22 #ifndef KYRA_KYRA_V1_H 23 #define KYRA_KYRA_V1_H 25 #include "engines/engine.h" 27 #include "common/array.h" 28 #include "common/error.h" 29 #include "common/events.h" 30 #include "common/hashmap.h" 31 #include "common/random.h" 32 #include "common/rendermode.h" 34 #include "audio/mixer.h" 36 #include "kyra/script/script.h" 37 #include "kyra/engine/item.h" 38 #include "kyra/detection.h" 42 class SeekableReadStream;
90 uint operator()(Common::KeyCode val)
const {
return (uint)val; }
98 kDebugLevelSprites = 1 << 2,
100 kDebugLevelSound = 1 << 4,
102 kDebugLevelMain = 1 << 6,
109 enum AudioResourceSet {
128 friend class ::KyraMetaEngine;
131 friend class GUI_EoB;
132 friend class GUI_EoB_SegaCD;
134 friend class SeqPlayer_HOF;
135 friend class TransferPartyWiz;
140 uint8 game()
const {
return _flags.gameID; }
141 const GameFlags &gameFlags()
const {
return _flags; }
144 Resource *resource() {
return _res; }
145 virtual Screen *screen() = 0;
147 virtual GUI *gui()
const {
return 0; }
148 Sound *sound() {
return _sound; }
152 uint32 tickLength()
const {
return _tickLength; }
157 void setMousePos(
int x,
int y);
161 bool speechEnabled();
171 void setVolume(kVolumeEntry vol, uint8 value);
172 uint8 getVolume(kVolumeEntry vol);
174 void syncSoundSettings()
override;
177 int setGameFlag(
int flag);
178 int queryGameFlag(
int flag)
const;
179 int resetGameFlag(
int flag);
182 virtual void snd_playTheme(
int file,
int track);
183 virtual void snd_playSoundEffect(
int id,
int volume=0xFF);
184 virtual void snd_playWanderScoreViaMap(
int command,
int restart);
185 virtual void snd_playVoiceFile(
int id) = 0;
186 virtual bool snd_voiceIsPlaying();
187 virtual void snd_stopVoice();
190 virtual void delayUntil(uint32 timestamp,
bool updateGameTimers =
false,
bool update =
false,
bool isMainLoop =
false);
191 virtual void delay(uint32 millis,
bool update =
false,
bool isMainLoop =
false);
192 virtual void delayWithTicks(
int ticks);
201 registerDefaultSettings();
209 void pauseEngineIntern(
bool pause)
override;
222 int checkInput(
Button *buttonList,
bool mainLoop =
false,
int eventFlag = 0x8000);
223 void removeInputTop();
225 int _mouseX, _mouseY;
229 void transposeScreenOutputY(
int yAdd);
236 Event() : event(), causedSkip(
false) {}
245 bool _asciiCodeEvents;
249 virtual void registerDefaultSettings();
250 virtual void readSettings();
251 virtual void writeSettings();
253 uint8 _configWalkspeed;
258 bool _configNullSound;
263 virtual bool skipFlag()
const;
264 virtual void resetSkipFlag(
bool removeEvent =
true);
273 virtual void setupTimers() = 0;
275 virtual void setWalkspeed(uint8 speed) = 0;
281 virtual void setupOpcodeTable() = 0;
284 int o1_queryGameFlag(
EMCState *script);
285 int o1_setGameFlag(
EMCState *script);
286 int o1_resetGameFlag(
EMCState *script);
290 int o1_setMousePos(
EMCState *script);
291 int o1_setHandItem(
EMCState *script);
292 int o1_removeHandItem(
EMCState *script);
293 int o1_getMouseState(
EMCState *script);
294 int o1_setDeathHandler(
EMCState *script);
295 int o1_playWanderScoreViaMap(
EMCState *script);
297 int o1_blockInWalkableRegion(
EMCState *script);
298 int o1_blockOutWalkableRegion(
EMCState *script);
299 int o1_playSoundEffect(
EMCState *script);
302 #ifndef RELEASE_BUILD 303 int16 emcSafeReadStack(
EMCState *s,
int x,
int line,
const char *file) {
304 if (s->sp+x > EMCState::kStackLastEntry) {
306 warning(
"Invalid EMC stack read attempt from: '%s', line %d", file, line);
309 return s->stack[s->sp+x];
316 virtual void setHandItem(Item item) = 0;
317 virtual void removeHandItem() = 0;
320 uint8 _flagsTable[100];
327 int16 _lastMusicCommand;
329 const int8 *_trackMap;
332 bool _preventScriptSfx;
334 virtual int convertVolumeToMixer(
int value);
335 virtual int convertVolumeFromMixer(
int value);
338 virtual int findWay(
int x,
int y,
int toX,
int toY,
int *moveTable,
int moveTableSize);
339 int findSubPath(
int x,
int y,
int toX,
int toY,
int *moveTable,
int start,
int end);
340 int getFacingFromPointToPoint(
int x,
int y,
int toX,
int toY);
341 int getOppositeFacingDirection(
int dir);
342 void changePosTowardsFacing(
int &x,
int &y,
int facing);
343 int getMoveTableSize(
int *moveTable);
344 virtual bool lineIsPassable(
int x,
int y) = 0;
346 static const int8 _addXPosTable[];
347 static const int8 _addYPosTable[];
351 static const int8 _charAddXPosTable[];
352 static const int8 _charAddYPosTable[];
363 const char *getSavegameFilename(
int num);
366 bool saveFileLoadable(
int slot);
380 uint32 totalPlaySecs;
383 enum ReadSaveHeaderError {
385 kRSHEInvalidType = 1,
386 kRSHEInvalidVersion = 2,
392 void loadGameStateCheck(
int slot);
395 return saveGameStateIntern(slot, desc.c_str(), 0);
406 void updatePlayTimer();
407 void restartPlayTimerAt(uint32 totalPlaySecs);
408 void pausePlayTimer(
bool pause);
411 uint32 _lastSecTickAtPauseStart;
412 uint32 _totalPlaySecs;
Definition: resource.h:1250
bool canLoadGameStateCurrently(Common::U32String *msg=nullptr) override
Definition: kyra_v1.h:359
EngineFeature
Definition: engine.h:253
Definition: savefile.h:54
debug level for "TimerManager" functions
Definition: kyra_v1.h:106
ErrorCode getCode() const
Definition: error.h:115
void warning(MSVC_PRINTF const char *s,...) GCC_PRINTF(1
Definition: resource.h:48
DebugLevels
Definition: kyra_v1.h:95
Definition: kyra_v1.h:126
Definition: kyra_v1.h:232
RenderMode
Definition: rendermode.h:48
No error occurred.
Definition: error.h:48
bool canSaveGameStateCurrently(Common::U32String *msg=nullptr) override
Definition: kyra_v1.h:360
Common::Error saveGameState(int slot, const Common::String &desc, bool isAutosave=false) override
Definition: kyra_v1.h:394
debug level for "SeqPlayer" functions
Definition: kyra_v1.h:104
debug level for "Screen" functions
Definition: kyra_v1.h:99
debug level for o::_* functions
Definition: kyra_v1.h:96
Definition: algorithm.h:29
Definition: formatinfo.h:28
Common::Error run() override
Definition: kyra_v1.h:199
bool skipThumbnail(Common::SeekableReadStream &in)
Definition: detection.h:38
Out move(In first, In last, Out dst)
Definition: algorithm.h:109
Definition: detection.h:27
int getAutosaveSlot() const override
Definition: kyra_v1.h:361
Definition: debugger.h:34
debug level for "ScreenAnimator" functions
Definition: kyra_v1.h:101
Definition: sound_intern.h:58
debug level for "EMCInterpreter" functions
Definition: kyra_v1.h:97
debug level for "KyraEngine*" gui functions
Definition: kyra_v1.h:103
debug level for movie specific funtions
Definition: kyra_v1.h:105