2005-04-05 15:53:16 +00:00
|
|
|
/* ScummVM - Scumm Interpreter
|
|
|
|
* Copyright (C) 2004 Ivan Dubrov
|
|
|
|
* Copyright (C) 2004-2005 The ScummVM project
|
|
|
|
*
|
|
|
|
* 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
|
2005-04-09 19:19:54 +00:00
|
|
|
* along with this program; if not, write to the Free Software
|
2005-10-18 01:30:26 +00:00
|
|
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
2005-04-05 15:53:16 +00:00
|
|
|
*
|
|
|
|
* $Header$
|
|
|
|
*
|
|
|
|
*/
|
2005-04-05 15:07:40 +00:00
|
|
|
#include "gob/gob.h"
|
|
|
|
#include "gob/global.h"
|
|
|
|
#include "gob/game.h"
|
|
|
|
#include "gob/video.h"
|
|
|
|
#include "gob/dataio.h"
|
|
|
|
#include "gob/pack.h"
|
2005-04-09 19:32:29 +00:00
|
|
|
#include "gob/scenery.h"
|
2005-04-05 15:07:40 +00:00
|
|
|
#include "gob/inter.h"
|
|
|
|
#include "gob/parse.h"
|
|
|
|
#include "gob/draw.h"
|
|
|
|
#include "gob/mult.h"
|
|
|
|
#include "gob/util.h"
|
|
|
|
#include "gob/goblin.h"
|
2005-04-15 00:07:14 +00:00
|
|
|
#include "gob/cdrom.h"
|
2005-04-05 15:07:40 +00:00
|
|
|
|
|
|
|
namespace Gob {
|
|
|
|
|
2006-01-03 23:14:39 +00:00
|
|
|
int16 Game::captureCount = 0;
|
|
|
|
Common::Rect Game::captureStack[20];
|
|
|
|
|
|
|
|
Game::Game(GobEngine *vm) : _vm(vm) {
|
|
|
|
extTable = 0;
|
|
|
|
totFileData = 0;
|
|
|
|
totResourceTable = 0;
|
|
|
|
imFileData = 0;
|
|
|
|
extHandle = 0;
|
|
|
|
collisionAreas = 0;
|
|
|
|
shouldPushColls = 0;
|
|
|
|
totTextData = 0;
|
|
|
|
|
|
|
|
// Collisions stack
|
|
|
|
collStackSize = 0;
|
|
|
|
for (int i = 0; i < 3; i++) {
|
|
|
|
collStack[i] = 0;
|
|
|
|
collStackElemSizes[i] = 0;
|
|
|
|
}
|
2005-04-05 15:07:40 +00:00
|
|
|
|
2006-01-03 23:14:39 +00:00
|
|
|
for (int i = 0; i < 20; i++)
|
|
|
|
soundSamples[i] = 0;
|
2005-04-05 15:07:40 +00:00
|
|
|
|
2006-01-03 23:14:39 +00:00
|
|
|
curTotFile[0] = 0;
|
|
|
|
curExtFile[0] = 0;
|
|
|
|
totToLoad[0] = 0;
|
2005-04-05 15:07:40 +00:00
|
|
|
|
2006-01-03 23:14:39 +00:00
|
|
|
startTimeKey = 0;
|
|
|
|
mouseButtons = 0;
|
2005-04-05 15:07:40 +00:00
|
|
|
|
2006-01-03 23:14:39 +00:00
|
|
|
lastCollKey = 0;
|
|
|
|
lastCollAreaIndex = 0;
|
|
|
|
lastCollId = 0;
|
2005-04-05 15:07:40 +00:00
|
|
|
|
2006-01-03 23:14:39 +00:00
|
|
|
activeCollResId = 0;
|
|
|
|
activeCollIndex = 0;
|
|
|
|
ghandleMouse = 0;
|
|
|
|
forceHandleMouse = 0;
|
2005-04-05 15:07:40 +00:00
|
|
|
|
2006-01-03 23:14:39 +00:00
|
|
|
tempStr[0] = 0;
|
|
|
|
curImaFile[0] = 0;
|
|
|
|
soundFromExt[0] = 0;
|
|
|
|
collStr[0] = 0;
|
2005-04-05 15:07:40 +00:00
|
|
|
|
|
|
|
|
2006-01-03 23:14:39 +00:00
|
|
|
// Capture
|
|
|
|
}
|
2005-04-05 15:07:40 +00:00
|
|
|
|
2006-01-03 23:14:39 +00:00
|
|
|
char *Game::loadExtData(int16 itemId, int16 *pResWidth, int16 *pResHeight) {
|
2005-04-05 15:07:40 +00:00
|
|
|
int16 commonHandle;
|
|
|
|
int16 itemsCount;
|
|
|
|
int32 offset;
|
|
|
|
uint32 size;
|
2006-01-03 23:14:39 +00:00
|
|
|
ExtItem *item;
|
2005-04-05 15:07:40 +00:00
|
|
|
char isPacked;
|
|
|
|
int16 handle;
|
|
|
|
int32 tableSize;
|
|
|
|
char path[20];
|
|
|
|
char *dataBuf;
|
|
|
|
char *packedBuf;
|
|
|
|
char *dataPtr;
|
|
|
|
|
|
|
|
itemId -= 30000;
|
2006-01-03 23:14:39 +00:00
|
|
|
if (extTable == 0)
|
2005-04-05 15:07:40 +00:00
|
|
|
return 0;
|
|
|
|
|
|
|
|
commonHandle = -1;
|
2006-01-03 23:14:39 +00:00
|
|
|
itemsCount = extTable->itemsCount;
|
|
|
|
item = &extTable->items[itemId];
|
2005-04-05 15:07:40 +00:00
|
|
|
tableSize = szGame_ExtTable + szGame_ExtItem * itemsCount;
|
|
|
|
|
|
|
|
offset = item->offset;
|
|
|
|
size = item->size;
|
|
|
|
if (item->width & 0x8000)
|
|
|
|
isPacked = 1;
|
|
|
|
else
|
|
|
|
isPacked = 0;
|
|
|
|
|
|
|
|
if (pResWidth != 0) {
|
|
|
|
*pResWidth = item->width & 0x7fff;
|
|
|
|
*pResHeight = item->height;
|
2006-01-03 23:14:39 +00:00
|
|
|
debug(7, "loadExtData(%d, %d, %d)", itemId, *pResWidth, *pResHeight);
|
2005-04-05 15:07:40 +00:00
|
|
|
}
|
|
|
|
|
2006-01-03 23:14:39 +00:00
|
|
|
debug(7, "loadExtData(%d, 0, 0)", itemId);
|
2005-04-05 15:07:40 +00:00
|
|
|
|
|
|
|
if (item->height == 0)
|
|
|
|
size += (item->width & 0x7fff) << 16;
|
|
|
|
|
2005-04-09 01:28:16 +00:00
|
|
|
debug(7, "size: %d off: %d", size, offset);
|
2005-04-05 15:07:40 +00:00
|
|
|
if (offset >= 0) {
|
2006-01-03 23:14:39 +00:00
|
|
|
handle = extHandle;
|
2005-04-05 15:07:40 +00:00
|
|
|
} else {
|
|
|
|
offset = -(offset + 1);
|
|
|
|
tableSize = 0;
|
2006-01-03 23:14:39 +00:00
|
|
|
_vm->_dataio->closeData(extHandle);
|
2005-04-05 15:07:40 +00:00
|
|
|
strcpy(path, "commun.ex1");
|
2006-01-03 23:14:39 +00:00
|
|
|
path[strlen(path) - 1] = *(totFileData + 0x3c) + '0';
|
|
|
|
commonHandle = _vm->_dataio->openData(path);
|
2005-04-05 15:07:40 +00:00
|
|
|
handle = commonHandle;
|
|
|
|
}
|
|
|
|
|
2005-04-09 01:28:16 +00:00
|
|
|
debug(7, "off: %ld size: %ld", offset, tableSize);
|
2006-01-03 23:14:39 +00:00
|
|
|
_vm->_dataio->seekData(handle, offset + tableSize, SEEK_SET);
|
2005-04-05 15:07:40 +00:00
|
|
|
if (isPacked)
|
|
|
|
dataBuf = (char *)malloc(size);
|
|
|
|
else
|
|
|
|
dataBuf = (char *)malloc(size);
|
|
|
|
|
|
|
|
dataPtr = dataBuf;
|
|
|
|
while (size > 32000) {
|
|
|
|
// BUG: huge->far conversion. Need normalization?
|
2006-01-03 23:14:39 +00:00
|
|
|
_vm->_dataio->readData(handle, (char *)dataPtr, 32000);
|
2005-04-05 15:07:40 +00:00
|
|
|
size -= 32000;
|
|
|
|
dataPtr += 32000;
|
|
|
|
}
|
2006-01-03 23:14:39 +00:00
|
|
|
_vm->_dataio->readData(handle, (char *)dataPtr, size);
|
2005-04-05 15:07:40 +00:00
|
|
|
if (commonHandle != -1) {
|
2006-01-03 23:14:39 +00:00
|
|
|
_vm->_dataio->closeData(commonHandle);
|
|
|
|
extHandle = _vm->_dataio->openData(curExtFile);
|
2005-04-05 15:07:40 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
if (isPacked != 0) {
|
|
|
|
packedBuf = dataBuf;
|
|
|
|
dataBuf = (char *)malloc(READ_LE_UINT32(packedBuf));
|
2006-01-03 23:14:39 +00:00
|
|
|
_vm->_pack->unpackData(packedBuf, dataBuf);
|
2005-04-05 15:07:40 +00:00
|
|
|
free(packedBuf);
|
|
|
|
}
|
|
|
|
|
|
|
|
return dataBuf;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
2006-01-03 23:14:39 +00:00
|
|
|
void Game::clearCollisions() {
|
2005-04-05 15:07:40 +00:00
|
|
|
int16 i;
|
2005-04-21 06:53:15 +00:00
|
|
|
for (i = 0; i < 250; i++) {
|
2006-01-03 23:14:39 +00:00
|
|
|
collisionAreas[i].id = 0;
|
|
|
|
collisionAreas[i].left = -1;
|
2005-04-21 06:53:15 +00:00
|
|
|
}
|
2005-04-05 15:07:40 +00:00
|
|
|
}
|
|
|
|
|
2006-01-03 23:14:39 +00:00
|
|
|
void Game::addNewCollision(int16 id, int16 left, int16 top, int16 right, int16 bottom,
|
2005-04-05 15:07:40 +00:00
|
|
|
int16 flags, int16 key, int16 funcEnter, int16 funcLeave) {
|
|
|
|
int16 i;
|
2006-01-03 23:14:39 +00:00
|
|
|
Collision *ptr;
|
2005-04-05 15:07:40 +00:00
|
|
|
|
2006-01-03 23:14:39 +00:00
|
|
|
debug(5, "addNewCollision");
|
2005-04-05 15:07:40 +00:00
|
|
|
debug(5, "id = %x", id);
|
|
|
|
debug(5, "left = %d, top = %d, right = %d, bottom = %d", left, top, right, bottom);
|
|
|
|
debug(5, "flags = %x, key = %x", flags, key);
|
|
|
|
debug(5, "funcEnter = %d, funcLeave = %d", funcEnter, funcLeave);
|
|
|
|
|
|
|
|
for (i = 0; i < 250; i++) {
|
2006-01-03 23:14:39 +00:00
|
|
|
if (collisionAreas[i].left != -1)
|
2005-04-05 15:07:40 +00:00
|
|
|
continue;
|
|
|
|
|
2006-01-03 23:14:39 +00:00
|
|
|
ptr = &collisionAreas[i];
|
2005-04-05 15:07:40 +00:00
|
|
|
ptr->id = id;
|
|
|
|
ptr->left = left;
|
|
|
|
ptr->top = top;
|
|
|
|
ptr->right = right;
|
|
|
|
ptr->bottom = bottom;
|
|
|
|
ptr->flags = flags;
|
|
|
|
ptr->key = key;
|
|
|
|
ptr->funcEnter = funcEnter;
|
|
|
|
ptr->funcLeave = funcLeave;
|
|
|
|
return;
|
|
|
|
}
|
2006-01-03 23:14:39 +00:00
|
|
|
error("addNewCollision: Collision array full!\n");
|
2005-04-05 15:07:40 +00:00
|
|
|
}
|
|
|
|
|
2006-01-03 23:14:39 +00:00
|
|
|
void Game::freeCollision(int16 id) {
|
2005-04-05 15:07:40 +00:00
|
|
|
int16 i;
|
|
|
|
|
|
|
|
for (i = 0; i < 250; i++) {
|
2006-01-03 23:14:39 +00:00
|
|
|
if (collisionAreas[i].id == id)
|
|
|
|
collisionAreas[i].left = -1;
|
2005-04-05 15:07:40 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2006-01-03 23:14:39 +00:00
|
|
|
void Game::pushCollisions(char all) {
|
|
|
|
Collision *srcPtr;
|
|
|
|
Collision *destPtr;
|
2005-04-05 15:07:40 +00:00
|
|
|
int16 size;
|
|
|
|
|
2006-01-03 23:14:39 +00:00
|
|
|
debug(4, "pushCollisions");
|
|
|
|
for (size = 0, srcPtr = collisionAreas; srcPtr->left != -1;
|
2005-04-05 15:07:40 +00:00
|
|
|
srcPtr++) {
|
|
|
|
if (all || (srcPtr->id & 0x8000))
|
|
|
|
size++;
|
|
|
|
}
|
|
|
|
|
2006-01-03 23:14:39 +00:00
|
|
|
destPtr = (Collision *)malloc(size * sizeof(Collision));
|
|
|
|
collStack[collStackSize] = destPtr;
|
|
|
|
collStackElemSizes[collStackSize] = size;
|
|
|
|
collStackSize++;
|
2005-04-05 15:07:40 +00:00
|
|
|
|
2006-01-03 23:14:39 +00:00
|
|
|
for (srcPtr = collisionAreas; srcPtr->left != -1; srcPtr++) {
|
2005-04-05 15:07:40 +00:00
|
|
|
if (all || (srcPtr->id & 0x8000)) {
|
2006-01-03 23:14:39 +00:00
|
|
|
memcpy(destPtr, srcPtr, sizeof(Collision));
|
2005-04-05 15:07:40 +00:00
|
|
|
srcPtr->left = -1;
|
|
|
|
destPtr++;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2006-01-03 23:14:39 +00:00
|
|
|
void Game::popCollisions(void) {
|
|
|
|
Collision *destPtr;
|
|
|
|
Collision *srcPtr;
|
2005-04-05 15:07:40 +00:00
|
|
|
|
2006-01-03 23:14:39 +00:00
|
|
|
debug(4, "popCollision");
|
2005-04-05 15:07:40 +00:00
|
|
|
|
2006-01-03 23:14:39 +00:00
|
|
|
collStackSize--;
|
|
|
|
for (destPtr = collisionAreas; destPtr->left != -1; destPtr++);
|
2005-04-05 15:07:40 +00:00
|
|
|
|
2006-01-03 23:14:39 +00:00
|
|
|
srcPtr = collStack[collStackSize];
|
2005-04-05 15:07:40 +00:00
|
|
|
memcpy(destPtr, srcPtr,
|
2006-01-03 23:14:39 +00:00
|
|
|
collStackElemSizes[collStackSize] *
|
|
|
|
sizeof(Collision));
|
2005-04-05 15:07:40 +00:00
|
|
|
|
2006-01-03 23:14:39 +00:00
|
|
|
free(collStack[collStackSize]);
|
2005-04-05 15:07:40 +00:00
|
|
|
}
|
|
|
|
|
2006-01-03 23:14:39 +00:00
|
|
|
int16 Game::checkMousePoint(int16 all, int16 *resId, int16 *resIndex) {
|
|
|
|
Collision *ptr;
|
2005-04-05 15:07:40 +00:00
|
|
|
int16 i;
|
|
|
|
|
|
|
|
if (resId != 0)
|
|
|
|
*resId = 0;
|
|
|
|
|
|
|
|
*resIndex = 0;
|
|
|
|
|
2006-01-03 23:14:39 +00:00
|
|
|
ptr = collisionAreas;
|
2005-04-05 15:07:40 +00:00
|
|
|
for (i = 0; ptr->left != -1; ptr++, i++) {
|
|
|
|
if (all) {
|
|
|
|
if ((ptr->flags & 0xf) > 1)
|
|
|
|
continue;
|
|
|
|
|
|
|
|
if ((ptr->flags & 0xff00) != 0)
|
|
|
|
continue;
|
|
|
|
|
2006-01-03 23:14:39 +00:00
|
|
|
if (_vm->_global->inter_mouseX < ptr->left
|
|
|
|
|| _vm->_global->inter_mouseX > ptr->right
|
|
|
|
|| _vm->_global->inter_mouseY < ptr->top
|
|
|
|
|| _vm->_global->inter_mouseY > ptr->bottom)
|
2005-04-05 15:07:40 +00:00
|
|
|
continue;
|
|
|
|
|
|
|
|
if (resId != 0)
|
|
|
|
*resId = ptr->id;
|
|
|
|
|
|
|
|
*resIndex = i;
|
|
|
|
return ptr->key;
|
|
|
|
} else {
|
|
|
|
if ((ptr->flags & 0xff00) != 0)
|
|
|
|
continue;
|
|
|
|
|
|
|
|
if ((ptr->flags & 0xf) != 1 && (ptr->flags & 0xf) != 2)
|
|
|
|
continue;
|
|
|
|
|
2006-01-03 23:14:39 +00:00
|
|
|
if ((ptr->flags & 0xf0) >> 4 != mouseButtons - 1
|
2005-04-05 15:07:40 +00:00
|
|
|
&& (ptr->flags & 0xf0) >> 4 != 2)
|
|
|
|
continue;
|
|
|
|
|
2006-01-03 23:14:39 +00:00
|
|
|
if (_vm->_global->inter_mouseX < ptr->left
|
|
|
|
|| _vm->_global->inter_mouseX > ptr->right
|
|
|
|
|| _vm->_global->inter_mouseY < ptr->top
|
|
|
|
|| _vm->_global->inter_mouseY > ptr->bottom)
|
2005-04-05 15:07:40 +00:00
|
|
|
continue;
|
|
|
|
|
|
|
|
if (resId != 0)
|
|
|
|
*resId = ptr->id;
|
|
|
|
*resIndex = i;
|
|
|
|
return ptr->key;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2006-01-03 23:14:39 +00:00
|
|
|
if (mouseButtons != 1 && all == 0)
|
2005-04-05 15:07:40 +00:00
|
|
|
return 0x11b;
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2006-01-03 23:14:39 +00:00
|
|
|
void Game::capturePush(int16 left, int16 top, int16 width, int16 height) {
|
2005-04-05 15:07:40 +00:00
|
|
|
int16 right;
|
|
|
|
|
2006-01-03 23:14:39 +00:00
|
|
|
if (captureCount == 20)
|
|
|
|
error("capturePush: Capture stack overflow!");
|
2005-04-05 15:07:40 +00:00
|
|
|
|
2006-01-03 23:14:39 +00:00
|
|
|
captureStack[captureCount].left = left;
|
|
|
|
captureStack[captureCount].top = top;
|
|
|
|
captureStack[captureCount].right = left + width;
|
|
|
|
captureStack[captureCount].bottom = top + height;
|
2005-04-05 15:07:40 +00:00
|
|
|
|
2006-01-03 23:14:39 +00:00
|
|
|
_vm->_draw->spriteTop = top;
|
|
|
|
_vm->_draw->spriteBottom = height;
|
2005-04-05 15:07:40 +00:00
|
|
|
|
|
|
|
right = left + width - 1;
|
|
|
|
left &= 0xfff0;
|
|
|
|
right |= 0xf;
|
|
|
|
|
2006-01-03 23:14:39 +00:00
|
|
|
_vm->_draw->spritesArray[30 + captureCount] =
|
|
|
|
_vm->_video->initSurfDesc(_vm->_global->videoMode, right - left + 1, height, 0);
|
2005-04-05 15:07:40 +00:00
|
|
|
|
2006-01-03 23:14:39 +00:00
|
|
|
_vm->_draw->sourceSurface = 21;
|
|
|
|
_vm->_draw->destSurface = 30 + captureCount;
|
2005-04-05 15:07:40 +00:00
|
|
|
|
2006-01-03 23:14:39 +00:00
|
|
|
_vm->_draw->spriteLeft = left;
|
|
|
|
_vm->_draw->spriteRight = right - left + 1;
|
|
|
|
_vm->_draw->destSpriteX = 0;
|
|
|
|
_vm->_draw->destSpriteY = 0;
|
|
|
|
_vm->_draw->transparency = 0;
|
|
|
|
_vm->_draw->spriteOperation(0);
|
|
|
|
captureCount++;
|
2005-04-05 15:07:40 +00:00
|
|
|
}
|
|
|
|
|
2006-01-03 23:14:39 +00:00
|
|
|
void Game::capturePop(char doDraw) {
|
|
|
|
if (captureCount <= 0)
|
2005-04-05 15:07:40 +00:00
|
|
|
return;
|
|
|
|
|
2006-01-03 23:14:39 +00:00
|
|
|
captureCount--;
|
2005-04-05 15:07:40 +00:00
|
|
|
if (doDraw) {
|
2006-01-03 23:14:39 +00:00
|
|
|
_vm->_draw->destSpriteX = captureStack[captureCount].left;
|
|
|
|
_vm->_draw->destSpriteY = captureStack[captureCount].top;
|
|
|
|
_vm->_draw->spriteRight =
|
|
|
|
captureStack[captureCount].width();
|
|
|
|
_vm->_draw->spriteBottom =
|
|
|
|
captureStack[captureCount].height();
|
|
|
|
|
|
|
|
_vm->_draw->transparency = 0;
|
|
|
|
_vm->_draw->sourceSurface = 30 + captureCount;
|
|
|
|
_vm->_draw->destSurface = 21;
|
|
|
|
_vm->_draw->spriteLeft = _vm->_draw->destSpriteX & 0xf;
|
|
|
|
_vm->_draw->spriteTop = 0;
|
|
|
|
_vm->_draw->spriteOperation(0);
|
2005-04-05 15:07:40 +00:00
|
|
|
}
|
2006-01-03 23:14:39 +00:00
|
|
|
_vm->_video->freeSurfDesc(_vm->_draw->spritesArray[30 + captureCount]);
|
2005-04-05 15:07:40 +00:00
|
|
|
}
|
|
|
|
|
2006-01-03 23:14:39 +00:00
|
|
|
char *Game::loadTotResource(int16 id) {
|
|
|
|
TotResItem *itemPtr;
|
2005-04-05 15:07:40 +00:00
|
|
|
int32 offset;
|
|
|
|
|
2006-01-03 23:14:39 +00:00
|
|
|
itemPtr = &totResourceTable->items[id];
|
2005-04-05 15:07:40 +00:00
|
|
|
offset = itemPtr->offset;
|
|
|
|
if (offset >= 0) {
|
2006-01-03 23:14:39 +00:00
|
|
|
return ((char *)totResourceTable) + szGame_TotResTable +
|
|
|
|
szGame_TotResItem * totResourceTable->itemsCount + offset;
|
2005-04-05 15:07:40 +00:00
|
|
|
} else {
|
2006-01-03 23:14:39 +00:00
|
|
|
return (char *)(imFileData + (int32)READ_LE_UINT32(&((int32 *)imFileData)[-offset - 1]));
|
2005-04-05 15:07:40 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2006-01-03 23:14:39 +00:00
|
|
|
void Game::loadSound(int16 slot, char *dataPtr) {
|
|
|
|
Snd::SoundDesc *soundDesc;
|
2005-04-05 15:07:40 +00:00
|
|
|
|
2006-01-03 23:14:39 +00:00
|
|
|
soundDesc = (Snd::SoundDesc *)malloc(sizeof(Snd::SoundDesc));
|
2005-04-05 15:07:40 +00:00
|
|
|
|
2006-01-03 23:14:39 +00:00
|
|
|
soundSamples[slot] = soundDesc;
|
2005-04-05 15:07:40 +00:00
|
|
|
|
|
|
|
soundDesc->frequency = (dataPtr[4] << 8) + dataPtr[5];
|
|
|
|
soundDesc->size = (dataPtr[1] << 16) + (dataPtr[2] << 8) + dataPtr[3];
|
|
|
|
soundDesc->data = dataPtr + 6;
|
|
|
|
soundDesc->timerTicks = (int32)1193180 / (int32)soundDesc->frequency;
|
|
|
|
|
|
|
|
soundDesc->inClocks = (soundDesc->frequency * 10) / 182;
|
|
|
|
soundDesc->flag = 0;
|
|
|
|
}
|
|
|
|
|
2006-01-03 23:14:39 +00:00
|
|
|
void Game::interLoadSound(int16 slot) {
|
2005-04-05 15:07:40 +00:00
|
|
|
char *dataPtr;
|
|
|
|
int16 id;
|
|
|
|
|
|
|
|
if (slot == -1)
|
2006-01-03 23:14:39 +00:00
|
|
|
slot = _vm->_parse->parseValExpr();
|
2005-04-05 15:07:40 +00:00
|
|
|
|
2006-01-03 23:14:39 +00:00
|
|
|
id = _vm->_inter->load16();
|
2005-04-05 15:07:40 +00:00
|
|
|
if (id == -1) {
|
2006-01-03 23:14:39 +00:00
|
|
|
_vm->_global->inter_execPtr += 9;
|
2005-04-05 15:07:40 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (id >= 30000) {
|
2006-01-03 23:14:39 +00:00
|
|
|
dataPtr = loadExtData(id, 0, 0);
|
|
|
|
soundFromExt[slot] = 1;
|
2005-04-05 15:07:40 +00:00
|
|
|
} else {
|
2006-01-03 23:14:39 +00:00
|
|
|
dataPtr = loadTotResource(id);
|
|
|
|
soundFromExt[slot] = 0;
|
2005-04-05 15:07:40 +00:00
|
|
|
}
|
|
|
|
|
2006-01-03 23:14:39 +00:00
|
|
|
loadSound(slot, dataPtr);
|
2005-04-05 15:07:40 +00:00
|
|
|
}
|
|
|
|
|
2006-01-03 23:14:39 +00:00
|
|
|
void Game::freeSoundSlot(int16 slot) {
|
2005-04-05 15:07:40 +00:00
|
|
|
if (slot == -1)
|
2006-01-03 23:14:39 +00:00
|
|
|
slot = _vm->_parse->parseValExpr();
|
2005-04-05 15:07:40 +00:00
|
|
|
|
2006-01-03 23:14:39 +00:00
|
|
|
if (soundSamples[slot] == 0)
|
2005-04-05 15:07:40 +00:00
|
|
|
return;
|
|
|
|
|
2006-01-03 23:14:39 +00:00
|
|
|
if (soundFromExt[slot] == 1) {
|
|
|
|
free(soundSamples[slot]->data - 6);
|
|
|
|
soundFromExt[slot] = 0;
|
2005-04-05 15:07:40 +00:00
|
|
|
}
|
|
|
|
|
2006-01-03 23:14:39 +00:00
|
|
|
free(soundSamples[slot]);
|
|
|
|
soundSamples[slot] = 0;
|
2005-04-05 15:07:40 +00:00
|
|
|
}
|
|
|
|
|
2006-01-03 23:14:39 +00:00
|
|
|
int16 Game::checkKeys(int16 *pMouseX, int16 *pMouseY, int16 *pButtons, char handleMouse) {
|
|
|
|
_vm->_util->processInput();
|
2005-04-05 15:07:40 +00:00
|
|
|
|
2005-04-10 17:13:17 +00:00
|
|
|
if (VAR(58) != 0) {
|
2006-01-03 23:14:39 +00:00
|
|
|
if (_vm->_mult->frameStart != (int)VAR(58) - 1)
|
|
|
|
_vm->_mult->frameStart++;
|
2005-04-05 15:07:40 +00:00
|
|
|
else
|
2006-01-03 23:14:39 +00:00
|
|
|
_vm->_mult->frameStart = 0;
|
2005-04-05 15:07:40 +00:00
|
|
|
|
2006-01-03 23:14:39 +00:00
|
|
|
_vm->_mult->playMult(_vm->_mult->frameStart + VAR(57), _vm->_mult->frameStart + VAR(57), 1,
|
2005-04-05 15:07:40 +00:00
|
|
|
handleMouse);
|
|
|
|
}
|
|
|
|
|
2006-01-03 23:14:39 +00:00
|
|
|
if (_vm->_inter->soundEndTimeKey != 0
|
|
|
|
&& _vm->_util->getTimeKey() >= _vm->_inter->soundEndTimeKey) {
|
|
|
|
_vm->_snd->stopSound(_vm->_inter->soundStopVal);
|
|
|
|
_vm->_inter->soundEndTimeKey = 0;
|
2005-04-05 15:07:40 +00:00
|
|
|
}
|
|
|
|
|
2006-01-03 23:14:39 +00:00
|
|
|
if (_vm->_global->useMouse == 0)
|
|
|
|
error("checkKeys: Can't work without mouse!");
|
2005-04-05 15:07:40 +00:00
|
|
|
|
2006-01-03 23:14:39 +00:00
|
|
|
_vm->_util->getMouseState(pMouseX, pMouseY, pButtons);
|
2005-04-05 15:07:40 +00:00
|
|
|
|
|
|
|
if (*pButtons == 3)
|
|
|
|
*pButtons = 0;
|
2005-04-13 20:53:36 +00:00
|
|
|
|
2006-01-03 23:14:39 +00:00
|
|
|
return _vm->_util->checkKey();
|
2005-04-05 15:07:40 +00:00
|
|
|
}
|
|
|
|
|
2006-01-03 23:14:39 +00:00
|
|
|
int16 Game::checkCollisions(char handleMouse, int16 deltaTime, int16 *pResId,
|
2005-04-05 15:07:40 +00:00
|
|
|
int16 *pResIndex) {
|
|
|
|
char *savedIP;
|
|
|
|
int16 resIndex;
|
|
|
|
int16 key;
|
|
|
|
int16 oldIndex;
|
|
|
|
int16 oldId;
|
|
|
|
uint32 timeKey;
|
|
|
|
|
|
|
|
if (deltaTime >= -1) {
|
2006-01-03 23:14:39 +00:00
|
|
|
lastCollKey = 0;
|
|
|
|
lastCollAreaIndex = 0;
|
|
|
|
lastCollId = 0;
|
2005-04-05 15:07:40 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
if (pResId != 0)
|
|
|
|
*pResId = 0;
|
|
|
|
|
|
|
|
resIndex = 0;
|
|
|
|
|
2006-01-03 23:14:39 +00:00
|
|
|
if (_vm->_draw->gcursorIndex == -1 && handleMouse != 0
|
|
|
|
&& lastCollKey == 0) {
|
|
|
|
lastCollKey =
|
|
|
|
checkMousePoint(1, &lastCollId,
|
|
|
|
&lastCollAreaIndex);
|
2005-04-05 15:07:40 +00:00
|
|
|
|
2006-01-03 23:14:39 +00:00
|
|
|
if (lastCollKey != 0 && (lastCollId & 0x8000) != 0) {
|
|
|
|
savedIP = _vm->_global->inter_execPtr;
|
|
|
|
_vm->_global->inter_execPtr = (char *)totFileData +
|
|
|
|
collisionAreas[lastCollAreaIndex].funcEnter;
|
2005-04-05 15:07:40 +00:00
|
|
|
|
2006-01-03 23:14:39 +00:00
|
|
|
_vm->_inter->funcBlock(0);
|
|
|
|
_vm->_global->inter_execPtr = savedIP;
|
2005-04-05 15:07:40 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (handleMouse != 0)
|
2006-01-03 23:14:39 +00:00
|
|
|
_vm->_draw->animateCursor(-1);
|
2005-04-05 15:07:40 +00:00
|
|
|
|
2006-01-03 23:14:39 +00:00
|
|
|
timeKey = _vm->_util->getTimeKey();
|
2005-04-05 15:07:40 +00:00
|
|
|
while (1) {
|
2006-01-03 23:14:39 +00:00
|
|
|
if (_vm->_inter->terminate != 0) {
|
2005-04-05 15:07:40 +00:00
|
|
|
if (handleMouse)
|
2006-01-03 23:14:39 +00:00
|
|
|
_vm->_draw->blitCursor();
|
2005-04-05 15:07:40 +00:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2006-01-03 23:14:39 +00:00
|
|
|
if (_vm->_draw->noInvalidated == 0) {
|
2005-04-05 15:07:40 +00:00
|
|
|
if (handleMouse)
|
2006-01-03 23:14:39 +00:00
|
|
|
_vm->_draw->animateCursor(-1);
|
2005-04-05 15:07:40 +00:00
|
|
|
else
|
2006-01-03 23:14:39 +00:00
|
|
|
_vm->_draw->blitInvalidated();
|
2005-04-05 15:07:40 +00:00
|
|
|
}
|
|
|
|
|
2006-01-03 23:14:39 +00:00
|
|
|
// NOTE: the original asm does the below checkKeys call
|
2005-04-13 20:53:36 +00:00
|
|
|
// _before_ this check. However, that can cause keypresses to get lost
|
|
|
|
// since there's a return statement in this check.
|
|
|
|
// Additionally, I added a 'deltaTime == -1' check there, since
|
2006-01-03 23:14:39 +00:00
|
|
|
// when this function is called with deltaTime == -1 in inputArea,
|
2005-04-13 20:53:36 +00:00
|
|
|
// and the return value is then discarded.
|
2005-04-05 15:07:40 +00:00
|
|
|
if (deltaTime < 0) {
|
2006-01-03 23:14:39 +00:00
|
|
|
uint32 curtime = _vm->_util->getTimeKey();
|
2005-04-13 20:53:36 +00:00
|
|
|
if (deltaTime == -1 || curtime + deltaTime > timeKey) {
|
2005-04-05 15:07:40 +00:00
|
|
|
if (pResId != 0)
|
|
|
|
*pResId = 0;
|
2005-07-30 21:11:48 +00:00
|
|
|
|
2005-04-05 15:07:40 +00:00
|
|
|
if (pResIndex != 0)
|
|
|
|
*pResIndex = 0;
|
2005-07-30 21:11:48 +00:00
|
|
|
|
2005-04-05 15:07:40 +00:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2006-01-03 23:14:39 +00:00
|
|
|
key = checkKeys(&_vm->_global->inter_mouseX, &_vm->_global->inter_mouseY,
|
|
|
|
&mouseButtons, handleMouse);
|
2005-04-13 20:53:36 +00:00
|
|
|
|
2006-01-03 23:14:39 +00:00
|
|
|
if (handleMouse == 0 && mouseButtons != 0) {
|
|
|
|
_vm->_util->waitMouseRelease(0);
|
2005-04-05 15:07:40 +00:00
|
|
|
key = 3;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (key != 0) {
|
|
|
|
|
|
|
|
if (handleMouse == 1)
|
2006-01-03 23:14:39 +00:00
|
|
|
_vm->_draw->blitCursor();
|
2005-04-05 15:07:40 +00:00
|
|
|
|
|
|
|
if (pResId != 0)
|
|
|
|
*pResId = 0;
|
|
|
|
|
|
|
|
if (pResIndex != 0)
|
|
|
|
*pResIndex = 0;
|
|
|
|
|
2006-01-03 23:14:39 +00:00
|
|
|
if (lastCollKey != 0 &&
|
|
|
|
collisionAreas[lastCollAreaIndex].funcLeave != 0) {
|
|
|
|
savedIP = _vm->_global->inter_execPtr;
|
|
|
|
_vm->_global->inter_execPtr = (char *)totFileData +
|
|
|
|
collisionAreas[lastCollAreaIndex].funcLeave;
|
2005-04-05 15:07:40 +00:00
|
|
|
|
2006-01-03 23:14:39 +00:00
|
|
|
_vm->_inter->funcBlock(0);
|
|
|
|
_vm->_global->inter_execPtr = savedIP;
|
2005-04-05 15:07:40 +00:00
|
|
|
}
|
|
|
|
|
2006-01-03 23:14:39 +00:00
|
|
|
lastCollKey = 0;
|
2005-04-05 15:07:40 +00:00
|
|
|
if (key != 0)
|
|
|
|
return key;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (handleMouse != 0) {
|
2006-01-03 23:14:39 +00:00
|
|
|
if (mouseButtons != 0) {
|
2005-04-05 15:07:40 +00:00
|
|
|
oldIndex = 0;
|
|
|
|
|
2006-01-03 23:14:39 +00:00
|
|
|
_vm->_draw->animateCursor(2);
|
2005-04-05 15:07:40 +00:00
|
|
|
if (deltaTime <= 0) {
|
|
|
|
if (handleMouse == 1)
|
2006-01-03 23:14:39 +00:00
|
|
|
_vm->_util->waitMouseRelease(1);
|
2005-04-05 15:07:40 +00:00
|
|
|
} else if (deltaTime > 0) {
|
2006-01-03 23:14:39 +00:00
|
|
|
_vm->_util->delay(deltaTime);
|
2005-04-05 15:07:40 +00:00
|
|
|
}
|
|
|
|
|
2006-01-03 23:14:39 +00:00
|
|
|
_vm->_draw->animateCursor(-1);
|
2005-04-05 15:07:40 +00:00
|
|
|
if (pResId != 0)
|
|
|
|
*pResId = 0;
|
|
|
|
|
2006-01-03 23:14:39 +00:00
|
|
|
key = checkMousePoint(0, pResId, &resIndex);
|
2005-04-05 15:07:40 +00:00
|
|
|
|
|
|
|
if (pResIndex != 0)
|
|
|
|
*pResIndex = resIndex;
|
|
|
|
|
|
|
|
if (key != 0 || (pResId != 0 && *pResId != 0)) {
|
|
|
|
if (handleMouse == 1 && (deltaTime <= 0
|
2006-01-03 23:14:39 +00:00
|
|
|
|| mouseButtons == 0))
|
|
|
|
_vm->_draw->blitCursor();
|
|
|
|
|
|
|
|
if (lastCollKey != 0 &&
|
|
|
|
collisionAreas[lastCollAreaIndex].funcLeave != 0) {
|
|
|
|
savedIP = _vm->_global->inter_execPtr;
|
|
|
|
_vm->_global->inter_execPtr =
|
|
|
|
(char *)totFileData +
|
|
|
|
collisionAreas[lastCollAreaIndex].funcLeave;
|
|
|
|
|
|
|
|
_vm->_inter->funcBlock(0);
|
|
|
|
_vm->_global->inter_execPtr = savedIP;
|
2005-04-05 15:07:40 +00:00
|
|
|
}
|
2006-01-03 23:14:39 +00:00
|
|
|
lastCollKey = 0;
|
2005-04-05 15:07:40 +00:00
|
|
|
return key;
|
|
|
|
}
|
|
|
|
|
2006-01-03 23:14:39 +00:00
|
|
|
if (lastCollKey != 0 &&
|
|
|
|
collisionAreas[lastCollAreaIndex].funcLeave != 0) {
|
|
|
|
savedIP = _vm->_global->inter_execPtr;
|
|
|
|
_vm->_global->inter_execPtr =
|
|
|
|
(char *)totFileData +
|
|
|
|
collisionAreas[lastCollAreaIndex].funcLeave;
|
2005-04-05 15:07:40 +00:00
|
|
|
|
2006-01-03 23:14:39 +00:00
|
|
|
_vm->_inter->funcBlock(0);
|
|
|
|
_vm->_global->inter_execPtr = savedIP;
|
2005-04-05 15:07:40 +00:00
|
|
|
}
|
|
|
|
|
2006-01-03 23:14:39 +00:00
|
|
|
lastCollKey =
|
|
|
|
checkMousePoint(1, &lastCollId,
|
|
|
|
&lastCollAreaIndex);
|
2005-04-05 15:07:40 +00:00
|
|
|
|
2006-01-03 23:14:39 +00:00
|
|
|
if (lastCollKey != 0
|
|
|
|
&& (lastCollId & 0x8000) != 0) {
|
|
|
|
savedIP = _vm->_global->inter_execPtr;
|
|
|
|
_vm->_global->inter_execPtr =
|
|
|
|
(char *)totFileData +
|
|
|
|
collisionAreas[lastCollAreaIndex].funcEnter;
|
2005-04-05 15:07:40 +00:00
|
|
|
|
2006-01-03 23:14:39 +00:00
|
|
|
_vm->_inter->funcBlock(0);
|
|
|
|
_vm->_global->inter_execPtr = savedIP;
|
2005-04-05 15:07:40 +00:00
|
|
|
}
|
|
|
|
} else {
|
|
|
|
|
|
|
|
if (handleMouse != 0 &&
|
2006-01-03 23:14:39 +00:00
|
|
|
(_vm->_global->inter_mouseX != _vm->_draw->cursorX
|
|
|
|
|| _vm->_global->inter_mouseY != _vm->_draw->cursorY)) {
|
|
|
|
oldIndex = lastCollAreaIndex;
|
|
|
|
oldId = lastCollId;
|
2005-04-05 15:07:40 +00:00
|
|
|
|
|
|
|
key =
|
2006-01-03 23:14:39 +00:00
|
|
|
checkMousePoint(1,
|
|
|
|
&lastCollId,
|
|
|
|
&lastCollAreaIndex);
|
2005-04-05 15:07:40 +00:00
|
|
|
|
2006-01-03 23:14:39 +00:00
|
|
|
if (key != lastCollKey) {
|
|
|
|
if (lastCollKey != 0
|
2005-04-05 15:07:40 +00:00
|
|
|
&& (oldId & 0x8000) != 0) {
|
2006-01-03 23:14:39 +00:00
|
|
|
savedIP = _vm->_global->inter_execPtr;
|
|
|
|
_vm->_global->inter_execPtr = (char *)totFileData +
|
|
|
|
collisionAreas[oldIndex].funcLeave;
|
2005-04-05 15:07:40 +00:00
|
|
|
|
2006-01-03 23:14:39 +00:00
|
|
|
_vm->_inter->funcBlock(0);
|
|
|
|
_vm->_global->inter_execPtr = savedIP;
|
2005-04-05 15:07:40 +00:00
|
|
|
}
|
|
|
|
|
2006-01-03 23:14:39 +00:00
|
|
|
lastCollKey = key;
|
|
|
|
if (lastCollKey != 0 && (lastCollId & 0x8000) != 0) {
|
|
|
|
savedIP = _vm->_global->inter_execPtr;
|
|
|
|
_vm->_global->inter_execPtr = (char *)totFileData +
|
|
|
|
collisionAreas[lastCollAreaIndex].funcEnter;
|
2005-04-05 15:07:40 +00:00
|
|
|
|
2006-01-03 23:14:39 +00:00
|
|
|
_vm->_inter->funcBlock(0);
|
|
|
|
_vm->_global->inter_execPtr = savedIP;
|
2005-04-05 15:07:40 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (handleMouse != 0)
|
2006-01-03 23:14:39 +00:00
|
|
|
_vm->_draw->animateCursor(-1);
|
2005-04-30 11:32:18 +00:00
|
|
|
|
2006-01-03 23:14:39 +00:00
|
|
|
_vm->_util->delay(10);
|
2005-08-10 15:48:50 +00:00
|
|
|
|
2006-01-03 23:14:39 +00:00
|
|
|
_vm->_snd->loopSounds();
|
2005-04-05 15:07:40 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2006-01-03 23:14:39 +00:00
|
|
|
int16 Game::inputArea(int16 xPos, int16 yPos, int16 width, int16 height, int16 backColor,
|
2005-04-05 15:07:40 +00:00
|
|
|
int16 frontColor, char *str, int16 fontIndex, char inpType, int16 *pTotTime) {
|
|
|
|
int16 handleMouse;
|
|
|
|
uint32 editSize;
|
2006-01-03 23:14:39 +00:00
|
|
|
Video::FontDesc *pFont;
|
2005-04-05 15:07:40 +00:00
|
|
|
char curSym;
|
|
|
|
int16 key;
|
|
|
|
const char *str1;
|
|
|
|
const char *str2;
|
|
|
|
int16 i;
|
|
|
|
uint32 pos;
|
|
|
|
int16 flag;
|
|
|
|
int16 savedKey;
|
|
|
|
|
2006-01-03 23:14:39 +00:00
|
|
|
if (ghandleMouse != 0 &&
|
|
|
|
(_vm->_global->useMouse != 0 || forceHandleMouse != 0))
|
2005-04-05 15:07:40 +00:00
|
|
|
handleMouse = 1;
|
|
|
|
else
|
|
|
|
handleMouse = 0;
|
|
|
|
|
|
|
|
pos = strlen(str);
|
2006-01-03 23:14:39 +00:00
|
|
|
pFont = _vm->_draw->fonts[fontIndex];
|
2005-04-05 15:07:40 +00:00
|
|
|
editSize = width / pFont->itemWidth;
|
|
|
|
|
|
|
|
while (1) {
|
2006-01-03 23:14:39 +00:00
|
|
|
strcpy(tempStr, str);
|
|
|
|
strcat(tempStr, " ");
|
|
|
|
if (strlen(tempStr) > editSize)
|
|
|
|
strcpy(tempStr, str);
|
|
|
|
|
|
|
|
_vm->_draw->destSpriteX = xPos;
|
|
|
|
_vm->_draw->destSpriteY = yPos;
|
|
|
|
_vm->_draw->spriteRight = editSize * pFont->itemWidth;
|
|
|
|
_vm->_draw->spriteBottom = height;
|
|
|
|
|
|
|
|
_vm->_draw->destSurface = 21;
|
|
|
|
_vm->_draw->backColor = backColor;
|
|
|
|
_vm->_draw->frontColor = frontColor;
|
|
|
|
_vm->_draw->textToPrint = tempStr;
|
|
|
|
_vm->_draw->transparency = 1;
|
|
|
|
_vm->_draw->fontIndex = fontIndex;
|
|
|
|
_vm->_draw->spriteOperation(DRAW_FILLRECT);
|
|
|
|
|
|
|
|
_vm->_draw->destSpriteY = yPos + (height - 8) / 2;
|
|
|
|
|
|
|
|
_vm->_draw->spriteOperation(DRAW_PRINTTEXT);
|
2005-04-05 15:07:40 +00:00
|
|
|
if (pos == editSize)
|
|
|
|
pos--;
|
|
|
|
|
2006-01-03 23:14:39 +00:00
|
|
|
curSym = tempStr[pos];
|
2005-04-05 15:07:40 +00:00
|
|
|
|
|
|
|
flag = 1;
|
|
|
|
|
|
|
|
while (1) {
|
2006-01-03 23:14:39 +00:00
|
|
|
tempStr[0] = curSym;
|
|
|
|
tempStr[1] = 0;
|
2005-04-05 15:07:40 +00:00
|
|
|
|
2006-01-03 23:14:39 +00:00
|
|
|
_vm->_draw->destSpriteX = xPos + pFont->itemWidth * pos;
|
|
|
|
_vm->_draw->destSpriteY = yPos + height - 1;
|
|
|
|
_vm->_draw->spriteRight = pFont->itemWidth;
|
|
|
|
_vm->_draw->spriteBottom = 1;
|
|
|
|
_vm->_draw->destSurface = 21;
|
|
|
|
_vm->_draw->backColor = frontColor;
|
|
|
|
_vm->_draw->spriteOperation(DRAW_FILLRECT);
|
2005-04-05 15:07:40 +00:00
|
|
|
|
|
|
|
if (flag != 0) {
|
2006-01-03 23:14:39 +00:00
|
|
|
key = checkCollisions(handleMouse, -1,
|
|
|
|
&activeCollResId,
|
|
|
|
&activeCollIndex);
|
2005-04-05 15:07:40 +00:00
|
|
|
}
|
|
|
|
flag = 0;
|
|
|
|
|
2006-01-03 23:14:39 +00:00
|
|
|
key = checkCollisions(handleMouse, -300,
|
|
|
|
&activeCollResId, &activeCollIndex);
|
2005-04-05 15:07:40 +00:00
|
|
|
|
|
|
|
if (*pTotTime > 0) {
|
|
|
|
*pTotTime -= 300;
|
|
|
|
if (*pTotTime <= 1) {
|
|
|
|
key = 0;
|
2006-01-03 23:14:39 +00:00
|
|
|
activeCollResId = 0;
|
2005-04-05 15:07:40 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2006-01-03 23:14:39 +00:00
|
|
|
tempStr[0] = curSym;
|
|
|
|
tempStr[1] = 0;
|
|
|
|
_vm->_draw->destSpriteX = xPos + pFont->itemWidth * pos;
|
|
|
|
_vm->_draw->destSpriteY = yPos + height - 1;
|
|
|
|
_vm->_draw->spriteRight = pFont->itemWidth;
|
|
|
|
_vm->_draw->spriteBottom = 1;
|
|
|
|
_vm->_draw->destSurface = 21;
|
|
|
|
_vm->_draw->backColor = backColor;
|
|
|
|
_vm->_draw->frontColor = frontColor;
|
|
|
|
_vm->_draw->textToPrint = tempStr;
|
|
|
|
_vm->_draw->transparency = 1;
|
|
|
|
_vm->_draw->spriteOperation(DRAW_FILLRECT);
|
|
|
|
|
|
|
|
_vm->_draw->destSpriteY = yPos + (height - 8) / 2;
|
|
|
|
_vm->_draw->spriteOperation(DRAW_PRINTTEXT);
|
|
|
|
|
|
|
|
if (key != 0 || activeCollResId != 0)
|
2005-04-05 15:07:40 +00:00
|
|
|
break;
|
|
|
|
|
2006-01-03 23:14:39 +00:00
|
|
|
key = checkCollisions(handleMouse, -300,
|
|
|
|
&activeCollResId, &activeCollIndex);
|
2005-04-05 15:07:40 +00:00
|
|
|
|
|
|
|
if (*pTotTime > 0) {
|
|
|
|
*pTotTime -= 300;
|
|
|
|
if (*pTotTime <= 1) {
|
|
|
|
key = 0;
|
2006-01-03 23:14:39 +00:00
|
|
|
activeCollResId = 0;
|
2005-04-05 15:07:40 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
2006-01-03 23:14:39 +00:00
|
|
|
if (key != 0 || activeCollResId != 0)
|
2005-04-05 15:07:40 +00:00
|
|
|
break;
|
|
|
|
|
2006-01-03 23:14:39 +00:00
|
|
|
if (_vm->_inter->terminate != 0)
|
2005-04-05 15:07:40 +00:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2006-01-03 23:14:39 +00:00
|
|
|
if (key == 0 || activeCollResId != 0
|
|
|
|
|| _vm->_inter->terminate != 0)
|
2005-04-05 15:07:40 +00:00
|
|
|
return 0;
|
|
|
|
|
|
|
|
switch (key) {
|
|
|
|
case 0x4d00: // Right Arrow
|
|
|
|
if (pos < strlen(str) && pos < editSize - 1) {
|
|
|
|
pos++;
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
return 0x5000;
|
|
|
|
|
|
|
|
case 0x4b00: // Left Arrow
|
|
|
|
if (pos > 0) {
|
|
|
|
pos--;
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
return 0x4800;
|
|
|
|
|
2005-07-30 21:11:48 +00:00
|
|
|
case 0xe08: // Backspace
|
2005-04-05 15:07:40 +00:00
|
|
|
if (pos > 0) {
|
2006-01-03 23:14:39 +00:00
|
|
|
_vm->_util->cutFromStr(str, pos - 1, 1);
|
2005-04-05 15:07:40 +00:00
|
|
|
pos--;
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
|
|
|
|
case 0x5300: // Del
|
|
|
|
|
|
|
|
if (pos >= strlen(str))
|
|
|
|
continue;
|
|
|
|
|
2006-01-03 23:14:39 +00:00
|
|
|
_vm->_util->cutFromStr(str, pos, 1);
|
2005-04-05 15:07:40 +00:00
|
|
|
continue;
|
|
|
|
|
|
|
|
case 0x1c0d: // Enter
|
|
|
|
case 0x3b00: // F1
|
|
|
|
case 0x3c00: // F2
|
|
|
|
case 0x3d00: // F3
|
|
|
|
case 0x3e00: // F4
|
2005-04-06 14:34:42 +00:00
|
|
|
case 0x3f00: // F5
|
2005-04-05 15:07:40 +00:00
|
|
|
case 0x4000: // F6
|
|
|
|
case 0x4100: // F7
|
|
|
|
case 0x4200: // F8
|
|
|
|
case 0x4300: // F9
|
|
|
|
case 0x4400: // F10
|
|
|
|
case 0x4800: // Up arrow
|
|
|
|
case 0x5000: // Down arrow
|
|
|
|
return key;
|
|
|
|
|
|
|
|
case 0x11b: // Escape
|
2006-01-03 23:14:39 +00:00
|
|
|
if (_vm->_global->useMouse != 0)
|
2005-04-05 15:07:40 +00:00
|
|
|
continue;
|
|
|
|
|
2006-01-03 23:14:39 +00:00
|
|
|
forceHandleMouse = !forceHandleMouse;
|
2005-04-05 15:07:40 +00:00
|
|
|
|
2006-01-03 23:14:39 +00:00
|
|
|
if (ghandleMouse != 0 &&
|
|
|
|
(_vm->_global->useMouse != 0 || forceHandleMouse != 0))
|
2005-04-05 15:07:40 +00:00
|
|
|
handleMouse = 1;
|
|
|
|
else
|
|
|
|
handleMouse = 0;
|
|
|
|
|
2006-01-03 23:14:39 +00:00
|
|
|
if (_vm->_global->pressedKeys[1] == 0)
|
2005-04-05 15:07:40 +00:00
|
|
|
continue;
|
|
|
|
|
2006-01-03 23:14:39 +00:00
|
|
|
while (_vm->_global->pressedKeys[1] != 0);
|
2005-04-05 15:07:40 +00:00
|
|
|
continue;
|
|
|
|
|
|
|
|
default:
|
|
|
|
|
|
|
|
savedKey = key;
|
|
|
|
key &= 0xff;
|
|
|
|
|
|
|
|
if ((inpType == 9 || inpType == 10) && key >= ' '
|
|
|
|
&& key <= 0xff) {
|
|
|
|
str1 = "0123456789-.,+ ";
|
|
|
|
str2 = "0123456789-,,+ ";
|
|
|
|
|
|
|
|
if ((savedKey >> 8) > 1
|
|
|
|
&& (savedKey >> 8) < 12)
|
|
|
|
key = ((savedKey >> 8) - 1) % 10 + '0';
|
|
|
|
|
|
|
|
for (i = 0; str1[i] != 0; i++) {
|
|
|
|
if (key == str1[i]) {
|
|
|
|
key = str2[i];
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (i == (int16)strlen(str1))
|
|
|
|
key = 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (key >= ' ' && key <= 0xff) {
|
|
|
|
if (editSize == strlen(str))
|
2006-01-03 23:14:39 +00:00
|
|
|
_vm->_util->cutFromStr(str, strlen(str) - 1,
|
2005-04-05 15:07:40 +00:00
|
|
|
1);
|
|
|
|
|
2005-04-13 20:53:36 +00:00
|
|
|
if (key >= 'a' && key <= 'z')
|
|
|
|
key += ('A' - 'a');
|
|
|
|
|
2005-04-05 15:07:40 +00:00
|
|
|
pos++;
|
2006-01-03 23:14:39 +00:00
|
|
|
tempStr[0] = key;
|
|
|
|
tempStr[1] = 0;
|
2005-04-05 15:07:40 +00:00
|
|
|
|
2006-01-03 23:14:39 +00:00
|
|
|
_vm->_util->insertStr(tempStr, str, pos - 1);
|
2005-04-13 20:53:36 +00:00
|
|
|
|
2005-04-05 15:07:40 +00:00
|
|
|
//strupr(str);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2006-01-03 23:14:39 +00:00
|
|
|
int16 Game::multiEdit(int16 time, int16 index, int16 *pCurPos, InputDesc * inpDesc) {
|
|
|
|
Collision *collArea;
|
2005-04-05 15:07:40 +00:00
|
|
|
int16 descInd;
|
|
|
|
int16 key;
|
|
|
|
int16 found = -1;
|
|
|
|
int16 i;
|
|
|
|
|
|
|
|
descInd = 0;
|
|
|
|
for (i = 0; i < 250; i++) {
|
2006-01-03 23:14:39 +00:00
|
|
|
collArea = &collisionAreas[i];
|
2005-04-05 15:07:40 +00:00
|
|
|
|
|
|
|
if (collArea->left == -1)
|
|
|
|
continue;
|
|
|
|
|
|
|
|
if ((collArea->id & 0x8000) == 0)
|
|
|
|
continue;
|
|
|
|
|
|
|
|
if ((collArea->flags & 0x0f) < 3)
|
|
|
|
continue;
|
|
|
|
|
|
|
|
if ((collArea->flags & 0x0f) > 10)
|
|
|
|
continue;
|
|
|
|
|
2006-01-03 23:14:39 +00:00
|
|
|
strcpy(tempStr, _vm->_global->inter_variables + collArea->key);
|
2005-04-05 15:07:40 +00:00
|
|
|
|
2006-01-03 23:14:39 +00:00
|
|
|
_vm->_draw->destSpriteX = collArea->left;
|
|
|
|
_vm->_draw->destSpriteY = collArea->top;
|
|
|
|
_vm->_draw->spriteRight = collArea->right - collArea->left + 1;
|
|
|
|
_vm->_draw->spriteBottom = collArea->bottom - collArea->top + 1;
|
2005-04-05 15:07:40 +00:00
|
|
|
|
2006-01-03 23:14:39 +00:00
|
|
|
_vm->_draw->destSurface = 21;
|
2005-04-05 15:07:40 +00:00
|
|
|
|
2006-01-03 23:14:39 +00:00
|
|
|
_vm->_draw->backColor = inpDesc[descInd].backColor;
|
|
|
|
_vm->_draw->frontColor = inpDesc[descInd].frontColor;
|
|
|
|
_vm->_draw->textToPrint = tempStr;
|
|
|
|
_vm->_draw->transparency = 1;
|
|
|
|
_vm->_draw->fontIndex = inpDesc[descInd].fontIndex;
|
|
|
|
_vm->_draw->spriteOperation(DRAW_FILLRECT);
|
|
|
|
_vm->_draw->destSpriteY +=
|
2005-04-05 15:07:40 +00:00
|
|
|
((collArea->bottom - collArea->top + 1) - 8) / 2;
|
|
|
|
|
2006-01-03 23:14:39 +00:00
|
|
|
_vm->_draw->spriteOperation(DRAW_PRINTTEXT);
|
2005-04-05 15:07:40 +00:00
|
|
|
descInd++;
|
|
|
|
}
|
|
|
|
|
|
|
|
for (i = 0; i < 40; i++) {
|
2005-04-10 17:13:17 +00:00
|
|
|
WRITE_VAR_OFFSET(i * 4 + 0x44, 0);
|
2005-04-05 15:07:40 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
while (1) {
|
|
|
|
descInd = 0;
|
|
|
|
|
|
|
|
for (i = 0; i < 250; i++) {
|
2006-01-03 23:14:39 +00:00
|
|
|
collArea = &collisionAreas[i];
|
2005-04-05 15:07:40 +00:00
|
|
|
|
|
|
|
if (collArea->left == -1)
|
|
|
|
continue;
|
|
|
|
|
|
|
|
if ((collArea->id & 0x8000) == 0)
|
|
|
|
continue;
|
|
|
|
|
|
|
|
if ((collArea->flags & 0x0f) < 3)
|
|
|
|
continue;
|
|
|
|
|
|
|
|
if ((collArea->flags & 0x0f) > 10)
|
|
|
|
continue;
|
|
|
|
|
|
|
|
if (descInd == *pCurPos) {
|
|
|
|
found = i;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
descInd++;
|
|
|
|
}
|
|
|
|
|
|
|
|
assert(found != -1);
|
|
|
|
|
2006-01-03 23:14:39 +00:00
|
|
|
collArea = &collisionAreas[found];
|
2005-04-05 15:07:40 +00:00
|
|
|
|
2006-01-03 23:14:39 +00:00
|
|
|
key = inputArea(collArea->left, collArea->top,
|
2005-04-05 15:07:40 +00:00
|
|
|
collArea->right - collArea->left + 1,
|
|
|
|
collArea->bottom - collArea->top + 1,
|
|
|
|
inpDesc[*pCurPos].backColor, inpDesc[*pCurPos].frontColor,
|
2006-01-03 23:14:39 +00:00
|
|
|
_vm->_global->inter_variables + collArea->key,
|
2005-04-05 15:07:40 +00:00
|
|
|
inpDesc[*pCurPos].fontIndex, collArea->flags, &time);
|
|
|
|
|
2006-01-03 23:14:39 +00:00
|
|
|
if (_vm->_inter->terminate != 0)
|
2005-04-05 15:07:40 +00:00
|
|
|
return 0;
|
|
|
|
|
|
|
|
switch (key) {
|
|
|
|
case 0:
|
2006-01-03 23:14:39 +00:00
|
|
|
if (activeCollResId == 0)
|
2005-04-05 15:07:40 +00:00
|
|
|
return 0;
|
|
|
|
|
2006-01-03 23:14:39 +00:00
|
|
|
if ((collisionAreas[activeCollIndex].
|
2005-04-05 15:07:40 +00:00
|
|
|
flags & 0x0f) < 3)
|
|
|
|
return 0;
|
|
|
|
|
2006-01-03 23:14:39 +00:00
|
|
|
if ((collisionAreas[activeCollIndex].
|
2005-04-05 15:07:40 +00:00
|
|
|
flags & 0x0f) > 10)
|
|
|
|
return 0;
|
|
|
|
|
|
|
|
*pCurPos = 0;
|
|
|
|
for (i = 0; i < 250; i++) {
|
2006-01-03 23:14:39 +00:00
|
|
|
collArea = &collisionAreas[i];
|
2005-04-05 15:07:40 +00:00
|
|
|
|
|
|
|
if (collArea->left == -1)
|
|
|
|
continue;
|
|
|
|
|
|
|
|
if ((collArea->id & 0x8000) == 0)
|
|
|
|
continue;
|
|
|
|
|
|
|
|
if ((collArea->flags & 0x0f) < 3)
|
|
|
|
continue;
|
|
|
|
|
|
|
|
if ((collArea->flags & 0x0f) > 10)
|
|
|
|
continue;
|
|
|
|
|
2006-01-03 23:14:39 +00:00
|
|
|
if (i == activeCollIndex)
|
2005-04-05 15:07:40 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
pCurPos[0]++;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
|
|
|
case 0x3b00:
|
|
|
|
case 0x3c00:
|
|
|
|
case 0x3d00:
|
|
|
|
case 0x3e00:
|
|
|
|
case 0x3f00:
|
|
|
|
case 0x4000:
|
|
|
|
case 0x4100:
|
|
|
|
case 0x4200:
|
|
|
|
case 0x4300:
|
|
|
|
case 0x4400:
|
|
|
|
return key;
|
|
|
|
|
|
|
|
case 0x1c0d:
|
|
|
|
|
|
|
|
if (index == 1)
|
|
|
|
return key;
|
|
|
|
|
|
|
|
if (*pCurPos == index - 1) {
|
|
|
|
*pCurPos = 0;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
pCurPos[0]++;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case 0x5000:
|
|
|
|
if (index - 1 > *pCurPos)
|
|
|
|
pCurPos[0]++;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case 0x4800:
|
|
|
|
if (*pCurPos > 0)
|
|
|
|
pCurPos[0]--;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2006-01-03 23:14:39 +00:00
|
|
|
int16 Game::adjustKey(int16 key) {
|
2005-04-05 15:07:40 +00:00
|
|
|
if (key <= 0x60 || key >= 0x7b)
|
|
|
|
return key;
|
|
|
|
|
|
|
|
return key - 0x20;
|
|
|
|
}
|
|
|
|
|
2006-01-03 23:14:39 +00:00
|
|
|
void Game::collisionsBlock(void) {
|
|
|
|
InputDesc descArray[20];
|
2005-04-05 15:07:40 +00:00
|
|
|
int16 array[250];
|
|
|
|
char count;
|
|
|
|
int16 collResId;
|
|
|
|
char *startIP;
|
|
|
|
int16 curCmd;
|
|
|
|
int16 cmd;
|
|
|
|
int16 cmdHigh;
|
|
|
|
int16 key;
|
|
|
|
int16 flags;
|
|
|
|
int16 left;
|
|
|
|
int16 top;
|
|
|
|
int16 width;
|
|
|
|
int16 height;
|
|
|
|
int16 var_22;
|
|
|
|
int16 index;
|
|
|
|
int16 curEditIndex;
|
|
|
|
int16 deltaTime;
|
|
|
|
int16 descIndex2;
|
|
|
|
int16 stackPos2;
|
|
|
|
int16 descIndex;
|
|
|
|
int16 timeVal;
|
|
|
|
char *str;
|
|
|
|
int16 pos;
|
|
|
|
int16 savedCollStackSize;
|
|
|
|
int16 i;
|
|
|
|
int16 counter;
|
|
|
|
int16 var_24;
|
|
|
|
int16 var_26;
|
|
|
|
int16 collStackPos;
|
2006-01-03 23:14:39 +00:00
|
|
|
Collision *collPtr;
|
2005-04-05 15:07:40 +00:00
|
|
|
int16 timeKey;
|
|
|
|
char *savedIP;
|
|
|
|
|
2006-01-03 23:14:39 +00:00
|
|
|
if (shouldPushColls)
|
|
|
|
pushCollisions(1);
|
2005-04-05 15:07:40 +00:00
|
|
|
|
|
|
|
collResId = -1;
|
2006-01-03 23:14:39 +00:00
|
|
|
_vm->_global->inter_execPtr++;
|
|
|
|
count = *_vm->_global->inter_execPtr++;
|
|
|
|
ghandleMouse = _vm->_global->inter_execPtr[0];
|
|
|
|
deltaTime = 1000 * (byte)_vm->_global->inter_execPtr[1];
|
|
|
|
descIndex2 = (byte)_vm->_global->inter_execPtr[2];
|
|
|
|
stackPos2 = (byte)_vm->_global->inter_execPtr[3];
|
|
|
|
descIndex = (byte)_vm->_global->inter_execPtr[4];
|
2005-04-05 15:07:40 +00:00
|
|
|
|
|
|
|
if (stackPos2 != 0 || descIndex != 0)
|
|
|
|
deltaTime /= 100;
|
|
|
|
|
|
|
|
timeVal = deltaTime;
|
2006-01-03 23:14:39 +00:00
|
|
|
_vm->_global->inter_execPtr += 6;
|
2005-04-05 15:07:40 +00:00
|
|
|
|
2006-01-03 23:14:39 +00:00
|
|
|
startIP = _vm->_global->inter_execPtr;
|
2005-04-10 17:13:17 +00:00
|
|
|
WRITE_VAR(16, 0);
|
2005-04-05 15:07:40 +00:00
|
|
|
var_22 = 0;
|
|
|
|
index = 0;
|
|
|
|
curEditIndex = 0;
|
|
|
|
|
|
|
|
for (curCmd = 0; curCmd < count; curCmd++) {
|
|
|
|
array[curCmd] = 0;
|
2006-01-03 23:14:39 +00:00
|
|
|
cmd = *_vm->_global->inter_execPtr++;
|
2005-04-05 15:07:40 +00:00
|
|
|
|
|
|
|
if ((cmd & 0x40) != 0) {
|
|
|
|
cmd -= 0x40;
|
2006-01-03 23:14:39 +00:00
|
|
|
cmdHigh = (byte)*_vm->_global->inter_execPtr;
|
|
|
|
_vm->_global->inter_execPtr++;
|
2005-04-05 15:07:40 +00:00
|
|
|
cmdHigh <<= 8;
|
|
|
|
} else {
|
|
|
|
cmdHigh = 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
if ((cmd & 0x80) != 0) {
|
2006-01-03 23:14:39 +00:00
|
|
|
left = _vm->_parse->parseValExpr();
|
|
|
|
top = _vm->_parse->parseValExpr();
|
|
|
|
width = _vm->_parse->parseValExpr();
|
|
|
|
height = _vm->_parse->parseValExpr();
|
2005-04-05 15:07:40 +00:00
|
|
|
} else {
|
2006-01-03 23:14:39 +00:00
|
|
|
left = _vm->_inter->load16();
|
|
|
|
top = _vm->_inter->load16();
|
|
|
|
width = _vm->_inter->load16();
|
|
|
|
height = _vm->_inter->load16();
|
2005-04-05 15:07:40 +00:00
|
|
|
}
|
|
|
|
cmd &= 0x7f;
|
|
|
|
|
2006-01-03 23:14:39 +00:00
|
|
|
debug(4, "collisionsBlock(%d)", cmd);
|
2005-07-19 09:10:05 +00:00
|
|
|
|
2005-04-05 15:07:40 +00:00
|
|
|
switch (cmd) {
|
|
|
|
case 3:
|
|
|
|
case 4:
|
|
|
|
case 5:
|
|
|
|
case 6:
|
|
|
|
case 7:
|
|
|
|
case 8:
|
|
|
|
case 9:
|
|
|
|
case 10:
|
|
|
|
|
2006-01-03 23:14:39 +00:00
|
|
|
_vm->_util->waitKey();
|
2005-04-05 15:07:40 +00:00
|
|
|
var_22 = 1;
|
2006-01-03 23:14:39 +00:00
|
|
|
key = _vm->_parse->parseVarIndex();
|
|
|
|
descArray[index].fontIndex = _vm->_inter->load16();
|
|
|
|
descArray[index].backColor = *_vm->_global->inter_execPtr++;
|
|
|
|
descArray[index].frontColor = *_vm->_global->inter_execPtr++;
|
2005-04-05 15:07:40 +00:00
|
|
|
|
|
|
|
if (cmd < 5 || cmd > 8) {
|
|
|
|
descArray[index].ptr = 0;
|
|
|
|
} else {
|
2006-01-03 23:14:39 +00:00
|
|
|
descArray[index].ptr = _vm->_global->inter_execPtr + 2;
|
|
|
|
_vm->_global->inter_execPtr += _vm->_inter->load16();
|
2005-04-05 15:07:40 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
if (left == -1)
|
|
|
|
break;
|
|
|
|
|
|
|
|
if ((cmd & 1) == 0) {
|
2006-01-03 23:14:39 +00:00
|
|
|
addNewCollision(curCmd + 0x8000, left,
|
2005-04-05 15:07:40 +00:00
|
|
|
top,
|
|
|
|
left +
|
|
|
|
width *
|
2006-01-03 23:14:39 +00:00
|
|
|
_vm->_draw->fonts[descArray[index].fontIndex]->
|
2005-04-05 15:07:40 +00:00
|
|
|
itemWidth - 1, top + height - 1, cmd, key,
|
|
|
|
0,
|
2006-01-03 23:14:39 +00:00
|
|
|
_vm->_global->inter_execPtr - (char *)totFileData);
|
2005-04-05 15:07:40 +00:00
|
|
|
|
2006-01-03 23:14:39 +00:00
|
|
|
_vm->_global->inter_execPtr += 2;
|
|
|
|
_vm->_global->inter_execPtr += READ_LE_UINT16(_vm->_global->inter_execPtr);
|
2005-04-05 15:07:40 +00:00
|
|
|
} else {
|
2006-01-03 23:14:39 +00:00
|
|
|
addNewCollision(curCmd + 0x8000, left,
|
2005-04-05 15:07:40 +00:00
|
|
|
top,
|
|
|
|
left +
|
|
|
|
width *
|
2006-01-03 23:14:39 +00:00
|
|
|
_vm->_draw->fonts[descArray[index].fontIndex]->
|
2005-04-05 15:07:40 +00:00
|
|
|
itemWidth - 1, top + height - 1, cmd, key,
|
|
|
|
0, 0);
|
|
|
|
}
|
|
|
|
index++;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case 21:
|
2006-01-03 23:14:39 +00:00
|
|
|
key = _vm->_inter->load16();
|
|
|
|
array[curCmd] = _vm->_inter->load16();
|
|
|
|
flags = _vm->_inter->load16() & 3;
|
2005-04-05 15:07:40 +00:00
|
|
|
|
2006-01-03 23:14:39 +00:00
|
|
|
addNewCollision(curCmd + 0x8000, left, top,
|
2005-04-05 15:07:40 +00:00
|
|
|
left + width - 1,
|
|
|
|
top + height - 1,
|
|
|
|
(flags << 4) + cmdHigh + 2, key,
|
2006-01-03 23:14:39 +00:00
|
|
|
_vm->_global->inter_execPtr - (char *)totFileData, 0);
|
2005-04-05 15:07:40 +00:00
|
|
|
|
2006-01-03 23:14:39 +00:00
|
|
|
_vm->_global->inter_execPtr += 2;
|
|
|
|
_vm->_global->inter_execPtr += READ_LE_UINT16(_vm->_global->inter_execPtr);
|
2005-04-05 15:07:40 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case 20:
|
|
|
|
collResId = curCmd;
|
2005-08-10 15:48:50 +00:00
|
|
|
// Fall through to case 2
|
2005-04-05 15:07:40 +00:00
|
|
|
|
|
|
|
case 2:
|
2006-01-03 23:14:39 +00:00
|
|
|
key = _vm->_inter->load16();
|
|
|
|
array[curCmd] = _vm->_inter->load16();
|
|
|
|
flags = _vm->_inter->load16() & 3;
|
2005-04-05 15:07:40 +00:00
|
|
|
|
2006-01-03 23:14:39 +00:00
|
|
|
addNewCollision(curCmd + 0x8000, left, top,
|
2005-04-05 15:07:40 +00:00
|
|
|
left + width - 1,
|
|
|
|
top + height - 1,
|
|
|
|
(flags << 4) + cmdHigh + 2, key, 0,
|
2006-01-03 23:14:39 +00:00
|
|
|
_vm->_global->inter_execPtr - (char *)totFileData);
|
2005-04-05 15:07:40 +00:00
|
|
|
|
2006-01-03 23:14:39 +00:00
|
|
|
_vm->_global->inter_execPtr += 2;
|
|
|
|
_vm->_global->inter_execPtr += READ_LE_UINT16(_vm->_global->inter_execPtr);
|
2005-04-05 15:07:40 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case 0:
|
2006-01-03 23:14:39 +00:00
|
|
|
_vm->_global->inter_execPtr += 6;
|
|
|
|
startIP = _vm->_global->inter_execPtr;
|
|
|
|
_vm->_global->inter_execPtr += 2;
|
|
|
|
_vm->_global->inter_execPtr += READ_LE_UINT16(_vm->_global->inter_execPtr);
|
2005-04-05 15:07:40 +00:00
|
|
|
key = curCmd + 0xA000;
|
|
|
|
|
2006-01-03 23:14:39 +00:00
|
|
|
addNewCollision(curCmd + 0x8000, left, top,
|
2005-04-05 15:07:40 +00:00
|
|
|
left + width - 1,
|
|
|
|
top + height - 1,
|
|
|
|
cmd + cmdHigh, key,
|
2006-01-03 23:14:39 +00:00
|
|
|
startIP - (char *)totFileData,
|
|
|
|
_vm->_global->inter_execPtr - (char *)totFileData);
|
2005-04-05 15:07:40 +00:00
|
|
|
|
2006-01-03 23:14:39 +00:00
|
|
|
_vm->_global->inter_execPtr += 2;
|
|
|
|
_vm->_global->inter_execPtr += READ_LE_UINT16(_vm->_global->inter_execPtr);
|
2005-04-05 15:07:40 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case 1:
|
2006-01-03 23:14:39 +00:00
|
|
|
key = _vm->_inter->load16();
|
|
|
|
array[curCmd] = _vm->_inter->load16();
|
|
|
|
flags = _vm->_inter->load16() & 3;
|
2005-04-05 15:07:40 +00:00
|
|
|
|
2006-01-03 23:14:39 +00:00
|
|
|
startIP = _vm->_global->inter_execPtr;
|
|
|
|
_vm->_global->inter_execPtr += 2;
|
|
|
|
_vm->_global->inter_execPtr += READ_LE_UINT16(_vm->_global->inter_execPtr);
|
2005-04-05 15:07:40 +00:00
|
|
|
if (key == 0)
|
|
|
|
key = curCmd + 0xa000;
|
|
|
|
|
2006-01-03 23:14:39 +00:00
|
|
|
addNewCollision(curCmd + 0x8000, left, top,
|
2005-04-05 15:07:40 +00:00
|
|
|
left + width - 1,
|
|
|
|
top + height - 1,
|
|
|
|
(flags << 4) + cmd + cmdHigh, key,
|
2006-01-03 23:14:39 +00:00
|
|
|
startIP - (char *)totFileData,
|
|
|
|
_vm->_global->inter_execPtr - (char *)totFileData);
|
2005-04-05 15:07:40 +00:00
|
|
|
|
2006-01-03 23:14:39 +00:00
|
|
|
_vm->_global->inter_execPtr += 2;
|
|
|
|
_vm->_global->inter_execPtr += READ_LE_UINT16(_vm->_global->inter_execPtr);
|
2005-04-05 15:07:40 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2006-01-03 23:14:39 +00:00
|
|
|
forceHandleMouse = 0;
|
|
|
|
_vm->_util->waitKey();
|
2005-04-05 15:07:40 +00:00
|
|
|
|
|
|
|
do {
|
|
|
|
if (var_22 != 0) {
|
|
|
|
key =
|
2006-01-03 23:14:39 +00:00
|
|
|
multiEdit(deltaTime, index, &curEditIndex,
|
2005-04-05 15:07:40 +00:00
|
|
|
descArray);
|
|
|
|
|
|
|
|
if (key == 0x1c0d) {
|
|
|
|
for (i = 0; i < 250; i++) {
|
2006-01-03 23:14:39 +00:00
|
|
|
if (collisionAreas[i].left == -1)
|
2005-04-05 15:07:40 +00:00
|
|
|
continue;
|
|
|
|
|
2006-01-03 23:14:39 +00:00
|
|
|
if ((collisionAreas[i].id & 0x8000) == 0)
|
2005-04-05 15:07:40 +00:00
|
|
|
continue;
|
|
|
|
|
2006-01-03 23:14:39 +00:00
|
|
|
if ((collisionAreas[i].flags & 1) != 0)
|
2005-04-05 15:07:40 +00:00
|
|
|
continue;
|
|
|
|
|
2006-01-03 23:14:39 +00:00
|
|
|
if ((collisionAreas[i].flags & 0x0f) <= 2)
|
2005-04-05 15:07:40 +00:00
|
|
|
continue;
|
|
|
|
|
2006-01-03 23:14:39 +00:00
|
|
|
collResId = collisionAreas[i].id;
|
|
|
|
activeCollResId = collResId;
|
2005-04-05 15:07:40 +00:00
|
|
|
collResId &= 0x7fff;
|
2006-01-03 23:14:39 +00:00
|
|
|
activeCollIndex = i;
|
2005-04-05 15:07:40 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
key =
|
2006-01-03 23:14:39 +00:00
|
|
|
checkCollisions(ghandleMouse, -deltaTime,
|
|
|
|
&activeCollResId, &activeCollIndex);
|
2005-04-05 15:07:40 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
if ((key & 0xff) >= ' ' && (key & 0xff) <= 0xff &&
|
|
|
|
(key >> 8) > 1 && (key >> 8) < 12) {
|
|
|
|
key = '0' + (((key >> 8) - 1) % 10) + (key & 0xff00);
|
|
|
|
}
|
|
|
|
|
2006-01-03 23:14:39 +00:00
|
|
|
if (activeCollResId == 0) {
|
2005-04-05 15:07:40 +00:00
|
|
|
if (key != 0) {
|
|
|
|
for (i = 0; i < 250; i++) {
|
2006-01-03 23:14:39 +00:00
|
|
|
if (collisionAreas[i].left == -1)
|
2005-04-05 15:07:40 +00:00
|
|
|
continue;
|
|
|
|
|
2006-01-03 23:14:39 +00:00
|
|
|
if ((collisionAreas[i].
|
2005-04-05 15:07:40 +00:00
|
|
|
id & 0x8000) == 0)
|
|
|
|
continue;
|
|
|
|
|
2006-01-03 23:14:39 +00:00
|
|
|
if (collisionAreas[i].key == key
|
|
|
|
|| collisionAreas[i].key ==
|
2005-04-05 15:07:40 +00:00
|
|
|
0x7fff) {
|
|
|
|
|
2006-01-03 23:14:39 +00:00
|
|
|
activeCollResId =
|
|
|
|
collisionAreas[i].id;
|
|
|
|
activeCollIndex = i;
|
2005-04-05 15:07:40 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2006-01-03 23:14:39 +00:00
|
|
|
if (activeCollResId == 0) {
|
2005-04-05 15:07:40 +00:00
|
|
|
for (i = 0; i < 250; i++) {
|
2006-01-03 23:14:39 +00:00
|
|
|
if (collisionAreas[i].left == -1)
|
2005-04-05 15:07:40 +00:00
|
|
|
continue;
|
|
|
|
|
2006-01-03 23:14:39 +00:00
|
|
|
if ((collisionAreas[i].id & 0x8000) == 0)
|
2005-04-05 15:07:40 +00:00
|
|
|
continue;
|
|
|
|
|
2006-01-03 23:14:39 +00:00
|
|
|
if ((collisionAreas[i].key & 0xff00) != 0)
|
2005-04-05 15:07:40 +00:00
|
|
|
continue;
|
|
|
|
|
2006-01-03 23:14:39 +00:00
|
|
|
if (collisionAreas[i].key == 0)
|
2005-04-05 15:07:40 +00:00
|
|
|
continue;
|
|
|
|
|
2006-01-03 23:14:39 +00:00
|
|
|
if (adjustKey(key & 0xff) == adjustKey(collisionAreas[i].key) || collisionAreas[i].key == 0x7fff) {
|
|
|
|
activeCollResId = collisionAreas[i].id;
|
|
|
|
activeCollIndex = i;
|
2005-04-05 15:07:40 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
|
2005-04-10 17:13:17 +00:00
|
|
|
if (deltaTime != 0 && VAR(16) == 0) {
|
2005-04-05 15:07:40 +00:00
|
|
|
if (stackPos2 != 0) {
|
|
|
|
collStackPos = 0;
|
2006-01-03 23:14:39 +00:00
|
|
|
collPtr = collisionAreas;
|
2005-04-05 15:07:40 +00:00
|
|
|
|
2006-01-03 23:14:39 +00:00
|
|
|
for (i = 0, collPtr = collisionAreas; collPtr->left != -1; i++, collPtr++) {
|
2005-04-05 15:07:40 +00:00
|
|
|
if ((collPtr->id & 0x8000) == 0)
|
|
|
|
continue;
|
|
|
|
|
|
|
|
collStackPos++;
|
|
|
|
if (collStackPos != stackPos2)
|
|
|
|
continue;
|
|
|
|
|
2006-01-03 23:14:39 +00:00
|
|
|
activeCollResId = collPtr->id;
|
|
|
|
activeCollIndex = i;
|
|
|
|
WRITE_VAR(2, _vm->_global->inter_mouseX);
|
|
|
|
WRITE_VAR(3, _vm->_global->inter_mouseY);
|
|
|
|
WRITE_VAR(4, mouseButtons);
|
|
|
|
WRITE_VAR(16, array[(uint16)activeCollResId & ~0x8000]);
|
2005-04-05 15:07:40 +00:00
|
|
|
|
|
|
|
if (collPtr->funcLeave != 0) {
|
2006-01-03 23:14:39 +00:00
|
|
|
timeKey = _vm->_util->getTimeKey();
|
|
|
|
savedIP = _vm->_global->inter_execPtr;
|
|
|
|
_vm->_global->inter_execPtr = (char *)totFileData + collPtr->funcLeave;
|
|
|
|
shouldPushColls = 1;
|
|
|
|
savedCollStackSize = collStackSize;
|
|
|
|
_vm->_inter->funcBlock(0);
|
2005-04-05 15:07:40 +00:00
|
|
|
|
2006-01-03 23:14:39 +00:00
|
|
|
if (savedCollStackSize != collStackSize)
|
|
|
|
popCollisions();
|
2005-04-05 15:07:40 +00:00
|
|
|
|
2006-01-03 23:14:39 +00:00
|
|
|
shouldPushColls = 0;
|
|
|
|
_vm->_global->inter_execPtr = savedIP;
|
|
|
|
deltaTime = timeVal - (_vm->_util->getTimeKey() - timeKey);
|
2005-04-05 15:07:40 +00:00
|
|
|
|
|
|
|
if (deltaTime < 2)
|
|
|
|
deltaTime = 2;
|
|
|
|
}
|
|
|
|
|
2005-04-10 17:13:17 +00:00
|
|
|
if (VAR(16) == 0)
|
2006-01-03 23:14:39 +00:00
|
|
|
activeCollResId = 0;
|
2005-04-05 15:07:40 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
if (descIndex != 0) {
|
|
|
|
counter = 0;
|
|
|
|
for (i = 0; i < 250; i++) {
|
2006-01-03 23:14:39 +00:00
|
|
|
if (collisionAreas[i].left == -1)
|
2005-04-05 15:07:40 +00:00
|
|
|
continue;
|
|
|
|
|
2006-01-03 23:14:39 +00:00
|
|
|
if ((collisionAreas[i].id & 0x8000) == 0)
|
2005-04-05 15:07:40 +00:00
|
|
|
continue;
|
|
|
|
|
|
|
|
counter++;
|
|
|
|
if (counter != descIndex)
|
|
|
|
continue;
|
|
|
|
|
2006-01-03 23:14:39 +00:00
|
|
|
activeCollResId = collisionAreas[i].id;
|
|
|
|
activeCollIndex = i;
|
2005-04-05 15:07:40 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
for (i = 0; i < 250; i++) {
|
2006-01-03 23:14:39 +00:00
|
|
|
if (collisionAreas[i].left == -1)
|
2005-04-05 15:07:40 +00:00
|
|
|
continue;
|
|
|
|
|
2006-01-03 23:14:39 +00:00
|
|
|
if ((collisionAreas[i].id & 0x8000) == 0)
|
2005-04-05 15:07:40 +00:00
|
|
|
continue;
|
|
|
|
|
2006-01-03 23:14:39 +00:00
|
|
|
activeCollResId = collisionAreas[i].id;
|
|
|
|
activeCollIndex = i;
|
2005-04-05 15:07:40 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
if (descIndex2 != 0) {
|
|
|
|
counter = 0;
|
|
|
|
for (i = 0; i < 250; i++) {
|
2006-01-03 23:14:39 +00:00
|
|
|
if (collisionAreas[i].left == -1)
|
2005-04-05 15:07:40 +00:00
|
|
|
continue;
|
|
|
|
|
2006-01-03 23:14:39 +00:00
|
|
|
if ((collisionAreas[i].id & 0x8000) == 0)
|
2005-04-05 15:07:40 +00:00
|
|
|
continue;
|
|
|
|
|
|
|
|
counter++;
|
|
|
|
if (counter != descIndex2)
|
|
|
|
continue;
|
|
|
|
|
2006-01-03 23:14:39 +00:00
|
|
|
activeCollResId = collisionAreas[i].id;
|
|
|
|
activeCollIndex = i;
|
2005-04-05 15:07:40 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2006-01-03 23:14:39 +00:00
|
|
|
if (activeCollResId == 0)
|
2005-04-05 15:07:40 +00:00
|
|
|
continue;
|
|
|
|
|
2006-01-03 23:14:39 +00:00
|
|
|
if (collisionAreas[activeCollIndex].funcLeave != 0)
|
2005-04-05 15:07:40 +00:00
|
|
|
continue;
|
|
|
|
|
2006-01-03 23:14:39 +00:00
|
|
|
WRITE_VAR(2, _vm->_global->inter_mouseX);
|
|
|
|
WRITE_VAR(3, _vm->_global->inter_mouseY);
|
|
|
|
WRITE_VAR(4, mouseButtons);
|
|
|
|
WRITE_VAR(16, array[(uint16)activeCollResId & ~0x8000]);
|
2005-04-05 15:07:40 +00:00
|
|
|
|
2006-01-03 23:14:39 +00:00
|
|
|
if (collisionAreas[activeCollIndex].funcEnter != 0) {
|
|
|
|
savedIP = _vm->_global->inter_execPtr;
|
|
|
|
_vm->_global->inter_execPtr = (char *)totFileData +
|
|
|
|
collisionAreas[activeCollIndex].
|
2005-04-05 15:07:40 +00:00
|
|
|
funcEnter;
|
|
|
|
|
2006-01-03 23:14:39 +00:00
|
|
|
shouldPushColls = 1;
|
2005-04-05 15:07:40 +00:00
|
|
|
|
2006-01-03 23:14:39 +00:00
|
|
|
collStackPos = collStackSize;
|
|
|
|
_vm->_inter->funcBlock(0);
|
|
|
|
if (collStackPos != collStackSize)
|
|
|
|
popCollisions();
|
|
|
|
shouldPushColls = 0;
|
|
|
|
_vm->_global->inter_execPtr = savedIP;
|
2005-04-05 15:07:40 +00:00
|
|
|
}
|
|
|
|
|
2005-04-10 17:13:17 +00:00
|
|
|
WRITE_VAR(16, 0);
|
2006-01-03 23:14:39 +00:00
|
|
|
activeCollResId = 0;
|
2005-04-05 15:07:40 +00:00
|
|
|
}
|
2006-01-03 23:14:39 +00:00
|
|
|
while (activeCollResId == 0 && _vm->_inter->terminate == 0);
|
2005-04-05 15:07:40 +00:00
|
|
|
|
2006-01-03 23:14:39 +00:00
|
|
|
if (((uint16)activeCollResId & ~0x8000) == collResId) {
|
2005-04-05 15:07:40 +00:00
|
|
|
collStackPos = 0;
|
|
|
|
var_24 = 0;
|
|
|
|
var_26 = 1;
|
|
|
|
for (i = 0; i < 250; i++) {
|
2006-01-03 23:14:39 +00:00
|
|
|
if (collisionAreas[i].left == -1)
|
2005-04-05 15:07:40 +00:00
|
|
|
continue;
|
|
|
|
|
2006-01-03 23:14:39 +00:00
|
|
|
if ((collisionAreas[i].id & 0x8000) == 0)
|
2005-04-05 15:07:40 +00:00
|
|
|
continue;
|
|
|
|
|
2006-01-03 23:14:39 +00:00
|
|
|
if ((collisionAreas[i].flags & 0x0f) < 3)
|
2005-04-05 15:07:40 +00:00
|
|
|
continue;
|
|
|
|
|
2006-01-03 23:14:39 +00:00
|
|
|
if ((collisionAreas[i].flags & 0x0f) > 10)
|
2005-04-05 15:07:40 +00:00
|
|
|
continue;
|
|
|
|
|
2006-01-03 23:14:39 +00:00
|
|
|
if ((collisionAreas[i].flags & 0x0f) > 8) {
|
|
|
|
strcpy(tempStr,
|
|
|
|
_vm->_global->inter_variables + collisionAreas[i].key);
|
2005-04-05 15:07:40 +00:00
|
|
|
while ((pos =
|
2006-01-03 23:14:39 +00:00
|
|
|
_vm->_util->strstr(" ", tempStr)) != 0) {
|
|
|
|
_vm->_util->cutFromStr(tempStr, pos - 1, 1);
|
|
|
|
pos = _vm->_util->strstr(" ", tempStr);
|
2005-04-05 15:07:40 +00:00
|
|
|
}
|
2006-01-03 23:14:39 +00:00
|
|
|
strcpy(_vm->_global->inter_variables + collisionAreas[i].key, tempStr);
|
2005-04-05 15:07:40 +00:00
|
|
|
}
|
|
|
|
|
2006-01-03 23:14:39 +00:00
|
|
|
if ((collisionAreas[i].flags & 0x0f) >= 5 &&
|
|
|
|
(collisionAreas[i].flags & 0x0f) <= 8) {
|
2005-04-05 15:07:40 +00:00
|
|
|
str = descArray[var_24].ptr;
|
|
|
|
|
2006-01-03 23:14:39 +00:00
|
|
|
strcpy(tempStr, _vm->_global->inter_variables + collisionAreas[i].key);
|
2005-04-05 15:07:40 +00:00
|
|
|
|
2006-01-03 23:14:39 +00:00
|
|
|
if ((collisionAreas[i].flags & 0x0f) < 7)
|
|
|
|
_vm->_util->prepareStr(tempStr);
|
2005-04-05 15:07:40 +00:00
|
|
|
|
|
|
|
pos = 0;
|
|
|
|
do {
|
2006-01-03 23:14:39 +00:00
|
|
|
strcpy(collStr, str);
|
2005-04-05 15:07:40 +00:00
|
|
|
pos += strlen(str) + 1;
|
|
|
|
|
|
|
|
str += strlen(str) + 1;
|
|
|
|
|
2006-01-03 23:14:39 +00:00
|
|
|
if ((collisionAreas[i].flags & 0x0f) < 7)
|
|
|
|
_vm->_util->prepareStr(collStr);
|
2005-04-05 15:07:40 +00:00
|
|
|
|
2006-01-03 23:14:39 +00:00
|
|
|
if (strcmp(tempStr, collStr) == 0) {
|
2005-04-10 17:13:17 +00:00
|
|
|
VAR(17)++;
|
|
|
|
WRITE_VAR(17 + var_26, 1);
|
2005-04-05 15:07:40 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
} while (READ_LE_UINT16(descArray[var_24].ptr - 2) > pos);
|
|
|
|
collStackPos++;
|
|
|
|
} else {
|
2005-04-10 17:13:17 +00:00
|
|
|
VAR(17 + var_26) = 2;
|
2005-04-05 15:07:40 +00:00
|
|
|
}
|
|
|
|
var_24++;
|
|
|
|
var_26++;
|
|
|
|
}
|
|
|
|
|
2005-04-10 17:13:17 +00:00
|
|
|
if (collStackPos != (int16)VAR(17))
|
|
|
|
WRITE_VAR(17, 0);
|
2005-04-05 15:07:40 +00:00
|
|
|
else
|
2005-04-10 17:13:17 +00:00
|
|
|
WRITE_VAR(17, 1);
|
2005-04-05 15:07:40 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
savedIP = 0;
|
2006-01-03 23:14:39 +00:00
|
|
|
if (_vm->_inter->terminate == 0) {
|
|
|
|
savedIP = (char *)totFileData +
|
|
|
|
collisionAreas[activeCollIndex].funcLeave;
|
2005-04-05 15:07:40 +00:00
|
|
|
|
2006-01-03 23:14:39 +00:00
|
|
|
WRITE_VAR(2, _vm->_global->inter_mouseX);
|
|
|
|
WRITE_VAR(3, _vm->_global->inter_mouseY);
|
|
|
|
WRITE_VAR(4, mouseButtons);
|
2005-04-05 15:07:40 +00:00
|
|
|
|
2005-04-10 17:13:17 +00:00
|
|
|
if (VAR(16) == 0) {
|
2006-01-03 23:14:39 +00:00
|
|
|
WRITE_VAR(16, array[(uint16)activeCollResId & ~0x8000]);
|
2005-04-05 15:07:40 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
for (curCmd = 0; curCmd < count; curCmd++) {
|
2006-01-03 23:14:39 +00:00
|
|
|
freeCollision(curCmd + 0x8000);
|
2005-04-05 15:07:40 +00:00
|
|
|
}
|
2006-01-03 23:14:39 +00:00
|
|
|
_vm->_global->inter_execPtr = savedIP;
|
2005-04-05 15:07:40 +00:00
|
|
|
}
|
|
|
|
|
2006-01-03 23:14:39 +00:00
|
|
|
void Game::prepareStart(void) {
|
2005-04-05 15:07:40 +00:00
|
|
|
int16 i;
|
|
|
|
|
2006-01-03 23:14:39 +00:00
|
|
|
clearCollisions();
|
2005-04-05 15:07:40 +00:00
|
|
|
|
2006-01-03 23:14:39 +00:00
|
|
|
_vm->_global->pPaletteDesc->unused2 = _vm->_draw->unusedPalette2;
|
|
|
|
_vm->_global->pPaletteDesc->unused1 = _vm->_draw->unusedPalette1;
|
|
|
|
_vm->_global->pPaletteDesc->vgaPal = _vm->_draw->vgaPalette;
|
2005-04-05 15:07:40 +00:00
|
|
|
|
2006-01-03 23:14:39 +00:00
|
|
|
_vm->_video->setFullPalette(_vm->_global->pPaletteDesc);
|
2005-04-05 15:07:40 +00:00
|
|
|
|
2006-01-03 23:14:39 +00:00
|
|
|
_vm->_draw->backSurface = _vm->_video->initSurfDesc(_vm->_global->videoMode, 320, 200, 0);
|
2005-04-05 15:07:40 +00:00
|
|
|
|
2006-01-03 23:14:39 +00:00
|
|
|
_vm->_video->fillRect(_vm->_draw->backSurface, 0, 0, 319, 199, 1);
|
|
|
|
_vm->_draw->frontSurface = _vm->_global->pPrimarySurfDesc;
|
|
|
|
_vm->_video->fillRect(_vm->_draw->frontSurface, 0, 0, 319, 199, 1);
|
2005-04-05 15:07:40 +00:00
|
|
|
|
2006-01-03 23:14:39 +00:00
|
|
|
_vm->_util->setMousePos(152, 92);
|
2005-04-05 15:07:40 +00:00
|
|
|
|
2006-01-03 23:14:39 +00:00
|
|
|
_vm->_draw->cursorX = 152;
|
|
|
|
_vm->_global->inter_mouseX = 152;
|
2005-04-05 15:07:40 +00:00
|
|
|
|
2006-01-03 23:14:39 +00:00
|
|
|
_vm->_draw->cursorY = 92;
|
|
|
|
_vm->_global->inter_mouseY = 92;
|
|
|
|
_vm->_draw->invalidatedCount = 0;
|
|
|
|
_vm->_draw->noInvalidated = 1;
|
|
|
|
_vm->_draw->applyPal = 0;
|
|
|
|
_vm->_draw->paletteCleared = 0;
|
|
|
|
_vm->_draw->cursorWidth = 16;
|
|
|
|
_vm->_draw->cursorHeight = 16;
|
|
|
|
_vm->_draw->transparentCursor = 1;
|
2005-04-05 15:07:40 +00:00
|
|
|
|
|
|
|
for (i = 0; i < 40; i++) {
|
2006-01-03 23:14:39 +00:00
|
|
|
_vm->_draw->cursorAnimLow[i] = -1;
|
|
|
|
_vm->_draw->cursorAnimDelays[i] = 0;
|
|
|
|
_vm->_draw->cursorAnimHigh[i] = 0;
|
2005-04-05 15:07:40 +00:00
|
|
|
}
|
|
|
|
|
2006-01-03 23:14:39 +00:00
|
|
|
_vm->_draw->cursorAnimLow[1] = 0;
|
|
|
|
_vm->_draw->cursorSprites = _vm->_video->initSurfDesc(_vm->_global->videoMode, 32, 16, 2);
|
|
|
|
_vm->_draw->cursorBack = _vm->_video->initSurfDesc(_vm->_global->videoMode, 16, 16, 0);
|
|
|
|
_vm->_draw->renderFlags = 0;
|
|
|
|
_vm->_draw->backDeltaX = 0;
|
|
|
|
_vm->_draw->backDeltaY = 0;
|
2005-04-05 15:07:40 +00:00
|
|
|
|
2006-01-03 23:14:39 +00:00
|
|
|
startTimeKey = _vm->_util->getTimeKey();
|
2005-04-05 15:07:40 +00:00
|
|
|
}
|
|
|
|
|
2006-01-03 23:14:39 +00:00
|
|
|
void Game::loadTotFile(char *path) {
|
2005-04-05 15:07:40 +00:00
|
|
|
int16 handle;
|
|
|
|
|
2006-01-03 23:14:39 +00:00
|
|
|
handle = _vm->_dataio->openData(path);
|
2005-04-05 15:07:40 +00:00
|
|
|
if (handle >= 0) {
|
2006-01-03 23:14:39 +00:00
|
|
|
_vm->_dataio->closeData(handle);
|
|
|
|
totFileData = _vm->_dataio->getData(path);
|
2005-04-05 15:07:40 +00:00
|
|
|
} else {
|
2006-01-03 23:14:39 +00:00
|
|
|
totFileData = 0;
|
2005-04-05 15:07:40 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2006-01-03 23:14:39 +00:00
|
|
|
void Game::loadExtTable(void) {
|
2005-04-05 15:07:40 +00:00
|
|
|
int16 count, i;
|
|
|
|
|
|
|
|
// Function is correct. [sev]
|
|
|
|
|
2006-01-03 23:14:39 +00:00
|
|
|
extHandle = _vm->_dataio->openData(curExtFile);
|
|
|
|
if (extHandle < 0)
|
2005-04-05 15:07:40 +00:00
|
|
|
return;
|
|
|
|
|
2006-01-03 23:14:39 +00:00
|
|
|
_vm->_dataio->readData(extHandle, (char *)&count, 2);
|
2005-04-05 15:07:40 +00:00
|
|
|
count = FROM_LE_16(count);
|
|
|
|
|
2006-01-03 23:14:39 +00:00
|
|
|
_vm->_dataio->seekData(extHandle, 0, 0);
|
|
|
|
extTable = (ExtTable *)malloc(sizeof(ExtTable)
|
|
|
|
+ sizeof(ExtItem) * count);
|
2005-04-05 15:07:40 +00:00
|
|
|
|
2006-01-03 23:14:39 +00:00
|
|
|
_vm->_dataio->readData(extHandle, (char *)&extTable->itemsCount, 2);
|
|
|
|
extTable->itemsCount = FROM_LE_16(extTable->itemsCount);
|
|
|
|
_vm->_dataio->readData(extHandle, (char *)&extTable->unknown, 1);
|
2005-04-05 15:07:40 +00:00
|
|
|
|
2005-05-08 21:49:52 +00:00
|
|
|
for (i = 0; i < count; i++) {
|
2006-01-03 23:14:39 +00:00
|
|
|
_vm->_dataio->readData(extHandle, (char *)&extTable->items[i].offset, 4);
|
|
|
|
extTable->items[i].offset = FROM_LE_32(extTable->items[i].offset);
|
|
|
|
_vm->_dataio->readData(extHandle, (char *)&extTable->items[i].size, 2);
|
|
|
|
extTable->items[i].size = FROM_LE_16(extTable->items[i].size);
|
|
|
|
_vm->_dataio->readData(extHandle, (char *)&extTable->items[i].width, 2);
|
|
|
|
extTable->items[i].width = FROM_LE_16(extTable->items[i].width);
|
|
|
|
_vm->_dataio->readData(extHandle, (char *)&extTable->items[i].height, 2);
|
|
|
|
extTable->items[i].height = FROM_LE_16(extTable->items[i].height);
|
2005-04-05 15:07:40 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2006-01-03 23:14:39 +00:00
|
|
|
void Game::loadImFile(void) {
|
2005-04-05 15:07:40 +00:00
|
|
|
char path[20];
|
|
|
|
int16 handle;
|
|
|
|
|
2006-01-03 23:14:39 +00:00
|
|
|
if (totFileData[0x3d] != 0 && totFileData[0x3b] == 0)
|
2005-04-05 15:07:40 +00:00
|
|
|
return;
|
|
|
|
|
|
|
|
strcpy(path, "commun.im1");
|
2006-01-03 23:14:39 +00:00
|
|
|
if (totFileData[0x3b] != 0)
|
|
|
|
path[strlen(path) - 1] = '0' + totFileData[0x3b];
|
2005-04-05 15:07:40 +00:00
|
|
|
|
2006-01-03 23:14:39 +00:00
|
|
|
handle = _vm->_dataio->openData(path);
|
2005-04-05 15:07:40 +00:00
|
|
|
if (handle < 0)
|
|
|
|
return;
|
|
|
|
|
2006-01-03 23:14:39 +00:00
|
|
|
_vm->_dataio->closeData(handle);
|
|
|
|
imFileData = _vm->_dataio->getData(path);
|
2005-04-05 15:07:40 +00:00
|
|
|
}
|
|
|
|
|
2006-01-03 23:14:39 +00:00
|
|
|
void Game::playTot(int16 skipPlay) {
|
2005-04-05 15:07:40 +00:00
|
|
|
char savedTotName[20];
|
|
|
|
int16 *oldCaptureCounter;
|
|
|
|
int16 *oldBreakFrom;
|
|
|
|
int16 *oldNestLevel;
|
|
|
|
int16 captureCounter;
|
|
|
|
int16 breakFrom;
|
|
|
|
int16 nestLevel;
|
|
|
|
char needTextFree;
|
|
|
|
char needFreeResTable;
|
|
|
|
char *curPtr;
|
|
|
|
int32 variablesCount;
|
|
|
|
char *filePtr;
|
|
|
|
char *savedIP;
|
|
|
|
int16 i;
|
|
|
|
|
2006-01-03 23:14:39 +00:00
|
|
|
oldNestLevel = _vm->_inter->nestLevel;
|
|
|
|
oldBreakFrom = _vm->_inter->breakFromLevel;
|
|
|
|
oldCaptureCounter = _vm->_scenery->pCaptureCounter;
|
|
|
|
savedIP = _vm->_global->inter_execPtr;
|
2005-04-05 15:07:40 +00:00
|
|
|
|
2006-01-03 23:14:39 +00:00
|
|
|
_vm->_inter->nestLevel = &nestLevel;
|
|
|
|
_vm->_inter->breakFromLevel = &breakFrom;
|
|
|
|
_vm->_scenery->pCaptureCounter = &captureCounter;
|
|
|
|
strcpy(savedTotName, curTotFile);
|
2005-04-05 15:07:40 +00:00
|
|
|
|
|
|
|
if (skipPlay == 0) {
|
|
|
|
while (1) {
|
|
|
|
for (i = 0; i < 4; i++) {
|
2006-01-03 23:14:39 +00:00
|
|
|
_vm->_draw->fontToSprite[i].sprite = -1;
|
|
|
|
_vm->_draw->fontToSprite[i].base = -1;
|
|
|
|
_vm->_draw->fontToSprite[i].width = -1;
|
|
|
|
_vm->_draw->fontToSprite[i].height = -1;
|
2005-04-05 15:07:40 +00:00
|
|
|
}
|
|
|
|
|
2006-01-03 23:14:39 +00:00
|
|
|
_vm->_cdrom->stopPlaying();
|
|
|
|
_vm->_draw->animateCursor(4);
|
|
|
|
_vm->_inter->initControlVars();
|
|
|
|
_vm->_mult->initAll();
|
|
|
|
_vm->_mult->zeroMultData();
|
2005-04-05 15:07:40 +00:00
|
|
|
|
|
|
|
for (i = 0; i < 20; i++)
|
2006-01-03 23:14:39 +00:00
|
|
|
_vm->_draw->spritesArray[i] = 0;
|
2005-04-05 15:07:40 +00:00
|
|
|
|
2006-01-03 23:14:39 +00:00
|
|
|
_vm->_draw->spritesArray[20] = _vm->_draw->frontSurface;
|
|
|
|
_vm->_draw->spritesArray[21] = _vm->_draw->backSurface;
|
|
|
|
_vm->_draw->spritesArray[23] = _vm->_draw->cursorSprites;
|
2005-04-05 15:07:40 +00:00
|
|
|
|
|
|
|
for (i = 0; i < 20; i++)
|
2006-01-03 23:14:39 +00:00
|
|
|
soundSamples[i] = 0;
|
2005-04-05 15:07:40 +00:00
|
|
|
|
2006-01-03 23:14:39 +00:00
|
|
|
totTextData = 0;
|
|
|
|
totResourceTable = 0;
|
|
|
|
imFileData = 0;
|
|
|
|
extTable = 0;
|
|
|
|
extHandle = -1;
|
2005-04-05 15:07:40 +00:00
|
|
|
|
|
|
|
needFreeResTable = 1;
|
|
|
|
needTextFree = 1;
|
|
|
|
|
2006-01-03 23:14:39 +00:00
|
|
|
totToLoad[0] = 0;
|
2005-04-05 15:07:40 +00:00
|
|
|
|
2006-01-03 23:14:39 +00:00
|
|
|
if (curTotFile[0] == 0 && totFileData == 0)
|
2005-04-05 15:07:40 +00:00
|
|
|
break;
|
|
|
|
|
2006-01-03 23:14:39 +00:00
|
|
|
loadTotFile(curTotFile);
|
|
|
|
if (totFileData == 0) {
|
|
|
|
_vm->_draw->blitCursor();
|
2005-04-05 15:07:40 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
2006-01-03 23:14:39 +00:00
|
|
|
strcpy(curImaFile, curTotFile);
|
|
|
|
strcpy(curExtFile, curTotFile);
|
2005-04-05 15:07:40 +00:00
|
|
|
|
2006-01-03 23:14:39 +00:00
|
|
|
curImaFile[strlen(curImaFile) - 4] = 0;
|
|
|
|
strcat(curImaFile, ".ima");
|
2005-04-05 15:07:40 +00:00
|
|
|
|
2006-01-03 23:14:39 +00:00
|
|
|
curExtFile[strlen(curExtFile) - 4] = 0;
|
|
|
|
strcat(curExtFile, ".ext");
|
2005-04-05 15:07:40 +00:00
|
|
|
|
2006-01-03 23:14:39 +00:00
|
|
|
debug(4, "IMA: %s", curImaFile);
|
|
|
|
debug(4, "EXT: %s", curExtFile);
|
2005-04-05 15:07:40 +00:00
|
|
|
|
2006-01-03 23:14:39 +00:00
|
|
|
filePtr = (char *)totFileData + 0x30;
|
2005-04-05 15:07:40 +00:00
|
|
|
|
2005-04-05 17:41:37 +00:00
|
|
|
if (READ_LE_UINT32(filePtr) != (uint32)-1) {
|
2006-01-03 23:14:39 +00:00
|
|
|
curPtr = totFileData;
|
|
|
|
totTextData =
|
|
|
|
(TotTextTable *) (curPtr +
|
|
|
|
READ_LE_UINT32((char *)totFileData + 0x30));
|
2005-07-30 21:11:48 +00:00
|
|
|
|
2006-01-03 23:14:39 +00:00
|
|
|
totTextData->itemsCount = (int16)READ_LE_UINT16(&totTextData->itemsCount);
|
2005-04-11 10:55:22 +00:00
|
|
|
|
2006-01-03 23:14:39 +00:00
|
|
|
for (i = 0; i < totTextData->itemsCount; ++i) {
|
|
|
|
totTextData->items[i].offset = (int16)READ_LE_UINT16(&totTextData->items[i].offset);
|
|
|
|
totTextData->items[i].size = (int16)READ_LE_UINT16(&totTextData->items[i].size);
|
2005-04-11 10:55:22 +00:00
|
|
|
}
|
2005-07-30 21:11:48 +00:00
|
|
|
|
2005-04-05 15:07:40 +00:00
|
|
|
needTextFree = 0;
|
|
|
|
}
|
|
|
|
|
2006-01-03 23:14:39 +00:00
|
|
|
filePtr = (char *)totFileData + 0x34;
|
2005-04-05 17:41:37 +00:00
|
|
|
if (READ_LE_UINT32(filePtr) != (uint32)-1) {
|
2006-01-03 23:14:39 +00:00
|
|
|
curPtr = totFileData;
|
2005-04-05 15:07:40 +00:00
|
|
|
|
2006-01-03 23:14:39 +00:00
|
|
|
totResourceTable =
|
|
|
|
(TotResTable *)(curPtr +
|
|
|
|
READ_LE_UINT32((char *)totFileData + 0x34));
|
2005-07-30 21:11:48 +00:00
|
|
|
|
2006-01-03 23:14:39 +00:00
|
|
|
totResourceTable->itemsCount = (int16)READ_LE_UINT16(&totResourceTable->itemsCount);
|
2005-07-30 21:11:48 +00:00
|
|
|
|
2006-01-03 23:14:39 +00:00
|
|
|
for (i = 0; i < totResourceTable->itemsCount; ++i) {
|
|
|
|
totResourceTable->items[i].offset = (int32)READ_LE_UINT32(&totResourceTable->items[i].offset);
|
|
|
|
totResourceTable->items[i].size = (int16)READ_LE_UINT16(&totResourceTable->items[i].size);
|
|
|
|
totResourceTable->items[i].width = (int16)READ_LE_UINT16(&totResourceTable->items[i].width);
|
|
|
|
totResourceTable->items[i].height = (int16)READ_LE_UINT16(&totResourceTable->items[i].height);
|
2005-04-11 10:55:22 +00:00
|
|
|
}
|
2005-07-30 21:11:48 +00:00
|
|
|
|
2005-04-05 15:07:40 +00:00
|
|
|
needFreeResTable = 0;
|
|
|
|
}
|
|
|
|
|
2006-01-03 23:14:39 +00:00
|
|
|
loadImFile();
|
|
|
|
loadExtTable();
|
2005-04-05 15:07:40 +00:00
|
|
|
|
2006-01-03 23:14:39 +00:00
|
|
|
_vm->_global->inter_animDataSize = READ_LE_UINT16((char *)totFileData + 0x38);
|
|
|
|
if (_vm->_global->inter_variables == 0) {
|
|
|
|
variablesCount = READ_LE_UINT32((char *)totFileData + 0x2c);
|
|
|
|
_vm->_global->inter_variables = (char *)malloc(variablesCount * 4);
|
2005-04-05 15:07:40 +00:00
|
|
|
for (i = 0; i < variablesCount; i++)
|
2005-04-10 17:13:17 +00:00
|
|
|
WRITE_VAR(i, 0);
|
2005-04-05 15:07:40 +00:00
|
|
|
}
|
|
|
|
|
2006-01-03 23:14:39 +00:00
|
|
|
_vm->_global->inter_execPtr = (char *)totFileData;
|
|
|
|
_vm->_global->inter_execPtr += READ_LE_UINT32((char *)totFileData + 0x64);
|
2005-04-05 15:07:40 +00:00
|
|
|
|
2006-01-03 23:14:39 +00:00
|
|
|
_vm->_inter->renewTimeInVars();
|
2005-04-05 15:07:40 +00:00
|
|
|
|
2006-01-03 23:14:39 +00:00
|
|
|
WRITE_VAR(13, _vm->_global->useMouse);
|
|
|
|
WRITE_VAR(14, _vm->_global->soundFlags);
|
|
|
|
WRITE_VAR(15, _vm->_global->videoMode);
|
|
|
|
WRITE_VAR(16, _vm->_global->language);
|
2005-04-05 15:07:40 +00:00
|
|
|
|
2006-01-03 23:14:39 +00:00
|
|
|
_vm->_inter->callSub(2);
|
2005-04-05 15:07:40 +00:00
|
|
|
|
2006-01-03 23:14:39 +00:00
|
|
|
if (totToLoad[0] != 0)
|
|
|
|
_vm->_inter->terminate = 0;
|
2005-04-05 15:07:40 +00:00
|
|
|
|
2006-01-03 23:14:39 +00:00
|
|
|
variablesCount = READ_LE_UINT32((char *)totFileData + 0x2c);
|
|
|
|
_vm->_draw->blitInvalidated();
|
|
|
|
free(totFileData);
|
|
|
|
totFileData = 0;
|
2005-04-05 15:07:40 +00:00
|
|
|
|
2005-05-05 11:11:49 +00:00
|
|
|
if (needTextFree)
|
2006-01-03 23:14:39 +00:00
|
|
|
free(totTextData);
|
|
|
|
totTextData = 0;
|
2005-04-05 15:07:40 +00:00
|
|
|
|
2005-05-05 11:11:49 +00:00
|
|
|
if (needFreeResTable)
|
2006-01-03 23:14:39 +00:00
|
|
|
free(totResourceTable);
|
|
|
|
totResourceTable = 0;
|
2005-04-05 15:07:40 +00:00
|
|
|
|
2006-01-03 23:14:39 +00:00
|
|
|
free(imFileData);
|
|
|
|
imFileData = 0;
|
2005-04-05 15:07:40 +00:00
|
|
|
|
2006-01-03 23:14:39 +00:00
|
|
|
free(extTable);
|
|
|
|
extTable = 0;
|
2005-05-05 11:11:49 +00:00
|
|
|
|
2006-01-03 23:14:39 +00:00
|
|
|
if (extHandle >= 0)
|
|
|
|
_vm->_dataio->closeData(extHandle);
|
2005-04-05 15:07:40 +00:00
|
|
|
|
2006-01-03 23:14:39 +00:00
|
|
|
extHandle = -1;
|
2005-04-05 15:07:40 +00:00
|
|
|
|
2006-01-03 23:14:39 +00:00
|
|
|
for (i = 0; i < *_vm->_scenery->pCaptureCounter; i++)
|
|
|
|
capturePop(0);
|
2005-04-05 15:07:40 +00:00
|
|
|
|
2006-01-03 23:14:39 +00:00
|
|
|
_vm->_mult->checkFreeMult();
|
|
|
|
_vm->_mult->freeAll();
|
2005-04-05 15:07:40 +00:00
|
|
|
|
|
|
|
for (i = 0; i < 20; i++) {
|
2006-01-03 23:14:39 +00:00
|
|
|
if (_vm->_draw->spritesArray[i] != 0)
|
|
|
|
_vm->_video->freeSurfDesc(_vm->_draw->spritesArray[i]);
|
|
|
|
_vm->_draw->spritesArray[i] = 0;
|
2005-04-05 15:07:40 +00:00
|
|
|
}
|
2006-01-03 23:14:39 +00:00
|
|
|
_vm->_snd->stopSound(0);
|
2005-04-05 15:07:40 +00:00
|
|
|
|
|
|
|
for (i = 0; i < 20; i++)
|
2006-01-03 23:14:39 +00:00
|
|
|
freeSoundSlot(i);
|
2005-04-05 15:07:40 +00:00
|
|
|
|
2006-01-03 23:14:39 +00:00
|
|
|
if (totToLoad[0] == 0)
|
2005-04-05 15:07:40 +00:00
|
|
|
break;
|
|
|
|
|
2006-01-03 23:14:39 +00:00
|
|
|
strcpy(curTotFile, totToLoad);
|
2005-04-05 15:07:40 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2006-01-03 23:14:39 +00:00
|
|
|
strcpy(curTotFile, savedTotName);
|
2005-04-05 15:07:40 +00:00
|
|
|
|
2006-01-03 23:14:39 +00:00
|
|
|
_vm->_inter->nestLevel = oldNestLevel;
|
|
|
|
_vm->_inter->breakFromLevel = oldBreakFrom;
|
|
|
|
_vm->_scenery->pCaptureCounter = oldCaptureCounter;
|
|
|
|
_vm->_global->inter_execPtr = savedIP;
|
2005-04-05 15:07:40 +00:00
|
|
|
}
|
|
|
|
|
2006-01-03 23:14:39 +00:00
|
|
|
void Game::start(void) {
|
|
|
|
collisionAreas = (Collision *)malloc(250 * sizeof(Collision));
|
|
|
|
prepareStart();
|
|
|
|
playTot(0);
|
2005-04-05 15:07:40 +00:00
|
|
|
|
2006-01-03 23:14:39 +00:00
|
|
|
free(collisionAreas);
|
2005-04-05 15:07:40 +00:00
|
|
|
|
2006-01-03 23:14:39 +00:00
|
|
|
_vm->_video->freeSurfDesc(_vm->_draw->cursorSprites);
|
|
|
|
_vm->_video->freeSurfDesc(_vm->_draw->cursorBack);
|
|
|
|
_vm->_video->freeSurfDesc(_vm->_draw->backSurface);
|
2005-04-05 15:07:40 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
} // End of namespace Gob
|