Skip to content

Commit

Permalink
fixes
Browse files Browse the repository at this point in the history
- not precached model dropping when killed while using satchel with 0 ammo
- items being usable before they respawn
- assist player count wrong
- rename some death causes
- "+ X players" flashing in scoreboard on assist kills
- wrong name color in chat if looking at a new npc at the same time
  • Loading branch information
wootguy committed Oct 5, 2024
1 parent f3f9470 commit 76adfd4
Show file tree
Hide file tree
Showing 7 changed files with 37 additions and 22 deletions.
24 changes: 8 additions & 16 deletions dlls/CBasePlayer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -807,10 +807,13 @@ void CBasePlayer::PackDeadPlayerItems( void )

iPW++;
}
}

pWeaponBox->pev->velocity = pev->velocity * 1.2;// weaponbox has player's velocity, then some.
pWeaponBox->pev->avelocity = Vector(0, 256, 256);
pWeaponBox->pev->velocity = pev->velocity * 1.2;// weaponbox has player's velocity, then some.
pWeaponBox->pev->avelocity = Vector(0, 256, 256);
}
else {
REMOVE_ENTITY(pWeaponBox->edict());
}

RemoveAllItems( TRUE );// now strip off everything that wasn't handled by the code above.

Expand Down Expand Up @@ -2135,6 +2138,7 @@ void CBasePlayer::UpdateStatusBar()

BOOL bForceResend = FALSE;

// second line of status bar, despite "0"
if ( strncmp( sbuf0, m_SbarString0, SBAR_STRING_SIZE) )
{
MESSAGE_BEGIN(MSG_ONE, gmsgStatusText, NULL, pev);
Expand Down Expand Up @@ -2165,19 +2169,7 @@ void CBasePlayer::UpdateStatusBar()
{
if (fakePlayerInfo.enabled) {
Rename(fakePlayerInfo.name, true, MSG_ONE, edict());

MESSAGE_BEGIN(MSG_ONE, gmsgScoreInfo, 0, edict());
WRITE_BYTE(entindex()); // client number
WRITE_SHORT(pev->frags);
WRITE_SHORT(m_iDeaths);
WRITE_SHORT(0);
WRITE_SHORT(fakePlayerInfo.color);
MESSAGE_END();

MESSAGE_BEGIN(MSG_ONE, gmsgTeamInfo, 0, edict());
WRITE_BYTE(entindex());
WRITE_STRING(DEFAULT_TEAM_NAME);
MESSAGE_END();
UpdateTeamInfo(fakePlayerInfo.color, MSG_ONE, edict());

tempNameActive = 1;
memset(m_tempName, 0, SBAR_STRING_SIZE);
Expand Down
10 changes: 10 additions & 0 deletions dlls/client_commands.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -255,12 +255,22 @@ void Host_Say(edict_t* pEntity, int teamonly)

}

if (player->tempNameActive) {
player->Rename(player->DisplayName(), true, MSG_ONE, player->edict());
player->UpdateTeamInfo(-1, MSG_ONE, player->edict());
}

// print to the sending client
MESSAGE_BEGIN(MSG_ONE, gmsgSayText, NULL, &pEntity->v);
WRITE_BYTE(ENTINDEX(pEntity));
WRITE_STRING(text);
MESSAGE_END();

if (player->tempNameActive) {
player->Rename(player->m_tempName, false, MSG_ONE, player->edict());
player->UpdateTeamInfo(player->m_tempTeam, MSG_ONE, player->edict());
}

// echo to server console for listen servers, dedicated servers should have logs enabled
if (!IS_DEDICATED_SERVER())
g_engfuncs.pfnServerPrint(text);
Expand Down
2 changes: 1 addition & 1 deletion dlls/func/CFuncTankRocket.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ class CFuncTankRocket : public CFuncTank
public:
void Precache(void);
void Fire(const Vector& barrelEnd, const Vector& forward, entvars_t* pevAttacker);
virtual const char* DisplayName() { return "Rocket"; }
virtual const char* DisplayName() { return "Rocket Launcher"; }
virtual const char* GetDeathNoticeWeapon() { return "rpg_rocket"; };
};
LINK_ENTITY_TO_CLASS(func_tankrocket, CFuncTankRocket)
Expand Down
4 changes: 4 additions & 0 deletions dlls/item/CItem.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,10 @@ void CItem::ItemTouch(CBaseEntity* pOther)
return;
}

