ref: d919168adb92b103e1196a753b5e5f52b3026c83
parent: fe1e1357ce329cbe71847a82d9bf56c9440f4512
author: Iliyas Jorio <iliyas@jor.io>
date: Wed Feb 2 19:32:45 EST 2022
MTicks type
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -114,7 +114,6 @@
-Wall
#-Wextra # TODO
#-Wshadow # TODO
- -Wno-sign-compare # TODO
-Wno-multichar
-Wno-unknown-pragmas
-Werror=return-type
--- a/src/MTypes.h
+++ b/src/MTypes.h
@@ -6,14 +6,15 @@
/// John Stiles, 2002/10/14
///
+#pragma once
-#ifndef __MTYPES__
-#define __MTYPES__
+#include <cstdint>
-
typedef signed char MBoolean;
+typedef uint32_t MTicks;
+
struct MRGBColor
{
unsigned short red;
@@ -42,5 +43,3 @@
void OffsetMRect( MRect* r, int x, int y );
unsigned char MPointInMRect( MPoint p, MRect* r );
-
-#endif
--- 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;
--- a/src/control.h
+++ b/src/control.h
@@ -17,7 +17,7 @@
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
{
--- a/src/gameticks.cpp
+++ b/src/gameticks.cpp
@@ -3,10 +3,10 @@
#include <SDL_timer.h>
#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);
}
--- 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 );
--- a/src/graphics.cpp
+++ b/src/graphics.cpp
@@ -163,7 +163,7 @@
RetrieveResources( );
- int time = MTickCount() + 120;
+ MTicks time = MTickCount() + 120;
DrawPICTInSurface( g_frontSurface, picTitle );
while( time > MTickCount() && !SDLU_Button() )
--- 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 };
--- a/src/grays.h
+++ b/src/grays.h
@@ -12,6 +12,7 @@
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
--- a/src/hiscore.cpp
+++ b/src/hiscore.cpp
@@ -117,7 +117,8 @@
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;
--- a/src/level.cpp
+++ b/src/level.cpp
@@ -47,7 +47,7 @@
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 @@
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 @@
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 };
binary files a/src/main.cpp b/src/main.cpp differ
--- a/src/main.h
+++ b/src/main.h
@@ -252,7 +252,7 @@
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],
--- a/src/next.cpp
+++ b/src/next.cpp
@@ -20,7 +20,8 @@
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 )
{
--- a/src/opponent.cpp
+++ b/src/opponent.cpp
@@ -23,7 +23,8 @@
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 )
--- a/src/opponent.h
+++ b/src/opponent.h
@@ -20,7 +20,8 @@
#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;
--- a/src/pause.cpp
+++ b/src/pause.cpp
@@ -48,7 +48,8 @@
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;
--- a/src/score.cpp
+++ b/src/score.cpp
@@ -21,7 +21,8 @@
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',
--- a/src/tutorial.cpp
+++ b/src/tutorial.cpp
@@ -315,7 +315,7 @@
MPoint balloonPt;
char* balloonChar;
char balloonMsg[256];
-int balloonTime, tutorialTime;
+MTicks balloonTime, tutorialTime;
SDL_Surface* balloonSurface = NULL;
void InitTutorial( void )
--- a/src/tutorial.h
+++ b/src/tutorial.h
@@ -24,7 +24,7 @@
AutoPattern, *AutoPatternPtr;
extern AutoPatternPtr autoPattern;
-extern int tutorialTime;
+extern MTicks tutorialTime;
void InitTutorial( void );
void StartBalloon( const char *message );
--- 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];
--- a/src/victory.cpp
+++ b/src/victory.cpp
@@ -27,7 +27,7 @@
#include <stdio.h>
#include <string.h>
-unsigned int winTime, loseTime;
+MTicks winTime, loseTime;
int winStage, loseStage;
float drop[kGridAcross], last[kGridAcross];
SkittlesFontPtr victoryFont;
@@ -88,7 +88,7 @@
void Lose( int player )
{
- int gameTime = GameTickCount();
+ MTicks gameTime = GameTickCount();
int skip = 1;
MRect boardRect;