Skip to content

Commit

Permalink
fixes
Browse files Browse the repository at this point in the history
- own player name showing in place of an npc name
- rename some kill feed messages caused by the world
- possibly fix weapons not being selectable and falling off of players
  • Loading branch information
wootguy committed Oct 4, 2024
1 parent 290868e commit 9f72dc1
Show file tree
Hide file tree
Showing 8 changed files with 40 additions and 16 deletions.
3 changes: 2 additions & 1 deletion dlls/env/CEnvExplosion.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,8 @@ void CEnvExplosion::Use(CBaseEntity* pActivator, CBaseEntity* pCaller, USE_TYPE
// do damage
if (!(pev->spawnflags & SF_ENVEXPLOSION_NODAMAGE))
{
::RadiusDamage(pev->origin, pev, pev, m_iMagnitude, m_iMagnitude * 2.5, CLASS_NONE, DMG_BLAST);
entvars_t* ownerpev = pev->owner ? &pev->owner->v : pev;
::RadiusDamage(pev->origin, pev, ownerpev, m_iMagnitude, m_iMagnitude * 2.5, CLASS_NONE, DMG_BLAST);
}

SetThink(&CEnvExplosion::Smoke);
Expand Down
1 change: 0 additions & 1 deletion dlls/func/CFuncTankMortar.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ class CFuncTankMortar : public CFuncTank
public:
void KeyValue(KeyValueData* pkvd);
void Fire(const Vector& barrelEnd, const Vector& forward, entvars_t* pevAttacker);
virtual const char* DisplayName() { return "Mortar"; }
virtual const char* GetDeathNoticeWeapon() { return "grenade"; };
};
LINK_ENTITY_TO_CLASS(func_tankmortar, CFuncTankMortar)
Expand Down
30 changes: 20 additions & 10 deletions dlls/multiplay_gamerules.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -690,7 +690,6 @@ void CHalfLifeMultiplay::DeathNotice( CBaseMonster *pVictim, entvars_t *pKiller,
const char* hackedKillerOriginalName = NULL;
const char* hackedVictimOriginalName = NULL;
const char* originalKillerName = NULL;
const char* originalVictimName = NULL;
bool monsterKill = !Killer->IsPlayer() || !pVictim->IsPlayer();
bool monsterKillingPlayer = !Killer->IsPlayer() && pVictim->IsPlayer();
bool playerKillingMonster = Killer->IsPlayer() && !pVictim->IsPlayer();
Expand Down Expand Up @@ -763,7 +762,7 @@ void CHalfLifeMultiplay::DeathNotice( CBaseMonster *pVictim, entvars_t *pKiller,
killerName = "Laser";
}
else if (pVictim->m_lastDamageType & DMG_DROWN) {
killerName = "Suffocation";
killerName = "Hypoxia";
}
else if (pVictim->m_lastDamageType & (DMG_POISON | DMG_NERVEGAS)) {
killerName = "Poison";
Expand All @@ -774,18 +773,22 @@ void CHalfLifeMultiplay::DeathNotice( CBaseMonster *pVictim, entvars_t *pKiller,
else if (pVictim->m_lastDamageType & DMG_ACID) {
killerName = "Acid";
}
else if (pVictim->m_lastDamageType & DMG_SLOWBURN) {
else if (pVictim->m_lastDamageType & (DMG_BURN | DMG_SLOWBURN)) {
killerName = "Hyperthermia";
}
else if (pVictim->m_lastDamageType & (DMG_FREEZE | DMG_SLOWFREEZE)) {
killerName = "Hypothermia";
}
else if (pVictim->m_lastDamageType & (DMG_MORTAR | DMG_BLAST)) {
killerName = "Explosion";
else if (pVictim->m_lastDamageType & DMG_MORTAR) {
killerName = "Mortar";
}
else if (pVictim->m_lastDamageType & DMG_BLAST) {
//killerName = "Explosion";
// entity name should be better
}
else if (pVictim->m_lastDamageType & (DMG_PARALYZE)) {
//killerName = "Nerve damage";
// entity name should be better ("pain" for trigger_hurt)
// entity name should be better
}
else if (pVictim->m_lastDamageType & (DMG_SONIC)) {
killerName = "Sound";
Expand Down Expand Up @@ -899,6 +902,7 @@ void CHalfLifeMultiplay::DeathNotice( CBaseMonster *pVictim, entvars_t *pKiller,
}

// restore player names if temporarily changed for the status bar, unless renamed just now
// or else the wrong name shows in the kill feed
if (pVictim->IsPlayer()) {
CBasePlayer* plr = (CBasePlayer*)pVictim;
if (plr->tempNameActive && plr != hackedPlayer1 && plr != hackedPlayer2) {
Expand All @@ -924,6 +928,12 @@ void CHalfLifeMultiplay::DeathNotice( CBaseMonster *pVictim, entvars_t *pKiller,
if (hackedPlayer1) {
hackedPlayer1->Rename(hackedKillerOriginalName, false);
hackedPlayer1->UpdateTeamInfo();

// TODO: this is sending the hacked player double the network packets, and these are already heavy
if (hackedPlayer1->tempNameActive) {
hackedPlayer1->Rename(hackedPlayer1->m_tempName, false, MSG_ONE, hackedPlayer1->edict());
hackedPlayer1->UpdateTeamInfo(hackedPlayer1->m_tempTeam, MSG_ONE, hackedPlayer1->edict());
}
}
if (originalKillerName) {
CBasePlayer* plr = (CBasePlayer*)Killer;
Expand All @@ -933,9 +943,9 @@ void CHalfLifeMultiplay::DeathNotice( CBaseMonster *pVictim, entvars_t *pKiller,
hackedPlayer2->Rename(hackedVictimOriginalName, false);
hackedPlayer2->UpdateTeamInfo();

if (originalVictimName) {
CBasePlayer* plr = (CBasePlayer*)Killer;
plr->Rename(originalVictimName, false);
if (hackedPlayer2->tempNameActive) {
hackedPlayer2->Rename(hackedPlayer2->m_tempName, false, MSG_ONE, hackedPlayer2->edict());
hackedPlayer2->UpdateTeamInfo(hackedPlayer2->m_tempTeam, MSG_ONE, hackedPlayer2->edict());
}
}

Expand All @@ -949,7 +959,7 @@ void CHalfLifeMultiplay::DeathNotice( CBaseMonster *pVictim, entvars_t *pKiller,
}
if (Killer->IsPlayer()) {
CBasePlayer* plr = (CBasePlayer*)Killer;
if (plr->tempNameActive && plr != hackedPlayer1 && plr != hackedPlayer2) {
if (plr->tempNameActive && plr != hackedPlayer1 && plr != hackedPlayer2 && !originalKillerName) {
plr->Rename(plr->m_tempName, false, MSG_ONE, plr->edict());
plr->UpdateTeamInfo(plr->m_tempTeam, MSG_ONE, plr->edict());
}
Expand Down
2 changes: 1 addition & 1 deletion dlls/triggers/CTriggerHurt.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ class CTriggerHurt : public CBaseTrigger
public:
void Spawn(void);
void EXPORT RadiationThink(void);
virtual const char* DisplayName() { return "Pain"; }
virtual const char* DisplayName() { return "Injury"; }
};

LINK_ENTITY_TO_CLASS(trigger_hurt, CTriggerHurt)
Expand Down
2 changes: 1 addition & 1 deletion dlls/triggers/CTriggerHurtRemote.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ class CTriggerHurtRemote : public CBaseLogic
void ConstantThink();
void HurtAllTargets();
void HurtTarget(CBaseEntity* target);
virtual const char* DisplayName() { return "Pain"; }
virtual const char* DisplayName() { return "Injury"; }

string_t m_targetClass;
float m_armorDmg;
Expand Down
15 changes: 14 additions & 1 deletion dlls/weapon/CBasePlayerItem.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -189,6 +189,10 @@ void CBasePlayerItem::DefaultTouch(CBaseEntity* pOther)
if (!pOther->IsPlayer())
return;

if (pev->movetype == MOVETYPE_FOLLOW) {
return; // attached to a player
}

CBasePlayer* pPlayer = (CBasePlayer*)pOther;

// can I have this?
Expand Down Expand Up @@ -301,4 +305,13 @@ void CBasePlayerItem::DefaultUse(CBaseEntity* pActivator, CBaseEntity* pCaller,

DefaultTouch(pCaller);
}
}
}

int CBasePlayerItem::ObjectCaps() {
if (pev->movetype == MOVETYPE_FOLLOW) {
return CBaseEntity::ObjectCaps();
}
else {
return FCAP_ACROSS_TRANSITION | FCAP_IMPULSE_USE;
}
}
2 changes: 1 addition & 1 deletion dlls/weapon/CBasePlayerItem.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ class EXPORT CBasePlayerItem : public CBaseAnimating
virtual int Save( CSave &save );
virtual int Restore( CRestore &restore );

virtual int ObjectCaps(void) { return FCAP_ACROSS_TRANSITION | FCAP_IMPULSE_USE; }
virtual int ObjectCaps(void);

static TYPEDESCRIPTION m_SaveData[];

Expand Down
1 change: 1 addition & 0 deletions dlls/weapon/CMortar.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ class CMortar : public CGrenade
public:
void Spawn( void );
void Precache( void );
virtual const char* DisplayName() { return "Mortar"; }

void EXPORT MortarExplode( void );

Expand Down

0 comments on commit 9f72dc1

Please sign in to comment.