2002-08-14 10:18:03 +00:00
|
|
|
/* ScummVM - Scumm Interpreter
|
2006-01-18 17:39:49 +00:00
|
|
|
* Copyright (C) 2002-2006 The ScummVM project
|
2002-08-14 10:18:03 +00:00
|
|
|
*
|
|
|
|
* 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
|
2005-10-18 01:30:26 +00:00
|
|
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
2002-08-14 10:18:03 +00:00
|
|
|
*
|
2006-02-11 09:53:21 +00:00
|
|
|
* $URL$
|
|
|
|
* $Id$
|
2002-08-14 10:18:03 +00:00
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef ENGINE_H
|
|
|
|
#define ENGINE_H
|
2005-06-24 15:23:51 +00:00
|
|
|
#include "common/stdafx.h"
|
2003-08-01 12:21:04 +00:00
|
|
|
#include "common/scummsys.h"
|
2003-10-10 13:55:08 +00:00
|
|
|
#include "common/str.h"
|
2002-08-18 17:48:18 +00:00
|
|
|
|
2004-12-27 22:08:20 +00:00
|
|
|
class OSystem;
|
2005-05-10 23:48:48 +00:00
|
|
|
namespace Audio {
|
|
|
|
class Mixer;
|
|
|
|
}
|
2005-05-10 23:17:38 +00:00
|
|
|
namespace Common {
|
|
|
|
class SaveFileManager;
|
|
|
|
class Timer;
|
|
|
|
}
|
2002-08-18 17:48:18 +00:00
|
|
|
|
2002-08-14 10:18:03 +00:00
|
|
|
class Engine {
|
|
|
|
public:
|
|
|
|
OSystem *_system;
|
2005-05-10 23:48:48 +00:00
|
|
|
Audio::Mixer *_mixer;
|
2005-05-10 23:17:38 +00:00
|
|
|
Common::Timer * _timer;
|
2002-08-14 10:18:03 +00:00
|
|
|
|
2002-08-18 22:47:11 +00:00
|
|
|
protected:
|
2006-04-15 20:36:41 +00:00
|
|
|
const Common::String _targetName; // target name for saves
|
2003-10-10 13:55:08 +00:00
|
|
|
const Common::String _gameDataPath;
|
2005-05-10 23:17:38 +00:00
|
|
|
Common::SaveFileManager *_saveFileMan;
|
2002-08-18 22:47:11 +00:00
|
|
|
|
2005-11-23 19:11:33 +00:00
|
|
|
private:
|
|
|
|
int _autosavePeriod;
|
|
|
|
|
2002-08-18 22:47:11 +00:00
|
|
|
public:
|
2003-11-10 01:04:12 +00:00
|
|
|
Engine(OSystem *syst);
|
2002-08-18 17:48:18 +00:00
|
|
|
virtual ~Engine();
|
2005-07-30 21:11:48 +00:00
|
|
|
|
2004-11-23 00:03:25 +00:00
|
|
|
/**
|
|
|
|
* Init the engine.
|
|
|
|
* @return 0 for success, else an error code.
|
|
|
|
*/
|
2006-04-15 20:36:41 +00:00
|
|
|
virtual int init() = 0;
|
2002-08-18 17:48:18 +00:00
|
|
|
|
2004-11-23 00:03:25 +00:00
|
|
|
/**
|
|
|
|
* Start the main engine loop.
|
|
|
|
* The return value is not yet used, but could indicate whether the user
|
2005-07-30 21:11:48 +00:00
|
|
|
* wants to return to the launch or to fully quit ScummVM.
|
2004-11-23 00:03:25 +00:00
|
|
|
* @return a result code
|
|
|
|
*/
|
|
|
|
virtual int go() = 0;
|
2003-03-06 16:27:06 +00:00
|
|
|
|
2003-11-29 12:10:23 +00:00
|
|
|
/** Specific for each engine: prepare error string. */
|
2006-02-12 01:23:58 +00:00
|
|
|
virtual void errorString(const char *buf_input, char *buf_output);
|
2004-11-24 00:14:21 +00:00
|
|
|
|
2006-04-15 20:36:41 +00:00
|
|
|
void initCommonGFX(bool defaultTo1XScaler);
|
2005-06-14 08:54:11 +00:00
|
|
|
|
|
|
|
/** On some systems, check if the game appears to be run from CD. */
|
|
|
|
void checkCD();
|
2005-11-23 19:11:33 +00:00
|
|
|
|
|
|
|
/* Indicate if an autosave should be performed */
|
|
|
|
bool shouldPerformAutoSave(int lastSaveTime);
|
2002-08-14 10:18:03 +00:00
|
|
|
};
|
|
|
|
|
2003-03-07 15:38:11 +00:00
|
|
|
extern Engine *g_engine;
|
|
|
|
|
2002-08-14 10:18:03 +00:00
|
|
|
#endif
|