Difference between revisions of "Talk:UNITREF.DAT"

From UFOpaedia
Jump to navigation Jump to search
(Offset 0x47)
Line 185: Line 185:
  
 
- [[User:Bomb Bloke|Bomb Bloke]] 21:31, 28 May 2008 (PDT)
 
- [[User:Bomb Bloke|Bomb Bloke]] 21:31, 28 May 2008 (PDT)
 +
 +
== Offset 0x47 ==
 +
 +
The only use I could find is that of updating [[SOURCEMP.DAT|mobile light sources]] (or something like that) when the unit dies/is rendered unconscious. Could not find anything else about this flag. [[User:Seb76|Seb76]] 05:24, 29 May 2008 (PDT)

Revision as of 12:24, 29 May 2008

Anyone who has it - can we get listings of values for various aliens on the Unitref page, for some of the variables found in both Unitref and the Geoscape Alien stats? E.g. energy recharge (Unitref[35]), energy loss [45]... like what Danial did for Height. Some of it might go to NKF's redesigned Soldier page. I am trying to flesh out the Geoscape data so I know what everything is there (and can then extend it across difficulty levels). It has unlabelled fields with values, some of which I know must be these values... but there's no list for me to compare against. Thanks if you can help! ---MikeTheRed 19:37, 25 Nov 2005 (PST)

P.S. We probably should clean up this Discussion some time. I will if I find the time to make sure everything has made its way to wherever it should go.


I've chopped out the majority of this page as it is no longer required. I'm keeping the heights chart in case it is required - I've also changed the "H-F" field to "H+F", as this actually makes sense.

               [49] [51] "Tall" [48]  | [49] [48]    
  Class         Ht.  Flt   H+F  Wide  |  Ht. Wide Area
  ---------     ---  ---  ----  ----  |  --- ---- ----
  Sectoid       16    0    16    2    |   16   2   32     Area=Ht.*Wide
  Celatid       12    6    18    3    |   12   3   36
  Hovertank*    12    6    18    4    |   12   4   48     
  Silacoid      10    0    10    5    |   10   5   50 
  Snakeman      18    0    18    3    |   18   3   54 
  Zombie        18    0    18    3    |   18   3   54
  Cyberdisc     15    2    17    4    |   15   4   60
  Ethereal      20    0    20    3    |   20   3   60    All Hover/Tanks in their
  Chryssalid    21    0    21    3    |   21   3   63    class assumed to be same
  Civilian      21    2    23    3    |   21   3   63    altho not tested yet
  Floater       21    2    23    3    |   21   3   63
  Muton         21    0    21    3    |   21   3   63
  Tank*         16    0    16    4    |   16   4   64
  Soldier       22    0    22    3    |   22   3   66
  Reaper        23    0    23    4    |   23   4   92
  Sectopod      23    0    23    4    |   23   4   92

Anyway, unitref[48] and unitref[52] remain somewhat of a mystery. Thus far we've assumed them to be the unit's width. Today I tried tinkering with [48] to see of this was correct. As I cranked it up, I found no change in my accuracy, or as to how the Sectoid target blocked line of fire to the tiles behind it.

When it reached the value of 37, however, the alien disappeared! I could not view it regardless of distance. In fact, I could even fire right through the tile it was standing on with no obstruction. The only sign that the alien was still there was the fact that my unit could not stand on the same square.

I lowered [48] a bit and tried viewing the alien from different distances, and found that it appeared in the same way as it usually would, regardless of the value used. It's simply the case that going to 37 or above makes the alien invisible.

I have a strong belief that offset 48 is nothing else but the loftemps.dat entry used for collision checking with bullets. A first check is done against the unit height (taking into account floating height, terrain height, kneeling). If the check is OK, the loftemps entry is then used as a final check (effectively treating the unit as a cylinder). I'll try to decypher the code further. If others want to have a look, the code is around here:
.text:004116AE 8B 15 5C 28 4A 00       mov     edx, pUnitPos
...
Seb76 13:24, 10 April 2008 (PDT)
I'm inclined to agree with you, though I'm not much good at reading through executable code. :( I hit on the same idea on my talk page... I've got some notes in there about how I think the firing system works, if you could find code to back it up I'd be a happy boy.
It's something of a long winded work-in-progress ramble, and I'm sure some parts are confusing and/or dead wrong, but with any luck you can make some sort of sense of it. :)
- Bomb Bloke 18:34, 11 April 2008 (PDT)

