Implemented loading progress bar
parent
f90bb63520
commit
57469533b6
|
@ -249,6 +249,36 @@ msgstr ""
|
|||
msgid "Recorder"
|
||||
msgstr ""
|
||||
|
||||
msgid "Starting..."
|
||||
msgstr ""
|
||||
|
||||
msgid "Processing level file"
|
||||
msgstr ""
|
||||
|
||||
msgid "Loading basic level settings"
|
||||
msgstr ""
|
||||
|
||||
msgid "Loading music"
|
||||
msgstr ""
|
||||
|
||||
msgid "Loading terrain"
|
||||
msgstr ""
|
||||
|
||||
msgid "Loading objects"
|
||||
msgstr ""
|
||||
|
||||
msgid "Restoring saved objects"
|
||||
msgstr ""
|
||||
|
||||
msgid "Loading programs"
|
||||
msgstr ""
|
||||
|
||||
msgid "Restoring CBot execution state"
|
||||
msgstr ""
|
||||
|
||||
msgid "Loading finished!"
|
||||
msgstr ""
|
||||
|
||||
msgid "Cancel"
|
||||
msgstr ""
|
||||
|
||||
|
|
33
po/de.po
33
po/de.po
|
@ -818,6 +818,26 @@ msgstr "Laden\\Eine gespeicherte Mission öffnen"
|
|||
msgid "Load\\Loads the selected mission"
|
||||
msgstr "Laden\\Öffnet eine gespeicherte Mission"
|
||||
|
||||
msgid "Loading basic level settings"
|
||||
msgstr ""
|
||||
|
||||
#, fuzzy
|
||||
msgid "Loading finished!"
|
||||
msgstr "Programm beendet"
|
||||
|
||||
msgid "Loading music"
|
||||
msgstr ""
|
||||
|
||||
#, fuzzy
|
||||
msgid "Loading objects"
|
||||
msgstr "Liste der Objekte"
|
||||
|
||||
msgid "Loading programs"
|
||||
msgstr ""
|
||||
|
||||
msgid "Loading terrain"
|
||||
msgstr ""
|
||||
|
||||
msgid "Lowest\\Minimum graphic quality (highest frame rate)"
|
||||
msgstr "Min.\\Minimale Qualität (großes Framerate)"
|
||||
|
||||
|
@ -1138,6 +1158,9 @@ msgstr "Geschütztes Element (private)"
|
|||
msgid "Private\\Private folder"
|
||||
msgstr "Privat\\Privater Ordner"
|
||||
|
||||
msgid "Processing level file"
|
||||
msgstr ""
|
||||
|
||||
#, fuzzy
|
||||
msgid "Program cloned"
|
||||
msgstr "Programm beendet"
|
||||
|
@ -1241,6 +1264,12 @@ msgstr "Auflösung"
|
|||
msgid "Restart\\Restart the mission from the beginning"
|
||||
msgstr "Neu anfangen\\Die Mission von vorne anfangen"
|
||||
|
||||
msgid "Restoring CBot execution state"
|
||||
msgstr ""
|
||||
|
||||
msgid "Restoring saved objects"
|
||||
msgstr ""
|
||||
|
||||
msgid "Return to start"
|
||||
msgstr "Alles zurücksetzen"
|
||||
|
||||
|
@ -1434,6 +1463,10 @@ msgstr "Standard\\Standardfarben einsetzen"
|
|||
msgid "Start"
|
||||
msgstr "Startfläche"
|
||||
|
||||
#, fuzzy
|
||||
msgid "Starting..."
|
||||
msgstr "Startfläche"
|
||||
|
||||
msgid "Still working ..."
|
||||
msgstr "Prozess im Gang ..."
|
||||
|
||||
|
|
33
po/fr.po
33
po/fr.po
|
@ -812,6 +812,26 @@ msgstr "Charger\\Charger une mission enregistrée"
|
|||
msgid "Load\\Loads the selected mission"
|
||||
msgstr "Charger\\Charger la mission sélectionnée"
|
||||
|
||||
msgid "Loading basic level settings"
|
||||
msgstr ""
|
||||
|
||||
#, fuzzy
|
||||
msgid "Loading finished!"
|
||||
msgstr "Programme terminé"
|
||||
|
||||
msgid "Loading music"
|
||||
msgstr ""
|
||||
|
||||
#, fuzzy
|
||||
msgid "Loading objects"
|
||||
msgstr "Liste des objets"
|
||||
|
||||
msgid "Loading programs"
|
||||
msgstr ""
|
||||
|
||||
msgid "Loading terrain"
|
||||
msgstr ""
|
||||
|
||||
msgid "Lowest\\Minimum graphic quality (highest frame rate)"
|
||||
msgstr "Mini\\Qualité minimale (+ rapide)"
|
||||
|
||||
|
@ -1134,6 +1154,9 @@ msgstr "Elément protégé"
|
|||
msgid "Private\\Private folder"
|
||||
msgstr "Privé\\Dossier privé"
|
||||
|
||||
msgid "Processing level file"
|
||||
msgstr ""
|
||||
|
||||
#, fuzzy
|
||||
msgid "Program cloned"
|
||||
msgstr "Programme terminé"
|
||||
|
@ -1236,6 +1259,12 @@ msgstr "Résolution"
|
|||
msgid "Restart\\Restart the mission from the beginning"
|
||||
msgstr "Recommencer\\Recommencer la mission au début"
|
||||
|
||||
msgid "Restoring CBot execution state"
|
||||
msgstr ""
|
||||
|
||||
msgid "Restoring saved objects"
|
||||
msgstr ""
|
||||
|
||||
msgid "Return to start"
|
||||
msgstr "Remet au départ"
|
||||
|
||||
|
@ -1430,6 +1459,10 @@ msgstr "Standard\\Remet les couleurs standards"
|
|||
msgid "Start"
|
||||
msgstr "Départ"
|
||||
|
||||
#, fuzzy
|
||||
msgid "Starting..."
|
||||
msgstr "Départ"
|
||||
|
||||
msgid "Still working ..."
|
||||
msgstr "Travail en cours ..."
|
||||
|
||||
|
|
30
po/pl.po
30
po/pl.po
|
@ -820,6 +820,24 @@ msgstr "Wczytaj\\Wczytuje zapisaną misję"
|
|||
msgid "Load\\Loads the selected mission"
|
||||
msgstr "Wczytaj\\Wczytuje zaznaczoną misję"
|
||||
|
||||
msgid "Loading basic level settings"
|
||||
msgstr "Wczytywanie podstawowych ustawień poziomu"
|
||||
|
||||
msgid "Loading finished!"
|
||||
msgstr "Wczytywanie zakończone!"
|
||||
|
||||
msgid "Loading music"
|
||||
msgstr "Wczytywanie muzyki"
|
||||
|
||||
msgid "Loading objects"
|
||||
msgstr "Wczytywanie obiektów"
|
||||
|
||||
msgid "Loading programs"
|
||||
msgstr "Wczytywanie programów"
|
||||
|
||||
msgid "Loading terrain"
|
||||
msgstr "Wczytywanie terenu"
|
||||
|
||||
msgid "Lowest\\Minimum graphic quality (highest frame rate)"
|
||||
msgstr ""
|
||||
"Najniższa\\Minimalna jakość grafiki (najwyższa częstotliwość odświeżania)"
|
||||
|
@ -1141,6 +1159,9 @@ msgstr "Element prywatny"
|
|||
msgid "Private\\Private folder"
|
||||
msgstr "Prywatny\\Folder prywatny"
|
||||
|
||||
msgid "Processing level file"
|
||||
msgstr "Przetwarzanie pliku poziomu"
|
||||
|
||||
msgid "Program cloned"
|
||||
msgstr "Program skopiowany"
|
||||
|
||||
|
@ -1240,6 +1261,12 @@ msgstr "Rozdzielczość"
|
|||
msgid "Restart\\Restart the mission from the beginning"
|
||||
msgstr "Uruchom ponownie\\Uruchamia ponownie misję od początku"
|
||||
|
||||
msgid "Restoring CBot execution state"
|
||||
msgstr "Przywracanie stanu wykonywania CBot"
|
||||
|
||||
msgid "Restoring saved objects"
|
||||
msgstr "Przywracanie zapisanych obiektów"
|
||||
|
||||
msgid "Return to start"
|
||||
msgstr "Powrót do początku"
|
||||
|
||||
|
@ -1431,6 +1458,9 @@ msgstr "Standardowe\\Standardowe ustawienia wyglądu"
|
|||
msgid "Start"
|
||||
msgstr "Początek"
|
||||
|
||||
msgid "Starting..."
|
||||
msgstr "Rozpoczynanie..."
|
||||
|
||||
msgid "Still working ..."
|
||||
msgstr "Wciąż pracuje..."
|
||||
|
||||
|
|
33
po/ru.po
33
po/ru.po
|
@ -811,6 +811,26 @@ msgstr "Загрузить\\Загрузить сохраненную мисси
|
|||
msgid "Load\\Loads the selected mission"
|
||||
msgstr "Загрузить\\Загрузить выбранную миссию"
|
||||
|
||||
msgid "Loading basic level settings"
|
||||
msgstr ""
|
||||
|
||||
#, fuzzy
|
||||
msgid "Loading finished!"
|
||||
msgstr "Программа выполнена"
|
||||
|
||||
msgid "Loading music"
|
||||
msgstr ""
|
||||
|
||||
#, fuzzy
|
||||
msgid "Loading objects"
|
||||
msgstr "Список объектов"
|
||||
|
||||
msgid "Loading programs"
|
||||
msgstr ""
|
||||
|
||||
msgid "Loading terrain"
|
||||
msgstr ""
|
||||
|
||||
msgid "Lowest\\Minimum graphic quality (highest frame rate)"
|
||||
msgstr "Низкое\\Минимальное качество графики (быстро)"
|
||||
|
||||
|
@ -1133,6 +1153,9 @@ msgstr "Частный элемент"
|
|||
msgid "Private\\Private folder"
|
||||
msgstr "Личное\\Личная папка"
|
||||
|
||||
msgid "Processing level file"
|
||||
msgstr ""
|
||||
|
||||
#, fuzzy
|
||||
msgid "Program cloned"
|
||||
msgstr "Программа выполнена"
|
||||
|
@ -1236,6 +1259,12 @@ msgstr "Разрешение"
|
|||
msgid "Restart\\Restart the mission from the beginning"
|
||||
msgstr "Заново\\Начать данную миссию с начала"
|
||||
|
||||
msgid "Restoring CBot execution state"
|
||||
msgstr ""
|
||||
|
||||
msgid "Restoring saved objects"
|
||||
msgstr ""
|
||||
|
||||
msgid "Return to start"
|
||||
msgstr "Вернуться в начало"
|
||||
|
||||
|
@ -1426,6 +1455,10 @@ msgstr "По умолчанию\\Настройки внешнего вида п
|
|||
msgid "Start"
|
||||
msgstr "Начало"
|
||||
|
||||
#, fuzzy
|
||||
msgid "Starting..."
|
||||
msgstr "Начало"
|
||||
|
||||
msgid "Still working ..."
|
||||
msgstr "Работает ..."
|
||||
|
||||
|
|
|
@ -58,7 +58,7 @@ void CController::StartApp()
|
|||
void CController::StartGame(LevelCategory cat, int chap, int lvl)
|
||||
{
|
||||
m_main->SetLevel(cat, chap, lvl);
|
||||
m_main->ChangePhase(PHASE_LOADING);
|
||||
m_main->ChangePhase(PHASE_SIMUL);
|
||||
}
|
||||
|
||||
void CController::ProcessEvent(Event& event)
|
||||
|
|
|
@ -148,6 +148,8 @@ void InitializeEventTypeTexts()
|
|||
EVENT_TYPE_TEXT[EVENT_LIST8] = "EVENT_LIST8";
|
||||
EVENT_TYPE_TEXT[EVENT_LIST9] = "EVENT_LIST9";
|
||||
|
||||
EVENT_TYPE_TEXT[EVENT_LOADING] = "EVENT_LOADING";
|
||||
|
||||
EVENT_TYPE_TEXT[EVENT_TOOLTIP] = "EVENT_TOOLTIP";
|
||||
|
||||
EVENT_TYPE_TEXT[EVENT_DIALOG_OK] = "EVENT_DIALOG_OK";
|
||||
|
|
|
@ -172,6 +172,8 @@ enum EventType
|
|||
EVENT_LIST8 = 118,
|
||||
EVENT_LIST9 = 119,
|
||||
|
||||
EVENT_LOADING = 120,
|
||||
|
||||
EVENT_TOOLTIP = 200,
|
||||
|
||||
EVENT_DIALOG_OK = 300,
|
||||
|
|
|
@ -19,7 +19,7 @@
|
|||
|
||||
/**
|
||||
* \file common/pathman.h
|
||||
* \brief Class for managing data/lang/save paths, and %something% replacements
|
||||
* \brief Class for managing data/lang/save paths
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
|
|
@ -146,6 +146,17 @@ void InitializeRestext()
|
|||
|
||||
stringsText[RT_INTERFACE_REC] = TR("Recorder");
|
||||
|
||||
stringsText[RT_LOADING_INIT] = TR("Starting...");
|
||||
stringsText[RT_LOADING_PROCESSING] = TR("Processing level file");
|
||||
stringsText[RT_LOADING_LEVEL_SETTINGS] = TR("Loading basic level settings");
|
||||
stringsText[RT_LOADING_MUSIC] = TR("Loading music");
|
||||
stringsText[RT_LOADING_TERRAIN] = TR("Loading terrain");
|
||||
stringsText[RT_LOADING_OBJECTS] = TR("Loading objects");
|
||||
stringsText[RT_LOADING_OBJECTS_SAVED] = TR("Restoring saved objects");
|
||||
stringsText[RT_LOADING_PROGRAMS] = TR("Loading programs");
|
||||
stringsText[RT_LOADING_CBOT_SAVE] = TR("Restoring CBot execution state");
|
||||
stringsText[RT_LOADING_FINISHED] = TR("Loading finished!");
|
||||
|
||||
|
||||
|
||||
stringsEvent[EVENT_BUTTON_OK] = TR("OK");
|
||||
|
|
|
@ -145,6 +145,17 @@ enum ResTextType
|
|||
RT_MESSAGE_WIN = 200,
|
||||
RT_MESSAGE_LOST = 201,
|
||||
|
||||
RT_LOADING_INIT = 210,
|
||||
RT_LOADING_PROCESSING = 211,
|
||||
RT_LOADING_LEVEL_SETTINGS = 212,
|
||||
RT_LOADING_MUSIC = 213,
|
||||
RT_LOADING_TERRAIN = 214,
|
||||
RT_LOADING_OBJECTS = 215,
|
||||
RT_LOADING_OBJECTS_SAVED = 216,
|
||||
RT_LOADING_PROGRAMS = 217,
|
||||
RT_LOADING_CBOT_SAVE = 218,
|
||||
RT_LOADING_FINISHED = 219,
|
||||
|
||||
|
||||
RT_MAX //! < number of values
|
||||
};
|
||||
|
|
|
@ -3214,6 +3214,7 @@ void CEngine::Render()
|
|||
|
||||
UseMSAA(true);
|
||||
|
||||
DrawBackground(); // draws the background
|
||||
if (m_drawWorld)
|
||||
Draw3DScene();
|
||||
|
||||
|
@ -3234,7 +3235,6 @@ void CEngine::Draw3DScene()
|
|||
if (m_groundSpotVisible)
|
||||
UpdateGroundSpotTextures();
|
||||
|
||||
DrawBackground(); // draws the background
|
||||
if (m_planetMode) DrawPlanet(); // draws the planets
|
||||
if (m_skyMode) m_cloud->Draw(); // draws the clouds
|
||||
|
||||
|
|
|
@ -356,7 +356,7 @@ void CLevelParser::AddLine(CLevelParserLineUPtr line)
|
|||
m_lines.push_back(std::move(line));
|
||||
}
|
||||
|
||||
CLevelParserLine* CLevelParser::Get(std::string command)
|
||||
CLevelParserLine* CLevelParser::Get(const std::string& command)
|
||||
{
|
||||
for (auto& line : m_lines)
|
||||
{
|
||||
|
@ -365,3 +365,14 @@ CLevelParserLine* CLevelParser::Get(std::string command)
|
|||
}
|
||||
throw CLevelParserException("Command not found: " + command);
|
||||
}
|
||||
|
||||
int CLevelParser::CountLines(const std::string& command)
|
||||
{
|
||||
int count = 0;
|
||||
for (auto& line : m_lines)
|
||||
{
|
||||
if (line->GetCommand() == command)
|
||||
count++;
|
||||
}
|
||||
return count;
|
||||
}
|
||||
|
|
|
@ -85,7 +85,10 @@ public:
|
|||
void AddLine(CLevelParserLineUPtr line);
|
||||
|
||||
//! Find first line with given command
|
||||
CLevelParserLine* Get(std::string command);
|
||||
CLevelParserLine* Get(const std::string& command);
|
||||
|
||||
//! Count lines with given command
|
||||
int CountLines(const std::string& command);
|
||||
|
||||
private:
|
||||
std::string m_filename;
|
||||
|
|
|
@ -462,7 +462,7 @@ ObjectType CLevelParserParam::ToObjectType(std::string value)
|
|||
if (value == "Me" ) return OBJECT_HUMAN;
|
||||
if (value == "Tech" ) return OBJECT_TECH;
|
||||
if (value == "MissionController" ) return OBJECT_CONTROLLER;
|
||||
return static_cast<ObjectType>(Cast<int>(value, "object"));
|
||||
return static_cast<ObjectType>(boost::lexical_cast<int>(value));
|
||||
}
|
||||
|
||||
const std::string CLevelParserParam::FromObjectType(ObjectType value)
|
||||
|
|
|
@ -122,6 +122,9 @@ public:
|
|||
std::string GetValue();
|
||||
bool IsDefined();
|
||||
|
||||
static const std::string FromObjectType(ObjectType value);
|
||||
static ObjectType ToObjectType(std::string value);
|
||||
|
||||
private:
|
||||
void ParseArray();
|
||||
void LoadArray();
|
||||
|
@ -130,7 +133,6 @@ private:
|
|||
template<typename T> T Cast(std::string requestedType);
|
||||
|
||||
std::string ToPath(std::string path, const std::string defaultDir);
|
||||
ObjectType ToObjectType(std::string value);
|
||||
DriveType ToDriveType(std::string value);
|
||||
ToolType ToToolType(std::string value);
|
||||
Gfx::WaterType ToWaterType(std::string value);
|
||||
|
@ -141,7 +143,6 @@ private:
|
|||
Gfx::CameraType ToCameraType(std::string value);
|
||||
MissionType ToMissionType(std::string value);
|
||||
|
||||
const std::string FromObjectType(ObjectType value);
|
||||
const std::string FromCameraType(Gfx::CameraType value);
|
||||
|
||||
private:
|
||||
|
@ -151,4 +152,3 @@ private:
|
|||
std::string m_value;
|
||||
CLevelParserParamVec m_array;
|
||||
};
|
||||
|
||||
|
|
|
@ -206,6 +206,17 @@ void CObjectManager::DestroyTeam(int team)
|
|||
}
|
||||
}
|
||||
|
||||
int CObjectManager::CountObjectsImplementing(ObjectInterfaceType interface)
|
||||
{
|
||||
int count = 0;
|
||||
for (CObject* object : GetAllObjects())
|
||||
{
|
||||
if (object->Implements(interface))
|
||||
count++;
|
||||
}
|
||||
return count;
|
||||
}
|
||||
|
||||
CObject* CObjectManager::Radar(CObject* pThis, ObjectType type, float angle, float focus, float minDist, float maxDist, bool furthest, RadarFilter filter, bool cbotTypes)
|
||||
{
|
||||
std::vector<ObjectType> types;
|
||||
|
|
|
@ -30,6 +30,7 @@
|
|||
#include "math/vector.h"
|
||||
|
||||
#include "object/object_create_params.h"
|
||||
#include "object/object_interface_type.h"
|
||||
#include "object/object_type.h"
|
||||
|
||||
#include <map>
|
||||
|
@ -172,6 +173,9 @@ public:
|
|||
// TODO: This should be probably moved to separate class
|
||||
void DestroyTeam(int team);
|
||||
|
||||
//! Counts all objects implementing given interface
|
||||
int CountObjectsImplementing(ObjectInterfaceType interface);
|
||||
|
||||
//! Returns all objects
|
||||
inline CObjectContainerProxy GetAllObjects()
|
||||
{
|
||||
|
|
|
@ -517,7 +517,7 @@ void CPlayerProfile::LoadScene(std::string dir)
|
|||
|
||||
CRobotMain::GetInstancePointer()->SetLevel(cat, chap, rank);
|
||||
CRobotMain::GetInstancePointer()->SetReadScene(dir);
|
||||
CRobotMain::GetInstancePointer()->ChangePhase(PHASE_LOADING);
|
||||
CRobotMain::GetInstancePointer()->ChangePhase(PHASE_SIMUL);
|
||||
}
|
||||
|
||||
bool CPlayerProfile::DeleteScene(std::string dir)
|
||||
|
|
|
@ -87,21 +87,24 @@
|
|||
|
||||
#include "sound/sound.h"
|
||||
|
||||
#include "ui/controls/button.h"
|
||||
#include "ui/displayinfo.h"
|
||||
#include "ui/displaytext.h"
|
||||
#include "ui/controls/edit.h"
|
||||
#include "ui/controls/interface.h"
|
||||
#include "ui/controls/label.h"
|
||||
#include "ui/maindialog.h"
|
||||
#include "ui/mainmap.h"
|
||||
#include "ui/mainshort.h"
|
||||
#include "ui/mainui.h"
|
||||
|
||||
#include "ui/controls/button.h"
|
||||
#include "ui/controls/edit.h"
|
||||
#include "ui/controls/interface.h"
|
||||
#include "ui/controls/label.h"
|
||||
#include "ui/controls/map.h"
|
||||
#include "ui/controls/shortcut.h"
|
||||
#include "ui/controls/slider.h"
|
||||
#include "ui/controls/window.h"
|
||||
|
||||
#include "ui/screen/screen_loading.h"
|
||||
|
||||
#include <iomanip>
|
||||
|
||||
#include <clipboard/clipboard.h>
|
||||
|
@ -373,14 +376,12 @@ bool IsPhaseWithWorld(Phase phase)
|
|||
if (phase == PHASE_WIN ) return true;
|
||||
if (phase == PHASE_LOST ) return true;
|
||||
if (phase == PHASE_APPERANCE) return true;
|
||||
if (phase == PHASE_LOADING ) return true;
|
||||
if (IsInSimulationConfigPhase(phase)) return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
bool IsMainMenuPhase(Phase phase)
|
||||
{
|
||||
if (phase == PHASE_LOADING) return true;
|
||||
return !IsPhaseWithWorld(phase);
|
||||
}
|
||||
|
||||
|
@ -470,15 +471,6 @@ void CRobotMain::ChangePhase(Phase phase)
|
|||
}
|
||||
ClearInterface();
|
||||
|
||||
if (m_phase == PHASE_LOADING)
|
||||
{
|
||||
m_app->SetMouseMode(MOUSE_NONE);
|
||||
}
|
||||
else
|
||||
{
|
||||
m_app->SetMouseMode(m_settings->GetSystemMouse() ? MOUSE_SYSTEM : MOUSE_ENGINE);
|
||||
}
|
||||
|
||||
Math::Point dim, pos;
|
||||
|
||||
// Creates and hide the command console.
|
||||
|
@ -525,7 +517,11 @@ void CRobotMain::ChangePhase(Phase phase)
|
|||
|
||||
bool loading = !m_sceneReadPath.empty();
|
||||
|
||||
m_ui->ShowLoadingScreen(true);
|
||||
m_ui->GetLoadingScreen()->SetProgress(0.0f, RT_LOADING_INIT);
|
||||
|
||||
m_map->CreateMap();
|
||||
m_map->ShowMap(false);
|
||||
|
||||
try
|
||||
{
|
||||
|
@ -2492,6 +2488,14 @@ void CRobotMain::InitEye()
|
|||
//! Advances the entire scene
|
||||
bool CRobotMain::EventFrame(const Event &event)
|
||||
{
|
||||
// TODO: For some reason we're getting one big event with event.rTime > 0.1f after loading before the movie starts?
|
||||
if (!m_immediatSatCom && !m_beginSatCom && !m_movieLock &&
|
||||
m_gameTime > 0.1f && m_phase == PHASE_SIMUL)
|
||||
{
|
||||
m_displayText->DisplayError(INFO_BEGINSATCOM, Math::Vector(0.0f,0.0f,0.0f));
|
||||
m_beginSatCom = true; // message appears
|
||||
}
|
||||
|
||||
m_time += event.rTime;
|
||||
if (!m_movieLock && m_pause->GetPause() == PAUSE_NONE)
|
||||
{
|
||||
|
@ -2499,13 +2503,6 @@ bool CRobotMain::EventFrame(const Event &event)
|
|||
m_gameTimeAbsolute += m_app->GetRealRelTime() / 1e9f;
|
||||
}
|
||||
|
||||
if (!m_immediatSatCom && !m_beginSatCom &&
|
||||
m_gameTime > 0.1f && m_phase == PHASE_SIMUL)
|
||||
{
|
||||
m_displayText->DisplayError(INFO_BEGINSATCOM, Math::Vector(0.0f,0.0f,0.0f));
|
||||
m_beginSatCom = true; // message appears
|
||||
}
|
||||
|
||||
if (!m_movieLock && m_pause->GetPause() == PAUSE_NONE && m_missionTimerStarted)
|
||||
m_missionTimer += event.rTime;
|
||||
|
||||
|
@ -2932,10 +2929,20 @@ void CRobotMain::CreateScene(bool soluce, bool fixScene, bool resetObject)
|
|||
m_missionTimerStarted = false;
|
||||
m_missionTimer = 0.0f;
|
||||
|
||||
std::string backgroundPath = "";
|
||||
Gfx::Color backgroundUp = Gfx::Color(0.0f, 0.0f, 0.0f, 0.0f);
|
||||
Gfx::Color backgroundDown = Gfx::Color(0.0f, 0.0f, 0.0f, 0.0f);
|
||||
Gfx::Color backgroundCloudUp = Gfx::Color(0.0f, 0.0f, 0.0f, 0.0f);
|
||||
Gfx::Color backgroundCloudDown = Gfx::Color(0.0f, 0.0f, 0.0f, 0.0f);
|
||||
bool backgroundFull = false;
|
||||
|
||||
try
|
||||
{
|
||||
m_ui->GetLoadingScreen()->SetProgress(0.05f, RT_LOADING_PROCESSING);
|
||||
CLevelParser levelParser(m_levelCategory, m_levelChap, m_levelRank);
|
||||
levelParser.Load();
|
||||
int numObjects = levelParser.CountLines("CreateObject");
|
||||
m_ui->GetLoadingScreen()->SetProgress(0.1f, RT_LOADING_LEVEL_SETTINGS);
|
||||
|
||||
int rankObj = 0;
|
||||
int rankGadget = 0;
|
||||
|
@ -3039,7 +3046,9 @@ void CRobotMain::CreateScene(bool soluce, bool fixScene, bool resetObject)
|
|||
|
||||
if (line->GetCommand() == "CacheAudio" && !resetObject)
|
||||
{
|
||||
m_sound->CacheMusic(std::string("../")+line->GetParam("filename")->AsPath("music"));
|
||||
std::string filename = line->GetParam("filename")->AsPath("music");
|
||||
m_ui->GetLoadingScreen()->SetProgress(0.15f, RT_LOADING_MUSIC, filename);
|
||||
m_sound->CacheMusic(std::string("../")+filename);
|
||||
continue;
|
||||
}
|
||||
|
||||
|
@ -3047,6 +3056,7 @@ void CRobotMain::CreateScene(bool soluce, bool fixScene, bool resetObject)
|
|||
{
|
||||
auto audioChange = MakeUnique<CAudioChangeCondition>();
|
||||
audioChange->Read(line.get());
|
||||
m_ui->GetLoadingScreen()->SetProgress(0.15f, RT_LOADING_MUSIC, CResourceManager::CleanPath("music/"+audioChange->music));
|
||||
m_sound->CacheMusic(audioChange->music);
|
||||
m_audioChange.push_back(std::move(audioChange));
|
||||
continue;
|
||||
|
@ -3076,7 +3086,7 @@ void CRobotMain::CreateScene(bool soluce, bool fixScene, bool resetObject)
|
|||
{
|
||||
if (line->GetParam("filename")->IsDefined())
|
||||
{
|
||||
m_audioTrack = std::string("../")+line->GetParam("filename")->AsPath("music");
|
||||
m_audioTrack = "../"+line->GetParam("filename")->AsPath("music");
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -3090,7 +3100,7 @@ void CRobotMain::CreateScene(bool soluce, bool fixScene, bool resetObject)
|
|||
|
||||
if (line->GetParam("satcom")->IsDefined())
|
||||
{
|
||||
m_satcomTrack = std::string("../")+line->GetParam("satcom")->AsPath("music");
|
||||
m_satcomTrack = "../"+line->GetParam("satcom")->AsPath("music");
|
||||
m_satcomRepeat = line->GetParam("satcomRepeat")->AsBool(true);
|
||||
}
|
||||
else
|
||||
|
@ -3100,7 +3110,7 @@ void CRobotMain::CreateScene(bool soluce, bool fixScene, bool resetObject)
|
|||
|
||||
if (line->GetParam("editor")->IsDefined())
|
||||
{
|
||||
m_editorTrack = std::string("../")+line->GetParam("editor")->AsPath("music");
|
||||
m_editorTrack = "../"+line->GetParam("editor")->AsPath("music");
|
||||
m_editorRepeat = line->GetParam("editorRepeat")->AsBool(true);
|
||||
}
|
||||
else
|
||||
|
@ -3108,9 +3118,21 @@ void CRobotMain::CreateScene(bool soluce, bool fixScene, bool resetObject)
|
|||
m_editorTrack = "";
|
||||
}
|
||||
|
||||
if (!m_audioTrack.empty()) m_sound->CacheMusic(m_audioTrack);
|
||||
if (!m_satcomTrack.empty()) m_sound->CacheMusic(m_satcomTrack);
|
||||
if (!m_editorTrack.empty()) m_sound->CacheMusic(m_editorTrack);
|
||||
if (!m_audioTrack.empty())
|
||||
{
|
||||
m_ui->GetLoadingScreen()->SetProgress(0.15f, RT_LOADING_MUSIC, CResourceManager::CleanPath("music/"+m_audioTrack));
|
||||
m_sound->CacheMusic(m_audioTrack);
|
||||
}
|
||||
if (!m_satcomTrack.empty())
|
||||
{
|
||||
m_sound->CacheMusic(m_satcomTrack);
|
||||
m_ui->GetLoadingScreen()->SetProgress(0.15f, RT_LOADING_MUSIC, CResourceManager::CleanPath("music/"+m_satcomTrack));
|
||||
}
|
||||
if (!m_editorTrack.empty())
|
||||
{
|
||||
m_sound->CacheMusic(m_editorTrack);
|
||||
m_ui->GetLoadingScreen()->SetProgress(0.15f, RT_LOADING_MUSIC, CResourceManager::CleanPath("music/"+m_editorTrack));
|
||||
}
|
||||
continue;
|
||||
}
|
||||
|
||||
|
@ -3177,15 +3199,13 @@ void CRobotMain::CreateScene(bool soluce, bool fixScene, bool resetObject)
|
|||
|
||||
if (line->GetCommand() == "Background" && !resetObject)
|
||||
{
|
||||
std::string path = "";
|
||||
if (line->GetParam("image")->IsDefined())
|
||||
path = line->GetParam("image")->AsPath("textures");
|
||||
m_engine->SetBackground(path.c_str(),
|
||||
line->GetParam("up")->AsColor(Gfx::Color(0.0f, 0.0f, 0.0f, 0.0f)),
|
||||
line->GetParam("down")->AsColor(Gfx::Color(0.0f, 0.0f, 0.0f, 0.0f)),
|
||||
line->GetParam("cloudUp")->AsColor(Gfx::Color(0.0f, 0.0f, 0.0f, 0.0f)),
|
||||
line->GetParam("cloudDown")->AsColor(Gfx::Color(0.0f, 0.0f, 0.0f, 0.0f)),
|
||||
line->GetParam("full")->AsBool(false));
|
||||
backgroundPath = line->GetParam("image")->AsPath("textures");
|
||||
backgroundUp = line->GetParam("up")->AsColor(backgroundUp);
|
||||
backgroundDown = line->GetParam("down")->AsColor(backgroundDown);
|
||||
backgroundCloudUp = line->GetParam("cloudUp")->AsColor(backgroundCloudUp);
|
||||
backgroundCloudDown = line->GetParam("cloudDown")->AsColor(backgroundCloudDown);
|
||||
backgroundFull = line->GetParam("full")->AsBool(backgroundFull);
|
||||
continue;
|
||||
}
|
||||
|
||||
|
@ -3229,6 +3249,7 @@ void CRobotMain::CreateScene(bool soluce, bool fixScene, bool resetObject)
|
|||
|
||||
if (line->GetCommand() == "TerrainGenerate" && !resetObject)
|
||||
{
|
||||
m_ui->GetLoadingScreen()->SetProgress(0.2f, RT_LOADING_TERRAIN);
|
||||
m_terrain->Generate(line->GetParam("mosaic")->AsInt(20),
|
||||
line->GetParam("brick")->AsInt(3),
|
||||
line->GetParam("size")->AsFloat(20.0f),
|
||||
|
@ -3422,7 +3443,14 @@ void CRobotMain::CreateScene(bool soluce, bool fixScene, bool resetObject)
|
|||
ChangeColor(); // changes the colors of texture
|
||||
|
||||
if (!m_sceneReadPath.empty()) // loading file ?
|
||||
{
|
||||
m_ui->GetLoadingScreen()->SetProgress(0.25f, RT_LOADING_OBJECTS_SAVED);
|
||||
sel = IOReadScene(m_sceneReadPath + "/data.sav", m_sceneReadPath + "/cbot.run");
|
||||
}
|
||||
else
|
||||
{
|
||||
m_ui->GetLoadingScreen()->SetProgress(0.25f, RT_LOADING_OBJECTS);
|
||||
}
|
||||
|
||||
continue;
|
||||
}
|
||||
|
@ -3472,6 +3500,15 @@ void CRobotMain::CreateScene(bool soluce, bool fixScene, bool resetObject)
|
|||
if (!TestGadgetQuantity(rankGadget++)) continue;
|
||||
}
|
||||
|
||||
|
||||
float objectProgress = static_cast<float>(rankObj) / static_cast<float>(numObjects);
|
||||
std::string details = StrUtils::ToString<int>(rankObj+1)+" / "+StrUtils::ToString<int>(numObjects);
|
||||
#if DEV_BUILD
|
||||
// Object categories may spoil the level a bit, so hide them in release builds
|
||||
details += ": "+CLevelParserParam::FromObjectType(type);
|
||||
#endif
|
||||
m_ui->GetLoadingScreen()->SetProgress(0.25f+objectProgress*0.5f, RT_LOADING_OBJECTS, details);
|
||||
|
||||
Math::Vector pos = line->GetParam("pos")->AsPoint()*g_unit;
|
||||
float dirAngle = line->GetParam("dir")->AsFloat(0.0f)*Math::PI;
|
||||
bool trainer;
|
||||
|
@ -3747,7 +3784,6 @@ void CRobotMain::CreateScene(bool soluce, bool fixScene, bool resetObject)
|
|||
m_map->FloorColorMap(line->GetParam("floor")->AsColor(Gfx::Color(0.533f, 0.533f, 0.533f, 0.533f)),
|
||||
line->GetParam("water")->AsColor(Gfx::Color(0.533f, 0.533f, 0.533f, 0.533f)));
|
||||
m_mapShow = line->GetParam("show")->AsBool(true);
|
||||
m_map->ShowMap(m_mapShow);
|
||||
m_map->SetToy(line->GetParam("toyIcon")->AsBool(false));
|
||||
m_mapImage = line->GetParam("image")->AsBool(false);
|
||||
if (m_mapImage)
|
||||
|
@ -3873,6 +3909,18 @@ void CRobotMain::CreateScene(bool soluce, bool fixScene, bool resetObject)
|
|||
if (m_sceneReadPath.empty())
|
||||
CompileScript(soluce); // compiles all scripts
|
||||
|
||||
m_ui->GetLoadingScreen()->SetProgress(1.0f, RT_LOADING_FINISHED);
|
||||
|
||||
if (!resetObject)
|
||||
{
|
||||
m_engine->SetBackground(backgroundPath,
|
||||
backgroundUp,
|
||||
backgroundDown,
|
||||
backgroundCloudUp,
|
||||
backgroundCloudDown,
|
||||
backgroundFull);
|
||||
}
|
||||
|
||||
if (m_levelCategory == LevelCategory::Missions && !resetObject) // mission?
|
||||
{
|
||||
m_playerProfile->SetFreeGameResearchUnlock(m_playerProfile->GetFreeGameResearchUnlock() | m_researchDone[0]);
|
||||
|
@ -3896,7 +3944,7 @@ void CRobotMain::CreateScene(bool soluce, bool fixScene, bool resetObject)
|
|||
m_short->SetMode(false); // vehicles?
|
||||
}
|
||||
|
||||
CreateShortcuts();
|
||||
m_map->ShowMap(m_mapShow);
|
||||
m_map->UpdateMap();
|
||||
// TODO: m_engine->TimeInit(); ??
|
||||
m_input->ResetKeyStates();
|
||||
|
@ -3949,6 +3997,9 @@ void CRobotMain::CreateScene(bool soluce, bool fixScene, bool resetObject)
|
|||
|
||||
if (m_app->GetSceneTestMode())
|
||||
m_eventQueue->AddEvent(Event(EVENT_QUIT));
|
||||
|
||||
m_ui->ShowLoadingScreen(false);
|
||||
CreateShortcuts();
|
||||
}
|
||||
|
||||
void CRobotMain::LevelLoadingError(const std::string& error, const std::runtime_error& exception, Phase exitPhase)
|
||||
|
@ -4614,17 +4665,19 @@ void CRobotMain::FrameShowLimit(float rTime)
|
|||
//! Compiles all scripts of robots
|
||||
void CRobotMain::CompileScript(bool soluce)
|
||||
{
|
||||
int nbError = 0;
|
||||
int lastError = 0;
|
||||
m_ui->GetLoadingScreen()->SetProgress(0.75f, RT_LOADING_PROGRAMS);
|
||||
|
||||
int numObjects = m_objMan->CountObjectsImplementing(ObjectInterfaceType::Programmable);
|
||||
int objCounter = 0;
|
||||
|
||||
do
|
||||
{
|
||||
lastError = nbError;
|
||||
nbError = 0;
|
||||
for (CObject* obj : m_objMan->GetAllObjects())
|
||||
{
|
||||
if (! obj->Implements(ObjectInterfaceType::Programmable)) continue;
|
||||
|
||||
float objectProgress = static_cast<float>(objCounter) / static_cast<float>(numObjects);
|
||||
m_ui->GetLoadingScreen()->SetProgress(0.75f+objectProgress*0.25f, RT_LOADING_PROGRAMS, "for object "+StrUtils::ToString<int>(objCounter+1)+" / "+StrUtils::ToString<int>(numObjects));
|
||||
objCounter++;
|
||||
|
||||
CBrain* brain = dynamic_cast<CProgrammableObject*>(obj)->GetBrain();
|
||||
for (auto& prog : brain->GetPrograms())
|
||||
{
|
||||
|
@ -4637,28 +4690,19 @@ void CRobotMain::CompileScript(bool soluce)
|
|||
{
|
||||
GetLogger()->Error("Unable to read script from file \"%s\"\n", name.c_str());
|
||||
}
|
||||
if (!brain->GetCompile(program)) nbError++;
|
||||
//? if (!brain->GetCompile(program)) nbError++;
|
||||
}
|
||||
|
||||
LoadOneScript(obj, nbError);
|
||||
}
|
||||
}
|
||||
while (nbError > 0 && nbError != lastError);
|
||||
|
||||
// Load all solutions.
|
||||
if (soluce)
|
||||
{
|
||||
for (CObject* obj : m_objMan->GetAllObjects())
|
||||
{
|
||||
if (! obj->Implements(ObjectInterfaceType::Programmable)) continue;
|
||||
|
||||
CBrain* brain = dynamic_cast<CProgrammableObject*>(obj)->GetBrain();
|
||||
char* name = brain->GetSoluceName();
|
||||
if (name[0] != 0)
|
||||
{
|
||||
brain->ReadSoluce(name); // load solution
|
||||
}
|
||||
}
|
||||
|
||||
LoadOneScript(obj);
|
||||
}
|
||||
|
||||
// Start all programs according to the command "run".
|
||||
|
@ -4676,7 +4720,7 @@ void CRobotMain::CompileScript(bool soluce)
|
|||
}
|
||||
|
||||
//! Load all programs of the robot
|
||||
void CRobotMain::LoadOneScript(CObject *obj, int &nbError)
|
||||
void CRobotMain::LoadOneScript(CObject *obj)
|
||||
{
|
||||
if (! obj->Implements(ObjectInterfaceType::Programmable)) return;
|
||||
|
||||
|
@ -4693,8 +4737,6 @@ void CRobotMain::LoadOneScript(CObject *obj, int &nbError)
|
|||
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, m_levelChap, m_levelRank, objRank, i);
|
||||
std::string filename = m_playerProfile->GetSaveFile(file);
|
||||
|
@ -4704,14 +4746,13 @@ void CRobotMain::LoadOneScript(CObject *obj, int &nbError)
|
|||
Program* program = brain->GetOrAddProgram(i);
|
||||
if(brain->GetCompile(program)) continue; // If already loaded (e.g. from level file), skip
|
||||
brain->ReadProgram(program, filename.c_str());
|
||||
if (!brain->GetCompile(program)) nbError++;
|
||||
//? if (!brain->GetCompile(program)) nbError++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//! Load all programs of the robot
|
||||
void CRobotMain::LoadFileScript(CObject *obj, const char* filename, int objRank,
|
||||
int &nbError)
|
||||
void CRobotMain::LoadFileScript(CObject *obj, const char* filename, int objRank)
|
||||
{
|
||||
if (objRank == -1) return;
|
||||
|
||||
|
@ -4733,7 +4774,7 @@ void CRobotMain::LoadFileScript(CObject *obj, const char* filename, int objRank,
|
|||
{
|
||||
Program* program = brain->GetOrAddProgram(i);
|
||||
brain->ReadProgram(program, fn);
|
||||
if (!brain->GetCompile(program)) nbError++;
|
||||
//? if (!brain->GetCompile(program)) nbError++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -5131,7 +5172,7 @@ void CRobotMain::IOWriteSceneFinished()
|
|||
}
|
||||
|
||||
//! Resumes the game
|
||||
CObject* CRobotMain::IOReadObject(CLevelParserLine *line, const char* filename, int objRank)
|
||||
CObject* CRobotMain::IOReadObject(CLevelParserLine *line, const char* filename, const std::string& objCounterText, float objectProgress, int objRank)
|
||||
{
|
||||
Math::Vector pos = line->GetParam("pos")->AsPoint()*g_unit;
|
||||
Math::Vector dir = line->GetParam("angle")->AsPoint()*(Math::PI/180.0f);
|
||||
|
@ -5140,6 +5181,13 @@ CObject* CRobotMain::IOReadObject(CLevelParserLine *line, const char* filename,
|
|||
ObjectType type = line->GetParam("type")->AsObjectType();
|
||||
int id = line->GetParam("id")->AsInt();
|
||||
|
||||
std::string details = objCounterText;
|
||||
#if DEV_BUILD
|
||||
// Object categories may spoil the level a bit, so hide them in release builds
|
||||
details += ": "+CLevelParserParam::FromObjectType(type);
|
||||
#endif
|
||||
m_ui->GetLoadingScreen()->SetProgress(0.25f+objectProgress*0.5f, RT_LOADING_OBJECTS_SAVED, details);
|
||||
|
||||
bool trainer = line->GetParam("trainer")->AsBool(false);
|
||||
bool toy = line->GetParam("toy")->AsBool(false);
|
||||
int option = line->GetParam("option")->AsInt(0);
|
||||
|
@ -5222,6 +5270,7 @@ CObject* CRobotMain::IOReadScene(std::string filename, std::string filecbot)
|
|||
{
|
||||
CLevelParser levelParser(filename);
|
||||
levelParser.Load();
|
||||
int numObjects = levelParser.CountLines("CreateObject") + levelParser.CountLines("CreatePower") + levelParser.CountLines("CreateFret");
|
||||
|
||||
m_base = nullptr;
|
||||
|
||||
|
@ -5229,6 +5278,7 @@ CObject* CRobotMain::IOReadScene(std::string filename, std::string filecbot)
|
|||
CObject* power = nullptr;
|
||||
CObject* sel = nullptr;
|
||||
int objRank = 0;
|
||||
int objCounter = 0;
|
||||
for (auto& line : levelParser.GetLines())
|
||||
{
|
||||
if (line->GetCommand() == "Map")
|
||||
|
@ -5247,14 +5297,20 @@ CObject* CRobotMain::IOReadScene(std::string filename, std::string filecbot)
|
|||
}
|
||||
|
||||
if (line->GetCommand() == "CreateFret")
|
||||
cargo = IOReadObject(line.get(), filename.c_str(), -1);
|
||||
{
|
||||
cargo = IOReadObject(line.get(), filename.c_str(), StrUtils::ToString<int>(objCounter+1)+" / "+StrUtils::ToString<int>(numObjects), static_cast<float>(objCounter) / static_cast<float>(numObjects), -1);
|
||||
objCounter++;
|
||||
}
|
||||
|
||||
if (line->GetCommand() == "CreatePower")
|
||||
power = IOReadObject(line.get(), filename.c_str(), -1);
|
||||
{
|
||||
power = IOReadObject(line.get(), filename.c_str(), StrUtils::ToString<int>(objCounter+1)+" / "+StrUtils::ToString<int>(numObjects), static_cast<float>(objCounter) / static_cast<float>(numObjects), -1);
|
||||
objCounter++;
|
||||
}
|
||||
|
||||
if (line->GetCommand() == "CreateObject")
|
||||
{
|
||||
CObject* obj = IOReadObject(line.get(), filename.c_str(), objRank++);
|
||||
CObject* obj = IOReadObject(line.get(), filename.c_str(), StrUtils::ToString<int>(objCounter+1)+" / "+StrUtils::ToString<int>(numObjects), static_cast<float>(objCounter) / static_cast<float>(numObjects), objRank++);
|
||||
|
||||
if (line->GetParam("select")->AsBool(false))
|
||||
sel = obj;
|
||||
|
@ -5278,30 +5334,31 @@ CObject* CRobotMain::IOReadScene(std::string filename, std::string filecbot)
|
|||
}
|
||||
cargo = nullptr;
|
||||
power = nullptr;
|
||||
|
||||
objCounter++;
|
||||
}
|
||||
}
|
||||
|
||||
// Compiles scripts.
|
||||
int nbError = 0;
|
||||
int lastError = 0;
|
||||
do
|
||||
{
|
||||
lastError = nbError;
|
||||
nbError = 0;
|
||||
m_ui->GetLoadingScreen()->SetProgress(0.75f, RT_LOADING_PROGRAMS);
|
||||
numObjects = m_objMan->CountObjectsImplementing(ObjectInterfaceType::Programmable);
|
||||
objCounter = 0;
|
||||
|
||||
for (CObject* obj : m_objMan->GetAllObjects())
|
||||
{
|
||||
if (IsObjectBeingTransported(obj)) continue;
|
||||
if (! obj->Implements(ObjectInterfaceType::Programmable)) continue;
|
||||
|
||||
float objectProgress = static_cast<float>(objCounter) / static_cast<float>(numObjects);
|
||||
m_ui->GetLoadingScreen()->SetProgress(0.75f+objectProgress*0.2f, RT_LOADING_PROGRAMS, "for object "+StrUtils::ToString<int>(objCounter+1)+" / "+StrUtils::ToString<int>(numObjects));
|
||||
objCounter++;
|
||||
|
||||
if (IsObjectBeingTransported(obj)) continue; // TODO: WTF, programmable transportable objects?
|
||||
|
||||
if (obj->Implements(ObjectInterfaceType::Programmable))
|
||||
{
|
||||
objRank = obj->GetDefRank();
|
||||
if (objRank == -1) continue;
|
||||
|
||||
LoadFileScript(obj, filename.c_str(), objRank, nbError);
|
||||
LoadFileScript(obj, filename.c_str(), objRank);
|
||||
}
|
||||
}
|
||||
}
|
||||
while (nbError > 0 && nbError != lastError);
|
||||
|
||||
// Starts scripts
|
||||
for (CObject* obj : m_objMan->GetAllObjects())
|
||||
|
@ -5318,6 +5375,8 @@ CObject* CRobotMain::IOReadScene(std::string filename, std::string filecbot)
|
|||
}
|
||||
}
|
||||
|
||||
m_ui->GetLoadingScreen()->SetProgress(0.95f, RT_LOADING_CBOT_SAVE);
|
||||
|
||||
// Reads the file of stacks of execution.
|
||||
FILE* file = fOpen((CResourceManager::GetSaveLocation() + "/" + filecbot).c_str(), "rb");
|
||||
if (file != NULL)
|
||||
|
@ -5346,6 +5405,8 @@ CObject* CRobotMain::IOReadScene(std::string filename, std::string filecbot)
|
|||
fClose(file);
|
||||
}
|
||||
|
||||
m_ui->GetLoadingScreen()->SetProgress(1.0f, RT_LOADING_FINISHED);
|
||||
|
||||
return sel;
|
||||
}
|
||||
|
||||
|
@ -5879,6 +5940,7 @@ void CRobotMain::UpdateSpeedLabel()
|
|||
bool CRobotMain::CreateShortcuts()
|
||||
{
|
||||
if (m_phase != PHASE_SIMUL) return false;
|
||||
if (m_ui->GetLoadingScreen()->IsVisible()) return false;
|
||||
if (!m_shortCut) return false;
|
||||
return m_short->CreateShortcuts();
|
||||
}
|
||||
|
@ -5892,7 +5954,7 @@ void CRobotMain::UpdateMap()
|
|||
//! Indicates whether the mini-map is visible
|
||||
bool CRobotMain::GetShowMap()
|
||||
{
|
||||
return m_map->GetShowMap() && m_mapShow;
|
||||
return m_mapShow;
|
||||
}
|
||||
|
||||
|
||||
|
@ -5902,7 +5964,7 @@ void CRobotMain::SetMovieLock(bool lock)
|
|||
m_movieLock = lock;
|
||||
|
||||
CreateShortcuts();
|
||||
m_map->ShowMap(!m_movieLock && m_mapShow);
|
||||
m_map->ShowMap(!m_movieLock && m_mapShow && !m_ui->GetLoadingScreen()->IsVisible());
|
||||
if (m_movieLock) HiliteClear();
|
||||
}
|
||||
|
||||
|
|
|
@ -50,7 +50,6 @@ enum Phase
|
|||
PHASE_APPERANCE,
|
||||
PHASE_MAIN_MENU,
|
||||
PHASE_LEVEL_LIST,
|
||||
PHASE_LOADING,
|
||||
PHASE_SIMUL,
|
||||
PHASE_SETUPd,
|
||||
PHASE_SETUPg,
|
||||
|
@ -273,8 +272,8 @@ public:
|
|||
void FrameShowLimit(float rTime);
|
||||
|
||||
void CompileScript(bool soluce);
|
||||
void LoadOneScript(CObject *pObj, int &nerror);
|
||||
void LoadFileScript(CObject *pObj, const char* filename, int objRank, int &nerror);
|
||||
void LoadOneScript(CObject *pObj);
|
||||
void LoadFileScript(CObject *pObj, const char* filename, int objRank);
|
||||
void SaveAllScript();
|
||||
void SaveOneScript(CObject *pObj);
|
||||
void SaveFileScript(CObject *pObj, const char* filename, int objRank);
|
||||
|
@ -293,7 +292,7 @@ public:
|
|||
void IOWriteSceneFinished();
|
||||
CObject* IOReadScene(std::string filename, std::string filecbot);
|
||||
void IOWriteObject(CLevelParserLine *line, CObject* obj);
|
||||
CObject* IOReadObject(CLevelParserLine *line, const char* filename, int objRank);
|
||||
CObject* IOReadObject(CLevelParserLine *line, const char* filename, const std::string& objCounterText, float objectProgress, int objRank);
|
||||
|
||||
int CreateSpot(Math::Vector pos, Gfx::Color color);
|
||||
|
||||
|
|
|
@ -125,7 +125,7 @@ bool CMainDialog::EventProcess(const Event &event)
|
|||
if ( pressedButton == EVENT_INTERFACE_AGAIN )
|
||||
{
|
||||
StopDialog();
|
||||
m_main->ChangePhase(PHASE_LOADING);
|
||||
m_main->ChangePhase(PHASE_SIMUL);
|
||||
}
|
||||
|
||||
if ( pressedButton == EVENT_DIALOG_OK )
|
||||
|
|
|
@ -39,7 +39,6 @@ CMainMap::CMainMap()
|
|||
m_event = CApplication::GetInstancePointer()->GetEventQueue();
|
||||
m_engine = Gfx::CEngine::GetInstancePointer();
|
||||
|
||||
m_mapMode = 1;
|
||||
m_bFixImage = false;
|
||||
}
|
||||
|
||||
|
@ -129,19 +128,18 @@ void CMainMap::ShowMap(bool bShow)
|
|||
if (pw == nullptr)
|
||||
return;
|
||||
|
||||
if (bShow)
|
||||
{
|
||||
DimMap();
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
pm = static_cast<CMap*>(pw->SearchControl(EVENT_OBJECT_MAP));
|
||||
if (pm != nullptr)
|
||||
pm->ClearState(STATE_VISIBLE);
|
||||
pm->SetState(STATE_VISIBLE, bShow);
|
||||
|
||||
ps = static_cast<CSlider*>(pw->SearchControl(EVENT_OBJECT_MAPZOOM));
|
||||
if (ps != nullptr)
|
||||
ps->ClearState(STATE_VISIBLE);
|
||||
ps->SetState(STATE_VISIBLE, bShow);
|
||||
|
||||
if (bShow)
|
||||
{
|
||||
DimMap();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -162,8 +160,6 @@ void CMainMap::DimMap()
|
|||
if (pm == nullptr)
|
||||
return;
|
||||
|
||||
pm->SetState(STATE_VISIBLE, (m_mapMode != 0));
|
||||
|
||||
dim.x = 100.0f/640.0f;
|
||||
dim.y = 100.0f/480.0f;
|
||||
pos.x = 540.0f/640.0f;
|
||||
|
@ -174,8 +170,6 @@ void CMainMap::DimMap()
|
|||
ps = static_cast<CSlider*>(pw->SearchControl(EVENT_OBJECT_MAPZOOM));
|
||||
if (ps != nullptr)
|
||||
{
|
||||
ps->SetState(STATE_VISIBLE, (m_mapMode != 0));
|
||||
|
||||
dim.x = SCROLL_WIDTH;
|
||||
dim.y = 66.0f / 480.0f;
|
||||
pos.x = 523.0f / 640.0f;
|
||||
|
@ -349,13 +343,6 @@ void CMainMap::UpdateMap()
|
|||
pm->UpdateTerrain();
|
||||
}
|
||||
|
||||
// Indicates if the mini-map is visible.
|
||||
|
||||
bool CMainMap::GetShowMap()
|
||||
{
|
||||
return ( m_mapMode != 0 );
|
||||
}
|
||||
|
||||
// Indicates whether the mini-map displays a still image.
|
||||
|
||||
bool CMainMap::GetFixImage()
|
||||
|
@ -401,4 +388,3 @@ void CMainMap::SetHighlight(CObject* pObj)
|
|||
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -49,7 +49,6 @@ public:
|
|||
void ZoomMap(float zoom);
|
||||
void ZoomMap();
|
||||
void MapEnable(bool bEnable);
|
||||
bool GetShowMap();
|
||||
bool GetFixImage();
|
||||
CObject* DetectMap(Math::Point pos, bool &bInMap);
|
||||
void SetHighlight(CObject* pObj);
|
||||
|
@ -64,7 +63,6 @@ protected:
|
|||
Gfx::CEngine* m_engine;
|
||||
CInterface* m_interface;
|
||||
|
||||
int m_mapMode;
|
||||
bool m_bFixImage;
|
||||
};
|
||||
|
||||
|
|
|
@ -63,11 +63,12 @@ namespace Ui
|
|||
|
||||
CMainUserInterface::CMainUserInterface()
|
||||
{
|
||||
m_app = CApplication::GetInstancePointer();
|
||||
m_main = CRobotMain::GetInstancePointer();
|
||||
m_engine = Gfx::CEngine::GetInstancePointer();
|
||||
m_particle = m_engine->GetParticle();
|
||||
m_interface = m_main->GetInterface();
|
||||
m_sound = CApplication::GetInstancePointer()->GetSound();
|
||||
m_sound = m_app->GetSound();
|
||||
m_settings = CSettings::GetInstancePointer();
|
||||
|
||||
m_dialog = MakeUnique<CMainDialog>();
|
||||
|
@ -112,6 +113,27 @@ CMainDialog* CMainUserInterface::GetDialog()
|
|||
return m_dialog.get();
|
||||
}
|
||||
|
||||
void CMainUserInterface::ShowLoadingScreen(bool show)
|
||||
{
|
||||
if (show)
|
||||
{
|
||||
m_app->SetMouseMode(MOUSE_NONE);
|
||||
m_currentScreen = m_screenLoading.get();
|
||||
m_screenLoading->CreateInterface();
|
||||
}
|
||||
else
|
||||
{
|
||||
m_screenLoading->DestroyInterface();
|
||||
m_currentScreen = nullptr;
|
||||
m_app->SetMouseMode(m_settings->GetSystemMouse() ? MOUSE_SYSTEM : MOUSE_ENGINE);
|
||||
}
|
||||
}
|
||||
|
||||
CScreenLoading* CMainUserInterface::GetLoadingScreen()
|
||||
{
|
||||
return m_screenLoading.get();
|
||||
}
|
||||
|
||||
|
||||
// Changes phase.
|
||||
|
||||
|
@ -162,10 +184,6 @@ void CMainUserInterface::ChangePhase(Phase phase)
|
|||
m_screenLevelList->SetLevelCategory(m_main->GetLevelCategory());
|
||||
m_currentScreen = m_screenLevelList.get();
|
||||
}
|
||||
if (m_phase == PHASE_LOADING)
|
||||
{
|
||||
m_currentScreen = m_screenLoading.get();
|
||||
}
|
||||
if (m_phase >= PHASE_SETUPd && m_phase <= PHASE_SETUPs)
|
||||
{
|
||||
CScreenSetup* screenSetup = GetSetupScreen(m_phase);
|
||||
|
|
|
@ -23,6 +23,7 @@
|
|||
#include <vector>
|
||||
|
||||
|
||||
class CApplication;
|
||||
class CSettings;
|
||||
class CSoundInterface;
|
||||
|
||||
|
@ -64,6 +65,9 @@ public:
|
|||
|
||||
CMainDialog* GetDialog();
|
||||
|
||||
void ShowLoadingScreen(bool show);
|
||||
CScreenLoading* GetLoadingScreen();
|
||||
|
||||
bool EventProcess(const Event &event);
|
||||
void ChangePhase(Phase phase);
|
||||
|
||||
|
@ -90,6 +94,7 @@ protected:
|
|||
CScreenSetup* GetSetupScreen(Phase phase);
|
||||
|
||||
protected:
|
||||
CApplication* m_app;
|
||||
CRobotMain* m_main;
|
||||
Gfx::CEngine* m_engine;
|
||||
Gfx::CParticle* m_particle;
|
||||
|
|
|
@ -167,7 +167,7 @@ bool CScreenIORead::EventProcess(const Event &event)
|
|||
if(m_inSimulation)
|
||||
{
|
||||
m_main->StopSuspend();
|
||||
m_main->ChangePhase(PHASE_LOADING);
|
||||
m_main->ChangePhase(PHASE_SIMUL);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -294,7 +294,7 @@ bool CScreenLevelList::EventProcess(const Event &event)
|
|||
|
||||
case EVENT_INTERFACE_PLAY:
|
||||
m_main->SetLevel(m_category, m_chap[m_category]+1, m_sel[m_category]+1);
|
||||
m_main->ChangePhase(PHASE_LOADING);
|
||||
m_main->ChangePhase(PHASE_SIMUL);
|
||||
break;
|
||||
|
||||
case EVENT_INTERFACE_READ:
|
||||
|
|
|
@ -19,10 +19,13 @@
|
|||
|
||||
#include "ui/screen/screen_loading.h"
|
||||
|
||||
#include "common/config.h"
|
||||
|
||||
#include "app/app.h"
|
||||
|
||||
#include "ui/controls/button.h"
|
||||
#include "ui/controls/edit.h"
|
||||
#include "ui/controls/gauge.h"
|
||||
#include "ui/controls/interface.h"
|
||||
#include "ui/controls/label.h"
|
||||
#include "ui/controls/window.h"
|
||||
|
@ -31,6 +34,7 @@ namespace Ui
|
|||
{
|
||||
|
||||
CScreenLoading::CScreenLoading()
|
||||
: m_visible(false)
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -68,24 +72,90 @@ void CScreenLoading::CreateInterface()
|
|||
pg = pw->CreateGroup(pos, ddim, 22, EVENT_NULL);
|
||||
pg->SetState(STATE_SHADOW);
|
||||
|
||||
pos.x = 220.0f/640.0f;
|
||||
pos.x = 257.5f/640.0f;
|
||||
pos.y = 210.0f/480.0f;
|
||||
ddim.x = 200.0f/640.0f;
|
||||
ddim.x = 125.0f/640.0f;
|
||||
ddim.y = 20.0f/480.0f;
|
||||
GetResource(RES_TEXT, RT_DIALOG_LOADING, name);
|
||||
pl = pw->CreateLabel(pos, ddim, 0, EVENT_LABEL1, name);
|
||||
pl->SetFontSize(12.0f);
|
||||
pl->SetTextAlign(Gfx::TEXT_ALIGN_CENTER);
|
||||
|
||||
pos.y -= ddim.y*1.75f;
|
||||
pl = pw->CreateLabel(pos, ddim, 0, EVENT_LABEL2, "");
|
||||
pl->SetTextAlign(Gfx::TEXT_ALIGN_CENTER);
|
||||
|
||||
pos.y -= ddim.y*1.0f;
|
||||
pl = pw->CreateLabel(pos, ddim, 0, EVENT_LABEL3, "");
|
||||
pl->SetTextAlign(Gfx::TEXT_ALIGN_CENTER);
|
||||
pl->SetFontSize(Gfx::FONT_SIZE_SMALL*0.75f);
|
||||
|
||||
pos.y -= ddim.y*2.0f;
|
||||
pw->CreateGauge(pos, ddim, 0, EVENT_LOADING);
|
||||
|
||||
SetBackground("textures/interface/interface.png");
|
||||
|
||||
m_engine->SetDrawWorld(false);
|
||||
m_app->Render();
|
||||
|
||||
m_visible = true;
|
||||
}
|
||||
|
||||
void CScreenLoading::DestroyInterface()
|
||||
{
|
||||
if (!m_visible) return;
|
||||
m_visible = false;
|
||||
|
||||
m_engine->SetBackForce(false);
|
||||
m_engine->SetDrawWorld(true);
|
||||
|
||||
m_interface->DeleteControl(EVENT_WINDOW5);
|
||||
}
|
||||
|
||||
bool CScreenLoading::EventProcess(const Event &event)
|
||||
{
|
||||
m_app->Render(); // render the frame once before we start loading
|
||||
m_main->ChangePhase(PHASE_SIMUL);
|
||||
return false; // Stop all events!
|
||||
}
|
||||
|
||||
return false;
|
||||
bool CScreenLoading::IsVisible()
|
||||
{
|
||||
return m_visible;
|
||||
}
|
||||
|
||||
void CScreenLoading::SetProgress(float progress, const std::string& text, const std::string& details)
|
||||
{
|
||||
if (!m_visible) return;
|
||||
|
||||
CWindow* pw = static_cast<CWindow*>(m_interface->SearchControl(EVENT_WINDOW5));
|
||||
if (pw == nullptr) return;
|
||||
|
||||
CLabel* pl = static_cast<CLabel*>(pw->SearchControl(EVENT_LABEL2));
|
||||
if (pl != nullptr)
|
||||
{
|
||||
pl->SetName(text);
|
||||
}
|
||||
|
||||
pl = static_cast<CLabel*>(pw->SearchControl(EVENT_LABEL3));
|
||||
if (pl != nullptr)
|
||||
{
|
||||
pl->SetName(details);
|
||||
}
|
||||
|
||||
CGauge* pg = static_cast<CGauge*>(pw->SearchControl(EVENT_LOADING));
|
||||
if (pg != nullptr)
|
||||
{
|
||||
pg->SetLevel(progress);
|
||||
}
|
||||
|
||||
SetBackground("textures/interface/interface.png");
|
||||
m_engine->SetBackForce(true);
|
||||
m_app->Render();
|
||||
}
|
||||
|
||||
void CScreenLoading::SetProgress(float progress, ResTextType text, const std::string& details)
|
||||
{
|
||||
std::string name;
|
||||
GetResource(RES_TEXT, text, name);
|
||||
SetProgress(progress, name, details);
|
||||
}
|
||||
|
||||
} // namespace Ui
|
||||
|
|
|
@ -21,6 +21,8 @@
|
|||
|
||||
#include "ui/screen/screen.h"
|
||||
|
||||
#include "common/restext.h"
|
||||
|
||||
namespace Ui
|
||||
{
|
||||
|
||||
|
@ -30,7 +32,16 @@ public:
|
|||
CScreenLoading();
|
||||
|
||||
void CreateInterface() override;
|
||||
void DestroyInterface();
|
||||
bool EventProcess(const Event &event) override;
|
||||
|
||||
bool IsVisible();
|
||||
|
||||
void SetProgress(float progress, const std::string& text, const std::string& details = "");
|
||||
void SetProgress(float progress, ResTextType text, const std::string& details = "");
|
||||
|
||||
protected:
|
||||
bool m_visible;
|
||||
};
|
||||
|
||||
} // namespace Ui
|
||||
|
|
Loading…
Reference in New Issue