From 2b7b8763eedd369a88ae557da2b84f7cae1f67b8 Mon Sep 17 00:00:00 2001 From: Vince Weaver Date: Tue, 12 Apr 2022 23:21:51 -0400 Subject: [PATCH] lemm: improve exploding sequence a bit --- games/lemm/Makefile | 1 + games/lemm/README | 6 ++++++ games/lemm/TODO | 16 ++++++++++------ games/lemm/draw_lemming.s | 20 ++++++++++++++++---- games/lemm/keyboard.s | 11 +++++++++-- games/lemm/move_lemming.s | 1 + games/lemm/particle_hgr.s | 4 ++-- games/lemm/update_time.s | 34 +++++++++++++++++++++++----------- games/lemm/update_timer.s | 2 ++ 9 files changed, 70 insertions(+), 25 deletions(-) diff --git a/games/lemm/Makefile b/games/lemm/Makefile index 6663995e..1cc0d374 100644 --- a/games/lemm/Makefile +++ b/games/lemm/Makefile @@ -156,6 +156,7 @@ lemm.inc: generate_common LEMM ./generate_common -a 0x6000 -s move_lemmings lemm.lst >> lemm.inc ./generate_common -a 0x6000 -s erase_lemming lemm.lst >> lemm.inc ./generate_common -a 0x6000 -s update_time lemm.lst >> lemm.inc + ./generate_common -a 0x6000 -s update_explosion_timer lemm.lst >> lemm.inc ./generate_common -a 0x6000 -s draw_door lemm.lst >> lemm.inc ./generate_common -a 0x6000 -s draw_door_5 lemm.lst >> lemm.inc ./generate_common -a 0x6000 -s draw_flames lemm.lst >> lemm.inc diff --git a/games/lemm/README b/games/lemm/README index e42ee63b..04453452 100644 --- a/games/lemm/README +++ b/games/lemm/README @@ -97,6 +97,12 @@ easily use any ROM routines so useful routines like WAIT and HPOSN are re-implemented in RAM. +Code Description +~~~~~~~~~~~~~~~~ +TODO + + + Memory Map ~~~~~~~~~~ $0000-$00ff = zero page diff --git a/games/lemm/TODO b/games/lemm/TODO index 99c5bce8..fcc3bb17 100644 --- a/games/lemm/TODO +++ b/games/lemm/TODO @@ -1,6 +1,12 @@ -Spinning things on L7 -one-way wall L9 Improve explosions ++ offset the frames when nuking so not simultaneous ++ on explosion, start with invisible 6 so we always get a full 5s ++ Make particles thicker? Look fine, not show up in recordings ++ Erase particles as last step + +Request from internet: ++ Acceleration on cursor movement keys + This is trickier than it sounds Change wait delay on levels with bg animations? Have 20 lemmings on some levels? @@ -15,9 +21,7 @@ Only scan for Maximum Lemming number rather than maximum possible number? even x, maybe we should start animation 4 frames in if that's the case. Or maybe it's the shift for odd frames, make the shift the other way if walking left/right -+ Make particles thicker? Look fine, not show up in recordings -+ Erase particles as last step -+ offset the frames when nuking so not simultaneous -+ on explosion, start with invisible 6 so we always get a full 5s + + diff --git a/games/lemm/draw_lemming.s b/games/lemm/draw_lemming.s index 8c2c7ab4..46889a2f 100644 --- a/games/lemm/draw_lemming.s +++ b/games/lemm/draw_lemming.s @@ -63,18 +63,30 @@ draw_lemming_loop: ; draw countdown if applicable do_draw_countdown: - lda lemming_exploding,Y - beq do_draw_lemming + lda lemming_exploding,Y ; see if exploding + beq do_draw_lemming ; if not skip ahead + + ; sprites are 5,4,3,2,1 + + tya + tax + inc lemming_exploding_frame,X + + ; decrement first because + ; =0 means no exploding + ; also to make sure 5 appears a whole second, skip first second ldx lemming_exploding,Y dex + dex + bmi do_draw_lemming - lda countdown_sprites_l,X + lda countdown_sprites_l,X ; look up number sprite sta INL lda countdown_sprites_h,X sta INH - ldx lemming_x,Y + ldx lemming_x,Y ; draw 6 pixels above head stx XPOS lda lemming_y,Y sec diff --git a/games/lemm/keyboard.s b/games/lemm/keyboard.s index d50a6705..9afb599a 100644 --- a/games/lemm/keyboard.s +++ b/games/lemm/keyboard.s @@ -336,6 +336,7 @@ make_exploding: lda EXPLODER_COUNT ; only if we have some left beq done_make_exploder + ldx #0 ; regular frame start jsr explode_lemming dec EXPLODER_COUNT @@ -621,16 +622,17 @@ done_plus_adjust: ; nuke ;============================ ;============================ - ; TODO: offset them a bit so it's not simultaneous nuke_button: ; stop lemmings from exiting lda #0 sta LEMMINGS_TO_RELEASE + ldx #0 ; initial frame offset ldy #0 nuke_loop: jsr explode_lemming + dex iny cpy #MAX_LEMMINGS bne nuke_loop @@ -669,13 +671,18 @@ done_menu: ;===================== ;===================== ; which is in Y + ; frame is in X explode_lemming: ; only explode if not already exploding lda lemming_exploding,Y bne skip_explode - lda #1 + txa + sta lemming_exploding_frame,Y + + lda #2 ; 2 not 1 as we don't display the + ; first partial second sta lemming_exploding,Y skip_explode: diff --git a/games/lemm/move_lemming.s b/games/lemm/move_lemming.s index 46765b24..84aa013c 100644 --- a/games/lemm/move_lemming.s +++ b/games/lemm/move_lemming.s @@ -5,6 +5,7 @@ lemming_y: .res MAX_LEMMINGS,0 lemming_direction: .res MAX_LEMMINGS,0 lemming_out: .res MAX_LEMMINGS,0 lemming_frame: .res MAX_LEMMINGS,0 +lemming_exploding_frame:.res MAX_LEMMINGS,0 lemming_status: .res MAX_LEMMINGS,0 lemming_exploding: .res MAX_LEMMINGS,0 lemming_fall_distance: .res MAX_LEMMINGS,0 diff --git a/games/lemm/particle_hgr.s b/games/lemm/particle_hgr.s index 87f6ae8d..685279fc 100644 --- a/games/lemm/particle_hgr.s +++ b/games/lemm/particle_hgr.s @@ -2,7 +2,7 @@ ; by Vince `deater` Weaver -PARTICLES = 64 +PARTICLES = 32 SCALE = 2 ;HGR_BITS = $1C @@ -140,7 +140,7 @@ y_good: HPLOT0: ; line from (x,a) to (x+y,a) - ldy #1 + ldy #2 jsr hgr_hlin rts diff --git a/games/lemm/update_time.s b/games/lemm/update_time.s index d1344064..0826e64c 100644 --- a/games/lemm/update_time.s +++ b/games/lemm/update_time.s @@ -1,29 +1,27 @@ - - - ;============================ - ; update the time - ;============================ - ; this gets called approximately once a second - - ; updates the time left -update_time: - ;============================== ; update explosion timer ;============================== ; not ideal (first second might be short) + ; called roughly at 7Hz +update_explosion_timer: ldy #0 update_exploding_loop: lda lemming_exploding,Y beq not_done_exploding + lda lemming_exploding_frame,Y ; roughly 1s? + cmp #7 + bne not_done_exploding + + lda #0 ; reset + sta lemming_exploding_frame,Y tya tax inc lemming_exploding,X lda lemming_exploding,Y - cmp #6 + cmp #7 ; value is 2+displayed bne not_done_exploding lda #LEMMING_EXPLODING @@ -38,8 +36,22 @@ not_done_exploding: cpy #MAX_LEMMINGS bne update_exploding_loop + rts + + + + ;============================ + ; update the time + ;============================ + ; this gets called approximately once a second + + ; updates the time left +update_time: + +; jsr update_explosion_timer + sed sec diff --git a/games/lemm/update_timer.s b/games/lemm/update_timer.s index c580db85..ebac4cd9 100644 --- a/games/lemm/update_timer.s +++ b/games/lemm/update_timer.s @@ -1,4 +1,6 @@ update_timer: + jsr update_explosion_timer + lda SOUND_STATUS and #SOUND_MOCKINGBOARD bne timer_mockingboard