Clarify csd

This commit is contained in:
Alexander Batalov 2024-01-16 16:22:52 +03:00
parent f39518cd09
commit dd4655c6c3
3 changed files with 27 additions and 27 deletions

View File

@ -33,7 +33,7 @@ void _combat_update_critter_outline_for_los(Object* critter, bool a2);
void _combat_over_from_load(); void _combat_over_from_load();
void _combat_give_exps(int exp_points); void _combat_give_exps(int exp_points);
void _combat_turn_run(); void _combat_turn_run();
void _combat(CombatStartData* attack); void _combat(CombatStartData* csd);
void attackInit(Attack* attack, Object* attacker, Object* defender, int hitMode, int hitLocation); void attackInit(Attack* attack, Object* attacker, Object* defender, int hitMode, int hitLocation);
int _combat_attack(Object* attacker, Object* defender, int hitMode, int hitLocation); int _combat_attack(Object* attacker, Object* defender, int hitMode, int hitLocation);
int _combat_bullet_start(const Object* attacker, const Object* target); int _combat_bullet_start(const Object* attacker, const Object* target);

View File

@ -1868,27 +1868,27 @@ static void opAttackComplex(Program* program)
combatData->whoHitMe = target; combatData->whoHitMe = target;
} }
} else { } else {
CombatStartData attack; CombatStartData combat;
attack.attacker = self; combat.attacker = self;
attack.defender = target; combat.defender = target;
attack.actionPointsBonus = 0; combat.actionPointsBonus = 0;
attack.accuracyBonus = data[4]; combat.accuracyBonus = data[4];
attack.damageBonus = 0; combat.damageBonus = 0;
attack.minDamage = data[3]; combat.minDamage = data[3];
attack.maxDamage = data[2]; combat.maxDamage = data[2];
// TODO: Something is probably broken here, why it wants // TODO: Something is probably broken here, why it wants
// flags to be the same? Maybe because both of them // flags to be the same? Maybe because both of them
// are applied to defender because of the bug in 0x422F3C? // are applied to defender because of the bug in 0x422F3C?
if (data[1] == data[0]) { if (data[1] == data[0]) {
attack.overrideAttackResults = 1; combat.overrideAttackResults = 1;
attack.targetResults = data[0]; combat.targetResults = data[0];
attack.attackerResults = data[1]; combat.attackerResults = data[1];
} else { } else {
attack.overrideAttackResults = 0; combat.overrideAttackResults = 0;
} }
scriptsRequestCombat(&attack); scriptsRequestCombat(&combat);
} }
program->flags &= ~PROGRAM_FLAG_0x20; program->flags &= ~PROGRAM_FLAG_0x20;
@ -4455,17 +4455,17 @@ static void opAttackSetup(Program* program)
attacker->data.critter.combat.whoHitMe = defender; attacker->data.critter.combat.whoHitMe = defender;
} }
} else { } else {
CombatStartData attack; CombatStartData combat;
attack.attacker = attacker; combat.attacker = attacker;
attack.defender = defender; combat.defender = defender;
attack.actionPointsBonus = 0; combat.actionPointsBonus = 0;
attack.accuracyBonus = 0; combat.accuracyBonus = 0;
attack.damageBonus = 0; combat.damageBonus = 0;
attack.minDamage = 0; combat.minDamage = 0;
attack.maxDamage = INT_MAX; combat.maxDamage = INT_MAX;
attack.overrideAttackResults = 0; combat.overrideAttackResults = 0;
scriptsRequestCombat(&attack); scriptsRequestCombat(&combat);
} }
} }

View File

@ -1117,10 +1117,10 @@ int scriptsRequestCombat(CombatStartData* combat)
// Likely related to random encounter, ala scriptsRequestRandomEncounter RELEASE // Likely related to random encounter, ala scriptsRequestRandomEncounter RELEASE
// //
// 0x4A45D4 // 0x4A45D4
void _scripts_request_combat_locked(CombatStartData* a1) void _scripts_request_combat_locked(CombatStartData* combat)
{ {
if (a1 != NULL) { if (combat != NULL) {
memcpy(&gScriptsRequestedCSD, a1, sizeof(gScriptsRequestedCSD)); memcpy(&gScriptsRequestedCSD, combat, sizeof(gScriptsRequestedCSD));
} else { } else {
gScriptsRequests |= SCRIPT_REQUEST_0x40; gScriptsRequests |= SCRIPT_REQUEST_0x40;
} }