ootw: centralize gun handling, level5 now works properly

This commit is contained in:
Vince Weaver 2019-08-16 10:12:44 -04:00
parent 324d8c6526
commit 4419a7e0d8
5 changed files with 69 additions and 116 deletions

View File

@ -5,9 +5,59 @@
; we handle that here
;===================================
; handle/draw all gun related stuff
;===================================
handle_gun:
;===================
; ???
;===================
jsr handle_gun2
;=======================
; draw gun charge effect
;=======================
jsr draw_gun_charging
;================
; move laser
;================
jsr move_laser
;================
; draw laser
;================
jsr draw_laser
;================
; move blast
;================
jsr move_blast
;================
; draw blast
;================
jsr draw_blast
;================
; draw shields
;================
jmp draw_shields
; rts
handle_gun2:
lda HAVE_GUN ; no gun, do nothing
beq done_gun
beq no_have_gun
;================
; fire laser
@ -70,20 +120,23 @@ done_firing:
lda #0
sta GUN_STATE
done_gun:
no_have_gun:
lda #0
sta GUN_FIRE
rts
draw_gun:
;============================
; draw gun charging effect
;============================
draw_gun_charging:
lda HAVE_GUN ; no gun, do nothing
beq done_draw_gun
beq done_draw_gun_charging
lda GUN_STATE ; gun not charging, do nothing
beq done_draw_gun
beq done_draw_gun_charging
; set direction
@ -125,7 +178,7 @@ done_zap:
jsr put_sprite
done_draw_gun:
done_draw_gun_charging:
rts
; progression

View File

@ -22,6 +22,7 @@ ootw_elevator:
;==============================
; setup per-room variables
check_elevator7:
lda WHICH_JAIL
cmp #7
@ -222,42 +223,6 @@ draw_elevator:
jsr handle_gun
;================
; draw gun effect
;================
jsr draw_gun
;================
; move laser
;================
jsr move_laser
;================
; draw laser
;================
jsr draw_laser
;================
; move blast
;================
jsr move_blast
;================
; draw blast
;================
jsr draw_blast
;================
; draw shields
;================
jsr draw_shields
;===============
; page flip

View File

@ -487,49 +487,12 @@ c2_done_draw_friend:
jsr draw_alien
no_draw_alien:
;================
; handle gun
;================
jsr handle_gun
;================
; draw gun effect
;================
jsr draw_gun
;================
; move laser
;================
jsr move_laser
;================
; draw laser
;================
jsr draw_laser
;================
; move blast
;================
jsr move_blast
;================
; draw blast
;================
jsr draw_blast
;================
; draw shields
;================
jsr draw_shields
;================
; handle doors
;================

View File

@ -643,43 +643,7 @@ no_draw_alien:
; handle gun
;================
jsr handle_gun
;================
; draw gun effect
;================
jsr draw_gun
;================
; move laser
;================
jsr move_laser
;================
; draw laser
;================
jsr draw_laser
;================
; move blast
;================
jsr move_blast
;================
; draw blast
;================
jsr draw_blast
;================
; draw shields
;================
jsr draw_shields
jsr handle_gun
;================
; handle doors

View File

@ -7,6 +7,7 @@ ootw_cave_init:
sta WHICH_CAVE
; yes you fall in facing left for some reason
sta DIRECTION ; left
sta NUM_DOORS
lda #1
sta HAVE_GUN
@ -42,6 +43,8 @@ ootw_cave:
lda WHICH_CAVE
bne cave1
jsr init_shields
; Room0 entrance
cave0:
lda #(0+128)
@ -232,6 +235,11 @@ check_floor1:
jsr draw_physicist
;===============
; handle gun
jsr handle_gun
;========================
; draw foreground action