2019-03-23 17:20:43 +00:00
|
|
|
;=======================================
|
|
|
|
; Move physicist based on current state
|
2019-03-23 17:34:12 +00:00
|
|
|
;
|
2019-03-23 17:20:43 +00:00
|
|
|
|
|
|
|
move_physicist:
|
|
|
|
lda PHYSICIST_STATE
|
|
|
|
cmp #P_WALKING
|
|
|
|
beq move_physicist_walking
|
|
|
|
cmp #P_RUNNING
|
|
|
|
beq move_physicist_running
|
|
|
|
rts
|
|
|
|
|
|
|
|
;======================
|
|
|
|
; walking
|
|
|
|
|
|
|
|
move_physicist_walking:
|
|
|
|
inc GAIT ; cycle through animation
|
|
|
|
|
|
|
|
lda GAIT
|
|
|
|
and #$7
|
2019-03-23 17:34:12 +00:00
|
|
|
cmp #$4 ; only walk roughly 1/8 of time
|
2019-03-23 17:20:43 +00:00
|
|
|
bne no_move_walk
|
|
|
|
|
|
|
|
lda DIRECTION
|
|
|
|
beq p_walk_left
|
|
|
|
|
|
|
|
inc PHYSICIST_X ; walk right
|
|
|
|
rts
|
|
|
|
p_walk_left:
|
|
|
|
dec PHYSICIST_X ; walk left
|
|
|
|
no_move_walk:
|
|
|
|
rts
|
|
|
|
|
|
|
|
;======================
|
|
|
|
; running
|
|
|
|
move_physicist_running:
|
2019-03-23 17:34:12 +00:00
|
|
|
; inc GAIT ; cycle through animation
|
2019-03-23 17:20:43 +00:00
|
|
|
inc GAIT ; cycle through animation
|
2019-03-23 17:34:12 +00:00
|
|
|
|
|
|
|
lda GAIT
|
|
|
|
and #$3
|
|
|
|
cmp #$2 ; only run roughly 1/4 of time
|
|
|
|
bne no_move_run
|
2019-03-23 17:20:43 +00:00
|
|
|
|
|
|
|
lda DIRECTION
|
|
|
|
beq p_run_left
|
|
|
|
|
|
|
|
inc PHYSICIST_X ; run right
|
|
|
|
rts
|
|
|
|
p_run_left:
|
|
|
|
dec PHYSICIST_X ; run left
|
2019-03-23 17:34:12 +00:00
|
|
|
no_move_run:
|
2019-03-23 17:20:43 +00:00
|
|
|
rts
|
|
|
|
;======================
|
|
|
|
; standing
|
|
|
|
|
|
|
|
move_physicist_standing:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2019-03-15 16:28:46 +00:00
|
|
|
pstate_table_lo:
|
2019-03-17 05:28:42 +00:00
|
|
|
.byte <physicist_standing ; 00
|
|
|
|
.byte <physicist_walking ; 01
|
|
|
|
.byte <physicist_running ; 02
|
|
|
|
.byte <physicist_crouching ; 03
|
|
|
|
.byte <physicist_kicking ; 04
|
|
|
|
.byte <physicist_jumping ; 05
|
|
|
|
.byte <physicist_collapsing ; 06
|
2019-08-09 16:54:52 +00:00
|
|
|
.byte <physicist_falling_sideways; 07
|
2019-07-11 16:30:34 +00:00
|
|
|
.byte <physicist_standing ; 08 swinging
|
|
|
|
.byte <physicist_standing ; 09 elevator up
|
|
|
|
.byte <physicist_standing ; 0A elevator down
|
2019-08-09 04:37:07 +00:00
|
|
|
.byte <physicist_shooting ; 0B
|
2019-08-09 16:54:52 +00:00
|
|
|
.byte <physicist_falling_down ; 0C
|
2019-08-09 17:58:58 +00:00
|
|
|
.byte <physicist_impaled ; 0D
|
2019-08-16 15:49:40 +00:00
|
|
|
.byte <physicist_crouch_shooting; 0E
|
|
|
|
.byte <physicist_crouch_kicking ; 0F
|
|
|
|
.byte <physicist_disintegrating ; 10
|
|
|
|
|
2019-07-11 16:30:34 +00:00
|
|
|
|
2019-03-15 16:28:46 +00:00
|
|
|
pstate_table_hi:
|
|
|
|
.byte >physicist_standing
|
2019-03-17 05:28:42 +00:00
|
|
|
.byte >physicist_walking
|
2019-03-15 16:28:46 +00:00
|
|
|
.byte >physicist_running
|
|
|
|
.byte >physicist_crouching
|
|
|
|
.byte >physicist_kicking
|
2019-03-15 17:00:47 +00:00
|
|
|
.byte >physicist_jumping
|
2019-03-15 17:47:41 +00:00
|
|
|
.byte >physicist_collapsing
|
2019-08-09 16:54:52 +00:00
|
|
|
.byte >physicist_falling_sideways
|
2019-07-11 16:30:34 +00:00
|
|
|
.byte >physicist_standing ; 08 swinging
|
|
|
|
.byte >physicist_standing ; 09 elevator up
|
|
|
|
.byte >physicist_standing ; 0A elevator down
|
2019-08-09 04:37:07 +00:00
|
|
|
.byte >physicist_shooting ; 0B
|
2019-08-09 16:54:52 +00:00
|
|
|
.byte >physicist_falling_down ; 0C
|
2019-08-09 17:58:58 +00:00
|
|
|
.byte >physicist_impaled ; 0D
|
2019-08-16 15:49:40 +00:00
|
|
|
.byte >physicist_crouch_shooting; 0E
|
|
|
|
.byte >physicist_crouch_kicking ; 0F
|
|
|
|
.byte >physicist_disintegrating ; 10
|
2019-03-15 16:28:46 +00:00
|
|
|
|
2019-03-16 18:17:20 +00:00
|
|
|
; Urgh, make sure this doesn't end up at $FF or you hit the
|
|
|
|
; NMOS 6502 bug
|
|
|
|
|
|
|
|
.align 2
|
|
|
|
|
2019-03-15 16:28:46 +00:00
|
|
|
pjump:
|
|
|
|
.word $0000
|
|
|
|
|
2019-03-16 18:17:20 +00:00
|
|
|
.align 1
|
|
|
|
|
2019-01-17 21:58:19 +00:00
|
|
|
;======================================
|
|
|
|
; draw physicist
|
|
|
|
;======================================
|
|
|
|
|
|
|
|
draw_physicist:
|
|
|
|
|
2019-08-16 15:49:40 +00:00
|
|
|
lda PHYSICIST_STATE
|
|
|
|
and #$1f ; mask off high state bits
|
|
|
|
tax
|
2019-03-15 16:28:46 +00:00
|
|
|
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
|
|
|
|
|
2019-08-09 04:37:07 +00:00
|
|
|
;==================================
|
|
|
|
; SHOOTING
|
|
|
|
;==================================
|
|
|
|
|
|
|
|
physicist_shooting:
|
|
|
|
|
|
|
|
lda #<shooting1
|
|
|
|
sta INL
|
|
|
|
|
|
|
|
lda #>shooting1
|
|
|
|
sta INH
|
|
|
|
|
|
|
|
jmp finally_draw_him
|
|
|
|
|
|
|
|
|
2019-03-15 16:28:46 +00:00
|
|
|
;==================================
|
|
|
|
; KICKING
|
|
|
|
;==================================
|
2019-01-18 16:33:23 +00:00
|
|
|
|
2019-03-15 16:28:46 +00:00
|
|
|
physicist_kicking:
|
2019-01-18 16:33:23 +00:00
|
|
|
lda #<kick1
|
|
|
|
sta INL
|
|
|
|
|
|
|
|
lda #>kick1
|
|
|
|
sta INH
|
|
|
|
|
2019-03-15 16:28:46 +00:00
|
|
|
; If kicking long enough, return to standing
|
|
|
|
|
|
|
|
dec GAIT
|
2019-03-15 21:08:18 +00:00
|
|
|
bne short_draw
|
2019-03-15 16:28:46 +00:00
|
|
|
|
|
|
|
lda #P_STANDING
|
|
|
|
sta PHYSICIST_STATE
|
2019-01-18 16:33:23 +00:00
|
|
|
|
2019-03-15 21:08:18 +00:00
|
|
|
short_draw:
|
2019-01-18 16:33:23 +00:00
|
|
|
jmp finally_draw_him
|
|
|
|
|
2019-03-15 16:28:46 +00:00
|
|
|
;===================================
|
|
|
|
; CROUCHING
|
|
|
|
;===================================
|
2019-01-18 16:33:23 +00:00
|
|
|
|
2019-03-15 16:28:46 +00:00
|
|
|
physicist_crouching:
|
2019-01-18 16:33:23 +00:00
|
|
|
|
|
|
|
; FIXME: we have an animation?
|
|
|
|
|
2019-08-17 19:51:15 +00:00
|
|
|
; if we have some gait left, slide a bit
|
|
|
|
lda GAIT
|
|
|
|
beq crouch_done_slide
|
|
|
|
|
|
|
|
dec GAIT
|
|
|
|
bne crouch_done_slide
|
|
|
|
|
|
|
|
lda DIRECTION
|
|
|
|
beq p_slide_left
|
|
|
|
inc PHYSICIST_X
|
|
|
|
jmp crouch_done_slide
|
|
|
|
p_slide_left:
|
|
|
|
dec PHYSICIST_X
|
|
|
|
|
|
|
|
crouch_done_slide:
|
|
|
|
|
2019-01-18 16:33:23 +00:00
|
|
|
lda #<crouch2
|
|
|
|
sta INL
|
|
|
|
|
|
|
|
lda #>crouch2
|
|
|
|
sta INH
|
|
|
|
|
|
|
|
jmp finally_draw_him
|
|
|
|
|
2019-08-16 15:49:40 +00:00
|
|
|
;===================================
|
|
|
|
; CROUCH KICKING
|
|
|
|
;===================================
|
|
|
|
|
|
|
|
physicist_crouch_kicking:
|
|
|
|
|
2019-08-16 20:32:59 +00:00
|
|
|
dec GAIT
|
|
|
|
lda GAIT
|
|
|
|
bpl still_kicking
|
|
|
|
|
|
|
|
lda #P_CROUCHING
|
|
|
|
sta PHYSICIST_STATE
|
|
|
|
|
|
|
|
still_kicking:
|
|
|
|
|
2019-08-16 15:49:40 +00:00
|
|
|
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
|
|
|
|
|
|
|
|
|
2019-03-15 17:00:47 +00:00
|
|
|
;===================================
|
|
|
|
; JUMPING
|
|
|
|
;===================================
|
|
|
|
|
|
|
|
physicist_jumping:
|
|
|
|
|
2019-03-15 21:08:18 +00:00
|
|
|
lda GAIT
|
2019-03-16 16:53:47 +00:00
|
|
|
cmp #32
|
2019-03-15 21:08:18 +00:00
|
|
|
bcc still_jumping ; blt
|
2019-03-15 17:00:47 +00:00
|
|
|
|
2019-08-17 19:27:17 +00:00
|
|
|
; done juming
|
|
|
|
lda #STATE_RUNNING
|
|
|
|
bit PHYSICIST_STATE
|
|
|
|
beq jump_to_stand
|
|
|
|
|
|
|
|
jump_to_run:
|
|
|
|
lda #0
|
|
|
|
sta GAIT
|
|
|
|
lda #P_RUNNING
|
|
|
|
sta PHYSICIST_STATE
|
|
|
|
jmp physicist_running
|
|
|
|
|
|
|
|
jump_to_stand:
|
2019-03-15 21:08:18 +00:00
|
|
|
lda #0
|
|
|
|
sta GAIT
|
2019-03-16 16:53:47 +00:00
|
|
|
lda #P_STANDING
|
2019-03-15 21:08:18 +00:00
|
|
|
sta PHYSICIST_STATE
|
2019-08-17 19:27:17 +00:00
|
|
|
jmp physicist_standing
|
2019-03-15 21:08:18 +00:00
|
|
|
|
|
|
|
still_jumping:
|
|
|
|
|
|
|
|
lsr
|
|
|
|
and #$fe
|
|
|
|
|
|
|
|
tax
|
|
|
|
|
|
|
|
lda phys_jump_progression,X
|
2019-03-15 17:00:47 +00:00
|
|
|
sta INL
|
|
|
|
|
2019-03-15 21:08:18 +00:00
|
|
|
lda phys_jump_progression+1,X
|
2019-03-15 17:00:47 +00:00
|
|
|
sta INH
|
|
|
|
|
2019-03-15 21:08:18 +00:00
|
|
|
inc GAIT
|
|
|
|
|
2019-08-17 19:27:17 +00:00
|
|
|
lda #STATE_RUNNING
|
|
|
|
bit PHYSICIST_STATE
|
|
|
|
beq jump_change_x_regular
|
|
|
|
|
|
|
|
jump_change_x_running:
|
2019-03-15 21:08:18 +00:00
|
|
|
lda GAIT
|
2019-08-17 19:27:17 +00:00
|
|
|
; 1/4 not enough, 1/2 too much
|
|
|
|
; 3/8?
|
2019-03-16 16:53:47 +00:00
|
|
|
and #$7
|
2019-08-17 19:27:17 +00:00
|
|
|
cmp #5
|
|
|
|
bcc jump_no_move
|
|
|
|
jmp jump_change_x
|
2019-03-15 21:08:18 +00:00
|
|
|
|
2019-08-17 19:27:17 +00:00
|
|
|
; only change X every 8th frame
|
|
|
|
jump_change_x_regular:
|
|
|
|
lda GAIT
|
|
|
|
and #$7
|
|
|
|
bne jump_no_move
|
|
|
|
jump_change_x:
|
2019-03-16 16:53:47 +00:00
|
|
|
lda DIRECTION
|
|
|
|
beq jump_left
|
|
|
|
|
|
|
|
jump_right:
|
2019-03-15 21:08:18 +00:00
|
|
|
inc PHYSICIST_X
|
2019-03-16 16:53:47 +00:00
|
|
|
jmp finally_draw_him
|
|
|
|
|
|
|
|
jump_left:
|
|
|
|
dec PHYSICIST_X
|
|
|
|
|
2019-03-15 21:08:18 +00:00
|
|
|
jump_no_move:
|
2019-03-15 17:00:47 +00:00
|
|
|
jmp finally_draw_him
|
|
|
|
|
|
|
|
|
2019-03-15 16:28:46 +00:00
|
|
|
|
|
|
|
;===============================
|
|
|
|
; 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
|
|
|
|
|
2019-03-15 16:28:46 +00:00
|
|
|
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
|
|
|
|
|
|
|
|
|
2019-03-15 17:47:41 +00:00
|
|
|
;==================================
|
|
|
|
; 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
|
|
|
|
|
2019-08-16 15:49:40 +00:00
|
|
|
;==================================
|
|
|
|
; DISINTEGRATING
|
|
|
|
;==================================
|
|
|
|
|
|
|
|
physicist_disintegrating:
|
|
|
|
|
|
|
|
lda GAIT
|
2019-08-22 17:20:10 +00:00
|
|
|
cmp #28
|
2019-08-16 15:49:40 +00:00
|
|
|
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
|
2019-08-22 17:20:10 +00:00
|
|
|
and #$7
|
2019-08-16 15:49:40 +00:00
|
|
|
bne no_disintegrate_progress
|
|
|
|
|
|
|
|
inc GAIT
|
|
|
|
inc GAIT
|
|
|
|
|
|
|
|
no_disintegrate_progress:
|
|
|
|
|
|
|
|
|
|
|
|
jmp finally_draw_him
|
|
|
|
|
|
|
|
|
2019-03-15 16:28:46 +00:00
|
|
|
|
2019-03-17 05:28:42 +00:00
|
|
|
;==================================
|
2019-08-09 16:54:52 +00:00
|
|
|
; FALLING SIDEWAYS
|
2019-03-17 05:28:42 +00:00
|
|
|
;==================================
|
|
|
|
|
2019-08-09 16:54:52 +00:00
|
|
|
physicist_falling_sideways:
|
2019-03-17 05:28:42 +00:00
|
|
|
|
|
|
|
|
|
|
|
lda FRAMEL
|
|
|
|
and #$3
|
|
|
|
bne no_fall_progress
|
|
|
|
|
|
|
|
inc PHYSICIST_X
|
|
|
|
inc PHYSICIST_Y ; must me mul of 2
|
|
|
|
inc PHYSICIST_Y
|
|
|
|
|
|
|
|
no_fall_progress:
|
|
|
|
|
|
|
|
lda PHYSICIST_Y
|
2019-08-09 16:54:52 +00:00
|
|
|
fall_sideways_destination_smc:
|
2019-03-17 05:28:42 +00:00
|
|
|
cmp #22
|
|
|
|
bne still_falling
|
|
|
|
done_falling:
|
|
|
|
; lda #0
|
|
|
|
; sta GAIT
|
|
|
|
|
|
|
|
lda #P_CROUCHING
|
|
|
|
sta PHYSICIST_STATE
|
|
|
|
jmp physicist_crouching
|
|
|
|
|
|
|
|
still_falling:
|
|
|
|
|
|
|
|
lda #<phys_falling
|
|
|
|
sta INL
|
|
|
|
|
|
|
|
lda #>phys_falling
|
|
|
|
sta INH
|
|
|
|
|
|
|
|
jmp finally_draw_him
|
|
|
|
|
|
|
|
|
2019-08-09 16:54:52 +00:00
|
|
|
;==================================
|
|
|
|
; FALLING DOWN
|
|
|
|
;==================================
|
|
|
|
|
|
|
|
physicist_falling_down:
|
|
|
|
|
2019-08-09 17:58:58 +00:00
|
|
|
falling_stop_smc: ; $2C to fall, $4C for not
|
|
|
|
bit still_falling_down
|
2019-08-09 16:54:52 +00:00
|
|
|
|
|
|
|
lda FRAMEL
|
2019-08-09 17:58:58 +00:00
|
|
|
and #$1
|
2019-08-09 16:54:52 +00:00
|
|
|
bne no_fall_down_progress
|
|
|
|
|
2019-08-09 17:58:58 +00:00
|
|
|
inc PHYSICIST_Y ; must be mul of 2
|
2019-08-09 16:54:52 +00:00
|
|
|
inc PHYSICIST_Y
|
|
|
|
|
|
|
|
no_fall_down_progress:
|
|
|
|
|
|
|
|
lda PHYSICIST_Y
|
|
|
|
fall_down_destination_smc:
|
|
|
|
cmp #22
|
|
|
|
bne still_falling_down
|
|
|
|
done_falling_down:
|
|
|
|
|
|
|
|
lda #P_CROUCHING
|
|
|
|
sta PHYSICIST_STATE
|
|
|
|
jmp physicist_crouching
|
|
|
|
|
|
|
|
still_falling_down:
|
|
|
|
|
|
|
|
lda #<phys_stand
|
|
|
|
sta INL
|
|
|
|
|
|
|
|
lda #>phys_stand
|
|
|
|
sta INH
|
|
|
|
|
|
|
|
jmp finally_draw_him
|
|
|
|
|
|
|
|
|
|
|
|
|
2019-08-09 17:58:58 +00:00
|
|
|
;==================================
|
|
|
|
; IMPALED
|
|
|
|
;==================================
|
|
|
|
|
|
|
|
physicist_impaled:
|
|
|
|
|
|
|
|
lda GAIT
|
2019-08-09 20:36:00 +00:00
|
|
|
cmp #$80
|
2019-08-09 17:58:58 +00:00
|
|
|
bne impale_not_done
|
|
|
|
|
|
|
|
impale_really_dead:
|
|
|
|
lda #$ff
|
|
|
|
sta GAME_OVER
|
|
|
|
jmp finally_draw_him
|
|
|
|
|
|
|
|
impale_not_done:
|
|
|
|
|
|
|
|
cmp #2 ; slide down one more
|
|
|
|
bne impale_enough
|
|
|
|
inc PHYSICIST_Y
|
|
|
|
inc PHYSICIST_Y
|
|
|
|
|
|
|
|
impale_enough:
|
|
|
|
inc GAIT
|
|
|
|
|
|
|
|
lda #<physicist_spike_sprite
|
|
|
|
sta INL
|
|
|
|
|
|
|
|
lda #>physicist_spike_sprite
|
|
|
|
sta INH
|
|
|
|
|
|
|
|
jmp finally_draw_him
|
|
|
|
|
2019-03-15 16:28:46 +00:00
|
|
|
;=============================
|
2019-03-15 17:47:41 +00:00
|
|
|
; Actually Draw Him
|
2019-03-15 16:28:46 +00:00
|
|
|
;=============================
|
|
|
|
|
|
|
|
|
2019-01-18 16:33:23 +00:00
|
|
|
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:
|
2019-03-22 05:14:33 +00:00
|
|
|
jmp put_sprite_crop
|
2019-01-17 21:58:19 +00:00
|
|
|
|
|
|
|
facing_right:
|
2019-03-23 05:25:13 +00:00
|
|
|
jmp put_sprite_flipped_crop
|
2019-01-17 21:58:19 +00:00
|
|
|
|
2019-03-16 18:17:20 +00:00
|
|
|
|
|
|
|
|
2019-07-12 14:05:55 +00:00
|
|
|
;======================================
|
2019-03-16 18:17:20 +00:00
|
|
|
;======================================
|
|
|
|
; Check screen limits
|
|
|
|
;======================================
|
2019-07-12 14:05:55 +00:00
|
|
|
;======================================
|
|
|
|
; If too far right or left, stop at boundary
|
|
|
|
; If also > 39 or < -4 then exit room
|
2019-03-16 18:17:20 +00:00
|
|
|
|
|
|
|
check_screen_limit:
|
|
|
|
|
2019-03-23 05:25:13 +00:00
|
|
|
clc
|
2019-03-16 18:17:20 +00:00
|
|
|
lda PHYSICIST_X
|
2019-03-23 05:25:13 +00:00
|
|
|
adc #$80
|
2019-08-15 17:38:11 +00:00
|
|
|
cmp LEFT_WALK_LIMIT
|
2019-03-23 05:25:13 +00:00
|
|
|
bcs just_fine_left ; (bge==bcs)
|
2019-03-16 18:17:20 +00:00
|
|
|
|
2019-07-12 14:05:55 +00:00
|
|
|
left_on_screen:
|
|
|
|
|
|
|
|
; if limit was -4, means we are off screen
|
|
|
|
; otherwise, stop physicist at limit
|
|
|
|
|
2019-08-15 17:38:11 +00:00
|
|
|
lda LEFT_WALK_LIMIT
|
2019-07-12 14:05:55 +00:00
|
|
|
cmp #($80 - 4)
|
|
|
|
beq too_far_left
|
|
|
|
|
|
|
|
left_stop_at_barrier:
|
|
|
|
lda #0
|
|
|
|
sta PHYSICIST_STATE
|
|
|
|
|
2019-08-15 17:38:11 +00:00
|
|
|
lda LEFT_WALK_LIMIT
|
2019-07-12 14:05:55 +00:00
|
|
|
sec
|
|
|
|
sbc #$7f
|
|
|
|
sta PHYSICIST_X
|
|
|
|
|
|
|
|
rts
|
|
|
|
|
2019-03-16 18:17:20 +00:00
|
|
|
too_far_left:
|
|
|
|
lda #1
|
|
|
|
sta GAME_OVER
|
|
|
|
rts
|
|
|
|
|
|
|
|
just_fine_left:
|
|
|
|
|
2019-03-23 05:25:13 +00:00
|
|
|
; Check right edge of screen
|
2019-03-16 18:17:20 +00:00
|
|
|
|
2019-03-23 05:25:13 +00:00
|
|
|
; lda PHYSICIST_X
|
2019-08-15 17:38:11 +00:00
|
|
|
cmp RIGHT_WALK_LIMIT
|
2019-03-16 18:17:20 +00:00
|
|
|
bcc just_fine_right ; blt
|
|
|
|
|
2019-07-12 14:05:55 +00:00
|
|
|
|
|
|
|
right_on_screen:
|
|
|
|
|
|
|
|
; if limit was 39, means we are off screen
|
|
|
|
; otherwise, stop physicist at limit
|
|
|
|
|
2019-08-15 17:38:11 +00:00
|
|
|
lda RIGHT_WALK_LIMIT
|
2019-07-12 14:05:55 +00:00
|
|
|
cmp #($80 + 39)
|
|
|
|
beq too_far_right
|
|
|
|
|
|
|
|
right_stop_at_barrier:
|
|
|
|
lda #0
|
|
|
|
sta PHYSICIST_STATE
|
|
|
|
|
2019-08-15 17:38:11 +00:00
|
|
|
lda RIGHT_WALK_LIMIT
|
2019-07-12 14:05:55 +00:00
|
|
|
clc
|
|
|
|
adc #$7f
|
|
|
|
sta PHYSICIST_X
|
|
|
|
rts
|
|
|
|
|
2019-03-16 18:17:20 +00:00
|
|
|
too_far_right:
|
|
|
|
lda #2
|
|
|
|
sta GAME_OVER
|
|
|
|
|
|
|
|
just_fine_right:
|
|
|
|
|
|
|
|
rts
|
2019-03-23 05:25:13 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
; LIMIT VALUE FLAGS
|
|
|
|
; 0 10 -----
|
|
|
|
; 0 0 Z----
|
|
|
|
; 0 FF
|
|
|
|
|
|
|
|
|
|
|
|
; 1 -> 129
|
|
|
|
; 0 -> 128
|
|
|
|
; -1 -> 127 FF + 80 = 7f
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
; XPOS XSIZE XMAX
|
|
|
|
; -5 8 3
|
|
|
|
; -4 4
|
|
|
|
; -3 5
|
|
|
|
; -2 6
|
|
|
|
; -1 7
|
|
|
|
; 0 8
|
|
|
|
; 1 9
|
|
|
|
; 2
|
|
|
|
; 3
|
|
|
|
; 4
|
|
|
|
; 5
|