From 92aac3489f9ae69517327645cf28ba658fb4b92c Mon Sep 17 00:00:00 2001 From: Marco Hladik Date: Sun, 26 Apr 2020 20:57:13 +0200 Subject: [PATCH] Counter-Strike: Added intermission logic. --- src/server/cstrike/gamerules_multiplayer.cpp | 11 +++------ src/server/cstrike/input.c | 7 ++++++ src/shared/cstrike/w_mp5.c | 4 +-- src/shared/cstrike/w_para.c | 4 +-- src/shared/valve/weapon_common.c | 26 ++++++++++++++++++++ 5 files changed, 41 insertions(+), 11 deletions(-) diff --git a/src/server/cstrike/gamerules_multiplayer.cpp b/src/server/cstrike/gamerules_multiplayer.cpp index 036afe8e..d0ee2ede 100644 --- a/src/server/cstrike/gamerules_multiplayer.cpp +++ b/src/server/cstrike/gamerules_multiplayer.cpp @@ -271,22 +271,19 @@ CSMultiplayerRules::TimerUpdate(void) if (g_cs_gamestate != GAME_OVER) { if (cvar("mp_timelimit") > 0) { if (time >= (cvar("mp_timelimit") * 60)) { - TimerBegin(5, GAME_OVER); + IntermissionStart(); + g_cs_gamestate = GAME_OVER; } } } - if ((g_cs_gamestate == GAME_OVER) && (g_cs_gametime < 0)) { - localcmd("echo nextmap\n"); - } - // Okay, this means that timelimit is not the only deciding factor if (autocvar_mp_winlimit > 0 && g_cs_gamestate != GAME_OVER) { // It really doesn't matter who won. Do some logging perhaps? if (g_cs_roundswon_ct == autocvar_mp_winlimit) { - TimerBegin(5, GAME_OVER); + IntermissionStart(); } else if (g_cs_roundswon_t == autocvar_mp_winlimit) { - TimerBegin(5, GAME_OVER); + IntermissionStart(); } } diff --git a/src/server/cstrike/input.c b/src/server/cstrike/input.c index 321aa81d..8c69cbb8 100644 --- a/src/server/cstrike/input.c +++ b/src/server/cstrike/input.c @@ -17,6 +17,13 @@ void Game_Input(void) { + CGameRules rules = (CGameRules)g_grMode; + + if (rules.m_iIntermission) { + rules.IntermissionEnd(); + return; + } + if (input_buttons & INPUT_BUTTON0) { Weapons_Primary(); } else if (input_buttons & INPUT_BUTTON4) { diff --git a/src/shared/cstrike/w_mp5.c b/src/shared/cstrike/w_mp5.c index 6aef7517..b275a10c 100644 --- a/src/shared/cstrike/w_mp5.c +++ b/src/shared/cstrike/w_mp5.c @@ -14,7 +14,7 @@ * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ -/*QUAKED weapon_mp5 (0 0 1) (-16 -16 0) (16 16 32) +/*QUAKED weapon_mp5navy (0 0 1) (-16 -16 0) (16 16 32) "model" "models/w_mp5.mdl" COUNTER-STRIKE (1999) ENTITY @@ -251,7 +251,7 @@ w_mp5_hudpic(int selected, vector pos, float a) weapon_t w_mp5 = { - "mp5", + "mp5navy", ITEM_MP5, 0, 2, diff --git a/src/shared/cstrike/w_para.c b/src/shared/cstrike/w_para.c index 5153857e..0936b9e4 100644 --- a/src/shared/cstrike/w_para.c +++ b/src/shared/cstrike/w_para.c @@ -243,7 +243,7 @@ w_para_hudpic(int selected, vector pos, float a) weapon_t w_para = { - "para", + "m249", ITEM_PARA, 0, 15, @@ -267,7 +267,7 @@ weapon_t w_para = #ifdef SERVER void -weapon_para(void) +weapon_m249(void) { Weapons_InitItem(WEAPON_PARA); } diff --git a/src/shared/valve/weapon_common.c b/src/shared/valve/weapon_common.c index a67f26d3..0da42429 100644 --- a/src/shared/valve/weapon_common.c +++ b/src/shared/valve/weapon_common.c @@ -20,6 +20,32 @@ void Decals_Init(void); void Weapons_Init(void) { + /* in the future we'll have no internal weapon table, then this will fill + * one up... */ + /*searchhandle sh; + filestream fh; + string line; + sh = search_begin("scripts/weapon_*.txt", TRUE, TRUE); + for (int i = 0; i < search_getsize(sh); i++) { + fh = fopen(search_getfilename(sh, i), FILE_READ); + if (fh < 0) { + continue; + } + + while ((line = fgets(fh))) { + int w = tokenize(line); + switch (argv(0)) { + case "name": + break; + case "slot": + break; + case "slot_pos": + break; + } + } + fclose(fh); + }*/ + for (int i = 0; i < g_weapons.length; i++) { if (g_weapons[i].precache != __NULL__) { g_weapons[i].precache();