Commit 3c6d873fe5584c41a0038758e52ecca843c1e182
- Diff rendering mode:
- inline
- side by side
src/engine.cpp
(5 / 4)
|   | |||
| 97 | 97 | particleEngine->setMap(newMap); | |
| 98 | 98 | viewport->setMap(newMap); | |
| 99 | 99 | ||
| 100 | delete mCurrentMap; | ||
| 101 | mCurrentMap = newMap; | ||
| 102 | |||
| 103 | Net::getGameHandler()->mapLoaded(mapPath); | ||
| 104 | |||
| 100 | 105 | // Initialize map-based particle effects | |
| 101 | 106 | if (newMap) | |
| 102 | 107 | newMap->initializeParticleEffects(particleEngine); | |
| … | … | ||
| 112 | 112 | if (newMusic != oldMusic) | |
| 113 | 113 | sound.playMusic(newMusic); | |
| 114 | 114 | ||
| 115 | delete mCurrentMap; | ||
| 116 | mCurrentMap = newMap; | ||
| 117 | |||
| 118 | Net::getGameHandler()->mapLoaded(mapPath); | ||
| 119 | 115 | return true; | |
| 120 | 116 | } | |
| 121 | 117 |
src/game.cpp
(52 / 45)
|   | |||
| 212 | 212 | } | |
| 213 | 213 | ||
| 214 | 214 | /** | |
| 215 | * Initialize every game sub-engines in the right order | ||
| 216 | */ | ||
| 217 | static void initEngines() | ||
| 218 | { | ||
| 219 | engine = new Engine; | ||
| 220 | |||
| 221 | beingManager = new BeingManager; | ||
| 222 | commandHandler = new CommandHandler; | ||
| 223 | floorItemManager = new FloorItemManager; | ||
| 224 | channelManager = new ChannelManager; | ||
| 225 | effectManager = new EffectManager; | ||
| 226 | |||
| 227 | particleEngine = new Particle(NULL); | ||
| 228 | particleEngine->setupEngine(); | ||
| 229 | } | ||
| 230 | |||
| 231 | /** | ||
| 215 | 232 | * Create all the various globally accessible gui windows | |
| 216 | 233 | */ | |
| 217 | 234 | static void createGuiWindows() | |
| … | … | ||
| 318 | 318 | { | |
| 319 | 319 | done = false; | |
| 320 | 320 | ||
| 321 | createGuiWindows(); | ||
| 321 | createGuiWindows(); | ||
| 322 | 322 | ||
| 323 | mWindowMenu = new WindowMenu; | ||
| 324 | windowContainer->add(mWindowMenu); | ||
| 323 | mWindowMenu = new WindowMenu; | ||
| 324 | windowContainer->add(mWindowMenu); | ||
| 325 | 325 | ||
| 326 | engine = new Engine; | ||
| 326 | initEngines(); | ||
| 327 | 327 | ||
| 328 | beingManager = new BeingManager; | ||
| 329 | commandHandler = new CommandHandler; | ||
| 330 | floorItemManager = new FloorItemManager; | ||
| 331 | channelManager = new ChannelManager; | ||
| 332 | effectManager = new EffectManager; | ||
| 328 | // Initialize logic and seconds counters | ||
| 329 | tick_time = 0; | ||
| 330 | mLogicCounterId = SDL_AddTimer(MILLISECONDS_IN_A_TICK, nextTick, NULL); | ||
| 331 | mSecondsCounterId = SDL_AddTimer(1000, nextSecond, NULL); | ||
| 333 | 332 | ||
| 334 | particleEngine = new Particle(NULL); | ||
| 335 | particleEngine->setupEngine(); | ||
| 333 | // This part is eAthena specific | ||
| 334 | // For TMWserv, the map is obtained | ||
| 335 | // with the GPMSG_PLAYER_MAP_CHANGE flag. | ||
| 336 | map_path = map_path.substr(0, map_path.rfind(".")); | ||
| 337 | if (!map_path.empty()) | ||
| 338 | engine->changeMap(map_path); | ||
| 336 | 339 | ||
| 337 | // Initialize logic and seconds counters | ||
| 338 | tick_time = 0; | ||
| 339 | mLogicCounterId = SDL_AddTimer(MILLISECONDS_IN_A_TICK, nextTick, NULL); | ||
| 340 | mSecondsCounterId = SDL_AddTimer(1000, nextSecond, NULL); | ||
| 340 | // Initialize beings | ||
| 341 | beingManager->setPlayer(player_node); | ||
| 341 | 342 | ||
| 342 | // Initialize frame limiting | ||
| 343 | config.addListener("fpslimit", this); | ||
| 344 | optionChanged("fpslimit"); | ||
| 343 | /* | ||
| 344 | * To prevent the server from sending data before the client | ||
| 345 | * has initialized, I've modified it to wait for a "ping" | ||
| 346 | * from the client to complete its initialization | ||
| 347 | * | ||
| 348 | * Note: This only affects the latest eAthena version. This | ||
| 349 | * packet is handled by the older version, but its response | ||
| 350 | * is ignored by the client | ||
| 351 | */ | ||
| 352 | Net::getGameHandler()->ping(tick_time); | ||
| 345 | 353 | ||
| 346 | // Initialize beings | ||
| 347 | beingManager->setPlayer(player_node); | ||
| 354 | // Initialize frame limiting | ||
| 355 | config.addListener("fpslimit", this); | ||
| 356 | optionChanged("fpslimit"); | ||
| 348 | 357 | ||
| 349 | Joystick::init(); | ||
| 350 | // TODO: The user should be able to choose which one to use | ||
| 351 | // Open the first device | ||
| 352 | if (Joystick::getNumberOfJoysticks() > 0) | ||
| 353 | joystick = new Joystick(0); | ||
| 358 | Joystick::init(); | ||
| 359 | // TODO: The user should be able to choose which one to use | ||
| 360 | // Open the first device | ||
| 361 | if (Joystick::getNumberOfJoysticks() > 0) | ||
| 362 | joystick = new Joystick(0); | ||
| 354 | 363 | ||
| 355 | // fade out logon-music here too to give the desired effect of "flowing" | ||
| 356 | // into the game. | ||
| 357 | sound.fadeOutMusic(1000); | ||
| 358 | map_path = map_path.substr(0, map_path.rfind(".")); | ||
| 359 | |||
| 360 | if (!map_path.empty()) | ||
| 361 | engine->changeMap(map_path); | ||
| 362 | |||
| 363 | setupWindow->setInGame(true); | ||
| 364 | |||
| 365 | /* | ||
| 366 | * To prevent the server from sending data before the client | ||
| 367 | * has initialized, I've modified it to wait for a "ping" | ||
| 368 | * from the client to complete its initialization | ||
| 369 | * | ||
| 370 | * Note: This only affects the latest eAthena version. This | ||
| 371 | * packet is handled by the older version, but its response | ||
| 372 | * is ignored by the client | ||
| 373 | */ | ||
| 374 | Net::getGameHandler()->ping(tick_time); | ||
| 364 | setupWindow->setInGame(true); | ||
| 375 | 365 | } | |
| 376 | 366 | ||
| 377 | 367 | Game::~Game() |
src/main.cpp
(8 / 5)
|   | |||
| 1092 | 1092 | ||
| 1093 | 1093 | case STATE_CONNECT_GAME: | |
| 1094 | 1094 | logger->log("State: CONNECT GAME"); | |
| 1095 | |||
| 1096 | // Allow any alpha opacity | ||
| 1097 | SkinLoader::instance()->setMinimumOpacity(-1.0f); | ||
| 1098 | |||
| 1099 | // Fade out logon-music here too to give the desired effect | ||
| 1100 | // of "flowing" into the game. | ||
| 1101 | sound.fadeOutMusic(1000); | ||
| 1102 | |||
| 1095 | 1103 | Net::getGameHandler()->connect(); | |
| 1096 | 1104 | currentDialog = new ConnectionDialog(STATE_SWITCH_CHARACTER); | |
| 1097 | 1105 | break; | |
| … | … | ||
| 1110 | 1110 | config.setValue("lastCharacter", player_node->getName()); | |
| 1111 | 1111 | ||
| 1112 | 1112 | Net::getGameHandler()->inGame(); | |
| 1113 | |||
| 1114 | // Allow any alpha opacity | ||
| 1115 | SkinLoader::instance()->setMinimumOpacity(-1.0f); | ||
| 1116 | |||
| 1117 | sound.fadeOutMusic(1000); | ||
| 1118 | 1113 | ||
| 1119 | 1114 | delete setupButton; | |
| 1120 | 1115 | delete desktop; |

