diff options
Diffstat (limited to 'engine/overworld/decorations.asm')
-rw-r--r-- | engine/overworld/decorations.asm | 114 |
1 files changed, 62 insertions, 52 deletions
diff --git a/engine/overworld/decorations.asm b/engine/overworld/decorations.asm index 97c73bf7..75243d01 100644 --- a/engine/overworld/decorations.asm +++ b/engine/overworld/decorations.asm @@ -23,7 +23,7 @@ _PlayerDecorationMenu: ld [wCurDecorationCategory], a jr c, .exit_menu ld a, [wMenuSelection] - ld hl, .pointers + ld hl, .category_pointers call MenuJumptable jr nc, .top_loop @@ -46,26 +46,28 @@ _PlayerDecorationMenu: db 0 ; items dw wNumOwnedDecoCategories dw PlaceNthMenuStrings - dw .pointers - -.pointers - dw DecoBedMenu, .bed - dw DecoCarpetMenu, .carpet - dw DecoPlantMenu, .plant - dw DecoPosterMenu, .poster - dw DecoConsoleMenu, .game + dw .category_pointers + +.category_pointers: + table_width 2 + 2, _PlayerDecorationMenu.category_pointers + dw DecoBedMenu, .bed + dw DecoCarpetMenu, .carpet + dw DecoPlantMenu, .plant + dw DecoPosterMenu, .poster + dw DecoConsoleMenu, .game dw DecoOrnamentMenu, .ornament - dw DecoBigDollMenu, .big_doll - dw DecoExitMenu, .exit - -.bed db "BED@" -.carpet db "CARPET@" -.plant db "PLANT@" -.poster db "POSTER@" -.game db "GAME CONSOLE@" -.ornament db "ORNAMENT@" -.big_doll db "BIG DOLL@" -.exit db "EXIT@" + dw DecoBigDollMenu, .big_doll + dw DecoExitMenu, .exit + assert_table_length NUM_DECO_CATEGORIES + 1 + +.bed: db "BED@" +.carpet: db "CARPET@" +.plant: db "PLANT@" +.poster: db "POSTER@" +.game: db "GAME CONSOLE@" +.ornament: db "ORNAMENT@" +.big_doll: db "BIG DOLL@" +.exit: db "EXIT@" .FindCategoriesWithOwnedDecos: xor a @@ -99,7 +101,7 @@ _PlayerDecorationMenu: ret .FindOwnedDecos: - ld hl, .dw + ld hl, .owned_pointers .loop ld a, [hli] ld e, a @@ -121,14 +123,16 @@ _PlayerDecorationMenu: .done ret -.dw - dwb FindOwnedBeds, 0 ; bed - dwb FindOwnedCarpets, 1 ; carpet - dwb FindOwnedPlants, 2 ; plant - dwb FindOwnedPosters, 3 ; poster - dwb FindOwnedConsoles, 4 ; game console +.owned_pointers: + table_width 3, _PlayerDecorationMenu.owned_pointers + dwb FindOwnedBeds, 0 ; bed + dwb FindOwnedCarpets, 1 ; carpet + dwb FindOwnedPlants, 2 ; plant + dwb FindOwnedPosters, 3 ; poster + dwb FindOwnedConsoles, 4 ; game console dwb FindOwnedOrnaments, 5 ; ornament - dwb FindOwnedBigDolls, 6 ; big doll + dwb FindOwnedBigDolls, 6 ; big doll + assert_table_length NUM_DECO_CATEGORIES dw 0 ; end Deco_FillTempWithMinusOne: @@ -200,7 +204,7 @@ FindOwnedBeds: ld c, BEDS jp FindOwnedDecosInCategory -.beds +.beds: db DECO_FEATHERY_BED ; 2 db DECO_PINK_BED ; 3 db DECO_POLKADOT_BED ; 4 @@ -218,7 +222,7 @@ FindOwnedCarpets: ld c, CARPETS jp FindOwnedDecosInCategory -.carpets +.carpets: db DECO_RED_CARPET ; 7 db DECO_BLUE_CARPET ; 8 db DECO_YELLOW_CARPET ; 9 @@ -236,7 +240,7 @@ FindOwnedPlants: ld c, PLANTS jp FindOwnedDecosInCategory -.plants +.plants: db DECO_MAGNAPLANT ; c db DECO_TROPICPLANT ; d db DECO_JUMBOPLANT ; e @@ -253,7 +257,7 @@ FindOwnedPosters: ld c, POSTERS jp FindOwnedDecosInCategory -.posters +.posters: db DECO_TOWN_MAP ; 10 db DECO_PIKACHU_POSTER ; 11 db DECO_CLEFAIRY_POSTER ; 12 @@ -271,7 +275,7 @@ FindOwnedConsoles: ld c, CONSOLES jp FindOwnedDecosInCategory -.consoles +.consoles: db DECO_FAMICOM ; 15 db DECO_SNES ; 16 db DECO_N64 ; 17 @@ -289,7 +293,7 @@ FindOwnedOrnaments: ld c, DOLLS jp FindOwnedDecosInCategory -.ornaments +.ornaments: db DECO_PIKACHU_DOLL ; 1e db DECO_SURF_PIKACHU_DOLL ; 1f db DECO_CLEFAIRY_DOLL ; 20 @@ -326,7 +330,7 @@ FindOwnedBigDolls: ld c, BIG_DOLLS jp FindOwnedDecosInCategory -.big_dolls +.big_dolls: db DECO_BIG_SNORLAX_DOLL ; 1a db DECO_BIG_ONIX_DOLL ; 1b db DECO_BIG_LAPRAS_DOLL ; 1c @@ -419,7 +423,7 @@ PopulateDecoCategoryMenu: GetDecorationData: ld hl, DecorationAttributes - ld bc, 6 + ld bc, DECOATTR_STRUCT_LENGTH call AddNTimes ret @@ -443,7 +447,7 @@ DecorationMenuFunction: DoDecorationAction2: ld a, [wMenuSelection] call GetDecorationData - ld de, 2 ; function 2 + ld de, DECOATTR_ACTION add hl, de ld a, [hl] ld hl, .DecoActions @@ -451,6 +455,7 @@ DoDecorationAction2: ret .DecoActions: + table_width 2, DoDecorationAction2.DecoActions dw DecoAction_nothing dw DecoAction_setupbed dw DecoAction_putawaybed @@ -466,10 +471,11 @@ DoDecorationAction2: dw DecoAction_putawaybigdoll dw DecoAction_setupornament dw DecoAction_putawayornament + assert_table_length NUM_DECO_ACTIONS + 1 GetDecorationFlag: call GetDecorationData - ld de, 3 ; event flag + ld de, DECOATTR_EVENT_FLAG add hl, de ld a, [hli] ld d, [hl] @@ -486,7 +492,7 @@ DecorationFlagAction: GetDecorationSprite: ld a, c call GetDecorationData - ld de, 5 ; sprite + ld de, DECOATTR_SPRITE add hl, de ld a, [hl] ld c, a @@ -497,8 +503,8 @@ INCLUDE "data/decorations/attributes.asm" INCLUDE "data/decorations/names.asm" GetDecoName: - ld a, [hli] - ld e, [hl] + ld a, [hli] ; DECOATTR_TYPE + ld e, [hl] ; DECOATTR_NAME ld bc, wStringBuffer2 push bc ld hl, .NameFunctions @@ -507,6 +513,7 @@ GetDecoName: ret .NameFunctions: + table_width 2, GetDecoName.NameFunctions dw .invalid dw .plant dw .bed @@ -514,37 +521,38 @@ GetDecoName: dw .poster dw .doll dw .bigdoll + assert_table_length NUM_DECO_TYPES + 1 -.invalid +.invalid: ret -.plant +.plant: ld a, e jr .getdeconame -.bed +.bed: call .plant ld a, _BED jr .getdeconame -.carpet +.carpet: call .plant ld a, _CARPET jr .getdeconame -.poster +.poster: ld a, e call .getpokename ld a, _POSTER jr .getdeconame -.doll +.doll: ld a, e call .getpokename ld a, _DOLL jr .getdeconame -.bigdoll +.bigdoll: push de ld a, BIG_ call .getdeconame @@ -552,18 +560,18 @@ GetDecoName: ld a, e jr .getpokename -.getpokename +.getpokename: push bc ld [wNamedObjectIndex], a call GetPokemonName pop bc jr .copy -.getdeconame +.getdeconame: call ._getdeconame jr .copy -._getdeconame +._getdeconame: push bc ld hl, DecorationNames call GetNthString @@ -572,7 +580,7 @@ GetDecoName: pop bc ret -.copy +.copy: ld h, b ld l, c call CopyName2 @@ -961,11 +969,13 @@ DescribeDecoration:: .JumpTable: ; entries correspond to DECODESC_* constants + table_width 2, DescribeDecoration.JumpTable dw DecorationDesc_Poster dw DecorationDesc_LeftOrnament dw DecorationDesc_RightOrnament dw DecorationDesc_GiantOrnament dw DecorationDesc_Console + assert_table_length NUM_DECODESCS DecorationDesc_Poster: ld a, [wDecoPoster] |