2017-12-24 18:46:34 +00:00
|
|
|
ObjectActionPairPointers: ; 445f
|
|
|
|
; entries correspond to OBJECT_ACTION_* constants
|
2017-12-09 05:50:59 +00:00
|
|
|
dw SetFacingStanding, SetFacingStanding
|
|
|
|
dw SetFacingStandAction, SetFacingCurrent
|
|
|
|
dw SetFacingStepAction, SetFacingCurrent
|
|
|
|
dw SetFacingBumpAction, SetFacingCurrent
|
|
|
|
dw SetFacingCounterclockwiseSpin, SetFacingCurrent
|
|
|
|
dw SetFacingCounterclockwiseSpin2, SetFacingStanding
|
|
|
|
dw SetFacingFish, SetFacingFish
|
|
|
|
dw SetFacingShadow, SetFacingStanding
|
|
|
|
dw SetFacingEmote, SetFacingEmote
|
|
|
|
dw SetFacingBigDollSym, SetFacingBigDollSym
|
|
|
|
dw SetFacingBounce, SetFacingFreezeBounce
|
|
|
|
dw SetFacingWeirdTree, SetFacingCurrent
|
|
|
|
dw SetFacingBigDollAsym, SetFacingBigDollAsym
|
|
|
|
dw SetFacingBigDoll, SetFacingBigDoll
|
|
|
|
dw SetFacingBoulderDust, SetFacingStanding
|
|
|
|
dw SetFacingGrassShake, SetFacingStanding
|
|
|
|
dw SetFacingSkyfall, SetFacingCurrent
|
2015-12-29 18:15:58 +00:00
|
|
|
; 44a3
|
|
|
|
|
|
|
|
SetFacingStanding: ; 44a3
|
|
|
|
ld hl, OBJECT_FACING_STEP
|
|
|
|
add hl, bc
|
|
|
|
ld [hl], STANDING
|
|
|
|
ret
|
|
|
|
; 44aa
|
|
|
|
|
|
|
|
SetFacingCurrent: ; 44aa
|
|
|
|
call GetSpriteDirection
|
2016-09-27 14:10:13 +00:00
|
|
|
or FACING_STEP_DOWN_0 ; useless
|
2015-12-29 18:15:58 +00:00
|
|
|
ld hl, OBJECT_FACING_STEP
|
|
|
|
add hl, bc
|
|
|
|
ld [hl], a
|
|
|
|
ret
|
|
|
|
; 44b5
|
|
|
|
|
2016-09-27 13:37:10 +00:00
|
|
|
SetFacingStandAction: ; 44b5
|
2015-12-29 18:15:58 +00:00
|
|
|
ld hl, OBJECT_FACING_STEP
|
|
|
|
add hl, bc
|
|
|
|
ld a, [hl]
|
|
|
|
and 1
|
2016-09-27 13:37:10 +00:00
|
|
|
jr nz, SetFacingStepAction
|
2015-12-29 18:15:58 +00:00
|
|
|
jp SetFacingCurrent
|
|
|
|
; 44c1
|
|
|
|
|
2016-09-27 13:37:10 +00:00
|
|
|
SetFacingStepAction: ; 44c1
|
2015-12-29 18:15:58 +00:00
|
|
|
ld hl, OBJECT_FLAGS1
|
|
|
|
add hl, bc
|
|
|
|
bit SLIDING, [hl]
|
|
|
|
jp nz, SetFacingCurrent
|
|
|
|
|
|
|
|
ld hl, OBJECT_STEP_FRAME
|
|
|
|
add hl, bc
|
|
|
|
ld a, [hl]
|
|
|
|
inc a
|
|
|
|
and %00001111
|
|
|
|
ld [hl], a
|
|
|
|
|
|
|
|
rrca
|
|
|
|
rrca
|
|
|
|
and %00000011
|
|
|
|
ld d, a
|
|
|
|
|
|
|
|
call GetSpriteDirection
|
2016-09-27 14:10:13 +00:00
|
|
|
or FACING_STEP_DOWN_0 ; useless
|
2015-12-29 18:15:58 +00:00
|
|
|
or d
|
|
|
|
ld hl, OBJECT_FACING_STEP
|
|
|
|
add hl, bc
|
|
|
|
ld [hl], a
|
|
|
|
ret
|
|
|
|
; 44e4
|
|
|
|
|
2016-09-27 14:10:13 +00:00
|
|
|
SetFacingSkyfall: ; 44e4
|
2015-12-29 18:15:58 +00:00
|
|
|
ld hl, OBJECT_FLAGS1
|
|
|
|
add hl, bc
|
|
|
|
bit SLIDING, [hl]
|
|
|
|
jp nz, SetFacingCurrent
|
|
|
|
|
|
|
|
ld hl, OBJECT_STEP_FRAME
|
|
|
|
add hl, bc
|
|
|
|
ld a, [hl]
|
|
|
|
add 2
|
|
|
|
and %00001111
|
|
|
|
ld [hl], a
|
|
|
|
|
|
|
|
rrca
|
|
|
|
rrca
|
|
|
|
and %00000011
|
|
|
|
ld d, a
|
|
|
|
|
|
|
|
call GetSpriteDirection
|
2016-09-27 14:10:13 +00:00
|
|
|
or FACING_STEP_DOWN_0 ; useless
|
2015-12-29 18:15:58 +00:00
|
|
|
or d
|
|
|
|
ld hl, OBJECT_FACING_STEP
|
|
|
|
add hl, bc
|
|
|
|
ld [hl], a
|
|
|
|
ret
|
|
|
|
; 4508
|
|
|
|
|
2016-09-27 13:37:10 +00:00
|
|
|
SetFacingBumpAction: ; 4508
|
2015-12-29 18:15:58 +00:00
|
|
|
ld hl, OBJECT_FLAGS1
|
|
|
|
add hl, bc
|
|
|
|
bit SLIDING, [hl]
|
|
|
|
jp nz, SetFacingCurrent
|
|
|
|
|
|
|
|
ld hl, OBJECT_STEP_FRAME
|
|
|
|
add hl, bc
|
|
|
|
inc [hl]
|
|
|
|
|
|
|
|
ld a, [hl]
|
|
|
|
rrca
|
|
|
|
rrca
|
|
|
|
rrca
|
|
|
|
and %00000011
|
|
|
|
ld d, a
|
|
|
|
|
|
|
|
call GetSpriteDirection
|
2016-09-27 14:10:13 +00:00
|
|
|
or FACING_STEP_DOWN_0 ; useless
|
2015-12-29 18:15:58 +00:00
|
|
|
or d
|
|
|
|
ld hl, OBJECT_FACING_STEP
|
|
|
|
add hl, bc
|
|
|
|
ld [hl], a
|
|
|
|
ret
|
|
|
|
; 4529
|
|
|
|
|
2016-09-27 13:37:10 +00:00
|
|
|
SetFacingCounterclockwiseSpin: ; 4529
|
|
|
|
call CounterclockwiseSpinAction
|
2015-12-29 18:15:58 +00:00
|
|
|
ld hl, OBJECT_FACING
|
|
|
|
add hl, bc
|
|
|
|
ld a, [hl]
|
2016-09-27 14:10:13 +00:00
|
|
|
or FACING_STEP_DOWN_0 ; useless
|
2015-12-29 18:15:58 +00:00
|
|
|
ld hl, OBJECT_FACING_STEP
|
|
|
|
add hl, bc
|
|
|
|
ld [hl], a
|
|
|
|
ret
|
|
|
|
; 4539
|
|
|
|
|
2016-09-27 13:37:10 +00:00
|
|
|
SetFacingCounterclockwiseSpin2: ; 4539
|
|
|
|
call CounterclockwiseSpinAction
|
2015-12-29 18:15:58 +00:00
|
|
|
jp SetFacingStanding
|
|
|
|
; 453f
|
|
|
|
|
2016-09-27 13:37:10 +00:00
|
|
|
CounterclockwiseSpinAction: ; 453f
|
|
|
|
; Here, OBJECT_STEP_FRAME consists of two 2-bit components,
|
|
|
|
; using only bits 0,1 and 4,5.
|
|
|
|
; bits 0,1 is a timer (4 overworld frames)
|
|
|
|
; bits 4,5 determines the facing - the direction is counterclockwise.
|
2015-12-29 18:15:58 +00:00
|
|
|
ld hl, OBJECT_STEP_FRAME
|
|
|
|
add hl, bc
|
|
|
|
ld a, [hl]
|
|
|
|
and %11110000
|
|
|
|
ld e, a
|
|
|
|
|
|
|
|
ld a, [hl]
|
|
|
|
inc a
|
|
|
|
and %00001111
|
|
|
|
ld d, a
|
|
|
|
cp 4
|
|
|
|
jr c, .ok
|
|
|
|
|
|
|
|
ld d, 0
|
|
|
|
ld a, e
|
|
|
|
add $10
|
|
|
|
and %00110000
|
|
|
|
ld e, a
|
|
|
|
|
|
|
|
.ok
|
|
|
|
ld a, d
|
|
|
|
or e
|
|
|
|
ld [hl], a
|
|
|
|
|
|
|
|
swap e
|
|
|
|
ld d, 0
|
|
|
|
ld hl, .Directions
|
|
|
|
add hl, de
|
|
|
|
ld a, [hl]
|
|
|
|
ld hl, OBJECT_FACING
|
|
|
|
add hl, bc
|
|
|
|
ld [hl], a
|
|
|
|
ret
|
|
|
|
; 456a
|
|
|
|
|
2016-04-10 18:42:14 +00:00
|
|
|
.Directions: ; 456a
|
2015-12-29 18:15:58 +00:00
|
|
|
db OW_DOWN, OW_RIGHT, OW_UP, OW_LEFT
|
|
|
|
; 456e
|
|
|
|
|
2016-09-27 13:37:10 +00:00
|
|
|
SetFacingFish: ; 456e
|
2015-12-29 18:15:58 +00:00
|
|
|
call GetSpriteDirection
|
|
|
|
rrca
|
|
|
|
rrca
|
2016-09-27 13:37:10 +00:00
|
|
|
add FACING_FISH_DOWN
|
2015-12-29 18:15:58 +00:00
|
|
|
ld hl, OBJECT_FACING_STEP
|
|
|
|
add hl, bc
|
|
|
|
ld [hl], a
|
|
|
|
ret
|
|
|
|
; 457b
|
|
|
|
|
2016-09-27 14:10:13 +00:00
|
|
|
SetFacingShadow: ; 457b
|
2015-12-29 18:15:58 +00:00
|
|
|
ld hl, OBJECT_FACING_STEP
|
|
|
|
add hl, bc
|
2016-09-27 14:10:13 +00:00
|
|
|
ld [hl], FACING_SHADOW
|
2015-12-29 18:15:58 +00:00
|
|
|
ret
|
|
|
|
; 4582
|
|
|
|
|
2016-09-27 14:10:13 +00:00
|
|
|
SetFacingEmote: ; 4582 emote
|
2015-12-29 18:15:58 +00:00
|
|
|
ld hl, OBJECT_FACING_STEP
|
|
|
|
add hl, bc
|
|
|
|
ld [hl], FACING_EMOTE
|
|
|
|
ret
|
|
|
|
; 4589
|
|
|
|
|
2016-09-27 14:10:13 +00:00
|
|
|
SetFacingBigDollSym: ; 4589
|
2015-12-29 18:15:58 +00:00
|
|
|
ld hl, OBJECT_FACING_STEP
|
|
|
|
add hl, bc
|
2016-09-27 14:10:13 +00:00
|
|
|
ld [hl], FACING_BIG_DOLL_SYM
|
2015-12-29 18:15:58 +00:00
|
|
|
ret
|
|
|
|
; 4590
|
|
|
|
|
2016-09-27 14:10:13 +00:00
|
|
|
SetFacingBounce: ; 4590
|
2015-12-29 18:15:58 +00:00
|
|
|
ld hl, OBJECT_STEP_FRAME
|
|
|
|
add hl, bc
|
|
|
|
ld a, [hl]
|
|
|
|
inc a
|
|
|
|
and %00001111
|
|
|
|
ld [hl], a
|
|
|
|
and %00001000
|
2016-09-27 14:10:13 +00:00
|
|
|
jr z, SetFacingFreezeBounce
|
2015-12-29 18:15:58 +00:00
|
|
|
ld hl, OBJECT_FACING_STEP
|
|
|
|
add hl, bc
|
2016-09-27 13:37:10 +00:00
|
|
|
ld [hl], FACING_STEP_UP_0
|
2015-12-29 18:15:58 +00:00
|
|
|
ret
|
|
|
|
; 45a4
|
|
|
|
|
2016-09-27 14:10:13 +00:00
|
|
|
SetFacingFreezeBounce: ; 45a4
|
2015-12-29 18:15:58 +00:00
|
|
|
ld hl, OBJECT_FACING_STEP
|
|
|
|
add hl, bc
|
2016-09-27 14:10:13 +00:00
|
|
|
ld [hl], FACING_STEP_DOWN_0
|
2015-12-29 18:15:58 +00:00
|
|
|
ret
|
|
|
|
; 45ab
|
|
|
|
|
2016-09-27 14:10:13 +00:00
|
|
|
SetFacingWeirdTree: ; 45ab
|
2015-12-29 18:15:58 +00:00
|
|
|
ld hl, OBJECT_STEP_FRAME
|
|
|
|
add hl, bc
|
|
|
|
ld a, [hl]
|
|
|
|
inc a
|
|
|
|
ld [hl], a
|
|
|
|
and %00001100
|
|
|
|
rrca
|
|
|
|
rrca
|
2016-09-27 14:10:13 +00:00
|
|
|
add FACING_WEIRD_TREE_0
|
2015-12-29 18:15:58 +00:00
|
|
|
ld hl, OBJECT_FACING_STEP
|
|
|
|
add hl, bc
|
|
|
|
ld [hl], a
|
|
|
|
ret
|
|
|
|
; 45be
|
|
|
|
|
2016-09-27 14:10:13 +00:00
|
|
|
SetFacingBigDollAsym: ; 45be
|
2015-12-29 18:15:58 +00:00
|
|
|
ld hl, OBJECT_FACING_STEP
|
|
|
|
add hl, bc
|
2016-09-27 14:10:13 +00:00
|
|
|
ld [hl], FACING_BIG_DOLL_ASYM
|
2015-12-29 18:15:58 +00:00
|
|
|
ret
|
|
|
|
; 45c5
|
|
|
|
|
2016-09-27 14:10:13 +00:00
|
|
|
SetFacingBigDoll: ; 45c5
|
2015-12-29 18:15:58 +00:00
|
|
|
ld a, [VariableSprites + SPRITE_BIG_DOLL - SPRITE_VARS]
|
2016-09-27 14:10:13 +00:00
|
|
|
ld d, FACING_BIG_DOLL_SYM ; symmetric
|
2015-12-29 18:15:58 +00:00
|
|
|
cp SPRITE_BIG_SNORLAX
|
|
|
|
jr z, .ok
|
|
|
|
cp SPRITE_BIG_LAPRAS
|
|
|
|
jr z, .ok
|
2016-09-27 14:10:13 +00:00
|
|
|
ld d, FACING_BIG_DOLL_ASYM ; asymmetric
|
2015-12-29 18:15:58 +00:00
|
|
|
|
|
|
|
.ok
|
|
|
|
ld hl, OBJECT_FACING_STEP
|
|
|
|
add hl, bc
|
|
|
|
ld [hl], d
|
|
|
|
ret
|
|
|
|
; 45da
|
|
|
|
|
2016-09-27 14:10:13 +00:00
|
|
|
SetFacingBoulderDust: ; 45da
|
2015-12-29 18:15:58 +00:00
|
|
|
ld hl, OBJECT_STEP_FRAME
|
|
|
|
add hl, bc
|
|
|
|
inc [hl]
|
|
|
|
ld a, [hl]
|
|
|
|
|
|
|
|
ld hl, OBJECT_FACING_STEP
|
|
|
|
add hl, bc
|
|
|
|
and 2
|
2016-09-27 14:10:13 +00:00
|
|
|
ld a, FACING_BOULDER_DUST_1
|
2015-12-29 18:15:58 +00:00
|
|
|
jr z, .ok
|
2016-09-27 14:10:13 +00:00
|
|
|
inc a ; FACING_BOULDER_DUST_2
|
2015-12-29 18:15:58 +00:00
|
|
|
.ok
|
|
|
|
ld [hl], a
|
|
|
|
ret
|
|
|
|
; 45ed
|
|
|
|
|
2016-09-27 13:37:10 +00:00
|
|
|
SetFacingGrassShake: ; 45ed
|
2015-12-29 18:15:58 +00:00
|
|
|
ld hl, OBJECT_STEP_FRAME
|
|
|
|
add hl, bc
|
|
|
|
inc [hl]
|
|
|
|
ld a, [hl]
|
|
|
|
ld hl, OBJECT_FACING_STEP
|
|
|
|
add hl, bc
|
|
|
|
and 4
|
2016-09-27 13:37:10 +00:00
|
|
|
ld a, FACING_GRASS_1
|
2015-12-29 18:15:58 +00:00
|
|
|
jr z, .ok
|
2016-09-27 13:37:10 +00:00
|
|
|
inc a ; FACING_GRASS_2
|
2015-12-29 18:15:58 +00:00
|
|
|
|
|
|
|
.ok
|
|
|
|
ld [hl], a
|
|
|
|
ret
|
|
|
|
; 4600
|