I also tweaked [52] a bit, but found that it seemed to have no similar effects, if any at all.

Although I haven't tested this any further as yet, it might be possible to use this effect in reverse - Create an 'invisible' X-Com unit, and use it to observe how aliens act when they think we're not looking.

- Bomb Bloke 00:44, 31 July 2006 (PDT)


MTR - re: death of units. If I'm not mistaken you also need to set a flag in UNITPOS.DAT to make sure that the unit is dead.

- NKF


Indeed, you need to flag offset 10, bit 2 to false (0). Health and the like has no effect on the matter.

Easiest way is to just use my editer. ;)

- Bomb Bloke 05:50, 6 November 2006 (PST)


Let me give it a shot, BB. Is there a link to your editor? (Where'd the link to Utilities go since the Main Page was reorganized?)

So, that one UNITPOS bit is the only thing needed to kill someone dead? And they'll already be dead, with none of the Morale effects I saw? That was so odd, how they die twice if you set UNITREF Current Health to 0.

Gah, somehow I totally missed your work on Width (above). I've been blithely writing about it at GEOSCAPE.EXE offsets [22] and [23]. Wow, that's extremely odd... UR[48] at >36 makes them disappear, but no accuracy change? And [52] at >36 doesn't do that, nor anything at all apparent? How so very odd. I wonder if [48] and [52] are interdependent somehow... [52] might make them disappear, depending on [48]. Just a thought.

As an "area" calculation (height X width in table above), 37 doesn't make sense... since Sectoids are 16 high, it would need a width of 16 to become "bigger than 255", not 37. But then, the area calculation is total conjecture.

I see from LOFTEMPS.DAT that tiles are of pixel dimensions X 16, Y 16, Z 12. However, that's for terrain. I can't seem to find pictures of aliens per se - or are they simply sprites with no actual LOFT (Line Of Fire Template) pixel grids, per se? If they do have pixel grids, maybe the dimensions could help suggest what these Unitref values do?

- MikeTheRed 08:00, 6 November 2006 (PST)


A dead unit is one that isn't in play. This can be the case regardless as to whether they have health or not. You can find the editer on StrategyCore.

Re the area calculation, even if the result was higher then 255, UFO is noted for just looping back around to 0. Also note that a tile has a height of 24 units. Although there are only 12 loftemps entries per tile, they each cover 2 layers.

So far, there isn't any evidence to suggest that units use loftemps, though it wouldn't surprise me if they do. Well already know how to affect their height, at least.

- Bomb Bloke 14:15, 6 November 2006 (PST)


Thanks for the LOFT notes, BB. More to think about.

- MikeTheRed 17:12, 7 November 2006 (PST)

Offset 0x3C

I have a gut feeling it is related to the panic/berserk status of the unit... Any volunteer for testing? Seb76 10:36, 22 March 2008 (PDT)


Made a save where all soldiers had no morale. Ended turn, most of them panicked etc. Saved the game but that offset still came up as 0. Might only be flagged at runtime.

- Bomb Bloke 18:01, 26 May 2008 (PDT)


I checked and indeed the game sets and clears it in the same turn so it is always 0 in a savegame and hence there is no 'black box' way of confirming it. I can provide disassembly screenshots if you want proofs however ;) Seb76 05:45, 28 May 2008 (PDT)

Actually after some thinking, it _might_ be possible... If you set the value to 3 for all entries, everyone may go berserk, with 2 they should run in fear and 1, they'll just crap their pants in place... Seb76 07:09, 28 May 2008 (PDT)

I tried it, and indeed my units did exactly that (at the start of their next turn - not that of the aliens).

- Bomb Bloke 21:08, 28 May 2008 (PDT)

Offset 0x71

Hmm, the code checks this offset before applying stun damage... It looks more like an 'immune to stun damage' flag then. Strange... Seb76 13:48, 7 April 2008 (PDT)


