diff --git a/ootw/TODO b/ootw/TODO index a696f6b3..3f38097d 100644 --- a/ootw/TODO +++ b/ootw/TODO @@ -1,6 +1,19 @@ TODO Before release: ==================== + + l2 -- alien behavior + + + + + room5: alien appears to left of door. Works on panel to + unlock it, comes in and bothers friend after + we call down. + also I think if you wait long enough more aliens + appear if you try to go left. + + general -- fix laser collision detection. add detection of shields add detection of friend diff --git a/ootw/friend.s b/ootw/friend.s index 5b690e6e..f4250715 100644 --- a/ootw/friend.s +++ b/ootw/friend.s @@ -1,18 +1,51 @@ ; draw/move our friend -friend_out: .byte 0 +friend_room: .byte 0 ; $FF means not out friend_x: .byte 0 friend_y: .byte 0 friend_state: .byte 0 friend_gait: .byte 0 friend_direction: .byte 0 -friend_gun: .byte 0 +;friend_gun: .byte 0 +friend_ai_state: .byte 0 F_STANDING = 0 F_WALKING = 1 F_RUNNING = 2 F_CROUCHING = 3 F_TURNING = 4 +F_KEYPAD = 5 +F_OPEN_VENT = 6 + +FAI_FOLLOWING = 0 +FAI_RUNTO_PANEL = 1 +FAI_OPENING_PANEL = 2 +FAI_END_L2 = 3 + + + ;======================================= + ; Process friend AI + ; + +friend_ai: + + ; FAI_END_L2 + ; crouch, holding panel open + + ; FAI_FOLLOWING + ; if x> phys_x by more than 8, walk left + ; if x< phys_x by more than 8, walk right + + ; FAI_RUNTO_PANEL + + ; otherwise, if not in ROOM#2, run right + ; if in room#2, run to panel + + ; FAI_OPENING_PANEL + ; if door2 unlocked -> FAI_FOLLOWING + + rts + ;======================================= ; Move friend based on current state @@ -89,6 +122,8 @@ fstate_table_lo: .byte friend_standing ; 00 @@ -96,6 +131,8 @@ fstate_table_hi: .byte >friend_running ; 02 .byte >friend_crouching ; 03 .byte >friend_turning ; 04 + .byte >friend_standing ; 05 KEYPAD + .byte >friend_open_vent ; 06 ; Urgh, make sure this doesn't end up at $FF or you hit the ; NMOS 6502 bug @@ -113,8 +150,9 @@ fjump: draw_friend: - lda friend_out - beq no_friend + lda friend_room + cmp WHICH_ROOM + bne no_friend lda friend_state tay @@ -158,6 +196,52 @@ friend_crouching: jmp finally_draw_friend +;=================================== +; OPEN_VENT +;=================================== + +friend_open_vent: + + ; draw vent -- HACK + + lda #1 + sta VENT_OPEN + + lda #$00 + sta COLOR + + ; X, V2 at Y + ; from x=top, v2=bottom + + + ldy #18 + lda #48 + sta V2 + ldx #24 + jsr vlin + + ldy #19 + lda #48 + sta V2 + ldx #24 + jsr vlin + + + + lda #21 + sta friend_x + lda #8 + sta friend_y + + lda #friend_crouch2 + sta INH + + jmp finally_draw_friend + + ;=============================== ; Walking @@ -243,7 +327,7 @@ friend_draw_turning: ;============================= -; Actually Draw Alien +; Actually Draw Friend ;============================= diff --git a/ootw/ootw_c2.s b/ootw/ootw_c2.s index 84a553fe..69037de8 100644 --- a/ootw/ootw_c2.s +++ b/ootw/ootw_c2.s @@ -57,13 +57,15 @@ c2_check_done: cmp #$ff beq quit_level - ; only exit if done level - ; FIXME: or quit pressed? - - lda WHICH_JAIL - cmp #11 + cmp #77 bne c2_new_room +;========================= +; end of level +;========================= + lda #3 + sta WHICH_LOAD + rts ;=========================== ; quit_level diff --git a/ootw/ootw_c2_jail.s b/ootw/ootw_c2_jail.s index 5610a763..e4c418e0 100644 --- a/ootw/ootw_c2_jail.s +++ b/ootw/ootw_c2_jail.s @@ -11,6 +11,7 @@ ootw_jail_init: sta WHICH_JAIL sta DIRECTION ; left sta HAVE_GUN + sta VENT_OPEN sta LASER_OUT sta ALIEN_OUT @@ -19,12 +20,14 @@ ootw_jail_init: sta GUN_STATE sta GUN_FIRE + sta friend_room + sta friend_ai_state + lda #100 sta GUN_CHARGE lda #1 sta JAIL_POWER_ON - sta friend_out sta friend_direction lda #F_RUNNING @@ -284,10 +287,6 @@ jail4_ok: lda #5 sta jel_smc+1 - - - - ; setup teleporter lda #(-4+128) sta td_left_smc1+1 @@ -310,11 +309,19 @@ jail4_ok: jmp jail_setup_done + ;===================== ; room with vent shaft jail5: cmp #5 bne jail6 + ; FIXME -- setup friend with open vent + sta friend_room + lda #F_OPEN_VENT + sta friend_state + lda #0 + sta friend_direction + ; setup doors lda #2 @@ -346,7 +353,8 @@ jail5: lda #(39+128) sta td_right_smc1+1 - lda #(6+128) + ; upper floor limits + lda #(0+128) sta tu_left_smc1+1 lda #(32+128) @@ -359,6 +367,7 @@ jail5: jmp jail_setup_done + ;====================== ; tiny room with power jail6: lda #(17+128) @@ -424,11 +433,13 @@ jail_loop: ;================================ ; copy background to current page + ;================================ jsr gr_copy_to_current ;================================== ; draw background action + ;================================== lda WHICH_JAIL @@ -484,6 +495,7 @@ c2_no_bg_action: ;=============================== ; check keyboard + ;=============================== jsr handle_keypress @@ -500,14 +512,17 @@ c2_no_bg_action: jsr move_friend - ;=============== + ;=================== ; check room limits + ;=================== + jsr check_screen_limit ;=============== ; draw physicist + ;================ lda TELEPORTING bne actively_teleporting @@ -529,8 +544,9 @@ actively_teleporting: dec TELEPORTING bne c2_done_draw_physicist - ;================ + ;=============================== ; recalc collision on new floor + ;=============================== jsr recalc_walk_collision @@ -576,6 +592,7 @@ no_draw_alien: ;======================== ; draw foreground action + ;======================== lda WHICH_JAIL cmp #1 @@ -696,11 +713,13 @@ dude_not_out: ;=============== ; page flip + ;=============== jsr page_flip ;================ ; inc frame count + ;================ inc FRAMEL bne jail_frame_no_oflo @@ -710,6 +729,7 @@ jail_frame_no_oflo: ;==================== ; handle teleporters + ;=================== lda WHICH_JAIL cmp #4 @@ -811,7 +831,7 @@ not_teleporting_today: ; see if picking up gun ;========================== - lda WHICH_JAIL + lda WHICH_JAIL ; only in room 0 bne not_picking_up_gun lda HAVE_GUN @@ -837,10 +857,57 @@ not_teleporting_today: not_picking_up_gun: + ;========================== + ; see if falling down vent + ;========================== +check_vent_falling: + lda WHICH_JAIL ; only in room 5 + cmp #5 + bne not_falling_down_vent + + lda VENT_OPEN + beq not_falling_down_vent + + lda PHYSICIST_STATE + cmp #P_STANDING + bne not_falling_down_vent + + ; vent at 18/19 + lda PHYSICIST_X + cmp #17 + beq falling_down_vent + cmp #18 + bne not_falling_down_vent + +falling_down_vent: + lda #P_FALLING_DOWN + sta PHYSICIST_STATE + + lda #48 + sta fall_down_destination_smc+1 + +not_falling_down_vent: + + + ;===================== + ; check if fell into L3 + ;======================= + + lda PHYSICIST_Y + cmp #48 + bne not_l3_yet + + lda #77 + sta GAME_OVER + +not_l3_yet: + + ;========================== ; check if done this level ;========================== + lda GAME_OVER beq still_in_jail @@ -1163,7 +1230,7 @@ door_c2_r5: .word door_c2_r5_xmax door_c2_r5_status: - c2_r5_door0_status: .byte DOOR_STATUS_CLOSED + c2_r5_door0_status: .byte DOOR_STATUS_LOCKED c2_r5_door1_status: .byte DOOR_STATUS_CLOSED door_c2_r5_x: diff --git a/ootw/ootw_graphics/l2jail/ootw_c2_jail.inc b/ootw/ootw_graphics/l2jail/ootw_c2_jail.inc index 560f91e0..f3be0384 100644 --- a/ootw/ootw_graphics/l2jail/ootw_c2_jail.inc +++ b/ootw/ootw_graphics/l2jail/ootw_c2_jail.inc @@ -249,16 +249,16 @@ room_b3_rle: .byte $28 ; ysize=48 .byte $A3,$22, $55, $A0,$1E,$22, $A3,$00, $88,$88, $55, $A3,$22 .byte $55, $A0,$1E,$22, $A3,$00, $88,$88, $55, $A3,$22, $55 .byte $A3,$22, $52, $A0,$1A,$22, $A3,$00, $88,$88, $65,$65, $62,$62 - .byte $65, $62,$62, $65,$65, $A4,$62, $65, $A4,$62, $A3,$F2 + .byte $65, $62,$62, $65,$65, $A4,$62, $65, $A4,$62, $A3,$02 .byte $AA,$62, $02, $A3,$22, $A3,$00, $88,$88, $A4,$00, $20 - .byte $02, $AE,$00, $05, $AA,$00, $02, $22,$22, $20 - .byte $A3,$00, $88,$88, $AD,$00, $80, $AF,$88, $00,$00, $02 - .byte $22,$22, $20, $A0,$10,$00, $80, $A0,$11,$88, $00,$00, $A3,$22 - .byte $A6,$20, $AA,$80, $A0,$13,$88, $00,$00, $A9,$22, $A0,$1D,$88, $00,$00 + .byte $02, $AC,$00, $0F,$0F, $5F, $AA,$00, $02, $22,$22 + .byte $20, $A3,$00, $88,$88, $AD,$00, $80, $AF,$88, $00,$00 + .byte $02, $22,$22, $20, $A0,$10,$00, $80, $A0,$11,$88, $00,$00 + .byte $A3,$22, $A6,$20, $AA,$80, $A0,$13,$88, $00,$00, $A9,$22, $A0,$1D,$88 + .byte $00,$00, $A9,$22, $A0,$1D,$88, $00,$00, $A9,$22, $A0,$1D,$88, $00,$00 .byte $A9,$22, $A0,$1D,$88, $00,$00, $A9,$22, $A0,$1D,$88, $00,$00, $A9,$22 .byte $A0,$1D,$88, $00,$00, $A9,$22, $A0,$1D,$88, $00,$00, $A9,$22, $A0,$1D,$88 - .byte $00,$00, $A9,$22, $A0,$1D,$88, $00,$00, $A9,$22, $A0,$1D,$88, $00,$00 - .byte $A9,$05 + .byte $00,$00, $A9,$05 .byte $A1 room_b4_rle: .byte $28 ; ysize=48 .byte $A0,$59,$88, $A0,$1F,$00, $A9,$88, $00, $65, $A3,$25, $27 diff --git a/ootw/ootw_graphics/l2jail/room_b3.png b/ootw/ootw_graphics/l2jail/room_b3.png index 2a8208b1..1d6413b6 100644 Binary files a/ootw/ootw_graphics/l2jail/room_b3.png and b/ootw/ootw_graphics/l2jail/room_b3.png differ diff --git a/ootw/zp.inc b/ootw/zp.inc index aaba6bb8..64ff40fc 100644 --- a/ootw/zp.inc +++ b/ootw/zp.inc @@ -133,6 +133,7 @@ DOOR_XMAX_H = $C9 BEAST_ZAPPING = $CA ; 1 BEAST_DEAD = $CB ; 1 +VENT_OPEN = $CC ; 2 LEFT_SHOOT_TARGET = $CF ; ALL RIGHT_SHOOT_TARGET = $D0 ; ALL