]> git.rm.cloudns.org Git - voretournament/voretournament.git/commitdiff
Campaign mode hooks
authorMirceaKitsune <sonichedgehog_hyperblast00@yahoo.com>
Mon, 13 Sep 2010 15:40:23 +0000 (18:40 +0300)
committerMirceaKitsune <sonichedgehog_hyperblast00@yahoo.com>
Mon, 13 Sep 2010 15:40:23 +0000 (18:40 +0300)
data/qcsrc/client/Main.qc
data/qcsrc/client/View.qc
data/qcsrc/client/main.qh
data/qcsrc/server/cl_client.qc
data/qcsrc/server/g_world.qc

index d544424804dc281904e2e9a3b8dd10a11b047d2e..06bb675bccf968a3dfb7731325cf5a6eb51c758b 100644 (file)
@@ -208,9 +208,17 @@ void CSQC_Shutdown(void)
        if not(isdemo())\r
        {\r
                if not(calledhooks & HOOK_START)\r
+               {\r
                        localcmd("\n_cl_hook_gamestart nop;");\r
+                       if(g_campaign) // this is a server cvar used in the client code, but g_campaign is always local, so it should be safe\r
+                               localcmd("\n_cl_hook_campaign_gamestart nop;");\r
+               }\r
                if not(calledhooks & HOOK_END)\r
+               {\r
                        localcmd("\ncl_hook_gameend;");\r
+                       if(g_campaign)\r
+                               localcmd("\ncl_hook_campaign_gameend;");\r
+               }\r
        }\r
 }\r
 \r
@@ -947,6 +955,8 @@ void Gamemode_Init()
        if not(isdemo())\r
        {\r
                localcmd("\n_cl_hook_gamestart ", GametypeNameFromType(gametype), ";");\r
+               if(g_campaign)\r
+                       localcmd("\n_cl_hook_campaign_gamestart ", GametypeNameFromType(gametype), ";");\r
                calledhooks |= HOOK_START;\r
        }\r
 }\r
@@ -1009,6 +1019,8 @@ void Ent_Init()
                strunzone(forcefog);\r
        forcefog = strzone(ReadString());\r
 \r
+       g_campaign = ReadCoord();\r
+\r
        armorblockpercent = ReadByte() / 255.0;\r
 \r
        g_weaponswitchdelay = ReadByte() / 255.0;\r
index ecbb3ddda3eb54bbdddfd6783a66378a88449bb2..3da6dccdb0caec1d91bdc46bc72be629eae221c4 100644 (file)
@@ -325,6 +325,8 @@ void CSQC_UpdateView(float w, float h)
                if(calledhooks & HOOK_START)\r
                {\r
                        localcmd("\ncl_hook_gameend;");\r
+                       if(g_campaign)\r
+                               localcmd("\ncl_hook_campaign_gameend;");\r
                        calledhooks |= HOOK_END;\r
                }\r
 \r
index 3b6aadee953f62441ce3e16f2f41e28279a4014d..db40270fc22a0c4a04401b8b186999e8c9b880e1 100644 (file)
@@ -161,6 +161,8 @@ void centerprint(string strMessage);
 \r
 #define ALPHA_MIN_VISIBLE 0.003\r
 \r
+float g_campaign;\r
+\r
 float armorblockpercent;\r
 float g_weaponswitchdelay;\r
 \r
index c8109a7baf7c552228d64164fbde9d2790a3b669..d6898c8d7859e33099f9a1f077b18054fecdaab2 100644 (file)
@@ -1010,6 +1010,7 @@ float ClientInit_SendEntity(entity to, float sf)
                WriteString(MSG_ENTITY, world.fog);\r
        else\r
                WriteString(MSG_ENTITY, "");\r
+       WriteCoord(MSG_ENTITY, cvar("g_campaign"));\r
        WriteByte(MSG_ENTITY, cvar("g_balance_armor_blockpercent") * 255.0);\r
        WriteByte(MSG_ENTITY, cvar("g_balance_weaponswitchdelay") * 255.0);\r
 \r
index f6dc068f5c26450247e5af6bcd5cfb4d927c9bb1..e7df6cab3c1a6149a99ab3ec1d228a9008c560f5 100644 (file)
@@ -720,6 +720,8 @@ void spawnfunc_worldspawn (void)
        CheatInit();\r
 \r
        localcmd("\n_sv_hook_gamestart ", GetGametype(), ";");\r
+       if(cvar("g_campaign"))\r
+               localcmd("\n_sv_hook_campaign_gamestart ", GetGametype(), ";");\r
 \r
        world_initialized = 1;\r
 }\r
@@ -1453,6 +1455,8 @@ void NextLevel()
                CampaignPreIntermission();\r
 \r
        localcmd("\nsv_hook_gameend;");\r
+       if(cvar("g_campaign"))\r
+               localcmd("\nsv_hook_campaign_gameend;");\r
 }\r
 \r
 /*\r