-
Notifications
You must be signed in to change notification settings - Fork 4.2k
Reclaim Unused Vars
There are a few unused vars that are still coded in other places. This is how to reclaim them.
#define VAR_DISTRIBUTE_EON_TICKET 0x403F
file: src/field_specials.c
in section bool32 ShouldDistributeEonTicket(void) (lines 3630 to 3636)
delete lines 3632, 3634 and 3635 so the section should now be:
// Always returns FALSE
bool32 ShouldDistributeEonTicket(void)
{
return FALSE;
}
__
file: data/scripts/cable_club.inc
in section CableClub_EventScript_DistributeEonTicket:: (lines 33 to 43)
delete line 40 setvar VAR_DISTRIBUTE_EON_TICKET, 0
so the section should now be:
CableClub_EventScript_DistributeEonTicket::
checkitem ITEM_EON_TICKET
goto_if_eq VAR_RESULT, TRUE, CableClub_EventScript_TryWonderCardScript
goto_if_set FLAG_ENABLE_SHIP_SOUTHERN_ISLAND, CableClub_EventScript_TryWonderCardScript
msgbox MysteryGift_Text_TheresATicketForYou, MSGBOX_DEFAULT
giveitem ITEM_EON_TICKET
setflag FLAG_ENABLE_SHIP_SOUTHERN_ISLAND
msgbox MysteryGift_Text_TryUsingItAtLilycovePort, MSGBOX_DEFAULT
release
end
#define VAR_GIFT_UNUSED_1 0x40DE // Var is written to, but never read
#define VAR_GIFT_UNUSED_2 0x40DF // Var is written to, but never read
#define VAR_GIFT_UNUSED_3 0x40E0 // Var is written to, but never read
#define VAR_GIFT_UNUSED_4 0x40E1 // Var is written to, but never read
#define VAR_GIFT_UNUSED_5 0x40E2 // Var is written to, but never read
#define VAR_GIFT_UNUSED_6 0x40E3 // Var is written to, but never read
#define VAR_GIFT_UNUSED_7 0x40E4 // var is written to, but never read
file: src/event_data.c
in section void ClearMysteryGiftVars(void) (lines 132 to 142)
delete lines 135 to 141 so the section should now be:
void ClearMysteryGiftVars(void)
{
VarSet(VAR_GIFT_PICHU_SLOT, 0);
}
#define VAR_TRICK_HOUSE_PUZZLE_7_STATE_2 0x40B6 // Leftover from RS, never set
file: data/maps/Route110_TrickHousePuzzle7/scripts.inc
you may have already deleted these sections if you followed Reclaim Unused Flags
(NOTE: doing this will also free up 5 flagsFLAG_TRICK_HOUSE_PUZZLE_7_SWITCH_1to 5)
in the map_script header, delete: (lines 2 to 5)
map_script MAP_SCRIPT_ON_RESUME, Route110_TrickHousePuzzle7_OnResume
map_script MAP_SCRIPT_ON_TRANSITION, Route110_TrickHousePuzzle7_OnTransition
map_script MAP_SCRIPT_ON_LOAD, Route110_TrickHousePuzzle7_OnLoad
map_script MAP_SCRIPT_ON_FRAME_TABLE, Route110_TrickHousePuzzle7_OnFrame
delete lines and entire sections ( now lines 4 to 93)
@ Puzzle Room 7 in RSE uses whatever puzzle Mossdeep Gym uses
@ Because Mossdeep Gym was redesigned for Emerald, theres a good deal of leftover script from the old R/S puzzle
Route110_TrickHousePuzzle7_OnResume
Route110_TrickHousePuzzle7_EventScript_UpdateSwitchMetatiles
@ Leftover from R/S, none of the below metatile scripts are ever called
Route110_TrickHousePuzzle7_EventScript_SetSwitch1MetatilesOn
Route110_TrickHousePuzzle7_EventScript_SetSwitch2MetatilesOn
Route110_TrickHousePuzzle7_EventScript_SetSwitch3MetatilesOn
Route110_TrickHousePuzzle7_EventScript_SetSwitch4MetatilesOn
Route110_TrickHousePuzzle7_EventScript_SetSwitch5MetatilesOn
Route110_TrickHousePuzzle7_EventScript_SetSwitch1MetatilesOff
Route110_TrickHousePuzzle7_EventScript_SetSwitch2MetatilesOff
Route110_TrickHousePuzzle7_EventScript_SetSwitch3MetatilesOff
Route110_TrickHousePuzzle7_EventScript_SetSwitch4MetatilesOff
Route110_TrickHousePuzzle7_EventScript_SetSwitch5MetatilesOff
Route110_TrickHousePuzzle7_OnTransition
Route110_TrickHousePuzzle7_EventScript_TeleportedTransition
Route110_TrickHousePuzzle7_OnLoad
Route110_TrickHousePuzzle7_OnFrame
Route110_TrickHousePuzzle7_EventScript_ClearState2
then delete entire sections (now lines 15 to 130)
@ Unused, leftover from R/S
Route110_TrickHousePuzzle7_EventScript_TeleportPad
@ All the below switch scripts are unused leftover from R/S
Route110_TrickHousePuzzle7_EventScript_Switch1
Route110_TrickHousePuzzle7_EventScript_Switch2
Route110_TrickHousePuzzle7_EventScript_Switch3
Route110_TrickHousePuzzle7_EventScript_Switch4
Route110_TrickHousePuzzle7_EventScript_Switch5
@ All the below switch scripts are unused leftover from R/S
Route110_TrickHousePuzzle7_EventScript_SetSwitch1On
Route110_TrickHousePuzzle7_EventScript_SetSwitch1Off
Route110_TrickHousePuzzle7_EventScript_SetSwitch2On
Route110_TrickHousePuzzle7_EventScript_SetSwitch2Off
Route110_TrickHousePuzzle7_EventScript_SetSwitch3On
Route110_TrickHousePuzzle7_EventScript_SetSwitch3Off
Route110_TrickHousePuzzle7_EventScript_SetSwitch4On
Route110_TrickHousePuzzle7_EventScript_SetSwitch4Off
Route110_TrickHousePuzzle7_EventScript_SetSwitch5On
Route110_TrickHousePuzzle7_EventScript_SetSwitch5Off