Skip to content

Commit f35d3e7

Browse files
committed
Add variables to give more granular control of the geoscape time display & event queue
1 parent 0e4913b commit f35d3e7

4 files changed

Lines changed: 88 additions & 25 deletions

File tree

X2WOTCCommunityHighlander/Config/XComGame.ini

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -291,6 +291,13 @@ iMixedCharacterPoolChance = 50
291291
;bForce24hClock = true
292292
;bForce24hClockLeadingZero = true
293293

294+
; Issue #1578 - Uncomment to force UTC Time with TimeZone Display, or only update the localized timezone when the skyranger takes off or lands
295+
; Use bShowEventQueueWhileFlying to display the event queue on the geoscape at all times
296+
;bUseSourceTimeZoneWhenFlying = true
297+
;bUseDestinationTimeZoneWhenFlying = true
298+
;bForceUTCAtAllTimes = true
299+
;bShowEventQueueWhileFlying = true
300+
294301
;;; HL-Docs: ref:PositiveTraitUI
295302
; Uncomment the following line to show UIAlerts at the end of a mission and on campaign start for all Traits instead of just the first one.
296303
; bShowAllTraitAcquiredPopups = true

X2WOTCCommunityHighlander/Src/XComGame/Classes/CHHelpers.uc

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -276,6 +276,12 @@ var config bool InterruptionsTriggerGroupTurnBegunEvent;
276276
var config bool bForce24hClock;
277277
var config bool bForce24hclockLeadingZero;
278278

279+
// Start Issue #1578 - Variables to adjust Geoscape behaviour when flying
280+
var config bool bUseSourceTimeZoneWhenFlying;
281+
var config bool bUseDestinationTimeZoneWhenFlying;
282+
var config bool bForceUTCAtAllTimes;
283+
var config bool bShowEventQueueWhileFlying;
284+
279285
// Variable for Issue #1398 - Number of seconds to wait after a unit is killed before playing the 'OnSquadMemberDead' voiceline
280286
var config float fSquadMemberDeadVoicelineDelay;
281287

@@ -1168,4 +1174,5 @@ static function bool GeoscapeReadyForUpdate()
11681174
StrategyMap != none &&
11691175
StrategyMap.m_eUIState != eSMS_Flight &&
11701176
StrategyMap.Movie.Pres.ScreenStack.GetCurrentScreen() == StrategyMap;
1171-
}
1177+
}
1178+

X2WOTCCommunityHighlander/Src/XComGame/Classes/UIEventQueue.uc

Lines changed: 67 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -88,8 +88,8 @@ simulated function UpdateEventQueue(array<HQEvent> Events, bool bExpand, bool En
8888
}
8989

9090
bIsInStrategyMap = `ScreenStack.IsInStack(class'UIStrategyMap');
91-
92-
if (Events.Length > 0 && !bIsInStrategyMap || (`HQPRES.StrategyMap2D != none && `HQPRES.StrategyMap2D.m_eUIState != eSMS_Flight))
91+
// Single Line for Issue #1578 - Allow mods to display the event queue while flying
92+
if (Events.Length > 0 && !bIsInStrategyMap || (`HQPRES.StrategyMap2D != none && (class'CHHelpers'.default.bShowEventQueueWhileFlying || `HQPRES.StrategyMap2D.m_eUIState != eSMS_Flight)))
9393
{
9494
if( bIsExpanded )
9595
{
@@ -156,10 +156,15 @@ simulated function UpdateEventQueue(array<HQEvent> Events, bool bExpand, bool En
156156
}
157157

158158
function RefreshDateTime()
159-
{
159+
{
160160
local TDateTime dateTimeData;
161-
local string Hours, Minutes, Suffix;
162-
local XComGameState_HeadquartersXCom XComHQ;
161+
local string Hours, Minutes, Suffix;
162+
local XComGameState_HeadquartersXCom XComHQ;
163+
// Variables for Issue #1578
164+
local TDateTime UTCTimeData;
165+
local string UTCHours, UTCMinutes, UTCSuffix;
166+
local int timeZoneDifference;
167+
local XComGameState_GeoscapeEntity DestinationEntity;
163168

164169
if( `GAME.GetGeoscape() == none ) return; // stop log spam when in the shell testing.
165170

@@ -170,23 +175,67 @@ function RefreshDateTime()
170175

