mirror of
https://github.com/dhewm/dhewm3-sdk.git
synced 2025-04-22 09:10:57 +00:00
Add part of modifications of Damage and TestMelee functions in d3xp: ai, gamesys and physics
This commit is contained in:
parent
926efcf0d0
commit
835ccde40d
5 changed files with 17 additions and 16 deletions
|
@ -2799,7 +2799,7 @@ void idAI::AnimMove( void ) {
|
|||
gameRenderWorld->DebugLine( colorCyan, oldorigin, physicsObj.GetOrigin(), 5000 );
|
||||
}
|
||||
|
||||
if ( !af_push_moveables && attack.Length() && TestMelee() ) {
|
||||
if ( !af_push_moveables && attack.Length() && TestMelee( idVec3() ) ) {
|
||||
DirectDamage( attack, enemy.GetEntity() );
|
||||
} else {
|
||||
idEntity *blockEnt = physicsObj.GetSlideMoveEntity();
|
||||
|
@ -2925,7 +2925,7 @@ void idAI::SlideMove( void ) {
|
|||
gameRenderWorld->DebugLine( colorCyan, oldorigin, physicsObj.GetOrigin(), 5000 );
|
||||
}
|
||||
|
||||
if ( !af_push_moveables && attack.Length() && TestMelee() ) {
|
||||
if ( !af_push_moveables && attack.Length() && TestMelee( idVec3() ) ) {
|
||||
DirectDamage( attack, enemy.GetEntity() );
|
||||
} else {
|
||||
idEntity *blockEnt = physicsObj.GetSlideMoveEntity();
|
||||
|
@ -3173,7 +3173,7 @@ void idAI::FlyMove( void ) {
|
|||
RunPhysics();
|
||||
|
||||
monsterMoveResult_t moveResult = physicsObj.GetMoveResult();
|
||||
if ( !af_push_moveables && attack.Length() && TestMelee() ) {
|
||||
if ( !af_push_moveables && attack.Length() && TestMelee( idVec3() ) ) {
|
||||
DirectDamage( attack, enemy.GetEntity() );
|
||||
} else {
|
||||
idEntity *blockEnt = physicsObj.GetSlideMoveEntity();
|
||||
|
@ -3227,7 +3227,7 @@ void idAI::StaticMove( void ) {
|
|||
|
||||
AI_ONGROUND = false;
|
||||
|
||||
if ( !af_push_moveables && attack.Length() && TestMelee() ) {
|
||||
if ( !af_push_moveables && attack.Length() && TestMelee( idVec3() ) ) {
|
||||
DirectDamage( attack, enemyEnt );
|
||||
}
|
||||
|
||||
|
@ -4395,7 +4395,7 @@ void idAI::DirectDamage( const char *meleeDefName, idEntity *ent ) {
|
|||
idVec3 globalKickDir;
|
||||
globalKickDir = ( viewAxis * physicsObj.GetGravityAxis() ) * kickDir;
|
||||
|
||||
ent->Damage( this, this, globalKickDir, meleeDefName, 1.0f, INVALID_JOINT );
|
||||
ent->Damage( this, this, globalKickDir, meleeDefName, 1.0f, INVALID_JOINT, idVec3( 0, 0, 0 ) );
|
||||
|
||||
// end the attack if we're a multiframe attack
|
||||
EndAttack();
|
||||
|
@ -4406,7 +4406,7 @@ void idAI::DirectDamage( const char *meleeDefName, idEntity *ent ) {
|
|||
idAI::TestMelee
|
||||
=====================
|
||||
*/
|
||||
bool idAI::TestMelee( void ) const {
|
||||
bool idAI::TestMelee( const idVec3 &iPoint ) const {
|
||||
trace_t trace;
|
||||
idActor *enemyEnt = enemy.GetEntity();
|
||||
|
||||
|
@ -4505,7 +4505,8 @@ bool idAI::AttackMelee( const char *meleeDefName ) {
|
|||
}
|
||||
|
||||
// make sure the trace can actually hit the enemy
|
||||
if ( forceMiss || !TestMelee() ) {
|
||||
idVec3 iPoint;
|
||||
if ( forceMiss || !TestMelee( iPoint ) ) {
|
||||
// missed
|
||||
p = meleeDef->GetString( "snd_miss" );
|
||||
if ( p && *p ) {
|
||||
|
@ -4530,7 +4531,7 @@ bool idAI::AttackMelee( const char *meleeDefName ) {
|
|||
idVec3 globalKickDir;
|
||||
globalKickDir = ( viewAxis * physicsObj.GetGravityAxis() ) * kickDir;
|
||||
|
||||
enemyEnt->Damage( this, this, globalKickDir, meleeDefName, 1.0f, INVALID_JOINT );
|
||||
enemyEnt->Damage( this, this, globalKickDir, meleeDefName, 1.0f, INVALID_JOINT, iPoint );
|
||||
|
||||
lastAttackTime = gameLocal.time;
|
||||
|
||||
|
@ -4571,7 +4572,7 @@ void idAI::PushWithAF( void ) {
|
|||
vel = ent->GetPhysics()->GetAbsBounds().GetCenter() - touchList[ i ].touchedByBody->GetWorldOrigin();
|
||||
vel.Normalize();
|
||||
if ( attack.Length() && ent->IsType( idActor::Type ) ) {
|
||||
ent->Damage( this, this, vel, attack, 1.0f, INVALID_JOINT );
|
||||
ent->Damage( this, this, vel, attack, 1.0f, INVALID_JOINT, idVec3( 0, 0, 0 ) );
|
||||
} else {
|
||||
ent->GetPhysics()->SetLinearVelocity( 100.0f * vel, touchList[ i ].touchedClipModel->GetId() );
|
||||
}
|
||||
|
|
|
@ -542,7 +542,7 @@ protected:
|
|||
idProjectile *LaunchProjectile( const char *jointname, idEntity *target, bool clampToAttackCone );
|
||||
virtual void DamageFeedback( idEntity *victim, idEntity *inflictor, int &damage );
|
||||
void DirectDamage( const char *meleeDefName, idEntity *ent );
|
||||
bool TestMelee( void ) const;
|
||||
bool TestMelee( const idVec3 &iPoint ) const;
|
||||
bool AttackMelee( const char *meleeDefName );
|
||||
void BeginAttack( const char *name );
|
||||
void EndAttack( void );
|
||||
|
|
|
@ -1922,7 +1922,7 @@ idAI::Event_TestMeleeAttack
|
|||
=====================
|
||||
*/
|
||||
void idAI::Event_TestMeleeAttack( void ) {
|
||||
bool result = TestMelee();
|
||||
bool result = TestMelee( idVec3() );
|
||||
idThread::ReturnInt( result );
|
||||
}
|
||||
|
||||
|
|
|
@ -910,7 +910,7 @@ void Cmd_Damage_f( const idCmdArgs &args ) {
|
|||
return;
|
||||
}
|
||||
|
||||
ent->Damage( gameLocal.world, gameLocal.world, idVec3( 0, 0, 1 ), "damage_moverCrush", atoi( args.Argv( 2 ) ), INVALID_JOINT );
|
||||
ent->Damage( gameLocal.world, gameLocal.world, idVec3( 0, 0, 1 ), "damage_moverCrush", atoi( args.Argv( 2 ) ), INVALID_JOINT, idVec3( 0, 0, 0 ) );
|
||||
}
|
||||
|
||||
|
||||
|
@ -1578,7 +1578,7 @@ static void Cmd_TestDamage_f( const idCmdArgs &args ) {
|
|||
// give the player full health before and after
|
||||
// running the damage
|
||||
player->health = player->inventory.maxHealth;
|
||||
player->Damage( NULL, NULL, dir, damageDefName, 1.0f, INVALID_JOINT );
|
||||
player->Damage( NULL, NULL, dir, damageDefName, 1.0f, INVALID_JOINT, idVec3( 0, 0, 0 ) );
|
||||
player->health = player->inventory.maxHealth;
|
||||
}
|
||||
|
||||
|
@ -1625,7 +1625,7 @@ static void Cmd_TestDeath_f( const idCmdArgs &args ) {
|
|||
dir[2] = 0;
|
||||
|
||||
g_testDeath.SetBool( 1 );
|
||||
player->Damage( NULL, NULL, dir, "damage_triggerhurt_1000", 1.0f, INVALID_JOINT );
|
||||
player->Damage( NULL, NULL, dir, "damage_triggerhurt_1000", 1.0f, INVALID_JOINT, idVec3( 0, 0, 0 ) );
|
||||
if ( args.Argc() >= 2) {
|
||||
player->SpawnGibs( dir, "damage_triggerhurt_1000" );
|
||||
}
|
||||
|
|
|
@ -1174,7 +1174,7 @@ float idPush::ClipTranslationalPush( trace_t &results, idEntity *pusher, const i
|
|||
|
||||
// if blocking entities should be crushed
|
||||
if ( flags & PUSHFL_CRUSH ) {
|
||||
check->Damage( clipModel->GetEntity(), clipModel->GetEntity(), vec3_origin, "damage_crush", 1.0f, CLIPMODEL_ID_TO_JOINT_HANDLE( pushResults.c.id ) );
|
||||
check->Damage( clipModel->GetEntity(), clipModel->GetEntity(), vec3_origin, "damage_crush", 1.0f, CLIPMODEL_ID_TO_JOINT_HANDLE( pushResults.c.id ), pushResults.c.point );
|
||||
continue;
|
||||
}
|
||||
|
||||
|
@ -1344,7 +1344,7 @@ float idPush::ClipRotationalPush( trace_t &results, idEntity *pusher, const int
|
|||
|
||||
// if blocking entities should be crushed
|
||||
if ( flags & PUSHFL_CRUSH ) {
|
||||
check->Damage( clipModel->GetEntity(), clipModel->GetEntity(), vec3_origin, "damage_crush", 1.0f, CLIPMODEL_ID_TO_JOINT_HANDLE( pushResults.c.id ) );
|
||||
check->Damage( clipModel->GetEntity(), clipModel->GetEntity(), vec3_origin, "damage_crush", 1.0f, CLIPMODEL_ID_TO_JOINT_HANDLE( pushResults.c.id ), pushResults.c.point );
|
||||
continue;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue