2010-08-17 09:28:20 +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.
|
|
|
|
*
|
|
|
|
* $URL$
|
|
|
|
* $Id$
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef HUGO_H
|
|
|
|
#define HUGO_H
|
|
|
|
|
|
|
|
#include "engines/engine.h"
|
|
|
|
#include "common/file.h"
|
|
|
|
|
|
|
|
// This include is here temporarily while the engine is being refactored.
|
|
|
|
#include "hugo/game.h"
|
|
|
|
|
2010-10-15 06:16:27 +00:00
|
|
|
#define HUGO_DAT_VER_MAJ 0 // 1 byte
|
|
|
|
#define HUGO_DAT_VER_MIN 25 // 1 byte
|
|
|
|
#define DATAALIGNMENT 4
|
|
|
|
#define EDGE 10 // Closest object can get to edge of screen
|
|
|
|
#define EDGE2 (EDGE * 2) // Push object further back on edge collision
|
|
|
|
#define SHIFT 8 // Place hero this far inside bounding box
|
2010-08-17 09:28:20 +00:00
|
|
|
|
|
|
|
namespace Common {
|
|
|
|
class RandomSource;
|
|
|
|
}
|
|
|
|
|
2010-10-15 12:28:56 +00:00
|
|
|
/**
|
|
|
|
* This is the namespace of the Hugo engine.
|
|
|
|
*
|
|
|
|
* Status of this engine: ???
|
|
|
|
*
|
2010-10-15 12:48:19 +00:00
|
|
|
* Games using this engine:
|
|
|
|
* - Hugo's House of Horror
|
|
|
|
* - Whodunit?
|
|
|
|
* - Jungle of Doom
|
2010-10-15 12:28:56 +00:00
|
|
|
*/
|
2010-08-17 09:28:20 +00:00
|
|
|
namespace Hugo {
|
2010-10-15 12:28:56 +00:00
|
|
|
|
2010-08-17 09:28:20 +00:00
|
|
|
enum GameType {
|
|
|
|
kGameTypeNone = 0,
|
|
|
|
kGameTypeHugo1,
|
|
|
|
kGameTypeHugo2,
|
|
|
|
kGameTypeHugo3
|
|
|
|
};
|
|
|
|
|
2010-09-17 22:40:53 +00:00
|
|
|
enum GameVariant {
|
|
|
|
kGameVariantH1Win = 0,
|
|
|
|
kGameVariantH2Win,
|
|
|
|
kGameVariantH3Win,
|
|
|
|
kGameVariantH1Dos,
|
|
|
|
kGameVariantH2Dos,
|
|
|
|
kGameVariantH3Dos
|
|
|
|
};
|
|
|
|
|
2010-09-16 23:03:03 +00:00
|
|
|
enum HugoDebugChannels {
|
2010-10-25 14:03:01 +00:00
|
|
|
kDebugSchedule = 1 << 0,
|
|
|
|
kDebugEngine = 1 << 1,
|
|
|
|
kDebugDisplay = 1 << 2,
|
|
|
|
kDebugMouse = 1 << 3,
|
|
|
|
kDebugParser = 1 << 4,
|
|
|
|
kDebugFile = 1 << 5,
|
|
|
|
kDebugRoute = 1 << 6,
|
|
|
|
kDebugInventory = 1 << 7,
|
|
|
|
kDebugObject = 1 << 8
|
2010-08-17 09:28:20 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
enum HugoGameFeatures {
|
|
|
|
GF_PACKED = (1 << 0) // Database
|
|
|
|
};
|
|
|
|
|
2010-10-15 06:16:27 +00:00
|
|
|
// Strings used by the engine
|
|
|
|
enum seqTextEngine {
|
|
|
|
kEsAdvertise = 0
|
|
|
|
};
|
2010-08-17 09:28:20 +00:00
|
|
|
struct HugoGameDescription;
|
|
|
|
|
|
|
|
class FileManager;
|
|
|
|
class Scheduler;
|
|
|
|
class Screen;
|
|
|
|
class MouseHandler;
|
|
|
|
class InventoryHandler;
|
|
|
|
class Parser;
|
|
|
|
class Route;
|
|
|
|
class SoundHandler;
|
|
|
|
class IntroHandler;
|
2010-10-21 17:09:57 +00:00
|
|
|
class ObjectHandler;
|
2010-08-17 09:28:20 +00:00
|
|
|
|
2010-10-15 06:16:27 +00:00
|
|
|
|
2010-08-17 09:28:20 +00:00
|
|
|
class HugoEngine : public Engine {
|
|
|
|
public:
|
|
|
|
HugoEngine(OSystem *syst, const HugoGameDescription *gd);
|
|
|
|
~HugoEngine();
|
|
|
|
|
|
|
|
byte _numVariant;
|
|
|
|
byte _gameVariant;
|
|
|
|
byte _maxInvent;
|
|
|
|
byte _numBonuses;
|
|
|
|
byte _soundSilence;
|
|
|
|
byte _soundTest;
|
|
|
|
byte _tunesNbr;
|
|
|
|
uint16 _numScreens;
|
|
|
|
|
|
|
|
object_t *_hero;
|
|
|
|
byte *_screen_p;
|
|
|
|
byte _heroImage;
|
|
|
|
|
|
|
|
byte *_palette;
|
|
|
|
byte *_introX;
|
|
|
|
byte *_introY;
|
|
|
|
byte *_screenStates;
|
2010-09-12 22:59:32 +00:00
|
|
|
byte *_arrayFont[3];
|
|
|
|
int16 _arrayFontSize[3];
|
2010-08-17 09:28:20 +00:00
|
|
|
char **_textData;
|
|
|
|
char **_stringtData;
|
|
|
|
char **_screenNames;
|
|
|
|
char **_textEngine;
|
|
|
|
char **_textIntro;
|
|
|
|
char **_textMouse;
|
|
|
|
char **_textParser;
|
|
|
|
char **_textSchedule;
|
|
|
|
char **_textUtil;
|
|
|
|
char ***_arrayNouns;
|
2010-10-30 16:04:43 +00:00
|
|
|
uint16 _arrayNounsSize;
|
2010-08-17 09:28:20 +00:00
|
|
|
char ***_arrayVerbs;
|
2010-10-30 16:04:43 +00:00
|
|
|
uint16 _arrayVerbsSize;
|
2010-08-17 09:28:20 +00:00
|
|
|
uint16 **_arrayReqs;
|
|
|
|
hotspot_t *_hotspots;
|
|
|
|
int16 *_invent;
|
|
|
|
uses_t *_uses;
|
|
|
|
background_t *_catchallList;
|
|
|
|
background_t **_backgroundObjects;
|
2010-10-30 16:04:43 +00:00
|
|
|
uint16 _backgroundObjectsSize;
|
2010-08-17 09:28:20 +00:00
|
|
|
point_t *_points;
|
|
|
|
cmd **_cmdList;
|
2010-10-30 16:04:43 +00:00
|
|
|
uint16 _cmdListSize;
|
2010-08-17 09:28:20 +00:00
|
|
|
uint16 **_screenActs;
|
2010-10-30 16:04:43 +00:00
|
|
|
uint16 _screenActsSize;
|
2010-08-17 09:28:20 +00:00
|
|
|
act **_actListArr;
|
2010-10-30 16:04:43 +00:00
|
|
|
uint16 _actListArrSize;
|
2010-08-17 09:28:20 +00:00
|
|
|
int16 *_defltTunes;
|
|
|
|
uint16 _look;
|
|
|
|
uint16 _take;
|
|
|
|
uint16 _drop;
|
|
|
|
uint16 _numObj;
|
|
|
|
uint16 _alNewscrIndex;
|
|
|
|
|
|
|
|
Common::RandomSource *_rnd;
|
|
|
|
|
|
|
|
const char *_episode;
|
|
|
|
const char *_picDir;
|
|
|
|
|
2010-10-10 23:24:57 +00:00
|
|
|
Common::String _initFilename, _saveFilename;
|
2010-08-17 09:28:20 +00:00
|
|
|
|
2010-09-27 20:24:36 +00:00
|
|
|
command_t _statusLine;
|
|
|
|
command_t _scoreLine;
|
|
|
|
|
2010-08-17 09:28:20 +00:00
|
|
|
const HugoGameDescription *_gameDescription;
|
|
|
|
uint32 getFeatures() const;
|
|
|
|
|
|
|
|
GameType getGameType() const;
|
|
|
|
Common::Platform getPlatform() const;
|
|
|
|
bool isPacked() const;
|
|
|
|
|
|
|
|
// Temporary, until the engine is fully objectified.
|
|
|
|
static HugoEngine &get() {
|
2010-10-03 08:08:42 +00:00
|
|
|
assert(s_Engine != 0);
|
2010-08-17 09:28:20 +00:00
|
|
|
return *s_Engine;
|
|
|
|
}
|
|
|
|
|
|
|
|
void initGame(const HugoGameDescription *gd);
|
|
|
|
void initGamePart(const HugoGameDescription *gd);
|
|
|
|
bool loadHugoDat();
|
|
|
|
|
|
|
|
int getMouseX() const {
|
|
|
|
return _mouseX;
|
|
|
|
}
|
|
|
|
int getMouseY() const {
|
|
|
|
return _mouseY;
|
|
|
|
}
|
|
|
|
|
2010-10-25 13:31:01 +00:00
|
|
|
void boundaryCollision(object_t *obj);
|
2010-08-17 09:28:20 +00:00
|
|
|
void clearBoundary(int x1, int x2, int y);
|
|
|
|
void endGame();
|
2010-10-21 17:09:57 +00:00
|
|
|
void initStatus();
|
|
|
|
void processMaze();
|
|
|
|
void readObjectImages();
|
2010-08-17 09:28:20 +00:00
|
|
|
void readScreenFiles(int screen);
|
|
|
|
void screenActions(int screen);
|
2010-10-21 17:09:57 +00:00
|
|
|
void setNewScreen(int screen);
|
2010-08-17 09:28:20 +00:00
|
|
|
void shutdown();
|
2010-10-21 17:09:57 +00:00
|
|
|
void storeBoundary(int x1, int x2, int y);
|
|
|
|
|
|
|
|
char *useBG(char *name);
|
|
|
|
|
|
|
|
int deltaX(int x1, int x2, int vx, int y);
|
|
|
|
int deltaY(int x1, int x2, int vy, int y);
|
2010-08-17 09:28:20 +00:00
|
|
|
|
|
|
|
overlay_t &getBoundaryOverlay() {
|
|
|
|
return _boundary;
|
|
|
|
}
|
|
|
|
overlay_t &getObjectBoundaryOverlay() {
|
|
|
|
return _objBound;
|
|
|
|
}
|
|
|
|
overlay_t &getBaseBoundaryOverlay() {
|
|
|
|
return _ovlBase;
|
|
|
|
}
|
|
|
|
overlay_t &getFirstOverlay() {
|
|
|
|
return _overlay;
|
|
|
|
}
|
|
|
|
status_t &getGameStatus() {
|
|
|
|
return _status;
|
|
|
|
}
|
|
|
|
int getScore() const {
|
|
|
|
return _score;
|
|
|
|
}
|
|
|
|
void setScore(int newScore) {
|
|
|
|
_score = newScore;
|
|
|
|
}
|
|
|
|
void adjustScore(int adjustment) {
|
|
|
|
_score += adjustment;
|
|
|
|
}
|
|
|
|
int getMaxScore() const {
|
|
|
|
return _maxscore;
|
|
|
|
}
|
|
|
|
void setMaxScore(int newScore) {
|
|
|
|
_maxscore = newScore;
|
|
|
|
}
|
|
|
|
byte getIntroSize() {
|
|
|
|
return _introXSize;
|
|
|
|
}
|
|
|
|
|
2010-10-21 17:09:57 +00:00
|
|
|
FileManager *_file;
|
|
|
|
Scheduler *_scheduler;
|
|
|
|
Screen *_screen;
|
|
|
|
MouseHandler *_mouse;
|
|
|
|
InventoryHandler *_inventory;
|
|
|
|
Parser *_parser;
|
|
|
|
Route *_route;
|
|
|
|
SoundHandler *_sound;
|
|
|
|
IntroHandler *_intro;
|
|
|
|
ObjectHandler *_object;
|
|
|
|
|
2010-08-17 09:28:20 +00:00
|
|
|
protected:
|
|
|
|
|
|
|
|
// Engine APIs
|
|
|
|
Common::Error run();
|
|
|
|
|
|
|
|
private:
|
|
|
|
int _mouseX;
|
|
|
|
int _mouseY;
|
|
|
|
byte _paletteSize;
|
|
|
|
byte _introXSize;
|
|
|
|
status_t _status; // Game status structure
|
|
|
|
|
|
|
|
static HugoEngine *s_Engine;
|
|
|
|
|
|
|
|
// The following are bit plane display overlays which mark travel boundaries,
|
|
|
|
// foreground stationary objects and baselines for those objects (used to
|
|
|
|
// determine foreground/background wrt moving objects)
|
|
|
|
|
|
|
|
// Vinterstum: These shouldn't be static, but we get weird pathfinding issues (and Valgrind warnings) without.
|
|
|
|
// Needs more investigation. Alignment issues?
|
|
|
|
|
|
|
|
static overlay_t _boundary; // Boundary overlay file
|
|
|
|
static overlay_t _overlay; // First overlay file
|
|
|
|
static overlay_t _ovlBase; // First overlay base file
|
|
|
|
static overlay_t _objBound; // Boundary file marks object baselines
|
|
|
|
|
|
|
|
GameType _gameType;
|
|
|
|
Common::Platform _platform;
|
|
|
|
bool _packedFl;
|
|
|
|
|
|
|
|
int _score; // Holds current score
|
|
|
|
int _maxscore; // Holds maximum score
|
|
|
|
|
|
|
|
char **loadTextsVariante(Common::File &in, uint16 *arraySize);
|
2010-10-30 16:04:43 +00:00
|
|
|
char ***loadTextsArray(Common::File &in, uint16 *arraySize);
|
2010-08-17 09:28:20 +00:00
|
|
|
uint16 **loadLongArray(Common::File &in);
|
|
|
|
char **loadTexts(Common::File &in);
|
|
|
|
void freeTexts(char **ptr);
|
|
|
|
|
|
|
|
void initPlaylist(bool playlist[MAX_TUNES]);
|
|
|
|
void initConfig(inst_t action);
|
|
|
|
void initialize();
|
|
|
|
void calcMaxScore();
|
|
|
|
void initMachine();
|
|
|
|
void runMachine();
|
2010-08-26 23:41:39 +00:00
|
|
|
|
2010-08-17 09:28:20 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
} // End of namespace Hugo
|
|
|
|
|
|
|
|
#endif // Hugo_H
|