mirror of
https://github.com/jmarshall23/DoomRTX.git
synced 2026-08-16 16:20:42 +02:00
Switched Doom 3 weapons to native.
This commit is contained in:
@@ -0,0 +1,50 @@
|
||||
// BotAI_Battle_Attacked.cpp
|
||||
//
|
||||
|
||||
#pragma hdrstop
|
||||
#include "precompiled.h"
|
||||
#include "../Game_local.h"
|
||||
|
||||
/*
|
||||
==================
|
||||
rvmBot::state_Attacked
|
||||
==================
|
||||
*/
|
||||
stateResult_t rvmBot::state_Attacked(stateParms_t* parms) {
|
||||
// respawn if dead.
|
||||
if (BotIsDead(&bs))
|
||||
{
|
||||
stateThread.SetState("state_Respawn");
|
||||
return SRESULT_DONE_FRAME;
|
||||
}
|
||||
|
||||
if (gameLocal.SysScriptTime() > bs.aggressiveAttackTime || bs.weaponnum == 0) {
|
||||
stateThread.SetState("state_Retreat");
|
||||
return SRESULT_DONE;
|
||||
}
|
||||
|
||||
// Ensure the target is a player.
|
||||
idPlayer *entinfo = gameLocal.entities[bs.enemy]->Cast<idPlayer>();
|
||||
if (!entinfo)
|
||||
{
|
||||
stateThread.SetState("state_SeekLTG");
|
||||
return SRESULT_DONE_FRAME;
|
||||
}
|
||||
|
||||
// If our enemy is dead, search for another LTG.
|
||||
if (EntityIsDead(entinfo))
|
||||
{
|
||||
stateThread.SetState("state_SeekLTG");
|
||||
return SRESULT_DONE_FRAME;
|
||||
}
|
||||
|
||||
bs.currentGoal.origin = bs.lastenemyorigin;
|
||||
|
||||
//aim at the enemy
|
||||
BotAimAtEnemy(&bs);
|
||||
|
||||
//attack the enemy if possible
|
||||
BotCheckAttack(&bs);
|
||||
|
||||
return SRESULT_WAIT;
|
||||
}
|
||||
Reference in New Issue
Block a user