Prev: 9965 Up: Map Next: 9A55
99EC: Shows the chatter - the alerts and remarks from the game's characters
Used by the routine at noise_effect.
print_chatter 99EC LD HL,($9630) Load current message set address
pc_loop 99EF LD A,(HL) Read a byte and advance
99F0 INC HL
$FC indicates a three-way random choice. Otherwise it's the index of the speaking character (1/2/3 for Nancy/Raymond/Tony) or 0 for the helicopter pilot.
99F1 CP $FC If byte != $FC then jump to pc_plot_character
99F3 JR NZ,pc_plot_character
We have a three-way choice here.
pc_random_choice 99F5 PUSH HL Preserve message data address
99F6 CALL rng Call rng - returns a random byte in A
99F9 POP HL Restore message data address
99FA CP $55 If random value < $55 jump to pc_load_message_ptr -- a 33.3% chance
99FC JR C,pc_load_message_ptr
99FE INC HL Skip first option message
99FF INC HL
9A00 CP $AA If random value < $AA jump to pc_load_message_ptr -- a 66.6% chance
9A02 JR C,pc_load_message_ptr
9A04 INC HL Skip second option message
9A05 INC HL
pc_load_message_ptr 9A06 LD A,(HL) Load the address of the chosen message set
9A07 INC HL
9A08 LD H,(HL)
9A09 LD L,A
9A0A JR pc_loop Loop back - it could be another random choice
A is the index of the face to show.
pc_plot_character 9A0C AND A Is it zero? (=> the pilot character's face)
9A0D PUSH HL Preserve message pointer
9A0E LD HL,($5CF2) Plot whatever face addrof_perp_mugshot_bitmap points to, otherwise calculate the face graphic's address
9A11 JR Z,pc_do_plot
9A13 LD B,A
9A14 LD HL,$7B35 Load base address of face graphics (BUT it's actually 180 bytes earlier than the real base because we're 1-indexed)
9A17 LD DE,$00B4 Length of face graphic (bitmap + attrs = 4*8*5 + 4*5)
pc_multiply 9A1A ADD HL,DE Get face graphic address
9A1B DJNZ pc_multiply
pc_do_plot 9A1D LD DE,$4036 Set plot address to (176,8)
9A20 CALL plot_face Call plot_face
9A23 POP HL Restore message pointer
This entry point is used by the routine at drive_chatter.
pc_chatter_message 9A24 LD E,(HL) Fetch address of message to start showing
9A25 INC HL
9A26 LD D,(HL)
9A27 INC HL
9A28 LD ($9630),HL Save current message set address
9A2B LD ($962E),DE Save next character address
9A2F XOR A Cause a clear_message_line and fall through
This entry point is used by the routine at drive_chatter. A is message_x.
pc_clear_line 9A30 PUSH AF If (A == 0) clear_message_line
9A31 AND A
9A32 CALL Z,clear_message_line
9A35 POP AF
9A36 LD HL,($962E) Fetch next_character
9A39 LD D,(HL) Load the character itself
9A3A RES 7,D Clear any string terminator bit
9A3C PUSH AF Preserve message_x
9A3D PUSH HL Preserve string address
9A3E CALL plot_mini_font_2 Call plot_mini_font_2, with D as ASCII character to plot
9A41 POP HL Restore string address
9A42 BIT 7,(HL) Test string terminator bit
9A44 INC HL Move to the next character in the string
9A45 JR Z,pc_exit If not terminated then jump over
9A47 LD A,$0A Set chatter_delay to 10
9A49 LD ($9633),A
pc_exit 9A4C POP AF Restore message_x
9A4D INC A Increment and store message_x
9A4E LD ($9632),A
9A51 LD ($962E),HL Update next_character
9A54 RET Return
Prev: 9965 Up: Map Next: 9A55