diff options
Diffstat (limited to 'engine/overworld')
-rw-r--r-- | engine/overworld/decorations.asm | 116 | ||||
-rw-r--r-- | engine/overworld/map_object_action.asm | 4 | ||||
-rw-r--r-- | engine/overworld/map_objects.asm | 8 | ||||
-rw-r--r-- | engine/overworld/overworld.asm | 2 | ||||
-rw-r--r-- | engine/overworld/player_movement.asm | 6 |
5 files changed, 76 insertions, 60 deletions
diff --git a/engine/overworld/decorations.asm b/engine/overworld/decorations.asm index 18a4fa5c1..d8ec6d9bc 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,25 +560,25 @@ GetDecoName: ld a, e jr .getpokename -.unused ; unreferenced +.unused: ; unreferenced push de call .getdeconame pop de ld a, e jr .getdeconame -.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 @@ -579,7 +587,7 @@ GetDecoName: pop bc ret -.copy +.copy: ld h, b ld l, c call CopyName2 @@ -968,11 +976,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] diff --git a/engine/overworld/map_object_action.asm b/engine/overworld/map_object_action.asm index 5c68f6b0f..e44fdfeb0 100644 --- a/engine/overworld/map_object_action.asm +++ b/engine/overworld/map_object_action.asm @@ -1,6 +1,7 @@ ObjectActionPairPointers: -; entries correspond to OBJECT_ACTION_* constants +; entries correspond to OBJECT_ACTION_* constants (see constants/map_object_constants.asm) ; normal action, frozen action + table_width 2 + 2, ObjectActionPairPointers dw SetFacingStanding, SetFacingStanding dw SetFacingStandAction, SetFacingCurrent dw SetFacingStepAction, SetFacingCurrent @@ -18,6 +19,7 @@ ObjectActionPairPointers: dw SetFacingBoulderDust, SetFacingStanding dw SetFacingGrassShake, SetFacingStanding dw SetFacingSkyfall, SetFacingCurrent + assert_table_length NUM_OBJECT_ACTIONS SetFacingStanding: ld hl, OBJECT_FACING_STEP diff --git a/engine/overworld/map_objects.asm b/engine/overworld/map_objects.asm index 4d7139128..bf809a2e6 100644 --- a/engine/overworld/map_objects.asm +++ b/engine/overworld/map_objects.asm @@ -523,7 +523,8 @@ StepFunction_FromMovement: ret .Pointers: -; entries correspond to SPRITEMOVEFN_* constants +; entries correspond to SPRITEMOVEFN_* constants (see constants/map_object_constants.asm) + table_width 2, StepFunction_FromMovement.Pointers dw MovementFunction_Null ; 00 dw MovementFunction_RandomWalkY ; 01 dw MovementFunction_RandomWalkX ; 02 @@ -552,6 +553,7 @@ StepFunction_FromMovement: dw MovementFunction_SpinCounterclockwise ; 19 dw MovementFunction_BoulderDust ; 1a dw MovementFunction_ShakingGrass ; 1b + assert_table_length NUM_SPRITEMOVEFN MovementFunction_Null: ret @@ -1085,7 +1087,8 @@ _SetRandomStepDuration: ret StepTypesJumptable: -; entries correspond to STEP_TYPE_* constants +; entries correspond to STEP_TYPE_* constants (see constants/map_object_constants.asm) + table_width 2, StepTypesJumptable dw StepFunction_Reset ; 00 dw StepFunction_FromMovement ; 01 dw StepFunction_NPCWalk ; 02 @@ -1112,6 +1115,7 @@ StepTypesJumptable: dw StepFunction_17 ; 17 dw StepFunction_Delete ; 18 dw StepFunction_SkyfallTop ; 19 + assert_table_length NUM_STEP_TYPES WaitStep_InPlace: ld hl, OBJECT_STEP_DURATION diff --git a/engine/overworld/overworld.asm b/engine/overworld/overworld.asm index f09159f37..e6c8319bf 100644 --- a/engine/overworld/overworld.asm +++ b/engine/overworld/overworld.asm @@ -636,7 +636,7 @@ endr LoadEmote:: ; Get the address of the pointer to emote c. ld a, c - ld bc, 6 ; sizeof(emote) + ld bc, EMOTE_LENGTH ld hl, Emotes call AddNTimes ; Load the emote address into de diff --git a/engine/overworld/player_movement.asm b/engine/overworld/player_movement.asm index a485cfa93..a5db49970 100644 --- a/engine/overworld/player_movement.asm +++ b/engine/overworld/player_movement.asm @@ -1,5 +1,4 @@ DoPlayerMovement:: - call .GetDPad ld a, movement_step_sleep ld [wMovementAnimation], a @@ -12,7 +11,6 @@ DoPlayerMovement:: ret .GetDPad: - ldh a, [hJoyDown] ld [wCurInput], a @@ -469,7 +467,8 @@ DoPlayerMovement:: ret .Steps: -; entries correspond to STEP_* constants +; entries correspond to STEP_* constants (see constants/map_object_constants.asm) + table_width 2, DoPlayerMovement.Steps dw .SlowStep dw .NormalStep dw .FastStep @@ -478,6 +477,7 @@ DoPlayerMovement:: dw .TurningStep dw .BackJumpStep dw .FinishFacing + assert_table_length NUM_STEPS .SlowStep: slow_step DOWN |