ref: b921226aea7e624655f0d32436638ea3ffd63419
parent: ed44de4bb4688f6b8c83aeb4f5fd8658d17615fb
author: PikalaxALT <PikalaxALT@gmail.com>
date: Sat Nov 14 18:02:38 EST 2015
More map object, swap StandingTile and NextTile
--- a/constants/map_constants.asm
+++ b/constants/map_constants.asm
@@ -527,13 +527,13 @@
const OBJECT_PALETTE
const OBJECT_DIRECTION_WALKING
const OBJECT_FACING
- const OBJECT_09
+ const OBJECT_STEP_TYPE
const OBJECT_STEP_DURATION
const OBJECT_ACTION
const OBJECT_12
const OBJECT_FACING_STEP
- const OBJECT_STANDING_TILE
const OBJECT_NEXT_TILE
+ const OBJECT_STANDING_TILE
const OBJECT_NEXT_MAP_X
const OBJECT_NEXT_MAP_Y
const OBJECT_MAP_X
@@ -590,9 +590,9 @@
const EMOTE_BOLT ; 5
const EMOTE_SLEEP ; 6
const EMOTE_FISH ; 7
- const EMOTE_08 ; 8
- const EMOTE_09 ; 9
- const EMOTE_0A ; 10
+ const EMOTE_SHADOW ; 8
+ const EMOTE_ROD ; 9
+ const EMOTE_BOULDER_DUST ; 10
const EMOTE_0B ; 11
EMOTE_MEM EQU -1
--- a/constants/sprite_constants.asm
+++ b/constants/sprite_constants.asm
@@ -268,29 +268,48 @@
MAX_OUTDOOR_SPRITES EQU 23
const_def
- const OBJECT_09_VALUE_00
- 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
- const OBJECT_09_VALUE_07
- const OBJECT_09_VALUE_08
- const OBJECT_09_VALUE_09
- const OBJECT_09_VALUE_0A
- const OBJECT_09_VALUE_0B
- const OBJECT_09_VALUE_0C
- const OBJECT_09_VALUE_0D
- const OBJECT_09_VALUE_0E
- const OBJECT_09_VALUE_0F
- const OBJECT_09_VALUE_10
- const OBJECT_09_VALUE_11
- const OBJECT_09_VALUE_12
- const OBJECT_09_VALUE_13
- const OBJECT_09_VALUE_14
- const OBJECT_09_VALUE_15
- const OBJECT_09_VALUE_16
- const OBJECT_09_VALUE_17
- const OBJECT_09_VALUE_18
- const OBJECT_09_VALUE_19
+ const STEP_TYPE_00
+ const STEP_TYPE_01 ; standing
+ const STEP_TYPE_02 ; walking
+ const STEP_TYPE_03 ; bumping
+ const STEP_TYPE_04
+ const STEP_TYPE_05
+ const STEP_TYPE_06
+ const STEP_TYPE_07
+ const STEP_TYPE_08
+ const STEP_TYPE_09
+ const STEP_TYPE_0A
+ const STEP_TYPE_0B
+ const STEP_TYPE_0C
+ const STEP_TYPE_0D
+ const STEP_TYPE_0E
+ const STEP_TYPE_0F
+ const STEP_TYPE_10
+ const STEP_TYPE_11
+ const STEP_TYPE_12
+ const STEP_TYPE_13
+ const STEP_TYPE_14
+ const STEP_TYPE_15
+ const STEP_TYPE_16
+ const STEP_TYPE_17
+ const STEP_TYPE_18
+ const STEP_TYPE_19
+
+ const_def
+ const PERSON_ACTION_00
+ const PERSON_ACTION_01
+ const PERSON_ACTION_02
+ const PERSON_ACTION_03
+ const PERSON_ACTION_04
+ const PERSON_ACTION_05
+ const PERSON_ACTION_06
+ const PERSON_ACTION_07
+ const PERSON_ACTION_08
+ const PERSON_ACTION_09
+ const PERSON_ACTION_0A
+ const PERSON_ACTION_0B
+ const PERSON_ACTION_0C
+ const PERSON_ACTION_0D
+ const PERSON_ACTION_0E
+ const PERSON_ACTION_0F
+ const PERSON_ACTION_10
--- a/engine/events.asm
+++ b/engine/events.asm
@@ -252,7 +252,7 @@
; 967f4
Function967f4: ; 967f4
- ld a, [wd150]
+ ld a, [wPlayerStepFlags]
bit 5, a
jr z, .events
bit 6, a
@@ -273,7 +273,7 @@
; 96812
Function96812: ; 96812
- ld hl, wd150
+ ld hl, wPlayerStepFlags
bit 6, [hl]
ret z
@@ -396,7 +396,7 @@
ret
.warp_tile
- ld a, [PlayerStandingTile]
+ ld a, [PlayerNextTile]
call CheckPitTile
jr nz, .not_pit
ld a, PLAYEREVENT_FALL
--- a/engine/events_2.asm
+++ b/engine/events_2.asm
@@ -161,7 +161,7 @@
jr nc, .no
.ice_check
- ld a, [PlayerStandingTile]
+ ld a, [PlayerNextTile]
call CheckIceTile
jr z, .no
scf
@@ -235,7 +235,7 @@
; 97d64
TryWildEncounter_BugContest: ; 97d64
- ld a, [PlayerStandingTile]
+ ld a, [PlayerNextTile]
call CheckSuperTallGrassTile
ld b, 40 percent
jr z, .ok
--- a/engine/facings.asm
+++ b/engine/facings.asm
@@ -50,7 +50,7 @@
Facing00:
Facing02:
Facing24:
-Facing26: ; 408b
+Facing26: ; standing down
db 4 ; #
db 0, 0, 0, $00
db 0, 8, 0, $01
@@ -58,7 +58,7 @@
db 8, 8, 2, $03
; 409c
-Facing01: ; 409c
+Facing01: ; walking down 1
db 4 ; #
db 0, 0, 0, $80
db 0, 8, 0, $81
@@ -66,7 +66,7 @@
db 8, 8, 2, $83
; 40ad
-Facing03: ; 40ad
+Facing03: ; walking down 2
db 4 ; #
db 0, 8, X_FLIP, $80
db 0, 0, X_FLIP, $81
@@ -75,7 +75,7 @@
; 40be
Facing04:
-Facing06: ; 40be
+Facing06: ; standing up
db 4 ; #
db 0, 0, 0, $04
db 0, 8, 0, $05
@@ -83,7 +83,7 @@
db 8, 8, 2, $07
; 40cf
-Facing05: ; 40cf
+Facing05: ; walking up 1
db 4 ; #
db 0, 0, 0, $84
db 0, 8, 0, $85
@@ -91,7 +91,7 @@
db 8, 8, 2, $87
; 40e0
-Facing07: ; 40e0
+Facing07: ; walking up 2
db 4 ; #
db 0, 8, X_FLIP, $84
db 0, 0, X_FLIP, $85
@@ -100,7 +100,7 @@
; 40f1
Facing08:
-Facing10: ; 40f1
+Facing10: ; standing left
db 4 ; #
db 0, 0, 0, $08
db 0, 8, 0, $09
@@ -109,7 +109,7 @@
; 4102
Facing12:
-Facing14: ; 4102
+Facing14: ; standing right
db 4 ; #
db 0, 8, X_FLIP, $08
db 0, 0, X_FLIP, $09
@@ -118,7 +118,7 @@
; 4113
Facing09:
-Facing11: ; 4113
+Facing11: ; walking left
db 4 ; #
db 0, 0, 0, $88
db 0, 8, 0, $89
@@ -127,7 +127,7 @@
; 4124
Facing13:
-Facing15: ; 4124
+Facing15: ; walking right
db 4 ; #
db 0, 8, X_FLIP, $88
db 0, 0, X_FLIP, $89
@@ -135,7 +135,7 @@
db 8, 0, 2 | X_FLIP, $8b
; 4135
-Facing16: ; 4135
+Facing16: ; fishing down
db 5 ; #
db 0, 0, 0, $00
db 0, 8, 0, $01
@@ -144,7 +144,7 @@
db 16, 0, 4, $fc
; 414a
-Facing17: ; 414a
+Facing17: ; fishing up
db 5 ; #
db 0, 0, 0, $04
db 0, 8, 0, $05
@@ -153,7 +153,7 @@
db -8, 0, 4, $fc
; 415f
-Facing18: ; 415f
+Facing18: ; fishing left
db 5 ; #
db 0, 0, 0, $08
db 0, 8, 0, $09
@@ -162,7 +162,7 @@
db 5, -8, 4 | X_FLIP, $fd
; 4174
-Facing19: ; 4174
+Facing19: ; fishing right
db 5 ; #
db 0, 8, X_FLIP, $08
db 0, 0, X_FLIP, $09
@@ -171,7 +171,7 @@
db 5, 16, 4, $fd
; 4189
-Facing20: ; 4189
+Facing20: ; emote
db 4 ; #
db 0, 0, 4, $f8
db 0, 8, 4, $f9
@@ -179,13 +179,13 @@
db 8, 8, 4, $fb
; 419a
-Facing21: ; 419a
+Facing21: ; shadow
db 2 ; #
db 0, 0, 4, $fc
db 0, 8, 4 | X_FLIP, $fc
; 41a3
-Facing23: ; 41a3
+Facing23: ; big doll
db 16 ; #
db 0, 0, 0, $00
db 0, 8, 0, $01
@@ -239,7 +239,7 @@
db 24, 16, 0, $0b
; 423f
-Facing28: ; 423f
+Facing28: ; boulder dust 1
db 4 ; #
db 0, 0, 4, $fe
db 0, 8, 4, $fe
@@ -247,7 +247,7 @@
db 8, 8, 4, $fe
; 4250
-Facing29: ; 4250
+Facing29: ; boulder dust 2
db 4 ; #
db 0, 0, 4, $ff
db 0, 8, 4, $ff
--- a/engine/map_objects.asm
+++ b/engine/map_objects.asm
@@ -151,7 +151,7 @@
; 43f3
Function43f3: ; 43f3
- ld hl, OBJECT_09
+ ld hl, OBJECT_STEP_TYPE
add hl, bc
ld a, [hl]
and a
@@ -162,7 +162,7 @@
bit 5, [hl]
jr nz, .bit5
- cp OBJECT_09_VALUE_01
+ cp STEP_TYPE_01
jr z, .one
jr .ok
@@ -175,12 +175,13 @@
.one
call Function47dd
- ld hl, OBJECT_09
+
+ ld hl, OBJECT_STEP_TYPE
add hl, bc
ld a, [hl]
and a
ret z
- cp OBJECT_09_VALUE_01
+ cp STEP_TYPE_01
ret z
.ok
@@ -242,40 +243,23 @@
; 445f
Pointers445f: ; 445f
- dw Function44a3 ; 00
- 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)
+ dw Function44a3, Function44a3 ; 00
+ dw Function44b5, Function44aa ; 01
+ dw Function44c1, Function44aa ; 02
+ dw Function4508, Function44aa ; 03
+ dw Function4529, Function44aa ; 04
+ dw Function4539, Function44a3 ; 05
+ dw Function456e, Function456e ; 06
+ dw Function457b, Function44a3 ; 07
+ dw Function4582, Function4582 ; 08
+ dw Function4589, Function4589 ; 09
+ dw Function4590, Function45a4 ; 0a
+ dw Function45ab, Function44aa ; 0c
+ dw Function45be, Function45be ; 0b
+ dw Function45c5, Function45c5 ; 0d
+ dw Function45da, Function44a3 ; 0e
+ dw Function45ed, Function44a3 ; 0f
+ dw Function44e4, Function44aa ; 10
; 44a3
Function44a3: ; 44a3
@@ -571,15 +555,15 @@
add hl, bc
ld [hl], a
- ld hl, OBJECT_STANDING_TILE
+ ld hl, OBJECT_NEXT_TILE
add hl, bc
ld a, [hl]
- ld hl, OBJECT_NEXT_TILE
+ ld hl, OBJECT_STANDING_TILE
add hl, bc
ld [hl], a
call Function4661
- ld hl, OBJECT_STANDING_TILE
+ ld hl, OBJECT_NEXT_TILE
add hl, bc
ld a, [hl]
@@ -611,18 +595,18 @@
add hl, bc
bit 3, [hl]
jr z, .ok
- ld hl, OBJECT_STANDING_TILE
+ ld hl, OBJECT_NEXT_TILE
add hl, bc
ld a, [hl]
call Function4661
.ok
- ld hl, OBJECT_STANDING_TILE
+ ld hl, OBJECT_NEXT_TILE
add hl, bc
ld a, [hl]
call Function4679
ret c
- ld hl, OBJECT_NEXT_TILE
+ ld hl, OBJECT_STANDING_TILE
add hl, bc
ld a, [hl]
call Function4679
@@ -677,7 +661,7 @@
ld hl, OBJECT_FLAGS1
add hl, bc
bit FIXED_FACING, [hl]
- jr nz, GetCurTile
+ jr nz, GetStandingTile
rept 2
add a
@@ -686,7 +670,7 @@
ld hl, OBJECT_FACING
add hl, bc
ld [hl], a
-GetCurTile: ; 46a6
+GetStandingTile: ; 46a6
call GetStepVector
@@ -718,7 +702,7 @@
call GetCoordTile
pop bc
- ld hl, OBJECT_STANDING_TILE
+ ld hl, OBJECT_NEXT_TILE
add hl, bc
ld [hl], a
@@ -801,15 +785,15 @@
add hl, bc
ld a, [hl]
and %00000011
- ld [wd151], a
+ ld [wPlayerStepDirection], a
call AddStepVector
- ld a, [wd14e]
+ ld a, [wPlayerStepVectorX]
add d
- ld [wd14e], a
- ld a, [wd14f]
+ ld [wPlayerStepVectorX], a
+ ld a, [wPlayerStepVectorY]
add e
- ld [wd14f], a
- ld hl, wd150
+ ld [wPlayerStepVectorY], a
+ ld hl, wPlayerStepFlags
set 5, [hl]
ret
; 4759
@@ -925,14 +909,14 @@
push bc
call GetCoordTile
pop bc
- ld hl, OBJECT_STANDING_TILE
+ ld hl, OBJECT_NEXT_TILE
add hl, bc
ld [hl], a
call Function4600
call Function467b
- ld hl, OBJECT_09
+ ld hl, OBJECT_STEP_TYPE
add hl, bc
- ld [hl], OBJECT_09_VALUE_01
+ ld [hl], STEP_TYPE_01
ret
; 47dd
@@ -965,15 +949,15 @@
dw .Script ; 10
dw .Strength ; 11
dw .FollowNotExact ; 12
- dw .Movement13 ; 13
- dw .Movement14 ; 14
+ dw .MovementShadow ; 13
+ dw .MovementEmote ; 14
dw .MovementBigStanding ; 15
dw .MovementBouncing ; 16
- dw .Movement17 ; 17
+ dw .MovementScreenShake ; 17
dw .MovementSpinClockwise ; 18
dw .MovementSpinCounterclockwise ; 19
- dw .Movement1a ; 1a
- dw .Movement1b ; 1b
+ dw .MovementBoulderDust ; 1a
+ dw .MovementShakingGrass ; 1b
; 4821
.Null_00: ; 4821
@@ -1035,10 +1019,10 @@
call Function467b
ld hl, OBJECT_ACTION
add hl, bc
- ld [hl], 1
- ld hl, OBJECT_09
+ ld [hl], PERSON_ACTION_01
+ ld hl, OBJECT_STEP_TYPE
add hl, bc
- ld [hl], OBJECT_09_VALUE_05
+ ld [hl], STEP_TYPE_05
ret
; 487c
@@ -1095,7 +1079,7 @@
; 48b3
.Strength_Start: ; 48b3
- ld hl, OBJECT_STANDING_TILE
+ ld hl, OBJECT_NEXT_TILE
add hl, bc
ld a, [hl]
call CheckPitTile
@@ -1120,9 +1104,9 @@
call PlaySFX
call SpawnStrengthBoulderDust
call Function463f
- ld hl, OBJECT_09
+ ld hl, OBJECT_STEP_TYPE
add hl, bc
- ld [hl], OBJECT_09_VALUE_0F
+ ld [hl], STEP_TYPE_0F
ret
.ok2
@@ -1210,7 +1194,7 @@
ld [hl], STANDING
ld hl, OBJECT_ACTION
add hl, bc
- ld [hl], 1
+ ld [hl], PERSON_ACTION_01
ret
; 4958
@@ -1221,10 +1205,10 @@
ld [hl], STANDING
ld hl, OBJECT_ACTION
add hl, bc
- ld [hl], 9
- ld hl, OBJECT_09
+ ld [hl], PERSON_ACTION_09
+ ld hl, OBJECT_STEP_TYPE
add hl, bc
- ld [hl], OBJECT_09_VALUE_04
+ ld [hl], STEP_TYPE_04
ret
; 496e
@@ -1235,10 +1219,10 @@
ld [hl], STANDING
ld hl, OBJECT_ACTION
add hl, bc
- ld [hl], 10
- ld hl, OBJECT_09
+ ld [hl], PERSON_ACTION_0A
+ ld hl, OBJECT_STEP_TYPE
add hl, bc
- ld [hl], OBJECT_09_VALUE_04
+ ld [hl], STEP_TYPE_04
ret
; 4984
@@ -1265,17 +1249,17 @@
.MovementSpinRepeat: ; 499c
ld hl, OBJECT_ACTION
add hl, bc
- ld [hl], 1
+ ld [hl], PERSON_ACTION_01
ld hl, OBJECT_RANGE
add hl, bc
ld a, [hl]
- ld a, 16
+ ld a, $10
ld hl, OBJECT_STEP_DURATION
add hl, bc
ld [hl], a
- ld hl, OBJECT_09
+ ld hl, OBJECT_STEP_TYPE
add hl, bc
- ld [hl], OBJECT_09_VALUE_03
+ ld [hl], STEP_TYPE_03
call IncrementObjectMovementByteIndex
ret
; 49b8
@@ -1318,11 +1302,11 @@
ret
; 49e5
-.Movement13: ; 49e5
- call ._Movement13_14_1a_1b
+.MovementShadow: ; 49e5
+ call ._MovementShadow_14_1a_1b
ld hl, OBJECT_ACTION
add hl, bc
- ld [hl], $7
+ ld [hl], PERSON_ACTION_07
ld hl, OBJECT_STEP_DURATION
add hl, de
ld a, [hl]
@@ -1350,39 +1334,39 @@
ld hl, OBJECT_SPRITE_X_OFFSET
add hl, bc
ld [hl], 0
- ld hl, OBJECT_09
+ ld hl, OBJECT_STEP_TYPE
add hl, bc
- ld [hl], OBJECT_09_VALUE_13
+ ld [hl], STEP_TYPE_13
ret
; 4a21
-.Movement14: ; 4a21
+.MovementEmote: ; 4a21
call Function467b
- call ._Movement13_14_1a_1b
+ call ._MovementShadow_14_1a_1b
ld hl, OBJECT_ACTION
add hl, bc
- ld [hl], 8
+ ld [hl], PERSON_ACTION_08
ld hl, OBJECT_STEP_DURATION
add hl, bc
ld [hl], 0
ld hl, OBJECT_SPRITE_Y_OFFSET
add hl, bc
- ld [hl], $f0
+ ld [hl], -$10
ld hl, OBJECT_SPRITE_X_OFFSET
add hl, bc
ld [hl], 0
- ld hl, OBJECT_09
+ ld hl, OBJECT_STEP_TYPE
add hl, bc
- ld [hl], OBJECT_09_VALUE_13
+ ld [hl], STEP_TYPE_13
ret
; 4a46
-.Movement1a: ; 4a46
+.MovementBoulderDust: ; 4a46
call Function467b
- call ._Movement13_14_1a_1b
+ call ._MovementShadow_14_1a_1b
ld hl, OBJECT_ACTION
add hl, bc
- ld [hl], $e
+ ld [hl], PERSON_ACTION_0E
ld hl, OBJECT_STEP_DURATION
add hl, de
ld a, [hl]
@@ -1410,9 +1394,9 @@
ld hl, OBJECT_SPRITE_Y_OFFSET
add hl, bc
ld [hl], e
- ld hl, OBJECT_09
+ ld hl, OBJECT_STEP_TYPE
add hl, bc
- ld [hl], OBJECT_09_VALUE_13
+ ld [hl], STEP_TYPE_13
ret
; 4a81
@@ -1424,12 +1408,12 @@
db -6, 2
; 4a89
-.Movement1b: ; 4a89
+.MovementShakingGrass: ; 4a89
call Function467b
- call ._Movement13_14_1a_1b
+ call ._MovementShadow_14_1a_1b
ld hl, OBJECT_ACTION
add hl, bc
- ld [hl], $f
+ ld [hl], PERSON_ACTION_0F
ld hl, OBJECT_STEP_DURATION
add hl, de
ld a, [hl]
@@ -1437,13 +1421,13 @@
ld hl, OBJECT_STEP_DURATION
add hl, bc
ld [hl], a
- ld hl, OBJECT_09
+ ld hl, OBJECT_STEP_TYPE
add hl, bc
- ld [hl], OBJECT_09_VALUE_13
+ ld [hl], STEP_TYPE_13
ret
; 4aa8
-._Movement13_14_1a_1b: ; 4aa8
+._MovementShadow_14_1a_1b: ; 4aa8
ld hl, OBJECT_RANGE
add hl, bc
ld a, [hl]
@@ -1460,15 +1444,15 @@
ret
; 4abc
-.Movement17: ; 4abc
+.MovementScreenShake: ; 4abc
call Function467b
ld hl, OBJECT_ACTION
add hl, bc
- ld [hl], 0
+ ld [hl], PERSON_ACTION_00
ld hl, OBJECT_RANGE
add hl, bc
ld a, [hl]
- call ._Movement17
+ call ._MovementScreenShake
ld hl, OBJECT_STEP_DURATION
add hl, bc
ld [hl], e
@@ -1475,13 +1459,13 @@
ld hl, OBJECT_30
add hl, bc
ld [hl], a
- ld hl, OBJECT_09
+ ld hl, OBJECT_STEP_TYPE
add hl, bc
- ld [hl], OBJECT_09_VALUE_15
+ ld [hl], STEP_TYPE_15
ret
; 4ade
-._Movement17: ; 4ade
+._MovementScreenShake: ; 4ade
ld d, a
and %00111111
ld e, a
@@ -1506,20 +1490,20 @@
call Function463f
ld hl, OBJECT_ACTION
add hl, bc
- ld [hl], 2
+ ld [hl], PERSON_ACTION_02
ld hl, wd4cf
ld a, [hMapObjectIndexBuffer]
cp [hl]
jr z, .load_6
- ld hl, OBJECT_09
+ ld hl, OBJECT_STEP_TYPE
add hl, bc
- ld [hl], OBJECT_09_VALUE_07
+ ld [hl], STEP_TYPE_07
ret
.load_6
- ld hl, OBJECT_09
+ ld hl, OBJECT_STEP_TYPE
add hl, bc
- ld [hl], OBJECT_09_VALUE_06
+ ld [hl], STEP_TYPE_06
ret
Function4b17: ; 4b17
@@ -1551,15 +1535,15 @@
ld [hl], STANDING
ld hl, OBJECT_ACTION
add hl, bc
- ld [hl], 1
- ld hl, OBJECT_09
+ ld [hl], PERSON_ACTION_01
+ ld hl, OBJECT_STEP_TYPE
add hl, bc
- ld [hl], OBJECT_09_VALUE_03
+ ld [hl], STEP_TYPE_03
ret
; 4b45
Pointers4b45: ; 4b45
-; These pointers use OBJECT_09. See constants/sprite_constants.asm
+; These pointers use OBJECT_STEP_TYPE. See constants/sprite_constants.asm
dw Function47bc ; 00
dw Function47dd ; 01
dw Function4e2b ; 02
@@ -1593,9 +1577,9 @@
add hl, bc
dec [hl]
ret nz
- ld hl, OBJECT_09
+ ld hl, OBJECT_STEP_TYPE
add hl, bc
- ld [hl], OBJECT_09_VALUE_01
+ ld [hl], STEP_TYPE_01
ret
; 4b86
@@ -1614,7 +1598,7 @@
dec [hl]
ret nz
call Function4600
- call GetCurTile
+ call GetStandingTile
ld hl, OBJECT_FLAGS2
add hl, bc
res 3, [hl]
@@ -1630,9 +1614,9 @@
dec [hl]
ret nz
call Function4600
- ld hl, OBJECT_09
+ ld hl, OBJECT_STEP_TYPE
add hl, bc
- ld [hl], OBJECT_09_VALUE_01
+ ld [hl], STEP_TYPE_01
ret
; 4bbf
@@ -1646,7 +1630,7 @@
; 4bca
Function4bca: ; 4bca
- ld hl, wd150
+ ld hl, wPlayerStepFlags
set 7, [hl]
call IncrementObjectStructField28
; fallthrough
@@ -1663,7 +1647,7 @@
ld hl, OBJECT_FLAGS2
add hl, bc
res 3, [hl]
- ld hl, wd150
+ ld hl, wPlayerStepFlags
set 6, [hl]
set 4, [hl]
call IncrementObjectStructField28
@@ -1671,8 +1655,8 @@
; 4bf2
Function4bf2: ; 4bf2
- call GetCurTile
- ld hl, wd150
+ call GetStandingTile
+ ld hl, wPlayerStepFlags
set 7, [hl]
call IncrementObjectStructField28
; fallthrough
@@ -1685,12 +1669,12 @@
add hl, bc
dec [hl]
ret nz
- ld hl, wd150
+ ld hl, wPlayerStepFlags
set 6, [hl]
call Function4600
- ld hl, OBJECT_09
+ ld hl, OBJECT_STEP_TYPE
add hl, bc
- ld [hl], OBJECT_09_VALUE_01
+ ld [hl], STEP_TYPE_01
ret
; 4c18
@@ -1717,7 +1701,7 @@
Function4c32: ; 4c32
ld hl, OBJECT_ACTION
add hl, bc
- ld [hl], 4
+ ld [hl], PERSON_ACTION_04
ld hl, OBJECT_STEP_DURATION
add hl, bc
dec [hl]
@@ -1746,7 +1730,7 @@
Function4c5d: ; 4c5d
ld hl, OBJECT_ACTION
add hl, bc
- ld [hl], 4
+ ld [hl], PERSON_ACTION_04
ld hl, OBJECT_31
add hl, bc
inc [hl]
@@ -1765,9 +1749,9 @@
ld hl, OBJECT_12
add hl, bc
ld [hl], 0
- ld hl, OBJECT_09
+ ld hl, OBJECT_STEP_TYPE
add hl, bc
- ld [hl], OBJECT_09_VALUE_01
+ ld [hl], STEP_TYPE_01
ret
; 4c89
@@ -1786,7 +1770,7 @@
Function4c9a: ; 4c9a
ld hl, OBJECT_ACTION
add hl, bc
- ld [hl], 0
+ ld [hl], PERSON_ACTION_00
ld hl, OBJECT_STEP_DURATION
add hl, bc
ld [hl], $10
@@ -1820,7 +1804,7 @@
Function4cc9: ; 4cc9
ld hl, OBJECT_ACTION
add hl, bc
- ld [hl], 4
+ ld [hl], PERSON_ACTION_04
ld hl, OBJECT_31
add hl, bc
inc [hl]
@@ -1851,7 +1835,7 @@
Function4cf5: ; 4cf5
ld hl, OBJECT_ACTION
add hl, bc
- ld [hl], 4
+ ld [hl], PERSON_ACTION_04
ld hl, OBJECT_STEP_DURATION
add hl, bc
dec [hl]
@@ -1865,9 +1849,9 @@
ld hl, OBJECT_SPRITE_Y_OFFSET
add hl, bc
ld [hl], 0
- ld hl, OBJECT_09
+ ld hl, OBJECT_STEP_TYPE
add hl, bc
- ld [hl], OBJECT_09_VALUE_01
+ ld [hl], STEP_TYPE_01
ret
; 4d14
@@ -1883,7 +1867,7 @@
Function4d1f: ; 4d1f
ld hl, OBJECT_ACTION
add hl, bc
- ld [hl], 0
+ ld [hl], PERSON_ACTION_00
ld hl, OBJECT_STEP_DURATION
add hl, bc
ld [hl], $10
@@ -1898,7 +1882,7 @@
ret nz
ld hl, OBJECT_ACTION
add hl, bc
- ld [hl], 2
+ ld [hl], PERSON_ACTION_02
ld hl, OBJECT_12
add hl, bc
ld [hl], 0
@@ -1939,9 +1923,9 @@
ld hl, OBJECT_SPRITE_Y_OFFSET
add hl, bc
ld [hl], 0
- ld hl, OBJECT_09
+ ld hl, OBJECT_STEP_TYPE
add hl, bc
- ld [hl], OBJECT_09_VALUE_01
+ ld [hl], STEP_TYPE_01
ret
; 4d7e
@@ -1976,9 +1960,9 @@
ld hl, OBJECT_SPRITE_Y_OFFSET
add hl, bc
ld [hl], 0
- ld hl, OBJECT_09
+ ld hl, OBJECT_STEP_TYPE
add hl, bc
- ld [hl], OBJECT_09_VALUE_01
+ ld [hl], STEP_TYPE_01
ret
; 4daf
@@ -1992,9 +1976,9 @@
add hl, bc
ld a, [hl]
and %00000001
- ld a, 1
+ ld a, PERSON_ACTION_01
jr z, .yes
- ld a, 0
+ ld a, PERSON_ACTION_00
.yes
ld hl, OBJECT_ACTION
@@ -2008,9 +1992,9 @@
add hl, bc
ld a, [hl]
and %00000001
- ld a, 4
+ ld a, PERSON_ACTION_04
jr z, .yes
- ld a, 5
+ ld a, PERSON_ACTION_05
.yes
ld hl, OBJECT_ACTION
@@ -2027,9 +2011,9 @@
add hl, bc
dec [hl]
ret nz
- ld hl, OBJECT_09
+ ld hl, OBJECT_STEP_TYPE
add hl, bc
- ld [hl], OBJECT_09_VALUE_01
+ ld [hl], STEP_TYPE_01
ret
; 4df0
@@ -2049,9 +2033,9 @@
add hl, bc
dec [hl]
ret nz
- ld hl, OBJECT_09
+ ld hl, OBJECT_STEP_TYPE
add hl, bc
- ld [hl], OBJECT_09_VALUE_01
+ ld [hl], STEP_TYPE_01
ret
; 4e0c
@@ -2091,9 +2075,9 @@
ld hl, OBJECT_DIRECTION_WALKING
add hl, bc
ld [hl], STANDING
- ld hl, OBJECT_09
+ ld hl, OBJECT_STEP_TYPE
add hl, bc
- ld [hl], OBJECT_09_VALUE_01
+ ld [hl], STEP_TYPE_01
ret
; 4e47
@@ -2116,7 +2100,7 @@
; 4e5d
Function4e5d: ; 4e5d
- ld hl, wd150
+ ld hl, wPlayerStepFlags
set 7, [hl]
call IncrementObjectStructField28
; fallthrough
@@ -2129,15 +2113,15 @@
dec [hl]
ret nz
- ld hl, wd150
+ ld hl, wPlayerStepFlags
set 6, [hl]
call Function4600
ld hl, OBJECT_DIRECTION_WALKING
add hl, bc
ld [hl], STANDING
- ld hl, OBJECT_09
+ ld hl, OBJECT_STEP_TYPE
add hl, bc
- ld [hl], OBJECT_09_VALUE_01
+ ld [hl], STEP_TYPE_01
ret
; 4e83
@@ -2193,9 +2177,9 @@
add hl, bc
dec [hl]
ret nz
- ld hl, OBJECT_09
+ ld hl, OBJECT_STEP_TYPE
add hl, bc
- ld [hl], OBJECT_09_VALUE_01
+ ld [hl], STEP_TYPE_01
ret
; 4ecd
@@ -2225,9 +2209,9 @@
ld hl, OBJECT_DIRECTION_WALKING
add hl, bc
ld [hl], STANDING
- ld hl, OBJECT_09
+ ld hl, OBJECT_STEP_TYPE
add hl, bc
- ld [hl], OBJECT_09_VALUE_01
+ ld [hl], STEP_TYPE_01
ret
; 4f04
@@ -2286,9 +2270,9 @@
ld hl, OBJECT_29
add hl, bc
ld d, [hl]
- ld a, [wd14f]
+ ld a, [wPlayerStepVectorY]
sub d
- ld [wd14f], a
+ ld [wPlayerStepVectorY], a
ld hl, OBJECT_STEP_DURATION
add hl, bc
dec [hl]
@@ -2299,9 +2283,9 @@
add hl, bc
ld [hl], a
ld d, a
- ld a, [wd14f]
+ ld a, [wPlayerStepVectorY]
add d
- ld [wd14f], a
+ ld [wPlayerStepVectorY], a
ret
.ok
@@ -2342,10 +2326,10 @@
Function4f8a: ; 4f8a
ld hl, OBJECT_ACTION
add hl, bc
- ld [hl], $10
+ ld [hl], PERSON_ACTION_10
ld hl, OBJECT_STEP_DURATION
add hl, bc
- ld [hl], $10
+ ld [hl], 16
call IncrementObjectStructField28
; 4f99
@@ -2360,9 +2344,9 @@
ld hl, OBJECT_12
add hl, bc
ld [hl], 0
- ld hl, OBJECT_09
+ ld hl, OBJECT_STEP_TYPE
add hl, bc
- ld [hl], OBJECT_09_VALUE_01
+ ld [hl], STEP_TYPE_01
ret
; 4fb2
@@ -2893,7 +2877,7 @@
ld e, [hl]
call GetCoordTile
pop bc
- ld hl, OBJECT_STANDING_TILE
+ ld hl, OBJECT_NEXT_TILE
add hl, bc
ld [hl], a
callba Function463f
@@ -3060,11 +3044,11 @@
Function5771: ; 5771
xor a
- ld [wd14e], a
- ld [wd14f], a
- ld [wd150], a
+ ld [wPlayerStepVectorX], a
+ ld [wPlayerStepVectorY], a
+ ld [wPlayerStepFlags], a
ld a, -1
- ld [wd151], a
+ ld [wPlayerStepDirection], a
ret
; 5781
@@ -3203,9 +3187,9 @@
ld hl, OBJECT_MOVEMENTTYPE
add hl, bc
ld [hl], SPRITEMOVEDATA_FOLLOWING
- ld hl, OBJECT_09
+ ld hl, OBJECT_STEP_TYPE
add hl, bc
- ld [hl], OBJECT_09_VALUE_00
+ ld [hl], STEP_TYPE_00
ld a, [hObjectStructIndexBuffer]
ld [wObjectFollow_Follower], a
ret
@@ -3343,9 +3327,9 @@
add hl, bc
ld [hl], a
- ld hl, OBJECT_09
+ ld hl, OBJECT_STEP_TYPE
add hl, bc
- ld [hl], OBJECT_09_VALUE_00
+ ld [hl], STEP_TYPE_00
ret
; 5903
@@ -3362,9 +3346,9 @@
add hl, bc
ld [hl], a
- ld hl, OBJECT_09
+ ld hl, OBJECT_STEP_TYPE
add hl, bc
- ld [hl], OBJECT_09_VALUE_00
+ ld [hl], STEP_TYPE_00
ret
.standing_movefns
--- a/engine/movement.asm
+++ b/engine/movement.asm
@@ -93,30 +93,30 @@
Movement_teleport_from: ; 5129
- ld hl, OBJECT_09
+ ld hl, OBJECT_STEP_TYPE
add hl, bc
- ld [hl], OBJECT_09_VALUE_0C
+ ld [hl], STEP_TYPE_0C
ret
; 5130
Movement_teleport_to: ; 5130
- ld hl, OBJECT_09
+ ld hl, OBJECT_STEP_TYPE
add hl, bc
- ld [hl], OBJECT_09_VALUE_0D
+ ld [hl], STEP_TYPE_0D
ret
; 5137
Movement_skyfall: ; 5137
- ld hl, OBJECT_09
+ ld hl, OBJECT_STEP_TYPE
add hl, bc
- ld [hl], OBJECT_09_VALUE_0E
+ ld [hl], STEP_TYPE_0E
ret
; 513e
Movement_59: ; 513e
- ld hl, OBJECT_09
+ ld hl, OBJECT_STEP_TYPE
add hl, bc
- ld [hl], OBJECT_09_VALUE_19
+ ld [hl], STEP_TYPE_19
ret
; 5145
@@ -129,14 +129,14 @@
ld [hl], a
ld hl, OBJECT_ACTION
add hl, bc
- ld [hl], $4
+ ld [hl], PERSON_ACTION_04
call GetMovementByte
ld hl, OBJECT_STEP_DURATION
add hl, bc
ld [hl], a
- ld hl, OBJECT_09
+ ld hl, OBJECT_STEP_TYPE
add hl, bc
- ld [hl], OBJECT_09_VALUE_03
+ ld [hl], STEP_TYPE_03
ld hl, OBJECT_DIRECTION_WALKING
add hl, bc
ld [hl], STANDING
@@ -157,9 +157,9 @@
ld hl, OBJECT_DIRECTION_WALKING
add hl, bc
ld [hl], STANDING
- ld hl, OBJECT_09
+ ld hl, OBJECT_STEP_TYPE
add hl, bc
- ld [hl], OBJECT_09_VALUE_12
+ ld [hl], STEP_TYPE_12
ret
; 5189
@@ -166,10 +166,10 @@
Movement_fish_got_bite: ; 5189
ld hl, OBJECT_ACTION
add hl, bc
- ld [hl], $6
- ld hl, OBJECT_09
+ ld [hl], PERSON_ACTION_06
+ ld hl, OBJECT_STEP_TYPE
add hl, bc
- ld [hl], OBJECT_09_VALUE_10
+ ld [hl], STEP_TYPE_10
ret
; 5196
@@ -180,10 +180,10 @@
ld [hl], a
ld hl, OBJECT_ACTION
add hl, bc
- ld [hl], $1
- ld hl, OBJECT_09
+ ld [hl], PERSON_ACTION_01
+ ld hl, OBJECT_STEP_TYPE
add hl, bc
- ld [hl], OBJECT_09_VALUE_11
+ ld [hl], STEP_TYPE_11
ret
; 51ab
@@ -190,10 +190,10 @@
Movement_fish_cast_rod: ; 51ab
ld hl, OBJECT_ACTION
add hl, bc
- ld [hl], $6
- ld hl, OBJECT_09
+ ld [hl], PERSON_ACTION_06
+ ld hl, OBJECT_STEP_TYPE
add hl, bc
- ld [hl], OBJECT_09_VALUE_01
+ ld [hl], STEP_TYPE_01
ret
; 51b8
@@ -217,9 +217,9 @@
ld hl, VramState
res 7, [hl]
- ld hl, OBJECT_09
+ ld hl, OBJECT_STEP_TYPE
add hl, bc
- ld [hl], OBJECT_09_VALUE_01
+ ld [hl], STEP_TYPE_01
ret
; 51db
@@ -238,9 +238,9 @@
add hl, bc
ld [hl], a
- ld hl, OBJECT_09
+ ld hl, OBJECT_STEP_TYPE
add hl, bc
- ld [hl], OBJECT_09_VALUE_03
+ ld [hl], STEP_TYPE_03
ld hl, VramState
res 7, [hl]
@@ -264,11 +264,11 @@
Movement_4b: ; 5210
ld hl, OBJECT_ACTION
add hl, bc
- ld [hl], $1
+ ld [hl], PERSON_ACTION_01
- ld hl, OBJECT_09
+ ld hl, OBJECT_STEP_TYPE
add hl, bc
- ld [hl], OBJECT_09_VALUE_04
+ ld [hl], STEP_TYPE_04
ld hl, VramState
res 7, [hl]
@@ -319,13 +319,13 @@
add hl, bc
ld [hl], a
- ld hl, OBJECT_09
+ ld hl, OBJECT_STEP_TYPE
add hl, bc
- ld [hl], OBJECT_09_VALUE_03
+ ld [hl], STEP_TYPE_03
ld hl, OBJECT_ACTION
add hl, bc
- ld [hl], $1
+ ld [hl], PERSON_ACTION_01
ld hl, OBJECT_DIRECTION_WALKING
add hl, bc
@@ -338,12 +338,12 @@
ld hl, OBJECT_STEP_DURATION
add hl, bc
ld [hl], a
- ld hl, OBJECT_09
+ ld hl, OBJECT_STEP_TYPE
add hl, bc
- ld [hl], OBJECT_09_VALUE_0B
+ ld [hl], STEP_TYPE_0B
ld hl, OBJECT_ACTION
add hl, bc
- ld [hl], $3
+ ld [hl], PERSON_ACTION_03
ld hl, OBJECT_DIRECTION_WALKING
add hl, bc
ld [hl], STANDING
@@ -351,16 +351,19 @@
; 5279
Movement_56: ; 5279
- ld a, $18
+ ld a, 24
ld hl, OBJECT_STEP_DURATION
add hl, bc
ld [hl], a
- ld hl, OBJECT_09
+
+ ld hl, OBJECT_STEP_TYPE
add hl, bc
- ld [hl], OBJECT_09_VALUE_03
+ ld [hl], STEP_TYPE_03
+
ld hl, OBJECT_ACTION
add hl, bc
- ld [hl], $b
+ ld [hl], PERSON_ACTION_0B
+
ld hl, OBJECT_DIRECTION_WALKING
add hl, bc
ld [hl], STANDING
@@ -448,9 +451,11 @@
ld hl, OBJECT_FACING
add hl, bc
ld [hl], a
+
ld hl, OBJECT_ACTION
add hl, bc
- ld [hl], $1
+ ld [hl], PERSON_ACTION_01
+
ld hl, OBJECT_DIRECTION_WALKING
add hl, bc
ld [hl], STANDING
@@ -721,12 +726,14 @@
ld hl, OBJECT_29
add hl, bc
ld [hl], a
+
ld hl, OBJECT_ACTION
add hl, bc
- ld [hl], $2
- ld hl, OBJECT_09
+ ld [hl], PERSON_ACTION_02
+
+ ld hl, OBJECT_STEP_TYPE
add hl, bc
- ld [hl], OBJECT_09_VALUE_0A
+ ld [hl], STEP_TYPE_0A
ret
; 5412
@@ -735,34 +742,35 @@
call Function463f
ld hl, OBJECT_ACTION
add hl, bc
- ld [hl], $2
- ld hl, OBJECT_STANDING_TILE
+ ld [hl], PERSON_ACTION_02
+
+ ld hl, OBJECT_NEXT_TILE
add hl, bc
ld a, [hl]
call CheckSuperTallGrassTile
- jr z, .asm_542d
+ jr z, .shake_grass
call Function1875
- jr c, .asm_5430
+ jr c, .skip_grass
-.asm_542d
+.shake_grass
call ShakeGrass
-.asm_5430
+.skip_grass
ld hl, wd4cf
ld a, [hMapObjectIndexBuffer]
cp [hl]
jr z, .asm_543f
- ld hl, OBJECT_09
+ ld hl, OBJECT_STEP_TYPE
add hl, bc
- ld [hl], OBJECT_09_VALUE_02
+ ld [hl], STEP_TYPE_02
ret
.asm_543f
- ld hl, OBJECT_09
+ ld hl, OBJECT_STEP_TYPE
add hl, bc
- ld [hl], OBJECT_09_VALUE_06
+ ld [hl], STEP_TYPE_06
ret
; 5446
@@ -771,20 +779,20 @@
call Function463f
ld hl, OBJECT_ACTION
add hl, bc
- ld [hl], $4
+ ld [hl], PERSON_ACTION_04
ld hl, wd4cf
ld a, [hMapObjectIndexBuffer]
cp [hl]
jr z, .asm_5461
- ld hl, OBJECT_09
+ ld hl, OBJECT_STEP_TYPE
add hl, bc
- ld [hl], OBJECT_09_VALUE_02
+ ld [hl], STEP_TYPE_02
ret
.asm_5461
- ld hl, OBJECT_09
+ ld hl, OBJECT_STEP_TYPE
add hl, bc
- ld [hl], OBJECT_09_VALUE_06
+ ld [hl], STEP_TYPE_06
ret
; 5468
@@ -794,20 +802,20 @@
call Function463f
ld hl, OBJECT_ACTION
add hl, bc
- ld [hl], $1
+ ld [hl], PERSON_ACTION_01
ld hl, wd4cf
ld a, [hMapObjectIndexBuffer]
cp [hl]
jr z, .asm_5483
- ld hl, OBJECT_09
+ ld hl, OBJECT_STEP_TYPE
add hl, bc
- ld [hl], OBJECT_09_VALUE_02
+ ld [hl], STEP_TYPE_02
ret
.asm_5483
- ld hl, OBJECT_09
+ ld hl, OBJECT_STEP_TYPE
add hl, bc
- ld [hl], OBJECT_09_VALUE_06
+ ld [hl], STEP_TYPE_06
ret
; 548a
@@ -822,20 +830,20 @@
res 3, [hl]
ld hl, OBJECT_ACTION
add hl, bc
- ld [hl], $2
+ ld [hl], PERSON_ACTION_02
call SpawnShadow
ld hl, wd4cf
ld a, [hMapObjectIndexBuffer]
cp [hl]
jr z, .asm_54b1
- ld hl, OBJECT_09
+ ld hl, OBJECT_STEP_TYPE
add hl, bc
- ld [hl], OBJECT_09_VALUE_08
+ ld [hl], STEP_TYPE_08
ret
.asm_54b1
- ld hl, OBJECT_09
+ ld hl, OBJECT_STEP_TYPE
add hl, bc
- ld [hl], OBJECT_09_VALUE_09
+ ld [hl], STEP_TYPE_09
ret
; 54b8
--- a/engine/overworld.asm
+++ b/engine/overworld.asm
@@ -13,11 +13,11 @@
ld [hUsedSpriteIndex], a
ld a, [UsedSprites + 1]
ld [hUsedSpriteTile], a
- call Function143c8
+ call GetUsedSprite
ret
; 14146
-Function14146: ; 14146
+Function14146: ; mobile
ld hl, wSpriteFlags
ld a, [hl]
push af
@@ -29,7 +29,7 @@
ret
; 14157
-Function14157: ; 14157
+Function14157: ; mobile
ld hl, wSpriteFlags
ld a, [hl]
push af
@@ -168,23 +168,23 @@
RunCallback_04: ; 14209
ld a, $4
call RunMapCallback
- call Function1439b
- call Function14215
+ call GetUsedSprites
+ call .LoadMiscTiles
ret
; 14215
-Function14215: ; 14215
+.LoadMiscTiles: ; 14215
ld a, [wSpriteFlags]
bit 6, a
ret nz
- ld c, EMOTE_08
+
+ ld c, EMOTE_SHADOW
callba LoadEmote
call GetMapPermission
call CheckOutdoorMap
ld c, EMOTE_0B
jr z, .outdoor
- ld c, EMOTE_0A
-
+ ld c, EMOTE_BOULDER_DUST
.outdoor
callba LoadEmote
ret
@@ -575,29 +575,34 @@
; 1439b
-Function1439b: ; 1439b
+GetUsedSprites: ; 1439b
ld hl, UsedSprites
ld c, SPRITE_GFX_LIST_CAPACITY
+
.loop
ld a, [wSpriteFlags]
res 5, a
ld [wSpriteFlags], a
+
ld a, [hli]
and a
jr z, .done
ld [hUsedSpriteIndex], a
+
ld a, [hli]
ld [hUsedSpriteTile], a
+
bit 7, a
jr z, .dont_set
+
ld a, [wSpriteFlags]
- set 5, a
+ set 5, a ; load VBank0
ld [wSpriteFlags], a
.dont_set
push bc
push hl
- call Function143c8
+ call GetUsedSprite
pop hl
pop bc
dec c
@@ -607,7 +612,7 @@
ret
; 143c8
-Function143c8: ; 143c8
+GetUsedSprite: ; 143c8
ld a, [hUsedSpriteIndex]
call SafeGetSprite
ld a, [hUsedSpriteTile]
@@ -632,14 +637,17 @@
ld d, h
ld e, l
pop hl
+
ld a, [wSpriteFlags]
bit 5, a
jr nz, .done
bit 6, a
jr nz, .done
+
ld a, [hUsedSpriteIndex]
call _DoesSpriteHaveFacings
jr c, .done
+
ld a, h
add $8
ld h, a
@@ -716,7 +724,7 @@
emote_header: MACRO
dw \1
db \2 tiles, BANK(\1)
- dw \3
+ dw VTiles1 tile \3
ENDM
EmotesPointers: ; 144d
@@ -724,18 +732,18 @@
; db length, bank
; dw dest address
- emote_header ShockEmote, 4, VTiles1 tile $78
- emote_header QuestionEmote, 4, VTiles1 tile $78
- emote_header HappyEmote, 4, VTiles1 tile $78
- emote_header SadEmote, 4, VTiles1 tile $78
- emote_header HeartEmote, 4, VTiles1 tile $78
- emote_header BoltEmote, 4, VTiles1 tile $78
- emote_header SleepEmote, 4, VTiles1 tile $78
- emote_header FishEmote, 4, VTiles1 tile $78
- emote_header JumpShadowGFX, 1, VTiles1 tile $7c
- emote_header FishingRodGFX2, 2, VTiles1 tile $7c
- emote_header BoulderDustGFX, 2, VTiles1 tile $7e
- emote_header FishingRodGFX4, 1, VTiles1 tile $7e
+ emote_header ShockEmote, 4, $78
+ emote_header QuestionEmote, 4, $78
+ emote_header HappyEmote, 4, $78
+ emote_header SadEmote, 4, $78
+ emote_header HeartEmote, 4, $78
+ emote_header BoltEmote, 4, $78
+ emote_header SleepEmote, 4, $78
+ emote_header FishEmote, 4, $78
+ emote_header JumpShadowGFX, 1, $7c
+ emote_header FishingRodGFX2, 2, $7c
+ emote_header BoulderDustGFX, 2, $7e
+ emote_header FishingRodGFX4, 1, $7e
; 14495
--- a/home/map.asm
+++ b/home/map.asm
@@ -1238,9 +1238,9 @@
call BackupBGMapRow
ld c, 2 * SCREEN_WIDTH
call FarCallScrollBGMapPalettes
- ld a, [wBGMapAnchorLo]
+ ld a, [wBGMapAnchor]
ld e, a
- ld a, [wBGMapAnchorHi]
+ ld a, [wBGMapAnchor + 1]
ld d, a
call UpdateBGMapRow
ld a, $1
@@ -1254,9 +1254,9 @@
call BackupBGMapRow
ld c, 2 * SCREEN_WIDTH
call FarCallScrollBGMapPalettes
- ld a, [wBGMapAnchorLo]
+ ld a, [wBGMapAnchor]
ld l, a
- ld a, [wBGMapAnchorHi]
+ ld a, [wBGMapAnchor + 1]
ld h, a
ld bc, $0200
add hl, bc
@@ -1278,9 +1278,9 @@
call BackupBGMapColumn
ld c, 2 * SCREEN_HEIGHT
call FarCallScrollBGMapPalettes
- ld a, [wBGMapAnchorLo]
+ ld a, [wBGMapAnchor]
ld e, a
- ld a, [wBGMapAnchorHi]
+ ld a, [wBGMapAnchor + 1]
ld d, a
call UpdateBGMapColumn
ld a, $1
@@ -1294,7 +1294,7 @@
call BackupBGMapColumn
ld c, 2 * SCREEN_HEIGHT
call FarCallScrollBGMapPalettes
- ld a, [wBGMapAnchorLo]
+ ld a, [wBGMapAnchor]
ld e, a
and %11100000
ld b, a
@@ -1303,7 +1303,7 @@
and %00011111
or b
ld e, a
- ld a, [wBGMapAnchorHi]
+ ld a, [wBGMapAnchor + 1]
ld d, a
call UpdateBGMapColumn
ld a, $1
@@ -1505,7 +1505,7 @@
ld a, [MapWidth]
add $6
ld [hMapObjectIndexBuffer], a
- ld a, [wd151]
+ ld a, [wPlayerStepDirection]
and a
jr z, .down
cp UP
@@ -1599,11 +1599,11 @@
ld a, [PlayerNextMapY]
ld e, a
call GetCoordTile
- ld [PlayerStandingTile], a
+ ld [PlayerNextTile], a
call Function29ff
ret nz
- ld a, [PlayerStandingTile]
+ ld a, [PlayerNextTile]
and 7
ld hl, .data_2945
add l
--- a/home/map_objects.asm
+++ b/home/map_objects.asm
@@ -80,7 +80,7 @@
Function184a:: ; 184a
- ld a, [PlayerStandingTile]
+ ld a, [PlayerNextTile]
call GetTileCollision
ld b, a
ret
@@ -87,7 +87,7 @@
; 1852
CheckOnWater:: ; 1852
- ld a, [PlayerStandingTile]
+ ld a, [PlayerNextTile]
call GetTileCollision
sub 1
ret z
@@ -211,7 +211,7 @@
; 18c3
CheckStandingOnEntrance:: ; 18c3
- ld a, [PlayerStandingTile]
+ ld a, [PlayerNextTile]
cp $71 ; door
ret z
cp $79
@@ -447,7 +447,7 @@
add hl, bc
ld [hl], SPRITEMOVEDATA_SCRIPTED
- ld hl, OBJECT_09
+ ld hl, OBJECT_STEP_TYPE
add hl, bc
ld [hl], 0
--- a/main.asm
+++ b/main.asm
@@ -1526,9 +1526,9 @@
ld a, VBGMap0 / $100
call Function64b9
xor a
- ld [wd152], a
- ld a, $98
- ld [wd153], a
+ ld [wBGMapAnchor], a
+ ld a, VBGMap0 / $100
+ ld [wBGMapAnchor + 1], a
xor a
ld [hSCX], a
ld [hSCY], a
@@ -2188,7 +2188,7 @@
add hl, bc
bit 7, [hl]
jp nz, Function6fa1
- ld hl, OBJECT_STANDING_TILE
+ ld hl, OBJECT_NEXT_TILE
add hl, bc
ld a, [hl]
ld d, a
@@ -2202,7 +2202,7 @@
Function6f2c: ; 6f2c
call Function6f5f
ret c
- ld hl, OBJECT_STANDING_TILE
+ ld hl, OBJECT_NEXT_TILE
add hl, bc
ld a, [hl]
call GetTileCollision
@@ -2213,7 +2213,7 @@
; 6f3e
Function6f3e: ; 6f3e
- ld hl, OBJECT_STANDING_TILE
+ ld hl, OBJECT_NEXT_TILE
add hl, bc
ld a, [hl]
call Function6f7f
@@ -2239,7 +2239,7 @@
; 6f5f
Function6f5f: ; 6f5f
- ld hl, OBJECT_NEXT_TILE
+ ld hl, OBJECT_STANDING_TILE
add hl, bc
ld a, [hl]
call Function6f7f
@@ -3488,7 +3488,7 @@
Function81ca:: ; 81ca
nop
- ld a, [wd151]
+ ld a, [wPlayerStepDirection]
cp $ff
ret z
ld hl, .jumptable
@@ -3651,9 +3651,9 @@
add hl, de
ld [hl], a
- ld hl, OBJECT_09
+ ld hl, OBJECT_STEP_TYPE
add hl, de
- ld [hl], OBJECT_09_VALUE_00
+ ld [hl], STEP_TYPE_00
ld hl, OBJECT_FACING_STEP
add hl, de
@@ -3904,9 +3904,9 @@
ld hl, OBJECT_MOVEMENTTYPE
add hl, de
ld [hl], SPRITEMOVEDATA_FOLLOWNOTEXACT
- ld hl, OBJECT_09
+ ld hl, OBJECT_STEP_TYPE
add hl, de
- ld [hl], OBJECT_09_VALUE_00
+ ld [hl], STEP_TYPE_00
ret
; 8417
@@ -5381,7 +5381,7 @@
CheckContinueWaterfall: ; cb38
xor a
ld [ScriptVar], a
- ld a, [PlayerStandingTile]
+ ld a, [PlayerNextTile]
call CheckWaterfallTile
ret z
callba MobileFn_1060c1
@@ -6325,7 +6325,7 @@
writetext UnknownText_0xd0a9
Script_NotEvenANibble_FallThrough: ; 0xd02d
- loademote EMOTE_08
+ loademote EMOTE_SHADOW
callasm PutTheRodAway
loadmovesprites
end
@@ -6396,7 +6396,7 @@
reloadmappart
loadvar hBGMapMode, $0
special UpdateTimePals
- loademote EMOTE_09
+ loademote EMOTE_ROD
callasm LoadFishingGFX
loademote EMOTE_SHOCK
applymovement PLAYER, MovementData_0xd093
@@ -7291,7 +7291,7 @@
Functiond497:: ; d497 (3:5497)
- ld a, [wd150]
+ ld a, [wPlayerStepFlags]
and a
ret z
bit 7, a
@@ -7311,9 +7311,9 @@
jr .asm_d4b8
.asm_d4b8
call Functiond4e5
- ld a, [wd14e]
+ ld a, [wPlayerStepVectorX]
ld d, a
- ld a, [wd14f]
+ ld a, [wPlayerStepVectorY]
ld e, a
ld a, [wd14c]
sub d
@@ -7324,9 +7324,9 @@
ret
Functiond4d2:: ; d4d2 (3:54d2)
- ld a, [wd14e]
+ ld a, [wPlayerStepVectorX]
ld d, a
- ld a, [wd14f]
+ ld a, [wPlayerStepVectorY]
ld e, a
ld a, [hSCX]
add d
@@ -7372,7 +7372,7 @@
ret
Functiond511: ; d511 (3:5511)
- ld a, [wd151]
+ ld a, [wPlayerStepDirection]
and a
jr nz, .asm_d51c
ld hl, YCoord
@@ -7398,7 +7398,7 @@
ret
Functiond536: ; d536 (3:5536)
- ld a, [wd151]
+ ld a, [wPlayerStepDirection]
and a
jr z, .asm_d549
cp $1
@@ -7434,24 +7434,24 @@
ret
Functiond571: ; d571 (3:5571)
- ld a, [wd152]
+ ld a, [wBGMapAnchor]
add $40
- ld [wd152], a
- jr nc, .asm_d586
- ld a, [wd153]
+ ld [wBGMapAnchor], a
+ jr nc, .not_overflowed
+ ld a, [wBGMapAnchor + 1]
inc a
and $3
- or $98
- ld [wd153], a
-.asm_d586
+ or VBGMap0 / $100
+ ld [wBGMapAnchor + 1], a
+.not_overflowed
ld hl, wd196
inc [hl]
ld a, [hl]
- cp $2
- jr nz, .asm_d594
+ cp $2 ; was 1
+ jr nz, .skip
ld [hl], $0
call Functiond595
-.asm_d594
+.skip
ret
Functiond595: ; d595 (3:5595)
@@ -7465,24 +7465,24 @@
ret
Functiond5a2: ; d5a2 (3:55a2)
- ld a, [wd152]
+ ld a, [wBGMapAnchor]
sub $40
- ld [wd152], a
- jr nc, .asm_d5b7
- ld a, [wd153]
+ ld [wBGMapAnchor], a
+ jr nc, .not_underflowed
+ ld a, [wBGMapAnchor + 1]
dec a
and $3
- or $98
- ld [wd153], a
-.asm_d5b7
+ or VBGMap0 / $100
+ ld [wBGMapAnchor + 1], a
+.not_underflowed
ld hl, wd196
dec [hl]
ld a, [hl]
- cp $ff
- jr nz, .asm_d5c5
+ cp $ff ; was 0
+ jr nz, .skip
ld [hl], $1
call Functiond5c6
-.asm_d5c5
+.skip
ret
Functiond5c6: ; d5c6 (3:55c6)
@@ -7498,7 +7498,7 @@
ret
Functiond5d5: ; d5d5 (3:55d5)
- ld a, [wd152]
+ ld a, [wBGMapAnchor]
ld e, a
and $e0
ld d, a
@@ -7506,7 +7506,7 @@
sub $2
and $1f
or d
- ld [wd152], a
+ ld [wBGMapAnchor], a
ld hl, wd197
dec [hl]
ld a, [hl]
@@ -7527,7 +7527,7 @@
ret
Functiond5fe: ; d5fe (3:55fe)
- ld a, [wd152]
+ ld a, [wBGMapAnchor]
ld e, a
and $e0
ld d, a
@@ -7535,7 +7535,7 @@
add $2
and $1f
or d
- ld [wd152], a
+ ld [wBGMapAnchor], a
ld hl, wd197
inc [hl]
ld a, [hl]
@@ -11364,7 +11364,7 @@
INCLUDE "engine/overworld.asm"
Function1499a:: ; 1499a
- ld a, [PlayerStandingTile]
+ ld a, [PlayerNextTile]
cp $60
jr z, .asm_149ad
cp $68
@@ -11381,7 +11381,7 @@
; 149af
Function149af:: ; 149af
- ld a, [PlayerStandingTile]
+ ld a, [PlayerNextTile]
cp $70
jr z, .asm_149c4
cp $76
@@ -11401,7 +11401,7 @@
CheckWarpCollision: ; 149c6
ld de, 1
ld hl, .blocks
- ld a, [PlayerStandingTile]
+ ld a, [PlayerNextTile]
call IsInArray
ret
; 149d3
@@ -11420,7 +11420,7 @@
; 149dd
CheckGrassCollision:: ; 149dd
- ld a, [PlayerStandingTile]
+ ld a, [PlayerNextTile]
ld hl, .blocks
ld de, 1
call IsInArray
@@ -11460,7 +11460,7 @@
; 14a07
Function14a07:: ; 14a07
- ld a, [PlayerStandingTile]
+ ld a, [PlayerNextTile]
ld de, $1f
cp $71 ; door
ret z
@@ -34139,7 +34139,7 @@
; Tiles such as waterfalls and warps move the player
; in a given direction, overriding input.
- ld a, [PlayerStandingTile]
+ ld a, [PlayerNextTile]
ld c, a
call CheckWhirlpoolTile
jr c, .asm_800c4
@@ -34300,7 +34300,7 @@
cp 2
jr z, .bump
- ld a, [PlayerStandingTile]
+ ld a, [PlayerNextTile]
call CheckIceTile
jr nc, .ice
@@ -34387,7 +34387,7 @@
TryJumpLedge: ; 801f3
- ld a, [PlayerStandingTile]
+ ld a, [PlayerNextTile]
ld e, a
and $f0
cp $a0 ; ledge
@@ -34439,7 +34439,7 @@
ld d, 0
ld hl, .EdgeWarps
add hl, de
- ld a, [PlayerStandingTile]
+ ld a, [PlayerNextTile]
cp [hl]
jr nz, .nope
@@ -34647,7 +34647,7 @@
; tile collision pointer
.table1
db STANDING, FACE_CURRENT, 0, 0
- dw PlayerStandingTile
+ dw PlayerNextTile
.table2
db RIGHT, FACE_RIGHT, 1, 0
dw TileRight
@@ -34859,7 +34859,7 @@
jr z, .nope
cp $f0
jr z, .nope
- ld a, [PlayerStandingTile]
+ ld a, [PlayerNextTile]
call CheckIceTile
jr nc, .yep
ld a, [PlayerState]
@@ -50406,23 +50406,23 @@
ret
Function10433a: ; 10433a (41:433a)
- ld b, $4
-.asm_10433c
- ld c, $14
-.asm_10433e
+ ld b, 4
+.outer_loop
+ ld c, 20
+.inner_loop
ld a, [de]
ld [hli], a
inc de
dec c
- jr nz, .asm_10433e
+ jr nz, .inner_loop
ld a, l
- add $c
+ add $20 - 20
ld l, a
ld a, h
adc $0
ld h, a
dec b
- jr nz, .asm_10433c
+ jr nz, .outer_loop
ret
; 104350
@@ -50460,7 +50460,7 @@
EnterMapConnection: ; 1045d6
; Return carry if a connection has been entered.
- ld a, [wd151]
+ ld a, [wPlayerStepDirection]
and a
jp z, EnterSouthConnection
cp 1
@@ -50687,9 +50687,9 @@
Function104770: ; 104770 (41:4770)
ld a, $98
- ld [wd153], a
+ ld [wBGMapAnchor + 1], a
xor a
- ld [wd152], a
+ ld [wBGMapAnchor], a
ld [hSCY], a
ld [hSCX], a
callba Function5958
@@ -50776,7 +50776,7 @@
ret
CheckMovingOffEdgeOfMap:: ; 104820 (41:4820)
- ld a, [wd151]
+ ld a, [wPlayerStepDirection]
cp STANDING
ret z
and a ; DOWN
--- a/misc/mobile_5c.asm
+++ b/misc/mobile_5c.asm
@@ -1297,7 +1297,7 @@
ld [hUsedSpriteIndex], a
ld a, [hl]
ld [hUsedSpriteTile], a
- callba Function143c8
+ callba GetUsedSprite
ret
; 170b90
--- a/tilesets/animations.asm
+++ b/tilesets/animations.asm
@@ -48,7 +48,7 @@
dw NULL, AnimateFlowerTile
dw NULL, WaitTileAnimation
dw NULL, WaitTileAnimation
- dw NULL, CurTileFrame8
+ dw NULL, StandingTileFrame8
dw NULL, DoneTileAnimation
; 0xfc047
@@ -62,7 +62,7 @@
dw NULL, AnimateFlowerTile
dw NULL, WaitTileAnimation
dw NULL, WaitTileAnimation
- dw NULL, CurTileFrame8
+ dw NULL, StandingTileFrame8
dw NULL, DoneTileAnimation
; 0xfc073
@@ -77,7 +77,7 @@
dw NULL, AnimateFlowerTile
dw VTiles2 tile $14, AnimateWaterTile
dw NULL, TileAnimationPalette
- dw NULL, CurTileFrame8
+ dw NULL, StandingTileFrame8
dw NULL, DoneTileAnimation
; 0xfc0a3
@@ -93,7 +93,7 @@
dw WhirlpoolFrames3, AnimateWhirlpoolTile
dw WhirlpoolFrames4, AnimateWhirlpoolTile
dw NULL, WaitTileAnimation
- dw NULL, CurTileFrame8
+ dw NULL, StandingTileFrame8
dw NULL, DoneTileAnimation
; 0xfc0d7
@@ -136,7 +136,7 @@
dw NULL, WaitTileAnimation
dw NULL, WaitTileAnimation
dw NULL, WaitTileAnimation
- dw NULL, CurTileFrame8
+ dw NULL, StandingTileFrame8
dw NULL, DoneTileAnimation
; 0xfc15f
@@ -147,7 +147,7 @@
dw NULL, WaitTileAnimation
dw NULL, SafariFountainAnim1
dw NULL, WaitTileAnimation
- dw NULL, CurTileFrame8
+ dw NULL, StandingTileFrame8
dw NULL, DoneTileAnimation
; 0xfc17f
@@ -239,7 +239,7 @@
dw SproutPillarTilePointer4, AnimateSproutPillarTile
dw SproutPillarTilePointer1, AnimateSproutPillarTile
dw SproutPillarTilePointer2, AnimateSproutPillarTile
- dw NULL, CurTileFrame
+ dw NULL, StandingTileFrame
dw NULL, WaitTileAnimation
dw NULL, WaitTileAnimation
dw NULL, WaitTileAnimation
@@ -302,7 +302,7 @@
ret
; fc2ff
-CurTileFrame8: ; fc2ff
+StandingTileFrame8: ; fc2ff
ld a, [TileAnimationTimer]
inc a
and a, 7
@@ -806,7 +806,7 @@
; fc673
-CurTileFrame: ; fc673
+StandingTileFrame: ; fc673
ld hl, TileAnimationTimer
inc [hl]
ret
--- a/wram.asm
+++ b/wram.asm
@@ -1735,16 +1735,15 @@
wd14c:: ds 1 ; used in FollowNotExact
wd14d:: ds 1 ; used in FollowNotExact
+
; Player movement
-wd14e:: ds 1
-wd14f:: ds 1
-wd150:: ds 1
-wd151:: ds 1
-wBGMapAnchorLo::
-wd152:: ds 1
-wBGMapAnchorHi::
-wd153:: ds 1
+wPlayerStepVectorX:: ds 1
+wPlayerStepVectorY:: ds 1
+wPlayerStepFlags:: ds 1
+wPlayerStepDirection:: ds 1
+wBGMapAnchor:: ds 2
+
UsedSprites:: ds 64 ; d154
UsedSpritesEnd::
ds UsedSprites - @
@@ -2218,13 +2217,13 @@
\1Palette:: ds 1
\1Walking:: ds 1
\1Direction:: ds 1
-\1Object09:: ds 1
+\1StepType:: ds 1
\1StepDuration:: ds 1
\1Action:: ds 1
\1Object12:: ds 1
\1Facing:: ds 1
-\1StandingTile:: ds 1 ; collision
-\1CurTile:: ds 1 ; collision
+\1NextTile:: ds 1 ; collision
+\1StandingTile:: ds 1 ; collision
\1NextMapX:: ds 1
\1NextMapY:: ds 1
\1MapX:: ds 1