From 876468fc29da1526f90344cca8510ea52394af02 Mon Sep 17 00:00:00 2001 From: Marco Hladik Date: Thu, 23 Apr 2020 22:42:09 +0200 Subject: [PATCH] Fixed a bug in which self wasn't reset in Weapons_AddItem() --- src/server/cstrike/gamerules.h | 2 +- src/server/cstrike/gamerules_multiplayer.cpp | 13 ++++++------- src/shared/valve/fx_breakmodel.c | 14 +++++++------- src/shared/valve/fx_gibhuman.c | 3 +-- src/shared/valve/weapon_common.c | 1 + 5 files changed, 16 insertions(+), 17 deletions(-) diff --git a/src/server/cstrike/gamerules.h b/src/server/cstrike/gamerules.h index 907a7f43..02588754 100644 --- a/src/server/cstrike/gamerules.h +++ b/src/server/cstrike/gamerules.h @@ -52,6 +52,7 @@ class CSMultiplayerRules:CSGameRules virtual void(player) PlayerSpawn; virtual void(player) PlayerPreFrame; virtual void(player) PlayerDeath; + virtual int(void) MaxItemPerSlot; /* CS specific */ virtual void(void) CreateRescueZones; @@ -74,5 +75,4 @@ class CSMultiplayerRules:CSGameRules virtual void(player) PlayerMakeSpectator; virtual void(player, int) PlayerRespawn; virtual entity(float) PlayerFindSpawn; - virtual int(void) MaxItemPerSlot; }; diff --git a/src/server/cstrike/gamerules_multiplayer.cpp b/src/server/cstrike/gamerules_multiplayer.cpp index eb46cf42..3bedb959 100644 --- a/src/server/cstrike/gamerules_multiplayer.cpp +++ b/src/server/cstrike/gamerules_multiplayer.cpp @@ -14,6 +14,12 @@ * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ +int +CSMultiplayerRules::MaxItemPerSlot(void) +{ + return 1; +} + void CSMultiplayerRules::PlayerDeath(player pl) { @@ -719,7 +725,6 @@ CSMultiplayerRules::PlayerMakePlayable(player pl, int chara) } else { /* counter */ pl.team = TEAM_CT; - pl.g_items |= ITEM_SUIT; Weapons_AddItem(pl, WEAPON_KNIFE); if (autocvar_fcs_knifeonly == FALSE) { @@ -788,12 +793,6 @@ CSMultiplayerRules::PlayerSpawn(player pl) forceinfokey(pl, "*team", "0"); } -int -CSMultiplayerRules::MaxItemPerSlot(void) -{ - return 1; -} - void CSMultiplayerRules::CSMultiplayerRules(void) { diff --git a/src/shared/valve/fx_breakmodel.c b/src/shared/valve/fx_breakmodel.c index 3d498466..4a6c967b 100644 --- a/src/shared/valve/fx_breakmodel.c +++ b/src/shared/valve/fx_breakmodel.c @@ -139,23 +139,23 @@ FX_BreakModel(int count, vector vMins, vector vMaxs, vector vVel, float fStyle) for (int i = 0; i < count; i++) { entity eGib = spawn(); eGib.classname = "gib"; - - vecPos[0] = vMins[0] + (random() * (vMaxs[0] - vMins[0])); - vecPos[1] = vMins[1] + (random() * (vMaxs[1] - vMins[1])); - vecPos[2] = vMins[2] + (random() * (vMaxs[2] - vMins[2])); - + + vecPos[0] = vMins[0] + (random() * (vMaxs[0] - vMins[0])); + vecPos[1] = vMins[1] + (random() * (vMaxs[1] - vMins[1])); + vecPos[2] = vMins[2] + (random() * (vMaxs[2] - vMins[2])); + setorigin(eGib, vecPos); setmodel(eGib, sModel); setcustomskin(eGib, "", sprintf("geomset 0 %f\n", random(1, fModelCount + 1))); eGib.movetype = MOVETYPE_BOUNCE; eGib.solid = SOLID_NOT; - + eGib.avelocity[0] = random()*600; eGib.avelocity[1] = random()*600; eGib.avelocity[2] = random()*600; eGib.think = FX_BreakModel_Remove; eGib.nextthink = time + 10; - + if ((fStyle == GSMATERIAL_GLASS) || (fStyle == GSMATERIAL_GLASS_UNBREAKABLE)) { eGib.effects = EF_ADDITIVE; } diff --git a/src/shared/valve/fx_gibhuman.c b/src/shared/valve/fx_gibhuman.c index 2df6fbcb..fcd2cbb0 100644 --- a/src/shared/valve/fx_gibhuman.c +++ b/src/shared/valve/fx_gibhuman.c @@ -55,12 +55,11 @@ FX_GibHuman(vector pos) Decals_Place(self.origin, sprintf("{blood%d", floor(random(1,9)))); } for (int i = 0; i < 5; i++) { - vector vel; vel[0] = random(-128,128); vel[1] = random(-128,128); vel[2] = (300 + random() * 64); - + entity gibb = spawn(); setmodel(gibb, g_hgibs[i]); setorigin(gibb, pos); diff --git a/src/shared/valve/weapon_common.c b/src/shared/valve/weapon_common.c index c0db727d..f25b081c 100644 --- a/src/shared/valve/weapon_common.c +++ b/src/shared/valve/weapon_common.c @@ -297,6 +297,7 @@ int Weapons_AddItem(player pl, int w) /* we're over the slot limit. */ if (c >= maxit) { + self = oldself; return FALSE; } }