diff options
author | Vincent Hamm | 2007-10-28 14:41:37 +0000 |
---|---|---|
committer | Vincent Hamm | 2007-10-28 14:41:37 +0000 |
commit | fc961908c59790840008049a1d97e675376312f9 (patch) | |
tree | 5d6c4e2258c8b5ebd8888e90b882a8cea3a2efc9 /engines/cruise | |
parent | 30b11df046134935133e788fffe6180c9600d199 (diff) | |
download | scummvm-rg350-fc961908c59790840008049a1d97e675376312f9.tar.gz scummvm-rg350-fc961908c59790840008049a1d97e675376312f9.tar.bz2 scummvm-rg350-fc961908c59790840008049a1d97e675376312f9.zip |
Find object fix
Walk fix
svn-id: r29291
Diffstat (limited to 'engines/cruise')
-rw-r--r-- | engines/cruise/actor.cpp | 12 | ||||
-rw-r--r-- | engines/cruise/cruise_main.cpp | 169 | ||||
-rw-r--r-- | engines/cruise/cruise_main.h | 11 | ||||
-rw-r--r-- | engines/cruise/function.cpp | 5 | ||||
-rw-r--r-- | engines/cruise/object.cpp | 3 |
5 files changed, 100 insertions, 100 deletions
diff --git a/engines/cruise/actor.cpp b/engines/cruise/actor.cpp index 57a2c0c1ca..be4d1a13f7 100644 --- a/engines/cruise/actor.cpp +++ b/engines/cruise/actor.cpp @@ -581,8 +581,7 @@ void valide_noeud(int16 table[], int16 p, int *nclick, int16 solution0[20 + 3][2 } //computePathfinding(returnVar2, params.X, params.Y, aniX, aniY, currentActor->stepX, currentActor->stepY); -int16 computePathfinding(int16 *pSolution, int16 x, int16 y, int16 destX, - int16 destY, int16 stepX, int16 stepY, int16 oldPathId) { +int16 computePathfinding(int16 *pSolution, int16 x, int16 y, int16 destX, int16 destY, int16 stepX, int16 stepY, int16 oldPathId) { persoStruct *perso; int num; @@ -762,16 +761,15 @@ int raoul_invstat[][13] = { void processAnimation(void) { objectParamsQuery params; int16 returnVar2[5]; - actorStruct *currentActor = &actorHead; + actorStruct *currentActor = actorHead.next; actorStruct *nextActor; while (currentActor) { nextActor = currentActor->next; - if (!currentActor->freeze && ((currentActor->type == 0) - || (currentActor->type == 1))) { - getMultipleObjectParam(currentActor->overlayNumber, - currentActor->idx, ¶ms); + if (!currentActor->freeze && ((currentActor->type == 0) || (currentActor->type == 1))) + { + getMultipleObjectParam(currentActor->overlayNumber, currentActor->idx, ¶ms); if (((animationStart && !currentActor->flag) || (!animationStart && currentActor->x_dest != -1 && currentActor->y_dest != -1)) && (currentActor->type == 0)) { // mouse animation diff --git a/engines/cruise/cruise_main.cpp b/engines/cruise/cruise_main.cpp index 6fce363c32..0b6ec91581 100644 --- a/engines/cruise/cruise_main.cpp +++ b/engines/cruise/cruise_main.cpp @@ -607,120 +607,111 @@ int buttonDown; int selectDown = 0; int menuDown = 0; -int getCursorFromObject(int mouseX, int mouseY, int *outX, int *outY) { - int16 var_2; - int16 var_4; - int16 var_14; - int16 var_16; - objectParamsQuery params; - int16 var_10; - int16 var_E; - int16 var_C; -// int16 var_42; - int16 var_A; - int16 var_6; - +int findObject(int mouseX, int mouseY, int *outObjOvl, int *outObjIdx) +{ char objectName[80]; cellStruct *currentObject = cellHead.prev; while (currentObject) { - if (currentObject->overlay >= 0 && overlayTable[currentObject->overlay].alreadyLoaded && (currentObject->type == 4 || currentObject->type == 1 || currentObject->type == 9 || currentObject->type == 3)) + if (currentObject->overlay >= 0 && overlayTable[currentObject->overlay].alreadyLoaded && (currentObject->type == OBJ_TYPE_SPRITE || currentObject->type == OBJ_TYPE_MASK || currentObject->type == OBJ_TYPE_EXIT || currentObject->type == OBJ_TYPE_VIRTUEL)) { char* pObjectName = getObjectName(currentObject->idx, overlayTable[currentObject->overlay].ovlData->specialString2); if(pObjectName) { strcpy(objectName, pObjectName); - if (strlen(objectName)) { - if (currentObject->freeze == 0) { - var_2 = currentObject->idx; - var_4 = currentObject->overlay; - var_14 = currentObject->followObjectIdx; - var_16 = currentObject->followObjectOverlayIdx; + if (strlen(objectName) && (currentObject->freeze == 0)) + { + int objIdx = currentObject->idx; + int objOvl = currentObject->overlay; + int linkedObjIdx = currentObject->followObjectIdx; + int linkedObjOvl = currentObject->followObjectOverlayIdx; - getMultipleObjectParam(currentObject->overlay, currentObject->idx, ¶ms); + objectParamsQuery params; + getMultipleObjectParam(objOvl, objIdx, ¶ms); - var_10 = 0; - var_E = 0; - var_C = 0; + int x2 = 0; + int y2 = 0; + int j2 = 0; - if ((var_4 != var_16) - && (var_2 != var_14)) { - getMultipleObjectParam - (var_16, var_14, ¶ms); + if ((objOvl != linkedObjOvl) || (objIdx != linkedObjIdx)) + { + getMultipleObjectParam(linkedObjOvl, linkedObjIdx, ¶ms); - var_C = params.X; - var_E = params.Y; - var_10 = params.fileIdx; - } + x2 = params.X; + y2 = params.Y; + j2 = params.fileIdx; + } + + if (params.var5 >= 0 && params.fileIdx >= 0) + { + if (currentObject->type == OBJ_TYPE_SPRITE || currentObject->type == OBJ_TYPE_MASK || currentObject->type == OBJ_TYPE_EXIT) + { + int x = params.X + x2; + int y = params.Y + y2; + int j = params.fileIdx; - if (params.var5 >= 0 && params.fileIdx >= 0) { - if (currentObject->type == 3) { - assert(0); + if (j >= 0) { + j += j2; + } - var_2 = params.scale; - var_A = params.X + var_C; + /*if ((filesDatabase[j].subData.resourceType == OBJ_TYPE_POLY) && (filesDatabase[j].subData.ptr)) { + ASSERT(0); + } + else*/ + { + int numBitPlanes = filesDatabase[j].resType; - // 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; + int nWidth; + int nHeight; - return (currentObject->type); + if (numBitPlanes == 1) + { + nWidth = filesDatabase[j].widthInColumn / 2; + } else { + nWidth = filesDatabase[j].width; } - } 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; + nHeight = filesDatabase[j].height; - if (di < 0) { - di += var_10; - } + int offsetX = mouseX - x; + int offsetY = mouseY - y; - /* if ((filesDatabase[di].subData.resourceType == 8) && (filesDatabase[di].subData.ptr)) { - assert(0); - } - */ + if ((offsetX >= 0) && (offsetX < nWidth * 16) && (offsetY >= 0) && (nWidth <= nHeight) && filesDatabase[j].subData.ptr) { - var_4 = filesDatabase[di].resType; - - if (var_4 == 1) { - var_C = filesDatabase[di].widthInColumn / 2; - } else { - var_C = filesDatabase[di].width; + if (numBitPlanes == 1) + { + } + else + { } - var_8 = filesDatabase[di].height; - - var_2 = mouseX - var_A; - si = mouseY - var_6; + printf("should compare to mask in findObject...\n"); - if (var_2 > 0 && var_C > var_2 && si > 0 && var_8 >= si) { - if (filesDatabase[di].subData.ptr) { - if (var_4 == 1) { - } else { - } + *outObjOvl = objOvl; + *outObjIdx = objIdx; - printf("should compare to mask in getCursorFromObject...\n"); + printf("Selected: %s\n", objectName); - *outX = var_16; - *outY = var_14; + return currentObject->type; + } + } + } + else if (currentObject->type == OBJ_TYPE_VIRTUEL) + { + int x = params.X + x2; + int y = params.Y + y2; + int width = params.fileIdx; + int height = params.scale; - printf("Selected: %s\n", objectName); + if ((mouseX >= x) && (mouseX <= x+width) && (mouseY >= y) && (mouseY <= y+height)) + { + *outObjOvl = objOvl; + *outObjIdx = objIdx; - return currentObject->type; - } - } - } + return (currentObject->type); } } } @@ -731,8 +722,8 @@ int getCursorFromObject(int mouseX, int mouseY, int *outX, int *outY) { currentObject = currentObject->prev; } - *outX = 0; - *outY = 0; + *outObjOvl = 0; + *outObjIdx = 0; return -1; } @@ -1120,7 +1111,7 @@ int processInput(void) int Y; int objIdx; - objIdx = getCursorFromObject(mouseX, mouseY, &X, &Y); + objIdx = findObject(mouseX, mouseY, &X, &Y); if (objIdx != -1) { @@ -1435,21 +1426,21 @@ void mainLoop(void) { if (mouseX != oldMouseX && mouseY != oldMouseY) { - int cursorType; + int objectType; int newCursor1; int newCursor2; oldMouseX = mouseX; oldMouseY = mouseY; - cursorType = getCursorFromObject(mouseX, mouseY, &newCursor1, &newCursor2); + objectType = findObject(mouseX, mouseY, &newCursor1, &newCursor2); - if (cursorType == 9) + if (objectType == 9) { changeCursor(CURSOR_EXIT); } else - if (cursorType != -1) + if (objectType != -1) { changeCursor(CURSOR_MAGNIFYING_GLASS); } diff --git a/engines/cruise/cruise_main.h b/engines/cruise/cruise_main.h index 8a126e0250..573048eae6 100644 --- a/engines/cruise/cruise_main.h +++ b/engines/cruise/cruise_main.h @@ -67,6 +67,17 @@ namespace Cruise { #define ASSERT_PTR assert #define ASSERT assert +#define OBJ_TYPE_LINE 0 +#define OBJ_TYPE_MASK 1 +#define OBJ_TYPE_BGMK 2 +#define OBJ_TYPE_VIRTUEL 3 +#define OBJ_TYPE_SPRITE 4 +#define OBJ_TYPE_MSG 5 +#define OBJ_TYPE_SOUND 6 +#define OBJ_TYPE_FONT 7 +#define OBJ_TYPE_POLY 8 +#define OBJ_TYPE_EXIT 9 + bool delphineUnpack(byte *dst, const byte *src, int len); ovlData3Struct *getOvlData3Entry(int32 scriptNumber, int32 param); diff --git a/engines/cruise/function.cpp b/engines/cruise/function.cpp index 35c6e46737..ddfa143418 100644 --- a/engines/cruise/function.cpp +++ b/engines/cruise/function.cpp @@ -681,8 +681,9 @@ int16 Op_AddMessage(void) { overlayIdx = currentScriptPtr->overlayNumber; if (color == -1) { - color = 0; - ASSERT(0); + color = 1; + printf("Unimplemented automatic message color\n"); + // ASSERT(0); //color = calcTabSomething(); } else { if (CVTLoaded) { diff --git a/engines/cruise/object.cpp b/engines/cruise/object.cpp index 22e81dea90..995f4857e9 100644 --- a/engines/cruise/object.cpp +++ b/engines/cruise/object.cpp @@ -57,8 +57,7 @@ objDataStruct *getObjectDataFromOverlay(int ovlIdx, int objIdx) { return (&var_6[objIdx]); } -int16 getMultipleObjectParam(int16 overlayIdx, int16 objectIdx, - objectParamsQuery *returnParam) { +int16 getMultipleObjectParam(int16 overlayIdx, int16 objectIdx, objectParamsQuery *returnParam) { int16 size; int16 var_A; int16 var_14; |