Difference between revisions of "UNITPOS.DAT"

From UFOpaedia
Jump to navigation Jump to search
(→‎See Also: Category)
Line 1: Line 1:
There are 80 records of 14 values of one byte each. 1120 bytes in total.<br>
+
Stores positioning information for units in the playing field. Each large unit takes four individual records, small units have one record each.
<br>
+
 
unitpos[0] - Y position. 255 if unit specifically unused.<br>
+
There are 80 records of 14 values of one byte each. 1120 bytes in total. The same format is used by the files [[UNIPOS.DAT]], and the MissDat version of [[UNITPOS.DAT_(MISSDAT)|UNITPOS.DAT]].
unitpos[1] - X position.<br>
+
 
unitpos[2] - Z position. (0 is top level).<br>
+
== Structure ==
unitpos[3] - <br>
+
 
unitpos[4] - <br>
+
<b>0/00</b> - Y position. 255 if unit specifically unused.
unitpos[5] - <br>
+
 
unitpos[6] - Seems to be the same number for all records, but does vary between saves.<br>
+
<b>1/01</b> - X position.
unitpos[7] - Always 0?<br>
+
 
<br>
+
<b>2/02</b> - Z position. (0 is top level).
unitpos[8] - <br>
+
 
<br>
+
<b>3/03</b> - ???
BB's notes:<br>
+
 
<br>
+
<b>4/04</b> - ???
Always seems to be 255 for X-Com controlled (as opposed to owned) units.<br>
+
 
<br>
+
<b>5/05</b> - ???
This is NOT race specific, but has something to do with whether a unit has been seen or not. I've observed this value changing to 0 as soon as an alien is spotted by a player controlled unit, even if the alien didn't see the other unit approach.<br>
+
 
<br>
+
<b>6/06</b> - Seems to be the same number for all records, but does vary between saves.
unitpos[9] - Owner flag. Possible values:<br>
+
 
0: X-Com<br>
+
<b>7/07</b> - Always 0?
1: Alien<br>
+
 
2: Civilian<br>
+
<b>8/08</b> - ???
<br>
+
 
unitpos[10] - Unit info flags. Bits (from left to right, 87654321):<br>
+
BB's notes:
(  1) 1: 0 = Invisible, 1 = visible.<br>
+
 
(  2) 2: 0 = Dead or unconcious, 1 = active.<br>
+
Always seems to be 255 for X-Com controlled (as opposed to owned) units.
(  4) 3: 0 = Small unit, 1 = big unit.<br>
+
 
(  8) 4: 0 = Left section of unit, 1 = right side of unit.<br>
+
This is NOT race specific, but has something to do with whether a unit has been seen or not. I've observed this value changing to 0 as soon as an alien is spotted by a player controlled unit, even if the alien didn't see the other unit approach.
( 16) 5: 0 = Upper side of unit, 1 = lower side of unit.<br>
+
 
( 32) 6: Only seems to flag for certain tank parts. Could be where tank will fire from?<br>
+
<b>9/09</b> - Owner flag. Possible values:
( 64) 7: 0 = Normal, 1 = under mind control.<br>
+
  0: X-Com
(128) 8: Unused?<br>
+
  1: Alien
<br>
+
  2: Civilian
Ignore bits 4 and 5 if bit 3 is unflagged.<br>
+
 
<br>
+
<b>10/0A</b> - Unit info flags. Bits (from left to right, 87654321):
unitpos[11] - <br>
+
 
unitpos[12] - <br>
+
  (  1) 1: 0 = Invisible, 1 = visible.
unitpos[13] -<br>
+
  (  2) 2: 0 = Dead or unconcious, 1 = active.
 +
  (  4) 3: 0 = Small unit, 1 = big unit.
 +
  (  8) 4: 0 = Left section of unit, 1 = right side of unit.
 +
  ( 16) 5: 0 = Upper side of unit, 1 = lower side of unit.
 +
  ( 32) 6: Only seems to flag for certain tank parts. Could be where tank will fire from?
 +
  ( 64) 7: 0 = Normal, 1 = under mind control.
 +
  (128) 8: Unused?
 +
 
 +
Ignore bits 4 and 5 if bit 3 is unflagged.
 +
 
 +
<b>11/0B</b> - ???
 +
 
 +
<b>12/0C</b> - ???
 +
 
 +
<b>13/0D</b> - ???
  
 
==See Also==
 
==See Also==

Revision as of 03:05, 17 June 2006

Stores positioning information for units in the playing field. Each large unit takes four individual records, small units have one record each.

There are 80 records of 14 values of one byte each. 1120 bytes in total. The same format is used by the files UNIPOS.DAT, and the MissDat version of UNITPOS.DAT.

Structure

0/00 - Y position. 255 if unit specifically unused.

1/01 - X position.

2/02 - Z position. (0 is top level).

3/03 - ???

4/04 - ???

5/05 - ???

6/06 - Seems to be the same number for all records, but does vary between saves.

7/07 - Always 0?

8/08 - ???

BB's notes:

Always seems to be 255 for X-Com controlled (as opposed to owned) units.

This is NOT race specific, but has something to do with whether a unit has been seen or not. I've observed this value changing to 0 as soon as an alien is spotted by a player controlled unit, even if the alien didn't see the other unit approach.

9/09 - Owner flag. Possible values:

  0: X-Com
  1: Alien
  2: Civilian

10/0A - Unit info flags. Bits (from left to right, 87654321):

  (  1) 1: 0 = Invisible, 1 = visible.
  (  2) 2: 0 = Dead or unconcious, 1 = active.
  (  4) 3: 0 = Small unit, 1 = big unit.
  (  8) 4: 0 = Left section of unit, 1 = right side of unit.
  ( 16) 5: 0 = Upper side of unit, 1 = lower side of unit.
  ( 32) 6: Only seems to flag for certain tank parts. Could be where tank will fire from?
  ( 64) 7: 0 = Normal, 1 = under mind control.
  (128) 8: Unused?

Ignore bits 4 and 5 if bit 3 is unflagged.

11/0B - ???

12/0C - ???

13/0D - ???

See Also