Prev: 46797 Up: Map Next: 46873
46840: Set Position In Cell
Sets where an object stands within its cell, from the position of the sheriff within his cell. The routine uses C as left by GetMapCell, and PlaceNearSheriff must have been called first.
Input
IY The address of the object
Set the horizontal position within the cell.
SetPositionInCell 46840 LD A,(41598) Fetch the horizontal position of the sheriff within his cell.
46843 AND %11000000 Keep the top two bits.
46845 OR %01000000 Set bit 6.
46847 BIT 0,C Jump to SetPositionInCell_Horizontal if bit 0 of C is clear.
46849 JR Z,SetPositionInCell_Horizontal
46851 NEG Negate the position.
SetPositionInCell_Horizontal 46853 LD (IY+1),A Set the horizontal position of the object within its cell.
Set the vertical position within the cell.
46856 LD A,(41600) Fetch the vertical position of the sheriff within his cell.
46859 AND %11000000 Keep the top two bits.
46861 OR %01000000 Set bit 6.
46863 BIT 1,C Jump to SetPositionInCell_Vertical if bit 1 of C is clear.
46865 JR Z,SetPositionInCell_Vertical
46867 NEG Negate the position.
SetPositionInCell_Vertical 46869 LD (IY+3),A Set the vertical position of the object within its cell.
46872 RET Return.
Prev: 46797 Up: Map Next: 46873