dos33fsprogs/ootw/ootw_c1_rope.s

426 lines
5.8 KiB
ArmAsm
Raw Normal View History

2019-01-19 04:23:18 +00:00
; Ootw Rope course
ootw_rope:
;===========================
; Enable graphics
bit LORES
bit SET_GR
bit FULLGR
;===========================
; Setup pages (is this necessary?)
lda #0
sta DRAW_PAGE
lda #1
sta DISP_PAGE
;=================================
2019-01-19 04:23:18 +00:00
; Setup right/left exit paramaters
lda #(39+128)
2019-01-19 04:23:18 +00:00
sta RIGHT_LIMIT
sta RIGHT_WALK_LIMIT
lda #(11+128)
2019-01-19 04:23:18 +00:00
sta LEFT_LIMIT
sta LEFT_WALK_LIMIT
2019-01-19 04:23:18 +00:00
2019-03-17 05:28:42 +00:00
lda #0
sta SWING_PROGRESS
2019-01-21 05:30:17 +00:00
2019-01-19 04:23:18 +00:00
;=============================
; Load background to $c00
lda BEFORE_SWING
beq after_swing_bg
before_swing_bg:
2019-01-19 04:23:18 +00:00
lda #>(rope_rle)
sta GBASH
lda #<(rope_rle)
sta GBASL
jmp load_swing_bg
after_swing_bg:
lda #>(broke_rope_rle)
sta GBASH
lda #<(broke_rope_rle)
sta GBASL
load_swing_bg:
lda #$c ; load image off-screen $c00
2019-01-19 04:23:18 +00:00
jsr load_rle_gr
;================================
; Load quake background to $BC00
jsr gr_make_quake
2019-01-19 04:23:18 +00:00
;=================================
; copy $c00 to both pages $400/$800
2019-01-19 04:23:18 +00:00
; jsr gr_copy_to_current
; jsr page_flip
2019-01-19 04:23:18 +00:00
;=================================
; setup vars
lda #0
sta GAIT
sta GAME_OVER
lda #3
sta WHICH_CAVE
2019-03-25 04:12:09 +00:00
jsr setup_beast
;============================
2019-01-19 04:23:18 +00:00
;============================
; Rope Loop
;============================
2019-03-25 04:12:09 +00:00
;============================
2019-01-19 04:23:18 +00:00
rope_loop:
2019-03-17 05:28:42 +00:00
;============================
; Check if swinging
;============================
lda SWING_PROGRESS
beq no_swing
2019-03-19 04:31:18 +00:00
cmp #80 ; only load background on first frame
bne swing_not_first
lda #<no_rope_rle
sta GBASL
lda #>no_rope_rle
sta GBASH
lda #$C ; load image off-screen $C00
jsr load_rle_gr
swing_not_first:
2019-03-17 05:28:42 +00:00
dec SWING_PROGRESS
dec SWING_PROGRESS
ldx SWING_PROGRESS
lda swing_progression,X
sta GBASL
lda swing_progression+1,X
sta GBASH
2019-03-19 04:31:18 +00:00
lda #$10 ; load image off-screen $1000
2019-03-17 05:28:42 +00:00
jsr load_rle_gr
2019-03-19 04:31:18 +00:00
jsr gr_overlay_40x40
; FIXME
; jsr gr_make_quake ; make quake
2019-03-17 05:28:42 +00:00
2019-03-19 04:31:18 +00:00
jmp beyond_quake
2019-03-17 05:28:42 +00:00
no_swing:
2019-01-19 04:23:18 +00:00
;================================
; handle earthquakes
2019-01-19 04:23:18 +00:00
jsr earthquake_handler
2019-01-19 04:23:18 +00:00
2019-03-19 04:31:18 +00:00
beyond_quake:
2019-01-19 04:23:18 +00:00
;===============================
; check keyboard
jsr handle_keypress
;===============================
; move physicist
jsr move_physicist
;===============================
; check screen limits
jsr check_screen_limit
2019-03-25 04:12:09 +00:00
;================
; handle beast
lda BEAST_OUT
beq rope_no_beast
;================
; move beast
jsr move_beast
;================
; draw beast
; adjust y for slope
; shift by 2 from physicist as beast is 9 wide (vs 5)
lda BEAST_X
cmp #24
bcs beast_no_adjust_y ; bge
cmp #15
bcc beast_on_platform ; blt
clc
adc #1
and #$fe ; our sprite code only draws even y
jmp beast_done_adjust_y
; 16 maps to -> 16
; 24 maps to -> 24
beast_on_platform:
lda #16
bne beast_done_adjust_y
beast_no_adjust_y:
lda #24
beast_done_adjust_y:
sta BEAST_Y
2019-03-25 04:12:09 +00:00
jsr draw_beast
rope_no_beast:
2019-03-17 05:28:42 +00:00
;===============================
; check if swinging off
lda PHYSICIST_STATE
cmp #P_SWINGING
bne done_swing_check
lda SWING_PROGRESS
bne done_swing_check
2019-01-19 04:23:18 +00:00
2019-03-17 05:28:42 +00:00
; swung off screen!
lda #5
sta GAME_OVER
2019-03-19 04:31:18 +00:00
2019-03-17 05:28:42 +00:00
done_swing_check:
2019-01-19 04:23:18 +00:00
;===============
; draw physicist
2019-01-21 05:30:17 +00:00
; adjust y for slope
lda PHYSICIST_X
cmp #26
bcs phys_no_adjust_y ; bge
2019-01-21 05:30:17 +00:00
cmp #17
bcc phys_on_platform
sec
sbc #3
and #$fe ; our sprite code only draws even y
jmp phys_done_adjust_y
; slope is 15 - 26 ( 28 - 36)
; 26 -> 22
phys_on_platform:
lda #14
bne phys_done_adjust_y
phys_no_adjust_y:
lda #22
phys_done_adjust_y:
sta PHYSICIST_Y
2019-01-19 04:23:18 +00:00
2019-03-17 05:28:42 +00:00
lda PHYSICIST_STATE
cmp #P_SWINGING
beq hes_swinging
jsr draw_physicist
hes_swinging:
2019-01-19 04:23:18 +00:00
;======================
; draw foreground plant
lda #<foreground_spikes
sta INL
lda #>foreground_spikes
sta INH
lda #30
sta XPOS
lda #30
sec
sbc EARTH_OFFSET
2019-01-19 04:23:18 +00:00
sta YPOS
jsr put_sprite
;================
; draw falling boulder
jsr draw_boulder
2019-01-19 04:23:18 +00:00
;===============
; page flip
jsr page_flip
;================
; inc frame count
inc FRAMEL
bne rope_frame_no_oflo
inc FRAMEH
rope_frame_no_oflo:
;===================
; check cliff's edge
lda PHYSICIST_X
cmp #11
bcs already_swung
lda BEFORE_SWING
beq already_swung
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
already_swung:
2019-03-17 05:28:42 +00:00
;=========================
; check if done this room
;=========================
2019-01-19 04:23:18 +00:00
2019-03-17 05:28:42 +00:00
; handle game over
2019-01-19 04:23:18 +00:00
lda GAME_OVER
cmp #$ff
beq done_rope
2019-03-17 05:28:42 +00:00
; if 2 then exiting right, to pool
2019-01-19 04:23:18 +00:00
cmp #$2
bne check_cliff_edge
2019-01-19 04:23:18 +00:00
lda #0
sta PHYSICIST_X
sta EARTH_OFFSET
2019-01-19 04:23:18 +00:00
jmp ootw_pool
2019-03-17 05:28:42 +00:00
; if 1 then at edge of cliff
check_cliff_edge:
cmp #$1
2019-03-17 05:28:42 +00:00
bne check_swung_off
lda #0
sta GAME_OVER
2019-03-17 05:28:42 +00:00
check_swung_off:
cmp #$5
bne not_done_rope
2019-03-27 03:12:44 +00:00
;==========================
; swung off screen to right
2019-03-17 05:28:42 +00:00
lda #1
sta PHYSICIST_X
sta EARTH_OFFSET
sta DIRECTION ; face right
2019-03-27 03:12:44 +00:00
sta BEAST_DIRECTION
2019-03-17 05:28:42 +00:00
lda #10
sta PHYSICIST_Y
lda #P_FALLING_SIDEWAYS
2019-03-17 05:28:42 +00:00
sta PHYSICIST_STATE
jmp ootw_pool
not_done_rope:
2019-01-19 04:23:18 +00:00
; loop forever
jmp rope_loop
done_rope:
rts
2019-03-17 05:28:42 +00:00
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