aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--engines/tsage/ringworld2/ringworld2_logic.cpp94
-rw-r--r--engines/tsage/ringworld2/ringworld2_logic.h50
-rw-r--r--engines/tsage/ringworld2/ringworld2_scenes1.cpp2
-rw-r--r--engines/tsage/ringworld2/ringworld2_scenes1.h2
-rw-r--r--engines/tsage/ringworld2/ringworld2_scenes3.cpp12
-rw-r--r--engines/tsage/ringworld2/ringworld2_scenes3.h2
6 files changed, 110 insertions, 52 deletions
diff --git a/engines/tsage/ringworld2/ringworld2_logic.cpp b/engines/tsage/ringworld2/ringworld2_logic.cpp
index 67af65c08a..65030bed31 100644
--- a/engines/tsage/ringworld2/ringworld2_logic.cpp
+++ b/engines/tsage/ringworld2/ringworld2_logic.cpp
@@ -21,6 +21,7 @@
*/
#include "common/config-manager.h"
+#include "tsage/graphics.h"
#include "tsage/scenes.h"
#include "tsage/tsage.h"
#include "tsage/staticres.h"
@@ -270,7 +271,7 @@ Scene *Ringworld2Game::createScene(int sceneNumber) {
// Confrontation
return new Scene3400();
case 3500:
- // Maze action scene
+ // Maze action sequencec
return new Scene3500();
case 3600:
// Cutscene - walking at gunpoint
@@ -1274,14 +1275,19 @@ void SceneAreaObject::setDetails(int resNum, int lookLineNum, int talkLineNum, i
/*****************************************************************************/
-UnkObject1200::UnkObject1200() {
+MazeUI::MazeUI() {
_field16 = _field3A = NULL;
_field12 = _field14 = 0;
- _field26 = _field28 = _field2A = _field2C = _field2E = _field30 = 0;
- _field32 = _field34 = _field36 = _field38 = _field3E = _field40 = 0;
+ _field26 = _field28 = _width = _height = _field2E = _field30 = 0;
+ _resNum = _field34 = _field36 = _field38 = _field3E = _field40 = 0;
}
-void UnkObject1200::synchronize(Serializer &s) {
+MazeUI::~MazeUI() {
+ DEALLOCATE(_field16);
+ DEALLOCATE(_field3A);
+}
+
+void MazeUI::synchronize(Serializer &s) {
SavedObject::synchronize(s);
_rect1.synchronize(s);
@@ -1293,11 +1299,11 @@ void UnkObject1200::synchronize(Serializer &s) {
s.syncAsSint16LE(_field14);
s.syncAsSint16LE(_field26);
s.syncAsSint16LE(_field28);
- s.syncAsSint16LE(_field2A);
- s.syncAsSint16LE(_field2C);
+ s.syncAsSint16LE(_width);
+ s.syncAsSint16LE(_height);
s.syncAsSint16LE(_field2E);
s.syncAsSint16LE(_field30);
- s.syncAsSint16LE(_field32);
+ s.syncAsSint16LE(_resNum);
s.syncAsSint16LE(_field34);
s.syncAsSint16LE(_field36);
s.syncAsSint16LE(_field38);
@@ -1305,16 +1311,58 @@ void UnkObject1200::synchronize(Serializer &s) {
s.syncAsSint16LE(_field40);
}
-void UnkObject1200::sub51AE9(int arg1) {
- warning("STUB: UnkObject1200::sub51AE9()");
+void MazeUI::load(int resNum) {
+ clear();
+ _resNum = resNum;
+
+ const byte *header = g_resourceManager->getResource(RT17, resNum, 0);
+
+ _field34 = resNum + 1000;
+ _field26 = READ_LE_UINT16(header + 2);
+ _field28 = READ_LE_UINT16(header + 4);
+ _field36 = 10;
+ _field38 = _field36 << 3;
+
+ Visage visage;
+ visage.setVisage(_field34, 1);
+
+ GfxSurface frame = visage.getFrame(2);
+ _width = frame.getBounds().width();
+ _height = frame.getBounds().height();
+
+ _field16 = ALLOCATE(_field26 * _field28 * 2);
+ const byte *res = g_resourceManager->getResource(RT17, resNum, 1);
+ Common::copy(res, res + (_field26 * _field28 * 2), _field16);
+
+ _field30 = _field2E = 0;
+ _field12 = (_rect1.width() + _width - 1) / _width;
+ _field14 = (_rect1.height() + _height - 1) / _height;
+
+ _field3E = (_field12 + 1) * _width;
+ _field3A = ALLOCATE(_field3E * _height);
+
+ _rect2 = Rect(0, 0, _width * _field26, _height * _field28);
+}
+
+void MazeUI::clear() {
+ if (!_resNum)
+ _resNum = 1;
+
+ if (_field16)
+ DEALLOCATE(_field16);
+ _field16 = NULL;
+
+ DEALLOCATE(_field3A);
+ _field3A = NULL;
+
}
-int UnkObject1200::sub51AF8(Common::Point pt) {
+int MazeUI::sub51AF8(Common::Point pt) {
if (!_rect1.contains(pt))
return -1;
- int tmp1 = (pt.x - _rect1.left + _field2E) / _field2A;
- int tmp2 = (pt.y - _rect1.top + _field30) / _field2C;
+ int tmp1 = (pt.x - _rect1.left + _field2E) / _width;
+ int tmp2 = (pt.y - _rect1.top + _field30) / _height;
if ((tmp1 >= 0) && (tmp2 >= 0) && (_field26 > tmp1) && (_field28 > tmp2))
return _field16[(((_field26 * tmp2) + tmp1)* 2)];
@@ -1322,7 +1370,7 @@ int UnkObject1200::sub51AF8(Common::Point pt) {
return -1;
}
-bool UnkObject1200::sub51AFD(Common::Point pt) {
+bool MazeUI::sub51AFD(Common::Point pt) {
int retval = false;
_field2E = pt.x;
@@ -1351,19 +1399,19 @@ bool UnkObject1200::sub51AFD(Common::Point pt) {
return retval;
}
-void UnkObject1200::sub51B02() {
- warning("STUB: UnkObject1200::sub51B02()");
+void MazeUI::sub51B02() {
+ warning("STUB: MazeUI::sub51B02()");
}
-void UnkObject1200::sub9EDE8(Rect rect) {
+void MazeUI::sub9EDE8(Rect rect) {
_rect1 = rect;
- warning("FIXME: UnkObject1200::sub9EDE8()");
+ warning("FIXME: MazeUI::sub9EDE8()");
// _rect1.clip(g_globals->gfxManager()._bounds);
}
-int UnkObject1200::sub9EE22(int &arg1, int &arg2) {
- arg1 /= _field2A;
- arg2 /= _field2C;
+int MazeUI::sub9EE22(int &arg1, int &arg2) {
+ arg1 /= _width;
+ arg2 /= _height;
if ((arg1 >= 0) && (arg2 >= 0) && (_field26 > arg1) && (_field28 > arg2)) {
return _field16[(((_field26 * arg2) + arg1) * 2)];
@@ -1372,6 +1420,10 @@ int UnkObject1200::sub9EE22(int &arg1, int &arg2) {
return -1;
}
+/*--------------------------------------------------------------------------*/
+
+/*--------------------------------------------------------------------------*/
+
void Scene1200::sub9DAD6(int indx) {
_object1.sub9EE22(R2_GLOBALS._v56AA2, R2_GLOBALS._v56AA4);
diff --git a/engines/tsage/ringworld2/ringworld2_logic.h b/engines/tsage/ringworld2/ringworld2_logic.h
index 0b573bf7f0..3ca1ba863e 100644
--- a/engines/tsage/ringworld2/ringworld2_logic.h
+++ b/engines/tsage/ringworld2/ringworld2_logic.h
@@ -276,53 +276,57 @@ public:
}
};
-class SceneAreaObject: public SceneArea {
- class Object1: public SceneActor {
- public:
- };
-public:
- Object1 _object1;
- int _insetCount;
-
- virtual void remove();
- virtual void process(Event &event);
- void setDetails(int visage, int strip, int frameNumber, const Common::Point &pt);
- void setDetails(int resNum, int lookLineNum, int talkLineNum, int useLineNum);
-};
-
-class UnkObject1200 : public SavedObject {
+class MazeUI: public SavedObject {
+private:
+ void clear();
public:
Rect _rect1;
Rect _rect2;
- int *_field16;
- int *_field3A;
+ byte *_field16;
+ byte *_field3A;
int _field12;
int _field14;
int _field26;
int _field28;
- int _field2A;
- int _field2C;
+ int _width;
+ int _height;
int _field2E;
int _field30;
- int _field32;
+ int _resNum;
int _field34;
int _field36;
int _field38;
int _field3E;
int _field40;
+public:
+ MazeUI();
+ ~MazeUI();
+ void load(int resNum);
- UnkObject1200();
+ virtual Common::String getClassName() { return "MazeUI"; }
void synchronize(Serializer &s);
- void sub51AE9(int arg1);
int sub51AF8(Common::Point pt);
bool sub51AFD(Common::Point pt);
void sub51B02();
void sub9EDE8(Rect rect);
int sub9EE22(int &arg1, int &arg2);
- virtual Common::String getClassName() { return "UnkObject1200"; }
+};
+
+class SceneAreaObject: public SceneArea {
+ class Object1: public SceneActor {
+ public:
+ };
+public:
+ Object1 _object1;
+ int _insetCount;
+
+ virtual void remove();
+ virtual void process(Event &event);
+ void setDetails(int visage, int strip, int frameNumber, const Common::Point &pt);
+ void setDetails(int resNum, int lookLineNum, int talkLineNum, int useLineNum);
};
/*--------------------------------------------------------------------------*/
diff --git a/engines/tsage/ringworld2/ringworld2_scenes1.cpp b/engines/tsage/ringworld2/ringworld2_scenes1.cpp
index af62ab6916..ba12a4b98f 100644
--- a/engines/tsage/ringworld2/ringworld2_scenes1.cpp
+++ b/engines/tsage/ringworld2/ringworld2_scenes1.cpp
@@ -1136,7 +1136,7 @@ void Scene1200::postInit(SceneObjectList *OwnerList) {
tmpRect.set(110, 20, 210, 120);
_object1.sub9EDE8(tmpRect);
- _object1.sub51AE9(1);
+ _object1.load(1);
_object1.sub51AFD(Common::Point(R2_GLOBALS._v56AA2, R2_GLOBALS._v56AA4));
warning("int unk = set_pane_p(_paneNumber);");
_object1.sub51B02();
diff --git a/engines/tsage/ringworld2/ringworld2_scenes1.h b/engines/tsage/ringworld2/ringworld2_scenes1.h
index f65a89972d..d1e55ef12b 100644
--- a/engines/tsage/ringworld2/ringworld2_scenes1.h
+++ b/engines/tsage/ringworld2/ringworld2_scenes1.h
@@ -147,7 +147,7 @@ public:
NamedHotspot _item1;
SceneActor _actor1;
Area1 _area1;
- UnkObject1200 _object1;
+ MazeUI _object1;
SequenceManager _sequenceManager;
int _field412;
diff --git a/engines/tsage/ringworld2/ringworld2_scenes3.cpp b/engines/tsage/ringworld2/ringworld2_scenes3.cpp
index 61711d0a4f..0e444a66bf 100644
--- a/engines/tsage/ringworld2/ringworld2_scenes3.cpp
+++ b/engines/tsage/ringworld2/ringworld2_scenes3.cpp
@@ -2888,6 +2888,7 @@ void Scene3400::signal() {
* Scene 3500 -
*
*--------------------------------------------------------------------------*/
+
Scene3500::Action1::Action1() {
_field1E = 0;
_field20 = 0;
@@ -3046,16 +3047,16 @@ void Scene3500::Actor7::sub109693(Common::Point Pt) {
}
int Scene3500::UnkObject3500::sub1097C9(int arg1) {
- return (_field2A / 2) + arg1 - (arg1 % _field2A);
+ return (_width / 2) + arg1 - (arg1 % _width);
}
int Scene3500::UnkObject3500::sub1097EF(int arg1) {
- return (_field2C / 2) + arg1 - (arg1 % _field2C);
+ return (_height / 2) + arg1 - (arg1 % _height);
}
int Scene3500::UnkObject3500::sub109C09(Common::Point pt) {
- int vx = pt.x / _field2A;
- int vy = pt.y / _field2C;
+ int vx = pt.x / _width;
+ int vy = pt.y / _height;
if ((vx >= 0) && (_field26 > vx) && (_field28 > vy)) {
return _field16[((_field26 * vy) + vx) * 2];
@@ -3665,7 +3666,7 @@ void Scene3500::postInit(SceneObjectList *OwnerList) {
tmpRect.set(160, 89, 299, 182);
_unkObj1.sub9EDE8(tmpRect);
- _unkObj1.sub51AE9(2);
+ _unkObj1.load(2);
_unkObj1.sub51AFD(Common::Point(_field127A, _field127C));
_action1._field24 = 0;
@@ -3787,6 +3788,7 @@ void Scene3500::process(Event &event) {
void Scene3500::dispatch() {
Rect tmpRect;
Scene::dispatch();
+
if (((_actor1._frame % 2) == 0) && (_action1._field24 == 0)) {
_actor1.setFrame(_actor1.changeFrame());
_field1276 = _actor1._frame;
diff --git a/engines/tsage/ringworld2/ringworld2_scenes3.h b/engines/tsage/ringworld2/ringworld2_scenes3.h
index 44787b9eef..ffad37d7ce 100644
--- a/engines/tsage/ringworld2/ringworld2_scenes3.h
+++ b/engines/tsage/ringworld2/ringworld2_scenes3.h
@@ -633,7 +633,7 @@ class Scene3500 : public SceneExt {
// TODO: double check if nothing specific is present, then remove this class
};
- class UnkObject3500 : public UnkObject1200 {
+ class UnkObject3500 : public MazeUI {
public:
int sub1097C9(int arg1);
int sub1097EF(int arg1);