fixed jittering when dead

This commit is contained in:
Magnus Auvinen 2007-11-26 20:58:44 +00:00
parent 0cf8d662d6
commit dd9118573d
2 changed files with 22 additions and 27 deletions

View file

@ -1747,10 +1747,13 @@ void render_scoreboard(float x, float y, float w, int team, const char *title)
{
gfx_pretty_text(x+10, y, 64, title, -1);
char buf[128];
sprintf(buf, "%d", gameobj->teamscore[team&1]);
tw = gfx_pretty_text_width(64, buf, -1);
gfx_pretty_text(x+w-tw-40, y, 64, buf, -1);
if(gameobj)
{
char buf[128];
sprintf(buf, "%d", gameobj->teamscore[team&1]);
tw = gfx_pretty_text_width(64, buf, -1);
gfx_pretty_text(x+w-tw-40, y, 64, buf, -1);
}
}
y += 64.0f;
@ -1965,7 +1968,14 @@ void render_game()
bool spectate = false;
if(config.cl_predict)
local_character_pos = mix(predicted_prev_player.pos, predicted_player.pos, client_intrapredtick());
{
if(!local_character || (local_character->health < 0) || (gameobj && gameobj->game_over))
{
// don't use predicted
}
else
local_character_pos = mix(predicted_prev_player.pos, predicted_player.pos, client_intrapredtick());
}
else if(local_character && local_prev_character)
{
local_character_pos = mix(
@ -2616,7 +2626,7 @@ void render_game()
// render score board
if(inp_key_pressed(KEY_TAB) || // user requested
(!spectate && (local_character && local_character->health == -1)) || // not spectating and is dead
(!spectate && (!local_character || local_character->health < 0)) || // not spectating and is dead
(gameobj && gameobj->game_over) // game over
)
{

View file

@ -960,20 +960,6 @@ void player::tick()
// handle weapons
handle_weapons();
/*
if (!(retflags & (MODIFIER_RETURNFLAGS_OVERRIDEVELOCITY | MODIFIER_RETURNFLAGS_OVERRIDEPOSITION)))
{
// add gravity
//if (!(retflags & MODIFIER_RETURNFLAGS_OVERRIDEGRAVITY))
//vel.y += gravity;
// do the move
defered_pos = pos;
move_box(&core.pos, &vel, vec2(phys_size, phys_size), 0);
}*/
//defered_pos = core.pos;
//jumped = core.jumped;
state = input.state;
@ -984,19 +970,18 @@ void player::tick()
void player::tick_defered()
{
core.move();
core.quantize();
//dbg_msg("", "%d %.0f,%.0f -> %.0f,%.0f", client_id, pos.x, pos.y, core.pos.x, core.pos.y);
pos = core.pos;
if(!dead)
{
core.move();
core.quantize();
pos = core.pos;
}
if(team == -1)
{
pos.x = input.target_x;
pos.y = input.target_y;
}
// apply the new position
//pos = defered_pos;
}
void player::die(int killer, int weapon)