aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--dists/msvc8/cruise.vcproj2
-rw-r--r--engines/cruise/actor.cpp28
-rw-r--r--engines/cruise/actor.h2
-rw-r--r--engines/cruise/cruise_main.cpp349
-rw-r--r--engines/cruise/cruise_main.h2
-rw-r--r--engines/cruise/function.cpp18
-rw-r--r--engines/cruise/mainDraw.cpp5
-rw-r--r--engines/cruise/menu.cpp11
-rw-r--r--engines/cruise/overlay.h18
-rw-r--r--engines/cruise/saveload.cpp4
-rw-r--r--engines/cruise/script.cpp4
-rw-r--r--engines/cruise/script.h4
-rw-r--r--engines/cruise/vars.cpp6
-rw-r--r--engines/cruise/vars.h10
14 files changed, 322 insertions, 141 deletions
diff --git a/dists/msvc8/cruise.vcproj b/dists/msvc8/cruise.vcproj
index 68c19e0db5..45479ef22f 100644
--- a/dists/msvc8/cruise.vcproj
+++ b/dists/msvc8/cruise.vcproj
@@ -1,4 +1,4 @@
-<?xml version="1.0" encoding="windows-1250"?>
+<?xml version="1.0" encoding="Windows-1252"?>
<VisualStudioProject
ProjectType="Visual C++"
Version="8,00"
diff --git a/engines/cruise/actor.cpp b/engines/cruise/actor.cpp
index be4d1a13f7..777b09d214 100644
--- a/engines/cruise/actor.cpp
+++ b/engines/cruise/actor.cpp
@@ -27,16 +27,18 @@
namespace Cruise {
-int16 mainProc13(int overlayIdx, int param1, actorStruct *pStartEntry,
- int param2) {
+int16 mainProc13(int overlayIdx, int param1, actorStruct *pStartEntry, int param2) {
actorStruct *pCurrentEntry = pStartEntry->next;
while (pCurrentEntry) {
- if ((pCurrentEntry->overlayNumber == overlayIdx
- || overlayIdx == -1) && (pCurrentEntry->idx == param1
- || param1 == -1) && (pCurrentEntry->type == param2
- || param2 == -1) && (pCurrentEntry->pathId != -2)) {
- return 0;
+ if ((pCurrentEntry->overlayNumber == overlayIdx || overlayIdx == -1) &&
+ (pCurrentEntry->idx == param1 || param1 == -1) &&
+ (pCurrentEntry->type == param2 || param2 == -1))
+ {
+ if(pCurrentEntry->pathId != -2)
+ {
+ return 0;
+ }
}
pCurrentEntry = pCurrentEntry->next;
@@ -45,15 +47,14 @@ int16 mainProc13(int overlayIdx, int param1, actorStruct *pStartEntry,
return 1;
}
-actorStruct *findActor(int overlayIdx, int param1, actorStruct *pStartEntry,
- int param2) {
+actorStruct *findActor(actorStruct *pStartEntry, int overlayIdx, int objIdx, int type) {
actorStruct *pCurrentEntry = pStartEntry->next;
while (pCurrentEntry) {
if ((pCurrentEntry->overlayNumber == overlayIdx
- || overlayIdx == -1) && (pCurrentEntry->idx == param1
- || param1 == -1) && (pCurrentEntry->type == param2
- || param2 == -1)) {
+ || overlayIdx == -1) && (pCurrentEntry->idx == objIdx
+ || objIdx == -1) && (pCurrentEntry->type == type
+ || type == -1)) {
return pCurrentEntry;
}
@@ -598,7 +599,8 @@ int16 computePathfinding(int16 *pSolution, int16 x, int16 y, int16 destX, int16
}
}
- if (!flagCt) {
+ //if (!flagCt)
+ {
int i;
int16 *ptr;
diff --git a/engines/cruise/actor.h b/engines/cruise/actor.h
index 43b9b03e87..6769d14c90 100644
--- a/engines/cruise/actor.h
+++ b/engines/cruise/actor.h
@@ -67,7 +67,7 @@ extern int raoul_stat[][13];
extern int raoul_invstat[][13];
int16 mainProc13(int overlayIdx, int param1, actorStruct * pStartEntry, int param2);
-actorStruct *findActor(int overlayIdx, int param1, actorStruct * pStartEntry, int param2);
+actorStruct *findActor(actorStruct *pStartEntry, int overlayIdx, int objIdx, int type);
void processAnimation(void);
void getPixel(int x, int y);
diff --git a/engines/cruise/cruise_main.cpp b/engines/cruise/cruise_main.cpp
index a3e847a98a..dd4b925900 100644
--- a/engines/cruise/cruise_main.cpp
+++ b/engines/cruise/cruise_main.cpp
@@ -34,6 +34,8 @@ namespace Cruise {
unsigned int timer = 0;
+gfxEntryStruct* linkedMsgList = NULL;
+
void drawSolidBox(int32 x1, int32 y1, int32 x2, int32 y2, uint8 color) {
int32 i;
int32 j;
@@ -567,7 +569,7 @@ int initAllData(void) {
if (bootOverlayNumber) {
positionInStack = 0;
- attacheNewScriptToTail(bootOverlayNumber, &procHead, 0, 20, 0, 0, scriptType_PROC);
+ attacheNewScriptToTail(&procHead, bootOverlayNumber, 0, 20, 0, 0, scriptType_PROC);
scriptFunc2(bootOverlayNumber, &procHead, 1, 0);
}
@@ -836,7 +838,8 @@ menuElementSubStruct *getSelectedEntryInMenu(menuStruct *pMenu) {
return NULL;
}
-bool findRelation(int objOvl, int objIdx, int x, int y) {
+bool findRelation(int objOvl, int objIdx, int x, int y)
+{
bool found = false;
bool first = true;
int testState;
@@ -924,12 +927,12 @@ bool findRelation(int objOvl, int objIdx, int x, int y) {
if( (!first) && ((testState==-1) || (testState==objectState)))
{
if(!strlen(verbe_name))
- attacheNewScriptToTail(j, &relHead, ptrHead->id, 30, currentScriptPtr->scriptNumber, currentScriptPtr->overlayNumber, scriptType_REL);
+ attacheNewScriptToTail(&relHead, j, ptrHead->id, 30, currentScriptPtr->scriptNumber, currentScriptPtr->overlayNumber, scriptType_REL);
else if(ovl2->nameVerbGlob)
{
found = true;
ptr = getObjectName(ptrHead->verbNumber, ovl2->nameVerbGlob);
- addSelectableMenuEntry(i, j, menuTable[0], 1, -1, ptr);
+ addSelectableMenuEntry(j, i, menuTable[0], 1, -1, ptr);
}
}
}
@@ -944,15 +947,14 @@ bool findRelation(int objOvl, int objIdx, int x, int y) {
int processInventory(void) {
if (menuTable[1]) {
- menuElementSubStruct *pMenuElementSub =
- getSelectedEntryInMenu(menuTable[1]);
+ menuElementSubStruct *pMenuElementSub = getSelectedEntryInMenu(menuTable[1]);
if (pMenuElementSub) {
//int var2;
//int var4;
- var2 = pMenuElementSub->var2;
- var4 = pMenuElementSub->var4;
+ var2 = pMenuElementSub->ovlIdx;
+ var4 = pMenuElementSub->header;
freeMenu(menuTable[1]);
menuTable[1] = NULL;
@@ -969,6 +971,122 @@ int processInventory(void) {
return 0;
}
+void callSubRelation(menuElementSubStruct *pMenuElement, int nOvl, int nObj)
+{
+ if(pMenuElement == NULL)
+ return;
+
+ menuElementSubStruct* pCurrent = pMenuElement;
+
+ while(pCurrent != NULL)
+ {
+ int ovlIdx = pCurrent->ovlIdx;
+ int header = pCurrent->header;
+
+ linkDataStruct* pHeader = &overlayTable[ovlIdx].ovlData->arrayMsgRelHeader[header];
+
+ int obj2Ovl = pHeader->obj2Overlay;
+ if(obj2Ovl == 0)
+ {
+ obj2Ovl = ovlIdx;
+ }
+
+ if((obj2Ovl == nOvl) && (pHeader->obj2Number != -1) && (pHeader->obj2Number == nObj))
+ {
+ int x = 60;
+ int y = 60;
+
+ objectParamsQuery params;
+ memset(&params, 0, sizeof(objectParamsQuery)); // to remove warning
+
+ if(pHeader->obj2Number >= 0)
+ {
+ getMultipleObjectParam(obj2Ovl, pHeader->obj2Number, &params);
+ }
+
+ if((pHeader->field_1C != -1) || (params.scale == pHeader->field_1C))
+ {
+ if(pHeader->type == 30)
+ {
+ ASSERT(0);
+ }
+ else
+ if(pHeader->type == 50)
+ {
+ ASSERT(0);
+ }
+ }
+ }
+
+ pCurrent = pCurrent->pNext;
+ }
+}
+
+void callRelation(menuElementSubStruct *pMenuElement, int nObj2)
+{
+ if(pMenuElement == NULL)
+ return;
+
+ menuElementSubStruct* pCurrent = pMenuElement;
+
+ while(pCurrent != NULL)
+ {
+ int ovlIdx = pCurrent->ovlIdx;
+ int header = pCurrent->header;
+
+ linkDataStruct* pHeader = &overlayTable[ovlIdx].ovlData->arrayMsgRelHeader[header];
+
+ if(pHeader->obj2Number == nObj2)
+ {
+ if(pHeader->type == 30)
+ {
+ attacheNewScriptToTail(&relHead, ovlIdx, pHeader->id, 30, currentScriptPtr->scriptNumber, currentScriptPtr->overlayNumber, scriptType_REL);
+
+ if((narratorOvl > 0) && (pHeader->field_12 != -1) && (pHeader->field_14 != -1))
+ {
+ actorStruct* pTrack = findActor(&actorHead, narratorOvl, narratorIdx, 0);
+
+ if(pTrack)
+ {
+ animationStart = false;
+
+ if(pHeader->field_1E == 9999)
+ {
+ ASSERT(0);
+ }
+ else if((pHeader->field_12 == 9999) && (pHeader->field_14 == 9999))
+ {
+ ASSERT(0);
+ }
+ else
+ {
+ pTrack->x_dest = pHeader->field_12;
+ pTrack->y_dest = pHeader->field_14;
+ pTrack->endDirection = pHeader->field_1E;
+ }
+
+ pTrack->flag = 1;
+
+ autoTrack = true;
+ userEnabled = 0;
+ changeScriptParamInList(ovlIdx, pHeader->id, &relHead, 9998, 0);
+ }
+ }
+ }
+ else
+ {
+ ASSERT(0);
+ }
+ }
+ else
+ {
+ linkedRelation = pMenuElement;
+ }
+
+ pCurrent = pCurrent->pNext;
+ }
+}
+
int processInput(void)
{
int16 mouseX = 0;
@@ -1026,72 +1144,93 @@ int processInput(void)
ASSERT(0);
}
else
+ if ((button & 1) && (buttonDown == 0))
{
- // not in dialogue
-
// left click
- if ((button & 1) && (buttonDown == 0))
+ buttonDown = 1;
+
+ // is there a relation
+ if (linkedRelation)
{
- buttonDown = 1;
+ // call sub relation when clicking on an object
+ if(menuDown == 0)
+ {
+ if(menuTable[0])
+ {
+ int objOvl;
+ int objIdx;
+ int objType;
+
+ objType = findObject(mouseX, mouseY, &objOvl, &objIdx);
- // is there a relation
- if (linkedRelation)
+ if (objType != -1)
+ {
+ callSubRelation(linkedRelation, objOvl, objIdx);
+ }
+ freeMenu(menuTable[0]);
+ menuTable[0] = NULL;
+ }
+
+ if(linkedMsgList)
+ {
+ ASSERT(0);
+// freeMsgList(linkedMsgList);
+ }
+ linkedMsgList = NULL;
+ linkedRelation = NULL;
+ changeCursor(CURSOR_NORMAL);
+ }
+ // call sub relation when clicking in inventory
+ else
{
ASSERT(0);
}
- else
+ }
+ else
+ {
+ // manage click on object menu
+ if (menuDown == 0)
{
- // manage click on object menu
- if (menuDown == 0)
+ // Handle left click on an object
+ if (menuTable[0] == 0)
{
- // Handle left click on an object
- if (menuTable[0] == 0)
- {
- int objOvl;
- int objIdx;
- int objType;
+ int objOvl;
+ int objIdx;
+ int objType;
- objType = findObject(mouseX, mouseY, &objOvl, &objIdx);
+ objType = findObject(mouseX, mouseY, &objOvl, &objIdx);
- if (objType != -1)
+ if (objType != -1)
+ {
+ int relation = findRelation(objOvl, objIdx, mouseX, mouseY);
+ if(menuTable[0])
{
- int relation = findRelation(objOvl, objIdx, mouseX, mouseY);
- if(menuTable[0])
+ if(relation)
{
- if(relation)
- {
- currentActiveMenu = 0;
- selectDown = 1;
- }
- else
- {
- // object has a name but no relation, just move the character
- freeMenu(menuTable[0]);
- menuTable[0] = NULL;
-
- aniX = mouseX;
- aniY = mouseY;
- animationStart = true;
- buttonDown = 0;
- }
+ currentActiveMenu = 0;
+ selectDown = 1;
}
else
{
+ // object has a name but no relation, just move the character
+ freeMenu(menuTable[0]);
+ menuTable[0] = NULL;
+
aniX = mouseX;
aniY = mouseY;
animationStart = true;
buttonDown = 0;
}
- }else {
- // No object found, we move the character to the cursor
+ }
+ else
+ {
aniX = mouseX;
aniY = mouseY;
animationStart = true;
buttonDown = 0;
}
- }
- else
- {
+ }else {
+ // No object found, we move the character to the cursor
aniX = mouseX;
aniY = mouseY;
animationStart = true;
@@ -1100,48 +1239,76 @@ int processInput(void)
}
else
{
- // Handle left click in inventory
- if (processInventory())
+ // handle click in menu
+ if (menuTable[0])
{
- currentActiveMenu = 0;
- selectDown = 1;
- menuDown = 0;
- } else {
- currentActiveMenu = -1;
- menuDown = 0;
+ menuElementSubStruct *pMenuElementSub = getSelectedEntryInMenu(menuTable[0]);
+
+ callRelation(pMenuElementSub, -1);
+
+ // if there is a linked relation, close menu
+ if(!linkedRelation)
+ {
+ freeMenu(menuTable[0]);
+ menuTable[0] = NULL;
+ changeCursor(CURSOR_NORMAL);
+ }
+ // else create the message for the linked relation
+ else
+ {
+ char text[80];
+ strcpy(text, menuTable[0]->stringPtr);
+ strcat(text, ":");
+ strcat(text, currentMenuElement->string);
+ linkedMsgList = renderText(320, (const uint8 *)text);
+ changeCursor(CURSOR_CROSS);
+ }
}
}
}
- }
- // test right button
- else if ((button & 2) || (keyboardVar == 0x43) || (keyboardVar == 0x52))
- {
- if (buttonDown == 0)
+ else
{
- keyboardVar = 0;
-
- // close object menu if there is no linked relation
- if ((linkedRelation == 0) && (menuTable[0])) {
- freeMenu(menuTable[0]);
- menuTable[0] = NULL;
- selectDown = 0;
+ // Handle left click in inventory
+ if (processInventory())
+ {
+ currentActiveMenu = 0;
+ selectDown = 1;
menuDown = 0;
+ } else {
currentActiveMenu = -1;
+ menuDown = 0;
}
+ }
+ }
+ }
+ // test right button
+ else if ((button & 2) || (keyboardVar == 0x43) || (keyboardVar == 0x52))
+ {
+ if (buttonDown == 0)
+ {
+ keyboardVar = 0;
+
+ // close object menu if there is no linked relation
+ if ((linkedRelation == 0) && (menuTable[0])) {
+ freeMenu(menuTable[0]);
+ menuTable[0] = NULL;
+ selectDown = 0;
+ menuDown = 0;
+ currentActiveMenu = -1;
+ }
- if ((!selectDown) && (!menuDown) && (menuTable[1] == NULL))
- {
- buildInventory(mouseX, mouseY);
+ if ((!selectDown) && (!menuDown) && (menuTable[1] == NULL))
+ {
+ buildInventory(mouseX, mouseY);
- if (menuTable[1]) {
- currentActiveMenu = 1;
- menuDown = 1;
- } else {
- menuDown = 1;
- }
+ if (menuTable[1]) {
+ currentActiveMenu = 1;
+ menuDown = 1;
+ } else {
+ menuDown = 1;
}
- buttonDown = 1;
}
+ buttonDown = 1;
}
}
return 0;
@@ -1321,7 +1488,7 @@ void mainLoop(void) {
main22 = 0;
main7 = 0;
main8 = 0;
- main15 = 0;
+ autoTrack = 0;
if (initAllData()) {
int playerDontAskQuit = 1;
@@ -1335,7 +1502,7 @@ void mainLoop(void) {
// readKeyboard();
playerDontAskQuit = processInput();
- //if (enableUser)
+ if (enableUser)
{
userEnabled = 1;
enableUser = 0;
@@ -1380,7 +1547,7 @@ void mainLoop(void) {
mainDraw(0);
flipScreen();
- if (userEnabled && !main7 && !main15)
+ if (userEnabled && !main7 && !autoTrack)
{
if(currentActiveMenu == -1)
{
@@ -1433,8 +1600,24 @@ void mainLoop(void) {
ASSERT(0);
}
- if (main15) {
- ASSERT(0);
+ // wait for character to finish auto track
+ if (autoTrack)
+ {
+ if(mainProc13(narratorOvl, narratorIdx, &actorHead, 0))
+ {
+ if(main14 != -1)
+ {
+ ASSERT(0);
+ }
+
+ changeScriptParamInList(-1, -1, &relHead, 9998, 0);
+ autoTrack = 0;
+ enableUser = 1;
+ }
+ else
+ {
+ userEnabled = false;
+ }
}
if (main14 != -1) {
diff --git a/engines/cruise/cruise_main.h b/engines/cruise/cruise_main.h
index 573048eae6..5fd0e80ae0 100644
--- a/engines/cruise/cruise_main.h
+++ b/engines/cruise/cruise_main.h
@@ -78,6 +78,8 @@ namespace Cruise {
#define OBJ_TYPE_POLY 8
#define OBJ_TYPE_EXIT 9
+extern gfxEntryStruct* linkedMsgList;
+
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 ddfa143418..6ac9032a7a 100644
--- a/engines/cruise/function.cpp
+++ b/engines/cruise/function.cpp
@@ -104,7 +104,7 @@ int16 Op_startScript(void) {
ovlIdx = currentScriptPtr->overlayNumber;
}
- ptr = attacheNewScriptToTail(ovlIdx, &procHead, scriptIdx, currentScriptPtr->type, currentScriptPtr->scriptNumber, currentScriptPtr->overlayNumber, scriptType_MinusPROC);
+ ptr = attacheNewScriptToTail(&procHead, ovlIdx, scriptIdx, currentScriptPtr->type, currentScriptPtr->scriptNumber, currentScriptPtr->overlayNumber, scriptType_MinusPROC);
if (!ptr)
return (0);
@@ -142,7 +142,7 @@ int16 Op_AddProc(void) {
if (!overlay)
return (0);
- attacheNewScriptToTail(overlay, &procHead, pop2, currentScriptPtr->type, currentScriptPtr->scriptNumber, currentScriptPtr->overlayNumber, scriptType_PROC);
+ attacheNewScriptToTail(&procHead, overlay, pop2, currentScriptPtr->type, currentScriptPtr->scriptNumber, currentScriptPtr->overlayNumber, scriptType_PROC);
if (pop1 > 0) {
printf("Unsupported art send in op6!\n");
@@ -159,8 +159,8 @@ int16 Op_37(void) {
if (!pop2)
pop2 = currentScriptPtr->overlayNumber;
- var30 = pop2;
- var31 = pop1;
+ narratorOvl = pop2;
+ narratorIdx = pop1;
return (0);
}
@@ -405,8 +405,7 @@ int16 Op_changeCutSceneState(void) {
int16 Op_62(void) {
if (currentScriptPtr->var1A == 20) {
- changeScriptParamInList(currentScriptPtr->var18,
- currentScriptPtr->var16, &procHead, 9997, -1);
+ changeScriptParamInList(currentScriptPtr->var18, currentScriptPtr->var16, &procHead, 9997, -1);
} else if (currentScriptPtr->var1A == 30) {
changeScriptParamInList(currentScriptPtr->var18,
currentScriptPtr->var16, &relHead, 9997, -1);
@@ -1201,7 +1200,7 @@ int16 Op_1E(void) { // setup actor position
overlay = currentScriptPtr->overlayNumber;
}
- pActor = findActor(overlay, var2, &actorHead, var1);
+ pActor = findActor(&actorHead, overlay, var2, var1);
if (!pActor) {
return 1;
@@ -1310,9 +1309,8 @@ int16 Op_FreezeCell(void) {
return 0;
}
-void Op_60Sub(int overlayIdx, actorStruct * pActorHead, int _var0, int _var1,
- int _var2, int _var3) {
- actorStruct *pActor = findActor(overlayIdx, _var0, pActorHead, _var3);
+void Op_60Sub(int overlayIdx, actorStruct * pActorHead, int _var0, int _var1, int _var2, int _var3) {
+ actorStruct *pActor = findActor(pActorHead, overlayIdx, _var0, _var3);
if (pActor) {
if ((pActor->freeze == _var2) || (_var2 == -1)) {
diff --git a/engines/cruise/mainDraw.cpp b/engines/cruise/mainDraw.cpp
index ba318433ed..8d79d6e8ad 100644
--- a/engines/cruise/mainDraw.cpp
+++ b/engines/cruise/mainDraw.cpp
@@ -1006,8 +1006,9 @@ void mainDraw(int16 param) {
return;
}
}
-
- if (linkedRelation) {
+ else
+ if ((linkedRelation) && (linkedMsgList))
+ {
ASSERT(0);
// TODO: draw mouse here
}
diff --git a/engines/cruise/menu.cpp b/engines/cruise/menu.cpp
index 6a3fc4efea..ffbf287978 100644
--- a/engines/cruise/menu.cpp
+++ b/engines/cruise/menu.cpp
@@ -46,8 +46,7 @@ menuStruct *createMenu(int X, int Y, const char *menuName) {
}
// TODO: rewrite to remove the goto
-void addSelectableMenuEntry(int param0, int param1, menuStruct *pMenu,
- int param2, int color, const char *menuText) {
+void addSelectableMenuEntry(int ovlIdx, int headerIdx, menuStruct *pMenu, int param2, int color, const char *menuText) {
menuElementStruct *di;
menuElementStruct *var_6;
menuElementStruct *pNewElement;
@@ -70,8 +69,8 @@ void addSelectableMenuEntry(int param0, int param1, menuStruct *pMenu,
ASSERT(pSubStruct);
pSubStruct->pNext = NULL;
- pSubStruct->var2 = param0;
- pSubStruct->var4 = param1;
+ pSubStruct->ovlIdx = ovlIdx;
+ pSubStruct->header = headerIdx;
pSubStructCurrent =
pNewElement->ptrSub;
@@ -129,8 +128,8 @@ void addSelectableMenuEntry(int param0, int param1, menuStruct *pMenu,
pNewElement->ptrSub = pSubStruct;
pSubStruct->pNext = NULL;
- pSubStruct->var2 = param0;
- pSubStruct->var4 = param1;
+ pSubStruct->ovlIdx = ovlIdx;
+ pSubStruct->header = headerIdx;
pMenu->numElements++;
}
diff --git a/engines/cruise/overlay.h b/engines/cruise/overlay.h
index 7d9d7d0c99..75f0e7a64b 100644
--- a/engines/cruise/overlay.h
+++ b/engines/cruise/overlay.h
@@ -67,15 +67,15 @@ struct stringEntryStruct {
};
struct linkDataStruct {
- uint16 type;
- uint16 id;
- uint16 offsetVerbeName;
- uint16 verbOverlay;
- uint16 verbNumber;
- uint16 obj1Overlay;
- uint16 obj1Number;
- uint16 obj2Overlay;
- uint16 obj2Number;
+ int16 type;
+ int16 id;
+ int16 offsetVerbeName;
+ int16 verbOverlay;
+ int16 verbNumber;
+ int16 obj1Overlay;
+ int16 obj1Number;
+ int16 obj2Overlay;
+ int16 obj2Number;
int16 field_12;
int16 field_14;
diff --git a/engines/cruise/saveload.cpp b/engines/cruise/saveload.cpp
index 612a26b885..380bc39b4b 100644
--- a/engines/cruise/saveload.cpp
+++ b/engines/cruise/saveload.cpp
@@ -222,8 +222,8 @@ int loadSavegameData(int saveGameIdx) {
//
- fread(&var30, 2, 1, fileHandle);
- fread(&var31, 2, 1, fileHandle);
+ fread(&narratorOvl, 2, 1, fileHandle);
+ fread(&narratorIdx, 2, 1, fileHandle);
fread(&aniX, 2, 1, fileHandle);
fread(&aniY, 2, 1, fileHandle);
int16 bTemp;
diff --git a/engines/cruise/script.cpp b/engines/cruise/script.cpp
index c9ba819d75..bf54dd17a4 100644
--- a/engines/cruise/script.cpp
+++ b/engines/cruise/script.cpp
@@ -595,9 +595,7 @@ int removeScript(int overlay, int idx, scriptInstanceStruct *headPtr) {
return (0);
}
-uint8 *attacheNewScriptToTail(int16 overlayNumber,
- scriptInstanceStruct *scriptHandlePtr, int16 param, int16 arg0,
- int16 arg1, int16 arg2, scriptTypeEnum scriptType) {
+uint8 *attacheNewScriptToTail(scriptInstanceStruct *scriptHandlePtr, int16 overlayNumber, int16 param, int16 arg0, int16 arg1, int16 arg2, scriptTypeEnum scriptType) {
int useArg3Neg = 0;
ovlData3Struct *data3Ptr;
scriptInstanceStruct *tempPtr;
diff --git a/engines/cruise/script.h b/engines/cruise/script.h
index e5d21b1ba0..ee41b61443 100644
--- a/engines/cruise/script.h
+++ b/engines/cruise/script.h
@@ -60,9 +60,7 @@ void setupFuncArray(void);
uint8 getByteFromScript(void);
int removeScript(int overlay, int idx, scriptInstanceStruct * headPtr);
-uint8 *attacheNewScriptToTail(int16 overlayNumber,
- scriptInstanceStruct * scriptHandlePtr, int16 param, int16 arg0,
- int16 arg1, int16 arg2, scriptTypeEnum scriptType);
+uint8 *attacheNewScriptToTail(scriptInstanceStruct *scriptHandlePtr, int16 overlayNumber, int16 param, int16 arg0, int16 arg1, int16 arg2, scriptTypeEnum scriptType);
void manageScripts(scriptInstanceStruct * scriptHandle);
} // End of namespace Cruise
diff --git a/engines/cruise/vars.cpp b/engines/cruise/vars.cpp
index b2029caab7..4b523629ad 100644
--- a/engines/cruise/vars.cpp
+++ b/engines/cruise/vars.cpp
@@ -57,7 +57,7 @@ int16 numOfDisks;
uint8 scriptNameBuffer[15];
int16 currentActiveMenu;
int16 main14;
-int16 linkedRelation;
+menuElementSubStruct* linkedRelation;
int16 main21;
int16 main22;
int16 main7;
@@ -103,8 +103,8 @@ int16 currentScriptOpcodeType;
int16 saveOpcodeVar;
-int16 var30 = 0;
-int16 var31 = 0;
+int16 narratorOvl = 0;
+int16 narratorIdx = 0;
int16 var1;
int16 var2;
diff --git a/engines/cruise/vars.h b/engines/cruise/vars.h
index bb0f488e59..9cb07149be 100644
--- a/engines/cruise/vars.h
+++ b/engines/cruise/vars.h
@@ -32,8 +32,8 @@ namespace Cruise {
struct menuElementSubStruct {
struct menuElementSubStruct *pNext;
- int16 var2;
- int16 var4;
+ int16 ovlIdx;
+ int16 header;
};
struct menuElementStruct {
@@ -159,7 +159,7 @@ extern int16 numOfDisks;
extern uint8 scriptNameBuffer[15];
extern int16 currentActiveMenu;
extern int16 main14;
-extern int16 linkedRelation;
+extern menuElementSubStruct* linkedRelation;
extern int16 main21;
extern int16 main22;
extern int16 main7;
@@ -204,8 +204,8 @@ extern int16 currentScriptOpcodeType;
extern int16 saveOpcodeVar;
-extern int16 var30;
-extern int16 var31;
+extern int16 narratorOvl;
+extern int16 narratorIdx;
extern int16 var1;
extern int16 var2;