diff --git a/ootw/Makefile b/ootw/Makefile index 2b55df18..43bc09c5 100644 --- a/ootw/Makefile +++ b/ootw/Makefile @@ -16,7 +16,7 @@ ootw.dsk: HELLO LOADER INTRO OOTW_C1 OOTW_C2 OOTW_C3 OOTW_C4 OOTW_C5 $(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 OOTW_C5 # $(DOS33) -y ootw.dsk BSAVE -a 0x1700 AUDIO_TEST # $(DOS33) -y ootw.dsk BSAVE -a 0x2000 COMPRESS-TEST diff --git a/ootw/alien.s b/ootw/alien.s index 49eef4b8..451c996a 100644 --- a/ootw/alien.s +++ b/ootw/alien.s @@ -166,9 +166,11 @@ ajump: .align 1 +;====================================== ;====================================== ; draw alien ;====================================== +;====================================== draw_alien: ; FIXME @@ -456,9 +458,11 @@ alien_facing_right: jmp put_sprite_flipped_crop + ;================== ;================== ; clear aliens ;================== + ;================== clear_aliens: lda #0 sta alien0_out @@ -466,3 +470,35 @@ clear_aliens: sta alien2_out rts + + + ;============================== + ;============================== + ; alien room init + ;============================== + ;============================== + +alien_room_init: + ;============================== + ; if alien in room, set ALIEN_OUT + + lda #0 + sta ALIEN_OUT + + ldx #0 +alien_room_loop: + lda alien_out,X + beq alien_room_continue + + lda alien_room,X + cmp WHICH_ROOM + bne alien_room_continue + + inc ALIEN_OUT + +alien_room_continue: + inx + cpx #MAX_ALIENS + bne alien_room_loop + + rts diff --git a/ootw/gun.s b/ootw/gun.s index 97226992..2b0fd497 100644 --- a/ootw/gun.s +++ b/ootw/gun.s @@ -9,6 +9,18 @@ handle_gun: lda HAVE_GUN ; no gun, do nothing beq done_gun + ;================ + ; fire laser + ;================ + + lda LASER_OUT + beq no_fire_laser + jsr fire_laser +no_fire_laser: + lda #0 + sta LASER_OUT + + lda GUN_STATE ; gun not charging, do nothing beq done_gun diff --git a/ootw/ootw_c1_cavern.s b/ootw/ootw_c1_cavern.s index 25a50c40..e78e75dc 100644 --- a/ootw/ootw_c1_cavern.s +++ b/ootw/ootw_c1_cavern.s @@ -21,8 +21,10 @@ ootw_cavern: lda #(-4+128) sta LEFT_LIMIT + sta LEFT_WALK_LIMIT lda #(39+128) sta RIGHT_LIMIT + sta RIGHT_WALK_LIMIT ;============================= ; Load background to $c00 diff --git a/ootw/ootw_c1_mesa.s b/ootw/ootw_c1_mesa.s index 9716aaa8..12b5baa9 100644 --- a/ootw/ootw_c1_mesa.s +++ b/ootw/ootw_c1_mesa.s @@ -26,16 +26,17 @@ ootw_mesa: lda #(128+39) ; aliens trigger sta RIGHT_LIMIT + sta RIGHT_WALK_LIMIT jmp mesa_left beast_not_out_yet: lda #(128+20) ; beast trigger sta RIGHT_LIMIT - + sta RIGHT_WALK_LIMIT mesa_left: lda #(128-4) sta LEFT_LIMIT - + sta LEFT_WALK_LIMIT ;============================= ; Load background to $c00 @@ -235,6 +236,7 @@ trigger_beast: lda #(39+128) ; update right side of screen sta RIGHT_LIMIT ; this is mostly for testing + sta RIGHT_WALK_LIMIT jsr beast_cutscene diff --git a/ootw/ootw_c1_pool.s b/ootw/ootw_c1_pool.s index 69966d08..02d9c6da 100644 --- a/ootw/ootw_c1_pool.s +++ b/ootw/ootw_c1_pool.s @@ -27,8 +27,10 @@ ootw_pool: lda #(39+128) sta RIGHT_LIMIT + sta RIGHT_WALK_LIMIT lda #(-4+128) sta LEFT_LIMIT + sta LEFT_WALK_LIMIT ;============================= ; Load background to $c00 diff --git a/ootw/ootw_c1_rope.s b/ootw/ootw_c1_rope.s index 1669149b..0bcc1ed5 100644 --- a/ootw/ootw_c1_rope.s +++ b/ootw/ootw_c1_rope.s @@ -21,8 +21,10 @@ ootw_rope: lda #(39+128) sta RIGHT_LIMIT + sta RIGHT_WALK_LIMIT lda #(11+128) sta LEFT_LIMIT + sta LEFT_WALK_LIMIT lda #0 sta SWING_PROGRESS diff --git a/ootw/ootw_c2.s b/ootw/ootw_c2.s index df5b9fe0..603f292b 100644 --- a/ootw/ootw_c2.s +++ b/ootw/ootw_c2.s @@ -15,17 +15,17 @@ ootw_c2: ; Run the intro ;======================= - jsr ootw_c2_intro +; jsr ootw_c2_intro ;======================= ; Enter the game ;======================= ootw_c2_restart: - jsr ootw_cage - lda GAME_OVER - cmp #$ff - beq quit_level +; jsr ootw_cage +; lda GAME_OVER +; cmp #$ff +; beq quit_level ;======================= ; Start Level After Cage @@ -119,6 +119,7 @@ end_message: .include "gr_run_sequence.s" .include "gr_overlay.s" .include "gr_vlin.s" +.include "gr_hlin.s" .include "random16.s" .include "keyboard.s" @@ -126,6 +127,13 @@ end_message: .include "alien.s" .include "friend.s" +.include "gun.s" +.include "blast.s" +.include "laser.s" +.include "shield.s" +.include "door.s" +.include "collision.s" + ; background miners .include "ootw_c2_miners.s" diff --git a/ootw/ootw_c2_cage.s b/ootw/ootw_c2_cage.s index 28a26add..34e28c23 100644 --- a/ootw/ootw_c2_cage.s +++ b/ootw/ootw_c2_cage.s @@ -158,7 +158,7 @@ done_drawing_cage: ; draw laser ;====================== - jsr draw_laser + jsr draw_up_laser ;====================== ; draw guard @@ -480,9 +480,9 @@ done_cage: ; Draw Laser ;====================== -draw_laser: +draw_up_laser: lda SHOOTING_BOTTOM - beq done_draw_laser + beq done_draw_up_laser ; 30 - 27, 30-24, 30-21 @@ -510,14 +510,14 @@ shoot_up_noadj: lda SHOOTING_TOP - beq done_draw_laser + beq done_draw_up_laser dec SHOOTING_TOP dec SHOOTING_TOP dec SHOOTING_TOP dec SHOOTING_TOP -done_draw_laser: +done_draw_up_laser: rts cage_amp1_sprites: @@ -1318,7 +1318,7 @@ done_cage_draw_lg: ;====================== ; continue drawing in case a shot was fired as we fell - jsr draw_laser + jsr draw_up_laser @@ -1362,7 +1362,7 @@ ce_default_gun: sta YPOS ce_draw_gun: - jsr draw_gun + jsr draw_floor_gun ce_done_gun: diff --git a/ootw/ootw_c2_elevator.s b/ootw/ootw_c2_elevator.s index 55690a27..bfda634b 100644 --- a/ootw/ootw_c2_elevator.s +++ b/ootw/ootw_c2_elevator.s @@ -1,21 +1,6 @@ ; Ootw Checkpoint2 -- Using the elevator ootw_elevator: - ;=========================== - ; 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 dome for later @@ -151,6 +136,18 @@ elevator_setup_done: jsr gr_copy_to_current ; jsr page_flip + + ;============================ + ; init shields + + jsr init_shields + + ;===================== + ; setup walk collision + + jsr recalc_walk_collision + + ;================================= ; setup vars @@ -219,9 +216,47 @@ draw_elevator: jsr draw_physicist + ;================ + ; handle gun + ;================ + + jsr handle_gun ;================ - ; draw foreground + ; draw gun effect + ;================ + + jsr draw_gun + + ;================ + ; move laser + ;================ + + jsr move_laser + + ;================ + ; draw laser + ;================ + + jsr draw_laser + + ;================ + ; move blast + ;================ + + jsr move_blast + + ;================ + ; draw blast + ;================ + + jsr draw_blast + + ;================ + ; draw shields + ;================ + + jsr draw_shields ;=============== ; page flip diff --git a/ootw/ootw_c2_jail.s b/ootw/ootw_c2_jail.s index b77acdd0..058a1202 100644 --- a/ootw/ootw_c2_jail.s +++ b/ootw/ootw_c2_jail.s @@ -12,6 +12,17 @@ ootw_jail_init: sta DIRECTION ; left sta HAVE_GUN + sta LASER_OUT + sta ALIEN_OUT + sta BLAST_OUT + sta CHARGER_COUNT + sta GUN_STATE + sta GUN_FIRE + sta NUM_DOORS + + lda #100 + sta GUN_CHARGE + lda #1 sta JAIL_POWER_ON sta friend_out @@ -36,7 +47,28 @@ ootw_jail_init: lda #30 sta PHYSICIST_Y + ;=============== + ; set up aliens + jsr clear_aliens + + lda #1 + sta alien0_out + + lda #6 + sta alien0_room + + lda #26 + sta alien0_x + + lda #20 + sta alien0_y + + lda #A_STANDING + sta alien0_state + + lda #1 + sta alien0_direction rts @@ -54,6 +86,17 @@ ootw_jail: sta ON_ELEVATOR sta TELEPORTING + ;============================ + ; init shields + + jsr init_shields + + ;============================ + ; init alien room + + jsr alien_room_init + + ;============================== ; setup per-room variables @@ -257,8 +300,8 @@ jail5: jmp jail_setup_done + ; tiny room with power jail6: - lda #(17+128) sta LEFT_LIMIT lda #(39+128) @@ -286,6 +329,10 @@ jail_setup_done: jsr load_rle_gr ; tail call + ; setup walk collision + jsr recalc_walk_collision + + ootw_jail_already_set: ;=========================== ; Enable graphics @@ -302,12 +349,6 @@ ootw_jail_already_set: lda #1 sta DISP_PAGE - ;================================= - ; copy to screen - -; jsr gr_copy_to_current -; jsr page_flip - ;================================= ; setup vars @@ -346,7 +387,7 @@ bg_jail0: sta XPOS lda #44 sta YPOS - jsr draw_gun + jsr draw_floor_gun jmp c2_no_bg_action @@ -430,8 +471,6 @@ actively_teleporting: c2_done_draw_physicist: - - ;=============== ; draw friend @@ -439,6 +478,71 @@ c2_done_draw_physicist: c2_done_draw_friend: + ;=============== + ; draw alien + ;=============== + + lda ALIEN_OUT + beq no_draw_alien + jsr draw_alien +no_draw_alien: + + + ;================ + ; handle gun + ;================ + + jsr handle_gun + + ;================ + ; draw gun effect + ;================ + + jsr draw_gun + + ;================ + ; move laser + ;================ + + jsr move_laser + + ;================ + ; draw laser + ;================ + + jsr draw_laser + + ;================ + ; move blast + ;================ + + jsr move_blast + + ;================ + ; draw blast + ;================ + + jsr draw_blast + + ;================ + ; draw shields + ;================ + + jsr draw_shields + + ;================ + ; handle doors + ;================ + + jsr handle_doors + + ;================ + ; draw doors + ;================ + + jsr draw_doors + + ;======================== @@ -840,10 +944,10 @@ gun_sprite: ;==================== - ; draw gun + ; draw floor_gun ;==================== ; xpos/ypos already set -draw_gun: +draw_floor_gun: lda #gun_sprite @@ -948,3 +1052,41 @@ gun_movie_loop: jsr load_rle_gr rts + + + +door_y: + c4_r0_door0_y: .byte 24 + c4_r0_door1_y: .byte 24 + c4_r0_door2_y: .byte 24 + c4_r0_door3_y: .byte 24 + c4_r0_door4_y: .byte 24 + +door_status: + c4_r0_door0_status: .byte DOOR_STATUS_CLOSED + c4_r0_door1_status: .byte DOOR_STATUS_CLOSED + c4_r0_door2_status: .byte DOOR_STATUS_LOCKED + c4_r0_door3_status: .byte DOOR_STATUS_LOCKED + c4_r0_door4_status: .byte DOOR_STATUS_LOCKED + +door_x: + c4_r0_door0_x: .byte 7 + c4_r0_door1_x: .byte 18 + c4_r0_door2_x: .byte 29 + c4_r0_door3_x: .byte 31 + c4_r0_door4_x: .byte 33 + +door_xmin: + c4_r0_door0_xmin: .byte 0 ; 7-4-5 + c4_r0_door1_xmin: .byte 11 ; 18-4-5 + c4_r0_door2_xmin: .byte 20 ; 29-4-5 + c4_r0_door3_xmin: .byte 22 ; 31-4-5 + c4_r0_door4_xmin: .byte 24 ; 33-4-5 + +door_xmax: + c4_r0_door0_xmax: .byte 11 ; 7+4 + c4_r0_door1_xmax: .byte 21 ; 18+4 + c4_r0_door2_xmax: .byte 33 ; don't care + c4_r0_door3_xmax: .byte 35 ; don't care + c4_r0_door4_xmax: .byte 37 ; don't care + diff --git a/ootw/ootw_c3_vent.s b/ootw/ootw_c3_vent.s index 5f2efe1e..f0bc1916 100644 --- a/ootw/ootw_c3_vent.s +++ b/ootw/ootw_c3_vent.s @@ -10,15 +10,15 @@ ootw_vent: sta VENT_DEATH sta VENT_END_COUNT + ; init the steam puffs sta steam1_state sta steam2_state sta steam3_state + ; steam4 is out of phase lda #32 sta steam4_state - - lda #17 sta PHYSICIST_X @@ -32,7 +32,7 @@ ootw_vent: sta FALLING_Y ;=========================== - ; Setup and clear pages (is this necessary?) + ; Setup and clear pages lda #4 sta DRAW_PAGE diff --git a/ootw/ootw_c4_city.s b/ootw/ootw_c4_city.s index 2cc7f0f4..11a06ef7 100644 --- a/ootw/ootw_c4_city.s +++ b/ootw/ootw_c4_city.s @@ -94,27 +94,8 @@ ootw_city: jsr init_shields - ;============================== - ; if alien in room, set ALIEN_OUT + jsr alien_room_init - lda #0 - sta ALIEN_OUT - - ldx #0 -alien_room_loop: - lda alien_out,X - beq alien_room_continue - - lda alien_room,X - cmp WHICH_ROOM - bne alien_room_continue - - inc ALIEN_OUT - -alien_room_continue: - inx - cpx #MAX_ALIENS - bne alien_room_loop lda #0 sta FRAMEL ; reset frame count for action timer @@ -658,17 +639,6 @@ after_draw_physicist: jsr draw_alien no_draw_alien: - ;================ - ; fire laser - ;================ - - lda LASER_OUT - beq no_fire_laser - jsr fire_laser -no_fire_laser: - lda #0 - sta LASER_OUT - ;================ ; handle gun ;================