ootw: swinging sorta works

This commit is contained in:
Vince Weaver 2019-03-17 01:28:42 -04:00
parent c49857b8b0
commit 821a9b47ad
10 changed files with 243 additions and 60 deletions

View File

@ -9,11 +9,16 @@ handle_keypress:
beq no_keypress
cmp #P_JUMPING ; ignore keypress if jumping
beq no_keypress
cmp #P_SWINGING
beq no_keypress
cmp #P_FALLING
beq no_keypress
lda KEYPRESS ; 4
bmi keypress ; 3
no_keypress:
bit KEYRESET ; clear
; avoid keeping old keys around
rts ; nothing pressed, return
keypress:

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 6.1 KiB

After

Width:  |  Height:  |  Size: 6.0 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 469 B

After

Width:  |  Height:  |  Size: 6.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.6 KiB

View File

@ -46,46 +46,45 @@ rope_rle: .byte $28 ; ysize=48
.byte $A4,$00, $AA,$22, $A0,$92,$00
.byte $A1
broke_rope_rle: .byte $28 ; ysize=48
.byte $A3,$00, $22,$22, $00, $A4,$22, $A3,$00, $55, $A9,$00
.byte $22, $A4,$00, $22, $52, $22, $00,$00, $22
.byte $06, $A5,$66, $A3,$00, $22,$22, $00, $A4,$22, $A3,$00
.byte $55, $A6,$00, $05, $00, $55, $22, $A5,$00
.byte $55, $22, $00,$00, $22, $00, $A5,$66, $00,$00
.byte $55, $22,$22, $00, $A4,$22, $20, $00,$00, $55
.byte $A6,$00, $55, $00, $55, $22, $A5,$00, $55
.byte $22, $00,$00, $02, $20, $A4,$66, $26, $00,$00
.byte $77, $55, $02, $00, $A5,$22, $00,$00, $55
.byte $A8,$00, $55, $22, $A5,$00, $55, $22, $00,$00
.byte $20, $22, $06, $A3,$66, $22, $00,$00, $77
.byte $55, $00, $A6,$22, $AB,$00, $55, $22, $A5,$00
.byte $55, $22, $00,$00, $22, $00,$00, $55, $66,$66
.byte $22, $00,$00, $77, $55, $20, $A5,$22, $A3,$00
.byte $55, $A8,$00, $55, $22, $00,$00, $55, $22
.byte $00, $55, $22, $00,$00, $02, $00,$00, $55
.byte $66,$66, $22, $00,$00, $77, $55, $A6,$22, $20
.byte $00,$00, $55, $A8,$00, $55, $22, $00,$00, $55
.byte $22, $00, $55, $22, $A5,$00, $55, $26
.byte $66, $22, $00,$00, $77, $55, $A7,$22, $A9,$00
.byte $50, $00, $55, $22, $00,$00, $55, $22
.byte $00, $55, $22, $A5,$00, $55, $22, $26
.byte $22, $A3,$00, $55, $A7,$22, $A9,$00, $55, $00
.byte $55, $22, $00,$00, $25, $22, $00, $05
.byte $22, $A5,$00, $55, $02, $00, $22, $A3,$00
.byte $77, $55, $A6,$22, $AB,$00, $55, $22, $00,$00
.byte $22, $A3,$00, $22, $A5,$00, $55, $00,$00, $22
.byte $A4,$00, $55, $A6,$22, $05, $AA,$00, $55, $22
.byte $00,$00, $22, $A3,$00, $22,$22, $A5,$00, $55, $22,$22
.byte $A4,$00, $55, $A6,$22, $AB,$00, $05, $22, $00,$00
.byte $22, $A3,$00, $02, $22, $A5,$00, $55, $22,$22
.byte $A4,$00, $A7,$22, $AC,$00, $22, $00,$00, $02, $A4,$00
.byte $22, $A5,$00, $55, $02,$02, $A4,$00, $A6,$22, $02
.byte $22, $00, $70,$70, $A8,$00, $22, $A7,$00, $22
.byte $A5,$00, $55, $A6,$00, $A6,$22, $20, $52, $A4,$55
.byte $50,$50, $A5,$00, $22, $A7,$00, $22, $AC,$00, $02
.byte $52, $72, $52, $A3,$22, $A5,$00, $A3,$05, $55
.byte $A3,$50, $22, $A0,$15,$00, $20,$20, $A3,$22, $00, $22
.byte $20, $A8,$00, $05, $55,$55, $50, $A0,$13,$00, $A6,$22
.byte $20, $22,$22, $AB,$00, $05, $55,$55, $AD,$50, $A4,$00
.byte $A9,$22, $20, $AC,$00, $05,$05, $AC,$55, $A4,$00, $AA,$22
.byte $AF,$00, $05, $A6,$55, $A4,$05, $A4,$00, $AA,$22, $A0,$92,$00
.byte $A3,$00, $A7,$22, $A3,$00, $55, $A9,$00, $22, $A4,$00
.byte $22, $52, $22, $00,$00, $22, $06, $A5,$66
.byte $A3,$00, $A7,$22, $A3,$00, $55, $A6,$00, $05, $00
.byte $55, $22, $A5,$00, $55, $22, $00,$00, $22
.byte $00, $A5,$66, $00,$00, $55, $A7,$22, $20, $00,$00
.byte $55, $A6,$00, $55, $00, $55, $22, $A5,$00
.byte $55, $22, $00,$00, $02, $20, $A4,$66, $26
.byte $00,$00, $77, $55, $A7,$22, $00,$00, $55, $A8,$00
.byte $55, $22, $A5,$00, $55, $22, $00,$00, $20
.byte $22, $06, $A3,$66, $22, $00,$00, $77, $55
.byte $A7,$22, $AB,$00, $55, $22, $A5,$00, $55, $22
.byte $00,$00, $22, $00,$00, $55, $66,$66, $22, $00,$00
.byte $77, $55, $A6,$22, $A3,$00, $55, $A8,$00, $55
.byte $22, $00,$00, $55, $22, $00, $55, $22
.byte $00,$00, $02, $00,$00, $55, $66,$66, $22, $00,$00
.byte $77, $55, $A6,$22, $20, $00,$00, $55, $A8,$00
.byte $55, $22, $00,$00, $55, $22, $00, $55
.byte $22, $A5,$00, $55, $26, $66, $22, $00,$00
.byte $77, $55, $A7,$22, $A9,$00, $50, $00, $55
.byte $22, $00,$00, $55, $22, $00, $55, $22
.byte $A5,$00, $55, $22, $26, $22, $A3,$00, $55
.byte $A7,$22, $A9,$00, $55, $00, $55, $22, $00,$00
.byte $25, $22, $00, $05, $22, $A5,$00, $55
.byte $02, $00, $22, $A3,$00, $77, $55, $A6,$22
.byte $AB,$00, $55, $22, $00,$00, $22, $A3,$00, $22
.byte $A5,$00, $55, $00,$00, $22, $A4,$00, $55, $A6,$22
.byte $05, $AA,$00, $55, $22, $00,$00, $22, $A3,$00
.byte $22,$22, $A5,$00, $55, $22,$22, $A4,$00, $55, $A6,$22
.byte $AB,$00, $05, $22, $00,$00, $22, $A3,$00, $02
.byte $22, $A5,$00, $55, $22,$22, $A4,$00, $A7,$22, $AC,$00
.byte $22, $00,$00, $02, $A4,$00, $22, $A5,$00, $55
.byte $02,$02, $A4,$00, $A6,$22, $02, $22, $00, $70,$70
.byte $A8,$00, $22, $A7,$00, $22, $A5,$00, $55, $A6,$00
.byte $A6,$22, $20, $52, $A4,$55, $50,$50, $A5,$00, $22
.byte $A7,$00, $22, $AC,$00, $02, $52, $72, $52
.byte $A3,$22, $A5,$00, $A3,$05, $55, $A3,$50, $22, $A0,$15,$00
.byte $20,$20, $A3,$22, $00, $22, $20, $A8,$00, $05
.byte $55,$55, $50, $A0,$13,$00, $A6,$22, $20, $22,$22, $AB,$00
.byte $05, $55,$55, $AD,$50, $A4,$00, $A9,$22, $20, $AC,$00
.byte $05,$05, $AC,$55, $A4,$00, $AA,$22, $AF,$00, $05, $A6,$55
.byte $A4,$05, $A4,$00, $AA,$22, $A0,$92,$00
.byte $A1

