ootw: alien disintegration works!

This commit is contained in:
Vince Weaver 2019-08-15 16:27:02 -04:00
parent d0d726c22c
commit 6ed71eae46
6 changed files with 219 additions and 26 deletions

View File

@ -98,7 +98,7 @@ ootw_c4.o: ootw_c4.s \
gr_unrle.s gr_hlin.s \
gr_putsprite.s gr_putsprite_flipped.s gr_putsprite_crop.s \
keyboard.s gr_run_sequence.s physicist.s \
collision.s \
collision.s alien.s \
ootw_c4_city.s ootw_c4_action.s \
door.s laser.s shield.s blast.s gun.s charger.s \
ootw_graphics/sprites/physicist.inc \

View File

@ -144,6 +144,7 @@ astate_table_lo:
.byte <alien_turning ; 04
.byte <alien_yelling ; 05
.byte <alien_shooting_up; 06
.byte <alien_disintegrating; 07
astate_table_hi:
.byte >alien_standing ; 00
@ -153,6 +154,7 @@ astate_table_hi:
.byte >alien_turning ; 04
.byte >alien_yelling ; 05
.byte >alien_shooting_up; 06
.byte >alien_disintegrating; 07
; Urgh, make sure this doesn't end up at $FF or you hit the
; NMOS 6502 bug
@ -351,6 +353,44 @@ alien_yelling_no_waving:
jmp finally_draw_alien
;===============================
; Disintegrating
;================================
alien_disintegrating:
lda alien_gait,X
cmp #13
bne alien_keep_disintegrating
lda #0
sta alien_out,X
dec ALIEN_OUT
rts
alien_keep_disintegrating:
asl
tay
lda alien_disintegrating_progression,Y
sta INL
lda alien_disintegrating_progression+1,Y
sta INH
lda FRAMEL
and #$7
bne slow_disintegration
inc alien_gait,X
slow_disintegration:
jmp finally_draw_alien
;===============================
; Shooting Upward
;================================

View File

@ -227,6 +227,10 @@ done_move_blast:
rts
;=====================
; hit something, left
;=====================
disable_blast_left:
lda #0
sta blast0_out
@ -234,6 +238,34 @@ disable_blast_left:
lda LEFT_SHOOT_TARGET
beq done_disable_blast_left
tax
and #$f0
cmp #TARGET_DOOR
beq blast_door_left
cmp #TARGET_ALIEN
beq blast_alien_left
jmp done_disable_blast_left
blast_alien_left:
txa
and #$f
tax
lda #A_DISINTEGRATING
sta alien_state,X
lda #0
sta alien_gait,X
jmp done_blasting_left
blast_door_left:
tax
and #$f0
cmp #TARGET_DOOR
@ -248,10 +280,15 @@ disable_blast_left:
jsr recalc_walk_collision
done_blasting_left:
done_disable_blast_left:
rts
;==================
; hit something, right
;==================
disable_blast_right:
lda #0
sta blast0_out
@ -261,9 +298,29 @@ disable_blast_right:
tax
and #$f0
cmp #TARGET_DOOR
bne done_disable_blast_right
cmp #TARGET_DOOR
beq blast_door_right
cmp #TARGET_ALIEN
beq blast_alien_right
jmp done_disable_blast_right
blast_alien_right:
txa
and #$f
tax
lda #A_DISINTEGRATING
sta alien_state,X
lda #0
sta alien_gait,X
jmp done_blasting_right
blast_door_right:
txa
and #$f
tax
@ -272,6 +329,10 @@ disable_blast_right:
sta door_status,X
jsr recalc_walk_collision
done_blasting_right:
done_disable_blast_right:
rts

View File

