Skip to content

Commit

Permalink
TSAGE: Bugfixes and renaming for R2R title screen
Browse files Browse the repository at this point in the history
  • Loading branch information
dreammaster committed Sep 28, 2013
1 parent ac1be66 commit 68d446c
Show file tree
Hide file tree
Showing 6 changed files with 176 additions and 84 deletions.
14 changes: 6 additions & 8 deletions engines/tsage/ringworld2/ringworld2_logic.cpp
Expand Up @@ -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:
Expand Down Expand Up @@ -1118,10 +1116,10 @@ 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();
Expand All @@ -1132,7 +1130,7 @@ void Ringworld2Game::restart() {
g_globals->_soundHandler.stop();

// Change to the first game scene
g_globals->_sceneManager.changeScene(100);
g_globals->_sceneManager.changeScene(180);
}

void Ringworld2Game::endGame(int resNum, int lineNum) {
Expand Down Expand Up @@ -2087,7 +2085,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) {
Expand Down Expand Up @@ -2133,13 +2131,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);
}

/*--------------------------------------------------------------------------*/
Expand Down
2 changes: 1 addition & 1 deletion engines/tsage/ringworld2/ringworld2_logic.h
Expand Up @@ -441,7 +441,7 @@ class AnimationPlayer: public EventHandler {

class AnimationPlayerExt: public AnimationPlayer {
public:
int _v;
bool _isActive;
public:
AnimationPlayerExt();

Expand Down
137 changes: 71 additions & 66 deletions engines/tsage/ringworld2/ringworld2_scenes0.cpp
Expand Up @@ -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)
Expand Down Expand Up @@ -1480,22 +1481,22 @@ 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;
}
}

/*--------------------------------------------------------------------------*/

Scene180::Scene180(): SceneExt(), _webbsterSpeaker(27) {
Scene180::Scene180(): SceneExt() {
_field412 = 0;
_frameInc = 0;
_frameNumber = R2_GLOBALS._events.getFrameNumber();
Expand Down Expand Up @@ -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;

Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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:
Expand All @@ -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;

Expand All @@ -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);
Expand All @@ -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);

Expand All @@ -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:
Expand All @@ -1823,7 +1827,7 @@ void Scene180::signal() {

case 41:
_field412 = 1;
_animationPlayer._v = 1;
_animationPlayer._isActive = true;
break;

case 42:
Expand All @@ -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);
Expand Down Expand Up @@ -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();

Expand Down
8 changes: 4 additions & 4 deletions engines/tsage/ringworld2/ringworld2_scenes0.h
Expand Up @@ -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;
Expand Down

0 comments on commit 68d446c

Please sign in to comment.