Prev: 53059 Up: Map Next: 53174
53120: Allocate Memory And Store Character
Used by the routines at ProcessObjectDisplayEntry and 57723.
Creates a new character entry in the character tracking system and adds it to the active character list, storing the character's current state for game logic purposes.
Input
HL Character location co-ordinates
B Character attribute value
AllocateMemoryAndStoreCharacter 53120 PUSH IX Stash the pointer register on the stack.
53122 LD A,7 Allocate 7 bytes of memory for the character entry.
53124 CALL AllocateMemory Call AllocateMemory.
53127 LD A,(41014) Store *CurrentCharacter_ID in the entry.
53130 LD (IX+0),A
53133 LD (IX+1),L Store the character's location co-ordinates in the entry.
53136 LD (IX+2),H
53139 LD DE,(41012) Store *RoomDisplayParameter in the entry.
53143 LD (IX+3),E
53146 LD (IX+4),D
AllocateMemoryAndStoreCharacter_StoreAttribute 53149 LD (IX+5),B Store the character's attribute value in the entry.
53152 LD A,(40918) Store *CurrentRoom_ID in the entry.
53155 LD (IX+6),A
53158 LD HL,(40937) Get the current head of *CharacterListPointer.
53161 LD (40937),IX Add this character entry to the front of the active character list.
53165 LD (IX-2),L Set up the backward link to maintain the list structure.
53168 LD (IX-1),H
53171 POP IX Restore the pointer register from the stack.
53173 RET Return.
Prev: 53059 Up: Map Next: 53174