diff options
author | lukaslw | 2014-07-04 22:00:02 +0200 |
---|---|---|
committer | lukaslw | 2014-07-04 22:00:02 +0200 |
commit | 092c3683b49288f9068a8dee5ae8db9071baab07 (patch) | |
tree | 79db8e780bd6334e4ea18aaf00803d2d030f48dd | |
parent | a838b34b4dc9968c06ab1ebf27efad85d54216a0 (diff) | |
download | scummvm-rg350-092c3683b49288f9068a8dee5ae8db9071baab07.tar.gz scummvm-rg350-092c3683b49288f9068a8dee5ae8db9071baab07.tar.bz2 scummvm-rg350-092c3683b49288f9068a8dee5ae8db9071baab07.zip |
PRINCE: O_GETOBJDATA(), O_SETOBJDATA()
-rw-r--r-- | engines/prince/object.cpp | 25 | ||||
-rw-r--r-- | engines/prince/object.h | 16 | ||||
-rw-r--r-- | engines/prince/prince.cpp | 3 | ||||
-rw-r--r-- | engines/prince/prince.h | 2 | ||||
-rw-r--r-- | engines/prince/script.cpp | 9 |
5 files changed, 49 insertions, 6 deletions
diff --git a/engines/prince/object.cpp b/engines/prince/object.cpp index 86d4238bc0..22ed0a7656 100644 --- a/engines/prince/object.cpp +++ b/engines/prince/object.cpp @@ -85,5 +85,30 @@ bool Object::loadFromStream(Common::SeekableReadStream &stream) { return true; } +void Object::setData(AttrId dataId, uint16 value) { + switch (dataId) { + case kObjectX: + _x = value; + break; + case kObjectY: + _y = value; + break; + default: + assert(false); + } +} + +uint16 Object::getData(AttrId dataId) { + switch (dataId) { + case kObjectX: + return _x; + case kObjectY: + return _y; + default: + assert(false); + return 0; + } +} + } /* vim: set tabstop=4 noexpandtab: */ diff --git a/engines/prince/object.h b/engines/prince/object.h index 1fb7465a0d..3d0257cad4 100644 --- a/engines/prince/object.h +++ b/engines/prince/object.h @@ -44,8 +44,24 @@ public: int32 _zoomInAddr; int32 _zoomInTime; + // Used instead of offset in setData and getData + enum AttrId { + kObjectAddr = 0, + kObjectX = 4, + kObjectY = 6, + kObjectZ = 8, + kObjectFlags = 10, + kObjectZoomInSource = 12, + kObjectZoomInLen = 16, + kObjectZoomInAddr = 20, + kObjectZoomInTime = 24 + }; + bool loadFromStream(Common::SeekableReadStream &stream); Graphics::Surface *getSurface() const { return _surface; } + uint16 getData(AttrId dataId); + void setData(AttrId dataId, uint16 value); + private: void loadSurface(Common::SeekableReadStream &stream); Graphics::Surface *_surface; diff --git a/engines/prince/prince.cpp b/engines/prince/prince.cpp index 10f90288c0..3140f2298f 100644 --- a/engines/prince/prince.cpp +++ b/engines/prince/prince.cpp @@ -1388,8 +1388,7 @@ void PrinceEngine::showBackAnims() { void PrinceEngine::removeSingleBackAnim(int slot) { if (!_backAnimList[slot].backAnims.empty()) { - int anims = _backAnimList[slot]._seq._anims != 0 ? _backAnimList[slot]._seq._anims : 1; - for (int j = 0; j < anims; j++) { + for (uint j = 0; j < _backAnimList[slot].backAnims.size(); j++) { delete _backAnimList[slot].backAnims[j]._animData; delete _backAnimList[slot].backAnims[j]._shadowData; } diff --git a/engines/prince/prince.h b/engines/prince/prince.h index 060f78f681..a96aba56c1 100644 --- a/engines/prince/prince.h +++ b/engines/prince/prince.h @@ -306,6 +306,7 @@ public: Common::Array<BackgroundAnim> _backAnimList; Common::Array<Anim> _normAnimList; Common::Array<Mob> _mobList; + Common::Array<Object *> _objList; void freeNormAnim(int slot); void freeAllNormAnims(); @@ -474,7 +475,6 @@ private: Audio::SoundHandle _soundHandle[MAX_SAMPLES]; Common::Array<PScr *> _pscrList; - Common::Array<Object *> _objList; Common::Array<Mask> _maskList; Common::Array<DrawNode> _drawNodeList; Common::Array<InvItem> _allInvList; diff --git a/engines/prince/script.cpp b/engines/prince/script.cpp index ab435f2cb1..4c9c28f1b3 100644 --- a/engines/prince/script.cpp +++ b/engines/prince/script.cpp @@ -615,7 +615,6 @@ void Interpreter::O_PUTOBJECT() { void Interpreter::O_REMOBJECT() { uint16 roomId = readScriptFlagValue(); uint16 objectId = readScriptFlagValue(); - debugInterpreter("O_REMOBJECT roomId %d objectId %d", roomId, objectId); } @@ -1335,6 +1334,8 @@ void Interpreter::O_GETOBJDATA() { Flags::Id flag = readScriptFlagId(); uint16 obj = readScriptFlagValue(); int16 objOffset = readScriptFlagValue(); + int16 value = _vm->_objList[obj]->getData((Object::AttrId)objOffset); + _flags->setFlagValue(flag, value); debugInterpreter("O_GETOBJDATA flag %d, obj %d, objOffset %d", flag, obj, objOffset); } @@ -1342,12 +1343,14 @@ void Interpreter::O_SETOBJDATA() { uint16 obj = readScriptFlagValue(); int16 objOffset = readScriptFlagValue(); uint16 value = readScriptFlagValue(); + _vm->_objList[obj]->setData((Object::AttrId)objOffset, value); debugInterpreter("O_SETOBJDATA obj %d, objOffset %d, value %d", obj, objOffset, value); } +// not used? void Interpreter::O_SWAPOBJECTS() { - uint16 obj1 = readScript<uint16>(); - uint16 obj2 = readScript<uint16>(); + uint16 obj1 = readScriptFlagValue(); + uint16 obj2 = readScriptFlagValue(); debugInterpreter("O_SWAPOBJECTS obj1 %d, obj2 %d", obj1, obj2); } |