Initial import of Red Planet v4.10 Win32 source
Imports the current Win32 source for the pod-racing game 'Red Planet', built on the MUNGA engine and its L4 (Win32/DirectX) platform layer: - MUNGA / MUNGA_L4: cross-platform engine core and Win32 backend - RP / RP_L4: Red Planet game logic and Win32 application - DivLoader, Setup1: asset loader and installer project - lib, MUNGA_L4/openal, MUNGA_L4/sos: third-party audio dependencies Removed stale Subversion metadata and added .gitignore/.gitattributes. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
+117
@@ -0,0 +1,117 @@
|
||||
#include "munga.h"
|
||||
#pragma hdrstop
|
||||
|
||||
#include "time.h"
|
||||
|
||||
//#############################################################################
|
||||
//########################### System Clock ##############################
|
||||
//#############################################################################
|
||||
|
||||
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
//
|
||||
void SystemClock::TogglePause()
|
||||
{
|
||||
//
|
||||
//--------------------------------------------------------------------
|
||||
// If the clock is currently paused, figure out how long it was paused
|
||||
// and add that to the pause delay
|
||||
//--------------------------------------------------------------------
|
||||
//
|
||||
if (timer.pauseStart)
|
||||
{
|
||||
timer.pauseTime += GetRTC() - timer.pauseStart;
|
||||
timer.pauseStart = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
//--------------------------------------------------------
|
||||
// Otherwise, start pausing by marking what time it is now
|
||||
//--------------------------------------------------------
|
||||
timer.pauseStart = GetRTC();
|
||||
}
|
||||
}
|
||||
|
||||
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
//
|
||||
volatile Time& Now()
|
||||
{
|
||||
static Time result;
|
||||
|
||||
//
|
||||
//-------------------------------------------------
|
||||
// If we are in pause mode, return the paused clock
|
||||
//-------------------------------------------------
|
||||
//
|
||||
if (SystemClock::timer.pauseStart)
|
||||
{
|
||||
result = SystemClock::timer.pauseStart;
|
||||
}
|
||||
else
|
||||
{
|
||||
//----------------------------------------------------------------
|
||||
// Otherwise, return the timer minus the amount of pause time lost
|
||||
//----------------------------------------------------------------
|
||||
result = SystemClock::GetRTC() - SystemClock::timer.pauseTime;
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
double HiResNow()
|
||||
{
|
||||
return SystemClock::GetHiRes();
|
||||
}
|
||||
|
||||
__int64 HiResNowTicks()
|
||||
{
|
||||
return SystemClock::GetHiResTicks();
|
||||
}
|
||||
|
||||
__int64 HiResCounterFreq()
|
||||
{
|
||||
return SystemClock::perfCounterFreq;
|
||||
}
|
||||
//#############################################################################
|
||||
//############################### Time ##################################
|
||||
//#############################################################################
|
||||
|
||||
Time Time::Null(SystemClock::timer);
|
||||
|
||||
#if defined(USE_SIGNATURE)
|
||||
int Is_Signature_Bad(const volatile Time *)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
#endif
|
||||
|
||||
//
|
||||
//#############################################################################
|
||||
//#############################################################################
|
||||
//
|
||||
Logical Time::TestInstance() const volatile
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Time functions ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
//
|
||||
//#############################################################################
|
||||
//#############################################################################
|
||||
//
|
||||
void Convert_From_Ascii(const char *str, Time *time)
|
||||
{
|
||||
Check_Pointer(str);
|
||||
Check_Signature(time);
|
||||
|
||||
Scalar seconds;
|
||||
|
||||
seconds = atof(str);
|
||||
*time = seconds;
|
||||
Check(time);
|
||||
}
|
||||
|
||||
#if defined(TEST_CLASS)
|
||||
#include "time.tcp"
|
||||
#endif
|
||||
Reference in New Issue
Block a user