Rename critter maneuver flags

This commit is contained in:
Alexander Batalov 2023-01-16 16:49:50 +03:00
parent ad3860790c
commit 6cac53d20b
5 changed files with 22 additions and 22 deletions

View File

@ -2581,7 +2581,7 @@ static void _combat_begin(Object* a1)
for (int index = 0; index < _list_total; index++) {
Object* critter = _combat_list[index];
CritterCombatData* combatData = &(critter->data.critter.combat);
combatData->maneuver &= CRITTER_MANEUVER_0x01;
combatData->maneuver &= CRITTER_MANEUVER_ENGAGING;
combatData->damageLastTurn = 0;
combatData->whoHitMe = NULL;
combatData->ap = 0;
@ -3032,8 +3032,8 @@ static void _combat_sequence()
Object* critter = _combat_list[index];
if (critter != gDude) {
if ((critter->data.critter.combat.results & DAM_KNOCKED_OUT) != 0
|| critter->data.critter.combat.maneuver == CRITTER_MANEUVER_STOP_ATTACKING) {
critter->data.critter.combat.maneuver &= ~CRITTER_MANEUVER_0x01;
|| critter->data.critter.combat.maneuver == CRITTER_MANEUVER_DISENGAGING) {
critter->data.critter.combat.maneuver &= ~CRITTER_MANEUVER_ENGAGING;
_list_noncom += 1;
_combat_list[index] = _combat_list[count - 1];

View File

@ -1189,7 +1189,7 @@ static void _ai_run_away(Object* a1, Object* a2)
}
}
} else {
combatData->maneuver |= CRITTER_MANEUVER_STOP_ATTACKING;
combatData->maneuver |= CRITTER_MANEUVER_DISENGAGING;
}
}
@ -1686,7 +1686,7 @@ int _caiSetupTeamCombat(Object* attackerTeam, Object* defenderTeam)
Object* obj = objectFindFirstAtElevation(attackerTeam->elevation);
while (obj != NULL) {
if (PID_TYPE(obj->pid) == OBJ_TYPE_CRITTER && obj != gDude) {
obj->data.critter.combat.maneuver |= CRITTER_MANEUVER_0x01;
obj->data.critter.combat.maneuver |= CRITTER_MANEUVER_ENGAGING;
}
obj = objectFindNextAtElevation();
}
@ -3081,7 +3081,7 @@ void _combat_ai(Object* a1, Object* a2)
} else {
int perception = critterGetStat(a1, STAT_PERCEPTION);
if (!_ai_find_friend(a1, perception * 2, 5)) {
combatData->maneuver |= CRITTER_MANEUVER_STOP_ATTACKING;
combatData->maneuver |= CRITTER_MANEUVER_DISENGAGING;
}
}
}
@ -3163,11 +3163,11 @@ bool _combatai_want_to_join(Object* a1)
scriptExecProc(a1->sid, SCRIPT_PROC_COMBAT);
}
if ((a1->data.critter.combat.maneuver & CRITTER_MANEUVER_0x01) != 0) {
if ((a1->data.critter.combat.maneuver & CRITTER_MANEUVER_ENGAGING) != 0) {
return true;
}
if ((a1->data.critter.combat.maneuver & CRITTER_MANEUVER_STOP_ATTACKING) != 0) {
if ((a1->data.critter.combat.maneuver & CRITTER_MANEUVER_DISENGAGING) != 0) {
return false;
}
@ -3187,7 +3187,7 @@ bool _combatai_want_to_stop(Object* a1)
{
_process_bk();
if ((a1->data.critter.combat.maneuver & CRITTER_MANEUVER_STOP_ATTACKING) != 0) {
if ((a1->data.critter.combat.maneuver & CRITTER_MANEUVER_DISENGAGING) != 0) {
return true;
}
@ -3589,9 +3589,9 @@ void _combatai_notify_onlookers(Object* a1)
{
for (int index = 0; index < _curr_crit_num; index++) {
Object* obj = _curr_crit_list[index];
if ((obj->data.critter.combat.maneuver & CRITTER_MANEUVER_0x01) == 0) {
if ((obj->data.critter.combat.maneuver & CRITTER_MANEUVER_ENGAGING) == 0) {
if (isWithinPerception(obj, a1)) {
obj->data.critter.combat.maneuver |= CRITTER_MANEUVER_0x01;
obj->data.critter.combat.maneuver |= CRITTER_MANEUVER_ENGAGING;
if ((a1->data.critter.combat.results & DAM_DEAD) != 0) {
if (!isWithinPerception(obj, obj->data.critter.combat.whoHitMe)) {
debugPrint("\nSomebody Died and I don't know why! Run!!!");
@ -3610,9 +3610,9 @@ void _combatai_notify_friends(Object* a1)
for (int index = 0; index < _curr_crit_num; index++) {
Object* obj = _curr_crit_list[index];
if ((obj->data.critter.combat.maneuver & CRITTER_MANEUVER_0x01) == 0 && team == obj->data.critter.combat.team) {
if ((obj->data.critter.combat.maneuver & CRITTER_MANEUVER_ENGAGING) == 0 && team == obj->data.critter.combat.team) {
if (isWithinPerception(obj, a1)) {
obj->data.critter.combat.maneuver |= CRITTER_MANEUVER_0x01;
obj->data.critter.combat.maneuver |= CRITTER_MANEUVER_ENGAGING;
}
}
}

View File

@ -1254,7 +1254,7 @@ int knockoutEventProcess(Object* obj, void* data)
obj->data.critter.combat.results |= DAM_KNOCKED_DOWN;
if (isInCombat()) {
obj->data.critter.combat.maneuver |= CRITTER_MANEUVER_0x01;
obj->data.critter.combat.maneuver |= CRITTER_MANEUVER_ENGAGING;
} else {
_dude_standup(obj);
}

View File

@ -1844,8 +1844,8 @@ static void opAttackComplex(Program* program)
if (isInCombat()) {
CritterCombatData* combatData = &(self->data.critter.combat);
if ((combatData->maneuver & CRITTER_MANEUVER_0x01) == 0) {
combatData->maneuver |= CRITTER_MANEUVER_0x01;
if ((combatData->maneuver & CRITTER_MANEUVER_ENGAGING) == 0) {
combatData->maneuver |= CRITTER_MANEUVER_ENGAGING;
combatData->whoHitMe = target;
}
} else {
@ -4431,8 +4431,8 @@ static void opAttackSetup(Program* program)
}
if (isInCombat()) {
if ((attacker->data.critter.combat.maneuver & CRITTER_MANEUVER_0x01) == 0) {
attacker->data.critter.combat.maneuver |= CRITTER_MANEUVER_0x01;
if ((attacker->data.critter.combat.maneuver & CRITTER_MANEUVER_ENGAGING) == 0) {
attacker->data.critter.combat.maneuver |= CRITTER_MANEUVER_ENGAGING;
attacker->data.critter.combat.whoHitMe = defender;
}
} else {
@ -4756,7 +4756,7 @@ static void opTerminateCombat(Program* program)
Object* self = scriptGetSelf(program);
if (self != NULL) {
if (PID_TYPE(self->pid) == OBJ_TYPE_CRITTER) {
self->data.critter.combat.maneuver |= CRITTER_MANEUVER_STOP_ATTACKING;
self->data.critter.combat.maneuver |= CRITTER_MANEUVER_DISENGAGING;
self->data.critter.combat.whoHitMe = NULL;
aiInfoSetLastTarget(self, NULL);
}
@ -4785,7 +4785,7 @@ static void opCritterStopAttacking(Program* program)
Object* obj = static_cast<Object*>(programStackPopPointer(program));
if (obj != NULL) {
obj->data.critter.combat.maneuver |= CRITTER_MANEUVER_STOP_ATTACKING;
obj->data.critter.combat.maneuver |= CRITTER_MANEUVER_DISENGAGING;
obj->data.critter.combat.whoHitMe = NULL;
aiInfoSetLastTarget(obj, NULL);
} else {

View File

@ -118,8 +118,8 @@ typedef enum CritterFlags {
typedef enum CritterManeuver {
CRITTER_MANEUVER_NONE = 0,
CRITTER_MANEUVER_0x01 = 0x01,
CRITTER_MANEUVER_STOP_ATTACKING = 0x02,
CRITTER_MANEUVER_ENGAGING = 0x01,
CRITTER_MANEUVER_DISENGAGING = 0x02,
CRITTER_MANUEVER_FLEEING = 0x04,
} CritterManeuver;