BGLOB.DAT
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[76]), 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:
Time | 0:00 | 0:30 | 1:00 | 1:30 | 2:00 | 2:30 | 3:00 | 3:30 | 4:00 | 4:30 | 5:00 | 5:30 |
---|---|---|---|---|---|---|---|---|---|---|---|---|
MISSION[74-75] | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 |
Time | 6:00 | 6:30 | 7:00 | 7:30 | 8:00 | 8:30 | 9:00 | 9:30 | 10:00 | 10:30 | 11:00 | 11:30 |
MISSION[74-75] | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 |
Time | 12:00 | 12:30 | 13:00 | 13:30 | 14:00 | 14:30 | 15:00 | 15:30 | 16:00 | 16:30 | 17:00 | 17:30 |
MISSION[74-75] | 23 | 22 | 21 | 20 | 19 | 18 | 17 | 16 | 15 | 14 | 13 | 12 |
Time | 18:00 | 18:30 | 19:00 | 19:30 | 20:00 | 20:30 | 21:00 | 21:30 | 22:00 | 22:30 | 23:00 | 23:30 |
MISSION[74-75] | 11 | 10 | 9 | 8 | 7 | 6 | 5 | 4 | 3 | 2 | 1 | 0 |
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[0] using the below lookup table:
MISSION[74-75] | 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|
BGLOB[0] | 16 | 16 | 16 | 16 | 16 | 16 | 16 | 16 | 16 | 16 | 12 | 8 | 4 |
MISSION[74-75] | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | |
BGLOB[0] | 2 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 |
BGLOB[1] is then set to whatever BGLOB[0] 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[0] and BGLOB[1].
- 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.