From 31c3c6cf4cb9cda00334526413a128196c3936e7 Mon Sep 17 00:00:00 2001 From: Mario Date: Mon, 4 Jul 2016 09:18:28 +1000 Subject: [PATCH] Clean up respawn check --- qcsrc/server/cl_client.qc | 54 ++++++++++++++++++++++++--------------- 1 file changed, 33 insertions(+), 21 deletions(-) diff --git a/qcsrc/server/cl_client.qc b/qcsrc/server/cl_client.qc index d813391bd..1cc143d74 100644 --- a/qcsrc/server/cl_client.qc +++ b/qcsrc/server/cl_client.qc @@ -2215,27 +2215,39 @@ void PlayerPreThink (entity this) if (frametime) player_anim(this); bool button_pressed = (PHYS_INPUT_BUTTON_ATCK(this) || PHYS_INPUT_BUTTON_JUMP(this) || PHYS_INPUT_BUTTON_ATCK2(this) || PHYS_INPUT_BUTTON_HOOK(this) || PHYS_INPUT_BUTTON_USE(this)); - if (this.deadflag == DEAD_DYING) { - if ((this.respawn_flags & RESPAWN_FORCE) && !(this.respawn_time < this.respawn_time_max)) { - this.deadflag = DEAD_RESPAWNING; - } else if (!button_pressed) { - this.deadflag = DEAD_DEAD; - } - } else if (this.deadflag == DEAD_DEAD) { - if (button_pressed) { - this.deadflag = DEAD_RESPAWNABLE; - } else if (time >= this.respawn_time_max && (this.respawn_flags & RESPAWN_FORCE)) { - this.deadflag = DEAD_RESPAWNING; - } - } else if (this.deadflag == DEAD_RESPAWNABLE) { - if (!button_pressed) { - this.deadflag = DEAD_RESPAWNING; - } - } else if (this.deadflag == DEAD_RESPAWNING) { - if (time > this.respawn_time) { - this.respawn_time = time + 1; // only retry once a second - this.respawn_time_max = this.respawn_time; - respawn(this); + switch(this.deadflag) + { + case DEAD_DYING: + { + if ((this.respawn_flags & RESPAWN_FORCE) && !(this.respawn_time < this.respawn_time_max)) + this.deadflag = DEAD_RESPAWNING; + else if (!button_pressed || (this.respawn_flags & RESPAWN_FORCE)) + this.deadflag = DEAD_DEAD; + break; + } + case DEAD_DEAD: + { + if (button_pressed) + this.deadflag = DEAD_RESPAWNABLE; + else if (time >= this.respawn_time_max && (this.respawn_flags & RESPAWN_FORCE)) + this.deadflag = DEAD_RESPAWNING; + break; + } + case DEAD_RESPAWNABLE: + { + if (!button_pressed || (this.respawn_flags & RESPAWN_FORCE)) + this.deadflag = DEAD_RESPAWNING; + break; + } + case DEAD_RESPAWNING: + { + if (time > this.respawn_time) + { + this.respawn_time = time + 1; // only retry once a second + this.respawn_time_max = this.respawn_time; + respawn(this); + } + break; } } -- 2.39.2