Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Generate local IDs from map.json files #675

Open
wants to merge 5 commits into
base: porymap-6
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -255,7 +255,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)/agb_flash.o: CFLAGS := -O -mthumb-interwork
Expand Down
6 changes: 3 additions & 3 deletions asm/macros/event.inc
Original file line number Diff line number Diff line change
Expand Up @@ -610,10 +610,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
4 changes: 3 additions & 1 deletion data/maps/BirthIsland_Exterior/map.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"id": "MAP_BIRTH_ISLAND_EXTERIOR",
"name": "BirthIsland_Exterior",
"layout": "LAYOUT_BIRTH_ISLAND_EXTERIOR",
"music": "0xFFFF",
"music": "MUS_NONE",
"region_map_section": "MAPSEC_BIRTH_ISLAND",
"requires_flash": false,
"weather": "WEATHER_NONE",
Expand All @@ -16,6 +16,7 @@
"connections": null,
"object_events": [
{
"local_id": "LOCALID_BIRTH_ISLAND_EXTERIOR_ROCK",
"type": "object",
"graphics_id": "OBJ_EVENT_GFX_METEORITE",
"x": 15,
Expand All @@ -30,6 +31,7 @@
"flag": "FLAG_HIDE_BIRTH_ISLAND_METEORITE"
},
{
"local_id": "LOCALID_BIRTH_ISLAND_DEOXYS",
"type": "object",
"graphics_id": "OBJ_EVENT_GFX_VAR_0",
"x": 15,
Expand Down
13 changes: 5 additions & 8 deletions data/maps/BirthIsland_Exterior/scripts.inc
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
.set LOCALID_DEOXYS_ROCK, 1
.set LOCALID_DEOXYS, 2

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 @@ -38,7 +35,7 @@ BirthIsland_Exterior_OnResume::
BirthIsland_Exterior_EventScript_TryRemoveDeoxys::
specialvar VAR_RESULT, GetBattleOutcome
goto_if_ne VAR_RESULT, B_OUTCOME_CAUGHT, EventScript_Return
removeobject LOCALID_DEOXYS
removeobject LOCALID_BIRTH_ISLAND_DEOXYS
return

BirthIsland_Exterior_EventScript_Triangle::
Expand Down Expand Up @@ -68,21 +65,21 @@ BirthIsland_Exterior_EventScript_NotSolved3::
end

BirthIsland_Exterior_EventScript_Deoxys::
addobject LOCALID_DEOXYS
addobject LOCALID_BIRTH_ISLAND_DEOXYS
waitse
setfieldeffectargument 0, LOCALID_DEOXYS_ROCK
setfieldeffectargument 0, LOCALID_BIRTH_ISLAND_EXTERIOR_ROCK
setfieldeffectargument 1, MAP_NUM(MAP_BIRTH_ISLAND_EXTERIOR)
setfieldeffectargument 2, MAP_GROUP(MAP_BIRTH_ISLAND_EXTERIOR)
dofieldeffect FLDEFF_DESTROY_DEOXYS_ROCK
playbgm MUS_ENCOUNTER_DEOXYS, 0
waitfieldeffect FLDEFF_DESTROY_DEOXYS_ROCK
applymovement LOCALID_DEOXYS, Movement_DeoxysApproach
applymovement LOCALID_BIRTH_ISLAND_DEOXYS, 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_SPECIAL_WILD_BATTLE
special StartLegendaryBattle
Expand Down
2 changes: 1 addition & 1 deletion data/maps/BirthIsland_Harbor/map.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"id": "MAP_BIRTH_ISLAND_HARBOR",
"name": "BirthIsland_Harbor",
"layout": "LAYOUT_ISLAND_HARBOR",
"music": "0xFFFF",
"music": "MUS_NONE",
"region_map_section": "MAPSEC_BIRTH_ISLAND",
"requires_flash": false,
"weather": "WEATHER_NONE",
Expand Down
7 changes: 5 additions & 2 deletions data/maps/CeladonCity/map.json
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@
"flag": "FLAG_HIDE_CELADON_ROCKETS"
},
{
"local_id": "LOCALID_CELADON_FAT_MAN",
"type": "object",
"graphics_id": "OBJ_EVENT_GFX_FAT_MAN",
"x": 38,
Expand All @@ -55,6 +56,7 @@
"flag": "0"
},
{
"local_id": "LOCALID_CELADON_POLIWRATH",
"type": "object",
"graphics_id": "OBJ_EVENT_GFX_POLIWRATH",
"x": 36,
Expand Down Expand Up @@ -153,6 +155,7 @@
"flag": "0"
},
{
"local_id": "LOCALID_CELADON_BORDER_TREE",
"type": "object",
"graphics_id": "OBJ_EVENT_GFX_CUT_TREE",
"x": 52,
Expand Down Expand Up @@ -199,7 +202,7 @@
"graphics_id": "OBJ_EVENT_GFX_CUT_TREE",
"x": -7,
"y": 21,
"target_local_id": 7,
"target_local_id": "LOCALID_ROUTE16_CUT_TREE",
"target_map": "MAP_ROUTE16"
},
{
Expand Down Expand Up @@ -407,7 +410,7 @@
"x": 48,
"y": 12,
"respawn_map": "MAP_CELADON_CITY_POKEMON_CENTER_1F",
"respawn_npc": 1
"respawn_npc": "LOCALID_CELADON_NURSE"
}
]
}
7 changes: 2 additions & 5 deletions data/maps/CeladonCity/scripts.inc
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
.set LOCALID_FAT_MAN, 2
.set LOCALID_POLIWRATH, 3

