diff --git a/games/lemm/Makefile b/games/lemm/Makefile index 65a0f627..819ce2c9 100644 --- a/games/lemm/Makefile +++ b/games/lemm/Makefile @@ -55,7 +55,7 @@ qload.o: qload.s qboot.inc \ audio.s decompress_fast_v2.s gr_offsets.s \ wait.s wait_a_bit.s \ hgr_hlin.s hgr_vlin.s hgr_box.s hgr_tables.s hgr_14x14_sprite.s \ - hgr_partial_restore.s + hgr_sprite.s hgr_partial_restore.s ca65 -o qload.o qload.s -l qload.lst ### @@ -79,7 +79,10 @@ qload.inc: generate_common QLOAD ./generate_common -a 0x1200 -s hgr_draw_sprite_14x14 qload.lst >> qload.inc ./generate_common -a 0x1200 -s crosshair_sprite_l qload.lst >> qload.inc ./generate_common -a 0x1200 -s select_sprite_l qload.lst >> qload.inc - + ./generate_common -a 0x1200 -s hgr_sprite_as_toggle qload.lst >> qload.inc + ./generate_common -a 0x1200 -s hgr_sprite_page_toggle qload.lst >> qload.inc + ./generate_common -a 0x1200 -s hgr_draw_sprite qload.lst >> qload.inc + ./generate_common -a 0x1200 -s hgr_draw_sprite_autoshift qload.lst >> qload.inc ### @@ -103,7 +106,7 @@ LEMM: lemm.o lemm.o: lemm.s zp.inc hardware.inc qload.inc hgr.inc \ graphics/sprites.inc \ - intro_level.s update_time.s hgr_sprite.s draw_flames.s \ + intro_level.s update_time.s draw_flames.s \ draw_door.s move_lemming.s draw_lemming.s \ update_menu.s init_level.s \ interrupt_handler.s keyboard.s \ diff --git a/games/lemm/TODO b/games/lemm/TODO index c2792991..06459a24 100644 --- a/games/lemm/TODO +++ b/games/lemm/TODO @@ -1,7 +1,6 @@ + wait a second after last lemming gone to exit + dig off the map, end level + fill in some of the ground so we don't get stuck when digging -+ "Out" counter is only printed to page1 so gets erased by cursor + See if the jerky animation is due to starting at an odd x vs 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 diff --git a/games/lemm/hgr_sprite.s b/games/lemm/hgr_sprite.s index 04f8b230..dfba073c 100644 --- a/games/lemm/hgr_sprite.s +++ b/games/lemm/hgr_sprite.s @@ -163,7 +163,7 @@ hgr_sprite_yloop_as: ; eor #$00 draws on page2 ; eor #$60 draws on page1 -hgr_sprite_page_smc_as: +hgr_sprite_smc_as: eor #$00 sta GBASH @@ -222,3 +222,9 @@ sprite_ysize_smc_as: rts + +hgr_sprite_as_toggle: + lda hgr_sprite_smc_as+1 + eor #$60 + sta hgr_sprite_smc_as+1 + rts diff --git a/games/lemm/lemm.s b/games/lemm/lemm.s index 80a88b73..df673da2 100644 --- a/games/lemm/lemm.s +++ b/games/lemm/lemm.s @@ -333,7 +333,6 @@ level_continue: .include "draw_pointer.s" - .include "hgr_sprite.s" .include "update_time.s" .include "intro_level.s" .include "draw_flames.s" @@ -362,6 +361,7 @@ level_continue: ; .include "hgr_tables.s" ; .include "hgr_partial_restore.s" ; .include "hgr_14x14_sprite.s" +; .include "hgr_sprite.s" ; pt3 player diff --git a/games/lemm/qload.s b/games/lemm/qload.s index 3afa26f7..f42d447e 100644 --- a/games/lemm/qload.s +++ b/games/lemm/qload.s @@ -196,6 +196,7 @@ length_array: .include "hgr_tables.s" .include "hgr_partial_restore.s" .include "hgr_14x14_sprite.s" + .include "hgr_sprite.s" qload_end: diff --git a/games/lemm/update_menu.s b/games/lemm/update_menu.s index c7180985..cc5f1571 100644 --- a/games/lemm/update_menu.s +++ b/games/lemm/update_menu.s @@ -1,5 +1,6 @@ - ; - ; + ;============================= + ; update menu + ;============================= update_menu: lda BUTTON_LOCATION bne actually_update_menu @@ -15,7 +16,7 @@ actually_update_menu: rts ;======================== - ; + ; erase menu ;======================== erase_menu: lda BUTTON_LOCATION diff --git a/games/lemm/update_time.s b/games/lemm/update_time.s index 9adb61bb..d1344064 100644 --- a/games/lemm/update_time.s +++ b/games/lemm/update_time.s @@ -72,30 +72,43 @@ not_over: draw_time: + ;============== ; draw minute - ldy TIME_MINUTES - lda bignums_l,Y - sta INL - lda bignums_h,Y - sta INH + ; draw twice, once on each page - ; 246, 152 + jsr hgr_sprite_as_toggle - ldx #35 ; 245 - stx XPOS - lda #152 - sta YPOS + lda TIME_MINUTES + ldx #35 ; XPOS + jsr print_one_digit + + jsr hgr_sprite_as_toggle + + lda TIME_MINUTES + ldx #35 ; XPOS + jsr print_one_digit - jsr hgr_draw_sprite_autoshift ;================ ; draw seconds + ; draw twice, once on each page + + jsr hgr_sprite_as_toggle + lda TIME_SECONDS - ldx #37 + ldx #37 ; x location sec ; no leading zero removal - jmp print_two_digits + jsr print_two_digits + + jsr hgr_sprite_as_toggle + + lda TIME_SECONDS + ldx #37 ; x location + sec ; no leading zero removal + + jmp print_two_digits ; tail call ;=========================== @@ -130,11 +143,22 @@ not_hundred_yet: clc ; leading zero removal hundreds_entry: + php + jsr hgr_sprite_as_toggle lda PERCENT_RESCUED_L ldx #24 + plp + php + jsr print_two_digits + + jsr hgr_sprite_as_toggle + lda PERCENT_RESCUED_L + ldx #24 + plp jmp print_two_digits + ;=========================== ;=========================== ; update lemmings out number @@ -143,7 +167,13 @@ hundreds_entry: update_lemmings_out: + jsr hgr_sprite_as_toggle + lda LEMMINGS_OUT + ldx #15 + clc ; leading zero removal + jsr print_two_digits + jsr hgr_sprite_as_toggle lda LEMMINGS_OUT ldx #15 clc ; leading zero removal @@ -151,6 +181,32 @@ update_lemmings_out: + + ;=========================== + ;=========================== + ; print one-digit number + ;=========================== + ;=========================== + ; A is the BCD value + ; X is the X location + ; we assume 152 for Y location + +print_one_digit: + tay + + lda bignums_l,Y + sta INL + lda bignums_h,Y + sta INH + + stx XPOS + lda #152 + sta YPOS + + jsr hgr_draw_sprite_autoshift + + rts + ;=========================== ;=========================== ; print two-digit number