2011-02-14 09:37:27 +00:00
|
|
|
/* 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_SCENES_H
|
|
|
|
#define TSAGE_SCENES_H
|
|
|
|
|
|
|
|
#include "common/scummsys.h"
|
|
|
|
#include "tsage/converse.h"
|
|
|
|
#include "tsage/events.h"
|
|
|
|
#include "tsage/core.h"
|
|
|
|
#include "tsage/saveload.h"
|
|
|
|
|
2011-08-15 10:47:59 +00:00
|
|
|
namespace TsAGE {
|
2011-02-14 09:37:27 +00:00
|
|
|
|
2011-04-13 19:27:46 +00:00
|
|
|
class Scene : public StripCallback {
|
2011-02-14 09:37:27 +00:00
|
|
|
private:
|
2011-09-24 07:52:03 +00:00
|
|
|
void drawBackgroundObjects();
|
2011-02-14 09:37:27 +00:00
|
|
|
public:
|
|
|
|
int _field12;
|
2011-04-19 11:07:37 +00:00
|
|
|
int _screenNumber;
|
2011-02-14 09:37:27 +00:00
|
|
|
int _activeScreenNumber;
|
|
|
|
int _sceneMode;
|
|
|
|
StripManager _stripManager;
|
|
|
|
|
|
|
|
Rect _backgroundBounds;
|
|
|
|
GfxSurface _backSurface;
|
|
|
|
Rect _sceneBounds;
|
|
|
|
Rect _oldSceneBounds;
|
|
|
|
int _enabledSections[256];
|
|
|
|
int _zoomPercents[256];
|
|
|
|
ScenePriorities _priorities;
|
2011-09-24 23:59:24 +00:00
|
|
|
SceneObjectList _bgSceneObjects;
|
2011-04-03 07:25:07 +00:00
|
|
|
|
|
|
|
int _fieldA;
|
|
|
|
int _fieldE;
|
2011-02-14 09:37:27 +00:00
|
|
|
public:
|
|
|
|
Scene();
|
|
|
|
virtual ~Scene();
|
|
|
|
|
|
|
|
virtual Common::String getClassName() { return "Scene"; }
|
2011-05-04 08:41:47 +00:00
|
|
|
virtual void synchronize(Serializer &s);
|
2011-02-14 09:37:27 +00:00
|
|
|
virtual void stripCallback(int v) {}
|
|
|
|
virtual void postInit(SceneObjectList *OwnerList = NULL);
|
|
|
|
virtual void process(Event &event);
|
|
|
|
virtual void dispatch();
|
|
|
|
virtual void loadScene(int sceneNum);
|
2011-10-22 09:44:26 +00:00
|
|
|
virtual void refreshBackground(int xAmount, int yAmount);
|
2011-02-14 09:37:27 +00:00
|
|
|
|
|
|
|
void setZoomPercents(int yStart, int minPercent, int yEnd, int maxPercent);
|
|
|
|
void loadBackground(int xAmount, int yAmount);
|
2012-09-26 02:17:31 +00:00
|
|
|
|
2011-02-14 09:37:27 +00:00
|
|
|
void loadSceneData(int sceneNum);
|
|
|
|
};
|
|
|
|
|
2011-04-13 19:27:46 +00:00
|
|
|
class SceneManager : public GameHandler, public SaveListener {
|
2011-02-14 09:37:27 +00:00
|
|
|
private:
|
2011-09-26 22:40:10 +00:00
|
|
|
void disposeRegions() {
|
|
|
|
// No need to do anything, since regions will be freed automatically when the scene is
|
2011-06-22 09:13:36 +00:00
|
|
|
}
|
2011-02-14 09:37:27 +00:00
|
|
|
Scene *getNewScene();
|
|
|
|
public:
|
|
|
|
Scene *_scene;
|
|
|
|
bool _hasPalette;
|
2011-02-27 05:28:37 +00:00
|
|
|
int _loadMode;
|
2011-02-14 09:37:27 +00:00
|
|
|
int _sceneNumber;
|
|
|
|
int _previousScene;
|
|
|
|
int _nextSceneNumber;
|
2011-02-27 11:52:35 +00:00
|
|
|
FadeMode _fadeMode;
|
2011-02-14 09:37:27 +00:00
|
|
|
Common::Point _sceneBgOffset;
|
|
|
|
int _sceneLoadCount;
|
|
|
|
Rect _scrollerRect;
|
2011-04-19 11:02:27 +00:00
|
|
|
int _objectCount;
|
2011-02-14 09:37:27 +00:00
|
|
|
public:
|
|
|
|
SceneManager();
|
|
|
|
virtual ~SceneManager();
|
|
|
|
|
2011-05-04 08:47:12 +00:00
|
|
|
virtual void listenerSynchronize(Serializer &s);
|
2011-02-14 09:37:27 +00:00
|
|
|
void setNewScene(int sceneNumber);
|
|
|
|
void checkScene();
|
|
|
|
void sceneChange();
|
|
|
|
void fadeInIfNecessary();
|
|
|
|
void changeScene(int newSceneNumber);
|
|
|
|
void setBgOffset(const Common::Point &pt, int loadCount);
|
|
|
|
|
2011-04-13 19:27:46 +00:00
|
|
|
void removeAction(Action *action) {
|
2011-02-14 09:37:27 +00:00
|
|
|
// Not currently implemented because addAction method doesn't seem to have any callers
|
|
|
|
}
|
|
|
|
|
|
|
|
static void setup();
|
|
|
|
static void setBackSurface();
|
|
|
|
static void saveListener(int saveMode);
|
|
|
|
static void loadNotifier(bool postFlag);
|
|
|
|
};
|
|
|
|
|
2011-05-14 08:20:56 +00:00
|
|
|
class Game {
|
|
|
|
protected:
|
|
|
|
SynchronizedList<GameHandler *> _handlers;
|
|
|
|
|
|
|
|
static bool notLockedFn(GameHandler *g);
|
2011-09-10 01:22:39 +00:00
|
|
|
virtual void handleSaveLoad(bool saveFlag, int &saveSlot, Common::String &saveName);
|
2011-05-14 08:20:56 +00:00
|
|
|
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() {}
|
2011-09-10 01:22:39 +00:00
|
|
|
virtual void restartGame();
|
|
|
|
virtual void saveGame();
|
|
|
|
virtual void restoreGame();
|
|
|
|
virtual void quitGame();
|
2011-05-14 08:20:56 +00:00
|
|
|
virtual void endGame(int resNum, int lineNum) {}
|
|
|
|
virtual Scene *createScene(int sceneNumber) = 0;
|
2011-05-16 11:09:05 +00:00
|
|
|
virtual void processEvent(Event &event) {}
|
2011-08-29 12:01:11 +00:00
|
|
|
virtual void rightClick() {}
|
2011-10-14 09:49:06 +00:00
|
|
|
virtual bool canSaveGameStateCurrently() = 0;
|
|
|
|
virtual bool canLoadGameStateCurrently() = 0;
|
2011-05-14 08:20:56 +00:00
|
|
|
};
|
|
|
|
|
2011-08-15 10:47:59 +00:00
|
|
|
} // End of namespace TsAGE
|
2011-02-14 09:37:27 +00:00
|
|
|
|
|
|
|
#endif
|