22 #ifndef CRYOMNI3D_VERSAILLES_ENGINE_H 23 #define CRYOMNI3D_VERSAILLES_ENGINE_H 25 #include "common/events.h" 26 #include "common/random.h" 27 #include "common/array.h" 28 #include "common/hashmap.h" 29 #include "common/hash-str.h" 30 #include "common/str.h" 32 #include "cryomni3d/cryomni3d.h" 33 #include "cryomni3d/omni3d.h" 34 #include "cryomni3d/sprites.h" 35 #include "cryomni3d/wam_parser.h" 37 #include "cryomni3d/versailles/documentation.h" 38 #include "cryomni3d/versailles/toolbar.h" 39 #include "cryomni3d/versailles/dialogs_manager.h" 47 struct FixedImageConfiguration;
52 namespace Versailles {
58 placeId(placeId_), placeState(placeState_), actionId(actionId_) {}
61 return other.placeId == placeId && other.placeState == placeState && other.actionId == actionId;
69 placeId(placeId_), actionId(actionId_) {}
72 return other.placeId == placeId && other.actionId == actionId;
84 return (k.placeId << 24 | k.placeState << 16) ^ k.actionId;
92 return (k.placeId << 16) ^ k.actionId;
98 namespace Versailles {
100 class CryOmni3DEngine_Versailles;
120 kCabinetDrawerStatus,
122 kCollectLampoonArchitecture,
127 kFakeSketchChatState,
130 kStateLampoonReligion,
134 kCollectVaubanBlueprint1,
135 kCollectVaubanBlueprint2,
144 kCollectedPaperOnTable,
147 kCollectedPaperInTrunk = 33,
153 kUsedVaubanBlueprint1,
154 kUsedVaubanBlueprint2,
193 kFileTypeSaveGameVisit,
195 kFileTypeTransSceneI,
209 PlaceState() : initPlace(
nullptr), filterEvent(
nullptr), docImage(
nullptr), state(0) {}
210 PlaceState(InitFunc initPlace_, FilterEventFunc filterEvent_,
const char *docImage_) :
211 initPlace(initPlace_), filterEvent(filterEvent_), docImage(docImage_), state(0) {}
214 FilterEventFunc filterEvent;
215 const char *docImage;
241 uint incrementHeight;
268 void setupPalette(
const byte *colors, uint start, uint num)
override { setupPalette(colors, start, num,
true); }
271 bool displayToolbar(
const Graphics::Surface *original)
override {
return _toolbar.displayToolbar(original); };
272 bool hasPlaceDocumentation()
override;
273 bool displayPlaceDocumentation()
override;
274 uint displayOptions()
override;
275 bool shouldAbort()
override;
280 void loadCursorsPalette();
281 void calculateTransparentMapping();
283 void setupDialogVariables();
284 void setupImgScripts();
285 void loadStaticData();
287 void syncOmni3DSettings();
288 void syncSoundSettings()
override;
290 void playTransitionEndLevel(
int level);
291 void changeLevel(
int level);
292 void initNewLevel(
int level);
293 void setupLevelWarps(
int level);
294 void initPlacesStates();
295 void initWhoSpeaksWhere();
296 void initDocPeopleRecord();
297 void setupLevelActionsMask();
299 uint currentGameTime()
const {
return _gameVariables[GameVariables::kCurrentTime]; }
300 void setGameTime(uint newTime, uint level);
301 void updateGameTimeDialVariables();
306 void setPlaceState(uint placeId, uint newState);
307 void doPlaceChange();
308 void executeTransition(uint nextPlaceId);
309 void fakeTransition(uint dstPlaceId);
310 uint determineTransitionAnimation(uint srcId, uint dstId,
313 uint getFakeTransition(uint actionId)
const;
314 void fixActionId(uint *actionId)
const;
317 bool handleWarpMouse(uint *actionId, uint movingCuror);
318 void animateWarpTransition(
const Transition *transition);
321 void handleFixedImg(
const FixedImgCallback &callback);
322 void executeSeeAction(uint actionId);
324 void executeSpeakAction(uint actionId);
325 void setupDialogShows();
329 void executeDocAction(uint actionId);
338 const Common::Functor0<void> &callback) { displayMessageBox(params, surface, _messages[msg_id], position, callback); }
343 void displayMessageBoxWarp(uint msg_id) { displayMessageBoxWarp(_messages[msg_id]); }
344 void displayCredits();
348 bool canVisit()
const;
351 void saveGame(
bool visit, uint saveNum,
const Common::String &saveName);
352 bool loadGame(
bool visit, uint saveNum);
354 void animateCursor(
const Object *
object);
356 bool showObject =
true);
357 void collectObject(uint nameID,
const ZonFixedImage *fimg =
nullptr,
358 bool showObject =
true) { collectObject(_objects.findObjectByNameID(nameID), fimg, showObject); }
360 void displayObject(
const Common::String &imgName, DisplayObjectHook hook =
nullptr);
362 void setMainPaletteColor(byte color, byte red, byte green, byte blue);
363 void setupPalette(
const byte *colors, uint start, uint num,
bool commit);
365 bool showSubtitles()
const;
368 playInGameVideo(getFilePath(kFileTypeAnimacti, filename));
370 void playInGameVideo(
const Common::Path &filename,
bool restoreCursorPalette =
true);
375 uint getMusicId(uint level, uint placeId)
const;
376 bool musicWouldChange(uint level, uint placeId)
const;
381 void musicSetQuiet(
bool quiet);
385 static const uint kSpritesMapTable[];
386 static const uint kSpritesMapTableSize;
395 byte *_cursorPalette;
397 bool _forcePaletteUpdate;
398 bool _forceRedrawWarp;
400 byte *_transparentPaletteMap;
401 uint _transparentSrcStart;
402 uint _transparentSrcStop;
403 uint _transparentDstStart;
404 uint _transparentDstStop;
405 uint _transparentNewStart;
406 uint _transparentNewStop;
410 AbortCommand _abortCommand;
426 bool _transitionAnimateWarp;
429 uint _currentPlaceId;
430 const Place *_currentPlace;
433 const char *_musicCurrentFile;
435 float _musicVolumeFactor;
436 static const char *kMusicFiles[8][8];
445 void initCountdown();
446 void syncCountdown();
447 inline bool countDown() {
if (_countingDown) {
return doCountDown(); }
else {
return false; } }
448 inline void drawCountdown(
Graphics::ManagedSurface *surface =
nullptr) {
if (_countingDown) { doDrawCountdown(surface); } }
449 void drawCountdownVideo(uint frameNum) { drawCountdown(); }
452 uint _countdownNextEvent;
453 char _countdownValue[6];
462 void drawVideoSubtitles(uint frameNum);
466 void genericDisplayObject();
485 #define IMG_CB(name) void img_ ## name(ZonFixedImage *fimg) 516 static const uint kSafeDigitsCount = 12;
517 static const uint16 kSafeDigitsX[];
518 static const uint16 kSafeDigitsY[];
519 static const char *kSafeDates[];
522 const unsigned char (&safeDigits)[kSafeDigitsCount]);
523 bool checkSafeDigits(
unsigned char (&safeDigits)[kSafeDigitsCount]);
560 static const uint kEpigraphMaxLetters = 32;
585 static const uint kBombPasswordSmallLength = 40;
586 static const uint kBombPasswordMaxLength = 60;
587 static const uint16 kBombLettersPos[2][kBombPasswordMaxLength][2];
591 const uint bombPasswordLength,
592 const uint32(&bombPossibilites)[kBombPasswordMaxLength][5],
593 const byte(&bombCurrentLetters)[kBombPasswordMaxLength]);
598 #define FILTER_EVENT(level, place) bool filterEventLevel ## level ## Place ## place(uint *event) 599 #define INIT_PLACE(level, place) void initPlaceLevel ## level ## Place ## place() 623 FILTER_EVENT(3_5, 20);
626 bool filterEventLevel3Obj23151();
627 void collectLampoonArchitecture(
const ZonFixedImage *fimg =
nullptr);
631 FILTER_EVENT(4, 12_13_14);
641 void filterEventLevel5UpdatePlaceStates();
652 FILTER_EVENT(6, Orangery);
657 FILTER_EVENT(7, 10_11_13);
663 void dialogShowBontempsShowThird();
664 void dialogShowHuissierShowPamphlet();
665 void dialogShowMonseigneurSorts();
666 void dialogShowLeBrunWatches();
667 void dialogShowDoorsOpen();
668 void dialogShowSwissGuardGives();
669 void dialogShowLullyCorrects();
670 void dialogShowBontempsGivesAuth();
671 void dialogShowCroissyLeave();
672 void dialogShowMaintenonGives();
673 void dialogShowLaChaizeGivesBack();
674 void dialogShowLaChaizeWrites();
675 void dialogShowLaChaizeGivesPamphlet();
676 void dialogShowBontempsGivesKey();
677 void dialogShowDuMaineLeaves();
678 void dialogShowTransitionScene();
679 void dialogShowEndOfGame();
680 void dialogShowLeBrunGives();
681 void dialogShowLeBrunLeave();
Definition: managed_surface.h:51
Definition: fixed_image.h:36
Definition: image_decoder.h:52
Definition: dialogs_manager.h:38
Definition: cryomni3d.h:62
EngineFeature
Definition: engine.h:253
Definition: wam_parser.h:53
Definition: documentation.h:39
const T * const_iterator
Definition: array.h:55
Definition: detection.h:48
Definition: cryomni3d.h:80
Definition: wam_parser.h:43
Definition: algorithm.h:29
Definition: formatinfo.h:28
Definition: fixed_image.h:51
Definition: wam_parser.h:66