lemm: update for proper pointers

This commit is contained in:
Vince Weaver 2022-03-13 01:28:37 -05:00
parent d471b5f22b
commit 93f58e95ad
9 changed files with 120 additions and 68 deletions

View File

@ -41,7 +41,7 @@ lemm.o: lemm.s zp.inc hardware.inc \
graphics/graphics_test.inc graphics/sprites.inc \
intro_level1.s update_time.s hgr_sprite.s draw_flames.s \
draw_door.s move_lemming.s draw_lemming.s \
interrupt_handler.s keyboard.s \
interrupt_handler.s keyboard.s draw_pointer.s \
pointer_sprites.inc \
level1.s
ca65 -o lemm.o lemm.s -l lemm.lst

View File

@ -10,3 +10,5 @@ ability to walk up hills
level 5
let's go sound
fill in some of the ground so we don't get stuck when digging
dig off the map, end level
better select pointer

View File

@ -8,7 +8,7 @@ draw_pointer:
lda #0
sta OVER_LEMMING
jsr save_bg_14x14 ; save old bg
; jsr save_bg_14x14 ; save old bg
; for now assume the only 14x14 sprites are the pointers
@ -21,32 +21,60 @@ draw_pointer:
; TODO
; see if X1 < X < X2
; lda CURSOR_X
; ldy #LOCATION_SPECIAL_X1
; cmp (LOCATION_STRUCT_L),Y
; bcc finger_not_special ; blt
; see if CURSOR_X==LEMMING_X
lda CURSOR_X
cmp lemming_x
beq check_pointer_y
clc
adc #1
cmp lemming_x
bne just_crosshair
; ldy #LOCATION_SPECIAL_X2
; cmp (LOCATION_STRUCT_L),Y
; bcs finger_not_special ; bge
check_pointer_y:
; see if CURSOR_Y+7 > lemming_y && CURSOR_Y+7 < lemming_y+9
; see if Y1 < Y < Y2
; lda CURSOR_Y
; ldy #LOCATION_SPECIAL_Y1
; cmp (LOCATION_STRUCT_L),Y
; bcc finger_not_special ; blt
lda CURSOR_Y
clc
adc #7
cmp lemming_y
bcc just_crosshair
; ldy #LOCATION_SPECIAL_Y2
; cmp (LOCATION_STRUCT_L),Y
; bcs finger_not_special ; bge
lda CURSOR_Y ; if cursor_y+7 > lemming_y+9
sec
sbc #2
cmp lemming_y
bcs just_crosshair
just_select:
lda #<select_sprite_l
sta INL
lda #>select_sprite_l
jmp common_pointer
just_crosshair:
lda #<crosshair_sprite_l
sta INL
lda #>crosshair_sprite_l
common_pointer:
sta INH
jsr hgr_draw_sprite_14x14
rts
;=====================
; erase pointer
;=====================
erase_pointer:
lda CURSOR_Y
sta SAVED_Y1
clc
adc #16
sta SAVED_Y2
lda CURSOR_X
tax
inx
jmp hgr_partial_restore

Binary file not shown.

Before

Width:  |  Height:  |  Size: 19 KiB

After

Width:  |  Height:  |  Size: 19 KiB

View File

@ -94,6 +94,7 @@ hds_smc2:
rts
.if 0
;======================
; save bg 14x14
@ -196,12 +197,13 @@ restore_yloop:
; save area
;====================
save_right_14x14:
;save_right_14x14:
.byte $00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00
save_left_14x14:
;save_left_14x14:
.byte $00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00
.endif
.include "pointer_sprites.inc"

View File

@ -79,9 +79,9 @@ keypress:
handle_input:
pha
jsr restore_bg_14x14 ; restore old background
pla
; pha
; jsr restore_bg_14x14 ; restore old background
; pla
check_sound:
cmp #$14 ; control-T
@ -199,7 +199,7 @@ return_pressed:
done_keypress:
jsr draw_pointer
; jsr draw_pointer
no_keypress:
bit KEYRESET

View File

@ -114,7 +114,7 @@ do_level1:
lda #1
sta LEMMINGS_TO_RELEASE
jsr save_bg_14x14 ; save initial bg
; jsr save_bg_14x14 ; save initial bg
; set up time
@ -188,16 +188,20 @@ done_release_lemmings:
sta TIMER_COUNT
timer_not_yet:
; main drawing loop
jsr erase_lemming
jsr erase_pointer
jsr move_lemmings
jsr draw_lemming
jsr handle_keypress
; jsr draw_pointer
jsr draw_pointer
lda #$ff
jsr wait

View File

