// --- void SabreWulfScene::initialize () { setMap (__SABREWULFMAP__); QGAMES::Scene::initialize (); setMazePlaceNumber (__FIRSTMAZEPLACE__); // The basic data... _locations = Locations (); // ...and the buffer... _allLocations.clear (); _allLocations.resize (__NUMBEROFMAZEPLACES__); for (int i = 0; i < __NUMBEROFMAZEPLACES__; i++) _allLocations [i] = Locations (); }
// --- SabreWulfScene::SabreWulfScene (const QGAMES::Maps& m, const QGAMES::Scene::Connections& cn, const QGAMES::SceneProperties& p, const QGAMES::EntitiesPerLayer& ePL) : QGAMES::Scene (__SABREWULFSCENE__, m, cn, p, ePL), _mazePlaceNumber (__FIRSTMAZEPLACE__), _locations (), _allLocations (), _add (), _addTp() // --- #ifndef NDEBUG ,_onOffDrawLimits (true) #endif // --- { _allLocations.resize (__NUMBEROFMAZEPLACES__); for (int i = 0; i < __NUMBEROFMAZEPLACES__; i++) _allLocations [i] = Locations (); _add.resize (4); _addTp.resize (4); _add [0] = 1; _addTp [0] = SabreWulfScene::Location::ExitType::_RIGHTE; _add [1] = __NUMBEROFMAZEPLACESX__; _addTp [1] = SabreWulfScene::Location::_DOWNE; _add [2] = -1; _addTp [2] = SabreWulfScene::Location::_LEFTE; _add [3] = -__NUMBEROFMAZEPLACESX__; _addTp [3] = SabreWulfScene::Location::_UPE; }
/*virtual*/ AssetLocatorMemoryImpl::Locations AssetLocatorMemoryImpl::getFilepath( AssetTag* pAssetTag ) const { LocationsOfAsset::const_iterator it = mAssetLocations.find( pAssetTag ); if (mAssetLocations.end() != it) return it->second; return Locations(); }
// --- const SabreWulfScene::Locations& SabreWulfScene::calculateLocations (int mP) { // Try to get first the locations from the buffer... if (!_allLocations [mP].empty ()) return (_allLocations [mP]); // Once the maze has been set... // It is necessary to calculate what we call "the movement paths" // which are the places where the user moves throught // Every place can the player is in can be either a "PASS" or a "DECIDE" or an "EXIT" place. // If it is a "DECIDE" place it means the plyer can decide to change // the movement direction to other places... // In an "EXIT" place the connection with the next room happens _allLocations [mP] = Locations (); // Clear... std::vector <QGAMES::Rectangle> places = ((SabreWulfMazePlace*) _activeMap) -> spaces (mP); for (int i = 0; i < (int) places.size (); i ++) { Location nLoc; nLoc._id = i; nLoc._zone = places [i]; nLoc._type = Location::_ISOLATE; if (!_allLocations [mP].empty ()) { for (int j = (i - 1); j >= 0; j--) { Location loc = _allLocations [mP][j]; int jP = joinPositionBetween (nLoc, loc); if (jP != 0) // There is a join possibility... { // 0: left, 1: up, 2: right, 3: down if (jP & 8) // Left...and the other one by the right (as a consequence) { nLoc._conexions [0] = loc._id; loc._conexions [2] = nLoc._id; } if (jP & 4) // Up...and the other one by the down part (as a consequence) { nLoc._conexions [1] = loc._id; loc._conexions [3] = nLoc._id; } if (jP & 2) // Right...and the other one by the left part (as a consequence) { nLoc._conexions [2] = loc._id; loc._conexions [0] = nLoc._id; } if (jP & 1) // Down...and the other one by the up part (as a consequence) { nLoc._conexions [3] = loc._id; loc._conexions [1] = nLoc._id; } // Other values mean no connection exists! // One link allowed! // The old location has to be also rectified! _allLocations [mP][j] = loc; } } } _allLocations [mP][nLoc._id] = nLoc; } // Real "exist ways" are those one with the corners out the playing zone... for (int i = 0; i < (int) _allLocations [mP].size (); i++) { Location loc = _allLocations [mP][i]; // Type of exit location... if (loc._zone.pos1 ().posX () >= __BD (__MAPORIGINX__ + (__ORIGINALMAPINITX__ * __XSCALE__)) && loc._zone.pos1 ().posY () >= __BD (__MAPORIGINY__ + (__ORIGINALMAPINITY__ * __YSCALE__)) && loc._zone.pos2 ().posX () <= __BD (__MAPORIGINX__ + (__ORIGINALMAPLENGTH__ * __XSCALE__)) && loc._zone.pos2 ().posY () <= __BD (__MAPORIGINY__ + ((__ORIGINALMAPHEIGHT__ + __ORIGINALMAPINITY__) * __YSCALE__))) loc._type = Location::_DECIDE; else loc._type = Location::_EXIT; // If it is an exit...wich type? if (loc._type == Location::_EXIT) { if (loc._zone.pos1 ().posX () <= __BD __MAPORIGINX__) loc._exitType = Location::_LEFTE; if (loc._zone.pos1 ().posY () <= __BD (__MAPORIGINY__ + (__ORIGINALMAPINITY__ * __YSCALE__))) loc._exitType = Location::_UPE; if (loc._zone.pos2 ().posX () >= __BD (__MAPORIGINX__ + (__ORIGINALMAPLENGTH__ * __XSCALE__))) loc._exitType = Location::_RIGHTE; if (loc._zone.pos2 ().posY () >= __BD (__MAPORIGINY__ + ((__ORIGINALMAPHEIGHT__ + __ORIGINALMAPINITY__) * __YSCALE__))) loc._exitType = Location::_DOWNE; } _allLocations [mP][i] = loc; } return (_allLocations [mP]); }
/// /// addLocations stores line and page numbers of string /// location to location vector. /// void Word::addLocations(int line, int page) { locVec.push_back(Locations(line, page)); }