- Moved some opcodes to KyraEngine_v1

- Little variable renaming

svn-id: r32053
This commit is contained in:
Johannes Schickel 2008-05-12 12:42:10 +00:00
parent e8e4c5dafb
commit 574af78acb
22 changed files with 177 additions and 205 deletions

View file

@ -139,7 +139,7 @@ void KyraEngine_HoF::updateItemAnimations() {
return; return;
uint16 shpIdx = s->frames[a->currentFrame].index + 64; uint16 shpIdx = s->frames[a->currentFrame].index + 64;
if (s->itemIndex == _handItemSet && s->itemIndex == _itemInHand && _screen->isMouseVisible()) { if (s->itemIndex == _mouseState && s->itemIndex == _itemInHand && _screen->isMouseVisible()) {
nextFrame = true; nextFrame = true;
_screen->setMouseCursor(8, 15, getShapePtr(shpIdx)); _screen->setMouseCursor(8, 15, getShapePtr(shpIdx));
} }

View file

@ -216,7 +216,7 @@ void KyraEngine_MR::updateItemAnimations() {
return; return;
uint16 shpIdx = s->frames[a->currentFrame].index + 248; uint16 shpIdx = s->frames[a->currentFrame].index + 248;
if (s->itemIndex == _handItemSet && s->itemIndex == _itemInHand && _screen->isMouseVisible()) { if (s->itemIndex == _mouseState && s->itemIndex == _itemInHand && _screen->isMouseVisible()) {
nextFrame = true; nextFrame = true;
_screen->setMouseCursor(12, 19, getShapePtr(shpIdx)); _screen->setMouseCursor(12, 19, getShapePtr(shpIdx));
} }

View file

@ -348,7 +348,7 @@ int KyraEngine_HoF::bookButton(Button *button) {
return 0; return 0;
} }
if (_handItemSet != -1) { if (_mouseState != -1) {
snd_playSoundEffect(0x0D); snd_playSoundEffect(0x0D);
return 0; return 0;
} }
@ -601,7 +601,7 @@ int KyraEngine_HoF::cauldronButton(Button *button) {
return 0; return 0;
} }
if (!_screen->isMouseVisible() || _handItemSet < -1) if (!_screen->isMouseVisible() || _mouseState < -1)
return 0; return 0;
if (queryGameFlag(0xE4)) { if (queryGameFlag(0xE4)) {
@ -681,8 +681,8 @@ int GUI_HoF::optionsButton(Button *button) {
_vm->showMessage(0, 0xCF); _vm->showMessage(0, 0xCF);
if (_vm->_handItemSet < -1) { if (_vm->_mouseState < -1) {
_vm->_handItemSet = -1; _vm->_mouseState = -1;
_screen->hideMouse(); _screen->hideMouse();
_screen->setMouseCursor(1, 1, _vm->getShapePtr(0)); _screen->setMouseCursor(1, 1, _vm->getShapePtr(0));
_screen->showMouse(); _screen->showMouse();

View file

@ -194,7 +194,7 @@ void KyraEngine_MR::showInventory() {
_screen->hideMouse(); _screen->hideMouse();
if (_itemInHand < 0) { if (_itemInHand < 0) {
_handItemSet = -1; _mouseState = -1;
_screen->setMouseCursor(0, 0, getShapePtr(0)); _screen->setMouseCursor(0, 0, getShapePtr(0));
} }
@ -684,7 +684,7 @@ int KyraEngine_MR::buttonJesterStaff(Button *button) {
void KyraEngine_MR::showAlbum() { void KyraEngine_MR::showAlbum() {
debugC(9, kDebugLevelMain, "KyraEngine_MR::showAlbum()"); debugC(9, kDebugLevelMain, "KyraEngine_MR::showAlbum()");
if (!_screen->isMouseVisible() || queryGameFlag(4) || _handItemSet != -1) if (!_screen->isMouseVisible() || queryGameFlag(4) || _mouseState != -1)
return; return;
if (!loadLanguageFile("ALBUM.", _album.file)) if (!loadLanguageFile("ALBUM.", _album.file))
@ -1262,8 +1262,8 @@ int GUI_MR::optionsButton(Button *button) {
_vm->showMessage(0, 0xF0, 0xF0); _vm->showMessage(0, 0xF0, 0xF0);
if (_vm->_handItemSet < -1) { if (_vm->_mouseState < -1) {
_vm->_handItemSet = -1; _vm->_mouseState = -1;
_screen->hideMouse(); _screen->hideMouse();
_screen->setMouseCursor(1, 1, _vm->getShapePtr(0)); _screen->setMouseCursor(1, 1, _vm->getShapePtr(0));
_screen->showMouse(); _screen->showMouse();

View file

@ -83,7 +83,7 @@ void KyraEngine_HoF::updateWaterFlasks() {
bool KyraEngine_HoF::dropItem(int unk1, uint16 item, int x, int y, int unk2) { bool KyraEngine_HoF::dropItem(int unk1, uint16 item, int x, int y, int unk2) {
debugC(9, kDebugLevelMain, "KyraEngine_HoF::dropItem(%d, %u, %d, %d, %d)", unk1, item, x, y, unk2); debugC(9, kDebugLevelMain, "KyraEngine_HoF::dropItem(%d, %u, %d, %d, %d)", unk1, item, x, y, unk2);
if (_handItemSet <= -1) if (_mouseState <= -1)
return false; return false;
bool success = processItemDrop(_mainCharacter.sceneId, item, x, y, unk1, unk2); bool success = processItemDrop(_mainCharacter.sceneId, item, x, y, unk1, unk2);

View file

@ -175,16 +175,16 @@ void KyraEngine_LoK::placeItemInGenericMapScene(int item, int index) {
} }
} }
void KyraEngine_LoK::createMouseItem(int item) { void KyraEngine_LoK::setHandItem(uint16 item) {
debugC(9, kDebugLevelMain, "KyraEngine_LoK::createMouseItem(%d)", item); debugC(9, kDebugLevelMain, "KyraEngine_LoK::setHandItem(%d)", item);
_screen->hideMouse(); _screen->hideMouse();
setMouseItem(item); setMouseItem(item);
_itemInHand = item; _itemInHand = item;
_screen->showMouse(); _screen->showMouse();
} }
void KyraEngine_LoK::destroyMouseItem() { void KyraEngine_LoK::removeHandItem() {
debugC(9, kDebugLevelMain, "KyraEngine_LoK::destroyMouseItem()"); debugC(9, kDebugLevelMain, "KyraEngine_LoK::removeHandItem()");
_screen->hideMouse(); _screen->hideMouse();
_screen->setMouseCursor(1, 1, _shapes[0]); _screen->setMouseCursor(1, 1, _shapes[0]);
_itemInHand = -1; _itemInHand = -1;
@ -222,7 +222,7 @@ void KyraEngine_LoK::wipeDownMouseItem(int xpos, int ypos) {
} }
restoreItemRect1(xpos, ypos); restoreItemRect1(xpos, ypos);
_screen->resetShapeHeight(_shapes[216+_itemInHand]); _screen->resetShapeHeight(_shapes[216+_itemInHand]);
destroyMouseItem(); removeHandItem();
_screen->showMouse(); _screen->showMouse();
} }
@ -420,7 +420,7 @@ int KyraEngine_LoK::processItemDrop(uint16 sceneId, uint8 item, int x, int y, in
itemSpecialFX(x, y, item); itemSpecialFX(x, y, item);
if (unk1 == 0) if (unk1 == 0)
destroyMouseItem(); removeHandItem();
itemDropDown(x, y, destX, destY, freeItem, item); itemDropDown(x, y, destX, destY, freeItem, item);

View file

@ -97,7 +97,7 @@ void KyraEngine_MR::setMouseCursor(uint16 item) {
void KyraEngine_MR::setItemMouseCursor() { void KyraEngine_MR::setItemMouseCursor() {
debugC(9, kDebugLevelMain, "KyraEngine_MR::setItemMouseCursor()"); debugC(9, kDebugLevelMain, "KyraEngine_MR::setItemMouseCursor()");
_handItemSet = _itemInHand; _mouseState = _itemInHand;
if (_itemInHand == -1) if (_itemInHand == -1)
_screen->setMouseCursor(0, 0, _gameShapes[0]); _screen->setMouseCursor(0, 0, _gameShapes[0]);
else else
@ -107,7 +107,7 @@ void KyraEngine_MR::setItemMouseCursor() {
bool KyraEngine_MR::dropItem(int unk1, uint16 item, int x, int y, int unk2) { bool KyraEngine_MR::dropItem(int unk1, uint16 item, int x, int y, int unk2) {
debugC(9, kDebugLevelMain, "KyraEngine_MR::dropItem(%d, %d, %d, %d, %d)", unk1, item, x, y, unk2); debugC(9, kDebugLevelMain, "KyraEngine_MR::dropItem(%d, %d, %d, %d, %d)", unk1, item, x, y, unk2);
if (_handItemSet <= -1) if (_mouseState <= -1)
return false; return false;
if (processItemDrop(_mainCharacter.sceneId, item, x, y, unk1, unk2)) if (processItemDrop(_mainCharacter.sceneId, item, x, y, unk1, unk2))

View file

@ -112,7 +112,7 @@ void KyraEngine_v2::removeHandItem() {
scr->hideMouse(); scr->hideMouse();
scr->setMouseCursor(0, 0, getShapePtr(0)); scr->setMouseCursor(0, 0, getShapePtr(0));
_itemInHand = -1; _itemInHand = -1;
_handItemSet = -1; _mouseState = -1;
scr->showMouse(); scr->showMouse();
} }

View file

@ -81,7 +81,7 @@ KyraEngine_HoF::KyraEngine_HoF(OSystem *system, const GameFlags &flags) : KyraEn
_oldTalkFile = -1; _oldTalkFile = -1;
_currentTalkFile = 0; _currentTalkFile = 0;
_lastSfxTrack = -1; _lastSfxTrack = -1;
_handItemSet = -1; _mouseState = -1;
_unkHandleSceneChangeFlag = false; _unkHandleSceneChangeFlag = false;
_pathfinderFlag = 0; _pathfinderFlag = 0;
_mouseX = _mouseY = 0; _mouseX = _mouseY = 0;
@ -449,7 +449,7 @@ void KyraEngine_HoF::runLoop() {
update(); update();
if (inputFlag == 198 || inputFlag == 199) { if (inputFlag == 198 || inputFlag == 199) {
_unk3 = _handItemSet; _unk3 = _mouseState;
handleInput(_mouseX, _mouseY); handleInput(_mouseX, _mouseY);
} }
@ -568,7 +568,7 @@ bool KyraEngine_HoF::handleInputUnkSub(int x, int y) {
if (y > 143 || _deathHandler > -1 || queryGameFlag(0x164)) if (y > 143 || _deathHandler > -1 || queryGameFlag(0x164))
return false; return false;
if (_handItemSet <= -3 && findItem(_mainCharacter.sceneId, 13) >= 0) { if (_mouseState <= -3 && findItem(_mainCharacter.sceneId, 13) >= 0) {
updateCharFacing(); updateCharFacing();
objectChat(getTableString(0xFC, _cCodeBuffer, 1), 0, 0x83, 0xFC); objectChat(getTableString(0xFC, _cCodeBuffer, 1), 0, 0x83, 0xFC);
return true; return true;
@ -723,16 +723,16 @@ void KyraEngine_HoF::updateMouse() {
yOffset = 9; yOffset = 9;
} }
if (type != 0 && _handItemSet != type && _screen->isMouseVisible()) { if (type != 0 && _mouseState != type && _screen->isMouseVisible()) {
_handItemSet = type; _mouseState = type;
_screen->hideMouse(); _screen->hideMouse();
_screen->setMouseCursor(xOffset, yOffset, getShapePtr(shapeIndex)); _screen->setMouseCursor(xOffset, yOffset, getShapePtr(shapeIndex));
_screen->showMouse(); _screen->showMouse();
} }
if (type == 0 && _handItemSet != _itemInHand && _screen->isMouseVisible()) { if (type == 0 && _mouseState != _itemInHand && _screen->isMouseVisible()) {
if ((mouse.y > 145) || (mouse.x > 6 && mouse.x < 312 && mouse.y > 6 && mouse.y < 135)) { if ((mouse.y > 145) || (mouse.x > 6 && mouse.x < 312 && mouse.y > 6 && mouse.y < 135)) {
_handItemSet = _itemInHand; _mouseState = _itemInHand;
_screen->hideMouse(); _screen->hideMouse();
if (_itemInHand == -1) if (_itemInHand == -1)
_screen->setMouseCursor(0, 0, getShapePtr(0)); _screen->setMouseCursor(0, 0, getShapePtr(0));

View file

@ -247,7 +247,7 @@ int KyraEngine_LoK::init() {
_marbleVaseItem = -1; _marbleVaseItem = -1;
memset(_foyerItemTable, -1, sizeof(_foyerItemTable)); memset(_foyerItemTable, -1, sizeof(_foyerItemTable));
_mouseState = _itemInHand = -1; _itemInHand = -1;
_handleInput = false; _handleInput = false;
_currentRoom = 0xFFFF; _currentRoom = 0xFFFF;
@ -414,7 +414,7 @@ void KyraEngine_LoK::mainLoop() {
snd_playSoundEffect(49); snd_playSoundEffect(49);
_screen->hideMouse(); _screen->hideMouse();
_screen->setMouseCursor(1, 1, _shapes[0]); _screen->setMouseCursor(1, 1, _shapes[0]);
destroyMouseItem(); removeHandItem();
_screen->showMouse(); _screen->showMouse();
_gui->buttonMenuCallback(0); _gui->buttonMenuCallback(0);
_deathHandler = 0xFF; _deathHandler = 0xFF;

View file

@ -282,8 +282,8 @@ protected:
void placeItemInGenericMapScene(int item, int index); void placeItemInGenericMapScene(int item, int index);
// -> mouse item // -> mouse item
void createMouseItem(int item); void setHandItem(uint16 item);
void destroyMouseItem(); void removeHandItem();
void setMouseItem(int item); void setMouseItem(int item);
// -> graphics effects // -> graphics effects
@ -392,7 +392,6 @@ protected:
uint8 *_itemBkgBackUp[2]; uint8 *_itemBkgBackUp[2];
uint8 *_shapes[373]; uint8 *_shapes[373];
int8 _itemInHand; int8 _itemInHand;
int _mouseState;
bool _handleInput; bool _handleInput;
bool _changedScene; bool _changedScene;
int _unkScreenVar1, _unkScreenVar2, _unkScreenVar3; int _unkScreenVar1, _unkScreenVar2, _unkScreenVar3;
@ -658,9 +657,6 @@ protected:
int o1_characterSays(EMCState *script); int o1_characterSays(EMCState *script);
int o1_pauseTicks(EMCState *script); int o1_pauseTicks(EMCState *script);
int o1_drawSceneAnimShape(EMCState *script); int o1_drawSceneAnimShape(EMCState *script);
int o1_queryGameFlag(EMCState *script);
int o1_setGameFlag(EMCState *script);
int o1_resetGameFlag(EMCState *script);
int o1_runNPCScript(EMCState *script); int o1_runNPCScript(EMCState *script);
int o1_setSpecialExitList(EMCState *script); int o1_setSpecialExitList(EMCState *script);
int o1_blockInWalkableRegion(EMCState *script); int o1_blockInWalkableRegion(EMCState *script);
@ -668,13 +664,11 @@ protected:
int o1_walkPlayerToPoint(EMCState *script); int o1_walkPlayerToPoint(EMCState *script);
int o1_dropItemInScene(EMCState *script); int o1_dropItemInScene(EMCState *script);
int o1_drawAnimShapeIntoScene(EMCState *script); int o1_drawAnimShapeIntoScene(EMCState *script);
int o1_createMouseItem(EMCState *script);
int o1_savePageToDisk(EMCState *script); int o1_savePageToDisk(EMCState *script);
int o1_sceneAnimOn(EMCState *script); int o1_sceneAnimOn(EMCState *script);
int o1_sceneAnimOff(EMCState *script); int o1_sceneAnimOff(EMCState *script);
int o1_getElapsedSeconds(EMCState *script); int o1_getElapsedSeconds(EMCState *script);
int o1_mouseIsPointer(EMCState *script); int o1_mouseIsPointer(EMCState *script);
int o1_destroyMouseItem(EMCState *script);
int o1_runSceneAnimUntilDone(EMCState *script); int o1_runSceneAnimUntilDone(EMCState *script);
int o1_fadeSpecialPalette(EMCState *script); int o1_fadeSpecialPalette(EMCState *script);
int o1_playAdlibSound(EMCState *script); int o1_playAdlibSound(EMCState *script);
@ -708,14 +702,11 @@ protected:
int o1_loadPageFromDisk(EMCState *script); int o1_loadPageFromDisk(EMCState *script);
int o1_customPrintTalkString(EMCState *script); int o1_customPrintTalkString(EMCState *script);
int o1_restoreCustomPrintBackground(EMCState *script); int o1_restoreCustomPrintBackground(EMCState *script);
int o1_hideMouse(EMCState *script);
int o1_showMouse(EMCState *script);
int o1_getCharacterX(EMCState *script); int o1_getCharacterX(EMCState *script);
int o1_getCharacterY(EMCState *script); int o1_getCharacterY(EMCState *script);
int o1_changeCharactersFacing(EMCState *script); int o1_changeCharactersFacing(EMCState *script);
int o1_copyWSARegion(EMCState *script); int o1_copyWSARegion(EMCState *script);
int o1_printText(EMCState *script); int o1_printText(EMCState *script);
int o1_random(EMCState *script);
int o1_loadSoundFile(EMCState *script); int o1_loadSoundFile(EMCState *script);
int o1_displayWSAFrameOnHidPage(EMCState *script); int o1_displayWSAFrameOnHidPage(EMCState *script);
int o1_displayWSASequentialFrames(EMCState *script); int o1_displayWSASequentialFrames(EMCState *script);
@ -775,8 +766,6 @@ protected:
int o1_setIdolGem(EMCState *script); int o1_setIdolGem(EMCState *script);
int o1_totalItemsInScene(EMCState *script); int o1_totalItemsInScene(EMCState *script);
int o1_restoreBrandonsMovementDelay(EMCState *script); int o1_restoreBrandonsMovementDelay(EMCState *script);
int o1_setMousePos(EMCState *script);
int o1_getMouseState(EMCState *script);
int o1_setEntranceMouseCursorTrack(EMCState *script); int o1_setEntranceMouseCursorTrack(EMCState *script);
int o1_itemAppearsOnGround(EMCState *script); int o1_itemAppearsOnGround(EMCState *script);
int o1_setNoDrawShapesFlag(EMCState *script); int o1_setNoDrawShapesFlag(EMCState *script);

View file

@ -99,7 +99,7 @@ KyraEngine_MR::KyraEngine_MR(OSystem *system, const GameFlags &flags) : KyraEngi
_unk5 = 0; _unk5 = 0;
_unkSceneScreenFlag1 = false; _unkSceneScreenFlag1 = false;
_noScriptEnter = true; _noScriptEnter = true;
_itemInHand = _handItemSet = -1; _itemInHand = _mouseState = -1;
_unk3 = -1; _unk3 = -1;
_unk4 = 0; _unk4 = 0;
_loadingState = false; _loadingState = false;
@ -999,7 +999,7 @@ void KyraEngine_MR::runLoop() {
_timer->update(); _timer->update();
if (inputFlag == 198 || inputFlag == 199) { if (inputFlag == 198 || inputFlag == 199) {
_unk3 = _handItemSet; _unk3 = _mouseState;
Common::Point mouse = getMousePos(); Common::Point mouse = getMousePos();
handleInput(mouse.x, mouse.y); handleInput(mouse.x, mouse.y);
} }
@ -1181,13 +1181,13 @@ void KyraEngine_MR::updateMouse() {
if (mouse.y > 187) { if (mouse.y > 187) {
bool setItemCursor = false; bool setItemCursor = false;
if (_handItemSet == -6) { if (_mouseState == -6) {
if (mouse.x < 311) if (mouse.x < 311)
setItemCursor = true; setItemCursor = true;
} else if (_handItemSet == -5) { } else if (_mouseState == -5) {
if (mouse.x < _sceneMinX || mouse.x > _sceneMaxX) if (mouse.x < _sceneMinX || mouse.x > _sceneMaxX)
setItemCursor = true; setItemCursor = true;
} else if (_handItemSet == -4) { } else if (_mouseState == -4) {
if (mouse.x > 8) if (mouse.x > 8)
setItemCursor = true; setItemCursor = true;
} }
@ -1204,8 +1204,8 @@ void KyraEngine_MR::updateMouse() {
hideInventory(); hideInventory();
} }
if (hasItemCollision && _handItemSet < -1 && _itemInHand < 0) { if (hasItemCollision && _mouseState < -1 && _itemInHand < 0) {
_handItemSet = -1; _mouseState = -1;
_itemInHand = -1; _itemInHand = -1;
_screen->setMouseCursor(0, 0, _gameShapes[0]); _screen->setMouseCursor(0, 0, _gameShapes[0]);
} }
@ -1282,12 +1282,12 @@ void KyraEngine_MR::updateMouse() {
} }
} }
if (type != 0 && type != _handItemSet && !hasItemCollision) { if (type != 0 && type != _mouseState && !hasItemCollision) {
_handItemSet = type; _mouseState = type;
_screen->setMouseCursor(offsetX, offsetY, _gameShapes[shape]); _screen->setMouseCursor(offsetX, offsetY, _gameShapes[shape]);
} else if (type == 0 && _handItemSet != _itemInHand && mouse.x > 8 && mouse.x < 311 && mouse.y < 171 && mouse.y > 8) { } else if (type == 0 && _mouseState != _itemInHand && mouse.x > 8 && mouse.x < 311 && mouse.y < 171 && mouse.y > 8) {
setItemMouseCursor(); setItemMouseCursor();
} else if (mouse.y > 187 && _handItemSet > -4 && type == 0 && !_inventoryState) { } else if (mouse.y > 187 && _mouseState > -4 && type == 0 && !_inventoryState) {
showInventory(); showInventory();
} }
} }

View file

@ -62,6 +62,8 @@ KyraEngine_v1::KyraEngine_v1(OSystem *system, const GameFlags &flags)
_gameToLoad = -1; _gameToLoad = -1;
_mouseState = -1;
memset(_flagsTable, 0, sizeof(_flagsTable)); memset(_flagsTable, 0, sizeof(_flagsTable));
// sets up all engine specific debug levels // sets up all engine specific debug levels

View file

@ -212,6 +212,23 @@ protected:
virtual void setupOpcodeTable() = 0; virtual void setupOpcodeTable() = 0;
Common::Array<const Opcode*> _opcodes; Common::Array<const Opcode*> _opcodes;
int o1_queryGameFlag(EMCState *script);
int o1_setGameFlag(EMCState *script);
int o1_resetGameFlag(EMCState *script);
int o1_getRand(EMCState *script);
int o1_hideMouse(EMCState *script);
int o1_showMouse(EMCState *script);
int o1_setMousePos(EMCState *script);
int o1_setHandItem(EMCState *script);
int o1_removeHandItem(EMCState *script);
int o1_getMouseState(EMCState *script);
// items
int _mouseState;
virtual void setHandItem(uint16 item) = 0;
virtual void removeHandItem() = 0;
// game flags // game flags
uint8 _flagsTable[100]; // TODO: check this value uint8 _flagsTable[100]; // TODO: check this value

View file

@ -318,7 +318,6 @@ protected:
int _itemListSize; int _itemListSize;
int _itemInHand; int _itemInHand;
int _handItemSet;
int findFreeItem(); int findFreeItem();
int countAllItems(); int countAllItems();
@ -393,21 +392,11 @@ protected:
int o2_moveCharacter(EMCState *script); int o2_moveCharacter(EMCState *script);
int o2_checkForItem(EMCState *script); int o2_checkForItem(EMCState *script);
int o2_defineItem(EMCState *script); int o2_defineItem(EMCState *script);
int o2_queryGameFlag(EMCState *script);
int o2_resetGameFlag(EMCState *script);
int o2_setGameFlag(EMCState *script);
int o2_setHandItem(EMCState *script);
int o2_removeHandItem(EMCState *script);
int o2_handItemSet(EMCState *script);
int o2_hideMouse(EMCState *script);
int o2_addSpecialExit(EMCState *script); int o2_addSpecialExit(EMCState *script);
int o2_setMousePos(EMCState *script);
int o2_showMouse(EMCState *script);
int o2_delay(EMCState *script); int o2_delay(EMCState *script);
int o2_update(EMCState *script); int o2_update(EMCState *script);
int o2_getShapeFlag1(EMCState *script); int o2_getShapeFlag1(EMCState *script);
int o2_playWanderScoreViaMap(EMCState *script); int o2_playWanderScoreViaMap(EMCState *script);
int o2_getRand(EMCState *script);
int o2_setDeathHandler(EMCState *script); int o2_setDeathHandler(EMCState *script);
int o2_waitForConfirmationClick(EMCState *script); int o2_waitForConfirmationClick(EMCState *script);
int o2_randomSceneChat(EMCState *script); int o2_randomSceneChat(EMCState *script);

View file

@ -183,7 +183,7 @@ void KyraEngine_LoK::loadGame(const char *fileName) {
_screen->copyRegion(0, 0, 0, 0, 320, 200, 8, 0); _screen->copyRegion(0, 0, 0, 0, 320, 200, 8, 0);
} }
createMouseItem(_itemInHand); setHandItem(_itemInHand);
_animator->setBrandonAnimSeqSize(3, 48); _animator->setBrandonAnimSeqSize(3, 48);
redrawInventory(0); redrawInventory(0);
_animator->_noDrawShapesFlag = 1; _animator->_noDrawShapesFlag = 1;

View file

@ -182,7 +182,7 @@ void KyraEngine_MR::enterNewScene(uint16 sceneId, int facing, int unk1, int unk2
if (_itemInHand < 0) { if (_itemInHand < 0) {
_itemInHand = -1; _itemInHand = -1;
_handItemSet = -1; _mouseState = -1;
_screen->setMouseCursor(0, 0, _gameShapes[0]); _screen->setMouseCursor(0, 0, _gameShapes[0]);
} }

View file

@ -1560,19 +1560,19 @@ void KyraEngine_HoF::setupOpcodeTable() {
Opcode(o2_removeItemFromInventory); Opcode(o2_removeItemFromInventory);
Opcode(o2_countItemInInventory); Opcode(o2_countItemInInventory);
Opcode(o2_countItemsInScene); Opcode(o2_countItemsInScene);
Opcode(o2_queryGameFlag); Opcode(o1_queryGameFlag);
// 0x28 // 0x28
Opcode(o2_resetGameFlag); Opcode(o1_resetGameFlag);
Opcode(o2_setGameFlag); Opcode(o1_setGameFlag);
Opcode(o2_setHandItem); Opcode(o1_setHandItem);
Opcode(o2_removeHandItem); Opcode(o1_removeHandItem);
// 0x2c // 0x2c
Opcode(o2_handItemSet); Opcode(o1_getMouseState);
Opcode(o2_hideMouse); Opcode(o1_hideMouse);
Opcode(o2_addSpecialExit); Opcode(o2_addSpecialExit);
Opcode(o2_setMousePos); Opcode(o1_setMousePos);
// 0x30 // 0x30
Opcode(o2_showMouse); Opcode(o1_showMouse);
OpcodeUnImpl(); OpcodeUnImpl();
Opcode(o2_wipeDownMouseItem); Opcode(o2_wipeDownMouseItem);
Opcode(o2_getElapsedSecs); Opcode(o2_getElapsedSecs);
@ -1632,7 +1632,7 @@ void KyraEngine_HoF::setupOpcodeTable() {
Opcode(o2_setCauldronState); Opcode(o2_setCauldronState);
Opcode(o2_showItemString); Opcode(o2_showItemString);
// 0x60 // 0x60
Opcode(o2_getRand); Opcode(o1_getRand);
Opcode(o2_isAnySoundPlaying); Opcode(o2_isAnySoundPlaying);
Opcode(o2_setDeathHandler); Opcode(o2_setDeathHandler);
Opcode(o2_setDrawNoShapeFlag); Opcode(o2_setDrawNoShapeFlag);

View file

@ -92,21 +92,6 @@ int KyraEngine_LoK::o1_drawSceneAnimShape(EMCState *script) {
return 0; return 0;
} }
int KyraEngine_LoK::o1_queryGameFlag(EMCState *script) {
debugC(3, kDebugLevelScriptFuncs, "KyraEngine_LoK::o1_queryGameFlag(%p) (0x%X)", (const void *)script, stackPos(0));
return queryGameFlag(stackPos(0));
}
int KyraEngine_LoK::o1_setGameFlag(EMCState *script) {
debugC(3, kDebugLevelScriptFuncs, "KyraEngine_LoK::o1_setGameFlag(%p) (0x%X)", (const void *)script, stackPos(0));
return setGameFlag(stackPos(0));
}
int KyraEngine_LoK::o1_resetGameFlag(EMCState *script) {
debugC(3, kDebugLevelScriptFuncs, "KyraEngine_LoK::o1_resetGameFlag(%p) (0x%X)", (const void *)script, stackPos(0));
return resetGameFlag(stackPos(0));
}
int KyraEngine_LoK::o1_runNPCScript(EMCState *script) { int KyraEngine_LoK::o1_runNPCScript(EMCState *script) {
warning("STUB: o1_runNPCScript"); warning("STUB: o1_runNPCScript");
return 0; return 0;
@ -205,12 +190,6 @@ int KyraEngine_LoK::o1_drawAnimShapeIntoScene(EMCState *script) {
return 0; return 0;
} }
int KyraEngine_LoK::o1_createMouseItem(EMCState *script) {
debugC(3, kDebugLevelScriptFuncs, "KyraEngine_LoK::o1_createMouseItem(%p) (%d)", (const void *)script, stackPos(0));
createMouseItem(stackPos(0));
return 0;
}
int KyraEngine_LoK::o1_savePageToDisk(EMCState *script) { int KyraEngine_LoK::o1_savePageToDisk(EMCState *script) {
debugC(3, kDebugLevelScriptFuncs, "KyraEngine_LoK::o1_savePageToDisk(%p) ('%s', %d)", (const void *)script, stackPosString(0), stackPos(1)); debugC(3, kDebugLevelScriptFuncs, "KyraEngine_LoK::o1_savePageToDisk(%p) ('%s', %d)", (const void *)script, stackPosString(0), stackPos(1));
_screen->savePageToDisk(stackPosString(0), stackPos(1)); _screen->savePageToDisk(stackPosString(0), stackPos(1));
@ -241,12 +220,6 @@ int KyraEngine_LoK::o1_mouseIsPointer(EMCState *script) {
return 0; return 0;
} }
int KyraEngine_LoK::o1_destroyMouseItem(EMCState *script) {
debugC(3, kDebugLevelScriptFuncs, "KyraEngine_LoK::o1_destroyMouseItem(%p) ()", (const void *)script);
destroyMouseItem();
return 0;
}
int KyraEngine_LoK::o1_runSceneAnimUntilDone(EMCState *script) { int KyraEngine_LoK::o1_runSceneAnimUntilDone(EMCState *script) {
debugC(3, kDebugLevelScriptFuncs, "KyraEngine_LoK::o1_runSceneAnimUntilDone(%p) (%d)", (const void *)script, stackPos(0)); debugC(3, kDebugLevelScriptFuncs, "KyraEngine_LoK::o1_runSceneAnimUntilDone(%p) (%d)", (const void *)script, stackPos(0));
_screen->hideMouse(); _screen->hideMouse();
@ -665,18 +638,6 @@ int KyraEngine_LoK::o1_restoreCustomPrintBackground(EMCState *script) {
return 0; return 0;
} }
int KyraEngine_LoK::o1_hideMouse(EMCState *script) {
debugC(3, kDebugLevelScriptFuncs, "KyraEngine_LoK::o1_hideMouse(%p) ()", (const void *)script);
_screen->hideMouse();
return 0;
}
int KyraEngine_LoK::o1_showMouse(EMCState *script) {
debugC(3, kDebugLevelScriptFuncs, "KyraEngine_LoK::o1_showMouse(%p) ()", (const void *)script);
_screen->showMouse();
return 0;
}
int KyraEngine_LoK::o1_getCharacterX(EMCState *script) { int KyraEngine_LoK::o1_getCharacterX(EMCState *script) {
debugC(3, kDebugLevelScriptFuncs, "KyraEngine_LoK::o1_getCharacterX(%p) (%d)", (const void *)script, stackPos(0)); debugC(3, kDebugLevelScriptFuncs, "KyraEngine_LoK::o1_getCharacterX(%p) (%d)", (const void *)script, stackPos(0));
return _characterList[stackPos(0)].x1; return _characterList[stackPos(0)].x1;
@ -728,12 +689,6 @@ int KyraEngine_LoK::o1_printText(EMCState *script) {
return 0; return 0;
} }
int KyraEngine_LoK::o1_random(EMCState *script) {
debugC(3, kDebugLevelScriptFuncs, "KyraEngine_LoK::o1_random(%p) (%d, %d)", (const void *)script, stackPos(0), stackPos(1));
assert(stackPos(0) < stackPos(1));
return _rnd.getRandomNumberRng(stackPos(0), stackPos(1));
}
int KyraEngine_LoK::o1_loadSoundFile(EMCState *script) { int KyraEngine_LoK::o1_loadSoundFile(EMCState *script) {
warning("STUB: o1_loadSoundFile"); warning("STUB: o1_loadSoundFile");
return 0; return 0;
@ -922,7 +877,7 @@ int KyraEngine_LoK::o1_wipeDownMouseItem(EMCState *script) {
debugC(3, kDebugLevelScriptFuncs, "KyraEngine_LoK::o1_wipeDownMouseItem(%p) (%d, %d, %d)", (const void *)script, stackPos(0), stackPos(1), stackPos(2)); debugC(3, kDebugLevelScriptFuncs, "KyraEngine_LoK::o1_wipeDownMouseItem(%p) (%d, %d, %d)", (const void *)script, stackPos(0), stackPos(1), stackPos(2));
_screen->hideMouse(); _screen->hideMouse();
wipeDownMouseItem(stackPos(1), stackPos(2)); wipeDownMouseItem(stackPos(1), stackPos(2));
destroyMouseItem(); removeHandItem();
_screen->showMouse(); _screen->showMouse();
return 0; return 0;
} }
@ -1512,17 +1467,6 @@ int KyraEngine_LoK::o1_restoreBrandonsMovementDelay(EMCState *script) {
return 0; return 0;
} }
int KyraEngine_LoK::o1_setMousePos(EMCState *script) {
debugC(3, kDebugLevelScriptFuncs, "KyraEngine_LoK::o1_setMousePos(%p) (%d, %d)", (const void *)script, stackPos(0), stackPos(1));
_system->warpMouse(stackPos(0), stackPos(1));
return 0;
}
int KyraEngine_LoK::o1_getMouseState(EMCState *script) {
debugC(3, kDebugLevelScriptFuncs, "KyraEngine_LoK::o1_getMouseState(%p) ()", (const void *)script);
return _mouseState;
}
int KyraEngine_LoK::o1_setEntranceMouseCursorTrack(EMCState *script) { int KyraEngine_LoK::o1_setEntranceMouseCursorTrack(EMCState *script) {
debugC(3, kDebugLevelScriptFuncs, "KyraEngine_LoK::o1_setEntranceMouseCursorTrack(%p) (%d, %d, %d, %d, %d)", (const void *)script, stackPos(0), stackPos(1), stackPos(2), stackPos(3), stackPos(4)); debugC(3, kDebugLevelScriptFuncs, "KyraEngine_LoK::o1_setEntranceMouseCursorTrack(%p) (%d, %d, %d, %d, %d)", (const void *)script, stackPos(0), stackPos(1), stackPos(2), stackPos(3), stackPos(4));
_entranceMouseCursorTracks[0] = stackPos(0); _entranceMouseCursorTracks[0] = stackPos(0);
@ -1845,7 +1789,7 @@ void KyraEngine_LoK::setupOpcodeTable() {
// 0x0c // 0x0c
Opcode(o1_dropItemInScene); Opcode(o1_dropItemInScene);
Opcode(o1_drawAnimShapeIntoScene); Opcode(o1_drawAnimShapeIntoScene);
Opcode(o1_createMouseItem); Opcode(o1_setHandItem);
Opcode(o1_savePageToDisk); Opcode(o1_savePageToDisk);
// 0x10 // 0x10
Opcode(o1_sceneAnimOn); Opcode(o1_sceneAnimOn);
@ -1853,7 +1797,7 @@ void KyraEngine_LoK::setupOpcodeTable() {
Opcode(o1_getElapsedSeconds); Opcode(o1_getElapsedSeconds);
Opcode(o1_mouseIsPointer); Opcode(o1_mouseIsPointer);
// 0x14 // 0x14
Opcode(o1_destroyMouseItem); Opcode(o1_removeHandItem);
Opcode(o1_runSceneAnimUntilDone); Opcode(o1_runSceneAnimUntilDone);
Opcode(o1_fadeSpecialPalette); Opcode(o1_fadeSpecialPalette);
Opcode(o1_playAdlibSound); Opcode(o1_playAdlibSound);
@ -1904,7 +1848,7 @@ void KyraEngine_LoK::setupOpcodeTable() {
Opcode(o1_copyWSARegion); Opcode(o1_copyWSARegion);
// 0x3c // 0x3c
Opcode(o1_printText); Opcode(o1_printText);
Opcode(o1_random); Opcode(o1_getRand);
Opcode(o1_loadSoundFile); Opcode(o1_loadSoundFile);
Opcode(o1_displayWSAFrameOnHidPage); Opcode(o1_displayWSAFrameOnHidPage);
// 0x40 // 0x40

View file

@ -1199,19 +1199,19 @@ void KyraEngine_MR::setupOpcodeTable() {
Opcode(o3_removeInventoryItemInstances); Opcode(o3_removeInventoryItemInstances);
Opcode(o3_countInventoryItemInstances); Opcode(o3_countInventoryItemInstances);
Opcode(o3_npcChatSequence); Opcode(o3_npcChatSequence);
Opcode(o2_queryGameFlag); Opcode(o1_queryGameFlag);
// 0x28 // 0x28
Opcode(o2_resetGameFlag); Opcode(o1_resetGameFlag);
Opcode(o2_setGameFlag); Opcode(o1_setGameFlag);
Opcode(o2_setHandItem); Opcode(o1_setHandItem);
Opcode(o2_removeHandItem); Opcode(o1_removeHandItem);
// 0x2c // 0x2c
Opcode(o2_handItemSet); Opcode(o1_getMouseState);
Opcode(o2_hideMouse); Opcode(o1_hideMouse);
Opcode(o2_addSpecialExit); Opcode(o2_addSpecialExit);
Opcode(o2_setMousePos); Opcode(o1_setMousePos);
// 0x30 // 0x30
Opcode(o2_showMouse); Opcode(o1_showMouse);
Opcode(o3_badConscienceChat); Opcode(o3_badConscienceChat);
Opcode(o3_wipeDownMouseItem); Opcode(o3_wipeDownMouseItem);
Opcode(o3_dummy); Opcode(o3_dummy);
@ -1271,7 +1271,7 @@ void KyraEngine_MR::setupOpcodeTable() {
Opcode(o3_showSceneStringsMessage); Opcode(o3_showSceneStringsMessage);
OpcodeUnImpl(); OpcodeUnImpl();
// 0x60 // 0x60
Opcode(o2_getRand); Opcode(o1_getRand);
Opcode(o3_dummy); Opcode(o3_dummy);
Opcode(o2_setDeathHandler); Opcode(o2_setDeathHandler);
Opcode(o3_showGoodConscience); Opcode(o3_showGoodConscience);
@ -1379,7 +1379,7 @@ void KyraEngine_MR::setupOpcodeTable() {
Opcode(o3_dummy); Opcode(o3_dummy);
// 0x0a // 0x0a
Opcode(o2a_setResetFrame); Opcode(o2a_setResetFrame);
Opcode(o2_getRand); Opcode(o1_getRand);
Opcode(o3_getMalcolmShapes); Opcode(o3_getMalcolmShapes);
Opcode(o3_dummy); Opcode(o3_dummy);
@ -1387,8 +1387,8 @@ void KyraEngine_MR::setupOpcodeTable() {
// 0x00 // 0x00
Opcode(o3d_updateAnim); Opcode(o3d_updateAnim);
Opcode(o3d_delay); Opcode(o3d_delay);
Opcode(o2_getRand); Opcode(o1_getRand);
Opcode(o2_queryGameFlag); Opcode(o1_queryGameFlag);
// 0x04 // 0x04
Opcode(o3_dummy); Opcode(o3_dummy);
} }

View file

@ -0,0 +1,87 @@
/* 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.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
* $URL$
* $Id$
*
*/
#include "kyra/kyra_v1.h"
namespace Kyra {
int KyraEngine_v1::o1_queryGameFlag(EMCState *script) {
debugC(3, kDebugLevelScriptFuncs, "KyraEngine_v1::o1_queryGameFlag(%p) (0x%X)", (const void *)script, stackPos(0));
return queryGameFlag(stackPos(0));
}
int KyraEngine_v1::o1_setGameFlag(EMCState *script) {
debugC(3, kDebugLevelScriptFuncs, "KyraEngine_v1::o1_setGameFlag(%p) (0x%X)", (const void *)script, stackPos(0));
return setGameFlag(stackPos(0));
}
int KyraEngine_v1::o1_resetGameFlag(EMCState *script) {
debugC(3, kDebugLevelScriptFuncs, "KyraEngine_v1::o1_resetGameFlag(%p) (0x%X)", (const void *)script, stackPos(0));
return resetGameFlag(stackPos(0));
}
int KyraEngine_v1::o1_getRand(EMCState *script) {
debugC(3, kDebugLevelScriptFuncs, "KyraEngine_v1::o1_getRand(%p) (%d, %d)", (const void *)script, stackPos(0), stackPos(1));
assert(stackPos(0) < stackPos(1));
return _rnd.getRandomNumberRng(stackPos(0), stackPos(1));
}
int KyraEngine_v1::o1_hideMouse(EMCState *script) {
debugC(3, kDebugLevelScriptFuncs, "KyraEngine_v1::o1_hideMouse(%p) ()", (const void *)script);
_screen->hideMouse();
return 0;
}
int KyraEngine_v1::o1_showMouse(EMCState *script) {
debugC(3, kDebugLevelScriptFuncs, "KyraEngine_v1::o1_showMouse(%p) ()", (const void *)script);
_screen->showMouse();
return 0;
}
int KyraEngine_v1::o1_setMousePos(EMCState *script) {
debugC(3, kDebugLevelScriptFuncs, "KyraEngine_v1::o1_setMousePos(%p) (%d, %d)", (const void *)script, stackPos(0), stackPos(1));
_system->warpMouse(stackPos(0), stackPos(1));
return 0;
}
int KyraEngine_v1::o1_setHandItem(EMCState *script) {
debugC(3, kDebugLevelScriptFuncs, "KyraEngine_v1::o1_setHandItem(%p) (%d)", (const void *)script, stackPos(0));
setHandItem(stackPos(0));
return 0;
}
int KyraEngine_v1::o1_removeHandItem(EMCState *script) {
debugC(3, kDebugLevelScriptFuncs, "KyraEngine_v1::o1_removeHandItem(%p) ()", (const void *)script);
removeHandItem();
return 0;
}
int KyraEngine_v1::o1_getMouseState(EMCState *script) {
debugC(3, kDebugLevelScriptFuncs, "KyraEngine_v1::o1_getMouseState(%p) ()", (const void *)script);
return _mouseState;
}
} // end of namespace Kyra

View file

@ -103,44 +103,6 @@ int KyraEngine_v2::o2_defineItem(EMCState *script) {
return freeItem; return freeItem;
} }
int KyraEngine_v2::o2_queryGameFlag(EMCState *script) {
debugC(3, kDebugLevelScriptFuncs, "KyraEngine_v2::o2_queryGameFlag(%p) (%d)", (const void *)script, stackPos(0));
return queryGameFlag(stackPos(0));
}
int KyraEngine_v2::o2_resetGameFlag(EMCState *script) {
debugC(3, kDebugLevelScriptFuncs, "KyraEngine_v2::o2_resetGameFlag(%p) (%d)", (const void *)script, stackPos(0));
return resetGameFlag(stackPos(0));
}
int KyraEngine_v2::o2_setGameFlag(EMCState *script) {
debugC(3, kDebugLevelScriptFuncs, "KyraEngine_v2::o2_setGameFlag(%p) (%d)", (const void *)script, stackPos(0));
return setGameFlag(stackPos(0));
}
int KyraEngine_v2::o2_setHandItem(EMCState *script) {
debugC(3, kDebugLevelScriptFuncs, "KyraEngine_v2::o2_setHandItem(%p) (%d)", (const void *)script, stackPos(0));
setHandItem(stackPos(0));
return 0;
}
int KyraEngine_v2::o2_removeHandItem(EMCState *script) {
debugC(3, kDebugLevelScriptFuncs, "KyraEngine_v2::o2_removeHandItem(%p) ()", (const void *)script);
removeHandItem();
return 0;
}
int KyraEngine_v2::o2_handItemSet(EMCState *script) {
debugC(3, kDebugLevelScriptFuncs, "KyraEngine_v2::o2_handItemSet(%p) ()", (const void *)script);
return _handItemSet;
}
int KyraEngine_v2::o2_hideMouse(EMCState *script) {
debugC(3, kDebugLevelScriptFuncs, "KyraEngine_v2::o2_hideMouse(%p) ()", (const void *)script);
screen()->hideMouse();
return 0;
}
int KyraEngine_v2::o2_addSpecialExit(EMCState *script) { int KyraEngine_v2::o2_addSpecialExit(EMCState *script) {
debugC(3, kDebugLevelScriptFuncs, "KyraEngine_v2::o2_addSpecialExit(%p) (%d, %d, %d, %d, %d)", (const void *)script, debugC(3, kDebugLevelScriptFuncs, "KyraEngine_v2::o2_addSpecialExit(%p) (%d, %d, %d, %d, %d)", (const void *)script,
stackPos(0), stackPos(1), stackPos(2), stackPos(3), stackPos(4)); stackPos(0), stackPos(1), stackPos(2), stackPos(3), stackPos(4));
@ -155,18 +117,6 @@ int KyraEngine_v2::o2_addSpecialExit(EMCState *script) {
return 0; return 0;
} }
int KyraEngine_v2::o2_setMousePos(EMCState *script) {
debugC(3, kDebugLevelScriptFuncs, "KyraEngine_v2::o2_setMousePos(%p) (%d, %d)", (const void *)script, stackPos(0), stackPos(1));
setMousePos(stackPos(0), stackPos(1));
return 0;
}
int KyraEngine_v2::o2_showMouse(EMCState *script) {
debugC(3, kDebugLevelScriptFuncs, "KyraEngine_v2::o2_showMouse(%p) ()", (const void *)script);
screen()->showMouse();
return 0;
}
int KyraEngine_v2::o2_delay(EMCState *script) { int KyraEngine_v2::o2_delay(EMCState *script) {
debugC(3, kDebugLevelScriptFuncs, "KyraEngine_v2::o2_delay(%p) (%d, %d)", (const void *)script, stackPos(0), stackPos(1)); debugC(3, kDebugLevelScriptFuncs, "KyraEngine_v2::o2_delay(%p) (%d, %d)", (const void *)script, stackPos(0), stackPos(1));
if (stackPos(1)) { if (stackPos(1)) {
@ -212,12 +162,6 @@ int KyraEngine_v2::o2_playWanderScoreViaMap(EMCState *script) {
return 0; return 0;
} }
int KyraEngine_v2::o2_getRand(EMCState *script) {
debugC(3, kDebugLevelScriptFuncs, "KyraEngine_v2::o2_getRand(%p) (%d, %d)", (const void *)script, stackPos(0), stackPos(1));
assert(stackPos(0) < stackPos(1));
return _rnd.getRandomNumberRng(stackPos(0), stackPos(1));
}
int KyraEngine_v2::o2_setDeathHandler(EMCState *script) { int KyraEngine_v2::o2_setDeathHandler(EMCState *script) {
debugC(3, kDebugLevelScriptFuncs, "KyraEngine_v2::o2_setDeathHandler(%p) (%d)", (const void *)script, stackPos(0)); debugC(3, kDebugLevelScriptFuncs, "KyraEngine_v2::o2_setDeathHandler(%p) (%d)", (const void *)script, stackPos(0));
_deathHandler = stackPos(0); _deathHandler = stackPos(0);