Changed timeTaken from int to long int.
This guarantees that it will be able to store at least about 68 years.
This commit is contained in:
parent
47fb2dc82a
commit
0e1cd4b86f
|
@ -553,7 +553,7 @@ int mainGameLoop()
|
||||||
engine.keyState[KEY_FIRE] = 0;
|
engine.keyState[KEY_FIRE] = 0;
|
||||||
engine.keyState[KEY_ALTFIRE] = 0;
|
engine.keyState[KEY_ALTFIRE] = 0;
|
||||||
LIMIT_ADD(engine.musicVolume, -0.2, 0, 100);
|
LIMIT_ADD(engine.musicVolume, -0.2, 0, 100);
|
||||||
audio_setMusicVolume((int)engine.musicVolume);
|
audio_setMusicVolume(engine.musicVolume);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -568,7 +568,7 @@ int mainGameLoop()
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
LIMIT_ADD(engine.musicVolume, -0.2, 0, 100);
|
LIMIT_ADD(engine.musicVolume, -0.2, 0, 100);
|
||||||
audio_setMusicVolume((int)engine.musicVolume);
|
audio_setMusicVolume(engine.musicVolume);
|
||||||
if (SDL_GetTicks() >= engine.missionCompleteTimer)
|
if (SDL_GetTicks() >= engine.missionCompleteTimer)
|
||||||
{
|
{
|
||||||
engine.done = 1;
|
engine.done = 1;
|
||||||
|
|
|
@ -41,7 +41,7 @@ void initVars()
|
||||||
if (engine.useAudio)
|
if (engine.useAudio)
|
||||||
{
|
{
|
||||||
Mix_Volume(-1, 100);
|
Mix_Volume(-1, 100);
|
||||||
Mix_VolumeMusic((int)engine.musicVolume);
|
Mix_VolumeMusic(engine.musicVolume);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -130,14 +130,15 @@ bool loadGame(int slot)
|
||||||
|
|
||||||
void saveGame(int slot)
|
void saveGame(int slot)
|
||||||
{
|
{
|
||||||
|
FILE *fp;
|
||||||
|
char fileName[PATH_MAX];
|
||||||
|
|
||||||
if ((slot < 0) || (slot > 5))
|
if ((slot < 0) || (slot > 5))
|
||||||
{
|
{
|
||||||
printf("Error - Saves may only be 0 to 5\n");
|
printf("Error - Saves may only be 0 to 5\n");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
FILE *fp;
|
|
||||||
char fileName[PATH_MAX];
|
|
||||||
sprintf(fileName, "%ssave%.2d.dat", engine.userHomeDirectory, slot);
|
sprintf(fileName, "%ssave%.2d.dat", engine.userHomeDirectory, slot);
|
||||||
fp = fopen(fileName, "wb");
|
fp = fopen(fileName, "wb");
|
||||||
|
|
||||||
|
@ -167,9 +168,9 @@ void saveGame(int slot)
|
||||||
|
|
||||||
void createSavesSurface(SDL_Surface *savesSurface, signed char clickedSlot)
|
void createSavesSurface(SDL_Surface *savesSurface, signed char clickedSlot)
|
||||||
{
|
{
|
||||||
blevelRect(savesSurface, 0, 0, 348, 298, 0x00, 0x00, 0x00);
|
int y = 10;
|
||||||
|
|
||||||
int y = 10;
|
blevelRect(savesSurface, 0, 0, 348, 298, 0x00, 0x00, 0x00);
|
||||||
|
|
||||||
for (int i = 1 ; i <= 5 ; i++)
|
for (int i = 1 ; i <= 5 ; i++)
|
||||||
{
|
{
|
||||||
|
@ -225,14 +226,14 @@ so that the function invoking it can perform a load or save on that slot.
|
||||||
*/
|
*/
|
||||||
int showSaveSlots(SDL_Surface *savesSurface, signed char saveSlot)
|
int showSaveSlots(SDL_Surface *savesSurface, signed char saveSlot)
|
||||||
{
|
{
|
||||||
|
int clickedSlot = -1;
|
||||||
|
|
||||||
SDL_Rect r;
|
SDL_Rect r;
|
||||||
r.x = 201;
|
r.x = 201;
|
||||||
r.y = 115;
|
r.y = 115;
|
||||||
r.w = 348;
|
r.w = 348;
|
||||||
r.h = 25;
|
r.h = 25;
|
||||||
|
|
||||||
int clickedSlot = -1;
|
|
||||||
|
|
||||||
if ((engine.keyState[KEY_FIRE]))
|
if ((engine.keyState[KEY_FIRE]))
|
||||||
{
|
{
|
||||||
for (int i = 1 ; i <= 5 ; i++)
|
for (int i = 1 ; i <= 5 ; i++)
|
||||||
|
|
|
@ -124,26 +124,37 @@ struct Game {
|
||||||
object thePlayer;
|
object thePlayer;
|
||||||
object playerWeapon;
|
object playerWeapon;
|
||||||
|
|
||||||
|
int saveFormat;
|
||||||
|
|
||||||
|
int difficulty;
|
||||||
|
|
||||||
int system;
|
int system;
|
||||||
int area;
|
int area;
|
||||||
int musicVolume;
|
int musicVolume;
|
||||||
int sfxVolume;
|
int sfxVolume;
|
||||||
|
|
||||||
int saveFormat;
|
|
||||||
int difficulty;
|
|
||||||
|
|
||||||
int cash;
|
int cash;
|
||||||
int cashEarned;
|
int cashEarned;
|
||||||
|
|
||||||
int shots;
|
int shots;
|
||||||
int hits;
|
int hits;
|
||||||
int accuracy;
|
int accuracy;
|
||||||
int hasWingMate1, hasWingMate2;
|
int hasWingMate1;
|
||||||
int totalKills, wingMate1Kills, wingMate2Kills;
|
int hasWingMate2;
|
||||||
int wingMate1Ejects, wingMate2Ejects;
|
int totalKills;
|
||||||
|
int wingMate1Kills;
|
||||||
|
int wingMate2Kills;
|
||||||
|
int wingMate1Ejects;
|
||||||
|
int wingMate2Ejects;
|
||||||
int totalOtherKills;
|
int totalOtherKills;
|
||||||
int secondaryMissions, secondaryMissionsCompleted;
|
int secondaryMissions;
|
||||||
int shieldPickups, rocketPickups, cellPickups, powerups, minesKilled, cargoPickups;
|
int secondaryMissionsCompleted;
|
||||||
|
int shieldPickups;
|
||||||
|
int rocketPickups;
|
||||||
|
int cellPickups;
|
||||||
|
int powerups;
|
||||||
|
int minesKilled;
|
||||||
|
int cargoPickups;
|
||||||
|
|
||||||
// slaves for Eyananth
|
// slaves for Eyananth
|
||||||
int slavesRescued;
|
int slavesRescued;
|
||||||
|
@ -151,7 +162,7 @@ struct Game {
|
||||||
// remaining shield for experimental fighter
|
// remaining shield for experimental fighter
|
||||||
int experimentalShield;
|
int experimentalShield;
|
||||||
|
|
||||||
int timeTaken; // In seconds
|
long int timeTaken; // In seconds
|
||||||
int missionCompleted[10];
|
int missionCompleted[10];
|
||||||
|
|
||||||
int stationedPlanet;
|
int stationedPlanet;
|
||||||
|
@ -271,7 +282,7 @@ struct globalEngineVariables {
|
||||||
|
|
||||||
// Times the mission normally
|
// Times the mission normally
|
||||||
Uint32 counter2;
|
Uint32 counter2;
|
||||||
int timeTaken; // In seconds
|
long int timeTaken; // In seconds
|
||||||
|
|
||||||
// For missions with a time limit
|
// For missions with a time limit
|
||||||
int timeMission;
|
int timeMission;
|
||||||
|
|
Loading…
Reference in New Issue