diff options
author | Vincent Hamm | 2007-11-04 01:11:39 +0000 |
---|---|---|
committer | Vincent Hamm | 2007-11-04 01:11:39 +0000 |
commit | 6e4037165d49ed4ba1a6e76656eab2d03851eeda (patch) | |
tree | a8f38190adf5b2867d2a4ded717039cd928dfe67 /engines/cruise | |
parent | 034eb920d2e3c869ed16a011886ec1e69d50001c (diff) | |
download | scummvm-rg350-6e4037165d49ed4ba1a6e76656eab2d03851eeda.tar.gz scummvm-rg350-6e4037165d49ed4ba1a6e76656eab2d03851eeda.tar.bz2 scummvm-rg350-6e4037165d49ed4ba1a6e76656eab2d03851eeda.zip |
Fix a few script issues
svn-id: r29397
Diffstat (limited to 'engines/cruise')
-rw-r--r-- | engines/cruise/cell.cpp | 4 | ||||
-rw-r--r-- | engines/cruise/ctp.cpp | 13 | ||||
-rw-r--r-- | engines/cruise/ctp.h | 2 | ||||
-rw-r--r-- | engines/cruise/function.cpp | 22 | ||||
-rw-r--r-- | engines/cruise/mainDraw.cpp | 4 | ||||
-rw-r--r-- | engines/cruise/script.cpp | 7 |
6 files changed, 42 insertions, 10 deletions
diff --git a/engines/cruise/cell.cpp b/engines/cruise/cell.cpp index 6b93d3a7af..a608956192 100644 --- a/engines/cruise/cell.cpp +++ b/engines/cruise/cell.cpp @@ -275,7 +275,7 @@ void freezeCell(cellStruct * pObject, int overlayIdx, int objIdx, int objType, i } void sortCells(int16 param1, int16 param2, cellStruct *objPtr) { - int16 var; +/*int16 var; cellStruct *var8_; cellStruct *var40; cellStruct *var3E; @@ -358,7 +358,7 @@ void sortCells(int16 param1, int16 param2, cellStruct *objPtr) { } temp->prev = match; - } + }*/ } } // End of namespace Cruise diff --git a/engines/cruise/ctp.cpp b/engines/cruise/ctp.cpp index 7922d2c720..f6f52f9204 100644 --- a/engines/cruise/ctp.cpp +++ b/engines/cruise/ctp.cpp @@ -279,13 +279,22 @@ void loadCtpSub1(int boxIdx, int scale, uint16 *_walkboxTable, } } +int getNode(int nodeResult[2], int nodeId){ + if(nodeId < 0 || nodeId >= ctp_routeCoordCount) + return -1; + + nodeResult[0] = ctp_routeCoords[nodeId][0]; + nodeResult[1] = ctp_routeCoords[nodeId][1]; + + return 0; +} + int loadCtp(uint8 *ctpName) { int walkboxCounter; // si uint8 *ptr; uint8 *dataPointer; // ptr2 char fileType[5]; // string2 short int segementSizeTable[7]; // tempTable - char string[32]; if (ctpVar1 == 0) { int i; @@ -354,7 +363,7 @@ int loadCtp(uint8 *ctpName) { free(ptr); - strcpyuint8(string, currentCtpName); + strcpyuint8(currentCtpName, ctpName); numberOfWalkboxes = segementSizeTable[6] / 2; // get the number of walkboxes diff --git a/engines/cruise/ctp.h b/engines/cruise/ctp.h index 2ea47ce62e..8fe3987a60 100644 --- a/engines/cruise/ctp.h +++ b/engines/cruise/ctp.h @@ -54,6 +54,8 @@ extern ctpVar19Struct *ctpVar19; int loadCtp(uint8 * ctpName); int ctpProc2(int varX, int varY, int paramX, int paramY); +int getNode(int nodeResult[2], int nodeId); + } // End of namespace Cruise #endif diff --git a/engines/cruise/function.cpp b/engines/cruise/function.cpp index 128da02890..7225f4040b 100644 --- a/engines/cruise/function.cpp +++ b/engines/cruise/function.cpp @@ -1389,6 +1389,27 @@ int16 Op_2A(void) { return getProcParam(overlayIdx, 40, (uint8 *) var_26); } +int16 Op_SetObjectAtNode(void) { + int16 node = popVar(); + int16 obj = popVar(); + int16 ovl = popVar(); + + if(!ovl) + ovl = currentScriptPtr->overlayNumber;; + + int nodeInfo[2]; + + if(!getNode(nodeInfo, node)) + { + setObjectPosition(ovl, obj, 0, nodeInfo[0]); + setObjectPosition(ovl, obj, 1, nodeInfo[1]); + setObjectPosition(ovl, obj, 2, nodeInfo[1]); + setObjectPosition(ovl, obj, 4, computeZoom(nodeInfo[1])); + } + + return 0; +} + void setupOpcodeTable(void) { int i; @@ -1422,6 +1443,7 @@ void setupOpcodeTable(void) { opcodeTablePtr[0x18] = Op_AddAnimation; opcodeTablePtr[0x19] = Op_RemoveAnimation; opcodeTablePtr[0x1A] = Op_SetZoom; + opcodeTablePtr[0x1B] = Op_SetObjectAtNode; opcodeTablePtr[0x1E] = Op_1E; opcodeTablePtr[0x21] = Op_21; opcodeTablePtr[0x22] = Op_22; diff --git a/engines/cruise/mainDraw.cpp b/engines/cruise/mainDraw.cpp index 0b6d1de50c..2cd577547e 100644 --- a/engines/cruise/mainDraw.cpp +++ b/engines/cruise/mainDraw.cpp @@ -169,7 +169,7 @@ int16 XMIN_XMAX[404]; int16 polyBuffer4[512]; // this function fills the sizeTable for the poly (OLD: mainDrawSub1Sub2) -void getPolySize(int positionX, int positionY, int scale, int sizeTable[4], char *dataPtr) +void getPolySize(int positionX, int positionY, int scale, int sizeTable[4], unsigned char *dataPtr) { int upperBorder; int lowerBorder; @@ -1036,7 +1036,7 @@ void mainDrawPolygons(int fileIndex, cellStruct *pObject, int X, int scale, int flipPoly(fileIndex, (int16*)dataPtr, scale, &newFrame, X, Y, &newX, &newY, &newScale); // this function fills the sizeTable for the poly (OLD: mainDrawSub1Sub2) - getPolySize(newX, newY, newScale, sizeTable, (char*)newFrame); + getPolySize(newX, newY, newScale, sizeTable, (unsigned char*)newFrame); spriteX2 = sizeTable[0] - 2; // left border spriteX1 = sizeTable[1] + 18; // right border diff --git a/engines/cruise/script.cpp b/engines/cruise/script.cpp index bf54dd17a4..96bd280bb4 100644 --- a/engines/cruise/script.cpp +++ b/engines/cruise/script.cpp @@ -276,9 +276,9 @@ int32 opcodeType1(void) { di = currentScriptPtr->overlayNumber; } - if (var == 0x85) // Special case to handle... + if ((var == 0x85) && !strcmp((char*)currentCtpName, "S26.CTP") && !di && mode == 1) // patch in bar { - ASSERT(0); + var= 0x87; } setObjectPosition(di, var_4, mode, var); @@ -732,8 +732,7 @@ int executeScripts(scriptInstanceStruct *ptr) { currentScriptOpcodeType = opcodeType & 7; if (!opcodeTypeTable[(opcodeType & 0xFB) >> 3]) { - printf("Unsupported opcode type %d\n", - (opcodeType & 0xFB) >> 3); + printf("Unsupported opcode type %d\n", (opcodeType & 0xFB) >> 3); exit(1); return (-21); } |