mirror of
https://github.com/dhewm/dhewm3-sdk.git
synced 2025-04-19 07:41:41 +00:00
Add modifications of the Damage functions and change some ammo variable types into float in d3xp
This commit is contained in:
parent
0942905731
commit
926efcf0d0
19 changed files with 74 additions and 72 deletions
|
@ -378,10 +378,10 @@ Pass damage to body at the bindjoint
|
|||
============
|
||||
*/
|
||||
void idAFAttachment::Damage( idEntity *inflictor, idEntity *attacker, const idVec3 &dir,
|
||||
const char *damageDefName, const float damageScale, const int location ) {
|
||||
const char *damageDefName, const float damageScale, const int location, const idVec3 &iPoint ) {
|
||||
|
||||
if ( body ) {
|
||||
body->Damage( inflictor, attacker, dir, damageDefName, damageScale, attachJoint );
|
||||
body->Damage( inflictor, attacker, dir, damageDefName, damageScale, attachJoint, iPoint );
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1100,11 +1100,11 @@ void idAFEntity_Gibbable::Present( void ) {
|
|||
idAFEntity_Gibbable::Damage
|
||||
================
|
||||
*/
|
||||
void idAFEntity_Gibbable::Damage( idEntity *inflictor, idEntity *attacker, const idVec3 &dir, const char *damageDefName, const float damageScale, const int location ) {
|
||||
void idAFEntity_Gibbable::Damage( idEntity *inflictor, idEntity *attacker, const idVec3 &dir, const char *damageDefName, const float damageScale, const int location, idVec3 &iPoint ) {
|
||||
if ( !fl.takedamage ) {
|
||||
return;
|
||||
}
|
||||
idAFEntity_Base::Damage( inflictor, attacker, dir, damageDefName, damageScale, location );
|
||||
idAFEntity_Base::Damage( inflictor, attacker, dir, damageDefName, damageScale, location, iPoint );
|
||||
if ( health < -20 && spawnArgs.GetBool( "gib" ) ) {
|
||||
Gib( dir, damageDefName );
|
||||
}
|
||||
|
@ -1147,7 +1147,7 @@ bool idAFEntity_Gibbable::Collide( const trace_t &collision, const idVec3 &veloc
|
|||
|
||||
ent = gameLocal.entities[ collision.c.entityNum ];
|
||||
if ( ent->fl.takedamage ) {
|
||||
ent->Damage( this, gameLocal.GetLocalPlayer(), collision.c.normal, "damage_thrown_ragdoll", 1.f, CLIPMODEL_ID_TO_JOINT_HANDLE( collision.c.id ) );
|
||||
ent->Damage( this, gameLocal.GetLocalPlayer(), collision.c.normal, "damage_thrown_ragdoll", 1.f, CLIPMODEL_ID_TO_JOINT_HANDLE( collision.c.id ), idVec3( collision.c.point ) );
|
||||
}
|
||||
|
||||
idVec3 vel = velocity;
|
||||
|
|
|
@ -123,7 +123,7 @@ public:
|
|||
virtual void ApplyImpulse( idEntity *ent, int id, const idVec3 &point, const idVec3 &impulse );
|
||||
virtual void AddForce( idEntity *ent, int id, const idVec3 &point, const idVec3 &force );
|
||||
|
||||
virtual void Damage( idEntity *inflictor, idEntity *attacker, const idVec3 &dir, const char *damageDefName, const float damageScale, const int location );
|
||||
virtual void Damage( idEntity *inflictor, idEntity *attacker, const idVec3 &dir, const char *damageDefName, const float damageScale, const int location, const idVec3 &iPoint );
|
||||
virtual void AddDamageEffect( const trace_t &collision, const idVec3 &velocity, const char *damageDefName );
|
||||
|
||||
void SetCombatModel( void );
|
||||
|
@ -225,7 +225,7 @@ public:
|
|||
void Save( idSaveGame *savefile ) const;
|
||||
void Restore( idRestoreGame *savefile );
|
||||
virtual void Present( void );
|
||||
virtual void Damage( idEntity *inflictor, idEntity *attacker, const idVec3 &dir, const char *damageDefName, const float damageScale, const int location );
|
||||
virtual void Damage( idEntity *inflictor, idEntity *attacker, const idVec3 &dir, const char *damageDefName, const float damageScale, const int location, idVec3 &iPoint );
|
||||
#ifdef _D3XP
|
||||
void SetThrown( bool isThrown );
|
||||
virtual bool Collide( const trace_t &collision, const idVec3 &velocity );
|
||||
|
|
|
@ -2206,7 +2206,7 @@ calls Damage()
|
|||
============
|
||||
*/
|
||||
void idActor::Damage( idEntity *inflictor, idEntity *attacker, const idVec3 &dir,
|
||||
const char *damageDefName, const float damageScale, const int location ) {
|
||||
const char *damageDefName, const float damageScale, const int location, const idVec3 &iPoint ) {
|
||||
if ( !fl.takedamage ) {
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -169,7 +169,7 @@ public:
|
|||
|
||||
// damage
|
||||
void SetupDamageGroups( void );
|
||||
virtual void Damage( idEntity *inflictor, idEntity *attacker, const idVec3 &dir, const char *damageDefName, const float damageScale, const int location );
|
||||
virtual void Damage( idEntity *inflictor, idEntity *attacker, const idVec3 &dir, const char *damageDefName, const float damageScale, const int location, const idVec3 &iPoint );
|
||||
int GetDamageForLocation( int damage, int location );
|
||||
const char * GetDamageGroup( int location );
|
||||
void ClearPain( void );
|
||||
|
|
|
@ -3072,7 +3072,7 @@ inflictor, attacker, dir, and point can be NULL for environmental effects
|
|||
============
|
||||
*/
|
||||
void idEntity::Damage( idEntity *inflictor, idEntity *attacker, const idVec3 &dir,
|
||||
const char *damageDefName, const float damageScale, const int location ) {
|
||||
const char *damageDefName, const float damageScale, const int location, const idVec3 &iPoint ) {
|
||||
if ( !fl.takedamage ) {
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -318,7 +318,7 @@ public:
|
|||
// returns true if this entity can be damaged from the given origin
|
||||
virtual bool CanDamage( const idVec3 &origin, idVec3 &damagePoint ) const;
|
||||
// applies damage to this entity
|
||||
virtual void Damage( idEntity *inflictor, idEntity *attacker, const idVec3 &dir, const char *damageDefName, const float damageScale, const int location );
|
||||
virtual void Damage( idEntity *inflictor, idEntity *attacker, const idVec3 &dir, const char *damageDefName, const float damageScale, const int location, const idVec3 &iPoint );
|
||||
// adds a damage effect like overlays, blood, sparks, debris etc.
|
||||
virtual void AddDamageEffect( const trace_t &collision, const idVec3 &velocity, const char *damageDefName );
|
||||
// callback function for when another entity received damage from this entity. damage can be adjusted and returned to the caller.
|
||||
|
|
|
@ -3811,7 +3811,7 @@ void idGameLocal::KillBox( idEntity *ent, bool catch_teleport ) {
|
|||
if ( hit->IsType( idPlayer::Type ) && static_cast< idPlayer * >( hit )->IsInTeleport() ) {
|
||||
static_cast< idPlayer * >( hit )->TeleportDeath( ent->entityNumber );
|
||||
} else if ( !catch_teleport ) {
|
||||
hit->Damage( ent, ent, vec3_origin, "damage_telefrag", 1.0f, INVALID_JOINT );
|
||||
hit->Damage( ent, ent, vec3_origin, "damage_telefrag", 1.0f, INVALID_JOINT, idVec3( 0, 0, 0 ) );
|
||||
}
|
||||
|
||||
if ( !gameLocal.isMultiplayer ) {
|
||||
|
@ -3974,7 +3974,7 @@ void idGameLocal::RadiusDamage( const idVec3 &origin, idEntity *inflictor, idEnt
|
|||
damageScale *= attackerDamageScale;
|
||||
}
|
||||
|
||||
ent->Damage( inflictor, attacker, dir, damageDefName, damageScale, INVALID_JOINT );
|
||||
ent->Damage( inflictor, attacker, dir, damageDefName, damageScale, INVALID_JOINT, idVec3( 0, 0, 0 ) );
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -344,7 +344,7 @@ void idGrabber::StopDrag( bool dropOnly ) {
|
|||
if ( grabbableAI( ent->spawnArgs.GetString( "classname" ) ) ) {
|
||||
idAI *aiEnt = static_cast<idAI*>(ent);
|
||||
|
||||
aiEnt->Damage( thePlayer, thePlayer, vec3_origin, "damage_suicide", 1.0f, INVALID_JOINT );
|
||||
aiEnt->Damage( thePlayer, thePlayer, vec3_origin, "damage_suicide", 1.0f, INVALID_JOINT, idVec3( 0, 0, 0 ) );
|
||||
}
|
||||
|
||||
af->SetThrown( !dropOnly );
|
||||
|
|
|
@ -3400,7 +3400,7 @@ void idShockwave::Think() {
|
|||
idPlayer* player = static_cast< idPlayer* >( ent );
|
||||
idVec3 dir = ent->GetPhysics()->GetOrigin() - pos;
|
||||
dir.NormalizeFast();
|
||||
player->Damage(NULL, NULL, dir, damageDef, 1.0f, INVALID_JOINT);
|
||||
player->Damage(NULL, NULL, dir, damageDef, 1.0f, INVALID_JOINT, idVec3( 0, 0, 0 ));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -314,13 +314,13 @@ bool idMoveable::Collide( const trace_t &collision, const idVec3 &velocity ) {
|
|||
if ( ent->IsType( idAI::Type ) && hasMonsterDamage ) {
|
||||
#ifdef _D3XP
|
||||
if ( attacker ) {
|
||||
ent->Damage( this, attacker, dir, monsterDamage, f, INVALID_JOINT );
|
||||
ent->Damage( this, attacker, dir, monsterDamage, f, INVALID_JOINT, idVec3( collision.c.point ) );
|
||||
}
|
||||
else {
|
||||
ent->Damage( this, GetPhysics()->GetClipModel()->GetOwner(), dir, monsterDamage, f, INVALID_JOINT );
|
||||
ent->Damage( this, GetPhysics()->GetClipModel()->GetOwner(), dir, monsterDamage, f, INVALID_JOINT, idVec3( collision.c.point ) );
|
||||
}
|
||||
#else
|
||||
ent->Damage( this, GetPhysics()->GetClipModel()->GetOwner(), dir, monsterDamage, f, INVALID_JOINT );
|
||||
ent->Damage( this, GetPhysics()->GetClipModel()->GetOwner(), dir, monsterDamage, f, INVALID_JOINT, idVec3( collision.c.point ) );
|
||||
#endif
|
||||
} else if ( hasDamage ) {
|
||||
#ifdef _D3XP
|
||||
|
@ -330,13 +330,13 @@ bool idMoveable::Collide( const trace_t &collision, const idVec3 &velocity ) {
|
|||
}
|
||||
|
||||
if ( attacker ) {
|
||||
ent->Damage( this, attacker, dir, damage, f, INVALID_JOINT );
|
||||
ent->Damage( this, attacker, dir, damage, f, INVALID_JOINT, idVec3( collision.c.point ) );
|
||||
}
|
||||
else {
|
||||
ent->Damage( this, GetPhysics()->GetClipModel()->GetOwner(), dir, damage, f, INVALID_JOINT );
|
||||
ent->Damage( this, GetPhysics()->GetClipModel()->GetOwner(), dir, damage, f, INVALID_JOINT, idVec3( collision.c.point ) );
|
||||
}
|
||||
#else
|
||||
ent->Damage( this, GetPhysics()->GetClipModel()->GetOwner(), dir, damage, f, INVALID_JOINT );
|
||||
ent->Damage( this, GetPhysics()->GetClipModel()->GetOwner(), dir, damage, f, INVALID_JOINT, idVec3( collision.c.point ) );
|
||||
#endif
|
||||
}
|
||||
|
||||
|
@ -1229,7 +1229,7 @@ idExplodingBarrel::Damage
|
|||
================
|
||||
*/
|
||||
void idExplodingBarrel::Damage( idEntity *inflictor, idEntity *attacker, const idVec3 &dir,
|
||||
const char *damageDefName, const float damageScale, const int location ) {
|
||||
const char *damageDefName, const float damageScale, const int location, const idVec3 &iPoint ) {
|
||||
|
||||
const idDict *damageDef = gameLocal.FindEntityDefDict( damageDefName );
|
||||
if ( !damageDef ) {
|
||||
|
@ -1238,7 +1238,7 @@ void idExplodingBarrel::Damage( idEntity *inflictor, idEntity *attacker, const i
|
|||
if ( damageDef->FindKey( "radius" ) && GetPhysics()->GetContents() != 0 && GetBindMaster() == NULL ) {
|
||||
PostEventMS( &EV_Explode, 400 );
|
||||
} else {
|
||||
idEntity::Damage( inflictor, attacker, dir, damageDefName, damageScale, location );
|
||||
idEntity::Damage( inflictor, attacker, dir, damageDefName, damageScale, location, iPoint );
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -175,7 +175,7 @@ public:
|
|||
|
||||
virtual void Think( void );
|
||||
virtual void Damage( idEntity *inflictor, idEntity *attacker, const idVec3 &dir,
|
||||
const char *damageDefName, const float damageScale, const int location );
|
||||
const char *damageDefName, const float damageScale, const int location, const idVec3 &iPoint );
|
||||
virtual void Killed( idEntity *inflictor, idEntity *attacker, int damage, const idVec3 &dir, int location );
|
||||
|
||||
virtual void WriteToSnapshot( idBitMsgDelta &msg ) const;
|
||||
|
|
|
@ -1001,7 +1001,7 @@ idMover::Event_PartBlocked
|
|||
*/
|
||||
void idMover::Event_PartBlocked( idEntity *blockingEntity ) {
|
||||
if ( damage > 0.0f ) {
|
||||
blockingEntity->Damage( this, this, vec3_origin, "damage_moverCrush", damage, INVALID_JOINT );
|
||||
blockingEntity->Damage( this, this, vec3_origin, "damage_moverCrush", damage, INVALID_JOINT, idVec3( 0, 0, 0 ) );
|
||||
}
|
||||
if ( g_debugMover.GetBool() ) {
|
||||
gameLocal.Printf( "%d: '%s' blocked by '%s'\n", gameLocal.slow.time, name.c_str(), blockingEntity->name.c_str() );
|
||||
|
@ -3843,7 +3843,7 @@ idDoor::Event_PartBlocked
|
|||
*/
|
||||
void idDoor::Event_PartBlocked( idEntity *blockingEntity ) {
|
||||
if ( damage > 0.0f ) {
|
||||
blockingEntity->Damage( this, this, vec3_origin, "damage_moverCrush", damage, INVALID_JOINT );
|
||||
blockingEntity->Damage( this, this, vec3_origin, "damage_moverCrush", damage, INVALID_JOINT, idVec3( 0, 0, 0 ) );
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -4286,7 +4286,7 @@ idPlat::Event_PartBlocked
|
|||
*/
|
||||
void idPlat::Event_PartBlocked( idEntity *blockingEntity ) {
|
||||
if ( damage > 0.0f ) {
|
||||
blockingEntity->Damage( this, this, vec3_origin, "damage_moverCrush", damage, INVALID_JOINT );
|
||||
blockingEntity->Damage( this, this, vec3_origin, "damage_moverCrush", damage, INVALID_JOINT, idVec3( 0, 0, 0 ) );
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -4377,7 +4377,7 @@ idMover_Periodic::Event_PartBlocked
|
|||
*/
|
||||
void idMover_Periodic::Event_PartBlocked( idEntity *blockingEntity ) {
|
||||
if ( damage > 0.0f ) {
|
||||
blockingEntity->Damage( this, this, vec3_origin, "damage_moverCrush", damage, INVALID_JOINT );
|
||||
blockingEntity->Damage( this, this, vec3_origin, "damage_moverCrush", damage, INVALID_JOINT, idVec3( 0, 0, 0 ) );
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -5662,7 +5662,7 @@ void idPlayer::CrashLand( const idVec3 &oldOrigin, const idVec3 &oldVelocity ) {
|
|||
landTime = gameLocal.time;
|
||||
if ( !noDamage ) {
|
||||
pain_debounce_time = gameLocal.time + pain_delay + 1; // ignore pain since we'll play our landing anim
|
||||
Damage( NULL, NULL, idVec3( 0, 0, -1 ), "damage_fatalfall", 1.0f, 0 );
|
||||
Damage( NULL, NULL, idVec3( 0, 0, -1 ), "damage_fatalfall", 1.0f, 0, idVec3( 0, 0, 0 ) );
|
||||
}
|
||||
} else if ( delta > hardDelta ) {
|
||||
AI_HARDLANDING = true;
|
||||
|
@ -5670,7 +5670,7 @@ void idPlayer::CrashLand( const idVec3 &oldOrigin, const idVec3 &oldVelocity ) {
|
|||
landTime = gameLocal.time;
|
||||
if ( !noDamage ) {
|
||||
pain_debounce_time = gameLocal.time + pain_delay + 1; // ignore pain since we'll play our landing anim
|
||||
Damage( NULL, NULL, idVec3( 0, 0, -1 ), "damage_hardfall", 1.0f, 0 );
|
||||
Damage( NULL, NULL, idVec3( 0, 0, -1 ), "damage_hardfall", 1.0f, 0, idVec3( 0, 0, 0 ) );
|
||||
}
|
||||
} else if ( delta > 30 ) {
|
||||
AI_HARDLANDING = true;
|
||||
|
@ -5678,7 +5678,7 @@ void idPlayer::CrashLand( const idVec3 &oldOrigin, const idVec3 &oldVelocity ) {
|
|||
landTime = gameLocal.time;
|
||||
if ( !noDamage ) {
|
||||
pain_debounce_time = gameLocal.time + pain_delay + 1; // ignore pain since we'll play our landing anim
|
||||
Damage( NULL, NULL, idVec3( 0, 0, -1 ), "damage_softfall", 1.0f, 0 );
|
||||
Damage( NULL, NULL, idVec3( 0, 0, -1 ), "damage_softfall", 1.0f, 0, idVec3( 0, 0, 0 ) );
|
||||
}
|
||||
} else if ( delta > 7 ) {
|
||||
AI_SOFTLANDING = true;
|
||||
|
@ -6094,7 +6094,7 @@ void idPlayer::UpdateAir( void ) {
|
|||
const idDict *damageDef = gameLocal.FindEntityDefDict( "damage_noair", false );
|
||||
int dmgTiming = 1000 * ((damageDef) ? damageDef->GetFloat( "delay", "3.0" ) : 3.0f );
|
||||
if ( gameLocal.time > lastAirDamage + dmgTiming ) {
|
||||
Damage( NULL, NULL, vec3_origin, "damage_noair", 1.0f, 0 );
|
||||
Damage( NULL, NULL, vec3_origin, "damage_noair", 1.0f, 0, idVec3( 0, 0, 0 ) );
|
||||
lastAirDamage = gameLocal.time;
|
||||
}
|
||||
}
|
||||
|
@ -7761,7 +7761,7 @@ void idPlayer::Kill( bool delayRespawn, bool nodamage ) {
|
|||
ServerSpectate( true );
|
||||
forceRespawn = true;
|
||||
} else {
|
||||
Damage( this, this, vec3_origin, "damage_suicide", 1.0f, INVALID_JOINT );
|
||||
Damage( this, this, vec3_origin, "damage_suicide", 1.0f, INVALID_JOINT, idVec3( 0, 0, 0 ) );
|
||||
if ( delayRespawn ) {
|
||||
forceRespawn = false;
|
||||
int delay = spawnArgs.GetFloat( "respawn_delay" );
|
||||
|
@ -8038,7 +8038,7 @@ inflictor, attacker, dir, and point can be NULL for environmental effects
|
|||
============
|
||||
*/
|
||||
void idPlayer::Damage( idEntity *inflictor, idEntity *attacker, const idVec3 &dir,
|
||||
const char *damageDefName, const float damageScale, const int location ) {
|
||||
const char *damageDefName, const float damageScale, const int location, const idVec3 &iPoint ) {
|
||||
idVec3 kick;
|
||||
int damage;
|
||||
int armorSave;
|
||||
|
@ -9258,7 +9258,7 @@ void idPlayer::Event_ExitTeleporter( void ) {
|
|||
|
||||
if ( teleportKiller != -1 ) {
|
||||
// we got killed while being teleported
|
||||
Damage( gameLocal.entities[ teleportKiller ], gameLocal.entities[ teleportKiller ], vec3_origin, "damage_telefrag", 1.0f, INVALID_JOINT );
|
||||
Damage( gameLocal.entities[ teleportKiller ], gameLocal.entities[ teleportKiller ], vec3_origin, "damage_telefrag", 1.0f, INVALID_JOINT, idVec3( 0, 0, 0 ) );
|
||||
teleportKiller = -1;
|
||||
} else {
|
||||
// kill anything that would have waited at teleport exit
|
||||
|
|
|
@ -454,7 +454,7 @@ public:
|
|||
virtual void DamageFeedback( idEntity *victim, idEntity *inflictor, int &damage );
|
||||
void CalcDamagePoints( idEntity *inflictor, idEntity *attacker, const idDict *damageDef,
|
||||
const float damageScale, const int location, int *health, int *armor );
|
||||
virtual void Damage( idEntity *inflictor, idEntity *attacker, const idVec3 &dir, const char *damageDefName, const float damageScale, const int location );
|
||||
virtual void Damage( idEntity *inflictor, idEntity *attacker, const idVec3 &dir, const char *damageDefName, const float damageScale, const int location, const idVec3 &iPoint );
|
||||
|
||||
// use exitEntityNum to specify a teleport with private camera view and delayed exit
|
||||
virtual void Teleport( const idVec3 &origin, const idAngles &angles, idEntity *destination );
|
||||
|
|
|
@ -632,7 +632,7 @@ bool idProjectile::Collide( const trace_t &collision, const idVec3 &velocity ) {
|
|||
}
|
||||
|
||||
if ( damageDefName[0] != '\0' ) {
|
||||
ent->Damage( this, owner.GetEntity(), dir, damageDefName, damageScale, CLIPMODEL_ID_TO_JOINT_HANDLE( collision.c.id ) );
|
||||
ent->Damage( this, owner.GetEntity(), dir, damageDefName, damageScale, CLIPMODEL_ID_TO_JOINT_HANDLE( collision.c.id ), idVec3( collision.c.point ) );
|
||||
ignore = ent;
|
||||
}
|
||||
}
|
||||
|
@ -1727,7 +1727,7 @@ void idSoulCubeMissile::KillTarget( const idVec3 &dir ) {
|
|||
if ( ( act->health > 0 ) && ownerEnt && ownerEnt->IsType( idPlayer::Type ) && ( ownerEnt->health > 0 ) && !act->spawnArgs.GetBool( "boss" ) ) {
|
||||
static_cast<idPlayer *>( ownerEnt )->GiveHealthPool( act->health );
|
||||
}
|
||||
act->Damage( this, owner.GetEntity(), dir, spawnArgs.GetString( "def_damage" ), 1.0f, INVALID_JOINT );
|
||||
act->Damage( this, owner.GetEntity(), dir, spawnArgs.GetString( "def_damage" ), 1.0f, INVALID_JOINT, idVec3( 0, 0, 0 ) );
|
||||
act->GetAFPhysics()->SetTimeScale( 0.25 );
|
||||
StartSound( "snd_explode", SND_CHANNEL_BODY, 0, false, NULL );
|
||||
}
|
||||
|
@ -2034,7 +2034,7 @@ void idBFGProjectile::Think( void ) {
|
|||
#endif
|
||||
org = beamTargets[i].target.GetEntity()->GetPhysics()->GetOrigin() - GetPhysics()->GetOrigin();
|
||||
org.Normalize();
|
||||
beamTargets[i].target.GetEntity()->Damage( this, owner.GetEntity(), org, damageFreq, ( damagePower ) ? damagePower : 1.0f, INVALID_JOINT );
|
||||
beamTargets[i].target.GetEntity()->Damage( this, owner.GetEntity(), org, damageFreq, ( damagePower ) ? damagePower : 1.0f, INVALID_JOINT, idVec3( 0, 0, 0 ) );
|
||||
} else {
|
||||
beamTargets[i].renderEntity.shaderParms[ SHADERPARM_RED ] =
|
||||
beamTargets[i].renderEntity.shaderParms[ SHADERPARM_GREEN ] =
|
||||
|
@ -2277,7 +2277,7 @@ void idBFGProjectile::Explode( const trace_t &collision, idEntity *ignore ) {
|
|||
if ( damage[0] && ( beamTargets[i].target.GetEntity()->entityNumber > gameLocal.numClients - 1 ) ) {
|
||||
dir = beamTargets[i].target.GetEntity()->GetPhysics()->GetOrigin() - GetPhysics()->GetOrigin();
|
||||
dir.Normalize();
|
||||
beamTargets[i].target.GetEntity()->Damage( this, ownerEnt, dir, damage, damageScale, ( collision.c.id < 0 ) ? CLIPMODEL_ID_TO_JOINT_HANDLE( collision.c.id ) : INVALID_JOINT );
|
||||
beamTargets[i].target.GetEntity()->Damage( this, ownerEnt, dir, damage, damageScale, ( collision.c.id < 0 ) ? CLIPMODEL_ID_TO_JOINT_HANDLE( collision.c.id ) : INVALID_JOINT, idVec3( collision.c.point ) );
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -147,7 +147,7 @@ void idTarget_Damage::Event_Activate( idEntity *activator ) {
|
|||
for( i = 0; i < targets.Num(); i++ ) {
|
||||
ent = targets[ i ].GetEntity();
|
||||
if ( ent ) {
|
||||
ent->Damage( this, this, vec3_origin, damage, 1.0f, INVALID_JOINT );
|
||||
ent->Damage( this, this, vec3_origin, damage, 1.0f, INVALID_JOINT, idVec3( 0, 0, 0 ) );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1019,9 +1019,9 @@ void idTrigger_Hurt::Event_Touch( idEntity *other, trace_t *trace ) {
|
|||
dir = other->GetPhysics()->GetOrigin() - GetPhysics()->GetOrigin();
|
||||
dir.Normalize();
|
||||
}
|
||||
other->Damage( NULL, NULL, dir, damage, 1.0f, INVALID_JOINT );
|
||||
other->Damage( NULL, NULL, dir, damage, 1.0f, INVALID_JOINT, trace->c.point );
|
||||
#else
|
||||
other->Damage( NULL, NULL, vec3_origin, damage, 1.0f, INVALID_JOINT );
|
||||
other->Damage( NULL, NULL, vec3_origin, damage, 1.0f, INVALID_JOINT, trace->c.point );
|
||||
#endif
|
||||
|
||||
ActivateTargets( other );
|
||||
|
|
|
@ -357,10 +357,10 @@ void idWeapon::Save( idSaveGame *savefile ) const {
|
|||
savefile->WriteVec3( muzzle_kick_offset );
|
||||
|
||||
savefile->WriteInt( ammoType );
|
||||
savefile->WriteInt( ammoRequired );
|
||||
savefile->WriteInt( clipSize );
|
||||
savefile->WriteInt( ammoClip );
|
||||
savefile->WriteInt( lowAmmo );
|
||||
savefile->WriteFloat( ammoRequired );
|
||||
savefile->WriteFloat( clipSize );
|
||||
savefile->WriteFloat( ammoClip );
|
||||
savefile->WriteFloat( lowAmmo );
|
||||
savefile->WriteBool( powerAmmo );
|
||||
|
||||
// savegames <= 17
|
||||
|
@ -556,10 +556,10 @@ void idWeapon::Restore( idRestoreGame *savefile ) {
|
|||
savefile->ReadVec3( muzzle_kick_offset );
|
||||
|
||||
savefile->ReadInt( (int &)ammoType );
|
||||
savefile->ReadInt( ammoRequired );
|
||||
savefile->ReadInt( clipSize );
|
||||
savefile->ReadInt( ammoClip );
|
||||
savefile->ReadInt( lowAmmo );
|
||||
savefile->ReadFloat( ammoRequired );
|
||||
savefile->ReadFloat( clipSize );
|
||||
savefile->ReadFloat( ammoClip );
|
||||
savefile->ReadFloat( lowAmmo );
|
||||
savefile->ReadBool( powerAmmo );
|
||||
|
||||
// savegame versions <= 17
|
||||
|
@ -952,9 +952,9 @@ void idWeapon::GetWeaponDef( const char *objectname, int ammoinclip ) {
|
|||
weaponDef = gameLocal.FindEntityDef( objectname );
|
||||
|
||||
ammoType = GetAmmoNumForName( weaponDef->dict.GetString( "ammoType" ) );
|
||||
ammoRequired = weaponDef->dict.GetInt( "ammoRequired" );
|
||||
clipSize = weaponDef->dict.GetInt( "clipSize" );
|
||||
lowAmmo = weaponDef->dict.GetInt( "lowAmmo" );
|
||||
ammoRequired = weaponDef->dict.GetFloat( "ammoRequired" );
|
||||
clipSize = weaponDef->dict.GetFloat( "clipSize" );
|
||||
lowAmmo = weaponDef->dict.GetFloat( "lowAmmo" );
|
||||
|
||||
icon = weaponDef->dict.GetString( "icon" );
|
||||
silent_fire = weaponDef->dict.GetBool( "silent_fire" );
|
||||
|
@ -2894,7 +2894,7 @@ void idWeapon::Event_WeaponLowering( void ) {
|
|||
idWeapon::Event_UseAmmo
|
||||
===============
|
||||
*/
|
||||
void idWeapon::Event_UseAmmo( int amount ) {
|
||||
void idWeapon::Event_UseAmmo( float amount ) {
|
||||
if ( gameLocal.isClient ) {
|
||||
return;
|
||||
}
|
||||
|
@ -2913,7 +2913,7 @@ void idWeapon::Event_UseAmmo( int amount ) {
|
|||
idWeapon::Event_AddToClip
|
||||
===============
|
||||
*/
|
||||
void idWeapon::Event_AddToClip( int amount ) {
|
||||
void idWeapon::Event_AddToClip( float amount ) {
|
||||
int ammoAvail;
|
||||
|
||||
if ( gameLocal.isClient ) {
|
||||
|
@ -2921,7 +2921,7 @@ void idWeapon::Event_AddToClip( int amount ) {
|
|||
}
|
||||
|
||||
#ifdef _D3XP
|
||||
int oldAmmo = ammoClip;
|
||||
float oldAmmo = ammoClip;
|
||||
ammoAvail = owner->inventory.HasAmmo( ammoType, ammoRequired ) + AmmoInClip();
|
||||
#endif
|
||||
|
||||
|
@ -2941,7 +2941,7 @@ void idWeapon::Event_AddToClip( int amount ) {
|
|||
|
||||
#ifdef _D3XP
|
||||
// for shared ammo we need to use the ammo when it is moved into the clip
|
||||
int usedAmmo = ammoClip - oldAmmo;
|
||||
float usedAmmo = ammoClip - oldAmmo;
|
||||
owner->inventory.UseAmmo(ammoType, usedAmmo);
|
||||
#endif
|
||||
}
|
||||
|
@ -2952,7 +2952,7 @@ idWeapon::Event_AmmoInClip
|
|||
===============
|
||||
*/
|
||||
void idWeapon::Event_AmmoInClip( void ) {
|
||||
int ammo = AmmoInClip();
|
||||
float ammo = AmmoInClip();
|
||||
idThread::ReturnFloat( ammo );
|
||||
}
|
||||
|
||||
|
@ -2963,10 +2963,10 @@ idWeapon::Event_AmmoAvailable
|
|||
*/
|
||||
void idWeapon::Event_AmmoAvailable( void ) {
|
||||
#ifdef _D3XP
|
||||
int ammoAvail = owner->inventory.HasAmmo( ammoType, ammoRequired );
|
||||
float ammoAvail = owner->inventory.HasAmmo( ammoType, ammoRequired );
|
||||
ammoAvail += AmmoInClip();
|
||||
#else
|
||||
int ammoAvail = owner->inventory.HasAmmo( ammoType, ammoRequired );
|
||||
float ammoAvail = owner->inventory.HasAmmo( ammoType, ammoRequired );
|
||||
#endif
|
||||
|
||||
idThread::ReturnFloat( ammoAvail );
|
||||
|
@ -3308,13 +3308,14 @@ void idWeapon::Event_LaunchProjectiles( int num_projectiles, float spread, float
|
|||
|
||||
#ifdef _D3XP
|
||||
|
||||
float ammoAvail = owner->inventory.HasAmmo( ammoType, ammoRequired );
|
||||
if ( ( clipSize != 0 ) && ( ammoClip <= 0 ) ) {
|
||||
return;
|
||||
}
|
||||
|
||||
#else
|
||||
// check if we're out of ammo or the clip is empty
|
||||
int ammoAvail = owner->inventory.HasAmmo( ammoType, ammoRequired );
|
||||
float ammoAvail = owner->inventory.HasAmmo( ammoType, ammoRequired );
|
||||
if ( !ammoAvail || ( ( clipSize != 0 ) && ( ammoClip <= 0 ) ) ) {
|
||||
return;
|
||||
}
|
||||
|
@ -3515,6 +3516,7 @@ void idWeapon::Event_LaunchProjectilesEllipse( int num_projectiles, float spread
|
|||
// avoid all ammo considerations on a client
|
||||
if ( !gameLocal.isClient ) {
|
||||
|
||||
float ammoAvail = owner->inventory.HasAmmo( ammoType, ammoRequired );
|
||||
if ( ( clipSize != 0 ) && ( ammoClip <= 0 ) ) {
|
||||
return;
|
||||
}
|
||||
|
@ -3629,7 +3631,7 @@ void idWeapon::Event_LaunchProjectilesEllipse( int num_projectiles, float spread
|
|||
* Gives the player a powerup as if it were a weapon shot. It will use the ammo amount specified
|
||||
* as ammoRequired.
|
||||
*/
|
||||
void idWeapon::Event_LaunchPowerup( const char* powerup, float duration, int useAmmo ) {
|
||||
void idWeapon::Event_LaunchPowerup( const char* powerup, float duration, float useAmmo ) {
|
||||
|
||||
if ( IsHidden() ) {
|
||||
return;
|
||||
|
@ -3637,7 +3639,7 @@ void idWeapon::Event_LaunchPowerup( const char* powerup, float duration, int use
|
|||
|
||||
// check if we're out of ammo
|
||||
if(useAmmo) {
|
||||
int ammoAvail = owner->inventory.HasAmmo( ammoType, ammoRequired );
|
||||
float ammoAvail = owner->inventory.HasAmmo( ammoType, ammoRequired );
|
||||
if ( !ammoAvail ) {
|
||||
return;
|
||||
}
|
||||
|
@ -3801,7 +3803,7 @@ void idWeapon::Event_Melee( void ) {
|
|||
//Only do a quater of the damage mod
|
||||
mod *= 0.25f;
|
||||
}
|
||||
ent->Damage( owner, owner, globalKickDir, meleeDefName, mod, tr.c.id );
|
||||
ent->Damage( owner, owner, globalKickDir, meleeDefName, mod, tr.c.id, tr.c.point );
|
||||
#else
|
||||
ent->Damage( owner, owner, globalKickDir, meleeDefName, owner->PowerUpModifier( MELEE_DAMAGE ), tr.c.id );
|
||||
#endif
|
||||
|
|
|
@ -288,10 +288,10 @@ private:
|
|||
|
||||
// ammo management
|
||||
ammo_t ammoType;
|
||||
int ammoRequired; // amount of ammo to use each shot. 0 means weapon doesn't need ammo.
|
||||
int clipSize; // 0 means no reload
|
||||
int ammoClip;
|
||||
int lowAmmo; // if ammo in clip hits this threshold, snd_
|
||||
float ammoRequired; // amount of ammo to use each shot. 0 means weapon doesn't need ammo.
|
||||
float clipSize; // 0 means no reload
|
||||
float ammoClip;
|
||||
float lowAmmo; // if ammo in clip hits this threshold, snd_
|
||||
bool powerAmmo; // true if the clip reduction is a factor of the power setting when
|
||||
// a projectile is launched
|
||||
// mp client
|
||||
|
@ -371,8 +371,8 @@ private:
|
|||
void Event_WeaponHolstered( void );
|
||||
void Event_WeaponRising( void );
|
||||
void Event_WeaponLowering( void );
|
||||
void Event_UseAmmo( int amount );
|
||||
void Event_AddToClip( int amount );
|
||||
void Event_UseAmmo( float amount );
|
||||
void Event_AddToClip( float amount );
|
||||
void Event_AmmoInClip( void );
|
||||
void Event_AmmoAvailable( void );
|
||||
void Event_TotalAmmoCount( void );
|
||||
|
@ -407,7 +407,7 @@ private:
|
|||
void Event_GrabberHasTarget( void );
|
||||
void Event_GrabberSetGrabDistance( float dist );
|
||||
void Event_LaunchProjectilesEllipse( int num_projectiles, float spreada, float spreadb, float fuseOffset, float power );
|
||||
void Event_LaunchPowerup( const char* powerup, float duration, int useAmmo );
|
||||
void Event_LaunchPowerup( const char* powerup, float duration, float useAmmo );
|
||||
|
||||
void Event_StartWeaponSmoke();
|
||||
void Event_StopWeaponSmoke();
|
||||
|
|
Loading…
Reference in a new issue