@ -1,4 +1,7 @@
;==========================
; move them
;==========================
move_lemmings:
ldy #0
@ -32,12 +35,16 @@ do_lemming_falling:
do_lemming_walking:
; collision detect walls
lda lemming_y
clc
adc #3 ; waist-high?
tay
lda hposn_high,Y
clc
adc #$20
sta GBASH
lda hposn_low,Y
sta GBASL
@ -78,6 +85,8 @@ do_lemming_digging:
tay
lda hposn_high,Y
clc
adc #$20
sta GBASH
lda hposn_low,Y
sta GBASL
@ -89,11 +98,12 @@ do_lemming_digging:
digging_digging:
lda #$0
sta (GBASL),Y
lda GBASH
adc #$20
sta GBASH
lda #$0
sta (GBASL),Y
; lda GBASH
; clc
; adc #$20 ; erase bg
; sta GBASH
; lda #$0
; sta (GBASL),Y
inc lemming_y
@ -167,6 +177,9 @@ lemming_status:
lemming_job:
.byte $00
;=============================
; collision check ground
;=============================
collision_check_ground:
lda lemming_y
@ -175,6 +188,8 @@ collision_check_ground:
tay
lda hposn_high,Y
clc
adc #$20 ; check bg, not fg
sta GBASH
lda hposn_low,Y
sta GBASL

View File

@ -74,65 +74,66 @@ crosshair_mask_r: ; X 654 3 210
;==================
select_sprite_l: ; X 654 3 210
.byte $7f ; 0 111 1 111
.byte $4f ; 0 100 1 111
.byte $03 ; 0 000 0 011
.byte $00 ; 0 000 0 000
.byte $00 ; 0 000 0 000
.byte $03 ; 0 000 0 011
.byte $03 ; 0 000 0 011
.byte $00 ; 0 000 0 000
.byte $00 ; 0 000 0 000
.byte $03 ; 0 000 0 011
.byte $03 ; 0 000 0 011
.byte $00 ; 0 000 0 000
.byte $00 ; 0 000 0 000
.byte $03 ; 0 000 0 011
.byte $03 ; 0 000 0 011
.byte $03 ; 0 000 0 011
.byte $03 ; 0 000 0 011
.byte $03 ; 0 000 0 011
.byte $03 ; 0 000 0 011
.byte $03 ; 0 000 0 011
.byte $03 ; 0 000 0 011
.byte $7f ; 0 111 1 111
.byte $4f ; 0 100 1 111
select_sprite_r: ; X 654 3 210
.byte $7f ; 0 111 1 111
.byte $79 ; 0 111 1 001
.byte $60 ; 0 110 0 000
.byte $00 ; 0 000 0 000
.byte $00 ; 0 000 0 000
.byte $60 ; 0 110 0 000
.byte $60 ; 0 110 0 000
.byte $00 ; 0 000 0 000
.byte $00 ; 0 000 0 000
.byte $60 ; 0 110 0 000
.byte $60 ; 0 110 0 000
.byte $00 ; 0 000 0 000
.byte $00 ; 0 000 0 000
.byte $60 ; 0 110 0 000
.byte $60 ; 0 110 0 000
.byte $60 ; 0 110 0 000
.byte $60 ; 0 110 0 000
.byte $60 ; 0 110 0 000
.byte $60 ; 0 110 0 000
.byte $60 ; 0 110 0 000
.byte $60 ; 0 110 0 000
.byte $7f ; 0 111 1 111
.byte $79 ; 0 111 1 001
select_mask_l: ; X 654 3 210
.byte $80 ; 0 111 1 111
.byte $d0 ; 0 100 1 111
.byte $fc ; 0 000 0 011
.byte $ff ; 0 000 0 000
.byte $ff ; 0 000 0 000
.byte $fc ; 0 000 0 011
.byte $fc ; 0 000 0 011
.byte $ff ; 0 000 0 000
.byte $ff ; 0 000 0 000
.byte $fc ; 0 000 0 011
.byte $fc ; 0 000 0 011
.byte $ff ; 0 000 0 000
.byte $ff ; 0 000 0 000
.byte $fc ; 0 000 0 011
.byte $fc ; 0 000 0 011
.byte $fc ; 0 000 0 011
.byte $fc ; 0 000 0 011
.byte $fc ; 0 000 0 011
.byte $fc ; 0 000 0 011
.byte $fc ; 0 000 0 011
.byte $fc ; 0 000 0 011
.byte $80 ; 0 111 1 111
.byte $d0 ; 0 100 1 111
select_mask_r: ; X 654 3 210
.byte $80 ; 0 111 1 111
.byte $86 ; 0 111 1 001
.byte $9f ; 0 110 0 000
.byte $ff ; 0 000 0 000
.byte $ff ; 0 000 0 000
.byte $9f ; 0 110 0 000
.byte $9f ; 0 110 0 000
.byte $ff ; 0 000 0 000
.byte $ff ; 0 000 0 000
.byte $9f ; 0 110 0 000
.byte $9f ; 0 110 0 000
.byte $ff ; 0 000 0 000
.byte $ff ; 0 000 0 000
.byte $9f ; 0 110 0 000
.byte $9f ; 0 110 0 000
.byte $9f ; 0 110 0 000
.byte $9f ; 0 110 0 000
.byte $9f ; 0 110 0 000
.byte $9f ; 0 110 0 000
.byte $9f ; 0 110 0 000
.byte $9f ; 0 110 0 000
.byte $80 ; 0 111 1 111
.byte $86 ; 0 111 1 001