Skip to content

Commit

Permalink
Generate local IDs from map.json files
Browse files Browse the repository at this point in the history
  • Loading branch information
GriffinRichards committed Oct 12, 2024
1 parent 6518f1e commit 9f31b0f
Show file tree
Hide file tree
Showing 146 changed files with 879 additions and 834 deletions.
3 changes: 2 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -273,7 +273,8 @@ generated: $(AUTO_GEN_TARGETS)
# NOTE: Tools must have been built prior (FIXME)
generated: tools $(AUTO_GEN_TARGETS)
clean-generated:
-rm -f $(AUTO_GEN_TARGETS)
@rm -f $(AUTO_GEN_TARGETS)
@echo "rm -f <AUTO_GEN_TARGETS>"

ifeq ($(MODERN),0)
$(C_BUILDDIR)/libc.o: CC1 := $(TOOLS_DIR)/agbcc/bin/old_agbcc$(EXE)
Expand Down
6 changes: 3 additions & 3 deletions asm/macros/event.inc
Original file line number Diff line number Diff line change
Expand Up @@ -604,10 +604,10 @@
.endm

@ Blocks script execution until the movements being applied to the specified (localId) object finish.
@ If localId is 0, then the id of the last-moved object will be used instead. If the specified object
@ is not currently being manipulated with applymovement, then this command does nothing.
@ If localId is LOCALID_NONE (0), then the id of the last-moved object will be used instead.
@ If the specified object is not currently being manipulated with applymovement, then this command does nothing.
@ If no map is specified, then the current map is used.
.macro waitmovement localId:req, map
.macro waitmovement localId=LOCALID_NONE, map
.ifb \map
.byte 0x51
.2byte \localId
Expand Down
2 changes: 2 additions & 0 deletions data/maps/AquaHideout_B2F/map.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
"connections": null,
"object_events": [
{
"local_id": "LOCALID_AQUA_HIDEOUT_MATT",
"graphics_id": "OBJ_EVENT_GFX_AQUA_MEMBER_M",
"x": 23,
"y": 19,
Expand Down Expand Up @@ -54,6 +55,7 @@
"flag": "FLAG_ITEM_AQUA_HIDEOUT_B2F_NEST_BALL"
},
{
"local_id": "LOCALID_AQUA_HIDEOUT_SUBMARINE",
"graphics_id": "OBJ_EVENT_GFX_SUBMARINE_SHADOW",
"x": 19,
"y": 20,
Expand Down
9 changes: 3 additions & 6 deletions data/maps/AquaHideout_B2F/scripts.inc
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
.set LOCALID_MATT, 1
.set LOCALID_SUBMARINE, 4

AquaHideout_B2F_MapScripts::
map_script MAP_SCRIPT_ON_TRANSITION, AquaHideout_B2F_OnTransition
.byte 0
Expand All @@ -15,7 +12,7 @@ AquaHideout_B2F_EventScript_PreventMattNoticing::

AquaHideout_B2F_EventScript_MattNoticePlayer::
lockall
setvar VAR_0x8008, LOCALID_MATT
setvar VAR_0x8008, LOCALID_AQUA_HIDEOUT_MATT
playse SE_PIN
applymovement VAR_0x8008, Common_Movement_ExclamationMark
waitmovement 0
Expand All @@ -32,8 +29,8 @@ AquaHideout_B2F_EventScript_Matt::
end

AquaHideout_B2F_EventScript_SubmarineEscape::
setvar VAR_0x8008, LOCALID_MATT
setvar VAR_0x8009, LOCALID_SUBMARINE
setvar VAR_0x8008, LOCALID_AQUA_HIDEOUT_MATT
setvar VAR_0x8009, LOCALID_AQUA_HIDEOUT_SUBMARINE
applymovement VAR_0x8008, Common_Movement_WalkInPlaceFasterLeft
waitmovement 0
delay 20
Expand Down
1 change: 1 addition & 0 deletions data/maps/BattleFrontier_BattlePikeCorridor/map.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
"connections": null,
"object_events": [
{
"local_id": "LOCALID_BATTLE_PIKE_CORRIDOR_ATTENDANT",
"graphics_id": "OBJ_EVENT_GFX_LINK_RECEPTIONIST",
"x": 6,
"y": 6,
Expand Down
4 changes: 1 addition & 3 deletions data/maps/BattleFrontier_BattlePikeCorridor/scripts.inc
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
.set LOCALID_ATTENDANT, 1

BattleFrontier_BattlePikeCorridor_MapScripts::
map_script MAP_SCRIPT_ON_FRAME_TABLE, BattleFrontier_BattlePikeCorridor_OnFrame
map_script MAP_SCRIPT_ON_WARP_INTO_MAP_TABLE, BattleFrontier_BattlePikeCorridor_OnWarp
Expand All @@ -15,7 +13,7 @@ BattleFrontier_BattlePikeCorridor_EventScript_EnterCorridor::
pike_cleartrainerids
pike_nohealing TRUE
applymovement OBJ_EVENT_ID_PLAYER, BattleFrontier_BattlePikeCorridor_Movement_PlayerEnterCorridor
applymovement LOCALID_ATTENDANT, BattleFrontier_BattlePikeCorridor_Movement_AttendantEnterCorridor
applymovement LOCALID_BATTLE_PIKE_CORRIDOR_ATTENDANT, BattleFrontier_BattlePikeCorridor_Movement_AttendantEnterCorridor
waitmovement 0
lockall
msgbox BattleFrontier_BattlePikeCorridor_Text_YourChallengeHasBegun, MSGBOX_DEFAULT
Expand Down
1 change: 1 addition & 0 deletions data/maps/BattleFrontier_BattleTowerCorridor/map.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
"connections": null,
"object_events": [
{
"local_id": "LOCALID_BATTLE_TOWER_CORRIDOR_ATTENDANT",
"graphics_id": "OBJ_EVENT_GFX_TEALA",
"x": 9,
"y": 2,
Expand Down
6 changes: 2 additions & 4 deletions data/maps/BattleFrontier_BattleTowerCorridor/scripts.inc
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
.set LOCALID_ATTENDANT, 1

BattleFrontier_BattleTowerCorridor_MapScripts::
map_script MAP_SCRIPT_ON_LOAD, BattleFrontier_BattleTowerCorridor_OnLoad
map_script MAP_SCRIPT_ON_FRAME_TABLE, BattleFrontier_BattleTowerCorridor_OnFrame
Expand All @@ -23,13 +21,13 @@ BattleFrontier_BattleTowerCorridor_OnFrame:
BattleFrontier_BattleTowerCorridor_EventScript_EnterCorridor::
setvar VAR_TEMP_0, 1
goto_if_eq VAR_0x8006, 1, BattleFrontier_BattleTowerCorridor_EventScript_WalkToFarDoor
applymovement LOCALID_ATTENDANT, BattleFrontier_BattleTowerCorridor_Movement_AttendantWalkToDoor
applymovement LOCALID_BATTLE_TOWER_CORRIDOR_ATTENDANT, BattleFrontier_BattleTowerCorridor_Movement_AttendantWalkToDoor
applymovement OBJ_EVENT_ID_PLAYER, BattleFrontier_BattleTowerCorridor_Movement_PlayerWalkToDoor
waitmovement 0
goto BattleFrontier_BattleTowerCorridor_EventScript_WarpToBattleRoom

BattleFrontier_BattleTowerCorridor_EventScript_WalkToFarDoor::
applymovement LOCALID_ATTENDANT, BattleFrontier_BattleTowerCorridor_Movement_AttendantWalkToFarDoor
applymovement LOCALID_BATTLE_TOWER_CORRIDOR_ATTENDANT, BattleFrontier_BattleTowerCorridor_Movement_AttendantWalkToFarDoor
applymovement OBJ_EVENT_ID_PLAYER, BattleFrontier_BattleTowerCorridor_Movement_PlayerWalkToFarDoor
waitmovement 0

Expand Down
2 changes: 2 additions & 0 deletions data/maps/BattleFrontier_BattleTowerLobby/map.json
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@
"flag": "0"
},
{
"local_id": "LOCALID_BATTLE_TOWER_LOBBY_REPORTER",
"graphics_id": "OBJ_EVENT_GFX_REPORTER_F",
"x": 11,
"y": 9,
Expand All @@ -80,6 +81,7 @@
"flag": "FLAG_HIDE_BATTLE_TOWER_REPORTER"
},
{
"local_id": "LOCALID_APPRENTICE",
"graphics_id": "OBJ_EVENT_GFX_VAR_0",
"x": 1,
"y": 5,
Expand Down
1 change: 1 addition & 0 deletions data/maps/BattleFrontier_Mart/map.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
"connections": null,
"object_events": [
{
"local_id": "LOCALID_BATTLE_FRONTIER_MART_CLERK",
"graphics_id": "OBJ_EVENT_GFX_MART_EMPLOYEE",
"x": 1,
"y": 3,
Expand Down
1 change: 1 addition & 0 deletions data/maps/BattleFrontier_OutsideEast/map.json
Original file line number Diff line number Diff line change
Expand Up @@ -190,6 +190,7 @@
"flag": "0"
},
{
"local_id": "LOCALID_FRONTIER_SUDOWOODO",
"graphics_id": "OBJ_EVENT_GFX_SUDOWOODO",
"x": 54,
"y": 62,
Expand Down
8 changes: 3 additions & 5 deletions data/maps/BattleFrontier_OutsideEast/scripts.inc
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
.set LOCALID_SUDOWOODO, 14

BattleFrontier_OutsideEast_MapScripts::
map_script MAP_SCRIPT_ON_RESUME, BattleFrontier_OutsideEast_OnResume
map_script MAP_SCRIPT_ON_TRANSITION, BattleFrontier_OutsideEast_OnTransition
Expand Down Expand Up @@ -108,7 +106,7 @@ BattleFrontier_OutsideEast_EventScript_Sudowoodo::
faceplayer
waitse
playse SE_SUDOWOODO_SHAKE
applymovement LOCALID_SUDOWOODO, BattleFrontier_OutsideEast_Movement_SudowoodoShake
applymovement LOCALID_FRONTIER_SUDOWOODO, BattleFrontier_OutsideEast_Movement_SudowoodoShake
waitmovement 0
release
end
Expand All @@ -120,15 +118,15 @@ BattleFrontier_OutsideEast_EventScript_WaterSudowoodo::
waitstate
waitse
playse SE_SUDOWOODO_SHAKE
applymovement LOCALID_SUDOWOODO, BattleFrontier_OutsideEast_Movement_SudowoodoShake
applymovement LOCALID_FRONTIER_SUDOWOODO, BattleFrontier_OutsideEast_Movement_SudowoodoShake
waitmovement 0
msgbox gText_Sudowoodo_Attacked, MSGBOX_DEFAULT
closemessage
waitse
playmoncry SPECIES_SUDOWOODO, CRY_MODE_ENCOUNTER
delay 40
waitmoncry
setvar VAR_LAST_TALKED, LOCALID_SUDOWOODO
setvar VAR_LAST_TALKED, LOCALID_FRONTIER_SUDOWOODO
setwildbattle SPECIES_SUDOWOODO, 40
setflag FLAG_SYS_CTRL_OBJ_DELETE
dowildbattle
Expand Down
2 changes: 2 additions & 0 deletions data/maps/BirthIsland_Exterior/map.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
"connections": null,
"object_events": [
{
"local_id": "LOCALID_BIRTH_ISLAND_EXTERIOR_ROCK",
"graphics_id": "OBJ_EVENT_GFX_DEOXYS_TRIANGLE",
"x": 15,
"y": 12,
Expand All @@ -28,6 +29,7 @@
"flag": "FLAG_HIDE_BIRTH_ISLAND_DEOXYS_TRIANGLE"
},
{
"local_id": "LOCALID_BIRTH_ISLAND_DEOXYS",
"graphics_id": "OBJ_EVENT_GFX_DEOXYS",
"x": 15,
"y": 3,
Expand Down
12 changes: 4 additions & 8 deletions data/maps/BirthIsland_Exterior/scripts.inc
Original file line number Diff line number Diff line change
@@ -1,7 +1,3 @@
.set LOCALID_DEOXYS, 2

@ Note: LOCALID_BIRTH_ISLAND_EXTERIOR_ROCK is a local id for this map used elsewhere. It's defined in event_objects.h

BirthIsland_Exterior_MapScripts::
map_script MAP_SCRIPT_ON_TRANSITION, BirthIsland_Exterior_OnTransition
map_script MAP_SCRIPT_ON_RESUME, BirthIsland_Exterior_OnResume
Expand Down Expand Up @@ -39,7 +35,7 @@ BirthIsland_Exterior_OnResume:
BirthIsland_Exterior_EventScript_TryRemoveDeoxys::
specialvar VAR_RESULT, GetBattleOutcome
goto_if_ne VAR_RESULT, B_OUTCOME_CAUGHT, Common_EventScript_NopReturn
removeobject LOCALID_DEOXYS
removeobject LOCALID_BIRTH_ISLAND_DEOXYS
return

BirthIsland_Exterior_EventScript_Triangle::
Expand Down Expand Up @@ -77,14 +73,14 @@ BirthIsland_Exterior_EventScript_Deoxys::
dofieldeffect FLDEFF_DESTROY_DEOXYS_ROCK
playbgm MUS_RG_ENCOUNTER_DEOXYS, FALSE
waitfieldeffect FLDEFF_DESTROY_DEOXYS_ROCK
addobject LOCALID_DEOXYS
applymovement LOCALID_DEOXYS, BirthIsland_Exterior_Movement_DeoxysApproach
addobject LOCALID_BIRTH_ISLAND_DEOXYS
applymovement LOCALID_BIRTH_ISLAND_DEOXYS, BirthIsland_Exterior_Movement_DeoxysApproach
waitmovement 0
waitse
playmoncry SPECIES_DEOXYS, CRY_MODE_ENCOUNTER
delay 40
waitmoncry
setvar VAR_LAST_TALKED, LOCALID_DEOXYS
setvar VAR_LAST_TALKED, LOCALID_BIRTH_ISLAND_DEOXYS
seteventmon SPECIES_DEOXYS, 30
setflag FLAG_SYS_CTRL_OBJ_DELETE
special BattleSetup_StartLegendaryBattle
Expand Down
2 changes: 2 additions & 0 deletions data/maps/BirthIsland_Harbor/map.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
"connections": null,
"object_events": [
{
"local_id": "LOCALID_BIRTH_ISLAND_SAILOR",
"graphics_id": "OBJ_EVENT_GFX_SAILOR",
"x": 8,
"y": 5,
Expand All @@ -28,6 +29,7 @@
"flag": "0"
},
{
"local_id": "LOCALID_BIRTH_ISLAND_SS_TIDAL",
"graphics_id": "OBJ_EVENT_GFX_SS_TIDAL",
"x": 8,
"y": 7,
Expand Down
7 changes: 2 additions & 5 deletions data/maps/BirthIsland_Harbor/scripts.inc
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
.set LOCALID_SAILOR, 1
.set LOCALID_SS_TIDAL, 2

BirthIsland_Harbor_MapScripts::
.byte 0

Expand All @@ -14,8 +11,8 @@ BirthIsland_Harbor_EventScript_Sailor::
applymovement VAR_LAST_TALKED, Common_Movement_WalkInPlaceFasterDown
waitmovement 0
delay 30
hideobjectat LOCALID_SAILOR, MAP_BIRTH_ISLAND_HARBOR
setvar VAR_0x8004, LOCALID_SS_TIDAL
hideobjectat LOCALID_BIRTH_ISLAND_SAILOR, MAP_BIRTH_ISLAND_HARBOR
setvar VAR_0x8004, LOCALID_BIRTH_ISLAND_SS_TIDAL
call Common_EventScript_FerryDepartIsland
warp MAP_LILYCOVE_CITY_HARBOR, 8, 11
waitstate
Expand Down
1 change: 1 addition & 0 deletions data/maps/CaveOfOrigin_B1F/map.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
"connections": null,
"object_events": [
{
"local_id": "LOCALID_CAVE_OF_ORIGIN_WALLACE",
"graphics_id": "OBJ_EVENT_GFX_WALLACE",
"x": 9,
"y": 13,
Expand Down
12 changes: 5 additions & 7 deletions data/maps/CaveOfOrigin_B1F/scripts.inc
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
.set LOCALID_WALLACE, 1

CaveOfOrigin_B1F_MapScripts::
.byte 0

Expand All @@ -8,16 +6,16 @@ CaveOfOrigin_B1F_EventScript_Wallace::
faceplayer
msgbox CaveOfOrigin_B1F_Text_WallaceStory, MSGBOX_DEFAULT
closemessage
applymovement LOCALID_WALLACE, Common_Movement_WalkInPlaceFasterUp
applymovement LOCALID_CAVE_OF_ORIGIN_WALLACE, Common_Movement_WalkInPlaceFasterUp
waitmovement 0
delay 60
playse SE_PIN
applymovement LOCALID_WALLACE, Common_Movement_ExclamationMark
applymovement LOCALID_CAVE_OF_ORIGIN_WALLACE, Common_Movement_ExclamationMark
waitmovement 0
applymovement LOCALID_WALLACE, Common_Movement_Delay48
applymovement LOCALID_CAVE_OF_ORIGIN_WALLACE, Common_Movement_Delay48
waitmovement 0
delay 30
applymovement LOCALID_WALLACE, Common_Movement_FacePlayer
applymovement LOCALID_CAVE_OF_ORIGIN_WALLACE, Common_Movement_FacePlayer
waitmovement 0
message CaveOfOrigin_B1F_Text_WhereIsRayquaza
waitmessage
Expand Down Expand Up @@ -55,7 +53,7 @@ CaveOfOrigin_B1F_EventScript_AtSkyPillar::
fadescreenspeed FADE_TO_BLACK, 4
setflag FLAG_WALLACE_GOES_TO_SKY_PILLAR
setvar VAR_SOOTOPOLIS_CITY_STATE, 3
removeobject LOCALID_WALLACE
removeobject LOCALID_CAVE_OF_ORIGIN_WALLACE
clearflag FLAG_HIDE_SKY_PILLAR_WALLACE
fadescreen FADE_FROM_BLACK
release
Expand Down
Loading

0 comments on commit 9f31b0f

Please sign in to comment.