game.cpp

Engine/source/app/game.cpp

More...

Public Variables

Public Functions

bool
clientProcess(U32 timeDelta)

Processes the next frame, including gui, rendering, and tick interpolation.

ConsoleFunctionGroupBegin(InputManagement , "Functions that let you deal with input from scripts" )
ConsoleFunctionGroupBegin(Platform , "General platform functions." )
ConsoleFunctionGroupEnd(InputManagement )
DefineEngineFunction(activateDirectInput , void , () , "()" "@brief Activates <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">DirectInput.\n\n</a>" "Also activates any connected joysticks." "@ingroup <a href="/coding/class/classinput/">Input</a>" )
DefineEngineFunction(closeNetPort , void , () , "()" "@brief Closes the current network <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">port\n\n</a>" "@ingroup Networking" )
DefineEngineFunction(deactivateDirectInput , void , () , "()" "@brief Disables <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">DirectInput.\n\n</a>" "Also deactivates any connected <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">joysticks.\n\n</a>" "@ingroup <a href="/coding/class/classinput/">Input</a>" )
DefineEngineFunction(getLocalTime , const char * , () , "@brief Return the current local time as: weekday month day year hour min <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">sec.\n\n</a>" "Local time is platform defined." "@ingroup Platform" )
DefineEngineFunction(getRealTime , S32 , () , "()" "@brief Return the current real time in <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">milliseconds.\n\n</a>" "Real time is platform defined; typically time since the computer <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">booted.\n\n</a>" "@ingroup Platform" )
DefineEngineFunction(getSimTime , S32 , () , "()" "Return the current sim time in <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">milliseconds.\n\n</a>" "@brief Sim time is time since the game <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">started.\n\n</a>" "@ingroup Platform" )
DefineEngineFunction(isAddressTypeAvailable , bool , (int addressType) , "(protocol <a href="/coding/file/win32cursorcontroller_8cpp/#win32cursorcontroller_8cpp_1ab38592509822a5f4674447022cc62efe">id</a>)" "@brief Determines <a href="/coding/file/tsmeshintrinsics_8cpp/#tsmeshintrinsics_8cpp_1a4e4fa7e3399708e0777b5308db01278c">if</a> <a href="/coding/file/pointer_8h/#pointer_8h_1aeeddce917cf130d62c370b8f216026dd">a</a> specified address type can be <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">reached.\n\n</a>" "@ingroup Networking" )
DefineEngineFunction(lockMouse , void , (bool isLocked) , "(bool isLocked)" "@brief Lock or unlock the mouse <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> the <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">window.\n\n</a>" "When true, prevents the mouse from leaving the bounds of the game <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">window.\n\n</a>" " @ingroup <a href="/coding/class/classinput/">Input</a>" )
DefineEngineFunction(playJournal , void , (const char *filename) , "(string filename)" "@brief Begin playback of <a href="/coding/file/pointer_8h/#pointer_8h_1aeeddce917cf130d62c370b8f216026dd">a</a> journal from <a href="/coding/file/pointer_8h/#pointer_8h_1aeeddce917cf130d62c370b8f216026dd">a</a> specified <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">field.\n\n</a>" "@param filename Name and path of <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1a702945180aa732857b380a007a7e2a21">file</a> journal <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">file\n</a>" "@ingroup Platform" )
DefineEngineFunction(saveJournal , void , (const char *filename) , "(string filename)" "Save the journal <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> the specified <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">file.\n\n</a>" "@ingroup Platform" )
DefineEngineFunction(setNetPort , bool , (int port, bool bind) , (true) , "(int port, bool bind=true)" "@brief Set the network port <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1a2732ab74fa0237854c2ba0f75f88a624">for</a> the game <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">use.\n\n</a>" "@param port The port <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">use.\n</a>" "@param bind True <a href="/coding/file/tsmeshintrinsics_8cpp/#tsmeshintrinsics_8cpp_1a4e4fa7e3399708e0777b5308db01278c">if</a> bind() should be called on the <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">port.\n</a>" "@returns True <a href="/coding/file/tsmeshintrinsics_8cpp/#tsmeshintrinsics_8cpp_1a4e4fa7e3399708e0777b5308db01278c">if</a> the port was successfully <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">opened.\n</a>" "This will trigger <a href="/coding/file/pointer_8h/#pointer_8h_1aeeddce917cf130d62c370b8f216026dd">a</a> windows firewall prompt. " "If you don'<a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1aded116371789db1fd63c90ef00c95a3d">t</a> have firewall tunneling tech you can set this <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> false <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> avoid the <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">prompt.\n\n</a>" "@ingroup Networking" )
DefineEngineFunction(strToPlayerName , const char * , (const char *ptr) , "strToPlayerName(string);" )
bool
serverProcess(U32 timeDelta)

Processes the next cycle on the server. This function will only have an effect when executed on the server.

Detailed Description

Public Variables

const U32 MaxPlayerNameLength 

Public Functions

clientProcess(U32 timeDelta)

Processes the next frame, including gui, rendering, and tick interpolation.

This function will only have an effect when executed on the client.

ConsoleFunctionGroupBegin(InputManagement , "Functions that let you deal with input from scripts" )

ConsoleFunctionGroupBegin(Platform , "General platform functions." )

ConsoleFunctionGroupEnd(InputManagement )

ConsoleFunctionGroupEnd(Platform )

DefineEngineFunction(activateDirectInput , void , () , "()" "@brief Activates <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">DirectInput.\n\n</a>" "Also activates any connected joysticks." "@ingroup <a href="/coding/class/classinput/">Input</a>" )

DefineEngineFunction(closeNetPort , void , () , "()" "@brief Closes the current network <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">port\n\n</a>" "@ingroup Networking" )

DefineEngineFunction(deactivateDirectInput , void , () , "()" "@brief Disables <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">DirectInput.\n\n</a>" "Also deactivates any connected <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">joysticks.\n\n</a>" "@ingroup <a href="/coding/class/classinput/">Input</a>" )

DefineEngineFunction(getLocalTime , const char * , () , "@brief Return the current local time as: weekday month day year hour min <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">sec.\n\n</a>" "Local time is platform defined." "@ingroup Platform" )

DefineEngineFunction(getRealTime , S32 , () , "()" "@brief Return the current real time in <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">milliseconds.\n\n</a>" "Real time is platform defined; typically time since the computer <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">booted.\n\n</a>" "@ingroup Platform" )

DefineEngineFunction(getSimTime , S32 , () , "()" "Return the current sim time in <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">milliseconds.\n\n</a>" "@brief Sim time is time since the game <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">started.\n\n</a>" "@ingroup Platform" )

DefineEngineFunction(isAddressTypeAvailable , bool , (int addressType) , "(protocol <a href="/coding/file/win32cursorcontroller_8cpp/#win32cursorcontroller_8cpp_1ab38592509822a5f4674447022cc62efe">id</a>)" "@brief Determines <a href="/coding/file/tsmeshintrinsics_8cpp/#tsmeshintrinsics_8cpp_1a4e4fa7e3399708e0777b5308db01278c">if</a> <a href="/coding/file/pointer_8h/#pointer_8h_1aeeddce917cf130d62c370b8f216026dd">a</a> specified address type can be <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">reached.\n\n</a>" "@ingroup Networking" )

DefineEngineFunction(lockMouse , void , (bool isLocked) , "(bool isLocked)" "@brief Lock or unlock the mouse <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> the <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">window.\n\n</a>" "When true, prevents the mouse from leaving the bounds of the game <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">window.\n\n</a>" " @ingroup <a href="/coding/class/classinput/">Input</a>" )

DefineEngineFunction(playJournal , void , (const char *filename) , "(string filename)" "@brief Begin playback of <a href="/coding/file/pointer_8h/#pointer_8h_1aeeddce917cf130d62c370b8f216026dd">a</a> journal from <a href="/coding/file/pointer_8h/#pointer_8h_1aeeddce917cf130d62c370b8f216026dd">a</a> specified <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">field.\n\n</a>" "@param filename Name and path of <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1a702945180aa732857b380a007a7e2a21">file</a> journal <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">file\n</a>" "@ingroup Platform" )

DefineEngineFunction(saveJournal , void , (const char *filename) , "(string filename)" "Save the journal <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> the specified <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">file.\n\n</a>" "@ingroup Platform" )

DefineEngineFunction(setNetPort , bool , (int port, bool bind) , (true) , "(int port, bool bind=true)" "@brief Set the network port <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1a2732ab74fa0237854c2ba0f75f88a624">for</a> the game <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">use.\n\n</a>" "@param port The port <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">use.\n</a>" "@param bind True <a href="/coding/file/tsmeshintrinsics_8cpp/#tsmeshintrinsics_8cpp_1a4e4fa7e3399708e0777b5308db01278c">if</a> bind() should be called on the <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">port.\n</a>" "@returns True <a href="/coding/file/tsmeshintrinsics_8cpp/#tsmeshintrinsics_8cpp_1a4e4fa7e3399708e0777b5308db01278c">if</a> the port was successfully <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">opened.\n</a>" "This will trigger <a href="/coding/file/pointer_8h/#pointer_8h_1aeeddce917cf130d62c370b8f216026dd">a</a> windows firewall prompt. " "If you don'<a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1aded116371789db1fd63c90ef00c95a3d">t</a> have firewall tunneling tech you can set this <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> false <a href="/coding/file/cmdgram_8cpp/#cmdgram_8cpp_1a5bafda9519252aa2d0fd038153f77dca">to</a> avoid the <a href="/coding/file/cmdscan_8cpp/#cmdscan_8cpp_1aeab71244afb687f16d8c4f5ee9d6ef0e">prompt.\n\n</a>" "@ingroup Networking" )

DefineEngineFunction(strToPlayerName , const char * , (const char *ptr) , "strToPlayerName(string);" )

serverProcess(U32 timeDelta)

Processes the next cycle on the server. This function will only have an effect when executed on the server.

  1
  2//-----------------------------------------------------------------------------
  3// Copyright (c) 2012 GarageGames, LLC
  4//
  5// Permission is hereby granted, free of charge, to any person obtaining a copy
  6// of this software and associated documentation files (the "Software"), to
  7// deal in the Software without restriction, including without limitation the
  8// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
  9// sell copies of the Software, and to permit persons to whom the Software is
 10// furnished to do so, subject to the following conditions:
 11//
 12// The above copyright notice and this permission notice shall be included in
 13// all copies or substantial portions of the Software.
 14//
 15// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
 16// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
 17// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
 18// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
 19// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
 20// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
 21// IN THE SOFTWARE.
 22//-----------------------------------------------------------------------------
 23
 24//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~//
 25// Arcane-FX for MIT Licensed Open Source version of Torque 3D from GarageGames
 26// Copyright (C) 2015 Faust Logic, Inc.
 27//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~//
 28
 29#include "platform/platform.h"
 30#include "platform/platformInput.h"
 31
 32#include "app/game.h"
 33#include "math/mMath.h"
 34#include "core/dnet.h"
 35#include "core/stream/fileStream.h"
 36#include "core/frameAllocator.h"
 37#include "core/iTickable.h"
 38#include "core/strings/findMatch.h"
 39#include "console/simBase.h"
 40#include "console/console.h"
 41#include "console/consoleTypes.h"
 42#include "console/engineAPI.h"
 43#include "gui/controls/guiMLTextCtrl.h"
 44#ifdef TORQUE_TGB_ONLY
 45#include "T2D/oldModel/networking/t2dGameConnection.h"
 46#include "T2D/oldModel/networking/t2dNetworkServerSceneProcess.h"
 47#include "T2D/oldModel/networking/t2dNetworkClientSceneProcess.h"
 48#else
 49#include "T3D/gameBase/gameConnection.h"
 50#include "T3D/gameFunctions.h"
 51#include "T3D/gameBase/gameProcess.h"
 52#endif
 53#include "platform/profiler.h"
 54#include "gfx/gfxCubemap.h"
 55#include "gfx/gfxTextureManager.h"
 56#include "sfx/sfxSystem.h"
 57
 58#ifdef TORQUE_AFX_ENABLED
 59#include "afx/arcaneFX.h"
 60#endif
 61
 62#ifdef TORQUE_PLAYER
 63// See matching #ifdef in editor/editor.cpp
 64bool gEditingMission = false;
 65#endif
 66
 67//--------------------------------------------------------------------------
 68
 69ConsoleFunctionGroupBegin( InputManagement, "Functions that let you deal with input from scripts" );
 70
 71DefineEngineFunction( deactivateDirectInput, void, (), ,
 72         "()"
 73            "@brief Disables DirectInput.\n\n"
 74            "Also deactivates any connected joysticks.\n\n"
 75         "@ingroup Input" )
 76{
 77   if ( Input::isActive() )
 78      Input::deactivate();
 79}
 80
 81DefineEngineFunction( activateDirectInput, void, (), ,
 82            "()"
 83            "@brief Activates DirectInput.\n\n"
 84            "Also activates any connected joysticks."
 85         "@ingroup Input")
 86{
 87   if ( !Input::isActive() )
 88      Input::activate();
 89}
 90ConsoleFunctionGroupEnd( InputManagement );
 91
 92//--------------------------------------------------------------------------
 93
 94static const U32 MaxPlayerNameLength = 16;
 95DefineEngineFunction( strToPlayerName, const char*, (const char* ptr ), , "strToPlayerName(string);" )
 96{
 97
 98   // Strip leading spaces and underscores:
 99   while ( *ptr == ' ' || *ptr == '_' )
100      ptr++;
101
102   U32 len = dStrlen( ptr );
103   if ( len )
104   {
105      char* ret = Con::getReturnBuffer( MaxPlayerNameLength + 1 );
106      char* rptr = ret;
107      ret[MaxPlayerNameLength - 1] = '\0';
108      ret[MaxPlayerNameLength] = '\0';
109      bool space = false;
110
111      U8 ch;
112      while ( *ptr && dStrlen( ret ) < MaxPlayerNameLength )
113      {
114         ch = (U8) *ptr;
115
116         // Strip all illegal characters:
117         if ( ch < 32 || ch == ',' || ch == '.' || ch == '\'' || ch == '`' )
118         {
119            ptr++;
120            continue;
121         }
122
123         // Don't allow double spaces or space-underline combinations:
124         if ( ch == ' ' || ch == '_' )
125         {
126            if ( space )
127            {
128               ptr++;
129               continue;
130            }
131            else
132               space = true;
133         }
134         else
135            space = false;
136
137         *rptr++ = *ptr;
138         ptr++;
139      }
140      *rptr = '\0';
141
142      //finally, strip out the ML text control chars...
143      return GuiMLTextCtrl::stripControlChars(ret);
144   }
145
146   return( "" );
147}
148
149ConsoleFunctionGroupBegin( Platform , "General platform functions.");
150
151DefineEngineFunction( lockMouse, void, (bool isLocked ), , "(bool isLocked)"
152            "@brief Lock or unlock the mouse to the window.\n\n"
153            "When true, prevents the mouse from leaving the bounds of the game window.\n\n"
154            "@ingroup Input")
155{
156   Platform::setWindowLocked(isLocked);
157}
158
159
160DefineEngineFunction( setNetPort, bool, (int port, bool bind), (true), "(int port, bool bind=true)" 
161   "@brief Set the network port for the game to use.\n\n"
162
163   "@param port The port to use.\n"
164   "@param bind True if bind() should be called on the port.\n"
165
166   "@returns True if the port was successfully opened.\n"
167
168   "This will trigger a windows firewall prompt.  "
169   "If you don't have firewall tunneling tech you can set this to false to avoid the prompt.\n\n"
170   "@ingroup Networking")
171{
172   return Net::openPort((S32)port, bind);
173}
174
175DefineEngineFunction(isAddressTypeAvailable, bool, (int addressType), , "(protocol id)"
176   "@brief Determines if a specified address type can be reached.\n\n"
177   "@ingroup Networking")
178{
179   return Net::isAddressTypeAvailable((NetAddress::Type)addressType);
180}
181
182DefineEngineFunction( closeNetPort, void, (), , "()" 
183   "@brief Closes the current network port\n\n"
184   "@ingroup Networking")
185{
186   Net::closePort();
187}
188
189DefineEngineFunction( saveJournal, void, (const char * filename), , "(string filename)" 
190                "Save the journal to the specified file.\n\n"
191            "@ingroup Platform")
192{
193   Journal::Record(filename);
194}
195
196DefineEngineFunction( playJournal, void, (const char * filename), , "(string filename)" 
197                "@brief Begin playback of a journal from a specified field.\n\n"
198            "@param filename Name and path of file journal file\n"
199            "@ingroup Platform")
200{
201   // CodeReview - BJG 4/24/2007 - The break flag needs to be wired back in.
202   // bool jBreak = (argc > 2)? dAtob(argv[2]): false;
203   Journal::Play(filename);
204}
205
206DefineEngineFunction( getSimTime, S32, (), , "()" 
207            "Return the current sim time in milliseconds.\n\n"
208                "@brief Sim time is time since the game started.\n\n"
209            "@ingroup Platform")
210{
211   return Sim::getCurrentTime();
212}
213
214DefineEngineFunction( getRealTime, S32, (), , "()" 
215            "@brief Return the current real time in milliseconds.\n\n"
216                "Real time is platform defined; typically time since the computer booted.\n\n"
217            "@ingroup Platform")
218{
219   return Platform::getRealMilliseconds();
220}
221
222DefineEngineFunction(getLocalTime, const char*, (),,
223   "@brief Return the current local time as: weekday month day year hour min sec.\n\n"
224   "Local time is platform defined."
225   "@ingroup Platform")
226{
227   Platform::LocalTime lt;
228   Platform::getLocalTime(lt);
229
230   static const U32 bufSize = 128;
231   char *retBuffer = Con::getReturnBuffer(bufSize);
232   dSprintf(retBuffer, bufSize, "%d %d %d %d %02d %02d %02d",
233      lt.weekday,
234      lt.month + 1,
235      lt.monthday,
236      lt.year + 1900,
237      lt.hour,
238      lt.min,
239      lt.sec);
240
241   return retBuffer;
242}
243
244ConsoleFunctionGroupEnd(Platform);
245
246//-----------------------------------------------------------------------------
247
248bool clientProcess(U32 timeDelta)
249{
250#ifdef TORQUE_AFX_ENABLED
251   // Required heartbeat call on the client side which must come
252   // before the advanceTime() calls are made to the scene objects.
253   arcaneFX::advanceTime(timeDelta);
254#endif
255   bool ret = true;
256
257#ifndef TORQUE_TGB_ONLY
258   ret = ClientProcessList::get()->advanceTime(timeDelta);
259#else
260   ret = gt2dNetworkClientProcess.advanceTime( timeDelta );
261#endif
262
263   ITickable::advanceTime(timeDelta);
264
265#ifndef TORQUE_TGB_ONLY
266   // Determine if we're lagging
267   GameConnection* connection = GameConnection::getConnectionToServer();
268   if(connection)
269   {
270      connection->detectLag();
271   }
272#else
273   // Determine if we're lagging
274   t2dGameConnection* connection = t2dGameConnection::getConnectionToServer();
275   if(connection)
276   {
277      connection->detectLag();
278   }
279#endif
280
281   // Let SFX process.
282   SFX->_update();
283
284   return ret;
285}
286
287bool serverProcess(U32 timeDelta)
288{
289   bool ret = true;
290#ifndef TORQUE_TGB_ONLY
291   ret =  ServerProcessList::get()->advanceTime(timeDelta);
292#else
293   ret =  gt2dNetworkServerProcess.advanceTime( timeDelta );
294#endif
295   return ret;
296}
297
298