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:
onpon4 2015-03-31 15:23:17 -04:00
parent 47fb2dc82a
commit 0e1cd4b86f
4 changed files with 31 additions and 19 deletions

View File

@ -553,7 +553,7 @@ int mainGameLoop()
engine.keyState[KEY_FIRE] = 0;
engine.keyState[KEY_ALTFIRE] = 0;
LIMIT_ADD(engine.musicVolume, -0.2, 0, 100);
audio_setMusicVolume((int)engine.musicVolume);
audio_setMusicVolume(engine.musicVolume);
}
else
{
@ -568,7 +568,7 @@ int mainGameLoop()
else
{
LIMIT_ADD(engine.musicVolume, -0.2, 0, 100);
audio_setMusicVolume((int)engine.musicVolume);
audio_setMusicVolume(engine.musicVolume);
if (SDL_GetTicks() >= engine.missionCompleteTimer)
{
engine.done = 1;

View File

@ -41,7 +41,7 @@ void initVars()
if (engine.useAudio)
{
Mix_Volume(-1, 100);
Mix_VolumeMusic((int)engine.musicVolume);
Mix_VolumeMusic(engine.musicVolume);
}
}

View File

@ -130,14 +130,15 @@ bool loadGame(int slot)
void saveGame(int slot)
{
FILE *fp;
char fileName[PATH_MAX];
if ((slot < 0) || (slot > 5))
{
printf("Error - Saves may only be 0 to 5\n");
return;
}
FILE *fp;
char fileName[PATH_MAX];
sprintf(fileName, "%ssave%.2d.dat", engine.userHomeDirectory, slot);
fp = fopen(fileName, "wb");
@ -167,10 +168,10 @@ void saveGame(int slot)
void createSavesSurface(SDL_Surface *savesSurface, signed char clickedSlot)
{
blevelRect(savesSurface, 0, 0, 348, 298, 0x00, 0x00, 0x00);
int y = 10;
blevelRect(savesSurface, 0, 0, 348, 298, 0x00, 0x00, 0x00);
for (int i = 1 ; i <= 5 ; i++)
{
if (clickedSlot == 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 clickedSlot = -1;
SDL_Rect r;
r.x = 201;
r.y = 115;
r.w = 348;
r.h = 25;
int clickedSlot = -1;
if ((engine.keyState[KEY_FIRE]))
{
for (int i = 1 ; i <= 5 ; i++)

View File

@ -124,26 +124,37 @@ struct Game {
object thePlayer;
object playerWeapon;
int saveFormat;
int difficulty;
int system;
int area;
int musicVolume;
int sfxVolume;
int saveFormat;
int difficulty;
int cash;
int cashEarned;
int shots;
int hits;
int accuracy;
int hasWingMate1, hasWingMate2;
int totalKills, wingMate1Kills, wingMate2Kills;
int wingMate1Ejects, wingMate2Ejects;
int hasWingMate1;
int hasWingMate2;
int totalKills;
int wingMate1Kills;
int wingMate2Kills;
int wingMate1Ejects;
int wingMate2Ejects;
int totalOtherKills;
int secondaryMissions, secondaryMissionsCompleted;
int shieldPickups, rocketPickups, cellPickups, powerups, minesKilled, cargoPickups;
int secondaryMissions;
int secondaryMissionsCompleted;
int shieldPickups;
int rocketPickups;
int cellPickups;
int powerups;
int minesKilled;
int cargoPickups;
// slaves for Eyananth
int slavesRescued;
@ -151,7 +162,7 @@ struct Game {
// remaining shield for experimental fighter
int experimentalShield;
int timeTaken; // In seconds
long int timeTaken; // In seconds
int missionCompleted[10];
int stationedPlanet;
@ -271,7 +282,7 @@ struct globalEngineVariables {
// Times the mission normally
Uint32 counter2;
int timeTaken; // In seconds
long int timeTaken; // In seconds
// For missions with a time limit
int timeMission;