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" 33 #include "saga/detection.h" 68 class ResourceContext;
71 #define SAGA_IMAGE_DATA_OFFSET 776 72 #define SAGA_IMAGE_HEADER_LEN 8 78 #define SAVE_TITLE_SIZE 28 80 #define IHNM_SAVE_TITLE_SIZE 22 82 #define MAX_FILE_NAME 256 86 #define OBJECT_TYPE_SHIFT 13 87 #define OBJECT_TYPE_MASK ((1 << OBJECT_TYPE_SHIFT) - 1) 89 #define IHNM_OBJ_PROFILE 0x4000 91 #define memoryError(Place) error("%s Memory allocation error.", Place) 112 kVerbITEWalkOnly = 13,
113 kVerbITELookOnly = 14,
122 kVerbIHNMSwallow = 6,
125 kVerbIHNMOptions = 9,
129 kVerbIHNMWalkOnly = 13,
130 kVerbIHNMLookOnly = 14,
132 kVerbTypeIdsMax = kVerbITELookOnly + 1
135 enum PanelButtonType {
136 kPanelButtonVerb = 1 << 0,
137 kPanelButtonArrow = 1 << 1,
138 kPanelButtonConverseText = 1 << 2,
139 kPanelButtonInventory = 1 << 3,
141 kPanelButtonOption = 1 << 4,
142 kPanelButtonOptionSlider = 1 << 5,
143 kPanelButtonOptionSaveFiles = 1 << 6,
144 kPanelButtonOptionText = 1 << 7,
146 kPanelButtonQuit = 1 << 8,
147 kPanelButtonQuitText = 1 << 9,
149 kPanelButtonLoad = 1 << 10,
150 kPanelButtonLoadText = 1 << 11,
152 kPanelButtonSave = 1 << 12,
153 kPanelButtonSaveText = 1 << 13,
154 kPanelButtonSaveEdit = 1 << 14,
156 kPanelButtonProtectText = 1 << 15,
157 kPanelButtonProtectEdit = 1 << 16,
159 kPanelAllButtons = 0xFFFFF
181 kTextContinuePlaying,
203 kTextQuitTheGameQuestion,
205 kTextEnterSaveGameName,
215 kTextEnterProtectAnswer,
224 uint32 sceneLUTResourceId;
225 uint32 moduleLUTResourceId;
226 uint32 mainPanelResourceId;
227 uint32 conversePanelResourceId;
228 uint32 optionPanelResourceId;
229 uint32 mainSpritesResourceId;
230 uint32 mainPanelSpritesResourceId;
231 uint32 mainStringsResourceId;
233 uint32 actorsStringsResourceId;
234 uint32 defaultPortraitsResourceId;
236 uint32 optionPanelSpritesResourceId;
237 uint32 warningPanelResourceId;
238 uint32 warningPanelSpritesResourceId;
239 uint32 psychicProfileResourceId;
243 uint32 fontResourceId;
249 const char *fileName;
254 enum GameObjectTypes {
256 kGameObjectActor = 1,
257 kGameObjectObject = 2,
258 kGameObjectHitZone = 3,
259 kGameObjectStepZone = 4
263 kScriptTimeTicksPerSecond = (728L/10L),
264 kRepeatSpeedTicks = (728L/10L)/3,
265 kNormalFadeDuration = 320,
266 kQuickFadeDuration = 64,
267 kPuzzleHintTime = 30000000L
282 kHitZoneEnabled = (1 << 0),
283 kHitZoneExit = (1 << 1),
289 kHitZoneAutoWalk = (1 << 2),
293 kHitZoneNoWalk = (1 << 2),
296 kHitZoneTerminus = (1 << 3),
301 kHitZoneProject = (1 << 3)
313 const char *getString(uint index)
const {
314 if (strings.
size() <= index) {
316 warning(
"StringsTable::getString wrong index 0x%X (%d)", index, strings.
size());
319 return strings[index];
332 kITEDOSColorTransBlack = 0x00,
333 kITEDOSColorBrightWhite = 0x01,
334 kITEDOSColorWhite = 0x02,
335 kITEDOSColorLightGrey = 0x04,
336 kITEDOSColorGrey = 0x0a,
337 kITEDOSColorDarkGrey = 0x0b,
338 kITEDOSColorDarkGrey0C = 0x0C,
339 kITEDOSColorBlack = 0x0f,
340 kITEDOSColorYellow60 = 0x60,
341 kITEDOSColorRed = 0x65,
342 kITEDOSColorDarkBlue8a = 0x8a,
343 kITEDOSColorBlue89 = 0x89,
344 kITEDOSColorLightBlue92 = 0x92,
345 kITEDOSColorBlue = 0x93,
346 kITEDOSColorLightBlue94 = 0x94,
347 kITEDOSColorLightBlue96 = 0x96,
348 kITEDOSColorGreen = 0xba,
353 kITEECSColorTransBlack = 0x00,
354 kITEECSColorBrightWhite = 0x4f,
355 kITEECSColorWhite = kITEECSColorBrightWhite,
356 kITEECSColorBlack = 0x50,
359 kITEECSBottomColorGreen = 0x25,
360 kITEECSBottomColorLightBlue96 = 0x28,
361 kITEECSBottomColorWhite = 0x2f,
362 kITEECSBottomColorBrightWhite = 0x2f,
363 kITEECSBottomColorDarkGrey = 0x32,
364 kITEECSBottomColorGrey = 0x36,
365 kITEECSBottomColorBlue = 0x3b,
366 kITEECSBottomColorYellow60 = 0x3e,
369 kITEECSOptionsColorLightBlue94 = 0x48,
370 kITEECSOptionsColorBlue = 0x48,
371 kITEECSOptionsColorDarkBlue8a = 0x48,
372 kITEECSOptionsColorLightBlue92 = 0x48,
373 kITEECSOptionsColorLightBlue96 = 0x48,
374 kITEECSOptionsColorDarkGrey0C = 0x49,
375 kITEECSOptionsColorBlack = kITEECSColorBlack,
376 kITEECSOptionsColorBrightWhite = kITEECSColorBrightWhite,
377 kITEECSOptionsColorDarkGrey = 0x52,
381 kKnownColorTransparent,
382 kKnownColorBrightWhite,
386 kKnownColorSubtitleTextColor,
387 kKnownColorSubtitleEffectColorPC98,
389 kKnownColorVerbTextShadow,
390 kKnownColorVerbTextActive
394 char name[SAVE_TITLE_SIZE];
402 char name[SAVE_TITLE_SIZE];
405 inline int objectTypeId(uint16 objectId) {
406 return objectId >> OBJECT_TYPE_SHIFT;
409 inline int objectIdToIndex(uint16 objectId) {
410 return OBJECT_TYPE_MASK & objectId;
413 inline uint16 objectIndexToId(
int type,
int index) {
414 return (type << OBJECT_TYPE_SHIFT) | (OBJECT_TYPE_MASK & index);
424 return empty() ? NULL : &front();
427 const byte *getBuffer()
const {
428 return empty() ? NULL : &front();
434 memcpy(&front(), &src.
front(), size());
446 ReadStreamEndian(bigEndian) {
457 void syncSoundSettings()
override;
458 void pauseEngineIntern(
bool pause)
override;
463 void save(
const char *fileName,
const char *saveName);
464 void load(
const char *fileName);
465 uint32 getCurrentLoadVersion()
const {
466 return _saveHeader.version;
469 char *calcSaveFileName(uint slotNumber);
475 uint getNewSaveSlotNumber()
const;
476 bool locateSaveFile(
char *saveName, uint &titleNumber);
477 bool isSaveListFull()
const {
478 return _saveFilesCount == MAX_SAVES;
480 uint getSaveFilesCount()
const {
481 return isSaveListFull() ? _saveFilesCount : _saveFilesCount + 1;
484 bool isIHNMDemo()
const {
return _isIHNMDemo; }
486 bool isITEAmiga()
const {
return getPlatform() == Common::kPlatformAmiga && getGameId() == GID_ITE; }
487 bool isAGA()
const {
return _gameDescription->features & GF_AGA_GRAPHICS; }
488 bool isECS()
const {
return _gameDescription->features & GF_ECS_GRAPHICS; }
489 unsigned getPalNumEntries()
const {
return isECS() ? 32 : 256; }
490 GameIntroList getIntroList()
const {
return _gameDescription->introList; }
495 int16 _ethicsPoints[8];
496 int _spiritualBarometer;
500 bool _subtitlesEnabled;
502 bool _voiceFilesExist;
505 bool _copyProtection;
506 bool _musicWasPlaying;
508 bool _hasITESceneSubstitutes;
534 bool decodeBGImageRLE(
const byte *inbuf,
size_t inbuf_len,
ByteArray &outbuf);
535 void flipImage(byte *imageBuffer,
int columns,
int scanlines);
536 void unbankBGImage(byte *dest_buf,
const byte *src_buf,
int columns,
int scanlines);
537 uint32 _previousTicks;
540 bool decodeBGImage(
const ByteArray &imageData,
ByteArray &outputBuffer,
int *w,
int *h,
bool flip =
false);
541 bool decodeBGImageMask(
const ByteArray &imageData,
ByteArray &outputBuffer,
int *w,
int *h,
bool flip =
false);
542 const byte *getImagePal(
const ByteArray &imageData) {
543 if (imageData.
size() <= SAGA_IMAGE_HEADER_LEN) {
547 return &imageData.
front() + SAGA_IMAGE_HEADER_LEN;
551 const char *getObjectName(uint16 objectId)
const;
554 Point mousePos()
const;
556 int getMouseClickCount()
const {
557 return _mouseClickCount;
560 void incrementMouseClickCount() {
564 void resetMouseClickCount() {
565 _mouseClickCount = 0;
568 bool leftMouseButtonPressed()
const {
569 return _leftMouseButtonPressed;
572 bool rightMouseButtonPressed()
const {
573 return _rightMouseButtonPressed;
576 bool mouseButtonPressed()
const {
577 return _leftMouseButtonPressed || _rightMouseButtonPressed;
580 inline int ticksToMSec(
int tick)
const {
581 return tick * 1000 / kScriptTimeTicksPerSecond;
585 uint _saveFilesCount;
589 bool _leftMouseButtonPressed;
590 bool _rightMouseButtonPressed;
591 int _mouseClickCount;
605 bool isBigEndian()
const;
606 bool isMacResources()
const;
609 GameResourceList getResourceList()
const;
610 GameFontList getFontList()
const;
611 GamePatchList getPatchList()
const;
613 int getGameId()
const;
614 uint32 getFeatures()
const;
617 int getGameNumber()
const;
618 int getStartSceneNumber()
const;
623 const Common::Rect &getDisplayClip()
const {
return _displayClip;}
630 int getLanguageIndex();
631 const char *getTextString(
int textStringId);
632 void getExcuseInfo(
int verb,
const char *&textString,
int &soundResourceId);
637 ColorId KnownColor2ColorId(KnownColor knownColor);
638 void setTalkspeed(
int talkspeed);
639 int getTalkspeed()
const;
641 #define ITE_COLOR_DISPATCHER_TYPE(NAME, TYPE) \ 642 ColorId iteColor ## TYPE ## NAME() const { return isECS() ? kITEECS ## TYPE ## Color ## NAME : kITEDOSColor ## NAME; } 643 #define ITE_COLOR_DISPATCHER_BOTTOM(NAME) ITE_COLOR_DISPATCHER_TYPE(NAME, Bottom) 644 #define ITE_COLOR_DISPATCHER_OPTIONS(NAME) ITE_COLOR_DISPATCHER_TYPE(NAME, Options) 645 #define ITE_COLOR_DISPATCHER(NAME) ITE_COLOR_DISPATCHER_TYPE(NAME, ) 647 ITE_COLOR_DISPATCHER(Black)
648 ITE_COLOR_DISPATCHER(TransBlack)
649 ITE_COLOR_DISPATCHER(BrightWhite)
650 ITE_COLOR_DISPATCHER(White)
652 ITE_COLOR_DISPATCHER_BOTTOM(DarkGrey)
653 ITE_COLOR_DISPATCHER_BOTTOM(Blue)
654 ITE_COLOR_DISPATCHER_BOTTOM(Grey)
655 ITE_COLOR_DISPATCHER_BOTTOM(White)
656 ITE_COLOR_DISPATCHER_BOTTOM(BrightWhite)
657 ITE_COLOR_DISPATCHER_BOTTOM(Green)
659 ITE_COLOR_DISPATCHER_OPTIONS(DarkGrey)
660 ITE_COLOR_DISPATCHER_OPTIONS(LightBlue92)
661 ITE_COLOR_DISPATCHER_OPTIONS(LightBlue94)
662 ITE_COLOR_DISPATCHER_OPTIONS(LightBlue96)
663 ITE_COLOR_DISPATCHER_OPTIONS(DarkBlue8a)
664 ITE_COLOR_DISPATCHER_OPTIONS(DarkGrey0C)
665 ITE_COLOR_DISPATCHER_OPTIONS(Blue)
666 ITE_COLOR_DISPATCHER_OPTIONS(BrightWhite)
667 #undef ITE_COLOR_DISPATCHER 668 #undef ITE_COLOR_DISPATCHER_BOTTOM 669 #undef ITE_COLOR_DISPATCHER_OPTIONS 670 #undef ITE_COLOR_DISPATCHER_TYPE
byte * getBuffer()
Definition: saga.h:423
EngineFeature
Definition: engine.h:250
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:280
Definition: detection.h:109
T & front()
Definition: array.h:177
Definition: displayinfo.h:43
Definition: memstream.h:103
Definition: resource.h:199
size_type size() const
Definition: array.h:275
Common::String getSaveStateName(int slot) const override
Definition: saga.h:470
uint size_type
Definition: array.h:59
Definition: animation.h:100
Definition: interface.h:176
Language
Definition: language.h:45
Definition: advancedDetector.h:50