peasant: ned more or less hooked up

more trouble than I thought it'd be
still can't walk behind him properly, need to hook up
	patching of the priority layer
This commit is contained in:
Vince Weaver 2022-02-20 01:17:23 -05:00
parent 9c0fe0c223
commit 206ab9676e
2 changed files with 105 additions and 30 deletions

View File

@ -199,9 +199,11 @@ not_kerrek:
;======================
; init ned
; FIXME: make random
; randomly waits 126-64 frames
lda #64
jsr random16
and #$3f
; lda #64
sta NED_STATUS
@ -230,17 +232,6 @@ game_loop:
inc FRAME
;====================
; update ned
lda NED_STATUS
beq leave_ned_alone
cmp #129
bcs leave_ned_alone
inc NED_STATUS
leave_ned_alone:
;=====================
; check keyboard
@ -264,22 +255,8 @@ leave_ned_alone:
cmp #LOCATION_WAVY_TREE
bne not_at_wavy_tree
lda NED_STATUS
bpl ned_not_out
jsr handle_ned
lda #25
sta CURSOR_X
lda #88
sta CURSOR_Y
lda #<ned3_sprite
sta INL
lda #>ned3_sprite
sta INH
jsr hgr_draw_sprite
ned_not_out:
not_at_wavy_tree:
;==========================================
@ -403,6 +380,104 @@ level_over:
rts
;======================
; handle ned
;======================
handle_ned:
;====================
; update ned status
; if 0 or 128, do nothing
lda NED_STATUS
beq leave_ned_alone
cmp #128
beq leave_ned_alone
inc NED_STATUS
leave_ned_alone:
lda NED_STATUS ; check status
beq ned_erase_bg ; special case, erase if just hit 0
cmp #125
bcc no_draw_ned ; blt, don't draw
cmp #128 ; don't erase if fully out
beq no_draw_ned
; erase by copying from background
ned_erase_bg:
lda #81
sta SAVED_Y1
lda #114
sta SAVED_Y2
lda #25
ldx #30
jsr hgr_partial_restore
; 125,255 draw ned1 sprite
; 126,254 draw ned2 sprite
; 127 draw ned3 sprite
lda NED_STATUS
cmp #127
beq draw_ned_out
cmp #125
beq draw_ned_hands
cmp #255
beq draw_ned_hands
cmp #126
beq draw_ned_half
cmp #254
beq draw_ned_half
bne no_draw_ned ; not out so don't draw
draw_ned_hands:
lda #28
sta CURSOR_X
lda #96
sta CURSOR_Y
lda #<ned1_sprite
sta INL
lda #>ned1_sprite
jmp draw_ned_common
draw_ned_half:
lda #28
sta CURSOR_X
lda #81
sta CURSOR_Y
lda #<ned2_sprite
sta INL
lda #>ned2_sprite
jmp draw_ned_common
draw_ned_out:
lda #25
sta CURSOR_X
lda #88
sta CURSOR_Y
lda #<ned3_sprite
sta INL
lda #>ned3_sprite
draw_ned_common:
sta INH
jsr hgr_draw_sprite
no_draw_ned:
rts
.include "peasant_common.s"
.include "move_peasant.s"

View File

@ -535,7 +535,7 @@ ned_tree_talk_ned_out:
; scare him away
lda #0
lda #253
sta NED_STATUS
; FIXME: do we need to re-draw?
@ -555,7 +555,7 @@ ned_tree_talk_at_out:
; scare him away
lda #0
lda #253
sta NED_STATUS
; FIXME: do we need to re-draw?