Prev: 38269 Up: Map Next: 38359
38313: Make Tombstone
Used by the routine at HandlerPlayerVanishing.
Makes a tombstone (sprite ID 143) where the player is. The four entities from ItemEntity_Tombstone_1 are searched for one that is not in use. If there is one, it is made a copy of the player, apart from the sprite ID, and with the attribute of the player set to 69 first. Then it is drawn.
MakeTombstone 38313 LD HL,60136 HL=ItemEntity_Tombstone_1 (the first of the four entities to search).
38316 LD DE,8 DE=0008 (the size of an entity).
38319 LD B,4 B=4 (the number of entities to look at).
MakeTombstone_Loop 38321 LD A,(HL) Fetch the sprite ID of the entity.
38322 AND A Jump to MakeTombstone_Create if the entity is not in use.
38323 JR Z,MakeTombstone_Create
38325 ADD HL,DE Move HL on to the next entity.
38326 DJNZ MakeTombstone_Loop Decrease the entity counter by one and loop back to MakeTombstone_Loop until all four have been checked.
38328 RET Return.
MakeTombstone_Create 38329 LD A,69 Write 69 to the attribute of the player.
38331 LD (60053),A
38334 PUSH HL Stash the address of the entity on the stack.
38335 LD (HL),143 Write 143 to the sprite ID of the entity.
38337 EX DE,HL Swap DE and HL, so that DE points at the entity.
38338 INC DE Move DE on to the room of the entity.
38339 LD HL,60049 Point HL at the room of the player at PlayerRoom.
38342 LD BC,7 BC=0007.
38345 LDIR Copy the seven bytes from the player to the entity.
38347 POP HL Restore the address of the entity from the stack.
This entry point is used by the routine at GameComplete.
Draw the entity that HL points to.
DrawEntityAtHL 38348 PUSH IX Stash IX on the stack.
38350 PUSH HL Copy HL into IX, as the entity to draw.
38351 POP IX
38353 CALL DrawEntity Call DrawEntity to draw the entity.
38356 POP IX Restore IX from the stack.
38358 RET Return.
Prev: 38269 Up: Map Next: 38359