Folded nops into hidemoneybox and updatemoneybox

The nops are essential to the hidemoneybox and updatemoneybox commands when using vanilla versions of those commands. Even though they're not actually used parameters in the command implementation, they are still consumed, which means if someone were to get rid of the nops (as I did in TriHard) it causes the commands to consume bytecode that are not theirs, resulting in undefined behavior usually leading to softlocks. Folding the extra bytes into the macros means there's no chance of the extra bytes getting losts in scripts.
This commit is contained in:
Tustin2121 2019-08-17 13:25:36 -04:00
parent 9bcd39d86c
commit f4d4424618
7 changed files with 10 additions and 54 deletions

View File

@ -1083,6 +1083,8 @@
@ Hides the secondary box spawned by showmoney.
.macro hidemoneybox
.byte 0x94
.byte 0 @ leftovers from ruby/sapphire. x, y params not used
.byte 0
.endm
@ Updates the secondary box spawned by showmoney. Consumes but does not use arguments.
@ -1090,6 +1092,7 @@
.byte 0x95
.byte \x
.byte \y
.byte 0 @ 1 = don't perform this command. Always 0 in vanilla. Why this is a thing is beyond me.
.endm
@ Gets the price reduction for the index given. In FireRed, this command is a nop.

View File

@ -143,8 +143,7 @@ LilycoveCity_DepartmentStoreRooftop_EventScript_22032F:: @ 822032F
call_if_eq LilycoveCity_DepartmentStoreRooftop_EventScript_220321
compare VAR_TEMP_1, 2
call_if_eq LilycoveCity_DepartmentStoreRooftop_EventScript_220328
updatemoneybox 0, 0
nop
updatemoneybox 0,0
bufferitemname 0, VAR_TEMP_0
playse SE_JIHANKI
msgbox LilycoveCity_DepartmentStoreRooftop_Text_2205A1, MSGBOX_DEFAULT
@ -197,8 +196,6 @@ LilycoveCity_DepartmentStoreRooftop_EventScript_220450:: @ 8220450
LilycoveCity_DepartmentStoreRooftop_EventScript_22045E:: @ 822045E
hidemoneybox
nop
nop
releaseall
end

View File

@ -39,14 +39,11 @@ MauvilleCity_GameCorner_EventScript_20FC33:: @ 820FC33
goto_if_eq MauvilleCity_GameCorner_EventScript_20FCC1
givecoins 50
takemoney 0x3e8, 0
updatemoneybox 0, 0
nop
updatemoneybox 0,0
updatecoinsbox 1, 6
playse SE_REGI
msgbox MauvilleCity_GameCorner_Text_210529, MSGBOX_DEFAULT
hidemoneybox
nop
nop
hidecoinsbox 0, 5
release
end
@ -60,14 +57,11 @@ MauvilleCity_GameCorner_EventScript_20FC75:: @ 820FC75
goto_if_eq MauvilleCity_GameCorner_EventScript_20FCC1
givecoins 500
takemoney 0x2710, 0
updatemoneybox 0, 0
nop
updatemoneybox 0,0
updatecoinsbox 1, 6
playse SE_REGI
msgbox MauvilleCity_GameCorner_Text_210529, MSGBOX_DEFAULT
hidemoneybox
nop
nop
hidecoinsbox 0, 5
release
end
@ -80,8 +74,6 @@ MauvilleCity_GameCorner_EventScript_20FCB7:: @ 820FCB7
MauvilleCity_GameCorner_EventScript_20FCC1:: @ 820FCC1
msgbox MauvilleCity_GameCorner_Text_210553, MSGBOX_DEFAULT
hidemoneybox
nop
nop
hidecoinsbox 0, 5
release
end
@ -89,8 +81,6 @@ MauvilleCity_GameCorner_EventScript_20FCC1:: @ 820FCC1
MauvilleCity_GameCorner_EventScript_20FCD1:: @ 820FCD1
msgbox MauvilleCity_GameCorner_Text_21059A, MSGBOX_DEFAULT
hidemoneybox
nop
nop
hidecoinsbox 0, 5
release
end
@ -98,8 +88,6 @@ MauvilleCity_GameCorner_EventScript_20FCD1:: @ 820FCD1
MauvilleCity_GameCorner_EventScript_20FCE1:: @ 820FCE1
msgbox MauvilleCity_GameCorner_Text_21057E, MSGBOX_DEFAULT
hidemoneybox
nop
nop
hidecoinsbox 0, 5
release
end

View File

@ -115,38 +115,29 @@ MtChimney_EventScript_22EEF3:: @ 822EEF3
compare VAR_RESULT, 0
goto_if_eq MtChimney_EventScript_22EF51
hidemoneybox
nop
nop
release
end
MtChimney_EventScript_22EF51:: @ 822EF51
msgbox gText_TooBadBagIsFull, MSGBOX_DEFAULT
hidemoneybox
nop
nop
release
end
MtChimney_EventScript_22EF5E:: @ 822EF5E
takemoney 0xc8, 0
updatemoneybox 0, 0
nop
updatemoneybox 0,0
return
MtChimney_EventScript_22EF69:: @ 822EF69
msgbox MtChimney_Text_22FE9B, MSGBOX_DEFAULT
hidemoneybox
nop
nop
release
end
MtChimney_EventScript_22EF76:: @ 822EF76
msgbox MtChimney_Text_22FE5E, MSGBOX_DEFAULT
hidemoneybox
nop
nop
release
end

