mirror of
https://github.com/deater/dos33fsprogs.git
synced 2025-08-15 08:27:41 +00:00
ootw: split out room edge detection
now we can jump on run to other rooms still a bit buggy. Also hit the NMOS 6502 jump table bug
This commit is contained in:
@@ -7,6 +7,8 @@ handle_keypress:
|
|||||||
lda PHYSICIST_STATE
|
lda PHYSICIST_STATE
|
||||||
cmp #P_COLLAPSING ; ignore keypress if dying
|
cmp #P_COLLAPSING ; ignore keypress if dying
|
||||||
beq no_keypress
|
beq no_keypress
|
||||||
|
cmp #P_JUMPING ; ignore keypress if jumping
|
||||||
|
beq no_keypress
|
||||||
|
|
||||||
lda KEYPRESS ; 4
|
lda KEYPRESS ; 4
|
||||||
bmi keypress ; 3
|
bmi keypress ; 3
|
||||||
@@ -59,15 +61,16 @@ walk_left:
|
|||||||
dec PHYSICIST_X ; walk left
|
dec PHYSICIST_X ; walk left
|
||||||
|
|
||||||
no_move_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:
|
; 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
|
jmp done_keypress ; done
|
||||||
|
|
||||||
@@ -104,18 +107,18 @@ walk_right:
|
|||||||
inc PHYSICIST_X
|
inc PHYSICIST_X
|
||||||
no_move_right:
|
no_move_right:
|
||||||
|
|
||||||
lda PHYSICIST_X
|
; lda PHYSICIST_X
|
||||||
cmp RIGHT_LIMIT
|
; cmp RIGHT_LIMIT
|
||||||
bne just_fine_right
|
; bne just_fine_right
|
||||||
too_far_right:
|
;too_far_right:
|
||||||
|
|
||||||
dec PHYSICIST_X
|
; dec PHYSICIST_X
|
||||||
|
|
||||||
lda #2
|
; lda #2
|
||||||
sta GAME_OVER
|
; sta GAME_OVER
|
||||||
|
|
||||||
|
|
||||||
just_fine_right:
|
;just_fine_right:
|
||||||
|
|
||||||
jmp done_keypress
|
jmp done_keypress
|
||||||
|
|
||||||
|
@@ -169,6 +169,12 @@ cavern_loop:
|
|||||||
|
|
||||||
jsr handle_keypress
|
jsr handle_keypress
|
||||||
|
|
||||||
|
;===============
|
||||||
|
; check room limits
|
||||||
|
|
||||||
|
jsr check_screen_limit
|
||||||
|
|
||||||
|
|
||||||
;===============
|
;===============
|
||||||
; draw physicist
|
; draw physicist
|
||||||
|
|
||||||
|
@@ -65,6 +65,12 @@ mesa_loop:
|
|||||||
|
|
||||||
jsr handle_keypress
|
jsr handle_keypress
|
||||||
|
|
||||||
|
;===============================
|
||||||
|
; check limits
|
||||||
|
|
||||||
|
jsr check_screen_limit
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
;===============
|
;===============
|
||||||
; draw physicist
|
; draw physicist
|
||||||
|
@@ -272,6 +272,10 @@ no_tentacle:
|
|||||||
|
|
||||||
jsr handle_keypress
|
jsr handle_keypress
|
||||||
|
|
||||||
|
;===============================
|
||||||
|
; check limits
|
||||||
|
|
||||||
|
jsr check_screen_limit
|
||||||
|
|
||||||
;===============
|
;===============
|
||||||
; draw physicist
|
; draw physicist
|
||||||
@@ -343,7 +347,7 @@ not_to_right:
|
|||||||
cmp #$1
|
cmp #$1
|
||||||
bne not_done_pool
|
bne not_done_pool
|
||||||
|
|
||||||
lda #37
|
lda #36
|
||||||
sta PHYSICIST_X
|
sta PHYSICIST_X
|
||||||
|
|
||||||
jmp ootw_rope
|
jmp ootw_rope
|
||||||
|
@@ -71,6 +71,11 @@ rope_loop:
|
|||||||
|
|
||||||
jsr handle_keypress
|
jsr handle_keypress
|
||||||
|
|
||||||
|
;===============================
|
||||||
|
; check screen limits
|
||||||
|
|
||||||
|
jsr check_screen_limit
|
||||||
|
|
||||||
|
|
||||||
;===============
|
;===============
|
||||||
; draw physicist
|
; draw physicist
|
||||||
@@ -152,7 +157,7 @@ rope_frame_no_oflo:
|
|||||||
|
|
||||||
; check if done this level
|
; check if done this level
|
||||||
cmp #$2
|
cmp #$2
|
||||||
bne not_done_rope
|
bne check_cliff_edge
|
||||||
|
|
||||||
lda #0
|
lda #0
|
||||||
sta PHYSICIST_X
|
sta PHYSICIST_X
|
||||||
@@ -160,8 +165,19 @@ rope_frame_no_oflo:
|
|||||||
|
|
||||||
jmp ootw_pool
|
jmp ootw_pool
|
||||||
|
|
||||||
not_done_rope:
|
|
||||||
|
|
||||||
|
; at edge of cliff
|
||||||
|
check_cliff_edge:
|
||||||
|
cmp #$1
|
||||||
|
bne not_done_rope
|
||||||
|
|
||||||
|
lda #0
|
||||||
|
sta GAME_OVER
|
||||||
|
|
||||||
|
lda #11
|
||||||
|
sta PHYSICIST_X
|
||||||
|
|
||||||
|
not_done_rope:
|
||||||
; loop forever
|
; loop forever
|
||||||
|
|
||||||
jmp rope_loop
|
jmp rope_loop
|
||||||
|
@@ -15,9 +15,16 @@ pstate_table_hi:
|
|||||||
.byte >physicist_jumping
|
.byte >physicist_jumping
|
||||||
.byte >physicist_collapsing
|
.byte >physicist_collapsing
|
||||||
|
|
||||||
|
; Urgh, make sure this doesn't end up at $FF or you hit the
|
||||||
|
; NMOS 6502 bug
|
||||||
|
|
||||||
|
.align 2
|
||||||
|
|
||||||
pjump:
|
pjump:
|
||||||
.word $0000
|
.word $0000
|
||||||
|
|
||||||
|
.align 1
|
||||||
|
|
||||||
;======================================
|
;======================================
|
||||||
; draw physicist
|
; draw physicist
|
||||||
;======================================
|
;======================================
|
||||||
@@ -247,3 +254,40 @@ facing_left:
|
|||||||
facing_right:
|
facing_right:
|
||||||
jmp put_sprite_flipped
|
jmp put_sprite_flipped
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
;======================================
|
||||||
|
; Check screen limits
|
||||||
|
;======================================
|
||||||
|
|
||||||
|
check_screen_limit:
|
||||||
|
|
||||||
|
lda PHYSICIST_X
|
||||||
|
cmp LEFT_LIMIT
|
||||||
|
bpl just_fine_left ; (bge==bcs)
|
||||||
|
|
||||||
|
too_far_left:
|
||||||
|
; inc PHYSICIST_X
|
||||||
|
|
||||||
|
lda #1
|
||||||
|
sta GAME_OVER
|
||||||
|
rts
|
||||||
|
|
||||||
|
just_fine_left:
|
||||||
|
|
||||||
|
; Check right edige of screen
|
||||||
|
|
||||||
|
lda PHYSICIST_X
|
||||||
|
cmp RIGHT_LIMIT
|
||||||
|
bcc just_fine_right ; blt
|
||||||
|
|
||||||
|
too_far_right:
|
||||||
|
|
||||||
|
; dec PHYSICIST_X
|
||||||
|
|
||||||
|
lda #2
|
||||||
|
sta GAME_OVER
|
||||||
|
|
||||||
|
just_fine_right:
|
||||||
|
|
||||||
|
rts
|
||||||
|
Reference in New Issue
Block a user