25 #include "engines/engine.h" 27 #include "common/array.h" 28 #include "common/random.h" 29 #include "common/memstream.h" 30 #include "common/textconsole.h" 32 #include "backends/keymapper/action.h" 33 #include "backends/keymapper/keymapper.h" 36 #include "saga/detection.h" 71 class ResourceContext;
74 #define SAGA_IMAGE_DATA_OFFSET 776 75 #define SAGA_IMAGE_HEADER_LEN 8 81 #define SAVE_TITLE_SIZE 28 83 #define IHNM_SAVE_TITLE_SIZE 22 85 #define MAX_FILE_NAME 256 89 #define OBJECT_TYPE_SHIFT 13 90 #define OBJECT_TYPE_MASK ((1 << OBJECT_TYPE_SHIFT) - 1) 92 #define IHNM_OBJ_PROFILE 0x4000 94 #define memoryError(Place) error("%s Memory allocation error.", Place) 124 kActionOptionReadingSpeed,
128 kActionOptionContinue,
130 kActionOptionQuitGame,
131 kActionOptionSaveGame,
133 kActionConversePosUp,
134 kActionConversePosDown
137 extern const char *engineKeyMapId;
138 extern const char *gameKeyMapId;
139 extern const char *optionKeyMapId;
140 extern const char *saveKeyMapId;
141 extern const char *loadKeyMapId;
142 extern const char *quitKeyMapId;
143 extern const char *converseKeyMapId;
159 kVerbITEWalkOnly = 13,
160 kVerbITELookOnly = 14,
169 kVerbIHNMSwallow = 6,
172 kVerbIHNMOptions = 9,
176 kVerbIHNMWalkOnly = 13,
177 kVerbIHNMLookOnly = 14,
179 kVerbTypeIdsMax = kVerbITELookOnly + 1
182 enum PanelButtonType {
183 kPanelButtonVerb = 1 << 0,
184 kPanelButtonArrow = 1 << 1,
185 kPanelButtonConverseText = 1 << 2,
186 kPanelButtonInventory = 1 << 3,
188 kPanelButtonOption = 1 << 4,
189 kPanelButtonOptionSlider = 1 << 5,
190 kPanelButtonOptionSaveFiles = 1 << 6,
191 kPanelButtonOptionText = 1 << 7,
193 kPanelButtonQuit = 1 << 8,
194 kPanelButtonQuitText = 1 << 9,
196 kPanelButtonLoad = 1 << 10,
197 kPanelButtonLoadText = 1 << 11,
199 kPanelButtonSave = 1 << 12,
200 kPanelButtonSaveText = 1 << 13,
201 kPanelButtonSaveEdit = 1 << 14,
203 kPanelButtonProtectText = 1 << 15,
204 kPanelButtonProtectEdit = 1 << 16,
206 kPanelAllButtons = 0xFFFFF
228 kTextContinuePlaying,
250 kTextQuitTheGameQuestion,
252 kTextEnterSaveGameName,
262 kTextEnterProtectAnswer,
271 uint32 sceneLUTResourceId;
272 uint32 moduleLUTResourceId;
273 uint32 mainPanelResourceId;
274 uint32 conversePanelResourceId;
275 uint32 optionPanelResourceId;
276 uint32 mainSpritesResourceId;
277 uint32 mainPanelSpritesResourceId;
278 uint32 mainStringsResourceId;
280 uint32 actorsStringsResourceId;
281 uint32 defaultPortraitsResourceId;
283 uint32 optionPanelSpritesResourceId;
284 uint32 warningPanelResourceId;
285 uint32 warningPanelSpritesResourceId;
286 uint32 psychicProfileResourceId;
290 uint32 fontResourceId;
296 const char *fileName;
301 enum GameObjectTypes {
303 kGameObjectActor = 1,
304 kGameObjectObject = 2,
305 kGameObjectHitZone = 3,
306 kGameObjectStepZone = 4
310 kScriptTimeTicksPerSecond = (728L/10L),
311 kRepeatSpeedTicks = (728L/10L)/3,
312 kNormalFadeDuration = 320,
313 kQuickFadeDuration = 64,
314 kPuzzleHintTime = 30000000L
329 kHitZoneEnabled = (1 << 0),
330 kHitZoneExit = (1 << 1),
336 kHitZoneAutoWalk = (1 << 2),
340 kHitZoneNoWalk = (1 << 2),
343 kHitZoneTerminus = (1 << 3),
348 kHitZoneProject = (1 << 3)
360 const char *getString(uint index)
const {
361 if (strings.
size() <= index) {
363 warning(
"StringsTable::getString wrong index 0x%X (%d)", index, strings.
size());
366 return strings[index];
379 kITEDOSColorTransBlack = 0x00,
380 kITEDOSColorBrightWhite = 0x01,
381 kITEDOSColorWhite = 0x02,
382 kITEDOSColorLightGrey = 0x04,
383 kITEDOSColorGrey = 0x0a,
384 kITEDOSColorDarkGrey = 0x0b,
385 kITEDOSColorDarkGrey0C = 0x0C,
386 kITEDOSColorBlack = 0x0f,
387 kITEDOSColorYellow60 = 0x60,
388 kITEDOSColorRed = 0x65,
389 kITEDOSColorDarkBlue8a = 0x8a,
390 kITEDOSColorBlue89 = 0x89,
391 kITEDOSColorLightBlue92 = 0x92,
392 kITEDOSColorBlue = 0x93,
393 kITEDOSColorLightBlue94 = 0x94,
394 kITEDOSColorLightBlue96 = 0x96,
395 kITEDOSColorGreen = 0xba,
400 kITEECSColorTransBlack = 0x00,
401 kITEECSColorBrightWhite = 0x4f,
402 kITEECSColorWhite = kITEECSColorBrightWhite,
403 kITEECSColorBlack = 0x50,
406 kITEECSBottomColorGreen = 0x25,
407 kITEECSBottomColorLightBlue96 = 0x28,
408 kITEECSBottomColorWhite = 0x2f,
409 kITEECSBottomColorBrightWhite = 0x2f,
410 kITEECSBottomColorDarkGrey = 0x32,
411 kITEECSBottomColorGrey = 0x36,
412 kITEECSBottomColorBlue = 0x3b,
413 kITEECSBottomColorYellow60 = 0x3e,
416 kITEECSOptionsColorLightBlue94 = 0x48,
417 kITEECSOptionsColorBlue = 0x48,
418 kITEECSOptionsColorDarkBlue8a = 0x48,
419 kITEECSOptionsColorLightBlue92 = 0x48,
420 kITEECSOptionsColorLightBlue96 = 0x48,
421 kITEECSOptionsColorDarkGrey0C = 0x49,
422 kITEECSOptionsColorBlack = kITEECSColorBlack,
423 kITEECSOptionsColorBrightWhite = kITEECSColorBrightWhite,
424 kITEECSOptionsColorDarkGrey = 0x52,
428 kKnownColorTransparent,
429 kKnownColorBrightWhite,
433 kKnownColorSubtitleTextColor,
434 kKnownColorSubtitleEffectColorPC98,
436 kKnownColorVerbTextShadow,
437 kKnownColorVerbTextActive
441 char name[SAVE_TITLE_SIZE];
449 char name[SAVE_TITLE_SIZE];
452 inline int objectTypeId(uint16 objectId) {
453 return objectId >> OBJECT_TYPE_SHIFT;
456 inline int objectIdToIndex(uint16 objectId) {
457 return OBJECT_TYPE_MASK & objectId;
460 inline uint16 objectIndexToId(
int type,
int index) {
461 return (type << OBJECT_TYPE_SHIFT) | (OBJECT_TYPE_MASK & index);
471 return empty() ? NULL : &front();
474 const byte *getBuffer()
const {
475 return empty() ? NULL : &front();
481 memcpy(&front(), &src.
front(), size());
493 ReadStreamEndian(bigEndian) {
504 void syncSoundSettings()
override;
505 void pauseEngineIntern(
bool pause)
override;
510 void save(
const char *fileName,
const char *saveName);
511 void load(
const char *fileName);
512 uint32 getCurrentLoadVersion()
const {
513 return _saveHeader.version;
516 char *calcSaveFileName(uint slotNumber);
522 uint getNewSaveSlotNumber()
const;
523 bool locateSaveFile(
char *saveName, uint &titleNumber);
524 bool isSaveListFull()
const {
525 return _saveFilesCount == MAX_SAVES;
527 uint getSaveFilesCount()
const {
528 return isSaveListFull() ? _saveFilesCount : _saveFilesCount + 1;
531 bool isIHNMDemo()
const {
return _isIHNMDemo; }
533 bool isITEAmiga()
const {
return getPlatform() == Common::kPlatformAmiga && getGameId() == GID_ITE; }
534 bool isAGA()
const {
return _gameDescription->features & GF_AGA_GRAPHICS; }
535 bool isECS()
const {
return _gameDescription->features & GF_ECS_GRAPHICS; }
536 unsigned getPalNumEntries()
const {
return isECS() ? 32 : 256; }
537 GameIntroList getIntroList()
const {
return _gameDescription->introList; }
542 int16 _ethicsPoints[8];
543 int _spiritualBarometer;
547 bool _subtitlesEnabled;
549 bool _voiceFilesExist;
552 bool _copyProtection;
553 bool _musicWasPlaying;
555 bool _hasITESceneSubstitutes;
581 bool decodeBGImageRLE(
const byte *inbuf,
size_t inbuf_len,
ByteArray &outbuf);
582 void flipImage(byte *imageBuffer,
int columns,
int scanlines);
583 void unbankBGImage(byte *dest_buf,
const byte *src_buf,
int columns,
int scanlines);
584 uint32 _previousTicks;
587 bool decodeBGImage(
const ByteArray &imageData,
ByteArray &outputBuffer,
int *w,
int *h,
bool flip =
false);
588 bool decodeBGImageMask(
const ByteArray &imageData,
ByteArray &outputBuffer,
int *w,
int *h,
bool flip =
false);
589 const byte *getImagePal(
const ByteArray &imageData) {
590 if (imageData.
size() <= SAGA_IMAGE_HEADER_LEN) {
594 return &imageData.
front() + SAGA_IMAGE_HEADER_LEN;
598 const char *getObjectName(uint16 objectId)
const;
601 Point mousePos()
const;
603 int getMouseClickCount()
const {
604 return _mouseClickCount;
607 void incrementMouseClickCount() {
611 void resetMouseClickCount() {
612 _mouseClickCount = 0;
615 bool leftMouseButtonPressed()
const {
616 return _leftMouseButtonPressed;
619 bool rightMouseButtonPressed()
const {
620 return _rightMouseButtonPressed;
623 bool mouseButtonPressed()
const {
624 return _leftMouseButtonPressed || _rightMouseButtonPressed;
627 inline int ticksToMSec(
int tick)
const {
628 return tick * 1000 / kScriptTimeTicksPerSecond;
632 uint _saveFilesCount;
636 bool _leftMouseButtonPressed;
637 bool _rightMouseButtonPressed;
638 int _mouseClickCount;
652 bool isBigEndian()
const;
653 bool isMacResources()
const;
656 GameResourceList getResourceList()
const;
657 GameFontList getFontList()
const;
658 GamePatchList getPatchList()
const;
660 int getGameId()
const;
661 uint32 getFeatures()
const;
664 int getGameNumber()
const;
665 int getStartSceneNumber()
const;
670 const Common::Rect &getDisplayClip()
const {
return _displayClip;}
677 int getLanguageIndex();
678 const char *getTextString(
int textStringId);
679 void getExcuseInfo(
int verb,
const char *&textString,
int &soundResourceId);
681 void enableKeyMap(
int mode);
685 int _currentPanelMode;
688 ColorId KnownColor2ColorId(KnownColor knownColor);
689 void setTalkspeed(
int talkspeed);
690 int getTalkspeed()
const;
692 #define ITE_COLOR_DISPATCHER_TYPE(NAME, TYPE) \ 693 ColorId iteColor ## TYPE ## NAME() const { return isECS() ? kITEECS ## TYPE ## Color ## NAME : kITEDOSColor ## NAME; } 694 #define ITE_COLOR_DISPATCHER_BOTTOM(NAME) ITE_COLOR_DISPATCHER_TYPE(NAME, Bottom) 695 #define ITE_COLOR_DISPATCHER_OPTIONS(NAME) ITE_COLOR_DISPATCHER_TYPE(NAME, Options) 696 #define ITE_COLOR_DISPATCHER(NAME) ITE_COLOR_DISPATCHER_TYPE(NAME, ) 698 ITE_COLOR_DISPATCHER(Black)
699 ITE_COLOR_DISPATCHER(TransBlack)
700 ITE_COLOR_DISPATCHER(BrightWhite)
701 ITE_COLOR_DISPATCHER(White)
703 ITE_COLOR_DISPATCHER_BOTTOM(DarkGrey)
704 ITE_COLOR_DISPATCHER_BOTTOM(Blue)
705 ITE_COLOR_DISPATCHER_BOTTOM(Grey)
706 ITE_COLOR_DISPATCHER_BOTTOM(White)
707 ITE_COLOR_DISPATCHER_BOTTOM(BrightWhite)
708 ITE_COLOR_DISPATCHER_BOTTOM(Green)
710 ITE_COLOR_DISPATCHER_OPTIONS(DarkGrey)
711 ITE_COLOR_DISPATCHER_OPTIONS(LightBlue92)
712 ITE_COLOR_DISPATCHER_OPTIONS(LightBlue94)
713 ITE_COLOR_DISPATCHER_OPTIONS(LightBlue96)
714 ITE_COLOR_DISPATCHER_OPTIONS(DarkBlue8a)
715 ITE_COLOR_DISPATCHER_OPTIONS(DarkGrey0C)
716 ITE_COLOR_DISPATCHER_OPTIONS(Blue)
717 ITE_COLOR_DISPATCHER_OPTIONS(BrightWhite)
718 #undef ITE_COLOR_DISPATCHER 719 #undef ITE_COLOR_DISPATCHER_BOTTOM 720 #undef ITE_COLOR_DISPATCHER_OPTIONS 721 #undef ITE_COLOR_DISPATCHER_TYPE
byte * getBuffer()
Definition: saga.h:470
EngineFeature
Definition: engine.h:253
static String format(MSVC_PRINTF const char *fmt,...) GCC_PRINTF(1
void warning(MSVC_PRINTF const char *s,...) GCC_PRINTF(1
void clear()
Definition: array.h:320
Definition: detection.h:109
T & front()
Definition: array.h:217
Definition: displayinfo.h:43
Definition: memstream.h:103
Definition: resource.h:199
size_type size() const
Definition: array.h:315
Common::String getSaveStateName(int slot) const override
Definition: saga.h:517
uint size_type
Definition: array.h:59
Definition: animation.h:100
Definition: interface.h:176
Language
Definition: language.h:45
Definition: advancedDetector.h:78