From 6cac53d20bf9b5a7aa3ec889b3d6102fc424535c Mon Sep 17 00:00:00 2001 From: Alexander Batalov Date: Mon, 16 Jan 2023 16:49:50 +0300 Subject: [PATCH] Rename critter maneuver flags --- src/combat.cc | 6 +++--- src/combat_ai.cc | 20 ++++++++++---------- src/critter.cc | 2 +- src/interpreter_extra.cc | 12 ++++++------ src/obj_types.h | 4 ++-- 5 files changed, 22 insertions(+), 22 deletions(-) diff --git a/src/combat.cc b/src/combat.cc index 2b624cc..2daecf6 100644 --- a/src/combat.cc +++ b/src/combat.cc @@ -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]; diff --git a/src/combat_ai.cc b/src/combat_ai.cc index 1a55d27..0b2940d 100644 --- a/src/combat_ai.cc +++ b/src/combat_ai.cc @@ -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; } } } diff --git a/src/critter.cc b/src/critter.cc index 7b3b04a..cd896ab 100644 --- a/src/critter.cc +++ b/src/critter.cc @@ -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); } diff --git a/src/interpreter_extra.cc b/src/interpreter_extra.cc index f790004..3a2d929 100644 --- a/src/interpreter_extra.cc +++ b/src/interpreter_extra.cc @@ -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(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 { diff --git a/src/obj_types.h b/src/obj_types.h index 6ae7e13..c1d1867 100644 --- a/src/obj_types.h +++ b/src/obj_types.h @@ -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;