ootw: c4: fall off cliff

this was a huge pain
This commit is contained in:
Vince Weaver 2019-08-09 12:54:52 -04:00
parent 381661a3d0
commit fc4d1e3b2e
11 changed files with 333 additions and 91 deletions

View File

@ -92,7 +92,8 @@ OOTW_C4: ootw_c4.o
ld65 -o OOTW_C4 ootw_c4.o -C ../linker_scripts/apple2_1700.inc
ootw_c4.o: ootw_c4.s \
gr_copy.s gr_copy_offset.s gr_fast_clear.s gr_pageflip.s gr_unrle.s \
gr_copy.s gr_twoscreen_scroll.s gr_fast_clear.s gr_pageflip.s \
gr_unrle.s \
gr_putsprite.s gr_putsprite_flipped.s gr_putsprite_crop.s \
keyboard.s gr_run_sequence.s physicist.s ootw_c4_city.s \
door.s \

126
ootw/gr_twoscreen_scroll.s Normal file
View File

@ -0,0 +1,126 @@
;=========================================================
; gr_twoscreen_scroll, 40x48 version
;=========================================================
; offset is in BG_SCROLL, must be multiple of 2
;
; two screens, top is at $1000, bottom at $BC00
; copy lines Y-48 from $1000 to $c00
; copy lines 0 - (48-y) from $BC00 to $c00
gr_twoscreen_scroll:
lda #0
sta TEMPY ; dest
ldy BG_SCROLL
gr_twoscreen_top:
; calculate source
lda gr_offsets+1,Y
clc
adc #($10-4)
sta gr_twoscreen_smc_src+2
lda gr_offsets,Y
sta gr_twoscreen_smc_src+1
tya
pha
; calculate destination
lda TEMPY
tay
lda gr_offsets+1,Y
clc
adc #($c-4)
sta gr_twoscreen_smc_dst+2
lda gr_offsets,Y
sta gr_twoscreen_smc_dst+1
ldx #0
gr_twoscreen_line_loop:
gr_twoscreen_smc_src:
lda $1000,X
gr_twoscreen_smc_dst:
sta $c00,X
inx
cpx #40
bne gr_twoscreen_line_loop
inc TEMPY
inc TEMPY
pla
tay
iny
iny
cpy #48
bne gr_twoscreen_top
;===============================
; now copy the bottom from $BC00
lda BG_SCROLL
beq done_twoscreen_bottom ; if 0, no bottom
ldy #0
gr_twoscreen_bottom:
; calculate source
lda gr_offsets+1,Y
clc
adc #($bc-4)
sta gr_twoscreen_bottom_smc_src+2
lda gr_offsets,Y
sta gr_twoscreen_bottom_smc_src+1
tya
pha
; calculate destination
lda TEMPY
tay
lda gr_offsets+1,Y
clc
adc #($c-4)
sta gr_twoscreen_bottom_smc_dst+2
lda gr_offsets,Y
sta gr_twoscreen_bottom_smc_dst+1
ldx #0
gr_twoscreen_bottom_line_loop:
gr_twoscreen_bottom_smc_src:
lda $BC00,X
gr_twoscreen_bottom_smc_dst:
sta $c00,X
inx
cpx #40
bne gr_twoscreen_bottom_line_loop
inc TEMPY
inc TEMPY
pla
tay
iny
iny
cpy BG_SCROLL
bne gr_twoscreen_bottom
done_twoscreen_bottom:
rts ; 6

View File

@ -27,7 +27,7 @@ handle_keypress:
beq no_keypress
cmp #P_SWINGING
beq no_keypress
cmp #P_FALLING
cmp #P_FALLING_SIDEWAYS
beq no_keypress
lda KEYPRESS ; 4

View File

@ -329,7 +329,7 @@ check_swung_off:
sta BEAST_DIRECTION
lda #10
sta PHYSICIST_Y
lda #P_FALLING
lda #P_FALLING_SIDEWAYS
sta PHYSICIST_STATE
jmp ootw_pool

View File

