Prev: C412 Up: Map Next: C439
C426: 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
02 "A match"
03 "A lighted match"
When the match is lit by the player; item 02 is destroyed and replaced with item 03.
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 C426 LD A,B Copy the "from" item ID into A.
C427 CALL ObjectEventLocator Call ObjectEventLocator to get the room ID where the "from" item is located (returns in A).
C42A PUSH BC Stash the item IDs and flags on the stack for later.
C42B PUSH AF
Destroy the "from" item by setting its location to 00 (inactive).
C42C LD C,$00 Set the room ID to 00 to deactivate the "from" item.
C42E CALL Handler_UpdateObjectLocation Call Handler_UpdateObjectLocation to update the "from" item's location to 00.
C431 POP AF Restore the item IDs and flags from the stack.
C432 POP BC
Create the "to" item at the same location where the "from" item was.
C433 LD B,C Copy the "to" item ID into B.
C434 LD C,A Copy the location (from A) into C.
C435 CALL Handler_UpdateObjectLocation Call Handler_UpdateObjectLocation to create the "to" item at the stored location.
C438 RET Return.
Prev: C412 Up: Map Next: C439