From 357dfe7c5775d6bc0cff1a98af8897301e6eb62d Mon Sep 17 00:00:00 2001 From: Vince Weaver Date: Tue, 22 Mar 2022 21:48:02 -0400 Subject: [PATCH] lemm: can explode all now --- games/lemm/draw_lemming.s | 27 ++++++++++++++++++--------- games/lemm/update_time.s | 24 +++++++++++++++++------- 2 files changed, 35 insertions(+), 16 deletions(-) diff --git a/games/lemm/draw_lemming.s b/games/lemm/draw_lemming.s index 9aa38edc..d9ffddcd 100644 --- a/games/lemm/draw_lemming.s +++ b/games/lemm/draw_lemming.s @@ -56,7 +56,7 @@ do_draw_countdown: lda lemming_exploding,Y beq do_draw_lemming - ldx lemming_exploding + ldx lemming_exploding,Y dex lda countdown_sprites_l,X @@ -292,19 +292,25 @@ countdown_sprites_h: .byte >countdown2_sprite,>countdown1_sprite + ;========================== + ; Handle particles + ;========================== + handle_particles: jsr hgr_draw_particles - lda lemming_frame + ldy CURRENT_LEMMING + + lda lemming_frame,Y cmp #16 bne still_going - ; partway through make lemming not out + ; TODO: partway through make lemming not out? + lda #0 - sta lemming_out - jsr update_lemmings_out - lda #LEVEL_FAIL - sta LEVEL_OVER + sta lemming_out,Y + + jsr remove_lemming still_going: @@ -314,6 +320,9 @@ still_going: not_done_particle: rts + ;========================== + ; Handle explosion + ;========================== ; moved to make room handle_explosion: @@ -326,13 +335,13 @@ handle_explosion: start_particles: lda #0 - sta lemming_frame + sta lemming_frame,Y jsr init_particles ; erase explosion - ldy #0 + ldy CURRENT_LEMMING lda lemming_y,Y sec diff --git a/games/lemm/update_time.s b/games/lemm/update_time.s index a1e5cfff..4a0030ca 100644 --- a/games/lemm/update_time.s +++ b/games/lemm/update_time.s @@ -4,23 +4,33 @@ update_time: ; update explosion timer ; not ideal (first second might be short) - lda lemming_exploding + + ldy #0 +update_exploding_loop: + lda lemming_exploding,Y beq not_done_exploding - inc lemming_exploding - lda lemming_exploding + + tya + tax + inc lemming_exploding,X + lda lemming_exploding,Y cmp #6 bne not_done_exploding lda #LEMMING_EXPLODING - sta lemming_status + sta lemming_status,Y lda #0 - sta lemming_frame - sta lemming_exploding - + sta lemming_frame,Y + sta lemming_exploding,Y not_done_exploding: + iny + cpy #MAX_LEMMINGS + bne update_exploding_loop + + sed