2006-02-22 22:40:53 +00:00
|
|
|
|
/* ScummVM - Scumm Interpreter
|
|
|
|
|
* Copyright (C) 2006 The ScummVM project
|
|
|
|
|
*
|
|
|
|
|
* cinE Engine is (C) 2004-2005 by CinE Team
|
|
|
|
|
*
|
|
|
|
|
* This program is free software; you can redistribute it and/or
|
|
|
|
|
* modify it under the terms of the GNU General Public License
|
|
|
|
|
* as published by the Free Software Foundation; either version 2
|
|
|
|
|
* of the License, or (at your option) any later version.
|
|
|
|
|
|
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
|
|
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
|
* along with this program; if not, write to the Free Software
|
|
|
|
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
|
|
|
|
*
|
|
|
|
|
* $URL$
|
|
|
|
|
* $Id$
|
|
|
|
|
*
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
#include "cine/cine.h"
|
2006-02-25 00:46:56 +00:00
|
|
|
|
#include "cine/font.h"
|
2006-02-25 01:18:01 +00:00
|
|
|
|
#include "cine/main_loop.h"
|
|
|
|
|
#include "cine/object.h"
|
2006-02-25 01:01:27 +00:00
|
|
|
|
#include "cine/sfx_player.h"
|
2006-02-25 01:18:01 +00:00
|
|
|
|
#include "cine/various.h"
|
2006-02-22 22:40:53 +00:00
|
|
|
|
|
2006-02-25 00:26:14 +00:00
|
|
|
|
namespace Cine {
|
|
|
|
|
|
2006-02-23 09:12:21 +00:00
|
|
|
|
int16 allowSystemMenu = 0;
|
2006-02-22 22:40:53 +00:00
|
|
|
|
|
2006-02-23 09:12:21 +00:00
|
|
|
|
int16 commandVar3[4];
|
|
|
|
|
int16 commandVar1;
|
|
|
|
|
int16 commandVar2;
|
2006-02-22 22:40:53 +00:00
|
|
|
|
|
|
|
|
|
unk1Struct messageTable[NUM_MAX_MESSAGE];
|
|
|
|
|
|
2006-02-23 09:12:21 +00:00
|
|
|
|
uint32 var6;
|
|
|
|
|
uint32 var8;
|
|
|
|
|
uint8 *var9;
|
2006-02-22 22:40:53 +00:00
|
|
|
|
|
2006-02-23 09:12:21 +00:00
|
|
|
|
uint16 var2;
|
|
|
|
|
uint16 var3;
|
|
|
|
|
uint16 var4;
|
|
|
|
|
uint16 var5;
|
2006-02-22 22:40:53 +00:00
|
|
|
|
|
2006-02-23 10:35:33 +00:00
|
|
|
|
void drawString(const char *string, uint8 param) {
|
2006-02-22 22:40:53 +00:00
|
|
|
|
}
|
|
|
|
|
|
2006-02-23 09:12:21 +00:00
|
|
|
|
void blitRawScreen(uint8 *frontBuffer) {
|
2006-02-22 22:40:53 +00:00
|
|
|
|
gfxFlipRawPage(frontBuffer);
|
|
|
|
|
}
|
|
|
|
|
|
2006-02-23 09:12:21 +00:00
|
|
|
|
void processPendingUpdates(int16 param) {
|
2006-02-22 22:40:53 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Common::File partFileHandle;
|
|
|
|
|
|
|
|
|
|
void waitPlayerInput(void) {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void closeEngine3(void) {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void mainLoopSub1(void) {
|
|
|
|
|
}
|
|
|
|
|
|
2006-02-23 09:12:21 +00:00
|
|
|
|
void mainLoopSub2(uint16 param1, uint16 param2, uint16 param3, uint16 param4) {
|
2006-02-22 22:40:53 +00:00
|
|
|
|
}
|
|
|
|
|
|
2006-02-23 09:12:21 +00:00
|
|
|
|
uint16 errorVar;
|
|
|
|
|
uint8 menuVar;
|
2006-02-22 22:40:53 +00:00
|
|
|
|
|
2006-02-23 20:02:46 +00:00
|
|
|
|
void gfxFuncGen1(uint8 *param1, uint8 *param2, uint8 *param3, uint8 *param4, int16 param5) {
|
2006-02-22 22:40:53 +00:00
|
|
|
|
}
|
|
|
|
|
|
2006-02-23 09:12:21 +00:00
|
|
|
|
uint8 *page0c;
|
2006-02-22 22:40:53 +00:00
|
|
|
|
|
|
|
|
|
void ptrGfxFunc13(void) {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void gfxFuncGen2(void) {
|
|
|
|
|
}
|
|
|
|
|
|
2006-02-23 09:12:21 +00:00
|
|
|
|
uint16 allowPlayerInput;
|
2006-02-22 22:40:53 +00:00
|
|
|
|
|
2006-02-23 09:12:21 +00:00
|
|
|
|
uint16 checkForPendingDataLoadSwitch;
|
2006-02-22 22:40:53 +00:00
|
|
|
|
|
2006-02-23 09:12:21 +00:00
|
|
|
|
uint16 fadeRequired;
|
|
|
|
|
uint16 isDrawCommandEnabled;
|
|
|
|
|
uint16 waitForPlayerClick;
|
2006-03-02 20:08:41 +00:00
|
|
|
|
uint16 menuCommandLen;
|
2006-02-23 09:12:21 +00:00
|
|
|
|
uint16 var17;
|
|
|
|
|
uint16 var18;
|
|
|
|
|
uint16 var19;
|
|
|
|
|
uint16 var20;
|
|
|
|
|
uint8 var21;
|
2006-02-22 22:40:53 +00:00
|
|
|
|
|
2006-02-23 09:12:21 +00:00
|
|
|
|
int16 playerCommand;
|
2006-02-22 22:40:53 +00:00
|
|
|
|
|
|
|
|
|
char commandBuffer[80];
|
|
|
|
|
|
2006-02-23 09:12:21 +00:00
|
|
|
|
uint16 palette_[256];
|
2006-02-22 22:40:53 +00:00
|
|
|
|
|
|
|
|
|
char currentPrcName[20];
|
|
|
|
|
char currentRelName[20];
|
|
|
|
|
char currentObjectName[20];
|
|
|
|
|
char currentMsgName[20];
|
|
|
|
|
char newPrcName[20];
|
|
|
|
|
char newRelName[20];
|
|
|
|
|
char newObjectName[20];
|
|
|
|
|
char newMsgName[20];
|
|
|
|
|
|
|
|
|
|
char currentBgName[8][15];
|
|
|
|
|
char currentCtName[15];
|
|
|
|
|
char currentPartName[15];
|
|
|
|
|
char currentDatName[30];
|
|
|
|
|
|
2006-02-23 09:12:21 +00:00
|
|
|
|
int16 saveVar2;
|
2006-02-22 22:40:53 +00:00
|
|
|
|
|
2006-02-23 09:12:21 +00:00
|
|
|
|
uint8 isInPause = 0;
|
2006-02-22 22:40:53 +00:00
|
|
|
|
|
2006-02-23 09:12:21 +00:00
|
|
|
|
uint16 defaultMenuBoxColor;
|
2006-02-22 22:40:53 +00:00
|
|
|
|
|
2006-02-23 09:12:21 +00:00
|
|
|
|
uint8 inputVar1 = 0;
|
2006-02-22 22:40:53 +00:00
|
|
|
|
|
2006-02-23 09:12:21 +00:00
|
|
|
|
uint16 inputVar2;
|
|
|
|
|
uint16 inputVar3;
|
2006-02-22 22:40:53 +00:00
|
|
|
|
|
|
|
|
|
commandeType defaultActionCommand[] = {
|
|
|
|
|
"EXAMINE",
|
|
|
|
|
"TAKE",
|
|
|
|
|
"INVENTORY",
|
|
|
|
|
"USE",
|
|
|
|
|
"OPERATE",
|
|
|
|
|
"SPEAK",
|
|
|
|
|
"NOACTION"
|
|
|
|
|
// french
|
|
|
|
|
/*
|
2006-02-23 20:02:46 +00:00
|
|
|
|
"EXAMINER",
|
|
|
|
|
"PRENDRE",
|
|
|
|
|
"INVENTAIRE",
|
|
|
|
|
"UTILISER",
|
|
|
|
|
"ACTIONNER",
|
|
|
|
|
"PARLER",
|
|
|
|
|
"NOACTION"
|
2006-02-22 22:40:53 +00:00
|
|
|
|
*/
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
selectedObjStruct currentSelectedObject;
|
|
|
|
|
|
|
|
|
|
void stopSample(void) {
|
|
|
|
|
snd_stopSong();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void mainLoopSub3(void) {
|
|
|
|
|
}
|
|
|
|
|
|
2006-02-23 09:12:21 +00:00
|
|
|
|
int16 stopObjectScript(int16 entryIdx) {
|
2006-02-22 22:40:53 +00:00
|
|
|
|
prcLinkedListStruct *currentHead = &objScriptList;
|
|
|
|
|
prcLinkedListStruct *tempHead = currentHead;
|
|
|
|
|
|
|
|
|
|
currentHead = tempHead->next;
|
|
|
|
|
|
|
|
|
|
while (currentHead) {
|
|
|
|
|
if (currentHead->scriptIdx == entryIdx) {
|
|
|
|
|
currentHead->scriptIdx = -1;
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
currentHead = currentHead->next;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return (-1);
|
|
|
|
|
}
|
|
|
|
|
|
2006-02-23 09:12:21 +00:00
|
|
|
|
void runObjectScript(int16 entryIdx) {
|
|
|
|
|
uint16 i;
|
2006-02-22 22:40:53 +00:00
|
|
|
|
prcLinkedListStruct *pNewElement;
|
|
|
|
|
prcLinkedListStruct *currentHead = &objScriptList;
|
|
|
|
|
prcLinkedListStruct *tempHead = currentHead;
|
|
|
|
|
|
|
|
|
|
currentHead = tempHead->next;
|
|
|
|
|
|
|
|
|
|
while (currentHead) {
|
|
|
|
|
tempHead = currentHead;
|
|
|
|
|
|
|
|
|
|
ASSERT_PTR(tempHead);
|
|
|
|
|
|
|
|
|
|
currentHead = tempHead->next;
|
|
|
|
|
}
|
|
|
|
|
|
2006-02-23 20:02:46 +00:00
|
|
|
|
pNewElement = (prcLinkedListStruct *)malloc(sizeof(prcLinkedListStruct));
|
2006-02-22 22:40:53 +00:00
|
|
|
|
|
|
|
|
|
ASSERT_PTR(pNewElement);
|
|
|
|
|
|
|
|
|
|
pNewElement->next = tempHead->next;
|
|
|
|
|
tempHead->next = pNewElement;
|
|
|
|
|
|
|
|
|
|
// copy the stack into the script instance
|
|
|
|
|
for (i = 0; i < SCRIPT_STACK_SIZE; i++) {
|
|
|
|
|
pNewElement->stack[i] = 0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
for (i = 0; i < 50; i++) {
|
|
|
|
|
pNewElement->localVars[i] = 0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
pNewElement->compareResult = 0;
|
|
|
|
|
pNewElement->scriptPosition = 0;
|
|
|
|
|
|
2006-02-24 22:34:22 +00:00
|
|
|
|
pNewElement->scriptPtr = (byte *)relTable[entryIdx].data;
|
2006-02-22 22:40:53 +00:00
|
|
|
|
pNewElement->scriptIdx = entryIdx;
|
|
|
|
|
|
2006-02-24 22:34:22 +00:00
|
|
|
|
computeScriptStack(pNewElement->scriptPtr, pNewElement->stack, relTable[entryIdx].size);
|
2006-02-22 22:40:53 +00:00
|
|
|
|
}
|
|
|
|
|
|
2006-02-23 09:12:21 +00:00
|
|
|
|
int16 getRelEntryForObject(uint16 param1, uint16 param2,
|
2006-02-22 22:40:53 +00:00
|
|
|
|
selectedObjStruct *pSelectedObject) {
|
2006-02-23 09:12:21 +00:00
|
|
|
|
int16 i;
|
|
|
|
|
int16 di = -1;
|
2006-02-22 22:40:53 +00:00
|
|
|
|
|
|
|
|
|
for (i = 0; i < NUM_MAX_REL; i++) {
|
2006-02-24 22:34:22 +00:00
|
|
|
|
if (relTable[i].data && relTable[i].obj1Param1 == param1 && relTable[i].obj1Param2 == pSelectedObject->idx) {
|
2006-02-22 22:40:53 +00:00
|
|
|
|
if (param2 == 1) {
|
|
|
|
|
di = i;
|
|
|
|
|
} else if (param2 == 2) {
|
2006-02-24 22:34:22 +00:00
|
|
|
|
if (relTable[i].obj2Param == pSelectedObject->param) {
|
2006-02-22 22:40:53 +00:00
|
|
|
|
di = i;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (di != -1)
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return di;
|
|
|
|
|
}
|
|
|
|
|
|
2006-02-23 09:12:21 +00:00
|
|
|
|
int16 getObjectUnderCursor(uint16 x, uint16 y) {
|
2006-02-22 22:40:53 +00:00
|
|
|
|
overlayHeadElement *currentHead = overlayHead.previous;
|
|
|
|
|
|
|
|
|
|
while (currentHead) {
|
|
|
|
|
if (currentHead->type < 2) {
|
|
|
|
|
if (objectTable[currentHead->objIdx].name[0]) {
|
2006-02-23 09:12:21 +00:00
|
|
|
|
int16 objX;
|
|
|
|
|
int16 objY;
|
|
|
|
|
int16 frame;
|
|
|
|
|
int16 part;
|
|
|
|
|
int16 treshold;
|
|
|
|
|
int16 height;
|
|
|
|
|
int16 xdif;
|
|
|
|
|
int16 ydif;
|
2006-02-22 22:40:53 +00:00
|
|
|
|
|
|
|
|
|
objX = objectTable[currentHead->objIdx].x;
|
|
|
|
|
objY = objectTable[currentHead->objIdx].y;
|
|
|
|
|
|
2006-02-23 20:02:46 +00:00
|
|
|
|
frame = abs((int16)(objectTable[currentHead->objIdx].frame));
|
2006-02-22 22:40:53 +00:00
|
|
|
|
|
|
|
|
|
part = objectTable[currentHead->objIdx].part;
|
|
|
|
|
|
|
|
|
|
if (currentHead->type == 0) {
|
|
|
|
|
treshold = animDataTable[frame].var1;
|
|
|
|
|
} else {
|
2006-02-23 20:02:46 +00:00
|
|
|
|
treshold = animDataTable[frame].width / 2;
|
2006-02-22 22:40:53 +00:00
|
|
|
|
}
|
|
|
|
|
|
2006-02-24 22:34:22 +00:00
|
|
|
|
height = animDataTable[frame].height;
|
2006-02-22 22:40:53 +00:00
|
|
|
|
|
|
|
|
|
xdif = x - objX;
|
|
|
|
|
ydif = y - objY;
|
|
|
|
|
|
2006-02-23 20:02:46 +00:00
|
|
|
|
if ((xdif >= 0) && ((treshold << 4) > xdif) && (ydif > 0) && (ydif < height)) {
|
2006-02-22 22:40:53 +00:00
|
|
|
|
if (animDataTable[frame].ptr1) {
|
|
|
|
|
if (gameType == Cine::GID_OS)
|
2006-02-23 20:02:46 +00:00
|
|
|
|
return currentHead->objIdx;
|
|
|
|
|
|
|
|
|
|
if (currentHead->type == 0) { // use generated mask
|
|
|
|
|
if (gfxGetBit(x - objX, y - objY, animDataTable[frame].ptr2, animDataTable[frame].width)) {
|
|
|
|
|
return currentHead->objIdx;
|
2006-02-22 22:40:53 +00:00
|
|
|
|
}
|
2006-02-23 20:02:46 +00:00
|
|
|
|
} else if (currentHead->type == 1) { // is mask
|
|
|
|
|
if (gfxGetBit(x - objX, y - objY, animDataTable[frame].ptr1, animDataTable[frame].width * 4)) {
|
|
|
|
|
return currentHead->objIdx;
|
2006-02-22 22:40:53 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
currentHead = currentHead->previous;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return -1;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const commandeType systemMenu[] = {
|
|
|
|
|
"Pause",
|
|
|
|
|
"Nouvelle partie",
|
|
|
|
|
"Quitter",
|
|
|
|
|
"Lecteur de Svg. A:",
|
|
|
|
|
"Charger une partie",
|
|
|
|
|
"Sauver la partie"
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
const commandeType confirmMenu[] = {
|
|
|
|
|
"Ok , Vas-y ...",
|
|
|
|
|
"Surtout Pas !"
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
commandeType currentSaveName[10];
|
|
|
|
|
|
2006-02-23 09:12:21 +00:00
|
|
|
|
int16 loadSaveDirectory(void) {
|
2006-02-22 22:40:53 +00:00
|
|
|
|
Common::File fHandle;
|
|
|
|
|
|
|
|
|
|
if (gameType == Cine::GID_FW)
|
|
|
|
|
fHandle.open("FW.DIR", Common::File::kFileReadMode, savePath);
|
|
|
|
|
else
|
|
|
|
|
fHandle.open("OS.DIR", Common::File::kFileReadMode, savePath);
|
|
|
|
|
|
|
|
|
|
if (!fHandle.isOpen()) {
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
fHandle.read(currentSaveName, 10 * 20);
|
|
|
|
|
fHandle.close();
|
|
|
|
|
|
|
|
|
|
return 1;
|
|
|
|
|
}
|
|
|
|
|
|
2006-02-23 09:12:21 +00:00
|
|
|
|
int16 currentDisk;
|
2006-02-22 22:40:53 +00:00
|
|
|
|
|
|
|
|
|
void loadObjectScritpFromSave(Common::File *fHandle) {
|
2006-02-23 09:12:21 +00:00
|
|
|
|
int16 i;
|
2006-02-22 22:40:53 +00:00
|
|
|
|
|
|
|
|
|
prcLinkedListStruct *newElement;
|
|
|
|
|
prcLinkedListStruct *currentHead = &globalScriptsHead;
|
|
|
|
|
prcLinkedListStruct *tempHead = currentHead;
|
|
|
|
|
|
|
|
|
|
currentHead = tempHead->next;
|
|
|
|
|
|
|
|
|
|
while (currentHead) {
|
|
|
|
|
tempHead = currentHead;
|
|
|
|
|
currentHead = tempHead->next;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
newElement =
|
2006-02-23 20:02:46 +00:00
|
|
|
|
(prcLinkedListStruct *)malloc(sizeof(prcLinkedListStruct));
|
2006-02-22 22:40:53 +00:00
|
|
|
|
|
|
|
|
|
newElement->next = tempHead->next;
|
|
|
|
|
tempHead->next = newElement;
|
|
|
|
|
|
2006-03-03 19:38:17 +00:00
|
|
|
|
for (i = 0; i < SCRIPT_STACK_SIZE; i++)
|
|
|
|
|
newElement->stack[i] = fHandle->readUint16BE();
|
2006-02-22 22:40:53 +00:00
|
|
|
|
|
2006-03-03 19:38:17 +00:00
|
|
|
|
for (i = 0; i < 50; i++)
|
|
|
|
|
newElement->localVars[i] = fHandle->readUint16BE();
|
2006-02-22 22:40:53 +00:00
|
|
|
|
|
2006-03-03 19:38:17 +00:00
|
|
|
|
newElement->compareResult = fHandle->readUint16BE();
|
2006-02-22 22:40:53 +00:00
|
|
|
|
|
2006-03-03 19:38:17 +00:00
|
|
|
|
newElement->scriptPosition = fHandle->readUint16BE();
|
2006-02-22 22:40:53 +00:00
|
|
|
|
|
2006-03-03 19:38:17 +00:00
|
|
|
|
newElement->scriptIdx = fHandle->readUint16BE();
|
2006-02-22 22:40:53 +00:00
|
|
|
|
|
2006-02-24 22:34:22 +00:00
|
|
|
|
newElement->scriptPtr = (byte *)relTable[newElement->scriptIdx].data;
|
2006-02-22 22:40:53 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void loadGlobalScritpFromSave(Common::File *fHandle) {
|
2006-02-23 09:12:21 +00:00
|
|
|
|
int16 i;
|
2006-02-22 22:40:53 +00:00
|
|
|
|
|
|
|
|
|
prcLinkedListStruct *newElement;
|
|
|
|
|
prcLinkedListStruct *currentHead = &globalScriptsHead;
|
|
|
|
|
prcLinkedListStruct *tempHead = currentHead;
|
|
|
|
|
|
|
|
|
|
currentHead = tempHead->next;
|
|
|
|
|
|
|
|
|
|
while (currentHead) {
|
|
|
|
|
tempHead = currentHead;
|
|
|
|
|
currentHead = tempHead->next;
|
|
|
|
|
}
|
|
|
|
|
|
2006-02-23 20:02:46 +00:00
|
|
|
|
newElement = (prcLinkedListStruct *)malloc(sizeof(prcLinkedListStruct));
|
2006-02-22 22:40:53 +00:00
|
|
|
|
|
|
|
|
|
newElement->next = tempHead->next;
|
|
|
|
|
tempHead->next = newElement;
|
|
|
|
|
|
2006-03-03 19:38:17 +00:00
|
|
|
|
for (i = 0; i < SCRIPT_STACK_SIZE; i++)
|
|
|
|
|
newElement->stack[i] = fHandle->readUint16BE();
|
2006-02-22 22:40:53 +00:00
|
|
|
|
|
2006-03-03 19:38:17 +00:00
|
|
|
|
for (i = 0; i < 50; i++)
|
|
|
|
|
newElement->localVars[i] = fHandle->readUint16BE();
|
2006-02-22 22:40:53 +00:00
|
|
|
|
|
2006-03-03 19:38:17 +00:00
|
|
|
|
newElement->compareResult = fHandle->readUint16BE();
|
2006-02-22 22:40:53 +00:00
|
|
|
|
|
2006-03-03 19:38:17 +00:00
|
|
|
|
newElement->scriptPosition = fHandle->readUint16BE();
|
2006-02-22 22:40:53 +00:00
|
|
|
|
|
2006-03-03 19:38:17 +00:00
|
|
|
|
newElement->scriptIdx = fHandle->readUint16BE();
|
2006-02-22 22:40:53 +00:00
|
|
|
|
|
|
|
|
|
newElement->scriptPtr = scriptTable[newElement->scriptIdx].ptr;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void loadOverlayFromSave(Common::File *fHandle) {
|
|
|
|
|
overlayHeadElement *newElement;
|
|
|
|
|
overlayHeadElement *currentHead = &overlayHead;
|
|
|
|
|
overlayHeadElement *tempHead = currentHead;
|
|
|
|
|
|
|
|
|
|
currentHead = tempHead->next;
|
|
|
|
|
|
|
|
|
|
while (currentHead) {
|
|
|
|
|
tempHead = currentHead;
|
|
|
|
|
currentHead = tempHead->next;
|
|
|
|
|
}
|
|
|
|
|
|
2006-02-23 20:02:46 +00:00
|
|
|
|
newElement = (overlayHeadElement *)malloc(sizeof(overlayHeadElement));
|
2006-02-22 22:40:53 +00:00
|
|
|
|
|
2006-03-03 19:38:17 +00:00
|
|
|
|
fHandle->readUint32BE();
|
|
|
|
|
fHandle->readUint32BE();
|
2006-02-22 22:40:53 +00:00
|
|
|
|
|
2006-03-03 19:38:17 +00:00
|
|
|
|
newElement->objIdx = fHandle->readUint16BE();
|
|
|
|
|
newElement->type = fHandle->readUint16BE();
|
|
|
|
|
newElement->x = fHandle->readSint16BE();
|
|
|
|
|
newElement->y = fHandle->readSint16BE();
|
|
|
|
|
newElement->var10 = fHandle->readSint16BE();
|
|
|
|
|
newElement->var12 = fHandle->readSint16BE();
|
2006-02-22 22:40:53 +00:00
|
|
|
|
|
|
|
|
|
newElement->next = tempHead->next;
|
|
|
|
|
tempHead->next = newElement;
|
|
|
|
|
|
|
|
|
|
if (!currentHead)
|
|
|
|
|
currentHead = &overlayHead;
|
|
|
|
|
|
|
|
|
|
newElement->previous = currentHead->previous;
|
|
|
|
|
|
|
|
|
|
currentHead->previous = newElement;
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void setupGlobalScriptList(void) {
|
|
|
|
|
prcLinkedListStruct *currentHead = globalScriptsHead.next;
|
|
|
|
|
|
|
|
|
|
while (currentHead) {
|
2006-02-23 20:02:46 +00:00
|
|
|
|
currentHead->scriptPtr = scriptTable[currentHead->scriptIdx].ptr;
|
2006-02-22 22:40:53 +00:00
|
|
|
|
|
|
|
|
|
currentHead = currentHead->next;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void setupObjectScriptList(void) {
|
|
|
|
|
prcLinkedListStruct *currentHead = objScriptList.next;
|
|
|
|
|
|
|
|
|
|
while (currentHead) {
|
2006-02-24 22:34:22 +00:00
|
|
|
|
currentHead->scriptPtr = (byte *)relTable[currentHead->scriptIdx].data;
|
2006-02-22 22:40:53 +00:00
|
|
|
|
currentHead = currentHead->next;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2006-02-23 09:12:21 +00:00
|
|
|
|
int16 makeLoad(char *saveName) {
|
|
|
|
|
int16 i;
|
|
|
|
|
int16 size;
|
2006-02-22 22:40:53 +00:00
|
|
|
|
Common::File fHandle;
|
|
|
|
|
|
|
|
|
|
fHandle.open(saveName, Common::File::kFileReadMode, savePath);
|
|
|
|
|
|
|
|
|
|
if (!fHandle.isOpen()) {
|
|
|
|
|
drawString("Cette sauvegarde n'existe pas ...", 0);
|
|
|
|
|
waitPlayerInput();
|
2006-02-23 20:02:46 +00:00
|
|
|
|
// restoreScreen();
|
2006-02-22 22:40:53 +00:00
|
|
|
|
checkDataDisk(-1);
|
|
|
|
|
return -1;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
stopSample();
|
|
|
|
|
closeEngine3();
|
|
|
|
|
unloadAllMasks();
|
|
|
|
|
freePrcLinkedList();
|
|
|
|
|
releaseObjectScripts();
|
|
|
|
|
closeEngine7();
|
|
|
|
|
closePart();
|
|
|
|
|
|
|
|
|
|
for (i = 0; i < NUM_MAX_REL; i++) {
|
2006-02-24 22:34:22 +00:00
|
|
|
|
if (relTable[i].data) {
|
|
|
|
|
free(relTable[i].data);
|
|
|
|
|
relTable[i].data = NULL;
|
|
|
|
|
relTable[i].size = 0;
|
|
|
|
|
relTable[i].obj1Param1 = 0;
|
|
|
|
|
relTable[i].obj1Param2 = 0;
|
|
|
|
|
relTable[i].obj2Param = 0;
|
2006-02-22 22:40:53 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
for (i = 0; i < NUM_MAX_SCRIPT; i++) {
|
|
|
|
|
if (scriptTable[i].ptr) {
|
|
|
|
|
free(scriptTable[i].ptr);
|
|
|
|
|
scriptTable[i].ptr = NULL;
|
2006-02-25 18:16:40 +00:00
|
|
|
|
scriptTable[i].size = 0;
|
2006-02-22 22:40:53 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
for (i = 0; i < NUM_MAX_MESSAGE; i++) {
|
|
|
|
|
messageTable[i].len = 0;
|
|
|
|
|
|
|
|
|
|
if (messageTable[i].ptr) {
|
|
|
|
|
free(messageTable[i].ptr);
|
|
|
|
|
messageTable[i].ptr = NULL;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
for (i = 0; i < NUM_MAX_OBJECT; i++) {
|
|
|
|
|
objectTable[i].part = 0;
|
|
|
|
|
objectTable[i].name[0] = 0;
|
|
|
|
|
objectTable[i].frame = 0;
|
|
|
|
|
objectTable[i].mask = 0;
|
|
|
|
|
objectTable[i].costume = 0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
for (i = 0; i < 255; i++) {
|
|
|
|
|
globalVars[i] = 0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
var2 = 0;
|
|
|
|
|
var3 = 0;
|
|
|
|
|
var4 = 0;
|
|
|
|
|
var5 = 0;
|
|
|
|
|
|
|
|
|
|
strcpy(newPrcName, "");
|
|
|
|
|
strcpy(newRelName, "");
|
|
|
|
|
strcpy(newObjectName, "");
|
|
|
|
|
strcpy(newMsgName, "");
|
|
|
|
|
strcpy(currentBgName[0], "");
|
|
|
|
|
strcpy(currentCtName, "");
|
|
|
|
|
|
|
|
|
|
allowPlayerInput = 0;
|
|
|
|
|
waitForPlayerClick = 0;
|
|
|
|
|
playerCommand = -1;
|
|
|
|
|
isDrawCommandEnabled = 0;
|
|
|
|
|
|
|
|
|
|
strcpy(commandBuffer, "");
|
|
|
|
|
|
2006-02-24 22:34:22 +00:00
|
|
|
|
globalVars[VAR_MOUSE_X_POS] = 0;
|
|
|
|
|
globalVars[VAR_MOUSE_Y_POS] = 0;
|
2006-02-22 22:40:53 +00:00
|
|
|
|
|
|
|
|
|
fadeRequired = 0;
|
|
|
|
|
|
|
|
|
|
for (i = 0; i < 16; i++) {
|
|
|
|
|
palette_[i] = 0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
checkForPendingDataLoadSwitch = 0;
|
|
|
|
|
|
2006-03-03 19:38:17 +00:00
|
|
|
|
currentDisk = fHandle.readUint16BE();
|
2006-02-22 22:40:53 +00:00
|
|
|
|
|
|
|
|
|
fHandle.read(currentPartName, 13);
|
|
|
|
|
fHandle.read(currentDatName, 13);
|
|
|
|
|
|
2006-03-03 19:38:17 +00:00
|
|
|
|
saveVar2 = fHandle.readSint16BE();
|
2006-02-22 22:40:53 +00:00
|
|
|
|
|
|
|
|
|
fHandle.read(currentPrcName, 13);
|
|
|
|
|
fHandle.read(currentRelName, 13);
|
|
|
|
|
fHandle.read(currentMsgName, 13);
|
|
|
|
|
fHandle.read(currentBgName[0], 13);
|
|
|
|
|
fHandle.read(currentCtName, 13);
|
|
|
|
|
|
2006-03-03 19:38:17 +00:00
|
|
|
|
i = fHandle.readUint16BE();
|
|
|
|
|
i = fHandle.readUint16BE();
|
2006-02-22 22:40:53 +00:00
|
|
|
|
|
|
|
|
|
fHandle.read(objectTable, i * 255);
|
|
|
|
|
|
|
|
|
|
for (i = 0; i < NUM_MAX_OBJECT; i++) {
|
2006-03-03 19:38:17 +00:00
|
|
|
|
objectTable[i].x = TO_BE_16(objectTable[i].x);
|
|
|
|
|
objectTable[i].y = TO_BE_16(objectTable[i].y);
|
|
|
|
|
objectTable[i].mask = TO_BE_16(objectTable[i].mask);
|
|
|
|
|
objectTable[i].frame = TO_BE_16(objectTable[i].frame);
|
|
|
|
|
objectTable[i].costume = TO_BE_16(objectTable[i].costume);
|
|
|
|
|
objectTable[i].part = TO_BE_16(objectTable[i].part);
|
2006-02-22 22:40:53 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
for (i = 0; i < 16; i++) {
|
2006-03-03 19:38:17 +00:00
|
|
|
|
palette_[i] = fHandle.readUint16BE();
|
2006-02-22 22:40:53 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
for (i = 0; i < 16; i++) {
|
2006-03-03 19:38:17 +00:00
|
|
|
|
tempPalette[i] = fHandle.readUint16BE();
|
2006-02-22 22:40:53 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
for (i = 0; i < 255; i++) {
|
2006-03-03 19:38:17 +00:00
|
|
|
|
globalVars[i] = fHandle.readUint16BE();
|
2006-02-22 22:40:53 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
for (i = 0; i < 16; i++) {
|
2006-03-03 19:38:17 +00:00
|
|
|
|
zoneData[i] = fHandle.readUint16BE();
|
2006-02-22 22:40:53 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
for (i = 0; i < 4; i++) {
|
2006-03-03 19:38:17 +00:00
|
|
|
|
commandVar3[i] = fHandle.readUint16BE();
|
2006-02-22 22:40:53 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
fHandle.read(commandBuffer, 0x50);
|
|
|
|
|
|
2006-03-03 19:38:17 +00:00
|
|
|
|
defaultMenuBoxColor = fHandle.readUint16BE();
|
|
|
|
|
bgVar0 = fHandle.readUint16BE();
|
|
|
|
|
allowPlayerInput = fHandle.readUint16BE();
|
|
|
|
|
playerCommand = fHandle.readSint16BE();
|
|
|
|
|
commandVar1 = fHandle.readSint16BE();
|
|
|
|
|
isDrawCommandEnabled = fHandle.readUint16BE();
|
|
|
|
|
var5 = fHandle.readUint16BE();
|
|
|
|
|
var4 = fHandle.readUint16BE();
|
|
|
|
|
var3 = fHandle.readUint16BE();
|
|
|
|
|
var2 = fHandle.readUint16BE();
|
|
|
|
|
commandVar2 = fHandle.readSint16BE();
|
|
|
|
|
defaultMenuBoxColor2 = fHandle.readUint16BE();
|
|
|
|
|
|
|
|
|
|
i = fHandle.readUint16BE();
|
|
|
|
|
i = fHandle.readSint16BE();
|
2006-02-22 22:40:53 +00:00
|
|
|
|
fHandle.read(animDataTable, i * 255);
|
|
|
|
|
for (i = 0; i < NUM_MAX_ANIMDATA; i++) {
|
2006-03-03 19:38:17 +00:00
|
|
|
|
animDataTable[i].width = TO_BE_16(animDataTable[i].width);
|
|
|
|
|
animDataTable[i].var1 = TO_BE_16(animDataTable[i].var1);
|
|
|
|
|
animDataTable[i].bpp = TO_BE_16(animDataTable[i].bpp);
|
|
|
|
|
animDataTable[i].height = TO_BE_16(animDataTable[i].height);
|
|
|
|
|
animDataTable[i].fileIdx = TO_BE_16(animDataTable[i].fileIdx);
|
|
|
|
|
animDataTable[i].frameIdx = TO_BE_16(animDataTable[i].frameIdx);
|
2006-02-22 22:40:53 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
fHandle.seek(12, SEEK_CUR); // TODO: handle screen params (realy required ?)
|
|
|
|
|
|
2006-03-03 19:38:17 +00:00
|
|
|
|
size = fHandle.readSint16BE();
|
2006-02-22 22:40:53 +00:00
|
|
|
|
for (i = 0; i < size; i++) {
|
|
|
|
|
loadGlobalScritpFromSave(&fHandle);
|
|
|
|
|
}
|
|
|
|
|
|
2006-03-03 19:38:17 +00:00
|
|
|
|
size = fHandle.readSint16BE();
|
2006-02-22 22:40:53 +00:00
|
|
|
|
for (i = 0; i < size; i++) {
|
|
|
|
|
loadObjectScritpFromSave(&fHandle);
|
|
|
|
|
}
|
|
|
|
|
|
2006-03-03 19:38:17 +00:00
|
|
|
|
size = fHandle.readSint16BE();
|
2006-02-22 22:40:53 +00:00
|
|
|
|
for (i = 0; i < size; i++) {
|
|
|
|
|
loadOverlayFromSave(&fHandle);
|
|
|
|
|
}
|
|
|
|
|
|
2006-03-03 19:38:17 +00:00
|
|
|
|
size = fHandle.readSint16BE();
|
2006-02-22 22:40:53 +00:00
|
|
|
|
for (i = 0; i < size; i++) {
|
2006-02-23 20:02:46 +00:00
|
|
|
|
// loadBgIncrustFromSave(&fHandle);
|
2006-02-22 22:40:53 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
fHandle.close();
|
|
|
|
|
|
|
|
|
|
checkDataDisk(currentDisk);
|
|
|
|
|
|
|
|
|
|
if (strlen(currentPartName)) {
|
|
|
|
|
loadPart(currentPartName);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (strlen(currentPrcName)) {
|
|
|
|
|
loadPrc(currentPrcName);
|
|
|
|
|
setupGlobalScriptList();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (strlen(currentRelName)) {
|
|
|
|
|
loadRel(currentRelName);
|
|
|
|
|
setupObjectScriptList();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (strlen(currentMsgName)) {
|
|
|
|
|
loadMsg(currentMsgName);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (strlen(currentBgName[0])) {
|
|
|
|
|
loadBg(currentBgName[0]);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (strlen(currentCtName)) {
|
|
|
|
|
loadCt(currentCtName);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
loadResourcesFromSave();
|
|
|
|
|
//reincrustAllBg();
|
|
|
|
|
|
|
|
|
|
processPendingUpdates(0);
|
|
|
|
|
|
|
|
|
|
if (strlen(currentDatName)) {
|
2006-02-23 20:02:46 +00:00
|
|
|
|
/* i = saveVar2;
|
|
|
|
|
saveVar2 = 0;
|
|
|
|
|
loadMusic();
|
|
|
|
|
if (i) {
|
|
|
|
|
playMusic();
|
|
|
|
|
}*/
|
2006-02-22 22:40:53 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return (0);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void makeSave(char *saveFileName) {
|
2006-02-23 09:12:21 +00:00
|
|
|
|
int16 i;
|
2006-02-22 22:40:53 +00:00
|
|
|
|
Common::File fHandle;
|
|
|
|
|
|
|
|
|
|
fHandle.open(saveFileName, Common::File::kFileWriteMode, savePath);
|
|
|
|
|
|
2006-03-03 19:38:17 +00:00
|
|
|
|
fHandle.writeUint16BE(currentDisk);
|
2006-02-22 22:40:53 +00:00
|
|
|
|
fHandle.write(currentPartName, 13);
|
|
|
|
|
fHandle.write(currentDatName, 13);
|
2006-03-03 19:38:17 +00:00
|
|
|
|
fHandle.writeUint16BE(saveVar2);
|
2006-02-22 22:40:53 +00:00
|
|
|
|
fHandle.write(currentPrcName, 13);
|
|
|
|
|
fHandle.write(currentRelName, 13);
|
|
|
|
|
fHandle.write(currentMsgName, 13);
|
|
|
|
|
fHandle.write(currentBgName[0], 13);
|
|
|
|
|
fHandle.write(currentCtName, 13);
|
|
|
|
|
|
2006-03-03 19:38:17 +00:00
|
|
|
|
fHandle.writeUint16BE(0xFF);
|
|
|
|
|
fHandle.writeUint16BE(0x20);
|
2006-02-22 22:40:53 +00:00
|
|
|
|
|
|
|
|
|
for (i = 0; i < 255; i++) {
|
2006-03-03 19:38:17 +00:00
|
|
|
|
fHandle.writeUint16BE(objectTable[i].x);
|
|
|
|
|
fHandle.writeUint16BE(objectTable[i].y);
|
|
|
|
|
fHandle.writeUint16BE(objectTable[i].mask);
|
|
|
|
|
fHandle.writeUint16BE(objectTable[i].frame);
|
|
|
|
|
fHandle.writeUint16BE(objectTable[i].costume);
|
2006-02-22 22:40:53 +00:00
|
|
|
|
fHandle.write(objectTable[i].name, 20);
|
2006-03-03 19:38:17 +00:00
|
|
|
|
fHandle.writeUint16BE(objectTable[i].part);
|
2006-02-22 22:40:53 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
for (i = 0; i < 16; i++) {
|
2006-03-03 19:38:17 +00:00
|
|
|
|
fHandle.writeUint16BE(palette_[i]);
|
2006-02-22 22:40:53 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
for (i = 0; i < 16; i++) {
|
2006-03-03 19:38:17 +00:00
|
|
|
|
fHandle.writeUint16BE(tempPalette[i]);
|
2006-02-22 22:40:53 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
for (i = 0; i < 255; i++) {
|
2006-03-03 19:38:17 +00:00
|
|
|
|
fHandle.writeUint16BE(globalVars[i]);
|
2006-02-22 22:40:53 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
for (i = 0; i < 16; i++) {
|
2006-03-03 19:38:17 +00:00
|
|
|
|
fHandle.writeUint16BE(zoneData[i]);
|
2006-02-22 22:40:53 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
for (i = 0; i < 4; i++) {
|
2006-03-03 19:38:17 +00:00
|
|
|
|
fHandle.writeUint16BE(commandVar3[i]);
|
2006-02-22 22:40:53 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
fHandle.write(commandBuffer, 0x50);
|
|
|
|
|
|
2006-03-03 19:38:17 +00:00
|
|
|
|
fHandle.writeUint16BE(defaultMenuBoxColor);
|
|
|
|
|
fHandle.writeUint16BE(bgVar0);
|
|
|
|
|
fHandle.writeUint16BE(allowPlayerInput);
|
|
|
|
|
fHandle.writeUint16BE(playerCommand);
|
|
|
|
|
fHandle.writeUint16BE(commandVar1);
|
|
|
|
|
fHandle.writeUint16BE(isDrawCommandEnabled);
|
|
|
|
|
fHandle.writeUint16BE(var5);
|
|
|
|
|
fHandle.writeUint16BE(var4);
|
|
|
|
|
fHandle.writeUint16BE(var3);
|
|
|
|
|
fHandle.writeUint16BE(var2);
|
|
|
|
|
fHandle.writeUint16BE(commandVar2);
|
|
|
|
|
fHandle.writeUint16BE(defaultMenuBoxColor2);
|
|
|
|
|
fHandle.writeUint16BE(0xFF);
|
|
|
|
|
fHandle.writeUint16BE(0x1E);
|
2006-02-22 22:40:53 +00:00
|
|
|
|
|
|
|
|
|
for (i = 0; i < NUM_MAX_ANIMDATA; i++) {
|
2006-03-03 19:38:17 +00:00
|
|
|
|
fHandle.writeUint16BE(animDataTable[i].width);
|
|
|
|
|
fHandle.writeUint16BE(animDataTable[i].var1);
|
|
|
|
|
fHandle.writeUint16BE(animDataTable[i].bpp);
|
|
|
|
|
fHandle.writeUint16BE(animDataTable[i].height);
|
|
|
|
|
fHandle.writeSint16BE(animDataTable[i].fileIdx);
|
|
|
|
|
fHandle.writeSint16BE(animDataTable[i].frameIdx);
|
|
|
|
|
fHandle.write(animDataTable[i].name, 10);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
fHandle.writeUint16BE(0); // Screen params, unhandled
|
|
|
|
|
fHandle.writeUint16BE(0);
|
|
|
|
|
fHandle.writeUint16BE(0);
|
|
|
|
|
fHandle.writeUint16BE(0);
|
|
|
|
|
fHandle.writeUint16BE(0);
|
|
|
|
|
fHandle.writeUint16BE(0);
|
2006-02-22 22:40:53 +00:00
|
|
|
|
|
|
|
|
|
{
|
2006-02-23 09:12:21 +00:00
|
|
|
|
int16 numScript = 0;
|
2006-02-22 22:40:53 +00:00
|
|
|
|
prcLinkedListStruct *currentHead = globalScriptsHead.next;
|
|
|
|
|
|
|
|
|
|
while (currentHead) {
|
|
|
|
|
numScript++;
|
|
|
|
|
currentHead = currentHead->next;
|
|
|
|
|
}
|
|
|
|
|
|
2006-03-03 19:38:17 +00:00
|
|
|
|
fHandle.writeUint16BE(numScript);
|
2006-02-22 22:40:53 +00:00
|
|
|
|
|
|
|
|
|
// actual save
|
|
|
|
|
currentHead = globalScriptsHead.next;
|
|
|
|
|
|
|
|
|
|
while (currentHead) {
|
|
|
|
|
for (i = 0; i < SCRIPT_STACK_SIZE; i++) {
|
2006-03-03 19:38:17 +00:00
|
|
|
|
fHandle.writeUint16BE(currentHead->stack[i]);
|
2006-02-22 22:40:53 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
for (i = 0; i < 50; i++) {
|
2006-03-03 19:38:17 +00:00
|
|
|
|
fHandle.writeUint16BE(currentHead->localVars[i]);
|
2006-02-22 22:40:53 +00:00
|
|
|
|
}
|
|
|
|
|
|
2006-03-03 19:38:17 +00:00
|
|
|
|
fHandle.writeUint16BE(currentHead->compareResult);
|
|
|
|
|
fHandle.writeUint16BE(currentHead->scriptPosition);
|
2006-02-22 22:40:53 +00:00
|
|
|
|
|
2006-03-03 19:38:17 +00:00
|
|
|
|
fHandle.writeUint16BE(currentHead->scriptIdx);
|
2006-02-22 22:40:53 +00:00
|
|
|
|
|
|
|
|
|
currentHead = currentHead->next;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
{
|
2006-02-23 09:12:21 +00:00
|
|
|
|
int16 numScript = 0;
|
2006-02-22 22:40:53 +00:00
|
|
|
|
prcLinkedListStruct *currentHead = objScriptList.next;
|
|
|
|
|
|
|
|
|
|
while (currentHead) {
|
|
|
|
|
numScript++;
|
|
|
|
|
currentHead = currentHead->next;
|
|
|
|
|
}
|
|
|
|
|
|
2006-03-03 19:38:17 +00:00
|
|
|
|
fHandle.writeUint16BE(numScript);
|
2006-02-22 22:40:53 +00:00
|
|
|
|
|
|
|
|
|
// actual save
|
|
|
|
|
currentHead = objScriptList.next;
|
|
|
|
|
|
|
|
|
|
while (currentHead) {
|
|
|
|
|
for (i = 0; i < SCRIPT_STACK_SIZE; i++) {
|
2006-03-03 19:38:17 +00:00
|
|
|
|
fHandle.writeUint16BE(currentHead->stack[i]);
|
2006-02-22 22:40:53 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
for (i = 0; i < 50; i++) {
|
2006-03-03 19:38:17 +00:00
|
|
|
|
fHandle.writeUint16BE(currentHead->localVars[i]);
|
2006-02-22 22:40:53 +00:00
|
|
|
|
}
|
|
|
|
|
|
2006-03-03 19:38:17 +00:00
|
|
|
|
fHandle.writeUint16BE(currentHead->compareResult);
|
|
|
|
|
fHandle.writeUint16BE(currentHead->scriptPosition);
|
2006-02-22 22:40:53 +00:00
|
|
|
|
|
2006-03-03 19:38:17 +00:00
|
|
|
|
fHandle.writeUint16BE(currentHead->scriptIdx);
|
2006-02-22 22:40:53 +00:00
|
|
|
|
|
|
|
|
|
currentHead = currentHead->next;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
{
|
2006-02-23 09:12:21 +00:00
|
|
|
|
int16 numScript = 0;
|
2006-02-22 22:40:53 +00:00
|
|
|
|
overlayHeadElement *currentHead = overlayHead.next;
|
|
|
|
|
|
|
|
|
|
while (currentHead) {
|
|
|
|
|
numScript++;
|
|
|
|
|
currentHead = currentHead->next;
|
|
|
|
|
}
|
|
|
|
|
|
2006-03-03 19:38:17 +00:00
|
|
|
|
fHandle.writeUint16BE(numScript);
|
2006-02-22 22:40:53 +00:00
|
|
|
|
|
|
|
|
|
// actual save
|
|
|
|
|
currentHead = overlayHead.next;
|
|
|
|
|
|
|
|
|
|
ASSERT(sizeof(overlayHeadElement) == 0x14);
|
|
|
|
|
while (currentHead) {
|
2006-03-03 19:38:17 +00:00
|
|
|
|
fHandle.writeUint32BE(0);
|
|
|
|
|
fHandle.writeUint32BE(0);
|
|
|
|
|
fHandle.writeUint16BE(currentHead->objIdx);
|
|
|
|
|
fHandle.writeUint16BE(currentHead->type);
|
|
|
|
|
fHandle.writeSint16BE(currentHead->x);
|
|
|
|
|
fHandle.writeSint16BE(currentHead->y);
|
|
|
|
|
fHandle.writeSint16BE(currentHead->var10);
|
|
|
|
|
fHandle.writeSint16BE(currentHead->var12);
|
2006-02-22 22:40:53 +00:00
|
|
|
|
|
|
|
|
|
currentHead = currentHead->next;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2006-03-03 19:38:17 +00:00
|
|
|
|
fHandle.writeUint16BE(0);
|
2006-02-22 22:40:53 +00:00
|
|
|
|
|
|
|
|
|
fHandle.close();
|
|
|
|
|
|
|
|
|
|
processPendingUpdates(0);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void makeSystemMenu(void) {
|
2006-02-23 09:12:21 +00:00
|
|
|
|
int16 numEntry;
|
|
|
|
|
int16 mouseButton;
|
|
|
|
|
int16 mouseX;
|
|
|
|
|
int16 mouseY;
|
|
|
|
|
int16 systemCommand;
|
2006-02-22 22:40:53 +00:00
|
|
|
|
|
|
|
|
|
if (!allowSystemMenu) {
|
|
|
|
|
manageEvents();
|
2006-02-23 20:02:46 +00:00
|
|
|
|
getMouseData(mouseUpdateStatus, (uint16 *)&mouseButton,(uint16 *)&mouseX, (uint16 *)&mouseY);
|
2006-02-22 22:40:53 +00:00
|
|
|
|
|
|
|
|
|
while (mouseButton) {
|
|
|
|
|
manageEvents();
|
2006-02-23 20:02:46 +00:00
|
|
|
|
getMouseData(mouseUpdateStatus, (uint16 *)&mouseButton, (uint16 *)&mouseX, (uint16 *)&mouseY);
|
2006-02-22 22:40:53 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
numEntry = 6;
|
|
|
|
|
|
|
|
|
|
if (!allowPlayerInput) {
|
|
|
|
|
numEntry--;
|
|
|
|
|
}
|
|
|
|
|
|
2006-02-23 20:02:46 +00:00
|
|
|
|
systemCommand = makeMenuChoice(systemMenu, numEntry, mouseX, mouseY, 140);
|
2006-02-22 22:40:53 +00:00
|
|
|
|
|
|
|
|
|
switch (systemCommand) {
|
|
|
|
|
case 0:
|
|
|
|
|
{
|
|
|
|
|
drawString("PAUSE", 0);
|
|
|
|
|
waitPlayerInput();
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
case 1:
|
|
|
|
|
{
|
2006-02-23 20:02:46 +00:00
|
|
|
|
getMouseData(mouseUpdateStatus, (uint16 *)&mouseButton, (uint16 *)&mouseX, (uint16 *)&mouseY);
|
|
|
|
|
if (!makeMenuChoice(confirmMenu, 2, mouseX, mouseY + 8, 100)) {
|
2006-02-22 22:40:53 +00:00
|
|
|
|
//reinitEngine();
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
case 2:
|
|
|
|
|
{
|
2006-02-23 20:02:46 +00:00
|
|
|
|
getMouseData(mouseUpdateStatus, (uint16 *)&mouseButton, (uint16 *)&mouseX, (uint16 *)&mouseY);
|
|
|
|
|
if (!makeMenuChoice(confirmMenu, 2, mouseX, mouseY + 8, 100)) {
|
2006-02-22 22:40:53 +00:00
|
|
|
|
exitEngine = 1;
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
case 3: // Select save drive... change ?
|
|
|
|
|
{
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
case 4: // load game
|
|
|
|
|
{
|
|
|
|
|
if (loadSaveDirectory()) {
|
2006-02-23 09:12:21 +00:00
|
|
|
|
int16 selectedSave;
|
2006-02-22 22:40:53 +00:00
|
|
|
|
|
2006-02-23 20:02:46 +00:00
|
|
|
|
getMouseData(mouseUpdateStatus, (uint16 *)&mouseButton, (uint16 *)&mouseX, (uint16 *)&mouseY);
|
|
|
|
|
selectedSave = makeMenuChoice(currentSaveName, 10, mouseX, mouseY + 8, 180);
|
2006-02-22 22:40:53 +00:00
|
|
|
|
|
|
|
|
|
if (selectedSave >= 0) {
|
|
|
|
|
char saveNameBuffer[256];
|
|
|
|
|
if (gameType == Cine::GID_FW)
|
2006-02-23 20:02:46 +00:00
|
|
|
|
sprintf(saveNameBuffer, "FW.%1d", selectedSave);
|
2006-02-22 22:40:53 +00:00
|
|
|
|
else
|
2006-02-23 20:02:46 +00:00
|
|
|
|
sprintf(saveNameBuffer, "OS.%1d", selectedSave);
|
|
|
|
|
|
|
|
|
|
getMouseData(mouseUpdateStatus, (uint16 *)&mouseButton, (uint16 *)&mouseX, (uint16 *)&mouseY);
|
|
|
|
|
if (!makeMenuChoice(confirmMenu, 2, mouseX, mouseY + 8, 100)) {
|
2006-02-22 22:40:53 +00:00
|
|
|
|
char loadString[256];
|
|
|
|
|
|
2006-02-23 20:02:46 +00:00
|
|
|
|
sprintf(loadString, "Chargement de | %s", currentSaveName[selectedSave]);
|
|
|
|
|
drawString(loadString, 0);
|
2006-02-22 22:40:53 +00:00
|
|
|
|
|
2006-02-23 20:02:46 +00:00
|
|
|
|
makeLoad(saveNameBuffer);
|
2006-02-22 22:40:53 +00:00
|
|
|
|
} else {
|
2006-02-23 20:02:46 +00:00
|
|
|
|
drawString("Chargement Annul<75> ...", 0);
|
2006-02-22 22:40:53 +00:00
|
|
|
|
waitPlayerInput();
|
|
|
|
|
checkDataDisk(-1);
|
|
|
|
|
}
|
|
|
|
|
} else {
|
2006-02-23 20:02:46 +00:00
|
|
|
|
drawString("Chargement Annul<75> ...", 0);
|
2006-02-22 22:40:53 +00:00
|
|
|
|
waitPlayerInput();
|
|
|
|
|
checkDataDisk(-1);
|
|
|
|
|
}
|
|
|
|
|
} else {
|
2006-02-23 20:02:46 +00:00
|
|
|
|
drawString("Aucune sauvegarde dans le lecteur ...", 0);
|
2006-02-22 22:40:53 +00:00
|
|
|
|
waitPlayerInput();
|
|
|
|
|
checkDataDisk(-1);
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
case 5:
|
|
|
|
|
{
|
2006-02-23 09:12:21 +00:00
|
|
|
|
int16 selectedSave;
|
2006-02-22 22:40:53 +00:00
|
|
|
|
|
|
|
|
|
loadSaveDirectory();
|
2006-02-23 20:02:46 +00:00
|
|
|
|
selectedSave = makeMenuChoice(currentSaveName, 10, mouseX, mouseY + 8, 180);
|
2006-02-22 22:40:53 +00:00
|
|
|
|
|
|
|
|
|
if (selectedSave >= 0) {
|
|
|
|
|
char saveFileName[256];
|
2006-02-23 20:02:46 +00:00
|
|
|
|
//makeTextEntryMenu("Veuillez entrer le Nom de la Sauvegarde .", ¤tSaveName[selectedSave], 120);
|
|
|
|
|
sprintf(currentSaveName[selectedSave], "temporary save name");
|
2006-02-22 22:40:53 +00:00
|
|
|
|
|
|
|
|
|
if (gameType == Cine::GID_FW)
|
2006-02-23 20:02:46 +00:00
|
|
|
|
sprintf(saveFileName, "FW.%1d", selectedSave);
|
2006-02-22 22:40:53 +00:00
|
|
|
|
else
|
2006-02-23 20:02:46 +00:00
|
|
|
|
sprintf(saveFileName, "OS.%1d", selectedSave);
|
|
|
|
|
|
|
|
|
|
getMouseData(mouseUpdateStatus, (uint16 *)&mouseButton, (uint16 *)&mouseX, (uint16 *)&mouseY);
|
|
|
|
|
if (!makeMenuChoice(confirmMenu, 2, mouseX, mouseY + 8, 100)) {
|
2006-02-22 22:40:53 +00:00
|
|
|
|
char saveString[256];
|
|
|
|
|
|
|
|
|
|
Common::File fHandle;
|
|
|
|
|
|
|
|
|
|
if (gameType == Cine::GID_FW)
|
2006-02-23 20:02:46 +00:00
|
|
|
|
fHandle.open("FW.DIR", Common::File::kFileWriteMode, savePath);
|
2006-02-22 22:40:53 +00:00
|
|
|
|
else
|
2006-02-23 20:02:46 +00:00
|
|
|
|
fHandle.open("OS.DIR", Common::File::kFileWriteMode, savePath);
|
2006-02-22 22:40:53 +00:00
|
|
|
|
|
2006-02-23 20:02:46 +00:00
|
|
|
|
fHandle.write(currentSaveName, 200);
|
2006-02-22 22:40:53 +00:00
|
|
|
|
fHandle.close();
|
|
|
|
|
|
2006-02-23 20:02:46 +00:00
|
|
|
|
sprintf(saveString, "Sauvegarde de |%s", currentSaveName[selectedSave]);
|
2006-02-22 22:40:53 +00:00
|
|
|
|
drawString(saveString, 0);
|
|
|
|
|
|
|
|
|
|
makeSave(saveFileName);
|
|
|
|
|
|
|
|
|
|
checkDataDisk(-1);
|
|
|
|
|
} else {
|
2006-02-23 20:02:46 +00:00
|
|
|
|
drawString("Sauvegarde Annul<75>e ...", 0);
|
2006-02-22 22:40:53 +00:00
|
|
|
|
waitPlayerInput();
|
|
|
|
|
checkDataDisk(-1);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2006-02-23 09:12:21 +00:00
|
|
|
|
const int16 choiceResultTable[] = {
|
2006-02-22 22:40:53 +00:00
|
|
|
|
1,
|
|
|
|
|
1,
|
|
|
|
|
1,
|
|
|
|
|
2,
|
|
|
|
|
1,
|
|
|
|
|
1,
|
|
|
|
|
1
|
|
|
|
|
};
|
|
|
|
|
|
2006-02-23 09:12:21 +00:00
|
|
|
|
const int16 subObjectUseTable[] = {
|
2006-02-22 22:40:53 +00:00
|
|
|
|
3,
|
|
|
|
|
3,
|
|
|
|
|
3,
|
|
|
|
|
3,
|
|
|
|
|
3,
|
|
|
|
|
0,
|
|
|
|
|
0
|
|
|
|
|
};
|
|
|
|
|
|
2006-02-23 09:12:21 +00:00
|
|
|
|
const int16 canUseOnItemTable[] = {
|
2006-02-22 22:40:53 +00:00
|
|
|
|
1,
|
|
|
|
|
0,
|
|
|
|
|
0,
|
|
|
|
|
1,
|
|
|
|
|
1,
|
|
|
|
|
0,
|
|
|
|
|
0
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
commandeType objectListCommand[20];
|
2006-02-23 09:12:21 +00:00
|
|
|
|
int16 objListTab[20];
|
2006-02-22 22:40:53 +00:00
|
|
|
|
|
2006-02-23 09:12:21 +00:00
|
|
|
|
int16 processInventory(int16 x, int16 y) {
|
2006-02-22 22:40:53 +00:00
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
|
2006-02-23 09:12:21 +00:00
|
|
|
|
int16 buildObjectListCommand(void) {
|
|
|
|
|
int16 i;
|
|
|
|
|
int16 j;
|
2006-02-22 22:40:53 +00:00
|
|
|
|
|
|
|
|
|
ASSERT(gameType == Cine::GID_FW);
|
|
|
|
|
|
|
|
|
|
for (i = 0; i < 20; i++) {
|
|
|
|
|
objectListCommand[i][0] = 0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
j = 0;
|
|
|
|
|
|
|
|
|
|
for (i = 0; i < 255; i++) {
|
|
|
|
|
if (objectTable[i].name[0] && objectTable[i].costume == -2) {
|
|
|
|
|
strcpy(objectListCommand[j], objectTable[i].name);
|
|
|
|
|
objListTab[j] = i;
|
|
|
|
|
j++;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return (j);
|
|
|
|
|
}
|
|
|
|
|
|
2006-02-23 09:12:21 +00:00
|
|
|
|
int16 buildObjectListCommand2(int16 param) {
|
|
|
|
|
int16 i;
|
|
|
|
|
int16 j;
|
2006-02-22 22:40:53 +00:00
|
|
|
|
|
|
|
|
|
ASSERT(gameType == Cine::GID_OS);
|
|
|
|
|
|
|
|
|
|
for (i = 0; i < 20; i++) {
|
|
|
|
|
objectListCommand[i][0] = 0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
j = 0;
|
|
|
|
|
|
|
|
|
|
for (i = 0; i < 255; i++) {
|
|
|
|
|
if (objectTable[i].name[0] && objectTable[i].costume == param) {
|
|
|
|
|
strcpy(objectListCommand[j], objectTable[i].name);
|
|
|
|
|
objListTab[j] = i;
|
|
|
|
|
j++;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return (j);
|
|
|
|
|
}
|
|
|
|
|
|
2006-02-23 09:12:21 +00:00
|
|
|
|
int16 selectSubObject(int16 x, int16 y) {
|
|
|
|
|
int16 listSize = buildObjectListCommand();
|
|
|
|
|
int16 selectedObject;
|
2006-02-22 22:40:53 +00:00
|
|
|
|
|
|
|
|
|
if (!listSize) {
|
|
|
|
|
return -2;
|
|
|
|
|
}
|
|
|
|
|
|
2006-02-23 20:02:46 +00:00
|
|
|
|
selectedObject = makeMenuChoice(objectListCommand, listSize, x, y, 140);
|
2006-02-22 22:40:53 +00:00
|
|
|
|
|
|
|
|
|
if (selectedObject == -1)
|
|
|
|
|
return -1;
|
|
|
|
|
|
|
|
|
|
return objListTab[selectedObject];
|
|
|
|
|
}
|
|
|
|
|
|
2006-02-23 09:12:21 +00:00
|
|
|
|
int16 selectSubObject2(int16 x, int16 y, int16 param) {
|
|
|
|
|
int16 listSize = buildObjectListCommand2(param);
|
|
|
|
|
int16 selectedObject;
|
2006-02-22 22:40:53 +00:00
|
|
|
|
|
|
|
|
|
if (!listSize) {
|
|
|
|
|
return -2;
|
|
|
|
|
}
|
|
|
|
|
|
2006-02-23 20:02:46 +00:00
|
|
|
|
selectedObject = makeMenuChoice2(objectListCommand, listSize, x, y, 140);
|
2006-02-22 22:40:53 +00:00
|
|
|
|
|
|
|
|
|
if (selectedObject == -1)
|
|
|
|
|
return -1;
|
|
|
|
|
|
|
|
|
|
if (selectedObject >= 8000) {
|
|
|
|
|
return objListTab[selectedObject - 8000] + 8000;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return objListTab[selectedObject];
|
|
|
|
|
}
|
|
|
|
|
|
2006-02-23 09:12:21 +00:00
|
|
|
|
int16 canUseOnObject = 0;
|
2006-02-22 22:40:53 +00:00
|
|
|
|
|
|
|
|
|
void makeCommandLine(void) {
|
2006-02-23 09:12:21 +00:00
|
|
|
|
uint16 x;
|
|
|
|
|
uint16 y;
|
2006-02-22 22:40:53 +00:00
|
|
|
|
|
|
|
|
|
commandVar1 = 0;
|
|
|
|
|
commandVar2 = -10;
|
|
|
|
|
|
|
|
|
|
if (playerCommand != -1) {
|
|
|
|
|
strcpy(commandBuffer, defaultActionCommand[playerCommand]);
|
|
|
|
|
} else {
|
|
|
|
|
strcpy(commandBuffer, "");
|
|
|
|
|
}
|
|
|
|
|
|
2006-02-23 20:02:46 +00:00
|
|
|
|
if ((playerCommand != -1) && (choiceResultTable[playerCommand] == 2)) { // need object selection ?
|
2006-02-23 09:12:21 +00:00
|
|
|
|
int16 si;
|
2006-02-22 22:40:53 +00:00
|
|
|
|
|
|
|
|
|
getMouseData(mouseUpdateStatus, &dummyU16, &x, &y);
|
|
|
|
|
|
|
|
|
|
if (gameType == Cine::GID_FW) {
|
|
|
|
|
si = selectSubObject(x, y + 8);
|
|
|
|
|
} else {
|
2006-02-23 20:02:46 +00:00
|
|
|
|
si = selectSubObject2(x, y + 8, -subObjectUseTable[playerCommand]);
|
2006-02-22 22:40:53 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (si < 0) {
|
|
|
|
|
playerCommand = -1;
|
|
|
|
|
strcpy(commandBuffer, "");
|
|
|
|
|
} else {
|
|
|
|
|
if (gameType == Cine::GID_OS) {
|
|
|
|
|
if (si >= 8000) {
|
|
|
|
|
si -= 8000;
|
2006-02-23 20:02:46 +00:00
|
|
|
|
canUseOnObject = canUseOnItemTable[playerCommand];
|
2006-02-22 22:40:53 +00:00
|
|
|
|
} else {
|
|
|
|
|
canUseOnObject = 0;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
commandVar3[0] = si;
|
|
|
|
|
commandVar1 = 1;
|
|
|
|
|
|
|
|
|
|
strcat(commandBuffer, " ");
|
2006-02-23 20:02:46 +00:00
|
|
|
|
strcat(commandBuffer, objectTable[commandVar3[0]].name);
|
2006-02-22 22:40:53 +00:00
|
|
|
|
strcat(commandBuffer, " sur");
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
if (playerCommand == 2) {
|
|
|
|
|
getMouseData(mouseUpdateStatus, &dummyU16, &x, &y);
|
2006-02-23 11:05:58 +00:00
|
|
|
|
//processInventory(x, y + 8);
|
2006-02-22 22:40:53 +00:00
|
|
|
|
playerCommand = -1;
|
|
|
|
|
commandVar1 = 0;
|
|
|
|
|
strcpy(commandBuffer, "");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (gameType == Cine::GID_OS) {
|
2006-02-23 20:02:46 +00:00
|
|
|
|
if (playerCommand != -1 && canUseOnObject != 0) { // call use on sub object
|
2006-02-23 09:12:21 +00:00
|
|
|
|
int16 si;
|
2006-02-22 22:40:53 +00:00
|
|
|
|
|
|
|
|
|
getMouseData(mouseUpdateStatus, &dummyU16, &x, &y);
|
|
|
|
|
|
2006-02-23 20:02:46 +00:00
|
|
|
|
si = selectSubObject2(x, y + 8, -subObjectUseTable[playerCommand]);
|
2006-02-22 22:40:53 +00:00
|
|
|
|
|
|
|
|
|
if (si) {
|
|
|
|
|
if (si >= 8000) {
|
|
|
|
|
si -= 8000;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
commandVar3[commandVar1] = si;
|
|
|
|
|
|
|
|
|
|
commandVar1++;
|
|
|
|
|
|
|
|
|
|
// TODO: add command message draw
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
isDrawCommandEnabled = 1;
|
|
|
|
|
|
2006-02-23 20:02:46 +00:00
|
|
|
|
if (playerCommand != -1 && choiceResultTable[playerCommand] == commandVar1) {
|
|
|
|
|
int16 di = getRelEntryForObject(playerCommand, commandVar1, (selectedObjStruct *) & commandVar3);
|
2006-02-22 22:40:53 +00:00
|
|
|
|
|
|
|
|
|
if (di != -1) {
|
|
|
|
|
runObjectScript(di);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (allowSystemMenu == 0) {
|
|
|
|
|
isDrawCommandEnabled = 1;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2006-02-23 09:12:21 +00:00
|
|
|
|
uint16 needMouseSave = 0;
|
|
|
|
|
|
|
|
|
|
uint16 menuVar4 = 0;
|
|
|
|
|
uint16 menuVar5 = 0;
|
|
|
|
|
|
|
|
|
|
int16 makeMenuChoice(const commandeType commandList[], uint16 height, uint16 X, uint16 Y,
|
|
|
|
|
uint16 width) {
|
|
|
|
|
uint8 color = 2;
|
|
|
|
|
uint8 color2;
|
|
|
|
|
int16 paramY;
|
|
|
|
|
int16 currentX;
|
|
|
|
|
int16 currentY;
|
|
|
|
|
int16 i;
|
|
|
|
|
uint16 button;
|
|
|
|
|
int16 var_A;
|
|
|
|
|
int16 di;
|
|
|
|
|
uint16 j;
|
|
|
|
|
int16 mouseX;
|
|
|
|
|
int16 mouseY;
|
|
|
|
|
int16 var_16;
|
|
|
|
|
int16 var_14;
|
|
|
|
|
int16 currentSelection;
|
|
|
|
|
int16 oldSelection;
|
|
|
|
|
int16 var_4;
|
2006-02-22 22:40:53 +00:00
|
|
|
|
|
|
|
|
|
if (allowSystemMenu)
|
|
|
|
|
return -1;
|
|
|
|
|
|
|
|
|
|
paramY = (height * 9) + 10;
|
|
|
|
|
|
|
|
|
|
if (X + width > 319) {
|
|
|
|
|
X = 319 - width;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (Y + paramY > 199) {
|
|
|
|
|
Y = 199 - paramY;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
color2 = defaultMenuBoxColor2;
|
|
|
|
|
|
|
|
|
|
hideMouse();
|
|
|
|
|
blitRawScreen(page1Raw);
|
|
|
|
|
|
|
|
|
|
gfxDrawPlainBoxRaw(X, Y, X + width, Y + 4, color2, page1Raw);
|
|
|
|
|
|
|
|
|
|
currentX = X + 4;
|
|
|
|
|
currentY = Y + 4;
|
|
|
|
|
|
|
|
|
|
for (i = 0; i < height; i++) {
|
2006-02-23 20:02:46 +00:00
|
|
|
|
gfxDrawPlainBoxRaw(X, currentY, X + width, currentY + 9, color2, page1Raw);
|
2006-02-22 22:40:53 +00:00
|
|
|
|
currentX = X + 4;
|
|
|
|
|
|
|
|
|
|
for (j = 0; j < strlen(commandList[i]); j++) {
|
2006-02-23 09:12:21 +00:00
|
|
|
|
uint8 currentChar = commandList[i][j];
|
2006-02-22 22:40:53 +00:00
|
|
|
|
|
|
|
|
|
if (currentChar == ' ') {
|
|
|
|
|
currentX += 5;
|
|
|
|
|
} else {
|
2006-02-23 20:02:46 +00:00
|
|
|
|
uint8 characterWidth = fontParamTable[currentChar].characterWidth;
|
2006-02-22 22:40:53 +00:00
|
|
|
|
|
|
|
|
|
if (characterWidth) {
|
2006-02-23 20:02:46 +00:00
|
|
|
|
uint8 characterIdx = fontParamTable[currentChar].characterIdx;
|
|
|
|
|
drawSpriteRaw(textTable[characterIdx][0], textTable[characterIdx][1], 2, 8, page1Raw, currentX, currentY);
|
2006-02-22 22:40:53 +00:00
|
|
|
|
currentX += characterWidth + 1;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
currentY += 9;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
gfxDrawPlainBoxRaw(X, currentY, X + width, currentY + 4, color2, page1Raw); // bottom part
|
|
|
|
|
|
|
|
|
|
gfxDrawLine(X + 1, Y + 1, X + width - 1, Y + 1, 0, page1Raw); // top
|
|
|
|
|
gfxDrawLine(X + 1, currentY + 3, X + width - 1, currentY + 3, 0, page1Raw); // bottom
|
|
|
|
|
gfxDrawLine(X + 1, Y + 1, X + 1, currentY + 3, 0, page1Raw); // left
|
|
|
|
|
gfxDrawLine(X + width - 1, Y + 1, X + width - 1, currentY + 3, 0, page1Raw); // left
|
|
|
|
|
|
|
|
|
|
gfxDrawLine(X, Y, X + width, Y, color, page1Raw);
|
|
|
|
|
gfxDrawLine(X, currentY + 4, X + width, currentY + 4, color, page1Raw);
|
|
|
|
|
gfxDrawLine(X, Y, X, currentY + 4, color, page1Raw);
|
|
|
|
|
gfxDrawLine(X + width, Y, X + width, currentY + 4, color, page1Raw);
|
|
|
|
|
|
|
|
|
|
blitRawScreen(page1Raw);
|
|
|
|
|
|
|
|
|
|
do {
|
|
|
|
|
manageEvents();
|
|
|
|
|
getMouseData(mouseUpdateStatus, &button, &dummyU16, &dummyU16);
|
|
|
|
|
} while (button);
|
|
|
|
|
|
|
|
|
|
var_A = 0;
|
|
|
|
|
|
|
|
|
|
currentSelection = 0;
|
|
|
|
|
|
|
|
|
|
di = currentSelection * 9 + Y + 4;
|
|
|
|
|
gfxDrawPlainBoxRaw(X + 2, di - 1, X + width - 2, di + 7, 0, page1Raw); // draw black box behind selection
|
|
|
|
|
currentX = X + 4;
|
|
|
|
|
|
|
|
|
|
for (j = 0; j < strlen(commandList[currentSelection]); j++) {
|
2006-02-23 09:12:21 +00:00
|
|
|
|
uint8 currentChar = commandList[currentSelection][j];
|
2006-02-22 22:40:53 +00:00
|
|
|
|
|
|
|
|
|
if (currentChar == ' ') {
|
|
|
|
|
currentX += 5;
|
|
|
|
|
} else {
|
2006-02-23 20:02:46 +00:00
|
|
|
|
uint8 characterWidth = fontParamTable[currentChar].characterWidth;
|
2006-02-22 22:40:53 +00:00
|
|
|
|
|
|
|
|
|
if (characterWidth) {
|
2006-02-23 20:02:46 +00:00
|
|
|
|
uint8 characterIdx = fontParamTable[currentChar].characterIdx;
|
|
|
|
|
drawSpriteRaw(textTable[characterIdx][0], textTable[characterIdx][1], 2, 8, page1Raw, currentX, di);
|
2006-02-22 22:40:53 +00:00
|
|
|
|
currentX += characterWidth + 1;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
blitRawScreen(page1Raw);
|
|
|
|
|
|
|
|
|
|
manageEvents();
|
2006-02-23 20:02:46 +00:00
|
|
|
|
getMouseData(mouseUpdateStatus, &button, (uint16 *)&mouseX, (uint16 *)&mouseY);
|
2006-02-22 22:40:53 +00:00
|
|
|
|
|
|
|
|
|
var_16 = mouseX;
|
|
|
|
|
var_14 = mouseY;
|
|
|
|
|
|
|
|
|
|
menuVar = 0;
|
|
|
|
|
|
|
|
|
|
do {
|
|
|
|
|
manageEvents();
|
2006-02-23 20:02:46 +00:00
|
|
|
|
getMouseData(mouseUpdateStatus, &button, (uint16 *)&mouseX, (uint16 *)&mouseY);
|
2006-02-22 22:40:53 +00:00
|
|
|
|
|
|
|
|
|
if (button) {
|
|
|
|
|
var_A = 1;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
oldSelection = currentSelection;
|
|
|
|
|
|
|
|
|
|
if (needMouseSave) {
|
|
|
|
|
for (j = 0; j < 3; j++) {
|
|
|
|
|
mainLoopSub6();
|
|
|
|
|
}
|
|
|
|
|
|
2006-02-23 20:02:46 +00:00
|
|
|
|
if (menuVar4 && currentSelection > 0) { // go up
|
2006-02-22 22:40:53 +00:00
|
|
|
|
currentSelection--;
|
|
|
|
|
}
|
|
|
|
|
|
2006-02-23 20:02:46 +00:00
|
|
|
|
if (menuVar5) { // go down
|
2006-02-22 22:40:53 +00:00
|
|
|
|
if (height - 1 > currentSelection) {
|
|
|
|
|
currentSelection++;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
} else {
|
2006-02-23 20:02:46 +00:00
|
|
|
|
if (mouseX > X && mouseX < X + width && mouseY > Y && mouseY < Y + height * 9) {
|
2006-02-22 22:40:53 +00:00
|
|
|
|
currentSelection = (mouseY - (Y + 4)) / 9;
|
|
|
|
|
|
|
|
|
|
if (currentSelection < 0)
|
|
|
|
|
currentSelection = 0;
|
|
|
|
|
|
|
|
|
|
if (currentSelection >= height)
|
|
|
|
|
currentSelection = height - 1;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2006-02-23 20:02:46 +00:00
|
|
|
|
if (currentSelection != oldSelection) { // old != new
|
2006-02-22 22:40:53 +00:00
|
|
|
|
if (needMouseSave) {
|
|
|
|
|
hideMouse();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
di = oldSelection * 9 + Y + 4;
|
|
|
|
|
|
|
|
|
|
gfxDrawPlainBoxRaw(X + 2, di - 1, X + width - 2, di + 7, color2, page1Raw); // restore color
|
|
|
|
|
|
|
|
|
|
currentX = X + 4;
|
|
|
|
|
|
|
|
|
|
for (j = 0; j < strlen(commandList[oldSelection]); j++) {
|
2006-02-23 09:12:21 +00:00
|
|
|
|
uint8 currentChar = commandList[oldSelection][j];
|
2006-02-22 22:40:53 +00:00
|
|
|
|
|
|
|
|
|
if (currentChar == ' ') {
|
|
|
|
|
currentX += 5;
|
|
|
|
|
} else {
|
2006-02-23 20:02:46 +00:00
|
|
|
|
uint8 characterWidth = fontParamTable[currentChar].characterWidth;
|
2006-02-22 22:40:53 +00:00
|
|
|
|
|
|
|
|
|
if (characterWidth) {
|
2006-02-23 20:02:46 +00:00
|
|
|
|
uint8 characterIdx = fontParamTable[currentChar].characterIdx;
|
|
|
|
|
drawSpriteRaw(textTable[characterIdx][0], textTable[characterIdx][1], 2, 8, page1Raw, currentX, di);
|
2006-02-22 22:40:53 +00:00
|
|
|
|
currentX += characterWidth + 1;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
di = currentSelection * 9 + Y + 4;
|
|
|
|
|
|
|
|
|
|
gfxDrawPlainBoxRaw(X + 2, di - 1, X + width - 2, di + 7, 0, page1Raw); // black new
|
|
|
|
|
|
|
|
|
|
currentX = X + 4;
|
|
|
|
|
|
|
|
|
|
for (j = 0; j < strlen(commandList[currentSelection]);
|
|
|
|
|
j++) {
|
2006-02-23 20:02:46 +00:00
|
|
|
|
uint8 currentChar = commandList[currentSelection][j];
|
2006-02-22 22:40:53 +00:00
|
|
|
|
|
|
|
|
|
if (currentChar == ' ') {
|
|
|
|
|
currentX += 5;
|
|
|
|
|
} else {
|
2006-02-23 20:02:46 +00:00
|
|
|
|
uint8 characterWidth = fontParamTable[currentChar].characterWidth;
|
2006-02-22 22:40:53 +00:00
|
|
|
|
|
|
|
|
|
if (characterWidth) {
|
2006-02-23 20:02:46 +00:00
|
|
|
|
uint8 characterIdx = fontParamTable[currentChar].characterIdx;
|
|
|
|
|
drawSpriteRaw(textTable[characterIdx][0], textTable[characterIdx][1], 2, 8, page1Raw, currentX, di);
|
2006-02-22 22:40:53 +00:00
|
|
|
|
currentX += characterWidth + 1;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
blitRawScreen(page1Raw);
|
|
|
|
|
|
|
|
|
|
if (needMouseSave) {
|
|
|
|
|
gfxFuncGen2();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
} while (!var_A);
|
|
|
|
|
|
|
|
|
|
if (needMouseSave) {
|
|
|
|
|
ASSERT(0);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
var_4 = button;
|
|
|
|
|
|
|
|
|
|
menuVar = 0;
|
|
|
|
|
|
|
|
|
|
do {
|
|
|
|
|
manageEvents();
|
|
|
|
|
getMouseData(mouseUpdateStatus, &button, &dummyU16, &dummyU16);
|
|
|
|
|
} while (button);
|
|
|
|
|
|
2006-02-23 20:02:46 +00:00
|
|
|
|
if (var_4 == 2) { // recheck
|
2006-02-22 22:40:53 +00:00
|
|
|
|
return -1;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return currentSelection;
|
|
|
|
|
}
|
|
|
|
|
|
2006-02-23 09:12:21 +00:00
|
|
|
|
int16 makeMenuChoice2(const commandeType commandList[], uint16 height, uint16 X, uint16 Y,
|
|
|
|
|
uint16 width) {
|
|
|
|
|
uint8 color = 2;
|
|
|
|
|
uint8 color2;
|
|
|
|
|
int16 paramY;
|
|
|
|
|
int16 currentX;
|
|
|
|
|
int16 currentY;
|
|
|
|
|
int16 i;
|
|
|
|
|
uint16 button;
|
|
|
|
|
int16 var_A;
|
|
|
|
|
int16 di;
|
|
|
|
|
uint16 j;
|
|
|
|
|
int16 mouseX;
|
|
|
|
|
int16 mouseY;
|
|
|
|
|
int16 var_16;
|
|
|
|
|
int16 var_14;
|
|
|
|
|
int16 currentSelection;
|
|
|
|
|
int16 oldSelection;
|
|
|
|
|
int16 var_4;
|
2006-02-22 22:40:53 +00:00
|
|
|
|
|
|
|
|
|
if (allowSystemMenu)
|
|
|
|
|
return -1;
|
|
|
|
|
|
|
|
|
|
paramY = (height * 9) + 10;
|
|
|
|
|
|
|
|
|
|
if (X + width > 319) {
|
|
|
|
|
X = 319 - width;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (Y + paramY > 199) {
|
|
|
|
|
Y = 199 - paramY;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
color2 = defaultMenuBoxColor2;
|
|
|
|
|
|
|
|
|
|
hideMouse();
|
|
|
|
|
blitRawScreen(page1Raw);
|
|
|
|
|
|
|
|
|
|
gfxDrawPlainBoxRaw(X, Y, X + width, Y + 4, color2, page1Raw);
|
|
|
|
|
|
|
|
|
|
currentX = X + 4;
|
|
|
|
|
currentY = Y + 4;
|
|
|
|
|
|
|
|
|
|
for (i = 0; i < height; i++) {
|
2006-02-23 20:02:46 +00:00
|
|
|
|
gfxDrawPlainBoxRaw(X, currentY, X + width, currentY + 9, color2, page1Raw);
|
2006-02-22 22:40:53 +00:00
|
|
|
|
currentX = X + 4;
|
|
|
|
|
|
|
|
|
|
for (j = 0; j < strlen(commandList[i]); j++) {
|
2006-02-23 09:12:21 +00:00
|
|
|
|
uint8 currentChar = commandList[i][j];
|
2006-02-22 22:40:53 +00:00
|
|
|
|
|
|
|
|
|
if (currentChar == ' ') {
|
|
|
|
|
currentX += 5;
|
|
|
|
|
} else {
|
2006-02-23 20:02:46 +00:00
|
|
|
|
uint8 characterWidth = fontParamTable[currentChar].characterWidth;
|
2006-02-22 22:40:53 +00:00
|
|
|
|
|
|
|
|
|
if (characterWidth) {
|
2006-02-23 20:02:46 +00:00
|
|
|
|
uint8 characterIdx = fontParamTable[currentChar].characterIdx;
|
|
|
|
|
drawSpriteRaw(textTable[characterIdx][0], textTable[characterIdx][1], 2, 8, page1Raw, currentX, currentY);
|
2006-02-22 22:40:53 +00:00
|
|
|
|
currentX += characterWidth + 1;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
currentY += 9;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
gfxDrawPlainBoxRaw(X, currentY, X + width, currentY + 4, color2, page1Raw); // bottom part
|
|
|
|
|
|
|
|
|
|
gfxDrawLine(X + 1, Y + 1, X + width - 1, Y + 1, 0, page1Raw); // top
|
|
|
|
|
gfxDrawLine(X + 1, currentY + 3, X + width - 1, currentY + 3, 0, page1Raw); // bottom
|
|
|
|
|
gfxDrawLine(X + 1, Y + 1, X + 1, currentY + 3, 0, page1Raw); // left
|
|
|
|
|
gfxDrawLine(X + width - 1, Y + 1, X + width - 1, currentY + 3, 0, page1Raw); // left
|
|
|
|
|
|
|
|
|
|
gfxDrawLine(X, Y, X + width, Y, color, page1Raw);
|
|
|
|
|
gfxDrawLine(X, currentY + 4, X + width, currentY + 4, color, page1Raw);
|
|
|
|
|
gfxDrawLine(X, Y, X, currentY + 4, color, page1Raw);
|
|
|
|
|
gfxDrawLine(X + width, Y, X + width, currentY + 4, color, page1Raw);
|
|
|
|
|
|
|
|
|
|
blitRawScreen(page1Raw);
|
|
|
|
|
|
|
|
|
|
do {
|
|
|
|
|
manageEvents();
|
|
|
|
|
getMouseData(mouseUpdateStatus, &button, &dummyU16, &dummyU16);
|
|
|
|
|
} while (button);
|
|
|
|
|
|
|
|
|
|
var_A = 0;
|
|
|
|
|
|
|
|
|
|
currentSelection = 0;
|
|
|
|
|
|
|
|
|
|
di = currentSelection * 9 + Y + 4;
|
|
|
|
|
gfxDrawPlainBoxRaw(X + 2, di - 1, X + width - 2, di + 7, 0, page1Raw); // draw black box behind selection
|
|
|
|
|
currentX = X + 4;
|
|
|
|
|
|
|
|
|
|
for (j = 0; j < strlen(commandList[currentSelection]); j++) {
|
2006-02-23 09:12:21 +00:00
|
|
|
|
uint8 currentChar = commandList[currentSelection][j];
|
2006-02-22 22:40:53 +00:00
|
|
|
|
|
|
|
|
|
if (currentChar == ' ') {
|
|
|
|
|
currentX += 5;
|
|
|
|
|
} else {
|
2006-02-23 20:02:46 +00:00
|
|
|
|
uint8 characterWidth = fontParamTable[currentChar].characterWidth;
|
2006-02-22 22:40:53 +00:00
|
|
|
|
|
|
|
|
|
if (characterWidth) {
|
2006-02-23 20:02:46 +00:00
|
|
|
|
uint8 characterIdx = fontParamTable[currentChar].characterIdx;
|
|
|
|
|
drawSpriteRaw(textTable[characterIdx][0], textTable[characterIdx][1], 2, 8, page1Raw, currentX, di);
|
2006-02-22 22:40:53 +00:00
|
|
|
|
currentX += characterWidth + 1;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
blitRawScreen(page1Raw);
|
|
|
|
|
|
|
|
|
|
manageEvents();
|
2006-02-23 20:02:46 +00:00
|
|
|
|
getMouseData(mouseUpdateStatus, &button, (uint16 *)&mouseX, (uint16 *)&mouseY);
|
2006-02-22 22:40:53 +00:00
|
|
|
|
|
|
|
|
|
var_16 = mouseX;
|
|
|
|
|
var_14 = mouseY;
|
|
|
|
|
|
|
|
|
|
menuVar = 0;
|
|
|
|
|
|
|
|
|
|
do {
|
|
|
|
|
manageEvents();
|
2006-02-23 20:02:46 +00:00
|
|
|
|
getMouseData(mouseUpdateStatus, &button, (uint16 *)&mouseX, (uint16 *)&mouseY);
|
2006-02-22 22:40:53 +00:00
|
|
|
|
|
|
|
|
|
if (button) {
|
|
|
|
|
var_A = 1;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
oldSelection = currentSelection;
|
|
|
|
|
|
|
|
|
|
if (needMouseSave) {
|
|
|
|
|
for (j = 0; j < 3; j++) {
|
|
|
|
|
mainLoopSub6();
|
|
|
|
|
}
|
|
|
|
|
|
2006-02-23 20:02:46 +00:00
|
|
|
|
if (menuVar4 && currentSelection > 0) { // go up
|
2006-02-22 22:40:53 +00:00
|
|
|
|
currentSelection--;
|
|
|
|
|
}
|
|
|
|
|
|
2006-02-23 20:02:46 +00:00
|
|
|
|
if (menuVar5) { // go down
|
2006-02-22 22:40:53 +00:00
|
|
|
|
if (height - 1 > currentSelection) {
|
|
|
|
|
currentSelection++;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
} else {
|
2006-02-23 20:02:46 +00:00
|
|
|
|
if (mouseX > X && mouseX < X + width && mouseY > Y && mouseY < Y + height * 9) {
|
2006-02-22 22:40:53 +00:00
|
|
|
|
currentSelection = (mouseY - (Y + 4)) / 9;
|
|
|
|
|
|
|
|
|
|
if (currentSelection < 0)
|
|
|
|
|
currentSelection = 0;
|
|
|
|
|
|
|
|
|
|
if (currentSelection >= height)
|
|
|
|
|
currentSelection = height - 1;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2006-02-23 20:02:46 +00:00
|
|
|
|
if (currentSelection != oldSelection) { // old != new
|
2006-02-22 22:40:53 +00:00
|
|
|
|
if (needMouseSave) {
|
|
|
|
|
hideMouse();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
di = oldSelection * 9 + Y + 4;
|
|
|
|
|
|
|
|
|
|
gfxDrawPlainBoxRaw(X + 2, di - 1, X + width - 2, di + 7, color2, page1Raw); // restore color
|
|
|
|
|
|
|
|
|
|
currentX = X + 4;
|
|
|
|
|
|
|
|
|
|
for (j = 0; j < strlen(commandList[oldSelection]); j++) {
|
2006-02-23 09:12:21 +00:00
|
|
|
|
uint8 currentChar = commandList[oldSelection][j];
|
2006-02-22 22:40:53 +00:00
|
|
|
|
|
|
|
|
|
if (currentChar == ' ') {
|
|
|
|
|
currentX += 5;
|
|
|
|
|
} else {
|
2006-02-23 20:02:46 +00:00
|
|
|
|
uint8 characterWidth = fontParamTable[currentChar].characterWidth;
|
2006-02-22 22:40:53 +00:00
|
|
|
|
|
|
|
|
|
if (characterWidth) {
|
2006-02-23 20:02:46 +00:00
|
|
|
|
uint8 characterIdx = fontParamTable[currentChar].characterIdx;
|
|
|
|
|
drawSpriteRaw(textTable[characterIdx][0], textTable[characterIdx][1], 2, 8, page1Raw, currentX, di);
|
2006-02-22 22:40:53 +00:00
|
|
|
|
currentX += characterWidth + 1;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
di = currentSelection * 9 + Y + 4;
|
|
|
|
|
|
|
|
|
|
gfxDrawPlainBoxRaw(X + 2, di - 1, X + width - 2, di + 7, 0, page1Raw); // black new
|
|
|
|
|
|
|
|
|
|
currentX = X + 4;
|
|
|
|
|
|
|
|
|
|
for (j = 0; j < strlen(commandList[currentSelection]);
|
|
|
|
|
j++) {
|
2006-02-23 20:02:46 +00:00
|
|
|
|
uint8 currentChar = commandList[currentSelection][j];
|
2006-02-22 22:40:53 +00:00
|
|
|
|
|
|
|
|
|
if (currentChar == ' ') {
|
|
|
|
|
currentX += 5;
|
|
|
|
|
} else {
|
2006-02-23 20:02:46 +00:00
|
|
|
|
uint8 characterWidth = fontParamTable[currentChar].characterWidth;
|
2006-02-22 22:40:53 +00:00
|
|
|
|
|
|
|
|
|
if (characterWidth) {
|
2006-02-23 20:02:46 +00:00
|
|
|
|
uint8 characterIdx = fontParamTable[currentChar].characterIdx;
|
|
|
|
|
drawSpriteRaw(textTable[characterIdx][0], textTable[characterIdx][1], 2, 8, page1Raw, currentX, di);
|
2006-02-22 22:40:53 +00:00
|
|
|
|
currentX += characterWidth + 1;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
blitRawScreen(page1Raw);
|
|
|
|
|
|
|
|
|
|
if (needMouseSave) {
|
|
|
|
|
gfxFuncGen2();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
} while (!var_A);
|
|
|
|
|
|
|
|
|
|
if (needMouseSave) {
|
|
|
|
|
ASSERT(0);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
var_4 = button;
|
|
|
|
|
|
|
|
|
|
menuVar = 0;
|
|
|
|
|
|
|
|
|
|
do {
|
|
|
|
|
manageEvents();
|
|
|
|
|
getMouseData(mouseUpdateStatus, &button, &dummyU16, &dummyU16);
|
|
|
|
|
} while (button);
|
|
|
|
|
|
2006-02-23 20:02:46 +00:00
|
|
|
|
if (var_4 == 2) { // recheck
|
2006-02-22 22:40:53 +00:00
|
|
|
|
return currentSelection + 8000;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return currentSelection;
|
|
|
|
|
}
|
|
|
|
|
|
2006-02-23 09:12:21 +00:00
|
|
|
|
void drawMenuBox(char *command, int16 x, int16 y) {
|
|
|
|
|
uint8 j;
|
|
|
|
|
uint8 lColor = 2;
|
2006-02-22 22:40:53 +00:00
|
|
|
|
|
|
|
|
|
hideMouse();
|
|
|
|
|
|
|
|
|
|
gfxDrawPlainBoxRaw(x, y, x + 300, y + 10, 0, page2Raw);
|
|
|
|
|
|
|
|
|
|
gfxDrawLine(x - 1, y - 1, x + 301, y - 1, lColor, page2Raw); // top
|
|
|
|
|
gfxDrawLine(x - 1, y + 11, x + 301, y + 11, lColor, page2Raw); // bottom
|
|
|
|
|
gfxDrawLine(x - 1, y - 1, x - 1, y + 11, lColor, page2Raw); // left
|
|
|
|
|
gfxDrawLine(x + 301, y - 1, x + 301, y + 11, lColor, page2Raw); // right
|
|
|
|
|
|
|
|
|
|
x += 2;
|
|
|
|
|
y += 2;
|
|
|
|
|
|
|
|
|
|
for (j = 0; j < strlen(command); j++) {
|
2006-02-23 09:12:21 +00:00
|
|
|
|
uint8 currentChar = command[j];
|
2006-02-22 22:40:53 +00:00
|
|
|
|
|
|
|
|
|
if (currentChar == ' ') {
|
|
|
|
|
x += 5;
|
|
|
|
|
} else {
|
2006-02-23 20:02:46 +00:00
|
|
|
|
uint8 characterWidth = fontParamTable[currentChar].characterWidth;
|
2006-02-22 22:40:53 +00:00
|
|
|
|
|
|
|
|
|
if (characterWidth) {
|
2006-02-23 20:02:46 +00:00
|
|
|
|
uint8 characterIdx = fontParamTable[currentChar].characterIdx;
|
|
|
|
|
drawSpriteRaw(textTable[characterIdx][0], textTable[characterIdx][1], 2, 8, page2Raw, x, y);
|
2006-02-22 22:40:53 +00:00
|
|
|
|
x += characterWidth + 1;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
gfxFuncGen2();
|
|
|
|
|
}
|
|
|
|
|
|
2006-02-23 09:12:21 +00:00
|
|
|
|
uint16 executePlayerInput(void) {
|
|
|
|
|
uint16 var_5E;
|
|
|
|
|
uint16 var_2;
|
|
|
|
|
uint16 mouseButton;
|
|
|
|
|
uint16 mouseX;
|
|
|
|
|
uint16 mouseY;
|
2006-02-22 22:40:53 +00:00
|
|
|
|
|
|
|
|
|
canUseOnObject = 0;
|
|
|
|
|
|
|
|
|
|
if (isInPause) {
|
|
|
|
|
drawString("PAUSE", 0);
|
|
|
|
|
waitPlayerInput();
|
|
|
|
|
isInPause = 0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (allowPlayerInput) {
|
2006-02-23 09:12:21 +00:00
|
|
|
|
uint16 currentEntry = 0;
|
|
|
|
|
uint16 di = 0;
|
2006-02-22 22:40:53 +00:00
|
|
|
|
|
|
|
|
|
if (isDrawCommandEnabled) {
|
|
|
|
|
drawMenuBox(commandBuffer, 10, defaultMenuBoxColor);
|
|
|
|
|
isDrawCommandEnabled = 0;
|
|
|
|
|
}
|
|
|
|
|
|
2006-02-23 20:02:46 +00:00
|
|
|
|
getMouseData(mouseUpdateStatus, &mouseButton, &mouseX, &mouseY);
|
2006-02-22 22:40:53 +00:00
|
|
|
|
|
|
|
|
|
while (mouseButton && currentEntry < 200) {
|
|
|
|
|
if (mouseButton & 1) {
|
|
|
|
|
di |= 1;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (mouseButton & 2) {
|
|
|
|
|
di |= 2;
|
|
|
|
|
}
|
|
|
|
|
|
2006-02-23 20:02:46 +00:00
|
|
|
|
getMouseData(mouseUpdateStatus, &mouseButton, &mouseX, &mouseY);
|
2006-02-22 22:40:53 +00:00
|
|
|
|
|
|
|
|
|
currentEntry++;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (di) {
|
|
|
|
|
mouseButton = di;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (playerCommand != -1) {
|
|
|
|
|
if (mouseButton & 1) {
|
|
|
|
|
if (mouseButton & 2) {
|
|
|
|
|
makeSystemMenu();
|
|
|
|
|
} else {
|
2006-02-23 09:12:21 +00:00
|
|
|
|
int16 si;
|
2006-02-22 22:40:53 +00:00
|
|
|
|
do {
|
|
|
|
|
manageEvents();
|
2006-02-23 20:02:46 +00:00
|
|
|
|
getMouseData(mouseUpdateStatus, &mouseButton, &dummyU16, &dummyU16);
|
2006-02-22 22:40:53 +00:00
|
|
|
|
} while (mouseButton);
|
|
|
|
|
|
|
|
|
|
si = getObjectUnderCursor(mouseX,
|
|
|
|
|
mouseY);
|
|
|
|
|
|
|
|
|
|
if (si != -1) {
|
|
|
|
|
commandVar3[commandVar1] = si;
|
|
|
|
|
commandVar1++;
|
|
|
|
|
|
|
|
|
|
strcat(commandBuffer, " ");
|
2006-02-23 20:02:46 +00:00
|
|
|
|
strcat(commandBuffer, objectTable[si].name);
|
2006-02-22 22:40:53 +00:00
|
|
|
|
|
|
|
|
|
isDrawCommandEnabled = 1;
|
|
|
|
|
|
2006-02-23 20:02:46 +00:00
|
|
|
|
if (choiceResultTable[playerCommand] == commandVar1) {
|
2006-02-23 09:12:21 +00:00
|
|
|
|
int16 relEntry;
|
2006-02-22 22:40:53 +00:00
|
|
|
|
|
2006-02-23 20:02:46 +00:00
|
|
|
|
drawMenuBox(commandBuffer, 10, defaultMenuBoxColor);
|
2006-02-22 22:40:53 +00:00
|
|
|
|
|
2006-02-23 20:02:46 +00:00
|
|
|
|
relEntry = getRelEntryForObject(playerCommand, commandVar1, (selectedObjStruct *)commandVar3);
|
2006-02-22 22:40:53 +00:00
|
|
|
|
|
|
|
|
|
if (relEntry != -1) {
|
2006-02-23 20:02:46 +00:00
|
|
|
|
runObjectScript(relEntry);
|
2006-02-22 22:40:53 +00:00
|
|
|
|
} else {
|
|
|
|
|
//addPlayerCommandMessage(playerCommand);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
playerCommand = -1;
|
|
|
|
|
|
|
|
|
|
commandVar1 = 0;
|
2006-02-23 20:02:46 +00:00
|
|
|
|
strcpy(commandBuffer, "");
|
2006-02-22 22:40:53 +00:00
|
|
|
|
}
|
|
|
|
|
} else {
|
2006-02-24 22:34:22 +00:00
|
|
|
|
globalVars[VAR_MOUSE_X_POS] = mouseX;
|
|
|
|
|
globalVars[VAR_MOUSE_Y_POS] = mouseY;
|
2006-02-22 22:40:53 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
if (mouseButton & 2) {
|
|
|
|
|
if (mouseButton & 1) {
|
|
|
|
|
makeSystemMenu();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (gameType == Cine::GID_OS) {
|
2006-02-23 20:02:46 +00:00
|
|
|
|
playerCommand = makeMenuChoice2(defaultActionCommand, 6, mouseX, mouseY, 70);
|
2006-02-22 22:40:53 +00:00
|
|
|
|
|
|
|
|
|
if (playerCommand >= 8000) {
|
|
|
|
|
playerCommand -= 8000;
|
|
|
|
|
canUseOnObject = 1;
|
|
|
|
|
}
|
|
|
|
|
} else {
|
2006-02-23 20:02:46 +00:00
|
|
|
|
playerCommand = makeMenuChoice(defaultActionCommand, 6, mouseX, mouseY, 70);
|
2006-02-22 22:40:53 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
makeCommandLine();
|
|
|
|
|
} else {
|
2006-02-23 09:12:21 +00:00
|
|
|
|
int16 objIdx;
|
2006-02-22 22:40:53 +00:00
|
|
|
|
|
2006-02-23 20:02:46 +00:00
|
|
|
|
objIdx = getObjectUnderCursor(mouseX, mouseY);
|
2006-02-22 22:40:53 +00:00
|
|
|
|
|
|
|
|
|
if (commandVar2 != objIdx) {
|
|
|
|
|
if (objIdx != -1) {
|
|
|
|
|
char command[256];
|
|
|
|
|
|
2006-02-23 20:02:46 +00:00
|
|
|
|
strcpy(command, commandBuffer);
|
2006-02-22 22:40:53 +00:00
|
|
|
|
strcat(command, " ");
|
2006-02-23 20:02:46 +00:00
|
|
|
|
strcat(command, objectTable[objIdx].name);
|
2006-02-22 22:40:53 +00:00
|
|
|
|
|
2006-02-23 20:02:46 +00:00
|
|
|
|
drawMenuBox(command, 10, defaultMenuBoxColor);
|
2006-02-22 22:40:53 +00:00
|
|
|
|
} else {
|
2006-02-23 20:02:46 +00:00
|
|
|
|
isDrawCommandEnabled = 1;
|
2006-02-22 22:40:53 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
commandVar2 = objIdx;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
if (mouseButton & 2) {
|
|
|
|
|
if (!(mouseButton & 1)) {
|
|
|
|
|
if (gameType == Cine::GID_OS) {
|
2006-02-23 20:02:46 +00:00
|
|
|
|
playerCommand = makeMenuChoice2(defaultActionCommand, 6, mouseX, mouseY, 70);
|
2006-02-22 22:40:53 +00:00
|
|
|
|
|
|
|
|
|
if (playerCommand >= 8000) {
|
|
|
|
|
playerCommand -= 8000;
|
|
|
|
|
canUseOnObject = 1;
|
|
|
|
|
}
|
|
|
|
|
} else {
|
2006-02-23 20:02:46 +00:00
|
|
|
|
playerCommand = makeMenuChoice(defaultActionCommand, 6, mouseX, mouseY, 70);
|
2006-02-22 22:40:53 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
makeCommandLine();
|
|
|
|
|
} else {
|
|
|
|
|
makeSystemMenu();
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
if (mouseButton & 1) {
|
|
|
|
|
if (!(mouseButton & 2)) {
|
2006-02-23 09:12:21 +00:00
|
|
|
|
int16 objIdx;
|
|
|
|
|
int16 relEntry;
|
2006-02-22 22:40:53 +00:00
|
|
|
|
|
2006-02-24 22:34:22 +00:00
|
|
|
|
globalVars[VAR_MOUSE_X_POS] = mouseX;
|
2006-02-22 22:40:53 +00:00
|
|
|
|
if (!mouseX) {
|
2006-02-24 22:34:22 +00:00
|
|
|
|
globalVars[VAR_MOUSE_X_POS]++;
|
2006-02-22 22:40:53 +00:00
|
|
|
|
}
|
|
|
|
|
|
2006-02-24 22:34:22 +00:00
|
|
|
|
globalVars[VAR_MOUSE_Y_POS] = mouseY;
|
2006-02-22 22:40:53 +00:00
|
|
|
|
|
2006-02-23 20:02:46 +00:00
|
|
|
|
objIdx = getObjectUnderCursor(mouseX, mouseY);
|
2006-02-22 22:40:53 +00:00
|
|
|
|
|
|
|
|
|
if (objIdx != -1) {
|
2006-02-23 20:02:46 +00:00
|
|
|
|
currentSelectedObject.idx = objIdx;
|
|
|
|
|
currentSelectedObject.param = -1;
|
2006-02-22 22:40:53 +00:00
|
|
|
|
|
2006-02-23 20:02:46 +00:00
|
|
|
|
relEntry = getRelEntryForObject(6, 1, ¤tSelectedObject);
|
2006-02-22 22:40:53 +00:00
|
|
|
|
|
|
|
|
|
if (relEntry != -1) {
|
2006-02-23 20:02:46 +00:00
|
|
|
|
runObjectScript(relEntry);
|
2006-02-22 22:40:53 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
makeSystemMenu();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
} else {
|
2006-02-23 09:12:21 +00:00
|
|
|
|
uint16 di = 0;
|
2006-02-23 20:02:46 +00:00
|
|
|
|
getMouseData(mouseUpdateStatus, &mouseButton, &mouseX, &mouseY);
|
2006-02-22 22:40:53 +00:00
|
|
|
|
|
|
|
|
|
while (mouseButton) {
|
|
|
|
|
if (mouseButton & 1) {
|
|
|
|
|
di |= 1;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (mouseButton & 2) {
|
|
|
|
|
di |= 2;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
manageEvents();
|
2006-02-23 20:02:46 +00:00
|
|
|
|
getMouseData(mouseUpdateStatus, &mouseButton, &mouseX, &mouseY);
|
2006-02-22 22:40:53 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (di) {
|
|
|
|
|
mouseButton = di;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if ((mouseButton & 1) && (mouseButton & 2)) {
|
|
|
|
|
makeSystemMenu();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
var_2 = menuVar & 0x7F;
|
|
|
|
|
var_5E = var_2;
|
|
|
|
|
|
|
|
|
|
if (menuVar & 0x80) {
|
|
|
|
|
var_5E = 0;
|
|
|
|
|
var_2 = 0;
|
|
|
|
|
}
|
|
|
|
|
|
2006-02-23 20:02:46 +00:00
|
|
|
|
if (inputVar1 && allowPlayerInput) { // use keyboard
|
2006-02-22 22:40:53 +00:00
|
|
|
|
inputVar1 = 0;
|
|
|
|
|
|
2006-02-24 22:34:22 +00:00
|
|
|
|
switch (globalVars[VAR_MOUSE_X_MODE]) {
|
2006-02-22 22:40:53 +00:00
|
|
|
|
case 1:
|
|
|
|
|
{
|
|
|
|
|
mouseX = objectTable[1].x + 12;
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
case 2:
|
|
|
|
|
{
|
|
|
|
|
mouseX = objectTable[1].x + 7;
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
default:
|
|
|
|
|
{
|
2006-02-24 22:34:22 +00:00
|
|
|
|
mouseX = globalVars[VAR_MOUSE_X_POS];
|
2006-02-22 22:40:53 +00:00
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2006-02-24 22:34:22 +00:00
|
|
|
|
switch (globalVars[VAR_MOUSE_Y_MODE]) {
|
2006-02-22 22:40:53 +00:00
|
|
|
|
case 1:
|
|
|
|
|
{
|
|
|
|
|
mouseY = objectTable[1].y + 34;
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
case 2:
|
|
|
|
|
{
|
|
|
|
|
mouseY = objectTable[1].y + 28;
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
default:
|
|
|
|
|
{
|
2006-02-24 22:34:22 +00:00
|
|
|
|
mouseY = globalVars[VAR_MOUSE_Y_POS];
|
2006-02-22 22:40:53 +00:00
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (var_5E == bgVar0) {
|
|
|
|
|
var_5E = 0;
|
|
|
|
|
|
2006-02-24 22:34:22 +00:00
|
|
|
|
globalVars[VAR_MOUSE_X_POS] = mouseX;
|
|
|
|
|
globalVars[VAR_MOUSE_Y_POS] = mouseY;
|
2006-02-22 22:40:53 +00:00
|
|
|
|
} else {
|
|
|
|
|
if (inputVar2) {
|
|
|
|
|
if (inputVar2 == 2) {
|
2006-02-24 22:34:22 +00:00
|
|
|
|
globalVars[VAR_MOUSE_X_POS] = 1;
|
2006-02-22 22:40:53 +00:00
|
|
|
|
} else {
|
2006-02-24 22:34:22 +00:00
|
|
|
|
globalVars[VAR_MOUSE_X_POS] = 320;
|
2006-02-22 22:40:53 +00:00
|
|
|
|
}
|
|
|
|
|
} else {
|
2006-02-24 22:34:22 +00:00
|
|
|
|
globalVars[VAR_MOUSE_X_POS] = mouseX;
|
2006-02-22 22:40:53 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (inputVar3) {
|
|
|
|
|
if (inputVar3 == 2) {
|
2006-02-24 22:34:22 +00:00
|
|
|
|
globalVars[VAR_MOUSE_Y_POS] = 1;
|
2006-02-22 22:40:53 +00:00
|
|
|
|
} else {
|
2006-02-24 22:34:22 +00:00
|
|
|
|
globalVars[VAR_MOUSE_Y_POS] = 200;
|
2006-02-22 22:40:53 +00:00
|
|
|
|
}
|
|
|
|
|
} else {
|
2006-02-24 22:34:22 +00:00
|
|
|
|
globalVars[VAR_MOUSE_Y_POS] = mouseY;
|
2006-02-22 22:40:53 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
bgVar0 = var_5E;
|
2006-02-23 20:02:46 +00:00
|
|
|
|
} else { // don't use keyboard for move -> shortcuts to commands
|
|
|
|
|
getMouseData(mouseUpdateStatus, &mouseButton, &mouseX, &mouseY);
|
2006-02-22 22:40:53 +00:00
|
|
|
|
|
|
|
|
|
switch (var_2 - 59) {
|
|
|
|
|
case 0:
|
|
|
|
|
{
|
|
|
|
|
if (allowPlayerInput) {
|
|
|
|
|
playerCommand = 0;
|
|
|
|
|
makeCommandLine();
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
case 1:
|
|
|
|
|
{
|
|
|
|
|
if (allowPlayerInput) {
|
|
|
|
|
playerCommand = 1;
|
|
|
|
|
makeCommandLine();
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
case 2:
|
|
|
|
|
{
|
|
|
|
|
if (allowPlayerInput) {
|
|
|
|
|
playerCommand = 2;
|
|
|
|
|
makeCommandLine();
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
case 3:
|
|
|
|
|
{
|
|
|
|
|
if (allowPlayerInput) {
|
|
|
|
|
playerCommand = 3;
|
|
|
|
|
makeCommandLine();
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
case 4:
|
|
|
|
|
{
|
|
|
|
|
if (allowPlayerInput) {
|
|
|
|
|
playerCommand = 4;
|
|
|
|
|
makeCommandLine();
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
case 5:
|
|
|
|
|
{
|
|
|
|
|
if (allowPlayerInput) {
|
|
|
|
|
playerCommand = 5;
|
|
|
|
|
makeCommandLine();
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
case 6:
|
|
|
|
|
case 7:
|
|
|
|
|
case 8:
|
|
|
|
|
case 23:
|
|
|
|
|
{
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
case 9:
|
|
|
|
|
case 24:
|
|
|
|
|
{
|
|
|
|
|
makeSystemMenu();
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
default:
|
|
|
|
|
{
|
|
|
|
|
// printf("Unhandled case %d in last part of executePLayerInput\n",var2-59);
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return var_5E;
|
|
|
|
|
}
|
|
|
|
|
|
2006-02-23 09:12:21 +00:00
|
|
|
|
void drawSprite(overlayHeadElement *currentOverlay, uint8 *spritePtr,
|
|
|
|
|
uint8 *maskPtr, uint16 width, uint16 height, uint8 *page, int16 x, int16 y) {
|
2006-02-23 10:35:33 +00:00
|
|
|
|
#if 0
|
2006-02-23 09:12:21 +00:00
|
|
|
|
uint8 *ptr = NULL;
|
|
|
|
|
uint8 i = 0;
|
|
|
|
|
uint16 si = 0;
|
2006-02-22 22:40:53 +00:00
|
|
|
|
overlayHeadElement *pCurrentOverlay = currentOverlay;
|
|
|
|
|
|
|
|
|
|
while(pCurrentOverlay) { // unfinished, probably for mask handling..
|
|
|
|
|
if (pCurrentOverlay->type == 5) {
|
2006-02-23 09:12:21 +00:00
|
|
|
|
int16 maskX;
|
|
|
|
|
int16 maskY;
|
|
|
|
|
int16 maskWidth;
|
|
|
|
|
int16 maskHeight;
|
|
|
|
|
uint16 maskSpriteIdx;
|
2006-02-22 22:40:53 +00:00
|
|
|
|
|
|
|
|
|
if (!si) {
|
2006-02-23 09:12:21 +00:00
|
|
|
|
ptr = (uint8 *)malloc(width * height);
|
2006-02-22 22:40:53 +00:00
|
|
|
|
si = 1;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
maskX = objectTable[pCurrentOverlay->objIdx].x;
|
|
|
|
|
maskY = objectTable[pCurrentOverlay->objIdx].y;
|
|
|
|
|
|
|
|
|
|
maskSpriteIdx = objectTable[pCurrentOverlay->objIdx].frame;
|
|
|
|
|
|
2006-02-23 20:02:46 +00:00
|
|
|
|
maskWidth = animDataTable[maskSpriteIdx].width / 2;
|
2006-02-24 22:34:22 +00:00
|
|
|
|
maskHeight = animDataTable[maskSpriteIdx].height;
|
2006-02-22 22:40:53 +00:00
|
|
|
|
|
2006-02-23 20:02:46 +00:00
|
|
|
|
gfxSpriteFunc2(spritePtr, width, height, animDataTable[maskSpriteIdx].ptr1, maskWidth, maskHeight, ptr, maskX - x,maskY - y, i++);
|
2006-02-22 22:40:53 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
pCurrentOverlay = pCurrentOverlay->next;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if(si) {
|
|
|
|
|
gfxSpriteFunc1(ptr, width, height, page, x, y);
|
|
|
|
|
free(ptr);
|
|
|
|
|
} else
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
if (gameType == Cine::GID_OS) {
|
2006-02-23 20:02:46 +00:00
|
|
|
|
drawSpriteRaw2(spritePtr, objectTable[currentOverlay->objIdx].part, width, height, page, x, y);
|
2006-02-22 22:40:53 +00:00
|
|
|
|
} else {
|
|
|
|
|
drawSpriteRaw(spritePtr, maskPtr, width, height, page, x, y);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
2006-02-23 09:12:21 +00:00
|
|
|
|
int16 additionalBgVScroll = 0;
|
2006-02-22 22:40:53 +00:00
|
|
|
|
|
|
|
|
|
void backupOverlayPage(void) {
|
2006-02-23 09:12:21 +00:00
|
|
|
|
uint8 *bgPage;
|
|
|
|
|
uint8 *scrollBg;
|
2006-02-22 22:40:53 +00:00
|
|
|
|
|
|
|
|
|
bgPage = additionalBgTable[currentAdditionalBgIdx];
|
|
|
|
|
|
|
|
|
|
if (bgPage) {
|
|
|
|
|
if (!additionalBgVScroll) {
|
|
|
|
|
memcpy(page1Raw, bgPage, 320 * 200);
|
|
|
|
|
} else {
|
2006-02-23 09:12:21 +00:00
|
|
|
|
int16 i;
|
2006-02-22 22:40:53 +00:00
|
|
|
|
|
|
|
|
|
scrollBg = additionalBgTable[currentAdditionalBgIdx2];
|
|
|
|
|
|
|
|
|
|
for (i = additionalBgVScroll;
|
|
|
|
|
i < 200 + additionalBgVScroll; i++) {
|
|
|
|
|
if (i > 200) {
|
2006-02-23 20:02:46 +00:00
|
|
|
|
memcpy(page1Raw + (i - additionalBgVScroll) * 320, scrollBg + (i - 200) * 320, 320);
|
2006-02-22 22:40:53 +00:00
|
|
|
|
} else {
|
2006-02-23 20:02:46 +00:00
|
|
|
|
memcpy(page1Raw + (i - additionalBgVScroll) * 320, bgPage + (i) * 320, 320);
|
2006-02-22 22:40:53 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2006-02-23 20:02:46 +00:00
|
|
|
|
uint16 computeMessageLength(uint8 *ptr, uint16 width, uint16 *numWords, uint16 *messageWidth, uint16 *lineResult) {
|
2006-02-23 09:12:21 +00:00
|
|
|
|
uint8 *localPtr = ptr;
|
2006-02-22 22:40:53 +00:00
|
|
|
|
|
2006-02-23 09:12:21 +00:00
|
|
|
|
uint16 var_2 = 0;
|
|
|
|
|
uint16 localLineResult = 0;
|
|
|
|
|
uint16 var_6 = 0;
|
|
|
|
|
uint16 var_8 = 0;
|
|
|
|
|
uint16 localMessageWidth = 0;
|
|
|
|
|
uint16 var_16 = 0;
|
|
|
|
|
uint16 finished = 0;
|
|
|
|
|
uint16 si = 0;
|
|
|
|
|
uint16 di = 0;
|
2006-02-22 22:40:53 +00:00
|
|
|
|
|
|
|
|
|
while (!finished) {
|
2006-02-23 09:12:21 +00:00
|
|
|
|
uint8 character = *(localPtr++);
|
2006-02-22 22:40:53 +00:00
|
|
|
|
|
|
|
|
|
if (character == ' ') {
|
|
|
|
|
var_8 = var_16;
|
|
|
|
|
var_6 = localMessageWidth;
|
|
|
|
|
localLineResult = si;
|
|
|
|
|
var_2 = di;
|
|
|
|
|
|
|
|
|
|
if (si + 5 < width) {
|
|
|
|
|
var_16++;
|
|
|
|
|
si += 5;
|
|
|
|
|
} else {
|
|
|
|
|
finished = 1;
|
|
|
|
|
}
|
|
|
|
|
} else if (character == 0x7C || character == 0) {
|
|
|
|
|
finished = 1;
|
|
|
|
|
si = 0;
|
|
|
|
|
} else {
|
|
|
|
|
if (fontParamTable[character].characterWidth) {
|
2006-02-23 20:02:46 +00:00
|
|
|
|
uint16 var_C = fontParamTable[character].characterWidth;
|
2006-02-22 22:40:53 +00:00
|
|
|
|
|
|
|
|
|
if (si + var_C < width) {
|
|
|
|
|
si += var_C;
|
|
|
|
|
localMessageWidth += var_C;
|
|
|
|
|
} else {
|
|
|
|
|
finished = 1;
|
|
|
|
|
|
|
|
|
|
if (localLineResult) {
|
|
|
|
|
var_16 = var_8;
|
|
|
|
|
localMessageWidth = var_6;
|
|
|
|
|
si = localLineResult;
|
|
|
|
|
di = var_2;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
di++;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
*numWords = var_16;
|
|
|
|
|
*messageWidth = localMessageWidth;
|
|
|
|
|
*lineResult = si;
|
|
|
|
|
|
|
|
|
|
return (di);
|
|
|
|
|
}
|
|
|
|
|
|
2006-02-23 09:12:21 +00:00
|
|
|
|
void drawDialogueMessage(uint8 msgIdx, int16 x, int16 y, int16 width, int16 color) {
|
|
|
|
|
uint8 color2 = 2;
|
|
|
|
|
uint8 endOfMessageReached = 0;
|
|
|
|
|
int16 localX;
|
|
|
|
|
int16 localY;
|
|
|
|
|
int16 localWidth;
|
2006-02-22 22:40:53 +00:00
|
|
|
|
|
|
|
|
|
char *messagePtr = (char *)messageTable[msgIdx].ptr;
|
|
|
|
|
|
|
|
|
|
if (!messagePtr) {
|
|
|
|
|
freeOverlay(msgIdx, 2);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
var20 += strlen(messagePtr);
|
|
|
|
|
|
|
|
|
|
gfxDrawPlainBoxRaw(x, y, x + width, y + 4, color, page1Raw);
|
|
|
|
|
|
|
|
|
|
localX = x + 4;
|
|
|
|
|
localY = y + 4;
|
|
|
|
|
localWidth = width - 8;
|
|
|
|
|
|
|
|
|
|
do {
|
2006-02-23 09:12:21 +00:00
|
|
|
|
uint16 messageLength = 0;
|
|
|
|
|
uint16 numWords;
|
|
|
|
|
uint16 messageWidth;
|
|
|
|
|
uint16 lineResult;
|
2006-02-22 22:40:53 +00:00
|
|
|
|
char *endOfMessagePtr;
|
2006-02-23 09:12:21 +00:00
|
|
|
|
uint16 fullLineWidth;
|
|
|
|
|
uint16 interWordSize;
|
|
|
|
|
uint16 interWordSizeRemain;
|
|
|
|
|
uint8 currentChar;
|
|
|
|
|
uint8 characterWidth;
|
2006-02-22 22:40:53 +00:00
|
|
|
|
|
|
|
|
|
while (messagePtr[messageLength] == ' ') {
|
|
|
|
|
messageLength++;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
messagePtr += messageLength;
|
|
|
|
|
|
2006-02-23 20:02:46 +00:00
|
|
|
|
messageLength = computeMessageLength((uint8 *) messagePtr, localWidth, &numWords, &messageWidth, &lineResult);
|
2006-02-22 22:40:53 +00:00
|
|
|
|
|
|
|
|
|
endOfMessagePtr = messagePtr + messageLength;
|
|
|
|
|
|
|
|
|
|
if (lineResult) {
|
|
|
|
|
fullLineWidth = localWidth - messageWidth;
|
|
|
|
|
|
|
|
|
|
if (numWords) {
|
|
|
|
|
interWordSize = fullLineWidth / numWords;
|
|
|
|
|
interWordSizeRemain = fullLineWidth % numWords;
|
|
|
|
|
} else {
|
|
|
|
|
interWordSize = 5;
|
|
|
|
|
interWordSizeRemain = 0;
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
interWordSize = 5;
|
|
|
|
|
interWordSizeRemain = 0;
|
|
|
|
|
}
|
|
|
|
|
|
2006-02-23 20:02:46 +00:00
|
|
|
|
gfxDrawPlainBoxRaw(x, localY, x + width, localY + 9, color, page1Raw);
|
2006-02-22 22:40:53 +00:00
|
|
|
|
|
|
|
|
|
do {
|
|
|
|
|
currentChar = *(messagePtr++);
|
|
|
|
|
|
|
|
|
|
if (currentChar == 0) {
|
|
|
|
|
endOfMessageReached = 1;
|
|
|
|
|
} else if (currentChar == ' ') {
|
|
|
|
|
localX += interWordSizeRemain + interWordSize;
|
|
|
|
|
|
|
|
|
|
if (interWordSizeRemain)
|
|
|
|
|
interWordSizeRemain = 0;
|
|
|
|
|
} else {
|
2006-02-23 20:02:46 +00:00
|
|
|
|
characterWidth = fontParamTable[currentChar].characterWidth;
|
2006-02-22 22:40:53 +00:00
|
|
|
|
|
|
|
|
|
if (characterWidth) {
|
2006-02-23 20:02:46 +00:00
|
|
|
|
uint8 characterIdx = fontParamTable[currentChar].characterIdx;
|
|
|
|
|
drawSpriteRaw(textTable[characterIdx][0], textTable[characterIdx][1], 2, 8, page1Raw, localX, localY);
|
2006-02-22 22:40:53 +00:00
|
|
|
|
localX += characterWidth;
|
|
|
|
|
}
|
|
|
|
|
}
|
2006-02-23 20:02:46 +00:00
|
|
|
|
} while ((messagePtr < endOfMessagePtr) && !endOfMessageReached);
|
2006-02-22 22:40:53 +00:00
|
|
|
|
|
|
|
|
|
localX = x + 4;
|
|
|
|
|
localY += 9;
|
|
|
|
|
} while (!endOfMessageReached);
|
|
|
|
|
|
|
|
|
|
gfxDrawPlainBoxRaw(x, localY, x + width, localY + 4, color, page1Raw);
|
|
|
|
|
|
|
|
|
|
gfxDrawLine(x + 1, y + 1, x + width - 1, y + 1, 0, page1Raw); // top
|
|
|
|
|
gfxDrawLine(x + 1, localY + 3, x + width - 1, localY + 3, 0, page1Raw); // bottom
|
|
|
|
|
gfxDrawLine(x + 1, y + 1, x + 1, localY + 3, 0, page1Raw); // left
|
|
|
|
|
gfxDrawLine(x + width - 1, y + 1, x + width - 1, localY + 3, 0, page1Raw); // right
|
|
|
|
|
|
|
|
|
|
gfxDrawLine(x, y, x + width, y, color2, page1Raw);
|
|
|
|
|
gfxDrawLine(x, localY + 4, x + width, localY + 4, color2, page1Raw);
|
|
|
|
|
gfxDrawLine(x, y, x, localY + 4, color2, page1Raw);
|
|
|
|
|
gfxDrawLine(x + width, y, x + width, localY + 4, color2, page1Raw);
|
|
|
|
|
|
|
|
|
|
freeOverlay(msgIdx, 2);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void drawOverlays(void) {
|
|
|
|
|
overlayHeadElement *currentOverlay;
|
|
|
|
|
|
|
|
|
|
backupOverlayPage();
|
|
|
|
|
|
|
|
|
|
var20 = 0;
|
|
|
|
|
|
|
|
|
|
currentOverlay = &overlayHead;
|
|
|
|
|
|
|
|
|
|
currentOverlay = currentOverlay->next;
|
|
|
|
|
|
|
|
|
|
while (currentOverlay) {
|
|
|
|
|
switch (currentOverlay->type) {
|
|
|
|
|
case 0: // sprite
|
|
|
|
|
{
|
|
|
|
|
objectStruct *objPtr;
|
2006-02-23 09:12:21 +00:00
|
|
|
|
int16 x;
|
|
|
|
|
int16 y;
|
2006-02-22 22:40:53 +00:00
|
|
|
|
|
2006-02-23 11:05:58 +00:00
|
|
|
|
ASSERT(currentOverlay->objIdx <= NUM_MAX_OBJECT);
|
2006-02-22 22:40:53 +00:00
|
|
|
|
|
|
|
|
|
objPtr = &objectTable[currentOverlay->objIdx];
|
|
|
|
|
|
|
|
|
|
x = objPtr->x;
|
|
|
|
|
y = objPtr->y;
|
|
|
|
|
|
|
|
|
|
if (objPtr->frame >= 0) {
|
|
|
|
|
if (gameType == Cine::GID_OS) {
|
2006-02-23 09:12:21 +00:00
|
|
|
|
uint16 partVar1;
|
|
|
|
|
uint16 partVar2;
|
2006-02-27 21:25:59 +00:00
|
|
|
|
AnimData *pPart;
|
2006-02-23 20:02:46 +00:00
|
|
|
|
pPart = &animDataTable[objPtr->frame];
|
2006-02-22 22:40:53 +00:00
|
|
|
|
|
|
|
|
|
partVar1 = pPart->var1;
|
2006-02-24 22:34:22 +00:00
|
|
|
|
partVar2 = pPart->height;
|
2006-02-22 22:40:53 +00:00
|
|
|
|
|
|
|
|
|
if (pPart->ptr1) {
|
2006-02-23 20:02:46 +00:00
|
|
|
|
drawSprite(currentOverlay, pPart->ptr1, pPart->ptr1, partVar1, partVar2, page1Raw, x, y);
|
2006-02-22 22:40:53 +00:00
|
|
|
|
}
|
|
|
|
|
} else {
|
2006-02-23 09:12:21 +00:00
|
|
|
|
uint16 partVar1;
|
|
|
|
|
uint16 partVar2;
|
2006-02-27 21:25:59 +00:00
|
|
|
|
AnimData *pPart;
|
2006-02-23 09:12:21 +00:00
|
|
|
|
int16 part = objPtr->part;
|
2006-02-22 22:40:53 +00:00
|
|
|
|
|
2006-02-23 20:02:46 +00:00
|
|
|
|
ASSERT(part >= 0 && part <= NUM_MAX_PARTDATA);
|
2006-02-22 22:40:53 +00:00
|
|
|
|
|
2006-02-23 20:02:46 +00:00
|
|
|
|
pPart = &animDataTable[objPtr->frame];
|
2006-02-22 22:40:53 +00:00
|
|
|
|
|
|
|
|
|
partVar1 = pPart->var1;
|
2006-02-24 22:34:22 +00:00
|
|
|
|
partVar2 = pPart->height;
|
2006-02-22 22:40:53 +00:00
|
|
|
|
|
|
|
|
|
if (pPart->ptr1) {
|
2006-02-23 20:02:46 +00:00
|
|
|
|
drawSprite(currentOverlay, pPart->ptr1, pPart->ptr2, partVar1, partVar2, page1Raw, x, y);
|
2006-02-22 22:40:53 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
case 2: // text
|
|
|
|
|
{
|
2006-02-23 09:12:21 +00:00
|
|
|
|
uint8 messageIdx;
|
|
|
|
|
int16 x;
|
|
|
|
|
int16 y;
|
|
|
|
|
uint16 partVar1;
|
|
|
|
|
uint16 partVar2;
|
2006-02-22 22:40:53 +00:00
|
|
|
|
|
2006-02-23 20:02:46 +00:00
|
|
|
|
// gfxWaitVSync();
|
|
|
|
|
// hideMouse();
|
2006-02-22 22:40:53 +00:00
|
|
|
|
|
|
|
|
|
messageIdx = currentOverlay->objIdx;
|
|
|
|
|
x = currentOverlay->x;
|
|
|
|
|
y = currentOverlay->y;
|
|
|
|
|
partVar1 = currentOverlay->var10;
|
|
|
|
|
partVar2 = currentOverlay->var12;
|
|
|
|
|
|
|
|
|
|
blitRawScreen(page1Raw);
|
|
|
|
|
|
2006-02-23 20:02:46 +00:00
|
|
|
|
drawDialogueMessage(messageIdx, x, y, partVar1, partVar2);
|
2006-02-22 22:40:53 +00:00
|
|
|
|
|
2006-02-23 20:02:46 +00:00
|
|
|
|
//blitScreen(page0, NULL);
|
2006-02-22 22:40:53 +00:00
|
|
|
|
|
|
|
|
|
gfxFuncGen2();
|
|
|
|
|
|
|
|
|
|
waitForPlayerClick = 1;
|
|
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
case 3:
|
|
|
|
|
{
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
case 4:
|
|
|
|
|
{
|
|
|
|
|
objectStruct *objPtr;
|
2006-02-23 09:12:21 +00:00
|
|
|
|
int16 x;
|
|
|
|
|
int16 y;
|
2006-02-22 22:40:53 +00:00
|
|
|
|
|
2006-02-23 11:05:58 +00:00
|
|
|
|
ASSERT(currentOverlay->objIdx <= NUM_MAX_OBJECT);
|
2006-02-22 22:40:53 +00:00
|
|
|
|
|
|
|
|
|
objPtr = &objectTable[currentOverlay->objIdx];
|
|
|
|
|
|
|
|
|
|
x = objPtr->x;
|
|
|
|
|
y = objPtr->y;
|
|
|
|
|
|
|
|
|
|
if (objPtr->frame >= 0) {
|
2006-02-23 09:12:21 +00:00
|
|
|
|
uint16 partVar1;
|
|
|
|
|
uint16 partVar2;
|
2006-02-27 21:25:59 +00:00
|
|
|
|
AnimData *pPart;
|
2006-02-23 09:12:21 +00:00
|
|
|
|
int16 part = objPtr->part;
|
2006-02-22 22:40:53 +00:00
|
|
|
|
|
2006-02-23 20:02:46 +00:00
|
|
|
|
ASSERT(part >= 0 && part <= NUM_MAX_PARTDATA);
|
2006-02-22 22:40:53 +00:00
|
|
|
|
|
|
|
|
|
pPart = &animDataTable[objPtr->frame];
|
|
|
|
|
|
|
|
|
|
partVar1 = pPart->width / 2;
|
2006-02-24 22:34:22 +00:00
|
|
|
|
partVar2 = pPart->height;
|
2006-02-22 22:40:53 +00:00
|
|
|
|
|
|
|
|
|
if (pPart->ptr1) {
|
2006-02-23 20:02:46 +00:00
|
|
|
|
gfxFillSprite(pPart->ptr1, partVar1, partVar2, page1Raw, x, y);
|
2006-02-22 22:40:53 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
case 20:
|
|
|
|
|
{
|
|
|
|
|
objectStruct *objPtr;
|
2006-02-23 09:12:21 +00:00
|
|
|
|
int16 x;
|
|
|
|
|
int16 y;
|
2006-02-22 22:40:53 +00:00
|
|
|
|
|
|
|
|
|
var5 = currentOverlay->x;
|
|
|
|
|
|
2006-02-23 11:05:58 +00:00
|
|
|
|
ASSERT(currentOverlay->objIdx <= NUM_MAX_OBJECT);
|
2006-02-22 22:40:53 +00:00
|
|
|
|
|
|
|
|
|
objPtr = &objectTable[currentOverlay->objIdx];
|
|
|
|
|
|
|
|
|
|
x = objPtr->x;
|
|
|
|
|
y = objPtr->y;
|
|
|
|
|
|
|
|
|
|
if (objPtr->frame >= 0) {
|
2006-02-23 11:05:58 +00:00
|
|
|
|
if (var5 <= 8) {
|
2006-02-22 22:40:53 +00:00
|
|
|
|
if (additionalBgTable[var5]) {
|
2006-02-24 22:34:22 +00:00
|
|
|
|
if (animDataTable[objPtr->frame].bpp == 1) {
|
2006-02-23 09:12:21 +00:00
|
|
|
|
int16 x2;
|
|
|
|
|
int16 y2;
|
2006-02-22 22:40:53 +00:00
|
|
|
|
|
|
|
|
|
x2 = animDataTable[objPtr->frame].width / 2;
|
2006-02-24 22:34:22 +00:00
|
|
|
|
y2 = animDataTable[objPtr->frame].height;
|
2006-02-22 22:40:53 +00:00
|
|
|
|
|
|
|
|
|
if (animDataTable[objPtr->frame].ptr1) {
|
2006-02-23 20:02:46 +00:00
|
|
|
|
// drawSpriteRaw(animDataTable[objPtr->frame].ptr1, animDataTable[objPtr->frame].ptr1, x2, y2,
|
|
|
|
|
// additionalBgTable[currentAdditionalBgIdx], x, y);
|
2006-02-22 22:40:53 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
currentOverlay = currentOverlay->next;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void flip(void) {
|
|
|
|
|
blitRawScreen(page1Raw);
|
|
|
|
|
}
|
|
|
|
|
|
2006-02-23 09:12:21 +00:00
|
|
|
|
uint16 processKeyboard(uint16 param) {
|
2006-02-22 22:40:53 +00:00
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void mainLoopSub6(void) {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void checkForPendingDataLoad(void) {
|
|
|
|
|
if (newPrcName[0] != 0) {
|
|
|
|
|
freePrcLinkedList();
|
|
|
|
|
resetglobalScriptsHead();
|
|
|
|
|
|
|
|
|
|
loadPrc(newPrcName);
|
|
|
|
|
|
|
|
|
|
strcpy(currentPrcName, newPrcName);
|
|
|
|
|
strcpy(newPrcName, "");
|
|
|
|
|
|
|
|
|
|
addScriptToList0(1);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (newRelName[0] != 0) {
|
|
|
|
|
releaseObjectScripts();
|
|
|
|
|
resetObjectScriptHead();
|
|
|
|
|
|
|
|
|
|
loadRel(newRelName);
|
|
|
|
|
|
|
|
|
|
strcpy(currentRelName, newRelName);
|
|
|
|
|
strcpy(newRelName, "");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (newObjectName[0] != 0) {
|
|
|
|
|
unloadAllMasks();
|
|
|
|
|
resetMessageHead();
|
|
|
|
|
|
|
|
|
|
loadObject(newObjectName);
|
|
|
|
|
|
|
|
|
|
strcpy(currentObjectName, newObjectName);
|
|
|
|
|
strcpy(newObjectName, "");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (newMsgName[0] != 0) {
|
|
|
|
|
loadMsg(newMsgName);
|
|
|
|
|
|
|
|
|
|
strcpy(currentMsgName, newMsgName);
|
|
|
|
|
strcpy(newMsgName, "");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2006-02-23 09:12:21 +00:00
|
|
|
|
uint16 exitEngine;
|
2006-02-22 22:40:53 +00:00
|
|
|
|
|
|
|
|
|
void hideMouse(void) {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void closeEngine7(void) {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void removeExtention(char *dest, const char *source) {
|
2006-02-23 09:12:21 +00:00
|
|
|
|
uint8 *ptr;
|
2006-02-22 22:40:53 +00:00
|
|
|
|
|
|
|
|
|
strcpy(dest, source);
|
|
|
|
|
|
2006-02-23 09:12:21 +00:00
|
|
|
|
ptr = (uint8 *) strchr(dest, '.');
|
2006-02-22 22:40:53 +00:00
|
|
|
|
|
|
|
|
|
if (ptr) {
|
|
|
|
|
*ptr = 0;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2006-02-23 09:12:21 +00:00
|
|
|
|
uint16 var22;
|
2006-02-22 22:40:53 +00:00
|
|
|
|
|
2006-02-23 09:12:21 +00:00
|
|
|
|
uint16 defaultMenuBoxColor2;
|
2006-02-22 22:40:53 +00:00
|
|
|
|
|
2006-02-23 09:12:21 +00:00
|
|
|
|
uint16 zoneData[NUM_MAX_ZONE];
|
2006-02-22 22:40:53 +00:00
|
|
|
|
|
2006-02-23 09:12:21 +00:00
|
|
|
|
void addMessage(uint8 param1, int16 param2, int16 param3, int16 param4, int16 param5) {
|
2006-02-22 22:40:53 +00:00
|
|
|
|
overlayHeadElement *currentHead = &overlayHead;
|
|
|
|
|
overlayHeadElement *tempHead = currentHead;
|
|
|
|
|
overlayHeadElement *newElement;
|
|
|
|
|
|
|
|
|
|
currentHead = tempHead->next;
|
|
|
|
|
|
|
|
|
|
while (currentHead) {
|
|
|
|
|
tempHead = currentHead;
|
|
|
|
|
currentHead = tempHead->next;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
newElement = (overlayHeadElement *) malloc(sizeof(overlayHeadElement));
|
|
|
|
|
|
|
|
|
|
newElement->next = tempHead->next;
|
|
|
|
|
tempHead->next = newElement;
|
|
|
|
|
|
|
|
|
|
newElement->objIdx = param1;
|
|
|
|
|
newElement->type = 2;
|
|
|
|
|
|
|
|
|
|
newElement->x = param2;
|
|
|
|
|
newElement->y = param3;
|
|
|
|
|
newElement->var10 = param4;
|
|
|
|
|
newElement->var12 = param5;
|
|
|
|
|
|
|
|
|
|
if (!currentHead)
|
|
|
|
|
currentHead = &overlayHead;
|
|
|
|
|
|
|
|
|
|
newElement->previous = currentHead->previous;
|
|
|
|
|
|
|
|
|
|
currentHead->previous = newElement;
|
|
|
|
|
}
|
|
|
|
|
|
2006-02-27 21:25:59 +00:00
|
|
|
|
SeqListElement seqList;
|
2006-02-22 22:40:53 +00:00
|
|
|
|
|
2006-02-27 21:25:59 +00:00
|
|
|
|
void addSeqListElement(int16 param0, int16 param1, int16 param2, int16 param3, int16 param4, int16 param5, int16 param6, int16 param7, int16 param8) {
|
|
|
|
|
SeqListElement *currentHead = &seqList;
|
|
|
|
|
SeqListElement *tempHead = currentHead;
|
|
|
|
|
SeqListElement *newElement;
|
2006-02-22 22:40:53 +00:00
|
|
|
|
|
|
|
|
|
currentHead = tempHead->next;
|
|
|
|
|
|
|
|
|
|
while (currentHead && currentHead->varE < param7) {
|
|
|
|
|
tempHead = currentHead;
|
|
|
|
|
currentHead = tempHead->next;
|
|
|
|
|
}
|
|
|
|
|
|
2006-02-27 21:25:59 +00:00
|
|
|
|
newElement = (SeqListElement *)malloc(sizeof(SeqListElement));
|
2006-02-22 22:40:53 +00:00
|
|
|
|
|
|
|
|
|
newElement->next = tempHead->next;
|
|
|
|
|
tempHead->next = newElement;
|
|
|
|
|
|
|
|
|
|
newElement->var6 = param0;
|
|
|
|
|
newElement->var4 = param1;
|
|
|
|
|
newElement->var8 = param2;
|
|
|
|
|
newElement->varA = param3;
|
|
|
|
|
newElement->varC = param4;
|
|
|
|
|
newElement->var14 = 0;
|
|
|
|
|
newElement->var16 = 0;
|
|
|
|
|
newElement->var18 = param5;
|
|
|
|
|
newElement->var1A = param6;
|
|
|
|
|
newElement->varE = param7;
|
|
|
|
|
newElement->var10 = param8;
|
|
|
|
|
newElement->var12 = param8;
|
|
|
|
|
newElement->var1C = 0;
|
|
|
|
|
newElement->var1E = 0;
|
|
|
|
|
}
|
|
|
|
|
|
2006-02-27 21:25:59 +00:00
|
|
|
|
void resetSeqList() {
|
|
|
|
|
seqList.next = NULL;
|
2006-02-22 22:40:53 +00:00
|
|
|
|
}
|
|
|
|
|
|
2006-02-27 21:25:59 +00:00
|
|
|
|
void computeMove1(SeqListElement *element, int16 x, int16 y, int16 param1,
|
2006-02-23 09:12:21 +00:00
|
|
|
|
int16 param2, int16 x2, int16 y2) {
|
2006-02-22 22:40:53 +00:00
|
|
|
|
element->var16 = 0;
|
|
|
|
|
element->var14 = 0;
|
|
|
|
|
|
|
|
|
|
if (y2) {
|
|
|
|
|
if (y - param2 > y2) {
|
|
|
|
|
element->var16 = 2;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (y + param2 < y2) {
|
|
|
|
|
element->var16 = 1;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (x2) {
|
|
|
|
|
if (x - param1 > x2) {
|
|
|
|
|
element->var14 = 2;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (x + param1 < x2) {
|
|
|
|
|
element->var14 = 1;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2006-02-27 21:25:59 +00:00
|
|
|
|
uint16 computeMove2(SeqListElement *element) {
|
2006-02-23 09:12:21 +00:00
|
|
|
|
int16 returnVar = 0;
|
2006-02-22 22:40:53 +00:00
|
|
|
|
|
|
|
|
|
if (element->var16 == 1) {
|
|
|
|
|
returnVar = 4;
|
|
|
|
|
} else if (element->var16 == 2) {
|
|
|
|
|
returnVar = 3;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (element->var14 == 1) {
|
|
|
|
|
returnVar = 1;
|
|
|
|
|
} else if (element->var14 == 2) {
|
|
|
|
|
returnVar = 2;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return returnVar;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// sort all the gfx stuff...
|
|
|
|
|
|
2006-02-23 09:12:21 +00:00
|
|
|
|
void resetGfxEntityEntry(uint16 objIdx) {
|
2006-02-22 22:40:53 +00:00
|
|
|
|
#if 0
|
|
|
|
|
overlayHeadElement* tempHead = &overlayHead;
|
2006-02-23 09:12:21 +00:00
|
|
|
|
uint8* var_16 = NULL;
|
|
|
|
|
uint16 var_10 = 0;
|
|
|
|
|
uint16 var_12 = 0;
|
2006-02-22 22:40:53 +00:00
|
|
|
|
overlayHeadElement* currentHead = tempHead->next;
|
2006-02-23 09:12:21 +00:00
|
|
|
|
uint8* var_1A = NULL;
|
2006-02-22 22:40:53 +00:00
|
|
|
|
overlayHeadElement* var1E = &overlayHead;
|
|
|
|
|
|
|
|
|
|
while(currentHead) {
|
|
|
|
|
tempHead2 = currentHead->next;
|
|
|
|
|
|
|
|
|
|
if(currentHead->objIdx == objIdx && currentHead->type!=2 && currentHead->type!=3 && currentHead->type!=0x14) {
|
|
|
|
|
tempHead->next = tempHead2;
|
|
|
|
|
|
|
|
|
|
if(tempHead2) {
|
|
|
|
|
tempHead2->previous = currentHead->previous;
|
|
|
|
|
} else {
|
|
|
|
|
seqVar0 = currentHead->previous;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
var_22 = var_16;
|
|
|
|
|
|
|
|
|
|
if(!var_22) {
|
|
|
|
|
// todo: goto?
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
var_22->previous = currentHead;
|
|
|
|
|
} else {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if(currentHead->type == 0x14) {
|
|
|
|
|
} else {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if(currentHead->type == 0x2 || currentHead->type == 0x3) {
|
|
|
|
|
si = 10000;
|
|
|
|
|
} else {
|
|
|
|
|
si = objectTable[currentHead->objIdx];
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if(objectTable[objIdx]>si) {
|
|
|
|
|
var1E = currentHead;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
tempHead = tempHead->next;
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
2006-02-23 20:02:46 +00:00
|
|
|
|
if (var_1A) {
|
2006-02-22 22:40:53 +00:00
|
|
|
|
currentHead = var_16;
|
|
|
|
|
var_22 = var_1E->next;
|
|
|
|
|
var_1E->next = currentHead;
|
|
|
|
|
var_1A->next = var_22;
|
|
|
|
|
|
|
|
|
|
if(var_1E != &gfxEntityHead) {
|
|
|
|
|
currentHead->previous = var_1E;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if(!var_22) {
|
|
|
|
|
seqVar0 = var_1A;
|
|
|
|
|
} else {
|
|
|
|
|
var_22->previous = var_1A;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
#endif
|
|
|
|
|
}
|
|
|
|
|
|
2006-02-27 21:25:59 +00:00
|
|
|
|
uint16 addAni(uint16 param1, uint16 param2, uint8 *ptr, SeqListElement *element, uint16 param3, int16 *param4) {
|
2006-02-23 09:12:21 +00:00
|
|
|
|
uint8 *currentPtr = ptr;
|
|
|
|
|
uint8 *ptrData;
|
|
|
|
|
uint8 *ptr2;
|
|
|
|
|
int16 di;
|
2006-02-22 22:40:53 +00:00
|
|
|
|
|
|
|
|
|
ASSERT_PTR(ptr);
|
|
|
|
|
ASSERT_PTR(element);
|
|
|
|
|
ASSERT_PTR(param4);
|
|
|
|
|
|
2006-03-03 19:38:17 +00:00
|
|
|
|
dummyU16 = READ_BE_UINT16((currentPtr + param1 * 2) + 8);
|
2006-02-22 22:40:53 +00:00
|
|
|
|
|
|
|
|
|
ptrData = ptr + dummyU16;
|
|
|
|
|
|
|
|
|
|
ASSERT(*ptrData);
|
|
|
|
|
|
|
|
|
|
di = (objectTable[param2].costume + 1) % (*ptrData);
|
|
|
|
|
ptr2 = (ptrData + (di * 8)) + 1;
|
|
|
|
|
|
|
|
|
|
if ((checkCollision(param2, ptr2[0], ptr2[1], ptr2[2], ptr[0]) & 1)) {
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
|
2006-02-23 20:02:46 +00:00
|
|
|
|
objectTable[param2].x += (int8)ptr2[4];
|
|
|
|
|
objectTable[param2].y += (int8)ptr2[5];
|
|
|
|
|
objectTable[param2].mask += (int8)ptr2[6];
|
2006-02-22 22:40:53 +00:00
|
|
|
|
|
|
|
|
|
if (objectTable[param2].frame) {
|
|
|
|
|
resetGfxEntityEntry(param2);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
objectTable[param2].frame = ptr2[7] + element->var8;
|
|
|
|
|
|
|
|
|
|
if (param3 || !element->var14) {
|
|
|
|
|
objectTable[param2].costume = di;
|
|
|
|
|
} else {
|
|
|
|
|
*param4 = di;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return 1;
|
|
|
|
|
}
|
|
|
|
|
|
2006-02-27 21:25:59 +00:00
|
|
|
|
void processSeqListElement(SeqListElement *element) {
|
2006-02-23 09:12:21 +00:00
|
|
|
|
int16 x;
|
|
|
|
|
int16 y;
|
|
|
|
|
uint8 *ptr1;
|
|
|
|
|
int16 var_10;
|
|
|
|
|
int16 var_4;
|
|
|
|
|
int16 var_2;
|
2006-02-22 22:40:53 +00:00
|
|
|
|
|
|
|
|
|
if (element->var12 < element->var10) {
|
|
|
|
|
element->var12++;
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
element->var12 = 0;
|
|
|
|
|
|
|
|
|
|
x = objectTable[element->var6].x;
|
|
|
|
|
y = objectTable[element->var6].y;
|
|
|
|
|
ptr1 = animDataTable[element->varA].ptr1;
|
|
|
|
|
|
|
|
|
|
if (ptr1) {
|
2006-02-23 09:12:21 +00:00
|
|
|
|
uint16 param1;
|
|
|
|
|
uint16 param2;
|
2006-02-22 22:40:53 +00:00
|
|
|
|
|
|
|
|
|
param1 = ptr1[1];
|
|
|
|
|
param2 = ptr1[2];
|
|
|
|
|
|
|
|
|
|
if (element->varC == 255) {
|
2006-02-24 22:34:22 +00:00
|
|
|
|
if (globalVars[VAR_MOUSE_X_POS] || globalVars[VAR_MOUSE_Y_POS]) {
|
|
|
|
|
computeMove1(element, ptr1[4] + x, ptr1[5] + y, param1, param2, globalVars[VAR_MOUSE_X_POS], globalVars[VAR_MOUSE_Y_POS]);
|
2006-02-22 22:40:53 +00:00
|
|
|
|
} else {
|
|
|
|
|
element->var16 = 0;
|
|
|
|
|
element->var14 = 0;
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
ASSERT(0);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
var_10 = computeMove2(element);
|
|
|
|
|
|
|
|
|
|
if (var_10) {
|
|
|
|
|
element->var1C = var_10;
|
|
|
|
|
element->var1E = var_10;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
var_4 = -1;
|
|
|
|
|
|
|
|
|
|
if ((element->var16 == 1
|
2006-02-23 20:02:46 +00:00
|
|
|
|
&& !addAni(3, element->var6, ptr1, element, 0, &var_4)) || (element->var16 == 2 && !addAni(2, element->var6, ptr1, element, 0,
|
2006-02-22 22:40:53 +00:00
|
|
|
|
&var_4))) {
|
|
|
|
|
if (element->varC == 255) {
|
2006-02-24 22:34:22 +00:00
|
|
|
|
globalVars[VAR_MOUSE_Y_POS] = 0;
|
2006-02-22 22:40:53 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if ((element->var14 == 1
|
2006-02-23 20:02:46 +00:00
|
|
|
|
&& !addAni(0, element->var6, ptr1, element, 1, &var_2))) {
|
2006-02-22 22:40:53 +00:00
|
|
|
|
if (element->varC == 255) {
|
2006-02-24 22:34:22 +00:00
|
|
|
|
globalVars[VAR_MOUSE_X_POS] = 0;
|
2006-02-22 22:40:53 +00:00
|
|
|
|
|
|
|
|
|
if (var_4 != -1) {
|
2006-02-23 20:02:46 +00:00
|
|
|
|
objectTable[element->var6].costume = var_4;
|
2006-02-22 22:40:53 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2006-02-23 20:02:46 +00:00
|
|
|
|
if ((element->var14 == 2 && !addAni(1, element->var6, ptr1, element, 1, &var_2))) {
|
2006-02-22 22:40:53 +00:00
|
|
|
|
if (element->varC == 255) {
|
2006-02-24 22:34:22 +00:00
|
|
|
|
globalVars[VAR_MOUSE_X_POS] = 0;
|
2006-02-22 22:40:53 +00:00
|
|
|
|
|
|
|
|
|
if (var_4 != -1) {
|
2006-02-23 20:02:46 +00:00
|
|
|
|
objectTable[element->var6].costume = var_4;
|
2006-02-22 22:40:53 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (element->var16 + element->var14) {
|
|
|
|
|
if (element->var1C) {
|
|
|
|
|
if (element->var1E) {
|
|
|
|
|
objectTable[element->var6].costume = 0;
|
|
|
|
|
element->var1E = 0;
|
|
|
|
|
}
|
|
|
|
|
|
2006-02-23 20:02:46 +00:00
|
|
|
|
addAni(element->var1C + 3, element->var6, ptr1, element, 1, (int16 *) & var2);
|
2006-02-22 22:40:53 +00:00
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2006-02-27 21:25:59 +00:00
|
|
|
|
void processSeqList(void) {
|
|
|
|
|
SeqListElement *currentHead = &seqList;
|
|
|
|
|
SeqListElement *tempHead = currentHead;
|
2006-02-22 22:40:53 +00:00
|
|
|
|
|
|
|
|
|
currentHead = tempHead->next;
|
|
|
|
|
|
|
|
|
|
while (currentHead) {
|
|
|
|
|
if (currentHead->var4 != -1) {
|
2006-02-27 21:25:59 +00:00
|
|
|
|
processSeqListElement(currentHead);
|
2006-02-22 22:40:53 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
tempHead = currentHead;
|
|
|
|
|
currentHead = tempHead->next;
|
|
|
|
|
}
|
|
|
|
|
}
|
2006-02-25 00:26:14 +00:00
|
|
|
|
|
|
|
|
|
} // End of namespace Cine
|