snes: missiles die when off end of screen

This commit is contained in:
Vince Weaver 2013-01-30 01:29:14 -05:00
parent 131b79cabf
commit 889515f2c5
3 changed files with 51 additions and 17 deletions

View File

@ -1,2 +1,2 @@
.word $7233 ; Complement of checksum
.word $8dcc ; Unsigned 16-bit sum of ROM
.word $60fc ; Complement of checksum
.word $9f03 ; Unsigned 16-bit sum of ROM

View File

@ -1811,24 +1811,18 @@ move_missiles:
ply
; iny ; move to missile.y
; iny
; clc ; clear carry
; lda (MISSILE_PL),Y ; get missile.y
; adc #$FF ; move up (subtract 1)
; sta (MISSILE_PL),Y ; store missile.y
; bpl missile_collision_detection ; if not off screen, contine
cmp #200
; dey ; back up to missile.out
; dey
; lda #$0
; sta (MISSILE_PL),Y ; set missile.out=0
; bge
bcc missile_collision_detection ; if not off screen, contine
; lda #<(~PERFECT_AIM) ; shot missed!
; and BONUS_FLAGS ; clear perfect shot flag
; sta BONUS_FLAGS
jsr deactivate_sprite
; jmp loop_move_missiles ; continue
lda #<(~PERFECT_AIM) ; shot missed!
and BONUS_FLAGS ; clear perfect shot flag
sta BONUS_FLAGS
jmp loop_move_missiles ; continue
missile_collision_detection:

View File

@ -358,3 +358,43 @@ activate_sprite:
plx
plp
rts
;===========================
;===========================
; deactivate_sprite
;===========================
;===========================
; assumes high sprite table at $0400
; sets carry if active
; clears carry if not
; sprite number in X
deactivate_sprite:
php
phx
phy
lda #$0
xba
tyx
; address=$0400 + Y/4
txa
lsr
lsr
tay
txa
and #$3
tax
lda SPRITE_HIGH_LOOKUP,X
ora $0400,Y ; sprite off screen when bit is 1
sta $0400,Y
ply
plx
plp
rts