Prev: 53302 Up: Map Next: 53356
53312: Update Vat: Event And Direction
Used by the routine at Update_Vat.
When the vat entity is not type 12, test game-event / direction bits and either copy the Data_CrusherEntityTemplate template into the crusher slot or randomly set direction bit 0.
Load game-event flags and test direction bit 0.
Update_Vat_TestEventAndDirBit0 53312 LD A,(29363) Load A with the game event flags (GameEventFlags).
53315 BIT 0,(IX+9) Is bit 0 of the current entity's direction / state set?.
53319 JR Z,Update_Vat_RandomSetDirBit0 If not, jump to Update_Vat_RandomSetDirBit0.
53321 BIT 1,A Is bit 1 of A set?.
53323 RET Z If not, return.
53324 LD DE,36809 Point DE at the crusher entity (StateData_Complex_16).
53327 LD HL,53302 Point HL at the vat template (Data_CrusherEntityTemplate).
53330 LD BC,10 Load BC with length 0010.
53333 LDIR Copy the template into the crusher entity slot.
53335 LD HL,53128 Point HL at DruttScript_Copy.
53338 JP ScriptInstruction Jump to ScriptInstruction to execute the script instruction at HL.
Randomly set direction bit 0 when bit 1 of A is clear.
Update_Vat_RandomSetDirBit0 53341 BIT 1,A Is bit 1 of A set?.
53343 RET NZ If so, return.
53344 LD A,60 Load A with 60.
53346 CALL PseudoRandom Call PseudoRandom to pick a pseudo-random value.
53349 OR A Is A zero?.
53350 RET NZ If not, return.
53351 SET 0,(IX+9) Set bit 0 of the current entity's direction / state.
53355 RET Return.
Prev: 53302 Up: Map Next: 53356