ProcessEnemyPowerBombInteraction - R18 overwritten by death routine

This commit is contained in:
Snesrev
2023-04-04 00:06:35 +02:00
parent 5034ffc8e5
commit f207b03b69
2 changed files with 7 additions and 0 deletions

View File

@@ -365,6 +365,10 @@ uint32 PatchBugs(uint32 mode, uint32 addr) {
WORD(g_ram[22]) = 1; // MotherBrain_Instr_SpawnLaserEproj doesn't set R22
} else if (FixBugHook(0x94A85B)) {
memset(g_ram + 0xd82, 0, 8); // grapple_beam_tmpD82 not cleared in BlockCollGrappleBeam
} else if (FixBugHook(0xA0A35C)) {
// ProcessEnemyPowerBombInteraction - R18 may get overwritten by the enemy death routine
REMOVED_R18 = HIBYTE(power_bomb_explosion_radius);
REMOVED_R20 = (REMOVED_R18 + (REMOVED_R18 >> 1)) >> 1;
}
return 0;

View File

@@ -18,6 +18,9 @@ static inline void SetHiLo(uint16 *hi, uint16 *lo, uint32 t) {
extern int32 *cur_coll_amt32;
// Not used anymore
#define REMOVED_R18 *(uint16*)(g_ram + 18)
#define REMOVED_R20 *(uint16*)(g_ram + 20)
#define INT16_SHL8(x) ((int16)(x) << 8)
#define INT16_SHL16(x) ((int16)(x) << 16)