From f621ff05e10cff50d3698148d82e9a2f383a9545 Mon Sep 17 00:00:00 2001 From: jeefo Date: Sun, 3 Jan 2016 23:18:47 +0300 Subject: [PATCH] fixed incorrent player_weaponstrip "fix" remove set_model call for csdm, as it useless --- source/interface.cpp | 35 +++++++++++++++++++++++++---------- source/manager.cpp | 11 +---------- 2 files changed, 26 insertions(+), 20 deletions(-) diff --git a/source/interface.cpp b/source/interface.cpp index e7b327a..a6ae69b 100644 --- a/source/interface.cpp +++ b/source/interface.cpp @@ -972,7 +972,10 @@ int Spawn (edict_t *ent) // Spawn() function is one of the functions any entity is supposed to have in the game DLL, // and any MOD is supposed to implement one for each of its entities. - if (strcmp (STRING (ent->v.classname), "worldspawn") == 0) + // for faster access + const char *entityClassname = STRING (ent->v.classname); + + if (strcmp (entityClassname, "worldspawn") == 0) { g_worldEntity = ent; // save the world entity for future use @@ -993,10 +996,22 @@ int Spawn (edict_t *ent) g_mapType = NULL; // reset map type as worldspawn is the first entity spawned } - else if (strcmp (STRING (ent->v.classname), "player_weaponstrip") == 0 && (STRING (ent->v.target))[0] == '0') - ent->v.target = ent->v.targetname = ALLOC_STRING ("fake"); + else if (strcmp (entityClassname, "player_weaponstrip") == 0) + { + if (g_gameVersion == CSV_OLD) + ent->v.target = ent->v.targetname = ALLOC_STRING ("fake"); + else + { + REMOVE_ENTITY (ent); + + if (g_isMetamod) + RETURN_META_VALUE (MRES_SUPERCEDE, 0); + + return 0; + } + } #ifndef XASH_CSDM - else if (strcmp (STRING (ent->v.classname), "info_player_start") == 0) + else if (strcmp (entityClassname, "info_player_start") == 0) { SET_MODEL (ent, ENGINE_STR ("models/player/urban/urban.mdl")); @@ -1004,7 +1019,7 @@ int Spawn (edict_t *ent) ent->v.renderamt = 127; // set its transparency amount ent->v.effects |= EF_NODRAW; } - else if (strcmp (STRING (ent->v.classname), "info_player_deathmatch") == 0) + else if (strcmp (entityClassname, "info_player_deathmatch") == 0) { SET_MODEL (ent, ENGINE_STR ("models/player/terror/terror.mdl")); @@ -1013,7 +1028,7 @@ int Spawn (edict_t *ent) ent->v.effects |= EF_NODRAW; } - else if (strcmp (STRING (ent->v.classname), "info_vip_start") == 0) + else if (strcmp (entityClassname, "info_vip_start") == 0) { SET_MODEL (ent, ENGINE_STR ("models/player/vip/vip.mdl")); @@ -1022,16 +1037,16 @@ int Spawn (edict_t *ent) ent->v.effects |= EF_NODRAW; } #endif - else if (strcmp (STRING (ent->v.classname), "func_vip_safetyzone") == 0 || strcmp (STRING (ent->v.classname), "info_vip_safetyzone") == 0) + else if (strcmp (entityClassname, "func_vip_safetyzone") == 0 || strcmp (STRING (ent->v.classname), "info_vip_safetyzone") == 0) g_mapType |= MAP_AS; // assassination map - else if (strcmp (STRING (ent->v.classname), "hostage_entity") == 0) + else if (strcmp (entityClassname, "hostage_entity") == 0) g_mapType |= MAP_CS; // rescue map - else if (strcmp (STRING (ent->v.classname), "func_bomb_target") == 0 || strcmp (STRING (ent->v.classname), "info_bomb_target") == 0) + else if (strcmp (entityClassname, "func_bomb_target") == 0 || strcmp (STRING (ent->v.classname), "info_bomb_target") == 0) g_mapType |= MAP_DE; // defusion map - else if (strcmp (STRING (ent->v.classname), "func_escapezone") == 0) + else if (strcmp (entityClassname, "func_escapezone") == 0) g_mapType |= MAP_ES; // next maps doesn't have map-specific entities, so determine it by name diff --git a/source/manager.cpp b/source/manager.cpp index 5dcdd90..0fe1ff8 100644 --- a/source/manager.cpp +++ b/source/manager.cpp @@ -1188,16 +1188,7 @@ void Bot::StartGame (void) FakeClientCommand (GetEntity (), "jointeam %d", m_wantedTeam); - if (m_wantedTeam == 2) - { - SET_MODEL (GetEntity (), ENGINE_STR ("models/player/Counter-Terrorists/Counter-Terrorists.mdl")); - SET_CLIENT_KEYVALUE (GetIndex (), GET_INFOKEYBUFFER (GetEntity ()), "model", "Counter-Terrorists"); - } - else - { - SET_MODEL (GetEntity (), ENGINE_STR ("models/player/Terrorists/Terrorists.mdl")); - SET_CLIENT_KEYVALUE (GetIndex (), GET_INFOKEYBUFFER (GetEntity ()), "model", "Terrorists"); - } + SET_CLIENT_KEYVALUE (GetIndex (), GET_INFOKEYBUFFER (GetEntity ()), "model", m_wantedTeam == 2 ? "Counter-Terrorists" : "Terrorists"); if (Random.Long (0, 100) < 20) ChatMessage (CHAT_WELCOME);