From c427cd9dcab111dd7f11a5ae96d0e20fd94ddb13 Mon Sep 17 00:00:00 2001 From: Le Philousophe Date: Sat, 6 Apr 2019 12:06:37 +0200 Subject: CRYOMNI3D: Implement level 3 --- engines/cryomni3d/versailles/data.cpp | 21 +- engines/cryomni3d/versailles/dialogs.cpp | 12 +- engines/cryomni3d/versailles/engine.cpp | 44 +- engines/cryomni3d/versailles/engine.h | 57 +- engines/cryomni3d/versailles/logic.cpp | 928 ++++++++++++++++++++++++++++++- 5 files changed, 1025 insertions(+), 37 deletions(-) (limited to 'engines') diff --git a/engines/cryomni3d/versailles/data.cpp b/engines/cryomni3d/versailles/data.cpp index ed29e6c4f4..3b7c577c18 100644 --- a/engines/cryomni3d/versailles/data.cpp +++ b/engines/cryomni3d/versailles/data.cpp @@ -552,30 +552,29 @@ void CryOmni3DEngine_Versailles::initPlacesStates() { SET_PLACE_STATE(14, nullptr, FILTER_EVENT(2, 14), nullptr); } else if (_currentLevel == 3) { _placeStates.resize(25); - // TODO: implement functions SET_PLACE_STATE(1, nullptr, nullptr, "VS35"); SET_PLACE_STATE(2, nullptr, nullptr, "VS40"); - SET_PLACE_STATE(3, nullptr, nullptr, "VS40"); + SET_PLACE_STATE(3, nullptr, FILTER_EVENT(3, 3), "VS40"); SET_PLACE_STATE(4, nullptr, nullptr, "VS36"); SET_PLACE_STATE(5, nullptr, nullptr, "VS36"); SET_PLACE_STATE(6, nullptr, nullptr, "VS30"); SET_PLACE_STATE(7, nullptr, nullptr, "VS30"); SET_PLACE_STATE(8, nullptr, nullptr, "VS30"); SET_PLACE_STATE(9, nullptr, nullptr, "VS39"); - SET_PLACE_STATE(10, nullptr, nullptr, "VS28"); + SET_PLACE_STATE(10, nullptr, FILTER_EVENT(3, 10), "VS28"); SET_PLACE_STATE(11, nullptr, nullptr, "VS28"); SET_PLACE_STATE(12, nullptr, nullptr, "VS30"); - SET_PLACE_STATE(13, nullptr, nullptr, "VS27"); + SET_PLACE_STATE(13, nullptr, FILTER_EVENT(3, 13), "VS27"); SET_PLACE_STATE(14, nullptr, nullptr, "VS26"); - SET_PLACE_STATE(15, nullptr, nullptr, "VS25"); + SET_PLACE_STATE(15, nullptr, FILTER_EVENT(3, 15), "VS25"); SET_PLACE_STATE(16, nullptr, nullptr, "VS24"); - SET_PLACE_STATE(17, nullptr, nullptr, "VS25"); - SET_PLACE_STATE(18, nullptr, nullptr, nullptr); - SET_PLACE_STATE(19, nullptr, nullptr, "VS26"); - SET_PLACE_STATE(20, nullptr, nullptr, nullptr); + SET_PLACE_STATE(17, nullptr, FILTER_EVENT(3, 17), "VS25"); + SET_PLACE_STATE(18, nullptr, FILTER_EVENT(3, 18), nullptr); + SET_PLACE_STATE(19, nullptr, FILTER_EVENT(3, 19), "VS26"); + SET_PLACE_STATE(20, nullptr, FILTER_EVENT(3_5, 20), nullptr); SET_PLACE_STATE(21, nullptr, nullptr, "VS28"); - SET_PLACE_STATE(22, nullptr, nullptr, "VS26"); - SET_PLACE_STATE(23, nullptr, nullptr, nullptr); + SET_PLACE_STATE(22, nullptr, FILTER_EVENT(3, 22), "VS26"); + SET_PLACE_STATE(23, nullptr, FILTER_EVENT(3, 23), nullptr); SET_PLACE_STATE(24, nullptr, nullptr, "VS30"); } else if (_currentLevel == 4) { _placeStates.resize(18); diff --git a/engines/cryomni3d/versailles/dialogs.cpp b/engines/cryomni3d/versailles/dialogs.cpp index ed5921397b..580b56e89d 100644 --- a/engines/cryomni3d/versailles/dialogs.cpp +++ b/engines/cryomni3d/versailles/dialogs.cpp @@ -64,7 +64,7 @@ bool CryOmni3DEngine_Versailles::preprocessDialog(const Common::String &sequence _dialogsMan["CROISSY-ACCEPTE-TEXTE"] == 'Y' && (!_inventory.inInventoryByNameID(121) || !_inventory.inInventoryByNameID(119) || !_inventory.inInventoryByNameID(115) || - _gameVariables[GameVariables::kGotMedaillesSolution] == 0)) { + _gameVariables[GameVariables::kGotMedalsSolution] == 0)) { displayMessageBoxWarp(18); _gameVariables[GameVariables::kWarnedIncomplete] = 1; return 0; @@ -116,18 +116,18 @@ void CryOmni3DEngine_Versailles::postprocessDialog(const Common::String &sequenc if (currentGameTime() == 1 && _dialogsMan["LULLY-DONNE-MISSION1-JOUEUR"] == 'Y') { setGameTime(2, 3); } - if (!_gameVariables[GameVariables::kGotMedaillesSolution] && + if (!_gameVariables[GameVariables::kGotMedalsSolution] && _dialogsMan["MONSIEUR-DONNE-SOLUTION-MEDAILLES"] == 'Y') { playInGameVideo("32M_MR2"); - _gameVariables[GameVariables::kGotMedaillesSolution] = 1; + _gameVariables[GameVariables::kGotMedalsSolution] = 1; } - if (!_gameVariables[GameVariables::kCollectePartition] && + if (!_gameVariables[GameVariables::kDecipherScore] && _dialogsMan["LULLY-DIT-CHAT-PENDU-JOUEUR"] == 'Y') { - _gameVariables[GameVariables::kCollectePartition] = 1; + _gameVariables[GameVariables::kDecipherScore] = 1; collectObject(118); setGameTime(3, 3); } - if (currentGameTime() == 1 && _dialogsMan["CROISSY-ACCEPTE-TEXTE"] == 'Y') { + if (currentGameTime() == 3 && _dialogsMan["CROISSY-ACCEPTE-TEXTE"] == 'Y') { setGameTime(4, 3); } if (_dialogsMan["{LEVEL3_FINI}"] == 'Y') { diff --git a/engines/cryomni3d/versailles/engine.cpp b/engines/cryomni3d/versailles/engine.cpp index 3baaf81458..a227a2676d 100644 --- a/engines/cryomni3d/versailles/engine.cpp +++ b/engines/cryomni3d/versailles/engine.cpp @@ -608,7 +608,7 @@ void CryOmni3DEngine_Versailles::changeLevel(int level) { } // TODO: countdown _inventory.clear(); - } else if (_currentLevel <= 2) { + } else if (_currentLevel <= 3) { // TODO: remove this when we implemented all levels } else { error("New level %d is not implemented (yet)", level); @@ -1190,9 +1190,7 @@ int CryOmni3DEngine_Versailles::handleWarp() { bool CryOmni3DEngine_Versailles::handleWarpMouse(unsigned int *actionId, unsigned int movingCursor) { - PlaceStateActionKey mask = PlaceStateActionKey(_currentPlaceId, _placeStates[_currentPlaceId].state, - *actionId); - *actionId = _actionMasks.getVal(mask, *actionId); + fixActionId(actionId); if (getCurrentMouseButton() == 2 || getNextKey().keycode == Common::KEYCODE_SPACE) { @@ -1240,6 +1238,44 @@ bool CryOmni3DEngine_Versailles::handleWarpMouse(unsigned int *actionId, return false; } +void CryOmni3DEngine_Versailles::fixActionId(unsigned int *actionId) const { + PlaceStateActionKey mask = PlaceStateActionKey(_currentPlaceId, _placeStates[_currentPlaceId].state, + *actionId); + Common::HashMap::const_iterator it = _actionMasks.find(mask); + if (it != _actionMasks.end()) { + *actionId = it->_value; + return; + } + + // Special case for level 3 taking dialogs variables into account + if (_currentLevel == 3) { + if (_dialogsMan["{LE JOUEUR-A-TENTE-OUVRIR-PETITE-PORTE}"] == 'N') { + if (*actionId == 13060) { + *actionId = 23060; + } else if (*actionId == 13100) { + if (currentGameTime() != 4) { + *actionId = 23100; + } + } else if (*actionId == 13130) { + *actionId = 23130; + } else if (*actionId == 13150) { + *actionId = 23150; + } + } else if (_dialogsMan["{JOUEUR-POSSEDE-CLE}"] == 'Y') { + if (*actionId == 13100) { + if (currentGameTime() != 4) { + *actionId = 23100; + } + } else if (*actionId == 13130) { + *actionId = 23130; + } else if (*actionId == 13150) { + *actionId = 23150; + } + + } + } +} + void CryOmni3DEngine_Versailles::animateWarpTransition(const Transition *transition) { double srcAlpha = transition->srcAlpha; double srcBeta = transition->srcBeta; diff --git a/engines/cryomni3d/versailles/engine.h b/engines/cryomni3d/versailles/engine.h index c19976bd27..9d0b7acbd3 100644 --- a/engines/cryomni3d/versailles/engine.h +++ b/engines/cryomni3d/versailles/engine.h @@ -112,15 +112,15 @@ enum AbortCommand { struct GameVariables { enum Var { // TODO: make these enum members more correct - kCollectPartition = 0, // 0 - kUnlockPetitePorte, - kAlreadyCame31, - kDrawerStatus, + kCollectScore = 0, // OK // 0 + kUnlockHiddenDoor, // OK + kAlreadyWent3_19, // OK + kMedalsDrawerStatus, // OK kCurrentTime, // OK - kGotMedaillesSolution, - kDrawerFurnitureStatus, - kCollectePartition, - kCollectPamphletArchi, + kGotMedalsSolution, // OK + kCabinetDrawerStatus, // OK + kDecipherScore, // OK + kCollectLampoonArchitecture, // OK kGotRevealedPaper, // OK kCollectKey, // OK // 10 kCollectPortfolio, // OK @@ -148,7 +148,7 @@ struct GameVariables { kCollectedPaperInTrunk = 33, // OK kBrushColor, // OK kUsedScissors, // OK - kUsedClefsCombles, + kUnlockedAttic, // OK kHasPlayedLebrun, // OK kWarnedIncomplete, kUsedPlanVauban1, @@ -272,6 +272,7 @@ private: const Transition **transition); unsigned int getFakeTransition(unsigned int actionId) const; + void fixActionId(unsigned int *actionId) const; int handleWarp(); bool handleWarpMouse(unsigned int *actionId, unsigned int movingCuror); @@ -437,6 +438,30 @@ private: IMG_CB(41802b); IMG_CB(41802c); IMG_CB(41802d); + IMG_CB(43143); + IMG_CB(43143b); + IMG_CB(43145); + IMG_CB(43145b); + IMG_CB(43145c); + IMG_CB(43146); + IMG_CB(43146b); + IMG_CB(43146c); + IMG_CB(43160); + IMG_CB(43160b); + IMG_CB(43160c); + IMG_CB(43160d); + IMG_CB(43190); + IMG_CB(43190b); + IMG_CB(43190c); + IMG_CB(43190d); + IMG_CB(43190e); + IMG_CB(43190f); + + IMG_CB(88001); + IMG_CB(88001b); + IMG_CB(88001c); + IMG_CB(88004); + IMG_CB(88004b); #undef IMG_CB #define FILTER_EVENT(level, place) bool filterEventLevel ## level ## Place ## place(unsigned int *event) @@ -456,6 +481,20 @@ private: FILTER_EVENT(2, 11); FILTER_EVENT(2, 12); FILTER_EVENT(2, 14); + + FILTER_EVENT(3, 3); + FILTER_EVENT(3, 10); + FILTER_EVENT(3, 13); + FILTER_EVENT(3, 15); + FILTER_EVENT(3, 17); + FILTER_EVENT(3, 18); + FILTER_EVENT(3, 19); + FILTER_EVENT(3_5, 20); + FILTER_EVENT(3, 22); + FILTER_EVENT(3, 23); + bool filterEventLevel3Obj23151(); + void collectLampoonArchitecture(const ZonFixedImage *fimg = nullptr); + #undef FILTER_EVENT #undef INIT_PLACE diff --git a/engines/cryomni3d/versailles/logic.cpp b/engines/cryomni3d/versailles/logic.cpp index 7baba9f43c..2f4555b8f2 100644 --- a/engines/cryomni3d/versailles/logic.cpp +++ b/engines/cryomni3d/versailles/logic.cpp @@ -293,7 +293,7 @@ void CryOmni3DEngine_Versailles::setupImgScripts() { SET_SCRIPT_BY_PAINTING(43140, 34); SET_SCRIPT_BY_PAINTING(43141, 35); SET_SCRIPT_BY_PAINTING(43142, 36); - //SET_SCRIPT_BY_ID(43143); // TODO: implement it + SET_SCRIPT_BY_ID(43143); SET_SCRIPT_BY_PAINTING(43144, 38); SET_SCRIPT_BY_PAINTING(43150, 39); SET_SCRIPT_BY_PAINTING(43151, 40); @@ -329,19 +329,19 @@ void CryOmni3DEngine_Versailles::setupImgScripts() { // From now specific handlers for anything that is not a painting SET_SCRIPT_BY_ID(41801); SET_SCRIPT_BY_ID(41802); - //SET_SCRIPT_BY_ID(43145); // TODO: implement it - //SET_SCRIPT_BY_ID(43146); // TODO: implement it - //SET_SCRIPT_BY_ID(43160); // TODO: implement it - //SET_SCRIPT_BY_ID(43190); // TODO: implement it + SET_SCRIPT_BY_ID(43145); + SET_SCRIPT_BY_ID(43146); + SET_SCRIPT_BY_ID(43160); + SET_SCRIPT_BY_ID(43190); //SET_SCRIPT_BY_ID(44071); // TODO: implement it //SET_SCRIPT_BY_ID(44161); // TODO: implement it //SET_SCRIPT_BY_ID(45130); // TODO: implement it // Almost dumb //SET_SCRIPT_BY_ID(45270); // TODO: implement it //SET_SCRIPT_BY_ID(45280); // TODO: implement it // Almost dumb - //SET_SCRIPT_BY_ID(88001); // TODO: implement it + SET_SCRIPT_BY_ID(88001); //SET_SCRIPT_BY_ID(88002); // TODO: implement it //SET_SCRIPT_BY_ID(88003); // TODO: implement it - //SET_SCRIPT_BY_ID(88004); // TODO: implement it + SET_SCRIPT_BY_ID(88004); #undef SET_SCRIPT_BY_ID } @@ -1187,6 +1187,629 @@ IMG_CB(41802d) { } } +IMG_CB(43143) { + // Lampoon is there: display it + if (!_gameVariables[GameVariables::kCollectLampoonArchitecture] && + (_currentLevel == 5 || currentGameTime() >= 3)) { + ZonFixedImage::CallbackFunctor *functor = + new Common::Functor1Mem(this, + &CryOmni3DEngine_Versailles::img_43143b); + fimg->changeCallback(functor); + return; + } + + fimg->load("30L_31.GIF"); + while (1) { + fimg->manage(); + if (fimg->_exit || fimg->_zoneLow) { + fimg->_exit = true; + break; + } + HANDLE_QUESTION(37); + } +} + +IMG_CB(43143b) { + fimg->load("30L_3101.GIF"); + while (1) { + fimg->manage(); + if (fimg->_exit || fimg->_zoneLow) { + fimg->_exit = true; + break; + } + HANDLE_QUESTION(37); + if (fimg->_zoneUse) { + // Paper is out of reach + displayMessageBox(kFixedimageMsgBoxParameters, fimg->surface(), 16, + fimg->getZoneCenter(fimg->_currentZone), + Common::Functor0Mem(fimg, &ZonFixedImage::manage)); + } else if (fimg->_usedObject && fimg->_usedObject->idOBJ() == 119 && fimg->_currentZone == 0) { + _inventory.removeByNameID(119); + collectLampoonArchitecture(fimg); + // Display without the lampoon + ZonFixedImage::CallbackFunctor *functor = + new Common::Functor1Mem(this, + &CryOmni3DEngine_Versailles::img_43143); + fimg->changeCallback(functor); + break; + } + } +} + +IMG_CB(43145) { + fimg->load("30L_50.GIF"); + while (1) { + fimg->manage(); + if (fimg->_exit || fimg->_zoneLow) { + fimg->_exit = true; + break; + } + if (fimg->_zoneUse) { + if (fimg->_currentZone == 0) { + playInGameVideo("30L_51"); + // Force reload of the place + if (_nextPlaceId == -1u) { + _nextPlaceId = _currentPlaceId; + } + + ZonFixedImage::CallbackFunctor *functor = + new Common::Functor1Mem(this, + &CryOmni3DEngine_Versailles::img_43145b); + fimg->changeCallback(functor); + break; + } else if (fimg->_currentZone == 1) { + playInGameVideo("30L_52"); + // Force reload of the place + if (_nextPlaceId == -1u) { + _nextPlaceId = _currentPlaceId; + } + + ZonFixedImage::CallbackFunctor *functor = + new Common::Functor1Mem(this, + &CryOmni3DEngine_Versailles::img_43145c); + fimg->changeCallback(functor); + break; + } + } + } +} + +IMG_CB(43145b) { + fimg->load("30L_51.GIF"); + while (1) { + fimg->manage(); + if (fimg->_exit) { + break; + } + if (fimg->_zoneLow) { + // Go back to drawer closed + ZonFixedImage::CallbackFunctor *functor = + new Common::Functor1Mem(this, + &CryOmni3DEngine_Versailles::img_43145); + fimg->changeCallback(functor); + break; + } + if (fimg->_zoneUse) { + if (_gameVariables[GameVariables::kCabinetDrawerStatus] == 1) { + // Small key 2 has been put in it and not yet picked by us + collectObject(116, fimg); + _gameVariables[GameVariables::kCabinetDrawerStatus] = 2; + } else { + // Drawer is empty + displayMessageBox(kFixedimageMsgBoxParameters, fimg->surface(), 3, + fimg->getZoneCenter(fimg->_currentZone), + Common::Functor0Mem(fimg, &ZonFixedImage::manage)); + } + } + } +} + +IMG_CB(43145c) { + fimg->load("30L_52.GIF"); + while (1) { + fimg->manage(); + if (fimg->_exit) { + break; + } + if (fimg->_zoneLow) { + // Go back to drawer closed + ZonFixedImage::CallbackFunctor *functor = + new Common::Functor1Mem(this, + &CryOmni3DEngine_Versailles::img_43145); + fimg->changeCallback(functor); + break; + } + if (fimg->_zoneUse) { + // Drawer is empty + displayMessageBox(kFixedimageMsgBoxParameters, fimg->surface(), 3, + fimg->getZoneCenter(fimg->_currentZone), + Common::Functor0Mem(fimg, &ZonFixedImage::manage)); + } + } +} + +IMG_CB(43146) { + fimg->load("30L_40.GIF"); + while (1) { + fimg->manage(); + if (fimg->_exit || fimg->_zoneLow) { + fimg->_exit = true; + break; + } + if (fimg->_zoneUse) { + if (fimg->_currentZone == 0) { + playInGameVideo("30L_41"); + // Force reload of the place + if (_nextPlaceId == -1u) { + _nextPlaceId = _currentPlaceId; + } + + ZonFixedImage::CallbackFunctor *functor = + new Common::Functor1Mem(this, + &CryOmni3DEngine_Versailles::img_43146b); + fimg->changeCallback(functor); + break; + } else if (fimg->_currentZone == 1) { + playInGameVideo("30L_42"); + // Force reload of the place + if (_nextPlaceId == -1u) { + _nextPlaceId = _currentPlaceId; + } + + ZonFixedImage::CallbackFunctor *functor = + new Common::Functor1Mem(this, + &CryOmni3DEngine_Versailles::img_43146c); + fimg->changeCallback(functor); + break; + } + } + } +} + +IMG_CB(43146b) { + fimg->load("30L_41.GIF"); + while (1) { + fimg->manage(); + if (fimg->_exit) { + break; + } + if (fimg->_zoneLow) { + // Go back to drawer closed + ZonFixedImage::CallbackFunctor *functor = + new Common::Functor1Mem(this, + &CryOmni3DEngine_Versailles::img_43146); + fimg->changeCallback(functor); + break; + } + if (fimg->_zoneUse) { + // Drawer is empty + displayMessageBox(kFixedimageMsgBoxParameters, fimg->surface(), 3, + fimg->getZoneCenter(fimg->_currentZone), + Common::Functor0Mem(fimg, &ZonFixedImage::manage)); + } + } +} + +IMG_CB(43146c) { + fimg->load("30L_42.GIF"); + while (1) { + fimg->manage(); + if (fimg->_exit) { + break; + } + if (fimg->_zoneLow) { + // Go back to drawer closed + ZonFixedImage::CallbackFunctor *functor = + new Common::Functor1Mem(this, + &CryOmni3DEngine_Versailles::img_43146); + fimg->changeCallback(functor); + break; + } + if (fimg->_zoneUse) { + // Drawer is empty + displayMessageBox(kFixedimageMsgBoxParameters, fimg->surface(), 3, + fimg->getZoneCenter(fimg->_currentZone), + Common::Functor0Mem(fimg, &ZonFixedImage::manage)); + } + } +} + +IMG_CB(43160) { + // Dispatch to the correct state + bool inInvCharcoal = _inventory.inInventoryByNameID(113); + bool inInvPaper = _inventory.inInventoryByNameID(114); + if (inInvCharcoal && inInvPaper) { + // When everything is collected, state of place change and we shouldn't be able to look at the table + error("BUG: Shouldn't be here"); + } else if (inInvCharcoal && !inInvPaper) { + // Draw table with paper but without charcoal + ZonFixedImage::CallbackFunctor *functor = + new Common::Functor1Mem(this, + &CryOmni3DEngine_Versailles::img_43160b); + fimg->changeCallback(functor); + return; + } else if (!inInvCharcoal && inInvPaper) { + // Draw table with charcoal but without paper + ZonFixedImage::CallbackFunctor *functor = + new Common::Functor1Mem(this, + &CryOmni3DEngine_Versailles::img_43160c); + fimg->changeCallback(functor); + return; + } + + // There we have charcoal and paper on table + fimg->load("31I01.GIF"); + while (1) { + fimg->manage(); + if (fimg->_exit || fimg->_zoneLow) { + fimg->_exit = true; + break; + } + if (fimg->_zoneUse) { + if (fimg->_currentZone == 0) { + // Collected charcoal + collectObject(113, fimg); + // Draw table with paper but without charcoal + ZonFixedImage::CallbackFunctor *functor = + new Common::Functor1Mem(this, + &CryOmni3DEngine_Versailles::img_43160b); + fimg->changeCallback(functor); + break; + } else if (fimg->_currentZone == 1) { + // Collected paper + collectObject(114, fimg); + // Draw table with charcoal but without paper + ZonFixedImage::CallbackFunctor *functor = + new Common::Functor1Mem(this, + &CryOmni3DEngine_Versailles::img_43160c); + fimg->changeCallback(functor); + break; + } + } + } +} + +IMG_CB(43160b) { + // There we have paper on table but without charcoal + fimg->load("31I02.GIF"); + while (1) { + fimg->manage(); + if (fimg->_exit) { + break; + } + if (fimg->_zoneUse) { + // Collected paper + collectObject(114, fimg); + // Draw table empty + ZonFixedImage::CallbackFunctor *functor = + new Common::Functor1Mem(this, + &CryOmni3DEngine_Versailles::img_43160d); + fimg->changeCallback(functor); + break; + } + } +} + +IMG_CB(43160c) { + // There we have charcoal on table but without paper + fimg->load("31I03.GIF"); + while (1) { + fimg->manage(); + if (fimg->_exit) { + break; + } + if (fimg->_zoneUse) { + // Collected charcoal + collectObject(113, fimg); + // Draw table empty + ZonFixedImage::CallbackFunctor *functor = + new Common::Functor1Mem(this, + &CryOmni3DEngine_Versailles::img_43160d); + fimg->changeCallback(functor); + break; + } + } +} + +IMG_CB(43160d) { + // There we have neither charcoal nor paper on table + fimg->load("31I04.GIF"); + setPlaceState(16, 1); + while (1) { + fimg->manage(); + if (fimg->_exit || fimg->_zoneLow) { + fimg->_exit = true; + break; + } + } +} + +IMG_CB(43190) { + fimg->load("31L1_20.GIF"); + if (_gameVariables[GameVariables::kCollectScore]) { + fimg->disableZone(0); + } + while (1) { + fimg->manage(); + if (fimg->_exit || fimg->_zoneLow) { + fimg->_exit = true; + break; + } + if (fimg->_zoneUse) { + playInGameVideo("31L1_2A"); + // Force reload of the place + if (_nextPlaceId == -1u) { + _nextPlaceId = _currentPlaceId; + } + ZonFixedImage::CallbackFunctor *functor = + new Common::Functor1Mem(this, + &CryOmni3DEngine_Versailles::img_43190b); + fimg->changeCallback(functor); + break; + } + } +} + +IMG_CB(43190b) { + fimg->load("31L1_20B.GIF"); + while (1) { + fimg->manage(); + if (fimg->_exit || fimg->_zoneLow) { + fimg->_exit = true; + break; + } + if (fimg->_zoneUse) { + playInGameVideo("31L1_2B"); + // Force reload of the place + if (_nextPlaceId == -1u) { + _nextPlaceId = _currentPlaceId; + } + ZonFixedImage::CallbackFunctor *functor = + new Common::Functor1Mem(this, + &CryOmni3DEngine_Versailles::img_43190c); + fimg->changeCallback(functor); + break; + } + } +} + +IMG_CB(43190c) { + fimg->load("31L1_20C.GIF"); + while (1) { + fimg->manage(); + if (fimg->_exit || fimg->_zoneLow) { + fimg->_exit = true; + break; + } + if (fimg->_zoneUse) { + playInGameVideo("31L1_2C"); + // Force reload of the place + if (_nextPlaceId == -1u) { + _nextPlaceId = _currentPlaceId; + } + ZonFixedImage::CallbackFunctor *functor = + new Common::Functor1Mem(this, + &CryOmni3DEngine_Versailles::img_43190d); + fimg->changeCallback(functor); + break; + } + } +} + +IMG_CB(43190d) { + fimg->load("31L1_20D.GIF"); + while (1) { + fimg->manage(); + if (fimg->_exit || fimg->_zoneLow) { + fimg->_exit = true; + break; + } + if (fimg->_zoneUse) { + playInGameVideo("31L1_2D"); + // Force reload of the place + if (_nextPlaceId == -1u) { + _nextPlaceId = _currentPlaceId; + } + ZonFixedImage::CallbackFunctor *functor = + new Common::Functor1Mem(this, + &CryOmni3DEngine_Versailles::img_43190e); + fimg->changeCallback(functor); + break; + } + } +} + +IMG_CB(43190e) { + fimg->load("31L1_20E.GIF"); + while (1) { + fimg->manage(); + if (fimg->_exit || fimg->_zoneLow) { + fimg->_exit = true; + break; + } + if (fimg->_zoneUse) { + ZonFixedImage::CallbackFunctor *functor = + new Common::Functor1Mem(this, + &CryOmni3DEngine_Versailles::img_43190f); + fimg->changeCallback(functor); + break; + } + } +} + +IMG_CB(43190f) { + fimg->load("31L1_22.GIF"); + while (1) { + fimg->manage(); + if (fimg->_exit) { + break; + } + if (fimg->_zoneUse) { + _gameVariables[GameVariables::kCollectScore] = 1; + collectObject(118, fimg); + fimg->_exit = true; + break; + } + } +} + +IMG_CB(88001) { + if (!_inventory.inInventoryByNameID(121) && + _gameVariables[GameVariables::kMedalsDrawerStatus] == 3) { + ZonFixedImage::CallbackFunctor *functor = + new Common::Functor1Mem(this, + &CryOmni3DEngine_Versailles::img_88001c); + fimg->changeCallback(functor); + return; + } + + fimg->load("33P_10.GIF"); + if (_inventory.inInventoryByNameID(121)) { + fimg->disableZone(0); + } + while (1) { + fimg->manage(); + if (fimg->_exit || fimg->_zoneLow) { + fimg->_exit = true; + break; + } + if (fimg->_zoneUse && + !_inventory.inInventoryByNameID(121)) { + // Open the drawer + + playInGameVideo("33P_10"); + // Force reload of the place + if (_nextPlaceId == -1u) { + _nextPlaceId = _currentPlaceId; + } + + ZonFixedImage::CallbackFunctor *functor = + new Common::Functor1Mem(this, + &CryOmni3DEngine_Versailles::img_88001b); + fimg->changeCallback(functor); + break; + } + } +} + +IMG_CB(88001b) { + _gameVariables[GameVariables::kMedalsDrawerStatus] = 2; + + fimg->load("33P_12.GIF"); + while (1) { + fimg->manage(); + if (fimg->_exit) { + break; + } + if (fimg->_zoneLow) { + _gameVariables[GameVariables::kMedalsDrawerStatus] = 0; + // Go back to drawer closed + ZonFixedImage::CallbackFunctor *functor = + new Common::Functor1Mem(this, + &CryOmni3DEngine_Versailles::img_88001); + fimg->changeCallback(functor); + break; + } + if (fimg->_usedObject && + fimg->_usedObject->idOBJ() == 114 && + fimg->_currentZone == 0) { + // Lay the paper on the medals + _inventory.removeByNameID(114); + + ZonFixedImage::CallbackFunctor *functor = + new Common::Functor1Mem(this, + &CryOmni3DEngine_Versailles::img_88001c); + fimg->changeCallback(functor); + break; + } + } +} + +IMG_CB(88001c) { + // Paper is laid on the medals + _gameVariables[GameVariables::kMedalsDrawerStatus] = 3; + + fimg->load("33P_13.GIF"); + while (1) { + fimg->manage(); + if (fimg->_exit || fimg->_zoneLow) { + fimg->_exit = true; + break; + } + if (fimg->_usedObject && + fimg->_usedObject->idOBJ() == 113 && + fimg->_currentZone == 0) { + // Use charcoal on paper and medals + _inventory.removeByNameID(113); + + playInGameVideo("33P_14"); + // Force reload of the place + if (_nextPlaceId == -1u) { + _nextPlaceId = _currentPlaceId; + } + + collectObject(121, fimg); + _dialogsMan["{JOUEUR-POSSEDE-FUSAIN-MEDAILLES}"] = 'Y'; + + ZonFixedImage::CallbackFunctor *functor = + new Common::Functor1Mem(this, + &CryOmni3DEngine_Versailles::img_88001); + fimg->changeCallback(functor); + break; + } + } +} + +IMG_CB(88004) { + fimg->load("31j31.gif"); + while (1) { + fimg->manage(); + if (fimg->_exit || fimg->_zoneLow) { + fimg->_exit = true; + break; + } + if (fimg->_zoneUse) { + ZonFixedImage::CallbackFunctor *functor = + new Common::Functor1Mem(this, + &CryOmni3DEngine_Versailles::img_88004b); + fimg->changeCallback(functor); + break; + } + } +} + +IMG_CB(88004b) { + // Open the toilets + playInGameVideo("31j32"); + // Force reload of the place + if (_nextPlaceId == -1u) { + _nextPlaceId = _currentPlaceId; + } + fimg->load("31j32.gif"); + while (1) { + fimg->manage(); + if (fimg->_exit || fimg->_zoneLow) { + fimg->_exit = true; + break; + } + if (fimg->_zoneUse) { + ZonFixedImage::CallbackFunctor *functor = + new Common::Functor1Mem(this, + &CryOmni3DEngine_Versailles::img_88004); + fimg->changeCallback(functor); + break; + } + } + if (!shouldQuit()) { + // Close the toilets + playInGameVideo("31j32b"); + // Force reload of the place + if (_nextPlaceId == -1u) { + _nextPlaceId = _currentPlaceId; + } + } +} + #undef IMG_CB // Init place and filter event @@ -1648,6 +2271,297 @@ FILTER_EVENT(2, 14) { return filterEventLevel1Place14(event); } +FILTER_EVENT(3, 3) { + if (*event == 23030 && _inventory.selectedObject() && + _inventory.selectedObject()->idOBJ() == 118 && + _gameVariables[GameVariables::kDecipherScore]) { + _dialogsMan["{JOUEUR-MONTRE-PAMPHLET-DECHIFFRE-PAR-LULLY}"] = 'Y'; + _dialogsMan.play("31X_BON"); + + _forcePaletteUpdate = true; + // Force reload of the place + if (_nextPlaceId == -1u) { + _nextPlaceId = _currentPlaceId; + } + + _dialogsMan["{JOUEUR-MONTRE-PAMPHLET-DECHIFFRE-PAR-LULLY}"] = 'N'; + _inventory.deselectObject(); + } + return true; +} + +FILTER_EVENT(3, 10) { + if (*event == 23101 && _inventory.selectedObject() && + _inventory.selectedObject()->idOBJ() == 120) { + _inventory.removeByNameID(120); + + _dialogsMan["{JOUEUR-MONTRE-AUTORISATION-DE-BONTEMPS}"] = 'Y'; + _dialogsMan.play("31O_SUIP"); + + _forcePaletteUpdate = true; + // Force reload of the place + if (_nextPlaceId == -1u) { + _nextPlaceId = _currentPlaceId; + } + + _dialogsMan["{JOUEUR-MONTRE-AUTORISATION-DE-BONTEMPS}"] = 'N'; + _inventory.deselectObject(); + return true; + } else if (*event == 21) { + if (_dialogsMan["SUISSE-VU-AUTORISATION"] == 'Y') { + fakeTransition(*event); + playInGameVideo("33O_SUIP"); + playInGameVideo("33O_P"); + executeSeeAction(88001); + if (!shouldAbort()) { + playInGameVideo("33P_O"); + } + _forcePaletteUpdate = true; + // Force reload of the place + if (_nextPlaceId == -1u) { + _nextPlaceId = _currentPlaceId; + } + } + // This place is a fake one: so never go in there + return false; + } + return true; +} + +FILTER_EVENT(3, 13) { + _dialogsMan["{JOUEUR-MONTRE-FUSAIN-MEDAILLES}"] = 'N'; + _dialogsMan["{JOUEUR-MONTRE-TOUT-AUTRE-OBJET}"] = 'N'; + if (*event == 33130 && !_inventory.inInventoryByNameID(119)) { + collectObject(119); + if (_placeStates[13].state) { + setPlaceState(13, 3); + } else { + setPlaceState(13, 1); + } + // We handle use here + return false; + } else if (*event == 23131 && _inventory.selectedObject()) { + if (_inventory.selectedObject()->idOBJ() == 121) { + _dialogsMan["{JOUEUR-MONTRE-FUSAIN-MEDAILLES}"] = 'Y'; + } else { + _dialogsMan["{JOUEUR-MONTRE-TOUT-AUTRE-OBJET}"] = 'Y'; + } + _dialogsMan.play("32M_MR"); + + _forcePaletteUpdate = true; + // Force reload of the place + if (_nextPlaceId == -1u) { + _nextPlaceId = _currentPlaceId; + } + + _dialogsMan["{JOUEUR-MONTRE-FUSAIN-MEDAILLES}"] = 'N'; + _dialogsMan["{JOUEUR-MONTRE-TOUT-AUTRE-OBJET}"] = 'N'; + _inventory.deselectObject(); + return true; + } else { + return true; + } +} + +FILTER_EVENT(3, 15) { + if (*event == 23151 && _inventory.selectedObject()) { + return filterEventLevel3Obj23151(); + } + return true; +} + +FILTER_EVENT(3, 17) { + if (*event == 18) { + if (_inventory.selectedObject() && + _inventory.selectedObject()->idOBJ() == 123) { + _gameVariables[GameVariables::kUnlockHiddenDoor] = 1; + _inventory.removeByNameID(123); + return true; + } else if (_gameVariables[GameVariables::kUnlockHiddenDoor] != 1) { + // Locked + displayMessageBoxWarp(1); + _dialogsMan["{LE JOUEUR-A-TENTE-OUVRIR-PETITE-PORTE}"] = 'Y'; + return false; + } else { + return true; + } + } else if (*event == 23151) { + return filterEventLevel3Obj23151(); + } else { + return true; + } +} + +FILTER_EVENT(3, 18) { + if (*event != 19) { + return true; + } + + // Only take care of event 19 + + // Adjust camera + fakeTransition(*event); + // As we have just adjusted camera, don't do it later + _transitionAnimateWarp = false; + + if (_placeStates[22].state) { + playInGameVideo("31J1_L2"); + } else if (_gameVariables[GameVariables::kAlreadyWent3_19]) { + playInGameVideo("31J1_L1"); + } else { + playInGameVideo("31J1_L0"); + playInGameVideo("31L1_AL2"); + playInGameVideo("31L1_AL3"); + _gameVariables[GameVariables::kAlreadyWent3_19] = 1; + _gameVariables[GameVariables::kCabinetDrawerStatus] = 1; + } + + _forcePaletteUpdate = true; + // Force reload of the place + if (_nextPlaceId == -1u) { + _nextPlaceId = _currentPlaceId; + } + return true; +} + +FILTER_EVENT(3, 19) { + if (*event != 18) { + return true; + } + if (currentGameTime() != 3 || _placeStates[22].state) { + return true; + } + + if (_gameVariables[GameVariables::kCollectLampoonArchitecture]) { + setPlaceState(22, 2); + } else { + setPlaceState(22, 1); + } + setPlaceState(19, 1); + + return true; +} + +FILTER_EVENT(3_5, 20) { + if (*event != 25) { + return true; + } + + fakeTransition(*event); + playInGameVideo("31j31"); + + // Force reload of the place + if (_nextPlaceId == -1u) { + _nextPlaceId = _currentPlaceId; + } + + // Toilets + executeSeeAction(88004); + + _forcePaletteUpdate = true; + + return false; +} + +FILTER_EVENT(3, 22) { + if (*event == 33220) { + if (!_gameVariables[GameVariables::kCollectLampoonArchitecture]) { + if (_inventory.selectedObject() && + _inventory.selectedObject()->idOBJ() == 119) { + // Using pool cue + _inventory.removeByNameID(119); + collectLampoonArchitecture(); + _forcePaletteUpdate = true; + } else { + // Paper is out of reach + displayMessageBoxWarp(16); + } + } + // We handle use here + return false; + } + + if (*event >= 20000 && *event < 30000 && + _inventory.selectedObject() && + _inventory.selectedObject()->idOBJ() == 118) { + _dialogsMan["{JOUEUR-PRESENTE-PAMPHLET-PARTITION}"] = 'Y'; + _dialogsMan.play("31L1_LUL"); + + _forcePaletteUpdate = true; + // Force reload of the place + if (_nextPlaceId == -1u) { + _nextPlaceId = _currentPlaceId; + } + + _dialogsMan["{JOUEUR-PRESENTE-PAMPHLET-PARTITION}"] = 'N'; + if (_dialogsMan["LULLY-DONNE-MISSION1-JOUEUR"] != 'Y' || + _gameVariables[GameVariables::kDecipherScore]) { + _inventory.deselectObject(); + } else { + _inventory.removeByNameID(118); + } + } + return true; +} + +FILTER_EVENT(3, 23) { + if (*event != 32) { + return true; + } + + if (_inventory.selectedObject() && + _inventory.selectedObject()->idOBJ() == 140) { + _gameVariables[GameVariables::kUnlockedAttic] = 1; + _inventory.removeByNameID(140); + return true; + } else if (_gameVariables[GameVariables::kUnlockedAttic] != 1) { + // Locked + displayMessageBoxWarp(1); + return false; + } else { + return true; + } +} + +bool CryOmni3DEngine_Versailles::filterEventLevel3Obj23151() { + if (_inventory.selectedObject() && + _inventory.selectedObject()->idOBJ() == 115) { + _dialogsMan["{JOUEUR-MONTRE-PAMPHLET-ARCHITECTURE}"] = 'Y'; + } else if (_inventory.selectedObject() && + _inventory.selectedObject()->idOBJ() == 121 && + _gameVariables[GameVariables::kGotMedalsSolution]) { + _inventory.removeByNameID(121); + _dialogsMan["{JOUEUR-MONTRE-EPIGRAPHE-MEDAILLES}"] = 'Y'; + } else { + _dialogsMan["{JOUEUR-MONTRE-TOUT-AUTRE-CHOSE}"] = 'Y'; + } + + _dialogsMan.play("32J_CRO"); + + _forcePaletteUpdate = true; + // Force reload of the place + if (_nextPlaceId == -1u) { + _nextPlaceId = _currentPlaceId; + } + + _dialogsMan["{JOUEUR-MONTRE-PAMPHLET-ARCHITECTURE}"] = 'N'; + _dialogsMan["{JOUEUR-MONTRE-EPIGRAPHE-MEDAILLES}"] = 'N'; + _dialogsMan["{JOUEUR-MONTRE-TOUT-AUTRE-CHOSE}"] = 'N'; + + _inventory.deselectObject(); + + return true; +} + +void CryOmni3DEngine_Versailles::collectLampoonArchitecture(const ZonFixedImage *fimg) { + _gameVariables[GameVariables::kCollectLampoonArchitecture] = 1; + collectObject(115, fimg); + if (_currentLevel == 3) { + setPlaceState(22, 2); + } + _dialogsMan["{JOUEUR_POSSEDE_PAMPHLET_ARCHI}"] = 'Y'; +} + #undef FILTER_EVENT #undef INIT_PLACE -- cgit v1.2.3