View File

@ -300,6 +300,19 @@ kick1:
;=====================
;=====================
; note: he falls into a crouch
phys_falling:
.byte $5,$8
.byte $aa,$aa,$aa,$aa,$aa
.byte $aa,$aa,$9a,$9a,$aa
.byte $aa,$aa,$bb,$99,$aa
.byte $ab,$ba,$ba,$b0,$0b
.byte $aa,$aa,$aa,$00,$00
.byte $aa,$aa,$aa,$44,$44
.byte $ca,$4c,$44,$a4,$aa
.byte $f5,$f4,$aa,$aa,$aa
;=====================

View File

@ -24,6 +24,9 @@ ootw_rope:
lda #11
sta LEFT_LIMIT
lda #0
sta SWING_PROGRESS
;=============================
; Load background to $c00
@ -71,6 +74,29 @@ load_swing_bg:
;============================
rope_loop:
;============================
; Check if swinging
;============================
lda SWING_PROGRESS
beq no_swing
dec SWING_PROGRESS
dec SWING_PROGRESS
ldx SWING_PROGRESS
lda swing_progression,X
sta GBASL
lda swing_progression+1,X
sta GBASH
lda #$c ; load image off-screen $c00
jsr load_rle_gr
jsr gr_make_quake ; make quake
no_swing:
;================================
; handle earthquakes
@ -87,7 +113,22 @@ rope_loop:
jsr check_screen_limit
;===============================
; check if swinging off
lda PHYSICIST_STATE
cmp #P_SWINGING
bne done_swing_check
lda SWING_PROGRESS
bne done_swing_check
; swung off screen!
lda #5
sta GAME_OVER
done_swing_check:
;===============
; draw physicist
@ -118,8 +159,13 @@ phys_no_adjust_y:
phys_done_adjust_y:
sta PHYSICIST_Y
jsr draw_physicist
lda PHYSICIST_STATE
cmp #P_SWINGING
beq hes_swinging
jsr draw_physicist
hes_swinging:
;======================
; draw foreground plant
@ -158,15 +204,18 @@ phys_done_adjust_y:
rope_frame_no_oflo:
; pause?
;=========================
; check if done this room
;=========================
; check if done this level
; handle game over
lda GAME_OVER
cmp #$ff
beq done_rope
; check if done this level
; if 2 then exiting right, to pool
cmp #$2
bne check_cliff_edge
@ -177,10 +226,10 @@ rope_frame_no_oflo:
jmp ootw_pool
; at edge of cliff
; if 1 then at edge of cliff
check_cliff_edge:
cmp #$1
bne not_done_rope
bne check_swung_off
lda #0
sta GAME_OVER
@ -188,12 +237,38 @@ check_cliff_edge:
;===================
; at cliff's edge
; lda #0
; sta BEFORE_SWING
lda #0
sta BEFORE_SWING
; FIXME: check for jump
lda #80
sta SWING_PROGRESS
lda #11
sta PHYSICIST_X
lda #P_SWINGING
sta PHYSICIST_STATE
jmp not_done_rope
check_swung_off:
cmp #$5
bne not_done_rope
lda #1
sta PHYSICIST_X
sta EARTH_OFFSET
sta DIRECTION ; face right
lda #10
sta PHYSICIST_Y
lda #P_FALLING
sta PHYSICIST_STATE
jmp ootw_pool
not_done_rope:
; loop forever
@ -201,3 +276,50 @@ not_done_rope:
done_rope:
rts
swing_progression:
.word swing25_rle
.word swing24_rle
.word swing23_rle
.word swing22_rle
.word swing21_rle
.word swing20_rle
.word swing19_rle
.word swing18_rle
.word swing17_rle
.word swing16_rle
.word swing15_rle
.word swing14_rle
.word swing13_rle
.word swing12_rle
.word swing11_rle
.word swing10_rle
.word swing08_rle
.word swing08_rle
.word swing08_rle
.word swing08_rle
.word swing08_rle
.word swing08_rle
.word swing08_rle
.word swing08_rle
.word swing08_rle
.word swing08_rle
.word swing08_rle
.word swing08_rle
.word swing08_rle
.word swing08_rle
.word swing08_rle
.word swing08_rle
.word swing08_rle
.word swing08_rle
.word swing06_rle
.word swing05_rle
.word swing04_rle
.word swing03_rle
.word swing02_rle
.word swing01_rle

