main.c : Unused variables
gamelib/ : FRACT->float and simplifications frame.c : Indent git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@1657 4a71c877-e1ca-e34f-864e-861f7616d084master
parent
892287d4f4
commit
7812d1635a
|
@ -150,32 +150,32 @@ void frameSetCursorFromRes(SWORD resID)
|
|||
|
||||
static void initCursors(void)
|
||||
{
|
||||
aCursors[CURSOR_ARROW - CURSOR_OFFSET] = init_system_cursor(cursor_arrow);
|
||||
aCursors[CURSOR_DEST - CURSOR_OFFSET] = init_system_cursor(cursor_dest);
|
||||
aCursors[CURSOR_SIGHT - CURSOR_OFFSET] = init_system_cursor(cursor_sight);
|
||||
aCursors[CURSOR_TARGET - CURSOR_OFFSET] = init_system_cursor(cursor_target);
|
||||
aCursors[CURSOR_LARROW - CURSOR_OFFSET] = init_system_cursor(cursor_larrow);
|
||||
aCursors[CURSOR_RARROW - CURSOR_OFFSET] = init_system_cursor(cursor_rarrow);
|
||||
aCursors[CURSOR_DARROW - CURSOR_OFFSET] = init_system_cursor(cursor_darrow);
|
||||
aCursors[CURSOR_UARROW - CURSOR_OFFSET] = init_system_cursor(cursor_uarrow);
|
||||
aCursors[CURSOR_DEFAULT - CURSOR_OFFSET] = init_system_cursor(cursor_default);
|
||||
aCursors[CURSOR_EDGEOFMAP - CURSOR_OFFSET] = init_system_cursor(cursor_default);
|
||||
aCursors[CURSOR_ATTACH - CURSOR_OFFSET] = init_system_cursor(cursor_attach);
|
||||
aCursors[CURSOR_ATTACK - CURSOR_OFFSET] = init_system_cursor(cursor_attack);
|
||||
aCursors[CURSOR_BOMB - CURSOR_OFFSET] = init_system_cursor(cursor_bomb);
|
||||
aCursors[CURSOR_BRIDGE - CURSOR_OFFSET] = init_system_cursor(cursor_bridge);
|
||||
aCursors[CURSOR_BUILD - CURSOR_OFFSET] = init_system_cursor(cursor_build);
|
||||
aCursors[CURSOR_EMBARK - CURSOR_OFFSET] = init_system_cursor(cursor_embark);
|
||||
aCursors[CURSOR_FIX - CURSOR_OFFSET] = init_system_cursor(cursor_fix);
|
||||
aCursors[CURSOR_GUARD - CURSOR_OFFSET] = init_system_cursor(cursor_guard);
|
||||
aCursors[CURSOR_JAM - CURSOR_OFFSET] = init_system_cursor(cursor_jam);
|
||||
aCursors[CURSOR_LOCKON - CURSOR_OFFSET] = init_system_cursor(cursor_lockon);
|
||||
aCursors[CURSOR_MENU - CURSOR_OFFSET] = init_system_cursor(cursor_menu);
|
||||
aCursors[CURSOR_MOVE - CURSOR_OFFSET] = init_system_cursor(cursor_move);
|
||||
aCursors[CURSOR_NOTPOSSIBLE - CURSOR_OFFSET] = init_system_cursor(cursor_notpossible);
|
||||
aCursors[CURSOR_PICKUP - CURSOR_OFFSET] = init_system_cursor(cursor_pickup);
|
||||
aCursors[CURSOR_SEEKREPAIR - CURSOR_OFFSET] = init_system_cursor(cursor_seekrepair);
|
||||
aCursors[CURSOR_SELECT - CURSOR_OFFSET] = init_system_cursor(cursor_select);
|
||||
aCursors[CURSOR_ARROW - CURSOR_OFFSET] = init_system_cursor(cursor_arrow);
|
||||
aCursors[CURSOR_DEST - CURSOR_OFFSET] = init_system_cursor(cursor_dest);
|
||||
aCursors[CURSOR_SIGHT - CURSOR_OFFSET] = init_system_cursor(cursor_sight);
|
||||
aCursors[CURSOR_TARGET - CURSOR_OFFSET] = init_system_cursor(cursor_target);
|
||||
aCursors[CURSOR_LARROW - CURSOR_OFFSET] = init_system_cursor(cursor_larrow);
|
||||
aCursors[CURSOR_RARROW - CURSOR_OFFSET] = init_system_cursor(cursor_rarrow);
|
||||
aCursors[CURSOR_DARROW - CURSOR_OFFSET] = init_system_cursor(cursor_darrow);
|
||||
aCursors[CURSOR_UARROW - CURSOR_OFFSET] = init_system_cursor(cursor_uarrow);
|
||||
aCursors[CURSOR_DEFAULT - CURSOR_OFFSET] = init_system_cursor(cursor_default);
|
||||
aCursors[CURSOR_EDGEOFMAP - CURSOR_OFFSET] = init_system_cursor(cursor_default);
|
||||
aCursors[CURSOR_ATTACH - CURSOR_OFFSET] = init_system_cursor(cursor_attach);
|
||||
aCursors[CURSOR_ATTACK - CURSOR_OFFSET] = init_system_cursor(cursor_attack);
|
||||
aCursors[CURSOR_BOMB - CURSOR_OFFSET] = init_system_cursor(cursor_bomb);
|
||||
aCursors[CURSOR_BRIDGE - CURSOR_OFFSET] = init_system_cursor(cursor_bridge);
|
||||
aCursors[CURSOR_BUILD - CURSOR_OFFSET] = init_system_cursor(cursor_build);
|
||||
aCursors[CURSOR_EMBARK - CURSOR_OFFSET] = init_system_cursor(cursor_embark);
|
||||
aCursors[CURSOR_FIX - CURSOR_OFFSET] = init_system_cursor(cursor_fix);
|
||||
aCursors[CURSOR_GUARD - CURSOR_OFFSET] = init_system_cursor(cursor_guard);
|
||||
aCursors[CURSOR_JAM - CURSOR_OFFSET] = init_system_cursor(cursor_jam);
|
||||
aCursors[CURSOR_LOCKON - CURSOR_OFFSET] = init_system_cursor(cursor_lockon);
|
||||
aCursors[CURSOR_MENU - CURSOR_OFFSET] = init_system_cursor(cursor_menu);
|
||||
aCursors[CURSOR_MOVE - CURSOR_OFFSET] = init_system_cursor(cursor_move);
|
||||
aCursors[CURSOR_NOTPOSSIBLE - CURSOR_OFFSET] = init_system_cursor(cursor_notpossible);
|
||||
aCursors[CURSOR_PICKUP - CURSOR_OFFSET] = init_system_cursor(cursor_pickup);
|
||||
aCursors[CURSOR_SEEKREPAIR - CURSOR_OFFSET] = init_system_cursor(cursor_seekrepair);
|
||||
aCursors[CURSOR_SELECT - CURSOR_OFFSET] = init_system_cursor(cursor_select);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -28,15 +28,10 @@
|
|||
|
||||
#include <time.h>
|
||||
|
||||
//#define DEBUG_GROUP1
|
||||
#include "lib/framework/frame.h"
|
||||
#include "gtime.h"
|
||||
|
||||
|
||||
#define TIME_FIX
|
||||
|
||||
//#define RATE_LIMIT
|
||||
|
||||
#define GTIME_MINFRAME (GAME_TICKS_PER_SEC/80)
|
||||
|
||||
/* The current time in the game world */
|
||||
|
@ -53,7 +48,7 @@ UDWORD frameTime2;
|
|||
|
||||
|
||||
// the current clock modifier
|
||||
static FRACT modifier;
|
||||
static float modifier;
|
||||
|
||||
|
||||
// the amount of game time before the last time clock speed was set
|
||||
|
@ -84,9 +79,7 @@ BOOL gameTimeInit(void)
|
|||
timeOffset2 = 0;
|
||||
baseTime2 = baseTime;
|
||||
|
||||
|
||||
modifier = FRACTCONST(1,1);
|
||||
|
||||
modifier = 1.0f;
|
||||
|
||||
stopCount = 0;
|
||||
|
||||
|
@ -115,57 +108,35 @@ UDWORD div1,div2;
|
|||
/* Call this each loop to update the game timer */
|
||||
void gameTimeUpdate(void)
|
||||
{
|
||||
UDWORD currTime, fpMod;
|
||||
#ifdef TIME_FIX
|
||||
Uint64 newTime;
|
||||
Uint64 extraTime;
|
||||
#else
|
||||
unsigned long long newTime;
|
||||
#endif
|
||||
|
||||
currTime = SDL_GetTicks();
|
||||
unsigned int currTime = SDL_GetTicks();
|
||||
unsigned long long newTime;
|
||||
|
||||
//don't update the game time if gameTimeStop has been called
|
||||
if (stopCount == 0)
|
||||
{
|
||||
// Calculate the new game time
|
||||
newTime = currTime - baseTime;
|
||||
|
||||
// convert the modifier to fixed point cos we loose accuracy
|
||||
fpMod = MAKEINT(FRACTmul(modifier, FRACTCONST(1000,1)));
|
||||
|
||||
newTime = newTime * fpMod / 1000;
|
||||
|
||||
newTime += timeOffset;
|
||||
newTime = ( currTime - baseTime ) * modifier + timeOffset;
|
||||
|
||||
// Calculate the time for this frame
|
||||
frameTime = (UDWORD)(newTime - gameTime);
|
||||
frameTime = (newTime - gameTime);
|
||||
|
||||
// Limit the frame time
|
||||
if (frameTime > GTIME_MAXFRAME)
|
||||
{
|
||||
#ifdef TIME_FIX
|
||||
extraTime = frameTime - GTIME_MAXFRAME;
|
||||
extraTime = extraTime * 1000 / fpMod;//adjust the addition to base time
|
||||
baseTime += (UDWORD)extraTime;
|
||||
#else
|
||||
baseTime += frameTime - GTIME_MAXFRAME;
|
||||
#endif
|
||||
baseTime += ( frameTime - GTIME_MAXFRAME ) / modifier; // adjust the addition to base time
|
||||
newTime = gameTime + GTIME_MAXFRAME;
|
||||
frameTime = GTIME_MAXFRAME;
|
||||
}
|
||||
|
||||
// Store the game time
|
||||
gameTime = (UDWORD)newTime;
|
||||
gameTime = newTime;
|
||||
}
|
||||
|
||||
// now update gameTime2 which does not pause
|
||||
newTime = currTime - baseTime2;
|
||||
|
||||
newTime += timeOffset;
|
||||
newTime = currTime - baseTime2 + timeOffset;
|
||||
|
||||
// Calculate the time for this frame
|
||||
frameTime2 = (UDWORD)newTime - gameTime2;
|
||||
frameTime2 = newTime - gameTime2;
|
||||
|
||||
// Limit the frame time
|
||||
if (frameTime2 > GTIME_MAXFRAME)
|
||||
|
@ -176,7 +147,7 @@ void gameTimeUpdate(void)
|
|||
}
|
||||
|
||||
// Store the game time
|
||||
gameTime2 = (UDWORD)newTime;
|
||||
gameTime2 = newTime;
|
||||
}
|
||||
|
||||
|
||||
|
@ -189,18 +160,18 @@ void gameTimeResetMod(void)
|
|||
baseTime = SDL_GetTicks();
|
||||
baseTime2 = SDL_GetTicks();
|
||||
|
||||
modifier = FRACTCONST(1,1);
|
||||
modifier = 1.0f;
|
||||
}
|
||||
|
||||
// set the time modifier
|
||||
void gameTimeSetMod(FRACT mod)
|
||||
void gameTimeSetMod(float mod)
|
||||
{
|
||||
gameTimeResetMod();
|
||||
modifier = mod;
|
||||
}
|
||||
|
||||
// get the current time modifier
|
||||
void gameTimeGetMod(FRACT *pMod)
|
||||
void gameTimeGetMod(float *pMod)
|
||||
{
|
||||
*pMod = modifier;
|
||||
}
|
||||
|
@ -253,8 +224,7 @@ void gameTimeReset(UDWORD time)
|
|||
baseTime2 = SDL_GetTicks();
|
||||
|
||||
|
||||
modifier = FRACTCONST(1,1);
|
||||
|
||||
modifier = 1.0f;
|
||||
}
|
||||
|
||||
void getTimeComponents(UDWORD time, UDWORD *hours, UDWORD *minutes, UDWORD *seconds)
|
||||
|
|
|
@ -25,17 +25,11 @@
|
|||
#define _gtime_h
|
||||
|
||||
/* The number of ticks per second for the game clock */
|
||||
#ifdef WIN32
|
||||
#define GAME_TICKS_PER_SEC 1000
|
||||
#else
|
||||
#define GAME_TICKS_PER_SEC 1000
|
||||
|
||||
|
||||
#endif
|
||||
#define GAME_TICKS_PER_SEC 1000
|
||||
|
||||
// The maximum time for one frame (stops the clock running away when debugging)
|
||||
// changed to /6 by ajl. if this needs to go back to ticks/10 then tell me.
|
||||
#define GTIME_MAXFRAME (GAME_TICKS_PER_SEC/6)
|
||||
// changed to /6 by ajl. if this needs to go back to ticks/10 then tell me.
|
||||
#define GTIME_MAXFRAME (GAME_TICKS_PER_SEC/6)
|
||||
|
||||
/* The current time in the game world */
|
||||
extern UDWORD gameTime;
|
||||
|
@ -71,16 +65,16 @@ extern void gameTimeReset(UDWORD time);
|
|||
// reset the game time modifiers
|
||||
void gameTimeResetMod(void);
|
||||
// set the time modifier
|
||||
void gameTimeSetMod(FRACT mod);
|
||||
void gameTimeSetMod(float mod);
|
||||
// get the current time modifier
|
||||
void gameTimeGetMod(FRACT *pMod);
|
||||
void gameTimeGetMod(float *pMod);
|
||||
|
||||
/* Useful for periodical stuff */
|
||||
/* Will return a number that climbs over tickFrequency game ticks and ends up in the required range. */
|
||||
/*
|
||||
/*
|
||||
For instance getTimeValueRange(4096,256) will return a number that cycles through
|
||||
the values 0..256 every 4.096 seconds...
|
||||
Ensure that the first is an integer multiple of the second
|
||||
Ensure that the first is an integer multiple of the second
|
||||
*/
|
||||
extern UDWORD getTimeValueRange(UDWORD tickFrequency, UDWORD requiredRange);
|
||||
extern UDWORD getStaticTimeValueRange(UDWORD tickFrequency, UDWORD requiredRange);
|
||||
|
|
14
src/main.c
14
src/main.c
|
@ -89,10 +89,8 @@ char * multiplay_mods[MAX_MODS] = { NULL };
|
|||
// Warzone 2100 . Pumpkin Studios
|
||||
|
||||
//flag to indicate when initialisation is complete
|
||||
BOOL videoInitialised = FALSE;
|
||||
BOOL gameInitialised = FALSE;
|
||||
BOOL frontendInitialised = FALSE;
|
||||
BOOL bDisableLobby;
|
||||
BOOL bDisableLobby = FALSE;
|
||||
char SaveGamePath[MAX_PATH];
|
||||
char ScreenDumpPath[MAX_PATH];
|
||||
char MultiForcesPath[MAX_PATH];
|
||||
|
@ -427,9 +425,6 @@ static void startTitleLoop(void)
|
|||
exit(EXIT_FAILURE);
|
||||
}
|
||||
frontendInitVars();
|
||||
|
||||
// set a flag for the trigger/event system to indicate initialisation is complete
|
||||
frontendInitialised = TRUE;
|
||||
}
|
||||
|
||||
|
||||
|
@ -444,7 +439,6 @@ static void stopTitleLoop(void)
|
|||
debug( LOG_ERROR, "Shutting down after failure" );
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
frontendInitialised = FALSE;
|
||||
}
|
||||
|
||||
|
||||
|
@ -686,8 +680,6 @@ static void mainLoop(void)
|
|||
|
||||
if (focusState == FOCUS_IN)
|
||||
{
|
||||
gameTimeUpdate(); // Update gametime. FIXME There is probably code duplicated with MaintainFrameStuff
|
||||
|
||||
if (loop_GetVideoStatus())
|
||||
videoLoop(); // Display the video if neccessary
|
||||
else switch (GetGameMode())
|
||||
|
@ -702,6 +694,8 @@ static void mainLoop(void)
|
|||
break;
|
||||
}
|
||||
|
||||
gameTimeUpdate(); // Update gametime. FIXME There is probably code duplicated with MaintainFrameStuff
|
||||
|
||||
frameUpdate(); // General housekeeping
|
||||
}
|
||||
|
||||
|
@ -776,8 +770,6 @@ int main(int argc, char *argv[])
|
|||
|
||||
debug(LOG_MAIN, "initializing");
|
||||
|
||||
bDisableLobby = FALSE;
|
||||
|
||||
loadConfig();
|
||||
atexit( closeConfig );
|
||||
loadRenderMode(); //get the registry entry for clRendMode
|
||||
|
|
Loading…
Reference in New Issue