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_give_exps(int exp_points);
void _combat_turn_run();
void _combat(CombatStartData* attack);
void _combat(CombatStartData* csd);
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_bullet_start(const Object* attacker, const Object* target);

View File

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