OBPOS.DAT

From UFOpaedia
Revision as of 07:02, 9 September 2006 by Bomb Bloke (talk | contribs)
Jump to navigation Jump to search

This file is used by save games to record the location of items mid-battle.

16 single byte values per record, with 170 records in the file.

This format is also used by OBPOS2.DAT and OBPOSREF.DAT.

Structure

0/00: Object type (Object is the item ID# in geodata\obdata.dat). Value of 255/-1 = item in this slot is meant to be unused or destroyed. See OBDATA.DAT for a list of possibilities.

1/01: Y coordinate when on the ground.

2/02: X coordinate when on the ground.

3/03: Z coordinate when on the ground.

The three above values are meant to tell the game where the items physically are. They determine where an unconcious unit will wake up. They tell the game where to centre an explosion for area effect items.

Oddly enough, these values ARE NOT UPDATED when in inventory. All items that start in your inventory default to the equipment pile. All items that start in the alien inventories are at location (0,0,0).

4/04: Owner of item. References the units in unitpos. First unit unit index is 0, naturally. Just tells the game who's holding the current item. If 255 = object will be on the ground.

5/05: Inventory slot (from left to right):

   0 = Right hand (it's right in the battlescape, but not in the inventory)
   1 = Left hand
   2 - 5 = Leg slots 
   6 - 9 = Shoulder slots
   10 - 18 = backpack
   19 - 22 = top row of belt
   23 - 24 = side pockets of belt

WARNING: If adding an item to the hand slots, remember to update the hand slot images in UNITREF for the soldier involved.

6/06: Object the current item is loaded into. -1/255 by default for no item. (Uses obpos item index - first object in obpos is 0).

7/07: -1/255 by default, otherwise 0 if the item is loaded into something.

8/08: Item Quantity 1:

For Ammo: Ammo quantity.

For Medikits: Painkillers remaining.

For Grenade: 'Turn to detonate on' trigger (0 = grenade object has not been primed).

Non zero positive value = What turn to explode on. Grenade will explode if current 'turn' is equal or greater than this number. See WGLOB.DAT for No. of turns.

When priming grenades this is set to the current turn number +1 for every additional turn added onto the timer. Refer to wglob for current number of turns. (Uses actual turns, not turns/2)

9/09: Item Quantity 2:

For Medikits: Stimulants remaining.

For Grenades: Ownership flag (unitpos reference). For remembering who last threw the live grenade. For morale loss calculations and for determining the soldier's combat experience. Refers to unit 0 by default. Refers to unit in unitpos.

10/0A: Item Quantity 3:

Medikit's Heal uses remaining.

11/0B: This is a direct copy of offset[48] from the MCD record (see TERRAIN) of the tile the unit is standing on. A signed byte.

12/0C: Usually 224 (-32?) or 227 (-35?), though other values have been observed.

11100000 - 224
11100011 - 227

13/0D: Presumed unused.

14/0E: Presumed unused.

15/0F: Presumed unused.


See Also