- add opcode 146 - resetInputColorCode()

- add updateWaterFlasks()
- some fixes for mouse pointer positioning in sjis mode
- bug fix for tim player

svn-id: r31136
This commit is contained in:
Florian Kagerer 2008-03-16 02:00:14 +00:00
parent 7074132276
commit b75c790c7a
8 changed files with 47 additions and 8 deletions

View File

@ -92,6 +92,28 @@ void KyraEngine_v2::resetItemList() {
}
}
void KyraEngine_v2::updateWaterFlasks() {
for (int i = 22; i < 24; i++) {
if (_itemInHand == i)
setHandItem(i - 1);
for (int ii = 0; ii < 20; ii++) {
if (_mainCharacter.inventory[ii] == i) {
_mainCharacter.inventory[ii]--;
if (ii < 10) {
clearInventorySlot(ii, 0);
_screen->drawShape(0, getShapePtr(i + 63), _inventoryX[ii], _inventoryY[ii], 0, 0);
}
}
}
for (int ii = 0; ii < 30; ii++) {
if (_itemList[ii].id == i)
_itemList[ii].id--;
}
}
}
bool KyraEngine_v2::dropItem(int unk1, uint16 item, int x, int y, int unk2) {
if (_handItemSet <= -1)
return false;

View File

@ -202,6 +202,14 @@ Common::Point KyraEngine::getMousePos() const {
return mouse;
}
void KyraEngine::setMousePos(int x, int y) {
if (_flags.useHiResOverlay) {
x <<= 1;
y <<= 1;
}
_system->warpMouse(x, y);
}
int KyraEngine::setGameFlag(int flag) {
_flagsTable[flag >> 3] |= (1 << (flag & 7));
return 1;

View File

@ -193,6 +193,7 @@ protected:
// input
Common::Point getMousePos() const;
void setMousePos(int x, int y);
// pathfinder
virtual int findWay(int x, int y, int toX, int toY, int *moveTable, int moveTableSize);

View File

@ -1867,7 +1867,7 @@ void KyraEngine_v2::cauldronItemAnim(int item) {
else if (mouseY > mouseDstY)
mouseY -= 2;
uint32 waitEnd = _system->getMillis() + _tickLength;
_system->warpMouse(mouseX, mouseY);
setMousePos(mouseX, mouseY);
_system->updateScreen();
delayUntil(waitEnd);
}
@ -1878,7 +1878,7 @@ void KyraEngine_v2::cauldronItemAnim(int item) {
else if (mouseX > mouseDstX)
mouseX -= 2;
uint32 waitEnd = _system->getMillis() + _tickLength;
_system->warpMouse(mouseX, mouseY);
setMousePos(mouseX, mouseY);
_system->updateScreen();
delayUntil(waitEnd);
}
@ -2264,7 +2264,7 @@ void KyraEngine_v2::setupOpcodeTable() {
// 0x90
Opcode(o2_clearSpecialSceneScriptState),
Opcode(o2_querySpecialSceneScriptState),
OpcodeUnImpl(),
Opcode(o2_resetInputColorCode),
Opcode(o2_setHiddenItemsEntry),
// 0x94
Opcode(o2_getHiddenItemsEntry),

View File

@ -542,6 +542,7 @@ protected:
int findItem(uint16 sceneId, uint16 id);
int checkItemCollision(int x, int y);
void resetItemList();
void updateWaterFlasks();
int _itemInHand;
int _handItemSet;
@ -1024,6 +1025,7 @@ protected:
int o2_setSpecialSceneScriptState(ScriptState *script);
int o2_clearSpecialSceneScriptState(ScriptState *script);
int o2_querySpecialSceneScriptState(ScriptState *script);
int o2_resetInputColorCode(ScriptState *script);
int o2_setHiddenItemsEntry(ScriptState *script);
int o2_getHiddenItemsEntry(ScriptState *script);
int o2_mushroomEffect(ScriptState *script);

View File

@ -47,7 +47,7 @@ void KyraEngine_v2::enterNewScene(uint16 newScene, int facing, int unk1, int unk
_screen->hideMouse();
if (!unk3) {
//updateSpecialItems();
updateWaterFlasks();
//displayInvWsaLastFrame();
}

View File

@ -410,7 +410,7 @@ int KyraEngine_v2::o2_addSpecialExit(ScriptState *script) {
int KyraEngine_v2::o2_setMousePos(ScriptState *script) {
debugC(3, kDebugLevelScriptFuncs, "o2_setMousePos(%p) (%d, %d)", (const void *)script, stackPos(0), stackPos(1));
_system->warpMouse(stackPos(0), stackPos(1));
setMousePos(stackPos(0), stackPos(1));
return 0;
}
@ -661,7 +661,7 @@ int KyraEngine_v2::o2_showLetter(ScriptState *script) {
_screen->copyRegion(0, 0, 0, 0, 320, 200, 2, 0);
_screen->fadePalette(_screen->getPalette(0), 0x14);
_screen->setMouseCursor(0, 0, getShapePtr(0));
_system->warpMouse(280, 160);
setMousePos(280, 160);
_screen->showMouse();
@ -786,7 +786,7 @@ int KyraEngine_v2::o2_updateSceneAnim(ScriptState *script) {
}
int KyraEngine_v2::o2_setSceneAnimPosAndUpdate(ScriptState *script) {
debugC(3, kDebugLevelScriptFuncs, "o2_updateSceneAnim(%p) (%d, %d, %d, %d)", (const void *)script, stackPos(0), stackPos(1), stackPos(2), stackPos(3));
debugC(3, kDebugLevelScriptFuncs, "o2_setSceneAnimPosAndUpdate(%p) (%d, %d, %d, %d)", (const void *)script, stackPos(0), stackPos(1), stackPos(2), stackPos(3));
const int anim = stackPos(0);
_sceneAnims[anim].x2 = stackPos(1);
_sceneAnims[anim].y2 = stackPos(2);
@ -1039,6 +1039,12 @@ int KyraEngine_v2::o2_querySpecialSceneScriptState(ScriptState *script) {
return _specialSceneScriptState[stackPos(0)];
}
int KyraEngine_v2::o2_resetInputColorCode(ScriptState *script) {
debugC(3, kDebugLevelScriptFuncs, "o2_resetInputColorCode(%p)", (const void *)script);
memset(_inputColorCode, 255, 7);
return 0;
}
int KyraEngine_v2::o2_setHiddenItemsEntry(ScriptState *script) {
debugC(3, kDebugLevelScriptFuncs, "o2_setHiddenItemsEntry(%p) (%d, %d)", (const void *)script, stackPos(0), stackPos(1));
return (_hiddenItems[stackPos(0)] = stackPos(1));

View File

@ -258,7 +258,7 @@ int KyraEngine_v2::tim_o_resetActiveSub(uint8 *ptr) {
}
int KyraEngine_v2::tim_o_printTalkText(uint8 *ptr) {
_chatText = _timChatText = (const char*) _TIMBuffers.TEXTChunk + (READ_LE_UINT16(ptr) << 1);
_chatText = _timChatText = (const char*) _TIMBuffers.TEXTChunk + READ_LE_UINT16(_TIMBuffers.TEXTChunk + (READ_LE_UINT16(ptr) << 1));
_chatObject = _timChatObject = READ_LE_UINT16(ptr + 2);
if (_flags.lang == Common::JA_JPN) {