From 038a7fc033ed5b67df8f33e5b2d21c0499f68be2 Mon Sep 17 00:00:00 2001 From: Vince Weaver Date: Thu, 8 Aug 2019 22:02:16 -0400 Subject: [PATCH] ootw: c5: add bare-bones level5 --- ootw/Makefile | 17 +- ootw/ootw_c5.s | 104 +++++++ ootw/ootw_c5_cave.s | 324 +++++++++++++++++++++ ootw/ootw_graphics/l5cave/ootw_c5_cave.inc | 23 ++ ootw/zp.inc | 2 +- 5 files changed, 468 insertions(+), 2 deletions(-) create mode 100644 ootw/ootw_c5.s create mode 100644 ootw/ootw_c5_cave.s create mode 100644 ootw/ootw_graphics/l5cave/ootw_c5_cave.inc diff --git a/ootw/Makefile b/ootw/Makefile index 86872ec1..f89ce8c2 100644 --- a/ootw/Makefile +++ b/ootw/Makefile @@ -7,7 +7,7 @@ PNG2LZ4 = ../gr-utils/png2lz4 all: ootw.dsk -ootw.dsk: HELLO LOADER INTRO OOTW_C1 OOTW_C2 OOTW_C3 OOTW_C4 +ootw.dsk: HELLO LOADER INTRO OOTW_C1 OOTW_C2 OOTW_C3 OOTW_C5 cp empty.dsk ootw.dsk $(DOS33) -y ootw.dsk SAVE A HELLO $(DOS33) -y ootw.dsk BSAVE -a 0x1400 LOADER @@ -16,6 +16,7 @@ ootw.dsk: HELLO LOADER INTRO OOTW_C1 OOTW_C2 OOTW_C3 OOTW_C4 $(DOS33) -y ootw.dsk BSAVE -a 0x1700 OOTW_C2 $(DOS33) -y ootw.dsk BSAVE -a 0x1700 OOTW_C3 $(DOS33) -y ootw.dsk BSAVE -a 0x1700 OOTW_C4 + $(DOS33) -y ootw.dsk BSAVE -a 0x1700 OOTW_C5 # $(DOS33) -y ootw.dsk BSAVE -a 0x1700 AUDIO_TEST # $(DOS33) -y ootw.dsk BSAVE -a 0x2000 COMPRESS-TEST @@ -99,6 +100,20 @@ ootw_c4.o: ootw_c4.s \ ootw_graphics/l4city/ootw_c4_city.inc ca65 -o ootw_c4.o ootw_c4.s -l ootw_c4.lst +### + +OOTW_C5: ootw_c5.o + ld65 -o OOTW_C5 ootw_c5.o -C ../linker_scripts/apple2_1700.inc + +ootw_c5.o: ootw_c5.s \ + gr_copy.s gr_copy_offset.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_c5_cave.s \ + door.s \ + ootw_graphics/sprites/physicist.inc \ + ootw_graphics/l5cave/ootw_c5_cave.inc + ca65 -o ootw_c5.o ootw_c5.s -l ootw_c5.lst + #### diff --git a/ootw/ootw_c5.s b/ootw/ootw_c5.s new file mode 100644 index 00000000..eae2baf0 --- /dev/null +++ b/ootw/ootw_c5.s @@ -0,0 +1,104 @@ +; Ootw for Apple II Lores +; Checkpoint5 (accidentally in a coal mine it was found) + +; by Vince "Deater" Weaver + +.include "zp.inc" +.include "hardware.inc" + + +ootw_c5: + + ; Initialize some variables + +ootw_c5_restart: + + jsr ootw_cave_init + + ;========================= + ; c5_new_cave + ;========================= + ; enter new cave on level5 + +c5_new_cave: + lda #0 + sta GAME_OVER + + jsr ootw_cave + +c5_check_done: + lda GAME_OVER + cmp #$ff + beq quit_level + + ; only exit if done level + ; FIXME: or quit pressed? + + lda WHICH_JAIL + cmp #11 + bne c5_new_cave + + +;=========================== +; quit_level +;=========================== + +quit_level: + jsr TEXT + jsr HOME + lda KEYRESET ; clear strobe + + lda #0 + sta DRAW_PAGE + + lda #end_message + sta OUTH + + jsr move_and_print + jsr move_and_print + +wait_loop: + lda KEYPRESS + bpl wait_loop + + lda KEYRESET ; clear strobe + + lda #0 + sta GAME_OVER + + jmp ootw_c5_restart + + +end_message: +.byte 8,10,"PRESS RETURN TO CONTINUE",0 +.byte 11,20,"ACCESS CODE: CAVE",0 + +.include "ootw_c5_cave.s" +.include "text_print.s" +.include "gr_pageflip.s" +.include "gr_unrle.s" +.include "gr_fast_clear.s" +.include "gr_copy.s" +.include "gr_copy_offset.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" + +.include "physicist.s" +.include "alien.s" + +.include "door.s" + +; room backgrounds +.include "ootw_graphics/l5cave/ootw_c5_cave.inc" +; sprites +.include "ootw_graphics/sprites/physicist.inc" +.include "ootw_graphics/sprites/alien.inc" + + diff --git a/ootw/ootw_c5_cave.s b/ootw/ootw_c5_cave.s new file mode 100644 index 00000000..e60aef59 --- /dev/null +++ b/ootw/ootw_c5_cave.s @@ -0,0 +1,324 @@ +; Ootw Checkpoint5 -- Running around the Caves + + + ; call once before entering cave for first time +ootw_cave_init: + lda #0 + sta PHYSICIST_STATE + sta WHICH_CAVE + + lda #1 + sta HAVE_GUN + sta DIRECTION ; right + + lda #0 + sta PHYSICIST_X + lda #20 + sta PHYSICIST_Y + + rts + + + ;=========================== + ; enter new room in cave + ;=========================== + +ootw_cave: + + ;============================== + ; each room init + +; lda #0 +; sta ON_ELEVATOR +; sta TELEPORTING + + ;============================== + ; setup per-room variables + + lda WHICH_CAVE + bne cave1 + + ; Room0 entrance +cave0: + lda #(0+128) + sta LEFT_LIMIT + lda #(38+128) + sta RIGHT_LIMIT + + ; set right exit + lda #1 + sta cer_smc+1 + + ; set left exit + lda #0 + sta cel_smc+1 + + lda #14 + sta PHYSICIST_Y + + ; load background + lda #>(entrance_rle) + sta GBASH + lda #<(entrance_rle) + + jmp cave_setup_done + + ; hallway with weird ceiling +cave1: +; cmp #1 +; bne cave2 + +; lda #(-4+128) +; sta LEFT_LIMIT +; lda #(39+128) +; sta RIGHT_LIMIT + + ; set right exit +; lda #2 +; sta cer_smc+1 + + ; set left exit +; lda #0 +; sta cel_smc+1 + +; lda #8 +; sta PHYSICIST_Y + + ; load background +; lda #>(hallway_rle) +; sta GBASH +; lda #<(hallway_rle) + + jmp cave_setup_done + +cave_setup_done: + + sta GBASL + lda #$c ; load to page $c00 + jsr load_rle_gr ; tail call + + +ootw_cave_already_set: + ;=========================== + ; Enable graphics + + bit LORES + bit SET_GR + bit FULLGR + + ;=========================== + ; Setup pages (is this necessary?) + + lda #0 + sta DRAW_PAGE + lda #1 + sta DISP_PAGE + + ;================================= + ; setup vars + + lda #0 + sta GAIT + sta GAME_OVER + + ;============================ + ;============================ + ; Cave Loop + ;============================ + ;============================ +cave_loop: + + ;================================ + ; copy background to current page + + jsr gr_copy_to_current + + ;================================== + ; draw background action + + lda WHICH_CAVE + +bg_cave0: + +; cmp #0 +; bne c4_no_bg_action + +; lda FRAMEL +; and #$c +; lsr +; tay + + +; lda #11 +; sta XPOS +; lda #24 +; sta YPOS + +; lda recharge_bg_progression,Y +; sta INL +; lda recharge_bg_progression+1,Y +; sta INH + +; jsr put_sprite + +c5_no_bg_action: + + ;=============================== + ; check keyboard + + jsr handle_keypress + + ;=============================== + ; move physicist + ;=============================== + + jsr move_physicist + + ;=============================== + ; move friend + ;=============================== + +; jsr move_friend + + + ;=============== + ; check room limits + + jsr check_screen_limit + + + ;=============== + ; draw physicist + + jsr draw_physicist + + ;=============== + ; draw friend + +; jsr draw_friend + +c5_done_draw_friend: + + + ;======================== + ; draw foreground action + +; lda WHICH_CAVE +; cmp #2 +; bne c4_no_fg_action + +;c2_draw_cart: +; +; lda CART_X +; sta XPOS +; lda #36 +; sta YPOS +; lda #cart_sprite +; sta INH +; jsr put_sprite_crop +; jmp c2_no_fg_action + +c5_no_fg_action: + + ;==================== + ; activate fg objects + ;==================== +;c2_fg_check_jail1: +; lda WHICH_JAIL +; cmp #1 +; bne c2_fg_check_jail2 +; +; lda CART_OUT +; bne c2_fg_check_jail2 +; +; inc CART_OUT + + + ;================ + ; move fg objects + ;================ +c4_move_fg_objects: + +; lda CART_OUT +; cmp #1 +; bne cart_not_out + + ; move cart + +; lda FRAMEL +; and #$3 +; bne cart_not_out +; +; inc CART_X +; lda CART_X +; cmp #39 +; bne cart_not_out +; inc CART_OUT + + + ;=============== + ; page flip + + jsr page_flip + + ;================ + ; inc frame count + + inc FRAMEL + bne cave_frame_no_oflo + inc FRAMEH +cave_frame_no_oflo: + + ;========================== + ; check if done this level + ;========================== + + lda GAME_OVER + beq still_in_cave + + cmp #$ff ; if $ff, we died + beq done_cave + + ;=============================== + ; check if exited room to right + cmp #1 + beq cave_exit_left + + ;================= + ; exit to right + +cave_right_yes_exit: + + lda #0 + sta PHYSICIST_X +cer_smc: + lda #$0 ; smc+1 = exit location + sta WHICH_CAVE + jmp done_cave + + ;===================== + ; exit to left + +cave_exit_left: + + lda #37 + sta PHYSICIST_X +cel_smc: + lda #0 ; smc+1 + sta WHICH_CAVE + jmp done_cave + + ; loop forever +still_in_cave: + lda #0 + sta GAME_OVER + + jmp cave_loop + +done_cave: + rts + + + diff --git a/ootw/ootw_graphics/l5cave/ootw_c5_cave.inc b/ootw/ootw_graphics/l5cave/ootw_c5_cave.inc new file mode 100644 index 00000000..28a90211 --- /dev/null +++ b/ootw/ootw_graphics/l5cave/ootw_c5_cave.inc @@ -0,0 +1,23 @@ +entrance_rle: .byte $28 ; ysize=48 + .byte $A0,$17,$00, $20, $A0,$26,$00, $02, $A6,$00, $02, $20,$20 + .byte $AA,$00, $20, $A0,$12,$00, $22, $AA,$00, $06,$06, $A3,$20 + .byte $A3,$00, $20, $00, $22, $A0,$11,$00, $22, $A0,$13,$00 + .byte $22, $00, $22, $20, $00,$00, $A3,$20, $26 + .byte $06, $02,$02, $20,$20, $A3,$00, $20, $02, $A0,$14,$00 + .byte $22, $00, $02, $22, $AB,$00, $A4,$02, $A0,$15,$00 + .byte $22, $00,$00, $02, $A0,$24,$00, $22, $A0,$20,$00, $02,$02 + .byte $66, $60, $A4,$00, $22, $A0,$21,$00, $20, $22 + .byte $A4,$00, $22, $AA,$00, $60, $A0,$16,$00, $62, $60 + .byte $A4,$00, $22, $AB,$00, $66, $A0,$11,$00, $20, $22 + .byte $00,$00, $06, $66, $60, $A3,$00, $22, $A9,$00 + .byte $20,$20, $06, $A0,$15,$00, $22, $02, $06, $A3,$00 + .byte $22, $AB,$00, $02, $22, $A0,$14,$00, $02, $60 + .byte $62, $60,$60, $00,$00, $02, $20, $AA,$00, $22 + .byte $AA,$00, $A3,$20, $22, $02,$02, $06, $00,$00, $02 + .byte $A7,$00, $20, $02, $00,$00, $A5,$20, $00,$00, $02 + .byte $20, $A4,$00, $A4,$26, $06, $02,$02, $A0,$10,$00, $02 + .byte $00, $A3,$02, $A7,$00, $22, $A0,$27,$00, $02, $20 + .byte $A0,$27,$00, $22, $A0,$27,$00, $22, $A0,$27,$00, $22, $A0,$27,$00 + .byte $22, $A0,$27,$00, $62, $A0,$27,$00, $66, $A0,$27,$00, $66 + .byte $A0,$18,$00 + .byte $A1 diff --git a/ootw/zp.inc b/ootw/zp.inc index c205dfc7..b263ca15 100644 --- a/ootw/zp.inc +++ b/ootw/zp.inc @@ -133,7 +133,7 @@ EXIT_COUNT = $E2 ; C1 pool WHICH_SLUG = $E2 ; C1 TELEPORTING = $E2 ; C2 jail -WHICH_CAVE = $E3 ; C1 +WHICH_CAVE = $E3 ; C1,C5 WHICH_JAIL = $E3 ; C2 WHICH_ROOM = $E3 ; C4