]> git.rm.cloudns.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Add the new field respawn_flags and set it just when the player dies so there's no...
authorterencehill <piuntn@gmail.com>
Mon, 11 Mar 2013 16:43:46 +0000 (17:43 +0100)
committerterencehill <piuntn@gmail.com>
Mon, 11 Mar 2013 16:43:46 +0000 (17:43 +0100)
qcsrc/server/cl_client.qc
qcsrc/server/cl_player.qc
qcsrc/server/defs.qh
qcsrc/server/mutators/base.qh
qcsrc/server/mutators/gamemode_arena.qc
qcsrc/server/mutators/gamemode_ca.qc

index 574df368d2df71479c55a2d0555683c5c96745c1..111501cb06ebf69997990be944a30d1821897c74 100644 (file)
@@ -478,6 +478,7 @@ void PutObserverInServer (void)
        self.pauseregen_finished = 0;
        self.damageforcescale = 0;
        self.death_time = 0;
+       self.respawn_flags = 0;
        self.respawn_time = 0;
        self.stat_respawn_time = 0;
        self.alpha = 0;
@@ -765,6 +766,7 @@ void PutClientInServer (void)
                }
                self.damageforcescale = 2;
                self.death_time = 0;
+               self.respawn_flags = 0;
                self.respawn_time = 0;
                self.stat_respawn_time = 0;
                self.scale = 0;
