CController - entry point into CRobotMain and CMainDialog
parent
4fef3af9ef
commit
986cf98aaf
|
@ -61,6 +61,7 @@ endif()
|
|||
# Source files
|
||||
set(BASE_SOURCES
|
||||
app/app.cpp
|
||||
app/controller.cpp
|
||||
app/input.cpp
|
||||
app/pausemanager.cpp
|
||||
app/system.cpp
|
||||
|
|
|
@ -21,6 +21,7 @@
|
|||
|
||||
#include "app/app.h"
|
||||
|
||||
#include "app/controller.h"
|
||||
#include "app/input.h"
|
||||
#include "app/system.h"
|
||||
|
||||
|
@ -108,16 +109,16 @@ CApplication::CApplication()
|
|||
m_profile = new CProfile();
|
||||
m_input = new CInput();
|
||||
|
||||
m_engine = nullptr;
|
||||
m_device = nullptr;
|
||||
m_modelManager = nullptr;
|
||||
m_robotMain = nullptr;
|
||||
m_sound = nullptr;
|
||||
m_engine = nullptr;
|
||||
m_device = nullptr;
|
||||
m_modelManager = nullptr;
|
||||
m_controller = nullptr;
|
||||
m_sound = nullptr;
|
||||
|
||||
m_exitCode = 0;
|
||||
m_active = false;
|
||||
m_debugModes = 0;
|
||||
m_restart = false;
|
||||
m_exitCode = 0;
|
||||
m_active = false;
|
||||
m_debugModes = 0;
|
||||
m_restart = false;
|
||||
|
||||
m_windowTitle = "Colobot: Gold Edition";
|
||||
|
||||
|
@ -588,14 +589,15 @@ bool CApplication::Create()
|
|||
m_modelManager = new Gfx::CModelManager(m_engine);
|
||||
|
||||
// Create the robot application.
|
||||
m_robotMain = new CRobotMain(this, !defaultValues);
|
||||
m_controller = new CController(this, !defaultValues);
|
||||
|
||||
if (defaultValues) m_robotMain->CreateIni();
|
||||
|
||||
if (! m_runSceneName.empty())
|
||||
m_robotMain->LoadSceneOnStart(m_runSceneName, m_runSceneRank);
|
||||
else
|
||||
m_robotMain->ChangePhase(PHASE_WELCOME1);
|
||||
if (m_runSceneName.empty())
|
||||
m_controller->StartApp();
|
||||
else {
|
||||
m_controller->GetRobotMain()->ChangePhase(PHASE_USER); // To load userlevel list - TODO: this is ugly
|
||||
m_controller->GetRobotMain()->SetExitAfterMission(true);
|
||||
m_controller->StartGame(m_runSceneName, m_runSceneRank/100, m_runSceneRank%100);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
@ -672,8 +674,8 @@ void CApplication::Destroy()
|
|||
{
|
||||
m_joystickEnabled = false;
|
||||
|
||||
delete m_robotMain;
|
||||
m_robotMain = nullptr;
|
||||
delete m_controller;
|
||||
m_controller = nullptr;
|
||||
|
||||
delete m_sound;
|
||||
m_sound = nullptr;
|
||||
|
@ -775,7 +777,7 @@ bool CApplication::ChangeVideoConfig(const Gfx::GLDeviceConfig &newConfig)
|
|||
( static_cast<Gfx::CGLDevice*>(m_device) )->ConfigChanged(m_deviceConfig);
|
||||
|
||||
m_engine->ResetAfterDeviceChanged();
|
||||
m_robotMain->ResetAfterDeviceChanged();
|
||||
m_controller->GetRobotMain()->ResetAfterDeviceChanged();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
@ -993,8 +995,8 @@ int CApplication::Run()
|
|||
if (m_engine != nullptr)
|
||||
passOn = m_engine->ProcessEvent(event);
|
||||
|
||||
if (passOn && m_robotMain != nullptr)
|
||||
m_robotMain->ProcessEvent(event);
|
||||
if (passOn && m_controller != nullptr)
|
||||
m_controller->ProcessEvent(event);
|
||||
}
|
||||
|
||||
StopPerformanceCounter(PCNT_EVENT_PROCESSING);
|
||||
|
@ -1003,14 +1005,14 @@ int CApplication::Run()
|
|||
|
||||
// Prepare and process step simulation event
|
||||
event = CreateUpdateEvent();
|
||||
if (event.type != EVENT_NULL && m_robotMain != nullptr)
|
||||
if (event.type != EVENT_NULL && m_controller != nullptr)
|
||||
{
|
||||
LogEvent(event);
|
||||
|
||||
m_sound->FrameMove(m_relTime);
|
||||
|
||||
StartPerformanceCounter(PCNT_UPDATE_GAME);
|
||||
m_robotMain->ProcessEvent(event);
|
||||
m_controller->ProcessEvent(event);
|
||||
StopPerformanceCounter(PCNT_UPDATE_GAME);
|
||||
|
||||
StartPerformanceCounter(PCNT_UPDATE_ENGINE);
|
||||
|
|
|
@ -40,7 +40,7 @@
|
|||
|
||||
class CInstanceManager;
|
||||
class CEventQueue;
|
||||
class CRobotMain;
|
||||
class CController;
|
||||
class CSoundInterface;
|
||||
class CInput;
|
||||
class CObjectManager;
|
||||
|
@ -373,8 +373,8 @@ protected:
|
|||
Gfx::CModelManager* m_modelManager;
|
||||
//! Sound subsystem
|
||||
CSoundInterface* m_sound;
|
||||
//! Main class of the proper game engine
|
||||
CRobotMain* m_robotMain;
|
||||
//! Game controller - game engine and UI
|
||||
CController* m_controller;
|
||||
//! Profile (INI) reader/writer
|
||||
CProfile* m_profile;
|
||||
//! Input manager
|
||||
|
|
|
@ -0,0 +1,88 @@
|
|||
/*
|
||||
* This file is part of the Colobot: Gold Edition source code
|
||||
* Copyright (C) 2001-2014, Daniel Roux, EPSITEC SA & TerranovaTeam
|
||||
* http://epsiteс.ch; http://colobot.info; http://github.com/colobot
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
* See the GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see http://gnu.org/licenses
|
||||
*/
|
||||
|
||||
#include "app/controller.h"
|
||||
|
||||
|
||||
#include "object/robotmain.h"
|
||||
|
||||
#include "ui/maindialog.h"
|
||||
|
||||
|
||||
template<> CController* CSingleton<CController>::m_instance = nullptr;
|
||||
|
||||
|
||||
CController::CController(CApplication* app, bool loadProfile)
|
||||
{
|
||||
m_app = app;
|
||||
m_main = new CRobotMain(this);
|
||||
m_dialog = new Ui::CMainDialog();
|
||||
|
||||
m_main->Create(loadProfile);
|
||||
m_dialog->Create();
|
||||
if (!loadProfile)
|
||||
m_main->CreateIni();
|
||||
else
|
||||
m_main->LoadIni();
|
||||
}
|
||||
|
||||
CController::~CController()
|
||||
{
|
||||
delete m_dialog;
|
||||
m_dialog = nullptr;
|
||||
|
||||
delete m_main;
|
||||
m_main = nullptr;
|
||||
|
||||
m_app = nullptr;
|
||||
}
|
||||
|
||||
CApplication* CController::GetApplication()
|
||||
{
|
||||
return m_app;
|
||||
}
|
||||
|
||||
CRobotMain* CController::GetRobotMain()
|
||||
{
|
||||
return m_main;
|
||||
}
|
||||
|
||||
Ui::CMainDialog* CController::GetMainDialog()
|
||||
{
|
||||
return m_dialog;
|
||||
}
|
||||
|
||||
void CController::StartApp()
|
||||
{
|
||||
m_main->ChangePhase(PHASE_WELCOME1);
|
||||
}
|
||||
|
||||
void CController::StartGame(std::string cat, int chap, int lvl)
|
||||
{
|
||||
m_dialog->SetSceneName(cat.c_str());
|
||||
m_dialog->SetSceneRank(chap*100+lvl);
|
||||
m_main->ChangePhase(PHASE_LOADING);
|
||||
}
|
||||
|
||||
void CController::ProcessEvent(Event& event)
|
||||
{
|
||||
bool passOn = m_dialog->EventProcess(event);
|
||||
if(passOn)
|
||||
m_main->ProcessEvent(event);
|
||||
}
|
|
@ -0,0 +1,65 @@
|
|||
/*
|
||||
* This file is part of the Colobot: Gold Edition source code
|
||||
* Copyright (C) 2001-2014, Daniel Roux, EPSITEC SA & TerranovaTeam
|
||||
* http://epsiteс.ch; http://colobot.info; http://github.com/colobot
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
* See the GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see http://gnu.org/licenses
|
||||
*/
|
||||
|
||||
/**
|
||||
* \file app/controller.h
|
||||
* \brief CController class
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "common/event.h"
|
||||
#include "common/singleton.h"
|
||||
|
||||
class CApplication;
|
||||
class CRobotMain;
|
||||
namespace Ui {
|
||||
class CMainDialog;
|
||||
}
|
||||
|
||||
/**
|
||||
* \class CController
|
||||
* \brief Entry point into CRobotMain and CMainDialog
|
||||
*/
|
||||
class CController : public CSingleton<CController>
|
||||
{
|
||||
public:
|
||||
CController(CApplication* app, bool loadProfile = true);
|
||||
~CController();
|
||||
|
||||
//! Return CApplication instance
|
||||
CApplication* GetApplication();
|
||||
//! Return CRobotMain instance
|
||||
CRobotMain* GetRobotMain();
|
||||
//! Return CMainDialog instance
|
||||
Ui::CMainDialog* GetMainDialog();
|
||||
|
||||
//! Event processing
|
||||
void ProcessEvent(Event &event);
|
||||
|
||||
//! Start the application
|
||||
void StartApp();
|
||||
//! Starts the simulation, loading the given scene
|
||||
void StartGame(std::string cat, int chap, int lvl);
|
||||
|
||||
private:
|
||||
CApplication* m_app;
|
||||
CRobotMain* m_main;
|
||||
Ui::CMainDialog* m_dialog;
|
||||
};
|
|
@ -23,6 +23,7 @@
|
|||
#include "CBot/CBotDll.h"
|
||||
|
||||
#include "app/app.h"
|
||||
#include "app/controller.h"
|
||||
#include "app/input.h"
|
||||
|
||||
#include "common/event.h"
|
||||
|
@ -120,35 +121,34 @@ float g_unit; // conversion factor
|
|||
|
||||
|
||||
//! Constructor of robot application
|
||||
CRobotMain::CRobotMain(CApplication* app, bool loadProfile)
|
||||
CRobotMain::CRobotMain(CController* controller)
|
||||
{
|
||||
m_app = app;
|
||||
m_ctrl = controller;
|
||||
m_app = nullptr;
|
||||
|
||||
m_eventQueue = m_app->GetEventQueue();
|
||||
m_sound = m_app->GetSound();
|
||||
m_eventQueue = nullptr;
|
||||
m_sound = nullptr;
|
||||
|
||||
m_engine = Gfx::CEngine::GetInstancePointer();
|
||||
m_lightMan = m_engine->GetLightManager();
|
||||
m_particle = m_engine->GetParticle();
|
||||
m_water = m_engine->GetWater();
|
||||
m_cloud = m_engine->GetCloud();
|
||||
m_lightning = m_engine->GetLightning();
|
||||
m_planet = m_engine->GetPlanet();
|
||||
m_pause = CPauseManager::GetInstancePointer();
|
||||
m_input = CInput::GetInstancePointer();
|
||||
m_engine = nullptr;
|
||||
m_lightMan = nullptr;
|
||||
m_particle = nullptr;
|
||||
m_water = nullptr;
|
||||
m_cloud = nullptr;
|
||||
m_lightning = nullptr;
|
||||
m_planet = nullptr;
|
||||
m_pause = nullptr;
|
||||
m_input = nullptr;
|
||||
|
||||
m_interface = new Ui::CInterface();
|
||||
m_terrain = new Gfx::CTerrain();
|
||||
m_camera = new Gfx::CCamera();
|
||||
m_displayText = new Ui::CDisplayText();
|
||||
m_movie = new CMainMovie();
|
||||
m_dialog = new Ui::CMainDialog();
|
||||
m_short = new Ui::CMainShort();
|
||||
m_map = new Ui::CMainMap();
|
||||
m_interface = nullptr;
|
||||
m_terrain = nullptr;
|
||||
m_camera = nullptr;
|
||||
m_displayText = nullptr;
|
||||
m_movie = nullptr;
|
||||
m_dialog = nullptr;
|
||||
m_short = nullptr;
|
||||
m_map = nullptr;
|
||||
m_displayInfo = nullptr;
|
||||
|
||||
m_engine->SetTerrain(m_terrain);
|
||||
|
||||
m_time = 0.0f;
|
||||
m_gameTime = 0.0f;
|
||||
|
||||
|
@ -199,10 +199,7 @@ CRobotMain::CRobotMain(CApplication* app, bool loadProfile)
|
|||
m_friendAim = false;
|
||||
m_resetCreate = false;
|
||||
m_shortCut = true;
|
||||
|
||||
m_engine->SetMovieLock(m_movieLock);
|
||||
|
||||
m_movie->Flush();
|
||||
|
||||
m_movieInfoIndex = -1;
|
||||
|
||||
m_tooltipPos = Math::Point(0.0f, 0.0f);
|
||||
|
@ -220,43 +217,6 @@ CRobotMain::CRobotMain(CApplication* app, bool loadProfile)
|
|||
m_autosaveSlots = 3;
|
||||
m_autosaveLast = 0.0f;
|
||||
|
||||
FlushDisplayInfo();
|
||||
|
||||
m_fontSize = 19.0f;
|
||||
m_windowPos = Math::Point(0.15f, 0.17f);
|
||||
m_windowDim = Math::Point(0.70f, 0.66f);
|
||||
|
||||
float fValue;
|
||||
int iValue;
|
||||
|
||||
if (loadProfile)
|
||||
{
|
||||
if (GetProfile().GetFloatProperty("Edit", "FontSize", fValue)) m_fontSize = fValue;
|
||||
if (GetProfile().GetFloatProperty("Edit", "WindowPosX", fValue)) m_windowPos.x = fValue;
|
||||
if (GetProfile().GetFloatProperty("Edit", "WindowPosY", fValue)) m_windowPos.y = fValue;
|
||||
if (GetProfile().GetFloatProperty("Edit", "WindowDimX", fValue)) m_windowDim.x = fValue;
|
||||
if (GetProfile().GetFloatProperty("Edit", "WindowDimY", fValue)) m_windowDim.y = fValue;
|
||||
}
|
||||
|
||||
m_IOPublic = false;
|
||||
m_IODim = Math::Point(320.0f/640.0f, (121.0f+18.0f*8)/480.0f);
|
||||
m_IOPos.x = (1.0f-m_IODim.x)/2.0f; // in the middle
|
||||
m_IOPos.y = (1.0f-m_IODim.y)/2.0f;
|
||||
|
||||
if (loadProfile)
|
||||
{
|
||||
if (GetProfile().GetIntProperty ("Edit", "IOPublic", iValue)) m_IOPublic = iValue;
|
||||
if (GetProfile().GetFloatProperty("Edit", "IOPosX", fValue)) m_IOPos.x = fValue;
|
||||
if (GetProfile().GetFloatProperty("Edit", "IOPosY", fValue)) m_IOPos.y = fValue;
|
||||
if (GetProfile().GetFloatProperty("Edit", "IODimX", fValue)) m_IODim.x = fValue;
|
||||
if (GetProfile().GetFloatProperty("Edit", "IODimY", fValue)) m_IODim.y = fValue;
|
||||
}
|
||||
|
||||
m_short->FlushShortcuts();
|
||||
InitEye();
|
||||
|
||||
m_engine->SetTracePrecision(1.0f);
|
||||
|
||||
m_cameraPan = 0.0f;
|
||||
m_cameraZoom = 0.0f;
|
||||
|
||||
|
@ -267,10 +227,6 @@ CRobotMain::CRobotMain(CApplication* app, bool loadProfile)
|
|||
g_unit = UNIT;
|
||||
|
||||
m_gamerName = "";
|
||||
if (loadProfile) GetProfile().GetStringProperty("Gamer", "LastName", m_gamerName);
|
||||
SetGlobalGamerName(m_gamerName);
|
||||
ReadFreeParam();
|
||||
if (loadProfile) m_dialog->SetupRecall();
|
||||
|
||||
for (int i = 0; i < MAXSHOWLIMIT; i++)
|
||||
{
|
||||
|
@ -278,6 +234,81 @@ CRobotMain::CRobotMain(CApplication* app, bool loadProfile)
|
|||
m_showLimit[i].total = 0;
|
||||
m_showLimit[i].link = 0;
|
||||
}
|
||||
}
|
||||
|
||||
void CRobotMain::Create(bool loadProfile)
|
||||
{
|
||||
m_app = m_ctrl->GetApplication();
|
||||
|
||||
m_eventQueue = m_app->GetEventQueue();
|
||||
m_sound = m_app->GetSound();
|
||||
|
||||
m_engine = Gfx::CEngine::GetInstancePointer();
|
||||
m_lightMan = m_engine->GetLightManager();
|
||||
m_particle = m_engine->GetParticle();
|
||||
m_water = m_engine->GetWater();
|
||||
m_cloud = m_engine->GetCloud();
|
||||
m_lightning = m_engine->GetLightning();
|
||||
m_planet = m_engine->GetPlanet();
|
||||
m_pause = CPauseManager::GetInstancePointer();
|
||||
m_input = CInput::GetInstancePointer();
|
||||
|
||||
m_interface = new Ui::CInterface();
|
||||
m_terrain = new Gfx::CTerrain();
|
||||
m_camera = new Gfx::CCamera();
|
||||
m_displayText = new Ui::CDisplayText();
|
||||
m_movie = new CMainMovie();
|
||||
m_dialog = m_ctrl->GetMainDialog();
|
||||
m_short = new Ui::CMainShort();
|
||||
m_map = new Ui::CMainMap();
|
||||
m_displayInfo = nullptr;
|
||||
|
||||
m_engine->SetTerrain(m_terrain);
|
||||
|
||||
m_engine->SetMovieLock(m_movieLock);
|
||||
|
||||
m_movie->Flush();
|
||||
|
||||
FlushDisplayInfo();
|
||||
|
||||
m_fontSize = 19.0f;
|
||||
m_windowPos = Math::Point(0.15f, 0.17f);
|
||||
m_windowDim = Math::Point(0.70f, 0.66f);
|
||||
|
||||
float fValue;
|
||||
int iValue;
|
||||
|
||||
if (loadProfile)
|
||||
{
|
||||
if (GetProfile().GetFloatProperty("Edit", "FontSize", fValue)) m_fontSize = fValue;
|
||||
if (GetProfile().GetFloatProperty("Edit", "WindowPosX", fValue)) m_windowPos.x = fValue;
|
||||
if (GetProfile().GetFloatProperty("Edit", "WindowPosY", fValue)) m_windowPos.y = fValue;
|
||||
if (GetProfile().GetFloatProperty("Edit", "WindowDimX", fValue)) m_windowDim.x = fValue;
|
||||
if (GetProfile().GetFloatProperty("Edit", "WindowDimY", fValue)) m_windowDim.y = fValue;
|
||||
}
|
||||
|
||||
m_IOPublic = false;
|
||||
m_IODim = Math::Point(320.0f/640.0f, (121.0f+18.0f*8)/480.0f);
|
||||
m_IOPos.x = (1.0f-m_IODim.x)/2.0f; // in the middle
|
||||
m_IOPos.y = (1.0f-m_IODim.y)/2.0f;
|
||||
|
||||
if (loadProfile)
|
||||
{
|
||||
if (GetProfile().GetIntProperty ("Edit", "IOPublic", iValue)) m_IOPublic = iValue;
|
||||
if (GetProfile().GetFloatProperty("Edit", "IOPosX", fValue)) m_IOPos.x = fValue;
|
||||
if (GetProfile().GetFloatProperty("Edit", "IOPosY", fValue)) m_IOPos.y = fValue;
|
||||
if (GetProfile().GetFloatProperty("Edit", "IODimX", fValue)) m_IODim.x = fValue;
|
||||
if (GetProfile().GetFloatProperty("Edit", "IODimY", fValue)) m_IODim.y = fValue;
|
||||
}
|
||||
|
||||
m_short->FlushShortcuts();
|
||||
InitEye();
|
||||
|
||||
m_engine->SetTracePrecision(1.0f);
|
||||
|
||||
if (loadProfile) GetProfile().GetStringProperty("Gamer", "LastName", m_gamerName);
|
||||
SetGlobalGamerName(m_gamerName);
|
||||
ReadFreeParam();
|
||||
|
||||
CScriptFunctions::m_filesDir = CResourceManager::GetSaveLocation()+"/"+m_dialog->GetFilesDir(); //TODO: Refactor to PHYSFS while rewriting CBot engine
|
||||
CScriptFunctions::Init();
|
||||
|
@ -304,18 +335,17 @@ CRobotMain::~CRobotMain()
|
|||
delete m_movie;
|
||||
m_movie = nullptr;
|
||||
|
||||
delete m_dialog;
|
||||
m_dialog = nullptr;
|
||||
|
||||
delete m_short;
|
||||
m_short = nullptr;
|
||||
|
||||
delete m_map;
|
||||
m_map = nullptr;
|
||||
|
||||
|
||||
m_dialog = nullptr;
|
||||
m_input = nullptr;
|
||||
m_pause = nullptr;
|
||||
m_app = nullptr;
|
||||
m_ctrl = nullptr;
|
||||
}
|
||||
|
||||
Gfx::CCamera* CRobotMain::GetCamera()
|
||||
|
@ -338,16 +368,6 @@ Ui::CDisplayText* CRobotMain::GetDisplayText()
|
|||
return m_displayText;
|
||||
}
|
||||
|
||||
void CRobotMain::LoadSceneOnStart(const std::string& name, int rank)
|
||||
{
|
||||
m_exitAfterMission = true;
|
||||
// TODO: fix this ugly dependency :(
|
||||
ChangePhase(PHASE_USER); // To load userlevel list
|
||||
m_dialog->SetSceneName(name.c_str());
|
||||
m_dialog->SetSceneRank(rank);
|
||||
ChangePhase(PHASE_LOADING);
|
||||
}
|
||||
|
||||
void CRobotMain::ResetAfterDeviceChanged()
|
||||
{
|
||||
if(m_phase == PHASE_SETUPds ||
|
||||
|
@ -382,6 +402,11 @@ void CRobotMain::CreateIni()
|
|||
GetProfile().Save();
|
||||
}
|
||||
|
||||
void CRobotMain::LoadIni()
|
||||
{
|
||||
m_dialog->SetupRecall();
|
||||
}
|
||||
|
||||
//! Changes phase
|
||||
void CRobotMain::ChangePhase(Phase phase)
|
||||
{
|
||||
|
@ -649,7 +674,6 @@ bool CRobotMain::ProcessEvent(Event &event)
|
|||
}
|
||||
}
|
||||
|
||||
m_dialog->EventProcess(event);
|
||||
m_displayText->EventProcess(event);
|
||||
RemoteCamera(m_cameraPan, m_cameraZoom, event.rTime);
|
||||
|
||||
|
@ -696,14 +720,10 @@ bool CRobotMain::ProcessEvent(Event &event)
|
|||
if (event.type == EVENT_SPEED)
|
||||
SetSpeed(1.0f);
|
||||
|
||||
if (!m_dialog->EventProcess(event))
|
||||
if (event.type == EVENT_MOUSE_MOVE)
|
||||
{
|
||||
if (event.type == EVENT_MOUSE_MOVE)
|
||||
{
|
||||
m_lastMousePos = event.mousePos;
|
||||
HiliteObject(event.mousePos);
|
||||
}
|
||||
return false;
|
||||
m_lastMousePos = event.mousePos;
|
||||
HiliteObject(event.mousePos);
|
||||
}
|
||||
|
||||
if (!m_displayText->EventProcess(event))
|
||||
|
@ -6186,4 +6206,9 @@ void CRobotMain::Autosave()
|
|||
IOWriteScene(savegameFileName.c_str(), fileCBot.c_str(), const_cast<char*>((std::string("[AUTOSAVE] ")+timestr).c_str()));
|
||||
|
||||
m_dialog->MakeSaveScreenshot(dir + "/screen.png");
|
||||
}
|
||||
|
||||
void CRobotMain::SetExitAfterMission(bool exit)
|
||||
{
|
||||
m_exitAfterMission = exit;
|
||||
}
|
|
@ -74,6 +74,7 @@ enum Phase
|
|||
};
|
||||
|
||||
|
||||
class CController;
|
||||
class CEventQueue;
|
||||
class CSoundInterface;
|
||||
class CLevelParserLine;
|
||||
|
@ -170,18 +171,18 @@ const int SATCOM_MAX = 6;
|
|||
class CRobotMain : public CSingleton<CRobotMain>
|
||||
{
|
||||
public:
|
||||
CRobotMain(CApplication* app, bool loadProfile);
|
||||
CRobotMain(CController* controller);
|
||||
virtual ~CRobotMain();
|
||||
|
||||
void Create(bool loadProfile = true);
|
||||
|
||||
Gfx::CCamera* GetCamera();
|
||||
Gfx::CTerrain* GetTerrain();
|
||||
Ui::CInterface* GetInterface();
|
||||
Ui::CDisplayText* GetDisplayText();
|
||||
|
||||
//! Caused the given mission to be loaded immediately after start
|
||||
void LoadSceneOnStart(const std::string& name, int rank);
|
||||
|
||||
void CreateIni();
|
||||
void LoadIni();
|
||||
|
||||
void ResetAfterDeviceChanged();
|
||||
|
||||
|
@ -350,6 +351,9 @@ public:
|
|||
int GetAutosaveInterval();
|
||||
void SetAutosaveSlots(int slots);
|
||||
int GetAutosaveSlots();
|
||||
|
||||
//! Enable mode where completing mission closes the game
|
||||
void SetExitAfterMission(bool exit);
|
||||
|
||||
protected:
|
||||
bool EventFrame(const Event &event);
|
||||
|
@ -389,6 +393,7 @@ protected:
|
|||
|
||||
|
||||
protected:
|
||||
CController* m_ctrl;
|
||||
CApplication* m_app;
|
||||
CEventQueue* m_eventQueue;
|
||||
CMainMovie* m_movie;
|
||||
|
|
|
@ -116,15 +116,15 @@ static int perso_color[3*10*3] =
|
|||
|
||||
CMainDialog::CMainDialog()
|
||||
{
|
||||
m_app = CApplication::GetInstancePointer();
|
||||
m_eventQueue = m_app->GetEventQueue();
|
||||
m_sound = m_app->GetSound();
|
||||
m_main = CRobotMain::GetInstancePointer();
|
||||
m_interface = m_main->GetInterface();
|
||||
m_camera = m_main->GetCamera();
|
||||
m_engine = Gfx::CEngine::GetInstancePointer();
|
||||
m_particle = m_engine->GetParticle();
|
||||
m_pause = CPauseManager::GetInstancePointer();
|
||||
m_app = nullptr;
|
||||
m_eventQueue = nullptr;
|
||||
m_sound = nullptr;
|
||||
m_main = nullptr;
|
||||
m_interface = nullptr;
|
||||
m_camera = nullptr;
|
||||
m_engine = nullptr;
|
||||
m_particle = nullptr;
|
||||
m_pause = nullptr;
|
||||
|
||||
m_phase = PHASE_NAME;
|
||||
m_phaseSetup = PHASE_SETUPg;
|
||||
|
@ -182,11 +182,26 @@ CMainDialog::CMainDialog()
|
|||
m_publicDir = "program";
|
||||
m_filesDir = "files";
|
||||
|
||||
m_setupFull = m_app->GetVideoConfig().fullScreen;
|
||||
m_setupFull = false;
|
||||
|
||||
m_bDialog = false;
|
||||
}
|
||||
|
||||
void CMainDialog::Create()
|
||||
{
|
||||
m_app = CApplication::GetInstancePointer();
|
||||
m_eventQueue = m_app->GetEventQueue();
|
||||
m_sound = m_app->GetSound();
|
||||
m_main = CRobotMain::GetInstancePointer();
|
||||
m_interface = m_main->GetInterface();
|
||||
m_camera = m_main->GetCamera();
|
||||
m_engine = Gfx::CEngine::GetInstancePointer();
|
||||
m_particle = m_engine->GetParticle();
|
||||
m_pause = CPauseManager::GetInstancePointer();
|
||||
|
||||
m_setupFull = m_app->GetVideoConfig().fullScreen;
|
||||
}
|
||||
|
||||
// Destructor of robot application.
|
||||
|
||||
CMainDialog::~CMainDialog()
|
||||
|
|
|
@ -72,6 +72,8 @@ class CMainDialog
|
|||
public:
|
||||
CMainDialog();
|
||||
~CMainDialog();
|
||||
|
||||
void Create();
|
||||
|
||||
bool EventProcess(const Event &event);
|
||||
void ChangePhase(Phase phase);
|
||||
|
|
Loading…
Reference in New Issue