Prev: 54909 Up: Map Next: 55653
55251: Update Bad Tempered Thing Dialogue
Used by the routine at GameStart.
Update_Bad_Tempered_Thing_Dialogue 55251 LD A,(29383) Load A with the Bad Tempered Thing state (BadTemperedThingState).
55254 CP 255 Is Bad Tempered Thing state equal to 255? If so, return.
55256 RET Z
55257 LD HL,15360 Point HL at CHARSET-256.
55260 LD (29433),HL Write the pointer in HL to the temporary screen pointer (Pointer_CurrentCharacterSet).
55263 LD HL,55250 Point HL at Bad Tempered Thing dialogue state (55250).
55266 INC (HL) Increment the Bad Tempered Thing dialogue counter at HL.
55267 LD HL,55245 Point HL at Bad Tempered Thing dialogue bytes (55245).
55270 LD A,(29383) Load A with the Bad Tempered Thing state (BadTemperedThingState).
55273 OR A Is Bad Tempered Thing state zero? If so, jump to Update_Bad_Tempered_Thing_Dialogue_BerkHeldBit5.
55274 JR Z,Update_Bad_Tempered_Thing_Dialogue_BerkHeldBit5
55276 LD E,A Keep Bad Tempered Thing state in E for later.
55277 LD A,(55250) Load A from 55250.
55280 CP 50 Is Bad Tempered Thing state less than 50? If not, jump to Update_Bad_Tempered_Thing_Dialogue_ResetTickLayout.
55282 JR NC,Update_Bad_Tempered_Thing_Dialogue_ResetTickLayout
55284 BIT 0,(HL) Has this Bad Tempered Thing aside already been shown (bit 0 of 55245)? If so, jump to Update_Bad_Tempered_Thing_Dialogue_PartH.
55286 JP NZ,Update_Bad_Tempered_Thing_Dialogue_PartH
55289 LD A,(29383) Load A with the Bad Tempered Thing state (BadTemperedThingState).
55292 CP 254 Is Bad Tempered Thing state equal to 254? If so, return.
55294 RET Z
55295 SET 0,(HL) Mark this Bad Tempered Thing aside as already shown (bit 0 of 55245).
55297 CALL Clear_DialogueArea Call Clear_DialogueArea to clear Dialogue Area.
55300 LD B,E Copy the low byte from E into B (build a dialogue index).
55301 LD HL,56660 Point HL at dialogue string data (56660).
Skip B dialogue fragments via Advance_DialogueCharacter, then start printing at Update_Bad_Tempered_Thing_Dialogue_PartB.
Update_Bad_Tempered_Thing_Dialogue_AdvanceChars 55304 CALL Advance_DialogueCharacter Call Advance_DialogueCharacter to advance Dialogue Character.
55307 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.
55309 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 5), either resume a mid-line print or open the task branch.
Update_Bad_Tempered_Thing_Dialogue_BerkHeldBit5 55312 LD IX,(36585) Load IX with Boney's complex entity state (StateData_Boney).
55316 BIT 5,(IX+1) Is bit 5 of the current entity's flags byte 1 set? If not, jump to Update_Bad_Tempered_Thing_Dialogue_ResetTickLayout.
55320 JR Z,Update_Bad_Tempered_Thing_Dialogue_ResetTickLayout
55322 BIT 0,(HL) Has this Bad Tempered Thing aside already been shown (bit 0 of 55245)? If so, jump to Update_Bad_Tempered_Thing_Dialogue_PartH.
55324 JP NZ,Update_Bad_Tempered_Thing_Dialogue_PartH
55327 LD A,(55250) Load A from 55250.
55330 CP 50 Is Bad Tempered Thing state less than 50? If so, jump to Update_Bad_Tempered_Thing_Dialogue_Branch.
55332 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 55334 XOR A Clear the Bad Tempered Thing dialogue tick.
55335 LD (55250),A Set the Bad Tempered Thing dialogue state (55250).
55338 LD (HL),A Write Bad Tempered Thing state through 56660.
55339 DEC A Step Bad Tempered Thing state back by one.
55340 LD (29383),A Set the Bad Tempered Thing state (BadTemperedThingState).
55343 LD HL,40094 Point HL at GraphicLayout_Boney.
55346 LD (36595),HL Write that layout pointer to Boney's graphic-layout field (Pointer_BoneyGraphicLayout).
55349 JP Clear_DialogueArea Jump to Clear_DialogueArea.
At dialogue state 6, clear the strip and pick task-1..4 (or menu) gate logic.
Update_Bad_Tempered_Thing_Dialogue_Branch 55352 CP 6 Is Bad Tempered Thing state equal to 6? If not, return.
55354 RET NZ
55355 SET 0,(HL) Set bit 0 of GraphicLayout_Boney.
55357 CALL Clear_DialogueArea Call Clear_DialogueArea to clear Dialogue Area.
55360 LD A,(29358) Load A with the current task index (CurrentTaskIndex).
55363 CP 1 Is current task index equal to 1? If so, jump to Update_Bad_Tempered_Thing_Dialogue_Task1Gates.
55365 JR Z,Update_Bad_Tempered_Thing_Dialogue_Task1Gates
55367 CP 2 Is current task index equal to 2? If so, jump to Update_Bad_Tempered_Thing_Dialogue_Task2Gates.
55369 JR Z,Update_Bad_Tempered_Thing_Dialogue_Task2Gates
55371 CP 3 Is current task index equal to 3? If so, jump to Update_Bad_Tempered_Thing_Dialogue_Task3Gates.
55373 JP Z,Update_Bad_Tempered_Thing_Dialogue_Task3Gates
55376 CP 4 Is current task index equal to 4? If so, jump to Update_Bad_Tempered_Thing_Dialogue_Task4Gates.
55378 JP Z,Update_Bad_Tempered_Thing_Dialogue_Task4Gates
55381 LD B,1 Load B with 1 as a loop counter.
55383 LD A,(29364) Load A with the task status flags (TaskStatusFlags).
55386 BIT 7,A Is bit 7 of task status flags set? If not, jump to Continue_Bad_Tempered_Thing_Dialogue.
55388 JP Z,Continue_Bad_Tempered_Thing_Dialogue
55391 INC B Advance the dialogue-check counter in B.
55392 JP Continue_Bad_Tempered_Thing_Dialogue Jump to Continue_Bad_Tempered_Thing_Dialogue.
Task 1 gates: empty slot StateData_Complex_20, collision count CollisionScratchByte, and door X choose the line index.
Update_Bad_Tempered_Thing_Dialogue_Task1Gates 55395 LD B,1 Load B with 1 as a loop counter.
55397 LD A,(36865) Load A with the type of complex entity slot 32 (StateData_Complex_20).
55400 OR A Is the type at StateData_Complex_20 non-zero? If so, jump to Continue_Bad_Tempered_Thing_Dialogue.
55401 JP NZ,Continue_Bad_Tempered_Thing_Dialogue
55404 INC B Advance the dialogue-check counter in B.
55405 LD A,(29373) Load A with the collision scratch byte (CollisionScratchByte).
55408 OR A Is CollisionScratchByte non-zero? If so, jump to Update_Bad_Tempered_Thing_Dialogue_Task1CounterGates.
55409 JR NZ,Update_Bad_Tempered_Thing_Dialogue_Task1CounterGates
55411 LD IX,36907 Point IX at the worm-can entity (StateData_Complex_23).
55415 LD A,(IX+7) Load A with the current entity's x-coordinate.
55418 CP 94 Is the current entity's x-coordinate less than 94? If so, jump to Continue_Bad_Tempered_Thing_Dialogue.
55420 JP C,Continue_Bad_Tempered_Thing_Dialogue
55423 LD A,(29373) Load A with the collision scratch byte (CollisionScratchByte).
Refine the task-1 line from how far CollisionScratchByte has progressed (zero / mid / 3).
Update_Bad_Tempered_Thing_Dialogue_Task1CounterGates 55426 INC B Advance the dialogue-line index in B.
55427 OR A Is CollisionScratchByte zero? If so, jump to Continue_Bad_Tempered_Thing_Dialogue.
55428 JP Z,Continue_Bad_Tempered_Thing_Dialogue
55431 INC B Advance the dialogue-line index in B.
55432 CP 3 Is CollisionScratchByte equal to 3? If not, jump to Continue_Bad_Tempered_Thing_Dialogue.
55434 JP NZ,Continue_Bad_Tempered_Thing_Dialogue
55437 INC B Advance the dialogue-check counter in B.
55438 JP Continue_Bad_Tempered_Thing_Dialogue Jump to Continue_Bad_Tempered_Thing_Dialogue.
Task 2 gates: require the script-active flag and phase 2 before deeper checks.
Update_Bad_Tempered_Thing_Dialogue_Task2Gates 55441 LD B,1 Load B with 1 as a loop counter.
55443 LD A,(29363) Load A with the game event flags (GameEventFlags).
55446 BIT 7,A Is bit 7 of game event flags set? If not, jump to Update_Bad_Tempered_Thing_Dialogue_Task2Creature.
55448 JR Z,Update_Bad_Tempered_Thing_Dialogue_Task2Creature
55450 LD A,(29359) Load A with the current task phase (CurrentTaskPhase).
55453 CP 2 Is current task phase equal to 2? If not, jump to Continue_Bad_Tempered_Thing_Dialogue.
55455 JP NZ,Continue_Bad_Tempered_Thing_Dialogue
Task-2 pan X checks before looking at the spawn timer.
Update_Bad_Tempered_Thing_Dialogue_Task2Creature 55458 INC B Advance the dialogue-check counter in B.
55459 LD A,(36949) Load A with the pan entity's type (StateData_Complex_26).
55462 OR A Is the type at StateData_Complex_26 zero? If so, jump to Update_Bad_Tempered_Thing_Dialogue_Task2SpawnZero.
55463 JR Z,Update_Bad_Tempered_Thing_Dialogue_Task2SpawnZero
55465 LD A,(36956) Load A from 36956.
55468 CP 94 Is the byte at 36956 less than 94? If so, jump to Continue_Bad_Tempered_Thing_Dialogue.
55470 JP C,Continue_Bad_Tempered_Thing_Dialogue
Task-2 spawn-timer zero path: only continue while the script-active flag is set.
Update_Bad_Tempered_Thing_Dialogue_Task2SpawnZero 55473 INC B Advance the dialogue-check counter in B.
55474 LD A,(29376) Load A with the entity spawn timer (EntitySpawnTimer).
55477 OR A Is entity spawn timer zero? If not, jump to Update_Bad_Tempered_Thing_Dialogue_Task2SpawnMatch.
55478 JR NZ,Update_Bad_Tempered_Thing_Dialogue_Task2SpawnMatch
55480 LD A,(29363) Load A with the game event flags (GameEventFlags).
55483 BIT 7,A Is bit 7 of game event flags set? If not, jump to Continue_Bad_Tempered_Thing_Dialogue.
55485 JP Z,Continue_Bad_Tempered_Thing_Dialogue
Task-2 spawn-timer path: match RoomTransitionFlag and require timer 4 for the final line.
Update_Bad_Tempered_Thing_Dialogue_Task2SpawnMatch 55488 INC B Advance the dialogue-check counter in B.
55489 LD A,(29376) Load A with the entity spawn timer (EntitySpawnTimer).
55492 OR A Is entity spawn timer zero? If so, jump to Continue_Bad_Tempered_Thing_Dialogue.
55493 JP Z,Continue_Bad_Tempered_Thing_Dialogue
55496 INC B Advance the dialogue-check counter in B.
55497 LD C,A Keep entity spawn timer in C for later.
55498 LD A,(29375) Load A with the room-transition flag (RoomTransitionFlag).
55501 CP C Does the room-transition flag equal the spawn timer in C? If not, jump to Continue_Bad_Tempered_Thing_Dialogue.
55502 JP NZ,Continue_Bad_Tempered_Thing_Dialogue
55505 INC B Advance the dialogue-check counter in B.
55506 LD A,(29376) Load A with the entity spawn timer (EntitySpawnTimer).
55509 CP 4 Is entity spawn timer equal to 4? If not, jump to Continue_Bad_Tempered_Thing_Dialogue.
55511 JP NZ,Continue_Bad_Tempered_Thing_Dialogue
55514 INC B Advance the dialogue-check counter in B.
55515 JP Continue_Bad_Tempered_Thing_Dialogue Jump to Continue_Bad_Tempered_Thing_Dialogue.
Task 3 gates: require the script-active flag and phase 3 before Slimy / stove checks.
Update_Bad_Tempered_Thing_Dialogue_Task3Gates 55518 LD B,1 Load B with 1 as a loop counter.
55520 LD A,(29363) Load A with the game event flags (GameEventFlags).
55523 BIT 7,A Is bit 7 of game event flags set? If not, jump to Update_Bad_Tempered_Thing_Dialogue_Task3CreatureFlags.
55525 JR Z,Update_Bad_Tempered_Thing_Dialogue_Task3CreatureFlags
55527 LD A,(29359) Load A with the current task phase (CurrentTaskPhase).
55530 CP 3 Is current task phase equal to 3? If not, jump to Continue_Bad_Tempered_Thing_Dialogue.
55532 JP NZ,Continue_Bad_Tempered_Thing_Dialogue
Task-3 creature X and Slimies / SlimyLoose / StoveReady flags choose the line index.
Update_Bad_Tempered_Thing_Dialogue_Task3CreatureFlags 55535 INC B Advance the dialogue-check counter in B by two.
55536 INC B
55537 LD IX,36963 Point IX at the cauldron entity (StateData_Complex_27).
55541 LD A,(IX+7) Load A with the current entity's x-coordinate.
55544 CP 94 Is the current entity's x-coordinate less than 94? If so, jump to Continue_Bad_Tempered_Thing_Dialogue.
55546 JP C,Continue_Bad_Tempered_Thing_Dialogue
55549 INC B Advance the dialogue-check counter in B.
55550 LD HL,29366 Point HL at the task-three flags (TaskThreeFlags).
55553 BIT 1,(HL) Is Slimies (bit 1 of TaskThreeFlags) set? If not, jump to Continue_Bad_Tempered_Thing_Dialogue.
55555 JP Z,Continue_Bad_Tempered_Thing_Dialogue
55558 INC B Advance the dialogue-check counter in B.
55559 BIT 2,(HL) Is SlimyLoose (bit 2 of TaskThreeFlags) set? If so, jump to Continue_Bad_Tempered_Thing_Dialogue.
55561 JP NZ,Continue_Bad_Tempered_Thing_Dialogue
55564 INC B Advance the dialogue-check counter in B by two.
55565 INC B
55566 LD A,(29363) Load A with the game event flags (GameEventFlags).
55569 BIT 7,A Is bit 7 of game event flags set? If not, jump to Update_Bad_Tempered_Thing_Dialogue_Task3FlagWalk.
55571 JR Z,Update_Bad_Tempered_Thing_Dialogue_Task3FlagWalk
55573 BIT 6,(HL) Is StoveReady (bit 6 of TaskThreeFlags) set? If not, jump to Continue_Bad_Tempered_Thing_Dialogue.
55575 JP Z,Continue_Bad_Tempered_Thing_Dialogue
Final task-3 gates: StoveReady, MobileHeater, and BoilEmUp must all be set.
Update_Bad_Tempered_Thing_Dialogue_Task3FlagWalk 55578 INC B Advance the dialogue-check counter in B.
55579 BIT 6,(HL) Is StoveReady (bit 6 of TaskThreeFlags) set? If not, jump to Continue_Bad_Tempered_Thing_Dialogue.
55581 JP Z,Continue_Bad_Tempered_Thing_Dialogue
55584 INC B Advance the dialogue-check counter in B.
55585 BIT 0,(HL) Is MobileHeater (bit 0 of TaskThreeFlags) set? If not, jump to Continue_Bad_Tempered_Thing_Dialogue.
55587 JP Z,Continue_Bad_Tempered_Thing_Dialogue
55590 INC B Advance the dialogue-check counter in B.
55591 BIT 4,(HL) Is BoilEmUp (bit 4 of TaskThreeFlags) set? If not, jump to Continue_Bad_Tempered_Thing_Dialogue.
55593 JP Z,Continue_Bad_Tempered_Thing_Dialogue
55596 INC B Advance the dialogue-check counter in B.
55597 JP Continue_Bad_Tempered_Thing_Dialogue Jump to Continue_Bad_Tempered_Thing_Dialogue.
Task 4 gates: animation frame, interaction bits on EntityInteractionFlag, and phase 4 choose the line.
Update_Bad_Tempered_Thing_Dialogue_Task4Gates 55600 LD B,1 Load B with 1 as a loop counter.
55602 LD A,(29377) Load A with the animation frame counter (AnimationFrameCounter).
55605 CP 3 Is animation frame counter equal to 3? If so, jump to Continue_Bad_Tempered_Thing_Dialogue.
55607 JP Z,Continue_Bad_Tempered_Thing_Dialogue
55610 INC B Advance the dialogue-check counter in B.
55611 LD HL,29369 Point HL at the entity interaction flag (EntityInteractionFlag).
55614 BIT 1,(HL) Is bit 1 of EntityInteractionFlag set? If not, jump to Continue_Bad_Tempered_Thing_Dialogue.
55616 JP Z,Continue_Bad_Tempered_Thing_Dialogue
55619 INC B Advance the dialogue-check counter in B.
55620 BIT 4,(HL) Is bit 4 of EntityInteractionFlag set? If not, jump to Continue_Bad_Tempered_Thing_Dialogue.
55622 JP Z,Continue_Bad_Tempered_Thing_Dialogue
55625 INC B Advance the dialogue-check counter in B.
55626 LD A,(29363) Load A with the game event flags (GameEventFlags).
55629 BIT 7,A Is bit 7 of game event flags set? If not, jump to Continue_Bad_Tempered_Thing_Dialogue.
55631 JP Z,Continue_Bad_Tempered_Thing_Dialogue
55634 INC B Advance the dialogue-check counter in B.
55635 LD A,(29359) Load A with the current task phase (CurrentTaskPhase).
55638 CP 4 Is current task phase equal to 4? If not, jump to Continue_Bad_Tempered_Thing_Dialogue.
55640 JP NZ,Continue_Bad_Tempered_Thing_Dialogue
55643 INC B Advance the dialogue-check counter in B.
55644 BIT 2,(HL) Is bit 2 of EntityInteractionFlag set? If so, jump to Continue_Bad_Tempered_Thing_Dialogue.
55646 JP NZ,Continue_Bad_Tempered_Thing_Dialogue
55649 INC B Advance the dialogue-check counter in B.
55650 JP Continue_Bad_Tempered_Thing_Dialogue Jump to Continue_Bad_Tempered_Thing_Dialogue.
Prev: 54909 Up: Map Next: 55653