From 01a66c60b296d375dbe8836028f79358b2fcdba8 Mon Sep 17 00:00:00 2001 From: Vince Weaver Date: Mon, 27 Jan 2020 13:50:11 -0500 Subject: [PATCH] ootw: add placeholders for all levels --- ootw/Makefile | 124 ++++++++++- ootw/ootw_c10.s | 525 ++++++++++++++++++++++++++++++++++++++++++++ ootw/ootw_c11.s | 525 ++++++++++++++++++++++++++++++++++++++++++++ ootw/ootw_c12.s | 525 ++++++++++++++++++++++++++++++++++++++++++++ ootw/ootw_c13.s | 525 ++++++++++++++++++++++++++++++++++++++++++++ ootw/ootw_c5.s | 12 +- ootw/ootw_c5_cave.s | 4 +- ootw/ootw_c6.s | 525 ++++++++++++++++++++++++++++++++++++++++++++ ootw/ootw_c7.s | 525 ++++++++++++++++++++++++++++++++++++++++++++ ootw/ootw_c8.s | 525 ++++++++++++++++++++++++++++++++++++++++++++ ootw/ootw_c9.s | 525 ++++++++++++++++++++++++++++++++++++++++++++ 11 files changed, 4333 insertions(+), 7 deletions(-) create mode 100644 ootw/ootw_c10.s create mode 100644 ootw/ootw_c11.s create mode 100644 ootw/ootw_c12.s create mode 100644 ootw/ootw_c13.s create mode 100644 ootw/ootw_c6.s create mode 100644 ootw/ootw_c7.s create mode 100644 ootw/ootw_c8.s create mode 100644 ootw/ootw_c9.s diff --git a/ootw/Makefile b/ootw/Makefile index b53de2ea..af4d24a4 100644 --- a/ootw/Makefile +++ b/ootw/Makefile @@ -21,10 +21,19 @@ ootw.dsk: HELLO TITLE INTRO OOTW_C1 OOTW_C2 OOTW_C3 OOTW_C4 OOTW_C5 # $(DOS33) -y ootw.dsk BSAVE -a 0x2000 COMPRESS-TEST ootw_side2.dsk: HELLO TITLE ENDING \ - OOTW_C14 OOTW_C15 + OOTW_C6 OOTW_C7 OOTW_C8 OOTW_C9 \ + OOTW_C10 OOTW_C11 OOTW_C12 OOTW_C13 OOTW_C14 OOTW_C15 cp empty.dsk ootw_side2.dsk $(DOS33) -y ootw_side2.dsk SAVE A HELLO HELLO $(DOS33) -y ootw_side2.dsk BSAVE -a 0xd00 TITLE + $(DOS33) -y ootw_side2.dsk BSAVE -a 0x1700 OOTW_C6 + $(DOS33) -y ootw_side2.dsk BSAVE -a 0x1700 OOTW_C7 + $(DOS33) -y ootw_side2.dsk BSAVE -a 0x1700 OOTW_C8 + $(DOS33) -y ootw_side2.dsk BSAVE -a 0x1700 OOTW_C9 + $(DOS33) -y ootw_side2.dsk BSAVE -a 0x1700 OOTW_C10 + $(DOS33) -y ootw_side2.dsk BSAVE -a 0x1700 OOTW_C11 + $(DOS33) -y ootw_side2.dsk BSAVE -a 0x1700 OOTW_C12 + $(DOS33) -y ootw_side2.dsk BSAVE -a 0x1700 OOTW_C13 $(DOS33) -y ootw_side2.dsk BSAVE -a 0x1700 OOTW_C14 $(DOS33) -y ootw_side2.dsk BSAVE -a 0x1700 OOTW_C15 $(DOS33) -y ootw_side2.dsk BSAVE -a 0x1700 ENDING @@ -130,6 +139,119 @@ ootw_c5.o: ootw_c5.s \ ootw_graphics/l5cave/ootw_c5_cave.inc ca65 -o ootw_c5.o ootw_c5.s -l ootw_c5.lst +### + +OOTW_C6: ootw_c6.o + ld65 -o OOTW_C6 ootw_c6.o -C ../linker_scripts/apple2_1700.inc + +ootw_c6.o: ootw_c6.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 \ + collision.s door.s gun.s blast.s shield.s \ + ootw_graphics/sprites/physicist.inc \ + ootw_graphics/l14arena/ootw_c14_arena.inc + ca65 -o ootw_c6.o ootw_c6.s -l ootw_c6.lst +### + +OOTW_C7: ootw_c7.o + ld65 -o OOTW_C7 ootw_c7.o -C ../linker_scripts/apple2_1700.inc + +ootw_c7.o: ootw_c7.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 \ + collision.s door.s gun.s blast.s shield.s \ + ootw_graphics/sprites/physicist.inc \ + ootw_graphics/l14arena/ootw_c14_arena.inc + ca65 -o ootw_c7.o ootw_c7.s -l ootw_c7.lst +### + +OOTW_C8: ootw_c8.o + ld65 -o OOTW_C8 ootw_c8.o -C ../linker_scripts/apple2_1700.inc + +ootw_c8.o: ootw_c8.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 \ + collision.s door.s gun.s blast.s shield.s \ + ootw_graphics/sprites/physicist.inc \ + ootw_graphics/l14arena/ootw_c14_arena.inc + ca65 -o ootw_c8.o ootw_c8.s -l ootw_c8.lst + +### + +OOTW_C9: ootw_c9.o + ld65 -o OOTW_C9 ootw_c9.o -C ../linker_scripts/apple2_1700.inc + +ootw_c9.o: ootw_c9.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 \ + collision.s door.s gun.s blast.s shield.s \ + ootw_graphics/sprites/physicist.inc \ + ootw_graphics/l14arena/ootw_c14_arena.inc + ca65 -o ootw_c9.o ootw_c9.s -l ootw_c9.lst + +### + +OOTW_C10: ootw_c10.o + ld65 -o OOTW_C10 ootw_c10.o -C ../linker_scripts/apple2_1700.inc + +ootw_c10.o: ootw_c10.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 \ + collision.s door.s gun.s blast.s shield.s \ + ootw_graphics/sprites/physicist.inc \ + ootw_graphics/l14arena/ootw_c14_arena.inc + ca65 -o ootw_c10.o ootw_c10.s -l ootw_c10.lst + +### + +OOTW_C11: ootw_c11.o + ld65 -o OOTW_C11 ootw_c11.o -C ../linker_scripts/apple2_1700.inc + +ootw_c11.o: ootw_c11.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 \ + collision.s door.s gun.s blast.s shield.s \ + ootw_graphics/sprites/physicist.inc \ + ootw_graphics/l14arena/ootw_c14_arena.inc + ca65 -o ootw_c11.o ootw_c11.s -l ootw_c11.lst + +### + +OOTW_C12: ootw_c12.o + ld65 -o OOTW_C12 ootw_c12.o -C ../linker_scripts/apple2_1700.inc + +ootw_c12.o: ootw_c12.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 \ + collision.s door.s gun.s blast.s shield.s \ + ootw_graphics/sprites/physicist.inc \ + ootw_graphics/l14arena/ootw_c14_arena.inc + ca65 -o ootw_c12.o ootw_c12.s -l ootw_c12.lst + +### + +OOTW_C13: ootw_c13.o + ld65 -o OOTW_C13 ootw_c13.o -C ../linker_scripts/apple2_1700.inc + +ootw_c13.o: ootw_c13.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 \ + collision.s door.s gun.s blast.s shield.s \ + ootw_graphics/sprites/physicist.inc \ + ootw_graphics/l14arena/ootw_c14_arena.inc + ca65 -o ootw_c13.o ootw_c13.s -l ootw_c13.lst + + + + ### OOTW_C14: ootw_c14.o diff --git a/ootw/ootw_c10.s b/ootw/ootw_c10.s new file mode 100644 index 00000000..1a151293 --- /dev/null +++ b/ootw/ootw_c10.s @@ -0,0 +1,525 @@ +; Ootw for Apple II Lores + +; Checkpoint-10 (???) + +; by Vince "DEATER" Weaver + +.include "zp.inc" +.include "hardware.inc" + + + ;============================ + ; ENTRY POINT FOR LEVEL + ;============================ + +ootw_c10: + ; Initializing when entering level for first time + + + ;======================================================== + ; RESTART: called when restarting level (after game over) + ;======================================================== + +ootw_c10_restart: + + ;=================================== + ; re-initialize level state + ;=================================== + + jsr ootw_c10_level_init + + ;=========================== + ; c10_new_room + ;=========================== + ; enter new room on level 14 + +c10_new_room: + lda #0 + sta GAME_OVER + + ;==================================== + ; Initialize room based on WHICH_ROOM + ; and then play until we exit + ;==================================== + + jsr ootw_c10_setup_room_and_play + + + ;==================================== + ; we exited the room + ;==================================== +c10_check_done: + + lda GAME_OVER ; if died or quit, jump to quit level + cmp #$ff + beq quit_level + + ;===================================================== + ; Check to see which room to enter next + ; If it's a special value, means we succesfully beat the level +c10_defeated: + lda WHICH_ROOM + cmp #$ff + bne c10_new_room + + ; point to next level + ; and exit to the level loader + lda #11 + sta WHICH_LOAD + rts + + +;=========================== +; quit_level +;=========================== + +quit_level: + jsr TEXT ; text mode + jsr HOME ; clear screen + lda KEYRESET ; clear keyboard state + + lda #0 ; set to PAGE0 + sta DRAW_PAGE + + lda #end_message + sta OUTH + + jsr move_and_print + jsr move_and_print + +wait_loop: + lda KEYPRESS ; wait for keypress + bpl wait_loop + + lda KEYRESET ; clear strobe + + lda #0 + sta GAME_OVER + + jmp ootw_c10_restart ; restart level + + +;========================================= +;========================================= +; Ootw Checkpoint 14 -- Tank Arena +;========================================= +;========================================= + + ; call once before entering for first time +ootw_c10_level_init: + lda #0 + sta WHICH_ROOM + sta NUM_DOORS + + lda #1 + sta HAVE_GUN + sta DIRECTION ; right + + lda #0 + sta PHYSICIST_X + lda #10 + sta PHYSICIST_Y + + lda #P_STANDING + sta PHYSICIST_STATE + + rts + + + ;=========================== + ;=========================== + ; enter new room + ;=========================== + ;=========================== + +ootw_c10_setup_room_and_play: + + ;============================== + ; each room init + + + ;============================== + ; setup per-room variables + + lda WHICH_ROOM + bne room1 + + jsr init_shields + + ;=============================== + ; Room0 -- the arena + ;=============================== +room: + lda #(2+128) + sta LEFT_LIMIT + lda #(39+128) + sta RIGHT_LIMIT + + ; set right exit + lda #$ff ; exit level if exit this way + sta cer_smc+1 + + ; set left exit + lda #0 + sta cel_smc+1 + + lda #28 + sta PHYSICIST_Y + + ; load background + lda #>(arena_rle) + sta GBASH + lda #<(arena_rle) + + jmp room_setup_done + + ; ???? +room1: +; cmp #1 +; bne room2 + +; 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 room_setup_done + +room_setup_done: + + sta GBASL + lda #$c ; load to page $c00 + jsr load_rle_gr ; tail call + + ;===================== + ; setup walk collision + jsr recalc_walk_collision + + + +ootw_room_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 + + ;============================ + ;============================ + ; Room Loop + ;============================ + ;============================ +room_loop: + + ;================================ + ; copy background to current page + + jsr gr_copy_to_current + + ;================================== + ; draw background action + + lda WHICH_CAVE + +bg_room0: + +; 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 + + ;=============================== + ; check room limits + ;=============================== + + jsr check_screen_limit + + ;=============================== + ; adjust floor + ;=============================== + +; lda PHYSICIST_STATE +; cmp #P_FALLING_DOWN +; beq check_floor0_done + +; lda WHICH_CAVE +; cmp #0 +; bne check_floor1 + +; lda #14 +; sta PHYSICIST_Y + +; lda PHYSICIST_X +; cmp #19 +; bcc check_floor0_done + +; lda #12 +; sta PHYSICIST_Y + +; lda PHYSICIST_X +; cmp #28 +; bcc check_floor0_done + +; lda #10 +; sta PHYSICIST_Y + +check_floor0_done: + +check_floor1: + + + ;===================================== + ; draw physicist + ;===================================== + + jsr draw_physicist + + + ;===================================== + ; handle gun + ;===================================== + + jsr handle_gun + + ;===================================== + ; draw foreground action + ;===================================== + +; lda WHICH_CAVE +; cmp #0 +; bne c5_no_fg_action + +c5_draw_rocks: +; lda #1 +; sta XPOS +; lda #26 +; sta YPOS +; lda #small_rock +; sta INH +; jsr put_sprite + +; lda #10 +; sta XPOS +; lda #18 +; sta YPOS +; lda #medium_rock +; sta INH +; jsr put_sprite + +; lda #31 +; sta XPOS +; lda #14 +; sta YPOS +; lda #large_rock +; sta INH +; jsr put_sprite + +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 room_frame_no_oflo + inc FRAMEH +room_frame_no_oflo: + + ;========================== + ; check if done this level + ;========================== + + lda GAME_OVER + beq still_in_room + + cmp #$ff ; if $ff, we died + beq done_room + + ;=============================== + ; check if exited room to right + cmp #1 + beq room_exit_left + + ;================= + ; exit to right + +room_right_yes_exit: + + lda #0 + sta PHYSICIST_X +cer_smc: + lda #$0 ; smc+1 = exit location + sta WHICH_ROOM + jmp done_room + + ;===================== + ; exit to left + +room_exit_left: + + lda #37 + sta PHYSICIST_X +cel_smc: + lda #0 ; smc+1 + sta WHICH_ROOM + jmp done_room + + ; loop forever +still_in_room: + lda #0 + sta GAME_OVER + + jmp room_loop + +done_room: + rts + +end_message: +.byte 8,10,"PRESS RETURN TO CONTINUE",0 +.byte 11,20,"ACCESS CODE: GRND",0 + +.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 "gr_hlin.s" +.include "keyboard.s" + +.include "physicist.s" +.include "alien.s" +.include "dummy_friend.s" + +.include "gun.s" +.include "laser.s" +.include "alien_laser.s" +.include "blast.s" +.include "shield.s" + +.include "door.s" +.include "collision.s" + +; room backgrounds +.include "ootw_graphics/l14arena/ootw_c14_arena.inc" +; sprites +.include "ootw_graphics/sprites/physicist.inc" +.include "ootw_graphics/sprites/alien.inc" + diff --git a/ootw/ootw_c11.s b/ootw/ootw_c11.s new file mode 100644 index 00000000..7d809a50 --- /dev/null +++ b/ootw/ootw_c11.s @@ -0,0 +1,525 @@ +; Ootw for Apple II Lores + +; Checkpoint-11 (???) + +; by Vince "DEATER" Weaver + +.include "zp.inc" +.include "hardware.inc" + + + ;============================ + ; ENTRY POINT FOR LEVEL + ;============================ + +ootw_c11: + ; Initializing when entering level for first time + + + ;======================================================== + ; RESTART: called when restarting level (after game over) + ;======================================================== + +ootw_c11_restart: + + ;=================================== + ; re-initialize level state + ;=================================== + + jsr ootw_c11_level_init + + ;=========================== + ; c11_new_room + ;=========================== + ; enter new room on level 14 + +c11_new_room: + lda #0 + sta GAME_OVER + + ;==================================== + ; Initialize room based on WHICH_ROOM + ; and then play until we exit + ;==================================== + + jsr ootw_c11_setup_room_and_play + + + ;==================================== + ; we exited the room + ;==================================== +c11_check_done: + + lda GAME_OVER ; if died or quit, jump to quit level + cmp #$ff + beq quit_level + + ;===================================================== + ; Check to see which room to enter next + ; If it's a special value, means we succesfully beat the level +c11_defeated: + lda WHICH_ROOM + cmp #$ff + bne c11_new_room + + ; point to next level + ; and exit to the level loader + lda #12 + sta WHICH_LOAD + rts + + +;=========================== +; quit_level +;=========================== + +quit_level: + jsr TEXT ; text mode + jsr HOME ; clear screen + lda KEYRESET ; clear keyboard state + + lda #0 ; set to PAGE0 + sta DRAW_PAGE + + lda #end_message + sta OUTH + + jsr move_and_print + jsr move_and_print + +wait_loop: + lda KEYPRESS ; wait for keypress + bpl wait_loop + + lda KEYRESET ; clear strobe + + lda #0 + sta GAME_OVER + + jmp ootw_c11_restart ; restart level + + +;========================================= +;========================================= +; Ootw Checkpoint 14 -- Tank Arena +;========================================= +;========================================= + + ; call once before entering for first time +ootw_c11_level_init: + lda #0 + sta WHICH_ROOM + sta NUM_DOORS + + lda #1 + sta HAVE_GUN + sta DIRECTION ; right + + lda #0 + sta PHYSICIST_X + lda #10 + sta PHYSICIST_Y + + lda #P_STANDING + sta PHYSICIST_STATE + + rts + + + ;=========================== + ;=========================== + ; enter new room + ;=========================== + ;=========================== + +ootw_c11_setup_room_and_play: + + ;============================== + ; each room init + + + ;============================== + ; setup per-room variables + + lda WHICH_ROOM + bne room1 + + jsr init_shields + + ;=============================== + ; Room0 -- the arena + ;=============================== +room: + lda #(2+128) + sta LEFT_LIMIT + lda #(39+128) + sta RIGHT_LIMIT + + ; set right exit + lda #$ff ; exit level if exit this way + sta cer_smc+1 + + ; set left exit + lda #0 + sta cel_smc+1 + + lda #28 + sta PHYSICIST_Y + + ; load background + lda #>(arena_rle) + sta GBASH + lda #<(arena_rle) + + jmp room_setup_done + + ; ???? +room1: +; cmp #1 +; bne room2 + +; 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 room_setup_done + +room_setup_done: + + sta GBASL + lda #$c ; load to page $c00 + jsr load_rle_gr ; tail call + + ;===================== + ; setup walk collision + jsr recalc_walk_collision + + + +ootw_room_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 + + ;============================ + ;============================ + ; Room Loop + ;============================ + ;============================ +room_loop: + + ;================================ + ; copy background to current page + + jsr gr_copy_to_current + + ;================================== + ; draw background action + + lda WHICH_CAVE + +bg_room0: + +; 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 + + ;=============================== + ; check room limits + ;=============================== + + jsr check_screen_limit + + ;=============================== + ; adjust floor + ;=============================== + +; lda PHYSICIST_STATE +; cmp #P_FALLING_DOWN +; beq check_floor0_done + +; lda WHICH_CAVE +; cmp #0 +; bne check_floor1 + +; lda #14 +; sta PHYSICIST_Y + +; lda PHYSICIST_X +; cmp #19 +; bcc check_floor0_done + +; lda #12 +; sta PHYSICIST_Y + +; lda PHYSICIST_X +; cmp #28 +; bcc check_floor0_done + +; lda #10 +; sta PHYSICIST_Y + +check_floor0_done: + +check_floor1: + + + ;===================================== + ; draw physicist + ;===================================== + + jsr draw_physicist + + + ;===================================== + ; handle gun + ;===================================== + + jsr handle_gun + + ;===================================== + ; draw foreground action + ;===================================== + +; lda WHICH_CAVE +; cmp #0 +; bne c5_no_fg_action + +c5_draw_rocks: +; lda #1 +; sta XPOS +; lda #26 +; sta YPOS +; lda #small_rock +; sta INH +; jsr put_sprite + +; lda #10 +; sta XPOS +; lda #18 +; sta YPOS +; lda #medium_rock +; sta INH +; jsr put_sprite + +; lda #31 +; sta XPOS +; lda #14 +; sta YPOS +; lda #large_rock +; sta INH +; jsr put_sprite + +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 room_frame_no_oflo + inc FRAMEH +room_frame_no_oflo: + + ;========================== + ; check if done this level + ;========================== + + lda GAME_OVER + beq still_in_room + + cmp #$ff ; if $ff, we died + beq done_room + + ;=============================== + ; check if exited room to right + cmp #1 + beq room_exit_left + + ;================= + ; exit to right + +room_right_yes_exit: + + lda #0 + sta PHYSICIST_X +cer_smc: + lda #$0 ; smc+1 = exit location + sta WHICH_ROOM + jmp done_room + + ;===================== + ; exit to left + +room_exit_left: + + lda #37 + sta PHYSICIST_X +cel_smc: + lda #0 ; smc+1 + sta WHICH_ROOM + jmp done_room + + ; loop forever +still_in_room: + lda #0 + sta GAME_OVER + + jmp room_loop + +done_room: + rts + +end_message: +.byte 8,10,"PRESS RETURN TO CONTINUE",0 +.byte 11,20,"ACCESS CODE: ABVE",0 + +.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 "gr_hlin.s" +.include "keyboard.s" + +.include "physicist.s" +.include "alien.s" +.include "dummy_friend.s" + +.include "gun.s" +.include "laser.s" +.include "alien_laser.s" +.include "blast.s" +.include "shield.s" + +.include "door.s" +.include "collision.s" + +; room backgrounds +.include "ootw_graphics/l14arena/ootw_c14_arena.inc" +; sprites +.include "ootw_graphics/sprites/physicist.inc" +.include "ootw_graphics/sprites/alien.inc" + diff --git a/ootw/ootw_c12.s b/ootw/ootw_c12.s new file mode 100644 index 00000000..3a0e2815 --- /dev/null +++ b/ootw/ootw_c12.s @@ -0,0 +1,525 @@ +; Ootw for Apple II Lores + +; Checkpoint-12 (???) + +; by Vince "DEATER" Weaver + +.include "zp.inc" +.include "hardware.inc" + + + ;============================ + ; ENTRY POINT FOR LEVEL + ;============================ + +ootw_c12: + ; Initializing when entering level for first time + + + ;======================================================== + ; RESTART: called when restarting level (after game over) + ;======================================================== + +ootw_c12_restart: + + ;=================================== + ; re-initialize level state + ;=================================== + + jsr ootw_c12_level_init + + ;=========================== + ; c12_new_room + ;=========================== + ; enter new room on level 14 + +c12_new_room: + lda #0 + sta GAME_OVER + + ;==================================== + ; Initialize room based on WHICH_ROOM + ; and then play until we exit + ;==================================== + + jsr ootw_c12_setup_room_and_play + + + ;==================================== + ; we exited the room + ;==================================== +c12_check_done: + + lda GAME_OVER ; if died or quit, jump to quit level + cmp #$ff + beq quit_level + + ;===================================================== + ; Check to see which room to enter next + ; If it's a special value, means we succesfully beat the level +c12_defeated: + lda WHICH_ROOM + cmp #$ff + bne c12_new_room + + ; point to next level + ; and exit to the level loader + lda #13 + sta WHICH_LOAD + rts + + +;=========================== +; quit_level +;=========================== + +quit_level: + jsr TEXT ; text mode + jsr HOME ; clear screen + lda KEYRESET ; clear keyboard state + + lda #0 ; set to PAGE0 + sta DRAW_PAGE + + lda #end_message + sta OUTH + + jsr move_and_print + jsr move_and_print + +wait_loop: + lda KEYPRESS ; wait for keypress + bpl wait_loop + + lda KEYRESET ; clear strobe + + lda #0 + sta GAME_OVER + + jmp ootw_c12_restart ; restart level + + +;========================================= +;========================================= +; Ootw Checkpoint 14 -- Tank Arena +;========================================= +;========================================= + + ; call once before entering for first time +ootw_c12_level_init: + lda #0 + sta WHICH_ROOM + sta NUM_DOORS + + lda #1 + sta HAVE_GUN + sta DIRECTION ; right + + lda #0 + sta PHYSICIST_X + lda #10 + sta PHYSICIST_Y + + lda #P_STANDING + sta PHYSICIST_STATE + + rts + + + ;=========================== + ;=========================== + ; enter new room + ;=========================== + ;=========================== + +ootw_c12_setup_room_and_play: + + ;============================== + ; each room init + + + ;============================== + ; setup per-room variables + + lda WHICH_ROOM + bne room1 + + jsr init_shields + + ;=============================== + ; Room0 -- the arena + ;=============================== +room: + lda #(2+128) + sta LEFT_LIMIT + lda #(39+128) + sta RIGHT_LIMIT + + ; set right exit + lda #$ff ; exit level if exit this way + sta cer_smc+1 + + ; set left exit + lda #0 + sta cel_smc+1 + + lda #28 + sta PHYSICIST_Y + + ; load background + lda #>(arena_rle) + sta GBASH + lda #<(arena_rle) + + jmp room_setup_done + + ; ???? +room1: +; cmp #1 +; bne room2 + +; 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 room_setup_done + +room_setup_done: + + sta GBASL + lda #$c ; load to page $c00 + jsr load_rle_gr ; tail call + + ;===================== + ; setup walk collision + jsr recalc_walk_collision + + + +ootw_room_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 + + ;============================ + ;============================ + ; Room Loop + ;============================ + ;============================ +room_loop: + + ;================================ + ; copy background to current page + + jsr gr_copy_to_current + + ;================================== + ; draw background action + + lda WHICH_CAVE + +bg_room0: + +; 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 + + ;=============================== + ; check room limits + ;=============================== + + jsr check_screen_limit + + ;=============================== + ; adjust floor + ;=============================== + +; lda PHYSICIST_STATE +; cmp #P_FALLING_DOWN +; beq check_floor0_done + +; lda WHICH_CAVE +; cmp #0 +; bne check_floor1 + +; lda #14 +; sta PHYSICIST_Y + +; lda PHYSICIST_X +; cmp #19 +; bcc check_floor0_done + +; lda #12 +; sta PHYSICIST_Y + +; lda PHYSICIST_X +; cmp #28 +; bcc check_floor0_done + +; lda #10 +; sta PHYSICIST_Y + +check_floor0_done: + +check_floor1: + + + ;===================================== + ; draw physicist + ;===================================== + + jsr draw_physicist + + + ;===================================== + ; handle gun + ;===================================== + + jsr handle_gun + + ;===================================== + ; draw foreground action + ;===================================== + +; lda WHICH_CAVE +; cmp #0 +; bne c5_no_fg_action + +c5_draw_rocks: +; lda #1 +; sta XPOS +; lda #26 +; sta YPOS +; lda #small_rock +; sta INH +; jsr put_sprite + +; lda #10 +; sta XPOS +; lda #18 +; sta YPOS +; lda #medium_rock +; sta INH +; jsr put_sprite + +; lda #31 +; sta XPOS +; lda #14 +; sta YPOS +; lda #large_rock +; sta INH +; jsr put_sprite + +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 room_frame_no_oflo + inc FRAMEH +room_frame_no_oflo: + + ;========================== + ; check if done this level + ;========================== + + lda GAME_OVER + beq still_in_room + + cmp #$ff ; if $ff, we died + beq done_room + + ;=============================== + ; check if exited room to right + cmp #1 + beq room_exit_left + + ;================= + ; exit to right + +room_right_yes_exit: + + lda #0 + sta PHYSICIST_X +cer_smc: + lda #$0 ; smc+1 = exit location + sta WHICH_ROOM + jmp done_room + + ;===================== + ; exit to left + +room_exit_left: + + lda #37 + sta PHYSICIST_X +cel_smc: + lda #0 ; smc+1 + sta WHICH_ROOM + jmp done_room + + ; loop forever +still_in_room: + lda #0 + sta GAME_OVER + + jmp room_loop + +done_room: + rts + +end_message: +.byte 8,10,"PRESS RETURN TO CONTINUE",0 +.byte 11,20,"ACCESS CODE: THRW",0 + +.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 "gr_hlin.s" +.include "keyboard.s" + +.include "physicist.s" +.include "alien.s" +.include "dummy_friend.s" + +.include "gun.s" +.include "laser.s" +.include "alien_laser.s" +.include "blast.s" +.include "shield.s" + +.include "door.s" +.include "collision.s" + +; room backgrounds +.include "ootw_graphics/l14arena/ootw_c14_arena.inc" +; sprites +.include "ootw_graphics/sprites/physicist.inc" +.include "ootw_graphics/sprites/alien.inc" + diff --git a/ootw/ootw_c13.s b/ootw/ootw_c13.s new file mode 100644 index 00000000..3cf407ca --- /dev/null +++ b/ootw/ootw_c13.s @@ -0,0 +1,525 @@ +; Ootw for Apple II Lores + +; Checkpoint-13 (???) + +; by Vince "DEATER" Weaver + +.include "zp.inc" +.include "hardware.inc" + + + ;============================ + ; ENTRY POINT FOR LEVEL + ;============================ + +ootw_c13: + ; Initializing when entering level for first time + + + ;======================================================== + ; RESTART: called when restarting level (after game over) + ;======================================================== + +ootw_c13_restart: + + ;=================================== + ; re-initialize level state + ;=================================== + + jsr ootw_c13_level_init + + ;=========================== + ; c13_new_room + ;=========================== + ; enter new room on level 14 + +c13_new_room: + lda #0 + sta GAME_OVER + + ;==================================== + ; Initialize room based on WHICH_ROOM + ; and then play until we exit + ;==================================== + + jsr ootw_c13_setup_room_and_play + + + ;==================================== + ; we exited the room + ;==================================== +c13_check_done: + + lda GAME_OVER ; if died or quit, jump to quit level + cmp #$ff + beq quit_level + + ;===================================================== + ; Check to see which room to enter next + ; If it's a special value, means we succesfully beat the level +c13_defeated: + lda WHICH_ROOM + cmp #$ff + bne c13_new_room + + ; point to next level + ; and exit to the level loader + lda #14 + sta WHICH_LOAD + rts + + +;=========================== +; quit_level +;=========================== + +quit_level: + jsr TEXT ; text mode + jsr HOME ; clear screen + lda KEYRESET ; clear keyboard state + + lda #0 ; set to PAGE0 + sta DRAW_PAGE + + lda #end_message + sta OUTH + + jsr move_and_print + jsr move_and_print + +wait_loop: + lda KEYPRESS ; wait for keypress + bpl wait_loop + + lda KEYRESET ; clear strobe + + lda #0 + sta GAME_OVER + + jmp ootw_c13_restart ; restart level + + +;========================================= +;========================================= +; Ootw Checkpoint 14 -- Tank Arena +;========================================= +;========================================= + + ; call once before entering for first time +ootw_c13_level_init: + lda #0 + sta WHICH_ROOM + sta NUM_DOORS + + lda #1 + sta HAVE_GUN + sta DIRECTION ; right + + lda #0 + sta PHYSICIST_X + lda #10 + sta PHYSICIST_Y + + lda #P_STANDING + sta PHYSICIST_STATE + + rts + + + ;=========================== + ;=========================== + ; enter new room + ;=========================== + ;=========================== + +ootw_c13_setup_room_and_play: + + ;============================== + ; each room init + + + ;============================== + ; setup per-room variables + + lda WHICH_ROOM + bne room1 + + jsr init_shields + + ;=============================== + ; Room0 -- the arena + ;=============================== +room: + lda #(2+128) + sta LEFT_LIMIT + lda #(39+128) + sta RIGHT_LIMIT + + ; set right exit + lda #$ff ; exit level if exit this way + sta cer_smc+1 + + ; set left exit + lda #0 + sta cel_smc+1 + + lda #28 + sta PHYSICIST_Y + + ; load background + lda #>(arena_rle) + sta GBASH + lda #<(arena_rle) + + jmp room_setup_done + + ; ???? +room1: +; cmp #1 +; bne room2 + +; 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 room_setup_done + +room_setup_done: + + sta GBASL + lda #$c ; load to page $c00 + jsr load_rle_gr ; tail call + + ;===================== + ; setup walk collision + jsr recalc_walk_collision + + + +ootw_room_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 + + ;============================ + ;============================ + ; Room Loop + ;============================ + ;============================ +room_loop: + + ;================================ + ; copy background to current page + + jsr gr_copy_to_current + + ;================================== + ; draw background action + + lda WHICH_CAVE + +bg_room0: + +; 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 + + ;=============================== + ; check room limits + ;=============================== + + jsr check_screen_limit + + ;=============================== + ; adjust floor + ;=============================== + +; lda PHYSICIST_STATE +; cmp #P_FALLING_DOWN +; beq check_floor0_done + +; lda WHICH_CAVE +; cmp #0 +; bne check_floor1 + +; lda #14 +; sta PHYSICIST_Y + +; lda PHYSICIST_X +; cmp #19 +; bcc check_floor0_done + +; lda #12 +; sta PHYSICIST_Y + +; lda PHYSICIST_X +; cmp #28 +; bcc check_floor0_done + +; lda #10 +; sta PHYSICIST_Y + +check_floor0_done: + +check_floor1: + + + ;===================================== + ; draw physicist + ;===================================== + + jsr draw_physicist + + + ;===================================== + ; handle gun + ;===================================== + + jsr handle_gun + + ;===================================== + ; draw foreground action + ;===================================== + +; lda WHICH_CAVE +; cmp #0 +; bne c5_no_fg_action + +c5_draw_rocks: +; lda #1 +; sta XPOS +; lda #26 +; sta YPOS +; lda #small_rock +; sta INH +; jsr put_sprite + +; lda #10 +; sta XPOS +; lda #18 +; sta YPOS +; lda #medium_rock +; sta INH +; jsr put_sprite + +; lda #31 +; sta XPOS +; lda #14 +; sta YPOS +; lda #large_rock +; sta INH +; jsr put_sprite + +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 room_frame_no_oflo + inc FRAMEH +room_frame_no_oflo: + + ;========================== + ; check if done this level + ;========================== + + lda GAME_OVER + beq still_in_room + + cmp #$ff ; if $ff, we died + beq done_room + + ;=============================== + ; check if exited room to right + cmp #1 + beq room_exit_left + + ;================= + ; exit to right + +room_right_yes_exit: + + lda #0 + sta PHYSICIST_X +cer_smc: + lda #$0 ; smc+1 = exit location + sta WHICH_ROOM + jmp done_room + + ;===================== + ; exit to left + +room_exit_left: + + lda #37 + sta PHYSICIST_X +cel_smc: + lda #0 ; smc+1 + sta WHICH_ROOM + jmp done_room + + ; loop forever +still_in_room: + lda #0 + sta GAME_OVER + + jmp room_loop + +done_room: + rts + +end_message: +.byte 8,10,"PRESS RETURN TO CONTINUE",0 +.byte 11,20,"ACCESS CODE: ARMS",0 + +.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 "gr_hlin.s" +.include "keyboard.s" + +.include "physicist.s" +.include "alien.s" +.include "dummy_friend.s" + +.include "gun.s" +.include "laser.s" +.include "alien_laser.s" +.include "blast.s" +.include "shield.s" + +.include "door.s" +.include "collision.s" + +; room backgrounds +.include "ootw_graphics/l14arena/ootw_c14_arena.inc" +; sprites +.include "ootw_graphics/sprites/physicist.inc" +.include "ootw_graphics/sprites/alien.inc" + diff --git a/ootw/ootw_c5.s b/ootw/ootw_c5.s index ce6c14a6..04994256 100644 --- a/ootw/ootw_c5.s +++ b/ootw/ootw_c5.s @@ -31,13 +31,17 @@ c5_check_done: cmp #$ff beq quit_level - ; only exit if done level - ; FIXME: or quit pressed? - lda WHICH_JAIL - cmp #11 + cmp #$ff bne c5_new_cave + ; point to next level + ; and exit to the level loader + lda #6 + sta WHICH_LOAD + rts + + ;=========================== ; quit_level diff --git a/ootw/ootw_c5_cave.s b/ootw/ootw_c5_cave.s index fe2b13f7..c5371f77 100644 --- a/ootw/ootw_c5_cave.s +++ b/ootw/ootw_c5_cave.s @@ -49,11 +49,11 @@ ootw_cave: cave0: lda #(0+128) sta LEFT_LIMIT - lda #(38+128) + lda #(39+128) sta RIGHT_LIMIT ; set right exit - lda #1 + lda #$ff sta cer_smc+1 ; set left exit diff --git a/ootw/ootw_c6.s b/ootw/ootw_c6.s new file mode 100644 index 00000000..b1d537ad --- /dev/null +++ b/ootw/ootw_c6.s @@ -0,0 +1,525 @@ +; Ootw for Apple II Lores + +; Checkpoint-6 (???) + +; by Vince "DEATER" Weaver + +.include "zp.inc" +.include "hardware.inc" + + + ;============================ + ; ENTRY POINT FOR LEVEL + ;============================ + +ootw_c6: + ; Initializing when entering level for first time + + + ;======================================================== + ; RESTART: called when restarting level (after game over) + ;======================================================== + +ootw_c6_restart: + + ;=================================== + ; re-initialize level state + ;=================================== + + jsr ootw_c6_level_init + + ;=========================== + ; c6_new_room + ;=========================== + ; enter new room on level 14 + +c6_new_room: + lda #0 + sta GAME_OVER + + ;==================================== + ; Initialize room based on WHICH_ROOM + ; and then play until we exit + ;==================================== + + jsr ootw_c6_setup_room_and_play + + + ;==================================== + ; we exited the room + ;==================================== +c6_check_done: + + lda GAME_OVER ; if died or quit, jump to quit level + cmp #$ff + beq quit_level + + ;===================================================== + ; Check to see which room to enter next + ; If it's a special value, means we succesfully beat the level +c6_defeated: + lda WHICH_ROOM + cmp #$ff + bne c6_new_room + + ; point to next level + ; and exit to the level loader + lda #7 + sta WHICH_LOAD + rts + + +;=========================== +; quit_level +;=========================== + +quit_level: + jsr TEXT ; text mode + jsr HOME ; clear screen + lda KEYRESET ; clear keyboard state + + lda #0 ; set to PAGE0 + sta DRAW_PAGE + + lda #end_message + sta OUTH + + jsr move_and_print + jsr move_and_print + +wait_loop: + lda KEYPRESS ; wait for keypress + bpl wait_loop + + lda KEYRESET ; clear strobe + + lda #0 + sta GAME_OVER + + jmp ootw_c6_restart ; restart level + + +;========================================= +;========================================= +; Ootw Checkpoint 14 -- Tank Arena +;========================================= +;========================================= + + ; call once before entering for first time +ootw_c6_level_init: + lda #0 + sta WHICH_ROOM + sta NUM_DOORS + + lda #1 + sta HAVE_GUN + sta DIRECTION ; right + + lda #0 + sta PHYSICIST_X + lda #10 + sta PHYSICIST_Y + + lda #P_STANDING + sta PHYSICIST_STATE + + rts + + + ;=========================== + ;=========================== + ; enter new room + ;=========================== + ;=========================== + +ootw_c6_setup_room_and_play: + + ;============================== + ; each room init + + + ;============================== + ; setup per-room variables + + lda WHICH_ROOM + bne room1 + + jsr init_shields + + ;=============================== + ; Room0 -- the arena + ;=============================== +room: + lda #(2+128) + sta LEFT_LIMIT + lda #(39+128) + sta RIGHT_LIMIT + + ; set right exit + lda #$ff ; exit level if exit this way + sta cer_smc+1 + + ; set left exit + lda #0 + sta cel_smc+1 + + lda #28 + sta PHYSICIST_Y + + ; load background + lda #>(arena_rle) + sta GBASH + lda #<(arena_rle) + + jmp room_setup_done + + ; ???? +room1: +; cmp #1 +; bne room2 + +; 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 room_setup_done + +room_setup_done: + + sta GBASL + lda #$c ; load to page $c00 + jsr load_rle_gr ; tail call + + ;===================== + ; setup walk collision + jsr recalc_walk_collision + + + +ootw_room_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 + + ;============================ + ;============================ + ; Room Loop + ;============================ + ;============================ +room_loop: + + ;================================ + ; copy background to current page + + jsr gr_copy_to_current + + ;================================== + ; draw background action + + lda WHICH_CAVE + +bg_room0: + +; 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 + + ;=============================== + ; check room limits + ;=============================== + + jsr check_screen_limit + + ;=============================== + ; adjust floor + ;=============================== + +; lda PHYSICIST_STATE +; cmp #P_FALLING_DOWN +; beq check_floor0_done + +; lda WHICH_CAVE +; cmp #0 +; bne check_floor1 + +; lda #14 +; sta PHYSICIST_Y + +; lda PHYSICIST_X +; cmp #19 +; bcc check_floor0_done + +; lda #12 +; sta PHYSICIST_Y + +; lda PHYSICIST_X +; cmp #28 +; bcc check_floor0_done + +; lda #10 +; sta PHYSICIST_Y + +check_floor0_done: + +check_floor1: + + + ;===================================== + ; draw physicist + ;===================================== + + jsr draw_physicist + + + ;===================================== + ; handle gun + ;===================================== + + jsr handle_gun + + ;===================================== + ; draw foreground action + ;===================================== + +; lda WHICH_CAVE +; cmp #0 +; bne c5_no_fg_action + +c5_draw_rocks: +; lda #1 +; sta XPOS +; lda #26 +; sta YPOS +; lda #small_rock +; sta INH +; jsr put_sprite + +; lda #10 +; sta XPOS +; lda #18 +; sta YPOS +; lda #medium_rock +; sta INH +; jsr put_sprite + +; lda #31 +; sta XPOS +; lda #14 +; sta YPOS +; lda #large_rock +; sta INH +; jsr put_sprite + +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 room_frame_no_oflo + inc FRAMEH +room_frame_no_oflo: + + ;========================== + ; check if done this level + ;========================== + + lda GAME_OVER + beq still_in_room + + cmp #$ff ; if $ff, we died + beq done_room + + ;=============================== + ; check if exited room to right + cmp #1 + beq room_exit_left + + ;================= + ; exit to right + +room_right_yes_exit: + + lda #0 + sta PHYSICIST_X +cer_smc: + lda #$0 ; smc+1 = exit location + sta WHICH_ROOM + jmp done_room + + ;===================== + ; exit to left + +room_exit_left: + + lda #37 + sta PHYSICIST_X +cel_smc: + lda #0 ; smc+1 + sta WHICH_ROOM + jmp done_room + + ; loop forever +still_in_room: + lda #0 + sta GAME_OVER + + jmp room_loop + +done_room: + rts + +end_message: +.byte 8,10,"PRESS RETURN TO CONTINUE",0 +.byte 11,20,"ACCESS CODE: CEIL",0 + +.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 "gr_hlin.s" +.include "keyboard.s" + +.include "physicist.s" +.include "alien.s" +.include "dummy_friend.s" + +.include "gun.s" +.include "laser.s" +.include "alien_laser.s" +.include "blast.s" +.include "shield.s" + +.include "door.s" +.include "collision.s" + +; room backgrounds +.include "ootw_graphics/l14arena/ootw_c14_arena.inc" +; sprites +.include "ootw_graphics/sprites/physicist.inc" +.include "ootw_graphics/sprites/alien.inc" + diff --git a/ootw/ootw_c7.s b/ootw/ootw_c7.s new file mode 100644 index 00000000..729a1556 --- /dev/null +++ b/ootw/ootw_c7.s @@ -0,0 +1,525 @@ +; Ootw for Apple II Lores + +; Checkpoint-7 (???) + +; by Vince "DEATER" Weaver + +.include "zp.inc" +.include "hardware.inc" + + + ;============================ + ; ENTRY POINT FOR LEVEL + ;============================ + +ootw_c7: + ; Initializing when entering level for first time + + + ;======================================================== + ; RESTART: called when restarting level (after game over) + ;======================================================== + +ootw_c7_restart: + + ;=================================== + ; re-initialize level state + ;=================================== + + jsr ootw_c7_level_init + + ;=========================== + ; c7_new_room + ;=========================== + ; enter new room on level 7 + +c7_new_room: + lda #0 + sta GAME_OVER + + ;==================================== + ; Initialize room based on WHICH_ROOM + ; and then play until we exit + ;==================================== + + jsr ootw_c7_setup_room_and_play + + + ;==================================== + ; we exited the room + ;==================================== +c7_check_done: + + lda GAME_OVER ; if died or quit, jump to quit level + cmp #$ff + beq quit_level + + ;===================================================== + ; Check to see which room to enter next + ; If it's a special value, means we succesfully beat the level +c7_defeated: + lda WHICH_ROOM + cmp #$ff + bne c7_new_room + + ; point to next level + ; and exit to the level loader + lda #8 + sta WHICH_LOAD + rts + + +;=========================== +; quit_level +;=========================== + +quit_level: + jsr TEXT ; text mode + jsr HOME ; clear screen + lda KEYRESET ; clear keyboard state + + lda #0 ; set to PAGE0 + sta DRAW_PAGE + + lda #end_message + sta OUTH + + jsr move_and_print + jsr move_and_print + +wait_loop: + lda KEYPRESS ; wait for keypress + bpl wait_loop + + lda KEYRESET ; clear strobe + + lda #0 + sta GAME_OVER + + jmp ootw_c7_restart ; restart level + + +;========================================= +;========================================= +; Ootw Checkpoint 14 -- Tank Arena +;========================================= +;========================================= + + ; call once before entering for first time +ootw_c7_level_init: + lda #0 + sta WHICH_ROOM + sta NUM_DOORS + + lda #1 + sta HAVE_GUN + sta DIRECTION ; right + + lda #0 + sta PHYSICIST_X + lda #10 + sta PHYSICIST_Y + + lda #P_STANDING + sta PHYSICIST_STATE + + rts + + + ;=========================== + ;=========================== + ; enter new room + ;=========================== + ;=========================== + +ootw_c7_setup_room_and_play: + + ;============================== + ; each room init + + + ;============================== + ; setup per-room variables + + lda WHICH_ROOM + bne room1 + + jsr init_shields + + ;=============================== + ; Room0 -- the arena + ;=============================== +room: + lda #(2+128) + sta LEFT_LIMIT + lda #(39+128) + sta RIGHT_LIMIT + + ; set right exit + lda #$ff ; exit level if exit this way + sta cer_smc+1 + + ; set left exit + lda #0 + sta cel_smc+1 + + lda #28 + sta PHYSICIST_Y + + ; load background + lda #>(arena_rle) + sta GBASH + lda #<(arena_rle) + + jmp room_setup_done + + ; ???? +room1: +; cmp #1 +; bne room2 + +; 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 room_setup_done + +room_setup_done: + + sta GBASL + lda #$c ; load to page $c00 + jsr load_rle_gr ; tail call + + ;===================== + ; setup walk collision + jsr recalc_walk_collision + + + +ootw_room_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 + + ;============================ + ;============================ + ; Room Loop + ;============================ + ;============================ +room_loop: + + ;================================ + ; copy background to current page + + jsr gr_copy_to_current + + ;================================== + ; draw background action + + lda WHICH_CAVE + +bg_room0: + +; 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 + + ;=============================== + ; check room limits + ;=============================== + + jsr check_screen_limit + + ;=============================== + ; adjust floor + ;=============================== + +; lda PHYSICIST_STATE +; cmp #P_FALLING_DOWN +; beq check_floor0_done + +; lda WHICH_CAVE +; cmp #0 +; bne check_floor1 + +; lda #14 +; sta PHYSICIST_Y + +; lda PHYSICIST_X +; cmp #19 +; bcc check_floor0_done + +; lda #12 +; sta PHYSICIST_Y + +; lda PHYSICIST_X +; cmp #28 +; bcc check_floor0_done + +; lda #10 +; sta PHYSICIST_Y + +check_floor0_done: + +check_floor1: + + + ;===================================== + ; draw physicist + ;===================================== + + jsr draw_physicist + + + ;===================================== + ; handle gun + ;===================================== + + jsr handle_gun + + ;===================================== + ; draw foreground action + ;===================================== + +; lda WHICH_CAVE +; cmp #0 +; bne c5_no_fg_action + +c5_draw_rocks: +; lda #1 +; sta XPOS +; lda #26 +; sta YPOS +; lda #small_rock +; sta INH +; jsr put_sprite + +; lda #10 +; sta XPOS +; lda #18 +; sta YPOS +; lda #medium_rock +; sta INH +; jsr put_sprite + +; lda #31 +; sta XPOS +; lda #14 +; sta YPOS +; lda #large_rock +; sta INH +; jsr put_sprite + +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 room_frame_no_oflo + inc FRAMEH +room_frame_no_oflo: + + ;========================== + ; check if done this level + ;========================== + + lda GAME_OVER + beq still_in_room + + cmp #$ff ; if $ff, we died + beq done_room + + ;=============================== + ; check if exited room to right + cmp #1 + beq room_exit_left + + ;================= + ; exit to right + +room_right_yes_exit: + + lda #0 + sta PHYSICIST_X +cer_smc: + lda #$0 ; smc+1 = exit location + sta WHICH_ROOM + jmp done_room + + ;===================== + ; exit to left + +room_exit_left: + + lda #37 + sta PHYSICIST_X +cel_smc: + lda #0 ; smc+1 + sta WHICH_ROOM + jmp done_room + + ; loop forever +still_in_room: + lda #0 + sta GAME_OVER + + jmp room_loop + +done_room: + rts + +end_message: +.byte 8,10,"PRESS RETURN TO CONTINUE",0 +.byte 11,20,"ACCESS CODE: RUNC",0 + +.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 "gr_hlin.s" +.include "keyboard.s" + +.include "physicist.s" +.include "alien.s" +.include "dummy_friend.s" + +.include "gun.s" +.include "laser.s" +.include "alien_laser.s" +.include "blast.s" +.include "shield.s" + +.include "door.s" +.include "collision.s" + +; room backgrounds +.include "ootw_graphics/l14arena/ootw_c14_arena.inc" +; sprites +.include "ootw_graphics/sprites/physicist.inc" +.include "ootw_graphics/sprites/alien.inc" + diff --git a/ootw/ootw_c8.s b/ootw/ootw_c8.s new file mode 100644 index 00000000..3983e70f --- /dev/null +++ b/ootw/ootw_c8.s @@ -0,0 +1,525 @@ +; Ootw for Apple II Lores + +; Checkpoint-8 (????) + +; by Vince "DEATER" Weaver + +.include "zp.inc" +.include "hardware.inc" + + + ;============================ + ; ENTRY POINT FOR LEVEL + ;============================ + +ootw_c8: + ; Initializing when entering level for first time + + + ;======================================================== + ; RESTART: called when restarting level (after game over) + ;======================================================== + +ootw_c8_restart: + + ;=================================== + ; re-initialize level state + ;=================================== + + jsr ootw_c8_level_init + + ;=========================== + ; c8_new_room + ;=========================== + ; enter new room on level 14 + +c8_new_room: + lda #0 + sta GAME_OVER + + ;==================================== + ; Initialize room based on WHICH_ROOM + ; and then play until we exit + ;==================================== + + jsr ootw_c8_setup_room_and_play + + + ;==================================== + ; we exited the room + ;==================================== +c8_check_done: + + lda GAME_OVER ; if died or quit, jump to quit level + cmp #$ff + beq quit_level + + ;===================================================== + ; Check to see which room to enter next + ; If it's a special value, means we succesfully beat the level +c8_defeated: + lda WHICH_ROOM + cmp #$ff + bne c8_new_room + + ; point to next level + ; and exit to the level loader + lda #9 + sta WHICH_LOAD + rts + + +;=========================== +; quit_level +;=========================== + +quit_level: + jsr TEXT ; text mode + jsr HOME ; clear screen + lda KEYRESET ; clear keyboard state + + lda #0 ; set to PAGE0 + sta DRAW_PAGE + + lda #end_message + sta OUTH + + jsr move_and_print + jsr move_and_print + +wait_loop: + lda KEYPRESS ; wait for keypress + bpl wait_loop + + lda KEYRESET ; clear strobe + + lda #0 + sta GAME_OVER + + jmp ootw_c8_restart ; restart level + + +;========================================= +;========================================= +; Ootw Checkpoint 14 -- Tank Arena +;========================================= +;========================================= + + ; call once before entering for first time +ootw_c8_level_init: + lda #0 + sta WHICH_ROOM + sta NUM_DOORS + + lda #1 + sta HAVE_GUN + sta DIRECTION ; right + + lda #0 + sta PHYSICIST_X + lda #10 + sta PHYSICIST_Y + + lda #P_STANDING + sta PHYSICIST_STATE + + rts + + + ;=========================== + ;=========================== + ; enter new room + ;=========================== + ;=========================== + +ootw_c8_setup_room_and_play: + + ;============================== + ; each room init + + + ;============================== + ; setup per-room variables + + lda WHICH_ROOM + bne room1 + + jsr init_shields + + ;=============================== + ; Room0 -- the arena + ;=============================== +room: + lda #(2+128) + sta LEFT_LIMIT + lda #(39+128) + sta RIGHT_LIMIT + + ; set right exit + lda #$ff ; exit level if exit this way + sta cer_smc+1 + + ; set left exit + lda #0 + sta cel_smc+1 + + lda #28 + sta PHYSICIST_Y + + ; load background + lda #>(arena_rle) + sta GBASH + lda #<(arena_rle) + + jmp room_setup_done + + ; ???? +room1: +; cmp #1 +; bne room2 + +; 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 room_setup_done + +room_setup_done: + + sta GBASL + lda #$c ; load to page $c00 + jsr load_rle_gr ; tail call + + ;===================== + ; setup walk collision + jsr recalc_walk_collision + + + +ootw_room_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 + + ;============================ + ;============================ + ; Room Loop + ;============================ + ;============================ +room_loop: + + ;================================ + ; copy background to current page + + jsr gr_copy_to_current + + ;================================== + ; draw background action + + lda WHICH_CAVE + +bg_room0: + +; 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 + + ;=============================== + ; check room limits + ;=============================== + + jsr check_screen_limit + + ;=============================== + ; adjust floor + ;=============================== + +; lda PHYSICIST_STATE +; cmp #P_FALLING_DOWN +; beq check_floor0_done + +; lda WHICH_CAVE +; cmp #0 +; bne check_floor1 + +; lda #14 +; sta PHYSICIST_Y + +; lda PHYSICIST_X +; cmp #19 +; bcc check_floor0_done + +; lda #12 +; sta PHYSICIST_Y + +; lda PHYSICIST_X +; cmp #28 +; bcc check_floor0_done + +; lda #10 +; sta PHYSICIST_Y + +check_floor0_done: + +check_floor1: + + + ;===================================== + ; draw physicist + ;===================================== + + jsr draw_physicist + + + ;===================================== + ; handle gun + ;===================================== + + jsr handle_gun + + ;===================================== + ; draw foreground action + ;===================================== + +; lda WHICH_CAVE +; cmp #0 +; bne c5_no_fg_action + +c5_draw_rocks: +; lda #1 +; sta XPOS +; lda #26 +; sta YPOS +; lda #small_rock +; sta INH +; jsr put_sprite + +; lda #10 +; sta XPOS +; lda #18 +; sta YPOS +; lda #medium_rock +; sta INH +; jsr put_sprite + +; lda #31 +; sta XPOS +; lda #14 +; sta YPOS +; lda #large_rock +; sta INH +; jsr put_sprite + +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 room_frame_no_oflo + inc FRAMEH +room_frame_no_oflo: + + ;========================== + ; check if done this level + ;========================== + + lda GAME_OVER + beq still_in_room + + cmp #$ff ; if $ff, we died + beq done_room + + ;=============================== + ; check if exited room to right + cmp #1 + beq room_exit_left + + ;================= + ; exit to right + +room_right_yes_exit: + + lda #0 + sta PHYSICIST_X +cer_smc: + lda #$0 ; smc+1 = exit location + sta WHICH_ROOM + jmp done_room + + ;===================== + ; exit to left + +room_exit_left: + + lda #37 + sta PHYSICIST_X +cel_smc: + lda #0 ; smc+1 + sta WHICH_ROOM + jmp done_room + + ; loop forever +still_in_room: + lda #0 + sta GAME_OVER + + jmp room_loop + +done_room: + rts + +end_message: +.byte 8,10,"PRESS RETURN TO CONTINUE",0 +.byte 11,20,"ACCESS CODE: ROLL",0 + +.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 "gr_hlin.s" +.include "keyboard.s" + +.include "physicist.s" +.include "alien.s" +.include "dummy_friend.s" + +.include "gun.s" +.include "laser.s" +.include "alien_laser.s" +.include "blast.s" +.include "shield.s" + +.include "door.s" +.include "collision.s" + +; room backgrounds +.include "ootw_graphics/l14arena/ootw_c14_arena.inc" +; sprites +.include "ootw_graphics/sprites/physicist.inc" +.include "ootw_graphics/sprites/alien.inc" + diff --git a/ootw/ootw_c9.s b/ootw/ootw_c9.s new file mode 100644 index 00000000..40d292ec --- /dev/null +++ b/ootw/ootw_c9.s @@ -0,0 +1,525 @@ +; Ootw for Apple II Lores + +; Checkpoint-9 (???) + +; by Vince "DEATER" Weaver + +.include "zp.inc" +.include "hardware.inc" + + + ;============================ + ; ENTRY POINT FOR LEVEL + ;============================ + +ootw_c9: + ; Initializing when entering level for first time + + + ;======================================================== + ; RESTART: called when restarting level (after game over) + ;======================================================== + +ootw_c9_restart: + + ;=================================== + ; re-initialize level state + ;=================================== + + jsr ootw_c9_level_init + + ;=========================== + ; c9_new_room + ;=========================== + ; enter new room on level 14 + +c9_new_room: + lda #0 + sta GAME_OVER + + ;==================================== + ; Initialize room based on WHICH_ROOM + ; and then play until we exit + ;==================================== + + jsr ootw_c9_setup_room_and_play + + + ;==================================== + ; we exited the room + ;==================================== +c9_check_done: + + lda GAME_OVER ; if died or quit, jump to quit level + cmp #$ff + beq quit_level + + ;===================================================== + ; Check to see which room to enter next + ; If it's a special value, means we succesfully beat the level +c9_defeated: + lda WHICH_ROOM + cmp #$ff + bne c9_new_room + + ; point to next level + ; and exit to the level loader + lda #10 + sta WHICH_LOAD + rts + + +;=========================== +; quit_level +;=========================== + +quit_level: + jsr TEXT ; text mode + jsr HOME ; clear screen + lda KEYRESET ; clear keyboard state + + lda #0 ; set to PAGE0 + sta DRAW_PAGE + + lda #end_message + sta OUTH + + jsr move_and_print + jsr move_and_print + +wait_loop: + lda KEYPRESS ; wait for keypress + bpl wait_loop + + lda KEYRESET ; clear strobe + + lda #0 + sta GAME_OVER + + jmp ootw_c9_restart ; restart level + + +;========================================= +;========================================= +; Ootw Checkpoint 14 -- Tank Arena +;========================================= +;========================================= + + ; call once before entering for first time +ootw_c9_level_init: + lda #0 + sta WHICH_ROOM + sta NUM_DOORS + + lda #1 + sta HAVE_GUN + sta DIRECTION ; right + + lda #0 + sta PHYSICIST_X + lda #10 + sta PHYSICIST_Y + + lda #P_STANDING + sta PHYSICIST_STATE + + rts + + + ;=========================== + ;=========================== + ; enter new room + ;=========================== + ;=========================== + +ootw_c9_setup_room_and_play: + + ;============================== + ; each room init + + + ;============================== + ; setup per-room variables + + lda WHICH_ROOM + bne room1 + + jsr init_shields + + ;=============================== + ; Room0 -- the arena + ;=============================== +room: + lda #(2+128) + sta LEFT_LIMIT + lda #(39+128) + sta RIGHT_LIMIT + + ; set right exit + lda #$ff ; exit level if exit this way + sta cer_smc+1 + + ; set left exit + lda #0 + sta cel_smc+1 + + lda #28 + sta PHYSICIST_Y + + ; load background + lda #>(arena_rle) + sta GBASH + lda #<(arena_rle) + + jmp room_setup_done + + ; ???? +room1: +; cmp #1 +; bne room2 + +; 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 room_setup_done + +room_setup_done: + + sta GBASL + lda #$c ; load to page $c00 + jsr load_rle_gr ; tail call + + ;===================== + ; setup walk collision + jsr recalc_walk_collision + + + +ootw_room_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 + + ;============================ + ;============================ + ; Room Loop + ;============================ + ;============================ +room_loop: + + ;================================ + ; copy background to current page + + jsr gr_copy_to_current + + ;================================== + ; draw background action + + lda WHICH_CAVE + +bg_room0: + +; 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 + + ;=============================== + ; check room limits + ;=============================== + + jsr check_screen_limit + + ;=============================== + ; adjust floor + ;=============================== + +; lda PHYSICIST_STATE +; cmp #P_FALLING_DOWN +; beq check_floor0_done + +; lda WHICH_CAVE +; cmp #0 +; bne check_floor1 + +; lda #14 +; sta PHYSICIST_Y + +; lda PHYSICIST_X +; cmp #19 +; bcc check_floor0_done + +; lda #12 +; sta PHYSICIST_Y + +; lda PHYSICIST_X +; cmp #28 +; bcc check_floor0_done + +; lda #10 +; sta PHYSICIST_Y + +check_floor0_done: + +check_floor1: + + + ;===================================== + ; draw physicist + ;===================================== + + jsr draw_physicist + + + ;===================================== + ; handle gun + ;===================================== + + jsr handle_gun + + ;===================================== + ; draw foreground action + ;===================================== + +; lda WHICH_CAVE +; cmp #0 +; bne c5_no_fg_action + +c5_draw_rocks: +; lda #1 +; sta XPOS +; lda #26 +; sta YPOS +; lda #small_rock +; sta INH +; jsr put_sprite + +; lda #10 +; sta XPOS +; lda #18 +; sta YPOS +; lda #medium_rock +; sta INH +; jsr put_sprite + +; lda #31 +; sta XPOS +; lda #14 +; sta YPOS +; lda #large_rock +; sta INH +; jsr put_sprite + +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 room_frame_no_oflo + inc FRAMEH +room_frame_no_oflo: + + ;========================== + ; check if done this level + ;========================== + + lda GAME_OVER + beq still_in_room + + cmp #$ff ; if $ff, we died + beq done_room + + ;=============================== + ; check if exited room to right + cmp #1 + beq room_exit_left + + ;================= + ; exit to right + +room_right_yes_exit: + + lda #0 + sta PHYSICIST_X +cer_smc: + lda #$0 ; smc+1 = exit location + sta WHICH_ROOM + jmp done_room + + ;===================== + ; exit to left + +room_exit_left: + + lda #37 + sta PHYSICIST_X +cel_smc: + lda #0 ; smc+1 + sta WHICH_ROOM + jmp done_room + + ; loop forever +still_in_room: + lda #0 + sta GAME_OVER + + jmp room_loop + +done_room: + rts + +end_message: +.byte 8,10,"PRESS RETURN TO CONTINUE",0 +.byte 11,20,"ACCESS CODE: SWIM",0 + +.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 "gr_hlin.s" +.include "keyboard.s" + +.include "physicist.s" +.include "alien.s" +.include "dummy_friend.s" + +.include "gun.s" +.include "laser.s" +.include "alien_laser.s" +.include "blast.s" +.include "shield.s" + +.include "door.s" +.include "collision.s" + +; room backgrounds +.include "ootw_graphics/l14arena/ootw_c14_arena.inc" +; sprites +.include "ootw_graphics/sprites/physicist.inc" +.include "ootw_graphics/sprites/alien.inc" +