@@ -2634,18 +2636,14 @@ void PlayerPreThink (void)
                        }
                        else
                        {
-                               float button_pressed, respawn_flags;
+                               float button_pressed;
                                if(frametime)
                                        player_anim();
                                button_pressed = (self.BUTTON_ATCK || self.BUTTON_JUMP || self.BUTTON_ATCK2 || self.BUTTON_HOOK || self.BUTTON_USE);
 
-                               respawn_flags = MUTATOR_CALLHOOK(GetRespawnFlags);
-                               if(g_lms || g_cts || autocvar_g_forced_respawn)
-                                       respawn_flags = respawn_flags | RESPAWN_FORCE;
-
                                if (self.deadflag == DEAD_DYING)
                                {
-                                       if(respawn_flags & RESPAWN_FORCE)
+                                       if(self.respawn_flags & RESPAWN_FORCE)
                                                self.deadflag = DEAD_RESPAWNING;
                                        else if(!button_pressed)
                                                self.deadflag = DEAD_DEAD;
@@ -2671,7 +2669,7 @@ void PlayerPreThink (void)
 
                                ShowRespawnCountdown();
 
-                               if(respawn_flags & RESPAWN_SILENT)
+                               if(self.respawn_flags & RESPAWN_SILENT)
                                        self.stat_respawn_time = 0;
                                else
                                        self.stat_respawn_time = self.respawn_time;
index 2c9a823a88634a86a64caf20e68d477496e3ccc2..3b6ba4bc53c2fa9ca2d8c63cbc883795610635b3 100644 (file)
@@ -661,11 +661,14 @@ void PlayerDamage (entity inflictor, entity attacker, float damage, float deatht
                        self.respawn_time = ceil((time + sdelay) / waves) * waves;
                else
                        self.respawn_time = time + sdelay;
-               self.stat_respawn_time = self.respawn_time;
                if((sdelay + waves >= 5.0) && (self.respawn_time - time > 1.75))
                        self.respawn_countdown = 10; // first number to count down from is 10
                else
                        self.respawn_countdown = -1; // do not count down
+
+               if(g_lms || g_cts || autocvar_g_forced_respawn)
+                       self.respawn_flags = self.respawn_flags | RESPAWN_FORCE;
+
                self.death_time = time;
                if (random() < 0.5)
                        animdecide_setstate(self, self.anim_state | ANIMSTATE_DEAD1, TRUE);
index 3281218ccb00ac50fa4ceff4700022a73c3447c9..db71b4a060693cfa304fad9b0f3fb946e877552f 100644 (file)
@@ -104,6 +104,7 @@ float server_is_dedicated;
 //.float cnt2;
 
 .float play_time;
+.float respawn_flags;
 .float respawn_time;
 .float death_time;
 .float fade_time;
index 06b5c0892bef1f23634f2815c151dc1fed180d98..d3d91232cf94c30fdacb9003eddea5167a816da4 100644 (file)
@@ -65,9 +65,6 @@ MUTATOR_HOOKABLE(ForbidPlayerScore_Clear);
 MUTATOR_HOOKABLE(ClientDisconnect);
        // called when a player disconnects
 
-MUTATOR_HOOKABLE(GetRespawnFlags);
-       // returns respawn flags
-
 MUTATOR_HOOKABLE(PlayerDies);
        // called when a player dies to e.g. remove stuff he was carrying.
        // INPUT:
index c561815ad0cbc9941b89541e57f755909059b9ba..c64886b914e8998950172b86c2f1bdd94910ba82 100644 (file)
@@ -204,14 +204,6 @@ MUTATOR_HOOKFUNCTION(arena_PlayerSpawn)
        return 1;
 }
 
-MUTATOR_HOOKFUNCTION(arena_GetRespawnFlags)
-{
-       // put dead players in the spawn queue
-       if(arena_roundbased)
-               return (RESPAWN_FORCE | RESPAWN_SILENT);
-       return RESPAWN_SILENT;
-}
-
 MUTATOR_HOOKFUNCTION(arena_ForbidPlayerScore_Clear)
 {
        return 1;
@@ -226,6 +218,11 @@ MUTATOR_HOOKFUNCTION(arena_GiveFragsForKill)
 
 MUTATOR_HOOKFUNCTION(arena_PlayerDies)
 {
+       // put dead players in the spawn queue
+       if(arena_roundbased)
+               self.respawn_flags = (RESPAWN_FORCE | RESPAWN_SILENT);
+       else
+               self.respawn_flags = RESPAWN_SILENT;
        Spawnqueue_Unmark(self);
        return 1;
 }
@@ -257,7 +254,6 @@ MUTATOR_DEFINITION(gamemode_arena)
        MUTATOR_HOOK(PutClientInServer, arena_PutClientInServer, CBC_ORDER_ANY);
        MUTATOR_HOOK(ClientConnect, arena_ClientConnect, CBC_ORDER_ANY);
        MUTATOR_HOOK(PlayerSpawn, arena_PlayerSpawn, CBC_ORDER_ANY);
-       MUTATOR_HOOK(GetRespawnFlags, arena_GetRespawnFlags, CBC_ORDER_ANY);
        MUTATOR_HOOK(ForbidPlayerScore_Clear, arena_ForbidPlayerScore_Clear, CBC_ORDER_ANY);
        MUTATOR_HOOK(GiveFragsForKill, arena_GiveFragsForKill, CBC_ORDER_ANY);
        MUTATOR_HOOK(PlayerDies, arena_PlayerDies, CBC_ORDER_ANY);
index c86aa6d9e7d7565e4976017677858589f60e9f0c..f00c4df39364a012c4fcee665251c63307a20d0e 100644 (file)
@@ -190,11 +190,11 @@ MUTATOR_HOOKFUNCTION(ca_GetTeamCount)
        return 1;
 }
 
-MUTATOR_HOOKFUNCTION(ca_GetRespawnFlags)
+MUTATOR_HOOKFUNCTION(ca_PlayerDies)
 {
        if(!allowed_to_spawn)
-               return RESPAWN_SILENT;
-       return 0;
+               self.respawn_flags =  RESPAWN_SILENT;
+       return 1;
 }
 
 MUTATOR_HOOKFUNCTION(ca_ForbidPlayerScore_Clear)
@@ -244,7 +244,7 @@ MUTATOR_DEFINITION(gamemode_ca)
        MUTATOR_HOOK(reset_map_global, ca_reset_map_global, CBC_ORDER_ANY);
        MUTATOR_HOOK(reset_map_players, ca_reset_map_players, CBC_ORDER_ANY);
        MUTATOR_HOOK(GetTeamCount, ca_GetTeamCount, CBC_ORDER_EXCLUSIVE);
-       MUTATOR_HOOK(GetRespawnFlags, ca_GetRespawnFlags, CBC_ORDER_ANY);
+       MUTATOR_HOOK(PlayerDies, ca_PlayerDies, CBC_ORDER_ANY);
        MUTATOR_HOOK(ForbidPlayerScore_Clear, ca_ForbidPlayerScore_Clear, CBC_ORDER_ANY);
        MUTATOR_HOOK(ForbidThrowCurrentWeapon, ca_ForbidThrowCurrentWeapon, CBC_ORDER_ANY);
        MUTATOR_HOOK(GiveFragsForKill, ca_GiveFragsForKill, CBC_ORDER_FIRST);