mirror of
https://github.com/deater/dos33fsprogs.git
synced 2024-12-28 09:30:41 +00:00
266 lines
3.6 KiB
ArmAsm
266 lines
3.6 KiB
ArmAsm
;======================
|
|
; check touching things
|
|
;======================
|
|
; do head, than foot
|
|
|
|
check_items:
|
|
|
|
jsr check_yorp
|
|
|
|
;===================
|
|
; check head first
|
|
;===================
|
|
; if X==0, check TILEX and TILEX+1
|
|
; if X==1, check TILEX+1
|
|
|
|
clc
|
|
lda KEEN_TILEY
|
|
adc #>big_tilemap
|
|
sta INH
|
|
lda KEEN_TILEX
|
|
sta INL
|
|
|
|
lda KEEN_X
|
|
bne check_head_tilex1
|
|
|
|
;===================
|
|
; check head tilex
|
|
|
|
check_head_tilex:
|
|
; don't check door, only leave if feet at door
|
|
|
|
; check if touching enemy
|
|
jsr check_enemy
|
|
|
|
; check item
|
|
jsr check_item
|
|
|
|
check_head_tilex1:
|
|
inc INL
|
|
|
|
; don't check door, only leave if feet at door
|
|
|
|
; check if touching enemy
|
|
jsr check_enemy
|
|
|
|
; check items
|
|
jsr check_item
|
|
|
|
|
|
;========================
|
|
; 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 fixed enemy
|
|
jsr check_enemy
|
|
|
|
; check yorp
|
|
; jsr check_yorp
|
|
|
|
; check item
|
|
jsr check_item
|
|
|
|
check_feet_tilex1:
|
|
inc INL
|
|
|
|
; check if going out door
|
|
jsr check_door
|
|
|
|
; check if touching fixed enemy
|
|
jsr check_enemy
|
|
|
|
; check yorp
|
|
; jsr check_yorp
|
|
|
|
; check items
|
|
jsr check_item
|
|
|
|
; rts ; FIXME: fallthrough
|
|
|
|
|
|
|
|
;==================
|
|
; check for items
|
|
;==================
|
|
|
|
check_item:
|
|
ldy #0
|
|
lda (INL),Y
|
|
|
|
do_check_item:
|
|
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
|
|
|
|
beq get_laser_gun
|
|
|
|
; otherwise look up points and add it
|
|
|
|
tax
|
|
lda score_lookup,X
|
|
jsr inc_score
|
|
jmp done_item_pickup
|
|
|
|
get_laser_gun:
|
|
lda RAYGUNS
|
|
clc
|
|
sed
|
|
adc #$05
|
|
sta RAYGUNS
|
|
cld
|
|
|
|
jmp done_item_pickup
|
|
|
|
; keycards go here too...
|
|
get_keycard:
|
|
|
|
done_item_pickup:
|
|
|
|
; erase big tilemap
|
|
|
|
lda #1 ; plain tile
|
|
sta (INL),Y
|
|
|
|
jsr copy_tilemap_subset
|
|
|
|
; play sound
|
|
ldy #SFX_GOTITEMSND
|
|
jsr play_sfx
|
|
|
|
|
|
done_check_item:
|
|
rts
|
|
|
|
;==========================
|
|
; check if feet at door
|
|
;==========================
|
|
check_door:
|
|
ldy #0
|
|
lda (INL),Y
|
|
cmp #11 ; door tile
|
|
bne done_check_door
|
|
|
|
at_door:
|
|
inc LEVEL_OVER
|
|
; TODO: mark level complete somehow
|
|
|
|
ldy #SFX_LVLDONESND
|
|
jsr play_sfx
|
|
|
|
|
|
done_check_door:
|
|
rts
|
|
|
|
|
|
|
|
;=============================
|
|
; check if touching enemy
|
|
;=============================
|
|
; level1 at least you can't touch with head?
|
|
check_enemy:
|
|
ldy #0
|
|
lda (INL),Y
|
|
cmp #21 ; green tentacles
|
|
beq touched_enemy
|
|
cmp #22 ; clam thing
|
|
bne done_check_enemy
|
|
|
|
touched_enemy:
|
|
|
|
; actual level over handled elsewhere
|
|
|
|
lda #TOUCHED_ENEMY
|
|
sta LEVEL_OVER
|
|
|
|
done_check_enemy:
|
|
rts
|
|
|
|
|
|
;==================================
|
|
; check if feet touching yorp head
|
|
;==================================
|
|
check_yorp:
|
|
|
|
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:
|
|
rts
|
|
|
|
|
|
|
|
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
|
|
|