Prev: 50194 Up: Map Next: 50233
50214: Transform Item
Transforms one item into another by destroying the "from" item and creating the "to" item in the same location. Rather than use item properties, the game just has separate objects that don't exist until an action is performed.
An example is:
Item ID Item Name
2 "A match"
3 "A lighted match"
When the match is lit by the player; item 2 is destroyed and replaced with item 3.
Input
B From item ID (the item to be destroyed)
C To item ID (the item to be created)
Get the location of the "from" item so the "to" item can be created in the same place.
TransformItem 50214 LD A,B Copy the "from" item ID into A.
50215 CALL ObjectEventLocator Call ObjectEventLocator to get the room ID where the "from" item is located (returns in A).
50218 PUSH BC Stash the item IDs and flags on the stack for later.
50219 PUSH AF
Destroy the "from" item by setting its location to 0 (inactive).
50220 LD C,0 Set the room ID to 0 to deactivate the "from" item.
50222 CALL Handler_UpdateObjectLocation Call Handler_UpdateObjectLocation to update the "from" item's location to 0.
50225 POP AF Restore the item IDs and flags from the stack.
50226 POP BC
Create the "to" item at the same location where the "from" item was.
50227 LD B,C Copy the "to" item ID into B.
50228 LD C,A Copy the location (from A) into C.
50229 CALL Handler_UpdateObjectLocation Call Handler_UpdateObjectLocation to create the "to" item at the stored location.
50232 RET Return.
Prev: 50194 Up: Map Next: 50233