@ -4,6 +4,9 @@ TARGET_SHIELD = $20
TARGET_FRIEND = $30
TARGET_ALIEN = $40
; FIXME!!!!
; if doors/aliens/shields then stop check if X passing them. URGH.
;=============================
@ -186,7 +189,7 @@ calc_gun_right_alien_there:
calc_gun_right_alien_continue:
inx
cpx MAX_ALIENS
cpx #MAX_ALIENS
bne calc_gun_right_alien_loop
done_calc_gun_right_alien_collision:
@ -211,7 +214,12 @@ calc_gun_left_collision:
sta LEFT_SHOOT_TARGET
lda LEFT_LIMIT
and #$7f
sec
sbc #$80
bpl left_limit_ok
lda #0
left_limit_ok:
sta LEFT_SHOOT_LIMIT
lda NUM_DOORS
@ -251,6 +259,7 @@ calc_gun_left_door_continue:
done_calc_gun_left_door_collision:
;==========================
; adjust for alien
@ -259,7 +268,7 @@ calc_gun_left_alien:
lda ALIEN_OUT
beq done_calc_gun_left_alien_collision
ldx MAX_ALIENS
ldx #MAX_ALIENS
dex
calc_gun_left_alien_loop:
@ -270,7 +279,7 @@ calc_gun_left_alien_loop:
lda PHYSICIST_X
cmp alien_x,X
bcs calc_gun_left_alien_continue ; bge
bcc calc_gun_left_alien_continue ; blt
lda alien_state,X
cmp #A_DISINTEGRATING
@ -279,11 +288,11 @@ calc_gun_left_alien_loop:
calc_gun_left_alien_there:
; early exit
lda alien_x,X
sta RIGHT_SHOOT_LIMIT
sta LEFT_SHOOT_LIMIT
txa ; set target if hit
ora #TARGET_ALIEN
sta RIGHT_SHOOT_TARGET
sta LEFT_SHOOT_TARGET
jmp done_calc_gun_left_alien_collision
@ -293,8 +302,6 @@ calc_gun_left_alien_continue:
done_calc_gun_left_alien_collision:
rts

View File

@ -1,3 +1,6 @@
; FIXME: merge a lot of the target code
; Handle laser
; should handle multiple at once?
@ -158,7 +161,7 @@ laser_edge_detect_left:
lda laser0_end
cmp LEFT_SHOOT_LIMIT
bmi disable_laser
bmi disable_laser_left
lda laser0_start
cmp LEFT_SHOOT_LIMIT
@ -197,7 +200,7 @@ laser_edge_detect_right:
; detect if totally off screen
lda laser0_start
cmp RIGHT_SHOOT_LIMIT
bcs disable_laser
bcs disable_laser_right
lda laser0_end
cmp RIGHT_SHOOT_LIMIT
@ -213,8 +216,77 @@ done_move_laser:
rts
disable_laser:
;===================
; hit somthing, left
;===================
disable_laser_left:
lda #0
sta laser0_out
lda LEFT_SHOOT_TARGET
beq done_disable_laser_left
tax
and #$f0
cmp #TARGET_ALIEN
beq laser_alien_left
jmp done_disable_laser_left
laser_alien_left:
txa
and #$f
tax
lda #A_DISINTEGRATING
sta alien_state,X
lda #0
sta alien_gait,X
jmp done_lasering_left
done_lasering_left:
done_disable_laser_left:
rts
;====================
; hit somthing, right
;====================
disable_laser_right:
lda #0
sta laser0_out
lda RIGHT_SHOOT_TARGET
beq done_disable_laser_right
tax
and #$f0
cmp #TARGET_ALIEN
beq laser_alien_right
jmp done_disable_laser_right
laser_alien_right:
txa
and #$f
tax
lda #A_DISINTEGRATING
sta alien_state,X
lda #0
sta alien_gait,X
jmp done_lasering_right
done_lasering_right:
done_disable_laser_right:
rts

View File

