Definition at line 20 of file WorldMap.h.
Public Member Functions | |
WorldMap () | |
virtual | ~WorldMap () |
virtual const char * | getName () const |
void | initMap (const Path &mapfile) |
Read dots postions and level descriptions. | |
virtual void | drawOn (SDL_Surface *screen) |
void | runSelected () |
Start level under pressed button. | |
void | addDesc (const std::string &codename, LevelDesc *desc) |
virtual std::string | findLevelName (const std::string &codename) const |
virtual std::string | findDesc (const std::string &codename) const |
Protected Member Functions | |
virtual void | own_initState () |
Display menu and play menu music. | |
virtual void | own_updateState () |
virtual void | own_pauseState () |
virtual void | own_resumeState () |
Display menu and play menu music. | |
virtual void | own_cleanState () |
Stop music. |
|
Definition at line 35 of file WorldMap.cpp. 00036 { 00037 m_selected = NULL; 00038 m_startNode = NULL; 00039 m_ending = NULL; 00040 prepareBg(); 00041 00042 m_drawer = new NodeDrawer(); 00043 m_descPack = new ResDialogPack(); 00044 m_levelStatus = new LevelStatus(); 00045 takeHandler(new WorldInput(this)); 00046 registerDrawable(m_bg); 00047 registerDrawable(this); 00048 }
|
|
Definition at line 50 of file WorldMap.cpp. 00051 { 00052 if (m_startNode) { 00053 delete m_startNode; 00054 } 00055 if (m_ending) { 00056 delete m_ending; 00057 } 00058 delete m_bg; 00059 m_descPack->removeAll(); 00060 delete m_descPack; 00061 delete m_drawer; 00062 delete m_levelStatus; 00063 }
|
|
|
|
Implements Drawable. Definition at line 260 of file WorldMap.cpp. 00261 { 00262 m_drawer->setScreen(screen); 00263 m_startNode->drawPath(m_drawer); 00264 if (m_selected) { 00265 m_drawer->drawSelected(findLevelName(m_selected->getCodename())); 00266 } 00267 }
|
|
Implements DescFinder. Definition at line 285 of file WorldMap.cpp. 00286 { 00287 std::string result; 00288 const LevelDesc *desc = 00289 dynamic_cast<const LevelDesc*>(m_descPack->findDialogHard(codename)); 00290 if (desc) { 00291 result = desc->getDesc(); 00292 } 00293 else { 00294 result = "???"; 00295 } 00296 return result; 00297 }
|
|
Implements DescFinder. Definition at line 270 of file WorldMap.cpp. 00271 { 00272 std::string result; 00273 const LevelDesc *desc = 00274 dynamic_cast<const LevelDesc*>(m_descPack->findDialogHard(codename)); 00275 if (desc) { 00276 result = desc->getLevelName(); 00277 } 00278 else { 00279 result = codename; 00280 } 00281 return result; 00282 }
|
|
Implements INamed. Definition at line 54 of file WorldMap.h. 00054 { return "state_worldmap"; };
|
|
Read dots postions and level descriptions.
Definition at line 90 of file WorldMap.cpp. 00091 { 00092 WorldBranch parser(NULL); 00093 m_startNode = parser.parseMap(mapfile, &m_ending, m_descPack); 00094 if (NULL == m_startNode) { 00095 throw LogicException(ExInfo("cannot create world map") 00096 .addInfo("file", mapfile.getNative())); 00097 } 00098 }
|
|
Stop music.
Implements GameState. Definition at line 152 of file WorldMap.cpp. 00153 { 00154 SoundAgent::agent()->stopMusic(); 00155 }
|
|
Display menu and play menu music.
Implements GameState. Definition at line 104 of file WorldMap.cpp. 00105 { 00106 m_levelStatus->setRunning(true); 00107 own_resumeState(); 00108 }
|
|
Implements GameState. Definition at line 48 of file WorldMap.h. 00048 {}
|
|
Display menu and play menu music.
Implements GameState. Definition at line 125 of file WorldMap.cpp. 00126 { 00127 if (m_levelStatus->wasRunning()) { 00128 LevelNode *nextLevel = NULL; 00129 if (m_levelStatus->isComplete()) { 00130 markSolved(); 00131 if (checkEnding()) { 00132 nextLevel = m_ending; 00133 } 00134 } 00135 m_selected = nextLevel; 00136 m_levelStatus->setRunning(false); 00137 00138 SoundAgent::agent()->playMusic( 00139 Path::dataReadPath("music/menu.ogg"), NULL); 00140 OptionAgent *options = OptionAgent::agent(); 00141 options->setParam("caption", findDesc("menu")); 00142 options->setParam("screen_width", m_bg->getW()); 00143 options->setParam("screen_height", m_bg->getH()); 00144 VideoAgent::agent()->initVideoMode(); 00145 } 00146 }
|
|
Implements GameState. Definition at line 111 of file WorldMap.cpp. 00112 { 00113 if (m_ending && m_selected == m_ending) { 00114 runSelected(); 00115 } 00116 else { 00117 watchCursor(); 00118 } 00119 }
|
|
Start level under pressed button. Start pedometer when level is solved already. Definition at line 184 of file WorldMap.cpp. 00185 { 00186 Level *level = createSelected(); 00187 if (level && m_selected) { 00188 m_levelStatus->prepareRun(m_selected->getCodename(), 00189 m_selected->getPoster(), 00190 m_selected->getBestMoves(), 00191 m_selected->getBestAuthor()); 00192 level->fillStatus(m_levelStatus); 00193 00194 if (m_selected->getState() == LevelNode::STATE_SOLVED) { 00195 Pedometer *pedometer = new Pedometer(m_levelStatus, level); 00196 pushState(pedometer); 00197 } 00198 else { 00199 pushState(level); 00200 } 00201 } 00202 else { 00203 if (m_activeMask == m_maskIntro) { 00204 runIntro(); 00205 } 00206 else if (m_activeMask == m_maskExit) { 00207 quitState(); 00208 } 00209 else if (m_activeMask == m_maskCredits) { 00210 runCredits(); 00211 } 00212 else if (m_activeMask == m_maskOptions) { 00213 runOptions(); 00214 } 00215 } 00216 }
|