2014-10-14 13:11:37 +00:00
|
|
|
|
/*
|
|
|
|
|
* 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
|
|
|
|
|
*/
|
2012-06-26 20:23:05 +00:00
|
|
|
|
|
|
|
|
|
|
2012-09-15 19:47:19 +00:00
|
|
|
|
#include "ui/maindialog.h"
|
2012-06-26 20:23:05 +00:00
|
|
|
|
|
2012-09-26 20:57:43 +00:00
|
|
|
|
#include "app/app.h"
|
2014-12-11 18:01:57 +00:00
|
|
|
|
#include "app/input.h"
|
2013-03-27 09:20:06 +00:00
|
|
|
|
#include "app/system.h"
|
2013-02-16 21:37:43 +00:00
|
|
|
|
|
2013-12-27 10:15:36 +00:00
|
|
|
|
#include "common/config.h"
|
2012-06-26 20:23:05 +00:00
|
|
|
|
#include "common/global.h"
|
|
|
|
|
#include "common/event.h"
|
2012-09-20 18:37:37 +00:00
|
|
|
|
#include "common/logger.h"
|
2015-07-17 18:36:01 +00:00
|
|
|
|
#include "common/make_unique.h"
|
2012-06-26 20:23:05 +00:00
|
|
|
|
#include "common/misc.h"
|
|
|
|
|
#include "common/profile.h"
|
|
|
|
|
#include "common/restext.h"
|
2013-12-02 23:11:26 +00:00
|
|
|
|
#include "common/stringutils.h"
|
2013-02-16 21:37:43 +00:00
|
|
|
|
|
2014-06-30 15:40:40 +00:00
|
|
|
|
#include "common/resources/resourcemanager.h"
|
|
|
|
|
#include "common/resources/inputstream.h"
|
|
|
|
|
#include "common/resources/outputstream.h"
|
|
|
|
|
|
2014-09-26 18:53:11 +00:00
|
|
|
|
#include "object/level/parser.h"
|
|
|
|
|
|
2015-07-18 21:14:20 +00:00
|
|
|
|
#include "object/player_progress.h"
|
2012-09-15 19:47:19 +00:00
|
|
|
|
#include "object/robotmain.h"
|
2013-02-16 21:37:43 +00:00
|
|
|
|
|
2012-09-15 19:47:19 +00:00
|
|
|
|
#include "sound/sound.h"
|
2013-02-16 21:37:43 +00:00
|
|
|
|
|
2012-06-26 20:23:05 +00:00
|
|
|
|
#include "ui/interface.h"
|
|
|
|
|
#include "ui/button.h"
|
|
|
|
|
#include "ui/color.h"
|
|
|
|
|
#include "ui/check.h"
|
|
|
|
|
#include "ui/key.h"
|
|
|
|
|
#include "ui/group.h"
|
|
|
|
|
#include "ui/image.h"
|
|
|
|
|
#include "ui/scroll.h"
|
|
|
|
|
#include "ui/slider.h"
|
|
|
|
|
#include "ui/list.h"
|
|
|
|
|
#include "ui/label.h"
|
|
|
|
|
#include "ui/window.h"
|
|
|
|
|
#include "ui/edit.h"
|
|
|
|
|
#include "ui/editvalue.h"
|
|
|
|
|
|
2012-09-15 19:47:19 +00:00
|
|
|
|
#include <stdio.h>
|
|
|
|
|
#include <string.h>
|
2012-09-26 20:57:43 +00:00
|
|
|
|
#include <sstream>
|
|
|
|
|
#include <iomanip>
|
2013-12-27 21:28:25 +00:00
|
|
|
|
#include <vector>
|
2015-03-22 13:29:03 +00:00
|
|
|
|
#include <boost/lexical_cast.hpp>
|
2012-06-26 20:23:05 +00:00
|
|
|
|
|
2012-09-26 20:57:43 +00:00
|
|
|
|
//TODO Get rid of all sprintf's
|
2012-06-26 20:23:05 +00:00
|
|
|
|
|
2013-02-16 21:37:43 +00:00
|
|
|
|
namespace Ui {
|
2012-09-15 19:47:19 +00:00
|
|
|
|
|
2012-06-26 20:23:05 +00:00
|
|
|
|
const int KEY_VISIBLE = 6; // number of visible keys redefinable
|
|
|
|
|
|
2013-04-25 19:05:27 +00:00
|
|
|
|
const float WELCOME_LENGTH = 3.0f;
|
2012-06-26 20:23:05 +00:00
|
|
|
|
|
|
|
|
|
static int perso_color[3*10*3] =
|
|
|
|
|
{
|
|
|
|
|
// hair:
|
|
|
|
|
193, 221, 226, // white
|
|
|
|
|
255, 255, 181, // yellow
|
|
|
|
|
204, 155, 84, // blond
|
|
|
|
|
165, 48, 10, // red
|
|
|
|
|
140, 75, 84, // brown
|
|
|
|
|
83, 64, 51, // brown
|
|
|
|
|
90, 95, 85, // black
|
|
|
|
|
85, 48, 9, // brown
|
|
|
|
|
60, 0, 23, // black
|
2012-06-26 21:01:17 +00:00
|
|
|
|
0, 0, 0, //
|
2012-06-26 20:23:05 +00:00
|
|
|
|
// spacesuit:
|
|
|
|
|
203, 206, 204, // dirty white
|
|
|
|
|
0, 205, 203, // bluish
|
|
|
|
|
108, 176, 0, // greenish
|
|
|
|
|
207, 207, 32, // yellow
|
|
|
|
|
170, 141, 0, // orange
|
|
|
|
|
108, 84, 0, // brown
|
|
|
|
|
0, 84, 136, // bluish
|
|
|
|
|
56, 61, 146, // bluish
|
|
|
|
|
56, 56, 56, // black
|
2012-06-26 21:01:17 +00:00
|
|
|
|
0, 0, 0, //
|
2012-06-26 20:23:05 +00:00
|
|
|
|
// strips:
|
|
|
|
|
255, 255, 255, // white
|
|
|
|
|
255, 255, 0, // yellow
|
|
|
|
|
255, 132, 1, // orange
|
|
|
|
|
255, 0, 255, // magenta
|
|
|
|
|
255, 0, 0, // red
|
|
|
|
|
0, 255, 0, // green
|
|
|
|
|
0, 255, 255, // cyan
|
|
|
|
|
0, 0, 255, // blue
|
|
|
|
|
70, 51, 84, // dark
|
2012-06-26 21:01:17 +00:00
|
|
|
|
0, 0, 0, //
|
2012-06-26 20:23:05 +00:00
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
// Constructor of robot application.
|
|
|
|
|
|
2013-02-16 21:37:43 +00:00
|
|
|
|
CMainDialog::CMainDialog()
|
2012-06-26 20:23:05 +00:00
|
|
|
|
{
|
2014-12-22 09:35:05 +00:00
|
|
|
|
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;
|
2012-06-26 20:23:05 +00:00
|
|
|
|
|
|
|
|
|
m_phase = PHASE_NAME;
|
|
|
|
|
m_phaseSetup = PHASE_SETUPg;
|
|
|
|
|
m_phaseTerm = PHASE_TRAINER;
|
|
|
|
|
m_sceneRead[0] = 0;
|
|
|
|
|
m_stackRead[0] = 0;
|
2015-07-18 17:43:22 +00:00
|
|
|
|
m_levelChap = 0;
|
|
|
|
|
m_levelRank = 0;
|
2012-06-26 20:23:05 +00:00
|
|
|
|
m_bSceneSoluce = false;
|
|
|
|
|
m_bSimulSetup = false;
|
2012-09-20 19:47:53 +00:00
|
|
|
|
|
2012-06-26 20:23:05 +00:00
|
|
|
|
m_accessEnable = true;
|
|
|
|
|
m_accessMission= true;
|
|
|
|
|
m_accessUser = true;
|
2012-09-15 19:47:19 +00:00
|
|
|
|
|
2012-06-26 20:23:05 +00:00
|
|
|
|
m_bDeleteGamer = true;
|
|
|
|
|
|
2015-07-18 16:52:37 +00:00
|
|
|
|
for(int i = 0; i < static_cast<int>(LevelCategory::Max); i++)
|
2012-06-26 20:23:05 +00:00
|
|
|
|
{
|
2015-07-18 16:52:37 +00:00
|
|
|
|
m_chap[static_cast<LevelCategory>(i)] = 0;
|
|
|
|
|
m_sel[static_cast<LevelCategory>(i)] = 0;
|
2012-06-26 20:23:05 +00:00
|
|
|
|
}
|
2015-07-18 16:52:37 +00:00
|
|
|
|
|
|
|
|
|
m_category = LevelCategory::Exercises;
|
2012-06-26 20:23:05 +00:00
|
|
|
|
m_maxList = 0;
|
|
|
|
|
|
|
|
|
|
m_bTooltip = true;
|
|
|
|
|
m_bGlint = true;
|
|
|
|
|
m_bRain = true;
|
|
|
|
|
m_bSoluce4 = true;
|
|
|
|
|
m_bMovies = true;
|
|
|
|
|
m_bNiceReset = true;
|
|
|
|
|
m_bHimselfDamage = true;
|
|
|
|
|
m_bCameraScroll = true;
|
2012-09-15 19:47:19 +00:00
|
|
|
|
|
2012-06-26 20:23:05 +00:00
|
|
|
|
m_bCameraInvertX = false;
|
|
|
|
|
m_bCameraInvertY = false;
|
|
|
|
|
m_bEffect = true;
|
2014-10-22 04:44:17 +00:00
|
|
|
|
m_bBlood = true;
|
2014-11-11 13:50:44 +00:00
|
|
|
|
m_bAutosave = true;
|
2012-06-26 20:23:05 +00:00
|
|
|
|
m_shotDelay = 0;
|
|
|
|
|
|
|
|
|
|
m_glintMouse = Math::Point(0.0f, 0.0f);
|
|
|
|
|
m_glintTime = 1000.0f;
|
|
|
|
|
|
2012-09-15 19:47:19 +00:00
|
|
|
|
for (int i = 0; i < 10; i++)
|
2012-06-26 20:23:05 +00:00
|
|
|
|
{
|
|
|
|
|
m_partiPhase[i] = 0;
|
|
|
|
|
m_partiTime[i] = 0.0f;
|
|
|
|
|
}
|
|
|
|
|
|
2013-05-01 17:44:55 +00:00
|
|
|
|
m_savegameDir = "savegame";
|
2014-11-10 16:37:34 +00:00
|
|
|
|
m_publicDir = "program";
|
|
|
|
|
m_filesDir = "files";
|
2012-06-26 20:23:05 +00:00
|
|
|
|
|
2014-12-22 09:35:05 +00:00
|
|
|
|
m_setupFull = false;
|
2013-05-04 18:12:15 +00:00
|
|
|
|
|
2012-06-26 20:23:05 +00:00
|
|
|
|
m_bDialog = false;
|
|
|
|
|
}
|
|
|
|
|
|
2014-12-22 09:35:05 +00:00
|
|
|
|
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();
|
2015-06-21 18:59:23 +00:00
|
|
|
|
|
2014-12-22 09:35:05 +00:00
|
|
|
|
m_setupFull = m_app->GetVideoConfig().fullScreen;
|
|
|
|
|
}
|
|
|
|
|
|
2012-06-26 20:23:05 +00:00
|
|
|
|
// Destructor of robot application.
|
|
|
|
|
|
|
|
|
|
CMainDialog::~CMainDialog()
|
|
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Changes phase.
|
|
|
|
|
|
|
|
|
|
void CMainDialog::ChangePhase(Phase phase)
|
|
|
|
|
{
|
2013-05-26 15:45:15 +00:00
|
|
|
|
CWindow* pw = nullptr;
|
2012-06-26 20:23:05 +00:00
|
|
|
|
CEdit* pe;
|
|
|
|
|
CEditValue* pv;
|
|
|
|
|
CLabel* pl;
|
|
|
|
|
CList* pli;
|
|
|
|
|
CCheck* pc;
|
|
|
|
|
CScroll* ps;
|
|
|
|
|
CSlider* psl;
|
|
|
|
|
CButton* pb;
|
|
|
|
|
CColor* pco;
|
|
|
|
|
CGroup* pg;
|
|
|
|
|
CImage* pi;
|
|
|
|
|
Math::Point pos, dim, ddim;
|
|
|
|
|
float ox, oy, sx, sy;
|
2013-12-02 23:11:26 +00:00
|
|
|
|
std::string name;
|
2012-06-26 20:23:05 +00:00
|
|
|
|
int res, i, j;
|
|
|
|
|
|
2012-09-15 19:47:19 +00:00
|
|
|
|
m_camera->SetType(Gfx::CAM_TYPE_DIALOG);
|
2012-06-26 20:23:05 +00:00
|
|
|
|
m_engine->SetOverFront(false);
|
2012-09-15 19:47:19 +00:00
|
|
|
|
m_engine->SetOverColor(Gfx::Color(0.0f, 0.0f, 0.0f, 0.0f), Gfx::ENG_RSTATE_TCOLOR_BLACK); // TODO: color ok?
|
2012-06-26 20:23:05 +00:00
|
|
|
|
|
|
|
|
|
if ( phase == PHASE_TERM )
|
|
|
|
|
{
|
|
|
|
|
phase = m_phaseTerm;
|
|
|
|
|
}
|
|
|
|
|
m_phase = phase; // copy the info to CRobotMain
|
|
|
|
|
m_phaseTime = 0.0f;
|
|
|
|
|
|
|
|
|
|
dim.x = 32.0f/640.0f;
|
|
|
|
|
dim.y = 32.0f/480.0f;
|
|
|
|
|
ox = 3.0f/640.0f;
|
|
|
|
|
oy = 3.0f/480.0f;
|
|
|
|
|
sx = (32.0f+2.0f)/640.0f;
|
|
|
|
|
sy = (32.0f+2.0f)/480.0f;
|
|
|
|
|
|
|
|
|
|
if ( m_phase == PHASE_INIT )
|
|
|
|
|
{
|
|
|
|
|
pos.x = 0.35f;
|
|
|
|
|
pos.y = 0.10f;
|
|
|
|
|
ddim.x = 0.30f;
|
|
|
|
|
ddim.y = 0.80f;
|
|
|
|
|
pw = m_interface->CreateWindows(pos, ddim, 10, EVENT_WINDOW5);
|
2012-09-15 19:47:19 +00:00
|
|
|
|
|
2012-06-26 20:23:05 +00:00
|
|
|
|
GetResource(RES_TEXT, RT_TITLE_INIT, name);
|
|
|
|
|
pw->SetName(name);
|
|
|
|
|
|
|
|
|
|
pos.x = 0.35f;
|
|
|
|
|
pos.y = 0.60f;
|
|
|
|
|
ddim.x = 0.30f;
|
|
|
|
|
ddim.y = 0.30f;
|
|
|
|
|
pw->CreateGroup(pos, ddim, 5, EVENT_INTERFACE_GLINTl); // orange corner
|
|
|
|
|
pos.x = 0.35f;
|
|
|
|
|
pos.y = 0.10f;
|
|
|
|
|
ddim.x = 0.30f;
|
|
|
|
|
ddim.y = 0.30f;
|
|
|
|
|
pw->CreateGroup(pos, ddim, 4, EVENT_INTERFACE_GLINTr); // blue corner
|
2015-06-21 18:59:23 +00:00
|
|
|
|
|
2012-06-26 20:23:05 +00:00
|
|
|
|
ddim.x = 0.20f;
|
|
|
|
|
ddim.y = dim.y*2.4f;
|
|
|
|
|
pos.x = 0.40f;
|
|
|
|
|
if ( m_accessEnable && m_accessMission )
|
|
|
|
|
{
|
|
|
|
|
pos.y = oy+sy*9.1f;
|
|
|
|
|
pg = pw->CreateGroup(pos, ddim, 23, EVENT_LABEL1); // yellow
|
|
|
|
|
pg->SetState(STATE_SHADOW);
|
|
|
|
|
}
|
|
|
|
|
pos.y = oy+sy*6.8f;
|
|
|
|
|
pg = pw->CreateGroup(pos, ddim, 24, EVENT_LABEL1); // orange
|
|
|
|
|
pg->SetState(STATE_SHADOW);
|
|
|
|
|
pos.y = oy+sy*3.9f;
|
|
|
|
|
pg = pw->CreateGroup(pos, ddim, 25, EVENT_LABEL1); // orange
|
|
|
|
|
pg->SetState(STATE_SHADOW);
|
|
|
|
|
ddim.y = dim.y*1.2f;
|
|
|
|
|
pos.y = oy+sy*1.9f;
|
|
|
|
|
pg = pw->CreateGroup(pos, ddim, 26, EVENT_LABEL1); // red
|
|
|
|
|
pg->SetState(STATE_SHADOW);
|
2015-06-21 18:59:23 +00:00
|
|
|
|
|
2012-06-26 20:23:05 +00:00
|
|
|
|
ddim.x = 0.18f;
|
|
|
|
|
ddim.y = dim.y*1;
|
|
|
|
|
pos.x = 0.41f;
|
|
|
|
|
|
|
|
|
|
if ( m_accessEnable && m_accessMission )
|
|
|
|
|
{
|
|
|
|
|
pos.y = oy+sy*10.3f;
|
|
|
|
|
pb = pw->CreateButton(pos, ddim, -1, EVENT_INTERFACE_MISSION);
|
|
|
|
|
pb->SetState(STATE_SHADOW);
|
|
|
|
|
|
|
|
|
|
pos.y = oy+sy*9.2f;
|
|
|
|
|
pb = pw->CreateButton(pos, ddim, -1, EVENT_INTERFACE_FREE);
|
|
|
|
|
pb->SetState(STATE_SHADOW);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
pos.y = oy+sy*8.0f;
|
|
|
|
|
pb = pw->CreateButton(pos, ddim, -1, EVENT_INTERFACE_TRAINER);
|
|
|
|
|
pb->SetState(STATE_SHADOW);
|
|
|
|
|
|
|
|
|
|
pos.y = oy+sy*6.9f;
|
|
|
|
|
pb = pw->CreateButton(pos, ddim, -1, EVENT_INTERFACE_DEFI);
|
|
|
|
|
pb->SetState(STATE_SHADOW);
|
|
|
|
|
|
2012-09-20 19:47:53 +00:00
|
|
|
|
pos.y = oy+sy*5.1f;
|
|
|
|
|
pb = pw->CreateButton(pos, ddim, -1, EVENT_INTERFACE_SETUP);
|
|
|
|
|
pb->SetState(STATE_SHADOW);
|
2012-06-26 20:23:05 +00:00
|
|
|
|
|
|
|
|
|
pos.y = oy+sy*4.0f;
|
|
|
|
|
pb = pw->CreateButton(pos, ddim, -1, EVENT_INTERFACE_NAME);
|
|
|
|
|
pb->SetState(STATE_SHADOW);
|
|
|
|
|
|
|
|
|
|
pos.y = oy+sy*2.0f;
|
|
|
|
|
pb = pw->CreateButton(pos, ddim, -1, EVENT_INTERFACE_QUIT);
|
|
|
|
|
pb->SetState(STATE_SHADOW);
|
|
|
|
|
|
|
|
|
|
if ( m_accessEnable && m_accessUser )
|
|
|
|
|
{
|
|
|
|
|
pos.x = 447.0f/640.0f;
|
|
|
|
|
pos.y = 313.0f/480.0f;
|
|
|
|
|
ddim.x = 0.09f;
|
|
|
|
|
pb = pw->CreateButton(pos, ddim, -1, EVENT_INTERFACE_USER);
|
|
|
|
|
pb->SetState(STATE_SHADOW);
|
2015-06-21 18:59:23 +00:00
|
|
|
|
|
|
|
|
|
try
|
|
|
|
|
{
|
|
|
|
|
CLevelParser levelParser("levels/custom/config.txt");
|
|
|
|
|
if (levelParser.Exists())
|
|
|
|
|
{
|
|
|
|
|
levelParser.Load();
|
|
|
|
|
CLevelParserLine* line = levelParser.Get("Button");
|
|
|
|
|
if (line->GetParam("name")->IsDefined())
|
2014-10-25 10:21:13 +00:00
|
|
|
|
pb->SetName(line->GetParam("name")->AsString());
|
2015-06-21 18:59:23 +00:00
|
|
|
|
if (line->GetParam("tooltip")->IsDefined())
|
2014-10-25 10:21:13 +00:00
|
|
|
|
pb->SetTooltip(line->GetParam("tooltip")->AsString());
|
|
|
|
|
}
|
|
|
|
|
}
|
2015-06-21 18:59:23 +00:00
|
|
|
|
catch (CLevelParserException& e)
|
|
|
|
|
{
|
2015-07-16 19:30:55 +00:00
|
|
|
|
GetLogger()->Error("Failed loading userlevel button name: %s\n", e.what());
|
2014-10-25 10:21:13 +00:00
|
|
|
|
}
|
2012-06-26 20:23:05 +00:00
|
|
|
|
}
|
|
|
|
|
|
2013-12-27 19:36:11 +00:00
|
|
|
|
/*pos.x = 139.0f/640.0f;
|
|
|
|
|
pos.y = 313.0f/480.0f;
|
|
|
|
|
ddim.x = 0.09f;
|
|
|
|
|
pb = pw->CreateButton(pos, ddim, -1, EVENT_INTERFACE_PROTO);
|
|
|
|
|
pb->SetState(STATE_SHADOW);*/
|
2012-06-26 20:23:05 +00:00
|
|
|
|
|
|
|
|
|
pos.x = 0.40f;
|
|
|
|
|
ddim.x = 0.20f;
|
|
|
|
|
pos.y = 26.0f/480.0f;
|
|
|
|
|
ddim.y = 12.0f/480.0f;
|
|
|
|
|
pg = pw->CreateGroup(pos, ddim, 1, EVENT_LABEL1);
|
|
|
|
|
pg->SetState(STATE_SHADOW);
|
|
|
|
|
pos.y -= 5.0f/480.0f;
|
2014-10-14 13:11:37 +00:00
|
|
|
|
pl = pw->CreateLabel(pos, ddim, 0, EVENT_LABEL1, "TerranovaTeam");
|
2012-09-15 19:47:19 +00:00
|
|
|
|
pl->SetFontType(Gfx::FONT_COURIER);
|
2013-03-23 20:22:44 +00:00
|
|
|
|
pl->SetFontSize(Gfx::FONT_SIZE_SMALL);
|
2012-06-26 20:23:05 +00:00
|
|
|
|
|
2014-07-10 14:25:40 +00:00
|
|
|
|
m_engine->SetBackground("interface/interface.png",
|
2012-09-29 21:52:30 +00:00
|
|
|
|
Gfx::Color(0.0f, 0.0f, 0.0f, 0.0f),
|
|
|
|
|
Gfx::Color(0.0f, 0.0f, 0.0f, 0.0f),
|
|
|
|
|
Gfx::Color(0.0f, 0.0f, 0.0f, 0.0f),
|
|
|
|
|
Gfx::Color(0.0f, 0.0f, 0.0f, 0.0f),
|
2013-05-11 21:05:20 +00:00
|
|
|
|
true);
|
2012-06-26 20:23:05 +00:00
|
|
|
|
m_engine->SetBackForce(true);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if ( m_phase == PHASE_NAME )
|
|
|
|
|
{
|
|
|
|
|
pos.x = 0.10f;
|
|
|
|
|
pos.y = 0.10f;
|
|
|
|
|
ddim.x = 0.80f;
|
|
|
|
|
ddim.y = 0.80f;
|
|
|
|
|
pw = m_interface->CreateWindows(pos, ddim, 12, EVENT_WINDOW5);
|
|
|
|
|
GetResource(RES_TEXT, RT_TITLE_NAME, name);
|
|
|
|
|
pw->SetName(name);
|
|
|
|
|
|
|
|
|
|
pos.x = 0.10f;
|
|
|
|
|
pos.y = 0.40f;
|
|
|
|
|
ddim.x = 0.50f;
|
|
|
|
|
ddim.y = 0.50f;
|
|
|
|
|
pw->CreateGroup(pos, ddim, 5, EVENT_INTERFACE_GLINTl); // orange corner
|
|
|
|
|
pos.x = 0.40f;
|
|
|
|
|
pos.y = 0.10f;
|
|
|
|
|
ddim.x = 0.50f;
|
|
|
|
|
ddim.y = 0.50f;
|
|
|
|
|
pw->CreateGroup(pos, ddim, 4, EVENT_INTERFACE_GLINTr); // blue corner
|
|
|
|
|
|
|
|
|
|
pos.x = 60.0f/640.0f;
|
|
|
|
|
pos.y = 313.0f/480.0f;
|
|
|
|
|
ddim.x = 120.0f/640.0f;
|
|
|
|
|
ddim.y = 32.0f/480.0f;
|
|
|
|
|
GetResource(RES_EVENT, EVENT_INTERFACE_NLABEL, name);
|
|
|
|
|
pl = pw->CreateLabel(pos, ddim, -1, EVENT_INTERFACE_NLABEL, name);
|
2012-09-15 19:47:19 +00:00
|
|
|
|
pl->SetTextAlign(Gfx::TEXT_ALIGN_RIGHT);
|
2012-06-26 20:23:05 +00:00
|
|
|
|
|
|
|
|
|
pos.x = 200.0f/640.0f;
|
|
|
|
|
pos.y = 320.0f/480.0f;
|
|
|
|
|
ddim.x = 160.0f/640.0f;
|
|
|
|
|
ddim.y = 32.0f/480.0f;
|
|
|
|
|
pg = pw->CreateGroup(pos, ddim, 7, EVENT_LABEL1);
|
|
|
|
|
pg->SetState(STATE_SHADOW);
|
|
|
|
|
|
|
|
|
|
pos.x = 207.0f/640.0f;
|
|
|
|
|
pos.y = 328.0f/480.0f;
|
|
|
|
|
ddim.x = 144.0f/640.0f;
|
|
|
|
|
ddim.y = 18.0f/480.0f;
|
|
|
|
|
pe = pw->CreateEdit(pos, ddim, 0, EVENT_INTERFACE_NEDIT);
|
|
|
|
|
pe->SetMaxChar(15);
|
2015-07-18 21:14:20 +00:00
|
|
|
|
if(m_main->GetPlayerProgress() != nullptr)
|
2012-06-26 20:23:05 +00:00
|
|
|
|
{
|
2015-07-18 21:14:20 +00:00
|
|
|
|
name = m_main->GetPlayerProgress()->GetName();
|
2012-06-26 20:23:05 +00:00
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
2015-07-18 21:14:20 +00:00
|
|
|
|
name = CPlayerProgress::GetLastName();
|
2012-06-26 20:23:05 +00:00
|
|
|
|
}
|
2013-12-02 23:11:26 +00:00
|
|
|
|
pe->SetText(name.c_str());
|
|
|
|
|
pe->SetCursor(name.length(), 0);
|
2015-07-15 17:08:45 +00:00
|
|
|
|
m_interface->SetFocus(pe);
|
2012-06-26 20:23:05 +00:00
|
|
|
|
|
|
|
|
|
pos.x = 380.0f/640.0f;
|
|
|
|
|
pos.y = 320.0f/480.0f;
|
|
|
|
|
ddim.x =100.0f/640.0f;
|
|
|
|
|
ddim.y = 32.0f/480.0f;
|
|
|
|
|
pb = pw->CreateButton(pos, ddim, -1, EVENT_INTERFACE_NOK);
|
|
|
|
|
pb->SetState(STATE_SHADOW);
|
|
|
|
|
|
|
|
|
|
pos.x = 380.0f/640.0f;
|
|
|
|
|
pos.y = 250.0f/480.0f;
|
|
|
|
|
ddim.x =100.0f/640.0f;
|
|
|
|
|
ddim.y = 52.0f/480.0f;
|
|
|
|
|
pb = pw->CreateButton(pos, ddim, -1, EVENT_INTERFACE_PERSO);
|
|
|
|
|
pb->SetState(STATE_SHADOW);
|
|
|
|
|
|
|
|
|
|
pos.x = 200.0f/640.0f;
|
|
|
|
|
pos.y = 150.0f/480.0f;
|
|
|
|
|
ddim.x = 160.0f/640.0f;
|
|
|
|
|
ddim.y = 160.0f/480.0f;
|
|
|
|
|
pli = pw->CreateList(pos, ddim, 0, EVENT_INTERFACE_NLIST);
|
|
|
|
|
pli->SetState(STATE_SHADOW);
|
|
|
|
|
|
|
|
|
|
if ( m_bDeleteGamer )
|
|
|
|
|
{
|
|
|
|
|
pos.x = 200.0f/640.0f;
|
|
|
|
|
pos.y = 100.0f/480.0f;
|
|
|
|
|
ddim.x = 160.0f/640.0f;
|
|
|
|
|
ddim.y = 32.0f/480.0f;
|
|
|
|
|
pb = pw->CreateButton(pos, ddim, -1, EVENT_INTERFACE_NDELETE);
|
|
|
|
|
pb->SetState(STATE_SHADOW);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
pos.x = 380.0f/640.0f;
|
|
|
|
|
pos.y = 100.0f/480.0f;
|
|
|
|
|
ddim.x =100.0f/640.0f;
|
|
|
|
|
ddim.y = 32.0f/480.0f;
|
|
|
|
|
pb = pw->CreateButton(pos, ddim, -1, EVENT_INTERFACE_NCANCEL);
|
|
|
|
|
pb->SetState(STATE_SHADOW);
|
|
|
|
|
|
|
|
|
|
ReadNameList();
|
|
|
|
|
UpdateNameList();
|
|
|
|
|
UpdateNameControl();
|
|
|
|
|
|
2014-07-10 14:25:40 +00:00
|
|
|
|
m_engine->SetBackground("interface/interface.png",
|
2012-09-29 21:52:30 +00:00
|
|
|
|
Gfx::Color(0.0f, 0.0f, 0.0f, 0.0f),
|
|
|
|
|
Gfx::Color(0.0f, 0.0f, 0.0f, 0.0f),
|
|
|
|
|
Gfx::Color(0.0f, 0.0f, 0.0f, 0.0f),
|
|
|
|
|
Gfx::Color(0.0f, 0.0f, 0.0f, 0.0f),
|
2013-05-11 21:05:20 +00:00
|
|
|
|
true);
|
2012-06-26 20:23:05 +00:00
|
|
|
|
m_engine->SetBackForce(true);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if ( m_phase == PHASE_PERSO )
|
|
|
|
|
{
|
|
|
|
|
pos.x = 0.10f;
|
|
|
|
|
pos.y = 0.10f;
|
|
|
|
|
ddim.x = 0.80f;
|
|
|
|
|
ddim.y = 0.80f;
|
|
|
|
|
pw = m_interface->CreateWindows(pos, ddim, 12, EVENT_WINDOW5);
|
|
|
|
|
GetResource(RES_TEXT, RT_TITLE_PERSO, name);
|
|
|
|
|
pw->SetName(name);
|
|
|
|
|
|
|
|
|
|
pos.x = 0.10f;
|
|
|
|
|
pos.y = 0.40f;
|
|
|
|
|
ddim.x = 0.50f;
|
|
|
|
|
ddim.y = 0.50f;
|
|
|
|
|
pw->CreateGroup(pos, ddim, 5, EVENT_INTERFACE_GLINTl); // orange corner
|
|
|
|
|
pos.x = 0.40f;
|
|
|
|
|
pos.y = 0.10f;
|
|
|
|
|
ddim.x = 0.50f;
|
|
|
|
|
ddim.y = 0.50f;
|
|
|
|
|
pw->CreateGroup(pos, ddim, 4, EVENT_INTERFACE_GLINTr); // blue corner
|
|
|
|
|
|
|
|
|
|
pos.x = 95.0f/640.0f;
|
|
|
|
|
pos.y = 108.0f/480.0f;
|
|
|
|
|
ddim.x = 220.0f/640.0f;
|
|
|
|
|
ddim.y = 274.0f/480.0f;
|
|
|
|
|
pw->CreateGroup(pos, ddim, 17, EVENT_NULL); // frame
|
2012-06-26 21:01:17 +00:00
|
|
|
|
|
2012-06-26 20:23:05 +00:00
|
|
|
|
pos.x = 100.0f/640.0f;
|
|
|
|
|
pos.y = 364.0f/480.0f;
|
|
|
|
|
ddim.x = 210.0f/640.0f;
|
|
|
|
|
ddim.y = 14.0f/480.0f;
|
|
|
|
|
pw->CreateGroup(pos, ddim, 3, EVENT_NULL); // transparent -> gray
|
|
|
|
|
|
|
|
|
|
pos.x = 120.0f/640.0f;
|
|
|
|
|
pos.y = 364.0f/480.0f;
|
|
|
|
|
ddim.x = 80.0f/640.0f;
|
|
|
|
|
ddim.y = 28.0f/480.0f;
|
|
|
|
|
pb = pw->CreateButton(pos, ddim, -1, EVENT_INTERFACE_PHEAD);
|
|
|
|
|
pb->SetState(STATE_SHADOW);
|
|
|
|
|
pb->SetState(STATE_CARD);
|
|
|
|
|
|
|
|
|
|
pos.x = 210.0f/640.0f;
|
|
|
|
|
pos.y = 364.0f/480.0f;
|
|
|
|
|
ddim.x = 80.0f/640.0f;
|
|
|
|
|
ddim.y = 28.0f/480.0f;
|
|
|
|
|
pb = pw->CreateButton(pos, ddim, -1, EVENT_INTERFACE_PBODY);
|
|
|
|
|
pb->SetState(STATE_SHADOW);
|
|
|
|
|
pb->SetState(STATE_CARD);
|
|
|
|
|
|
|
|
|
|
pos.x = 100.0f/640.0f;
|
|
|
|
|
pos.y = 354.0f/480.0f;
|
|
|
|
|
ddim.x = 210.0f/640.0f;
|
|
|
|
|
ddim.y = 10.0f/480.0f;
|
|
|
|
|
pw->CreateGroup(pos, ddim, 1, EVENT_INTERFACE_GLINTb); // orange bar
|
|
|
|
|
pos.x = 100.0f/640.0f;
|
|
|
|
|
pos.y = 154.0f/480.0f;
|
|
|
|
|
ddim.x = 210.0f/640.0f;
|
|
|
|
|
ddim.y = 200.0f/480.0f;
|
|
|
|
|
pw->CreateGroup(pos, ddim, 2, EVENT_INTERFACE_GLINTu); // orange -> transparent
|
|
|
|
|
|
|
|
|
|
// Face
|
|
|
|
|
pos.x = 340.0f/640.0f;
|
|
|
|
|
pos.y = 356.0f/480.0f;
|
|
|
|
|
ddim.x = 200.0f/640.0f;
|
|
|
|
|
ddim.y = 16.0f/480.0f;
|
|
|
|
|
pl = pw->CreateLabel(pos, ddim, 0, EVENT_LABEL11, "");
|
2012-09-15 19:47:19 +00:00
|
|
|
|
pl->SetTextAlign(Gfx::TEXT_ALIGN_LEFT);
|
2012-06-26 20:23:05 +00:00
|
|
|
|
|
|
|
|
|
pos.x = 340.0f/640.0f;
|
|
|
|
|
pos.y = 312.0f/480.0f;
|
|
|
|
|
ddim.x = 44.0f/640.0f;
|
|
|
|
|
ddim.y = 44.0f/480.0f;
|
|
|
|
|
pb = pw->CreateButton(pos, ddim, 43, EVENT_INTERFACE_PFACE1);
|
|
|
|
|
pb->SetState(STATE_SHADOW);
|
|
|
|
|
pos.x += 50.0f/640.0f;
|
|
|
|
|
pb = pw->CreateButton(pos, ddim, 46, EVENT_INTERFACE_PFACE4);
|
|
|
|
|
pb->SetState(STATE_SHADOW);
|
|
|
|
|
pos.x += 50.0f/640.0f;
|
|
|
|
|
pb = pw->CreateButton(pos, ddim, 45, EVENT_INTERFACE_PFACE3);
|
|
|
|
|
pb->SetState(STATE_SHADOW);
|
|
|
|
|
pos.x += 50.0f/640.0f;
|
|
|
|
|
pb = pw->CreateButton(pos, ddim, 44, EVENT_INTERFACE_PFACE2);
|
|
|
|
|
pb->SetState(STATE_SHADOW);
|
|
|
|
|
|
|
|
|
|
// Glasses
|
|
|
|
|
pos.x = 340.0f/640.0f;
|
|
|
|
|
pos.y = 270.0f/480.0f;
|
|
|
|
|
ddim.x = 200.0f/640.0f;
|
|
|
|
|
ddim.y = 16.0f/480.0f;
|
|
|
|
|
pl = pw->CreateLabel(pos, ddim, 0, EVENT_LABEL12, "");
|
2012-09-15 19:47:19 +00:00
|
|
|
|
pl->SetTextAlign(Gfx::TEXT_ALIGN_LEFT);
|
2012-06-26 20:23:05 +00:00
|
|
|
|
|
|
|
|
|
pos.x = 340.0f/640.0f;
|
|
|
|
|
pos.y = 240.0f/480.0f;
|
|
|
|
|
ddim.x = 30.0f/640.0f;
|
|
|
|
|
ddim.y = 30.0f/480.0f;
|
|
|
|
|
for ( i=0 ; i<6 ; i++ )
|
|
|
|
|
{
|
|
|
|
|
int ti[6] = {11, 179, 180, 181, 182, 183};
|
2012-09-18 20:33:28 +00:00
|
|
|
|
pb = pw->CreateButton(pos, ddim, ti[i], static_cast<EventType>(EVENT_INTERFACE_PGLASS0+i));
|
2012-06-26 20:23:05 +00:00
|
|
|
|
pb->SetState(STATE_SHADOW);
|
|
|
|
|
pos.x += (30.0f+2.8f)/640.0f;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Color A
|
|
|
|
|
pos.x = 340.0f/640.0f;
|
|
|
|
|
pos.y = 300.0f/480.0f;
|
|
|
|
|
ddim.x = 200.0f/640.0f;
|
|
|
|
|
ddim.y = 16.0f/480.0f;
|
|
|
|
|
pl = pw->CreateLabel(pos, ddim, 0, EVENT_LABEL14, "");
|
2012-09-15 19:47:19 +00:00
|
|
|
|
pl->SetTextAlign(Gfx::TEXT_ALIGN_LEFT);
|
2012-06-26 20:23:05 +00:00
|
|
|
|
|
|
|
|
|
pos.y = 282.0f/480.0f;
|
|
|
|
|
ddim.x = 18.0f/640.0f;
|
|
|
|
|
ddim.y = 18.0f/480.0f;
|
|
|
|
|
for ( j=0 ; j<3 ; j++ )
|
|
|
|
|
{
|
|
|
|
|
pos.x = 340.0f/640.0f;
|
|
|
|
|
for ( i=0 ; i<3 ; i++ )
|
|
|
|
|
{
|
2012-09-18 20:33:28 +00:00
|
|
|
|
pco = pw->CreateColor(pos, ddim, -1, static_cast<EventType>(EVENT_INTERFACE_PC0a+j*3+i));
|
2012-06-26 20:23:05 +00:00
|
|
|
|
pco->SetState(STATE_SHADOW);
|
|
|
|
|
pos.x += 20.0f/640.0f;
|
|
|
|
|
}
|
|
|
|
|
pos.y -= 20.0f/480.0f;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
pos.x = 420.0f/640.0f;
|
|
|
|
|
pos.y = 282.0f/480.0f;
|
|
|
|
|
ddim.x = 100.0f/640.0f;
|
|
|
|
|
ddim.y = 18.0f/480.0f;
|
|
|
|
|
for ( i=0 ; i<3 ; i++ )
|
|
|
|
|
{
|
2012-09-18 20:33:28 +00:00
|
|
|
|
psl = pw->CreateSlider(pos, ddim, 0, static_cast<EventType>(EVENT_INTERFACE_PCRa+i));
|
2012-06-26 20:23:05 +00:00
|
|
|
|
psl->SetState(STATE_SHADOW);
|
|
|
|
|
psl->SetLimit(0.0f, 255.0f);
|
|
|
|
|
psl->SetArrowStep(16.0f);
|
|
|
|
|
pos.y -= 20.0f/480.0f;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Color B
|
|
|
|
|
pos.x = 340.0f/640.0f;
|
|
|
|
|
pos.y = 192.0f/480.0f;
|
|
|
|
|
ddim.x = 200.0f/640.0f;
|
|
|
|
|
ddim.y = 16.0f/480.0f;
|
|
|
|
|
pl = pw->CreateLabel(pos, ddim, 0, EVENT_LABEL13, "");
|
2012-09-15 19:47:19 +00:00
|
|
|
|
pl->SetTextAlign(Gfx::TEXT_ALIGN_LEFT);
|
2012-06-26 20:23:05 +00:00
|
|
|
|
|
|
|
|
|
pos.y = 174.0f/480.0f;
|
|
|
|
|
ddim.x = 18.0f/640.0f;
|
|
|
|
|
ddim.y = 18.0f/480.0f;
|
|
|
|
|
for ( j=0 ; j<3 ; j++ )
|
|
|
|
|
{
|
|
|
|
|
pos.x = 340.0f/640.0f;
|
|
|
|
|
for ( i=0 ; i<3 ; i++ )
|
|
|
|
|
{
|
2012-09-18 20:33:28 +00:00
|
|
|
|
pco = pw->CreateColor(pos, ddim, -1, static_cast<EventType>(EVENT_INTERFACE_PC0b+j*3+i));
|
2012-06-26 20:23:05 +00:00
|
|
|
|
pco->SetState(STATE_SHADOW);
|
|
|
|
|
pos.x += 20.0f/640.0f;
|
|
|
|
|
}
|
|
|
|
|
pos.y -= 20.0f/480.0f;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
pos.x = 420.0f/640.0f;
|
|
|
|
|
pos.y = 174.0f/480.0f;
|
|
|
|
|
ddim.x = 100.0f/640.0f;
|
|
|
|
|
ddim.y = 18.0f/480.0f;
|
|
|
|
|
for ( i=0 ; i<3 ; i++ )
|
|
|
|
|
{
|
2012-09-18 20:33:28 +00:00
|
|
|
|
psl = pw->CreateSlider(pos, ddim, 0, static_cast<EventType>(EVENT_INTERFACE_PCRb+i));
|
2012-06-26 20:23:05 +00:00
|
|
|
|
psl->SetState(STATE_SHADOW);
|
|
|
|
|
psl->SetLimit(0.0f, 255.0f);
|
|
|
|
|
psl->SetArrowStep(16.0f);
|
|
|
|
|
pos.y -= 20.0f/480.0f;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Rotation
|
|
|
|
|
pos.x = 100.0f/640.0f;
|
|
|
|
|
pos.y = 113.0f/480.0f;
|
|
|
|
|
ddim.x = 20.0f/640.0f;
|
|
|
|
|
ddim.y = 20.0f/480.0f;
|
|
|
|
|
pb = pw->CreateButton(pos, ddim, 55, EVENT_INTERFACE_PLROT); // <
|
|
|
|
|
pb->SetState(STATE_SHADOW);
|
|
|
|
|
pb->SetRepeat(true);
|
|
|
|
|
|
|
|
|
|
pos.x = 290.0f/640.0f;
|
|
|
|
|
pos.y = 113.0f/480.0f;
|
|
|
|
|
ddim.x = 20.0f/640.0f;
|
|
|
|
|
ddim.y = 20.0f/480.0f;
|
|
|
|
|
pb = pw->CreateButton(pos, ddim, 48, EVENT_INTERFACE_PRROT); // >
|
|
|
|
|
pb->SetState(STATE_SHADOW);
|
|
|
|
|
pb->SetRepeat(true);
|
|
|
|
|
|
|
|
|
|
pos.x = 100.0f/640.0f;
|
|
|
|
|
pos.y = 70.0f/480.0f;
|
|
|
|
|
ddim.x = 100.0f/640.0f;
|
|
|
|
|
ddim.y = 32.0f/480.0f;
|
|
|
|
|
pb = pw->CreateButton(pos, ddim, -1, EVENT_INTERFACE_POK);
|
|
|
|
|
pb->SetState(STATE_SHADOW);
|
|
|
|
|
|
|
|
|
|
pos.x = 210.0f/640.0f;
|
|
|
|
|
pos.y = 70.0f/480.0f;
|
|
|
|
|
ddim.x =100.0f/640.0f;
|
|
|
|
|
ddim.y = 32.0f/480.0f;
|
|
|
|
|
pb = pw->CreateButton(pos, ddim, -1, EVENT_INTERFACE_PCANCEL);
|
|
|
|
|
pb->SetState(STATE_SHADOW);
|
|
|
|
|
|
|
|
|
|
pos.x = 340.0f/640.0f;
|
|
|
|
|
pos.y = 70.0f/480.0f;
|
|
|
|
|
ddim.x =194.0f/640.0f;
|
|
|
|
|
ddim.y = 32.0f/480.0f;
|
|
|
|
|
pb = pw->CreateButton(pos, ddim, -1, EVENT_INTERFACE_PDEF);
|
|
|
|
|
pb->SetState(STATE_SHADOW);
|
|
|
|
|
|
2015-07-18 21:14:20 +00:00
|
|
|
|
m_apperanceTab = 0;
|
|
|
|
|
m_apperanceAngle = -0.6f;
|
|
|
|
|
m_main->GetPlayerProgress()->LoadApperance();
|
2012-06-26 20:23:05 +00:00
|
|
|
|
UpdatePerso();
|
|
|
|
|
m_main->ScenePerso();
|
|
|
|
|
CameraPerso();
|
|
|
|
|
}
|
|
|
|
|
|
2013-05-02 08:58:38 +00:00
|
|
|
|
if ( m_phase != PHASE_SIMUL &&
|
|
|
|
|
m_phase != PHASE_WIN &&
|
|
|
|
|
m_phase != PHASE_LOST &&
|
|
|
|
|
m_phase != PHASE_WRITE &&
|
|
|
|
|
m_phase != PHASE_READs &&
|
|
|
|
|
m_phase != PHASE_WRITEs &&
|
|
|
|
|
m_phase != PHASE_SETUPds &&
|
|
|
|
|
m_phase != PHASE_SETUPgs &&
|
|
|
|
|
m_phase != PHASE_SETUPps &&
|
|
|
|
|
m_phase != PHASE_SETUPcs &&
|
|
|
|
|
m_phase != PHASE_SETUPss )
|
|
|
|
|
{
|
2014-11-02 12:33:37 +00:00
|
|
|
|
if (!m_sound->IsPlayingMusic() && m_sound->IsCachedMusic("Intro1.ogg"))
|
2013-05-26 15:47:54 +00:00
|
|
|
|
{
|
2013-05-02 08:58:38 +00:00
|
|
|
|
m_sound->PlayMusic("Intro1.ogg", false);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2012-06-26 20:23:05 +00:00
|
|
|
|
if ( m_phase == PHASE_TRAINER ||
|
2012-09-29 21:52:30 +00:00
|
|
|
|
m_phase == PHASE_DEFI ||
|
|
|
|
|
m_phase == PHASE_MISSION ||
|
|
|
|
|
m_phase == PHASE_FREE ||
|
2013-12-27 19:36:11 +00:00
|
|
|
|
m_phase == PHASE_USER )
|
2012-06-26 20:23:05 +00:00
|
|
|
|
{
|
2015-07-18 16:52:37 +00:00
|
|
|
|
if ( m_phase == PHASE_TRAINER ) m_category = LevelCategory::Exercises;
|
|
|
|
|
if ( m_phase == PHASE_DEFI ) m_category = LevelCategory::Challenges;
|
|
|
|
|
if ( m_phase == PHASE_MISSION ) m_category = LevelCategory::Missions;
|
|
|
|
|
if ( m_phase == PHASE_FREE ) m_category = LevelCategory::FreeGame;
|
|
|
|
|
if ( m_phase == PHASE_USER ) m_category = LevelCategory::CustomLevels;
|
2012-06-26 20:23:05 +00:00
|
|
|
|
|
|
|
|
|
if ( m_phase == PHASE_FREE )
|
|
|
|
|
{
|
2015-07-18 21:14:20 +00:00
|
|
|
|
m_accessChap = m_main->GetPlayerProgress()->GetChapPassed(LevelCategory::Missions);
|
2015-07-18 16:52:37 +00:00
|
|
|
|
}
|
2012-06-26 20:23:05 +00:00
|
|
|
|
|
|
|
|
|
pos.x = 0.10f;
|
|
|
|
|
pos.y = 0.10f;
|
|
|
|
|
ddim.x = 0.80f;
|
|
|
|
|
ddim.y = 0.80f;
|
|
|
|
|
pw = m_interface->CreateWindows(pos, ddim, 12, EVENT_WINDOW5);
|
|
|
|
|
pw->SetClosable(true);
|
|
|
|
|
if ( m_phase == PHASE_TRAINER ) res = RT_TITLE_TRAINER;
|
|
|
|
|
if ( m_phase == PHASE_DEFI ) res = RT_TITLE_DEFI;
|
|
|
|
|
if ( m_phase == PHASE_MISSION ) res = RT_TITLE_MISSION;
|
|
|
|
|
if ( m_phase == PHASE_FREE ) res = RT_TITLE_FREE;
|
|
|
|
|
if ( m_phase == PHASE_USER ) res = RT_TITLE_USER;
|
|
|
|
|
GetResource(RES_TEXT, res, name);
|
|
|
|
|
pw->SetName(name);
|
|
|
|
|
|
|
|
|
|
pos.x = 0.10f;
|
|
|
|
|
pos.y = 0.40f;
|
|
|
|
|
ddim.x = 0.50f;
|
|
|
|
|
ddim.y = 0.50f;
|
|
|
|
|
pw->CreateGroup(pos, ddim, 5, EVENT_INTERFACE_GLINTl); // orange corner
|
|
|
|
|
pos.x = 0.40f;
|
|
|
|
|
pos.y = 0.10f;
|
|
|
|
|
ddim.x = 0.50f;
|
|
|
|
|
ddim.y = 0.50f;
|
|
|
|
|
pw->CreateGroup(pos, ddim, 4, EVENT_INTERFACE_GLINTr); // blue corner
|
|
|
|
|
|
|
|
|
|
// Displays a list of chapters:
|
|
|
|
|
pos.x = ox+sx*3;
|
|
|
|
|
pos.y = oy+sy*10.5f;
|
|
|
|
|
ddim.x = dim.x*7.5f;
|
|
|
|
|
ddim.y = dim.y*0.6f;
|
|
|
|
|
if ( m_phase == PHASE_TRAINER ) res = RT_PLAY_CHAPt;
|
|
|
|
|
if ( m_phase == PHASE_DEFI ) res = RT_PLAY_CHAPd;
|
|
|
|
|
if ( m_phase == PHASE_MISSION ) res = RT_PLAY_CHAPm;
|
|
|
|
|
if ( m_phase == PHASE_FREE ) res = RT_PLAY_CHAPf;
|
|
|
|
|
if ( m_phase == PHASE_USER ) res = RT_PLAY_CHAPu;
|
|
|
|
|
GetResource(RES_TEXT, res, name);
|
|
|
|
|
pl = pw->CreateLabel(pos, ddim, 0, EVENT_LABEL11, name);
|
2012-09-15 19:47:19 +00:00
|
|
|
|
pl->SetTextAlign(Gfx::TEXT_ALIGN_LEFT);
|
2012-06-26 20:23:05 +00:00
|
|
|
|
|
|
|
|
|
pos.y = oy+sy*6.7f;
|
|
|
|
|
ddim.y = dim.y*4.5f;
|
|
|
|
|
ddim.x = dim.x*6.5f;
|
|
|
|
|
pli = pw->CreateList(pos, ddim, 0, EVENT_INTERFACE_CHAP);
|
|
|
|
|
pli->SetState(STATE_SHADOW);
|
2015-07-18 21:14:20 +00:00
|
|
|
|
m_chap[m_category] = m_main->GetPlayerProgress()->GetSelectedChap(m_category)-1;
|
2015-07-18 16:52:37 +00:00
|
|
|
|
UpdateSceneChap(m_chap[m_category]);
|
2012-06-26 20:23:05 +00:00
|
|
|
|
if ( m_phase != PHASE_USER ) pli->SetState(STATE_EXTEND);
|
2012-06-26 21:01:17 +00:00
|
|
|
|
|
2012-06-26 20:23:05 +00:00
|
|
|
|
// Displays a list of missions:
|
|
|
|
|
pos.x = ox+sx*9.5f;
|
|
|
|
|
pos.y = oy+sy*10.5f;
|
|
|
|
|
ddim.x = dim.x*7.5f;
|
|
|
|
|
ddim.y = dim.y*0.6f;
|
|
|
|
|
if ( m_phase == PHASE_TRAINER ) res = RT_PLAY_LISTt;
|
|
|
|
|
if ( m_phase == PHASE_DEFI ) res = RT_PLAY_LISTd;
|
|
|
|
|
if ( m_phase == PHASE_MISSION ) res = RT_PLAY_LISTm;
|
|
|
|
|
if ( m_phase == PHASE_FREE ) res = RT_PLAY_LISTf;
|
|
|
|
|
if ( m_phase == PHASE_USER ) res = RT_PLAY_LISTu;
|
|
|
|
|
GetResource(RES_TEXT, res, name);
|
|
|
|
|
pl = pw->CreateLabel(pos, ddim, 0, EVENT_LABEL12, name);
|
2012-09-15 19:47:19 +00:00
|
|
|
|
pl->SetTextAlign(Gfx::TEXT_ALIGN_LEFT);
|
2012-06-26 20:23:05 +00:00
|
|
|
|
|
|
|
|
|
pos.y = oy+sy*6.7f;
|
|
|
|
|
ddim.y = dim.y*4.5f;
|
|
|
|
|
ddim.x = dim.x*6.5f;
|
|
|
|
|
pli = pw->CreateList(pos, ddim, 0, EVENT_INTERFACE_LIST);
|
|
|
|
|
pli->SetState(STATE_SHADOW);
|
2015-07-18 21:14:20 +00:00
|
|
|
|
m_sel[m_category] = m_main->GetPlayerProgress()->GetSelectedRank(m_category)-1;
|
2015-07-18 16:52:37 +00:00
|
|
|
|
UpdateSceneList(m_chap[m_category], m_sel[m_category]);
|
2012-06-26 20:23:05 +00:00
|
|
|
|
if ( m_phase != PHASE_USER ) pli->SetState(STATE_EXTEND);
|
2012-09-15 19:47:19 +00:00
|
|
|
|
pos = pli->GetPos();
|
|
|
|
|
ddim = pli->GetDim();
|
2012-06-26 20:23:05 +00:00
|
|
|
|
|
|
|
|
|
// Displays the summary:
|
|
|
|
|
pos.x = ox+sx*3;
|
|
|
|
|
pos.y = oy+sy*5.4f;
|
|
|
|
|
ddim.x = dim.x*6.5f;
|
|
|
|
|
ddim.y = dim.y*0.6f;
|
|
|
|
|
GetResource(RES_TEXT, RT_PLAY_RESUME, name);
|
|
|
|
|
pl = pw->CreateLabel(pos, ddim, 0, EVENT_LABEL13, name);
|
2012-09-15 19:47:19 +00:00
|
|
|
|
pl->SetTextAlign(Gfx::TEXT_ALIGN_LEFT);
|
2012-06-26 21:01:17 +00:00
|
|
|
|
|
2012-06-26 20:23:05 +00:00
|
|
|
|
pos.x = ox+sx*3;
|
|
|
|
|
pos.y = oy+sy*3.6f;
|
|
|
|
|
ddim.x = dim.x*13.4f;
|
|
|
|
|
ddim.y = dim.y*1.9f;
|
|
|
|
|
pe = pw->CreateEdit(pos, ddim, 0, EVENT_INTERFACE_RESUME);
|
|
|
|
|
pe->SetState(STATE_SHADOW);
|
|
|
|
|
pe->SetMaxChar(500);
|
|
|
|
|
pe->SetEditCap(false); // just to see
|
2013-03-20 20:50:44 +00:00
|
|
|
|
pe->SetHighlightCap(false);
|
2012-06-26 20:23:05 +00:00
|
|
|
|
|
|
|
|
|
// Button displays the "soluce":
|
|
|
|
|
if ( m_phase != PHASE_TRAINER &&
|
2014-07-10 15:39:45 +00:00
|
|
|
|
m_phase != PHASE_FREE )
|
2012-06-26 20:23:05 +00:00
|
|
|
|
{
|
|
|
|
|
pos.x = ox+sx*9.5f;
|
|
|
|
|
pos.y = oy+sy*5.8f;
|
|
|
|
|
ddim.x = dim.x*6.5f;
|
|
|
|
|
ddim.y = dim.y*0.5f;
|
|
|
|
|
pc = pw->CreateCheck(pos, ddim, -1, EVENT_INTERFACE_SOLUCE);
|
|
|
|
|
pc->SetState(STATE_SHADOW);
|
|
|
|
|
pc->ClearState(STATE_CHECK);
|
|
|
|
|
}
|
|
|
|
|
m_bSceneSoluce = false;
|
|
|
|
|
|
2015-07-18 17:43:22 +00:00
|
|
|
|
UpdateSceneResume(m_chap[m_category]+1, m_sel[m_category]+1);
|
2012-06-26 20:23:05 +00:00
|
|
|
|
|
|
|
|
|
if ( m_phase == PHASE_MISSION ||
|
2012-09-29 21:52:30 +00:00
|
|
|
|
m_phase == PHASE_FREE ||
|
|
|
|
|
m_phase == PHASE_USER )
|
2012-06-26 20:23:05 +00:00
|
|
|
|
{
|
|
|
|
|
pos.x = ox+sx*9.5f;
|
|
|
|
|
pos.y = oy+sy*2;
|
|
|
|
|
ddim.x = dim.x*3.7f;
|
|
|
|
|
ddim.y = dim.y*1;
|
|
|
|
|
pb = pw->CreateButton(pos, ddim, -1, EVENT_INTERFACE_PLAY);
|
|
|
|
|
pb->SetState(STATE_SHADOW);
|
|
|
|
|
if ( m_maxList == 0 )
|
|
|
|
|
{
|
|
|
|
|
pb->ClearState(STATE_ENABLE);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
pos.x += dim.x*4.0f;
|
|
|
|
|
ddim.x = dim.x*2.5f;
|
|
|
|
|
pb = pw->CreateButton(pos, ddim, -1, EVENT_INTERFACE_READ);
|
|
|
|
|
pb->SetState(STATE_SHADOW);
|
|
|
|
|
if ( !IsIOReadScene() ) // no file to read?
|
|
|
|
|
{
|
|
|
|
|
pb->ClearState(STATE_ENABLE);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
pos.x = ox+sx*9.5f;
|
|
|
|
|
pos.y = oy+sy*2;
|
|
|
|
|
ddim.x = dim.x*6.5f;
|
|
|
|
|
ddim.y = dim.y*1;
|
|
|
|
|
pb = pw->CreateButton(pos, ddim, -1, EVENT_INTERFACE_PLAY);
|
|
|
|
|
pb->SetState(STATE_SHADOW);
|
|
|
|
|
if ( m_maxList == 0 )
|
|
|
|
|
{
|
|
|
|
|
pb->ClearState(STATE_ENABLE);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
pos.x = ox+sx*3;
|
|
|
|
|
ddim.x = dim.x*4;
|
|
|
|
|
pb = pw->CreateButton(pos, ddim, -1, EVENT_INTERFACE_BACK);
|
|
|
|
|
pb->SetState(STATE_SHADOW);
|
|
|
|
|
|
2014-07-10 14:25:40 +00:00
|
|
|
|
m_engine->SetBackground("interface/interface.png",
|
2012-09-29 21:52:30 +00:00
|
|
|
|
Gfx::Color(0.0f, 0.0f, 0.0f, 0.0f),
|
|
|
|
|
Gfx::Color(0.0f, 0.0f, 0.0f, 0.0f),
|
|
|
|
|
Gfx::Color(0.0f, 0.0f, 0.0f, 0.0f),
|
|
|
|
|
Gfx::Color(0.0f, 0.0f, 0.0f, 0.0f),
|
2013-05-11 21:05:20 +00:00
|
|
|
|
true);
|
2012-06-26 20:23:05 +00:00
|
|
|
|
m_engine->SetBackForce(true);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if ( m_phase == PHASE_SETUPd ||
|
2012-09-29 21:52:30 +00:00
|
|
|
|
m_phase == PHASE_SETUPg ||
|
|
|
|
|
m_phase == PHASE_SETUPp ||
|
|
|
|
|
m_phase == PHASE_SETUPc ||
|
|
|
|
|
m_phase == PHASE_SETUPs ||
|
|
|
|
|
m_phase == PHASE_SETUPds ||
|
|
|
|
|
m_phase == PHASE_SETUPgs ||
|
|
|
|
|
m_phase == PHASE_SETUPps ||
|
|
|
|
|
m_phase == PHASE_SETUPcs ||
|
|
|
|
|
m_phase == PHASE_SETUPss )
|
2012-06-26 20:23:05 +00:00
|
|
|
|
{
|
|
|
|
|
if ( m_phase == PHASE_SETUPds )
|
|
|
|
|
{
|
|
|
|
|
m_phaseSetup = PHASE_SETUPd;
|
|
|
|
|
m_bSimulSetup = true;
|
|
|
|
|
}
|
|
|
|
|
else if ( m_phase == PHASE_SETUPgs )
|
|
|
|
|
{
|
|
|
|
|
m_phaseSetup = PHASE_SETUPg;
|
|
|
|
|
m_bSimulSetup = true;
|
|
|
|
|
}
|
|
|
|
|
else if ( m_phase == PHASE_SETUPps )
|
|
|
|
|
{
|
|
|
|
|
m_phaseSetup = PHASE_SETUPp;
|
|
|
|
|
m_bSimulSetup = true;
|
|
|
|
|
}
|
|
|
|
|
else if ( m_phase == PHASE_SETUPcs )
|
|
|
|
|
{
|
|
|
|
|
m_phaseSetup = PHASE_SETUPc;
|
|
|
|
|
m_bSimulSetup = true;
|
|
|
|
|
}
|
|
|
|
|
else if ( m_phase == PHASE_SETUPss )
|
|
|
|
|
{
|
|
|
|
|
m_phaseSetup = PHASE_SETUPs;
|
|
|
|
|
m_bSimulSetup = true;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
m_phaseSetup = m_phase;
|
|
|
|
|
m_bSimulSetup = false;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
pos.x = 0.10f;
|
|
|
|
|
pos.y = 0.10f;
|
|
|
|
|
ddim.x = 0.80f;
|
|
|
|
|
ddim.y = 0.80f;
|
|
|
|
|
pw = m_interface->CreateWindows(pos, ddim, 12, EVENT_WINDOW5);
|
|
|
|
|
pw->SetClosable(true);
|
|
|
|
|
GetResource(RES_TEXT, RT_TITLE_SETUP, name);
|
|
|
|
|
pw->SetName(name);
|
|
|
|
|
|
|
|
|
|
pos.x = 0.70f;
|
|
|
|
|
pos.y = 0.10f;
|
|
|
|
|
ddim.x = 0.20f;
|
|
|
|
|
ddim.y = 0.20f;
|
|
|
|
|
pw->CreateGroup(pos, ddim, 4, EVENT_INTERFACE_GLINTr); // blue corner
|
|
|
|
|
|
|
|
|
|
pos.x = 0.10f;
|
|
|
|
|
ddim.x = 0.80f;
|
|
|
|
|
pos.y = 0.76f;
|
|
|
|
|
ddim.y = 0.05f;
|
|
|
|
|
pw->CreateGroup(pos, ddim, 3, EVENT_NULL); // transparent -> gray
|
|
|
|
|
|
|
|
|
|
ddim.x = 0.78f/5-0.01f;
|
|
|
|
|
ddim.y = 0.06f;
|
|
|
|
|
pos.x = 0.115f;
|
|
|
|
|
pos.y = 0.76f;
|
|
|
|
|
pb = pw->CreateButton(pos, ddim, -1, EVENT_INTERFACE_SETUPd);
|
|
|
|
|
pb->SetState(STATE_SHADOW);
|
|
|
|
|
pb->SetState(STATE_CARD);
|
|
|
|
|
pb->SetState(STATE_CHECK, (m_phase == PHASE_SETUPd || m_phase == PHASE_SETUPds));
|
2014-10-25 15:28:30 +00:00
|
|
|
|
#if PLATFORM_WINDOWS
|
2014-10-25 15:23:09 +00:00
|
|
|
|
pb->SetState(STATE_ENABLE, !m_bSimulSetup);
|
2014-10-25 15:28:30 +00:00
|
|
|
|
#endif
|
2012-06-26 20:23:05 +00:00
|
|
|
|
|
|
|
|
|
pos.x += ddim.x+0.01f;
|
|
|
|
|
pb = pw->CreateButton(pos, ddim, -1, EVENT_INTERFACE_SETUPg);
|
|
|
|
|
pb->SetState(STATE_SHADOW);
|
|
|
|
|
pb->SetState(STATE_CARD);
|
|
|
|
|
pb->SetState(STATE_CHECK, (m_phase == PHASE_SETUPg || m_phase == PHASE_SETUPgs));
|
|
|
|
|
|
|
|
|
|
pos.x += ddim.x+0.01f;
|
|
|
|
|
pb = pw->CreateButton(pos, ddim, -1, EVENT_INTERFACE_SETUPp);
|
|
|
|
|
pb->SetState(STATE_SHADOW);
|
|
|
|
|
pb->SetState(STATE_CARD);
|
|
|
|
|
pb->SetState(STATE_CHECK, (m_phase == PHASE_SETUPp || m_phase == PHASE_SETUPps));
|
|
|
|
|
|
|
|
|
|
pos.x += ddim.x+0.01f;
|
|
|
|
|
pb = pw->CreateButton(pos, ddim, -1, EVENT_INTERFACE_SETUPc);
|
|
|
|
|
pb->SetState(STATE_SHADOW);
|
|
|
|
|
pb->SetState(STATE_CARD);
|
|
|
|
|
pb->SetState(STATE_CHECK, (m_phase == PHASE_SETUPc || m_phase == PHASE_SETUPcs));
|
|
|
|
|
|
|
|
|
|
pos.x += ddim.x+0.01f;
|
|
|
|
|
pb = pw->CreateButton(pos, ddim, -1, EVENT_INTERFACE_SETUPs);
|
|
|
|
|
pb->SetState(STATE_SHADOW);
|
|
|
|
|
pb->SetState(STATE_CARD);
|
|
|
|
|
pb->SetState(STATE_CHECK, (m_phase == PHASE_SETUPs || m_phase == PHASE_SETUPss));
|
|
|
|
|
|
|
|
|
|
pos.x = 0.10f;
|
|
|
|
|
ddim.x = 0.80f;
|
|
|
|
|
pos.y = 0.34f;
|
|
|
|
|
ddim.y = 0.42f;
|
|
|
|
|
pw->CreateGroup(pos, ddim, 2, EVENT_INTERFACE_GLINTu); // orange -> transparent
|
|
|
|
|
pos.x = 0.10f+(6.0f/640.0f);
|
|
|
|
|
ddim.x = 0.80f-(11.0f/640.0f);
|
|
|
|
|
pos.y = 0.74f;
|
|
|
|
|
ddim.y = 0.02f;
|
|
|
|
|
pw->CreateGroup(pos, ddim, 1, EVENT_INTERFACE_GLINTb); // orange bar
|
|
|
|
|
|
|
|
|
|
ddim.x = dim.x*4;
|
|
|
|
|
ddim.y = dim.y*1;
|
|
|
|
|
pos.x = ox+sx*3;
|
|
|
|
|
pos.y = oy+sy*2;
|
|
|
|
|
pb = pw->CreateButton(pos, ddim, -1, EVENT_INTERFACE_BACK);
|
|
|
|
|
pb->SetState(STATE_SHADOW);
|
|
|
|
|
|
|
|
|
|
if ( !m_bSimulSetup )
|
|
|
|
|
{
|
2014-07-10 14:25:40 +00:00
|
|
|
|
m_engine->SetBackground("interface/interface.png",
|
2012-09-29 21:52:30 +00:00
|
|
|
|
Gfx::Color(0.0f, 0.0f, 0.0f, 0.0f),
|
|
|
|
|
Gfx::Color(0.0f, 0.0f, 0.0f, 0.0f),
|
|
|
|
|
Gfx::Color(0.0f, 0.0f, 0.0f, 0.0f),
|
|
|
|
|
Gfx::Color(0.0f, 0.0f, 0.0f, 0.0f),
|
2013-05-11 21:05:20 +00:00
|
|
|
|
true);
|
2012-06-26 20:23:05 +00:00
|
|
|
|
m_engine->SetBackForce(true);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if ( m_phase == PHASE_SETUPd || // setup/display ?
|
2012-09-29 21:52:30 +00:00
|
|
|
|
m_phase == PHASE_SETUPds )
|
2012-06-26 20:23:05 +00:00
|
|
|
|
{
|
|
|
|
|
pos.x = ox+sx*3;
|
|
|
|
|
pos.y = oy+sy*9;
|
|
|
|
|
ddim.x = dim.x*6;
|
|
|
|
|
ddim.y = dim.y*1;
|
|
|
|
|
GetResource(RES_TEXT, RT_SETUP_MODE, name);
|
|
|
|
|
pl = pw->CreateLabel(pos, ddim, 0, EVENT_LABEL2, name);
|
2012-09-15 19:47:19 +00:00
|
|
|
|
pl->SetTextAlign(Gfx::TEXT_ALIGN_LEFT);
|
2012-06-26 20:23:05 +00:00
|
|
|
|
|
2012-09-15 19:47:19 +00:00
|
|
|
|
m_setupFull = m_app->GetVideoConfig().fullScreen;
|
2012-12-25 20:36:50 +00:00
|
|
|
|
pos.x = ox+sx*3;
|
2012-06-26 20:23:05 +00:00
|
|
|
|
pos.y = oy+sy*5.2f;
|
|
|
|
|
ddim.x = dim.x*6;
|
|
|
|
|
ddim.y = dim.y*4.5f;
|
|
|
|
|
pli = pw->CreateList(pos, ddim, 0, EVENT_LIST2);
|
|
|
|
|
pli->SetState(STATE_SHADOW);
|
|
|
|
|
UpdateDisplayMode();
|
|
|
|
|
|
|
|
|
|
ddim.x = dim.x*4;
|
|
|
|
|
ddim.y = dim.y*0.5f;
|
|
|
|
|
pos.x = ox+sx*3;
|
|
|
|
|
pos.y = oy+sy*4.1f;
|
|
|
|
|
pc = pw->CreateCheck(pos, ddim, -1, EVENT_INTERFACE_FULL);
|
|
|
|
|
pc->SetState(STATE_SHADOW);
|
|
|
|
|
pc->SetState(STATE_CHECK, m_setupFull);
|
2015-06-21 18:59:23 +00:00
|
|
|
|
|
2014-10-25 16:43:02 +00:00
|
|
|
|
#if !PLATFORM_LINUX
|
|
|
|
|
ddim.x = 0.9f;
|
|
|
|
|
ddim.y = 0.1f;
|
|
|
|
|
pos.x = 0.05f;
|
|
|
|
|
pos.y = 0.20f;
|
|
|
|
|
pl = pw->CreateLabel(pos, ddim, 0, EVENT_LABEL1, "The game will be restarted in order to apply changes. All unsaved progress will be lost.");
|
|
|
|
|
#endif
|
2012-06-26 20:23:05 +00:00
|
|
|
|
|
|
|
|
|
ddim.x = dim.x*6;
|
|
|
|
|
ddim.y = dim.y*1;
|
|
|
|
|
pos.x = ox+sx*10;
|
|
|
|
|
pos.y = oy+sy*2;
|
|
|
|
|
pb = pw->CreateButton(pos, ddim, -1, EVENT_INTERFACE_APPLY);
|
|
|
|
|
pb->SetState(STATE_SHADOW);
|
|
|
|
|
UpdateApply();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if ( m_phase == PHASE_SETUPg || // setup/graphic ?
|
2012-09-29 21:52:30 +00:00
|
|
|
|
m_phase == PHASE_SETUPgs )
|
2012-06-26 20:23:05 +00:00
|
|
|
|
{
|
|
|
|
|
ddim.x = dim.x*6;
|
|
|
|
|
ddim.y = dim.y*0.5f;
|
|
|
|
|
pos.x = ox+sx*3;
|
|
|
|
|
pos.y = 0.65f;
|
|
|
|
|
pc = pw->CreateCheck(pos, ddim, -1, EVENT_INTERFACE_SHADOW);
|
|
|
|
|
pc->SetState(STATE_SHADOW);
|
|
|
|
|
pos.y -= 0.048f;
|
|
|
|
|
if ( !m_bSimulSetup )
|
|
|
|
|
{
|
|
|
|
|
pc = pw->CreateCheck(pos, ddim, -1, EVENT_INTERFACE_GROUND);
|
|
|
|
|
pc->SetState(STATE_SHADOW);
|
2012-09-15 19:47:19 +00:00
|
|
|
|
// TODO: video 8 MB?
|
|
|
|
|
//if ( m_engine->IsVideo8MB() ) pc->ClearState(STATE_ENABLE);
|
2012-06-26 20:23:05 +00:00
|
|
|
|
}
|
|
|
|
|
pos.y -= 0.048f;
|
|
|
|
|
pc = pw->CreateCheck(pos, ddim, -1, EVENT_INTERFACE_DIRTY);
|
|
|
|
|
pc->SetState(STATE_SHADOW);
|
|
|
|
|
pos.y -= 0.048f;
|
|
|
|
|
pc = pw->CreateCheck(pos, ddim, -1, EVENT_INTERFACE_SKY);
|
|
|
|
|
pc->SetState(STATE_SHADOW);
|
2012-09-15 19:47:19 +00:00
|
|
|
|
// TODO: video 8 MB?
|
|
|
|
|
//if ( m_engine->IsVideo8MB() ) pc->ClearState(STATE_ENABLE);
|
2012-06-26 20:23:05 +00:00
|
|
|
|
pos.y -= 0.048f;
|
|
|
|
|
pc = pw->CreateCheck(pos, ddim, -1, EVENT_INTERFACE_LENS);
|
|
|
|
|
pc->SetState(STATE_SHADOW);
|
|
|
|
|
pos.y -= 0.048f;
|
|
|
|
|
pc = pw->CreateCheck(pos, ddim, -1, EVENT_INTERFACE_PLANET);
|
|
|
|
|
pc->SetState(STATE_SHADOW);
|
|
|
|
|
pos.y -= 0.048f;
|
|
|
|
|
pc = pw->CreateCheck(pos, ddim, -1, EVENT_INTERFACE_FOG);
|
|
|
|
|
pc->SetState(STATE_SHADOW);
|
|
|
|
|
pos.y -= 0.048f;
|
|
|
|
|
if ( !m_bSimulSetup )
|
|
|
|
|
{
|
|
|
|
|
pc = pw->CreateCheck(pos, ddim, -1, EVENT_INTERFACE_LIGHT);
|
|
|
|
|
pc->SetState(STATE_SHADOW);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
pos.x = ox+sx*8.5f;
|
|
|
|
|
pos.y = 0.65f;
|
|
|
|
|
ddim.x = dim.x*2.2f;
|
|
|
|
|
ddim.y = 18.0f/480.0f;
|
|
|
|
|
pv = pw->CreateEditValue(pos, ddim, 0, EVENT_INTERFACE_PARTI);
|
|
|
|
|
pv->SetState(STATE_SHADOW);
|
|
|
|
|
pv->SetMinValue(0.0f);
|
|
|
|
|
pv->SetMaxValue(2.0f);
|
|
|
|
|
pos.x += 0.13f;
|
|
|
|
|
pos.y -= 0.015f;
|
|
|
|
|
ddim.x = 0.40f;
|
|
|
|
|
GetResource(RES_EVENT, EVENT_INTERFACE_PARTI, name);
|
|
|
|
|
pl = pw->CreateLabel(pos, ddim, 0, EVENT_LABEL10, name);
|
2012-09-15 19:47:19 +00:00
|
|
|
|
pl->SetTextAlign(Gfx::TEXT_ALIGN_LEFT);
|
2012-06-26 20:23:05 +00:00
|
|
|
|
|
|
|
|
|
pos.x = ox+sx*8.5f;
|
|
|
|
|
pos.y = 0.59f;
|
|
|
|
|
ddim.x = dim.x*2.2f;
|
|
|
|
|
ddim.y = 18.0f/480.0f;
|
|
|
|
|
pv = pw->CreateEditValue(pos, ddim, 0, EVENT_INTERFACE_CLIP);
|
|
|
|
|
pv->SetState(STATE_SHADOW);
|
|
|
|
|
pv->SetMinValue(0.5f);
|
|
|
|
|
pv->SetMaxValue(2.0f);
|
|
|
|
|
pos.x += 0.13f;
|
|
|
|
|
pos.y -= 0.015f;
|
|
|
|
|
ddim.x = 0.40f;
|
|
|
|
|
GetResource(RES_EVENT, EVENT_INTERFACE_CLIP, name);
|
|
|
|
|
pl = pw->CreateLabel(pos, ddim, 0, EVENT_LABEL11, name);
|
2012-09-15 19:47:19 +00:00
|
|
|
|
pl->SetTextAlign(Gfx::TEXT_ALIGN_LEFT);
|
2012-06-26 20:23:05 +00:00
|
|
|
|
|
|
|
|
|
pos.x = ox+sx*8.5f;
|
|
|
|
|
pos.y = 0.53f;
|
|
|
|
|
ddim.x = dim.x*2.2f;
|
|
|
|
|
ddim.y = 18.0f/480.0f;
|
|
|
|
|
pv = pw->CreateEditValue(pos, ddim, 0, EVENT_INTERFACE_DETAIL);
|
|
|
|
|
pv->SetState(STATE_SHADOW);
|
|
|
|
|
pv->SetMinValue(0.0f);
|
|
|
|
|
pv->SetMaxValue(2.0f);
|
|
|
|
|
pos.x += 0.13f;
|
|
|
|
|
pos.y -= 0.015f;
|
|
|
|
|
ddim.x = 0.40f;
|
|
|
|
|
GetResource(RES_EVENT, EVENT_INTERFACE_DETAIL, name);
|
|
|
|
|
pl = pw->CreateLabel(pos, ddim, 0, EVENT_LABEL12, name);
|
2012-09-15 19:47:19 +00:00
|
|
|
|
pl->SetTextAlign(Gfx::TEXT_ALIGN_LEFT);
|
2012-06-26 20:23:05 +00:00
|
|
|
|
|
|
|
|
|
if ( !m_bSimulSetup )
|
|
|
|
|
{
|
|
|
|
|
pos.x = ox+sx*8.5f;
|
|
|
|
|
pos.y = 0.47f;
|
|
|
|
|
ddim.x = dim.x*2.2f;
|
|
|
|
|
ddim.y = 18.0f/480.0f;
|
|
|
|
|
pv = pw->CreateEditValue(pos, ddim, 0, EVENT_INTERFACE_GADGET);
|
|
|
|
|
pv->SetState(STATE_SHADOW);
|
|
|
|
|
pv->SetMinValue(0.0f);
|
|
|
|
|
pv->SetMaxValue(1.0f);
|
|
|
|
|
pos.x += 0.13f;
|
|
|
|
|
pos.y -= 0.015f;
|
|
|
|
|
ddim.x = 0.40f;
|
|
|
|
|
GetResource(RES_EVENT, EVENT_INTERFACE_GADGET, name);
|
|
|
|
|
pl = pw->CreateLabel(pos, ddim, 0, EVENT_LABEL13, name);
|
2012-09-15 19:47:19 +00:00
|
|
|
|
pl->SetTextAlign(Gfx::TEXT_ALIGN_LEFT);
|
2012-06-26 20:23:05 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#if 0
|
|
|
|
|
if ( !m_bSimulSetup )
|
|
|
|
|
{
|
|
|
|
|
pos.x = ox+sx*8.5f;
|
|
|
|
|
pos.y = 0.41f;
|
|
|
|
|
ddim.x = dim.x*2.2f;
|
|
|
|
|
ddim.y = 18.0f/480.0f;
|
|
|
|
|
pv = pw->CreateEditValue(pos, ddim, 0, EVENT_INTERFACE_TEXTURE);
|
|
|
|
|
pv->SetState(STATE_SHADOW);
|
|
|
|
|
pv->SetType(EVT_INT);
|
|
|
|
|
pv->SetMinValue(0.0f);
|
|
|
|
|
pv->SetMaxValue(2.0f);
|
|
|
|
|
pv->SetStepValue(1.0f);
|
|
|
|
|
pos.x += 0.13f;
|
|
|
|
|
pos.y -= 0.015f;
|
|
|
|
|
ddim.x = 0.40f;
|
|
|
|
|
GetResource(RES_EVENT, EVENT_INTERFACE_TEXTURE, name);
|
|
|
|
|
pl = pw->CreateLabel(pos, ddim, 0, EVENT_LABEL14, name);
|
2012-09-15 19:47:19 +00:00
|
|
|
|
pl->SetTextAlign(Gfx::TEXT_ALIGN_LEFT);
|
2012-06-26 20:23:05 +00:00
|
|
|
|
}
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
ddim.x = dim.x*2;
|
|
|
|
|
ddim.y = dim.y*1;
|
|
|
|
|
pos.x = ox+sx*10;
|
|
|
|
|
pos.y = oy+sy*2;
|
2015-06-21 18:59:23 +00:00
|
|
|
|
|
2012-06-26 20:23:05 +00:00
|
|
|
|
pb = pw->CreateButton(pos, ddim, -1, EVENT_INTERFACE_MIN);
|
|
|
|
|
pb->SetState(STATE_SHADOW);
|
|
|
|
|
pos.x += ddim.x;
|
|
|
|
|
pb = pw->CreateButton(pos, ddim, -1, EVENT_INTERFACE_NORM);
|
|
|
|
|
pb->SetState(STATE_SHADOW);
|
|
|
|
|
pos.x += ddim.x;
|
|
|
|
|
pb = pw->CreateButton(pos, ddim, -1, EVENT_INTERFACE_MAX);
|
|
|
|
|
pb->SetState(STATE_SHADOW);
|
|
|
|
|
|
|
|
|
|
UpdateSetupButtons();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if ( m_phase == PHASE_SETUPp || // setup/game ?
|
2012-09-29 21:52:30 +00:00
|
|
|
|
m_phase == PHASE_SETUPps )
|
2012-06-26 20:23:05 +00:00
|
|
|
|
{
|
|
|
|
|
ddim.x = dim.x*6;
|
|
|
|
|
ddim.y = dim.y*0.5f;
|
|
|
|
|
pos.x = ox+sx*3;
|
|
|
|
|
pos.y = 0.65f;
|
2012-09-29 21:52:30 +00:00
|
|
|
|
//? pc = pw->CreateCheck(pos, ddim, -1, EVENT_INTERFACE_TOTO);
|
|
|
|
|
//? pc->SetState(STATE_SHADOW);
|
|
|
|
|
//? pos.y -= 0.048f;
|
2015-06-21 18:59:23 +00:00
|
|
|
|
|
2012-06-26 20:23:05 +00:00
|
|
|
|
pc = pw->CreateCheck(pos, ddim, -1, EVENT_INTERFACE_MOVIES);
|
|
|
|
|
pc->SetState(STATE_SHADOW);
|
|
|
|
|
pos.y -= 0.048f;
|
2012-09-29 21:52:30 +00:00
|
|
|
|
//#endif
|
2012-06-26 20:23:05 +00:00
|
|
|
|
pc = pw->CreateCheck(pos, ddim, -1, EVENT_INTERFACE_SCROLL);
|
|
|
|
|
pc->SetState(STATE_SHADOW);
|
|
|
|
|
pos.y -= 0.048f;
|
|
|
|
|
pc = pw->CreateCheck(pos, ddim, -1, EVENT_INTERFACE_INVERTX);
|
|
|
|
|
pc->SetState(STATE_SHADOW);
|
|
|
|
|
pos.y -= 0.048f;
|
|
|
|
|
pc = pw->CreateCheck(pos, ddim, -1, EVENT_INTERFACE_INVERTY);
|
|
|
|
|
pc->SetState(STATE_SHADOW);
|
|
|
|
|
pos.y -= 0.048f;
|
|
|
|
|
pc = pw->CreateCheck(pos, ddim, -1, EVENT_INTERFACE_EFFECT);
|
|
|
|
|
pc->SetState(STATE_SHADOW);
|
2014-10-22 04:44:17 +00:00
|
|
|
|
pos.y -= 0.048f;
|
|
|
|
|
pc = pw->CreateCheck(pos, ddim, -1, EVENT_INTERFACE_BLOOD);
|
|
|
|
|
pc->SetState(STATE_SHADOW);
|
2014-11-11 13:50:44 +00:00
|
|
|
|
pos.y -= 0.048f;
|
|
|
|
|
pc = pw->CreateCheck(pos, ddim, -1, EVENT_INTERFACE_AUTOSAVE_ENABLE);
|
|
|
|
|
pc->SetState(STATE_SHADOW);
|
|
|
|
|
pos.y -= 0.048f;
|
2015-06-21 18:59:23 +00:00
|
|
|
|
|
2014-11-11 13:50:44 +00:00
|
|
|
|
pos.y -= ddim.y;
|
|
|
|
|
ddim.x = dim.x*2.5f;
|
|
|
|
|
psl = pw->CreateSlider(pos, ddim, -1, EVENT_INTERFACE_AUTOSAVE_INTERVAL);
|
|
|
|
|
psl->SetState(STATE_SHADOW);
|
|
|
|
|
psl->SetLimit(1.0f, 30.0f);
|
|
|
|
|
psl->SetArrowStep(1.0f);
|
|
|
|
|
pos.y += ddim.y/2;
|
|
|
|
|
GetResource(RES_EVENT, EVENT_INTERFACE_AUTOSAVE_INTERVAL, name);
|
|
|
|
|
pl = pw->CreateLabel(pos, ddim, 0, EVENT_LABEL1, name);
|
|
|
|
|
pl->SetTextAlign(Gfx::TEXT_ALIGN_LEFT);
|
|
|
|
|
pos.y -= ddim.y/2;
|
|
|
|
|
pos.x = ox+sx*3+dim.x*3.5f;
|
|
|
|
|
psl = pw->CreateSlider(pos, ddim, -1, EVENT_INTERFACE_AUTOSAVE_SLOTS);
|
|
|
|
|
psl->SetState(STATE_SHADOW);
|
|
|
|
|
psl->SetLimit(1.0f, 10.0f);
|
|
|
|
|
psl->SetArrowStep(1.0f);
|
|
|
|
|
pos.y += ddim.y/2;
|
|
|
|
|
GetResource(RES_EVENT, EVENT_INTERFACE_AUTOSAVE_SLOTS, name);
|
|
|
|
|
pl = pw->CreateLabel(pos, ddim, 0, EVENT_LABEL1, name);
|
|
|
|
|
pl->SetTextAlign(Gfx::TEXT_ALIGN_LEFT);
|
|
|
|
|
pos.y -= ddim.y/2;
|
2015-06-21 18:59:23 +00:00
|
|
|
|
|
|
|
|
|
|
2012-09-29 21:52:30 +00:00
|
|
|
|
//? pos.y -= 0.048f;
|
|
|
|
|
//? pc = pw->CreateCheck(pos, ddim, -1, EVENT_INTERFACE_NICERST);
|
|
|
|
|
//? pc->SetState(STATE_SHADOW);
|
|
|
|
|
//? pos.y -= 0.048f;
|
|
|
|
|
//? pc = pw->CreateCheck(pos, ddim, -1, EVENT_INTERFACE_HIMSELF);
|
|
|
|
|
//? pc->SetState(STATE_SHADOW);
|
2012-06-26 20:23:05 +00:00
|
|
|
|
|
|
|
|
|
ddim.x = dim.x*6;
|
|
|
|
|
ddim.y = dim.y*0.5f;
|
|
|
|
|
pos.x = ox+sx*10;
|
|
|
|
|
pos.y = 0.65f;
|
|
|
|
|
pc = pw->CreateCheck(pos, ddim, -1, EVENT_INTERFACE_TOOLTIP);
|
|
|
|
|
pc->SetState(STATE_SHADOW);
|
|
|
|
|
pos.y -= 0.048f;
|
|
|
|
|
pc = pw->CreateCheck(pos, ddim, -1, EVENT_INTERFACE_GLINT);
|
|
|
|
|
pc->SetState(STATE_SHADOW);
|
|
|
|
|
pos.y -= 0.048f;
|
|
|
|
|
pc = pw->CreateCheck(pos, ddim, -1, EVENT_INTERFACE_RAIN);
|
|
|
|
|
pc->SetState(STATE_SHADOW);
|
|
|
|
|
pos.y -= 0.048f;
|
2015-07-13 10:11:11 +00:00
|
|
|
|
pc = pw->CreateCheck(pos, ddim, -1, EVENT_INTERFACE_MOUSE);
|
|
|
|
|
pc->SetState(STATE_SHADOW);
|
2012-06-26 20:23:05 +00:00
|
|
|
|
pos.y -= 0.048f;
|
|
|
|
|
pos.y -= 0.048f;
|
|
|
|
|
if ( !m_bSimulSetup )
|
|
|
|
|
{
|
|
|
|
|
pc = pw->CreateCheck(pos, ddim, -1, EVENT_INTERFACE_EDITMODE);
|
|
|
|
|
pc->SetState(STATE_SHADOW);
|
|
|
|
|
}
|
|
|
|
|
pos.y -= 0.048f;
|
|
|
|
|
pc = pw->CreateCheck(pos, ddim, -1, EVENT_INTERFACE_EDITVALUE);
|
|
|
|
|
pc->SetState(STATE_SHADOW);
|
|
|
|
|
|
|
|
|
|
UpdateSetupButtons();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if ( m_phase == PHASE_SETUPc || // setup/commands ?
|
2012-09-29 21:52:30 +00:00
|
|
|
|
m_phase == PHASE_SETUPcs )
|
2012-06-26 20:23:05 +00:00
|
|
|
|
{
|
|
|
|
|
pos.x = ox+sx*3;
|
|
|
|
|
pos.y = 320.0f/480.0f;
|
|
|
|
|
ddim.x = dim.x*15.0f;
|
|
|
|
|
ddim.y = 18.0f/480.0f;
|
|
|
|
|
GetResource(RES_TEXT, RT_SETUP_KEY1, name);
|
|
|
|
|
pl = pw->CreateLabel(pos, ddim, 0, EVENT_INTERFACE_KINFO1, name);
|
2012-09-15 19:47:19 +00:00
|
|
|
|
pl->SetTextAlign(Gfx::TEXT_ALIGN_LEFT);
|
2012-06-26 20:23:05 +00:00
|
|
|
|
|
|
|
|
|
pos.x = ox+sx*3;
|
|
|
|
|
pos.y = 302.0f/480.0f;
|
|
|
|
|
ddim.x = dim.x*15.0f;
|
|
|
|
|
ddim.y = 18.0f/480.0f;
|
|
|
|
|
GetResource(RES_TEXT, RT_SETUP_KEY2, name);
|
|
|
|
|
pl = pw->CreateLabel(pos, ddim, 0, EVENT_INTERFACE_KINFO2, name);
|
2012-09-15 19:47:19 +00:00
|
|
|
|
pl->SetTextAlign(Gfx::TEXT_ALIGN_LEFT);
|
2012-06-26 20:23:05 +00:00
|
|
|
|
|
|
|
|
|
ddim.x = 428.0f/640.0f;
|
|
|
|
|
ddim.y = 128.0f/480.0f;
|
|
|
|
|
pos.x = 105.0f/640.0f;
|
|
|
|
|
pos.y = 164.0f/480.0f;
|
|
|
|
|
pg = pw->CreateGroup(pos, ddim, 0, EVENT_INTERFACE_KGROUP);
|
|
|
|
|
pg->ClearState(STATE_ENABLE);
|
|
|
|
|
pg->SetState(STATE_DEAD);
|
|
|
|
|
pg->SetState(STATE_SHADOW);
|
|
|
|
|
|
|
|
|
|
ddim.x = 18.0f/640.0f;
|
|
|
|
|
ddim.y = (20.0f/480.0f)*KEY_VISIBLE;
|
|
|
|
|
pos.x = 510.0f/640.0f;
|
|
|
|
|
pos.y = 168.0f/480.0f;
|
|
|
|
|
ps = pw->CreateScroll(pos, ddim, -1, EVENT_INTERFACE_KSCROLL);
|
2014-12-14 15:54:32 +00:00
|
|
|
|
ps->SetVisibleRatio(static_cast<float>(KEY_VISIBLE/INPUT_SLOT_MAX));
|
|
|
|
|
ps->SetArrowStep(1.0f/(static_cast<float>(INPUT_SLOT_MAX-KEY_VISIBLE)));
|
2012-06-26 20:23:05 +00:00
|
|
|
|
UpdateKey();
|
|
|
|
|
|
|
|
|
|
ddim.x = dim.x*6;
|
|
|
|
|
ddim.y = dim.y*0.5f;
|
|
|
|
|
pos.x = ox+sx*3;
|
|
|
|
|
pos.y = 130.0f/480.0f;
|
|
|
|
|
pc = pw->CreateCheck(pos, ddim, -1, EVENT_INTERFACE_JOYSTICK);
|
|
|
|
|
pc->SetState(STATE_SHADOW);
|
|
|
|
|
|
|
|
|
|
ddim.x = dim.x*6;
|
|
|
|
|
ddim.y = dim.y*1;
|
|
|
|
|
pos.x = ox+sx*10;
|
|
|
|
|
pos.y = oy+sy*2;
|
|
|
|
|
pb = pw->CreateButton(pos, ddim, -1, EVENT_INTERFACE_KDEF);
|
|
|
|
|
pb->SetState(STATE_SHADOW);
|
|
|
|
|
|
|
|
|
|
UpdateSetupButtons();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if ( m_phase == PHASE_SETUPs || // setup/sound ?
|
2012-09-29 21:52:30 +00:00
|
|
|
|
m_phase == PHASE_SETUPss )
|
2012-06-26 20:23:05 +00:00
|
|
|
|
{
|
|
|
|
|
pos.x = ox+sx*3;
|
|
|
|
|
pos.y = 0.55f;
|
|
|
|
|
ddim.x = dim.x*4.0f;
|
|
|
|
|
ddim.y = 18.0f/480.0f;
|
|
|
|
|
psl = pw->CreateSlider(pos, ddim, 0, EVENT_INTERFACE_VOLSOUND);
|
|
|
|
|
psl->SetState(STATE_SHADOW);
|
|
|
|
|
psl->SetLimit(0.0f, MAXVOLUME);
|
|
|
|
|
psl->SetArrowStep(1.0f);
|
|
|
|
|
pos.y += ddim.y;
|
|
|
|
|
GetResource(RES_EVENT, EVENT_INTERFACE_VOLSOUND, name);
|
|
|
|
|
pl = pw->CreateLabel(pos, ddim, 0, EVENT_LABEL1, name);
|
2012-09-15 19:47:19 +00:00
|
|
|
|
pl->SetTextAlign(Gfx::TEXT_ALIGN_LEFT);
|
2012-06-26 20:23:05 +00:00
|
|
|
|
|
|
|
|
|
pos.x = ox+sx*3;
|
|
|
|
|
pos.y = 0.40f;
|
|
|
|
|
ddim.x = dim.x*4.0f;
|
|
|
|
|
ddim.y = 18.0f/480.0f;
|
|
|
|
|
psl = pw->CreateSlider(pos, ddim, 0, EVENT_INTERFACE_VOLMUSIC);
|
|
|
|
|
psl->SetState(STATE_SHADOW);
|
|
|
|
|
psl->SetLimit(0.0f, MAXVOLUME);
|
|
|
|
|
psl->SetArrowStep(1.0f);
|
|
|
|
|
pos.y += ddim.y;
|
|
|
|
|
GetResource(RES_EVENT, EVENT_INTERFACE_VOLMUSIC, name);
|
|
|
|
|
pl = pw->CreateLabel(pos, ddim, 0, EVENT_LABEL2, name);
|
2012-09-15 19:47:19 +00:00
|
|
|
|
pl->SetTextAlign(Gfx::TEXT_ALIGN_LEFT);
|
2012-06-26 20:23:05 +00:00
|
|
|
|
|
|
|
|
|
ddim.x = dim.x*3;
|
|
|
|
|
ddim.y = dim.y*1;
|
|
|
|
|
pos.x = ox+sx*10;
|
|
|
|
|
pos.y = oy+sy*2;
|
|
|
|
|
pb = pw->CreateButton(pos, ddim, -1, EVENT_INTERFACE_SILENT);
|
|
|
|
|
pb->SetState(STATE_SHADOW);
|
|
|
|
|
pos.x += ddim.x;
|
|
|
|
|
pb = pw->CreateButton(pos, ddim, -1, EVENT_INTERFACE_NOISY);
|
|
|
|
|
pb->SetState(STATE_SHADOW);
|
|
|
|
|
|
|
|
|
|
UpdateSetupButtons();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if ( m_phase == PHASE_WRITE ||
|
2012-09-29 21:52:30 +00:00
|
|
|
|
m_phase == PHASE_WRITEs )
|
2012-06-26 20:23:05 +00:00
|
|
|
|
{
|
|
|
|
|
pos.x = 0.10f;
|
|
|
|
|
pos.y = 0.10f;
|
|
|
|
|
ddim.x = 0.80f;
|
|
|
|
|
ddim.y = 0.80f;
|
|
|
|
|
pw = m_interface->CreateWindows(pos, ddim, 13, EVENT_WINDOW5);
|
|
|
|
|
pw->SetClosable(true);
|
|
|
|
|
GetResource(RES_TEXT, RT_TITLE_WRITE, name);
|
|
|
|
|
pw->SetName(name);
|
|
|
|
|
|
|
|
|
|
pos.x = 0.10f;
|
|
|
|
|
pos.y = 0.40f;
|
|
|
|
|
ddim.x = 0.50f;
|
|
|
|
|
ddim.y = 0.50f;
|
|
|
|
|
pw->CreateGroup(pos, ddim, 5, EVENT_INTERFACE_GLINTl); // orange corner
|
|
|
|
|
pos.x = 0.40f;
|
|
|
|
|
pos.y = 0.10f;
|
|
|
|
|
ddim.x = 0.50f;
|
|
|
|
|
ddim.y = 0.50f;
|
|
|
|
|
pw->CreateGroup(pos, ddim, 4, EVENT_INTERFACE_GLINTr); // blue corner
|
|
|
|
|
|
|
|
|
|
pos.x = 290.0f/640.0f;
|
|
|
|
|
ddim.x = 245.0f/640.0f;
|
|
|
|
|
|
|
|
|
|
pos.y = 146.0f/480.0f;
|
|
|
|
|
ddim.y = 18.0f/480.0f;
|
|
|
|
|
GetResource(RES_EVENT, EVENT_INTERFACE_IOLABEL, name);
|
|
|
|
|
pl = pw->CreateLabel(pos, ddim, 0, EVENT_INTERFACE_IOLABEL, name);
|
2012-09-15 19:47:19 +00:00
|
|
|
|
pl->SetTextAlign(Gfx::TEXT_ALIGN_LEFT);
|
2012-06-26 20:23:05 +00:00
|
|
|
|
|
|
|
|
|
pos.y = 130.0f/480.0f;
|
|
|
|
|
ddim.y = 18.0f/480.0f;
|
|
|
|
|
pe = pw->CreateEdit(pos, ddim, 0, EVENT_INTERFACE_IONAME);
|
|
|
|
|
pe->SetState(STATE_SHADOW);
|
2012-09-15 19:47:19 +00:00
|
|
|
|
pe->SetFontType(Gfx::FONT_COLOBOT);
|
2012-06-26 20:23:05 +00:00
|
|
|
|
pe->SetMaxChar(35);
|
|
|
|
|
IOReadName();
|
|
|
|
|
|
|
|
|
|
pos.y = 190.0f/480.0f;
|
|
|
|
|
ddim.y = 190.0f/480.0f;
|
|
|
|
|
pli = pw->CreateList(pos, ddim, 0, EVENT_INTERFACE_IOLIST);
|
|
|
|
|
pli->SetState(STATE_SHADOW);
|
|
|
|
|
|
|
|
|
|
pos.y = oy+sy*2;
|
|
|
|
|
ddim.y = dim.y*1;
|
|
|
|
|
pb = pw->CreateButton(pos, ddim, -1, EVENT_INTERFACE_IOWRITE);
|
|
|
|
|
pb->SetState(STATE_SHADOW);
|
|
|
|
|
|
|
|
|
|
pos.x = 105.0f/640.0f;
|
|
|
|
|
pos.y = 190.0f/480.0f;
|
|
|
|
|
ddim.x = 170.0f/640.0f;
|
|
|
|
|
ddim.y = dim.y*1;
|
|
|
|
|
pb = pw->CreateButton(pos, ddim, -1, EVENT_INTERFACE_IODELETE);
|
|
|
|
|
pb->SetState(STATE_SHADOW);
|
|
|
|
|
|
|
|
|
|
pos.x = 105.0f/640.0f;
|
|
|
|
|
pos.y = 250.0f/480.0f;
|
|
|
|
|
ddim.x = 170.0f/640.0f;
|
|
|
|
|
ddim.y = 128.0f/480.0f;
|
|
|
|
|
pi = pw->CreateImage(pos, ddim, 0, EVENT_INTERFACE_IOIMAGE);
|
|
|
|
|
pi->SetState(STATE_SHADOW);
|
|
|
|
|
|
|
|
|
|
ddim.x = dim.x*4;
|
|
|
|
|
ddim.y = dim.y*1;
|
|
|
|
|
pos.x = ox+sx*3;
|
|
|
|
|
pos.y = oy+sy*2;
|
|
|
|
|
pb = pw->CreateButton(pos, ddim, -1, EVENT_INTERFACE_BACK);
|
|
|
|
|
pb->SetState(STATE_SHADOW);
|
|
|
|
|
|
|
|
|
|
IOReadList();
|
|
|
|
|
IOUpdateList();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if ( m_phase == PHASE_READ ||
|
2013-05-26 15:47:54 +00:00
|
|
|
|
m_phase == PHASE_READs )
|
2012-06-26 20:23:05 +00:00
|
|
|
|
{
|
|
|
|
|
pos.x = 0.10f;
|
|
|
|
|
pos.y = 0.10f;
|
|
|
|
|
ddim.x = 0.80f;
|
|
|
|
|
ddim.y = 0.80f;
|
|
|
|
|
pw = m_interface->CreateWindows(pos, ddim, 14, EVENT_WINDOW5);
|
|
|
|
|
pw->SetClosable(true);
|
|
|
|
|
GetResource(RES_TEXT, RT_TITLE_READ, name);
|
|
|
|
|
pw->SetName(name);
|
|
|
|
|
|
|
|
|
|
pos.x = 0.10f;
|
|
|
|
|
pos.y = 0.40f;
|
|
|
|
|
ddim.x = 0.50f;
|
|
|
|
|
ddim.y = 0.50f;
|
|
|
|
|
pw->CreateGroup(pos, ddim, 5, EVENT_INTERFACE_GLINTl); // orange corner
|
|
|
|
|
pos.x = 0.40f;
|
|
|
|
|
pos.y = 0.10f;
|
|
|
|
|
ddim.x = 0.50f;
|
|
|
|
|
ddim.y = 0.50f;
|
|
|
|
|
pw->CreateGroup(pos, ddim, 4, EVENT_INTERFACE_GLINTr); // blue corner
|
|
|
|
|
|
|
|
|
|
pos.x = 290.0f/640.0f;
|
|
|
|
|
ddim.x = 245.0f/640.0f;
|
|
|
|
|
|
|
|
|
|
pos.y = 160.0f/480.0f;
|
|
|
|
|
ddim.y = 190.0f/480.0f;
|
|
|
|
|
pli = pw->CreateList(pos, ddim, 0, EVENT_INTERFACE_IOLIST);
|
|
|
|
|
pli->SetState(STATE_SHADOW);
|
|
|
|
|
|
|
|
|
|
pos.y = oy+sy*2;
|
|
|
|
|
ddim.y = dim.y*1;
|
|
|
|
|
pb = pw->CreateButton(pos, ddim, -1, EVENT_INTERFACE_IOREAD);
|
|
|
|
|
pb->SetState(STATE_SHADOW);
|
|
|
|
|
if ( m_phase == PHASE_READs )
|
|
|
|
|
{
|
|
|
|
|
pb->SetState(STATE_WARNING);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
pos.x = 105.0f/640.0f;
|
|
|
|
|
pos.y = 160.0f/480.0f;
|
|
|
|
|
ddim.x = 170.0f/640.0f;
|
|
|
|
|
ddim.y = dim.y*1;
|
|
|
|
|
pb = pw->CreateButton(pos, ddim, -1, EVENT_INTERFACE_IODELETE);
|
|
|
|
|
pb->SetState(STATE_SHADOW);
|
|
|
|
|
|
|
|
|
|
pos.x = 105.0f/640.0f;
|
|
|
|
|
pos.y = 220.0f/480.0f;
|
|
|
|
|
ddim.x = 170.0f/640.0f;
|
|
|
|
|
ddim.y = 128.0f/480.0f;
|
|
|
|
|
pi = pw->CreateImage(pos, ddim, 0, EVENT_INTERFACE_IOIMAGE);
|
|
|
|
|
pi->SetState(STATE_SHADOW);
|
|
|
|
|
|
|
|
|
|
ddim.x = dim.x*4;
|
|
|
|
|
ddim.y = dim.y*1;
|
|
|
|
|
pos.x = ox+sx*3;
|
|
|
|
|
pos.y = oy+sy*2;
|
|
|
|
|
pb = pw->CreateButton(pos, ddim, -1, EVENT_INTERFACE_BACK);
|
|
|
|
|
pb->SetState(STATE_SHADOW);
|
|
|
|
|
|
|
|
|
|
IOReadList();
|
|
|
|
|
IOUpdateList();
|
|
|
|
|
|
|
|
|
|
if ( m_phase == PHASE_READ )
|
|
|
|
|
{
|
2014-07-10 14:25:40 +00:00
|
|
|
|
m_engine->SetBackground("interface/interface.png",
|
2012-09-29 21:52:30 +00:00
|
|
|
|
Gfx::Color(0.0f, 0.0f, 0.0f, 0.0f),
|
|
|
|
|
Gfx::Color(0.0f, 0.0f, 0.0f, 0.0f),
|
|
|
|
|
Gfx::Color(0.0f, 0.0f, 0.0f, 0.0f),
|
|
|
|
|
Gfx::Color(0.0f, 0.0f, 0.0f, 0.0f),
|
2013-05-11 21:05:20 +00:00
|
|
|
|
true);
|
2012-06-26 20:23:05 +00:00
|
|
|
|
m_engine->SetBackForce(true);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if ( m_phase == PHASE_LOADING )
|
|
|
|
|
{
|
|
|
|
|
pos.x = 0.35f;
|
|
|
|
|
pos.y = 0.10f;
|
|
|
|
|
ddim.x = 0.30f;
|
|
|
|
|
ddim.y = 0.80f;
|
|
|
|
|
pw = m_interface->CreateWindows(pos, ddim, 10, EVENT_WINDOW5);
|
2012-09-15 19:47:19 +00:00
|
|
|
|
|
2012-06-26 20:23:05 +00:00
|
|
|
|
pw->SetName(" ");
|
|
|
|
|
|
|
|
|
|
pos.x = 0.35f;
|
|
|
|
|
pos.y = 0.60f;
|
|
|
|
|
ddim.x = 0.30f;
|
|
|
|
|
ddim.y = 0.30f;
|
|
|
|
|
pw->CreateGroup(pos, ddim, 5, EVENT_INTERFACE_GLINTl); // orange corner
|
|
|
|
|
pos.x = 0.35f;
|
|
|
|
|
pos.y = 0.10f;
|
|
|
|
|
ddim.x = 0.30f;
|
|
|
|
|
ddim.y = 0.30f;
|
|
|
|
|
pw->CreateGroup(pos, ddim, 4, EVENT_INTERFACE_GLINTr); // blue corner
|
|
|
|
|
|
|
|
|
|
pos.x = 254.0f/640.0f;
|
|
|
|
|
pos.y = 208.0f/480.0f;
|
|
|
|
|
ddim.x = 132.0f/640.0f;
|
|
|
|
|
ddim.y = 42.0f/480.0f;
|
|
|
|
|
pg = pw->CreateGroup(pos, ddim, 22, EVENT_NULL);
|
|
|
|
|
pg->SetState(STATE_SHADOW);
|
|
|
|
|
|
|
|
|
|
pos.x = 220.0f/640.0f;
|
|
|
|
|
pos.y = 210.0f/480.0f;
|
|
|
|
|
ddim.x = 200.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);
|
2012-09-15 19:47:19 +00:00
|
|
|
|
pl->SetTextAlign(Gfx::TEXT_ALIGN_CENTER);
|
|
|
|
|
|
2014-07-10 14:25:40 +00:00
|
|
|
|
m_engine->SetBackground("interface/interface.png",
|
2012-09-29 21:52:30 +00:00
|
|
|
|
Gfx::Color(0.0f, 0.0f, 0.0f, 0.0f),
|
|
|
|
|
Gfx::Color(0.0f, 0.0f, 0.0f, 0.0f),
|
|
|
|
|
Gfx::Color(0.0f, 0.0f, 0.0f, 0.0f),
|
|
|
|
|
Gfx::Color(0.0f, 0.0f, 0.0f, 0.0f),
|
2013-05-11 21:05:20 +00:00
|
|
|
|
true);
|
2012-06-26 20:23:05 +00:00
|
|
|
|
m_engine->SetBackForce(true);
|
|
|
|
|
|
|
|
|
|
m_loadingCounter = 1; // enough time to display!
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if ( m_phase == PHASE_WELCOME1 )
|
|
|
|
|
{
|
|
|
|
|
pos.x = 0.0f;
|
|
|
|
|
pos.y = 0.0f;
|
|
|
|
|
ddim.x = 0.0f;
|
|
|
|
|
ddim.y = 0.0f;
|
|
|
|
|
pw = m_interface->CreateWindows(pos, ddim, -1, EVENT_WINDOW5);
|
|
|
|
|
|
2012-09-15 19:47:19 +00:00
|
|
|
|
m_engine->SetOverColor(Gfx::Color(1.0f, 1.0f, 1.0f, 1.0f), Gfx::ENG_RSTATE_TCOLOR_BLACK); // TODO: color ok?
|
2012-06-26 20:23:05 +00:00
|
|
|
|
m_engine->SetOverFront(true);
|
|
|
|
|
|
2014-10-28 09:37:05 +00:00
|
|
|
|
m_engine->SetBackground("interface/intro1.png",
|
2012-09-29 21:52:30 +00:00
|
|
|
|
Gfx::Color(0.0f, 0.0f, 0.0f, 0.0f),
|
|
|
|
|
Gfx::Color(0.0f, 0.0f, 0.0f, 0.0f),
|
|
|
|
|
Gfx::Color(0.0f, 0.0f, 0.0f, 0.0f),
|
|
|
|
|
Gfx::Color(0.0f, 0.0f, 0.0f, 0.0f),
|
2015-07-11 10:57:02 +00:00
|
|
|
|
true, true);
|
2012-06-26 20:23:05 +00:00
|
|
|
|
m_engine->SetBackForce(true);
|
|
|
|
|
}
|
|
|
|
|
if ( m_phase == PHASE_WELCOME2 )
|
|
|
|
|
{
|
|
|
|
|
pos.x = 0.0f;
|
|
|
|
|
pos.y = 0.0f;
|
|
|
|
|
ddim.x = 0.0f;
|
|
|
|
|
ddim.y = 0.0f;
|
|
|
|
|
pw = m_interface->CreateWindows(pos, ddim, -1, EVENT_WINDOW5);
|
|
|
|
|
|
2013-04-25 19:05:27 +00:00
|
|
|
|
m_engine->SetOverColor(Gfx::Color(0.0f, 0.0f, 0.0f, 0.0f), Gfx::ENG_RSTATE_TCOLOR_WHITE); // TODO: color ok?
|
2012-06-26 20:23:05 +00:00
|
|
|
|
m_engine->SetOverFront(true);
|
|
|
|
|
|
2014-10-28 09:37:05 +00:00
|
|
|
|
m_engine->SetBackground("interface/intro2.png",
|
2012-09-29 21:52:30 +00:00
|
|
|
|
Gfx::Color(0.0f, 0.0f, 0.0f, 0.0f),
|
|
|
|
|
Gfx::Color(0.0f, 0.0f, 0.0f, 0.0f),
|
|
|
|
|
Gfx::Color(0.0f, 0.0f, 0.0f, 0.0f),
|
|
|
|
|
Gfx::Color(0.0f, 0.0f, 0.0f, 0.0f),
|
2015-07-11 10:57:02 +00:00
|
|
|
|
true, true);
|
2012-06-26 20:23:05 +00:00
|
|
|
|
m_engine->SetBackForce(true);
|
|
|
|
|
}
|
|
|
|
|
if ( m_phase == PHASE_WELCOME3 )
|
|
|
|
|
{
|
|
|
|
|
pos.x = 0.0f;
|
|
|
|
|
pos.y = 0.0f;
|
|
|
|
|
ddim.x = 0.0f;
|
|
|
|
|
ddim.y = 0.0f;
|
|
|
|
|
pw = m_interface->CreateWindows(pos, ddim, -1, EVENT_WINDOW5);
|
|
|
|
|
|
2012-09-15 19:47:19 +00:00
|
|
|
|
m_engine->SetOverColor(Gfx::Color(0.0f, 0.0f, 0.0f, 0.0f), Gfx::ENG_RSTATE_TCOLOR_WHITE); // TODO: color ok?
|
2012-06-26 20:23:05 +00:00
|
|
|
|
m_engine->SetOverFront(true);
|
|
|
|
|
|
2014-10-28 09:37:05 +00:00
|
|
|
|
m_engine->SetBackground("interface/intro3.png",
|
2012-09-29 21:52:30 +00:00
|
|
|
|
Gfx::Color(0.0f, 0.0f, 0.0f, 0.0f),
|
|
|
|
|
Gfx::Color(0.0f, 0.0f, 0.0f, 0.0f),
|
|
|
|
|
Gfx::Color(0.0f, 0.0f, 0.0f, 0.0f),
|
|
|
|
|
Gfx::Color(0.0f, 0.0f, 0.0f, 0.0f),
|
2015-07-11 10:57:02 +00:00
|
|
|
|
true, true);
|
2012-06-26 20:23:05 +00:00
|
|
|
|
m_engine->SetBackForce(true);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if ( m_phase == PHASE_GENERIC )
|
|
|
|
|
{
|
|
|
|
|
pos.x = 0.0f;
|
|
|
|
|
pos.y = 0.0f;
|
|
|
|
|
ddim.x = 0.0f;
|
|
|
|
|
ddim.y = 0.0f;
|
|
|
|
|
pw = m_interface->CreateWindows(pos, ddim, -1, EVENT_WINDOW5);
|
|
|
|
|
|
|
|
|
|
pos.x = 80.0f/640.0f;
|
2015-05-09 18:36:32 +00:00
|
|
|
|
pos.y = 190.0f/480.0f;
|
2012-06-26 20:23:05 +00:00
|
|
|
|
ddim.x = 490.0f/640.0f;
|
2015-05-09 18:36:32 +00:00
|
|
|
|
ddim.y = 160.0f/480.0f;
|
2012-06-26 20:23:05 +00:00
|
|
|
|
pe = pw->CreateEdit(pos, ddim, 0, EVENT_EDIT1);
|
|
|
|
|
pe->SetGenericMode(true);
|
|
|
|
|
pe->SetEditCap(false);
|
2013-03-20 20:50:44 +00:00
|
|
|
|
pe->SetHighlightCap(false);
|
2012-09-15 19:47:19 +00:00
|
|
|
|
pe->SetFontType(Gfx::FONT_COURIER);
|
2013-03-23 20:22:44 +00:00
|
|
|
|
pe->SetFontSize(Gfx::FONT_SIZE_SMALL);
|
2013-03-29 09:03:35 +00:00
|
|
|
|
pe->ReadText(std::string("help/") + m_app->GetLanguageChar() + std::string("/authors.txt"));
|
2012-06-26 20:23:05 +00:00
|
|
|
|
|
|
|
|
|
pos.x = 40.0f/640.0f;
|
2013-03-24 15:02:06 +00:00
|
|
|
|
pos.y = 83.0f/480.0f;
|
2012-06-26 20:23:05 +00:00
|
|
|
|
ddim.x = 246.0f/640.0f;
|
|
|
|
|
ddim.y = 16.0f/480.0f;
|
|
|
|
|
GetResource(RES_TEXT, RT_GENERIC_DEV1, name);
|
|
|
|
|
pl = pw->CreateLabel(pos, ddim, 0, EVENT_LABEL1, name);
|
2012-09-15 19:47:19 +00:00
|
|
|
|
pl->SetFontType(Gfx::FONT_COURIER);
|
2013-03-23 20:22:44 +00:00
|
|
|
|
pl->SetFontSize(Gfx::FONT_SIZE_SMALL);
|
2012-06-26 20:23:05 +00:00
|
|
|
|
|
2013-03-24 15:02:06 +00:00
|
|
|
|
pos.y = 13.0f/480.0f;
|
2012-06-26 20:23:05 +00:00
|
|
|
|
GetResource(RES_TEXT, RT_GENERIC_DEV2, name);
|
|
|
|
|
pl = pw->CreateLabel(pos, ddim, 0, EVENT_LABEL2, name);
|
2012-09-15 19:47:19 +00:00
|
|
|
|
pl->SetFontType(Gfx::FONT_COURIER);
|
2013-03-23 20:22:44 +00:00
|
|
|
|
pl->SetFontSize(Gfx::FONT_SIZE_SMALL);
|
2012-06-26 20:23:05 +00:00
|
|
|
|
|
|
|
|
|
pos.x = 355.0f/640.0f;
|
2013-03-24 15:02:06 +00:00
|
|
|
|
pos.y = 83.0f/480.0f;
|
2012-06-26 20:23:05 +00:00
|
|
|
|
ddim.x = 246.0f/640.0f;
|
|
|
|
|
ddim.y = 16.0f/480.0f;
|
|
|
|
|
GetResource(RES_TEXT, RT_GENERIC_EDIT1, name);
|
|
|
|
|
pl = pw->CreateLabel(pos, ddim, 0, EVENT_LABEL3, name);
|
2012-09-15 19:47:19 +00:00
|
|
|
|
pl->SetFontType(Gfx::FONT_COURIER);
|
2013-03-23 20:22:44 +00:00
|
|
|
|
pl->SetFontSize(Gfx::FONT_SIZE_SMALL);
|
2012-06-26 20:23:05 +00:00
|
|
|
|
|
2013-03-24 15:02:06 +00:00
|
|
|
|
pos.y = 13.0f/480.0f;
|
2012-06-26 20:23:05 +00:00
|
|
|
|
GetResource(RES_TEXT, RT_GENERIC_EDIT2, name);
|
|
|
|
|
pl = pw->CreateLabel(pos, ddim, 0, EVENT_LABEL4, name);
|
2012-09-15 19:47:19 +00:00
|
|
|
|
pl->SetFontType(Gfx::FONT_COURIER);
|
2013-03-23 20:22:44 +00:00
|
|
|
|
pl->SetFontSize(Gfx::FONT_SIZE_SMALL);
|
2015-06-21 18:59:23 +00:00
|
|
|
|
|
2012-06-26 20:23:05 +00:00
|
|
|
|
pos.x = 306.0f/640.0f;
|
|
|
|
|
pos.y = 17.0f/480.0f;
|
|
|
|
|
ddim.x = 30.0f/640.0f;
|
|
|
|
|
ddim.y = 30.0f/480.0f;
|
|
|
|
|
pb = pw->CreateButton(pos, ddim, 49, EVENT_INTERFACE_ABORT);
|
|
|
|
|
pb->SetState(STATE_SHADOW);
|
2012-09-15 19:47:19 +00:00
|
|
|
|
|
2014-07-10 14:25:40 +00:00
|
|
|
|
m_engine->SetBackground("interface/generico.png",
|
2012-09-29 21:52:30 +00:00
|
|
|
|
Gfx::Color(0.0f, 0.0f, 0.0f, 0.0f),
|
|
|
|
|
Gfx::Color(0.0f, 0.0f, 0.0f, 0.0f),
|
|
|
|
|
Gfx::Color(0.0f, 0.0f, 0.0f, 0.0f),
|
|
|
|
|
Gfx::Color(0.0f, 0.0f, 0.0f, 0.0f),
|
2013-05-11 21:05:20 +00:00
|
|
|
|
true);
|
2012-06-26 20:23:05 +00:00
|
|
|
|
m_engine->SetBackForce(true);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if ( m_phase == PHASE_INIT ||
|
2012-09-29 21:52:30 +00:00
|
|
|
|
m_phase == PHASE_NAME ||
|
|
|
|
|
m_phase == PHASE_TRAINER ||
|
|
|
|
|
m_phase == PHASE_DEFI ||
|
|
|
|
|
m_phase == PHASE_MISSION ||
|
|
|
|
|
m_phase == PHASE_FREE ||
|
|
|
|
|
m_phase == PHASE_USER ||
|
|
|
|
|
m_phase == PHASE_SETUPd ||
|
|
|
|
|
m_phase == PHASE_SETUPg ||
|
|
|
|
|
m_phase == PHASE_SETUPp ||
|
|
|
|
|
m_phase == PHASE_SETUPc ||
|
|
|
|
|
m_phase == PHASE_SETUPs ||
|
|
|
|
|
m_phase == PHASE_READ ||
|
|
|
|
|
m_phase == PHASE_LOADING )
|
2012-06-26 20:23:05 +00:00
|
|
|
|
{
|
|
|
|
|
pos.x = 540.0f/640.0f;
|
|
|
|
|
pos.y = 9.0f/480.0f;
|
|
|
|
|
ddim.x = 90.0f/640.0f;
|
|
|
|
|
ddim.y = 10.0f/480.0f;
|
2013-12-27 10:15:36 +00:00
|
|
|
|
pl = pw->CreateLabel(pos, ddim, 0, EVENT_LABEL1, COLOBOT_VERSION_DISPLAY);
|
2012-09-15 19:47:19 +00:00
|
|
|
|
pl->SetFontType(Gfx::FONT_COURIER);
|
2012-06-26 20:23:05 +00:00
|
|
|
|
pl->SetFontSize(9.0f);
|
|
|
|
|
}
|
|
|
|
|
|
2012-09-15 19:47:19 +00:00
|
|
|
|
m_engine->LoadAllTextures();
|
2012-06-26 20:23:05 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Processing an event.
|
2012-09-20 18:37:37 +00:00
|
|
|
|
// Returns false if the event has been processed completely.
|
2012-06-26 20:23:05 +00:00
|
|
|
|
|
|
|
|
|
bool CMainDialog::EventProcess(const Event &event)
|
|
|
|
|
{
|
|
|
|
|
CWindow* pw;
|
|
|
|
|
CList* pl;
|
|
|
|
|
CButton* pb;
|
|
|
|
|
CCheck* pc;
|
|
|
|
|
Event newEvent;
|
|
|
|
|
float welcomeLength;
|
|
|
|
|
|
2012-09-15 19:47:19 +00:00
|
|
|
|
if ( event.type == EVENT_FRAME )
|
2012-06-26 20:23:05 +00:00
|
|
|
|
{
|
|
|
|
|
m_phaseTime += event.rTime;
|
|
|
|
|
|
2012-09-29 21:52:30 +00:00
|
|
|
|
//? if ( m_phase == PHASE_WELCOME1 ) welcomeLength = WELCOME_LENGTH+2.0f;
|
|
|
|
|
//? else welcomeLength = WELCOME_LENGTH;
|
2012-06-26 20:23:05 +00:00
|
|
|
|
welcomeLength = WELCOME_LENGTH;
|
|
|
|
|
|
2013-05-02 08:44:07 +00:00
|
|
|
|
if ( m_phase != PHASE_SIMUL &&
|
|
|
|
|
m_phase != PHASE_WIN &&
|
|
|
|
|
m_phase != PHASE_LOST &&
|
|
|
|
|
m_phase != PHASE_WRITE &&
|
|
|
|
|
m_phase != PHASE_READs &&
|
|
|
|
|
m_phase != PHASE_WRITEs &&
|
|
|
|
|
m_phase != PHASE_SETUPds &&
|
|
|
|
|
m_phase != PHASE_SETUPgs &&
|
|
|
|
|
m_phase != PHASE_SETUPps &&
|
|
|
|
|
m_phase != PHASE_SETUPcs &&
|
|
|
|
|
m_phase != PHASE_SETUPss )
|
|
|
|
|
{
|
2014-11-02 12:33:37 +00:00
|
|
|
|
if (!m_sound->IsPlayingMusic() && m_sound->IsCachedMusic("Intro2.ogg"))
|
2013-05-26 15:47:54 +00:00
|
|
|
|
{
|
2013-05-02 08:44:07 +00:00
|
|
|
|
m_sound->PlayMusic("Intro2.ogg", true);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2012-06-26 20:23:05 +00:00
|
|
|
|
if ( m_phase == PHASE_WELCOME1 ||
|
2013-05-26 15:47:54 +00:00
|
|
|
|
m_phase == PHASE_WELCOME2 ||
|
|
|
|
|
m_phase == PHASE_WELCOME3 )
|
2012-06-26 20:23:05 +00:00
|
|
|
|
{
|
|
|
|
|
float intensity;
|
2013-04-25 19:05:27 +00:00
|
|
|
|
int mode = Gfx::ENG_RSTATE_TCOLOR_WHITE;
|
2012-06-26 20:23:05 +00:00
|
|
|
|
|
2013-04-25 19:05:27 +00:00
|
|
|
|
// 1/4 of display time is animating
|
|
|
|
|
float animatingTime = welcomeLength / 4.0f;
|
|
|
|
|
|
|
|
|
|
if ( m_phaseTime < animatingTime )
|
2012-06-26 20:23:05 +00:00
|
|
|
|
{
|
2013-04-25 19:05:27 +00:00
|
|
|
|
//appearing
|
|
|
|
|
intensity = m_phaseTime / animatingTime;
|
2012-06-26 20:23:05 +00:00
|
|
|
|
}
|
2013-04-25 19:05:27 +00:00
|
|
|
|
else if ( m_phaseTime < welcomeLength - animatingTime )
|
2012-06-26 20:23:05 +00:00
|
|
|
|
{
|
2013-04-25 19:05:27 +00:00
|
|
|
|
//showing
|
|
|
|
|
intensity = 1.0f;
|
2012-06-26 20:23:05 +00:00
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
2013-04-25 19:05:27 +00:00
|
|
|
|
//hiding
|
|
|
|
|
intensity = (welcomeLength - m_phaseTime) / animatingTime;
|
2012-06-26 20:23:05 +00:00
|
|
|
|
}
|
2013-04-25 19:05:27 +00:00
|
|
|
|
|
2012-06-26 20:23:05 +00:00
|
|
|
|
if ( intensity < 0.0f ) intensity = 0.0f;
|
|
|
|
|
if ( intensity > 1.0f ) intensity = 1.0f;
|
|
|
|
|
|
2013-04-25 19:05:27 +00:00
|
|
|
|
//white first, others -> black fadding
|
|
|
|
|
if ( (m_phase == PHASE_WELCOME1) && ( m_phaseTime < welcomeLength/2.0f))
|
2012-06-26 20:23:05 +00:00
|
|
|
|
{
|
2013-04-25 19:05:27 +00:00
|
|
|
|
intensity = 1.0f - intensity;
|
|
|
|
|
mode = Gfx::ENG_RSTATE_TCOLOR_BLACK;
|
2012-06-26 20:23:05 +00:00
|
|
|
|
}
|
|
|
|
|
|
2012-09-15 19:47:19 +00:00
|
|
|
|
m_engine->SetOverColor(Gfx::Color(intensity, intensity, intensity, intensity), mode); // TODO: color ok?
|
2012-06-26 20:23:05 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if ( m_phase == PHASE_WELCOME1 && m_phaseTime >= welcomeLength )
|
|
|
|
|
{
|
2015-04-06 15:23:18 +00:00
|
|
|
|
m_main->ChangePhase(PHASE_WELCOME2);
|
2012-06-26 20:23:05 +00:00
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
if ( m_phase == PHASE_WELCOME2 && m_phaseTime >= welcomeLength )
|
|
|
|
|
{
|
2015-04-06 15:23:18 +00:00
|
|
|
|
m_main->ChangePhase(PHASE_WELCOME3);
|
2012-06-26 20:23:05 +00:00
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
if ( m_phase == PHASE_WELCOME3 && m_phaseTime >= welcomeLength )
|
|
|
|
|
{
|
2015-04-06 15:23:18 +00:00
|
|
|
|
m_main->ChangePhase(PHASE_NAME);
|
2012-06-26 20:23:05 +00:00
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if ( m_shotDelay > 0 && !m_bDialog ) // screenshot done?
|
|
|
|
|
{
|
|
|
|
|
m_shotDelay --;
|
|
|
|
|
if ( m_shotDelay == 0 )
|
2015-06-21 18:59:23 +00:00
|
|
|
|
{
|
2014-06-24 17:27:31 +00:00
|
|
|
|
Math::IntPoint windowSize = m_engine->GetWindowSize();
|
2014-06-23 22:35:05 +00:00
|
|
|
|
|
2014-06-24 17:27:31 +00:00
|
|
|
|
m_engine->WriteScreenShot(m_shotName, windowSize.x, windowSize.y);
|
2012-06-26 20:23:05 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if ( m_phase == PHASE_LOADING )
|
|
|
|
|
{
|
|
|
|
|
if ( m_loadingCounter == 0 )
|
|
|
|
|
{
|
|
|
|
|
m_main->ChangePhase(PHASE_SIMUL);
|
|
|
|
|
}
|
|
|
|
|
m_loadingCounter --;
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
m_glintTime += event.rTime;
|
|
|
|
|
GlintMove(); // moves reflections
|
|
|
|
|
|
2012-09-15 19:47:19 +00:00
|
|
|
|
FrameParticle(event.rTime);
|
2012-06-26 20:23:05 +00:00
|
|
|
|
|
|
|
|
|
if ( m_bDialog ) // this dialogue?
|
|
|
|
|
{
|
|
|
|
|
FrameDialog(event.rTime);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
|
2012-09-15 19:47:19 +00:00
|
|
|
|
if ( event.type == EVENT_MOUSE_MOVE )
|
2012-06-26 20:23:05 +00:00
|
|
|
|
{
|
2012-09-21 22:38:17 +00:00
|
|
|
|
m_glintMouse = event.mousePos;
|
|
|
|
|
NiceParticle(event.mousePos, event.mouseButtonsState & MOUSE_BUTTON_LEFT);
|
2012-06-26 20:23:05 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if ( m_bDialog ) // this dialogue?
|
|
|
|
|
{
|
|
|
|
|
m_interface->EventProcess(event);
|
|
|
|
|
|
2012-09-15 19:47:19 +00:00
|
|
|
|
if ( event.type == EVENT_DIALOG_OK ||
|
2012-09-29 21:52:30 +00:00
|
|
|
|
(event.type == EVENT_KEY_DOWN && event.key.key == KEY(RETURN) ) )
|
2012-06-26 20:23:05 +00:00
|
|
|
|
{
|
|
|
|
|
StopDialog();
|
|
|
|
|
if ( m_phase == PHASE_NAME )
|
|
|
|
|
{
|
|
|
|
|
NameDelete();
|
|
|
|
|
}
|
|
|
|
|
if ( m_phase == PHASE_INIT )
|
|
|
|
|
{
|
2012-09-29 21:52:30 +00:00
|
|
|
|
//? m_eventQueue->MakeEvent(newEvent, EVENT_QUIT);
|
|
|
|
|
//? m_eventQueue->AddEvent(newEvent);
|
2012-06-26 20:23:05 +00:00
|
|
|
|
m_main->ChangePhase(PHASE_GENERIC);
|
|
|
|
|
}
|
|
|
|
|
if ( m_phase == PHASE_SIMUL )
|
|
|
|
|
{
|
|
|
|
|
if ( m_bDialogDelete )
|
|
|
|
|
{
|
|
|
|
|
m_main->DeleteObject();
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
m_main->ChangePhase(PHASE_TERM);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
2012-09-15 19:47:19 +00:00
|
|
|
|
if ( event.type == EVENT_DIALOG_CANCEL ||
|
2012-09-29 21:52:30 +00:00
|
|
|
|
(event.type == EVENT_KEY_DOWN && event.key.key == KEY(ESCAPE) ) )
|
2012-06-26 20:23:05 +00:00
|
|
|
|
{
|
|
|
|
|
StopDialog();
|
|
|
|
|
}
|
2012-09-15 19:47:19 +00:00
|
|
|
|
if ( event.type == EVENT_INTERFACE_SETUP )
|
2012-06-26 20:23:05 +00:00
|
|
|
|
{
|
|
|
|
|
StopDialog();
|
|
|
|
|
StartSuspend();
|
2014-10-25 17:11:24 +00:00
|
|
|
|
#if PLATFORM_WINDOWS
|
|
|
|
|
if ( m_phaseSetup == PHASE_SETUPd ) m_phaseSetup = PHASE_SETUPg;
|
|
|
|
|
#endif
|
2012-06-26 20:23:05 +00:00
|
|
|
|
if ( m_phaseSetup == PHASE_SETUPd ) ChangePhase(PHASE_SETUPds);
|
|
|
|
|
if ( m_phaseSetup == PHASE_SETUPg ) ChangePhase(PHASE_SETUPgs);
|
|
|
|
|
if ( m_phaseSetup == PHASE_SETUPp ) ChangePhase(PHASE_SETUPps);
|
|
|
|
|
if ( m_phaseSetup == PHASE_SETUPc ) ChangePhase(PHASE_SETUPcs);
|
|
|
|
|
if ( m_phaseSetup == PHASE_SETUPs ) ChangePhase(PHASE_SETUPss);
|
|
|
|
|
}
|
2012-09-15 19:47:19 +00:00
|
|
|
|
if ( event.type == EVENT_INTERFACE_AGAIN )
|
2012-06-26 20:23:05 +00:00
|
|
|
|
{
|
|
|
|
|
StopDialog();
|
|
|
|
|
m_main->ChangePhase(PHASE_LOADING);
|
|
|
|
|
}
|
2012-09-15 19:47:19 +00:00
|
|
|
|
if ( event.type == EVENT_INTERFACE_WRITE )
|
2012-06-26 20:23:05 +00:00
|
|
|
|
{
|
|
|
|
|
StopDialog();
|
|
|
|
|
StartSuspend();
|
|
|
|
|
ChangePhase(PHASE_WRITEs);
|
|
|
|
|
}
|
2012-09-15 19:47:19 +00:00
|
|
|
|
if ( event.type == EVENT_INTERFACE_READ )
|
2012-06-26 20:23:05 +00:00
|
|
|
|
{
|
|
|
|
|
StopDialog();
|
|
|
|
|
StartSuspend();
|
|
|
|
|
ChangePhase(PHASE_READs);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
2012-09-20 18:37:37 +00:00
|
|
|
|
if ( /* m_engine->GetMouseVisible() && TODO: WTF ?! */
|
2012-09-29 21:52:30 +00:00
|
|
|
|
!m_interface->EventProcess(event) )
|
2012-06-26 20:23:05 +00:00
|
|
|
|
{
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if ( m_phase == PHASE_INIT )
|
|
|
|
|
{
|
2012-09-15 19:47:19 +00:00
|
|
|
|
switch( event.type )
|
2012-06-26 20:23:05 +00:00
|
|
|
|
{
|
2012-09-15 19:47:19 +00:00
|
|
|
|
case EVENT_KEY_DOWN:
|
2012-09-21 22:38:17 +00:00
|
|
|
|
if ( event.key.key == KEY(ESCAPE) )
|
2012-06-26 20:23:05 +00:00
|
|
|
|
{
|
2012-09-29 21:52:30 +00:00
|
|
|
|
//? StartQuit(); // would you leave?
|
2012-06-26 20:23:05 +00:00
|
|
|
|
m_sound->Play(SOUND_TZOING);
|
|
|
|
|
m_main->ChangePhase(PHASE_GENERIC);
|
2015-04-06 15:23:18 +00:00
|
|
|
|
return false;
|
2012-06-26 20:23:05 +00:00
|
|
|
|
}
|
2015-04-06 15:23:18 +00:00
|
|
|
|
return true;
|
2012-06-26 20:23:05 +00:00
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case EVENT_INTERFACE_QUIT:
|
2012-09-29 21:52:30 +00:00
|
|
|
|
//? StartQuit(); // would you leave?
|
2012-06-26 20:23:05 +00:00
|
|
|
|
m_sound->Play(SOUND_TZOING);
|
|
|
|
|
m_main->ChangePhase(PHASE_GENERIC);
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case EVENT_INTERFACE_TRAINER:
|
|
|
|
|
m_main->ChangePhase(PHASE_TRAINER);
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case EVENT_INTERFACE_DEFI:
|
|
|
|
|
m_main->ChangePhase(PHASE_DEFI);
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case EVENT_INTERFACE_MISSION:
|
|
|
|
|
m_main->ChangePhase(PHASE_MISSION);
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case EVENT_INTERFACE_FREE:
|
|
|
|
|
m_main->ChangePhase(PHASE_FREE);
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case EVENT_INTERFACE_USER:
|
|
|
|
|
m_main->ChangePhase(PHASE_USER);
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case EVENT_INTERFACE_SETUP:
|
|
|
|
|
m_main->ChangePhase(m_phaseSetup);
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case EVENT_INTERFACE_NAME:
|
|
|
|
|
m_main->ChangePhase(PHASE_NAME);
|
|
|
|
|
break;
|
2012-09-15 19:47:19 +00:00
|
|
|
|
|
|
|
|
|
default:
|
2015-04-06 15:23:18 +00:00
|
|
|
|
return true;
|
2012-06-26 20:23:05 +00:00
|
|
|
|
}
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if ( m_phase == PHASE_NAME )
|
|
|
|
|
{
|
2012-09-15 19:47:19 +00:00
|
|
|
|
switch( event.type )
|
2012-06-26 20:23:05 +00:00
|
|
|
|
{
|
2012-09-15 19:47:19 +00:00
|
|
|
|
case EVENT_KEY_DOWN:
|
2012-09-21 22:38:17 +00:00
|
|
|
|
if ( event.key.key == KEY(RETURN) )
|
2012-06-26 20:23:05 +00:00
|
|
|
|
{
|
|
|
|
|
NameSelect();
|
|
|
|
|
}
|
2012-09-21 22:38:17 +00:00
|
|
|
|
if ( event.key.key == KEY(ESCAPE) )
|
2012-06-26 20:23:05 +00:00
|
|
|
|
{
|
2012-09-18 20:33:28 +00:00
|
|
|
|
pw = static_cast<CWindow*>(m_interface->SearchControl(EVENT_WINDOW5));
|
2012-06-26 20:23:05 +00:00
|
|
|
|
if ( pw == 0 ) break;
|
2012-09-18 20:33:28 +00:00
|
|
|
|
pb = static_cast<CButton*>(pw->SearchControl(EVENT_INTERFACE_NCANCEL));
|
2012-06-26 20:23:05 +00:00
|
|
|
|
if ( pb == 0 ) break;
|
|
|
|
|
if ( pb->TestState(STATE_ENABLE) )
|
|
|
|
|
{
|
|
|
|
|
m_main->ChangePhase(PHASE_INIT);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case EVENT_INTERFACE_NEDIT:
|
|
|
|
|
UpdateNameList();
|
|
|
|
|
UpdateNameControl();
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case EVENT_INTERFACE_NLIST:
|
|
|
|
|
UpdateNameEdit();
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case EVENT_INTERFACE_NOK:
|
|
|
|
|
NameSelect();
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case EVENT_INTERFACE_PERSO:
|
|
|
|
|
NameSelect();
|
|
|
|
|
m_main->ChangePhase(PHASE_PERSO);
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case EVENT_INTERFACE_NCANCEL:
|
|
|
|
|
m_main->ChangePhase(PHASE_INIT);
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case EVENT_INTERFACE_NDELETE:
|
2012-09-18 20:33:28 +00:00
|
|
|
|
pw = static_cast<CWindow*>(m_interface->SearchControl(EVENT_WINDOW5));
|
2012-06-26 20:23:05 +00:00
|
|
|
|
if ( pw == 0 ) break;
|
2012-09-18 20:33:28 +00:00
|
|
|
|
pl = static_cast<CList*>(pw->SearchControl(EVENT_INTERFACE_NLIST));
|
2012-06-26 20:23:05 +00:00
|
|
|
|
if ( pl == 0 ) break;
|
2013-05-26 15:45:15 +00:00
|
|
|
|
StartDeleteGame(pl->GetItemName(pl->GetSelect()));
|
2012-09-15 19:47:19 +00:00
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
default:
|
2015-04-17 19:47:03 +00:00
|
|
|
|
return true;
|
2012-06-26 20:23:05 +00:00
|
|
|
|
}
|
2015-04-17 19:47:03 +00:00
|
|
|
|
return false;
|
2012-06-26 20:23:05 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if ( m_phase == PHASE_PERSO )
|
|
|
|
|
{
|
2015-07-18 21:14:20 +00:00
|
|
|
|
PlayerApperance& apperance = m_main->GetPlayerProgress()->GetApperance();
|
2012-09-15 19:47:19 +00:00
|
|
|
|
switch( event.type )
|
2012-06-26 20:23:05 +00:00
|
|
|
|
{
|
2012-09-15 19:47:19 +00:00
|
|
|
|
case EVENT_KEY_DOWN:
|
2012-09-21 22:38:17 +00:00
|
|
|
|
if ( event.key.key == KEY(RETURN) )
|
2012-06-26 20:23:05 +00:00
|
|
|
|
{
|
|
|
|
|
m_main->ChangePhase(PHASE_INIT);
|
|
|
|
|
}
|
2012-09-21 22:38:17 +00:00
|
|
|
|
if ( event.key.key == KEY(ESCAPE) )
|
2012-06-26 20:23:05 +00:00
|
|
|
|
{
|
|
|
|
|
m_main->ChangePhase(PHASE_NAME);
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case EVENT_INTERFACE_PHEAD:
|
2015-07-18 21:14:20 +00:00
|
|
|
|
m_apperanceTab = 0;
|
2012-06-26 20:23:05 +00:00
|
|
|
|
UpdatePerso();
|
|
|
|
|
m_main->ScenePerso();
|
|
|
|
|
CameraPerso();
|
|
|
|
|
break;
|
|
|
|
|
case EVENT_INTERFACE_PBODY:
|
2015-07-18 21:14:20 +00:00
|
|
|
|
m_apperanceTab = 1;
|
2012-06-26 20:23:05 +00:00
|
|
|
|
UpdatePerso();
|
|
|
|
|
m_main->ScenePerso();
|
|
|
|
|
CameraPerso();
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case EVENT_INTERFACE_PFACE1:
|
|
|
|
|
case EVENT_INTERFACE_PFACE2:
|
|
|
|
|
case EVENT_INTERFACE_PFACE3:
|
|
|
|
|
case EVENT_INTERFACE_PFACE4:
|
2015-07-18 21:14:20 +00:00
|
|
|
|
apperance.face = event.type-EVENT_INTERFACE_PFACE1;
|
2012-06-26 20:23:05 +00:00
|
|
|
|
UpdatePerso();
|
|
|
|
|
m_main->ScenePerso();
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case EVENT_INTERFACE_PGLASS0:
|
|
|
|
|
case EVENT_INTERFACE_PGLASS1:
|
|
|
|
|
case EVENT_INTERFACE_PGLASS2:
|
|
|
|
|
case EVENT_INTERFACE_PGLASS3:
|
|
|
|
|
case EVENT_INTERFACE_PGLASS4:
|
|
|
|
|
case EVENT_INTERFACE_PGLASS5:
|
|
|
|
|
case EVENT_INTERFACE_PGLASS6:
|
|
|
|
|
case EVENT_INTERFACE_PGLASS7:
|
|
|
|
|
case EVENT_INTERFACE_PGLASS8:
|
|
|
|
|
case EVENT_INTERFACE_PGLASS9:
|
2015-07-18 21:14:20 +00:00
|
|
|
|
apperance.glasses = event.type-EVENT_INTERFACE_PGLASS0;
|
2012-06-26 20:23:05 +00:00
|
|
|
|
UpdatePerso();
|
|
|
|
|
m_main->ScenePerso();
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case EVENT_INTERFACE_PC0a:
|
|
|
|
|
case EVENT_INTERFACE_PC1a:
|
|
|
|
|
case EVENT_INTERFACE_PC2a:
|
|
|
|
|
case EVENT_INTERFACE_PC3a:
|
|
|
|
|
case EVENT_INTERFACE_PC4a:
|
|
|
|
|
case EVENT_INTERFACE_PC5a:
|
|
|
|
|
case EVENT_INTERFACE_PC6a:
|
|
|
|
|
case EVENT_INTERFACE_PC7a:
|
|
|
|
|
case EVENT_INTERFACE_PC8a:
|
|
|
|
|
case EVENT_INTERFACE_PC9a:
|
2012-09-15 19:47:19 +00:00
|
|
|
|
FixPerso(event.type-EVENT_INTERFACE_PC0a, 0);
|
2012-06-26 20:23:05 +00:00
|
|
|
|
UpdatePerso();
|
|
|
|
|
m_main->ScenePerso();
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case EVENT_INTERFACE_PC0b:
|
|
|
|
|
case EVENT_INTERFACE_PC1b:
|
|
|
|
|
case EVENT_INTERFACE_PC2b:
|
|
|
|
|
case EVENT_INTERFACE_PC3b:
|
|
|
|
|
case EVENT_INTERFACE_PC4b:
|
|
|
|
|
case EVENT_INTERFACE_PC5b:
|
|
|
|
|
case EVENT_INTERFACE_PC6b:
|
|
|
|
|
case EVENT_INTERFACE_PC7b:
|
|
|
|
|
case EVENT_INTERFACE_PC8b:
|
|
|
|
|
case EVENT_INTERFACE_PC9b:
|
2012-09-15 19:47:19 +00:00
|
|
|
|
FixPerso(event.type-EVENT_INTERFACE_PC0b, 1);
|
2012-06-26 20:23:05 +00:00
|
|
|
|
UpdatePerso();
|
|
|
|
|
m_main->ScenePerso();
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case EVENT_INTERFACE_PCRa:
|
|
|
|
|
case EVENT_INTERFACE_PCGa:
|
|
|
|
|
case EVENT_INTERFACE_PCBa:
|
|
|
|
|
case EVENT_INTERFACE_PCRb:
|
|
|
|
|
case EVENT_INTERFACE_PCGb:
|
|
|
|
|
case EVENT_INTERFACE_PCBb:
|
|
|
|
|
ColorPerso();
|
|
|
|
|
UpdatePerso();
|
|
|
|
|
m_main->ScenePerso();
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case EVENT_INTERFACE_PDEF:
|
2015-07-18 21:14:20 +00:00
|
|
|
|
apperance.DefPerso();
|
2012-06-26 20:23:05 +00:00
|
|
|
|
UpdatePerso();
|
|
|
|
|
m_main->ScenePerso();
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case EVENT_INTERFACE_PLROT:
|
2015-07-18 21:14:20 +00:00
|
|
|
|
m_apperanceAngle += 0.2f;
|
2012-06-26 20:23:05 +00:00
|
|
|
|
break;
|
|
|
|
|
case EVENT_INTERFACE_PRROT:
|
2015-07-18 21:14:20 +00:00
|
|
|
|
m_apperanceAngle -= 0.2f;
|
2012-06-26 20:23:05 +00:00
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case EVENT_INTERFACE_POK:
|
2015-07-18 21:14:20 +00:00
|
|
|
|
m_main->GetPlayerProgress()->SaveApperance();
|
2012-06-26 20:23:05 +00:00
|
|
|
|
m_main->ChangePhase(PHASE_INIT);
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case EVENT_INTERFACE_PCANCEL:
|
2015-07-18 21:14:20 +00:00
|
|
|
|
m_main->GetPlayerProgress()->LoadApperance(); // reload apperance from file
|
2012-06-26 20:23:05 +00:00
|
|
|
|
m_main->ChangePhase(PHASE_NAME);
|
|
|
|
|
break;
|
2012-09-15 19:47:19 +00:00
|
|
|
|
|
|
|
|
|
default:
|
2015-04-17 19:47:03 +00:00
|
|
|
|
return true;
|
2012-06-26 20:23:05 +00:00
|
|
|
|
}
|
2015-04-17 19:47:03 +00:00
|
|
|
|
return false;
|
2012-06-26 20:23:05 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if ( m_phase == PHASE_TRAINER ||
|
2012-09-29 21:52:30 +00:00
|
|
|
|
m_phase == PHASE_DEFI ||
|
|
|
|
|
m_phase == PHASE_MISSION ||
|
|
|
|
|
m_phase == PHASE_FREE ||
|
2013-12-27 19:36:11 +00:00
|
|
|
|
m_phase == PHASE_USER )
|
2012-06-26 20:23:05 +00:00
|
|
|
|
{
|
2012-09-18 20:33:28 +00:00
|
|
|
|
pw = static_cast<CWindow*>(m_interface->SearchControl(EVENT_WINDOW5));
|
2012-06-26 20:23:05 +00:00
|
|
|
|
if ( pw == 0 ) return false;
|
|
|
|
|
|
2012-09-15 19:47:19 +00:00
|
|
|
|
if ( event.type == pw->GetEventTypeClose() ||
|
2012-09-29 21:52:30 +00:00
|
|
|
|
event.type == EVENT_INTERFACE_BACK ||
|
|
|
|
|
(event.type == EVENT_KEY_DOWN && event.key.key == KEY(ESCAPE)) )
|
2012-06-26 20:23:05 +00:00
|
|
|
|
{
|
|
|
|
|
m_main->ChangePhase(PHASE_INIT);
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if ( m_phase == PHASE_TRAINER ||
|
2012-09-29 21:52:30 +00:00
|
|
|
|
m_phase == PHASE_DEFI ||
|
|
|
|
|
m_phase == PHASE_MISSION ||
|
|
|
|
|
m_phase == PHASE_FREE ||
|
2013-12-27 19:36:11 +00:00
|
|
|
|
m_phase == PHASE_USER )
|
2012-06-26 20:23:05 +00:00
|
|
|
|
{
|
2012-09-15 19:47:19 +00:00
|
|
|
|
switch( event.type )
|
2012-06-26 20:23:05 +00:00
|
|
|
|
{
|
|
|
|
|
case EVENT_INTERFACE_CHAP:
|
2012-09-18 20:33:28 +00:00
|
|
|
|
pl = static_cast<CList*>(pw->SearchControl(EVENT_INTERFACE_CHAP));
|
2012-06-26 20:23:05 +00:00
|
|
|
|
if ( pl == 0 ) break;
|
2015-07-18 16:52:37 +00:00
|
|
|
|
m_chap[m_category] = pl->GetSelect();
|
2015-07-18 21:14:20 +00:00
|
|
|
|
m_main->GetPlayerProgress()->SetSelectedChap(m_category, m_chap[m_category]+1);
|
2015-07-18 16:52:37 +00:00
|
|
|
|
UpdateSceneList(m_chap[m_category], m_sel[m_category]);
|
2015-07-18 17:43:22 +00:00
|
|
|
|
UpdateSceneResume(m_chap[m_category]+1, m_sel[m_category]+1);
|
2012-06-26 20:23:05 +00:00
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case EVENT_INTERFACE_LIST:
|
2012-09-18 20:33:28 +00:00
|
|
|
|
pl = static_cast<CList*>(pw->SearchControl(EVENT_INTERFACE_LIST));
|
2012-06-26 20:23:05 +00:00
|
|
|
|
if ( pl == 0 ) break;
|
2015-07-18 16:52:37 +00:00
|
|
|
|
m_sel[m_category] = pl->GetSelect();
|
2015-07-18 21:14:20 +00:00
|
|
|
|
m_main->GetPlayerProgress()->SetSelectedRank(m_category, m_sel[m_category]+1);
|
2015-07-18 17:43:22 +00:00
|
|
|
|
UpdateSceneResume(m_chap[m_category]+1, m_sel[m_category]+1);
|
2012-06-26 20:23:05 +00:00
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case EVENT_INTERFACE_SOLUCE:
|
2012-09-18 20:33:28 +00:00
|
|
|
|
pb = static_cast<CButton*>(pw->SearchControl(EVENT_INTERFACE_SOLUCE));
|
2012-06-26 20:23:05 +00:00
|
|
|
|
if ( pb == 0 ) break;
|
|
|
|
|
m_bSceneSoluce = !m_bSceneSoluce;
|
|
|
|
|
pb->SetState(STATE_CHECK, m_bSceneSoluce);
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case EVENT_INTERFACE_PLAY:
|
2015-07-18 17:43:22 +00:00
|
|
|
|
m_levelChap = m_chap[m_category]+1;
|
|
|
|
|
m_levelRank = m_sel[m_category]+1;
|
2012-06-26 20:23:05 +00:00
|
|
|
|
m_phaseTerm = m_phase;
|
|
|
|
|
m_main->ChangePhase(PHASE_LOADING);
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case EVENT_INTERFACE_READ:
|
|
|
|
|
m_phaseTerm = m_phase;
|
|
|
|
|
m_main->ChangePhase(PHASE_READ);
|
|
|
|
|
break;
|
2012-09-15 19:47:19 +00:00
|
|
|
|
|
|
|
|
|
default:
|
2015-04-06 15:23:18 +00:00
|
|
|
|
return true;
|
2012-06-26 20:23:05 +00:00
|
|
|
|
}
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if ( m_phase == PHASE_SETUPd ||
|
2012-09-29 21:52:30 +00:00
|
|
|
|
m_phase == PHASE_SETUPg ||
|
|
|
|
|
m_phase == PHASE_SETUPp ||
|
|
|
|
|
m_phase == PHASE_SETUPc ||
|
|
|
|
|
m_phase == PHASE_SETUPs )
|
2012-06-26 20:23:05 +00:00
|
|
|
|
{
|
2012-09-18 20:33:28 +00:00
|
|
|
|
pw = static_cast<CWindow*>(m_interface->SearchControl(EVENT_WINDOW5));
|
2012-06-26 20:23:05 +00:00
|
|
|
|
if ( pw == 0 ) return false;
|
|
|
|
|
|
2012-09-15 19:47:19 +00:00
|
|
|
|
if ( event.type == pw->GetEventTypeClose() ||
|
2012-09-29 21:52:30 +00:00
|
|
|
|
event.type == EVENT_INTERFACE_BACK ||
|
|
|
|
|
(event.type == EVENT_KEY_DOWN && event.key.key == KEY(ESCAPE)) )
|
2012-06-26 20:23:05 +00:00
|
|
|
|
{
|
|
|
|
|
SetupMemorize();
|
|
|
|
|
m_engine->ApplyChange();
|
|
|
|
|
m_main->ChangePhase(PHASE_INIT);
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
2012-09-15 19:47:19 +00:00
|
|
|
|
switch( event.type )
|
2012-06-26 20:23:05 +00:00
|
|
|
|
{
|
|
|
|
|
case EVENT_INTERFACE_SETUPd:
|
|
|
|
|
m_main->ChangePhase(PHASE_SETUPd);
|
2015-04-17 20:02:10 +00:00
|
|
|
|
return false;
|
2012-06-26 20:23:05 +00:00
|
|
|
|
|
|
|
|
|
case EVENT_INTERFACE_SETUPg:
|
|
|
|
|
m_main->ChangePhase(PHASE_SETUPg);
|
2015-04-17 20:02:10 +00:00
|
|
|
|
return false;
|
2012-06-26 20:23:05 +00:00
|
|
|
|
|
|
|
|
|
case EVENT_INTERFACE_SETUPp:
|
|
|
|
|
m_main->ChangePhase(PHASE_SETUPp);
|
2015-04-17 20:02:10 +00:00
|
|
|
|
return false;
|
2012-06-26 20:23:05 +00:00
|
|
|
|
|
|
|
|
|
case EVENT_INTERFACE_SETUPc:
|
|
|
|
|
m_main->ChangePhase(PHASE_SETUPc);
|
2015-04-17 20:02:10 +00:00
|
|
|
|
return false;
|
2012-06-26 20:23:05 +00:00
|
|
|
|
|
|
|
|
|
case EVENT_INTERFACE_SETUPs:
|
|
|
|
|
m_main->ChangePhase(PHASE_SETUPs);
|
2015-04-17 20:02:10 +00:00
|
|
|
|
return false;
|
2012-09-15 19:47:19 +00:00
|
|
|
|
|
|
|
|
|
default:
|
2015-04-17 20:02:10 +00:00
|
|
|
|
break;
|
2012-06-26 20:23:05 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if ( m_phase == PHASE_SETUPds ||
|
2012-09-29 21:52:30 +00:00
|
|
|
|
m_phase == PHASE_SETUPgs ||
|
|
|
|
|
m_phase == PHASE_SETUPps ||
|
|
|
|
|
m_phase == PHASE_SETUPcs ||
|
|
|
|
|
m_phase == PHASE_SETUPss )
|
2012-06-26 20:23:05 +00:00
|
|
|
|
{
|
2012-09-18 20:33:28 +00:00
|
|
|
|
pw = static_cast<CWindow*>(m_interface->SearchControl(EVENT_WINDOW5));
|
2012-06-26 20:23:05 +00:00
|
|
|
|
if ( pw == 0 ) return false;
|
|
|
|
|
|
2012-09-15 19:47:19 +00:00
|
|
|
|
if ( event.type == pw->GetEventTypeClose() ||
|
2012-09-29 21:52:30 +00:00
|
|
|
|
event.type == EVENT_INTERFACE_BACK ||
|
|
|
|
|
(event.type == EVENT_KEY_DOWN && event.key.key == KEY(ESCAPE)) )
|
2012-06-26 20:23:05 +00:00
|
|
|
|
{
|
|
|
|
|
SetupMemorize();
|
|
|
|
|
m_engine->ApplyChange();
|
|
|
|
|
m_interface->DeleteControl(EVENT_WINDOW5);
|
|
|
|
|
ChangePhase(PHASE_SIMUL);
|
|
|
|
|
StopSuspend();
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
2012-09-15 19:47:19 +00:00
|
|
|
|
switch( event.type )
|
2012-06-26 20:23:05 +00:00
|
|
|
|
{
|
|
|
|
|
case EVENT_INTERFACE_SETUPd:
|
|
|
|
|
ChangePhase(PHASE_SETUPds);
|
2015-04-17 20:02:10 +00:00
|
|
|
|
return false;
|
2012-06-26 20:23:05 +00:00
|
|
|
|
|
|
|
|
|
case EVENT_INTERFACE_SETUPg:
|
|
|
|
|
ChangePhase(PHASE_SETUPgs);
|
2015-04-17 20:02:10 +00:00
|
|
|
|
return false;
|
2012-06-26 20:23:05 +00:00
|
|
|
|
|
|
|
|
|
case EVENT_INTERFACE_SETUPp:
|
|
|
|
|
ChangePhase(PHASE_SETUPps);
|
2015-04-17 20:02:10 +00:00
|
|
|
|
return false;
|
2012-06-26 20:23:05 +00:00
|
|
|
|
|
|
|
|
|
case EVENT_INTERFACE_SETUPc:
|
|
|
|
|
ChangePhase(PHASE_SETUPcs);
|
2015-04-17 20:02:10 +00:00
|
|
|
|
return false;
|
2012-06-26 20:23:05 +00:00
|
|
|
|
|
|
|
|
|
case EVENT_INTERFACE_SETUPs:
|
|
|
|
|
ChangePhase(PHASE_SETUPss);
|
2015-04-17 20:02:10 +00:00
|
|
|
|
return false;
|
2012-09-15 19:47:19 +00:00
|
|
|
|
|
|
|
|
|
default:
|
2015-04-17 20:02:10 +00:00
|
|
|
|
break;
|
2012-06-26 20:23:05 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if ( m_phase == PHASE_SETUPd || // setup/display ?
|
2012-09-29 21:52:30 +00:00
|
|
|
|
m_phase == PHASE_SETUPds )
|
2012-06-26 20:23:05 +00:00
|
|
|
|
{
|
2012-09-15 19:47:19 +00:00
|
|
|
|
switch( event.type )
|
2012-06-26 20:23:05 +00:00
|
|
|
|
{
|
|
|
|
|
case EVENT_LIST2:
|
|
|
|
|
UpdateApply();
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case EVENT_INTERFACE_FULL:
|
2012-09-18 20:33:28 +00:00
|
|
|
|
pw = static_cast<CWindow*>(m_interface->SearchControl(EVENT_WINDOW5));
|
2012-06-26 20:23:05 +00:00
|
|
|
|
if ( pw == 0 ) break;
|
2012-09-18 20:33:28 +00:00
|
|
|
|
pc = static_cast<CCheck*>(pw->SearchControl(EVENT_INTERFACE_FULL));
|
2013-05-26 15:47:54 +00:00
|
|
|
|
if ( pc == 0 ) break;
|
|
|
|
|
|
|
|
|
|
if ( pc->TestState(STATE_CHECK) )
|
|
|
|
|
{
|
|
|
|
|
pc->ClearState(STATE_CHECK);
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
pc->SetState(STATE_CHECK);
|
|
|
|
|
}
|
2012-12-25 20:36:50 +00:00
|
|
|
|
|
2012-06-26 20:23:05 +00:00
|
|
|
|
UpdateApply();
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case EVENT_INTERFACE_APPLY:
|
2012-09-18 20:33:28 +00:00
|
|
|
|
pw = static_cast<CWindow*>(m_interface->SearchControl(EVENT_WINDOW5));
|
2012-06-26 20:23:05 +00:00
|
|
|
|
if ( pw == 0 ) break;
|
2012-09-18 20:33:28 +00:00
|
|
|
|
pb = static_cast<CButton*>(pw->SearchControl(EVENT_INTERFACE_APPLY));
|
2012-06-26 20:23:05 +00:00
|
|
|
|
if ( pb == 0 ) break;
|
|
|
|
|
pb->ClearState(STATE_PRESS);
|
|
|
|
|
pb->ClearState(STATE_HILIGHT);
|
2014-10-19 13:45:59 +00:00
|
|
|
|
ChangeDisplay();
|
2012-06-26 20:23:05 +00:00
|
|
|
|
UpdateApply();
|
|
|
|
|
break;
|
2012-09-15 19:47:19 +00:00
|
|
|
|
|
|
|
|
|
default:
|
2015-04-17 19:47:03 +00:00
|
|
|
|
return true;
|
2012-06-26 20:23:05 +00:00
|
|
|
|
}
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if ( m_phase == PHASE_SETUPg || // setup/graphic ?
|
2012-09-29 21:52:30 +00:00
|
|
|
|
m_phase == PHASE_SETUPgs )
|
2012-06-26 20:23:05 +00:00
|
|
|
|
{
|
2012-09-15 19:47:19 +00:00
|
|
|
|
switch( event.type )
|
2012-06-26 20:23:05 +00:00
|
|
|
|
{
|
|
|
|
|
case EVENT_INTERFACE_SHADOW:
|
2012-09-15 19:47:19 +00:00
|
|
|
|
m_engine->SetShadow(!m_engine->GetShadow());
|
2012-06-26 20:23:05 +00:00
|
|
|
|
ChangeSetupButtons();
|
|
|
|
|
UpdateSetupButtons();
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case EVENT_INTERFACE_GROUND:
|
2012-09-15 19:47:19 +00:00
|
|
|
|
m_engine->SetGroundSpot(!m_engine->GetGroundSpot());
|
2012-06-26 20:23:05 +00:00
|
|
|
|
ChangeSetupButtons();
|
|
|
|
|
UpdateSetupButtons();
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case EVENT_INTERFACE_DIRTY:
|
2012-09-15 19:47:19 +00:00
|
|
|
|
m_engine->SetDirty(!m_engine->GetDirty());
|
2012-06-26 20:23:05 +00:00
|
|
|
|
ChangeSetupButtons();
|
|
|
|
|
UpdateSetupButtons();
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case EVENT_INTERFACE_FOG:
|
2012-09-15 19:47:19 +00:00
|
|
|
|
m_engine->SetFog(!m_engine->GetFog());
|
|
|
|
|
m_camera->SetOverBaseColor(Gfx::Color(0.0f, 0.0f, 0.0f, 0.0f)); // TODO: color ok?
|
2012-06-26 20:23:05 +00:00
|
|
|
|
ChangeSetupButtons();
|
|
|
|
|
UpdateSetupButtons();
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case EVENT_INTERFACE_LENS:
|
2012-09-15 19:47:19 +00:00
|
|
|
|
m_engine->SetLensMode(!m_engine->GetLensMode());
|
2012-06-26 20:23:05 +00:00
|
|
|
|
ChangeSetupButtons();
|
|
|
|
|
UpdateSetupButtons();
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case EVENT_INTERFACE_SKY:
|
2012-09-15 19:47:19 +00:00
|
|
|
|
m_engine->SetSkyMode(!m_engine->GetSkyMode());
|
2012-06-26 20:23:05 +00:00
|
|
|
|
ChangeSetupButtons();
|
|
|
|
|
UpdateSetupButtons();
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case EVENT_INTERFACE_PLANET:
|
2012-09-15 19:47:19 +00:00
|
|
|
|
m_engine->SetPlanetMode(!m_engine->GetPlanetMode());
|
2012-06-26 20:23:05 +00:00
|
|
|
|
ChangeSetupButtons();
|
|
|
|
|
UpdateSetupButtons();
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case EVENT_INTERFACE_LIGHT:
|
2012-09-15 19:47:19 +00:00
|
|
|
|
m_engine->SetLightMode(!m_engine->GetLightMode());
|
2012-06-26 20:23:05 +00:00
|
|
|
|
ChangeSetupButtons();
|
|
|
|
|
UpdateSetupButtons();
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case EVENT_INTERFACE_PARTI:
|
|
|
|
|
case EVENT_INTERFACE_CLIP:
|
|
|
|
|
case EVENT_INTERFACE_DETAIL:
|
|
|
|
|
case EVENT_INTERFACE_GADGET:
|
|
|
|
|
case EVENT_INTERFACE_TEXTURE:
|
|
|
|
|
ChangeSetupButtons();
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case EVENT_INTERFACE_MIN:
|
|
|
|
|
ChangeSetupQuality(-1);
|
|
|
|
|
UpdateSetupButtons();
|
|
|
|
|
break;
|
|
|
|
|
case EVENT_INTERFACE_NORM:
|
|
|
|
|
ChangeSetupQuality(0);
|
|
|
|
|
UpdateSetupButtons();
|
|
|
|
|
break;
|
|
|
|
|
case EVENT_INTERFACE_MAX:
|
|
|
|
|
ChangeSetupQuality(1);
|
|
|
|
|
UpdateSetupButtons();
|
|
|
|
|
break;
|
2012-09-15 19:47:19 +00:00
|
|
|
|
|
|
|
|
|
default:
|
2015-04-17 19:47:03 +00:00
|
|
|
|
return true;
|
2012-06-26 20:23:05 +00:00
|
|
|
|
}
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if ( m_phase == PHASE_SETUPp || // setup/game ?
|
2012-09-29 21:52:30 +00:00
|
|
|
|
m_phase == PHASE_SETUPps )
|
2012-06-26 20:23:05 +00:00
|
|
|
|
{
|
2012-09-15 19:47:19 +00:00
|
|
|
|
switch( event.type )
|
2012-06-26 20:23:05 +00:00
|
|
|
|
{
|
|
|
|
|
case EVENT_INTERFACE_TOTO:
|
2012-09-15 19:47:19 +00:00
|
|
|
|
m_engine->SetTotoMode(!m_engine->GetTotoMode());
|
2012-06-26 20:23:05 +00:00
|
|
|
|
ChangeSetupButtons();
|
|
|
|
|
UpdateSetupButtons();
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case EVENT_INTERFACE_TOOLTIP:
|
|
|
|
|
m_bTooltip = !m_bTooltip;
|
|
|
|
|
ChangeSetupButtons();
|
|
|
|
|
UpdateSetupButtons();
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case EVENT_INTERFACE_GLINT:
|
|
|
|
|
m_bGlint = !m_bGlint;
|
|
|
|
|
ChangeSetupButtons();
|
|
|
|
|
UpdateSetupButtons();
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case EVENT_INTERFACE_RAIN:
|
|
|
|
|
m_bRain = !m_bRain;
|
|
|
|
|
ChangeSetupButtons();
|
|
|
|
|
UpdateSetupButtons();
|
|
|
|
|
break;
|
|
|
|
|
|
2015-07-13 10:11:11 +00:00
|
|
|
|
case EVENT_INTERFACE_MOUSE:
|
|
|
|
|
if (m_app->GetMouseMode() == MOUSE_SYSTEM)
|
|
|
|
|
m_app->SetMouseMode(MOUSE_ENGINE);
|
|
|
|
|
else
|
|
|
|
|
m_app->SetMouseMode(MOUSE_SYSTEM);
|
|
|
|
|
|
|
|
|
|
ChangeSetupButtons();
|
|
|
|
|
UpdateSetupButtons();
|
|
|
|
|
break;
|
|
|
|
|
|
2012-06-26 20:23:05 +00:00
|
|
|
|
case EVENT_INTERFACE_EDITMODE:
|
2012-09-15 19:47:19 +00:00
|
|
|
|
m_engine->SetEditIndentMode(!m_engine->GetEditIndentMode());
|
2012-06-26 20:23:05 +00:00
|
|
|
|
ChangeSetupButtons();
|
|
|
|
|
UpdateSetupButtons();
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case EVENT_INTERFACE_EDITVALUE:
|
2012-09-15 19:47:19 +00:00
|
|
|
|
if ( m_engine->GetEditIndentValue() == 2 )
|
2012-06-26 20:23:05 +00:00
|
|
|
|
{
|
|
|
|
|
m_engine->SetEditIndentValue(4);
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
m_engine->SetEditIndentValue(2);
|
|
|
|
|
}
|
|
|
|
|
ChangeSetupButtons();
|
|
|
|
|
UpdateSetupButtons();
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case EVENT_INTERFACE_SOLUCE4:
|
|
|
|
|
m_bSoluce4 = !m_bSoluce4;
|
|
|
|
|
ChangeSetupButtons();
|
|
|
|
|
UpdateSetupButtons();
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case EVENT_INTERFACE_MOVIES:
|
|
|
|
|
m_bMovies = !m_bMovies;
|
|
|
|
|
ChangeSetupButtons();
|
|
|
|
|
UpdateSetupButtons();
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case EVENT_INTERFACE_NICERST:
|
|
|
|
|
m_bNiceReset = !m_bNiceReset;
|
|
|
|
|
ChangeSetupButtons();
|
|
|
|
|
UpdateSetupButtons();
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case EVENT_INTERFACE_HIMSELF:
|
|
|
|
|
m_bHimselfDamage = !m_bHimselfDamage;
|
|
|
|
|
ChangeSetupButtons();
|
|
|
|
|
UpdateSetupButtons();
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case EVENT_INTERFACE_SCROLL:
|
|
|
|
|
m_bCameraScroll = !m_bCameraScroll;
|
|
|
|
|
m_camera->SetCameraScroll(m_bCameraScroll);
|
|
|
|
|
ChangeSetupButtons();
|
|
|
|
|
UpdateSetupButtons();
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case EVENT_INTERFACE_INVERTX:
|
|
|
|
|
m_bCameraInvertX = !m_bCameraInvertX;
|
|
|
|
|
m_camera->SetCameraInvertX(m_bCameraInvertX);
|
|
|
|
|
ChangeSetupButtons();
|
|
|
|
|
UpdateSetupButtons();
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case EVENT_INTERFACE_INVERTY:
|
|
|
|
|
m_bCameraInvertY = !m_bCameraInvertY;
|
|
|
|
|
m_camera->SetCameraInvertY(m_bCameraInvertY);
|
|
|
|
|
ChangeSetupButtons();
|
|
|
|
|
UpdateSetupButtons();
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case EVENT_INTERFACE_EFFECT:
|
|
|
|
|
m_bEffect = !m_bEffect;
|
|
|
|
|
m_camera->SetEffect(m_bEffect);
|
|
|
|
|
ChangeSetupButtons();
|
|
|
|
|
UpdateSetupButtons();
|
|
|
|
|
break;
|
2012-09-15 19:47:19 +00:00
|
|
|
|
|
2014-10-22 04:44:17 +00:00
|
|
|
|
case EVENT_INTERFACE_BLOOD:
|
|
|
|
|
m_bBlood = !m_bBlood;
|
|
|
|
|
m_camera->SetBlood(m_bBlood);
|
|
|
|
|
ChangeSetupButtons();
|
|
|
|
|
UpdateSetupButtons();
|
|
|
|
|
break;
|
2015-06-21 18:59:23 +00:00
|
|
|
|
|
2014-11-11 13:50:44 +00:00
|
|
|
|
case EVENT_INTERFACE_AUTOSAVE_ENABLE:
|
|
|
|
|
m_bAutosave = !m_bAutosave;
|
|
|
|
|
m_main->SetAutosave(m_bAutosave);
|
|
|
|
|
ChangeSetupButtons();
|
|
|
|
|
UpdateSetupButtons();
|
|
|
|
|
break;
|
2015-06-21 18:59:23 +00:00
|
|
|
|
|
2014-11-11 13:50:44 +00:00
|
|
|
|
case EVENT_INTERFACE_AUTOSAVE_INTERVAL:
|
|
|
|
|
ChangeSetupButtons();
|
|
|
|
|
UpdateSetupButtons();
|
|
|
|
|
break;
|
2015-06-21 18:59:23 +00:00
|
|
|
|
|
2014-11-11 13:50:44 +00:00
|
|
|
|
case EVENT_INTERFACE_AUTOSAVE_SLOTS:
|
|
|
|
|
ChangeSetupButtons();
|
|
|
|
|
UpdateSetupButtons();
|
|
|
|
|
break;
|
2014-10-22 04:44:17 +00:00
|
|
|
|
|
2012-09-15 19:47:19 +00:00
|
|
|
|
default:
|
2015-04-17 19:47:03 +00:00
|
|
|
|
return true;
|
2012-06-26 20:23:05 +00:00
|
|
|
|
}
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if ( m_phase == PHASE_SETUPc || // setup/commands ?
|
2012-09-29 21:52:30 +00:00
|
|
|
|
m_phase == PHASE_SETUPcs )
|
2012-06-26 20:23:05 +00:00
|
|
|
|
{
|
2012-09-15 19:47:19 +00:00
|
|
|
|
switch( event.type )
|
2012-06-26 20:23:05 +00:00
|
|
|
|
{
|
|
|
|
|
case EVENT_INTERFACE_KSCROLL:
|
|
|
|
|
UpdateKey();
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case EVENT_INTERFACE_KDEF:
|
2014-12-11 18:01:57 +00:00
|
|
|
|
CInput::GetInstancePointer()->SetDefaultInputBindings();
|
2012-06-26 20:23:05 +00:00
|
|
|
|
UpdateKey();
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case EVENT_INTERFACE_JOYSTICK:
|
2012-09-15 19:47:19 +00:00
|
|
|
|
m_app->SetJoystickEnabled(!m_app->GetJoystickEnabled());
|
2012-06-26 20:23:05 +00:00
|
|
|
|
UpdateSetupButtons();
|
|
|
|
|
break;
|
2012-09-15 19:47:19 +00:00
|
|
|
|
|
|
|
|
|
default:
|
2015-06-21 18:59:23 +00:00
|
|
|
|
if (event.type >= EVENT_INTERFACE_KEY && event.type <= EVENT_INTERFACE_KEY_END)
|
2014-12-14 15:54:32 +00:00
|
|
|
|
{
|
|
|
|
|
ChangeKey(event.type);
|
|
|
|
|
UpdateKey();
|
2015-04-17 19:47:03 +00:00
|
|
|
|
break;
|
2014-12-14 15:54:32 +00:00
|
|
|
|
}
|
2015-04-17 19:47:03 +00:00
|
|
|
|
return true;
|
2012-06-26 20:23:05 +00:00
|
|
|
|
}
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if ( m_phase == PHASE_SETUPs || // setup/sound ?
|
2012-09-29 21:52:30 +00:00
|
|
|
|
m_phase == PHASE_SETUPss )
|
2012-06-26 20:23:05 +00:00
|
|
|
|
{
|
2012-09-15 19:47:19 +00:00
|
|
|
|
switch( event.type )
|
2012-06-26 20:23:05 +00:00
|
|
|
|
{
|
|
|
|
|
case EVENT_INTERFACE_VOLSOUND:
|
|
|
|
|
case EVENT_INTERFACE_VOLMUSIC:
|
|
|
|
|
ChangeSetupButtons();
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case EVENT_INTERFACE_SILENT:
|
|
|
|
|
m_sound->SetAudioVolume(0);
|
2012-12-25 20:36:50 +00:00
|
|
|
|
m_sound->SetMusicVolume(0);
|
2012-06-26 20:23:05 +00:00
|
|
|
|
UpdateSetupButtons();
|
|
|
|
|
break;
|
|
|
|
|
case EVENT_INTERFACE_NOISY:
|
|
|
|
|
m_sound->SetAudioVolume(MAXVOLUME);
|
2012-12-25 20:36:50 +00:00
|
|
|
|
m_sound->SetMusicVolume(MAXVOLUME*3/4);
|
2012-06-26 20:23:05 +00:00
|
|
|
|
UpdateSetupButtons();
|
|
|
|
|
break;
|
2012-09-15 19:47:19 +00:00
|
|
|
|
|
|
|
|
|
default:
|
2015-04-17 19:47:03 +00:00
|
|
|
|
return true;
|
2012-06-26 20:23:05 +00:00
|
|
|
|
}
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if ( m_phase == PHASE_READ )
|
|
|
|
|
{
|
2012-09-18 20:33:28 +00:00
|
|
|
|
pw = static_cast<CWindow*>(m_interface->SearchControl(EVENT_WINDOW5));
|
2012-06-26 20:23:05 +00:00
|
|
|
|
if ( pw == 0 ) return false;
|
|
|
|
|
|
2012-09-15 19:47:19 +00:00
|
|
|
|
if ( event.type == pw->GetEventTypeClose() ||
|
2012-09-29 21:52:30 +00:00
|
|
|
|
event.type == EVENT_INTERFACE_BACK ||
|
|
|
|
|
(event.type == EVENT_KEY_DOWN && event.key.key == KEY(ESCAPE)) )
|
2012-06-26 20:23:05 +00:00
|
|
|
|
{
|
|
|
|
|
ChangePhase(m_phaseTerm);
|
2015-04-17 19:47:03 +00:00
|
|
|
|
return false;
|
2012-06-26 20:23:05 +00:00
|
|
|
|
}
|
|
|
|
|
|
2012-09-15 19:47:19 +00:00
|
|
|
|
if ( event.type == EVENT_INTERFACE_IOLIST )
|
2012-06-26 20:23:05 +00:00
|
|
|
|
{
|
|
|
|
|
IOUpdateList();
|
2015-04-17 19:47:03 +00:00
|
|
|
|
return false;
|
2012-06-26 20:23:05 +00:00
|
|
|
|
}
|
2012-09-15 19:47:19 +00:00
|
|
|
|
if ( event.type == EVENT_INTERFACE_IODELETE )
|
2012-06-26 20:23:05 +00:00
|
|
|
|
{
|
|
|
|
|
IODeleteScene();
|
|
|
|
|
IOUpdateList();
|
2015-04-17 19:47:03 +00:00
|
|
|
|
return false;
|
2012-06-26 20:23:05 +00:00
|
|
|
|
}
|
2012-09-15 19:47:19 +00:00
|
|
|
|
if ( event.type == EVENT_INTERFACE_IOREAD )
|
2012-06-26 20:23:05 +00:00
|
|
|
|
{
|
|
|
|
|
if ( IOReadScene() )
|
|
|
|
|
{
|
|
|
|
|
m_main->ChangePhase(PHASE_LOADING);
|
|
|
|
|
}
|
2015-04-17 19:47:03 +00:00
|
|
|
|
return false;
|
2012-06-26 20:23:05 +00:00
|
|
|
|
}
|
|
|
|
|
|
2015-04-17 19:47:03 +00:00
|
|
|
|
return true;
|
2012-06-26 20:23:05 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if ( m_phase == PHASE_WRITEs ||
|
2012-09-29 21:52:30 +00:00
|
|
|
|
m_phase == PHASE_READs )
|
2012-06-26 20:23:05 +00:00
|
|
|
|
{
|
2012-09-18 20:33:28 +00:00
|
|
|
|
pw = static_cast<CWindow*>(m_interface->SearchControl(EVENT_WINDOW5));
|
2012-06-26 20:23:05 +00:00
|
|
|
|
if ( pw == 0 ) return false;
|
|
|
|
|
|
2012-09-15 19:47:19 +00:00
|
|
|
|
if ( event.type == pw->GetEventTypeClose() ||
|
2012-09-29 21:52:30 +00:00
|
|
|
|
event.type == EVENT_INTERFACE_BACK ||
|
|
|
|
|
(event.type == EVENT_KEY_DOWN && event.key.key == KEY(ESCAPE)) )
|
2012-06-26 20:23:05 +00:00
|
|
|
|
{
|
|
|
|
|
m_interface->DeleteControl(EVENT_WINDOW5);
|
|
|
|
|
ChangePhase(PHASE_SIMUL);
|
|
|
|
|
StopSuspend();
|
2015-04-17 19:47:03 +00:00
|
|
|
|
return false;
|
2012-06-26 20:23:05 +00:00
|
|
|
|
}
|
|
|
|
|
|
2012-09-15 19:47:19 +00:00
|
|
|
|
if ( event.type == EVENT_INTERFACE_IOLIST )
|
2012-06-26 20:23:05 +00:00
|
|
|
|
{
|
|
|
|
|
IOUpdateList();
|
2015-04-17 19:47:03 +00:00
|
|
|
|
return false;
|
2012-06-26 20:23:05 +00:00
|
|
|
|
}
|
2012-09-15 19:47:19 +00:00
|
|
|
|
if ( event.type == EVENT_INTERFACE_IODELETE )
|
2012-06-26 20:23:05 +00:00
|
|
|
|
{
|
|
|
|
|
IODeleteScene();
|
|
|
|
|
IOUpdateList();
|
2015-04-17 19:47:03 +00:00
|
|
|
|
return false;
|
2012-06-26 20:23:05 +00:00
|
|
|
|
}
|
2012-09-15 19:47:19 +00:00
|
|
|
|
if ( event.type == EVENT_INTERFACE_IOWRITE )
|
2012-06-26 20:23:05 +00:00
|
|
|
|
{
|
|
|
|
|
IOWriteScene();
|
|
|
|
|
m_interface->DeleteControl(EVENT_WINDOW5);
|
|
|
|
|
ChangePhase(PHASE_SIMUL);
|
|
|
|
|
StopSuspend();
|
2015-04-17 19:47:03 +00:00
|
|
|
|
return false;
|
2012-06-26 20:23:05 +00:00
|
|
|
|
}
|
2012-09-15 19:47:19 +00:00
|
|
|
|
if ( event.type == EVENT_INTERFACE_IOREAD )
|
2012-06-26 20:23:05 +00:00
|
|
|
|
{
|
|
|
|
|
if ( IOReadScene() )
|
|
|
|
|
{
|
|
|
|
|
m_interface->DeleteControl(EVENT_WINDOW5);
|
|
|
|
|
ChangePhase(PHASE_SIMUL);
|
|
|
|
|
StopSuspend();
|
|
|
|
|
m_main->ChangePhase(PHASE_LOADING);
|
|
|
|
|
}
|
2015-04-17 19:47:03 +00:00
|
|
|
|
return false;
|
2012-06-26 20:23:05 +00:00
|
|
|
|
}
|
|
|
|
|
|
2015-04-17 19:47:03 +00:00
|
|
|
|
return true;
|
2012-06-26 20:23:05 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if ( m_phase == PHASE_WELCOME1 )
|
|
|
|
|
{
|
2012-09-15 19:47:19 +00:00
|
|
|
|
if ( event.type == EVENT_KEY_DOWN ||
|
2012-09-29 21:52:30 +00:00
|
|
|
|
event.type == EVENT_MOUSE_BUTTON_DOWN )
|
2012-06-26 20:23:05 +00:00
|
|
|
|
{
|
2015-04-06 15:23:18 +00:00
|
|
|
|
m_main->ChangePhase(PHASE_WELCOME2);
|
2012-06-26 20:23:05 +00:00
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if ( m_phase == PHASE_WELCOME2 )
|
|
|
|
|
{
|
2012-09-15 19:47:19 +00:00
|
|
|
|
if ( event.type == EVENT_KEY_DOWN ||
|
2012-09-29 21:52:30 +00:00
|
|
|
|
event.type == EVENT_MOUSE_BUTTON_DOWN )
|
2012-06-26 20:23:05 +00:00
|
|
|
|
{
|
2015-04-06 15:23:18 +00:00
|
|
|
|
m_main->ChangePhase(PHASE_WELCOME3);
|
2012-06-26 20:23:05 +00:00
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if ( m_phase == PHASE_WELCOME3 )
|
|
|
|
|
{
|
2012-09-15 19:47:19 +00:00
|
|
|
|
if ( event.type == EVENT_KEY_DOWN ||
|
2012-09-29 21:52:30 +00:00
|
|
|
|
event.type == EVENT_MOUSE_BUTTON_DOWN )
|
2012-06-26 20:23:05 +00:00
|
|
|
|
{
|
2015-04-06 15:23:18 +00:00
|
|
|
|
m_main->ChangePhase(PHASE_NAME);
|
2012-06-26 20:23:05 +00:00
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if ( m_phase == PHASE_GENERIC )
|
|
|
|
|
{
|
2012-09-15 19:47:19 +00:00
|
|
|
|
if ( event.type == EVENT_INTERFACE_ABORT )
|
2012-06-26 20:23:05 +00:00
|
|
|
|
{
|
|
|
|
|
ChangePhase(PHASE_INIT);
|
|
|
|
|
}
|
|
|
|
|
|
2012-09-15 19:47:19 +00:00
|
|
|
|
if ( event.type == EVENT_KEY_DOWN )
|
2012-06-26 20:23:05 +00:00
|
|
|
|
{
|
2012-09-21 22:38:17 +00:00
|
|
|
|
if ( event.key.key == KEY(ESCAPE) )
|
2012-06-26 20:23:05 +00:00
|
|
|
|
{
|
|
|
|
|
ChangePhase(PHASE_INIT);
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
2012-09-15 19:47:19 +00:00
|
|
|
|
m_eventQueue->AddEvent(Event(EVENT_QUIT));
|
2012-06-26 20:23:05 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2012-09-15 19:47:19 +00:00
|
|
|
|
if ( event.type == EVENT_MOUSE_BUTTON_DOWN )
|
2012-06-26 20:23:05 +00:00
|
|
|
|
{
|
2012-09-15 19:47:19 +00:00
|
|
|
|
m_eventQueue->AddEvent(Event(EVENT_QUIT));
|
2012-06-26 20:23:05 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Moves the reflections.
|
|
|
|
|
|
|
|
|
|
void CMainDialog::GlintMove()
|
|
|
|
|
{
|
|
|
|
|
CWindow* pw;
|
|
|
|
|
CGroup* pg;
|
|
|
|
|
Math::Point pos, dim, zoom;
|
|
|
|
|
|
|
|
|
|
if ( m_phase == PHASE_SIMUL ) return;
|
|
|
|
|
|
2012-09-18 20:33:28 +00:00
|
|
|
|
pw = static_cast<CWindow*>(m_interface->SearchControl(EVENT_WINDOW5));
|
2012-06-26 20:23:05 +00:00
|
|
|
|
if ( pw == 0 ) return;
|
|
|
|
|
|
|
|
|
|
if ( m_phase == PHASE_INIT )
|
|
|
|
|
{
|
2012-09-18 20:33:28 +00:00
|
|
|
|
pg = static_cast<CGroup*>(pw->SearchControl(EVENT_INTERFACE_GLINTl));
|
2012-06-26 20:23:05 +00:00
|
|
|
|
if ( pg != 0 )
|
|
|
|
|
{
|
|
|
|
|
zoom.x = sinf(m_glintTime*0.23f);
|
|
|
|
|
zoom.y = sinf(m_glintTime*0.37f);
|
|
|
|
|
pos.x = 0.35f;
|
|
|
|
|
pos.y = 0.90f;
|
|
|
|
|
dim.x = 0.30f-0.10f*(zoom.x+1.0f)/2.0f;
|
|
|
|
|
dim.y = 0.50f-0.30f*(zoom.y+1.0f)/2.0f;
|
|
|
|
|
pos.y -= dim.y;
|
|
|
|
|
pg->SetPos(pos);
|
|
|
|
|
pg->SetDim(dim);
|
|
|
|
|
}
|
|
|
|
|
|
2012-09-18 20:33:28 +00:00
|
|
|
|
pg = static_cast<CGroup*>(pw->SearchControl(EVENT_INTERFACE_GLINTr));
|
2012-06-26 20:23:05 +00:00
|
|
|
|
if ( pg != 0 )
|
|
|
|
|
{
|
|
|
|
|
zoom.x = sinf(m_glintTime*0.21f);
|
|
|
|
|
zoom.y = sinf(m_glintTime*0.26f);
|
|
|
|
|
pos.x = 0.65f;
|
|
|
|
|
pos.y = 0.10f;
|
|
|
|
|
dim.x = 0.30f-0.10f*(zoom.x+1.0f)/2.0f;
|
|
|
|
|
dim.y = 0.50f-0.30f*(zoom.y+1.0f)/2.0f;
|
|
|
|
|
pos.x -= dim.x;
|
|
|
|
|
pg->SetPos(pos);
|
|
|
|
|
pg->SetDim(dim);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if ( m_phase == PHASE_NAME ||
|
2012-09-29 21:52:30 +00:00
|
|
|
|
m_phase == PHASE_TRAINER ||
|
|
|
|
|
m_phase == PHASE_MISSION ||
|
|
|
|
|
m_phase == PHASE_FREE ||
|
2013-12-27 19:36:11 +00:00
|
|
|
|
m_phase == PHASE_USER )
|
2012-06-26 20:23:05 +00:00
|
|
|
|
{
|
2012-09-18 20:33:28 +00:00
|
|
|
|
pg = static_cast<CGroup*>(pw->SearchControl(EVENT_INTERFACE_GLINTl));
|
2012-06-26 20:23:05 +00:00
|
|
|
|
if ( pg != 0 )
|
|
|
|
|
{
|
|
|
|
|
zoom.x = sinf(m_glintTime*0.22f);
|
|
|
|
|
zoom.y = sinf(m_glintTime*0.37f);
|
|
|
|
|
pos.x = 0.10f;
|
|
|
|
|
pos.y = 0.90f;
|
|
|
|
|
dim.x = 0.60f+0.30f*zoom.x;
|
|
|
|
|
dim.y = 0.60f+0.30f*zoom.y;
|
|
|
|
|
pos.y -= dim.y;
|
|
|
|
|
pg->SetPos(pos);
|
|
|
|
|
pg->SetDim(dim);
|
|
|
|
|
}
|
|
|
|
|
|
2012-09-18 20:33:28 +00:00
|
|
|
|
pg = static_cast<CGroup*>(pw->SearchControl(EVENT_INTERFACE_GLINTr));
|
2012-06-26 20:23:05 +00:00
|
|
|
|
if ( pg != 0 )
|
|
|
|
|
{
|
|
|
|
|
zoom.x = sinf(m_glintTime*0.19f);
|
|
|
|
|
zoom.y = sinf(m_glintTime*0.28f);
|
|
|
|
|
pos.x = 0.90f;
|
|
|
|
|
pos.y = 0.10f;
|
|
|
|
|
dim.x = 0.60f+0.30f*zoom.x;
|
|
|
|
|
dim.y = 0.60f+0.30f*zoom.y;
|
|
|
|
|
pos.x -= dim.x;
|
|
|
|
|
pg->SetPos(pos);
|
|
|
|
|
pg->SetDim(dim);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if ( m_phase == PHASE_SETUPd ||
|
2012-09-29 21:52:30 +00:00
|
|
|
|
m_phase == PHASE_SETUPg ||
|
|
|
|
|
m_phase == PHASE_SETUPp ||
|
|
|
|
|
m_phase == PHASE_SETUPc ||
|
|
|
|
|
m_phase == PHASE_SETUPs ||
|
|
|
|
|
m_phase == PHASE_SETUPds ||
|
|
|
|
|
m_phase == PHASE_SETUPgs ||
|
|
|
|
|
m_phase == PHASE_SETUPps ||
|
|
|
|
|
m_phase == PHASE_SETUPcs ||
|
|
|
|
|
m_phase == PHASE_SETUPss )
|
2012-06-26 20:23:05 +00:00
|
|
|
|
{
|
2012-09-18 20:33:28 +00:00
|
|
|
|
pg = static_cast<CGroup*>(pw->SearchControl(EVENT_INTERFACE_GLINTu));
|
2012-06-26 20:23:05 +00:00
|
|
|
|
if ( pg != 0 )
|
|
|
|
|
{
|
|
|
|
|
zoom.y = sinf(m_glintTime*0.27f);
|
|
|
|
|
pos.x = 0.10f;
|
|
|
|
|
pos.y = 0.76f;
|
|
|
|
|
dim.x = 0.80f;
|
|
|
|
|
dim.y = 0.32f+0.20f*zoom.y;
|
|
|
|
|
pos.y -= dim.y;
|
|
|
|
|
pg->SetPos(pos);
|
|
|
|
|
pg->SetDim(dim);
|
|
|
|
|
}
|
|
|
|
|
|
2012-09-18 20:33:28 +00:00
|
|
|
|
pg = static_cast<CGroup*>(pw->SearchControl(EVENT_INTERFACE_GLINTr));
|
2012-06-26 20:23:05 +00:00
|
|
|
|
if ( pg != 0 )
|
|
|
|
|
{
|
|
|
|
|
zoom.x = sinf(m_glintTime*0.29f);
|
|
|
|
|
zoom.y = sinf(m_glintTime*0.14f);
|
|
|
|
|
pos.x = 0.90f;
|
|
|
|
|
pos.y = 0.10f;
|
|
|
|
|
dim.x = 0.40f+0.20f*zoom.x;
|
|
|
|
|
dim.y = 0.40f+0.20f*zoom.y;
|
|
|
|
|
pos.x -= dim.x;
|
|
|
|
|
pg->SetPos(pos);
|
|
|
|
|
pg->SetDim(dim);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if ( m_phase == PHASE_WRITE ||
|
2012-09-29 21:52:30 +00:00
|
|
|
|
m_phase == PHASE_READ ||
|
|
|
|
|
m_phase == PHASE_WRITEs ||
|
|
|
|
|
m_phase == PHASE_READs )
|
2012-06-26 20:23:05 +00:00
|
|
|
|
{
|
2012-09-18 20:33:28 +00:00
|
|
|
|
pg = static_cast<CGroup*>(pw->SearchControl(EVENT_INTERFACE_GLINTl));
|
2012-06-26 20:23:05 +00:00
|
|
|
|
if ( pg != 0 )
|
|
|
|
|
{
|
|
|
|
|
zoom.x = sinf(m_glintTime*0.22f);
|
|
|
|
|
zoom.y = sinf(m_glintTime*0.37f);
|
|
|
|
|
pos.x = 0.10f;
|
|
|
|
|
pos.y = 0.90f;
|
|
|
|
|
dim.x = 0.60f+0.30f*zoom.x;
|
|
|
|
|
dim.y = 0.60f+0.30f*zoom.y;
|
|
|
|
|
pos.y -= dim.y;
|
|
|
|
|
pg->SetPos(pos);
|
|
|
|
|
pg->SetDim(dim);
|
|
|
|
|
}
|
|
|
|
|
|
2012-09-18 20:33:28 +00:00
|
|
|
|
pg = static_cast<CGroup*>(pw->SearchControl(EVENT_INTERFACE_GLINTr));
|
2012-06-26 20:23:05 +00:00
|
|
|
|
if ( pg != 0 )
|
|
|
|
|
{
|
|
|
|
|
zoom.x = sinf(m_glintTime*0.19f);
|
|
|
|
|
zoom.y = sinf(m_glintTime*0.28f);
|
|
|
|
|
pos.x = 0.90f;
|
|
|
|
|
pos.y = 0.10f;
|
|
|
|
|
dim.x = 0.60f+0.30f*zoom.x;
|
|
|
|
|
dim.y = 0.60f+0.30f*zoom.y;
|
|
|
|
|
pos.x -= dim.x;
|
|
|
|
|
pg->SetPos(pos);
|
|
|
|
|
pg->SetDim(dim);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2012-09-20 18:37:37 +00:00
|
|
|
|
// Returns the position for a sound.
|
2012-06-26 20:23:05 +00:00
|
|
|
|
|
|
|
|
|
Math::Vector SoundPos(Math::Point pos)
|
|
|
|
|
{
|
|
|
|
|
Math::Vector s;
|
|
|
|
|
|
|
|
|
|
s.x = (pos.x-0.5f)*2.0f;
|
|
|
|
|
s.y = (pos.y-0.5f)*2.0f;
|
|
|
|
|
s.z = 0.0f;
|
|
|
|
|
|
|
|
|
|
return s;
|
|
|
|
|
}
|
|
|
|
|
|
2012-09-20 18:37:37 +00:00
|
|
|
|
// Returns a random position for a sound.
|
2012-06-26 20:23:05 +00:00
|
|
|
|
|
|
|
|
|
Math::Vector SoundRand()
|
|
|
|
|
{
|
|
|
|
|
Math::Vector s;
|
|
|
|
|
|
|
|
|
|
s.x = (Math::Rand()-0.5f)*2.0f;
|
|
|
|
|
s.y = (Math::Rand()-0.5f)*2.0f;
|
|
|
|
|
s.z = 0.0f;
|
|
|
|
|
|
|
|
|
|
return s;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Makes pretty qq particles evolve.
|
|
|
|
|
|
2012-09-15 19:47:19 +00:00
|
|
|
|
void CMainDialog::FrameParticle(float rTime)
|
2012-06-26 20:23:05 +00:00
|
|
|
|
{
|
|
|
|
|
Math::Vector pos, speed;
|
|
|
|
|
Math::Point dim;
|
|
|
|
|
float *pParti, *pGlint;
|
|
|
|
|
int nParti, nGlint;
|
|
|
|
|
int i, r, ii;
|
|
|
|
|
|
|
|
|
|
static float partiPosInit[1+5*12] =
|
|
|
|
|
{ // x x t2 t2 type
|
2012-09-29 21:52:30 +00:00
|
|
|
|
12.0f,
|
2012-06-26 20:23:05 +00:00
|
|
|
|
607.0f, 164.0f, 0.2f, 0.8f, 1.0f, // upper cable
|
|
|
|
|
604.0f, 205.0f, 0.1f, 0.3f, 1.0f, // middle cable
|
|
|
|
|
603.0f, 247.0f, 0.1f, 0.3f, 1.0f, // lower cable
|
|
|
|
|
119.0f, 155.0f, 0.2f, 0.4f, 2.0f, // left pipe
|
|
|
|
|
366.0f, 23.0f, 0.5f, 1.5f, 4.0f, // upper pipe
|
|
|
|
|
560.0f, 414.0f, 0.1f, 0.1f, 1.0f, // button lower/right
|
2012-09-29 21:52:30 +00:00
|
|
|
|
20.0f, 413.0f, 0.1f, 0.1f, 2.0f, // button lower/left
|
|
|
|
|
39.0f, 78.0f, 0.1f, 0.2f, 1.0f, // left pot
|
|
|
|
|
39.0f, 78.0f, 0.5f, 0.9f, 1.0f, // left pot
|
2012-06-26 20:23:05 +00:00
|
|
|
|
170.0f, 229.0f, 0.5f, 0.5f, 3.0f, // left smoke
|
|
|
|
|
170.0f, 229.0f, 0.5f, 0.5f, 3.0f, // left smoke
|
|
|
|
|
474.0f, 229.0f, 0.5f, 0.5f, 3.0f, // right smoke
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
static float glintPosInit[1+2*14] =
|
|
|
|
|
{
|
2012-09-29 21:52:30 +00:00
|
|
|
|
14.0f,
|
|
|
|
|
15.0f, 407.0f,
|
|
|
|
|
68.0f, 417.0f,
|
2012-06-26 20:23:05 +00:00
|
|
|
|
548.0f, 36.0f,
|
|
|
|
|
611.0f, 37.0f,
|
|
|
|
|
611.0f, 100.0f,
|
|
|
|
|
611.0f, 395.0f,
|
2012-09-29 21:52:30 +00:00
|
|
|
|
36.0f, 35.0f,
|
2012-06-26 20:23:05 +00:00
|
|
|
|
166.0f, 55.0f,
|
|
|
|
|
166.0f, 94.0f,
|
|
|
|
|
477.0f, 56.0f,
|
2012-09-29 21:52:30 +00:00
|
|
|
|
31.0f, 190.0f,
|
|
|
|
|
32.0f, 220.0f,
|
|
|
|
|
65.0f, 221.0f,
|
|
|
|
|
65.0f, 250.0f,
|
2012-06-26 20:23:05 +00:00
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
static float partiPosBig[1+5*12] =
|
|
|
|
|
{ // x x t2 t2 type
|
2012-09-29 21:52:30 +00:00
|
|
|
|
12.0f,
|
2012-06-26 20:23:05 +00:00
|
|
|
|
607.0f, 164.0f, 0.2f, 0.8f, 1.0f, // upper cable
|
|
|
|
|
604.0f, 205.0f, 0.1f, 0.3f, 1.0f, // middle cable
|
|
|
|
|
603.0f, 247.0f, 0.1f, 0.3f, 1.0f, // lower cable
|
2012-09-29 21:52:30 +00:00
|
|
|
|
64.0f, 444.0f, 0.2f, 0.8f, 1.0f, // down the left cable
|
2012-06-26 20:23:05 +00:00
|
|
|
|
113.0f, 449.0f, 0.1f, 0.3f, 1.0f, // down the left cable
|
|
|
|
|
340.0f, 463.0f, 0.2f, 0.8f, 1.0f, // down the middle cable
|
2012-09-29 21:52:30 +00:00
|
|
|
|
36.0f, 155.0f, 0.2f, 0.4f, 2.0f, // left pipe
|
2012-06-26 20:23:05 +00:00
|
|
|
|
366.0f, 23.0f, 0.5f, 1.5f, 4.0f, // upper pipe
|
|
|
|
|
612.0f, 414.0f, 0.1f, 0.1f, 1.0f, // button lower/right
|
2012-09-29 21:52:30 +00:00
|
|
|
|
20.0f, 413.0f, 0.1f, 0.1f, 2.0f, // button lower/left
|
|
|
|
|
39.0f, 78.0f, 0.1f, 0.2f, 1.0f, // left pot
|
|
|
|
|
39.0f, 78.0f, 0.5f, 0.9f, 1.0f, // left pot
|
2012-06-26 20:23:05 +00:00
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
static float glintPosBig[1+2*12] =
|
|
|
|
|
{
|
2012-09-29 21:52:30 +00:00
|
|
|
|
12.0f,
|
|
|
|
|
15.0f, 407.0f,
|
|
|
|
|
48.0f, 399.0f,
|
2012-06-26 20:23:05 +00:00
|
|
|
|
611.0f, 37.0f,
|
|
|
|
|
611.0f, 100.0f,
|
|
|
|
|
611.0f, 395.0f,
|
2012-09-29 21:52:30 +00:00
|
|
|
|
36.0f, 35.0f,
|
|
|
|
|
31.0f, 190.0f,
|
|
|
|
|
32.0f, 220.0f,
|
|
|
|
|
31.0f, 221.0f,
|
|
|
|
|
31.0f, 189.0f,
|
2012-06-26 20:23:05 +00:00
|
|
|
|
255.0f, 18.0f,
|
|
|
|
|
279.0f, 18.0f,
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
if ( m_bDialog || !m_bRain ) return;
|
|
|
|
|
|
|
|
|
|
if ( m_phase == PHASE_INIT )
|
|
|
|
|
{
|
|
|
|
|
pParti = partiPosInit;
|
|
|
|
|
pGlint = glintPosInit;
|
|
|
|
|
}
|
|
|
|
|
else if ( m_phase == PHASE_NAME ||
|
2012-09-29 21:52:30 +00:00
|
|
|
|
m_phase == PHASE_TRAINER ||
|
|
|
|
|
m_phase == PHASE_DEFI ||
|
|
|
|
|
m_phase == PHASE_MISSION ||
|
|
|
|
|
m_phase == PHASE_FREE ||
|
|
|
|
|
m_phase == PHASE_USER ||
|
|
|
|
|
m_phase == PHASE_SETUPd ||
|
|
|
|
|
m_phase == PHASE_SETUPg ||
|
|
|
|
|
m_phase == PHASE_SETUPp ||
|
|
|
|
|
m_phase == PHASE_SETUPc ||
|
|
|
|
|
m_phase == PHASE_SETUPs ||
|
|
|
|
|
m_phase == PHASE_WRITE ||
|
|
|
|
|
m_phase == PHASE_READ )
|
2012-06-26 20:23:05 +00:00
|
|
|
|
{
|
|
|
|
|
pParti = partiPosBig;
|
|
|
|
|
pGlint = glintPosBig;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
2012-09-18 20:33:28 +00:00
|
|
|
|
nParti = static_cast<int>(*pParti++);
|
|
|
|
|
nGlint = static_cast<int>(*pGlint++);
|
2012-06-26 20:23:05 +00:00
|
|
|
|
|
|
|
|
|
for ( i=0 ; i<10 ; i++ )
|
|
|
|
|
{
|
|
|
|
|
if ( m_partiPhase[i] == 0 ) // waiting?
|
|
|
|
|
{
|
|
|
|
|
m_partiTime[i] -= rTime;
|
|
|
|
|
if ( m_partiTime[i] <= 0.0f )
|
|
|
|
|
{
|
|
|
|
|
r = rand()%3;
|
|
|
|
|
|
|
|
|
|
if ( r == 0 )
|
|
|
|
|
{
|
|
|
|
|
ii = rand()%nParti;
|
|
|
|
|
m_partiPos[i].x = pParti[ii*5+0]/640.0f;
|
|
|
|
|
m_partiPos[i].y = (480.0f-pParti[ii*5+1])/480.0f;
|
|
|
|
|
m_partiTime[i] = pParti[ii*5+2]+Math::Rand()*pParti[ii*5+3];
|
2012-09-18 20:33:28 +00:00
|
|
|
|
m_partiPhase[i] = static_cast<int>(pParti[ii*5+4]);
|
2012-06-26 20:23:05 +00:00
|
|
|
|
if ( m_partiPhase[i] == 3 )
|
|
|
|
|
{
|
|
|
|
|
m_sound->Play(SOUND_PSHHH, SoundPos(m_partiPos[i]), 0.3f+Math::Rand()*0.3f);
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
m_sound->Play(SOUND_GGG, SoundPos(m_partiPos[i]), 0.1f+Math::Rand()*0.4f);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if ( r == 1 )
|
|
|
|
|
{
|
|
|
|
|
ii = rand()%nGlint;
|
|
|
|
|
pos.x = pGlint[ii*2+0]/640.0f;
|
|
|
|
|
pos.y = (480.0f-pGlint[ii*2+1])/480.0f;
|
|
|
|
|
pos.z = 0.0f;
|
|
|
|
|
speed.x = 0.0f;
|
|
|
|
|
speed.y = 0.0f;
|
|
|
|
|
speed.z = 0.0f;
|
|
|
|
|
dim.x = 0.04f+Math::Rand()*0.04f;
|
|
|
|
|
dim.y = dim.x/0.75f;
|
2012-09-15 19:47:19 +00:00
|
|
|
|
m_particle->CreateParticle(pos, speed, dim,
|
2012-09-29 21:52:30 +00:00
|
|
|
|
rand()%2?Gfx::PARTIGLINT:Gfx::PARTICONTROL,
|
|
|
|
|
Math::Rand()*0.4f+0.4f, 0.0f, 0.0f,
|
|
|
|
|
Gfx::SH_INTERFACE);
|
2012-06-26 20:23:05 +00:00
|
|
|
|
m_partiTime[i] = 0.5f+Math::Rand()*0.5f;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if ( r == 2 )
|
|
|
|
|
{
|
|
|
|
|
ii = rand()%7;
|
|
|
|
|
if ( ii == 0 )
|
|
|
|
|
{
|
|
|
|
|
m_sound->Play(SOUND_ENERGY, SoundRand(), 0.2f+Math::Rand()*0.2f);
|
|
|
|
|
m_partiTime[i] = 1.0f+Math::Rand()*1.0f;
|
|
|
|
|
}
|
|
|
|
|
if ( ii == 1 )
|
|
|
|
|
{
|
|
|
|
|
m_sound->Play(SOUND_STATION, SoundRand(), 0.2f+Math::Rand()*0.2f);
|
|
|
|
|
m_partiTime[i] = 1.0f+Math::Rand()*2.0f;
|
|
|
|
|
}
|
|
|
|
|
if ( ii == 2 )
|
|
|
|
|
{
|
|
|
|
|
m_sound->Play(SOUND_ALARM, SoundRand(), 0.1f+Math::Rand()*0.1f);
|
|
|
|
|
m_partiTime[i] = 2.0f+Math::Rand()*4.0f;
|
|
|
|
|
}
|
|
|
|
|
if ( ii == 3 )
|
|
|
|
|
{
|
|
|
|
|
m_sound->Play(SOUND_INFO, SoundRand(), 0.1f+Math::Rand()*0.1f);
|
|
|
|
|
m_partiTime[i] = 2.0f+Math::Rand()*4.0f;
|
|
|
|
|
}
|
|
|
|
|
if ( ii == 4 )
|
|
|
|
|
{
|
|
|
|
|
m_sound->Play(SOUND_RADAR, SoundRand(), 0.2f+Math::Rand()*0.2f);
|
|
|
|
|
m_partiTime[i] = 0.5f+Math::Rand()*1.0f;
|
|
|
|
|
}
|
|
|
|
|
if ( ii == 5 )
|
|
|
|
|
{
|
|
|
|
|
m_sound->Play(SOUND_GFLAT, SoundRand(), 0.3f+Math::Rand()*0.3f);
|
|
|
|
|
m_partiTime[i] = 2.0f+Math::Rand()*4.0f;
|
|
|
|
|
}
|
|
|
|
|
if ( ii == 6 )
|
|
|
|
|
{
|
|
|
|
|
m_sound->Play(SOUND_ALARMt, SoundRand(), 0.1f+Math::Rand()*0.1f);
|
|
|
|
|
m_partiTime[i] = 2.0f+Math::Rand()*4.0f;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if ( m_partiPhase[i] != 0 ) // generates?
|
|
|
|
|
{
|
|
|
|
|
m_partiTime[i] -= rTime;
|
|
|
|
|
if ( m_partiTime[i] > 0.0f )
|
|
|
|
|
{
|
|
|
|
|
if ( m_partiPhase[i] == 1 ) // sparks?
|
|
|
|
|
{
|
|
|
|
|
pos.x = m_partiPos[i].x;
|
|
|
|
|
pos.y = m_partiPos[i].y;
|
|
|
|
|
pos.z = 0.0f;
|
|
|
|
|
pos.x += (Math::Rand()-0.5f)*0.01f;
|
|
|
|
|
pos.y += (Math::Rand()-0.5f)*0.01f;
|
|
|
|
|
speed.x = (Math::Rand()-0.5f)*0.2f;
|
|
|
|
|
speed.y = (Math::Rand()-0.5f)*0.2f;
|
|
|
|
|
speed.z = 0.0f;
|
|
|
|
|
dim.x = 0.005f+Math::Rand()*0.005f;
|
|
|
|
|
dim.y = dim.x/0.75f;
|
2012-09-15 19:47:19 +00:00
|
|
|
|
m_particle->CreateParticle(pos, speed, dim, Gfx::PARTIBLITZ,
|
2012-09-29 21:52:30 +00:00
|
|
|
|
Math::Rand()*0.2f+0.2f, 0.0f, 0.0f,
|
|
|
|
|
Gfx::SH_INTERFACE);
|
2012-06-26 20:23:05 +00:00
|
|
|
|
pos.x = m_partiPos[i].x;
|
|
|
|
|
pos.y = m_partiPos[i].y;
|
|
|
|
|
pos.z = 0.0f;
|
|
|
|
|
speed.x = (Math::Rand()-0.5f)*0.5f;
|
|
|
|
|
speed.y = (0.3f+Math::Rand()*0.3f);
|
|
|
|
|
speed.z = 0.0f;
|
|
|
|
|
dim.x = 0.01f+Math::Rand()*0.01f;
|
|
|
|
|
dim.y = dim.x/0.75f;
|
2012-09-15 19:47:19 +00:00
|
|
|
|
m_particle->CreateParticle(pos, speed, dim,
|
2012-09-29 21:52:30 +00:00
|
|
|
|
static_cast<Gfx::ParticleType>(Gfx::PARTILENS1+rand()%3),
|
|
|
|
|
Math::Rand()*0.5f+0.5f, 2.0f, 0.0f,
|
|
|
|
|
Gfx::SH_INTERFACE);
|
2012-06-26 20:23:05 +00:00
|
|
|
|
}
|
|
|
|
|
if ( m_partiPhase[i] == 2 ) // sparks?
|
|
|
|
|
{
|
|
|
|
|
pos.x = m_partiPos[i].x;
|
|
|
|
|
pos.y = m_partiPos[i].y;
|
|
|
|
|
pos.z = 0.0f;
|
|
|
|
|
pos.x += (Math::Rand()-0.5f)*0.01f;
|
|
|
|
|
pos.y += (Math::Rand()-0.5f)*0.01f;
|
|
|
|
|
speed.x = (Math::Rand()-0.5f)*0.2f;
|
|
|
|
|
speed.y = (Math::Rand()-0.5f)*0.2f;
|
|
|
|
|
speed.z = 0.0f;
|
|
|
|
|
dim.x = 0.005f+Math::Rand()*0.005f;
|
|
|
|
|
dim.y = dim.x/0.75f;
|
2012-09-15 19:47:19 +00:00
|
|
|
|
m_particle->CreateParticle(pos, speed, dim, Gfx::PARTIBLITZ,
|
2012-09-29 21:52:30 +00:00
|
|
|
|
Math::Rand()*0.2f+0.2f, 0.0f, 0.0f,
|
|
|
|
|
Gfx::SH_INTERFACE);
|
2012-06-26 20:23:05 +00:00
|
|
|
|
pos.x = m_partiPos[i].x;
|
|
|
|
|
pos.y = m_partiPos[i].y;
|
|
|
|
|
pos.z = 0.0f;
|
|
|
|
|
speed.x = (Math::Rand()-0.5f)*0.5f;
|
|
|
|
|
speed.y = (0.3f+Math::Rand()*0.3f);
|
|
|
|
|
speed.z = 0.0f;
|
|
|
|
|
dim.x = 0.005f+Math::Rand()*0.005f;
|
|
|
|
|
dim.y = dim.x/0.75f;
|
2012-09-15 19:47:19 +00:00
|
|
|
|
m_particle->CreateParticle(pos, speed, dim, Gfx::PARTISCRAPS,
|
2012-09-29 21:52:30 +00:00
|
|
|
|
Math::Rand()*0.5f+0.5f, 2.0f, 0.0f,
|
|
|
|
|
Gfx::SH_INTERFACE);
|
2012-06-26 20:23:05 +00:00
|
|
|
|
}
|
|
|
|
|
if ( m_partiPhase[i] == 3 ) // smoke?
|
|
|
|
|
{
|
|
|
|
|
pos.x = m_partiPos[i].x;
|
|
|
|
|
pos.y = m_partiPos[i].y;
|
|
|
|
|
pos.z = 0.0f;
|
|
|
|
|
pos.x += (Math::Rand()-0.5f)*0.03f;
|
|
|
|
|
pos.y += (Math::Rand()-0.5f)*0.03f;
|
|
|
|
|
speed.x = (Math::Rand()-0.5f)*0.2f;
|
|
|
|
|
speed.y = Math::Rand()*0.5f;
|
|
|
|
|
speed.z = 0.0f;
|
|
|
|
|
dim.x = 0.03f+Math::Rand()*0.07f;
|
|
|
|
|
dim.y = dim.x/0.75f;
|
2012-09-15 19:47:19 +00:00
|
|
|
|
m_particle->CreateParticle(pos, speed, dim, Gfx::PARTICRASH,
|
2012-09-29 21:52:30 +00:00
|
|
|
|
Math::Rand()*0.4f+0.4f, 0.0f, 0.0f,
|
|
|
|
|
Gfx::SH_INTERFACE);
|
2012-06-26 20:23:05 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
m_partiPhase[i] = 0;
|
|
|
|
|
m_partiTime[i] = 2.0f+Math::Rand()*4.0f;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
2012-09-29 21:52:30 +00:00
|
|
|
|
// #endif
|
2012-06-26 20:23:05 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Some nice particles following the mouse.
|
|
|
|
|
|
2012-09-15 19:47:19 +00:00
|
|
|
|
void CMainDialog::NiceParticle(Math::Point mouse, bool bPress)
|
2012-06-26 20:23:05 +00:00
|
|
|
|
{
|
|
|
|
|
Math::Vector pos, speed;
|
|
|
|
|
Math::Point dim;
|
|
|
|
|
|
|
|
|
|
if ( !m_bRain ) return;
|
|
|
|
|
if ( (m_phase == PHASE_SIMUL ||
|
2012-09-29 21:52:30 +00:00
|
|
|
|
m_phase == PHASE_WIN ||
|
|
|
|
|
m_phase == PHASE_LOST ||
|
|
|
|
|
m_phase == PHASE_MODEL ) &&
|
|
|
|
|
!m_bDialog ) return;
|
2012-06-26 20:23:05 +00:00
|
|
|
|
|
|
|
|
|
if ( bPress )
|
|
|
|
|
{
|
|
|
|
|
pos.x = mouse.x;
|
|
|
|
|
pos.y = mouse.y;
|
|
|
|
|
pos.z = 0.0f;
|
|
|
|
|
speed.x = (Math::Rand()-0.5f)*0.5f;
|
|
|
|
|
speed.y = (0.3f+Math::Rand()*0.3f);
|
|
|
|
|
speed.z = 0.0f;
|
|
|
|
|
dim.x = 0.005f+Math::Rand()*0.005f;
|
|
|
|
|
dim.y = dim.x/0.75f;
|
2012-09-15 19:47:19 +00:00
|
|
|
|
m_particle->CreateParticle(pos, speed, dim, Gfx::PARTISCRAPS,
|
2012-09-29 21:52:30 +00:00
|
|
|
|
Math::Rand()*0.5f+0.5f, 2.0f, 0.0f,
|
|
|
|
|
Gfx::SH_INTERFACE);
|
2012-06-26 20:23:05 +00:00
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
pos.x = mouse.x;
|
|
|
|
|
pos.y = mouse.y;
|
|
|
|
|
pos.z = 0.0f;
|
|
|
|
|
speed.x = (Math::Rand()-0.5f)*0.5f;
|
|
|
|
|
speed.y = (0.3f+Math::Rand()*0.3f);
|
|
|
|
|
speed.z = 0.0f;
|
|
|
|
|
dim.x = 0.01f+Math::Rand()*0.01f;
|
|
|
|
|
dim.y = dim.x/0.75f;
|
2012-09-15 19:47:19 +00:00
|
|
|
|
m_particle->CreateParticle(pos, speed, dim,
|
2012-09-29 21:52:30 +00:00
|
|
|
|
static_cast<Gfx::ParticleType>(Gfx::PARTILENS1+rand()%3),
|
|
|
|
|
Math::Rand()*0.5f+0.5f, 2.0f, 0.0f,
|
|
|
|
|
Gfx::SH_INTERFACE);
|
2012-06-26 20:23:05 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Built the default descriptive name of a mission.
|
|
|
|
|
|
2015-07-18 17:43:22 +00:00
|
|
|
|
void CMainDialog::BuildResumeName(char *filename, std::string base, int chap, int rank)
|
2012-06-26 20:23:05 +00:00
|
|
|
|
{
|
2015-07-18 17:43:22 +00:00
|
|
|
|
sprintf(filename, "%s %d.%d", base.c_str(), chap, rank);
|
2012-06-26 20:23:05 +00:00
|
|
|
|
}
|
|
|
|
|
|
2012-09-20 18:37:37 +00:00
|
|
|
|
// Returns the name of the file or save the files.
|
2012-06-26 20:23:05 +00:00
|
|
|
|
|
2012-09-26 20:57:43 +00:00
|
|
|
|
std::string & CMainDialog::GetFilesDir()
|
2012-06-26 20:23:05 +00:00
|
|
|
|
{
|
|
|
|
|
return m_filesDir;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Updates the list of players after checking the files on disk.
|
|
|
|
|
|
|
|
|
|
void CMainDialog::ReadNameList()
|
|
|
|
|
{
|
2014-11-10 16:37:34 +00:00
|
|
|
|
CWindow* pw = static_cast<CWindow*>(m_interface->SearchControl(EVENT_WINDOW5));
|
|
|
|
|
if (pw == nullptr) return;
|
|
|
|
|
CList* pl = static_cast<CList*>(pw->SearchControl(EVENT_INTERFACE_NLIST));
|
|
|
|
|
if (pl == nullptr) return;
|
2012-06-26 20:23:05 +00:00
|
|
|
|
pl->Flush();
|
2012-06-26 21:01:17 +00:00
|
|
|
|
|
2014-11-10 16:37:34 +00:00
|
|
|
|
auto userSaveDirs = CResourceManager::ListDirectories(m_savegameDir);
|
|
|
|
|
for (int i = 0; i < static_cast<int>(userSaveDirs.size()); ++i)
|
2012-09-29 21:52:30 +00:00
|
|
|
|
{
|
2014-11-10 16:37:34 +00:00
|
|
|
|
pl->SetItemName(i, userSaveDirs.at(i).c_str());
|
2012-06-26 20:23:05 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Updates the controls of the players.
|
|
|
|
|
|
|
|
|
|
void CMainDialog::UpdateNameControl()
|
|
|
|
|
{
|
|
|
|
|
CWindow* pw;
|
|
|
|
|
CList* pl;
|
|
|
|
|
CButton* pb;
|
|
|
|
|
CEdit* pe;
|
|
|
|
|
char name[100];
|
|
|
|
|
int total, sel;
|
|
|
|
|
|
2012-09-18 20:33:28 +00:00
|
|
|
|
pw = static_cast<CWindow*>(m_interface->SearchControl(EVENT_WINDOW5));
|
2012-06-26 20:23:05 +00:00
|
|
|
|
if ( pw == 0 ) return;
|
2012-09-18 20:33:28 +00:00
|
|
|
|
pl = static_cast<CList*>(pw->SearchControl(EVENT_INTERFACE_NLIST));
|
2012-06-26 20:23:05 +00:00
|
|
|
|
if ( pl == 0 ) return;
|
2012-09-18 20:33:28 +00:00
|
|
|
|
pe = static_cast<CEdit*>(pw->SearchControl(EVENT_INTERFACE_NEDIT));
|
2012-06-26 20:23:05 +00:00
|
|
|
|
if ( pe == 0 ) return;
|
|
|
|
|
|
2015-07-18 21:14:20 +00:00
|
|
|
|
std::string gamer = m_main->GetPlayerProgress()->GetName();
|
2012-09-15 19:47:19 +00:00
|
|
|
|
total = pl->GetTotal();
|
|
|
|
|
sel = pl->GetSelect();
|
2012-06-26 20:23:05 +00:00
|
|
|
|
pe->GetText(name, 100);
|
|
|
|
|
|
2012-09-18 20:33:28 +00:00
|
|
|
|
pb = static_cast<CButton*>(pw->SearchControl(EVENT_INTERFACE_NCANCEL));
|
2012-06-26 20:23:05 +00:00
|
|
|
|
if ( pb != 0 )
|
|
|
|
|
{
|
2015-07-18 21:14:20 +00:00
|
|
|
|
pb->SetState(STATE_ENABLE, !gamer.empty());
|
2012-06-26 20:23:05 +00:00
|
|
|
|
}
|
|
|
|
|
|
2012-09-18 20:33:28 +00:00
|
|
|
|
pb = static_cast<CButton*>(pw->SearchControl(EVENT_INTERFACE_NDELETE));
|
2012-06-26 20:23:05 +00:00
|
|
|
|
if ( pb != 0 )
|
|
|
|
|
{
|
|
|
|
|
pb->SetState(STATE_ENABLE, total>0 && sel!=-1);
|
|
|
|
|
}
|
|
|
|
|
|
2012-09-18 20:33:28 +00:00
|
|
|
|
pb = static_cast<CButton*>(pw->SearchControl(EVENT_INTERFACE_NOK));
|
2012-06-26 20:23:05 +00:00
|
|
|
|
if ( pb != 0 )
|
|
|
|
|
{
|
|
|
|
|
pb->SetState(STATE_ENABLE, name[0]!=0 || sel!=-1);
|
|
|
|
|
}
|
|
|
|
|
|
2012-09-18 20:33:28 +00:00
|
|
|
|
pb = static_cast<CButton*>(pw->SearchControl(EVENT_INTERFACE_PERSO));
|
2012-06-26 20:23:05 +00:00
|
|
|
|
if ( pb != 0 )
|
|
|
|
|
{
|
|
|
|
|
pb->SetState(STATE_ENABLE, name[0]!=0 || sel!=-1);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Updates the list of players by name frape.
|
|
|
|
|
|
|
|
|
|
void CMainDialog::UpdateNameList()
|
|
|
|
|
{
|
|
|
|
|
CWindow* pw;
|
|
|
|
|
CList* pl;
|
|
|
|
|
CEdit* pe;
|
|
|
|
|
char name[100];
|
2012-09-18 20:33:28 +00:00
|
|
|
|
int total, i;
|
2012-06-26 20:23:05 +00:00
|
|
|
|
|
2012-09-18 20:33:28 +00:00
|
|
|
|
pw = static_cast<CWindow*>(m_interface->SearchControl(EVENT_WINDOW5));
|
2012-06-26 20:23:05 +00:00
|
|
|
|
if ( pw == 0 ) return;
|
2012-09-18 20:33:28 +00:00
|
|
|
|
pl = static_cast<CList*>(pw->SearchControl(EVENT_INTERFACE_NLIST));
|
2012-06-26 20:23:05 +00:00
|
|
|
|
if ( pl == 0 ) return;
|
2012-09-18 20:33:28 +00:00
|
|
|
|
pe = static_cast<CEdit*>(pw->SearchControl(EVENT_INTERFACE_NEDIT));
|
2012-06-26 20:23:05 +00:00
|
|
|
|
if ( pe == 0 ) return;
|
|
|
|
|
|
|
|
|
|
pe->GetText(name, 100);
|
2012-09-15 19:47:19 +00:00
|
|
|
|
total = pl->GetTotal();
|
2012-06-26 20:23:05 +00:00
|
|
|
|
|
|
|
|
|
for ( i=0 ; i<total ; i++ )
|
|
|
|
|
{
|
2012-09-15 19:47:19 +00:00
|
|
|
|
// TODO: stricmp?
|
2013-05-26 15:45:15 +00:00
|
|
|
|
if ( strcmp(name, pl->GetItemName(i)) == 0 )
|
2012-06-26 20:23:05 +00:00
|
|
|
|
{
|
|
|
|
|
pl->SetSelect(i);
|
|
|
|
|
pl->ShowSelect(false);
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
pl->SetSelect(-1);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Updates the player's name and function of the selected list.
|
|
|
|
|
|
|
|
|
|
void CMainDialog::UpdateNameEdit()
|
|
|
|
|
{
|
|
|
|
|
CWindow* pw;
|
|
|
|
|
CList* pl;
|
|
|
|
|
CEdit* pe;
|
|
|
|
|
char* name;
|
|
|
|
|
int sel;
|
|
|
|
|
|
2012-09-18 20:33:28 +00:00
|
|
|
|
pw = static_cast<CWindow*>(m_interface->SearchControl(EVENT_WINDOW5));
|
2012-06-26 20:23:05 +00:00
|
|
|
|
if ( pw == 0 ) return;
|
2012-09-18 20:33:28 +00:00
|
|
|
|
pl = static_cast<CList*>(pw->SearchControl(EVENT_INTERFACE_NLIST));
|
2012-06-26 20:23:05 +00:00
|
|
|
|
if ( pl == 0 ) return;
|
2012-09-18 20:33:28 +00:00
|
|
|
|
pe = static_cast<CEdit*>(pw->SearchControl(EVENT_INTERFACE_NEDIT));
|
2012-06-26 20:23:05 +00:00
|
|
|
|
if ( pe == 0 ) return;
|
|
|
|
|
|
2012-09-15 19:47:19 +00:00
|
|
|
|
sel = pl->GetSelect();
|
2012-06-26 20:23:05 +00:00
|
|
|
|
if ( sel == -1 )
|
|
|
|
|
{
|
|
|
|
|
pe->SetText("");
|
|
|
|
|
pe->SetCursor(0, 0);
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
2013-05-26 15:45:15 +00:00
|
|
|
|
name = pl->GetItemName(sel);
|
2012-06-26 20:23:05 +00:00
|
|
|
|
pe->SetText(name);
|
|
|
|
|
pe->SetCursor(strlen(name), 0);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
UpdateNameControl();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Selects a player.
|
|
|
|
|
|
|
|
|
|
void CMainDialog::NameSelect()
|
|
|
|
|
{
|
|
|
|
|
CWindow* pw;
|
|
|
|
|
CList* pl;
|
|
|
|
|
CEdit* pe;
|
|
|
|
|
char name[100];
|
|
|
|
|
int sel;
|
|
|
|
|
|
2012-09-18 20:33:28 +00:00
|
|
|
|
pw = static_cast<CWindow*>(m_interface->SearchControl(EVENT_WINDOW5));
|
2012-06-26 20:23:05 +00:00
|
|
|
|
if ( pw == 0 ) return;
|
2012-09-18 20:33:28 +00:00
|
|
|
|
pl = static_cast<CList*>(pw->SearchControl(EVENT_INTERFACE_NLIST));
|
2012-06-26 20:23:05 +00:00
|
|
|
|
if ( pl == 0 ) return;
|
2012-09-18 20:33:28 +00:00
|
|
|
|
pe = static_cast<CEdit*>(pw->SearchControl(EVENT_INTERFACE_NEDIT));
|
2012-06-26 20:23:05 +00:00
|
|
|
|
if ( pe == 0 ) return;
|
|
|
|
|
|
|
|
|
|
pe->GetText(name, 100);
|
2012-09-15 19:47:19 +00:00
|
|
|
|
sel = pl->GetSelect();
|
2012-06-26 20:23:05 +00:00
|
|
|
|
|
|
|
|
|
if ( sel == -1 )
|
|
|
|
|
{
|
|
|
|
|
NameCreate();
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
2015-07-18 21:14:20 +00:00
|
|
|
|
m_main->SelectPlayer(pl->GetItemName(sel));
|
2012-06-26 20:23:05 +00:00
|
|
|
|
}
|
|
|
|
|
|
2015-07-18 21:14:20 +00:00
|
|
|
|
m_main->ChangePhase(PHASE_INIT);
|
2012-06-26 20:23:05 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Creates a new player.
|
|
|
|
|
|
2015-07-18 21:14:20 +00:00
|
|
|
|
bool CMainDialog::NameCreate()
|
2012-06-26 20:23:05 +00:00
|
|
|
|
{
|
|
|
|
|
CWindow* pw;
|
|
|
|
|
CEdit* pe;
|
|
|
|
|
char name[100];
|
|
|
|
|
char c;
|
|
|
|
|
int len, i, j;
|
|
|
|
|
|
2014-10-19 11:18:31 +00:00
|
|
|
|
GetLogger()->Info("Creating new player\n");
|
2012-09-18 20:33:28 +00:00
|
|
|
|
pw = static_cast<CWindow*>(m_interface->SearchControl(EVENT_WINDOW5));
|
2015-07-18 21:14:20 +00:00
|
|
|
|
if ( pw == 0 ) return false;
|
2012-09-18 20:33:28 +00:00
|
|
|
|
pe = static_cast<CEdit*>(pw->SearchControl(EVENT_INTERFACE_NEDIT));
|
2015-07-18 21:14:20 +00:00
|
|
|
|
if ( pe == 0 ) return false;
|
2012-06-26 20:23:05 +00:00
|
|
|
|
|
|
|
|
|
pe->GetText(name, 100);
|
|
|
|
|
if ( name[0] == 0 )
|
|
|
|
|
{
|
|
|
|
|
m_sound->Play(SOUND_TZOING);
|
2015-07-18 21:14:20 +00:00
|
|
|
|
return false;
|
2012-06-26 20:23:05 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
len = strlen(name);
|
|
|
|
|
j = 0;
|
|
|
|
|
for ( i=0 ; i<len ; i++ )
|
|
|
|
|
{
|
2012-09-15 19:47:19 +00:00
|
|
|
|
c = GetNoAccent(GetToLower(name[i]));
|
2012-06-26 20:23:05 +00:00
|
|
|
|
if ( (c >= '0' && c <= '9') ||
|
|
|
|
|
(c >= 'a' && c <= 'z') ||
|
|
|
|
|
c == ' ' ||
|
|
|
|
|
c == '-' ||
|
|
|
|
|
c == '_' ||
|
|
|
|
|
c == '.' ||
|
|
|
|
|
c == ',' ||
|
|
|
|
|
c == '\'' )
|
|
|
|
|
{
|
|
|
|
|
name[j++] = name[i];
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
name[j] = 0;
|
|
|
|
|
if ( j == 0 )
|
|
|
|
|
{
|
|
|
|
|
m_sound->Play(SOUND_TZOING);
|
2015-07-18 21:14:20 +00:00
|
|
|
|
return false;
|
2012-06-26 20:23:05 +00:00
|
|
|
|
}
|
|
|
|
|
|
2015-07-18 21:14:20 +00:00
|
|
|
|
m_main->SelectPlayer(name);
|
2012-06-26 20:23:05 +00:00
|
|
|
|
|
2015-07-18 21:14:20 +00:00
|
|
|
|
return true;
|
2012-06-26 20:23:05 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Removes a player.
|
|
|
|
|
|
|
|
|
|
void CMainDialog::NameDelete()
|
|
|
|
|
{
|
2014-11-10 16:37:34 +00:00
|
|
|
|
CWindow* pw = static_cast<CWindow*>(m_interface->SearchControl(EVENT_WINDOW5));
|
|
|
|
|
if (pw == nullptr) return;
|
|
|
|
|
CList* pl = static_cast<CList*>(pw->SearchControl(EVENT_INTERFACE_NLIST));
|
|
|
|
|
if (pl == nullptr) return;
|
2012-06-26 20:23:05 +00:00
|
|
|
|
|
2014-11-10 16:37:34 +00:00
|
|
|
|
int sel = pl->GetSelect();
|
|
|
|
|
if (sel == -1)
|
2012-06-26 20:23:05 +00:00
|
|
|
|
{
|
|
|
|
|
m_sound->Play(SOUND_TZOING);
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
2014-11-10 16:37:34 +00:00
|
|
|
|
char* gamer = pl->GetItemName(sel);
|
|
|
|
|
|
2015-07-18 21:14:20 +00:00
|
|
|
|
m_main->SelectPlayer(gamer);
|
|
|
|
|
if (!m_main->GetPlayerProgress()->Delete())
|
2012-06-26 20:23:05 +00:00
|
|
|
|
{
|
|
|
|
|
m_sound->Play(SOUND_TZOING);
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
pl->SetSelect(-1);
|
|
|
|
|
|
|
|
|
|
ReadNameList();
|
|
|
|
|
UpdateNameList();
|
|
|
|
|
UpdateNameControl();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// ests whether two colors are equal or nearly are.
|
|
|
|
|
|
2012-09-15 19:47:19 +00:00
|
|
|
|
bool EqColor(const Gfx::Color &c1, const Gfx::Color &c2)
|
2012-06-26 20:23:05 +00:00
|
|
|
|
{
|
|
|
|
|
return (fabs(c1.r-c2.r) < 0.01f &&
|
|
|
|
|
fabs(c1.g-c2.g) < 0.01f &&
|
|
|
|
|
fabs(c1.b-c2.b) < 0.01f );
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Updates all the buttons for the character.
|
|
|
|
|
|
|
|
|
|
void CMainDialog::UpdatePerso()
|
|
|
|
|
{
|
|
|
|
|
CWindow* pw;
|
|
|
|
|
CLabel* pl;
|
|
|
|
|
CButton* pb;
|
|
|
|
|
CColor* pc;
|
|
|
|
|
CSlider* ps;
|
2012-09-15 19:47:19 +00:00
|
|
|
|
Gfx::Color color;
|
2013-12-02 23:11:26 +00:00
|
|
|
|
std::string name;
|
2012-06-26 20:23:05 +00:00
|
|
|
|
int i;
|
|
|
|
|
|
2015-07-18 21:14:20 +00:00
|
|
|
|
PlayerApperance& apperance = m_main->GetPlayerProgress()->GetApperance();
|
|
|
|
|
|
2012-09-18 20:33:28 +00:00
|
|
|
|
pw = static_cast<CWindow*>(m_interface->SearchControl(EVENT_WINDOW5));
|
2012-06-26 20:23:05 +00:00
|
|
|
|
if ( pw == 0 ) return;
|
|
|
|
|
|
2012-09-18 20:33:28 +00:00
|
|
|
|
pb = static_cast<CButton*>(pw->SearchControl(EVENT_INTERFACE_PHEAD));
|
2012-06-26 20:23:05 +00:00
|
|
|
|
if ( pb != 0 )
|
|
|
|
|
{
|
2015-07-18 21:14:20 +00:00
|
|
|
|
pb->SetState(STATE_CHECK, m_apperanceTab==0);
|
2012-06-26 20:23:05 +00:00
|
|
|
|
}
|
2012-09-18 20:33:28 +00:00
|
|
|
|
pb = static_cast<CButton*>(pw->SearchControl(EVENT_INTERFACE_PBODY));
|
2012-06-26 20:23:05 +00:00
|
|
|
|
if ( pb != 0 )
|
|
|
|
|
{
|
2015-07-18 21:14:20 +00:00
|
|
|
|
pb->SetState(STATE_CHECK, m_apperanceTab==1);
|
2012-06-26 20:23:05 +00:00
|
|
|
|
}
|
|
|
|
|
|
2012-09-18 20:33:28 +00:00
|
|
|
|
pl = static_cast<CLabel*>(pw->SearchControl(EVENT_LABEL11));
|
2012-06-26 20:23:05 +00:00
|
|
|
|
if ( pl != 0 )
|
|
|
|
|
{
|
2015-07-18 21:14:20 +00:00
|
|
|
|
if ( m_apperanceTab == 0 )
|
2012-06-26 20:23:05 +00:00
|
|
|
|
{
|
|
|
|
|
pl->SetState(STATE_VISIBLE);
|
|
|
|
|
GetResource(RES_TEXT, RT_PERSO_FACE, name);
|
|
|
|
|
pl->SetName(name);
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
pl->ClearState(STATE_VISIBLE);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2012-09-18 20:33:28 +00:00
|
|
|
|
pl = static_cast<CLabel*>(pw->SearchControl(EVENT_LABEL12));
|
2012-06-26 20:23:05 +00:00
|
|
|
|
if ( pl != 0 )
|
|
|
|
|
{
|
2015-07-18 21:14:20 +00:00
|
|
|
|
if ( m_apperanceTab == 0 )
|
2012-06-26 20:23:05 +00:00
|
|
|
|
{
|
|
|
|
|
pl->SetState(STATE_VISIBLE);
|
|
|
|
|
GetResource(RES_TEXT, RT_PERSO_GLASSES, name);
|
|
|
|
|
pl->SetName(name);
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
pl->ClearState(STATE_VISIBLE);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2012-09-18 20:33:28 +00:00
|
|
|
|
pl = static_cast<CLabel*>(pw->SearchControl(EVENT_LABEL13));
|
2012-06-26 20:23:05 +00:00
|
|
|
|
if ( pl != 0 )
|
|
|
|
|
{
|
2015-07-18 21:14:20 +00:00
|
|
|
|
if ( m_apperanceTab == 0 ) GetResource(RES_TEXT, RT_PERSO_HAIR, name);
|
2012-06-26 20:23:05 +00:00
|
|
|
|
else GetResource(RES_TEXT, RT_PERSO_BAND, name);
|
|
|
|
|
pl->SetName(name);
|
|
|
|
|
}
|
|
|
|
|
|
2012-09-18 20:33:28 +00:00
|
|
|
|
pl = static_cast<CLabel*>(pw->SearchControl(EVENT_LABEL14));
|
2012-06-26 20:23:05 +00:00
|
|
|
|
if ( pl != 0 )
|
|
|
|
|
{
|
2015-07-18 21:14:20 +00:00
|
|
|
|
if ( m_apperanceTab == 0 )
|
2012-06-26 20:23:05 +00:00
|
|
|
|
{
|
|
|
|
|
pl->ClearState(STATE_VISIBLE);
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
pl->SetState(STATE_VISIBLE);
|
|
|
|
|
GetResource(RES_TEXT, RT_PERSO_COMBI, name);
|
|
|
|
|
pl->SetName(name);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
for ( i=0 ; i<4 ; i++ )
|
|
|
|
|
{
|
2012-09-18 20:33:28 +00:00
|
|
|
|
pb = static_cast<CButton*>(pw->SearchControl(static_cast<EventType>(EVENT_INTERFACE_PFACE1+i)));
|
2012-06-26 20:23:05 +00:00
|
|
|
|
if ( pb == 0 ) break;
|
2015-07-18 21:14:20 +00:00
|
|
|
|
pb->SetState(STATE_VISIBLE, m_apperanceTab==0);
|
|
|
|
|
pb->SetState(STATE_CHECK, i==apperance.face);
|
2012-06-26 20:23:05 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
for ( i=0 ; i<10 ; i++ )
|
|
|
|
|
{
|
2012-09-18 20:33:28 +00:00
|
|
|
|
pb = static_cast<CButton*>(pw->SearchControl(static_cast<EventType>(EVENT_INTERFACE_PGLASS0+i)));
|
2012-06-26 20:23:05 +00:00
|
|
|
|
if ( pb == 0 ) break;
|
2015-07-18 21:14:20 +00:00
|
|
|
|
pb->SetState(STATE_VISIBLE, m_apperanceTab==0);
|
|
|
|
|
pb->SetState(STATE_CHECK, i==apperance.glasses);
|
2012-06-26 20:23:05 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
for ( i=0 ; i<3*3 ; i++ )
|
|
|
|
|
{
|
2012-09-18 20:33:28 +00:00
|
|
|
|
pc = static_cast<CColor*>(pw->SearchControl(static_cast<EventType>(EVENT_INTERFACE_PC0a+i)));
|
2012-06-26 20:23:05 +00:00
|
|
|
|
if ( pc == 0 ) break;
|
2015-07-18 21:14:20 +00:00
|
|
|
|
if ( m_apperanceTab == 0 )
|
2012-06-26 20:23:05 +00:00
|
|
|
|
{
|
|
|
|
|
pc->ClearState(STATE_VISIBLE);
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
pc->SetState(STATE_VISIBLE);
|
|
|
|
|
color.r = perso_color[3*10*1+3*i+0]/255.0f;
|
|
|
|
|
color.g = perso_color[3*10*1+3*i+1]/255.0f;
|
|
|
|
|
color.b = perso_color[3*10*1+3*i+2]/255.0f;
|
|
|
|
|
color.a = 0.0f;
|
|
|
|
|
pc->SetColor(color);
|
2015-07-18 21:14:20 +00:00
|
|
|
|
pc->SetState(STATE_CHECK, EqColor(color, apperance.colorCombi));
|
2012-06-26 20:23:05 +00:00
|
|
|
|
}
|
|
|
|
|
|
2012-09-18 20:33:28 +00:00
|
|
|
|
pc = static_cast<CColor*>(pw->SearchControl(static_cast<EventType>(EVENT_INTERFACE_PC0b+i)));
|
2012-06-26 20:23:05 +00:00
|
|
|
|
if ( pc == 0 ) break;
|
2015-07-18 21:14:20 +00:00
|
|
|
|
color.r = perso_color[3*10*2*m_apperanceTab+3*i+0]/255.0f;
|
|
|
|
|
color.g = perso_color[3*10*2*m_apperanceTab+3*i+1]/255.0f;
|
|
|
|
|
color.b = perso_color[3*10*2*m_apperanceTab+3*i+2]/255.0f;
|
2012-06-26 20:23:05 +00:00
|
|
|
|
color.a = 0.0f;
|
|
|
|
|
pc->SetColor(color);
|
2015-07-18 21:14:20 +00:00
|
|
|
|
pc->SetState(STATE_CHECK, EqColor(color, m_apperanceTab?apperance.colorBand:apperance.colorHair));
|
2012-06-26 20:23:05 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
for ( i=0 ; i<3 ; i++ )
|
|
|
|
|
{
|
2012-09-18 20:33:28 +00:00
|
|
|
|
ps = static_cast<CSlider*>(pw->SearchControl(static_cast<EventType>(EVENT_INTERFACE_PCRa+i)));
|
2012-06-26 20:23:05 +00:00
|
|
|
|
if ( ps == 0 ) break;
|
2015-07-18 21:14:20 +00:00
|
|
|
|
ps->SetState(STATE_VISIBLE, m_apperanceTab==1);
|
2012-06-26 20:23:05 +00:00
|
|
|
|
}
|
|
|
|
|
|
2015-07-18 21:14:20 +00:00
|
|
|
|
if ( m_apperanceTab == 1 )
|
2012-06-26 20:23:05 +00:00
|
|
|
|
{
|
2015-07-18 21:14:20 +00:00
|
|
|
|
color = apperance.colorCombi;
|
2012-09-18 20:33:28 +00:00
|
|
|
|
ps = static_cast<CSlider*>(pw->SearchControl(EVENT_INTERFACE_PCRa));
|
2012-06-26 20:23:05 +00:00
|
|
|
|
if ( ps != 0 ) ps->SetVisibleValue(color.r*255.0f);
|
2012-09-18 20:33:28 +00:00
|
|
|
|
ps = static_cast<CSlider*>(pw->SearchControl(EVENT_INTERFACE_PCGa));
|
2012-06-26 20:23:05 +00:00
|
|
|
|
if ( ps != 0 ) ps->SetVisibleValue(color.g*255.0f);
|
2012-09-18 20:33:28 +00:00
|
|
|
|
ps = static_cast<CSlider*>(pw->SearchControl(EVENT_INTERFACE_PCBa));
|
2012-06-26 20:23:05 +00:00
|
|
|
|
if ( ps != 0 ) ps->SetVisibleValue(color.b*255.0f);
|
|
|
|
|
}
|
|
|
|
|
|
2015-07-18 21:14:20 +00:00
|
|
|
|
if ( m_apperanceTab == 0 ) color = apperance.colorHair;
|
|
|
|
|
else color = apperance.colorBand;
|
2012-09-18 20:33:28 +00:00
|
|
|
|
ps = static_cast<CSlider*>(pw->SearchControl(EVENT_INTERFACE_PCRb));
|
2012-06-26 20:23:05 +00:00
|
|
|
|
if ( ps != 0 ) ps->SetVisibleValue(color.r*255.0f);
|
2012-09-18 20:33:28 +00:00
|
|
|
|
ps = static_cast<CSlider*>(pw->SearchControl(EVENT_INTERFACE_PCGb));
|
2012-06-26 20:23:05 +00:00
|
|
|
|
if ( ps != 0 ) ps->SetVisibleValue(color.g*255.0f);
|
2012-09-18 20:33:28 +00:00
|
|
|
|
ps = static_cast<CSlider*>(pw->SearchControl(EVENT_INTERFACE_PCBb));
|
2012-06-26 20:23:05 +00:00
|
|
|
|
if ( ps != 0 ) ps->SetVisibleValue(color.b*255.0f);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Updates the camera for the character.
|
|
|
|
|
|
|
|
|
|
void CMainDialog::CameraPerso()
|
|
|
|
|
{
|
2015-07-18 21:14:20 +00:00
|
|
|
|
if ( m_apperanceTab == 0 )
|
2012-06-26 20:23:05 +00:00
|
|
|
|
{
|
|
|
|
|
//? m_camera->Init(Math::Vector(4.0f, 0.0f, 0.0f),
|
|
|
|
|
//? Math::Vector(0.0f, 0.0f, 1.0f), 0.0f);
|
|
|
|
|
m_camera->Init(Math::Vector(6.0f, 0.0f, 0.0f),
|
|
|
|
|
Math::Vector(0.0f, 0.2f, 1.5f), 0.0f);
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
m_camera->Init(Math::Vector(18.0f, 0.0f, 4.5f),
|
|
|
|
|
Math::Vector(0.0f, 1.6f, 4.5f), 0.0f);
|
|
|
|
|
}
|
|
|
|
|
|
2012-09-15 19:47:19 +00:00
|
|
|
|
m_camera->SetType(Gfx::CAM_TYPE_SCRIPT);
|
2012-06-26 20:23:05 +00:00
|
|
|
|
m_camera->FixCamera();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Sets a fixed color.
|
|
|
|
|
|
|
|
|
|
void CMainDialog::FixPerso(int rank, int index)
|
|
|
|
|
{
|
2015-07-18 21:14:20 +00:00
|
|
|
|
PlayerApperance& apperance = m_main->GetPlayerProgress()->GetApperance();
|
|
|
|
|
if ( m_apperanceTab == 0 )
|
2012-06-26 20:23:05 +00:00
|
|
|
|
{
|
|
|
|
|
if ( index == 1 )
|
|
|
|
|
{
|
2015-07-18 21:14:20 +00:00
|
|
|
|
apperance.colorHair.r = perso_color[3*10*0+rank*3+0]/255.0f;
|
|
|
|
|
apperance.colorHair.g = perso_color[3*10*0+rank*3+1]/255.0f;
|
|
|
|
|
apperance.colorHair.b = perso_color[3*10*0+rank*3+2]/255.0f;
|
2012-06-26 20:23:05 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
2015-07-18 21:14:20 +00:00
|
|
|
|
if ( m_apperanceTab == 1 )
|
2012-06-26 20:23:05 +00:00
|
|
|
|
{
|
|
|
|
|
if ( index == 0 )
|
|
|
|
|
{
|
2015-07-18 21:14:20 +00:00
|
|
|
|
apperance.colorCombi.r = perso_color[3*10*1+rank*3+0]/255.0f;
|
|
|
|
|
apperance.colorCombi.g = perso_color[3*10*1+rank*3+1]/255.0f;
|
|
|
|
|
apperance.colorCombi.b = perso_color[3*10*1+rank*3+2]/255.0f;
|
2012-06-26 20:23:05 +00:00
|
|
|
|
}
|
|
|
|
|
if ( index == 1 )
|
|
|
|
|
{
|
2015-07-18 21:14:20 +00:00
|
|
|
|
apperance.colorBand.r = perso_color[3*10*2+rank*3+0]/255.0f;
|
|
|
|
|
apperance.colorBand.g = perso_color[3*10*2+rank*3+1]/255.0f;
|
|
|
|
|
apperance.colorBand.b = perso_color[3*10*2+rank*3+2]/255.0f;
|
2012-06-26 20:23:05 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Updates the color of the character.
|
|
|
|
|
|
|
|
|
|
void CMainDialog::ColorPerso()
|
|
|
|
|
{
|
|
|
|
|
CWindow* pw;
|
|
|
|
|
CSlider* ps;
|
2012-09-15 19:47:19 +00:00
|
|
|
|
Gfx::Color color;
|
2012-06-26 20:23:05 +00:00
|
|
|
|
|
2015-07-18 21:14:20 +00:00
|
|
|
|
PlayerApperance& apperance = m_main->GetPlayerProgress()->GetApperance();
|
|
|
|
|
|
2012-09-18 20:33:28 +00:00
|
|
|
|
pw = static_cast<CWindow*>(m_interface->SearchControl(EVENT_WINDOW5));
|
2012-06-26 20:23:05 +00:00
|
|
|
|
if ( pw == 0 ) return;
|
|
|
|
|
|
|
|
|
|
color.a = 0.0f;
|
|
|
|
|
|
2012-09-18 20:33:28 +00:00
|
|
|
|
ps = static_cast<CSlider*>(pw->SearchControl(EVENT_INTERFACE_PCRa));
|
2012-09-15 19:47:19 +00:00
|
|
|
|
if ( ps != 0 ) color.r = ps->GetVisibleValue()/255.0f;
|
2012-09-18 20:33:28 +00:00
|
|
|
|
ps = static_cast<CSlider*>(pw->SearchControl(EVENT_INTERFACE_PCGa));
|
2012-09-15 19:47:19 +00:00
|
|
|
|
if ( ps != 0 ) color.g = ps->GetVisibleValue()/255.0f;
|
2012-09-18 20:33:28 +00:00
|
|
|
|
ps = static_cast<CSlider*>(pw->SearchControl(EVENT_INTERFACE_PCBa));
|
2012-09-15 19:47:19 +00:00
|
|
|
|
if ( ps != 0 ) color.b = ps->GetVisibleValue()/255.0f;
|
2015-07-18 21:14:20 +00:00
|
|
|
|
if ( m_apperanceTab == 1 ) apperance.colorCombi = color;
|
2012-06-26 20:23:05 +00:00
|
|
|
|
|
2012-09-18 20:33:28 +00:00
|
|
|
|
ps = static_cast<CSlider*>(pw->SearchControl(EVENT_INTERFACE_PCRb));
|
2012-09-15 19:47:19 +00:00
|
|
|
|
if ( ps != 0 ) color.r = ps->GetVisibleValue()/255.0f;
|
2012-09-18 20:33:28 +00:00
|
|
|
|
ps = static_cast<CSlider*>(pw->SearchControl(EVENT_INTERFACE_PCGb));
|
2012-09-15 19:47:19 +00:00
|
|
|
|
if ( ps != 0 ) color.g = ps->GetVisibleValue()/255.0f;
|
2012-09-18 20:33:28 +00:00
|
|
|
|
ps = static_cast<CSlider*>(pw->SearchControl(EVENT_INTERFACE_PCBb));
|
2012-09-15 19:47:19 +00:00
|
|
|
|
if ( ps != 0 ) color.b = ps->GetVisibleValue()/255.0f;
|
2015-07-18 21:14:20 +00:00
|
|
|
|
if ( m_apperanceTab == 0 ) apperance.colorHair = color;
|
|
|
|
|
else apperance.colorBand = color;
|
2012-06-26 20:23:05 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Indicates if there is at least one backup.
|
|
|
|
|
|
|
|
|
|
bool CMainDialog::IsIOReadScene()
|
|
|
|
|
{
|
2015-07-18 21:14:20 +00:00
|
|
|
|
std::string userSaveDir = m_savegameDir + "/" + m_main->GetPlayerProgress()->GetName();
|
2014-11-10 16:37:34 +00:00
|
|
|
|
auto saveDirs = CResourceManager::ListDirectories(userSaveDir);
|
|
|
|
|
for (auto dir : saveDirs)
|
2013-05-26 15:47:54 +00:00
|
|
|
|
{
|
2014-11-10 16:37:34 +00:00
|
|
|
|
if (CResourceManager::Exists(userSaveDir + "/" + dir + "/" + "data.sav"))
|
2013-05-26 15:47:54 +00:00
|
|
|
|
{
|
2014-11-10 16:37:34 +00:00
|
|
|
|
return true;
|
2013-04-01 16:24:12 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
2013-05-26 15:47:54 +00:00
|
|
|
|
|
2013-04-01 16:24:12 +00:00
|
|
|
|
return false;
|
2012-06-26 20:23:05 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Builds the file name by default.
|
|
|
|
|
|
|
|
|
|
void CMainDialog::IOReadName()
|
|
|
|
|
{
|
|
|
|
|
CWindow* pw;
|
|
|
|
|
CEdit* pe;
|
2015-03-22 13:29:03 +00:00
|
|
|
|
std::string resume;
|
|
|
|
|
char line[100];
|
2012-06-26 20:23:05 +00:00
|
|
|
|
char name[100];
|
|
|
|
|
time_t now;
|
|
|
|
|
|
2012-09-18 20:33:28 +00:00
|
|
|
|
pw = static_cast<CWindow*>(m_interface->SearchControl(EVENT_WINDOW5));
|
2013-04-01 16:24:12 +00:00
|
|
|
|
if ( pw == nullptr ) return;
|
2012-09-18 20:33:28 +00:00
|
|
|
|
pe = static_cast<CEdit*>(pw->SearchControl(EVENT_INTERFACE_IONAME));
|
2013-04-01 16:24:12 +00:00
|
|
|
|
if ( pe == nullptr ) return;
|
2012-06-26 20:23:05 +00:00
|
|
|
|
|
2015-07-18 16:52:37 +00:00
|
|
|
|
resume = std::string(GetLevelCategoryDir(m_category)) + " " + boost::lexical_cast<std::string>(m_chap[m_category]+1);
|
2013-01-02 11:24:26 +00:00
|
|
|
|
|
2015-07-18 16:52:37 +00:00
|
|
|
|
CLevelParser levelParser(m_category, m_chap[m_category]+1, 0);
|
2015-03-22 13:29:03 +00:00
|
|
|
|
try
|
2012-06-26 20:23:05 +00:00
|
|
|
|
{
|
2015-06-21 18:59:23 +00:00
|
|
|
|
levelParser.Load();
|
|
|
|
|
resume = levelParser.Get("Title")->GetParam("resume")->AsString();
|
2015-03-22 13:29:03 +00:00
|
|
|
|
}
|
2015-06-21 18:59:23 +00:00
|
|
|
|
catch (CLevelParserException& e)
|
2015-03-22 13:29:03 +00:00
|
|
|
|
{
|
2015-07-16 19:30:55 +00:00
|
|
|
|
GetLogger()->Warn("%s\n", e.what());
|
2012-06-26 20:23:05 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
time(&now);
|
2013-12-27 21:28:25 +00:00
|
|
|
|
TimeToAsciiClean(now, line);
|
2015-07-18 16:52:37 +00:00
|
|
|
|
sprintf(name, "%s - %s %d", line, resume.c_str(), m_sel[m_category]+1);
|
2015-03-22 13:29:03 +00:00
|
|
|
|
|
2012-06-26 20:23:05 +00:00
|
|
|
|
pe->SetText(name);
|
|
|
|
|
pe->SetCursor(strlen(name), 0);
|
2015-07-15 17:08:45 +00:00
|
|
|
|
m_interface->SetFocus(pe);
|
2012-06-26 20:23:05 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Updates the list of games recorded on disk.
|
|
|
|
|
|
|
|
|
|
void CMainDialog::IOReadList()
|
|
|
|
|
{
|
2014-11-10 16:37:34 +00:00
|
|
|
|
CWindow* pw = static_cast<CWindow*>(m_interface->SearchControl(EVENT_WINDOW5));
|
|
|
|
|
if (pw == nullptr) return;
|
|
|
|
|
CList* pl = static_cast<CList*>(pw->SearchControl(EVENT_INTERFACE_IOLIST));
|
|
|
|
|
if (pl == nullptr) return;
|
2012-06-26 20:23:05 +00:00
|
|
|
|
|
|
|
|
|
pl->Flush();
|
2013-05-26 15:47:54 +00:00
|
|
|
|
|
2013-04-01 16:24:12 +00:00
|
|
|
|
m_saveList.clear();
|
2013-05-26 15:47:54 +00:00
|
|
|
|
|
2015-07-18 21:14:20 +00:00
|
|
|
|
std::string userSaveDir = m_savegameDir + "/" + m_main->GetPlayerProgress()->GetName();
|
2012-06-26 20:23:05 +00:00
|
|
|
|
|
2014-11-10 16:37:34 +00:00
|
|
|
|
auto saveDirs = CResourceManager::ListDirectories(userSaveDir);
|
2014-11-11 11:08:19 +00:00
|
|
|
|
//std::sort(saveDirs.begin(), saveDirs.end());
|
2015-06-21 18:59:23 +00:00
|
|
|
|
|
2014-11-11 11:08:19 +00:00
|
|
|
|
std::map<int, std::string> sortedSaveDirs;
|
|
|
|
|
std::map<int, std::string> names;
|
2012-06-26 20:23:05 +00:00
|
|
|
|
|
2014-11-10 16:37:34 +00:00
|
|
|
|
for (auto dir : saveDirs)
|
|
|
|
|
{
|
|
|
|
|
std::string savegameFile = userSaveDir + "/" + dir + "/" + "data.sav";
|
|
|
|
|
if (CResourceManager::Exists(savegameFile))
|
|
|
|
|
{
|
2015-06-21 18:59:23 +00:00
|
|
|
|
CLevelParser levelParser(savegameFile);
|
|
|
|
|
levelParser.Load();
|
|
|
|
|
int time = levelParser.Get("Created")->GetParam("date")->AsInt();
|
2014-11-11 11:08:19 +00:00
|
|
|
|
sortedSaveDirs[time] = userSaveDir + "/" + dir;
|
2015-06-21 18:59:23 +00:00
|
|
|
|
names[time] = levelParser.Get("Title")->GetParam("text")->AsString();
|
2012-06-26 20:23:05 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
2015-06-21 18:59:23 +00:00
|
|
|
|
|
2014-11-11 11:08:19 +00:00
|
|
|
|
for (auto dir : sortedSaveDirs)
|
|
|
|
|
{
|
|
|
|
|
pl->SetItemName(m_saveList.size(), names[dir.first].c_str());
|
|
|
|
|
m_saveList.push_back(dir.second);
|
|
|
|
|
}
|
2013-05-26 15:47:54 +00:00
|
|
|
|
|
|
|
|
|
// invalid index
|
|
|
|
|
if ( m_phase == PHASE_WRITE || m_phase == PHASE_WRITEs )
|
|
|
|
|
{
|
2013-12-02 23:11:26 +00:00
|
|
|
|
std::string nameStr;
|
|
|
|
|
GetResource(RES_TEXT, RT_IO_NEW, nameStr);
|
|
|
|
|
pl->SetItemName(m_saveList.size(), nameStr.c_str());
|
2012-06-26 20:23:05 +00:00
|
|
|
|
}
|
|
|
|
|
|
2013-04-01 16:24:12 +00:00
|
|
|
|
pl->SetSelect(m_saveList.size());
|
2012-06-26 20:23:05 +00:00
|
|
|
|
pl->ShowSelect(false); // shows the selected columns
|
2015-06-21 18:59:23 +00:00
|
|
|
|
|
2014-12-11 18:01:57 +00:00
|
|
|
|
unsigned int i;
|
2014-11-18 19:07:00 +00:00
|
|
|
|
std::string screenName;
|
2015-06-21 18:59:23 +00:00
|
|
|
|
|
2014-11-18 19:07:00 +00:00
|
|
|
|
for ( i=0; i < m_saveList.size(); i++ )
|
|
|
|
|
{
|
2014-12-11 18:01:57 +00:00
|
|
|
|
screenName = "textures/../" + m_saveList.at(i) + "/screen.png";
|
|
|
|
|
m_engine->DeleteTexture(screenName);
|
2014-11-18 19:07:00 +00:00
|
|
|
|
}
|
2012-06-26 20:23:05 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Updates the buttons according to the selected part in the list.
|
|
|
|
|
|
|
|
|
|
void CMainDialog::IOUpdateList()
|
|
|
|
|
{
|
|
|
|
|
CWindow* pw;
|
|
|
|
|
CList* pl;
|
|
|
|
|
CButton* pb;
|
|
|
|
|
CImage* pi;
|
|
|
|
|
int sel, max;
|
|
|
|
|
|
2012-09-18 20:33:28 +00:00
|
|
|
|
pw = static_cast<CWindow*>(m_interface->SearchControl(EVENT_WINDOW5));
|
2013-04-01 16:24:12 +00:00
|
|
|
|
if ( pw == nullptr ) return;
|
2012-09-18 20:33:28 +00:00
|
|
|
|
pl = static_cast<CList*>(pw->SearchControl(EVENT_INTERFACE_IOLIST));
|
2013-04-01 16:24:12 +00:00
|
|
|
|
if ( pl == nullptr ) return;
|
2012-09-18 20:33:28 +00:00
|
|
|
|
pi = static_cast<CImage*>(pw->SearchControl(EVENT_INTERFACE_IOIMAGE));
|
2013-04-01 16:24:12 +00:00
|
|
|
|
if ( pi == nullptr ) return;
|
2012-06-26 20:23:05 +00:00
|
|
|
|
|
2012-09-15 19:47:19 +00:00
|
|
|
|
sel = pl->GetSelect();
|
|
|
|
|
max = pl->GetTotal();
|
2012-06-26 20:23:05 +00:00
|
|
|
|
|
2013-05-26 15:47:54 +00:00
|
|
|
|
if (m_saveList.size() <= static_cast<unsigned int>(sel))
|
2013-04-01 16:24:12 +00:00
|
|
|
|
return;
|
2013-05-26 15:47:54 +00:00
|
|
|
|
|
2014-11-10 16:37:34 +00:00
|
|
|
|
std::string filename = "../"+m_saveList.at(sel) + "/screen.png";
|
2013-04-01 16:24:12 +00:00
|
|
|
|
if ( m_phase == PHASE_WRITE || m_phase == PHASE_WRITEs )
|
2012-06-26 20:23:05 +00:00
|
|
|
|
{
|
2013-05-26 15:47:54 +00:00
|
|
|
|
if ( sel < max-1 )
|
|
|
|
|
{
|
2012-09-26 20:57:43 +00:00
|
|
|
|
pi->SetFilenameImage(filename.c_str());
|
2012-06-26 20:23:05 +00:00
|
|
|
|
}
|
2013-05-26 15:47:54 +00:00
|
|
|
|
else
|
|
|
|
|
{
|
2012-06-26 20:23:05 +00:00
|
|
|
|
pi->SetFilenameImage("");
|
|
|
|
|
}
|
|
|
|
|
|
2012-09-18 20:33:28 +00:00
|
|
|
|
pb = static_cast<CButton*>(pw->SearchControl(EVENT_INTERFACE_IODELETE));
|
2013-05-26 15:47:54 +00:00
|
|
|
|
if ( pb != nullptr )
|
|
|
|
|
{
|
2012-06-26 20:23:05 +00:00
|
|
|
|
pb->SetState(STATE_ENABLE, sel < max-1);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
2012-09-26 20:57:43 +00:00
|
|
|
|
pi->SetFilenameImage(filename.c_str());
|
2012-06-26 20:23:05 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Deletes the selected scene.
|
|
|
|
|
|
|
|
|
|
void CMainDialog::IODeleteScene()
|
|
|
|
|
{
|
2012-10-02 19:44:14 +00:00
|
|
|
|
CWindow* pw;
|
|
|
|
|
CList* pl;
|
|
|
|
|
int sel;
|
2012-06-26 20:23:05 +00:00
|
|
|
|
|
2012-09-18 20:33:28 +00:00
|
|
|
|
pw = static_cast<CWindow*>(m_interface->SearchControl(EVENT_WINDOW5));
|
2012-06-26 20:23:05 +00:00
|
|
|
|
if ( pw == 0 ) return;
|
2012-09-18 20:33:28 +00:00
|
|
|
|
pl = static_cast<CList*>(pw->SearchControl(EVENT_INTERFACE_IOLIST));
|
2012-06-26 20:23:05 +00:00
|
|
|
|
if ( pl == 0 ) return;
|
|
|
|
|
|
2012-09-15 19:47:19 +00:00
|
|
|
|
sel = pl->GetSelect();
|
2013-04-01 16:24:12 +00:00
|
|
|
|
if ( sel == -1 || m_saveList.size() <= static_cast<unsigned int>(sel))
|
2012-06-26 20:23:05 +00:00
|
|
|
|
{
|
|
|
|
|
m_sound->Play(SOUND_TZOING);
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
2014-11-10 16:37:34 +00:00
|
|
|
|
if (CResourceManager::DirectoryExists(m_saveList.at(sel)))
|
2012-09-29 21:52:30 +00:00
|
|
|
|
{
|
2014-11-10 16:37:34 +00:00
|
|
|
|
CResourceManager::RemoveDirectory(m_saveList.at(sel));
|
2012-09-29 21:52:30 +00:00
|
|
|
|
}
|
2012-06-26 20:23:05 +00:00
|
|
|
|
|
|
|
|
|
IOReadList();
|
|
|
|
|
}
|
|
|
|
|
|
2013-04-01 16:24:12 +00:00
|
|
|
|
// clears filename only to leave letter or numbers
|
|
|
|
|
std::string clearName(char *name)
|
|
|
|
|
{
|
|
|
|
|
std::string ret;
|
|
|
|
|
int len = strlen(name);
|
2013-05-26 15:47:54 +00:00
|
|
|
|
for (int i = 0; i < len; i++)
|
|
|
|
|
{
|
|
|
|
|
if (isalnum(name[i]))
|
|
|
|
|
{
|
2013-04-01 16:24:12 +00:00
|
|
|
|
ret += name[i];
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return ret;
|
|
|
|
|
}
|
|
|
|
|
|
2012-06-26 20:23:05 +00:00
|
|
|
|
|
2013-04-01 16:24:12 +00:00
|
|
|
|
// Writes the scene.
|
2012-06-26 20:23:05 +00:00
|
|
|
|
bool CMainDialog::IOWriteScene()
|
|
|
|
|
{
|
|
|
|
|
CWindow* pw;
|
|
|
|
|
CList* pl;
|
|
|
|
|
CEdit* pe;
|
|
|
|
|
char info[100];
|
|
|
|
|
int sel;
|
|
|
|
|
|
2012-09-18 20:33:28 +00:00
|
|
|
|
pw = static_cast<CWindow*>(m_interface->SearchControl(EVENT_WINDOW5));
|
2013-04-01 16:24:12 +00:00
|
|
|
|
if ( pw == nullptr ) return false;
|
2012-09-18 20:33:28 +00:00
|
|
|
|
pl = static_cast<CList*>(pw->SearchControl(EVENT_INTERFACE_IOLIST));
|
2013-04-01 16:24:12 +00:00
|
|
|
|
if ( pl == nullptr ) return false;
|
2012-09-18 20:33:28 +00:00
|
|
|
|
pe = static_cast<CEdit*>(pw->SearchControl(EVENT_INTERFACE_IONAME));
|
2013-04-01 16:24:12 +00:00
|
|
|
|
if ( pe == nullptr ) return false;
|
2012-06-26 20:23:05 +00:00
|
|
|
|
|
2012-09-15 19:47:19 +00:00
|
|
|
|
sel = pl->GetSelect();
|
2013-05-26 15:47:54 +00:00
|
|
|
|
if ( sel == -1 )
|
|
|
|
|
{
|
2013-04-01 16:24:12 +00:00
|
|
|
|
return false;
|
2012-09-26 20:57:43 +00:00
|
|
|
|
}
|
2013-05-26 15:47:54 +00:00
|
|
|
|
|
2014-11-10 16:37:34 +00:00
|
|
|
|
std::string dir;
|
2012-06-26 20:23:05 +00:00
|
|
|
|
pe->GetText(info, 100);
|
2013-05-26 15:47:54 +00:00
|
|
|
|
if (static_cast<unsigned int>(sel) >= m_saveList.size())
|
|
|
|
|
{
|
2015-07-18 21:14:20 +00:00
|
|
|
|
dir = m_savegameDir + "/" + m_main->GetPlayerProgress()->GetName() + "/save" + clearName(info);
|
2013-05-26 15:47:54 +00:00
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
2013-04-01 16:24:12 +00:00
|
|
|
|
dir = m_saveList.at(sel);
|
2013-05-26 15:47:54 +00:00
|
|
|
|
}
|
|
|
|
|
|
2015-07-18 21:14:20 +00:00
|
|
|
|
m_main->GetPlayerProgress()->SaveScene(dir, info);
|
2015-06-21 18:59:23 +00:00
|
|
|
|
|
2012-06-26 20:23:05 +00:00
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
|
2014-11-11 13:50:44 +00:00
|
|
|
|
void CMainDialog::MakeSaveScreenshot(const std::string& name)
|
|
|
|
|
{
|
|
|
|
|
m_shotDelay = 3;
|
|
|
|
|
m_shotName = CResourceManager::GetSaveLocation() + "/" + name; //TODO: Use PHYSFS?
|
|
|
|
|
}
|
|
|
|
|
|
2012-06-26 20:23:05 +00:00
|
|
|
|
// Reads the scene.
|
|
|
|
|
|
|
|
|
|
bool CMainDialog::IOReadScene()
|
|
|
|
|
{
|
|
|
|
|
CWindow* pw;
|
|
|
|
|
CList* pl;
|
2015-07-18 17:43:22 +00:00
|
|
|
|
int sel;
|
2012-06-26 20:23:05 +00:00
|
|
|
|
|
2012-09-18 20:33:28 +00:00
|
|
|
|
pw = static_cast<CWindow*>(m_interface->SearchControl(EVENT_WINDOW5));
|
2013-04-01 16:24:12 +00:00
|
|
|
|
if ( pw == nullptr ) return false;
|
2012-09-18 20:33:28 +00:00
|
|
|
|
pl = static_cast<CList*>(pw->SearchControl(EVENT_INTERFACE_IOLIST));
|
2013-04-01 16:24:12 +00:00
|
|
|
|
if ( pl == nullptr ) return false;
|
2012-06-26 20:23:05 +00:00
|
|
|
|
|
2012-09-15 19:47:19 +00:00
|
|
|
|
sel = pl->GetSelect();
|
2013-05-26 15:47:54 +00:00
|
|
|
|
if ( sel == -1 || m_saveList.size() <= static_cast<unsigned int>(sel) )
|
|
|
|
|
{
|
2013-04-01 16:24:12 +00:00
|
|
|
|
return false;
|
|
|
|
|
}
|
2012-06-26 20:23:05 +00:00
|
|
|
|
|
2014-11-10 16:37:34 +00:00
|
|
|
|
std::string fileName = m_saveList.at(sel) + "/" + "data.sav";
|
|
|
|
|
std::string fileCbot = CResourceManager::GetSaveLocation()+"/"+m_saveList.at(sel) + "/" + "cbot.run";
|
2012-09-26 20:57:43 +00:00
|
|
|
|
|
2015-06-21 18:59:23 +00:00
|
|
|
|
CLevelParser levelParser(fileName);
|
|
|
|
|
levelParser.Load();
|
|
|
|
|
|
|
|
|
|
CLevelParserLine* line = levelParser.Get("Mission");
|
2015-07-18 16:52:37 +00:00
|
|
|
|
m_category = GetLevelCategoryFromDir(line->GetParam("base")->AsString());
|
2015-06-21 18:59:23 +00:00
|
|
|
|
|
2015-07-18 17:43:22 +00:00
|
|
|
|
m_levelRank = line->GetParam("rank")->AsInt();
|
2015-07-18 16:52:37 +00:00
|
|
|
|
if (m_category == LevelCategory::CustomLevels)
|
2013-05-26 15:47:54 +00:00
|
|
|
|
{
|
2015-07-18 17:43:22 +00:00
|
|
|
|
m_levelChap = 0;
|
2014-11-10 16:37:34 +00:00
|
|
|
|
std::string dir = line->GetParam("dir")->AsString();
|
2015-07-18 17:43:22 +00:00
|
|
|
|
for (unsigned int i = 0; i < m_customLevelList.size(); i++)
|
2013-05-26 15:47:54 +00:00
|
|
|
|
{
|
2015-07-18 17:43:22 +00:00
|
|
|
|
if (m_customLevelList[i] == dir)
|
2013-05-26 15:47:54 +00:00
|
|
|
|
{
|
2015-07-18 17:43:22 +00:00
|
|
|
|
m_levelChap = i+1;
|
2012-06-26 20:23:05 +00:00
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
2015-07-18 17:43:22 +00:00
|
|
|
|
if (m_levelChap == 0)
|
2013-05-26 15:47:54 +00:00
|
|
|
|
{
|
2014-11-10 16:37:34 +00:00
|
|
|
|
return false;
|
2012-06-26 20:23:05 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
2015-07-18 17:43:22 +00:00
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
if(line->GetParam("chap")->IsDefined())
|
|
|
|
|
{
|
|
|
|
|
m_levelChap = line->GetParam("chap")->AsInt();
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
// Backwards combatibility
|
|
|
|
|
int rank = line->GetParam("rank")->AsInt();
|
|
|
|
|
m_levelChap = rank/100;
|
|
|
|
|
m_levelRank = rank%100;
|
|
|
|
|
}
|
|
|
|
|
}
|
2012-06-26 20:23:05 +00:00
|
|
|
|
|
2015-07-18 17:43:22 +00:00
|
|
|
|
m_chap[m_category] = m_levelChap-1;
|
|
|
|
|
m_sel[m_category] = m_levelRank-1;
|
2012-06-26 20:23:05 +00:00
|
|
|
|
|
2012-09-26 20:57:43 +00:00
|
|
|
|
m_sceneRead = fileName;
|
|
|
|
|
m_stackRead = fileCbot;
|
2012-06-26 20:23:05 +00:00
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Updates the lists according to the cheat code.
|
|
|
|
|
|
|
|
|
|
void CMainDialog::AllMissionUpdate()
|
|
|
|
|
{
|
|
|
|
|
if ( m_phase == PHASE_TRAINER ||
|
|
|
|
|
m_phase == PHASE_DEFI ||
|
|
|
|
|
m_phase == PHASE_MISSION ||
|
|
|
|
|
m_phase == PHASE_FREE ||
|
2013-12-27 19:36:11 +00:00
|
|
|
|
m_phase == PHASE_USER )
|
2012-06-26 20:23:05 +00:00
|
|
|
|
{
|
2015-07-18 16:52:37 +00:00
|
|
|
|
UpdateSceneChap(m_chap[m_category]);
|
|
|
|
|
UpdateSceneList(m_chap[m_category], m_sel[m_category]);
|
2012-06-26 20:23:05 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Updates the chapters of exercises or missions.
|
|
|
|
|
|
|
|
|
|
void CMainDialog::UpdateSceneChap(int &chap)
|
|
|
|
|
{
|
|
|
|
|
CWindow* pw;
|
|
|
|
|
CList* pl;
|
2014-06-30 15:40:40 +00:00
|
|
|
|
|
2012-09-26 20:57:43 +00:00
|
|
|
|
std::string fileName;
|
2012-06-26 20:23:05 +00:00
|
|
|
|
char line[500];
|
2012-10-02 19:44:14 +00:00
|
|
|
|
bool bPassed;
|
2012-06-26 20:23:05 +00:00
|
|
|
|
|
2012-09-20 22:01:03 +00:00
|
|
|
|
memset(line, 0, 500);
|
|
|
|
|
|
2012-09-18 20:33:28 +00:00
|
|
|
|
pw = static_cast<CWindow*>(m_interface->SearchControl(EVENT_WINDOW5));
|
2012-06-26 20:23:05 +00:00
|
|
|
|
if ( pw == 0 ) return;
|
2012-09-18 20:33:28 +00:00
|
|
|
|
pl = static_cast<CList*>(pw->SearchControl(EVENT_INTERFACE_CHAP));
|
2012-06-26 20:23:05 +00:00
|
|
|
|
if ( pl == 0 ) return;
|
|
|
|
|
|
|
|
|
|
pl->Flush();
|
|
|
|
|
|
2015-07-18 17:43:22 +00:00
|
|
|
|
unsigned int j;
|
2012-06-26 20:23:05 +00:00
|
|
|
|
if ( m_phase == PHASE_USER )
|
|
|
|
|
{
|
2014-09-26 18:53:11 +00:00
|
|
|
|
auto userLevelDirs = CResourceManager::ListDirectories("levels/custom/");
|
|
|
|
|
std::sort(userLevelDirs.begin(), userLevelDirs.end());
|
2015-07-18 17:43:22 +00:00
|
|
|
|
m_customLevelList = userLevelDirs;
|
2012-06-26 20:23:05 +00:00
|
|
|
|
|
2015-07-18 17:43:22 +00:00
|
|
|
|
for ( j=0 ; j<m_customLevelList.size() ; j++ )
|
2012-06-26 20:23:05 +00:00
|
|
|
|
{
|
2015-06-21 18:59:23 +00:00
|
|
|
|
try
|
|
|
|
|
{
|
|
|
|
|
CLevelParser levelParser("custom", j+1, 0);
|
|
|
|
|
levelParser.Load();
|
|
|
|
|
pl->SetItemName(j, levelParser.Get("Title")->GetParam("text")->AsString().c_str());
|
2014-09-26 18:53:11 +00:00
|
|
|
|
pl->SetEnable(j, true);
|
2012-06-26 20:23:05 +00:00
|
|
|
|
}
|
2015-06-21 18:59:23 +00:00
|
|
|
|
catch (CLevelParserException& e)
|
2012-06-26 20:23:05 +00:00
|
|
|
|
{
|
2014-09-26 18:53:11 +00:00
|
|
|
|
pl->SetItemName(j, (std::string("[ERROR]: ")+e.what()).c_str());
|
|
|
|
|
pl->SetEnable(j, false);
|
2012-06-26 20:23:05 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
2015-07-18 17:43:22 +00:00
|
|
|
|
for ( j=0 ; j<MAXSCENE ; j++ )
|
2012-06-26 20:23:05 +00:00
|
|
|
|
{
|
2015-07-18 16:52:37 +00:00
|
|
|
|
CLevelParser levelParser(m_category, j+1, 0);
|
2015-06-21 18:59:23 +00:00
|
|
|
|
if (!levelParser.Exists())
|
2014-10-25 10:01:21 +00:00
|
|
|
|
break;
|
2015-06-21 18:59:23 +00:00
|
|
|
|
try
|
|
|
|
|
{
|
|
|
|
|
levelParser.Load();
|
|
|
|
|
sprintf(line, "%d: %s", j+1, levelParser.Get("Title")->GetParam("text")->AsString().c_str());
|
2012-06-26 20:23:05 +00:00
|
|
|
|
}
|
2015-06-21 18:59:23 +00:00
|
|
|
|
catch (CLevelParserException& e)
|
|
|
|
|
{
|
2014-10-25 10:01:21 +00:00
|
|
|
|
sprintf(line, "%s", (std::string("[ERROR]: ")+e.what()).c_str());
|
|
|
|
|
}
|
2012-06-26 20:23:05 +00:00
|
|
|
|
|
2015-07-18 21:14:20 +00:00
|
|
|
|
bPassed = m_main->GetPlayerProgress()->GetLevelPassed(m_category, j+1, 0);
|
2013-05-26 15:45:15 +00:00
|
|
|
|
pl->SetItemName(j, line);
|
2012-06-26 20:23:05 +00:00
|
|
|
|
pl->SetCheck(j, bPassed);
|
|
|
|
|
pl->SetEnable(j, true);
|
|
|
|
|
|
2012-09-15 19:47:19 +00:00
|
|
|
|
if ( m_phase == PHASE_MISSION && !m_main->GetShowAll() && !bPassed )
|
2012-06-26 20:23:05 +00:00
|
|
|
|
{
|
|
|
|
|
j ++;
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if ( m_phase == PHASE_FREE && j == m_accessChap )
|
|
|
|
|
{
|
|
|
|
|
j ++;
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if ( chap > j-1 ) chap = j-1;
|
|
|
|
|
|
|
|
|
|
pl->SetSelect(chap);
|
|
|
|
|
pl->ShowSelect(false); // shows the selected columns
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Updates the list of exercises or missions.
|
|
|
|
|
|
|
|
|
|
void CMainDialog::UpdateSceneList(int chap, int &sel)
|
|
|
|
|
{
|
|
|
|
|
CWindow* pw;
|
|
|
|
|
CList* pl;
|
2012-09-26 20:57:43 +00:00
|
|
|
|
std::string fileName;
|
2012-06-26 20:23:05 +00:00
|
|
|
|
char line[500];
|
2014-10-25 10:01:21 +00:00
|
|
|
|
int j;
|
2012-06-26 20:23:05 +00:00
|
|
|
|
bool bPassed;
|
|
|
|
|
|
2012-09-20 22:01:03 +00:00
|
|
|
|
memset(line, 0, 500);
|
|
|
|
|
|
2012-09-18 20:33:28 +00:00
|
|
|
|
pw = static_cast<CWindow*>(m_interface->SearchControl(EVENT_WINDOW5));
|
2012-06-26 20:23:05 +00:00
|
|
|
|
if ( pw == 0 ) return;
|
2012-09-18 20:33:28 +00:00
|
|
|
|
pl = static_cast<CList*>(pw->SearchControl(EVENT_INTERFACE_LIST));
|
2012-06-26 20:23:05 +00:00
|
|
|
|
if ( pl == 0 ) return;
|
|
|
|
|
|
|
|
|
|
pl->Flush();
|
2015-06-21 18:59:23 +00:00
|
|
|
|
|
|
|
|
|
if (chap < 0) return;
|
2012-06-26 20:23:05 +00:00
|
|
|
|
|
2014-10-25 10:01:21 +00:00
|
|
|
|
bool readAll = true;
|
2015-07-18 17:43:22 +00:00
|
|
|
|
for ( j=0 ; j<MAXSCENE ; j++ )
|
2012-06-26 20:23:05 +00:00
|
|
|
|
{
|
2015-07-18 16:52:37 +00:00
|
|
|
|
CLevelParser levelParser(m_category, chap+1, j+1);
|
2015-06-21 18:59:23 +00:00
|
|
|
|
if (!levelParser.Exists())
|
|
|
|
|
{
|
2014-10-25 15:09:14 +00:00
|
|
|
|
readAll = true;
|
2014-10-25 10:01:21 +00:00
|
|
|
|
break;
|
2015-06-21 18:59:23 +00:00
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
if (!readAll)
|
2014-10-25 15:09:14 +00:00
|
|
|
|
break;
|
|
|
|
|
}
|
2015-06-21 18:59:23 +00:00
|
|
|
|
try
|
|
|
|
|
{
|
|
|
|
|
levelParser.Load();
|
|
|
|
|
sprintf(line, "%d: %s", j+1, levelParser.Get("Title")->GetParam("text")->AsString().c_str());
|
2012-06-26 20:23:05 +00:00
|
|
|
|
}
|
2015-06-21 18:59:23 +00:00
|
|
|
|
catch (CLevelParserException& e)
|
|
|
|
|
{
|
2014-10-25 10:01:21 +00:00
|
|
|
|
sprintf(line, "%s", (std::string("[ERROR]: ")+e.what()).c_str());
|
|
|
|
|
}
|
2012-06-26 20:23:05 +00:00
|
|
|
|
|
2015-07-18 21:14:20 +00:00
|
|
|
|
bPassed = m_main->GetPlayerProgress()->GetLevelPassed(m_category, chap+1, j+1);
|
2013-05-26 15:45:15 +00:00
|
|
|
|
pl->SetItemName(j, line);
|
2012-06-26 20:23:05 +00:00
|
|
|
|
pl->SetCheck(j, bPassed);
|
|
|
|
|
pl->SetEnable(j, true);
|
|
|
|
|
|
2012-09-15 19:47:19 +00:00
|
|
|
|
if ( m_phase == PHASE_MISSION && !m_main->GetShowAll() && !bPassed )
|
2012-06-26 20:23:05 +00:00
|
|
|
|
{
|
2014-10-25 10:01:21 +00:00
|
|
|
|
readAll = false;
|
2012-06-26 20:23:05 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2015-06-21 18:59:23 +00:00
|
|
|
|
if (readAll)
|
2012-06-26 20:23:05 +00:00
|
|
|
|
{
|
|
|
|
|
m_maxList = j;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
m_maxList = j+1; // this is not the last!
|
2014-10-25 10:01:21 +00:00
|
|
|
|
}
|
2012-06-26 20:23:05 +00:00
|
|
|
|
|
|
|
|
|
if ( sel > j-1 ) sel = j-1;
|
|
|
|
|
|
|
|
|
|
pl->SetSelect(sel);
|
|
|
|
|
pl->ShowSelect(false); // shows the selected columns
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Updates the button "solution" according to cheat code.
|
|
|
|
|
|
|
|
|
|
void CMainDialog::ShowSoluceUpdate()
|
|
|
|
|
{
|
|
|
|
|
CWindow* pw;
|
|
|
|
|
CEdit* pe;
|
|
|
|
|
CCheck* pc;
|
|
|
|
|
|
|
|
|
|
if ( m_phase == PHASE_TRAINER ||
|
|
|
|
|
m_phase == PHASE_DEFI ||
|
|
|
|
|
m_phase == PHASE_MISSION ||
|
|
|
|
|
m_phase == PHASE_FREE ||
|
2013-12-27 19:36:11 +00:00
|
|
|
|
m_phase == PHASE_USER )
|
2012-06-26 20:23:05 +00:00
|
|
|
|
{
|
|
|
|
|
m_bSceneSoluce = false;
|
|
|
|
|
|
2012-09-18 20:33:28 +00:00
|
|
|
|
pw = static_cast<CWindow*>(m_interface->SearchControl(EVENT_WINDOW5));
|
2012-06-26 20:23:05 +00:00
|
|
|
|
if ( pw == 0 ) return;
|
2012-09-18 20:33:28 +00:00
|
|
|
|
pe = static_cast<CEdit*>(pw->SearchControl(EVENT_INTERFACE_RESUME));
|
2012-06-26 20:23:05 +00:00
|
|
|
|
if ( pe == 0 ) return;
|
2012-09-18 20:33:28 +00:00
|
|
|
|
pc = static_cast<CCheck*>(pw->SearchControl(EVENT_INTERFACE_SOLUCE));
|
2012-06-26 20:23:05 +00:00
|
|
|
|
if ( pc == 0 ) return;
|
|
|
|
|
|
2012-09-15 19:47:19 +00:00
|
|
|
|
if ( m_main->GetShowSoluce() )
|
2012-06-26 20:23:05 +00:00
|
|
|
|
{
|
|
|
|
|
pc->SetState(STATE_VISIBLE);
|
|
|
|
|
pc->SetState(STATE_CHECK);
|
|
|
|
|
m_bSceneSoluce = true;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
pc->ClearState(STATE_VISIBLE);
|
|
|
|
|
pc->ClearState(STATE_CHECK);
|
|
|
|
|
m_bSceneSoluce = false;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Updates a summary of exercise or mission.
|
|
|
|
|
|
2015-07-18 17:43:22 +00:00
|
|
|
|
void CMainDialog::UpdateSceneResume(int chap, int rank)
|
2012-06-26 20:23:05 +00:00
|
|
|
|
{
|
|
|
|
|
CWindow* pw;
|
|
|
|
|
CEdit* pe;
|
|
|
|
|
CCheck* pc;
|
2012-09-26 20:57:43 +00:00
|
|
|
|
std::string fileName;
|
2014-09-27 14:49:00 +00:00
|
|
|
|
int numTry;
|
2012-06-26 20:23:05 +00:00
|
|
|
|
bool bPassed, bVisible;
|
|
|
|
|
|
2012-09-18 20:33:28 +00:00
|
|
|
|
pw = static_cast<CWindow*>(m_interface->SearchControl(EVENT_WINDOW5));
|
2012-06-26 20:23:05 +00:00
|
|
|
|
if ( pw == 0 ) return;
|
2012-09-18 20:33:28 +00:00
|
|
|
|
pe = static_cast<CEdit*>(pw->SearchControl(EVENT_INTERFACE_RESUME));
|
2012-06-26 20:23:05 +00:00
|
|
|
|
if ( pe == 0 ) return;
|
2012-09-18 20:33:28 +00:00
|
|
|
|
pc = static_cast<CCheck*>(pw->SearchControl(EVENT_INTERFACE_SOLUCE));
|
2012-06-26 20:23:05 +00:00
|
|
|
|
|
|
|
|
|
if ( pc == 0 )
|
|
|
|
|
{
|
|
|
|
|
m_bSceneSoluce = false;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
2015-07-18 21:14:20 +00:00
|
|
|
|
numTry = m_main->GetPlayerProgress()->GetLevelTryCount(m_category, chap, rank);
|
|
|
|
|
bPassed = m_main->GetPlayerProgress()->GetLevelPassed(m_category, chap, rank);
|
2012-09-15 19:47:19 +00:00
|
|
|
|
bVisible = ( numTry > 2 || bPassed || m_main->GetShowSoluce() );
|
|
|
|
|
if ( !GetSoluce4() ) bVisible = false;
|
2012-06-26 20:23:05 +00:00
|
|
|
|
pc->SetState(STATE_VISIBLE, bVisible);
|
|
|
|
|
if ( !bVisible )
|
|
|
|
|
{
|
|
|
|
|
pc->ClearState(STATE_CHECK);
|
|
|
|
|
m_bSceneSoluce = false;
|
|
|
|
|
}
|
|
|
|
|
}
|
2015-06-21 18:59:23 +00:00
|
|
|
|
|
2015-07-18 17:43:22 +00:00
|
|
|
|
if(chap == 0) return;
|
2015-06-21 18:59:23 +00:00
|
|
|
|
|
|
|
|
|
try
|
|
|
|
|
{
|
2015-07-18 17:43:22 +00:00
|
|
|
|
CLevelParser levelParser(m_category, chap, rank);
|
2015-06-21 18:59:23 +00:00
|
|
|
|
levelParser.Load();
|
|
|
|
|
pe->SetText(levelParser.Get("Resume")->GetParam("text")->AsString().c_str());
|
2014-09-26 18:53:11 +00:00
|
|
|
|
}
|
2015-06-21 18:59:23 +00:00
|
|
|
|
catch (CLevelParserException& e)
|
2012-06-26 20:23:05 +00:00
|
|
|
|
{
|
2014-09-26 18:53:11 +00:00
|
|
|
|
pe->SetText((std::string("[ERROR]: ")+e.what()).c_str());
|
2012-06-26 20:23:05 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Updates the list of modes.
|
|
|
|
|
|
2015-07-11 21:53:25 +00:00
|
|
|
|
int GCD(int a, int b) {
|
|
|
|
|
return (b == 0) ? a : GCD(b, a%b);
|
|
|
|
|
}
|
|
|
|
|
Math::IntPoint AspectRatio(Math::IntPoint resolution)
|
|
|
|
|
{
|
|
|
|
|
int gcd = GCD(resolution.x, resolution.y);
|
|
|
|
|
return Math::IntPoint(static_cast<float>(resolution.x) / gcd, static_cast<float>(resolution.y) / gcd);
|
|
|
|
|
}
|
|
|
|
|
|
2012-06-26 20:23:05 +00:00
|
|
|
|
void CMainDialog::UpdateDisplayMode()
|
|
|
|
|
{
|
|
|
|
|
CWindow* pw;
|
|
|
|
|
CList* pl;
|
|
|
|
|
|
2012-09-18 20:33:28 +00:00
|
|
|
|
pw = static_cast<CWindow*>(m_interface->SearchControl(EVENT_WINDOW5));
|
2012-06-26 20:23:05 +00:00
|
|
|
|
if ( pw == 0 ) return;
|
2012-09-18 20:33:28 +00:00
|
|
|
|
pl = static_cast<CList*>(pw->SearchControl(EVENT_LIST2));
|
2012-06-26 20:23:05 +00:00
|
|
|
|
if ( pl == 0 ) return;
|
|
|
|
|
pl->Flush();
|
|
|
|
|
|
2012-12-25 20:36:50 +00:00
|
|
|
|
std::vector<Math::IntPoint> modes;
|
|
|
|
|
m_app->GetVideoResolutionList(modes, true, true);
|
|
|
|
|
int i = 0;
|
|
|
|
|
std::stringstream mode_text;
|
2013-05-26 15:47:54 +00:00
|
|
|
|
for (Math::IntPoint mode : modes)
|
|
|
|
|
{
|
|
|
|
|
mode_text.str("");
|
2015-07-11 21:53:25 +00:00
|
|
|
|
Math::IntPoint aspect = AspectRatio(mode);
|
|
|
|
|
mode_text << mode.x << "x" << mode.y << " [" << aspect.x << ":" << aspect.y << "]";
|
2013-05-26 15:47:54 +00:00
|
|
|
|
pl->SetItemName(i++, mode_text.str().c_str());
|
2012-06-26 20:23:05 +00:00
|
|
|
|
}
|
|
|
|
|
|
2012-12-25 20:36:50 +00:00
|
|
|
|
pl->SetSelect(m_setupSelMode);
|
2012-06-26 20:23:05 +00:00
|
|
|
|
pl->ShowSelect(false);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Change the graphics mode.
|
|
|
|
|
|
|
|
|
|
void CMainDialog::ChangeDisplay()
|
|
|
|
|
{
|
|
|
|
|
CWindow* pw;
|
|
|
|
|
CList* pl;
|
|
|
|
|
CCheck* pc;
|
|
|
|
|
bool bFull;
|
|
|
|
|
|
2012-09-18 20:33:28 +00:00
|
|
|
|
pw = static_cast<CWindow*>(m_interface->SearchControl(EVENT_WINDOW5));
|
2012-06-26 20:23:05 +00:00
|
|
|
|
if ( pw == 0 ) return;
|
|
|
|
|
|
2012-09-18 20:33:28 +00:00
|
|
|
|
pl = static_cast<CList*>(pw->SearchControl(EVENT_LIST2));
|
2012-06-26 20:23:05 +00:00
|
|
|
|
if ( pl == 0 ) return;
|
2012-09-15 19:47:19 +00:00
|
|
|
|
m_setupSelMode = pl->GetSelect();
|
2012-06-26 20:23:05 +00:00
|
|
|
|
|
2012-09-18 20:33:28 +00:00
|
|
|
|
pc = static_cast<CCheck*>(pw->SearchControl(EVENT_INTERFACE_FULL));
|
2012-06-26 20:23:05 +00:00
|
|
|
|
if ( pc == 0 ) return;
|
|
|
|
|
bFull = pc->TestState(STATE_CHECK);
|
|
|
|
|
m_setupFull = bFull;
|
2015-06-21 18:59:23 +00:00
|
|
|
|
|
2014-10-25 16:34:29 +00:00
|
|
|
|
SetupMemorize();
|
2015-06-21 18:59:23 +00:00
|
|
|
|
|
2014-10-25 16:34:29 +00:00
|
|
|
|
#if !PLATFORM_LINUX
|
|
|
|
|
// Windows causes problems, so we'll restart the game
|
|
|
|
|
// Mac OS was not tested so let's restart just to be sure
|
|
|
|
|
m_app->Restart();
|
|
|
|
|
#else
|
2014-10-19 13:45:59 +00:00
|
|
|
|
std::vector<Math::IntPoint> modes;
|
|
|
|
|
m_app->GetVideoResolutionList(modes, true, true);
|
2015-06-21 18:59:23 +00:00
|
|
|
|
|
2015-06-16 17:30:35 +00:00
|
|
|
|
Gfx::DeviceConfig config = m_app->GetVideoConfig();
|
2014-10-19 13:45:59 +00:00
|
|
|
|
config.size = modes[m_setupSelMode];
|
|
|
|
|
config.fullScreen = bFull;
|
|
|
|
|
m_app->ChangeVideoConfig(config);
|
2014-10-25 16:34:29 +00:00
|
|
|
|
#endif
|
2012-06-26 20:23:05 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Updates the "apply" button.
|
|
|
|
|
|
|
|
|
|
void CMainDialog::UpdateApply()
|
|
|
|
|
{
|
|
|
|
|
CWindow* pw;
|
|
|
|
|
CButton* pb;
|
|
|
|
|
CList* pl;
|
|
|
|
|
CCheck* pc;
|
2014-10-19 13:45:59 +00:00
|
|
|
|
int sel2;
|
2012-06-26 20:23:05 +00:00
|
|
|
|
bool bFull;
|
|
|
|
|
|
2012-09-18 20:33:28 +00:00
|
|
|
|
pw = static_cast<CWindow*>(m_interface->SearchControl(EVENT_WINDOW5));
|
2012-06-26 20:23:05 +00:00
|
|
|
|
if ( pw == 0 ) return;
|
|
|
|
|
|
2012-09-18 20:33:28 +00:00
|
|
|
|
pb = static_cast<CButton*>(pw->SearchControl(EVENT_INTERFACE_APPLY));
|
2012-06-26 20:23:05 +00:00
|
|
|
|
|
2012-09-18 20:33:28 +00:00
|
|
|
|
pl = static_cast<CList*>(pw->SearchControl(EVENT_LIST2));
|
2012-06-26 20:23:05 +00:00
|
|
|
|
if ( pl == 0 ) return;
|
2012-09-15 19:47:19 +00:00
|
|
|
|
sel2 = pl->GetSelect();
|
2012-06-26 20:23:05 +00:00
|
|
|
|
|
2012-09-18 20:33:28 +00:00
|
|
|
|
pc = static_cast<CCheck*>(pw->SearchControl(EVENT_INTERFACE_FULL));
|
2012-06-26 20:23:05 +00:00
|
|
|
|
bFull = pc->TestState(STATE_CHECK);
|
|
|
|
|
|
2014-10-19 13:45:59 +00:00
|
|
|
|
if ( sel2 == m_setupSelMode &&
|
2012-06-26 20:23:05 +00:00
|
|
|
|
bFull == m_setupFull )
|
|
|
|
|
{
|
|
|
|
|
pb->ClearState(STATE_ENABLE);
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
pb->SetState(STATE_ENABLE);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Updates the buttons during the setup phase.
|
|
|
|
|
|
|
|
|
|
void CMainDialog::UpdateSetupButtons()
|
|
|
|
|
{
|
|
|
|
|
CWindow* pw;
|
|
|
|
|
CCheck* pc;
|
|
|
|
|
CEditValue* pv;
|
|
|
|
|
CSlider* ps;
|
|
|
|
|
float value;
|
|
|
|
|
|
2012-09-18 20:33:28 +00:00
|
|
|
|
pw = static_cast<CWindow*>(m_interface->SearchControl(EVENT_WINDOW5));
|
2012-06-26 20:23:05 +00:00
|
|
|
|
if ( pw == 0 ) return;
|
|
|
|
|
|
2012-09-18 20:33:28 +00:00
|
|
|
|
pc = static_cast<CCheck*>(pw->SearchControl(EVENT_INTERFACE_TOTO));
|
2012-06-26 20:23:05 +00:00
|
|
|
|
if ( pc != 0 )
|
|
|
|
|
{
|
2012-09-15 19:47:19 +00:00
|
|
|
|
pc->SetState(STATE_CHECK, m_engine->GetTotoMode());
|
2012-06-26 20:23:05 +00:00
|
|
|
|
}
|
|
|
|
|
|
2012-09-18 20:33:28 +00:00
|
|
|
|
pc = static_cast<CCheck*>(pw->SearchControl(EVENT_INTERFACE_TOOLTIP));
|
2012-06-26 20:23:05 +00:00
|
|
|
|
if ( pc != 0 )
|
|
|
|
|
{
|
|
|
|
|
pc->SetState(STATE_CHECK, m_bTooltip);
|
|
|
|
|
}
|
|
|
|
|
|
2012-09-18 20:33:28 +00:00
|
|
|
|
pc = static_cast<CCheck*>(pw->SearchControl(EVENT_INTERFACE_GLINT));
|
2012-06-26 20:23:05 +00:00
|
|
|
|
if ( pc != 0 )
|
|
|
|
|
{
|
|
|
|
|
pc->SetState(STATE_CHECK, m_bGlint);
|
|
|
|
|
}
|
|
|
|
|
|
2012-09-18 20:33:28 +00:00
|
|
|
|
pc = static_cast<CCheck*>(pw->SearchControl(EVENT_INTERFACE_RAIN));
|
2012-06-26 20:23:05 +00:00
|
|
|
|
if ( pc != 0 )
|
|
|
|
|
{
|
|
|
|
|
pc->SetState(STATE_CHECK, m_bRain);
|
|
|
|
|
}
|
|
|
|
|
|
2015-07-13 10:11:11 +00:00
|
|
|
|
pc = static_cast<CCheck*>(pw->SearchControl(EVENT_INTERFACE_MOUSE));
|
|
|
|
|
if ( pc != 0 )
|
|
|
|
|
{
|
|
|
|
|
pc->SetState(STATE_CHECK, m_app->GetMouseMode() == MOUSE_SYSTEM);
|
|
|
|
|
}
|
|
|
|
|
|
2012-09-18 20:33:28 +00:00
|
|
|
|
pc = static_cast<CCheck*>(pw->SearchControl(EVENT_INTERFACE_EDITMODE));
|
2012-06-26 20:23:05 +00:00
|
|
|
|
if ( pc != 0 )
|
|
|
|
|
{
|
2012-09-15 19:47:19 +00:00
|
|
|
|
pc->SetState(STATE_CHECK, m_engine->GetEditIndentMode());
|
2012-06-26 20:23:05 +00:00
|
|
|
|
}
|
|
|
|
|
|
2012-09-18 20:33:28 +00:00
|
|
|
|
pc = static_cast<CCheck*>(pw->SearchControl(EVENT_INTERFACE_EDITVALUE));
|
2012-06-26 20:23:05 +00:00
|
|
|
|
if ( pc != 0 )
|
|
|
|
|
{
|
2012-09-15 19:47:19 +00:00
|
|
|
|
pc->SetState(STATE_CHECK, m_engine->GetEditIndentValue()>2);
|
2012-06-26 20:23:05 +00:00
|
|
|
|
}
|
|
|
|
|
|
2012-09-18 20:33:28 +00:00
|
|
|
|
pc = static_cast<CCheck*>(pw->SearchControl(EVENT_INTERFACE_SOLUCE4));
|
2012-06-26 20:23:05 +00:00
|
|
|
|
if ( pc != 0 )
|
|
|
|
|
{
|
|
|
|
|
pc->SetState(STATE_CHECK, m_bSoluce4);
|
|
|
|
|
}
|
|
|
|
|
|
2012-09-18 20:33:28 +00:00
|
|
|
|
pc = static_cast<CCheck*>(pw->SearchControl(EVENT_INTERFACE_MOVIES));
|
2012-06-26 20:23:05 +00:00
|
|
|
|
if ( pc != 0 )
|
|
|
|
|
{
|
|
|
|
|
pc->SetState(STATE_CHECK, m_bMovies);
|
|
|
|
|
}
|
|
|
|
|
|
2012-09-18 20:33:28 +00:00
|
|
|
|
pc = static_cast<CCheck*>(pw->SearchControl(EVENT_INTERFACE_NICERST));
|
2012-06-26 20:23:05 +00:00
|
|
|
|
if ( pc != 0 )
|
|
|
|
|
{
|
|
|
|
|
pc->SetState(STATE_CHECK, m_bNiceReset);
|
|
|
|
|
}
|
|
|
|
|
|
2012-09-18 20:33:28 +00:00
|
|
|
|
pc = static_cast<CCheck*>(pw->SearchControl(EVENT_INTERFACE_HIMSELF));
|
2012-06-26 20:23:05 +00:00
|
|
|
|
if ( pc != 0 )
|
|
|
|
|
{
|
|
|
|
|
pc->SetState(STATE_CHECK, m_bHimselfDamage);
|
|
|
|
|
}
|
|
|
|
|
|
2012-09-18 20:33:28 +00:00
|
|
|
|
pc = static_cast<CCheck*>(pw->SearchControl(EVENT_INTERFACE_SCROLL));
|
2012-06-26 20:23:05 +00:00
|
|
|
|
if ( pc != 0 )
|
|
|
|
|
{
|
|
|
|
|
pc->SetState(STATE_CHECK, m_bCameraScroll);
|
|
|
|
|
}
|
|
|
|
|
|
2012-09-18 20:33:28 +00:00
|
|
|
|
pc = static_cast<CCheck*>(pw->SearchControl(EVENT_INTERFACE_INVERTX));
|
2012-06-26 20:23:05 +00:00
|
|
|
|
if ( pc != 0 )
|
|
|
|
|
{
|
|
|
|
|
pc->SetState(STATE_CHECK, m_bCameraInvertX);
|
|
|
|
|
}
|
|
|
|
|
|
2012-09-18 20:33:28 +00:00
|
|
|
|
pc = static_cast<CCheck*>(pw->SearchControl(EVENT_INTERFACE_INVERTY));
|
2012-06-26 20:23:05 +00:00
|
|
|
|
if ( pc != 0 )
|
|
|
|
|
{
|
|
|
|
|
pc->SetState(STATE_CHECK, m_bCameraInvertY);
|
|
|
|
|
}
|
|
|
|
|
|
2012-09-18 20:33:28 +00:00
|
|
|
|
pc = static_cast<CCheck*>(pw->SearchControl(EVENT_INTERFACE_EFFECT));
|
2012-06-26 20:23:05 +00:00
|
|
|
|
if ( pc != 0 )
|
|
|
|
|
{
|
|
|
|
|
pc->SetState(STATE_CHECK, m_bEffect);
|
|
|
|
|
}
|
|
|
|
|
|
2014-10-22 04:44:17 +00:00
|
|
|
|
pc = static_cast<CCheck*>(pw->SearchControl(EVENT_INTERFACE_BLOOD));
|
|
|
|
|
if ( pc != 0 )
|
|
|
|
|
{
|
|
|
|
|
pc->SetState(STATE_CHECK, m_bBlood);
|
|
|
|
|
}
|
2015-06-21 18:59:23 +00:00
|
|
|
|
|
2014-11-11 13:50:44 +00:00
|
|
|
|
pc = static_cast<CCheck*>(pw->SearchControl(EVENT_INTERFACE_AUTOSAVE_ENABLE));
|
|
|
|
|
if ( pc != 0 )
|
|
|
|
|
{
|
|
|
|
|
pc->SetState(STATE_CHECK, m_bAutosave);
|
|
|
|
|
}
|
2015-06-21 18:59:23 +00:00
|
|
|
|
|
2014-11-11 13:50:44 +00:00
|
|
|
|
ps = static_cast<CSlider*>(pw->SearchControl(EVENT_INTERFACE_AUTOSAVE_INTERVAL));
|
|
|
|
|
if ( ps != 0 )
|
|
|
|
|
{
|
|
|
|
|
ps->SetState(STATE_ENABLE, m_bAutosave);
|
|
|
|
|
ps->SetVisibleValue(m_main->GetAutosaveInterval());
|
2015-06-21 18:59:23 +00:00
|
|
|
|
|
2014-11-11 13:50:44 +00:00
|
|
|
|
}
|
2015-06-21 18:59:23 +00:00
|
|
|
|
|
2014-11-11 13:50:44 +00:00
|
|
|
|
ps = static_cast<CSlider*>(pw->SearchControl(EVENT_INTERFACE_AUTOSAVE_SLOTS));
|
|
|
|
|
if ( ps != 0 )
|
|
|
|
|
{
|
|
|
|
|
ps->SetState(STATE_ENABLE, m_bAutosave);
|
|
|
|
|
ps->SetVisibleValue(m_main->GetAutosaveSlots());
|
|
|
|
|
}
|
2014-10-22 04:44:17 +00:00
|
|
|
|
|
2012-09-18 20:33:28 +00:00
|
|
|
|
pc = static_cast<CCheck*>(pw->SearchControl(EVENT_INTERFACE_SHADOW));
|
2012-06-26 20:23:05 +00:00
|
|
|
|
if ( pc != 0 )
|
|
|
|
|
{
|
2012-09-15 19:47:19 +00:00
|
|
|
|
pc->SetState(STATE_CHECK, m_engine->GetShadow());
|
2012-06-26 20:23:05 +00:00
|
|
|
|
}
|
|
|
|
|
|
2012-09-18 20:33:28 +00:00
|
|
|
|
pc = static_cast<CCheck*>(pw->SearchControl(EVENT_INTERFACE_GROUND));
|
2012-06-26 20:23:05 +00:00
|
|
|
|
if ( pc != 0 )
|
|
|
|
|
{
|
2012-09-15 19:47:19 +00:00
|
|
|
|
pc->SetState(STATE_CHECK, m_engine->GetGroundSpot());
|
2012-06-26 20:23:05 +00:00
|
|
|
|
}
|
|
|
|
|
|
2012-09-18 20:33:28 +00:00
|
|
|
|
pc = static_cast<CCheck*>(pw->SearchControl(EVENT_INTERFACE_DIRTY));
|
2012-06-26 20:23:05 +00:00
|
|
|
|
if ( pc != 0 )
|
|
|
|
|
{
|
2012-09-15 19:47:19 +00:00
|
|
|
|
pc->SetState(STATE_CHECK, m_engine->GetDirty());
|
2012-06-26 20:23:05 +00:00
|
|
|
|
}
|
|
|
|
|
|
2012-09-18 20:33:28 +00:00
|
|
|
|
pc = static_cast<CCheck*>(pw->SearchControl(EVENT_INTERFACE_FOG));
|
2012-06-26 20:23:05 +00:00
|
|
|
|
if ( pc != 0 )
|
|
|
|
|
{
|
2012-09-15 19:47:19 +00:00
|
|
|
|
pc->SetState(STATE_CHECK, m_engine->GetFog());
|
2012-06-26 20:23:05 +00:00
|
|
|
|
}
|
|
|
|
|
|
2012-09-18 20:33:28 +00:00
|
|
|
|
pc = static_cast<CCheck*>(pw->SearchControl(EVENT_INTERFACE_LENS));
|
2012-06-26 20:23:05 +00:00
|
|
|
|
if ( pc != 0 )
|
|
|
|
|
{
|
2012-09-15 19:47:19 +00:00
|
|
|
|
pc->SetState(STATE_CHECK, m_engine->GetLensMode());
|
2012-06-26 20:23:05 +00:00
|
|
|
|
}
|
|
|
|
|
|
2012-09-18 20:33:28 +00:00
|
|
|
|
pc = static_cast<CCheck*>(pw->SearchControl(EVENT_INTERFACE_SKY));
|
2012-06-26 20:23:05 +00:00
|
|
|
|
if ( pc != 0 )
|
|
|
|
|
{
|
2012-09-15 19:47:19 +00:00
|
|
|
|
pc->SetState(STATE_CHECK, m_engine->GetSkyMode());
|
2012-06-26 20:23:05 +00:00
|
|
|
|
}
|
|
|
|
|
|
2012-09-18 20:33:28 +00:00
|
|
|
|
pc = static_cast<CCheck*>(pw->SearchControl(EVENT_INTERFACE_PLANET));
|
2012-06-26 20:23:05 +00:00
|
|
|
|
if ( pc != 0 )
|
|
|
|
|
{
|
2012-09-15 19:47:19 +00:00
|
|
|
|
pc->SetState(STATE_CHECK, m_engine->GetPlanetMode());
|
2012-06-26 20:23:05 +00:00
|
|
|
|
}
|
|
|
|
|
|
2012-09-18 20:33:28 +00:00
|
|
|
|
pc = static_cast<CCheck*>(pw->SearchControl(EVENT_INTERFACE_LIGHT));
|
2012-06-26 20:23:05 +00:00
|
|
|
|
if ( pc != 0 )
|
|
|
|
|
{
|
2012-09-15 19:47:19 +00:00
|
|
|
|
pc->SetState(STATE_CHECK, m_engine->GetLightMode());
|
2012-06-26 20:23:05 +00:00
|
|
|
|
}
|
|
|
|
|
|
2012-09-18 20:33:28 +00:00
|
|
|
|
pc = static_cast<CCheck*>(pw->SearchControl(EVENT_INTERFACE_JOYSTICK));
|
2012-06-26 20:23:05 +00:00
|
|
|
|
if ( pc != 0 )
|
|
|
|
|
{
|
2015-07-09 22:02:39 +00:00
|
|
|
|
pc->SetState(STATE_ENABLE, m_app->GetJoystick().index >= 0);
|
2012-09-15 19:47:19 +00:00
|
|
|
|
pc->SetState(STATE_CHECK, m_app->GetJoystickEnabled());
|
2012-06-26 20:23:05 +00:00
|
|
|
|
}
|
|
|
|
|
|
2012-09-18 20:33:28 +00:00
|
|
|
|
pv = static_cast<CEditValue*>(pw->SearchControl(EVENT_INTERFACE_PARTI));
|
2012-06-26 20:23:05 +00:00
|
|
|
|
if ( pv != 0 )
|
|
|
|
|
{
|
2012-09-15 19:47:19 +00:00
|
|
|
|
value = m_engine->GetParticleDensity();
|
2012-06-26 20:23:05 +00:00
|
|
|
|
pv->SetValue(value);
|
|
|
|
|
}
|
|
|
|
|
|
2012-09-18 20:33:28 +00:00
|
|
|
|
pv = static_cast<CEditValue*>(pw->SearchControl(EVENT_INTERFACE_CLIP));
|
2012-06-26 20:23:05 +00:00
|
|
|
|
if ( pv != 0 )
|
|
|
|
|
{
|
2012-09-15 19:47:19 +00:00
|
|
|
|
value = m_engine->GetClippingDistance();
|
2012-06-26 20:23:05 +00:00
|
|
|
|
pv->SetValue(value);
|
|
|
|
|
}
|
|
|
|
|
|
2012-09-18 20:33:28 +00:00
|
|
|
|
pv = static_cast<CEditValue*>(pw->SearchControl(EVENT_INTERFACE_DETAIL));
|
2012-06-26 20:23:05 +00:00
|
|
|
|
if ( pv != 0 )
|
|
|
|
|
{
|
2012-09-15 19:47:19 +00:00
|
|
|
|
value = m_engine->GetObjectDetail();
|
2012-06-26 20:23:05 +00:00
|
|
|
|
pv->SetValue(value);
|
|
|
|
|
}
|
|
|
|
|
|
2012-09-18 20:33:28 +00:00
|
|
|
|
pv = static_cast<CEditValue*>(pw->SearchControl(EVENT_INTERFACE_GADGET));
|
2012-06-26 20:23:05 +00:00
|
|
|
|
if ( pv != 0 )
|
|
|
|
|
{
|
2012-09-15 19:47:19 +00:00
|
|
|
|
value = m_engine->GetGadgetQuantity();
|
2012-06-26 20:23:05 +00:00
|
|
|
|
pv->SetValue(value);
|
|
|
|
|
}
|
|
|
|
|
|
2012-09-18 20:33:28 +00:00
|
|
|
|
pv = static_cast<CEditValue*>(pw->SearchControl(EVENT_INTERFACE_TEXTURE));
|
2012-06-26 20:23:05 +00:00
|
|
|
|
if ( pv != 0 )
|
|
|
|
|
{
|
2012-09-18 20:33:28 +00:00
|
|
|
|
value = static_cast<float>(m_engine->GetTextureQuality());
|
2012-06-26 20:23:05 +00:00
|
|
|
|
pv->SetValue(value);
|
|
|
|
|
}
|
|
|
|
|
|
2012-09-18 20:33:28 +00:00
|
|
|
|
ps = static_cast<CSlider*>(pw->SearchControl(EVENT_INTERFACE_VOLSOUND));
|
2012-06-26 20:23:05 +00:00
|
|
|
|
if ( ps != 0 )
|
|
|
|
|
{
|
2012-09-18 20:33:28 +00:00
|
|
|
|
value = static_cast<float>(m_sound->GetAudioVolume());
|
2012-06-26 20:23:05 +00:00
|
|
|
|
ps->SetVisibleValue(value);
|
|
|
|
|
}
|
|
|
|
|
|
2012-09-18 20:33:28 +00:00
|
|
|
|
ps = static_cast<CSlider*>(pw->SearchControl(EVENT_INTERFACE_VOLMUSIC));
|
2012-06-26 20:23:05 +00:00
|
|
|
|
if ( ps != 0 )
|
|
|
|
|
{
|
2012-12-25 20:36:50 +00:00
|
|
|
|
value = static_cast<float>(m_sound->GetMusicVolume());
|
|
|
|
|
ps->SetVisibleValue(value);
|
2012-06-26 20:23:05 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Updates the engine function of the buttons after the setup phase.
|
|
|
|
|
|
|
|
|
|
void CMainDialog::ChangeSetupButtons()
|
|
|
|
|
{
|
|
|
|
|
CWindow* pw;
|
|
|
|
|
CEditValue* pv;
|
|
|
|
|
CSlider* ps;
|
|
|
|
|
float value;
|
|
|
|
|
|
2012-09-18 20:33:28 +00:00
|
|
|
|
pw = static_cast<CWindow*>(m_interface->SearchControl(EVENT_WINDOW5));
|
2012-06-26 20:23:05 +00:00
|
|
|
|
if ( pw == 0 ) return;
|
|
|
|
|
|
2012-09-18 20:33:28 +00:00
|
|
|
|
pv = static_cast<CEditValue*>(pw->SearchControl(EVENT_INTERFACE_PARTI));
|
2012-06-26 20:23:05 +00:00
|
|
|
|
if ( pv != 0 )
|
|
|
|
|
{
|
2012-09-15 19:47:19 +00:00
|
|
|
|
value = pv->GetValue();
|
|
|
|
|
m_engine->SetParticleDensity(value);
|
2012-06-26 20:23:05 +00:00
|
|
|
|
}
|
|
|
|
|
|
2012-09-18 20:33:28 +00:00
|
|
|
|
pv = static_cast<CEditValue*>(pw->SearchControl(EVENT_INTERFACE_CLIP));
|
2012-06-26 20:23:05 +00:00
|
|
|
|
if ( pv != 0 )
|
|
|
|
|
{
|
2012-09-15 19:47:19 +00:00
|
|
|
|
value = pv->GetValue();
|
2012-06-26 20:23:05 +00:00
|
|
|
|
m_engine->SetClippingDistance(value);
|
|
|
|
|
}
|
|
|
|
|
|
2012-09-18 20:33:28 +00:00
|
|
|
|
pv = static_cast<CEditValue*>(pw->SearchControl(EVENT_INTERFACE_DETAIL));
|
2012-06-26 20:23:05 +00:00
|
|
|
|
if ( pv != 0 )
|
|
|
|
|
{
|
2012-09-15 19:47:19 +00:00
|
|
|
|
value = pv->GetValue();
|
2012-06-26 20:23:05 +00:00
|
|
|
|
m_engine->SetObjectDetail(value);
|
|
|
|
|
}
|
|
|
|
|
|
2012-09-18 20:33:28 +00:00
|
|
|
|
pv = static_cast<CEditValue*>(pw->SearchControl(EVENT_INTERFACE_GADGET));
|
2012-06-26 20:23:05 +00:00
|
|
|
|
if ( pv != 0 )
|
|
|
|
|
{
|
2012-09-15 19:47:19 +00:00
|
|
|
|
value = pv->GetValue();
|
2012-06-26 20:23:05 +00:00
|
|
|
|
m_engine->SetGadgetQuantity(value);
|
|
|
|
|
}
|
|
|
|
|
|
2012-09-18 20:33:28 +00:00
|
|
|
|
pv = static_cast<CEditValue*>(pw->SearchControl(EVENT_INTERFACE_TEXTURE));
|
2012-06-26 20:23:05 +00:00
|
|
|
|
if ( pv != 0 )
|
|
|
|
|
{
|
2012-09-15 19:47:19 +00:00
|
|
|
|
value = pv->GetValue();
|
2012-09-18 20:33:28 +00:00
|
|
|
|
m_engine->SetTextureQuality(static_cast<int>(value));
|
2012-06-26 20:23:05 +00:00
|
|
|
|
}
|
|
|
|
|
|
2012-09-18 20:33:28 +00:00
|
|
|
|
ps = static_cast<CSlider*>(pw->SearchControl(EVENT_INTERFACE_VOLSOUND));
|
2012-06-26 20:23:05 +00:00
|
|
|
|
if ( ps != 0 )
|
|
|
|
|
{
|
2012-09-15 19:47:19 +00:00
|
|
|
|
value = ps->GetVisibleValue();
|
2012-09-18 20:33:28 +00:00
|
|
|
|
m_sound->SetAudioVolume(static_cast<int>(value));
|
2012-06-26 20:23:05 +00:00
|
|
|
|
}
|
|
|
|
|
|
2012-09-18 20:33:28 +00:00
|
|
|
|
ps = static_cast<CSlider*>(pw->SearchControl(EVENT_INTERFACE_VOLMUSIC));
|
2012-06-26 20:23:05 +00:00
|
|
|
|
if ( ps != 0 )
|
|
|
|
|
{
|
2012-09-15 19:47:19 +00:00
|
|
|
|
value = ps->GetVisibleValue();
|
2013-01-14 21:55:16 +00:00
|
|
|
|
m_sound->SetMusicVolume(static_cast<int>(value));
|
2012-06-26 20:23:05 +00:00
|
|
|
|
}
|
2015-06-21 18:59:23 +00:00
|
|
|
|
|
2014-11-11 13:50:44 +00:00
|
|
|
|
ps = static_cast<CSlider*>(pw->SearchControl(EVENT_INTERFACE_AUTOSAVE_INTERVAL));
|
|
|
|
|
if ( ps != 0 )
|
|
|
|
|
{
|
|
|
|
|
value = ps->GetVisibleValue();
|
|
|
|
|
m_main->SetAutosaveInterval(static_cast<int>(value));
|
|
|
|
|
}
|
2015-06-21 18:59:23 +00:00
|
|
|
|
|
2014-11-11 13:50:44 +00:00
|
|
|
|
ps = static_cast<CSlider*>(pw->SearchControl(EVENT_INTERFACE_AUTOSAVE_SLOTS));
|
|
|
|
|
if ( ps != 0 )
|
|
|
|
|
{
|
|
|
|
|
value = ps->GetVisibleValue();
|
|
|
|
|
m_main->SetAutosaveSlots(static_cast<int>(value));
|
|
|
|
|
}
|
2012-06-26 20:23:05 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Memorizes all the settings.
|
|
|
|
|
|
|
|
|
|
void CMainDialog::SetupMemorize()
|
|
|
|
|
{
|
2014-08-12 19:24:33 +00:00
|
|
|
|
GetProfile().SetStringProperty("Directory", "savegame", m_savegameDir);
|
|
|
|
|
GetProfile().SetStringProperty("Directory", "public", m_publicDir);
|
|
|
|
|
GetProfile().SetStringProperty("Directory", "files", m_filesDir);
|
|
|
|
|
GetProfile().SetIntProperty("Setup", "Tooltips", m_bTooltip);
|
|
|
|
|
GetProfile().SetIntProperty("Setup", "InterfaceGlint", m_bGlint);
|
|
|
|
|
GetProfile().SetIntProperty("Setup", "InterfaceGlint", m_bRain);
|
|
|
|
|
GetProfile().SetIntProperty("Setup", "Soluce4", m_bSoluce4);
|
|
|
|
|
GetProfile().SetIntProperty("Setup", "Movies", m_bMovies);
|
|
|
|
|
GetProfile().SetIntProperty("Setup", "NiceReset", m_bNiceReset);
|
|
|
|
|
GetProfile().SetIntProperty("Setup", "HimselfDamage", m_bHimselfDamage);
|
|
|
|
|
GetProfile().SetIntProperty("Setup", "CameraScroll", m_bCameraScroll);
|
|
|
|
|
GetProfile().SetIntProperty("Setup", "CameraInvertX", m_bCameraInvertX);
|
|
|
|
|
GetProfile().SetIntProperty("Setup", "CameraInvertY", m_bCameraInvertY);
|
|
|
|
|
GetProfile().SetIntProperty("Setup", "InterfaceEffect", m_bEffect);
|
2014-10-22 15:52:17 +00:00
|
|
|
|
GetProfile().SetIntProperty("Setup", "Blood", m_bBlood);
|
2014-11-11 13:50:44 +00:00
|
|
|
|
GetProfile().SetIntProperty("Setup", "Autosave", m_bAutosave);
|
|
|
|
|
GetProfile().SetIntProperty("Setup", "AutosaveInterval", m_main->GetAutosaveInterval());
|
|
|
|
|
GetProfile().SetIntProperty("Setup", "AutosaveSlots", m_main->GetAutosaveSlots());
|
2014-08-12 19:24:33 +00:00
|
|
|
|
GetProfile().SetIntProperty("Setup", "GroundShadow", m_engine->GetShadow());
|
|
|
|
|
GetProfile().SetIntProperty("Setup", "GroundSpot", m_engine->GetGroundSpot());
|
|
|
|
|
GetProfile().SetIntProperty("Setup", "ObjectDirty", m_engine->GetDirty());
|
|
|
|
|
GetProfile().SetIntProperty("Setup", "FogMode", m_engine->GetFog());
|
|
|
|
|
GetProfile().SetIntProperty("Setup", "LensMode", m_engine->GetLensMode());
|
|
|
|
|
GetProfile().SetIntProperty("Setup", "SkyMode", m_engine->GetSkyMode());
|
|
|
|
|
GetProfile().SetIntProperty("Setup", "PlanetMode", m_engine->GetPlanetMode());
|
|
|
|
|
GetProfile().SetIntProperty("Setup", "LightMode", m_engine->GetLightMode());
|
2015-07-09 22:02:39 +00:00
|
|
|
|
GetProfile().SetIntProperty("Setup", "UseJoystick", m_app->GetJoystickEnabled() ? m_app->GetJoystick().index : -1);
|
2014-08-12 19:24:33 +00:00
|
|
|
|
GetProfile().SetFloatProperty("Setup", "ParticleDensity", m_engine->GetParticleDensity());
|
|
|
|
|
GetProfile().SetFloatProperty("Setup", "ClippingDistance", m_engine->GetClippingDistance());
|
|
|
|
|
GetProfile().SetFloatProperty("Setup", "ObjectDetail", m_engine->GetObjectDetail());
|
|
|
|
|
GetProfile().SetFloatProperty("Setup", "GadgetQuantity", m_engine->GetGadgetQuantity());
|
|
|
|
|
GetProfile().SetIntProperty("Setup", "TextureQuality", m_engine->GetTextureQuality());
|
|
|
|
|
GetProfile().SetIntProperty("Setup", "TotoMode", m_engine->GetTotoMode());
|
|
|
|
|
GetProfile().SetIntProperty("Setup", "AudioVolume", m_sound->GetAudioVolume());
|
|
|
|
|
GetProfile().SetIntProperty("Setup", "MusicVolume", m_sound->GetMusicVolume());
|
|
|
|
|
GetProfile().SetIntProperty("Setup", "EditIndentMode", m_engine->GetEditIndentMode());
|
|
|
|
|
GetProfile().SetIntProperty("Setup", "EditIndentValue", m_engine->GetEditIndentValue());
|
2015-07-13 10:11:11 +00:00
|
|
|
|
GetProfile().SetIntProperty("Setup", "SystemMouse", m_app->GetMouseMode() == MOUSE_SYSTEM);
|
2013-05-26 15:47:54 +00:00
|
|
|
|
|
2015-06-15 16:41:31 +00:00
|
|
|
|
GetProfile().SetIntProperty("Setup", "MipmapLevel", m_engine->GetTextureMipmapLevel());
|
|
|
|
|
GetProfile().SetIntProperty("Setup", "Anisotropy", m_engine->GetTextureAnisotropyLevel());
|
|
|
|
|
GetProfile().SetFloatProperty("Setup", "ShadowColor", m_engine->GetShadowColor());
|
|
|
|
|
GetProfile().SetFloatProperty("Setup", "ShadowRange", m_engine->GetShadowRange());
|
|
|
|
|
|
2012-12-25 20:36:50 +00:00
|
|
|
|
/* screen setup */
|
2015-06-15 16:41:31 +00:00
|
|
|
|
GetProfile().SetIntProperty("Setup", "Fullscreen", m_setupFull ? 1 : 0);
|
2013-05-26 15:47:54 +00:00
|
|
|
|
|
2012-12-25 20:36:50 +00:00
|
|
|
|
CList *pl;
|
|
|
|
|
CWindow *pw;
|
|
|
|
|
pw = static_cast<CWindow *>(m_interface->SearchControl(EVENT_WINDOW5));
|
2013-05-26 15:47:54 +00:00
|
|
|
|
if ( pw != 0 )
|
|
|
|
|
{
|
|
|
|
|
pl = static_cast<CList *>(pw->SearchControl(EVENT_LIST2));
|
|
|
|
|
if ( pl != 0 )
|
|
|
|
|
{
|
2015-03-19 18:42:01 +00:00
|
|
|
|
std::vector<Math::IntPoint> modes;
|
|
|
|
|
m_app->GetVideoResolutionList(modes, true, true);
|
|
|
|
|
std::ostringstream ss;
|
|
|
|
|
ss << modes[m_setupSelMode].x << "x" << modes[m_setupSelMode].y;
|
|
|
|
|
GetProfile().SetStringProperty("Setup", "Resolution", ss.str());
|
2013-05-26 15:47:54 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2015-07-10 08:08:45 +00:00
|
|
|
|
CInput::GetInstancePointer()->SaveKeyBindings();
|
2012-06-26 20:23:05 +00:00
|
|
|
|
|
2014-08-12 19:24:33 +00:00
|
|
|
|
GetProfile().SetIntProperty("Setup", "DeleteGamer", m_bDeleteGamer);
|
2012-06-26 20:23:05 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Remember all the settings.
|
|
|
|
|
|
|
|
|
|
void CMainDialog::SetupRecall()
|
|
|
|
|
{
|
2012-10-02 19:44:14 +00:00
|
|
|
|
float fValue;
|
2012-10-06 22:46:46 +00:00
|
|
|
|
int iValue;
|
2012-10-02 19:44:14 +00:00
|
|
|
|
std::string key;
|
2012-06-26 20:23:05 +00:00
|
|
|
|
|
2014-08-12 19:24:33 +00:00
|
|
|
|
if ( GetProfile().GetStringProperty("Directory", "savegame", key) )
|
2012-06-26 20:23:05 +00:00
|
|
|
|
{
|
2012-10-02 19:44:14 +00:00
|
|
|
|
m_savegameDir = key;
|
2012-06-26 20:23:05 +00:00
|
|
|
|
}
|
|
|
|
|
|
2014-08-12 19:24:33 +00:00
|
|
|
|
if ( GetProfile().GetStringProperty("Directory", "public", key) )
|
2012-06-26 20:23:05 +00:00
|
|
|
|
{
|
2012-10-02 19:44:14 +00:00
|
|
|
|
m_publicDir = key;
|
2012-06-26 20:23:05 +00:00
|
|
|
|
}
|
|
|
|
|
|
2014-08-12 19:24:33 +00:00
|
|
|
|
if ( GetProfile().GetStringProperty("Directory", "files", key) )
|
2012-06-26 20:23:05 +00:00
|
|
|
|
{
|
2012-10-02 19:44:14 +00:00
|
|
|
|
m_filesDir = key;
|
2012-06-26 20:23:05 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2014-08-12 19:24:33 +00:00
|
|
|
|
if ( GetProfile().GetIntProperty("Setup", "TotoMode", iValue) )
|
2012-06-26 20:23:05 +00:00
|
|
|
|
{
|
|
|
|
|
m_engine->SetTotoMode(iValue);
|
|
|
|
|
}
|
|
|
|
|
|
2014-08-12 19:24:33 +00:00
|
|
|
|
if ( GetProfile().GetIntProperty("Setup", "Tooltips", iValue) )
|
2012-06-26 20:23:05 +00:00
|
|
|
|
{
|
|
|
|
|
m_bTooltip = iValue;
|
|
|
|
|
}
|
|
|
|
|
|
2014-08-12 19:24:33 +00:00
|
|
|
|
if ( GetProfile().GetIntProperty("Setup", "InterfaceGlint", iValue) )
|
2012-06-26 20:23:05 +00:00
|
|
|
|
{
|
|
|
|
|
m_bGlint = iValue;
|
|
|
|
|
}
|
|
|
|
|
|
2014-08-12 19:24:33 +00:00
|
|
|
|
if ( GetProfile().GetIntProperty("Setup", "InterfaceGlint", iValue) )
|
2012-06-26 20:23:05 +00:00
|
|
|
|
{
|
|
|
|
|
m_bRain = iValue;
|
|
|
|
|
}
|
|
|
|
|
|
2015-07-13 10:11:11 +00:00
|
|
|
|
if ( GetProfile().GetIntProperty("Setup", "SystemMouse", iValue) )
|
|
|
|
|
{
|
|
|
|
|
m_app->SetMouseMode(iValue ? MOUSE_SYSTEM : MOUSE_ENGINE);
|
|
|
|
|
}
|
|
|
|
|
|
2014-08-12 19:24:33 +00:00
|
|
|
|
if ( GetProfile().GetIntProperty("Setup", "Soluce4", iValue) )
|
2012-06-26 20:23:05 +00:00
|
|
|
|
{
|
|
|
|
|
m_bSoluce4 = iValue;
|
|
|
|
|
}
|
|
|
|
|
|
2014-08-12 19:24:33 +00:00
|
|
|
|
if ( GetProfile().GetIntProperty("Setup", "Movies", iValue) )
|
2012-06-26 20:23:05 +00:00
|
|
|
|
{
|
|
|
|
|
m_bMovies = iValue;
|
|
|
|
|
}
|
|
|
|
|
|
2014-08-12 19:24:33 +00:00
|
|
|
|
if ( GetProfile().GetIntProperty("Setup", "NiceReset", iValue) )
|
2012-06-26 20:23:05 +00:00
|
|
|
|
{
|
|
|
|
|
m_bNiceReset = iValue;
|
|
|
|
|
}
|
|
|
|
|
|
2014-08-12 19:24:33 +00:00
|
|
|
|
if ( GetProfile().GetIntProperty("Setup", "HimselfDamage", iValue) )
|
2012-06-26 20:23:05 +00:00
|
|
|
|
{
|
|
|
|
|
m_bHimselfDamage = iValue;
|
|
|
|
|
}
|
|
|
|
|
|
2014-08-12 19:24:33 +00:00
|
|
|
|
if ( GetProfile().GetIntProperty("Setup", "CameraScroll", iValue) )
|
2012-06-26 20:23:05 +00:00
|
|
|
|
{
|
|
|
|
|
m_bCameraScroll = iValue;
|
|
|
|
|
m_camera->SetCameraScroll(m_bCameraScroll);
|
|
|
|
|
}
|
|
|
|
|
|
2014-08-12 19:24:33 +00:00
|
|
|
|
if ( GetProfile().GetIntProperty("Setup", "CameraInvertX", iValue) )
|
2012-06-26 20:23:05 +00:00
|
|
|
|
{
|
|
|
|
|
m_bCameraInvertX = iValue;
|
|
|
|
|
m_camera->SetCameraInvertX(m_bCameraInvertX);
|
|
|
|
|
}
|
|
|
|
|
|
2014-08-12 19:24:33 +00:00
|
|
|
|
if ( GetProfile().GetIntProperty("Setup", "CameraInvertY", iValue) )
|
2012-06-26 20:23:05 +00:00
|
|
|
|
{
|
|
|
|
|
m_bCameraInvertY = iValue;
|
|
|
|
|
m_camera->SetCameraInvertY(m_bCameraInvertY);
|
|
|
|
|
}
|
|
|
|
|
|
2014-08-12 19:24:33 +00:00
|
|
|
|
if ( GetProfile().GetIntProperty("Setup", "InterfaceEffect", iValue) )
|
2012-06-26 20:23:05 +00:00
|
|
|
|
{
|
|
|
|
|
m_bEffect = iValue;
|
|
|
|
|
}
|
|
|
|
|
|
2014-10-22 15:52:17 +00:00
|
|
|
|
if ( GetProfile().GetIntProperty("Setup", "Blood", iValue) )
|
2014-10-22 04:44:17 +00:00
|
|
|
|
{
|
|
|
|
|
m_bBlood = iValue;
|
|
|
|
|
}
|
2015-06-21 18:59:23 +00:00
|
|
|
|
|
2014-11-11 13:50:44 +00:00
|
|
|
|
if ( GetProfile().GetIntProperty("Setup", "Autosave", iValue) )
|
|
|
|
|
{
|
|
|
|
|
m_bAutosave = iValue;
|
|
|
|
|
}
|
2015-06-21 18:59:23 +00:00
|
|
|
|
|
2014-11-11 13:50:44 +00:00
|
|
|
|
if ( GetProfile().GetIntProperty("Setup", "AutosaveInterval", iValue) )
|
|
|
|
|
{
|
|
|
|
|
m_main->SetAutosaveInterval(iValue);
|
|
|
|
|
}
|
2015-06-21 18:59:23 +00:00
|
|
|
|
|
2014-11-11 13:50:44 +00:00
|
|
|
|
if ( GetProfile().GetIntProperty("Setup", "AutosaveSlots", iValue) )
|
|
|
|
|
{
|
|
|
|
|
m_main->SetAutosaveSlots(iValue);
|
|
|
|
|
}
|
2015-06-21 18:59:23 +00:00
|
|
|
|
|
2014-08-12 19:24:33 +00:00
|
|
|
|
if ( GetProfile().GetIntProperty("Setup", "GroundShadow", iValue) )
|
2012-06-26 20:23:05 +00:00
|
|
|
|
{
|
|
|
|
|
m_engine->SetShadow(iValue);
|
|
|
|
|
}
|
|
|
|
|
|
2014-08-12 19:24:33 +00:00
|
|
|
|
if ( GetProfile().GetIntProperty("Setup", "GroundSpot", iValue) )
|
2012-06-26 20:23:05 +00:00
|
|
|
|
{
|
|
|
|
|
m_engine->SetGroundSpot(iValue);
|
|
|
|
|
}
|
|
|
|
|
|
2014-08-12 19:24:33 +00:00
|
|
|
|
if ( GetProfile().GetIntProperty("Setup", "ObjectDirty", iValue) )
|
2012-06-26 20:23:05 +00:00
|
|
|
|
{
|
|
|
|
|
m_engine->SetDirty(iValue);
|
|
|
|
|
}
|
|
|
|
|
|
2014-08-12 19:24:33 +00:00
|
|
|
|
if ( GetProfile().GetIntProperty("Setup", "FogMode", iValue) )
|
2012-06-26 20:23:05 +00:00
|
|
|
|
{
|
|
|
|
|
m_engine->SetFog(iValue);
|
2012-10-02 19:44:14 +00:00
|
|
|
|
m_camera->SetOverBaseColor(Gfx::Color(0.0f, 0.0f, 0.0f, 0.0f)); // TODO: color ok?
|
2012-06-26 20:23:05 +00:00
|
|
|
|
}
|
|
|
|
|
|
2014-08-12 19:24:33 +00:00
|
|
|
|
if ( GetProfile().GetIntProperty("Setup", "LensMode", iValue) )
|
2012-06-26 20:23:05 +00:00
|
|
|
|
{
|
|
|
|
|
m_engine->SetLensMode(iValue);
|
|
|
|
|
}
|
|
|
|
|
|
2014-08-12 19:24:33 +00:00
|
|
|
|
if ( GetProfile().GetIntProperty("Setup", "SkyMode", iValue) )
|
2012-06-26 20:23:05 +00:00
|
|
|
|
{
|
|
|
|
|
m_engine->SetSkyMode(iValue);
|
|
|
|
|
}
|
|
|
|
|
|
2014-08-12 19:24:33 +00:00
|
|
|
|
if ( GetProfile().GetIntProperty("Setup", "PlanetMode", iValue) )
|
2012-06-26 20:23:05 +00:00
|
|
|
|
{
|
|
|
|
|
m_engine->SetPlanetMode(iValue);
|
|
|
|
|
}
|
|
|
|
|
|
2014-08-12 19:24:33 +00:00
|
|
|
|
if ( GetProfile().GetIntProperty("Setup", "LightMode", iValue) )
|
2012-06-26 20:23:05 +00:00
|
|
|
|
{
|
|
|
|
|
m_engine->SetLightMode(iValue);
|
|
|
|
|
}
|
2015-07-09 22:02:39 +00:00
|
|
|
|
|
|
|
|
|
if ( GetProfile().GetIntProperty("Setup", "UseJoystick", iValue) )
|
|
|
|
|
{
|
|
|
|
|
if(iValue >= 0)
|
|
|
|
|
{
|
|
|
|
|
auto joysticks = m_app->GetJoystickList();
|
|
|
|
|
for(const auto& joystick : joysticks)
|
|
|
|
|
{
|
|
|
|
|
if (joystick.index == iValue)
|
|
|
|
|
{
|
|
|
|
|
m_app->ChangeJoystick(joystick);
|
|
|
|
|
m_app->SetJoystickEnabled(true);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
m_app->SetJoystickEnabled(false);
|
|
|
|
|
}
|
|
|
|
|
}
|
2012-06-26 20:23:05 +00:00
|
|
|
|
|
2014-08-12 19:24:33 +00:00
|
|
|
|
if ( GetProfile().GetFloatProperty("Setup", "ParticleDensity", fValue) )
|
2012-06-26 20:23:05 +00:00
|
|
|
|
{
|
2012-09-15 19:47:19 +00:00
|
|
|
|
m_engine->SetParticleDensity(fValue);
|
2012-06-26 20:23:05 +00:00
|
|
|
|
}
|
|
|
|
|
|
2014-08-12 19:24:33 +00:00
|
|
|
|
if ( GetProfile().GetFloatProperty("Setup", "ClippingDistance", fValue) )
|
2012-06-26 20:23:05 +00:00
|
|
|
|
{
|
|
|
|
|
m_engine->SetClippingDistance(fValue);
|
|
|
|
|
}
|
|
|
|
|
|
2014-08-12 19:24:33 +00:00
|
|
|
|
if ( GetProfile().GetFloatProperty("Setup", "ObjectDetail", fValue) )
|
2012-06-26 20:23:05 +00:00
|
|
|
|
{
|
|
|
|
|
m_engine->SetObjectDetail(fValue);
|
|
|
|
|
}
|
|
|
|
|
|
2014-08-12 19:24:33 +00:00
|
|
|
|
if ( GetProfile().GetFloatProperty("Setup", "GadgetQuantity", fValue) )
|
2012-06-26 20:23:05 +00:00
|
|
|
|
{
|
|
|
|
|
m_engine->SetGadgetQuantity(fValue);
|
|
|
|
|
}
|
|
|
|
|
|
2014-08-12 19:24:33 +00:00
|
|
|
|
if ( GetProfile().GetIntProperty("Setup", "TextureQuality", iValue) )
|
2012-06-26 20:23:05 +00:00
|
|
|
|
{
|
|
|
|
|
m_engine->SetTextureQuality(iValue);
|
|
|
|
|
}
|
|
|
|
|
|
2014-08-12 19:24:33 +00:00
|
|
|
|
if ( GetProfile().GetIntProperty("Setup", "AudioVolume", iValue) )
|
2012-06-26 20:23:05 +00:00
|
|
|
|
{
|
|
|
|
|
m_sound->SetAudioVolume(iValue);
|
|
|
|
|
}
|
|
|
|
|
|
2014-08-12 19:24:33 +00:00
|
|
|
|
if ( GetProfile().GetIntProperty("Setup", "MusicVolume", iValue) )
|
2012-12-25 20:36:50 +00:00
|
|
|
|
{
|
|
|
|
|
m_sound->SetMusicVolume(iValue);
|
|
|
|
|
}
|
2013-05-26 15:47:54 +00:00
|
|
|
|
|
2014-08-12 19:24:33 +00:00
|
|
|
|
if ( GetProfile().GetIntProperty("Setup", "EditIndentMode", iValue) )
|
2012-06-26 20:23:05 +00:00
|
|
|
|
{
|
|
|
|
|
m_engine->SetEditIndentMode(iValue);
|
|
|
|
|
}
|
|
|
|
|
|
2014-08-12 19:24:33 +00:00
|
|
|
|
if ( GetProfile().GetIntProperty("Setup", "EditIndentValue", iValue) )
|
2012-06-26 20:23:05 +00:00
|
|
|
|
{
|
|
|
|
|
m_engine->SetEditIndentValue(iValue);
|
|
|
|
|
}
|
|
|
|
|
|
2015-07-10 08:08:45 +00:00
|
|
|
|
CInput::GetInstancePointer()->LoadKeyBindings();
|
2012-10-02 19:44:14 +00:00
|
|
|
|
|
2014-08-12 19:24:33 +00:00
|
|
|
|
if ( GetProfile().GetIntProperty("Setup", "DeleteGamer", iValue) )
|
2012-06-26 20:23:05 +00:00
|
|
|
|
{
|
|
|
|
|
m_bDeleteGamer = iValue;
|
2012-10-02 19:44:14 +00:00
|
|
|
|
}
|
2013-05-26 15:47:54 +00:00
|
|
|
|
|
2015-03-19 18:42:01 +00:00
|
|
|
|
if ( GetProfile().GetStringProperty("Setup", "Resolution", key) )
|
2013-05-26 15:47:54 +00:00
|
|
|
|
{
|
2015-03-19 18:42:01 +00:00
|
|
|
|
std::istringstream resolution(key);
|
|
|
|
|
std::string ws, hs;
|
|
|
|
|
std::getline(resolution, ws, 'x');
|
|
|
|
|
std::getline(resolution, hs, 'x');
|
|
|
|
|
int w = 800, h = 600;
|
2015-06-21 18:59:23 +00:00
|
|
|
|
if (!ws.empty() && !hs.empty())
|
|
|
|
|
{
|
2015-03-19 18:42:01 +00:00
|
|
|
|
w = atoi(ws.c_str());
|
|
|
|
|
h = atoi(hs.c_str());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
std::vector<Math::IntPoint> modes;
|
|
|
|
|
m_app->GetVideoResolutionList(modes, true, true);
|
2015-06-21 18:59:23 +00:00
|
|
|
|
for (auto it = modes.begin(); it != modes.end(); ++it)
|
|
|
|
|
{
|
|
|
|
|
if (it->x == w && it->y == h)
|
|
|
|
|
{
|
2015-03-19 18:42:01 +00:00
|
|
|
|
m_setupSelMode = it - modes.begin();
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
2012-12-25 20:36:50 +00:00
|
|
|
|
}
|
2013-05-26 15:47:54 +00:00
|
|
|
|
|
2014-08-12 19:24:33 +00:00
|
|
|
|
if ( GetProfile().GetIntProperty("Setup", "Fullscreen", iValue) )
|
2013-05-26 15:47:54 +00:00
|
|
|
|
{
|
|
|
|
|
m_setupFull = (iValue == 1);
|
2012-12-25 20:36:50 +00:00
|
|
|
|
}
|
2015-06-15 16:41:31 +00:00
|
|
|
|
|
|
|
|
|
if ( GetProfile().GetIntProperty("Setup", "MipmapLevel", iValue))
|
|
|
|
|
{
|
|
|
|
|
m_engine->SetTextureMipmapLevel(iValue);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (GetProfile().GetIntProperty("Setup", "Anisotropy", iValue))
|
|
|
|
|
{
|
|
|
|
|
m_engine->SetTextureAnisotropyLevel(iValue);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (GetProfile().GetFloatProperty("Setup", "ShadowColor", fValue))
|
|
|
|
|
{
|
|
|
|
|
m_engine->SetShadowColor(fValue);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (GetProfile().GetFloatProperty("Setup", "ShadowRange", fValue))
|
|
|
|
|
{
|
|
|
|
|
m_engine->SetShadowRange(fValue);
|
|
|
|
|
}
|
2012-06-26 20:23:05 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Changes the general level of quality.
|
|
|
|
|
|
|
|
|
|
void CMainDialog::ChangeSetupQuality(int quality)
|
|
|
|
|
{
|
|
|
|
|
bool bEnable;
|
|
|
|
|
float value;
|
|
|
|
|
int iValue;
|
|
|
|
|
|
|
|
|
|
bEnable = (quality >= 0);
|
|
|
|
|
m_engine->SetShadow(bEnable);
|
|
|
|
|
m_engine->SetGroundSpot(bEnable);
|
|
|
|
|
m_engine->SetDirty(bEnable);
|
|
|
|
|
m_engine->SetFog(bEnable);
|
|
|
|
|
m_engine->SetLensMode(bEnable);
|
|
|
|
|
m_engine->SetSkyMode(bEnable);
|
|
|
|
|
m_engine->SetPlanetMode(bEnable);
|
|
|
|
|
m_engine->SetLightMode(bEnable);
|
2012-09-15 19:47:19 +00:00
|
|
|
|
m_camera->SetOverBaseColor(Gfx::Color(0.0f, 0.0f, 0.0f, 0.0f)); // TODO: color ok?
|
2012-06-26 20:23:05 +00:00
|
|
|
|
|
|
|
|
|
if ( quality < 0 ) value = 0.0f;
|
|
|
|
|
if ( quality == 0 ) value = 1.0f;
|
|
|
|
|
if ( quality > 0 ) value = 2.0f;
|
2012-09-15 19:47:19 +00:00
|
|
|
|
m_engine->SetParticleDensity(value);
|
2012-06-26 20:23:05 +00:00
|
|
|
|
|
|
|
|
|
if ( quality < 0 ) value = 0.5f;
|
|
|
|
|
if ( quality == 0 ) value = 1.0f;
|
|
|
|
|
if ( quality > 0 ) value = 2.0f;
|
|
|
|
|
m_engine->SetClippingDistance(value);
|
|
|
|
|
|
|
|
|
|
if ( quality < 0 ) value = 0.0f;
|
|
|
|
|
if ( quality == 0 ) value = 1.0f;
|
|
|
|
|
if ( quality > 0 ) value = 2.0f;
|
|
|
|
|
m_engine->SetObjectDetail(value);
|
|
|
|
|
|
|
|
|
|
if ( quality < 0 ) value = 0.5f;
|
|
|
|
|
if ( quality == 0 ) value = 1.0f;
|
|
|
|
|
if ( quality > 0 ) value = 1.0f;
|
|
|
|
|
m_engine->SetGadgetQuantity(value);
|
|
|
|
|
|
|
|
|
|
if ( quality < 0 ) iValue = 0;
|
|
|
|
|
if ( quality == 0 ) iValue = 1;
|
|
|
|
|
if ( quality > 0 ) iValue = 2;
|
|
|
|
|
m_engine->SetTextureQuality(iValue);
|
|
|
|
|
|
2012-09-15 19:47:19 +00:00
|
|
|
|
// TODO: first execute adapt?
|
|
|
|
|
//m_engine->FirstExecuteAdapt(false);
|
2012-06-26 20:23:05 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Updates the list of keys.
|
|
|
|
|
|
|
|
|
|
void CMainDialog::UpdateKey()
|
|
|
|
|
{
|
2012-10-06 22:46:46 +00:00
|
|
|
|
CWindow* pw = static_cast<CWindow*>(m_interface->SearchControl(EVENT_WINDOW5));
|
|
|
|
|
if (pw == nullptr) return;
|
2012-06-26 20:23:05 +00:00
|
|
|
|
|
2012-10-06 22:46:46 +00:00
|
|
|
|
CScroll* ps = static_cast<CScroll*>(pw->SearchControl(EVENT_INTERFACE_KSCROLL));
|
|
|
|
|
if (ps == nullptr) return;
|
2012-06-26 20:23:05 +00:00
|
|
|
|
|
2014-12-14 15:54:32 +00:00
|
|
|
|
int first = static_cast<int>(ps->GetVisibleValue()*(INPUT_SLOT_MAX-KEY_VISIBLE));
|
2012-06-26 20:23:05 +00:00
|
|
|
|
|
2014-12-14 15:54:32 +00:00
|
|
|
|
for (int i = 0; i < INPUT_SLOT_MAX; i++)
|
|
|
|
|
pw->DeleteControl(static_cast<EventType>(EVENT_INTERFACE_KEY+i));
|
2012-06-26 20:23:05 +00:00
|
|
|
|
|
2012-10-06 22:46:46 +00:00
|
|
|
|
Math::Point dim;
|
2012-06-26 20:23:05 +00:00
|
|
|
|
dim.x = 400.0f/640.0f;
|
|
|
|
|
dim.y = 20.0f/480.0f;
|
2012-10-06 22:46:46 +00:00
|
|
|
|
Math::Point pos;
|
2012-06-26 20:23:05 +00:00
|
|
|
|
pos.x = 110.0f/640.0f;
|
|
|
|
|
pos.y = 168.0f/480.0f + dim.y*(KEY_VISIBLE-1);
|
2012-10-06 22:46:46 +00:00
|
|
|
|
for (int i = 0; i < KEY_VISIBLE; i++)
|
2012-06-26 20:23:05 +00:00
|
|
|
|
{
|
2014-12-14 15:54:32 +00:00
|
|
|
|
pw->CreateKey(pos, dim, -1, static_cast<EventType>(EVENT_INTERFACE_KEY+first+i));
|
|
|
|
|
CKey* pk = static_cast<CKey*>(pw->SearchControl(static_cast<EventType>(EVENT_INTERFACE_KEY+first+i)));
|
2012-10-06 22:46:46 +00:00
|
|
|
|
if (pk == nullptr) break;
|
|
|
|
|
|
2014-12-14 15:54:32 +00:00
|
|
|
|
pk->SetBinding(CInput::GetInstancePointer()->GetInputBinding(static_cast<InputSlot>(first+i)));
|
2012-06-26 20:23:05 +00:00
|
|
|
|
pos.y -= dim.y;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Change a key.
|
|
|
|
|
|
2012-09-15 19:47:19 +00:00
|
|
|
|
void CMainDialog::ChangeKey(EventType event)
|
2012-06-26 20:23:05 +00:00
|
|
|
|
{
|
2012-10-06 22:46:46 +00:00
|
|
|
|
CWindow* pw = static_cast<CWindow*>(m_interface->SearchControl(EVENT_WINDOW5));
|
|
|
|
|
if (pw == nullptr) return;
|
2012-06-26 20:23:05 +00:00
|
|
|
|
|
2012-10-06 22:46:46 +00:00
|
|
|
|
CScroll* ps = static_cast<CScroll*>(pw->SearchControl(EVENT_INTERFACE_KSCROLL));
|
|
|
|
|
if (ps == nullptr) return;
|
2012-06-26 20:23:05 +00:00
|
|
|
|
|
2014-12-14 15:54:32 +00:00
|
|
|
|
for (int i = 0; i < INPUT_SLOT_MAX; i++)
|
2012-06-26 20:23:05 +00:00
|
|
|
|
{
|
2014-12-14 15:54:32 +00:00
|
|
|
|
if ( EVENT_INTERFACE_KEY+i == event )
|
2012-06-26 20:23:05 +00:00
|
|
|
|
{
|
2014-12-14 15:54:32 +00:00
|
|
|
|
CKey* pk = static_cast<CKey*>(pw->SearchControl(static_cast<EventType>(EVENT_INTERFACE_KEY+i)));
|
2012-10-06 22:46:46 +00:00
|
|
|
|
if (pk == nullptr) break;
|
|
|
|
|
|
2014-12-14 15:54:32 +00:00
|
|
|
|
CInput::GetInstancePointer()->SetInputBinding(static_cast<InputSlot>(i), pk->GetBinding());
|
2012-06-26 20:23:05 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Do you want to quit the current mission?
|
|
|
|
|
|
|
|
|
|
void CMainDialog::StartAbort()
|
|
|
|
|
{
|
|
|
|
|
CWindow* pw;
|
|
|
|
|
CButton* pb;
|
|
|
|
|
Math::Point pos, dim;
|
2013-12-02 23:11:26 +00:00
|
|
|
|
std::string name;
|
2012-06-26 20:23:05 +00:00
|
|
|
|
|
|
|
|
|
StartDialog(Math::Point(0.3f, 0.8f), true, false, false);
|
|
|
|
|
m_bDialogDelete = false;
|
|
|
|
|
|
2012-09-18 20:33:28 +00:00
|
|
|
|
pw = static_cast<CWindow*>(m_interface->SearchControl(EVENT_WINDOW9));
|
2012-06-26 20:23:05 +00:00
|
|
|
|
if ( pw == 0 ) return;
|
|
|
|
|
|
|
|
|
|
pos.x = 0.35f;
|
|
|
|
|
pos.y = 0.60f;
|
|
|
|
|
dim.x = 0.30f;
|
|
|
|
|
dim.y = 0.30f;
|
|
|
|
|
pw->CreateGroup(pos, dim, 5, EVENT_INTERFACE_GLINTl); // orange corner
|
|
|
|
|
pos.x = 0.35f;
|
|
|
|
|
pos.y = 0.10f;
|
|
|
|
|
dim.x = 0.30f;
|
|
|
|
|
dim.y = 0.30f;
|
|
|
|
|
pw->CreateGroup(pos, dim, 4, EVENT_INTERFACE_GLINTr); // blue corner
|
|
|
|
|
|
|
|
|
|
pos.x = 0.40f;
|
|
|
|
|
dim.x = 0.20f;
|
|
|
|
|
dim.y = 32.0f/480.0f;
|
|
|
|
|
|
|
|
|
|
pos.y = 0.74f;
|
|
|
|
|
pb = pw->CreateButton(pos, dim, -1, EVENT_DIALOG_CANCEL);
|
|
|
|
|
pb->SetState(STATE_SHADOW);
|
|
|
|
|
GetResource(RES_TEXT, RT_DIALOG_NO, name);
|
|
|
|
|
pb->SetName(name);
|
|
|
|
|
|
2015-07-18 16:52:37 +00:00
|
|
|
|
if ( m_category == LevelCategory::Missions || // missions ?
|
|
|
|
|
m_category == LevelCategory::FreeGame || // free games?
|
|
|
|
|
m_category == LevelCategory::CustomLevels ) // user ?
|
2012-06-26 20:23:05 +00:00
|
|
|
|
{
|
|
|
|
|
pos.y = 0.62f;
|
|
|
|
|
pb = pw->CreateButton(pos, dim, -1, EVENT_INTERFACE_WRITE);
|
|
|
|
|
pb->SetState(STATE_SHADOW);
|
|
|
|
|
if ( m_main->IsBusy() ) // current task?
|
|
|
|
|
{
|
|
|
|
|
pb->ClearState(STATE_ENABLE);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
pos.y = 0.53f;
|
|
|
|
|
pb = pw->CreateButton(pos, dim, -1, EVENT_INTERFACE_READ);
|
|
|
|
|
pb->SetState(STATE_SHADOW);
|
|
|
|
|
if ( !IsIOReadScene() ) // no file to read?
|
|
|
|
|
{
|
|
|
|
|
pb->ClearState(STATE_ENABLE);
|
|
|
|
|
}
|
|
|
|
|
pb->SetState(STATE_WARNING);
|
|
|
|
|
}
|
|
|
|
|
|
2012-09-20 19:47:53 +00:00
|
|
|
|
pos.y = 0.39f;
|
|
|
|
|
pb = pw->CreateButton(pos, dim, -1, EVENT_INTERFACE_SETUP);
|
|
|
|
|
pb->SetState(STATE_SHADOW);
|
2012-06-26 20:23:05 +00:00
|
|
|
|
|
|
|
|
|
pos.y = 0.25f;
|
|
|
|
|
pb = pw->CreateButton(pos, dim, -1, EVENT_INTERFACE_AGAIN);
|
|
|
|
|
pb->SetState(STATE_SHADOW);
|
|
|
|
|
pb->SetState(STATE_WARNING);
|
|
|
|
|
|
|
|
|
|
pos.y = 0.16f;
|
|
|
|
|
pb = pw->CreateButton(pos, dim, -1, EVENT_DIALOG_OK);
|
|
|
|
|
pb->SetState(STATE_SHADOW);
|
|
|
|
|
pb->SetState(STATE_WARNING);
|
|
|
|
|
GetResource(RES_TEXT, RT_DIALOG_YES, name);
|
|
|
|
|
pb->SetName(name);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Do you want to destroy the building?
|
|
|
|
|
|
|
|
|
|
void CMainDialog::StartDeleteObject()
|
|
|
|
|
{
|
|
|
|
|
CWindow* pw;
|
|
|
|
|
CButton* pb;
|
|
|
|
|
Math::Point pos, dim;
|
2013-12-02 23:11:26 +00:00
|
|
|
|
std::string name;
|
2012-06-26 20:23:05 +00:00
|
|
|
|
|
|
|
|
|
StartDialog(Math::Point(0.7f, 0.3f), false, true, true);
|
|
|
|
|
m_bDialogDelete = true;
|
|
|
|
|
|
2012-09-18 20:33:28 +00:00
|
|
|
|
pw = static_cast<CWindow*>(m_interface->SearchControl(EVENT_WINDOW9));
|
2012-06-26 20:23:05 +00:00
|
|
|
|
if ( pw == 0 ) return;
|
|
|
|
|
|
|
|
|
|
pos.x = 0.00f;
|
|
|
|
|
pos.y = 0.50f;
|
|
|
|
|
dim.x = 1.00f;
|
|
|
|
|
dim.y = 0.05f;
|
|
|
|
|
GetResource(RES_TEXT, RT_DIALOG_DELOBJ, name);
|
|
|
|
|
pw->CreateLabel(pos, dim, -1, EVENT_DIALOG_LABEL, name);
|
|
|
|
|
|
2012-09-18 20:33:28 +00:00
|
|
|
|
pb = static_cast<CButton*>(pw->SearchControl(EVENT_DIALOG_OK));
|
2012-06-26 20:23:05 +00:00
|
|
|
|
if ( pb == 0 ) return;
|
|
|
|
|
GetResource(RES_TEXT, RT_DIALOG_YESDEL, name);
|
|
|
|
|
pb->SetName(name);
|
|
|
|
|
pb->SetState(STATE_WARNING);
|
|
|
|
|
|
2012-09-18 20:33:28 +00:00
|
|
|
|
pb = static_cast<CButton*>(pw->SearchControl(EVENT_DIALOG_CANCEL));
|
2012-06-26 20:23:05 +00:00
|
|
|
|
if ( pb == 0 ) return;
|
|
|
|
|
GetResource(RES_TEXT, RT_DIALOG_NODEL, name);
|
|
|
|
|
pb->SetName(name);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Do you want to delete the player?
|
|
|
|
|
|
|
|
|
|
void CMainDialog::StartDeleteGame(char *gamer)
|
|
|
|
|
{
|
|
|
|
|
CWindow* pw;
|
|
|
|
|
CButton* pb;
|
|
|
|
|
Math::Point pos, dim;
|
|
|
|
|
|
|
|
|
|
StartDialog(Math::Point(0.7f, 0.3f), false, true, true);
|
|
|
|
|
m_bDialogDelete = true;
|
|
|
|
|
|
2012-09-18 20:33:28 +00:00
|
|
|
|
pw = static_cast<CWindow*>(m_interface->SearchControl(EVENT_WINDOW9));
|
2013-12-02 23:11:26 +00:00
|
|
|
|
if (pw == nullptr)
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
std::string name;
|
2012-06-26 20:23:05 +00:00
|
|
|
|
|
|
|
|
|
pos.x = 0.00f;
|
|
|
|
|
pos.y = 0.50f;
|
|
|
|
|
dim.x = 1.00f;
|
|
|
|
|
dim.y = 0.05f;
|
|
|
|
|
GetResource(RES_TEXT, RT_DIALOG_DELGAME, name);
|
2013-12-02 23:11:26 +00:00
|
|
|
|
std::string text = StrUtils::Format(name.c_str(), gamer);
|
2012-06-26 20:23:05 +00:00
|
|
|
|
pw->CreateLabel(pos, dim, -1, EVENT_DIALOG_LABEL, text);
|
|
|
|
|
|
2012-09-18 20:33:28 +00:00
|
|
|
|
pb = static_cast<CButton*>(pw->SearchControl(EVENT_DIALOG_OK));
|
2012-06-26 20:23:05 +00:00
|
|
|
|
if ( pb == 0 ) return;
|
|
|
|
|
GetResource(RES_TEXT, RT_DIALOG_YESDEL, name);
|
|
|
|
|
pb->SetName(name);
|
|
|
|
|
pb->SetState(STATE_WARNING);
|
|
|
|
|
|
2012-09-18 20:33:28 +00:00
|
|
|
|
pb = static_cast<CButton*>(pw->SearchControl(EVENT_DIALOG_CANCEL));
|
2012-06-26 20:23:05 +00:00
|
|
|
|
if ( pb == 0 ) return;
|
|
|
|
|
GetResource(RES_TEXT, RT_DIALOG_NODEL, name);
|
|
|
|
|
pb->SetName(name);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Would you quit the game?
|
|
|
|
|
|
|
|
|
|
void CMainDialog::StartQuit()
|
|
|
|
|
{
|
|
|
|
|
CWindow* pw;
|
|
|
|
|
CButton* pb;
|
|
|
|
|
Math::Point pos, dim;
|
|
|
|
|
|
|
|
|
|
StartDialog(Math::Point(0.6f, 0.3f), false, true, true);
|
|
|
|
|
|
2012-09-18 20:33:28 +00:00
|
|
|
|
pw = static_cast<CWindow*>(m_interface->SearchControl(EVENT_WINDOW9));
|
2013-12-02 23:11:26 +00:00
|
|
|
|
if (pw == nullptr)
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
std::string name;
|
2012-06-26 20:23:05 +00:00
|
|
|
|
|
|
|
|
|
pos.x = 0.00f;
|
|
|
|
|
pos.y = 0.50f;
|
|
|
|
|
dim.x = 1.00f;
|
|
|
|
|
dim.y = 0.05f;
|
|
|
|
|
GetResource(RES_TEXT, RT_DIALOG_QUIT, name);
|
|
|
|
|
pw->CreateLabel(pos, dim, -1, EVENT_DIALOG_LABEL, name);
|
|
|
|
|
|
2012-09-18 20:33:28 +00:00
|
|
|
|
pb = static_cast<CButton*>(pw->SearchControl(EVENT_DIALOG_OK));
|
2012-06-26 20:23:05 +00:00
|
|
|
|
if ( pb == 0 ) return;
|
|
|
|
|
GetResource(RES_TEXT, RT_DIALOG_YESQUIT, name);
|
|
|
|
|
pb->SetName(name);
|
|
|
|
|
pb->SetState(STATE_WARNING);
|
|
|
|
|
|
2012-09-18 20:33:28 +00:00
|
|
|
|
pb = static_cast<CButton*>(pw->SearchControl(EVENT_DIALOG_CANCEL));
|
2012-06-26 20:23:05 +00:00
|
|
|
|
if ( pb == 0 ) return;
|
|
|
|
|
GetResource(RES_TEXT, RT_DIALOG_NOQUIT, name);
|
|
|
|
|
pb->SetName(name);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Beginning of displaying a dialog.
|
|
|
|
|
|
|
|
|
|
void CMainDialog::StartDialog(Math::Point dim, bool bFire, bool bOK, bool bCancel)
|
|
|
|
|
{
|
|
|
|
|
CWindow* pw;
|
|
|
|
|
CButton* pb;
|
|
|
|
|
Math::Point pos, ddim;
|
|
|
|
|
|
|
|
|
|
StartSuspend();
|
|
|
|
|
|
2012-09-18 20:33:28 +00:00
|
|
|
|
pw = static_cast<CWindow*>(m_interface->SearchControl(EVENT_WINDOW0));
|
2012-06-26 20:23:05 +00:00
|
|
|
|
if ( pw != 0 ) pw->ClearState(STATE_ENABLE);
|
|
|
|
|
|
2012-09-18 20:33:28 +00:00
|
|
|
|
pw = static_cast<CWindow*>(m_interface->SearchControl(EVENT_WINDOW1));
|
2012-06-26 20:23:05 +00:00
|
|
|
|
if ( pw != 0 ) pw->ClearState(STATE_ENABLE);
|
|
|
|
|
|
2012-09-18 20:33:28 +00:00
|
|
|
|
pw = static_cast<CWindow*>(m_interface->SearchControl(EVENT_WINDOW2));
|
2012-06-26 20:23:05 +00:00
|
|
|
|
if ( pw != 0 ) pw->ClearState(STATE_ENABLE);
|
|
|
|
|
|
2012-09-18 20:33:28 +00:00
|
|
|
|
pw = static_cast<CWindow*>(m_interface->SearchControl(EVENT_WINDOW3));
|
2012-06-26 20:23:05 +00:00
|
|
|
|
if ( pw != 0 ) pw->ClearState(STATE_ENABLE);
|
|
|
|
|
|
2012-09-18 20:33:28 +00:00
|
|
|
|
pw = static_cast<CWindow*>(m_interface->SearchControl(EVENT_WINDOW4));
|
2012-06-26 20:23:05 +00:00
|
|
|
|
if ( pw != 0 ) pw->ClearState(STATE_ENABLE);
|
|
|
|
|
|
2012-09-18 20:33:28 +00:00
|
|
|
|
pw = static_cast<CWindow*>(m_interface->SearchControl(EVENT_WINDOW5));
|
2012-06-26 20:23:05 +00:00
|
|
|
|
if ( pw != 0 ) pw->ClearState(STATE_ENABLE);
|
|
|
|
|
|
2012-09-18 20:33:28 +00:00
|
|
|
|
pw = static_cast<CWindow*>(m_interface->SearchControl(EVENT_WINDOW6));
|
2012-06-26 20:23:05 +00:00
|
|
|
|
if ( pw != 0 ) pw->ClearState(STATE_ENABLE);
|
|
|
|
|
|
2012-09-18 20:33:28 +00:00
|
|
|
|
pw = static_cast<CWindow*>(m_interface->SearchControl(EVENT_WINDOW7));
|
2012-06-26 20:23:05 +00:00
|
|
|
|
if ( pw != 0 ) pw->ClearState(STATE_ENABLE);
|
|
|
|
|
|
2012-09-18 20:33:28 +00:00
|
|
|
|
pw = static_cast<CWindow*>(m_interface->SearchControl(EVENT_WINDOW8));
|
2012-06-26 20:23:05 +00:00
|
|
|
|
if ( pw != 0 ) pw->ClearState(STATE_ENABLE);
|
|
|
|
|
|
|
|
|
|
m_bDialogFire = bFire;
|
|
|
|
|
|
2013-12-02 23:11:26 +00:00
|
|
|
|
std::string name;
|
|
|
|
|
|
2012-06-26 20:23:05 +00:00
|
|
|
|
pos.x = (1.0f-dim.x)/2.0f;
|
|
|
|
|
pos.y = (1.0f-dim.y)/2.0f;
|
|
|
|
|
pw = m_interface->CreateWindows(pos, dim, bFire?12:8, EVENT_WINDOW9);
|
|
|
|
|
pw->SetState(STATE_SHADOW);
|
|
|
|
|
GetResource(RES_TEXT, RT_TITLE_BASE, name);
|
|
|
|
|
pw->SetName(name);
|
|
|
|
|
|
|
|
|
|
m_dialogPos = pos;
|
|
|
|
|
m_dialogDim = dim;
|
|
|
|
|
m_dialogTime = 0.0f;
|
|
|
|
|
m_dialogParti = 999.0f;
|
|
|
|
|
|
|
|
|
|
if ( bOK )
|
|
|
|
|
{
|
|
|
|
|
pos.x = 0.50f-0.15f-0.02f;
|
|
|
|
|
pos.y = 0.50f-dim.y/2.0f+0.03f;
|
|
|
|
|
ddim.x = 0.15f;
|
|
|
|
|
ddim.y = 0.06f;
|
|
|
|
|
pb = pw->CreateButton(pos, ddim, -1, EVENT_DIALOG_OK);
|
|
|
|
|
pb->SetState(STATE_SHADOW);
|
|
|
|
|
GetResource(RES_EVENT, EVENT_DIALOG_OK, name);
|
|
|
|
|
pb->SetName(name);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if ( bCancel )
|
|
|
|
|
{
|
|
|
|
|
pos.x = 0.50f+0.02f;
|
|
|
|
|
pos.y = 0.50f-dim.y/2.0f+0.03f;
|
|
|
|
|
ddim.x = 0.15f;
|
|
|
|
|
ddim.y = 0.06f;
|
|
|
|
|
pb = pw->CreateButton(pos, ddim, -1, EVENT_DIALOG_CANCEL);
|
|
|
|
|
pb->SetState(STATE_SHADOW);
|
|
|
|
|
GetResource(RES_EVENT, EVENT_DIALOG_CANCEL, name);
|
|
|
|
|
pb->SetName(name);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
m_sound->Play(SOUND_TZOING);
|
|
|
|
|
m_bDialog = true;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Animation of a dialog.
|
|
|
|
|
|
|
|
|
|
void CMainDialog::FrameDialog(float rTime)
|
|
|
|
|
{
|
|
|
|
|
CWindow* pw;
|
|
|
|
|
Math::Vector pos, speed;
|
|
|
|
|
Math::Point dim, dpos, ddim;
|
|
|
|
|
float zoom;
|
|
|
|
|
int i;
|
|
|
|
|
|
|
|
|
|
dpos = m_dialogPos;
|
|
|
|
|
ddim = m_dialogDim;
|
|
|
|
|
|
|
|
|
|
m_dialogTime += rTime;
|
|
|
|
|
if ( m_dialogTime < 1.0f )
|
|
|
|
|
{
|
2012-09-18 20:33:28 +00:00
|
|
|
|
pw = static_cast<CWindow*>(m_interface->SearchControl(EVENT_WINDOW9));
|
2012-06-26 20:23:05 +00:00
|
|
|
|
if ( pw != 0 )
|
|
|
|
|
{
|
|
|
|
|
if ( m_dialogTime < 0.50f )
|
|
|
|
|
{
|
|
|
|
|
zoom = Math::Bounce(m_dialogTime/0.50f);
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
zoom = 1.0f;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
dpos.x += ddim.x/2.0f;
|
|
|
|
|
dpos.y += ddim.y/2.0f;
|
|
|
|
|
|
|
|
|
|
ddim.x *= zoom;
|
|
|
|
|
//? ddim.y *= zoom;
|
|
|
|
|
|
|
|
|
|
dpos.x -= ddim.x/2.0f;
|
|
|
|
|
dpos.y -= ddim.y/2.0f;
|
|
|
|
|
|
|
|
|
|
pw->SetPos(dpos);
|
|
|
|
|
pw->SetDim(ddim);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if ( !m_bGlint ) return;
|
|
|
|
|
|
|
|
|
|
m_dialogParti += rTime;
|
2012-09-15 19:47:19 +00:00
|
|
|
|
if ( m_dialogParti < m_engine->ParticleAdapt(0.05f) ) return;
|
2012-06-26 20:23:05 +00:00
|
|
|
|
m_dialogParti = 0.0f;
|
|
|
|
|
|
|
|
|
|
if ( !m_bDialogFire ) return;
|
|
|
|
|
|
|
|
|
|
dpos = m_dialogPos;
|
|
|
|
|
ddim = m_dialogDim;
|
|
|
|
|
|
|
|
|
|
pos.z = 0.0f;
|
|
|
|
|
speed = Math::Vector(0.0f, 0.0f, 0.0f);
|
|
|
|
|
|
|
|
|
|
for ( i=0 ; i<2 ; i++ )
|
|
|
|
|
{
|
|
|
|
|
// Bottom.
|
|
|
|
|
pos.x = dpos.x + ddim.x*Math::Rand();
|
|
|
|
|
pos.y = dpos.y;
|
|
|
|
|
pos.x += (Math::Rand()-0.5f)*(6.0f/640.0f);
|
|
|
|
|
pos.y += Math::Rand()*(16.0f/480.0f)-(10.0f/480.0f);
|
|
|
|
|
dim.x = 0.01f+Math::Rand()*0.01f;
|
|
|
|
|
dim.y = dim.x/0.75f;
|
2012-09-15 19:47:19 +00:00
|
|
|
|
m_particle->CreateParticle(pos, speed, dim,
|
2012-09-18 20:33:28 +00:00
|
|
|
|
static_cast<Gfx::ParticleType>(Gfx::PARTILENS1+rand()%3),
|
2012-09-15 19:47:19 +00:00
|
|
|
|
1.0f, 0.0f, 0.0f, Gfx::SH_INTERFACE);
|
2012-06-26 20:23:05 +00:00
|
|
|
|
|
|
|
|
|
// Top.
|
|
|
|
|
pos.x = dpos.x + ddim.x*Math::Rand();
|
|
|
|
|
pos.y = dpos.y + ddim.y;
|
|
|
|
|
pos.x += (Math::Rand()-0.5f)*(6.0f/640.0f);
|
|
|
|
|
pos.y -= Math::Rand()*(16.0f/480.0f)-(10.0f/480.0f);
|
|
|
|
|
dim.x = 0.01f+Math::Rand()*0.01f;
|
|
|
|
|
dim.y = dim.x/0.75f;
|
2012-09-15 19:47:19 +00:00
|
|
|
|
m_particle->CreateParticle(pos, speed, dim,
|
2012-09-18 20:33:28 +00:00
|
|
|
|
static_cast<Gfx::ParticleType>(Gfx::PARTILENS1+rand()%3),
|
2012-09-15 19:47:19 +00:00
|
|
|
|
1.0f, 0.0f, 0.0f, Gfx::SH_INTERFACE);
|
2012-06-26 20:23:05 +00:00
|
|
|
|
|
|
|
|
|
// Left.
|
|
|
|
|
pos.y = dpos.y + ddim.y*Math::Rand();
|
|
|
|
|
pos.x = dpos.x;
|
|
|
|
|
pos.x += Math::Rand()*(16.0f/640.0f)-(10.0f/640.0f);
|
|
|
|
|
pos.y += (Math::Rand()-0.5f)*(6.0f/480.0f);
|
|
|
|
|
dim.x = 0.01f+Math::Rand()*0.01f;
|
|
|
|
|
dim.y = dim.x/0.75f;
|
2012-09-15 19:47:19 +00:00
|
|
|
|
m_particle->CreateParticle(pos, speed, dim,
|
2012-09-18 20:33:28 +00:00
|
|
|
|
static_cast<Gfx::ParticleType>(Gfx::PARTILENS1+rand()%3),
|
2012-09-15 19:47:19 +00:00
|
|
|
|
1.0f, 0.0f, 0.0f, Gfx::SH_INTERFACE);
|
2012-06-26 20:23:05 +00:00
|
|
|
|
|
|
|
|
|
// Right.
|
|
|
|
|
pos.y = dpos.y + ddim.y*Math::Rand();
|
|
|
|
|
pos.x = dpos.x + ddim.x;
|
|
|
|
|
pos.x -= Math::Rand()*(16.0f/640.0f)-(10.0f/640.0f);
|
|
|
|
|
pos.y += (Math::Rand()-0.5f)*(6.0f/480.0f);
|
|
|
|
|
dim.x = 0.01f+Math::Rand()*0.01f;
|
|
|
|
|
dim.y = dim.x/0.75f;
|
2012-09-15 19:47:19 +00:00
|
|
|
|
m_particle->CreateParticle(pos, speed, dim,
|
2012-09-18 20:33:28 +00:00
|
|
|
|
static_cast<Gfx::ParticleType>(Gfx::PARTILENS1+rand()%3),
|
2012-09-15 19:47:19 +00:00
|
|
|
|
1.0f, 0.0f, 0.0f, Gfx::SH_INTERFACE);
|
2012-06-26 20:23:05 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// End of the display of a dialogue.
|
|
|
|
|
|
|
|
|
|
void CMainDialog::StopDialog()
|
|
|
|
|
{
|
|
|
|
|
CWindow* pw;
|
|
|
|
|
|
2012-09-18 20:33:28 +00:00
|
|
|
|
pw = static_cast<CWindow*>(m_interface->SearchControl(EVENT_WINDOW0));
|
2012-06-26 20:23:05 +00:00
|
|
|
|
if ( pw != 0 ) pw->SetState(STATE_ENABLE);
|
|
|
|
|
|
2012-09-18 20:33:28 +00:00
|
|
|
|
pw = static_cast<CWindow*>(m_interface->SearchControl(EVENT_WINDOW1));
|
2012-06-26 20:23:05 +00:00
|
|
|
|
if ( pw != 0 ) pw->SetState(STATE_ENABLE);
|
|
|
|
|
|
2012-09-18 20:33:28 +00:00
|
|
|
|
pw = static_cast<CWindow*>(m_interface->SearchControl(EVENT_WINDOW2));
|
2012-06-26 20:23:05 +00:00
|
|
|
|
if ( pw != 0 ) pw->SetState(STATE_ENABLE);
|
|
|
|
|
|
2012-09-18 20:33:28 +00:00
|
|
|
|
pw = static_cast<CWindow*>(m_interface->SearchControl(EVENT_WINDOW3));
|
2012-06-26 20:23:05 +00:00
|
|
|
|
if ( pw != 0 ) pw->SetState(STATE_ENABLE);
|
|
|
|
|
|
2012-09-18 20:33:28 +00:00
|
|
|
|
pw = static_cast<CWindow*>(m_interface->SearchControl(EVENT_WINDOW4));
|
2012-06-26 20:23:05 +00:00
|
|
|
|
if ( pw != 0 ) pw->SetState(STATE_ENABLE);
|
|
|
|
|
|
2012-09-18 20:33:28 +00:00
|
|
|
|
pw = static_cast<CWindow*>(m_interface->SearchControl(EVENT_WINDOW5));
|
2012-06-26 20:23:05 +00:00
|
|
|
|
if ( pw != 0 ) pw->SetState(STATE_ENABLE);
|
|
|
|
|
|
2012-09-18 20:33:28 +00:00
|
|
|
|
pw = static_cast<CWindow*>(m_interface->SearchControl(EVENT_WINDOW6));
|
2012-06-26 20:23:05 +00:00
|
|
|
|
if ( pw != 0 ) pw->SetState(STATE_ENABLE);
|
|
|
|
|
|
2012-09-18 20:33:28 +00:00
|
|
|
|
pw = static_cast<CWindow*>(m_interface->SearchControl(EVENT_WINDOW7));
|
2012-06-26 20:23:05 +00:00
|
|
|
|
if ( pw != 0 ) pw->SetState(STATE_ENABLE);
|
|
|
|
|
|
2012-09-18 20:33:28 +00:00
|
|
|
|
pw = static_cast<CWindow*>(m_interface->SearchControl(EVENT_WINDOW8));
|
2012-06-26 20:23:05 +00:00
|
|
|
|
if ( pw != 0 ) pw->SetState(STATE_ENABLE);
|
|
|
|
|
|
|
|
|
|
StopSuspend();
|
|
|
|
|
m_interface->DeleteControl(EVENT_WINDOW9);
|
|
|
|
|
m_bDialog = false;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Suspends the simulation for a dialog phase.
|
|
|
|
|
|
|
|
|
|
void CMainDialog::StartSuspend()
|
|
|
|
|
{
|
|
|
|
|
m_sound->MuteAll(true);
|
|
|
|
|
m_main->ClearInterface();
|
2013-12-31 11:58:45 +00:00
|
|
|
|
m_bInitPause = m_pause->GetPauseType();
|
|
|
|
|
m_pause->SetPause(PAUSE_DIALOG);
|
2012-06-26 20:23:05 +00:00
|
|
|
|
m_engine->SetOverFront(false); // over flat behind
|
|
|
|
|
m_main->CreateShortcuts();
|
|
|
|
|
m_main->StartSuspend();
|
2012-09-15 19:47:19 +00:00
|
|
|
|
m_initCamera = m_camera->GetType();
|
|
|
|
|
m_camera->SetType(Gfx::CAM_TYPE_DIALOG);
|
2012-06-26 20:23:05 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Resume the simulation after a period of dialog.
|
|
|
|
|
|
|
|
|
|
void CMainDialog::StopSuspend()
|
|
|
|
|
{
|
|
|
|
|
m_sound->MuteAll(false);
|
|
|
|
|
m_main->ClearInterface();
|
2013-12-31 11:58:45 +00:00
|
|
|
|
m_pause->SetPause(m_bInitPause);
|
2012-06-26 20:23:05 +00:00
|
|
|
|
m_engine->SetOverFront(true); // over flat front
|
|
|
|
|
m_main->CreateShortcuts();
|
|
|
|
|
m_main->StopSuspend();
|
|
|
|
|
m_camera->SetType(m_initCamera);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Whether to use tooltips.
|
|
|
|
|
|
2012-09-15 19:47:19 +00:00
|
|
|
|
bool CMainDialog::GetTooltip()
|
2012-06-26 20:23:05 +00:00
|
|
|
|
{
|
|
|
|
|
return m_bTooltip;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Specifies whether a dialog is displayed.
|
|
|
|
|
|
|
|
|
|
bool CMainDialog::IsDialog()
|
|
|
|
|
{
|
|
|
|
|
return m_bDialog;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Specifies the name of the scene to read.
|
|
|
|
|
|
2012-09-17 22:01:00 +00:00
|
|
|
|
void CMainDialog::SetSceneRead(const char* name)
|
2012-06-26 20:23:05 +00:00
|
|
|
|
{
|
2012-09-26 20:57:43 +00:00
|
|
|
|
m_sceneRead = name;
|
2012-06-26 20:23:05 +00:00
|
|
|
|
}
|
|
|
|
|
|
2012-09-20 18:37:37 +00:00
|
|
|
|
// Returns the name of the scene to read.
|
2012-06-26 20:23:05 +00:00
|
|
|
|
|
2012-09-26 20:57:43 +00:00
|
|
|
|
std::string & CMainDialog::GetSceneRead()
|
2012-06-26 20:23:05 +00:00
|
|
|
|
{
|
|
|
|
|
return m_sceneRead;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Specifies the name of the scene to read.
|
|
|
|
|
|
2012-09-17 22:01:00 +00:00
|
|
|
|
void CMainDialog::SetStackRead(const char* name)
|
2012-06-26 20:23:05 +00:00
|
|
|
|
{
|
2012-09-26 20:57:43 +00:00
|
|
|
|
m_stackRead = name;
|
2012-06-26 20:23:05 +00:00
|
|
|
|
}
|
|
|
|
|
|
2012-09-20 18:37:37 +00:00
|
|
|
|
// Returns the name of the scene to read.
|
2012-06-26 20:23:05 +00:00
|
|
|
|
|
2012-09-26 20:57:43 +00:00
|
|
|
|
std::string & CMainDialog::GetStackRead()
|
2012-06-26 20:23:05 +00:00
|
|
|
|
{
|
|
|
|
|
return m_stackRead;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2015-07-18 17:43:22 +00:00
|
|
|
|
void CMainDialog::SetLevel(LevelCategory cat, int chap, int rank)
|
2012-06-26 20:23:05 +00:00
|
|
|
|
{
|
2015-07-18 17:43:22 +00:00
|
|
|
|
m_category = cat;
|
|
|
|
|
m_levelChap = chap;
|
|
|
|
|
m_levelRank = rank;
|
2012-06-26 20:23:05 +00:00
|
|
|
|
}
|
|
|
|
|
|
2015-07-18 16:52:37 +00:00
|
|
|
|
LevelCategory CMainDialog::GetLevelCategory()
|
2012-06-26 20:23:05 +00:00
|
|
|
|
{
|
2015-07-18 16:52:37 +00:00
|
|
|
|
return m_category;
|
2012-06-26 20:23:05 +00:00
|
|
|
|
}
|
|
|
|
|
|
2015-07-18 17:43:22 +00:00
|
|
|
|
int CMainDialog::GetLevelChap()
|
2012-06-26 20:23:05 +00:00
|
|
|
|
{
|
2015-07-18 17:43:22 +00:00
|
|
|
|
return m_levelChap;
|
2012-06-26 20:23:05 +00:00
|
|
|
|
}
|
|
|
|
|
|
2015-07-18 16:52:37 +00:00
|
|
|
|
int CMainDialog::GetLevelRank()
|
2012-06-26 20:23:05 +00:00
|
|
|
|
{
|
2015-07-18 17:43:22 +00:00
|
|
|
|
return m_levelRank;
|
2012-06-26 20:23:05 +00:00
|
|
|
|
}
|
|
|
|
|
|
2012-09-20 18:37:37 +00:00
|
|
|
|
// Returns folder name of the scene that user selected to play.
|
2012-06-26 20:23:05 +00:00
|
|
|
|
|
2015-07-18 17:43:22 +00:00
|
|
|
|
std::string CMainDialog::GetCustomLevelDir()
|
2012-06-26 20:23:05 +00:00
|
|
|
|
{
|
2015-07-18 17:43:22 +00:00
|
|
|
|
if (m_levelChap-1 < 0 || m_levelChap-1 >= m_customLevelList.size()) return "";
|
|
|
|
|
return m_customLevelList[m_levelChap-1];
|
2012-06-26 20:23:05 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Whether to show the solution.
|
|
|
|
|
|
2012-09-15 19:47:19 +00:00
|
|
|
|
bool CMainDialog::GetSceneSoluce()
|
2012-06-26 20:23:05 +00:00
|
|
|
|
{
|
|
|
|
|
return m_bSceneSoluce;
|
|
|
|
|
}
|
|
|
|
|
|
2012-09-20 18:37:37 +00:00
|
|
|
|
// Returns the name of the folder to save.
|
2012-06-26 20:23:05 +00:00
|
|
|
|
|
2014-11-10 18:26:36 +00:00
|
|
|
|
std::string & CMainDialog::GetSavegameDir()
|
2012-06-26 20:23:05 +00:00
|
|
|
|
{
|
|
|
|
|
return m_savegameDir;
|
|
|
|
|
}
|
|
|
|
|
|
2012-09-20 18:37:37 +00:00
|
|
|
|
// Returns the name of public folder.
|
2012-06-26 20:23:05 +00:00
|
|
|
|
|
2012-09-26 20:57:43 +00:00
|
|
|
|
std::string & CMainDialog::GetPublicDir()
|
2012-06-26 20:23:05 +00:00
|
|
|
|
{
|
|
|
|
|
return m_publicDir;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Indicates if there are reflections on the buttons.
|
|
|
|
|
|
2012-09-15 19:47:19 +00:00
|
|
|
|
bool CMainDialog::GetGlint()
|
2012-06-26 20:23:05 +00:00
|
|
|
|
{
|
|
|
|
|
return m_bGlint;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Whether to show 4:solutions.
|
|
|
|
|
|
2012-09-15 19:47:19 +00:00
|
|
|
|
bool CMainDialog::GetSoluce4()
|
2012-06-26 20:23:05 +00:00
|
|
|
|
{
|
|
|
|
|
return m_bSoluce4;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Whether to show the cinematics.
|
|
|
|
|
|
2012-09-15 19:47:19 +00:00
|
|
|
|
bool CMainDialog::GetMovies()
|
2012-06-26 20:23:05 +00:00
|
|
|
|
{
|
|
|
|
|
return m_bMovies;
|
|
|
|
|
}
|
|
|
|
|
|
2015-07-13 19:51:18 +00:00
|
|
|
|
// Whether to make an animation on reset.
|
2012-06-26 20:23:05 +00:00
|
|
|
|
|
2012-09-15 19:47:19 +00:00
|
|
|
|
bool CMainDialog::GetNiceReset()
|
2012-06-26 20:23:05 +00:00
|
|
|
|
{
|
|
|
|
|
return m_bNiceReset;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Indicates whether the fire causes damage to its own units.
|
|
|
|
|
|
2012-09-15 19:47:19 +00:00
|
|
|
|
bool CMainDialog::GetHimselfDamage()
|
2012-06-26 20:23:05 +00:00
|
|
|
|
{
|
|
|
|
|
return m_bHimselfDamage;
|
|
|
|
|
}
|
|
|
|
|
|
2012-09-15 19:47:19 +00:00
|
|
|
|
bool CMainDialog::GetGamerOnlyHead()
|
2012-06-26 20:23:05 +00:00
|
|
|
|
{
|
2015-07-18 21:14:20 +00:00
|
|
|
|
return (m_phase == PHASE_PERSO && m_apperanceTab == 0);
|
2012-06-26 20:23:05 +00:00
|
|
|
|
}
|
|
|
|
|
|
2012-09-15 19:47:19 +00:00
|
|
|
|
float CMainDialog::GetPersoAngle()
|
2012-06-26 20:23:05 +00:00
|
|
|
|
{
|
2015-07-18 21:14:20 +00:00
|
|
|
|
return m_apperanceAngle;
|
2012-06-26 20:23:05 +00:00
|
|
|
|
}
|
|
|
|
|
|
2015-07-18 21:14:20 +00:00
|
|
|
|
void CMainDialog::UpdateChapterPassed()
|
2012-06-26 20:23:05 +00:00
|
|
|
|
{
|
2015-07-18 21:14:20 +00:00
|
|
|
|
// TODO: CMainDialog is a bad place for this function
|
|
|
|
|
bool bAll = true;
|
|
|
|
|
for ( int i=0 ; i<m_maxList ; i++ )
|
2012-06-26 20:23:05 +00:00
|
|
|
|
{
|
2015-07-18 21:14:20 +00:00
|
|
|
|
if (!m_main->GetPlayerProgress()->GetLevelPassed(m_category, m_chap[m_category]+1, i+1))
|
2015-06-21 18:59:23 +00:00
|
|
|
|
{
|
2015-07-18 21:14:20 +00:00
|
|
|
|
bAll = false;
|
2015-06-21 18:59:23 +00:00
|
|
|
|
break;
|
|
|
|
|
}
|
2012-06-26 20:23:05 +00:00
|
|
|
|
}
|
2015-07-18 21:14:20 +00:00
|
|
|
|
m_main->GetPlayerProgress()->IncrementLevelTryCount(m_category, m_chap[m_category]+1, 0);
|
|
|
|
|
m_main->GetPlayerProgress()->SetLevelPassed(m_category, m_chap[m_category]+1, 0, bAll);
|
2012-06-26 20:23:05 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Passes to the next mission, and possibly in the next chapter.
|
|
|
|
|
|
|
|
|
|
bool CMainDialog::NextMission()
|
|
|
|
|
{
|
2015-07-18 16:52:37 +00:00
|
|
|
|
m_sel[m_category] ++; // next mission
|
2012-06-26 20:23:05 +00:00
|
|
|
|
|
2015-07-18 16:52:37 +00:00
|
|
|
|
if ( m_sel[m_category] >= m_maxList ) // last mission of the chapter?
|
2012-06-26 20:23:05 +00:00
|
|
|
|
{
|
2015-07-18 16:52:37 +00:00
|
|
|
|
m_chap[m_category] ++; // next chapter
|
|
|
|
|
m_sel[m_category] = 0; // first mission
|
2012-06-26 20:23:05 +00:00
|
|
|
|
}
|
|
|
|
|
|
2015-07-18 21:14:20 +00:00
|
|
|
|
m_main->GetPlayerProgress()->SetSelectedChap(m_category, m_chap[m_category]+1);
|
|
|
|
|
m_main->GetPlayerProgress()->SetSelectedRank(m_category, m_sel[m_category]+1);
|
|
|
|
|
|
2012-06-26 20:23:05 +00:00
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
|
2015-07-18 16:52:37 +00:00
|
|
|
|
std::string& CMainDialog::GetCustomLevelName(int id)
|
2014-09-26 18:53:11 +00:00
|
|
|
|
{
|
2015-07-18 17:43:22 +00:00
|
|
|
|
return m_customLevelList[id-1];
|
2014-09-26 18:53:11 +00:00
|
|
|
|
}
|
|
|
|
|
|
2012-09-20 19:47:53 +00:00
|
|
|
|
|
2012-09-15 19:47:19 +00:00
|
|
|
|
} // namespace Ui
|