@ -88,12 +88,11 @@ end_message:
.include "gr_unrle.s"
.include "gr_fast_clear.s"
.include "gr_copy.s"
.include "gr_copy_offset.s"
.include "gr_twoscreen_scroll.s"
.include "gr_putsprite.s"
.include "gr_putsprite_flipped.s"
.include "gr_putsprite_crop.s"
.include "gr_offsets.s"
.include "gr_offsets_hl.s"
.include "random16.s"
.include "keyboard.s"

View File

@ -6,6 +6,7 @@ ootw_city_init:
lda #0
sta PHYSICIST_STATE
sta WHICH_ROOM
sta BG_SCROLL
sta DIRECTION ; left
lda #1
@ -140,6 +141,25 @@ room3:
lda #18
sta PHYSICIST_Y
; load top high
lda #>(causeway2_rle)
sta GBASH
lda #<(causeway2_rle)
sta GBASL
lda #$10 ; load to page $1000
jsr load_rle_gr
; load pit background even higher
lda #>(pit_rle)
sta GBASH
lda #<(pit_rle)
sta GBASL
lda #$BC ; load to page $BC00
jsr load_rle_gr
; load background
lda #>(causeway2_rle)
sta GBASH
@ -149,9 +169,6 @@ room3:
; down at the bottom
room4:
; cmp #4
; bne jail5
lda #(17+128)
sta LEFT_LIMIT
@ -166,9 +183,9 @@ room4:
sta PHYSICIST_Y
; load background
; lda #>(room_b2_rle)
; sta GBASH
; lda #<(room_b2_rle)
lda #>(pit_rle)
sta GBASH
lda #<(pit_rle)
jmp room_setup_done
@ -212,11 +229,58 @@ city_loop:
;================================
; copy background to current page
;================================
lda WHICH_ROOM
cmp #3
bne nothing_fancy
lda PHYSICIST_STATE
cmp #P_FALLING_SIDEWAYS
beq scroll_bg
cmp #P_FALLING_DOWN
bne nothing_fancy
scroll_bg:
lda FRAMEL
and #$3
bne no_scroll_progress
inc BG_SCROLL
inc BG_SCROLL
ldy BG_SCROLL
cpy #48
forever:
beq forever
no_scroll_progress:
lda #$94
ldy #0
clear1:
sta $c00,Y
sta $d00,Y
sta $e00,Y
sta $f00,Y
iny
bne clear1
; ldy BG_SCROLL
jsr gr_twoscreen_scroll
jmp done_city_bg
nothing_fancy:
done_city_bg:
jsr gr_copy_to_current
;==================================
; draw background action
;==================================
lda WHICH_JAIL
@ -280,31 +344,46 @@ c4_no_bg_action:
jsr move_physicist
;===============================
; move friend
;===============================
; jsr move_friend
;===============
;===================
; check room limits
;===================
jsr check_screen_limit
;===================
; extra room limits
;===================
lda WHICH_ROOM
cmp #3
bne regular_room
lda PHYSICIST_X
cmp #8
bcc regular_room ; blt
lda PHYSICIST_STATE
cmp #P_JUMPING
beq fall_sideways
; if not jumping then fall
lda #P_FALLING_DOWN
sta PHYSICIST_STATE
jmp regular_room
fall_sideways:
lda #P_FALLING_SIDEWAYS
sta PHYSICIST_STATE
regular_room:
;===============
; draw physicist
jsr draw_physicist
;===============
; draw friend
; jsr draw_friend
c4_done_draw_friend:
;========================
; draw foreground action

View File

@ -8,7 +8,7 @@ all: ootw_c4_city.inc
#####
ootw_c4_city.inc: $(PNG2RLE) \
recharge.png hallway.png causeway1.png causeway2.png
recharge.png hallway.png causeway1.png causeway2.png pit.png
$(PNG2RLE) asm recharge.png recharge_rle > ootw_c4_city.inc
$(PNG2RLE) asm hallway.png hallway_rle >> ootw_c4_city.inc
$(PNG2RLE) asm causeway1.png causeway1_rle >> ootw_c4_city.inc

View File

