mirror of
https://github.com/deater/dos33fsprogs.git
synced 2025-01-14 13:33:48 +00:00
ootw: change the physicist state machine to be more compact
This commit is contained in:
parent
eb8544113c
commit
2ff3a299f9
@ -33,8 +33,8 @@ left:
|
||||
|
||||
; walk left
|
||||
|
||||
lda #0
|
||||
sta CROUCHING ; stanid crouching
|
||||
lda #P_WALKING
|
||||
sta PHYSICIST_STATE ; stand from crouching
|
||||
|
||||
lda DIRECTION ; if facing right, turn to face left
|
||||
bne face_left
|
||||
@ -75,8 +75,8 @@ check_right:
|
||||
cmp #$15
|
||||
bne check_down
|
||||
right:
|
||||
lda #0
|
||||
sta CROUCHING
|
||||
lda #P_WALKING
|
||||
sta PHYSICIST_STATE
|
||||
|
||||
lda DIRECTION
|
||||
beq face_right
|
||||
@ -119,8 +119,8 @@ check_down:
|
||||
cmp #$0A
|
||||
bne check_space
|
||||
down:
|
||||
lda #48
|
||||
sta CROUCHING
|
||||
lda #P_CROUCHING
|
||||
sta PHYSICIST_STATE
|
||||
lda #0
|
||||
sta GAIT
|
||||
|
||||
@ -132,9 +132,9 @@ check_space:
|
||||
cmp #$15
|
||||
bne unknown
|
||||
space:
|
||||
lda #P_KICKING
|
||||
sta PHYSICIST_STATE
|
||||
lda #15
|
||||
sta KICKING
|
||||
lda #0
|
||||
sta GAIT
|
||||
unknown:
|
||||
done_keypress:
|
||||
|
@ -14,8 +14,7 @@ ootw:
|
||||
sta GAME_OVER
|
||||
sta EQUAKE_PROGRESS
|
||||
sta EARTH_OFFSET
|
||||
sta KICKING
|
||||
sta CROUCHING
|
||||
sta PHYSICIST_STATE
|
||||
sta WHICH_CAVE
|
||||
sta BEAST_OUT
|
||||
|
||||
|
@ -13,8 +13,7 @@ ootw_c2:
|
||||
|
||||
lda #0
|
||||
sta GAME_OVER
|
||||
sta KICKING
|
||||
sta CROUCHING
|
||||
sta PHYSICIST_STATE
|
||||
|
||||
lda #22
|
||||
sta PHYSICIST_Y
|
||||
|
106
ootw/physicist.s
106
ootw/physicist.s
@ -1,31 +1,73 @@
|
||||
pstate_table_lo:
|
||||
.byte <physicist_standing
|
||||
.byte <physicist_walking
|
||||
.byte <physicist_running
|
||||
.byte <physicist_crouching
|
||||
.byte <physicist_kicking
|
||||
pstate_table_hi:
|
||||
.byte >physicist_standing
|
||||
.byte >physicist_standing
|
||||
.byte >physicist_running
|
||||
.byte >physicist_crouching
|
||||
.byte >physicist_kicking
|
||||
|
||||
pjump:
|
||||
.word $0000
|
||||
|
||||
;======================================
|
||||
; draw physicist
|
||||
;======================================
|
||||
|
||||
draw_physicist:
|
||||
|
||||
; FIXME: what happens if crouch+kick
|
||||
; or crouch+walk?
|
||||
ldx PHYSICIST_STATE
|
||||
lda pstate_table_lo,x
|
||||
sta pjump
|
||||
lda pstate_table_hi,x
|
||||
sta pjump+1
|
||||
jmp (pjump)
|
||||
|
||||
check_if_still_kicking:
|
||||
lda KICKING
|
||||
beq check_crouching
|
||||
kicking:
|
||||
|
||||
;==================================
|
||||
; STANDING
|
||||
;==================================
|
||||
|
||||
physicist_standing:
|
||||
|
||||
lda #<phys_stand
|
||||
sta INL
|
||||
|
||||
lda #>phys_stand
|
||||
sta INH
|
||||
|
||||
jmp finally_draw_him
|
||||
|
||||
;==================================
|
||||
; KICKING
|
||||
;==================================
|
||||
|
||||
physicist_kicking:
|
||||
lda #<kick1
|
||||
sta INL
|
||||
|
||||
lda #>kick1
|
||||
sta INH
|
||||
|
||||
dec KICKING
|
||||
; If kicking long enough, return to standing
|
||||
|
||||
dec GAIT
|
||||
bne finally_draw_him
|
||||
|
||||
lda #P_STANDING
|
||||
sta PHYSICIST_STATE
|
||||
|
||||
jmp finally_draw_him
|
||||
|
||||
check_crouching:
|
||||
lda CROUCHING
|
||||
beq walking
|
||||
;===================================
|
||||
; CROUCHING
|
||||
;===================================
|
||||
|
||||
crouching:
|
||||
physicist_crouching:
|
||||
|
||||
; FIXME: we have an animation?
|
||||
|
||||
@ -37,7 +79,12 @@ crouching:
|
||||
|
||||
jmp finally_draw_him
|
||||
|
||||
walking:
|
||||
|
||||
;===============================
|
||||
; Walking
|
||||
;================================
|
||||
|
||||
physicist_walking:
|
||||
lda GAIT
|
||||
cmp #40
|
||||
bcc gait_fine ; blt
|
||||
@ -57,6 +104,41 @@ gait_fine:
|
||||
lda phys_walk_progression+1,X
|
||||
sta INH
|
||||
|
||||
jmp finally_draw_him
|
||||
|
||||
;===============================
|
||||
; Running
|
||||
;================================
|
||||
|
||||
physicist_running:
|
||||
lda GAIT
|
||||
cmp #40
|
||||
bcc run_gait_fine ; blt
|
||||
|
||||
lda #0
|
||||
sta GAIT
|
||||
|
||||
run_gait_fine:
|
||||
lsr
|
||||
and #$fe
|
||||
|
||||
tax
|
||||
|
||||
lda phys_run_progression,X
|
||||
sta INL
|
||||
|
||||
lda phys_run_progression+1,X
|
||||
sta INH
|
||||
|
||||
jmp finally_draw_him
|
||||
|
||||
|
||||
|
||||
;=============================
|
||||
; Actuall Draw Him
|
||||
;=============================
|
||||
|
||||
|
||||
finally_draw_him:
|
||||
lda PHYSICIST_X
|
||||
sta XPOS
|
||||
|
@ -183,7 +183,8 @@ check_kicked:
|
||||
;==================
|
||||
; see if kicked
|
||||
|
||||
lda KICKING
|
||||
lda PHYSICIST_STATE
|
||||
cmp #P_KICKING
|
||||
beq check_attack
|
||||
|
||||
lda PHYSICIST_X
|
||||
|
11
ootw/zp.inc
11
ootw/zp.inc
@ -155,8 +155,15 @@ MESSAGE_COUNT = $E7
|
||||
|
||||
BOULDER_X = $E8
|
||||
BOULDER_Y = $E9
|
||||
CROUCHING = $EA
|
||||
KICKING = $EB
|
||||
PHYSICIST_STATE = $EA
|
||||
P_STANDING = $00
|
||||
P_WALKING = $01
|
||||
P_RUNNING = $02
|
||||
P_CROUCHING = $03
|
||||
P_KICKING = $04
|
||||
|
||||
; CROUCHING = $EA
|
||||
; KICKING = $EB
|
||||
CUTFRAME = $EC
|
||||
DISP_PAGE = $ED
|
||||
DRAW_PAGE = $EE
|
||||
|
Loading…
x
Reference in New Issue
Block a user