mist_hgr: pointer working a bit better

This commit is contained in:
Vince Weaver 2021-07-12 15:23:53 -04:00
parent 45ec8a3fe0
commit e7c0834453
5 changed files with 41 additions and 15 deletions

View File

@ -181,7 +181,7 @@ mist_title.o: mist_title.s zp.inc hardware.inc common_defines.inc \
common_routines.inc \
graphics_title_hgr/mist_title.lzsa graphics_title/title_graphics.inc \
gr_offsets.s \
text_print.s gr_fast_clear.s decompress_fast_v2.s \
draw_pointer.s text_print.s gr_fast_clear.s decompress_fast_v2.s \
keyboard.s audio.s \
init_state.s wait_a_bit.s \
link_book_mist_dock.s common_sprites.inc leveldata_title.inc \

View File

@ -4,6 +4,14 @@
draw_pointer:
lda UPDATE_POINTER
bne really_draw_pointer
rts
really_draw_pointer:
jsr save_bg_14x14 ; save old bg
; for now assume the only 14x14 sprites are the pointers
@ -242,6 +250,9 @@ finger_draw:
jsr hgr_draw_sprite_14x14
no_draw_pointer:
lda #0
sta UPDATE_POINTER
rts
; 0 = point

View File

@ -7,6 +7,7 @@ init_state:
; global game state
lda #0
sta JOYSTICK_ENABLED
sta UPDATE_POINTER
; game state in saves init

View File

@ -23,7 +23,7 @@ check_button:
lda #1
sta JS_BUTTON_STATE
lda #' '
jmp check_sound
jmp handle_input
button_clear:
lda #0
@ -37,13 +37,13 @@ js_check_left:
cmp #$20
bcs js_check_right ; if less than 32, left
lda #'A'
bne check_sound
bne handle_input
js_check_right:
cmp #$40
bcc js_check_up
lda #'D'
bne check_sound
bne handle_input
js_check_up:
lda value1
@ -51,13 +51,13 @@ js_check_up:
bcs js_check_down
lda #'W'
bne check_sound
bne handle_input
js_check_down:
cmp #$40
bcc done_joystick
lda #'S'
bne check_sound
bne handle_input
done_joystick:
@ -73,9 +73,17 @@ actually_handle_keypress:
keypress:
and #$7f ; clear high bit
cmp #' '
beq check_sound ; make sure not to lose space
beq handle_input ; make sure not to lose space
and #$df ; convert uppercase to lower case
handle_input:
pha
jsr restore_bg_14x14 ; restore old background
inc UPDATE_POINTER
pla
check_sound:
cmp #$14 ; control-T
bne check_joystick
@ -116,10 +124,10 @@ check_left:
cmp #8 ; left key
bne check_right
left_pressed:
lda CURSOR_X ; if 41<x<$FB don't decrement
lda CURSOR_X ; if 41<x<$FE don't decrement
cmp #41
bcc do_dec_cursor_x
cmp #$FB
cmp #$FE
bcc done_left_pressed
do_dec_cursor_x:
dec CURSOR_X
@ -132,10 +140,10 @@ check_right:
cmp #$15 ; right key
bne check_up
right_pressed:
lda CURSOR_X ; if 40<x<$FA don't increment
lda CURSOR_X ; if 40<x<$FE don't increment
cmp #40
bcc do_inc_cursor_x
cmp #$FA
cmp #$FE
bcc done_right_pressed
do_inc_cursor_x:
inc CURSOR_X
@ -148,14 +156,17 @@ check_up:
cmp #$0B ; up key
bne check_down
up_pressed:
lda CURSOR_Y ; if 49<y<$F0 don't decrement
cmp #49
lda CURSOR_Y ; if 191<y<$F0 don't decrement
cmp #191
bcc do_dec_cursor_y
cmp #$F0
bcc done_up_pressed
do_dec_cursor_y:
dec CURSOR_Y
dec CURSOR_Y
dec CURSOR_Y
dec CURSOR_Y
done_up_pressed:
jmp done_keypress
@ -165,14 +176,16 @@ check_down:
cmp #$0A
bne check_return
down_pressed:
lda CURSOR_Y ; if 48<y<$EE don't decrement
cmp #48
lda CURSOR_Y ; if 191<y<$EE don't decrement
cmp #191
bcc do_inc_cursor_y
cmp #$EE
bcc done_down_pressed
do_inc_cursor_y:
inc CURSOR_Y
inc CURSOR_Y
inc CURSOR_Y
inc CURSOR_Y
done_down_pressed:
jmp done_keypress

View File

@ -15,6 +15,7 @@ P4 = $07
P5 = $08
VGIL = $09
VGIH = $0A
UPDATE_POINTER = $0B
TEMP0 = $10
TEMP1 = $11