ootw: aliens can shoot. also make laser collision code generic

This commit is contained in:
Vince Weaver 2019-08-22 12:21:18 -04:00
parent 02b123ccfa
commit 33738a7cc9
9 changed files with 90 additions and 26 deletions

View File

@ -9,6 +9,11 @@ TODO Before release:
l2 -- move doors to final behavior (break room one needs to
be locked)
l2 -- re-activate opening cutscene
l2 -- shield up in alien hallway
shooting through shield is broken
MISSING SPRITES:
================
@ -45,6 +50,8 @@ BEHAVIOR DIFFERENCES:
we call down.
also I think if you wait long enough more aliens
appear if you try to go left.
- should be able to crouch/shoot
- should be able to blast/shield
* gun behavior:
- doors/walls should explode outward away from blast

View File

@ -179,8 +179,14 @@ done_move_alien_standing:
; shooting
move_alien_shooting:
lda FRAMEL
and #$3f
bne done_alien_shooting_now
jsr fire_alien_laser
done_alien_shooting_now:
jmp done_move_alien

View File

@ -22,6 +22,11 @@ fire_alien_laser:
lda laser1_out
bne done_fire_alien_laser
lda alien_x,X
sta COLLISION_X
lda alien_y,X
sta COLLISION_Y
; activate laser slot
inc laser1_out
@ -51,9 +56,12 @@ fire_alien_laser:
; set x
alien_laser_left:
stx LASER_TEMP
jsr calc_gun_left_collision
ldx LASER_TEMP
lda alien_x,X
; dex
sta laser1_end
@ -67,8 +75,12 @@ alien_laser_left:
alien_laser_right:
stx LASER_TEMP
jsr calc_gun_right_collision
ldx LASER_TEMP
lda alien_x,X
clc
adc #5

View File

@ -16,6 +16,11 @@ fire_blast:
lda blast0_out
bne done_fire_blast
lda PHYSICIST_X
sta COLLISION_X
lda PHYSICIST_Y
sta COLLISION_Y
; activate blast slot
inc blast0_out

View File

@ -4,10 +4,6 @@ TARGET_SHIELD = $20
TARGET_FRIEND = $30
TARGET_ALIEN = $40
; FIXME!!!!
; if doors/aliens/shields then stop check if X passing them. URGH.
;=============================
;=============================
@ -140,10 +136,10 @@ calc_gun_right_door_loop:
lda (DOOR_Y),Y
clc
adc #4
cmp PHYSICIST_Y
cmp COLLISION_Y
bne calc_gun_right_door_continue
lda PHYSICIST_X
lda COLLISION_X
cmp (DOOR_X),Y
bcs calc_gun_right_door_continue ; bge
@ -188,7 +184,7 @@ calc_gun_right_shield_loop:
lda shield_out,X
beq calc_gun_right_shield_continue
lda PHYSICIST_X
lda COLLISION_X
cmp shield_x,X
bcs calc_gun_right_shield_continue ; bge
@ -225,7 +221,7 @@ calc_gun_right_friend:
cmp WHICH_ROOM
bne done_calc_gun_right_friend_collision
lda PHYSICIST_X
lda COLLISION_X
cmp friend_x
bcs calc_gun_right_friend_continue ; bge
@ -269,10 +265,10 @@ calc_gun_right_alien_loop:
; only if on same level
lda alien_y,X
cmp PHYSICIST_Y
cmp COLLISION_Y
bne calc_gun_right_alien_continue
lda PHYSICIST_X
lda COLLISION_X
cmp alien_x,X
bcs calc_gun_right_alien_continue ; bge
@ -354,10 +350,10 @@ calc_gun_left_door_loop:
lda (DOOR_Y),Y
clc
adc #4
cmp PHYSICIST_Y
cmp COLLISION_Y
bne calc_gun_left_door_continue
lda PHYSICIST_X
lda COLLISION_X
cmp (DOOR_X),Y
bcc calc_gun_left_door_continue ; blt
@ -400,7 +396,7 @@ calc_gun_left_shield_loop:
lda shield_out,X
beq calc_gun_left_shield_continue
lda PHYSICIST_X
lda COLLISION_X
cmp shield_x,X
bcc calc_gun_left_shield_continue ; blt
@ -438,7 +434,7 @@ calc_gun_left_friend:
cmp WHICH_ROOM
bne done_calc_gun_left_friend_collision
lda PHYSICIST_X
lda COLLISION_X
cmp friend_x
bcc calc_gun_left_friend_continue ; blt
@ -482,10 +478,10 @@ calc_gun_left_alien_loop:
; only if on same level
lda alien_y,X
cmp PHYSICIST_Y
cmp COLLISION_Y
bne calc_gun_left_alien_continue
lda PHYSICIST_X
lda COLLISION_X
cmp alien_x,X
bcc calc_gun_left_alien_continue ; blt

