mirror of
https://github.com/MaSzyna-EU07/maszyna.git
synced 2026-07-18 05:29:18 +02:00
more deltatime hacking
This commit is contained in:
@@ -32,6 +32,8 @@ double GetTime()
|
||||
|
||||
double GetDeltaTime()
|
||||
{ // czas symulacji (stoi gdy pauza)
|
||||
if (override_delta != -1.0f)
|
||||
return override_delta;
|
||||
return DeltaTime;
|
||||
}
|
||||
|
||||
@@ -79,10 +81,7 @@ void UpdateTimers(bool pause)
|
||||
else
|
||||
DeltaTime = 0.0; // wszystko stoi, bo czas nie płynie
|
||||
|
||||
if (override_delta != -1.0f)
|
||||
DeltaTime = override_delta;
|
||||
|
||||
fSimulationTime += DeltaTime;
|
||||
fSimulationTime += GetDeltaTime();
|
||||
|
||||
oldCount = count;
|
||||
// Keep track of the time lapse and frame count
|
||||
|
||||
@@ -174,6 +174,8 @@ eu07_application::run() {
|
||||
//
|
||||
// trivia: being client and server is possible
|
||||
|
||||
double frameStartTime = Timer::GetTime();
|
||||
|
||||
bool nextloop = true;
|
||||
while (nextloop)
|
||||
{
|
||||
@@ -229,6 +231,14 @@ eu07_application::run() {
|
||||
|
||||
double sync = generate_sync();
|
||||
|
||||
// if we're the server
|
||||
if (m_network && m_network->servers)
|
||||
{
|
||||
// send delta, sync, and commands we just executed to clients
|
||||
double delta = Timer::GetDeltaTime();
|
||||
m_network->servers->push_delta(delta, sync, commands_to_exec);
|
||||
}
|
||||
|
||||
// if we're slave
|
||||
if (m_network && m_network->client)
|
||||
{
|
||||
@@ -236,14 +246,10 @@ eu07_application::run() {
|
||||
if (sync != slave_sync) {
|
||||
WriteLog("net: DESYNC!", logtype::net);
|
||||
}
|
||||
}
|
||||
|
||||
// if we're the server
|
||||
if (m_network && m_network->servers)
|
||||
{
|
||||
// send delta, sync, and commands we just executed to clients
|
||||
double delta = Timer::GetDeltaTime();
|
||||
m_network->servers->push_delta(delta, sync, commands_to_exec);
|
||||
// set total delta for rendering code
|
||||
double totalDelta = Timer::GetTime() - frameStartTime;
|
||||
Timer::set_delta_override(totalDelta);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user