Initial commit
This commit is contained in:
368
engines/hugo/hugo.h
Normal file
368
engines/hugo/hugo.h
Normal file
@@ -0,0 +1,368 @@
|
||||
/* 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 3 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, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef HUGO_HUGO_H
|
||||
#define HUGO_HUGO_H
|
||||
|
||||
#include "common/text-to-speech.h"
|
||||
|
||||
#include "engines/engine.h"
|
||||
|
||||
// This include is here temporarily while the engine is being refactored.
|
||||
#include "hugo/game.h"
|
||||
#include "hugo/detection.h"
|
||||
|
||||
#define HUGO_DAT_VER_MAJ 0 // 1 byte
|
||||
#define HUGO_DAT_VER_MIN 42 // 1 byte
|
||||
#define DATAALIGNMENT 4
|
||||
|
||||
namespace Common {
|
||||
class SeekableReadStream;
|
||||
class RandomSource;
|
||||
}
|
||||
|
||||
/**
|
||||
* This is the namespace of the Hugo engine.
|
||||
*
|
||||
* Status of this engine: ???
|
||||
*
|
||||
* Games using this engine:
|
||||
* - Hugo's House of Horror
|
||||
* - Whodunit?
|
||||
* - Jungle of Doom
|
||||
* - Hugo's Horrific Adventure
|
||||
* - Hugo's Mystery Adventure
|
||||
* - Hugo's Amazon Adventure
|
||||
*/
|
||||
namespace Hugo {
|
||||
|
||||
static const int kSavegameVersion = 6;
|
||||
static const int kInvDx = 32; // Width of an inventory icon
|
||||
static const int kInvDy = 32; // Height of inventory icon
|
||||
static const int kMaxTunes = 16; // Max number of tunes
|
||||
static const int kStepDx = 5; // Num pixels moved in x by HERO per step
|
||||
static const int kStepDy = 4; // Num pixels moved in y by HERO per step
|
||||
static const int kXPix = 320; // Width of pcx background file
|
||||
static const int kYPix = 200; // Height of pcx background file
|
||||
static const int kViewSizeX = kXPix; // Width of window view
|
||||
static const int kViewSizeY = 192; // Height of window view. In original game: 184
|
||||
static const int kDibOffY = 0; // Offset into dib SrcY (old status line area). In original game: 8
|
||||
static const int kCompLineSize = 40; // number of bytes in a compressed line
|
||||
static const int kMaxTextCols = 40; // Number of text lines in display
|
||||
static const int kMaxTextRows = 25; // Number of text lines in display
|
||||
static const int kMaxLineSize = kMaxTextCols - 2; // Max length of user input line
|
||||
static const int kMaxBoxChar = kMaxTextCols * kMaxTextRows; // Max chars on screen
|
||||
static const int kOvlSize = kCompLineSize * kYPix; // Size of an overlay file
|
||||
static const int kStateDontCare = 0xFF; // Any state allowed in command verb
|
||||
static const int kHeroIndex = 0; // In all enums, HERO is the first element
|
||||
static const int kArrowNumb = 2; // Number of arrows (left/right)
|
||||
static const int kLeftArrow = -2; // Cursor over Left arrow in inventory icon bar
|
||||
static const int kRightArrow = -3; // Cursor over Right arrow in inventory icon bar
|
||||
static const int kMaxPath = 256; // Max length of a full path name
|
||||
static const int kHeroMaxWidth = 24; // Maximum width of hero
|
||||
static const int kHeroMinWidth = 16; // Minimum width of hero
|
||||
|
||||
typedef char Command[kMaxLineSize + 8]; // Command line (+spare for prompt,cursor)
|
||||
|
||||
struct Config { // User's config (saved)
|
||||
bool _musicFl; // State of Music button/menu item
|
||||
bool _soundFl; // State of Sound button/menu item
|
||||
bool _turboFl; // State of Turbo button/menu item
|
||||
bool _playlist[kMaxTunes]; // Tune playlist
|
||||
};
|
||||
|
||||
typedef byte Icondib[kXPix * kInvDy]; // Icon bar dib
|
||||
typedef byte Viewdib[(long)kXPix * kYPix]; // Viewport dib
|
||||
typedef byte Overlay[kOvlSize]; // Overlay file
|
||||
|
||||
enum HUGOAction {
|
||||
kActionNone,
|
||||
kActionEscape,
|
||||
kActionMoveTop,
|
||||
kActionMoveBottom,
|
||||
kActionMoveLeft,
|
||||
kActionMoveRight,
|
||||
kActionMoveTopRight,
|
||||
kActionMoveTopLeft,
|
||||
kActionMoveBottomRight,
|
||||
kActionMoveBottomLeft,
|
||||
kActionUserHelp,
|
||||
kActionToggleSound,
|
||||
kActionRepeatLine,
|
||||
kActionSaveGame,
|
||||
kActionRestoreGame,
|
||||
kActionNewGame,
|
||||
kActionInventory,
|
||||
kActionToggleTurbo
|
||||
};
|
||||
|
||||
enum HugoDebugChannels {
|
||||
kDebugSchedule = 1,
|
||||
kDebugEngine,
|
||||
kDebugDisplay,
|
||||
kDebugMouse,
|
||||
kDebugParser,
|
||||
kDebugFile,
|
||||
kDebugRoute,
|
||||
kDebugInventory,
|
||||
kDebugObject,
|
||||
kDebugMusic,
|
||||
};
|
||||
|
||||
enum HugoRegistered {
|
||||
kRegShareware = 0,
|
||||
kRegRegistered,
|
||||
kRegFreeware
|
||||
};
|
||||
|
||||
/**
|
||||
* Inventory icon bar states
|
||||
*/
|
||||
enum Istate {kInventoryOff, kInventoryUp, kInventoryDown, kInventoryActive};
|
||||
|
||||
/**
|
||||
* Game view state machine
|
||||
*/
|
||||
enum Vstate {kViewIdle, kViewIntroInit, kViewIntro, kViewPlay, kViewInvent, kViewExit};
|
||||
|
||||
/**
|
||||
* Enumerate whether object is foreground, background or 'floating'
|
||||
* If floating, HERO can collide with it and fore/back ground is determined
|
||||
* by relative y-coord of object base. This is the general case.
|
||||
* If fore or background, no collisions can take place and object is either
|
||||
* behind or in front of all others, although can still be hidden by the
|
||||
* the overlay plane. OVEROVL means the object is FLOATING (to other
|
||||
* objects) but is never hidden by the overlay plane
|
||||
*/
|
||||
enum {kPriorityForeground, kPriorityBackground, kPriorityFloating, kPriorityOverOverlay};
|
||||
|
||||
/**
|
||||
* Display list functions
|
||||
*/
|
||||
enum Dupdate {kDisplayInit, kDisplayAdd, kDisplayDisplay, kDisplayRestore};
|
||||
|
||||
/**
|
||||
* Priority for sound effect
|
||||
*/
|
||||
enum Priority {kSoundPriorityLow, kSoundPriorityMedium, kSoundPriorityHigh};
|
||||
|
||||
// Strings used by the engine
|
||||
enum seqTextEngine {
|
||||
kEsAdvertise = 0
|
||||
};
|
||||
|
||||
struct Status { // Game status (not saved)
|
||||
bool _storyModeFl; // Game is telling story - no commands
|
||||
bool _gameOverFl; // Game is over - hero knobbled
|
||||
bool _lookFl; // Toolbar "look" button pressed
|
||||
bool _recallFl; // Toolbar "recall" button pressed
|
||||
bool _newScreenFl; // New screen just loaded in dib_a
|
||||
bool _godModeFl; // Allow DEBUG features in live version
|
||||
bool _showBoundariesFl; // Flag used to show and hide boundaries,
|
||||
// used by the console
|
||||
bool _doQuitFl;
|
||||
bool _skipIntroFl;
|
||||
bool _helpFl;
|
||||
uint32 _tick; // Current time in ticks
|
||||
Vstate _viewState; // View state machine
|
||||
int16 _song; // Current song
|
||||
};
|
||||
|
||||
/**
|
||||
* Structure to define an EXIT or other collision-activated hotspot
|
||||
*/
|
||||
struct Hotspot {
|
||||
int _screenIndex; // Screen in which hotspot appears
|
||||
int _x1, _y1, _x2, _y2; // Bounding box of hotspot
|
||||
uint16 _actIndex; // Actions to carry out if a 'hit'
|
||||
int16 _viewx, _viewy, _direction; // Used in auto-route mode
|
||||
};
|
||||
|
||||
enum TtsOptions {
|
||||
kTtsNoSpeech = 0,
|
||||
kTtsSpeech = (1 << 0),
|
||||
kTtsReplaceNewlines = ((1 << 1) | kTtsSpeech)
|
||||
};
|
||||
|
||||
class FileManager;
|
||||
class Scheduler;
|
||||
class Screen;
|
||||
class MouseHandler;
|
||||
class InventoryHandler;
|
||||
class Parser;
|
||||
class Route;
|
||||
class SoundHandler;
|
||||
class IntroHandler;
|
||||
class ObjectHandler;
|
||||
class TextHandler;
|
||||
class TopMenu;
|
||||
class HugoConsole;
|
||||
|
||||
class HugoEngine : public Engine {
|
||||
public:
|
||||
HugoEngine(OSystem *syst, const HugoGameDescription *gd);
|
||||
~HugoEngine() override;
|
||||
|
||||
OSystem *_system;
|
||||
|
||||
byte _numVariant;
|
||||
byte _gameVariant;
|
||||
int8 _soundSilence;
|
||||
int8 _soundTest;
|
||||
int8 _tunesNbr;
|
||||
uint16 _numScreens;
|
||||
uint16 _numStates;
|
||||
int8 _normalTPS; // Number of ticks (frames) per second.
|
||||
// 8 for Win versions, 9 for DOS versions
|
||||
Object *_hero;
|
||||
byte *_screenPtr;
|
||||
byte _heroImage;
|
||||
byte *_screenStates;
|
||||
Command _line; // Line of user text input
|
||||
Config _config; // User's config
|
||||
int16 *_defltTunes;
|
||||
uint16 _look;
|
||||
uint16 _take;
|
||||
uint16 _drop;
|
||||
|
||||
Maze _maze; // Maze control structure
|
||||
hugoBoot _boot; // Boot info structure
|
||||
|
||||
Common::RandomSource *_rnd;
|
||||
|
||||
const char *_episode;
|
||||
Common::Path _picDir;
|
||||
|
||||
Command _statusLine; // text at top row of screen
|
||||
Command _promptLine; // text at bottom row of screen
|
||||
|
||||
#ifdef USE_TTS
|
||||
bool _voiceScoreLine;
|
||||
bool _voiceSoundSetting;
|
||||
bool _queueAllVoicing;
|
||||
int _previousScore;
|
||||
|
||||
Common::String _previousSaid;
|
||||
#endif
|
||||
|
||||
const HugoGameDescription *_gameDescription;
|
||||
uint32 getFeatures() const;
|
||||
const char *getGameId() const;
|
||||
|
||||
GameType getGameType() const;
|
||||
Common::Platform getPlatform() const;
|
||||
bool isPacked() const;
|
||||
bool useWindowsInterface() const;
|
||||
|
||||
// Used by the qsort function
|
||||
static HugoEngine &get() {
|
||||
assert(s_Engine != nullptr);
|
||||
return *s_Engine;
|
||||
}
|
||||
|
||||
bool canLoadGameStateCurrently(Common::U32String *msg = nullptr) override;
|
||||
bool canSaveGameStateCurrently(Common::U32String *msg = nullptr) override;
|
||||
bool loadHugoDat();
|
||||
|
||||
int8 getTPS() const;
|
||||
|
||||
void initGame(const HugoGameDescription *gd);
|
||||
void initGamePart(const HugoGameDescription *gd);
|
||||
void endGame();
|
||||
void gameOverMsg();
|
||||
void initStatus();
|
||||
void readScreenFiles(const int screen);
|
||||
void setNewScreen(const int screen);
|
||||
void shutdown();
|
||||
void syncSoundSettings() override;
|
||||
|
||||
Status &getGameStatus();
|
||||
int getScore() const;
|
||||
void setScore(const int newScore);
|
||||
void adjustScore(const int adjustment);
|
||||
int getMaxScore() const;
|
||||
void setMaxScore(const int newScore);
|
||||
Common::Error saveGameState(int slot, const Common::String &desc, bool isAutosave = false) override;
|
||||
Common::Error loadGameState(int slot) override;
|
||||
bool hasFeature(EngineFeature f) const override;
|
||||
const char *getCopyrightString1() const;
|
||||
const char *getCopyrightString2() const;
|
||||
|
||||
Common::String getSaveStateName(int slot) const override;
|
||||
uint16 **loadLongArray(Common::SeekableReadStream &in);
|
||||
|
||||
Common::KeyCode notifyBox(const Common::String &text, bool protect = false, TtsOptions ttsOptions = kTtsReplaceNewlines);
|
||||
Common::String promptBox(const Common::String &text);
|
||||
bool yesNoBox(const Common::String &text, bool useFirstKey);
|
||||
void takeObjectBox(const char *name);
|
||||
|
||||
#ifdef USE_TTS
|
||||
void sayText(const Common::String &text, Common::TextToSpeechManager::Action action = Common::TextToSpeechManager::INTERRUPT);
|
||||
#endif
|
||||
|
||||
FileManager *_file;
|
||||
Scheduler *_scheduler;
|
||||
Screen *_screen;
|
||||
MouseHandler *_mouse;
|
||||
InventoryHandler *_inventory;
|
||||
Parser *_parser;
|
||||
Route *_route;
|
||||
SoundHandler *_sound;
|
||||
IntroHandler *_intro;
|
||||
ObjectHandler *_object;
|
||||
TextHandler *_text;
|
||||
TopMenu *_topMenu;
|
||||
|
||||
protected:
|
||||
|
||||
// Engine APIs
|
||||
Common::Error run() override;
|
||||
|
||||
private:
|
||||
static const int kTurboTps = 16; // This many in turbo mode
|
||||
|
||||
Status _status; // Game status structure
|
||||
uint32 _lastTime;
|
||||
uint32 _curTime;
|
||||
|
||||
static HugoEngine *s_Engine;
|
||||
|
||||
GameType _gameType;
|
||||
Common::Platform _platform;
|
||||
bool _packedFl;
|
||||
bool _windowsInterfaceFl;
|
||||
|
||||
int _score; // Holds current score
|
||||
int _maxscore; // Holds maximum score
|
||||
|
||||
void initPlaylist(bool playlist[kMaxTunes]);
|
||||
void initConfig();
|
||||
void initialize();
|
||||
void initMachine();
|
||||
void calcMaxScore();
|
||||
void resetConfig();
|
||||
void runMachine();
|
||||
|
||||
};
|
||||
|
||||
} // End of namespace Hugo
|
||||
|
||||
#endif // HUGO_HUGO_H
|
||||
Reference in New Issue
Block a user