ootw: spin off earthquake code

This commit is contained in:
Vince Weaver 2019-01-20 01:05:52 -05:00
parent e55c030176
commit 43da6edbfa
4 changed files with 66 additions and 59 deletions

View File

@ -18,7 +18,7 @@ OOTW: ootw.o
ootw.o: ootw.s \
gr_copy.s gr_fast_clear.s gr_pageflip.s gr_unrle.s gr_putsprite.s \
keyboard.s sluggy.s \
ootw_rope.s \
ootw_rope.s earthquake.s \
ootw_pool.s ootw_cavern.s physicist.s random16.s slug_cutscene.s \
ootw_pool.inc \
ootw_cavern.inc ootw_cavern2.inc ootw_cavern3.inc \

62
ootw/earthquake.s Normal file
View File

@ -0,0 +1,62 @@
;==========================
; check for earthquake
earthquake_handler:
lda FRAMEH
and #3
bne earth_mover
lda FRAMEL
cmp #$ff
bne earth_mover
earthquake_init:
lda #200
sta EQUAKE_PROGRESS
lda #0
sta BOULDER_Y
jsr random16
lda SEEDL
and #$1f
clc
adc #4
sta BOULDER_X
earth_mover:
lda EQUAKE_PROGRESS
beq earth_still
and #$8
bne earth_calm
lda #2
bne earth_decrement
earth_calm:
lda #0
earth_decrement:
sta EARTH_OFFSET
dec EQUAKE_PROGRESS
jmp earth_done
earth_still:
lda #0
sta EARTH_OFFSET
earth_done:
;================================
; copy background to current page
lda EARTH_OFFSET
bne shake_shake
no_shake:
jsr gr_copy_to_current
jmp done_shake
shake_shake:
jsr gr_copy_to_current_1000
done_shake:
rts

View File

@ -121,6 +121,7 @@ end_message:
.include "ootw_cavern.s"
.include "physicist.s"
.include "sluggy.s"
.include "earthquake.s"
.include "text_print.s"
.include "gr_pageflip.s"
.include "gr_unrle.s"

View File

@ -78,65 +78,9 @@ cave_bg_done:
cavern_loop:
;==========================
; check for earthquake
earthquake_handler:
lda FRAMEH
and #3
bne earth_mover
lda FRAMEL
cmp #$ff
bne earth_mover
earthquake_init:
lda #200
sta EQUAKE_PROGRESS
lda #0
sta BOULDER_Y
jsr random16
lda SEEDL
and #$1f
clc
adc #4
sta BOULDER_X
earth_mover:
lda EQUAKE_PROGRESS
beq earth_still
and #$8
bne earth_calm
lda #2
bne earth_decrement
earth_calm:
lda #0
earth_decrement:
sta EARTH_OFFSET
dec EQUAKE_PROGRESS
jmp earth_done
earth_still:
lda #0
sta EARTH_OFFSET
earth_done:
;================================
; copy background to current page
lda EARTH_OFFSET
bne shake_shake
no_shake:
jsr gr_copy_to_current
jmp done_shake
shake_shake:
jsr gr_copy_to_current_1000
done_shake:
; handle earthquake
jsr earthquake_handler
;===============
; handle slug death