ootw: update c15 laser handling

This commit is contained in:
Vince Weaver 2020-02-10 01:05:18 -05:00
parent b9bd74e5a8
commit d43a0a97b5
3 changed files with 113 additions and 3 deletions

42
ootw/gr_trapezoid.s Normal file
View File

@ -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

View File

@ -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

View File

@ -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: