void GameStatePlay::checkCutscene() { if (!mapr->cutscene) return; GameStateCutscene *cutscene = new GameStateCutscene(NULL); if (!cutscene->load(mapr->cutscene_file)) { delete cutscene; mapr->cutscene = false; return; } // handle respawn point and set game play game_slot cutscene->game_slot = save_load->getGameSlot(); if (mapr->teleportation) { if (mapr->teleport_mapname != "") mapr->respawn_map = mapr->teleport_mapname; mapr->respawn_point = mapr->teleport_destination; } else { mapr->respawn_point = floor(pc->stats.pos); } if (SAVE_ONLOAD) save_load->saveGame(); delete requestedGameState; requestedGameState = cutscene; }
GameSwitcher::GameSwitcher() : background(NULL) , background_image(NULL) , background_filename("") , fps_ticks(0) , last_fps(0) { // The initial state is the intro cutscene and then title screen GameStateTitle *title=new GameStateTitle(); GameStateCutscene *intro = new GameStateCutscene(title); currentState = intro; if (!intro->load("cutscenes/intro.txt")) { delete intro; currentState = title; } label_fps = new WidgetLabel(); done = false; loadMusic(); loadFPS(); loadBackgroundList(); if (currentState->has_background) loadBackgroundImage(); }
GameSwitcher::GameSwitcher() { // The initial state is the intro cutscene and then title screen GameStateTitle *title=new GameStateTitle(); GameStateCutscene *intro = new GameStateCutscene(title); currentState = intro; if (!intro->load("cutscenes/intro.txt")) { delete intro; currentState = title; } label_fps = new WidgetLabel(); done = false; loadMusic(); loadFPS(); }
void GameStateTitle::logic() { button_play->enabled = ENABLE_PLAYGAME; snd->logic(FPoint(0,0)); if(inpt->pressing[CANCEL] && !inpt->lock[CANCEL]) { inpt->lock[CANCEL] = true; exitRequested = true; } if (warning_box) { warning_box->logic(); } tablist.logic(); if (button_play->checkClick()) { delete requestedGameState; requestedGameState = new GameStateLoad(); } else if (button_cfg->checkClick()) { delete requestedGameState; requestedGameState = new GameStateConfig(); } else if (button_credits->checkClick()) { GameStateTitle *title = new GameStateTitle(); GameStateCutscene *credits = new GameStateCutscene(title); if (!credits->load("credits.txt")) { delete credits; delete title; } else { delete requestedGameState; requestedGameState = credits; } } else if (button_exit->checkClick()) { exitRequested = true; } }