Prev: 46648 Up: Map Next: 46797
46702: Resolve Object Order
The routines selected by the table at SortJumpTable, once DrawObjectsInOrder has compared two objects. IX holds the object that is being considered and IY holds the object that it has been compared with.
The order of the objects is not known, so look at the next object.
ResolveObjectOrder 46702 JP DrawObjectsInOrder_NextOther Jump to DrawObjectsInOrder_NextOther to compare the object considered with the next object in the list.
The object considered is behind the other, so it needs no wait: look at the next object.
ResolveObjectOrder_Behind 46705 JP DrawObjectsInOrder_NextOther Jump to DrawObjectsInOrder_NextOther to compare the object considered with the next object in the list.
The object considered is in front of the other so it must be drawn after it. Make the other one the object that is being considered, unless it has already been tried, and so is part of a loop.
ResolveObjectOrder_InFront 46708 LD HL,(42779) Fetch the list pointer, which is just after the entry of the other object.
46711 DEC HL Point HL at the entry.
46712 LD C,(HL) Fetch the number of the object in C.
46713 LD DE,46797 Point DE at the list of the objects that have been tried, ObjectsTriedList.
ResolveObjectOrder_FindTried 46716 LD A,(DE) Fetch the next number in the list of the objects tried.
46717 CP 255 Jump to ResolveObjectOrder_AddTried if the end of that list has been reached.
46719 JR Z,ResolveObjectOrder_AddTried
46721 CP C Jump to ResolveObjectOrder_Loop if the object has already been tried, which means that there is a loop.
46722 JR Z,ResolveObjectOrder_Loop
46724 INC DE Move on in the list.
46725 JR ResolveObjectOrder_FindTried Jump to ResolveObjectOrder_FindTried to look at the next number.
Add the object to the list of the objects tried.
ResolveObjectOrder_AddTried 46727 LD A,C Fetch the number of the object.
46728 LD (DE),A Add it to the list.
46729 INC DE Move on in the list.
46730 LD A,255 Set A to 255.
46732 LD (DE),A Mark the end of the list.
Make the other object the one that is considered and start the search again from the top of the list.
46733 PUSH IY Copy IY to IX (using the stack).
46735 POP IX
46737 LD HL,(42779) Fetch the list pointer.
46740 LD (42777),HL Make it the pointer to the entry of the object that is considered.
46743 LD DE,46426 Point DE at the start of the draw list, DrawList.
46746 JP DrawObjectsInOrder_NextOther Jump to DrawObjectsInOrder_NextOther to compare the object with the others.
The object has been tried before, so there is a loop. Draw it, to break the loop, once its place in the list has been found.
ResolveObjectOrder_Loop 46749 LD HL,46426 Point HL at the start of the draw list, DrawList.
ResolveObjectOrder_FindEntry 46752 LD A,(HL) Fetch the next number from the list.
46753 INC HL
46754 CP 255 Jump to DrawObjectsInOrder_Restart if the end of the list has been reached.
46756 JP Z,DrawObjectsInOrder_Restart
46759 CP C Jump to ResolveObjectOrder_FindEntry if it is not the entry of the object.
46760 JR NZ,ResolveObjectOrder_FindEntry
46762 PUSH IY Copy IY to IX (using the stack).
46764 POP IX
46766 JR ResolveObjectOrder_DrawEntry Jump to ResolveObjectOrder_DrawEntry to draw the object.
The two objects overlap completely, so look at the next object.
ResolveObjectOrder_Overlap 46768 JP DrawObjectsInOrder_NextOther Jump to DrawObjectsInOrder_NextOther to compare the object considered with the next object in the list.
This entry point is used by the routine at DrawObjectsInOrder.
Nothing has to be drawn before the object considered, so draw it now.
ResolveObjectOrder_Draw 46771 LD HL,(42777) Fetch the pointer to the entry of the object in the list.
ResolveObjectOrder_DrawEntry 46774 DEC HL Point HL at the entry.
46775 SET 7,(HL) Set bit 7 of the entry, to show that the object has been drawn.
46777 LD A,255 Set A to 255.
46779 LD (46797),A Empty the list of the objects that have been tried.
46782 LD HL,42772 Point HL at the count of the objects drawn, DrawingWorkCount.
46785 INC (HL) Count the object.
46786 CALL DrawObject Call DrawObject to draw the object.
46789 JP DrawObjectsInOrder_Restart Jump to DrawObjectsInOrder_Restart to look for the next object to draw.
This entry point is used by the routine at DrawObjectsInOrder.
All the objects have been drawn.
ResolveObjectOrder_Done 46792 POP IY Restore IY and IX from the stack.
46794 POP IX
46796 RET Return.
Prev: 46648 Up: Map Next: 46797