diff options
author | strangerke | 2011-04-08 22:09:11 +0200 |
---|---|---|
committer | strangerke | 2011-04-08 22:09:11 +0200 |
commit | 2aba8a81bd4ab20038109f70036d0dbbdbcab9a8 (patch) | |
tree | 1f004198b278c19645b6086baf09170e49af6750 | |
parent | ab0b31eb30dd1d2dd474dc9564c520b479e9b6ec (diff) | |
download | scummvm-rg350-2aba8a81bd4ab20038109f70036d0dbbdbcab9a8.tar.gz scummvm-rg350-2aba8a81bd4ab20038109f70036d0dbbdbcab9a8.tar.bz2 scummvm-rg350-2aba8a81bd4ab20038109f70036d0dbbdbcab9a8.zip |
TSAGE: move NamedHotspot back into core. Replace HotspotBase4300 by NamedHotspot and suppress it.
-rw-r--r-- | engines/tsage/core.cpp | 33 | ||||
-rw-r--r-- | engines/tsage/core.h | 10 | ||||
-rw-r--r-- | engines/tsage/ringworld_scenes10.cpp | 33 | ||||
-rw-r--r-- | engines/tsage/ringworld_scenes10.h | 12 | ||||
-rw-r--r-- | engines/tsage/ringworld_scenes5.cpp | 41 | ||||
-rw-r--r-- | engines/tsage/ringworld_scenes5.h | 18 |
6 files changed, 53 insertions, 94 deletions
diff --git a/engines/tsage/core.cpp b/engines/tsage/core.cpp index e58a6ef7b0..fad8ae8be6 100644 --- a/engines/tsage/core.cpp +++ b/engines/tsage/core.cpp @@ -1568,6 +1568,39 @@ void SceneHotspot::doAction(int action) { /*--------------------------------------------------------------------------*/ +void NamedHotspot::doAction(int action) { + switch (action) { + case CURSOR_WALK: + // Nothing + break; + case CURSOR_LOOK: + if (_lookLineNum == -1) + SceneHotspot::doAction(action); + else + SceneItem::display(_resnum, _lookLineNum, SET_Y, 20, SET_WIDTH, 200, SET_EXT_BGCOLOUR, 7, LIST_END); + break; + case CURSOR_USE: + if (_useLineNum == -1) + SceneHotspot::doAction(action); + else + SceneItem::display(_resnum, _useLineNum, SET_Y, 20, SET_WIDTH, 200, SET_EXT_BGCOLOUR, 7, LIST_END); + break; + default: + SceneHotspot::doAction(action); + break; + } +} + +void NamedHotspot::quickInit(const int ys, const int xe, const int ye, const int xs, const int resnum, const int lookLineNum, const int useLineNum) { + setBounds(ys, xe, ye, xs); + _resnum = resnum; + _lookLineNum = lookLineNum; + _useLineNum = useLineNum; + _globals->_sceneItems.addItems(this, NULL); +} + +/*--------------------------------------------------------------------------*/ + void SceneObjectWrapper::setSceneObject(SceneObject *so) { _sceneObject = so; so->_strip = 1; diff --git a/engines/tsage/core.h b/engines/tsage/core.h index b37d576b4e..27079dd963 100644 --- a/engines/tsage/core.h +++ b/engines/tsage/core.h @@ -439,6 +439,16 @@ public: virtual void doAction(int action); }; +class NamedHotspot: public SceneHotspot { +public: + int _resnum, _lookLineNum, _useLineNum; + NamedHotspot(): SceneHotspot() {} + + void quickInit(const int ys, const int xe, const int ye, const int xs, const int resnum, const int lookLineNum, const int useLineNum); + virtual void doAction(int action); + virtual Common::String getClassName() { return "NamedHotspot"; } +}; + class SceneHotspot_2: public SceneHotspot { public: int _field26, _field28; diff --git a/engines/tsage/ringworld_scenes10.cpp b/engines/tsage/ringworld_scenes10.cpp index 493b8dc85a..12e69a7011 100644 --- a/engines/tsage/ringworld_scenes10.cpp +++ b/engines/tsage/ringworld_scenes10.cpp @@ -38,39 +38,6 @@ Scene2::Scene2() { /*--------------------------------------------------------------------------*/ -void NamedHotspot::doAction(int action) { - switch (action) { - case CURSOR_WALK: - // Nothing - break; - case CURSOR_LOOK: - if (_lookLineNum == -1) - SceneHotspot::doAction(action); - else - SceneItem::display(_resnum, _lookLineNum, SET_Y, 20, SET_WIDTH, 200, SET_EXT_BGCOLOUR, 7, LIST_END); - break; - case CURSOR_USE: - if (_useLineNum == -1) - SceneHotspot::doAction(action); - else - SceneItem::display(_resnum, _useLineNum, SET_Y, 20, SET_WIDTH, 200, SET_EXT_BGCOLOUR, 7, LIST_END); - break; - default: - SceneHotspot::doAction(action); - break; - } -} - -void NamedHotspot::quickInit(const int ys, const int xe, const int ye, const int xs, const int resnum, const int lookLineNum, const int useLineNum) { - setBounds(ys, xe, ye, xs); - _resnum = resnum; - _lookLineNum = lookLineNum; - _useLineNum = useLineNum; - _globals->_sceneItems.addItems(this, NULL); -} - -/*--------------------------------------------------------------------------*/ - void Object9350::postInit(SceneObjectList *OwnerList) { _globals->_sceneManager.postInit(&_globals->_sceneManager._altSceneObjects); } diff --git a/engines/tsage/ringworld_scenes10.h b/engines/tsage/ringworld_scenes10.h index 857ee94c80..00b524f7c8 100644 --- a/engines/tsage/ringworld_scenes10.h +++ b/engines/tsage/ringworld_scenes10.h @@ -46,16 +46,6 @@ public : } }; -class NamedHotspot: public SceneHotspot { -public: - int _resnum, _lookLineNum, _useLineNum; - NamedHotspot(): SceneHotspot() {} - - void quickInit(const int ys, const int xe, const int ye, const int xs, const int resnum, const int lookLineNum, const int useLineNum); - virtual void doAction(int action); - virtual Common::String getClassName() { return "NamedHotspot"; } -}; - class Object9350: public SceneObject { public: virtual void postInit(SceneObjectList *OwnerList = NULL); @@ -132,7 +122,7 @@ public: SpeakerQText _speakerQText; SoundHandler _soundHandler; SceneHotspot1 _hotspot1; - NamedHotspot _hotspot2; + NamedHotspot _hotspot2; NamedHotspot _hotspot3; NamedHotspot _hotspot4; NamedHotspot _hotspot5; diff --git a/engines/tsage/ringworld_scenes5.cpp b/engines/tsage/ringworld_scenes5.cpp index fad83cdcf8..d39029f6f8 100644 --- a/engines/tsage/ringworld_scenes5.cpp +++ b/engines/tsage/ringworld_scenes5.cpp @@ -3743,37 +3743,6 @@ void Scene4300::Action2::signal() { /*--------------------------------------------------------------------------*/ -void HotspotBase4300::doAction(int action) { - switch (action) { - case CURSOR_WALK: - break; - case CURSOR_LOOK: - if (_lookLine != -1) - SceneItem::display2(_resNum, _lookLine); - else - SceneHotspot::doAction(action); - break; - case CURSOR_USE: - if (_useLine != -1) - SceneItem::display2(_resNum, _useLine); - else - SceneHotspot::doAction(action); - break; - default: - SceneHotspot::doAction(action); - break; - } -} - -void HotspotBase4300::setup(const Rect &bounds, int resNum, int lookLine, int useLine) { - SceneHotspot::setBounds(bounds); - _resNum = resNum; - _lookLine = lookLine; - _useLine = useLine; - - _globals->_sceneItems.push_back(this); -} - void Scene4300::Hotspot8::doAction(int action) { switch (action) { case CURSOR_LOOK: @@ -3829,7 +3798,7 @@ void Scene4300::Hotspot9::doAction(int action) { SceneItem::display2(4300, 23); break; default: - HotspotBase4300::doAction(action); + NamedHotspot::doAction(action); break; } } @@ -3981,7 +3950,7 @@ void Scene4300::postInit(SceneObjectList *OwnerList) { _stripManager.addSpeaker(&_speakerMText); _stripManager.addSpeaker(&_speakerFLText); - _hotspot11.setup(Rect(76, 97, 102, 127), 4300, 5, 6); + _hotspot11.quickInit(76, 97, 102, 127, 4300, 5, 6); _hotspot7.postInit(); _hotspot7.setPosition(Common::Point(90, 128)); @@ -3989,7 +3958,7 @@ void Scene4300::postInit(SceneObjectList *OwnerList) { _hotspot7.setPriority2(250); _globals->_sceneItems.push_back(&_hotspot7); - _hotspot9.setup(Rect(120, 49, 174, 91), 4300, -1, -1); + _hotspot9.quickInit(120, 49, 174, 91, 4300, -1, -1); _hotspot15.postInit(); _hotspot15.setVisage(4300); @@ -4324,7 +4293,7 @@ void Scene4301::Hotspot4::doAction(int action) { _globals->_player.disableControl(); scene->setAction(&scene->_action1); } else { - HotspotBase4300::doAction(action); + NamedHotspot::doAction(action); } } @@ -4358,7 +4327,7 @@ void Scene4301::postInit(SceneObjectList *OwnerList) { _field68E = false; _globals->_inventory._stasisBox2._sceneNumber = 1; - _hotspot4.setup(Rect(76, 97, 102, 127), 4300, 5, 6); + _hotspot4.quickInit(76, 97, 102, 127, 4300, 5, 6); _hotspot1.postInit(); _hotspot1.setPosition(Common::Point(90, 128)); diff --git a/engines/tsage/ringworld_scenes5.h b/engines/tsage/ringworld_scenes5.h index fd7751af27..e9ad5b62cb 100644 --- a/engines/tsage/ringworld_scenes5.h +++ b/engines/tsage/ringworld_scenes5.h @@ -574,16 +574,6 @@ public: virtual void dispatch(); }; -class HotspotBase4300: public SceneObject { -public: - int _resNum; - int _lookLine, _useLine; - - virtual void doAction(int action); - - void setup(const Rect &bounds, int resNum, int lookLine, int useLine); -}; - class Scene4300: public Scene { /* Actions */ class Action1: public Action { @@ -600,7 +590,7 @@ class Scene4300: public Scene { public: virtual void doAction(int action); }; - class Hotspot9: public HotspotBase4300 { + class Hotspot9: public NamedHotspot { public: virtual void doAction(int action); }; @@ -638,7 +628,7 @@ public: Hotspot8 _hotspot8; Hotspot9 _hotspot9; Hotspot10 _hotspot10; - HotspotBase4300 _hotspot11; + NamedHotspot _hotspot11; SceneObject _hotspot12, _hotspot13, _hotspot14; Hotspot15 _hotspot15; Hotspot16 _hotspot16; @@ -672,11 +662,11 @@ class Scene4301: public Scene { }; /* Hotspots */ - class Hotspot4: public HotspotBase4300 { + class Hotspot4: public NamedHotspot { public: virtual void doAction(int action); }; - class Hotspot5: public HotspotBase4300 { + class Hotspot5: public NamedHotspot { public: virtual void doAction(int action); }; |