ootw: c4: falling into pit more or less works

This commit is contained in:
Vince Weaver 2019-08-09 13:58:58 -04:00
parent fc4d1e3b2e
commit f98a36a591
6 changed files with 144 additions and 36 deletions

View File

@ -13,6 +13,8 @@ gr_twoscreen_scroll:
sta TEMPY ; dest sta TEMPY ; dest
ldy BG_SCROLL ldy BG_SCROLL
cpy #48
beq gr_twoscreen_bottom ; no top to draw
gr_twoscreen_top: gr_twoscreen_top:
@ -71,9 +73,11 @@ gr_twoscreen_smc_dst:
lda BG_SCROLL lda BG_SCROLL
beq done_twoscreen_bottom ; if 0, no bottom beq done_twoscreen_bottom ; if 0, no bottom
gr_twoscreen_bottom:
ldy #0 ldy #0
gr_twoscreen_bottom: gr_twoscreen_bottom_loop:
; calculate source ; calculate source
@ -121,6 +125,6 @@ gr_twoscreen_bottom_smc_dst:
cpy BG_SCROLL cpy BG_SCROLL
bne gr_twoscreen_bottom bne gr_twoscreen_bottom_loop
done_twoscreen_bottom: done_twoscreen_bottom:
rts ; 6 rts ; 6

View File

@ -29,6 +29,8 @@ handle_keypress:
beq no_keypress beq no_keypress
cmp #P_FALLING_SIDEWAYS cmp #P_FALLING_SIDEWAYS
beq no_keypress beq no_keypress
cmp #P_IMPALED
beq no_keypress
lda KEYPRESS ; 4 lda KEYPRESS ; 4
bmi keypress ; 3 bmi keypress ; 3

View File

@ -17,6 +17,9 @@ ootw_city_init:
lda #30 lda #30
sta PHYSICIST_Y sta PHYSICIST_Y
lda #$2c
sta falling_stop_smc
rts rts
@ -125,6 +128,10 @@ room3:
cmp #3 cmp #3
bne room4 bne room4
; set falling floor
lda #48
sta fall_down_destination_smc+1
lda #(-4+128) lda #(-4+128)
sta LEFT_LIMIT sta LEFT_LIMIT
lda #(39+128) lda #(39+128)
@ -157,9 +164,6 @@ room3:
lda #$BC ; load to page $BC00 lda #$BC ; load to page $BC00
jsr load_rle_gr jsr load_rle_gr
; load background ; load background
lda #>(causeway2_rle) lda #>(causeway2_rle)
sta GBASH sta GBASH
@ -227,9 +231,10 @@ ootw_room_already_set:
;============================ ;============================
city_loop: city_loop:
;================================
; copy background to current page ;======================================
;================================ ; draw split screen if falling into pit
;======================================
lda WHICH_ROOM lda WHICH_ROOM
cmp #3 cmp #3
@ -241,32 +246,74 @@ city_loop:
cmp #P_FALLING_DOWN cmp #P_FALLING_DOWN
bne nothing_fancy bne nothing_fancy
scroll_bg: ;======================
lda FRAMEL ; falling
and #$3
bne no_scroll_progress
inc BG_SCROLL scroll_bg:
inc BG_SCROLL lda PHYSICIST_Y
cmp #32
bcc scroll_check ; blt
lda #9
sta PHYSICIST_X
lda #38
sta PHYSICIST_Y
lda #0
sta GAIT
lda #P_IMPALED
sta PHYSICIST_STATE
scroll_check:
lda BG_SCROLL ; if done scrolling, re-enable falling
cmp #48
bne scroll_bg_check22
lda #$2c
sta falling_stop_smc
jmp not_far_enough
scroll_bg_check22:
lda PHYSICIST_Y ; once Y=22, stop falling (scroll bg)
cmp #22
bcc not_far_enough
lda #$4c
sta falling_stop_smc
not_far_enough:
lda FRAMEL ; slow down a bit
and #$1
bne no_scroll_progress
ldy BG_SCROLL ldy BG_SCROLL
cpy #48 cpy #48
forever: beq no_scroll_progress
beq forever
inc BG_SCROLL
inc BG_SCROLL
; ldy BG_SCROLL
; cpy #44
; bne no_scroll_progress
; lda #P_IMPALED
; sta PHYSICIST_STATE
no_scroll_progress: no_scroll_progress:
lda #$94 ; lda #$94
ldy #0 ; ldy #0
clear1: ;clear1:
sta $c00,Y ; sta $c00,Y
sta $d00,Y ; sta $d00,Y
sta $e00,Y ; sta $e00,Y
sta $f00,Y ; sta $f00,Y
iny ; iny
bne clear1 ; bne clear1
; ldy BG_SCROLL
jsr gr_twoscreen_scroll jsr gr_twoscreen_scroll
@ -275,6 +322,11 @@ clear1:
nothing_fancy: nothing_fancy:
done_city_bg: done_city_bg:
;================================
; copy background to current page
;================================
jsr gr_copy_to_current jsr gr_copy_to_current
@ -358,6 +410,10 @@ c4_no_bg_action:
cmp #3 cmp #3
bne regular_room bne regular_room
lda PHYSICIST_Y
cmp #18
bne regular_room
lda PHYSICIST_X lda PHYSICIST_X
cmp #8 cmp #8
bcc regular_room ; blt bcc regular_room ; blt
@ -626,10 +682,3 @@ recharge_bg4:
; 9x40
physicist_spike_sprite:
.byte 3,4
.byte $AA,$11,$AA
.byte $0A,$90,$0A
.byte $BB,$A9,$BB
.byte $BB,$AA,$BB

