Prev: CD66 Up: Map Next: CDD7
CD88: Deal with creature in room - create footstep sounds and check for missile collisions
Used by the routine at C89F.
Play/trigger sounds for creature footsteps and check if any creatures are being destroyed by Maroc's spells or servant-wielded weapons.
Trigger footstep sound effect (for certain creatures):
CD88 LD A,($EC9C) Check FREEZE spell timer counter
CD8B CP $00
CD8D JR NZ,$CDA6 If it's > 0, the FREEZE spell is still in place so skip the footsteps check
Create short intervals between footsteps
CD8F LD A,($EAAA) Game timer
CD92 AND $03 Check if either bit 0 or 1 are set
CD94 JR NZ,$CDA6 If so, skip the footstep sounds (this creates a short interval in the sound, to mimic a footstep effect)
Check creature type (EB46). Prepare footstep sound effects for Guardian of Chaos (creature type = 8), goblin warrior (9), and goblin missile thrower (10).
Warlocks (1-7), wraiths (11) and demons (12) make no sound when they move.
CD96 LD A,($EB46) Check creature type number
CD99 CP $08
CD9B JR C,$CDA6 Creature number < 8 - warlock
CD9D CP $0B
CD9F JR NC,$CDA6 Creature number >= 11 - a wraith or a demon
CDA1 LD A,$10 If the creature type is 8, 9, or 10, set the byte at EB56 to start with the speaker bit on (bit 4).
CDA3 LD ($EB56),A
Copy the 8 bytes of data for this creature type at 6C7C/6CB4 into working creature data buffer at EBA5, along with a couple of other bytes:
CDA6 LD HL,($EB44) Pointer to data set at 6C7C/6CB4
CDA9 LD BC,$0008 Copy 8 bytes to creature data buffer at EBA5
CDAC LD DE,$EBA5
CDAF LDIR
CDB1 LD A,($EBA5) Creature attribute/colour byte - first byte of current creature set at 6CB4
CDB4 LD ($EAA8),A Copy into room item working data buffer
Check if any creatures have been destroyed (e.g. by a missile fired by Maroc)
CDB7 LD A,($EB4E) Item (creature) properties byte
CDBA LD C,A Temp store in C register
CDBB AND $E0 Check top 3 bits (bits 5-7)
If any of these are set, it means the creature is disintegrating or materializing
CDBD JP NZ,$CF99 If so, don't run any more checks for this creature - skip out of this routine
CDC0 LD A,C Retrieve item/creature properties byte
CDC1 AND $01 Check bit 0 - if set, it means the creature is on-screen/visible
CDC3 JR Z,$CDD7 Skip the next instructions if creature isn't visible on-screen as creatures need to be on-screen to be destroyed by missiles etc.
Run collision checks for Maroc's spells vs creatures
CDC5 LD A,($EBA9) Collision/event check type (wraiths/demons = 7, other creatures = 3)
This indicates which spells or weapons can destroy these sorts of creature
For warlocks this is a value matching the missile/bolt type that destroys them (from byte 5 in the warlock table at 6C7C)
CDC8 LD C,A Store in C register, which is used as the event value to check in the following CALL
CDC9 CALL $DFCD Check if Maroc has destroyed a creature with a missile/bolt or wraithbane
CDCC CP $00 The A register is returned with 0 (no collision) or 1 (positive collision detected)
CDCE JP NZ,$D07C Positive collision (flag = 1), e.g. a wraith touching Maroc while WRAITHBANE is active, or a missile hitting a creature that it destroys - so destroy the creature.
CDD1 LD A,($EBAA) Otherwise get event/collision value for for creatures opening/closing doors (17)
CDD4 CALL $E2B0 ...and add this to the collision/event set in the table at 7FB3 ready for checking next game cycle
Prev: CD66 Up: Map Next: CDD7