if (pev->effects & EF_NODRAW) {
return; // waiting to respawn
}

CBasePlayer* pPlayer = (CBasePlayer*)pOther;

// ok, a player is touching this item, but can he have it?
Expand Down
14 changes: 9 additions & 5 deletions dlls/multiplay_gamerules.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -762,7 +762,7 @@ void CHalfLifeMultiplay::DeathNotice( CBaseMonster *pVictim, entvars_t *pKiller,
killerName = "Laser";
}
else if (pVictim->m_lastDamageType & DMG_DROWN) {
killerName = "Hypoxia";
killerName = "Fluid";
}
else if (pVictim->m_lastDamageType & (DMG_POISON | DMG_NERVEGAS)) {
killerName = "Poison";
Expand All @@ -774,15 +774,18 @@ void CHalfLifeMultiplay::DeathNotice( CBaseMonster *pVictim, entvars_t *pKiller,
killerName = "Acid";
}
else if (pVictim->m_lastDamageType & (DMG_BURN | DMG_SLOWBURN)) {
killerName = "Hyperthermia";
killerName = "Heat";
}
else if (pVictim->m_lastDamageType & (DMG_FREEZE | DMG_SLOWFREEZE)) {
killerName = "Hypothermia";
killerName = "Cold";
}
else if (pVictim->m_lastDamageType & DMG_MORTAR) {
killerName = "Mortar";
}
else if (pVictim->m_lastDamageType & DMG_BLAST) {
if (pVictim->IsBreakable()) {
killerName = "Explosion";
}
//killerName = "Explosion";
// entity name should be better
}
Expand All @@ -794,7 +797,7 @@ void CHalfLifeMultiplay::DeathNotice( CBaseMonster *pVictim, entvars_t *pKiller,
killerName = "Sound";
}
else if (pVictim->m_lastDamageType & (DMG_CLUB)) {
killerName = "Clubbing";
killerName = "Club";
}

hackedPlayer1->Rename(killerName, true);
Expand Down Expand Up @@ -841,7 +844,7 @@ void CHalfLifeMultiplay::DeathNotice( CBaseMonster *pVictim, entvars_t *pKiller,
plr->Rename(UTIL_VarArgs("%s + %s", Killer->DisplayName(), otherAttacker), true);
}
else {
plr->Rename(UTIL_VarArgs("%s + %d players", Killer->DisplayName(), attackerCount), true);
plr->Rename(UTIL_VarArgs("%s + %d players", Killer->DisplayName(), attackerCount-1), true);
}
}

Expand Down Expand Up @@ -939,6 +942,7 @@ void CHalfLifeMultiplay::DeathNotice( CBaseMonster *pVictim, entvars_t *pKiller,
if (originalKillerName) {
CBasePlayer* plr = (CBasePlayer*)Killer;
plr->Rename(originalKillerName, false);
plr->UpdateTeamInfo(); // forces name on client to update NOW
}
if (hackedPlayer2) {
hackedPlayer2->Rename(hackedVictimOriginalName, false);
Expand Down
4 changes: 4 additions & 0 deletions dlls/weapon/CBasePlayerAmmo.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,10 @@ void CBasePlayerAmmo::DefaultTouch(CBaseEntity* pOther)
return;
}

if (pev->effects & EF_NODRAW) {
return; // waiting to respawn
}

if (AddAmmo(pOther))
{
if (g_pGameRules->AmmoShouldRespawn(this) == GR_AMMO_RESPAWN_YES)
Expand Down
1 change: 1 addition & 0 deletions dlls/weapon/CSatchel.h
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ class CSatchelCharge : public CGrenade
void Spawn(void);
void Precache(void);
void BounceSound(void);
const char* DisplayName() { return "Satchel"; }

void EXPORT SatchelSlide(CBaseEntity* pOther);
void EXPORT SatchelThink(void);
Expand Down

0 comments on commit 76adfd4

Please sign in to comment.