171176
//When showing time, either through time of day or the clock - always show local time
172177
dateTimeData = `GAME.GetGeoscape().m_kDateTime;
173-
174-
//Don't adjust to local time while the base is in flight as it looks nicer for the clock to update smoothly
178+
UTCTimeData = dateTimeData;
175179
XComHQ = XComGameState_HeadquartersXCom(`XCOMHISTORY.GetSingleGameStateObjectForClass(class'XComGameState_HeadquartersXCom'));
176-
if(!XComHQ.Flying)
180+
181+
// Start Issue #1578
182+
/// HL-Docs: feature:GeoscapeClockOptions; issue:1578; tags:strategy
183+
/// Provide easily adjustable options for display of the Geoscape time by modders, to make the time display more intuitive
184+
/// when the skyranger is flying (in this case, options are: 1. The timezone is only updated when the avenger lands,
185+
/// 2. The timezone is updated only when the skyranger takes off, 3. Display UTC at all times and display the timezone
186+
/// difference on the clock UI.
187+
if(!class'CHHelpers'.default.bForceUTCAtAllTimes)
188+
{
189+
// Base Game
190+
if(!XComHQ.Flying)
191+
{
192+
class'X2StrategyGameRulesetDataStructures'.static.GetLocalizedTime(XComHQ.Get2DLocation(), dateTimeData);
193+
}
194+
// Option 1
195+
else if(class'CHHelpers'.default.bUseSourceTimeZoneWhenFlying)
196+
{
197+
class'X2StrategyGameRulesetDataStructures'.static.GetLocalizedTime(XComHQ.SourceLocation, dateTimeData);
198+
}
199+
// Option 2
200+
else if(class'CHHelpers'.default.bUseDestinationTimeZoneWhenFlying)
201+
{
202+
DestinationEntity = XComGameState_GeoscapeEntity(`XCOMHISTORY.GetGameStateForObjectID(XComHQ.SelectedDestination.ObjectID));
203+
class'X2StrategyGameRulesetDataStructures'.static.GetLocalizedTime(DestinationEntity.Get2DLocation(), dateTimeData);
204+
}
205+
class'X2StrategyGameRulesetDataStructures'.static.GetTimeStringSeparated(dateTimeData, Hours, Minutes, Suffix);
206+
207+
MC.BeginFunctionOp("RefreshDateTime");
208+
MC.QueueString(class'X2StrategyGameRulesetDataStructures'.static.GetDateString(dateTimeData));
209+
//RED: //MC.QueueString(class'UIUtilities_Text'.static.GetColoredText(class'X2StrategyGameRulesetDataStructures'.static.GetTimeString(dateTimeData), eUIState_IsGeoscapePaused));
210+
MC.QueueString(Hours);
211+
MC.QueueString(Minutes);
212+
MC.QueueString(Suffix);
213+
MC.EndOp();
214+
}
215+
else
177216
{
217+
// Option 3
178218
class'X2StrategyGameRulesetDataStructures'.static.GetLocalizedTime(XComHQ.Get2DLocation(), dateTimeData);
219+
class'X2StrategyGameRulesetDataStructures'.static.GetTimeStringSeparated(UTCTimeData, UTCHours, UTCMinutes, UTCSuffix);
220+
timeZoneDifference = class'X2StrategyGameRulesetDataStructures'.static.GetHour(dateTimeData) - class'X2StrategyGameRulesetDataStructures'.static.GetHour(UTCTimeData);
221+
222+
if (timeZoneDifference < -12)
223+
{
224+
timeZoneDifference += 24;
225+
}
226+
else if (timeZoneDifference > 12)
227+
{
228+
timeZoneDifference -= 24;
229+
}
230+
231+
MC.BeginFunctionOp("RefreshDateTime");
232+
MC.QueueString(class'X2StrategyGameRulesetDataStructures'.static.GetDateString(UTCTimeData));
233+
MC.QueueString(UTCHours);
234+
MC.QueueString(UTCMinutes);
235+
MC.QueueString(timeZoneDifference >=0 ? "+" @ string(timeZoneDifference) : string(timeZoneDifference));
236+
MC.EndOp();
179237
}
180-
181-
class'X2StrategyGameRulesetDataStructures'.static.GetTimeStringSeparated(dateTimeData, Hours, Minutes, Suffix);
182-
183-
MC.BeginFunctionOp("RefreshDateTime");
184-
MC.QueueString(class'X2StrategyGameRulesetDataStructures'.static.GetDateString(dateTimeData));
185-
//RED: //MC.QueueString(class'UIUtilities_Text'.static.GetColoredText(class'X2StrategyGameRulesetDataStructures'.static.GetTimeString(dateTimeData), eUIState_IsGeoscapePaused));
186-
MC.QueueString(Hours);
187-
MC.QueueString(Minutes);
188-
MC.QueueString(Suffix);
189-
MC.EndOp();
238+
// End Issue #1578
190239
}
191240

192241
simulated function HideDateTime()

X2WOTCCommunityHighlander/Src/XComGame/Classes/X2StrategyGameRulesetDataStructures.uc

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1571,7 +1571,7 @@ static function GetTimeStringSeparated(TDateTime kDateTime, out string Hours, ou
15711571
/// Allow forcing the 24h clock independently of locale and add an option to display leading zeroes for military-style time - e.g. 03:41 instead of 3:41
15721572

15731573
// INT and ESN use the 12 hour clock for events, checked with Loc 12/15/2015. -bsteiner
1574-
if( !class'CHHelpers'.default.bForce24hclock && (Lang == "INT" || Lang == "ESN"))
1574+
if( !class'CHHelpers'.default.bForce24hclock && !class'CHHelpers'.default.bForceUTCAtAllTimes && (Lang == "INT" || Lang == "ESN"))
15751575
{
15761576
// AM
15771577
if( iHour < 12 )
@@ -1853,12 +1853,12 @@ static function GetLocalizedTime( vector2d v2Loc, out TDateTime kDate )
18531853
iHourDiff -= iXMT;
18541854
}
18551855
1856-
AddTime(kDate, iHourDiff*60*60);
1856+
AddTime(kDate, iHourDiff*60*60);
18571857
1858-
if( kDate.m_fTime < 0 )
1859-
{
1860-
kDate.m_fTime += 24*60*60;
1861-
}
1858+
if( kDate.m_fTime < 0 )
1859+
{
1860+
kDate.m_fTime += 24*60*60;
1861+
}
18621862
}
18631863
18641864
// Time has always been treated as GMT, but we adjust your base (visually) so that the game start at midnight "GMT" (let's call it XMT)

0 commit comments

Comments
 (0)