Skip to content

Commit

Permalink
TSAGE: Implemented Scene 666 - Death Scene
Browse files Browse the repository at this point in the history
  • Loading branch information
dreammaster committed Sep 11, 2011
1 parent 406a8ca commit 3e45367
Show file tree
Hide file tree
Showing 12 changed files with 266 additions and 12 deletions.
8 changes: 8 additions & 0 deletions engines/tsage/blue_force/blueforce_logic.cpp
Expand Up @@ -25,6 +25,7 @@
#include "tsage/blue_force/blueforce_scenes0.h"
#include "tsage/blue_force/blueforce_scenes1.h"
#include "tsage/blue_force/blueforce_scenes3.h"
#include "tsage/blue_force/blueforce_scenes6.h"
#include "tsage/scenes.h"
#include "tsage/tsage.h"
#include "tsage/graphics.h"
Expand Down Expand Up @@ -117,6 +118,8 @@ Scene *BlueForceGame::createScene(int sceneNumber) {
case 600:
case 620:
case 666:
// Death scene
return new Scene666();
case 690:
error("Scene group 6 not implemented");
case 710:
Expand Down Expand Up @@ -597,6 +600,11 @@ bool SceneExt::display(CursorType action) {
return true;
}

void SceneExt::fadeOut() {
uint32 black = 0;
BF_GLOBALS._scenePalette.fade((const byte *)&black, false, 100);
}

void SceneExt::gunDisplay() {
if (!BF_GLOBALS.getFlag(gunDrawn)) {
// Gun not drawn
Expand Down
2 changes: 1 addition & 1 deletion engines/tsage/blue_force/blueforce_logic.h
Expand Up @@ -170,7 +170,7 @@ class SceneExt: public Scene {
void addTimer(Timer *timer) { _timerList.add(timer); }
void removeTimer(Timer *timer) { _timerList.remove(timer); }
bool display(CursorType action);
void fadeOut() {}
void fadeOut();
};

class GroupedScene: public SceneExt {
Expand Down
6 changes: 3 additions & 3 deletions engines/tsage/blue_force/blueforce_scenes0.cpp
Expand Up @@ -294,7 +294,7 @@ void Scene50::Tooltip::highlight(bool btnDown) {
BF_GLOBALS._player.disableControl();
scene->_sceneNumber = _newSceneNumber;
} else {
BF_GLOBALS._v4CEA8 = 4;
BF_GLOBALS._deathReason = 4;
BF_GLOBALS._sceneManager.changeScene(666);
return;
}
Expand Down Expand Up @@ -450,7 +450,7 @@ void Scene50::signal() {
if (BF_GLOBALS._bookmark >= bStoppedFrankie)
BF_GLOBALS.setFlag(131);
if (BF_GLOBALS._bookmark == bArrestedGreen) {
BF_GLOBALS._v4CEA8 = 19;
BF_GLOBALS._deathReason = 19;
_sceneNumber = 666;
}
}
Expand Down Expand Up @@ -570,7 +570,7 @@ bool Scene60::Item2::check1() {
BF_GLOBALS._v5098C = (BF_GLOBALS._v5098C & 0xC3) | (v << 2);

if ((v != 1) && (v != 2)) {
BF_GLOBALS._v4CEA8 = 19;
BF_GLOBALS._deathReason = 19;
BF_GLOBALS._sceneManager.changeScene(666);
return true;
}
Expand Down
8 changes: 5 additions & 3 deletions engines/tsage/blue_force/blueforce_scenes3.cpp
Expand Up @@ -961,6 +961,8 @@ Scene315::Scene315() {
}

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

s.syncAsSint16LE(_field1390);
s.syncAsSint16LE(_stripNumber);
s.syncAsSint16LE(_field1398);
Expand Down Expand Up @@ -1146,7 +1148,7 @@ void Scene315::signal() {
}

if (ctr) {
BF_GLOBALS._v4CEA8 = 20;
BF_GLOBALS._deathReason = 20;
BF_GLOBALS._sceneManager.changeScene(666);
} else {
BF_GLOBALS._sceneManager.changeScene(300);
Expand All @@ -1171,7 +1173,7 @@ void Scene315::signal() {
}

if (ctr == 1) {
BF_GLOBALS._v4CEA8 = 20;
BF_GLOBALS._deathReason = 20;
BF_GLOBALS._sound1.fadeOut2(NULL);
} else if ((BF_GLOBALS._bookmark != bBookedFrankie) || !BF_GLOBALS.getFlag(onDuty)) {
BF_GLOBALS._sound1.fadeOut2(NULL);
Expand Down Expand Up @@ -1264,7 +1266,7 @@ void Scene315::signal() {
BF_GLOBALS._player.enableControl();
break;
case 3161:
BF_GLOBALS._v4CEA8 = 21;
BF_GLOBALS._deathReason = 21;
BF_GLOBALS._sound1.fadeOut2(NULL);
BF_GLOBALS._sceneManager.changeScene(666);
break;
Expand Down
168 changes: 168 additions & 0 deletions engines/tsage/blue_force/blueforce_scenes6.cpp
@@ -0,0 +1,168 @@
/* 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/blue_force/blueforce_scenes6.h"
#include "tsage/blue_force/blueforce_dialogs.h"
#include "tsage/scenes.h"
#include "tsage/tsage.h"
#include "tsage/staticres.h"

namespace TsAGE {

namespace BlueForce {

/*--------------------------------------------------------------------------
* Scene 666 - Death Scene
*
*--------------------------------------------------------------------------*/

void Scene666::Action1::signal() {
switch (_actionIndex++) {
case 0:
BF_GLOBALS._player.hide();
setDelay(6);
break;
case 1:
BF_GLOBALS._game->restartGame();
break;
}
}

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

bool Scene666::Item1::startAction(CursorType action, Event &event) {
return true;
}

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

void Scene666::postInit(SceneObjectList *OwnerList) {
BF_GLOBALS._sound1.play(27);
SceneExt::postInit();
BF_GLOBALS._interfaceY = 200;
loadScene(999);
BF_GLOBALS._screenSurface.fillRect(BF_GLOBALS._screenSurface.getBounds(), 0);

if (BF_GLOBALS._dayNumber == 0) {
BF_GLOBALS._dayNumber = 1;
BF_GLOBALS._deathReason = BF_GLOBALS._randomSource.getRandomNumber(23);
}

BF_GLOBALS._scenePalette.loadPalette(BF_GLOBALS._sceneManager._previousScene);
BF_GLOBALS._uiElements._active = false;

_item1.setDetails(Rect(0, 0, SCREEN_WIDTH, SCREEN_HEIGHT), 666, -1, -1, -1, 1, NULL);
BF_GLOBALS._player.postInit();
BF_GLOBALS._events.setCursor(CURSOR_WALK);

if (BF_GLOBALS._sceneManager._previousScene == 271) {
setAction(&_action1);
} else {
switch (BF_GLOBALS._deathReason) {
case 4:
case 18:
case 19:
case 20:
BF_GLOBALS._scenePalette.loadPalette(668);
BF_GLOBALS._player.setVisage(668);
BF_GLOBALS._player.setStrip2(1);
BF_GLOBALS._player.setPosition(Common::Point(77, 155));
BF_GLOBALS._player.animate(ANIM_MODE_5, this);
break;
case 5:
BF_GLOBALS._scenePalette.loadPalette(900);
BF_GLOBALS._scenePalette.refresh();
BF_GLOBALS._player.setVisage(666);
BF_GLOBALS._player.setPosition(Common::Point(60, 160));
signal();
break;
case 7:
case 11:
case 12:
case 22:
BF_GLOBALS._scenePalette.loadPalette(667);
BF_GLOBALS._scenePalette.refresh();

_object1.postInit();
_object2.postInit();
_object3.postInit();
setAction(&_sequenceManager, this, 6660, &BF_GLOBALS._player, &_object1, &_object2,
&_object3, NULL);
break;
case 13:
case 14:
BF_GLOBALS._scenePalette.loadPalette(665);
BF_GLOBALS._scenePalette.refresh();
BF_GLOBALS._player.setVisage(665);
BF_GLOBALS._player.setPosition(Common::Point(80, 140));
signal();
break;
case 24:
BF_GLOBALS._player.setVisage(664);
BF_GLOBALS._player.setPosition(Common::Point(70, 160));
signal();
break;
default:
BF_GLOBALS._scenePalette.loadPalette(669);
BF_GLOBALS._scenePalette.refresh();
BF_GLOBALS._player.setVisage(669);
BF_GLOBALS._player.setStrip(1);
BF_GLOBALS._player.setPosition(Common::Point(27, 27));
BF_GLOBALS._player.animate(ANIM_MODE_5, this);
break;
}
}
}

void Scene666::remove() {
BF_GLOBALS._sound1.fadeOut2(NULL);
BF_GLOBALS._scrollFollower = &BF_GLOBALS._player;
SceneExt::remove();
BF_GLOBALS._uiElements._active = true;
}

void Scene666::signal() {
BF_GLOBALS._player.enableControl();
Rect textRect, sceneBounds;

_text._color1 = 19;
_text._color2 = 9;
_text._color3 = 13;
_text._fontNumber = 4;
_text._width = 150;

Common::String msg = _resourceManager->getMessage(666, BF_GLOBALS._deathReason);
sceneBounds = BF_GLOBALS._sceneManager._scene->_sceneBounds;
sceneBounds.collapse(4, 2);
BF_GLOBALS.gfxManager()._font.getStringBounds(msg.c_str(), textRect, _text._width);
textRect.moveTo(160, 10);
textRect.contain(sceneBounds);

_text.setup(msg);
_text.setPosition(Common::Point(textRect.left, textRect.top));
_text.setPriority(255);
_text.show();
}

} // End of namespace BlueForce

} // End of namespace TsAGE
70 changes: 70 additions & 0 deletions engines/tsage/blue_force/blueforce_scenes6.h
@@ -0,0 +1,70 @@
/* 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_BLUEFORCE_SCENES6_H
#define TSAGE_BLUEFORCE_SCENES6_H

#include "common/scummsys.h"
#include "tsage/blue_force/blueforce_logic.h"
#include "tsage/blue_force/blueforce_speakers.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"

namespace TsAGE {

namespace BlueForce {

using namespace TsAGE;

class Scene666 : public SceneExt {
/* Actions */
class Action1 : public Action {
public:
virtual void signal();
};

/* Items */
class Item1: public NamedHotspot {
public:
virtual bool startAction(CursorType action, Event &event);
};
public:
Action1 _action1;
SequenceManager _sequenceManager;
NamedObject _object1, _object2, _object3;
Item1 _item1;
SceneText _text;

virtual void postInit(SceneObjectList *OwnerList = NULL);
virtual void remove();
virtual void signal();
};

} // End of namespace BlueForce

} // End of namespace TsAGE

#endif
7 changes: 7 additions & 0 deletions engines/tsage/core.cpp
Expand Up @@ -2996,6 +2996,9 @@ void Player::process(Event &event) {
(_globals->_events.getCursor() == CURSOR_WALK) && _globals->_player._canWalk &&
(_position != event.mousePos) && _globals->_sceneObjects->contains(this)) {

if ((_vm->getGameID() == GType_BlueForce) && !BF_GLOBALS._player._enabled)
return;

PlayerMover *newMover = new PlayerMover();
Common::Point destPos(event.mousePos.x + _globals->_sceneManager._scene->_sceneBounds.left,
event.mousePos.y + _globals->_sceneManager._scene->_sceneBounds.top);
Expand Down Expand Up @@ -3824,6 +3827,7 @@ void SceneHandler::process(Event &event) {
if (i != _globals->_sceneItems.end()) {
// Pass the action to the item
(*i)->startAction(_globals->_events.getCursor(), event);

event.handled = _globals->_events.getCursor() != CURSOR_WALK;

if (_globals->_player._uiEnabled && _globals->_player._canWalk &&
Expand All @@ -3834,6 +3838,9 @@ void SceneHandler::process(Event &event) {
} else if (_globals->_player._uiEnabled && (_globals->_events.getCursor() != CURSOR_LOOK)) {
_globals->_events.setCursor(CURSOR_USE);
}

if (_vm->getGameID() == GType_BlueForce)
event.handled = true;
}

// Handle any fallback text display
Expand Down
4 changes: 2 additions & 2 deletions engines/tsage/globals.cpp
Expand Up @@ -191,7 +191,7 @@ void BlueForceGlobals::synchronize(Serializer &s) {

s.syncAsSint16LE(_dayNumber);
s.syncAsSint16LE(_v4CEA4);
s.syncAsSint16LE(_v4CEA8);
s.syncAsSint16LE(_deathReason);
s.syncAsSint16LE(_driveFromScene);
s.syncAsSint16LE(_driveToScene);
s.syncAsSint16LE(_v4CF9E);
Expand Down Expand Up @@ -228,7 +228,7 @@ void BlueForceGlobals::reset() {
_v51C44 = 1;
_dayNumber = 0;
_v4CEA4 = 0;
_v4CEA8 = 0;
_deathReason = 0;
_v4CF9E = 0;
_v4E238 = 0;
_v50696 = 0;
Expand Down
2 changes: 1 addition & 1 deletion engines/tsage/globals.h
Expand Up @@ -169,7 +169,7 @@ class BlueForceGlobals: public Globals {
StripProxy _stripProxy;
int _dayNumber;
int _v4CEA4;
int _v4CEA8;
int _deathReason;
int _driveFromScene;
int _driveToScene;
int _v4CF9E;
Expand Down

0 comments on commit 3e45367

Please sign in to comment.