aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--engines/cruise/actor.cpp21
-rw-r--r--engines/cruise/background.cpp3
-rw-r--r--engines/cruise/backgroundIncrust.cpp6
-rw-r--r--engines/cruise/cruise_main.cpp429
-rw-r--r--engines/cruise/ctp.cpp9
-rw-r--r--engines/cruise/decompiler.cpp166
-rw-r--r--engines/cruise/font.cpp3
-rw-r--r--engines/cruise/function.cpp25
-rw-r--r--engines/cruise/gfxModule.cpp6
-rw-r--r--engines/cruise/linker.cpp60
-rw-r--r--engines/cruise/mainDraw.cpp50
-rw-r--r--engines/cruise/menu.cpp9
-rw-r--r--engines/cruise/overlay.cpp21
-rw-r--r--engines/cruise/script.cpp12
-rw-r--r--engines/lure/detection.cpp3
-rw-r--r--engines/lure/fights.cpp3
-rw-r--r--engines/lure/intro.cpp3
-rw-r--r--engines/lure/lure.cpp6
-rw-r--r--engines/lure/menu.cpp3
-rw-r--r--engines/lure/res.cpp3
-rw-r--r--engines/lure/screen.cpp3
-rw-r--r--engines/lure/sound.cpp3
-rw-r--r--engines/parallaction/staticres.cpp3
-rw-r--r--engines/queen/cutaway.cpp6
-rw-r--r--engines/saga/font.cpp6
-rw-r--r--engines/saga/interface.cpp3
-rw-r--r--engines/saga/saga.cpp3
-rw-r--r--engines/saga/sndres.cpp3
-rw-r--r--engines/scumm/charset.cpp3
-rw-r--r--engines/scumm/file_nes.cpp3
-rw-r--r--engines/scumm/player_v2a.cpp23
-rw-r--r--engines/sword1/logic.cpp3
-rw-r--r--engines/sword1/router.cpp114
33 files changed, 325 insertions, 692 deletions
diff --git a/engines/cruise/actor.cpp b/engines/cruise/actor.cpp
index 44b0c9c92d..c4af217117 100644
--- a/engines/cruise/actor.cpp
+++ b/engines/cruise/actor.cpp
@@ -471,8 +471,7 @@ void valide_noeud(int16 table[], int16 p, int *nclick, int16 solution0[20 + 3][2
(*nclick)++;
ctpVar19 = ctpVar11;
- if (*nclick == 2) // second point
- {
+ if (*nclick == 2) { // second point
x1 = table_ptselect[0][0];
y1 = table_ptselect[0][1];
x2 = table_ptselect[1][0];
@@ -858,26 +857,18 @@ void processAnimation(void) {
currentActor->phase = ANIM_PHASE_MOVE;
}
- if ((currentActor->counter >=
- 0)
- && ((currentActor->phase ==
- ANIM_PHASE_STATIC_END)
- || (currentActor->
- phase ==
- ANIM_PHASE_STATIC)))
+ if ((currentActor->counter >= 0)
+ && ((currentActor->phase == ANIM_PHASE_STATIC_END)
+ || (currentActor->phase == ANIM_PHASE_STATIC)))
{
int newA;
int inc = 1;
- int t_inc =
- currentActor->
- startDirection - 1;
+ int t_inc = currentActor->startDirection - 1;
if (t_inc < 0)
t_inc = 3;
- if (currentActor->
- nextDirection ==
- t_inc)
+ if (currentActor->nextDirection == t_inc)
inc = -1;
if (inc > 0)
diff --git a/engines/cruise/background.cpp b/engines/cruise/background.cpp
index c375b37b1b..f23c331eb8 100644
--- a/engines/cruise/background.cpp
+++ b/engines/cruise/background.cpp
@@ -98,8 +98,7 @@ int loadBackground(char *name, int idx) {
backgroundPtrtable[idx] =
(uint8 *) mallocAndZero(320 * 200 /*64000 */ );
}
-/* else
- {
+/* else {
backgroundPtrtable[idx] = hwMemAddr[idx];
} */
}
diff --git a/engines/cruise/backgroundIncrust.cpp b/engines/cruise/backgroundIncrust.cpp
index 25713394d9..7e79c048b1 100644
--- a/engines/cruise/backgroundIncrust.cpp
+++ b/engines/cruise/backgroundIncrust.cpp
@@ -113,8 +113,7 @@ backgroundIncrustStruct *addBackgroundIncrust(int16 overlayIdx,
newElement->ptr = NULL;
strcpy(newElement->name, filesDatabase[params.fileIdx].subData.name);
- if (filesDatabase[params.fileIdx].subData.resourceType == 4) // sprite
- {
+ if (filesDatabase[params.fileIdx].subData.resourceType == 4) { // sprite
int width = filesDatabase[params.fileIdx].width;
int height = filesDatabase[params.fileIdx].height;
@@ -125,8 +124,7 @@ backgroundIncrustStruct *addBackgroundIncrust(int16 overlayIdx,
newElement->Y, newElement->X, (char *)backgroundPtr,
(char *)filesDatabase[params.fileIdx].subData.ptr);
// ASSERT(0);
- } else // poly
- {
+ } else { // poly
/* if(param4 == 1)
* {
* int var_A;
diff --git a/engines/cruise/cruise_main.cpp b/engines/cruise/cruise_main.cpp
index bd6f341d24..b3b0077ee7 100644
--- a/engines/cruise/cruise_main.cpp
+++ b/engines/cruise/cruise_main.cpp
@@ -627,192 +627,98 @@ int getCursorFromObject(int mouseX, int mouseY, int *outX, int *outY) {
cellStruct *currentObject = cellHead.prev;
while (currentObject) {
- if (currentObject->overlay >= 0) {
- if (overlayTable[currentObject->overlay].alreadyLoaded) {
- if (currentObject->type == 4
- || currentObject->type == 1
- || currentObject->type == 9
- || currentObject->type == 3) {
- strcpy(objectName,
- getObjectName(currentObject->idx,
- overlayTable[currentObject->
- overlay].ovlData->
- specialString2));
-
- if (strlen(objectName)) {
- if (currentObject->freeze == 0) {
- var_2 =
- currentObject->idx;
- var_4 =
- currentObject->
- overlay;
- var_14 =
- currentObject->
- followObjectIdx;
- var_16 =
- currentObject->
- followObjectOverlayIdx;
-
- getMultipleObjectParam
- (currentObject->
- overlay,
- currentObject->idx,
- &params);
-
- var_10 = 0;
- var_E = 0;
- var_C = 0;
-
- if ((var_4 != var_16)
- && (var_2 !=
- var_14)) {
- getMultipleObjectParam
- (var_16,
- var_14,
- &params);
-
- var_C =
- params.X;
- var_E =
- params.Y;
- var_10 =
- params.
- fileIdx;
+ if (currentObject->overlay >= 0 && overlayTable[currentObject->overlay].alreadyLoaded
+ && (currentObject->type == 4 || currentObject->type == 1
+ || currentObject->type == 9 || currentObject->type == 3)) {
+ strcpy(objectName,
+ getObjectName(currentObject->idx,
+ overlayTable[currentObject->overlay].ovlData->specialString2));
+
+ if (strlen(objectName)) {
+ if (currentObject->freeze == 0) {
+ var_2 = currentObject->idx;
+ var_4 = currentObject->overlay;
+ var_14 = currentObject->followObjectIdx;
+ var_16 = currentObject->followObjectOverlayIdx;
+
+ getMultipleObjectParam(currentObject->overlay, currentObject->idx, &params);
+
+ var_10 = 0;
+ var_E = 0;
+ var_C = 0;
+
+ if ((var_4 != var_16)
+ && (var_2 != var_14)) {
+ getMultipleObjectParam
+ (var_16, var_14, &params);
+
+ var_C = params.X;
+ var_E = params.Y;
+ var_10 = params.fileIdx;
+ }
+
+ if (params.var5 >= 0 && params.fileIdx >= 0) {
+ if (currentObject->type == 3) {
+ assert(0);
+
+ var_2 = params.scale;
+ var_A = params.X + var_C;
+
+ // TODO: this var3 is stupid, investigate...
+ if ((var_A <= mouseX) && (var_A + params.fileIdx >= mouseX) && (mouseY >= params.Y + var_E) && (params.Y + var_E + var2 >= mouseY)) {
+ *outX = var_16;
+ *outY = var_14;
+
+ return (currentObject->type);
}
+ } else if (currentObject->type == 4 ||
+ currentObject->type == 1 ||
+ currentObject->type == 9) {
+ int si;
+ int var_8;
+ int di;
- if (params.var5 >= 0
- && params.
- fileIdx >= 0) {
- if (currentObject->type == 3) {
- assert
- (0);
-
- var_2 =
- params.
- scale;
- var_A =
- params.
- X +
- var_C;
-
- // TODO: this var3 is stupid, investigate...
- if ((var_A <= mouseX) && (var_A + params.fileIdx >= mouseX) && (mouseY >= params.Y + var_E) && (params.Y + var_E + var2 >= mouseY)) {
- *outX
- =
- var_16;
- *outY
- =
- var_14;
-
- return
- (currentObject->
- type);
- }
- } else
- if
- (currentObject->
- type == 4
- ||
- currentObject->
- type == 1
- ||
- currentObject->
- type ==
- 9) {
- int si;
- int var_8;
- int di;
-
- var_A =
- params.
- X +
- var_C;
- var_6 =
- params.
- Y +
- var_E;
-
- di = params.fileIdx;
-
- if (di
- <
- 0)
- {
- di += var_10;
- }
+ var_A = params.X + var_C;
+ var_6 = params.Y + var_E;
-/* if((filesDatabase[di].subData.resourceType == 8) && (filesDatabase[di].subData.ptr))
- {
- assert(0);
- }
- else */
- {
- var_4
- =
- filesDatabase
- [di].
- resType;
+ di = params.fileIdx;
+ if (di < 0) {
+ di += var_10;
+ }
+
+/* if((filesDatabase[di].subData.resourceType == 8) && (filesDatabase[di].subData.ptr)) {
+ assert(0);
+ }
+*/
+ {
+ var_4 = filesDatabase[di].resType;
+
+ if (var_4 == 1) {
+ var_C = filesDatabase[di].widthInColumn / 2;
+ } else {
+ var_C = filesDatabase[di].width;
+ }
+
+ var_8 = filesDatabase[di].height;
+
+ var_2 = mouseX - var_A;
+ si = mouseY - var_6;
+
+ if (var_2 > 0 && var_C > var_2 && si > 0 && var_8 >= si) {
+ if (filesDatabase[di].subData.ptr) {
if (var_4 == 1) {
- var_C
- =
- filesDatabase
- [di].
- widthInColumn
- /
- 2;
} else {
- var_C
- =
- filesDatabase
- [di].
- width;
}
- var_8
- =
- filesDatabase
- [di].
- height;
-
- var_2
- =
- mouseX
- -
- var_A;
- si = mouseY - var_6;
-
- if (var_2 > 0) {
- if (var_C > var_2) {
- if (si > 0) {
- if (var_8 >= si) {
- if (filesDatabase[di].subData.ptr) {
- if (var_4 == 1) {
- } else {
- }
-
- printf
- ("should compare to mask in getCursorFromObject...\n");
+ printf("should compare to mask in getCursorFromObject...\n");
- *outX
- =
- var_16;
- *outY
- =
- var_14;
+ *outX = var_16;
+ *outY = var_14;
- printf
- ("Selected: %s\n",
- objectName);
+ printf("Selected: %s\n", objectName);
- return
- currentObject->
- type;
- }
- }
- }
- }
- }
+ return currentObject->type;
}
}
}
@@ -878,52 +784,22 @@ void buildInventory(int X, int Y) {
menuStruct *pMenu;
pMenu = createMenu(X, Y, "Inventaire");
-
menuTable[1] = pMenu;
- if (pMenu) {
- numObjectInInventory = 0;
+ if (pMenu && numOfLoadedOverlay > 1) {
+ for (int i = 1; i < numOfLoadedOverlay; i++) {
+ ovlDataStruct *pOvlData = overlayTable[i].ovlData;
- if (numOfLoadedOverlay > 1) {
- int i;
+ if (pOvlData && pOvlData->objDataTable && pOvlData->numObjData) {
+ for (int j = 0; j < pOvlData->numObjData; j++) {
+ if (buildInventorySub1(i, j) != 3) {
+ int16 returnVar;
- for (i = 1; i < numOfLoadedOverlay; i++) {
- ovlDataStruct *pOvlData =
- overlayTable[i].ovlData;
+ getSingleObjectParam(i, j, 5, &returnVar);
- if (pOvlData && pOvlData->objDataTable) {
- int var_2;
-
- var_2 = 0;
-
- if (pOvlData->numObjData) {
- int j;
-
- for (j = 0;
- j < pOvlData->numObjData;
- j++) {
- if (buildInventorySub1
- (i, j) != 3) {
- int16
- returnVar;
-
- getSingleObjectParam
- (i, j, 5,
- &returnVar);
-
- if (returnVar <
- -1) {
- addSelectableMenuEntry
- (i,
- j,
- pMenu,
- 1,
- -1,
- getObjectName
- (j, pOvlData->specialString2));
- numObjectInInventory++;
- }
- }
+ if (returnVar < -1) {
+ addSelectableMenuEntry(i, j, pMenu, 1, -1, getObjectName(j, pOvlData->specialString2));
+ numObjectInInventory++;
}
}
}
@@ -1014,12 +890,9 @@ int callInventoryObject(int param0, int param1, int x, int y) {
var_34->stringNameOffset);
if (var_2 == param0) {
- if (param1 ==
- var_34->stringNameOffset) {
+ if (param1 == var_34->stringNameOffset) {
if (pObject) {
- if (pObject->
- type !=
- 3) {
+ if (pObject->type != 3) {
char var_214[80];
char var_1C4[80];
char var_174[80];
@@ -1027,110 +900,52 @@ int callInventoryObject(int param0, int param1, int x, int y) {
char var_D4[80];
char var_84[80];
- ovlDataStruct
- *var_12;
- ovlDataStruct
- *var_22;
+ ovlDataStruct *var_12;
+ ovlDataStruct *var_22;
int var_E = var_34->varIdx;
- int cx
- =
- var_34->
- stringIdx;
+ int cx = var_34->stringIdx;
int var_C = var_34->procIdx;
- int di
- =
- var_E;
+ int di = var_E;
if (var_E == 0)
di = var_1E;
- var_2 =
- cx;
- if (cx
- ==
- 0)
- var_2
- =
- var_1E;
+ var_2 = cx;
+ if (cx == 0)
+ var_2 = var_1E;
if (var_C == 0)
- var_C
- =
- var_1E;
-
- var_12
- =
- NULL;
- var_22
- =
- NULL;
-
- var_214
- [0]
- =
- 0;
- var_1C4
- [0]
- =
- 0;
- var_174
- [0]
- =
- 0;
- var_124
- [0]
- =
- 0;
- var_D4
- [0]
- =
- 0;
- var_84
- [0]
- =
- 0;
-
- if (di
- >
- 0)
- {
- var_22
- =
- overlayTable
- [di].
- ovlData;
+ var_C = var_1E;
+
+ var_12 = NULL;
+ var_22 = NULL;
+
+ var_214[0] = 0;
+ var_1C4[0] = 0;
+ var_174[0] = 0;
+ var_124[0] = 0;
+ var_D4[0] = 0;
+ var_84[0] = 0;
+
+ if (di > 0) {
+ var_22 = overlayTable[di].ovlData;
}
if (var_2 > 0) {
- var_12
- =
- overlayTable
- [var_2].
- ovlData;
+ var_12 = overlayTable[var_2].ovlData;
}
if (var_12) {
if (var_34->stringNameOffset) {
- var_30
- =
- var_34->
- field_1A;
+ var_30 = var_34->field_1A;
if (var_28) {
if (var_12->specialString2) {
if (var_30 == -1 || var_30 == returnVar) {
char *ptrName = getObjectName(var_34->stringNameOffset, var_12->specialString2);
- menuTable
- [0]
- =
- createMenu
- (x,
- y,
- ptrName);
- var_28
- =
- 0;
+ menuTable[0] = createMenu(x, y, ptrName);
+ var_28 = 0;
}
}
}
@@ -1138,8 +953,7 @@ int callInventoryObject(int param0, int param1, int x, int y) {
}
if (var_22) {
- if (true /*var_34->varNameOffset>=0 */ ) // FIXME: This check is always true since varNameOffset is unsigned
- {
+ if (true /*var_34->varNameOffset>=0 */ ) { // FIXME: This check is always true since varNameOffset is unsigned
if (var_22->specialString1) {
char *ptr = getObjectName(var_34->varNameOffset, var_22->specialString1);
@@ -1289,8 +1103,7 @@ int processInput(void) {
ASSERT(0);
}
- if (var38 == 0) // are we in inventory mode ?
- {
+ if (var38 == 0) { // are we in inventory mode ?
if (menuTable[0] == 0) {
int X;
int Y;
diff --git a/engines/cruise/ctp.cpp b/engines/cruise/ctp.cpp
index 84e510a53f..5af2cda46c 100644
--- a/engines/cruise/ctp.cpp
+++ b/engines/cruise/ctp.cpp
@@ -66,16 +66,14 @@ void loadCtpSub2(short int coordCount, short int *ptr) {
short int *cur_ctp_routeCoords = (short int *)ctp_routeCoords; // coordinates table
int8 *cur_ctp_routes = (int8 *) ctp_routes;
- for (i = 0; i < coordCount; i++) // for i < ctp_routeCoordCount
- {
+ for (i = 0; i < coordCount; i++) { // for i < ctp_routeCoordCount
int varX = cur_ctp_routeCoords[0]; // x
int varY = cur_ctp_routeCoords[1]; // y
int di = 0;
int var4Offset = 2;
- while (*(int16 *) cur_ctp_routes > di) // while (coordCount > counter++)
- {
+ while (*(int16 *) cur_ctp_routes > di) { // while (coordCount > counter++)
int idx = *(int16 *) (cur_ctp_routes + var4Offset);
ptr[offset + idx] =
ctpProc2(varX, varY, ctp_routeCoords[idx][0],
@@ -189,8 +187,7 @@ void loadCtpSub1(int boxIdx, int scale, uint16 *_walkboxTable,
ASSERT(boxIdx <= 15);
- if (_walkboxTable[boxIdx * 40] > 0) // is walkbox used ?
- {
+ if (_walkboxTable[boxIdx * 40] > 0) { // is walkbox used ?
getWalkBoxCenter(boxIdx, _walkboxTable);
currentWalkBoxCenterYBis = currentWalkBoxCenterY;
diff --git a/engines/cruise/decompiler.cpp b/engines/cruise/decompiler.cpp
index 7adfd00f3e..b027f948aa 100644
--- a/engines/cruise/decompiler.cpp
+++ b/engines/cruise/decompiler.cpp
@@ -136,52 +136,47 @@ void pushDecomp(char *string, ...) {
void resolveDecompShort(char *buffer) {
ovlData3Struct *data3Ptr = currentScript;
+ int i;
- {
- int i;
+ importScriptStruct *importEntry =
+ (importScriptStruct *) (data3Ptr->dataPtr +
+ data3Ptr->offsetToImportData);
- importScriptStruct *importEntry =
- (importScriptStruct *) (data3Ptr->dataPtr +
- data3Ptr->offsetToImportData);
-
- for (i = 0; i < data3Ptr->numImport; i++) {
- switch (importEntry->type) {
- case 20: // script
- case 30:
- case 40:
- case 50:
- {
- if (importEntry->offset == currentDecompScriptPtr->var4 - 3) // param1
- {
- sprintf(buffer,
- data3Ptr->dataPtr +
- data3Ptr->
- offsetToImportName +
- importEntry->offsetToName);
- return;
- }
- if (importEntry->offset == currentDecompScriptPtr->var4 - 6) // param2
- {
- sprintf(buffer, "linkedIdx");
- return;
- }
- break;
+ for (i = 0; i < data3Ptr->numImport; i++) {
+ switch (importEntry->type) {
+ case 20: // script
+ case 30:
+ case 40:
+ case 50:
+ {
+ if (importEntry->offset == currentDecompScriptPtr->var4 - 3) { // param1
+ sprintf(buffer,
+ data3Ptr->dataPtr +
+ data3Ptr->
+ offsetToImportName +
+ importEntry->offsetToName);
+ return;
}
- default:
- {
- if (importEntry->offset ==
- currentDecompScriptPtr->var4 - 4) {
- sprintf(buffer,
- data3Ptr->dataPtr +
- data3Ptr->
- offsetToImportName +
- importEntry->offsetToName);
- return;
- }
+ if (importEntry->offset == currentDecompScriptPtr->var4 - 6) { // param2
+ sprintf(buffer, "linkedIdx");
+ return;
+ }
+ break;
+ }
+ default:
+ {
+ if (importEntry->offset ==
+ currentDecompScriptPtr->var4 - 4) {
+ sprintf(buffer,
+ data3Ptr->dataPtr +
+ data3Ptr->
+ offsetToImportName +
+ importEntry->offsetToName);
+ return;
}
}
- importEntry++;
}
+ importEntry++;
}
buffer[0] = 0;
@@ -190,31 +185,28 @@ void resolveDecompShort(char *buffer) {
void resolveDecompChar(char *buffer) {
ovlData3Struct *data3Ptr = currentScript;
+ int i;
- {
- int i;
+ importScriptStruct *importEntry =
+ (importScriptStruct *) (data3Ptr->dataPtr +
+ data3Ptr->offsetToImportData);
- importScriptStruct *importEntry =
- (importScriptStruct *) (data3Ptr->dataPtr +
- data3Ptr->offsetToImportData);
-
- for (i = 0; i < data3Ptr->numImport; i++) {
- switch (importEntry->type) {
- default:
- {
- if (importEntry->offset ==
- currentDecompScriptPtr->var4 - 2) {
- sprintf(buffer,
- data3Ptr->dataPtr +
- data3Ptr->
- offsetToImportName +
- importEntry->offsetToName);
- return;
- }
+ for (i = 0; i < data3Ptr->numImport; i++) {
+ switch (importEntry->type) {
+ default:
+ {
+ if (importEntry->offset ==
+ currentDecompScriptPtr->var4 - 2) {
+ sprintf(buffer,
+ data3Ptr->dataPtr +
+ data3Ptr->
+ offsetToImportName +
+ importEntry->offsetToName);
+ return;
}
}
- importEntry++;
}
+ importEntry++;
}
buffer[0] = 0;
@@ -342,16 +334,14 @@ void resolveVarName(char *ovlIdxString, int varType, char *varIdxString,
for (i = 0; i < currentDecompOvl->numExport; i++) {
if (varIdx == currentDecompOvl->exportDataPtr[i].idx) {
- if (((currentDecompOvl->exportDataPtr[i].var4 & 0xF0) == 0) && varType != 0x20) // var
- {
+ if (((currentDecompOvl->exportDataPtr[i].var4 & 0xF0) == 0) && varType != 0x20) { // var
strcpy(outputName,
currentDecompOvl->exportNamesPtr +
currentDecompOvl->exportDataPtr[i].
offsetToName);
return;
}
- if ((currentDecompOvl->exportDataPtr[i].var4) == 20 && varType == 0x20) // script
- {
+ if ((currentDecompOvl->exportDataPtr[i].var4) == 20 && varType == 0x20) { // script
strcpy(outputName,
currentDecompOvl->exportNamesPtr +
currentDecompOvl->exportDataPtr[i].
@@ -722,13 +712,11 @@ int decompCompare(void) {
if(!pop)
si = 1;
- if(pop<0)
- {
+ if(pop<0) {
si |= 4;
}
- if(pop>0)
- {
+ if(pop>0) {
si |= 2;
}
@@ -1435,7 +1423,7 @@ int decompBreak(void) {
}
void generateIndentation(void) {
- int i;
+ int i, j;
for (i = 0; i < positionInDecompileLineTable; i++) {
if (decompileLineTable[i].type != 0) {
@@ -1449,37 +1437,25 @@ void generateIndentation(void) {
gotoStatement = strchr(gotoStatement, ' ') + 1;
destLine = atoi(gotoStatement);
+ destLineIdx = -1;
- {
- int j;
-
- destLineIdx = -1;
-
- for (j = 0; j < positionInDecompileLineTable;
- j++) {
- if (decompileLineTable[j].lineOffset ==
- destLine) {
- destLineIdx = j;
- break;
- }
+ for (j = 0; j < positionInDecompileLineTable; j++) {
+ if (decompileLineTable[j].lineOffset == destLine) {
+ destLineIdx = j;
+ break;
}
+ }
- assert(destLineIdx != -1);
-
- if (destLineIdx > i) {
- int j;
+ assert(destLineIdx != -1);
- for (j = i + 1; j < destLineIdx; j++) {
- decompileLineTable[j].indent++;
- }
+ if (destLineIdx > i) {
+ for (j = i + 1; j < destLineIdx; j++) {
+ decompileLineTable[j].indent++;
+ }
- if (strstr(decompileLineTable
- [destLineIdx - 1].line,
- "goto") ==
- decompileLineTable[destLineIdx -
- 1].line) {
- //decompileLineTable[destLineIdx-1].pendingElse = 1;
- }
+ if (strstr(decompileLineTable[destLineIdx - 1].line, "goto") ==
+ decompileLineTable[destLineIdx - 1].line) {
+ //decompileLineTable[destLineIdx-1].pendingElse = 1;
}
}
}
diff --git a/engines/cruise/font.cpp b/engines/cruise/font.cpp
index c94bbc8f82..ee99567525 100644
--- a/engines/cruise/font.cpp
+++ b/engines/cruise/font.cpp
@@ -253,8 +253,7 @@ void renderWord(uint8 * fontPtr_Data, uint8 * outBufferPtr,
outBufferPtr += heightOff * width * 2; // param2 = height , param6 = width
outBufferPtr += drawPosPixel_X; // param1 = drawPosPixel_X
- for (i = 0; i < height; i++) // y++
- {
+ for (i = 0; i < height; i++) { // y++
uint16 currentColor1 =
(*(fontPtr_Data) << 8) | *(fontPtr_Data + 1);
uint16 currentColor2 =
diff --git a/engines/cruise/function.cpp b/engines/cruise/function.cpp
index 7841a5e4ce..cfb579e331 100644
--- a/engines/cruise/function.cpp
+++ b/engines/cruise/function.cpp
@@ -1006,8 +1006,7 @@ actorStruct *addAnimation(actorStruct * pHead, int overlay, int objIdx, int para
return pNewElement;
}
-int removeAnimation(actorStruct * pHead, int overlay, int objIdx, int objType)
-{
+int removeAnimation(actorStruct * pHead, int overlay, int objIdx, int objType) {
actorStruct* pl;
actorStruct* pl2;
actorStruct* pl3;
@@ -1019,14 +1018,12 @@ int removeAnimation(actorStruct * pHead, int overlay, int objIdx, int objType)
pl2 = pl;
pl = pl2->next;
- while(pl)
- {
+ while (pl) {
pl2 = pl;
- if(((pl->overlayNumber == overlay) || (overlay == -1)) &&
+ if (((pl->overlayNumber == overlay) || (overlay == -1)) &&
((pl->idx == objIdx) || (objIdx == -1)) &&
- ((pl->type == objType) || (objType == -1)))
- {
+ ((pl->type == objType) || (objType == -1))) {
pl->type = -1;
}
@@ -1037,29 +1034,25 @@ int removeAnimation(actorStruct * pHead, int overlay, int objIdx, int objType)
pl2 = pl;
pl = pl2->next;
- while(pl)
- {
- if(pl->type == -1)
- {
+ while (pl) {
+ if (pl->type == -1) {
pl4 = pl->next;
pl2->next = pl4;
pl3 = pl4;
- if(pl3 == NULL)
+ if (pl3 == NULL)
pl3 = pHead;
pl3->prev = pl->prev;
dir = pl->startDirection;
- if(pl->idx >= 0)
+ if (pl->idx >= 0)
freePerso(pl->idx);
free(pl);
pl = pl4;
- }
- else
- {
+ } else {
pl2 = pl;
pl = pl2->next;
}
diff --git a/engines/cruise/gfxModule.cpp b/engines/cruise/gfxModule.cpp
index 881bf1d3ca..9228193560 100644
--- a/engines/cruise/gfxModule.cpp
+++ b/engines/cruise/gfxModule.cpp
@@ -526,10 +526,8 @@ void gfxModuleData_field_60(char *sourcePtr, int width, int height,
int i;
int j;
- for(i=x;i<height+x;i++)
- {
- for(j=y;j<width*16+y;j++)
- {
+ for(i=x;i<height+x;i++) {
+ for(j=y;j<width*16+y;j++) {
if(i>=0&&i<200&&j>=0&&j<320)
destPtr[i*320+j] = *(sourcePtr++);
}
diff --git a/engines/cruise/linker.cpp b/engines/cruise/linker.cpp
index 6cd28062d3..e72218037b 100644
--- a/engines/cruise/linker.cpp
+++ b/engines/cruise/linker.cpp
@@ -186,70 +186,36 @@ int updateScriptImport(int ovlIdx) {
int temp =
ptrImportData->
offset;
- if (out1) //is sub function... (ie 'invent.livre:s')
- {
+ if (out1) { //is sub function... (ie 'invent.livre:s')
uint8 *ptr = ptrData + temp;
- *(ptr +
- 1)
- =
- out2;
- *(int16
- *)
- (ptr
- +
- 2)
- =
- ptrDest2->
- idx;
-
- flipShort
- (
- (int16
- *)
- (ptr + 2));
+ *(ptr + 1) = out2;
+ *(int16 *)(ptr + 2) = ptrDest2->idx;
+
+ flipShort((int16 *)(ptr + 2));
} else {
- if (param2 == 20 || param2 == 30 || param2 == 40 || param2 == 50) // this patch a double push
- {
- uint8
- *
- ptr
- =
- ptrData
- +
- temp;
+ if (param2 == 20 || param2 == 30 || param2 == 40 || param2 == 50) { // this patch a double push
+ uint8 *ptr = ptrData + temp;
*(ptr + 1) = 0;
*(ptr + 2) = out2; // update the overlay number
- *(int16 *) (ptr + 4) = ptrDest2->idx;
+ *(int16 *)(ptr + 4) = ptrDest2->idx;
- flipShort
- (
- (int16
- *)
- (ptr + 4));
+ flipShort((int16 *)(ptr + 4));
} else {
int var_4 = ptrDest2->var4;
if (var_4 & 1) {
- param2
- =
- 8;
+ param2 = 8;
} else {
- param2
- =
- 16;
+ param2 = 16;
}
if (var_4 >= 0 && var_4 <= 3) {
- param2
- |=
- 5;
+ param2 |= 5;
} else {
- param2
- |=
- 6;
+ param2 |= 6;
}
*(ptrData + temp) = param2;
diff --git a/engines/cruise/mainDraw.cpp b/engines/cruise/mainDraw.cpp
index 95142e9edf..b30dc29380 100644
--- a/engines/cruise/mainDraw.cpp
+++ b/engines/cruise/mainDraw.cpp
@@ -24,7 +24,8 @@
*/
#include "cruise/cruise_main.h"
-#include "polys.h"
+#include "cruise/polys.h"
+#include "common/util.h"
namespace Cruise {
@@ -131,8 +132,7 @@ void getPolyData(int fileIndex, int X, int Y, int *outScale, int *outY,
newFileIndex += fileIndex;
- if (true /*newFileIndex >= 0 */ ) // FIXME: comparison is always true due to limited range of data type
- {
+ if (true /*newFileIndex >= 0 */ ) { // FIXME: comparison is always true due to limited range of data type
if (filesDatabase[newFileIndex].resType == 0
&& filesDatabase[newFileIndex].subData.ptr) {
dataPtr =
@@ -180,8 +180,7 @@ void getPolySize(int positionX, int positionY, int scale, int sizeTable[4],
int lowerBorder;
m_flipLeftRight = 0;
- if (scale < 0) // flip left right
- {
+ if (scale < 0) { // flip left right
m_flipLeftRight = 1;
scale = -scale;
}
@@ -208,11 +207,8 @@ void getPolySize(int positionX, int positionY, int scale, int sizeTable[4],
upperBorder = (upscaleValue(upperBorder, scale) + 0x8000) >> 16;
- if (upperBorder < lowerBorder) // exchange borders if lower > upper
- {
- int temp = upperBorder;
- upperBorder = lowerBorder;
- lowerBorder = temp;
+ if (upperBorder < lowerBorder) { // exchange borders if lower > upper
+ SWAP(upperBorder, lowerBorder);
}
sizeTable[0] = lowerBorder; // left
@@ -231,11 +227,8 @@ void getPolySize(int positionX, int positionY, int scale, int sizeTable[4],
upperBorder -= *(dataPtr + 4);
upperBorder = (upscaleValue(upperBorder, scale) + 0x8000) >> 16;
- if (upperBorder < lowerBorder) // exchange borders if lower > upper
- {
- int temp = upperBorder;
- upperBorder = lowerBorder;
- lowerBorder = temp;
+ if (upperBorder < lowerBorder) { // exchange borders if lower > upper
+ SWAP(upperBorder, lowerBorder);
}
sizeTable[2] = lowerBorder; // bottom
@@ -397,8 +390,7 @@ void buildPolyModel(int positionX, int positionY, int scale, char *ptr2,
m_flipLeftRight = 1;
}
- if (scale < 0x180) // If scale is smaller than 384
- {
+ if (scale < 0x180) { // If scale is smaller than 384
m_useSmallScale = 1;
m_scaleValue = scale << 1; // double scale
} else {
@@ -448,8 +440,7 @@ void buildPolyModel(int positionX, int positionY, int scale, char *ptr2,
x = *(dataPointer++) - m_first_X;
y = *(dataPointer++) - m_first_Y;
- if (m_useSmallScale) // shrink all coordinates by factor 2 if a scale smaller than 384 is used
- {
+ if (m_useSmallScale) { // shrink all coordinates by factor 2 if a scale smaller than 384 is used
x >>= 1;
y >>= 1;
}
@@ -502,8 +493,7 @@ void buildPolyModel(int positionX, int positionY, int scale, char *ptr2,
do {
int linesToDraw = *dataPointer++;
- if (linesToDraw > 1) // if value not zero
- {
+ if (linesToDraw > 1) { // if value not zero
uint16 minimumScale;
m_color = *dataPointer; // color
@@ -514,8 +504,7 @@ void buildPolyModel(int positionX, int positionY, int scale, char *ptr2,
flipShort(&minimumScale);
- if (minimumScale > scale) // if the scale is too small, for the model to be drawn ...
- {
+ if (minimumScale > scale) { // if the scale is too small, for the model to be drawn ...
dataPointer += linesToDraw; // ... skip ahead
} else {
if (m_flipLeftRight) {
@@ -913,13 +902,10 @@ void mainDraw(int16 param) {
}
if ((params.var5 >= 0) && (objZ2 >= 0) && filesDatabase[objZ2].subData.ptr) {
- if (filesDatabase[objZ2].subData.resourceType == 8) // Poly
- {
+ if (filesDatabase[objZ2].subData.resourceType == 8) { // Poly
mainDrawPolygons(objZ2, currentObjPtr, objX2, params.scale, objY2, (char *)gfxModuleData.pPage10, (char *)filesDatabase[objZ2].subData.ptr); // poly
- } else if (filesDatabase[objZ2].subData.resourceType == 6) // sound
- {
- } else if (filesDatabase[objZ2].resType == 1) //(num plan == 1)
- {
+ } else if (filesDatabase[objZ2].subData.resourceType == 6) { // sound
+ } else if (filesDatabase[objZ2].resType == 1) { //(num plan == 1)
} else if (filesDatabase[objZ2].subData.resourceType == 4) {
objX1 = filesDatabase[objZ2].width; // width
spriteHeight = filesDatabase[objZ2].height; // height
@@ -953,12 +939,10 @@ void mainDraw(int16 param) {
change = false;
currentObjPtr->animStep = 0;
- if (currentObjPtr->animType) // should we resume the script ?
- {
+ if (currentObjPtr->animType) { // should we resume the script ?
if (currentObjPtr->parentType == 20) {
changeScriptParamInList(currentObjPtr->parentOverlay, currentObjPtr->parent, &procHead, 0, -1);
- }
- else if(currentObjPtr->parentType == 30) {
+ } else if (currentObjPtr->parentType == 30) {
changeScriptParamInList(currentObjPtr->parentOverlay, currentObjPtr->parent, &relHead, 0, -1);
}
}
diff --git a/engines/cruise/menu.cpp b/engines/cruise/menu.cpp
index 2ea8c4ff8c..4f828d1fd3 100644
--- a/engines/cruise/menu.cpp
+++ b/engines/cruise/menu.cpp
@@ -221,8 +221,7 @@ int playerMenu(int menuX, int menuY) {
freeStuff2();
}
/*
- if(currentMenu)
- {
+ if(currentMenu) {
freeMenu(currentMenu);
currentMenu = 0;
var37 = 0;
@@ -230,8 +229,7 @@ int playerMenu(int menuX, int menuY) {
main9 = -1;
}
- if(inventoryMenu)
- {
+ if(inventoryMenu) {
freeMenu(inventoryMenu);
inventoryMenu = 0;
var37 = 0;
@@ -239,8 +237,7 @@ int playerMenu(int menuX, int menuY) {
main9 = -1;
}*/
-/* if(mouseVar2)
- {
+/* if(mouseVar2) {
free3(mouseVar2);
} */
diff --git a/engines/cruise/overlay.cpp b/engines/cruise/overlay.cpp
index 2b83e0f2b2..179c53357d 100644
--- a/engines/cruise/overlay.cpp
+++ b/engines/cruise/overlay.cpp
@@ -375,8 +375,7 @@ int loadOverlay(const uint8 *scriptName) {
if (!ovlData->ptr8) {
/* releaseScript(scriptIdx,scriptName);
- if(freeIsNeeded)
- {
+ if(freeIsNeeded) {
freePtr(unpackedBuffer);
} */
@@ -396,8 +395,7 @@ int loadOverlay(const uint8 *scriptName) {
if (!ovlData->objDataTable) {
/* releaseScript(scriptIdx,scriptName);
- if(freeIsNeeded)
- {
+ if(freeIsNeeded) {
freePtr(unpackedBuffer);
} */
@@ -457,8 +455,7 @@ int loadOverlay(const uint8 *scriptName) {
if (!ovlData->objData2WorkTable) {
/* releaseScript(scriptIdx,scriptName);
- if(freeIsNeeded)
- {
+ if(freeIsNeeded) {
freePtr(unpackedBuffer);
} */
@@ -474,8 +471,7 @@ int loadOverlay(const uint8 *scriptName) {
if (!ovlData->objData2SourceTable) {
/* releaseScript(scriptIdx,scriptName);
- if(freeIsNeeded)
- {
+ if(freeIsNeeded) {
freePtr(unpackedBuffer);
} */
@@ -501,8 +497,7 @@ int loadOverlay(const uint8 *scriptName) {
}
}
-/* if(freeIsNeeded)
- {
+/* if(freeIsNeeded) {
freePtr(unpackedBuffer);
} */
@@ -701,14 +696,12 @@ int releaseOverlay(const char *name) {
if (!ovlDataPtr)
return -4;
/*
- if(overlayTable[overlayIdx].var1E)
- {
+ if(overlayTable[overlayIdx].var1E) {
free(overlayTable[overlayIdx].var1E);
overlayTable[overlayIdx].var1E = NULL;
}
- if(overlayTable[overlayIdx].var16)
- {
+ if(overlayTable[overlayIdx].var16) {
free(overlayTable[overlayIdx].var16);
overlayTable[overlayIdx].var16 = NULL;
} */
diff --git a/engines/cruise/script.cpp b/engines/cruise/script.cpp
index d3d88a8b5f..c9ba819d75 100644
--- a/engines/cruise/script.cpp
+++ b/engines/cruise/script.cpp
@@ -73,8 +73,7 @@ int32 opcodeType0(void) {
if (!byte2) {
ptr = scriptDataPtrTable[var_E] + short1;
- } else // TODO:
- {
+ } else { // TODO:
if (!overlayTable[byte2].alreadyLoaded) {
return (-7);
}
@@ -145,8 +144,7 @@ int32 opcodeType0(void) {
if (!byte2) {
ptr = scriptDataPtrTable[var_E] + var_12;
- } else // TODO:
- {
+ } else { // TODO:
if (!overlayTable[byte2].alreadyLoaded) {
return (-7);
}
@@ -635,8 +633,7 @@ uint8 *attacheNewScriptToTail(int16 overlayNumber,
oldTail = scriptHandlePtr;
- while (oldTail->nextScriptPtr) // go to the end of the list
- {
+ while (oldTail->nextScriptPtr) { // go to the end of the list
oldTail = oldTail->nextScriptPtr;
}
@@ -660,8 +657,7 @@ uint8 *attacheNewScriptToTail(int16 overlayNumber,
tempPtr->scriptNumber = param;
tempPtr->overlayNumber = overlayNumber;
- if (scriptType == 20) // Obj or not ?
- {
+ if (scriptType == 20) { // Obj or not ?
tempPtr->sysKey = useArg3Neg;
} else {
tempPtr->sysKey = 1;
diff --git a/engines/lure/detection.cpp b/engines/lure/detection.cpp
index b4a69bfd43..d12244af07 100644
--- a/engines/lure/detection.cpp
+++ b/engines/lure/detection.cpp
@@ -152,8 +152,7 @@ void LureEngine::detectGame() {
"Lure of the Temptress executable. See the documentation for creating it.",
SUPPORT_FILENAME);
- for (uint8 fileNum = 1; fileNum <= 4; ++fileNum)
- {
+ for (uint8 fileNum = 1; fileNum <= 4; ++fileNum) {
char sFilename[10];
sprintf(sFilename, "disk%d.vga", fileNum);
diff --git a/engines/lure/fights.cpp b/engines/lure/fights.cpp
index 374ea22c26..836c109ca7 100644
--- a/engines/lure/fights.cpp
+++ b/engines/lure/fights.cpp
@@ -335,8 +335,7 @@ void FightsManager::fightHandler(Hotspot &h, uint16 moveOffset) {
return;
}
- switch (moveValue)
- {
+ switch (moveValue) {
case 0xFFFA:
// Walk left
if ((fighter.fwmove_number == 5) || (fighter.fwmove_number == 10)) {
diff --git a/engines/lure/intro.cpp b/engines/lure/intro.cpp
index 3f939c6389..41146742b7 100644
--- a/engines/lure/intro.cpp
+++ b/engines/lure/intro.cpp
@@ -80,8 +80,7 @@ bool Introduction::show() {
PaletteCollection coll(0x32);
const AnimRecord *curr_anim = anim_screens;
- for (; curr_anim->resourceId; ++curr_anim)
- {
+ for (; curr_anim->resourceId; ++curr_anim) {
bool fadeIn = curr_anim == anim_screens;
anim = new AnimationSequence(_screen, _system, curr_anim->resourceId,
coll.getPalette(curr_anim->paletteIndex), fadeIn);
diff --git a/engines/lure/lure.cpp b/engines/lure/lure.cpp
index f7c4272f0e..7359ce9fb8 100644
--- a/engines/lure/lure.cpp
+++ b/engines/lure/lure.cpp
@@ -169,8 +169,7 @@ bool LureEngine::loadGame(uint8 slotNumber) {
// Check for header
char buffer[5];
f->read(buffer, 5);
- if (memcmp(buffer, "lure", 5) != 0)
- {
+ if (memcmp(buffer, "lure", 5) != 0) {
warning(FAILED_MSG, slotNumber);
delete f;
return false;
@@ -179,8 +178,7 @@ bool LureEngine::loadGame(uint8 slotNumber) {
// Check language version
uint8 language = f->readByte();
uint8 version = f->readByte();
- if ((language != _language) || (version != LURE_DAT_MINOR))
- {
+ if ((language != _language) || (version != LURE_DAT_MINOR)) {
warning("loadGame: Failed to load slot %d - incorrect version", slotNumber);
delete f;
return false;
diff --git a/engines/lure/menu.cpp b/engines/lure/menu.cpp
index 3bb6769ff7..7dfb6e2a57 100644
--- a/engines/lure/menu.cpp
+++ b/engines/lure/menu.cpp
@@ -106,8 +106,7 @@ uint8 Menu::execute() {
while (events.pollEvent()) {
if (events.quitFlag) return MENUITEM_NONE;
- if (mouse.y() < MENUBAR_Y_SIZE)
- {
+ if (mouse.y() < MENUBAR_Y_SIZE) {
MenuRecord *p = getMenuAt(mouse.x());
if (_selectedMenu != p) {
diff --git a/engines/lure/res.cpp b/engines/lure/res.cpp
index 44d9d9859f..419101a6ee 100644
--- a/engines/lure/res.cpp
+++ b/engines/lure/res.cpp
@@ -657,8 +657,7 @@ void Resources::setTalkData(uint16 offset) {
error("Unknown talk entry offset %d requested", offset);
}
-void Resources::saveToStream(Common::WriteStream *stream)
-{
+void Resources::saveToStream(Common::WriteStream *stream) {
_hotspotData.saveToStream(stream);
_activeHotspots.saveToStream(stream);
_fieldList.saveToStream(stream);
diff --git a/engines/lure/screen.cpp b/engines/lure/screen.cpp
index 7e96484b2f..552e609b84 100644
--- a/engines/lure/screen.cpp
+++ b/engines/lure/screen.cpp
@@ -95,8 +95,7 @@ void Screen::paletteFadeIn(Palette *p) {
byte *pFinal = p->data();
byte *pCurrent = _palette->data();
- for (int palCtr = 0; palCtr < p->numEntries() * PALETTE_FADE_INC_SIZE; ++palCtr, ++pCurrent, ++pFinal)
- {
+ for (int palCtr = 0; palCtr < p->numEntries() * PALETTE_FADE_INC_SIZE; ++palCtr, ++pCurrent, ++pFinal) {
if (palCtr % PALETTE_FADE_INC_SIZE == (PALETTE_FADE_INC_SIZE - 1)) continue;
bool isDifferent = *pCurrent < *pFinal;
diff --git a/engines/lure/sound.cpp b/engines/lure/sound.cpp
index 8b927cca9d..b0fb3a54f6 100644
--- a/engines/lure/sound.cpp
+++ b/engines/lure/sound.cpp
@@ -131,8 +131,7 @@ void SoundManager::addSound2(uint8 soundIndex) {
if (soundIndex == 6)
// Chinese torture
addSound(6);
- else
- {
+ else {
SoundDescResource &descEntry = soundDescs()[soundIndex];
SoundDescResource *rec = findSound(descEntry.soundNumber);
if (rec == NULL)
diff --git a/engines/parallaction/staticres.cpp b/engines/parallaction/staticres.cpp
index c3775dd4fa..b126d1dc0c 100644
--- a/engines/parallaction/staticres.cpp
+++ b/engines/parallaction/staticres.cpp
@@ -50,8 +50,7 @@ byte Parallaction_ns::_mouseArrow[256] = {
};
-byte _amigaTopazFont[2600] =
-{
+byte _amigaTopazFont[2600] = {
0x00, 0x00, 0x03, 0xf3, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x79, 0x00, 0x00, 0x03, 0xe9, 0x00, 0x00, 0x02, 0x79,
0x70, 0xff, 0x4e, 0x75, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0c, 0x00, 0x00, 0x00,
diff --git a/engines/queen/cutaway.cpp b/engines/queen/cutaway.cpp
index 1f34128820..5da0548108 100644
--- a/engines/queen/cutaway.cpp
+++ b/engines/queen/cutaway.cpp
@@ -181,8 +181,7 @@ void Cutaway::loadStrings(uint16 offset) {
debug(6, "_talkTo = %i", _talkTo);
}
-const byte *Cutaway::getCutawayObject(const byte *ptr, CutawayObject &object)
-{
+const byte *Cutaway::getCutawayObject(const byte *ptr, CutawayObject &object) {
const byte *oldPtr = ptr;
object.objectNumber = (int16)READ_BE_INT16(ptr); ptr += 2;
@@ -216,8 +215,7 @@ const byte *Cutaway::getCutawayObject(const byte *ptr, CutawayObject &object)
return ptr;
}
-void Cutaway::dumpCutawayObject(int index, CutawayObject &object)
-{
+void Cutaway::dumpCutawayObject(int index, CutawayObject &object) {
debug(6, "----- CutawayObject[%i] -----", index);
const char *objectNumberStr;
diff --git a/engines/saga/font.cpp b/engines/saga/font.cpp
index 71cd6b0eef..1e818b047a 100644
--- a/engines/saga/font.cpp
+++ b/engines/saga/font.cpp
@@ -632,8 +632,7 @@ Font::FontId Font::knownFont2FontIdx(KnownFont font) {
// The demo version of IHNM has 3 font types (like ITE), not 6 (like the full version of IHNM)
if (_vm->getGameType() == GType_ITE || _vm->getGameId() == GID_IHNM_DEMO) {
- switch (font)
- {
+ switch (font) {
case (kKnownFontSmall):
fontId = kSmallFont;
break;
@@ -655,8 +654,7 @@ Font::FontId Font::knownFont2FontIdx(KnownFont font) {
break;
}
} else if (_vm->getGameType() == GType_IHNM && _vm->getGameId() != GID_IHNM_DEMO) {
- switch (font)
- {
+ switch (font) {
case (kKnownFontSmall):
fontId = kSmallFont;
break;
diff --git a/engines/saga/interface.cpp b/engines/saga/interface.cpp
index c73741347d..362366ba55 100644
--- a/engines/saga/interface.cpp
+++ b/engines/saga/interface.cpp
@@ -608,8 +608,7 @@ bool Interface::processAscii(uint16 ascii) {
return true;
}
}
- if (ascii == 15) // ctrl-o
- {
+ if (ascii == 15) { // ctrl-o
if (_saveReminderState > 0) {
setMode(kPanelOption);
return true;
diff --git a/engines/saga/saga.cpp b/engines/saga/saga.cpp
index 2c064258d2..c6682e12f3 100644
--- a/engines/saga/saga.cpp
+++ b/engines/saga/saga.cpp
@@ -452,8 +452,7 @@ ColorId SagaEngine::KnownColor2ColorId(KnownColor knownColor) {
error("SagaEngine::KnownColor2ColorId unknown color %i", knownColor);
}
} else if (getGameType() == GType_IHNM) {
- switch (knownColor)
- {
+ switch (knownColor) {
case(kKnownColorTransparent):
colorId = kITEColorTransBlack;
break;
diff --git a/engines/saga/sndres.cpp b/engines/saga/sndres.cpp
index 20ec015de4..ac21656dfa 100644
--- a/engines/saga/sndres.cpp
+++ b/engines/saga/sndres.cpp
@@ -101,8 +101,7 @@ SndRes::~SndRes() {
}
}
-void SndRes::setVoiceBank(int serial)
-{
+void SndRes::setVoiceBank(int serial) {
if (_voiceSerial == serial) return;
_voiceSerial = serial;
diff --git a/engines/scumm/charset.cpp b/engines/scumm/charset.cpp
index b90bba6526..df4cfb34a8 100644
--- a/engines/scumm/charset.cpp
+++ b/engines/scumm/charset.cpp
@@ -1226,8 +1226,7 @@ int CharsetRendererV3::getCharWidth(byte chr) {
return spacing;
}
-void CharsetRendererV3::setColor(byte color)
-{
+void CharsetRendererV3::setColor(byte color) {
bool useShadow = false;
_color = color;
diff --git a/engines/scumm/file_nes.cpp b/engines/scumm/file_nes.cpp
index aeba6120a2..88b4253a1d 100644
--- a/engines/scumm/file_nes.cpp
+++ b/engines/scumm/file_nes.cpp
@@ -948,8 +948,7 @@ uint16 ScummNESFile::extractResource(Common::WriteStream *output, const Resource
for (i = 1; i < 8; i++)
reslen += write_byte(output, 0);
- for (j = 0; j < 4; j++)
- {
+ for (j = 0; j < 4; j++) {
reslen += write_byte(output,' ');
for (i = 1; (val = fileReadByte()); i++)
reslen += write_byte(output, val);
diff --git a/engines/scumm/player_v2a.cpp b/engines/scumm/player_v2a.cpp
index 575281a26a..ceabbc7d95 100644
--- a/engines/scumm/player_v2a.cpp
+++ b/engines/scumm/player_v2a.cpp
@@ -35,14 +35,12 @@ namespace Scumm {
static uint32 CRCtable[256];
-static void InitCRC (void)
-{
+static void InitCRC (void) {
const uint32 poly = 0xEDB88320;
int i, j;
uint32 n;
- for (i = 0; i < 256; i++)
- {
+ for (i = 0; i < 256; i++) {
n = i;
for (j = 0; j < 8; j++)
n = (n & 1) ? ((n >> 1) ^ poly) : (n >> 1);
@@ -50,8 +48,7 @@ static void InitCRC (void)
}
}
-static uint32 GetCRC (byte *data, int len)
-{
+static uint32 GetCRC (byte *data, int len) {
uint32 CRC = 0xFFFFFFFF;
int i;
for (i = 0; i < len; i++)
@@ -1113,8 +1110,7 @@ public:
}
virtual bool update() {
assert(_id);
- if (_curfreq >= _freq2)
- {
+ if (_curfreq >= _freq2) {
_mod->setChannelFreq(_id, BASE_FREQUENCY / _curfreq);
_curfreq -= _bendrate;
if (--_bendctr)
@@ -1122,9 +1118,7 @@ public:
_bendrate--;
if (_bendrate < 2)
_bendrate = 2;
- }
- else
- {
+ } else {
if (!--_holdctr)
return false;
}
@@ -1160,15 +1154,12 @@ public:
}
virtual bool update() {
assert(_id);
- if (!_loop)
- {
+ if (!_loop) {
_vol--;
if (_vol)
_mod->setChannelVol(_id, _vol);
else return false;
- }
- else if (!--_loop)
- {
+ } else if (!--_loop) {
_mod->stopChannel(_id);
char *tmp_data = (char *)malloc(_size2);
memcpy(tmp_data, _data + _offset2, _size2);
diff --git a/engines/sword1/logic.cpp b/engines/sword1/logic.cpp
index 7c15d66a46..60103ba5f9 100644
--- a/engines/sword1/logic.cpp
+++ b/engines/sword1/logic.cpp
@@ -317,8 +317,7 @@ int Logic::logicArAnimate(Object *compact, uint32 id) {
}
compact->o_walk_pc++;
- if (route[compact->o_walk_pc].frame == 512) //end of sequence
- {
+ if (route[compact->o_walk_pc].frame == 512) { //end of sequence
compact->o_logic = LOGIC_script;
if (((_scriptVars[GEORGE_WALKING] == 2) || (_scriptVars[GEORGE_WALKING] == 1)) &&
(id == PLAYER)) {
diff --git a/engines/sword1/router.cpp b/engines/sword1/router.cpp
index 685e11fd32..6478674eb2 100644
--- a/engines/sword1/router.cpp
+++ b/engines/sword1/router.cpp
@@ -130,8 +130,7 @@ int32 Router::routeFinder(int32 id, Object *megaObject, int32 x, int32 y, int32
slowInFrames = 0;
slowOutFrames = 0;
- if (megaId == GEORGE)
- {
+ if (megaId == GEORGE) {
turnFramesLeft = 3 * _framesPerChar + NO_DIRECTIONS + 2 * SLOW_IN + 4 * SLOW_OUT;
turnFramesRight = 3 * _framesPerChar + NO_DIRECTIONS + 2 * SLOW_IN + 4 * SLOW_OUT + NO_DIRECTIONS;
walkFramesLeft = _framesPerChar + NO_DIRECTIONS;
@@ -703,8 +702,7 @@ void Router::slidyWalkAnimator(WalkData *walkAnim) {
// TURN TO START THE WALK
//****************************************************************************
// rotate if we need to
- if (lastDir != currentDir)
- {
+ if (lastDir != currentDir) {
// get the direction to turn
turnDir = currentDir - lastDir;
if ( turnDir < 0)
@@ -717,10 +715,8 @@ void Router::slidyWalkAnimator(WalkData *walkAnim) {
// rotate to new walk direction
// for george and nico put in a head turn at the start
- if ((megaId == GEORGE) || (megaId == NICO))
- {
- if ( turnDir < 0) // new frames for turn frames 29oct95jps
- {
+ if ((megaId == GEORGE) || (megaId == NICO)) {
+ if ( turnDir < 0) { // new frames for turn frames 29oct95jps
module = turnFramesLeft + lastDir;
} else {
module = turnFramesRight + lastDir;
@@ -734,11 +730,9 @@ void Router::slidyWalkAnimator(WalkData *walkAnim) {
}
// rotate till were facing new dir then go back 45 degrees
- while (lastDir != currentDir)
- {
+ while (lastDir != currentDir) {
lastDir += turnDir;
- if ( turnDir < 0) // new frames for turn frames 29oct95jps
- {
+ if ( turnDir < 0) { // new frames for turn frames 29oct95jps
if ( lastDir < 0)
lastDir += NO_DIRECTIONS;
module = turnFramesLeft + lastDir;
@@ -774,8 +768,7 @@ void Router::slidyWalkAnimator(WalkData *walkAnim) {
lastDir = 99;// this ensures that we don't put in turn frames for the start
currentDir = 99;// this ensures that we don't put in turn frames for the start
do {
- while (_modularPath[p].num == 0)
- {
+ while (_modularPath[p].num == 0) {
p = p + 1;
if (currentDir != 99)
lastRealDir = currentDir;
@@ -784,8 +777,7 @@ void Router::slidyWalkAnimator(WalkData *walkAnim) {
}
//calculate average amount to lose in each step on the way to the next _node
currentDir = _modularPath[p].dir;
- if (currentDir < NO_DIRECTIONS)
- {
+ if (currentDir < NO_DIRECTIONS) {
module = currentDir * _framesPerStep * 2 + left;
if (left == 0)
left = _framesPerStep;
@@ -814,22 +806,18 @@ void Router::slidyWalkAnimator(WalkData *walkAnim) {
errorX = errorX * stepX;
errorY = _modularPath[p].y - moduleY;
errorY = errorY * stepY;
- if ((errorX < 0) || (errorY < 0))
- {
+ if ((errorX < 0) || (errorY < 0)) {
_modularPath[p].num = 0; // the end of the path
// okay those last steps took us past our target but do we want to scoot or moonwalk
frames = stepCount - lastCount;
errorX = _modularPath[p].x - walkAnim[stepCount-1].x;
errorY = _modularPath[p].y - walkAnim[stepCount-1].y;
- if (frames > _framesPerStep)
- {
+ if (frames > _framesPerStep) {
lastErrorX = _modularPath[p].x - walkAnim[stepCount-7].x;
lastErrorY = _modularPath[p].y - walkAnim[stepCount-7].y;
- if (stepX==0)
- {
- if (3*ABS(lastErrorY) < ABS(errorY)) //the last stop was closest
- {
+ if (stepX==0) {
+ if (3*ABS(lastErrorY) < ABS(errorY)) { //the last stop was closest
stepCount -= _framesPerStep;
if (left == 0)
left = _framesPerStep;
@@ -837,8 +825,7 @@ void Router::slidyWalkAnimator(WalkData *walkAnim) {
left = 0;
}
} else {
- if (3*ABS(lastErrorX) < ABS(errorX)) //the last stop was closest
- {
+ if (3*ABS(lastErrorX) < ABS(errorX)) { //the last stop was closest
stepCount -= _framesPerStep;
if (left == 0)
left = _framesPerStep;
@@ -850,8 +837,7 @@ void Router::slidyWalkAnimator(WalkData *walkAnim) {
errorX = _modularPath[p].x - walkAnim[stepCount-1].x;
errorY = _modularPath[p].y - walkAnim[stepCount-1].y;
// okay we've reached the end but we still have an error
- if (errorX != 0)
- {
+ if (errorX != 0) {
frameCount = 0;
frames = stepCount - lastCount;
do {
@@ -859,8 +845,7 @@ void Router::slidyWalkAnimator(WalkData *walkAnim) {
walkAnim[lastCount + frameCount - 1].x += errorX*frameCount/frames;
} while (frameCount<frames);
}
- if (errorY != 0)
- {
+ if (errorY != 0) {
frameCount = 0;
frames = stepCount - lastCount;
do {
@@ -874,25 +859,20 @@ void Router::slidyWalkAnimator(WalkData *walkAnim) {
if (currentDir != 99)
lastRealDir = currentDir;
// check each turn condition in turn
- if (((lastDir != 99) && (currentDir != 99)) && (megaId == GEORGE)) // only for george
- {
+ if (((lastDir != 99) && (currentDir != 99)) && (megaId == GEORGE)) { // only for george
lastDir = currentDir - lastDir;//1 and -7 going right -1 and 7 going left
- if (((lastDir == -1) || (lastDir == 7)) || ((lastDir == -2) || (lastDir == 6)))
- {
+ if (((lastDir == -1) || (lastDir == 7)) || ((lastDir == -2) || (lastDir == 6))) {
// turn at the end of the last walk
frame = lastCount - _framesPerStep;
- do
- {
+ do {
walkAnim[frame].frame += 104;//turning left
frame += 1;
} while (frame < lastCount );
}
- if (((lastDir == 1) || (lastDir == -7)) || ((lastDir == 2) || (lastDir == -6)))
- {
+ if (((lastDir == 1) || (lastDir == -7)) || ((lastDir == 2) || (lastDir == -6))) {
// turn at the end of the current walk
frame = lastCount - _framesPerStep;
- do
- {
+ do {
walkAnim[frame].frame += 200; //was 60 now 116
frame += 1;
} while (frame < lastCount );
@@ -912,8 +892,7 @@ void Router::slidyWalkAnimator(WalkData *walkAnim) {
- if (lastRealDir == 99)
- {
+ if (lastRealDir == 99) {
error("SlidyWalkAnimatorlast direction error\n");
}
//****************************************************************************
@@ -924,8 +903,7 @@ void Router::slidyWalkAnimator(WalkData *walkAnim) {
// We've done the walk now put in any turns at the end
- if (_targetDir == NO_DIRECTIONS) // stand in the last direction
- {
+ if (_targetDir == NO_DIRECTIONS) { // stand in the last direction
module = standFrames + lastRealDir;
_targetDir = lastRealDir;
walkAnim[stepCount].frame = module;
@@ -935,10 +913,8 @@ void Router::slidyWalkAnimator(WalkData *walkAnim) {
walkAnim[stepCount].y = moduleY;
stepCount += 1;
}
- if (_targetDir == 9)
- {
- if (stepCount == 0)
- {
+ if (_targetDir == 9) {
+ if (stepCount == 0) {
module = _framesPerChar + lastRealDir;
walkAnim[stepCount].frame = module;
walkAnim[stepCount].step = 0;
@@ -947,8 +923,7 @@ void Router::slidyWalkAnimator(WalkData *walkAnim) {
walkAnim[stepCount].y = moduleY;
stepCount += 1;
}
- } else if (_targetDir != lastRealDir) // rotate to _targetDir
- {
+ } else if (_targetDir != lastRealDir) { // rotate to _targetDir
// rotate to target direction
turnDir = _targetDir - lastRealDir;
if ( turnDir < 0)
@@ -961,10 +936,8 @@ void Router::slidyWalkAnimator(WalkData *walkAnim) {
// rotate to target direction
// for george and nico put in a head turn at the start
- if ((megaId == GEORGE) || (megaId == NICO))
- {
- if ( turnDir < 0) // new frames for turn frames 29oct95jps
- {
+ if ((megaId == GEORGE) || (megaId == NICO)) {
+ if ( turnDir < 0) { // new frames for turn frames 29oct95jps
module = turnFramesLeft + lastDir;
} else {
module = turnFramesRight + lastDir;
@@ -978,11 +951,9 @@ void Router::slidyWalkAnimator(WalkData *walkAnim) {
}
// rotate if we need to
- while (lastRealDir != _targetDir)
- {
+ while (lastRealDir != _targetDir) {
lastRealDir += turnDir;
- if ( turnDir < 0) // new frames for turn frames 29oct95jps
- {
+ if ( turnDir < 0) { // new frames for turn frames 29oct95jps
if ( lastRealDir < 0)
lastRealDir += NO_DIRECTIONS;
module = turnFramesLeft + lastRealDir;
@@ -1000,8 +971,7 @@ void Router::slidyWalkAnimator(WalkData *walkAnim) {
}
module = standFrames + lastRealDir;
walkAnim[stepCount-1].frame = module;
- } else // just stand at the end
- {
+ } else { // just stand at the end
module = standFrames + lastRealDir;
walkAnim[stepCount].frame = module;
walkAnim[stepCount].step = 0;
@@ -1150,8 +1120,7 @@ int32 Router::solidWalkAnimator(WalkData *walkAnim) {
// TURN TO START THE WALK
//****************************************************************************
// rotate if we need to
- if (lastDir != currentDir)
- {
+ if (lastDir != currentDir) {
// get the direction to turn
turnDir = currentDir - lastDir;
if ( turnDir < 0)
@@ -1164,10 +1133,8 @@ int32 Router::solidWalkAnimator(WalkData *walkAnim) {
// rotate to new walk direction
// for george and nico put in a head turn at the start
- if ((megaId == GEORGE) || (megaId == NICO))
- {
- if ( turnDir < 0) // new frames for turn frames 29oct95jps
- {
+ if ((megaId == GEORGE) || (megaId == NICO)) {
+ if ( turnDir < 0) { // new frames for turn frames 29oct95jps
module = turnFramesLeft + lastDir;
} else {
module = turnFramesRight + lastDir;
@@ -1181,11 +1148,9 @@ int32 Router::solidWalkAnimator(WalkData *walkAnim) {
}
// rotate till were facing new dir then go back 45 degrees
- while (lastDir != currentDir)
- {
+ while (lastDir != currentDir) {
lastDir += turnDir;
- if ( turnDir < 0) // new frames for turn frames 29oct95jps
- {
+ if ( turnDir < 0) { // new frames for turn frames 29oct95jps
if ( lastDir < 0)
lastDir += NO_DIRECTIONS;
module = turnFramesLeft + lastDir;
@@ -1882,8 +1847,7 @@ int32 Router::checkTarget(int32 x, int32 y) {
// * THE SETUP ROUTINES
// ****************************************************************************
-int32 Router::LoadWalkResources(Object *megaObject, int32 x, int32 y, int32 dir)
-{
+int32 Router::LoadWalkResources(Object *megaObject, int32 x, int32 y, int32 dir) {
WalkGridHeader floorHeader;
int32 i;
uint8 *fPolygrid;
@@ -1915,8 +1879,7 @@ int32 Router::LoadWalkResources(Object *megaObject, int32 x, int32 y, int32 dir)
fPolygrid += sizeof(WalkGridHeader);
_nBars = _resMan->getUint32(floorHeader.numBars);
- if (_nBars >= O_GRID_SIZE)
- {
+ if (_nBars >= O_GRID_SIZE) {
#ifdef DEBUG //check for id > number in file,
error("RouteFinder Error too many _bars %d", _nBars);
#endif
@@ -1925,8 +1888,7 @@ int32 Router::LoadWalkResources(Object *megaObject, int32 x, int32 y, int32 dir)
_nNodes = _resMan->getUint32(floorHeader.numNodes)+1; //array starts at 0 begins at a start _node has nnodes nodes and a target _node
- if (_nNodes >= O_GRID_SIZE)
- {
+ if (_nNodes >= O_GRID_SIZE) {
#ifdef DEBUG //check for id > number in file,
error("RouteFinder Error too many nodes %d", _nNodes);
#endif