From: MirceaKitsune Date: Mon, 13 Sep 2010 15:40:23 +0000 (+0300) Subject: Campaign mode hooks X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=64cbbc9cd75db2d7d8251e26d84e197cad389543;p=voretournament%2Fvoretournament.git Campaign mode hooks --- diff --git a/data/qcsrc/client/Main.qc b/data/qcsrc/client/Main.qc index d5444248..06bb675b 100644 --- a/data/qcsrc/client/Main.qc +++ b/data/qcsrc/client/Main.qc @@ -208,9 +208,17 @@ void CSQC_Shutdown(void) if not(isdemo()) { if not(calledhooks & HOOK_START) + { localcmd("\n_cl_hook_gamestart nop;"); + if(g_campaign) // this is a server cvar used in the client code, but g_campaign is always local, so it should be safe + localcmd("\n_cl_hook_campaign_gamestart nop;"); + } if not(calledhooks & HOOK_END) + { localcmd("\ncl_hook_gameend;"); + if(g_campaign) + localcmd("\ncl_hook_campaign_gameend;"); + } } } @@ -947,6 +955,8 @@ void Gamemode_Init() if not(isdemo()) { localcmd("\n_cl_hook_gamestart ", GametypeNameFromType(gametype), ";"); + if(g_campaign) + localcmd("\n_cl_hook_campaign_gamestart ", GametypeNameFromType(gametype), ";"); calledhooks |= HOOK_START; } } @@ -1009,6 +1019,8 @@ void Ent_Init() strunzone(forcefog); forcefog = strzone(ReadString()); + g_campaign = ReadCoord(); + armorblockpercent = ReadByte() / 255.0; g_weaponswitchdelay = ReadByte() / 255.0; diff --git a/data/qcsrc/client/View.qc b/data/qcsrc/client/View.qc index ecbb3ddd..3da6dccd 100644 --- a/data/qcsrc/client/View.qc +++ b/data/qcsrc/client/View.qc @@ -325,6 +325,8 @@ void CSQC_UpdateView(float w, float h) if(calledhooks & HOOK_START) { localcmd("\ncl_hook_gameend;"); + if(g_campaign) + localcmd("\ncl_hook_campaign_gameend;"); calledhooks |= HOOK_END; } diff --git a/data/qcsrc/client/main.qh b/data/qcsrc/client/main.qh index 3b6aadee..db40270f 100644 --- a/data/qcsrc/client/main.qh +++ b/data/qcsrc/client/main.qh @@ -161,6 +161,8 @@ void centerprint(string strMessage); #define ALPHA_MIN_VISIBLE 0.003 +float g_campaign; + float armorblockpercent; float g_weaponswitchdelay; diff --git a/data/qcsrc/server/cl_client.qc b/data/qcsrc/server/cl_client.qc index c8109a7b..d6898c8d 100644 --- a/data/qcsrc/server/cl_client.qc +++ b/data/qcsrc/server/cl_client.qc @@ -1010,6 +1010,7 @@ float ClientInit_SendEntity(entity to, float sf) WriteString(MSG_ENTITY, world.fog); else WriteString(MSG_ENTITY, ""); + WriteCoord(MSG_ENTITY, cvar("g_campaign")); WriteByte(MSG_ENTITY, cvar("g_balance_armor_blockpercent") * 255.0); WriteByte(MSG_ENTITY, cvar("g_balance_weaponswitchdelay") * 255.0); diff --git a/data/qcsrc/server/g_world.qc b/data/qcsrc/server/g_world.qc index f6dc068f..e7df6cab 100644 --- a/data/qcsrc/server/g_world.qc +++ b/data/qcsrc/server/g_world.qc @@ -720,6 +720,8 @@ void spawnfunc_worldspawn (void) CheatInit(); localcmd("\n_sv_hook_gamestart ", GetGametype(), ";"); + if(cvar("g_campaign")) + localcmd("\n_sv_hook_campaign_gamestart ", GetGametype(), ";"); world_initialized = 1; } @@ -1453,6 +1455,8 @@ void NextLevel() CampaignPreIntermission(); localcmd("\nsv_hook_gameend;"); + if(cvar("g_campaign")) + localcmd("\nsv_hook_campaign_gameend;"); } /*