@ -182,67 +182,61 @@ causeway2_rle: .byte $28 ; ysize=48
.byte $A1
pit_rle: .byte $28 ; ysize=48
.byte $00,$00, $22, $55,$55, $52, $22, $25, $55,$55
.byte $77, $A5,$22, $A8,$00, $88, $A3,$00, $A5,$22, $A6,$00
.byte $FF, $00,$00, $22, $55, $57, $07, $57
.byte $77, $05, $55, $57, $72, $A4,$22, $A8,$00
.byte $58, $00,$00, $20, $A5,$22, $A6,$00, $FF, $00,$00
.byte $22, $A3,$00, $55, $77, $00, $55,$55, $77
.byte $A4,$22, $A8,$00, $55, $00,$00, $A6,$22, $A6,$00, $FF
.byte $00,$00, $22, $00, $20, $22, $55, $27
.byte $55, $00, $05, $27, $A3,$22, $52, $A8,$00
.byte $55, $A3,$00, $27, $A4,$22, $A6,$00, $FF, $00,$00
.byte $55, $00, $22,$22, $55, $22, $05, $50
.byte $55, $A4,$22, $75, $A8,$00, $55, $A4,$00, $02,$02
.byte $22, $A7,$00, $FF, $00,$00, $55, $00, $22,$22
.byte $05, $22, $A4,$55, $A4,$22, $A8,$00, $22, $AE,$00
.byte $FF, $00,$00, $55, $00, $22, $55, $00
.byte $77, $22, $20, $22, $20, $A6,$00, $A3,$05
.byte $80, $00,$00, $02, $A4,$22, $AA,$00, $22, $55
.byte $57, $07, $57, $77, $05, $55, $57
.byte $72, $A4,$22, $A8,$00, $88, $00,$00, $20, $A5,$22
.byte $A9,$00, $22, $A3,$00, $55, $77, $00, $55,$55
.byte $77, $A4,$22, $A8,$00, $58, $00,$00, $A6,$22, $A9,$00
.byte $22, $00, $20, $22, $55, $27, $55
.byte $00, $05, $27, $A3,$22, $52, $A8,$00, $55
.byte $A3,$00, $27, $A4,$22, $A9,$00, $55, $00, $22,$22
.byte $55, $22, $05, $50, $55, $A4,$22, $75
.byte $A8,$00, $55, $A4,$00, $02,$02, $22, $AA,$00, $55
.byte $00, $22,$22, $05, $22, $A4,$55, $A4,$22, $A8,$00
.byte $22, $A0,$11,$00, $55, $00, $22, $55, $00
.byte $22, $55, $05,$05, $85, $A4,$22, $00, $20
.byte $AA,$00, $20, $AA,$00, $FF, $00,$00, $55, $00,$00
.byte $55, $00, $22, $05, $00, $22, $88
.byte $A4,$22, $00, $22, $AB,$00, $02, $22, $20
.byte $A7,$00, $FF, $00, $22, $55, $00, $50
.byte $05, $00, $22,$22, $00, $05, $88, $A3,$22
.byte $02, $00, $22, $AC,$00, $22, $A8,$00, $FF
.byte $00, $22, $00,$00, $55, $00, $55, $22
.byte $50,$50, $55, $88, $A3,$22, $00,$00, $22, $AC,$00
.byte $02, $A8,$00, $FF, $00, $22, $00,$00, $55
.byte $00, $55, $22, $A3,$55, $88,$88, $22,$22, $00,$00
.byte $22, $AA,$00, $02, $AA,$00, $FF, $00, $22
.byte $00,$00, $55, $00, $55, $22,$22, $05, $50
.byte $88,$88, $22,$22, $00, $22, $00,$00, $50,$50, $A4,$52
.byte $22, $20,$20, $AB,$00, $FF, $00, $22, $00,$00
.byte $55, $00, $55, $A3,$22, $55, $77, $88
.byte $22, $00,$00, $22, $A7,$00, $02, $A5,$22, $A9,$00
.byte $FF, $00, $22, $00,$00, $55, $00, $55
.byte $AA,$00, $20, $AD,$00, $55, $00,$00, $55, $00
.byte $22, $05, $00, $22, $88, $A4,$22, $00
.byte $22, $AB,$00, $02, $22, $20, $A9,$00, $22
.byte $55, $00, $50, $05, $00, $22,$22, $00
.byte $05, $88, $A3,$22, $02, $00, $22, $AC,$00
.byte $22, $AA,$00, $22, $00,$00, $55, $00, $55
.byte $22, $50,$50, $55, $88, $A3,$22, $00,$00, $22
.byte $AC,$00, $02, $AA,$00, $22, $00,$00, $55, $00
.byte $55, $22, $A3,$55, $88,$88, $22,$22, $00,$00, $22
.byte $AA,$00, $02, $AC,$00, $22, $00,$00, $55, $00
.byte $55, $22,$22, $05, $50, $88,$88, $22,$22, $00
.byte $22, $00,$00, $50,$50, $A4,$52, $22, $20,$20, $AD,$00
.byte $22, $00,$00, $55, $00, $55, $A3,$22, $55
.byte $77, $88, $22, $00,$00, $22, $A7,$00, $02
.byte $A5,$22, $AB,$00, $22, $00,$00, $55, $00, $55
.byte $72, $22,$22, $55, $77, $88, $22, $00,$00
.byte $55, $AB,$00, $22, $02, $A9,$00, $FF, $00
.byte $22, $00,$00, $05, $55, $00, $55, $22,$22
.byte $55, $77, $58, $22, $00,$00, $25, $A5,$00
.byte $50,$50, $A3,$20, $22, $02, $AA,$00, $FF, $00
.byte $22, $A3,$00, $55, $00, $55, $22, $25
.byte $55, $77, $55, $A3,$00, $22, $A5,$00, $02
.byte $22, $A3,$02, $AC,$00, $FF, $00, $22, $A3,$00
.byte $55, $00, $55,$55, $22, $55, $77, $55
.byte $A3,$00, $52, $A5,$00, $50, $22, $A3,$00, $20
.byte $AB,$00, $FF, $00, $22, $00,$00, $20, $55
.byte $00, $55,$55, $22, $55, $77, $55, $A3,$00
.byte $55, $A6,$00, $22, $A4,$00, $02, $AA,$00, $FF
.byte $00, $22, $00,$00, $22, $55, $00, $55,$55
.byte $22, $55, $77, $80, $A3,$00, $55, $A3,$00
.byte $20, $00, $22, $A0,$10,$00, $FF, $00, $20
.byte $00,$00, $22, $55, $00, $55,$55, $22, $00
.byte $77, $88, $A3,$00, $55, $A3,$00, $22, $00
.byte $22, $A0,$10,$00, $FF, $00, $52, $00,$00, $22
.byte $55, $AB,$00, $22, $02, $AB,$00, $22, $00,$00
.byte $05, $55, $00, $55, $22,$22, $55, $77
.byte $58, $22, $00,$00, $25, $A5,$00, $50,$50, $A3,$20
.byte $22, $02, $AC,$00, $22, $A3,$00, $55, $00
.byte $55, $22, $25, $55, $77, $55, $A3,$00
.byte $22, $A5,$00, $02, $22, $A3,$02, $AE,$00, $22
.byte $A3,$00, $55, $00, $55,$55, $22, $55, $77
.byte $55, $A3,$00, $52, $A5,$00, $50, $22, $A3,$00
.byte $20, $AD,$00, $22, $00,$00, $20, $55, $00
.byte $55,$55, $22, $55, $77, $55, $A3,$00, $55
.byte $A6,$00, $22, $A4,$00, $02, $AC,$00, $22, $00,$00
.byte $22, $55, $00, $55,$55, $22, $55, $77
.byte $80, $A3,$00, $55, $A3,$00, $20, $00, $22
.byte $A0,$12,$00, $20, $00,$00, $22, $55, $00, $55,$55
.byte $22, $00, $77, $88, $A3,$00, $55, $A3,$00
.byte $22, $00, $22, $A0,$12,$00, $52, $00,$00, $22
.byte $55, $00, $22, $55,$55, $00, $55, $22,$22
.byte $02, $22,$22, $20, $00,$00, $22, $00, $02
.byte $A0,$10,$00, $FF, $00, $55, $00,$00, $02, $25
.byte $50, $22, $55,$55, $00, $55, $22,$22, $00
.byte $22, $00, $22, $02, $22,$22, $20, $00
.byte $22, $AF,$00, $FF, $00, $25, $A3,$00, $02
.byte $25, $52, $25, $55, $00, $55, $72
.byte $22, $00, $22, $00, $22, $00, $22
.byte $00, $22, $00, $02, $AF,$00, $FF, $00
.byte $22, $20, $00, $22, $20, $22,$22, $25
.byte $05, $00,$00, $07, $02, $00, $02, $00
.byte $22, $00, $22, $00, $22, $A0,$11,$00, $FF
.byte $A0,$12,$00, $55, $00,$00, $02, $25, $50, $22
.byte $55,$55, $00, $55, $22,$22, $00, $22, $00
.byte $22, $02, $22,$22, $20, $00, $22, $A0,$11,$00
.byte $25, $A3,$00, $02, $25, $52, $25, $55
.byte $00, $55, $72, $22, $00, $22, $00
.byte $22, $00, $22, $00, $22, $00, $02
.byte $A0,$11,$00, $22, $20, $00, $22, $20, $22,$22
.byte $25, $05, $00,$00, $07, $02, $00, $02
.byte $00, $22, $00, $22, $00, $22, $A0,$12,$00
.byte $A1

