Prev: 50310 Up: Map Next: 50338
50319: 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
12 "A closed chest"
13 "An open chest containing the Crystals of Vulcan"
When the chest is opened; item 12 is destroyed and replaced with item 13.
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 50319 LD A,B Call GetObjectLocation to fetch where the original object is.
50320 CALL GetObjectLocation
Destroy the "from" item by clearing its location.
50323 PUSH BC Call UpdateObjectLocation to clear the original object.
50324 PUSH AF
50325 LD C,0
50327 CALL UpdateObjectLocation
50330 POP AF Restore the new object and its destination from the stack.
50331 POP BC
Create the "to" item at the same location where the "from" item was.
50332 LD B,C Call UpdateObjectLocation to put the new object in its place.
50333 LD C,A
50334 CALL UpdateObjectLocation
50337 RET Return.
Prev: 50310 Up: Map Next: 50338