dos33fsprogs/ootw/physicist.s

250 lines
3.2 KiB
ArmAsm
Raw Normal View History

pstate_table_lo:
.byte <physicist_standing
.byte <physicist_walking
.byte <physicist_running
.byte <physicist_crouching
.byte <physicist_kicking
2019-03-15 17:00:47 +00:00
.byte <physicist_jumping
.byte <physicist_collapsing
pstate_table_hi:
.byte >physicist_standing
.byte >physicist_standing
.byte >physicist_running
.byte >physicist_crouching
.byte >physicist_kicking
2019-03-15 17:00:47 +00:00
.byte >physicist_jumping
.byte >physicist_collapsing
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 short_draw
lda #P_STANDING
sta PHYSICIST_STATE
short_draw:
jmp finally_draw_him
;===================================
; CROUCHING
;===================================
physicist_crouching:
; FIXME: we have an animation?
lda #<crouch2
sta INL
lda #>crouch2
sta INH
jmp finally_draw_him
2019-03-15 17:00:47 +00:00
;===================================
; JUMPING
;===================================
physicist_jumping:
lda GAIT
2019-03-16 16:53:47 +00:00
cmp #32
bcc still_jumping ; blt
2019-03-15 17:00:47 +00:00
lda #0
sta GAIT
2019-03-16 16:53:47 +00:00
lda #P_STANDING
sta PHYSICIST_STATE
jmp physicist_walking
still_jumping:
lsr
and #$fe
tax
lda phys_jump_progression,X
2019-03-15 17:00:47 +00:00
sta INL
lda phys_jump_progression+1,X
2019-03-15 17:00:47 +00:00
sta INH
inc GAIT
lda GAIT
2019-03-16 16:53:47 +00:00
and #$7
bne jump_no_move
2019-03-16 16:53:47 +00:00
lda DIRECTION
beq jump_left
jump_right:
inc PHYSICIST_X
2019-03-16 16:53:47 +00:00
jmp finally_draw_him
jump_left:
dec PHYSICIST_X
jump_no_move:
2019-03-15 17:00:47 +00:00
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
;==================================
; COLLAPSING
;==================================
physicist_collapsing:
lda GAIT
cmp #18
bne collapse_not_done
really_dead:
lda #$ff
sta GAME_OVER
jmp finally_draw_him
collapse_not_done:
ldx GAIT
lda collapse_progression,X
sta INL
lda collapse_progression+1,X
sta INH
lda FRAMEL
and #$1f
bne no_collapse_progress
inc GAIT
inc GAIT
no_collapse_progress:
jmp finally_draw_him
;=============================
; Actually 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