From 7d13d340937f7f1ed0a88d2860f13fd2da59ce30 Mon Sep 17 00:00:00 2001 From: jojobear13 Date: Sun, 14 Jan 2024 23:57:43 -0600 Subject: [PATCH] prevent static wild mon NPCs from refusing to hide after battle --- engine/battle/core.asm | 3 +++ engine/overworld/missable_objects.asm | 22 +++++++++++----------- 2 files changed, 14 insertions(+), 11 deletions(-) diff --git a/engine/battle/core.asm b/engine/battle/core.asm index c8447a8d..f552e481 100644 --- a/engine/battle/core.asm +++ b/engine/battle/core.asm @@ -6981,6 +6981,9 @@ PlayMoveAnimation: predef_jump MoveAnimation InitBattle:: + xor a + ld [wWasTrainerBattle], a ;Remember to clear wWasTrainerBattle from any previous battles, + ;because this new battle could be a static wild encounter. ld a, [wCurOpponent] and a jr z, DetermineWildOpponent diff --git a/engine/overworld/missable_objects.asm b/engine/overworld/missable_objects.asm index d232780d..fed7d1fb 100644 --- a/engine/overworld/missable_objects.asm +++ b/engine/overworld/missable_objects.asm @@ -142,20 +142,20 @@ HideObject: ld c, a ld b, FLAG_SET call MissableObjectFlagAction ; set "removed" flag - call VerifyObjectState - jr z, HideObject +; call VerifyObjectState +; jr z, HideObject jp UpdateSprites ;returns z flag set if shown and z flag cleared if hidden -VerifyObjectState: - ld hl, wMissableObjectFlags - ld a, [wMissableObjectIndex] - ld c, a - ld b, FLAG_TEST - call MissableObjectFlagAction - ld a, c - and a - ret +;VerifyObjectState: +; ld hl, wMissableObjectFlags +; ld a, [wMissableObjectIndex] +; ld c, a +; ld b, FLAG_TEST +; call MissableObjectFlagAction +; ld a, c +; and a +; ret MissableObjectFlagAction: ; identical to FlagAction