Prev: 49262 Up: Map Next: 49410
49301: 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 49301 LD A,(36949) Load A with the pan entity's type (StateData_Complex_26).
49304 OR A Is A zero? If so, return.
49305 RET Z
49306 LD A,(29375) Load A with the room-transition flag (RoomTransitionFlag).
49309 OR A Is room-transition flag zero? If so, return.
49310 RET Z
49311 LD E,A Keep room-transition flag in E for later.
49312 LD IX,36949 Point IX at the pan entity (StateData_Complex_26).
49316 LD HL,29365 Point HL at the task-two flags (TaskTwoFlags).
49319 LD A,(IX+7) Load A with the current entity's x-coordinate.
49322 CP 132 Is the current entity's x-coordinate equal to 132? If not, jump to Update_Task_Helper_Entities_Countdown.
49324 JR NZ,Update_Task_Helper_Entities_Countdown
49326 LD A,(IX+5) Load A with the current entity's y-coordinate.
49329 CP 32 Is the current entity's y-coordinate equal to 32? If not, jump to Update_Task_Helper_Entities_Countdown.
49331 JR NZ,Update_Task_Helper_Entities_Countdown
49333 LD A,(29380) Load A with the stove / heater state (StoveHeaterState).
49336 CP 255 Is stove / heater state equal to 255? If so, return.
49338 RET Z
49339 INC A Advance stove / heater state by one.
49340 LD (29380),A Set the stove / heater state (StoveHeaterState).
49343 CP 50 Is stove / heater state equal to 50? If so, jump to Update_Task_Helper_Entities_SetLayoutBit.
49345 JR Z,Update_Task_Helper_Entities_SetLayoutBit
49347 CP 200 Is stove / heater state less than 200? If so, return.
49349 RET C
49350 SET 3,(IX+2) Set bit 3 of the current entity's flags byte 2.
49354 LD HL,40408 Point HL at the hot pan layout (GraphicLayout_PanHot).
49357 JR Update_Task_Helper_Entities_WritePanLayout Jump to Update_Task_Helper_Entities_WritePanLayout to write the pan layout pointer.
Heater reached 50: set task-two layout bits 4/5 on TaskTwoFlags.
Update_Task_Helper_Entities_SetLayoutBit 49359 LD A,E Copy the saved low byte from E into A.
49360 OR A Is the saved room-transition flag in A zero? If so, return.
49361 RET Z
49362 SET 4,(HL) Set bit 4 of TaskTwoFlags.
49364 SET 5,(HL) Set bit 5 of TaskTwoFlags (cleared by 49276 / 49393. no BIT reader found).
Select the pan cooking layout GraphicLayout_PanCooking.
Update_Task_Helper_Entities_PanCookingLayout 49366 LD HL,40419 Point HL at the pan cooking layout (GraphicLayout_PanCooking).
Write the chosen pan layout pointer into the pan entity at 36959.
Update_Task_Helper_Entities_WritePanLayout 49369 LD (36959),HL Write the layout pointer into the pan entity's layout field (36959).
49372 RET Return.
Countdown the stove/heater state (StoveHeaterState) and refresh pan layouts on thresholds.
Update_Task_Helper_Entities_Countdown 49373 LD A,(29380) Load A with the stove / heater state (StoveHeaterState).
49376 OR A Is stove / heater state zero? If so, return.
49377 RET Z
49378 DEC A Step stove / heater state back by one.
49379 LD (29380),A Set the stove / heater state (StoveHeaterState).
49382 CP 200 Is stove / heater state equal to 200? If so, jump to Update_Task_Helper_Entities_ClearFlagBit3.
49384 JR Z,Update_Task_Helper_Entities_ClearFlagBit3
49386 CP 50 Is stove / heater state equal to 50? If not, return.
49388 RET NZ
49389 LD A,E Copy the saved low byte from E into A.
49390 OR A Is the saved room-transition flag zero? If so, jump to Update_Task_Helper_Entities_PanLayout.
49391 JR Z,Update_Task_Helper_Entities_PanLayout
49393 RES 5,(HL) Clear bit 5 of TaskTwoFlags.
49395 JR Update_Task_Helper_Entities_PanLayout Jump to Update_Task_Helper_Entities_PanLayout to finish the pan update.
Clear the pan entity's bit 3, then restore layout GraphicLayout_PanCooking or GraphicLayout_Pan.
Update_Task_Helper_Entities_ClearFlagBit3 49397 RES 3,(IX+2) Reset bit 3 of the current entity's flags byte 2.
49401 LD A,E Copy the saved low byte from E into A.
49402 OR A Is the saved room-transition flag zero? If not, jump to Update_Task_Helper_Entities_PanCookingLayout.
49403 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 49405 LD HL,40455 Point HL at the pan layout GraphicLayout_Pan.
49408 JR Update_Task_Helper_Entities_WritePanLayout Jump to Update_Task_Helper_Entities_WritePanLayout to write the pan layout pointer.
Prev: 49262 Up: Map Next: 49410