diff options
| author | Magnus Auvinen <magnus.auvinen@gmail.com> | 2007-11-26 20:58:44 +0000 |
|---|---|---|
| committer | Magnus Auvinen <magnus.auvinen@gmail.com> | 2007-11-26 20:58:44 +0000 |
| commit | dd9118573d521fe6b382b1248bc7529f38bdec4f (patch) | |
| tree | c0f40a1ee3b8d0021f6e6cb53ba271af6cf37fe4 /src/game | |
| parent | 0cf8d662d60f9f8ff838699eef34c180a5264550 (diff) | |
| download | zcatch-dd9118573d521fe6b382b1248bc7529f38bdec4f.tar.gz zcatch-dd9118573d521fe6b382b1248bc7529f38bdec4f.zip | |
fixed jittering when dead
Diffstat (limited to 'src/game')
| -rw-r--r-- | src/game/client/game_client.cpp | 22 | ||||
| -rw-r--r-- | src/game/server/game_server.cpp | 27 |
2 files changed, 22 insertions, 27 deletions
diff --git a/src/game/client/game_client.cpp b/src/game/client/game_client.cpp index b7a7b8d7..8c2ff777 100644 --- a/src/game/client/game_client.cpp +++ b/src/game/client/game_client.cpp @@ -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 ) { diff --git a/src/game/server/game_server.cpp b/src/game/server/game_server.cpp index b8b23960..84ab162a 100644 --- a/src/game/server/game_server.cpp +++ b/src/game/server/game_server.cpp @@ -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) |