ootw: change the keyboard controls

a bit more awkward, but something that will actually work on a II+
This commit is contained in:
Vince Weaver 2019-03-23 13:20:43 -04:00
parent c7bb489b03
commit 448f16e947
9 changed files with 209 additions and 182 deletions

View File

@ -29,11 +29,11 @@ Game controls:
This means it's really not possible to use the keyboard the This means it's really not possible to use the keyboard the
same way as the original game. same way as the original game.
Q/E - walk left/right D -> - move right (twice to run)
A/D <-/-> - run left/right A <- - move left (twice to run)
W up - jump W up - jump
S down - crouch S down - crouch / pickup
space - kick space - kick / gun
During the intro, you can press R to make it repeat forever. During the intro, you can press R to make it repeat forever.

View File

@ -26,13 +26,10 @@
305 HTAB 8:PRINT "LOADING (BE PATIENT...)" 305 HTAB 8:PRINT "LOADING (BE PATIENT...)"
310 PRINT:PRINT:PRINT:PRINT 310 PRINT:PRINT:PRINT:PRINT
315 PRINT "CONTROLS:" 315 PRINT "CONTROLS:"
320 PRINT " A OR <- : WALK LEFT" 320 PRINT " A OR <- : MOVE LEFT"
325 PRINT " D OR -> : WALK RIGHT" 325 PRINT " D OR -> : MOVE RIGHT"
330 PRINT " Q : RUN LEFT"
335 PRINT " E : RUN RIGHT"
340 PRINT " W OR UP : JUMP" 340 PRINT " W OR UP : JUMP"
345 PRINT " S OR DOWN : CROUCH / PICKUP" 345 PRINT " S OR DOWN : CROUCH / PICKUP"
350 PRINT " SPACEBAR : KICK" 350 PRINT " SPACEBAR : KICK / SHOOT"
355 PRINT " RETURN : SHOOTS"
360 PRINT " ESC : QUITS" 360 PRINT " ESC : QUITS"
365 RETURN 365 RETURN

View File

@ -1,3 +1,4 @@
;====================================== ;======================================
; handle keypress ; handle keypress
;====================================== ;======================================
@ -41,9 +42,12 @@ keypress:
and #$7f ; clear high bit and #$7f ; clear high bit
;======================
; check escape
check_quit: check_quit:
cmp #27 ; quit if ESCAPE pressed cmp #27 ; quit if ESCAPE pressed
bne check_walk_left bne check_left
;===================== ;=====================
; QUIT ; QUIT
@ -53,148 +57,138 @@ quit:
sta GAME_OVER sta GAME_OVER
rts rts
check_walk_left: ;======================
; check left
check_left:
cmp #'A' cmp #'A'
beq walk_left beq left_pressed
cmp #$8 ; left arrow cmp #$8 ; left arrow
bne check_walk_right bne check_right
;==================== ;====================
; Walk left ; Left Pressed
;==================== ;====================
walk_left: left_pressed:
; left==0
lda #P_WALKING
sta PHYSICIST_STATE ; stand from crouching
lda DIRECTION ; if facing right, turn to face left 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 ; already running, do nothing?
cmp #$4 rts
bne no_move_left
dec PHYSICIST_X ; walk left left_going_right:
lda PHYSICIST_STATE
no_move_left: cmp #P_RUNNING
; 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'
beq walk_right 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 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 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: run_right:
lda #P_RUNNING lda #P_RUNNING
bne update_state
update_state:
sta PHYSICIST_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: check_up:
cmp #'W' cmp #'W'
@ -203,7 +197,7 @@ check_up:
bne check_down bne check_down
up: up:
;======================== ;========================
; Jump ; Jump -- Up Pressed
;======================== ;========================
lda #P_JUMPING lda #P_JUMPING
@ -249,5 +243,3 @@ done_keypress:
bit KEYRESET ; clear the keyboard strobe ; 4 bit KEYRESET ; clear the keyboard strobe ; 4
rts ; 6 rts ; 6

View File

@ -96,6 +96,11 @@ jail_loop:
jsr handle_keypress jsr handle_keypress
;===============================
; move physicist
jsr move_physicist
;=============== ;===============
; check room limits ; check room limits

View File

@ -117,58 +117,18 @@ cavern_loop:
jsr earthquake_handler 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 ; check keyboard
jsr handle_keypress jsr handle_keypress
;===============
; move physicist
jsr move_physicist
;=============== ;===============
; check room limits ; check room limits

View File

@ -141,11 +141,19 @@ no_levelend:
beyond_mesa_normal: beyond_mesa_normal:
lda LEVELEND_PROGRESS ; only draw if not in end animation
bne level1_ending
;=============================== ;===============================
; check keyboard ; check keyboard
jsr handle_keypress jsr handle_keypress
;===============================
; Move physicist
jsr move_physicist
;=============================== ;===============================
; check limits ; check limits
@ -155,10 +163,8 @@ beyond_mesa_normal:
;=============== ;===============
; draw physicist ; draw physicist
lda LEVELEND_PROGRESS ; only draw if not in end animation
bne level1_ending
jsr draw_physicist jsr draw_physicist
level1_ending: level1_ending:
;=============== ;===============

View File

@ -272,6 +272,12 @@ no_tentacle:
jsr handle_keypress jsr handle_keypress
;===============================
; move physicist
jsr move_physicist
;=============================== ;===============================
; check limits ; check limits

View File

@ -126,6 +126,11 @@ beyond_quake:
jsr handle_keypress jsr handle_keypress
;===============================
; move physicist
jsr move_physicist
;=============================== ;===============================
; check screen limits ; check screen limits

View File

@ -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: pstate_table_lo:
.byte <physicist_standing ; 00 .byte <physicist_standing ; 00
.byte <physicist_walking ; 01 .byte <physicist_walking ; 01