[Scummvm-cvs-logs] SF.net SVN: scummvm: [29211] scummvm/trunk/engines/kyra
lordhoto at users.sourceforge.net
lordhoto at users.sourceforge.net
Sat Oct 13 21:17:58 CEST 2007
Revision: 29211
http://scummvm.svn.sourceforge.net/scummvm/?rev=29211&view=rev
Author: lordhoto
Date: 2007-10-13 12:17:58 -0700 (Sat, 13 Oct 2007)
Log Message:
-----------
HoF:
- implemented opcodes
-> o2_checkForItem 32
-> o2_countItemInInventory 37
-> o2_setMousePos 47
-> o2_countItemInstances 136
Modified Paths:
--------------
scummvm/trunk/engines/kyra/kyra_v2.cpp
scummvm/trunk/engines/kyra/kyra_v2.h
scummvm/trunk/engines/kyra/script_v2.cpp
Modified: scummvm/trunk/engines/kyra/kyra_v2.cpp
===================================================================
--- scummvm/trunk/engines/kyra/kyra_v2.cpp 2007-10-13 18:53:49 UTC (rev 29210)
+++ scummvm/trunk/engines/kyra/kyra_v2.cpp 2007-10-13 19:17:58 UTC (rev 29211)
@@ -1505,14 +1505,14 @@
OpcodeUnImpl(),
OpcodeUnImpl(),
// 0x20
+ Opcode(o2_checkForItem),
OpcodeUnImpl(),
OpcodeUnImpl(),
- OpcodeUnImpl(),
Opcode(o2_defineItem),
// 0x24
OpcodeUnImpl(),
+ Opcode(o2_countItemInInventory),
OpcodeUnImpl(),
- OpcodeUnImpl(),
Opcode(o2_queryGameFlag),
// 0x28
Opcode(o2_resetGameFlag),
@@ -1523,7 +1523,7 @@
Opcode(o2_handItemSet),
Opcode(o2_hideMouse),
Opcode(o2_addSpecialExit),
- OpcodeUnImpl(),
+ Opcode(o2_setMousePos),
// 0x30
Opcode(o2_showMouse),
OpcodeUnImpl(),
@@ -1635,10 +1635,10 @@
OpcodeUnImpl(),
OpcodeUnImpl(),
// 0x88
+ Opcode(o2_countItemInstances),
OpcodeUnImpl(),
OpcodeUnImpl(),
OpcodeUnImpl(),
- OpcodeUnImpl(),
// 0x8c
OpcodeUnImpl(),
OpcodeUnImpl(),
Modified: scummvm/trunk/engines/kyra/kyra_v2.h
===================================================================
--- scummvm/trunk/engines/kyra/kyra_v2.h 2007-10-13 18:53:49 UTC (rev 29210)
+++ scummvm/trunk/engines/kyra/kyra_v2.h 2007-10-13 19:17:58 UTC (rev 29211)
@@ -559,7 +559,9 @@
int o2_displayWsaFrame(ScriptState *script);
int o2_displayWsaSequentialFrames(ScriptState *script);
int o2_wsaOpen(ScriptState *script);
+ int o2_checkForItem(ScriptState *script);
int o2_defineItem(ScriptState *script);
+ int o2_countItemInInventory(ScriptState *script);
int o2_queryGameFlag(ScriptState *script);
int o2_resetGameFlag(ScriptState *script);
int o2_setGameFlag(ScriptState *script);
@@ -567,6 +569,7 @@
int o2_handItemSet(ScriptState *script);
int o2_hideMouse(ScriptState *script);
int o2_addSpecialExit(ScriptState *script);
+ int o2_setMousePos(ScriptState *script);
int o2_showMouse(ScriptState *script);
//int o2_playSoundEffect(ScriptState *script);
int o2_delay(ScriptState *script);
@@ -594,6 +597,7 @@
int o2_defineSceneAnim(ScriptState *script);
int o2_updateSceneAnim(ScriptState *script);
int o2_defineRoom(ScriptState *script);
+ int o2_countItemInstances(ScriptState *script);
int o2_setSpecialSceneScriptState(ScriptState *script);
int o2_clearSpecialSceneScriptState(ScriptState *script);
int o2_querySpecialSceneScriptState(ScriptState *script);
Modified: scummvm/trunk/engines/kyra/script_v2.cpp
===================================================================
--- scummvm/trunk/engines/kyra/script_v2.cpp 2007-10-13 18:53:49 UTC (rev 29210)
+++ scummvm/trunk/engines/kyra/script_v2.cpp 2007-10-13 19:17:58 UTC (rev 29211)
@@ -248,6 +248,11 @@
return 0;
}
+int KyraEngine_v2::o2_checkForItem(ScriptState *script) {
+ debugC(3, kDebugLevelScriptFuncs, "o2_checkForItem(%p) (%d, %d)", (const void *)script, stackPos(0), stackPos(1));
+ return findItem(stackPos(0), stackPos(1)) == -1 ? 0 : 1;
+}
+
int KyraEngine_v2::o2_defineItem(ScriptState *script) {
debugC(3, kDebugLevelScriptFuncs, "o2_defineItem(%p) (%d, %d, %d, %d)", (const void *)script,
stackPos(0), stackPos(1), stackPos(2), stackPos(3));
@@ -263,6 +268,22 @@
return freeItem;
}
+int KyraEngine_v2::o2_countItemInInventory(ScriptState *script) {
+ debugC(3, kDebugLevelScriptFuncs, "o2_countItemInInventory(%p) (%d)", (const void *)script, stackPos(0));
+ uint16 item = stackPos(0);
+ int count = 0;
+
+ for (int i = 0; i < 20; ++i) {
+ if (_mainCharacter.inventory[i] == item)
+ ++count;
+ }
+
+ if (_itemInHand == int16(item))
+ ++count;
+
+ return count;
+}
+
int KyraEngine_v2::o2_queryGameFlag(ScriptState *script) {
debugC(3, kDebugLevelScriptFuncs, "o2_queryGameFlag(%p) (%d)", (const void *)script, stackPos(0));
return queryGameFlag(stackPos(0));
@@ -309,6 +330,12 @@
return 0;
}
+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));
+ return 0;
+}
+
int KyraEngine_v2::o2_showMouse(ScriptState *script) {
debugC(3, kDebugLevelScriptFuncs, "o2_showMouse(%p) ()", (const void *)script);
_screen->showMouse();
@@ -607,6 +634,39 @@
return 0;
}
+int KyraEngine_v2::o2_countItemInstances(ScriptState *script) {
+ debugC(3, kDebugLevelScriptFuncs, "o2_countItemInstances(%p) (%d)", (const void *)script, stackPos(0));
+ uint16 item = stackPos(0);
+
+ int count = 0;
+ for (int i = 0; i < 20; ++i) {
+ if (_mainCharacter.inventory[i] == item)
+ ++count;
+ }
+
+ if (_itemInHand == int16(item))
+ ++count;
+
+ for (int i = 0; i < 30; ++i) {
+ if (_itemList[i].id == item)
+ ++count;
+ }
+
+ /*XXX
+ if (_unkTable3[0] == item && _newChapterFile == 1)
+ ++count;
+ if (_unkTable3[1] == item && _newChapterFile == 1)
+ ++count;
+ if (_unkTable3[2] == item && _newChapterFile == 2)
+ ++count;
+ if (_unkTable3[3] == item && _newChapterFile == 2)
+ ++count;
+ if (_unkTable3[4] == item && _newChapterFile == 1)
+ ++count;*/
+
+ return count;
+}
+
int KyraEngine_v2::o2_setSpecialSceneScriptState(ScriptState *script) {
debugC(3, kDebugLevelScriptFuncs, "o2_setSpecialSceneScriptState(%p) (%d)", (const void *)script, stackPos(0));
_specialSceneScriptState[stackPos(0)] = 1;
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
More information about the Scummvm-git-logs
mailing list