View File

@ -13,6 +13,8 @@
; should handle shooting while crouching
MAX_LASERS = 2
laser_out:
laser0_out: .byte $0
laser1_out: .byte $0
@ -42,6 +44,10 @@ laser1_count: .byte $0
;=========================
fire_laser:
lda PHYSICIST_X
sta COLLISION_X
lda PHYSICIST_Y
sta COLLISION_Y
lda laser0_out
bne done_fire_laser
@ -112,33 +118,48 @@ done_fire_laser:
rts
;====================
; draw laser
;====================
draw_laser:
lda laser0_out
ldx #0
draw_laser_loop:
lda laser_out,X
beq done_draw_laser
txa
pha ; save X on stack
lda #$10
sta hlin_color_smc+1
lda #$0f
sta hlin_mask_smc+1
ldy laser0_y
ldy laser_y,X
sec
lda laser0_end
sbc laser0_start
tax
lda laser_end,X
sbc laser_start,X
sta LASER_TEMP
lda laser0_start
lda laser_start,X
ldx LASER_TEMP
jsr hlin
pla ; restore X from stack
tax
done_draw_laser:
inx
cpx #MAX_LASERS
bne draw_laser_loop
rts

View File

@ -97,6 +97,7 @@ end_message:
.include "gun.s"
.include "laser.s"
.include "alien_laser.s"
.include "blast.s"
.include "shield.s"

View File

@ -581,4 +581,20 @@ alien_disintegrating_14: ; 8
;=====================
;=====================
; SHOOTING
;=====================
;=====================
alien_shoot_sprite:
.byte $5,$8
.byte $aa,$7a,$f7,$7f,$aa
.byte $aa,$77,$07,$00,$aa
.byte $0a,$aa,$00,$77,$aa
.byte $aa,$a7,$17,$10,$aa
.byte $aa,$aa,$00,$00,$aa
.byte $aa,$aa,$77,$a5,$5a
.byte $aa,$aa,$07,$aa,$05
.byte $aa,$0a,$00,$0a,$00

View File

@ -56,9 +56,6 @@ LETTERD = $67
LETTER = $68
BLARGH = $69
;ZPOS = $78
AY_REGISTERS = $70
A_FINE_TONE = $70
A_COARSE_TONE = $71
@ -94,6 +91,8 @@ PT3_TEMP = $8A
; More zero-page addresses
; we try not to conflict with anything DOS, MONITOR or BASIC related
COLLISION_X = $BE
COLLISION_Y = $BF
DOOR_STATUS = $C0
DOOR_STATUS_H = $C1
@ -111,6 +110,7 @@ BEAST_DEAD = $CB ; 1
VENT_OPEN = $CC ; 2
INTRO_REPEAT = $CD ; INTRO
LASER_TEMP = $CE ; 2+
LEFT_SHOOT_TARGET = $CF ; ALL
RIGHT_SHOOT_TARGET = $D0 ; ALL