25 #include "common/debug-channels.h" 26 #include "common/array.h" 27 #include "common/rect.h" 28 #include "common/str.h" 29 #include "common/hashmap.h" 30 #include "common/hash-str.h" 31 #include "common/func.h" 32 #include "common/ptr.h" 33 #include "common/scummsys.h" 34 #include "common/keyboard.h" 36 #include "engines/engine.h" 38 #include "audio/mixer.h" 39 #include "audio/softsynth/pcspk.h" 41 #include "adl/console.h" 43 #include "adl/sound.h" 44 #include "adl/detection.h" 49 class SeekableReadStream;
57 Common::Path getDiskImageName(
const AdlGameDescription &adlDesc, byte volume);
58 GameType getGameType(
const AdlGameDescription &desc);
59 GameVersion getGameVersion(
const AdlGameDescription &desc);
69 kDebugChannelScript = 1 << 0
80 #define IDO_ACT_SAVE 0x0f 81 #define IDO_ACT_LOAD 0x10 83 #define IDI_CUR_ROOM 0xfc 84 #define IDI_VOID_ROOM 0xfd 87 #define IDI_WORD_SIZE 8 105 memset(connections, 0,
sizeof(connections));
109 byte connections[IDI_DIR_TOTAL];
123 byte numCond, numAct;
130 _cmd(cmd), _room(room), _verb(verb), _noun(noun), _ip(0) { }
140 byte op()
const {
return _cmd.script[_ip]; }
141 virtual kOpType getOpType()
const = 0;
143 byte arg(uint i)
const {
return _cmd.script[_ip + i]; }
144 virtual void next(uint numArgs) = 0;
146 bool isMatch()
const {
147 return (_cmd.room == IDI_ANY || _cmd.room == _room) &&
148 (_cmd.verb == IDI_ANY || _cmd.verb == _verb) &&
149 (_cmd.noun == IDI_ANY || _cmd.noun == _noun);
152 byte getNoun()
const {
return _noun; }
153 const Command &getCommand()
const {
return _cmd; }
160 const byte _room, _verb, _noun;
182 Item() : id(0), noun(0), region(0), room(0), picture(0), isShape(
false), state(0), description(0), isOnScreen(
false) { }
188 Time() : hours(12), minutes(0) { }
207 byte region, prevRegion;
214 State() : region(0), prevRegion(0), room(1), curPicture(0), moves(1), isDark(
false) { }
227 #define OP_DEBUG_0(F) do { \ 228 if (DebugMan.isDebugChannelEnabled(kDebugChannelScript) && op_debug(F)) \ 232 #define OP_DEBUG_1(F, P1) do { \ 233 if (DebugMan.isDebugChannelEnabled(kDebugChannelScript) && op_debug(F, P1)) \ 237 #define OP_DEBUG_2(F, P1, P2) do { \ 238 if (DebugMan.isDebugChannelEnabled(kDebugChannelScript) && op_debug(F, P1, P2)) \ 242 #define OP_DEBUG_3(F, P1, P2, P3) do { \ 243 if (DebugMan.isDebugChannelEnabled(kDebugChannelScript) && op_debug(F, P1, P2, P3)) \ 247 #define OP_DEBUG_4(F, P1, P2, P3, P4) do { \ 248 if (DebugMan.isDebugChannelEnabled(kDebugChannelScript) && op_debug(F, P1, P2, P3, P4)) \ 258 void bell(uint count = 1)
const;
270 Common::Path getDiskImageName(byte volume)
const {
return Adl::getDiskImageName(*_gameDescription, volume); }
271 GameType getGameType()
const {
return Adl::getGameType(*_gameDescription); }
272 GameVersion getGameVersion()
const {
return Adl::getGameVersion(*_gameDescription); }
273 Common::Language getLanguage()
const {
return Adl::getLanguage(*_gameDescription); }
274 virtual void gameLoop();
283 virtual void printMessage(uint idx);
285 void delay(uint32 ms)
const;
289 byte inputKey(
bool showCursor =
true)
const;
290 void waitKey(uint32 ms = 0, Common::KeyCode keycode = Common::KEYCODE_INVALID)
const;
291 virtual void getInput(uint &verb, uint &noun);
298 void removeCommand(Commands &commands, uint idx);
299 Command &getCommand(Commands &commands, uint idx);
300 void checkInput(byte verb, byte noun);
301 virtual bool isInputValid(byte verb, byte noun,
bool &is_any);
302 virtual bool isInputValid(
const Commands &commands, byte verb, byte noun,
bool &is_any);
303 virtual void applyRoomWorkarounds(byte roomNr) { }
304 virtual void applyRegionWorkarounds() { }
306 virtual void setupOpcodeTables();
307 virtual void initState();
308 virtual void switchRoom(byte roomNr);
309 virtual byte roomArg(byte room)
const;
310 virtual void advanceClock() { }
317 Opcode opcode(
int (T::*f)(
ScriptEnv &)) {
321 virtual int o_isItemInRoom(
ScriptEnv &e);
349 virtual int goDirection(
ScriptEnv &e, Direction D);
350 int o_goNorth(
ScriptEnv &e) {
return goDirection(e, IDI_DIR_NORTH); }
351 int o_goSouth(
ScriptEnv &e) {
return goDirection(e, IDI_DIR_SOUTH); }
352 int o_goEast(
ScriptEnv &e) {
return goDirection(e, IDI_DIR_EAST); }
353 int o_goWest(
ScriptEnv &e) {
return goDirection(e, IDI_DIR_WEST); }
354 int o_goUp(
ScriptEnv &e) {
return goDirection(e, IDI_DIR_UP); }
355 int o_goDown(
ScriptEnv &e) {
return goDirection(e, IDI_DIR_DOWN); }
361 bool playTones(
const Tones &tones,
bool isMusic,
bool allowSkip =
false)
const;
364 const Region &getRegion(uint i)
const;
365 Region &getRegion(uint i);
366 const Room &getRoom(uint i)
const;
367 Room &getRoom(uint i);
368 const Region &getCurRegion()
const;
370 const Room &getCurRoom()
const;
372 const Item &getItem(uint i)
const;
373 Item &getItem(uint i);
374 byte getVar(uint i)
const;
375 void setVar(uint i, byte value);
376 virtual void takeItem(byte noun);
377 virtual void dropItem(byte noun);
380 bool doOneCommand(
const Commands &commands, byte verb, byte noun);
381 void doAllCommands(
const Commands &commands, byte verb, byte noun);
382 virtual ScriptEnv *createScriptEnv(
const Command &cmd, byte room, byte verb, byte noun);
393 bool op_debug(
const char *fmt, ...)
const;
405 PictureMap _pictures;
409 Commands _roomCommands;
410 Commands _globalCommands;
428 uint32 _verbErrorPos, _nounErrorPos;
435 uint thanksForPlaying;
442 bool _isRestarting, _isRestoring, _isQuitting;
443 bool _canSaveNow, _canRestoreNow;
450 mutable uint _scriptDelay;
451 mutable bool _scriptPaused;
454 virtual void runIntro() { }
455 virtual void init() = 0;
456 virtual void initGameState() = 0;
457 virtual void drawItems() = 0;
459 virtual void loadRoom(byte roomNr) = 0;
460 virtual void showRoom() = 0;
461 virtual void switchRegion(byte region) { }
462 void runScript(
const char *filename)
const;
463 void stopScript()
const;
464 void setScriptDelay(uint scriptDelay)
const { _scriptDelay = scriptDelay; }
472 byte convertKey(uint16 ascii)
const;
474 byte _saveVerb, _saveNoun, _restoreVerb, _restoreNoun;
EngineFeature
Definition: engine.h:253
int getAutosaveSlot() const override
Definition: adl.h:268
Definition: detection.h:71
Definition: graphics.h:32
Definition: algorithm.h:29
Language
Definition: language.h:45