From 35d8b590a1bdd1b3b907a713c1f5c4dedcbe8566 Mon Sep 17 00:00:00 2001 From: Vince Weaver Date: Sun, 13 Oct 2024 01:32:02 -0400 Subject: [PATCH] peasant: lightning more or less working --- games/peasant/cliff_heights/Makefile | 2 +- games/peasant/cliff_heights/cliff_heights.s | 47 +----- games/peasant/cliff_heights/draw_lightning.s | 159 ++++++++++++++++++ .../cliff_heights/sprites_heights/Makefile | 16 +- .../sprites_heights/lightning.png | Bin 1807 -> 1696 bytes 5 files changed, 177 insertions(+), 47 deletions(-) create mode 100644 games/peasant/cliff_heights/draw_lightning.s diff --git a/games/peasant/cliff_heights/Makefile b/games/peasant/cliff_heights/Makefile index 3a1b0a38..d5657dad 100644 --- a/games/peasant/cliff_heights/Makefile +++ b/games/peasant/cliff_heights/Makefile @@ -13,7 +13,7 @@ cliff_heights.o: cliff_heights.s \ ../zp.inc ../hardware.inc ../qload.inc ../version.inc \ ../inventory/inventory.inc \ ../parse_input.inc \ - cliff_actions.s \ + cliff_actions.s draw_lightning.s \ ../text/DIALOG_CLIFF_HEIGHTS.ZX02 ../text/dialog_cliff_heights.inc \ graphics_heights/ciff_heights_graphics.inc \ graphics_heights/priority_cliff_heights.inc \ diff --git a/games/peasant/cliff_heights/cliff_heights.s b/games/peasant/cliff_heights/cliff_heights.s index f55a1122..b92f21de 100644 --- a/games/peasant/cliff_heights/cliff_heights.s +++ b/games/peasant/cliff_heights/cliff_heights.s @@ -232,27 +232,16 @@ game_loop: bmi oops_new_location bne level_over + + ;===================== ; draw lightning - lda FRAME - and #$3 - tax - -; ldx #0 - lda big_lightning_l,X - sta INL - lda big_lightning_h,X - sta INH - - lda big_lightning_x,X - sta CURSOR_X - lda big_lightning_y,X - sta CURSOR_Y - - jsr hgr_draw_sprite - - + lda MAP_LOCATION + cmp #LOCATION_CLIFF_HEIGHTS + bne no_lightning + jsr draw_lightning +no_lightning: ;===================== ; always draw peasant @@ -426,25 +415,7 @@ cliff_text_zx02: robe_sprite_data: .incbin "../sprites_peasant/robe_sprites.zx02" -.include "sprites_heights/lightning_sprites.inc" + .include "sprites_heights/ron_sprites.inc" -big_lightning_l: - .byte big_lightning0,>big_lightning1,>big_lightning2,>big_lightning3 -small_lightning_h: - .byte >small_lightning0,>small_lightning1,>small_lightning2,>small_lightning3 - -big_lightning_x: - .byte 13,11,10,10 -small_lightning_x: - .byte 2,2,2,2 - -big_lightning_y: - .byte 27,27,27,27 -small_lightning_y: - .byte 39,39,39,39 +.include "draw_lightning.s" diff --git a/games/peasant/cliff_heights/draw_lightning.s b/games/peasant/cliff_heights/draw_lightning.s new file mode 100644 index 00000000..da7530c1 --- /dev/null +++ b/games/peasant/cliff_heights/draw_lightning.s @@ -0,0 +1,159 @@ + ;===================== + ; draw lightning + ;===================== + +draw_lightning: + + ;===================== + ; check big + + lda big_lightning_out + bne draw_big_lightning + + ;========================== + ; see if need to start + jsr random8 + + and #$3f ; 1/64 chance + bne done_big_lightning + + ;===================== + ; draw big +draw_big_lightning: + + inc big_lightning_out + + ldx big_lightning_out + lda big_lightning_pattern,X + bpl keep_drawing_big_lightning + + ;=============== + ; done drawing + + lda #0 + sta big_lightning_out + beq done_big_lightning ; bra + + +keep_drawing_big_lightning: + + tax + lda big_lightning_l,X + sta INL + lda big_lightning_h,X + sta INH + + lda big_lightning_x,X + sta CURSOR_X + lda big_lightning_y,X + sta CURSOR_Y + + jsr hgr_draw_sprite + +done_big_lightning: + + ;========================== + ; check small + + lda small_lightning_out + bne draw_small_lightning + + ;========================== + ; see if need to start + jsr random8 + + and #$3f ; 1/64 chance + bne done_small_lightning + + ;===================== + ; draw small +draw_small_lightning: + + inc small_lightning_out + + ldx small_lightning_out + lda small_lightning_pattern,X + bpl keep_drawing_small_lightning + + ;=============== + ; done drawing + + lda #0 + sta small_lightning_out + beq done_small_lightning ; bra + + +keep_drawing_small_lightning: + + tax + lda small_lightning_l,X + sta INL + lda small_lightning_h,X + sta INH + + lda small_lightning_x,X + sta CURSOR_X + lda small_lightning_y,X + sta CURSOR_Y + + jsr hgr_draw_sprite + +done_small_lightning: + + rts + +.include "sprites_heights/lightning_sprites.inc" + +big_lightning_l: + .byte big_lightning0,>big_lightning1,>big_lightning2,>big_lightning3 +small_lightning_h: + .byte >small_lightning0,>small_lightning1,>small_lightning2,>small_lightning3 + +big_lightning_x: + .byte 10,12,10,10 +small_lightning_x: + .byte 2,2,2,2 + +big_lightning_y: + .byte 26,26,26,26 +small_lightning_y: + .byte 39,39,39,39 + + +; patterns ; assume 1/4 the frame rate? +; big lightning: 1 (8) 2 +; 2 (7) 2 +; 3 (11) 3 +; 0 (4) 1 +; 3 (7) 2 +; 0 (6) 2 +; 3 (6) 2 +; 0,done 1,ff + +big_lightning_pattern: + .byte 1,1,2,2,3,3,3,0,3,3,0,0,3,3,0,$FF + +; small lightning: +; 1 (5) 2 +; 2 (6) 2 +; 3 (10) 3 +; 0 (5) 1 +; 3 (7) 2 +; 0 (4) 2 +; 3 (6) 2 +; 0 done 1,ff + +small_lightning_pattern: + .byte 1,1,2,2,3,3,3,0,3,3,0,0,3,3,0,$ff + +big_lightning_out: + .byte $00 + +small_lightning_out: + .byte $00 + diff --git a/games/peasant/cliff_heights/sprites_heights/Makefile b/games/peasant/cliff_heights/sprites_heights/Makefile index 4ba2ee77..359fd6f7 100644 --- a/games/peasant/cliff_heights/sprites_heights/Makefile +++ b/games/peasant/cliff_heights/sprites_heights/Makefile @@ -3,14 +3,14 @@ HGR_SPRITE = ../../../../utils/hgr-utils/hgr_make_sprite all: lightning_sprites.inc ron_sprites.inc lightning_sprites.inc: lightning.png - $(HGR_SPRITE) -s -l small_lightning0 lightning.png 14 3 27 15 > lightning_sprites.inc - $(HGR_SPRITE) -s -l small_lightning1 lightning.png 42 3 62 21 >> lightning_sprites.inc - $(HGR_SPRITE) -s -l small_lightning2 lightning.png 77 3 104 29 >> lightning_sprites.inc - $(HGR_SPRITE) -s -l small_lightning3 lightning.png 119 3 146 29 >> lightning_sprites.inc - $(HGR_SPRITE) -s -l big_lightning0 lightning.png 14 51 34 91 >> lightning_sprites.inc - $(HGR_SPRITE) -s -l big_lightning1 lightning.png 49 51 83 103 >> lightning_sprites.inc - $(HGR_SPRITE) -s -l big_lightning2 lightning.png 98 51 146 118 >> lightning_sprites.inc - $(HGR_SPRITE) -s -l big_lightning3 lightning.png 161 51 209 118 >> lightning_sprites.inc + $(HGR_SPRITE) -s -l small_lightning1 lightning.png 14 3 27 14 > lightning_sprites.inc + $(HGR_SPRITE) -s -l small_lightning2 lightning.png 42 3 69 21 >> lightning_sprites.inc + $(HGR_SPRITE) -s -l small_lightning3 lightning.png 84 3 111 29 >> lightning_sprites.inc + $(HGR_SPRITE) -s -l small_lightning0 lightning.png 126 3 153 29 >> lightning_sprites.inc + $(HGR_SPRITE) -s -l big_lightning1 lightning.png 14 51 41 91 >> lightning_sprites.inc + $(HGR_SPRITE) -s -l big_lightning2 lightning.png 56 51 97 103 >> lightning_sprites.inc + $(HGR_SPRITE) -s -l big_lightning3 lightning.png 112 51 167 118 >> lightning_sprites.inc + $(HGR_SPRITE) -s -l big_lightning0 lightning.png 182 51 237 118 >> lightning_sprites.inc ron_sprites.inc: heights_sprites.png $(HGR_SPRITE) -s -l ron0 heights_sprites.png 14 32 27 61 > ron_sprites.inc diff --git a/games/peasant/cliff_heights/sprites_heights/lightning.png b/games/peasant/cliff_heights/sprites_heights/lightning.png index 479248068f0bcf9f1a2ed7e2a181f5985cb92458..97ac745a8567f0d9fefd862a74ff5c821591703f 100644 GIT binary patch delta 1183 zcmV;Q1YrA*4xkON?*Rx61r#cM$1hux_W>w>Y)M2xRCwC$n+=Y$AP|OUqX+0@Z_pF4 zp$BNPbN@4a{0IW_V_QTw-@K+>WmtH5ii4>Zfc1wYL86>we55piDVxOf^DT6N5R+JH zsY10Sg`M0Gsjj0V)s6OLJD%xRcWex#Zo6nL3_@Mb$tyd;Ia+>lI;VmFU} zUopsy?h{caN1+$-h2JB|P;!)zq31X<7?Hu0%nyzvLqN$<?Og{Fr#%J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