diff --git a/src/sm_cpu_infra.c b/src/sm_cpu_infra.c index ecbaf6d..fda9179 100644 --- a/src/sm_cpu_infra.c +++ b/src/sm_cpu_infra.c @@ -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; diff --git a/src/variables.h b/src/variables.h index 6c20ae3..db7d156 100644 --- a/src/variables.h +++ b/src/variables.h @@ -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)