Prev: 46183 Up: Map Next: 46217
46194: Play Sound From Object Number
Used by the routine at HandleTransformation.
Plays the warbling sound of the player turning into a wulf or back into a human. The number of cycles depends on the sprite number of the transformation.
Input
IX Address of the object
Work the number of cycles from the sprite number.
PlaySoundFromObjectNumber 46194 LD A,(IX+0) Fetch the graphic number of the object.
46197 RLCA Rotate it left three times.
46198 RLCA
46199 RLCA
46200 AND %00011000 Keep bits 3 and 4.
46202 ADD A,16 Add 16 to get the number of cycles.
46204 LD C,A Set C to the number of cycles.
PlaySoundFromObjectNumber_NextBeep 46205 LD A,C Fetch the cycle counter.
46206 XOR %01010101 Mix it up to get a wide range of pitches.
46208 ADD A,C Add the cycle counter again.
46209 LD B,A Set B to the pitch.
46210 CALL PlaySquareWave Play a single cycle of the tone.
46213 DEC C Decrease the cycle counter and loop back to PlaySoundFromObjectNumber_NextBeep until it is zero.
46214 JR NZ,PlaySoundFromObjectNumber_NextBeep
46216 RET Return.
View the equivalent code in;
Prev: 46183 Up: Map Next: 46217