[Scummvm-cvs-logs] scummvm master -> 744f04bf5001bf4220ecec40adc299e00b5792a4

dreammaster dreammaster at scummvm.org
Thu Aug 11 14:09:21 CEST 2011


This automated email contains information about 2 new commits which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .

Summary:
c903411036 TSAGE: Added support for reverse palette fading
744f04bf50 TSAGE: Implemented new Globals for Blue Force, and beginnings of implementation of Scene 100 (Title Screen)


Commit: c9034110363ebc031a37784af913ba107411376d
    https://github.com/scummvm/scummvm/commit/c9034110363ebc031a37784af913ba107411376d
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2011-08-11T05:03:57-07:00

Commit Message:
TSAGE: Added support for reverse palette fading

Changed paths:
    engines/tsage/core.cpp
    engines/tsage/core.h



diff --git a/engines/tsage/core.cpp b/engines/tsage/core.cpp
index d0075d5..52c1a5c 100644
--- a/engines/tsage/core.cpp
+++ b/engines/tsage/core.cpp
@@ -1161,6 +1161,20 @@ void PaletteFader::remove() {
 		action->signal();
 }
 
+void PaletteFader::setPalette(ScenePalette *palette, int step) {
+	if (step < 0) {
+		// Reverse step means moving from dest palette to source, so swap the two palettes
+		byte tempPal[256 * 3];
+		Common::copy(&palette->_palette[0], &palette->_palette[256 * 3], &tempPal[0]);
+		Common::copy(&this->_palette[0], &this->_palette[256 * 3], &palette->_palette[0]);
+		Common::copy(&tempPal[0], &tempPal[256 * 3], &this->_palette[0]);
+
+		step = -step;
+	}
+
+	PaletteModifierCached::setPalette(palette, step);
+}
+
 /*--------------------------------------------------------------------------*/
 
 ScenePalette::ScenePalette() {
@@ -1314,7 +1328,7 @@ PaletteRotation *ScenePalette::addRotation(int start, int end, int rotationMode,
 	return obj;
 }
 
-PaletteFader *ScenePalette::addFader(const byte *arrBufferRGB, int palSize, int percent, Action *action) {
+PaletteFader *ScenePalette::addFader(const byte *arrBufferRGB, int palSize, int step, Action *action) {
 	PaletteFader *fader = new PaletteFader();
 	fader->_action = action;
 	for (int i = 0; i < 256 * 3; i += 3) {
@@ -1326,7 +1340,7 @@ PaletteFader *ScenePalette::addFader(const byte *arrBufferRGB, int palSize, int
 			arrBufferRGB += 3;
 	}
 
-	fader->setPalette(this, percent);
+	fader->setPalette(this, step);
 	_globals->_scenePalette._listeners.push_back(fader);
 	return fader;
 }
@@ -2274,6 +2288,22 @@ void SceneObject::setup(int visage, int stripFrameNum, int frameNum, int posX, i
 
 /*--------------------------------------------------------------------------*/
 
+void SceneObjectExt2::postInit(SceneObjectList *OwnerList) {
+	_v8A = -1;
+	_v8C = -1;
+	_v8E = -1;
+	SceneObject::postInit();
+}
+
+void SceneObjectExt2::synchronize(Serializer &s) {
+	SceneObject::synchronize(s);
+	s.syncAsSint16LE(_v8A);
+	s.syncAsSint16LE(_v8C);
+	s.syncAsSint16LE(_v8E);
+}
+
+/*--------------------------------------------------------------------------*/
+
 void SceneObjectList::draw() {
 	Common::Array<SceneObject *> objList;
 	int paneNum = 0;
diff --git a/engines/tsage/core.h b/engines/tsage/core.h
index b86e2f6..959f96b 100644
--- a/engines/tsage/core.h
+++ b/engines/tsage/core.h
@@ -287,7 +287,7 @@ public:
 
 	PaletteModifierCached();
 
-	void setPalette(ScenePalette *palette, int step);
+	virtual void setPalette(ScenePalette *palette, int step);
 	virtual Common::String getClassName() { return "PaletteModifierCached"; }
 	virtual void synchronize(Serializer &s);
 };
@@ -323,6 +323,7 @@ public:
 	virtual void synchronize(Serializer &s);
 	virtual void signal();
 	virtual void remove();
+	virtual void setPalette(ScenePalette *palette, int step);
 };
 
 /*--------------------------------------------------------------------------*/
@@ -356,7 +357,7 @@ public:
 	void clearListeners();
 	void fade(const byte *adjustData, bool fullAdjust, int percent);
 	PaletteRotation *addRotation(int start, int end, int rotationMode, int duration = 0, Action *action = NULL);
-	PaletteFader *addFader(const byte *arrBufferRGB, int palSize, int percent, Action *action);
+	PaletteFader *addFader(const byte *arrBufferRGB, int palSize, int step, Action *action);
 
 	static void changeBackground(const Rect &bounds, FadeMode fadeMode);
 
@@ -569,6 +570,16 @@ public:
 	virtual Common::String getClassName() { return "SceneObjectExt"; }
 };
 
+class SceneObjectExt2: public SceneObject {
+public:
+	int _v88, _v8A, _v8C, _v8E;
+
+	virtual Common::String getClassName() { return "BF100Object"; }
+	virtual void synchronize(Serializer &s);
+	virtual void postInit(SceneObjectList *OwnerList = NULL);
+};
+
+
 class SceneText : public SceneObject {
 public:
 	int _fontNumber;


Commit: 744f04bf5001bf4220ecec40adc299e00b5792a4
    https://github.com/scummvm/scummvm/commit/744f04bf5001bf4220ecec40adc299e00b5792a4
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2011-08-11T05:05:44-07:00

Commit Message:
TSAGE: Implemented new Globals for Blue Force, and beginnings of implementation of Scene 100 (Title Screen)

Changed paths:
  A engines/tsage/blueforce_scenes1.cpp
  A engines/tsage/blueforce_scenes1.h
    engines/tsage/blueforce_logic.cpp
    engines/tsage/events.cpp
    engines/tsage/globals.cpp
    engines/tsage/globals.h
    engines/tsage/module.mk
    engines/tsage/scenes.cpp
    engines/tsage/staticres.cpp
    engines/tsage/staticres.h
    engines/tsage/tsage.cpp



diff --git a/engines/tsage/blueforce_logic.cpp b/engines/tsage/blueforce_logic.cpp
index 3cf31b0..cad7609 100644
--- a/engines/tsage/blueforce_logic.cpp
+++ b/engines/tsage/blueforce_logic.cpp
@@ -22,6 +22,7 @@
 
 #include "tsage/blueforce_logic.h"
 #include "tsage/blueforce_scenes0.h"
+#include "tsage/blueforce_scenes1.h"
 #include "tsage/scenes.h"
 #include "tsage/tsage.h"
 #include "tsage/staticres.h"
@@ -37,13 +38,17 @@ void BlueForceGame::start() {
 
 Scene *BlueForceGame::createScene(int sceneNumber) {
 	switch (sceneNumber) {
+	/* Scene Group #0 */
 	case 20:
 		// Tsunami Title Screen
 		return new BF_Scene20();
 	case 50:
 	case 60:
 		error("Scene group 0 not implemented");
+	/* Scene Group #1 */
 	case 100:
+		// Tsnunami Title Screen #2
+		return new BF_Scene100();
 	case 109:
 	case 110:
 	case 114:
diff --git a/engines/tsage/blueforce_scenes1.cpp b/engines/tsage/blueforce_scenes1.cpp
new file mode 100644
index 0000000..81f7d0a
--- /dev/null
+++ b/engines/tsage/blueforce_scenes1.cpp
@@ -0,0 +1,195 @@
+/* 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 "common/config-manager.h"
+#include "tsage/blueforce_scenes1.h"
+#include "tsage/scenes.h"
+#include "tsage/tsage.h"
+#include "tsage/staticres.h"
+#include "tsage/globals.h"
+
+namespace tSage {
+
+/*--------------------------------------------------------------------------
+ * Scene 100 - Tsunami Title Screen #2
+ *
+ *--------------------------------------------------------------------------*/
+
+void BF_Scene100::Action1::signal() {
+	static byte black[3] = { 0, 0, 0 };
+
+	switch (_actionIndex++) {
+	case 0:
+		_state = 0;
+		setDelay(6);
+		break;
+	case 1: {
+		Common::String msg1 = _resourceManager->getMessage(100, _state++);
+		if (!msg1.compareTo("LASTCREDIT")) {
+			Common::String msg2 = _resourceManager->getMessage(100, _state++);
+			setTextStrings(msg1, msg2, this);
+		} else {
+			setTextStrings(BF_NAME, BF_ALL_RIGHTS_RESERVED, this);
+			
+			Common::Point pt(_sceneText1._position.x, 80);
+			NpcMover *mover = new NpcMover();
+			_sceneText1.addMover(mover, &pt, this);
+		}
+		break;
+	}
+	case 2:
+		setDelay(600);
+		break;
+	case 3:
+		BF_GLOBALS._sound1.fade(0, 10, 10, 1, this);
+		GLOBALS._scenePalette.addFader(black, 1, 2, NULL);
+		break;
+	case 4:
+		error("??exit");
+		break;
+	}
+}
+
+void BF_Scene100::Action1::setTextStrings(const Common::String &msg1, const Common::String &msg2, Action *action) {
+	// Set data for first text control
+	_sceneText1._fontNumber = 10;
+	_sceneText1._width = 160;
+	_sceneText1._textMode = ALIGN_RIGHT;
+	_sceneText1._color1 = _globals->_fontColors.background;
+	_sceneText1._color2 = _globals->_fontColors.foreground;
+	_sceneText1._color3 = _globals->_fontColors.background;
+	_sceneText1.setup(msg1);
+	_sceneText1.setFrame2(-1);
+	_sceneText1.setPosition(Common::Point(
+		(SCREEN_WIDTH - _sceneText1.getFrame().getBounds().width()) / 2, 202));
+	_sceneText1._moveRate = 30;
+	_sceneText1._moveDiff.y = 1;
+
+	// Set data for second text control
+	_sceneText2._fontNumber = 10;
+	_sceneText2._width = _sceneText1._width;
+	_sceneText2._textMode = _sceneText1._textMode;
+	_sceneText2._color1 = _globals->_fontColors.background;
+	_sceneText2._color2 = _globals->_fontColors.foreground;
+	_sceneText2._color3 = _globals->_fontColors.background;
+	_sceneText2.setup(msg1);
+	_sceneText2.setFrame2(-1);
+	GfxSurface textSurface = _sceneText2.getFrame();
+	_sceneText2.setPosition(Common::Point((SCREEN_WIDTH - textSurface.getBounds().width()) / 2, 202));
+	_sceneText2._moveRate = 30;
+	_sceneText2._moveDiff.y = 1;
+	
+	_textHeight = textSurface.getBounds().height();
+	int yp = -(_textHeight * 2);
+
+	Common::Point pt(_sceneText1._position.x, yp); 
+	NpcMover *mover = new NpcMover();
+	_sceneText1.addMover(mover, &pt, action); 
+}
+
+void BF_Scene100::Action2::signal() {
+	BF_Scene100 *scene = (BF_Scene100 *)_globals->_sceneManager._scene;
+	static byte black[3] = {0, 0, 0};
+
+	switch (_actionIndex++) {
+	case 0:
+		BF_GLOBALS._scenePalette.addFader(black, 1, -2, this);
+		break;
+	case 1:
+		setDelay(180);
+		break;
+	case 2: {
+		const char *SEEN_INTRO = "seen_intro";
+		if (!ConfMan.hasKey(SEEN_INTRO) || !ConfMan.getBool(SEEN_INTRO)) {
+			// First time being played, so will need to show the intro
+			ConfMan.setBool(SEEN_INTRO, true);
+			ConfMan.flushToDisk();
+		} else {
+			// Prompt user for whether to start play or watch introduction
+			_globals->_player.enableControl();
+
+			if (MessageDialog::show2(WATCH_INTRO_MSG, START_PLAY_BTN_STRING, INTRODUCTION_BTN_STRING) == 0) {
+				// Signal to start the game
+				scene->_index = 190;
+				remove();
+				return;
+			}
+		}
+
+		// At this point the introduction needs to start
+		_globals->_scenePalette.addFader(black, 1, 2, this);
+		break;
+	}
+	case 3:
+		remove();
+		break;
+	}
+}
+
+/*--------------------------------------------------------------------------*/
+
+BF_Scene100::BF_Scene100(): Scene() {
+	_index = 0;
+}
+
+void BF_Scene100::postInit(SceneObjectList *OwnerList) {
+	BF_GLOBALS._scenePalette.loadPalette(2);
+	BF_GLOBALS._v51C44 = 1;
+	Scene::postInit();
+	BF_GLOBALS._v51C24 = 200;
+
+	_globals->_player.enableControl();
+	_globals->_player.hide();
+	_globals->_player.disableControl();
+	_index = 109;
+
+	if (BF_GLOBALS._v4CEA2 < 6) {
+		// Title
+		loadScene(100);
+		BF_GLOBALS._sound1.play(2);
+		setAction(&_action2, this);
+	} else {
+		// Credits
+		loadScene(101);
+		BF_GLOBALS._sound1.play(118);
+		setAction(&_action1, this);
+	}
+
+	loadScene(20);
+	setZoomPercents(60, 85, 200, 100);
+}
+
+void BF_Scene100::signal() {
+	++_sceneMode;
+	if (BF_GLOBALS._v4CEA2 < 6) {
+		BF_GLOBALS._scenePalette.clearListeners();
+		BF_GLOBALS._scenePalette.loadPalette(100);
+		BF_GLOBALS._sceneManager.changeScene(_index);
+	} else {
+		if (_sceneMode > 1)
+			BF_GLOBALS._events.setCursor(CURSOR_ARROW);
+
+		setAction(this, &_action1, this);
+	}
+}
+
+} // End of namespace tSage
diff --git a/engines/tsage/blueforce_scenes1.h b/engines/tsage/blueforce_scenes1.h
new file mode 100644
index 0000000..d9fcc48
--- /dev/null
+++ b/engines/tsage/blueforce_scenes1.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_BLUEFORCE_SCENES1_H
+#define TSAGE_BLUEFORCE_SCENES1_H
+
+#include "common/scummsys.h"
+#include "tsage/blueforce_logic.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 {
+
+class BF_Scene100: public Scene {
+	/* Actions */
+	class Action1: public ActionExt {
+	private:
+		void setTextStrings(const Common::String &msg1, const Common::String &msg2, Action *action);
+	public:
+		SceneText _sceneText1, _sceneText2;
+		int _textHeight;
+
+		virtual Common::String getClassName() { return "BF100Action1"; }
+		virtual void synchronize(Serializer &s) {
+			ActionExt::synchronize(s);
+			s.syncAsSint16LE(_textHeight);
+		}
+		virtual void signal();
+	};
+	class Action2: public ActionExt {
+	public:
+		virtual Common::String getClassName() { return "BF100Action2"; }
+		virtual void signal();
+	};
+public:
+	SequenceManager _sequenceManager;
+	Action1 _action1;
+	Action2 _action2;
+	ScenePalette _scenePalette;
+	SceneObjectExt2 _object1, _object2, _object3, _object4, _object5;
+	int _index;
+
+	BF_Scene100();
+	virtual void postInit(SceneObjectList *OwnerList = NULL);
+	virtual void signal();
+};
+
+} // End of namespace tSage
+
+#endif
diff --git a/engines/tsage/events.cpp b/engines/tsage/events.cpp
index 7aadf62..59894f3 100644
--- a/engines/tsage/events.cpp
+++ b/engines/tsage/events.cpp
@@ -155,7 +155,7 @@ void EventsClass::setCursor(CursorType cursorType) {
 		// No cursor
 		_globals->setFlag(122);
 
-		if (_vm->getFeatures() & GF_DEMO) {
+		if ((_vm->getFeatures() & GF_DEMO) || (_vm->getGameID() == GType_BlueForce))  {
 			CursorMan.showMouse(false);
 			return;
 		}
diff --git a/engines/tsage/globals.cpp b/engines/tsage/globals.cpp
index 34b26ec..e5572d9 100644
--- a/engines/tsage/globals.cpp
+++ b/engines/tsage/globals.cpp
@@ -166,5 +166,17 @@ void Globals::dispatchSounds() {
 	Common::for_each(_sounds.begin(), _sounds.end(), Globals::dispatchSound);
 }
 
+/*--------------------------------------------------------------------------*/
+
+BlueForceGlobals::BlueForceGlobals(): Globals() {
+	_v51C24 = 0;
+	_v51C44 = 1;
+	_v4CEA2 = 0;
+}
+
+void BlueForceGlobals::synchronize(Serializer &s) {
+	Globals::synchronize(s);
+	error("Sync variables");
+}
 
 } // end of namespace tSage
diff --git a/engines/tsage/globals.h b/engines/tsage/globals.h
index 7cfec71..9d12669 100644
--- a/engines/tsage/globals.h
+++ b/engines/tsage/globals.h
@@ -96,8 +96,23 @@ public:
 	void dispatchSounds();
 };
 
+class BlueForceGlobals: public Globals {
+public:
+	ASound _sound1, _sound2, _sound3;
+	int _v4CEA2;
+	int _v51C44;
+	int _v51C24;
+
+	BlueForceGlobals();
+	virtual Common::String getClassName() { return "BFGlobals"; }
+	virtual void synchronize(Serializer &s);
+};
+
 extern Globals *_globals;
 
+#define GLOBALS (*_globals)
+#define BF_GLOBALS (*((BlueForceGlobals *)_globals))
+
 // Note: Currently this can't be part of the _globals structure, since it needs to be constructed
 // prior to many of the fields in Globals execute their constructors
 extern ResourceManager *_resourceManager;
diff --git a/engines/tsage/module.mk b/engines/tsage/module.mk
index 5866995..7ac1795 100644
--- a/engines/tsage/module.mk
+++ b/engines/tsage/module.mk
@@ -3,6 +3,7 @@ MODULE := engines/tsage
 MODULE_OBJS := \
 	blueforce_logic.o \
 	blueforce_scenes0.o \
+	blueforce_scenes1.o \
 	converse.o \
 	core.o \
 	debugger.o \
diff --git a/engines/tsage/scenes.cpp b/engines/tsage/scenes.cpp
index 9a175ea..6a164a6 100644
--- a/engines/tsage/scenes.cpp
+++ b/engines/tsage/scenes.cpp
@@ -28,9 +28,6 @@
 
 namespace tSage {
 
-// TODO: Doesn't seem to be ever set
-const bool _v52C9F = false;
-
 SceneManager::SceneManager() {
 	_scene = NULL;
 	_hasPalette = false;
@@ -505,8 +502,13 @@ void Scene::setZoomPercents(int yStart, int minPercent, int yEnd, int maxPercent
 }
 
 byte *Scene::preloadVisage(int resNum) {
+	// This isn't being used, since modern systems can load the data much quicker, and in any case
+	// visage data is specially loaded into the Visage class, and the resources discarded from memory.
+	return NULL;
+/*
 	assert(!_v52C9F);
 	return _resourceManager->getResource(RES_VISAGE, resNum, 9999, false);
+*/
 }
 
 /*--------------------------------------------------------------------------*/
diff --git a/engines/tsage/staticres.cpp b/engines/tsage/staticres.cpp
index 9f36268..5d8f1b0 100644
--- a/engines/tsage/staticres.cpp
+++ b/engines/tsage/staticres.cpp
@@ -118,4 +118,15 @@ const char *EXIT_BTN_STRING = "Exit";
 const char *DEMO_BTN_STRING = "Demo";
 const char *DEMO_RESUME_BTN_STRING = "Resume";
 
+// Blue Force general messages
+const char *BF_NAME = "Blue Force";
+const char *BF_COPYRIGHT = " Copyright, 1993 Tsunami Media, Inc.";
+const char *BF_ALL_RIGHTS_RESERVED = "All Rights Reserved";
+const char *BF_19840518 = "May 18, 1984";
+const char *BF_19840515 = "May 15, 1984";
+const char *BF_3_DAYS = "Three days later";
+const char *BF_11_YEARS = "Eleven years later.";
+const char *BF_NEXT_DAY = "The Next Day";
+const char *BF_ACADEMY = "Here we are at the Academy";
+
 } // End of namespace tSage
diff --git a/engines/tsage/staticres.h b/engines/tsage/staticres.h
index fa93511..bac8976 100644
--- a/engines/tsage/staticres.h
+++ b/engines/tsage/staticres.h
@@ -86,6 +86,18 @@ extern const char *EXIT_BTN_STRING;
 extern const char *DEMO_BTN_STRING;
 extern const char *DEMO_RESUME_BTN_STRING;
 
+// Blue Force messages
+extern const char *BF_NAME;
+extern const char *BF_COPYRIGHT;
+extern const char *BF_ALL_RIGHTS_RESERVED;
+extern const char *BF_19840518;
+extern const char *BF_19840515;
+extern const char *BF_3_DAYS;
+extern const char *BF_11_YEARS;
+extern const char *BF_NEXT_DAY;
+extern const char *BF_ACADEMY;
+
+
 } // End of namespace tSage
 
 #endif
diff --git a/engines/tsage/tsage.cpp b/engines/tsage/tsage.cpp
index 23a0193..3332841 100644
--- a/engines/tsage/tsage.cpp
+++ b/engines/tsage/tsage.cpp
@@ -68,18 +68,22 @@ void TSageEngine::initialize() {
 	if (_vm->getFeatures() & GF_DEMO) {
 		// Add the single library file associated with the demo
 		_resourceManager->addLib(getPrimaryFilename());
+		_globals = new Globals();
+
 	} else if (_vm->getGameID() == GType_Ringworld) {
 		_resourceManager->addLib("RING.RLB");
 		_resourceManager->addLib("TSAGE.RLB");
+		_globals = new Globals();
+
 	} else if (_vm->getGameID() == GType_BlueForce) {
 		_resourceManager->addLib("BLUE.RLB");
 		if (_vm->getFeatures() & GF_FLOPPY) {
 			_resourceManager->addLib("FILES.RLB");
 			_resourceManager->addLib("TSAGE.RLB");
 		}
+		_globals = new BlueForceGlobals();
 	}
 
-	_globals = new Globals();
 	_globals->gfxManager().setDefaults();
 
 	// Setup sound settings






More information about the Scummvm-git-logs mailing list