This file is only used by tactical saves. It is always two bytes and describes the default light levels on the map.
The first byte indicates overall level of ambient lighting. On night missions it is 16, on day missions 0, dusk and dawn use values in the middle. The second byte is the ambient lighting of shadowed areas (below and inside Skyranger, inside UFOs), usually it is equal to the first byte plus four. TERMP.DAT is recalculated at certain times (eg end of turn, or when a light-source tile (eg street lamp) is destroyed - refer to page article for full list) using the appropriate value from BGLOB.DAT as the maximum (or 15, whichever is lower). What determines under which exact circumstances the first or second offset will be used is not yet known.
Determining the time on the world map
The values held in this file are determined by values in MISSION.DAT, which are in turn determined by the local time at the mission location or the type of mission to take place.
To determine the time, look up the corresponding world-map object (MISSION), then grab its longitude co-ordinate (LOC[2-3]). This can be used to determine the time relative to UTC (a mission located at longitude 0 matches UTC).
- Divide the longitude by 120 and round the result down to determine the hour.
- Take the remainder of the above calculation and divide by two to determine the minute.
- The remainder of the above, multiplied by 30, determines the second.
(As the games use longitude values of 0 to 2879, it's only possible to get the time zone accurate to within half a minute).
Next take the game's displayed time (from IGLOB.DAT), add this to the mission location's time offset, and you've got the current time at that location.
(When I initially did this research, I found the game time to be displayed as +10UTC. Now... it's not. I must've made a mistake somewhere, but I'll leave this note here in case I didn't. - BB)
Determining the value of MISSION[74-75]
When the GeoScape engine initiates a new combat, it stores a value at MISSION[74-75] which is based on the time determined by the above step, per the below table:
For example, if the time is determined to be 5:46pm, then the value will be 12.
Some mission types override this table, and just output a value of 0. Modifying this prior to the battle starting has no effect with at least some mission types; the BattleScape engine will ignore the value and set lighting according to the type of mission to be played out instead.
Determining the values in BGLOB
Once the BattleScape engine starts, it takes the value the GeoScape engine entered into MISSION[74-75], then determines BGLOB using the below lookup table:
BGLOB is then set to whatever BGLOB is, plus four.
According to Seb76, this last table only has 24 indexes (0 through to 23) - however, it seems the game itself does try to access a 25th index, regardless as to whether it "should").
Some mission types do not use this lookup table, but rather set values according to the mission type:
- EU X-COM bases use 8 for both BGLOB and BGLOB.
- EU alien bases, including both stages of Cydonia, use 16 for both.
- TFTD colony surface missions use 16 for both, though the underground colony zone uses values of 0 and 4.