]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Merge branch 'master' into terencehill/gameover_stuff
authorterencehill <piuntn@gmail.com>
Thu, 3 Nov 2016 18:58:13 +0000 (19:58 +0100)
committerterencehill <piuntn@gmail.com>
Thu, 3 Nov 2016 18:58:13 +0000 (19:58 +0100)
24 files changed:
notifications.cfg
qcsrc/client/defs.qh
qcsrc/client/hud/panel/timer.qc
qcsrc/client/view.qc
qcsrc/common/mutators/mutator/nix/sv_nix.qc
qcsrc/common/mutators/mutator/overkill/sv_overkill.qc
qcsrc/common/notifications/all.inc
qcsrc/common/stats.qh
qcsrc/common/vehicles/vehicle/bumblebee.qc
qcsrc/common/vehicles/vehicle/racer.qc
qcsrc/common/vehicles/vehicle/raptor.qc
qcsrc/common/vehicles/vehicle/spiderbot.qc
qcsrc/server/bot/default/bot.qc
qcsrc/server/client.qc
qcsrc/server/command/vote.qc
qcsrc/server/defs.qh
qcsrc/server/g_hook.qc
qcsrc/server/g_world.qc
qcsrc/server/miscfunctions.qc
qcsrc/server/mutators/mutator/gamemode_assault.qc
qcsrc/server/mutators/mutator/gamemode_keyhunt.qc
qcsrc/server/player.qc
qcsrc/server/round_handler.qc
qcsrc/server/weapons/weaponsystem.qc

index 8583592b9acb74d11d24b8125b9b9caac23f0177..d57a9f2beb291ea5f1ad02c1d66a81bae8d82d24 100644 (file)
@@ -424,10 +424,11 @@ seta notification_INFO_WEAPON_TUBA_SUICIDE "1" "0 = off, 1 = print to console, 2
 seta notification_INFO_WEAPON_VAPORIZER_MURDER "1" "0 = off, 1 = print to console, 2 = print to console and chatbox (if notification_allow_chatboxprint is enabled)"
 seta notification_INFO_WEAPON_VORTEX_MURDER "1" "0 = off, 1 = print to console, 2 = print to console and chatbox (if notification_allow_chatboxprint is enabled)"
 
-// MSG_CENTER notifications (count = 230):
+// MSG_CENTER notifications (count = 231):
 seta notification_CENTER_ALONE "1" "0 = off, 1 = centerprint"
 seta notification_CENTER_ASSAULT_ATTACKING "1" "0 = off, 1 = centerprint"
 seta notification_CENTER_ASSAULT_DEFENDING "1" "0 = off, 1 = centerprint"
+seta notification_CENTER_ASSAULT_OBJ_DESTROYED "1" "0 = off, 1 = centerprint"
 seta notification_CENTER_CAMPCHECK "1" "0 = off, 1 = centerprint"
 seta notification_CENTER_COINTOSS "1" "0 = off, 1 = centerprint"
 seta notification_CENTER_COUNTDOWN_BEGIN "1" "0 = off, 1 = centerprint"
index 437e1dd75bab5538dc80c311102adcb7719a8ebd..309ed1d81572998098dcc40fdaad24ae72df6ba1 100644 (file)
@@ -120,7 +120,7 @@ int serverflags;
 
 float uid2name_dialog;
 
-float gameover_time;
+float intermission_time;
 
 .bool csqcmodel_isdead; // used by shownames and miscfunctions (entcs_IsDead) to know when a player is dead
 
index fab0392dc08938d19dd27046faf608e9f1241931..45f46b4087ad35da1c4cff70aabe9799a40463f6 100644 (file)
@@ -50,15 +50,15 @@ void HUD_Timer()
        }
 
        vector timer_color;
-       if(gameover_time || minutesLeft >= 5 || warmup_stage || timelimit == 0)
+       if(intermission_time || minutesLeft >= 5 || warmup_stage || timelimit == 0)
                timer_color = '1 1 1'; //white
        else if(minutesLeft >= 1)
                timer_color = '1 1 0'; //yellow
        else
                timer_color = '1 0 0'; //red
 
