From 806b048a9f485f188801ba698b15213e0235056b Mon Sep 17 00:00:00 2001 From: xCrystal Date: Tue, 17 Oct 2023 18:27:28 +0200 Subject: [PATCH] Add wMapSpacesPointer to the map attributes (#4); create basic space macro to define the space layout of maps (#23) --- data/maps/attributes.asm | 3 ++- data/maps/spawn_points.asm | 10 ++++----- macros/scripts/maps.asm | 8 +++++++ maps/DebugLevel1_Map1.asm | 44 ++++++++++++++++++++------------------ maps/DebugLevel2_Map1.asm | 2 ++ maps/DebugLevel3_Map1.asm | 2 ++ maps/DebugLevel4_Map1.asm | 2 ++ maps/DebugLevel5_Map1.asm | 37 ++++++++++++++++++++++++++++++++ maps/DebugLevel5_Map1.blk | 2 +- maps/Level1_Map1.asm | 44 ++++++++++++++++++++------------------ ram/wram.asm | 1 + 11 files changed, 106 insertions(+), 49 deletions(-) diff --git a/data/maps/attributes.asm b/data/maps/attributes.asm index ee28ac836..00559d87f 100644 --- a/data/maps/attributes.asm +++ b/data/maps/attributes.asm @@ -10,9 +10,10 @@ MACRO map_attributes db CURRENT_MAP_HEIGHT, CURRENT_MAP_WIDTH db BANK(\1_Blocks) dw \1_Blocks - db BANK(\1_MapScripts) ; aka BANK(\1_MapEvents) + db BANK(\1_MapScripts) ; aka BANK(\1_MapEvents), BANK(\1_MapSpaces) dw \1_MapScripts dw \1_MapEvents + dw \1_MapSpaces db \4 ENDM diff --git a/data/maps/spawn_points.asm b/data/maps/spawn_points.asm index 5a14b2fed..396062149 100644 --- a/data/maps/spawn_points.asm +++ b/data/maps/spawn_points.asm @@ -11,11 +11,11 @@ SpawnPoints: spawn LEVEL_1_MAP_1, 3, 3 ; SPAWN_LEVEL_1 ; spawn LEVEL_2_MAP_1, 5, 3 ; SPAWN_LEVEL_2 if DEF(_DEBUG) - spawn DEBUGLEVEL_1_MAP_1, 3, 3, ; SPAWN_DEBUGLEVEL_1 - spawn DEBUGLEVEL_2_MAP_1, 3, 3, ; SPAWN_DEBUGLEVEL_2 - spawn DEBUGLEVEL_3_MAP_1, 3, 3, ; SPAWN_DEBUGLEVEL_3 - spawn DEBUGLEVEL_4_MAP_1, 3, 3, ; SPAWN_DEBUGLEVEL_4 - spawn DEBUGLEVEL_5_MAP_1, 3, 3, ; SPAWN_DEBUGLEVEL_5 + spawn DEBUGLEVEL_1_MAP_1, 3, 3 ; SPAWN_DEBUGLEVEL_1 + spawn DEBUGLEVEL_2_MAP_1, 3, 3 ; SPAWN_DEBUGLEVEL_2 + spawn DEBUGLEVEL_3_MAP_1, 3, 3 ; SPAWN_DEBUGLEVEL_3 + spawn DEBUGLEVEL_4_MAP_1, 3, 3 ; SPAWN_DEBUGLEVEL_4 + spawn DEBUGLEVEL_5_MAP_1, 2, 4 ; SPAWN_DEBUGLEVEL_5 endc spawn N_A, -1, -1 diff --git a/macros/scripts/maps.asm b/macros/scripts/maps.asm index 1181ba543..ed98573c0 100644 --- a/macros/scripts/maps.asm +++ b/macros/scripts/maps.asm @@ -131,6 +131,14 @@ MACRO object_event endc ENDM +MACRO space +;\1: x coord +;\2: y coord +;\3: effect (space type specific) +;\4: next space + db \1, \2, \3, \4 +ENDM + MACRO trainer ;\1: trainer group ;\2: trainer id diff --git a/maps/DebugLevel1_Map1.asm b/maps/DebugLevel1_Map1.asm index 843b1ebec..c6ee138be 100755 --- a/maps/DebugLevel1_Map1.asm +++ b/maps/DebugLevel1_Map1.asm @@ -10,6 +10,29 @@ DebugLevel1_Map1_MapScripts: def_callbacks +DebugLevel1_Map1_MapEvents: + db 0, 0 ; filler + + def_warp_events + warp_event 7, 0, LEVEL_1_MAP_1, 1 + + def_coord_events + + def_bg_events + bg_event 2, 1, BGEVENT_UP, DebugLevel1_Map1_PCScript + bg_event 3, 1, BGEVENT_READ, DebugLevel1_Map1_RadioScript + bg_event 5, 1, BGEVENT_READ, DebugLevel1_Map1_BookshelfScript + bg_event 6, 0, BGEVENT_IFSET, DebugLevel1_Map1_PosterScript + + def_object_events + object_event 4, 2, SPRITE_CONSOLE, SPRITEMOVEDATA_STILL, 0, 0, -1, -1, 0, OBJECTTYPE_SCRIPT, 0, DebugLevel1_Map1_GameConsoleScript, -1 + object_event 4, 4, SPRITE_DOLL_1, SPRITEMOVEDATA_STILL, 0, 0, -1, -1, 0, OBJECTTYPE_SCRIPT, 0, DebugLevel1_Map1_Doll1Script, -1 + object_event 5, 4, SPRITE_DOLL_2, SPRITEMOVEDATA_STILL, 0, 0, -1, -1, 0, OBJECTTYPE_SCRIPT, 0, DebugLevel1_Map1_Doll2Script, -1 + object_event 0, 1, SPRITE_BIG_DOLL, SPRITEMOVEDATA_BIGDOLL, 0, 0, -1, -1, 0, OBJECTTYPE_SCRIPT, 0, DebugLevel1_Map1_BigDollScript, -1 + object_event 6, 6, SPRITE_YOUNGSTER, SPRITEMOVEDATA_STANDING_DOWN, 0, 0, -1, -1, PAL_NPC_BLUE, OBJECTTYPE_TRAINER, 1, DebugLevel1_Map1_TrainerYoungsterMikey, -1 + +DebugLevel1_Map1_MapSpaces: + DebugLevel1_Map1_Doll1Script:: opentext callasm .BoardMenu @@ -90,24 +113,3 @@ DebugLevel1_Map1_TrainerYoungsterMikey: line "tle other people" cont "to get better." done - -DebugLevel1_Map1_MapEvents: - db 0, 0 ; filler - - def_warp_events - warp_event 7, 0, LEVEL_1_MAP_1, 1 - - def_coord_events - - def_bg_events - bg_event 2, 1, BGEVENT_UP, DebugLevel1_Map1_PCScript - bg_event 3, 1, BGEVENT_READ, DebugLevel1_Map1_RadioScript - bg_event 5, 1, BGEVENT_READ, DebugLevel1_Map1_BookshelfScript - bg_event 6, 0, BGEVENT_IFSET, DebugLevel1_Map1_PosterScript - - def_object_events - object_event 4, 2, SPRITE_CONSOLE, SPRITEMOVEDATA_STILL, 0, 0, -1, -1, 0, OBJECTTYPE_SCRIPT, 0, DebugLevel1_Map1_GameConsoleScript, -1 - object_event 4, 4, SPRITE_DOLL_1, SPRITEMOVEDATA_STILL, 0, 0, -1, -1, 0, OBJECTTYPE_SCRIPT, 0, DebugLevel1_Map1_Doll1Script, -1 - object_event 5, 4, SPRITE_DOLL_2, SPRITEMOVEDATA_STILL, 0, 0, -1, -1, 0, OBJECTTYPE_SCRIPT, 0, DebugLevel1_Map1_Doll2Script, -1 - object_event 0, 1, SPRITE_BIG_DOLL, SPRITEMOVEDATA_BIGDOLL, 0, 0, -1, -1, 0, OBJECTTYPE_SCRIPT, 0, DebugLevel1_Map1_BigDollScript, -1 - object_event 6, 6, SPRITE_YOUNGSTER, SPRITEMOVEDATA_STANDING_DOWN, 0, 0, -1, -1, PAL_NPC_BLUE, OBJECTTYPE_TRAINER, 1, DebugLevel1_Map1_TrainerYoungsterMikey, -1 diff --git a/maps/DebugLevel2_Map1.asm b/maps/DebugLevel2_Map1.asm index 4b48f8426..eb4565511 100755 --- a/maps/DebugLevel2_Map1.asm +++ b/maps/DebugLevel2_Map1.asm @@ -15,3 +15,5 @@ DebugLevel2_Map1_MapEvents: def_bg_events def_object_events + +DebugLevel2_Map1_MapSpaces: diff --git a/maps/DebugLevel3_Map1.asm b/maps/DebugLevel3_Map1.asm index daa664a22..c57d95049 100755 --- a/maps/DebugLevel3_Map1.asm +++ b/maps/DebugLevel3_Map1.asm @@ -15,3 +15,5 @@ DebugLevel3_Map1_MapEvents: def_bg_events def_object_events + +DebugLevel3_Map1_MapSpaces: diff --git a/maps/DebugLevel4_Map1.asm b/maps/DebugLevel4_Map1.asm index 16b3937a1..667e08f65 100755 --- a/maps/DebugLevel4_Map1.asm +++ b/maps/DebugLevel4_Map1.asm @@ -15,3 +15,5 @@ DebugLevel4_Map1_MapEvents: def_bg_events def_object_events + +DebugLevel4_Map1_MapSpaces: diff --git a/maps/DebugLevel5_Map1.asm b/maps/DebugLevel5_Map1.asm index 8e8048b74..8a1786b10 100755 --- a/maps/DebugLevel5_Map1.asm +++ b/maps/DebugLevel5_Map1.asm @@ -15,3 +15,40 @@ DebugLevel5_Map1_MapEvents: def_bg_events def_object_events + +DebugLevel5_Map1_MapSpaces: + space 2, 4, $0, 1 ; 0 + space 4, 4, $0, 2 ; 1 + space 6, 4, $0, 3 ; 2 + space 8, 4, $0, 4 ; 3 + space 10, 4, $0, 5 ; 4 + space 12, 4, $0, 6 ; 5 + space 14, 4, $0, 7 ; 6 + space 16, 4, $0, 8 ; 7 + space 18, 4, $0, 9 ; 8 + space 20, 4, $0, 10 ; 9 + space 22, 4, $0, 11 ; 10 + space 24, 4, $0, 12 ; 11 + space 24, 6, $0, 13 ; 12 + space 24, 8, $0, 14 ; 13 + space 24, 10, $0, 15 ; 14 + space 24, 12, $0, 16 ; 15 + space 24, 14, $0, 17 ; 16 + space 22, 14, $0, 18 ; 17 + space 20, 14, $0, 19 ; 18 + space 18, 14, $0, 20 ; 19 + space 16, 14, $0, 21 ; 20 + space 14, 14, $0, 22 ; 21 + space 12, 14, $0, 23 ; 22 + space 10, 14, $0, 24 ; 23 + space 8, 14, $0, 25 ; 24 + space 6, 14, $0, 26 ; 25 + space 4, 14, $0, 27 ; 26 + space 4, 12, $0, 28 ; 27 + space 4, 10, $0, 29 ; 28 + space 4, 8, $0, 30 ; 29 + space 6, 8, $0, 31 ; 30 + space 8, 8, $0, 32 ; 31 + space 10, 8, $0, 33 ; 32 + space 12, 8, $0, 34 ; 33 + space 14, 8, $0, 34 ; 34 diff --git a/maps/DebugLevel5_Map1.blk b/maps/DebugLevel5_Map1.blk index 164708b28..306556501 100755 --- a/maps/DebugLevel5_Map1.blk +++ b/maps/DebugLevel5_Map1.blk @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/maps/Level1_Map1.asm b/maps/Level1_Map1.asm index 769154269..ddc19ce3a 100755 --- a/maps/Level1_Map1.asm +++ b/maps/Level1_Map1.asm @@ -10,6 +10,29 @@ Level1_Map1_MapScripts: def_callbacks +Level1_Map1_MapEvents: + db 0, 0 ; filler + + def_warp_events + warp_event 7, 0, LEVEL_1_MAP_1, 1 + + def_coord_events + + def_bg_events + bg_event 2, 1, BGEVENT_UP, Level1_Map1_PCScript + bg_event 3, 1, BGEVENT_READ, Level1_Map1_RadioScript + bg_event 5, 1, BGEVENT_READ, Level1_Map1_BookshelfScript + bg_event 6, 0, BGEVENT_IFSET, Level1_Map1_PosterScript + + def_object_events + object_event 4, 2, SPRITE_CONSOLE, SPRITEMOVEDATA_STILL, 0, 0, -1, -1, 0, OBJECTTYPE_SCRIPT, 0, Level1_Map1_GameConsoleScript, -1 + object_event 4, 4, SPRITE_DOLL_1, SPRITEMOVEDATA_STILL, 0, 0, -1, -1, 0, OBJECTTYPE_SCRIPT, 0, Level1_Map1_Doll1Script, -1 + object_event 5, 4, SPRITE_DOLL_2, SPRITEMOVEDATA_STILL, 0, 0, -1, -1, 0, OBJECTTYPE_SCRIPT, 0, Level1_Map1_Doll2Script, -1 + object_event 0, 1, SPRITE_BIG_DOLL, SPRITEMOVEDATA_BIGDOLL, 0, 0, -1, -1, 0, OBJECTTYPE_SCRIPT, 0, Level1_Map1_BigDollScript, -1 + object_event 6, 6, SPRITE_YOUNGSTER, SPRITEMOVEDATA_STANDING_DOWN, 0, 0, -1, -1, PAL_NPC_BLUE, OBJECTTYPE_TRAINER, 1, Level1_Map1_TrainerYoungsterMikey, -1 + +Level1_Map1_MapSpaces: + Level1_Map1_Doll1Script:: opentext callasm .BoardMenu @@ -90,24 +113,3 @@ Level1_Map1_TrainerYoungsterMikey: line "tle other people" cont "to get better." done - -Level1_Map1_MapEvents: - db 0, 0 ; filler - - def_warp_events - warp_event 7, 0, LEVEL_1_MAP_1, 1 - - def_coord_events - - def_bg_events - bg_event 2, 1, BGEVENT_UP, Level1_Map1_PCScript - bg_event 3, 1, BGEVENT_READ, Level1_Map1_RadioScript - bg_event 5, 1, BGEVENT_READ, Level1_Map1_BookshelfScript - bg_event 6, 0, BGEVENT_IFSET, Level1_Map1_PosterScript - - def_object_events - object_event 4, 2, SPRITE_CONSOLE, SPRITEMOVEDATA_STILL, 0, 0, -1, -1, 0, OBJECTTYPE_SCRIPT, 0, Level1_Map1_GameConsoleScript, -1 - object_event 4, 4, SPRITE_DOLL_1, SPRITEMOVEDATA_STILL, 0, 0, -1, -1, 0, OBJECTTYPE_SCRIPT, 0, Level1_Map1_Doll1Script, -1 - object_event 5, 4, SPRITE_DOLL_2, SPRITEMOVEDATA_STILL, 0, 0, -1, -1, 0, OBJECTTYPE_SCRIPT, 0, Level1_Map1_Doll2Script, -1 - object_event 0, 1, SPRITE_BIG_DOLL, SPRITEMOVEDATA_BIGDOLL, 0, 0, -1, -1, 0, OBJECTTYPE_SCRIPT, 0, Level1_Map1_BigDollScript, -1 - object_event 6, 6, SPRITE_YOUNGSTER, SPRITEMOVEDATA_STANDING_DOWN, 0, 0, -1, -1, PAL_NPC_BLUE, OBJECTTYPE_TRAINER, 1, Level1_Map1_TrainerYoungsterMikey, -1 diff --git a/ram/wram.asm b/ram/wram.asm index 3cca4bb6e..53e82bcfb 100644 --- a/ram/wram.asm +++ b/ram/wram.asm @@ -1852,6 +1852,7 @@ wMapBlocksPointer:: dw wMapScriptsBank:: db wMapScriptsPointer:: dw wMapEventsPointer:: dw +wMapSpacesPointer:: dw ; bit set wMapConnections:: db wMapAttributesEnd::