From ed44de4bb4688f6b8c83aeb4f5fd8658d17615fb Mon Sep 17 00:00:00 2001 From: PikalaxALT Date: Sat, 14 Nov 2015 14:41:47 -0500 Subject: [PATCH] More map object work --- constants/map_constants.asm | 16 +- constants/sprite_constants.asm | 26 +- engine/events.asm | 2 +- engine/map_objects.asm | 401 ++++++++++--------- engine/map_setup.asm | 4 +- engine/movement.asm | 42 +- engine/overworld.asm | 4 +- gfx/misc/{fishing3.2bpp => boulderdust.2bpp} | Bin gfx/misc/{fishing1.2bpp => shadow.2bpp} | 0 home.asm | 12 +- home/map.asm | 36 +- home/map_objects.asm | 7 +- main.asm | 259 ++++++------ tilesets/animations.asm | 18 +- wram.asm | 32 +- 15 files changed, 450 insertions(+), 409 deletions(-) rename gfx/misc/{fishing3.2bpp => boulderdust.2bpp} (100%) rename gfx/misc/{fishing1.2bpp => shadow.2bpp} (100%) diff --git a/constants/map_constants.asm b/constants/map_constants.asm index c98c64ff9..7891b10f9 100644 --- a/constants/map_constants.asm +++ b/constants/map_constants.asm @@ -529,18 +529,18 @@ const_value SET 1 const OBJECT_FACING const OBJECT_09 const OBJECT_STEP_DURATION - const OBJECT_11 + const OBJECT_ACTION const OBJECT_12 const OBJECT_FACING_STEP const OBJECT_STANDING_TILE const OBJECT_NEXT_TILE - const OBJECT_MAP_X - const OBJECT_MAP_Y const OBJECT_NEXT_MAP_X const OBJECT_NEXT_MAP_Y - const OBJECT_20 - const OBJECT_21 - const OBJECT_22 + const OBJECT_MAP_X + const OBJECT_MAP_Y + const OBJECT_INIT_X + const OBJECT_INIT_Y + const OBJECT_RADIUS const OBJECT_SPRITE_X const OBJECT_SPRITE_Y const OBJECT_SPRITE_X_OFFSET @@ -550,7 +550,7 @@ const_value SET 1 const OBJECT_29 const OBJECT_30 const OBJECT_31 - const OBJECT_32 + const OBJECT_RANGE ; 33-39 are not used ; map object struct @@ -651,3 +651,5 @@ NUM_SPAWNS EQU const_value const PALETTE_NITE const PALETTE_MORN const PALETTE_DARK + +FIXED_FACING EQU 2 diff --git a/constants/sprite_constants.asm b/constants/sprite_constants.asm index d42f0f5d8..1310b0565 100644 --- a/constants/sprite_constants.asm +++ b/constants/sprite_constants.asm @@ -220,15 +220,15 @@ NUM_SPRITEHEADER_FIELDS EQU const_value const SPRITEMOVEDATA_SMASHABLE_ROCK const SPRITEMOVEDATA_STRENGTH_BOULDER const SPRITEMOVEDATA_FOLLOWNOTEXACT - const SPRITEMOVEDATA_1B - const SPRITEMOVEDATA_1C - const SPRITEMOVEDATA_1D + const SPRITEMOVEDATA_SHADOW + const SPRITEMOVEDATA_EMOTE + const SPRITEMOVEDATA_SCREENSHAKE const SPRITEMOVEDATA_SPINCOUNTERCLOCKWISE const SPRITEMOVEDATA_SPINCLOCKWISE const SPRITEMOVEDATA_20 const SPRITEMOVEDATA_BIGDOLL - const SPRITEMOVEDATA_22 - const SPRITEMOVEDATA_23 + const SPRITEMOVEDATA_BOULDERDUST + const SPRITEMOVEDATA_GRASS const SPRITEMOVEDATA_LAPRAS const SPRITEMOVEDATA_25 NUM_SPRITEMOVEDATA EQU const_value +- 1 @@ -255,23 +255,23 @@ SPRITEMOVEDATA_FIELDS EQU 6 const SPRITEMOVEFN_SCRIPTED const SPRITEMOVEFN_STRENGTH const SPRITEMOVEFN_FOLLOWNOTEXACT - const SPRITEMOVEFN_13 - const SPRITEMOVEFN_14 + const SPRITEMOVEFN_SHADOW + const SPRITEMOVEFN_EMOTE const SPRITEMOVEFN_BIG_SNORLAX const SPRITEMOVEFN_BOUNCE - const SPRITEMOVEFN_17 + const SPRITEMOVEFN_SCREENSHAKE const SPRITEMOVEFN_SPIN_CLOCKWISE const SPRITEMOVEFN_SPIN_COUNTERCLOCKWISE - const SPRITEMOVEFN_1A - const SPRITEMOVEFN_1B + const SPRITEMOVEFN_BOULDERDUST + const SPRITEMOVEFN_GRASS MAX_OUTDOOR_SPRITES EQU 23 const_def const OBJECT_09_VALUE_00 - const OBJECT_09_VALUE_01 - const OBJECT_09_VALUE_02 - const OBJECT_09_VALUE_03 + const OBJECT_09_VALUE_01 ; standing + const OBJECT_09_VALUE_02 ; walking + const OBJECT_09_VALUE_03 ; bumping const OBJECT_09_VALUE_04 const OBJECT_09_VALUE_05 const OBJECT_09_VALUE_06 diff --git a/engine/events.asm b/engine/events.asm index 04e090483..004cbf33e 100644 --- a/engine/events.asm +++ b/engine/events.asm @@ -368,7 +368,7 @@ CheckTileEvent: ; 96874 call CheckCoordEventScriptFlag jr z, .coord_events_disabled - call CheckCurrentMapXYTriggers + call CheckCurrentNextMapXYTriggers jr c, .coord_event .coord_events_disabled diff --git a/engine/map_objects.asm b/engine/map_objects.asm index a53658e60..670eca9a6 100644 --- a/engine/map_objects.asm +++ b/engine/map_objects.asm @@ -30,15 +30,15 @@ SpriteMovementData:: ; 4273 db SPRITEMOVEFN_STANDING, DOWN, $01, $2e, $10, $00 ; 18 db SPRITEMOVEFN_STRENGTH, DOWN, $01, $2e, $00, $40 ; 19 db SPRITEMOVEFN_FOLLOWNOTEXACT, DOWN, $01, $02, $00, $00 ; 1a - db SPRITEMOVEFN_13, DOWN, $00, $8e, $01, $00 ; 1b - db SPRITEMOVEFN_14, DOWN, $08, $8e, $02, $00 ; 1c - db SPRITEMOVEFN_17, DOWN, $00, $82, $00, $00 ; 1d + db SPRITEMOVEFN_SHADOW, DOWN, $00, $8e, $01, $00 ; 1b + db SPRITEMOVEFN_EMOTE, DOWN, $08, $8e, $02, $00 ; 1c + db SPRITEMOVEFN_SCREENSHAKE, DOWN, $00, $82, $00, $00 ; 1d db SPRITEMOVEFN_SPIN_COUNTERCLOCKWISE, LEFT, $01, $00, $00, $00 ; 1e db SPRITEMOVEFN_SPIN_CLOCKWISE, RIGHT, $01, $00, $00, $00 ; 1f db SPRITEMOVEFN_STRENGTH, DOWN, $0c, $2e, $01, $c0 ; 20 db SPRITEMOVEFN_STRENGTH, DOWN, $0d, $2e, $01, $c0 ; 21 - db SPRITEMOVEFN_1A, DOWN, $0e, $8e, $01, $00 ; 22 - db SPRITEMOVEFN_1B, DOWN, $0f, $8e, $02, $00 ; 23 + db SPRITEMOVEFN_BOULDERDUST, DOWN, $0e, $8e, $01, $00 ; 22 + db SPRITEMOVEFN_GRASS, DOWN, $0f, $8e, $02, $00 ; 23 db SPRITEMOVEFN_RANDOM_WALK_XY, DOWN, $01, $00, $00, $20 ; 24 db SPRITEMOVEFN_00, DOWN, $01, $00, $00, $00 ; 25 ; 4357 @@ -84,7 +84,7 @@ Function4386: ; 4386 res 6, [hl] ld a, [XCoord] ld e, a - ld hl, OBJECT_MAP_X + ld hl, OBJECT_NEXT_MAP_X add hl, bc ld a, [hl] add 1 @@ -94,7 +94,7 @@ Function4386: ; 4386 jr nc, .ok ld a, [YCoord] ld e, a - ld hl, OBJECT_MAP_Y + ld hl, OBJECT_NEXT_MAP_Y add hl, bc ld a, [hl] add 1 @@ -110,7 +110,7 @@ Function4386: ; 4386 set 6, [hl] ld a, [XCoord] ld e, a - ld hl, OBJECT_20 + ld hl, OBJECT_INIT_X add hl, bc ld a, [hl] add 1 @@ -120,7 +120,7 @@ Function4386: ; 4386 jr nc, .ok2 ld a, [YCoord] ld e, a - ld hl, OBJECT_21 + ld hl, OBJECT_INIT_Y add hl, bc ld a, [hl] add 1 @@ -224,7 +224,8 @@ Function4448: ; 4448 ; 444d Function444d: ; 444d - ld hl, OBJECT_11 +; call [4 * ObjectStructs[ObjInd, OBJECT_ACTION] + de] + ld hl, OBJECT_ACTION add hl, bc ld a, [hl] ld l, a @@ -242,39 +243,39 @@ endr Pointers445f: ; 445f dw Function44a3 ; 00 - dw Function44a3 ; 01 - dw Function44b5 ; 02 - dw Function44aa ; 03 - dw Function44c1 ; 04 - dw Function44aa ; 05 - dw Function4508 ; 06 - dw Function44aa ; 07 - dw Function4529 ; 08 - dw Function44aa ; 09 - dw Function4539 ; 0a - dw Function44a3 ; 0b - dw Function456e ; 0c - dw Function456e ; 0d - dw Function457b ; 0e - dw Function44a3 ; 0f - dw Function4582 ; 10 - dw Function4582 ; 11 - dw Function4589 ; 12 - dw Function4589 ; 13 - dw Function4590 ; 14 - dw Function45a4 ; 15 - dw Function45ab ; 16 - dw Function44aa ; 17 - dw Function45be ; 18 - dw Function45be ; 19 - dw Function45c5 ; 1a - dw Function45c5 ; 1b - dw Function45da ; 1c - dw Function44a3 ; 1d - dw Function45ed ; 1e - dw Function44a3 ; 1f - dw Function44e4 ; 20 - dw Function44aa ; 21 + dw Function44a3 ; 01 (00) + dw Function44b5 ; 02 (01) + dw Function44aa ; 03 (02) + dw Function44c1 ; 04 (03) + dw Function44aa ; 05 (04) + dw Function4508 ; 06 (05) + dw Function44aa ; 07 (06) + dw Function4529 ; 08 (07) + dw Function44aa ; 09 (08) + dw Function4539 ; 0a (09) + dw Function44a3 ; 0b (0a) + dw Function456e ; 0c (0b) + dw Function456e ; 0d (0c) + dw Function457b ; 0e (0d) + dw Function44a3 ; 0f (0e) + dw Function4582 ; 10 (0f) + dw Function4582 ; 11 (10) + dw Function4589 ; 12 (11) + dw Function4589 ; 13 (12) + dw Function4590 ; 14 (13) + dw Function45a4 ; 15 (14) + dw Function45ab ; 16 (15) + dw Function44aa ; 17 (16) + dw Function45be ; 18 (17) + dw Function45be ; 19 (18) + dw Function45c5 ; 1a (19) + dw Function45c5 ; 1b (1a) + dw Function45da ; 1c (1b) + dw Function44a3 ; 1d (1c) + dw Function45ed ; 1e (1d) + dw Function44a3 ; 1f (1e) + dw Function44e4 ; 20 (1f) + dw Function44aa ; 21 (20) ; 44a3 Function44a3: ; 44a3 @@ -286,7 +287,7 @@ Function44a3: ; 44a3 Function44aa: ; 44aa call GetSpriteDirection - or 0 + or 0 ; useless ld hl, OBJECT_FACING_STEP add hl, bc ld [hl], a @@ -556,17 +557,17 @@ Function45ed: ; 45ed Function4600: ; 4600 - ld hl, OBJECT_MAP_X + ld hl, OBJECT_NEXT_MAP_X add hl, bc ld a, [hl] - ld hl, OBJECT_NEXT_MAP_X + ld hl, OBJECT_MAP_X add hl, bc ld [hl], a - ld hl, OBJECT_MAP_Y + ld hl, OBJECT_NEXT_MAP_Y add hl, bc ld a, [hl] - ld hl, OBJECT_NEXT_MAP_Y + ld hl, OBJECT_MAP_Y add hl, bc ld [hl], a @@ -588,17 +589,17 @@ Function4600: ; 4600 Function462a: ; 462a - ld hl, OBJECT_NEXT_MAP_X + ld hl, OBJECT_MAP_X add hl, bc ld a, [hl] - ld hl, OBJECT_MAP_X + ld hl, OBJECT_NEXT_MAP_X add hl, bc ld [hl], a - ld hl, OBJECT_NEXT_MAP_Y + ld hl, OBJECT_MAP_Y add hl, bc ld a, [hl] - ld hl, OBJECT_MAP_Y + ld hl, OBJECT_NEXT_MAP_Y add hl, bc ld [hl], a @@ -662,7 +663,7 @@ Function467b: ; 467b rept 3 ld [hli], a endr - ld [hl], a + ld [hl], a ; OBJECT_30 ld hl, OBJECT_DIRECTION_WALKING add hl, bc ld [hl], STANDING @@ -675,8 +676,8 @@ Function4690: ; 4690 ld [hl], a ld hl, OBJECT_FLAGS1 add hl, bc - bit 2, [hl] - jr nz, .ok + bit FIXED_FACING, [hl] + jr nz, GetCurTile rept 2 add a @@ -685,12 +686,7 @@ endr ld hl, OBJECT_FACING add hl, bc ld [hl], a - -.ok - ; fallthrough -; 46a6 - -Function46a6: ; 46a6 +GetCurTile: ; 46a6 call GetStepVector @@ -699,21 +695,21 @@ Function46a6: ; 46a6 ld [hl], a ld a, d - call Function4730 - ld hl, OBJECT_NEXT_MAP_X + call GetStepVectorSign + ld hl, OBJECT_MAP_X add hl, bc add [hl] - ld hl, OBJECT_MAP_X + ld hl, OBJECT_NEXT_MAP_X add hl, bc ld [hl], a ld d, a ld a, e - call Function4730 - ld hl, OBJECT_NEXT_MAP_Y + call GetStepVectorSign + ld hl, OBJECT_MAP_Y add hl, bc add [hl] - ld hl, OBJECT_MAP_Y + ld hl, OBJECT_NEXT_MAP_Y add hl, bc ld [hl], a ld e, a @@ -729,7 +725,7 @@ Function46a6: ; 46a6 ret ; 46d7 -Function46d7: ; 46d7 +AddStepVector: ; 46d7 call GetStepVector @@ -789,13 +785,15 @@ StepVectors: ; 4700 db 4, 0, 4, 4 ; 4730 -Function4730: ; 4730 +GetStepVectorSign: ; 4730 add a - ret z + ret z ; 0 or 128 + ld a, 1 - ret nc + ret nc ; 1 - 127 + ld a, -1 - ret + ret ; 129 - 255 ; 4738 Function4738: ; 4738 @@ -804,7 +802,7 @@ Function4738: ; 4738 ld a, [hl] and %00000011 ld [wd151], a - call Function46d7 + call AddStepVector ld a, [wd14e] add d ld [wd14e], a @@ -849,28 +847,28 @@ RestoreDefaultMovement: ; 4769 ret ; 4780 -ClearObjectStructField27: ; 4780 +ClearObjectMovementByteIndex: ; 4780 ld hl, OBJECT_MOVEMENT_BYTE_INDEX add hl, bc ld [hl], 0 ret ; 4787 -IncrementObjectStructField27: ; 4787 +IncrementObjectMovementByteIndex: ; 4787 ld hl, OBJECT_MOVEMENT_BYTE_INDEX add hl, bc inc [hl] ret ; 478d -DecrementObjectStructField27: ; 478d +DecrementObjectMovementByteIndex: ; 478d ld hl, OBJECT_MOVEMENT_BYTE_INDEX add hl, bc dec [hl] ret ; 4793 -JumptoObjectStructField27: ; 4793 +JumptoObjectMovementByteIndex: ; 4793 ld hl, OBJECT_MOVEMENT_BYTE_INDEX add hl, bc ld a, [hl] @@ -893,7 +891,7 @@ IncrementObjectStructField28: ; 47a2 ret ; 47a8 -JumptoObjectStructField28: ; 47a8 +Object28AnonymousJumptable: ; 47a8 ; anonymous jumptable ld hl, OBJECT_28 add hl, bc @@ -918,10 +916,10 @@ SetValueObjectStructField28: ; 47b6 ; 47bc Function47bc: ; 47bc - ld hl, OBJECT_MAP_X + ld hl, OBJECT_NEXT_MAP_X add hl, bc ld d, [hl] - ld hl, OBJECT_MAP_Y + ld hl, OBJECT_NEXT_MAP_Y add hl, bc ld e, [hl] push bc @@ -1011,7 +1009,7 @@ Function47dd: ; 47dd ld hl, OBJECT_FACING add hl, bc ld [hl], a - jp Function4b1d + jp RandomStepDuration_Slow ; 4851 .RandomSpin2: ; 4851 @@ -1029,13 +1027,13 @@ Function47dd: ; 47dd .keep ld [hl], a - jp Function4b26 + jp RandomStepDuration_Fast ; 4869 .Standing: ; 4869 call Function462a call Function467b - ld hl, OBJECT_11 + ld hl, OBJECT_ACTION add hl, bc ld [hl], 1 ld hl, OBJECT_09 @@ -1091,7 +1089,7 @@ Function47dd: ; 47dd ; 48ac .Strength: ; 48ac - call JumptoObjectStructField27 + call JumptoObjectMovementByteIndex dw .Strength_Start dw .Strength_Stop ; 48b3 @@ -1109,7 +1107,7 @@ Function47dd: ; 47dd res 2, [hl] jr z, .ok - ld hl, OBJECT_32 + ld hl, OBJECT_RANGE add hl, bc ld a, [hl] and %00000011 @@ -1120,7 +1118,7 @@ Function47dd: ; 47dd ld de, SFX_STRENGTH call PlaySFX - call Function5538 + call SpawnStrengthBoulderDust call Function463f ld hl, OBJECT_09 add hl, bc @@ -1137,7 +1135,7 @@ Function47dd: ; 47dd ret .on_pit - call IncrementObjectStructField27 + call IncrementObjectMovementByteIndex ; fallthrough ; 48f8 @@ -1149,15 +1147,15 @@ Function47dd: ; 47dd ; 48ff .FollowNotExact: ; 48ff - ld hl, OBJECT_MAP_X + ld hl, OBJECT_NEXT_MAP_X add hl, bc ld d, [hl] - ld hl, OBJECT_MAP_Y + ld hl, OBJECT_NEXT_MAP_Y add hl, bc ld e, [hl] - ld hl, OBJECT_32 + ld hl, OBJECT_RANGE add hl, bc ld a, [hl] @@ -1169,7 +1167,7 @@ Function47dd: ; 47dd cp STANDING jr z, .standing - ld hl, OBJECT_NEXT_MAP_X + ld hl, OBJECT_MAP_X add hl, bc ld a, [hl] cp d @@ -1183,7 +1181,7 @@ Function47dd: ; 47dd jr .done .equal - ld hl, OBJECT_NEXT_MAP_Y + ld hl, OBJECT_MAP_Y add hl, bc ld a, [hl] cp e @@ -1210,7 +1208,7 @@ Function47dd: ; 47dd ld hl, OBJECT_DIRECTION_WALKING add hl, bc ld [hl], STANDING - ld hl, OBJECT_11 + ld hl, OBJECT_ACTION add hl, bc ld [hl], 1 ret @@ -1221,7 +1219,7 @@ Function47dd: ; 47dd ld hl, OBJECT_DIRECTION_WALKING add hl, bc ld [hl], STANDING - ld hl, OBJECT_11 + ld hl, OBJECT_ACTION add hl, bc ld [hl], 9 ld hl, OBJECT_09 @@ -1235,7 +1233,7 @@ Function47dd: ; 47dd ld hl, OBJECT_DIRECTION_WALKING add hl, bc ld [hl], STANDING - ld hl, OBJECT_11 + ld hl, OBJECT_ACTION add hl, bc ld [hl], 10 ld hl, OBJECT_09 @@ -1245,14 +1243,14 @@ Function47dd: ; 47dd ; 4984 .MovementSpinCounterclockwise: ; 4984 - call JumptoObjectStructField27 + call JumptoObjectMovementByteIndex dw .MovementSpinInit dw .MovementSpinRepeat dw .MovementSpinTurnLeft ; 498d .MovementSpinClockwise: ; 498d - call JumptoObjectStructField27 + call JumptoObjectMovementByteIndex dw .MovementSpinInit dw .MovementSpinRepeat dw .MovementSpinTurnRight @@ -1260,25 +1258,25 @@ Function47dd: ; 47dd .MovementSpinInit: ; 4996 call Function467b - call IncrementObjectStructField27 + call IncrementObjectMovementByteIndex ; fallthrough ; 499c .MovementSpinRepeat: ; 499c - ld hl, OBJECT_11 + ld hl, OBJECT_ACTION add hl, bc ld [hl], 1 - ld hl, OBJECT_32 + ld hl, OBJECT_RANGE add hl, bc ld a, [hl] - ld a, $10 + ld a, 16 ld hl, OBJECT_STEP_DURATION add hl, bc ld [hl], a ld hl, OBJECT_09 add hl, bc ld [hl], OBJECT_09_VALUE_03 - call IncrementObjectStructField27 + call IncrementObjectMovementByteIndex ret ; 49b8 @@ -1316,13 +1314,13 @@ Function47dd: ; 47dd ld a, [hl] pop hl ld [hl], a - call DecrementObjectStructField27 + call DecrementObjectMovementByteIndex ret ; 49e5 .Movement13: ; 49e5 call ._Movement13_14_1a_1b - ld hl, OBJECT_11 + ld hl, OBJECT_ACTION add hl, bc ld [hl], $7 ld hl, OBJECT_STEP_DURATION @@ -1361,7 +1359,7 @@ Function47dd: ; 47dd .Movement14: ; 4a21 call Function467b call ._Movement13_14_1a_1b - ld hl, OBJECT_11 + ld hl, OBJECT_ACTION add hl, bc ld [hl], 8 ld hl, OBJECT_STEP_DURATION @@ -1382,7 +1380,7 @@ Function47dd: ; 47dd .Movement1a: ; 4a46 call Function467b call ._Movement13_14_1a_1b - ld hl, OBJECT_11 + ld hl, OBJECT_ACTION add hl, bc ld [hl], $e ld hl, OBJECT_STEP_DURATION @@ -1429,7 +1427,7 @@ endr .Movement1b: ; 4a89 call Function467b call ._Movement13_14_1a_1b - ld hl, OBJECT_11 + ld hl, OBJECT_ACTION add hl, bc ld [hl], $f ld hl, OBJECT_STEP_DURATION @@ -1446,7 +1444,7 @@ endr ; 4aa8 ._Movement13_14_1a_1b: ; 4aa8 - ld hl, OBJECT_32 + ld hl, OBJECT_RANGE add hl, bc ld a, [hl] push bc @@ -1464,10 +1462,10 @@ endr .Movement17: ; 4abc call Function467b - ld hl, OBJECT_11 + ld hl, OBJECT_ACTION add hl, bc ld [hl], 0 - ld hl, OBJECT_32 + ld hl, OBJECT_RANGE add hl, bc ld a, [hl] call ._Movement17 @@ -1506,7 +1504,7 @@ endr call Function6ec1 jr c, Function4b17 call Function463f - ld hl, OBJECT_11 + ld hl, OBJECT_ACTION add hl, bc ld [hl], 2 ld hl, wd4cf @@ -1530,28 +1528,28 @@ Function4b17: ; 4b17 ; fallthrough ; 4b1d -Function4b1d: ; 4b1d +RandomStepDuration_Slow: ; 4b1d call Random ld a, [hRandomAdd] and %01111111 - jr Function4b2d + jr SetRandomStepDuration ; 4b26 -Function4b26: ; 4b26 +RandomStepDuration_Fast: ; 4b26 call Random ld a, [hRandomAdd] and %00011111 ; fallthrough ; 4b2d -Function4b2d: ; 4b2d +SetRandomStepDuration: ; 4b2d ld hl, OBJECT_STEP_DURATION add hl, bc ld [hl], a ld hl, OBJECT_DIRECTION_WALKING add hl, bc ld [hl], STANDING - ld hl, OBJECT_11 + ld hl, OBJECT_ACTION add hl, bc ld [hl], 1 ld hl, OBJECT_09 @@ -1602,20 +1600,21 @@ Function4b79: ; 4b79 ; 4b86 Function4b86: ; 4b86 - call JumptoObjectStructField28 + call Object28AnonymousJumptable +; anonymous jumptable dw Function4b8d dw Function4ba9 ; 4b8d Function4b8d: ; 4b8d - call Function46d7 + call AddStepVector call UpdateJumpPosition ld hl, OBJECT_STEP_DURATION add hl, bc dec [hl] ret nz call Function4600 - call Function46a6 + call GetCurTile ld hl, OBJECT_FLAGS2 add hl, bc res 3, [hl] @@ -1624,7 +1623,7 @@ Function4b8d: ; 4b8d ; 4ba9 Function4ba9: ; 4ba9 - call Function46d7 + call AddStepVector call UpdateJumpPosition ld hl, OBJECT_STEP_DURATION add hl, bc @@ -1638,7 +1637,8 @@ Function4ba9: ; 4ba9 ; 4bbf Function4bbf: ; 4bbf - call JumptoObjectStructField28 + call Object28AnonymousJumptable +; anonymous jumptable dw Function4bca dw Function4bd2 dw Function4bf2 @@ -1671,7 +1671,7 @@ Function4bd2: ; 4bd2 ; 4bf2 Function4bf2: ; 4bf2 - call Function46a6 + call GetCurTile ld hl, wd150 set 7, [hl] call IncrementObjectStructField28 @@ -1695,7 +1695,8 @@ Function4bfd: ; 4bfd ; 4c18 Function4c18: ; 4c18 - call JumptoObjectStructField28 + call Object28AnonymousJumptable +; anonymous jumptable dw Function4c23 dw Function4c32 dw Function4c42 @@ -1714,7 +1715,7 @@ Function4c23: ; 4c23 ; 4c32 Function4c32: ; 4c32 - ld hl, OBJECT_11 + ld hl, OBJECT_ACTION add hl, bc ld [hl], 4 ld hl, OBJECT_STEP_DURATION @@ -1743,7 +1744,7 @@ Function4c42: ; 4c42 ; 4c5d Function4c5d: ; 4c5d - ld hl, OBJECT_11 + ld hl, OBJECT_ACTION add hl, bc ld [hl], 4 ld hl, OBJECT_31 @@ -1771,7 +1772,8 @@ Function4c5d: ; 4c5d ; 4c89 Function4c89: ; 4c89 - call JumptoObjectStructField28 + call Object28AnonymousJumptable +; anonymous jumptable dw Function4c9a dw Function4caa dw Function4cb3 @@ -1782,7 +1784,7 @@ Function4c89: ; 4c89 ; 4c9a Function4c9a: ; 4c9a - ld hl, OBJECT_11 + ld hl, OBJECT_ACTION add hl, bc ld [hl], 0 ld hl, OBJECT_STEP_DURATION @@ -1816,7 +1818,7 @@ Function4cb3: ; 4cb3 ; 4cc9 Function4cc9: ; 4cc9 - ld hl, OBJECT_11 + ld hl, OBJECT_ACTION add hl, bc ld [hl], 4 ld hl, OBJECT_31 @@ -1847,7 +1849,7 @@ Function4ceb: ; 4ceb ; 4cf5 Function4cf5: ; 4cf5 - ld hl, OBJECT_11 + ld hl, OBJECT_ACTION add hl, bc ld [hl], 4 ld hl, OBJECT_STEP_DURATION @@ -1870,7 +1872,8 @@ Function4d01: ; 4d01 ; 4d14 Function4d14: ; 4d14 - call JumptoObjectStructField28 + call Object28AnonymousJumptable +; anonymous jumptable dw Function4d1f dw Function4d2e dw Function4d4f @@ -1878,7 +1881,7 @@ Function4d14: ; 4d14 ; 4d1f Function4d1f: ; 4d1f - ld hl, OBJECT_11 + ld hl, OBJECT_ACTION add hl, bc ld [hl], 0 ld hl, OBJECT_STEP_DURATION @@ -1893,7 +1896,7 @@ Function4d2e: ; 4d2e add hl, bc dec [hl] ret nz - ld hl, OBJECT_11 + ld hl, OBJECT_ACTION add hl, bc ld [hl], 2 ld hl, OBJECT_12 @@ -1943,7 +1946,8 @@ Function4d6b: ; 4d6b ; 4d7e Function4d7e: ; 4d7e - call JumptoObjectStructField28 + call Object28AnonymousJumptable +; anonymous jumptable dw Function4d85 dw Function4d94 ; 4d85 @@ -1993,7 +1997,7 @@ Function4db5: ; 4db5 ld a, 0 .yes - ld hl, OBJECT_11 + ld hl, OBJECT_ACTION add hl, bc ld [hl], a ret @@ -2009,7 +2013,7 @@ Function4dc8: ; 4dc8 ld a, 5 .yes - ld hl, OBJECT_11 + ld hl, OBJECT_ACTION add hl, bc ld [hl], a jp Function4b79 @@ -2052,7 +2056,8 @@ Function4dff: ; 4dff ; 4e0c Function4e0c: ; 4e0c - call JumptoObjectStructField28 + call Object28AnonymousJumptable +; anonymous jumptable dw Function4e13 dw Function4e21 ; 4e13 @@ -2077,7 +2082,7 @@ Function4e21: ; 4e21 Function4e2b: ; 4e2b call Function4fb2 - call Function46d7 + call AddStepVector ld hl, OBJECT_STEP_DURATION add hl, bc dec [hl] @@ -2093,18 +2098,19 @@ Function4e2b: ; 4e2b ; 4e47 Function4e47: ; 4e47 - call Function46d7 + call AddStepVector ld hl, OBJECT_STEP_DURATION add hl, bc dec [hl] ret nz call Function4600 - jp Function4b1d + jp RandomStepDuration_Slow ; 4e56 Function4e56: ; 4e56 ; AnimateStep? - call JumptoObjectStructField28 + call Object28AnonymousJumptable +; anonymous jumptable dw Function4e5d dw Function4e65 ; 4e5d @@ -2122,6 +2128,7 @@ Function4e65: ; 4e65 add hl, bc dec [hl] ret nz + ld hl, wd150 set 6, [hl] call Function4600 @@ -2135,7 +2142,8 @@ Function4e65: ; 4e65 ; 4e83 Function4e83: ; 4e83 - call JumptoObjectStructField28 + call Object28AnonymousJumptable +; anonymous jumptable dw Function4e8e dw Function4ea4 dw Function4ead @@ -2192,16 +2200,16 @@ Function4ec0: ; 4ec0 ; 4ecd Function4ecd: ; 4ecd - call Function46d7 + call AddStepVector ld hl, OBJECT_STEP_DURATION add hl, bc dec [hl] ret nz push bc - ld hl, OBJECT_MAP_X + ld hl, OBJECT_NEXT_MAP_X add hl, bc ld d, [hl] - ld hl, OBJECT_MAP_Y + ld hl, OBJECT_NEXT_MAP_Y add hl, bc ld e, [hl] ld hl, OBJECT_MAP_OBJECT_INDEX @@ -2259,7 +2267,8 @@ Function4f04: ; 4f04 ; 4f33 Function4f33: ; 4f33 - call JumptoObjectStructField28 + call Object28AnonymousJumptable +; anonymous jumptable dw Function4f3a dw Function4f43 ; 4f3a @@ -2312,24 +2321,26 @@ Function4f6c: ; 4f6c ; 4f77 Function4f77: ; 4f77 - call JumptoObjectStructField28 ; ???? + call Object28AnonymousJumptable ; ???? ; 4f7a Function4f7a: ; 4f7a - call JumptoObjectStructField28 + call Object28AnonymousJumptable +; anonymous jumptable dw Function4f83 dw Function4f83 dw Function4f83 ; 4f83 Function4f83: ; 4f83 - call JumptoObjectStructField28 + call Object28AnonymousJumptable +; anonymous jumptable dw Function4f8a dw Function4f99 ; 4f8a Function4f8a: ; 4f8a - ld hl, OBJECT_11 + ld hl, OBJECT_ACTION add hl, bc ld [hl], $10 ld hl, OBJECT_STEP_DURATION @@ -2602,79 +2613,80 @@ Function550a: ; 550a ret ; 5529 -Function5529: ; 5529 +SpawnShadow: ; 5529 push bc - ld de, .data_5535 - call Function55b9 - call Function55ac + ld de, .ShadowObject + call CopyTempObjectData + call InitTempObject pop bc ret -.data_5535 - db $00, $05, $1b +.ShadowObject + ; vtile, palette, movement + db $00, PAL_OW_SILVER, SPRITEMOVEDATA_SHADOW ; 5538 -Function5538: ; 5538 +SpawnStrengthBoulderDust: ; 5538 push bc - ld de, .data_5544 - call Function55b9 - call Function55ac + ld de, .BoulderDustObject + call CopyTempObjectData + call InitTempObject pop bc ret -.data_5544 - db $00, $05, $22 +.BoulderDustObject + db $00, PAL_OW_SILVER, SPRITEMOVEDATA_BOULDERDUST ; 5547 -Function5547: ; 5547 +SpawnEmote: ; 5547 push bc - ld de, .data_5553 - call Function55b9 - call Function55ac + ld de, .EmoteObject + call CopyTempObjectData + call InitTempObject pop bc ret -.data_5553 - db $00, $05, $1c +.EmoteObject + db $00, PAL_OW_SILVER, SPRITEMOVEDATA_EMOTE ; 5556 -Function5556: ; 5556 +ShakeGrass: ; 5556 push bc ld de, .data_5562 - call Function55b9 - call Function55ac + call CopyTempObjectData + call InitTempObject pop bc ret .data_5562 - db $00, $06, $23 + db $00, PAL_OW_TREE, SPRITEMOVEDATA_GRASS ; 5565 -Function5565: ; 5565 +ShakeScreen: ; 5565 push bc push af - ld de, .data_5576 - call Function55b9 + ld de, .ScreenShakeObject + call CopyTempObjectData pop af - ld [wc2f5], a - call Function55ac + ld [wTempObjectCopyRange], a + call InitTempObject pop bc ret -.data_5576 - db $00, $05, $1d +.ScreenShakeObject + db $00, PAL_OW_SILVER, SPRITEMOVEDATA_SCREENSHAKE ; 5579 -Function5579: ; 5579 +DespawnEmote: ; 5579 push bc ld a, [hMapObjectIndexBuffer] ld c, a - call Function5582 + call .DeleteEmote pop bc ret ; 5582 -Function5582: ; 5582 +.DeleteEmote: ; 5582 ld de, ObjectStructs ld a, NUM_OBJECT_STRUCTS .loop @@ -2705,20 +2717,21 @@ Function5582: ; 5582 ret ; 55ac -Function55ac: ; 55ac +InitTempObject: ; 55ac call FindFirstEmptyObjectStruct ret nc ld d, h ld e, l - callba Function8286 + callba CopyTempObjectToObjectStruct ret ; 55b9 -Function55b9: ; 55b9 -; load into wc2f0: -; -1, -1, [de], [de + 1], [de + 2], [hMapObjectIndexBuffer], [MapX], [MapY], -1 - ld hl, wc2f0 +CopyTempObjectData: ; 55b9 +; load into wTempObjectCopy: +; -1, -1, [de], [de + 1], [de + 2], [hMapObjectIndexBuffer], [NextMapX], [NextMapY], -1 +; This spawns the object at the same place as whichever object is loaded into bc. + ld hl, wTempObjectCopyMapObjectIndex ld [hl], -1 inc hl ld [hl], -1 @@ -2737,10 +2750,10 @@ Function55b9: ; 55b9 ld [hli], a push hl - ld hl, OBJECT_MAP_X + ld hl, OBJECT_NEXT_MAP_X add hl, bc ld d, [hl] - ld hl, OBJECT_MAP_Y + ld hl, OBJECT_NEXT_MAP_Y add hl, bc ld e, [hl] pop hl @@ -2872,10 +2885,10 @@ Function5680: ; 5680 Function5688: ; 5688 push bc - ld hl, OBJECT_MAP_X + ld hl, OBJECT_NEXT_MAP_X add hl, bc ld d, [hl] - ld hl, OBJECT_MAP_Y + ld hl, OBJECT_NEXT_MAP_Y add hl, bc ld e, [hl] call GetCoordTile @@ -2888,10 +2901,10 @@ Function5688: ; 5688 ; 56a3 Function56a3: ; 56a3 - ld hl, OBJECT_MAP_X + ld hl, OBJECT_NEXT_MAP_X add hl, bc ld d, [hl] - ld hl, OBJECT_MAP_Y + ld hl, OBJECT_NEXT_MAP_Y add hl, bc ld e, [hl] inc d @@ -3612,7 +3625,7 @@ Function59f3: ; 59f3 ld hl, OBJECT_FACING_STEP add hl, bc ld a, [hl] - cp -1 + cp STANDING jp z, .done cp NUM_FACINGS jp nc, .done diff --git a/engine/map_setup.asm b/engine/map_setup.asm index 9c99df2f6..7e0bfd3c1 100644 --- a/engine/map_setup.asm +++ b/engine/map_setup.asm @@ -311,10 +311,10 @@ SuspendMapAnims: ; 154d3 ; 154d7 LoadObjectsRunCallback_02: ; 154d7 - ld a, $2 + ld a, 2 call RunMapCallback callba LoadObjectMasks - callba Function8177 + callba InitializeVisibleSprites ret ; 154ea (5:54ea) diff --git a/engine/movement.asm b/engine/movement.asm index a908624e1..7708773aa 100644 --- a/engine/movement.asm +++ b/engine/movement.asm @@ -127,7 +127,7 @@ Movement_step_wait5: ; 5145 ld hl, OBJECT_12 add hl, bc ld [hl], a - ld hl, OBJECT_11 + ld hl, OBJECT_ACTION add hl, bc ld [hl], $4 call GetMovementByte @@ -164,7 +164,7 @@ Movement_58: ; 516a ; 5189 Movement_fish_got_bite: ; 5189 - ld hl, OBJECT_11 + ld hl, OBJECT_ACTION add hl, bc ld [hl], $6 ld hl, OBJECT_09 @@ -178,7 +178,7 @@ Movement_rock_smash: ; 5196 ld hl, OBJECT_STEP_DURATION add hl, bc ld [hl], a - ld hl, OBJECT_11 + ld hl, OBJECT_ACTION add hl, bc ld [hl], $1 ld hl, OBJECT_09 @@ -188,7 +188,7 @@ Movement_rock_smash: ; 5196 ; 51ab Movement_fish_cast_rod: ; 51ab - ld hl, OBJECT_11 + ld hl, OBJECT_ACTION add hl, bc ld [hl], $6 ld hl, OBJECT_09 @@ -262,7 +262,7 @@ Movement_remove_person: ; 51fd ; 5210 Movement_4b: ; 5210 - ld hl, OBJECT_11 + ld hl, OBJECT_ACTION add hl, bc ld [hl], $1 @@ -323,7 +323,7 @@ Movement_step_sleep_common: ; 5247 add hl, bc ld [hl], OBJECT_09_VALUE_03 - ld hl, OBJECT_11 + ld hl, OBJECT_ACTION add hl, bc ld [hl], $1 @@ -341,7 +341,7 @@ Movement_step_bump: ; 525f ld hl, OBJECT_09 add hl, bc ld [hl], OBJECT_09_VALUE_0B - ld hl, OBJECT_11 + ld hl, OBJECT_ACTION add hl, bc ld [hl], $3 ld hl, OBJECT_DIRECTION_WALKING @@ -358,7 +358,7 @@ Movement_56: ; 5279 ld hl, OBJECT_09 add hl, bc ld [hl], OBJECT_09_VALUE_03 - ld hl, OBJECT_11 + ld hl, OBJECT_ACTION add hl, bc ld [hl], $b ld hl, OBJECT_DIRECTION_WALKING @@ -384,14 +384,14 @@ Movement_39: ; 529c Movement_remove_fixed_facing: ; 52a5 ld hl, OBJECT_FLAGS1 add hl, bc - res 2, [hl] + res FIXED_FACING, [hl] jp ContinueReadingMovement ; 52ae Movement_fix_facing: ; 52ae ld hl, OBJECT_FLAGS1 add hl, bc - set 2, [hl] + set FIXED_FACING, [hl] jp ContinueReadingMovement ; 52b7 @@ -410,12 +410,12 @@ Movement_hide_person: ; 52c0 ; 52c9 Movement_hide_emote: ; 52c9 - call Function5579 + call DespawnEmote jp ContinueReadingMovement ; 52cf Movement_show_emote: ; 52cf - call Function5547 + call SpawnEmote jp ContinueReadingMovement ; 52d5 @@ -424,7 +424,7 @@ Movement_step_shake: ; 52d5 ; displacement (DecimalParam) call GetMovementByte - call Function5565 + call ShakeScreen jp ContinueReadingMovement ; 52de @@ -448,7 +448,7 @@ TurnHead: ; 52ee ld hl, OBJECT_FACING add hl, bc ld [hl], a - ld hl, OBJECT_11 + ld hl, OBJECT_ACTION add hl, bc ld [hl], $1 ld hl, OBJECT_DIRECTION_WALKING @@ -721,7 +721,7 @@ HalfStep: ; 5400 ld hl, OBJECT_29 add hl, bc ld [hl], a - ld hl, OBJECT_11 + ld hl, OBJECT_ACTION add hl, bc ld [hl], $2 ld hl, OBJECT_09 @@ -733,7 +733,7 @@ HalfStep: ; 5400 NormalStep: ; 5412 call Function4690 call Function463f - ld hl, OBJECT_11 + ld hl, OBJECT_ACTION add hl, bc ld [hl], $2 ld hl, OBJECT_STANDING_TILE @@ -746,7 +746,7 @@ NormalStep: ; 5412 jr c, .asm_5430 .asm_542d - call Function5556 + call ShakeGrass .asm_5430 ld hl, wd4cf @@ -769,7 +769,7 @@ NormalStep: ; 5412 TurningStep: ; 5446 call Function4690 call Function463f - ld hl, OBJECT_11 + ld hl, OBJECT_ACTION add hl, bc ld [hl], $4 ld hl, wd4cf @@ -792,7 +792,7 @@ TurningStep: ; 5446 SlideStep: ; 5468 call Function4690 call Function463f - ld hl, OBJECT_11 + ld hl, OBJECT_ACTION add hl, bc ld [hl], $1 ld hl, wd4cf @@ -820,10 +820,10 @@ JumpStep: ; 548a ld hl, OBJECT_FLAGS2 add hl, bc res 3, [hl] - ld hl, OBJECT_11 + ld hl, OBJECT_ACTION add hl, bc ld [hl], $2 - call Function5529 + call SpawnShadow ld hl, wd4cf ld a, [hMapObjectIndexBuffer] cp [hl] diff --git a/engine/overworld.asm b/engine/overworld.asm index 517428007..566cc2a9b 100755 --- a/engine/overworld.asm +++ b/engine/overworld.asm @@ -732,9 +732,9 @@ EmotesPointers: ; 144d emote_header BoltEmote, 4, VTiles1 tile $78 emote_header SleepEmote, 4, VTiles1 tile $78 emote_header FishEmote, 4, VTiles1 tile $78 - emote_header FishingRodGFX1, 1, VTiles1 tile $7c + emote_header JumpShadowGFX, 1, VTiles1 tile $7c emote_header FishingRodGFX2, 2, VTiles1 tile $7c - emote_header FishingRodGFX3, 2, VTiles1 tile $7e + emote_header BoulderDustGFX, 2, VTiles1 tile $7e emote_header FishingRodGFX4, 1, VTiles1 tile $7e ; 14495 diff --git a/gfx/misc/fishing3.2bpp b/gfx/misc/boulderdust.2bpp similarity index 100% rename from gfx/misc/fishing3.2bpp rename to gfx/misc/boulderdust.2bpp diff --git a/gfx/misc/fishing1.2bpp b/gfx/misc/shadow.2bpp similarity index 100% rename from gfx/misc/fishing1.2bpp rename to gfx/misc/shadow.2bpp diff --git a/home.asm b/home.asm index 8995d45d8..ad757acb1 100644 --- a/home.asm +++ b/home.asm @@ -1508,19 +1508,19 @@ FacingPlayerDistance:: ; 36ad ; Return carry if the sprite at bc is facing the player, ; and its distance in d. - ld hl, OBJECT_MAP_X ; x + ld hl, OBJECT_NEXT_MAP_X ; x add hl, bc ld d, [hl] - ld hl, OBJECT_MAP_Y ; y + ld hl, OBJECT_NEXT_MAP_Y ; y add hl, bc ld e, [hl] - ld a, [PlayerMapX] + ld a, [PlayerNextMapX] cp d jr z, .CheckY - ld a, [PlayerMapY] + ld a, [PlayerNextMapY] cp e jr z, .CheckX @@ -1528,7 +1528,7 @@ FacingPlayerDistance:: ; 36ad ret .CheckY - ld a, [PlayerMapY] + ld a, [PlayerNextMapY] sub e jr z, .NotFacing jr nc, .Above @@ -1546,7 +1546,7 @@ FacingPlayerDistance:: ; 36ad jr .CheckFacing .CheckX - ld a, [PlayerMapX] + ld a, [PlayerNextMapX] sub d jr z, .NotFacing jr nc, .Left diff --git a/home/map.asm b/home/map.asm index 1a964fc22..dd4dc069a 100644 --- a/home/map.asm +++ b/home/map.asm @@ -258,10 +258,10 @@ GetDestinationWarpNumber:: ; 2252 ; 2266 .GetDestinationWarpNumber ; 2266 - ld a, [PlayerMapY] + ld a, [PlayerNextMapY] sub $4 ld e, a - ld a, [PlayerMapX] + ld a, [PlayerNextMapX] sub $4 ld d, a ld a, [wCurrMapWarpCount] @@ -570,11 +570,11 @@ ReadWarps:: ; 23da ReadCoordEvents:: ; 23f1 ld a, [hli] ld c, a - ld [wCurrentMapXYTriggerCount], a + ld [wCurrentNextMapXYTriggerCount], a ld a, l - ld [wCurrentMapXYTriggerHeaderPointer], a + ld [wCurrentNextMapXYTriggerHeaderPointer], a ld a, h - ld [wCurrentMapXYTriggerHeaderPointer + 1], a + ld [wCurrentNextMapXYTriggerHeaderPointer + 1], a ld a, c and a @@ -1594,9 +1594,9 @@ Function2914:: ; 2914 call GetLeftRightCollision call GetUpDownCollision ; get coords of current tile - ld a, [PlayerMapX] + ld a, [PlayerNextMapX] ld d, a - ld a, [PlayerMapY] + ld a, [PlayerNextMapY] ld e, a call GetCoordTile ld [PlayerStandingTile], a @@ -1623,9 +1623,9 @@ Function2914:: ; 2914 ; 294d GetUpDownCollision:: ; 294d - ld a, [PlayerMapX] + ld a, [PlayerNextMapX] ld d, a - ld a, [PlayerMapY] + ld a, [PlayerNextMapY] ld e, a push de @@ -1643,9 +1643,9 @@ GetUpDownCollision:: ; 294d ; 296c GetLeftRightCollision:: ; 296c - ld a, [PlayerMapX] + ld a, [PlayerNextMapX] ld d, a - ld a, [PlayerMapY] + ld a, [PlayerNextMapY] ld e, a push de @@ -1772,10 +1772,10 @@ endr ld h, [hl] ld l, a - ld a, [PlayerMapX] + ld a, [PlayerNextMapX] add d ld d, a - ld a, [PlayerMapY] + ld a, [PlayerNextMapY] add e ld e, a ld a, [hl] @@ -1928,9 +1928,9 @@ CheckIfFacingTileCoordIsSign:: ; 2aaa ret ; 2ad4 -CheckCurrentMapXYTriggers:: ; 2ad4 +CheckCurrentNextMapXYTriggers:: ; 2ad4 ; If there are no xy triggers, we don't need to be here. - ld a, [wCurrentMapXYTriggerCount] + ld a, [wCurrentNextMapXYTriggerCount] and a ret z ; Copy the trigger count into c. @@ -1947,7 +1947,7 @@ CheckCurrentMapXYTriggers:: ; 2ad4 CheckStandingOnXYTrigger:: ; 2ae7 ; Checks to see if you are standing on an xy-trigger. If yes, copies the trigger to EngineBuffer1 and sets carry. - ld hl, wCurrentMapXYTriggerHeaderPointer + ld hl, wCurrentNextMapXYTriggerHeaderPointer ld a, [hli] ld h, [hl] ld l, a @@ -1955,10 +1955,10 @@ CheckStandingOnXYTrigger:: ; 2ae7 call CheckTriggers ld b, a ; Load your current coordinates into de. This will be used to check if your position is in the xy-trigger table for the current map. - ld a, [PlayerMapX] + ld a, [PlayerNextMapX] sub 4 ld d, a - ld a, [PlayerMapY] + ld a, [PlayerNextMapY] sub 4 ld e, a diff --git a/home/map_objects.asm b/home/map_objects.asm index c6b7f271c..c2512b22f 100644 --- a/home/map_objects.asm +++ b/home/map_objects.asm @@ -6,7 +6,9 @@ GetSpritePalette:: ; 17ff push de push bc ld c, a + callba _GetSpritePalette + ld a, c pop bc pop de @@ -15,7 +17,7 @@ GetSpritePalette:: ; 17ff ; 180e -Function180e:: ; 180e +GetSpriteVTile:: ; 180e push hl push bc ld hl, UsedSprites + 2 @@ -571,7 +573,7 @@ endr ld [hl], a ld a, [bc] inc bc - ld hl, OBJECT_11 + ld hl, OBJECT_ACTION add hl, de ld [hl], a ld a, [bc] @@ -659,6 +661,7 @@ GetObjectSprite:: ; 1af1 ; 1af8 SetSpriteDirection:: ; 1af8 + ; preserves other flags push af ld hl, OBJECT_FACING add hl, bc diff --git a/main.asm b/main.asm index 93cd9d44f..c455092e6 100644 --- a/main.asm +++ b/main.asm @@ -2178,10 +2178,10 @@ Function6ec1: ; 6ec1 Function6f07: ; 6f07 call Function6f5f ret c - ld hl, OBJECT_MAP_X + ld hl, OBJECT_NEXT_MAP_X add hl, bc ld d, [hl] - ld hl, OBJECT_MAP_Y + ld hl, OBJECT_NEXT_MAP_Y add hl, bc ld e, [hl] ld hl, OBJECT_PALETTE @@ -2351,14 +2351,14 @@ CheckFacingObject:: ; 6fd9 call CheckCounterTile jr nz, .asm_6ff1 - ld a, [PlayerMapX] + ld a, [PlayerNextMapX] sub d cpl inc a add d ld d, a - ld a, [PlayerMapY] + ld a, [PlayerNextMapY] sub e cpl inc a @@ -2386,10 +2386,10 @@ CheckFacingObject:: ; 6fd9 Function7009: ; 7009 - ld hl, OBJECT_MAP_X + ld hl, OBJECT_NEXT_MAP_X add hl, bc ld d, [hl] - ld hl, OBJECT_MAP_Y + ld hl, OBJECT_NEXT_MAP_Y add hl, bc ld e, [hl] jr IsNPCAtCoord @@ -2403,10 +2403,10 @@ Function7015: ; unreferenced ret Function7021: ; 7021 - ld hl, OBJECT_MAP_X + ld hl, OBJECT_NEXT_MAP_X add hl, bc ld d, [hl] - ld hl, OBJECT_MAP_Y + ld hl, OBJECT_NEXT_MAP_Y add hl, bc ld e, [hl] call GetSpriteDirection @@ -2455,12 +2455,12 @@ IsNPCAtCoord: ; 7041 jr .ok2 .got - ld hl, OBJECT_MAP_X + ld hl, OBJECT_NEXT_MAP_X add hl, bc ld a, [hl] cp d jr nz, .ok - ld hl, OBJECT_MAP_Y + ld hl, OBJECT_NEXT_MAP_Y add hl, bc ld a, [hl] cp e @@ -2474,12 +2474,12 @@ IsNPCAtCoord: ; 7041 jr nz, .setcarry .ok - ld hl, OBJECT_NEXT_MAP_X + ld hl, OBJECT_MAP_X add hl, bc ld a, [hl] cp d jr nz, .next - ld hl, OBJECT_NEXT_MAP_Y + ld hl, OBJECT_MAP_Y add hl, bc ld a, [hl] cp e @@ -2508,7 +2508,7 @@ IsNPCAtCoord: ; 7041 ; 70a4 Function70a4: ; 70a4 - ld hl, OBJECT_22 + ld hl, OBJECT_RADIUS add hl, bc ld a, [hl] and a @@ -2517,7 +2517,7 @@ Function70a4: ; 70a4 jr z, .asm_70c7 ld e, a ld d, a - ld hl, OBJECT_20 + ld hl, OBJECT_INIT_X add hl, bc ld a, [hl] sub d @@ -2525,7 +2525,7 @@ Function70a4: ; 70a4 ld a, [hl] add e ld e, a - ld hl, OBJECT_MAP_X + ld hl, OBJECT_NEXT_MAP_X add hl, bc ld a, [hl] cp d @@ -2534,7 +2534,7 @@ Function70a4: ; 70a4 jr z, .asm_70eb .asm_70c7 - ld hl, OBJECT_22 + ld hl, OBJECT_RADIUS add hl, bc ld a, [hl] swap a @@ -2542,7 +2542,7 @@ Function70a4: ; 70a4 jr z, .asm_70e9 ld e, a ld d, a - ld hl, OBJECT_21 + ld hl, OBJECT_INIT_Y add hl, bc ld a, [hl] sub d @@ -2550,7 +2550,7 @@ Function70a4: ; 70a4 ld a, [hl] add e ld e, a - ld hl, OBJECT_MAP_Y + ld hl, OBJECT_NEXT_MAP_Y add hl, bc ld a, [hl] cp d @@ -2568,7 +2568,7 @@ Function70a4: ; 70a4 ; 70ed Function70ed: ; 70ed - ld hl, OBJECT_MAP_X + ld hl, OBJECT_NEXT_MAP_X add hl, bc ld a, [XCoord] cp [hl] @@ -2579,7 +2579,7 @@ Function70ed: ; 70ed jr c, .asm_7111 .asm_70fe - ld hl, OBJECT_MAP_Y + ld hl, OBJECT_NEXT_MAP_Y add hl, bc ld a, [YCoord] cp [hl] @@ -2599,9 +2599,9 @@ Function70ed: ; 70ed ; 7113 Function7113: ; unreferenced - ld a, [PlayerMapX] + ld a, [PlayerNextMapX] ld d, a - ld a, [PlayerMapY] + ld a, [PlayerNextMapY] ld e, a ld bc, ObjectStructs xor a @@ -2619,12 +2619,12 @@ Function7113: ; unreferenced jr .asm_7160 .asm_7136 - ld hl, OBJECT_MAP_Y + ld hl, OBJECT_NEXT_MAP_Y add hl, bc ld a, [hl] cp e jr nz, .asm_714e - ld hl, OBJECT_MAP_X + ld hl, OBJECT_NEXT_MAP_X add hl, bc ld a, [hl] cp d @@ -2635,12 +2635,12 @@ Function7113: ; unreferenced jr .asm_716f .asm_714e - ld hl, OBJECT_NEXT_MAP_Y + ld hl, OBJECT_MAP_Y add hl, bc ld a, [hl] cp e jr nz, .asm_7160 - ld hl, OBJECT_NEXT_MAP_X + ld hl, OBJECT_MAP_X add hl, bc ld a, [hl] cp d @@ -2666,14 +2666,14 @@ Function7113: ; unreferenced Function7171: ; 7171 - ld hl, OBJECT_MAP_X + ld hl, OBJECT_NEXT_MAP_X add hl, bc ld a, d sub [hl] jr c, .asm_718b cp $2 jr nc, .asm_718b - ld hl, OBJECT_MAP_Y + ld hl, OBJECT_NEXT_MAP_Y add hl, bc ld a, e sub [hl] @@ -3235,7 +3235,7 @@ GetSpawnCoord: ; 8029 ld a, $0 ld [hObjectStructIndexBuffer], a ld de, ObjectStructs - call Function8116 + call CopyMapObjectToObjectStruct ld a, $0 ld [wd4cf], a ret @@ -3281,10 +3281,10 @@ WritePersonXY:: ; 80a1 call CheckObjectVisibility ret c - ld hl, OBJECT_MAP_X + ld hl, OBJECT_NEXT_MAP_X add hl, bc ld d, [hl] - ld hl, OBJECT_MAP_Y + ld hl, OBJECT_NEXT_MAP_Y add hl, bc ld e, [hl] ld a, [hMapObjectIndexBuffer] @@ -3298,23 +3298,23 @@ RefreshPlayerCoords: ; 80b8 ld a, [XCoord] add 4 ld d, a - ld hl, PlayerMapX + ld hl, PlayerNextMapX sub [hl] ld [hl], d ld hl, MapObjects + MAPOBJECT_X_COORD ld [hl], d - ld hl, PlayerNextMapX + ld hl, PlayerMapX ld [hl], d ld d, a ld a, [YCoord] add 4 ld e, a - ld hl, PlayerMapY + ld hl, PlayerNextMapY sub [hl] ld [hl], e ld hl, MapObjects + MAPOBJECT_Y_COORD ld [hl], e - ld hl, PlayerNextMapY + ld hl, PlayerMapY ld [hl], e ld e, a ld a, [wObjectFollow_Leader] @@ -3328,6 +3328,7 @@ CopyObjectStruct:: ; 80e7 call CheckObjectMask and a ret nz ; masked + ld hl, ObjectStructs + OBJECT_STRUCT_LENGTH * 1 ld a, 1 ld de, OBJECT_STRUCT_LENGTH @@ -3342,77 +3343,87 @@ CopyObjectStruct:: ; 80e7 cp NUM_OBJECT_STRUCTS jr nz, .loop scf - ret + ret ; overflow .done ld d, h ld e, l - call Function8116 + call CopyMapObjectToObjectStruct ld hl, VramState bit 7, [hl] ret z + ld hl, OBJECT_FLAGS2 add hl, de set 5, [hl] ret ; 8116 -Function8116: ; 8116 - call Function811d - call Function8286 +CopyMapObjectToObjectStruct: ; 8116 + call .CopyMapObjectToTempObject + call CopyTempObjectToObjectStruct ret ; 811d -Function811d: ; 811d +.CopyMapObjectToTempObject: ; 811d ld a, [hObjectStructIndexBuffer] ld hl, MAPOBJECT_OBJECT_STRUCT_ID add hl, bc ld [hl], a + ld a, [hMapObjectIndexBuffer] - ld [wc2f0], a + ld [wTempObjectCopyMapObjectIndex], a + ld hl, MAPOBJECT_SPRITE add hl, bc ld a, [hl] - ld [wc2f1], a - call Function180e - ld [wc2f2], a + ld [wTempObjectCopySprite], a + + call GetSpriteVTile + ld [wTempObjectCopySpriteVTile], a + ld a, [hl] call GetSpritePalette - ld [wc2f3], a + ld [wTempObjectCopyPalette], a + ld hl, MAPOBJECT_COLOR add hl, bc ld a, [hl] and $f0 - jr z, .no_color + jr z, .skip_color_override swap a - and $7 - ld [wc2f3], a + and $7 ; OAM_PALETTE + ld [wTempObjectCopyPalette], a -.no_color +.skip_color_override ld hl, MAPOBJECT_MOVEMENT add hl, bc ld a, [hl] - ld [wc2f4], a + ld [wTempObjectCopyMovement], a + ld hl, MAPOBJECT_RANGE add hl, bc ld a, [hl] - ld [wc2f5], a + ld [wTempObjectCopyRange], a + ld hl, MAPOBJECT_X_COORD add hl, bc ld a, [hl] - ld [wc2f6], a + ld [wTempObjectCopyX], a + ld hl, MAPOBJECT_Y_COORD add hl, bc ld a, [hl] - ld [wc2f7], a + ld [wTempObjectCopyY], a + ld hl, MAPOBJECT_RADIUS add hl, bc ld a, [hl] - ld [wc2f8], a + ld [wTempObjectCopyRadius], a ret ; 8177 -Function8177: ; 8177 +InitializeVisibleSprites: ; 8177 ld bc, MapObjects + OBJECT_LENGTH ld a, 1 .loop @@ -3422,35 +3433,42 @@ Function8177: ; 8177 ld a, [hl] and a jr z, .next + ld hl, MAPOBJECT_OBJECT_STRUCT_ID add hl, bc ld a, [hl] cp -1 jr nz, .next + ld a, [XCoord] ld d, a ld a, [YCoord] ld e, a + ld hl, MAPOBJECT_X_COORD add hl, bc ld a, [hl] add 1 sub d jr c, .next + cp MAPOBJECT_SCREEN_WIDTH jr nc, .next + ld hl, MAPOBJECT_Y_COORD add hl, bc ld a, [hl] add 1 sub e jr c, .next + cp MAPOBJECT_SCREEN_HEIGHT jr nc, .next + push bc call CopyObjectStruct pop bc - jp c, Function81c9 + jp c, .ret .next ld hl, OBJECT_LENGTH @@ -3464,7 +3482,7 @@ Function8177: ; 8177 ret ; 81c9 -Function81c9: ; 81c9 +.ret: ; 81c9 ret ; 81ca @@ -3473,12 +3491,12 @@ Function81ca:: ; 81ca ld a, [wd151] cp $ff ret z - ld hl, Table81d6 + ld hl, .jumptable rst JumpTable ret ; 81d6 -Table81d6: ; 81d6 +.jumptable: ; 81d6 dw Function81e5 dw Function81de dw Function8232 @@ -3602,32 +3620,33 @@ Function823e: ; 823e ; 8286 -Function8286: ; 8286 - ld a, [wc2f0] +CopyTempObjectToObjectStruct: ; 8286 + ld a, [wTempObjectCopyMapObjectIndex] ld hl, OBJECT_MAP_OBJECT_INDEX add hl, de ld [hl], a - ld a, [wc2f4] + ld a, [wTempObjectCopyMovement] call Function1a61 - ld a, [wc2f3] + + ld a, [wTempObjectCopyPalette] ld hl, OBJECT_PALETTE add hl, de or [hl] ld [hl], a - ld a, [wc2f7] - call Function82d5 + ld a, [wTempObjectCopyY] + call .InitYCoord - ld a, [wc2f6] - call Function82f1 + ld a, [wTempObjectCopyX] + call .InitXCoord - ld a, [wc2f1] + ld a, [wTempObjectCopySprite] ld hl, OBJECT_SPRITE add hl, de ld [hl], a - ld a, [wc2f2] + ld a, [wTempObjectCopySpriteVTile] ld hl, OBJECT_SPRITE_TILE add hl, de ld [hl], a @@ -3638,13 +3657,13 @@ Function8286: ; 8286 ld hl, OBJECT_FACING_STEP add hl, de - ld [hl], $ff + ld [hl], STANDING - ld a, [wc2f8] - call Function830d + ld a, [wTempObjectCopyRadius] + call .InitRadius - ld a, [wc2f5] - ld hl, OBJECT_32 + ld a, [wTempObjectCopyRange] + ld hl, OBJECT_RANGE add hl, de ld [hl], a @@ -3652,13 +3671,15 @@ Function8286: ; 8286 ret ; 82d5 -Function82d5: ; 82d5 - ld hl, OBJECT_21 +.InitYCoord: ; 82d5 + ld hl, OBJECT_INIT_Y add hl, de ld [hl], a - ld hl, OBJECT_MAP_Y + + ld hl, OBJECT_NEXT_MAP_Y add hl, de ld [hl], a + ld hl, YCoord sub [hl] and $f @@ -3671,11 +3692,11 @@ Function82d5: ; 82d5 ret ; 82f1 -Function82f1: ; 82f1 - ld hl, OBJECT_20 +.InitXCoord: ; 82f1 + ld hl, OBJECT_INIT_X add hl, de ld [hl], a - ld hl, OBJECT_MAP_X + ld hl, OBJECT_NEXT_MAP_X add hl, de ld [hl], a ld hl, XCoord @@ -3690,7 +3711,7 @@ Function82f1: ; 82f1 ret ; 830d -Function830d: ; 830d +.InitRadius: ; 830d ld h, a inc a and $f @@ -3699,7 +3720,7 @@ Function830d: ; 830d add $10 and $f0 or l - ld hl, OBJECT_22 + ld hl, OBJECT_RADIUS add hl, de ld [hl], a ret @@ -3749,19 +3770,19 @@ TrainerWalkToPlayer: ; 831e call GetObjectStruct ; get last talked coords, load to bc - ld hl, OBJECT_MAP_X + ld hl, OBJECT_NEXT_MAP_X add hl, bc ld a, [hl] - ld hl, OBJECT_MAP_Y + ld hl, OBJECT_NEXT_MAP_Y add hl, bc ld c, [hl] ld b, a ; get player coords, load to de - ld hl, OBJECT_MAP_X + ld hl, OBJECT_NEXT_MAP_X add hl, de ld a, [hl] - ld hl, OBJECT_MAP_Y + ld hl, OBJECT_NEXT_MAP_Y add hl, de ld e, [hl] ld d, a @@ -3815,15 +3836,15 @@ FollowNotExact:: ; 839e ret c ; Person 2 is now in bc, person 1 is now in de - ld hl, OBJECT_MAP_X + ld hl, OBJECT_NEXT_MAP_X add hl, bc ld a, [hl] - ld hl, OBJECT_MAP_Y + ld hl, OBJECT_NEXT_MAP_Y add hl, bc ld c, [hl] ld b, a - ld hl, OBJECT_MAP_X + ld hl, OBJECT_NEXT_MAP_X add hl, de ld a, [hl] cp b @@ -3837,7 +3858,7 @@ FollowNotExact:: ; 839e jr .continue .same_x - ld hl, OBJECT_MAP_Y + ld hl, OBJECT_NEXT_MAP_Y add hl, de ld a, [hl] cp c @@ -3850,7 +3871,7 @@ FollowNotExact:: ; 839e dec c .continue - ld hl, OBJECT_MAP_X + ld hl, OBJECT_NEXT_MAP_X add hl, de ld [hl], b ld a, b @@ -3863,7 +3884,7 @@ FollowNotExact:: ; 839e ld hl, OBJECT_SPRITE_X add hl, de ld [hl], a - ld hl, OBJECT_MAP_Y + ld hl, OBJECT_NEXT_MAP_Y add hl, de ld [hl], c ld a, c @@ -3877,7 +3898,7 @@ FollowNotExact:: ; 839e add hl, de ld [hl], a ld a, [hObjectStructIndexBuffer] - ld hl, OBJECT_32 + ld hl, OBJECT_RANGE add hl, de ld [hl], a ld hl, OBJECT_MOVEMENTTYPE @@ -3920,10 +3941,10 @@ GetRelativeFacing:: ; 8417 ; load the coordinates of object d into bc ld a, d call GetObjectStruct - ld hl, OBJECT_MAP_X + ld hl, OBJECT_NEXT_MAP_X add hl, bc ld a, [hl] - ld hl, OBJECT_MAP_Y + ld hl, OBJECT_NEXT_MAP_Y add hl, bc ld c, [hl] ld b, a @@ -3931,10 +3952,10 @@ GetRelativeFacing:: ; 8417 ; load the coordinates of object e into de ld a, e call GetObjectStruct - ld hl, OBJECT_MAP_X + ld hl, OBJECT_NEXT_MAP_X add hl, bc ld d, [hl] - ld hl, OBJECT_MAP_Y + ld hl, OBJECT_NEXT_MAP_Y add hl, bc ld e, [hl] pop bc @@ -4014,15 +4035,15 @@ Function848a: ; 848a Function849d: ; 849d ld a, [wObjectFollow_Leader] call GetObjectStruct - ld hl, OBJECT_MAP_X + ld hl, OBJECT_NEXT_MAP_X add hl, bc ld d, [hl] - ld hl, OBJECT_MAP_Y + ld hl, OBJECT_NEXT_MAP_Y add hl, bc ld e, [hl] ld a, [wObjectFollow_Follower] call GetObjectStruct - ld hl, OBJECT_MAP_X + ld hl, OBJECT_NEXT_MAP_X add hl, bc ld a, d cp [hl] @@ -4038,7 +4059,7 @@ Function849d: ; 849d ret .check_y - ld hl, OBJECT_MAP_Y + ld hl, OBJECT_NEXT_MAP_Y add hl, bc ld a, e cp [hl] @@ -34646,13 +34667,13 @@ IsNPCInFront: ; 80341 ld a, 0 ld [hMapObjectIndexBuffer], a ; Load the next X coordinate into d - ld a, [PlayerMapX] + ld a, [PlayerNextMapX] ld d, a ld a, [WalkingX] add d ld d, a ; Load the next Y coordinate into e - ld a, [PlayerMapY] + ld a, [PlayerNextMapY] ld e, a ld a, [WalkingY] add e @@ -34701,7 +34722,7 @@ Function8036f: ; 8036f ld a, [WalkingDirection] ld d, a - ld hl, OBJECT_32 + ld hl, OBJECT_RANGE add hl, bc ld a, [hl] and $fc @@ -50405,17 +50426,17 @@ Function10433a: ; 10433a (41:433a) ret ; 104350 -ShockEmote: INCBIN "gfx/emotes/shock.2bpp" -QuestionEmote: INCBIN "gfx/emotes/question.2bpp" -HappyEmote: INCBIN "gfx/emotes/happy.2bpp" -SadEmote: INCBIN "gfx/emotes/sad.2bpp" -HeartEmote: INCBIN "gfx/emotes/heart.2bpp" -BoltEmote: INCBIN "gfx/emotes/bolt.2bpp" -SleepEmote: INCBIN "gfx/emotes/sleep.2bpp" -FishEmote: INCBIN "gfx/emotes/fish.2bpp" -FishingRodGFX1: INCBIN "gfx/misc/fishing1.2bpp" +ShockEmote: INCBIN "gfx/emotes/shock.2bpp" +QuestionEmote: INCBIN "gfx/emotes/question.2bpp" +HappyEmote: INCBIN "gfx/emotes/happy.2bpp" +SadEmote: INCBIN "gfx/emotes/sad.2bpp" +HeartEmote: INCBIN "gfx/emotes/heart.2bpp" +BoltEmote: INCBIN "gfx/emotes/bolt.2bpp" +SleepEmote: INCBIN "gfx/emotes/sleep.2bpp" +FishEmote: INCBIN "gfx/emotes/fish.2bpp" +JumpShadowGFX: INCBIN "gfx/misc/shadow.2bpp" FishingRodGFX2: INCBIN "gfx/misc/fishing2.2bpp" -FishingRodGFX3: INCBIN "gfx/misc/fishing3.2bpp" +BoulderDustGFX: INCBIN "gfx/misc/boulderdust.2bpp" FishingRodGFX4: INCBIN "gfx/misc/fishing4.2bpp" @@ -50770,7 +50791,7 @@ CheckMovingOffEdgeOfMap:: ; 104820 (41:4820) ret .down - ld a, [PlayerMapY] + ld a, [PlayerNextMapY] sub 4 ld b, a ld a, [MapHeight] @@ -50781,7 +50802,7 @@ CheckMovingOffEdgeOfMap:: ; 104820 (41:4820) ret .up - ld a, [PlayerMapY] + ld a, [PlayerNextMapY] sub 4 cp -1 jr z, .ok @@ -50789,7 +50810,7 @@ CheckMovingOffEdgeOfMap:: ; 104820 (41:4820) ret .left - ld a, [PlayerMapX] + ld a, [PlayerNextMapX] sub $4 cp -1 jr z, .ok @@ -50797,7 +50818,7 @@ CheckMovingOffEdgeOfMap:: ; 104820 (41:4820) ret .right - ld a, [PlayerMapX] + ld a, [PlayerNextMapX] sub 4 ld b, a ld a, [MapWidth] diff --git a/tilesets/animations.asm b/tilesets/animations.asm index d0e44a063..0a681c86b 100644 --- a/tilesets/animations.asm +++ b/tilesets/animations.asm @@ -48,7 +48,7 @@ Tileset03Anim: ; 0xfc01b dw NULL, AnimateFlowerTile dw NULL, WaitTileAnimation dw NULL, WaitTileAnimation - dw NULL, NextTileFrame8 + dw NULL, CurTileFrame8 dw NULL, DoneTileAnimation ; 0xfc047 @@ -62,7 +62,7 @@ Tileset25Anim: ; 0xfc047 dw NULL, AnimateFlowerTile dw NULL, WaitTileAnimation dw NULL, WaitTileAnimation - dw NULL, NextTileFrame8 + dw NULL, CurTileFrame8 dw NULL, DoneTileAnimation ; 0xfc073 @@ -77,7 +77,7 @@ Tileset31Anim: ; 0xfc073 dw NULL, AnimateFlowerTile dw VTiles2 tile $14, AnimateWaterTile dw NULL, TileAnimationPalette - dw NULL, NextTileFrame8 + dw NULL, CurTileFrame8 dw NULL, DoneTileAnimation ; 0xfc0a3 @@ -93,7 +93,7 @@ Tileset01Anim: ; 0xfc0a3 dw WhirlpoolFrames3, AnimateWhirlpoolTile dw WhirlpoolFrames4, AnimateWhirlpoolTile dw NULL, WaitTileAnimation - dw NULL, NextTileFrame8 + dw NULL, CurTileFrame8 dw NULL, DoneTileAnimation ; 0xfc0d7 @@ -136,7 +136,7 @@ Tileset09Anim: ; 0xfc12f dw NULL, WaitTileAnimation dw NULL, WaitTileAnimation dw NULL, WaitTileAnimation - dw NULL, NextTileFrame8 + dw NULL, CurTileFrame8 dw NULL, DoneTileAnimation ; 0xfc15f @@ -147,7 +147,7 @@ Tileset15Anim: ; 0xfc15f dw NULL, WaitTileAnimation dw NULL, SafariFountainAnim1 dw NULL, WaitTileAnimation - dw NULL, NextTileFrame8 + dw NULL, CurTileFrame8 dw NULL, DoneTileAnimation ; 0xfc17f @@ -239,7 +239,7 @@ Tileset23Anim: ; 0xfc27f dw SproutPillarTilePointer4, AnimateSproutPillarTile dw SproutPillarTilePointer1, AnimateSproutPillarTile dw SproutPillarTilePointer2, AnimateSproutPillarTile - dw NULL, NextTileFrame + dw NULL, CurTileFrame dw NULL, WaitTileAnimation dw NULL, WaitTileAnimation dw NULL, WaitTileAnimation @@ -302,7 +302,7 @@ WaitTileAnimation: ; fc2fe ret ; fc2ff -NextTileFrame8: ; fc2ff +CurTileFrame8: ; fc2ff ld a, [TileAnimationTimer] inc a and a, 7 @@ -806,7 +806,7 @@ AnimateSproutPillarTile: ; fc645 ; fc673 -NextTileFrame: ; fc673 +CurTileFrame: ; fc673 ld hl, TileAnimationTimer inc [hl] ret diff --git a/wram.asm b/wram.asm index 504294902..42de7cb76 100644 --- a/wram.asm +++ b/wram.asm @@ -327,15 +327,17 @@ wc2e6:: ds 4 wc2ea:: ds 1 wMovementPointer:: ds 2 ; c2eb ds 3 -wc2f0:: ds 1 -wc2f1:: ds 1 -wc2f2:: ds 1 -wc2f3:: ds 1 -wc2f4:: ds 1 -wc2f5:: ds 1 -wc2f6:: ds 1 -wc2f7:: ds 1 -wc2f8:: ds 1 + +wTempObjectCopyMapObjectIndex:: ds 1 ; c2f0 +wTempObjectCopySprite:: ds 1 ; c2f1 +wTempObjectCopySpriteVTile:: ds 1 ; c2f2 +wTempObjectCopyPalette:: ds 1 ; c2f3 +wTempObjectCopyMovement:: ds 1 ; c2f4 +wTempObjectCopyRange:: ds 1 ; c2f5 +wTempObjectCopyX:: ds 1 ; c2f6 +wTempObjectCopyY:: ds 1 ; c2f7 +wTempObjectCopyRadius:: ds 1 ; c2f8 + ds 1 TileDown:: ; c2fa @@ -1743,7 +1745,7 @@ wd152:: ds 1 wBGMapAnchorHi:: wd153:: ds 1 -UsedSprites:: ds 64 +UsedSprites:: ds 64 ; d154 UsedSpritesEnd:: ds UsedSprites - @ @@ -2222,11 +2224,11 @@ object_struct: MACRO \1Object12:: ds 1 \1Facing:: ds 1 \1StandingTile:: ds 1 ; collision -\1NextTile:: ds 1 ; collision -\1MapX:: ds 1 -\1MapY:: ds 1 +\1CurTile:: ds 1 ; collision \1NextMapX:: ds 1 \1NextMapY:: ds 1 +\1MapX:: ds 1 +\1MapY:: ds 1 ds 3 \1SpriteX:: ds 1 \1SpriteY:: ds 1 @@ -2548,8 +2550,8 @@ wCurrentCaller:: ds 2 wCurrMapWarpCount:: ds 1 wCurrMapWarpHeaderPointer:: ds 1 wdbfd:: ds 1 -wCurrentMapXYTriggerCount:: ds 1 -wCurrentMapXYTriggerHeaderPointer:: ds 1 +wCurrentNextMapXYTriggerCount:: ds 1 +wCurrentNextMapXYTriggerHeaderPointer:: ds 1 wdc00:: ds 1 wCurrentMapSignpostCount:: ds 1 wCurrentMapSignpostHeaderPointer::