From 1909896922267333738863cfaf619b76d75bfea4 Mon Sep 17 00:00:00 2001 From: Vince Weaver Date: Thu, 25 Jul 2019 17:09:44 -0400 Subject: [PATCH] ootw: start work on underwater scene --- ootw/Makefile | 2 +- ootw/ootw_c1.s | 24 ++ ootw/ootw_c1_arrival.s | 343 ++++++++++++++++++ ootw/ootw_graphics/l1underwater/Makefile | 4 +- .../l1underwater/ootw_underwater.inc | 123 +++++-- ootw/zp.inc | 1 + 6 files changed, 461 insertions(+), 36 deletions(-) create mode 100644 ootw/ootw_c1_arrival.s diff --git a/ootw/Makefile b/ootw/Makefile index d5d867ee..024c3c38 100644 --- a/ootw/Makefile +++ b/ootw/Makefile @@ -28,7 +28,7 @@ ootw_c1.o: ootw_c1.s \ gr_putsprite.s gr_putsprite_flipped.s gr_putsprite_crop.s \ gr_make_quake.s gr_overlay.s zp.inc keyboard.s \ ootw_sluggy.s ootw_beast.s \ - ootw_c1_rope.s earthquake.s ootw_c1_mesa.s \ + ootw_c1_arrival.s ootw_c1_rope.s earthquake.s ootw_c1_mesa.s \ ootw_c1_pool.s ootw_c1_cavern.s physicist.s random16.s \ ootw_cut_slug.s ootw_cut_beast.s \ ootw_graphics/l1pool/ootw_pool.inc \ diff --git a/ootw/ootw_c1.s b/ootw/ootw_c1.s index 814a42eb..4b298930 100644 --- a/ootw/ootw_c1.s +++ b/ootw/ootw_c1.s @@ -19,6 +19,26 @@ ootw: sta BEAST_OUT sta ON_ELEVATOR + + ;======================= + ; Handle Arrival + ;======================= + + jsr ootw_c1_arrival + + + ; Initialize some variables + + lda #0 + sta GAME_OVER + sta EQUAKE_PROGRESS + sta EARTH_OFFSET + sta PHYSICIST_STATE + sta WHICH_CAVE + sta BEAST_OUT + sta ON_ELEVATOR + + lda #1 sta BEFORE_SWING @@ -91,10 +111,14 @@ end_message: .byte 8,10,"PRESS RETURN TO CONTINUE",0 .byte 11,20,"ACCESS CODE: IH8S",0 +; rooms +.include "ootw_c1_arrival.s" .include "ootw_c1_rope.s" .include "ootw_c1_pool.s" .include "ootw_c1_cavern.s" .include "ootw_c1_mesa.s" + +; movement .include "physicist.s" .include "ootw_sluggy.s" .include "ootw_beast.s" diff --git a/ootw/ootw_c1_arrival.s b/ootw/ootw_c1_arrival.s new file mode 100644 index 00000000..4c08bd41 --- /dev/null +++ b/ootw/ootw_c1_arrival.s @@ -0,0 +1,343 @@ +; Ootw Checkpoint1 -- arriving with a splash + +ootw_c1_arrival: + ;=========================== + ; Enable graphics + + bit LORES + bit SET_GR + bit FULLGR + + ;=========================== + ; Setup pages (is this necessary?) + + lda #0 + sta DRAW_PAGE + lda #1 + sta DISP_PAGE + + ;============================= + ; Load background to $c00 + + lda #>(underwater_rle) + sta GBASH + lda #<(underwater_rle) + sta GBASL + lda #$c ; load image off-screen $c00 + jsr load_rle_gr + + + ;================================= + ; do intro flash + + jsr do_flash + + + ;================================= + ; setup vars + + lda #0 + sta GAME_OVER + + lda #20 + sta BUBBLES_Y + + + + bit KEYRESET ; clear keypress + + ;============================ + ; Underwater Loop + ;============================ +underwater_loop: + + ;================================ + ; copy background to current page + ;================================ + + jsr gr_copy_to_current + + + ;======================= + ; draw Surface ripple + ;======================= + +; jsr ootw_draw_miners + + ;====================== + ; draw console + ;====================== + + lda #11 + sta XPOS + lda #0 + sta YPOS + +; lda #cage_center_sprite +; sta INH +; jsr put_sprite_crop +; jmp done_drawing_cage + + + ;================================= + ; draw physicist + ;================================= + + ;====================== + ; draw monster + ;====================== + + ;====================== + ; draw bubbles + ;====================== + + lda BUBBLES_Y + cmp #2 + bcc no_draw_bubbles ; blt + + sta YPOS + + lda #17 + sta XPOS + + + lda #bubbles_sprite + sta INH + jsr put_sprite_crop +no_draw_bubbles: + + + + + ;=============================== + ; check keyboard + ;=============================== + + lda KEYPRESS + bpl underwater_done_keyboard + + cmp #27+$80 + beq underwater_escape + +; cmp #'A'+$80 +; beq cage_left_pressed +; cmp #8+$80 +; beq cage_left_pressed + +; cmp #'D'+$80 +; beq cage_right_pressed +; cmp #$15+$80 +; beq cage_right_pressed + + jmp underwater_done_keyboard + +underwater_escape: + lda #$ff + sta GAME_OVER + bne underwater_done_keyboard ; bra + + +;cage_left_pressed: +; lda CAGE_AMPLITUDE +; bne cage_left_already_moving +; lda #8 ; *2 +; sta CAGE_OFFSET +; jmp cage_inc_amplitude + +underwater_done_keyboard: + + + ;================================= + ; move things + ;================================= + + ;=================== + ; move bubbles + ;=================== + + lda FRAMEL + and #$f + bne no_move_bubbles + + ldx BUBBLES_Y + beq no_move_bubbles + + dex + dex + stx BUBBLES_Y + +no_move_bubbles: + + + ;=============== + ; page flip + + jsr page_flip + + ;================ + ; inc frame count + + inc FRAMEL + bne underwater_frame_no_oflo + inc FRAMEH + +underwater_frame_no_oflo: + + + ;========================== + ; check if done this level + ;========================== + + lda GAME_OVER + cmp #$ff + beq done_underwater + + + + ; loop forever + + jmp underwater_loop + +done_underwater: + rts + + + + + + + + + +bubbles_sprite: + .byte 5,2 + .byte $6A,$AA,$A6,$7A,$6A + .byte $AA,$AA,$A6,$AA,$AA + + + + + + + + + + + + ;============================ + ; Do Flash + ;============================ +do_flash: + + lda #0 + sta FRAMEL + + ;============================ + ; Flash Loop + ;============================ +flash_loop: + + + + ;================================ + ; Handle Flash + ;================================ + + lda FRAMEL + cmp #180 + bcc no_flash ; blt + cmp #182 + bcc first_flash + bcs second_flash + +first_flash: + + ; Load background to $1000 + + lda #>(uboot_flash1_rle) + sta GBASH + lda #<(uboot_flash1_rle) + sta GBASL + lda #$10 ; load image off-screen $c00 + jsr load_rle_gr + + jsr gr_overlay + + jmp check_flash_done +second_flash: + + ; Load background to $1000 + + lda #>(uboot_flash2_rle) + sta GBASH + lda #<(uboot_flash2_rle) + sta GBASL + lda #$10 ; load image off-screen $c00 + jsr load_rle_gr + + jsr gr_overlay + + jmp check_flash_done + +no_flash: + ;================================ + ; copy background to current page + ;================================ + + jsr gr_copy_to_current + +check_flash_done: + + + ;======================= + ; draw Surface ripple + ;======================= + +; jsr ootw_draw_miners + + ;======================= + ; draw Overall ripple + ;======================= + + + + ;=============== + ; page flip + + jsr page_flip + + ;================ + ; inc frame count + + inc FRAMEL + bne flash_frame_no_oflo + inc FRAMEH + +flash_frame_no_oflo: + + + ;========================== + ; check if done this level + ;========================== + + lda FRAMEL + cmp #184 + beq done_flash + + + + ; loop forever + + jmp flash_loop + +done_flash: + rts + + + + + diff --git a/ootw/ootw_graphics/l1underwater/Makefile b/ootw/ootw_graphics/l1underwater/Makefile index b8b09831..39efd6a5 100644 --- a/ootw/ootw_graphics/l1underwater/Makefile +++ b/ootw/ootw_graphics/l1underwater/Makefile @@ -8,7 +8,9 @@ all: ootw_underwater.inc ##### ootw_underwater.inc: $(PNG2RLE) another_uboot.png - $(PNG2RLE) asm another_uboot.png underwater_rle > ootw_underwater.inc + $(PNG2RLE) asm ootw_uboot_bg.png underwater_rle > ootw_underwater.inc + $(PNG2RLE) asm ootw_uboot_flash1.png uboot_flash1_rle >> ootw_underwater.inc + $(PNG2RLE) asm ootw_uboot_flash2.png uboot_flash2_rle >> ootw_underwater.inc ##### diff --git a/ootw/ootw_graphics/l1underwater/ootw_underwater.inc b/ootw/ootw_graphics/l1underwater/ootw_underwater.inc index 7bec4844..8b182710 100644 --- a/ootw/ootw_graphics/l1underwater/ootw_underwater.inc +++ b/ootw/ootw_graphics/l1underwater/ootw_underwater.inc @@ -2,38 +2,93 @@ underwater_rle: .byte $28 ; ysize=48 .byte $22,$22, $A3,$00, $A3,$22, $26, $22, $66, $6E .byte $2E, $6E, $25,$25, $66, $6E,$6E, $A4,$66, $5E .byte $2F,$2F, $6F, $A3,$66, $26,$26, $02, $A7,$00, $22,$22 - .byte $A3,$00, $02, $22,$22, $02, $22, $00, $22 - .byte $A4,$00, $50, $20, $A3,$00, $22, $A8,$00, $22 - .byte $A9,$00, $02, $22, $A4,$00, $22, $00, $20 - .byte $02, $22, $A5,$00, $02,$02, $AC,$00, $22, $20 - .byte $A9,$00, $22, $20, $A3,$00, $22, $00, $02 - .byte $00, $22, $A3,$00, $02, $A7,$00, $22, $A7,$00 - .byte $22, $20, $02,$02, $A6,$00, $20,$20, $22, $20 - .byte $00,$00, $02, $A3,$00, $22, $00,$00, $20, $00,$00 - .byte $60, $A7,$00, $20,$20, $A4,$00, $22, $A6,$00, $A3,$20 - .byte $00, $A3,$02, $22, $26, $60,$60, $20, $00 - .byte $22, $A5,$00, $06, $A7,$00, $02,$02, $A4,$00, $22 - .byte $00, $20,$20, $22,$22, $A4,$02, $A9,$00, $02, $22 - .byte $A5,$00, $20,$20, $A3,$00, $22, $A8,$00, $22, $02,$02 - .byte $A0,$11,$00, $22, $A6,$00, $02, $00, $02, $AA,$00 - .byte $22, $A0,$13,$00, $22, $A9,$00, $20, $00,$00, $22,$22 - .byte $A5,$00, $22, $A9,$00, $50, $20, $50, $A4,$00 - .byte $22, $00,$00, $22, $A4,$00, $02, $00,$00, $02 - .byte $A6,$00, $20, $A3,$00, $22, $AA,$00, $A3,$22, $A3,$20 - .byte $00, $02, $00,$00, $22, $A7,$00, $02, $AA,$00 - .byte $22, $AA,$00, $27, $A5,$22, $A4,$00, $22, $A4,$00 - .byte $22, $A6,$00, $02, $A6,$00, $22, $AA,$00, $A3,$02 - .byte $A3,$22, $A4,$00, $22, $A8,$00, $02, $22, $00,$00 - .byte $20, $A5,$00, $22, $AD,$00, $02,$02, $A5,$00, $22 - .byte $A0,$12,$00, $22, $AB,$00, $05, $A7,$00, $20, $22 - .byte $A6,$00, $22, $AB,$00, $22, $02, $20, $AF,$00 - .byte $20, $02, $00, $22, $A0,$12,$00, $22, $00,$00 - .byte $02, $20, $AB,$00, $20, $02, $A3,$00, $02 - .byte $22, $A0,$11,$00, $22, $A4,$00, $02, $20,$20, $A5,$00 - .byte $20, $22, $02, $20, $A5,$00, $22,$22, $A5,$00 - .byte $02, $AA,$00, $22, $A5,$00, $02, $22,$22, $20 - .byte $00, $20, $22,$22, $00,$00, $22, $A5,$00, $22 - .byte $A0,$11,$00, $22, $A7,$00, $02, $A3,$22, $02, $00,$00 - .byte $20, $02, $A5,$00, $22, $AF,$00, $22, $00 - .byte $22, $A9,$00, $02, $A0,$A0,$00 + .byte $A3,$00, $22,$22, $02,$02, $22, $00, $22, $A4,$00 + .byte $50, $20, $A3,$00, $22, $A8,$00, $22, $A9,$00 + .byte $02, $22, $A3,$00, $22, $00,$00, $A3,$22, $00,$00 + .byte $02, $00,$00, $02,$02, $AC,$00, $22, $AA,$00, $22 + .byte $A3,$00, $22, $00, $02, $00,$00, $22, $A7,$00 + .byte $02, $A3,$00, $22, $A7,$00, $22, $A9,$00, $20 + .byte $22, $20, $00,$00, $22, $A4,$00, $22, $A4,$00 + .byte $60,$60, $A7,$00, $20,$20, $A4,$00, $22, $A6,$00, $A3,$20 + .byte $00,$00, $02,$02, $06,$06, $60, $20, $00,$00, $22 + .byte $A4,$00, $02, $05, $A7,$00, $02,$02, $A4,$00, $22 + .byte $00, $20,$20, $A4,$22, $02,$02, $AA,$00, $22, $A5,$00 + .byte $20,$20, $A3,$00, $20, $A8,$00, $22, $02,$02, $A0,$11,$00 + .byte $22, $A6,$00, $02, $AC,$00, $22, $A0,$13,$00, $22 + .byte $A9,$00, $20, $00,$00, $22,$22, $A5,$00, $22, $A9,$00 + .byte $A3,$20, $A7,$00, $22, $A3,$00, $02, $A3,$00, $02 + .byte $A7,$00, $20, $00,$00, $20, $02, $A9,$00, $A3,$22 + .byte $A3,$20, $A4,$00, $22, $A7,$00, $02, $A4,$00, $20 + .byte $00,$00, $02, $00,$00, $22, $AA,$00, $A6,$22, $A4,$00 + .byte $22, $A4,$00, $22, $A3,$00, $20, $A3,$00, $02 + .byte $A5,$00, $22, $AA,$00, $02,$02, $A4,$22, $A4,$00, $22 + .byte $A8,$00, $02, $A3,$00, $25, $A5,$00, $22, $AC,$00 + .byte $A4,$02, $A4,$00, $22, $A0,$12,$00, $22, $A0,$12,$00, $20 + .byte $22,$22, $20, $A4,$00, $22, $AC,$00, $22, $02 + .byte $20,$20, $AD,$00, $20, $22, $02, $00,$00, $22 + .byte $A0,$11,$00, $22, $00,$00, $02, $22, $20, $A9,$00 + .byte $20, $22, $02, $A4,$00, $22, $A0,$11,$00, $22 + .byte $A4,$00, $02, $22, $20, $A5,$00, $20, $22 + .byte $02, $22, $A5,$00, $22,$22, $A5,$00, $02, $AA,$00 + .byte $22, $A6,$00, $02, $22, $20, $00, $20 + .byte $22, $02, $00,$00, $22, $A5,$00, $22, $AF,$00 + .byte $20, $00, $22, $A8,$00, $A3,$22, $A3,$00, $20 + .byte $02, $A5,$00, $22, $AF,$00, $02, $00, $22 + .byte $A9,$00, $02, $A3,$00, $22, $02, $A3,$00, $20 + .byte $22, $00, $22, $A0,$10,$00, $20, $22, $A0,$11,$00 + .byte $20, $22,$22, $00, $22, $A0,$10,$00, $22, $00 + .byte $22, $A0,$10,$00, $22, $02, $00, $22,$22, $AC,$00 + .byte $20, $A3,$00, $22, $00, $02, $20, $AF,$00 + .byte $02, $00, $22, $00, $22, $AC,$00, $02 + .byte $A3,$00, $22, $00,$00, $22, $A8,$00 + .byte $A1 +uboot_flash1_rle: .byte $28 ; ysize=48 + .byte $A0,$FF,$EE, $A0,$A3,$EE, $FE, $FF, $FE, $A0,$13,$EE, $A0,$11,$FE + .byte $A5,$FF, $A0,$12,$FE, $A0,$28,$FF, $A0,$11,$EE, $EF, $A3,$FF, $EF + .byte $A0,$24,$EE, $EF,$EF, $A0,$FF,$EE, $A0,$7D,$EE + .byte $A1 +uboot_flash2_rle: .byte $28 ; ysize=48 + .byte $55,$55, $A3,$22, $66, $56, $66,$66, $65, $66 + .byte $A3,$6F, $A3,$66, $6F,$6F, $A4,$66, $A4,$6F, $A3,$66, $56,$56 + .byte $A8,$22, $55,$55, $A3,$22, $66, $55, $25,$25, $66 + .byte $A6,$22, $62,$62, $A3,$22, $56, $A8,$22, $55, $A9,$22 + .byte $25, $55, $A3,$22, $66, $22,$22, $55, $66,$66 + .byte $A5,$22, $26,$26, $AC,$22, $55, $AA,$22, $55, $A3,$22 + .byte $66, $A4,$22, $66, $A7,$22, $25, $A3,$22, $56 + .byte $A7,$22, $55, $A9,$22, $62, $65, $62, $22,$22 + .byte $66, $A4,$22, $56, $A4,$22, $F2,$F2, $A7,$22, $52 + .byte $62, $A4,$22, $55, $A6,$22, $A3,$62, $22,$22, $A4,$26 + .byte $A3,$62, $22, $55, $A4,$22, $26,$26, $A7,$22, $25,$25 + .byte $A4,$22, $55, $22, $52,$52, $A3,$56, $55, $25,$25 + .byte $A9,$22, $26, $55, $A5,$22, $52, $62, $A3,$22 + .byte $52, $A8,$22, $55, $25,$25, $A0,$11,$22, $55, $A6,$22 + .byte $25, $AC,$22, $55, $A0,$13,$22, $55, $A9,$22, $52 + .byte $22,$22, $55, $56, $A5,$22, $55, $A9,$22, $A3,$62 + .byte $A7,$22, $55, $A3,$22, $25, $A3,$22, $E5, $EE,$EE + .byte $E2, $A4,$22, $52, $22,$22, $52, $25, $A9,$22 + .byte $A3,$66, $A3,$52, $A4,$22, $55, $A6,$22, $E2, $A4,$EE + .byte $E2, $52, $22,$22, $25, $22,$22, $55, $AA,$22 + .byte $A3,$66, $A3,$55, $A4,$22, $55, $A4,$22, $55, $22 + .byte $EE,$EE, $FE,$FE, $EE,$EE, $25, $A5,$22, $55, $AA,$22 + .byte $26,$26, $56, $A3,$55, $A4,$22, $55, $A6,$22, $A3,$EE + .byte $EF, $EE,$EE, $65, $A5,$22, $55, $AC,$22, $A4,$25 + .byte $A4,$22, $55, $A6,$22, $2E, $A4,$EE, $2E, $A6,$22 + .byte $55, $A0,$12,$22, $52, $55,$55, $52, $A4,$22, $55 + .byte $22, $A4,$2E, $A7,$22, $55, $25, $52,$52, $AD,$22 + .byte $52, $65, $25, $22,$22, $55, $A0,$11,$22, $55 + .byte $22,$22, $25, $55, $52, $A9,$22, $52, $55 + .byte $25, $A4,$22, $55, $A0,$11,$22, $55, $A4,$22, $25 + .byte $55, $52, $A5,$22, $52, $55, $25, $66 + .byte $A5,$22, $55,$55, $A5,$22, $25, $AA,$22, $55, $A6,$22 + .byte $25, $55, $52, $22, $52, $55, $25 + .byte $22,$22, $66, $A5,$22, $55, $AF,$22, $52, $22 + .byte $55, $A8,$22, $A3,$55, $A3,$22, $62, $26, $A5,$22 + .byte $55, $AF,$22, $25, $22, $55, $A9,$22, $25 + .byte $A3,$22, $66, $26, $A3,$22, $52, $55, $22 + .byte $55, $A0,$10,$22, $52, $55, $A0,$11,$22, $52, $55,$55 + .byte $22, $55, $A0,$10,$22, $55, $22, $55, $A0,$10,$22 + .byte $55, $25, $22, $55,$55, $AC,$22, $52, $A3,$22 + .byte $55, $22, $25, $52, $AF,$22, $25, $22 + .byte $55, $22, $55, $AC,$22, $25, $A3,$22, $55 + .byte $22,$22, $55, $A8,$22 .byte $A1 diff --git a/ootw/zp.inc b/ootw/zp.inc index 5457cb3d..23e89a37 100644 --- a/ootw/zp.inc +++ b/ootw/zp.inc @@ -170,6 +170,7 @@ PHYSICIST_STATE = $EA P_ELEVATING_DOWN = $0A +BUBBLES_Y = $EB ; C1 underwater BEFORE_SWING = $EB ; C1 SHOOTING_BOTTOM = $EB ; C2 cage CART_OUT = $EB ; C2 jail