ootw: climb out of the pool

This commit is contained in:
Vince Weaver 2019-07-29 15:02:58 -04:00
parent 12ec26efac
commit 68932d6cf0
4 changed files with 442 additions and 109 deletions

View File

@ -20,15 +20,23 @@ ootw:
sta ON_ELEVATOR
;=======================
; Handle Arrival
;=======================
;==========================
; Handle Underwater Arrival
;==========================
jsr ootw_c1_arrival
lda GAME_OVER
bmi end_c1
;==========================
; Exit the Pool
;==========================
jsr exit_pool
; Initialize some variables
lda #0

View File

@ -40,35 +40,13 @@ ootw_pool:
lda #$c ; load image off-screen $c00
jsr load_rle_gr
;===================================================
; put beast in background if it hasn't been released
lda BEAST_OUT
bne beast_in
lda #8
sta DRAW_PAGE
lda #<background_beast
sta INL
lda #>background_beast
sta INH
lda #34
sta XPOS
lda #8
sta YPOS
jsr put_sprite
beast_in:
;=================================
; copy to both pages $400/$800
jsr gr_copy_to_current
jsr page_flip
jsr gr_copy_to_current
; jsr gr_copy_to_current
; jsr page_flip
; jsr gr_copy_to_current
;=================================
@ -82,8 +60,12 @@ beast_in:
lda #30
sta TENTACLE_PROGRESS
;==================================
; setup beast if we're running from it
jsr setup_beast
;============================
;============================
;============================
@ -102,67 +84,7 @@ pool_loop:
;=======================
; draw pool ripples
lda FRAMEL
and #$30 ; 0110 1100
lsr
lsr
lsr
tax
lda pool_ripples,X
sta INL
lda pool_ripples+1,X
sta INH
lda #9
sta XPOS
lda #30
sta YPOS
jsr put_sprite
lda FRAMEL
and #$30 ; 0110 1100
lsr
lsr
lsr
clc
adc #2
and #$6
tax
lda pool_ripples,X
sta INL
lda pool_ripples+1,X
sta INH
lda #27
sta XPOS
lda #30
sta YPOS
jsr put_sprite
lda FRAMEL
and #$30 ; 0110 1100
lsr
lsr
lsr
clc
adc #4
and #$6
tax
lda #18
sta XPOS
lda #28
sta YPOS
jsr put_sprite
jsr draw_ripples
;==============================
@ -318,26 +240,7 @@ beyond_tentacles:
;======================
; draw foreground plant
lda FRAMEL
and #$c0 ; 0110 1100
lsr
lsr
lsr
lsr
lsr
tax
lda plant_wind,X
sta INL
lda plant_wind+1,X
sta INH
lda #4
sta XPOS
lda #30
sta YPOS
jsr put_sprite
jsr draw_fg_plant
;===============
; page flip
@ -390,3 +293,255 @@ not_done_pool:
done_pool:
rts
;=======================
; draw pool ripples
draw_ripples:
lda FRAMEL
and #$30 ; 0110 1100
lsr
lsr
lsr
tax
lda pool_ripples,X
sta INL
lda pool_ripples+1,X
sta INH
lda #9
sta XPOS
lda #30
sta YPOS
jsr put_sprite
lda FRAMEL
and #$30 ; 0110 1100
lsr
lsr
lsr
clc
adc #2
and #$6
tax
lda pool_ripples,X
sta INL
lda pool_ripples+1,X
sta INH
lda #27
sta XPOS
lda #30
sta YPOS
jsr put_sprite
lda FRAMEL
and #$30 ; 0110 1100
lsr
lsr
lsr
clc
adc #4
and #$6
tax
lda #18
sta XPOS
lda #28
sta YPOS
jmp put_sprite ; tail call
; rts
;======================
; draw foreground plant
draw_fg_plant:
lda FRAMEL
and #$c0 ; 0110 1100
lsr
lsr
lsr
lsr
lsr
tax
lda plant_wind,X
sta INL
lda plant_wind+1,X
sta INH
lda #4
sta XPOS
lda #30
sta YPOS
jmp put_sprite
; rts
;============================
;============================
; exit pool
;============================
;============================
exit_pool:
lda #0
sta EXIT_COUNT
;=============================
; Load background to $c00
lda #>(pool_rle)
sta GBASH
lda #<(pool_rle)
sta GBASL
lda #$c ; load image off-screen $c00
jsr load_rle_gr
exit_pool_loop:
;================================
; copy background to current page
jsr gr_copy_to_current
;=======================
; draw pool ripples
jsr draw_ripples
;===============
; draw physicist
lda EXIT_COUNT
and #$fe
tay
lda #20
sta XPOS
lda #22
sta YPOS
lda pool_exit_progression,Y
sta INL
lda pool_exit_progression+1,Y
sta INH
jsr put_sprite
;================
; handle beast
; jsr move_beast
;================
; draw beast
; jsr draw_beast
;=================
; draw foreground plant
jsr draw_fg_plant
;===============
; page flip
jsr page_flip
;================
; inc frame count
inc FRAMEL
bne framee_no_oflo
inc FRAMEH
framee_no_oflo:
; increment exit count
lda FRAMEL
and #$0f
bne exit_count_same
inc EXIT_COUNT
exit_count_same:
; check if done
lda EXIT_COUNT
cmp #(26*2)
beq done_exit_pool
jmp exit_pool_loop
done_exit_pool:
bit KEYRESET
rts
;=========================
; draw background beast
draw_bg_beast:
;===================================================
; put beast in background if it hasn't been released
lda BEAST_OUT
bne beast_in
lda #8
sta DRAW_PAGE
lda #<background_beast
sta INL
lda #>background_beast
sta INH
lda #34
sta XPOS
lda #8
sta YPOS
jsr put_sprite
beast_in:
rts

