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
|
|
|
|
|
2019-03-23 05:25:13 +00:00
|
|
|
lda #(0+128)
|
2019-01-19 03:32:55 +00:00
|
|
|
sta LEFT_LIMIT
|
2019-03-23 05:25:13 +00:00
|
|
|
lda #(37+128)
|
2019-01-19 03:32:55 +00:00
|
|
|
sta RIGHT_LIMIT
|
2019-01-17 21:58:19 +00:00
|
|
|
|
|
|
|
;=============================
|
2019-03-19 01:29:32 +00:00
|
|
|
; Load background to $c00
|
2019-01-17 21:58:19 +00:00
|
|
|
|
2019-01-23 20:48:32 +00:00
|
|
|
jsr cavern_load_background
|
2019-01-17 21:58:19 +00:00
|
|
|
|
2019-01-23 20:48:32 +00:00
|
|
|
;================================
|
2019-03-19 01:29:32 +00:00
|
|
|
; Load quake background to $BC00
|
2019-01-20 06:02:41 +00:00
|
|
|
|
2019-01-23 20:48:32 +00:00
|
|
|
jsr gr_make_quake
|
2019-01-20 06:45:51 +00:00
|
|
|
|
2019-01-23 20:48:32 +00:00
|
|
|
;================================
|
|
|
|
; setup per-cave variables
|
2019-01-20 06:45:51 +00:00
|
|
|
|
2019-01-20 06:02:41 +00:00
|
|
|
lda WHICH_CAVE
|
2019-01-23 20:48:32 +00:00
|
|
|
bne cave1
|
2019-01-20 06:02:41 +00:00
|
|
|
|
2019-01-23 20:48:32 +00:00
|
|
|
cave0:
|
2019-01-21 04:53:49 +00:00
|
|
|
; set slug table to use
|
|
|
|
lda #0
|
|
|
|
sta ds_smc1+1
|
2019-01-23 20:36:20 +00:00
|
|
|
lda #(SLUG_STRUCT_SIZE*3)
|
2019-01-21 04:53:49 +00:00
|
|
|
sta ds_smc2+1
|
|
|
|
|
2019-01-20 06:45:51 +00:00
|
|
|
; set right exit
|
|
|
|
lda #1
|
|
|
|
sta cer_smc+1
|
|
|
|
lda #<ootw_cavern
|
|
|
|
sta cer_smc+5
|
|
|
|
lda #>ootw_cavern
|
|
|
|
sta cer_smc+6
|
|
|
|
|
|
|
|
; set left exit
|
|
|
|
lda #0
|
|
|
|
sta cel_smc+1
|
|
|
|
lda #<ootw_pool
|
|
|
|
sta cel_smc+5
|
|
|
|
lda #>ootw_pool
|
|
|
|
sta cel_smc+6
|
|
|
|
|
2019-01-23 20:48:32 +00:00
|
|
|
jmp cave_setup_done
|
2019-01-20 06:45:51 +00:00
|
|
|
|
2019-01-23 20:48:32 +00:00
|
|
|
cave1:
|
2019-01-20 06:45:51 +00:00
|
|
|
|
2019-01-21 04:53:49 +00:00
|
|
|
; set slug table to use
|
2019-01-23 20:36:20 +00:00
|
|
|
lda #(SLUG_STRUCT_SIZE*3)
|
2019-01-21 04:53:49 +00:00
|
|
|
sta ds_smc1+1
|
2019-01-23 20:36:20 +00:00
|
|
|
lda #(SLUG_STRUCT_SIZE*7)
|
2019-01-21 04:53:49 +00:00
|
|
|
sta ds_smc2+1
|
|
|
|
|
2019-01-20 06:45:51 +00:00
|
|
|
; set right exit
|
|
|
|
lda #1
|
|
|
|
sta cer_smc+1
|
|
|
|
lda #<ootw_mesa
|
|
|
|
sta cer_smc+5
|
|
|
|
lda #>ootw_mesa
|
|
|
|
sta cer_smc+6
|
|
|
|
|
|
|
|
; set left exit
|
|
|
|
lda #0
|
|
|
|
sta cel_smc+1
|
|
|
|
lda #<ootw_cavern
|
|
|
|
sta cel_smc+5
|
|
|
|
lda #>ootw_cavern
|
|
|
|
sta cel_smc+6
|
|
|
|
|
2019-01-23 20:48:32 +00:00
|
|
|
cave_setup_done:
|
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:13:34 +00:00
|
|
|
|
2019-03-23 17:20:43 +00:00
|
|
|
;===============
|
|
|
|
; check keyboard
|
2019-01-18 17:00:25 +00:00
|
|
|
|
2019-03-23 17:20:43 +00:00
|
|
|
jsr handle_keypress
|
2019-01-18 17:00:25 +00:00
|
|
|
|
|
|
|
|
|
|
|
;===============
|
2019-03-23 17:20:43 +00:00
|
|
|
; move physicist
|
2019-01-18 17:00:25 +00:00
|
|
|
|
2019-03-23 17:20:43 +00:00
|
|
|
jsr move_physicist
|
2019-01-18 17:00:25 +00:00
|
|
|
|
2019-03-16 18:17:20 +00:00
|
|
|
;===============
|
|
|
|
; check room limits
|
|
|
|
|
|
|
|
jsr check_screen_limit
|
|
|
|
|
|
|
|
|
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-20 06:54:58 +00:00
|
|
|
jsr draw_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:
|
|
|
|
|
|
|
|
|
2019-01-20 06:45:51 +00:00
|
|
|
|
|
|
|
;=================
|
2019-01-17 21:58:19 +00:00
|
|
|
; see if game over
|
|
|
|
lda GAME_OVER
|
2019-01-20 06:45:51 +00:00
|
|
|
beq still_in_cavern ; if 0, continue as per normal
|
|
|
|
|
|
|
|
cmp #$ff ; if $ff, we died
|
2019-01-17 22:14:19 +00:00
|
|
|
beq done_cavern
|
|
|
|
|
2019-01-20 06:45:51 +00:00
|
|
|
;===========================
|
|
|
|
; see if exited room to right
|
2019-01-17 22:14:19 +00:00
|
|
|
cmp #1
|
2019-01-20 06:45:51 +00:00
|
|
|
beq cavern_exit_left
|
|
|
|
|
|
|
|
cavern_exit_right:
|
|
|
|
lda #0
|
|
|
|
sta PHYSICIST_X
|
|
|
|
cer_smc:
|
|
|
|
lda #$0
|
|
|
|
sta WHICH_CAVE
|
|
|
|
jmp ootw_pool
|
2019-01-17 22:14:19 +00:00
|
|
|
|
2019-01-20 06:45:51 +00:00
|
|
|
|
|
|
|
;==========================
|
|
|
|
; see if exited room to left
|
|
|
|
cavern_exit_left:
|
2019-01-17 22:14:19 +00:00
|
|
|
lda #37
|
|
|
|
sta PHYSICIST_X
|
2019-01-20 06:45:51 +00:00
|
|
|
cel_smc:
|
|
|
|
lda #$0
|
|
|
|
sta WHICH_CAVE
|
2019-01-17 22:14:19 +00:00
|
|
|
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
|
|
|
|
|
2019-01-23 20:48:32 +00:00
|
|
|
|
|
|
|
|
|
|
|
;===============================
|
|
|
|
; load proper background to $c00
|
|
|
|
;===============================
|
|
|
|
|
|
|
|
cavern_load_background:
|
|
|
|
|
|
|
|
lda WHICH_CAVE
|
|
|
|
bne cave_bg1
|
|
|
|
|
|
|
|
cave_bg0:
|
|
|
|
; load background
|
|
|
|
lda #>(cavern_rle)
|
|
|
|
sta GBASH
|
|
|
|
lda #<(cavern_rle)
|
|
|
|
sta GBASL
|
|
|
|
jmp cave_bg_done
|
|
|
|
|
|
|
|
cave_bg1:
|
|
|
|
; load background
|
|
|
|
lda #>(cavern2_rle)
|
|
|
|
sta GBASH
|
|
|
|
lda #<(cavern2_rle)
|
|
|
|
sta GBASL
|
|
|
|
cave_bg_done:
|
2019-02-03 05:55:45 +00:00
|
|
|
lda #$c ; load image off-screen $c00
|
2019-01-23 20:48:32 +00:00
|
|
|
jmp load_rle_gr ; tail call
|