Moved scene to load out of CMainDialog
parent
fc8d8cb9d4
commit
ea7bfdefda
|
@ -65,7 +65,7 @@ void CController::StartApp()
|
|||
|
||||
void CController::StartGame(LevelCategory cat, int chap, int lvl)
|
||||
{
|
||||
m_dialog->SetLevel(cat, chap, lvl);
|
||||
m_main->SetLevel(cat, chap, lvl);
|
||||
m_main->ChangePhase(PHASE_LOADING);
|
||||
}
|
||||
|
||||
|
|
|
@ -469,18 +469,13 @@ void CPlayerProfile::SaveScene(std::string dir, std::string info)
|
|||
CResourceManager::CreateDirectory(dir);
|
||||
}
|
||||
|
||||
std::string savegameFileName = dir + "/data.sav";
|
||||
std::string fileCBot = CResourceManager::GetSaveLocation() + "/" + dir + "/cbot.run";
|
||||
CRobotMain::GetInstancePointer()->IOWriteScene(savegameFileName.c_str(), fileCBot.c_str(), const_cast<char*>(info.c_str()));
|
||||
CRobotMain::GetInstancePointer()->IOWriteScene(dir + "/data.sav", dir + "/cbot.run", const_cast<char*>(info.c_str()));
|
||||
CRobotMain::GetInstancePointer()->MakeSaveScreenshot(dir + "/screen.png");
|
||||
}
|
||||
|
||||
void CPlayerProfile::LoadScene(std::string dir)
|
||||
{
|
||||
std::string savegameFileName = dir + "/data.sav";
|
||||
std::string fileCbot = CResourceManager::GetSaveLocation() + "/" + dir + "/cbot.run";
|
||||
|
||||
CLevelParser levelParser(savegameFileName);
|
||||
CLevelParser levelParser(dir + "/data.sav");
|
||||
levelParser.Load();
|
||||
|
||||
LevelCategory cat;
|
||||
|
@ -522,7 +517,8 @@ void CPlayerProfile::LoadScene(std::string dir)
|
|||
}
|
||||
|
||||
CRobotMain::GetInstancePointer()->SetLevel(cat, chap, rank);
|
||||
CRobotMain::GetInstancePointer()->IOReadScene(savegameFileName.c_str(), fileCbot.c_str());
|
||||
CRobotMain::GetInstancePointer()->SetReadScene(dir);
|
||||
CRobotMain::GetInstancePointer()->ChangePhase(PHASE_LOADING);
|
||||
}
|
||||
|
||||
bool CPlayerProfile::DeleteScene(std::string dir)
|
||||
|
|
|
@ -164,6 +164,11 @@ CRobotMain::CRobotMain(CController* controller)
|
|||
m_gameTime = 0.0f;
|
||||
m_gameTimeAbsolute = 0.0f;
|
||||
|
||||
m_levelCategory = LevelCategory::Exercises;
|
||||
m_levelChap = 0;
|
||||
m_levelRank = 0;
|
||||
m_sceneReadPath = "";
|
||||
|
||||
m_missionTimerEnabled = false;
|
||||
m_missionTimerStarted = false;
|
||||
m_missionTimer = 0.0f;
|
||||
|
@ -435,19 +440,13 @@ void CRobotMain::ChangePhase(Phase phase)
|
|||
|
||||
if (m_gameTime > 10.0f) // did you play at least 10 seconds?
|
||||
{
|
||||
LevelCategory cat = m_dialog->GetLevelCategory();
|
||||
int chap = m_dialog->GetLevelChap();
|
||||
int rank = m_dialog->GetLevelRank();
|
||||
m_playerProfile->IncrementLevelTryCount(cat, chap, rank);
|
||||
m_playerProfile->IncrementLevelTryCount(m_levelCategory, m_levelChap, m_levelRank);
|
||||
}
|
||||
}
|
||||
|
||||
if (phase == PHASE_WIN) // wins a simulation?
|
||||
{
|
||||
LevelCategory cat = m_dialog->GetLevelCategory();
|
||||
int chap = m_dialog->GetLevelChap();
|
||||
int rank = m_dialog->GetLevelRank();
|
||||
m_playerProfile->SetLevelPassed(cat, chap, rank, true);
|
||||
m_playerProfile->SetLevelPassed(m_levelCategory, m_levelChap, m_levelRank, true);
|
||||
m_dialog->NextMission(); // passes to the next mission
|
||||
}
|
||||
|
||||
|
@ -549,7 +548,7 @@ void CRobotMain::ChangePhase(Phase phase)
|
|||
|
||||
m_app->SetLowCPU(false); // high CPU for simulation
|
||||
|
||||
bool loading = (m_dialog->GetSceneRead()[0] != 0);
|
||||
bool loading = !m_sceneReadPath.empty();
|
||||
|
||||
m_map->CreateMap();
|
||||
|
||||
|
@ -586,7 +585,7 @@ void CRobotMain::ChangePhase(Phase phase)
|
|||
else
|
||||
{
|
||||
m_winTerminate = (m_endingWinRank == 904);
|
||||
m_dialog->SetLevel(LevelCategory::Win, 0, m_endingWinRank);
|
||||
SetLevel(LevelCategory::Win, 0, m_endingWinRank);
|
||||
try
|
||||
{
|
||||
CreateScene(false, true, false); // sets scene
|
||||
|
@ -632,7 +631,7 @@ void CRobotMain::ChangePhase(Phase phase)
|
|||
else
|
||||
{
|
||||
m_winTerminate = false;
|
||||
m_dialog->SetLevel(LevelCategory::Lost, 0, m_endingLostRank);
|
||||
SetLevel(LevelCategory::Lost, 0, m_endingLostRank);
|
||||
try
|
||||
{
|
||||
CreateScene(false, true, false); // sets scene
|
||||
|
@ -2579,10 +2578,9 @@ bool CRobotMain::EventFrame(const Event &event)
|
|||
|
||||
if (m_pause->GetPause() == PAUSE_NONE && m_autosave && m_gameTimeAbsolute >= m_autosaveLast+(m_autosaveInterval*60) && m_phase == PHASE_SIMUL)
|
||||
{
|
||||
LevelCategory cat = m_dialog->GetLevelCategory();
|
||||
if (cat == LevelCategory::Missions ||
|
||||
cat == LevelCategory::FreeGame ||
|
||||
cat == LevelCategory::CustomLevels )
|
||||
if (m_levelCategory == LevelCategory::Missions ||
|
||||
m_levelCategory == LevelCategory::FreeGame ||
|
||||
m_levelCategory == LevelCategory::CustomLevels )
|
||||
{
|
||||
m_autosaveLast = m_gameTimeAbsolute;
|
||||
Autosave();
|
||||
|
@ -2821,7 +2819,7 @@ void CRobotMain::ScenePerso()
|
|||
m_lightMan->FlushLights();
|
||||
m_particle->FlushParticle();
|
||||
|
||||
m_dialog->SetLevel(LevelCategory::Perso, 0, 0);
|
||||
SetLevel(LevelCategory::Perso, 0, 0);
|
||||
try
|
||||
{
|
||||
CreateScene(false, true, false); // sets scene
|
||||
|
@ -2848,12 +2846,6 @@ void CRobotMain::ScenePerso()
|
|||
//! Creates the whole scene
|
||||
void CRobotMain::CreateScene(bool soluce, bool fixScene, bool resetObject)
|
||||
{
|
||||
LevelCategory category = m_dialog->GetLevelCategory();
|
||||
int chap = m_dialog->GetLevelChap();
|
||||
int rank = m_dialog->GetLevelRank();
|
||||
const char* read = m_dialog->GetSceneRead().c_str();
|
||||
const char* stack = m_dialog->GetStackRead().c_str();
|
||||
|
||||
m_fixScene = fixScene;
|
||||
|
||||
m_base = nullptr;
|
||||
|
@ -2929,8 +2921,8 @@ void CRobotMain::CreateScene(bool soluce, bool fixScene, bool resetObject)
|
|||
m_engine->SetSecondTexture("");
|
||||
m_engine->SetForegroundName("");
|
||||
|
||||
m_dialog->BuildResumeName(m_title, GetLevelCategoryDir(category), chap, rank);
|
||||
m_dialog->BuildResumeName(m_resume, GetLevelCategoryDir(category), chap, rank);
|
||||
sprintf(m_title, "%s %d.%d", GetLevelCategoryDir(m_levelCategory).c_str(), m_levelChap, m_levelRank);
|
||||
sprintf(m_resume, "%s %d.%d", GetLevelCategoryDir(m_levelCategory).c_str(), m_levelChap, m_levelRank);
|
||||
std::string scriptNameStr;
|
||||
GetResource(RES_TEXT, RT_SCRIPT_NEW, scriptNameStr);
|
||||
strcpy(m_scriptName, scriptNameStr.c_str());
|
||||
|
@ -2952,7 +2944,7 @@ void CRobotMain::CreateScene(bool soluce, bool fixScene, bool resetObject)
|
|||
|
||||
try
|
||||
{
|
||||
CLevelParser levelParser(category, chap, rank);
|
||||
CLevelParser levelParser(m_levelCategory, m_levelChap, m_levelRank);
|
||||
levelParser.Load();
|
||||
|
||||
int rankObj = 0;
|
||||
|
@ -3439,13 +3431,13 @@ void CRobotMain::CreateScene(bool soluce, bool fixScene, bool resetObject)
|
|||
if(!resetObject)
|
||||
ChangeColor(); // changes the colors of texture
|
||||
|
||||
if (read[0] != 0) // loading file ?
|
||||
sel = IOReadSceneObjects(read, stack);
|
||||
if (!m_sceneReadPath.empty()) // loading file ?
|
||||
sel = IOReadScene(m_sceneReadPath + "/data.sav", m_sceneReadPath + "/cbot.run");
|
||||
|
||||
continue;
|
||||
}
|
||||
|
||||
if (line->GetCommand() == "LevelController" && read[0] == 0)
|
||||
if (line->GetCommand() == "LevelController" && m_sceneReadPath.empty())
|
||||
{
|
||||
m_controller = m_objMan->CreateObject(Math::Vector(0.0f, 0.0f, 0.0f), 0.0f, OBJECT_CONTROLLER, 100.0f);
|
||||
m_controller->SetMagnifyDamage(100.0f);
|
||||
|
@ -3464,7 +3456,7 @@ void CRobotMain::CreateScene(bool soluce, bool fixScene, bool resetObject)
|
|||
continue;
|
||||
}
|
||||
|
||||
if (line->GetCommand() == "CreateObject" && read[0] == 0)
|
||||
if (line->GetCommand() == "CreateObject" && m_sceneReadPath.empty())
|
||||
{
|
||||
ObjectType type = line->GetParam("type")->AsObjectType();
|
||||
|
||||
|
@ -3741,7 +3733,7 @@ void CRobotMain::CreateScene(bool soluce, bool fixScene, bool resetObject)
|
|||
|
||||
if (line->GetCommand() == "GroundSpot" && !resetObject)
|
||||
{
|
||||
rank = m_engine->CreateGroundSpot();
|
||||
int rank = m_engine->CreateGroundSpot();
|
||||
if (rank != -1)
|
||||
{
|
||||
m_engine->SetObjectGroundSpotPos(rank, line->GetParam("pos")->AsPoint(Math::Vector(0.0f, 0.0f, 0.0f))*g_unit);
|
||||
|
@ -3870,7 +3862,7 @@ void CRobotMain::CreateScene(bool soluce, bool fixScene, bool resetObject)
|
|||
continue;
|
||||
}
|
||||
|
||||
if (line->GetCommand() == "DoneResearch" && read[0] == 0 && !resetObject) // not loading file?
|
||||
if (line->GetCommand() == "DoneResearch" && m_sceneReadPath.empty() && !resetObject) // not loading file?
|
||||
{
|
||||
m_researchDone[0] |= line->GetParam("type")->AsResearchFlag();
|
||||
continue;
|
||||
|
@ -3882,22 +3874,22 @@ void CRobotMain::CreateScene(bool soluce, bool fixScene, bool resetObject)
|
|||
continue;
|
||||
}
|
||||
|
||||
if (read[0] != 0) continue; // ignore errors when loading saved game (TODO: don't report ones that are just not loaded when loading saved game)
|
||||
if (!m_sceneReadPath.empty()) continue; // ignore errors when loading saved game (TODO: don't report ones that are just not loaded when loading saved game)
|
||||
if (resetObject) continue; // ignore when reseting just objects (TODO: see above)
|
||||
|
||||
throw CLevelParserException("Unknown command: '" + line->GetCommand() + "' in " + line->GetLevel()->GetFilename() + ":" + boost::lexical_cast<std::string>(line->GetLineNumber()));
|
||||
}
|
||||
|
||||
if (read[0] == 0)
|
||||
if (m_sceneReadPath.empty())
|
||||
CompileScript(soluce); // compiles all scripts
|
||||
|
||||
if (category == LevelCategory::Missions && !resetObject) // mission?
|
||||
if (m_levelCategory == LevelCategory::Missions && !resetObject) // mission?
|
||||
{
|
||||
m_playerProfile->SetFreeGameResearchUnlock(m_playerProfile->GetFreeGameResearchUnlock() | m_researchDone[0]);
|
||||
m_playerProfile->SetFreeGameBuildUnlock(m_playerProfile->GetFreeGameBuildUnlock() | m_build);
|
||||
}
|
||||
|
||||
if (category == LevelCategory::FreeGame && !resetObject) // free play?
|
||||
if (m_levelCategory == LevelCategory::FreeGame && !resetObject) // free play?
|
||||
{
|
||||
m_researchDone[0] = m_playerProfile->GetFreeGameResearchUnlock();
|
||||
|
||||
|
@ -3946,7 +3938,7 @@ void CRobotMain::CreateScene(bool soluce, bool fixScene, bool resetObject)
|
|||
if (m_fixScene)
|
||||
m_camera->SetType(Gfx::CAM_TYPE_SCRIPT);
|
||||
|
||||
if (read[0] != 0 && sel != 0) // loading file?
|
||||
if (!m_sceneReadPath.empty() && sel != 0) // loading file?
|
||||
{
|
||||
Math::Vector pos = sel->GetPosition();
|
||||
m_camera->Init(pos, pos, 0.0f);
|
||||
|
@ -3960,12 +3952,10 @@ void CRobotMain::CreateScene(bool soluce, bool fixScene, bool resetObject)
|
|||
}
|
||||
catch (...)
|
||||
{
|
||||
m_dialog->SetSceneRead("");
|
||||
m_dialog->SetStackRead("");
|
||||
m_sceneReadPath = "";
|
||||
throw;
|
||||
}
|
||||
m_dialog->SetSceneRead("");
|
||||
m_dialog->SetStackRead("");
|
||||
m_sceneReadPath = "";
|
||||
|
||||
if (m_app->GetSceneTestMode())
|
||||
m_eventQueue->AddEvent(Event(EVENT_QUIT));
|
||||
|
@ -4702,16 +4692,13 @@ void CRobotMain::LoadOneScript(CObject *obj, int &nbError)
|
|||
int objRank = obj->GetDefRank();
|
||||
if (objRank == -1) return;
|
||||
|
||||
char categoryChar = GetLevelCategoryDir(m_dialog->GetLevelCategory())[0];
|
||||
int chap = m_dialog->GetLevelChap();
|
||||
int rank = m_dialog->GetLevelRank();
|
||||
|
||||
char categoryChar = GetLevelCategoryDir(m_levelCategory)[0];
|
||||
for (unsigned int i = 0; i <= 999; i++)
|
||||
{
|
||||
//? if (brain->GetCompile(i)) continue;
|
||||
|
||||
char file[MAX_FNAME];
|
||||
sprintf(file, "%c%.3d%.3d%.3d%.3d.txt", categoryChar, chap, rank, objRank, i);
|
||||
sprintf(file, "%c%.3d%.3d%.3d%.3d.txt", categoryChar, m_levelChap, m_levelRank, objRank, i);
|
||||
std::string filename = m_playerProfile->GetSaveFile(file);
|
||||
|
||||
if (CResourceManager::Exists(filename))
|
||||
|
@ -4778,16 +4765,13 @@ void CRobotMain::SaveOneScript(CObject *obj)
|
|||
int objRank = obj->GetDefRank();
|
||||
if (objRank == -1) return;
|
||||
|
||||
char categoryChar = GetLevelCategoryDir(m_dialog->GetLevelCategory())[0];
|
||||
int chap = m_dialog->GetLevelChap();
|
||||
int rank = m_dialog->GetLevelRank();
|
||||
|
||||
char categoryChar = GetLevelCategoryDir(m_levelCategory)[0];
|
||||
auto& programs = brain->GetPrograms();
|
||||
// TODO: Find a better way to do that
|
||||
for (unsigned int i = 0; i <= 999; i++)
|
||||
{
|
||||
char file[MAX_FNAME];
|
||||
sprintf(file, "%c%.3d%.3d%.3d%.3d.txt", categoryChar, chap, rank, objRank, i);
|
||||
sprintf(file, "%c%.3d%.3d%.3d%.3d.txt", categoryChar, m_levelChap, m_levelRank, objRank, i);
|
||||
std::string filename = m_playerProfile->GetSaveFile(file);
|
||||
|
||||
if (i < programs.size())
|
||||
|
@ -4997,7 +4981,7 @@ void CRobotMain::IOWriteObject(CLevelParserLine* line, CObject* obj)
|
|||
}
|
||||
|
||||
//! Saves the current game
|
||||
bool CRobotMain::IOWriteScene(const char *filename, const char *filecbot, char *info)
|
||||
bool CRobotMain::IOWriteScene(std::string filename, std::string filecbot, char *info)
|
||||
{
|
||||
CLevelParser levelParser(filename);
|
||||
CLevelParserLineUPtr line;
|
||||
|
@ -5019,12 +5003,12 @@ bool CRobotMain::IOWriteScene(const char *filename, const char *filecbot, char *
|
|||
levelParser.AddLine(std::move(line));
|
||||
|
||||
line = MakeUnique<CLevelParserLine>("Mission");
|
||||
line->AddParam("base", MakeUnique<CLevelParserParam>(GetLevelCategoryDir(m_dialog->GetLevelCategory())));
|
||||
if (m_dialog->GetLevelCategory() == LevelCategory::CustomLevels)
|
||||
line->AddParam("dir", MakeUnique<CLevelParserParam>(m_dialog->GetCustomLevelDir()));
|
||||
line->AddParam("base", MakeUnique<CLevelParserParam>(GetLevelCategoryDir(m_levelCategory)));
|
||||
if (m_levelCategory == LevelCategory::CustomLevels)
|
||||
line->AddParam("dir", MakeUnique<CLevelParserParam>(GetCustomLevelDir()));
|
||||
else
|
||||
line->AddParam("chap", MakeUnique<CLevelParserParam>(m_dialog->GetLevelChap()));
|
||||
line->AddParam("rank", MakeUnique<CLevelParserParam>(m_dialog->GetLevelRank()));
|
||||
line->AddParam("chap", MakeUnique<CLevelParserParam>(m_levelChap));
|
||||
line->AddParam("rank", MakeUnique<CLevelParserParam>(m_levelRank));
|
||||
levelParser.AddLine(std::move(line));
|
||||
|
||||
line = MakeUnique<CLevelParserLine>("Map");
|
||||
|
@ -5084,7 +5068,7 @@ bool CRobotMain::IOWriteScene(const char *filename, const char *filecbot, char *
|
|||
IOWriteObject(line.get(), obj);
|
||||
levelParser.AddLine(std::move(line));
|
||||
|
||||
SaveFileScript(obj, filename, objRank++);
|
||||
SaveFileScript(obj, filename.c_str(), objRank++);
|
||||
}
|
||||
try
|
||||
{
|
||||
|
@ -5097,7 +5081,7 @@ bool CRobotMain::IOWriteScene(const char *filename, const char *filecbot, char *
|
|||
}
|
||||
|
||||
// Writes the file of stacks of execution.
|
||||
FILE* file = fOpen(filecbot, "wb");
|
||||
FILE* file = fOpen((CResourceManager::GetSaveLocation() + "/" + filecbot).c_str(), "wb");
|
||||
if (file == NULL) return false;
|
||||
|
||||
long version = 1;
|
||||
|
@ -5216,15 +5200,8 @@ CObject* CRobotMain::IOReadObject(CLevelParserLine *line, const char* filename,
|
|||
return obj;
|
||||
}
|
||||
|
||||
void CRobotMain::IOReadScene(const char *filename, const char *filecbot)
|
||||
{
|
||||
m_dialog->SetSceneRead(filename);
|
||||
m_dialog->SetStackRead(filecbot);
|
||||
ChangePhase(PHASE_LOADING);
|
||||
}
|
||||
|
||||
//! Resumes some part of the game
|
||||
CObject* CRobotMain::IOReadSceneObjects(const char *filename, const char *filecbot)
|
||||
CObject* CRobotMain::IOReadScene(std::string filename, std::string filecbot)
|
||||
{
|
||||
CLevelParser levelParser(filename);
|
||||
levelParser.Load();
|
||||
|
@ -5253,14 +5230,14 @@ CObject* CRobotMain::IOReadSceneObjects(const char *filename, const char *filecb
|
|||
}
|
||||
|
||||
if (line->GetCommand() == "CreateFret")
|
||||
cargo = IOReadObject(line.get(), filename, -1);
|
||||
cargo = IOReadObject(line.get(), filename.c_str(), -1);
|
||||
|
||||
if (line->GetCommand() == "CreatePower")
|
||||
power = IOReadObject(line.get(), filename, -1);
|
||||
power = IOReadObject(line.get(), filename.c_str(), -1);
|
||||
|
||||
if (line->GetCommand() == "CreateObject")
|
||||
{
|
||||
CObject* obj = IOReadObject(line.get(), filename, objRank++);
|
||||
CObject* obj = IOReadObject(line.get(), filename.c_str(), objRank++);
|
||||
|
||||
if (line->GetParam("select")->AsBool(false))
|
||||
sel = obj;
|
||||
|
@ -5303,7 +5280,7 @@ CObject* CRobotMain::IOReadSceneObjects(const char *filename, const char *filecb
|
|||
objRank = obj->GetDefRank();
|
||||
if (objRank == -1) continue;
|
||||
|
||||
LoadFileScript(obj, filename, objRank, nbError);
|
||||
LoadFileScript(obj, filename.c_str(), objRank, nbError);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -5325,7 +5302,7 @@ CObject* CRobotMain::IOReadSceneObjects(const char *filename, const char *filecb
|
|||
}
|
||||
|
||||
// Reads the file of stacks of execution.
|
||||
FILE* file = fOpen(filecbot, "rb");
|
||||
FILE* file = fOpen((CResourceManager::GetSaveLocation() + "/" + filecbot).c_str(), "rb");
|
||||
if (file != NULL)
|
||||
{
|
||||
long version;
|
||||
|
@ -5796,22 +5773,36 @@ float CRobotMain::GetPersoAngle()
|
|||
|
||||
void CRobotMain::SetLevel(LevelCategory cat, int chap, int rank)
|
||||
{
|
||||
m_dialog->SetLevel(cat, chap, rank);
|
||||
m_levelCategory = cat;
|
||||
m_levelChap = chap;
|
||||
m_levelRank = rank;
|
||||
}
|
||||
|
||||
LevelCategory CRobotMain::GetLevelCategory()
|
||||
{
|
||||
return m_dialog->GetLevelCategory();
|
||||
return m_levelCategory;
|
||||
}
|
||||
|
||||
int CRobotMain::GetLevelChap()
|
||||
{
|
||||
return m_dialog->GetLevelChap();
|
||||
return m_levelChap;
|
||||
}
|
||||
|
||||
int CRobotMain::GetLevelRank()
|
||||
{
|
||||
return m_dialog->GetLevelRank();
|
||||
return m_levelRank;
|
||||
}
|
||||
|
||||
//! Returns folder name of the scene that user selected to play.
|
||||
std::string CRobotMain::GetCustomLevelDir()
|
||||
{
|
||||
assert(m_levelCategory == LevelCategory::CustomLevels);
|
||||
return m_dialog->GetCustomLevelName(m_levelChap);
|
||||
}
|
||||
|
||||
void CRobotMain::SetReadScene(std::string path)
|
||||
{
|
||||
m_sceneReadPath = path;
|
||||
}
|
||||
|
||||
void CRobotMain::UpdateChapterPassed()
|
||||
|
|
|
@ -261,6 +261,8 @@ public:
|
|||
LevelCategory GetLevelCategory();
|
||||
int GetLevelChap();
|
||||
int GetLevelRank();
|
||||
std::string GetCustomLevelDir();
|
||||
void SetReadScene(std::string path);
|
||||
void UpdateChapterPassed();
|
||||
void MakeSaveScreenshot(const std::string& name);
|
||||
|
||||
|
@ -299,10 +301,9 @@ public:
|
|||
CPlayerProfile* GetPlayerProfile();
|
||||
|
||||
bool IsBusy();
|
||||
bool IOWriteScene(const char *filename, const char *filecbot, char *info);
|
||||
bool IOWriteScene(std::string filename, std::string filecbot, char *info);
|
||||
void IOWriteSceneFinished();
|
||||
void IOReadScene(const char *filename, const char *filecbot);
|
||||
CObject* IOReadSceneObjects(const char *filename, const char *filecbot);
|
||||
CObject* IOReadScene(std::string filename, std::string filecbot);
|
||||
void IOWriteObject(CLevelParserLine *line, CObject* obj);
|
||||
CObject* IOReadObject(CLevelParserLine *line, const char* filename, int objRank);
|
||||
|
||||
|
@ -461,6 +462,11 @@ protected:
|
|||
//! Playing time since level start, not dependent on simulation speed
|
||||
float m_gameTimeAbsolute;
|
||||
|
||||
LevelCategory m_levelCategory;
|
||||
int m_levelChap;
|
||||
int m_levelRank;
|
||||
std::string m_sceneReadPath;
|
||||
|
||||
float m_winDelay;
|
||||
float m_lostDelay;
|
||||
bool m_fixScene; // scene fixed, no interraction
|
||||
|
|
|
@ -130,10 +130,6 @@ CMainDialog::CMainDialog()
|
|||
|
||||
m_phase = PHASE_PLAYER_SELECT;
|
||||
m_phaseSetup = PHASE_SETUPg;
|
||||
m_sceneRead[0] = 0;
|
||||
m_stackRead[0] = 0;
|
||||
m_levelChap = 0;
|
||||
m_levelRank = 0;
|
||||
m_bSceneSoluce = false;
|
||||
m_bSimulSetup = false;
|
||||
|
||||
|
@ -718,6 +714,7 @@ void CMainDialog::ChangePhase(Phase phase)
|
|||
|
||||
if ( m_phase == PHASE_LEVEL_LIST )
|
||||
{
|
||||
m_category = m_main->GetLevelCategory();
|
||||
if ( static_cast<int>(m_category) >= static_cast<int>(LevelCategory::Max) )
|
||||
{
|
||||
m_category = m_listCategory;
|
||||
|
@ -2061,27 +2058,27 @@ bool CMainDialog::EventProcess(const Event &event)
|
|||
break;
|
||||
|
||||
case EVENT_INTERFACE_TRAINER:
|
||||
m_category = LevelCategory::Exercises;
|
||||
m_main->SetLevel(LevelCategory::Exercises, 0, 0);
|
||||
m_main->ChangePhase(PHASE_LEVEL_LIST);
|
||||
break;
|
||||
|
||||
case EVENT_INTERFACE_DEFI:
|
||||
m_category = LevelCategory::Challenges;
|
||||
m_main->SetLevel(LevelCategory::Challenges, 0, 0);
|
||||
m_main->ChangePhase(PHASE_LEVEL_LIST);
|
||||
break;
|
||||
|
||||
case EVENT_INTERFACE_MISSION:
|
||||
m_category = LevelCategory::Missions;
|
||||
m_main->SetLevel(LevelCategory::Missions, 0, 0);
|
||||
m_main->ChangePhase(PHASE_LEVEL_LIST);
|
||||
break;
|
||||
|
||||
case EVENT_INTERFACE_FREE:
|
||||
m_category = LevelCategory::FreeGame;
|
||||
m_main->SetLevel(LevelCategory::FreeGame, 0, 0);
|
||||
m_main->ChangePhase(PHASE_LEVEL_LIST);
|
||||
break;
|
||||
|
||||
case EVENT_INTERFACE_USER:
|
||||
m_category = LevelCategory::CustomLevels;
|
||||
m_main->SetLevel(LevelCategory::CustomLevels, 0, 0);
|
||||
m_main->ChangePhase(PHASE_LEVEL_LIST);
|
||||
break;
|
||||
|
||||
|
@ -2320,8 +2317,7 @@ bool CMainDialog::EventProcess(const Event &event)
|
|||
break;
|
||||
|
||||
case EVENT_INTERFACE_PLAY:
|
||||
m_levelChap = m_chap[m_category]+1;
|
||||
m_levelRank = m_sel[m_category]+1;
|
||||
m_main->SetLevel(m_category, m_chap[m_category]+1, m_sel[m_category]+1);
|
||||
m_main->ChangePhase(PHASE_LOADING);
|
||||
break;
|
||||
|
||||
|
@ -3406,15 +3402,6 @@ void CMainDialog::NiceParticle(Math::Point mouse, bool bPress)
|
|||
}
|
||||
|
||||
|
||||
|
||||
// Built the default descriptive name of a mission.
|
||||
|
||||
void CMainDialog::BuildResumeName(char *filename, std::string base, int chap, int rank)
|
||||
{
|
||||
sprintf(filename, "%s %d.%d", base.c_str(), chap, rank);
|
||||
}
|
||||
|
||||
|
||||
// Updates the list of players after checking the files on disk.
|
||||
|
||||
void CMainDialog::ReadNameList()
|
||||
|
@ -4130,8 +4117,8 @@ void CMainDialog::IOReadScene()
|
|||
|
||||
m_main->GetPlayerProfile()->LoadScene(m_saveList.at(sel));
|
||||
|
||||
m_chap[m_category] = m_levelChap-1;
|
||||
m_sel[m_category] = m_levelRank-1;
|
||||
m_chap[m_category] = m_main->GetLevelChap()-1;
|
||||
m_sel[m_category] = m_main->GetLevelRank()-1;
|
||||
}
|
||||
|
||||
// Updates the lists according to the cheat code.
|
||||
|
@ -5817,67 +5804,6 @@ bool CMainDialog::IsDialog()
|
|||
}
|
||||
|
||||
|
||||
|
||||
|
||||
// Specifies the name of the scene to read.
|
||||
|
||||
void CMainDialog::SetSceneRead(const char* name)
|
||||
{
|
||||
m_sceneRead = name;
|
||||
}
|
||||
|
||||
// Returns the name of the scene to read.
|
||||
|
||||
std::string & CMainDialog::GetSceneRead()
|
||||
{
|
||||
return m_sceneRead;
|
||||
}
|
||||
|
||||
// Specifies the name of the scene to read.
|
||||
|
||||
void CMainDialog::SetStackRead(const char* name)
|
||||
{
|
||||
m_stackRead = name;
|
||||
}
|
||||
|
||||
// Returns the name of the scene to read.
|
||||
|
||||
std::string & CMainDialog::GetStackRead()
|
||||
{
|
||||
return m_stackRead;
|
||||
}
|
||||
|
||||
|
||||
void CMainDialog::SetLevel(LevelCategory cat, int chap, int rank)
|
||||
{
|
||||
m_category = cat;
|
||||
m_levelChap = chap;
|
||||
m_levelRank = rank;
|
||||
}
|
||||
|
||||
LevelCategory CMainDialog::GetLevelCategory()
|
||||
{
|
||||
return m_category;
|
||||
}
|
||||
|
||||
int CMainDialog::GetLevelChap()
|
||||
{
|
||||
return m_levelChap;
|
||||
}
|
||||
|
||||
int CMainDialog::GetLevelRank()
|
||||
{
|
||||
return m_levelRank;
|
||||
}
|
||||
|
||||
// Returns folder name of the scene that user selected to play.
|
||||
|
||||
std::string CMainDialog::GetCustomLevelDir()
|
||||
{
|
||||
if (m_levelChap-1 < 0 || m_levelChap-1 >= m_customLevelList.size()) return "";
|
||||
return m_customLevelList[m_levelChap-1];
|
||||
}
|
||||
|
||||
// Whether to show the solution.
|
||||
|
||||
bool CMainDialog::GetSceneSoluce()
|
||||
|
|
|
@ -59,18 +59,7 @@ public:
|
|||
bool EventProcess(const Event &event);
|
||||
void ChangePhase(Phase phase);
|
||||
|
||||
void SetSceneRead(const char* name);
|
||||
std::string & GetSceneRead();
|
||||
void SetStackRead(const char* name);
|
||||
std::string & GetStackRead();
|
||||
|
||||
void SetLevel(LevelCategory cat, int chap, int rank);
|
||||
LevelCategory GetLevelCategory();
|
||||
int GetLevelChap();
|
||||
int GetLevelRank();
|
||||
std::string GetCustomLevelDir();
|
||||
|
||||
bool GetSceneSoluce();
|
||||
bool GetSceneSoluce();
|
||||
|
||||
bool GetTooltip();
|
||||
bool GetGlint();
|
||||
|
@ -79,8 +68,6 @@ public:
|
|||
bool GetNiceReset();
|
||||
bool GetHimselfDamage();
|
||||
|
||||
void BuildResumeName(char *filename, std::string base, int chap, int rank);
|
||||
|
||||
void StartAbort();
|
||||
void StartDeleteObject();
|
||||
void StartDeleteGame(char *gamer);
|
||||
|
@ -169,10 +156,6 @@ protected:
|
|||
std::map<LevelCategory, int> m_sel; // chosen mission (0..98)
|
||||
int m_maxList;
|
||||
int m_accessChap;
|
||||
std::string m_sceneRead; // name of the scene to read
|
||||
std::string m_stackRead; // name of the scene to read
|
||||
int m_levelChap; // chapter of the level to play
|
||||
int m_levelRank; // rank of the level to play
|
||||
bool m_bSceneSoluce; // shows the solution
|
||||
bool m_bSimulSetup; // adjustment during the game
|
||||
bool m_accessEnable;
|
||||
|
|
Loading…
Reference in New Issue