mirror of
https://github.com/deater/dos33fsprogs.git
synced 2025-01-16 11:30:55 +00:00
ootw: optimize keyboard/state handling a bit
add some additional state bits
This commit is contained in:
parent
f1cf10b0b8
commit
98c083f232
@ -22,18 +22,7 @@
|
||||
handle_keypress:
|
||||
|
||||
lda PHYSICIST_STATE
|
||||
cmp #P_COLLAPSING ; ignore keypress if dying
|
||||
beq no_keypress
|
||||
cmp #P_JUMPING ; ignore keypress if jumping
|
||||
beq no_keypress
|
||||
cmp #P_SWINGING
|
||||
beq no_keypress
|
||||
cmp #P_FALLING_SIDEWAYS
|
||||
beq no_keypress
|
||||
cmp #P_FALLING_DOWN
|
||||
beq no_keypress
|
||||
cmp #P_IMPALED
|
||||
beq no_keypress
|
||||
bmi no_keypress ; ignore keypress if dying/action
|
||||
|
||||
lda KEYPRESS ; 4
|
||||
bmi keypress ; 3
|
||||
@ -91,8 +80,8 @@ left_going_left:
|
||||
beq walk_left
|
||||
cmp #P_WALKING
|
||||
beq run_left
|
||||
cmp #P_CROUCHING
|
||||
beq stand_left
|
||||
and #STATE_CROUCHING
|
||||
bne stand_left
|
||||
|
||||
;=============================
|
||||
; already running, do nothing?
|
||||
@ -108,9 +97,8 @@ left_going_right:
|
||||
beq stand_left
|
||||
cmp #P_SHOOTING
|
||||
beq stand_left
|
||||
|
||||
cmp #P_CROUCHING
|
||||
beq stand_left
|
||||
and #STATE_CROUCHING
|
||||
bne stand_left
|
||||
|
||||
;===========================
|
||||
; otherwise?
|
||||
@ -146,8 +134,8 @@ right_going_right:
|
||||
beq walk_right
|
||||
cmp #P_WALKING
|
||||
beq run_right
|
||||
cmp #P_CROUCHING
|
||||
beq stand_right
|
||||
and #STATE_CROUCHING
|
||||
bne stand_right
|
||||
|
||||
;=============================
|
||||
; already running, do nothing?
|
||||
@ -163,8 +151,9 @@ right_going_left:
|
||||
beq stand_right
|
||||
cmp #P_SHOOTING
|
||||
beq stand_right
|
||||
cmp #P_CROUCHING
|
||||
beq stand_right
|
||||
and #STATE_CROUCHING
|
||||
bne stand_right
|
||||
|
||||
|
||||
;===========================
|
||||
; otherwise?
|
||||
|
@ -382,6 +382,8 @@ crouch2:
|
||||
;=====================
|
||||
;=====================
|
||||
|
||||
; see physicist_l1_swim.inc
|
||||
|
||||
;=====================
|
||||
;=====================
|
||||
; COLLAPSING
|
||||
@ -585,3 +587,118 @@ physicist_spike_sprite:
|
||||
.byte $BB,$A9,$BB
|
||||
.byte $BB,$AA,$BB
|
||||
|
||||
|
||||
|
||||
;=====================
|
||||
;=====================
|
||||
; CROUCH SHOOTING
|
||||
;=====================
|
||||
;=====================
|
||||
|
||||
crouch_shooting:
|
||||
.byte 3,8
|
||||
.byte $aa,$aa,$aa
|
||||
.byte $aa,$aa,$aa
|
||||
.byte $9a,$9a,$aa
|
||||
.byte $bb,$99,$aa
|
||||
.byte $aa,$0b,$0a
|
||||
.byte $aa,$bb,$00
|
||||
.byte $ba,$4b,$aa
|
||||
.byte $54,$f4,$f4
|
||||
|
||||
;=====================
|
||||
;=====================
|
||||
; CROUCH KICKING
|
||||
;=====================
|
||||
;=====================
|
||||
|
||||
crouch_kicking:
|
||||
.byte 3,8
|
||||
.byte $aa,$aa,$aa
|
||||
.byte $aa,$aa,$aa
|
||||
.byte $9a,$9a,$aa
|
||||
.byte $bb,$99,$aa
|
||||
.byte $aa,$0b,$0a
|
||||
.byte $aa,$bb,$00
|
||||
.byte $ba,$4b,$aa
|
||||
.byte $54,$f4,$f4
|
||||
|
||||
|
||||
|
||||
|
||||
;=====================
|
||||
;=====================
|
||||
; DISINTEGRATING
|
||||
;=====================
|
||||
;=====================
|
||||
|
||||
disintegrate_progression:
|
||||
.word disintegrate1 ; 00
|
||||
.word disintegrate2 ; 02
|
||||
.word disintegrate3 ; 04
|
||||
.word disintegrate4 ; 06
|
||||
.word disintegrate5 ; 08
|
||||
.word disintegrate5 ; 10
|
||||
.word disintegrate5 ; 12
|
||||
.word disintegrate5 ; 14
|
||||
.word disintegrate5 ; 16
|
||||
|
||||
disintegrate1:
|
||||
.byte 4,8
|
||||
.byte $9a,$9a,$aa,$aa
|
||||
.byte $ab,$99,$aa,$aa
|
||||
.byte $aa,$0b,$aa,$aa
|
||||
.byte $aa,$bb,$aa,$aa
|
||||
.byte $aa,$bb,$aa,$aa
|
||||
.byte $aa,$44,$aa,$aa
|
||||
.byte $aa,$a4,$4a,$aa
|
||||
.byte $aa,$fa,$f4,$aa
|
||||
|
||||
|
||||
disintegrate2:
|
||||
.byte 5,8
|
||||
.byte $aa,$aa,$aa,$aa,$aa
|
||||
.byte $b9,$99,$aa,$aa,$aa
|
||||
.byte $ab,$b9,$aa,$aa,$aa
|
||||
.byte $aa,$b0,$aa,$aa,$aa
|
||||
.byte $aa,$bb,$00,$aa,$aa
|
||||
.byte $aa,$bb,$44,$4a,$aa
|
||||
.byte $aa,$ab,$aa,$a4,$4a
|
||||
.byte $aa,$aa,$aa,$fa,$f4
|
||||
|
||||
|
||||
|
||||
disintegrate3:
|
||||
.byte 6,8
|
||||
.byte $aa,$aa,$aa,$aa,$aa,$aa
|
||||
.byte $aa,$aa,$aa,$aa,$aa,$aa
|
||||
.byte $9a,$9a,$aa,$aa,$aa,$aa
|
||||
.byte $bb,$99,$aa,$aa,$aa,$aa
|
||||
.byte $aa,$0b,$0a,$aa,$aa,$aa
|
||||
.byte $aa,$bb,$00,$4a,$aa,$aa
|
||||
.byte $aa,$bb,$a0,$44,$44,$fa
|
||||
.byte $aa,$ab,$aa,$aa,$a4,$ff
|
||||
|
||||
disintegrate4:
|
||||
.byte 7,8
|
||||
.byte $aa,$aa,$aa,$aa,$aa,$aa,$aa
|
||||
.byte $aa,$aa,$aa,$aa,$aa,$aa,$aa
|
||||
.byte $aa,$aa,$aa,$aa,$aa,$aa,$aa
|
||||
.byte $aa,$aa,$aa,$aa,$aa,$aa,$aa
|
||||
.byte $9a,$9a,$aa,$aa,$aa,$aa,$aa
|
||||
.byte $99,$bb,$00,$0a,$aa,$aa,$aa
|
||||
.byte $aa,$aa,$bb,$00,$44,$4a,$fa
|
||||
.byte $aa,$aa,$aa,$bb,$aa,$a4,$ff
|
||||
|
||||
|
||||
disintegrate5:
|
||||
.byte 8,8
|
||||
.byte $aa,$aa,$aa,$aa,$aa,$aa,$aa,$aa
|
||||
.byte $aa,$aa,$aa,$aa,$aa,$aa,$aa,$aa
|
||||
.byte $aa,$aa,$aa,$aa,$aa,$aa,$aa,$aa
|
||||
.byte $aa,$aa,$aa,$aa,$aa,$aa,$aa,$aa
|
||||
.byte $aa,$aa,$aa,$aa,$aa,$aa,$aa,$aa
|
||||
.byte $aa,$aa,$aa,$aa,$aa,$aa,$aa,$aa
|
||||
.byte $99,$b9,$00,$b0,$00,$bb,$4a,$aa
|
||||
.byte $a9,$ab,$aa,$aa,$bb,$b4,$44,$ff
|
||||
|
||||
|
@ -75,6 +75,10 @@ pstate_table_lo:
|
||||
.byte <physicist_shooting ; 0B
|
||||
.byte <physicist_falling_down ; 0C
|
||||
.byte <physicist_impaled ; 0D
|
||||
.byte <physicist_crouch_shooting; 0E
|
||||
.byte <physicist_crouch_kicking ; 0F
|
||||
.byte <physicist_disintegrating ; 10
|
||||
|
||||
|
||||
pstate_table_hi:
|
||||
.byte >physicist_standing
|
||||
@ -91,6 +95,9 @@ pstate_table_hi:
|
||||
.byte >physicist_shooting ; 0B
|
||||
.byte >physicist_falling_down ; 0C
|
||||
.byte >physicist_impaled ; 0D
|
||||
.byte >physicist_crouch_shooting; 0E
|
||||
.byte >physicist_crouch_kicking ; 0F
|
||||
.byte >physicist_disintegrating ; 10
|
||||
|
||||
; Urgh, make sure this doesn't end up at $FF or you hit the
|
||||
; NMOS 6502 bug
|
||||
@ -108,7 +115,9 @@ pjump:
|
||||
|
||||
draw_physicist:
|
||||
|
||||
ldx PHYSICIST_STATE
|
||||
lda PHYSICIST_STATE
|
||||
and #$1f ; mask off high state bits
|
||||
tax
|
||||
lda pstate_table_lo,x
|
||||
sta pjump
|
||||
lda pstate_table_hi,x
|
||||
@ -183,6 +192,35 @@ physicist_crouching:
|
||||
|
||||
jmp finally_draw_him
|
||||
|
||||
;===================================
|
||||
; CROUCH KICKING
|
||||
;===================================
|
||||
|
||||
physicist_crouch_kicking:
|
||||
|
||||
lda #<crouch_kicking
|
||||
sta INL
|
||||
|
||||
lda #>crouch_kicking
|
||||
sta INH
|
||||
|
||||
jmp finally_draw_him
|
||||
|
||||
;===================================
|
||||
; CROUCH SHOOTING
|
||||
;===================================
|
||||
|
||||
physicist_crouch_shooting:
|
||||
|
||||
lda #<crouch_shooting
|
||||
sta INL
|
||||
|
||||
lda #>crouch_shooting
|
||||
sta INH
|
||||
|
||||
jmp finally_draw_him
|
||||
|
||||
|
||||
;===================================
|
||||
; JUMPING
|
||||
;===================================
|
||||
@ -322,6 +360,43 @@ no_collapse_progress:
|
||||
|
||||
jmp finally_draw_him
|
||||
|
||||
;==================================
|
||||
; DISINTEGRATING
|
||||
;==================================
|
||||
|
||||
physicist_disintegrating:
|
||||
|
||||
lda GAIT
|
||||
cmp #18
|
||||
bne disintegrate_not_done
|
||||
|
||||
disintegrate_really_dead:
|
||||
lda #$ff
|
||||
sta GAME_OVER
|
||||
jmp finally_draw_him
|
||||
|
||||
disintegrate_not_done:
|
||||
|
||||
ldx GAIT
|
||||
|
||||
lda disintegrate_progression,X
|
||||
sta INL
|
||||
lda disintegrate_progression+1,X
|
||||
sta INH
|
||||
|
||||
lda FRAMEL
|
||||
and #$1f
|
||||
bne no_disintegrate_progress
|
||||
|
||||
inc GAIT
|
||||
inc GAIT
|
||||
|
||||
no_disintegrate_progress:
|
||||
|
||||
|
||||
jmp finally_draw_him
|
||||
|
||||
|
||||
|
||||
;==================================
|
||||
; FALLING SIDEWAYS
|
||||
|
21
ootw/zp.inc
21
ootw/zp.inc
@ -195,22 +195,27 @@ BOULDER_Y = $E9 ; C1
|
||||
SHOOTING_TOP = $E9 ; C1 cage
|
||||
DUDE_X = $E9 ; C2 jail
|
||||
|
||||
STATE_NO_KEYPRESS = $80
|
||||
STATE_CROUCHING = $40
|
||||
|
||||
PHYSICIST_STATE = $EA
|
||||
P_STANDING = $00
|
||||
P_WALKING = $01
|
||||
P_RUNNING = $02
|
||||
P_CROUCHING = $03
|
||||
P_CROUCHING = $03 | STATE_CROUCHING
|
||||
P_KICKING = $04
|
||||
P_JUMPING = $05 ; no keypress
|
||||
P_COLLAPSING = $06 ; no keypress
|
||||
P_FALLING_SIDEWAYS = $07 ; no keypress
|
||||
P_SWINGING = $08 ; no keypress
|
||||
P_JUMPING = $05 | STATE_NO_KEYPRESS
|
||||
P_COLLAPSING = $06 | STATE_NO_KEYPRESS
|
||||
P_FALLING_SIDEWAYS = $07 | STATE_NO_KEYPRESS
|
||||
P_SWINGING = $08 | STATE_NO_KEYPRESS
|
||||
P_ELEVATING_UP = $09
|
||||
P_ELEVATING_DOWN = $0A
|
||||
P_SHOOTING = $0B
|
||||
P_FALLING_DOWN = $0C
|
||||
P_IMPALED = $0D
|
||||
P_CROUCH_SHOOTING = $0E
|
||||
P_FALLING_DOWN = $0C | STATE_NO_KEYPRESS
|
||||
P_IMPALED = $0D | STATE_NO_KEYPRESS
|
||||
P_CROUCH_SHOOTING = $0E | STATE_CROUCHING
|
||||
P_CROUCH_KICKING = $0F | STATE_CROUCHING
|
||||
P_DISINTEGRATING = $10 | STATE_NO_KEYPRESS
|
||||
|
||||
BUBBLES_Y = $EB ; C1 underwater
|
||||
BEFORE_SWING = $EB ; C1
|
||||
|
Loading…
x
Reference in New Issue
Block a user