Separated single player and multiplayer frame rate limits. Single player is set to 60 fps and is configurable. Multiplayer fps limit is set to 45 and is hardcoded so that people will not cheat without knowing it.

git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@4565 4a71c877-e1ca-e34f-864e-861f7616d084
master
Roman C 2008-04-11 21:40:38 +00:00
parent 5c368bae76
commit 1e62c71165
3 changed files with 48 additions and 4 deletions

View File

@ -62,6 +62,34 @@
extern void registry_clear(void); // from configfile.c
void setSinglePlayerFrameLimit (SDWORD limit);
SDWORD getSinglePlayerFrameLimit (void);
void setDefaultFrameRateLimit (void);
// current frame limit for single player modes
SDWORD spFrameLimit = SP_FRAME_LIMIT;
void setSinglePlayerFrameLimit(SDWORD limit)
{
spFrameLimit = limit;
}
SDWORD getSinglePlayerFrameLimit(void)
{
return spFrameLimit;
}
void setDefaultFrameRateLimit(void)
{
if(bMultiPlayer && NetPlay.bComms)
{
setFramerateLimit(MP_FRAME_LIMIT); // true multiplayer
}
else
{
setFramerateLimit(getSinglePlayerFrameLimit()); // single player
}
}
// ////////////////////////////////////////////////////////////////////////////
BOOL loadConfig(void)
@ -120,14 +148,15 @@ BOOL loadConfig(void)
setWarzoneKeyNumeric("debugmode", bAllowDebugMode);
}
if (getWarzoneKeyNumeric("framerate", &val))
if (getWarzoneKeyNumeric("SinglePlayerFPS", &val))
{
setFramerateLimit(val);
setSinglePlayerFrameLimit(val);
setFramerateLimit(getSinglePlayerFrameLimit());
}
else
{
setFramerateLimit(60);
setWarzoneKeyNumeric("framerate", 60);
setFramerateLimit(getSinglePlayerFrameLimit());
setWarzoneKeyNumeric("SinglePlayerFPS", getSinglePlayerFrameLimit());
}
if (getWarzoneKeyString("language", sBuf))

View File

@ -28,5 +28,16 @@ extern BOOL loadConfig(void);
extern BOOL loadRenderMode(void);
extern BOOL saveConfig(void);
extern void closeConfig( void );
extern void setSinglePlayerFrameLimit(SDWORD limit);
extern SDWORD getSinglePlayerFrameLimit(void);
extern void setDefaultFrameRateLimit(void);
/* Frame limit for multiplayer games (excluding skirmish and campaign) */
#define MP_FRAME_LIMIT 45
/* Default frame limit for single player: skirmish ans campaign */
#define SP_FRAME_LIMIT 60
extern SDWORD spFrameLimit;
#endif // __INCLUDED_SRC_CONFIGURATION_H__

View File

@ -66,6 +66,7 @@
#include "main.h"
#include "wrappers.h"
#include "version.h"
#include "configuration.h"
static int StartWithGame = 1; // New game starts in Cam 1.
@ -219,6 +220,9 @@ void changeTitleMode(tMode mode)
break;
}
/* Set default frame rate limit */
setDefaultFrameRateLimit();
return;
}