lemm: handle falling into the water

This commit is contained in:
Vince Weaver 2022-04-09 21:22:18 -04:00
parent d3d0e45941
commit 354ed0e013
3 changed files with 49 additions and 0 deletions

View File

@ -169,6 +169,7 @@ lemm.inc: generate_common LEMM
./generate_common -a 0x6000 -s erase_pointer lemm.lst >> lemm.inc
./generate_common -a 0x6000 -s update_remaining lemm.lst >> lemm.inc
./generate_common -a 0x6000 -s update_remaining_all lemm.lst >> lemm.inc
./generate_common -a 0x6000 -s collision_check_hazzard lemm.lst >> lemm.inc
####

View File

@ -251,6 +251,12 @@ l4_door_is_open:
jsr move_lemmings
;=========================
; extra check if in water
jsr collision_check_hazzard
jsr draw_lemming
jsr handle_keypress

View File

@ -993,3 +993,45 @@ exit_y2_smc:
not_done_level:
rts
;=============================
; check if hit hazzard
;=============================
; TODO: make configurable
collision_check_hazzard:
ldy #0
sty CURRENT_LEMMING
check_hazzard_loop:
ldy CURRENT_LEMMING
lda lemming_y,Y
cmp #130
bcs in_hazzard
bcc continue_check_hazzard
in_hazzard:
lda lemming_status,Y
cmp #LEMMING_SPLATTING
beq continue_check_hazzard ; don't re-splat
lda #LEMMING_SPLATTING
sta lemming_status,Y
lda #0
sta lemming_frame,Y
continue_check_hazzard:
inc CURRENT_LEMMING
lda CURRENT_LEMMING
cmp #MAX_LEMMINGS
bne check_hazzard_loop
rts