diff --git a/ootw/Makefile b/ootw/Makefile index c6b95006..1ed7ff91 100644 --- a/ootw/Makefile +++ b/ootw/Makefile @@ -93,7 +93,7 @@ OOTW_C4: ootw_c4.o ootw_c4.o: ootw_c4.s \ gr_copy.s gr_twoscreen_scroll.s gr_fast_clear.s gr_pageflip.s \ - gr_unrle.s \ + gr_unrle.s gr_hlin.s laser.s \ gr_putsprite.s gr_putsprite_flipped.s gr_putsprite_crop.s \ keyboard.s gr_run_sequence.s physicist.s ootw_c4_city.s \ door.s \ diff --git a/ootw/gr_hlin.s b/ootw/gr_hlin.s new file mode 100644 index 00000000..51d7c91f --- /dev/null +++ b/ootw/gr_hlin.s @@ -0,0 +1,34 @@ + ;=============================== + ; hlin + ;=============================== + ; Y = y position + ; A = start + ; X = length +hlin: + clc + adc gr_offsets,Y + sta hlin_smc1+1 + sta hlin_smc2+1 + + lda gr_offsets+1,Y + clc + adc DRAW_PAGE + sta hlin_smc1+2 + sta hlin_smc2+2 + + +hlin_loop: + +hlin_smc1: + lda $c00,X +hlin_mask_smc: + and #$f0 +hlin_color_smc: + ora #$01 +hlin_smc2: + sta $c00,X + + dex + bpl hlin_loop + + rts diff --git a/ootw/keyboard.s b/ootw/keyboard.s index 4642aecf..1fdeb42b 100644 --- a/ootw/keyboard.s +++ b/ootw/keyboard.s @@ -282,6 +282,14 @@ space: lda HAVE_GUN beq kick shoot: + lda PHYSICIST_STATE + cmp #P_SHOOTING + bne no_stance + + lda #1 + sta LASER_OUT + +no_stance: lda #P_SHOOTING sta PHYSICIST_STATE diff --git a/ootw/laser.s b/ootw/laser.s new file mode 100644 index 00000000..2dc5fd49 --- /dev/null +++ b/ootw/laser.s @@ -0,0 +1,53 @@ +; Handle laser + + + +draw_laser: + + lda #$10 + sta hlin_color_smc+1 + + lda #$0f + sta hlin_mask_smc+1 + + lda PHYSICIST_Y + clc + adc #4 + tay + + lda DIRECTION + beq laser_left + bne laser_right + +laser_left: + + ldx PHYSICIST_X + dex + lda #0 + + jmp laser_hlin + +laser_right: + + lda PHYSICIST_Y + clc + adc #4 + tay + + lda PHYSICIST_X + clc + adc #5 + sta TEMP + + sec + lda #39 + sbc TEMP + tax + + lda TEMP + +laser_hlin: + + jsr hlin + + rts diff --git a/ootw/ootw_c4.s b/ootw/ootw_c4.s index da791e3f..7dea2e47 100644 --- a/ootw/ootw_c4.s +++ b/ootw/ootw_c4.s @@ -90,6 +90,7 @@ end_message: .include "gr_unrle.s" .include "gr_fast_clear.s" .include "gr_copy.s" +.include "gr_hlin.s" .include "gr_twoscreen_scroll.s" .include "gr_putsprite.s" .include "gr_putsprite_flipped.s" @@ -102,6 +103,7 @@ end_message: .include "alien.s" .include "door.s" +.include "laser.s" ; room backgrounds .include "ootw_graphics/l4city/ootw_c4_city.inc" diff --git a/ootw/ootw_c4_city.s b/ootw/ootw_c4_city.s index a3feb7df..dbf153db 100644 --- a/ootw/ootw_c4_city.s +++ b/ootw/ootw_c4_city.s @@ -7,6 +7,7 @@ ootw_city_init: sta WHICH_ROOM sta BG_SCROLL sta DIRECTION ; left + sta LASER_OUT lda #1 sta HAVE_GUN @@ -188,7 +189,7 @@ room3: ; down at the bottom room4: - lda #(17+128) + lda #(16+128) sta LEFT_LIMIT lda #(39+128) sta RIGHT_LIMIT @@ -533,12 +534,25 @@ regular_room: ;=============== ; draw physicist + ;=============== jsr draw_physicist + + ;================ + ; draw laser + ;================ + + lda LASER_OUT + beq done_draw_laser + jsr draw_laser +done_draw_laser: + + ;======================== ; draw foreground cover + ;======================== lda WHICH_ROOM cmp #2 @@ -635,6 +649,7 @@ c4_move_fg_objects: ;=============== ; page flip + ;=============== jsr page_flip diff --git a/ootw/zp.inc b/ootw/zp.inc index 743418a4..052e4e16 100644 --- a/ootw/zp.inc +++ b/ootw/zp.inc @@ -118,6 +118,7 @@ LZ4_DONE = $96 ; More zero-page addresses ; we try not to conflict with anything DOS, MONITOR or BASIC related +LASER_OUT = $DB ; 2+ GUN_CHARGE = $DC ; 2+