View File

@ -1,3 +1,172 @@
pool_exit_progression:
.word pool_exit_1 ; 0
.word pool_exit_2 ; 1
.word pool_exit_3 ; 2
.word pool_exit_3 ; 3
.word pool_exit_2 ; 4
.word pool_exit_1 ; 5
.word pool_exit_0 ; 6
.word pool_exit_0 ; 7
.word pool_exit_0 ; 8
.word pool_exit_0 ; 9
.word pool_exit_0 ; 10
.word pool_exit_4 ; 11
.word pool_exit_5 ; 12
.word pool_exit_5 ; 13
.word pool_exit_5 ; 14
.word pool_exit_5 ; 15
.word pool_exit_5 ; 16
.word pool_exit_6 ; 17
.word pool_exit_7 ; 18
.word pool_exit_8 ; 19
.word pool_exit_8 ; 20
.word pool_exit_8 ; 21
.word pool_exit_8 ; 22
.word pool_exit_8 ; 23
.word pool_exit_9 ; 24
.word pool_exit_10 ; 25
pool_exit_0: ; nothing
.byte 3,8
.byte $AA,$AA,$AA
.byte $AA,$AA,$AA
.byte $AA,$AA,$AA
.byte $AA,$AA,$AA
.byte $AA,$AA,$AA
.byte $AA,$AA,$AA
.byte $AA,$AA,$AA
.byte $AA,$AA,$AA
pool_exit_1:
.byte 3,8
.byte $AA,$AA,$AA
.byte $AA,$AA,$AA
.byte $AA,$AA,$AA
.byte $AA,$AA,$AA
.byte $AA,$AA,$AA
.byte $AB,$AA,$AB
.byte $AA,$AA,$AA
.byte $AA,$AA,$AA
pool_exit_2:
.byte 3,8
.byte $AA,$AA,$AA
.byte $AA,$AA,$AA
.byte $AA,$AA,$AA
.byte $AA,$AA,$AA
.byte $BA,$AA,$BA
.byte $AB,$AA,$AB
.byte $AA,$AA,$AA
.byte $AA,$AA,$AA
pool_exit_3:
.byte 3,8
.byte $AA,$AA,$AA
.byte $AA,$AA,$AA
.byte $AA,$AA,$AA
.byte $AA,$AA,$AA
.byte $BB,$AA,$BB
.byte $AB,$A9,$AB
.byte $AA,$AA,$AA
.byte $AA,$AA,$AA
pool_exit_4:
.byte 3,8
.byte $AA,$AA,$AA
.byte $AA,$AA,$AA
.byte $AA,$AA,$AA
.byte $AA,$AA,$AA
.byte $AA,$9A,$AA
.byte $BA,$AB,$BA
.byte $AA,$AA,$AA
.byte $AA,$AA,$AA
pool_exit_5:
.byte 3,8
.byte $AA,$AA,$AA
.byte $AA,$AA,$AA
.byte $AA,$AA,$AA
.byte $AA,$AA,$AA
.byte $AA,$9A,$AA
.byte $B0,$A9,$BA
.byte $AA,$AB,$AA
.byte $AA,$AA,$AA
pool_exit_6:
.byte 3,8
.byte $AA,$AA,$AA
.byte $AA,$AA,$AA
.byte $AA,$AA,$AA
.byte $AA,$9A,$AA
.byte $BA,$99,$BA
.byte $BB,$A0,$BB
.byte $AA,$AA,$AA
.byte $AA,$AA,$AA
pool_exit_7:
.byte 3,8
.byte $AA,$AA,$AA
.byte $AA,$AA,$AA
.byte $AA,$9A,$AA
.byte $B0,$99,$B0
.byte $BB,$00,$BB
.byte $AB,$A4,$AB
.byte $AA,$AA,$AA
.byte $AA,$AA,$AA
pool_exit_8:
.byte 3,8
.byte $AA,$AA,$AA
.byte $AA,$AA,$AA
.byte $AA,$9A,$AA
.byte $00,$99,$00
.byte $BB,$00,$BB
.byte $BB,$4B,$4B
.byte $AA,$AA,$74
.byte $AA,$AA,$AA
pool_exit_9:
.byte 3,8
.byte $AA,$9A,$AA
.byte $AA,$BB,$AA
.byte $00,$00,$00
.byte $BB,$00,$BB
.byte $BB,$40,$BB
.byte $CC,$C4,$44
.byte $CC,$AA,$74
.byte $AA,$AA,$AA
pool_exit_10:
.byte 3,8
.byte $AA,$9A,$AA
.byte $AA,$BB,$AA
.byte $0A,$00,$00
.byte $BB,$00,$BB
.byte $BB,$40,$BB
.byte $AA,$C4,$44
.byte $AA,$CC,$44
.byte $AA,$7C,$F4
swim_progression:
.word swimming1
.word swimming2

View File

@ -124,6 +124,7 @@ LEFT_LIMIT = $E0 ; ALL
RIGHT_LIMIT = $E1 ; ALL
CONSOLE_Y = $E2 ; C1 arrival
EXIT_COUNT = $E2 ; C1 pool
WHICH_SLUG = $E2 ; C1
TELEPORTING = $E2 ; C2 jail