By memory, the only things that use this are X-Com HWPs (which shouldn't have stun applied). It does toggle inventory access as described though it wouldn't surprise me if it also toggled stun damage.

- Bomb Bloke 05:46, 8 April 2008 (PDT)

OK, I located the check and it is exactly what happens. BTW, if you want to try something, try to patch this with nops (0x90):
.text:00412A20 A8 40                   test    al, 40h
.text:00412A22 0F 85 00 02 00 00       jnz     exit                            ; default
It should enable inventory screen for memory controlled units (could not test since I have no save files with psy units...) Seb76 11:37, 8 April 2008 (PDT)

Offset 0xB

The value is used together as an offset to MCDData offset 39 (describing TUs required to cross a tile walking/flying/sliding) so it most likely represent the way the unit moves. Still needs testing. Seb76 13:27, 23 May 2008 (PDT)


I took a look at it for Snakemen and Silacoids, it's still 0 (same as it is for everything else).

But that doesn't mean it remains at 0 when the game's running. Do you mean to say that the value here + 39 = the offset in the MCD array that says how many TUs were required to move past any given obstacles in the current map location?

(That is, you'd expect to see a 2 there for sliding units?)

- Bomb Bloke 05:14, 25 May 2008 (PDT)


Yep, exactly like that. Also it checks if the value is 0xff and prevent movement in that case. I'll try a live check with a debugger when I encounter snakemen. Maybe it's a part of code that was implemented but not put into usage. Seb76 05:20, 25 May 2008 (PDT)

Did the check and the value is indeed zero even for snakemen... BTW, is the movement type really working? I mean has anybody ever checked that e.g. snakemen really use different TU amount for tiles where TU usage is not the same between crawling and walking? Seb76 06:43, 25 May 2008 (PDT)

Truth be told I don't remember reading of anyone doing the tests, so I had a go myself.

I tried first with the Avenger ramp, stuck it up in the air and had soldiers walk/fly onto it. Made no effect to their TU usage.

Next I rigged a Snakeman mission in the arctic, stuck one of them in the middle of a pond. It wouldn't move on it's own, and I couldn't move it under mind control.

So then I set 0xB to 2 just for that unit, and hey presto! Suddenly it was able to move freely, either under my control or otherwise. That's certainly the movement type flag... It's just not set in practise.

Still, now I'm wondering if 2 really was for sliders... It doesn't make sense that "fliers" (which I guess was supposed to include the likes of CyberDiscs, which "hover" even when on the ground) wouldn't be able to cross water, yet Snakemen could. Perhaps it should be the other way around?

- Bomb Bloke 19:22, 25 May 2008 (PDT)


Note that there are some tiles that have 0 MP cost for sliders. - Zaimoni 22:28, 25 May 2008 (CDT)

Yeah, I guess that puts the clincher on it. Only fliers would really be totally unhindered by ground rubble. I've tweaked the MCD details page accordingly. - Bomb Bloke 05:25, 26 May 2008 (PDT)

Hehe, I knew it couldn't be anything else but movement type. Yet another entry for known bugs ;) I'll check if it's possible to reenable the feature. It'll depends if it's a bug or if it was voluntarily removed I guess... Seb76 04:37, 26 May 2008 (PDT)

Did a quick check and can confirm what is said in Alien Stats page. Offset 0xB is filled with the 3rd "unknown" value of alien stats. It is set to 0 for all entries. Could not find any other place where it could possibly be set to another value. Seb76 05:17, 26 May 2008 (PDT)

So it's just a matter of tweaking that for all relevant units, then. However, I reckon it was left unused intentionally - I doubt the map files really contain enough variety to make it worth including.

- Bomb Bloke 05:25, 26 May 2008 (PDT)


Since TFTD was done later with the same engine, perhaps it makes use of this? However, given that a different team made it (Terror from the Deep was developed by Microprose using code licensed by Mythos), developers may not have known the feature was available... Seb76 07:25, 28 May 2008 (PDT)


I took a quick check, and sure enough found a Hallucinoid (the big flying squid thing) set to 2.

- Bomb Bloke 21:31, 28 May 2008 (PDT)

Offset 0x47

The only use I could find is that of updating mobile light sources (or something like that) when the unit dies/is rendered unconscious. Could not find anything else about this flag. Seb76 05:24, 29 May 2008 (PDT)