22 #ifndef PRINCE_PRINCE_H 23 #define PRINCE_PRINCE_H 25 #include "common/random.h" 26 #include "common/system.h" 27 #include "common/debug.h" 28 #include "common/debug-channels.h" 29 #include "common/textconsole.h" 30 #include "common/rect.h" 31 #include "common/events.h" 32 #include "common/endian.h" 33 #include "common/savefile.h" 34 #include "common/serializer.h" 38 #include "gui/debugger.h" 40 #include "engines/engine.h" 41 #include "engines/util.h" 43 #include "audio/mixer.h" 45 #include "video/flic_decoder.h" 47 #include "prince/mob.h" 48 #include "prince/object.h" 49 #include "prince/pscr.h" 50 #include "prince/detection.h" 54 struct SavegameHeader;
60 class InterpreterFlags;
76 int16 saveYear, saveMonth, saveDay;
77 int16 saveHour, saveMinutes;
81 #define kSavegameStrSize 14 82 #define kSavegameStr "SCUMMVM_PRINCE" 127 const int kStructSizeBAS = 28;
136 const int kStructSizeBASA = 8;
159 int32 _currShadowFrame;
160 int16 _packShadowFlag;
174 int16 getAnimData(Anim::AnimOffsets offset) {
183 error(
"getAnimData() - Wrong offset type: %d", (
int)offset);
187 void setAnimData(Anim::AnimOffsets offset, int16 value) {
188 if (offset == kAnimX) {
191 error(
"setAnimData() - Wrong offset: %d, value: %d", (
int)offset, value);
202 kBackgroundAnimation,
221 return READ_LE_UINT16(_data);
225 return READ_LE_UINT16(_data + 2);
228 int16 getWidth()
const {
229 return READ_LE_UINT16(_data + 4);
232 int16 getHeight()
const {
233 return READ_LE_UINT16(_data + 6);
236 byte *getMask()
const {
237 return (byte *)(_data + 8);
278 bool scummVMSaveLoadDialog(
bool isSave);
281 void pauseEngineIntern(
bool pause)
override;
292 bool loadGame(
int slotNumber);
295 int32 _creditsDataSize;
297 void scrollCredits();
299 int getGameType()
const;
300 const char *getGameId()
const;
301 uint32 getFeatures()
const;
312 uint32 _mobTranslationSize;
313 byte *_mobTranslationData;
317 bool loadLocation(uint16 locationNr);
318 bool loadAnim(uint16 animNr,
bool loop);
319 bool loadVoice(uint32 textSlot, uint32 sampleSlot,
const Common::String &name);
321 bool loadZoom(byte *zoomBitmap, uint32 dataSize,
const char *resourceName);
322 bool loadShadow(byte *shadowBitmap, uint32 dataSize,
const char *resourceName1,
const char *resourceName2);
323 bool loadTrans(byte *transTable,
const char *resourceName);
324 bool loadMobPriority(
const char *resourceName);
326 void loadMobTranslationTexts();
327 void setMobTranslationTexts();
329 bool loadMusic(
int musNumber);
332 void playSample(uint16 sampleId, uint16 loopType);
333 void stopSample(uint16 sampleId);
334 void stopAllSamples();
335 void freeSample(uint16 sampleId);
336 void freeAllSamples();
338 void setVoice(uint16 slot, uint32 sampleSlot, uint16 flag);
340 void changeCursor(uint16 curId);
341 void printAt(uint32 slot, uint8 color,
char *s, uint16 x, uint16 y);
342 int calcTextLines(
const char *s);
343 int calcTextTime(
int numberOfLines);
344 void correctStringDEU(
char *s);
346 static const uint8 kMaxTexts = 32;
347 Text _textSlots[kMaxTexts];
379 int32 _shadScaleValue;
382 void setShadowScale(int32 shadowScale);
383 static void plotShadowLinePoint(
int x,
int y,
int color,
void *data);
385 static const int16 kFPS = 15;
386 static const int32 kIntMax = 2147483647;
388 static const int16 kMaxPicWidth = 1280;
389 static const int16 kMaxPicHeight = 480;
390 static const int16 kZoomStep = 4;
391 static const int32 kZoomBitmapLen = kMaxPicHeight / kZoomStep * kMaxPicWidth / kZoomStep;
392 static const int32 kShadowBitmapSize = kMaxPicWidth * kMaxPicHeight / 8;
393 static const int16 kShadowLineArraySize = 2 * 1280 * 4;
394 static const int16 kZoomBitmapWidth = kMaxPicWidth / kZoomStep;
395 static const int16 kZoomBitmapHeight = kMaxPicHeight / kZoomStep;
396 static const int16 kNormalWidth = 640;
397 static const int16 kNormalHeight = 480;
398 static const uint32 kTransTableSize = 256 * 256;
400 static const int kMaxNormAnims = 64;
401 static const int kMaxBackAnims = 64;
402 static const int kMaxObjects = 64;
403 static const int kMaxMobs = 64;
415 void freeNormAnim(
int slot);
416 void freeAllNormAnims();
417 void removeSingleBackAnim(
int slot);
421 void checkMasks(
int x1,
int y1,
int sprWidth,
int sprHeight,
int z);
431 int _currentPointerNumber;
433 static const int16 kMaxInv = 90;
434 static const uint16 kMaxItems = 30;
449 int _invOptionsWidth;
450 int _invOptionsHeight;
454 int _invOptionsNumber;
458 bool _showInventoryFlag;
460 bool _inventoryBackgroundRemember;
482 void inventoryFlagChange(
bool inventoryState);
484 void rememberScreenInv();
485 void prepareInventoryToView();
487 void displayInventory();
488 void addInv(
int heroId,
int item,
bool addItemQuiet);
489 void remInv(
int heroId,
int item);
490 void clearInv(
int heroId);
491 void swapInv(
int heroId);
493 void makeInvCursor(
int itemNr);
494 void enableOptions(
bool checkType);
496 void checkInvOptions();
497 void openInventoryCheck();
499 void leftMouseButton();
500 void rightMouseButton();
501 void inventoryLeftMouseButton();
502 void inventoryRightMouseButton();
503 void dialogLeftMouseButton(byte *
string,
int dialogSelected);
505 uint32 _dialogDatSize;
509 byte *_dialogBoxAddr[32];
510 byte *_dialogOptAddr[32];
511 int _dialogOptLines[4 * 32];
518 int _dialogLineSpace;
523 void createDialogBox(
int dialogBoxNr);
525 void talkHero(
int slot);
526 void doTalkAnim(
int animNumber,
int slot, AnimType animType);
528 static const uint8 zoomInStep = 8;
529 void initZoomIn(
int slot);
530 void initZoomOut(
int slot);
531 void doZoomIn(
int slot);
532 void doZoomOut(
int slot);
533 void freeZoomObject(
int slot);
535 static const uint8 kFadeStep = 4;
537 void setPalette(
const byte *palette);
542 static const int16 kCurveLen = 17;
543 static const int kCelStep = 4;
550 static const uint16 kPowerBarPosX = 288;
551 static const uint16 kPowerBarPosY = 430;
552 static const uint8 kPowerBarWidth = 64;
553 static const uint8 kPowerBarHeight = 16;
554 static const uint8 kPowerBarBackgroundColor = 0;
555 static const uint16 kPowerBarGreenPosY = 434;
556 static const uint8 kPowerBarGreenColor1 = 202;
557 static const uint8 kPowerBarGreenColor2 = 235;
558 static const uint8 kPowerBarGreenHeight = 8;
562 static const int16 kPathGridStep = 2;
563 static const uint32 kPathBitmapLen = (kMaxPicHeight / kPathGridStep * kMaxPicWidth / kPathGridStep) / 8;
564 static const int32 kTracePts = 8000;
565 static const int32 kPBW = kMaxPicWidth / 16;
566 static const int kMinDistance = 2500;
568 byte *_roomPathBitmap;
569 byte *_roomPathBitmapTemp;
578 bool _traceLineFirstPointFlag;
579 bool _tracePointFirstPointFlag;
580 byte *_directionTable;
583 byte *_checkBitmapTemp;
589 byte *_rembBitmapTemp;
598 int drawLine(
int x0,
int y0,
int x1,
int y1,
int (*plotProc)(
int,
int,
void *),
void *data);
599 bool loadPath(
const char *resourceName);
600 byte *makePath(
int heroId,
int currX,
int currY,
int destX,
int destY);
601 void findPoint(
int x,
int y);
602 int getPixelAddr(byte *pathBitmap,
int x,
int y);
603 static int plotTraceLine(
int x,
int y,
void *data);
604 void specialPlotInside(
int x,
int y);
605 bool tracePath(
int x1,
int y1,
int x2,
int y2);
606 Direction makeDirection(
int x1,
int y1,
int x2,
int y2);
607 void specialPlot(
int x,
int y);
608 void specialPlot2(
int x,
int y);
612 static int plotTracePoint(
int x,
int y,
void *data);
613 void specialPlotInside2(
int x,
int y);
615 void freeDirectionTable();
616 void scanDirections();
617 int scanDirectionsFindNext(byte *coords,
int xDiff,
int yDiff);
620 void moveRunHero(
int heroId,
int x,
int y,
int dir,
bool runHeroFlag);
636 int checkLeftDownDir();
641 int checkLeftUpDir();
642 int checkRightDownDir();
643 int checkRightUpDir();
646 bool playNextFLCFrame();
653 void showAnim(
Anim &anim);
654 void showNormAnims();
655 void setBackAnim(
Anim &backAnim);
656 void showBackAnims();
657 void clearBackAnimList();
658 bool spriteCheck(
int sprWidth,
int sprHeight,
int destX,
int destY);
659 void showSprite(
Graphics::Surface *spriteSurface,
int destX,
int destY,
int destZ);
660 void showSpriteShadow(
Graphics::Surface *shadowSurface,
int destX,
int destY,
int destZ);
665 void makeShadowTable(
int brightness);
666 void pausePrinceEngine(
int fps = kFPS);
668 uint32 getTextWidth(
const char *s);
669 void debugEngine(
const char *s, ...);
681 static const int kMaxSamples = 60;
EngineFeature
Definition: engine.h:253
Definition: savefile.h:54
Definition: detection.h:42
Definition: flic_decoder.h:49
Definition: animation.h:32
Definition: animation.h:30
Definition: atari-cursor.h:38
bool skipThumbnail(Common::SeekableReadStream &in)
Definition: variatxt.h:26
void NORETURN_PRE error(MSVC_PRINTF const char *s,...) GCC_PRINTF(1
Definition: audiostream.h:109
Definition: graphics.h:33
Definition: debugger.h:33
Language
Definition: language.h:45