Skip to content

Commit

Permalink
Add 'No Camera Punch' flag for trigger_hurt and trigger_hurt_remote
Browse files Browse the repository at this point in the history
  • Loading branch information
FreeSlave committed Oct 19, 2023
1 parent 3cbef6c commit ec112bb
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 1 deletion.
3 changes: 2 additions & 1 deletion dlls/player.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -740,7 +740,8 @@ int CBasePlayer::TakeDamage( entvars_t *pevInflictor, entvars_t *pevAttacker, fl
}
}

pev->punchangle.x = -2;
if (!FBitSet(bitsDamageType, DMG_NO_PUNCH))
pev->punchangle.x = -2;

if( fTookDamage && !ftrivial && fmajor && flHealthPrev >= 75 )
{
Expand Down
6 changes: 6 additions & 0 deletions dlls/triggers.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@
#define SF_TRIGGER_HURT_AFFECT_NON_MOVING_MONSTERS 64 // hack to affect non-moving monsters
#define SF_TRIGGER_HURT_FULL_DAMAGE_EVERY_HALF_SECOND 128
#define SF_TRIGGER_HURT_IGNORE_ARMOR 256
#define SF_TRIGGER_HURT_NO_PUNCH 512

extern DLL_GLOBAL BOOL g_fGameOver;

Expand Down Expand Up @@ -996,6 +997,8 @@ class CTriggerHurt : public CBaseTrigger
}
if (pev->spawnflags & SF_TRIGGER_HURT_IGNORE_ARMOR)
damageType |= DMG_IGNORE_ARMOR;
if (pev->spawnflags & SF_TRIGGER_HURT_NO_PUNCH)
damageType |= DMG_NO_PUNCH;
return damageType;
}
};
Expand Down Expand Up @@ -5075,6 +5078,7 @@ void CTriggerChangeClass::Affect(CBaseEntity *pEntity, USE_TYPE useType)
#define SF_TRIGGER_HURT_REMOTE_STARTON 4

#define SF_TRIGGER_HURT_REMOTE_IGNORE_ARMOR 256
#define SF_TRIGGER_HURT_REMOTE_NO_PUNCH 512

class CTriggerHurtRemote : public CPointEntity
{
Expand Down Expand Up @@ -5109,6 +5113,8 @@ class CTriggerHurtRemote : public CPointEntity
}
if (pev->spawnflags & SF_TRIGGER_HURT_REMOTE_IGNORE_ARMOR)
damageType |= DMG_IGNORE_ARMOR;
if (pev->spawnflags & SF_TRIGGER_HURT_REMOTE_NO_PUNCH)
damageType |= DMG_NO_PUNCH;
return damageType;
}
float Delay() const { return pev->frags ? pev->frags : 0.1; }
Expand Down
2 changes: 2 additions & 0 deletions fgd/halflife.fgd
Original file line number Diff line number Diff line change
Expand Up @@ -7523,6 +7523,7 @@
64:"Affect non-moving NPC's" : 0 : "Uses entity's bounding box to find and hurt non-moving monsters. Will produce wrong results on non-cuboid brush shapes."
128:"Full dmg every 0.5 seconds" : 0 : "Do full damage (or healing) instead of halving the value. Recommended to use with odd values."
256:"Ignore Armor" : 0
512:"No Camera Punch" : 0
]
master(string) : "Master"
dmg(integer) : "Damage" : 10 : "The damage is applied every 0.5 seconds. Negative value means healing. The value is getting halved, unless 'Full dmg every 0.5 seconds' spawnflag is set."
Expand All @@ -7539,6 +7540,7 @@
2 : "Constant" : 0
4 : "Start On" : 0
256:"Ignore Armor" : 0
512:"No Camera Punch" : 0
]
target(string) : "Target [LE]"
targetclass(string) : "Target Class" : : "If specified, all entities with the given class will be affected. This is independent from Target, which means the entity might cause damage twice to the same entity if Target is class of Target Class."
Expand Down
1 change: 1 addition & 0 deletions game_shared/dmg_types.h
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@
#define DMG_TIMEDNONLETHAL (1 << 25) // timed damage, e.g. poison, shouldn't kill player completely
#define DMG_DONTBLEED (1 << 26) // used in TraceAttack. Force not to bleed.
#define DMG_IGNORE_ARMOR (1 << 27)
#define DMG_NO_PUNCH (1 << 28)

// Modifiers to time-based damage, up to 8
#define DMG_TIMED_MOD_NONLETHAL ( 1 << 0 )
Expand Down

0 comments on commit ec112bb

Please sign in to comment.