View File

@ -1,19 +1,21 @@
pstate_table_lo:
.byte <physicist_standing
.byte <physicist_walking
.byte <physicist_running
.byte <physicist_crouching
.byte <physicist_kicking
.byte <physicist_jumping
.byte <physicist_collapsing
.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
.byte <physicist_falling ; 07
pstate_table_hi:
.byte >physicist_standing
.byte >physicist_standing
.byte >physicist_walking
.byte >physicist_running
.byte >physicist_crouching
.byte >physicist_kicking
.byte >physicist_jumping
.byte >physicist_collapsing
.byte >physicist_falling
; Urgh, make sure this doesn't end up at $FF or you hit the
; NMOS 6502 bug
@ -231,6 +233,45 @@ no_collapse_progress:
jmp finally_draw_him
;==================================
; FALLING
;==================================
physicist_falling:
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
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
;=============================
; Actually Draw Him
;=============================

View File

@ -161,7 +161,9 @@ PHYSICIST_STATE = $EA
P_KICKING = $04
P_JUMPING = $05 ; no keypress
P_COLLAPSING = $06 ; no keypress
P_SWINGING = $07 ; no keypress
P_FALLING = $07 ; no keypress
P_SWINGING = $08 ; no keypress
BEFORE_SWING = $EB
CUTFRAME = $EC
@ -183,6 +185,7 @@ DIRECTION = $F5
GAIT = $F6
TENTACLE_X = $F7
SWING_PROGRESS = $F8
TENTACLE_PROGRESS = $F8
;SLUGDEATH_PROGRESS = $F8
ELEVATOR_CYCLE = $F8