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

@ -144,7 +144,6 @@ LilycoveCity_DepartmentStoreRooftop_EventScript_22032F:: @ 822032F
compare VAR_TEMP_1, 2
call_if_eq LilycoveCity_DepartmentStoreRooftop_EventScript_220328
updatemoneybox 0,0
nop
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

@ -40,13 +40,10 @@ MauvilleCity_GameCorner_EventScript_20FC33:: @ 820FC33
givecoins 50
takemoney 0x3e8, 0
updatemoneybox 0,0
nop
updatecoinsbox 1, 6
playse SE_REGI
msgbox MauvilleCity_GameCorner_Text_210529, MSGBOX_DEFAULT
hidemoneybox
nop
nop
hidecoinsbox 0, 5
release
end
@ -61,13 +58,10 @@ MauvilleCity_GameCorner_EventScript_20FC75:: @ 820FC75
givecoins 500
takemoney 0x2710, 0
updatemoneybox 0,0
nop
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
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
@ -58,27 +56,20 @@ Route109_SeashoreHouse_EventScript_269484:: @ 8269484
msgbox Route109_SeashoreHouse_Text_2697C8, MSGBOX_DEFAULT
takemoney 0x12c, 0
updatemoneybox 0,0
nop
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

@ -68,7 +68,6 @@ Route121_SafariZoneEntrance_EventScript_22BC48:: @ 822BC48
msgbox Route121_SafariZoneEntrance_Text_2A501B, MSGBOX_DEFAULT
takemoney 0x1f4, 0
updatemoneybox 0,0
nop
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
@ -40,12 +38,9 @@ SlateportCity_OceanicMuseum_1F_EventScript_20ADE8:: @ 820ADE8
playse SE_REGI
takemoney 0x32, 0
updatemoneybox 0,0
nop
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