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
+3
View File
@@ -1083,6 +1083,8 @@
@ Hides the secondary box spawned by showmoney. @ Hides the secondary box spawned by showmoney.
.macro hidemoneybox .macro hidemoneybox
.byte 0x94 .byte 0x94
.byte 0 @ leftovers from ruby/sapphire. x, y params not used
.byte 0
.endm .endm
@ Updates the secondary box spawned by showmoney. Consumes but does not use arguments. @ Updates the secondary box spawned by showmoney. Consumes but does not use arguments.
@@ -1090,6 +1092,7 @@
.byte 0x95 .byte 0x95
.byte \x .byte \x
.byte \y .byte \y
.byte 0 @ 1 = don't perform this command. Always 0 in vanilla. Why this is a thing is beyond me.
.endm .endm
@ Gets the price reduction for the index given. In FireRed, this command is a nop. @ Gets the price reduction for the index given. In FireRed, this command is a nop.
@@ -143,8 +143,7 @@ LilycoveCity_DepartmentStoreRooftop_EventScript_22032F:: @ 822032F
call_if_eq LilycoveCity_DepartmentStoreRooftop_EventScript_220321 call_if_eq LilycoveCity_DepartmentStoreRooftop_EventScript_220321
compare VAR_TEMP_1, 2 compare VAR_TEMP_1, 2
call_if_eq LilycoveCity_DepartmentStoreRooftop_EventScript_220328 call_if_eq LilycoveCity_DepartmentStoreRooftop_EventScript_220328
updatemoneybox 0, 0 updatemoneybox 0,0
nop
bufferitemname 0, VAR_TEMP_0 bufferitemname 0, VAR_TEMP_0
playse SE_JIHANKI playse SE_JIHANKI
msgbox LilycoveCity_DepartmentStoreRooftop_Text_2205A1, MSGBOX_DEFAULT msgbox LilycoveCity_DepartmentStoreRooftop_Text_2205A1, MSGBOX_DEFAULT
@@ -197,8 +196,6 @@ LilycoveCity_DepartmentStoreRooftop_EventScript_220450:: @ 8220450
LilycoveCity_DepartmentStoreRooftop_EventScript_22045E:: @ 822045E LilycoveCity_DepartmentStoreRooftop_EventScript_22045E:: @ 822045E
hidemoneybox hidemoneybox
nop
nop
releaseall releaseall
end end
+2 -14
View File
@@ -39,14 +39,11 @@ MauvilleCity_GameCorner_EventScript_20FC33:: @ 820FC33
goto_if_eq MauvilleCity_GameCorner_EventScript_20FCC1 goto_if_eq MauvilleCity_GameCorner_EventScript_20FCC1
givecoins 50 givecoins 50
takemoney 0x3e8, 0 takemoney 0x3e8, 0
updatemoneybox 0, 0 updatemoneybox 0,0
nop
updatecoinsbox 1, 6 updatecoinsbox 1, 6
playse SE_REGI playse SE_REGI
msgbox MauvilleCity_GameCorner_Text_210529, MSGBOX_DEFAULT msgbox MauvilleCity_GameCorner_Text_210529, MSGBOX_DEFAULT
hidemoneybox hidemoneybox
nop
nop
hidecoinsbox 0, 5 hidecoinsbox 0, 5
release release
end end
@@ -60,14 +57,11 @@ MauvilleCity_GameCorner_EventScript_20FC75:: @ 820FC75
goto_if_eq MauvilleCity_GameCorner_EventScript_20FCC1 goto_if_eq MauvilleCity_GameCorner_EventScript_20FCC1
givecoins 500 givecoins 500
takemoney 0x2710, 0 takemoney 0x2710, 0
updatemoneybox 0, 0 updatemoneybox 0,0
nop
updatecoinsbox 1, 6 updatecoinsbox 1, 6
playse SE_REGI playse SE_REGI
msgbox MauvilleCity_GameCorner_Text_210529, MSGBOX_DEFAULT msgbox MauvilleCity_GameCorner_Text_210529, MSGBOX_DEFAULT
hidemoneybox hidemoneybox
nop
nop
hidecoinsbox 0, 5 hidecoinsbox 0, 5
release release
end end
@@ -80,8 +74,6 @@ MauvilleCity_GameCorner_EventScript_20FCB7:: @ 820FCB7
MauvilleCity_GameCorner_EventScript_20FCC1:: @ 820FCC1 MauvilleCity_GameCorner_EventScript_20FCC1:: @ 820FCC1
msgbox MauvilleCity_GameCorner_Text_210553, MSGBOX_DEFAULT msgbox MauvilleCity_GameCorner_Text_210553, MSGBOX_DEFAULT
hidemoneybox hidemoneybox
nop
nop
hidecoinsbox 0, 5 hidecoinsbox 0, 5
release release
end end
@@ -89,8 +81,6 @@ MauvilleCity_GameCorner_EventScript_20FCC1:: @ 820FCC1
MauvilleCity_GameCorner_EventScript_20FCD1:: @ 820FCD1 MauvilleCity_GameCorner_EventScript_20FCD1:: @ 820FCD1
msgbox MauvilleCity_GameCorner_Text_21059A, MSGBOX_DEFAULT msgbox MauvilleCity_GameCorner_Text_21059A, MSGBOX_DEFAULT
hidemoneybox hidemoneybox
nop
nop
hidecoinsbox 0, 5 hidecoinsbox 0, 5
release release
end end
@@ -98,8 +88,6 @@ MauvilleCity_GameCorner_EventScript_20FCD1:: @ 820FCD1
MauvilleCity_GameCorner_EventScript_20FCE1:: @ 820FCE1 MauvilleCity_GameCorner_EventScript_20FCE1:: @ 820FCE1
msgbox MauvilleCity_GameCorner_Text_21057E, MSGBOX_DEFAULT msgbox MauvilleCity_GameCorner_Text_21057E, MSGBOX_DEFAULT
hidemoneybox hidemoneybox
nop
nop
hidecoinsbox 0, 5 hidecoinsbox 0, 5
release release
end end
+1 -10
View File
@@ -115,38 +115,29 @@ MtChimney_EventScript_22EEF3:: @ 822EEF3
compare VAR_RESULT, 0 compare VAR_RESULT, 0
goto_if_eq MtChimney_EventScript_22EF51 goto_if_eq MtChimney_EventScript_22EF51
hidemoneybox hidemoneybox
nop
nop
release release
end end
MtChimney_EventScript_22EF51:: @ 822EF51 MtChimney_EventScript_22EF51:: @ 822EF51
msgbox gText_TooBadBagIsFull, MSGBOX_DEFAULT msgbox gText_TooBadBagIsFull, MSGBOX_DEFAULT
hidemoneybox hidemoneybox
nop
nop
release release
end end
MtChimney_EventScript_22EF5E:: @ 822EF5E MtChimney_EventScript_22EF5E:: @ 822EF5E
takemoney 0xc8, 0 takemoney 0xc8, 0
updatemoneybox 0, 0 updatemoneybox 0,0
nop
return return
MtChimney_EventScript_22EF69:: @ 822EF69 MtChimney_EventScript_22EF69:: @ 822EF69
msgbox MtChimney_Text_22FE9B, MSGBOX_DEFAULT msgbox MtChimney_Text_22FE9B, MSGBOX_DEFAULT
hidemoneybox hidemoneybox
nop
nop
release release
end end
MtChimney_EventScript_22EF76:: @ 822EF76 MtChimney_EventScript_22EF76:: @ 822EF76
msgbox MtChimney_Text_22FE5E, MSGBOX_DEFAULT msgbox MtChimney_Text_22FE5E, MSGBOX_DEFAULT
hidemoneybox hidemoneybox
nop
nop
release release
end end
+1 -10
View File
@@ -43,8 +43,6 @@ Route109_SeashoreHouse_EventScript_269460:: @ 8269460
goto_if_eq Route109_SeashoreHouse_EventScript_269484 goto_if_eq Route109_SeashoreHouse_EventScript_269484
msgbox Route109_SeashoreHouse_Text_2697EF, MSGBOX_DEFAULT msgbox Route109_SeashoreHouse_Text_2697EF, MSGBOX_DEFAULT
hidemoneybox hidemoneybox
nop
nop
release release
end end
@@ -57,28 +55,21 @@ Route109_SeashoreHouse_EventScript_269484:: @ 8269484
goto_if_eq Route109_SeashoreHouse_EventScript_2694D5 goto_if_eq Route109_SeashoreHouse_EventScript_2694D5
msgbox Route109_SeashoreHouse_Text_2697C8, MSGBOX_DEFAULT msgbox Route109_SeashoreHouse_Text_2697C8, MSGBOX_DEFAULT
takemoney 0x12c, 0 takemoney 0x12c, 0
updatemoneybox 0, 0 updatemoneybox 0,0
nop
giveitem_std ITEM_SODA_POP giveitem_std ITEM_SODA_POP
hidemoneybox hidemoneybox
nop
nop
release release
end end
Route109_SeashoreHouse_EventScript_2694C8:: @ 82694C8 Route109_SeashoreHouse_EventScript_2694C8:: @ 82694C8
msgbox Route109_SeashoreHouse_Text_2697D5, MSGBOX_DEFAULT msgbox Route109_SeashoreHouse_Text_2697D5, MSGBOX_DEFAULT
hidemoneybox hidemoneybox
nop
nop
release release
end end
Route109_SeashoreHouse_EventScript_2694D5:: @ 82694D5 Route109_SeashoreHouse_EventScript_2694D5:: @ 82694D5
msgbox gText_TooBadBagIsFull, MSGBOX_DEFAULT msgbox gText_TooBadBagIsFull, MSGBOX_DEFAULT
hidemoneybox hidemoneybox
nop
nop
release release
end end
@@ -67,8 +67,7 @@ Route121_SafariZoneEntrance_EventScript_22BC48:: @ 822BC48
playse SE_REGI playse SE_REGI
msgbox Route121_SafariZoneEntrance_Text_2A501B, MSGBOX_DEFAULT msgbox Route121_SafariZoneEntrance_Text_2A501B, MSGBOX_DEFAULT
takemoney 0x1f4, 0 takemoney 0x1f4, 0
updatemoneybox 0, 0 updatemoneybox 0,0
nop
msgbox Route121_SafariZoneEntrance_Text_2A5036, MSGBOX_DEFAULT msgbox Route121_SafariZoneEntrance_Text_2A5036, MSGBOX_DEFAULT
playfanfare MUS_FANFA4 playfanfare MUS_FANFA4
message Route121_SafariZoneEntrance_Text_2A5052 message Route121_SafariZoneEntrance_Text_2A5052
@@ -76,8 +75,6 @@ Route121_SafariZoneEntrance_EventScript_22BC48:: @ 822BC48
msgbox Route121_SafariZoneEntrance_Text_2A506F, MSGBOX_DEFAULT msgbox Route121_SafariZoneEntrance_Text_2A506F, MSGBOX_DEFAULT
closemessage closemessage
hidemoneybox hidemoneybox
nop
nop
applymovement EVENT_OBJ_ID_PLAYER, Route121_SafariZoneEntrance_Movement_22BD18 applymovement EVENT_OBJ_ID_PLAYER, Route121_SafariZoneEntrance_Movement_22BD18
waitmovement 0 waitmovement 0
special EnterSafariMode special EnterSafariMode
@@ -114,8 +111,6 @@ Route121_SafariZoneEntrance_EventScript_22BCF8:: @ 822BCF8
Route121_SafariZoneEntrance_EventScript_22BD06:: @ 822BD06 Route121_SafariZoneEntrance_EventScript_22BD06:: @ 822BD06
closemessage closemessage
hidemoneybox hidemoneybox
nop
nop
applymovement EVENT_OBJ_ID_PLAYER, Route121_SafariZoneEntrance_Movement_22BD16 applymovement EVENT_OBJ_ID_PLAYER, Route121_SafariZoneEntrance_Movement_22BD16
waitmovement 0 waitmovement 0
releaseall releaseall
@@ -26,8 +26,6 @@ SlateportCity_OceanicMuseum_1F_EventScript_20ADC1:: @ 820ADC1
goto_if_eq SlateportCity_OceanicMuseum_1F_EventScript_20ADE8 goto_if_eq SlateportCity_OceanicMuseum_1F_EventScript_20ADE8
closemessage closemessage
hidemoneybox hidemoneybox
nop
nop
applymovement EVENT_OBJ_ID_PLAYER, SlateportCity_OceanicMuseum_1F_Movement_20AE4B applymovement EVENT_OBJ_ID_PLAYER, SlateportCity_OceanicMuseum_1F_Movement_20AE4B
waitmovement 0 waitmovement 0
releaseall releaseall
@@ -39,13 +37,10 @@ SlateportCity_OceanicMuseum_1F_EventScript_20ADE8:: @ 820ADE8
goto_if_eq SlateportCity_OceanicMuseum_1F_EventScript_20AE18 goto_if_eq SlateportCity_OceanicMuseum_1F_EventScript_20AE18
playse SE_REGI playse SE_REGI
takemoney 0x32, 0 takemoney 0x32, 0
updatemoneybox 0, 0 updatemoneybox 0,0
nop
msgbox SlateportCity_OceanicMuseum_1F_Text_20B026, MSGBOX_DEFAULT msgbox SlateportCity_OceanicMuseum_1F_Text_20B026, MSGBOX_DEFAULT
setvar VAR_SLATEPORT_MUSEUM_1F_STATE, 1 setvar VAR_SLATEPORT_MUSEUM_1F_STATE, 1
hidemoneybox hidemoneybox
nop
nop
releaseall releaseall
end end
@@ -54,8 +49,6 @@ SlateportCity_OceanicMuseum_1F_EventScript_20AE18:: @ 820AE18
msgbox SlateportCity_OceanicMuseum_1F_Text_20B03D, MSGBOX_DEFAULT msgbox SlateportCity_OceanicMuseum_1F_Text_20B03D, MSGBOX_DEFAULT
closemessage closemessage
hidemoneybox hidemoneybox
nop
nop
applymovement EVENT_OBJ_ID_PLAYER, SlateportCity_OceanicMuseum_1F_Movement_20AE4B applymovement EVENT_OBJ_ID_PLAYER, SlateportCity_OceanicMuseum_1F_Movement_20AE4B
waitmovement 0 waitmovement 0
releaseall releaseall
@@ -65,8 +58,6 @@ SlateportCity_OceanicMuseum_1F_EventScript_20AE39:: @ 820AE39
msgbox SlateportCity_OceanicMuseum_1F_Text_20B075, MSGBOX_DEFAULT msgbox SlateportCity_OceanicMuseum_1F_Text_20B075, MSGBOX_DEFAULT
setvar VAR_SLATEPORT_MUSEUM_1F_STATE, 1 setvar VAR_SLATEPORT_MUSEUM_1F_STATE, 1
hidemoneybox hidemoneybox
nop
nop
releaseall releaseall
end end