aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--sword2/build_display.cpp2
-rw-r--r--sword2/console.cpp2
-rw-r--r--sword2/driver/driver96.h92
-rw-r--r--sword2/driver/keyboard.cpp7
-rw-r--r--sword2/driver/language.cpp11
-rw-r--r--sword2/driver/render.cpp29
-rw-r--r--sword2/interpreter.cpp2
-rw-r--r--sword2/maketext.cpp5
-rw-r--r--sword2/resman.cpp6
-rw-r--r--sword2/router.cpp14
-rw-r--r--sword2/speech.cpp3
-rw-r--r--sword2/sword2.cpp2
-rw-r--r--sword2/walker.cpp4
13 files changed, 62 insertions, 117 deletions
diff --git a/sword2/build_display.cpp b/sword2/build_display.cpp
index 38a1c3ebd6..9024db8175 100644
--- a/sword2/build_display.cpp
+++ b/sword2/build_display.cpp
@@ -107,7 +107,7 @@ void Send_fore_par1_frames(void); //James23Jan97
// ---------------------------------------------------------------------------
void Build_display(void) { //Tony21Sept96
- BOOL end;
+ bool end;
#ifdef _SWORD2_DEBUG
uint8 pal[12] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 255, 0, 0 };
#endif
diff --git a/sword2/console.cpp b/sword2/console.cpp
index e1ecbc8d4b..6173371317 100644
--- a/sword2/console.cpp
+++ b/sword2/console.cpp
@@ -250,7 +250,7 @@ uint32 Tconsole(uint32 mode) //Tony9Oct96
StartConsole();
- while (TRUE)
+ while (1)
{
ServiceWindows();
diff --git a/sword2/driver/driver96.h b/sword2/driver/driver96.h
index da99a0d467..dbb26d3b11 100644
--- a/sword2/driver/driver96.h
+++ b/sword2/driver/driver96.h
@@ -898,10 +898,6 @@ extern "C" {
// Key buffer size
#define MAX_KEY_BUFFER 32
-typedef int BOOL;
-#define TRUE 1
-#define FALSE 0
-
//
// Structure definitions
// ---------------------
@@ -921,11 +917,10 @@ typedef struct {
#pragma START_PACK_STRUCTS
#endif
-typedef struct
-{
- uint16 w;
- uint16 h;
- uint32 offset[2]; // 2 is arbitrary
+typedef struct {
+ uint16 w;
+ uint16 h;
+ uint32 offset[2]; // 2 is arbitrary
} GCC_PACK _parallax;
#if !defined(__GNUC__)
@@ -933,30 +928,29 @@ typedef struct
#endif
-// The _spriteInfo structure is used to tell the driver96 code what attributes
-// are linked to a sprite for drawing. These include position, scaling and
-// compression.
-typedef struct
-{
- int16 x; // coords for top-left of sprite
- int16 y;
- uint16 w; // dimensions of sprite (before scaling)
- uint16 h;
- uint16 scale; // scale at which to draw, given in 256ths ['0' or '256' MEANS DON'T SCALE]
- uint16 scaledWidth; // new dimensions (we calc these for the mouse area, so may as well pass to you to save time)
- uint16 scaledHeight; //
- uint16 type; // mask containing 'RDSPR_' bits specifying compression type, flip, transparency, etc
- uint16 blend; // holds the blending values.
- uint8 *data; // pointer to the sprite data
- uint8 *colourTable; // pointer to 16-byte colour table, only applicable to 16-col compression type
+// The _spriteInfo structure is used to tell the driver96 code what attributes
+// are linked to a sprite for drawing. These include position, scaling and
+// compression.
+
+typedef struct {
+ int16 x; // coords for top-left of sprite
+ int16 y;
+ uint16 w; // dimensions of sprite (before scaling)
+ uint16 h;
+ uint16 scale; // scale at which to draw, given in 256ths ['0' or '256' MEANS DON'T SCALE]
+ uint16 scaledWidth; // new dimensions (we calc these for the mouse area, so may as well pass to you to save time)
+ uint16 scaledHeight; //
+ uint16 type; // mask containing 'RDSPR_' bits specifying compression type, flip, transparency, etc
+ uint16 blend; // holds the blending values.
+ uint8 *data; // pointer to the sprite data
+ uint8 *colourTable; // pointer to 16-byte colour table, only applicable to 16-col compression type
} _spriteInfo;
// This is the format of a .WAV file. Somewhere after this header is the string
// 'DATA' followed by an int32 size which is the size of the data. Following
// the size of the data is the data itself.
-typedef struct
-{
+typedef struct {
uint32 riff;
uint32 fileLength;
uint32 wavID;
@@ -977,8 +971,7 @@ typedef struct
// It includes the smack to play, and any text lines which are
// to be displayed over the top of the sequence.
-typedef struct
-{
+typedef struct {
uint16 startFrame;
uint16 endFrame;
_spriteInfo *textSprite;
@@ -986,25 +979,6 @@ typedef struct
uint16 *speech;
} _movieTextObject;
-
-
-typedef struct
-{ uint8 manufacturer;
- uint8 version;
- uint8 encoding;
- uint8 bitsPerPixel;
- int16 xmin,ymin;
- int16 xmax,ymax;
- int16 hres;
- int16 vres;
- char palette[48];
- char reserved;
- uint8 colourPlanes;
- int16 bytesPerLine;
- int16 paletteType;
- char filler[58];
-} _pcxHeader;
-
//
// Function Prototypes
// -------------------
@@ -1068,7 +1042,7 @@ extern void ResetRenderEngine(void);
//-----------------------------------------------------------------------------
// Keyboard functions - from keyboard.c
//-----------------------------------------------------------------------------
-extern BOOL KeyWaiting(void);
+extern bool KeyWaiting(void);
extern int32 ReadKey(_keyboardEvent *ke);
//-----------------------------------------------------------------------------
@@ -1089,7 +1063,7 @@ extern int32 CloseLightMask(void);
extern int32 SetScrollTarget(int16 sx, int16 sy);
extern int32 InitialiseRenderCycle(void);
extern int32 StartRenderCycle(void);
-extern int32 EndRenderCycle(BOOL *end);
+extern int32 EndRenderCycle(bool *end);
extern int32 RenderParallax(_parallax *p, int16 layer);
extern int32 SetLocationMetrics(uint16 w, uint16 h);
extern int32 CopyScreenBuffer(void);
@@ -1110,7 +1084,6 @@ extern int32 SetMenuIcon(uint8 menu, uint8 pocket, uint8 *icon);
extern uint8 GetMenuStatus(uint8 menu);
extern int32 CloseMenuImmediately(void);
-
//-----------------------------------------------------------------------------
// Misc functions - from misc.cpp
//-----------------------------------------------------------------------------
@@ -1121,18 +1094,13 @@ extern int32 SVM_GetVolumeInformation(char *cdPath, char *sCDName, uint32 maxPat
extern void scumm_mkdir(const char *pathname);
extern void SVM_GetModuleFileName(void *module, char *destStr, uint32 maxLen);
-
//-----------------------------------------------------------------------------
-//-----------------------------------------------------------------------------
-extern int16 screenWide; // Width of the screen display
-extern int16 screenDeep; // Height of the screen display
-extern int16 mousex; // Mouse screen x coordinate
-extern int16 mousey; // Mouse screen y coordinate
-extern int32 renderCaps; // Flags which determine how to render the scene.
-extern uint8 palCopy[256][4]; // Current palette.
-//-----------------------------------------------------------------------------
-
-extern long int myTimers[10][2];
+extern int16 screenWide; // Width of the screen display
+extern int16 screenDeep; // Height of the screen display
+extern int16 mousex; // Mouse screen x coordinate
+extern int16 mousey; // Mouse screen y coordinate
+extern int32 renderCaps; // Flags which determine how to render the scene.
+extern uint8 palCopy[256][4]; // Current palette.
#ifdef __cplusplus
}
diff --git a/sword2/driver/keyboard.cpp b/sword2/driver/keyboard.cpp
index 7de0225c1a..e25eb4714e 100644
--- a/sword2/driver/keyboard.cpp
+++ b/sword2/driver/keyboard.cpp
@@ -70,11 +70,8 @@ void WriteKey(uint16 ascii, int keycode, int modifiers) {
}
}
-BOOL KeyWaiting(void) {
- if (keyBacklog)
- return TRUE;
-
- return FALSE;
+bool KeyWaiting(void) {
+ return keyBacklog != 0;
}
int32 ReadKey(_keyboardEvent *ev) {
diff --git a/sword2/driver/language.cpp b/sword2/driver/language.cpp
index 41db961d9b..81e63f4663 100644
--- a/sword2/driver/language.cpp
+++ b/sword2/driver/language.cpp
@@ -67,12 +67,11 @@ int32 GetLanguageVersion(uint8 *version) {
} else {
versionFromFile = 1;
languageVersion = AMERICAN;
- return(RDERR_OPENVERSIONFILE);
+ return RDERR_OPENVERSIONFILE;
}
return RD_OK;
}
-
int32 SetLanguageVersion(uint8 version) {
languageVersion = version;
return RD_OK;
@@ -86,17 +85,17 @@ int32 GetGameName(uint8 *name) {
switch (version) {
case ENGLISH:
- strcpy((char *)name, "Broken Sword II");
+ strcpy((char *) name, "Broken Sword II");
break;
case AMERICAN:
- strcpy((char *)name, "Circle of Blood II");
+ strcpy((char *) name, "Circle of Blood II");
break;
case GERMAN:
- strcpy((char *)name, "Baphomet's Fluch II");
+ strcpy((char *) name, "Baphomet's Fluch II");
break;
default:
strcpy((char *)name, "Some game or other, part 86");
- return(RDERR_INVALIDVERSION);
+ return RDERR_INVALIDVERSION;
}
return rv;
diff --git a/sword2/driver/render.cpp b/sword2/driver/render.cpp
index d7db73e5b6..4874d92aa3 100644
--- a/sword2/driver/render.cpp
+++ b/sword2/driver/render.cpp
@@ -809,8 +809,6 @@ int32 SetLocationMetrics(uint16 w, uint16 h)
}
-
-
int32 RenderParallax(_parallax *p, int16 l) {
int16 x, y;
int16 i, j;
@@ -854,10 +852,6 @@ int32 RenderParallax(_parallax *p, int16 l) {
}
-
-
-
-
/*
#define LOGSIZE 10
int32 previousTimeLog[LOGSIZE];
@@ -902,8 +896,6 @@ int32 InitialiseRenderCycle(void) {
return RD_OK;
}
-
-
int32 StartRenderCycle(void) {
scrollxOld = scrollx;
scrollyOld = scrolly;
@@ -924,7 +916,6 @@ int32 StartRenderCycle(void) {
return RD_OK;
}
-
// FIXME: Move this to some better place?
void sleepUntil(int32 time) {
@@ -939,7 +930,7 @@ void sleepUntil(int32 time) {
}
}
-int32 EndRenderCycle(BOOL *end) {
+int32 EndRenderCycle(bool *end) {
int32 time;
time = SVM_timeGetTime();
@@ -953,23 +944,23 @@ int32 EndRenderCycle(BOOL *end) {
renderCountIndex = 0;
if (renderTooSlow) {
- *end = TRUE;
+ *end = true;
InitialiseRenderCycle();
} else if (startTime + renderAverageTime >= totalTime) {
- *end = TRUE;
+ *end = true;
totalTime += MILLISECSPERCYCLE;
initialTime = time;
#ifdef LIMIT_FRAME_RATE
} else if (scrollxTarget == scrollx && scrollyTarget == scrolly) {
// If we have already reached the scroll target sleep for the
// rest of the render cycle.
- *end = TRUE;
+ *end = true;
sleepUntil(totalTime);
initialTime = SVM_timeGetTime();
totalTime += MILLISECSPERCYCLE;
#endif
} else {
- *end = FALSE;
+ *end = false;
// This is an attempt to ensure that we always reach the scroll
// target. Otherwise the game frequently tries to pump out new
@@ -987,7 +978,6 @@ int32 EndRenderCycle(BOOL *end) {
return RD_OK;
}
-
int32 SetScrollTarget(int16 sx, int16 sy) {
scrollxTarget = sx;
scrollyTarget = sy;
@@ -1000,7 +990,6 @@ int32 CopyScreenBuffer(void) {
return RD_OK;
}
-
int32 InitialiseBackgroundLayer(_parallax *p) {
uint8 *memchunk;
uint8 zeros;
@@ -1121,7 +1110,6 @@ int32 InitialiseBackgroundLayer(_parallax *p) {
}
-
int32 CloseBackgroundLayer(void) {
debug(2, "CloseBackgroundLayer");
@@ -1140,10 +1128,3 @@ int32 CloseBackgroundLayer(void) {
layer = 0;
return RD_OK;
}
-
-
-int32 EraseSoftwareScreenBuffer(void)
-{
- // memset(myScreenBuffer, 0, RENDERWIDE * RENDERDEEP);
- return(RD_OK);
-}
diff --git a/sword2/interpreter.cpp b/sword2/interpreter.cpp
index 5100296be9..6e698d88b8 100644
--- a/sword2/interpreter.cpp
+++ b/sword2/interpreter.cpp
@@ -424,7 +424,7 @@ int RunScript(char *scriptData, char *objectData, uint32 *offset) {
*offset = ip;
return 2;
default:
- ASSERT(FALSE);
+ ASSERT(false);
}
parameterReturnedFromMcodeFunction = retVal >> 3;
break;
diff --git a/sword2/maketext.cpp b/sword2/maketext.cpp
index 4b93044b70..c5046ad89b 100644
--- a/sword2/maketext.cpp
+++ b/sword2/maketext.cpp
@@ -152,9 +152,10 @@ mem* MakeTextSprite(uint8 *sentence, uint16 maxWidth, uint8 pen, uint32 fontRes)
}
uint16 AnalyseSentence(uint8 *sentence, uint16 maxWidth, uint32 fontRes, _lineInfo *line) {
- uint16 pos = 0, wordWidth, wordLength, spaceNeeded, firstWord = TRUE;
+ uint16 pos = 0, wordWidth, wordLength, spaceNeeded;
uint16 lineNo = 0;
uint8 ch;
+ bool firstWord = true;
// joinWidth = how much extra space is needed to append a word to a
// line. NB. SPACE requires TWICE the 'char_spacing' to join a word
@@ -192,7 +193,7 @@ uint16 AnalyseSentence(uint8 *sentence, uint16 maxWidth, uint32 fontRes, _lineIn
line[0].width = wordWidth;
line[0].length = wordLength;
- firstWord = FALSE;
+ firstWord = false;
} else {
// see how much extra space this word will need to
// fit on current line (with a separating space
diff --git a/sword2/resman.cpp b/sword2/resman.cpp
index 943fc9f24f..7335f20353 100644
--- a/sword2/resman.cpp
+++ b/sword2/resman.cpp
@@ -1438,7 +1438,7 @@ void resMan::GetCd(int cd) {
do {
if (offNetwork == 1)
- done = TRUE;
+ done = true;
else {
index = 0;
while (cdDrives[index] != 0 && !done && index < 24) {
@@ -1450,10 +1450,10 @@ void resMan::GetCd(int cd) {
if (!scumm_stricmp(sCDName,CD1_LABEL)) {
if (cd == CD1)
- done = TRUE;
+ done = true;
} else if (!scumm_stricmp(sCDName,CD2_LABEL)) {
if (cd == CD2)
- done = TRUE;
+ done = true;
}
index++;
}
diff --git a/sword2/router.cpp b/sword2/router.cpp
index c136258cf5..3c0cf93379 100644
--- a/sword2/router.cpp
+++ b/sword2/router.cpp
@@ -877,7 +877,7 @@ int32 SlidyPath() {
stepX = stepX >> 19; // quarter a step minimum
stepY = stepY >> 19;
- if (abs(deltaX) >= abs(stepX) && abs(deltaY) >= abs(stepY)) {
+ if (ABS(deltaX) >= ABS(stepX) && ABS(deltaY) >= ABS(stepY)) {
modularPath[slidy].x = smoothPath[smooth].x;
modularPath[slidy].y = smoothPath[smooth].y;
modularPath[slidy].dir = smoothPath[smooth].dir;
@@ -1288,7 +1288,7 @@ void SlidyWalkAnimator(_walkData *walkAnim) {
lastErrorY = modularPath[p].y - walkAnim[stepCount - 7].y;
if (stepX == 0) {
- if (3 * abs(lastErrorY) < abs(errorY)) {
+ if (3 * ABS(lastErrorY) < ABS(errorY)) {
// the last stop was
// closest
stepCount -= framesPerStep;
@@ -1298,7 +1298,7 @@ void SlidyWalkAnimator(_walkData *walkAnim) {
left = 0;
}
} else {
- if (3 * abs(lastErrorX) < abs(errorX)) {
+ if (3 * ABS(lastErrorX) < ABS(errorX)) {
//the last stop was
// closest
stepCount -= framesPerStep;
@@ -1560,7 +1560,7 @@ int32 SolidPath() {
stepX = stepX >> 16;
stepY = stepY >> 16;
- if (abs(deltaX) >= abs(stepX) && abs(deltaY) >= abs(stepY)) {
+ if (ABS(deltaX) >= ABS(stepX) && ABS(deltaY) >= ABS(stepY)) {
modularPath[solid].x = smoothPath[smooth].x;
modularPath[solid].y = smoothPath[smooth].y;
modularPath[solid].dir = smoothPath[smooth].dir;
@@ -1954,10 +1954,10 @@ int32 Scan(int32 level) {
x2 = node[k].x;
y2 = node[k].y;
- if (abs(x2 - x1) > 4.5 * abs(y2-y1))
- distance = (8 * abs(x2 - x1) + 18 * abs(y2 - y1)) / (54 * 8) + 1;
+ if (ABS(x2 - x1) > 4.5 * ABS(y2-y1))
+ distance = (8 * ABS(x2 - x1) + 18 * ABS(y2 - y1)) / (54 * 8) + 1;
else
- distance = (6 * abs(x2 - x1) + 36 * abs(y2 - y1)) / (36 * 14) + 1;
+ distance = (6 * ABS(x2 - x1) + 36 * ABS(y2 - y1)) / (36 * 14) + 1;
if (distance + node[i].dist < node[nnodes].dist && distance + node[i].dist < node[k].dist) {
if (NewCheck(0, x1, y1, x2, y2)) {
diff --git a/sword2/speech.cpp b/sword2/speech.cpp
index 621ac11354..a3e94f43f5 100644
--- a/sword2/speech.cpp
+++ b/sword2/speech.cpp
@@ -94,7 +94,6 @@ _subject_unit subject_list[MAX_SUBJECT_LIST];
int32 FN_i_speak(int32 *params);
void LocateTalker(int32 *params);
void Form_text(int32 *params);
-BOOL Is_anim_boxed(uint32 res);
uint8 WantSpeechForLine(uint32 wavId);
#ifdef _SWORD2_DEBUG
@@ -105,7 +104,7 @@ int32 FN_add_subject(int32 *params) { // James12nov96 / Tony18Nov96
// params: 0 id
// 1 daves reference number
- if (IN_SUBJECT==0) {
+ if (IN_SUBJECT == 0) {
// This is the start of the new subject list (James 07may97)
// Set the default repsonse id to zero in case we're never
// passed one
diff --git a/sword2/sword2.cpp b/sword2/sword2.cpp
index 0366434042..8076df53d9 100644
--- a/sword2/sword2.cpp
+++ b/sword2/sword2.cpp
@@ -323,7 +323,7 @@ void Sword2State::go() {
InitialiseRenderCycle();
// Zdebug("RETURNED.");
- while (TRUE) {
+ while (1) {
ServiceWindows();
#ifdef _SWORD2_DEBUG
diff --git a/sword2/walker.cpp b/sword2/walker.cpp
index 96cf0444c4..1ed5950e26 100644
--- a/sword2/walker.cpp
+++ b/sword2/walker.cpp
@@ -524,12 +524,12 @@ int What_target(int startX, int startY, int destX, int destY) { // S2.1(20Jul95
// Flat route
- if (abs(deltaY) * diagonalx < abs(deltaX) * diagonaly / 2)
+ if (ABS(deltaY) * diagonalx < ABS(deltaX) * diagonaly / 2)
return (deltaX > 0) ? 2 : 6;
// Vertical route
- if (abs(deltaY) * diagonalx / 2 > abs(deltaX) * diagonaly)
+ if (ABS(deltaY) * diagonalx / 2 > ABS(deltaX) * diagonaly)
return (deltaY > 0) ? 4 : 0;
// Diagonal route