monkey: displays nouns when you hover over them now

This commit is contained in:
Vince Weaver 2020-09-16 00:28:08 -04:00
parent 2cb849dfd2
commit da7b9745fc
6 changed files with 114 additions and 78 deletions

View File

@ -19,6 +19,13 @@ VERB_WALK = 9
;===============================================
LOCATION_BACKGROUND=0 ; background
LOCATION_WALK_X_LEFT=2
LOCATION_WALK_X_RIGHT=3
LOCATION_WALK_Y_TOP=4
LOCATION_WALK_Y_BOTTOM=5
LOCATION_NUM_AREAS=6
LOCATION_AREAS=7 ; each area 8 in size
;================================
; Loader definitions

View File

@ -10,8 +10,7 @@ location0:
.word lookout_lzsa ; background
.byte 18,40 ; walking range X
.byte 16,48 ; walking range Y
.byte 4 ; num areas
.byte 3
.byte 3 ; num areas
.byte 12,15 ; x
.byte 18,28 ; y
@ -33,8 +32,7 @@ location1:
.word poster_lzsa ; background
.byte 18,40 ; walking range X
.byte 16,48 ; walking range Y
.byte 4 ; num areas
.byte 3
.byte 3 ; num areas
.byte 12,15 ; x
.byte 18,28 ; y
@ -56,8 +54,7 @@ location2:
.word dock_lzsa ; background
.byte 18,40 ; walking range X
.byte 16,48 ; walking range Y
.byte 4 ; num areas
.byte 3
.byte 3 ; num areas
.byte 12,15 ; x
.byte 18,28 ; y
@ -79,8 +76,7 @@ location3:
.word bar_lzsa ; background
.byte 18,40 ; walking range X
.byte 16,48 ; walking range Y
.byte 4 ; num areas
.byte 3
.byte 3 ; num areas
.byte 12,15 ; x
.byte 18,28 ; y
@ -101,7 +97,7 @@ location3:
string_data:
lookout_string: .byte "LOOKOUT",0
path_string: .byte "PATH",0
stairs_string: .byte "STAIRS",0
lookout_string: .byte 20,20,"LOOKOUT",0
path_string: .byte 20,20,"PATH",0
stairs_string: .byte 20,20,"STAIRS",0

View File

@ -81,18 +81,6 @@ game_loop:
;====================================
lda LOCATION
; cmp #NIBEL_BLUE_ROOM
; beq fg_draw_blue_page
; cmp #NIBEL_RED_TABLE_OPEN
; beq fg_draw_red_page
; cmp #NIBEL_BLUE_HOUSE_VIEWER
; beq animate_viewer
; cmp #NIBEL_SHACK_ENTRANCE
; beq animate_projector
; cmp #NIBEL_SHACK_CENTER
; beq animate_trap
; cmp #NIBEL_BLUE_PATH_2P25
; beq animate_gate_s
; cmp #NIBEL_BLUE_PATH_2P5
; beq animate_gate_n
@ -104,59 +92,6 @@ animate_gate_n:
; jsr update_gate_n
jmp nothing_special
animate_viewer:
lda ANIMATE_FRAME
beq nothing_special
cmp #6
beq viewer_done
sec
sbc #1
asl
tay
; lda current_button_animation
; sta OUTL
; lda current_button_animation+1
; sta OUTH
lda (OUTL),Y
sta INL
iny
lda (OUTL),Y
sta INH
lda #14
sta XPOS
lda #10
sta YPOS
jsr put_sprite_crop
lda FRAMEL
and #$f
bne nothing_special
lda ANIMATE_FRAME
cmp #5
bne short_frame
long_frame:
inc LONG_FRAME
lda LONG_FRAME
cmp #30
bne nothing_special
short_frame:
inc ANIMATE_FRAME
lda #0
sta LONG_FRAME
jmp nothing_special
viewer_done:
lda #0
sta ANIMATE_FRAME
nothing_special:
@ -182,6 +117,12 @@ nothing_special:
;====================================
;====================================
; what are we pointing too
;====================================
jsr where_do_we_point
;====================================
; update bottom bar
;====================================

View File

@ -1,3 +1,84 @@
;===================================
; where do we point?
;===================================
; check to see if cursor is in any of zones
where_do_we_point:
ldy #LOCATION_NUM_AREAS
lda (LOCATION_STRUCT_L),Y
tax ; num areas in X
ldy #LOCATION_AREAS
where_loop:
lda CURSOR_X
clc
adc #3 ; center of cursor is 3 over
cmp (LOCATION_STRUCT_L),Y
bcc where_notxlow ; too far left
iny
cmp (LOCATION_STRUCT_L),Y
bcs where_notxhigh ; too far right
iny
lda CURSOR_Y
clc
adc #4 ; center of cursor 4 down?
cmp (LOCATION_STRUCT_L),Y
bcc where_notylow ; too far up
iny
; cmp CURSOR_Y
cmp (LOCATION_STRUCT_L),Y
bcs where_notyhigh ; too far right
iny
; we got this far, was a match
lda (LOCATION_STRUCT_L),Y
sta NOUN_L
iny
lda (LOCATION_STRUCT_L),Y
sta NOUN_H
iny
lda (LOCATION_STRUCT_L),Y
sta NOUN_VECTOR_L
iny
lda (LOCATION_STRUCT_L),Y
sta NOUN_VECTOR_H
lda #0
sta VALID_NOUN
rts
; update area pointer
where_notxlow:
iny
where_notxhigh:
iny
where_notylow:
iny
where_notyhigh:
iny
iny
iny
iny
iny
dex
bpl where_loop
point_nowhere:
lda #$ff
sta VALID_NOUN
rts
lookout_action:
rts

View File

@ -28,9 +28,16 @@ update_bottom:
jsr move_and_print
lda CURRENT_NOUN
lda VALID_NOUN
bmi no_noun
lda NOUN_L
sta OUTL
lda NOUN_H
sta OUTH
jsr move_and_print
no_noun:

View File

@ -78,7 +78,11 @@ GUYBRUSH_X = $82 ; location of protagonist
GUYBRUSH_Y = $83
CURRENT_VERB = $84 ; current verb
CURRENT_NOUN = $85 ; current noun
VALID_NOUN = $85 ; current noun
NOUN_L = $86 ; pointer to current noun string
NOUN_H = $87
NOUN_VECTOR_L = $88 ; pointer to callback for clicking noun
NOUN_VECTOR_H = $89
; done game puzzle state