View File

@ -570,3 +570,18 @@ jump8:
.byte $aa,$44,$c4,$ca,$aa .byte $aa,$44,$c4,$ca,$aa
.byte $fa,$f4,$5a,$5c,$aa .byte $fa,$f4,$5a,$5c,$aa
;====================
;====================
; On Spike
;====================
;====================
; 9x40
physicist_spike_sprite:
.byte 3,4
.byte $AA,$11,$AA
.byte $0A,$90,$0A
.byte $BB,$A9,$BB
.byte $BB,$AA,$BB

View File

@ -74,6 +74,7 @@ pstate_table_lo:
.byte <physicist_standing ; 0A elevator down .byte <physicist_standing ; 0A elevator down
.byte <physicist_shooting ; 0B .byte <physicist_shooting ; 0B
.byte <physicist_falling_down ; 0C .byte <physicist_falling_down ; 0C
.byte <physicist_impaled ; 0D
pstate_table_hi: pstate_table_hi:
.byte >physicist_standing .byte >physicist_standing
@ -89,6 +90,7 @@ pstate_table_hi:
.byte >physicist_standing ; 0A elevator down .byte >physicist_standing ; 0A elevator down
.byte >physicist_shooting ; 0B .byte >physicist_shooting ; 0B
.byte >physicist_falling_down ; 0C .byte >physicist_falling_down ; 0C
.byte >physicist_impaled ; 0D
; Urgh, make sure this doesn't end up at $FF or you hit the ; Urgh, make sure this doesn't end up at $FF or you hit the
; NMOS 6502 bug ; NMOS 6502 bug
@ -367,12 +369,14 @@ still_falling:
physicist_falling_down: physicist_falling_down:
falling_stop_smc: ; $2C to fall, $4C for not
bit still_falling_down
lda FRAMEL lda FRAMEL
and #$3 and #$1
bne no_fall_down_progress bne no_fall_down_progress
inc PHYSICIST_Y ; must me mul of 2 inc PHYSICIST_Y ; must be mul of 2
inc PHYSICIST_Y inc PHYSICIST_Y
no_fall_down_progress: no_fall_down_progress:
@ -399,6 +403,39 @@ still_falling_down:
;==================================
; IMPALED
;==================================
physicist_impaled:
lda GAIT
cmp #$f0
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
;============================= ;=============================
; Actually Draw Him ; Actually Draw Him
;============================= ;=============================

View File

@ -182,6 +182,7 @@ PHYSICIST_STATE = $EA
P_ELEVATING_DOWN = $0A P_ELEVATING_DOWN = $0A
P_SHOOTING = $0B P_SHOOTING = $0B
P_FALLING_DOWN = $0C P_FALLING_DOWN = $0C
P_IMPALED = $0D
BUBBLES_Y = $EB ; C1 underwater BUBBLES_Y = $EB ; C1 underwater
BEFORE_SWING = $EB ; C1 BEFORE_SWING = $EB ; C1