[Scummvm-cvs-logs] scummvm master -> 0b4beb59b647b5ae6c2f783ad0031635bb6fcddc
Strangerke
Strangerke at scummvm.org
Sun Jun 1 11:52:35 CEST 2014
This automated email contains information about 6 new commits which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .
Summary:
c15f211486 CRUISE: Reduce the scope of some variables in actor and cruise_main
a6ead6bba8 CRUISE: Comment out some useless code
7f19bbb21d CRUISE: Reduce the scope of a variable, remove a useless increment
094b9d18bb CRUISE: Fix a bug in the decompiler
6b8348a6bd CRUISE: Fix a CppCheck error in decompiler
0b4beb59b6 CRUISE: Start renaming opcodes in the Decompiler, some rework
Commit: c15f2114862f2c2c3422519d578a0c8352626042
https://github.com/scummvm/scummvm/commit/c15f2114862f2c2c3422519d578a0c8352626042
Author: Strangerke (strangerke at scummvm.org)
Date: 2014-06-01T11:50:40+02:00
Commit Message:
CRUISE: Reduce the scope of some variables in actor and cruise_main
Changed paths:
engines/cruise/actor.cpp
engines/cruise/cruise_main.cpp
diff --git a/engines/cruise/actor.cpp b/engines/cruise/actor.cpp
index 0a7bbfe..331b1c1 100644
--- a/engines/cruise/actor.cpp
+++ b/engines/cruise/actor.cpp
@@ -289,16 +289,15 @@ void poly2(int x1, int y1, int x2, int y2) {
}
int point_proche(int16 table[][2]) {
- int x1, y1, i, x, y, p;
int d1 = 1000;
_vm->_polyStructs = &_vm->_polyStructNorm;
if (nclick_noeud == 1) {
- x = x_mouse;
- y = y_mouse;
- x1 = table_ptselect[0][0];
- y1 = table_ptselect[0][1];
+ int x = x_mouse;
+ int y = y_mouse;
+ int x1 = table_ptselect[0][0];
+ int y1 = table_ptselect[0][1];
_vm->_polyStructs = &_vm->_polyStructExp;
@@ -326,10 +325,10 @@ int point_proche(int16 table[][2]) {
}
_vm->_polyStructs = &_vm->_polyStructNorm;
- p = -1;
- for (i = 0; i < ctp_routeCoordCount; i++) {
- x = table[i][0];
- y = table[i][1];
+ int p = -1;
+ for (int i = 0; i < ctp_routeCoordCount; i++) {
+ int x = table[i][0];
+ int y = table[i][1];
int pointDistance = computeDistance(x_mouse, y_mouse, x, y);
if (pointDistance < d1) {
@@ -363,9 +362,7 @@ int8 Fsol[NBNOEUD + 1];
int D;
void explore(int depart, int arrivee) {
- int id1, id2, i;
-
- id1 = depart;
+ int id1 = depart;
fl[id1]++;
sol[idsol++] = (char)id1;
@@ -377,8 +374,9 @@ void explore(int depart, int arrivee) {
return;
}
+ int i;
while ((i = fl[id1]) < 20) {
- id2 = ctp_routes[id1][i + 1];
+ int id2 = ctp_routes[id1][i + 1];
if (id2 == arrivee) {
if (idsol < solmax) {
@@ -441,9 +439,6 @@ void chemin0(int depart, int arrivee) {
}
void valide_noeud(int16 table[], int16 p, int *nclick, int16 solution0[20 + 3][2]) {
- int a, b, d, i, p1, x1, x2, y1, y2;
- //int y=30;
-
table[*nclick] = p;
table[(*nclick) + 1] = -1;
table_ptselect[*nclick][0] = x_mouse;
@@ -452,10 +447,10 @@ void valide_noeud(int16 table[], int16 p, int *nclick, int16 solution0[20 + 3][2
_vm->_polyStructs = &_vm->_polyStructNorm;
if (*nclick == 2) { // second point
- x1 = table_ptselect[0][0];
- y1 = table_ptselect[0][1];
- x2 = table_ptselect[1][0];
- y2 = table_ptselect[1][1];
+ int x1 = table_ptselect[0][0];
+ int y1 = table_ptselect[0][1];
+ int x2 = table_ptselect[1][0];
+ int y2 = table_ptselect[1][1];
if ((x1 == x2) && (y1 == y2)) {
return;
}
@@ -504,13 +499,11 @@ void valide_noeud(int16 table[], int16 p, int *nclick, int16 solution0[20 + 3][2
} else {
solution0[0][0] = x1;
solution0[0][1] = y1;
- i = 0;
+ int i = 0;
while (solution[i] != -1) {
- p1 = solution[i];
- solution0[i + 1][0] =
- ctp_routeCoords[p1][0];
- solution0[++i][1] =
- ctp_routeCoords[p1][1];
+ int p1 = solution[i];
+ solution0[i + 1][0] = ctp_routeCoords[p1][0];
+ solution0[++i][1] = ctp_routeCoords[p1][1];
}
_vm->_polyStructs = &_vm->_polyStructExp;
poly2(x2, y2,
@@ -527,8 +520,8 @@ void valide_noeud(int16 table[], int16 p, int *nclick, int16 solution0[20 + 3][2
/****** Trim down any un-necessary walk points ******/
i++;
- d = 0;
- a = i;
+ int d = 0;
+ int a = i;
flag_obstacle = 1;
while (d != a) {
x1 = solution0[d][0];
@@ -544,7 +537,7 @@ void valide_noeud(int16 table[], int16 p, int *nclick, int16 solution0[20 + 3][2
flag_obstacle = 1;
if (d != i) {
i++;
- for (b = d + 1; b < i; b++) {
+ for (int b = d + 1; b < i; b++) {
solution0[b][0] = -2;
}
} else
diff --git a/engines/cruise/cruise_main.cpp b/engines/cruise/cruise_main.cpp
index b3f9308..f9ae722 100644
--- a/engines/cruise/cruise_main.cpp
+++ b/engines/cruise/cruise_main.cpp
@@ -989,7 +989,6 @@ bool findRelation(int objOvl, int objIdx, int x, int y) {
ovlDataStruct *ovl2 = NULL;
ovlDataStruct *ovl3 = NULL;
- //ovlDataStruct *ovl4 = NULL;
if (verbOvl > 0)
ovl2 = overlayTable[verbOvl].ovlData;
@@ -1079,9 +1078,6 @@ void callSubRelation(menuElementSubStruct *pMenuElement, int nOvl, int nObj) {
}
if ((obj2Ovl == nOvl) && (pHeader->obj2Number != -1) && (pHeader->obj2Number == nObj)) {
- int x = 60;
- int y = 60;
-
objectParamsQuery params;
memset(¶ms, 0, sizeof(objectParamsQuery)); // to remove warning
@@ -1129,6 +1125,8 @@ void callSubRelation(menuElementSubStruct *pMenuElement, int nOvl, int nObj) {
}
}
} else if (pHeader->type == RT_MSG) {
+ int x = 60;
+ int y = 60;
if (pHeader->obj2Number >= 0) {
if ((pHeader->trackX !=-1) && (pHeader->trackY !=-1) &&
@@ -1897,11 +1895,10 @@ void CruiseEngine::mainLoop() {
// Raoul appearing when looking at the book is being there are 3 script iterations separation between the
// scene being changed to the book, and the Raoul actor being frozen/disabled. This loop is a hack to ensure
// that does a few extra script executions for that scene
- bool bgChanged;
int numIterations = 1;
while (numIterations-- > 0) {
- bgChanged = backgroundChanged[masterScreen];
+ bool bgChanged = backgroundChanged[masterScreen];
manageScripts(&relHead);
manageScripts(&procHead);
Commit: a6ead6bba80f817fc0799e8d8fc3c789443e41f6
https://github.com/scummvm/scummvm/commit/a6ead6bba80f817fc0799e8d8fc3c789443e41f6
Author: Strangerke (strangerke at scummvm.org)
Date: 2014-06-01T11:50:42+02:00
Commit Message:
CRUISE: Comment out some useless code
Changed paths:
engines/cruise/cruise_main.cpp
diff --git a/engines/cruise/cruise_main.cpp b/engines/cruise/cruise_main.cpp
index f9ae722..c00f8a5 100644
--- a/engines/cruise/cruise_main.cpp
+++ b/engines/cruise/cruise_main.cpp
@@ -975,14 +975,16 @@ bool findRelation(int objOvl, int objIdx, int x, int y) {
if ((thisOvl == objOvl) && (objIdx == ptrHead->obj1Number) && pObject && (pObject->_class != THEME)) {
int verbOvl = ptrHead->verbOverlay;
int obj1Ovl = ptrHead->obj1Overlay;
- int obj2Ovl = ptrHead->obj2Overlay;
+ // Unused variable
+ // int obj2Ovl = ptrHead->obj2Overlay;
if (!verbOvl)
verbOvl = j;
if (!obj1Ovl)
obj1Ovl = j;
- if (!obj2Ovl)
- obj2Ovl = j;
+ // Unused variable
+ // if (!obj2Ovl)
+ // obj2Ovl = j;
char verbName[80];
verbName[0] = 0;
Commit: 7f19bbb21df67faf49642abf6df049e1768847ec
https://github.com/scummvm/scummvm/commit/7f19bbb21df67faf49642abf6df049e1768847ec
Author: Strangerke (strangerke at scummvm.org)
Date: 2014-06-01T11:50:44+02:00
Commit Message:
CRUISE: Reduce the scope of a variable, remove a useless increment
Changed paths:
engines/cruise/dataLoader.cpp
diff --git a/engines/cruise/dataLoader.cpp b/engines/cruise/dataLoader.cpp
index 8532d30..d242633 100644
--- a/engines/cruise/dataLoader.cpp
+++ b/engines/cruise/dataLoader.cpp
@@ -433,7 +433,6 @@ int loadSetEntry(const char *name, uint8 *ptr, int currentEntryIdx, int currentD
int resourceSize;
int fileIndex;
setHeaderEntry localBuffer;
- uint8 *ptr5;
Common::MemoryReadStream s4(ptr + offset + 6, 16);
@@ -472,12 +471,9 @@ int loadSetEntry(const char *name, uint8 *ptr, int currentEntryIdx, int currentD
filesDatabase[fileIndex].width += 2;
}
- ptr5 = ptr3 + localBuffer.offset + numIdx * 16;
-
+ uint8 *ptr5 = ptr3 + localBuffer.offset + numIdx * 16;
memcpy(filesDatabase[fileIndex].subData.ptr, ptr5, resourceSize);
- ptr5 += resourceSize;
-
switch (localBuffer.type) {
case 0: { // polygon
filesDatabase[fileIndex].subData.resourceType = OBJ_TYPE_POLY;
Commit: 094b9d18bbaa4780629ac9d8d836f20548c965dc
https://github.com/scummvm/scummvm/commit/094b9d18bbaa4780629ac9d8d836f20548c965dc
Author: Strangerke (strangerke at scummvm.org)
Date: 2014-06-01T11:50:45+02:00
Commit Message:
CRUISE: Fix a bug in the decompiler
Changed paths:
engines/cruise/decompiler.cpp
diff --git a/engines/cruise/decompiler.cpp b/engines/cruise/decompiler.cpp
index 043946a..4149c71 100644
--- a/engines/cruise/decompiler.cpp
+++ b/engines/cruise/decompiler.cpp
@@ -491,7 +491,7 @@ int decompOpcodeType2() {
char buffer3[256];
char varName[256];
int byte1 = getByteFromDecompScriptReal();
- int byte2 = getByteFromDecompScriptReal();
+ getByteFromDecompScriptReal();
getShortFromDecompScript(buffer3);
resolveVarName("0", byte1 & 7, buffer3, varName);
@@ -502,7 +502,7 @@ int decompOpcodeType2() {
}
case 5: {
int byte1 = getByteFromDecompScriptReal();
- int byte2 = getByteFromDecompScriptReal();
+ getByteFromDecompScriptReal();
short int short1 = getShortFromDecompScriptReal();
int8 *ptr = scriptDataPtrTable[byte1 & 7] + short1;
@@ -1405,16 +1405,14 @@ void dumpScript(uint8 *ovlName, ovlDataStruct *ovlData, int idx) {
if (decompileLineTable[i].pendingElse) {
fprintf(fHandle, "%05d:\t",
decompileLineTable[i].lineOffset);
- fprintf(fHandle, "else", decompileLineTable[i].line);
- fprintf(fHandle, "\n");
+ fprintf(fHandle, "else %s\n", decompileLineTable[i].line);
}
fprintf(fHandle, "%05d:\t", decompileLineTable[i].lineOffset);
for (int j = 0; j < decompileLineTable[i].indent; j++)
fprintf(fHandle, "\t");
- fprintf(fHandle, "%s", decompileLineTable[i].line);
- fprintf(fHandle, "\n");
+ fprintf(fHandle, "%s\n", decompileLineTable[i].line);
}
fclose(fHandle);
Commit: 6b8348a6bdf8b33008a2320adb10ab8c44779503
https://github.com/scummvm/scummvm/commit/6b8348a6bdf8b33008a2320adb10ab8c44779503
Author: Strangerke (strangerke at scummvm.org)
Date: 2014-06-01T11:50:47+02:00
Commit Message:
CRUISE: Fix a CppCheck error in decompiler
Changed paths:
engines/cruise/decompiler.cpp
diff --git a/engines/cruise/decompiler.cpp b/engines/cruise/decompiler.cpp
index 4149c71..1e8b561 100644
--- a/engines/cruise/decompiler.cpp
+++ b/engines/cruise/decompiler.cpp
@@ -555,7 +555,7 @@ int decompMath() {
break;
}
case 4: {
- sprintf(tempbuffer, "%s\%%s", param1, param2);
+ sprintf(tempbuffer, "%s % %s", param1, param2);
pushDecomp(tempbuffer);
break;
}
Commit: 0b4beb59b647b5ae6c2f783ad0031635bb6fcddc
https://github.com/scummvm/scummvm/commit/0b4beb59b647b5ae6c2f783ad0031635bb6fcddc
Author: Strangerke (strangerke at scummvm.org)
Date: 2014-06-01T11:50:49+02:00
Commit Message:
CRUISE: Start renaming opcodes in the Decompiler, some rework
Changed paths:
engines/cruise/decompiler.cpp
diff --git a/engines/cruise/decompiler.cpp b/engines/cruise/decompiler.cpp
index 1e8b561..daedfbc 100644
--- a/engines/cruise/decompiler.cpp
+++ b/engines/cruise/decompiler.cpp
@@ -697,46 +697,39 @@ int decompSwapStack() {
int decompFunction() {
currentScriptOpcodeType = getByteFromDecompScriptReal();
-// addDecomp("OP_%X", currentScriptOpcodeType);
switch (currentScriptOpcodeType) {
- case 0x1: {
- pushDecomp("_setdoFade()");
+ case 0x1:
+ pushDecomp("Op_FadeIn()");
break;
- }
- case 0x2: {
- pushDecomp("_prepareFade()");
+
+ case 0x2:
+ pushDecomp("Op_FadeOut()");
break;
- }
- case 0x3: {
- sprintf(tempbuffer, "_loadBackground(%s,%s)",
- popDecomp(), popDecomp());
+
+ case 0x3:
+ sprintf(tempbuffer, "Op_loadBackground(%s,%s)", popDecomp(), popDecomp());
pushDecomp(tempbuffer);
break;
- }
- case 0x4: {
- sprintf(tempbuffer, "_loadFullBundle(%s,%s)",
- popDecomp(), popDecomp());
+
+ case 0x4:
+ sprintf(tempbuffer, "Op_LoadAbs(%s,%s)", popDecomp(), popDecomp());
pushDecomp(tempbuffer);
break;
- }
- case 0x5: {
- sprintf(tempbuffer, "_addCell(%s,%s,%s)", popDecomp(),
- popDecomp(), popDecomp());
+
+ case 0x5:
+ sprintf(tempbuffer, "Op_AddCell(%s,%s,%s)", popDecomp(), popDecomp(), popDecomp());
pushDecomp(tempbuffer);
break;
- }
+
case 0x6: {
unsigned long int numArg = atoi(popDecomp());
- char *ovlStr;
- char *idxStr;
char functionName[100];
- idxStr = popDecomp();
- ovlStr = popDecomp();
+ char *idxStr = popDecomp();
+ char *ovlStr = popDecomp();
resolveVarName(ovlStr, 0x20, idxStr, functionName);
-
- sprintf(tempbuffer, "_startASync(%s", functionName);
+ sprintf(tempbuffer, "Op_AddProc(%s", functionName);
for (int i = 0; i < numArg; i++) {
strcatuint8(tempbuffer, ",");
@@ -747,74 +740,62 @@ int decompFunction() {
pushDecomp(tempbuffer);
break;
- }
- case 0x7: {
- char *var1;
- char *objIdxStr;
- char *ovlStr;
+ }
- var1 = popDecomp();
- objIdxStr = popDecomp();
- ovlStr = popDecomp();
+ case 0x7: {
+ char *var1 = popDecomp();
+ char *objIdxStr = popDecomp();
+ char *ovlStr = popDecomp();
- sprintf(tempbuffer,
- "_createObjectFromOvlData(ovl:%s,dataIdx:%s,%s)",
- ovlStr, objIdxStr, var1);
+ sprintf(tempbuffer, "Op_InitializeState(ovl:%s,dataIdx:%s,%s)", ovlStr, objIdxStr, var1);
pushDecomp(tempbuffer);
break;
- }
- case 0x8: {
- sprintf(tempbuffer, "_removeCell(%s,%s,%s)",
- popDecomp(), popDecomp(), popDecomp());
+ }
+
+ case 0x8:
+ sprintf(tempbuffer, "Op_RemoveCell(%s,%s,%s)", popDecomp(), popDecomp(), popDecomp());
pushDecomp(tempbuffer);
break;
- }
- case 0x9: {
- pushDecomp("_freeobjectList()");
+
+ case 0x9:
+ pushDecomp("Op_FreeCell()");
break;
- }
- case 0xA: {
- sprintf(tempbuffer, "_removeScript(ovl(%s),%s)",
- popDecomp(), popDecomp());
+
+ case 0xA:
+ sprintf(tempbuffer, "Op_RemoveProc(ovl(%s),%s)", popDecomp(), popDecomp());
pushDecomp(tempbuffer);
break;
- }
- case 0xB: {
- sprintf(tempbuffer, "_resetFilesEntries(%s,%s)",
- popDecomp(), popDecomp());
+
+ case 0xB:
+ sprintf(tempbuffer, "Op_RemoveFrame(%s,%s)", popDecomp(), popDecomp());
pushDecomp(tempbuffer);
break;
- }
- case 0xC: {
- sprintf(tempbuffer, "_loadOverlay(%s)", popDecomp());
+
+ case 0xC:
+ sprintf(tempbuffer, "Op_LoadOverlay(%s)", popDecomp());
pushDecomp(tempbuffer);
break;
- }
- case 0xD: {
- sprintf(tempbuffer, "_palManipulation(%s,%s,%s,%s,%s)",
- popDecomp(), popDecomp(), popDecomp(), popDecomp(),
- popDecomp());
+
+ case 0xD:
+ sprintf(tempbuffer, "Op_SetColor(%s,%s,%s,%s,%s)", popDecomp(), popDecomp(), popDecomp(), popDecomp(), popDecomp());
pushDecomp(tempbuffer);
break;
- }
- case 0xE: {
- sprintf(tempbuffer, "_playSample(%s,%s,%s,%s)",
- popDecomp(), popDecomp(), popDecomp(),
- popDecomp());
+
+ case 0xE:
+ sprintf(tempbuffer, "Op_PlayFX(%s,%s,%s,%s)", popDecomp(), popDecomp(), popDecomp(), popDecomp());
pushDecomp(tempbuffer);
break;
- }
- case 0x10: {
- sprintf(tempbuffer, "_releaseScript2(%s)",
- popDecomp());
+
+ case 0x10:
+ sprintf(tempbuffer, "Op_FreeOverlay(%s)", popDecomp());
pushDecomp(tempbuffer);
break;
- }
- case 0x11: {
- sprintf(tempbuffer, "_getOverlayIdx(%s)", popDecomp());
+
+ case 0x11:
+ sprintf(tempbuffer, "Op_FindOverlay(%s)", popDecomp());
pushDecomp(tempbuffer);
break;
- }
+
case 0x13: {
sprintf(tempbuffer,
"_displayMessage(%s,\"%s\",%s,%s,%s,%s)",
More information about the Scummvm-git-logs
mailing list