Prev: B2E9 Up: Map Next: B337
B318: Create Direction Pointer
Used by the routine at CreateTownObjects.
Called every frame in the town. Puts a pointing hand (an object of type 0B) in the sixth object slot, next to the sheriff, if the slot is free. HandlePointer makes it point towards the outlaw.
Use the sixth slot if it is free.
CreateDirectionPointer B318 LD DE,$A2CD Point DE at the sixth object slot.
B31B LD A,(DE) Fetch the type of the object in the slot.
B31C AND A Return if the slot is in use.
B31D RET NZ
Copy the template and place the pointer near the sheriff.
B31E PUSH DE Copy DE to IY (using the stack).
B31F POP IY
B321 LD HL,$B337 Point HL at PointerTemplate.
B324 LD BC,$0010 Set the size of an object slot in BC.
B327 LDIR Copy the template into the slot.
B329 LD B,$01 Set the distance from the sheriff to one cell.
B32B CALL PlaceNearSheriff Place the pointer one cell away from the sheriff.
B32E RET NZ Return if that cell is blocked.
B32F CALL SetPositionInCell Set the position of the pointer within its cell.
B332 LD (IY+$00),$0B Turn the slot into a pointer.
B336 RET Return.
Prev: B2E9 Up: Map Next: B337