ootw: c4: initial laser support

This commit is contained in:
Vince Weaver 2019-08-09 21:46:04 -04:00
parent 37868abe9c
commit acd247c574
7 changed files with 115 additions and 2 deletions

View File

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

34
ootw/gr_hlin.s Normal file
View File

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

View File

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

53
ootw/laser.s Normal file
View File

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

View File

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

View File

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

View File

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