@ -457,15 +457,28 @@ alien_shooting_up_sprite:
;=====================
;=====================
; EXPLODING
; DISINTEGRATING
;=====================
;=====================
;alien_explode_progression:
; .word alien_exploding_2
alien_disintegrating_progression:
.word alien_disintegrating_2 ; 0
.word alien_disintegrating_3 ; 1
.word alien_disintegrating_4 ; 2
.word alien_disintegrating_4 ; 3
.word alien_disintegrating_4 ; 4
.word alien_disintegrating_4 ; 5
.word alien_disintegrating_3 ; 6
.word alien_disintegrating_9 ; 7
.word alien_disintegrating_10 ; 8
.word alien_disintegrating_11 ; 9
.word alien_disintegrating_12 ; 10
.word alien_disintegrating_13 ; 11
.word alien_disintegrating_14 ; 12
.word alien_disintegrating_14 ; 13
alien_exploding_2: ; 0
alien_disintegrating_2: ; 0
.byte $5,$8
.byte $aa,$ea,$ea,$ea,$aa
.byte $fe,$ff,$ff,$ee,$ea
@ -476,7 +489,7 @@ alien_exploding_2: ; 0
.byte $ee,$ff,$ff,$ff,$ff
.byte $fe,$ff,$ff,$ee,$ff
alien_exploding_3: ; 1
alien_disintegrating_3: ; 1
.byte $5,$8
.byte $aa,$aa,$aa,$aa,$aa
.byte $fa,$ff,$ff,$aa,$aa
@ -487,7 +500,7 @@ alien_exploding_3: ; 1
.byte $aa,$ff,$ff,$fa,$fa
.byte $fa,$ff,$aa,$aa,$ff
alien_exploding_4: ; 2
alien_disintegrating_4: ; 2
.byte $5,$8
.byte $aa,$aa,$aa,$aa,$aa
.byte $0a,$00,$00,$aa,$aa
@ -498,7 +511,7 @@ alien_exploding_4: ; 2
.byte $aa,$00,$00,$0a,$0a
.byte $0a,$00,$aa,$aa,$00
alien_exploding_9: ; 3
alien_disintegrating_9: ; 3
.byte $5,$8
.byte $aa,$aa,$aa,$fa,$aa
.byte $5a,$aa,$aa,$aa,$aa
@ -509,7 +522,7 @@ alien_exploding_9: ; 3
.byte $aa,$aa,$aa,$aa,$aa
.byte $fa,$aa,$aa,$aa,$aa
alien_exploding_10: ; 4
alien_disintegrating_10: ; 4
.byte $5,$8
.byte $5a,$aa,$aa,$aa,$fa
.byte $aa,$aa,$aa,$aa,$aa
@ -520,7 +533,7 @@ alien_exploding_10: ; 4
.byte $a7,$aa,$aa,$aa,$a7
.byte $fa,$aa,$aa,$aa,$aa
alien_exploding_11: ; 5
alien_disintegrating_11: ; 5
.byte $5,$8
.byte $aa,$aa,$aa,$aa,$aa
.byte $aa,$5a,$aa,$fa,$aa
@ -531,7 +544,7 @@ alien_exploding_11: ; 5
.byte $aa,$aa,$aa,$aa,$7a
.byte $fa,$aa,$aa,$aa,$aa
alien_exploding_12: ; 6
alien_disintegrating_12: ; 6
.byte $5,$8
.byte $aa,$aa,$aa,$aa,$aa
.byte $aa,$aa,$aa,$aa,$aa
@ -542,7 +555,7 @@ alien_exploding_12: ; 6
.byte $7a,$aa,$aa,$aa,$af
.byte $fa,$aa,$aa,$aa,$5a
alien_exploding_13: ; 7
alien_disintegrating_13: ; 7
.byte $5,$8
.byte $aa,$aa,$aa,$aa,$aa
.byte $aa,$aa,$aa,$aa,$aa
@ -553,7 +566,7 @@ alien_exploding_13: ; 7
.byte $aa,$a5,$aa,$0a,$aa
.byte $5a,$a7,$aa,$aa,$fa
alien_exploding_14: ; 8
alien_disintegrating_14: ; 8
.byte $5,$8
.byte $aa,$aa,$aa,$aa,$aa
.byte $aa,$aa,$aa,$aa,$aa