2024-03-30 00:55:12 -04:00
|
|
|
;======================
|
|
|
|
; check touching things
|
|
|
|
;======================
|
|
|
|
; do head, than foot
|
2024-04-05 16:45:40 -04:00
|
|
|
|
2024-03-30 00:55:12 -04:00
|
|
|
check_items:
|
2024-03-30 01:05:25 -04:00
|
|
|
|
2024-04-05 16:45:40 -04:00
|
|
|
;===================
|
|
|
|
; check head first
|
|
|
|
;===================
|
|
|
|
; if X==0, check TILEX and TILEX+1
|
|
|
|
; if X==1, check TILEX+1
|
2024-03-30 01:05:25 -04:00
|
|
|
|
2024-04-05 16:45:40 -04:00
|
|
|
clc
|
|
|
|
lda KEEN_TILEY
|
|
|
|
adc #>big_tilemap
|
|
|
|
sta INH
|
|
|
|
lda KEEN_TILEX
|
|
|
|
sta INL
|
2024-03-30 00:55:12 -04:00
|
|
|
|
2024-04-05 16:45:40 -04:00
|
|
|
lda KEEN_X
|
|
|
|
bne check_head_tilex1
|
|
|
|
|
|
|
|
;===================
|
|
|
|
; check head tilex
|
2024-03-30 01:05:25 -04:00
|
|
|
|
2024-04-05 16:45:40 -04:00
|
|
|
check_head_tilex:
|
|
|
|
; don't check door, only leave if feet at door
|
|
|
|
|
|
|
|
; check if touching enemy
|
2024-03-30 01:05:25 -04:00
|
|
|
jsr check_enemy
|
|
|
|
|
2024-04-05 16:45:40 -04:00
|
|
|
; check item
|
|
|
|
jsr check_item
|
|
|
|
|
|
|
|
check_head_tilex1:
|
|
|
|
inc INL
|
|
|
|
|
|
|
|
; don't check door, only leave if feet at door
|
2024-03-30 01:05:25 -04:00
|
|
|
|
2024-04-05 16:45:40 -04:00
|
|
|
; check if touching enemy
|
|
|
|
jsr check_enemy
|
|
|
|
|
|
|
|
; check items
|
2024-04-01 01:25:52 -04:00
|
|
|
jsr check_item
|
2024-04-05 16:45:40 -04: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
|
|
|
|
|
|
|
|
; check if touching enemy
|
|
|
|
jsr check_enemy
|
|
|
|
|
|
|
|
; check item
|
2024-03-30 00:55:12 -04:00
|
|
|
jsr check_item
|
|
|
|
|
2024-04-05 16:45:40 -04:00
|
|
|
check_feet_tilex1:
|
|
|
|
inc INL
|
|
|
|
|
|
|
|
; check if going out door
|
|
|
|
jsr check_door
|
|
|
|
|
|
|
|
; check if touching enemy
|
|
|
|
jsr check_enemy
|
2024-03-30 01:05:25 -04:00
|
|
|
|
2024-04-05 16:45:40 -04:00
|
|
|
; check items
|
2024-04-01 01:25:52 -04:00
|
|
|
jsr check_item
|
|
|
|
|
2024-04-05 16:45:40 -04:00
|
|
|
rts ; FIXME: fallthrough
|
|
|
|
|
|
|
|
|
2024-03-10 00:44:20 -05:00
|
|
|
|
|
|
|
;==================
|
|
|
|
; check for items
|
|
|
|
;==================
|
2024-03-29 01:34:20 -04:00
|
|
|
|
2024-03-10 00:44:20 -05:00
|
|
|
check_item:
|
2024-04-05 16:45:40 -04:00
|
|
|
ldy #0
|
|
|
|
lda (INL),Y
|
2024-03-10 00:44:20 -05:00
|
|
|
|
2024-03-30 00:55:12 -04:00
|
|
|
do_check_item:
|
2024-03-18 01:16:13 -04: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 01:40:58 -04:00
|
|
|
beq get_laser_gun
|
|
|
|
|
|
|
|
; otherwise look up points and add it
|
2024-03-18 01:16:13 -04:00
|
|
|
|
2024-04-05 16:45:40 -04:00
|
|
|
tax
|
|
|
|
lda score_lookup,X
|
2024-03-20 01:40:58 -04:00
|
|
|
jsr inc_score
|
|
|
|
jmp done_item_pickup
|
2024-03-18 01:16:13 -04:00
|
|
|
|
2024-03-20 01:40:58 -04:00
|
|
|
get_laser_gun:
|
2024-03-20 01:45:37 -04:00
|
|
|
lda RAYGUNS
|
|
|
|
clc
|
|
|
|
sed
|
|
|
|
adc #$05
|
|
|
|
sta RAYGUNS
|
|
|
|
cld
|
|
|
|
|
|
|
|
jmp done_item_pickup
|
2024-03-18 01:16:13 -04:00
|
|
|
|
2024-03-20 01:40:58 -04:00
|
|
|
; keycards go here too...
|
|
|
|
get_keycard:
|
|
|
|
|
|
|
|
done_item_pickup:
|
2024-03-18 01:16:13 -04:00
|
|
|
|
2024-04-05 16:45:40 -04:00
|
|
|
; erase big tilemap
|
2024-03-18 01:16:13 -04:00
|
|
|
|
|
|
|
lda #1 ; plain tile
|
2024-04-05 16:45:40 -04:00
|
|
|
sta (INL),Y
|
2024-03-10 00:44:20 -05:00
|
|
|
|
2024-04-05 16:45:40 -04:00
|
|
|
jsr copy_tilemap_subset
|
2024-03-18 01:16:13 -04:00
|
|
|
|
|
|
|
; play sound
|
2024-04-04 01:06:29 -04:00
|
|
|
ldy #SFX_GOTITEMSND
|
|
|
|
jsr play_sfx
|
2024-03-18 01:16:13 -04:00
|
|
|
|
2024-03-10 00:44:20 -05:00
|
|
|
|
|
|
|
done_check_item:
|
|
|
|
rts
|
2024-03-20 01:40:58 -04:00
|
|
|
|
2024-03-30 00:55:12 -04:00
|
|
|
;==========================
|
|
|
|
; check if feet at door
|
|
|
|
;==========================
|
|
|
|
check_door:
|
2024-04-05 16:45:40 -04:00
|
|
|
ldy #0
|
|
|
|
lda (INL),Y
|
2024-03-30 00:55:12 -04:00
|
|
|
cmp #11 ; door tile
|
|
|
|
bne done_check_door
|
|
|
|
|
|
|
|
at_door:
|
|
|
|
inc LEVEL_OVER
|
|
|
|
; TODO: mark level complete somehow
|
2024-04-04 01:06:29 -04:00
|
|
|
|
|
|
|
ldy #SFX_LVLDONESND
|
|
|
|
jsr play_sfx
|
|
|
|
|
|
|
|
|
2024-03-30 00:55:12 -04:00
|
|
|
done_check_door:
|
|
|
|
rts
|
2024-03-20 01:40:58 -04:00
|
|
|
|
2024-03-30 01:05:25 -04:00
|
|
|
|
|
|
|
|
|
|
|
;=============================
|
|
|
|
; check if feet touching enemy
|
|
|
|
;=============================
|
|
|
|
; level1 at least you can't touch with head?
|
|
|
|
check_enemy:
|
2024-04-05 16:45:40 -04:00
|
|
|
ldy #0
|
|
|
|
lda (INL),Y
|
2024-03-30 01:05:25 -04:00
|
|
|
cmp #21 ; green tentacles
|
|
|
|
beq touched_enemy
|
|
|
|
cmp #22 ; clam thing
|
|
|
|
bne done_check_enemy
|
|
|
|
|
|
|
|
touched_enemy:
|
|
|
|
dec KEENS
|
|
|
|
inc LEVEL_OVER
|
2024-04-04 01:06:29 -04:00
|
|
|
|
|
|
|
|
|
|
|
ldy #SFX_KEENDIESND
|
|
|
|
jsr play_sfx
|
|
|
|
|
2024-03-30 01:05:25 -04:00
|
|
|
; TODO: ANIMATION
|
2024-04-04 01:06:29 -04:00
|
|
|
; keen turns to head, flies up screen
|
|
|
|
|
|
|
|
; play game over music if out of keens
|
|
|
|
|
|
|
|
lda KEENS
|
|
|
|
bpl done_check_enemy
|
|
|
|
|
|
|
|
ldy #SFX_GAMEOVERSND
|
|
|
|
jsr play_sfx
|
|
|
|
|
|
|
|
|
2024-03-30 01:05:25 -04:00
|
|
|
done_check_enemy:
|
|
|
|
rts
|
|
|
|
|
|
|
|
|
2024-03-20 01:40:58 -04: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 01:25:52 -04:00
|
|
|
|
2024-04-05 16:45:40 -04:00
|
|
|
.if 0
|
2024-04-01 01:25:52 -04:00
|
|
|
; bit of a hack
|
|
|
|
; TODO: auto-generate at startup
|
|
|
|
|
|
|
|
div20_table:
|
|
|
|
.byte 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0
|
|
|
|
.byte 1,1,1,1,1, 1,1,1,1,1, 1,1,1,1,1, 1,1,1,1,1
|
|
|
|
.byte 2,2,2,2,2, 2,2,2,2,2, 2,2,2,2,2, 2,2,2,2,2
|
|
|
|
.byte 3,3,3,3,3, 3,3,3,3,3, 3,3,3,3,3, 3,3,3,3,3
|
|
|
|
.byte 4,4,4,4,4, 4,4,4,4,4, 4,4,4,4,4, 4,4,4,4,4
|
|
|
|
.byte 5,5,5,5,5, 5,5,5,5,5, 5,5,5,5,5, 5,5,5,5,5
|
|
|
|
.byte 6,6,6,6,6, 6,6,6,6,6, 6,6,6,6,6, 6,6,6,6,6
|
|
|
|
.byte 7,7,7,7,7, 7,7,7,7,7, 7,7,7,7,7, 7,7,7,7,7
|
|
|
|
.byte 8,8,8,8,8, 8,8,8,8,8, 8,8,8,8,8, 8,8,8,8,8
|
|
|
|
.byte 9,9,9,9,9, 9,9,9,9,9, 9,9,9,9,9, 9,9,9,9,9
|
|
|
|
.byte 10,10,10,10,10, 10,10,10,10,10, 10,10,10,10,10, 10,10,10,10,10
|
|
|
|
.byte 11,11,11,11,11, 11,11,11,11,11, 11,11,11,11,11, 11,11,11,11,11
|
|
|
|
.byte 12,12,12,12,12, 12,12,12,12,12, 12,12,12,12,12 ;, 12,12,12,12,12
|
|
|
|
|
|
|
|
|
|
|
|
mod20_table:
|
|
|
|
.byte 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19
|
|
|
|
.byte 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19
|
|
|
|
.byte 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19
|
|
|
|
.byte 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19
|
|
|
|
.byte 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19
|
|
|
|
.byte 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19
|
|
|
|
.byte 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19
|
|
|
|
.byte 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19
|
|
|
|
.byte 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19
|
|
|
|
.byte 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19
|
|
|
|
.byte 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19
|
|
|
|
.byte 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19
|
|
|
|
.byte 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19
|
|
|
|
.byte 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15
|
|
|
|
|
2024-04-05 16:45:40 -04:00
|
|
|
.endif
|