2012-06-26 20:23:05 +00:00
|
|
|
// * This file is part of the COLOBOT source code
|
|
|
|
// * Copyright (C) 2001-2008, Daniel ROUX & EPSITEC SA, www.epsitec.ch
|
|
|
|
// *
|
|
|
|
// * 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
|
2012-09-15 19:47:19 +00:00
|
|
|
// * MERCHANTABILITY or FITNESS FOR A Gfx::PARTICULAR PURPOSE. See the
|
2012-06-26 20:23:05 +00:00
|
|
|
// * 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://www.gnu.org/licenses/.
|
|
|
|
|
|
|
|
// maindialog.cpp
|
|
|
|
|
2012-09-15 19:47:19 +00:00
|
|
|
#include "ui/maindialog.h"
|
2012-06-26 20:23:05 +00:00
|
|
|
|
|
|
|
#include "common/global.h"
|
|
|
|
#include "common/event.h"
|
|
|
|
#include "common/misc.h"
|
|
|
|
#include "common/profile.h"
|
|
|
|
#include "common/iman.h"
|
|
|
|
#include "common/restext.h"
|
2012-09-15 19:47:19 +00:00
|
|
|
#include "object/robotmain.h"
|
|
|
|
#include "script/cmdtoken.h"
|
|
|
|
#include "sound/sound.h"
|
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-06-26 20:23:05 +00:00
|
|
|
|
|
|
|
|
2012-09-15 19:47:19 +00:00
|
|
|
namespace Ui
|
|
|
|
{
|
|
|
|
|
2012-06-26 20:23:05 +00:00
|
|
|
const int KEY_VISIBLE = 6; // number of visible keys redefinable
|
|
|
|
|
2012-09-15 19:47:19 +00:00
|
|
|
/*TODO: #if _SCHOOL & _TEEN
|
2012-06-26 20:23:05 +00:00
|
|
|
const int KEY_TOTAL = 13; // total number of keys redefinable
|
2012-09-15 19:47:19 +00:00
|
|
|
#else*/
|
2012-06-26 20:23:05 +00:00
|
|
|
const int KEY_TOTAL = 21; // total number of keys redefinable
|
|
|
|
|
|
|
|
const int WELCOME_LENGTH = 6.0f;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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
|
|
|
};
|
|
|
|
|
|
|
|
|
2012-09-15 19:47:19 +00:00
|
|
|
/* TODO: ? #if _NET
|
2012-06-26 20:23:05 +00:00
|
|
|
// Check if the key "school" is present in the registry.
|
|
|
|
|
|
|
|
bool SchoolCheck()
|
|
|
|
{
|
|
|
|
HKEY key;
|
|
|
|
char buffer[100];
|
|
|
|
LONG i;
|
|
|
|
DWORD type, len;
|
|
|
|
|
|
|
|
i = RegOpenKeyEx(HKEY_LOCAL_MACHINE,
|
|
|
|
#if _NEWLOOK
|
|
|
|
"Software\\Epsitec\\CeeBot\\Setup",
|
|
|
|
#else
|
|
|
|
"Software\\Epsitec\\Colobot\\Setup",
|
|
|
|
#endif
|
|
|
|
0, KEY_READ, &key);
|
|
|
|
if ( i != ERROR_SUCCESS ) return false;
|
|
|
|
|
|
|
|
type = REG_SZ;
|
|
|
|
len = sizeof(buffer);
|
|
|
|
i = RegQueryValueEx(key, "School", NULL, &type, (LPBYTE)buffer, &len);
|
|
|
|
if ( i != ERROR_SUCCESS || type != REG_SZ ) return false;
|
|
|
|
|
|
|
|
if ( strcmp(buffer, "ToBoLoC") != 0 ) return false;
|
|
|
|
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
#endif
|
2012-09-15 19:47:19 +00:00
|
|
|
*/
|
2012-06-26 20:23:05 +00:00
|
|
|
|
|
|
|
// Constructor of robot application.
|
|
|
|
|
|
|
|
CMainDialog::CMainDialog(CInstanceManager* iMan)
|
|
|
|
{
|
|
|
|
m_iMan = iMan;
|
|
|
|
m_iMan->AddInstance(CLASS_DIALOG, this);
|
|
|
|
|
2012-09-15 19:47:19 +00:00
|
|
|
m_app = CApplication::GetInstancePointer();
|
|
|
|
|
2012-06-26 20:23:05 +00:00
|
|
|
m_main = (CRobotMain*)m_iMan->SearchInstance(CLASS_MAIN);
|
|
|
|
m_interface = (CInterface*)m_iMan->SearchInstance(CLASS_INTERFACE);
|
2012-09-15 19:47:19 +00:00
|
|
|
m_eventQueue = (CEventQueue*)m_iMan->SearchInstance(CLASS_EVENT);
|
|
|
|
m_engine = (Gfx::CEngine*)m_iMan->SearchInstance(CLASS_ENGINE);
|
|
|
|
m_particle = (Gfx::CParticle*)m_iMan->SearchInstance(CLASS_PARTICULE);
|
|
|
|
m_camera = (Gfx::CCamera*)m_iMan->SearchInstance(CLASS_CAMERA);
|
|
|
|
m_sound = (CSoundInterface*)m_iMan->SearchInstance(CLASS_SOUND);
|
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;
|
|
|
|
m_sceneName[0] = 0;
|
|
|
|
m_sceneRank = 0;
|
|
|
|
m_bSceneSoluce = false;
|
|
|
|
m_bSimulSetup = false;
|
2012-09-15 19:47:19 +00:00
|
|
|
/* TODO: ? #if _NET
|
2012-06-26 20:23:05 +00:00
|
|
|
m_accessEnable = SchoolCheck();
|
|
|
|
m_accessMission= false;
|
|
|
|
m_accessUser = false;
|
2012-09-15 19:47:19 +00:00
|
|
|
#else*/
|
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;
|
|
|
|
|
2012-09-15 19:47:19 +00:00
|
|
|
for (int i = 0; i < 10; i++)
|
2012-06-26 20:23:05 +00:00
|
|
|
{
|
|
|
|
m_chap[i] = 0;
|
|
|
|
m_sel[i] = 0;
|
|
|
|
}
|
|
|
|
m_index = 0;
|
|
|
|
m_maxList = 0;
|
|
|
|
|
2012-09-15 19:47:19 +00:00
|
|
|
memset(&m_perso, 0, sizeof(GamerPerso));
|
2012-06-26 20:23:05 +00:00
|
|
|
DefPerso();
|
2012-06-26 21:01:17 +00:00
|
|
|
|
2012-06-26 20:23:05 +00:00
|
|
|
m_bTooltip = true;
|
|
|
|
m_bGlint = true;
|
|
|
|
m_bRain = true;
|
|
|
|
m_bSoluce4 = true;
|
|
|
|
m_bMovies = true;
|
|
|
|
m_bNiceReset = true;
|
|
|
|
m_bHimselfDamage = true;
|
2012-09-15 19:47:19 +00:00
|
|
|
/* TODO: #if _TEEN
|
2012-06-26 20:23:05 +00:00
|
|
|
m_bCameraScroll = false;
|
2012-09-15 19:47:19 +00:00
|
|
|
#else*/
|
2012-06-26 20:23:05 +00:00
|
|
|
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;
|
|
|
|
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;
|
|
|
|
}
|
|
|
|
|
|
|
|
strcpy(m_sceneDir, "scene");
|
|
|
|
strcpy(m_savegameDir, "savegame");
|
|
|
|
strcpy(m_publicDir, "program");
|
|
|
|
strcpy(m_userDir, "user");
|
|
|
|
strcpy(m_filesDir, "files");
|
|
|
|
|
|
|
|
m_bDialog = false;
|
|
|
|
}
|
|
|
|
|
|
|
|
// Destructor of robot application.
|
|
|
|
|
|
|
|
CMainDialog::~CMainDialog()
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// Changes phase.
|
|
|
|
|
|
|
|
void CMainDialog::ChangePhase(Phase phase)
|
|
|
|
{
|
|
|
|
CWindow* pw;
|
|
|
|
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;
|
|
|
|
char name[100];
|
|
|
|
char* gamer;
|
|
|
|
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;
|
2012-09-15 19:47:19 +00:00
|
|
|
/* TODO: #if _TEEN
|
2012-06-26 20:23:05 +00:00
|
|
|
pw = m_interface->CreateWindows(pos, ddim, 12, EVENT_WINDOW5);
|
2012-09-15 19:47:19 +00:00
|
|
|
#else*/
|
2012-06-26 20:23:05 +00:00
|
|
|
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
|
|
|
|
|
2012-09-15 19:47:19 +00:00
|
|
|
/* TODO: #if _SCHOOL
|
2012-06-26 20:23:05 +00:00
|
|
|
ddim.x = 0.20f;
|
|
|
|
ddim.y = dim.y*2.4f;
|
|
|
|
pos.x = 0.40f;
|
|
|
|
pos.y = oy+sy*7.9f;
|
|
|
|
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);
|
2012-09-15 19:47:19 +00:00
|
|
|
#else */
|
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);
|
|
|
|
|
2012-09-15 19:47:19 +00:00
|
|
|
/* TODO: #if _SCHOOL
|
2012-06-26 20:23:05 +00:00
|
|
|
ddim.x = 0.18f;
|
|
|
|
ddim.y = dim.y*1;
|
|
|
|
pos.x = 0.41f;
|
|
|
|
pos.y = oy+sy*9.1f;
|
|
|
|
pb = pw->CreateButton(pos, ddim, -1, EVENT_INTERFACE_TRAINER);
|
|
|
|
pb->SetState(STATE_SHADOW);
|
|
|
|
|
|
|
|
pos.y = oy+sy*8.0f;
|
|
|
|
#if _TEEN
|
|
|
|
pb = pw->CreateButton(pos, ddim, -1, EVENT_INTERFACE_TEEN);
|
|
|
|
#else
|
|
|
|
pb = pw->CreateButton(pos, ddim, -1, EVENT_INTERFACE_DEFI);
|
|
|
|
#endif
|
|
|
|
#if _CEEBOTDEMO
|
|
|
|
pb->ClearState(STATE_ENABLE);
|
|
|
|
#endif
|
|
|
|
pb->SetState(STATE_SHADOW);
|
2012-09-15 19:47:19 +00:00
|
|
|
#else */
|
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-15 19:47:19 +00:00
|
|
|
|
|
|
|
/* TODO: setup mode?
|
|
|
|
if ( m_engine->GetSetupMode() )
|
2012-06-26 20:23:05 +00:00
|
|
|
{
|
|
|
|
pos.y = oy+sy*5.1f;
|
|
|
|
pb = pw->CreateButton(pos, ddim, -1, EVENT_INTERFACE_SETUP);
|
|
|
|
pb->SetState(STATE_SHADOW);
|
2012-09-15 19:47:19 +00:00
|
|
|
} */
|
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);
|
|
|
|
|
2012-09-15 19:47:19 +00:00
|
|
|
// TODO: #if !_DEMO & !_SCHOOL
|
2012-06-26 20:23:05 +00:00
|
|
|
if ( m_accessEnable && m_accessUser )
|
|
|
|
{
|
|
|
|
pos.x = 447.0f/640.0f;
|
|
|
|
pos.y = 313.0f/480.0f;
|
|
|
|
ddim.x = 0.09f;
|
2012-09-15 19:47:19 +00:00
|
|
|
/*#if _POLISH
|
2012-06-26 20:23:05 +00:00
|
|
|
pos.x -= 5.0f/640.0f;
|
|
|
|
ddim.x += 10.0f/640.0f;
|
2012-09-15 19:47:19 +00:00
|
|
|
#endif*/
|
2012-06-26 20:23:05 +00:00
|
|
|
pb = pw->CreateButton(pos, ddim, -1, EVENT_INTERFACE_USER);
|
|
|
|
pb->SetState(STATE_SHADOW);
|
|
|
|
}
|
2012-09-15 19:47:19 +00:00
|
|
|
// #endif
|
2012-06-26 20:23:05 +00:00
|
|
|
|
2012-09-15 19:47:19 +00:00
|
|
|
if ( m_app->GetDebugMode() )
|
2012-06-26 20:23:05 +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);
|
|
|
|
}
|
|
|
|
|
|
|
|
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;
|
2012-09-15 19:47:19 +00:00
|
|
|
pl = pw->CreateLabel(pos, ddim, 0, EVENT_LABEL1, "PPC Team");
|
|
|
|
pl->SetFontType(Gfx::FONT_COURIER);
|
2012-06-26 20:23:05 +00:00
|
|
|
pl->SetFontSize(8.0f);
|
|
|
|
|
2012-09-15 19:47:19 +00:00
|
|
|
m_engine->SetBackground("inter01.png",
|
|
|
|
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),
|
|
|
|
true, 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);
|
|
|
|
|
2012-09-15 19:47:19 +00:00
|
|
|
/* TODO: #if _NEWLOOK
|
2012-06-26 20:23:05 +00:00
|
|
|
pos.x = 80.0f/640.0f;
|
|
|
|
pos.y = 93.0f/480.0f;
|
|
|
|
ddim.x = 285.0f/640.0f;
|
|
|
|
ddim.y = 266.0f/480.0f;
|
|
|
|
pg = pw->CreateGroup(pos, ddim, 23, EVENT_LABEL1); // blue
|
|
|
|
pg->SetState(STATE_SHADOW);
|
|
|
|
pos.x = 372.0f/640.0f;
|
|
|
|
ddim.x = 188.0f/640.0f;
|
|
|
|
pg = pw->CreateGroup(pos, ddim, 26, EVENT_LABEL1); // violet
|
|
|
|
pg->SetState(STATE_SHADOW);
|
2012-09-15 19:47:19 +00:00
|
|
|
#endif*/
|
2012-06-26 20:23:05 +00:00
|
|
|
|
|
|
|
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);
|
2012-09-15 19:47:19 +00:00
|
|
|
gamer = m_main->GetGamerName();
|
2012-06-26 20:23:05 +00:00
|
|
|
if ( gamer[0] == 0 )
|
|
|
|
{
|
|
|
|
GetResource(RES_TEXT, RT_NAME_DEFAULT, name);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
strcpy(name, gamer);
|
|
|
|
}
|
|
|
|
pe->SetText(name);
|
|
|
|
pe->SetCursor(strlen(name), 0);
|
|
|
|
pe->SetFocus(true);
|
|
|
|
|
|
|
|
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);
|
|
|
|
|
2012-09-15 19:47:19 +00:00
|
|
|
/* TODO: #if !_TEEN
|
2012-06-26 20:23:05 +00:00
|
|
|
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);
|
2012-09-15 19:47:19 +00:00
|
|
|
#endif*/
|
2012-06-26 20:23:05 +00:00
|
|
|
|
|
|
|
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();
|
|
|
|
UpdateNameFace();
|
|
|
|
|
2012-09-15 19:47:19 +00:00
|
|
|
m_engine->SetBackground("inter01.png",
|
|
|
|
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),
|
|
|
|
true, 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);
|
|
|
|
|
2012-09-15 19:47:19 +00:00
|
|
|
/* TODO: #if _NEWLOOK
|
2012-06-26 20:23:05 +00:00
|
|
|
pos.x = 95.0f/640.0f;
|
|
|
|
pos.y = 66.0f/480.0f;
|
|
|
|
ddim.x = 443.0f/640.0f;
|
|
|
|
ddim.y = 42.0f/480.0f;
|
|
|
|
pg = pw->CreateGroup(pos, ddim, 26, EVENT_LABEL1); // violet
|
|
|
|
pg->SetState(STATE_SHADOW);
|
2012-09-15 19:47:19 +00:00
|
|
|
#endif*/
|
2012-06-26 20:23:05 +00:00
|
|
|
|
|
|
|
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-15 19:47:19 +00:00
|
|
|
pb = pw->CreateButton(pos, ddim, ti[i], (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-15 19:47:19 +00:00
|
|
|
pco = pw->CreateColor(pos, ddim, -1, (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-15 19:47:19 +00:00
|
|
|
psl = pw->CreateSlider(pos, ddim, 0, (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-15 19:47:19 +00:00
|
|
|
pco = pw->CreateColor(pos, ddim, -1, (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-15 19:47:19 +00:00
|
|
|
psl = pw->CreateSlider(pos, ddim, 0, (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);
|
|
|
|
|
|
|
|
m_persoCopy = m_perso;
|
|
|
|
m_persoTab = 0;
|
|
|
|
m_persoAngle = -0.6f;
|
|
|
|
UpdatePerso();
|
|
|
|
m_main->ScenePerso();
|
|
|
|
CameraPerso();
|
|
|
|
}
|
|
|
|
|
|
|
|
if ( m_phase == PHASE_TRAINER ||
|
|
|
|
m_phase == PHASE_DEFI ||
|
|
|
|
m_phase == PHASE_MISSION ||
|
|
|
|
m_phase == PHASE_FREE ||
|
|
|
|
m_phase == PHASE_TEEN ||
|
|
|
|
m_phase == PHASE_USER ||
|
|
|
|
m_phase == PHASE_PROTO )
|
|
|
|
{
|
|
|
|
if ( m_phase == PHASE_TRAINER ) m_index = 0;
|
|
|
|
if ( m_phase == PHASE_DEFI ) m_index = 1;
|
|
|
|
if ( m_phase == PHASE_MISSION ) m_index = 2;
|
|
|
|
if ( m_phase == PHASE_FREE ) m_index = 3;
|
|
|
|
if ( m_phase == PHASE_USER ) m_index = 4;
|
|
|
|
if ( m_phase == PHASE_PROTO ) m_index = 5;
|
|
|
|
if ( m_phase == PHASE_TEEN ) m_index = 6;
|
|
|
|
|
|
|
|
if ( m_phase == PHASE_FREE )
|
|
|
|
{
|
|
|
|
strcpy(m_sceneName, "scene");
|
|
|
|
ReadGamerInfo();
|
2012-09-15 19:47:19 +00:00
|
|
|
m_accessChap = GetChapPassed();
|
2012-06-26 20:23:05 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
if ( m_phase == PHASE_TRAINER ) strcpy(m_sceneName, "train");
|
|
|
|
if ( m_phase == PHASE_DEFI ) strcpy(m_sceneName, "defi" );
|
|
|
|
if ( m_phase == PHASE_MISSION ) strcpy(m_sceneName, "scene");
|
|
|
|
if ( m_phase == PHASE_FREE ) strcpy(m_sceneName, "free");
|
|
|
|
if ( m_phase == PHASE_TEEN ) strcpy(m_sceneName, "teen");
|
|
|
|
if ( m_phase == PHASE_USER ) strcpy(m_sceneName, "user");
|
|
|
|
if ( m_phase == PHASE_PROTO ) strcpy(m_sceneName, "proto");
|
|
|
|
|
|
|
|
ReadGamerInfo();
|
|
|
|
|
|
|
|
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_TEEN ) res = RT_TITLE_TEEN;
|
|
|
|
if ( m_phase == PHASE_USER ) res = RT_TITLE_USER;
|
|
|
|
if ( m_phase == PHASE_PROTO ) res = RT_TITLE_PROTO;
|
|
|
|
GetResource(RES_TEXT, res, name);
|
|
|
|
pw->SetName(name);
|
|
|
|
|
2012-09-15 19:47:19 +00:00
|
|
|
/* TODO: #if _NEWLOOK
|
2012-06-26 20:23:05 +00:00
|
|
|
pos.x = 100.0f/640.0f;
|
|
|
|
pos.y = 226.0f/480.0f;
|
|
|
|
ddim.x = 216.0f/640.0f;
|
|
|
|
ddim.y = 160.0f/480.0f;
|
|
|
|
pg = pw->CreateGroup(pos, ddim, 23, EVENT_LABEL1); // blue
|
|
|
|
pg->SetState(STATE_SHADOW);
|
|
|
|
pos.x = 322.0f/640.0f;
|
|
|
|
pg = pw->CreateGroup(pos, ddim, 24, EVENT_LABEL1); // cyan
|
|
|
|
pg->SetState(STATE_SHADOW);
|
|
|
|
|
|
|
|
pos.x = 100.0f/640.0f;
|
|
|
|
pos.y = 122.0f/480.0f;
|
|
|
|
ddim.x = 438.0f/640.0f;
|
|
|
|
ddim.y = 98.0f/480.0f;
|
|
|
|
pg = pw->CreateGroup(pos, ddim, 25, EVENT_LABEL1); // green
|
|
|
|
pg->SetState(STATE_SHADOW);
|
|
|
|
pos.y = 66.0f/480.0f;
|
|
|
|
ddim.y = 42.0f/480.0f;
|
|
|
|
pg = pw->CreateGroup(pos, ddim, 26, EVENT_LABEL1); // violet
|
|
|
|
pg->SetState(STATE_SHADOW);
|
2012-09-15 19:47:19 +00:00
|
|
|
#endif */
|
2012-06-26 20:23:05 +00:00
|
|
|
|
|
|
|
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_TEEN ) res = RT_PLAY_CHAPte;
|
|
|
|
if ( m_phase == PHASE_USER ) res = RT_PLAY_CHAPu;
|
|
|
|
if ( m_phase == PHASE_PROTO ) res = RT_PLAY_CHAPp;
|
|
|
|
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);
|
|
|
|
UpdateSceneChap(m_chap[m_index]);
|
|
|
|
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_TEEN ) res = RT_PLAY_LISTk;
|
|
|
|
if ( m_phase == PHASE_USER ) res = RT_PLAY_LISTu;
|
|
|
|
if ( m_phase == PHASE_PROTO ) res = RT_PLAY_LISTp;
|
|
|
|
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);
|
|
|
|
UpdateSceneList(m_chap[m_index], m_sel[m_index]);
|
|
|
|
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
|
|
|
|
pe->SetHiliteCap(false);
|
|
|
|
|
|
|
|
// Button displays the "soluce":
|
|
|
|
if ( m_phase != PHASE_TRAINER &&
|
|
|
|
m_phase != PHASE_FREE &&
|
|
|
|
m_phase != PHASE_TEEN )
|
|
|
|
{
|
|
|
|
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;
|
|
|
|
|
|
|
|
UpdateSceneResume((m_chap[m_index]+1)*100+(m_sel[m_index]+1));
|
|
|
|
|
|
|
|
if ( m_phase == PHASE_MISSION ||
|
|
|
|
m_phase == PHASE_FREE ||
|
|
|
|
m_phase == PHASE_USER )
|
|
|
|
{
|
|
|
|
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);
|
|
|
|
|
2012-09-15 19:47:19 +00:00
|
|
|
m_engine->SetBackground("inter01.png",
|
|
|
|
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),
|
|
|
|
true, true);
|
2012-06-26 20:23:05 +00:00
|
|
|
m_engine->SetBackForce(true);
|
|
|
|
}
|
|
|
|
|
|
|
|
if ( m_phase == PHASE_SETUPd ||
|
|
|
|
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 )
|
|
|
|
{
|
|
|
|
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
|
|
|
|
|
2012-09-15 19:47:19 +00:00
|
|
|
/* TODO: #if _NEWLOOK
|
2012-06-26 20:23:05 +00:00
|
|
|
if ( m_phase == PHASE_SETUPd || // setup/display ?
|
|
|
|
m_phase == PHASE_SETUPds )
|
|
|
|
{
|
|
|
|
pos.x = 100.0f/640.0f;
|
|
|
|
pos.y = 130.0f/480.0f;
|
|
|
|
ddim.x = 216.0f/640.0f;
|
|
|
|
ddim.y = 212.0f/480.0f;
|
|
|
|
pg = pw->CreateGroup(pos, ddim, 23, EVENT_LABEL1); // blue
|
|
|
|
pg->SetState(STATE_SHADOW);
|
|
|
|
pos.x = 324.0f/640.0f;
|
|
|
|
pg = pw->CreateGroup(pos, ddim, 24, EVENT_LABEL1); // cyan
|
|
|
|
pg->SetState(STATE_SHADOW);
|
|
|
|
}
|
|
|
|
if ( m_phase == PHASE_SETUPg || // setup/graphic ?
|
|
|
|
m_phase == PHASE_SETUPgs )
|
|
|
|
{
|
|
|
|
pos.x = 100.0f/640.0f;
|
|
|
|
pos.y = 130.0f/480.0f;
|
|
|
|
ddim.x = 174.0f/640.0f;
|
|
|
|
ddim.y = 212.0f/480.0f;
|
|
|
|
pg = pw->CreateGroup(pos, ddim, 23, EVENT_LABEL1); // blue
|
|
|
|
pg->SetState(STATE_SHADOW);
|
|
|
|
pos.x = 282.0f/640.0f;
|
|
|
|
ddim.x = 258.0f/640.0f;
|
|
|
|
pg = pw->CreateGroup(pos, ddim, 24, EVENT_LABEL1); // cyan
|
|
|
|
pg->SetState(STATE_SHADOW);
|
|
|
|
}
|
|
|
|
if ( m_phase == PHASE_SETUPp || // setup/game ?
|
|
|
|
m_phase == PHASE_SETUPps )
|
|
|
|
{
|
|
|
|
pos.x = 100.0f/640.0f;
|
|
|
|
pos.y = 130.0f/480.0f;
|
|
|
|
ddim.x = 226.0f/640.0f;
|
|
|
|
ddim.y = 212.0f/480.0f;
|
|
|
|
pg = pw->CreateGroup(pos, ddim, 23, EVENT_LABEL1); // blue
|
|
|
|
pg->SetState(STATE_SHADOW);
|
|
|
|
pos.x = 334.0f/640.0f;
|
|
|
|
ddim.x = 206.0f/640.0f;
|
|
|
|
pg = pw->CreateGroup(pos, ddim, 24, EVENT_LABEL1); // cyan
|
|
|
|
pg->SetState(STATE_SHADOW);
|
|
|
|
}
|
|
|
|
if ( m_phase == PHASE_SETUPc || // setup/command ?
|
|
|
|
m_phase == PHASE_SETUPcs )
|
|
|
|
{
|
|
|
|
pos.x = 100.0f/640.0f;
|
|
|
|
pos.y = 125.0f/480.0f;
|
|
|
|
ddim.x = 440.0f/640.0f;
|
|
|
|
ddim.y = 222.0f/480.0f;
|
|
|
|
pg = pw->CreateGroup(pos, ddim, 23, EVENT_LABEL1); // blue
|
|
|
|
pg->SetState(STATE_SHADOW);
|
|
|
|
}
|
|
|
|
if ( m_phase == PHASE_SETUPs || // setup/sound ?
|
|
|
|
m_phase == PHASE_SETUPss )
|
|
|
|
{
|
|
|
|
pos.x = 100.0f/640.0f;
|
|
|
|
pos.y = 130.0f/480.0f;
|
|
|
|
ddim.x = 216.0f/640.0f;
|
|
|
|
ddim.y = 212.0f/480.0f;
|
|
|
|
pg = pw->CreateGroup(pos, ddim, 23, EVENT_LABEL1); // blue
|
|
|
|
pg->SetState(STATE_SHADOW);
|
|
|
|
pos.x = 324.0f/640.0f;
|
|
|
|
pg = pw->CreateGroup(pos, ddim, 24, EVENT_LABEL1); // cyan
|
|
|
|
pg->SetState(STATE_SHADOW);
|
|
|
|
}
|
|
|
|
|
|
|
|
pos.x = 100.0f/640.0f;
|
|
|
|
pos.y = 66.0f/480.0f;
|
|
|
|
ddim.x = 440.0f/640.0f;
|
|
|
|
ddim.y = 42.0f/480.0f;
|
|
|
|
pg = pw->CreateGroup(pos, ddim, 26, EVENT_LABEL1); // violet
|
|
|
|
pg->SetState(STATE_SHADOW);
|
2012-09-15 19:47:19 +00:00
|
|
|
#endif */
|
2012-06-26 20:23:05 +00:00
|
|
|
|
|
|
|
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));
|
|
|
|
|
|
|
|
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 )
|
|
|
|
{
|
2012-09-15 19:47:19 +00:00
|
|
|
m_engine->SetBackground("inter01.png",
|
|
|
|
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),
|
|
|
|
true, true);
|
2012-06-26 20:23:05 +00:00
|
|
|
m_engine->SetBackForce(true);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if ( m_phase == PHASE_SETUPd || // setup/display ?
|
|
|
|
m_phase == PHASE_SETUPds )
|
|
|
|
{
|
|
|
|
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_DEVICE, 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 = oy+sy*5.2f;
|
|
|
|
ddim.x = dim.x*6;
|
|
|
|
ddim.y = dim.y*4.5f;
|
|
|
|
pli = pw->CreateList(pos, ddim, 0, EVENT_LIST1);
|
|
|
|
pli->SetState(STATE_SHADOW);
|
|
|
|
UpdateDisplayDevice();
|
|
|
|
|
|
|
|
pos.x = ox+sx*10;
|
|
|
|
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-06-26 20:23:05 +00:00
|
|
|
pos.x = ox+sx*10;
|
|
|
|
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();
|
|
|
|
pli->SetState(STATE_ENABLE, m_setupFull);
|
|
|
|
|
|
|
|
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);
|
|
|
|
|
|
|
|
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 ?
|
|
|
|
m_phase == PHASE_SETUPgs )
|
|
|
|
{
|
|
|
|
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;
|
2012-09-15 19:47:19 +00:00
|
|
|
/* TODO: #if _POLISH
|
2012-06-26 20:23:05 +00:00
|
|
|
ddim.x += 20.0f/640.0f;
|
|
|
|
pos.x -= 20.0f/640.0f*3.0f;
|
2012-09-15 19:47:19 +00:00
|
|
|
#endif*/
|
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 ?
|
|
|
|
m_phase == PHASE_SETUPps )
|
|
|
|
{
|
|
|
|
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_TOTO);
|
|
|
|
//? pc->SetState(STATE_SHADOW);
|
|
|
|
//? pos.y -= 0.048f;
|
2012-09-15 19:47:19 +00:00
|
|
|
/*TODO: #if _SCHOOL
|
2012-06-26 20:23:05 +00:00
|
|
|
#if _EDU
|
|
|
|
pc = pw->CreateCheck(pos, ddim, -1, EVENT_INTERFACE_SOLUCE4);
|
|
|
|
pc->SetState(STATE_SHADOW);
|
|
|
|
pos.y -= 0.048f;
|
|
|
|
#endif
|
2012-09-15 19:47:19 +00:00
|
|
|
#else*/
|
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-15 19:47:19 +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);
|
|
|
|
//? 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);
|
|
|
|
|
|
|
|
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;
|
|
|
|
pc = pw->CreateCheck(pos, ddim, -1, EVENT_INTERFACE_MOUSE);
|
|
|
|
pc->SetState(STATE_SHADOW);
|
|
|
|
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 ?
|
|
|
|
m_phase == PHASE_SETUPcs )
|
|
|
|
{
|
|
|
|
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);
|
|
|
|
ps->SetVisibleRatio((float)KEY_VISIBLE/KEY_TOTAL);
|
|
|
|
ps->SetArrowStep(1.0f/((float)KEY_TOTAL-KEY_VISIBLE));
|
|
|
|
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 ?
|
|
|
|
m_phase == PHASE_SETUPss )
|
|
|
|
{
|
|
|
|
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
|
|
|
|
2012-09-15 19:47:19 +00:00
|
|
|
// TODO: #if (_FULL | _NET) & _SOUNDTRACKS
|
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);
|
|
|
|
// #endif
|
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.55f;
|
|
|
|
pc = pw->CreateCheck(pos, ddim, -1, EVENT_INTERFACE_SOUND3D);
|
|
|
|
pc->SetState(STATE_SHADOW);
|
|
|
|
|
|
|
|
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 ||
|
|
|
|
m_phase == PHASE_WRITEs )
|
|
|
|
{
|
|
|
|
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
|
|
|
|
|
2012-09-15 19:47:19 +00:00
|
|
|
/* TODO: #if _NEWLOOK
|
2012-06-26 20:23:05 +00:00
|
|
|
pos.x = 100.0f/640.0f;
|
|
|
|
pos.y = 66.0f/480.0f;
|
|
|
|
ddim.x = 438.0f/640.0f;
|
|
|
|
ddim.y = 42.0f/480.0f;
|
|
|
|
pg = pw->CreateGroup(pos, ddim, 26, EVENT_LABEL1); // violet
|
|
|
|
pg->SetState(STATE_SHADOW);
|
2012-09-15 19:47:19 +00:00
|
|
|
#endif */
|
2012-06-26 20:23:05 +00:00
|
|
|
|
|
|
|
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 ||
|
|
|
|
m_phase == PHASE_READs )
|
|
|
|
{
|
|
|
|
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
|
|
|
|
|
2012-09-15 19:47:19 +00:00
|
|
|
/* TODO: #if _NEWLOOK
|
2012-06-26 20:23:05 +00:00
|
|
|
pos.x = 100.0f/640.0f;
|
|
|
|
pos.y = 66.0f/480.0f;
|
|
|
|
ddim.x = 438.0f/640.0f;
|
|
|
|
ddim.y = 42.0f/480.0f;
|
|
|
|
pg = pw->CreateGroup(pos, ddim, 26, EVENT_LABEL1); // violet
|
|
|
|
pg->SetState(STATE_SHADOW);
|
2012-09-15 19:47:19 +00:00
|
|
|
#endif*/
|
2012-06-26 20:23:05 +00:00
|
|
|
|
|
|
|
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 )
|
|
|
|
{
|
2012-09-15 19:47:19 +00:00
|
|
|
m_engine->SetBackground("inter01.png",
|
|
|
|
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),
|
|
|
|
true, 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;
|
2012-09-15 19:47:19 +00:00
|
|
|
/*TODO: #if _TEEN
|
2012-06-26 20:23:05 +00:00
|
|
|
pw = m_interface->CreateWindows(pos, ddim, 12, EVENT_WINDOW5);
|
2012-09-15 19:47:19 +00:00
|
|
|
#else*/
|
2012-06-26 20:23:05 +00:00
|
|
|
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);
|
|
|
|
|
|
|
|
m_engine->SetBackground("inter01.png",
|
|
|
|
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),
|
|
|
|
true, 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 )
|
|
|
|
{
|
|
|
|
m_sound->StopMusic();
|
|
|
|
m_sound->PlayMusic(11, false);
|
|
|
|
|
|
|
|
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);
|
|
|
|
|
2012-09-15 19:47:19 +00:00
|
|
|
m_engine->SetBackground("ppc.png",
|
|
|
|
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),
|
|
|
|
true, false);
|
2012-06-26 20:23:05 +00:00
|
|
|
m_engine->SetBackForce(true);
|
|
|
|
}
|
|
|
|
if ( m_phase == PHASE_WELCOME2 )
|
|
|
|
{
|
|
|
|
m_sound->StopMusic();
|
|
|
|
m_sound->PlayMusic(11, false);
|
|
|
|
|
|
|
|
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);
|
|
|
|
|
2012-09-15 19:47:19 +00:00
|
|
|
m_engine->SetBackground("colobot.png",
|
|
|
|
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),
|
|
|
|
true, false);
|
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);
|
|
|
|
|
2012-09-15 19:47:19 +00:00
|
|
|
m_engine->SetBackground("epsitece.png",
|
|
|
|
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),
|
|
|
|
true, false);
|
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);
|
|
|
|
|
2012-09-15 19:47:19 +00:00
|
|
|
// TODO: #if _FULL | _NET
|
2012-06-26 20:23:05 +00:00
|
|
|
pos.x = 80.0f/640.0f;
|
|
|
|
pos.y = 240.0f/480.0f;
|
|
|
|
ddim.x = 490.0f/640.0f;
|
|
|
|
ddim.y = 110.0f/480.0f;
|
|
|
|
pe = pw->CreateEdit(pos, ddim, 0, EVENT_EDIT1);
|
|
|
|
pe->SetGenericMode(true);
|
|
|
|
pe->SetEditCap(false);
|
|
|
|
pe->SetHiliteCap(false);
|
2012-09-15 19:47:19 +00:00
|
|
|
pe->SetFontType(Gfx::FONT_COURIER);
|
2012-06-26 20:23:05 +00:00
|
|
|
pe->SetFontSize(8.0f);
|
|
|
|
pe->ReadText("help\\authors.txt");
|
|
|
|
|
|
|
|
pos.x = 80.0f/640.0f;
|
|
|
|
pos.y = 140.0f/480.0f;
|
|
|
|
ddim.x = 490.0f/640.0f;
|
|
|
|
ddim.y = 100.0f/480.0f;
|
|
|
|
pe = pw->CreateEdit(pos, ddim, 0, EVENT_EDIT2);
|
|
|
|
pe->SetGenericMode(true);
|
|
|
|
pe->SetEditCap(false);
|
|
|
|
pe->SetHiliteCap(false);
|
2012-09-15 19:47:19 +00:00
|
|
|
pe->SetFontType(Gfx::FONT_COURIER);
|
2012-06-26 20:23:05 +00:00
|
|
|
pe->SetFontSize(6.5f);
|
|
|
|
pe->ReadText("help\\licences.txt");
|
2012-09-15 19:47:19 +00:00
|
|
|
// #endif
|
|
|
|
/* TODO: #if _SCHOOL
|
2012-06-26 20:23:05 +00:00
|
|
|
#if _CEEBOTDEMO
|
|
|
|
pos.x = 80.0f/640.0f;
|
|
|
|
pos.y = 210.0f/480.0f;
|
|
|
|
ddim.x = 490.0f/640.0f;
|
|
|
|
ddim.y = 150.0f/480.0f;
|
|
|
|
#else
|
|
|
|
pos.x = 80.0f/640.0f;
|
|
|
|
pos.y = 200.0f/480.0f;
|
|
|
|
ddim.x = 490.0f/640.0f;
|
|
|
|
ddim.y = 150.0f/480.0f;
|
2012-09-15 19:47:19 +00:00
|
|
|
#endif*/
|
2012-06-26 20:23:05 +00:00
|
|
|
pe = pw->CreateEdit(pos, ddim, 0, EVENT_EDIT1);
|
|
|
|
pe->SetGenericMode(true);
|
|
|
|
pe->SetEditCap(false);
|
|
|
|
pe->SetHiliteCap(false);
|
2012-09-15 19:47:19 +00:00
|
|
|
pe->SetFontType(Gfx::FONT_COURIER);
|
2012-06-26 20:23:05 +00:00
|
|
|
pe->SetFontSize(8.0f);
|
|
|
|
pe->ReadText("help\\authors.txt");
|
2012-09-15 19:47:19 +00:00
|
|
|
|
|
|
|
/* #if _DEMO
|
2012-06-26 20:23:05 +00:00
|
|
|
//? pos.x = 80.0f/640.0f;
|
|
|
|
//? pos.y = 240.0f/480.0f;
|
|
|
|
//? ddim.x = 490.0f/640.0f;
|
|
|
|
//? ddim.y = 110.0f/480.0f;
|
|
|
|
//? pe = pw->CreateEdit(pos, ddim, 0, EVENT_EDIT1);
|
|
|
|
//? pe->SetGenericMode(true);
|
|
|
|
//? pe->SetEditCap(false);
|
|
|
|
//? pe->SetHiliteCap(false);
|
2012-09-15 19:47:19 +00:00
|
|
|
//? pe->SetFontType(Gfx::FONT_COURIER);
|
2012-06-26 20:23:05 +00:00
|
|
|
//? pe->SetFontSize(8.0f);
|
|
|
|
//? pe->ReadText("help\\demo.txt");
|
|
|
|
|
|
|
|
//? pos.x = 80.0f/640.0f;
|
|
|
|
//? pos.y = 140.0f/480.0f;
|
|
|
|
//? ddim.x = 490.0f/640.0f;
|
|
|
|
//? ddim.y = 100.0f/480.0f;
|
|
|
|
//? pe = pw->CreateEdit(pos, ddim, 0, EVENT_EDIT2);
|
|
|
|
//? pe->SetGenericMode(true);
|
|
|
|
//? pe->SetEditCap(false);
|
|
|
|
//? pe->SetHiliteCap(false);
|
2012-09-15 19:47:19 +00:00
|
|
|
//? pe->SetFontType(Gfx::FONT_COURIER);
|
2012-06-26 20:23:05 +00:00
|
|
|
//? pe->SetFontSize(8.0f);
|
|
|
|
//? pe->ReadText("help\\authors.txt");
|
2012-09-15 19:47:19 +00:00
|
|
|
#endif */
|
2012-06-26 20:23:05 +00:00
|
|
|
|
2012-09-15 19:47:19 +00:00
|
|
|
// TODO: #if !_DEMO
|
2012-06-26 20:23:05 +00:00
|
|
|
pos.x = 40.0f/640.0f;
|
|
|
|
pos.y = 83.0f/480.0f;
|
|
|
|
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);
|
2012-06-26 20:23:05 +00:00
|
|
|
pl->SetFontSize(8.0f);
|
|
|
|
|
|
|
|
pos.y = 13.0f/480.0f;
|
|
|
|
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);
|
2012-06-26 20:23:05 +00:00
|
|
|
pl->SetFontSize(8.0f);
|
|
|
|
|
|
|
|
pos.x = 355.0f/640.0f;
|
|
|
|
pos.y = 83.0f/480.0f;
|
|
|
|
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);
|
2012-06-26 20:23:05 +00:00
|
|
|
pl->SetFontSize(8.0f);
|
|
|
|
|
|
|
|
pos.y = 13.0f/480.0f;
|
|
|
|
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);
|
2012-06-26 20:23:05 +00:00
|
|
|
pl->SetFontSize(8.0f);
|
2012-09-15 19:47:19 +00:00
|
|
|
// #endif
|
2012-06-26 20:23:05 +00:00
|
|
|
|
2012-09-15 19:47:19 +00:00
|
|
|
/* TODO: #if _DEMO
|
2012-06-26 20:23:05 +00:00
|
|
|
pos.x = 481.0f/640.0f;
|
|
|
|
pos.y = 51.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
|
|
|
#else */
|
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
|
|
|
// #endif
|
|
|
|
|
|
|
|
m_engine->SetBackground("genere.png",
|
|
|
|
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),
|
|
|
|
true, true);
|
2012-06-26 20:23:05 +00:00
|
|
|
m_engine->SetBackForce(true);
|
|
|
|
}
|
|
|
|
|
|
|
|
if ( m_phase == PHASE_INIT ||
|
|
|
|
m_phase == PHASE_NAME ||
|
|
|
|
m_phase == PHASE_TRAINER ||
|
|
|
|
m_phase == PHASE_DEFI ||
|
|
|
|
m_phase == PHASE_MISSION ||
|
|
|
|
m_phase == PHASE_FREE ||
|
|
|
|
m_phase == PHASE_TEEN ||
|
|
|
|
m_phase == PHASE_USER ||
|
|
|
|
m_phase == PHASE_PROTO ||
|
|
|
|
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-09-15 19:47:19 +00:00
|
|
|
/*TODO: #if _SCHOOL
|
2012-06-26 20:23:05 +00:00
|
|
|
#if _TEEN
|
|
|
|
pos.x = 50.0f/640.0f;
|
|
|
|
pos.y = 430.0f/480.0f;
|
|
|
|
ddim.x = 200.0f/640.0f;
|
|
|
|
ddim.y = 10.0f/480.0f;
|
|
|
|
#else
|
|
|
|
pos.x = 450.0f/640.0f;
|
|
|
|
pos.y = 0.0f/480.0f;
|
|
|
|
ddim.x = 170.0f/640.0f;
|
|
|
|
ddim.y = 9.0f/480.0f;
|
|
|
|
#endif
|
2012-09-15 19:47:19 +00:00
|
|
|
#else */
|
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;
|
2012-09-15 19:47:19 +00:00
|
|
|
//#endif
|
2012-06-26 20:23:05 +00:00
|
|
|
GetResource(RES_TEXT, RT_VERSION_ID, name);
|
|
|
|
pl = pw->CreateLabel(pos, ddim, 0, EVENT_LABEL1, name);
|
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-15 19:47:19 +00:00
|
|
|
// Geturns 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;
|
|
|
|
|
|
|
|
//? if ( m_phase == PHASE_WELCOME1 ) welcomeLength = WELCOME_LENGTH+2.0f;
|
|
|
|
//? else welcomeLength = WELCOME_LENGTH;
|
|
|
|
welcomeLength = WELCOME_LENGTH;
|
|
|
|
|
|
|
|
if ( m_phase == PHASE_WELCOME1 ||
|
|
|
|
m_phase == PHASE_WELCOME2 ||
|
|
|
|
m_phase == PHASE_WELCOME3 )
|
|
|
|
{
|
|
|
|
float intensity;
|
2012-09-15 19:47:19 +00:00
|
|
|
int mode = Gfx::ENG_RSTATE_TCOLOR_BLACK;
|
2012-06-26 20:23:05 +00:00
|
|
|
|
|
|
|
if ( m_phaseTime < 1.5f )
|
|
|
|
{
|
|
|
|
intensity = 1.0f-(m_phaseTime-0.5f);
|
|
|
|
}
|
|
|
|
else if ( m_phaseTime < welcomeLength-1.0f )
|
|
|
|
{
|
|
|
|
intensity = 0.0f;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
intensity = m_phaseTime-(welcomeLength-1.0f);
|
|
|
|
}
|
|
|
|
if ( intensity < 0.0f ) intensity = 0.0f;
|
|
|
|
if ( intensity > 1.0f ) intensity = 1.0f;
|
|
|
|
|
|
|
|
if ( (m_phase == PHASE_WELCOME2 && m_phaseTime > welcomeLength/2.0f) ||
|
|
|
|
m_phase == PHASE_WELCOME3 )
|
|
|
|
{
|
|
|
|
intensity = 1.0f-intensity;
|
2012-09-15 19:47:19 +00:00
|
|
|
mode = Gfx::ENG_RSTATE_TCOLOR_WHITE;
|
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 )
|
|
|
|
{
|
|
|
|
ChangePhase(PHASE_WELCOME2);
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
if ( m_phase == PHASE_WELCOME2 && m_phaseTime >= welcomeLength )
|
|
|
|
{
|
|
|
|
ChangePhase(PHASE_WELCOME3);
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
if ( m_phase == PHASE_WELCOME3 && m_phaseTime >= welcomeLength )
|
|
|
|
{
|
|
|
|
ChangePhase(PHASE_NAME);
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
if ( m_shotDelay > 0 && !m_bDialog ) // screenshot done?
|
|
|
|
{
|
|
|
|
m_shotDelay --;
|
|
|
|
if ( m_shotDelay == 0 )
|
|
|
|
{
|
|
|
|
m_engine->WriteScreenShot(m_shotName, 320, 240);
|
|
|
|
//? m_engine->WriteScreenShot(m_shotName, 160, 120);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
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
|
|
|
{
|
|
|
|
m_glintMouse = event.pos;
|
2012-09-15 19:47:19 +00:00
|
|
|
NiceParticle(event.pos, event.keyState&KS_MLEFT);
|
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 ||
|
|
|
|
(event.type == EVENT_KEY_DOWN && event.param == KEY(RETURN) ) )
|
2012-06-26 20:23:05 +00:00
|
|
|
{
|
|
|
|
StopDialog();
|
|
|
|
if ( m_phase == PHASE_NAME )
|
|
|
|
{
|
|
|
|
NameDelete();
|
|
|
|
}
|
|
|
|
if ( m_phase == PHASE_INIT )
|
|
|
|
{
|
2012-09-15 19:47:19 +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 ||
|
|
|
|
(event.type == EVENT_KEY_DOWN && event.param == 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();
|
|
|
|
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-15 19:47:19 +00:00
|
|
|
if ( m_engine->GetMouseVisible() &&
|
2012-06-26 20:23:05 +00:00
|
|
|
!m_interface->EventProcess(event) )
|
|
|
|
{
|
|
|
|
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:
|
|
|
|
if ( event.param == KEY(ESCAPE) )
|
2012-06-26 20:23:05 +00:00
|
|
|
{
|
|
|
|
//? StartQuit(); // would you leave?
|
|
|
|
m_sound->Play(SOUND_TZOING);
|
|
|
|
m_main->ChangePhase(PHASE_GENERIC);
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
|
|
|
case EVENT_INTERFACE_QUIT:
|
|
|
|
//? StartQuit(); // would you leave?
|
|
|
|
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_TEEN:
|
|
|
|
m_main->ChangePhase(PHASE_TEEN);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case EVENT_INTERFACE_USER:
|
|
|
|
m_main->ChangePhase(PHASE_USER);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case EVENT_INTERFACE_PROTO:
|
|
|
|
m_main->ChangePhase(PHASE_PROTO);
|
|
|
|
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:
|
|
|
|
break;
|
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:
|
|
|
|
if ( event.param == KEY(RETURN) )
|
2012-06-26 20:23:05 +00:00
|
|
|
{
|
|
|
|
NameSelect();
|
|
|
|
}
|
2012-09-15 19:47:19 +00:00
|
|
|
if ( event.param == KEY(ESCAPE) )
|
2012-06-26 20:23:05 +00:00
|
|
|
{
|
|
|
|
pw = (CWindow*)m_interface->SearchControl(EVENT_WINDOW5);
|
|
|
|
if ( pw == 0 ) break;
|
|
|
|
pb = (CButton*)pw->SearchControl(EVENT_INTERFACE_NCANCEL);
|
|
|
|
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:
|
|
|
|
pw = (CWindow*)m_interface->SearchControl(EVENT_WINDOW5);
|
|
|
|
if ( pw == 0 ) break;
|
|
|
|
pl = (CList*)pw->SearchControl(EVENT_INTERFACE_NLIST);
|
|
|
|
if ( pl == 0 ) break;
|
2012-09-15 19:47:19 +00:00
|
|
|
StartDeleteGame(pl->GetName(pl->GetSelect()));
|
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
2012-06-26 20:23:05 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if ( m_phase == PHASE_PERSO )
|
|
|
|
{
|
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:
|
|
|
|
if ( event.param == KEY(RETURN) )
|
2012-06-26 20:23:05 +00:00
|
|
|
{
|
|
|
|
m_main->ChangePhase(PHASE_INIT);
|
|
|
|
}
|
2012-09-15 19:47:19 +00:00
|
|
|
if ( event.param == KEY(ESCAPE) )
|
2012-06-26 20:23:05 +00:00
|
|
|
{
|
|
|
|
m_main->ChangePhase(PHASE_NAME);
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
|
|
|
case EVENT_INTERFACE_PHEAD:
|
|
|
|
m_persoTab = 0;
|
|
|
|
UpdatePerso();
|
|
|
|
m_main->ScenePerso();
|
|
|
|
CameraPerso();
|
|
|
|
break;
|
|
|
|
case EVENT_INTERFACE_PBODY:
|
|
|
|
m_persoTab = 1;
|
|
|
|
UpdatePerso();
|
|
|
|
m_main->ScenePerso();
|
|
|
|
CameraPerso();
|
|
|
|
break;
|
|
|
|
|
|
|
|
case EVENT_INTERFACE_PFACE1:
|
|
|
|
case EVENT_INTERFACE_PFACE2:
|
|
|
|
case EVENT_INTERFACE_PFACE3:
|
|
|
|
case EVENT_INTERFACE_PFACE4:
|
2012-09-15 19:47:19 +00:00
|
|
|
m_perso.face = event.type-EVENT_INTERFACE_PFACE1;
|
|
|
|
WriteGamerPerso(m_main->GetGamerName());
|
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:
|
2012-09-15 19:47:19 +00:00
|
|
|
m_perso.glasses = event.type-EVENT_INTERFACE_PGLASS0;
|
|
|
|
WriteGamerPerso(m_main->GetGamerName());
|
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);
|
|
|
|
WriteGamerPerso(m_main->GetGamerName());
|
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);
|
|
|
|
WriteGamerPerso(m_main->GetGamerName());
|
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();
|
2012-09-15 19:47:19 +00:00
|
|
|
WriteGamerPerso(m_main->GetGamerName());
|
2012-06-26 20:23:05 +00:00
|
|
|
UpdatePerso();
|
|
|
|
m_main->ScenePerso();
|
|
|
|
break;
|
|
|
|
|
|
|
|
case EVENT_INTERFACE_PDEF:
|
|
|
|
DefPerso();
|
2012-09-15 19:47:19 +00:00
|
|
|
WriteGamerPerso(m_main->GetGamerName());
|
2012-06-26 20:23:05 +00:00
|
|
|
UpdatePerso();
|
|
|
|
m_main->ScenePerso();
|
|
|
|
break;
|
|
|
|
|
|
|
|
case EVENT_INTERFACE_PLROT:
|
|
|
|
m_persoAngle += 0.2f;
|
|
|
|
break;
|
|
|
|
case EVENT_INTERFACE_PRROT:
|
|
|
|
m_persoAngle -= 0.2f;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case EVENT_INTERFACE_POK:
|
|
|
|
m_main->ChangePhase(PHASE_INIT);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case EVENT_INTERFACE_PCANCEL:
|
|
|
|
m_perso = m_persoCopy;
|
2012-09-15 19:47:19 +00:00
|
|
|
WriteGamerPerso(m_main->GetGamerName());
|
2012-06-26 20:23:05 +00:00
|
|
|
m_main->ChangePhase(PHASE_NAME);
|
|
|
|
break;
|
2012-09-15 19:47:19 +00:00
|
|
|
|
|
|
|
default:
|
|
|
|
break;
|
2012-06-26 20:23:05 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if ( m_phase == PHASE_TRAINER ||
|
|
|
|
m_phase == PHASE_DEFI ||
|
|
|
|
m_phase == PHASE_MISSION ||
|
|
|
|
m_phase == PHASE_FREE ||
|
|
|
|
m_phase == PHASE_TEEN ||
|
|
|
|
m_phase == PHASE_USER ||
|
|
|
|
m_phase == PHASE_PROTO )
|
|
|
|
{
|
|
|
|
pw = (CWindow*)m_interface->SearchControl(EVENT_WINDOW5);
|
|
|
|
if ( pw == 0 ) return false;
|
|
|
|
|
2012-09-15 19:47:19 +00:00
|
|
|
if ( event.type == pw->GetEventTypeClose() ||
|
|
|
|
event.type == EVENT_INTERFACE_BACK ||
|
|
|
|
(event.type == EVENT_KEY_DOWN && event.param == KEY(ESCAPE)) )
|
2012-06-26 20:23:05 +00:00
|
|
|
{
|
|
|
|
m_main->ChangePhase(PHASE_INIT);
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if ( m_phase == PHASE_TRAINER ||
|
|
|
|
m_phase == PHASE_DEFI ||
|
|
|
|
m_phase == PHASE_MISSION ||
|
|
|
|
m_phase == PHASE_FREE ||
|
|
|
|
m_phase == PHASE_TEEN ||
|
|
|
|
m_phase == PHASE_USER ||
|
|
|
|
m_phase == PHASE_PROTO )
|
|
|
|
{
|
2012-09-15 19:47:19 +00:00
|
|
|
switch( event.type )
|
2012-06-26 20:23:05 +00:00
|
|
|
{
|
|
|
|
case EVENT_INTERFACE_CHAP:
|
|
|
|
pl = (CList*)pw->SearchControl(EVENT_INTERFACE_CHAP);
|
|
|
|
if ( pl == 0 ) break;
|
2012-09-15 19:47:19 +00:00
|
|
|
m_chap[m_index] = pl->GetSelect();
|
2012-06-26 20:23:05 +00:00
|
|
|
UpdateSceneList(m_chap[m_index], m_sel[m_index]);
|
|
|
|
UpdateSceneResume((m_chap[m_index]+1)*100+(m_sel[m_index]+1));
|
|
|
|
break;
|
|
|
|
|
|
|
|
case EVENT_INTERFACE_LIST:
|
|
|
|
pl = (CList*)pw->SearchControl(EVENT_INTERFACE_LIST);
|
|
|
|
if ( pl == 0 ) break;
|
2012-09-15 19:47:19 +00:00
|
|
|
m_sel[m_index] = pl->GetSelect();
|
2012-06-26 20:23:05 +00:00
|
|
|
UpdateSceneResume((m_chap[m_index]+1)*100+(m_sel[m_index]+1));
|
|
|
|
break;
|
|
|
|
|
|
|
|
case EVENT_INTERFACE_SOLUCE:
|
|
|
|
pb = (CButton*)pw->SearchControl(EVENT_INTERFACE_SOLUCE);
|
|
|
|
if ( pb == 0 ) break;
|
|
|
|
m_bSceneSoluce = !m_bSceneSoluce;
|
|
|
|
pb->SetState(STATE_CHECK, m_bSceneSoluce);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case EVENT_INTERFACE_PLAY:
|
|
|
|
if ( m_phase == PHASE_PROTO && m_chap[m_index] == 0 && m_sel[m_index] == 0 )
|
|
|
|
{
|
|
|
|
m_main->ChangePhase(PHASE_MODEL);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
m_sceneRank = (m_chap[m_index]+1)*100+(m_sel[m_index]+1);
|
|
|
|
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:
|
|
|
|
break;
|
2012-06-26 20:23:05 +00:00
|
|
|
}
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
if ( m_phase == PHASE_SETUPd ||
|
|
|
|
m_phase == PHASE_SETUPg ||
|
|
|
|
m_phase == PHASE_SETUPp ||
|
|
|
|
m_phase == PHASE_SETUPc ||
|
|
|
|
m_phase == PHASE_SETUPs )
|
|
|
|
{
|
|
|
|
pw = (CWindow*)m_interface->SearchControl(EVENT_WINDOW5);
|
|
|
|
if ( pw == 0 ) return false;
|
|
|
|
|
2012-09-15 19:47:19 +00:00
|
|
|
if ( event.type == pw->GetEventTypeClose() ||
|
|
|
|
event.type == EVENT_INTERFACE_BACK ||
|
|
|
|
(event.type == EVENT_KEY_DOWN && event.param == 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);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case EVENT_INTERFACE_SETUPg:
|
|
|
|
m_main->ChangePhase(PHASE_SETUPg);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case EVENT_INTERFACE_SETUPp:
|
|
|
|
m_main->ChangePhase(PHASE_SETUPp);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case EVENT_INTERFACE_SETUPc:
|
|
|
|
m_main->ChangePhase(PHASE_SETUPc);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case EVENT_INTERFACE_SETUPs:
|
|
|
|
m_main->ChangePhase(PHASE_SETUPs);
|
|
|
|
break;
|
2012-09-15 19:47:19 +00:00
|
|
|
|
|
|
|
default:
|
|
|
|
break;
|
2012-06-26 20:23:05 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if ( m_phase == PHASE_SETUPds ||
|
|
|
|
m_phase == PHASE_SETUPgs ||
|
|
|
|
m_phase == PHASE_SETUPps ||
|
|
|
|
m_phase == PHASE_SETUPcs ||
|
|
|
|
m_phase == PHASE_SETUPss )
|
|
|
|
{
|
|
|
|
pw = (CWindow*)m_interface->SearchControl(EVENT_WINDOW5);
|
|
|
|
if ( pw == 0 ) return false;
|
|
|
|
|
2012-09-15 19:47:19 +00:00
|
|
|
if ( event.type == pw->GetEventTypeClose() ||
|
|
|
|
event.type == EVENT_INTERFACE_BACK ||
|
|
|
|
(event.type == EVENT_KEY_DOWN && event.param == 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);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case EVENT_INTERFACE_SETUPg:
|
|
|
|
ChangePhase(PHASE_SETUPgs);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case EVENT_INTERFACE_SETUPp:
|
|
|
|
ChangePhase(PHASE_SETUPps);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case EVENT_INTERFACE_SETUPc:
|
|
|
|
ChangePhase(PHASE_SETUPcs);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case EVENT_INTERFACE_SETUPs:
|
|
|
|
ChangePhase(PHASE_SETUPss);
|
|
|
|
break;
|
2012-09-15 19:47:19 +00:00
|
|
|
|
|
|
|
default:
|
|
|
|
break;
|
2012-06-26 20:23:05 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if ( m_phase == PHASE_SETUPd || // setup/display ?
|
|
|
|
m_phase == PHASE_SETUPds )
|
|
|
|
{
|
2012-09-15 19:47:19 +00:00
|
|
|
switch( event.type )
|
2012-06-26 20:23:05 +00:00
|
|
|
{
|
|
|
|
case EVENT_LIST1:
|
|
|
|
case EVENT_LIST2:
|
|
|
|
UpdateApply();
|
|
|
|
break;
|
|
|
|
|
|
|
|
case EVENT_INTERFACE_FULL:
|
|
|
|
pw = (CWindow*)m_interface->SearchControl(EVENT_WINDOW5);
|
|
|
|
if ( pw == 0 ) break;
|
|
|
|
pc = (CCheck*)pw->SearchControl(EVENT_INTERFACE_FULL);
|
|
|
|
if ( pc == 0 ) break;
|
|
|
|
pl = (CList*)pw->SearchControl(EVENT_LIST2);
|
|
|
|
if ( pl == 0 ) break;
|
|
|
|
if ( pc->TestState(STATE_CHECK) )
|
|
|
|
{
|
|
|
|
pc->ClearState(STATE_CHECK); // window
|
|
|
|
pl->ClearState(STATE_ENABLE);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
pc->SetState(STATE_CHECK); // fullscreen
|
|
|
|
pl->SetState(STATE_ENABLE);
|
|
|
|
}
|
|
|
|
UpdateApply();
|
|
|
|
break;
|
|
|
|
|
|
|
|
case EVENT_INTERFACE_APPLY:
|
|
|
|
pw = (CWindow*)m_interface->SearchControl(EVENT_WINDOW5);
|
|
|
|
if ( pw == 0 ) break;
|
|
|
|
pb = (CButton*)pw->SearchControl(EVENT_INTERFACE_APPLY);
|
|
|
|
if ( pb == 0 ) break;
|
|
|
|
pb->ClearState(STATE_PRESS);
|
|
|
|
pb->ClearState(STATE_HILIGHT);
|
|
|
|
ChangeDisplay();
|
|
|
|
UpdateApply();
|
|
|
|
break;
|
2012-09-15 19:47:19 +00:00
|
|
|
|
|
|
|
default:
|
|
|
|
break;
|
2012-06-26 20:23:05 +00:00
|
|
|
}
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
if ( m_phase == PHASE_SETUPg || // setup/graphic ?
|
|
|
|
m_phase == PHASE_SETUPgs )
|
|
|
|
{
|
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:
|
|
|
|
break;
|
2012-06-26 20:23:05 +00:00
|
|
|
}
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
if ( m_phase == PHASE_SETUPp || // setup/game ?
|
|
|
|
m_phase == PHASE_SETUPps )
|
|
|
|
{
|
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;
|
|
|
|
|
|
|
|
case EVENT_INTERFACE_MOUSE:
|
2012-09-15 19:47:19 +00:00
|
|
|
m_engine->SetMouseVisible(!m_engine->GetMouseVisible());
|
|
|
|
// TODO: system mouse visible
|
2012-06-26 20:23:05 +00:00
|
|
|
ChangeSetupButtons();
|
|
|
|
UpdateSetupButtons();
|
|
|
|
break;
|
|
|
|
|
|
|
|
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
|
|
|
|
|
|
|
default:
|
|
|
|
break;
|
2012-06-26 20:23:05 +00:00
|
|
|
}
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
if ( m_phase == PHASE_SETUPc || // setup/commands ?
|
|
|
|
m_phase == PHASE_SETUPcs )
|
|
|
|
{
|
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_KLEFT:
|
|
|
|
case EVENT_INTERFACE_KRIGHT:
|
|
|
|
case EVENT_INTERFACE_KUP:
|
|
|
|
case EVENT_INTERFACE_KDOWN:
|
|
|
|
case EVENT_INTERFACE_KGUP:
|
|
|
|
case EVENT_INTERFACE_KGDOWN:
|
|
|
|
case EVENT_INTERFACE_KCAMERA:
|
|
|
|
case EVENT_INTERFACE_KDESEL:
|
|
|
|
case EVENT_INTERFACE_KACTION:
|
|
|
|
case EVENT_INTERFACE_KNEAR:
|
|
|
|
case EVENT_INTERFACE_KAWAY:
|
|
|
|
case EVENT_INTERFACE_KNEXT:
|
|
|
|
case EVENT_INTERFACE_KHUMAN:
|
|
|
|
case EVENT_INTERFACE_KQUIT:
|
|
|
|
case EVENT_INTERFACE_KHELP:
|
|
|
|
case EVENT_INTERFACE_KPROG:
|
|
|
|
case EVENT_INTERFACE_KCBOT:
|
|
|
|
case EVENT_INTERFACE_KSPEED10:
|
|
|
|
case EVENT_INTERFACE_KSPEED15:
|
|
|
|
case EVENT_INTERFACE_KSPEED20:
|
|
|
|
case EVENT_INTERFACE_KSPEED30:
|
|
|
|
case EVENT_INTERFACE_KVISIT:
|
2012-09-15 19:47:19 +00:00
|
|
|
ChangeKey(event.type);
|
2012-06-26 20:23:05 +00:00
|
|
|
UpdateKey();
|
|
|
|
break;
|
|
|
|
|
|
|
|
case EVENT_INTERFACE_KDEF:
|
2012-09-15 19:47:19 +00:00
|
|
|
m_app->ResetKeyStates();
|
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:
|
|
|
|
break;
|
2012-06-26 20:23:05 +00:00
|
|
|
}
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
if ( m_phase == PHASE_SETUPs || // setup/sound ?
|
|
|
|
m_phase == PHASE_SETUPss )
|
|
|
|
{
|
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_SOUND3D:
|
2012-09-15 19:47:19 +00:00
|
|
|
m_sound->SetSound3D(!m_sound->GetSound3D());
|
2012-06-26 20:23:05 +00:00
|
|
|
ChangeSetupButtons();
|
|
|
|
UpdateSetupButtons();
|
|
|
|
break;
|
|
|
|
|
|
|
|
case EVENT_INTERFACE_SILENT:
|
|
|
|
m_sound->SetAudioVolume(0);
|
2012-09-15 19:47:19 +00:00
|
|
|
//TODO: m_sound->SetMidiVolume(0);
|
2012-06-26 20:23:05 +00:00
|
|
|
UpdateSetupButtons();
|
|
|
|
break;
|
|
|
|
case EVENT_INTERFACE_NOISY:
|
|
|
|
m_sound->SetAudioVolume(MAXVOLUME);
|
2012-09-15 19:47:19 +00:00
|
|
|
//TODO: m_sound->SetMidiVolume(MAXVOLUME*3/4);
|
2012-06-26 20:23:05 +00:00
|
|
|
UpdateSetupButtons();
|
|
|
|
break;
|
2012-09-15 19:47:19 +00:00
|
|
|
|
|
|
|
default:
|
|
|
|
break;
|
2012-06-26 20:23:05 +00:00
|
|
|
}
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
if ( m_phase == PHASE_READ )
|
|
|
|
{
|
|
|
|
pw = (CWindow*)m_interface->SearchControl(EVENT_WINDOW5);
|
|
|
|
if ( pw == 0 ) return false;
|
|
|
|
|
2012-09-15 19:47:19 +00:00
|
|
|
if ( event.type == pw->GetEventTypeClose() ||
|
|
|
|
event.type == EVENT_INTERFACE_BACK ||
|
|
|
|
(event.type == EVENT_KEY_DOWN && event.param == KEY(ESCAPE)) )
|
2012-06-26 20:23:05 +00:00
|
|
|
{
|
|
|
|
ChangePhase(m_phaseTerm);
|
|
|
|
}
|
|
|
|
|
2012-09-15 19:47:19 +00:00
|
|
|
if ( event.type == EVENT_INTERFACE_IOLIST )
|
2012-06-26 20:23:05 +00:00
|
|
|
{
|
|
|
|
IOUpdateList();
|
|
|
|
}
|
2012-09-15 19:47:19 +00:00
|
|
|
if ( event.type == EVENT_INTERFACE_IODELETE )
|
2012-06-26 20:23:05 +00:00
|
|
|
{
|
|
|
|
IODeleteScene();
|
|
|
|
IOUpdateList();
|
|
|
|
}
|
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);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
if ( m_phase == PHASE_WRITEs ||
|
|
|
|
m_phase == PHASE_READs )
|
|
|
|
{
|
|
|
|
pw = (CWindow*)m_interface->SearchControl(EVENT_WINDOW5);
|
|
|
|
if ( pw == 0 ) return false;
|
|
|
|
|
2012-09-15 19:47:19 +00:00
|
|
|
if ( event.type == pw->GetEventTypeClose() ||
|
|
|
|
event.type == EVENT_INTERFACE_BACK ||
|
|
|
|
(event.type == EVENT_KEY_DOWN && event.param == KEY(ESCAPE)) )
|
2012-06-26 20:23:05 +00:00
|
|
|
{
|
|
|
|
m_interface->DeleteControl(EVENT_WINDOW5);
|
|
|
|
ChangePhase(PHASE_SIMUL);
|
|
|
|
StopSuspend();
|
|
|
|
}
|
|
|
|
|
2012-09-15 19:47:19 +00:00
|
|
|
if ( event.type == EVENT_INTERFACE_IOLIST )
|
2012-06-26 20:23:05 +00:00
|
|
|
{
|
|
|
|
IOUpdateList();
|
|
|
|
}
|
2012-09-15 19:47:19 +00:00
|
|
|
if ( event.type == EVENT_INTERFACE_IODELETE )
|
2012-06-26 20:23:05 +00:00
|
|
|
{
|
|
|
|
IODeleteScene();
|
|
|
|
IOUpdateList();
|
|
|
|
}
|
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();
|
|
|
|
}
|
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);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
if ( m_phase == PHASE_WELCOME1 )
|
|
|
|
{
|
2012-09-15 19:47:19 +00:00
|
|
|
if ( event.type == EVENT_KEY_DOWN ||
|
|
|
|
event.type == EVENT_MOUSE_BUTTON_DOWN )
|
2012-06-26 20:23:05 +00:00
|
|
|
{
|
|
|
|
ChangePhase(PHASE_WELCOME2);
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if ( m_phase == PHASE_WELCOME2 )
|
|
|
|
{
|
2012-09-15 19:47:19 +00:00
|
|
|
if ( event.type == EVENT_KEY_DOWN ||
|
|
|
|
event.type == EVENT_MOUSE_BUTTON_DOWN )
|
2012-06-26 20:23:05 +00:00
|
|
|
{
|
|
|
|
ChangePhase(PHASE_WELCOME3);
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if ( m_phase == PHASE_WELCOME3 )
|
|
|
|
{
|
2012-09-15 19:47:19 +00:00
|
|
|
if ( event.type == EVENT_KEY_DOWN ||
|
|
|
|
event.type == EVENT_MOUSE_BUTTON_DOWN )
|
2012-06-26 20:23:05 +00:00
|
|
|
{
|
|
|
|
ChangePhase(PHASE_NAME);
|
|
|
|
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-15 19:47:19 +00:00
|
|
|
if ( event.param == 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;
|
|
|
|
|
|
|
|
pw = (CWindow*)m_interface->SearchControl(EVENT_WINDOW5);
|
|
|
|
if ( pw == 0 ) return;
|
|
|
|
|
|
|
|
if ( m_phase == PHASE_INIT )
|
|
|
|
{
|
|
|
|
pg = (CGroup*)pw->SearchControl(EVENT_INTERFACE_GLINTl);
|
|
|
|
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);
|
|
|
|
}
|
|
|
|
|
|
|
|
pg = (CGroup*)pw->SearchControl(EVENT_INTERFACE_GLINTr);
|
|
|
|
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 ||
|
|
|
|
m_phase == PHASE_TRAINER ||
|
|
|
|
m_phase == PHASE_MISSION ||
|
|
|
|
m_phase == PHASE_FREE ||
|
|
|
|
m_phase == PHASE_TEEN ||
|
|
|
|
m_phase == PHASE_USER ||
|
|
|
|
m_phase == PHASE_PROTO )
|
|
|
|
{
|
|
|
|
pg = (CGroup*)pw->SearchControl(EVENT_INTERFACE_GLINTl);
|
|
|
|
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);
|
|
|
|
}
|
|
|
|
|
|
|
|
pg = (CGroup*)pw->SearchControl(EVENT_INTERFACE_GLINTr);
|
|
|
|
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 ||
|
|
|
|
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 )
|
|
|
|
{
|
|
|
|
pg = (CGroup*)pw->SearchControl(EVENT_INTERFACE_GLINTu);
|
|
|
|
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);
|
|
|
|
}
|
|
|
|
|
|
|
|
pg = (CGroup*)pw->SearchControl(EVENT_INTERFACE_GLINTr);
|
|
|
|
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 ||
|
|
|
|
m_phase == PHASE_READ ||
|
|
|
|
m_phase == PHASE_WRITEs ||
|
|
|
|
m_phase == PHASE_READs )
|
|
|
|
{
|
|
|
|
pg = (CGroup*)pw->SearchControl(EVENT_INTERFACE_GLINTl);
|
|
|
|
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);
|
|
|
|
}
|
|
|
|
|
|
|
|
pg = (CGroup*)pw->SearchControl(EVENT_INTERFACE_GLINTr);
|
|
|
|
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-15 19:47:19 +00:00
|
|
|
// Geturns 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-15 19:47:19 +00:00
|
|
|
// Geturns 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
|
|
|
{
|
2012-09-15 19:47:19 +00:00
|
|
|
/* TODO: #if _NEWLOOK
|
|
|
|
#else */
|
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
|
|
|
|
12.0f,
|
|
|
|
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
|
|
|
|
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
|
|
|
|
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] =
|
|
|
|
{
|
|
|
|
14.0f,
|
|
|
|
15.0f, 407.0f,
|
|
|
|
68.0f, 417.0f,
|
|
|
|
548.0f, 36.0f,
|
|
|
|
611.0f, 37.0f,
|
|
|
|
611.0f, 100.0f,
|
|
|
|
611.0f, 395.0f,
|
|
|
|
36.0f, 35.0f,
|
|
|
|
166.0f, 55.0f,
|
|
|
|
166.0f, 94.0f,
|
|
|
|
477.0f, 56.0f,
|
|
|
|
31.0f, 190.0f,
|
|
|
|
32.0f, 220.0f,
|
|
|
|
65.0f, 221.0f,
|
|
|
|
65.0f, 250.0f,
|
|
|
|
};
|
|
|
|
|
|
|
|
static float partiPosBig[1+5*12] =
|
|
|
|
{ // x x t2 t2 type
|
|
|
|
12.0f,
|
|
|
|
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
|
|
|
|
64.0f, 444.0f, 0.2f, 0.8f, 1.0f, // down the left cable
|
|
|
|
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
|
|
|
|
36.0f, 155.0f, 0.2f, 0.4f, 2.0f, // left pipe
|
|
|
|
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
|
|
|
|
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
|
|
|
|
};
|
|
|
|
|
|
|
|
static float glintPosBig[1+2*12] =
|
|
|
|
{
|
|
|
|
12.0f,
|
|
|
|
15.0f, 407.0f,
|
|
|
|
48.0f, 399.0f,
|
|
|
|
611.0f, 37.0f,
|
|
|
|
611.0f, 100.0f,
|
|
|
|
611.0f, 395.0f,
|
|
|
|
36.0f, 35.0f,
|
|
|
|
31.0f, 190.0f,
|
|
|
|
32.0f, 220.0f,
|
|
|
|
31.0f, 221.0f,
|
|
|
|
31.0f, 189.0f,
|
|
|
|
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 ||
|
|
|
|
m_phase == PHASE_TRAINER ||
|
|
|
|
m_phase == PHASE_DEFI ||
|
|
|
|
m_phase == PHASE_MISSION ||
|
|
|
|
m_phase == PHASE_FREE ||
|
|
|
|
m_phase == PHASE_TEEN ||
|
|
|
|
m_phase == PHASE_USER ||
|
|
|
|
m_phase == PHASE_PROTO ||
|
|
|
|
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 )
|
|
|
|
{
|
|
|
|
pParti = partiPosBig;
|
|
|
|
pGlint = glintPosBig;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
nParti = (int)(*pParti++);
|
|
|
|
nGlint = (int)(*pGlint++);
|
|
|
|
|
|
|
|
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];
|
|
|
|
m_partiPhase[i] = (int)pParti[ii*5+4];
|
|
|
|
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,
|
|
|
|
rand()%2?Gfx::PARTIGLINT:Gfx::PARTICONTROL,
|
2012-06-26 20:23:05 +00:00
|
|
|
Math::Rand()*0.4f+0.4f, 0.0f, 0.0f,
|
2012-09-15 19:47:19 +00:00
|
|
|
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-06-26 20:23:05 +00:00
|
|
|
Math::Rand()*0.2f+0.2f, 0.0f, 0.0f,
|
2012-09-15 19:47:19 +00:00
|
|
|
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,
|
|
|
|
(Gfx::ParticleType)(Gfx::PARTILENS1+rand()%3),
|
2012-06-26 20:23:05 +00:00
|
|
|
Math::Rand()*0.5f+0.5f, 2.0f, 0.0f,
|
2012-09-15 19:47:19 +00:00
|
|
|
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-06-26 20:23:05 +00:00
|
|
|
Math::Rand()*0.2f+0.2f, 0.0f, 0.0f,
|
2012-09-15 19:47:19 +00:00
|
|
|
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-06-26 20:23:05 +00:00
|
|
|
Math::Rand()*0.5f+0.5f, 2.0f, 0.0f,
|
2012-09-15 19:47:19 +00:00
|
|
|
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-06-26 20:23:05 +00:00
|
|
|
Math::Rand()*0.4f+0.4f, 0.0f, 0.0f,
|
2012-09-15 19:47:19 +00:00
|
|
|
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-15 19:47:19 +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 ||
|
|
|
|
m_phase == PHASE_WIN ||
|
|
|
|
m_phase == PHASE_LOST ||
|
|
|
|
m_phase == PHASE_MODEL ) &&
|
|
|
|
!m_bDialog ) return;
|
|
|
|
|
|
|
|
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-06-26 20:23:05 +00:00
|
|
|
Math::Rand()*0.5f+0.5f, 2.0f, 0.0f,
|
2012-09-15 19:47:19 +00:00
|
|
|
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,
|
|
|
|
(Gfx::ParticleType)(Gfx::PARTILENS1+rand()%3),
|
2012-06-26 20:23:05 +00:00
|
|
|
Math::Rand()*0.5f+0.5f, 2.0f, 0.0f,
|
2012-09-15 19:47:19 +00:00
|
|
|
Gfx::SH_INTERFACE);
|
2012-06-26 20:23:05 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Specifies the special user folder if needed.
|
|
|
|
|
|
|
|
void CMainDialog::SetUserDir(char *base, int rank)
|
|
|
|
{
|
|
|
|
char dir[100];
|
|
|
|
|
|
|
|
if ( strcmp(base, "user") == 0 && rank >= 100 )
|
|
|
|
{
|
|
|
|
sprintf(dir, "%s\\%s", m_userDir, m_userList[rank/100-1]);
|
|
|
|
UserDir(true, dir);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
UserDir(false, "");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// Builds the file name of a mission.
|
|
|
|
|
|
|
|
void CMainDialog::BuildSceneName(char *filename, char *base, int rank)
|
|
|
|
{
|
|
|
|
if ( strcmp(base, "user") == 0 )
|
|
|
|
{
|
|
|
|
sprintf(filename, "%s\\%s\\scene%.2d.txt", m_userDir, m_userList[rank/100-1], rank%100);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
sprintf(filename, "%s\\%s%.3d.txt", m_sceneDir, base, rank);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// Built the default descriptive name of a mission.
|
|
|
|
|
|
|
|
void CMainDialog::BuildResumeName(char *filename, char *base, int rank)
|
|
|
|
{
|
|
|
|
sprintf(filename, "Scene %s %d", base, rank);
|
|
|
|
}
|
|
|
|
|
2012-09-15 19:47:19 +00:00
|
|
|
// Geturns the name of the file or save the files.
|
2012-06-26 20:23:05 +00:00
|
|
|
|
2012-09-15 19:47:19 +00:00
|
|
|
char* 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()
|
|
|
|
{
|
|
|
|
CWindow* pw;
|
|
|
|
CList* pl;
|
|
|
|
long hFile;
|
2012-09-15 19:47:19 +00:00
|
|
|
//struct _finddata_t fBuffer;
|
2012-06-26 20:23:05 +00:00
|
|
|
bool bDo;
|
2012-09-15 19:47:19 +00:00
|
|
|
char dir[MAX_FNAME];
|
|
|
|
char temp[MAX_FNAME];
|
|
|
|
char filenames[MAX_FNAME][100];
|
2012-06-26 20:23:05 +00:00
|
|
|
int nbFilenames, i;
|
|
|
|
|
|
|
|
pw = (CWindow*)m_interface->SearchControl(EVENT_WINDOW5);
|
|
|
|
if ( pw == 0 ) return;
|
|
|
|
pl = (CList*)pw->SearchControl(EVENT_INTERFACE_NLIST);
|
|
|
|
if ( pl == 0 ) return;
|
|
|
|
pl->Flush();
|
2012-06-26 21:01:17 +00:00
|
|
|
|
2012-06-26 20:23:05 +00:00
|
|
|
nbFilenames = 0;
|
2012-09-15 19:47:19 +00:00
|
|
|
/* TODO: list dir
|
2012-06-26 20:23:05 +00:00
|
|
|
sprintf(dir, "%s\\*", m_savegameDir);
|
|
|
|
hFile = _findfirst(dir, &fBuffer);
|
|
|
|
if ( hFile != -1 )
|
|
|
|
{
|
|
|
|
do
|
|
|
|
{
|
|
|
|
if ( (fBuffer.attrib & _A_SUBDIR) && fBuffer.name[0] != '.' )
|
|
|
|
{
|
|
|
|
strcpy(filenames[nbFilenames++], fBuffer.name);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
while ( _findnext(hFile, &fBuffer) == 0 && nbFilenames < 100 );
|
|
|
|
}
|
|
|
|
do // sorts all names:
|
|
|
|
{
|
|
|
|
bDo = false;
|
|
|
|
for ( i=0 ; i<nbFilenames-1 ; i++ )
|
|
|
|
{
|
|
|
|
if ( strcmp(filenames[i], filenames[i+1]) > 0 )
|
|
|
|
{
|
|
|
|
strcpy(temp, filenames[i]);
|
|
|
|
strcpy(filenames[i], filenames[i+1]);
|
|
|
|
strcpy(filenames[i+1], temp);
|
|
|
|
bDo = true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2012-09-15 19:47:19 +00:00
|
|
|
while ( bDo );*/
|
|
|
|
|
|
|
|
strcpy(filenames[nbFilenames++], "Test");
|
2012-06-26 20:23:05 +00:00
|
|
|
|
|
|
|
for ( i=0 ; i<nbFilenames ; i++ )
|
|
|
|
{
|
|
|
|
pl->SetName(i, filenames[i]);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// Updates the controls of the players.
|
|
|
|
|
|
|
|
void CMainDialog::UpdateNameControl()
|
|
|
|
{
|
|
|
|
CWindow* pw;
|
|
|
|
CList* pl;
|
|
|
|
CButton* pb;
|
|
|
|
CEdit* pe;
|
|
|
|
char name[100];
|
|
|
|
char* gamer;
|
|
|
|
int total, sel;
|
|
|
|
|
|
|
|
pw = (CWindow*)m_interface->SearchControl(EVENT_WINDOW5);
|
|
|
|
if ( pw == 0 ) return;
|
|
|
|
pl = (CList*)pw->SearchControl(EVENT_INTERFACE_NLIST);
|
|
|
|
if ( pl == 0 ) return;
|
|
|
|
pe = (CEdit*)pw->SearchControl(EVENT_INTERFACE_NEDIT);
|
|
|
|
if ( pe == 0 ) return;
|
|
|
|
|
2012-09-15 19:47:19 +00:00
|
|
|
gamer = m_main->GetGamerName();
|
|
|
|
total = pl->GetTotal();
|
|
|
|
sel = pl->GetSelect();
|
2012-06-26 20:23:05 +00:00
|
|
|
pe->GetText(name, 100);
|
|
|
|
|
|
|
|
pb = (CButton*)pw->SearchControl(EVENT_INTERFACE_NCANCEL);
|
|
|
|
if ( pb != 0 )
|
|
|
|
{
|
|
|
|
pb->SetState(STATE_ENABLE, gamer[0]!=0);
|
|
|
|
}
|
|
|
|
|
|
|
|
pb = (CButton*)pw->SearchControl(EVENT_INTERFACE_NDELETE);
|
|
|
|
if ( pb != 0 )
|
|
|
|
{
|
|
|
|
pb->SetState(STATE_ENABLE, total>0 && sel!=-1);
|
|
|
|
}
|
|
|
|
|
|
|
|
pb = (CButton*)pw->SearchControl(EVENT_INTERFACE_NOK);
|
|
|
|
if ( pb != 0 )
|
|
|
|
{
|
|
|
|
pb->SetState(STATE_ENABLE, name[0]!=0 || sel!=-1);
|
|
|
|
}
|
|
|
|
|
|
|
|
pb = (CButton*)pw->SearchControl(EVENT_INTERFACE_PERSO);
|
|
|
|
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];
|
|
|
|
int total, sel, i;
|
|
|
|
|
|
|
|
pw = (CWindow*)m_interface->SearchControl(EVENT_WINDOW5);
|
|
|
|
if ( pw == 0 ) return;
|
|
|
|
pl = (CList*)pw->SearchControl(EVENT_INTERFACE_NLIST);
|
|
|
|
if ( pl == 0 ) return;
|
|
|
|
pe = (CEdit*)pw->SearchControl(EVENT_INTERFACE_NEDIT);
|
|
|
|
if ( pe == 0 ) return;
|
|
|
|
|
|
|
|
pe->GetText(name, 100);
|
2012-09-15 19:47:19 +00:00
|
|
|
total = pl->GetTotal();
|
|
|
|
sel = pl->GetSelect();
|
2012-06-26 20:23:05 +00:00
|
|
|
|
|
|
|
for ( i=0 ; i<total ; i++ )
|
|
|
|
{
|
2012-09-15 19:47:19 +00:00
|
|
|
// TODO: stricmp?
|
|
|
|
if ( strcmp(name, pl->GetName(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;
|
|
|
|
|
|
|
|
pw = (CWindow*)m_interface->SearchControl(EVENT_WINDOW5);
|
|
|
|
if ( pw == 0 ) return;
|
|
|
|
pl = (CList*)pw->SearchControl(EVENT_INTERFACE_NLIST);
|
|
|
|
if ( pl == 0 ) return;
|
|
|
|
pe = (CEdit*)pw->SearchControl(EVENT_INTERFACE_NEDIT);
|
|
|
|
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
|
|
|
|
{
|
2012-09-15 19:47:19 +00:00
|
|
|
name = pl->GetName(sel);
|
2012-06-26 20:23:05 +00:00
|
|
|
pe->SetText(name);
|
|
|
|
pe->SetCursor(strlen(name), 0);
|
|
|
|
}
|
|
|
|
|
|
|
|
UpdateNameControl();
|
|
|
|
}
|
|
|
|
|
|
|
|
// Updates the representation of the player depending on the selected list.
|
|
|
|
|
|
|
|
void CMainDialog::UpdateNameFace()
|
|
|
|
{
|
|
|
|
CWindow* pw;
|
|
|
|
CList* pl;
|
|
|
|
char* name;
|
|
|
|
int sel;
|
|
|
|
|
|
|
|
pw = (CWindow*)m_interface->SearchControl(EVENT_WINDOW5);
|
|
|
|
if ( pw == 0 ) return;
|
|
|
|
pl = (CList*)pw->SearchControl(EVENT_INTERFACE_NLIST);
|
|
|
|
if ( pl == 0 ) return;
|
|
|
|
|
2012-09-15 19:47:19 +00:00
|
|
|
sel = pl->GetSelect();
|
2012-06-26 20:23:05 +00:00
|
|
|
if ( sel == -1 ) return;
|
2012-09-15 19:47:19 +00:00
|
|
|
name = pl->GetName(sel);
|
2012-06-26 20:23:05 +00:00
|
|
|
|
|
|
|
ReadGamerPerso(name);
|
|
|
|
}
|
|
|
|
|
|
|
|
// Selects a player.
|
|
|
|
|
|
|
|
void CMainDialog::NameSelect()
|
|
|
|
{
|
|
|
|
CWindow* pw;
|
|
|
|
CList* pl;
|
|
|
|
CEdit* pe;
|
|
|
|
char name[100];
|
|
|
|
int sel;
|
|
|
|
|
|
|
|
pw = (CWindow*)m_interface->SearchControl(EVENT_WINDOW5);
|
|
|
|
if ( pw == 0 ) return;
|
|
|
|
pl = (CList*)pw->SearchControl(EVENT_INTERFACE_NLIST);
|
|
|
|
if ( pl == 0 ) return;
|
|
|
|
pe = (CEdit*)pw->SearchControl(EVENT_INTERFACE_NEDIT);
|
|
|
|
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
|
|
|
|
{
|
2012-09-15 19:47:19 +00:00
|
|
|
m_main->SetGamerName(pl->GetName(sel));
|
2012-06-26 20:23:05 +00:00
|
|
|
m_main->ChangePhase(PHASE_INIT);
|
|
|
|
}
|
|
|
|
|
2012-09-15 19:47:19 +00:00
|
|
|
GetGamerFace(m_main->GetGamerName());
|
2012-06-26 20:23:05 +00:00
|
|
|
|
2012-09-15 19:47:19 +00:00
|
|
|
// TODO: SetLocalProfileString("Gamer", "LastName", m_main->GetGamerName());
|
2012-06-26 20:23:05 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// Creates a new player.
|
|
|
|
|
|
|
|
void CMainDialog::NameCreate()
|
|
|
|
{
|
|
|
|
CWindow* pw;
|
|
|
|
CEdit* pe;
|
|
|
|
char name[100];
|
|
|
|
char dir[100];
|
|
|
|
char c;
|
|
|
|
int len, i, j;
|
|
|
|
|
|
|
|
pw = (CWindow*)m_interface->SearchControl(EVENT_WINDOW5);
|
|
|
|
if ( pw == 0 ) return;
|
|
|
|
pe = (CEdit*)pw->SearchControl(EVENT_INTERFACE_NEDIT);
|
|
|
|
if ( pe == 0 ) return;
|
|
|
|
|
|
|
|
pe->GetText(name, 100);
|
|
|
|
if ( name[0] == 0 )
|
|
|
|
{
|
|
|
|
m_sound->Play(SOUND_TZOING);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
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);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2012-09-15 19:47:19 +00:00
|
|
|
// TODO: _mkdir(m_savegameDir); // if does not exist yet!
|
2012-06-26 20:23:05 +00:00
|
|
|
|
|
|
|
sprintf(dir, "%s\\%s", m_savegameDir, name);
|
2012-09-15 19:47:19 +00:00
|
|
|
// TODO: if ( _mkdir(dir) != 0 )
|
2012-06-26 20:23:05 +00:00
|
|
|
{
|
|
|
|
m_sound->Play(SOUND_TZOING);
|
|
|
|
pe->SetText(name);
|
|
|
|
pe->SetCursor(strlen(name), 0);
|
|
|
|
pe->SetFocus(true);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
SetGamerFace(name, 0);
|
|
|
|
|
|
|
|
m_main->SetGamerName(name);
|
|
|
|
m_main->ChangePhase(PHASE_INIT);
|
|
|
|
}
|
|
|
|
|
|
|
|
// Deletes a folder and all its offspring.
|
|
|
|
|
|
|
|
bool RemoveDir(char *dirname)
|
|
|
|
{
|
2012-09-15 19:47:19 +00:00
|
|
|
/* TODO: remove dir
|
2012-06-26 20:23:05 +00:00
|
|
|
long hFile;
|
|
|
|
struct _finddata_t fBuffer;
|
|
|
|
char filename[100];
|
|
|
|
|
|
|
|
sprintf(filename, "%s\\*", dirname);
|
|
|
|
hFile = _findfirst(filename, &fBuffer);
|
|
|
|
if ( hFile != -1 )
|
|
|
|
{
|
|
|
|
do
|
|
|
|
{
|
|
|
|
if ( fBuffer.name[0] != '.' )
|
|
|
|
{
|
|
|
|
if ( fBuffer.attrib & _A_SUBDIR )
|
|
|
|
{
|
|
|
|
sprintf(filename, "%s\\%s", dirname, fBuffer.name);
|
|
|
|
RemoveDir(filename);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
sprintf(filename, "%s\\%s", dirname, fBuffer.name);
|
|
|
|
remove(filename);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
while ( _findnext(hFile, &fBuffer) == 0 );
|
|
|
|
}
|
|
|
|
|
|
|
|
if ( _rmdir(dirname) != 0 )
|
|
|
|
{
|
|
|
|
return false;
|
2012-09-15 19:47:19 +00:00
|
|
|
}*/
|
2012-06-26 20:23:05 +00:00
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
// Removes a player.
|
|
|
|
|
|
|
|
void CMainDialog::NameDelete()
|
|
|
|
{
|
|
|
|
CWindow* pw;
|
|
|
|
CList* pl;
|
|
|
|
int sel;
|
|
|
|
char* gamer;
|
|
|
|
char dir[100];
|
|
|
|
|
|
|
|
pw = (CWindow*)m_interface->SearchControl(EVENT_WINDOW5);
|
|
|
|
if ( pw == 0 ) return;
|
|
|
|
pl = (CList*)pw->SearchControl(EVENT_INTERFACE_NLIST);
|
|
|
|
if ( pl == 0 ) return;
|
|
|
|
|
2012-09-15 19:47:19 +00:00
|
|
|
sel = pl->GetSelect();
|
2012-06-26 20:23:05 +00:00
|
|
|
if ( sel == -1 )
|
|
|
|
{
|
|
|
|
m_sound->Play(SOUND_TZOING);
|
|
|
|
return;
|
|
|
|
}
|
2012-09-15 19:47:19 +00:00
|
|
|
gamer = pl->GetName(sel);
|
2012-06-26 20:23:05 +00:00
|
|
|
|
|
|
|
// Deletes all the contents of the file.
|
|
|
|
sprintf(dir, "%s\\%s", m_savegameDir, gamer);
|
|
|
|
if ( !RemoveDir(dir) )
|
|
|
|
{
|
|
|
|
m_sound->Play(SOUND_TZOING);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
m_main->SetGamerName("");
|
|
|
|
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;
|
2012-06-26 20:23:05 +00:00
|
|
|
char name[100];
|
|
|
|
int i;
|
|
|
|
|
|
|
|
pw = (CWindow*)m_interface->SearchControl(EVENT_WINDOW5);
|
|
|
|
if ( pw == 0 ) return;
|
|
|
|
|
|
|
|
pb = (CButton*)pw->SearchControl(EVENT_INTERFACE_PHEAD);
|
|
|
|
if ( pb != 0 )
|
|
|
|
{
|
|
|
|
pb->SetState(STATE_CHECK, m_persoTab==0);
|
|
|
|
}
|
|
|
|
pb = (CButton*)pw->SearchControl(EVENT_INTERFACE_PBODY);
|
|
|
|
if ( pb != 0 )
|
|
|
|
{
|
|
|
|
pb->SetState(STATE_CHECK, m_persoTab==1);
|
|
|
|
}
|
|
|
|
|
|
|
|
pl = (CLabel*)pw->SearchControl(EVENT_LABEL11);
|
|
|
|
if ( pl != 0 )
|
|
|
|
{
|
|
|
|
if ( m_persoTab == 0 )
|
|
|
|
{
|
|
|
|
pl->SetState(STATE_VISIBLE);
|
|
|
|
GetResource(RES_TEXT, RT_PERSO_FACE, name);
|
|
|
|
pl->SetName(name);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
pl->ClearState(STATE_VISIBLE);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
pl = (CLabel*)pw->SearchControl(EVENT_LABEL12);
|
|
|
|
if ( pl != 0 )
|
|
|
|
{
|
|
|
|
if ( m_persoTab == 0 )
|
|
|
|
{
|
|
|
|
pl->SetState(STATE_VISIBLE);
|
|
|
|
GetResource(RES_TEXT, RT_PERSO_GLASSES, name);
|
|
|
|
pl->SetName(name);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
pl->ClearState(STATE_VISIBLE);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
pl = (CLabel*)pw->SearchControl(EVENT_LABEL13);
|
|
|
|
if ( pl != 0 )
|
|
|
|
{
|
|
|
|
if ( m_persoTab == 0 ) GetResource(RES_TEXT, RT_PERSO_HAIR, name);
|
|
|
|
else GetResource(RES_TEXT, RT_PERSO_BAND, name);
|
|
|
|
pl->SetName(name);
|
|
|
|
}
|
|
|
|
|
|
|
|
pl = (CLabel*)pw->SearchControl(EVENT_LABEL14);
|
|
|
|
if ( pl != 0 )
|
|
|
|
{
|
|
|
|
if ( m_persoTab == 0 )
|
|
|
|
{
|
|
|
|
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-15 19:47:19 +00:00
|
|
|
pb = (CButton*)pw->SearchControl((EventType)(EVENT_INTERFACE_PFACE1+i));
|
2012-06-26 20:23:05 +00:00
|
|
|
if ( pb == 0 ) break;
|
|
|
|
pb->SetState(STATE_VISIBLE, m_persoTab==0);
|
|
|
|
pb->SetState(STATE_CHECK, i==m_perso.face);
|
|
|
|
}
|
|
|
|
|
|
|
|
for ( i=0 ; i<10 ; i++ )
|
|
|
|
{
|
2012-09-15 19:47:19 +00:00
|
|
|
pb = (CButton*)pw->SearchControl((EventType)(EVENT_INTERFACE_PGLASS0+i));
|
2012-06-26 20:23:05 +00:00
|
|
|
if ( pb == 0 ) break;
|
|
|
|
pb->SetState(STATE_VISIBLE, m_persoTab==0);
|
|
|
|
pb->SetState(STATE_CHECK, i==m_perso.glasses);
|
|
|
|
}
|
|
|
|
|
|
|
|
for ( i=0 ; i<3*3 ; i++ )
|
|
|
|
{
|
2012-09-15 19:47:19 +00:00
|
|
|
pc = (CColor*)pw->SearchControl((EventType)(EVENT_INTERFACE_PC0a+i));
|
2012-06-26 20:23:05 +00:00
|
|
|
if ( pc == 0 ) break;
|
|
|
|
if ( m_persoTab == 0 )
|
|
|
|
{
|
|
|
|
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);
|
|
|
|
pc->SetState(STATE_CHECK, EqColor(color, m_perso.colorCombi));
|
|
|
|
}
|
|
|
|
|
2012-09-15 19:47:19 +00:00
|
|
|
pc = (CColor*)pw->SearchControl((EventType)(EVENT_INTERFACE_PC0b+i));
|
2012-06-26 20:23:05 +00:00
|
|
|
if ( pc == 0 ) break;
|
|
|
|
color.r = perso_color[3*10*2*m_persoTab+3*i+0]/255.0f;
|
|
|
|
color.g = perso_color[3*10*2*m_persoTab+3*i+1]/255.0f;
|
|
|
|
color.b = perso_color[3*10*2*m_persoTab+3*i+2]/255.0f;
|
|
|
|
color.a = 0.0f;
|
|
|
|
pc->SetColor(color);
|
|
|
|
pc->SetState(STATE_CHECK, EqColor(color, m_persoTab?m_perso.colorBand:m_perso.colorHair));
|
|
|
|
}
|
|
|
|
|
|
|
|
for ( i=0 ; i<3 ; i++ )
|
|
|
|
{
|
2012-09-15 19:47:19 +00:00
|
|
|
ps = (CSlider*)pw->SearchControl((EventType)(EVENT_INTERFACE_PCRa+i));
|
2012-06-26 20:23:05 +00:00
|
|
|
if ( ps == 0 ) break;
|
|
|
|
ps->SetState(STATE_VISIBLE, m_persoTab==1);
|
|
|
|
}
|
|
|
|
|
|
|
|
if ( m_persoTab == 1 )
|
|
|
|
{
|
|
|
|
color = m_perso.colorCombi;
|
|
|
|
ps = (CSlider*)pw->SearchControl(EVENT_INTERFACE_PCRa);
|
|
|
|
if ( ps != 0 ) ps->SetVisibleValue(color.r*255.0f);
|
|
|
|
ps = (CSlider*)pw->SearchControl(EVENT_INTERFACE_PCGa);
|
|
|
|
if ( ps != 0 ) ps->SetVisibleValue(color.g*255.0f);
|
|
|
|
ps = (CSlider*)pw->SearchControl(EVENT_INTERFACE_PCBa);
|
|
|
|
if ( ps != 0 ) ps->SetVisibleValue(color.b*255.0f);
|
|
|
|
}
|
|
|
|
|
|
|
|
if ( m_persoTab == 0 ) color = m_perso.colorHair;
|
|
|
|
else color = m_perso.colorBand;
|
|
|
|
ps = (CSlider*)pw->SearchControl(EVENT_INTERFACE_PCRb);
|
|
|
|
if ( ps != 0 ) ps->SetVisibleValue(color.r*255.0f);
|
|
|
|
ps = (CSlider*)pw->SearchControl(EVENT_INTERFACE_PCGb);
|
|
|
|
if ( ps != 0 ) ps->SetVisibleValue(color.g*255.0f);
|
|
|
|
ps = (CSlider*)pw->SearchControl(EVENT_INTERFACE_PCBb);
|
|
|
|
if ( ps != 0 ) ps->SetVisibleValue(color.b*255.0f);
|
|
|
|
}
|
|
|
|
|
|
|
|
// Updates the camera for the character.
|
|
|
|
|
|
|
|
void CMainDialog::CameraPerso()
|
|
|
|
{
|
|
|
|
if ( m_persoTab == 0 )
|
|
|
|
{
|
|
|
|
//? 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)
|
|
|
|
{
|
|
|
|
if ( m_persoTab == 0 )
|
|
|
|
{
|
|
|
|
if ( index == 1 )
|
|
|
|
{
|
|
|
|
m_perso.colorHair.r = perso_color[3*10*0+rank*3+0]/255.0f;
|
|
|
|
m_perso.colorHair.g = perso_color[3*10*0+rank*3+1]/255.0f;
|
|
|
|
m_perso.colorHair.b = perso_color[3*10*0+rank*3+2]/255.0f;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if ( m_persoTab == 1 )
|
|
|
|
{
|
|
|
|
if ( index == 0 )
|
|
|
|
{
|
|
|
|
m_perso.colorCombi.r = perso_color[3*10*1+rank*3+0]/255.0f;
|
|
|
|
m_perso.colorCombi.g = perso_color[3*10*1+rank*3+1]/255.0f;
|
|
|
|
m_perso.colorCombi.b = perso_color[3*10*1+rank*3+2]/255.0f;
|
|
|
|
}
|
|
|
|
if ( index == 1 )
|
|
|
|
{
|
|
|
|
m_perso.colorBand.r = perso_color[3*10*2+rank*3+0]/255.0f;
|
|
|
|
m_perso.colorBand.g = perso_color[3*10*2+rank*3+1]/255.0f;
|
|
|
|
m_perso.colorBand.b = perso_color[3*10*2+rank*3+2]/255.0f;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// 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
|
|
|
|
|
|
|
pw = (CWindow*)m_interface->SearchControl(EVENT_WINDOW5);
|
|
|
|
if ( pw == 0 ) return;
|
|
|
|
|
|
|
|
color.a = 0.0f;
|
|
|
|
|
|
|
|
ps = (CSlider*)pw->SearchControl(EVENT_INTERFACE_PCRa);
|
2012-09-15 19:47:19 +00:00
|
|
|
if ( ps != 0 ) color.r = ps->GetVisibleValue()/255.0f;
|
2012-06-26 20:23:05 +00:00
|
|
|
ps = (CSlider*)pw->SearchControl(EVENT_INTERFACE_PCGa);
|
2012-09-15 19:47:19 +00:00
|
|
|
if ( ps != 0 ) color.g = ps->GetVisibleValue()/255.0f;
|
2012-06-26 20:23:05 +00:00
|
|
|
ps = (CSlider*)pw->SearchControl(EVENT_INTERFACE_PCBa);
|
2012-09-15 19:47:19 +00:00
|
|
|
if ( ps != 0 ) color.b = ps->GetVisibleValue()/255.0f;
|
2012-06-26 20:23:05 +00:00
|
|
|
if ( m_persoTab == 1 ) m_perso.colorCombi = color;
|
|
|
|
|
|
|
|
ps = (CSlider*)pw->SearchControl(EVENT_INTERFACE_PCRb);
|
2012-09-15 19:47:19 +00:00
|
|
|
if ( ps != 0 ) color.r = ps->GetVisibleValue()/255.0f;
|
2012-06-26 20:23:05 +00:00
|
|
|
ps = (CSlider*)pw->SearchControl(EVENT_INTERFACE_PCGb);
|
2012-09-15 19:47:19 +00:00
|
|
|
if ( ps != 0 ) color.g = ps->GetVisibleValue()/255.0f;
|
2012-06-26 20:23:05 +00:00
|
|
|
ps = (CSlider*)pw->SearchControl(EVENT_INTERFACE_PCBb);
|
2012-09-15 19:47:19 +00:00
|
|
|
if ( ps != 0 ) color.b = ps->GetVisibleValue()/255.0f;
|
2012-06-26 20:23:05 +00:00
|
|
|
if ( m_persoTab == 0 ) m_perso.colorHair = color;
|
|
|
|
else m_perso.colorBand = color;
|
|
|
|
}
|
|
|
|
|
|
|
|
// Updates the default settings of the character.
|
|
|
|
|
|
|
|
void CMainDialog::DefPerso()
|
|
|
|
{
|
|
|
|
m_perso.colorCombi.r = 206.0f/256.0f;
|
|
|
|
m_perso.colorCombi.g = 206.0f/256.0f;
|
|
|
|
m_perso.colorCombi.b = 204.0f/256.0f; // ~white
|
|
|
|
m_perso.colorBand.r = 255.0f/256.0f;
|
|
|
|
m_perso.colorBand.g = 132.0f/256.0f;
|
|
|
|
m_perso.colorBand.b = 1.0f/256.0f; // orange
|
|
|
|
|
|
|
|
if ( m_perso.face == 0 ) // normal ?
|
|
|
|
{
|
|
|
|
m_perso.glasses = 0;
|
|
|
|
m_perso.colorHair.r = 90.0f/256.0f;
|
|
|
|
m_perso.colorHair.g = 95.0f/256.0f;
|
|
|
|
m_perso.colorHair.b = 85.0f/256.0f; // black
|
|
|
|
}
|
|
|
|
if ( m_perso.face == 1 ) // bald ?
|
|
|
|
{
|
|
|
|
m_perso.glasses = 0;
|
|
|
|
m_perso.colorHair.r = 83.0f/256.0f;
|
|
|
|
m_perso.colorHair.g = 64.0f/256.0f;
|
|
|
|
m_perso.colorHair.b = 51.0f/256.0f; // brown
|
|
|
|
}
|
|
|
|
if ( m_perso.face == 2 ) // carlos ?
|
|
|
|
{
|
|
|
|
m_perso.glasses = 1;
|
|
|
|
m_perso.colorHair.r = 85.0f/256.0f;
|
|
|
|
m_perso.colorHair.g = 48.0f/256.0f;
|
|
|
|
m_perso.colorHair.b = 9.0f/256.0f; // brown
|
|
|
|
}
|
|
|
|
if ( m_perso.face == 3 ) // blond ?
|
|
|
|
{
|
|
|
|
m_perso.glasses = 4;
|
|
|
|
m_perso.colorHair.r = 255.0f/256.0f;
|
|
|
|
m_perso.colorHair.g = 255.0f/256.0f;
|
|
|
|
m_perso.colorHair.b = 181.0f/256.0f; // yellow
|
|
|
|
}
|
|
|
|
|
|
|
|
m_perso.colorHair.a = 0.0f;
|
|
|
|
m_perso.colorCombi.a = 0.0f;
|
|
|
|
m_perso.colorBand.a = 0.0f;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// Indicates if there is at least one backup.
|
|
|
|
|
|
|
|
bool CMainDialog::IsIOReadScene()
|
|
|
|
{
|
|
|
|
FILE* file;
|
|
|
|
char filename[100];
|
|
|
|
|
2012-09-15 19:47:19 +00:00
|
|
|
sprintf(filename, "%s\\%s\\save%c%.3d\\data.sav", m_savegameDir, m_main->GetGamerName(), m_sceneName[0], 0);
|
2012-06-26 20:23:05 +00:00
|
|
|
file = fopen(filename, "r");
|
|
|
|
if ( file == NULL ) return false;
|
|
|
|
fclose(file);
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
// Builds the file name by default.
|
|
|
|
|
|
|
|
void CMainDialog::IOReadName()
|
|
|
|
{
|
|
|
|
FILE* file;
|
|
|
|
CWindow* pw;
|
|
|
|
CEdit* pe;
|
2012-09-15 19:47:19 +00:00
|
|
|
char filename[MAX_FNAME];
|
2012-06-26 20:23:05 +00:00
|
|
|
char op[100];
|
|
|
|
char line[500];
|
|
|
|
char resume[100];
|
|
|
|
char name[100];
|
|
|
|
time_t now;
|
|
|
|
int i;
|
|
|
|
|
|
|
|
pw = (CWindow*)m_interface->SearchControl(EVENT_WINDOW5);
|
|
|
|
if ( pw == 0 ) return;
|
|
|
|
pe = (CEdit*)pw->SearchControl(EVENT_INTERFACE_IONAME);
|
|
|
|
if ( pe == 0 ) return;
|
|
|
|
|
|
|
|
sprintf(resume, "%s %d", m_sceneName, m_chap[m_index]+1);
|
|
|
|
BuildSceneName(filename, m_sceneName, (m_chap[m_index]+1)*100);
|
|
|
|
file = fopen(filename, "r");
|
|
|
|
if ( file != NULL )
|
|
|
|
{
|
|
|
|
while ( fgets(line, 500, file) != NULL )
|
|
|
|
{
|
|
|
|
for ( i=0 ; i<500 ; i++ )
|
|
|
|
{
|
|
|
|
if ( line[i] == '\t' ) line[i] = ' '; // replaces tab by space
|
|
|
|
if ( line[i] == '/' && line[i+1] == '/' )
|
|
|
|
{
|
|
|
|
line[i] = 0;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2012-09-15 19:47:19 +00:00
|
|
|
// TODO: language letters
|
|
|
|
sprintf(op, "Title.%c", 'E' /*MAX_FNAME()*/ );
|
2012-06-26 20:23:05 +00:00
|
|
|
if ( Cmd(line, op) )
|
|
|
|
{
|
|
|
|
OpString(line, "resume", resume);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
fclose(file);
|
|
|
|
}
|
|
|
|
|
|
|
|
time(&now);
|
|
|
|
TimeToAscii(now, line);
|
|
|
|
sprintf(name, "%s %d - %s", resume, m_sel[m_index]+1, line);
|
|
|
|
pe->SetText(name);
|
|
|
|
pe->SetCursor(strlen(name), 0);
|
|
|
|
pe->SetFocus(true);
|
|
|
|
}
|
|
|
|
|
|
|
|
// Updates the list of games recorded on disk.
|
|
|
|
|
|
|
|
void CMainDialog::IOReadList()
|
|
|
|
{
|
|
|
|
FILE* file = NULL;
|
|
|
|
CWindow* pw;
|
|
|
|
CList* pl;
|
|
|
|
char filename[100];
|
|
|
|
char line[500];
|
|
|
|
char name[100];
|
|
|
|
int i, j;
|
|
|
|
|
|
|
|
pw = (CWindow*)m_interface->SearchControl(EVENT_WINDOW5);
|
|
|
|
if ( pw == 0 ) return;
|
|
|
|
pl = (CList*)pw->SearchControl(EVENT_INTERFACE_IOLIST);
|
|
|
|
if ( pl == 0 ) return;
|
|
|
|
|
|
|
|
pl->Flush();
|
|
|
|
|
|
|
|
for ( j=0 ; j<999 ; j++ )
|
|
|
|
{
|
2012-09-15 19:47:19 +00:00
|
|
|
sprintf(filename, "%s\\%s\\save%c%.3d\\data.sav", m_savegameDir, m_main->GetGamerName(), m_sceneName[0], j);
|
2012-06-26 20:23:05 +00:00
|
|
|
file = fopen(filename, "r");
|
|
|
|
if ( file == NULL ) break;
|
|
|
|
|
|
|
|
strcmp(name, filename); // default name
|
|
|
|
while ( fgets(line, 500, file) != NULL )
|
|
|
|
{
|
|
|
|
for ( i=0 ; i<500 ; i++ )
|
|
|
|
{
|
|
|
|
if ( line[i] == '\t' ) line[i] = ' '; // replaces tab by space
|
|
|
|
if ( line[i] == '/' && line[i+1] == '/' )
|
|
|
|
{
|
|
|
|
line[i] = 0;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if ( Cmd(line, "Title") )
|
|
|
|
{
|
|
|
|
OpString(line, "text", name);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
fclose(file);
|
|
|
|
|
|
|
|
pl->SetName(j, name);
|
|
|
|
}
|
|
|
|
|
|
|
|
if ( m_phase == PHASE_WRITE ||
|
|
|
|
m_phase == PHASE_WRITEs )
|
|
|
|
{
|
|
|
|
GetResource(RES_TEXT, RT_IO_NEW, name);
|
|
|
|
pl->SetName(j, name);
|
|
|
|
j ++;
|
|
|
|
}
|
|
|
|
|
|
|
|
pl->SetSelect(j-1);
|
|
|
|
pl->ShowSelect(false); // shows the selected columns
|
|
|
|
}
|
|
|
|
|
|
|
|
// Updates the buttons according to the selected part in the list.
|
|
|
|
|
|
|
|
void CMainDialog::IOUpdateList()
|
|
|
|
{
|
|
|
|
FILE* file = NULL;
|
|
|
|
CWindow* pw;
|
|
|
|
CList* pl;
|
|
|
|
CButton* pb;
|
|
|
|
CImage* pi;
|
|
|
|
char filename[100];
|
|
|
|
int sel, max;
|
|
|
|
|
|
|
|
pw = (CWindow*)m_interface->SearchControl(EVENT_WINDOW5);
|
|
|
|
if ( pw == 0 ) return;
|
|
|
|
pl = (CList*)pw->SearchControl(EVENT_INTERFACE_IOLIST);
|
|
|
|
if ( pl == 0 ) return;
|
|
|
|
pi = (CImage*)pw->SearchControl(EVENT_INTERFACE_IOIMAGE);
|
|
|
|
if ( pi == 0 ) return;
|
|
|
|
|
2012-09-15 19:47:19 +00:00
|
|
|
sel = pl->GetSelect();
|
|
|
|
max = pl->GetTotal();
|
2012-06-26 20:23:05 +00:00
|
|
|
|
2012-09-15 19:47:19 +00:00
|
|
|
sprintf(filename, "%s\\%s\\save%c%.3d\\screen.png", m_savegameDir, m_main->GetGamerName(), m_sceneName[0], sel);
|
2012-06-26 20:23:05 +00:00
|
|
|
|
|
|
|
if ( m_phase == PHASE_WRITE ||
|
|
|
|
m_phase == PHASE_WRITEs )
|
|
|
|
{
|
|
|
|
if ( sel < max-1 )
|
|
|
|
{
|
|
|
|
pi->SetFilenameImage(filename);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
pi->SetFilenameImage("");
|
|
|
|
}
|
|
|
|
|
|
|
|
pb = (CButton*)pw->SearchControl(EVENT_INTERFACE_IODELETE);
|
|
|
|
if ( pb != 0 )
|
|
|
|
{
|
|
|
|
pb->SetState(STATE_ENABLE, sel < max-1);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
pi->SetFilenameImage(filename);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// Deletes the selected scene.
|
|
|
|
|
|
|
|
void CMainDialog::IODeleteScene()
|
|
|
|
{
|
|
|
|
CWindow* pw;
|
|
|
|
CList* pl;
|
|
|
|
char dir[100];
|
|
|
|
char old[100];
|
|
|
|
long hFile;
|
2012-09-15 19:47:19 +00:00
|
|
|
//struct _finddata_t fBuffer;
|
2012-06-26 20:23:05 +00:00
|
|
|
int sel, max, i;
|
|
|
|
|
|
|
|
pw = (CWindow*)m_interface->SearchControl(EVENT_WINDOW5);
|
|
|
|
if ( pw == 0 ) return;
|
|
|
|
pl = (CList*)pw->SearchControl(EVENT_INTERFACE_IOLIST);
|
|
|
|
if ( pl == 0 ) return;
|
|
|
|
|
2012-09-15 19:47:19 +00:00
|
|
|
sel = pl->GetSelect();
|
2012-06-26 20:23:05 +00:00
|
|
|
if ( sel == -1 )
|
|
|
|
{
|
|
|
|
m_sound->Play(SOUND_TZOING);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2012-09-15 19:47:19 +00:00
|
|
|
/* TODO: remove files
|
2012-06-26 20:23:05 +00:00
|
|
|
// Deletes all the contents of the file.
|
2012-09-15 19:47:19 +00:00
|
|
|
sprintf(dir, "%s\\%s\\save%c%.3d\\*", m_savegameDir, m_main->GetGamerName(), m_sceneName[0], sel);
|
2012-06-26 20:23:05 +00:00
|
|
|
hFile = _findfirst(dir, &fBuffer);
|
|
|
|
if ( hFile != -1 )
|
|
|
|
{
|
|
|
|
do
|
|
|
|
{
|
|
|
|
if ( fBuffer.name[0] != '.' )
|
|
|
|
{
|
2012-09-15 19:47:19 +00:00
|
|
|
sprintf(dir, "%s\\%s\\save%c%.3d\\%s", m_savegameDir, m_main->GetGamerName(), m_sceneName[0], sel, fBuffer.name);
|
2012-06-26 20:23:05 +00:00
|
|
|
remove(dir);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
while ( _findnext(hFile, &fBuffer) == 0 );
|
|
|
|
}
|
|
|
|
|
2012-09-15 19:47:19 +00:00
|
|
|
sprintf(dir, "%s\\%s\\save%c%.3d", m_savegameDir, m_main->GetGamerName(), m_sceneName[0], sel);
|
2012-06-26 20:23:05 +00:00
|
|
|
if ( _rmdir(dir) != 0 )
|
|
|
|
{
|
|
|
|
m_sound->Play(SOUND_TZOING);
|
|
|
|
return;
|
2012-09-15 19:47:19 +00:00
|
|
|
}*/
|
2012-06-26 20:23:05 +00:00
|
|
|
|
2012-09-15 19:47:19 +00:00
|
|
|
/* TODO: rename
|
|
|
|
max = pl->GetTotal();
|
2012-06-26 20:23:05 +00:00
|
|
|
for ( i=sel+1 ; i<max ; i++ )
|
|
|
|
{
|
2012-09-15 19:47:19 +00:00
|
|
|
sprintf(old, "%s\\%s\\save%c%.3d", m_savegameDir, m_main->GetGamerName(), m_sceneName[0], i);
|
|
|
|
sprintf(dir, "%s\\%s\\save%c%.3d", m_savegameDir, m_main->GetGamerName(), m_sceneName[0], i-1);
|
2012-06-26 20:23:05 +00:00
|
|
|
rename(old, dir);
|
2012-09-15 19:47:19 +00:00
|
|
|
}*/
|
2012-06-26 20:23:05 +00:00
|
|
|
IOReadList();
|
|
|
|
}
|
|
|
|
|
|
|
|
// Writes the scene.
|
|
|
|
|
|
|
|
bool CMainDialog::IOWriteScene()
|
|
|
|
{
|
|
|
|
CWindow* pw;
|
|
|
|
CList* pl;
|
|
|
|
CEdit* pe;
|
|
|
|
char filename[100];
|
|
|
|
char filecbot[100];
|
|
|
|
char info[100];
|
|
|
|
int sel;
|
|
|
|
|
|
|
|
pw = (CWindow*)m_interface->SearchControl(EVENT_WINDOW5);
|
|
|
|
if ( pw == 0 ) return false;
|
|
|
|
pl = (CList*)pw->SearchControl(EVENT_INTERFACE_IOLIST);
|
|
|
|
if ( pl == 0 ) return false;
|
|
|
|
pe = (CEdit*)pw->SearchControl(EVENT_INTERFACE_IONAME);
|
|
|
|
if ( pe == 0 ) return false;
|
|
|
|
|
2012-09-15 19:47:19 +00:00
|
|
|
sel = pl->GetSelect();
|
2012-06-26 20:23:05 +00:00
|
|
|
if ( sel == -1 ) return false;
|
|
|
|
|
2012-09-15 19:47:19 +00:00
|
|
|
// TODO: _mkdir("Savegame"); // if doesn't exist yet!
|
|
|
|
sprintf(filename, "%s\\%s", m_savegameDir, m_main->GetGamerName());
|
|
|
|
// TODO: _mkdir(filename);
|
|
|
|
sprintf(filename, "%s\\%s\\save%c%.3d", m_savegameDir, m_main->GetGamerName(), m_sceneName[0], sel);
|
|
|
|
// TODO: _mkdir(filename);
|
2012-06-26 20:23:05 +00:00
|
|
|
|
2012-09-15 19:47:19 +00:00
|
|
|
sprintf(filename, "%s\\%s\\save%c%.3d\\data.sav", m_savegameDir, m_main->GetGamerName(), m_sceneName[0], sel);
|
|
|
|
sprintf(filecbot, "%s\\%s\\save%c%.3d\\cbot.run", m_savegameDir, m_main->GetGamerName(), m_sceneName[0], sel);
|
2012-06-26 20:23:05 +00:00
|
|
|
pe->GetText(info, 100);
|
|
|
|
m_main->IOWriteScene(filename, filecbot, info);
|
|
|
|
|
|
|
|
m_shotDelay = 3;
|
2012-09-15 19:47:19 +00:00
|
|
|
sprintf(m_shotName, "%s\\%s\\save%c%.3d\\screen.png", m_savegameDir, m_main->GetGamerName(), m_sceneName[0], sel);
|
2012-06-26 20:23:05 +00:00
|
|
|
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
// Reads the scene.
|
|
|
|
|
|
|
|
bool CMainDialog::IOReadScene()
|
|
|
|
{
|
|
|
|
FILE* file;
|
|
|
|
CWindow* pw;
|
|
|
|
CList* pl;
|
|
|
|
char filename[100];
|
|
|
|
char filecbot[100];
|
|
|
|
char line[500];
|
|
|
|
char dir[100];
|
|
|
|
int sel, i;
|
|
|
|
|
|
|
|
pw = (CWindow*)m_interface->SearchControl(EVENT_WINDOW5);
|
|
|
|
if ( pw == 0 ) return false;
|
|
|
|
pl = (CList*)pw->SearchControl(EVENT_INTERFACE_IOLIST);
|
|
|
|
if ( pl == 0 ) return false;
|
|
|
|
|
2012-09-15 19:47:19 +00:00
|
|
|
sel = pl->GetSelect();
|
2012-06-26 20:23:05 +00:00
|
|
|
if ( sel == -1 ) return false;
|
|
|
|
|
2012-09-15 19:47:19 +00:00
|
|
|
sprintf(filename, "%s\\%s\\save%c%.3d\\data.sav", m_savegameDir, m_main->GetGamerName(), m_sceneName[0], sel);
|
|
|
|
sprintf(filecbot, "%s\\%s\\save%c%.3d\\cbot.run", m_savegameDir, m_main->GetGamerName(), m_sceneName[0], sel);
|
2012-06-26 20:23:05 +00:00
|
|
|
|
|
|
|
file = fopen(filename, "r");
|
|
|
|
if ( file == NULL ) return false;
|
|
|
|
|
|
|
|
while ( fgets(line, 500, file) != NULL )
|
|
|
|
{
|
|
|
|
for ( i=0 ; i<500 ; i++ )
|
|
|
|
{
|
|
|
|
if ( line[i] == '\t' ) line[i] = ' '; // replaces tab by space
|
|
|
|
if ( line[i] == '/' && line[i+1] == '/' )
|
|
|
|
{
|
|
|
|
line[i] = 0;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if ( Cmd(line, "Mission") )
|
|
|
|
{
|
|
|
|
OpString(line, "base", m_sceneName);
|
|
|
|
m_sceneRank = OpInt(line, "rank", 0);
|
|
|
|
|
|
|
|
if ( strcmp(m_sceneName, "user") == 0 )
|
|
|
|
{
|
|
|
|
m_sceneRank = m_sceneRank%100;
|
|
|
|
OpString(line, "dir", dir);
|
|
|
|
for ( i=0 ; i<m_userTotal ; i++ )
|
|
|
|
{
|
|
|
|
if ( strcmp(m_userList[i], dir) == 0 )
|
|
|
|
{
|
|
|
|
m_sceneRank += (i+1)*100;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if ( m_sceneRank/100 == 0 )
|
|
|
|
{
|
|
|
|
fclose(file);
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
fclose(file);
|
|
|
|
|
|
|
|
m_chap[m_index] = (m_sceneRank/100)-1;
|
|
|
|
m_sel[m_index] = (m_sceneRank%100)-1;
|
|
|
|
|
|
|
|
strcpy(m_sceneRead, filename);
|
|
|
|
strcpy(m_stackRead, filecbot);
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2012-09-15 19:47:19 +00:00
|
|
|
// Geturns the number of accessible chapters.
|
2012-06-26 20:23:05 +00:00
|
|
|
|
2012-09-15 19:47:19 +00:00
|
|
|
int CMainDialog::GetChapPassed()
|
2012-06-26 20:23:05 +00:00
|
|
|
{
|
|
|
|
int j;
|
|
|
|
|
2012-09-15 19:47:19 +00:00
|
|
|
if ( m_main->GetShowAll() ) return 9;
|
2012-06-26 20:23:05 +00:00
|
|
|
|
|
|
|
for ( j=0 ; j<9 ; j++ )
|
|
|
|
{
|
2012-09-15 19:47:19 +00:00
|
|
|
if ( !GetGamerInfoPassed((j+1)*100) )
|
2012-06-26 20:23:05 +00:00
|
|
|
{
|
|
|
|
return j;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return 9;
|
|
|
|
}
|
|
|
|
|
|
|
|
// 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 ||
|
|
|
|
m_phase == PHASE_TEEN ||
|
|
|
|
m_phase == PHASE_USER ||
|
|
|
|
m_phase == PHASE_PROTO )
|
|
|
|
{
|
|
|
|
UpdateSceneChap(m_chap[m_index]);
|
|
|
|
UpdateSceneList(m_chap[m_index], m_sel[m_index]);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// Updates the chapters of exercises or missions.
|
|
|
|
|
|
|
|
void CMainDialog::UpdateSceneChap(int &chap)
|
|
|
|
{
|
|
|
|
FILE* file = NULL;
|
|
|
|
CWindow* pw;
|
|
|
|
CList* pl;
|
|
|
|
long hFile;
|
2012-09-15 19:47:19 +00:00
|
|
|
//struct _finddata_t fileBuffer;
|
|
|
|
char filename[MAX_FNAME];
|
2012-06-26 20:23:05 +00:00
|
|
|
char op[100];
|
|
|
|
char line[500];
|
|
|
|
char name[100];
|
|
|
|
int i, j;
|
|
|
|
bool bPassed, bDo;
|
|
|
|
|
|
|
|
pw = (CWindow*)m_interface->SearchControl(EVENT_WINDOW5);
|
|
|
|
if ( pw == 0 ) return;
|
|
|
|
pl = (CList*)pw->SearchControl(EVENT_INTERFACE_CHAP);
|
|
|
|
if ( pl == 0 ) return;
|
|
|
|
|
|
|
|
pl->Flush();
|
|
|
|
|
|
|
|
if ( m_phase == PHASE_USER )
|
|
|
|
{
|
|
|
|
j = 0;
|
2012-09-15 19:47:19 +00:00
|
|
|
/* TODO: list files
|
2012-06-26 20:23:05 +00:00
|
|
|
hFile = _findfirst("user\\*", &fileBuffer);
|
|
|
|
if ( hFile != -1 )
|
|
|
|
{
|
|
|
|
do
|
|
|
|
{
|
|
|
|
if ( (fileBuffer.attrib & _A_SUBDIR) != 0 &&
|
|
|
|
fileBuffer.name[0] != '.' )
|
|
|
|
{
|
|
|
|
strcpy(m_userList[j++], fileBuffer.name);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
while ( _findnext(hFile, &fileBuffer) == 0 && j < 100 );
|
2012-09-15 19:47:19 +00:00
|
|
|
}*/
|
2012-06-26 20:23:05 +00:00
|
|
|
m_userTotal = j;
|
|
|
|
|
|
|
|
do // sorts all names:
|
|
|
|
{
|
|
|
|
bDo = false;
|
|
|
|
for ( i=0 ; i<m_userTotal-1 ; i++ )
|
|
|
|
{
|
|
|
|
if ( strcmp(m_userList[i], m_userList[i+1]) > 0 )
|
|
|
|
{
|
|
|
|
strcpy(name, m_userList[i]);
|
|
|
|
strcpy(m_userList[i], m_userList[i+1]);
|
|
|
|
strcpy(m_userList[i+1], name);
|
|
|
|
bDo = true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
while ( bDo );
|
|
|
|
|
|
|
|
for ( j=0 ; j<m_userTotal ; j++ )
|
|
|
|
{
|
|
|
|
BuildSceneName(filename, m_sceneName, (j+1)*100);
|
|
|
|
file = fopen(filename, "r");
|
|
|
|
if ( file == NULL )
|
|
|
|
{
|
|
|
|
strcpy(name, m_userList[j]);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
BuildResumeName(name, m_sceneName, j+1); // default name
|
|
|
|
while ( fgets(line, 500, file) != NULL )
|
|
|
|
{
|
|
|
|
for ( i=0 ; i<500 ; i++ )
|
|
|
|
{
|
|
|
|
if ( line[i] == '\t' ) line[i] = ' '; // replaces tab by space
|
|
|
|
if ( line[i] == '/' && line[i+1] == '/' )
|
|
|
|
{
|
|
|
|
line[i] = 0;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2012-09-15 19:47:19 +00:00
|
|
|
/* TODO: language letters */
|
|
|
|
sprintf(op, "Title.%c", 'E' /*GetLanguageLetter()*/);
|
2012-06-26 20:23:05 +00:00
|
|
|
if ( Cmd(line, op) )
|
|
|
|
{
|
|
|
|
OpString(line, "text", name);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
fclose(file);
|
|
|
|
}
|
|
|
|
|
|
|
|
pl->SetName(j, name);
|
|
|
|
pl->SetEnable(j, true);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
for ( j=0 ; j<9 ; j++ )
|
|
|
|
{
|
2012-09-15 19:47:19 +00:00
|
|
|
/* TODO: #if _SCHOOL
|
2012-06-26 20:23:05 +00:00
|
|
|
if ( m_phase == PHASE_MISSION ) break;
|
|
|
|
if ( m_phase == PHASE_FREE ) break;
|
|
|
|
#if _CEEBOTDEMO
|
|
|
|
if ( m_phase == PHASE_TRAINER && j >= 2 ) break;
|
|
|
|
#endif
|
|
|
|
#endif
|
|
|
|
#if _DEMO
|
|
|
|
if ( m_phase == PHASE_MISSION && j >= 4 ) break;
|
|
|
|
if ( m_phase == PHASE_TRAINER && j >= 1 ) break;
|
2012-09-15 19:47:19 +00:00
|
|
|
#endif */
|
2012-06-26 20:23:05 +00:00
|
|
|
BuildSceneName(filename, m_sceneName, (j+1)*100);
|
|
|
|
file = fopen(filename, "r");
|
|
|
|
if ( file == NULL ) break;
|
|
|
|
|
|
|
|
BuildResumeName(name, m_sceneName, j+1); // default name
|
|
|
|
while ( fgets(line, 500, file) != NULL )
|
|
|
|
{
|
|
|
|
for ( i=0 ; i<500 ; i++ )
|
|
|
|
{
|
|
|
|
if ( line[i] == '\t' ) line[i] = ' '; // replaces tab by space
|
|
|
|
if ( line[i] == '/' && line[i+1] == '/' )
|
|
|
|
{
|
|
|
|
line[i] = 0;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2012-09-15 19:47:19 +00:00
|
|
|
// TODO: language letters
|
|
|
|
sprintf(op, "Title.%c", 'E'/*GetLanguageLetter()*/);
|
2012-06-26 20:23:05 +00:00
|
|
|
if ( Cmd(line, op) )
|
|
|
|
{
|
|
|
|
OpString(line, "text", name);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
fclose(file);
|
|
|
|
|
2012-09-15 19:47:19 +00:00
|
|
|
bPassed = GetGamerInfoPassed((j+1)*100);
|
2012-06-26 20:23:05 +00:00
|
|
|
sprintf(line, "%d: %s", j+1, name);
|
|
|
|
pl->SetName(j, line);
|
|
|
|
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;
|
|
|
|
}
|
|
|
|
|
2012-09-15 19:47:19 +00:00
|
|
|
/* TODO: #if _TEEN
|
|
|
|
if ( m_phase == PHASE_TRAINER && !m_main->GetShowAll() && !bPassed )
|
2012-06-26 20:23:05 +00:00
|
|
|
{
|
|
|
|
j ++;
|
|
|
|
break;
|
|
|
|
}
|
2012-09-15 19:47:19 +00:00
|
|
|
#endif*/
|
2012-06-26 20:23:05 +00:00
|
|
|
|
|
|
|
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)
|
|
|
|
{
|
|
|
|
FILE* file = NULL;
|
|
|
|
CWindow* pw;
|
|
|
|
CList* pl;
|
2012-09-15 19:47:19 +00:00
|
|
|
char filename[MAX_FNAME];
|
2012-06-26 20:23:05 +00:00
|
|
|
char op[100];
|
|
|
|
char line[500];
|
|
|
|
char name[100];
|
|
|
|
int i, j;
|
|
|
|
bool bPassed;
|
|
|
|
|
|
|
|
pw = (CWindow*)m_interface->SearchControl(EVENT_WINDOW5);
|
|
|
|
if ( pw == 0 ) return;
|
|
|
|
pl = (CList*)pw->SearchControl(EVENT_INTERFACE_LIST);
|
|
|
|
if ( pl == 0 ) return;
|
|
|
|
|
|
|
|
pl->Flush();
|
|
|
|
|
|
|
|
for ( j=0 ; j<99 ; j++ )
|
|
|
|
{
|
2012-09-15 19:47:19 +00:00
|
|
|
/* TODO: #if _SCHOOL
|
2012-06-26 20:23:05 +00:00
|
|
|
if ( m_phase == PHASE_MISSION ) break;
|
|
|
|
if ( m_phase == PHASE_FREE ) break;
|
|
|
|
#if _CEEBOTDEMO
|
|
|
|
#if _TEEN
|
|
|
|
if ( m_phase == PHASE_TRAINER && j >= 5 ) break;
|
|
|
|
#else
|
|
|
|
if ( m_phase == PHASE_TRAINER && j >= 3 ) break;
|
|
|
|
#endif
|
|
|
|
#endif
|
|
|
|
#endif
|
|
|
|
#if _DEMO
|
|
|
|
if ( m_phase == PHASE_MISSION && j >= 3 ) break;
|
|
|
|
if ( m_phase == PHASE_TRAINER && j >= 5 ) break;
|
2012-09-15 19:47:19 +00:00
|
|
|
#endif */
|
2012-06-26 20:23:05 +00:00
|
|
|
BuildSceneName(filename, m_sceneName, (chap+1)*100+(j+1));
|
|
|
|
file = fopen(filename, "r");
|
|
|
|
if ( file == NULL ) break;
|
|
|
|
|
|
|
|
BuildResumeName(name, m_sceneName, j+1); // default name
|
|
|
|
while ( fgets(line, 500, file) != NULL )
|
|
|
|
{
|
|
|
|
for ( i=0 ; i<500 ; i++ )
|
|
|
|
{
|
|
|
|
if ( line[i] == '\t' ) line[i] = ' '; // replaces tab by space
|
|
|
|
if ( line[i] == '/' && line[i+1] == '/' )
|
|
|
|
{
|
|
|
|
line[i] = 0;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2012-09-15 19:47:19 +00:00
|
|
|
// TODO: language letters
|
|
|
|
sprintf(op, "Title.%c", 'E' /*MAX_FNAME()*/);
|
2012-06-26 20:23:05 +00:00
|
|
|
if ( Cmd(line, op) )
|
|
|
|
{
|
|
|
|
OpString(line, "text", name);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
fclose(file);
|
|
|
|
|
2012-09-15 19:47:19 +00:00
|
|
|
bPassed = GetGamerInfoPassed((chap+1)*100+(j+1));
|
2012-06-26 20:23:05 +00:00
|
|
|
sprintf(line, "%d: %s", j+1, name);
|
|
|
|
pl->SetName(j, line);
|
|
|
|
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;
|
|
|
|
}
|
|
|
|
|
2012-09-15 19:47:19 +00:00
|
|
|
/* TODO: #if _TEEN
|
|
|
|
if ( m_phase == PHASE_TRAINER && !m_main->GetShowAll() && !bPassed )
|
2012-06-26 20:23:05 +00:00
|
|
|
{
|
|
|
|
j ++;
|
|
|
|
break;
|
|
|
|
}
|
2012-09-15 19:47:19 +00:00
|
|
|
#endif*/
|
2012-06-26 20:23:05 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
BuildSceneName(filename, m_sceneName, (chap+1)*100+(j+1));
|
|
|
|
file = fopen(filename, "r");
|
|
|
|
if ( file == NULL )
|
|
|
|
{
|
|
|
|
m_maxList = j;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
m_maxList = j+1; // this is not the last!
|
|
|
|
fclose(file);
|
|
|
|
}
|
|
|
|
|
|
|
|
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 ||
|
|
|
|
m_phase == PHASE_TEEN ||
|
|
|
|
m_phase == PHASE_USER ||
|
|
|
|
m_phase == PHASE_PROTO )
|
|
|
|
{
|
|
|
|
m_bSceneSoluce = false;
|
|
|
|
|
|
|
|
pw = (CWindow*)m_interface->SearchControl(EVENT_WINDOW5);
|
|
|
|
if ( pw == 0 ) return;
|
|
|
|
pe = (CEdit*)pw->SearchControl(EVENT_INTERFACE_RESUME);
|
|
|
|
if ( pe == 0 ) return;
|
|
|
|
pc = (CCheck*)pw->SearchControl(EVENT_INTERFACE_SOLUCE);
|
|
|
|
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.
|
|
|
|
|
|
|
|
void CMainDialog::UpdateSceneResume(int rank)
|
|
|
|
{
|
|
|
|
FILE* file = NULL;
|
|
|
|
CWindow* pw;
|
|
|
|
CEdit* pe;
|
|
|
|
CCheck* pc;
|
2012-09-15 19:47:19 +00:00
|
|
|
char filename[MAX_FNAME];
|
2012-06-26 20:23:05 +00:00
|
|
|
char op[100];
|
|
|
|
char line[500];
|
|
|
|
char name[500];
|
|
|
|
int i, numTry;
|
|
|
|
bool bPassed, bVisible;
|
|
|
|
|
|
|
|
pw = (CWindow*)m_interface->SearchControl(EVENT_WINDOW5);
|
|
|
|
if ( pw == 0 ) return;
|
|
|
|
pe = (CEdit*)pw->SearchControl(EVENT_INTERFACE_RESUME);
|
|
|
|
if ( pe == 0 ) return;
|
|
|
|
pc = (CCheck*)pw->SearchControl(EVENT_INTERFACE_SOLUCE);
|
|
|
|
|
|
|
|
if ( pc == 0 )
|
|
|
|
{
|
|
|
|
m_bSceneSoluce = false;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2012-09-15 19:47:19 +00:00
|
|
|
numTry = GetGamerInfoTry(rank);
|
|
|
|
bPassed = GetGamerInfoPassed(rank);
|
|
|
|
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;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
BuildSceneName(filename, m_sceneName, rank);
|
|
|
|
file = fopen(filename, "r");
|
|
|
|
if ( file == NULL ) return;
|
|
|
|
|
|
|
|
name[0] = 0;
|
|
|
|
while ( fgets(line, 500, file) != NULL )
|
|
|
|
{
|
|
|
|
for ( i=0 ; i<500 ; i++ )
|
|
|
|
{
|
|
|
|
if ( line[i] == '\t' ) line[i] = ' '; // replaces tab by space
|
|
|
|
if ( line[i] == '/' && line[i+1] == '/' )
|
|
|
|
{
|
|
|
|
line[i] = 0;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2012-09-15 19:47:19 +00:00
|
|
|
// TODO: language letters
|
|
|
|
sprintf(op, "Resume.%c", 'E' /*MAX_FNAME()*/);
|
2012-06-26 20:23:05 +00:00
|
|
|
if ( Cmd(line, op) )
|
|
|
|
{
|
|
|
|
OpString(line, "text", name);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
fclose(file);
|
|
|
|
|
|
|
|
pe->SetText(name);
|
|
|
|
}
|
|
|
|
|
|
|
|
// Updates the list of devices.
|
|
|
|
|
|
|
|
void CMainDialog::UpdateDisplayDevice()
|
|
|
|
{
|
|
|
|
CWindow* pw;
|
|
|
|
CList* pl;
|
|
|
|
char bufDevices[1000];
|
|
|
|
char bufModes[5000];
|
|
|
|
int i, j, totalDevices, selectDevices, totalModes, selectModes;
|
|
|
|
|
|
|
|
pw = (CWindow*)m_interface->SearchControl(EVENT_WINDOW5);
|
|
|
|
if ( pw == 0 ) return;
|
|
|
|
pl = (CList*)pw->SearchControl(EVENT_LIST1);
|
|
|
|
if ( pl == 0 ) return;
|
|
|
|
pl->Flush();
|
|
|
|
|
2012-09-15 19:47:19 +00:00
|
|
|
bufModes[0] = 0;
|
|
|
|
/* TODO: remove device choice
|
2012-06-26 20:23:05 +00:00
|
|
|
m_engine->EnumDevices(bufDevices, 1000,
|
|
|
|
bufModes, 5000,
|
|
|
|
totalDevices, selectDevices,
|
2012-09-15 19:47:19 +00:00
|
|
|
totalModes, selectModes);*/
|
2012-06-26 20:23:05 +00:00
|
|
|
|
|
|
|
i = 0;
|
|
|
|
j = 0;
|
|
|
|
while ( bufDevices[i] != 0 )
|
|
|
|
{
|
|
|
|
pl->SetName(j++, bufDevices+i);
|
|
|
|
while ( bufDevices[i++] != 0 );
|
|
|
|
}
|
|
|
|
|
|
|
|
pl->SetSelect(selectDevices);
|
|
|
|
pl->ShowSelect(false);
|
|
|
|
|
|
|
|
m_setupSelDevice = selectDevices;
|
|
|
|
}
|
|
|
|
|
|
|
|
// Updates the list of modes.
|
|
|
|
|
|
|
|
void CMainDialog::UpdateDisplayMode()
|
|
|
|
{
|
|
|
|
CWindow* pw;
|
|
|
|
CList* pl;
|
|
|
|
char bufDevices[1000];
|
|
|
|
char bufModes[5000];
|
|
|
|
int i, j, totalDevices, selectDevices, totalModes, selectModes;
|
|
|
|
|
|
|
|
pw = (CWindow*)m_interface->SearchControl(EVENT_WINDOW5);
|
|
|
|
if ( pw == 0 ) return;
|
|
|
|
pl = (CList*)pw->SearchControl(EVENT_LIST2);
|
|
|
|
if ( pl == 0 ) return;
|
|
|
|
pl->Flush();
|
|
|
|
|
2012-09-15 19:47:19 +00:00
|
|
|
bufModes[0] = 0;
|
|
|
|
/* TODO: remove device choice
|
2012-06-26 20:23:05 +00:00
|
|
|
m_engine->EnumDevices(bufDevices, 1000,
|
|
|
|
bufModes, 5000,
|
|
|
|
totalDevices, selectDevices,
|
2012-09-15 19:47:19 +00:00
|
|
|
totalModes, selectModes);*/
|
2012-06-26 20:23:05 +00:00
|
|
|
|
|
|
|
i = 0;
|
|
|
|
j = 0;
|
|
|
|
while ( bufModes[i] != 0 )
|
|
|
|
{
|
|
|
|
pl->SetName(j++, bufModes+i);
|
|
|
|
while ( bufModes[i++] != 0 );
|
|
|
|
}
|
|
|
|
|
|
|
|
pl->SetSelect(selectModes);
|
|
|
|
pl->ShowSelect(false);
|
|
|
|
|
|
|
|
m_setupSelMode = selectModes;
|
|
|
|
}
|
|
|
|
|
|
|
|
// Change the graphics mode.
|
|
|
|
|
|
|
|
void CMainDialog::ChangeDisplay()
|
|
|
|
{
|
|
|
|
CWindow* pw;
|
|
|
|
CList* pl;
|
|
|
|
CCheck* pc;
|
|
|
|
char* device;
|
|
|
|
char* mode;
|
|
|
|
bool bFull;
|
|
|
|
|
|
|
|
pw = (CWindow*)m_interface->SearchControl(EVENT_WINDOW5);
|
|
|
|
if ( pw == 0 ) return;
|
|
|
|
|
|
|
|
pl = (CList*)pw->SearchControl(EVENT_LIST1);
|
|
|
|
if ( pl == 0 ) return;
|
2012-09-15 19:47:19 +00:00
|
|
|
m_setupSelDevice = pl->GetSelect();
|
|
|
|
device = pl->GetName(m_setupSelDevice);
|
2012-06-26 20:23:05 +00:00
|
|
|
|
|
|
|
pl = (CList*)pw->SearchControl(EVENT_LIST2);
|
|
|
|
if ( pl == 0 ) return;
|
2012-09-15 19:47:19 +00:00
|
|
|
m_setupSelMode = pl->GetSelect();
|
|
|
|
mode = pl->GetName(m_setupSelMode);
|
2012-06-26 20:23:05 +00:00
|
|
|
|
|
|
|
pc = (CCheck*)pw->SearchControl(EVENT_INTERFACE_FULL);
|
|
|
|
if ( pc == 0 ) return;
|
|
|
|
bFull = pc->TestState(STATE_CHECK);
|
|
|
|
m_setupFull = bFull;
|
|
|
|
|
2012-09-15 19:47:19 +00:00
|
|
|
// TODO: remove device choice
|
|
|
|
// m_engine->ChangeDevice(device, mode, bFull);
|
2012-06-26 20:23:05 +00:00
|
|
|
|
|
|
|
if ( m_bSimulSetup )
|
|
|
|
{
|
|
|
|
m_main->ChangeColor();
|
|
|
|
m_main->UpdateMap();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Updates the "apply" button.
|
|
|
|
|
|
|
|
void CMainDialog::UpdateApply()
|
|
|
|
{
|
|
|
|
CWindow* pw;
|
|
|
|
CButton* pb;
|
|
|
|
CList* pl;
|
|
|
|
CCheck* pc;
|
|
|
|
int sel1, sel2;
|
|
|
|
bool bFull;
|
|
|
|
|
|
|
|
pw = (CWindow*)m_interface->SearchControl(EVENT_WINDOW5);
|
|
|
|
if ( pw == 0 ) return;
|
|
|
|
|
|
|
|
pb = (CButton*)pw->SearchControl(EVENT_INTERFACE_APPLY);
|
|
|
|
if ( pb == 0 ) return;
|
|
|
|
|
|
|
|
pl = (CList*)pw->SearchControl(EVENT_LIST1);
|
|
|
|
if ( pl == 0 ) return;
|
2012-09-15 19:47:19 +00:00
|
|
|
sel1 = pl->GetSelect();
|
2012-06-26 20:23:05 +00:00
|
|
|
|
|
|
|
pl = (CList*)pw->SearchControl(EVENT_LIST2);
|
|
|
|
if ( pl == 0 ) return;
|
2012-09-15 19:47:19 +00:00
|
|
|
sel2 = pl->GetSelect();
|
2012-06-26 20:23:05 +00:00
|
|
|
|
|
|
|
pc = (CCheck*)pw->SearchControl(EVENT_INTERFACE_FULL);
|
|
|
|
bFull = pc->TestState(STATE_CHECK);
|
|
|
|
|
|
|
|
if ( sel1 == m_setupSelDevice &&
|
|
|
|
sel2 == m_setupSelMode &&
|
|
|
|
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;
|
|
|
|
|
|
|
|
pw = (CWindow*)m_interface->SearchControl(EVENT_WINDOW5);
|
|
|
|
if ( pw == 0 ) return;
|
|
|
|
|
|
|
|
pc = (CCheck*)pw->SearchControl(EVENT_INTERFACE_TOTO);
|
|
|
|
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
|
|
|
}
|
|
|
|
|
|
|
|
pc = (CCheck*)pw->SearchControl(EVENT_INTERFACE_TOOLTIP);
|
|
|
|
if ( pc != 0 )
|
|
|
|
{
|
|
|
|
pc->SetState(STATE_CHECK, m_bTooltip);
|
|
|
|
}
|
|
|
|
|
|
|
|
pc = (CCheck*)pw->SearchControl(EVENT_INTERFACE_GLINT);
|
|
|
|
if ( pc != 0 )
|
|
|
|
{
|
|
|
|
pc->SetState(STATE_CHECK, m_bGlint);
|
|
|
|
}
|
|
|
|
|
|
|
|
pc = (CCheck*)pw->SearchControl(EVENT_INTERFACE_RAIN);
|
|
|
|
if ( pc != 0 )
|
|
|
|
{
|
|
|
|
pc->SetState(STATE_CHECK, m_bRain);
|
|
|
|
}
|
|
|
|
|
|
|
|
pc = (CCheck*)pw->SearchControl(EVENT_INTERFACE_MOUSE);
|
|
|
|
if ( pc != 0 )
|
|
|
|
{
|
2012-09-15 19:47:19 +00:00
|
|
|
/* TODO: nice mouse?
|
|
|
|
pc->SetState(STATE_CHECK, m_engine->GetNiceMouse());
|
|
|
|
pc->SetState(STATE_ENABLE, m_engine->GetNiceMouseCap());*/
|
2012-06-26 20:23:05 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
pc = (CCheck*)pw->SearchControl(EVENT_INTERFACE_EDITMODE);
|
|
|
|
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
|
|
|
}
|
|
|
|
|
|
|
|
pc = (CCheck*)pw->SearchControl(EVENT_INTERFACE_EDITVALUE);
|
|
|
|
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
|
|
|
}
|
|
|
|
|
|
|
|
pc = (CCheck*)pw->SearchControl(EVENT_INTERFACE_SOLUCE4);
|
|
|
|
if ( pc != 0 )
|
|
|
|
{
|
|
|
|
pc->SetState(STATE_CHECK, m_bSoluce4);
|
|
|
|
}
|
|
|
|
|
|
|
|
pc = (CCheck*)pw->SearchControl(EVENT_INTERFACE_MOVIES);
|
|
|
|
if ( pc != 0 )
|
|
|
|
{
|
|
|
|
pc->SetState(STATE_CHECK, m_bMovies);
|
|
|
|
}
|
|
|
|
|
|
|
|
pc = (CCheck*)pw->SearchControl(EVENT_INTERFACE_NICERST);
|
|
|
|
if ( pc != 0 )
|
|
|
|
{
|
|
|
|
pc->SetState(STATE_CHECK, m_bNiceReset);
|
|
|
|
}
|
|
|
|
|
|
|
|
pc = (CCheck*)pw->SearchControl(EVENT_INTERFACE_HIMSELF);
|
|
|
|
if ( pc != 0 )
|
|
|
|
{
|
|
|
|
pc->SetState(STATE_CHECK, m_bHimselfDamage);
|
|
|
|
}
|
|
|
|
|
|
|
|
pc = (CCheck*)pw->SearchControl(EVENT_INTERFACE_SCROLL);
|
|
|
|
if ( pc != 0 )
|
|
|
|
{
|
|
|
|
pc->SetState(STATE_CHECK, m_bCameraScroll);
|
|
|
|
}
|
|
|
|
|
|
|
|
pc = (CCheck*)pw->SearchControl(EVENT_INTERFACE_INVERTX);
|
|
|
|
if ( pc != 0 )
|
|
|
|
{
|
|
|
|
pc->SetState(STATE_CHECK, m_bCameraInvertX);
|
|
|
|
}
|
|
|
|
|
|
|
|
pc = (CCheck*)pw->SearchControl(EVENT_INTERFACE_INVERTY);
|
|
|
|
if ( pc != 0 )
|
|
|
|
{
|
|
|
|
pc->SetState(STATE_CHECK, m_bCameraInvertY);
|
|
|
|
}
|
|
|
|
|
|
|
|
pc = (CCheck*)pw->SearchControl(EVENT_INTERFACE_EFFECT);
|
|
|
|
if ( pc != 0 )
|
|
|
|
{
|
|
|
|
pc->SetState(STATE_CHECK, m_bEffect);
|
|
|
|
}
|
|
|
|
|
|
|
|
pc = (CCheck*)pw->SearchControl(EVENT_INTERFACE_SHADOW);
|
|
|
|
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
|
|
|
}
|
|
|
|
|
|
|
|
pc = (CCheck*)pw->SearchControl(EVENT_INTERFACE_GROUND);
|
|
|
|
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
|
|
|
}
|
|
|
|
|
|
|
|
pc = (CCheck*)pw->SearchControl(EVENT_INTERFACE_DIRTY);
|
|
|
|
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
|
|
|
}
|
|
|
|
|
|
|
|
pc = (CCheck*)pw->SearchControl(EVENT_INTERFACE_FOG);
|
|
|
|
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
|
|
|
}
|
|
|
|
|
|
|
|
pc = (CCheck*)pw->SearchControl(EVENT_INTERFACE_LENS);
|
|
|
|
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
|
|
|
}
|
|
|
|
|
|
|
|
pc = (CCheck*)pw->SearchControl(EVENT_INTERFACE_SKY);
|
|
|
|
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
|
|
|
}
|
|
|
|
|
|
|
|
pc = (CCheck*)pw->SearchControl(EVENT_INTERFACE_PLANET);
|
|
|
|
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
|
|
|
}
|
|
|
|
|
|
|
|
pc = (CCheck*)pw->SearchControl(EVENT_INTERFACE_LIGHT);
|
|
|
|
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
|
|
|
}
|
|
|
|
|
|
|
|
pc = (CCheck*)pw->SearchControl(EVENT_INTERFACE_JOYSTICK);
|
|
|
|
if ( pc != 0 )
|
|
|
|
{
|
2012-09-15 19:47:19 +00:00
|
|
|
pc->SetState(STATE_CHECK, m_app->GetJoystickEnabled());
|
2012-06-26 20:23:05 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
pv = (CEditValue*)pw->SearchControl(EVENT_INTERFACE_PARTI);
|
|
|
|
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);
|
|
|
|
}
|
|
|
|
|
|
|
|
pv = (CEditValue*)pw->SearchControl(EVENT_INTERFACE_CLIP);
|
|
|
|
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);
|
|
|
|
}
|
|
|
|
|
|
|
|
pv = (CEditValue*)pw->SearchControl(EVENT_INTERFACE_DETAIL);
|
|
|
|
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);
|
|
|
|
}
|
|
|
|
|
|
|
|
pv = (CEditValue*)pw->SearchControl(EVENT_INTERFACE_GADGET);
|
|
|
|
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);
|
|
|
|
}
|
|
|
|
|
|
|
|
pv = (CEditValue*)pw->SearchControl(EVENT_INTERFACE_TEXTURE);
|
|
|
|
if ( pv != 0 )
|
|
|
|
{
|
2012-09-15 19:47:19 +00:00
|
|
|
value = (float)m_engine->GetTextureQuality();
|
2012-06-26 20:23:05 +00:00
|
|
|
pv->SetValue(value);
|
|
|
|
}
|
|
|
|
|
|
|
|
ps = (CSlider*)pw->SearchControl(EVENT_INTERFACE_VOLSOUND);
|
|
|
|
if ( ps != 0 )
|
|
|
|
{
|
2012-09-15 19:47:19 +00:00
|
|
|
value = (float)m_sound->GetAudioVolume();
|
2012-06-26 20:23:05 +00:00
|
|
|
ps->SetVisibleValue(value);
|
|
|
|
}
|
|
|
|
|
|
|
|
ps = (CSlider*)pw->SearchControl(EVENT_INTERFACE_VOLMUSIC);
|
|
|
|
if ( ps != 0 )
|
|
|
|
{
|
2012-09-15 19:47:19 +00:00
|
|
|
/* TODO: midi volume
|
|
|
|
value = (float)m_sound->GetMidiVolume();
|
|
|
|
ps->SetVisibleValue(value);*/
|
2012-06-26 20:23:05 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
pc = (CCheck*)pw->SearchControl(EVENT_INTERFACE_SOUND3D);
|
|
|
|
if ( pc != 0 )
|
|
|
|
{
|
2012-09-15 19:47:19 +00:00
|
|
|
pc->SetState(STATE_CHECK, m_sound->GetSound3D());
|
|
|
|
pc->SetState(STATE_ENABLE, m_sound->GetSound3DCap());
|
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;
|
|
|
|
|
|
|
|
pw = (CWindow*)m_interface->SearchControl(EVENT_WINDOW5);
|
|
|
|
if ( pw == 0 ) return;
|
|
|
|
|
|
|
|
pv = (CEditValue*)pw->SearchControl(EVENT_INTERFACE_PARTI);
|
|
|
|
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
|
|
|
}
|
|
|
|
|
|
|
|
pv = (CEditValue*)pw->SearchControl(EVENT_INTERFACE_CLIP);
|
|
|
|
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);
|
|
|
|
}
|
|
|
|
|
|
|
|
pv = (CEditValue*)pw->SearchControl(EVENT_INTERFACE_DETAIL);
|
|
|
|
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);
|
|
|
|
}
|
|
|
|
|
|
|
|
pv = (CEditValue*)pw->SearchControl(EVENT_INTERFACE_GADGET);
|
|
|
|
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);
|
|
|
|
}
|
|
|
|
|
|
|
|
pv = (CEditValue*)pw->SearchControl(EVENT_INTERFACE_TEXTURE);
|
|
|
|
if ( pv != 0 )
|
|
|
|
{
|
2012-09-15 19:47:19 +00:00
|
|
|
value = pv->GetValue();
|
2012-06-26 20:23:05 +00:00
|
|
|
m_engine->SetTextureQuality((int)value);
|
|
|
|
}
|
|
|
|
|
|
|
|
ps = (CSlider*)pw->SearchControl(EVENT_INTERFACE_VOLSOUND);
|
|
|
|
if ( ps != 0 )
|
|
|
|
{
|
2012-09-15 19:47:19 +00:00
|
|
|
value = ps->GetVisibleValue();
|
2012-06-26 20:23:05 +00:00
|
|
|
m_sound->SetAudioVolume((int)value);
|
|
|
|
}
|
|
|
|
|
|
|
|
ps = (CSlider*)pw->SearchControl(EVENT_INTERFACE_VOLMUSIC);
|
|
|
|
if ( ps != 0 )
|
|
|
|
{
|
2012-09-15 19:47:19 +00:00
|
|
|
/*
|
|
|
|
TODO: midi volume
|
|
|
|
value = ps->GetVisibleValue();
|
|
|
|
m_sound->SetMidiVolume((int)value);*/
|
2012-06-26 20:23:05 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// Memorizes all the settings.
|
|
|
|
|
|
|
|
void CMainDialog::SetupMemorize()
|
|
|
|
{
|
|
|
|
float fValue;
|
|
|
|
int iValue, i, j;
|
|
|
|
char key[500];
|
|
|
|
char num[10];
|
|
|
|
|
2012-09-15 19:47:19 +00:00
|
|
|
/* TODO: profile
|
2012-07-04 17:56:22 +00:00
|
|
|
SetLocalProfileString("Directory", "scene", m_sceneDir);
|
|
|
|
SetLocalProfileString("Directory", "savegame", m_savegameDir);
|
|
|
|
SetLocalProfileString("Directory", "public", m_publicDir);
|
|
|
|
SetLocalProfileString("Directory", "user", m_userDir);
|
|
|
|
SetLocalProfileString("Directory", "files", m_filesDir);
|
2012-06-26 20:23:05 +00:00
|
|
|
|
2012-09-15 19:47:19 +00:00
|
|
|
iValue = m_engine->GetTotoMode();
|
2012-07-04 17:56:22 +00:00
|
|
|
SetLocalProfileInt("Setup", "TotoMode", iValue);
|
2012-06-26 20:23:05 +00:00
|
|
|
|
|
|
|
iValue = m_bTooltip;
|
2012-07-04 17:56:22 +00:00
|
|
|
SetLocalProfileInt("Setup", "Tooltips", iValue);
|
2012-06-26 20:23:05 +00:00
|
|
|
|
|
|
|
iValue = m_bGlint;
|
2012-07-04 17:56:22 +00:00
|
|
|
SetLocalProfileInt("Setup", "InterfaceGlint", iValue);
|
2012-06-26 20:23:05 +00:00
|
|
|
|
|
|
|
iValue = m_bRain;
|
2012-07-04 17:56:22 +00:00
|
|
|
SetLocalProfileInt("Setup", "InterfaceGlint", iValue);
|
2012-06-26 20:23:05 +00:00
|
|
|
|
2012-09-15 19:47:19 +00:00
|
|
|
iValue = m_engine->GetNiceMouse();
|
2012-07-04 17:56:22 +00:00
|
|
|
SetLocalProfileInt("Setup", "NiceMouse", iValue);
|
2012-06-26 20:23:05 +00:00
|
|
|
|
|
|
|
iValue = m_bSoluce4;
|
2012-07-04 17:56:22 +00:00
|
|
|
SetLocalProfileInt("Setup", "Soluce4", iValue);
|
2012-06-26 20:23:05 +00:00
|
|
|
|
|
|
|
iValue = m_bMovies;
|
2012-07-04 17:56:22 +00:00
|
|
|
SetLocalProfileInt("Setup", "Movies", iValue);
|
2012-06-26 20:23:05 +00:00
|
|
|
|
|
|
|
iValue = m_bNiceReset;
|
2012-07-04 17:56:22 +00:00
|
|
|
SetLocalProfileInt("Setup", "NiceReset", iValue);
|
2012-06-26 20:23:05 +00:00
|
|
|
|
|
|
|
iValue = m_bHimselfDamage;
|
2012-07-04 17:56:22 +00:00
|
|
|
SetLocalProfileInt("Setup", "HimselfDamage", iValue);
|
2012-06-26 20:23:05 +00:00
|
|
|
|
|
|
|
iValue = m_bCameraScroll;
|
2012-07-04 17:56:22 +00:00
|
|
|
SetLocalProfileInt("Setup", "CameraScroll", iValue);
|
2012-06-26 20:23:05 +00:00
|
|
|
|
|
|
|
iValue = m_bCameraInvertX;
|
2012-07-04 17:56:22 +00:00
|
|
|
SetLocalProfileInt("Setup", "CameraInvertX", iValue);
|
2012-06-26 20:23:05 +00:00
|
|
|
|
|
|
|
iValue = m_bEffect;
|
2012-07-04 17:56:22 +00:00
|
|
|
SetLocalProfileInt("Setup", "InterfaceEffect", iValue);
|
2012-06-26 20:23:05 +00:00
|
|
|
|
2012-09-15 19:47:19 +00:00
|
|
|
iValue = m_engine->GetShadow();
|
2012-07-04 17:56:22 +00:00
|
|
|
SetLocalProfileInt("Setup", "GroundShadow", iValue);
|
2012-06-26 20:23:05 +00:00
|
|
|
|
2012-09-15 19:47:19 +00:00
|
|
|
iValue = m_engine->GetGroundSpot();
|
2012-07-04 17:56:22 +00:00
|
|
|
SetLocalProfileInt("Setup", "GroundSpot", iValue);
|
2012-06-26 20:23:05 +00:00
|
|
|
|
2012-09-15 19:47:19 +00:00
|
|
|
iValue = m_engine->GetDirty();
|
2012-07-04 17:56:22 +00:00
|
|
|
SetLocalProfileInt("Setup", "ObjectDirty", iValue);
|
2012-06-26 20:23:05 +00:00
|
|
|
|
2012-09-15 19:47:19 +00:00
|
|
|
iValue = m_engine->GetFog();
|
2012-07-04 17:56:22 +00:00
|
|
|
SetLocalProfileInt("Setup", "FogMode", iValue);
|
2012-06-26 20:23:05 +00:00
|
|
|
|
2012-09-15 19:47:19 +00:00
|
|
|
iValue = m_engine->GetLensMode();
|
2012-07-04 17:56:22 +00:00
|
|
|
SetLocalProfileInt("Setup", "LensMode", iValue);
|
2012-06-26 20:23:05 +00:00
|
|
|
|
2012-09-15 19:47:19 +00:00
|
|
|
iValue = m_engine->GetSkyMode();
|
2012-07-04 17:56:22 +00:00
|
|
|
SetLocalProfileInt("Setup", "SkyMode", iValue);
|
2012-06-26 20:23:05 +00:00
|
|
|
|
2012-09-15 19:47:19 +00:00
|
|
|
iValue = m_engine->GetPlanetMode();
|
2012-07-04 17:56:22 +00:00
|
|
|
SetLocalProfileInt("Setup", "PlanetMode", iValue);
|
2012-06-26 20:23:05 +00:00
|
|
|
|
2012-09-15 19:47:19 +00:00
|
|
|
iValue = m_engine->GetLightMode();
|
2012-07-04 17:56:22 +00:00
|
|
|
SetLocalProfileInt("Setup", "LightMode", iValue);
|
2012-06-26 20:23:05 +00:00
|
|
|
|
2012-09-15 19:47:19 +00:00
|
|
|
iValue = m_engine->GetJoystick();
|
2012-07-04 17:56:22 +00:00
|
|
|
SetLocalProfileInt("Setup", "UseJoystick", iValue);
|
2012-06-26 20:23:05 +00:00
|
|
|
|
2012-09-15 19:47:19 +00:00
|
|
|
fValue = m_engine->GetParticleDensity();
|
|
|
|
SetLocalProfileFloat("Setup", "ParticleDensity", fValue);
|
2012-06-26 20:23:05 +00:00
|
|
|
|
2012-09-15 19:47:19 +00:00
|
|
|
fValue = m_engine->GetClippingDistance();
|
2012-07-04 17:56:22 +00:00
|
|
|
SetLocalProfileFloat("Setup", "ClippingDistance", fValue);
|
2012-06-26 20:23:05 +00:00
|
|
|
|
2012-09-15 19:47:19 +00:00
|
|
|
fValue = m_engine->GetObjectDetail();
|
2012-07-04 17:56:22 +00:00
|
|
|
SetLocalProfileFloat("Setup", "ObjectDetail", fValue);
|
2012-06-26 20:23:05 +00:00
|
|
|
|
2012-09-15 19:47:19 +00:00
|
|
|
fValue = m_engine->GetGadgetQuantity();
|
2012-07-04 17:56:22 +00:00
|
|
|
SetLocalProfileFloat("Setup", "GadgetQuantity", fValue);
|
2012-06-26 20:23:05 +00:00
|
|
|
|
2012-09-15 19:47:19 +00:00
|
|
|
iValue = m_engine->GetTextureQuality();
|
2012-07-04 17:56:22 +00:00
|
|
|
SetLocalProfileInt("Setup", "TextureQuality", iValue);
|
2012-06-26 20:23:05 +00:00
|
|
|
|
2012-09-15 19:47:19 +00:00
|
|
|
iValue = m_sound->GetAudioVolume();
|
2012-07-04 17:56:22 +00:00
|
|
|
SetLocalProfileInt("Setup", "AudioVolume", iValue);
|
2012-06-26 20:23:05 +00:00
|
|
|
|
2012-09-15 19:47:19 +00:00
|
|
|
iValue = m_sound->GetMidiVolume();
|
2012-07-04 17:56:22 +00:00
|
|
|
SetLocalProfileInt("Setup", "MidiVolume", iValue);
|
2012-06-26 20:23:05 +00:00
|
|
|
|
2012-09-15 19:47:19 +00:00
|
|
|
iValue = m_sound->GetSound3D();
|
2012-07-04 17:56:22 +00:00
|
|
|
SetLocalProfileInt("Setup", "Sound3D", iValue);
|
2012-06-26 20:23:05 +00:00
|
|
|
|
2012-09-15 19:47:19 +00:00
|
|
|
iValue = m_engine->GetEditIndentMode();
|
2012-07-04 17:56:22 +00:00
|
|
|
SetLocalProfileInt("Setup", "EditIndentMode", iValue);
|
2012-06-26 20:23:05 +00:00
|
|
|
|
2012-09-15 19:47:19 +00:00
|
|
|
iValue = m_engine->GetEditIndentValue();
|
|
|
|
SetLocalProfileInt("Setup", "EditIndentValue", iValue);*/
|
2012-06-26 20:23:05 +00:00
|
|
|
|
2012-09-15 19:47:19 +00:00
|
|
|
/* key[0] = 0;
|
2012-06-26 20:23:05 +00:00
|
|
|
for ( i=0 ; i<100 ; i++ )
|
|
|
|
{
|
2012-09-15 19:47:19 +00:00
|
|
|
if ( m_engine->GetKey(i, 0) == 0 ) break;
|
2012-06-26 20:23:05 +00:00
|
|
|
|
|
|
|
for ( j=0 ; j<2 ; j++ )
|
|
|
|
{
|
2012-09-15 19:47:19 +00:00
|
|
|
iValue = m_engine->GetKey(i, j);
|
2012-06-26 20:23:05 +00:00
|
|
|
sprintf(num, "%d%c", iValue, j==0?'+':' ');
|
|
|
|
strcat(key, num);
|
|
|
|
}
|
2012-09-15 19:47:19 +00:00
|
|
|
}*/
|
|
|
|
|
|
|
|
/* TODO: profile
|
|
|
|
SetLocalProfileString("Setup", "KeyMap", key); */
|
2012-06-26 20:23:05 +00:00
|
|
|
|
2012-09-15 19:47:19 +00:00
|
|
|
/* TODO: #if _NET
|
2012-06-26 20:23:05 +00:00
|
|
|
if ( m_accessEnable )
|
|
|
|
{
|
|
|
|
iValue = m_accessMission;
|
2012-07-04 17:56:22 +00:00
|
|
|
SetLocalProfileInt("Setup", "AccessMission", iValue);
|
2012-06-26 20:23:05 +00:00
|
|
|
|
|
|
|
iValue = m_accessUser;
|
2012-07-04 17:56:22 +00:00
|
|
|
SetLocalProfileInt("Setup", "AccessUser", iValue);
|
2012-06-26 20:23:05 +00:00
|
|
|
}
|
2012-09-15 19:47:19 +00:00
|
|
|
#endif */
|
2012-06-26 20:23:05 +00:00
|
|
|
|
2012-09-15 19:47:19 +00:00
|
|
|
/* TODO: profile
|
2012-06-26 20:23:05 +00:00
|
|
|
iValue = m_bDeleteGamer;
|
2012-09-15 19:47:19 +00:00
|
|
|
SetLocalProfileInt("Setup", "DeleteGamer", iValue); */
|
2012-06-26 20:23:05 +00:00
|
|
|
|
2012-09-15 19:47:19 +00:00
|
|
|
// TODO: write profile
|
|
|
|
//m_engine->WriteProfile();
|
2012-06-26 20:23:05 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// Remember all the settings.
|
|
|
|
|
|
|
|
void CMainDialog::SetupRecall()
|
|
|
|
{
|
|
|
|
float fValue;
|
|
|
|
int iValue, i, j;
|
|
|
|
char key[500];
|
|
|
|
char* p;
|
|
|
|
|
2012-09-15 19:47:19 +00:00
|
|
|
/* TODO: profile
|
|
|
|
if ( GetLocalProfileString("Directory", "scene", key, MAX_FNAME) )
|
2012-06-26 20:23:05 +00:00
|
|
|
{
|
|
|
|
strcpy(m_sceneDir, key);
|
|
|
|
}
|
|
|
|
|
2012-09-15 19:47:19 +00:00
|
|
|
if ( GetLocalProfileString("Directory", "savegame", key, MAX_FNAME) )
|
2012-06-26 20:23:05 +00:00
|
|
|
{
|
|
|
|
strcpy(m_savegameDir, key);
|
|
|
|
}
|
|
|
|
|
2012-09-15 19:47:19 +00:00
|
|
|
if ( GetLocalProfileString("Directory", "public", key, MAX_FNAME) )
|
2012-06-26 20:23:05 +00:00
|
|
|
{
|
|
|
|
strcpy(m_publicDir, key);
|
|
|
|
}
|
|
|
|
|
2012-09-15 19:47:19 +00:00
|
|
|
if ( GetLocalProfileString("Directory", "user", key, MAX_FNAME) )
|
2012-06-26 20:23:05 +00:00
|
|
|
{
|
|
|
|
strcpy(m_userDir, key);
|
|
|
|
}
|
|
|
|
|
2012-09-15 19:47:19 +00:00
|
|
|
if ( GetLocalProfileString("Directory", "files", key, MAX_FNAME) )
|
2012-06-26 20:23:05 +00:00
|
|
|
{
|
|
|
|
strcpy(m_filesDir, key);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2012-07-04 17:56:22 +00:00
|
|
|
if ( GetLocalProfileInt("Setup", "TotoMode", iValue) )
|
2012-06-26 20:23:05 +00:00
|
|
|
{
|
|
|
|
m_engine->SetTotoMode(iValue);
|
|
|
|
}
|
|
|
|
|
2012-07-04 17:56:22 +00:00
|
|
|
if ( GetLocalProfileInt("Setup", "Tooltips", iValue) )
|
2012-06-26 20:23:05 +00:00
|
|
|
{
|
|
|
|
m_bTooltip = iValue;
|
|
|
|
}
|
|
|
|
|
2012-07-04 17:56:22 +00:00
|
|
|
if ( GetLocalProfileInt("Setup", "InterfaceGlint", iValue) )
|
2012-06-26 20:23:05 +00:00
|
|
|
{
|
|
|
|
m_bGlint = iValue;
|
|
|
|
}
|
|
|
|
|
2012-07-04 17:56:22 +00:00
|
|
|
if ( GetLocalProfileInt("Setup", "InterfaceGlint", iValue) )
|
2012-06-26 20:23:05 +00:00
|
|
|
{
|
|
|
|
m_bRain = iValue;
|
|
|
|
}
|
|
|
|
|
2012-07-04 17:56:22 +00:00
|
|
|
if ( GetLocalProfileInt("Setup", "NiceMouse", iValue) )
|
2012-06-26 20:23:05 +00:00
|
|
|
{
|
|
|
|
m_engine->SetNiceMouse(iValue);
|
|
|
|
}
|
|
|
|
|
2012-07-04 17:56:22 +00:00
|
|
|
if ( GetLocalProfileInt("Setup", "Soluce4", iValue) )
|
2012-06-26 20:23:05 +00:00
|
|
|
{
|
|
|
|
m_bSoluce4 = iValue;
|
|
|
|
}
|
|
|
|
|
2012-07-04 17:56:22 +00:00
|
|
|
if ( GetLocalProfileInt("Setup", "Movies", iValue) )
|
2012-06-26 20:23:05 +00:00
|
|
|
{
|
|
|
|
m_bMovies = iValue;
|
|
|
|
}
|
|
|
|
|
2012-07-04 17:56:22 +00:00
|
|
|
if ( GetLocalProfileInt("Setup", "NiceReset", iValue) )
|
2012-06-26 20:23:05 +00:00
|
|
|
{
|
|
|
|
m_bNiceReset = iValue;
|
|
|
|
}
|
|
|
|
|
2012-07-04 17:56:22 +00:00
|
|
|
if ( GetLocalProfileInt("Setup", "HimselfDamage", iValue) )
|
2012-06-26 20:23:05 +00:00
|
|
|
{
|
|
|
|
m_bHimselfDamage = iValue;
|
|
|
|
}
|
|
|
|
|
2012-07-04 17:56:22 +00:00
|
|
|
if ( GetLocalProfileInt("Setup", "CameraScroll", iValue) )
|
2012-06-26 20:23:05 +00:00
|
|
|
{
|
|
|
|
m_bCameraScroll = iValue;
|
|
|
|
m_camera->SetCameraScroll(m_bCameraScroll);
|
|
|
|
}
|
|
|
|
|
2012-07-04 17:56:22 +00:00
|
|
|
if ( GetLocalProfileInt("Setup", "CameraInvertX", iValue) )
|
2012-06-26 20:23:05 +00:00
|
|
|
{
|
|
|
|
m_bCameraInvertX = iValue;
|
|
|
|
m_camera->SetCameraInvertX(m_bCameraInvertX);
|
|
|
|
}
|
|
|
|
|
2012-07-04 17:56:22 +00:00
|
|
|
if ( GetLocalProfileInt("Setup", "CameraInvertY", iValue) )
|
2012-06-26 20:23:05 +00:00
|
|
|
{
|
|
|
|
m_bCameraInvertY = iValue;
|
|
|
|
m_camera->SetCameraInvertY(m_bCameraInvertY);
|
|
|
|
}
|
|
|
|
|
2012-07-04 17:56:22 +00:00
|
|
|
if ( GetLocalProfileInt("Setup", "InterfaceEffect", iValue) )
|
2012-06-26 20:23:05 +00:00
|
|
|
{
|
|
|
|
m_bEffect = iValue;
|
|
|
|
}
|
|
|
|
|
2012-07-04 17:56:22 +00:00
|
|
|
if ( GetLocalProfileInt("Setup", "GroundShadow", iValue) )
|
2012-06-26 20:23:05 +00:00
|
|
|
{
|
|
|
|
m_engine->SetShadow(iValue);
|
|
|
|
}
|
|
|
|
|
2012-07-04 17:56:22 +00:00
|
|
|
if ( GetLocalProfileInt("Setup", "GroundSpot", iValue) )
|
2012-06-26 20:23:05 +00:00
|
|
|
{
|
|
|
|
m_engine->SetGroundSpot(iValue);
|
|
|
|
}
|
|
|
|
|
2012-07-04 17:56:22 +00:00
|
|
|
if ( GetLocalProfileInt("Setup", "ObjectDirty", iValue) )
|
2012-06-26 20:23:05 +00:00
|
|
|
{
|
|
|
|
m_engine->SetDirty(iValue);
|
|
|
|
}
|
|
|
|
|
2012-07-04 17:56:22 +00:00
|
|
|
if ( GetLocalProfileInt("Setup", "FogMode", iValue) )
|
2012-06-26 20:23:05 +00:00
|
|
|
{
|
|
|
|
m_engine->SetFog(iValue);
|
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
|
|
|
}
|
|
|
|
|
2012-07-04 17:56:22 +00:00
|
|
|
if ( GetLocalProfileInt("Setup", "LensMode", iValue) )
|
2012-06-26 20:23:05 +00:00
|
|
|
{
|
|
|
|
m_engine->SetLensMode(iValue);
|
|
|
|
}
|
|
|
|
|
2012-07-04 17:56:22 +00:00
|
|
|
if ( GetLocalProfileInt("Setup", "SkyMode", iValue) )
|
2012-06-26 20:23:05 +00:00
|
|
|
{
|
|
|
|
m_engine->SetSkyMode(iValue);
|
|
|
|
}
|
|
|
|
|
2012-07-04 17:56:22 +00:00
|
|
|
if ( GetLocalProfileInt("Setup", "PlanetMode", iValue) )
|
2012-06-26 20:23:05 +00:00
|
|
|
{
|
|
|
|
m_engine->SetPlanetMode(iValue);
|
|
|
|
}
|
|
|
|
|
2012-07-04 17:56:22 +00:00
|
|
|
if ( GetLocalProfileInt("Setup", "LightMode", iValue) )
|
2012-06-26 20:23:05 +00:00
|
|
|
{
|
|
|
|
m_engine->SetLightMode(iValue);
|
|
|
|
}
|
|
|
|
|
2012-07-04 17:56:22 +00:00
|
|
|
if ( GetLocalProfileInt("Setup", "UseJoystick", iValue) )
|
2012-06-26 20:23:05 +00:00
|
|
|
{
|
|
|
|
m_engine->SetJoystick(iValue);
|
|
|
|
}
|
|
|
|
|
2012-09-15 19:47:19 +00:00
|
|
|
if ( GetLocalProfileFloat("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
|
|
|
}
|
|
|
|
|
2012-07-04 17:56:22 +00:00
|
|
|
if ( GetLocalProfileFloat("Setup", "ClippingDistance", fValue) )
|
2012-06-26 20:23:05 +00:00
|
|
|
{
|
|
|
|
m_engine->SetClippingDistance(fValue);
|
|
|
|
}
|
|
|
|
|
2012-07-04 17:56:22 +00:00
|
|
|
if ( GetLocalProfileFloat("Setup", "ObjectDetail", fValue) )
|
2012-06-26 20:23:05 +00:00
|
|
|
{
|
|
|
|
m_engine->SetObjectDetail(fValue);
|
|
|
|
}
|
|
|
|
|
2012-07-04 17:56:22 +00:00
|
|
|
if ( GetLocalProfileFloat("Setup", "GadgetQuantity", fValue) )
|
2012-06-26 20:23:05 +00:00
|
|
|
{
|
|
|
|
m_engine->SetGadgetQuantity(fValue);
|
|
|
|
}
|
|
|
|
|
2012-07-04 17:56:22 +00:00
|
|
|
if ( GetLocalProfileInt("Setup", "TextureQuality", iValue) )
|
2012-06-26 20:23:05 +00:00
|
|
|
{
|
|
|
|
m_engine->SetTextureQuality(iValue);
|
|
|
|
}
|
|
|
|
|
2012-07-04 17:56:22 +00:00
|
|
|
if ( GetLocalProfileInt("Setup", "AudioVolume", iValue) )
|
2012-06-26 20:23:05 +00:00
|
|
|
{
|
|
|
|
m_sound->SetAudioVolume(iValue);
|
|
|
|
}
|
|
|
|
|
2012-07-04 17:56:22 +00:00
|
|
|
if ( GetLocalProfileInt("Setup", "MidiVolume", iValue) )
|
2012-06-26 20:23:05 +00:00
|
|
|
{
|
|
|
|
m_sound->SetMidiVolume(iValue);
|
|
|
|
}
|
|
|
|
|
2012-07-04 17:56:22 +00:00
|
|
|
if ( GetLocalProfileInt("Setup", "EditIndentMode", iValue) )
|
2012-06-26 20:23:05 +00:00
|
|
|
{
|
|
|
|
m_engine->SetEditIndentMode(iValue);
|
|
|
|
}
|
|
|
|
|
2012-07-04 17:56:22 +00:00
|
|
|
if ( GetLocalProfileInt("Setup", "EditIndentValue", iValue) )
|
2012-06-26 20:23:05 +00:00
|
|
|
{
|
|
|
|
m_engine->SetEditIndentValue(iValue);
|
|
|
|
}
|
|
|
|
|
2012-07-04 17:56:22 +00:00
|
|
|
if ( GetLocalProfileString("Setup", "KeyMap", key, 500) )
|
2012-06-26 20:23:05 +00:00
|
|
|
{
|
|
|
|
p = key;
|
|
|
|
for ( i=0 ; i<100 ; i++ )
|
|
|
|
{
|
|
|
|
if ( p[0] == 0 ) break;
|
|
|
|
|
|
|
|
for ( j=0 ; j<2 ; j++ )
|
|
|
|
{
|
|
|
|
sscanf(p, "%d", &iValue);
|
|
|
|
m_engine->SetKey(i, j, iValue);
|
|
|
|
while ( *p >= '0' && *p <= '9' ) p++;
|
|
|
|
while ( *p == ' ' || *p == '+' ) p++;
|
|
|
|
}
|
|
|
|
}
|
2012-09-15 19:47:19 +00:00
|
|
|
} */
|
2012-06-26 20:23:05 +00:00
|
|
|
|
2012-09-15 19:47:19 +00:00
|
|
|
/* TODO: #if _NET
|
2012-06-26 20:23:05 +00:00
|
|
|
if ( m_accessEnable )
|
|
|
|
{
|
2012-07-04 17:56:22 +00:00
|
|
|
if ( GetLocalProfileInt("Setup", "AccessMission", iValue) )
|
2012-06-26 20:23:05 +00:00
|
|
|
{
|
|
|
|
m_accessMission = iValue;
|
|
|
|
}
|
|
|
|
|
2012-07-04 17:56:22 +00:00
|
|
|
if ( GetLocalProfileInt("Setup", "AccessUser", iValue) )
|
2012-06-26 20:23:05 +00:00
|
|
|
{
|
|
|
|
m_accessUser = iValue;
|
|
|
|
}
|
|
|
|
}
|
2012-09-15 19:47:19 +00:00
|
|
|
#endif */
|
2012-06-26 20:23:05 +00:00
|
|
|
|
2012-09-15 19:47:19 +00:00
|
|
|
/* TODO: profile
|
2012-07-04 17:56:22 +00:00
|
|
|
if ( GetLocalProfileInt("Setup", "DeleteGamer", iValue) )
|
2012-06-26 20:23:05 +00:00
|
|
|
{
|
|
|
|
m_bDeleteGamer = iValue;
|
2012-09-15 19:47:19 +00:00
|
|
|
} */
|
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
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// Redefinable keys:
|
|
|
|
|
|
|
|
static int key_table[KEY_TOTAL] =
|
|
|
|
{
|
2012-09-15 19:47:19 +00:00
|
|
|
/* TODO: #if _SCHOOL & _TEEN
|
2012-06-26 20:23:05 +00:00
|
|
|
KEYRANK_LEFT,
|
|
|
|
KEYRANK_RIGHT,
|
|
|
|
KEYRANK_UP,
|
|
|
|
KEYRANK_DOWN,
|
|
|
|
KEYRANK_CAMERA,
|
|
|
|
KEYRANK_NEAR,
|
|
|
|
KEYRANK_AWAY,
|
|
|
|
KEYRANK_HELP,
|
|
|
|
KEYRANK_PROG,
|
|
|
|
KEYRANK_SPEED10,
|
|
|
|
KEYRANK_SPEED15,
|
|
|
|
KEYRANK_SPEED20,
|
|
|
|
KEYRANK_QUIT,
|
2012-09-15 19:47:19 +00:00
|
|
|
#else */
|
2012-06-26 20:23:05 +00:00
|
|
|
KEYRANK_LEFT,
|
|
|
|
KEYRANK_RIGHT,
|
|
|
|
KEYRANK_UP,
|
|
|
|
KEYRANK_DOWN,
|
|
|
|
KEYRANK_GUP,
|
|
|
|
KEYRANK_GDOWN,
|
|
|
|
KEYRANK_ACTION,
|
|
|
|
KEYRANK_CAMERA,
|
|
|
|
KEYRANK_VISIT,
|
|
|
|
KEYRANK_NEXT,
|
|
|
|
KEYRANK_HUMAN,
|
|
|
|
KEYRANK_DESEL,
|
|
|
|
KEYRANK_NEAR,
|
|
|
|
KEYRANK_AWAY,
|
|
|
|
KEYRANK_HELP,
|
|
|
|
KEYRANK_PROG,
|
|
|
|
KEYRANK_CBOT,
|
|
|
|
KEYRANK_SPEED10,
|
|
|
|
KEYRANK_SPEED15,
|
|
|
|
KEYRANK_SPEED20,
|
|
|
|
KEYRANK_QUIT,
|
2012-09-15 19:47:19 +00:00
|
|
|
// #endif
|
2012-06-26 20:23:05 +00:00
|
|
|
};
|
|
|
|
|
2012-09-15 19:47:19 +00:00
|
|
|
static EventType key_event[KEY_TOTAL] =
|
2012-06-26 20:23:05 +00:00
|
|
|
{
|
2012-09-15 19:47:19 +00:00
|
|
|
/* TODO: #if _SCHOOL & _TEEN
|
2012-06-26 20:23:05 +00:00
|
|
|
EVENT_INTERFACE_KLEFT,
|
|
|
|
EVENT_INTERFACE_KRIGHT,
|
|
|
|
EVENT_INTERFACE_KUP,
|
|
|
|
EVENT_INTERFACE_KDOWN,
|
|
|
|
EVENT_INTERFACE_KCAMERA,
|
|
|
|
EVENT_INTERFACE_KNEAR,
|
|
|
|
EVENT_INTERFACE_KAWAY,
|
|
|
|
EVENT_INTERFACE_KHELP,
|
|
|
|
EVENT_INTERFACE_KPROG,
|
|
|
|
EVENT_INTERFACE_KSPEED10,
|
|
|
|
EVENT_INTERFACE_KSPEED15,
|
|
|
|
EVENT_INTERFACE_KSPEED20,
|
|
|
|
EVENT_INTERFACE_KQUIT,
|
2012-09-15 19:47:19 +00:00
|
|
|
#else */
|
2012-06-26 20:23:05 +00:00
|
|
|
EVENT_INTERFACE_KLEFT,
|
|
|
|
EVENT_INTERFACE_KRIGHT,
|
|
|
|
EVENT_INTERFACE_KUP,
|
|
|
|
EVENT_INTERFACE_KDOWN,
|
|
|
|
EVENT_INTERFACE_KGUP,
|
|
|
|
EVENT_INTERFACE_KGDOWN,
|
|
|
|
EVENT_INTERFACE_KACTION,
|
|
|
|
EVENT_INTERFACE_KCAMERA,
|
|
|
|
EVENT_INTERFACE_KVISIT,
|
|
|
|
EVENT_INTERFACE_KNEXT,
|
|
|
|
EVENT_INTERFACE_KHUMAN,
|
|
|
|
EVENT_INTERFACE_KDESEL,
|
|
|
|
EVENT_INTERFACE_KNEAR,
|
|
|
|
EVENT_INTERFACE_KAWAY,
|
|
|
|
EVENT_INTERFACE_KHELP,
|
|
|
|
EVENT_INTERFACE_KPROG,
|
|
|
|
EVENT_INTERFACE_KCBOT,
|
|
|
|
EVENT_INTERFACE_KSPEED10,
|
|
|
|
EVENT_INTERFACE_KSPEED15,
|
|
|
|
EVENT_INTERFACE_KSPEED20,
|
|
|
|
EVENT_INTERFACE_KQUIT,
|
2012-09-15 19:47:19 +00:00
|
|
|
//#endif
|
2012-06-26 20:23:05 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
// Updates the list of keys.
|
|
|
|
|
|
|
|
void CMainDialog::UpdateKey()
|
|
|
|
{
|
|
|
|
CWindow* pw;
|
|
|
|
CScroll* ps;
|
|
|
|
CKey* pk;
|
|
|
|
Math::Point pos, dim;
|
|
|
|
int first, i;
|
|
|
|
|
|
|
|
pw = (CWindow*)m_interface->SearchControl(EVENT_WINDOW5);
|
|
|
|
if ( pw == 0 ) return;
|
|
|
|
|
|
|
|
ps = (CScroll*)pw->SearchControl(EVENT_INTERFACE_KSCROLL);
|
|
|
|
if ( ps == 0 ) return;
|
|
|
|
|
2012-09-15 19:47:19 +00:00
|
|
|
first = (int)(ps->GetVisibleValue()*(KEY_TOTAL-KEY_VISIBLE));
|
2012-06-26 20:23:05 +00:00
|
|
|
|
|
|
|
for ( i=0 ; i<KEY_TOTAL ; i++ )
|
|
|
|
{
|
|
|
|
pw->DeleteControl(key_event[i]);
|
|
|
|
}
|
|
|
|
|
|
|
|
dim.x = 400.0f/640.0f;
|
|
|
|
dim.y = 20.0f/480.0f;
|
|
|
|
pos.x = 110.0f/640.0f;
|
|
|
|
pos.y = 168.0f/480.0f + dim.y*(KEY_VISIBLE-1);
|
|
|
|
for ( i=0 ; i<KEY_VISIBLE ; i++ )
|
|
|
|
{
|
|
|
|
pw->CreateKey(pos, dim, -1, key_event[first+i]);
|
|
|
|
pk = (CKey*)pw->SearchControl(key_event[first+i]);
|
|
|
|
if ( pk == 0 ) break;
|
2012-09-15 19:47:19 +00:00
|
|
|
/* TODO: set input bindings
|
|
|
|
pk->SetKey(0, m_engine->GetKey(key_table[first+i], 0));
|
|
|
|
pk->SetKey(1, m_engine->GetKey(key_table[first+i], 1)); */
|
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
|
|
|
{
|
|
|
|
CWindow* pw;
|
|
|
|
CScroll* ps;
|
|
|
|
CKey* pk;
|
|
|
|
int i;
|
|
|
|
|
|
|
|
pw = (CWindow*)m_interface->SearchControl(EVENT_WINDOW5);
|
|
|
|
if ( pw == 0 ) return;
|
|
|
|
|
|
|
|
ps = (CScroll*)pw->SearchControl(EVENT_INTERFACE_KSCROLL);
|
|
|
|
if ( ps == 0 ) return;
|
|
|
|
|
|
|
|
for ( i=0 ; i<KEY_TOTAL ; i++ )
|
|
|
|
{
|
|
|
|
if ( key_event[i] == event )
|
|
|
|
{
|
|
|
|
pk = (CKey*)pw->SearchControl(key_event[i]);
|
|
|
|
if ( pk == 0 ) break;
|
2012-09-15 19:47:19 +00:00
|
|
|
/* TODO: set key binding
|
|
|
|
m_engine->SetKey(key_table[i], 0, pk->GetKey(0));
|
|
|
|
m_engine->SetKey(key_table[i], 1, pk->GetKey(1)); */
|
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;
|
|
|
|
char name[100];
|
|
|
|
|
|
|
|
StartDialog(Math::Point(0.3f, 0.8f), true, false, false);
|
|
|
|
m_bDialogDelete = false;
|
|
|
|
|
|
|
|
pw = (CWindow*)m_interface->SearchControl(EVENT_WINDOW9);
|
|
|
|
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;
|
2012-09-15 19:47:19 +00:00
|
|
|
/* TODO: #if _POLISH
|
2012-06-26 20:23:05 +00:00
|
|
|
pos.x -= 7.0f/640.0f;
|
|
|
|
dim.x += 14.0f/640.0f;
|
2012-09-15 19:47:19 +00:00
|
|
|
#endif*/
|
2012-06-26 20:23:05 +00:00
|
|
|
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);
|
|
|
|
|
|
|
|
if ( m_index == 2 || // missions ?
|
|
|
|
m_index == 3 || // free games?
|
|
|
|
m_index == 4 ) // user ?
|
|
|
|
{
|
|
|
|
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-15 19:47:19 +00:00
|
|
|
/* TODO: setup mode?
|
|
|
|
if ( m_engine->GetSetupMode() )
|
2012-06-26 20:23:05 +00:00
|
|
|
{
|
|
|
|
pos.y = 0.39f;
|
|
|
|
pb = pw->CreateButton(pos, dim, -1, EVENT_INTERFACE_SETUP);
|
|
|
|
pb->SetState(STATE_SHADOW);
|
2012-09-15 19:47:19 +00:00
|
|
|
}*/
|
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;
|
|
|
|
char name[100];
|
|
|
|
|
|
|
|
StartDialog(Math::Point(0.7f, 0.3f), false, true, true);
|
|
|
|
m_bDialogDelete = true;
|
|
|
|
|
|
|
|
pw = (CWindow*)m_interface->SearchControl(EVENT_WINDOW9);
|
|
|
|
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);
|
|
|
|
|
|
|
|
pb = (CButton*)pw->SearchControl(EVENT_DIALOG_OK);
|
|
|
|
if ( pb == 0 ) return;
|
|
|
|
GetResource(RES_TEXT, RT_DIALOG_YESDEL, name);
|
|
|
|
pb->SetName(name);
|
|
|
|
pb->SetState(STATE_WARNING);
|
|
|
|
|
|
|
|
pb = (CButton*)pw->SearchControl(EVENT_DIALOG_CANCEL);
|
|
|
|
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;
|
|
|
|
char name[100];
|
|
|
|
char text[100];
|
|
|
|
|
|
|
|
StartDialog(Math::Point(0.7f, 0.3f), false, true, true);
|
|
|
|
m_bDialogDelete = true;
|
|
|
|
|
|
|
|
pw = (CWindow*)m_interface->SearchControl(EVENT_WINDOW9);
|
|
|
|
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_DELGAME, name);
|
|
|
|
sprintf(text, name, gamer);
|
|
|
|
pw->CreateLabel(pos, dim, -1, EVENT_DIALOG_LABEL, text);
|
|
|
|
|
|
|
|
pb = (CButton*)pw->SearchControl(EVENT_DIALOG_OK);
|
|
|
|
if ( pb == 0 ) return;
|
|
|
|
GetResource(RES_TEXT, RT_DIALOG_YESDEL, name);
|
|
|
|
pb->SetName(name);
|
|
|
|
pb->SetState(STATE_WARNING);
|
|
|
|
|
|
|
|
pb = (CButton*)pw->SearchControl(EVENT_DIALOG_CANCEL);
|
|
|
|
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;
|
|
|
|
char name[100];
|
|
|
|
|
|
|
|
StartDialog(Math::Point(0.6f, 0.3f), false, true, true);
|
|
|
|
|
|
|
|
pw = (CWindow*)m_interface->SearchControl(EVENT_WINDOW9);
|
|
|
|
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_QUIT, name);
|
|
|
|
pw->CreateLabel(pos, dim, -1, EVENT_DIALOG_LABEL, name);
|
|
|
|
|
|
|
|
pb = (CButton*)pw->SearchControl(EVENT_DIALOG_OK);
|
|
|
|
if ( pb == 0 ) return;
|
|
|
|
GetResource(RES_TEXT, RT_DIALOG_YESQUIT, name);
|
|
|
|
pb->SetName(name);
|
|
|
|
pb->SetState(STATE_WARNING);
|
|
|
|
|
|
|
|
pb = (CButton*)pw->SearchControl(EVENT_DIALOG_CANCEL);
|
|
|
|
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;
|
|
|
|
char name[100];
|
|
|
|
|
|
|
|
StartSuspend();
|
|
|
|
|
|
|
|
pw = (CWindow*)m_interface->SearchControl(EVENT_WINDOW0);
|
|
|
|
if ( pw != 0 ) pw->ClearState(STATE_ENABLE);
|
|
|
|
|
|
|
|
pw = (CWindow*)m_interface->SearchControl(EVENT_WINDOW1);
|
|
|
|
if ( pw != 0 ) pw->ClearState(STATE_ENABLE);
|
|
|
|
|
|
|
|
pw = (CWindow*)m_interface->SearchControl(EVENT_WINDOW2);
|
|
|
|
if ( pw != 0 ) pw->ClearState(STATE_ENABLE);
|
|
|
|
|
|
|
|
pw = (CWindow*)m_interface->SearchControl(EVENT_WINDOW3);
|
|
|
|
if ( pw != 0 ) pw->ClearState(STATE_ENABLE);
|
|
|
|
|
|
|
|
pw = (CWindow*)m_interface->SearchControl(EVENT_WINDOW4);
|
|
|
|
if ( pw != 0 ) pw->ClearState(STATE_ENABLE);
|
|
|
|
|
|
|
|
pw = (CWindow*)m_interface->SearchControl(EVENT_WINDOW5);
|
|
|
|
if ( pw != 0 ) pw->ClearState(STATE_ENABLE);
|
|
|
|
|
|
|
|
pw = (CWindow*)m_interface->SearchControl(EVENT_WINDOW6);
|
|
|
|
if ( pw != 0 ) pw->ClearState(STATE_ENABLE);
|
|
|
|
|
|
|
|
pw = (CWindow*)m_interface->SearchControl(EVENT_WINDOW7);
|
|
|
|
if ( pw != 0 ) pw->ClearState(STATE_ENABLE);
|
|
|
|
|
|
|
|
pw = (CWindow*)m_interface->SearchControl(EVENT_WINDOW8);
|
|
|
|
if ( pw != 0 ) pw->ClearState(STATE_ENABLE);
|
|
|
|
|
|
|
|
pb = (CButton*)m_interface->SearchControl(EVENT_BUTTON_QUIT);
|
|
|
|
if ( pb != 0 )
|
|
|
|
{
|
|
|
|
pb->ClearState(STATE_VISIBLE);
|
|
|
|
}
|
|
|
|
|
|
|
|
m_bDialogFire = bFire;
|
|
|
|
|
|
|
|
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 )
|
|
|
|
{
|
|
|
|
pw = (CWindow*)m_interface->SearchControl(EVENT_WINDOW9);
|
|
|
|
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,
|
|
|
|
(Gfx::ParticleType)(Gfx::PARTILENS1+rand()%3),
|
|
|
|
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,
|
|
|
|
(Gfx::ParticleType)(Gfx::PARTILENS1+rand()%3),
|
|
|
|
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,
|
|
|
|
(Gfx::ParticleType)(Gfx::PARTILENS1+rand()%3),
|
|
|
|
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,
|
|
|
|
(Gfx::ParticleType)(Gfx::PARTILENS1+rand()%3),
|
|
|
|
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;
|
|
|
|
CButton* pb;
|
|
|
|
|
|
|
|
pw = (CWindow*)m_interface->SearchControl(EVENT_WINDOW0);
|
|
|
|
if ( pw != 0 ) pw->SetState(STATE_ENABLE);
|
|
|
|
|
|
|
|
pw = (CWindow*)m_interface->SearchControl(EVENT_WINDOW1);
|
|
|
|
if ( pw != 0 ) pw->SetState(STATE_ENABLE);
|
|
|
|
|
|
|
|
pw = (CWindow*)m_interface->SearchControl(EVENT_WINDOW2);
|
|
|
|
if ( pw != 0 ) pw->SetState(STATE_ENABLE);
|
|
|
|
|
|
|
|
pw = (CWindow*)m_interface->SearchControl(EVENT_WINDOW3);
|
|
|
|
if ( pw != 0 ) pw->SetState(STATE_ENABLE);
|
|
|
|
|
|
|
|
pw = (CWindow*)m_interface->SearchControl(EVENT_WINDOW4);
|
|
|
|
if ( pw != 0 ) pw->SetState(STATE_ENABLE);
|
|
|
|
|
|
|
|
pw = (CWindow*)m_interface->SearchControl(EVENT_WINDOW5);
|
|
|
|
if ( pw != 0 ) pw->SetState(STATE_ENABLE);
|
|
|
|
|
|
|
|
pw = (CWindow*)m_interface->SearchControl(EVENT_WINDOW6);
|
|
|
|
if ( pw != 0 ) pw->SetState(STATE_ENABLE);
|
|
|
|
|
|
|
|
pw = (CWindow*)m_interface->SearchControl(EVENT_WINDOW7);
|
|
|
|
if ( pw != 0 ) pw->SetState(STATE_ENABLE);
|
|
|
|
|
|
|
|
pw = (CWindow*)m_interface->SearchControl(EVENT_WINDOW8);
|
|
|
|
if ( pw != 0 ) pw->SetState(STATE_ENABLE);
|
|
|
|
|
|
|
|
pb = (CButton*)m_interface->SearchControl(EVENT_BUTTON_QUIT);
|
|
|
|
if ( pb != 0 )
|
|
|
|
{
|
|
|
|
pb->SetState(STATE_VISIBLE);
|
|
|
|
}
|
|
|
|
|
|
|
|
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();
|
2012-09-15 19:47:19 +00:00
|
|
|
m_bInitPause = m_engine->GetPause();
|
2012-06-26 20:23:05 +00:00
|
|
|
m_engine->SetPause(true);
|
|
|
|
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();
|
|
|
|
if ( !m_bInitPause ) m_engine->SetPause(false);
|
|
|
|
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.
|
|
|
|
|
|
|
|
void CMainDialog::SetSceneRead(char* name)
|
|
|
|
{
|
|
|
|
strcpy(m_sceneRead, name);
|
|
|
|
}
|
|
|
|
|
2012-09-15 19:47:19 +00:00
|
|
|
// Geturns the name of the scene to read.
|
2012-06-26 20:23:05 +00:00
|
|
|
|
2012-09-15 19:47:19 +00:00
|
|
|
char* CMainDialog::GetSceneRead()
|
2012-06-26 20:23:05 +00:00
|
|
|
{
|
|
|
|
return m_sceneRead;
|
|
|
|
}
|
|
|
|
|
|
|
|
// Specifies the name of the scene to read.
|
|
|
|
|
|
|
|
void CMainDialog::SetStackRead(char* name)
|
|
|
|
{
|
|
|
|
strcpy(m_stackRead, name);
|
|
|
|
}
|
|
|
|
|
2012-09-15 19:47:19 +00:00
|
|
|
// Geturns the name of the scene to read.
|
2012-06-26 20:23:05 +00:00
|
|
|
|
2012-09-15 19:47:19 +00:00
|
|
|
char* CMainDialog::GetStackRead()
|
2012-06-26 20:23:05 +00:00
|
|
|
{
|
|
|
|
return m_stackRead;
|
|
|
|
}
|
|
|
|
|
|
|
|
// Specifies the name of the chosen to play scene.
|
|
|
|
|
|
|
|
void CMainDialog::SetSceneName(char* name)
|
|
|
|
{
|
|
|
|
strcpy(m_sceneName, name);
|
|
|
|
}
|
|
|
|
|
2012-09-15 19:47:19 +00:00
|
|
|
// Geturns the name of the chosen to play scene.
|
2012-06-26 20:23:05 +00:00
|
|
|
|
2012-09-15 19:47:19 +00:00
|
|
|
char* CMainDialog::GetSceneName()
|
2012-06-26 20:23:05 +00:00
|
|
|
{
|
|
|
|
return m_sceneName;
|
|
|
|
}
|
|
|
|
|
|
|
|
// Specifies the rank of the chosen to play scene.
|
|
|
|
|
|
|
|
void CMainDialog::SetSceneRank(int rank)
|
|
|
|
{
|
|
|
|
m_sceneRank = rank;
|
|
|
|
}
|
|
|
|
|
2012-09-15 19:47:19 +00:00
|
|
|
// Geturns the rank of the chosen to play scene.
|
2012-06-26 20:23:05 +00:00
|
|
|
|
2012-09-15 19:47:19 +00:00
|
|
|
int CMainDialog::GetSceneRank()
|
2012-06-26 20:23:05 +00:00
|
|
|
{
|
|
|
|
return m_sceneRank;
|
|
|
|
}
|
|
|
|
|
2012-09-15 19:47:19 +00:00
|
|
|
// Geturns folder name of the scene that user selected to play.
|
2012-06-26 20:23:05 +00:00
|
|
|
|
2012-09-15 19:47:19 +00:00
|
|
|
char* CMainDialog::GetSceneDir()
|
2012-06-26 20:23:05 +00:00
|
|
|
{
|
|
|
|
int i;
|
|
|
|
|
|
|
|
i = (m_sceneRank/100)-1;
|
|
|
|
|
|
|
|
if ( i < 0 || i >= m_userTotal ) return 0;
|
|
|
|
return m_userList[i];
|
|
|
|
}
|
|
|
|
|
|
|
|
// 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-15 19:47:19 +00:00
|
|
|
// Geturns the name of the folder to save.
|
2012-06-26 20:23:05 +00:00
|
|
|
|
2012-09-15 19:47:19 +00:00
|
|
|
char* CMainDialog::GetSavegameDir()
|
2012-06-26 20:23:05 +00:00
|
|
|
{
|
|
|
|
return m_savegameDir;
|
|
|
|
}
|
|
|
|
|
2012-09-15 19:47:19 +00:00
|
|
|
// Geturns the name of public folder.
|
2012-06-26 20:23:05 +00:00
|
|
|
|
2012-09-15 19:47:19 +00:00
|
|
|
char* 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;
|
|
|
|
}
|
|
|
|
|
|
|
|
// IWhether to make an animation in CTaskReset.
|
|
|
|
|
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;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Saves the personalized player.
|
|
|
|
|
|
|
|
void CMainDialog::WriteGamerPerso(char *gamer)
|
|
|
|
{
|
|
|
|
FILE* file;
|
|
|
|
char filename[100];
|
|
|
|
char line[100];
|
|
|
|
|
|
|
|
sprintf(filename, "%s\\%s\\face.gam", m_savegameDir, gamer);
|
|
|
|
file = fopen(filename, "w");
|
|
|
|
if ( file == NULL ) return;
|
|
|
|
|
|
|
|
sprintf(line, "Head face=%d glasses=%d hair=%.2f;%.2f;%.2f;%.2f\n",
|
|
|
|
m_perso.face, m_perso.glasses,
|
|
|
|
m_perso.colorHair.r, m_perso.colorHair.g, m_perso.colorHair.b, m_perso.colorHair.a);
|
|
|
|
fputs(line, file);
|
|
|
|
|
|
|
|
sprintf(line, "Body combi=%.2f;%.2f;%.2f;%.2f band=%.2f;%.2f;%.2f;%.2f\n",
|
|
|
|
m_perso.colorCombi.r, m_perso.colorCombi.g, m_perso.colorCombi.b, m_perso.colorCombi.a,
|
|
|
|
m_perso.colorBand.r, m_perso.colorBand.g, m_perso.colorBand.b, m_perso.colorBand.a);
|
|
|
|
fputs(line, file);
|
|
|
|
|
|
|
|
fclose(file);
|
|
|
|
}
|
|
|
|
|
|
|
|
// Reads the personalized player.
|
|
|
|
|
|
|
|
void CMainDialog::ReadGamerPerso(char *gamer)
|
|
|
|
{
|
|
|
|
FILE* file;
|
|
|
|
char filename[100];
|
|
|
|
char line[100];
|
2012-09-15 19:47:19 +00:00
|
|
|
Gfx::Color color;
|
2012-06-26 20:23:05 +00:00
|
|
|
|
|
|
|
m_perso.face = 0;
|
|
|
|
DefPerso();
|
|
|
|
|
|
|
|
sprintf(filename, "%s\\%s\\face.gam", m_savegameDir, gamer);
|
|
|
|
file = fopen(filename, "r");
|
|
|
|
if ( file == NULL ) return;
|
|
|
|
|
|
|
|
while ( fgets(line, 100, file) != NULL )
|
|
|
|
{
|
|
|
|
if ( Cmd(line, "Head") )
|
|
|
|
{
|
|
|
|
m_perso.face = OpInt(line, "face", 0);
|
|
|
|
m_perso.glasses = OpInt(line, "glasses", 0);
|
|
|
|
|
|
|
|
color.r = 0.0f;
|
|
|
|
color.g = 0.0f;
|
|
|
|
color.b = 0.0f;
|
|
|
|
color.a = 0.0f;
|
2012-09-15 19:47:19 +00:00
|
|
|
m_perso.colorHair = OpColor(line, "hair", color);
|
2012-06-26 20:23:05 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
if ( Cmd(line, "Body") )
|
|
|
|
{
|
|
|
|
color.r = 0.0f;
|
|
|
|
color.g = 0.0f;
|
|
|
|
color.b = 0.0f;
|
|
|
|
color.a = 0.0f;
|
2012-09-15 19:47:19 +00:00
|
|
|
m_perso.colorCombi = OpColor(line, "combi", color);
|
2012-06-26 20:23:05 +00:00
|
|
|
|
|
|
|
color.r = 0.0f;
|
|
|
|
color.g = 0.0f;
|
|
|
|
color.b = 0.0f;
|
|
|
|
color.a = 0.0f;
|
2012-09-15 19:47:19 +00:00
|
|
|
m_perso.colorBand = OpColor(line, "band", color);
|
2012-06-26 20:23:05 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
fclose(file);
|
|
|
|
}
|
|
|
|
|
|
|
|
// Specifies the face of the player.
|
|
|
|
|
|
|
|
void CMainDialog::SetGamerFace(char *gamer, int face)
|
|
|
|
{
|
|
|
|
m_perso.face = face;
|
|
|
|
WriteGamerPerso(gamer);
|
|
|
|
}
|
|
|
|
|
|
|
|
// Gives the face of the player.
|
|
|
|
|
2012-09-15 19:47:19 +00:00
|
|
|
int CMainDialog::GetGamerFace(char *gamer)
|
2012-06-26 20:23:05 +00:00
|
|
|
{
|
|
|
|
ReadGamerPerso(gamer);
|
|
|
|
return m_perso.face;
|
|
|
|
}
|
|
|
|
|
|
|
|
// Gives the face of the player.
|
|
|
|
|
2012-09-15 19:47:19 +00:00
|
|
|
int CMainDialog::GetGamerFace()
|
2012-06-26 20:23:05 +00:00
|
|
|
{
|
|
|
|
return m_perso.face;
|
|
|
|
}
|
|
|
|
|
2012-09-15 19:47:19 +00:00
|
|
|
int CMainDialog::GetGamerGlasses()
|
2012-06-26 20:23:05 +00:00
|
|
|
{
|
|
|
|
return m_perso.glasses;
|
|
|
|
}
|
|
|
|
|
2012-09-15 19:47:19 +00:00
|
|
|
bool CMainDialog::GetGamerOnlyHead()
|
2012-06-26 20:23:05 +00:00
|
|
|
{
|
|
|
|
return (m_phase == PHASE_PERSO && m_persoTab == 0);
|
|
|
|
}
|
|
|
|
|
2012-09-15 19:47:19 +00:00
|
|
|
float CMainDialog::GetPersoAngle()
|
2012-06-26 20:23:05 +00:00
|
|
|
{
|
|
|
|
return m_persoAngle;
|
|
|
|
}
|
|
|
|
|
2012-09-15 19:47:19 +00:00
|
|
|
Gfx::Color CMainDialog::GetGamerColorHair()
|
2012-06-26 20:23:05 +00:00
|
|
|
{
|
|
|
|
return m_perso.colorHair;
|
|
|
|
}
|
|
|
|
|
2012-09-15 19:47:19 +00:00
|
|
|
Gfx::Color CMainDialog::GetGamerColorCombi()
|
2012-06-26 20:23:05 +00:00
|
|
|
{
|
|
|
|
return m_perso.colorCombi;
|
|
|
|
}
|
|
|
|
|
2012-09-15 19:47:19 +00:00
|
|
|
Gfx::Color CMainDialog::GetGamerColorBand()
|
2012-06-26 20:23:05 +00:00
|
|
|
{
|
|
|
|
return m_perso.colorBand;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// Reads the file of the player.
|
|
|
|
|
|
|
|
bool CMainDialog::ReadGamerInfo()
|
|
|
|
{
|
|
|
|
FILE* file;
|
|
|
|
char line[100];
|
|
|
|
int chap, i, numTry, passed;
|
|
|
|
|
|
|
|
for ( i=0 ; i<MAXSCENE ; i++ )
|
|
|
|
{
|
|
|
|
m_sceneInfo[i].numTry = 0;
|
|
|
|
m_sceneInfo[i].bPassed = false;
|
|
|
|
}
|
|
|
|
|
2012-09-15 19:47:19 +00:00
|
|
|
sprintf(line, "%s\\%s\\%s.gam", m_savegameDir, m_main->GetGamerName(), m_sceneName);
|
2012-06-26 20:23:05 +00:00
|
|
|
file = fopen(line, "r");
|
|
|
|
if ( file == NULL ) return false;
|
|
|
|
|
|
|
|
if ( fgets(line, 100, file) != NULL )
|
|
|
|
{
|
|
|
|
sscanf(line, "CurrentChapter=%d CurrentSel=%d\n", &chap, &i);
|
|
|
|
m_chap[m_index] = chap-1;
|
|
|
|
m_sel[m_index] = i-1;
|
|
|
|
}
|
|
|
|
|
|
|
|
while ( fgets(line, 100, file) != NULL )
|
|
|
|
{
|
|
|
|
sscanf(line, "Chapter %d: Scene %d: numTry=%d passed=%d\n",
|
|
|
|
&chap, &i, &numTry, &passed);
|
|
|
|
|
|
|
|
i += chap*100;
|
|
|
|
if ( i >= 0 && i < MAXSCENE )
|
|
|
|
{
|
|
|
|
m_sceneInfo[i].numTry = numTry;
|
|
|
|
m_sceneInfo[i].bPassed = passed;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
fclose(file);
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
// Writes the file of the player.
|
|
|
|
|
|
|
|
bool CMainDialog::WriteGamerInfo()
|
|
|
|
{
|
|
|
|
FILE* file;
|
|
|
|
char line[100];
|
|
|
|
int i;
|
|
|
|
|
2012-09-15 19:47:19 +00:00
|
|
|
sprintf(line, "%s\\%s\\%s.gam", m_savegameDir, m_main->GetGamerName(), m_sceneName);
|
2012-06-26 20:23:05 +00:00
|
|
|
file = fopen(line, "w");
|
|
|
|
if ( file == NULL ) return false;
|
|
|
|
|
|
|
|
sprintf(line, "CurrentChapter=%d CurrentSel=%d\n",
|
|
|
|
m_chap[m_index]+1, m_sel[m_index]+1);
|
|
|
|
fputs(line, file);
|
|
|
|
|
|
|
|
for ( i=0 ; i<MAXSCENE ; i++ )
|
|
|
|
{
|
|
|
|
if ( m_sceneInfo[i].numTry == 0 ) continue;
|
|
|
|
|
|
|
|
sprintf(line, "Chapter %d: Scene %d: numTry=%d passed=%d\n",
|
|
|
|
i/100, i%100, m_sceneInfo[i].numTry, m_sceneInfo[i].bPassed);
|
|
|
|
fputs(line, file);
|
|
|
|
}
|
|
|
|
|
|
|
|
fclose(file);
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
void CMainDialog::SetGamerInfoTry(int rank, int numTry)
|
|
|
|
{
|
|
|
|
if ( rank < 0 || rank >= MAXSCENE ) return;
|
|
|
|
if ( numTry > 100 ) numTry = 100;
|
|
|
|
m_sceneInfo[rank].numTry = numTry;
|
|
|
|
}
|
|
|
|
|
2012-09-15 19:47:19 +00:00
|
|
|
int CMainDialog::GetGamerInfoTry(int rank)
|
2012-06-26 20:23:05 +00:00
|
|
|
{
|
|
|
|
if ( rank < 0 || rank >= MAXSCENE ) return 0;
|
|
|
|
return m_sceneInfo[rank].numTry;
|
|
|
|
}
|
|
|
|
|
|
|
|
void CMainDialog::SetGamerInfoPassed(int rank, bool bPassed)
|
|
|
|
{
|
|
|
|
int chap, i;
|
|
|
|
bool bAll;
|
|
|
|
|
|
|
|
if ( rank < 0 || rank >= MAXSCENE ) return;
|
|
|
|
m_sceneInfo[rank].bPassed = bPassed;
|
|
|
|
|
|
|
|
if ( bPassed )
|
|
|
|
{
|
|
|
|
bAll = true;
|
|
|
|
chap = rank/100;
|
|
|
|
for ( i=0 ; i<m_maxList ; i++ )
|
|
|
|
{
|
|
|
|
bAll &= m_sceneInfo[chap*100+i+1].bPassed;
|
|
|
|
}
|
|
|
|
m_sceneInfo[chap*100].numTry ++;
|
|
|
|
m_sceneInfo[chap*100].bPassed = bAll;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2012-09-15 19:47:19 +00:00
|
|
|
bool CMainDialog::GetGamerInfoPassed(int rank)
|
2012-06-26 20:23:05 +00:00
|
|
|
{
|
|
|
|
if ( rank < 0 || rank >= MAXSCENE ) return false;
|
|
|
|
return m_sceneInfo[rank].bPassed;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// Passes to the next mission, and possibly in the next chapter.
|
|
|
|
|
|
|
|
bool CMainDialog::NextMission()
|
|
|
|
{
|
|
|
|
m_sel[m_index] ++; // next mission
|
|
|
|
|
|
|
|
if ( m_sel[m_index] >= m_maxList ) // last mission of the chapter?
|
|
|
|
{
|
|
|
|
m_chap[m_index] ++; // next chapter
|
|
|
|
m_sel[m_index] = 0; // first mission
|
|
|
|
}
|
|
|
|
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2012-09-15 19:47:19 +00:00
|
|
|
} // namespace Ui
|
2012-06-26 20:23:05 +00:00
|
|
|
|