aboutsummaryrefslogtreecommitdiff
path: root/engines/prince
diff options
context:
space:
mode:
authorlukaslw2014-07-04 03:12:06 +0200
committerlukaslw2014-07-04 03:12:06 +0200
commit9d2670416ce81abeca04cb64512f7c5ebc918281 (patch)
treee7d5f998606ae7f9cdee9242c5cf47ea091ff7b4 /engines/prince
parent9698ec51b3d579245f67879fb608db8c2c855bcb (diff)
downloadscummvm-rg350-9d2670416ce81abeca04cb64512f7c5ebc918281.tar.gz
scummvm-rg350-9d2670416ce81abeca04cb64512f7c5ebc918281.tar.bz2
scummvm-rg350-9d2670416ce81abeca04cb64512f7c5ebc918281.zip
PRINCE: O_SETFRAME, O_CHECKINV, O_GETANIMDATA, O_SETBACKFRAME, O_GETRND. O_GETBACKANIMDATA fix
Diffstat (limited to 'engines/prince')
-rw-r--r--engines/prince/prince.cpp32
-rw-r--r--engines/prince/prince.h4
-rw-r--r--engines/prince/script.cpp45
3 files changed, 62 insertions, 19 deletions
diff --git a/engines/prince/prince.cpp b/engines/prince/prince.cpp
index 30feaeca8a..0430a967c1 100644
--- a/engines/prince/prince.cpp
+++ b/engines/prince/prince.cpp
@@ -1387,6 +1387,14 @@ void PrinceEngine::clearBackAnimList() {
_backAnimList.clear();
}
+void PrinceEngine::initZoomIn(int slot) {
+ //TODO
+}
+
+void PrinceEngine::initZoomOut(int slot) {
+ //TODO
+}
+
void PrinceEngine::showObjects() {
if (!_objList.empty()) {
for (uint i = 0; i < _objList.size(); i++) {
@@ -1673,6 +1681,30 @@ void PrinceEngine::swapInv(int hero) {
}
}
+void PrinceEngine::checkInv(int hero, int item) {
+ switch (hero) {
+ case 0:
+ for (uint i = 0; i < _mainHero->_inventory.size(); i++) {
+ if (_mainHero->_inventory[i] == item) {
+ _interpreter->setResult(0);
+ }
+ }
+ _interpreter->setResult(1);
+ break;
+ case 1:
+ for (uint i = 0; i < _secondHero->_inventory.size(); i++) {
+ if (_secondHero->_inventory[i] == item) {
+ _interpreter->setResult(0);
+ }
+ }
+ _interpreter->setResult(1);
+ break;
+ default:
+ error("addInv() - wrong hero slot");
+ break;
+ }
+}
+
void PrinceEngine::addInvObj() {
changeCursor(0);
//prepareInventoryToView();
diff --git a/engines/prince/prince.h b/engines/prince/prince.h
index 340c2d0cbf..b095da1fc0 100644
--- a/engines/prince/prince.h
+++ b/engines/prince/prince.h
@@ -385,6 +385,7 @@ public:
void remInv(int hero, int item);
void clearInv(int hero);
void swapInv(int hero);
+ void checkInv(int hero, int item);
void addInvObj();
void makeInvCursor(int itemNr);
void enableOptions();
@@ -420,6 +421,9 @@ public:
void talkHero(int slot);
void doTalkAnim(int animNumber, int slot, AnimType animType);
+ void initZoomIn(int slot);
+ void initZoomOut(int slot);
+
int testAnimNr;
int testAnimFrame;
diff --git a/engines/prince/script.cpp b/engines/prince/script.cpp
index bf3fbacf21..8615b1ef9b 100644
--- a/engines/prince/script.cpp
+++ b/engines/prince/script.cpp
@@ -1090,6 +1090,7 @@ void Interpreter::O_WAITFRAME() {
void Interpreter::O_SETFRAME() {
uint16 anim = readScriptFlagValue();
uint16 frame = readScriptFlagValue();
+ _vm->_normAnimList[anim]._frame = frame;
debugInterpreter("O_SETFRAME anim %d, frame %d", anim, frame);
}
@@ -1129,8 +1130,8 @@ void Interpreter::O_FREEPRELOAD() {
void Interpreter::O_CHECKINV() {
uint16 hero = readScriptFlagValue();
uint16 item = readScriptFlagValue();
+ _vm->checkInv(hero, item);
debugInterpreter("O_CHECKINV hero %d, item %d", hero, item);
- // checks if item is in heros inventory
}
void Interpreter::O_TALKHERO() {
@@ -1139,6 +1140,7 @@ void Interpreter::O_TALKHERO() {
_vm->talkHero(hero);
}
+//TODO
void Interpreter::O_WAITTEXT() {
uint16 slot = readScriptFlagValue();
Text &text = _vm->_textSlots[slot];
@@ -1197,8 +1199,8 @@ void Interpreter::O_CHANGEBACKFRAMES() {
void Interpreter::O_GETBACKANIMDATA() {
Flags::Id flagId = readScriptFlagId();
- uint16 animNumber = readScript<uint16>();
- uint16 animDataOffset = readScript<uint16>();
+ uint16 animNumber = readScriptFlagValue();
+ uint16 animDataOffset = readScriptFlagValue();
int currAnim = _vm->_backAnimList[animNumber]._seq._currRelative;
int16 value = _vm->_backAnimList[animNumber].backAnims[currAnim].getAnimData((Anim::AnimOffsets)(animDataOffset));
_flags->setFlagValue((Flags::Id)(flagId), value);
@@ -1206,12 +1208,13 @@ void Interpreter::O_GETBACKANIMDATA() {
}
void Interpreter::O_GETANIMDATA() {
- uint16 flag = readScript<uint16>();
+ Flags::Id flagId = readScriptFlagId();
uint16 anim = readScriptFlagValue();
uint16 animOffset = readScriptFlagValue();
- debugInterpreter("O_GETANIMDATA flag %d, anim %d, animOffset %d", flag, anim, animOffset);
- // Gets value of anim data
- // use anim offset as attribute id not an offset
+ if (_vm->_normAnimList[anim]._animData != nullptr) {
+ _flags->setFlagValue(flagId, _vm->_normAnimList[anim].getAnimData((Anim::AnimOffsets)(animOffset)));
+ }
+ debugInterpreter("O_GETANIMDATA flag %04X (%s), anim %d, animOffset %d", flagId, Flags::getFlagName(flagId), anim, animOffset);
}
void Interpreter::O_SETBGCODE() {
@@ -1223,17 +1226,22 @@ void Interpreter::O_SETBGCODE() {
void Interpreter::O_SETBACKFRAME() {
uint16 anim = readScriptFlagValue();
uint16 frame = readScriptFlagValue();
-
+ int currAnim = _vm->_backAnimList[anim]._seq._currRelative;
+ if (_vm->_backAnimList[anim].backAnims[currAnim]._animData != nullptr) {
+ _vm->_backAnimList[anim].backAnims[currAnim]._frame = frame;
+ }
debugInterpreter("O_SETBACKFRAME anim %d, frame %d", anim, frame);
}
+// TODO - check if proper max for getRandomNumber
void Interpreter::O_GETRND() {
Flags::Id flag = readScriptFlagId();
uint16 rndSeed = readScript<uint16>();
debugInterpreter("O_GETRND flag %d, rndSeed %d", flag, rndSeed);
// puts and random value as flag value
// fairly random value ;)
- // _flags->setFlagValue(flag, 4);
+ int value = _vm->_randomSource.getRandomNumber(rndSeed);
+ _flags->setFlagValue(flag, value);
}
void Interpreter::O_TALKBACKANIM() {
@@ -1275,33 +1283,32 @@ void Interpreter::O_CALLDFLAG() {
void Interpreter::O_PRINTAT() {
uint16 slot = readScriptFlagValue();
- uint16 fr1 = readScriptFlagValue();
- uint16 fr2 = readScriptFlagValue();
-
- debugInterpreter("O_PRINTAT slot %d, fr1 %d, fr2 %d", slot, fr1, fr2);
-
+ uint16 x = readScriptFlagValue();
+ uint16 y = readScriptFlagValue();
+ debugInterpreter("O_PRINTAT slot %d, x %d, y %d", slot, x, y);
uint8 color = _flags->getFlagValue(Flags::KOLOR);
-
- _vm->printAt(slot, color, (char *)_string, fr1, fr2);
-
+ _vm->printAt(slot, color, (char *)_string, x, y);
increaseString();
}
void Interpreter::O_ZOOMIN() {
uint16 slot = readScriptFlagValue();
+ _vm->initZoomIn(slot);
debugInterpreter("O_ZOOMIN slot %04d", slot);
}
void Interpreter::O_ZOOMOUT() {
uint16 slot = readScriptFlagValue();
+ _vm->initZoomOut(slot);
debugInterpreter("O_ZOOMOUT slot %d", slot);
}
+// TODO - never used?
void Interpreter::O_SETSTRINGOFFSET() {
int32 offset = readScript<uint32>();
debugInterpreter("O_SETSTRINGOFFSET offset %04x", offset);
- // _currentString = ""
- // _string = (const char *)_currentInstruction + offset
+ _currentString = 0;
+ _string = (byte *)_currentInstruction + offset; //FIXME
}
void Interpreter::O_GETOBJDATA() {