Prev: 30972 Up: Map Next: 31100
30989: Display a cutscene
Used by the routine at 31414. Displays a cutscene, and then enters demo mode or resumes the game in the next mode.
Input
A Cutscene message number
30989 LD (32722),A Store the cutscene message number at 32722 so that it can be monitored
30992 CALL 28357 Add the message to the message queue
30995 XOR A A=0
30996 LD (32713),A Set Sam's disguise ID (stored at 32713) to 0 (none)
30999 LD (32666),A Disconnect any phone call Sam may be making by setting 32666 to 0
31002 LD (32764),A Clear all of Sam's status flags at 32764
31005 CALL 63849 Update Sam's sprite and the disguise icon now that Sam's wearing no disguise
The loop that follows makes Sam pace up and down until the cutscene is over.
31008 LD HL,58889 Reset the midstride/mid-action timer in byte 9 of Sam's buffer
31011 XOR A
31012 LD (HL),A
31013 LD L,A L=0
31014 BIT 0,(HL) Is Sam midstride?
31016 JR Z,31058 Jump if not
31018 CALL 59848 Update the SRB for Sam's current animatory state and location
31021 DEC E Set E to Sam's next x-coordinate (immediately in front of him)
31022 BIT 7,A
31024 JR Z,31028
31026 INC E
31027 INC E
31028 INC A Set A to Sam's new animatory state
31029 AND 251
31031 CALL 59861 Update Sam's animatory state and location and update the SRB
31034 CALL 60521 Make a walking sound effect
31037 CALL 60032 Update the display
31040 CALL 28404 Update the message line
31043 LD HL,32712 32712 holds the value of the LSB of the system variable FRAMES as it was at the end of the last pass through the main loop (or this routine)
31046 LD A,(23672) Wait about 240ms
31049 SUB (HL)
31050 CP 12
31052 JR C,31046
31054 ADD A,(HL) Store the current value of the LSB of the system variable FRAMES at 32712 for comparison next time
31055 LD (HL),A
31056 JR 31008 Jump back to the beginning of this loop
Sam is not midstride at the moment.
31058 CALL 29668 Show or hide the fuse, door, light bulb or phone in the icon panel
31061 CALL 30972 Has the entire cutscene message been displayed yet?
31064 JP NZ,61630 Jump if so to end the cutscene
The cutscene is not over yet. Check whether Sam should turn round before pacing up or down again.
31067 LD HL,58881 Point HL at byte 1 of Sam's buffer
31070 LD A,(HL) A=Sam's x-coordinate
31071 DEC L L=0
31072 AND 7 Is Sam's x-coordinate exactly divisible by 8?
31074 JR NZ,31087 Jump if not
31076 BIT 7,(HL) Is Sam facing right?
31078 JR NZ,31095 Jump if so
31080 CALL 59848 Update the SRB for Sam's current animatory state and location
31083 XOR 128 Flip bit 7 of Sam's animatory state, thus turning him round
31085 JR 31031 Jump back to update Sam's animatory state and the SRB
31087 CP 5 Is Sam's x-coordinate congruent to 5 mod 8?
31089 JR NZ,31095 Jump if not
31091 BIT 7,(HL) Is Sam facing right?
31093 JR NZ,31080 Jump back to turn Sam round if so
31095 CALL 59848 Update the SRB for Sam's current animatory state and location
31098 JR 31028
Prev: 30972 Up: Map Next: 31100