diff --git a/ootw/README b/ootw/README index fb11b2c8..fd9ecd8c 100644 --- a/ootw/README +++ b/ootw/README @@ -29,11 +29,11 @@ Game controls: This means it's really not possible to use the keyboard the same way as the original game. - Q/E - walk left/right - A/D <-/-> - run left/right + D -> - move right (twice to run) + A <- - move left (twice to run) W up - jump - S down - crouch - space - kick + S down - crouch / pickup + space - kick / gun During the intro, you can press R to make it repeat forever. diff --git a/ootw/hello.bas b/ootw/hello.bas index 28764d4f..0f311d62 100644 --- a/ootw/hello.bas +++ b/ootw/hello.bas @@ -26,13 +26,10 @@ 305 HTAB 8:PRINT "LOADING (BE PATIENT...)" 310 PRINT:PRINT:PRINT:PRINT 315 PRINT "CONTROLS:" - 320 PRINT " A OR <- : WALK LEFT" - 325 PRINT " D OR -> : WALK RIGHT" - 330 PRINT " Q : RUN LEFT" - 335 PRINT " E : RUN RIGHT" + 320 PRINT " A OR <- : MOVE LEFT" + 325 PRINT " D OR -> : MOVE RIGHT" 340 PRINT " W OR UP : JUMP" 345 PRINT " S OR DOWN : CROUCH / PICKUP" - 350 PRINT " SPACEBAR : KICK" - 355 PRINT " RETURN : SHOOTS" + 350 PRINT " SPACEBAR : KICK / SHOOT" 360 PRINT " ESC : QUITS" 365 RETURN diff --git a/ootw/keyboard.s b/ootw/keyboard.s index 68b2f95a..c489d6a7 100644 --- a/ootw/keyboard.s +++ b/ootw/keyboard.s @@ -1,3 +1,4 @@ + ;====================================== ; handle keypress ;====================================== @@ -41,9 +42,12 @@ keypress: and #$7f ; clear high bit + ;====================== + ; check escape + check_quit: cmp #27 ; quit if ESCAPE pressed - bne check_walk_left + bne check_left ;===================== ; QUIT @@ -53,148 +57,138 @@ quit: sta GAME_OVER rts -check_walk_left: + ;====================== + ; check left +check_left: cmp #'A' - beq walk_left + beq left_pressed cmp #$8 ; left arrow - bne check_walk_right + bne check_right ;==================== - ; Walk left + ; Left Pressed ;==================== -walk_left: - - lda #P_WALKING - sta PHYSICIST_STATE ; stand from crouching - +left_pressed: + ; left==0 lda DIRECTION ; if facing right, turn to face left - bne face_left + bne left_going_right - inc GAIT ; cycle through animation +left_going_left: + lda PHYSICIST_STATE + cmp #P_STANDING + beq walk_left + cmp #P_WALKING + beq run_left - lda GAIT - and #$7 - cmp #$4 - bne no_move_left + ;============================= + ; already running, do nothing? + rts - dec PHYSICIST_X ; walk left - -no_move_left: - -; lda PHYSICIST_X -; cmp LEFT_LIMIT -; bpl just_fine_left -;too_far_left: -; inc PHYSICIST_X -; lda #1 -; sta GAME_OVER - -;just_fine_left: - - jmp done_keypress ; done - -face_left: - lda #0 - sta DIRECTION - sta GAIT - jmp done_keypress - -check_walk_right: - cmp #'D' +left_going_right: + lda PHYSICIST_STATE + cmp #P_RUNNING beq walk_right + cmp #P_WALKING + beq stand_right + cmp #P_STANDING + beq stand_left + + ;=========================== + ; otherwise? + rts + + ;======================== + ; check for right pressed + +check_right: + cmp #'D' + beq right_pressed cmp #$15 - bne check_run_left - - - ;=================== - ; Walk Right - ;=================== -walk_right: - lda #P_WALKING - sta PHYSICIST_STATE - - lda DIRECTION - beq face_right - - inc GAIT - - lda GAIT - and #$7 - cmp #$4 - bne no_move_right - - inc PHYSICIST_X -no_move_right: - -; lda PHYSICIST_X -; cmp RIGHT_LIMIT -; bne just_fine_right -;too_far_right: - -; dec PHYSICIST_X - -; lda #2 -; sta GAME_OVER - - -;just_fine_right: - - jmp done_keypress - -face_right: - lda #0 - sta GAIT - lda #1 - sta DIRECTION - jmp done_keypress - - - -check_run_left: - cmp #'Q' - bne check_run_right - - - ;==================== - ; Run left - ;==================== -run_left: - - lda #P_RUNNING - sta PHYSICIST_STATE ; stand from crouching - - lda DIRECTION ; if facing right, turn to face left - bne face_left - - inc GAIT ; cycle through animation - inc GAIT ; cycle through animation - - dec PHYSICIST_X ; walk left - - jmp no_move_left - - -check_run_right: - cmp #'E' bne check_up + ;=================== - ; Run Right + ; Right Pressed ;=================== +right_pressed: + + ; right==1 + lda DIRECTION ; if facing right, turn to face left + beq right_going_left + + +right_going_right: + lda PHYSICIST_STATE + cmp #P_STANDING + beq walk_right + cmp #P_WALKING + beq run_right + + ;============================= + ; already running, do nothing? + rts + +right_going_left: + lda PHYSICIST_STATE + cmp #P_RUNNING + beq walk_left + cmp #P_WALKING + beq stand_left + cmp #P_STANDING + beq stand_right + + ;=========================== + ; otherwise? + rts + + + ;===================== + ; Left, direction=0 + ; Right, direction=1 + +stand_left: + lda #0 ; left + sta DIRECTION + sta GAIT + lda #P_STANDING + beq update_state + +walk_left: + lda #P_WALKING + bne update_state + +run_left: + lda #P_RUNNING + bne update_state + + +stand_right: + lda #0 + sta GAIT + lda #1 ; just inc DIRECTION? + sta DIRECTION + lda #P_STANDING + beq update_state + +walk_right: + lda #P_WALKING + bne update_state + run_right: lda #P_RUNNING + bne update_state + +update_state: sta PHYSICIST_STATE + bit KEYRESET + rts - lda DIRECTION - beq face_right - inc GAIT - inc GAIT - inc PHYSICIST_X - jmp no_move_right + ;===================== + ; check up check_up: cmp #'W' @@ -203,7 +197,7 @@ check_up: bne check_down up: ;======================== - ; Jump + ; Jump -- Up Pressed ;======================== lda #P_JUMPING @@ -249,5 +243,3 @@ done_keypress: bit KEYRESET ; clear the keyboard strobe ; 4 rts ; 6 - - diff --git a/ootw/ootw_c2_jail.s b/ootw/ootw_c2_jail.s index 9c4d86d7..28330516 100644 --- a/ootw/ootw_c2_jail.s +++ b/ootw/ootw_c2_jail.s @@ -96,6 +96,11 @@ jail_loop: jsr handle_keypress + ;=============================== + ; move physicist + + jsr move_physicist + ;=============== ; check room limits diff --git a/ootw/ootw_cavern.s b/ootw/ootw_cavern.s index 31311e24..34c4555f 100644 --- a/ootw/ootw_cavern.s +++ b/ootw/ootw_cavern.s @@ -117,58 +117,18 @@ cavern_loop: jsr earthquake_handler - ;=============== - ; handle slug death - -; lda SLUGDEATH -; beq still_alive - -;collapsing: -; lda SLUGDEATH_PROGRESS -; cmp #18 -; bmi still_collapsing - -;really_dead: -; lda #$ff -; sta GAME_OVER -; jmp just_slugs - - -;still_collapsing: -; tax - -; lda collapse_progression,X - ; sta INL - ; lda collapse_progression+1,X - ; sta INH - -; lda PHYSICIST_X - ; sta XPOS - ; lda PHYSICIST_Y -; sec -; sbc EARTH_OFFSET - ; sta YPOS - -; jsr put_sprite - - ; lda FRAMEL - ; and #$1f - ; bne no_collapse_progress - -; inc SLUGDEATH_PROGRESS -; inc SLUGDEATH_PROGRESS -;no_collapse_progress: - - -; jmp just_slugs - -;still_alive: ;=============== ; check keyboard jsr handle_keypress + + ;=============== + ; move physicist + + jsr move_physicist + ;=============== ; check room limits diff --git a/ootw/ootw_mesa.s b/ootw/ootw_mesa.s index 8a80ebb8..8aa54fd1 100644 --- a/ootw/ootw_mesa.s +++ b/ootw/ootw_mesa.s @@ -141,11 +141,19 @@ no_levelend: beyond_mesa_normal: + lda LEVELEND_PROGRESS ; only draw if not in end animation + bne level1_ending + ;=============================== ; check keyboard jsr handle_keypress + ;=============================== + ; Move physicist + + jsr move_physicist + ;=============================== ; check limits @@ -155,10 +163,8 @@ beyond_mesa_normal: ;=============== ; draw physicist - lda LEVELEND_PROGRESS ; only draw if not in end animation - bne level1_ending - jsr draw_physicist + level1_ending: ;=============== diff --git a/ootw/ootw_pool.s b/ootw/ootw_pool.s index 391e163b..82feb444 100644 --- a/ootw/ootw_pool.s +++ b/ootw/ootw_pool.s @@ -272,6 +272,12 @@ no_tentacle: jsr handle_keypress + + ;=============================== + ; move physicist + + jsr move_physicist + ;=============================== ; check limits diff --git a/ootw/ootw_rope.s b/ootw/ootw_rope.s index 12b865f6..afefd162 100644 --- a/ootw/ootw_rope.s +++ b/ootw/ootw_rope.s @@ -126,6 +126,11 @@ beyond_quake: jsr handle_keypress + ;=============================== + ; move physicist + + jsr move_physicist + ;=============================== ; check screen limits diff --git a/ootw/physicist.s b/ootw/physicist.s index ca67714d..2b104e2c 100644 --- a/ootw/physicist.s +++ b/ootw/physicist.s @@ -1,3 +1,59 @@ + ;======================================= + ; Move physicist based on current state + +move_physicist: + lda PHYSICIST_STATE + cmp #P_WALKING + beq move_physicist_walking + cmp #P_RUNNING + beq move_physicist_running + rts + + ;====================== + ; walking + +move_physicist_walking: + inc GAIT ; cycle through animation + + lda GAIT + and #$7 + cmp #$4 + bne no_move_walk + + lda DIRECTION + beq p_walk_left + + inc PHYSICIST_X ; walk right + rts +p_walk_left: + dec PHYSICIST_X ; walk left +no_move_walk: + rts + + ;====================== + ; running +move_physicist_running: + inc GAIT ; cycle through animation + inc GAIT ; cycle through animation + + lda DIRECTION + beq p_run_left + + inc PHYSICIST_X ; run right + rts +p_run_left: + dec PHYSICIST_X ; run left + + rts + ;====================== + ; standing + +move_physicist_standing: + + + + + pstate_table_lo: .byte