View File

@ -43,8 +43,6 @@ Route109_SeashoreHouse_EventScript_269460:: @ 8269460
goto_if_eq Route109_SeashoreHouse_EventScript_269484
msgbox Route109_SeashoreHouse_Text_2697EF, MSGBOX_DEFAULT
hidemoneybox
nop
nop
release
end
@ -57,28 +55,21 @@ Route109_SeashoreHouse_EventScript_269484:: @ 8269484
goto_if_eq Route109_SeashoreHouse_EventScript_2694D5
msgbox Route109_SeashoreHouse_Text_2697C8, MSGBOX_DEFAULT
takemoney 0x12c, 0
updatemoneybox 0, 0
nop
updatemoneybox 0,0
giveitem_std ITEM_SODA_POP
hidemoneybox
nop
nop
release
end
Route109_SeashoreHouse_EventScript_2694C8:: @ 82694C8
msgbox Route109_SeashoreHouse_Text_2697D5, MSGBOX_DEFAULT
hidemoneybox
nop
nop
release
end
Route109_SeashoreHouse_EventScript_2694D5:: @ 82694D5
msgbox gText_TooBadBagIsFull, MSGBOX_DEFAULT
hidemoneybox
nop
nop
release
end

View File

@ -67,8 +67,7 @@ Route121_SafariZoneEntrance_EventScript_22BC48:: @ 822BC48
playse SE_REGI
msgbox Route121_SafariZoneEntrance_Text_2A501B, MSGBOX_DEFAULT
takemoney 0x1f4, 0
updatemoneybox 0, 0
nop
updatemoneybox 0,0
msgbox Route121_SafariZoneEntrance_Text_2A5036, MSGBOX_DEFAULT
playfanfare MUS_FANFA4
message Route121_SafariZoneEntrance_Text_2A5052
@ -76,8 +75,6 @@ Route121_SafariZoneEntrance_EventScript_22BC48:: @ 822BC48
msgbox Route121_SafariZoneEntrance_Text_2A506F, MSGBOX_DEFAULT
closemessage
hidemoneybox
nop
nop
applymovement EVENT_OBJ_ID_PLAYER, Route121_SafariZoneEntrance_Movement_22BD18
waitmovement 0
special EnterSafariMode
@ -114,8 +111,6 @@ Route121_SafariZoneEntrance_EventScript_22BCF8:: @ 822BCF8
Route121_SafariZoneEntrance_EventScript_22BD06:: @ 822BD06
closemessage
hidemoneybox
nop
nop
applymovement EVENT_OBJ_ID_PLAYER, Route121_SafariZoneEntrance_Movement_22BD16
waitmovement 0
releaseall

View File

@ -26,8 +26,6 @@ SlateportCity_OceanicMuseum_1F_EventScript_20ADC1:: @ 820ADC1
goto_if_eq SlateportCity_OceanicMuseum_1F_EventScript_20ADE8
closemessage
hidemoneybox
nop
nop
applymovement EVENT_OBJ_ID_PLAYER, SlateportCity_OceanicMuseum_1F_Movement_20AE4B
waitmovement 0
releaseall
@ -39,13 +37,10 @@ SlateportCity_OceanicMuseum_1F_EventScript_20ADE8:: @ 820ADE8
goto_if_eq SlateportCity_OceanicMuseum_1F_EventScript_20AE18
playse SE_REGI
takemoney 0x32, 0
updatemoneybox 0, 0
nop
updatemoneybox 0,0
msgbox SlateportCity_OceanicMuseum_1F_Text_20B026, MSGBOX_DEFAULT
setvar VAR_SLATEPORT_MUSEUM_1F_STATE, 1
hidemoneybox
nop
nop
releaseall
end
@ -54,8 +49,6 @@ SlateportCity_OceanicMuseum_1F_EventScript_20AE18:: @ 820AE18
msgbox SlateportCity_OceanicMuseum_1F_Text_20B03D, MSGBOX_DEFAULT
closemessage
hidemoneybox
nop
nop
applymovement EVENT_OBJ_ID_PLAYER, SlateportCity_OceanicMuseum_1F_Movement_20AE4B
waitmovement 0
releaseall
@ -65,8 +58,6 @@ SlateportCity_OceanicMuseum_1F_EventScript_20AE39:: @ 820AE39
msgbox SlateportCity_OceanicMuseum_1F_Text_20B075, MSGBOX_DEFAULT
setvar VAR_SLATEPORT_MUSEUM_1F_STATE, 1
hidemoneybox
nop
nop
releaseall
end