Multiple bug fixes

* Moves the Mystery Box activation into Event Constants. This means that now, the Mystery Box activation is handled in the save, preventing some jank from happening when resetting.
* The "don't switch off the box yet" variable is now always unset after entering a map. Meltan itself allows the variable to keep being re-set, which is super handy. Now, whenever you enter and exit maps, it'll work properly.
* Flying, using an Escape Rope, and using Dig, all now unset the Mystery Box. If for some reason everything fucks up, this'll fix it.
* Fixed a text bug with the scientist in Celadon University.
* Fixed a menu alignment issue with the Vermilion Beauty.
* Attempted to fix the Battle Tent exit. Failed. This is a really, really bad bug, hopefully this gets sorted sometime.
This commit is contained in:
Llinos Evans 2023-08-31 02:48:01 +01:00
parent f6cdf8d428
commit 138bfd7042
9 changed files with 26 additions and 22 deletions

View file

@ -15,7 +15,8 @@
const EVENT_BEAT_JACKY const EVENT_BEAT_JACKY
const EVENT_GOT_MANSION_GIFT const EVENT_GOT_MANSION_GIFT
const EVENT_USED_MASTER_BALL ; Used to determine Chief's dialogue in the end-game. const EVENT_USED_MASTER_BALL ; Used to determine Chief's dialogue in the end-game.
const_skip 10 const EVENT_MYSTERY_BOX_ACTIVATED
const_skip 9
const EVENT_GOT_TOWN_MAP const EVENT_GOT_TOWN_MAP
const EVENT_ENTERED_BLUES_HOUSE const EVENT_ENTERED_BLUES_HOUSE
const EVENT_DAISY_WALKING const EVENT_DAISY_WALKING

View file

@ -9,7 +9,7 @@ TwoOptionMenuStrings:
; width, height, blank line before first menu item?, text pointer ; width, height, blank line before first menu item?, text pointer
two_option_menu 4, 3, FALSE, .YesNoMenu two_option_menu 4, 3, FALSE, .YesNoMenu
two_option_menu 5, 3, FALSE, .BoyGirlMenu two_option_menu 5, 3, FALSE, .BoyGirlMenu
two_option_menu 6, 3, TRUE, .CatsDogsMenu two_option_menu 6, 4, TRUE, .CatsDogsMenu
two_option_menu 6, 3, FALSE, .YesNoMenu two_option_menu 6, 3, FALSE, .YesNoMenu
two_option_menu 6, 3, FALSE, .NorthEastMenu two_option_menu 6, 3, FALSE, .NorthEastMenu
two_option_menu 7, 3, FALSE, .TradeCancelMenu two_option_menu 7, 3, FALSE, .TradeCancelMenu

View file

@ -88,9 +88,8 @@ TryDoWildEncounter:
; This used to be in engine/battle/core.asm. ; This used to be in engine/battle/core.asm.
; However, it was a bit buggy as the implementation was forced. ; However, it was a bit buggy as the implementation was forced.
; So instead, we do this: ; So instead, we do this:
ld a, [wMysteryBoxActive] ; Load the box. CheckEvent EVENT_MYSTERY_BOX_ACTIVATED
cp $01 ; Check if it's active. jr nz, .meltanEncounter ; If so, skip this.
jr z, .meltanEncounter ; If so, skip this.
ld b, 0 ld b, 0
add hl, bc add hl, bc
ld a, [hli] ld a, [hli]

View file

@ -144,8 +144,7 @@ ItemUseMysteryBox:
jp nz, ItemUseNotTime jp nz, ItemUseNotTime
; Sets a variable in WRAM that'll trigger a Meltan wild encounter. ; Sets a variable in WRAM that'll trigger a Meltan wild encounter.
; Handled in engine\core.asm ; Handled in engine\core.asm
ld a, $1 SetEvent EVENT_MYSTERY_BOX_ACTIVATED
ld [wMysteryBoxActive], a
ld hl, MysteryBoxText ; Simple text is shown. Ambiguous to the user, identical to GO. ld hl, MysteryBoxText ; Simple text is shown. Ambiguous to the user, identical to GO.
call PrintText call PrintText
jp TextScriptEnd jp TextScriptEnd
@ -1601,6 +1600,7 @@ ThrewRockText:
; also used for Dig out-of-battle effect ; also used for Dig out-of-battle effect
ItemUseEscapeRope: ItemUseEscapeRope:
ResetEvent EVENT_MYSTERY_BOX_ACTIVATED ; get this shit outta here
ld a, [wIsInBattle] ld a, [wIsInBattle]
and a and a
jr nz, .notUsable jr nz, .notUsable

