MCPcopy Create free account
hub / github.com/TheForceEngine/TheForceEngine / updateTime

Function updateTime

TheForceEngine/TFE_DarkForces/time.cpp:55–91  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

53 }
54
55 void updateTime()
56 {
57 if (!s_pauseTimeUpdate)
58 {
59 s_timeAccum += TFE_System::getDeltaTime() * TIMER_FREQ;
60 }
61
62 Tick prevTick = s_curTick;
63
64 // Record Replay Ticks
65 if (TFE_Input::isRecording())
66 {
67 TFE_Input::saveTick();
68 }
69
70 // Either Playback Ticks or use the current time.
71 if (TFE_Input::isDemoPlayback())
72 {
73 TFE_Input::loadTick();
74 }
75 else
76 {
77 s_curTick = Tick(s_timeAccum);
78
79 s_curTickFract = 0;
80 if (TFE_Settings::getGraphicsSettings()->useSmoothDeltaTime)
81 {
82 s_curTickFract = fract16(floatToFixed16(s_timeAccum));
83 }
84 }
85 // Keep the original tick delta for animations.
86 fixed16_16 dt = div16(intToFixed16(s_curTick - prevTick), FIXED(TICKS_PER_SECOND));
87 for (s32 i = 0; i < 13; i++)
88 {
89 s_frameTicks[i] += mul16(dt, intToFixed16(i));
90 }
91 }
92} // TFE_DarkForces

Callers 1

loopGameMethod · 0.85

Calls 11

getDeltaTimeFunction · 0.85
isRecordingFunction · 0.85
saveTickFunction · 0.85
isDemoPlaybackFunction · 0.85
loadTickFunction · 0.85
getGraphicsSettingsFunction · 0.85
fract16Function · 0.85
floatToFixed16Function · 0.85
div16Function · 0.85
intToFixed16Function · 0.85
mul16Function · 0.85

Tested by

no test coverage detected