-       if (gameover_time) {
-               timer = seconds_tostring(max(0, floor(gameover_time - STAT(GAMESTARTTIME))));
+       if (intermission_time) {
+               timer = seconds_tostring(max(0, floor(intermission_time - STAT(GAMESTARTTIME))));
        } else if (autocvar_hud_panel_timer_increment || (!warmup_stage && timelimit == 0) || (warmup_stage && warmup_timeleft <= 0)) {
                if (time < STAT(GAMESTARTTIME))
                        timer = seconds_tostring(0); //while restart is still active, show 00:00
index 12f4c6a1d0e68e5b72ebb0a475d31c5dee265045..af1562d6267044fa8b9d6153340d0c35a9bbb065 100644 (file)
@@ -751,7 +751,7 @@ bool WantEventchase(entity this)
 {
        if(autocvar_cl_orthoview)
                return false;
-       if(intermission)
+       if(STAT(GAMEOVER) || intermission)
                return true;
        if(this.viewloc)
                return true;
@@ -944,7 +944,7 @@ void HUD_Crosshair(entity this)
 {
        float f, i, j;
        vector v;
-       if(!scoreboard_active && !camera_active && intermission != 2 &&
+       if(!scoreboard_active && !camera_active && intermission != 2 && !STAT(GAMEOVER) &&
                spectatee_status != -1 && !csqcplayer.viewloc && !MUTATOR_CALLHOOK(DrawCrosshair) &&
                !HUD_MinigameMenu_IsOpened() )
        {
@@ -1752,8 +1752,8 @@ void CSQC_UpdateView(entity this, float w, float h)
        if(!postinit)
                PostInit();
 
-       if(intermission && !gameover_time)
-               gameover_time = time;
+       if(intermission && !intermission_time)
+               intermission_time = time;
 
        if(intermission && !isdemo() && !(calledhooks & HOOK_END))
        {
index 39072cefc7d2ba0ab9697a9f3a104599b2a40dc9..5bb9fbc322a40b8d3b4891322a1e948b492f098d 100644 (file)
@@ -267,7 +267,7 @@ MUTATOR_HOOKFUNCTION(nix, PlayerPreThink)
 {
        entity player = M_ARGV(0, entity);
 
-       if(!intermission_running)
+       if(!gameover)
        if(!IS_DEAD(player))
        if(IS_PLAYER(player))
                NIX_GiveCurrentWeapon(player);
index d47da6c3c38ed43c3949eed8042f94941d8beef9..74a8c40ea0b7da37f8cbc2c7a6ceb05ecc89830a 100644 (file)
@@ -164,7 +164,7 @@ MUTATOR_HOOKFUNCTION(ok, ForbidThrowCurrentWeapon)
 
 MUTATOR_HOOKFUNCTION(ok, PlayerPreThink)
 {
-       if(intermission_running || gameover)
+       if(gameover)
                return;
 
        entity player = M_ARGV(0, entity);
index a6431cf673810c1625552fc2418c644738c3e8ad..92fd5df1ac37330b1479044e7ef1cb61280d3930 100644 (file)
 
     MSG_CENTER_NOTIF(ASSAULT_ATTACKING,                 1,      0, 0, "",               CPID_ASSAULT_ROLE,      "0 0",  _("^BGYou are attacking!"), "")
     MSG_CENTER_NOTIF(ASSAULT_DEFENDING,                 1,      0, 0, "",               CPID_ASSAULT_ROLE,      "0 0",  _("^BGYou are defending!"), "")
+    MSG_CENTER_NOTIF(ASSAULT_OBJ_DESTROYED,             1,      0, 1, "f1time",         CPID_ASSAULT_ROLE,      "0 0",  _("^BGObjective destroyed in ^F4%s^BG!"), "")
 
     MSG_CENTER_NOTIF(COUNTDOWN_BEGIN,                   1,      0, 0, "",               CPID_ROUND,             "2 0",  _("^F4Begin!"), "")
     MSG_CENTER_NOTIF(COUNTDOWN_GAMESTART,               1,      0, 1, "",               CPID_ROUND,             "1 f1", _("^F4Game starts in ^COUNT"), "")
index 82398aa56b1c7d40513bdfb5e735115a0e4087ee..b3459a67b9e5dcacfc4a33c0ce03b6a0fd47f1fb 100644 (file)
@@ -63,9 +63,10 @@ REGISTER_STAT(WEAPON_NEXTTHINK, float)
 #ifdef SVQC
 SPECTATE_COPYFIELD(_STAT(WEAPON_NEXTTHINK))
 float W_WeaponRateFactor(entity this);
+float gameover;
 #endif
 REGISTER_STAT(WEAPONRATEFACTOR, float, W_WeaponRateFactor(this))
-
+REGISTER_STAT(GAMEOVER, int, gameover)
 REGISTER_STAT(GAMESTARTTIME, float)
 REGISTER_STAT(STRENGTH_FINISHED, float)
 REGISTER_STAT(INVINCIBLE_FINISHED, float)
index 3f5f40435819d6de9b7f748eeb7724af411623c6..95cc74802ceab386bc8611a277e9c9f3bd4eec04 100644 (file)
@@ -391,7 +391,7 @@ bool bumblebee_pilot_frame(entity this, float dt)
        entity vehic = this.vehicle;
        return = true;
 
-       if(intermission_running)
+       if(gameover)
        {
                vehic.solid = SOLID_NOT;
                vehic.takedamage = DAMAGE_NO;
index 41a31743f621d94fcd8c35db61f72d499feeeded..caec3b0b7077c07c83fc5bc0c36f901419b97f1b 100644 (file)
@@ -151,7 +151,7 @@ bool racer_frame(entity this, float dt)
        entity vehic = this.vehicle;
        return = true;
 
-       if(intermission_running)
+       if(gameover)
        {
                vehic.solid = SOLID_NOT;
                vehic.takedamage = DAMAGE_NO;
index 1068e7430dd47a8cc36b008575f2077b98071d9e..7c433f9c76f69dce59cbdba280418880c8210fe1 100644 (file)
@@ -133,7 +133,7 @@ bool raptor_frame(entity this, float dt)
        entity vehic = this.vehicle;
        return = true;
 
-       if(intermission_running)
+       if(gameover)
        {
                vehic.solid = SOLID_NOT;
                vehic.takedamage = DAMAGE_NO;
index 347d2120aa1a17155db038821fbfcdc6f880c5f8..fcdd638b38e1c20fff54b81161288bc9fd78907f 100644 (file)
@@ -48,7 +48,7 @@ bool spiderbot_frame(entity this, float dt)
        entity vehic = this.vehicle;
        return = true;
 
-       if(intermission_running)
+       if(gameover)
        {
                vehic.solid = SOLID_NOT;
                vehic.takedamage = DAMAGE_NO;
index 2a7478dee2d7688322dfa3006b4534957159bcd3..d4ef331ef4e82d5e0d7edc60fffd13845dd3bbbf 100644 (file)
@@ -632,7 +632,7 @@ float bot_fixcount()
 
 void bot_serverframe()
 {
-       if (intermission_running)
+       if (gameover)
                return;
 
        if (time < 2)
index da66ece3bb813fa6776d5c9ad183311ba63218af..445e35f5b19fbb35c8d87be4f6041674646cf709 100644 (file)
@@ -284,8 +284,8 @@ void PutObserverInServer(entity this)
        if (this.killcount != FRAGS_SPECTATOR)
        {
                Send_Notification(NOTIF_ALL, NULL, MSG_INFO, INFO_QUIT_SPECTATE, this.netname);
-               if(!intermission_running)
-               if(autocvar_g_chat_nospectators == 1 || (!(warmup_stage || gameover) && autocvar_g_chat_nospectators == 2))
+               if(!gameover)
+               if(autocvar_g_chat_nospectators == 1 || (!warmup_stage && autocvar_g_chat_nospectators == 2))
                        Send_Notification(NOTIF_ONE_ONLY, this, MSG_INFO, INFO_CHAT_NOSPECTATORS);
 
                if(this.just_joined == false) {
@@ -2315,8 +2315,9 @@ void PlayerPreThink (entity this)
        if (IS_PLAYER(this)) {
                CheckRules_Player(this);
 
-               if (intermission_running) {
-                       IntermissionThink(this);
+               if (gameover || intermission_running) {
+                       if(intermission_running)
+                               IntermissionThink(this);
                        return;
                }
 
@@ -2467,8 +2468,9 @@ void PlayerPreThink (entity this)
 
                this.dmg_team = max(0, this.dmg_team - autocvar_g_teamdamage_resetspeed * frametime);
        }
-       else if (gameover) {
-               if (intermission_running) IntermissionThink(this);
+       else if (gameover || intermission_running) {
+               if(intermission_running)
+                       IntermissionThink(this);
                return;
        }
        else if (IS_OBSERVER(this)) {
@@ -2610,13 +2612,23 @@ void PlayerPostThink (entity this)
        CheatFrame(this);
 
        //CheckPlayerJump();
+       if (gameover)
+       {
+               this.solid = SOLID_NOT;
+               this.takedamage = DAMAGE_NO;
+               set_movetype(this, MOVETYPE_NONE);
+       }
 
        if (IS_PLAYER(this)) {
                DrownPlayer(this);
                CheckRules_Player(this);
                UpdateChatBubble(this);
                if (this.impulse) ImpulseCommands(this);
-               if (intermission_running) return; // intermission or finale
+               if (gameover)
+               {
+                       CSQCMODEL_AUTOUPDATE(this);
+                       return;
+               }
                GetPressedKeys(this);
        }
 
index d1cdb7e59db5a2c766aeb76ef907c7a5a198f64b..ebef7e1375d3ddc6a68b37f5a0f91758702e8624 100644 (file)
@@ -456,7 +456,7 @@ void ReadyRestart_force()
 void ReadyRestart()
 {
        // no assault support yet...
-       if (g_assault | gameover | intermission_running | race_completing) localcmd("restart\n");
+       if (g_assault || gameover || race_completing) localcmd("restart\n");
        else localcmd("\nsv_hook_gamerestart\n");
 
        // Reset ALL scores, but only do that at the beginning of the countdown if sv_ready_restart_after_countdown is off!
index 52153fcd7edeedaf2b7c3aec557103786fcca343..fedd5eb1ab346354f6121da51fa247627a5de039 100644 (file)
@@ -129,7 +129,6 @@ const int W_TICSPERFRAME = 2;
 
 void weapon_defaultspawnfunc(entity this, Weapon e);
 
-float gameover;
 float intermission_running;
 float intermission_exittime;
 float alreadychangedlevel;
index fd725ad35e8b128a3e78521e0d46913e64f6134e..cccba42bb42128fff96050498f317875c050c360 100644 (file)
@@ -144,7 +144,7 @@ void GrapplingHookThink(entity this)
                error("Owner lost the hook!\n");
                return;
        }
-       if(LostMovetypeFollow(this) || intermission_running || (round_handler_IsActive() && !round_handler_IsRoundStarted()) || ((this.aiment.flags & FL_PROJECTILE) && this.aiment.classname != "nade"))
+       if(LostMovetypeFollow(this) || gameover || (round_handler_IsActive() && !round_handler_IsRoundStarted()) || ((this.aiment.flags & FL_PROJECTILE) && this.aiment.classname != "nade"))
        {
                RemoveGrapplingHook(this.realowner);
                return;
index 8edcf3b8f58f7b0010efffabd1279ab4c6d9ab9f..4ca9ef77c8afb16b1b5fab0190bc1cbd1770e8f5 100644 (file)
@@ -1308,7 +1308,6 @@ When the player presses attack or jump, change to the next level
 void IntermissionThink(entity this)
 {
        FixIntermissionClient(this);
-       CSQCMODEL_AUTOUPDATE(this); // PlayerPostThink returns before calling this during intermission, so run it here
 
        float server_screenshot = (autocvar_sv_autoscreenshot && this.cvar_cl_autoscreenshot);
        float client_screenshot = (this.cvar_cl_autoscreenshot == 2);
@@ -1496,9 +1495,6 @@ void FixIntermissionClient(entity e)
                e.autoscreenshot = time + 0.8;  // used for autoscreenshot
                e.health = -2342;
                // first intermission phase; voting phase has positive health (used to decide whether to send SVC_FINALE or not)
-               e.solid = SOLID_NOT;
-               set_movetype(e, MOVETYPE_NONE);
-               e.takedamage = DAMAGE_NO;
                for (int slot = 0; slot < MAX_WEAPONSLOTS; ++slot)
                {
                    .entity weaponentity = weaponentities[slot];
@@ -1536,7 +1532,7 @@ void NextLevel()
 
        intermission_running = 1;
 
-// enforce a wait time before allowing changelevel
+       // enforce a wait time before allowing changelevel
        if(player_count > 0)
                intermission_exittime = time + autocvar_sv_mapchange_delay;
        else
@@ -1843,7 +1839,7 @@ void CheckRules_World()
 
        SetDefaultAlpha();
 
-       if (gameover)   // someone else quit the game already
+       if (intermission_running) // someone else quit the game already
        {
                if(player_count == 0) // Nobody there? Then let's go to the next map
                        MapVote_Start();
index e90dbeb9669a81e00cc94cb6651094e015081c4d..51e8fb42d5e49779f82a6c2dbfa64ef99f9df4f1 100644 (file)
@@ -458,7 +458,7 @@ void GetCvars(entity this, int f)
 string playername(entity p)
 {
     string t;
-    if (teamplay && !intermission_running && IS_PLAYER(p))
+    if (teamplay && !gameover && IS_PLAYER(p))
     {
         t = Team_ColorCode(p.team);
         return strcat(t, strdecolorize(p.netname));
index 1a1d7959fd2799b4e3908d3e13736b314106aced..d92e77158c3f8b18e011f9347c97df0e3c9edac7 100644 (file)
@@ -1,6 +1,7 @@
 #include "gamemode_assault.qh"
 
 .entity sprite;
+#define AS_ROUND_DELAY 5
 
 // random functions
 void assault_objective_use(entity this, entity actor, entity trigger)
@@ -202,14 +203,27 @@ void assault_new_round(entity this)
        });
 
        // reset the level with a countdown
-       cvar_set("timelimit", ftos(ceil(time - game_starttime) / 60));
+       cvar_set("timelimit", ftos(ceil(time - AS_ROUND_DELAY - game_starttime) / 60));
        ReadyRestart_force(); // sets game_starttime
 }
 
+entity as_round;
+.entity ent_winning;
+void as_round_think()
+{
+       gameover = false;
+       assault_new_round(as_round.ent_winning);
+       delete(as_round);
+       as_round = NULL;
+}
+
 // Assault winning condition: If the attackers triggered a round end (by fulfilling all objectives)
 // they win. Otherwise the defending team wins once the timelimit passes.
 int WinningCondition_Assault()
 {
+       if(as_round)
+               return WINNING_NO;
+
        WinningConditionHelper(NULL); // set worldstatus
 
        int status = WINNING_NO;
@@ -229,7 +243,7 @@ int WinningCondition_Assault()
        {
                if(ent.winning) // round end has been triggered by attacking team
                {
-                       bprint("ASSAULT: round completed...\n");
+                       bprint("Assault: round completed.\n");
                        SetWinners(team, assault_attacker_team);
 
                        TeamScore_AddToTeam(assault_attacker_team, ST_ASSAULT_OBJECTIVES, 666 - TeamScore_AddToTeam(assault_attacker_team, ST_ASSAULT_OBJECTIVES, 0));
@@ -240,7 +254,17 @@ int WinningCondition_Assault()
                        }
                        else
                        {
-                               assault_new_round(ent);
+                               Send_Notification(NOTIF_ALL, NULL, MSG_CENTER, CENTER_ASSAULT_OBJ_DESTROYED, ceil(time - game_starttime));
+                               as_round = new(as_round);
+                               as_round.think = as_round_think;
+                               as_round.ent_winning = ent;
+                               as_round.nextthink = time + AS_ROUND_DELAY;
+                               gameover = true;
+
+                               // make sure timelimit isn't hit while the game is blocked
+                               if(autocvar_timelimit > 0)
+                               if(time + AS_ROUND_DELAY >= game_starttime + autocvar_timelimit * 60)
+                                       cvar_set("timelimit", ftos(autocvar_timelimit + AS_ROUND_DELAY / 60));
                        }
                }
        }
index 944311598090c80e7f19f489ed2631ff52d1ff47..f7bf6602d16dbfa610e571481791c6d611c2a8d5 100644 (file)
@@ -156,7 +156,7 @@ void kh_Controller_SetThink(float t, kh_Think_t func)  // runs occasionaly
 void kh_WaitForPlayers();
 void kh_Controller_Think(entity this)  // called a lot
 {
-       if(intermission_running)
+       if(gameover)
                return;
        if(this.cnt > 0)
        { if(getthink(this) != kh_WaitForPlayers) { this.cnt -= 1; } }
@@ -173,7 +173,7 @@ void kh_Controller_Think(entity this)  // called a lot
 void kh_Scores_Event(entity player, entity key, string what, float frags_player, float frags_owner)  // update the score when a key is captured
 {
        string s;
-       if(intermission_running)
+       if(gameover)
                return;
 
        if(frags_player)
@@ -448,7 +448,7 @@ void kh_Key_Collect(entity key, entity player)  //a player picks up a dropped ke
 
 void kh_Key_Touch(entity this, entity toucher)  // runs many, many times when a key has been dropped and can be picked up
 {
-       if(intermission_running)
+       if(gameover)
                return;
 
        if(this.owner) // already carried
@@ -671,7 +671,7 @@ void kh_LoserTeam(float teem, entity lostkey)  // runs when a player pushes a fl
 
 void kh_Key_Think(entity this)  // runs all the time
 {
-       if(intermission_running)
+       if(gameover)
                return;
 
        if(this.owner)
index 77eae0aa20c516594e1e5b71c43f637468a83a2b..a80216e755e7395ffc7fa0a8a5f915d4e12caa3f 100644 (file)
@@ -704,7 +704,7 @@ int Say(entity source, int teamsay, entity privatesay, string msgin, bool floodc
                teamsay = false;
        }
 
-       if(intermission_running)
+       if(gameover)
                teamsay = false;
 
     if (!source) {
@@ -881,9 +881,9 @@ int Say(entity source, int teamsay, entity privatesay, string msgin, bool floodc
 
        if (!privatesay && source && !IS_PLAYER(source))
        {
-               if (!intermission_running)
-                       if(teamsay || (autocvar_g_chat_nospectators == 1) || (autocvar_g_chat_nospectators == 2 && !(warmup_stage || gameover)))
-                               teamsay = -1; // spectators
+               if (!gameover)
+               if (teamsay || (autocvar_g_chat_nospectators == 1) || (autocvar_g_chat_nospectators == 2 && !warmup_stage))
+                       teamsay = -1; // spectators
        }
 
        if(flood)
index 3b11c5f9b6f409e0d51948286cab7160041b3270..d060d2cca859590ce3ee92e1966daca1f1464e83 100644 (file)
@@ -12,6 +12,9 @@ void round_handler_Think(entity this)
        }
 
        if (gameover)
+               gameover = false;
+
+       if (intermission_running)
        {
                round_handler_Reset(0);
                round_handler_Remove();
@@ -55,6 +58,7 @@ void round_handler_Think(entity this)
                        // schedule a new round
                        this.wait = true;
                        this.nextthink = time + this.delay;
+                       gameover = true;
                }
                else
                {
index c0d302e2232123e9e3c049eed1965f27d750cf7b..7dbdae6838cb2d5adcd632b9f67404b1f9359021 100644 (file)
@@ -67,7 +67,7 @@ vector CL_Weapon_GetShotOrg(int wpn)
 void CL_Weaponentity_Think(entity this)
 {
        this.nextthink = time;
-       if (intermission_running) this.frame = this.anim_idle.x;
+       if (gameover) this.frame = this.anim_idle.x;
        .entity weaponentity = this.weaponentity_fld;
        if (this.owner.(weaponentity) != this)
        {