diff --git a/CMakeLists.txt b/CMakeLists.txt index 423fd47..d440e31 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -114,7 +114,6 @@ if(NOT MSVC) -Wall #-Wextra # TODO #-Wshadow # TODO - -Wno-sign-compare # TODO -Wno-multichar -Wno-unknown-pragmas -Werror=return-type diff --git a/src/MTypes.h b/src/MTypes.h index dd064d6..23cb1f8 100644 --- a/src/MTypes.h +++ b/src/MTypes.h @@ -6,13 +6,14 @@ /// John Stiles, 2002/10/14 /// +#pragma once -#ifndef __MTYPES__ -#define __MTYPES__ - +#include typedef signed char MBoolean; +typedef uint32_t MTicks; + struct MRGBColor { @@ -42,5 +43,3 @@ void UnionMRect( const MRect* a, const MRect* b, MRect* u ); void OffsetMRect( MRect* r, int x, int y ); unsigned char MPointInMRect( MPoint p, MRect* r ); - -#endif diff --git a/src/control.cpp b/src/control.cpp index 2aa67e4..b6a05df 100644 --- a/src/control.cpp +++ b/src/control.cpp @@ -14,7 +14,7 @@ int destinationX[2], destinationR[2]; signed char tempGrid[kGridAcross][kGridDown]; -int timeAI[2], timeMove[2]; +MTicks timeAI[2], timeMove[2]; MBoolean moveQuick[2]; AutoPatternPtr autoPattern = NULL; diff --git a/src/control.h b/src/control.h index 875e066..a86453e 100644 --- a/src/control.h +++ b/src/control.h @@ -17,7 +17,7 @@ void AutoControl( int player ); extern int destinationX[2], destinationR[2]; extern signed char tempGrid[kGridAcross][kGridDown]; -extern int timeAI[2]; +extern MTicks timeAI[2]; extern MBoolean moveQuick[2]; enum { diff --git a/src/gameticks.cpp b/src/gameticks.cpp index eac454d..b4551ac 100644 --- a/src/gameticks.cpp +++ b/src/gameticks.cpp @@ -3,10 +3,10 @@ #include #include "gameticks.h" -unsigned int baseTickCount, freezeTickCount; +MTicks baseTickCount, freezeTickCount; int freezeLevel; -unsigned int MTickCount() +MTicks MTickCount() { return (unsigned int ) ((float)SDL_GetTicks() * 0.06f); } diff --git a/src/gameticks.h b/src/gameticks.h index 9fcd08f..a5a4992 100644 --- a/src/gameticks.h +++ b/src/gameticks.h @@ -1,6 +1,8 @@ // gameticks.h -unsigned int MTickCount(); +#include "MTypes.h" + +MTicks MTickCount(); void InitGameTickCount( void ); void FreezeGameTickCount( void ); void UnfreezeGameTickCount( void ); diff --git a/src/graphics.cpp b/src/graphics.cpp index dd6498c..491ca61 100644 --- a/src/graphics.cpp +++ b/src/graphics.cpp @@ -163,7 +163,7 @@ void ShowTitle( void ) RetrieveResources( ); - int time = MTickCount() + 120; + MTicks time = MTickCount() + 120; DrawPICTInSurface( g_frontSurface, picTitle ); while( time > MTickCount() && !SDLU_Button() ) diff --git a/src/grays.cpp b/src/grays.cpp index 3f302ab..2f0ae58 100644 --- a/src/grays.cpp +++ b/src/grays.cpp @@ -20,7 +20,8 @@ int grays[2][kGridAcross], grayAir[2][kGridAcross]; int unallocatedGrays[2], lockGrays[2], rowBounce[2][kGridAcross], splat[2][kGridAcross]; -int blinkTime[2], blinkStage[2]; +MTicks blinkTime[2]; +int blinkStage[2]; const int blinkList[] = { kGrayNoBlink, kGrayBlink1, kGrayBlink2, kGrayBlink3, kGrayBlink2, kGrayBlink1 }; diff --git a/src/grays.h b/src/grays.h index dda50ea..76ac2fe 100644 --- a/src/grays.h +++ b/src/grays.h @@ -12,6 +12,7 @@ MBoolean BusyDroppingGrays( int player ); extern int grays[2][kGridAcross], grayAir[2][kGridAcross], graySpeed[2]; extern int unallocatedGrays[2], lockGrays[2], rowBounce[2][kGridAcross], splat[2][kGridAcross]; -extern int blinkTime[2], sunTime[2], blinkStage[2], sunStage[2]; +extern MTicks blinkTime[2]; +extern int blinkStage[2]; #define kTimeBetweenBlinks 120 diff --git a/src/hiscore.cpp b/src/hiscore.cpp index d39d55b..5203402 100644 --- a/src/hiscore.cpp +++ b/src/hiscore.cpp @@ -117,7 +117,8 @@ const char *highScoreRank; static void FadeScreen( SDL_Surface* hiScoreSurface, SDL_Surface* fadeSurface, int start, int end ) { - int skip, timer, frame, fade, color, direction, fadeStart, fadeEnd; + MTicks timer; + int skip, frame, fade, color, direction, fadeStart, fadeEnd; SDL_Rect destSDLRect; SDL_Rect fullSDLRect = { 0, 0, 640, 480 }; int black; diff --git a/src/level.cpp b/src/level.cpp index 1f6482f..7cf3143 100644 --- a/src/level.cpp +++ b/src/level.cpp @@ -47,7 +47,7 @@ using std::max; const int startSkip = 1; static MBoolean shouldFullRepaint = false; -static int startMenuTime = 0; +static MTicks startMenuTime = 0; static int splatState[kNumSplats], splatColor[kNumSplats], splatSide[kNumSplats]; static MRect splatBlob[kNumSplats]; @@ -1084,7 +1084,8 @@ void SharewareVictory( void ) MRect bufferSrcRect = { 0, 50, 480, 350 }; MRect bufferDstRect = { 0, 0, 480, 300 }; MPoint dPoint = { 450, 50 }, lPoint, cPoint; - int scroll, ticks, x, y; + int scroll, x, y; + MTicks ticks; const char* text; int thisFade; const char fade[120] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, //0 @@ -1215,7 +1216,7 @@ void RegisteredVictory( void ) MPoint bubblePoint, textPoint, shadowPoint; MPoint setPoint[7][6]; MPoint msgSetPoint[7][2]; - int ticks; + MTicks ticks; int vertScroll, picture, weight, line, minimum; int scrollDir[] = {1, -1, 1, -1, 1, -1, -1}; int spacing[] = {40, 19, 19, 19, 23, 19, 23 }; diff --git a/src/main.cpp b/src/main.cpp index 26f4a28..43f5b5e 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -288,7 +288,7 @@ signed char nextA[2], nextB[2], nextM[2], nextG[2], colorA[2], colorB[2], blobX[2], blobY[2], blobR[2], blobSpin[2], speed[2], role[2], halfway[2], control[2], dropping[2], magic[2], grenade[2], anim[2]; int chain[2]; -int blobTime[2], startTime, endTime; +MTicks blobTime[2], startTime, endTime; MBoolean finished = false, pauseKey = false, showStartMenu = true; signed char grid[2][kGridAcross][kGridDown], suction[2][kGridAcross][kGridDown], charred[2][kGridAcross][kGridDown], glow[2][kGridAcross][kGridDown]; MRect playerWindowZRect, playerWindowRect[2]; @@ -642,7 +642,7 @@ void QuickFadeIn( MRGBColor *color ) if (fullscreen) { for( float percent=0.0f; percent<1.0f; percent += 0.04f ) { - int c = MTickCount( ); + MTicks c = MTickCount( ); SDLU_SetBrightness( percent ); while( c == MTickCount( ) ) { @@ -663,7 +663,7 @@ void QuickFadeOut( MRGBColor *color ) if (fullscreen) { for( float percent=1.0f; percent>0.0f; percent -= 0.04f ) { - int c = MTickCount( ); + MTicks c = MTickCount( ); SDLU_SetBrightness( percent ); while( c == MTickCount( ) ) { diff --git a/src/main.h b/src/main.h index 46c4e4e..73385a3 100644 --- a/src/main.h +++ b/src/main.h @@ -252,7 +252,7 @@ extern signed char nextA[2], nextB[2], nextM[2], nextG[2], colorA[2], colorB[2], blobX[2], blobY[2], blobR[2], blobSpin[2], speed[2], role[2], halfway[2], control[2], dropping[2], magic[2], grenade[2], anim[2]; extern int chain[2]; -extern int blobTime[2], startTime, endTime; +extern MTicks blobTime[2], startTime, endTime; extern MBoolean finished, pauseKey, showStartMenu; extern MBoolean fullscreen, widescreen, crispUpscaling; extern signed char grid[2][kGridAcross][kGridDown], suction[2][kGridAcross][kGridDown], diff --git a/src/next.cpp b/src/next.cpp index d8690ae..f486afd 100644 --- a/src/next.cpp +++ b/src/next.cpp @@ -20,7 +20,8 @@ SDL_Surface* nextDrawSurface; MRect nextWindowZRect, nextWindowRect[2]; MBoolean nextWindowVisible[2] = {true, true}; -int nextTime[2][2], nextStage[2][2], pullA[2], pullB[2]; +MTicks nextTime[2][2]; +int nextStage[2][2], pullA[2], pullB[2]; void InitNext( void ) { diff --git a/src/opponent.cpp b/src/opponent.cpp index c7d862d..4ef645d 100644 --- a/src/opponent.cpp +++ b/src/opponent.cpp @@ -23,7 +23,8 @@ SDL_Surface* opponentDrawSurface; MRect opponentWindowZRect, opponentWindowRect; int opponentMood, opponentFrame; -int opponentTime, glowTime[kGlows], glowFrame[kGlows], panicTime, panicFrame; +MTicks opponentTime, glowTime[kGlows], panicTime; +int glowFrame[kGlows], panicFrame; int heavyGlowArray[kGlowArraySize], glowArray[kGlowArraySize], lightGlowArray[kGlowArraySize]; void InitOpponent( void ) diff --git a/src/opponent.h b/src/opponent.h index 9c7fee5..bc4b40b 100644 --- a/src/opponent.h +++ b/src/opponent.h @@ -20,7 +20,8 @@ enum #define kGlowArraySize 30 extern int opponentMood, opponentFrame; -extern int opponentTime, glowTime[kGlows], glowFrame[kGlows], panicTime, panicFrame; +extern MTicks opponentTime, glowTime[kGlows], panicTime; +extern int glowFrame[kGlows], panicFrame; extern int glowArray[kGlowArraySize], lightGlowArray[kGlowArraySize]; extern MRect opponentWindowZRect, opponentWindowRect; diff --git a/src/pause.cpp b/src/pause.cpp index cef377d..29f78a7 100644 --- a/src/pause.cpp +++ b/src/pause.cpp @@ -48,7 +48,8 @@ SkittlesFontPtr smallFont, bigFont, dashedLineFont, continueFont, tinyFont, bats FRGBColor backColor[4]; MBoolean continueTimeOut; -static int dialogType, dialogStage, dialogTimer, dialogTarget, dialogShade, dialogItem; +static int dialogType, dialogStage, dialogTarget, dialogShade, dialogItem; +MTicks dialogTimer; static float colorWrap = 0, colorInc; static MRect logoRect = {0, 0, 111, 246}, lastPauseRect; static MBoolean dialogStageComplete; diff --git a/src/score.cpp b/src/score.cpp index 4f6a6a9..4929f37 100644 --- a/src/score.cpp +++ b/src/score.cpp @@ -21,7 +21,8 @@ SDL_Surface* numberMaskSurface; MRect scoreWindowZRect, scoreWindowRect[2]; MBoolean scoreWindowVisible[2] = {true, true}; -int roundStartScore[2], score[2], displayedScore[2], scoreTime[2]; +int roundStartScore[2], score[2], displayedScore[2]; +MTicks scoreTime[2]; const char characterList[] = { 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', diff --git a/src/tutorial.cpp b/src/tutorial.cpp index d26d821..4c3f6ec 100644 --- a/src/tutorial.cpp +++ b/src/tutorial.cpp @@ -315,7 +315,7 @@ SkittlesFontPtr balloonFont; MPoint balloonPt; char* balloonChar; char balloonMsg[256]; -int balloonTime, tutorialTime; +MTicks balloonTime, tutorialTime; SDL_Surface* balloonSurface = NULL; void InitTutorial( void ) diff --git a/src/tutorial.h b/src/tutorial.h index 3812d37..44549b8 100644 --- a/src/tutorial.h +++ b/src/tutorial.h @@ -24,7 +24,7 @@ typedef struct AutoPattern, *AutoPatternPtr; extern AutoPatternPtr autoPattern; -extern int tutorialTime; +extern MTicks tutorialTime; void InitTutorial( void ); void StartBalloon( const char *message ); diff --git a/src/tweak.cpp b/src/tweak.cpp index d39f52c..35ca4d8 100644 --- a/src/tweak.cpp +++ b/src/tweak.cpp @@ -10,7 +10,7 @@ #include "graphics.h" #include "players.h" -int xTweakTime[2], yTweakTime[2], rTweakTime[2]; +MTicks xTweakTime[2], yTweakTime[2], rTweakTime[2]; int yTweak[2], xTweak[2], xDirection[2], rTweak[2], rDirection[2]; int lastShadow[2]; int tweakOffsetX[4][11], tweakOffsetY[4][11]; diff --git a/src/victory.cpp b/src/victory.cpp index 4fd8bc5..b476547 100644 --- a/src/victory.cpp +++ b/src/victory.cpp @@ -27,7 +27,7 @@ #include #include -unsigned int winTime, loseTime; +MTicks winTime, loseTime; int winStage, loseStage; float drop[kGridAcross], last[kGridAcross]; SkittlesFontPtr victoryFont; @@ -88,7 +88,7 @@ void BeginVictory( int player ) void Lose( int player ) { - int gameTime = GameTickCount(); + MTicks gameTime = GameTickCount(); int skip = 1; MRect boardRect;