scummvm/engines/kingdom/kingdom.h

248 lines
6.2 KiB
C
Raw Normal View History

2017-06-11 17:32:05 +02: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 KINGDOM_KINGDOM_H
#define KINGDOM_KINGDOM_H
2017-06-16 11:04:33 +02:00
#include "common/system.h"
2017-06-11 17:32:05 +02:00
#include "common/scummsys.h"
#include "common/config-manager.h"
#include "common/random.h"
2017-06-11 17:32:05 +02:00
#include "engines/advancedDetector.h"
#include "common/error.h"
#include "engines/engine.h"
#include "audio/audiostream.h"
#include "audio/decoders/wave.h"
#include "audio/mixer.h"
#include "common/memstream.h"
2017-06-11 17:32:05 +02:00
#include "common/events.h"
#include "common/file.h"
#include "common/queue.h"
#include "common/system.h"
#include "common/timer.h"
#include "graphics/palette.h"
#include "graphics/screen.h"
#include "graphics/surface.h"
#include "image/bmp.h"
2017-06-29 00:38:03 +02:00
#include "common/savefile.h"
#include "gui/saveload.h"
#include "graphics/thumbnail.h"
#include "common/serializer.h"
2017-06-11 17:32:05 +02:00
#include "kingdom/console.h"
#include "kingdom/logic.h"
2017-06-11 17:32:05 +02:00
namespace Kingdom {
enum KingdomDebugChannels {
kDebugGeneral = 1 << 0
};
2017-06-11 17:32:05 +02:00
struct KingArtEntry {
2017-07-05 07:58:18 +02:00
uint8 _width;
uint8 _height;
byte* _data;
};
struct HotSpot {
int16 _minX;
int16 _maxX;
int16 _minY;
int16 _maxY;
int16 _mouseValue;
};
2017-07-05 07:58:18 +02:00
extern const char *_rezNames[];
extern const char *_movieNames[];
2017-07-05 07:58:18 +02:00
extern int _mapExit[];
extern int _emlTable[];
extern int _zoomTable[81][9][2];
extern int _iconActTable[82][7];
extern int _cursorTable[96];
extern int _teaSeq[6][2];
extern int _hgaSeq[4][2];
extern HotSpot _mouseMapMS[51];
extern HotSpot _mouseMapAS[128][16];
2017-06-16 16:37:55 +02:00
2017-06-29 00:38:03 +02:00
struct KingdomSavegameHeader {
uint32 _signature;
uint8 _version;
Common::String _saveName;
Graphics::Surface *_thumbnail;
int _year, _month, _day;
int _hour, _minute;
};
class KingdomGame : public Engine {
public:
KingdomGame(OSystem *syst, const ADGameDescription *gameDesc);
~KingdomGame();
2017-06-11 17:32:05 +02:00
virtual Common::Error run();
2017-06-11 17:32:05 +02:00
// Detection related functions
const ADGameDescription *_gameDescription;
const char *getGameId() const;
Common::Platform getPlatform() const;
2017-07-04 07:47:25 +02:00
static bool readSavegameHeader(Common::InSaveFile *in, KingdomSavegameHeader &header);
bool isDemo() const;
2017-06-11 17:32:05 +02:00
private:
Console *_console;
Logic *_logic;
2017-06-11 17:32:05 +02:00
KingArtEntry *_kingartEntries;
public:
Common::RandomSource *_rnd;
2017-07-05 07:58:18 +02:00
bool _loopFlag;
int _gameMode;
bool _fstFwd;
bool _noIFScreen;
bool _sound;
bool _lastSound;
bool _fullScreen;
int _frameStop;
int _daelonCntr;
bool _itemInhibit;
bool _asMode;
bool _aTimerFlag;
bool _bTimerFlag;
bool _cTimerFlag;
bool _skylarTimerFlag;
int _aTimer;
int _bTimer;
int _cTimer;
int _skylarTimer;
bool _mapEx;
int _healthTmr;
int _treeEyeTimer;
int _treeEyePic;
int _treeEyeSta;
int _treeHGTimer;
int _treeHGPic;
int _treeHGUPic;
int _treeLeftPic;
int _treeRightPic;
int _treeRightSta;
int _treeHGSta;
bool _tsIconOnly;
2017-07-06 07:22:27 +02:00
bool _noMusic; // TODO: Synchronize this flag with the launcher
byte *_asPtr;
int _asMap;
int _oldTLS;
int _oldTRS;
int _treeLeftSta;
bool _iconsClosed;
bool _oldIconsClosed;
int _pMovie;
bool _keyActive;
bool _iconRedraw;
bool _quit;
2017-07-06 07:22:27 +02:00
bool _cursorDrawn; // CHECKME: Useless
bool _wizard;
int _zoom;
int _mouseValue;
int _cursorDef; // TODO: Could be removed by using the return value of CursorTypeExit()
int _oldCursorDef; // CHECKME: Unused in our implementation?
int _cursorX;
int _cursorY;
int _oldCursorX; // CHECKME: Unused in out implementation?
int _oldCursorY; // CHECKME: Unused in out implementation?
int _iconSel;
int _iconSelect;
bool _mouseDebound;
int _soundNumber;
bool _palStepFlag;
2017-06-27 23:29:49 +02:00
Audio::SoundHandle _soundHandle;
2017-07-03 08:13:10 +02:00
int _tickCount;
2017-07-03 20:14:17 +02:00
uint32 _oldTime;
2017-06-13 07:14:50 +02:00
Common::SeekableReadStream *_rezPointers[510];
int _rezSize[510];
int _iconPic[7];
uint16 _userInput;
uint16 _mouseButton;
void drawScreen();
void setupPics();
void initTools();
void titlePage();
void initPlay();
void initHelp();
void fadeToBlack1();
void fadeToBlack2();
2017-07-08 11:28:34 +02:00
void loadAResource(int reznum);
void releaseAResource(int reznum);
void showPic(int reznum);
void fShowPic(int reznum);
void initCursor();
void initMouse();
void setMouse();
void readMouse();
void initMPlayer();
void playMovie(int movieNum);
void saveAS(); // TODO: Rename later as saveVideoBackground
void restoreAS(); // TODO: Rename later as restoreVideoBackground
void drawHelpScreen();
void drawRect(uint minX, uint minY, uint maxX, uint maxY, int color);
void drawInventory();
void playSound(int idx);
void eraseCursor();
void getUserInput();
void eraseCursorAsm();
void drawLocation();
void processMap(int mapNum, int zoom);
void processMapInput(int mapNum);
void drawPic(int reznum);
void displayIcon(int reznum);
void setATimer();
void refreshSound();
void checkMainScreen();
void switchAtoM();
void switchMtoA();
void drawIcon(int x, int y, int index);
int waitKey();
void drawCursor();
void cursorType();
void loadKingArt();
void setCursor(int cursor);
int getAKey();
int checkMouseMapAS();
void cursorTypeExit();
2017-06-29 00:38:03 +02:00
void saveGame();
void restoreGame();
virtual Common::Error loadGameState(int slot);
virtual Common::Error saveGameState(int slot, const Common::String &desc);
2017-07-04 07:47:25 +02:00
Common::String getSavegameFilename(int slot);
2017-06-29 00:38:03 +02:00
void writeSavegameHeader(Common::OutSaveFile *out, KingdomSavegameHeader &header);
void synchronize(Common::Serializer &s);
2017-07-03 08:13:10 +02:00
void refreshScreen();
void checkTimers();
void initVariables();
};
2017-06-11 17:32:05 +02:00
} // End of namespace Kingdom
#endif