Prev: 59624 Up: Map Next: 59715
59657: Graphic Layout Routine: (247) Timer-Based Random Graphic Index
Choose a graphic-set index from a timer-based random table.
GraphicLayoutRoutine_TimerRandomGraphicIndex 59657 LD B,0 Load B with 0.
59659 LD A,(IX+0) Fetch the current entity's type into A.
59662 INC A Step the nested-layout counter on by one.
59663 LD (IX+0),A Set the current entity's entity type.
59666 CP (IX+1) Compare A with this entity's flags byte 1.
59669 INC IX Advance IX past the two-byte graphic-layout operand.
59671 INC IX
59673 LD A,(IX+0) Fetch the current entity's type into A.
59676 JR Z,GraphicLayoutRoutine_F7Continue Jump to GraphicLayoutRoutine_F7Continue to continue if the comparison matched.
59678 INC A Step the nested-layout counter on by one.
59679 LD C,A Keep the updated index in C.
59680 ADD IX,BC IX+=BC.
59682 JP Process_GraphicLayoutData Jump to Process_GraphicLayoutData to process graphic layout data.
Reset the 247 timer byte, pick a random graphic index, and continue layout at Process_GraphicLayoutData.
GraphicLayoutRoutine_F7Continue 59685 LD (IX-2),0 Write 0 to *(IX-2).
59689 PUSH IX Stash IX on the stack.
59691 CALL PseudoRandom Call PseudoRandom to pick a pseudo-random value.
59694 INC A Step the nested-layout counter on by one.
59695 LD C,A Keep the updated index in C.
59696 ADD IX,BC IX+=BC.
59698 LD A,(IX+0) Fetch the current entity's type into A.
59701 POP IX Restore IX from the stack.
59703 LD C,(IX+0) Load C with the current entity's entity type.
59706 INC C Advance the saved count in C by one.
59707 ADD IX,BC IX+=BC.
59709 LD (IX+0),A Set the current entity's entity type.
59712 JP Process_GraphicLayoutData Jump to Process_GraphicLayoutData to process graphic layout data.
View the equivalent code in;
Prev: 59624 Up: Map Next: 59715