2016-02-05 20:39:42 -05: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 04:05:49 -07: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-05 20:39:42 -05:00
|
|
|
|
|
|
|
/**
|
|
|
|
* This is the namespace of the Titanic engine.
|
|
|
|
*
|
|
|
|
* Status of this engine: In Development
|
|
|
|
*
|
|
|
|
* Games using this engine:
|
|
|
|
* - Starship Titanic
|
|
|
|
*/
|
|
|
|
|
2017-08-24 04:05:49 -07:00
|
|
|
class OSystem;
|
|
|
|
|
|
|
|
namespace Graphics {
|
|
|
|
class Screen;
|
|
|
|
}
|
|
|
|
|
|
|
|
namespace Common {
|
|
|
|
class Error;
|
|
|
|
class FSNode;
|
|
|
|
}
|
|
|
|
|
|
|
|
namespace Titanic {
|
2016-02-05 20:39:42 -05:00
|
|
|
|
|
|
|
#define TITANIC_SAVEGAME_VERSION 1
|
|
|
|
|
2016-03-13 15:30:12 -04:00
|
|
|
#define SCREEN_WIDTH 640
|
|
|
|
#define SCREEN_HEIGHT 480
|
|
|
|
|
2016-04-01 21:58:39 -04:00
|
|
|
#define TOTAL_ITEMS 46
|
2016-05-01 19:09:21 -04:00
|
|
|
#define TOTAL_ROOMS 34
|
2016-04-01 21:58:39 -04:00
|
|
|
|
2016-07-22 19:20:05 -04:00
|
|
|
#define MAX_SAVES 99
|
|
|
|
|
2017-06-25 13:24:10 -04:00
|
|
|
#define SOUND(enName, deName) (g_vm->isGerman() ? deName : enName)
|
|
|
|
|
2017-08-23 22:43:10 -04: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 04:05:49 -07:00
|
|
|
class CFilesManager;
|
|
|
|
class CMainGameWindow;
|
|
|
|
class CString;
|
|
|
|
class CTrueTalkManager;
|
|
|
|
class Debugger;
|
|
|
|
class Events;
|
|
|
|
class OSScreenManager;
|
|
|
|
class CScriptHandler;
|
|
|
|
class TTscriptBase;
|
2016-02-05 20:39:42 -05:00
|
|
|
struct TitanicGameDescription;
|
|
|
|
|
|
|
|
class TitanicEngine : public Engine {
|
|
|
|
private:
|
|
|
|
/**
|
|
|
|
* Handles basic initialization
|
|
|
|
*/
|
2017-06-20 19:52:11 -04:00
|
|
|
bool initialize();
|
2016-02-28 12:46:48 -05:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Handles game deinitialization
|
|
|
|
*/
|
|
|
|
void deinitialize();
|
2016-04-01 20:37:44 -04:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Sets up the item names, short, and long descriptions
|
|
|
|
*/
|
|
|
|
void setItemNames();
|
2016-05-01 19:09:21 -04:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Sets up the list of room names
|
|
|
|
*/
|
|
|
|
void setRoomNames();
|
2016-02-05 20:39:42 -05:00
|
|
|
protected:
|
|
|
|
const TitanicGameDescription *_gameDescription;
|
|
|
|
int _loadSaveSlot;
|
|
|
|
|
|
|
|
// Engine APIs
|
2016-03-15 23:49:18 -04:00
|
|
|
virtual void initializePath(const Common::FSNode &gamePath);
|
2016-02-05 20:39:42 -05:00
|
|
|
virtual Common::Error run();
|
|
|
|
virtual bool hasFeature(EngineFeature f) const;
|
2016-02-05 22:11:02 -05:00
|
|
|
public:
|
2016-03-17 22:29:16 -04:00
|
|
|
Debugger *_debugger;
|
2016-03-18 20:04:54 -04:00
|
|
|
Events *_events;
|
2016-05-09 21:03:21 -04:00
|
|
|
CFilesManager *_filesManager;
|
2016-07-03 17:43:37 -04:00
|
|
|
CMovieManager _movieManager;
|
2016-03-21 21:51:29 -04:00
|
|
|
Graphics::Screen *_screen;
|
2016-02-05 22:11:02 -05:00
|
|
|
OSScreenManager *_screenManager;
|
|
|
|
CMainGameWindow *_window;
|
2016-03-17 19:58:59 -04:00
|
|
|
Common::RandomSource _randomSource;
|
2016-05-08 14:37:18 -04:00
|
|
|
CScriptHandler *_scriptHandler;
|
2016-05-14 00:12:47 -04:00
|
|
|
TTscriptBase *_script;
|
2016-05-30 10:18:50 -04:00
|
|
|
CTrueTalkManager *_trueTalkManager;
|
2016-05-11 21:17:28 -04:00
|
|
|
CExeResources _exeResources;
|
2016-05-16 07:40:10 -04:00
|
|
|
StringArray _itemNames;
|
|
|
|
StringArray _itemDescriptions;
|
|
|
|
StringArray _itemIds;
|
|
|
|
StringArray _roomNames;
|
2016-11-11 15:24:53 -05:00
|
|
|
Strings _strings;
|
2016-12-16 21:27:43 -05:00
|
|
|
CString _stateRoomExitView;
|
2016-02-05 20:39:42 -05:00
|
|
|
public:
|
|
|
|
TitanicEngine(OSystem *syst, const TitanicGameDescription *gameDesc);
|
|
|
|
virtual ~TitanicEngine();
|
|
|
|
|
2016-06-25 23:07:44 -04: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-06-17 13:15:23 -04:00
|
|
|
/**
|
|
|
|
* Gets the game features
|
|
|
|
*/
|
2016-02-05 20:39:42 -05:00
|
|
|
uint32 getFeatures() const;
|
2017-06-17 13:15:23 -04:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Returns the language for the game
|
|
|
|
*/
|
2016-02-05 20:39:42 -05:00
|
|
|
Common::Language getLanguage() const;
|
2016-04-10 10:20:06 -04:00
|
|
|
|
2016-09-11 16:53:44 -04:00
|
|
|
/**
|
|
|
|
* Returns true if it's the German version
|
|
|
|
*/
|
|
|
|
bool isGerman() const { return getLanguage() == Common::DE_DEU; }
|
|
|
|
|
2016-04-10 10:20:06 -04:00
|
|
|
/**
|
2017-08-24 04:05:49 -07:00
|
|
|
* Returns a uniform random unsigned integer in the interval [0, max]
|
2016-04-10 10:20:06 -04:00
|
|
|
*/
|
|
|
|
uint getRandomNumber(uint max) { return _randomSource.getRandomNumber(max); }
|
2016-06-25 23:07:44 -04:00
|
|
|
|
2017-03-02 21:07:28 -05:00
|
|
|
/**
|
2017-08-24 04:05:49 -07:00
|
|
|
* Returns a uniform random floating point number in the interval [0.0, 65535.0]
|
2017-03-02 21:07:28 -05:00
|
|
|
*/
|
2017-08-24 04:06:12 -07:00
|
|
|
double getRandomFloat() { return getRandomNumber(0xfffffffe) * 0.00001525855623540901; } // fffffffe=4294967294 and 0.00001525855623540901 ~= 1/65537.0
|
2017-03-02 21:07:28 -05:00
|
|
|
|
2016-06-25 23:07:44 -04:00
|
|
|
/**
|
|
|
|
* Support method that generates a savegame name
|
|
|
|
* @param slot Slot number
|
|
|
|
*/
|
|
|
|
CString generateSaveName(int slot);
|
2016-07-22 19:20:05 -04: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 19:52:11 -04:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Displays an error message in a GUI dialog
|
|
|
|
*/
|
|
|
|
void GUIError(const char *msg, ...) GCC_PRINTF(2, 3);
|
2017-08-18 21:53:57 -04:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Shows the ScummVM GMM save dialog
|
|
|
|
*/
|
|
|
|
void showScummVMSaveDialog();
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Shows the ScummVM GMM load dialog
|
|
|
|
*/
|
|
|
|
void showScummVMRestoreDialog();
|
2016-02-05 20:39:42 -05:00
|
|
|
};
|
|
|
|
|
2016-03-14 23:09:57 -04:00
|
|
|
extern TitanicEngine *g_vm;
|
|
|
|
|
2016-02-05 20:39:42 -05:00
|
|
|
} // End of namespace Titanic
|
|
|
|
|
|
|
|
#endif /* TITANIC_TITANIC_H */
|