Skip to content

Commit

Permalink
TSAGE: R2R - Implement scene 3100
Browse files Browse the repository at this point in the history
  • Loading branch information
Strangerke committed Dec 18, 2011
1 parent 0c47554 commit 14ccd4f
Show file tree
Hide file tree
Showing 6 changed files with 302 additions and 0 deletions.
1 change: 1 addition & 0 deletions engines/tsage/module.mk
Expand Up @@ -39,6 +39,7 @@ MODULE_OBJS := \
ringworld2/ringworld2_logic.o \
ringworld2/ringworld2_scenes0.o \
ringworld2/ringworld2_scenes2.o \
ringworld2/ringworld2_scenes3.o \
ringworld2/ringworld2_speakers.o \
saveload.o \
scenes.o \
Expand Down
2 changes: 2 additions & 0 deletions engines/tsage/ringworld2/ringworld2_logic.cpp
Expand Up @@ -28,6 +28,7 @@
#include "tsage/ringworld2/ringworld2_dialogs.h"
#include "tsage/ringworld2/ringworld2_scenes0.h"
#include "tsage/ringworld2/ringworld2_scenes2.h"
#include "tsage/ringworld2/ringworld2_scenes3.h"

namespace TsAGE {

Expand Down Expand Up @@ -169,6 +170,7 @@ Scene *Ringworld2Game::createScene(int sceneNumber) {
/* Scene group #3 */
//
case 3100:
return new Scene3100();
case 3125:
case 3150:
case 3175:
Expand Down
206 changes: 206 additions & 0 deletions engines/tsage/ringworld2/ringworld2_scenes3.cpp
@@ -0,0 +1,206 @@
/* ScummVM - Graphic Adventure Engine
*
* ScummVM is the legal property of its developers, whose names
* are too numerous to list here. Please refer to the COPYRIGHT
* file distributed with this source distribution.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
*/

#include "tsage/scenes.h"
#include "tsage/tsage.h"
#include "tsage/staticres.h"
#include "tsage/ringworld2/ringworld2_scenes3.h"

namespace TsAGE {

namespace Ringworld2 {

/*--------------------------------------------------------------------------
* Scene 3100 -
*
*--------------------------------------------------------------------------*/
Scene3100::Scene3100() {
_field412 = 0;
}

void Scene3100::synchronize(Serializer &s) {
SceneExt::synchronize(s);

s.syncAsSint16LE(_field412);
}

bool Scene3100::Actor6::startAction(CursorType action, Event &event) {
if (action != CURSOR_TALK)
return SceneActor::startAction(action, event);

Scene3100 *scene = (Scene3100 *)R2_GLOBALS._sceneManager._scene;

R2_GLOBALS._player.disableControl();
scene->_sceneMode = 10;
R2_GLOBALS._events.setCursor(CURSOR_CROSSHAIRS);
scene->_stripManager.start(606, scene);
return true;
}

void Scene3100::postInit(SceneObjectList *OwnerList) {
if (R2_GLOBALS._sceneManager._previousScene == 1000) {
if (R2_GLOBALS._player._oldCharacterScene[1] == 3100) {
loadScene(3101);
R2_GLOBALS._v58CE2 = 0;
} else {
loadScene(3100);
g_globals->gfxManager()._bounds.moveTo(Common::Point(160, 0));
}
} else {
loadScene(3100);
}
// Original was doing it twice in a row. Skipped.

if (R2_GLOBALS._sceneManager._previousScene == 3255)
R2_GLOBALS._v58CE2 = 0;

SceneExt::postInit();
_stripManager.addSpeaker(&_guardSpeaker);

if (R2_GLOBALS._sceneManager._previousScene == -1)
R2_GLOBALS._sceneManager._previousScene = 1000;

R2_GLOBALS._player.postInit();
R2_GLOBALS._player._characterIndex = R2_QUINN;
R2_GLOBALS._player.disableControl();

_actor1.postInit();
_item2.setDetails(Rect(212, 97, 320, 114), 3100, 3, -1, -1, 1, NULL);
_item1.setDetails(Rect(0, 0, 480, 200), 3100, 0, -1, -1, 1, NULL);
_field412 = 0;

if (R2_GLOBALS._sceneManager._previousScene == 1000) {
if (R2_GLOBALS._player._oldCharacterScene[1] == 3100) {
_sceneMode = 3102;
_actor3.postInit();
_actor4.postInit();
_actor5.postInit();
R2_GLOBALS._sound1.play(274);
_sound1.fadeSound(130);
setAction(&_sequenceManager, this, 3102, &_actor1, &R2_GLOBALS._player, &_actor3, &_actor4, &_actor5, NULL);
} else {
_actor6.postInit();
_actor6.setup(3110, 5, 1);
_actor6.changeZoom(50);
_actor6.setPosition(Common::Point(10, 149));
_actor6.setDetails(3100, 6, -1, -1, 2, NULL);

_actor4.postInit();
_actor4.setup(3103, 1, 1);
_actor4.setPosition(Common::Point(278, 113));
_actor4.setDetails(3100, 9, -1, -1, 2, NULL);
_actor4.animate(ANIM_MODE_2, NULL);

_field412 = 1;
_actor1.setDetails(3100, 3, -1, -1, 2, NULL);
R2_GLOBALS._sound1.play(243);
R2_GLOBALS._sound2.play(130);
_sceneMode = 3100;

setAction(&_sequenceManager, this, 3100, &R2_GLOBALS._player, &_actor1, NULL);
}
} else if (R2_GLOBALS._sceneManager._previousScene == 3255) {
_sceneMode = 3101;
_actor2.postInit();
_actor3.postInit();
_field412 = 1;

setAction(&_sequenceManager, this, 3101, &R2_GLOBALS._player, &_actor1, &_actor2, &_actor3, NULL);
} else {
_actor6.postInit();
_actor6.setup(3110, 5, 1);
_actor6.changeZoom(50);
_actor6.setPosition(Common::Point(10, 149));
_actor6.setDetails(3100, 6, -1, -1, 2, NULL);

_actor4.postInit();
_actor4.setup(3103, 1, 1);
_actor4.setPosition(Common::Point(278, 113));
_actor4.setDetails(3100, 9, -1, -1, 2, NULL);
_actor4.animate(ANIM_MODE_2, NULL);

_actor1.postInit();
_actor1.setup(3104, 4, 1);
_actor1.setPosition(Common::Point(143, 104));
_actor1.setDetails(3100, 3, -1, -1, 2, NULL);

R2_GLOBALS._player.setup(3110, 3, 1);
R2_GLOBALS._player.changeZoom(50);
R2_GLOBALS._player.animate(ANIM_MODE_1, NULL);
R2_GLOBALS._player.setPosition(Common::Point(160, 150));
R2_GLOBALS._player._moveDiff = Common::Point(3, 2);
R2_GLOBALS._player.enableControl(CURSOR_ARROW);

R2_GLOBALS._sound1.play(243);
}

R2_GLOBALS._player._oldCharacterScene[1] = 3100;
}

void Scene3100::remove() {
R2_GLOBALS._scrollFollower = &R2_GLOBALS._player;
R2_GLOBALS._sound1.fadeOut2(NULL);
R2_GLOBALS._sound2.fadeOut2(NULL);
_sound1.fadeOut2(NULL);
SceneExt::remove();
}

void Scene3100::signal() {
switch (_sceneMode) {
case 10:
warning("TODO: Unknown cursor used (6/-6)");
R2_GLOBALS._player.enableControl();
break;
case 3100:
R2_GLOBALS._player._moveDiff = Common::Point(3, 2);
R2_GLOBALS._scrollFollower = &R2_GLOBALS._player;
R2_GLOBALS._player.enableControl(CURSOR_ARROW);
break;
case 3101:
R2_GLOBALS._sceneManager.changeScene(1000);
break;
case 3102:
R2_GLOBALS._player._oldCharacterScene[1] = 1000;
R2_GLOBALS._sceneManager.changeScene(1000);
break;
default:
R2_GLOBALS._player.enableControl(CURSOR_ARROW);
break;
}
}

void Scene3100::dispatch() {
if ((_sceneMode == 3100) && (_field412 != 0) && (R2_GLOBALS._player._position.y == 104)) {
_field412 = 0;
R2_GLOBALS._sound2.fadeOut2(NULL);
}

if ((_sceneMode == 3101) && (_field412 != 0) && (R2_GLOBALS._player._position.y < 104)) {
_field412 = 0;
_sound1.fadeSound(130);
}

Scene::dispatch();
}

} // End of namespace Ringworld2
} // End of namespace TsAGE
73 changes: 73 additions & 0 deletions engines/tsage/ringworld2/ringworld2_scenes3.h
@@ -0,0 +1,73 @@
/* ScummVM - Graphic Adventure Engine
*
* ScummVM is the legal property of its developers, whose names
* are too numerous to list here. Please refer to the COPYRIGHT
* file distributed with this source distribution.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
*/

#ifndef TSAGE_RINGWORLD2_SCENES3_H
#define TSAGE_RINGWORLD2_SCENES3_H

#include "common/scummsys.h"
#include "tsage/converse.h"
#include "tsage/events.h"
#include "tsage/core.h"
#include "tsage/scenes.h"
#include "tsage/globals.h"
#include "tsage/sound.h"
#include "tsage/ringworld2/ringworld2_logic.h"
#include "tsage/ringworld2/ringworld2_speakers.h"

namespace TsAGE {

namespace Ringworld2 {

using namespace TsAGE;


class Scene3100 : public SceneExt {
class Actor6 : public SceneActor {
virtual bool startAction(CursorType action, Event &event);
};
public:

int _field412;
SpeakerGuard3100 _guardSpeaker;
NamedHotspot _item1;
NamedHotspot _item2;
SceneActor _actor1;
SceneActor _actor2;
SceneActor _actor3;
SceneActor _actor4;
SceneActor _actor5;
Actor6 _actor6;
ASoundExt _sound1;
SequenceManager _sequenceManager;

Scene3100();
virtual void postInit(SceneObjectList *OwnerList = NULL);
virtual void remove();
virtual void signal();
virtual void dispatch();
virtual void synchronize(Serializer &s);
};

} // End of namespace Ringworld2
} // End of namespace TsAGE

#endif
13 changes: 13 additions & 0 deletions engines/tsage/ringworld2/ringworld2_speakers.cpp
Expand Up @@ -1039,5 +1039,18 @@ void SpeakerGuard2800::proc15() {
_object1.animate(ANIM_MODE_5, this);
}
}

SpeakerGuard3100::SpeakerGuard3100() {
_speakerName = "GUARD";
_color1 = 5;
_color2 = 0;
_fieldF6 = 0;
_textWidth = 300;
_hideObjects = false;
_object2 = NULL;
_displayMode = 1;
_numFrames = 0;
}

} // End of namespace Ringworld2
} // End of namespace TsAGE
7 changes: 7 additions & 0 deletions engines/tsage/ringworld2/ringworld2_speakers.h
Expand Up @@ -261,6 +261,13 @@ class SpeakerGuard2800 : public VisualSpeaker {
virtual Common::String getClassName() { return "SpeakerGuard2800"; }
virtual void proc15();
};

class SpeakerGuard3100 : public VisualSpeaker {
public:
SpeakerGuard3100();

virtual Common::String getClassName() { return "SpeakerGuard3100"; }
};
} // End of namespace Ringworld2
} // End of namespace TsAGE

Expand Down

0 comments on commit 14ccd4f

Please sign in to comment.