Binary file not shown.

Before

Width:  |  Height:  |  Size: 495 B

After

Width:  |  Height:  |  Size: 8.6 KiB

View File

@ -68,11 +68,12 @@ pstate_table_lo:
.byte <physicist_kicking ; 04
.byte <physicist_jumping ; 05
.byte <physicist_collapsing ; 06
.byte <physicist_falling ; 07
.byte <physicist_falling_sideways; 07
.byte <physicist_standing ; 08 swinging
.byte <physicist_standing ; 09 elevator up
.byte <physicist_standing ; 0A elevator down
.byte <physicist_shooting ; 0B
.byte <physicist_falling_down ; 0C
pstate_table_hi:
.byte >physicist_standing
@ -82,11 +83,12 @@ pstate_table_hi:
.byte >physicist_kicking
.byte >physicist_jumping
.byte >physicist_collapsing
.byte >physicist_falling
.byte >physicist_falling_sideways
.byte >physicist_standing ; 08 swinging
.byte >physicist_standing ; 09 elevator up
.byte >physicist_standing ; 0A elevator down
.byte >physicist_shooting ; 0B
.byte >physicist_falling_down ; 0C
; Urgh, make sure this doesn't end up at $FF or you hit the
; NMOS 6502 bug
@ -320,10 +322,10 @@ no_collapse_progress:
;==================================
; FALLING
; FALLING SIDEWAYS
;==================================
physicist_falling:
physicist_falling_sideways:
lda FRAMEL
@ -337,6 +339,7 @@ physicist_falling:
no_fall_progress:
lda PHYSICIST_Y
fall_sideways_destination_smc:
cmp #22
bne still_falling
done_falling:
@ -358,6 +361,44 @@ still_falling:
jmp finally_draw_him
;==================================
; FALLING DOWN
;==================================
physicist_falling_down:
lda FRAMEL
and #$3
bne no_fall_down_progress
inc PHYSICIST_Y ; must me mul of 2
inc PHYSICIST_Y
no_fall_down_progress:
lda PHYSICIST_Y
fall_down_destination_smc:
cmp #22
bne still_falling_down
done_falling_down:
lda #P_CROUCHING
sta PHYSICIST_STATE
jmp physicist_crouching
still_falling_down:
lda #<phys_stand
sta INL
lda #>phys_stand
sta INH
jmp finally_draw_him
;=============================
; Actually Draw Him
;=============================

View File

@ -176,11 +176,12 @@ PHYSICIST_STATE = $EA
P_KICKING = $04
P_JUMPING = $05 ; no keypress
P_COLLAPSING = $06 ; no keypress
P_FALLING = $07 ; no keypress
P_FALLING_SIDEWAYS = $07 ; no keypress
P_SWINGING = $08 ; no keypress
P_ELEVATING_UP = $09
P_ELEVATING_DOWN = $0A
P_SHOOTING = $0B
P_FALLING_DOWN = $0C
BUBBLES_Y = $EB ; C1 underwater
BEFORE_SWING = $EB ; C1
@ -222,6 +223,7 @@ ELEVATOR_COUNT = $F9 ; INTRO
TENTACLE_GRAB = $F9 ; C1
CAGE_AMPLITUDE = $F9 ; C2 cage
ELEVATOR_OFFSET = $F9 ; C2 jail
BG_SCROLL = $F9 ; C4
TEMP = $FA