Difference between revisions of "BGLOB.DAT"

From UFOpaedia
Jump to navigation Jump to search
m
(Determining brightness levels of a given world-map location - does this seem needlessly complicated for a two-byte file?!)
Line 1: Line 1:
This file is only used by tactical saves. It is always two bytes and describes the default light levels on the map.
+
{{tocright}}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 uses 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. What determines under which exact circumstances the first or second offset will be used is not yet known.
+
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.
  
The values held in this file are determined by values in [[MISSION.DAT]]. For a UFO/Terror site, a value from this table (stored in the executable) will be used as the first BGLOB byte, according to [[MISDATA.DAT#74-75 |MISSION[74-75]]] (which is based on the time at the mission location):
 
  
'''MISSION[74-75] Value:  0  1  2  3  4  5  6  7  8  9 10 11 12 13 14 15 16 17 18 19 20 21 22 23'''
+
===Determining the time on the world map===
BGLOB[0] Value:      16 16 16 16 16 16 16 16 16 16 12  8  4  2  0  0  0  0  0  0  0  0  0  0
+
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.
  
For example, if MISSION[74-75] is 11 BGLOB[0] will be 8 and BGLOB[1] will be 12.
+
To determine the time, look up the corresponding world-map object ([[MISDATA.DAT#76|MISSION[76]]]), then grab its longitude co-ordinate ([[LOC.DAT#2-3|LOC[2-3]]]). This can be used to determine the time relative to UTC (a mission located at longitude 0 ''matches'' UTC).
  
When defending an X-Com base, the table is ignored (as the map is underground and so time of day is irrelvant). Both BGLOB values will be set to 8.
+
* 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]]) and subtract 10 hours to get the UTC version. Add this to the mission location's time offset and you've got the ''current'' time at that location.
 +
 
 +
 
 +
===Determining the value of MISSION[74-75]===
 +
When the GeoScape engine initiates a new combat, it stores a value at [[MISDATA.DAT#74-75 |MISSION[74-75]]] which is based on the time determined by the above step, per the below table:
 +
 
 +
{| class="wikitable" width="700"
 +
|- align="center"
 +
! 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
 +
|- align="center"
 +
! MISSION[74-75]
 +
| 1 || 2 || 3 || 4 || 5 || 6 || 7 || 8 || 9 || 10 || 11 || 12
 +
|- align="center"
 +
|colspan="13"|
 +
|- align="center"
 +
! 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
 +
|- align="center"
 +
! MISSION[74-75]
 +
| 13 || 14 || 15 || 16 || 17 || 18 || 19 || 20 || 21 || 22 || 23 || 24
 +
|- align="center"
 +
|colspan="13"|
 +
|- align="center"
 +
! 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
 +
|- align="center"
 +
! MISSION[74-75]
 +
| 23 || 22 || 21 || 20 || 19 || 18 || 17 || 16 || 15 || 14 || 13 || 12
 +
|- align="center"
 +
|colspan="13"|
 +
|- align="center"
 +
! 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
 +
|- align="center"
 +
! 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:
 +
 
 +
{| class="wikitable" width="700"
 +
|- align="center"
 +
! MISSION[74-75] !! 0 !! 1 !! 2 !! 3 !! 4 !! 5 !! 6 !! 7 !! 8 !! 9 !! 10 !! 11 !! 12
 +
|- align="center"
 +
! BGLOB[0]
 +
| 16 || 16 || 16 || 16 || 16 || 16 || 16 || 16 || 16 || 16 || 12 || 8 || 4
 +
|- align="center"
 +
|colspan="14"|
 +
|- align="center"
 +
! MISSION[74-75] !! 13 !! 14 !! 15 !! 16 !! 17 !! 18 !! 19 !! 20 !! 21 !! 22 !! 23 !! 24
 +
|- align="center"
 +
! 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 [[User:Seb76|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.
  
The three other mission types (alien base assault, cydonia surface, cydonia underground base) set both BGLOB values to 16. TFTD colony surface missions act the same way.
 
  
 
==See Also==
 
==See Also==

Revision as of 02:32, 22 May 2011

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) and subtract 10 hours to get the UTC version. Add this to the mission location's time offset and you've got the current time at that location.


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.


See Also