Cleaning up static HRAM labels; movement stuff, route 38 trainers

This commit is contained in:
PikalaxALT
2015-11-09 23:01:45 -05:00
parent 77d0a8a396
commit f1b2466cc3
20 changed files with 483 additions and 373 deletions

View File

@@ -234,7 +234,7 @@ endr
; 3a90
FarJumpText:: ; 3a90
FarCopyRadioText:: ; 3a90
inc hl
ld a, [hROMBank]
push af
@@ -249,8 +249,8 @@ FarJumpText:: ; 3a90
ld l, a
ld a, d
ld h, a
ld de, wd00c
ld bc, $0028
ld de, wRadioText
ld bc, 2 * SCREEN_WIDTH
call CopyBytes
pop af
ld [hROMBank], a

View File

@@ -437,7 +437,7 @@ KeepTextOpen:: ; aaf
; af5
.blink_cursor: ; af5
ld a, [$ff9b]
ld a, [hVBlankCounter]
and %00010000 ; bit 4, a
jr z, .cursor_off
ld a, "▼"

View File

@@ -1,29 +1,29 @@
Function1b1e:: ; 1b1e
ld [wd003], a
InitMovementBuffer:: ; 1b1e
ld [wMovementBufferPerson], a
xor a
ld [DefaultFlypoint], a
ld a, $0
ld [wMovementBufferCount], a
ld a, $0 ; useless
ld [wd004], a
ld a, $7
ld [StartFlypoint], a
ld [wd005], a
ld a, $d0
ld [EndFlypoint], a
ld [wd006], a
ret
; 1b35
Function1b35:: ; 1b35
ld a, [DefaultFlypoint]
DecrementMovementBufferCount:: ; 1b35
ld a, [wMovementBufferCount]
and a
ret z
dec a
ld [DefaultFlypoint], a
ld [wMovementBufferCount], a
ret
; 1b3f
Function1b3f:: ; 1b3f
AppendToMovementBuffer:: ; 1b3f
push hl
push de
ld hl, DefaultFlypoint
ld hl, wMovementBufferCount
ld e, [hl]
inc [hl]
ld d, 0
@@ -35,47 +35,50 @@ Function1b3f:: ; 1b3f
ret
; 1b50
Function1b50:: ; 1b50
AppendToMovementBufferNTimes:: ; 1b50
push af
ld a, c
and a
jr nz, .asm_1b57
jr nz, .okay
pop af
ret
.asm_1b57
.okay
pop af
.asm_1b58
call Function1b3f
.loop
call AppendToMovementBuffer
dec c
jr nz, .asm_1b58
jr nz, .loop
ret
; 1b5f
Function1b5f:: ; 1b5f
ComputePathToWalkToPlayer:: ; 1b5f
push af
; compare x coords, load left/right into h, and x distance into d
ld a, b
sub d
ld h, $2
jr nc, .asm_1b6a
ld h, LEFT
jr nc, .got_x_distance
dec a
cpl
ld h, $3
ld h, RIGHT
.asm_1b6a
.got_x_distance
ld d, a
; compare y coords, load up/down into l, and y distance into e
ld a, c
sub e
ld l, $1
jr nc, .asm_1b75
ld l, UP
jr nc, .got_y_distance
dec a
cpl
ld l, $0
ld l, DOWN
.asm_1b75
.got_y_distance
ld e, a
; if the x distance is less than the y distance, swap h and l, and swap d and e
cp d
jr nc, .asm_1b7f
jr nc, .done
ld a, h
ld h, l
ld l, a
@@ -83,21 +86,23 @@ Function1b5f:: ; 1b5f
ld d, e
ld e, a
.asm_1b7f
.done
pop af
ld b, a
; Add movement in the longer direction first...
ld a, h
call Function1b92
call .GetMovementData
ld c, d
call Function1b50
call AppendToMovementBufferNTimes
; ... then add the shorter direction.
ld a, l
call Function1b92
call .GetMovementData
ld c, e
call Function1b50
call AppendToMovementBufferNTimes
ret
; 1b92
Function1b92:: ; 1b92
.GetMovementData: ; 1b92
push de
push hl
ld l, b
@@ -108,7 +113,7 @@ endr
ld e, a
ld d, 0
add hl, de
ld de, .data_1ba5
ld de, .MovementData
add hl, de
ld a, [hl]
pop hl
@@ -116,8 +121,19 @@ endr
ret
; 1ba5
.data_1ba5
db 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19
.MovementData
slow_step_down
slow_step_up
slow_step_left
slow_step_right
step_down
step_up
step_left
step_right
big_step_down
big_step_up
big_step_left
big_step_right
; 1bb1
Function1bb1:: ; 1bb1

View File

@@ -64,7 +64,7 @@ VBlank0:: ; 2b1
; sound
; inc frame counter
ld hl, $ff9b
ld hl, hVBlankCounter
inc [hl]
; advance random variables
@@ -418,7 +418,7 @@ VBlank6:: ; 436
ld [hROMBankBackup], a
; inc frame counter
ld hl, $ff9b
ld hl, hVBlankCounter
inc [hl]
call UpdateCGBPals