[Scummvm-cvs-logs] scummvm master -> 1568f1956908b3d4375f735129d5c2bf3f3f5b5c
dreammaster
dreammaster at scummvm.org
Sat May 14 10:23:05 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:
621a6e5229 TSAGE: Added skeleton game class for Blue Force
1568f19569 TSAGE: Moved scene creation into the Game class, and separated out the Ringworld demo scene creation to it's own game cl
Commit: 621a6e522948b35b7967c0f573c6008fc0fca078
https://github.com/scummvm/scummvm/commit/621a6e522948b35b7967c0f573c6008fc0fca078
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2011-05-14T01:19:35-07:00
Commit Message:
TSAGE: Added skeleton game class for Blue Force
Changed paths:
A engines/tsage/blueforce_logic.cpp
A engines/tsage/blueforce_logic.h
engines/tsage/globals.cpp
diff --git a/engines/tsage/blueforce_logic.cpp b/engines/tsage/blueforce_logic.cpp
new file mode 100644
index 0000000..27e8da2
--- /dev/null
+++ b/engines/tsage/blueforce_logic.cpp
@@ -0,0 +1,41 @@
+/* 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/blueforce_logic.h"
+#include "tsage/scenes.h"
+#include "tsage/tsage.h"
+#include "tsage/staticres.h"
+
+namespace tSage {
+
+void BlueForceGame::start() {
+ // Start the game
+ _globals->_sceneManager.changeScene(1);
+
+ _globals->_events.setCursor(CURSOR_WALK);
+}
+
+Scene *BlueForceGame::createScene(int sceneNumber) {
+ error("TODO: Implement BlueForceGame::createScene");
+}
+
+} // End of namespace tSage
diff --git a/engines/tsage/blueforce_logic.h b/engines/tsage/blueforce_logic.h
new file mode 100644
index 0000000..9237e50
--- /dev/null
+++ b/engines/tsage/blueforce_logic.h
@@ -0,0 +1,42 @@
+/* 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_LOGIC_H
+#define TSAGE_BLUEFORCE_LOGIC_H
+
+#include "common/scummsys.h"
+#include "tsage/events.h"
+#include "tsage/core.h"
+#include "tsage/scenes.h"
+#include "tsage/globals.h"
+
+namespace tSage {
+
+class BlueForceGame: public Game {
+public:
+ virtual void start();
+ virtual Scene *createScene(int sceneNumber);
+};
+
+} // End of namespace tSage
+
+#endif
diff --git a/engines/tsage/globals.cpp b/engines/tsage/globals.cpp
index bff1bde..e51e9d2 100644
--- a/engines/tsage/globals.cpp
+++ b/engines/tsage/globals.cpp
@@ -22,6 +22,7 @@
#include "tsage/globals.h"
#include "tsage/tsage.h"
+#include "tsage/blueforce_logic.h"
#include "tsage/ringworld_demo.h"
#include "tsage/ringworld_logic.h"
@@ -82,11 +83,19 @@ Globals::Globals() :
_scrollFollower = NULL;
_inventory = NULL;
- if (!(_vm->getFeatures() & GF_DEMO)) {
- _inventory = new RingworldInvObjectList();
- _game = new RingworldGame();
- } else {
- _game = new RingworldDemoGame();
+ switch (_vm->getGameID()) {
+ case GType_Ringworld:
+ if (!(_vm->getFeatures() & GF_DEMO)) {
+ _inventory = new RingworldInvObjectList();
+ _game = new RingworldGame();
+ } else {
+ _game = new RingworldDemoGame();
+ }
+ break;
+
+ case GType_BlueForce:
+ _game = new BlueForceGame();
+ break;
}
}
Commit: 1568f1956908b3d4375f735129d5c2bf3f3f5b5c
https://github.com/scummvm/scummvm/commit/1568f1956908b3d4375f735129d5c2bf3f3f5b5c
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2011-05-14T01:20:56-07:00
Commit Message:
TSAGE: Moved scene creation into the Game class, and separated out the Ringworld demo scene creation to it's own game class
Changed paths:
engines/tsage/core.cpp
engines/tsage/core.h
engines/tsage/module.mk
engines/tsage/ringworld_demo.cpp
engines/tsage/ringworld_demo.h
engines/tsage/ringworld_logic.cpp
engines/tsage/ringworld_logic.h
engines/tsage/scenes.cpp
engines/tsage/scenes.h
diff --git a/engines/tsage/core.cpp b/engines/tsage/core.cpp
index 9176251..2f05365 100644
--- a/engines/tsage/core.cpp
+++ b/engines/tsage/core.cpp
@@ -3647,22 +3647,4 @@ void SceneHandler::saveListener(Serializer &ser) {
warning("TODO: SceneHandler::saveListener");
}
-/*--------------------------------------------------------------------------*/
-
-void Game::execute() {
- // Main game loop
- bool activeFlag = false;
- do {
- // Process all currently atcive game handlers
- activeFlag = false;
- for (SynchronizedList<GameHandler *>::iterator i = _handlers.begin(); i != _handlers.end(); ++i) {
- GameHandler *gh = *i;
- if (gh->_lockCtr.getCtr() == 0) {
- gh->execute();
- activeFlag = true;
- }
- }
- } while (activeFlag && !_vm->getEventManager()->shouldQuit());
-}
-
} // End of namespace tSage
diff --git a/engines/tsage/core.h b/engines/tsage/core.h
index f984a72..71130e5 100644
--- a/engines/tsage/core.h
+++ b/engines/tsage/core.h
@@ -909,30 +909,6 @@ public:
static void saveListener(Serializer &ser);
};
-/*--------------------------------------------------------------------------*/
-
-class Game {
-protected:
- SynchronizedList<GameHandler *> _handlers;
-
- static bool notLockedFn(GameHandler *g);
- virtual void handleSaveLoad(bool saveFlag, int &saveSlot, Common::String &saveName) {}
-public:
- virtual ~Game() {}
-
- void addHandler(GameHandler *entry) { _handlers.push_back(entry); }
- void removeHandler(GameHandler *entry) { _handlers.remove(entry); }
-
- void execute();
- virtual void start() = 0;
- virtual void restart() {}
- virtual void restartGame() {}
- virtual void saveGame() {}
- virtual void restoreGame() {}
- virtual void quitGame() {}
- virtual void endGame(int resNum, int lineNum) {}
-};
-
} // End of namespace tSage
#endif
diff --git a/engines/tsage/module.mk b/engines/tsage/module.mk
index 2f9194a..aefc8b0 100644
--- a/engines/tsage/module.mk
+++ b/engines/tsage/module.mk
@@ -1,6 +1,7 @@
MODULE := engines/tsage
MODULE_OBJS := \
+ blueforce_logic.o \
converse.o \
core.o \
debugger.o \
diff --git a/engines/tsage/ringworld_demo.cpp b/engines/tsage/ringworld_demo.cpp
index f6e915b..2dacea6 100644
--- a/engines/tsage/ringworld_demo.cpp
+++ b/engines/tsage/ringworld_demo.cpp
@@ -34,7 +34,9 @@ void RingworldDemoGame::start() {
_globals->_events.setCursor(CURSOR_NONE);
}
-void RingworldDemoGame::restart() {
+Scene *RingworldDemoGame::createScene(int sceneNumber) {
+ // The demo only has a single scene, so ignore the scene number and always return it
+ return new RingworldDemoScene();
}
/*--------------------------------------------------------------------------
diff --git a/engines/tsage/ringworld_demo.h b/engines/tsage/ringworld_demo.h
index d72db9c..8b69da8 100644
--- a/engines/tsage/ringworld_demo.h
+++ b/engines/tsage/ringworld_demo.h
@@ -32,15 +32,9 @@
namespace tSage {
class RingworldDemoGame: public Game {
-protected:
- virtual void restart();
public:
virtual void start();
- virtual void restartGame() {}
- virtual void saveGame() {}
- virtual void restoreGame() {}
- virtual void quitGame() {}
- virtual void endGame(int resNum, int lineNum) {}
+ virtual Scene *createScene(int sceneNumber);
};
class RingworldDemoScene: public Scene {
diff --git a/engines/tsage/ringworld_logic.cpp b/engines/tsage/ringworld_logic.cpp
index 9eba3bf..82331ba 100644
--- a/engines/tsage/ringworld_logic.cpp
+++ b/engines/tsage/ringworld_logic.cpp
@@ -39,10 +39,7 @@
namespace tSage {
-Scene *SceneFactory::createScene(int sceneNumber) {
- if (_vm->getFeatures() & GF_DEMO)
- return new RingworldDemoScene();
-
+Scene *RingworldGame::createScene(int sceneNumber) {
switch (sceneNumber) {
/* Scene group 1 */
// Kziniti Palace (Introduction)
diff --git a/engines/tsage/ringworld_logic.h b/engines/tsage/ringworld_logic.h
index e3671e7..6fa92fa 100644
--- a/engines/tsage/ringworld_logic.h
+++ b/engines/tsage/ringworld_logic.h
@@ -451,6 +451,8 @@ public:
virtual void restoreGame();
virtual void quitGame();
virtual void endGame(int resNum, int lineNum);
+
+ virtual Scene *createScene(int sceneNumber);
};
} // End of namespace tSage
diff --git a/engines/tsage/scenes.cpp b/engines/tsage/scenes.cpp
index 8ff0636..3741bda 100644
--- a/engines/tsage/scenes.cpp
+++ b/engines/tsage/scenes.cpp
@@ -127,7 +127,7 @@ void SceneManager::sceneChange() {
}
Scene *SceneManager::getNewScene() {
- return SceneFactory::createScene(_nextSceneNumber);
+ return _globals->_game->createScene(_nextSceneNumber);
}
void SceneManager::fadeInIfNecessary() {
@@ -490,4 +490,22 @@ void Scene::setZoomPercents(int yStart, int minPercent, int yEnd, int maxPercent
_zoomPercents[yEnd++] = minPercent;
}
+/*--------------------------------------------------------------------------*/
+
+void Game::execute() {
+ // Main game loop
+ bool activeFlag = false;
+ do {
+ // Process all currently atcive game handlers
+ activeFlag = false;
+ for (SynchronizedList<GameHandler *>::iterator i = _handlers.begin(); i != _handlers.end(); ++i) {
+ GameHandler *gh = *i;
+ if (gh->_lockCtr.getCtr() == 0) {
+ gh->execute();
+ activeFlag = true;
+ }
+ }
+ } while (activeFlag && !_vm->getEventManager()->shouldQuit());
+}
+
} // End of namespace tSage
diff --git a/engines/tsage/scenes.h b/engines/tsage/scenes.h
index 7ef74b4..a5aacba 100644
--- a/engines/tsage/scenes.h
+++ b/engines/tsage/scenes.h
@@ -108,6 +108,29 @@ public:
static void loadNotifier(bool postFlag);
};
+class Game {
+protected:
+ SynchronizedList<GameHandler *> _handlers;
+
+ static bool notLockedFn(GameHandler *g);
+ virtual void handleSaveLoad(bool saveFlag, int &saveSlot, Common::String &saveName) {}
+public:
+ virtual ~Game() {}
+
+ void addHandler(GameHandler *entry) { _handlers.push_back(entry); }
+ void removeHandler(GameHandler *entry) { _handlers.remove(entry); }
+
+ void execute();
+ virtual void start() = 0;
+ virtual void restart() {}
+ virtual void restartGame() {}
+ virtual void saveGame() {}
+ virtual void restoreGame() {}
+ virtual void quitGame() {}
+ virtual void endGame(int resNum, int lineNum) {}
+ virtual Scene *createScene(int sceneNumber) = 0;
+};
+
} // End of namespace tSage
#endif
More information about the Scummvm-git-logs
mailing list