dos33fsprogs/ootw/physicist.s

160 lines
2.1 KiB
ArmAsm
Raw Normal View History

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
2019-01-17 21:58:19 +00:00
;======================================
; draw physicist
;======================================
draw_physicist:
ldx PHYSICIST_STATE
lda pstate_table_lo,x
sta pjump
lda pstate_table_hi,x
sta pjump+1
jmp (pjump)
;==================================
; 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
; If kicking long enough, return to standing
dec GAIT
bne finally_draw_him
lda #P_STANDING
sta PHYSICIST_STATE
jmp finally_draw_him
;===================================
; CROUCHING
;===================================
physicist_crouching:
; FIXME: we have an animation?
lda #<crouch2
sta INL
lda #>crouch2
sta INH
jmp finally_draw_him
;===============================
; Walking
;================================
physicist_walking:
2019-01-17 21:58:19 +00:00
lda GAIT
2019-03-10 06:21:35 +00:00
cmp #40
bcc gait_fine ; blt
lda #0
2019-01-17 21:58:19 +00:00
sta GAIT
2019-03-10 06:21:35 +00:00
gait_fine:
lsr
and #$fe
2019-01-17 21:58:19 +00:00
tax
lda phys_walk_progression,X
sta INL
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:
2019-01-17 21:58:19 +00:00
lda PHYSICIST_X
sta XPOS
2019-01-18 05:18:06 +00:00
2019-01-17 21:58:19 +00:00
lda PHYSICIST_Y
2019-01-18 05:18:06 +00:00
sec
sbc EARTH_OFFSET ; adjust for earthquakes
2019-01-17 21:58:19 +00:00
sta YPOS
lda DIRECTION
bne facing_right
facing_left:
jmp put_sprite
facing_right:
jmp put_sprite_flipped