From 39a5627cf669ba63296f1824dc456e3dd2818ab0 Mon Sep 17 00:00:00 2001 From: Vince Weaver Date: Sat, 2 Apr 2022 23:28:45 -0400 Subject: [PATCH] lemm: update so we update number of jobs left irregularly placed, should re-draw the graphics to look better --- games/lemm/Makefile | 2 + games/lemm/keyboard.s | 10 +++- games/lemm/level1.s | 14 ++++++ games/lemm/update_menu.s | 103 +++++++++++++++++++++++++++++++++++++-- games/lemm/zp.inc | 8 +++ 5 files changed, 130 insertions(+), 7 deletions(-) diff --git a/games/lemm/Makefile b/games/lemm/Makefile index 9b67ea12..2aaea662 100644 --- a/games/lemm/Makefile +++ b/games/lemm/Makefile @@ -167,6 +167,8 @@ lemm.inc: generate_common LEMM ./generate_common -a 0x6000 -s init_level lemm.lst >> lemm.inc ./generate_common -a 0x6000 -s draw_pointer lemm.lst >> lemm.inc ./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 #### diff --git a/games/lemm/keyboard.s b/games/lemm/keyboard.s index 96707596..ae9e406f 100644 --- a/games/lemm/keyboard.s +++ b/games/lemm/keyboard.s @@ -451,6 +451,9 @@ done_make_miner: ; make digger ;======================== make_digger: + lda DIGGER_COUNT ; only if we have some left + beq done_make_digger + ; only do it if walking lda lemming_status,Y cmp #LEMMING_WALKING @@ -459,7 +462,10 @@ make_digger: lda #LEMMING_DIGGING sta lemming_status,Y - ; FIXME: decrement digger_count + dec DIGGER_COUNT + ldx #7 + jsr update_remaining + done_make_digger: jmp done_keypress @@ -530,7 +536,7 @@ job_button: ; draw new - jsr update_menu + jsr update_selection jmp done_menu diff --git a/games/lemm/level1.s b/games/lemm/level1.s index f08911b3..04fd0b77 100644 --- a/games/lemm/level1.s +++ b/games/lemm/level1.s @@ -13,6 +13,17 @@ do_level1: ; set up stuff ;============== + lda #0 + sta CLIMBER_COUNT + sta FLOATER_COUNT + sta EXPLODER_COUNT + sta STOPPER_COUNT + sta BUILDER_COUNT + sta BASHER_COUNT + sta MINER_COUNT + lda #20 + sta DIGGER_COUNT + lda #9 sta DOOR_X lda #36 @@ -168,6 +179,9 @@ do_level1: jsr init_level + jsr update_remaining_all + + ;======================= ; Play "Let's Go" ;======================= diff --git a/games/lemm/update_menu.s b/games/lemm/update_menu.s index cc5f1571..aa765db0 100644 --- a/games/lemm/update_menu.s +++ b/games/lemm/update_menu.s @@ -1,12 +1,105 @@ ;============================= - ; update menu + ; update remaining_all ;============================= -update_menu: - lda BUTTON_LOCATION - bne actually_update_menu +update_remaining_all: + + ldx #0 +ura_loop: + txa + pha + jsr update_remaining + pla + tax + inx + cpx #8 + bne ura_loop rts -actually_update_menu: + + ;============================= + ; update remaining + ;============================= + ; X is which one to update +update_remaining: + txa + pha + + jsr hgr_sprite_page_toggle ; toggle page (bg) + + lda CLIMBER_COUNT,X + tay + + lda littlenums_l,Y + sta INL + lda littlenums_h,Y + sta INH + + lda remaining_x,X + sta XPOS + lda #169 + sta YPOS + + jsr hgr_draw_sprite + + ; + + pla + tax + + jsr hgr_sprite_page_toggle ; toggle page (bg) + + lda CLIMBER_COUNT,X + tay + + lda littlenums_l,Y + sta INL + lda littlenums_h,Y + sta INH + + lda remaining_x,X + sta XPOS + lda #169 + sta YPOS + + jsr hgr_draw_sprite + + rts + + + ; X locations to print the counts at + ; approximate, 7-bit boundaries where graphics are on 8-bit +remaining_x: + .byte 5,7,10,12,14,17,19,21 + +littlenums_l: + .byte little00_sprite,>little01_sprite,>little02_sprite + .byte >little03_sprite,>little04_sprite,>little05_sprite + .byte >little06_sprite,>little07_sprite,>little08_sprite + .byte >little09_sprite,>little10_sprite,>little11_sprite + .byte >little12_sprite,>little13_sprite,>little14_sprite + .byte >little15_sprite,>little16_sprite,>little17_sprite + .byte >little18_sprite,>little19_sprite,>little20_sprite + + + + ;============================= + ; update selection + ;============================= +update_selection: + lda BUTTON_LOCATION + bne actually_update_selection + rts + +actually_update_selection: ldx #7 stx HGR_COLOR diff --git a/games/lemm/zp.inc b/games/lemm/zp.inc index a5dabba6..0fd986e0 100644 --- a/games/lemm/zp.inc +++ b/games/lemm/zp.inc @@ -85,6 +85,14 @@ DOOR_Y = $91 INIT_X = $92 ; initial lemming position INIT_Y = $93 +CLIMBER_COUNT = $94 +FLOATER_COUNT = $95 +EXPLODER_COUNT = $96 +STOPPER_COUNT = $97 +BUILDER_COUNT = $98 +BASHER_COUNT = $99 +MINER_COUNT = $9A +DIGGER_COUNT = $9B ; done game puzzle state