From d43a0a97b5ed1d8ccc673128e74ae82fae55ee93 Mon Sep 17 00:00:00 2001 From: Vince Weaver Date: Mon, 10 Feb 2020 01:05:18 -0500 Subject: [PATCH] ootw: update c15 laser handling --- ootw/gr_trapezoid.s | 42 +++++++++++++++++++++++++++++++++ ootw/laser.s | 17 +++++++++++++- ootw/ootw_c15.s | 57 +++++++++++++++++++++++++++++++++++++++++++-- 3 files changed, 113 insertions(+), 3 deletions(-) create mode 100644 ootw/gr_trapezoid.s diff --git a/ootw/gr_trapezoid.s b/ootw/gr_trapezoid.s new file mode 100644 index 00000000..c4dcfea1 --- /dev/null +++ b/ootw/gr_trapezoid.s @@ -0,0 +1,42 @@ + + ; color -> trapezoid_color_smc+1 + ; width -> trapezoid_width_smc+1 + ; starty = Y + ; endy -> trapezoid_endy_smc+1 + ; startx-> trapezoid_startx_smc+1 + ; LEFTSLOPE, RIGHTSLOPE + +draw_trapezoid: + + +draw_trapezoid_loop: + + clc +trapezoid_startx_smc: + lda #5 + adc gr_offsets,Y + sta trapezoid_draw_loop_smc+1 + + lda gr_offsets+1,Y + clc + adc DRAW_PAGE + sta trapezoid_draw_loop_smc+2 + +trapezoid_color_smc: + lda #$11 +trapezoid_width_smc: + ldx #0 + +trapezoid_draw_loop: +trapezoid_draw_loop_smc: + sta $c00,X + dex + bne trapezoid_draw_loop + + dey + dey +trapezoid_endy_smc: + cpy #0 + bne draw_trapezoid_loop + + rts diff --git a/ootw/laser.s b/ootw/laser.s index d37fa7f6..cf377265 100644 --- a/ootw/laser.s +++ b/ootw/laser.s @@ -12,31 +12,46 @@ ; should handle shooting while crouching -MAX_LASERS = 2 +; in general, 0 for physicist, 1/2 for alien +MAX_LASERS = 3 + +; 0=not out, else out. ff=can't hurt laser_out: laser0_out: .byte $0 laser1_out: .byte $0 +laser2_out: .byte $0 +laser3_out: .byte $0 laser_start: laser0_start: .byte $0 laser1_start: .byte $0 +laser2_start: .byte $0 +laser3_start: .byte $0 laser_end: laser0_end: .byte $0 laser1_end: .byte $0 +laser2_end: .byte $0 +laser3_end: .byte $0 laser_y: laser0_y: .byte $0 laser1_y: .byte $0 +laser2_y: .byte $0 +laser3_y: .byte $0 laser_direction: laser0_direction: .byte $0 laser1_direction: .byte $0 +laser2_direction: .byte $0 +laser3_direction: .byte $0 laser_count: laser0_count: .byte $0 laser1_count: .byte $0 +laser2_count: .byte $0 +laser3_count: .byte $0 ;========================= ; fire laser diff --git a/ootw/ootw_c15.s b/ootw/ootw_c15.s index 246a57fa..4cbfa043 100644 --- a/ootw/ootw_c15.s +++ b/ootw/ootw_c15.s @@ -151,6 +151,10 @@ ootw_c15_setup_room_and_play: ;============================== ; each room init + lda #0 + sta LEFT_SHOOT_LIMIT + lda #39 + sta RIGHT_SHOOT_LIMIT ;============================== ; setup per-room variables @@ -462,7 +466,41 @@ c15_no_bg_action: lda WHICH_ROOM cmp #0 - bne c15_no_fg_action + bne c15_room1_foreground + +c15_room0_foreground: + ; Room 0 laser fire + + lda laser1_out + bne handle_laser2 + +handle_laser1: + jsr random16 + lda SEEDL + and #$7 ; 0..7 (+1 carry) + adc #20 ; make random + sta laser1_y + + lda #1 ; right + sta laser1_direction + + lda #0 + sta laser1_start + sta laser1_count + + lda #10 + sta laser1_end + + lda #$ff + sta laser1_out + + jmp done_handle_laser + +handle_laser2: + lda laser2_out + bne done_handle_laser + +done_handle_laser: ; Room 0 draw guard c15_draw_fg_guard: @@ -495,7 +533,7 @@ fg_guard_draw: jsr put_sprite_crop - ; draw laser + ; draw forground lasers lda FRAMEL and #$1f @@ -516,6 +554,15 @@ fg_guard_no_laser: jmp c15_no_fg_action + +c15_room1_foreground: + cmp #1 + bne c15_draw_friend_cliff + + + jsr draw_trapezoid + + ; Room 5 friend slowly working to left c15_draw_friend_cliff: @@ -640,6 +687,8 @@ end_message: .include "keyboard.s" .include "gr_overlay.s" .include "gr_run_sequence.s" +.include "random16.s" +.include "gr_trapezoid.s" .include "physicist.s" .include "alien.s" @@ -806,3 +855,7 @@ guard_laser: + + + +