mirror of
https://github.com/openmoh/openmohaa.git
synced 2025-05-10 12:36:38 +03:00
Finalized actor_weaponless
This commit is contained in:
parent
0b1e8cdbf3
commit
6eff8bc273
2 changed files with 67 additions and 55 deletions
|
@ -550,6 +550,9 @@ enum eActorState_BalconyKilled {
|
||||||
//
|
//
|
||||||
enum eActorState_WeaponLess {
|
enum eActorState_WeaponLess {
|
||||||
ACTOR_STATE_WEAPONLESS_START = ACTOR_STATE_WEAPONLESS,
|
ACTOR_STATE_WEAPONLESS_START = ACTOR_STATE_WEAPONLESS,
|
||||||
|
ACTOR_STATE_WEAPONLESS_NORMAL = ACTOR_STATE_WEAPONLESS_START,
|
||||||
|
ACTOR_STATE_WEAPONLESS_GRENADE,
|
||||||
|
ACTOR_STATE_WEAPONLESS_LOOP
|
||||||
};
|
};
|
||||||
|
|
||||||
//
|
//
|
||||||
|
|
|
@ -46,16 +46,16 @@ void Actor::Begin_Weaponless(void)
|
||||||
if (AttackEntryAnimation()) {
|
if (AttackEntryAnimation()) {
|
||||||
m_bLockThinkState = true;
|
m_bLockThinkState = true;
|
||||||
|
|
||||||
TransitionState(902, 0);
|
TransitionState(ACTOR_STATE_WEAPONLESS_LOOP, 0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
TransitionState(900, 0);
|
TransitionState(ACTOR_STATE_WEAPONLESS_START, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Actor::Suspend_Weaponless(void)
|
void Actor::Suspend_Weaponless(void)
|
||||||
{
|
{
|
||||||
if (m_State <= 902) {
|
if (m_State == ACTOR_STATE_WEAPONLESS_GRENADE || m_State == ACTOR_STATE_WEAPONLESS_LOOP) {
|
||||||
TransitionState(900, 0);
|
TransitionState(ACTOR_STATE_WEAPONLESS_START, 0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -65,74 +65,83 @@ void Actor::State_Weaponless_Normal(void)
|
||||||
if (m_bScriptGoalValid) {
|
if (m_bScriptGoalValid) {
|
||||||
SetPath(m_vScriptGoal, NULL, 0, NULL, 0);
|
SetPath(m_vScriptGoal, NULL, 0, NULL, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (PathExists() && !PathComplete()) {
|
if (PathExists() && !PathComplete()) {
|
||||||
FaceMotion();
|
FaceMotion();
|
||||||
Anim_RunToDanger(3);
|
Anim_RunToDanger(ANIM_MODE_PATH_GOAL);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
m_bScriptGoalValid = false;
|
||||||
|
|
||||||
|
AimAtTargetPos();
|
||||||
|
Anim_Stand();
|
||||||
|
|
||||||
|
if (level.inttime < m_iStateTime) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (DecideToThrowGrenade(m_Enemy->origin + m_Enemy->velocity, &m_vGrenadeVel, &m_eGrenadeMode, false)) {
|
||||||
|
SetDesiredYawDir(m_vGrenadeVel);
|
||||||
|
DesiredAnimation(
|
||||||
|
ANIM_MODE_NORMAL,
|
||||||
|
m_eGrenadeMode == AI_GREN_TOSS_ROLL ? STRING_ANIM_GRENADETOSS_SCR : STRING_ANIM_GRENADETHROW_SCR
|
||||||
|
);
|
||||||
|
TransitionState(ACTOR_STATE_WEAPONLESS_GRENADE);
|
||||||
} else {
|
} else {
|
||||||
m_bScriptGoalValid = false;
|
TransitionState(ACTOR_STATE_WEAPONLESS_START, 1000);
|
||||||
|
|
||||||
AimAtTargetPos();
|
|
||||||
|
|
||||||
Anim_Stand();
|
|
||||||
if (level.inttime >= m_iStateTime) {
|
|
||||||
if (DecideToThrowGrenade(m_Enemy->velocity + m_Enemy->origin, &m_vGrenadeVel, &m_eGrenadeMode, false)) {
|
|
||||||
SetDesiredYawDir(m_vGrenadeVel);
|
|
||||||
|
|
||||||
m_State = 901;
|
|
||||||
m_eNextAnimMode = ANIM_MODE_NORMAL;
|
|
||||||
m_bNextForceStart = false;
|
|
||||||
m_csNextAnimString =
|
|
||||||
(m_eGrenadeMode == AI_GREN_TOSS_ROLL) ? STRING_ANIM_GRENADETOSS_SCR : STRING_ANIM_GRENADETHROW_SCR;
|
|
||||||
iStateTime = level.inttime;
|
|
||||||
} else {
|
|
||||||
m_State = 900;
|
|
||||||
iStateTime = level.inttime + 1000;
|
|
||||||
}
|
|
||||||
m_iStateTime = iStateTime;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Actor::Think_Weaponless(void)
|
void Actor::Think_Weaponless(void)
|
||||||
{
|
{
|
||||||
if (RequireThink()) {
|
if (!RequireThink()) {
|
||||||
UpdateEyeOrigin();
|
return;
|
||||||
NoPoint();
|
}
|
||||||
UpdateEnemy(500);
|
|
||||||
|
|
||||||
if (m_State == 902) {
|
UpdateEyeOrigin();
|
||||||
ContinueAnimation();
|
NoPoint();
|
||||||
|
UpdateEnemy(500);
|
||||||
|
|
||||||
|
if (m_State == ACTOR_STATE_WEAPONLESS_LOOP) {
|
||||||
|
ContinueAnimation();
|
||||||
|
} else {
|
||||||
|
m_bLockThinkState = false;
|
||||||
|
|
||||||
|
if (!m_Enemy) {
|
||||||
|
SetThinkState(THINKSTATE_IDLE, THINKLEVEL_IDLE);
|
||||||
|
IdleThink();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (m_State == ACTOR_STATE_WEAPONLESS_START) {
|
||||||
|
State_Weaponless_Normal();
|
||||||
|
} else if (m_State == ACTOR_STATE_WEAPONLESS_GRENADE) {
|
||||||
|
State_Weaponless_Grenade();
|
||||||
} else {
|
} else {
|
||||||
m_bLockThinkState = false;
|
Com_Printf("Think_Weaponless: invalid think state %i\n", m_State);
|
||||||
if (!m_Enemy) {
|
char assertStr[16317] = {0};
|
||||||
SetThinkState(THINKSTATE_IDLE, THINKLEVEL_IDLE);
|
strcpy(assertStr, "\"invalid think state\"\n\tMessage: ");
|
||||||
IdleThink();
|
Q_strcat(assertStr, sizeof(assertStr), DumpCallTrace("thinkstate = %i", m_State));
|
||||||
return;
|
assert(!assertStr);
|
||||||
}
|
}
|
||||||
if (m_State == 900) {
|
|
||||||
State_Weaponless_Normal();
|
if (!CheckForTransition(THINKSTATE_GRENADE, THINKLEVEL_IDLE)) {
|
||||||
} else if (m_State == 901) {
|
|
||||||
State_Weaponless_Grenade();
|
|
||||||
} else {
|
|
||||||
Com_Printf("Think_Weaponless: invalid think state %i\n", m_State);
|
|
||||||
char assertStr[16317] = {0};
|
|
||||||
strcpy(assertStr, "\"invalid think state\"\n\tMessage: ");
|
|
||||||
Q_strcat(assertStr, sizeof(assertStr), DumpCallTrace("thinkstate = %i", m_State));
|
|
||||||
assert(!assertStr);
|
|
||||||
}
|
|
||||||
CheckForTransition(THINKSTATE_GRENADE, THINKLEVEL_IDLE);
|
CheckForTransition(THINKSTATE_GRENADE, THINKLEVEL_IDLE);
|
||||||
}
|
}
|
||||||
PostThink(true);
|
}
|
||||||
if (GetWeapon(WEAPON_MAIN)) {
|
|
||||||
SetThink(THINKSTATE_ATTACK, THINK_TURRET);
|
PostThink(true);
|
||||||
}
|
|
||||||
|
if (GetWeapon(WEAPON_MAIN)) {
|
||||||
|
SetThink(THINKSTATE_ATTACK, THINK_TURRET);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Actor::FinishedAnimation_Weaponless(void)
|
void Actor::FinishedAnimation_Weaponless(void)
|
||||||
{
|
{
|
||||||
if (m_State <= 902) {
|
if (m_State == ACTOR_STATE_WEAPONLESS_GRENADE || m_State == ACTOR_STATE_WEAPONLESS_LOOP) {
|
||||||
TransitionState(900, 4000);
|
TransitionState(ACTOR_STATE_WEAPONLESS_NORMAL, 4000);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue