diff options
126 files changed, 1663 insertions, 901 deletions
diff --git a/base/plugins.h b/base/plugins.h index 4409c9eaea..e0673ce636 100644 --- a/base/plugins.h +++ b/base/plugins.h @@ -169,7 +169,7 @@ protected: PluginType _type; public: - Plugin() : _pluginObject(0) {} + Plugin() : _pluginObject(0), _type(PLUGIN_TYPE_MAX) {} virtual ~Plugin() { //if (isLoaded()) //unloadPlugin(); diff --git a/common/dcl.cpp b/common/dcl.cpp index 1879be992d..87ec0ad915 100644 --- a/common/dcl.cpp +++ b/common/dcl.cpp @@ -371,12 +371,14 @@ bool DecompressorDCL::unpack(ReadStream *src, byte *dest, uint32 nPacked, uint32 debug(8, "\nCOPY(%d from %d)\n", val_length, val_distance); if (val_length + _dwWrote > _szUnpacked) { - warning("DCL-INFLATE Error: Write out of bounds while copying %d bytes", val_length); + warning("DCL-INFLATE Error: Write out of bounds while copying %d bytes (declared unpacked size is %d bytes, current is %d + %d bytes)", + val_length, _szUnpacked, _dwWrote, val_length); return false; } if (_dwWrote < val_distance) { - warning("DCL-INFLATE Error: Attempt to copy from before beginning of input stream"); + warning("DCL-INFLATE Error: Attempt to copy from before beginning of input stream (declared unpacked size is %d bytes, current is %d bytes)", + _szUnpacked, _dwWrote); return false; } diff --git a/common/scummsys.h b/common/scummsys.h index 3e9d5ef063..b15a76e5b9 100644 --- a/common/scummsys.h +++ b/common/scummsys.h @@ -23,6 +23,10 @@ #ifndef COMMON_SCUMMSYS_H #define COMMON_SCUMMSYS_H +#ifndef __has_feature // Optional of course. + #define __has_feature(x) 0 // Compatibility with non-clang compilers. +#endif + // This is a convenience macro to test whether the compiler used is a GCC // version, which is at least major.minor. #define GCC_ATLEAST(major, minor) (defined(__GNUC__) && (__GNUC__ > (major) || (__GNUC__ == (major) && __GNUC_MINOR__ >= (minor)))) @@ -3410,10 +3410,10 @@ int main(void) { return 0; } EOF - cc_check $PNG_CFLAGS $PNG_LIBS -lpng && _png=yes + cc_check $PNG_CFLAGS $PNG_LIBS -lpng -lz && _png=yes fi if test "$_png" = yes ; then - LIBS="$LIBS $PNG_LIBS -lpng" + LIBS="$LIBS $PNG_LIBS -lpng -lz" INCLUDES="$INCLUDES $PNG_CFLAGS" fi define_in_config_if_yes "$_png" 'USE_PNG' diff --git a/devtools/convbdf.cpp b/devtools/convbdf.cpp index c8b1fb7d6d..69728eb9fd 100644 --- a/devtools/convbdf.cpp +++ b/devtools/convbdf.cpp @@ -20,6 +20,10 @@ * */ +#ifndef __has_feature // Optional of course. + #define __has_feature(x) 0 // Compatibility with non-clang compilers. +#endif + #include <fstream> #include <string> #include <stdio.h> diff --git a/devtools/create_mortdat/create_mortdat.cpp b/devtools/create_mortdat/create_mortdat.cpp index 5a491eea2f..0065407daa 100644 --- a/devtools/create_mortdat/create_mortdat.cpp +++ b/devtools/create_mortdat/create_mortdat.cpp @@ -33,10 +33,6 @@ #undef main #endif // main -#include <stdio.h> -#include <stdlib.h> -#include <string.h> - #include "common/endian.h" #include "create_mortdat.h" #include "enginetext.h" diff --git a/devtools/create_neverhood/create_neverhood.cpp b/devtools/create_neverhood/create_neverhood.cpp index 446ee5ec3b..a37ff99ca9 100644 --- a/devtools/create_neverhood/create_neverhood.cpp +++ b/devtools/create_neverhood/create_neverhood.cpp @@ -30,8 +30,8 @@ #undef main #endif // main -#include <vector> #include "create_neverhood.h" +#include <vector> #include "md5.h" #include "tables.h" diff --git a/devtools/create_project/create_project.h b/devtools/create_project/create_project.h index 5325bf6d1b..2f27cc2f61 100644 --- a/devtools/create_project/create_project.h +++ b/devtools/create_project/create_project.h @@ -23,6 +23,10 @@ #ifndef TOOLS_CREATE_PROJECT_H #define TOOLS_CREATE_PROJECT_H +#ifndef __has_feature // Optional of course. + #define __has_feature(x) 0 // Compatibility with non-clang compilers. +#endif + #include <map> #include <list> #include <string> diff --git a/devtools/create_translations/create_translations.cpp b/devtools/create_translations/create_translations.cpp index a153632c47..a8b04a7a52 100644 --- a/devtools/create_translations/create_translations.cpp +++ b/devtools/create_translations/create_translations.cpp @@ -22,6 +22,8 @@ * The generated files is used by ScummVM to propose translation of its GUI. */ +#include "create_translations.h" + #include <stdio.h> #include <stdlib.h> #include <string.h> @@ -34,7 +36,6 @@ #undef main #endif // main -#include "create_translations.h" #include "po_parser.h" #include "cp_parser.h" diff --git a/devtools/create_translations/create_translations.h b/devtools/create_translations/create_translations.h index 9ccbd39b2b..1df01e6333 100644 --- a/devtools/create_translations/create_translations.h +++ b/devtools/create_translations/create_translations.h @@ -28,4 +28,8 @@ typedef unsigned short uint16; typedef unsigned int uint32; typedef signed short int16; +#ifndef __has_feature // Optional of course. + #define __has_feature(x) 0 // Compatibility with non-clang compilers. +#endif + #endif /* CREATE_TRANSLATIONS_H */ diff --git a/devtools/scumm-md5.txt b/devtools/scumm-md5.txt index 0dbcbf4792..a52bbaecf8 100644 --- a/devtools/scumm-md5.txt +++ b/devtools/scumm-md5.txt @@ -598,6 +598,7 @@ catalog Humongous Interactive Catalog a56e8d9d4281c53c3f63c9bd22a59e21 10978342 en All HE CUP Preview George Kormendi 74da3494fbe1a7d20213b0afe0954755 10841544 fr All HE CUP Preview - George Kormendi 4c4820518e16e1a0e3616a3b021a04f3 10927456 de All HE CUP Preview - Kirben + 288fb75b24389733c29fa107fe8d44e8 10795148 us All HE CUP Preview - Kirben airport Let's Explore the Airport with Buzzy d6334a5a9b61afe18c368540fdf522ca -1 en Mac - - - Joachim Eberhard diff --git a/engines/composer/composer.cpp b/engines/composer/composer.cpp index 5db778dfda..2d7075cba1 100644 --- a/engines/composer/composer.cpp +++ b/engines/composer/composer.cpp @@ -48,6 +48,15 @@ namespace Composer { ComposerEngine::ComposerEngine(OSystem *syst, const ComposerGameDescription *gameDesc) : Engine(syst), _gameDescription(gameDesc) { _rnd = new Common::RandomSource("composer"); _audioStream = NULL; + _currSoundPriority = 0; + _currentTime = 0; + _lastTime = 0; + _needsUpdate = true; + _directoriesToStrip = 1; + _mouseVisible = true; + _mouseEnabled = false; + _mouseSpriteId = 0; + _lastButton = NULL; } ComposerEngine::~ComposerEngine() { @@ -79,12 +88,6 @@ Common::Error ComposerEngine::run() { _queuedScripts[i]._scriptId = 0; } - _mouseVisible = true; - _mouseEnabled = false; - _mouseSpriteId = 0; - _lastButton = NULL; - - _directoriesToStrip = 1; if (!_bookIni.loadFromFile("book.ini")) { _directoriesToStrip = 0; if (!_bookIni.loadFromFile("programs/book.ini")) { @@ -103,7 +106,6 @@ Common::Error ComposerEngine::run() { height = atoi(getStringFromConfig("Common", "Height").c_str()); initGraphics(width, height, true); _screen.create(width, height, Graphics::PixelFormat::createFormatCLUT8()); - _needsUpdate = true; Graphics::Cursor *cursor = Graphics::makeDefaultWinCursor(); CursorMan.replaceCursor(cursor->getSurface(), cursor->getWidth(), cursor->getHeight(), cursor->getHotspotX(), @@ -113,11 +115,12 @@ Common::Error ComposerEngine::run() { loadLibrary(0); - _currentTime = 0; - _lastTime = 0; - uint fps = atoi(getStringFromConfig("Common", "FPS").c_str()); - uint frameTime = 1000 / fps; + uint frameTime = 125; // Default to 125ms (1000/8) + if (fps != 0) + frameTime = 1000 / fps; + else + warning("FPS in book.ini is zero. Defaulting to 8..."); uint32 lastDrawTime = 0; while (!shouldQuit()) { diff --git a/engines/fullpipe/motion.cpp b/engines/fullpipe/motion.cpp index b63267c572..da0c614e72 100644 --- a/engines/fullpipe/motion.cpp +++ b/engines/fullpipe/motion.cpp @@ -27,6 +27,7 @@ #include "common/list.h" #include "fullpipe/objects.h" +#include "fullpipe/statics.h" #include "fullpipe/motion.h" #include "fullpipe/messages.h" #include "fullpipe/gameloader.h" @@ -50,7 +51,9 @@ bool MctlCompound::load(MfcArchive &file) { for (int i = 0; i < count; i++) { debug(6, "CompoundArray[%d]", i); - MctlCompoundArrayItem *obj = (MctlCompoundArrayItem *)file.readClass(); + MctlCompoundArrayItem *obj = new MctlCompoundArrayItem(); + + obj->_motionControllerObj = (MotionController *)file.readClass(); int count1 = file.readUint32LE(); @@ -68,16 +71,15 @@ bool MctlCompound::load(MfcArchive &file) { debug(6, "graphReact"); obj->_movGraphReactObj = (MovGraphReact *)file.readClass(); - _motionControllers.push_back(*obj); + _motionControllers.push_back(obj); } return true; } -int MctlCompound::addObject(StaticANIObject *obj) { - warning("STUB: MctlCompound::addObject()"); - - return 0; +void MctlCompound::addObject(StaticANIObject *obj) { + for (uint i = 0; i < _motionControllers.size(); i++) + _motionControllers[i]->_motionControllerObj->addObject(obj); } int MctlCompound::removeObject(StaticANIObject *obj) { @@ -87,7 +89,6 @@ int MctlCompound::removeObject(StaticANIObject *obj) { } void MctlCompound::initMovGraph2() { -#if 0 if (_objtype != kObjTypeMctlCompound) return; @@ -97,10 +98,10 @@ void MctlCompound::initMovGraph2() { MovGraph *gr = (MovGraph *)_motionControllers[i]->_motionControllerObj; - CMovGraph2 *newgr = new MovGraph2(); + MovGraph2 *newgr = new MovGraph2(); - newgr->_links.push_back(gr->_links); - newgr->_nodes.push_back(gr->_nodes); + newgr->_links = gr->_links; + newgr->_nodes = gr->_nodes; gr->_links.clear(); gr->_nodes.clear(); @@ -109,7 +110,6 @@ void MctlCompound::initMovGraph2() { _motionControllers[i]->_motionControllerObj = newgr; } -#endif } void MctlCompound::freeItems() { @@ -167,14 +167,277 @@ bool MovGraph::load(MfcArchive &file) { return true; } -int MovGraph::addObject(StaticANIObject *obj) { +void MovGraph::addObject(StaticANIObject *obj) { warning("STUB: MovGraph::addObject()"); +} + +int MovGraph::removeObject(StaticANIObject *obj) { + warning("STUB: MovGraph::removeObject()"); + + return 0; +} + +void MovGraph::freeItems() { + warning("STUB: MovGraph::freeItems()"); +} + +int MovGraph::method28() { + warning("STUB: MovGraph::method28()"); + + return 0; +} + +int MovGraph::method2C() { + warning("STUB: MovGraph::method2C()"); + + return 0; +} + +MessageQueue *MovGraph::method34(StaticANIObject *subj, int xpos, int ypos, int flag, int staticsId) { + warning("STUB: MovGraph::method34()"); + + return 0; +} + +int MovGraph::changeCallback() { + warning("STUB: MovGraph::changeCallback()"); + + return 0; +} + +int MovGraph::method3C() { + warning("STUB: MovGraph::method3C()"); + + return 0; +} + +int MovGraph::method44() { + warning("STUB: MovGraph::method44()"); + + return 0; +} + +MessageQueue *MovGraph::method4C(StaticANIObject *subj, int xpos, int ypos, int flag, int staticsId) { + warning("STUB: MovGraph::method4C()"); + + return 0; +} + +int MovGraph::method50() { + warning("STUB: MovGraph::method50()"); return 0; } double MovGraph::calcDistance(Common::Point *point, MovGraphLink *link, int flag) { - warning("STUB: MovGraph::calcDistance()"); + int n1x = link->_movGraphNode1->_x; + int n1y = link->_movGraphNode1->_y; + int n2x = link->_movGraphNode2->_x; + int n2y = link->_movGraphNode2->_y; + double dist1x = (double)(point->x - n1x); + double dist1y = (double)(n1y - point->y); + double dist2x = (double)(n2x - n1x); + double dist2y = (double)(n2y - n1y); + double dist1 = sqrt(dist1y * dist1y + dist1x * dist1x); + double dist2 = ((double)(n1y - n2y) * dist1y + dist2x * dist1x) / link->_distance / dist1; + double distm = dist2 * dist1; + double res = sqrt(1.0 - dist2 * dist2) * dist1; + + if (dist2 <= 0.0 || distm >= link->_distance) { + if (flag) { + if (dist2 > 0.0) { + if (distm >= link->_distance) { + point->x = n2x; + point->y = n2y; + } + } else { + point->x = n1x; + point->y = n1y; + } + } else { + return -1.0; + } + } else { + point->x = n1x + (dist2x * distm / link->_distance); + point->y = n1y + (dist2y * distm / link->_distance); + } + + return res; +} + +int MovGraph2::getItemIndexByGameObjectId(int objectId) { + for (uint i = 0; i < _items.size(); i++) + if (_items[i]->_objectId == objectId) + return i; + + return -1; +} + +bool MovGraph2::initDirections(StaticANIObject *obj, MovGraph2Item *item) { + item->_obj = obj; + item->_objectId = obj->_id; + + GameVar *var = g_fullpipe->getGameLoaderGameVar()->getSubVarByName(obj->_objectName); + if (!var) + return false; + + var = var->getSubVarByName("Test_walk"); + + if (!var) + return false; + + GameVar *varD = 0; + Common::Point point; + + for (int dir = 0; dir < 4; dir++) { + switch (dir) { + case 0: + varD = var->getSubVarByName("Right"); + break; + case 1: + varD = var->getSubVarByName("Left"); + break; + case 2: + varD = var->getSubVarByName("Up"); + break; + case 3: + varD = var->getSubVarByName("Down"); + break; + } + + if (!varD) + return false; + + for (int act = 0; act < 3; act++) { + int idx; + + switch(act) { + case 0: + idx = varD->getSubVarAsInt("Start"); + break; + case 1: + idx = varD->getSubVarAsInt("Go"); + break; + case 2: + idx = varD->getSubVarAsInt("Stop"); + break; + } + + item->_subItems[dir]._walk[act]._movementId = idx; + + Movement *mov = obj->getMovementById(idx); + + item->_subItems[dir]._walk[act]._mov = mov; + if (mov) { + mov->calcSomeXY(point, 0); + item->_subItems[dir]._walk[act]._mx = point.x; + item->_subItems[dir]._walk[act]._my = point.y; + } + } + + for (int act = 0; act < 4; act++) { + int idx; + + switch(act) { + case 0: + idx = varD->getSubVarAsInt("TurnR"); + break; + case 1: + idx = varD->getSubVarAsInt("TurnL"); + break; + case 2: + idx = varD->getSubVarAsInt("TurnU"); + break; + case 3: + idx = varD->getSubVarAsInt("TurnD"); + break; + } + + item->_subItems[dir]._turn[act]._movementId = idx; + + Movement *mov = obj->getMovementById(idx); + + item->_subItems[dir]._turn[act]._mov = mov; + if (mov) { + mov->calcSomeXY(point, 0); + item->_subItems[dir]._turn[act]._mx = point.x; + item->_subItems[dir]._turn[act]._my = point.y; + } + } + + for (int act = 0; act < 4; act++) { + int idx; + + switch(act) { + case 0: + idx = varD->getSubVarAsInt("TurnSR"); + break; + case 1: + idx = varD->getSubVarAsInt("TurnSL"); + break; + case 2: + idx = varD->getSubVarAsInt("TurnSU"); + break; + case 3: + idx = varD->getSubVarAsInt("TurnSD"); + break; + } + + item->_subItems[dir]._turnS[act]._movementId = idx; + + Movement *mov = obj->getMovementById(idx); + + item->_subItems[dir]._turnS[act]._mov = mov; + if (mov) { + mov->calcSomeXY(point, 0); + item->_subItems[dir]._turnS[act]._mx = point.x; + item->_subItems[dir]._turnS[act]._my = point.y; + } + } + + item->_subItems[dir]._staticsId1 = item->_subItems[dir]._walk[0]._mov->_staticsObj1->_staticsId; + item->_subItems[dir]._staticsId2 = item->_subItems[dir]._walk[0]._mov->_staticsObj2->_staticsId; + + } + return true; +} + +void MovGraph2::addObject(StaticANIObject *obj) { + MovGraph::addObject(obj); + + int id = getItemIndexByGameObjectId(obj->_id); + + if (id >= 0) { + _items[id]->_obj = obj; + } else { + MovGraph2Item *item = new MovGraph2Item; + + if (initDirections(obj, item)) { + _items.push_back(item); + } else { + delete item; + } + } +} + +int MovGraph2::removeObject(StaticANIObject *obj) { + warning("STUB: MovGraph2::removeObject()"); + + return 0; +} + +void MovGraph2::freeItems() { + warning("STUB: MovGraph2::freeItems()"); +} + +MessageQueue *MovGraph2::method34(StaticANIObject *subj, int xpos, int ypos, int flag, int staticsId) { + warning("STUB: MovGraph2::method34()"); + + return 0; +} + +MessageQueue *MovGraph2::method4C(StaticANIObject *subj, int xpos, int ypos, int flag, int staticsId) { + warning("STUB: MovGraph2::method4C()"); return 0; } @@ -185,7 +448,6 @@ MovGraphNode *MovGraph::calcOffset(int ox, int oy) { return 0; } - MovGraphLink::MovGraphLink() { _distance = 0; _angle = 0; diff --git a/engines/fullpipe/motion.h b/engines/fullpipe/motion.h index b0bfe92d1f..99d8d3eb79 100644 --- a/engines/fullpipe/motion.h +++ b/engines/fullpipe/motion.h @@ -42,7 +42,7 @@ public: virtual void method10() {} virtual void clearEnabled() { _isEnabled = false; } virtual void setEnabled() { _isEnabled = true; } - virtual int addObject(StaticANIObject *obj) { return 0; } + virtual void addObject(StaticANIObject *obj) {} virtual int removeObject(StaticANIObject *obj) { return 0; } virtual void freeItems() {} virtual int method28() { return 0; } @@ -57,12 +57,28 @@ public: virtual MessageQueue *method4C(StaticANIObject *subj, int xpos, int ypos, int flag, int staticsId) { return 0; } }; -class MctlCompoundArray : public Common::Array<CObject>, public CObject { +class MovGraphReact : public CObject { + // Empty +}; + +typedef Common::Array<CObject> MctlConnectionPointsArray; + +class MctlCompoundArrayItem : public CObject { + friend class MctlCompound; + + protected: + MotionController *_motionControllerObj; + MovGraphReact *_movGraphReactObj; + MctlConnectionPointsArray _connectionPoints; + int _field_20; + int _field_24; + int _field_28; + public: - virtual bool load(MfcArchive &file); + MctlCompoundArrayItem() : _movGraphReactObj(0) {} }; -class MctlConnectionPointsArray : public Common::Array<CObject>, public CObject { +class MctlCompoundArray : public Common::Array<MctlCompoundArrayItem *>, public CObject { public: virtual bool load(MfcArchive &file); }; @@ -75,7 +91,7 @@ class MctlCompound : public MotionController { virtual bool load(MfcArchive &file); - virtual int addObject(StaticANIObject *obj); + virtual void addObject(StaticANIObject *obj); virtual int removeObject(StaticANIObject *obj); virtual void freeItems(); virtual MessageQueue *method34(StaticANIObject *subj, int xpos, int ypos, int flag, int staticsId); @@ -85,10 +101,11 @@ class MctlCompound : public MotionController { }; class Unk2 : public CObject { +public: int _items; int _count; - public: +public: Unk2() : _items(0), _count(0) {} }; @@ -105,25 +122,6 @@ class MovGraphNode : public CObject { virtual bool load(MfcArchive &file); }; -class MovGraphReact : public CObject { - // Empty -}; - -class MctlCompoundArrayItem : public CObject { - friend class MctlCompound; - - protected: - MotionController *_motionControllerObj; - MovGraphReact *_movGraphReactObj; - MctlConnectionPointsArray _connectionPoints; - int _field_20; - int _field_24; - int _field_28; - - public: - MctlCompoundArrayItem() : _movGraphReactObj(0) {} -}; - class ReactParallel : public MovGraphReact { //CRgn _rgn; int _x1; @@ -186,13 +184,62 @@ class MovGraph : public MotionController { MovGraph(); virtual bool load(MfcArchive &file); - virtual int addObject(StaticANIObject *obj); + virtual void addObject(StaticANIObject *obj); + virtual int removeObject(StaticANIObject *obj); + virtual void freeItems(); + virtual int method28(); + virtual int method2C(); + virtual MessageQueue *method34(StaticANIObject *subj, int xpos, int ypos, int flag, int staticsId); + virtual int changeCallback(); + virtual int method3C(); + virtual int method44(); + virtual MessageQueue *method4C(StaticANIObject *subj, int xpos, int ypos, int flag, int staticsId); + virtual int method50(); double calcDistance(Common::Point *point, MovGraphLink *link, int flag); MovGraphNode *calcOffset(int ox, int oy); }; +class Movement; + +struct MG2I { + int _movementId; + Movement *_mov; + int _mx; + int _my; +}; + +struct MovGraph2ItemSub { + int _staticsId2; + int _staticsId1; + MG2I _walk[3]; + MG2I _turn[4]; + MG2I _turnS[4]; +}; + +struct MovGraph2Item { + int _objectId; + StaticANIObject *_obj; + MovGraph2ItemSub _subItems[4]; +}; + +class MovGraph2 : public MovGraph { +public: + Common::Array<MovGraph2Item *> _items; + +public: + virtual void addObject(StaticANIObject *obj); + virtual int removeObject(StaticANIObject *obj); + virtual void freeItems(); + virtual MessageQueue *method34(StaticANIObject *subj, int xpos, int ypos, int flag, int staticsId); + virtual MessageQueue *method4C(StaticANIObject *subj, int xpos, int ypos, int flag, int staticsId); + + int getItemIndexByGameObjectId(int objectId); + bool initDirections(StaticANIObject *obj, MovGraph2Item *item); +}; + class MctlConnectionPoint : public CObject { +public: int _connectionX; int _connectionY; int _field_C; diff --git a/engines/fullpipe/scenes.cpp b/engines/fullpipe/scenes.cpp index 7bc8f68fa5..9fb8a95f53 100644 --- a/engines/fullpipe/scenes.cpp +++ b/engines/fullpipe/scenes.cpp @@ -1348,7 +1348,7 @@ int MovGraph_messageHandler(ExCommand *cmd) { double sq = (ani->_oy - node->_y) * (ani->_oy - node->_y) + (ani->_ox - node->_x) * (ani->_ox - node->_x); int off = (node->_field_14 >> 16) & 0xFF; - double off2 = (link->_movGraphNode2->_field_14 >> 8) & 0xff - off; + double off2 = ((link->_movGraphNode2->_field_14 >> 8) & 0xff) - off; top = off + (int)(sqrt(sq) * off2 / link->_distance); } else { diff --git a/engines/fullpipe/statics.cpp b/engines/fullpipe/statics.cpp index e33eb1139e..0e9daadd45 100644 --- a/engines/fullpipe/statics.cpp +++ b/engines/fullpipe/statics.cpp @@ -1245,6 +1245,41 @@ Common::Point *Movement::getCurrDynamicPhaseXY(Common::Point &p) { return &p; } +Common::Point *Movement::calcSomeXY(Common::Point &p, int idx) { + int oldox = _ox; + int oldoy = _oy; + int oldidx = _currDynamicPhaseIndex; + + int x = 0; + int y = 0; + + if (!idx) { + Common::Point point; + + _staticsObj1->getSomeXY(point); + int y1 = _my - point.y; + int x1 = _mx - point.x; + + setDynamicPhaseIndex(0); + + x = _currDynamicPhase->_someX + x1; + y = _currDynamicPhase->_someY + y1; + } + + setOXY(x, y); + + while (_currDynamicPhaseIndex != idx) + gotoNextFrame(0, 0); + + p.x = _ox; + p.y = _oy; + + setDynamicPhaseIndex(oldidx); + setOXY(oldox, oldoy); + + return &p; +} + void Movement::setAlpha(int alpha) { if (_currMovement) for (uint i = 0; i < _currMovement->_dynamicPhases.size(); i++) { diff --git a/engines/fullpipe/statics.h b/engines/fullpipe/statics.h index 1767a5720e..2879edd8e1 100644 --- a/engines/fullpipe/statics.h +++ b/engines/fullpipe/statics.h @@ -140,6 +140,8 @@ class Movement : public GameObject { Common::Point *getCenter(Common::Point *p); Common::Point *getDimensionsOfPhase(Common::Point *p, int phaseIndex); + Common::Point *calcSomeXY(Common::Point &p, int idx); + void initStatics(StaticANIObject *ani); void updateCurrDynamicPhase(); diff --git a/engines/mohawk/cstime_game.cpp b/engines/mohawk/cstime_game.cpp index 2e21111025..91d2f895c0 100644 --- a/engines/mohawk/cstime_game.cpp +++ b/engines/mohawk/cstime_game.cpp @@ -1094,7 +1094,7 @@ void CSTimeScene::idleAmbientAnims() { bool CSTimeScene::eventIsActive() { return _vm->NISIsRunning() /* TODO || _vm->soundIsPlaying()*/ || _vm->getCurrentEventType() == kCSTimeEventWaitForClick - || _activeChar->_flappingState != 0xffff || _vm->getInterface()->getState() == 4; + || _activeChar->_flappingState != 0xffff || _vm->getInterface()->getState() == kCSTimeInterfaceDroppedInventory; } void CSTimeScene::cursorOverHotspot(uint id) { diff --git a/engines/mohawk/cstime_ui.cpp b/engines/mohawk/cstime_ui.cpp index de7d5bde80..6d5e5dd3ef 100644 --- a/engines/mohawk/cstime_ui.cpp +++ b/engines/mohawk/cstime_ui.cpp @@ -854,7 +854,7 @@ void CSTimeInterface::dropItemInInventory(uint16 id) { clearDialogArea(); _inventoryDisplay->show(); _inventoryDisplay->draw(); - _inventoryDisplay->setState(4); + _inventoryDisplay->setState(kCSTimeInterfaceDroppedInventory); } CSTimeHelp::CSTimeHelp(MohawkEngine_CSTime *vm) : _vm(vm) { diff --git a/engines/mohawk/cstime_ui.h b/engines/mohawk/cstime_ui.h index 27df7cac3e..3154d4b2ef 100644 --- a/engines/mohawk/cstime_ui.h +++ b/engines/mohawk/cstime_ui.h @@ -167,7 +167,8 @@ protected: enum CSTimeInterfaceState { kCSTimeInterfaceStateNormal = 1, kCSTimeInterfaceStateDragStart = 2, - kCSTimeInterfaceStateDragging = 3 + kCSTimeInterfaceStateDragging = 3, + kCSTimeInterfaceDroppedInventory = 4 }; class CSTimeInterface { diff --git a/engines/mortevielle/mouse.h b/engines/mortevielle/mouse.h index 1b9856e2c4..594031d816 100644 --- a/engines/mortevielle/mouse.h +++ b/engines/mortevielle/mouse.h @@ -37,7 +37,6 @@ class MouseHandler { private: MortevielleEngine *_vm; - int s_s[12][6]; int _counter; public: Common::Point _pos; diff --git a/engines/neverhood/blbarchive.cpp b/engines/neverhood/blbarchive.cpp index d730d75718..c743037e63 100644 --- a/engines/neverhood/blbarchive.cpp +++ b/engines/neverhood/blbarchive.cpp @@ -131,7 +131,8 @@ void BlbArchive::load(BlbArchiveEntry *entry, byte *buffer, uint32 size) { break; case 3: // DCL-compressed if (!Common::decompressDCL(&_fd, buffer, entry->diskSize, entry->size)) - error("BlbArchive::load() Error during decompression of %08X", entry->fileHash); + error("BlbArchive::load() Error during decompression of %08X (offset: %d, disk size: %d, size: %d)", + entry->fileHash, entry->offset, entry->diskSize, entry->size); break; default: error("BlbArchive::load() Unknown compression type %d", entry->comprType); diff --git a/engines/neverhood/console.cpp b/engines/neverhood/console.cpp index a2ceed8a2e..708c68746c 100644 --- a/engines/neverhood/console.cpp +++ b/engines/neverhood/console.cpp @@ -252,7 +252,7 @@ bool Console::Cmd_DumpResource(int argc, const char **argv) { if (!handle.isValid()) { DebugPrintf("Invalid resource hash\n"); } else { - _vm->_res->loadResource(handle); + _vm->_res->loadResource(handle, _vm->applyResourceFixes()); Common::DumpFile outFile; outFile.open(outFileName); outFile.write(handle.data(), handle.size()); diff --git a/engines/neverhood/detection.cpp b/engines/neverhood/detection.cpp index 3de087051a..96c87ab3ae 100644 --- a/engines/neverhood/detection.cpp +++ b/engines/neverhood/detection.cpp @@ -52,6 +52,10 @@ Common::Platform NeverhoodEngine::getPlatform() const { return _gameDescription->desc.platform; } +Common::Language NeverhoodEngine::getLanguage() const { + return _gameDescription->desc.language; +} + uint16 NeverhoodEngine::getVersion() const { return _gameDescription->version; } @@ -60,6 +64,10 @@ bool NeverhoodEngine::isDemo() const { return _gameDescription->desc.flags & ADGF_DEMO; } +bool NeverhoodEngine::applyResourceFixes() const { + return getLanguage() == Common::RU_RUS; +} + } static const PlainGameDescriptor neverhoodGames[] = { diff --git a/engines/neverhood/menumodule.cpp b/engines/neverhood/menumodule.cpp index 362f5270e3..5ad2dd69d7 100644 --- a/engines/neverhood/menumodule.cpp +++ b/engines/neverhood/menumodule.cpp @@ -574,6 +574,7 @@ TextEditWidget::TextEditWidget(NeverhoodEngine *vm, int16 x, int16 y, GameStateM _maxVisibleChars = (_rect.x2 - _rect.x1) / _fontSurface->getCharWidth(); _cursorPos = 0; + _textLabelWidget = NULL; SetUpdateHandler(&TextEditWidget::update); SetMessageHandler(&TextEditWidget::handleMessage); diff --git a/engines/neverhood/modules/module1000.cpp b/engines/neverhood/modules/module1000.cpp index 08fb88ad72..14ce5f4347 100644 --- a/engines/neverhood/modules/module1000.cpp +++ b/engines/neverhood/modules/module1000.cpp @@ -1012,7 +1012,7 @@ void AsScene1002VenusFlyTrap::swallowKlaymen() { } AsScene1002OutsideDoorBackground::AsScene1002OutsideDoorBackground(NeverhoodEngine *vm) - : AnimatedSprite(vm, 1200), _countdown(0) { + : AnimatedSprite(vm, 1200), _countdown(0), _isDoorClosed(true) { createSurface(850, 186, 212); _x = 320; diff --git a/engines/neverhood/modules/module1200.h b/engines/neverhood/modules/module1200.h index c97dc98986..e85273185e 100644 --- a/engines/neverhood/modules/module1200.h +++ b/engines/neverhood/modules/module1200.h @@ -155,8 +155,6 @@ protected: class SsScene1201Tnt : public StaticSprite { public: SsScene1201Tnt(NeverhoodEngine *vm, uint32 elemIndex, uint32 pointIndex, int16 clipY2); -protected: - uint32 _elemIndex; }; class Scene1201 : public Scene { diff --git a/engines/neverhood/modules/module1300.cpp b/engines/neverhood/modules/module1300.cpp index c8a561af76..0b883b217b 100644 --- a/engines/neverhood/modules/module1300.cpp +++ b/engines/neverhood/modules/module1300.cpp @@ -630,7 +630,7 @@ void AsScene1303Balloon::stPopBalloon() { } Scene1303::Scene1303(NeverhoodEngine *vm, Module *parentModule) - : Scene(vm, parentModule) { + : Scene(vm, parentModule), _asBalloon(NULL) { SetMessageHandler(&Scene1303::handleMessage); diff --git a/engines/neverhood/modules/module2800_sprites.cpp b/engines/neverhood/modules/module2800_sprites.cpp index 28e2657ee7..f7949b97c8 100644 --- a/engines/neverhood/modules/module2800_sprites.cpp +++ b/engines/neverhood/modules/module2800_sprites.cpp @@ -895,7 +895,7 @@ uint32 AsScene2809Spew::handleMessage(int messageNum, const MessageParam ¶m, } AsScene2810Rope::AsScene2810Rope(NeverhoodEngine *vm, Scene *parentScene, int16 x) - : AnimatedSprite(vm, 1100) { + : AnimatedSprite(vm, 1100), _parentScene(parentScene) { createSurface(990, 68, 476); SetUpdateHandler(&AnimatedSprite::update); diff --git a/engines/neverhood/neverhood.h b/engines/neverhood/neverhood.h index 9b65f6740e..0561aa251e 100644 --- a/engines/neverhood/neverhood.h +++ b/engines/neverhood/neverhood.h @@ -72,8 +72,10 @@ public: uint32 getFeatures() const; uint16 getVersion() const; Common::Platform getPlatform() const; + Common::Language getLanguage() const; bool hasFeature(EngineFeature f) const; bool isDemo() const; + bool applyResourceFixes() const; Common::String getTargetName() { return _targetName; }; Common::RandomSource *_rnd; diff --git a/engines/neverhood/palette.cpp b/engines/neverhood/palette.cpp index c381f46671..941bcc3cd3 100644 --- a/engines/neverhood/palette.cpp +++ b/engines/neverhood/palette.cpp @@ -66,6 +66,11 @@ void Palette::init() { _status = 0; _palette = new byte[1024]; _basePalette = new byte[1024]; + _palCounter = 0; + _fadeToR = 0; + _fadeToG = 0; + _fadeToB = 0; + _fadeStep = 0; } void Palette::usePalette() { diff --git a/engines/neverhood/resource.cpp b/engines/neverhood/resource.cpp index a1a517f251..b45dbff3b9 100644 --- a/engines/neverhood/resource.cpp +++ b/engines/neverhood/resource.cpp @@ -53,7 +53,7 @@ bool SpriteResource::load(uint32 fileHash, bool doLoadPosition) { unload(); _vm->_res->queryResource(fileHash, _resourceHandle); if (_resourceHandle.isValid() && _resourceHandle.type() == kResTypeBitmap) { - _vm->_res->loadResource(_resourceHandle); + _vm->_res->loadResource(_resourceHandle, _vm->applyResourceFixes()); const byte *spriteData = _resourceHandle.data(); NPoint *position = doLoadPosition ? &_position : NULL; parseBitmapResource(spriteData, &_rle, &_dimensions, position, NULL, &_pixels); @@ -83,7 +83,7 @@ bool PaletteResource::load(uint32 fileHash) { _vm->_res->queryResource(fileHash, _resourceHandle); if (_resourceHandle.isValid() && (_resourceHandle.type() == kResTypeBitmap || _resourceHandle.type() == kResTypePalette)) { - _vm->_res->loadResource(_resourceHandle); + _vm->_res->loadResource(_resourceHandle, _vm->applyResourceFixes()); _palette = _resourceHandle.data(); // Check if the palette is stored in a bitmap if (_resourceHandle.type() == kResTypeBitmap) @@ -144,7 +144,7 @@ bool AnimResource::load(uint32 fileHash) { uint16 frameListStartOfs, frameCount; uint32 spriteDataOfs, paletteDataOfs; - _vm->_res->loadResource(_resourceHandle); + _vm->_res->loadResource(_resourceHandle, _vm->applyResourceFixes()); resourceData = _resourceHandle.data(); animListCount = READ_LE_UINT16(resourceData); @@ -323,7 +323,7 @@ void TextResource::load(uint32 fileHash) { unload(); _vm->_res->queryResource(fileHash, _resourceHandle); if (_resourceHandle.isValid() && _resourceHandle.type() == kResTypeText) { - _vm->_res->loadResource(_resourceHandle); + _vm->_res->loadResource(_resourceHandle, _vm->applyResourceFixes()); _textData = _resourceHandle.data(); _count = READ_LE_UINT32(_textData); } @@ -359,7 +359,7 @@ void DataResource::load(uint32 fileHash) { unload(); _vm->_res->queryResource(fileHash, _resourceHandle); if (_resourceHandle.isValid() && _resourceHandle.type() == kResTypeData) { - _vm->_res->loadResource(_resourceHandle); + _vm->_res->loadResource(_resourceHandle, _vm->applyResourceFixes()); data = _resourceHandle.data(); dataSize = _resourceHandle.size(); } diff --git a/engines/neverhood/resourceman.cpp b/engines/neverhood/resourceman.cpp index 37089a5bd6..518755a846 100644 --- a/engines/neverhood/resourceman.cpp +++ b/engines/neverhood/resourceman.cpp @@ -85,7 +85,25 @@ void ResourceMan::queryResource(uint32 fileHash, ResourceHandle &resourceHandle) resourceHandle._extData = firstEntry ? firstEntry->archiveEntry->extData : NULL; } -void ResourceMan::loadResource(ResourceHandle &resourceHandle) { +struct EntrySizeFix { + uint32 fileHash; + uint32 offset; + uint32 diskSize; + uint32 size; + uint32 fixedSize; +}; + +static const EntrySizeFix entrySizeFixes[] = { + // fileHash offset diskSize size fixedSize + // Fixes for the Russian "Dyadyushka Risech" version + // TODO + // Fixes for the Russian "Fargus" version + // TODO + // + { 0, 0, 0, 0, 0 } +}; + +void ResourceMan::loadResource(ResourceHandle &resourceHandle, bool applyResourceFixes) { resourceHandle._data = NULL; if (resourceHandle.isValid()) { const uint32 fileHash = resourceHandle.fileHash(); @@ -97,8 +115,19 @@ void ResourceMan::loadResource(ResourceHandle &resourceHandle) { if (resourceData->data != NULL) { resourceData->dataRefCount++; } else { - resourceData->data = new byte[resourceHandle._resourceFileEntry->archiveEntry->size]; - resourceHandle._resourceFileEntry->archive->load(resourceHandle._resourceFileEntry->archiveEntry, resourceData->data, 0); + BlbArchiveEntry *entry = resourceHandle._resourceFileEntry->archiveEntry; + + // Apply fixes for broken resources in Russian versions + if (applyResourceFixes) { + for (const EntrySizeFix *cur = entrySizeFixes; cur->fileHash > 0; ++cur) { + if (entry->fileHash == cur->fileHash && entry->offset == cur->offset && + entry->diskSize == cur->diskSize && entry->size == cur->size) + entry->size = cur->fixedSize; + } + } + + resourceData->data = new byte[entry->size]; + resourceHandle._resourceFileEntry->archive->load(entry, resourceData->data, 0); resourceData->dataRefCount = 1; } resourceHandle._data = resourceData->data; diff --git a/engines/neverhood/resourceman.h b/engines/neverhood/resourceman.h index 5a3697fe0d..29bf40a6b8 100644 --- a/engines/neverhood/resourceman.h +++ b/engines/neverhood/resourceman.h @@ -78,7 +78,7 @@ public: const ResourceFileEntry& getEntry(uint index) { return _entries[index]; } uint getEntryCount() { return _entries.size(); } void queryResource(uint32 fileHash, ResourceHandle &resourceHandle); - void loadResource(ResourceHandle &resourceHandle); + void loadResource(ResourceHandle &resourceHandle, bool applyResourceFixes); void unloadResource(ResourceHandle &resourceHandle); void purgeResources(); protected: diff --git a/engines/neverhood/scene.cpp b/engines/neverhood/scene.cpp index 0b2e9c6b75..9a7e87ac8d 100644 --- a/engines/neverhood/scene.cpp +++ b/engines/neverhood/scene.cpp @@ -50,6 +50,9 @@ Scene::Scene(NeverhoodEngine *vm, Module *parentModule) _smackerPlayer = NULL; _isMessageListBusy = false; _messageValue = -1; + _messageListStatus = 0; + _messageListCount = 0; + _messageListIndex = 0; _backgroundFileHash = _cursorFileHash = 0; diff --git a/engines/neverhood/scene.h b/engines/neverhood/scene.h index f60e291395..e6183199ce 100644 --- a/engines/neverhood/scene.h +++ b/engines/neverhood/scene.h @@ -204,8 +204,6 @@ protected: // Used for debugging uint32 _backgroundFileHash, _cursorFileHash; // for StaticScene and all Scene* classes - void (Entity::*_savedUpdateHandlerCb)(); - uint32 (Entity::*_savedMessageHandlerCb)(int messageNum, const MessageParam ¶m, Entity *sender); int _messageValue; uint32 handleMessage(int messageNum, const MessageParam ¶m, Entity *sender); bool queryPositionSprite(int16 mouseX, int16 mouseY); diff --git a/engines/neverhood/screen.cpp b/engines/neverhood/screen.cpp index 4c8dd9add0..901ab73b39 100644 --- a/engines/neverhood/screen.cpp +++ b/engines/neverhood/screen.cpp @@ -27,7 +27,8 @@ namespace Neverhood { Screen::Screen(NeverhoodEngine *vm) : _vm(vm), _paletteData(NULL), _paletteChanged(false), _smackerDecoder(NULL), - _yOffset(0), _fullRefresh(false) { + _yOffset(0), _fullRefresh(false), _frameDelay(0), _savedSmackerDecoder(NULL), + _savedFrameDelay(0), _savedYOffset(0) { _ticks = _vm->_system->getMillis(); diff --git a/engines/neverhood/sound.cpp b/engines/neverhood/sound.cpp index 1fd09674a2..3ea45491a7 100644 --- a/engines/neverhood/sound.cpp +++ b/engines/neverhood/sound.cpp @@ -250,7 +250,9 @@ void SoundItem::update() { // SoundMan SoundMan::SoundMan(NeverhoodEngine *vm) - : _vm(vm), _soundIndex1(-1), _soundIndex2(-1), _soundIndex3(-1) { + : _vm(vm), _soundIndex1(-1), _soundIndex2(-1), _soundIndex3(-1), + _initialCountdown(0), _playOnceAfterCountdown(false), + _initialCountdown3(0), _playOnceAfterCountdown3(false) { } SoundMan::~SoundMan() { @@ -577,7 +579,7 @@ AudioResourceManSoundItem::AudioResourceManSoundItem(NeverhoodEngine *vm, uint32 void AudioResourceManSoundItem::loadSound() { if (!_data && _resourceHandle.isValid() && (_resourceHandle.type() == kResTypeSound || _resourceHandle.type() == kResTypeMusic)) { - _vm->_res->loadResource(_resourceHandle); + _vm->_res->loadResource(_resourceHandle, _vm->applyResourceFixes()); _data = _resourceHandle.data(); } } @@ -627,7 +629,8 @@ bool AudioResourceManSoundItem::isPlaying() { AudioResourceManMusicItem::AudioResourceManMusicItem(NeverhoodEngine *vm, uint32 fileHash) : _vm(vm), _fileHash(fileHash), _terminate(false), _canRestart(false), - _volume(100), _panning(50), _start(false), _isFadingIn(false), _isFadingOut(false), _isPlaying(false) { + _volume(100), _panning(50), _start(false), _isFadingIn(false), _isFadingOut(false), _isPlaying(false), + _fadeVolume(0), _fadeVolumeStep(0) { } diff --git a/engines/neverhood/sprite.cpp b/engines/neverhood/sprite.cpp index 3c158ff7e3..1a432461fb 100644 --- a/engines/neverhood/sprite.cpp +++ b/engines/neverhood/sprite.cpp @@ -211,6 +211,12 @@ void AnimatedSprite::init() { _replNewColor = 0; _animResource.setReplEnabled(false); _playBackwards = false; + _currAnimFileHash = 0; + _lastFrameIndex = 0; + _plLastFrameIndex = 0; + _plFirstFrameHash = 0; + _plLastFrameHash = 0; + _animStatus = 0; } void AnimatedSprite::update() { diff --git a/engines/sci/engine/script_patches.cpp b/engines/sci/engine/script_patches.cpp index abb7351d97..d2c3356d54 100644 --- a/engines/sci/engine/script_patches.cpp +++ b/engines/sci/engine/script_patches.cpp @@ -1467,6 +1467,32 @@ const SciScriptSignature sq4Signatures[] = { SCI_SIGNATUREENTRY_TERMINATOR }; +// =========================================================================== +// When you leave Ulence Flats, another timepod is supposed to appear. +// On fast machines, that timepod appears fully immediately and then +// starts to appear like it should be. That first appearance is caused +// by the scripts setting an invalid cel number and the machine being +// so fast that there is no time for another script to actually fix +// the cel number. On slower machines, the cel number gets fixed +// by the cycler and that's why only fast machines are affected. +// The same issue happens in Sierra SCI. +// We simply set the correct starting cel number to fix the bug. +// Responsible method: robotIntoShip::changeState(9) +const byte sq1vgaSignatureUlenceFlatsTimepodGfxGlitch[] = { + 8, + 0x39, 0x07, // pushi 07 (ship::cel) + 0x78, // push1 + 0x39, 0x0a, // pushi 0x0a (set ship::cel to 10) + 0x38, 0xa0, 0x00, // pushi 0x00a0 (ship::setLoop) + 0 +}; + +const uint16 sq1vgaPatchUlenceFlatsTimepodGfxGlitch[] = { + PATCH_ADDTOOFFSET | +3, + 0x39, 0x09, // pushi 0x09 (set ship::cel to 9) + PATCH_END +}; + const byte sq1vgaSignatureEgoShowsCard[] = { 25, 0x38, 0x46, 0x02, // push 0x246 (set up send frame to set timesShownID) @@ -1484,7 +1510,8 @@ const byte sq1vgaSignatureEgoShowsCard[] = { 0x36, // push (wrong, acc clobbered by class, above) 0x35, 0x03, // ldi 0x03 0x22, // lt? - 0}; + 0 +}; // Note that this script patch is merely a reordering of the // instructions in the original script. @@ -1504,13 +1531,14 @@ const uint16 sq1vgaPatchEgoShowsCard[] = { 0x4a, 0x06, // send 0x06 (set timesShownID) 0x35, 0x03, // ldi 0x03 0x22, // lt? - PATCH_END}; + PATCH_END +}; // script, description, magic DWORD, adjust const SciScriptSignature sq1vgaSignatures[] = { - { 58, "Sarien armory droid zapping ego first time", 1, PATCH_MAGICDWORD( 0x72, 0x88, 0x15, 0x36 ), -70, - sq1vgaSignatureEgoShowsCard, sq1vgaPatchEgoShowsCard }, + { 45, "Ulence Flats: timepod graphic glitch", 1, PATCH_MAGICDWORD( 0x07, 0x78, 0x39, 0x0a ), -1, sq1vgaSignatureUlenceFlatsTimepodGfxGlitch, sq1vgaPatchUlenceFlatsTimepodGfxGlitch }, + { 58, "Sarien armory droid zapping ego first time", 1, PATCH_MAGICDWORD( 0x72, 0x88, 0x15, 0x36 ), -70, sq1vgaSignatureEgoShowsCard, sq1vgaPatchEgoShowsCard }, SCI_SIGNATUREENTRY_TERMINATOR}; diff --git a/engines/scumm/scumm-md5.h b/engines/scumm/scumm-md5.h index 979573c5f5..ae80f306af 100644 --- a/engines/scumm/scumm-md5.h +++ b/engines/scumm/scumm-md5.h @@ -1,5 +1,5 @@ /* - This file was generated by the md5table tool on Thu Aug 15 12:47:39 2013 + This file was generated by the md5table tool on Fri Sep 27 05:44:12 2013 DO NOT EDIT MANUALLY! */ @@ -121,6 +121,7 @@ static const MD5Table md5table[] = { { "2723fea3dae0cb47768c424b145ae0e7", "tentacle", "Floppy", "Floppy", 7932, Common::EN_ANY, Common::kPlatformDOS }, { "27b2ef1653089fe5b897d9cc89ce784f", "balloon", "HE 80", "", -1, Common::RU_RUS, Common::kPlatformWindows }, { "27b3a4224ad63d5b04627595c1c1a025", "zak", "V2", "V2", -1, Common::IT_ITA, Common::kPlatformAmiga }, + { "288fb75b24389733c29fa107fe8d44e8", "catalog", "HE CUP", "Preview", 10795148, Common::EN_USA, Common::kPlatformUnknown }, { "28d24a33448fab6795850bc9f159a4a2", "atlantis", "FM-TOWNS", "Demo", 11170, Common::JA_JPN, Common::kPlatformFMTowns }, { "28ef68ee3ed76d7e2ee8ee13c15fbd5b", "loom", "EGA", "EGA", 5748, Common::EN_ANY, Common::kPlatformDOS }, { "28f07458f1b6c24e118a1ea056827701", "lost", "HE 99", "", -1, Common::NL_NLD, Common::kPlatformUnknown }, diff --git a/engines/sword25/gfx/animation.cpp b/engines/sword25/gfx/animation.cpp index 1660c393c0..37207c967b 100644 --- a/engines/sword25/gfx/animation.cpp +++ b/engines/sword25/gfx/animation.cpp @@ -553,15 +553,15 @@ bool Animation::persist(OutputPersistenceBlock &writer) { writer.write(_currentFrameTime); writer.write(_running); writer.write(_finished); - writer.write(static_cast<uint>(_direction)); + writer.write(static_cast<uint32>(_direction)); // Je nach Animationstyp entweder das Template oder die Ressource speichern. if (_animationResourcePtr) { - uint marker = 0; + uint32 marker = 0; writer.write(marker); writer.writeString(_animationResourcePtr->getFileName()); } else if (_animationTemplateHandle) { - uint marker = 1; + uint32 marker = 1; writer.write(marker); writer.write(_animationTemplateHandle); } else { @@ -574,13 +574,13 @@ bool Animation::persist(OutputPersistenceBlock &writer) { // The following is only there to for compatibility with older saves // resp. the original engine. - writer.write((uint)1); + writer.write((uint32)1); writer.writeString("LuaLoopPointCB"); writer.write(getHandle()); - writer.write((uint)1); + writer.write((uint32)1); writer.writeString("LuaActionCB"); writer.write(getHandle()); - writer.write((uint)1); + writer.write((uint32)1); writer.writeString("LuaDeleteCB"); writer.write(getHandle()); @@ -605,12 +605,12 @@ bool Animation::unpersist(InputPersistenceBlock &reader) { reader.read(_currentFrameTime); reader.read(_running); reader.read(_finished); - uint direction; + uint32 direction; reader.read(direction); _direction = static_cast<Direction>(direction); // Animationstyp einlesen. - uint marker; + uint32 marker; reader.read(marker); if (marker == 0) { Common::String resourceFilename; @@ -629,9 +629,9 @@ bool Animation::unpersist(InputPersistenceBlock &reader) { // The following is only there to for compatibility with older saves // resp. the original engine. - uint callbackCount; + uint32 callbackCount; Common::String callbackFunctionName; - uint callbackData; + uint32 callbackData; // loop point callback reader.read(callbackCount); diff --git a/engines/sword25/gfx/animation.h b/engines/sword25/gfx/animation.h index 44255e3b64..ced1995ae9 100644 --- a/engines/sword25/gfx/animation.h +++ b/engines/sword25/gfx/animation.h @@ -159,18 +159,18 @@ private: BACKWARD }; - int _relX; - int _relY; + int32 _relX; + int32 _relY; float _scaleFactorX; float _scaleFactorY; - uint _modulationColor; - uint _currentFrame; - int _currentFrameTime; + uint32 _modulationColor; + uint32 _currentFrame; + int32 _currentFrameTime; bool _running; bool _finished; Direction _direction; AnimationResource *_animationResourcePtr; - uint _animationTemplateHandle; + uint32 _animationTemplateHandle; bool _framesLocked; ANIMATION_CALLBACK _loopPointCallback; diff --git a/engines/sword25/gfx/animationdescription.cpp b/engines/sword25/gfx/animationdescription.cpp index da0a660df9..164206bbc2 100644 --- a/engines/sword25/gfx/animationdescription.cpp +++ b/engines/sword25/gfx/animationdescription.cpp @@ -36,7 +36,7 @@ namespace Sword25 { bool AnimationDescription::persist(OutputPersistenceBlock &writer) { - writer.write(static_cast<uint>(_animationType)); + writer.write(static_cast<uint32>(_animationType)); writer.write(_FPS); writer.write(_millisPerFrame); writer.write(_scalingAllowed); @@ -47,7 +47,7 @@ bool AnimationDescription::persist(OutputPersistenceBlock &writer) { } bool AnimationDescription::unpersist(InputPersistenceBlock &reader) { - uint animationType; + uint32 animationType; reader.read(animationType); _animationType = static_cast<Animation::ANIMATION_TYPES>(animationType); reader.read(_FPS); diff --git a/engines/sword25/gfx/animationdescription.h b/engines/sword25/gfx/animationdescription.h index 3b11686bb9..009d83dcc7 100644 --- a/engines/sword25/gfx/animationdescription.h +++ b/engines/sword25/gfx/animationdescription.h @@ -52,8 +52,8 @@ protected: public: struct Frame { // Die Hotspot-Angabe bezieht sich auf das ungeflippte Bild!! - int hotspotX; - int hotspotY; + int32 hotspotX; + int32 hotspotY; bool flipV; bool flipH; Common::String fileName; @@ -88,8 +88,8 @@ public: protected: Animation::ANIMATION_TYPES _animationType; - int _FPS; - int _millisPerFrame; + int32 _FPS; + int32 _millisPerFrame; bool _scalingAllowed; bool _alphaAllowed; bool _colorModulationAllowed; diff --git a/engines/sword25/gfx/animationresource.cpp b/engines/sword25/gfx/animationresource.cpp index 621e20ad8c..8c09a545a0 100644 --- a/engines/sword25/gfx/animationresource.cpp +++ b/engines/sword25/gfx/animationresource.cpp @@ -188,7 +188,7 @@ bool AnimationResource::parserCallback_frame(ParserNode *node) { Common::String flipHString = node->values["fliph"]; if (!flipHString.empty()) { - if (!parseBooleanKey(flipVString, frame.flipV)) { + if (!parseBooleanKey(flipHString, frame.flipH)) { warning("Illegal fliph value (\"%s\") in <frame> tag in \"%s\". Assuming default (\"false\").", flipHString.c_str(), getFileName().c_str()); frame.flipH = false; diff --git a/engines/sword25/gfx/animationtemplate.cpp b/engines/sword25/gfx/animationtemplate.cpp index 19924302b9..a1d2bf5d1a 100644 --- a/engines/sword25/gfx/animationtemplate.cpp +++ b/engines/sword25/gfx/animationtemplate.cpp @@ -181,7 +181,7 @@ bool AnimationTemplate::persist(OutputPersistenceBlock &writer) { Result &= AnimationDescription::persist(writer); // Frameanzahl schreiben. - writer.write(_frames.size()); + writer.write((uint32)_frames.size()); // Frames einzeln persistieren. Common::Array<const Frame>::const_iterator Iter = _frames.begin(); @@ -209,7 +209,7 @@ bool AnimationTemplate::unpersist(InputPersistenceBlock &reader) { result &= AnimationDescription::unpersist(reader); // Frameanzahl lesen. - uint frameCount; + uint32 frameCount; reader.read(frameCount); // Frames einzeln wieder herstellen. diff --git a/engines/sword25/gfx/animationtemplateregistry.cpp b/engines/sword25/gfx/animationtemplateregistry.cpp index 8184b49eba..4cefe24b18 100644 --- a/engines/sword25/gfx/animationtemplateregistry.cpp +++ b/engines/sword25/gfx/animationtemplateregistry.cpp @@ -47,7 +47,7 @@ bool AnimationTemplateRegistry::persist(OutputPersistenceBlock &writer) { writer.write(_nextHandle); // Anzahl an BS_AnimationTemplates schreiben. - writer.write(_handle2PtrMap.size()); + writer.write((uint32)_handle2PtrMap.size()); // Alle BS_AnimationTemplates persistieren. HANDLE2PTR_MAP::const_iterator iter = _handle2PtrMap.begin(); @@ -77,13 +77,13 @@ bool AnimationTemplateRegistry::unpersist(InputPersistenceBlock &reader) { delete _handle2PtrMap.begin()->_value; // Anzahl an BS_AnimationTemplates einlesen. - uint animationTemplateCount; + uint32 animationTemplateCount; reader.read(animationTemplateCount); // Alle gespeicherten BS_AnimationTemplates wieder herstellen. for (uint i = 0; i < animationTemplateCount; ++i) { // Handle lesen. - uint handle; + uint32 handle; reader.read(handle); // BS_AnimationTemplate wieder herstellen. diff --git a/engines/sword25/gfx/bitmap.h b/engines/sword25/gfx/bitmap.h index caa1238558..f22c5d7fc9 100644 --- a/engines/sword25/gfx/bitmap.h +++ b/engines/sword25/gfx/bitmap.h @@ -176,9 +176,9 @@ protected: bool _flipV; float _scaleFactorX; float _scaleFactorY; - uint _modulationColor; - int _originalWidth; - int _originalHeight; + uint32 _modulationColor; + int32 _originalWidth; + int32 _originalHeight; }; } // End of namespace Sword25 diff --git a/engines/sword25/gfx/image/renderedimage.cpp b/engines/sword25/gfx/image/renderedimage.cpp index 346b46f3b4..b359fc6a3e 100644 --- a/engines/sword25/gfx/image/renderedimage.cpp +++ b/engines/sword25/gfx/image/renderedimage.cpp @@ -240,14 +240,6 @@ bool RenderedImage::blit(int posX, int posY, int flipping, Common::Rect *pPartRe int cg = (color >> 8) & 0xff; int cb = (color >> 0) & 0xff; - // Compensate for transparency. Since we're coming - // down to 255 alpha, we just compensate for the colors here - if (ca != 255) { - cr = cr * ca >> 8; - cg = cg * ca >> 8; - cb = cb * ca >> 8; - } - // Create an encapsulating surface for the data Graphics::Surface srcImage; // TODO: Is the data really in the screen format? @@ -400,52 +392,52 @@ bool RenderedImage::blit(int posX, int posY, int flipping, Common::Rect *pPartRe } else { #if defined(SCUMM_LITTLE_ENDIAN) pix = *(uint32 *)out; - int outb = (pix >> 0) & 0xff; - int outg = (pix >> 8) & 0xff; - int outr = (pix >> 16) & 0xff; + int outb = ((pix >> 0) & 0xff) * (255 - a); + int outg = ((pix >> 8) & 0xff) * (255 - a); + int outr = ((pix >> 16) & 0xff) * (255 - a); if (cb == 0) - outb = 0; + outb = outb >> 8; else if (cb != 255) - outb += ((b - outb) * a * cb) >> 16; + outb = ((outb << 8) + b * a * cb) >> 16; else - outb += ((b - outb) * a) >> 8; + outb = (outb + b * a) >> 8; if (cg == 0) - outg = 0; + outg = outg >> 8; else if (cg != 255) - outg += ((g - outg) * a * cg) >> 16; + outg = ((outg << 8) + g * a * cg) >> 16; else - outg += ((g - outg) * a) >> 8; + outg = (outg + g * a) >> 8; if (cr == 0) - outr = 0; + outr = outr >> 8; else if (cr != 255) - outr += ((r - outr) * a * cr) >> 16; + outr = ((outr << 8) + r * a * cr) >> 16; else - outr += ((r - outr) * a) >> 8; + outr = (outr + r * a) >> 8; *(uint32 *)out = (255 << 24) | (outr << 16) | (outg << 8) | outb; out += 4; #else *out = 255; out++; if (cr == 0) - *out = 0; + *out = (*out * (255-a)) >> 8; else if (cr != 255) - *out += ((r - *out) * a * cr) >> 16; + *out = (((*out * (255-a)) << 8) + r * a * cr) >> 16; else - *out += ((r - *out) * a) >> 8; + *out = ((*out * (255-a)) + r * a) >> 8; out++; if (cg == 0) - *out = 0; + *out = (*out * (255-a)) >> 8; else if (cg != 255) - *out += ((g - *out) * a * cg) >> 16; + *out = (((*out * (255-a)) << 8) + g * a * cg) >> 16; else - *out += ((g - *out) * a) >> 8; + *out = ((*out * (255-a)) + g * a) >> 8; out++; if (cb == 0) - *out = 0; + *out = (*out * (255-a)) >> 8; else if (cb != 255) - *out += ((b - *out) * a * cb) >> 16; + *out = (((*out * (255-a)) << 8) + b * a * cb) >> 16; else - *out += ((b - *out) * a) >> 8; + *out = ((*out * (255-a)) + b * a) >> 8; out++; #endif } diff --git a/engines/sword25/gfx/panel.cpp b/engines/sword25/gfx/panel.cpp index b9bb8b087d..9b7fe82914 100644 --- a/engines/sword25/gfx/panel.cpp +++ b/engines/sword25/gfx/panel.cpp @@ -104,7 +104,7 @@ bool Panel::unpersist(InputPersistenceBlock &reader) { result &= RenderObject::unpersist(reader); - uint color; + uint32 color; reader.read(color); setColor(color); diff --git a/engines/sword25/gfx/panel.h b/engines/sword25/gfx/panel.h index 74a93247b6..d372b4e0fc 100644 --- a/engines/sword25/gfx/panel.h +++ b/engines/sword25/gfx/panel.h @@ -64,7 +64,7 @@ protected: virtual bool doRender(RectangleList *updateRects); private: - uint _color; + uint32 _color; }; } // End of namespace Sword25 diff --git a/engines/sword25/gfx/renderobject.cpp b/engines/sword25/gfx/renderobject.cpp index 1dd6f4590f..e9e11aae4e 100644 --- a/engines/sword25/gfx/renderobject.cpp +++ b/engines/sword25/gfx/renderobject.cpp @@ -219,27 +219,27 @@ Common::Rect RenderObject::calcBoundingBox() const { return bbox; } -void RenderObject::calcAbsolutePos(int &x, int &y, int &z) const { +void RenderObject::calcAbsolutePos(int32 &x, int32 &y, int32 &z) const { x = calcAbsoluteX(); y = calcAbsoluteY(); z = calcAbsoluteZ(); } -int RenderObject::calcAbsoluteX() const { +int32 RenderObject::calcAbsoluteX() const { if (_parentPtr.isValid()) return _parentPtr->getAbsoluteX() + _x; else return _x; } -int RenderObject::calcAbsoluteY() const { +int32 RenderObject::calcAbsoluteY() const { if (_parentPtr.isValid()) return _parentPtr->getAbsoluteY() + _y; else return _y; } -int RenderObject::calcAbsoluteZ() const { +int32 RenderObject::calcAbsoluteZ() const { if (_parentPtr.isValid()) return _parentPtr->getAbsoluteZ() + _z; else @@ -399,7 +399,7 @@ RenderObjectPtr<Text> RenderObject::addText(const Common::String &font, const Co bool RenderObject::persist(OutputPersistenceBlock &writer) { // Typ und Handle werden als erstes gespeichert, damit beim Laden ein Objekt vom richtigen Typ mit dem richtigen Handle erzeugt werden kann. - writer.write(static_cast<uint>(_type)); + writer.write(static_cast<uint32>(_type)); writer.write(_handle); // Restliche Objekteigenschaften speichern. @@ -413,14 +413,14 @@ bool RenderObject::persist(OutputPersistenceBlock &writer) { writer.write(_visible); writer.write(_childChanged); writer.write(_initSuccess); - writer.write(_bbox.left); - writer.write(_bbox.top); - writer.write(_bbox.right); - writer.write(_bbox.bottom); - writer.write(_oldBbox.left); - writer.write(_oldBbox.top); - writer.write(_oldBbox.right); - writer.write(_oldBbox.bottom); + writer.write((int32)_bbox.left); + writer.write((int32)_bbox.top); + writer.write((int32)_bbox.right); + writer.write((int32)_bbox.bottom); + writer.write((int32)_oldBbox.left); + writer.write((int32)_oldBbox.top); + writer.write((int32)_oldBbox.right); + writer.write((int32)_oldBbox.bottom); writer.write(_oldX); writer.write(_oldY); writer.write(_oldZ); @@ -455,7 +455,7 @@ bool RenderObject::unpersist(InputPersistenceBlock &reader) { reader.read(_oldY); reader.read(_oldZ); reader.read(_oldVisible); - uint parentHandle; + uint32 parentHandle; reader.read(parentHandle); _parentPtr = RenderObjectPtr<RenderObject>(parentHandle); reader.read(_refreshForced); @@ -470,7 +470,7 @@ bool RenderObject::persistChildren(OutputPersistenceBlock &writer) { bool result = true; // Kinderanzahl speichern. - writer.write(_children.size()); + writer.write((uint32)_children.size()); // Rekursiv alle Kinder speichern. RENDEROBJECT_LIST::iterator it = _children.begin(); @@ -486,13 +486,13 @@ bool RenderObject::unpersistChildren(InputPersistenceBlock &reader) { bool result = true; // Kinderanzahl einlesen. - uint childrenCount; + uint32 childrenCount; reader.read(childrenCount); if (!reader.isGood()) return false; // Alle Kinder rekursiv wieder herstellen. - for (uint i = 0; i < childrenCount; ++i) { + for (uint32 i = 0; i < childrenCount; ++i) { if (!recreatePersistedRenderObject(reader).isValid()) return false; } @@ -504,8 +504,8 @@ RenderObjectPtr<RenderObject> RenderObject::recreatePersistedRenderObject(InputP RenderObjectPtr<RenderObject> result; // Typ und Handle auslesen. - uint type; - uint handle; + uint32 type; + uint32 handle; reader.read(type); reader.read(handle); if (!reader.isGood()) diff --git a/engines/sword25/gfx/renderobject.h b/engines/sword25/gfx/renderobject.h index 1116c3284c..7fcd3a87a3 100644 --- a/engines/sword25/gfx/renderobject.h +++ b/engines/sword25/gfx/renderobject.h @@ -359,7 +359,7 @@ public: /** @brief Gibt das Handle des Objekte zurück. */ - uint getHandle() const { + uint32 getHandle() const { return _handle; } @@ -388,14 +388,14 @@ protected: typedef Common::List<RenderObjectPtr<RenderObject> > RENDEROBJECT_LIST; typedef Common::List<RenderObjectPtr<RenderObject> >::iterator RENDEROBJECT_ITER; - int _x; ///< Die X-Position des Objektes relativ zum Eltern-Objekt - int _y; ///< Die Y-Position des Objektes relativ zum Eltern-Objekt - int _z; ///< Der Z-Wert des Objektes relativ zum Eltern-Objekt - int _absoluteX; ///< Die absolute X-Position des Objektes - int _absoluteY; ///< Die absolute Y-Position des Objektes - int _absoluteZ; - int _width; ///< Die Breite des Objektes - int _height; ///< Die Höhe des Objektes + int32 _x; ///< Die X-Position des Objektes relativ zum Eltern-Objekt + int32 _y; ///< Die Y-Position des Objektes relativ zum Eltern-Objekt + int32 _z; ///< Der Z-Wert des Objektes relativ zum Eltern-Objekt + int32 _absoluteX; ///< Die absolute X-Position des Objektes + int32 _absoluteY; ///< Die absolute Y-Position des Objektes + int32 _absoluteZ; + int32 _width; ///< Die Breite des Objektes + int32 _height; ///< Die Höhe des Objektes bool _visible; ///< Ist true, wenn das Objekt sichtbar ist bool _childChanged; ///< Ist true, wenn sich ein Kinderobjekt verändert hat TYPES _type; ///< Der Objekttyp @@ -404,14 +404,14 @@ protected: // Kopien der Variablen, die für die Errechnung des Dirty-Rects und zur Bestimmung der Objektveränderung notwendig sind Common::Rect _oldBbox; - int _oldX; - int _oldY; - int _oldZ; + int32 _oldX; + int32 _oldY; + int32 _oldZ; bool _oldVisible; static int _nextGlobalVersion; - int _version; + int32 _version; // This should be set to true if the RenderObject is NOT alpha-blended to optimize drawing bool _isSolid; @@ -475,7 +475,7 @@ private: /// Ist true, wenn das Objekt in nächsten Frame neu gezeichnet werden soll bool _refreshForced; - uint _handle; + uint32 _handle; /** @brief Entfernt ein Objekt aus der Kinderliste. @@ -500,17 +500,17 @@ private: /** @brief Berechnet die absolute Position des Objektes. */ - void calcAbsolutePos(int &x, int &y, int &z) const; + void calcAbsolutePos(int32 &x, int32 &y, int32 &z) const; /** @brief Berechnet die absolute Position des Objektes auf der X-Achse. */ - int calcAbsoluteX() const; + int32 calcAbsoluteX() const; /** @brief Berechnet die absolute Position des Objektes. */ - int calcAbsoluteY() const; + int32 calcAbsoluteY() const; - int calcAbsoluteZ() const; + int32 calcAbsoluteZ() const; /** @brief Sortiert alle Kinderobjekte nach ihrem Renderang. diff --git a/engines/sword25/gfx/renderobjectmanager.cpp b/engines/sword25/gfx/renderobjectmanager.cpp index 77f944c9e0..57c8ec318f 100644 --- a/engines/sword25/gfx/renderobjectmanager.cpp +++ b/engines/sword25/gfx/renderobjectmanager.cpp @@ -171,7 +171,7 @@ bool RenderObjectManager::persist(OutputPersistenceBlock &writer) { writer.write(_frameStarted); // Referenzen auf die TimedRenderObjects persistieren. - writer.write(_timedRenderObjects.size()); + writer.write((uint32)_timedRenderObjects.size()); RenderObjectList::const_iterator iter = _timedRenderObjects.begin(); while (iter != _timedRenderObjects.end()) { writer.write((*iter)->getHandle()); @@ -200,10 +200,10 @@ bool RenderObjectManager::unpersist(InputPersistenceBlock &reader) { _timedRenderObjects.resize(0); // Referenzen auf die TimedRenderObjects wieder herstellen. - uint timedObjectCount; + uint32 timedObjectCount; reader.read(timedObjectCount); - for (uint i = 0; i < timedObjectCount; ++i) { - uint handle; + for (uint32 i = 0; i < timedObjectCount; ++i) { + uint32 handle; reader.read(handle); _timedRenderObjects.push_back(handle); } diff --git a/engines/sword25/gfx/text.cpp b/engines/sword25/gfx/text.cpp index d4aaa90682..8c33fa8d61 100644 --- a/engines/sword25/gfx/text.cpp +++ b/engines/sword25/gfx/text.cpp @@ -45,7 +45,7 @@ namespace Sword25 { namespace { -const uint AUTO_WRAP_THRESHOLD_DEFAULT = 300; +const uint32 AUTO_WRAP_THRESHOLD_DEFAULT = 300; } Text::Text(RenderObjectPtr<RenderObject> parentPtr) : @@ -98,8 +98,8 @@ void Text::setText(const Common::String &text) { } } -void Text::setColor(uint modulationColor) { - uint newModulationColor = (modulationColor & 0x00ffffff) | (_modulationColor & 0xff000000); +void Text::setColor(uint32 modulationColor) { + uint32 newModulationColor = (modulationColor & 0x00ffffff) | (_modulationColor & 0xff000000); if (newModulationColor != _modulationColor) { _modulationColor = newModulationColor; forceRefresh(); @@ -108,7 +108,7 @@ void Text::setColor(uint modulationColor) { void Text::setAlpha(int alpha) { assert(alpha >= 0 && alpha < 256); - uint newModulationColor = (_modulationColor & 0x00ffffff) | alpha << 24; + uint32 newModulationColor = (_modulationColor & 0x00ffffff) | alpha << 24; if (newModulationColor != _modulationColor) { _modulationColor = newModulationColor; forceRefresh(); @@ -123,7 +123,7 @@ void Text::setAutoWrap(bool autoWrap) { } } -void Text::setAutoWrapThreshold(uint autoWrapThreshold) { +void Text::setAutoWrapThreshold(uint32 autoWrapThreshold) { if (autoWrapThreshold != _autoWrapThreshold) { _autoWrapThreshold = autoWrapThreshold; updateFormat(); @@ -351,7 +351,7 @@ bool Text::unpersist(InputPersistenceBlock &reader) { reader.read(autoWrap); setAutoWrap(autoWrap); - uint autoWrapThreshold; + uint32 autoWrapThreshold; reader.read(autoWrapThreshold); setAutoWrapThreshold(autoWrapThreshold); diff --git a/engines/sword25/gfx/text.h b/engines/sword25/gfx/text.h index 94e7a30865..873eb33380 100644 --- a/engines/sword25/gfx/text.h +++ b/engines/sword25/gfx/text.h @@ -80,7 +80,7 @@ public: @remark Dieses Attribut wird mit dem Wert 300 initialisiert. @remark Eine automatische Formatierung wird nur vorgenommen, wenn diese durch einen Aufruf von SetAutoWrap() aktiviert wurde. */ - void setAutoWrapThreshold(uint autoWrapThreshold); + void setAutoWrapThreshold(uint32 autoWrapThreshold); /** @brief Gibt den dargestellten Text zurück. @@ -100,7 +100,7 @@ public: @brief Setzt die Farbe des Textes. @param Color eine 24-Bit RGB Farbe, die die Farbe des Textes festlegt. */ - void setColor(uint modulationColor); + void setColor(uint32 modulationColor); /** @brief Gibt den Alphawert des Textes zurück. @@ -128,7 +128,7 @@ public: /** @brief Gibt die Längengrenze des Textes in Pixeln zurück, ab der eine automatische Formatierung vorgenommen wird. */ - uint getAutoWrapThreshold() const { + uint32 getAutoWrapThreshold() const { return _autoWrapThreshold; } @@ -142,11 +142,11 @@ private: Text(RenderObjectPtr<RenderObject> parentPtr); Text(InputPersistenceBlock &reader, RenderObjectPtr<RenderObject> parentPtr, uint handle); - uint _modulationColor; + uint32 _modulationColor; Common::String _font; Common::String _text; bool _autoWrap; - uint _autoWrapThreshold; + uint32 _autoWrapThreshold; struct Line { Common::Rect bbox; diff --git a/engines/sword25/input/inputengine.cpp b/engines/sword25/input/inputengine.cpp index bb9c2c8b40..0d1c449805 100644 --- a/engines/sword25/input/inputengine.cpp +++ b/engines/sword25/input/inputengine.cpp @@ -235,13 +235,13 @@ bool InputEngine::persist(OutputPersistenceBlock &writer) { // Write out the number of command callbacks and their names. // Note: We do this only for compatibility with older engines resp. // the original engine. - writer.write((uint)1); + writer.write((uint32)1); writer.writeString("LuaCommandCB"); // Write out the number of command callbacks and their names. // Note: We do this only for compatibility with older engines resp. // the original engine. - writer.write((uint)1); + writer.write((uint32)1); writer.writeString("LuaCharacterCB"); return true; @@ -253,7 +253,7 @@ bool InputEngine::unpersist(InputPersistenceBlock &reader) { // Read number of command callbacks and their names. // Note: We do this only for compatibility with older engines resp. // the original engine. - uint commandCallbackCount; + uint32 commandCallbackCount; reader.read(commandCallbackCount); assert(commandCallbackCount == 1); @@ -263,7 +263,7 @@ bool InputEngine::unpersist(InputPersistenceBlock &reader) { // Read number of character callbacks and their names. // Note: We do this only for compatibility with older engines resp. // the original engine. - uint characterCallbackCount; + uint32 characterCallbackCount; reader.read(characterCallbackCount); assert(characterCallbackCount == 1); diff --git a/engines/sword25/kernel/inputpersistenceblock.cpp b/engines/sword25/kernel/inputpersistenceblock.cpp index 0fe5d88b80..aa3a759756 100644 --- a/engines/sword25/kernel/inputpersistenceblock.cpp +++ b/engines/sword25/kernel/inputpersistenceblock.cpp @@ -48,12 +48,12 @@ InputPersistenceBlock::~InputPersistenceBlock() { } void InputPersistenceBlock::read(int16 &value) { - signed int v; + int32 v; read(v); value = static_cast<int16>(v); } -void InputPersistenceBlock::read(signed int &value) { +void InputPersistenceBlock::read(int32 &value) { if (checkMarker(SINT_MARKER)) { value = (int32)READ_LE_UINT32(_iter); _iter += 4; @@ -62,7 +62,7 @@ void InputPersistenceBlock::read(signed int &value) { } } -void InputPersistenceBlock::read(uint &value) { +void InputPersistenceBlock::read(uint32 &value) { if (checkMarker(UINT_MARKER)) { value = READ_LE_UINT32(_iter); _iter += 4; @@ -96,7 +96,7 @@ void InputPersistenceBlock::readString(Common::String &value) { value = ""; if (checkMarker(STRING_MARKER)) { - uint size; + uint32 size; read(size); if (checkBlockSize(size)) { @@ -108,7 +108,7 @@ void InputPersistenceBlock::readString(Common::String &value) { void InputPersistenceBlock::readByteArray(Common::Array<byte> &value) { if (checkMarker(BLOCK_MARKER)) { - uint size; + uint32 size; read(size); if (checkBlockSize(size)) { diff --git a/engines/sword25/kernel/inputpersistenceblock.h b/engines/sword25/kernel/inputpersistenceblock.h index 2518d7e32c..02a944ff1b 100644 --- a/engines/sword25/kernel/inputpersistenceblock.h +++ b/engines/sword25/kernel/inputpersistenceblock.h @@ -50,8 +50,8 @@ public: virtual ~InputPersistenceBlock(); void read(int16 &value); - void read(signed int &value); - void read(uint &value); + void read(int32 &value); + void read(uint32 &value); void read(float &value); void read(bool &value); void readString(Common::String &value); diff --git a/engines/sword25/kernel/objectregistry.h b/engines/sword25/kernel/objectregistry.h index d9a7c353f7..449b1b60a3 100644 --- a/engines/sword25/kernel/objectregistry.h +++ b/engines/sword25/kernel/objectregistry.h @@ -139,12 +139,12 @@ protected: } }; - typedef Common::HashMap<uint, T *> HANDLE2PTR_MAP; - typedef Common::HashMap<T *, uint, ClassPointer_Hash, ClassPointer_EqualTo> PTR2HANDLE_MAP; + typedef Common::HashMap<uint32, T *> HANDLE2PTR_MAP; + typedef Common::HashMap<T *, uint32, ClassPointer_Hash, ClassPointer_EqualTo> PTR2HANDLE_MAP; HANDLE2PTR_MAP _handle2PtrMap; PTR2HANDLE_MAP _ptr2HandleMap; - uint _nextHandle; + uint32 _nextHandle; T *findPtrByHandle(uint handle) { // Zum Handle gehörigen Pointer finden. diff --git a/engines/sword25/kernel/outputpersistenceblock.cpp b/engines/sword25/kernel/outputpersistenceblock.cpp index e29d956e5f..53fb624767 100644 --- a/engines/sword25/kernel/outputpersistenceblock.cpp +++ b/engines/sword25/kernel/outputpersistenceblock.cpp @@ -41,13 +41,13 @@ OutputPersistenceBlock::OutputPersistenceBlock() { _data.reserve(INITIAL_BUFFER_SIZE); } -void OutputPersistenceBlock::write(signed int value) { +void OutputPersistenceBlock::write(int32 value) { writeMarker(SINT_MARKER); value = TO_LE_32(value); rawWrite(&value, sizeof(value)); } -void OutputPersistenceBlock::write(uint value) { +void OutputPersistenceBlock::write(uint32 value) { writeMarker(UINT_MARKER); value = TO_LE_32(value); rawWrite(&value, sizeof(value)); @@ -74,14 +74,14 @@ void OutputPersistenceBlock::write(bool value) { void OutputPersistenceBlock::writeString(const Common::String &string) { writeMarker(STRING_MARKER); - write(string.size()); + write((uint32)string.size()); rawWrite(string.c_str(), string.size()); } void OutputPersistenceBlock::writeByteArray(Common::Array<byte> &value) { writeMarker(BLOCK_MARKER); - write((uint)value.size()); + write((uint32)value.size()); rawWrite(&value[0], value.size()); } diff --git a/engines/sword25/kernel/outputpersistenceblock.h b/engines/sword25/kernel/outputpersistenceblock.h index 12351d22e2..17f018a106 100644 --- a/engines/sword25/kernel/outputpersistenceblock.h +++ b/engines/sword25/kernel/outputpersistenceblock.h @@ -41,8 +41,8 @@ class OutputPersistenceBlock : public PersistenceBlock { public: OutputPersistenceBlock(); - void write(signed int value); - void write(uint value); + void write(int32 value); + void write(uint32 value); void write(float value); void write(bool value); void writeString(const Common::String &string); diff --git a/engines/sword25/math/polygon.cpp b/engines/sword25/math/polygon.cpp index 2e7836ff77..99d947df87 100644 --- a/engines/sword25/math/polygon.cpp +++ b/engines/sword25/math/polygon.cpp @@ -364,20 +364,20 @@ bool Polygon::isPointInPolygon(const Vertex &point, bool edgesBelongToPolygon) c bool Polygon::persist(OutputPersistenceBlock &writer) { writer.write(vertexCount); for (int i = 0; i < vertexCount; ++i) { - writer.write(vertices[i].x); - writer.write(vertices[i].y); + writer.write((int32)vertices[i].x); + writer.write((int32)vertices[i].y); } return true; } bool Polygon::unpersist(InputPersistenceBlock &reader) { - int storedvertexCount; + int32 storedvertexCount; reader.read(storedvertexCount); Common::Array<Vertex> storedvertices; for (int i = 0; i < storedvertexCount; ++i) { - int x, y; + int32 x, y; reader.read(x); reader.read(y); storedvertices.push_back(Vertex(x, y)); diff --git a/engines/sword25/math/polygon.h b/engines/sword25/math/polygon.h index ffdbf14f6b..f81e165621 100644 --- a/engines/sword25/math/polygon.h +++ b/engines/sword25/math/polygon.h @@ -169,7 +169,7 @@ public: // /// Specifies the number of Vertecies in the Vertecies array. - int vertexCount; + int32 vertexCount; /// COntains the Vertecies of the polygon Vertex *vertices; diff --git a/engines/sword25/math/region.cpp b/engines/sword25/math/region.cpp index 7681ef6d9f..b6ebaee23f 100644 --- a/engines/sword25/math/region.cpp +++ b/engines/sword25/math/region.cpp @@ -67,7 +67,7 @@ uint Region::create(REGION_TYPE type) { uint Region::create(InputPersistenceBlock &reader, uint handle) { // Read type - uint type; + uint32 type; reader.read(type); // Depending on the type, create a new BS_Region or BS_WalkRegion object @@ -299,22 +299,22 @@ bool Region::isLineOfSight(const Vertex &a, const Vertex &b) const { bool Region::persist(OutputPersistenceBlock &writer) { bool Result = true; - writer.write(static_cast<uint>(_type)); + writer.write(static_cast<uint32>(_type)); writer.write(_valid); - writer.write(_position.x); - writer.write(_position.y); + writer.write((int32)_position.x); + writer.write((int32)_position.y); - writer.write(_polygons.size()); + writer.write((uint32)_polygons.size()); Common::Array<Polygon>::iterator It = _polygons.begin(); while (It != _polygons.end()) { Result &= It->persist(writer); ++It; } - writer.write(_boundingBox.left); - writer.write(_boundingBox.top); - writer.write(_boundingBox.right); - writer.write(_boundingBox.bottom); + writer.write((uint32)_boundingBox.left); + writer.write((uint32)_boundingBox.top); + writer.write((uint32)_boundingBox.right); + writer.write((uint32)_boundingBox.bottom); return Result; } @@ -325,7 +325,7 @@ bool Region::unpersist(InputPersistenceBlock &reader) { reader.read(_position.y); _polygons.clear(); - uint PolygonCount; + uint32 PolygonCount; reader.read(PolygonCount); for (uint i = 0; i < PolygonCount; ++i) { _polygons.push_back(Polygon(reader)); diff --git a/engines/sword25/math/regionregistry.cpp b/engines/sword25/math/regionregistry.cpp index 68c360a5ee..e4925f7baf 100644 --- a/engines/sword25/math/regionregistry.cpp +++ b/engines/sword25/math/regionregistry.cpp @@ -47,7 +47,7 @@ bool RegionRegistry::persist(OutputPersistenceBlock &writer) { writer.write(_nextHandle); // Number of regions to write - writer.write(_handle2PtrMap.size()); + writer.write((uint32)_handle2PtrMap.size()); // Persist all the BS_Regions HANDLE2PTR_MAP::const_iterator iter = _handle2PtrMap.begin(); @@ -76,13 +76,13 @@ bool RegionRegistry::unpersist(InputPersistenceBlock &reader) { delete _handle2PtrMap.begin()->_value; // read in the number of BS_Regions - uint regionCount; + uint32 regionCount; reader.read(regionCount); // Restore all the BS_Regions objects for (uint i = 0; i < regionCount; ++i) { // Handle read - uint handle; + uint32 handle; reader.read(handle); // BS_Region restore diff --git a/engines/sword25/math/walkregion.cpp b/engines/sword25/math/walkregion.cpp index bace4d54bc..0ba7e8ec3d 100644 --- a/engines/sword25/math/walkregion.cpp +++ b/engines/sword25/math/walkregion.cpp @@ -328,22 +328,22 @@ bool WalkRegion::persist(OutputPersistenceBlock &writer) { result &= Region::persist(writer); // Persist the nodes - writer.write(_nodes.size()); + writer.write((uint32)_nodes.size()); Common::Array<Vertex>::const_iterator it = _nodes.begin(); while (it != _nodes.end()) { - writer.write(it->x); - writer.write(it->y); + writer.write((int32)it->x); + writer.write((int32)it->y); ++it; } // Persist the visibility matrix - writer.write(_visibilityMatrix.size()); + writer.write((uint32)_visibilityMatrix.size()); Common::Array< Common::Array<int> >::const_iterator rowIter = _visibilityMatrix.begin(); while (rowIter != _visibilityMatrix.end()) { - writer.write(rowIter->size()); + writer.write((uint32)rowIter->size()); Common::Array<int>::const_iterator colIter = rowIter->begin(); while (colIter != rowIter->end()) { - writer.write(*colIter); + writer.write((int32)*colIter); ++colIter; } @@ -360,7 +360,7 @@ bool WalkRegion::unpersist(InputPersistenceBlock &reader) { // this point only the additional data from BS_WalkRegion needs to be loaded // Node load - uint nodeCount; + uint32 nodeCount; reader.read(nodeCount); _nodes.clear(); _nodes.resize(nodeCount); @@ -372,18 +372,20 @@ bool WalkRegion::unpersist(InputPersistenceBlock &reader) { } // Visibility matrix load - uint rowCount; + uint32 rowCount; reader.read(rowCount); _visibilityMatrix.clear(); _visibilityMatrix.resize(rowCount); Common::Array< Common::Array<int> >::iterator rowIter = _visibilityMatrix.begin(); while (rowIter != _visibilityMatrix.end()) { - uint colCount; + uint32 colCount; reader.read(colCount); rowIter->resize(colCount); Common::Array<int>::iterator colIter = rowIter->begin(); while (colIter != rowIter->end()) { - reader.read(*colIter); + int32 t; + reader.read(t); + *colIter = t; ++colIter; } diff --git a/engines/sword25/sfx/soundengine.cpp b/engines/sword25/sfx/soundengine.cpp index 61d53c89a7..d90849e449 100644 --- a/engines/sword25/sfx/soundengine.cpp +++ b/engines/sword25/sfx/soundengine.cpp @@ -339,7 +339,7 @@ bool SoundEngine::persist(OutputPersistenceBlock &writer) { _handles[i].type = kFreeHandle; writer.writeString(_handles[i].fileName); - writer.write((int)_handles[i].sndType); + writer.write(_handles[i].sndType); writer.write(_handles[i].volume); writer.write(_handles[i].pan); writer.write(_handles[i].loop); @@ -363,13 +363,13 @@ bool SoundEngine::unpersist(InputPersistenceBlock &reader) { reader.read(_handles[i].id); Common::String fileName; - int sndType; + int32 sndType; float volume; float pan; bool loop; - int loopStart; - int loopEnd; - uint layer; + int32 loopStart; + int32 loopEnd; + uint32 layer; reader.readString(fileName); reader.read(sndType); diff --git a/engines/sword25/sfx/soundengine.h b/engines/sword25/sfx/soundengine.h index 8132ec556e..8974ee69e5 100644 --- a/engines/sword25/sfx/soundengine.h +++ b/engines/sword25/sfx/soundengine.h @@ -67,13 +67,13 @@ struct SndHandle { uint32 id; Common::String fileName; - int sndType; + int32 sndType; float volume; float pan; bool loop; - int loopStart; - int loopEnd; - uint layer; + int32 loopStart; + int32 loopEnd; + uint32 layer; }; diff --git a/engines/sword25/util/lua/lcode.cpp b/engines/sword25/util/lua/lcode.cpp index ead780d359..93188b37e2 100644 --- a/engines/sword25/util/lua/lcode.cpp +++ b/engines/sword25/util/lua/lcode.cpp @@ -5,8 +5,6 @@ */ -#include <stdlib.h> - #define lcode_c #define LUA_CORE diff --git a/engines/sword25/util/lua/ldebug.cpp b/engines/sword25/util/lua/ldebug.cpp index e89ae9cad5..396c5df18b 100644 --- a/engines/sword25/util/lua/ldebug.cpp +++ b/engines/sword25/util/lua/ldebug.cpp @@ -5,11 +5,6 @@ */ -#include <stdarg.h> -#include <stddef.h> -#include <string.h> - - #define ldebug_c #define LUA_CORE diff --git a/engines/sword25/util/lua/lfunc.cpp b/engines/sword25/util/lua/lfunc.cpp index f8fa19e25a..95e616cc7e 100644 --- a/engines/sword25/util/lua/lfunc.cpp +++ b/engines/sword25/util/lua/lfunc.cpp @@ -5,8 +5,6 @@ */ -#include <stddef.h> - #define lfunc_c #define LUA_CORE diff --git a/engines/sword25/util/lua/lgc.cpp b/engines/sword25/util/lua/lgc.cpp index 54f7b548dd..53f512280a 100644 --- a/engines/sword25/util/lua/lgc.cpp +++ b/engines/sword25/util/lua/lgc.cpp @@ -4,8 +4,6 @@ ** See Copyright Notice in lua.h */ -#include <string.h> - #define lgc_c #define LUA_CORE diff --git a/engines/sword25/util/lua/llimits.h b/engines/sword25/util/lua/llimits.h index 0925231350..ce6dbc980c 100644 --- a/engines/sword25/util/lua/llimits.h +++ b/engines/sword25/util/lua/llimits.h @@ -8,9 +8,6 @@ #define llimits_h -#include <limits.h> -#include <stddef.h> - #include "lua.h" diff --git a/engines/sword25/util/lua/lmem.cpp b/engines/sword25/util/lua/lmem.cpp index 004a467dc8..8cd220308c 100644 --- a/engines/sword25/util/lua/lmem.cpp +++ b/engines/sword25/util/lua/lmem.cpp @@ -5,8 +5,6 @@ */ -#include <stddef.h> - #define lmem_c #define LUA_CORE diff --git a/engines/sword25/util/lua/lopcodes.cpp b/engines/sword25/util/lua/lopcodes.cpp index 255b2029e9..9d76862ae2 100644 --- a/engines/sword25/util/lua/lopcodes.cpp +++ b/engines/sword25/util/lua/lopcodes.cpp @@ -8,6 +8,7 @@ #define LUA_CORE +#include "lua.h" #include "lopcodes.h" diff --git a/engines/sword25/util/lua/lparser.cpp b/engines/sword25/util/lua/lparser.cpp index 03ea333315..0c88992e79 100644 --- a/engines/sword25/util/lua/lparser.cpp +++ b/engines/sword25/util/lua/lparser.cpp @@ -5,8 +5,6 @@ */ -#include <string.h> - #define lparser_c #define LUA_CORE diff --git a/engines/sword25/util/lua/lstate.cpp b/engines/sword25/util/lua/lstate.cpp index 26bed7bec2..c0ea29de01 100644 --- a/engines/sword25/util/lua/lstate.cpp +++ b/engines/sword25/util/lua/lstate.cpp @@ -5,8 +5,6 @@ */ -#include <stddef.h> - #define lstate_c #define LUA_CORE diff --git a/engines/sword25/util/lua/lstring.cpp b/engines/sword25/util/lua/lstring.cpp index 046b87ee1c..5cfc72539a 100644 --- a/engines/sword25/util/lua/lstring.cpp +++ b/engines/sword25/util/lua/lstring.cpp @@ -5,8 +5,6 @@ */ -#include <string.h> - #define lstring_c #define LUA_CORE diff --git a/engines/sword25/util/lua/lstrlib.cpp b/engines/sword25/util/lua/lstrlib.cpp index ed68a2fa00..5da45e1fea 100644 --- a/engines/sword25/util/lua/lstrlib.cpp +++ b/engines/sword25/util/lua/lstrlib.cpp @@ -7,12 +7,6 @@ #define FORBIDDEN_SYMBOL_EXCEPTION_ctype_h -#include <ctype.h> -#include <stddef.h> -#include <stdio.h> -#include <stdlib.h> -#include <string.h> - #define lstrlib_c #define LUA_LIB diff --git a/engines/sword25/util/lua/ltablib.cpp b/engines/sword25/util/lua/ltablib.cpp index 93be9e6077..064c33c005 100644 --- a/engines/sword25/util/lua/ltablib.cpp +++ b/engines/sword25/util/lua/ltablib.cpp @@ -5,8 +5,6 @@ */ -#include <stddef.h> - #define ltablib_c #define LUA_LIB diff --git a/engines/tinsel/scene.cpp b/engines/tinsel/scene.cpp index 43654fc3af..043b18b8c5 100644 --- a/engines/tinsel/scene.cpp +++ b/engines/tinsel/scene.cpp @@ -186,7 +186,7 @@ static void SceneTinselProcess(CORO_PARAM, const void *param) { void SendSceneTinselProcess(TINSEL_EVENT event) { SCENE_STRUC *ss; - if (g_SceneHandle != (SCNHANDLE)NULL) { + if (g_SceneHandle != 0) { ss = (SCENE_STRUC *) FindChunk(g_SceneHandle, CHUNK_SCENE); if (ss->hSceneScript) { diff --git a/engines/tony/mpal/mpal.cpp b/engines/tony/mpal/mpal.cpp index 5e6d44f0a3..7010c238b5 100644 --- a/engines/tony/mpal/mpal.cpp +++ b/engines/tony/mpal/mpal.cpp @@ -409,7 +409,7 @@ static uint32 *getSelectList(uint32 i) { sl[k++] = dialog->_choice[i]._select[j]._dwData; } - sl[k] = (uint32)NULL; + sl[k] = 0; return sl; } @@ -436,7 +436,7 @@ static uint32 *GetItemList(uint32 nLoc) { } } - il[j] = (uint32)NULL; + il[j] = 0; return il; } @@ -832,7 +832,7 @@ void LocationPollThread(CORO_PARAM, const void *param) { if (_ctx->k == 0) // We can remove this item from the list - _ctx->il[_ctx->i] = (uint32)NULL; + _ctx->il[_ctx->i] = 0; else _ctx->nRealItems++; } diff --git a/engines/tsage/core.cpp b/engines/tsage/core.cpp index 029f9b5075..f7fbb1daa1 100644 --- a/engines/tsage/core.cpp +++ b/engines/tsage/core.cpp @@ -2066,8 +2066,8 @@ SceneObject::SceneObject() : SceneHotspot() { _visage = 0; _strip = 0; _frame = 0; - _effect = 0; - _shade = _shade2 = 0; + _effect = EFFECT_NONE; + _shade = _oldShade = 0; _linkedActor = NULL; _field8A = Common::Point(0, 0); @@ -2370,12 +2370,17 @@ void SceneObject::animate(AnimateMode animMode, ...) { case ANIM_MODE_8: case ANIM_MODE_9: - _field68 = va_arg(va, int); - _endAction = va_arg(va, Action *); - _frameChange = 1; - _endFrame = getFrameCount(); - if (_frame == _endFrame) - setFrame(getNewFrame()); + if (_animateMode == ANIM_MODE_9 && g_vm->getGameID() == GType_Ringworld2) { + _frameChange = -1; + _field2E = _position; + } else { + _field68 = va_arg(va, int); + _endAction = va_arg(va, Action *); + _frameChange = 1; + _endFrame = getFrameCount(); + if (_frame == _endFrame) + setFrame(getNewFrame()); + } break; } va_end(va); @@ -2468,7 +2473,7 @@ void SceneObject::synchronize(Serializer &s) { if (g_vm->getGameID() == GType_Ringworld2) { s.syncAsSint16LE(_effect); s.syncAsSint16LE(_shade); - s.syncAsSint16LE(_shade2); + s.syncAsSint16LE(_oldShade); SYNC_POINTER(_linkedActor); } } @@ -2514,9 +2519,9 @@ void SceneObject::remove() { void SceneObject::dispatch() { if (g_vm->getGameID() == GType_Ringworld2) { - if (_shade != _shade2) + if (_shade != _oldShade) _flags |= OBJFLAG_PANES; - _shade2 = _shade; + _oldShade = _shade; } uint32 currTime = g_globals->_events.getFrameNumber(); @@ -2634,8 +2639,9 @@ void SceneObject::dispatch() { _linkedActor->setFrame(_frame); } - if ((_effect == 1) && (getRegionIndex() < 11)) - _shade = 0; + int regionIndex = getRegionIndex(); + if ((_effect == EFFECT_SHADED) && (regionIndex < 11)) + _shade = regionIndex; } } @@ -2664,7 +2670,24 @@ void SceneObject::removeObject() { GfxSurface SceneObject::getFrame() { _visageImages.setVisage(_visage, _strip); - return _visageImages.getFrame(_frame); + GfxSurface frame = _visageImages.getFrame(_frame); + + // If shading is needed, post apply the shadiing onto the frame + if ((g_vm->getGameID() == GType_Ringworld2) && (_shade >= 1)) { + Graphics::Surface s = frame.lockSurface(); + byte *p = (byte *)s.getPixels(); + byte *endP = p + s.w * s.h; + + while (p < endP) { + if (*p != frame._transColor) + *p = R2_GLOBALS._fadePaletteMap[_shade - 1][*p]; + ++p; + } + + frame.unlockSurface(); + } + + return frame; } void SceneObject::reposition() { @@ -3285,7 +3308,7 @@ void Player::postInit(SceneObjectList *OwnerList) { { _moveDiff.x = 3; _moveDiff.y = 2; - _effect = 1; + _effect = EFFECT_SHADED; _shade = 0; _linkedActor = NULL; diff --git a/engines/tsage/core.h b/engines/tsage/core.h index 6156d13b34..2c88f6be79 100644 --- a/engines/tsage/core.h +++ b/engines/tsage/core.h @@ -466,6 +466,9 @@ enum AnimateMode {ANIM_MODE_NONE = 0, ANIM_MODE_1 = 1, ANIM_MODE_2 = 2, ANIM_MOD ANIM_MODE_9 = 9 }; +enum Effect { EFFECT_NONE = 0, EFFECT_SHADED = 1, EFFECT_2 = 2, EFFECT_3 = 3, + EFFECT_4 = 4, EFFECT_5 = 5 }; + class SceneObject; class Visage { @@ -550,7 +553,7 @@ public: // Ringworld 2 specific fields byte *_field9C; - int _shade, _shade2; + int _shade, _oldShade; int _effect; SceneObject *_linkedActor; public: diff --git a/engines/tsage/globals.cpp b/engines/tsage/globals.cpp index 0964db5497..9bd7249902 100644 --- a/engines/tsage/globals.cpp +++ b/engines/tsage/globals.cpp @@ -503,7 +503,7 @@ void Ringworld2Globals::reset() { _player._characterIndex = R2_QUINN; _player._characterScene[R2_QUINN] = 100; _player._characterScene[R2_SEEKER] = 300; - _player._characterScene[3] = 300; + _player._characterScene[R2_MIRANDA] = 300; } void Ringworld2Globals::synchronize(Serializer &s) { diff --git a/engines/tsage/ringworld2/ringworld2_dialogs.cpp b/engines/tsage/ringworld2/ringworld2_dialogs.cpp index 663697d94d..057d91a46e 100644 --- a/engines/tsage/ringworld2/ringworld2_dialogs.cpp +++ b/engines/tsage/ringworld2/ringworld2_dialogs.cpp @@ -235,7 +235,7 @@ void CharacterDialog::show() { scene->saveCharacter(oldCharacter); // Play the correctfrequency, if any, of the character being switched to's scanner device - if (R2_GLOBALS._player._characterScene[0] != 300) { + if (R2_GLOBALS._player._characterScene[R2_NONE] != 300) { switch (R2_GLOBALS._scannerFrequencies[R2_GLOBALS._player._characterIndex] - 1) { case 0: R2_GLOBALS._sound4.stop(); diff --git a/engines/tsage/ringworld2/ringworld2_logic.cpp b/engines/tsage/ringworld2/ringworld2_logic.cpp index 4050c62a78..b86b8283ed 100644 --- a/engines/tsage/ringworld2/ringworld2_logic.cpp +++ b/engines/tsage/ringworld2/ringworld2_logic.cpp @@ -38,8 +38,6 @@ namespace TsAGE { namespace Ringworld2 { Scene *Ringworld2Game::createScene(int sceneNumber) { - warning("Switching to scene %d", sceneNumber); - switch (sceneNumber) { /* Scene group #0 */ case 50: @@ -1118,19 +1116,31 @@ void Ringworld2Game::start() { if (slot >= 0) R2_GLOBALS._sceneHandler->_loadGameSlot = slot; else { - // Switch to the first game scene + // Switch to the first title screen R2_GLOBALS._events.setCursor(CURSOR_WALK); R2_GLOBALS._uiElements._active = true; - R2_GLOBALS._sceneManager.setNewScene(100); + R2_GLOBALS._sceneManager.setNewScene(180); } g_globals->_events.showCursor(); } +void Ringworld2Game::restartGame() { + if (MessageDialog::show(Ringworld2::R2_RESTART_MSG, CANCEL_BTN_STRING, YES_MSG) == 1) + restart(); +} + void Ringworld2Game::restart() { g_globals->_scenePalette.clearListeners(); g_globals->_soundHandler.stop(); + // Reset the globals + g_globals->reset(); + + // Clear save/load slots + g_globals->_sceneHandler->_saveGameSlot = -1; + g_globals->_sceneHandler->_loadGameSlot = -1; + // Change to the first game scene g_globals->_sceneManager.changeScene(100); } @@ -1307,18 +1317,18 @@ GfxSurface SceneActor::getFrame() { // TODO: Proper effects handling switch (_effect) { - case 0: - case 5: + case EFFECT_NONE: + case EFFECT_5: // TODO: Figure out purpose of setting image flags to 64, and getting // scene priorities -1 or _shade break; - case 1: + case EFFECT_SHADED: // TODO: Transposing using R2_GLOBALS._pixelArrayMap break; - case 2: + case EFFECT_2: // No effect break; - case 4: + case EFFECT_4: break; default: // TODO: Default effect @@ -2087,7 +2097,7 @@ void AnimationPlayer::close() { _field38 = 0; if (g_globals != NULL) - R2_GLOBALS._animationCtr = MAX(R2_GLOBALS._animationCtr, 0); + R2_GLOBALS._animationCtr = MAX(R2_GLOBALS._animationCtr - 1, 0); } void AnimationPlayer::rleDecode(const byte *pSrc, byte *pDest, int size) { @@ -2133,13 +2143,13 @@ void AnimationPlayer::getSlices() { /*--------------------------------------------------------------------------*/ AnimationPlayerExt::AnimationPlayerExt(): AnimationPlayer() { - _v = 0; + _isActive = false; _field3A = 0; } void AnimationPlayerExt::synchronize(Serializer &s) { AnimationPlayer::synchronize(s); - s.syncAsSint16LE(_v); + s.syncAsSint16LE(_isActive); } /*--------------------------------------------------------------------------*/ diff --git a/engines/tsage/ringworld2/ringworld2_logic.h b/engines/tsage/ringworld2/ringworld2_logic.h index 57a30dcc13..aeac2fdd6a 100644 --- a/engines/tsage/ringworld2/ringworld2_logic.h +++ b/engines/tsage/ringworld2/ringworld2_logic.h @@ -228,6 +228,7 @@ public: class Ringworld2Game: public Game { public: virtual void start(); + virtual void restartGame(); virtual void restart(); virtual void endGame(int resNum, int lineNum); @@ -441,7 +442,7 @@ public: class AnimationPlayerExt: public AnimationPlayer { public: - int _v; + bool _isActive; public: AnimationPlayerExt(); diff --git a/engines/tsage/ringworld2/ringworld2_scenes0.cpp b/engines/tsage/ringworld2/ringworld2_scenes0.cpp index de6e0aaf38..4ca8eee5de 100644 --- a/engines/tsage/ringworld2/ringworld2_scenes0.cpp +++ b/engines/tsage/ringworld2/ringworld2_scenes0.cpp @@ -228,6 +228,7 @@ bool Scene100::Terminal::startAction(CursorType action, Event &event) { void Scene100::postInit(SceneObjectList *OwnerList) { loadScene(100); R2_GLOBALS._scenePalette.loadPalette(0); + R2_GLOBALS._scenePalette.setEntry(255, 255, 255, 255); SceneExt::postInit(); if (R2_GLOBALS._sceneManager._previousScene != 125) @@ -1480,14 +1481,14 @@ void Scene180::Action1::signal() { case 0: case 1: case 2: - scene->_object5.setStrip((_actionIndex == 1) ? 1 : 2); - scene->_object5.setFrame(1); - scene->_object5.animate(ANIM_MODE_5, this); + scene->_shipDisplay.setStrip((_actionIndex == 1) ? 1 : 2); + scene->_shipDisplay.setFrame(1); + scene->_shipDisplay.animate(ANIM_MODE_5, this); break; case 4: - scene->_object5.setStrip(3); - scene->_object5.setFrame(1); - scene->_object5.animate(ANIM_MODE_5, this); + scene->_shipDisplay.setStrip(3); + scene->_shipDisplay.setFrame(1); + scene->_shipDisplay.animate(ANIM_MODE_5, this); _actionIndex = 0; break; } @@ -1495,7 +1496,7 @@ void Scene180::Action1::signal() { /*--------------------------------------------------------------------------*/ -Scene180::Scene180(): SceneExt(), _webbsterSpeaker(27) { +Scene180::Scene180(): SceneExt() { _field412 = 0; _frameInc = 0; _frameNumber = R2_GLOBALS._events.getFrameNumber(); @@ -1562,7 +1563,7 @@ void Scene180::signal() { _field412 = 1; R2_GLOBALS._sceneManager._hasPalette = true; _animationPlayer._paletteMode = ANIMPALMODE_NONE; - _animationPlayer._v = 1; + _animationPlayer._isActive = true; _animationPlayer._objectMode = ANIMOBJMODE_1; R2_GLOBALS._scene180Mode = 1; @@ -1605,7 +1606,7 @@ void Scene180::signal() { case 5: _animationPlayer._paletteMode = ANIMPALMODE_NONE; - _animationPlayer._v = 1; + _animationPlayer._isActive = true; _animationPlayer._objectMode = ANIMOBJMODE_1; R2_GLOBALS._scene180Mode = 2; _animationPlayer.load(2); @@ -1648,9 +1649,9 @@ void Scene180::signal() { case 11: _field412 = 1; - _object4.postInit(); - _object5.postInit(); - setAction(&_sequenceManager, this, 4000, &_object4, &_object5, NULL); + _door.postInit(); + _shipDisplay.postInit(); + setAction(&_sequenceManager, this, 4000, &_door, &_shipDisplay, NULL); break; case 12: @@ -1666,37 +1667,37 @@ void Scene180::signal() { break; case 13: - setAction(&_sequenceManager, this, 4001, &_object4, &_object5, NULL); + setAction(&_sequenceManager, this, 4001, &_door, &_shipDisplay, NULL); break; case 15: - setAction(&_sequenceManager, this, 4002, &_object4, &_object5, NULL); + setAction(&_sequenceManager, this, 4002, &_door, &_shipDisplay, NULL); break; case 17: - setAction(&_sequenceManager, this, 4003, &_object4, &_object5, NULL); + setAction(&_sequenceManager, this, 4003, &_door, &_shipDisplay, NULL); break; case 19: - setAction(&_sequenceManager, this, 4004, &_object4, &_object5, NULL); + setAction(&_sequenceManager, this, 4004, &_door, &_shipDisplay, NULL); break; case 21: - setAction(&_sequenceManager, this, 4005, &_object4, &_object5, NULL); + setAction(&_sequenceManager, this, 4005, &_door, &_shipDisplay, NULL); break; case 23: - setAction(&_sequenceManager, this, 4006, &_object4, &_object5, NULL); + setAction(&_sequenceManager, this, 4006, &_door, &_shipDisplay, NULL); break; case 25: - setAction(&_sequenceManager, this, 4007, &_object4, &_object5, NULL); + setAction(&_sequenceManager, this, 4007, &_door, &_shipDisplay, NULL); break; case 27: _field412 = 0; - _object4.remove(); - _object5.remove(); + _door.remove(); + _shipDisplay.remove(); setSceneDelay(2); break; @@ -1710,7 +1711,7 @@ void Scene180::signal() { case 29: _field412 = 1; _animationPlayer._paletteMode = ANIMPALMODE_REPLACE_PALETTE; - _animationPlayer._v = 1; + _animationPlayer._isActive = true; _animationPlayer._objectMode = ANIMOBJMODE_42; R2_GLOBALS._scene180Mode = 3; _animationPlayer.load(3); @@ -1719,12 +1720,12 @@ void Scene180::signal() { case 31: R2_GLOBALS._sound2.play(7); - _object4.postInit(); - _object4.setVisage(76); - _object4.setStrip(1); - _object4.setFrame(1); - _object4.setPosition(Common::Point(288, 143)); - _object4.fixPriority(210); + _door.postInit(); + _door.setVisage(76); + _door.setStrip(1); + _door.setFrame(1); + _door.setPosition(Common::Point(288, 143)); + _door.fixPriority(210); loadScene(75); @@ -1739,68 +1740,71 @@ void Scene180::signal() { case 32: _field412 = 1; - _object2.postInit(); - _object2.setPosition(Common::Point(161, 97)); - _object2.hide(); + _teal.postInit(); + _teal.setPosition(Common::Point(161, 97)); + _teal.hide(); - _object3.postInit(); - _object3.setPosition(Common::Point(60, 96)); - _object3.hide(); - R2_GLOBALS._scenePalette.addFader(_palette._palette, 256, 11, this); + _webbser.postInit(); + _webbser.setPosition(Common::Point(60, 96)); + _webbser.hide(); + _stripManager.start(11, this); break; case 33: - _object2.hide(); + _teal.hide(); - _object3.setup(76, 4, 1); - _object3.setFrame(_object3.getFrameCount()); + _webbser.setup(76, 4, 1); + _webbser.setFrame(_webbser.getFrameCount()); - _object5.postInit(); - _object5.setup(75, 1, 1); - _object5.setPosition(Common::Point(221, 125)); - _object5.fixPriority(210); - _object5.setAction(&_action1); - R2_GLOBALS._scenePalette.addFader(_palette._palette, 256, 12, this); + _shipDisplay.postInit(); + _shipDisplay.setup(75, 1, 1); + _shipDisplay.setPosition(Common::Point(221, 125)); + _shipDisplay.fixPriority(210); + _shipDisplay.setAction(&_action1); + _stripManager.start(12, this); break; case 34: - _object2.hide(); - _object3.hide(); + _teal.hide(); + _webbser.hide(); - _object1.postInit(); - _object1.setup(76, 2, 1); - _object1.setPosition(Common::Point(287, 135)); - _object1.fixPriority(200); + _dutyOfficer.postInit(); + _dutyOfficer.setup(76, 2, 1); + _dutyOfficer.setPosition(Common::Point(287, 135)); + _dutyOfficer.fixPriority(200); _sound1.play(19); - R2_GLOBALS._scenePalette.addFader(_palette._palette, 256, 5, this); + _door.animate(ANIM_MODE_5, this); break; case 35: - R2_GLOBALS._scenePalette.addFader(_palette._palette, 256, 13, this); + _stripManager.start(13, this); break; case 36: - _object2.remove(); + _teal.remove(); _sound1.play(19); - - R2_GLOBALS._scenePalette.addFader(_palette._palette, 256, 6, this); + _door.animate(ANIM_MODE_6, this); break; case 37: _field412 = 0; - _object1.remove(); + _dutyOfficer.remove(); _palette.loadPalette(9998); R2_GLOBALS._scenePalette.addFader(_palette._palette, 256, 8, this); break; case 38: - _object4.remove(); - _object5.setAction(NULL); - _object5.remove(); - + _door.remove(); + _shipDisplay.setAction(NULL); + _shipDisplay.remove(); + + // TODO: Figure out why end action on sounds aren't firing. For now, I'm + // simply setting up a scene delay to ensure the signal() method gets + // called again after a brief delay + setSceneDelay(10); R2_GLOBALS._sound2.fadeOut2(NULL); - R2_GLOBALS._sound1.fadeOut2(NULL); + R2_GLOBALS._sound1.fadeOut2(NULL /* this */); break; case 39: @@ -1823,7 +1827,7 @@ void Scene180::signal() { case 41: _field412 = 1; - _animationPlayer._v = 1; + _animationPlayer._isActive = true; break; case 42: @@ -1842,13 +1846,14 @@ void Scene180::signal() { break; case 45: - R2_GLOBALS._scenePalette.addFader(_animationPlayer._subData._palData, 256, 28, this); + _field412 = 1; + _stripManager.start(28, this); break; case 48: _field412 = 1; _animationPlayer._paletteMode = ANIMPALMODE_NONE; - _animationPlayer._v = 1; + _animationPlayer._isActive = true; _animationPlayer._objectMode = ANIMOBJMODE_1; R2_GLOBALS._scene180Mode = 15; _animationPlayer.load(15, NULL); @@ -1905,9 +1910,9 @@ void Scene180::dispatch() { } } - if (_animationPlayer._v) { + if (_animationPlayer._isActive) { if (_animationPlayer.isCompleted()) { - _animationPlayer._v = 0; + _animationPlayer._isActive = false; _animationPlayer.close(); _animationPlayer.remove(); @@ -2805,12 +2810,12 @@ void Scene300::Action1::signal() { switch (_actionIndex) { case 0: - setAction(&scene->_sequenceManager2, this, 311, (R2_GLOBALS._player._characterIndex == 1) ? + setAction(&scene->_sequenceManager2, this, 311, (R2_GLOBALS._player._characterIndex == R2_QUINN) ? (SceneObject *)&R2_GLOBALS._player : (SceneObject *)&scene->_quinn); _actionIndex = 2; break; case 1: - setAction(&scene->_sequenceManager2, this, 312, (R2_GLOBALS._player._characterIndex == 1) ? + setAction(&scene->_sequenceManager2, this, 312, (R2_GLOBALS._player._characterIndex == R2_QUINN) ? (SceneObject *)&R2_GLOBALS._player : (SceneObject *)&scene->_quinn); _actionIndex = 0; break; @@ -2904,7 +2909,7 @@ bool Scene300::QuinnWorkstation::startAction(CursorType action, Event &event) { return true; case CURSOR_LOOK: - if (R2_GLOBALS._player._characterIndex == 1) { + if (R2_GLOBALS._player._characterIndex == R2_QUINN) { SceneItem::display2(300, 47); return true; } @@ -2927,7 +2932,7 @@ bool Scene300::MirandaWorkstation::startAction(CursorType action, Event &event) return true; case CURSOR_LOOK: - if (R2_GLOBALS._player._characterIndex == 3) { + if (R2_GLOBALS._player._characterIndex == R2_MIRANDA) { SceneItem::display2(300, 47); return true; } @@ -2943,7 +2948,7 @@ bool Scene300::MirandaWorkstation::startAction(CursorType action, Event &event) bool Scene300::SeekerWorkstation::startAction(CursorType action, Event &event) { switch (action) { case CURSOR_LOOK: - if (R2_GLOBALS._player._characterIndex == 2) { + if (R2_GLOBALS._player._characterIndex == R2_SEEKER) { SceneItem::display2(300, 47); return true; } @@ -3452,8 +3457,8 @@ void Scene300::postInit(SceneObjectList *OwnerList) { case 3: if (R2_GLOBALS._sceneManager._previousScene == 1500) { - R2_GLOBALS._player._oldCharacterScene[3] = 3150; - R2_GLOBALS._player._characterScene[3] = 3150; + R2_GLOBALS._player._oldCharacterScene[R2_MIRANDA] = 3150; + R2_GLOBALS._player._characterScene[R2_MIRANDA] = 3150; R2_GLOBALS._player._effect = 0; R2_GLOBALS._player.setAction(NULL); R2_GLOBALS._player.disableControl(); @@ -4281,7 +4286,7 @@ void Scene325::consoleAction(int id) { break; case 11: - if (R2_GLOBALS.getFlag(57) && (R2_GLOBALS._player._characterIndex == 1) && !R2_GLOBALS.getFlag(25)) { + if (R2_GLOBALS.getFlag(57) && (R2_GLOBALS._player._characterIndex == R2_QUINN) && !R2_GLOBALS.getFlag(25)) { R2_GLOBALS._player.disableControl(); R2_GLOBALS._events.setCursor(CURSOR_ARROW); _sceneMode = 13; diff --git a/engines/tsage/ringworld2/ringworld2_scenes0.h b/engines/tsage/ringworld2/ringworld2_scenes0.h index df0b4d8fc6..b735f7cc23 100644 --- a/engines/tsage/ringworld2/ringworld2_scenes0.h +++ b/engines/tsage/ringworld2/ringworld2_scenes0.h @@ -197,11 +197,11 @@ class Scene180: public SceneExt { private: void setSceneDelay(int v); public: - SpeakerWebbster _webbsterSpeaker; - SpeakerDutyOfficer _dutyOfficerSpeaker; - SpeakerTeal _tealSpeaker; + SpeakerWebbster180 _webbsterSpeaker; + SpeakerDutyOfficer180 _dutyOfficerSpeaker; + SpeakerTeal180 _tealSpeaker; SpeakerGameText _gameTextSpeaker; - SceneActor _object1, _object2, _object3, _object4, _object5; + SceneActor _dutyOfficer, _teal, _webbser, _door, _shipDisplay; ScenePalette _palette; SceneText _textList[20]; AnimationPlayerExt _animationPlayer; @@ -306,7 +306,6 @@ public: virtual void dispatch(); }; - class Scene250: public SceneExt { class Button: public SceneActor { public: @@ -477,7 +476,6 @@ public: virtual void dispatch(); }; - class Scene400: public SceneExt { /* Items */ class Terminal: public NamedHotspot { diff --git a/engines/tsage/ringworld2/ringworld2_scenes1.cpp b/engines/tsage/ringworld2/ringworld2_scenes1.cpp index 8f1905eeac..29bef2ccb2 100644 --- a/engines/tsage/ringworld2/ringworld2_scenes1.cpp +++ b/engines/tsage/ringworld2/ringworld2_scenes1.cpp @@ -1520,7 +1520,7 @@ void Scene1200::postInit(SceneObjectList *OwnerList) { R2_GLOBALS._player.setup(3156, 1, 6); R2_GLOBALS._player.setPosition(Common::Point(160, 70)); R2_GLOBALS._player._numFrames = 10; - R2_GLOBALS._player._oldCharacterScene[3] = 1200; + R2_GLOBALS._player._oldCharacterScene[R2_MIRANDA] = 1200; _actor1.postInit(); _actor1.hide(); diff --git a/engines/tsage/ringworld2/ringworld2_scenes2.cpp b/engines/tsage/ringworld2/ringworld2_scenes2.cpp index 01c5ae3fd6..a8e534d5cb 100644 --- a/engines/tsage/ringworld2/ringworld2_scenes2.cpp +++ b/engines/tsage/ringworld2/ringworld2_scenes2.cpp @@ -51,77 +51,77 @@ void Scene2000::initPlayer() { R2_GLOBALS._player.enableControl(); break; case 1: - if (R2_GLOBALS._player._characterIndex == 1) + if (R2_GLOBALS._player._characterIndex == R2_QUINN) _sceneMode = 2001; else _sceneMode = 2021; setAction(&_sequenceManager, this, _sceneMode, &R2_GLOBALS._player, NULL); break; case 2: - if (R2_GLOBALS._player._characterIndex == 1) + if (R2_GLOBALS._player._characterIndex == R2_QUINN) _sceneMode = 2002; else _sceneMode = 2022; setAction(&_sequenceManager, this, _sceneMode, &R2_GLOBALS._player, NULL); break; case 3: - if (R2_GLOBALS._player._characterIndex == 1) + if (R2_GLOBALS._player._characterIndex == R2_QUINN) _sceneMode = 2000; else _sceneMode = 2020; setAction(&_sequenceManager, this, _sceneMode, &R2_GLOBALS._player, NULL); break; case 4: - if (R2_GLOBALS._player._characterIndex == 1) + if (R2_GLOBALS._player._characterIndex == R2_QUINN) _sceneMode = 2005; else _sceneMode = 2025; setAction(&_sequenceManager, this, _sceneMode, &R2_GLOBALS._player, NULL); break; case 5: - if (R2_GLOBALS._player._characterIndex == 1) + if (R2_GLOBALS._player._characterIndex == R2_QUINN) _sceneMode = 2004; else _sceneMode = 2024; setAction(&_sequenceManager, this, _sceneMode, &R2_GLOBALS._player, NULL); break; case 6: - if (R2_GLOBALS._player._characterIndex == 1) + if (R2_GLOBALS._player._characterIndex == R2_QUINN) _sceneMode = 2009; else _sceneMode = 2029; setAction(&_sequenceManager, this, _sceneMode, &R2_GLOBALS._player, NULL); break; case 7: - if (R2_GLOBALS._player._characterIndex == 1) + if (R2_GLOBALS._player._characterIndex == R2_QUINN) _sceneMode = 2008; else _sceneMode = 2028; setAction(&_sequenceManager, this, _sceneMode, &R2_GLOBALS._player, NULL); break; case 8: - if (R2_GLOBALS._player._characterIndex == 1) + if (R2_GLOBALS._player._characterIndex == R2_QUINN) _sceneMode = 2013; else _sceneMode = 2033; setAction(&_sequenceManager, this, _sceneMode, &R2_GLOBALS._player, NULL); break; case 9: - if (R2_GLOBALS._player._characterIndex == 1) + if (R2_GLOBALS._player._characterIndex == R2_QUINN) _sceneMode = 2012; else _sceneMode = 2032; setAction(&_sequenceManager, this, _sceneMode, &R2_GLOBALS._player, NULL); break; case 10: - if (R2_GLOBALS._player._characterIndex == 1) + if (R2_GLOBALS._player._characterIndex == R2_QUINN) _sceneMode = 2016; else _sceneMode = 2036; setAction(&_sequenceManager, this, _sceneMode, &R2_GLOBALS._player, NULL); break; case 11: - if (R2_GLOBALS._player._characterIndex == 1) + if (R2_GLOBALS._player._characterIndex == R2_QUINN) _sceneMode = 2038; else _sceneMode = 2040; @@ -137,7 +137,7 @@ void Scene2000::initPlayer() { if ((R2_GLOBALS._player._characterScene[R2_QUINN] == R2_GLOBALS._player._characterScene[R2_SEEKER]) && (R2_GLOBALS._spillLocation[R2_QUINN] == R2_GLOBALS._spillLocation[R2_SEEKER])) { _object1.postInit(); - if (R2_GLOBALS._player._characterIndex == 1) { + if (R2_GLOBALS._player._characterIndex == R2_QUINN) { _object1.setup(20, 5, 1); _object1.setDetails(9002, 0, 4, 3, 1, (SceneItem *)NULL); } else { @@ -601,25 +601,25 @@ void Scene2000::SouthExit::changeScene() { switch (scene->_mazePlayerMode) { case 4: - if (R2_GLOBALS._player._characterIndex == 1) + if (R2_GLOBALS._player._characterIndex == R2_QUINN) scene->setAction(&scene->_sequenceManager, scene, 2003, &R2_GLOBALS._player, NULL); else scene->setAction(&scene->_sequenceManager, scene, 2023, &R2_GLOBALS._player, NULL); break; case 6: - if (R2_GLOBALS._player._characterIndex == 1) + if (R2_GLOBALS._player._characterIndex == R2_QUINN) scene->setAction(&scene->_sequenceManager, scene, 2007, &R2_GLOBALS._player, NULL); else scene->setAction(&scene->_sequenceManager, scene, 2027, &R2_GLOBALS._player, NULL); break; case 8: - if (R2_GLOBALS._player._characterIndex == 1) + if (R2_GLOBALS._player._characterIndex == R2_QUINN) scene->setAction(&scene->_sequenceManager, scene, 2011, &R2_GLOBALS._player, NULL); else scene->setAction(&scene->_sequenceManager, scene, 2031, &R2_GLOBALS._player, NULL); break; case 11: - if (R2_GLOBALS._player._characterIndex == 1) + if (R2_GLOBALS._player._characterIndex == R2_QUINN) scene->_sceneMode = 2039; else scene->_sceneMode = 2041; @@ -666,19 +666,19 @@ void Scene2000::NorthExit::changeScene() { switch (scene->_mazePlayerMode) { case 5: - if (R2_GLOBALS._player._characterIndex == 1) + if (R2_GLOBALS._player._characterIndex == R2_QUINN) scene->setAction(&scene->_sequenceManager, scene, 2006, &R2_GLOBALS._player, NULL); else scene->setAction(&scene->_sequenceManager, scene, 2026, &R2_GLOBALS._player, NULL); break; case 7: - if (R2_GLOBALS._player._characterIndex == 1) + if (R2_GLOBALS._player._characterIndex == R2_QUINN) scene->setAction(&scene->_sequenceManager, scene, 2010, &R2_GLOBALS._player, NULL); else scene->setAction(&scene->_sequenceManager, scene, 2030, &R2_GLOBALS._player, NULL); break; case 9: - if (R2_GLOBALS._player._characterIndex == 1) + if (R2_GLOBALS._player._characterIndex == R2_QUINN) scene->setAction(&scene->_sequenceManager, scene, 2014, &R2_GLOBALS._player, NULL); else scene->setAction(&scene->_sequenceManager, scene, 2034, &R2_GLOBALS._player, NULL); @@ -698,56 +698,56 @@ void Scene2000::DoorExit::changeScene() { switch (R2_GLOBALS._spillLocation[R2_GLOBALS._player._characterIndex]) { case 3: scene->_mazePlayerMode = 1; - if (R2_GLOBALS._player._characterIndex == 1) + if (R2_GLOBALS._player._characterIndex == R2_QUINN) scene->setAction(&scene->_sequenceManager, scene, 2015, &R2_GLOBALS._player, NULL); else scene->setAction(&scene->_sequenceManager, scene, 2035, &R2_GLOBALS._player, NULL); break; case 4: scene->_mazePlayerMode = 7; - if (R2_GLOBALS._player._characterIndex == 1) + if (R2_GLOBALS._player._characterIndex == R2_QUINN) scene->setAction(&scene->_sequenceManager, scene, 2017, &R2_GLOBALS._player, NULL); else scene->setAction(&scene->_sequenceManager, scene, 2037, &R2_GLOBALS._player, NULL); break; case 10: scene->_mazePlayerMode = 8; - if (R2_GLOBALS._player._characterIndex == 1) + if (R2_GLOBALS._player._characterIndex == R2_QUINN) scene->setAction(&scene->_sequenceManager, scene, 2015, &R2_GLOBALS._player, NULL); else scene->setAction(&scene->_sequenceManager, scene, 2035, &R2_GLOBALS._player, NULL); break; case 12: scene->_mazePlayerMode = 3; - if (R2_GLOBALS._player._characterIndex == 1) + if (R2_GLOBALS._player._characterIndex == R2_QUINN) scene->setAction(&scene->_sequenceManager, scene, 2017, &R2_GLOBALS._player, NULL); else scene->setAction(&scene->_sequenceManager, scene, 2037, &R2_GLOBALS._player, NULL); break; case 16: scene->_mazePlayerMode = 4; - if (R2_GLOBALS._player._characterIndex == 1) + if (R2_GLOBALS._player._characterIndex == R2_QUINN) scene->setAction(&scene->_sequenceManager, scene, 2015, &R2_GLOBALS._player, NULL); else scene->setAction(&scene->_sequenceManager, scene, 2035, &R2_GLOBALS._player, NULL); break; case 21: scene->_mazePlayerMode = 5; - if (R2_GLOBALS._player._characterIndex == 1) + if (R2_GLOBALS._player._characterIndex == R2_QUINN) scene->setAction(&scene->_sequenceManager, scene, 2015, &R2_GLOBALS._player, NULL); else scene->setAction(&scene->_sequenceManager, scene, 2035, &R2_GLOBALS._player, NULL); break; case 25: scene->_mazePlayerMode = 2; - if (R2_GLOBALS._player._characterIndex == 1) + if (R2_GLOBALS._player._characterIndex == R2_QUINN) scene->setAction(&scene->_sequenceManager, scene, 2017, &R2_GLOBALS._player, NULL); else scene->setAction(&scene->_sequenceManager, scene, 2037, &R2_GLOBALS._player, NULL); break; case 34: scene->_mazePlayerMode = 6; - if (R2_GLOBALS._player._characterIndex == 1) + if (R2_GLOBALS._player._characterIndex == R2_QUINN) scene->setAction(&scene->_sequenceManager, scene, 2017, &R2_GLOBALS._player, NULL); else scene->setAction(&scene->_sequenceManager, scene, 2037, &R2_GLOBALS._player, NULL); @@ -791,7 +791,7 @@ void Scene2000::postInit(SceneObjectList *OwnerList) { R2_GLOBALS._player.postInit(); R2_GLOBALS._player.animate(ANIM_MODE_1, NULL); - if (R2_GLOBALS._player._characterIndex == 1) { + if (R2_GLOBALS._player._characterIndex == R2_QUINN) { R2_GLOBALS._player.setup(2008, 3, 1); R2_GLOBALS._player._moveDiff = Common::Point(3, 2); } else { @@ -1063,7 +1063,7 @@ void Scene2350::ExitUp::changeScene() { R2_GLOBALS._player.disableControl(CURSOR_CROSSHAIRS); scene->_sceneMode = 12; - if (R2_GLOBALS._player._characterIndex == 1) + if (R2_GLOBALS._player._characterIndex == R2_QUINN) scene->setAction(&scene->_sequenceManager, scene, 2350, &R2_GLOBALS._player, NULL); else scene->setAction(&scene->_sequenceManager, scene, 2352, &R2_GLOBALS._player, NULL); @@ -1099,7 +1099,7 @@ void Scene2350::postInit(SceneObjectList *OwnerList) { R2_GLOBALS._player.postInit(); R2_GLOBALS._player.animate(ANIM_MODE_1, NULL); - if (R2_GLOBALS._player._characterIndex == 1) { + if (R2_GLOBALS._player._characterIndex == R2_QUINN) { R2_GLOBALS._player.setup(2008, 3, 1); R2_GLOBALS._player._moveDiff = Common::Point(3, 2); } else { @@ -1109,7 +1109,7 @@ void Scene2350::postInit(SceneObjectList *OwnerList) { if (R2_GLOBALS._player._characterScene[R2_QUINN] == R2_GLOBALS._player._characterScene[R2_SEEKER]) { _actor2.postInit(); - if (R2_GLOBALS._player._characterIndex == 1) { + if (R2_GLOBALS._player._characterIndex == R2_QUINN) { _actor2.setup(20, 5, 1); _actor2.setDetails(9002, 0, 4, 3, 1, (SceneItem *)NULL); } else { @@ -1139,7 +1139,7 @@ void Scene2350::postInit(SceneObjectList *OwnerList) { if (R2_GLOBALS._player._oldCharacterScene[R2_GLOBALS._player._characterIndex] == 2000) { if (R2_GLOBALS._spillLocation[R2_GLOBALS._player._characterIndex] == 34) { - if (R2_GLOBALS._player._characterIndex == 1) + if (R2_GLOBALS._player._characterIndex == R2_QUINN) _sceneMode = 2351; else _sceneMode = 2353; @@ -1392,7 +1392,7 @@ void Scene2425::postInit(SceneObjectList *OwnerList) { R2_GLOBALS._player.postInit(); R2_GLOBALS._player.animate(ANIM_MODE_1, NULL); - if (R2_GLOBALS._player._characterIndex == 1) { + if (R2_GLOBALS._player._characterIndex == R2_QUINN) { R2_GLOBALS._player.setVisage(2008); R2_GLOBALS._player._moveDiff = Common::Point(3, 2); } else { @@ -1402,7 +1402,7 @@ void Scene2425::postInit(SceneObjectList *OwnerList) { if (R2_GLOBALS._player._characterScene[R2_QUINN] == R2_GLOBALS._player._characterScene[R2_SEEKER]) { _pictographs1.postInit(); - if (R2_GLOBALS._player._characterIndex == 1) { + if (R2_GLOBALS._player._characterIndex == R2_QUINN) { _pictographs1.setup(20, 5, 1); _pictographs1.setDetails(9002, 0, 4, 3, 1, (SceneItem *)NULL); } else { @@ -1556,7 +1556,7 @@ void Scene2430::postInit(SceneObjectList *OwnerList) { R2_GLOBALS._player.postInit(); R2_GLOBALS._player.animate(ANIM_MODE_1, NULL); - if (R2_GLOBALS._player._characterIndex == 1) { + if (R2_GLOBALS._player._characterIndex == R2_QUINN) { R2_GLOBALS._player.setVisage(2008); R2_GLOBALS._player._moveDiff = Common::Point(3, 2); } else { @@ -1567,7 +1567,7 @@ void Scene2430::postInit(SceneObjectList *OwnerList) { if (R2_GLOBALS._player._characterScene[R2_QUINN] == R2_GLOBALS._player._characterScene[R2_SEEKER]) { _actor1.postInit(); - if (R2_GLOBALS._player._characterIndex == 1) { + if (R2_GLOBALS._player._characterIndex == R2_QUINN) { _actor1.setup(20, 5, 1); _actor1.setDetails(9002, 0, 4, 3, 1, (SceneItem *)NULL); } else { @@ -1657,7 +1657,7 @@ bool Scene2435::Astor::startAction(CursorType action, Event &event) { R2_GLOBALS._player.disableControl(); scene->_sceneMode = 20; R2_GLOBALS._events.setCursor(CURSOR_ARROW); - if ((R2_GLOBALS._player._characterIndex == 1) || (R2_GLOBALS.getFlag(82))) { + if ((R2_GLOBALS._player._characterIndex == R2_QUINN) || (R2_GLOBALS.getFlag(82))) { scene->_stripManager.start(605, scene); return true; } else if (R2_INVENTORY.getObjectScene(R2_ANCIENT_SCROLLS) == 2) { @@ -1771,7 +1771,7 @@ void Scene2435::signal() { _sceneMode = 2436; R2_GLOBALS._player.setStrip(7); _companion.postInit(); - if (R2_GLOBALS._player._characterIndex == 1) + if (R2_GLOBALS._player._characterIndex == R2_QUINN) _companion.setVisage(20); else _companion.setVisage(2008); @@ -1839,7 +1839,7 @@ void Scene2440::postInit(SceneObjectList *OwnerList) { R2_GLOBALS._player.enableControl(); R2_GLOBALS._player.animate(ANIM_MODE_1, NULL); - if (R2_GLOBALS._player._characterIndex == 1) { + if (R2_GLOBALS._player._characterIndex == R2_QUINN) { R2_GLOBALS._player.setVisage(2008); R2_GLOBALS._player._moveDiff = Common::Point(3, 2); } else { @@ -1849,7 +1849,7 @@ void Scene2440::postInit(SceneObjectList *OwnerList) { R2_GLOBALS._player.setPosition(Common::Point(210, 200)); if (R2_GLOBALS._player._characterScene[R2_QUINN] == R2_GLOBALS._player._characterScene[R2_SEEKER]) { _actor1.postInit(); - if (R2_GLOBALS._player._characterIndex == 1) { + if (R2_GLOBALS._player._characterIndex == R2_QUINN) { _actor1.setup(20, 5, 1); _actor1.setDetails(9002, 0, 4, 3, 1, (SceneItem *)NULL); } else { @@ -1927,7 +1927,7 @@ void Scene2445::signal() { bool Scene2450::Parker::startAction(CursorType action, Event &event) { Scene2450 *scene = (Scene2450 *)R2_GLOBALS._sceneManager._scene; - if ((action == CURSOR_USE) && (R2_GLOBALS._player._characterIndex == 1)) { + if ((action == CURSOR_USE) && (R2_GLOBALS._player._characterIndex == R2_QUINN)) { R2_GLOBALS._player.disableControl(); scene->_sceneMode = 2452; scene->setAction(&scene->_sequenceManager, scene, 2452, &R2_GLOBALS._player, &scene->_parker, NULL); @@ -1945,7 +1945,7 @@ bool Scene2450::CareTaker::startAction(CursorType action, Event &event) { ++R2_GLOBALS._v565AE; scene->_sceneMode = 20; R2_GLOBALS._events.setCursor(CURSOR_CROSSHAIRS); - if (R2_GLOBALS._player._characterIndex == 1) + if (R2_GLOBALS._player._characterIndex == R2_QUINN) scene->_stripManager.start(699 + (R2_GLOBALS._v565AE * 2), scene); else scene->_stripManager.start(700 + (R2_GLOBALS._v565AE * 2), scene); @@ -2017,7 +2017,7 @@ void Scene2450::postInit(SceneObjectList *OwnerList) { break; case 2000: _sceneMode = 2451; - if (R2_GLOBALS._player._characterIndex == 1) { + if (R2_GLOBALS._player._characterIndex == R2_QUINN) { if (R2_GLOBALS._player._characterScene[R2_SEEKER] == 2450) { _companion.postInit(); _companion.setup(20, 6, 1); @@ -2041,7 +2041,7 @@ void Scene2450::postInit(SceneObjectList *OwnerList) { } break; case 2450: - if (R2_GLOBALS._player._characterIndex == 1) { + if (R2_GLOBALS._player._characterIndex == R2_QUINN) { R2_GLOBALS._player.postInit(); if (R2_GLOBALS.getFlag(61)) { R2_GLOBALS._player.setup(2008, 6, 1); @@ -2111,7 +2111,7 @@ void Scene2450::postInit(SceneObjectList *OwnerList) { break; default: R2_GLOBALS._player.animate(ANIM_MODE_1, NULL); - if (R2_GLOBALS._player._characterIndex == 1) { + if (R2_GLOBALS._player._characterIndex == R2_QUINN) { if (R2_GLOBALS.getFlag(61)) { R2_GLOBALS._player.setup(2008, 3, 1); } else { @@ -2429,7 +2429,7 @@ void Scene2500::postInit(SceneObjectList *OwnerList) { R2_GLOBALS._player.postInit(); R2_GLOBALS._player.animate(ANIM_MODE_1, NULL); - if (R2_GLOBALS._player._characterIndex == 1) { + if (R2_GLOBALS._player._characterIndex == R2_QUINN) { R2_GLOBALS._player.setVisage(11); R2_GLOBALS._player._moveDiff = Common::Point(2, 1); } else { @@ -2439,7 +2439,7 @@ void Scene2500::postInit(SceneObjectList *OwnerList) { if (R2_GLOBALS._player._characterScene[R2_QUINN] == R2_GLOBALS._player._characterScene[R2_SEEKER]) { _actor1.postInit(); - if (R2_GLOBALS._player._characterIndex == 1) { + if (R2_GLOBALS._player._characterIndex == R2_QUINN) { _actor1.setup(21, 3, 1); _actor1.setDetails(9002, 1, -1, -1, 1, (SceneItem *)NULL); } else { @@ -2568,7 +2568,7 @@ void Scene2525::postInit(SceneObjectList *OwnerList) { R2_GLOBALS._player.postInit(); R2_GLOBALS._player.animate(ANIM_MODE_1, NULL); - if (R2_GLOBALS._player._characterIndex == 1) { + if (R2_GLOBALS._player._characterIndex == R2_QUINN) { R2_GLOBALS._player.setup(2008, 3, 1); R2_GLOBALS._player._moveDiff = Common::Point(3, 2); } else { @@ -2578,7 +2578,7 @@ void Scene2525::postInit(SceneObjectList *OwnerList) { if (R2_GLOBALS._player._characterScene[R2_QUINN] == R2_GLOBALS._player._characterScene[R2_SEEKER]) { _actor1.postInit(); - if (R2_GLOBALS._player._characterIndex == 1) { + if (R2_GLOBALS._player._characterIndex == R2_QUINN) { _actor1.setup(20, 5, 1); _actor1.setDetails(9002, 0, 4, 3, 1, (SceneItem *)NULL); } else { @@ -2729,7 +2729,7 @@ void Scene2530::postInit(SceneObjectList *OwnerList) { R2_GLOBALS._player.postInit(); R2_GLOBALS._player.animate(ANIM_MODE_1, NULL); - if (R2_GLOBALS._player._characterIndex == 1) { + if (R2_GLOBALS._player._characterIndex == R2_QUINN) { R2_GLOBALS._player.setVisage(2008); R2_GLOBALS._player._moveDiff = Common::Point(3, 2); } else { @@ -2740,7 +2740,7 @@ void Scene2530::postInit(SceneObjectList *OwnerList) { if (R2_GLOBALS._player._characterScene[R2_QUINN] == R2_GLOBALS._player._characterScene[R2_SEEKER]) { _actor1.postInit(); - if (R2_GLOBALS._player._characterIndex == 1) { + if (R2_GLOBALS._player._characterIndex == R2_QUINN) { _actor1.setup(20, 5, 1); _actor1.setDetails(9002, 0, 4, 3, 1, (SceneItem *)NULL); } else { @@ -2892,7 +2892,7 @@ void Scene2535::postInit(SceneObjectList *OwnerList) { R2_GLOBALS._player.postInit(); R2_GLOBALS._player.animate(ANIM_MODE_1, NULL); - if (R2_GLOBALS._player._characterIndex == 1) { + if (R2_GLOBALS._player._characterIndex == R2_QUINN) { R2_GLOBALS._player.setVisage(2008); R2_GLOBALS._player._moveDiff = Common::Point(3, 2); } else { @@ -2903,7 +2903,7 @@ void Scene2535::postInit(SceneObjectList *OwnerList) { if (R2_GLOBALS._player._characterScene[R2_QUINN] == R2_GLOBALS._player._characterScene[R2_SEEKER]) { _companion.postInit(); - if (R2_GLOBALS._player._characterIndex == 1) { + if (R2_GLOBALS._player._characterIndex == R2_QUINN) { _companion.setup(20, 5, 1); _companion.setDetails(9002, 0, 4, 3, 1, (SceneItem *)NULL); } else { diff --git a/engines/tsage/ringworld2/ringworld2_scenes3.cpp b/engines/tsage/ringworld2/ringworld2_scenes3.cpp index 2188a487e5..c64665a839 100644 --- a/engines/tsage/ringworld2/ringworld2_scenes3.cpp +++ b/engines/tsage/ringworld2/ringworld2_scenes3.cpp @@ -334,7 +334,7 @@ void Scene3125::postInit(SceneObjectList *OwnerList) { R2_GLOBALS._sound1.play(262); R2_GLOBALS._player.postInit(); - if (R2_GLOBALS._player._oldCharacterScene[3] == 3250) { + if (R2_GLOBALS._player._oldCharacterScene[R2_MIRANDA] == 3250) { _sceneMode = 3175; setAction(&_sequenceManager1, this, 3175, &R2_GLOBALS._player, &_door, NULL); } else { @@ -343,7 +343,7 @@ void Scene3125::postInit(SceneObjectList *OwnerList) { R2_GLOBALS._player.setPosition(Common::Point(89, 76)); R2_GLOBALS._player.enableControl(); } - R2_GLOBALS._player._oldCharacterScene[3] = 3125; + R2_GLOBALS._player._oldCharacterScene[R2_MIRANDA] = 3125; } void Scene3125::signal() { @@ -545,7 +545,7 @@ void Scene3150::postInit(SceneObjectList *OwnerList) { if (R2_GLOBALS._sceneManager._previousScene == -1) { R2_INVENTORY.setObjectScene(R2_ANCIENT_SCROLLS, 2000); R2_GLOBALS._player._oldCharacterScene[R2_QUINN] = 3100; - R2_GLOBALS._player._oldCharacterScene[3] = 0; + R2_GLOBALS._player._oldCharacterScene[R2_MIRANDA] = 0; R2_GLOBALS._player._characterIndex = R2_MIRANDA; } SceneExt::postInit(); @@ -708,7 +708,7 @@ void Scene3150::postInit(SceneObjectList *OwnerList) { } } - R2_GLOBALS._player._oldCharacterScene[3] = 3150; + R2_GLOBALS._player._oldCharacterScene[R2_MIRANDA] = 3150; } void Scene3150::signal() { @@ -910,7 +910,7 @@ void Scene3175::postInit(SceneObjectList *OwnerList) { R2_GLOBALS._player.postInit(); - if (R2_GLOBALS._player._oldCharacterScene[3] == 3250) { + if (R2_GLOBALS._player._oldCharacterScene[R2_MIRANDA] == 3250) { R2_GLOBALS._player.setup(30, 5, 1); R2_GLOBALS._player.animate(ANIM_MODE_1, NULL); R2_GLOBALS._player.setPosition(Common::Point(126, 77)); @@ -920,7 +920,7 @@ void Scene3175::postInit(SceneObjectList *OwnerList) { setAction(&_sequenceManager, this, 3175, &R2_GLOBALS._player, &_door, NULL); } - R2_GLOBALS._player._oldCharacterScene[3] = 3175; + R2_GLOBALS._player._oldCharacterScene[R2_MIRANDA] = 3175; } void Scene3175::signal() { @@ -1165,7 +1165,7 @@ void Scene3250::postInit(SceneObjectList *OwnerList) { loadScene(3250); if (R2_GLOBALS._sceneManager._previousScene == -1) { - R2_GLOBALS._player._oldCharacterScene[3] = 1200; + R2_GLOBALS._player._oldCharacterScene[R2_MIRANDA] = 1200; R2_GLOBALS._player._characterIndex = R2_MIRANDA; } @@ -1195,7 +1195,7 @@ void Scene3250::postInit(SceneObjectList *OwnerList) { R2_GLOBALS._player.postInit(); - switch (R2_GLOBALS._player._oldCharacterScene[3]) { + switch (R2_GLOBALS._player._oldCharacterScene[R2_MIRANDA]) { case 1200: _sceneMode = 3250; _actor4.postInit(); @@ -1234,7 +1234,7 @@ void Scene3250::postInit(SceneObjectList *OwnerList) { break; } - R2_GLOBALS._player._oldCharacterScene[3] = 3250; + R2_GLOBALS._player._oldCharacterScene[R2_MIRANDA] = 3250; } void Scene3250::signal() { @@ -1305,7 +1305,7 @@ void Scene3255::postInit(SceneObjectList *OwnerList) { _sceneMode = 3255; setAction(&_sequenceManager, this, 3255, &R2_GLOBALS._player, NULL); } - R2_GLOBALS._player._oldCharacterScene[3] = 3255; + R2_GLOBALS._player._oldCharacterScene[R2_MIRANDA] = 3255; } void Scene3255::signal() { @@ -1512,7 +1512,7 @@ void Scene3260::postInit(SceneObjectList *OwnerList) { _item1.setDetails(Rect(0, 0, 320, 200), 3260, 0, 1, 2, 1, NULL); R2_GLOBALS._player.postInit(); - if (R2_GLOBALS._player._oldCharacterScene[3] == 3275) { + if (R2_GLOBALS._player._oldCharacterScene[R2_MIRANDA] == 3275) { _sceneMode = 3270; setAction(&_sequenceManager, this, 3270, &R2_GLOBALS._player, &_door, NULL); } else { @@ -1522,7 +1522,7 @@ void Scene3260::postInit(SceneObjectList *OwnerList) { R2_GLOBALS._player._moveDiff = Common::Point(3, 2); R2_GLOBALS._player.enableControl(); } - R2_GLOBALS._player._oldCharacterScene[3] = 3260; + R2_GLOBALS._player._oldCharacterScene[R2_MIRANDA] = 3260; } void Scene3260::remove() { @@ -1614,7 +1614,7 @@ void Scene3275::postInit(SceneObjectList *OwnerList) { R2_GLOBALS._scrollFollower = &R2_GLOBALS._player; R2_GLOBALS._player.postInit(); R2_GLOBALS._player.disableControl(); - if (R2_GLOBALS._player._oldCharacterScene[3] == 3150) { + if (R2_GLOBALS._player._oldCharacterScene[R2_MIRANDA] == 3150) { _sceneMode = 11; R2_GLOBALS._player.setup(30, 3, 1); R2_GLOBALS._player.animate(ANIM_MODE_1, NULL); @@ -1623,7 +1623,7 @@ void Scene3275::postInit(SceneObjectList *OwnerList) { Common::Point pt(418, 128); NpcMover *mover = new NpcMover(); R2_GLOBALS._player.addMover(mover, &pt, this); - } else if (R2_GLOBALS._player._oldCharacterScene[3] == 3260) { + } else if (R2_GLOBALS._player._oldCharacterScene[R2_MIRANDA] == 3260) { _sceneMode = 3276; setAction(&_sequenceManager, this, 3276, &R2_GLOBALS._player, &_door, NULL); } else { @@ -1633,7 +1633,7 @@ void Scene3275::postInit(SceneObjectList *OwnerList) { R2_GLOBALS._player._moveDiff = Common::Point(3, 2); R2_GLOBALS._player.enableControl(); } - R2_GLOBALS._player._oldCharacterScene[3] = 3275; + R2_GLOBALS._player._oldCharacterScene[R2_MIRANDA] = 3275; } void Scene3275::signal() { @@ -1813,7 +1813,7 @@ bool Scene3375::Companion2::startAction(CursorType action, Event &event) { return SceneActor::startAction(action, event); scene->_sceneMode = 9999; - if (R2_GLOBALS._player._characterIndex == 2) + if (R2_GLOBALS._player._characterIndex == R2_SEEKER) scene->_stripManager.start(3302, scene); else scene->_stripManager.start(3304, scene); @@ -1828,7 +1828,7 @@ bool Scene3375::Companion1::startAction(CursorType action, Event &event) { return SceneActor::startAction(action, event); scene->_sceneMode = 9999; - if (R2_GLOBALS._player._characterIndex == 3) + if (R2_GLOBALS._player._characterIndex == R2_MIRANDA) scene->_stripManager.start(3302, scene); else scene->_stripManager.start(3301, scene); @@ -2241,7 +2241,7 @@ bool Scene3385::Companion1::startAction(CursorType action, Event &event) { return SceneActor::startAction(action, event); scene->_sceneMode = 9999; - if (R2_GLOBALS._player._characterIndex == 2) + if (R2_GLOBALS._player._characterIndex == R2_SEEKER) scene->_stripManager.start(3302, scene); else scene->_stripManager.start(3304, scene); @@ -2256,7 +2256,7 @@ bool Scene3385::Companion2::startAction(CursorType action, Event &event) { return SceneActor::startAction(action, event); scene->_sceneMode = 9999; - if (R2_GLOBALS._player._characterIndex == 3) + if (R2_GLOBALS._player._characterIndex == R2_MIRANDA) scene->_stripManager.start(3302, scene); else scene->_stripManager.start(3301, scene); @@ -2333,7 +2333,7 @@ void Scene3385::postInit(SceneObjectList *OwnerList) { R2_GLOBALS._player._characterScene[R2_QUINN] = 3385; R2_GLOBALS._player._characterScene[R2_SEEKER] = 3385; - R2_GLOBALS._player._characterScene[3] = 3385; + R2_GLOBALS._player._characterScene[R2_MIRANDA] = 3385; if (R2_GLOBALS._sceneManager._previousScene == 3375) _field11B2 = 3; @@ -2343,16 +2343,16 @@ void Scene3385::postInit(SceneObjectList *OwnerList) { setZoomPercents(102, 40, 200, 160); R2_GLOBALS._player.postInit(); - if (R2_GLOBALS._player._characterIndex == 2) + if (R2_GLOBALS._player._characterIndex == R2_SEEKER) R2_GLOBALS._player._moveDiff = Common::Point(5, 3); else R2_GLOBALS._player._moveDiff = Common::Point(3, 2); R2_GLOBALS._player.changeZoom(-1); - if (R2_GLOBALS._player._characterIndex == 2) + if (R2_GLOBALS._player._characterIndex == R2_SEEKER) R2_GLOBALS._player.setup(20, _field11B2, 1); - else if (R2_GLOBALS._player._characterIndex == 3) + else if (R2_GLOBALS._player._characterIndex == R2_MIRANDA) R2_GLOBALS._player.setup(30, _field11B2, 1); else R2_GLOBALS._player.setup(10, _field11B2, 1); @@ -2361,7 +2361,7 @@ void Scene3385::postInit(SceneObjectList *OwnerList) { R2_GLOBALS._player.disableControl(); _companion1.postInit(); - if (R2_GLOBALS._player._characterIndex == 2) { + if (R2_GLOBALS._player._characterIndex == R2_SEEKER) { _companion1._moveRate = 10; _companion1._moveDiff = Common::Point(3, 2); } else { @@ -2370,7 +2370,7 @@ void Scene3385::postInit(SceneObjectList *OwnerList) { } _companion1.changeZoom(-1); _companion1._effect = 1; - if (R2_GLOBALS._player._characterIndex == 2) + if (R2_GLOBALS._player._characterIndex == R2_SEEKER) _companion1.setup(10, _field11B2, 1); else _companion1.setup(20, _field11B2, 1); @@ -2381,7 +2381,7 @@ void Scene3385::postInit(SceneObjectList *OwnerList) { _companion2._moveDiff = Common::Point(3, 2); _companion2.changeZoom(-1); _companion2._effect = 1; - if (R2_GLOBALS._player._characterIndex == 3) + if (R2_GLOBALS._player._characterIndex == R2_MIRANDA) _companion2.setup(10, _field11B2, 1); else _companion2.setup(30, _field11B2, 1); @@ -2478,7 +2478,7 @@ bool Scene3395::Companion1::startAction(CursorType action, Event &event) { return SceneActor::startAction(action, event); scene->_sceneMode = 9999; - if (R2_GLOBALS._player._characterIndex == 2) + if (R2_GLOBALS._player._characterIndex == R2_SEEKER) scene->_stripManager.start(3302, scene); else scene->_stripManager.start(3304, scene); @@ -2493,7 +2493,7 @@ bool Scene3395::Companion2::startAction(CursorType action, Event &event) { return SceneActor::startAction(action, event); scene->_sceneMode = 9999; - if (R2_GLOBALS._player._characterIndex == 3) + if (R2_GLOBALS._player._characterIndex == R2_MIRANDA) scene->_stripManager.start(3302, scene); else scene->_stripManager.start(3301, scene); @@ -2556,7 +2556,7 @@ void Scene3395::postInit(SceneObjectList *OwnerList) { R2_GLOBALS._player._characterScene[R2_QUINN] = 3395; R2_GLOBALS._player._characterScene[R2_SEEKER] = 3395; - R2_GLOBALS._player._characterScene[3] = 3395; + R2_GLOBALS._player._characterScene[R2_MIRANDA] = 3395; if (R2_GLOBALS._sceneManager._previousScene == 3385) _field142E = 3; @@ -2566,16 +2566,16 @@ void Scene3395::postInit(SceneObjectList *OwnerList) { setZoomPercents(51, 40, 200, 137); R2_GLOBALS._player.postInit(); - if (R2_GLOBALS._player._characterIndex == 2) + if (R2_GLOBALS._player._characterIndex == R2_SEEKER) R2_GLOBALS._player._moveDiff = Common::Point(5, 3); else R2_GLOBALS._player._moveDiff = Common::Point(3, 2); R2_GLOBALS._player.changeZoom(-1); - if (R2_GLOBALS._player._characterIndex == 2) + if (R2_GLOBALS._player._characterIndex == R2_SEEKER) R2_GLOBALS._player.setup(20, _field142E, 1); - else if (R2_GLOBALS._player._characterIndex == 3) + else if (R2_GLOBALS._player._characterIndex == R2_MIRANDA) R2_GLOBALS._player.setup(30, _field142E, 1); else R2_GLOBALS._player.setup(10, _field142E, 1); @@ -2584,7 +2584,7 @@ void Scene3395::postInit(SceneObjectList *OwnerList) { R2_GLOBALS._player.disableControl(); _companion1.postInit(); - if (R2_GLOBALS._player._characterIndex == 2) { + if (R2_GLOBALS._player._characterIndex == R2_SEEKER) { _companion1._moveRate = 10; _companion1._moveDiff = Common::Point(3, 2); } else { @@ -2593,7 +2593,7 @@ void Scene3395::postInit(SceneObjectList *OwnerList) { } _companion1.changeZoom(-1); _companion1._effect = 1; - if (R2_GLOBALS._player._characterIndex == 2) + if (R2_GLOBALS._player._characterIndex == R2_SEEKER) _companion1.setup(10, _field142E, 1); else _companion1.setup(20, _field142E, 1); @@ -2680,9 +2680,10 @@ void Scene3395::signal() { } /*-------------------------------------------------------------------------- - * Scene 3400 - + * Scene 3400 - Confrontation * *--------------------------------------------------------------------------*/ + Scene3400::Scene3400() { _field157C = 0; } @@ -2714,7 +2715,7 @@ void Scene3400::postInit(SceneObjectList *OwnerList) { setZoomPercents(51, 46, 180, 200); R2_GLOBALS._player._characterScene[R2_QUINN] = 3400; R2_GLOBALS._player._characterScene[R2_SEEKER] = 3400; - R2_GLOBALS._player._characterScene[3] = 3400; + R2_GLOBALS._player._characterScene[R2_MIRANDA] = 3400; _actor7.postInit(); _actor7.setup(3403, 1, 1); @@ -2722,16 +2723,16 @@ void Scene3400::postInit(SceneObjectList *OwnerList) { _actor7.fixPriority(89); R2_GLOBALS._player.postInit(); - if (R2_GLOBALS._player._characterIndex == 2) + if (R2_GLOBALS._player._characterIndex == R2_SEEKER) R2_GLOBALS._player._moveDiff = Common::Point(5, 3); else R2_GLOBALS._player._moveDiff = Common::Point(3, 2); R2_GLOBALS._player.changeZoom(-1); R2_GLOBALS._player.setPosition(Common::Point(239, 64)); - if (R2_GLOBALS._player._characterIndex == 2) + if (R2_GLOBALS._player._characterIndex == R2_SEEKER) R2_GLOBALS._player.setup(20, 5, 1); - else if (R2_GLOBALS._player._characterIndex == 3) + else if (R2_GLOBALS._player._characterIndex == R2_MIRANDA) R2_GLOBALS._player.setup(30, 5, 1); else R2_GLOBALS._player.setup(10, 5, 1); @@ -2739,42 +2740,42 @@ void Scene3400::postInit(SceneObjectList *OwnerList) { R2_GLOBALS._player.animate(ANIM_MODE_1, NULL); R2_GLOBALS._player.disableControl(); - _actor1.postInit(); - if (R2_GLOBALS._player._characterIndex == 2) { - _actor1._numFrames = 10; - _actor1._moveDiff = Common::Point(3, 2); + _companion1.postInit(); + if (R2_GLOBALS._player._characterIndex == R2_SEEKER) { + _companion1._numFrames = 10; + _companion1._moveDiff = Common::Point(3, 2); } else { - _actor1._numFrames = 7; - _actor1._moveDiff = Common::Point(5, 3); + _companion1._numFrames = 7; + _companion1._moveDiff = Common::Point(5, 3); } - _actor1.changeZoom(-1); - _actor1._effect = 1; - _actor1.setPosition(Common::Point(247, 63)); - if (R2_GLOBALS._player._characterIndex == 2) - _actor1.setup(10, 5, 1); + _companion1.changeZoom(-1); + _companion1._effect = 1; + _companion1.setPosition(Common::Point(247, 63)); + if (R2_GLOBALS._player._characterIndex == R2_SEEKER) + _companion1.setup(10, 5, 1); else - _actor1.setup(20, 5, 1); - _actor1.animate(ANIM_MODE_1, NULL); + _companion1.setup(20, 5, 1); + _companion1.animate(ANIM_MODE_1, NULL); - _actor2.postInit(); - _actor2._moveDiff = Common::Point(3, 2); - _actor2.changeZoom(-1); - _actor2._effect = 1; - _actor2.setPosition(Common::Point(225, 63)); - if (R2_GLOBALS._player._characterIndex == 3) - _actor2.setup(10, 5, 1); + _companion2.postInit(); + _companion2._moveDiff = Common::Point(3, 2); + _companion2.changeZoom(-1); + _companion2._effect = 1; + _companion2.setPosition(Common::Point(225, 63)); + if (R2_GLOBALS._player._characterIndex == R2_MIRANDA) + _companion2.setup(10, 5, 1); else - _actor2.setup(30, 5, 1); - _actor2.animate(ANIM_MODE_1, NULL); + _companion2.setup(30, 5, 1); + _companion2.animate(ANIM_MODE_1, NULL); - _actor3.postInit(); - _actor3._numFrames = 7; - _actor3._moveDiff = Common::Point(5, 3); - _actor3.changeZoom(-1); - _actor3._effect = 1; - _actor3.setPosition(Common::Point(235, 61)); - _actor3.setup(40, 3, 1); - _actor3.animate(ANIM_MODE_1, NULL); + _webbster.postInit(); + _webbster._numFrames = 7; + _webbster._moveDiff = Common::Point(5, 3); + _webbster.changeZoom(-1); + _webbster._effect = 1; + _webbster.setPosition(Common::Point(235, 61)); + _webbster.setup(40, 3, 1); + _webbster.animate(ANIM_MODE_1, NULL); _actor6.postInit(); _actor6.setup(3400, 1, 6); @@ -2784,7 +2785,7 @@ void Scene3400::postInit(SceneObjectList *OwnerList) { R2_GLOBALS.clearFlag(71); _sceneMode = 3400; - setAction(&_sequenceManager, this, 3400, &R2_GLOBALS._player, &_actor1, &_actor2, &_actor3, NULL); + setAction(&_sequenceManager, this, 3400, &R2_GLOBALS._player, &_companion1, &_companion2, &_webbster, NULL); } void Scene3400::remove() { @@ -2798,30 +2799,30 @@ void Scene3400::signal() { case 3305: { warning("STUB: sub_1D227()"); _tealSpeaker._object1.hide(); - _actor4.show(); - _actor4.setStrip(1); + _teal.show(); + _teal.setStrip(1); Common::Point pt(158, 190); NpcMover *mover = new NpcMover(); - _actor4.addMover(mover, &pt, this); + _teal.addMover(mover, &pt, this); _sceneMode = 3402; - setAction(&_sequenceManager, this, 3402, &R2_GLOBALS._player, &_actor1, &_actor2, &_actor3, NULL); + setAction(&_sequenceManager, this, 3402, &R2_GLOBALS._player, &_companion1, &_companion2, &_webbster, NULL); } break; case 3306: R2_GLOBALS._sound2.play(318); - _actor1.setStrip(2); + _companion1.setStrip(2); R2_GLOBALS._player.setStrip(6); - _actor2.setStrip(6); - _actor3.setStrip(3); - _actor4.setStrip(1); + _companion2.setStrip(6); + _webbster.setStrip(3); + _teal.setStrip(1); R2_INVENTORY.setObjectScene(R2_SAPPHIRE_BLUE, 0); _stripManager.start(3307, this); - if (R2_GLOBALS._player._characterIndex == 2) { + if (R2_GLOBALS._player._characterIndex == R2_SEEKER) { _sceneMode = 3400; - R2_GLOBALS._player.setAction(&_sequenceManager, this, 3400, &R2_GLOBALS._player, &_actor4, &_actor8, NULL); + R2_GLOBALS._player.setAction(&_sequenceManager, this, 3400, &R2_GLOBALS._player, &_teal, &_actor8, NULL); } else { _sceneMode = 3408; - _actor1.setAction(&_sequenceManager, this, 3408, &_actor1, &_actor4, &_actor8, NULL); + _companion1.setAction(&_sequenceManager, this, 3408, &_companion1, &_teal, &_actor8, NULL); } break; case 3307: @@ -2837,63 +2838,63 @@ void Scene3400::signal() { break; case 3308: warning("STUB: sub_1D227()"); - _actor1.setStrip(2); + _companion1.setStrip(2); R2_GLOBALS._player.setStrip(6); - _actor2.setStrip(6); - _actor3.setStrip(3); - _actor4.setStrip(1); + _companion2.setStrip(6); + _webbster.setStrip(3); + _teal.setStrip(1); _sceneMode = 3403; - if (R2_GLOBALS._player._characterIndex == 2) - setAction(&_sequenceManager, this, 3403, &R2_GLOBALS._player, &_actor3, &_actor7, NULL); + if (R2_GLOBALS._player._characterIndex == R2_SEEKER) + setAction(&_sequenceManager, this, 3403, &R2_GLOBALS._player, &_webbster, &_actor7, NULL); else - setAction(&_sequenceManager, this, 3403, &_actor1, &_actor3, &_actor7, NULL); + setAction(&_sequenceManager, this, 3403, &_companion1, &_webbster, &_actor7, NULL); break; case 3309: warning("STUB: sub_1D227()"); - _actor4.setStrip(1); + _teal.setStrip(1); _sceneMode = 3405; - if (R2_GLOBALS._player._characterIndex == 3) + if (R2_GLOBALS._player._characterIndex == R2_MIRANDA) setAction(&_sequenceManager, this, 3405, &R2_GLOBALS._player, &_actor7, NULL); else - setAction(&_sequenceManager, this, 3405, &_actor2, &_actor7, NULL); + setAction(&_sequenceManager, this, 3405, &_companion2, &_actor7, NULL); break; case 3310: warning("STUB: sub_1D227()"); - _actor4.setStrip(1); + _teal.setStrip(1); _sceneMode = 3406; - if (R2_GLOBALS._player._characterIndex == 1) + if (R2_GLOBALS._player._characterIndex == R2_QUINN) setAction(&_sequenceManager, this, 3406, &R2_GLOBALS._player, &_actor7, NULL); - else if (R2_GLOBALS._player._characterIndex == 2) - setAction(&_sequenceManager, this, 3406, &_actor1, &_actor7, NULL); - else if (R2_GLOBALS._player._characterIndex == 3) - setAction(&_sequenceManager, this, 3406, &_actor2, &_actor7, NULL); + else if (R2_GLOBALS._player._characterIndex == R2_SEEKER) + setAction(&_sequenceManager, this, 3406, &_companion1, &_actor7, NULL); + else if (R2_GLOBALS._player._characterIndex == R2_MIRANDA) + setAction(&_sequenceManager, this, 3406, &_companion2, &_actor7, NULL); break; case 3311: warning("STUB: sub_1D227()"); _tealSpeaker._object1.hide(); - _actor4.show(); - _actor4.setStrip(1); + _teal.show(); + _teal.setStrip(1); _sceneMode = 3407; - setAction(&_sequenceManager, this, 3407, &_actor4, &_actor7, NULL); + setAction(&_sequenceManager, this, 3407, &_teal, &_actor7, NULL); break; case 3400: { _actor8.postInit(); _actor8.hide(); - _actor4.postInit(); - _actor4._numFrames = 7; - _actor4._moveDiff = Common::Point(3, 2); - _actor4.changeZoom(-1); - _actor4._effect = 1; - _actor4.setPosition(Common::Point(-15, 90)); - _actor4.setup(3402, 1, 1); - _actor4.animate(ANIM_MODE_1, NULL); + _teal.postInit(); + _teal._numFrames = 7; + _teal._moveDiff = Common::Point(3, 2); + _teal.changeZoom(-1); + _teal._effect = 1; + _teal.setPosition(Common::Point(-15, 90)); + _teal.setup(3402, 1, 1); + _teal.animate(ANIM_MODE_1, NULL); Common::Point pt1(115, 90); NpcMover *mover1 = new NpcMover(); - _actor4.addMover(mover1, &pt1, this); - R2_GLOBALS._scrollFollower = &_actor4; + _teal.addMover(mover1, &pt1, this); + R2_GLOBALS._scrollFollower = &_teal; Common::Point pt2(203, 76); NpcMover *mover2 = new NpcMover(); - _actor3.addMover(mover2, &pt2, NULL); + _webbster.addMover(mover2, &pt2, NULL); _sceneMode = 3401; } break; @@ -4228,15 +4229,16 @@ void Scene3500::dispatch() { } /*-------------------------------------------------------------------------- - * Scene 3600 - + * Scene 3600 - Cutscene - walking at gunpoint * *--------------------------------------------------------------------------*/ + Scene3600::Scene3600() { _field2548 = 0; _field254A = 0; _field254C = 0; _field254E = 0; - _field2550 = false; + _ghoulTeleported = false; } void Scene3600::synchronize(Serializer &s) { SceneExt::synchronize(s); @@ -4245,7 +4247,7 @@ void Scene3600::synchronize(Serializer &s) { s.syncAsSint16LE(_field254A); s.syncAsSint16LE(_field254C); s.syncAsSint16LE(_field254E); - s.syncAsSint16LE(_field2550); + s.syncAsSint16LE(_ghoulTeleported); } Scene3600::Action3600::Action3600() { @@ -4275,8 +4277,8 @@ void Scene3600::Action3600::signal() { R2_GLOBALS._sound2.play(330, NULL, 0); R2_GLOBALS._sound2.fade(127, 5, 10, false, NULL); } + setDelay(1); - warning("TODO: Palette fader using parameter 2 = 256"); R2_GLOBALS._scenePalette.fade((const byte *)&scene->_palette1._palette, true, _field20); if (_field20 > 0) _field20 -= 2; @@ -4304,14 +4306,14 @@ void Scene3600::Action2::signal() { R2_GLOBALS._events.proc1(); R2_GLOBALS._player.enableControl(); _actionIndex = 3619; - scene->_actor13._state = 0; + scene->_protector._state = 0; // No break on purpose case 3619: { ++_actionIndex; - scene->_actor13.setup(3127, 2, 1); - scene->_actor13.animate(ANIM_MODE_1, NULL); + scene->_protector.setup(3127, 2, 1); + scene->_protector.animate(ANIM_MODE_1, NULL); NpcMover *mover = new NpcMover(); - scene->_actor13.addMover(mover, &scene->_actor13._field8A, scene); + scene->_protector.addMover(mover, &scene->_protector._field8A, scene); } break; default: @@ -4337,9 +4339,9 @@ bool Scene3600::Item5::startAction(CursorType action, Event &event) { scene->_actor12.setStrip2(-1); scene->_actor4.setStrip2(-1); - if (R2_GLOBALS._player._characterIndex == 2) + if (R2_GLOBALS._player._characterIndex == R2_SEEKER) R2_GLOBALS._player.setAction(&scene->_sequenceManager3, scene, 3611, &R2_GLOBALS._player, NULL); - else if (R2_GLOBALS._player._characterIndex == 3) + else if (R2_GLOBALS._player._characterIndex == R2_MIRANDA) R2_GLOBALS._player.setAction(&scene->_sequenceManager4, scene, 3612, &R2_GLOBALS._player, NULL); else R2_GLOBALS._player.setAction(&scene->_sequenceManager2, scene, 3610, &R2_GLOBALS._player, NULL); @@ -4347,12 +4349,12 @@ bool Scene3600::Item5::startAction(CursorType action, Event &event) { return true; } -bool Scene3600::Actor13::startAction(CursorType action, Event &event) { +bool Scene3600::Protector::startAction(CursorType action, Event &event) { Scene3600 *scene = (Scene3600 *)R2_GLOBALS._sceneManager._scene; switch(action) { case CURSOR_TALK: - if (!_action) + if (_action) return SceneActor::startAction(action, event); scene->_protectorSpeaker._displayMode = 1; @@ -4379,6 +4381,7 @@ bool Scene3600::Actor13::startAction(CursorType action, Event &event) { R2_GLOBALS._sound3.play(43); else R2_GLOBALS._sound3.play(99); + if (_state != 0) { _state = 1; setup(3128, 1, 1); @@ -4424,7 +4427,7 @@ void Scene3600::postInit(SceneObjectList *OwnerList) { setZoomPercents(142, 80, 167, 105); R2_GLOBALS._player._characterScene[R2_QUINN] = 3600; R2_GLOBALS._player._characterScene[R2_SEEKER] = 3600; - R2_GLOBALS._player._characterScene[3] = 3600; + R2_GLOBALS._player._characterScene[R2_MIRANDA] = 3600; _item2.setDetails(33, 3600, 6, -1, -1); _item3.setDetails(Rect(3, 3, 22, 45), 3600, 9, -1, -1, 1, NULL); @@ -4498,7 +4501,7 @@ void Scene3600::postInit(SceneObjectList *OwnerList) { _actor12.setup(30, 5, 11); _actor12.animate(ANIM_MODE_1, NULL); - if (R2_GLOBALS._player._characterIndex == 2) { + if (R2_GLOBALS._player._characterIndex == R2_SEEKER) { _actor10.setPosition(Common::Point(76, 148)); _actor11.setPosition(Common::Point(134, 148)); _actor12.setPosition(Common::Point(100, 148)); @@ -4506,7 +4509,7 @@ void Scene3600::postInit(SceneObjectList *OwnerList) { R2_GLOBALS._player.setup(20, _actor11._strip, 1); R2_GLOBALS._player.setPosition(_actor11._position); _actor11.hide(); - } else if (R2_GLOBALS._player._characterIndex == 3) { + } else if (R2_GLOBALS._player._characterIndex == R2_MIRANDA) { _actor10.setPosition(Common::Point(110, 148)); _actor11.setPosition(Common::Point(76, 148)); _actor12.setPosition(Common::Point(134, 148)); @@ -4531,14 +4534,14 @@ void Scene3600::postInit(SceneObjectList *OwnerList) { _actor5.setup(3601, 7, 5); if (!R2_GLOBALS.getFlag(71)) { - _actor13.postInit(); - _actor13._state = 0; - _actor13._field8A = Common::Point(226, 152); - _actor13._moveDiff = Common::Point(3, 2); - _actor13.setPosition(Common::Point(284, 152)); - _actor13.setup(3127, 2, 1); - _actor13.changeZoom(-1); - _actor13.setDetails(3600, 15, -1, 17, 1, (SceneItem *) NULL); + _protector.postInit(); + _protector._state = 0; + _protector._field8A = Common::Point(226, 152); + _protector._moveDiff = Common::Point(3, 2); + _protector.setPosition(Common::Point(284, 152)); + _protector.setup(3127, 2, 1); + _protector.changeZoom(-1); + _protector.setDetails(3600, 15, -1, 17, 1, (SceneItem *) NULL); } R2_GLOBALS._sound2.play(330); @@ -4575,9 +4578,8 @@ void Scene3600::postInit(SceneObjectList *OwnerList) { _actor5.setup(3403, 8, 11); _actor5.setPosition(Common::Point(403, 155)); - _actor12.setup(3403, 7, 1); - - _actor13.setPosition(Common::Point(405, 155)); + _protector.setup(3403, 7, 1); + _protector.setPosition(Common::Point(405, 155)); _actor2.postInit(); _actor2.setup(3600, 2, 1); @@ -4593,7 +4595,7 @@ void Scene3600::postInit(SceneObjectList *OwnerList) { _field254E = 0; } _field254E = 0; - _field2550 = R2_GLOBALS.getFlag(71); + _ghoulTeleported = R2_GLOBALS.getFlag(71); R2_GLOBALS._sound1.play(326); _item1.setDetails(Rect(0, 0, 480, 200), 3600, 0, -1, -1, 1, NULL); @@ -4611,15 +4613,15 @@ void Scene3600::remove() { void Scene3600::signal() { switch (_sceneMode) { case 3320: - warning("STUB: sub_1D227()"); + // TODO: warning("STUB: sub_1D227()"); R2_GLOBALS._walkRegions.disableRegion(14); R2_GLOBALS._scrollFollower = &_actor11; _tealSpeaker._object1.hide(); _actor5.show(); _actor5.setStrip(2); - if (R2_GLOBALS._player._characterIndex == 2) + if (R2_GLOBALS._player._characterIndex == R2_SEEKER) _sceneMode = 3602; - else if (R2_GLOBALS._player._characterIndex == 3) + else if (R2_GLOBALS._player._characterIndex == R2_MIRANDA) _sceneMode = 3603; else _sceneMode = 3601; @@ -4643,7 +4645,7 @@ void Scene3600::signal() { _tealSpeaker._displayMode = 7; R2_GLOBALS._scrollFollower = &_actor5; _sceneMode = 3605; - setAction(&_sequenceManager1, this, _sceneMode, &_actor5, &_actor13, &_actor2, NULL); + setAction(&_sequenceManager1, this, _sceneMode, &_actor5, &_protector, &_actor2, NULL); break; case 3323: if (_field254A == 0) @@ -4651,15 +4653,18 @@ void Scene3600::signal() { else { warning("STUB: sub_1D227()"); _protectorSpeaker.proc16(); - _actor13.show(); - _actor13.setup(3258, 6, 1); + _protector.show(); + _protector.setup(3258, 6, 1); + _sceneMode = 3607; - _actor13.setAction(&_sequenceManager1, this, _sceneMode, &_actor13, NULL); + _protector.setAction(&_sequenceManager1, this, _sceneMode, &_protector, NULL); + R2_GLOBALS._v558C2 = 1; _protectorSpeaker.proc16(); _protectorSpeaker._displayMode = 1; _quinnSpeaker._displayMode = 1; - _actor13.show(); + _protector.show(); + R2_GLOBALS._scrollFollower = &R2_GLOBALS._player; R2_GLOBALS._walkRegions.enableRegion(17); R2_GLOBALS._walkRegions.enableRegion(18); @@ -4668,7 +4673,8 @@ void Scene3600::signal() { R2_GLOBALS._walkRegions.disableRegion(14); R2_GLOBALS._walkRegions.disableRegion(15); R2_GLOBALS._walkRegions.disableRegion(16); - _actor13.setAction(&_action1); + + _actor3.setAction(&_action1); } break; case 3324: @@ -4676,7 +4682,7 @@ void Scene3600::signal() { case 3607: g_globals->_events.setCursor(CURSOR_ARROW); R2_GLOBALS._player.enableControl(CURSOR_WALK); - _actor13.fixPriority(-1); + _protector.fixPriority(-1); _sceneMode = 3623; _field2548 = 1; break; @@ -4689,7 +4695,8 @@ void Scene3600::signal() { R2_GLOBALS._sound1.stop(); _actor1.hide(); _actor6.hide(); - g_globals->gfxManager()._bounds.moveTo(Common::Point(40, 0)); + + _sceneBounds = Rect(40, 0, SCREEN_WIDTH + 40, SCREEN_HEIGHT); setZoomPercents(142, 80, 167, 105); loadScene(3600); R2_GLOBALS._uiElements.show(); @@ -4705,17 +4712,17 @@ void Scene3600::signal() { _actor5.setPosition(Common::Point(298, 151)); - _actor13.postInit(); - _actor13._state = 0; - _actor13._field8A = Common::Point(226, 152); - _actor13._moveDiff = Common::Point(5, 3); - _actor13.setup(3403, 7, 1); - _actor13.setPosition(Common::Point(405, 155)); - _actor13.changeZoom(-1); - _actor13.addMover(NULL); - _actor13.animate(ANIM_MODE_NONE); - _actor13.hide(); - _actor13.setDetails(3600, 15, -1, 17, 5, &_item5); + _protector.postInit(); + _protector._state = 0; + _protector._field8A = Common::Point(226, 152); + _protector._moveDiff = Common::Point(5, 3); + _protector.setup(3403, 7, 1); + _protector.setPosition(Common::Point(405, 155)); + _protector.changeZoom(-1); + _protector.addMover(NULL); + _protector.animate(ANIM_MODE_NONE); + _protector.hide(); + _protector.setDetails(3600, 15, -1, 17, 5, &_item5); _actor2.setup(3600, 2, 1); _actor2.setPosition(Common::Point(403, 161)); @@ -4726,12 +4733,12 @@ void Scene3600::signal() { _quinnSpeaker._displayMode = 2; _tealSpeaker._displayMode = 2; - if (R2_GLOBALS._player._characterIndex == 2) { + if (R2_GLOBALS._player._characterIndex == R2_SEEKER) { R2_GLOBALS._player._moveDiff = Common::Point(5, 3); R2_GLOBALS._player.setup(20, _actor11._strip, 1); R2_GLOBALS._player.setPosition(_actor11._position); _actor11.hide(); - } else if (R2_GLOBALS._player._characterIndex == 3) { + } else if (R2_GLOBALS._player._characterIndex == R2_MIRANDA) { R2_GLOBALS._player._moveDiff = Common::Point(3, 2); R2_GLOBALS._player.setup(30, _actor12._strip, 1); R2_GLOBALS._player.setPosition(_actor12._position); @@ -4779,7 +4786,7 @@ void Scene3600::signal() { _actor4.hide(); _actor5.hide(); - g_globals->gfxManager()._bounds.moveTo(Common::Point(60, 0)); + _sceneBounds = Rect(60, 0, SCREEN_WIDTH + 60, SCREEN_HEIGHT); setZoomPercents(51, 46, 180, 200); loadScene(3400); @@ -4802,8 +4809,8 @@ void Scene3600::signal() { setAction(&_sequenceManager1, this, 3450, &_actor1, &_actor6, NULL); break; case 3605: - _actor13.setup(3258, 4, 1); - _actor13.setAction(&_sequenceManager1, this, 3606, &_actor5, &_actor13, &_actor2, NULL); + _protector.setup(3258, 4, 1); + _protector.setAction(&_sequenceManager1, this, 3606, &_actor5, &_protector, &_actor2, NULL); _sceneMode = 3323; _stripManager.start(3323, this); @@ -4811,12 +4818,13 @@ void Scene3600::signal() { case 3620: // No break on purpose case 3623: - if ((_actor13._position.x == 226) && (_actor13._position.y == 152) && (_action1._field1E != 0) && (_actor13._visage == 3127) && (!R2_GLOBALS.getFlag(71))) { + if ((_protector._position.x == 226) && (_protector._position.y == 152) + && (_action1._field1E != 0) && (_protector._visage == 3127) && (!R2_GLOBALS.getFlag(71))) { R2_GLOBALS._sound2.stop(); R2_GLOBALS._sound2.play(331); R2_GLOBALS.setFlag(71); _sceneMode = 3626; - setAction(&_sequenceManager1, this, 3626, &_actor13, NULL); + setAction(&_sequenceManager1, this, 3626, &_protector, NULL); } break; case 3624: @@ -4833,7 +4841,7 @@ void Scene3600::signal() { R2_GLOBALS._sceneManager.changeScene(3700); break; case 3626: - _actor13.setPosition(Common::Point(0, 0)); + _protector.setPosition(Common::Point(0, 0)); _action1.setActionIndex(2); if (R2_GLOBALS._events.getCursor() > R2_LAST_INVENT) { R2_GLOBALS._events.setCursor(CURSOR_USE); @@ -4858,10 +4866,12 @@ void Scene3600::process(Event &event) { } void Scene3600::dispatch() { - if ((R2_GLOBALS._player.getRegionIndex() == 200) && (_action1._field1E != 0) && (_field254E == 0)){ + if ((R2_GLOBALS._player.getRegionIndex() == 200) && (_action1._field1E != 0) + && (_field254E == 0)) { R2_GLOBALS._sound2.fadeOut2(NULL); - if (_actor13._mover) - _actor13.addMover(NULL); + if (_protector._mover) + _protector.addMover(NULL); + if (R2_GLOBALS._player._action) R2_GLOBALS._player.setAction(NULL); if (R2_GLOBALS._player._mover) @@ -4883,10 +4893,10 @@ void Scene3600::dispatch() { R2_GLOBALS._player.hide(); - if (R2_GLOBALS._player._characterIndex == 2) { + if (R2_GLOBALS._player._characterIndex == R2_SEEKER) { _actor11.setPosition(R2_GLOBALS._player._position); _actor11.show(); - } else if (R2_GLOBALS._player._characterIndex == 3) { + } else if (R2_GLOBALS._player._characterIndex == R2_MIRANDA) { _actor12.setPosition(R2_GLOBALS._player._position); _actor12.show(); } else { @@ -4899,10 +4909,10 @@ void Scene3600::dispatch() { _actor4.setAction(&_sequenceManager1, this, 3613, &_actor4, NULL); } - if ((_actor13.getRegionIndex() == 200) && (_action1._field1E != 0) && (_field254E == 0)){ + if ((_protector.getRegionIndex() == 200) && (_action1._field1E != 0) && !_ghoulTeleported) { R2_GLOBALS._sound2.fadeOut2(NULL); _sceneMode = 3620; - _field2550 = 1; + _ghoulTeleported = true; R2_GLOBALS._player.disableControl(); if (R2_GLOBALS._player._mover) @@ -4916,6 +4926,7 @@ void Scene3600::dispatch() { if (_actor4._mover) _actor4.addMover(NULL); } + Scene::dispatch(); } @@ -4923,10 +4934,12 @@ void Scene3600::dispatch() { * Scene 3700 - Cutscene - Teleport outside * *--------------------------------------------------------------------------*/ + void Scene3700::postInit(SceneObjectList *OwnerList) { loadScene(3700); - R2_GLOBALS._uiElements._active = false; SceneExt::postInit(); + R2_GLOBALS._uiElements._active = false; + R2_GLOBALS._interfaceY = SCREEN_HEIGHT; _stripManager.setColors(60, 255); _stripManager.setFontNumber(3); @@ -4934,30 +4947,31 @@ void Scene3700::postInit(SceneObjectList *OwnerList) { _stripManager.addSpeaker(&_seekerSpeaker); _stripManager.addSpeaker(&_mirandaSpeaker); - _actor1.postInit(); - _actor1._moveDiff = Common::Point(3, 2); + _quinn.postInit(); + _quinn._moveDiff = Common::Point(3, 2); - _actor2.postInit(); - _actor2._numFrames = 7; - _actor2._moveDiff = Common::Point(5, 3); - _actor2.hide(); + _seeker.postInit(); + _seeker._numFrames = 7; + _seeker._moveDiff = Common::Point(5, 3); + _seeker.hide(); - _actor3.postInit(); - _actor3._moveDiff = Common::Point(3, 2); - _actor3.hide(); + _miranda.postInit(); + _miranda._moveDiff = Common::Point(3, 2); + _miranda.hide(); - _actor4.postInit(); - _actor4._numFrames = 7; - _actor4._moveDiff = Common::Point(5, 3); - _actor4.hide(); + _webbster.postInit(); + _webbster._numFrames = 7; + _webbster._moveDiff = Common::Point(5, 3); + _webbster.hide(); _actor5.postInit(); - R2_GLOBALS._player.postInit(); + R2_GLOBALS._player.disableControl(); R2_GLOBALS._sound1.play(332); _sceneMode = 3700; - setAction(&_sequenceManager, this, 3700, &_actor1, &_actor2, &_actor3, &_actor4, &_actor5, NULL); + setAction(&_sequenceManager, this, 3700, &_quinn, &_seeker, &_miranda, + &_webbster, &_actor5, NULL); } void Scene3700::remove() { @@ -4972,11 +4986,11 @@ void Scene3700::signal() { case 3329: warning("STUB: sub_1D227()"); _sceneMode = 3701; - setAction(&_sequenceManager, this, 3701, &_actor2, &_actor3, &_actor4, NULL); + setAction(&_sequenceManager, this, 3701, &_seeker, &_miranda, &_webbster, NULL); break; case 3700: - _actor1.setup(10, 6, 1); - _actor2.setup(20, 5, 1); + _quinn.setup(10, 6, 1); + _seeker.setup(20, 5, 1); if (R2_GLOBALS.getFlag(71)) { _sceneMode = 3329; _stripManager.start(3329, this); diff --git a/engines/tsage/ringworld2/ringworld2_scenes3.h b/engines/tsage/ringworld2/ringworld2_scenes3.h index 82eafdcdc2..6c7a594b12 100644 --- a/engines/tsage/ringworld2/ringworld2_scenes3.h +++ b/engines/tsage/ringworld2/ringworld2_scenes3.h @@ -547,10 +547,10 @@ public: SpeakerMiranda3400 _mirandaSpeaker; SpeakerWebbster3400 _webbsterSpeaker; SpeakerTeal3400 _tealSpeaker; - SceneActor _actor1; - SceneActor _actor2; - SceneActor _actor3; - SceneActor _actor4; + SceneActor _companion1; + SceneActor _companion2; + SceneActor _webbster; + SceneActor _teal; SceneActor _actor5; SceneActor _actor6; SceneActor _actor7; @@ -704,7 +704,7 @@ class Scene3600 : public SceneExt { virtual bool startAction(CursorType action, Event &event); }; - class Actor13 : public SceneActorExt { + class Protector : public SceneActorExt { virtual bool startAction(CursorType action, Event &event); }; public: @@ -732,7 +732,7 @@ public: SceneActor _actor10; SceneActor _actor11; SceneActor _actor12; - Actor13 _actor13; + Protector _protector; SequenceManager _sequenceManager1; SequenceManager _sequenceManager2; SequenceManager _sequenceManager3; @@ -743,7 +743,7 @@ public: int _field254A; int _field254C; int _field254E; - bool _field2550; + bool _ghoulTeleported; Scene3600(); virtual void postInit(SceneObjectList *OwnerList = NULL); @@ -759,10 +759,10 @@ public: SpeakerQuinn3700 _quinnSpeaker; SpeakerSeeker3700 _seekerSpeaker; SpeakerMiranda3700 _mirandaSpeaker; - SceneActor _actor1; - SceneActor _actor2; - SceneActor _actor3; - SceneActor _actor4; + SceneActor _quinn; + SceneActor _seeker; + SceneActor _miranda; + SceneActor _webbster; SceneActor _actor5; SequenceManager _sequenceManager; diff --git a/engines/tsage/ringworld2/ringworld2_speakers.cpp b/engines/tsage/ringworld2/ringworld2_speakers.cpp index fb10fdcac9..3091086980 100644 --- a/engines/tsage/ringworld2/ringworld2_speakers.cpp +++ b/engines/tsage/ringworld2/ringworld2_speakers.cpp @@ -541,7 +541,7 @@ void SpeakerMiranda300::proc15() { int v = _speakerMode; if (!_object2) { - if (R2_GLOBALS._player._characterIndex == 3) { + if (R2_GLOBALS._player._characterIndex == R2_MIRANDA) { _object2 = &R2_GLOBALS._player; } else { Scene300 *scene = (Scene300 *)R2_GLOBALS._sceneManager._scene; @@ -627,7 +627,7 @@ void SpeakerMiranda3375::proc15() { int v = _speakerMode; if (!_object2) { - if (R2_GLOBALS._player._characterIndex == 3) + if (R2_GLOBALS._player._characterIndex == R2_MIRANDA) _object2 = &R2_GLOBALS._player; else _object2 = &scene->_companion2; @@ -677,7 +677,7 @@ void SpeakerMiranda3385::proc15() { int v = _speakerMode; if (!_object2) { - if (R2_GLOBALS._player._characterIndex == 3) + if (R2_GLOBALS._player._characterIndex == R2_MIRANDA) _object2 = &R2_GLOBALS._player; else _object2 = &scene->_companion2; @@ -726,7 +726,7 @@ void SpeakerMiranda3395::proc15() { int v = _speakerMode; if (!_object2) { - if (R2_GLOBALS._player._characterIndex == 3) + if (R2_GLOBALS._player._characterIndex == R2_MIRANDA) _object2 = &R2_GLOBALS._player; else _object2 = &scene->_companion2; @@ -776,10 +776,10 @@ void SpeakerMiranda3400::proc15() { int v = _speakerMode; if (!_object2) { - if (R2_GLOBALS._player._characterIndex == 3) + if (R2_GLOBALS._player._characterIndex == R2_MIRANDA) _object2 = &R2_GLOBALS._player; else - _object2 = &scene->_actor2; + _object2 = &scene->_companion2; _object2->hide(); _object1.postInit(); @@ -801,12 +801,12 @@ void SpeakerMiranda3400::proc15() { case 1: ((SceneItem *)_action)->_sceneRegionId = 0; _object1.setup(4051, 5, 1); - _object1.animate(ANIM_MODE_5, NULL); + _object1.animate(ANIM_MODE_5, this); break; case 2: ((SceneItem *)_action)->_sceneRegionId = 0; _object1.setup(4050, 3, 1); - _object1.animate(ANIM_MODE_5, NULL); + _object1.animate(ANIM_MODE_5, this); break; default: signal(); @@ -820,7 +820,7 @@ void SpeakerMiranda3600::proc15() { int v = _speakerMode; if (!_object2) { - if (R2_GLOBALS._player._characterIndex == 3) + if (R2_GLOBALS._player._characterIndex == R2_MIRANDA) _object2 = &R2_GLOBALS._player; else _object2 = &scene->_actor12; @@ -866,7 +866,7 @@ void SpeakerMiranda3700::proc15() { int v = _speakerMode; if (!_object2) { - _object2 = &scene->_actor3; + _object2 = &scene->_miranda; _object2->hide(); _object1.postInit(); _object1.setPosition(_object2->_position); @@ -886,25 +886,25 @@ void SpeakerMiranda3700::proc15() { break; case 1: ((SceneItem *)_action)->_sceneRegionId = 0; - scene->_actor1.setup(10, 6, 1); - scene->_actor2.setup(20, 5, 1); + scene->_quinn.setup(10, 6, 1); + scene->_seeker.setup(20, 5, 1); _object2->setup(30, 1, 1); - scene->_actor4.setup(40, 1, 1); + scene->_webbster.setup(40, 1, 1); _object1.setup(4050, 5, 1); - _object1.animate(ANIM_MODE_5, NULL); + _object1.animate(ANIM_MODE_5, this); break; case 2: ((SceneItem *)_action)->_sceneRegionId = 0; - scene->_actor3.setup(30, 8, 1); + scene->_miranda.setup(30, 8, 1); _object1.setup(4052, 3, 1); - _object1.animate(ANIM_MODE_5, NULL); + _object1.animate(ANIM_MODE_5, this); break; case 3: ((SceneItem *)_action)->_sceneRegionId = 0; - scene->_actor2.setup(20, 1, 1); - scene->_actor3.setup(30, 1, 1); + scene->_seeker.setup(20, 1, 1); + scene->_miranda.setup(30, 1, 1); _object1.setup(4051, 7, 1); - _object1.animate(ANIM_MODE_5, NULL); + _object1.animate(ANIM_MODE_5, this); break; default: signal(); @@ -1116,7 +1116,7 @@ void SpeakerProtector3600::proc15() { Scene3600 *scene = (Scene3600 *)R2_GLOBALS._sceneManager._scene; if (!_object2) { - _object2 = &scene->_actor13; + _object2 = &scene->_protector; _object2->hide(); _object1.postInit(); _object1.setPosition(_object2->_position); @@ -1176,7 +1176,7 @@ void SpeakerQuinn300::proc15() { int v = _speakerMode; if (!_object2) { - if (R2_GLOBALS._player._characterIndex == 3) { + if (R2_GLOBALS._player._characterIndex == R2_MIRANDA) { _object2 = &R2_GLOBALS._player; } else { assert(R2_GLOBALS._sceneManager._sceneNumber == 300); @@ -1272,7 +1272,7 @@ void SpeakerQuinn1100::proc15() { if (v == 0) return; - if (R2_GLOBALS._player._characterIndex == 1) { + if (R2_GLOBALS._player._characterIndex == R2_QUINN) { _object2 = &R2_GLOBALS._player; } else { assert(R2_GLOBALS._sceneManager._sceneNumber == 1100); @@ -1318,7 +1318,7 @@ void SpeakerQuinn2435::proc15() { int v = _speakerMode; if (!_object2) { - if (R2_GLOBALS._player._characterIndex == 1) { + if (R2_GLOBALS._player._characterIndex == R2_QUINN) { _object2 = &R2_GLOBALS._player; } else { assert(R2_GLOBALS._sceneManager._sceneNumber == 2435); @@ -1345,7 +1345,7 @@ void SpeakerQuinn2450::proc15() { int v = _speakerMode; if (!_object2) { - if (R2_GLOBALS._player._characterIndex == 1) { + if (R2_GLOBALS._player._characterIndex == R2_QUINN) { _object2 = &R2_GLOBALS._player; } else { assert(R2_GLOBALS._sceneManager._sceneNumber == 2435); @@ -1500,9 +1500,9 @@ void SpeakerQuinn3375::proc15() { int v = _speakerMode; if (!_object2) { - if (R2_GLOBALS._player._characterIndex == 1) + if (R2_GLOBALS._player._characterIndex == R2_QUINN) _object2 = &R2_GLOBALS._player; - else if (R2_GLOBALS._player._characterIndex == 2) + else if (R2_GLOBALS._player._characterIndex == R2_SEEKER) _object2 = &scene->_companion1; else _object2 = &scene->_companion2; @@ -1551,9 +1551,9 @@ void SpeakerQuinn3385::proc15() { int v = _speakerMode; if (!_object2) { - if (R2_GLOBALS._player._characterIndex == 1) + if (R2_GLOBALS._player._characterIndex == R2_QUINN) _object2 = &R2_GLOBALS._player; - else if (R2_GLOBALS._player._characterIndex == 2) + else if (R2_GLOBALS._player._characterIndex == R2_SEEKER) _object2 = &scene->_companion1; else _object2 = &scene->_companion2; @@ -1587,7 +1587,7 @@ void SpeakerQuinn3385::proc15() { break; case 1: ((SceneItem *)_action)->_sceneRegionId = 0; - if (R2_GLOBALS._player._characterIndex == 2) + if (R2_GLOBALS._player._characterIndex == R2_SEEKER) _object1.setup(4010, 3, 1); else _object1.setup(4010, 5, 1); @@ -1606,9 +1606,9 @@ void SpeakerQuinn3395::proc15() { int v = _speakerMode; if (!_object2) { - if (R2_GLOBALS._player._characterIndex == 1) + if (R2_GLOBALS._player._characterIndex == R2_QUINN) _object2 = &R2_GLOBALS._player; - else if (R2_GLOBALS._player._characterIndex == 2) + else if (R2_GLOBALS._player._characterIndex == R2_SEEKER) _object2 = &scene->_companion1; else _object2 = &scene->_companion2; @@ -1642,7 +1642,7 @@ void SpeakerQuinn3395::proc15() { break; case 1: ((SceneItem *)_action)->_sceneRegionId = 0; - if (R2_GLOBALS._player._characterIndex == 2) + if (R2_GLOBALS._player._characterIndex == R2_SEEKER) _object1.setup(4010, 3, 1); else _object1.setup(4010, 5, 1); @@ -1661,12 +1661,12 @@ void SpeakerQuinn3400::proc15() { int v = _speakerMode; if (!_object2) { - if (R2_GLOBALS._player._characterIndex == 1) + if (R2_GLOBALS._player._characterIndex == R2_QUINN) _object2 = &R2_GLOBALS._player; - else if (R2_GLOBALS._player._characterIndex == 2) - _object2 = &scene->_actor1; + else if (R2_GLOBALS._player._characterIndex == R2_SEEKER) + _object2 = &scene->_companion1; else - _object2 = &scene->_actor2; + _object2 = &scene->_companion2; _object2->hide(); _object1.postInit(); @@ -1691,12 +1691,12 @@ void SpeakerQuinn3400::proc15() { case 2: ((SceneItem *)_action)->_sceneRegionId = 0; _object1.setup(4010, 3, 1); - _object1.animate(ANIM_MODE_5, NULL); + _object1.animate(ANIM_MODE_5, this); break; case 3: ((SceneItem *)_action)->_sceneRegionId = 0; _object1.setup(4012, 3, 1); - _object1.animate(ANIM_MODE_5, NULL); + _object1.animate(ANIM_MODE_5, this); break; default: signal(); @@ -1710,7 +1710,7 @@ void SpeakerQuinn3600::proc15() { int v = _speakerMode; if (!_object2) { - if (R2_GLOBALS._player._characterIndex == 1) + if (R2_GLOBALS._player._characterIndex == R2_QUINN) _object2 = &R2_GLOBALS._player; else _object2 = &scene->_actor10; @@ -1757,14 +1757,14 @@ void SpeakerQuinn3700::setText(const Common::String &msg) { switch (_speakerMode) { case 2: - scene->_actor3.setup(30, 1, 1); + scene->_miranda.setup(30, 1, 1); R2_GLOBALS._sound2.play(44); break; case 3: - scene->_actor3.setup(30, 1, 1); + scene->_miranda.setup(30, 1, 1); break; default: - scene->_actor3.setup(30, 7, 1); + scene->_miranda.setup(30, 7, 1); break; } VisualSpeaker::setText(msg); @@ -1776,7 +1776,7 @@ void SpeakerQuinn3700::proc15() { int v = _speakerMode; if (!_object2) { - _object2 = &scene->_actor1; + _object2 = &scene->_quinn; _object2->hide(); _object1.postInit(); _object1.setPosition(_object2->_position); @@ -1797,24 +1797,24 @@ void SpeakerQuinn3700::proc15() { case 1: ((SceneItem *)_action)->_sceneRegionId = 0; R2_GLOBALS._sound2.stop(); - scene->_actor1.setup(10, 4, 1); - scene->_actor3.setup(30, 7, 1); + scene->_quinn.setup(10, 4, 1); + scene->_miranda.setup(30, 7, 1); _object1.setup(3701, 1, 1); - _object1.animate(ANIM_MODE_5, NULL); + _object1.animate(ANIM_MODE_5, this); break; case 2: ((SceneItem *)_action)->_sceneRegionId = 0; - scene->_actor2.setup(20, 1, 1); - scene->_actor3.setup(30, 1, 1); - _object1.setup(3701, 2, 1); - _object1.animate(ANIM_MODE_5, NULL); + scene->_seeker.setup(20, 1, 1); + scene->_miranda.setup(30, 1, 1); + _object1.setup(3702, 1, 1); + _object1.animate(ANIM_MODE_5, this); break; case 3: ((SceneItem *)_action)->_sceneRegionId = 0; - scene->_actor1.setup(10, 2, 1); - scene->_actor3.setup(30, 1, 1); + scene->_quinn.setup(10, 2, 1); + scene->_miranda.setup(30, 1, 1); _object1.setup(4011, 1, 1); - _object1.animate(ANIM_MODE_5, NULL); + _object1.animate(ANIM_MODE_5, this); break; default: signal(); @@ -2072,7 +2072,7 @@ void SpeakerSeeker1100::proc15() { if (v == 0) return; - if (R2_GLOBALS._player._characterIndex == 2) { + if (R2_GLOBALS._player._characterIndex == R2_SEEKER) { _object2 = &R2_GLOBALS._player; } else { assert(R2_GLOBALS._sceneManager._sceneNumber == 1100); @@ -2129,7 +2129,7 @@ void SpeakerSeeker1900::proc15() { int v = _speakerMode; if (!_object2) { - if (R2_GLOBALS._player._characterIndex == 2) { + if (R2_GLOBALS._player._characterIndex == R2_SEEKER) { _object2 = &R2_GLOBALS._player; } else { assert(R2_GLOBALS._sceneManager._sceneNumber == 1900); @@ -2160,7 +2160,7 @@ void SpeakerSeeker2435::proc15() { int v = _speakerMode; if (!_object2) { - if (R2_GLOBALS._player._characterIndex == 2) { + if (R2_GLOBALS._player._characterIndex == R2_SEEKER) { _object2 = &R2_GLOBALS._player; } else { assert(R2_GLOBALS._sceneManager._sceneNumber == 2435); @@ -2187,7 +2187,7 @@ void SpeakerSeeker2450::proc15() { int v = _speakerMode; if (!_object2) { - if (R2_GLOBALS._player._characterIndex == 2) { + if (R2_GLOBALS._player._characterIndex == R2_SEEKER) { _object2 = &R2_GLOBALS._player; } else { assert(R2_GLOBALS._sceneManager._sceneNumber == 2450); @@ -2362,10 +2362,10 @@ void SpeakerSeeker3400::proc15() { int v = _speakerMode; if (!_object2) { - if (R2_GLOBALS._player._characterIndex == 2) + if (R2_GLOBALS._player._characterIndex == R2_SEEKER) _object2 = &R2_GLOBALS._player; else - _object2 = &scene->_actor1; + _object2 = &scene->_companion1; _object2->hide(); _object1.postInit(); @@ -2387,27 +2387,27 @@ void SpeakerSeeker3400::proc15() { case 1: ((SceneItem *)_action)->_sceneRegionId = 0; _object1.setup(4031, 1, 1); - _object1.animate(ANIM_MODE_5, NULL); + _object1.animate(ANIM_MODE_5, this); break; case 2: ((SceneItem *)_action)->_sceneRegionId = 0; _object1.setup(4031, 3, 1); - _object1.animate(ANIM_MODE_5, NULL); + _object1.animate(ANIM_MODE_5, this); break; case 3: ((SceneItem *)_action)->_sceneRegionId = 0; _object1.setup(4030, 3, 1); - _object1.animate(ANIM_MODE_5, NULL); + _object1.animate(ANIM_MODE_5, this); break; case 4: ((SceneItem *)_action)->_sceneRegionId = 0; _object1.setup(4031, 7, 1); - _object1.animate(ANIM_MODE_5, NULL); + _object1.animate(ANIM_MODE_5, this); break; case 5: ((SceneItem *)_action)->_sceneRegionId = 0; _object1.setup(4033, 1, 1); - _object1.animate(ANIM_MODE_5, NULL); + _object1.animate(ANIM_MODE_5, this); break; default: signal(); @@ -2421,7 +2421,7 @@ void SpeakerSeeker3600::proc15() { int v = _speakerMode; if (!_object2) { - if (R2_GLOBALS._player._characterIndex == 2) + if (R2_GLOBALS._player._characterIndex == R2_SEEKER) _object2 = &R2_GLOBALS._player; else _object2 = &scene->_actor11; @@ -2467,10 +2467,11 @@ void SpeakerSeeker3700::setText(const Common::String &msg) { if (_speakerMode == 1) { R2_GLOBALS._sound2.play(44); - scene->_actor3.setup(30, 8, 1); + scene->_miranda.setup(30, 8, 1); } else { - scene->_actor3.setup(30, 2, 1); + scene->_miranda.setup(30, 2, 1); } + VisualSpeaker::setText(msg); } @@ -2480,7 +2481,7 @@ void SpeakerSeeker3700::proc15() { int v = _speakerMode; if (!_object2) { - _object2 = &scene->_actor2; + _object2 = &scene->_seeker; _object2->hide(); _object1.postInit(); _object1.setPosition(_object2->_position); @@ -2501,19 +2502,19 @@ void SpeakerSeeker3700::proc15() { case 1: ((SceneItem *)_action)->_sceneRegionId = 0; R2_GLOBALS._sound2.stop(); - scene->_actor1.setup(10, 8, 1); - scene->_actor2.setup(20, 7, 1); - scene->_actor3.setup(30, 8, 1); + scene->_quinn.setup(10, 8, 1); + scene->_seeker.setup(20, 7, 1); + scene->_miranda.setup(30, 8, 1); _object1.setup(3701, 3, 1); - _object1.animate(ANIM_MODE_5, NULL); + _object1.animate(ANIM_MODE_5, this); break; case 2: ((SceneItem *)_action)->_sceneRegionId = 0; - scene->_actor1.setup(10, 2, 1); - scene->_actor2.setup(20, 1, 1); - scene->_actor3.setup(30, 1, 1); + scene->_quinn.setup(10, 2, 1); + scene->_seeker.setup(20, 1, 1); + scene->_miranda.setup(30, 1, 1); _object1.setup(4031, 1, 1); - _object1.animate(ANIM_MODE_5, NULL); + _object1.animate(ANIM_MODE_5, this); break; default: signal(); @@ -2637,6 +2638,41 @@ SpeakerTealMode7::SpeakerTealMode7(): SpeakerTeal() { _displayMode = 7; } +void SpeakerTeal180::proc15() { + int v = _speakerMode; + + if (!_object2) { + Scene180 *scene = (Scene180 *)R2_GLOBALS._sceneManager._scene; + _object2 = &scene->_teal; + _object2->hide(); + + _object1.postInit(); + _object1.setPosition(_object2->_position); + + if (_object2->_mover) + _object2->addMover(NULL); + } + + switch (v) { + case 0: + _object1.animate(ANIM_MODE_2, NULL); + break; + case 1: + ((SceneItem *)_action)->_sceneRegionId = 0; + _object1.setup(75, 5, 1); + _object1.animate(ANIM_MODE_5, this); + break; + case 2: + ((SceneItem *)_action)->_sceneRegionId = 0; + _object1.setup(77, 1, 1); + _object1.animate(ANIM_MODE_5, this); + break; + default: + signal(); + break; + } +} + void SpeakerTeal300::proc15() { int v = _speakerMode; @@ -2714,7 +2750,7 @@ void SpeakerTeal3400::proc15() { int v = _speakerMode; if (!_object2) { - _object2 = &scene->_actor4; + _object2 = &scene->_teal; _object2->hide(); _object1.postInit(); _object1._numFrames = 7; @@ -2731,8 +2767,8 @@ void SpeakerTeal3400::proc15() { if (scene ->_sceneMode == 3305) { R2_GLOBALS._player.setStrip(6); - scene->_actor1.setStrip(6); - scene->_actor2.setStrip(6); + scene->_companion1.setStrip(6); + scene->_companion2.setStrip(6); } switch (v) { @@ -2742,22 +2778,22 @@ void SpeakerTeal3400::proc15() { case 1: ((SceneItem *)_action)->_sceneRegionId = 0; _object1.setup(4107, 5, 1); - _object1.animate(ANIM_MODE_5, NULL); + _object1.animate(ANIM_MODE_5, this); break; case 2: ((SceneItem *)_action)->_sceneRegionId = 0; _object1.setup(4107, 1, 1); - _object1.animate(ANIM_MODE_5, NULL); + _object1.animate(ANIM_MODE_5, this); break; case 3: ((SceneItem *)_action)->_sceneRegionId = 0; _object1.setup(4107, 7, 1); - _object1.animate(ANIM_MODE_5, NULL); + _object1.animate(ANIM_MODE_5, this); break; case 4: ((SceneItem *)_action)->_sceneRegionId = 0; _object1.setup(4107, 3, 1); - _object1.animate(ANIM_MODE_5, NULL); + _object1.animate(ANIM_MODE_5, this); break; default: signal(); @@ -2889,6 +2925,47 @@ SpeakerWebbster::SpeakerWebbster(int color) { _numFrames = 0; } +void SpeakerWebbster180::proc15() { + Scene3375 *scene = (Scene3375 *)R2_GLOBALS._sceneManager._scene; + + int v = _speakerMode; + + if (!_object2) { + _object2 = &scene->_webbster; + _object2->hide(); + _object1.postInit(); + _object1.setPosition(_object2->_position); + _object1._numFrames = 6; + + if (_object2->_mover) + _object2->addMover(NULL); + } + + switch (v) { + case 0: + _object1.animate(ANIM_MODE_2, NULL); + break; + case 1: + ((SceneItem *)_action)->_sceneRegionId = 0; + _object1.setup(75, 7, 1); + _object1.animate(ANIM_MODE_5, this); + break; + case 2: + ((SceneItem *)_action)->_sceneRegionId = 0; + _object1.setup(76, 4, 1); + _object1.animate(ANIM_MODE_5, this); + break; + case 3: + ((SceneItem *)_action)->_sceneRegionId = 0; + _object1.setup(75, 6, 1); + _object1.animate(ANIM_MODE_5, this); + break; + default: + signal(); + break; + } +} + void SpeakerWebbster3240::proc15() { int v = _speakerMode; Scene3240 *scene = (Scene3240 *)R2_GLOBALS._sceneManager._scene; @@ -3050,7 +3127,7 @@ void SpeakerWebbster3400::proc15() { int v = _speakerMode; if (!_object2) { - _object2 = &scene->_actor3; + _object2 = &scene->_webbster; _object2->hide(); _object1.postInit(); _object1.setPosition(_object2->_position); @@ -3071,17 +3148,17 @@ void SpeakerWebbster3400::proc15() { case 1: ((SceneItem *)_action)->_sceneRegionId = 0; _object1.setup(4110, 5, 1); - _object1.animate(ANIM_MODE_5, NULL); + _object1.animate(ANIM_MODE_5, this); break; case 2: ((SceneItem *)_action)->_sceneRegionId = 0; _object1.setup(4110, 7, 1); - _object1.animate(ANIM_MODE_5, NULL); + _object1.animate(ANIM_MODE_5, this); break; case 3: ((SceneItem *)_action)->_sceneRegionId = 0; _object1.setup(4110, 3, 1); - _object1.animate(ANIM_MODE_5, NULL); + _object1.animate(ANIM_MODE_5, this); break; default: signal(); @@ -3091,7 +3168,7 @@ void SpeakerWebbster3400::proc15() { //---------------------------------------------------------------------------- -SpeakerDutyOfficer::SpeakerDutyOfficer(): VisualSpeaker() { +SpeakerDutyOfficer180::SpeakerDutyOfficer180(): VisualSpeaker() { _speakerName = "DUTYOFFICER"; _color1 = 5; _color2 = 0; @@ -3103,13 +3180,13 @@ SpeakerDutyOfficer::SpeakerDutyOfficer(): VisualSpeaker() { _numFrames = 0; } -void SpeakerDutyOfficer::proc15() { +void SpeakerDutyOfficer180::proc15() { Scene180 *scene = (Scene180 *)R2_GLOBALS._sceneManager._scene; int v = _speakerMode; if (!_object2) { - _object2 = &scene->_object2; + _object2 = &scene->_dutyOfficer; _object2->hide(); _object1.postInit(); _object1.setPosition(_object2->_position); diff --git a/engines/tsage/ringworld2/ringworld2_speakers.h b/engines/tsage/ringworld2/ringworld2_speakers.h index 4dfb500f2d..1b87606381 100644 --- a/engines/tsage/ringworld2/ringworld2_speakers.h +++ b/engines/tsage/ringworld2/ringworld2_speakers.h @@ -547,6 +547,12 @@ public: virtual Common::String getClassName() { return "SpeakerTealMode7"; } }; +class SpeakerTeal180 : public SpeakerTeal { +public: + virtual Common::String getClassName() { return "SpeakerTeal180"; } + virtual void proc15(); +}; + class SpeakerTeal300 : public SpeakerTeal { public: virtual Common::String getClassName() { return "SpeakerTeal300"; } @@ -595,6 +601,13 @@ public: virtual Common::String getClassName() { return "SpeakerWebbster"; } }; +class SpeakerWebbster180 : public SpeakerWebbster { +public: + SpeakerWebbster180() : SpeakerWebbster(27) {} + virtual Common::String getClassName() { return "SpeakerWebbster180"; } + virtual void proc15(); +}; + class SpeakerWebbster2500 : public SpeakerWebbster { public: SpeakerWebbster2500() : SpeakerWebbster(27) {} @@ -641,9 +654,9 @@ public: virtual void proc15(); }; -class SpeakerDutyOfficer: public VisualSpeaker { +class SpeakerDutyOfficer180: public VisualSpeaker { public: - SpeakerDutyOfficer(); + SpeakerDutyOfficer180(); virtual Common::String getClassName() { return "SpeakerDutyOfficer"; } virtual void proc15(); diff --git a/engines/tsage/staticres.cpp b/engines/tsage/staticres.cpp index 2c5e8e57a0..662efa19b4 100644 --- a/engines/tsage/staticres.cpp +++ b/engines/tsage/staticres.cpp @@ -229,6 +229,7 @@ char const *const RESTORE_GAME = "Restore game"; char const *const SHOW_CREDITS = "Show credits"; char const *const PAUSE_GAME = "Pause game"; char const *const RESUME_PLAY = " Resume play "; +char const *const R2_RESTART_MSG = "Go to the beginning of game?"; char const *const F2 = "F2"; char const *const F3 = "F3"; char const *const F4 = "F4"; diff --git a/engines/tsage/staticres.h b/engines/tsage/staticres.h index b6c5d5e72a..7d97f2824d 100644 --- a/engines/tsage/staticres.h +++ b/engines/tsage/staticres.h @@ -182,6 +182,7 @@ extern char const *const RESTORE_GAME; extern char const *const SHOW_CREDITS; extern char const *const PAUSE_GAME; extern char const *const RESUME_PLAY; +extern char const *const R2_RESTART_MSG; extern char const *const F2; extern char const *const F3; extern char const *const F4; diff --git a/engines/wintermute/ad/ad_inventory_box.cpp b/engines/wintermute/ad/ad_inventory_box.cpp index d703de1714..313da99a28 100644 --- a/engines/wintermute/ad/ad_inventory_box.cpp +++ b/engines/wintermute/ad/ad_inventory_box.cpp @@ -120,8 +120,8 @@ bool AdInventoryBox::display() { if (_closeButton) { _closeButton->_posX = _closeButton->_posY = 0; - _closeButton->_width = _gameRef->_renderer->getWidth(); - _closeButton->_height = _gameRef->_renderer->getHeight(); + _closeButton->setWidth(_gameRef->_renderer->getWidth()); + _closeButton->setHeight(_gameRef->_renderer->getHeight()); _closeButton->display(); } @@ -323,7 +323,7 @@ bool AdInventoryBox::loadBuffer(byte *buffer, bool complete) { if (_window) { for (uint32 i = 0; i < _window->_widgets.size(); i++) { - if (!_window->_widgets[i]->_listenerObject) { + if (!_window->_widgets[i]->getListener()) { _window->_widgets[i]->setListener(this, _window->_widgets[i], 0); } } diff --git a/engines/wintermute/ad/ad_item.h b/engines/wintermute/ad/ad_item.h index dd7039db43..f074e5ac4e 100644 --- a/engines/wintermute/ad/ad_item.h +++ b/engines/wintermute/ad/ad_item.h @@ -35,6 +35,8 @@ namespace Wintermute { class AdItem : public AdTalkHolder { + using Wintermute::AdObject::display; + public: bool update(); DECLARE_PERSISTENT(AdItem, AdTalkHolder) diff --git a/engines/wintermute/ad/ad_response_box.cpp b/engines/wintermute/ad/ad_response_box.cpp index 9d7c17ac74..9fcc33e2d1 100644 --- a/engines/wintermute/ad/ad_response_box.cpp +++ b/engines/wintermute/ad/ad_response_box.cpp @@ -121,12 +121,12 @@ void AdResponseBox::clearButtons() { ////////////////////////////////////////////////////////////////////////// bool AdResponseBox::invalidateButtons() { for (uint32 i = 0; i < _respButtons.size(); i++) { - _respButtons[i]->_image = nullptr; - _respButtons[i]->_cursor = nullptr; - _respButtons[i]->_font = nullptr; - _respButtons[i]->_fontHover = nullptr; - _respButtons[i]->_fontPress = nullptr; + _respButtons[i]->setImage(nullptr); + _respButtons[i]->setFont(nullptr); _respButtons[i]->setText(""); + _respButtons[i]->_cursor = nullptr; + _respButtons[i]->setFontHover(nullptr); + _respButtons[i]->setFontPress(nullptr); } return STATUS_OK; } @@ -141,16 +141,17 @@ bool AdResponseBox::createButtons() { UIButton *btn = new UIButton(_gameRef); if (btn) { btn->_parent = _window; - btn->_sharedFonts = btn->_sharedImages = true; + btn->setSharedFonts(true); + btn->setSharedImages(true); btn->_sharedCursors = true; // iconic if (_responses[i]->getIcon()) { - btn->_image = _responses[i]->getIcon(); + btn->setImage(_responses[i]->getIcon()); if (_responses[i]->getIconHover()) { - btn->_imageHover = _responses[i]->getIconHover(); + btn->setImageHover(_responses[i]->getIconHover()); } if (_responses[i]->getIconPressed()) { - btn->_imagePress = _responses[i]->getIconPressed(); + btn->setImagePress(_responses[i]->getIconPressed()); } btn->setCaption(_responses[i]->getText()); @@ -163,23 +164,30 @@ bool AdResponseBox::createButtons() { // textual else { btn->setText(_responses[i]->getText()); - btn->_font = (_font == nullptr) ? _gameRef->getSystemFont() : _font; - btn->_fontHover = (_fontHover == nullptr) ? _gameRef->getSystemFont() : _fontHover; - btn->_fontPress = btn->_fontHover; - btn->_align = _align; + if (_font == nullptr) { + btn->setFont(_gameRef->getSystemFont()); + } else { + btn->setFont(_font); + } + btn->setFontHover((_fontHover == nullptr) ? _gameRef->getSystemFont() : _fontHover); + btn->setFontPress(btn->getFontHover()); + btn->setTextAlign(_align); if (_gameRef->_touchInterface) { - btn->_fontHover = btn->_font; + btn->setFontHover(btn->getFont()); } if (_responses[i]->getFont()) { - btn->_font = _responses[i]->getFont(); + btn->setFont(_responses[i]->getFont()); } - btn->_width = _responseArea.right - _responseArea.left; - if (btn->_width <= 0) { - btn->_width = _gameRef->_renderer->getWidth(); + int width = _responseArea.right - _responseArea.left; + + if (width <= 0) { + btn->setWidth(_gameRef->_renderer->getWidth()); + } else { + btn->setWidth(width); } } btn->setName("response"); @@ -187,17 +195,17 @@ bool AdResponseBox::createButtons() { // make the responses touchable if (_gameRef->_touchInterface) { - btn->_height = MAX<int32>(btn->_height, 50); + btn->setHeight(MAX<int32>(btn->getHeight(), 50)); } //btn->SetListener(this, btn, _responses[i]->_iD); btn->setListener(this, btn, i); - btn->_visible = false; + btn->setVisible(false); _respButtons.add(btn); - if (_responseArea.bottom - _responseArea.top < btn->_height) { + if (_responseArea.bottom - _responseArea.top < btn->getHeight()) { _gameRef->LOG(0, "Warning: Response '%s' is too high to be displayed within response box. Correcting.", _responses[i]->getText()); - _responseArea.bottom += (btn->_height - (_responseArea.bottom - _responseArea.top)); + _responseArea.bottom += (btn->getHeight() - (_responseArea.bottom - _responseArea.top)); } } } @@ -368,7 +376,7 @@ bool AdResponseBox::loadBuffer(byte *buffer, bool complete) { if (_window) { for (uint32 i = 0; i < _window->_widgets.size(); i++) { - if (!_window->_widgets[i]->_listenerObject) { + if (!_window->_widgets[i]->getListener()) { _window->_widgets[i]->setListener(this, _window->_widgets[i], 0); } } @@ -461,7 +469,7 @@ bool AdResponseBox::display() { if (!_horizontal) { int totalHeight = 0; for (i = 0; i < _respButtons.size(); i++) { - totalHeight += (_respButtons[i]->_height + _spacing); + totalHeight += (_respButtons[i]->getHeight() + _spacing); } totalHeight -= _spacing; @@ -487,22 +495,22 @@ bool AdResponseBox::display() { // prepare response buttons bool scrollNeeded = false; for (i = _scrollOffset; i < _respButtons.size(); i++) { - if ((_horizontal && xxx + _respButtons[i]->_width > rect.right) - || (!_horizontal && yyy + _respButtons[i]->_height > rect.bottom)) { + if ((_horizontal && xxx + _respButtons[i]->getWidth() > rect.right) + || (!_horizontal && yyy + _respButtons[i]->getHeight() > rect.bottom)) { scrollNeeded = true; - _respButtons[i]->_visible = false; + _respButtons[i]->setVisible(false); break; } - _respButtons[i]->_visible = true; + _respButtons[i]->setVisible(true); _respButtons[i]->_posX = xxx; _respButtons[i]->_posY = yyy; if (_horizontal) { - xxx += (_respButtons[i]->_width + _spacing); + xxx += (_respButtons[i]->getWidth() + _spacing); } else { - yyy += (_respButtons[i]->_height + _spacing); + yyy += (_respButtons[i]->getHeight() + _spacing); } } @@ -515,8 +523,8 @@ bool AdResponseBox::display() { // go exclusive if (_shieldWindow) { _shieldWindow->_posX = _shieldWindow->_posY = 0; - _shieldWindow->_width = _gameRef->_renderer->getWidth(); - _shieldWindow->_height = _gameRef->_renderer->getHeight(); + _shieldWindow->setWidth(_gameRef->_renderer->getWidth()); + _shieldWindow->setHeight(_gameRef->_renderer->getHeight()); _shieldWindow->display(); } diff --git a/engines/wintermute/ad/ad_scene.cpp b/engines/wintermute/ad/ad_scene.cpp index 668b39853b..46badee92b 100644 --- a/engines/wintermute/ad/ad_scene.cpp +++ b/engines/wintermute/ad/ad_scene.cpp @@ -1014,8 +1014,8 @@ bool AdScene::traverseNodes(bool doUpdate) { } if (_shieldWindow) { _shieldWindow->_posX = _shieldWindow->_posY = 0; - _shieldWindow->_width = _gameRef->_renderer->getWidth(); - _shieldWindow->_height = _gameRef->_renderer->getHeight(); + _shieldWindow->setWidth(_gameRef->_renderer->getWidth()); + _shieldWindow->setHeight(_gameRef->_renderer->getHeight()); _shieldWindow->display(); } } diff --git a/engines/wintermute/base/base_game.cpp b/engines/wintermute/base/base_game.cpp index b2c05d271d..38fb668f8e 100644 --- a/engines/wintermute/base/base_game.cpp +++ b/engines/wintermute/base/base_game.cpp @@ -573,7 +573,7 @@ bool BaseGame::initLoop() { _focusedWindow = nullptr; for (int i = _windows.size() - 1; i >= 0; i--) { - if (_windows[i]->_visible) { + if (_windows[i]->isVisible()) { _focusedWindow = _windows[i]; break; } @@ -3019,10 +3019,10 @@ bool BaseGame::displayWindows(bool inGame) { bool res; // did we lose focus? focus topmost window - if (_focusedWindow == nullptr || !_focusedWindow->_visible || _focusedWindow->_disable) { + if (_focusedWindow == nullptr || !_focusedWindow->isVisible() || _focusedWindow->isDisabled()) { _focusedWindow = nullptr; for (int i = _windows.size() - 1; i >= 0; i--) { - if (_windows[i]->_visible && !_windows[i]->_disable) { + if (_windows[i]->isVisible() && !_windows[i]->isDisabled()) { _focusedWindow = _windows[i]; break; } @@ -3031,7 +3031,7 @@ bool BaseGame::displayWindows(bool inGame) { // display all windows for (uint32 i = 0; i < _windows.size(); i++) { - if (_windows[i]->_visible && _windows[i]->_inGame == inGame) { + if (_windows[i]->isVisible() && _windows[i]->getInGame() == inGame) { res = _windows[i]->display(); if (DID_FAIL(res)) { @@ -3131,7 +3131,7 @@ bool BaseGame::focusWindow(UIWindow *window) { _gameRef->_focusedWindow = window; } - if (window->_mode == WINDOW_NORMAL && prev != window && _gameRef->validObject(prev) && (prev->_mode == WINDOW_EXCLUSIVE || prev->_mode == WINDOW_SYSTEM_EXCLUSIVE)) { + if (window->getMode() == WINDOW_NORMAL && prev != window && _gameRef->validObject(prev) && (prev->getMode() == WINDOW_EXCLUSIVE || prev->getMode() == WINDOW_SYSTEM_EXCLUSIVE)) { return focusWindow(prev); } else { return STATUS_OK; diff --git a/engines/wintermute/base/font/base_font_truetype.cpp b/engines/wintermute/base/font/base_font_truetype.cpp index b6f372f377..8e0eb8a004 100644 --- a/engines/wintermute/base/font/base_font_truetype.cpp +++ b/engines/wintermute/base/font/base_font_truetype.cpp @@ -286,6 +286,26 @@ BaseSurface *BaseFontTT::renderTextToTexture(const WideString &text, int width, BaseSurface *retSurface = _gameRef->_renderer->createSurface(); Graphics::Surface *convertedSurface = surface->convertTo(_gameRef->_renderer->getPixelFormat()); + + if (_deletableFont) { + // Reconstruct the alpha channel of the font. + + // Since we painted it with color 0xFFFFFFFF onto a black background, + // the alpha channel is gone, but the color value of each pixel corresponds + // to its original alpha value. + + Graphics::PixelFormat format = _gameRef->_renderer->getPixelFormat(); + uint32 *pixels = (uint32 *)convertedSurface->getPixels(); + + // This is a Surface we created ourselves, so no empty space between rows. + for (int i = 0; i < surface->w * surface->h; ++i) { + uint8 a, r, g, b; + format.colorToRGB(*pixels, r, g, b); + a = r; + *pixels++ = format.ARGBToColor(a, r, g, b); + } + } + retSurface->putSurface(*convertedSurface, true); convertedSurface->free(); surface->free(); diff --git a/engines/wintermute/base/gfx/osystem/base_render_osystem.cpp b/engines/wintermute/base/gfx/osystem/base_render_osystem.cpp index b8e35d9724..39691628ab 100644 --- a/engines/wintermute/base/gfx/osystem/base_render_osystem.cpp +++ b/engines/wintermute/base/gfx/osystem/base_render_osystem.cpp @@ -58,7 +58,6 @@ BaseRenderOSystem::BaseRenderOSystem(BaseGame *inGame) : BaseRenderer(inGame) { _borderLeft = _borderRight = _borderTop = _borderBottom = 0; _ratioX = _ratioY = 1.0f; - _colorMod = kDefaultRgbaMod; _dirtyRect = nullptr; _disableDirtyRects = false; if (ConfMan.hasKey("dirty_rects")) { @@ -261,7 +260,6 @@ void BaseRenderOSystem::drawSurface(BaseSurfaceOSystem *owner, const Graphics::S if (_disableDirtyRects) { RenderTicket *ticket = new RenderTicket(owner, surf, srcRect, dstRect, transform); - ticket->_transform._rgbaMod = _colorMod; ticket->_wantsDraw = true; _renderQueue.push_back(ticket); drawFromSurface(ticket); @@ -289,7 +287,6 @@ void BaseRenderOSystem::drawSurface(BaseSurfaceOSystem *owner, const Graphics::S for (it = _lastAddedTicket; it != endIterator; ++it) { compareTicket = *it; if (*(compareTicket) == compare && compareTicket->_isValid) { - compareTicket->_transform._rgbaMod = transform._rgbaMod; if (_disableDirtyRects) { drawFromSurface(compareTicket); } else { @@ -397,9 +394,6 @@ void BaseRenderOSystem::drawTickets() { } return; } - // The color-mods are stored in the RenderTickets on add, since we set that state again during - // draw, we need to keep track of what it was prior to draw. - uint32 oldColorMod = _colorMod; // Apply the clear-color to the dirty rect. _renderSurface->fillRect(*_dirtyRect, _clearColor); @@ -420,7 +414,6 @@ void BaseRenderOSystem::drawTickets() { // convert from screen-coords to surface-coords. dstClip.translate(-offsetX, -offsetY); - _colorMod = ticket->_transform._rgbaMod; drawFromSurface(ticket, &pos, &dstClip); _needsFlip = true; } @@ -429,9 +422,6 @@ void BaseRenderOSystem::drawTickets() { } g_system->copyRectToScreen((byte *)_renderSurface->getBasePtr(_dirtyRect->left, _dirtyRect->top), _renderSurface->pitch, _dirtyRect->left, _dirtyRect->top, _dirtyRect->width(), _dirtyRect->height()); - // Revert the colorMod-state. - _colorMod = oldColorMod; - it = _renderQueue.begin(); // Clean out the old tickets while (it != _renderQueue.end()) { diff --git a/engines/wintermute/base/gfx/osystem/base_render_osystem.h b/engines/wintermute/base/gfx/osystem/base_render_osystem.h index a6634d9acc..de977916fd 100644 --- a/engines/wintermute/base/gfx/osystem/base_render_osystem.h +++ b/engines/wintermute/base/gfx/osystem/base_render_osystem.h @@ -145,7 +145,6 @@ private: bool _disableDirtyRects; float _ratioX; float _ratioY; - uint32 _colorMod; uint32 _clearColor; bool _skipThisFrame; diff --git a/engines/wintermute/base/gfx/osystem/render_ticket.cpp b/engines/wintermute/base/gfx/osystem/render_ticket.cpp index 11a4921f97..7a926c3e36 100644 --- a/engines/wintermute/base/gfx/osystem/render_ticket.cpp +++ b/engines/wintermute/base/gfx/osystem/render_ticket.cpp @@ -110,9 +110,9 @@ void RenderTicket::drawToSurface(Graphics::Surface *_targetSurface) const { if (_owner) { if (_transform._alphaDisable) { - src._alphaMode = TransparentSurface::ALPHA_OPAQUE; + src.setAlphaMode(TransparentSurface::ALPHA_OPAQUE); } else { - src._alphaMode = _owner->getAlphaType(); + src.setAlphaMode(_owner->getAlphaType()); } } @@ -142,9 +142,9 @@ void RenderTicket::drawToSurface(Graphics::Surface *_targetSurface, Common::Rect if (_owner) { if (_transform._alphaDisable) { - src._alphaMode = TransparentSurface::ALPHA_OPAQUE; + src.setAlphaMode(TransparentSurface::ALPHA_OPAQUE); } else { - src._alphaMode = _owner->getAlphaType(); + src.setAlphaMode(_owner->getAlphaType()); } } diff --git a/engines/wintermute/graphics/transparent_surface.cpp b/engines/wintermute/graphics/transparent_surface.cpp index 411ff1f477..b03bc4264b 100644 --- a/engines/wintermute/graphics/transparent_surface.cpp +++ b/engines/wintermute/graphics/transparent_surface.cpp @@ -758,4 +758,11 @@ void TransparentSurface::applyColorKey(uint8 rKey, uint8 gKey, uint8 bKey, bool } } +TransparentSurface::AlphaType TransparentSurface::getAlphaMode() const { + return _alphaMode; +} + +void TransparentSurface::setAlphaMode(TransparentSurface::AlphaType mode) { + _alphaMode = mode; +} } // End of namespace Wintermute diff --git a/engines/wintermute/graphics/transparent_surface.h b/engines/wintermute/graphics/transparent_surface.h index 821b5c5943..5f44cf0c4c 100644 --- a/engines/wintermute/graphics/transparent_surface.h +++ b/engines/wintermute/graphics/transparent_surface.h @@ -101,8 +101,6 @@ struct TransparentSurface : public Graphics::Surface { ALPHA_FULL = 2 }; - AlphaType _alphaMode; - #ifdef SCUMM_LITTLE_ENDIAN static const int kAIndex = 0; static const int kBIndex = 1; @@ -180,6 +178,11 @@ struct TransparentSurface : public Graphics::Surface { * */ TransparentSurface *rotoscale(const TransformStruct &transform) const; + AlphaType getAlphaMode() const; + void setAlphaMode(AlphaType); +private: + AlphaType _alphaMode; + }; /** diff --git a/engines/wintermute/ui/ui_button.cpp b/engines/wintermute/ui/ui_button.cpp index b2e6c3953b..66cee8a50c 100644 --- a/engines/wintermute/ui/ui_button.cpp +++ b/engines/wintermute/ui/ui_button.cpp @@ -660,7 +660,7 @@ bool UIButton::display(int offsetX, int offsetY) { _hover = (!_disable && _gameRef->_activeObject == this && (_gameRef->_interactive || _gameRef->_state == GAME_SEMI_FROZEN)); if ((_press && _hover && !_gameRef->_mouseLeftDown) || - (_oneTimePress && g_system->getMillis() - _oneTimePressTime >= 100)) { + (_oneTimePress && g_system->getMillis() - _oneTimePressTime >= 100)) { press(); } @@ -1206,4 +1206,28 @@ bool UIButton::persist(BasePersistenceManager *persistMgr) { return STATUS_OK; } +void UIButton::setFontHover(BaseFont *font) { + _fontHover = font; +} + +BaseFont *UIButton::getFontHover() { + return _fontHover; +} + +void UIButton::setFontPress(BaseFont *font) { + _fontPress = font; +} + +void UIButton::setImageHover(BaseSprite *sprite) { + _imageHover = sprite; +} + +void UIButton::setImagePress(BaseSprite *sprite) { + _imagePress = sprite; +} + +void UIButton::setTextAlign(TTextAlign align) { + _align = align; +} + } // End of namespace Wintermute diff --git a/engines/wintermute/ui/ui_button.h b/engines/wintermute/ui/ui_button.h index b5002f3166..542a50d35a 100644 --- a/engines/wintermute/ui/ui_button.h +++ b/engines/wintermute/ui/ui_button.h @@ -37,31 +37,14 @@ namespace Wintermute { class UIButton : public UIObject { public: - bool _pixelPerfect; - bool _stayPressed; - bool _centerImage; - bool _oneTimePress; - uint32 _oneTimePressTime; + DECLARE_PERSISTENT(UIButton, UIObject) void press(); virtual bool display() { return display(0, 0); } virtual bool display(int offsetX, int offsetY); - bool _press; - bool _hover; + void correctSize(); - TTextAlign _align; - BaseSprite *_imageHover; - BaseSprite *_imagePress; - BaseSprite *_imageDisable; - BaseSprite *_imageFocus; - BaseFont *_fontDisable; - BaseFont *_fontPress; - BaseFont *_fontHover; - BaseFont *_fontFocus; - UITiledImage *_backPress; - UITiledImage *_backHover; - UITiledImage *_backDisable; - UITiledImage *_backFocus; + UIButton(BaseGame *inGame = nullptr); virtual ~UIButton(); bool loadFile(const char *filename); @@ -73,6 +56,39 @@ public: virtual bool scSetProperty(const char *name, ScValue *value) override; virtual bool scCallMethod(ScScript *script, ScStack *stack, ScStack *thisStack, const char *name) override; virtual const char *scToString() override; + + + void setFontHover(BaseFont *font); + BaseFont *getFontHover(); + void setFontPress(BaseFont *font); + + void setTextAlign(TTextAlign align); + + void setImageHover(BaseSprite *sprite); + void setImagePress(BaseSprite *sprite); + +private: + bool _pixelPerfect; + bool _stayPressed; + bool _centerImage; + bool _oneTimePress; + UITiledImage *_backPress; + UITiledImage *_backHover; + UITiledImage *_backDisable; + UITiledImage *_backFocus; + bool _press; + bool _hover; + BaseFont *_fontDisable; + BaseFont *_fontPress; + BaseFont *_fontHover; + BaseFont *_fontFocus; + BaseSprite *_imageHover; + BaseSprite *_imagePress; + BaseSprite *_imageDisable; + BaseSprite *_imageFocus; + uint32 _oneTimePressTime; + TTextAlign _align; + }; } // End of namespace Wintermute diff --git a/engines/wintermute/ui/ui_edit.cpp b/engines/wintermute/ui/ui_edit.cpp index caed157e0b..502685f0f1 100644 --- a/engines/wintermute/ui/ui_edit.cpp +++ b/engines/wintermute/ui/ui_edit.cpp @@ -627,9 +627,9 @@ bool UIEdit::display(int offsetX, int offsetY) { curFirst = true; } else { while (font->getTextWidth((byte *)_text + _scrollOffset, MAX<int32>(0, _selStart - _scrollOffset)) + - sfont->getTextWidth((byte *)(_text + MAX<int32>(_scrollOffset, _selStart)), _selEnd - MAX(_scrollOffset, _selStart)) + sfont->getTextWidth((byte *)(_text + MAX<int32>(_scrollOffset, _selStart)), _selEnd - MAX(_scrollOffset, _selStart)) - > _width - cursorWidth - 2 * _frameWidth) { + > _width - cursorWidth - 2 * _frameWidth) { _scrollOffset++; if (_scrollOffset >= (int)strlen(_text)) { break; diff --git a/engines/wintermute/ui/ui_edit.h b/engines/wintermute/ui/ui_edit.h index a057be9ead..7a379011fd 100644 --- a/engines/wintermute/ui/ui_edit.h +++ b/engines/wintermute/ui/ui_edit.h @@ -38,21 +38,15 @@ class BaseFont; class UIEdit : public UIObject { public: DECLARE_PERSISTENT(UIEdit, UIObject) - int32 _maxLength; + int insertChars(int pos, const byte *chars, int num); int deleteChars(int start, int end); - bool _cursorVisible; - uint32 _lastBlinkTime; + virtual bool display(int offsetX, int offsetY); virtual bool handleKeypress(Common::Event *event, bool printable = false); - int32 _scrollOffset; - int32 _frameWidth; - uint32 _cursorBlinkRate; + void setCursorChar(const char *character); - char *_cursorChar; - int32 _selEnd; - int32 _selStart; - BaseFont *_fontSelected; + UIEdit(BaseGame *inGame); virtual ~UIEdit(); @@ -65,6 +59,17 @@ public: virtual bool scSetProperty(const char *name, ScValue *value) override; virtual bool scCallMethod(ScScript *script, ScStack *stack, ScStack *thisStack, const char *name) override; virtual const char *scToString() override; +private: + uint32 _cursorBlinkRate; + uint32 _lastBlinkTime; + int32 _selEnd; + int32 _selStart; + int32 _scrollOffset; + int32 _frameWidth; + BaseFont *_fontSelected; + int32 _maxLength; + bool _cursorVisible; + char *_cursorChar; }; } // End of namespace Wintermute diff --git a/engines/wintermute/ui/ui_entity.h b/engines/wintermute/ui/ui_entity.h index 1b6e8a10d6..e155ca2ce2 100644 --- a/engines/wintermute/ui/ui_entity.h +++ b/engines/wintermute/ui/ui_entity.h @@ -44,7 +44,6 @@ public: virtual bool display() override { return display(0, 0); } virtual bool display(int offsetX, int offsetY) override; - AdEntity *_entity; bool setEntity(const char *filename); // scripting interface @@ -52,6 +51,9 @@ public: virtual bool scSetProperty(const char *name, ScValue *value) override; virtual bool scCallMethod(ScScript *script, ScStack *stack, ScStack *thisStack, const char *name); virtual const char *scToString(); + +private: + AdEntity *_entity; }; } // End of namespace Wintermute diff --git a/engines/wintermute/ui/ui_object.cpp b/engines/wintermute/ui/ui_object.cpp index c32ae75c20..a8da89b011 100644 --- a/engines/wintermute/ui/ui_object.cpp +++ b/engines/wintermute/ui/ui_object.cpp @@ -648,4 +648,79 @@ bool UIObject::saveAsText(BaseDynamicBuffer *buffer, int indent) { return STATUS_FAILED; } +int32 UIObject::getWidth() const { + return _width; +} + +int32 UIObject::getHeight() const { + return _height; +} + +void UIObject::setWidth(int32 width) { + assert(width >= 0); + _width = width; +} + +void UIObject::setHeight(int32 height) { + assert(height >= 0); + _height = height; +} + +bool UIObject::isDisabled() const { + return _disable; +} + +bool UIObject::isVisible() const { + return _visible; +} + +void UIObject::setVisible(bool visible) { + _visible = visible; +} + +void UIObject::setDisabled(bool disable) { + _disable = disable; +} + +bool UIObject::hasSharedFonts() const { + return _sharedFonts; +} + +void UIObject::setSharedFonts(bool shared) { + _sharedFonts = shared; +} + +bool UIObject::hasSharedImages() const { + return _sharedImages; +} + +void UIObject::setSharedImages(bool shared) { + _sharedImages = shared; +} + +BaseSprite *UIObject::getImage() const { + return _image; +} + +void UIObject::setImage(BaseSprite *image) { + _image = image; +} + +bool UIObject::canFocus() const { + return _canFocus; +} + +void UIObject::setFont(BaseFont *font) { + _font = font; +} + +BaseFont *UIObject::getFont() { + return _font; +} + +BaseScriptHolder *UIObject::getListener() const { + return _listenerObject; +} + + } // End of namespace Wintermute diff --git a/engines/wintermute/ui/ui_object.h b/engines/wintermute/ui/ui_object.h index 5d9508c2cf..8d14d8a6a4 100644 --- a/engines/wintermute/ui/ui_object.h +++ b/engines/wintermute/ui/ui_object.h @@ -41,35 +41,23 @@ class UIObject : public BaseObject { public: bool getTotalOffset(int *offsetX, int *offsetY); - bool _canFocus; bool focus(); virtual bool handleMouse(TMouseEvent event, TMouseButton button); bool isFocused(); - bool _parentNotify; + DECLARE_PERSISTENT(UIObject, BaseObject) UIObject *_parent; virtual bool display() override { return display(0, 0); } virtual bool display(int offsetX) { return display(offsetX, 0); } virtual bool display(int offsetX, int offsetY); virtual void correctSize(); - bool _sharedFonts; - bool _sharedImages; void setText(const char *text); - char *_text; - BaseFont *_font; - bool _visible; - UITiledImage *_back; - bool _disable; + UIObject(BaseGame *inGame = nullptr); virtual ~UIObject(); - int32 _width; - int32 _height; - TUIObjectType _type; - BaseSprite *_image; void setListener(BaseScriptHolder *object, BaseScriptHolder *listenerObject, uint32 listenerParam); - BaseScriptHolder *_listenerParamObject; - uint32 _listenerParamDWORD; - BaseScriptHolder *_listenerObject; + BaseScriptHolder *getListener() const; + UIObject *_focusedWidget; virtual bool saveAsText(BaseDynamicBuffer *buffer, int indent) override; @@ -78,6 +66,42 @@ public: virtual bool scSetProperty(const char *name, ScValue *value) override; virtual bool scCallMethod(ScScript *script, ScStack *stack, ScStack *thisStack, const char *name) override; virtual const char *scToString() override; + TUIObjectType _type; + + int32 getWidth() const; + int32 getHeight() const; + void setHeight(int32 height); + void setWidth(int32 width); + bool isDisabled() const; + void setDisabled(bool disable); + bool isVisible() const; + void setVisible(bool visible); + bool hasSharedFonts() const; + void setSharedFonts(bool shared); + bool hasSharedImages() const; + void setSharedImages(bool shared); + BaseSprite *getImage() const; + void setImage(BaseSprite *image); + void setFont(BaseFont *font); + BaseFont *getFont(); + bool canFocus() const; + +protected: + BaseScriptHolder *_listenerParamObject; + uint32 _listenerParamDWORD; + BaseScriptHolder *_listenerObject; + BaseSprite *_image; + BaseFont *_font; + bool _sharedFonts; + bool _sharedImages; + char *_text; + bool _visible; + bool _disable; + int32 _width; + int32 _height; + bool _canFocus; + bool _parentNotify; + UITiledImage *_back; }; } // End of namespace Wintermute diff --git a/engines/wintermute/ui/ui_text.h b/engines/wintermute/ui/ui_text.h index 29ed62a5ef..4470367fd5 100644 --- a/engines/wintermute/ui/ui_text.h +++ b/engines/wintermute/ui/ui_text.h @@ -37,13 +37,13 @@ namespace Wintermute { class UIText : public UIObject { private: bool sizeToFit(); + TTextAlign _textAlign; + TVerticalAlign _verticalAlign; public: virtual bool display(int offsetX, int offsetY); DECLARE_PERSISTENT(UIText, UIObject) UIText(BaseGame *inGame = nullptr); virtual ~UIText(); - TTextAlign _textAlign; - TVerticalAlign _verticalAlign; bool loadFile(const char *filename); bool loadBuffer(byte *buffer, bool complete = true); virtual bool saveAsText(BaseDynamicBuffer *buffer, int indent) override; diff --git a/engines/wintermute/ui/ui_tiled_image.h b/engines/wintermute/ui/ui_tiled_image.h index 39bc6495a9..5fd3346dc8 100644 --- a/engines/wintermute/ui/ui_tiled_image.h +++ b/engines/wintermute/ui/ui_tiled_image.h @@ -36,6 +36,8 @@ namespace Wintermute { class BaseSubFrame; class UITiledImage : public BaseObject { + using Wintermute::BaseObject::display; + public: DECLARE_PERSISTENT(UITiledImage, BaseObject) void correctSize(int32 *width, int32 *height); diff --git a/engines/wintermute/ui/ui_window.cpp b/engines/wintermute/ui/ui_window.cpp index 9066ee9f5b..da681b9153 100644 --- a/engines/wintermute/ui/ui_window.cpp +++ b/engines/wintermute/ui/ui_window.cpp @@ -141,8 +141,8 @@ bool UIWindow::display(int offsetX, int offsetY) { } if (_shieldButton) { _shieldButton->_posX = _shieldButton->_posY = 0; - _shieldButton->_width = _gameRef->_renderer->getWidth(); - _shieldButton->_height = _gameRef->_renderer->getHeight(); + _shieldButton->setWidth(_gameRef->_renderer->getWidth()); + _shieldButton->setHeight(_gameRef->_renderer->getHeight()); _shieldButton->display(); } @@ -170,7 +170,7 @@ bool UIWindow::display(int offsetX, int offsetY) { _dragFrom.y = _gameRef->_mousePos.y; } - if (!_focusedWidget || (!_focusedWidget->_canFocus || _focusedWidget->_disable || !_focusedWidget->_visible)) { + if (!_focusedWidget || (!_focusedWidget->canFocus() || _focusedWidget->isDisabled() || !_focusedWidget->isVisible())) { moveFocus(); } @@ -400,8 +400,8 @@ bool UIWindow::loadBuffer(byte *buffer, bool complete) { break; case TOKEN_IMAGE_INACTIVE: - delete _imageInactive, - _imageInactive = new BaseSprite(_gameRef); + delete _imageInactive; + _imageInactive = new BaseSprite(_gameRef); if (!_imageInactive || DID_FAIL(_imageInactive->loadFile((char *)params))) { delete _imageInactive; _imageInactive = nullptr; @@ -737,7 +737,7 @@ bool UIWindow::saveAsText(BaseDynamicBuffer *buffer, int indent) { bool UIWindow::enableWidget(const char *name, bool enable) { for (uint32 i = 0; i < _widgets.size(); i++) { if (scumm_stricmp(_widgets[i]->getName(), name) == 0) { - _widgets[i]->_disable = !enable; + _widgets[i]->setDisabled(!enable); } } return STATUS_OK; @@ -748,7 +748,7 @@ bool UIWindow::enableWidget(const char *name, bool enable) { bool UIWindow::showWidget(const char *name, bool visible) { for (uint32 i = 0; i < _widgets.size(); i++) { if (scumm_stricmp(_widgets[i]->getName(), name) == 0) { - _widgets[i]->_visible = visible; + _widgets[i]->setVisible(visible); } } return STATUS_OK; @@ -1309,7 +1309,7 @@ bool UIWindow::moveFocus(bool forward) { bool done = false; while (numTries <= (int32)_widgets.size()) { - if (_widgets[i] != _focusedWidget && _widgets[i]->_canFocus && _widgets[i]->_visible && !_widgets[i]->_disable) { + if (_widgets[i] != _focusedWidget && _widgets[i]->canFocus() && _widgets[i]->isVisible() && !_widgets[i]->isDisabled()) { _focusedWidget = _widgets[i]; done = true; break; @@ -1419,7 +1419,7 @@ void UIWindow::makeFreezable(bool freezable) { bool UIWindow::getWindowObjects(BaseArray<UIObject *> &objects, bool interactiveOnly) { for (uint32 i = 0; i < _widgets.size(); i++) { UIObject *control = _widgets[i]; - if (control->_disable && interactiveOnly) { + if (control->isDisabled() && interactiveOnly) { continue; } @@ -1442,4 +1442,14 @@ bool UIWindow::getWindowObjects(BaseArray<UIObject *> &objects, bool interactive return STATUS_OK; } +bool UIWindow::getInGame() const { + return _inGame; +} + +TWindowMode UIWindow::getMode() const { + return _mode; +} + + + } // End of namespace Wintermute diff --git a/engines/wintermute/ui/ui_window.h b/engines/wintermute/ui/ui_window.h index 8a726fdff8..a603e0f7b9 100644 --- a/engines/wintermute/ui/ui_window.h +++ b/engines/wintermute/ui/ui_window.h @@ -38,47 +38,32 @@ namespace Wintermute { class UIButton; class BaseViewport; class UIWindow : public UIObject { - uint32 _fadeColor; public: bool getWindowObjects(BaseArray<UIObject *> &Objects, bool InteractiveOnly); - bool _pauseMusic; void cleanup(); virtual void makeFreezable(bool freezable); - BaseViewport *_viewport; - bool _clipContents; - bool _inGame; - bool _isMenu; - bool _fadeBackground; virtual bool handleMouseWheel(int delta); - UIWindow *_shieldWindow; - UIButton *_shieldButton; + bool close(); bool goSystemExclusive(); bool goExclusive(); - TWindowMode _mode; bool moveFocus(bool forward = true); virtual bool handleMouse(TMouseEvent Event, TMouseButton Button); - Point32 _dragFrom; - bool _dragging; DECLARE_PERSISTENT(UIWindow, UIObject) - bool _transparent; bool showWidget(const char *name, bool visible = true); bool enableWidget(const char *name, bool enable = true); - Rect32 _titleRect; - Rect32 _dragRect; + virtual bool display(int offsetX = 0, int offsetY = 0) override; UIWindow(BaseGame *inGame); virtual ~UIWindow(); virtual bool handleKeypress(Common::Event *event, bool printable = false) override; BaseArray<UIObject *> _widgets; - TTextAlign _titleAlign; + bool loadFile(const char *filename); bool loadBuffer(byte *buffer, bool complete = true); - UITiledImage *_backInactive; - BaseFont *_fontInactive; - BaseSprite *_imageInactive; + virtual bool listen(BaseScriptHolder *param1, uint32 param2); virtual bool saveAsText(BaseDynamicBuffer *buffer, int indent) override; @@ -87,6 +72,30 @@ public: virtual bool scSetProperty(const char *name, ScValue *value) override; virtual bool scCallMethod(ScScript *script, ScStack *stack, ScStack *thisStack, const char *name) override; virtual const char *scToString(); + + bool getInGame() const; + TWindowMode getMode() const; + +private: + bool _pauseMusic; + BaseViewport *_viewport; + bool _clipContents; + bool _inGame; + bool _isMenu; + bool _fadeBackground; + TWindowMode _mode; + Point32 _dragFrom; + bool _dragging; + bool _transparent; + uint32 _fadeColor; + UIWindow *_shieldWindow; + UIButton *_shieldButton; + Rect32 _titleRect; + Rect32 _dragRect; + UITiledImage *_backInactive; + BaseFont *_fontInactive; + BaseSprite *_imageInactive; + TTextAlign _titleAlign; }; } // End of namespace Wintermute diff --git a/graphics/cursorman.cpp b/graphics/cursorman.cpp index 6825767dfd..133ee5fd71 100644 --- a/graphics/cursorman.cpp +++ b/graphics/cursorman.cpp @@ -253,6 +253,7 @@ CursorManager::Cursor::Cursor(const void *data, uint w, uint h, int hotspotX, in _hotspotX = hotspotX; _hotspotY = hotspotY; _dontScale = dontScale; + _visible = false; } CursorManager::Cursor::~Cursor() { diff --git a/graphics/decoders/png.cpp b/graphics/decoders/png.cpp index 505475213f..5acb7b36f7 100644 --- a/graphics/decoders/png.cpp +++ b/graphics/decoders/png.cpp @@ -38,7 +38,7 @@ namespace Graphics { -PNGDecoder::PNGDecoder() : _outputSurface(0), _palette(0), _paletteColorCount(0) { +PNGDecoder::PNGDecoder() : _outputSurface(0), _palette(0), _paletteColorCount(0), _stream(0) { } PNGDecoder::~PNGDecoder() { diff --git a/gui/recorderdialog.h b/gui/recorderdialog.h index eb690a4f38..9c5965f56d 100644 --- a/gui/recorderdialog.h +++ b/gui/recorderdialog.h @@ -34,6 +34,8 @@ class ContainerWidget; class StaticTextWidget; class RecorderDialog : public GUI::Dialog { + using GUI::Dialog::runModal; + private: bool _firstScreenshotUpdate; Common::PlaybackFile _playbackFile; diff --git a/gui/widgets/list.cpp b/gui/widgets/list.cpp index 473d5f04df..8ecb31311f 100644 --- a/gui/widgets/list.cpp +++ b/gui/widgets/list.cpp @@ -91,6 +91,9 @@ ListWidget::ListWidget(Dialog *boss, int x, int y, int w, int h, const char *too // FIXME: This flag should come from widget definition _editable = true; + + _quickSelect = true; + _editColor = ThemeEngine::kFontColorNormal; } ListWidget::~ListWidget() { |