mirror of
https://github.com/pret/pokegold-spaceworld.git
synced 2026-08-08 19:25:24 -05:00
This uses catch-all files like main.asm to reduce the total quantity and size of build objects (from 1.1 GB to 70 MB). --------- Co-authored-by: Rangi <35663410+Rangi42@users.noreply.github.com>
64 lines
832 B
NASM
64 lines
832 B
NASM
QueueFollowerFirstStep::
|
|
call .QueueFirstStep
|
|
jr c, .same
|
|
ld [wFollowMovementQueue], a
|
|
xor a
|
|
ld [wFollowerMovementQueueLength], a
|
|
ret
|
|
|
|
.same
|
|
ld a, -1
|
|
ld [wFollowerMovementQueueLength], a
|
|
ret
|
|
|
|
.QueueFirstStep:
|
|
ld a, [wObjectFollow_Leader]
|
|
call GetObjectStruct
|
|
ld hl, OBJECT_MAP_X
|
|
add hl, bc
|
|
ld d, [hl]
|
|
ld hl, OBJECT_MAP_Y
|
|
add hl, bc
|
|
ld e, [hl]
|
|
ld a, [wObjectFollow_Follower]
|
|
call GetObjectStruct
|
|
ld hl, OBJECT_MAP_X
|
|
add hl, bc
|
|
ld a, d
|
|
cp [hl]
|
|
jr z, .check_y
|
|
jr c, .left
|
|
and a
|
|
ld a, movement_step + RIGHT
|
|
ret
|
|
|
|
.left
|
|
and a
|
|
ld a, movement_step + LEFT
|
|
ret
|
|
|
|
.check_y
|
|
ld hl, OBJECT_MAP_Y
|
|
add hl, bc
|
|
ld a, e
|
|
cp [hl]
|
|
jr z, .same_xy
|
|
jr c, .up
|
|
and a
|
|
ld a, movement_step + DOWN
|
|
ret
|
|
|
|
.up
|
|
and a
|
|
ld a, movement_step + UP
|
|
ret
|
|
|
|
.same_xy
|
|
scf
|
|
ret
|
|
|
|
; a = d * sin(e * pi/32)
|
|
_Sine::
|
|
ld a, e
|
|
calc_sine_wave
|