Rename critter maneuver flags
This commit is contained in:
parent
ad3860790c
commit
6cac53d20b
|
@ -2581,7 +2581,7 @@ static void _combat_begin(Object* a1)
|
||||||
for (int index = 0; index < _list_total; index++) {
|
for (int index = 0; index < _list_total; index++) {
|
||||||
Object* critter = _combat_list[index];
|
Object* critter = _combat_list[index];
|
||||||
CritterCombatData* combatData = &(critter->data.critter.combat);
|
CritterCombatData* combatData = &(critter->data.critter.combat);
|
||||||
combatData->maneuver &= CRITTER_MANEUVER_0x01;
|
combatData->maneuver &= CRITTER_MANEUVER_ENGAGING;
|
||||||
combatData->damageLastTurn = 0;
|
combatData->damageLastTurn = 0;
|
||||||
combatData->whoHitMe = NULL;
|
combatData->whoHitMe = NULL;
|
||||||
combatData->ap = 0;
|
combatData->ap = 0;
|
||||||
|
@ -3032,8 +3032,8 @@ static void _combat_sequence()
|
||||||
Object* critter = _combat_list[index];
|
Object* critter = _combat_list[index];
|
||||||
if (critter != gDude) {
|
if (critter != gDude) {
|
||||||
if ((critter->data.critter.combat.results & DAM_KNOCKED_OUT) != 0
|
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_DISENGAGING) {
|
||||||
critter->data.critter.combat.maneuver &= ~CRITTER_MANEUVER_0x01;
|
critter->data.critter.combat.maneuver &= ~CRITTER_MANEUVER_ENGAGING;
|
||||||
_list_noncom += 1;
|
_list_noncom += 1;
|
||||||
|
|
||||||
_combat_list[index] = _combat_list[count - 1];
|
_combat_list[index] = _combat_list[count - 1];
|
||||||
|
|
|
@ -1189,7 +1189,7 @@ static void _ai_run_away(Object* a1, Object* a2)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} 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);
|
Object* obj = objectFindFirstAtElevation(attackerTeam->elevation);
|
||||||
while (obj != NULL) {
|
while (obj != NULL) {
|
||||||
if (PID_TYPE(obj->pid) == OBJ_TYPE_CRITTER && obj != gDude) {
|
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();
|
obj = objectFindNextAtElevation();
|
||||||
}
|
}
|
||||||
|
@ -3081,7 +3081,7 @@ void _combat_ai(Object* a1, Object* a2)
|
||||||
} else {
|
} else {
|
||||||
int perception = critterGetStat(a1, STAT_PERCEPTION);
|
int perception = critterGetStat(a1, STAT_PERCEPTION);
|
||||||
if (!_ai_find_friend(a1, perception * 2, 5)) {
|
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);
|
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;
|
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;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3187,7 +3187,7 @@ bool _combatai_want_to_stop(Object* a1)
|
||||||
{
|
{
|
||||||
_process_bk();
|
_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;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3589,9 +3589,9 @@ void _combatai_notify_onlookers(Object* a1)
|
||||||
{
|
{
|
||||||
for (int index = 0; index < _curr_crit_num; index++) {
|
for (int index = 0; index < _curr_crit_num; index++) {
|
||||||
Object* obj = _curr_crit_list[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)) {
|
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 ((a1->data.critter.combat.results & DAM_DEAD) != 0) {
|
||||||
if (!isWithinPerception(obj, obj->data.critter.combat.whoHitMe)) {
|
if (!isWithinPerception(obj, obj->data.critter.combat.whoHitMe)) {
|
||||||
debugPrint("\nSomebody Died and I don't know why! Run!!!");
|
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++) {
|
for (int index = 0; index < _curr_crit_num; index++) {
|
||||||
Object* obj = _curr_crit_list[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)) {
|
if (isWithinPerception(obj, a1)) {
|
||||||
obj->data.critter.combat.maneuver |= CRITTER_MANEUVER_0x01;
|
obj->data.critter.combat.maneuver |= CRITTER_MANEUVER_ENGAGING;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1254,7 +1254,7 @@ int knockoutEventProcess(Object* obj, void* data)
|
||||||
obj->data.critter.combat.results |= DAM_KNOCKED_DOWN;
|
obj->data.critter.combat.results |= DAM_KNOCKED_DOWN;
|
||||||
|
|
||||||
if (isInCombat()) {
|
if (isInCombat()) {
|
||||||
obj->data.critter.combat.maneuver |= CRITTER_MANEUVER_0x01;
|
obj->data.critter.combat.maneuver |= CRITTER_MANEUVER_ENGAGING;
|
||||||
} else {
|
} else {
|
||||||
_dude_standup(obj);
|
_dude_standup(obj);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1844,8 +1844,8 @@ static void opAttackComplex(Program* program)
|
||||||
|
|
||||||
if (isInCombat()) {
|
if (isInCombat()) {
|
||||||
CritterCombatData* combatData = &(self->data.critter.combat);
|
CritterCombatData* combatData = &(self->data.critter.combat);
|
||||||
if ((combatData->maneuver & CRITTER_MANEUVER_0x01) == 0) {
|
if ((combatData->maneuver & CRITTER_MANEUVER_ENGAGING) == 0) {
|
||||||
combatData->maneuver |= CRITTER_MANEUVER_0x01;
|
combatData->maneuver |= CRITTER_MANEUVER_ENGAGING;
|
||||||
combatData->whoHitMe = target;
|
combatData->whoHitMe = target;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
@ -4431,8 +4431,8 @@ static void opAttackSetup(Program* program)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isInCombat()) {
|
if (isInCombat()) {
|
||||||
if ((attacker->data.critter.combat.maneuver & CRITTER_MANEUVER_0x01) == 0) {
|
if ((attacker->data.critter.combat.maneuver & CRITTER_MANEUVER_ENGAGING) == 0) {
|
||||||
attacker->data.critter.combat.maneuver |= CRITTER_MANEUVER_0x01;
|
attacker->data.critter.combat.maneuver |= CRITTER_MANEUVER_ENGAGING;
|
||||||
attacker->data.critter.combat.whoHitMe = defender;
|
attacker->data.critter.combat.whoHitMe = defender;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
@ -4756,7 +4756,7 @@ static void opTerminateCombat(Program* program)
|
||||||
Object* self = scriptGetSelf(program);
|
Object* self = scriptGetSelf(program);
|
||||||
if (self != NULL) {
|
if (self != NULL) {
|
||||||
if (PID_TYPE(self->pid) == OBJ_TYPE_CRITTER) {
|
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;
|
self->data.critter.combat.whoHitMe = NULL;
|
||||||
aiInfoSetLastTarget(self, NULL);
|
aiInfoSetLastTarget(self, NULL);
|
||||||
}
|
}
|
||||||
|
@ -4785,7 +4785,7 @@ static void opCritterStopAttacking(Program* program)
|
||||||
Object* obj = static_cast<Object*>(programStackPopPointer(program));
|
Object* obj = static_cast<Object*>(programStackPopPointer(program));
|
||||||
|
|
||||||
if (obj != NULL) {
|
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;
|
obj->data.critter.combat.whoHitMe = NULL;
|
||||||
aiInfoSetLastTarget(obj, NULL);
|
aiInfoSetLastTarget(obj, NULL);
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -118,8 +118,8 @@ typedef enum CritterFlags {
|
||||||
|
|
||||||
typedef enum CritterManeuver {
|
typedef enum CritterManeuver {
|
||||||
CRITTER_MANEUVER_NONE = 0,
|
CRITTER_MANEUVER_NONE = 0,
|
||||||
CRITTER_MANEUVER_0x01 = 0x01,
|
CRITTER_MANEUVER_ENGAGING = 0x01,
|
||||||
CRITTER_MANEUVER_STOP_ATTACKING = 0x02,
|
CRITTER_MANEUVER_DISENGAGING = 0x02,
|
||||||
CRITTER_MANUEVER_FLEEING = 0x04,
|
CRITTER_MANUEVER_FLEEING = 0x04,
|
||||||
} CritterManeuver;
|
} CritterManeuver;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue