Skip to content

Commit

Permalink
TSAGE: Some further cleanup of R2R drive room
Browse files Browse the repository at this point in the history
  • Loading branch information
dreammaster committed Jul 18, 2013
1 parent b7fbf23 commit 2eb26ad
Show file tree
Hide file tree
Showing 3 changed files with 66 additions and 61 deletions.
3 changes: 2 additions & 1 deletion engines/tsage/ringworld2/ringworld2_logic.cpp
Expand Up @@ -88,6 +88,7 @@ Scene *Ringworld2Game::createScene(int sceneNumber) {
// Cutscene - Walking in hall
return new Scene525();
case 600:
// Drive Room
return new Scene600();
case 700:
// Lander Bay 2
Expand Down Expand Up @@ -426,7 +427,7 @@ bool SceneExt::display(CursorType action, Event &event) {
SceneItem::display2(5, 15);
} else {
R2_GLOBALS._sound3.play(43, 0);
SceneItem::display2(2, 0);
SceneItem::display2(2, R2_SONIC_STUNNER);
}

R2_GLOBALS._sound4.play(45);
Expand Down
102 changes: 53 additions & 49 deletions engines/tsage/ringworld2/ringworld2_scenes0.cpp
Expand Up @@ -2042,8 +2042,8 @@ void Scene200::WestExit::changeScene() {
/*--------------------------------------------------------------------------*/

void Scene200::postInit(SceneObjectList *OwnerList) {
SceneExt::postInit();
loadScene(200);
SceneExt::postInit();

_westExit.setDetails(Rect(94, 0, 123, 58), EXITCURSOR_W, 175);
_westExit.setDest(Common::Point(125, 52));
Expand Down Expand Up @@ -5341,9 +5341,10 @@ void Scene525::signal() {
}

/*--------------------------------------------------------------------------
* Scene 600 -
* Scene 600 - Drive Room
*
*--------------------------------------------------------------------------*/

Scene600::Scene600() {
_field412 = 0;
for (int i = 0; i < 256; i++)
Expand All @@ -5358,11 +5359,12 @@ void Scene600::synchronize(Serializer &s) {
s.syncAsByte(_fieldAD2[i]);
}

bool Scene600::Item1::startAction(CursorType action, Event &event) {
bool Scene600::CompartmentHotspot::startAction(CursorType action, Event &event) {
if ((action != R2_NEGATOR_GUN) || (!R2_GLOBALS.getFlag(5)) || (R2_GLOBALS.getFlag(8)))
return SceneHotspot::startAction(action, event);

SceneItem::display(600, 32, 0, 280, 1, 160, 9, 1, 2, 20, 7, 7, -999);
SceneItem::display(600, 32, SET_WIDTH, 280, SET_X, 160, SET_POS_MODE, ALIGN_CENTER,
SET_Y, 20, SET_EXT_BGCOLOR, 7, LIST_END);
return true;
}

Expand All @@ -5371,12 +5373,14 @@ bool Scene600::Item4::startAction(CursorType action, Event &event) {
return SceneHotspot::startAction(action, event);

if ((R2_GLOBALS.getFlag(5)) && (!R2_GLOBALS.getFlag(8))) {
SceneItem::display(600, 32, 0, 280, 1, 160, 9, 1, 2, 20, 7, 7, -999);
SceneItem::display(600, 32, SET_WIDTH, 280, SET_X, 160, SET_POS_MODE, ALIGN_CENTER,
SET_Y, 20, SET_EXT_BGCOLOR, 7, LIST_END);
return true;
}

if (R2_GLOBALS.getFlag(5)) {
SceneItem::display(600, 30, 0, 280, 1, 160, 9, 1, 2, 20, 7, 7, -999);
SceneItem::display(600, 30, SET_WIDTH, 280, SET_X, 160, SET_POS_MODE, ALIGN_CENTER,
SET_Y, 20, SET_EXT_BGCOLOR, 7, LIST_END);
return true;
}

Expand Down Expand Up @@ -5416,7 +5420,7 @@ void Scene600::Actor4::draw() {
SceneActor::draw();
}

bool Scene600::Actor5::startAction(CursorType action, Event &event) {
bool Scene600::Doorway::startAction(CursorType action, Event &event) {
if ((action < CURSOR_WALK) && (action >= R2CURSORS_START))
return false;

Expand All @@ -5427,10 +5431,10 @@ bool Scene600::Actor5::startAction(CursorType action, Event &event) {

if ((R2_INVENTORY.getObjectScene(R2_CLAMP) == 600) && (!R2_GLOBALS.getFlag(6))) {
R2_GLOBALS._player.disableControl();
scene->_actor6.setDetails(600, 11, -1, -1, 3, (SceneItem *) NULL);
scene->_laser.setDetails(600, 11, -1, -1, 3, (SceneItem *) NULL);
R2_GLOBALS.setFlag(6);
scene->_sceneMode = 609;
scene->setAction(&scene->_sequenceManager1, scene, 609, &R2_GLOBALS._player, &scene->_actor5, &scene->_actor6, &scene->_actor1, NULL);
scene->setAction(&scene->_sequenceManager1, scene, 609, &R2_GLOBALS._player, &scene->_doorway, &scene->_laser, &scene->_actor1, NULL);
return true;
}

Expand All @@ -5440,7 +5444,7 @@ bool Scene600::Actor5::startAction(CursorType action, Event &event) {
if (!R2_GLOBALS.getFlag(6)) {
R2_GLOBALS._player.disableControl();
scene->_sceneMode = 616;
scene->setAction(&scene->_sequenceManager1, scene, 616, &R2_GLOBALS._player, &scene->_actor5, &scene->_actor6, NULL);
scene->setAction(&scene->_sequenceManager1, scene, 616, &R2_GLOBALS._player, &scene->_doorway, &scene->_laser, NULL);
return true;
}

Expand All @@ -5449,12 +5453,12 @@ bool Scene600::Actor5::startAction(CursorType action, Event &event) {
else {
R2_GLOBALS._player.disableControl();
scene->_sceneMode = 601;
scene->setAction(&scene->_sequenceManager1, scene, 601, &R2_GLOBALS._player, &scene->_actor5, NULL);
scene->setAction(&scene->_sequenceManager1, scene, 601, &R2_GLOBALS._player, &scene->_doorway, NULL);
}
return true;
}

bool Scene600::Actor6::startAction(CursorType action, Event &event) {
bool Scene600::Laser::startAction(CursorType action, Event &event) {
Scene600 *scene = (Scene600 *)R2_GLOBALS._sceneManager._scene;

if (action < CURSOR_WALK) {
Expand All @@ -5467,7 +5471,7 @@ bool Scene600::Actor6::startAction(CursorType action, Event &event) {
} else {
R2_GLOBALS._player.disableControl();
scene->_actor8.postInit();
scene->_actor8.setDetails(600, 20, -1, -1, 4, &scene->_actor6);
scene->_actor8.setDetails(600, 20, -1, -1, 4, &scene->_laser);
scene->_sceneMode = 607;
scene->setAction(&scene->_sequenceManager1, scene, 607, &R2_GLOBALS._player, &scene->_actor8, NULL);
return true;
Expand All @@ -5482,28 +5486,28 @@ bool Scene600::Actor6::startAction(CursorType action, Event &event) {
return true;
} else {
R2_GLOBALS._player.disableControl();
scene->_actor7.postInit();
scene->_actor7.setDetails(600, 27, -1, -1, 5, &scene->_actor6);
scene->_aerosol.postInit();
scene->_aerosol.setDetails(600, 27, -1, -1, 5, &scene->_laser);

scene->_actor4.postInit();
scene->_actor4.setup(601, 3, 1);
scene->_actor4._effect = 3;
scene->_actor4._moveDiff = Common::Point(1, 1);
scene->_actor4._moveRate = 2;
scene->_actor4._numFrames = 3;
scene->_actor4.setDetails(600, 24, 25, 26, 5, &scene->_actor7);
scene->_actor4.setDetails(600, 24, 25, 26, 5, &scene->_aerosol);

scene->_sceneMode = 605;

scene->setAction(&scene->_sequenceManager1, scene, 605, &R2_GLOBALS._player, &scene->_actor7, &scene->_actor4, &scene->_actor5, NULL);
scene->setAction(&scene->_sequenceManager1, scene, 605, &R2_GLOBALS._player, &scene->_aerosol, &scene->_actor4, &scene->_doorway, NULL);
return true;
}
break;
case R2_CLAMP:
if (R2_GLOBALS.getFlag(5)) {
R2_GLOBALS._player.disableControl();
scene->_sceneMode = 606;
scene->setAction(&scene->_sequenceManager1, scene, 606, &R2_GLOBALS._player, &scene->_actor6, NULL);
scene->setAction(&scene->_sequenceManager1, scene, 606, &R2_GLOBALS._player, &scene->_laser, NULL);
return true;
} else {
return SceneActor::startAction(action, event);
Expand All @@ -5526,15 +5530,15 @@ bool Scene600::Actor6::startAction(CursorType action, Event &event) {
return SceneActor::startAction(action, event);
}

bool Scene600::Actor7::startAction(CursorType action, Event &event) {
bool Scene600::Aerosol::startAction(CursorType action, Event &event) {
Scene600 *scene = (Scene600 *)R2_GLOBALS._sceneManager._scene;

if ((action < CURSOR_WALK) && (action >= R2CURSORS_START)) {
return false;
} else if (action == CURSOR_USE) {
R2_GLOBALS._player.disableControl();
scene->_sceneMode = 614;
scene->setAction(&scene->_sequenceManager1, scene, 614, &R2_GLOBALS._player, &scene->_actor7, NULL);
scene->setAction(&scene->_sequenceManager1, scene, 614, &R2_GLOBALS._player, &scene->_aerosol, NULL);
return true;
} else {
return SceneActor::startAction(action, event);
Expand Down Expand Up @@ -5568,14 +5572,14 @@ void Scene600::postInit(SceneObjectList *OwnerList) {

warning("FIXME: loop to initialize _fieldAD2[]");

_actor5.postInit();
_actor5.setVisage(600);
_actor5.setPosition(Common::Point(29, 147));
_actor5.fixPriority(10);
_actor5.setDetails(300, 3, -1, -1, 1, (SceneItem *) NULL);
_doorway.postInit();
_doorway.setVisage(600);
_doorway.setPosition(Common::Point(29, 147));
_doorway.fixPriority(10);
_doorway.setDetails(300, 3, -1, -1, 1, (SceneItem *) NULL);

_actor6.postInit();
_actor6.setPosition(Common::Point(246, 41));
_laser.postInit();
_laser.setPosition(Common::Point(246, 41));

if (R2_INVENTORY.getObjectScene(9) == 600) {
_actor8.postInit();
Expand All @@ -5601,11 +5605,11 @@ void Scene600::postInit(SceneObjectList *OwnerList) {
}

if (R2_GLOBALS.getFlag(6)) {
_actor6.setup(602, 7, 1);
_actor6.setDetails(600, 11, -1, -1, 1, (SceneItem *) NULL);
_laser.setup(602, 7, 1);
_laser.setDetails(600, 11, -1, -1, 1, (SceneItem *) NULL);
} else {
_actor6.setup(600, 2, 1);
_actor6.setDetails(600, 10, -1, -1, 1, (SceneItem *) NULL);
_laser.setup(600, 2, 1);
_laser.setDetails(600, 10, -1, -1, 1, (SceneItem *) NULL);

_actor1.postInit();
_actor1.setup(600, 3, 5);
Expand All @@ -5618,10 +5622,10 @@ void Scene600::postInit(SceneObjectList *OwnerList) {

if (R2_GLOBALS.getFlag(5)) {
if (R2_INVENTORY.getObjectScene(12) == 600) {
_actor7.postInit();
_actor7.setup(602, 2, 2);
_actor7.setPosition(Common::Point(189, 95));
_actor7.setDetails(600, 27, -1, -1, 1, (SceneItem *) NULL);
_aerosol.postInit();
_aerosol.setup(602, 2, 2);
_aerosol.setPosition(Common::Point(189, 95));
_aerosol.setDetails(600, 27, -1, -1, 1, (SceneItem *) NULL);
}

if (R2_GLOBALS.getFlag(8)) {
Expand Down Expand Up @@ -5655,30 +5659,30 @@ void Scene600::postInit(SceneObjectList *OwnerList) {
_item3.setDetails(11, 600, 14, -1, -1);

if (R2_GLOBALS.getFlag(9)) {
_item1.setDetails(Rect(159, 3, 315, 95), 600, 7, -1, -1, 1, NULL);
_background.setDetails(Rect(159, 3, 315, 95), 600, 7, -1, -1, 1, NULL);
} else {
_item4.setDetails(Rect(173, 15, 315, 45), 600, 21, -1, 23, 1, NULL);
_item1.setDetails(Rect(159, 3, 315, 95), 600, 6, -1, -1, 1, NULL);
_background.setDetails(Rect(159, 3, 315, 95), 600, 6, -1, -1, 1, NULL);
}
_item5.setDetails(Rect(0, 0, 320, 200), 600, 0, -1, -1, 1, NULL);

_sceneMode = 600;
if (R2_GLOBALS._sceneManager._previousScene == 700) {
if (R2_GLOBALS.getFlag(6)) {
setAction(&_sequenceManager1, this, 600, &R2_GLOBALS._player, &_actor5, NULL);
setAction(&_sequenceManager1, this, 600, &R2_GLOBALS._player, &_doorway, NULL);
} else if (R2_GLOBALS.getFlag(5)) {
setAction(&_sequenceManager1, this, 603, &R2_GLOBALS._player, &_actor5, &_actor6, &_actor1, NULL);
setAction(&_sequenceManager1, this, 603, &R2_GLOBALS._player, &_doorway, &_laser, &_actor1, NULL);
} else {
setAction(&_sequenceManager1, this, 602, &R2_GLOBALS._player, &_actor5, &_actor6, &_actor1, NULL);
setAction(&_sequenceManager1, this, 602, &R2_GLOBALS._player, &_doorway, &_laser, &_actor1, NULL);
}
} else if (R2_GLOBALS.getFlag(5)) {
R2_GLOBALS._player.setPosition(Common::Point(50, 140));
R2_GLOBALS._player.setStrip(3);
_actor6.setFrame(_actor6.getFrameCount());
_laser.setFrame(_laser.getFrameCount());
signal();
} else {
_actor5.setFrame(7);
_actor6.setFrame(7);
_doorway.setFrame(7);
_laser.setFrame(7);
R2_GLOBALS._player.setPosition(Common::Point(28, 140));
R2_GLOBALS._player.setStrip(5);
signal();
Expand Down Expand Up @@ -5734,12 +5738,12 @@ void Scene600::signal() {
_actor3.remove();
R2_GLOBALS._sceneItems.remove(&_item4);
_actor2.setDetails(600, 21, -1, 23, 4, &_item4);
_item1.setDetails(600, 7, -1, -1, 3, (SceneItem *) NULL);
_background.setDetails(600, 7, -1, -1, 3, (SceneItem *) NULL);
R2_GLOBALS._player.enableControl(CURSOR_USE);
break;
case 614:
R2_GLOBALS._player.enableControl();
_actor7.remove();
_aerosol.remove();
R2_INVENTORY.setObjectScene(12, 1);
R2_GLOBALS._walkRegions.disableRegion(7);
break;
Expand All @@ -5759,7 +5763,7 @@ void Scene600::signal() {
void Scene600::process(Event &event) {
if (R2_GLOBALS._player._canWalk && (!R2_GLOBALS.getFlag(6)) && (event.eventType == EVENT_BUTTON_DOWN)
&& (R2_GLOBALS._events.getCursor() == CURSOR_WALK)) {
if (!_actor5.contains(event.mousePos) || (_actor5._frame <= 1)) {
if (!_doorway.contains(event.mousePos) || (_doorway._frame <= 1)) {
if (R2_GLOBALS.getFlag(5)) {
_field412 += 10;
} else {
Expand All @@ -5771,7 +5775,7 @@ void Scene600::process(Event &event) {
} else {
R2_GLOBALS._player.disableControl();
_sceneMode = 613;
setAction(&_sequenceManager1, this, 613, &R2_GLOBALS._player, &_actor6, NULL);
setAction(&_sequenceManager1, this, 613, &R2_GLOBALS._player, &_laser, NULL);
event.handled = true;
}
} else if ((!R2_GLOBALS.getFlag(6)) && (R2_GLOBALS._player._mover) && (_field412 < 10)){
Expand All @@ -5783,9 +5787,9 @@ void Scene600::process(Event &event) {

void Scene600::dispatch() {
if ((_field412 != 0) && (_sceneMode != 600) && (_sceneMode != 603) && (_sceneMode != 602)) {
if ( ((_actor6._strip == 4) && (_actor6._frame > 1))
if ( ((_laser._strip == 4) && (_laser._frame > 1))
|| (_sceneMode == 601)
|| ((_sceneMode == 616) && (_actor5._frame > 1)) )
|| ((_sceneMode == 616) && (_doorway._frame > 1)) )
_field412 = 0;
else {
_field412--;
Expand Down
22 changes: 11 additions & 11 deletions engines/tsage/ringworld2/ringworld2_scenes0.h
Expand Up @@ -615,7 +615,7 @@ class Scene525: public SceneExt {
};

class Scene600 : public SceneExt {
class Item1 : public NamedHotspot {
class CompartmentHotspot : public NamedHotspot {
public:
virtual bool startAction(CursorType action, Event &event);
};
Expand All @@ -630,15 +630,15 @@ class Scene600 : public SceneExt {
virtual bool startAction(CursorType action, Event &event);
virtual void draw();
};
class Actor5 : public SceneActor {
class Doorway : public SceneActor {
public:
virtual bool startAction(CursorType action, Event &event);
};
class Actor6 : public SceneActor {
class Laser : public SceneActor {
public:
virtual bool startAction(CursorType action, Event &event);
};
class Actor7 : public SceneActor {
class Aerosol : public SceneActor {
public:
virtual bool startAction(CursorType action, Event &event);
};
Expand All @@ -648,19 +648,19 @@ class Scene600 : public SceneExt {
};
public:
int _field412;
Item1 _item1;
Item1 _item2;
Item1 _item3;
CompartmentHotspot _background;
CompartmentHotspot _item2;
CompartmentHotspot _item3;
Item4 _item4;
Item1 _item5;
CompartmentHotspot _item5;
BackgroundSceneObject _object1;
SceneActor _actor1;
SceneActor _actor2;
SceneActor _actor3;
Actor4 _actor4;
Actor5 _actor5;
Actor6 _actor6;
Actor7 _actor7;
Doorway _doorway;
Laser _laser;
Aerosol _aerosol;
Actor8 _actor8;
ASoundExt _aSound1;
SequenceManager _sequenceManager1;
Expand Down

0 comments on commit 2eb26ad

Please sign in to comment.