![]() |
Routines |
| Prev: D965 | Up: Map | Next: DA23 |
|
Used by the routine at Update_Bad_Tempered_Thing_Dialogue.
Continuation of Update_Bad_Tempered_Thing_Dialogue after the dialogue table at Data_BadTemperedThingDialogue.
|
||||
| Continue_Bad_Tempered_Thing_Dialogue | D971 | LD A,($72AE) | Load A with the current task index (CurrentTaskIndex). | |
| D974 | OR A | Is A zero? If not, jump to Update_Bad_Tempered_Thing_Dialogue_IndexTable. | ||
| D975 | JR NZ,Update_Bad_Tempered_Thing_Dialogue_IndexTable | |||
| D977 | LD HL,$D7CD | Point HL at Bad Tempered Thing dialogue bytes (D7CD). | ||
| D97A | SET 0,(HL) | Mark this Bad Tempered Thing aside as already shown (bit 00 of D7CD). | ||
| D97C | LD HL,$DA66 | Point HL at Messaging: Task Menu Options (Messaging_WhatNext). | ||
| D97F | LD A,$06 | Load A with 06. | ||
| D981 | JR Update_Bad_Tempered_Thing_Dialogue_Hit | Jump to Update_Bad_Tempered_Thing_Dialogue_Hit to pick a random dialogue variant. | ||
|
Index the per-task dialogue table at Data_BadTemperedThingDialogue by the current task.
|
||||
| Update_Bad_Tempered_Thing_Dialogue_IndexTable | D983 | ADD A,A | Double A. | |
| D984 | LD E,A | Copy A into E for later use. | ||
| D985 | LD D,$00 | Clear D (high byte of a pointer/offset). | ||
| D987 | LD HL,$D965 | Point HL at the dialogue table (Data_BadTemperedThingDialogue). | ||
| D98A | ADD HL,DE | Add the offset in DE to the pointer in HL. | ||
| D98B | LD E,(HL) | Fetch the dialogue pointer into DE. | ||
| D98C | INC HL | |||
| D98D | LD D,(HL) | |||
| D98E | EX DE,HL | Swap the destination and source pointers in DE/HL. | ||
|
Skip join markers (&) and walk B fragments to the gated line.
|
||||
| Update_Bad_Tempered_Thing_Dialogue_SkipJoinMarkers | D98F | CALL Advance_DialogueCharacter | Call Advance_DialogueCharacter to advance Dialogue Character. | |
| D992 | CP $26 | Is A equal to 26? If so, jump to Update_Bad_Tempered_Thing_Dialogue_SkipJoinMarkers. | ||
| D994 | JR Z,Update_Bad_Tempered_Thing_Dialogue_SkipJoinMarkers | |||
| D996 | DJNZ Update_Bad_Tempered_Thing_Dialogue_SkipJoinMarkers | Decrease the loop counter in B and jump to Update_Bad_Tempered_Thing_Dialogue_SkipJoinMarkers if more iterations remain. | ||
|
If the gate byte is non-zero, decrement it and fall back to a random aside; else start Part A.
|
||||
| Update_Bad_Tempered_Thing_Dialogue_GateByteOrAside | D998 | LD A,(HL) | Fetch the byte at HL. | |
| D999 | OR A | Is A zero? If so, jump to Update_Bad_Tempered_Thing_Dialogue_PartA. | ||
| D99A | JR Z,Update_Bad_Tempered_Thing_Dialogue_PartA | |||
| D99C | DEC (HL) | Decrease the counter/flag byte at HL. | ||
| D99D | CALL Advance_DialogueCharacter | Call Advance_DialogueCharacter to advance Dialogue Character. | ||
| D9A0 | CP $26 | Is A equal to 26? If so, jump to Update_Bad_Tempered_Thing_Dialogue_GateByteOrAside. | ||
| D9A2 | JR Z,Update_Bad_Tempered_Thing_Dialogue_GateByteOrAside | |||
| D9A4 | LD HL,$D7CD | Point HL at Bad Tempered Thing dialogue bytes (D7CD). | ||
| D9A7 | SET 0,(HL) | Set bit 00 of D7CD (aside-already-shown). | ||
| D9A9 | LD HL,$DD1C | Point HL at DD1C. | ||
| D9AC | LD A,$04 | Load A with 04. | ||
|
Pick a random aside variant and skip that many fragments before printing.
|
||||
| Update_Bad_Tempered_Thing_Dialogue_Hit | D9AE | CALL PseudoRandom | Call PseudoRandom to pick a pseudo-random value. | |
| D9B1 | INC A | Turn the random roll into a 01-based skip count. | ||
| D9B2 | LD B,A | Copy A into B for later use. | ||
|
Consume the remaining skip count via Advance_DialogueCharacter, then enter the print setup at Update_Bad_Tempered_Thing_Dialogue_PartB.
|
||||
| Update_Bad_Tempered_Thing_Dialogue_Exit | D9B3 | CALL Advance_DialogueCharacter | Call Advance_DialogueCharacter to advance Dialogue Character. | |
| D9B6 | DJNZ Update_Bad_Tempered_Thing_Dialogue_Exit | Decrease the loop counter in B and jump to Update_Bad_Tempered_Thing_Dialogue_Exit if more iterations remain. | ||
| D9B8 | JR Update_Bad_Tempered_Thing_Dialogue_PartB | Jump to Update_Bad_Tempered_Thing_Dialogue_PartB to continue Bad Tempered Thing dialogue. | ||
|
Seed a fresh random gate byte (01..03) when the previous gate hit zero.
|
||||
| Update_Bad_Tempered_Thing_Dialogue_PartA | D9BA | LD A,$03 | Load A with 03. | |
| D9BC | CALL PseudoRandom | Call PseudoRandom to pick a pseudo-random value. | ||
| D9BF | INC A | Turn the random roll into a 01-based gate value. | ||
| D9C0 | LD (HL),A | Set the byte at HL. | ||
| D9C1 | INC HL | Advance past the freshly written gate byte. | ||
|
This entry point is used by the routine at Update_Bad_Tempered_Thing_Dialogue.
Stash the dialogue string pointer and begin measuring the fragment length.
|
||||
| Update_Bad_Tempered_Thing_Dialogue_PartB | D9C2 | PUSH HL | Stash HL on the stack. | |
| D9C3 | LD E,$00 | Load E with 00. | ||
|
Count characters until a fragment ([) or join (&) marker.
|
||||
| Update_Bad_Tempered_Thing_Dialogue_PartC | D9C5 | LD A,(HL) | Fetch the byte at HL. | |
| D9C6 | CP $5B | Is A equal to 5B? If so, jump to Update_Bad_Tempered_Thing_Dialogue_PartD. | ||
| D9C8 | JR Z,Update_Bad_Tempered_Thing_Dialogue_PartD | |||
| D9CA | CP $26 | Is A equal to 26? If so, jump to Update_Bad_Tempered_Thing_Dialogue_PartD. | ||
| D9CC | JR Z,Update_Bad_Tempered_Thing_Dialogue_PartD | |||
| D9CE | INC E | Advance the low byte of the pointer/offset in DE. | ||
| D9CF | INC HL | Advance through the dialogue fragment. | ||
| D9D0 | JR Update_Bad_Tempered_Thing_Dialogue_PartC | Jump to Update_Bad_Tempered_Thing_Dialogue_PartC to fetch the next dialogue byte. | ||
|
Compute left padding so the line centres within the 17-character dialogue strip.
|
||||
| Update_Bad_Tempered_Thing_Dialogue_PartD | D9D2 | LD A,$17 | Load A with 17. | |
| D9D4 | SUB E | Subtract E from A. | ||
| D9D5 | JR NC,Update_Bad_Tempered_Thing_Dialogue_PartE | If no borrow/miss was signaled, jump to Update_Bad_Tempered_Thing_Dialogue_PartE. | ||
| D9D7 | XOR A | Clear A to 00. | ||
|
Halve that padding, restore the string pointer into IX, and aim HL at 5AC1 (attribute buffer).
|
||||
| Update_Bad_Tempered_Thing_Dialogue_PartE | D9D8 | SRL A | Shift the flag/value in A right one bit. | |
| D9DA | POP IX | Pop the dialogue string pointer into IX. | ||
| D9DC | LD HL,$5AC1 | Load HL with 5AC1 (attribute buffer). | ||
| D9DF | LD E,A | Copy A into E for later use. | ||
| D9E0 | LD D,$00 | Clear D (high byte of a pointer/offset). | ||
| D9E2 | ADD HL,DE | Add the offset in DE to the pointer in HL. | ||
|
|
||||
| Update_Bad_Tempered_Thing_Dialogue_PartF | D9E3 | LD E,(IX+$00) | Load E with the next dialogue character code from *(IX). | |
| D9E6 | LD D,$00 | Clear D (high byte of a pointer/offset). | ||
| D9E8 | CALL Draw_DialogueCharacter | Call Draw_DialogueCharacter to draw Dialogue Character. | ||
| D9EB | INC IX | Advance the dialogue source pointer by one character. | ||
| D9ED | INC HL | Advance the attribute-file destination by one column. | ||
| D9EE | LD ($D7CE),IX | Store IX in D7CE. | ||
| D9F2 | LD ($D7D0),HL | Store HL in D7D0. | ||
| D9F5 | LD A,(IX+$00) | Fetch the next dialogue byte from *(IX). | ||
| D9F8 | CP $5B | Is A equal to 5B? If so, jump to Update_Bad_Tempered_Thing_Dialogue_PartG. | ||
| D9FA | JR Z,Update_Bad_Tempered_Thing_Dialogue_PartG | |||
| D9FC | CP $26 | Is A equal to 26? If not, return. | ||
| D9FE | RET NZ | |||
|
End of line: clear the aside-shown bit, restore Berk's layout, and arm the FE cooldown.
|
||||
| Update_Bad_Tempered_Thing_Dialogue_PartG | D9FF | LD HL,$D7CD | Point HL at Bad Tempered Thing dialogue bytes (D7CD). | |
| DA02 | RES 0,(HL) | Clear bit 00 of D7CD (aside-already-shown). | ||
| DA04 | LD HL,$9C9E | Point HL at GraphicLayout_Boney. | ||
| DA07 | LD ($8EF3),HL | Write that layout pointer to Boney's graphic-layout field (Pointer_BoneyGraphicLayout). | ||
| DA0A | LD A,($72C7) | Load A with the Bad Tempered Thing state (BadTemperedThingState). | ||
| DA0D | OR A | Is A zero? If so, return. | ||
| DA0E | RET Z | |||
| DA0F | LD A,$FE | Load A with FE. | ||
| DA11 | LD ($72C7),A | Set the Bad Tempered Thing state (BadTemperedThingState). | ||
| DA14 | LD A,$2F | Load A with 2F. | ||
| DA16 | LD ($D7D2),A | Set the Bad Tempered Thing dialogue state (D7D2). | ||
| DA19 | RET | Return. | ||
|
This entry point is used by the routine at Update_Bad_Tempered_Thing_Dialogue.
|
||||
| Update_Bad_Tempered_Thing_Dialogue_PartH | DA1A | LD IX,($D7CE) | Load IX from D7CE. | |
| DA1E | LD HL,($D7D0) | Load HL from D7D0. | ||
| DA21 | JR Update_Bad_Tempered_Thing_Dialogue_PartF | Jump to Update_Bad_Tempered_Thing_Dialogue_PartF to reload the entity type for dialogue. | ||
| Prev: D965 | Up: Map | Next: DA23 |