Prev: C486 Up: Map Next: C4A2
C48F: 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
0C "A closed chest"
0D "An open chest containing the Crystals of Vulcan"
When the chest is opened; item 0C is destroyed and replaced with item 0D.
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 C48F LD A,B Call GetObjectLocation to fetch where the original object is.
C490 CALL GetObjectLocation
Destroy the "from" item by clearing its location.
C493 PUSH BC Call UpdateObjectLocation to clear the original object.
C494 PUSH AF
C495 LD C,$00
C497 CALL UpdateObjectLocation
C49A POP AF Restore the new object and its destination from the stack.
C49B POP BC
Create the "to" item at the same location where the "from" item was.
C49C LD B,C Call UpdateObjectLocation to put the new object in its place.
C49D LD C,A
C49E CALL UpdateObjectLocation
C4A1 RET Return.
Prev: C486 Up: Map Next: C4A2