2024-03-30 04:55:12 +00:00
|
|
|
;======================
|
|
|
|
; check touching things
|
|
|
|
;======================
|
|
|
|
; do head, than foot
|
2024-04-05 20:45:40 +00:00
|
|
|
|
2024-03-30 04:55:12 +00:00
|
|
|
check_items:
|
2024-03-30 05:05:25 +00:00
|
|
|
|
2024-04-06 06:18:42 +00:00
|
|
|
jsr check_yorp
|
|
|
|
|
2024-04-05 20:45:40 +00:00
|
|
|
;===================
|
|
|
|
; check head first
|
|
|
|
;===================
|
|
|
|
; if X==0, check TILEX and TILEX+1
|
|
|
|
; if X==1, check TILEX+1
|
2024-03-30 05:05:25 +00:00
|
|
|
|
2024-04-05 20:45:40 +00:00
|
|
|
clc
|
|
|
|
lda KEEN_TILEY
|
|
|
|
adc #>big_tilemap
|
|
|
|
sta INH
|
|
|
|
lda KEEN_TILEX
|
|
|
|
sta INL
|
2024-03-30 04:55:12 +00:00
|
|
|
|
2024-04-05 20:45:40 +00:00
|
|
|
lda KEEN_X
|
|
|
|
bne check_head_tilex1
|
|
|
|
|
|
|
|
;===================
|
|
|
|
; check head tilex
|
2024-03-30 05:05:25 +00:00
|
|
|
|
2024-04-05 20:45:40 +00:00
|
|
|
check_head_tilex:
|
|
|
|
; don't check door, only leave if feet at door
|
|
|
|
|
|
|
|
; check if touching enemy
|
2024-03-30 05:05:25 +00:00
|
|
|
jsr check_enemy
|
|
|
|
|
2024-04-05 20:45:40 +00:00
|
|
|
; check item
|
|
|
|
jsr check_item
|
|
|
|
|
|
|
|
check_head_tilex1:
|
|
|
|
inc INL
|
|
|
|
|
|
|
|
; don't check door, only leave if feet at door
|
2024-03-30 05:05:25 +00:00
|
|
|
|
2024-04-05 20:45:40 +00:00
|
|
|
; check if touching enemy
|
|
|
|
jsr check_enemy
|
|
|
|
|
|
|
|
; check items
|
2024-04-01 05:25:52 +00:00
|
|
|
jsr check_item
|
2024-04-05 20:45:40 +00:00
|
|
|
|
|
|
|
|
|
|
|
;========================
|
|
|
|
; check feet
|
|
|
|
check_feet:
|
|
|
|
inc INH ; point to next row
|
|
|
|
dec INL ; restore tile pointer
|
|
|
|
|
|
|
|
lda KEEN_X
|
|
|
|
bne check_feet_tilex1
|
|
|
|
|
|
|
|
check_feet_tilex:
|
|
|
|
; check if going out door
|
|
|
|
jsr check_door
|
|
|
|
|
2024-04-06 06:18:42 +00:00
|
|
|
; check if touching fixed enemy
|
2024-04-05 20:45:40 +00:00
|
|
|
jsr check_enemy
|
|
|
|
|
2024-04-06 06:18:42 +00:00
|
|
|
; check yorp
|
|
|
|
; jsr check_yorp
|
|
|
|
|
2024-04-05 20:45:40 +00:00
|
|
|
; check item
|
2024-03-30 04:55:12 +00:00
|
|
|
jsr check_item
|
|
|
|
|
2024-04-05 20:45:40 +00:00
|
|
|
check_feet_tilex1:
|
|
|
|
inc INL
|
|
|
|
|
|
|
|
; check if going out door
|
|
|
|
jsr check_door
|
|
|
|
|
2024-04-06 06:18:42 +00:00
|
|
|
; check if touching fixed enemy
|
2024-04-05 20:45:40 +00:00
|
|
|
jsr check_enemy
|
2024-03-30 05:05:25 +00:00
|
|
|
|
2024-04-06 06:18:42 +00:00
|
|
|
; check yorp
|
|
|
|
; jsr check_yorp
|
|
|
|
|
2024-04-05 20:45:40 +00:00
|
|
|
; check items
|
2024-04-01 05:25:52 +00:00
|
|
|
jsr check_item
|
|
|
|
|
2024-04-06 06:18:42 +00:00
|
|
|
; rts ; FIXME: fallthrough
|
2024-04-05 20:45:40 +00:00
|
|
|
|
|
|
|
|
2024-03-10 05:44:20 +00:00
|
|
|
|
|
|
|
;==================
|
|
|
|
; check for items
|
|
|
|
;==================
|
2024-03-29 05:34:20 +00:00
|
|
|
|
2024-03-10 05:44:20 +00:00
|
|
|
check_item:
|
2024-04-05 20:45:40 +00:00
|
|
|
ldy #0
|
|
|
|
lda (INL),Y
|
2024-03-10 05:44:20 +00:00
|
|
|
|
2024-03-30 04:55:12 +00:00
|
|
|
do_check_item:
|
2024-03-18 05:16:13 +00:00
|
|
|
cmp #27
|
|
|
|
bcc done_check_item ; not an item
|
|
|
|
cmp #32
|
|
|
|
bcs done_check_item ; not an item
|
|
|
|
|
|
|
|
sec
|
|
|
|
sbc #27 ; subtract off to get index
|
|
|
|
|
|
|
|
; 0 = laser gun
|
|
|
|
; 1 = lollipop 100 pts
|
|
|
|
; 2 = book 1000 pts
|
|
|
|
; 3 = pizza 500 pts
|
|
|
|
; 4 = carbonated beverage 200 pts
|
|
|
|
; ? = bear 5000 pts
|
|
|
|
|
2024-03-20 05:40:58 +00:00
|
|
|
beq get_laser_gun
|
|
|
|
|
|
|
|
; otherwise look up points and add it
|
2024-03-18 05:16:13 +00:00
|
|
|
|
2024-04-05 20:45:40 +00:00
|
|
|
tax
|
|
|
|
lda score_lookup,X
|
2024-03-20 05:40:58 +00:00
|
|
|
jsr inc_score
|
|
|
|
jmp done_item_pickup
|
2024-03-18 05:16:13 +00:00
|
|
|
|
2024-03-20 05:40:58 +00:00
|
|
|
get_laser_gun:
|
2024-03-20 05:45:37 +00:00
|
|
|
lda RAYGUNS
|
|
|
|
clc
|
|
|
|
sed
|
|
|
|
adc #$05
|
|
|
|
sta RAYGUNS
|
|
|
|
cld
|
|
|
|
|
|
|
|
jmp done_item_pickup
|
2024-03-18 05:16:13 +00:00
|
|
|
|
2024-03-20 05:40:58 +00:00
|
|
|
; keycards go here too...
|
|
|
|
get_keycard:
|
|
|
|
|
|
|
|
done_item_pickup:
|
2024-03-18 05:16:13 +00:00
|
|
|
|
2024-04-05 20:45:40 +00:00
|
|
|
; erase big tilemap
|
2024-03-18 05:16:13 +00:00
|
|
|
|
|
|
|
lda #1 ; plain tile
|
2024-04-05 20:45:40 +00:00
|
|
|
sta (INL),Y
|
2024-03-10 05:44:20 +00:00
|
|
|
|
2024-04-05 20:45:40 +00:00
|
|
|
jsr copy_tilemap_subset
|
2024-03-18 05:16:13 +00:00
|
|
|
|
|
|
|
; play sound
|
2024-04-04 05:06:29 +00:00
|
|
|
ldy #SFX_GOTITEMSND
|
|
|
|
jsr play_sfx
|
2024-03-18 05:16:13 +00:00
|
|
|
|
2024-03-10 05:44:20 +00:00
|
|
|
|
|
|
|
done_check_item:
|
|
|
|
rts
|
2024-03-20 05:40:58 +00:00
|
|
|
|
2024-03-30 04:55:12 +00:00
|
|
|
;==========================
|
|
|
|
; check if feet at door
|
|
|
|
;==========================
|
|
|
|
check_door:
|
2024-04-05 20:45:40 +00:00
|
|
|
ldy #0
|
|
|
|
lda (INL),Y
|
2024-03-30 04:55:12 +00:00
|
|
|
cmp #11 ; door tile
|
|
|
|
bne done_check_door
|
|
|
|
|
|
|
|
at_door:
|
|
|
|
inc LEVEL_OVER
|
|
|
|
; TODO: mark level complete somehow
|
2024-04-04 05:06:29 +00:00
|
|
|
|
|
|
|
ldy #SFX_LVLDONESND
|
|
|
|
jsr play_sfx
|
|
|
|
|
|
|
|
|
2024-03-30 04:55:12 +00:00
|
|
|
done_check_door:
|
|
|
|
rts
|
2024-03-20 05:40:58 +00:00
|
|
|
|
2024-03-30 05:05:25 +00:00
|
|
|
|
|
|
|
|
|
|
|
;=============================
|
2024-04-06 06:18:42 +00:00
|
|
|
; check if touching enemy
|
2024-03-30 05:05:25 +00:00
|
|
|
;=============================
|
|
|
|
; level1 at least you can't touch with head?
|
|
|
|
check_enemy:
|
2024-04-05 20:45:40 +00:00
|
|
|
ldy #0
|
|
|
|
lda (INL),Y
|
2024-03-30 05:05:25 +00:00
|
|
|
cmp #21 ; green tentacles
|
|
|
|
beq touched_enemy
|
|
|
|
cmp #22 ; clam thing
|
|
|
|
bne done_check_enemy
|
|
|
|
|
|
|
|
touched_enemy:
|
2024-04-04 05:06:29 +00:00
|
|
|
|
2024-04-06 06:18:42 +00:00
|
|
|
; actual level over handled elsewhere
|
|
|
|
|
2024-04-06 03:56:13 +00:00
|
|
|
lda #TOUCHED_ENEMY
|
|
|
|
sta LEVEL_OVER
|
2024-04-04 05:06:29 +00:00
|
|
|
|
2024-04-06 06:18:42 +00:00
|
|
|
done_check_enemy:
|
|
|
|
rts
|
2024-04-04 05:06:29 +00:00
|
|
|
|
|
|
|
|
2024-04-06 06:18:42 +00:00
|
|
|
;==================================
|
|
|
|
; check if feet touching yorp head
|
|
|
|
;==================================
|
|
|
|
check_yorp:
|
2024-04-04 05:06:29 +00:00
|
|
|
|
2024-04-06 06:18:42 +00:00
|
|
|
ldx #0
|
|
|
|
check_yorp_loop:
|
|
|
|
lda enemy_data_out,X
|
|
|
|
beq no_yorp_stomp
|
|
|
|
|
|
|
|
lda enemy_data_state,X
|
|
|
|
cmp #YORP_STUNNED
|
|
|
|
beq no_yorp_stomp
|
|
|
|
|
|
|
|
lda enemy_data_tilex,X
|
|
|
|
cmp KEEN_TILEX
|
|
|
|
bne no_yorp_stomp
|
|
|
|
|
|
|
|
;==================
|
|
|
|
; K 0+1=1
|
|
|
|
; K Y
|
|
|
|
; Y
|
|
|
|
lda enemy_data_tiley,X
|
|
|
|
sec
|
|
|
|
sbc #1
|
|
|
|
cmp KEEN_TILEY
|
|
|
|
bne no_yorp_stomp
|
|
|
|
|
|
|
|
yes_yorp_stomp:
|
|
|
|
|
|
|
|
; this trashes X,Y
|
|
|
|
|
|
|
|
txa
|
|
|
|
pha
|
|
|
|
|
|
|
|
ldy #SFX_YORPBOPSND
|
|
|
|
jsr play_sfx
|
|
|
|
|
|
|
|
pla
|
|
|
|
tax
|
|
|
|
|
|
|
|
lda #YORP_STUNNED
|
|
|
|
sta enemy_data_state,X
|
|
|
|
|
|
|
|
lda #255
|
|
|
|
sta enemy_data_count,X
|
|
|
|
|
|
|
|
no_yorp_stomp:
|
|
|
|
|
|
|
|
inx
|
|
|
|
cpx #NUM_ENEMIES
|
|
|
|
bne check_yorp_loop
|
|
|
|
|
|
|
|
done_check_yorp:
|
2024-03-30 05:05:25 +00:00
|
|
|
rts
|
|
|
|
|
|
|
|
|
2024-04-06 06:18:42 +00:00
|
|
|
|
2024-03-20 05:40:58 +00:00
|
|
|
score_lookup:
|
|
|
|
.byte $00,$01,$10,$05,$02,$50 ; BCD
|
|
|
|
; 0 = laser gun
|
|
|
|
; 1 = lollipop 100 pts
|
|
|
|
; 2 = book 1000 pts
|
|
|
|
; 3 = pizza 500 pts
|
|
|
|
; 4 = carbonated beverage 200 pts
|
|
|
|
; ? = bear 5000 pts
|
2024-04-01 05:25:52 +00:00
|
|
|
|