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 removeMessage(uint idx);
301 void checkInput(byte verb, byte noun);
302 virtual bool isInputValid(byte verb, byte noun,
bool &is_any);
303 virtual bool isInputValid(
const Commands &commands, byte verb, byte noun,
bool &is_any);
304 virtual void applyRoomWorkarounds(byte roomNr) { }
305 virtual void applyRegionWorkarounds() { }
307 virtual void setupOpcodeTables();
308 virtual void initState();
309 virtual void switchRoom(byte roomNr);
310 virtual byte roomArg(byte room)
const;
311 virtual void advanceClock() { }
318 Opcode opcode(
int (T::*f)(
ScriptEnv &)) {
322 virtual int o_isItemInRoom(
ScriptEnv &e);
350 virtual int goDirection(
ScriptEnv &e, Direction D);
351 int o_goNorth(
ScriptEnv &e) {
return goDirection(e, IDI_DIR_NORTH); }
352 int o_goSouth(
ScriptEnv &e) {
return goDirection(e, IDI_DIR_SOUTH); }
353 int o_goEast(
ScriptEnv &e) {
return goDirection(e, IDI_DIR_EAST); }
354 int o_goWest(
ScriptEnv &e) {
return goDirection(e, IDI_DIR_WEST); }
355 int o_goUp(
ScriptEnv &e) {
return goDirection(e, IDI_DIR_UP); }
356 int o_goDown(
ScriptEnv &e) {
return goDirection(e, IDI_DIR_DOWN); }
362 bool playTones(
const Tones &tones,
bool isMusic,
bool allowSkip =
false)
const;
365 const Region &getRegion(uint i)
const;
366 Region &getRegion(uint i);
367 const Room &getRoom(uint i)
const;
368 Room &getRoom(uint i);
369 const Region &getCurRegion()
const;
371 const Room &getCurRoom()
const;
373 const Item &getItem(uint i)
const;
374 Item &getItem(uint i);
375 byte getVar(uint i)
const;
376 void setVar(uint i, byte value);
377 virtual void takeItem(byte noun);
378 virtual void dropItem(byte noun);
381 bool doOneCommand(
const Commands &commands, byte verb, byte noun);
382 void doAllCommands(
const Commands &commands, byte verb, byte noun);
383 virtual ScriptEnv *createScriptEnv(
const Command &cmd, byte room, byte verb, byte noun);
394 bool op_debug(
const char *fmt, ...)
const;
406 PictureMap _pictures;
410 Commands _roomCommands;
411 Commands _globalCommands;
429 uint32 _verbErrorPos, _nounErrorPos;
436 uint thanksForPlaying;
443 bool _isRestarting, _isRestoring, _isQuitting;
444 bool _canSaveNow, _canRestoreNow;
451 mutable uint _scriptDelay;
452 mutable bool _scriptPaused;
455 virtual void runIntro() { }
456 virtual void init() = 0;
457 virtual void initGameState() = 0;
458 virtual void drawItems() = 0;
460 virtual void loadRoom(byte roomNr) = 0;
461 virtual void showRoom() = 0;
462 virtual void switchRegion(byte region) { }
463 void runScript(
const char *filename)
const;
464 void stopScript()
const;
465 void setScriptDelay(uint scriptDelay)
const { _scriptDelay = scriptDelay; }
473 byte convertKey(uint16 ascii)
const;
475 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