ITM Format (Shadowcaster)
ITM files are found within SHADOW.LIB and contains a list of 42-byte records, each describing one item in the level. An "item" is distinguished from an "object" in that items can be picked up and placed in the inventory, and typically have some effect when the player interacts with them (or uses them on scripted static objects in the level).
The following structure describes any individual ITM record.
typedef struct {
int32_t tag;
int32_t unknown1;
int32_t unknown2;
int32_t tilex;
int32_t tiley;
int32_t unknown3;
int32_t itemtype;
int32_t stacksize;
int32_t charge;
int16_t tilesubx;
int16_t tilesuby;
int16_t unknown4;
} item_t;
tag
An identifier that scripts can use to address this item. This identifier does not have to be unique.
If the item is referenced in a script, then all items with the referenced tag will be acted upon (such as deleting a group of items at once).
tilex, tiley
Defines the "integer" component of the item's coordinates, in terms of coarse tile coordinates (0-31). X+ is eastward, and Y+ is southward.
itemtype
The record ID within itemtype.nfo that specifies most of this item's properties, such as what spell to cast when a wand is used and what graphics to display.
stacksize
The game technically supports "stacks" of items, but not very well.
You can use this field to specify if this itm contains multiple of the same (for example, a stack of 5 healing potions). In effect, this acts like a multiplier for the "charge" property.
charge
How much "mana" or "power" this item contains at spawn. This value is also treated as the maximum mana the item can hold when recharged in a mana pool.
Note however that all effects that an item can use appear to have a fixed amount of mana they require, so it is possible to create "illegal" items that can never store enough mana to execute their effect (you will see "ITEM OUT OF POWER" in the message bar in-game).
tilesubx, tilesuby
These form the "fractional" component of the item's spawn position. Valid values are 0-63, using the same coordinate system as coarse tilex/tiley. This means that storing 0 in these fields will spawn an item at the northwest most corner of its tile.