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 47924806..97ac745a 100644 Binary files a/games/peasant/cliff_heights/sprites_heights/lightning.png and b/games/peasant/cliff_heights/sprites_heights/lightning.png differ