Prev: D67D Up: Map Next: D965
D7D3: Update Bad Tempered Thing Dialogue
Used by the routine at GameStart.
Update_Bad_Tempered_Thing_Dialogue D7D3 LD A,($72C7) Load A with the Bad Tempered Thing state (BadTemperedThingState).
D7D6 CP $FF Is Bad Tempered Thing state equal to FF? If so, return.
D7D8 RET Z
D7D9 LD HL,$3C00 Point HL at CHARSET-0100.
D7DC LD ($72F9),HL Write the pointer in HL to the temporary screen pointer (Pointer_CurrentCharacterSet).
D7DF LD HL,$D7D2 Point HL at Bad Tempered Thing dialogue state (D7D2).
D7E2 INC (HL) Increment the Bad Tempered Thing dialogue counter at HL.
D7E3 LD HL,$D7CD Point HL at Bad Tempered Thing dialogue bytes (D7CD).
D7E6 LD A,($72C7) Load A with the Bad Tempered Thing state (BadTemperedThingState).
D7E9 OR A Is Bad Tempered Thing state zero? If so, jump to Update_Bad_Tempered_Thing_Dialogue_BerkHeldBit5.
D7EA JR Z,Update_Bad_Tempered_Thing_Dialogue_BerkHeldBit5
D7EC LD E,A Keep Bad Tempered Thing state in E for later.
D7ED LD A,($D7D2) Load A from D7D2.
D7F0 CP $32 Is Bad Tempered Thing state less than 32? If not, jump to Update_Bad_Tempered_Thing_Dialogue_ResetTickLayout.
D7F2 JR NC,Update_Bad_Tempered_Thing_Dialogue_ResetTickLayout
D7F4 BIT 0,(HL) Has this Bad Tempered Thing aside already been shown (bit 00 of D7CD)? If so, jump to Update_Bad_Tempered_Thing_Dialogue_PartH.
D7F6 JP NZ,Update_Bad_Tempered_Thing_Dialogue_PartH
D7F9 LD A,($72C7) Load A with the Bad Tempered Thing state (BadTemperedThingState).
D7FC CP $FE Is Bad Tempered Thing state equal to FE? If so, return.
D7FE RET Z
D7FF SET 0,(HL) Mark this Bad Tempered Thing aside as already shown (bit 00 of D7CD).
D801 CALL Clear_DialogueArea Call Clear_DialogueArea to clear Dialogue Area.
D804 LD B,E Copy the low byte from E into B (build a dialogue index).
D805 LD HL,$DD54 Point HL at dialogue string data (DD54).
Skip B dialogue fragments via Advance_DialogueCharacter, then start printing at Update_Bad_Tempered_Thing_Dialogue_PartB.
Update_Bad_Tempered_Thing_Dialogue_AdvanceChars D808 CALL Advance_DialogueCharacter Call Advance_DialogueCharacter to advance Dialogue Character.
D80B DJNZ Update_Bad_Tempered_Thing_Dialogue_AdvanceChars Decrease the loop counter in B and jump to Update_Bad_Tempered_Thing_Dialogue_AdvanceChars if more iterations remain.
D80D JP Update_Bad_Tempered_Thing_Dialogue_PartB Jump to Update_Bad_Tempered_Thing_Dialogue_PartB to continue Bad Tempered Thing dialogue.
When Berk is held (flags bit 05), either resume a mid-line print or open the task branch.
Update_Bad_Tempered_Thing_Dialogue_BerkHeldBit5 D810 LD IX,($8EE9) Load IX with Boney's complex entity state (StateData_Boney).
D814 BIT 5,(IX+$01) Is bit 05 of the current entity's flags byte 1 set? If not, jump to Update_Bad_Tempered_Thing_Dialogue_ResetTickLayout.
D818 JR Z,Update_Bad_Tempered_Thing_Dialogue_ResetTickLayout
D81A BIT 0,(HL) Has this Bad Tempered Thing aside already been shown (bit 00 of D7CD)? If so, jump to Update_Bad_Tempered_Thing_Dialogue_PartH.
D81C JP NZ,Update_Bad_Tempered_Thing_Dialogue_PartH
D81F LD A,($D7D2) Load A from D7D2.
D822 CP $32 Is Bad Tempered Thing state less than 32? If so, jump to Update_Bad_Tempered_Thing_Dialogue_Branch.
D824 JR C,Update_Bad_Tempered_Thing_Dialogue_Branch
Reset the dialogue tick, restore layout GraphicLayout_Boney (Boney), and clear the dialogue strip.
Update_Bad_Tempered_Thing_Dialogue_ResetTickLayout D826 XOR A Clear the Bad Tempered Thing dialogue tick.
D827 LD ($D7D2),A Set the Bad Tempered Thing dialogue state (D7D2).
D82A LD (HL),A Write Bad Tempered Thing state through DD54.
D82B DEC A Step Bad Tempered Thing state back by one.
D82C LD ($72C7),A Set the Bad Tempered Thing state (BadTemperedThingState).
D82F LD HL,$9C9E Point HL at GraphicLayout_Boney.
D832 LD ($8EF3),HL Write that layout pointer to Boney's graphic-layout field (Pointer_BoneyGraphicLayout).
D835 JP Clear_DialogueArea Jump to Clear_DialogueArea.
At dialogue state 06, clear the strip and pick task-01..04 (or menu) gate logic.
Update_Bad_Tempered_Thing_Dialogue_Branch D838 CP $06 Is Bad Tempered Thing state equal to 06? If not, return.
D83A RET NZ
D83B SET 0,(HL) Set bit 00 of GraphicLayout_Boney.
D83D CALL Clear_DialogueArea Call Clear_DialogueArea to clear Dialogue Area.
D840 LD A,($72AE) Load A with the current task index (CurrentTaskIndex).
D843 CP $01 Is current task index equal to 01? If so, jump to Update_Bad_Tempered_Thing_Dialogue_Task1Gates.
D845 JR Z,Update_Bad_Tempered_Thing_Dialogue_Task1Gates
D847 CP $02 Is current task index equal to 02? If so, jump to Update_Bad_Tempered_Thing_Dialogue_Task2Gates.
D849 JR Z,Update_Bad_Tempered_Thing_Dialogue_Task2Gates
D84B CP $03 Is current task index equal to 03? If so, jump to Update_Bad_Tempered_Thing_Dialogue_Task3Gates.
D84D JP Z,Update_Bad_Tempered_Thing_Dialogue_Task3Gates
D850 CP $04 Is current task index equal to 04? If so, jump to Update_Bad_Tempered_Thing_Dialogue_Task4Gates.
D852 JP Z,Update_Bad_Tempered_Thing_Dialogue_Task4Gates
D855 LD B,$01 Load B with 01 as a loop counter.
D857 LD A,($72B4) Load A with the task status flags (TaskStatusFlags).
D85A BIT 7,A Is bit 07 of task status flags set? If not, jump to Continue_Bad_Tempered_Thing_Dialogue.
D85C JP Z,Continue_Bad_Tempered_Thing_Dialogue
D85F INC B Advance the dialogue-check counter in B.
D860 JP Continue_Bad_Tempered_Thing_Dialogue Jump to Continue_Bad_Tempered_Thing_Dialogue.
Task 01 gates: empty slot StateData_Complex_20, collision count CollisionScratchByte, and door X choose the line index.
Update_Bad_Tempered_Thing_Dialogue_Task1Gates D863 LD B,$01 Load B with 01 as a loop counter.
D865 LD A,($9001) Load A with the type of complex entity slot 20 (StateData_Complex_20).
D868 OR A Is the type at StateData_Complex_20 non-zero? If so, jump to Continue_Bad_Tempered_Thing_Dialogue.
D869 JP NZ,Continue_Bad_Tempered_Thing_Dialogue
D86C INC B Advance the dialogue-check counter in B.
D86D LD A,($72BD) Load A with the collision scratch byte (CollisionScratchByte).
D870 OR A Is CollisionScratchByte non-zero? If so, jump to Update_Bad_Tempered_Thing_Dialogue_Task1CounterGates.
D871 JR NZ,Update_Bad_Tempered_Thing_Dialogue_Task1CounterGates
D873 LD IX,$902B Point IX at the worm-can entity (StateData_Complex_23).
D877 LD A,(IX+$07) Load A with the current entity's x-coordinate.
D87A CP $5E Is the current entity's x-coordinate less than 5E? If so, jump to Continue_Bad_Tempered_Thing_Dialogue.
D87C JP C,Continue_Bad_Tempered_Thing_Dialogue
D87F LD A,($72BD) Load A with the collision scratch byte (CollisionScratchByte).
Refine the task-01 line from how far CollisionScratchByte has progressed (zero / mid / 03).
Update_Bad_Tempered_Thing_Dialogue_Task1CounterGates D882 INC B Advance the dialogue-line index in B.
D883 OR A Is CollisionScratchByte zero? If so, jump to Continue_Bad_Tempered_Thing_Dialogue.
D884 JP Z,Continue_Bad_Tempered_Thing_Dialogue
D887 INC B Advance the dialogue-line index in B.
D888 CP $03 Is CollisionScratchByte equal to 03? If not, jump to Continue_Bad_Tempered_Thing_Dialogue.
D88A JP NZ,Continue_Bad_Tempered_Thing_Dialogue
D88D INC B Advance the dialogue-check counter in B.
D88E JP Continue_Bad_Tempered_Thing_Dialogue Jump to Continue_Bad_Tempered_Thing_Dialogue.
Task 02 gates: require the script-active flag and phase 02 before deeper checks.
Update_Bad_Tempered_Thing_Dialogue_Task2Gates D891 LD B,$01 Load B with 01 as a loop counter.
D893 LD A,($72B3) Load A with the game event flags (GameEventFlags).
D896 BIT 7,A Is bit 07 of game event flags set? If not, jump to Update_Bad_Tempered_Thing_Dialogue_Task2Creature.
D898 JR Z,Update_Bad_Tempered_Thing_Dialogue_Task2Creature
D89A LD A,($72AF) Load A with the current task phase (CurrentTaskPhase).
D89D CP $02 Is current task phase equal to 02? If not, jump to Continue_Bad_Tempered_Thing_Dialogue.
D89F JP NZ,Continue_Bad_Tempered_Thing_Dialogue
Task-02 pan X checks before looking at the spawn timer.
Update_Bad_Tempered_Thing_Dialogue_Task2Creature D8A2 INC B Advance the dialogue-check counter in B.
D8A3 LD A,($9055) Load A with the pan entity's type (StateData_Complex_26).
D8A6 OR A Is the type at StateData_Complex_26 zero? If so, jump to Update_Bad_Tempered_Thing_Dialogue_Task2SpawnZero.
D8A7 JR Z,Update_Bad_Tempered_Thing_Dialogue_Task2SpawnZero
D8A9 LD A,($905C) Load A from 905C.
D8AC CP $5E Is the byte at 905C less than 5E? If so, jump to Continue_Bad_Tempered_Thing_Dialogue.
D8AE JP C,Continue_Bad_Tempered_Thing_Dialogue
Task-02 spawn-timer zero path: only continue while the script-active flag is set.
Update_Bad_Tempered_Thing_Dialogue_Task2SpawnZero D8B1 INC B Advance the dialogue-check counter in B.
D8B2 LD A,($72C0) Load A with the entity spawn timer (EntitySpawnTimer).
D8B5 OR A Is entity spawn timer zero? If not, jump to Update_Bad_Tempered_Thing_Dialogue_Task2SpawnMatch.
D8B6 JR NZ,Update_Bad_Tempered_Thing_Dialogue_Task2SpawnMatch
D8B8 LD A,($72B3) Load A with the game event flags (GameEventFlags).
D8BB BIT 7,A Is bit 07 of game event flags set? If not, jump to Continue_Bad_Tempered_Thing_Dialogue.
D8BD JP Z,Continue_Bad_Tempered_Thing_Dialogue
Task-02 spawn-timer path: match RoomTransitionFlag and require timer 04 for the final line.
Update_Bad_Tempered_Thing_Dialogue_Task2SpawnMatch D8C0 INC B Advance the dialogue-check counter in B.
D8C1 LD A,($72C0) Load A with the entity spawn timer (EntitySpawnTimer).
D8C4 OR A Is entity spawn timer zero? If so, jump to Continue_Bad_Tempered_Thing_Dialogue.
D8C5 JP Z,Continue_Bad_Tempered_Thing_Dialogue
D8C8 INC B Advance the dialogue-check counter in B.
D8C9 LD C,A Keep entity spawn timer in C for later.
D8CA LD A,($72BF) Load A with the room-transition flag (RoomTransitionFlag).
D8CD CP C Does the room-transition flag equal the spawn timer in C? If not, jump to Continue_Bad_Tempered_Thing_Dialogue.
D8CE JP NZ,Continue_Bad_Tempered_Thing_Dialogue
D8D1 INC B Advance the dialogue-check counter in B.
D8D2 LD A,($72C0) Load A with the entity spawn timer (EntitySpawnTimer).
D8D5 CP $04 Is entity spawn timer equal to 04? If not, jump to Continue_Bad_Tempered_Thing_Dialogue.
D8D7 JP NZ,Continue_Bad_Tempered_Thing_Dialogue
D8DA INC B Advance the dialogue-check counter in B.
D8DB JP Continue_Bad_Tempered_Thing_Dialogue Jump to Continue_Bad_Tempered_Thing_Dialogue.
Task 03 gates: require the script-active flag and phase 03 before Slimy / stove checks.
Update_Bad_Tempered_Thing_Dialogue_Task3Gates D8DE LD B,$01 Load B with 01 as a loop counter.
D8E0 LD A,($72B3) Load A with the game event flags (GameEventFlags).
D8E3 BIT 7,A Is bit 07 of game event flags set? If not, jump to Update_Bad_Tempered_Thing_Dialogue_Task3CreatureFlags.
D8E5 JR Z,Update_Bad_Tempered_Thing_Dialogue_Task3CreatureFlags
D8E7 LD A,($72AF) Load A with the current task phase (CurrentTaskPhase).
D8EA CP $03 Is current task phase equal to 03? If not, jump to Continue_Bad_Tempered_Thing_Dialogue.
D8EC JP NZ,Continue_Bad_Tempered_Thing_Dialogue
Task-03 creature X and Slimies / SlimyLoose / StoveReady flags choose the line index.
Update_Bad_Tempered_Thing_Dialogue_Task3CreatureFlags D8EF INC B Advance the dialogue-check counter in B by two.
D8F0 INC B
D8F1 LD IX,$9063 Point IX at the cauldron entity (StateData_Complex_27).
D8F5 LD A,(IX+$07) Load A with the current entity's x-coordinate.
D8F8 CP $5E Is the current entity's x-coordinate less than 5E? If so, jump to Continue_Bad_Tempered_Thing_Dialogue.
D8FA JP C,Continue_Bad_Tempered_Thing_Dialogue
D8FD INC B Advance the dialogue-check counter in B.
D8FE LD HL,$72B6 Point HL at the task-three flags (TaskThreeFlags).
D901 BIT 1,(HL) Is Slimies (bit 01 of TaskThreeFlags) set? If not, jump to Continue_Bad_Tempered_Thing_Dialogue.
D903 JP Z,Continue_Bad_Tempered_Thing_Dialogue
D906 INC B Advance the dialogue-check counter in B.
D907 BIT 2,(HL) Is SlimyLoose (bit 02 of TaskThreeFlags) set? If so, jump to Continue_Bad_Tempered_Thing_Dialogue.
D909 JP NZ,Continue_Bad_Tempered_Thing_Dialogue
D90C INC B Advance the dialogue-check counter in B by two.
D90D INC B
D90E LD A,($72B3) Load A with the game event flags (GameEventFlags).
D911 BIT 7,A Is bit 07 of game event flags set? If not, jump to Update_Bad_Tempered_Thing_Dialogue_Task3FlagWalk.
D913 JR Z,Update_Bad_Tempered_Thing_Dialogue_Task3FlagWalk
D915 BIT 6,(HL) Is StoveReady (bit 06 of TaskThreeFlags) set? If not, jump to Continue_Bad_Tempered_Thing_Dialogue.
D917 JP Z,Continue_Bad_Tempered_Thing_Dialogue
Final task-03 gates: StoveReady, MobileHeater, and BoilEmUp must all be set.
Update_Bad_Tempered_Thing_Dialogue_Task3FlagWalk D91A INC B Advance the dialogue-check counter in B.
D91B BIT 6,(HL) Is StoveReady (bit 06 of TaskThreeFlags) set? If not, jump to Continue_Bad_Tempered_Thing_Dialogue.
D91D JP Z,Continue_Bad_Tempered_Thing_Dialogue
D920 INC B Advance the dialogue-check counter in B.
D921 BIT 0,(HL) Is MobileHeater (bit 00 of TaskThreeFlags) set? If not, jump to Continue_Bad_Tempered_Thing_Dialogue.
D923 JP Z,Continue_Bad_Tempered_Thing_Dialogue
D926 INC B Advance the dialogue-check counter in B.
D927 BIT 4,(HL) Is BoilEmUp (bit 04 of TaskThreeFlags) set? If not, jump to Continue_Bad_Tempered_Thing_Dialogue.
D929 JP Z,Continue_Bad_Tempered_Thing_Dialogue
D92C INC B Advance the dialogue-check counter in B.
D92D JP Continue_Bad_Tempered_Thing_Dialogue Jump to Continue_Bad_Tempered_Thing_Dialogue.
Task 04 gates: animation frame, interaction bits on EntityInteractionFlag, and phase 04 choose the line.
Update_Bad_Tempered_Thing_Dialogue_Task4Gates D930 LD B,$01 Load B with 01 as a loop counter.
D932 LD A,($72C1) Load A with the animation frame counter (AnimationFrameCounter).
D935 CP $03 Is animation frame counter equal to 03? If so, jump to Continue_Bad_Tempered_Thing_Dialogue.
D937 JP Z,Continue_Bad_Tempered_Thing_Dialogue
D93A INC B Advance the dialogue-check counter in B.
D93B LD HL,$72B9 Point HL at the entity interaction flag (EntityInteractionFlag).
D93E BIT 1,(HL) Is bit 01 of EntityInteractionFlag set? If not, jump to Continue_Bad_Tempered_Thing_Dialogue.
D940 JP Z,Continue_Bad_Tempered_Thing_Dialogue
D943 INC B Advance the dialogue-check counter in B.
D944 BIT 4,(HL) Is bit 04 of EntityInteractionFlag set? If not, jump to Continue_Bad_Tempered_Thing_Dialogue.
D946 JP Z,Continue_Bad_Tempered_Thing_Dialogue
D949 INC B Advance the dialogue-check counter in B.
D94A LD A,($72B3) Load A with the game event flags (GameEventFlags).
D94D BIT 7,A Is bit 07 of game event flags set? If not, jump to Continue_Bad_Tempered_Thing_Dialogue.
D94F JP Z,Continue_Bad_Tempered_Thing_Dialogue
D952 INC B Advance the dialogue-check counter in B.
D953 LD A,($72AF) Load A with the current task phase (CurrentTaskPhase).
D956 CP $04 Is current task phase equal to 04? If not, jump to Continue_Bad_Tempered_Thing_Dialogue.
D958 JP NZ,Continue_Bad_Tempered_Thing_Dialogue
D95B INC B Advance the dialogue-check counter in B.
D95C BIT 2,(HL) Is bit 02 of EntityInteractionFlag set? If so, jump to Continue_Bad_Tempered_Thing_Dialogue.
D95E JP NZ,Continue_Bad_Tempered_Thing_Dialogue
D961 INC B Advance the dialogue-check counter in B.
D962 JP Continue_Bad_Tempered_Thing_Dialogue Jump to Continue_Bad_Tempered_Thing_Dialogue.
Prev: D67D Up: Map Next: D965