ootw: have beast appear

This commit is contained in:
Vince Weaver 2019-03-24 01:14:23 -04:00
parent d28b3e9062
commit 4905a1dd05
7 changed files with 239 additions and 4 deletions

View File

@ -25,7 +25,7 @@ ootw.o: ootw.s \
gr_copy.s gr_fast_clear.s gr_pageflip.s gr_unrle.s \
gr_putsprite.s gr_putsprite_flipped.s gr_putsprite_crop.s \
gr_make_quake.s gr_overlay.s zp.inc \
keyboard.s sluggy.s \
keyboard.s sluggy.s beast.s \
ootw_rope.s earthquake.s ootw_mesa.s \
ootw_pool.s ootw_cavern.s physicist.s random16.s \
cutscene_slug.s cutscene_beast.s \

185
ootw/beast.s Normal file
View File

@ -0,0 +1,185 @@
;=======================================
; Move Beast
move_beast:
; lda PHYSICIST_STATE
; cmp #P_WALKING
; beq move_physicist_walking
; cmp #P_RUNNING
; beq move_physicist_running
rts
;======================
; running
move_beast_running:
inc BEAST_GAIT ; cycle through animation
lda BEAST_GAIT
and #$3
cmp #$2 ; only run roughly 1/4 of time
bne b_no_move_run
lda BEAST_DIRECTION
beq b_run_left
inc BEAST_X ; run right
rts
b_run_left:
dec BEAST_X ; run left
b_no_move_run:
rts
;======================
; standing
move_beast_standing:
;======================================
; draw beast
;======================================
draw_beast:
lda BEAST_STATE
cmp #B_STANDING
beq b_standing
cmp #B_RUNNING
beq b_running
rts
;==================================
; STANDING
;==================================
b_standing:
lda #<beast_standing
sta INL
lda #>beast_standing
sta INH
jmp finally_draw_beast
;===============================
; Running
;================================
b_running:
lda BEAST_GAIT
cmp #16
bcc brun_gait_fine ; blt
lda #0
sta GAIT
brun_gait_fine:
lsr
and #$fe
tax
lda beast_run_progression,X
sta INL
lda beast_run_progression+1,X
sta INH
jmp finally_draw_beast
;==================================
; COLLAPSING
;==================================
;physicist_collapsing:
; lda GAIT
; cmp #18
; bne collapse_not_done
;really_dead:
; lda #$ff
; sta GAME_OVER
; jmp finally_draw_him
;collapse_not_done:
; ldx GAIT
; lda collapse_progression,X
; sta INL
; lda collapse_progression+1,X
; sta INH
; lda FRAMEL
; and #$1f
; bne no_collapse_progress
; inc GAIT
; inc GAIT
;no_collapse_progress:
; jmp finally_draw_him
;=============================
; Actually Draw Beast
;=============================
finally_draw_beast:
lda BEAST_X
sta XPOS
lda #26
sec
sbc EARTH_OFFSET ; adjust for earthquakes
sta YPOS
lda BEAST_DIRECTION
bne b_facing_right
b_facing_left:
jmp put_sprite_crop
b_facing_right:
jmp put_sprite_flipped_crop
;======================================
; Check beast limit
;======================================
check_beast_limit:
; clc
; lda PHYSICIST_X
; adc #$80
; cmp LEFT_LIMIT
; bcs just_fine_left ; (bge==bcs)
;too_far_left:
; lda #1
; sta GAME_OVER
; rts
;just_fine_left:
; Check right edge of screen
; cmp RIGHT_LIMIT
; bcc just_fine_right ; blt
;too_far_right:
; lda #2
; sta GAME_OVER
;just_fine_right:
; rts

View File

@ -96,6 +96,7 @@ end_message:
.include "ootw_mesa.s"
.include "physicist.s"
.include "sluggy.s"
.include "beast.s"
.include "earthquake.s"
.include "text_print.s"
.include "gr_pageflip.s"

View File

@ -21,7 +21,7 @@ ootw_cavern:
lda #(0+128)
sta LEFT_LIMIT
lda #(37+128)
lda #(38+128)
sta RIGHT_LIMIT
;=============================

View File

@ -17,6 +17,19 @@ beast_standing:
.byte $aa,$aa,$00,$a0,$aa,$a0,$00,$00,$aa
.byte $aa,$aa,$00,$aa,$aa,$aa,$00,$aa,$00
beast_run_progression:
.word beast_running1
.word beast_running2
.word beast_running3
.word beast_running4
.word beast_running5
.word beast_running6
.word beast_running7
.word beast_running8
beast_running1: ; piskel2
.byte $9,$6
.byte $aa,$0a,$00,$00,$0a,$aa,$aa,$aa,$aa

View File

@ -1,6 +1,7 @@
; Ootw mesa at far right
ootw_mesa:
;===========================
; Enable graphics
@ -159,12 +160,29 @@ beyond_mesa_normal:
jsr check_screen_limit
;===============
; draw physicist
jsr draw_physicist
;================
; handle beast
lda BEAST_OUT
beq mesa_no_beast
;================
; draw beast
jsr move_beast
;================
; draw beast
jsr draw_beast
mesa_no_beast:
level1_ending:
;===============
@ -230,7 +248,15 @@ trigger_beast:
sta BEAST_OUT
lda #0
sta BEAST_DIRECTION
sta BEAST_GAIT
sta BEAST_STATE ; B_STANDING
sta GAME_OVER
sta PHYSICIST_STATE ; stop in tracks
lda #30
sta BEAST_X
lda #(39+128) ; update right side of screen
sta RIGHT_LIMIT ; this is mostly for testing

View File

@ -30,7 +30,17 @@ COLOR = $30
SEEDL = $4e
SEEDH = $4f
XMAX = $50
XMAX = $50
BEAST_X = $51
BEAST_GAIT = $52
BEAST_COUNT = $53
BEAST_STATE = $54
B_STANDING = $00
B_RUNNING = $01
B_FALLING = $02
B_DEAD = $03
BEAST_DIRECTION = $55
;INVFLG = $32
; dos33 zero page = 26-2f, 35-38, 3e 3f 40-4d