2007-05-30 21:56:52 +00:00
|
|
|
/* ScummVM - Graphic Adventure Engine
|
|
|
|
*
|
|
|
|
* ScummVM is the legal property of its developers, whose names
|
|
|
|
* are too numerous to list here. Please refer to the COPYRIGHT
|
|
|
|
* file distributed with this source distribution.
|
2006-01-05 16:06:55 +00:00
|
|
|
*
|
|
|
|
* 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
|
2008-01-05 12:45:14 +00:00
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
2006-01-05 16:06:55 +00:00
|
|
|
* 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.
|
|
|
|
*
|
2006-02-11 10:11:37 +00:00
|
|
|
* $URL$
|
|
|
|
* $Id$
|
2006-01-05 16:06:55 +00:00
|
|
|
*
|
|
|
|
*/
|
2006-03-29 15:59:37 +00:00
|
|
|
|
2010-10-15 13:54:23 +00:00
|
|
|
#include "common/str.h"
|
2006-03-29 15:59:37 +00:00
|
|
|
|
2006-01-05 16:06:55 +00:00
|
|
|
#include "gob/gob.h"
|
|
|
|
#include "gob/inter.h"
|
2007-03-20 14:51:57 +00:00
|
|
|
#include "gob/global.h"
|
2006-01-05 16:06:55 +00:00
|
|
|
#include "gob/util.h"
|
2007-03-20 14:51:57 +00:00
|
|
|
#include "gob/dataio.h"
|
2006-01-05 16:06:55 +00:00
|
|
|
#include "gob/draw.h"
|
2007-03-20 14:51:57 +00:00
|
|
|
#include "gob/game.h"
|
2009-06-22 16:30:35 +00:00
|
|
|
#include "gob/expression.h"
|
2009-06-22 10:13:37 +00:00
|
|
|
#include "gob/script.h"
|
2009-06-24 21:49:37 +00:00
|
|
|
#include "gob/resources.h"
|
2009-07-05 11:27:54 +00:00
|
|
|
#include "gob/hotspots.h"
|
2006-01-05 16:06:55 +00:00
|
|
|
#include "gob/goblin.h"
|
2007-03-20 14:51:57 +00:00
|
|
|
#include "gob/inter.h"
|
2006-01-10 11:30:23 +00:00
|
|
|
#include "gob/map.h"
|
2007-03-20 14:51:57 +00:00
|
|
|
#include "gob/mult.h"
|
2006-02-02 21:12:00 +00:00
|
|
|
#include "gob/palanim.h"
|
2007-03-20 14:51:57 +00:00
|
|
|
#include "gob/scenery.h"
|
|
|
|
#include "gob/video.h"
|
2011-01-22 12:26:31 +00:00
|
|
|
#include "gob/videoplayer.h"
|
2008-05-08 00:47:23 +00:00
|
|
|
#include "gob/sound/sound.h"
|
2006-01-05 16:06:55 +00:00
|
|
|
|
|
|
|
namespace Gob {
|
|
|
|
|
2009-06-17 04:16:21 +00:00
|
|
|
#define OPCODEVER Inter_v1
|
|
|
|
#define OPCODEDRAW(i, x) _opcodesDraw[i]._OPCODEDRAW(OPCODEVER, x)
|
|
|
|
#define OPCODEFUNC(i, x) _opcodesFunc[i]._OPCODEFUNC(OPCODEVER, x)
|
2009-06-17 04:16:51 +00:00
|
|
|
#define OPCODEGOB(i, x) _opcodesGob[i]._OPCODEGOB(OPCODEVER, x)
|
2006-01-10 11:30:23 +00:00
|
|
|
|
2006-01-05 16:06:55 +00:00
|
|
|
Inter_v1::Inter_v1(GobEngine *vm) : Inter(vm) {
|
|
|
|
}
|
|
|
|
|
2009-06-17 04:15:45 +00:00
|
|
|
void Inter_v1::setupOpcodesDraw() {
|
|
|
|
OPCODEDRAW(0x00, o1_loadMult);
|
|
|
|
OPCODEDRAW(0x01, o1_playMult);
|
|
|
|
OPCODEDRAW(0x02, o1_freeMultKeys);
|
|
|
|
|
|
|
|
OPCODEDRAW(0x07, o1_initCursor);
|
|
|
|
|
|
|
|
OPCODEDRAW(0x08, o1_initCursorAnim);
|
|
|
|
OPCODEDRAW(0x09, o1_clearCursorAnim);
|
|
|
|
OPCODEDRAW(0x0A, o1_setRenderFlags);
|
2006-01-05 16:06:55 +00:00
|
|
|
|
2009-06-17 04:15:45 +00:00
|
|
|
OPCODEDRAW(0x10, o1_loadAnim);
|
|
|
|
OPCODEDRAW(0x11, o1_freeAnim);
|
|
|
|
OPCODEDRAW(0x12, o1_updateAnim);
|
|
|
|
|
|
|
|
OPCODEDRAW(0x14, o1_initMult);
|
|
|
|
OPCODEDRAW(0x15, o1_freeMult);
|
|
|
|
OPCODEDRAW(0x16, o1_animate);
|
|
|
|
OPCODEDRAW(0x17, o1_loadMultObject);
|
|
|
|
|
|
|
|
OPCODEDRAW(0x18, o1_getAnimLayerInfo);
|
|
|
|
OPCODEDRAW(0x19, o1_getObjAnimSize);
|
|
|
|
OPCODEDRAW(0x1A, o1_loadStatic);
|
|
|
|
OPCODEDRAW(0x1B, o1_freeStatic);
|
|
|
|
|
|
|
|
OPCODEDRAW(0x1C, o1_renderStatic);
|
|
|
|
OPCODEDRAW(0x1D, o1_loadCurLayer);
|
|
|
|
|
|
|
|
OPCODEDRAW(0x20, o1_playCDTrack);
|
|
|
|
OPCODEDRAW(0x21, o1_getCDTrackPos);
|
|
|
|
OPCODEDRAW(0x22, o1_stopCD);
|
|
|
|
|
|
|
|
OPCODEDRAW(0x30, o1_loadFontToSprite);
|
|
|
|
OPCODEDRAW(0x31, o1_freeFontToSprite);
|
|
|
|
}
|
|
|
|
|
2009-06-17 04:16:21 +00:00
|
|
|
void Inter_v1::setupOpcodesFunc() {
|
|
|
|
OPCODEFUNC(0x00, o1_callSub);
|
|
|
|
OPCODEFUNC(0x01, o1_callSub);
|
|
|
|
OPCODEFUNC(0x02, o1_printTotText);
|
|
|
|
OPCODEFUNC(0x03, o1_loadCursor);
|
|
|
|
|
|
|
|
OPCODEFUNC(0x05, o1_switch);
|
|
|
|
OPCODEFUNC(0x06, o1_repeatUntil);
|
|
|
|
OPCODEFUNC(0x07, o1_whileDo);
|
|
|
|
|
|
|
|
OPCODEFUNC(0x08, o1_if);
|
|
|
|
OPCODEFUNC(0x09, o1_assign);
|
|
|
|
OPCODEFUNC(0x0A, o1_loadSpriteToPos);
|
|
|
|
OPCODEFUNC(0x11, o1_printText);
|
|
|
|
OPCODEFUNC(0x12, o1_loadTot);
|
|
|
|
OPCODEFUNC(0x13, o1_palLoad);
|
2006-01-05 16:06:55 +00:00
|
|
|
|
2009-06-17 04:16:21 +00:00
|
|
|
OPCODEFUNC(0x14, o1_keyFunc);
|
|
|
|
OPCODEFUNC(0x15, o1_capturePush);
|
|
|
|
OPCODEFUNC(0x16, o1_capturePop);
|
|
|
|
OPCODEFUNC(0x17, o1_animPalInit);
|
|
|
|
|
|
|
|
OPCODEFUNC(0x1E, o1_drawOperations);
|
|
|
|
OPCODEFUNC(0x1F, o1_setcmdCount);
|
|
|
|
|
|
|
|
OPCODEFUNC(0x20, o1_return);
|
|
|
|
OPCODEFUNC(0x21, o1_renewTimeInVars);
|
|
|
|
OPCODEFUNC(0x22, o1_speakerOn);
|
|
|
|
OPCODEFUNC(0x23, o1_speakerOff);
|
|
|
|
|
|
|
|
OPCODEFUNC(0x24, o1_putPixel);
|
|
|
|
OPCODEFUNC(0x25, o1_goblinFunc);
|
|
|
|
OPCODEFUNC(0x26, o1_createSprite);
|
|
|
|
OPCODEFUNC(0x27, o1_freeSprite);
|
|
|
|
|
|
|
|
OPCODEFUNC(0x30, o1_returnTo);
|
|
|
|
OPCODEFUNC(0x31, o1_loadSpriteContent);
|
|
|
|
OPCODEFUNC(0x32, o1_copySprite);
|
|
|
|
OPCODEFUNC(0x33, o1_fillRect);
|
|
|
|
|
|
|
|
OPCODEFUNC(0x34, o1_drawLine);
|
|
|
|
OPCODEFUNC(0x35, o1_strToLong);
|
|
|
|
OPCODEFUNC(0x36, o1_invalidate);
|
|
|
|
OPCODEFUNC(0x37, o1_setBackDelta);
|
|
|
|
|
|
|
|
OPCODEFUNC(0x38, o1_playSound);
|
|
|
|
OPCODEFUNC(0x39, o1_stopSound);
|
|
|
|
OPCODEFUNC(0x3A, o1_loadSound);
|
|
|
|
OPCODEFUNC(0x3B, o1_freeSoundSlot);
|
|
|
|
|
|
|
|
OPCODEFUNC(0x3C, o1_waitEndPlay);
|
|
|
|
OPCODEFUNC(0x3D, o1_playComposition);
|
|
|
|
OPCODEFUNC(0x3E, o1_getFreeMem);
|
|
|
|
OPCODEFUNC(0x3F, o1_checkData);
|
|
|
|
|
2009-07-05 11:26:42 +00:00
|
|
|
OPCODEFUNC(0x41, o1_cleanupStr);
|
2009-06-17 04:16:21 +00:00
|
|
|
OPCODEFUNC(0x42, o1_insertStr);
|
|
|
|
OPCODEFUNC(0x43, o1_cutStr);
|
|
|
|
|
|
|
|
OPCODEFUNC(0x44, o1_strstr);
|
|
|
|
OPCODEFUNC(0x45, o1_istrlen);
|
|
|
|
OPCODEFUNC(0x46, o1_setMousePos);
|
|
|
|
OPCODEFUNC(0x47, o1_setFrameRate);
|
|
|
|
|
|
|
|
OPCODEFUNC(0x48, o1_animatePalette);
|
|
|
|
OPCODEFUNC(0x49, o1_animateCursor);
|
|
|
|
OPCODEFUNC(0x4A, o1_blitCursor);
|
|
|
|
OPCODEFUNC(0x4B, o1_loadFont);
|
|
|
|
|
|
|
|
OPCODEFUNC(0x4C, o1_freeFont);
|
|
|
|
OPCODEFUNC(0x4D, o1_readData);
|
|
|
|
OPCODEFUNC(0x4E, o1_writeData);
|
|
|
|
OPCODEFUNC(0x4F, o1_manageDataFile);
|
|
|
|
}
|
|
|
|
|
2009-06-17 04:16:51 +00:00
|
|
|
void Inter_v1::setupOpcodesGob() {
|
|
|
|
OPCODEGOB( 1, o1_setState);
|
|
|
|
OPCODEGOB( 2, o1_setCurFrame);
|
|
|
|
OPCODEGOB( 3, o1_setNextState);
|
|
|
|
OPCODEGOB( 4, o1_setMultState);
|
|
|
|
OPCODEGOB( 5, o1_setOrder);
|
|
|
|
OPCODEGOB( 6, o1_setActionStartState);
|
|
|
|
OPCODEGOB( 7, o1_setCurLookDir);
|
|
|
|
OPCODEGOB( 8, o1_setType);
|
|
|
|
OPCODEGOB( 9, o1_setNoTick);
|
|
|
|
OPCODEGOB( 10, o1_setPickable);
|
|
|
|
OPCODEGOB( 12, o1_setXPos);
|
|
|
|
OPCODEGOB( 13, o1_setYPos);
|
|
|
|
OPCODEGOB( 14, o1_setDoAnim);
|
|
|
|
OPCODEGOB( 15, o1_setRelaxTime);
|
|
|
|
OPCODEGOB( 16, o1_setMaxTick);
|
|
|
|
OPCODEGOB( 21, o1_getState);
|
|
|
|
OPCODEGOB( 22, o1_getCurFrame);
|
|
|
|
OPCODEGOB( 23, o1_getNextState);
|
|
|
|
OPCODEGOB( 24, o1_getMultState);
|
|
|
|
OPCODEGOB( 25, o1_getOrder);
|
|
|
|
OPCODEGOB( 26, o1_getActionStartState);
|
|
|
|
OPCODEGOB( 27, o1_getCurLookDir);
|
|
|
|
OPCODEGOB( 28, o1_getType);
|
|
|
|
OPCODEGOB( 29, o1_getNoTick);
|
|
|
|
OPCODEGOB( 30, o1_getPickable);
|
|
|
|
OPCODEGOB( 32, o1_getObjMaxFrame);
|
|
|
|
OPCODEGOB( 33, o1_getXPos);
|
|
|
|
OPCODEGOB( 34, o1_getYPos);
|
|
|
|
OPCODEGOB( 35, o1_getDoAnim);
|
|
|
|
OPCODEGOB( 36, o1_getRelaxTime);
|
|
|
|
OPCODEGOB( 37, o1_getMaxTick);
|
|
|
|
OPCODEGOB( 40, o1_manipulateMap);
|
|
|
|
OPCODEGOB( 41, o1_getItem);
|
|
|
|
OPCODEGOB( 42, o1_manipulateMapIndirect);
|
|
|
|
OPCODEGOB( 43, o1_getItemIndirect);
|
|
|
|
OPCODEGOB( 44, o1_setPassMap);
|
|
|
|
OPCODEGOB( 50, o1_setGoblinPosH);
|
|
|
|
OPCODEGOB( 52, o1_getGoblinPosXH);
|
|
|
|
OPCODEGOB( 53, o1_getGoblinPosYH);
|
|
|
|
OPCODEGOB( 150, o1_setGoblinMultState);
|
|
|
|
OPCODEGOB( 152, o1_setGoblinUnk14);
|
|
|
|
OPCODEGOB( 200, o1_setItemIdInPocket);
|
|
|
|
OPCODEGOB( 201, o1_setItemIndInPocket);
|
|
|
|
OPCODEGOB( 202, o1_getItemIdInPocket);
|
|
|
|
OPCODEGOB( 203, o1_getItemIndInPocket);
|
|
|
|
OPCODEGOB( 204, o1_setItemPos);
|
|
|
|
OPCODEGOB( 250, o1_setGoblinPos);
|
|
|
|
OPCODEGOB( 251, o1_setGoblinState);
|
|
|
|
OPCODEGOB( 252, o1_setGoblinStateRedraw);
|
|
|
|
OPCODEGOB( 500, o1_decRelaxTime);
|
|
|
|
OPCODEGOB( 502, o1_getGoblinPosX);
|
|
|
|
OPCODEGOB( 503, o1_getGoblinPosY);
|
|
|
|
OPCODEGOB( 600, o1_clearPathExistence);
|
|
|
|
OPCODEGOB( 601, o1_setGoblinVisible);
|
|
|
|
OPCODEGOB( 602, o1_setGoblinInvisible);
|
|
|
|
OPCODEGOB( 603, o1_getObjectIntersect);
|
|
|
|
OPCODEGOB( 604, o1_getGoblinIntersect);
|
|
|
|
OPCODEGOB( 605, o1_setItemPos);
|
|
|
|
OPCODEGOB(1000, o1_loadObjects);
|
|
|
|
OPCODEGOB(1001, o1_freeObjects);
|
|
|
|
OPCODEGOB(1002, o1_animateObjects);
|
|
|
|
OPCODEGOB(1003, o1_drawObjects);
|
|
|
|
OPCODEGOB(1004, o1_loadMap);
|
|
|
|
OPCODEGOB(1005, o1_moveGoblin);
|
|
|
|
OPCODEGOB(1006, o1_switchGoblin);
|
|
|
|
OPCODEGOB(1008, o1_loadGoblin);
|
|
|
|
OPCODEGOB(1009, o1_writeTreatItem);
|
|
|
|
OPCODEGOB(1010, o1_moveGoblin0);
|
|
|
|
OPCODEGOB(1011, o1_setGoblinTarget);
|
|
|
|
OPCODEGOB(1015, o1_setGoblinObjectsPos);
|
|
|
|
OPCODEGOB(2005, o1_initGoblin);
|
2007-02-06 14:42:05 +00:00
|
|
|
}
|
|
|
|
|
2009-06-22 10:13:37 +00:00
|
|
|
void Inter_v1::checkSwitchTable(uint32 &offset) {
|
2007-02-06 14:42:05 +00:00
|
|
|
int16 len;
|
|
|
|
int32 value;
|
|
|
|
bool found;
|
|
|
|
bool notFound;
|
|
|
|
|
|
|
|
found = false;
|
|
|
|
notFound = true;
|
2009-06-22 10:13:37 +00:00
|
|
|
offset = 0;
|
|
|
|
value = VAR_OFFSET(_vm->_game->_script->readVarIndex());
|
2007-02-06 14:42:05 +00:00
|
|
|
|
2009-06-22 10:13:37 +00:00
|
|
|
len = _vm->_game->_script->readInt8();
|
2007-02-06 14:42:05 +00:00
|
|
|
while (len != -5) {
|
2007-03-20 14:51:57 +00:00
|
|
|
for (int i = 0; i < len; i++) {
|
2009-06-22 10:29:32 +00:00
|
|
|
_vm->_game->_script->evalExpr(0);
|
2007-02-06 14:42:05 +00:00
|
|
|
|
|
|
|
if (_terminate)
|
|
|
|
return;
|
|
|
|
|
2009-06-22 10:13:37 +00:00
|
|
|
if (_vm->_game->_script->getResultInt() == value) {
|
2007-02-06 14:42:05 +00:00
|
|
|
found = true;
|
|
|
|
notFound = false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (found)
|
2009-06-22 10:13:37 +00:00
|
|
|
offset = _vm->_game->_script->pos();
|
2007-02-06 14:42:05 +00:00
|
|
|
|
2009-06-22 10:13:37 +00:00
|
|
|
_vm->_game->_script->skip(_vm->_game->_script->peekUint16(2) + 2);
|
2007-02-06 14:42:05 +00:00
|
|
|
found = false;
|
2009-06-22 10:13:37 +00:00
|
|
|
len = _vm->_game->_script->readInt8();
|
2007-09-19 08:40:12 +00:00
|
|
|
}
|
2007-02-06 14:42:05 +00:00
|
|
|
|
2009-06-22 10:13:37 +00:00
|
|
|
if ((_vm->_game->_script->peekByte() >> 4) != 4)
|
2007-02-06 14:42:05 +00:00
|
|
|
return;
|
|
|
|
|
2009-06-22 10:13:37 +00:00
|
|
|
_vm->_game->_script->skip(1);
|
2007-02-06 14:42:05 +00:00
|
|
|
if (notFound)
|
2009-06-22 10:13:37 +00:00
|
|
|
offset = _vm->_game->_script->pos();
|
2007-02-06 14:42:05 +00:00
|
|
|
|
2009-06-22 10:13:37 +00:00
|
|
|
_vm->_game->_script->skip(_vm->_game->_script->peekUint16(2) + 2);
|
2006-01-05 16:06:55 +00:00
|
|
|
}
|
|
|
|
|
2007-03-20 14:51:57 +00:00
|
|
|
void Inter_v1::o1_loadMult() {
|
2009-06-22 10:13:37 +00:00
|
|
|
_vm->_mult->loadMult(_vm->_game->_script->readInt16());
|
2006-01-05 16:06:55 +00:00
|
|
|
}
|
|
|
|
|
2007-03-20 14:51:57 +00:00
|
|
|
void Inter_v1::o1_playMult() {
|
2006-01-05 16:06:55 +00:00
|
|
|
int16 checkEscape;
|
|
|
|
|
2009-06-22 10:13:37 +00:00
|
|
|
checkEscape = _vm->_game->_script->readInt16();
|
2006-01-05 16:06:55 +00:00
|
|
|
_vm->_mult->playMult(VAR(57), -1, checkEscape, 0);
|
|
|
|
}
|
|
|
|
|
2007-03-20 14:51:57 +00:00
|
|
|
void Inter_v1::o1_freeMultKeys() {
|
2009-06-22 10:13:37 +00:00
|
|
|
_vm->_game->_script->readInt16();
|
2006-01-05 16:06:55 +00:00
|
|
|
_vm->_mult->freeMultKeys();
|
|
|
|
}
|
|
|
|
|
2007-03-20 14:51:57 +00:00
|
|
|
void Inter_v1::o1_initCursor() {
|
2006-01-05 16:06:55 +00:00
|
|
|
int16 width;
|
|
|
|
int16 height;
|
|
|
|
int16 count;
|
|
|
|
|
2009-08-24 22:37:09 +00:00
|
|
|
_vm->_draw->_cursorHotspotXVar = ((uint16) _vm->_game->_script->readVarIndex()) / 4;
|
|
|
|
_vm->_draw->_cursorHotspotYVar = ((uint16) _vm->_game->_script->readVarIndex()) / 4;
|
2006-01-05 16:06:55 +00:00
|
|
|
|
2009-06-22 10:13:37 +00:00
|
|
|
width = _vm->_game->_script->readInt16();
|
2006-01-05 16:06:55 +00:00
|
|
|
if (width < 16)
|
|
|
|
width = 16;
|
|
|
|
|
2009-06-22 10:13:37 +00:00
|
|
|
height = _vm->_game->_script->readInt16();
|
2006-01-05 16:06:55 +00:00
|
|
|
if (height < 16)
|
|
|
|
height = 16;
|
|
|
|
|
2007-03-20 14:51:57 +00:00
|
|
|
_vm->_draw->adjustCoords(0, &width, &height);
|
|
|
|
|
2009-06-22 10:13:37 +00:00
|
|
|
count = _vm->_game->_script->readInt16();
|
2008-12-12 00:10:39 +00:00
|
|
|
|
2006-01-05 16:06:55 +00:00
|
|
|
if (count < 2)
|
|
|
|
count = 2;
|
|
|
|
|
2007-03-20 14:51:57 +00:00
|
|
|
if ((width != _vm->_draw->_cursorWidth) ||
|
|
|
|
(height != _vm->_draw->_cursorHeight) ||
|
|
|
|
(_vm->_draw->_cursorSprites->getWidth() != (width * count))) {
|
2006-01-05 16:06:55 +00:00
|
|
|
|
2010-08-08 00:35:18 +00:00
|
|
|
_vm->_draw->freeSprite(Draw::kCursorSurface);
|
2009-06-06 20:03:13 +00:00
|
|
|
_vm->_draw->_cursorSprites.reset();
|
|
|
|
_vm->_draw->_cursorSpritesBack.reset();
|
|
|
|
_vm->_draw->_scummvmCursor.reset();
|
2006-01-05 16:06:55 +00:00
|
|
|
|
2006-01-07 22:28:54 +00:00
|
|
|
_vm->_draw->_cursorWidth = width;
|
|
|
|
_vm->_draw->_cursorHeight = height;
|
2006-01-05 16:06:55 +00:00
|
|
|
|
|
|
|
if (count < 0x80)
|
2006-01-07 22:28:54 +00:00
|
|
|
_vm->_draw->_transparentCursor = 1;
|
2006-01-05 16:06:55 +00:00
|
|
|
else
|
2006-01-07 22:28:54 +00:00
|
|
|
_vm->_draw->_transparentCursor = 0;
|
2006-01-05 16:06:55 +00:00
|
|
|
|
|
|
|
if (count > 0x80)
|
|
|
|
count -= 0x80;
|
|
|
|
|
2010-08-08 00:35:18 +00:00
|
|
|
_vm->_draw->initSpriteSurf(Draw::kCursorSurface, _vm->_draw->_cursorWidth * count,
|
2007-03-20 14:51:57 +00:00
|
|
|
_vm->_draw->_cursorHeight, 2);
|
2010-08-08 00:35:18 +00:00
|
|
|
_vm->_draw->_cursorSpritesBack = _vm->_draw->_spritesArray[Draw::kCursorSurface];
|
2007-03-20 14:51:57 +00:00
|
|
|
_vm->_draw->_cursorSprites = _vm->_draw->_cursorSpritesBack;
|
2006-01-05 16:06:55 +00:00
|
|
|
|
2006-07-09 18:54:12 +00:00
|
|
|
_vm->_draw->_scummvmCursor =
|
2011-02-02 16:48:04 +00:00
|
|
|
_vm->_video->initSurfDesc(_vm->_draw->_cursorWidth,
|
|
|
|
_vm->_draw->_cursorHeight, SCUMMVM_CURSOR);
|
2007-03-20 14:51:57 +00:00
|
|
|
|
|
|
|
for (int i = 0; i < 40; i++) {
|
2006-01-07 22:28:54 +00:00
|
|
|
_vm->_draw->_cursorAnimLow[i] = -1;
|
|
|
|
_vm->_draw->_cursorAnimDelays[i] = 0;
|
|
|
|
_vm->_draw->_cursorAnimHigh[i] = 0;
|
2006-01-05 16:06:55 +00:00
|
|
|
}
|
2006-01-07 22:28:54 +00:00
|
|
|
_vm->_draw->_cursorAnimLow[1] = 0;
|
2006-01-05 16:06:55 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2007-03-20 14:51:57 +00:00
|
|
|
void Inter_v1::o1_initCursorAnim() {
|
2006-01-05 16:06:55 +00:00
|
|
|
int16 ind;
|
|
|
|
|
2007-02-07 13:08:17 +00:00
|
|
|
_vm->_draw->_showCursor = 3;
|
2009-06-22 10:13:37 +00:00
|
|
|
ind = _vm->_game->_script->readValExpr();
|
|
|
|
_vm->_draw->_cursorAnimLow[ind] = _vm->_game->_script->readInt16();
|
|
|
|
_vm->_draw->_cursorAnimHigh[ind] = _vm->_game->_script->readInt16();
|
|
|
|
_vm->_draw->_cursorAnimDelays[ind] = _vm->_game->_script->readInt16();
|
2006-01-05 16:06:55 +00:00
|
|
|
}
|
|
|
|
|
2007-03-20 14:51:57 +00:00
|
|
|
void Inter_v1::o1_clearCursorAnim() {
|
2006-01-05 16:06:55 +00:00
|
|
|
int16 ind;
|
|
|
|
|
2007-02-07 13:08:17 +00:00
|
|
|
_vm->_draw->_showCursor = 0;
|
2009-06-22 10:13:37 +00:00
|
|
|
ind = _vm->_game->_script->readValExpr();
|
2006-01-07 22:28:54 +00:00
|
|
|
_vm->_draw->_cursorAnimLow[ind] = -1;
|
|
|
|
_vm->_draw->_cursorAnimHigh[ind] = 0;
|
|
|
|
_vm->_draw->_cursorAnimDelays[ind] = 0;
|
2006-01-05 16:06:55 +00:00
|
|
|
}
|
|
|
|
|
2007-03-20 14:51:57 +00:00
|
|
|
void Inter_v1::o1_setRenderFlags() {
|
2009-06-22 10:13:37 +00:00
|
|
|
_vm->_draw->_renderFlags = _vm->_game->_script->readValExpr();
|
2007-03-20 14:51:57 +00:00
|
|
|
}
|
2006-01-05 16:06:55 +00:00
|
|
|
|
2007-03-20 14:51:57 +00:00
|
|
|
void Inter_v1::o1_loadAnim() {
|
|
|
|
_vm->_scenery->loadAnim(0);
|
2006-01-05 16:06:55 +00:00
|
|
|
}
|
|
|
|
|
2007-03-20 14:51:57 +00:00
|
|
|
void Inter_v1::o1_freeAnim() {
|
|
|
|
_vm->_scenery->freeAnim(-1);
|
|
|
|
}
|
2006-01-05 16:06:55 +00:00
|
|
|
|
2007-03-20 14:51:57 +00:00
|
|
|
void Inter_v1::o1_updateAnim() {
|
|
|
|
int16 deltaX;
|
|
|
|
int16 deltaY;
|
|
|
|
int16 flags;
|
|
|
|
int16 frame;
|
|
|
|
int16 layer;
|
|
|
|
int16 animation;
|
2006-01-05 16:06:55 +00:00
|
|
|
|
2009-06-22 10:29:32 +00:00
|
|
|
_vm->_game->_script->evalExpr(&deltaX);
|
|
|
|
_vm->_game->_script->evalExpr(&deltaY);
|
|
|
|
_vm->_game->_script->evalExpr(&animation);
|
|
|
|
_vm->_game->_script->evalExpr(&layer);
|
|
|
|
_vm->_game->_script->evalExpr(&frame);
|
2009-06-22 10:13:37 +00:00
|
|
|
flags = _vm->_game->_script->readInt16();
|
2007-03-20 14:51:57 +00:00
|
|
|
_vm->_scenery->updateAnim(layer, frame, animation, flags,
|
|
|
|
deltaX, deltaY, 1);
|
2006-01-05 16:06:55 +00:00
|
|
|
}
|
|
|
|
|
2007-03-20 14:51:57 +00:00
|
|
|
void Inter_v1::o1_initMult() {
|
|
|
|
int16 oldAnimHeight;
|
|
|
|
int16 oldAnimWidth;
|
|
|
|
int16 oldObjCount;
|
|
|
|
int16 posXVar;
|
|
|
|
int16 posYVar;
|
|
|
|
int16 animDataVar;
|
2006-01-05 16:06:55 +00:00
|
|
|
|
2007-03-20 14:51:57 +00:00
|
|
|
oldAnimWidth = _vm->_mult->_animWidth;
|
|
|
|
oldAnimHeight = _vm->_mult->_animHeight;
|
|
|
|
oldObjCount = _vm->_mult->_objCount;
|
2006-01-05 16:06:55 +00:00
|
|
|
|
2009-06-22 10:13:37 +00:00
|
|
|
_vm->_mult->_animLeft = _vm->_game->_script->readInt16();
|
|
|
|
_vm->_mult->_animTop = _vm->_game->_script->readInt16();
|
|
|
|
_vm->_mult->_animWidth = _vm->_game->_script->readInt16();
|
|
|
|
_vm->_mult->_animHeight = _vm->_game->_script->readInt16();
|
|
|
|
_vm->_mult->_objCount = _vm->_game->_script->readInt16();
|
|
|
|
posXVar = _vm->_game->_script->readVarIndex();
|
|
|
|
posYVar = _vm->_game->_script->readVarIndex();
|
|
|
|
animDataVar = _vm->_game->_script->readVarIndex();
|
2006-01-05 16:06:55 +00:00
|
|
|
|
2007-03-20 14:51:57 +00:00
|
|
|
if (_vm->_mult->_objects && (oldObjCount != _vm->_mult->_objCount)) {
|
|
|
|
warning("Initializing new objects without having "
|
|
|
|
"cleaned up the old ones at first");
|
2008-07-12 15:21:38 +00:00
|
|
|
|
|
|
|
for (int i = 0; i < _vm->_mult->_objCount; i++) {
|
|
|
|
delete _vm->_mult->_objects[i].pPosX;
|
|
|
|
delete _vm->_mult->_objects[i].pPosY;
|
|
|
|
}
|
|
|
|
|
2007-03-20 14:51:57 +00:00
|
|
|
delete[] _vm->_mult->_objects;
|
|
|
|
delete[] _vm->_mult->_renderData;
|
2008-07-12 15:21:38 +00:00
|
|
|
|
2007-03-20 14:51:57 +00:00
|
|
|
_vm->_mult->_objects = 0;
|
|
|
|
_vm->_mult->_renderObjs = 0;
|
2008-07-12 15:21:38 +00:00
|
|
|
|
2007-03-20 14:51:57 +00:00
|
|
|
}
|
2007-03-19 12:52:18 +00:00
|
|
|
|
2007-03-20 14:51:57 +00:00
|
|
|
if (_vm->_mult->_objects == 0) {
|
|
|
|
_vm->_mult->_renderData = new int16[_vm->_mult->_objCount * 9];
|
|
|
|
memset(_vm->_mult->_renderData, 0,
|
|
|
|
_vm->_mult->_objCount * 9 * sizeof(int16));
|
|
|
|
_vm->_mult->_objects = new Mult::Mult_Object[_vm->_mult->_objCount];
|
|
|
|
memset(_vm->_mult->_objects, 0,
|
|
|
|
_vm->_mult->_objCount * sizeof(Mult::Mult_Object));
|
2006-01-05 16:06:55 +00:00
|
|
|
|
2007-03-20 14:51:57 +00:00
|
|
|
for (int i = 0; i < _vm->_mult->_objCount; i++) {
|
2008-05-28 21:15:11 +00:00
|
|
|
uint32 offPosX = i * 4 + (posXVar / 4) * 4;
|
|
|
|
uint32 offPosY = i * 4 + (posYVar / 4) * 4;
|
|
|
|
uint32 offAnim = animDataVar + i * 4 * _vm->_global->_inter_animDataSize;
|
|
|
|
|
2009-06-22 10:13:37 +00:00
|
|
|
_vm->_mult->_objects[i].pPosX = new VariableReference(*_variables, offPosX);
|
|
|
|
_vm->_mult->_objects[i].pPosY = new VariableReference(*_variables, offPosY);
|
2006-01-05 16:06:55 +00:00
|
|
|
|
2007-03-20 14:51:57 +00:00
|
|
|
_vm->_mult->_objects[i].pAnimData =
|
2010-05-17 22:46:53 +00:00
|
|
|
(Mult::Mult_AnimData *)_variables->getAddressOff8(offAnim);
|
2006-01-05 16:06:55 +00:00
|
|
|
|
2007-03-20 14:51:57 +00:00
|
|
|
_vm->_mult->_objects[i].pAnimData->isStatic = 1;
|
|
|
|
_vm->_mult->_objects[i].tick = 0;
|
|
|
|
_vm->_mult->_objects[i].lastLeft = -1;
|
|
|
|
_vm->_mult->_objects[i].lastRight = -1;
|
|
|
|
_vm->_mult->_objects[i].lastTop = -1;
|
|
|
|
_vm->_mult->_objects[i].lastBottom = -1;
|
|
|
|
}
|
2006-01-05 16:06:55 +00:00
|
|
|
}
|
|
|
|
|
2007-03-20 14:51:57 +00:00
|
|
|
if (_vm->_mult->_animSurf &&
|
|
|
|
((oldAnimWidth != _vm->_mult->_animWidth) ||
|
|
|
|
(oldAnimHeight != _vm->_mult->_animHeight))) {
|
2010-08-08 00:35:18 +00:00
|
|
|
_vm->_draw->freeSprite(Draw::kAnimSurface);
|
2009-06-06 20:03:13 +00:00
|
|
|
_vm->_mult->_animSurf.reset();
|
2007-03-20 14:51:57 +00:00
|
|
|
}
|
2006-01-05 16:06:55 +00:00
|
|
|
|
2007-03-20 14:51:57 +00:00
|
|
|
if (!_vm->_mult->_animSurf) {
|
2010-08-08 00:35:18 +00:00
|
|
|
_vm->_draw->initSpriteSurf(Draw::kAnimSurface, _vm->_mult->_animWidth,
|
2007-03-20 14:51:57 +00:00
|
|
|
_vm->_mult->_animHeight, 0);
|
2010-08-08 00:35:18 +00:00
|
|
|
_vm->_mult->_animSurf = _vm->_draw->_spritesArray[Draw::kAnimSurface];
|
2007-03-20 14:51:57 +00:00
|
|
|
}
|
2006-01-05 16:06:55 +00:00
|
|
|
|
2010-09-30 13:02:16 +00:00
|
|
|
_vm->_mult->_animSurf->blit(*_vm->_draw->_backSurface,
|
2007-03-20 14:51:57 +00:00
|
|
|
_vm->_mult->_animLeft, _vm->_mult->_animTop,
|
|
|
|
_vm->_mult->_animLeft + _vm->_mult->_animWidth - 1,
|
2010-09-30 13:02:16 +00:00
|
|
|
_vm->_mult->_animTop + _vm->_mult->_animHeight - 1, 0, 0);
|
2006-01-05 16:06:55 +00:00
|
|
|
|
2007-03-20 14:51:57 +00:00
|
|
|
debugC(4, kDebugGraphics, "o1_initMult: x = %d, y = %d, w = %d, h = %d",
|
|
|
|
_vm->_mult->_animLeft, _vm->_mult->_animTop,
|
|
|
|
_vm->_mult->_animWidth, _vm->_mult->_animHeight);
|
|
|
|
debugC(4, kDebugGraphics, " _vm->_mult->_objCount = %d, "
|
|
|
|
"animation data size = %d", _vm->_mult->_objCount,
|
|
|
|
_vm->_global->_inter_animDataSize);
|
|
|
|
}
|
2006-01-05 16:06:55 +00:00
|
|
|
|
2007-03-20 14:51:57 +00:00
|
|
|
void Inter_v1::o1_freeMult() {
|
|
|
|
_vm->_mult->freeMult();
|
2006-01-05 16:06:55 +00:00
|
|
|
}
|
|
|
|
|
2007-03-20 14:51:57 +00:00
|
|
|
void Inter_v1::o1_animate() {
|
|
|
|
_vm->_mult->animate();
|
|
|
|
}
|
2006-01-05 16:06:55 +00:00
|
|
|
|
2007-03-20 14:51:57 +00:00
|
|
|
void Inter_v1::o1_loadMultObject() {
|
|
|
|
int16 val;
|
|
|
|
int16 objIndex;
|
2007-04-02 11:05:09 +00:00
|
|
|
byte *multData;
|
2006-01-05 16:06:55 +00:00
|
|
|
|
2009-06-22 10:29:32 +00:00
|
|
|
_vm->_game->_script->evalExpr(&objIndex);
|
|
|
|
_vm->_game->_script->evalExpr(&val);
|
2007-03-20 14:51:57 +00:00
|
|
|
*_vm->_mult->_objects[objIndex].pPosX = val;
|
2009-06-22 10:29:32 +00:00
|
|
|
_vm->_game->_script->evalExpr(&val);
|
2007-03-20 14:51:57 +00:00
|
|
|
*_vm->_mult->_objects[objIndex].pPosY = val;
|
2006-01-05 16:06:55 +00:00
|
|
|
|
2007-03-20 14:51:57 +00:00
|
|
|
debugC(4, kDebugGameFlow, "Loading mult object %d", objIndex);
|
2006-01-05 16:06:55 +00:00
|
|
|
|
2010-05-17 22:46:53 +00:00
|
|
|
multData = (byte *)_vm->_mult->_objects[objIndex].pAnimData;
|
2007-03-20 14:51:57 +00:00
|
|
|
for (int i = 0; i < 11; i++) {
|
2009-06-22 10:13:37 +00:00
|
|
|
if (_vm->_game->_script->peekUint16() != 99) {
|
2009-06-22 10:29:32 +00:00
|
|
|
_vm->_game->_script->evalExpr(&val);
|
2007-03-20 14:51:57 +00:00
|
|
|
multData[i] = val;
|
2006-06-04 17:24:03 +00:00
|
|
|
} else
|
2009-06-22 10:13:37 +00:00
|
|
|
_vm->_game->_script->skip(1);
|
2006-01-05 16:06:55 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2007-03-20 14:51:57 +00:00
|
|
|
void Inter_v1::o1_getAnimLayerInfo() {
|
|
|
|
int16 anim;
|
|
|
|
int16 layer;
|
|
|
|
int16 varDX, varDY;
|
|
|
|
int16 varUnk0;
|
|
|
|
int16 varFrames;
|
2006-01-05 16:06:55 +00:00
|
|
|
|
2009-06-22 10:29:32 +00:00
|
|
|
_vm->_game->_script->evalExpr(&anim);
|
|
|
|
_vm->_game->_script->evalExpr(&layer);
|
2006-01-05 16:06:55 +00:00
|
|
|
|
2009-06-22 10:13:37 +00:00
|
|
|
varDX = _vm->_game->_script->readVarIndex();
|
|
|
|
varDY = _vm->_game->_script->readVarIndex();
|
|
|
|
varUnk0 = _vm->_game->_script->readVarIndex();
|
|
|
|
varFrames = _vm->_game->_script->readVarIndex();
|
2006-01-05 16:06:55 +00:00
|
|
|
|
2007-03-20 14:51:57 +00:00
|
|
|
_vm->_scenery->writeAnimLayerInfo(anim, layer,
|
|
|
|
varDX, varDY, varUnk0, varFrames);
|
|
|
|
}
|
2006-01-05 16:06:55 +00:00
|
|
|
|
2007-03-20 14:51:57 +00:00
|
|
|
void Inter_v1::o1_getObjAnimSize() {
|
|
|
|
int16 objIndex;
|
2006-01-05 16:06:55 +00:00
|
|
|
|
2009-06-22 10:29:32 +00:00
|
|
|
_vm->_game->_script->evalExpr(&objIndex);
|
2006-01-05 16:06:55 +00:00
|
|
|
|
2009-08-24 22:37:09 +00:00
|
|
|
uint16 varLeft = _vm->_game->_script->readVarIndex();
|
|
|
|
uint16 varTop = _vm->_game->_script->readVarIndex();
|
|
|
|
uint16 varRight = _vm->_game->_script->readVarIndex();
|
|
|
|
uint16 varBottom = _vm->_game->_script->readVarIndex();
|
|
|
|
|
|
|
|
if ((objIndex < 0) || (objIndex >= _vm->_mult->_objCount)) {
|
|
|
|
warning("o1_getObjAnimSize(): objIndex = %d (%d)", objIndex, _vm->_mult->_objCount);
|
|
|
|
_vm->_scenery->_toRedrawLeft = 0;
|
|
|
|
_vm->_scenery->_toRedrawTop = 0;
|
|
|
|
_vm->_scenery->_toRedrawRight = 0;
|
|
|
|
_vm->_scenery->_toRedrawBottom = 0;
|
|
|
|
} else {
|
|
|
|
Mult::Mult_AnimData &animData = *(_vm->_mult->_objects[objIndex].pAnimData);
|
|
|
|
if (animData.isStatic == 0)
|
|
|
|
_vm->_scenery->updateAnim(animData.layer, animData.frame,
|
|
|
|
animData.animation, 0, *(_vm->_mult->_objects[objIndex].pPosX),
|
|
|
|
*(_vm->_mult->_objects[objIndex].pPosY), 0);
|
|
|
|
|
|
|
|
_vm->_scenery->_toRedrawLeft = MAX<int16>(_vm->_scenery->_toRedrawLeft, 0);
|
|
|
|
_vm->_scenery->_toRedrawTop = MAX<int16>(_vm->_scenery->_toRedrawTop , 0);
|
|
|
|
}
|
|
|
|
|
|
|
|
WRITE_VAR_OFFSET(varLeft , _vm->_scenery->_toRedrawLeft);
|
|
|
|
WRITE_VAR_OFFSET(varTop , _vm->_scenery->_toRedrawTop);
|
|
|
|
WRITE_VAR_OFFSET(varRight , _vm->_scenery->_toRedrawRight);
|
|
|
|
WRITE_VAR_OFFSET(varBottom, _vm->_scenery->_toRedrawBottom);
|
2006-01-05 16:06:55 +00:00
|
|
|
}
|
|
|
|
|
2007-03-20 14:51:57 +00:00
|
|
|
void Inter_v1::o1_loadStatic() {
|
|
|
|
_vm->_scenery->loadStatic(0);
|
2006-01-05 16:06:55 +00:00
|
|
|
}
|
|
|
|
|
2007-03-20 14:51:57 +00:00
|
|
|
void Inter_v1::o1_freeStatic() {
|
|
|
|
_vm->_scenery->freeStatic(-1);
|
2006-01-05 16:06:55 +00:00
|
|
|
}
|
|
|
|
|
2007-03-20 14:51:57 +00:00
|
|
|
void Inter_v1::o1_renderStatic() {
|
|
|
|
int16 layer;
|
|
|
|
int16 index;
|
2006-01-05 16:06:55 +00:00
|
|
|
|
2009-06-22 10:29:32 +00:00
|
|
|
_vm->_game->_script->evalExpr(&index);
|
|
|
|
_vm->_game->_script->evalExpr(&layer);
|
2007-03-20 14:51:57 +00:00
|
|
|
_vm->_scenery->renderStatic(index, layer);
|
2006-01-05 16:06:55 +00:00
|
|
|
}
|
|
|
|
|
2007-03-20 14:51:57 +00:00
|
|
|
void Inter_v1::o1_loadCurLayer() {
|
2009-06-22 10:29:32 +00:00
|
|
|
_vm->_game->_script->evalExpr(&_vm->_scenery->_curStatic);
|
|
|
|
_vm->_game->_script->evalExpr(&_vm->_scenery->_curStaticLayer);
|
2006-01-05 16:06:55 +00:00
|
|
|
}
|
|
|
|
|
2007-03-20 14:51:57 +00:00
|
|
|
void Inter_v1::o1_playCDTrack() {
|
2008-05-08 00:47:23 +00:00
|
|
|
_vm->_sound->adlibPlayBgMusic(); // Mac version
|
2011-01-29 22:47:53 +00:00
|
|
|
_vm->_sound->cdPlay(_vm->_game->_script->evalString()); // PC CD version
|
2006-01-05 16:06:55 +00:00
|
|
|
}
|
|
|
|
|
2007-03-20 14:51:57 +00:00
|
|
|
void Inter_v1::o1_getCDTrackPos() {
|
|
|
|
// Used in gob1 CD
|
2006-01-05 16:06:55 +00:00
|
|
|
|
2007-03-20 14:51:57 +00:00
|
|
|
// Some scripts busy-wait while calling this opcode.
|
|
|
|
// This is a very nasty thing to do, so let's add a
|
|
|
|
// short delay here. It's probably a safe thing to do.
|
2006-01-05 16:06:55 +00:00
|
|
|
|
2007-03-20 14:51:57 +00:00
|
|
|
_vm->_util->longDelay(1);
|
2006-01-05 16:06:55 +00:00
|
|
|
|
2008-05-08 00:47:23 +00:00
|
|
|
int pos = _vm->_sound->cdGetTrackPos();
|
2007-03-20 14:51:57 +00:00
|
|
|
if (pos == -1)
|
|
|
|
pos = 32767;
|
|
|
|
WRITE_VAR(5, pos);
|
2006-01-05 16:06:55 +00:00
|
|
|
}
|
|
|
|
|
2007-03-20 14:51:57 +00:00
|
|
|
void Inter_v1::o1_stopCD() {
|
2008-05-08 00:47:23 +00:00
|
|
|
_vm->_sound->adlibStop(); // Mac version
|
|
|
|
_vm->_sound->cdStop(); // PC CD version
|
2006-01-05 16:06:55 +00:00
|
|
|
}
|
|
|
|
|
2007-03-20 14:51:57 +00:00
|
|
|
void Inter_v1::o1_loadFontToSprite() {
|
2009-06-22 10:13:37 +00:00
|
|
|
int16 i = _vm->_game->_script->readInt16();
|
|
|
|
_vm->_draw->_fontToSprite[i].sprite = _vm->_game->_script->readInt16();
|
|
|
|
_vm->_draw->_fontToSprite[i].base = _vm->_game->_script->readInt16();
|
|
|
|
_vm->_draw->_fontToSprite[i].width = _vm->_game->_script->readInt16();
|
|
|
|
_vm->_draw->_fontToSprite[i].height = _vm->_game->_script->readInt16();
|
2006-01-05 16:06:55 +00:00
|
|
|
}
|
|
|
|
|
2007-03-20 14:51:57 +00:00
|
|
|
void Inter_v1::o1_freeFontToSprite() {
|
2009-06-22 10:13:37 +00:00
|
|
|
int16 i = _vm->_game->_script->readInt16();
|
2007-03-20 14:51:57 +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;
|
2006-01-05 16:06:55 +00:00
|
|
|
}
|
|
|
|
|
2011-01-29 22:44:06 +00:00
|
|
|
void Inter_v1::o1_callSub(OpFuncParams ¶ms) {
|
2009-06-22 10:14:18 +00:00
|
|
|
uint16 offset = _vm->_game->_script->readUint16();
|
2006-01-05 16:06:55 +00:00
|
|
|
|
2007-03-20 14:51:57 +00:00
|
|
|
debugC(5, kDebugGameFlow, "tot = \"%s\", offset = %d",
|
2011-01-29 22:45:15 +00:00
|
|
|
_vm->_game->_curTotFile.c_str(), offset);
|
2006-01-05 16:06:55 +00:00
|
|
|
|
2007-04-05 13:37:20 +00:00
|
|
|
if (offset < 128) {
|
|
|
|
warning("Inter_v1::o1_callSub(): Offset %d points into the header. "
|
|
|
|
"Skipping call", offset);
|
2011-01-29 22:44:06 +00:00
|
|
|
return;
|
2007-04-05 13:37:20 +00:00
|
|
|
}
|
|
|
|
|
2007-03-20 14:51:57 +00:00
|
|
|
// Skipping the copy protection screen in Gobliiins
|
2011-01-29 22:45:15 +00:00
|
|
|
if (!_vm->_copyProtection && (_vm->getGameType() == kGameTypeGob1) && (offset == 3905) &&
|
2011-01-29 22:45:51 +00:00
|
|
|
_vm->isCurrentTot(_vm->_startTot)) {
|
2007-03-20 14:51:57 +00:00
|
|
|
debugC(2, kDebugGameFlow, "Skipping copy protection screen");
|
2011-01-29 22:44:06 +00:00
|
|
|
return;
|
2007-03-20 14:51:57 +00:00
|
|
|
}
|
|
|
|
// Skipping the copy protection screen in Gobliins 2
|
2011-01-29 22:45:15 +00:00
|
|
|
if (!_vm->_copyProtection && (_vm->getGameType() == kGameTypeGob2) && (offset == 1746) &&
|
2011-01-29 22:45:51 +00:00
|
|
|
_vm->isCurrentTot("intro0.tot")) {
|
2007-03-20 14:51:57 +00:00
|
|
|
debugC(2, kDebugGameFlow, "Skipping copy protection screen");
|
2011-01-29 22:44:06 +00:00
|
|
|
return;
|
2007-03-20 14:51:57 +00:00
|
|
|
}
|
2006-01-05 16:06:55 +00:00
|
|
|
|
2009-06-22 10:14:18 +00:00
|
|
|
_vm->_game->_script->call(offset);
|
2006-01-05 16:06:55 +00:00
|
|
|
|
2009-06-22 10:14:18 +00:00
|
|
|
if ((params.counter == params.cmdCount) && (params.retFlag == 2)) {
|
|
|
|
_vm->_game->_script->pop(false);
|
2011-01-29 22:44:06 +00:00
|
|
|
params.doReturn = true;
|
|
|
|
return;
|
2009-06-22 10:14:18 +00:00
|
|
|
}
|
2006-01-05 16:06:55 +00:00
|
|
|
|
2007-03-20 14:51:57 +00:00
|
|
|
callSub(2);
|
2009-06-22 10:13:37 +00:00
|
|
|
|
2009-06-22 10:14:18 +00:00
|
|
|
_vm->_game->_script->pop();
|
2006-01-05 16:06:55 +00:00
|
|
|
}
|
|
|
|
|
2011-01-29 22:44:06 +00:00
|
|
|
void Inter_v1::o1_printTotText(OpFuncParams ¶ms) {
|
2009-06-22 10:13:37 +00:00
|
|
|
_vm->_draw->printTotText(_vm->_game->_script->readInt16());
|
2006-01-05 16:06:55 +00:00
|
|
|
}
|
|
|
|
|
2011-01-29 22:44:06 +00:00
|
|
|
void Inter_v1::o1_loadCursor(OpFuncParams ¶ms) {
|
2009-06-24 21:49:37 +00:00
|
|
|
int16 id = _vm->_game->_script->readInt16();
|
|
|
|
int8 index = _vm->_game->_script->readInt8();
|
2007-07-25 20:36:14 +00:00
|
|
|
|
|
|
|
if ((index * _vm->_draw->_cursorWidth) >= _vm->_draw->_cursorSprites->getWidth())
|
2011-01-29 22:44:06 +00:00
|
|
|
return;
|
2007-07-25 20:36:14 +00:00
|
|
|
|
2009-06-24 21:49:37 +00:00
|
|
|
Resource *resource = _vm->_game->_resources->getResource(id);
|
|
|
|
if (!resource)
|
2011-01-29 22:44:06 +00:00
|
|
|
return;
|
2006-01-05 16:06:55 +00:00
|
|
|
|
2010-09-30 13:02:16 +00:00
|
|
|
_vm->_draw->_cursorSprites->fillRect(index * _vm->_draw->_cursorWidth, 0,
|
2007-03-20 14:51:57 +00:00
|
|
|
index * _vm->_draw->_cursorWidth + _vm->_draw->_cursorWidth - 1,
|
|
|
|
_vm->_draw->_cursorHeight - 1, 0);
|
2006-01-05 16:06:55 +00:00
|
|
|
|
2009-06-24 21:49:37 +00:00
|
|
|
_vm->_video->drawPackedSprite(resource->getData(),
|
|
|
|
resource->getWidth(), resource->getHeight(),
|
2009-06-06 20:03:13 +00:00
|
|
|
index * _vm->_draw->_cursorWidth, 0, 0, *_vm->_draw->_cursorSprites);
|
2006-01-07 22:28:54 +00:00
|
|
|
_vm->_draw->_cursorAnimLow[index] = 0;
|
2006-01-05 16:06:55 +00:00
|
|
|
|
2009-06-24 21:49:37 +00:00
|
|
|
delete resource;
|
2006-01-05 16:06:55 +00:00
|
|
|
}
|
|
|
|
|
2011-01-29 22:44:06 +00:00
|
|
|
void Inter_v1::o1_switch(OpFuncParams ¶ms) {
|
2009-06-22 10:13:37 +00:00
|
|
|
uint32 offset;
|
|
|
|
|
|
|
|
checkSwitchTable(offset);
|
2006-01-05 16:06:55 +00:00
|
|
|
|
2009-06-22 10:14:18 +00:00
|
|
|
_vm->_game->_script->call(offset);
|
2009-06-22 10:13:37 +00:00
|
|
|
|
|
|
|
if (offset == 0)
|
|
|
|
_vm->_game->_script->setFinished(true);
|
2006-01-05 16:06:55 +00:00
|
|
|
|
2009-06-22 10:14:18 +00:00
|
|
|
if ((params.counter == params.cmdCount) && (params.retFlag == 2)) {
|
|
|
|
_vm->_game->_script->pop(false);
|
2011-01-29 22:44:06 +00:00
|
|
|
params.doReturn = true;
|
|
|
|
return;
|
2009-06-22 10:14:18 +00:00
|
|
|
}
|
2007-02-06 14:42:05 +00:00
|
|
|
|
2007-03-20 14:51:57 +00:00
|
|
|
funcBlock(0);
|
2009-06-22 10:14:18 +00:00
|
|
|
|
|
|
|
_vm->_game->_script->pop();
|
2006-01-05 16:06:55 +00:00
|
|
|
}
|
|
|
|
|
2011-01-29 22:44:06 +00:00
|
|
|
void Inter_v1::o1_repeatUntil(OpFuncParams ¶ms) {
|
2006-01-05 16:06:55 +00:00
|
|
|
int16 size;
|
2007-03-20 14:51:57 +00:00
|
|
|
bool flag;
|
2006-01-05 16:06:55 +00:00
|
|
|
|
|
|
|
_nestLevel[0]++;
|
2009-06-22 10:13:37 +00:00
|
|
|
|
|
|
|
uint32 blockPos = _vm->_game->_script->pos();
|
2006-01-05 16:06:55 +00:00
|
|
|
|
|
|
|
do {
|
2009-06-22 10:13:37 +00:00
|
|
|
_vm->_game->_script->seek(blockPos);
|
|
|
|
size = _vm->_game->_script->peekUint16(2) + 2;
|
2006-01-05 16:06:55 +00:00
|
|
|
|
|
|
|
funcBlock(1);
|
2009-06-22 10:13:37 +00:00
|
|
|
|
|
|
|
_vm->_game->_script->seek(blockPos + size + 1);
|
|
|
|
|
2011-01-29 22:47:14 +00:00
|
|
|
flag = _vm->_game->_script->evalBool();
|
2008-09-30 12:27:38 +00:00
|
|
|
} while (!flag && !_break && !_terminate && !_vm->shouldQuit());
|
2006-01-05 16:06:55 +00:00
|
|
|
|
|
|
|
_nestLevel[0]--;
|
|
|
|
|
|
|
|
if (*_breakFromLevel > -1) {
|
2007-03-20 14:51:57 +00:00
|
|
|
_break = false;
|
2006-01-05 16:06:55 +00:00
|
|
|
*_breakFromLevel = -1;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2011-01-29 22:44:06 +00:00
|
|
|
void Inter_v1::o1_whileDo(OpFuncParams ¶ms) {
|
2007-03-20 14:51:57 +00:00
|
|
|
bool flag;
|
2006-01-05 16:06:55 +00:00
|
|
|
int16 size;
|
|
|
|
|
|
|
|
_nestLevel[0]++;
|
|
|
|
do {
|
2009-06-22 10:13:37 +00:00
|
|
|
uint32 startPos = _vm->_game->_script->pos();
|
|
|
|
|
2011-01-29 22:47:14 +00:00
|
|
|
flag = _vm->_game->_script->evalBool();
|
2006-01-05 16:06:55 +00:00
|
|
|
|
|
|
|
if (_terminate)
|
2011-01-29 22:44:06 +00:00
|
|
|
return;
|
2006-01-05 16:06:55 +00:00
|
|
|
|
2009-06-22 10:13:37 +00:00
|
|
|
uint32 blockPos = _vm->_game->_script->pos();
|
2006-01-05 16:06:55 +00:00
|
|
|
|
2009-06-22 10:13:37 +00:00
|
|
|
size = _vm->_game->_script->peekUint16(2) + 2;
|
2006-01-05 16:06:55 +00:00
|
|
|
|
2007-03-20 14:51:57 +00:00
|
|
|
if (flag) {
|
2006-01-05 16:06:55 +00:00
|
|
|
funcBlock(1);
|
2009-06-22 10:13:37 +00:00
|
|
|
_vm->_game->_script->seek(startPos);
|
2007-03-20 14:51:57 +00:00
|
|
|
} else
|
2009-06-22 10:13:37 +00:00
|
|
|
_vm->_game->_script->skip(size);
|
2006-01-05 16:06:55 +00:00
|
|
|
|
2008-09-30 12:27:38 +00:00
|
|
|
if (_break || _terminate || _vm->shouldQuit()) {
|
2009-06-22 10:13:37 +00:00
|
|
|
_vm->_game->_script->seek(blockPos);
|
|
|
|
_vm->_game->_script->skip(size);
|
2006-01-05 16:06:55 +00:00
|
|
|
break;
|
|
|
|
}
|
2007-03-20 14:51:57 +00:00
|
|
|
} while (flag);
|
2006-01-05 16:06:55 +00:00
|
|
|
|
|
|
|
_nestLevel[0]--;
|
|
|
|
if (*_breakFromLevel > -1) {
|
2007-03-20 14:51:57 +00:00
|
|
|
_break = false;
|
2006-01-05 16:06:55 +00:00
|
|
|
*_breakFromLevel = -1;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2011-01-29 22:44:06 +00:00
|
|
|
void Inter_v1::o1_if(OpFuncParams ¶ms) {
|
2007-03-20 14:51:57 +00:00
|
|
|
byte cmd;
|
|
|
|
bool boolRes;
|
2007-09-19 08:40:12 +00:00
|
|
|
|
2010-11-04 06:28:51 +00:00
|
|
|
// WORKAROUND: Gob1 goblin stuck on reload bugs present in original - bugs #3018918 and 3065914
|
|
|
|
if ((_vm->getGameType() == kGameTypeGob1) && (_vm->_game->_script->pos() == 2933) &&
|
2011-01-29 22:45:51 +00:00
|
|
|
_vm->isCurrentTot("inter.tot") && VAR(285) != 0) {
|
2010-11-04 06:28:51 +00:00
|
|
|
warning("Workaround for Gob1 Goblin Stuck On Reload Bug applied...");
|
|
|
|
// VAR(59) actually locks goblin movement, but these variables trigger this in the script.
|
2010-06-29 03:53:06 +00:00
|
|
|
WRITE_VAR(285, 0);
|
|
|
|
}
|
|
|
|
|
2011-01-29 22:47:14 +00:00
|
|
|
boolRes = _vm->_game->_script->evalBool();
|
2007-03-20 14:51:57 +00:00
|
|
|
if (boolRes) {
|
2011-01-29 22:44:06 +00:00
|
|
|
if ((params.counter == params.cmdCount) && (params.retFlag == 2)) {
|
|
|
|
params.doReturn = true;
|
|
|
|
return;
|
|
|
|
}
|
2006-01-05 16:06:55 +00:00
|
|
|
|
2009-06-22 10:14:18 +00:00
|
|
|
_vm->_game->_script->push();
|
2007-03-20 14:51:57 +00:00
|
|
|
funcBlock(0);
|
2009-06-22 10:14:18 +00:00
|
|
|
_vm->_game->_script->pop();
|
2009-06-22 10:13:37 +00:00
|
|
|
|
|
|
|
_vm->_game->_script->skip(_vm->_game->_script->peekUint16(2) + 2);
|
2006-05-29 18:24:52 +00:00
|
|
|
|
2011-01-18 07:02:42 +00:00
|
|
|
debugC(6, kDebugGameFlow, "cmd = %d", (int16) _vm->_game->_script->peekByte());
|
2006-01-05 16:06:55 +00:00
|
|
|
|
2009-06-22 10:13:37 +00:00
|
|
|
cmd = _vm->_game->_script->readByte() >> 4;
|
2007-03-20 14:51:57 +00:00
|
|
|
if (cmd != 12)
|
2011-01-29 22:44:06 +00:00
|
|
|
return;
|
2006-02-16 20:25:59 +00:00
|
|
|
|
2009-06-22 10:13:37 +00:00
|
|
|
_vm->_game->_script->skip(_vm->_game->_script->peekUint16(2) + 2);
|
2007-03-20 14:51:57 +00:00
|
|
|
} else {
|
2009-06-22 10:13:37 +00:00
|
|
|
_vm->_game->_script->skip(_vm->_game->_script->peekUint16(2) + 2);
|
2006-02-16 20:25:59 +00:00
|
|
|
|
2011-01-18 07:02:42 +00:00
|
|
|
debugC(6, kDebugGameFlow, "cmd = %d", (int16) _vm->_game->_script->peekByte());
|
2006-02-16 20:25:59 +00:00
|
|
|
|
2009-06-22 10:13:37 +00:00
|
|
|
cmd = _vm->_game->_script->readByte() >> 4;
|
2007-03-20 14:51:57 +00:00
|
|
|
if (cmd != 12)
|
2011-01-29 22:44:06 +00:00
|
|
|
return;
|
2006-02-16 20:25:59 +00:00
|
|
|
|
2011-01-29 22:44:06 +00:00
|
|
|
if ((params.counter == params.cmdCount) && (params.retFlag == 2)) {
|
|
|
|
params.doReturn = true;
|
|
|
|
return;
|
|
|
|
}
|
2006-02-16 20:25:59 +00:00
|
|
|
|
2009-06-22 10:14:18 +00:00
|
|
|
_vm->_game->_script->push();
|
2007-03-20 14:51:57 +00:00
|
|
|
funcBlock(0);
|
2009-06-22 10:14:18 +00:00
|
|
|
_vm->_game->_script->pop();
|
2009-06-22 10:13:37 +00:00
|
|
|
|
|
|
|
_vm->_game->_script->skip(_vm->_game->_script->peekUint16(2) + 2);
|
2006-02-16 20:25:59 +00:00
|
|
|
}
|
2007-03-20 14:51:57 +00:00
|
|
|
}
|
2006-02-16 20:25:59 +00:00
|
|
|
|
2011-01-29 22:44:06 +00:00
|
|
|
void Inter_v1::o1_assign(OpFuncParams ¶ms) {
|
2009-06-22 10:13:37 +00:00
|
|
|
byte destType = _vm->_game->_script->peekByte();
|
|
|
|
int16 dest = _vm->_game->_script->readVarIndex();
|
2009-06-15 23:08:28 +00:00
|
|
|
|
2007-03-20 14:51:57 +00:00
|
|
|
int16 result;
|
2009-06-22 10:29:32 +00:00
|
|
|
int16 srcType = _vm->_game->_script->evalExpr(&result);
|
2006-02-16 20:25:59 +00:00
|
|
|
|
2009-06-15 23:09:37 +00:00
|
|
|
switch (destType) {
|
2009-06-15 23:09:23 +00:00
|
|
|
case TYPE_VAR_INT32:
|
|
|
|
case TYPE_ARRAY_INT32:
|
2009-06-22 10:13:37 +00:00
|
|
|
WRITE_VAR_OFFSET(dest, _vm->_game->_script->getResultInt());
|
2007-03-20 14:51:57 +00:00
|
|
|
break;
|
2006-02-16 20:25:59 +00:00
|
|
|
|
2009-06-15 23:09:23 +00:00
|
|
|
case TYPE_VAR_STR:
|
|
|
|
case TYPE_ARRAY_STR:
|
2009-06-15 23:09:37 +00:00
|
|
|
if (srcType == TYPE_IMM_INT16)
|
2009-06-15 23:08:28 +00:00
|
|
|
WRITE_VARO_UINT8(dest, result);
|
2007-03-20 14:51:57 +00:00
|
|
|
else
|
2009-06-22 10:13:37 +00:00
|
|
|
WRITE_VARO_STR(dest, _vm->_game->_script->getResultStr());
|
2007-03-20 14:51:57 +00:00
|
|
|
break;
|
2006-02-16 20:25:59 +00:00
|
|
|
|
2007-03-20 14:51:57 +00:00
|
|
|
}
|
2006-01-05 16:06:55 +00:00
|
|
|
}
|
|
|
|
|
2011-01-29 22:44:06 +00:00
|
|
|
void Inter_v1::o1_loadSpriteToPos(OpFuncParams ¶ms) {
|
2009-06-22 10:13:37 +00:00
|
|
|
_vm->_draw->_spriteLeft = _vm->_game->_script->readInt16();
|
2006-01-05 16:06:55 +00:00
|
|
|
|
2009-06-22 10:13:37 +00:00
|
|
|
_vm->_draw->_destSpriteX = _vm->_game->_script->readValExpr();
|
2009-07-05 12:52:14 +00:00
|
|
|
|
|
|
|
// WORKAROUND: The EGA version of Gobliiins 1 has an invalid expression there
|
|
|
|
if (_vm->isEGA() && (_vm->_game->_script->pos() == 1398) &&
|
2011-01-29 22:45:51 +00:00
|
|
|
_vm->isCurrentTot("intro.tot")) {
|
2009-07-05 12:52:14 +00:00
|
|
|
|
|
|
|
_vm->_draw->_destSpriteY = 0;
|
|
|
|
_vm->_game->_script->skip(1);
|
|
|
|
|
|
|
|
} else
|
|
|
|
_vm->_draw->_destSpriteY = _vm->_game->_script->readValExpr();
|
2006-01-05 16:06:55 +00:00
|
|
|
|
2009-06-22 10:13:37 +00:00
|
|
|
_vm->_draw->_transparency = _vm->_game->_script->peekByte() & 1;
|
|
|
|
_vm->_draw->_destSurface = ((int16) (_vm->_game->_script->peekByte() >> 1)) - 1;
|
2007-03-20 14:51:57 +00:00
|
|
|
if (_vm->_draw->_destSurface < 0)
|
|
|
|
_vm->_draw->_destSurface = 101;
|
2006-01-05 16:06:55 +00:00
|
|
|
|
2009-06-22 10:13:37 +00:00
|
|
|
_vm->_game->_script->skip(2);
|
2006-01-05 16:06:55 +00:00
|
|
|
|
2007-03-20 14:51:57 +00:00
|
|
|
_vm->_draw->spriteOperation(DRAW_LOADSPRITE);
|
2006-01-05 16:06:55 +00:00
|
|
|
}
|
|
|
|
|
2011-01-29 22:44:06 +00:00
|
|
|
void Inter_v1::o1_printText(OpFuncParams ¶ms) {
|
2007-03-20 14:51:57 +00:00
|
|
|
char buf[60];
|
|
|
|
int i;
|
2006-01-05 16:06:55 +00:00
|
|
|
|
2009-06-22 10:13:37 +00:00
|
|
|
_vm->_draw->_destSpriteX = _vm->_game->_script->readValExpr();
|
|
|
|
_vm->_draw->_destSpriteY = _vm->_game->_script->readValExpr();
|
2006-01-05 16:06:55 +00:00
|
|
|
|
2009-06-22 10:13:37 +00:00
|
|
|
_vm->_draw->_backColor = _vm->_game->_script->readValExpr();
|
|
|
|
_vm->_draw->_frontColor = _vm->_game->_script->readValExpr();
|
|
|
|
_vm->_draw->_fontIndex = _vm->_game->_script->readValExpr();
|
2010-08-08 00:35:18 +00:00
|
|
|
_vm->_draw->_destSurface = Draw::kBackSurface;
|
2007-03-20 14:51:57 +00:00
|
|
|
_vm->_draw->_textToPrint = buf;
|
|
|
|
_vm->_draw->_transparency = 0;
|
2006-04-14 18:18:46 +00:00
|
|
|
|
2007-03-20 14:51:57 +00:00
|
|
|
if (_vm->_draw->_backColor >= 16) {
|
|
|
|
_vm->_draw->_backColor = 0;
|
|
|
|
_vm->_draw->_transparency = 1;
|
|
|
|
}
|
2006-01-05 16:06:55 +00:00
|
|
|
|
2007-03-20 14:51:57 +00:00
|
|
|
do {
|
2009-06-22 10:13:37 +00:00
|
|
|
for (i = 0; ((_vm->_game->_script->peekChar()) != '.') &&
|
|
|
|
(_vm->_game->_script->peekByte() != 200);
|
|
|
|
i++, _vm->_game->_script->skip(1)) {
|
|
|
|
buf[i] = _vm->_game->_script->peekChar();
|
2007-03-20 14:51:57 +00:00
|
|
|
}
|
2006-01-05 16:06:55 +00:00
|
|
|
|
2009-06-22 10:13:37 +00:00
|
|
|
if (_vm->_game->_script->peekByte() != 200) {
|
|
|
|
_vm->_game->_script->skip(1);
|
|
|
|
switch (_vm->_game->_script->peekByte()) {
|
2009-06-15 23:09:23 +00:00
|
|
|
case TYPE_VAR_INT32:
|
|
|
|
case TYPE_ARRAY_INT32:
|
2007-03-20 14:51:57 +00:00
|
|
|
sprintf(buf + i, "%d",
|
2009-06-22 10:13:37 +00:00
|
|
|
VAR_OFFSET(_vm->_game->_script->readVarIndex()));
|
2007-03-20 14:51:57 +00:00
|
|
|
break;
|
2006-01-05 16:06:55 +00:00
|
|
|
|
2009-06-15 23:09:23 +00:00
|
|
|
case TYPE_VAR_STR:
|
|
|
|
case TYPE_ARRAY_STR:
|
2007-03-20 14:51:57 +00:00
|
|
|
sprintf(buf + i, "%s",
|
2009-06-22 10:13:37 +00:00
|
|
|
GET_VARO_STR(_vm->_game->_script->readVarIndex()));
|
2007-03-20 14:51:57 +00:00
|
|
|
break;
|
|
|
|
}
|
2009-06-22 10:13:37 +00:00
|
|
|
_vm->_game->_script->skip(1);
|
2007-03-20 14:51:57 +00:00
|
|
|
} else
|
|
|
|
buf[i] = 0;
|
2006-01-05 16:06:55 +00:00
|
|
|
|
2007-03-20 14:51:57 +00:00
|
|
|
_vm->_draw->spriteOperation(DRAW_PRINTTEXT);
|
2009-06-22 10:13:37 +00:00
|
|
|
} while (_vm->_game->_script->peekByte() != 200);
|
2006-01-05 16:06:55 +00:00
|
|
|
|
2009-06-22 10:13:37 +00:00
|
|
|
_vm->_game->_script->skip(1);
|
2006-01-05 16:06:55 +00:00
|
|
|
}
|
|
|
|
|
2011-01-29 22:44:06 +00:00
|
|
|
void Inter_v1::o1_loadTot(OpFuncParams ¶ms) {
|
2009-06-22 10:13:37 +00:00
|
|
|
if ((_vm->_game->_script->peekByte() & 0x80) != 0) {
|
|
|
|
_vm->_game->_script->skip(1);
|
2011-01-29 22:47:53 +00:00
|
|
|
_vm->_game->_totToLoad = _vm->_game->_script->evalString();
|
2007-03-20 14:51:57 +00:00
|
|
|
} else {
|
2011-01-29 22:45:15 +00:00
|
|
|
uint8 size = _vm->_game->_script->readInt8();
|
|
|
|
_vm->_game->_totToLoad = Common::String(_vm->_game->_script->readString(size), size);
|
2006-04-13 16:25:07 +00:00
|
|
|
}
|
2006-04-18 09:59:18 +00:00
|
|
|
|
2011-01-29 22:45:15 +00:00
|
|
|
_vm->_game->_totToLoad += ".tot";
|
2009-04-21 21:44:37 +00:00
|
|
|
|
2007-03-20 14:51:57 +00:00
|
|
|
if (_terminate != 2)
|
|
|
|
_terminate = 1;
|
2006-01-05 16:06:55 +00:00
|
|
|
}
|
|
|
|
|
2011-01-29 22:44:06 +00:00
|
|
|
void Inter_v1::o1_palLoad(OpFuncParams ¶ms) {
|
2007-03-20 14:51:57 +00:00
|
|
|
int index1, index2;
|
2009-07-25 16:07:29 +00:00
|
|
|
int16 id;
|
2006-01-05 16:06:55 +00:00
|
|
|
byte cmd;
|
2009-06-24 21:49:37 +00:00
|
|
|
Resource *resource;
|
2006-08-12 09:16:08 +00:00
|
|
|
|
2009-06-22 10:13:37 +00:00
|
|
|
cmd = _vm->_game->_script->readByte();
|
2007-03-20 14:51:57 +00:00
|
|
|
switch (cmd & 0x7F) {
|
|
|
|
case 48:
|
|
|
|
if ((_vm->_global->_fakeVideoMode < 0x32) ||
|
|
|
|
(_vm->_global->_fakeVideoMode > 0x63)) {
|
2009-06-22 10:13:37 +00:00
|
|
|
_vm->_game->_script->skip(48);
|
2011-01-29 22:44:06 +00:00
|
|
|
return;
|
2007-03-20 14:51:57 +00:00
|
|
|
}
|
|
|
|
break;
|
2006-01-05 16:06:55 +00:00
|
|
|
|
2007-03-20 14:51:57 +00:00
|
|
|
case 49:
|
|
|
|
if ((_vm->_global->_fakeVideoMode != 5) &&
|
|
|
|
(_vm->_global->_fakeVideoMode != 7)) {
|
2009-06-22 10:13:37 +00:00
|
|
|
_vm->_game->_script->skip(18);
|
2011-01-29 22:44:06 +00:00
|
|
|
return;
|
2007-03-20 14:51:57 +00:00
|
|
|
}
|
|
|
|
break;
|
2006-01-05 16:06:55 +00:00
|
|
|
|
2007-03-20 14:51:57 +00:00
|
|
|
case 50:
|
|
|
|
if (_vm->_global->_colorCount == 256) {
|
2009-06-22 10:13:37 +00:00
|
|
|
_vm->_game->_script->skip(16);
|
2011-01-29 22:44:06 +00:00
|
|
|
return;
|
2007-03-20 14:51:57 +00:00
|
|
|
}
|
|
|
|
break;
|
2006-01-05 16:06:55 +00:00
|
|
|
|
2007-03-20 14:51:57 +00:00
|
|
|
case 51:
|
|
|
|
if (_vm->_global->_fakeVideoMode < 0x64) {
|
2009-06-22 10:13:37 +00:00
|
|
|
_vm->_game->_script->skip(2);
|
2011-01-29 22:44:06 +00:00
|
|
|
return;
|
2007-03-20 14:51:57 +00:00
|
|
|
}
|
|
|
|
break;
|
2006-01-05 16:06:55 +00:00
|
|
|
|
2007-03-20 14:51:57 +00:00
|
|
|
case 52:
|
|
|
|
if (_vm->_global->_colorCount == 256) {
|
2009-06-22 10:13:37 +00:00
|
|
|
_vm->_game->_script->skip(48);
|
2011-01-29 22:44:06 +00:00
|
|
|
return;
|
2007-03-20 14:51:57 +00:00
|
|
|
}
|
|
|
|
break;
|
2006-01-05 16:06:55 +00:00
|
|
|
|
2007-03-20 14:51:57 +00:00
|
|
|
case 53:
|
|
|
|
if (_vm->_global->_colorCount != 256) {
|
2009-06-22 10:13:37 +00:00
|
|
|
_vm->_game->_script->skip(2);
|
2011-01-29 22:44:06 +00:00
|
|
|
return;
|
2007-03-20 14:51:57 +00:00
|
|
|
}
|
|
|
|
break;
|
2006-01-05 16:06:55 +00:00
|
|
|
|
2007-03-20 14:51:57 +00:00
|
|
|
case 54:
|
|
|
|
if (_vm->_global->_fakeVideoMode < 0x13) {
|
2011-01-29 22:44:06 +00:00
|
|
|
return;
|
2007-03-20 14:51:57 +00:00
|
|
|
}
|
|
|
|
break;
|
2006-01-05 16:06:55 +00:00
|
|
|
|
2007-03-20 14:51:57 +00:00
|
|
|
case 61:
|
|
|
|
if (_vm->_global->_fakeVideoMode < 0x13) {
|
2009-06-22 10:13:37 +00:00
|
|
|
_vm->_game->_script->skip(4);
|
2011-01-29 22:44:06 +00:00
|
|
|
return;
|
2007-03-20 14:51:57 +00:00
|
|
|
}
|
|
|
|
break;
|
2006-01-05 16:06:55 +00:00
|
|
|
}
|
|
|
|
|
2007-03-20 14:51:57 +00:00
|
|
|
if ((cmd & 0x7F) == 0x30) {
|
2009-06-22 10:13:37 +00:00
|
|
|
_vm->_game->_script->skip(48);
|
2011-01-29 22:44:06 +00:00
|
|
|
return;
|
2007-03-20 14:51:57 +00:00
|
|
|
}
|
2006-02-02 21:12:00 +00:00
|
|
|
|
2007-03-20 14:51:57 +00:00
|
|
|
_vm->_draw->_applyPal = !(cmd & 0x80);
|
|
|
|
cmd &= 0x7F;
|
2006-02-02 21:12:00 +00:00
|
|
|
|
|
|
|
if (cmd == 49) {
|
2007-03-20 14:51:57 +00:00
|
|
|
bool allZero = true;
|
|
|
|
|
|
|
|
for (int i = 2; i < 18; i++) {
|
2009-06-22 10:13:37 +00:00
|
|
|
if (_vm->_game->_script->peekByte(i) != 0) {
|
2007-03-20 14:51:57 +00:00
|
|
|
allZero = false;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (!allZero) {
|
2010-09-30 13:02:16 +00:00
|
|
|
_vm->_draw->_frontSurface->clear();
|
2007-03-20 14:51:57 +00:00
|
|
|
_vm->_draw->_noInvalidated57 = true;
|
2009-06-22 10:13:37 +00:00
|
|
|
_vm->_game->_script->skip(48);
|
2011-01-29 22:44:06 +00:00
|
|
|
return;
|
2007-03-20 14:51:57 +00:00
|
|
|
}
|
|
|
|
_vm->_draw->_noInvalidated57 = false;
|
|
|
|
|
2009-06-22 10:13:37 +00:00
|
|
|
for (int i = 0; i < 18; i++) {
|
2006-02-02 21:12:00 +00:00
|
|
|
if (i < 2) {
|
2007-03-20 14:51:57 +00:00
|
|
|
if (!_vm->_draw->_applyPal)
|
2006-02-02 21:12:00 +00:00
|
|
|
continue;
|
|
|
|
|
2009-06-22 10:13:37 +00:00
|
|
|
_vm->_draw->_unusedPalette1[i] = _vm->_game->_script->peekByte();
|
2006-02-02 21:12:00 +00:00
|
|
|
continue;
|
|
|
|
}
|
|
|
|
|
2009-06-22 10:13:37 +00:00
|
|
|
index1 = _vm->_game->_script->peekByte() >> 4;
|
|
|
|
index2 = _vm->_game->_script->peekByte() & 0xF;
|
2006-02-02 21:12:00 +00:00
|
|
|
|
|
|
|
_vm->_draw->_unusedPalette1[i] =
|
2007-03-20 14:51:57 +00:00
|
|
|
((_vm->_draw->_palLoadData1[index1] +
|
|
|
|
_vm->_draw->_palLoadData2[index2]) << 8) +
|
|
|
|
(_vm->_draw->_palLoadData2[index1] +
|
|
|
|
_vm->_draw->_palLoadData1[index2]);
|
2009-06-22 10:13:37 +00:00
|
|
|
|
|
|
|
_vm->_game->_script->skip(1);
|
2006-02-02 21:12:00 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
_vm->_global->_pPaletteDesc->unused1 = _vm->_draw->_unusedPalette1;
|
2007-03-20 14:51:57 +00:00
|
|
|
_vm->_video->setFullPalette(_vm->_global->_pPaletteDesc);
|
2011-01-29 22:44:06 +00:00
|
|
|
return;
|
2006-02-02 21:12:00 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
switch (cmd) {
|
|
|
|
case 50:
|
2009-06-22 10:13:37 +00:00
|
|
|
for (int i = 0; i < 16; i++)
|
|
|
|
_vm->_draw->_unusedPalette2[i] = _vm->_game->_script->readByte();
|
2006-02-02 21:12:00 +00:00
|
|
|
break;
|
|
|
|
|
2007-03-20 14:51:57 +00:00
|
|
|
case 52:
|
2009-06-22 10:13:37 +00:00
|
|
|
for (int i = 0; i < 16; i++) {
|
|
|
|
_vm->_draw->_vgaPalette[i].red = _vm->_game->_script->readByte();
|
|
|
|
_vm->_draw->_vgaPalette[i].green = _vm->_game->_script->readByte();
|
|
|
|
_vm->_draw->_vgaPalette[i].blue = _vm->_game->_script->readByte();
|
2007-03-20 14:51:57 +00:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
2006-02-02 21:12:00 +00:00
|
|
|
case 53:
|
2009-06-24 21:49:37 +00:00
|
|
|
resource = _vm->_game->_resources->getResource(_vm->_game->_script->readInt16());
|
|
|
|
if (!resource)
|
|
|
|
break;
|
|
|
|
|
2010-05-17 22:46:53 +00:00
|
|
|
memcpy((char *)_vm->_draw->_vgaPalette, resource->getData(), MIN<int>(768, resource->getSize()));
|
2009-06-24 21:49:37 +00:00
|
|
|
delete resource;
|
2006-02-02 21:12:00 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case 54:
|
2010-05-17 22:46:53 +00:00
|
|
|
memset((char *)_vm->_draw->_vgaPalette, 0, 768);
|
2007-03-20 14:51:57 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case 61:
|
2009-06-22 10:13:37 +00:00
|
|
|
index1 = _vm->_game->_script->readByte();
|
|
|
|
index2 = (_vm->_game->_script->readByte() - index1 + 1) * 3;
|
2009-07-25 16:07:29 +00:00
|
|
|
id = _vm->_game->_script->readInt16();
|
|
|
|
resource = _vm->_game->_resources->getResource(id);
|
2009-06-24 21:49:37 +00:00
|
|
|
if (!resource)
|
|
|
|
break;
|
|
|
|
|
2010-05-17 22:46:53 +00:00
|
|
|
memcpy((char *)_vm->_draw->_vgaPalette + index1 * 3,
|
2009-06-24 21:49:37 +00:00
|
|
|
resource->getData() + index1 * 3, index2);
|
|
|
|
delete resource;
|
2007-03-20 14:51:57 +00:00
|
|
|
|
2009-07-25 16:07:29 +00:00
|
|
|
// WORKAROUND: The Last Dynasty overwrites the 0. palette entry but depends on it staying black.
|
|
|
|
if ((_vm->getGameType() == kGameTypeDynasty) && (index1 == 0)) {
|
|
|
|
_vm->_draw->_vgaPalette[0].red = 0;
|
|
|
|
_vm->_draw->_vgaPalette[0].green = 0;
|
|
|
|
_vm->_draw->_vgaPalette[0].blue = 0;
|
|
|
|
}
|
|
|
|
|
2007-03-20 14:51:57 +00:00
|
|
|
if (_vm->_draw->_applyPal) {
|
|
|
|
_vm->_draw->_applyPal = false;
|
|
|
|
_vm->_video->setFullPalette(_vm->_global->_pPaletteDesc);
|
2011-01-29 22:44:06 +00:00
|
|
|
return;
|
2007-03-20 14:51:57 +00:00
|
|
|
}
|
2006-02-02 21:12:00 +00:00
|
|
|
break;
|
|
|
|
}
|
2007-09-19 08:40:12 +00:00
|
|
|
|
2006-02-02 21:12:00 +00:00
|
|
|
if (!_vm->_draw->_applyPal) {
|
|
|
|
_vm->_global->_pPaletteDesc->unused2 = _vm->_draw->_unusedPalette2;
|
|
|
|
_vm->_global->_pPaletteDesc->unused1 = _vm->_draw->_unusedPalette1;
|
|
|
|
|
2007-03-20 14:51:57 +00:00
|
|
|
if (_vm->_global->_videoMode < 0x13) {
|
2007-08-03 15:18:00 +00:00
|
|
|
_vm->_global->_pPaletteDesc->vgaPal = _vm->_draw->_vgaPalette;
|
2007-03-20 14:51:57 +00:00
|
|
|
_vm->_palAnim->fade(_vm->_global->_pPaletteDesc, 0, 0);
|
2011-01-29 22:44:06 +00:00
|
|
|
return;
|
2007-03-20 14:51:57 +00:00
|
|
|
}
|
|
|
|
if ((_vm->_global->_videoMode < 0x32) ||
|
|
|
|
(_vm->_global->_videoMode >= 0x64)) {
|
|
|
|
_vm->_global->_pPaletteDesc->vgaPal = _vm->_draw->_vgaPalette;
|
|
|
|
_vm->_palAnim->fade(_vm->_global->_pPaletteDesc, 0, 0);
|
2011-01-29 22:44:06 +00:00
|
|
|
return;
|
2007-03-20 14:51:57 +00:00
|
|
|
}
|
|
|
|
_vm->_global->_pPaletteDesc->vgaPal = _vm->_draw->_vgaSmallPalette;
|
|
|
|
_vm->_palAnim->fade(_vm->_global->_pPaletteDesc, 0, 0);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2011-01-29 22:44:06 +00:00
|
|
|
void Inter_v1::o1_keyFunc(OpFuncParams ¶ms) {
|
2007-03-20 14:51:57 +00:00
|
|
|
static uint32 lastCalled = 0;
|
|
|
|
int16 cmd;
|
|
|
|
int16 key;
|
|
|
|
uint32 now;
|
|
|
|
|
2011-01-22 12:26:31 +00:00
|
|
|
if (!_vm->_vidPlayer->isPlayingLive()) {
|
|
|
|
_vm->_draw->forceBlit();
|
|
|
|
_vm->_video->retrace();
|
|
|
|
}
|
2010-09-30 13:02:16 +00:00
|
|
|
|
2009-06-22 10:13:37 +00:00
|
|
|
cmd = _vm->_game->_script->readInt16();
|
2007-03-20 14:51:57 +00:00
|
|
|
animPalette();
|
|
|
|
_vm->_draw->blitInvalidated();
|
|
|
|
|
|
|
|
now = _vm->_util->getTimeKey();
|
|
|
|
if (!_noBusyWait)
|
|
|
|
if ((now - lastCalled) <= 20)
|
|
|
|
_vm->_util->longDelay(1);
|
|
|
|
lastCalled = now;
|
|
|
|
_noBusyWait = false;
|
|
|
|
|
2007-06-26 08:01:32 +00:00
|
|
|
// WORKAROUND for bug #1726130: Ween busy-waits in the intro for a counter
|
|
|
|
// to become 5000. We deliberately slow down busy-waiting, so we shorten
|
|
|
|
// the counting, too.
|
2007-07-24 23:24:40 +00:00
|
|
|
if ((_vm->getGameType() == kGameTypeWeen) && (VAR(59) < 4000) &&
|
2011-01-29 22:45:51 +00:00
|
|
|
(_vm->_game->_script->pos() == 729) && _vm->isCurrentTot("intro5.tot"))
|
2007-06-25 16:16:34 +00:00
|
|
|
WRITE_VAR(59, 4000);
|
|
|
|
|
2007-03-20 14:51:57 +00:00
|
|
|
switch (cmd) {
|
2011-01-25 00:50:26 +00:00
|
|
|
case -1:
|
|
|
|
break;
|
|
|
|
|
2007-03-20 14:51:57 +00:00
|
|
|
case 0:
|
|
|
|
_vm->_draw->_showCursor &= ~2;
|
|
|
|
_vm->_util->longDelay(1);
|
2009-07-05 11:27:54 +00:00
|
|
|
key = _vm->_game->_hotspots->check(0, 0);
|
2007-03-20 14:51:57 +00:00
|
|
|
storeKey(key);
|
|
|
|
|
|
|
|
_vm->_util->clearKeyBuf();
|
|
|
|
break;
|
|
|
|
|
|
|
|
case 1:
|
2010-02-08 23:12:42 +00:00
|
|
|
if (_vm->getGameType() != kGameTypeFascination)
|
|
|
|
_vm->_util->forceMouseUp(true);
|
2007-03-20 14:51:57 +00:00
|
|
|
key = _vm->_game->checkKeys(&_vm->_global->_inter_mouseX,
|
|
|
|
&_vm->_global->_inter_mouseY, &_vm->_game->_mouseButtons, 0);
|
|
|
|
storeKey(key);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case 2:
|
2007-04-21 20:13:15 +00:00
|
|
|
_vm->_util->processInput(true);
|
|
|
|
key = _vm->_util->checkKey();
|
2007-03-20 14:51:57 +00:00
|
|
|
|
|
|
|
WRITE_VAR(0, key);
|
|
|
|
_vm->_util->clearKeyBuf();
|
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
2008-05-08 00:47:23 +00:00
|
|
|
_vm->_sound->speakerOnUpdate(cmd);
|
2007-03-20 14:51:57 +00:00
|
|
|
if (cmd < 20) {
|
|
|
|
_vm->_util->delay(cmd);
|
|
|
|
_noBusyWait = true;
|
|
|
|
} else
|
|
|
|
_vm->_util->longDelay(cmd);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2011-01-29 22:44:06 +00:00
|
|
|
void Inter_v1::o1_capturePush(OpFuncParams ¶ms) {
|
2007-03-20 14:51:57 +00:00
|
|
|
int16 left, top;
|
|
|
|
int16 width, height;
|
|
|
|
|
2009-06-22 10:13:37 +00:00
|
|
|
left = _vm->_game->_script->readValExpr();
|
|
|
|
top = _vm->_game->_script->readValExpr();
|
|
|
|
width = _vm->_game->_script->readValExpr();
|
|
|
|
height = _vm->_game->_script->readValExpr();
|
2007-07-25 21:02:30 +00:00
|
|
|
|
|
|
|
if ((width < 0) || (height < 0))
|
2011-01-29 22:44:06 +00:00
|
|
|
return;
|
2007-07-25 21:02:30 +00:00
|
|
|
|
2007-03-20 14:51:57 +00:00
|
|
|
_vm->_game->capturePush(left, top, width, height);
|
|
|
|
(*_vm->_scenery->_pCaptureCounter)++;
|
|
|
|
}
|
|
|
|
|
2011-01-29 22:44:06 +00:00
|
|
|
void Inter_v1::o1_capturePop(OpFuncParams ¶ms) {
|
2007-03-20 14:51:57 +00:00
|
|
|
if (*_vm->_scenery->_pCaptureCounter != 0) {
|
|
|
|
(*_vm->_scenery->_pCaptureCounter)--;
|
|
|
|
_vm->_game->capturePop(1);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2011-01-29 22:44:06 +00:00
|
|
|
void Inter_v1::o1_animPalInit(OpFuncParams ¶ms) {
|
2009-06-22 10:13:37 +00:00
|
|
|
_animPalDir[0] = _vm->_game->_script->readInt16();
|
|
|
|
_animPalLowIndex[0] = _vm->_game->_script->readValExpr();
|
|
|
|
_animPalHighIndex[0] = _vm->_game->_script->readValExpr();
|
2007-03-20 14:51:57 +00:00
|
|
|
}
|
|
|
|
|
2011-01-29 22:44:06 +00:00
|
|
|
void Inter_v1::o1_drawOperations(OpFuncParams ¶ms) {
|
2007-03-20 14:51:57 +00:00
|
|
|
byte cmd;
|
|
|
|
|
2009-06-22 10:13:37 +00:00
|
|
|
cmd = _vm->_game->_script->readByte();
|
2007-03-20 14:51:57 +00:00
|
|
|
|
2009-06-17 04:15:45 +00:00
|
|
|
executeOpcodeDraw(cmd);
|
2007-03-20 14:51:57 +00:00
|
|
|
}
|
|
|
|
|
2011-01-29 22:44:06 +00:00
|
|
|
void Inter_v1::o1_setcmdCount(OpFuncParams ¶ms) {
|
2009-06-22 10:13:37 +00:00
|
|
|
params.cmdCount = _vm->_game->_script->readByte();
|
2007-03-20 14:51:57 +00:00
|
|
|
params.counter = 0;
|
|
|
|
}
|
|
|
|
|
2011-01-29 22:44:06 +00:00
|
|
|
void Inter_v1::o1_return(OpFuncParams ¶ms) {
|
2007-03-20 14:51:57 +00:00
|
|
|
if (params.retFlag != 2)
|
|
|
|
_break = true;
|
|
|
|
|
2009-06-22 10:13:37 +00:00
|
|
|
_vm->_game->_script->setFinished(true);
|
2011-01-29 22:44:06 +00:00
|
|
|
params.doReturn = true;
|
2007-03-20 14:51:57 +00:00
|
|
|
}
|
|
|
|
|
2011-01-29 22:44:06 +00:00
|
|
|
void Inter_v1::o1_renewTimeInVars(OpFuncParams ¶ms) {
|
2007-03-20 14:51:57 +00:00
|
|
|
renewTimeInVars();
|
|
|
|
}
|
|
|
|
|
2011-01-29 22:44:06 +00:00
|
|
|
void Inter_v1::o1_speakerOn(OpFuncParams ¶ms) {
|
2009-06-22 10:13:37 +00:00
|
|
|
_vm->_sound->speakerOn(_vm->_game->_script->readValExpr(), -1);
|
2007-03-20 14:51:57 +00:00
|
|
|
}
|
|
|
|
|
2011-01-29 22:44:06 +00:00
|
|
|
void Inter_v1::o1_speakerOff(OpFuncParams ¶ms) {
|
2008-05-08 00:47:23 +00:00
|
|
|
_vm->_sound->speakerOff();
|
2007-03-20 14:51:57 +00:00
|
|
|
}
|
|
|
|
|
2011-01-29 22:44:06 +00:00
|
|
|
void Inter_v1::o1_putPixel(OpFuncParams ¶ms) {
|
2009-06-22 10:13:37 +00:00
|
|
|
_vm->_draw->_destSurface = _vm->_game->_script->readInt16();
|
2007-03-20 14:51:57 +00:00
|
|
|
|
2009-06-22 10:13:37 +00:00
|
|
|
_vm->_draw->_destSpriteX = _vm->_game->_script->readValExpr();
|
|
|
|
_vm->_draw->_destSpriteY = _vm->_game->_script->readValExpr();
|
|
|
|
_vm->_draw->_frontColor = _vm->_game->_script->readValExpr();
|
2007-03-20 14:51:57 +00:00
|
|
|
_vm->_draw->spriteOperation(DRAW_PUTPIXEL);
|
|
|
|
}
|
|
|
|
|
2011-01-29 22:44:06 +00:00
|
|
|
void Inter_v1::o1_goblinFunc(OpFuncParams ¶ms) {
|
2007-03-20 14:51:57 +00:00
|
|
|
OpGobParams gobParams;
|
|
|
|
bool objDescSet = false;
|
|
|
|
int16 cmd;
|
|
|
|
|
|
|
|
gobParams.extraData = 0;
|
|
|
|
gobParams.objDesc = 0;
|
2009-06-22 10:13:37 +00:00
|
|
|
gobParams.retVarPtr.set(*_variables, 236);
|
2007-03-20 14:51:57 +00:00
|
|
|
|
2009-06-22 10:13:37 +00:00
|
|
|
cmd = _vm->_game->_script->readInt16();
|
2010-06-24 11:50:25 +00:00
|
|
|
gobParams.paramCount = _vm->_game->_script->readInt16();
|
|
|
|
|
2007-03-20 14:51:57 +00:00
|
|
|
if ((cmd > 0) && (cmd < 17)) {
|
|
|
|
objDescSet = true;
|
2009-06-22 10:13:37 +00:00
|
|
|
gobParams.extraData = _vm->_game->_script->readInt16();
|
2007-03-20 14:51:57 +00:00
|
|
|
gobParams.objDesc = _vm->_goblin->_objects[gobParams.extraData];
|
2009-06-22 10:13:37 +00:00
|
|
|
gobParams.extraData = _vm->_game->_script->readInt16();
|
2007-03-20 14:51:57 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
if ((cmd > 90) && (cmd < 107)) {
|
|
|
|
objDescSet = true;
|
2009-06-22 10:13:37 +00:00
|
|
|
gobParams.extraData = _vm->_game->_script->readInt16();
|
2007-03-20 14:51:57 +00:00
|
|
|
gobParams.objDesc = _vm->_goblin->_goblins[gobParams.extraData];
|
2009-06-22 10:13:37 +00:00
|
|
|
gobParams.extraData = _vm->_game->_script->readInt16();
|
2007-03-20 14:51:57 +00:00
|
|
|
cmd -= 90;
|
|
|
|
}
|
|
|
|
|
|
|
|
if ((cmd > 110) && (cmd < 128)) {
|
|
|
|
objDescSet = true;
|
2009-06-22 10:13:37 +00:00
|
|
|
gobParams.extraData = _vm->_game->_script->readInt16();
|
2007-03-20 14:51:57 +00:00
|
|
|
gobParams.objDesc = _vm->_goblin->_goblins[gobParams.extraData];
|
|
|
|
cmd -= 90;
|
|
|
|
} else if ((cmd > 20) && (cmd < 38)) {
|
|
|
|
objDescSet = true;
|
2009-06-22 10:13:37 +00:00
|
|
|
gobParams.extraData = _vm->_game->_script->readInt16();
|
2007-03-20 14:51:57 +00:00
|
|
|
gobParams.objDesc = _vm->_goblin->_objects[gobParams.extraData];
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
NB: The original gobliiins engine did not initialize the gobParams.objDesc
|
|
|
|
variable, so we manually check if gobParams.objDesc is properly set before
|
|
|
|
checking if it is zero. If it was not set, we do not return. This
|
|
|
|
fixes a crash in the EGA version if the life bar is depleted, because
|
|
|
|
interFunc is called multiple times with cmd == 39.
|
|
|
|
Bug #1324814
|
|
|
|
*/
|
|
|
|
|
|
|
|
if ((cmd < 40) && objDescSet && !gobParams.objDesc)
|
2011-01-29 22:44:06 +00:00
|
|
|
return;
|
2007-03-20 14:51:57 +00:00
|
|
|
|
2009-06-17 04:16:51 +00:00
|
|
|
executeOpcodeGob(cmd, gobParams);
|
2007-03-20 14:51:57 +00:00
|
|
|
}
|
|
|
|
|
2011-01-29 22:44:06 +00:00
|
|
|
void Inter_v1::o1_createSprite(OpFuncParams ¶ms) {
|
2007-03-20 14:51:57 +00:00
|
|
|
int16 index;
|
|
|
|
int16 width, height;
|
|
|
|
int16 flag;
|
|
|
|
|
2009-06-22 10:13:37 +00:00
|
|
|
if (_vm->_game->_script->peekByte(1) == 0) {
|
|
|
|
index = _vm->_game->_script->readInt16();
|
|
|
|
width = _vm->_game->_script->readInt16();
|
|
|
|
height = _vm->_game->_script->readInt16();
|
2008-12-15 16:01:39 +00:00
|
|
|
} else {
|
2009-06-22 10:13:37 +00:00
|
|
|
index = _vm->_game->_script->readValExpr();
|
|
|
|
width = _vm->_game->_script->readValExpr();
|
|
|
|
height = _vm->_game->_script->readValExpr();
|
2008-12-15 16:01:39 +00:00
|
|
|
}
|
2007-03-20 14:51:57 +00:00
|
|
|
|
2009-06-22 10:13:37 +00:00
|
|
|
flag = _vm->_game->_script->readInt16();
|
2007-03-20 14:51:57 +00:00
|
|
|
_vm->_draw->initSpriteSurf(index, width, height, flag ? 2 : 0);
|
|
|
|
}
|
|
|
|
|
2011-01-29 22:44:06 +00:00
|
|
|
void Inter_v1::o1_freeSprite(OpFuncParams ¶ms) {
|
2009-06-22 10:13:37 +00:00
|
|
|
_vm->_draw->freeSprite(_vm->_game->_script->readInt16());
|
2007-03-20 14:51:57 +00:00
|
|
|
}
|
|
|
|
|
2011-01-29 22:44:06 +00:00
|
|
|
void Inter_v1::o1_returnTo(OpFuncParams ¶ms) {
|
2007-03-20 14:51:57 +00:00
|
|
|
if (params.retFlag == 1) {
|
|
|
|
_break = true;
|
2009-06-22 10:13:37 +00:00
|
|
|
_vm->_game->_script->setFinished(true);
|
2011-01-29 22:44:06 +00:00
|
|
|
params.doReturn = true;
|
|
|
|
return;
|
2007-03-20 14:51:57 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
if (*_nestLevel == 0)
|
2011-01-29 22:44:06 +00:00
|
|
|
return;
|
2007-03-20 14:51:57 +00:00
|
|
|
|
|
|
|
*_breakFromLevel = *_nestLevel;
|
|
|
|
_break = true;
|
2009-06-22 10:13:37 +00:00
|
|
|
_vm->_game->_script->setFinished(true);
|
2011-01-29 22:44:06 +00:00
|
|
|
|
|
|
|
params.doReturn = true;
|
2007-03-20 14:51:57 +00:00
|
|
|
}
|
|
|
|
|
2011-01-29 22:44:06 +00:00
|
|
|
void Inter_v1::o1_loadSpriteContent(OpFuncParams ¶ms) {
|
2009-06-22 10:13:37 +00:00
|
|
|
_vm->_draw->_spriteLeft = _vm->_game->_script->readInt16();
|
|
|
|
_vm->_draw->_destSurface = _vm->_game->_script->readInt16();
|
|
|
|
_vm->_draw->_transparency = _vm->_game->_script->readInt16();
|
2007-03-20 14:51:57 +00:00
|
|
|
_vm->_draw->_destSpriteX = 0;
|
|
|
|
_vm->_draw->_destSpriteY = 0;
|
2008-12-12 02:44:34 +00:00
|
|
|
|
2007-03-20 14:51:57 +00:00
|
|
|
_vm->_draw->spriteOperation(DRAW_LOADSPRITE);
|
|
|
|
}
|
|
|
|
|
2011-01-29 22:44:06 +00:00
|
|
|
void Inter_v1::o1_copySprite(OpFuncParams ¶ms) {
|
2009-06-22 10:13:37 +00:00
|
|
|
if (_vm->_game->_script->peekByte(1) == 0)
|
|
|
|
_vm->_draw->_sourceSurface = _vm->_game->_script->readInt16();
|
2008-12-11 21:57:47 +00:00
|
|
|
else
|
2009-06-22 10:13:37 +00:00
|
|
|
_vm->_draw->_sourceSurface = _vm->_game->_script->readValExpr();
|
2008-12-11 21:57:47 +00:00
|
|
|
|
2009-06-22 10:13:37 +00:00
|
|
|
if (_vm->_game->_script->peekByte(1) == 0)
|
|
|
|
_vm->_draw->_destSurface = _vm->_game->_script->readInt16();
|
2008-12-11 21:57:47 +00:00
|
|
|
else
|
2009-06-22 10:13:37 +00:00
|
|
|
_vm->_draw->_destSurface = _vm->_game->_script->readValExpr();
|
2007-03-20 14:51:57 +00:00
|
|
|
|
2009-06-22 10:13:37 +00:00
|
|
|
_vm->_draw->_spriteLeft = _vm->_game->_script->readValExpr();
|
|
|
|
_vm->_draw->_spriteTop = _vm->_game->_script->readValExpr();
|
|
|
|
_vm->_draw->_spriteRight = _vm->_game->_script->readValExpr();
|
|
|
|
_vm->_draw->_spriteBottom = _vm->_game->_script->readValExpr();
|
2007-03-20 14:51:57 +00:00
|
|
|
|
2009-06-22 10:13:37 +00:00
|
|
|
_vm->_draw->_destSpriteX = _vm->_game->_script->readValExpr();
|
|
|
|
_vm->_draw->_destSpriteY = _vm->_game->_script->readValExpr();
|
2007-03-20 14:51:57 +00:00
|
|
|
|
2009-06-22 10:13:37 +00:00
|
|
|
_vm->_draw->_transparency = _vm->_game->_script->readInt16();
|
2008-12-12 00:10:39 +00:00
|
|
|
|
2007-03-20 14:51:57 +00:00
|
|
|
_vm->_draw->spriteOperation(DRAW_BLITSURF);
|
|
|
|
}
|
|
|
|
|
2011-01-29 22:44:06 +00:00
|
|
|
void Inter_v1::o1_fillRect(OpFuncParams ¶ms) {
|
2007-07-26 03:29:45 +00:00
|
|
|
int16 destSurf;
|
|
|
|
|
2009-06-22 10:13:37 +00:00
|
|
|
_vm->_draw->_destSurface = destSurf = _vm->_game->_script->readInt16();
|
2007-03-20 14:51:57 +00:00
|
|
|
|
2009-06-22 10:13:37 +00:00
|
|
|
_vm->_draw->_destSpriteX = _vm->_game->_script->readValExpr();
|
|
|
|
_vm->_draw->_destSpriteY = _vm->_game->_script->readValExpr();
|
|
|
|
_vm->_draw->_spriteRight = _vm->_game->_script->readValExpr();
|
|
|
|
_vm->_draw->_spriteBottom = _vm->_game->_script->readValExpr();
|
2007-03-20 14:51:57 +00:00
|
|
|
|
2009-06-22 10:13:37 +00:00
|
|
|
_vm->_draw->_backColor = _vm->_game->_script->readValExpr();
|
2007-07-25 20:36:14 +00:00
|
|
|
|
2009-06-06 21:37:30 +00:00
|
|
|
if (!_vm->_draw->_spritesArray[(destSurf >= 100) ? (destSurf - 80) : destSurf])
|
2011-01-29 22:44:06 +00:00
|
|
|
return;
|
2007-07-25 20:36:14 +00:00
|
|
|
|
2007-07-26 03:17:54 +00:00
|
|
|
if (_vm->_draw->_spriteRight < 0) {
|
|
|
|
_vm->_draw->_destSpriteX += _vm->_draw->_spriteRight - 1;
|
|
|
|
_vm->_draw->_spriteRight = -_vm->_draw->_spriteRight + 2;
|
|
|
|
}
|
|
|
|
if (_vm->_draw->_spriteBottom < 0) {
|
|
|
|
_vm->_draw->_destSpriteY += _vm->_draw->_spriteBottom - 1;
|
|
|
|
_vm->_draw->_spriteBottom = -_vm->_draw->_spriteBottom + 2;
|
|
|
|
}
|
|
|
|
|
2007-03-20 14:51:57 +00:00
|
|
|
_vm->_draw->spriteOperation(DRAW_FILLRECT);
|
|
|
|
}
|
|
|
|
|
2011-01-29 22:44:06 +00:00
|
|
|
void Inter_v1::o1_drawLine(OpFuncParams ¶ms) {
|
2009-06-22 10:13:37 +00:00
|
|
|
_vm->_draw->_destSurface = _vm->_game->_script->readInt16();
|
2007-03-20 14:51:57 +00:00
|
|
|
|
2009-06-22 10:13:37 +00:00
|
|
|
_vm->_draw->_destSpriteX = _vm->_game->_script->readValExpr();
|
|
|
|
_vm->_draw->_destSpriteY = _vm->_game->_script->readValExpr();
|
|
|
|
_vm->_draw->_spriteRight = _vm->_game->_script->readValExpr();
|
|
|
|
_vm->_draw->_spriteBottom = _vm->_game->_script->readValExpr();
|
2007-03-20 14:51:57 +00:00
|
|
|
|
2009-06-22 10:13:37 +00:00
|
|
|
_vm->_draw->_frontColor = _vm->_game->_script->readValExpr();
|
2007-03-20 14:51:57 +00:00
|
|
|
_vm->_draw->spriteOperation(DRAW_DRAWLINE);
|
|
|
|
}
|
|
|
|
|
2011-01-29 22:44:06 +00:00
|
|
|
void Inter_v1::o1_strToLong(OpFuncParams ¶ms) {
|
2007-03-20 14:51:57 +00:00
|
|
|
char str[20];
|
|
|
|
int16 strVar;
|
|
|
|
int16 destVar;
|
|
|
|
int32 res;
|
|
|
|
|
2009-06-22 10:13:37 +00:00
|
|
|
strVar = _vm->_game->_script->readVarIndex();
|
2010-10-15 13:54:23 +00:00
|
|
|
Common::strlcpy(str, GET_VARO_STR(strVar), 20);
|
2009-05-29 14:39:10 +00:00
|
|
|
res = atoi(str);
|
2007-03-20 14:51:57 +00:00
|
|
|
|
2009-06-22 10:13:37 +00:00
|
|
|
destVar = _vm->_game->_script->readVarIndex();
|
2007-03-20 14:51:57 +00:00
|
|
|
WRITE_VAR_OFFSET(destVar, res);
|
|
|
|
}
|
|
|
|
|
2011-01-29 22:44:06 +00:00
|
|
|
void Inter_v1::o1_invalidate(OpFuncParams ¶ms) {
|
2009-06-22 10:13:37 +00:00
|
|
|
_vm->_draw->_destSurface = _vm->_game->_script->readInt16();
|
|
|
|
_vm->_draw->_destSpriteX = _vm->_game->_script->readValExpr();
|
|
|
|
_vm->_draw->_destSpriteY = _vm->_game->_script->readValExpr();
|
|
|
|
_vm->_draw->_spriteRight = _vm->_game->_script->readValExpr();
|
|
|
|
_vm->_draw->_frontColor = _vm->_game->_script->readValExpr();
|
2007-03-20 14:51:57 +00:00
|
|
|
_vm->_draw->spriteOperation(DRAW_INVALIDATE);
|
|
|
|
}
|
|
|
|
|
2011-01-29 22:44:06 +00:00
|
|
|
void Inter_v1::o1_setBackDelta(OpFuncParams ¶ms) {
|
2009-06-22 10:13:37 +00:00
|
|
|
_vm->_draw->_backDeltaX = _vm->_game->_script->readValExpr();
|
|
|
|
_vm->_draw->_backDeltaY = _vm->_game->_script->readValExpr();
|
2007-03-20 14:51:57 +00:00
|
|
|
}
|
|
|
|
|
2011-01-29 22:44:06 +00:00
|
|
|
void Inter_v1::o1_playSound(OpFuncParams ¶ms) {
|
2007-03-20 14:51:57 +00:00
|
|
|
int16 frequency;
|
|
|
|
int16 freq2;
|
|
|
|
int16 repCount;
|
|
|
|
int16 index;
|
|
|
|
int16 endRep;
|
|
|
|
|
2009-06-22 10:13:37 +00:00
|
|
|
index = _vm->_game->_script->readValExpr();
|
|
|
|
repCount = _vm->_game->_script->readValExpr();
|
|
|
|
frequency = _vm->_game->_script->readValExpr();
|
2007-03-20 14:51:57 +00:00
|
|
|
|
2008-05-08 00:47:23 +00:00
|
|
|
SoundDesc *sample = _vm->_sound->sampleGetBySlot(index);
|
2007-03-20 14:51:57 +00:00
|
|
|
|
|
|
|
_soundEndTimeKey = 0;
|
2008-05-08 00:47:23 +00:00
|
|
|
if (!sample || sample->empty())
|
2011-01-29 22:44:06 +00:00
|
|
|
return;
|
2007-03-20 14:51:57 +00:00
|
|
|
|
|
|
|
if (repCount < 0) {
|
|
|
|
if (_vm->_global->_soundFlags < 2)
|
2011-01-29 22:44:06 +00:00
|
|
|
return;
|
2007-03-20 14:51:57 +00:00
|
|
|
|
|
|
|
repCount = -repCount;
|
|
|
|
_soundEndTimeKey = _vm->_util->getTimeKey();
|
|
|
|
|
2008-05-08 00:47:23 +00:00
|
|
|
freq2 = frequency ? frequency : sample->_frequency;
|
2007-03-20 14:51:57 +00:00
|
|
|
endRep = MAX(repCount - 1, 1);
|
|
|
|
|
2008-05-08 00:47:23 +00:00
|
|
|
_soundStopVal = sample->calcFadeOutLength(freq2);
|
|
|
|
_soundEndTimeKey += sample->calcLength(endRep, freq2, true);
|
2007-03-20 14:51:57 +00:00
|
|
|
}
|
|
|
|
|
2008-05-08 00:47:23 +00:00
|
|
|
if (sample->getType() == SOUND_ADL) {
|
2009-06-18 13:27:35 +00:00
|
|
|
_vm->_sound->adlibLoadADL(sample->getData(), sample->size(), index);
|
2008-05-08 00:47:23 +00:00
|
|
|
_vm->_sound->adlibSetRepeating(repCount - 1);
|
|
|
|
_vm->_sound->adlibPlay();
|
2007-03-20 14:51:57 +00:00
|
|
|
} else {
|
2008-05-08 00:47:23 +00:00
|
|
|
_vm->_sound->blasterStop(0);
|
|
|
|
_vm->_sound->blasterPlay(sample, repCount - 1, frequency);
|
2007-03-20 14:51:57 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2011-01-29 22:44:06 +00:00
|
|
|
void Inter_v1::o1_stopSound(OpFuncParams ¶ms) {
|
2008-05-08 00:47:23 +00:00
|
|
|
_vm->_sound->adlibStop();
|
2009-06-22 10:13:37 +00:00
|
|
|
_vm->_sound->blasterStop(_vm->_game->_script->readValExpr());
|
2007-03-20 14:51:57 +00:00
|
|
|
|
|
|
|
_soundEndTimeKey = 0;
|
|
|
|
}
|
|
|
|
|
2011-01-29 22:44:06 +00:00
|
|
|
void Inter_v1::o1_loadSound(OpFuncParams ¶ms) {
|
2007-03-20 14:51:57 +00:00
|
|
|
loadSound(-1);
|
|
|
|
}
|
|
|
|
|
2011-01-29 22:44:06 +00:00
|
|
|
void Inter_v1::o1_freeSoundSlot(OpFuncParams ¶ms) {
|
2007-03-20 14:51:57 +00:00
|
|
|
_vm->_game->freeSoundSlot(-1);
|
|
|
|
}
|
|
|
|
|
2011-01-29 22:44:06 +00:00
|
|
|
void Inter_v1::o1_waitEndPlay(OpFuncParams ¶ms) {
|
2008-05-08 00:47:23 +00:00
|
|
|
_vm->_sound->blasterWaitEndPlay();
|
2007-03-20 14:51:57 +00:00
|
|
|
}
|
|
|
|
|
2011-01-29 22:44:06 +00:00
|
|
|
void Inter_v1::o1_playComposition(OpFuncParams ¶ms) {
|
2007-03-20 14:51:57 +00:00
|
|
|
int16 composition[50];
|
|
|
|
int16 dataVar;
|
|
|
|
int16 freqVal;
|
|
|
|
|
2009-06-22 10:13:37 +00:00
|
|
|
dataVar = _vm->_game->_script->readVarIndex();
|
|
|
|
freqVal = _vm->_game->_script->readValExpr();
|
2007-03-20 14:51:57 +00:00
|
|
|
for (int i = 0; i < 50; i++)
|
|
|
|
composition[i] = (int16) VAR_OFFSET(dataVar + i * 4);
|
|
|
|
|
2008-05-08 00:47:23 +00:00
|
|
|
_vm->_sound->blasterPlayComposition(composition, freqVal);
|
2007-03-20 14:51:57 +00:00
|
|
|
}
|
|
|
|
|
2011-01-29 22:44:06 +00:00
|
|
|
void Inter_v1::o1_getFreeMem(OpFuncParams ¶ms) {
|
2007-03-20 14:51:57 +00:00
|
|
|
int16 freeVar;
|
|
|
|
int16 maxFreeVar;
|
|
|
|
|
2009-06-22 10:13:37 +00:00
|
|
|
freeVar = _vm->_game->_script->readVarIndex();
|
|
|
|
maxFreeVar = _vm->_game->_script->readVarIndex();
|
2007-03-20 14:51:57 +00:00
|
|
|
|
|
|
|
// HACK
|
|
|
|
WRITE_VAR_OFFSET(freeVar, 1000000);
|
|
|
|
WRITE_VAR_OFFSET(maxFreeVar, 1000000);
|
|
|
|
}
|
|
|
|
|
2011-01-29 22:44:06 +00:00
|
|
|
void Inter_v1::o1_checkData(OpFuncParams ¶ms) {
|
2011-01-29 22:47:53 +00:00
|
|
|
const char *file = _vm->_game->_script->evalString();
|
|
|
|
int16 varOff = _vm->_game->_script->readVarIndex();
|
2007-03-20 14:51:57 +00:00
|
|
|
|
2011-01-29 22:47:53 +00:00
|
|
|
if (!_vm->_dataIO->hasFile(file)) {
|
|
|
|
warning("File \"%s\" not found", file);
|
2010-10-31 21:47:20 +00:00
|
|
|
WRITE_VAR_OFFSET(varOff, (uint32) -1);
|
2010-10-31 20:07:14 +00:00
|
|
|
} else
|
|
|
|
WRITE_VAR_OFFSET(varOff, 50); // "handle" between 50 and 128 = in archive
|
2007-03-20 14:51:57 +00:00
|
|
|
}
|
|
|
|
|
2011-01-29 22:44:06 +00:00
|
|
|
void Inter_v1::o1_cleanupStr(OpFuncParams ¶ms) {
|
2007-03-20 14:51:57 +00:00
|
|
|
int16 strVar;
|
|
|
|
|
2009-06-22 10:13:37 +00:00
|
|
|
strVar = _vm->_game->_script->readVarIndex();
|
2009-07-05 11:26:42 +00:00
|
|
|
_vm->_util->cleanupStr(GET_VARO_FSTR(strVar));
|
2007-03-20 14:51:57 +00:00
|
|
|
}
|
|
|
|
|
2011-01-29 22:44:06 +00:00
|
|
|
void Inter_v1::o1_insertStr(OpFuncParams ¶ms) {
|
2007-03-20 14:51:57 +00:00
|
|
|
int16 pos;
|
|
|
|
int16 strVar;
|
|
|
|
|
2009-06-22 10:13:37 +00:00
|
|
|
strVar = _vm->_game->_script->readVarIndex();
|
2009-06-22 10:29:32 +00:00
|
|
|
_vm->_game->_script->evalExpr(0);
|
2009-06-22 10:13:37 +00:00
|
|
|
pos = _vm->_game->_script->readValExpr();
|
2008-05-28 21:15:11 +00:00
|
|
|
|
|
|
|
char *str = GET_VARO_FSTR(strVar);
|
2009-06-22 10:13:37 +00:00
|
|
|
_vm->_util->insertStr(_vm->_game->_script->getResultStr(), str, pos);
|
2007-03-20 14:51:57 +00:00
|
|
|
}
|
|
|
|
|
2011-01-29 22:44:06 +00:00
|
|
|
void Inter_v1::o1_cutStr(OpFuncParams ¶ms) {
|
2007-03-20 14:51:57 +00:00
|
|
|
int16 strVar;
|
|
|
|
int16 pos;
|
|
|
|
int16 size;
|
|
|
|
|
2009-06-22 10:13:37 +00:00
|
|
|
strVar = _vm->_game->_script->readVarIndex();
|
|
|
|
pos = _vm->_game->_script->readValExpr();
|
|
|
|
size = _vm->_game->_script->readValExpr();
|
2007-03-20 14:51:57 +00:00
|
|
|
_vm->_util->cutFromStr(GET_VARO_STR(strVar), pos, size);
|
|
|
|
}
|
|
|
|
|
2011-01-29 22:44:06 +00:00
|
|
|
void Inter_v1::o1_strstr(OpFuncParams ¶ms) {
|
2007-03-20 14:51:57 +00:00
|
|
|
int16 strVar;
|
|
|
|
int16 resVar;
|
|
|
|
int16 pos;
|
2006-02-02 21:12:00 +00:00
|
|
|
|
2009-06-22 10:13:37 +00:00
|
|
|
strVar = _vm->_game->_script->readVarIndex();
|
2009-06-22 10:29:32 +00:00
|
|
|
_vm->_game->_script->evalExpr(0);
|
2009-06-22 10:13:37 +00:00
|
|
|
resVar = _vm->_game->_script->readVarIndex();
|
2007-03-20 14:51:57 +00:00
|
|
|
|
2009-06-22 10:13:37 +00:00
|
|
|
char *res = strstr(GET_VARO_STR(strVar), _vm->_game->_script->getResultStr());
|
2007-03-20 14:51:57 +00:00
|
|
|
pos = res ? (res - (GET_VARO_STR(strVar))) : -1;
|
|
|
|
WRITE_VAR_OFFSET(resVar, pos);
|
2006-01-05 16:06:55 +00:00
|
|
|
}
|
|
|
|
|
2011-01-29 22:44:06 +00:00
|
|
|
void Inter_v1::o1_istrlen(OpFuncParams ¶ms) {
|
2007-03-20 14:51:57 +00:00
|
|
|
int16 len;
|
|
|
|
int16 strVar;
|
|
|
|
|
2009-06-22 10:13:37 +00:00
|
|
|
strVar = _vm->_game->_script->readVarIndex();
|
2007-03-20 14:51:57 +00:00
|
|
|
len = strlen(GET_VARO_STR(strVar));
|
2009-06-22 10:13:37 +00:00
|
|
|
strVar = _vm->_game->_script->readVarIndex();
|
2007-03-20 14:51:57 +00:00
|
|
|
|
|
|
|
WRITE_VAR_OFFSET(strVar, len);
|
2006-01-05 16:06:55 +00:00
|
|
|
}
|
|
|
|
|
2011-01-29 22:44:06 +00:00
|
|
|
void Inter_v1::o1_setMousePos(OpFuncParams ¶ms) {
|
2009-06-22 10:13:37 +00:00
|
|
|
_vm->_global->_inter_mouseX = _vm->_game->_script->readValExpr();
|
|
|
|
_vm->_global->_inter_mouseY = _vm->_game->_script->readValExpr();
|
2007-04-06 13:30:09 +00:00
|
|
|
_vm->_global->_inter_mouseX -= _vm->_video->_scrollOffsetX;
|
|
|
|
_vm->_global->_inter_mouseY -= _vm->_video->_scrollOffsetY;
|
2007-03-20 14:51:57 +00:00
|
|
|
if (_vm->_global->_useMouse != 0)
|
|
|
|
_vm->_util->setMousePos(_vm->_global->_inter_mouseX,
|
|
|
|
_vm->_global->_inter_mouseY);
|
|
|
|
}
|
2006-01-05 16:06:55 +00:00
|
|
|
|
2011-01-29 22:44:06 +00:00
|
|
|
void Inter_v1::o1_setFrameRate(OpFuncParams ¶ms) {
|
2009-06-22 10:13:37 +00:00
|
|
|
_vm->_util->setFrameRate(_vm->_game->_script->readValExpr());
|
2006-01-05 16:06:55 +00:00
|
|
|
}
|
|
|
|
|
2011-01-29 22:44:06 +00:00
|
|
|
void Inter_v1::o1_animatePalette(OpFuncParams ¶ms) {
|
2007-03-20 14:51:57 +00:00
|
|
|
_vm->_draw->blitInvalidated();
|
|
|
|
_vm->_util->waitEndFrame();
|
|
|
|
animPalette();
|
|
|
|
storeKey(_vm->_game->checkKeys(&_vm->_global->_inter_mouseX,
|
|
|
|
&_vm->_global->_inter_mouseY, &_vm->_game->_mouseButtons, 0));
|
2006-01-05 16:06:55 +00:00
|
|
|
}
|
|
|
|
|
2011-01-29 22:44:06 +00:00
|
|
|
void Inter_v1::o1_animateCursor(OpFuncParams ¶ms) {
|
2007-03-20 14:51:57 +00:00
|
|
|
_vm->_draw->animateCursor(1);
|
2006-01-05 16:06:55 +00:00
|
|
|
}
|
|
|
|
|
2011-01-29 22:44:06 +00:00
|
|
|
void Inter_v1::o1_blitCursor(OpFuncParams ¶ms) {
|
2007-03-20 14:51:57 +00:00
|
|
|
_vm->_draw->blitCursor();
|
2006-01-05 16:06:55 +00:00
|
|
|
}
|
|
|
|
|
2011-01-29 22:44:06 +00:00
|
|
|
void Inter_v1::o1_loadFont(OpFuncParams ¶ms) {
|
2011-01-29 22:47:53 +00:00
|
|
|
const char *font = _vm->_game->_script->evalString();
|
|
|
|
uint16 index = _vm->_game->_script->readInt16();
|
2006-01-10 11:30:23 +00:00
|
|
|
|
2007-03-20 14:51:57 +00:00
|
|
|
_vm->_draw->animateCursor(4);
|
2011-01-29 22:47:53 +00:00
|
|
|
_vm->_draw->loadFont(index, font);
|
2007-03-20 14:51:57 +00:00
|
|
|
}
|
2006-01-10 11:30:23 +00:00
|
|
|
|
2011-01-29 22:44:06 +00:00
|
|
|
void Inter_v1::o1_freeFont(OpFuncParams ¶ms) {
|
2007-03-20 14:51:57 +00:00
|
|
|
int16 index;
|
2006-01-10 11:30:23 +00:00
|
|
|
|
2009-06-22 10:13:37 +00:00
|
|
|
index = _vm->_game->_script->readInt16();
|
2011-01-25 15:14:07 +00:00
|
|
|
|
|
|
|
if (index >= Draw::kFontCount) {
|
|
|
|
warning("o1_freeFont(): Index %d > count %d", index, Draw::kFontCount);
|
2011-01-29 22:44:06 +00:00
|
|
|
return;
|
2011-01-25 15:14:07 +00:00
|
|
|
}
|
|
|
|
|
2008-12-14 04:33:28 +00:00
|
|
|
delete _vm->_draw->_fonts[index];
|
2007-03-20 14:51:57 +00:00
|
|
|
_vm->_draw->_fonts[index] = 0;
|
2006-01-05 16:06:55 +00:00
|
|
|
}
|
|
|
|
|
2011-01-29 22:44:06 +00:00
|
|
|
void Inter_v1::o1_readData(OpFuncParams ¶ms) {
|
2011-01-29 22:47:53 +00:00
|
|
|
const char *file = _vm->_game->_script->evalString();
|
|
|
|
int16 dataVar = _vm->_game->_script->readVarIndex();
|
|
|
|
int16 size = _vm->_game->_script->readValExpr();
|
|
|
|
int16 offset = _vm->_game->_script->readValExpr();
|
|
|
|
int16 retSize = 0;
|
2006-01-05 16:06:55 +00:00
|
|
|
|
2007-03-20 14:51:57 +00:00
|
|
|
WRITE_VAR(1, 1);
|
2007-07-31 01:43:32 +00:00
|
|
|
|
2011-01-29 22:47:53 +00:00
|
|
|
Common::SeekableReadStream *stream = _vm->_dataIO->getFile(file);
|
2010-10-31 20:07:14 +00:00
|
|
|
if (!stream)
|
2011-01-29 22:44:06 +00:00
|
|
|
return;
|
2006-01-05 16:06:55 +00:00
|
|
|
|
2010-10-31 20:07:14 +00:00
|
|
|
_vm->_draw->animateCursor(4);
|
|
|
|
if (offset < 0)
|
|
|
|
stream->seek(offset + 1, SEEK_END);
|
|
|
|
else
|
|
|
|
stream->seek(offset);
|
2006-01-05 16:06:55 +00:00
|
|
|
|
2010-10-31 20:07:14 +00:00
|
|
|
if (((dataVar >> 2) == 59) && (size == 4))
|
|
|
|
WRITE_VAR(59, stream->readUint32LE());
|
|
|
|
else
|
|
|
|
retSize = stream->read((byte *)_variables->getAddressOff8(dataVar), size);
|
2007-07-31 01:43:32 +00:00
|
|
|
|
2010-10-31 20:07:14 +00:00
|
|
|
if (retSize == size)
|
|
|
|
WRITE_VAR(1, 0);
|
|
|
|
|
|
|
|
delete stream;
|
2006-01-05 16:06:55 +00:00
|
|
|
}
|
|
|
|
|
2011-01-29 22:44:06 +00:00
|
|
|
void Inter_v1::o1_writeData(OpFuncParams ¶ms) {
|
2007-03-20 14:51:57 +00:00
|
|
|
// This writes into a file. It's not portable and isn't needed anyway
|
|
|
|
// (Gobliiins 1 doesn't use save file), so we just warn should it be
|
|
|
|
// called regardless.
|
|
|
|
|
2011-01-29 22:47:53 +00:00
|
|
|
const char *file = _vm->_game->_script->evalString();
|
2007-03-20 14:51:57 +00:00
|
|
|
|
2011-01-29 22:47:53 +00:00
|
|
|
int16 dataVar = _vm->_game->_script->readVarIndex();
|
|
|
|
int16 size = _vm->_game->_script->readValExpr();
|
|
|
|
int16 offset = _vm->_game->_script->readValExpr();
|
|
|
|
|
|
|
|
warning("Attempted to write to file \"%s\" (%d, %d, %d)", file, dataVar, size, offset);
|
2007-03-20 14:51:57 +00:00
|
|
|
WRITE_VAR(1, 0);
|
2006-01-05 16:06:55 +00:00
|
|
|
}
|
|
|
|
|
2011-01-29 22:44:06 +00:00
|
|
|
void Inter_v1::o1_manageDataFile(OpFuncParams ¶ms) {
|
2011-01-29 22:47:53 +00:00
|
|
|
Common::String file = _vm->_game->_script->evalString();
|
2007-03-20 14:51:57 +00:00
|
|
|
|
2011-01-29 22:47:53 +00:00
|
|
|
if (!file.empty())
|
|
|
|
_vm->_dataIO->openArchive(file, true);
|
2007-03-20 14:51:57 +00:00
|
|
|
else
|
2010-10-31 20:07:14 +00:00
|
|
|
_vm->_dataIO->closeArchive(true);
|
2006-01-05 16:06:55 +00:00
|
|
|
}
|
|
|
|
|
2007-03-20 14:51:57 +00:00
|
|
|
void Inter_v1::o1_setState(OpGobParams ¶ms) {
|
|
|
|
params.objDesc->state = params.extraData;
|
|
|
|
if (params.objDesc == _vm->_goblin->_actDestItemDesc)
|
2008-07-12 15:21:38 +00:00
|
|
|
_vm->_goblin->_destItemStateVarPtr = (uint32) params.extraData;
|
2006-01-10 11:30:23 +00:00
|
|
|
}
|
|
|
|
|
2007-03-20 14:51:57 +00:00
|
|
|
void Inter_v1::o1_setCurFrame(OpGobParams ¶ms) {
|
|
|
|
params.objDesc->curFrame = params.extraData;
|
|
|
|
if (params.objDesc == _vm->_goblin->_actDestItemDesc)
|
2008-07-12 15:21:38 +00:00
|
|
|
_vm->_goblin->_destItemFrameVarPtr = (uint32) params.extraData;
|
2006-01-10 11:30:23 +00:00
|
|
|
}
|
|
|
|
|
2007-03-20 14:51:57 +00:00
|
|
|
void Inter_v1::o1_setNextState(OpGobParams ¶ms) {
|
|
|
|
params.objDesc->nextState = params.extraData;
|
|
|
|
if (params.objDesc == _vm->_goblin->_actDestItemDesc)
|
2008-07-12 15:21:38 +00:00
|
|
|
_vm->_goblin->_destItemNextStateVarPtr = (uint32) params.extraData;
|
2006-01-10 11:30:23 +00:00
|
|
|
}
|
|
|
|
|
2007-03-20 14:51:57 +00:00
|
|
|
void Inter_v1::o1_setMultState(OpGobParams ¶ms) {
|
|
|
|
params.objDesc->multState = params.extraData;
|
|
|
|
if (params.objDesc == _vm->_goblin->_actDestItemDesc)
|
2008-07-12 15:21:38 +00:00
|
|
|
_vm->_goblin->_destItemMultStateVarPtr = (uint32) params.extraData;
|
2006-01-10 11:30:23 +00:00
|
|
|
}
|
|
|
|
|
2007-03-20 14:51:57 +00:00
|
|
|
void Inter_v1::o1_setOrder(OpGobParams ¶ms) {
|
|
|
|
params.objDesc->order = params.extraData;
|
|
|
|
if (params.objDesc == _vm->_goblin->_actDestItemDesc)
|
2008-07-12 15:21:38 +00:00
|
|
|
_vm->_goblin->_destItemOrderVarPtr = (uint32) params.extraData;
|
2006-01-10 11:30:23 +00:00
|
|
|
}
|
|
|
|
|
2007-03-20 14:51:57 +00:00
|
|
|
void Inter_v1::o1_setActionStartState(OpGobParams ¶ms) {
|
|
|
|
params.objDesc->actionStartState = params.extraData;
|
|
|
|
if (params.objDesc == _vm->_goblin->_actDestItemDesc)
|
2008-07-12 15:21:38 +00:00
|
|
|
_vm->_goblin->_destItemActStartStVarPtr = (uint32) params.extraData;
|
2006-01-10 11:30:23 +00:00
|
|
|
}
|
|
|
|
|
2007-03-20 14:51:57 +00:00
|
|
|
void Inter_v1::o1_setCurLookDir(OpGobParams ¶ms) {
|
|
|
|
params.objDesc->curLookDir = params.extraData;
|
|
|
|
if (params.objDesc == _vm->_goblin->_actDestItemDesc)
|
2008-07-12 15:21:38 +00:00
|
|
|
_vm->_goblin->_destItemLookDirVarPtr = (uint32) params.extraData;
|
2006-01-10 11:30:23 +00:00
|
|
|
}
|
|
|
|
|
2007-03-20 14:51:57 +00:00
|
|
|
void Inter_v1::o1_setType(OpGobParams ¶ms) {
|
|
|
|
params.objDesc->type = params.extraData;
|
|
|
|
if (params.objDesc == _vm->_goblin->_actDestItemDesc)
|
2008-07-12 15:21:38 +00:00
|
|
|
_vm->_goblin->_destItemTypeVarPtr = (uint32) params.extraData;
|
2006-01-10 11:30:23 +00:00
|
|
|
|
2007-03-20 14:51:57 +00:00
|
|
|
if (params.extraData == 0)
|
|
|
|
params.objDesc->toRedraw = 1;
|
2006-01-10 11:30:23 +00:00
|
|
|
}
|
|
|
|
|
2007-03-20 14:51:57 +00:00
|
|
|
void Inter_v1::o1_setNoTick(OpGobParams ¶ms) {
|
|
|
|
params.objDesc->noTick = params.extraData;
|
|
|
|
if (params.objDesc == _vm->_goblin->_actDestItemDesc)
|
2008-07-12 15:21:38 +00:00
|
|
|
_vm->_goblin->_destItemNoTickVarPtr = (uint32) params.extraData;
|
2006-01-10 11:30:23 +00:00
|
|
|
}
|
|
|
|
|
2007-03-20 14:51:57 +00:00
|
|
|
void Inter_v1::o1_setPickable(OpGobParams ¶ms) {
|
|
|
|
params.objDesc->pickable = params.extraData;
|
|
|
|
if (params.objDesc == _vm->_goblin->_actDestItemDesc)
|
2008-07-12 15:21:38 +00:00
|
|
|
_vm->_goblin->_destItemPickableVarPtr = (uint32) params.extraData;
|
2006-01-10 11:30:23 +00:00
|
|
|
}
|
|
|
|
|
2007-03-20 14:51:57 +00:00
|
|
|
void Inter_v1::o1_setXPos(OpGobParams ¶ms) {
|
|
|
|
params.objDesc->xPos = params.extraData;
|
|
|
|
if (params.objDesc == _vm->_goblin->_actDestItemDesc)
|
2008-07-12 15:21:38 +00:00
|
|
|
_vm->_goblin->_destItemScrXVarPtr = (uint32) params.extraData;
|
2006-01-10 11:30:23 +00:00
|
|
|
}
|
|
|
|
|
2007-03-20 14:51:57 +00:00
|
|
|
void Inter_v1::o1_setYPos(OpGobParams ¶ms) {
|
|
|
|
params.objDesc->yPos = params.extraData;
|
|
|
|
if (params.objDesc == _vm->_goblin->_actDestItemDesc)
|
2008-07-12 15:21:38 +00:00
|
|
|
_vm->_goblin->_destItemScrYVarPtr = (uint32) params.extraData;
|
2006-01-10 11:30:23 +00:00
|
|
|
}
|
|
|
|
|
2007-03-20 14:51:57 +00:00
|
|
|
void Inter_v1::o1_setDoAnim(OpGobParams ¶ms) {
|
|
|
|
params.objDesc->doAnim = params.extraData;
|
|
|
|
if (params.objDesc == _vm->_goblin->_actDestItemDesc)
|
2008-07-12 15:21:38 +00:00
|
|
|
_vm->_goblin->_destItemDoAnimVarPtr = (uint32) params.extraData;
|
2006-01-10 11:30:23 +00:00
|
|
|
}
|
|
|
|
|
2007-03-20 14:51:57 +00:00
|
|
|
void Inter_v1::o1_setRelaxTime(OpGobParams ¶ms) {
|
|
|
|
params.objDesc->relaxTime = params.extraData;
|
|
|
|
if (params.objDesc == _vm->_goblin->_actDestItemDesc)
|
2008-07-12 15:21:38 +00:00
|
|
|
_vm->_goblin->_destItemRelaxVarPtr = (uint32) params.extraData;
|
2006-01-10 11:30:23 +00:00
|
|
|
}
|
|
|
|
|
2007-03-20 14:51:57 +00:00
|
|
|
void Inter_v1::o1_setMaxTick(OpGobParams ¶ms) {
|
|
|
|
params.objDesc->maxTick = params.extraData;
|
|
|
|
if (params.objDesc == _vm->_goblin->_actDestItemDesc)
|
2008-07-12 15:21:38 +00:00
|
|
|
_vm->_goblin->_destItemMaxTickVarPtr = (uint32) params.extraData;
|
2006-01-10 11:30:23 +00:00
|
|
|
}
|
|
|
|
|
2007-03-20 14:51:57 +00:00
|
|
|
void Inter_v1::o1_getState(OpGobParams ¶ms) {
|
2008-07-12 15:21:38 +00:00
|
|
|
params.retVarPtr = (uint32) params.objDesc->state;
|
2006-01-10 11:30:23 +00:00
|
|
|
}
|
|
|
|
|
2007-03-20 14:51:57 +00:00
|
|
|
void Inter_v1::o1_getCurFrame(OpGobParams ¶ms) {
|
2008-07-12 15:21:38 +00:00
|
|
|
params.retVarPtr = (uint32) params.objDesc->curFrame;
|
2006-01-10 11:30:23 +00:00
|
|
|
}
|
|
|
|
|
2007-03-20 14:51:57 +00:00
|
|
|
void Inter_v1::o1_getNextState(OpGobParams ¶ms) {
|
2008-07-12 15:21:38 +00:00
|
|
|
params.retVarPtr = (uint32) params.objDesc->nextState;
|
2006-01-10 11:30:23 +00:00
|
|
|
}
|
|
|
|
|
2007-03-20 14:51:57 +00:00
|
|
|
void Inter_v1::o1_getMultState(OpGobParams ¶ms) {
|
2008-07-12 15:21:38 +00:00
|
|
|
params.retVarPtr = (uint32) params.objDesc->multState;
|
2006-01-10 11:30:23 +00:00
|
|
|
}
|
|
|
|
|
2007-03-20 14:51:57 +00:00
|
|
|
void Inter_v1::o1_getOrder(OpGobParams ¶ms) {
|
2008-07-12 15:21:38 +00:00
|
|
|
params.retVarPtr = (uint32) params.objDesc->order;
|
2006-01-10 11:30:23 +00:00
|
|
|
}
|
|
|
|
|
2007-03-20 14:51:57 +00:00
|
|
|
void Inter_v1::o1_getActionStartState(OpGobParams ¶ms) {
|
2008-07-12 15:21:38 +00:00
|
|
|
params.retVarPtr = (uint32) params.objDesc->actionStartState;
|
2006-01-10 11:30:23 +00:00
|
|
|
}
|
|
|
|
|
2007-03-20 14:51:57 +00:00
|
|
|
void Inter_v1::o1_getCurLookDir(OpGobParams ¶ms) {
|
2008-07-12 15:21:38 +00:00
|
|
|
params.retVarPtr = (uint32) params.objDesc->curLookDir;
|
2006-01-10 11:30:23 +00:00
|
|
|
}
|
|
|
|
|
2007-03-20 14:51:57 +00:00
|
|
|
void Inter_v1::o1_getType(OpGobParams ¶ms) {
|
2008-07-12 15:21:38 +00:00
|
|
|
params.retVarPtr = (uint32) params.objDesc->type;
|
2006-01-10 11:30:23 +00:00
|
|
|
}
|
|
|
|
|
2007-03-20 14:51:57 +00:00
|
|
|
void Inter_v1::o1_getNoTick(OpGobParams ¶ms) {
|
2008-07-12 15:21:38 +00:00
|
|
|
params.retVarPtr = (uint32) params.objDesc->noTick;
|
2006-01-10 11:30:23 +00:00
|
|
|
}
|
|
|
|
|
2007-03-20 14:51:57 +00:00
|
|
|
void Inter_v1::o1_getPickable(OpGobParams ¶ms) {
|
2008-07-12 15:21:38 +00:00
|
|
|
params.retVarPtr = (uint32) params.objDesc->pickable;
|
2006-01-10 11:30:23 +00:00
|
|
|
}
|
|
|
|
|
2007-03-20 14:51:57 +00:00
|
|
|
void Inter_v1::o1_getObjMaxFrame(OpGobParams ¶ms) {
|
2008-07-12 15:21:38 +00:00
|
|
|
params.retVarPtr = (uint32) _vm->_goblin->getObjMaxFrame(params.objDesc);
|
2006-01-10 11:30:23 +00:00
|
|
|
}
|
|
|
|
|
2007-03-20 14:51:57 +00:00
|
|
|
void Inter_v1::o1_getXPos(OpGobParams ¶ms) {
|
2008-07-12 15:21:38 +00:00
|
|
|
params.retVarPtr = (uint32) params.objDesc->xPos;
|
2006-01-10 11:30:23 +00:00
|
|
|
}
|
|
|
|
|
2007-03-20 14:51:57 +00:00
|
|
|
void Inter_v1::o1_getYPos(OpGobParams ¶ms) {
|
2008-07-12 15:21:38 +00:00
|
|
|
params.retVarPtr = (uint32) params.objDesc->yPos;
|
2006-01-10 11:30:23 +00:00
|
|
|
}
|
|
|
|
|
2007-03-20 14:51:57 +00:00
|
|
|
void Inter_v1::o1_getDoAnim(OpGobParams ¶ms) {
|
2008-07-12 15:21:38 +00:00
|
|
|
params.retVarPtr = (uint32) params.objDesc->doAnim;
|
2006-01-10 11:30:23 +00:00
|
|
|
}
|
|
|
|
|
2007-03-20 14:51:57 +00:00
|
|
|
void Inter_v1::o1_getRelaxTime(OpGobParams ¶ms) {
|
2008-07-12 15:21:38 +00:00
|
|
|
params.retVarPtr = (uint32) params.objDesc->relaxTime;
|
2006-01-10 11:30:23 +00:00
|
|
|
}
|
|
|
|
|
2007-03-20 14:51:57 +00:00
|
|
|
void Inter_v1::o1_getMaxTick(OpGobParams ¶ms) {
|
2008-07-12 15:21:38 +00:00
|
|
|
params.retVarPtr = (uint32) params.objDesc->maxTick;
|
2006-01-10 11:30:23 +00:00
|
|
|
}
|
|
|
|
|
2007-03-20 14:51:57 +00:00
|
|
|
void Inter_v1::o1_manipulateMap(OpGobParams ¶ms) {
|
2009-06-22 10:13:37 +00:00
|
|
|
int16 xPos = _vm->_game->_script->readInt16();
|
|
|
|
int16 yPos = _vm->_game->_script->readInt16();
|
|
|
|
int16 item = _vm->_game->_script->readInt16();
|
2006-01-10 11:30:23 +00:00
|
|
|
|
|
|
|
manipulateMap(xPos, yPos, item);
|
|
|
|
}
|
|
|
|
|
2007-03-20 14:51:57 +00:00
|
|
|
void Inter_v1::o1_getItem(OpGobParams ¶ms) {
|
2009-06-22 10:13:37 +00:00
|
|
|
int16 xPos = _vm->_game->_script->readInt16();
|
|
|
|
int16 yPos = _vm->_game->_script->readInt16();
|
2006-01-10 11:30:23 +00:00
|
|
|
|
2008-08-23 14:18:12 +00:00
|
|
|
if ((_vm->_map->getItem(xPos, yPos) & 0xFF00) != 0)
|
|
|
|
params.retVarPtr = (uint32) ((_vm->_map->getItem(xPos, yPos) & 0xFF00) >> 8);
|
2006-01-10 11:30:23 +00:00
|
|
|
else
|
2008-08-23 14:18:12 +00:00
|
|
|
params.retVarPtr = (uint32) _vm->_map->getItem(xPos, yPos);
|
2006-01-10 11:30:23 +00:00
|
|
|
}
|
|
|
|
|
2007-03-20 14:51:57 +00:00
|
|
|
void Inter_v1::o1_manipulateMapIndirect(OpGobParams ¶ms) {
|
2009-06-22 10:13:37 +00:00
|
|
|
int16 xPos = _vm->_game->_script->readInt16();
|
|
|
|
int16 yPos = _vm->_game->_script->readInt16();
|
|
|
|
int16 item = _vm->_game->_script->readInt16();
|
2006-01-10 11:30:23 +00:00
|
|
|
|
|
|
|
xPos = VAR(xPos);
|
|
|
|
yPos = VAR(yPos);
|
|
|
|
item = VAR(item);
|
|
|
|
|
|
|
|
manipulateMap(xPos, yPos, item);
|
|
|
|
}
|
|
|
|
|
2007-03-20 14:51:57 +00:00
|
|
|
void Inter_v1::o1_getItemIndirect(OpGobParams ¶ms) {
|
2009-06-22 10:13:37 +00:00
|
|
|
int16 xPos = _vm->_game->_script->readInt16();
|
|
|
|
int16 yPos = _vm->_game->_script->readInt16();
|
2006-01-10 11:30:23 +00:00
|
|
|
|
|
|
|
xPos = VAR(xPos);
|
|
|
|
yPos = VAR(yPos);
|
|
|
|
|
2008-08-23 14:18:12 +00:00
|
|
|
if ((_vm->_map->getItem(xPos, yPos) & 0xFF00) != 0)
|
|
|
|
params.retVarPtr = (uint32) ((_vm->_map->getItem(xPos, yPos) & 0xFF00) >> 8);
|
2006-01-10 11:30:23 +00:00
|
|
|
else
|
2008-08-23 14:18:12 +00:00
|
|
|
params.retVarPtr = (uint32) _vm->_map->getItem(xPos, yPos);
|
2006-01-10 11:30:23 +00:00
|
|
|
}
|
|
|
|
|
2007-03-20 14:51:57 +00:00
|
|
|
void Inter_v1::o1_setPassMap(OpGobParams ¶ms) {
|
2009-06-22 10:13:37 +00:00
|
|
|
int16 xPos = _vm->_game->_script->readInt16();
|
|
|
|
int16 yPos = _vm->_game->_script->readInt16();
|
|
|
|
int16 val = _vm->_game->_script->readInt16();
|
2006-05-29 18:24:52 +00:00
|
|
|
_vm->_map->setPass(xPos, yPos, val);
|
2006-01-10 11:30:23 +00:00
|
|
|
}
|
|
|
|
|
2007-03-20 14:51:57 +00:00
|
|
|
void Inter_v1::o1_setGoblinPosH(OpGobParams ¶ms) {
|
2006-01-10 11:30:23 +00:00
|
|
|
int16 layer;
|
2009-06-22 10:13:37 +00:00
|
|
|
int16 item = _vm->_game->_script->readInt16();
|
|
|
|
int16 xPos = _vm->_game->_script->readInt16();
|
|
|
|
int16 yPos = _vm->_game->_script->readInt16();
|
2006-01-10 11:30:23 +00:00
|
|
|
|
|
|
|
_vm->_goblin->_gobPositions[item].x = xPos * 2;
|
|
|
|
_vm->_goblin->_gobPositions[item].y = yPos * 2;
|
|
|
|
|
2007-03-20 14:51:57 +00:00
|
|
|
params.objDesc = _vm->_goblin->_goblins[item];
|
|
|
|
params.objDesc->nextState = 21;
|
2006-01-10 11:30:23 +00:00
|
|
|
|
2007-03-20 14:51:57 +00:00
|
|
|
_vm->_goblin->nextLayer(params.objDesc);
|
2006-01-10 11:30:23 +00:00
|
|
|
|
2007-03-20 14:51:57 +00:00
|
|
|
layer = params.objDesc->stateMach[params.objDesc->state][0]->layer;
|
2006-01-10 11:30:23 +00:00
|
|
|
|
2007-03-20 14:51:57 +00:00
|
|
|
_vm->_scenery->updateAnim(layer, 0, params.objDesc->animation, 0,
|
|
|
|
params.objDesc->xPos, params.objDesc->yPos, 0);
|
2006-01-10 11:30:23 +00:00
|
|
|
|
2007-03-20 14:51:57 +00:00
|
|
|
params.objDesc->yPos = (_vm->_goblin->_gobPositions[item].y * 6 + 6) -
|
|
|
|
(_vm->_scenery->_toRedrawBottom - _vm->_scenery->_animTop);
|
|
|
|
params.objDesc->xPos =
|
|
|
|
_vm->_goblin->_gobPositions[item].x * 12 -
|
|
|
|
(_vm->_scenery->_toRedrawLeft - _vm->_scenery->_animLeft);
|
2006-01-10 11:30:23 +00:00
|
|
|
|
2007-03-20 14:51:57 +00:00
|
|
|
params.objDesc->curFrame = 0;
|
|
|
|
params.objDesc->state = 21;
|
2006-01-10 11:30:23 +00:00
|
|
|
if (_vm->_goblin->_currentGoblin == item) {
|
2008-07-12 15:21:38 +00:00
|
|
|
_vm->_goblin->_curGobScrXVarPtr = (uint32) params.objDesc->xPos;
|
|
|
|
_vm->_goblin->_curGobScrYVarPtr = (uint32) params.objDesc->yPos;
|
2006-01-10 11:30:23 +00:00
|
|
|
|
2008-07-12 15:21:38 +00:00
|
|
|
_vm->_goblin->_curGobFrameVarPtr = 0;
|
|
|
|
_vm->_goblin->_curGobStateVarPtr = 18;
|
2006-01-10 11:30:23 +00:00
|
|
|
_vm->_goblin->_pressedMapX = _vm->_goblin->_gobPositions[item].x;
|
|
|
|
_vm->_goblin->_pressedMapY = _vm->_goblin->_gobPositions[item].y;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2007-03-20 14:51:57 +00:00
|
|
|
void Inter_v1::o1_getGoblinPosXH(OpGobParams ¶ms) {
|
2009-06-22 10:13:37 +00:00
|
|
|
int16 item = _vm->_game->_script->readInt16();
|
2008-07-12 15:21:38 +00:00
|
|
|
params.retVarPtr = (uint32) (_vm->_goblin->_gobPositions[item].x >> 1);
|
2006-01-10 11:30:23 +00:00
|
|
|
}
|
|
|
|
|
2007-03-20 14:51:57 +00:00
|
|
|
void Inter_v1::o1_getGoblinPosYH(OpGobParams ¶ms) {
|
2009-06-22 10:13:37 +00:00
|
|
|
int16 item = _vm->_game->_script->readInt16();
|
2008-07-12 15:21:38 +00:00
|
|
|
params.retVarPtr = (uint32) (_vm->_goblin->_gobPositions[item].y >> 1);
|
2006-01-10 11:30:23 +00:00
|
|
|
}
|
|
|
|
|
2007-03-20 14:51:57 +00:00
|
|
|
void Inter_v1::o1_setGoblinMultState(OpGobParams ¶ms) {
|
2006-01-10 11:30:23 +00:00
|
|
|
int16 layer;
|
2009-06-22 10:13:37 +00:00
|
|
|
int16 item = _vm->_game->_script->readInt16();
|
|
|
|
int16 xPos = _vm->_game->_script->readInt16();
|
|
|
|
int16 yPos = _vm->_game->_script->readInt16();
|
2006-01-10 11:30:23 +00:00
|
|
|
|
2007-03-20 14:51:57 +00:00
|
|
|
params.objDesc = _vm->_goblin->_goblins[item];
|
2006-01-10 11:30:23 +00:00
|
|
|
if (yPos == 0) {
|
2007-03-20 14:51:57 +00:00
|
|
|
params.objDesc->multState = xPos;
|
|
|
|
params.objDesc->nextState = xPos;
|
|
|
|
_vm->_goblin->nextLayer(params.objDesc);
|
2006-01-10 11:30:23 +00:00
|
|
|
|
2007-03-20 14:51:57 +00:00
|
|
|
layer = params.objDesc->stateMach[params.objDesc->state][0]->layer;
|
2006-01-10 11:30:23 +00:00
|
|
|
|
2007-03-20 14:51:57 +00:00
|
|
|
Scenery::AnimLayer *animLayer =
|
|
|
|
_vm->_scenery->getAnimLayer(params.objDesc->animation, layer);
|
|
|
|
params.objDesc->xPos = animLayer->posX;
|
|
|
|
params.objDesc->yPos = animLayer->posY;
|
2006-01-10 11:30:23 +00:00
|
|
|
|
2008-07-12 15:21:38 +00:00
|
|
|
_vm->_goblin->_curGobScrXVarPtr = (uint32) params.objDesc->xPos;
|
|
|
|
_vm->_goblin->_curGobScrYVarPtr = (uint32) params.objDesc->yPos;
|
|
|
|
_vm->_goblin->_curGobFrameVarPtr = 0;
|
|
|
|
_vm->_goblin->_curGobStateVarPtr = (uint32) params.objDesc->state;
|
|
|
|
_vm->_goblin->_curGobNextStateVarPtr = (uint32) params.objDesc->nextState;
|
|
|
|
_vm->_goblin->_curGobMultStateVarPtr = (uint32) params.objDesc->multState;
|
|
|
|
_vm->_goblin->_curGobMaxFrameVarPtr =
|
|
|
|
(uint32) _vm->_goblin->getObjMaxFrame(params.objDesc);
|
2006-01-10 11:30:23 +00:00
|
|
|
_vm->_goblin->_noPick = 1;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2007-03-20 14:51:57 +00:00
|
|
|
params.objDesc->multState = 21;
|
|
|
|
params.objDesc->nextState = 21;
|
|
|
|
params.objDesc->state = 21;
|
|
|
|
_vm->_goblin->nextLayer(params.objDesc);
|
|
|
|
layer = params.objDesc->stateMach[params.objDesc->state][0]->layer;
|
2006-01-10 11:30:23 +00:00
|
|
|
|
2007-03-20 14:51:57 +00:00
|
|
|
_vm->_scenery->updateAnim(layer, 0, params.objDesc->animation, 0,
|
|
|
|
params.objDesc->xPos, params.objDesc->yPos, 0);
|
2006-01-10 11:30:23 +00:00
|
|
|
|
2007-03-20 14:51:57 +00:00
|
|
|
params.objDesc->yPos = (yPos * 6 + 6) -
|
|
|
|
(_vm->_scenery->_toRedrawBottom - _vm->_scenery->_animTop);
|
|
|
|
params.objDesc->xPos = xPos * 12 -
|
|
|
|
(_vm->_scenery->_toRedrawLeft - _vm->_scenery->_animLeft);
|
2006-01-10 11:30:23 +00:00
|
|
|
|
|
|
|
_vm->_goblin->_gobPositions[item].x = xPos;
|
|
|
|
_vm->_goblin->_pressedMapX = xPos;
|
|
|
|
_vm->_map->_curGoblinX = xPos;
|
|
|
|
|
|
|
|
_vm->_goblin->_gobPositions[item].y = yPos;
|
|
|
|
_vm->_goblin->_pressedMapY = yPos;
|
|
|
|
_vm->_map->_curGoblinY = yPos;
|
|
|
|
|
2008-07-12 15:21:38 +00:00
|
|
|
_vm->_goblin->_curGobScrXVarPtr = (uint32) params.objDesc->xPos;
|
|
|
|
_vm->_goblin->_curGobScrYVarPtr = (uint32) params.objDesc->yPos;
|
|
|
|
_vm->_goblin->_curGobFrameVarPtr = 0;
|
|
|
|
_vm->_goblin->_curGobStateVarPtr = 21;
|
|
|
|
_vm->_goblin->_curGobNextStateVarPtr = 21;
|
|
|
|
_vm->_goblin->_curGobMultStateVarPtr = (uint32) -1;
|
2006-01-10 11:30:23 +00:00
|
|
|
_vm->_goblin->_noPick = 0;
|
|
|
|
}
|
|
|
|
|
2007-03-20 14:51:57 +00:00
|
|
|
void Inter_v1::o1_setGoblinUnk14(OpGobParams ¶ms) {
|
2009-06-22 10:13:37 +00:00
|
|
|
int16 item = _vm->_game->_script->readInt16();
|
|
|
|
int16 val = _vm->_game->_script->readInt16();
|
2007-03-20 14:51:57 +00:00
|
|
|
params.objDesc = _vm->_goblin->_objects[item];
|
|
|
|
params.objDesc->unk14 = val;
|
|
|
|
}
|
|
|
|
|
|
|
|
void Inter_v1::o1_setItemIdInPocket(OpGobParams ¶ms) {
|
2009-06-22 10:13:37 +00:00
|
|
|
_vm->_goblin->_itemIdInPocket = _vm->_game->_script->readInt16();
|
2007-03-20 14:51:57 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void Inter_v1::o1_setItemIndInPocket(OpGobParams ¶ms) {
|
2009-06-22 10:13:37 +00:00
|
|
|
_vm->_goblin->_itemIndInPocket = _vm->_game->_script->readInt16();
|
2007-03-20 14:51:57 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void Inter_v1::o1_getItemIdInPocket(OpGobParams ¶ms) {
|
2008-07-12 15:21:38 +00:00
|
|
|
params.retVarPtr = (uint32) _vm->_goblin->_itemIdInPocket;
|
2007-03-20 14:51:57 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void Inter_v1::o1_getItemIndInPocket(OpGobParams ¶ms) {
|
2008-07-12 15:21:38 +00:00
|
|
|
params.retVarPtr = (uint32) _vm->_goblin->_itemIndInPocket;
|
2007-03-20 14:51:57 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void Inter_v1::o1_setGoblinPos(OpGobParams ¶ms) {
|
2006-01-10 11:30:23 +00:00
|
|
|
int16 layer;
|
2009-06-22 10:13:37 +00:00
|
|
|
int16 item = _vm->_game->_script->readInt16();
|
|
|
|
int16 xPos = _vm->_game->_script->readInt16();
|
|
|
|
int16 yPos = _vm->_game->_script->readInt16();
|
2006-01-10 11:30:23 +00:00
|
|
|
|
|
|
|
_vm->_goblin->_gobPositions[item].x = xPos;
|
|
|
|
_vm->_goblin->_gobPositions[item].y = yPos;
|
|
|
|
|
2007-03-20 14:51:57 +00:00
|
|
|
params.objDesc = _vm->_goblin->_goblins[item];
|
|
|
|
params.objDesc->nextState = 21;
|
|
|
|
_vm->_goblin->nextLayer(params.objDesc);
|
2006-01-10 11:30:23 +00:00
|
|
|
|
2007-03-20 14:51:57 +00:00
|
|
|
layer = params.objDesc->stateMach[params.objDesc->state][0]->layer;
|
2006-01-10 11:30:23 +00:00
|
|
|
|
2007-03-20 14:51:57 +00:00
|
|
|
_vm->_scenery->updateAnim(layer, 0, params.objDesc->animation, 0,
|
|
|
|
params.objDesc->xPos, params.objDesc->yPos, 0);
|
2006-01-10 11:30:23 +00:00
|
|
|
|
2007-03-20 14:51:57 +00:00
|
|
|
params.objDesc->yPos = (yPos * 6 + 6) -
|
|
|
|
(_vm->_scenery->_toRedrawBottom - _vm->_scenery->_animTop);
|
|
|
|
params.objDesc->xPos = xPos * 12 -
|
|
|
|
(_vm->_scenery->_toRedrawLeft - _vm->_scenery->_animLeft);
|
2006-01-10 11:30:23 +00:00
|
|
|
|
2007-03-20 14:51:57 +00:00
|
|
|
params.objDesc->curFrame = 0;
|
|
|
|
params.objDesc->state = 21;
|
2006-01-10 11:30:23 +00:00
|
|
|
|
|
|
|
if (_vm->_goblin->_currentGoblin == item) {
|
2008-07-12 15:21:38 +00:00
|
|
|
_vm->_goblin->_curGobScrXVarPtr = (uint32) params.objDesc->xPos;
|
|
|
|
_vm->_goblin->_curGobScrYVarPtr = (uint32) params.objDesc->yPos;
|
|
|
|
_vm->_goblin->_curGobFrameVarPtr = 0;
|
|
|
|
_vm->_goblin->_curGobStateVarPtr = 18;
|
2006-01-10 11:30:23 +00:00
|
|
|
|
|
|
|
_vm->_goblin->_pressedMapX = _vm->_goblin->_gobPositions[item].x;
|
|
|
|
_vm->_goblin->_pressedMapY = _vm->_goblin->_gobPositions[item].y;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2007-03-20 14:51:57 +00:00
|
|
|
void Inter_v1::o1_setGoblinState(OpGobParams ¶ms) {
|
2006-01-10 11:30:23 +00:00
|
|
|
int16 layer;
|
2009-06-22 10:13:37 +00:00
|
|
|
int16 item = _vm->_game->_script->readInt16();
|
|
|
|
int16 state = _vm->_game->_script->readInt16();
|
2006-01-10 11:30:23 +00:00
|
|
|
|
2007-03-20 14:51:57 +00:00
|
|
|
params.objDesc = _vm->_goblin->_goblins[item];
|
|
|
|
params.objDesc->nextState = state;
|
2006-01-10 11:30:23 +00:00
|
|
|
|
2007-03-20 14:51:57 +00:00
|
|
|
_vm->_goblin->nextLayer(params.objDesc);
|
|
|
|
layer = params.objDesc->stateMach[params.objDesc->state][0]->layer;
|
2006-01-10 11:30:23 +00:00
|
|
|
|
2007-03-20 14:51:57 +00:00
|
|
|
Scenery::AnimLayer *animLayer =
|
|
|
|
_vm->_scenery->getAnimLayer(params.objDesc->animation, layer);
|
|
|
|
params.objDesc->xPos = animLayer->posX;
|
|
|
|
params.objDesc->yPos = animLayer->posY;
|
2006-01-10 11:30:23 +00:00
|
|
|
|
|
|
|
if (item == _vm->_goblin->_currentGoblin) {
|
2008-07-12 15:21:38 +00:00
|
|
|
_vm->_goblin->_curGobScrXVarPtr = (uint32) params.objDesc->xPos;
|
|
|
|
_vm->_goblin->_curGobScrYVarPtr = (uint32) params.objDesc->yPos;
|
|
|
|
_vm->_goblin->_curGobFrameVarPtr = 0;
|
|
|
|
_vm->_goblin->_curGobStateVarPtr = (uint32) params.objDesc->state;
|
|
|
|
_vm->_goblin->_curGobMultStateVarPtr = (uint32) params.objDesc->multState;
|
2006-01-10 11:30:23 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2007-03-20 14:51:57 +00:00
|
|
|
void Inter_v1::o1_setGoblinStateRedraw(OpGobParams ¶ms) {
|
2006-01-10 11:30:23 +00:00
|
|
|
int16 layer;
|
2009-06-22 10:13:37 +00:00
|
|
|
int16 item = _vm->_game->_script->readInt16();
|
|
|
|
int16 state = _vm->_game->_script->readInt16();
|
2007-03-20 14:51:57 +00:00
|
|
|
params.objDesc = _vm->_goblin->_objects[item];
|
|
|
|
|
|
|
|
params.objDesc->nextState = state;
|
2006-01-10 11:30:23 +00:00
|
|
|
|
2007-03-20 14:51:57 +00:00
|
|
|
_vm->_goblin->nextLayer(params.objDesc);
|
|
|
|
layer = params.objDesc->stateMach[params.objDesc->state][0]->layer;
|
2006-01-10 11:30:23 +00:00
|
|
|
|
2007-03-20 14:51:57 +00:00
|
|
|
Scenery::AnimLayer *animLayer =
|
|
|
|
_vm->_scenery->getAnimLayer(params.objDesc->animation, layer);
|
|
|
|
params.objDesc->xPos = animLayer->posX;
|
|
|
|
params.objDesc->yPos = animLayer->posY;
|
2006-01-10 11:30:23 +00:00
|
|
|
|
2007-03-20 14:51:57 +00:00
|
|
|
params.objDesc->toRedraw = 1;
|
|
|
|
params.objDesc->type = 0;
|
|
|
|
if (params.objDesc == _vm->_goblin->_actDestItemDesc) {
|
2008-07-12 15:21:38 +00:00
|
|
|
_vm->_goblin->_destItemScrXVarPtr = (uint32) params.objDesc->xPos;
|
|
|
|
_vm->_goblin->_destItemScrYVarPtr = (uint32) params.objDesc->yPos;
|
2006-01-10 11:30:23 +00:00
|
|
|
|
2008-07-12 15:21:38 +00:00
|
|
|
_vm->_goblin->_destItemStateVarPtr = (uint32) params.objDesc->state;
|
|
|
|
_vm->_goblin->_destItemNextStateVarPtr = (uint32) -1;
|
|
|
|
_vm->_goblin->_destItemMultStateVarPtr = (uint32) -1;
|
|
|
|
_vm->_goblin->_destItemFrameVarPtr = 0;
|
2006-01-10 11:30:23 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2007-03-20 14:51:57 +00:00
|
|
|
void Inter_v1::o1_decRelaxTime(OpGobParams ¶ms) {
|
2009-06-22 10:13:37 +00:00
|
|
|
params.extraData = _vm->_game->_script->readInt16();
|
2007-03-20 14:51:57 +00:00
|
|
|
params.objDesc = _vm->_goblin->_objects[params.extraData];
|
2006-01-10 11:30:23 +00:00
|
|
|
|
2007-03-20 14:51:57 +00:00
|
|
|
params.objDesc->relaxTime--;
|
|
|
|
if ((params.objDesc->relaxTime < 0) &&
|
|
|
|
(_vm->_goblin->getObjMaxFrame(params.objDesc) ==
|
|
|
|
params.objDesc->curFrame)) {
|
|
|
|
params.objDesc->relaxTime = _vm->_util->getRandom(100) + 50;
|
|
|
|
params.objDesc->curFrame = 0;
|
|
|
|
params.objDesc->toRedraw = 1;
|
2006-01-10 11:30:23 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2007-03-20 14:51:57 +00:00
|
|
|
void Inter_v1::o1_getGoblinPosX(OpGobParams ¶ms) {
|
2009-06-22 10:13:37 +00:00
|
|
|
int16 item = _vm->_game->_script->readInt16();
|
2008-07-12 15:21:38 +00:00
|
|
|
params.retVarPtr = (uint32) _vm->_goblin->_gobPositions[item].x;
|
2006-01-10 11:30:23 +00:00
|
|
|
}
|
|
|
|
|
2007-03-20 14:51:57 +00:00
|
|
|
void Inter_v1::o1_getGoblinPosY(OpGobParams ¶ms) {
|
2009-06-22 10:13:37 +00:00
|
|
|
int16 item = _vm->_game->_script->readInt16();
|
2008-07-12 15:21:38 +00:00
|
|
|
params.retVarPtr = (uint32) _vm->_goblin->_gobPositions[item].y;
|
2006-01-10 11:30:23 +00:00
|
|
|
}
|
|
|
|
|
2007-03-20 14:51:57 +00:00
|
|
|
void Inter_v1::o1_clearPathExistence(OpGobParams ¶ms) {
|
2006-01-10 11:30:23 +00:00
|
|
|
_vm->_goblin->_pathExistence = 0;
|
|
|
|
}
|
|
|
|
|
2007-03-20 14:51:57 +00:00
|
|
|
void Inter_v1::o1_setGoblinVisible(OpGobParams ¶ms) {
|
2009-06-22 10:13:37 +00:00
|
|
|
params.extraData = _vm->_game->_script->readInt16();
|
2007-03-20 14:51:57 +00:00
|
|
|
_vm->_goblin->_goblins[params.extraData]->visible = 1;
|
2006-01-10 11:30:23 +00:00
|
|
|
}
|
|
|
|
|
2007-03-20 14:51:57 +00:00
|
|
|
void Inter_v1::o1_setGoblinInvisible(OpGobParams ¶ms) {
|
2009-06-22 10:13:37 +00:00
|
|
|
params.extraData = _vm->_game->_script->readInt16();
|
2007-03-20 14:51:57 +00:00
|
|
|
_vm->_goblin->_goblins[params.extraData]->visible = 0;
|
2006-01-10 11:30:23 +00:00
|
|
|
}
|
|
|
|
|
2007-03-20 14:51:57 +00:00
|
|
|
void Inter_v1::o1_getObjectIntersect(OpGobParams ¶ms) {
|
2009-06-22 10:13:37 +00:00
|
|
|
params.extraData = _vm->_game->_script->readInt16();
|
|
|
|
int16 item = _vm->_game->_script->readInt16();
|
2006-01-10 11:30:23 +00:00
|
|
|
|
2007-03-20 14:51:57 +00:00
|
|
|
params.objDesc = _vm->_goblin->_objects[params.extraData];
|
|
|
|
if (_vm->_goblin->objIntersected(params.objDesc,
|
|
|
|
_vm->_goblin->_goblins[item]))
|
2008-07-12 15:21:38 +00:00
|
|
|
params.retVarPtr = 1;
|
2006-01-10 11:30:23 +00:00
|
|
|
else
|
2008-07-12 15:21:38 +00:00
|
|
|
params.retVarPtr = 0;
|
2006-01-10 11:30:23 +00:00
|
|
|
}
|
|
|
|
|
2007-03-20 14:51:57 +00:00
|
|
|
void Inter_v1::o1_getGoblinIntersect(OpGobParams ¶ms) {
|
2009-06-22 10:13:37 +00:00
|
|
|
params.extraData = _vm->_game->_script->readInt16();
|
|
|
|
int16 item = _vm->_game->_script->readInt16();
|
2006-01-10 11:30:23 +00:00
|
|
|
|
2007-03-20 14:51:57 +00:00
|
|
|
params.objDesc = _vm->_goblin->_goblins[params.extraData];
|
|
|
|
if (_vm->_goblin->objIntersected(params.objDesc,
|
|
|
|
_vm->_goblin->_goblins[item]))
|
2008-07-12 15:21:38 +00:00
|
|
|
params.retVarPtr = 1;
|
2006-01-10 11:30:23 +00:00
|
|
|
else
|
2008-07-12 15:21:38 +00:00
|
|
|
params.retVarPtr = 0;
|
2007-03-20 14:51:57 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void Inter_v1::o1_setItemPos(OpGobParams ¶ms) {
|
2009-06-22 10:13:37 +00:00
|
|
|
int16 item = _vm->_game->_script->readInt16();
|
|
|
|
int16 xPos = _vm->_game->_script->readInt16();
|
|
|
|
int16 yPos = _vm->_game->_script->readInt16();
|
|
|
|
int16 val = _vm->_game->_script->readInt16();
|
2007-03-20 14:51:57 +00:00
|
|
|
|
|
|
|
_vm->_map->_itemPoses[item].x = xPos;
|
|
|
|
_vm->_map->_itemPoses[item].y = yPos;
|
|
|
|
_vm->_map->_itemPoses[item].orient = val;
|
2006-01-10 11:30:23 +00:00
|
|
|
}
|
|
|
|
|
2007-03-20 14:51:57 +00:00
|
|
|
void Inter_v1::o1_loadObjects(OpGobParams ¶ms) {
|
2009-06-22 10:13:37 +00:00
|
|
|
params.extraData = _vm->_game->_script->readInt16();
|
2006-01-10 11:30:23 +00:00
|
|
|
|
2009-07-28 16:28:32 +00:00
|
|
|
_vm->_goblin->loadObjects(_variables->getAddressVarString(params.extraData));
|
2006-01-10 11:30:23 +00:00
|
|
|
}
|
|
|
|
|
2007-03-20 14:51:57 +00:00
|
|
|
void Inter_v1::o1_freeObjects(OpGobParams ¶ms) {
|
2006-01-10 11:30:23 +00:00
|
|
|
_vm->_goblin->freeAllObjects();
|
|
|
|
}
|
|
|
|
|
2007-03-20 14:51:57 +00:00
|
|
|
void Inter_v1::o1_animateObjects(OpGobParams ¶ms) {
|
2006-01-10 11:30:23 +00:00
|
|
|
_vm->_goblin->animateObjects();
|
|
|
|
}
|
|
|
|
|
2007-03-20 14:51:57 +00:00
|
|
|
void Inter_v1::o1_drawObjects(OpGobParams ¶ms) {
|
2006-01-10 11:30:23 +00:00
|
|
|
_vm->_goblin->drawObjects();
|
|
|
|
|
2008-05-08 00:47:23 +00:00
|
|
|
_vm->_sound->adlibPlayBgMusic(); // Mac version
|
|
|
|
if (_vm->_sound->cdGetTrackPos() == -1)
|
|
|
|
_vm->_sound->cdPlayBgMusic(); // PC CD version
|
2006-01-10 11:30:23 +00:00
|
|
|
}
|
|
|
|
|
2007-03-20 14:51:57 +00:00
|
|
|
void Inter_v1::o1_loadMap(OpGobParams ¶ms) {
|
2006-01-10 11:30:23 +00:00
|
|
|
_vm->_map->loadMapsInitGobs();
|
|
|
|
}
|
|
|
|
|
2007-03-20 14:51:57 +00:00
|
|
|
void Inter_v1::o1_moveGoblin(OpGobParams ¶ms) {
|
2006-01-10 11:30:23 +00:00
|
|
|
int16 item;
|
2009-06-22 10:13:37 +00:00
|
|
|
params.extraData = _vm->_game->_script->readInt16();
|
|
|
|
int16 xPos = _vm->_game->_script->readInt16();
|
2006-01-10 11:30:23 +00:00
|
|
|
|
2007-03-20 14:51:57 +00:00
|
|
|
if ((uint16) VAR(xPos) == 0) {
|
2006-01-10 11:30:23 +00:00
|
|
|
item =
|
2007-03-20 14:51:57 +00:00
|
|
|
_vm->_goblin->doMove(_vm->_goblin->_goblins[_vm->_goblin->_currentGoblin],
|
|
|
|
1, (uint16) VAR(params.extraData));
|
2006-01-10 11:30:23 +00:00
|
|
|
} else {
|
|
|
|
item =
|
2007-03-20 14:51:57 +00:00
|
|
|
_vm->_goblin->doMove(_vm->_goblin->_goblins[_vm->_goblin->_currentGoblin],
|
|
|
|
1, 3);
|
2006-01-10 11:30:23 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
if (item != 0)
|
|
|
|
_vm->_goblin->switchGoblin(item);
|
|
|
|
}
|
|
|
|
|
2007-03-20 14:51:57 +00:00
|
|
|
void Inter_v1::o1_switchGoblin(OpGobParams ¶ms) {
|
2006-01-10 11:30:23 +00:00
|
|
|
_vm->_goblin->switchGoblin(0);
|
|
|
|
}
|
|
|
|
|
2007-03-20 14:51:57 +00:00
|
|
|
void Inter_v1::o1_loadGoblin(OpGobParams ¶ms) {
|
2006-01-10 11:30:23 +00:00
|
|
|
_vm->_goblin->loadGobDataFromVars();
|
|
|
|
}
|
|
|
|
|
2007-03-20 14:51:57 +00:00
|
|
|
void Inter_v1::o1_writeTreatItem(OpGobParams ¶ms) {
|
2009-06-22 10:13:37 +00:00
|
|
|
params.extraData = _vm->_game->_script->readInt16();
|
|
|
|
int16 cmd = _vm->_game->_script->readInt16();
|
|
|
|
int16 xPos = _vm->_game->_script->readInt16();
|
2006-01-10 11:30:23 +00:00
|
|
|
|
2007-03-20 14:51:57 +00:00
|
|
|
if ((uint16) VAR(xPos) == 0) {
|
|
|
|
WRITE_VAR(cmd, _vm->_goblin->treatItem((uint16) VAR(params.extraData)));
|
2006-01-10 11:30:23 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
WRITE_VAR(cmd, _vm->_goblin->treatItem(3));
|
|
|
|
}
|
|
|
|
|
2007-03-20 14:51:57 +00:00
|
|
|
void Inter_v1::o1_moveGoblin0(OpGobParams ¶ms) {
|
|
|
|
_vm->_goblin->doMove(_vm->_goblin->_goblins[_vm->_goblin->_currentGoblin],
|
|
|
|
0, 0);
|
2006-01-10 11:30:23 +00:00
|
|
|
}
|
|
|
|
|
2007-03-20 14:51:57 +00:00
|
|
|
void Inter_v1::o1_setGoblinTarget(OpGobParams ¶ms) {
|
2009-06-22 10:13:37 +00:00
|
|
|
params.extraData = _vm->_game->_script->readInt16();
|
2007-03-20 14:51:57 +00:00
|
|
|
if (VAR(params.extraData) != 0)
|
2006-01-10 11:30:23 +00:00
|
|
|
_vm->_goblin->_goesAtTarget = 1;
|
|
|
|
else
|
|
|
|
_vm->_goblin->_goesAtTarget = 0;
|
|
|
|
}
|
|
|
|
|
2007-03-20 14:51:57 +00:00
|
|
|
void Inter_v1::o1_setGoblinObjectsPos(OpGobParams ¶ms) {
|
2009-06-22 10:13:37 +00:00
|
|
|
params.extraData = _vm->_game->_script->readInt16();
|
2007-03-20 14:51:57 +00:00
|
|
|
params.extraData = VAR(params.extraData);
|
|
|
|
_vm->_goblin->_objects[10]->xPos = params.extraData;
|
2006-01-10 11:30:23 +00:00
|
|
|
|
2009-06-22 10:13:37 +00:00
|
|
|
params.extraData = _vm->_game->_script->readInt16();
|
2007-03-20 14:51:57 +00:00
|
|
|
params.extraData = VAR(params.extraData);
|
|
|
|
_vm->_goblin->_objects[10]->yPos = params.extraData;
|
2006-01-10 11:30:23 +00:00
|
|
|
}
|
|
|
|
|
2007-03-20 14:51:57 +00:00
|
|
|
void Inter_v1::o1_initGoblin(OpGobParams ¶ms) {
|
2006-01-10 11:30:23 +00:00
|
|
|
Goblin::Gob_Object *gobDesc = _vm->_goblin->_goblins[0];
|
|
|
|
int16 xPos;
|
|
|
|
int16 yPos;
|
|
|
|
int16 layer;
|
|
|
|
|
|
|
|
if (_vm->_goblin->_currentGoblin != 0) {
|
|
|
|
_vm->_goblin->_goblins[_vm->_goblin->_currentGoblin]->doAnim = 1;
|
|
|
|
_vm->_goblin->_goblins[_vm->_goblin->_currentGoblin]->nextState = 21;
|
|
|
|
|
|
|
|
_vm->_goblin->nextLayer(_vm->_goblin->_goblins[_vm->_goblin->_currentGoblin]);
|
|
|
|
_vm->_goblin->_currentGoblin = 0;
|
|
|
|
|
|
|
|
gobDesc->doAnim = 0;
|
|
|
|
gobDesc->type = 0;
|
|
|
|
gobDesc->toRedraw = 1;
|
|
|
|
|
|
|
|
_vm->_goblin->_pressedMapX = _vm->_goblin->_gobPositions[0].x;
|
|
|
|
_vm->_map->_destX = _vm->_goblin->_gobPositions[0].x;
|
|
|
|
_vm->_goblin->_gobDestX = _vm->_goblin->_gobPositions[0].x;
|
|
|
|
|
|
|
|
_vm->_goblin->_pressedMapY = _vm->_goblin->_gobPositions[0].y;
|
|
|
|
_vm->_map->_destY = _vm->_goblin->_gobPositions[0].y;
|
|
|
|
_vm->_goblin->_gobDestY = _vm->_goblin->_gobPositions[0].y;
|
|
|
|
|
2008-07-12 15:21:38 +00:00
|
|
|
_vm->_goblin->_curGobVarPtr = 0;
|
2006-01-10 11:30:23 +00:00
|
|
|
_vm->_goblin->_pathExistence = 0;
|
|
|
|
_vm->_goblin->_readyToAct = 0;
|
|
|
|
}
|
|
|
|
|
2007-03-20 14:51:57 +00:00
|
|
|
if ((gobDesc->state != 10) && (_vm->_goblin->_itemIndInPocket != -1) &&
|
|
|
|
(_vm->_goblin->getObjMaxFrame(gobDesc) == gobDesc->curFrame)) {
|
2006-01-10 11:30:23 +00:00
|
|
|
|
|
|
|
gobDesc->stateMach = gobDesc->realStateMach;
|
|
|
|
xPos = _vm->_goblin->_gobPositions[0].x;
|
|
|
|
yPos = _vm->_goblin->_gobPositions[0].y;
|
|
|
|
|
|
|
|
gobDesc->nextState = 10;
|
|
|
|
layer = _vm->_goblin->nextLayer(gobDesc);
|
|
|
|
|
|
|
|
_vm->_scenery->updateAnim(layer, 0, gobDesc->animation, 0,
|
|
|
|
gobDesc->xPos, gobDesc->yPos, 0);
|
|
|
|
|
2007-03-20 14:51:57 +00:00
|
|
|
gobDesc->yPos = (yPos * 6 + 6) -
|
|
|
|
(_vm->_scenery->_toRedrawBottom - _vm->_scenery->_animTop);
|
|
|
|
gobDesc->xPos = xPos * 12 -
|
|
|
|
(_vm->_scenery->_toRedrawLeft - _vm->_scenery->_animLeft);
|
2006-01-10 11:30:23 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
if (gobDesc->state != 10)
|
|
|
|
return;
|
|
|
|
|
|
|
|
if (_vm->_goblin->_itemIndInPocket == -1)
|
|
|
|
return;
|
|
|
|
|
|
|
|
if (gobDesc->curFrame != 10)
|
|
|
|
return;
|
|
|
|
|
2007-03-20 14:51:57 +00:00
|
|
|
params.objDesc = _vm->_goblin->_objects[_vm->_goblin->_itemIndInPocket];
|
|
|
|
params.objDesc->type = 0;
|
|
|
|
params.objDesc->toRedraw = 1;
|
|
|
|
params.objDesc->curFrame = 0;
|
2006-01-10 11:30:23 +00:00
|
|
|
|
2007-03-20 14:51:57 +00:00
|
|
|
params.objDesc->order = gobDesc->order;
|
|
|
|
params.objDesc->animation =
|
|
|
|
params.objDesc->stateMach[params.objDesc->state][0]->animation;
|
2006-01-10 11:30:23 +00:00
|
|
|
|
2007-03-20 14:51:57 +00:00
|
|
|
layer = params.objDesc->stateMach[params.objDesc->state][0]->layer;
|
2006-01-10 11:30:23 +00:00
|
|
|
|
2007-03-20 14:51:57 +00:00
|
|
|
_vm->_scenery->updateAnim(layer, 0, params.objDesc->animation, 0,
|
|
|
|
params.objDesc->xPos, params.objDesc->yPos, 0);
|
2006-01-10 11:30:23 +00:00
|
|
|
|
2007-03-20 14:51:57 +00:00
|
|
|
params.objDesc->yPos += (_vm->_goblin->_gobPositions[0].y * 6 + 5) -
|
|
|
|
_vm->_scenery->_toRedrawBottom;
|
2006-01-10 11:30:23 +00:00
|
|
|
|
|
|
|
if (gobDesc->curLookDir == 4) {
|
2007-03-20 14:51:57 +00:00
|
|
|
params.objDesc->xPos += _vm->_goblin->_gobPositions[0].x * 12 + 14
|
2006-01-10 11:30:23 +00:00
|
|
|
- (_vm->_scenery->_toRedrawLeft + _vm->_scenery->_toRedrawRight) / 2;
|
|
|
|
} else {
|
2007-03-20 14:51:57 +00:00
|
|
|
params.objDesc->xPos += _vm->_goblin->_gobPositions[0].x * 12
|
2006-01-10 11:30:23 +00:00
|
|
|
- (_vm->_scenery->_toRedrawLeft + _vm->_scenery->_toRedrawRight) / 2;
|
|
|
|
}
|
|
|
|
|
|
|
|
_vm->_goblin->_itemIndInPocket = -1;
|
|
|
|
_vm->_goblin->_itemIdInPocket = -1;
|
|
|
|
_vm->_util->beep(50);
|
|
|
|
}
|
2006-01-05 16:06:55 +00:00
|
|
|
|
2006-02-24 21:58:03 +00:00
|
|
|
int16 Inter_v1::loadSound(int16 slot) {
|
|
|
|
if (slot == -1)
|
2009-06-22 10:13:37 +00:00
|
|
|
slot = _vm->_game->_script->readValExpr();
|
2006-02-24 21:58:03 +00:00
|
|
|
|
2009-06-24 21:49:37 +00:00
|
|
|
uint16 id = _vm->_game->_script->readUint16();
|
|
|
|
if (id == 0xFFFF) {
|
2009-06-22 10:13:37 +00:00
|
|
|
_vm->_game->_script->skip(9);
|
2006-02-24 21:58:03 +00:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2009-06-24 21:49:37 +00:00
|
|
|
Resource *resource = _vm->_game->_resources->getResource(id);
|
|
|
|
if (!resource)
|
|
|
|
return 0;
|
2006-04-13 20:56:22 +00:00
|
|
|
|
2009-06-24 21:49:37 +00:00
|
|
|
SoundDesc *sample = _vm->_sound->sampleGetBySlot(slot);
|
|
|
|
if (!sample)
|
|
|
|
return 0;
|
2006-12-19 07:38:33 +00:00
|
|
|
|
2009-06-24 21:49:37 +00:00
|
|
|
sample->load(SOUND_SND, resource);
|
2007-03-20 14:51:57 +00:00
|
|
|
return 0;
|
2006-05-01 12:43:50 +00:00
|
|
|
}
|
|
|
|
|
2007-03-20 14:51:57 +00:00
|
|
|
void Inter_v1::animPalette() {
|
2006-05-11 19:43:30 +00:00
|
|
|
int16 i;
|
|
|
|
Video::Color col;
|
|
|
|
|
|
|
|
if (_animPalDir[0] == 0)
|
|
|
|
return;
|
|
|
|
|
2007-03-29 17:55:39 +00:00
|
|
|
_vm->_video->waitRetrace();
|
2006-05-11 19:43:30 +00:00
|
|
|
|
|
|
|
if (_animPalDir[0] == -1) {
|
|
|
|
col = _vm->_draw->_vgaSmallPalette[_animPalLowIndex[0]];
|
|
|
|
|
|
|
|
for (i = _animPalLowIndex[0]; i < _animPalHighIndex[0]; i++)
|
|
|
|
_vm->_draw->_vgaSmallPalette[i] = _vm->_draw->_vgaSmallPalette[i + 1];
|
|
|
|
|
|
|
|
_vm->_draw->_vgaSmallPalette[_animPalHighIndex[0]] = col;
|
|
|
|
} else {
|
|
|
|
col = _vm->_draw->_vgaSmallPalette[_animPalHighIndex[0]];
|
|
|
|
for (i = _animPalHighIndex[0]; i > _animPalLowIndex[0]; i--)
|
|
|
|
_vm->_draw->_vgaSmallPalette[i] = _vm->_draw->_vgaSmallPalette[i - 1];
|
|
|
|
|
|
|
|
_vm->_draw->_vgaSmallPalette[_animPalLowIndex[0]] = col;
|
|
|
|
}
|
|
|
|
|
|
|
|
_vm->_global->_pPaletteDesc->vgaPal = _vm->_draw->_vgaSmallPalette;
|
|
|
|
_vm->_video->setFullPalette(_vm->_global->_pPaletteDesc);
|
|
|
|
}
|
|
|
|
|
2007-03-20 14:51:57 +00:00
|
|
|
void Inter_v1::manipulateMap(int16 xPos, int16 yPos, int16 item) {
|
2010-10-30 17:28:27 +00:00
|
|
|
for (int y = 0; y < _vm->_map->getMapHeight(); y++) {
|
|
|
|
for (int x = 0; x < _vm->_map->getMapWidth(); x++) {
|
2008-08-23 14:18:12 +00:00
|
|
|
if ((_vm->_map->getItem(x, y) & 0xFF) == item)
|
|
|
|
_vm->_map->setItem(x, y, _vm->_map->getItem(x, y) & 0xFF00);
|
|
|
|
else if (((_vm->_map->getItem(x, y) & 0xFF00) >> 8) == item)
|
|
|
|
_vm->_map->setItem(x, y, _vm->_map->getItem(x, y) & 0xFF);
|
2007-03-20 14:51:57 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2010-10-30 17:28:27 +00:00
|
|
|
if (xPos < _vm->_map->getMapWidth() - 1) {
|
2007-03-20 14:51:57 +00:00
|
|
|
if (yPos > 0) {
|
2008-08-23 14:18:12 +00:00
|
|
|
if (((_vm->_map->getItem(xPos, yPos) & 0xFF00) != 0) ||
|
|
|
|
((_vm->_map->getItem(xPos, yPos - 1) & 0xFF00) != 0) ||
|
|
|
|
((_vm->_map->getItem(xPos + 1, yPos) & 0xFF00) != 0) ||
|
|
|
|
((_vm->_map->getItem(xPos + 1, yPos - 1) & 0xFF00) != 0)) {
|
2007-03-20 14:51:57 +00:00
|
|
|
|
2008-08-23 14:18:12 +00:00
|
|
|
_vm->_map->setItem(xPos, yPos,
|
|
|
|
(_vm->_map->getItem(xPos, yPos) & 0xFF00) + item);
|
2007-03-20 14:51:57 +00:00
|
|
|
|
2008-08-23 14:18:12 +00:00
|
|
|
_vm->_map->setItem(xPos, yPos - 1,
|
|
|
|
(_vm->_map->getItem(xPos, yPos - 1) & 0xFF00) + item);
|
2007-03-20 14:51:57 +00:00
|
|
|
|
2008-08-23 14:18:12 +00:00
|
|
|
_vm->_map->setItem(xPos + 1, yPos,
|
|
|
|
(_vm->_map->getItem(xPos + 1, yPos) & 0xFF00) + item);
|
2007-03-20 14:51:57 +00:00
|
|
|
|
2008-08-23 14:18:12 +00:00
|
|
|
_vm->_map->setItem(xPos + 1, yPos - 1,
|
|
|
|
(_vm->_map->getItem(xPos + 1, yPos - 1) & 0xFF00) + item);
|
2007-03-20 14:51:57 +00:00
|
|
|
|
|
|
|
} else {
|
2008-08-23 14:18:12 +00:00
|
|
|
_vm->_map->setItem(xPos, yPos,
|
|
|
|
(_vm->_map->getItem(xPos, yPos) & 0xFF) + (item << 8));
|
2007-03-20 14:51:57 +00:00
|
|
|
|
2008-08-23 14:18:12 +00:00
|
|
|
_vm->_map->setItem(xPos, yPos - 1,
|
|
|
|
(_vm->_map->getItem(xPos, yPos - 1) & 0xFF) + (item << 8));
|
2007-03-20 14:51:57 +00:00
|
|
|
|
2008-08-23 14:18:12 +00:00
|
|
|
_vm->_map->setItem(xPos + 1, yPos,
|
|
|
|
(_vm->_map->getItem(xPos + 1, yPos) & 0xFF) + (item << 8));
|
2007-03-20 14:51:57 +00:00
|
|
|
|
2008-08-23 14:18:12 +00:00
|
|
|
_vm->_map->setItem(xPos + 1, yPos - 1,
|
|
|
|
(_vm->_map->getItem(xPos + 1, yPos - 1) & 0xFF) + (item << 8));
|
2007-03-20 14:51:57 +00:00
|
|
|
}
|
|
|
|
} else {
|
2008-08-23 14:18:12 +00:00
|
|
|
if (((_vm->_map->getItem(xPos, yPos) & 0xFF00) != 0) ||
|
|
|
|
((_vm->_map->getItem(xPos + 1, yPos) & 0xFF00) != 0)) {
|
2007-03-20 14:51:57 +00:00
|
|
|
|
2008-08-23 14:18:12 +00:00
|
|
|
_vm->_map->setItem(xPos, yPos,
|
|
|
|
(_vm->_map->getItem(xPos, yPos) & 0xFF00) + item);
|
2007-03-20 14:51:57 +00:00
|
|
|
|
2008-08-23 14:18:12 +00:00
|
|
|
_vm->_map->setItem(xPos + 1, yPos,
|
|
|
|
(_vm->_map->getItem(xPos + 1, yPos) & 0xFF00) + item);
|
2007-03-20 14:51:57 +00:00
|
|
|
|
|
|
|
} else {
|
2008-08-23 14:18:12 +00:00
|
|
|
_vm->_map->setItem(xPos, yPos,
|
|
|
|
(_vm->_map->getItem(xPos, yPos) & 0xFF) + (item << 8));
|
2007-03-20 14:51:57 +00:00
|
|
|
|
2008-08-23 14:18:12 +00:00
|
|
|
_vm->_map->setItem(xPos + 1, yPos,
|
|
|
|
(_vm->_map->getItem(xPos + 1, yPos) & 0xFF) + (item << 8));
|
2007-03-20 14:51:57 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
if (yPos > 0) {
|
2008-08-23 14:18:12 +00:00
|
|
|
if (((_vm->_map->getItem(xPos, yPos) & 0xFF00) != 0) ||
|
|
|
|
((_vm->_map->getItem(xPos, yPos - 1) & 0xFF00) != 0)) {
|
2007-03-20 14:51:57 +00:00
|
|
|
|
2008-08-23 14:18:12 +00:00
|
|
|
_vm->_map->setItem(xPos, yPos,
|
|
|
|
(_vm->_map->getItem(xPos, yPos) & 0xFF00) + item);
|
2007-03-20 14:51:57 +00:00
|
|
|
|
2008-08-23 14:18:12 +00:00
|
|
|
_vm->_map->setItem(xPos, yPos - 1,
|
|
|
|
(_vm->_map->getItem(xPos, yPos - 1) & 0xFF00) + item);
|
2007-03-20 14:51:57 +00:00
|
|
|
|
|
|
|
} else {
|
2008-08-23 14:18:12 +00:00
|
|
|
_vm->_map->setItem(xPos, yPos,
|
|
|
|
(_vm->_map->getItem(xPos, yPos) & 0xFF) + (item << 8));
|
2007-03-20 14:51:57 +00:00
|
|
|
|
2008-08-23 14:18:12 +00:00
|
|
|
_vm->_map->setItem(xPos, yPos - 1,
|
|
|
|
(_vm->_map->getItem(xPos, yPos - 1) & 0xFF) + (item << 8));
|
2007-03-20 14:51:57 +00:00
|
|
|
}
|
|
|
|
} else {
|
2008-08-23 14:18:12 +00:00
|
|
|
if ((_vm->_map->getItem(xPos, yPos) & 0xFF00) != 0) {
|
|
|
|
_vm->_map->setItem(xPos, yPos,
|
|
|
|
(_vm->_map->getItem(xPos, yPos) & 0xFF00) + item);
|
2007-03-20 14:51:57 +00:00
|
|
|
} else {
|
2008-08-23 14:18:12 +00:00
|
|
|
_vm->_map->setItem(xPos, yPos,
|
|
|
|
(_vm->_map->getItem(xPos, yPos) & 0xFF) + (item << 8));
|
2007-03-20 14:51:57 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if ((item < 0) || (item >= 20))
|
|
|
|
return;
|
|
|
|
|
|
|
|
if ((xPos > 1) && (_vm->_map->getPass(xPos - 2, yPos) == 1)) {
|
|
|
|
_vm->_map->_itemPoses[item].x = xPos - 2;
|
|
|
|
_vm->_map->_itemPoses[item].y = yPos;
|
|
|
|
_vm->_map->_itemPoses[item].orient = 4;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2010-10-30 17:28:27 +00:00
|
|
|
if ((xPos < _vm->_map->getMapWidth() - 2) &&
|
2007-03-20 14:51:57 +00:00
|
|
|
(_vm->_map->getPass(xPos + 2, yPos) == 1)) {
|
|
|
|
_vm->_map->_itemPoses[item].x = xPos + 2;
|
|
|
|
_vm->_map->_itemPoses[item].y = yPos;
|
|
|
|
_vm->_map->_itemPoses[item].orient = 0;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2010-10-30 17:28:27 +00:00
|
|
|
if ((xPos < _vm->_map->getMapWidth() - 1) &&
|
2007-03-20 14:51:57 +00:00
|
|
|
(_vm->_map->getPass(xPos + 1, yPos) == 1)) {
|
|
|
|
_vm->_map->_itemPoses[item].x = xPos + 1;
|
|
|
|
_vm->_map->_itemPoses[item].y = yPos;
|
|
|
|
_vm->_map->_itemPoses[item].orient = 0;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
if ((xPos > 0) && (_vm->_map->getPass(xPos - 1, yPos) == 1)) {
|
|
|
|
_vm->_map->_itemPoses[item].x = xPos - 1;
|
|
|
|
_vm->_map->_itemPoses[item].y = yPos;
|
|
|
|
_vm->_map->_itemPoses[item].orient = 4;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2006-01-05 16:06:55 +00:00
|
|
|
} // End of namespace Gob
|