Prev: 59550 Up: Map Next: 59624
59562: Graphic Layout Routine: (249) Jump To Time-Weighted Random Address
Jump to one of several graphic-layout addresses using a time-weighted random pick.
GraphicLayoutRoutine_JumpTimeWeightedRandom 59562 PUSH IX Stash IX on the stack.
59564 LD A,(IX+1) Load A with the current entity's flags byte 1.
59567 ADD A,A Multiply A by 4 to index the four-byte table entries.
59568 ADD A,A
59569 ADD A,2 A+=2.
59571 LD E,A Copy A into E as a saved coordinate / value.
59572 LD D,0 Clear D (high byte of a pointer/offset).
59574 ADD IX,DE IX+=DE.
59576 DEC (IX+0) Decrease the current entity's entity type.
59579 JR NZ,Layout_LoopEnd Jump to Layout_LoopEnd to continue if the comparison did not match.
59581 POP IX Restore IX from the stack.
59583 LD A,(IX+0) Fetch the current entity's type into A.
59586 CALL PseudoRandom Call PseudoRandom to pick a pseudo-random value.
59589 LD (IX+1),A Set the current entity's flags byte 1.
59592 ADD A,A Multiply A by 4 to index the four-byte table entries.
59593 ADD A,A
59594 ADD A,2 A+=2.
59596 LD E,A Copy A into E as a saved coordinate / value.
59597 ADD IX,DE IX+=DE.
59599 LD A,(IX+1) Load A with the current entity's flags byte 1.
59602 CALL PseudoRandom Call PseudoRandom to pick a pseudo-random value.
59605 INC A Step the graphic-set / attribute index on by one.
59606 LD (IX+0),A Set the current entity's entity type.
59609 JR GraphicLayoutRoutine_F9Continue Jump to GraphicLayoutRoutine_F9Continue to continue this routine.
Timer still counting: restore IX and jump to the current time-weighted layout address.
Layout_LoopEnd 59611 POP DE Restore DE from the stack.
Load the chosen 249 table entry's layout address into IX and process it at Process_GraphicLayoutData.
GraphicLayoutRoutine_F9Continue 59612 LD E,(IX+2) Fetch this table entry's graphic-layout address into DE.
59615 LD D,(IX+3)
59618 PUSH DE Copy DE into IX (using the stack).
59619 POP IX
59621 JP Process_GraphicLayoutData Jump to Process_GraphicLayoutData to process graphic layout data.
View the equivalent code in;
Prev: 59550 Up: Map Next: 59624