2016-02-06 01:39:42 +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 TITANIC_TITANIC_H
|
|
|
|
#define TITANIC_TITANIC_H
|
|
|
|
|
2017-08-24 11:05:49 +00:00
|
|
|
#include "common/random.h" // getRandomNumber and getRandomFloat
|
|
|
|
#include "engines/engine.h" // class Engine
|
|
|
|
#include "titanic/support/exe_resources.h" // class CExeResources
|
|
|
|
#include "titanic/support/movie_manager.h" // class CMovieManager
|
|
|
|
#include "titanic/support/string.h" // class StringArray;
|
|
|
|
#include "titanic/support/strings.h" // class Strings;
|
|
|
|
#include "common/language.h" // Language enum
|
2016-02-06 01:39:42 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* This is the namespace of the Titanic engine.
|
|
|
|
*
|
|
|
|
* Status of this engine: In Development
|
|
|
|
*
|
|
|
|
* Games using this engine:
|
|
|
|
* - Starship Titanic
|
|
|
|
*/
|
|
|
|
|
2017-08-24 11:05:49 +00:00
|
|
|
class OSystem;
|
|
|
|
|
|
|
|
namespace Graphics {
|
|
|
|
class Screen;
|
|
|
|
}
|
|
|
|
|
|
|
|
namespace Common {
|
|
|
|
class Error;
|
|
|
|
class FSNode;
|
|
|
|
}
|
|
|
|
|
|
|
|
namespace Titanic {
|
2016-02-06 01:39:42 +00:00
|
|
|
|
|
|
|
#define TITANIC_SAVEGAME_VERSION 1
|
|
|
|
|
2016-03-13 19:30:12 +00:00
|
|
|
#define SCREEN_WIDTH 640
|
|
|
|
#define SCREEN_HEIGHT 480
|
|
|
|
|
2016-04-02 01:58:39 +00:00
|
|
|
#define TOTAL_ITEMS 46
|
2016-05-01 23:09:21 +00:00
|
|
|
#define TOTAL_ROOMS 34
|
2016-04-02 01:58:39 +00:00
|
|
|
|
2016-07-22 23:20:05 +00:00
|
|
|
#define MAX_SAVES 99
|
|
|
|
|
2017-08-24 02:43:10 +00:00
|
|
|
// If enabled, fixes an original bug where dispensed chickens weren't
|
|
|
|
// meant to be hot unless the Yellow fuse was left in the Fusebox.
|
|
|
|
// This is being left disabled for now, since most walkthroughs for
|
|
|
|
// the game redundantly suggest removing the fuse, which is wrong
|
|
|
|
//#define FIX_DISPENSOR_TEMPATURE
|
|
|
|
|
2017-08-24 11:05:49 +00:00
|
|
|
class CFilesManager;
|
|
|
|
class CMainGameWindow;
|
|
|
|
class CString;
|
|
|
|
class CTrueTalkManager;
|
|
|
|
class Debugger;
|
|
|
|
class Events;
|
|
|
|
class OSScreenManager;
|
|
|
|
class CScriptHandler;
|
|
|
|
class TTscriptBase;
|
2016-02-06 01:39:42 +00:00
|
|
|
struct TitanicGameDescription;
|
|
|
|
|
|
|
|
class TitanicEngine : public Engine {
|
|
|
|
private:
|
|
|
|
/**
|
|
|
|
* Handles basic initialization
|
|
|
|
*/
|
2017-06-20 23:52:11 +00:00
|
|
|
bool initialize();
|
2016-02-28 17:46:48 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Handles game deinitialization
|
|
|
|
*/
|
|
|
|
void deinitialize();
|
2016-04-02 00:37:44 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Sets up the item names, short, and long descriptions
|
|
|
|
*/
|
|
|
|
void setItemNames();
|
2016-05-01 23:09:21 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Sets up the list of room names
|
|
|
|
*/
|
|
|
|
void setRoomNames();
|
2016-02-06 01:39:42 +00:00
|
|
|
protected:
|
|
|
|
const TitanicGameDescription *_gameDescription;
|
|
|
|
|
|
|
|
// Engine APIs
|
2016-03-16 03:49:18 +00:00
|
|
|
virtual void initializePath(const Common::FSNode &gamePath);
|
2016-02-06 01:39:42 +00:00
|
|
|
virtual Common::Error run();
|
|
|
|
virtual bool hasFeature(EngineFeature f) const;
|
2016-02-06 03:11:02 +00:00
|
|
|
public:
|
2016-03-18 02:29:16 +00:00
|
|
|
Debugger *_debugger;
|
2016-03-19 00:04:54 +00:00
|
|
|
Events *_events;
|
2016-05-10 01:03:21 +00:00
|
|
|
CFilesManager *_filesManager;
|
2016-07-03 21:43:37 +00:00
|
|
|
CMovieManager _movieManager;
|
2016-03-22 01:51:29 +00:00
|
|
|
Graphics::Screen *_screen;
|
2016-02-06 03:11:02 +00:00
|
|
|
OSScreenManager *_screenManager;
|
|
|
|
CMainGameWindow *_window;
|
2016-03-17 23:58:59 +00:00
|
|
|
Common::RandomSource _randomSource;
|
2016-05-08 18:37:18 +00:00
|
|
|
CScriptHandler *_scriptHandler;
|
2016-05-14 04:12:47 +00:00
|
|
|
TTscriptBase *_script;
|
2016-05-30 14:18:50 +00:00
|
|
|
CTrueTalkManager *_trueTalkManager;
|
2016-05-12 01:17:28 +00:00
|
|
|
CExeResources _exeResources;
|
2016-05-16 11:40:10 +00:00
|
|
|
StringArray _itemNames;
|
|
|
|
StringArray _itemDescriptions;
|
|
|
|
StringArray _itemIds;
|
|
|
|
StringArray _roomNames;
|
2016-11-11 20:24:53 +00:00
|
|
|
Strings _strings;
|
2016-12-17 02:27:43 +00:00
|
|
|
CString _stateRoomExitView;
|
2017-09-06 03:01:12 +00:00
|
|
|
int _loadSaveSlot;
|
2016-02-06 01:39:42 +00:00
|
|
|
public:
|
|
|
|
TitanicEngine(OSystem *syst, const TitanicGameDescription *gameDesc);
|
|
|
|
virtual ~TitanicEngine();
|
|
|
|
|
2016-06-26 03:07:44 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Returns true if a savegame can be loaded
|
|
|
|
*/
|
|
|
|
virtual bool canLoadGameStateCurrently();
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Returns true if the game can be saved
|
|
|
|
*/
|
|
|
|
virtual bool canSaveGameStateCurrently();
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Called by the GMM to load a savegame
|
|
|
|
*/
|
|
|
|
virtual Common::Error loadGameState(int slot);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Called by the GMM to save the game
|
|
|
|
*/
|
|
|
|
virtual Common::Error saveGameState(int slot, const Common::String &desc);
|
|
|
|
|
2017-09-06 01:11:06 +00:00
|
|
|
/**
|
|
|
|
* Handles updates to the sound levels
|
|
|
|
*/
|
|
|
|
virtual void syncSoundSettings();
|
|
|
|
|
2017-06-17 17:15:23 +00:00
|
|
|
/**
|
|
|
|
* Gets the game features
|
|
|
|
*/
|
2016-02-06 01:39:42 +00:00
|
|
|
uint32 getFeatures() const;
|
2017-06-17 17:15:23 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Returns the language for the game
|
|
|
|
*/
|
2016-02-06 01:39:42 +00:00
|
|
|
Common::Language getLanguage() const;
|
2016-04-10 14:20:06 +00:00
|
|
|
|
2016-09-11 20:53:44 +00:00
|
|
|
/**
|
|
|
|
* Returns true if it's the German version
|
|
|
|
*/
|
|
|
|
bool isGerman() const { return getLanguage() == Common::DE_DEU; }
|
|
|
|
|
2016-04-10 14:20:06 +00:00
|
|
|
/**
|
2017-08-24 11:05:49 +00:00
|
|
|
* Returns a uniform random unsigned integer in the interval [0, max]
|
2016-04-10 14:20:06 +00:00
|
|
|
*/
|
|
|
|
uint getRandomNumber(uint max) { return _randomSource.getRandomNumber(max); }
|
2016-06-26 03:07:44 +00:00
|
|
|
|
2017-03-03 02:07:28 +00:00
|
|
|
/**
|
2017-08-24 11:05:49 +00:00
|
|
|
* Returns a uniform random floating point number in the interval [0.0, 65535.0]
|
2017-03-03 02:07:28 +00:00
|
|
|
*/
|
2017-08-24 11:06:12 +00:00
|
|
|
double getRandomFloat() { return getRandomNumber(0xfffffffe) * 0.00001525855623540901; } // fffffffe=4294967294 and 0.00001525855623540901 ~= 1/65537.0
|
2017-03-03 02:07:28 +00:00
|
|
|
|
2016-06-26 03:07:44 +00:00
|
|
|
/**
|
|
|
|
* Support method that generates a savegame name
|
|
|
|
* @param slot Slot number
|
|
|
|
*/
|
|
|
|
CString generateSaveName(int slot);
|
2016-07-22 23:20:05 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Checks whether a savegame exists for the given slot,
|
|
|
|
* and if it exists, returns it's description
|
|
|
|
*/
|
|
|
|
CString getSavegameName(int slot);
|
2017-06-20 23:52:11 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Displays an error message in a GUI dialog
|
|
|
|
*/
|
|
|
|
void GUIError(const char *msg, ...) GCC_PRINTF(2, 3);
|
2017-08-19 01:53:57 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Shows the ScummVM GMM save dialog
|
|
|
|
*/
|
|
|
|
void showScummVMSaveDialog();
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Shows the ScummVM GMM load dialog
|
|
|
|
*/
|
|
|
|
void showScummVMRestoreDialog();
|
2016-02-06 01:39:42 +00:00
|
|
|
};
|
|
|
|
|
2016-03-15 03:09:57 +00:00
|
|
|
extern TitanicEngine *g_vm;
|
|
|
|
|
2016-02-06 01:39:42 +00:00
|
|
|
} // End of namespace Titanic
|
|
|
|
|
|
|
|
#endif /* TITANIC_TITANIC_H */
|