Prev: C06E Up: Map Next: C102
C095: Update Task Helper Entities
Used by the routine at Update_Task_Two_Entities.
Update Task Helper Entities for the current Thing Upstairs task.
Update_Task_Helper_Entities C095 LD A,($9055) Load A with the pan entity's type (StateData_Complex_26).
C098 OR A Is A zero? If so, return.
C099 RET Z
C09A LD A,($72BF) Load A with the room-transition flag (RoomTransitionFlag).
C09D OR A Is room-transition flag zero? If so, return.
C09E RET Z
C09F LD E,A Keep room-transition flag in E for later.
C0A0 LD IX,$9055 Point IX at the pan entity (StateData_Complex_26).
C0A4 LD HL,$72B5 Point HL at the task-two flags (TaskTwoFlags).
C0A7 LD A,(IX+$07) Load A with the current entity's x-coordinate.
C0AA CP $84 Is the current entity's x-coordinate equal to 84? If not, jump to Update_Task_Helper_Entities_Countdown.
C0AC JR NZ,Update_Task_Helper_Entities_Countdown
C0AE LD A,(IX+$05) Load A with the current entity's y-coordinate.
C0B1 CP $20 Is the current entity's y-coordinate equal to 20? If not, jump to Update_Task_Helper_Entities_Countdown.
C0B3 JR NZ,Update_Task_Helper_Entities_Countdown
C0B5 LD A,($72C4) Load A with the stove / heater state (StoveHeaterState).
C0B8 CP $FF Is stove / heater state equal to FF? If so, return.
C0BA RET Z
C0BB INC A Advance stove / heater state by one.
C0BC LD ($72C4),A Set the stove / heater state (StoveHeaterState).
C0BF CP $32 Is stove / heater state equal to 32? If so, jump to Update_Task_Helper_Entities_SetLayoutBit.
C0C1 JR Z,Update_Task_Helper_Entities_SetLayoutBit
C0C3 CP $C8 Is stove / heater state less than C8? If so, return.
C0C5 RET C
C0C6 SET 3,(IX+$02) Set bit 03 of the current entity's flags byte 2.
C0CA LD HL,$9DD8 Point HL at the hot pan layout (GraphicLayout_PanHot).
C0CD JR Update_Task_Helper_Entities_WritePanLayout Jump to Update_Task_Helper_Entities_WritePanLayout to write the pan layout pointer.
Heater reached 32: set task-two layout bits 04/05 on TaskTwoFlags.
Update_Task_Helper_Entities_SetLayoutBit C0CF LD A,E Copy the saved low byte from E into A.
C0D0 OR A Is the saved room-transition flag in A zero? If so, return.
C0D1 RET Z
C0D2 SET 4,(HL) Set bit 04 of TaskTwoFlags.
C0D4 SET 5,(HL) Set bit 05 of TaskTwoFlags (cleared by C07C / C0F1. no BIT reader found).
Select the pan cooking layout GraphicLayout_PanCooking.
Update_Task_Helper_Entities_PanCookingLayout C0D6 LD HL,$9DE3 Point HL at the pan cooking layout (GraphicLayout_PanCooking).
Write the chosen pan layout pointer into the pan entity at 905F.
Update_Task_Helper_Entities_WritePanLayout C0D9 LD ($905F),HL Write the layout pointer into the pan entity's layout field (905F).
C0DC RET Return.
Countdown the stove/heater state (StoveHeaterState) and refresh pan layouts on thresholds.
Update_Task_Helper_Entities_Countdown C0DD LD A,($72C4) Load A with the stove / heater state (StoveHeaterState).
C0E0 OR A Is stove / heater state zero? If so, return.
C0E1 RET Z
C0E2 DEC A Step stove / heater state back by one.
C0E3 LD ($72C4),A Set the stove / heater state (StoveHeaterState).
C0E6 CP $C8 Is stove / heater state equal to C8? If so, jump to Update_Task_Helper_Entities_ClearFlagBit3.
C0E8 JR Z,Update_Task_Helper_Entities_ClearFlagBit3
C0EA CP $32 Is stove / heater state equal to 32? If not, return.
C0EC RET NZ
C0ED LD A,E Copy the saved low byte from E into A.
C0EE OR A Is the saved room-transition flag zero? If so, jump to Update_Task_Helper_Entities_PanLayout.
C0EF JR Z,Update_Task_Helper_Entities_PanLayout
C0F1 RES 5,(HL) Clear bit 05 of TaskTwoFlags.
C0F3 JR Update_Task_Helper_Entities_PanLayout Jump to Update_Task_Helper_Entities_PanLayout to finish the pan update.
Clear the pan entity's bit 03, then restore layout GraphicLayout_PanCooking or GraphicLayout_Pan.
Update_Task_Helper_Entities_ClearFlagBit3 C0F5 RES 3,(IX+$02) Reset bit 03 of the current entity's flags byte 2.
C0F9 LD A,E Copy the saved low byte from E into A.
C0FA OR A Is the saved room-transition flag zero? If not, jump to Update_Task_Helper_Entities_PanCookingLayout.
C0FB JR NZ,Update_Task_Helper_Entities_PanCookingLayout
Default pan layout: point at GraphicLayout_Pan and write it through Update_Task_Helper_Entities_WritePanLayout.
Update_Task_Helper_Entities_PanLayout C0FD LD HL,$9E07 Point HL at the pan layout GraphicLayout_Pan.
C100 JR Update_Task_Helper_Entities_WritePanLayout Jump to Update_Task_Helper_Entities_WritePanLayout to write the pan layout pointer.
Prev: C06E Up: Map Next: C102