2019-01-20 06:02:41 +00:00
|
|
|
; Cavern scenes (with the slugs)
|
2019-01-17 21:58:19 +00:00
|
|
|
|
|
|
|
ootw_cavern:
|
|
|
|
;===========================
|
|
|
|
; Enable graphics
|
|
|
|
|
|
|
|
bit LORES
|
|
|
|
bit SET_GR
|
|
|
|
bit FULLGR
|
|
|
|
|
2019-01-19 03:32:55 +00:00
|
|
|
;==================
|
|
|
|
; setup drawing
|
2019-01-17 21:58:19 +00:00
|
|
|
|
|
|
|
lda #0
|
|
|
|
sta DRAW_PAGE
|
|
|
|
lda #1
|
|
|
|
sta DISP_PAGE
|
|
|
|
|
2019-01-20 06:02:41 +00:00
|
|
|
;======================
|
2019-01-19 03:32:55 +00:00
|
|
|
; setup room boundaries
|
|
|
|
|
|
|
|
lda #0
|
|
|
|
sta LEFT_LIMIT
|
|
|
|
lda #37
|
|
|
|
sta RIGHT_LIMIT
|
2019-01-17 21:58:19 +00:00
|
|
|
|
|
|
|
;=============================
|
|
|
|
; Load background to $c00
|
|
|
|
|
|
|
|
lda #$0c
|
|
|
|
sta BASH
|
|
|
|
lda #$00
|
|
|
|
sta BASL ; load image off-screen $c00
|
|
|
|
|
2019-01-20 06:02:41 +00:00
|
|
|
|
|
|
|
lda WHICH_CAVE
|
|
|
|
|
|
|
|
cave_bg0:
|
2019-01-17 22:14:19 +00:00
|
|
|
lda #>(cavern_rle)
|
2019-01-17 21:58:19 +00:00
|
|
|
sta GBASH
|
2019-01-17 22:14:19 +00:00
|
|
|
lda #<(cavern_rle)
|
2019-01-17 21:58:19 +00:00
|
|
|
sta GBASL
|
2019-01-20 06:02:41 +00:00
|
|
|
jmp cave_bg_done
|
|
|
|
|
|
|
|
cave_bg1:
|
|
|
|
lda #>(cavern2_rle)
|
|
|
|
sta GBASH
|
|
|
|
lda #<(cavern2_rle)
|
|
|
|
sta GBASL
|
|
|
|
cave_bg_done:
|
2019-01-17 21:58:19 +00:00
|
|
|
jsr load_rle_gr
|
|
|
|
|
2019-01-20 06:02:41 +00:00
|
|
|
|
|
|
|
;================================
|
2019-01-18 05:18:06 +00:00
|
|
|
; Load quake background to $1000
|
|
|
|
|
2019-01-20 05:52:07 +00:00
|
|
|
jsr gr_make_quake
|
2019-01-18 05:18:06 +00:00
|
|
|
|
|
|
|
|
2019-01-17 21:58:19 +00:00
|
|
|
;=================================
|
2019-01-20 06:02:41 +00:00
|
|
|
; copy $c00 background to both pages $400/$800
|
2019-01-17 21:58:19 +00:00
|
|
|
|
|
|
|
jsr gr_copy_to_current
|
|
|
|
jsr page_flip
|
|
|
|
jsr gr_copy_to_current
|
|
|
|
|
|
|
|
|
|
|
|
;=================================
|
|
|
|
; setup vars
|
|
|
|
|
|
|
|
lda #0
|
|
|
|
sta GAIT
|
2019-01-17 22:14:19 +00:00
|
|
|
sta GAME_OVER
|
2019-01-17 21:58:19 +00:00
|
|
|
|
|
|
|
;============================
|
|
|
|
; Cavern Loop (not a palindrome)
|
|
|
|
;============================
|
|
|
|
cavern_loop:
|
|
|
|
|
2019-01-18 05:18:06 +00:00
|
|
|
;==========================
|
2019-01-20 06:05:52 +00:00
|
|
|
; handle earthquake
|
2019-01-17 21:58:19 +00:00
|
|
|
|
2019-01-20 06:05:52 +00:00
|
|
|
jsr earthquake_handler
|
2019-01-17 21:58:19 +00:00
|
|
|
|
2019-01-18 17:00:25 +00:00
|
|
|
;===============
|
|
|
|
; handle slug death
|
|
|
|
|
|
|
|
lda SLUGDEATH
|
|
|
|
beq still_alive
|
|
|
|
|
2019-01-18 17:13:34 +00:00
|
|
|
collapsing:
|
|
|
|
lda SLUGDEATH_PROGRESS
|
|
|
|
cmp #18
|
|
|
|
bmi still_collapsing
|
|
|
|
|
|
|
|
really_dead:
|
|
|
|
lda #$ff
|
|
|
|
sta GAME_OVER
|
|
|
|
jmp just_slugs
|
|
|
|
|
|
|
|
|
|
|
|
still_collapsing:
|
|
|
|
tax
|
|
|
|
|
|
|
|
lda collapse_progression,X
|
|
|
|
sta INL
|
|
|
|
lda collapse_progression+1,X
|
|
|
|
sta INH
|
|
|
|
|
|
|
|
lda PHYSICIST_X
|
|
|
|
sta XPOS
|
|
|
|
lda PHYSICIST_Y
|
|
|
|
sec
|
|
|
|
sbc EARTH_OFFSET
|
|
|
|
sta YPOS
|
|
|
|
|
|
|
|
jsr put_sprite
|
|
|
|
|
|
|
|
lda FRAMEL
|
|
|
|
and #$1f
|
|
|
|
bne no_collapse_progress
|
|
|
|
|
|
|
|
inc SLUGDEATH_PROGRESS
|
|
|
|
inc SLUGDEATH_PROGRESS
|
|
|
|
no_collapse_progress:
|
|
|
|
|
2019-01-18 17:00:25 +00:00
|
|
|
|
|
|
|
jmp just_slugs
|
|
|
|
|
|
|
|
still_alive:
|
|
|
|
|
|
|
|
;===============
|
|
|
|
; check keyboard
|
|
|
|
|
2019-01-19 03:32:55 +00:00
|
|
|
jsr handle_keypress
|
2019-01-18 17:00:25 +00:00
|
|
|
|
2019-01-17 21:58:19 +00:00
|
|
|
;===============
|
|
|
|
; draw physicist
|
|
|
|
|
|
|
|
jsr draw_physicist
|
|
|
|
|
2019-01-18 17:00:25 +00:00
|
|
|
just_slugs:
|
|
|
|
|
2019-01-17 21:58:19 +00:00
|
|
|
;===============
|
|
|
|
; draw slugs
|
|
|
|
|
|
|
|
jsr draw_slugs
|
|
|
|
|
|
|
|
;======================
|
|
|
|
; draw falling boulders
|
|
|
|
|
2019-01-18 05:27:32 +00:00
|
|
|
lda BOULDER_Y
|
|
|
|
cmp #38
|
|
|
|
bpl no_boulder
|
|
|
|
|
|
|
|
lda #<boulder
|
|
|
|
sta INL
|
|
|
|
lda #>boulder
|
|
|
|
sta INH
|
|
|
|
|
|
|
|
lda BOULDER_X
|
|
|
|
sta XPOS
|
|
|
|
lda BOULDER_Y
|
|
|
|
sta YPOS
|
|
|
|
jsr put_sprite
|
|
|
|
|
|
|
|
lda FRAMEL
|
|
|
|
and #$3
|
|
|
|
bne no_boulder
|
|
|
|
inc BOULDER_Y
|
|
|
|
inc BOULDER_Y
|
2019-01-17 21:58:19 +00:00
|
|
|
|
2019-01-18 05:27:32 +00:00
|
|
|
no_boulder:
|
2019-01-17 21:58:19 +00:00
|
|
|
;=======================
|
|
|
|
; page flip
|
|
|
|
|
|
|
|
jsr page_flip
|
|
|
|
|
|
|
|
;========================
|
|
|
|
; inc frame count
|
|
|
|
|
|
|
|
inc FRAMEL
|
|
|
|
bne frame_no_oflo_c
|
|
|
|
inc FRAMEH
|
|
|
|
|
|
|
|
frame_no_oflo_c:
|
|
|
|
|
|
|
|
; pause?
|
|
|
|
|
|
|
|
; see if game over
|
|
|
|
lda GAME_OVER
|
2019-01-17 22:14:19 +00:00
|
|
|
cmp #$ff
|
|
|
|
beq done_cavern
|
|
|
|
|
|
|
|
; see if left level
|
|
|
|
cmp #1
|
|
|
|
bne still_in_cavern
|
|
|
|
|
|
|
|
lda #37
|
|
|
|
sta PHYSICIST_X
|
|
|
|
jmp ootw_pool
|
2019-01-17 21:58:19 +00:00
|
|
|
|
2019-01-17 22:14:19 +00:00
|
|
|
still_in_cavern:
|
2019-01-17 21:58:19 +00:00
|
|
|
; loop forever
|
|
|
|
|
|
|
|
jmp cavern_loop
|
|
|
|
|
|
|
|
done_cavern:
|
|
|
|
rts
|
|
|
|
|