Replaced abs() with ABS and BOOL with bool, plus some minor cleanups.
svn-id: r10391
This commit is contained in:
parent
570e60a487
commit
09a01e4cbe
13 changed files with 62 additions and 117 deletions
|
@ -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
|
||||
|
|
|
@ -250,7 +250,7 @@ uint32 Tconsole(uint32 mode) //Tony9Oct96
|
|||
|
||||
StartConsole();
|
||||
|
||||
while (TRUE)
|
||||
while (1)
|
||||
{
|
||||
ServiceWindows();
|
||||
|
||||
|
|
|
@ -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
|
||||
}
|
||||
|
|
|
@ -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) {
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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++;
|
||||
}
|
||||
|
|
|
@ -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)) {
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -323,7 +323,7 @@ void Sword2State::go() {
|
|||
InitialiseRenderCycle();
|
||||
// Zdebug("RETURNED.");
|
||||
|
||||
while (TRUE) {
|
||||
while (1) {
|
||||
ServiceWindows();
|
||||
|
||||
#ifdef _SWORD2_DEBUG
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue