Skip to content

Commit

Permalink
Reference TMs and HMs by move instead of number (#1732)
Browse files Browse the repository at this point in the history
  • Loading branch information
mrgriffin authored Aug 9, 2023
1 parent da23856 commit 912a80e
Show file tree
Hide file tree
Showing 74 changed files with 10,758 additions and 9,936 deletions.
1 change: 1 addition & 0 deletions constants/constants.inc
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
.include "constants/gba_constants.inc"
.include "constants/global.inc"
.include "constants/tms_hms.inc"
17 changes: 17 additions & 0 deletions constants/tms_hms.inc
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
#include "constants/tms_hms.h"

/* Expands to:
* enum_start ITEM_TM01
* enum ITEM_TM_FOCUS_PUNCH
* ...
* enum_start ITEM_HM01
* enum ITEM_HM_CUT
* ... */
#define EQUIV_TM(id) enum ITEM_TM_ ## id;
#define EQUIV_HM(id) enum ITEM_HM_ ## id;
enum_start ITEM_TM01
FOREACH_TM(EQUIV_TM)
enum_start ITEM_HM01
FOREACH_HM(EQUIV_HM)
#undef EQUIV_TM
#undef EQUIV_HM
1 change: 1 addition & 0 deletions data/battle_ai_scripts.s
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
#include "constants/battle_move_effects.h"
#include "constants/hold_effects.h"
#include "constants/pokemon.h"
.include "asm/macros.inc"
.include "asm/macros/battle_ai_script.inc"
.include "constants/constants.inc"

Expand Down
4 changes: 2 additions & 2 deletions data/maps/AbandonedShip_HiddenFloorRooms/map.json
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,8 @@
"movement_range_y": 1,
"trainer_type": "TRAINER_TYPE_NONE",
"trainer_sight_or_berry_tree_id": "0",
"script": "AbandonedShip_HiddenFloorRooms_EventScript_ItemTM18",
"flag": "FLAG_ITEM_ABANDONED_SHIP_HIDDEN_FLOOR_ROOM_1_TM18"
"script": "AbandonedShip_HiddenFloorRooms_EventScript_ItemTMRainDance",
"flag": "FLAG_ITEM_ABANDONED_SHIP_HIDDEN_FLOOR_ROOM_1_TM_RAIN_DANCE"
},
{
"graphics_id": "OBJ_EVENT_GFX_ITEM_BALL",
Expand Down
4 changes: 2 additions & 2 deletions data/maps/AbandonedShip_Room_B1F/map.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@
"movement_range_y": 1,
"trainer_type": "TRAINER_TYPE_NONE",
"trainer_sight_or_berry_tree_id": "0",
"script": "AbandonedShip_Room_B1F_EventScript_ItemTM13",
"flag": "FLAG_ITEM_ABANDONED_SHIP_ROOMS_B1F_TM13"
"script": "AbandonedShip_Room_B1F_EventScript_ItemTMIceBeam",
"flag": "FLAG_ITEM_ABANDONED_SHIP_ROOMS_B1F_TM_ICE_BEAM"
}
],
"warp_events": [
Expand Down
10 changes: 5 additions & 5 deletions data/maps/DewfordTown_Gym/scripts.inc
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ DewfordTown_Gym_EventScript_Brawly::
trainerbattle_single TRAINER_BRAWLY_1, DewfordTown_Gym_Text_BrawlyIntro, DewfordTown_Gym_Text_BrawlyDefeat, DewfordTown_Gym_EventScript_BrawlyDefeated, NO_MUSIC
specialvar VAR_RESULT, ShouldTryRematchBattle
goto_if_eq VAR_RESULT, TRUE, DewfordTown_Gym_EventScript_BrawlyRematch
goto_if_unset FLAG_RECEIVED_TM08, DewfordTown_Gym_EventScript_GiveBulkUp2
goto_if_unset FLAG_RECEIVED_TM_BULK_UP, DewfordTown_Gym_EventScript_GiveBulkUp2
msgbox DewfordTown_Gym_Text_BrawlyPostBattle, MSGBOX_DEFAULT
release
end
Expand Down Expand Up @@ -168,17 +168,17 @@ DewfordTown_Gym_EventScript_BrawlyDefeated::
end

DewfordTown_Gym_EventScript_GiveBulkUp::
giveitem ITEM_TM08
giveitem ITEM_TM_BULK_UP
goto_if_eq VAR_RESULT, 0, Common_EventScript_BagIsFull
msgbox DewfordTown_Gym_Text_ExplainBulkUp, MSGBOX_DEFAULT
setflag FLAG_RECEIVED_TM08
setflag FLAG_RECEIVED_TM_BULK_UP
return

DewfordTown_Gym_EventScript_GiveBulkUp2:
giveitem ITEM_TM08
giveitem ITEM_TM_BULK_UP
goto_if_eq VAR_RESULT, 0, Common_EventScript_ShowBagIsFull
msgbox DewfordTown_Gym_Text_ExplainBulkUp, MSGBOX_DEFAULT
setflag FLAG_RECEIVED_TM08
setflag FLAG_RECEIVED_TM_BULK_UP
release
end

Expand Down
6 changes: 3 additions & 3 deletions data/maps/DewfordTown_Hall/scripts.inc
Original file line number Diff line number Diff line change
Expand Up @@ -246,11 +246,11 @@ DewfordTown_Hall_EventScript_SludgeBombMan::
lock
faceplayer
call Common_EventScript_BufferTrendyPhrase
goto_if_set FLAG_RECEIVED_TM36, DewfordTown_Hall_EventScript_ReceivedSludgeBomb
goto_if_set FLAG_RECEIVED_TM_SLUDGE_BOMB, DewfordTown_Hall_EventScript_ReceivedSludgeBomb
msgbox DewfordTown_Hall_Text_GiveYouSludgeBomb, MSGBOX_DEFAULT
giveitem ITEM_TM36
giveitem ITEM_TM_SLUDGE_BOMB
goto_if_eq VAR_RESULT, FALSE, Common_EventScript_ShowBagIsFull
setflag FLAG_RECEIVED_TM36
setflag FLAG_RECEIVED_TM_SLUDGE_BOMB
release
end

Expand Down
8 changes: 4 additions & 4 deletions data/maps/FallarborTown_CozmosHouse/scripts.inc
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ FallarborTown_CozmosHouse_MapScripts::
FallarborTown_CozmosHouse_EventScript_ProfCozmo::
lock
faceplayer
goto_if_set FLAG_RECEIVED_TM27, FallarborTown_CozmosHouse_EventScript_GaveMeteorite
goto_if_set FLAG_RECEIVED_TM_RETURN, FallarborTown_CozmosHouse_EventScript_GaveMeteorite
checkitem ITEM_METEORITE
goto_if_eq VAR_RESULT, TRUE, FallarborTown_CozmosHouse_EventScript_PlayerHasMeteorite
msgbox FallarborTown_CozmosHouse_Text_MeteoriteWillNeverBeMineNow, MSGBOX_DEFAULT
Expand All @@ -16,11 +16,11 @@ FallarborTown_CozmosHouse_EventScript_PlayerHasMeteorite::
call_if_set FLAG_TEMP_2, FallarborTown_CozmosHouse_EventScript_AskForMeteorite
goto_if_eq VAR_RESULT, NO, FallarborTown_CozmosHouse_EventScript_DeclineGiveMeteorite
msgbox FallarborTown_CozmosHouse_Text_PleaseUseThisTM, MSGBOX_DEFAULT
giveitem ITEM_TM27
giveitem ITEM_TM_RETURN
goto_if_eq VAR_RESULT, FALSE, Common_EventScript_ShowBagIsFull
setvar VAR_0x8004, ITEM_METEORITE
call Common_EventScript_PlayerHandedOverTheItem
setflag FLAG_RECEIVED_TM27
setflag FLAG_RECEIVED_TM_RETURN
msgbox FallarborTown_CozmosHouse_Text_ReallyGoingToHelpMyResearch, MSGBOX_DEFAULT
release
end
Expand Down Expand Up @@ -48,7 +48,7 @@ FallarborTown_CozmosHouse_EventScript_GaveMeteorite::
FallarborTown_CozmosHouse_EventScript_CozmosWife::
lock
faceplayer
goto_if_set FLAG_RECEIVED_TM27, FallarborTown_CozmosHouse_EventScript_CozmoIsHappy
goto_if_set FLAG_RECEIVED_TM_RETURN, FallarborTown_CozmosHouse_EventScript_CozmoIsHappy
goto_if_set FLAG_DEFEATED_EVIL_TEAM_MT_CHIMNEY, FallarborTown_CozmosHouse_EventScript_CozmoIsSad
msgbox FallarborTown_CozmosHouse_Text_CozmoWentToMeteorFalls, MSGBOX_DEFAULT
release
Expand Down
4 changes: 2 additions & 2 deletions data/maps/FieryPath/map.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@
"movement_range_y": 1,
"trainer_type": "TRAINER_TYPE_NONE",
"trainer_sight_or_berry_tree_id": "0",
"script": "FieryPath_EventScript_ItemTM06",
"flag": "FLAG_ITEM_FIERY_PATH_TM06"
"script": "FieryPath_EventScript_ItemTMToxic",
"flag": "FLAG_ITEM_FIERY_PATH_TM_TOXIC"
},
{
"graphics_id": "OBJ_EVENT_GFX_PUSHABLE_BOULDER",
Expand Down
10 changes: 5 additions & 5 deletions data/maps/FortreeCity_Gym/scripts.inc
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ FortreeCity_Gym_EventScript_Winona::
trainerbattle_single TRAINER_WINONA_1, FortreeCity_Gym_Text_WinonaIntro, FortreeCity_Gym_Text_WinonaDefeat, FortreeCity_Gym_EventScript_WinonaDefeated, NO_MUSIC
specialvar VAR_RESULT, ShouldTryRematchBattle
goto_if_eq VAR_RESULT, TRUE, FortreeCity_Gym_EventScript_WinonaRematch
goto_if_unset FLAG_RECEIVED_TM40, FortreeCity_Gym_EventScript_GiveAerialAce2
goto_if_unset FLAG_RECEIVED_TM_AERIAL_ACE, FortreeCity_Gym_EventScript_GiveAerialAce2
msgbox FortreeCity_Gym_Text_WinonaPostBattle, MSGBOX_DEFAULT
release
end
Expand Down Expand Up @@ -48,18 +48,18 @@ FortreeCity_Gym_EventScript_WinonaDefeated::
end

FortreeCity_Gym_EventScript_GiveAerialAce2::
giveitem ITEM_TM40
giveitem ITEM_TM_AERIAL_ACE
goto_if_eq VAR_RESULT, FALSE, Common_EventScript_ShowBagIsFull
msgbox FortreeCity_Gym_Text_ExplainAerialAce, MSGBOX_DEFAULT
setflag FLAG_RECEIVED_TM40
setflag FLAG_RECEIVED_TM_AERIAL_ACE
release
end

FortreeCity_Gym_EventScript_GiveAerialAce::
giveitem ITEM_TM40
giveitem ITEM_TM_AERIAL_ACE
goto_if_eq VAR_RESULT, FALSE, Common_EventScript_BagIsFull
msgbox FortreeCity_Gym_Text_ExplainAerialAce, MSGBOX_DEFAULT
setflag FLAG_RECEIVED_TM40
setflag FLAG_RECEIVED_TM_AERIAL_ACE
return

FortreeCity_Gym_EventScript_WinonaRematch::
Expand Down
6 changes: 3 additions & 3 deletions data/maps/FortreeCity_House2/scripts.inc
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ FortreeCity_House2_MapScripts::
FortreeCity_House2_EventScript_HiddenPowerGiver::
lock
faceplayer
goto_if_set FLAG_RECEIVED_TM10, FortreeCity_House2_EventScript_ExplainHiddenPower
goto_if_set FLAG_RECEIVED_TM_HIDDEN_POWER, FortreeCity_House2_EventScript_ExplainHiddenPower
call_if_unset FLAG_MET_HIDDEN_POWER_GIVER, FortreeCity_House2_EventScript_Greeting
msgbox FortreeCity_House2_Text_CoinInWhichHand, MSGBOX_DEFAULT
multichoice 21, 8, MULTI_RIGHTLEFT, TRUE
Expand All @@ -19,9 +19,9 @@ FortreeCity_House2_EventScript_HiddenPowerGiver::
switch VAR_RESULT
case 0, FortreeCity_House2_EventScript_WrongGuess
msgbox FortreeCity_House2_Text_YourHiddenPowerHasAwoken, MSGBOX_DEFAULT
giveitem ITEM_TM10
giveitem ITEM_TM_HIDDEN_POWER
goto_if_eq VAR_RESULT, 0, Common_EventScript_ShowBagIsFull
setflag FLAG_RECEIVED_TM10
setflag FLAG_RECEIVED_TM_HIDDEN_POWER
msgbox FortreeCity_House2_Text_ExplainHiddenPower, MSGBOX_DEFAULT
release
end
Expand Down
6 changes: 3 additions & 3 deletions data/maps/GraniteCave_1F/scripts.inc
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@ GraniteCave_1F_MapScripts::
GraniteCave_1F_EventScript_Hiker::
lock
faceplayer
goto_if_set FLAG_RECEIVED_HM05, GraniteCave_1F_EventScript_ReceivedFlash
goto_if_set FLAG_RECEIVED_HM_FLASH, GraniteCave_1F_EventScript_ReceivedFlash
msgbox GraniteCave_1F_Text_GetsDarkAheadHereYouGo, MSGBOX_DEFAULT
giveitem ITEM_HM05
setflag FLAG_RECEIVED_HM05
giveitem ITEM_HM_FLASH
setflag FLAG_RECEIVED_HM_FLASH
msgbox GraniteCave_1F_Text_ExplainFlash, MSGBOX_DEFAULT
release
end
Expand Down
2 changes: 1 addition & 1 deletion data/maps/GraniteCave_StevensRoom/scripts.inc
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ GraniteCave_StevensRoom_EventScript_Steven::
call Common_EventScript_PlayerHandedOverTheItem
setflag FLAG_DELIVERED_STEVEN_LETTER
msgbox GraniteCave_StevensRoom_Text_ThankYouTakeThis, MSGBOX_DEFAULT
giveitem ITEM_TM47
giveitem ITEM_TM_STEEL_WING
call_if_eq VAR_RESULT, FALSE, GraniteCave_StevensRoom_EventScript_BagFull
msgbox GraniteCave_StevensRoom_Text_CouldBecomeChampionLetsRegister, MSGBOX_DEFAULT
closemessage
Expand Down
10 changes: 5 additions & 5 deletions data/maps/LavaridgeTown_Gym_1F/scripts.inc
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ LavaridgeTown_Gym_1F_EventScript_Flannery::
trainerbattle_single TRAINER_FLANNERY_1, LavaridgeTown_Gym_1F_Text_FlanneryIntro, LavaridgeTown_Gym_1F_Text_FlanneryDefeat, LavaridgeTown_Gym_1F_EventScript_FlanneryDefeated, NO_MUSIC
specialvar VAR_RESULT, ShouldTryRematchBattle
goto_if_eq VAR_RESULT, TRUE, LavaridgeTown_Gym_1F_EventScript_FlanneryRematch
goto_if_unset FLAG_RECEIVED_TM50, LavaridgeTown_Gym_1F_EventScript_GiveOverheat2
goto_if_unset FLAG_RECEIVED_TM_OVERHEAT, LavaridgeTown_Gym_1F_EventScript_GiveOverheat2
msgbox LavaridgeTown_Gym_1F_Text_FlanneryPostBattle, MSGBOX_DEFAULT
release
end
Expand Down Expand Up @@ -84,18 +84,18 @@ LavaridgeTown_Gym_1F_EventScript_FlanneryDefeated::
end

LavaridgeTown_Gym_1F_EventScript_GiveOverheat2::
giveitem ITEM_TM50
giveitem ITEM_TM_OVERHEAT
goto_if_eq VAR_RESULT, FALSE, Common_EventScript_ShowBagIsFull
msgbox LavaridgeTown_Gym_1F_Text_ExplainOverheat, MSGBOX_DEFAULT
setflag FLAG_RECEIVED_TM50
setflag FLAG_RECEIVED_TM_OVERHEAT
release
end

LavaridgeTown_Gym_1F_EventScript_GiveOverheat::
giveitem ITEM_TM50
giveitem ITEM_TM_OVERHEAT
goto_if_eq VAR_RESULT, FALSE, Common_EventScript_BagIsFull
msgbox LavaridgeTown_Gym_1F_Text_ExplainOverheat, MSGBOX_DEFAULT
setflag FLAG_RECEIVED_TM50
setflag FLAG_RECEIVED_TM_OVERHEAT
return

LavaridgeTown_Gym_1F_EventScript_FlanneryRematch::
Expand Down
16 changes: 8 additions & 8 deletions data/maps/LilycoveCity_DepartmentStore_4F/scripts.inc
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,10 @@ LilycoveCity_DepartmentStore_4F_EventScript_ClerkLeft::

.align 2
LilycoveCity_DepartmentStore_4F_Pokemart_AttackTMs:
.2byte ITEM_TM38 @ Fire Blast
.2byte ITEM_TM25 @ Thunder
.2byte ITEM_TM14 @ Blizzard
.2byte ITEM_TM15 @ Hyper Beam
.2byte ITEM_TM_FIRE_BLAST
.2byte ITEM_TM_THUNDER
.2byte ITEM_TM_BLIZZARD
.2byte ITEM_TM_HYPER_BEAM
.2byte ITEM_NONE
release
end
Expand All @@ -45,10 +45,10 @@ LilycoveCity_DepartmentStore_4F_EventScript_ClerkRight::

.align 2
LilycoveCity_DepartmentStore_4F_Pokemart_DefenseTMs:
.2byte ITEM_TM17 @ Protect
.2byte ITEM_TM20 @ Safeguard
.2byte ITEM_TM33 @ Reflect
.2byte ITEM_TM16 @ Light Screen
.2byte ITEM_TM_PROTECT
.2byte ITEM_TM_SAFEGUARD
.2byte ITEM_TM_REFLECT
.2byte ITEM_TM_LIGHT_SCREEN
.2byte ITEM_NONE
release
end
Expand Down
6 changes: 3 additions & 3 deletions data/maps/LilycoveCity_House2/scripts.inc
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@ LilycoveCity_House2_MapScripts::
LilycoveCity_House2_EventScript_FatMan::
lock
faceplayer
goto_if_set FLAG_RECEIVED_TM44, LilycoveCity_House2_EventScript_ReceivedRest
goto_if_set FLAG_RECEIVED_TM_REST, LilycoveCity_House2_EventScript_ReceivedRest
msgbox LilycoveCity_House2_Text_NotAwakeYetHaveThis, MSGBOX_DEFAULT
giveitem ITEM_TM44
giveitem ITEM_TM_REST
goto_if_eq VAR_RESULT, FALSE, Common_EventScript_ShowBagIsFull
setflag FLAG_RECEIVED_TM44
setflag FLAG_RECEIVED_TM_REST
msgbox LilycoveCity_House2_Text_SleepIsEssential, MSGBOX_DEFAULT
release
end
Expand Down
8 changes: 4 additions & 4 deletions data/maps/MauvilleCity/scripts.inc
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ MauvilleCity_OnTransition:
setflag FLAG_SYS_TV_START
clearflag FLAG_MAUVILLE_GYM_BARRIERS_STATE
setvar VAR_MAUVILLE_GYM_STATE, 0
call_if_set FLAG_GOT_TM24_FROM_WATTSON, MauvilleCity_EventScript_MoveWattsonBackToGym
call_if_set FLAG_GOT_TM_THUNDERBOLT_FROM_WATTSON, MauvilleCity_EventScript_MoveWattsonBackToGym
end

MauvilleCity_EventScript_MoveWattsonBackToGym::
Expand Down Expand Up @@ -418,7 +418,7 @@ MauvilleCity_Movement_ScottExitEast:
MauvilleCity_EventScript_Wattson::
lock
faceplayer
goto_if_set FLAG_GOT_TM24_FROM_WATTSON, MauvilleCity_EventScript_ReceivedThunderbolt
goto_if_set FLAG_GOT_TM_THUNDERBOLT_FROM_WATTSON, MauvilleCity_EventScript_ReceivedThunderbolt
goto_if_eq VAR_NEW_MAUVILLE_STATE, 2, MauvilleCity_EventScript_CompletedNewMauville
goto_if_set FLAG_GOT_BASEMENT_KEY_FROM_WATTSON, MauvilleCity_EventScript_BegunNewMauville
msgbox MauvilleCity_Text_WattsonNeedFavorTakeKey, MSGBOX_DEFAULT
Expand All @@ -435,9 +435,9 @@ MauvilleCity_EventScript_BegunNewMauville::

MauvilleCity_EventScript_CompletedNewMauville::
msgbox MauvilleCity_Text_WattsonThanksTakeTM, MSGBOX_DEFAULT
giveitem ITEM_TM24
giveitem ITEM_TM_THUNDERBOLT
goto_if_eq VAR_RESULT, FALSE, Common_EventScript_ShowBagIsFull
setflag FLAG_GOT_TM24_FROM_WATTSON
setflag FLAG_GOT_TM_THUNDERBOLT_FROM_WATTSON
msgbox MauvilleCity_Text_WattsonYoungTakeCharge, MSGBOX_DEFAULT
release
end
Expand Down
Loading

0 comments on commit 912a80e

Please sign in to comment.