diff --git a/ootw/keyboard.s b/ootw/keyboard.s index 375b35c4..a38a3263 100644 --- a/ootw/keyboard.s +++ b/ootw/keyboard.s @@ -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: diff --git a/ootw/ootw_graphics/rope/another_brokerope.png b/ootw/ootw_graphics/rope/another_brokerope.png new file mode 100644 index 00000000..6a01adbd Binary files /dev/null and b/ootw/ootw_graphics/rope/another_brokerope.png differ diff --git a/ootw/ootw_graphics/rope/another_norope.png b/ootw/ootw_graphics/rope/another_norope.png index 243f8e4b..919f1a7c 100644 Binary files a/ootw/ootw_graphics/rope/another_norope.png and b/ootw/ootw_graphics/rope/another_norope.png differ diff --git a/ootw/ootw_graphics/rope/another_rope.png b/ootw/ootw_graphics/rope/another_rope.png index 1b96bc8d..d8260046 100644 Binary files a/ootw/ootw_graphics/rope/another_rope.png and b/ootw/ootw_graphics/rope/another_rope.png differ diff --git a/ootw/ootw_graphics/rope/falling.png b/ootw/ootw_graphics/rope/falling.png new file mode 100644 index 00000000..f8c82cd4 Binary files /dev/null and b/ootw/ootw_graphics/rope/falling.png differ diff --git a/ootw/ootw_graphics/rope/ootw_rope.inc b/ootw/ootw_graphics/rope/ootw_rope.inc index 08ee1a01..e829edc4 100644 --- a/ootw/ootw_graphics/rope/ootw_rope.inc +++ b/ootw/ootw_graphics/rope/ootw_rope.inc @@ -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 diff --git a/ootw/ootw_graphics/sprites/sprites_physicist.inc b/ootw/ootw_graphics/sprites/sprites_physicist.inc index 36000244..fd3a238d 100644 --- a/ootw/ootw_graphics/sprites/sprites_physicist.inc +++ b/ootw/ootw_graphics/sprites/sprites_physicist.inc @@ -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 + ;===================== diff --git a/ootw/ootw_rope.s b/ootw/ootw_rope.s index 496efca6..65f72e57 100644 --- a/ootw/ootw_rope.s +++ b/ootw/ootw_rope.s @@ -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 + diff --git a/ootw/physicist.s b/ootw/physicist.s index cc6d2aa5..6ecf50ee 100644 --- a/ootw/physicist.s +++ b/ootw/physicist.s @@ -1,19 +1,21 @@ pstate_table_lo: - .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 INH + + jmp finally_draw_him + + ;============================= ; Actually Draw Him ;============================= diff --git a/ootw/zp.inc b/ootw/zp.inc index c159c9d3..b619888b 100644 --- a/ootw/zp.inc +++ b/ootw/zp.inc @@ -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