View file

@ -22,8 +22,8 @@ ClearVariablesOnEnterMap::
ld a, [wDontSwitchOffMysteryBoxYet] ; Load WRAM bit. ld a, [wDontSwitchOffMysteryBoxYet] ; Load WRAM bit.
and a ; Did a battle just happen? and a ; Did a battle just happen?
jr nz, .skip ; Yes? Off you go then. jr nz, .skip ; Yes? Off you go then.
ld a, $0 ; No? Let's zero both of these out then. ResetEvent EVENT_MYSTERY_BOX_ACTIVATED
ld [wMysteryBoxActive], a ; This is now deactivated.
ld [wDontSwitchOffMysteryBoxYet], a ; To be activated when a Meltan is defeated later.
.skip .skip
ld a, $0 ; No? Let's zero this out then.
ld [wDontSwitchOffMysteryBoxYet], a ; To be activated when a Meltan is defeated later.
ret ret

View file

@ -229,6 +229,7 @@ LeaveMapThroughHoleAnim:
jp RestoreFacingDirectionAndYScreenPos jp RestoreFacingDirectionAndYScreenPos
DoFlyAnimation: DoFlyAnimation:
ResetEvent EVENT_MYSTERY_BOX_ACTIVATED ; get this shit outta here
ld a, [wFlyAnimBirdSpriteImageIndex] ld a, [wFlyAnimBirdSpriteImageIndex]
xor $1 ; make the bird flap its wings xor $1 ; make the bird flap its wings
ld [wFlyAnimBirdSpriteImageIndex], a ld [wFlyAnimBirdSpriteImageIndex], a

View file

@ -2162,11 +2162,13 @@ wFossilMon:: db
; Once used, the count will reset. ; Once used, the count will reset.
wCandyJarCount:: db wCandyJarCount:: db
; Cut due to glitches involving the save feature.
; Used for Meltan implementation. Replaced unused Card Key function. ; Used for Meltan implementation. Replaced unused Card Key function.
; When byte is $01, Meltan has a chance to replace a Pokemon that appears. ; When byte is $01, Meltan has a chance to replace a Pokemon that appears.
; $00 - Not Active ; $00 - Not Active
; $01 - Active ; $01 - Active
wMysteryBoxActive:: db ;wMysteryBoxActive:: db
ds 1
; ClearVariablesOnEnterMap does everything I want, except when leaving battle, so this switches off that specific aspect. ; ClearVariablesOnEnterMap does everything I want, except when leaving battle, so this switches off that specific aspect.
; This is achieved through some jank in engine\core.asm and engine\overworld\clear_variables.asm. ; This is achieved through some jank in engine\core.asm and engine\overworld\clear_variables.asm.

View file

@ -630,19 +630,19 @@ BattleTentGuy2:
ld a, [wCurrentMenuItem] ld a, [wCurrentMenuItem]
and a and a
jr nz, .refused ; If 0, move to refused. jr nz, .refused ; If 0, move to refused.
jr .cont ; Otherwise, continue as if nothing happened. .cont
ld hl, BattleTentGuy2_Init ; Load the next battle.
; fallthrough
.skip2 ; This handles BattleTentGuy2_Streak and BattleTentGuy2_Init at once.
call PrintText
jr .done
.refused .refused
ld hl, BattleTentGuy2_Win ld hl, BattleTentGuy2_Win
call PrintText call PrintText
ld a, 9 ; Load BattleTent_PlayerWalkBack, which takes it from here. ld a, 9 ; Load BattleTent_PlayerWalkBack, which takes it from here.
ld [wBattleTentCurScript], a ld [wBattleTentCurScript], a ; For some reason, this isn't working properly, even if jp'd.
jp TextScriptEnd ; fallthrough
.cont .done
ld hl, BattleTentGuy2_Init ; Load the next battle.
jr .skip2
.skip2 ; This handles BattleTentGuy2_Streak and BattleTentGuy2_Init at once.
call PrintText
jp TextScriptEnd jp TextScriptEnd
BattleTentTrainer: BattleTentTrainer:

View file

@ -30,8 +30,9 @@ _KHRP::
line "use DRAGON RAGE!" line "use DRAGON RAGE!"
para "Huh? You want to" para "Huh? You want to"
line "teach it to yours?" line "teach yours?"
cont "Sure! Take this!"
para "Sure! Take this!"
prompt prompt