CeladonCity_MapScripts::
map_script MAP_SCRIPT_ON_TRANSITION, CeladonCity_OnTransition
.byte 0
Expand Down Expand Up @@ -36,7 +33,7 @@ CeladonCity_EventScript_FatMan::
faceplayer
msgbox CeladonCity_Text_MyTrustedPalPoliwrath
closemessage
applymovement LOCALID_FAT_MAN, Common_Movement_FaceOriginalDirection
applymovement LOCALID_CELADON_FAT_MAN, Common_Movement_FaceOriginalDirection
waitmovement 0
release
end
Expand All @@ -49,7 +46,7 @@ CeladonCity_EventScript_Poliwrath::
msgbox CeladonCity_Text_Poliwrath
closemessage
waitmoncry
applymovement LOCALID_POLIWRATH, Common_Movement_FaceOriginalDirection
applymovement LOCALID_CELADON_POLIWRATH, Common_Movement_FaceOriginalDirection
waitmovement 0
release
end
Expand Down
1 change: 1 addition & 0 deletions data/maps/CeladonCity_Condominiums_RoofRoom/map.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
"flag": "0"
},
{
"local_id": "LOCALID_EEVEE_POKEBALL",
"type": "object",
"graphics_id": "OBJ_EVENT_GFX_ITEM_BALL",
"x": 7,
Expand Down
2 changes: 0 additions & 2 deletions data/maps/CeladonCity_Condominiums_RoofRoom/scripts.inc
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
.set LOCALID_EEVEE_POKEBALL, 2

CeladonCity_Condominiums_RoofRoom_MapScripts::
.byte 0

Expand Down
1 change: 1 addition & 0 deletions data/maps/CeladonCity_GameCorner/map.json
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,7 @@
"flag": "0"
},
{
"local_id": "LOCALID_GAME_CORNER_GRUNT",
"type": "object",
"graphics_id": "OBJ_EVENT_GFX_ROCKET_M",
"x": 11,
Expand Down
10 changes: 4 additions & 6 deletions data/maps/CeladonCity_GameCorner/scripts.inc
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
.set LOCALID_GRUNT, 11

CeladonCity_GameCorner_MapScripts::
map_script MAP_SCRIPT_ON_LOAD, CeladonCity_GameCorner_OnLoad
.byte 0
Expand Down Expand Up @@ -246,7 +244,7 @@ CeladonCity_GameCorner_EventScript_SlotMachine::
goto_if_unset FLAG_GOT_COIN_CASE, CeladonCity_GameCorner_EventScript_SlotMachineNoCoinCase
msgbox CeladonCity_GameCorner_Text_SlotMachineWantToPlay, MSGBOX_YESNO
goto_if_eq VAR_RESULT, NO, CeladonCity_GameCorner_EventScript_DontPlaySlotMachine
setfieldeffectargument 0, OBJ_EVENT_ID_PLAYER
setfieldeffectargument 0, LOCALID_PLAYER
.ifdef BUGFIX
setfieldeffectargument 1, MAP_NUM(MAP_CELADON_CITY_GAME_CORNER)
setfieldeffectargument 2, MAP_GROUP(MAP_CELADON_CITY_GAME_CORNER)
Expand Down Expand Up @@ -421,17 +419,17 @@ CeladonCity_GameCorner_Text_DefeatedGrunt::
closemessage
call_if_eq VAR_FACING, DIR_WEST, CeladonCity_GameCorner_Text_GruntExitWest
call_if_ne VAR_FACING, DIR_WEST, CeladonCity_GameCorner_Text_GruntExit
removeobject LOCALID_GRUNT
removeobject LOCALID_GAME_CORNER_GRUNT
release
end

CeladonCity_GameCorner_Text_GruntExitWest::
applymovement LOCALID_GRUNT, CeladonCity_GameCorner_Movement_GruntExitWest
applymovement LOCALID_GAME_CORNER_GRUNT, CeladonCity_GameCorner_Movement_GruntExitWest
waitmovement 0
return

CeladonCity_GameCorner_Text_GruntExit::
applymovement LOCALID_GRUNT, CeladonCity_GameCorner_Movement_GruntExit
applymovement LOCALID_GAME_CORNER_GRUNT, CeladonCity_GameCorner_Movement_GruntExit
waitmovement 0
return

Expand Down
1 change: 1 addition & 0 deletions data/maps/CeladonCity_PokemonCenter_1F/map.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
"connections": null,
"object_events": [
{
"local_id": "LOCALID_CELADON_NURSE",
"type": "object",
"graphics_id": "OBJ_EVENT_GFX_NURSE",
"x": 7,
Expand Down
11 changes: 9 additions & 2 deletions data/maps/CeruleanCity/map.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@
],
"object_events": [
{
"local_id": "LOCALID_CERULEAN_POLICEMAN",
"type": "object",
"graphics_id": "OBJ_EVENT_GFX_POLICEMAN",
"x": 31,
Expand All @@ -51,6 +52,7 @@
"flag": "0"
},
{
"local_id": "LOCALID_CERULEAN_GRUNT",
"type": "object",
"graphics_id": "OBJ_EVENT_GFX_ROCKET_M",
"x": 33,
Expand Down Expand Up @@ -93,6 +95,7 @@
"flag": "0"
},
{
"local_id": "LOCALID_CERULEAN_SLOWBRO",
"type": "object",
"graphics_id": "OBJ_EVENT_GFX_SLOWBRO",
"x": 32,
Expand All @@ -107,6 +110,7 @@
"flag": "0"
},
{
"local_id": "LOCALID_CERULEAN_LASS",
"type": "object",
"graphics_id": "OBJ_EVENT_GFX_LASS",
"x": 33,
Expand Down Expand Up @@ -135,6 +139,7 @@
"flag": "0"
},
{
"local_id": "LOCALID_CERULEAN_RIVAL",
"type": "object",
"graphics_id": "OBJ_EVENT_GFX_BLUE",
"x": 22,
Expand Down Expand Up @@ -167,10 +172,11 @@
"graphics_id": "OBJ_EVENT_GFX_CUT_TREE",
"x": 50,
"y": 18,
"target_local_id": 10,
"target_local_id": "LOCALID_ROUTE9_CUT_TREE",
"target_map": "MAP_ROUTE9"
},
{
"local_id": "LOCALID_CERULEAN_WOMAN",
"type": "object",
"graphics_id": "OBJ_EVENT_GFX_WOMAN_1",
"x": 12,
Expand All @@ -185,6 +191,7 @@
"flag": "0"
},
{
"local_id": "LOCALID_CERULEAN_CAVE_GUARD",
"type": "object",
"graphics_id": "OBJ_EVENT_GFX_COOLTRAINER_M",
"x": 1,
Expand Down Expand Up @@ -420,7 +427,7 @@
"x": 22,
"y": 20,
"respawn_map": "MAP_CERULEAN_CITY_POKEMON_CENTER_1F",
"respawn_npc": 1
"respawn_npc": "LOCALID_CERULEAN_NURSE"
}
]
}
Loading