Prev: 59586 Up: Map Next: 59634
59601: If current character is in same room as target entity at IX then set pending sound to A
If the requested sound has a lower index than the sound already pending then the requested sound overrides the pending sound (i.e. lower index has higher priority).
This routine is used to ensure that certain sounds are only played when a given entity is in the current character's room. For example it will cause Drutt's hopping sound to play only when Drutt is in the same room as the current character.
Used by the routine at 48133.
Input
A Index of requested sound
IX Address of complex state data for target entity
59601 PUSH AF Store AF (A = index of requested sound)
59602 LD A,(34218) If current character's current room is the same as current room of target entity then skip ahead to 59612
59605 CP (IX+0)
59608 JR Z,59612
59610 POP AF Restore AF (A = index of requested sound)
59611 RET Return
59612 POP AF Restore AF (A = index of requested sound)
This entry point is used by the routines at 46284, 55196 and 59722.
At this point, A will hold the index of a requested sound, and RAM address 34273 will contain the index of a pending sound. If the index of the requested sound is lower than the index of the pending sound, then the pending sound's index at 34273 will be overwritten by the index of the requested sound in A. Sounds with lower indices therefore take priority over sounds with higher indices.
59613 OR A If index of requested sound is zero then return
59614 RET Z
59615 PUSH DE Load E with requested sound index
59616 LD E,A
59617 LD A,(34273) If index of pending sound is zero then skip ahead to 59628
59620 OR A
59621 JR Z,59628
Index of pending sound is not zero
59623 CP E If index of requested sound is less than or equal to index of pending sound then skip ahead to 59628
59624 JR NC,59628
59626 POP DE Return
59627 RET
Index of pending sound is zero
59628 LD A,E Set requested sound to be new pending sound
59629 LD (34273),A
59632 POP DE Return
59633 RET
Prev: 59586 Up: Map Next: 59634