summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorMichał Konopacki <konopacki.m@gmail.com>2012-09-15 16:35:48 +0200
committerMichał Konopacki <konopacki.m@gmail.com>2012-09-15 16:35:48 +0200
commitd439f4fa93eb45175dcdfa773af8f68efa1bad9d (patch)
treea2620bee6aae9ee49726892c5d1ebe717ad88e33 /src
parente57be247c2ddce796fd64e9f3c1b3bfa4759b74a (diff)
parente9fcec9de52471508933c9d90cc6041ce0af9752 (diff)
downloadcolobot-d439f4fa93eb45175dcdfa773af8f68efa1bad9d.tar.gz
colobot-d439f4fa93eb45175dcdfa773af8f68efa1bad9d.tar.bz2
colobot-d439f4fa93eb45175dcdfa773af8f68efa1bad9d.zip
Merge branch 'dev-ui' into dev
Conflicts: src/CMakeLists.txt src/common/misc.cpp src/common/misc.h src/object/robotmain.cpp src/object/robotmain.h src/script/cbottoken.cpp src/script/cbottoken.h src/ui/button.cpp src/ui/button.h src/ui/check.cpp src/ui/check.h src/ui/color.cpp src/ui/color.h src/ui/compass.cpp src/ui/compass.h src/ui/control.cpp src/ui/control.h src/ui/displayinfo.cpp src/ui/displayinfo.h src/ui/displaytext.cpp src/ui/displaytext.h src/ui/edit.cpp src/ui/edit.h src/ui/gauge.cpp src/ui/gauge.h src/ui/interface.cpp src/ui/interface.h src/ui/key.cpp src/ui/map.h src/ui/shortcut.h src/ui/slider.h src/ui/target.cpp src/ui/target.h src/ui/window.cpp src/ui/window.h
Diffstat (limited to 'src')
-rw-r--r--src/CMakeLists.txt7
-rw-r--r--src/common/misc.cpp2
-rw-r--r--src/common/misc.h2
-rw-r--r--src/object/robotmain.cpp744
-rw-r--r--src/object/robotmain.h8
-rw-r--r--src/script/cbottoken.cpp10
-rw-r--r--src/script/cbottoken.h8
-rw-r--r--src/ui/button.cpp22
-rw-r--r--src/ui/button.h45
-rw-r--r--src/ui/check.cpp25
-rw-r--r--src/ui/check.h26
-rw-r--r--src/ui/color.cpp16
-rw-r--r--src/ui/color.h45
-rw-r--r--src/ui/compass.cpp17
-rw-r--r--src/ui/compass.h35
-rw-r--r--src/ui/control.cpp105
-rw-r--r--src/ui/control.h238
-rw-r--r--src/ui/displayinfo.cpp89
-rw-r--r--src/ui/displayinfo.h130
-rw-r--r--src/ui/displaytext.cpp33
-rw-r--r--src/ui/displaytext.h11
-rw-r--r--src/ui/edit.cpp217
-rw-r--r--src/ui/edit.h42
-rw-r--r--src/ui/gauge.cpp14
-rw-r--r--src/ui/gauge.h33
-rw-r--r--src/ui/interface.cpp4
-rw-r--r--src/ui/interface.h43
-rw-r--r--src/ui/key.cpp2
-rw-r--r--src/ui/maindialog.cpp14
-rw-r--r--src/ui/maindialog.h1
-rw-r--r--src/ui/mainmap.cpp185
-rw-r--r--src/ui/mainmap.h72
-rw-r--r--src/ui/mainshort.cpp92
-rw-r--r--src/ui/mainshort.h65
-rw-r--r--src/ui/map.cpp361
-rw-r--r--src/ui/map.h160
-rw-r--r--src/ui/shortcut.cpp66
-rw-r--r--src/ui/shortcut.h5
-rw-r--r--src/ui/slider.h2
-rw-r--r--src/ui/studio.cpp338
-rw-r--r--src/ui/studio.h170
-rw-r--r--src/ui/target.cpp24
-rw-r--r--src/ui/target.h12
-rw-r--r--src/ui/window.cpp84
-rw-r--r--src/ui/window.h35
45 files changed, 1752 insertions, 1907 deletions
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index efc871c..07e487d 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -1,11 +1,14 @@
# CBot shared library is built separately
add_subdirectory(CBot)
+<<<<<<< HEAD
# Tools directory is built separately
add_subdirectory(tools)
# Tests
add_subdirectory(graphics/engine/test)
+=======
+>>>>>>> dev-ui
# Configure options
@@ -156,10 +159,10 @@ graphics/opengl/gldevice.cpp
# ui/check.cpp
# ui/color.cpp
# ui/compass.cpp
-# ui/control.cpp
+ui/control.cpp
# ui/displayinfo.cpp
# ui/displaytext.cpp
-# ui/edit.cpp
+ui/edit.cpp
# ui/editvalue.cpp
# ui/gauge.cpp
# ui/group.cpp
diff --git a/src/common/misc.cpp b/src/common/misc.cpp
index a678f58..747c66d 100644
--- a/src/common/misc.cpp
+++ b/src/common/misc.cpp
@@ -381,7 +381,7 @@ void UserDir(bool bUser, char* dir)
// def = "abc\"
// out: buffer = "abc\toto.txt"
-void UserDir(char* buffer, char* dir, const char* def)
+void UserDir(char* buffer, const char* dir, const char* def)
{
char ddir[100];
char* add;
diff --git a/src/common/misc.h b/src/common/misc.h
index fa478bd..0928acb 100644
--- a/src/common/misc.h
+++ b/src/common/misc.h
@@ -99,7 +99,7 @@ extern bool CopyFileToTemp(char* filename);
extern bool CopyFileListToTemp(char* filename, int* list, int total);
extern void AddExt(char* filename, char* ext);
extern void UserDir(bool bUser, char* dir);
-extern void UserDir(char* buffer, char* dir, const char* def);
+extern void UserDir(char* buffer, const char* dir, const char* def);
extern char GetLanguageLetter();
diff --git a/src/object/robotmain.cpp b/src/object/robotmain.cpp
index 1f2f261..8178ab4 100644
--- a/src/object/robotmain.cpp
+++ b/src/object/robotmain.cpp
@@ -634,7 +634,7 @@ CRobotMain::CRobotMain(CInstanceManager* iMan)
m_displayInfo = 0;
m_engine->SetTerrain(m_terrain);
- m_filesDir = m_dialog->RetFilesDir();
+ m_filesDir = m_dialog->GetFilesDir();
m_time = 0.0f;
m_gameTime = 0.0f;
@@ -657,7 +657,7 @@ CRobotMain::CRobotMain(CInstanceManager* iMan)
m_bEditLock = false;
m_bEditFull = false;
m_bPause = false;
- m_bHilite = false;
+ m_bHighlight = false;
m_bFreePhoto = false;
m_bShowPos = false;
m_bSelectInsect = false;
@@ -869,8 +869,8 @@ void CRobotMain::ChangePhase(Phase phase)
if ( m_gameTime > 10.0f ) // did you play at least 10 seconds?
#endif
{
- rank = m_dialog->RetSceneRank();
- numTry = m_dialog->RetGamerInfoTry(rank);
+ rank = m_dialog->GetSceneRank();
+ numTry = m_dialog->GetGamerInfoTry(rank);
m_dialog->SetGamerInfoTry(rank, numTry+1);
m_dialog->WriteGamerInfo();
}
@@ -878,7 +878,7 @@ void CRobotMain::ChangePhase(Phase phase)
if ( phase == PHASE_WIN ) // wins a simulation?
{
- rank = m_dialog->RetSceneRank();
+ rank = m_dialog->GetSceneRank();
m_dialog->SetGamerInfoPassed(rank, true);
m_dialog->NextMission(); // passes to the next mission
m_dialog->WriteGamerInfo();
@@ -1060,11 +1060,11 @@ void CRobotMain::ChangePhase(Phase phase)
m_engine->FreeTexture("inter01c.tga");
m_engine->FreeTexture("inter01d.tga");
- read = m_dialog->RetSceneRead();
+ read = m_dialog->GetSceneRead();
bLoading = (read[0] != 0);
m_map->CreateMap();
- CreateScene(m_dialog->RetSceneSoluce(), false, false); // interactive scene
+ CreateScene(m_dialog->GetSceneSoluce(), false, false); // interactive scene
if ( m_bMapImage )
{
m_map->SetFixImage(m_mapFilename);
@@ -1116,7 +1116,7 @@ void CRobotMain::ChangePhase(Phase phase)
pe = m_interface->CreateEdit(pos, ddim, 0, EVENT_EDIT0);
pe->SetFontType(FONT_COLOBOT);
pe->SetEditCap(false);
- pe->SetHiliteCap(false);
+ pe->SetHighlightCap(false);
pe->ReadText("help\\teenw.txt");
#else
pos.x = ox+sx*3; pos.y = oy+sy*0.2f;
@@ -1125,7 +1125,7 @@ void CRobotMain::ChangePhase(Phase phase)
pe->SetGenericMode(true);
pe->SetFontType(FONT_COLOBOT);
pe->SetEditCap(false);
- pe->SetHiliteCap(false);
+ pe->SetHighlightCap(false);
pe->ReadText("help\\win.txt");
#endif
}
@@ -1195,7 +1195,7 @@ bool CRobotMain::EventProcess(const Event &event)
{
if ( !m_movie->EventProcess(event) ) // end of the movie?
{
- type = m_movie->RetStopType();
+ type = m_movie->GetStopType();
if ( type == MM_SATCOMopen )
{
ChangePause(false);
@@ -1268,7 +1268,7 @@ bool CRobotMain::EventProcess(const Event &event)
if ( event.event == EVENT_MOUSEMOVE )
{
m_lastMousePos = event.pos;
- HiliteObject(event.pos);
+ HighlightObject(event.pos);
}
return false;
}
@@ -1281,7 +1281,7 @@ bool CRobotMain::EventProcess(const Event &event)
if ( event.event == EVENT_MOUSEMOVE )
{
m_lastMousePos = event.pos;
- HiliteObject(event.pos);
+ HighlightObject(event.pos);
}
if ( m_displayInfo != 0 ) // current info?
@@ -1290,10 +1290,10 @@ bool CRobotMain::EventProcess(const Event &event)
if ( event.event == EVENT_KEYDOWN )
{
- if ( event.param == m_engine->RetKey(KEYRANK_HELP, 0) ||
- event.param == m_engine->RetKey(KEYRANK_HELP, 1) ||
- event.param == m_engine->RetKey(KEYRANK_PROG, 0) ||
- event.param == m_engine->RetKey(KEYRANK_PROG, 1) ||
+ if ( event.param == m_engine->GetKey(KEYRANK_HELP, 0) ||
+ event.param == m_engine->GetKey(KEYRANK_HELP, 1) ||
+ event.param == m_engine->GetKey(KEYRANK_PROG, 0) ||
+ event.param == m_engine->GetKey(KEYRANK_PROG, 1) ||
event.param == VK_ESCAPE )
{
StopDisplayInfo();
@@ -1320,7 +1320,7 @@ bool CRobotMain::EventProcess(const Event &event)
{
case EVENT_KEYDOWN:
KeyCamera(event.event, event.param);
- HiliteClear();
+ HighlightClear();
if ( event.param == VK_F11 )
{
m_particle->WriteWheelTrace("Savegame\\t.bmp", 256, 256, Math::Vector(16.0f, 0.0f, -368.0f), Math::Vector(140.0f, 0.0f, -248.0f));
@@ -1328,14 +1328,14 @@ bool CRobotMain::EventProcess(const Event &event)
}
if ( m_bEditLock ) // current edition?
{
- if ( event.param == m_engine->RetKey(KEYRANK_HELP, 0) ||
- event.param == m_engine->RetKey(KEYRANK_HELP, 1) )
+ if ( event.param == m_engine->GetKey(KEYRANK_HELP, 0) ||
+ event.param == m_engine->GetKey(KEYRANK_HELP, 1) )
{
StartDisplayInfo(SATCOM_HUSTON, false);
return false;
}
- if ( event.param == m_engine->RetKey(KEYRANK_PROG, 0) ||
- event.param == m_engine->RetKey(KEYRANK_PROG, 1) )
+ if ( event.param == m_engine->GetKey(KEYRANK_PROG, 0) ||
+ event.param == m_engine->GetKey(KEYRANK_PROG, 1) )
{
StartDisplayInfo(SATCOM_PROG, false);
return false;
@@ -1344,31 +1344,31 @@ bool CRobotMain::EventProcess(const Event &event)
}
if ( m_bMovieLock ) // current movie?
{
- if ( event.param == m_engine->RetKey(KEYRANK_QUIT, 0) ||
- event.param == m_engine->RetKey(KEYRANK_QUIT, 1) ||
+ if ( event.param == m_engine->GetKey(KEYRANK_QUIT, 0) ||
+ event.param == m_engine->GetKey(KEYRANK_QUIT, 1) ||
event.param == VK_ESCAPE )
{
AbortMovie();
}
return false;
}
- if ( m_camera->RetType() == CAMERA_VISIT )
+ if ( m_camera->GetType() == CAMERA_VISIT )
{
- if ( event.param == m_engine->RetKey(KEYRANK_VISIT, 0) ||
- event.param == m_engine->RetKey(KEYRANK_VISIT, 1) )
+ if ( event.param == m_engine->GetKey(KEYRANK_VISIT, 0) ||
+ event.param == m_engine->GetKey(KEYRANK_VISIT, 1) )
{
StartDisplayVisit(EVENT_NULL);
}
- if ( event.param == m_engine->RetKey(KEYRANK_QUIT, 0) ||
- event.param == m_engine->RetKey(KEYRANK_QUIT, 1) ||
+ if ( event.param == m_engine->GetKey(KEYRANK_QUIT, 0) ||
+ event.param == m_engine->GetKey(KEYRANK_QUIT, 1) ||
event.param == VK_ESCAPE )
{
StopDisplayVisit();
}
return false;
}
- if ( event.param == m_engine->RetKey(KEYRANK_QUIT, 0) ||
- event.param == m_engine->RetKey(KEYRANK_QUIT, 1) )
+ if ( event.param == m_engine->GetKey(KEYRANK_QUIT, 0) ||
+ event.param == m_engine->GetKey(KEYRANK_QUIT, 1) )
{
if ( m_movie->IsExist() )
{
@@ -1390,70 +1390,70 @@ bool CRobotMain::EventProcess(const Event &event)
if ( event.param == VK_PAUSE )
{
if ( !m_bMovieLock && !m_bEditLock && !m_bCmdEdit &&
- m_camera->RetType() != CAMERA_VISIT &&
+ m_camera->GetType() != CAMERA_VISIT &&
!m_movie->IsExist() )
{
- ChangePause(!m_engine->RetPause());
+ ChangePause(!m_engine->GetPause());
}
}
- if ( event.param == m_engine->RetKey(KEYRANK_CAMERA, 0) ||
- event.param == m_engine->RetKey(KEYRANK_CAMERA, 1) )
+ if ( event.param == m_engine->GetKey(KEYRANK_CAMERA, 0) ||
+ event.param == m_engine->GetKey(KEYRANK_CAMERA, 1) )
{
ChangeCamera();
}
- if ( event.param == m_engine->RetKey(KEYRANK_DESEL, 0) ||
- event.param == m_engine->RetKey(KEYRANK_DESEL, 1) )
+ if ( event.param == m_engine->GetKey(KEYRANK_DESEL, 0) ||
+ event.param == m_engine->GetKey(KEYRANK_DESEL, 1) )
{
if ( m_bShortCut )
{
DeselectObject();
}
}
- if ( event.param == m_engine->RetKey(KEYRANK_HUMAN, 0) ||
- event.param == m_engine->RetKey(KEYRANK_HUMAN, 1) )
+ if ( event.param == m_engine->GetKey(KEYRANK_HUMAN, 0) ||
+ event.param == m_engine->GetKey(KEYRANK_HUMAN, 1) )
{
SelectHuman();
}
- if ( event.param == m_engine->RetKey(KEYRANK_NEXT, 0) ||
- event.param == m_engine->RetKey(KEYRANK_NEXT, 1) )
+ if ( event.param == m_engine->GetKey(KEYRANK_NEXT, 0) ||
+ event.param == m_engine->GetKey(KEYRANK_NEXT, 1) )
{
if ( m_bShortCut )
{
m_short->SelectNext();
}
}
- if ( event.param == m_engine->RetKey(KEYRANK_HELP, 0) ||
- event.param == m_engine->RetKey(KEYRANK_HELP, 1) )
+ if ( event.param == m_engine->GetKey(KEYRANK_HELP, 0) ||
+ event.param == m_engine->GetKey(KEYRANK_HELP, 1) )
{
StartDisplayInfo(SATCOM_HUSTON, true);
}
- if ( event.param == m_engine->RetKey(KEYRANK_PROG, 0) ||
- event.param == m_engine->RetKey(KEYRANK_PROG, 1) )
+ if ( event.param == m_engine->GetKey(KEYRANK_PROG, 0) ||
+ event.param == m_engine->GetKey(KEYRANK_PROG, 1) )
{
StartDisplayInfo(SATCOM_PROG, true);
}
- if ( event.param == m_engine->RetKey(KEYRANK_VISIT, 0) ||
- event.param == m_engine->RetKey(KEYRANK_VISIT, 1) )
+ if ( event.param == m_engine->GetKey(KEYRANK_VISIT, 0) ||
+ event.param == m_engine->GetKey(KEYRANK_VISIT, 1) )
{
StartDisplayVisit(EVENT_NULL);
}
- if ( event.param == m_engine->RetKey(KEYRANK_SPEED10, 0) ||
- event.param == m_engine->RetKey(KEYRANK_SPEED10, 1) )
+ if ( event.param == m_engine->GetKey(KEYRANK_SPEED10, 0) ||
+ event.param == m_engine->GetKey(KEYRANK_SPEED10, 1) )
{
SetSpeed(1.0f);
}
- if ( event.param == m_engine->RetKey(KEYRANK_SPEED15, 0) ||
- event.param == m_engine->RetKey(KEYRANK_SPEED15, 1) )
+ if ( event.param == m_engine->GetKey(KEYRANK_SPEED15, 0) ||
+ event.param == m_engine->GetKey(KEYRANK_SPEED15, 1) )
{
SetSpeed(1.5f);
}
- if ( event.param == m_engine->RetKey(KEYRANK_SPEED20, 0) ||
- event.param == m_engine->RetKey(KEYRANK_SPEED20, 1) )
+ if ( event.param == m_engine->GetKey(KEYRANK_SPEED20, 0) ||
+ event.param == m_engine->GetKey(KEYRANK_SPEED20, 1) )
{
SetSpeed(2.0f);
}
- if ( event.param == m_engine->RetKey(KEYRANK_SPEED30, 0) ||
- event.param == m_engine->RetKey(KEYRANK_SPEED30, 1) )
+ if ( event.param == m_engine->GetKey(KEYRANK_SPEED30, 0) ||
+ event.param == m_engine->GetKey(KEYRANK_SPEED30, 1) )
{
SetSpeed(3.0f);
}
@@ -1466,7 +1466,7 @@ bool CRobotMain::EventProcess(const Event &event)
case EVENT_LBUTTONDOWN:
pObj = DetectObject(event.pos);
if ( !m_bShortCut ) pObj = 0;
- if ( pObj != 0 && pObj->RetType() == OBJECT_TOTO )
+ if ( pObj != 0 && pObj->GetType() == OBJECT_TOTO )
{
if ( m_displayInfo != 0 ) // current info?
{
@@ -1803,7 +1803,7 @@ void CRobotMain::ExecuteCmd(char *cmd)
object = RetSelect();
if ( object != 0 )
{
- object->SetMagnifyDamage(object->RetMagnifyDamage()*0.1f);
+ object->SetMagnifyDamage(object->GetMagnifyDamage()*0.1f);
}
return;
}
@@ -1815,7 +1815,7 @@ void CRobotMain::ExecuteCmd(char *cmd)
object = RetSelect();
if ( object != 0 )
{
- object->SetRange(object->RetRange()*10.0f);
+ object->SetRange(object->GetRange()*10.0f);
}
return;
}
@@ -1829,13 +1829,13 @@ void CRobotMain::ExecuteCmd(char *cmd)
object = RetSelect();
if ( object != 0 )
{
- power = object->RetPower();
+ power = object->GetPower();
if ( power != 0 )
{
power->SetEnergy(1.0f);
}
object->SetShield(1.0f);
- physics = object->RetPhysics();
+ physics = object->GetPhysics();
if ( physics != 0 )
{
physics->SetReactorRange(1.0f);
@@ -1852,7 +1852,7 @@ void CRobotMain::ExecuteCmd(char *cmd)
object = RetSelect();
if ( object != 0 )
{
- power = object->RetPower();
+ power = object->GetPower();
if ( power != 0 )
{
power->SetEnergy(1.0f);
@@ -1881,7 +1881,7 @@ void CRobotMain::ExecuteCmd(char *cmd)
object = RetSelect();
if ( object != 0 )
{
- physics = object->RetPhysics();
+ physics = object->GetPhysics();
if ( physics != 0 )
{
physics->SetReactorRange(1.0f);
@@ -1893,55 +1893,55 @@ void CRobotMain::ExecuteCmd(char *cmd)
if ( strcmp(cmd, "debugmode") == 0 )
{
- m_engine->SetDebugMode(!m_engine->RetDebugMode());
+ m_engine->SetDebugMode(!m_engine->GetDebugMode());
return;
}
if ( strcmp(cmd, "showstat") == 0 )
{
- m_engine->SetShowStat(!m_engine->RetShowStat());
+ m_engine->SetShowStat(!m_engine->GetShowStat());
return;
}
if ( strcmp(cmd, "invshadow") == 0 )
{
- m_engine->SetShadow(!m_engine->RetShadow());
+ m_engine->SetShadow(!m_engine->GetShadow());
return;
}
if ( strcmp(cmd, "invdirty") == 0 )
{
- m_engine->SetDirty(!m_engine->RetDirty());
+ m_engine->SetDirty(!m_engine->GetDirty());
return;
}
if ( strcmp(cmd, "invfog") == 0 )
{
- m_engine->SetFog(!m_engine->RetFog());
+ m_engine->SetFog(!m_engine->GetFog());
return;
}
if ( strcmp(cmd, "invlens") == 0 )
{
- m_engine->SetLensMode(!m_engine->RetLensMode());
+ m_engine->SetLensMode(!m_engine->GetLensMode());
return;
}
if ( strcmp(cmd, "invwater") == 0 )
{
- m_engine->SetWaterMode(!m_engine->RetWaterMode());
+ m_engine->SetWaterMode(!m_engine->GetWaterMode());
return;
}
if ( strcmp(cmd, "invsky") == 0 )
{
- m_engine->SetSkyMode(!m_engine->RetSkyMode());
+ m_engine->SetSkyMode(!m_engine->GetSkyMode());
return;
}
if ( strcmp(cmd, "invplanet") == 0 )
{
- m_engine->SetPlanetMode(!m_engine->RetPlanetMode());
+ m_engine->SetPlanetMode(!m_engine->GetPlanetMode());
return;
}
@@ -1991,9 +1991,9 @@ void CRobotMain::ExecuteCmd(char *cmd)
// Returns the type of current movie.
-MainMovieType CRobotMain::RetMainMovie()
+MainMovieType CRobotMain::GetMainMovie()
{
- return m_movie->RetType();
+ return m_movie->GetType();
}
@@ -2024,12 +2024,12 @@ void CRobotMain::StartDisplayInfo(int index, bool bMovie)
if ( m_bCmdEdit || m_bSatComLock ) return;
pObj = RetSelect();
- bHuman = ( pObj != 0 && pObj->RetType() == OBJECT_HUMAN );
+ bHuman = ( pObj != 0 && pObj->GetType() == OBJECT_HUMAN );
if ( !m_bEditLock && bMovie && !m_movie->IsExist() && bHuman )
{
- motion = pObj->RetMotion();
- if ( motion != 0 && motion->RetAction() == -1 )
+ motion = pObj->GetMotion();
+ if ( motion != 0 && motion->GetAction() == -1 )
{
m_movieInfoIndex = index;
m_movie->Start(MM_SATCOMopen, 2.5f);
@@ -2079,7 +2079,7 @@ void CRobotMain::StartDisplayInfo(char *filename, int index)
pb->ClearState(STATE_VISIBLE);
}
- bSoluce = m_dialog->RetSceneSoluce();
+ bSoluce = m_dialog->GetSceneSoluce();
m_displayInfo = new CDisplayInfo(m_iMan);
m_displayInfo->StartDisplayInfo(filename, index, bSoluce);
@@ -2104,7 +2104,7 @@ void CRobotMain::StopDisplayInfo()
if ( m_infoIndex != -1 )
{
- m_infoPos[m_infoIndex] = m_displayInfo->RetPosition();
+ m_infoPos[m_infoIndex] = m_displayInfo->GetPosition();
}
m_displayInfo->StopDisplayInfo();
@@ -2135,14 +2135,14 @@ void CRobotMain::StopDisplayInfo()
// Returns the name of the text display.
-char* CRobotMain::RetDisplayInfoName(int index)
+char* CRobotMain::GetDisplayInfoName(int index)
{
return m_infoFilename[index];
}
// Returns the name of the text display.
-int CRobotMain::RetDisplayInfoPosition(int index)
+int CRobotMain::GetDisplayInfoPosition(int index)
{
return m_infoPos[index];
}
@@ -2196,7 +2196,7 @@ void CRobotMain::StopSuspend()
// Returns the absolute time of the game
-float CRobotMain::RetGameTime()
+float CRobotMain::GetGameTime()
{
return m_gameTime;
}
@@ -2211,7 +2211,7 @@ void CRobotMain::SetFontSize(float size)
SetLocalProfileFloat("Edit", "FontSize", m_fontSize);
}
-float CRobotMain::RetFontSize()
+float CRobotMain::GetFontSize()
{
return m_fontSize;
}
@@ -2225,7 +2225,7 @@ void CRobotMain::SetWindowPos(Math::Point pos)
SetLocalProfileFloat("Edit", "WindowPos.y", m_windowPos.y);
}
-Math::Point CRobotMain::RetWindowPos()
+Math::Point CRobotMain::GetWindowPos()
{
return m_windowPos;
}
@@ -2237,7 +2237,7 @@ void CRobotMain::SetWindowDim(Math::Point dim)
SetLocalProfileFloat("Edit", "WindowDim.y", m_windowDim.y);
}
-Math::Point CRobotMain::RetWindowDim()
+Math::Point CRobotMain::GetWindowDim()
{
return m_windowDim;
}
@@ -2251,7 +2251,7 @@ void CRobotMain::SetIOPublic(bool bMode)
SetLocalProfileInt("Edit", "IOPublic", m_IOPublic);
}
-bool CRobotMain::RetIOPublic()
+bool CRobotMain::GetIOPublic()
{
return m_IOPublic;
}
@@ -2263,7 +2263,7 @@ void CRobotMain::SetIOPos(Math::Point pos)
SetLocalProfileFloat("Edit", "IOPos.y", m_IOPos.y);
}
-Math::Point CRobotMain::RetIOPos()
+Math::Point CRobotMain::GetIOPos()
{
return m_IOPos;
}
@@ -2275,7 +2275,7 @@ void CRobotMain::SetIODim(Math::Point dim)
SetLocalProfileFloat("Edit", "IODim.y", m_IODim.y);
}
-Math::Point CRobotMain::RetIODim()
+Math::Point CRobotMain::GetIODim()
{
return m_IODim;
}
@@ -2336,7 +2336,7 @@ void CRobotMain::StartDisplayVisit(EventMsg event)
ClearInterface(); // removes setting evidence and tooltip
- if ( m_camera->RetType() == CAMERA_VISIT ) // already a current visit?
+ if ( m_camera->GetType() == CAMERA_VISIT ) // already a current visit?
{
m_camera->StopVisit();
m_displayText->ClearVisit();
@@ -2363,12 +2363,12 @@ void CRobotMain::StartDisplayVisit(EventMsg event)
delete m_visitArrow;
m_visitArrow = 0;
}
- goal = m_displayText->RetVisitGoal(event);
+ goal = m_displayText->GetVisitGoal(event);
m_visitArrow = CreateObject(goal, 0.0f, 1.0f, 10.0f, OBJECT_SHOW, false, false, 0);
- m_visitPos = m_visitArrow->RetPosition(0);
+ m_visitPos = m_visitArrow->GetPosition(0);
m_visitPosArrow = m_visitPos;
- m_visitPosArrow.y += m_displayText->RetVisitHeight(event);
+ m_visitPosArrow.y += m_displayText->GetVisitHeight(event);
m_visitArrow->SetPosition(0, m_visitPosArrow);
m_visitTime = 0.0;
@@ -2376,8 +2376,8 @@ void CRobotMain::StartDisplayVisit(EventMsg event)
m_particle->DeleteParticule(PARTISHOW);
- m_camera->StartVisit(m_displayText->RetVisitGoal(event),
- m_displayText->RetVisitDist(event));
+ m_camera->StartVisit(m_displayText->GetVisitGoal(event),
+ m_displayText->GetVisitDist(event));
m_displayText->SetVisit(event);
ChangePause(true);
}
@@ -2407,7 +2407,7 @@ void CRobotMain::FrameVisit(float rTime)
m_visitParticule = 1.5f;
pos = m_visitPos;
- level = m_terrain->RetFloorLevel(pos)+2.0f;
+ level = m_terrain->GetFloorLevel(pos)+2.0f;
if ( pos.y < level ) pos.y = level; // not below the ground
speed = Math::Vector(0.0f, 0.0f, 0.0f);
dim.x = 30.0f;
@@ -2457,7 +2457,7 @@ void CRobotMain::UpdateShortcuts()
// Returns the object that default was select after the creation of a scene.
-CObject* CRobotMain::RetSelectObject()
+CObject* CRobotMain::GetSelectObject()
{
if ( m_selectObject != 0 ) return m_selectObject;
return SearchHuman();
@@ -2477,7 +2477,7 @@ CObject* CRobotMain::DeselectAll()
pObj = (CObject*)m_iMan->SearchInstance(CLASS_OBJECT, i);
if ( pObj == 0 ) break;
- if ( pObj->RetSelect() ) pPrev = pObj;
+ if ( pObj->GetSelect() ) pPrev = pObj;
pObj->SetSelect(false);
}
return pPrev;
@@ -2494,7 +2494,7 @@ void CRobotMain::SelectOneObject(CObject* pObj, bool bDisplayError)
pObj->SetSelect(true, bDisplayError);
m_camera->SetObject(pObj);
- type = pObj->RetType();
+ type = pObj->GetType();
if ( type == OBJECT_HUMAN ||
type == OBJECT_MOBILEfa ||
type == OBJECT_MOBILEta ||
@@ -2524,8 +2524,8 @@ void CRobotMain::SelectOneObject(CObject* pObj, bool bDisplayError)
type == OBJECT_MOBILEdr ||
type == OBJECT_APOLLO2 )
{
- m_camera->SetType(pObj->RetCameraType());
- m_camera->SetDist(pObj->RetCameraDist());
+ m_camera->SetType(pObj->GetCameraType());
+ m_camera->SetDist(pObj->GetCameraDist());
}
else
{
@@ -2535,7 +2535,7 @@ void CRobotMain::SelectOneObject(CObject* pObj, bool bDisplayError)
toto = SearchToto();
if ( toto != 0 )
{
- mt = (CMotionToto*)toto->RetMotion();
+ mt = (CMotionToto*)toto->GetMotion();
if ( mt != 0 )
{
mt->SetLinkType(type);
@@ -2549,7 +2549,7 @@ bool CRobotMain::SelectObject(CObject* pObj, bool bDisplayError)
{
CObject* pPrev;
- if ( m_camera->RetType() == CAMERA_VISIT )
+ if ( m_camera->GetType() == CAMERA_VISIT )
{
StopDisplayVisit();
}
@@ -2666,7 +2666,7 @@ CObject* CRobotMain::SearchHuman()
pObj = (CObject*)m_iMan->SearchInstance(CLASS_OBJECT, i);
if ( pObj == 0 ) break;
- type = pObj->RetType();
+ type = pObj->GetType();
if ( type == OBJECT_HUMAN )
{
return pObj;
@@ -2688,7 +2688,7 @@ CObject* CRobotMain::SearchToto()
pObj = (CObject*)m_iMan->SearchInstance(CLASS_OBJECT, i);
if ( pObj == 0 ) break;
- type = pObj->RetType();
+ type = pObj->GetType();
if ( type == OBJECT_TOTO )
{
return pObj;
@@ -2717,10 +2717,10 @@ CObject* CRobotMain::SearchNearest(Math::Vector pos, CObject* pExclu)
if ( pObj == pExclu ) continue;
if ( !IsSelectable(pObj) ) continue;
- type = pObj->RetType();
+ type = pObj->GetType();
if ( type == OBJECT_TOTO ) continue;
- oPos = pObj->RetPosition(0);
+ oPos = pObj->GetPosition(0);
dist = Math::DistanceProjected(oPos, pos);
if ( dist < min )
{
@@ -2733,7 +2733,7 @@ CObject* CRobotMain::SearchNearest(Math::Vector pos, CObject* pExclu)
// Returns the selected object.
-CObject* CRobotMain::RetSelect()
+CObject* CRobotMain::GetSelect()
{
CObject* pObj;
int i;
@@ -2743,7 +2743,7 @@ CObject* CRobotMain::RetSelect()
pObj = (CObject*)m_iMan->SearchInstance(CLASS_OBJECT, i);
if ( pObj == 0 ) break;
- if ( pObj->RetSelect() )
+ if ( pObj->GetSelect() )
{
return pObj;
}
@@ -2761,7 +2761,7 @@ CObject* CRobotMain::SearchObject(ObjectType type)
pObj = (CObject*)m_iMan->SearchInstance(CLASS_OBJECT, i);
if ( pObj == 0 ) break;
- if ( pObj->RetType() == type )
+ if ( pObj->GetType() == type )
{
return pObj;
}
@@ -2784,11 +2784,11 @@ CObject* CRobotMain::DetectObject(Math::Point pos)
pObj = (CObject*)m_iMan->SearchInstance(CLASS_OBJECT, i);
if ( pObj == 0 ) break;
- if ( !pObj->RetActif() ) continue;
- if ( pObj->RetProxyActivate() ) continue;
+ if ( !pObj->GetActif() ) continue;
+ if ( pObj->GetProxyActivate() ) continue;
pTarget = 0;
- type = pObj->RetType();
+ type = pObj->GetType();
if ( type == OBJECT_PORTICO ||
type == OBJECT_BASE ||
type == OBJECT_DERRICK ||
@@ -2900,9 +2900,9 @@ CObject* CRobotMain::DetectObject(Math::Point pos)
}
else if ( (type == OBJECT_POWER ||
type == OBJECT_ATOMIC ) &&
- pObj->RetTruck() != 0 ) // battery used?
+ pObj->GetTruck() != 0 ) // battery used?
{
- pTarget = pObj->RetTruck();
+ pTarget = pObj->GetTruck();
}
else if ( type == OBJECT_POWER ||
type == OBJECT_ATOMIC )
@@ -2912,7 +2912,7 @@ CObject* CRobotMain::DetectObject(Math::Point pos)
for ( j=0 ; j<OBJECTMAXPART ; j++ )
{
- rank = pObj->RetObjectRank(j);
+ rank = pObj->GetObjectRank(j);
if ( rank == -1 ) continue;
if ( rank != objRank ) continue;
return pTarget;
@@ -2927,9 +2927,9 @@ bool CRobotMain::IsSelectable(CObject* pObj)
{
ObjectType type;
- if ( !pObj->RetSelectable() ) return false;
+ if ( !pObj->GetSelectable() ) return false;
- type = pObj->RetType();
+ type = pObj->GetType();
if ( type == OBJECT_HUMAN ||
type == OBJECT_TOTO ||
type == OBJECT_MOBILEfa ||
@@ -3021,7 +3021,7 @@ bool CRobotMain::DeleteObject()
// Removes setting evidence of the object with the mouse hovers over.
-void CRobotMain::HiliteClear()
+void CRobotMain::HighlightClear()
{
CObject* pObj;
int i;
@@ -3029,27 +3029,27 @@ void CRobotMain::HiliteClear()
ClearTooltip();
m_tooltipName[0] = 0; // really removes the tooltip
- if ( !m_bHilite ) return;
+ if ( !m_bHighlight ) return;
i = -1;
- m_engine->SetHiliteRank(&i); // nothing more selected
+ m_engine->SetHighlightRank(&i); // nothing more selected
for ( i=0 ; i<1000000 ; i++ )
{
pObj = (CObject*)m_iMan->SearchInstance(CLASS_OBJECT, i);
if ( pObj == 0 ) break;
- pObj->SetHilite(false);
- m_map->SetHilite(0);
- m_short->SetHilite(0);
+ pObj->SetHighlight(false);
+ m_map->SetHighlight(0);
+ m_short->SetHighlight(0);
}
- m_bHilite = false;
+ m_bHighlight = false;
}
// Highlights the object with the mouse hovers over.
-void CRobotMain::HiliteObject(Math::Point pos)
+void CRobotMain::HighlightObject(Math::Point pos)
{
CObject* pObj;
char name[100];
@@ -3058,13 +3058,13 @@ void CRobotMain::HiliteObject(Math::Point pos)
if ( m_bFixScene && m_phase != PHASE_PERSO ) return;
if ( m_bMovieLock ) return;
if ( m_movie->IsExist() ) return;
- if ( m_engine->RetMouseHide() ) return;
+ if ( m_engine->GetMouseHide() ) return;
ClearInterface(); // removes setting evidence and tooltip
pObj = m_short->DetectShort(pos);
- if ( m_dialog->RetTooltip() && m_interface->GetTooltip(pos, name) )
+ if ( m_dialog->GetTooltip() && m_interface->GetTooltip(pos, name) )
{
m_tooltipPos = pos;
strcpy(m_tooltipName, name);
@@ -3083,8 +3083,8 @@ void CRobotMain::HiliteObject(Math::Point pos)
pObj = DetectObject(pos);
- if ( m_camera->RetType() == CAMERA_ONBOARD &&
- m_camera->RetObject() == pObj )
+ if ( m_camera->GetType() == CAMERA_ONBOARD &&
+ m_camera->GetObject() == pObj )
{
return;
}
@@ -3093,7 +3093,7 @@ void CRobotMain::HiliteObject(Math::Point pos)
if ( pObj != 0 )
{
- if ( m_dialog->RetTooltip() && pObj->GetTooltipName(name) )
+ if ( m_dialog->GetTooltip() && pObj->GetTooltipName(name) )
{
m_tooltipPos = pos;
strcpy(m_tooltipName, name);
@@ -3102,17 +3102,17 @@ void CRobotMain::HiliteObject(Math::Point pos)
if ( IsSelectable(pObj) )
{
- pObj->SetHilite(true);
- m_map->SetHilite(pObj);
- m_short->SetHilite(pObj);
- m_bHilite = true;
+ pObj->SetHighlight(true);
+ m_map->SetHighlight(pObj);
+ m_short->SetHighlight(pObj);
+ m_bHighlight = true;
}
}
}
// Highlights the object with the mouse hovers over.
-void CRobotMain::HiliteFrame(float rTime)
+void CRobotMain::HighlightFrame(float rTime)
{
if ( m_bFixScene && m_phase != PHASE_PERSO ) return;
if ( m_bMovieLock ) return;
@@ -3139,7 +3139,7 @@ void CRobotMain::CreateTooltip(Math::Point pos, char* text)
corner.x = pos.x+0.022f;
corner.y = pos.y-0.052f;
- m_engine->RetText()->DimText(text, corner, 1,
+ m_engine->GetText()->DimText(text, corner, 1,
SMALLFONT, NORMSTRETCH, FONT_COLOBOT,
start, end);
start.x -= 0.010f;
@@ -3170,7 +3170,7 @@ void CRobotMain::CreateTooltip(Math::Point pos, char* text)
pw->SetState(STATE_SHADOW);
pw->SetTrashEvent(false);
- pos.y -= m_engine->RetText()->RetHeight(SMALLFONT, FONT_COLOBOT)/2.0f;
+ pos.y -= m_engine->GetText()->GetHeight(SMALLFONT, FONT_COLOBOT)/2.0f;
pw->CreateLabel(pos, dim, -1, EVENT_LABEL2, text);
}
}
@@ -3193,7 +3193,7 @@ void CRobotMain::HelpObject()
pObj = RetSelect();
if ( pObj == 0 ) return;
- filename = RetHelpFilename(pObj->RetType());
+ filename = RetHelpFilename(pObj->GetType());
if ( filename[0] == 0 ) return;
StartDisplayInfo(filename, -1);
@@ -3214,12 +3214,12 @@ void CRobotMain::ChangeCamera()
pObj = (CObject*)m_iMan->SearchInstance(CLASS_OBJECT, i);
if ( pObj == 0 ) break;
- if ( pObj->RetSelect() )
+ if ( pObj->GetSelect() )
{
- if ( pObj->RetCameraLock() ) return;
+ if ( pObj->GetCameraLock() ) return;
- oType = pObj->RetType();
- type = pObj->RetCameraType();
+ oType = pObj->GetType();
+ type = pObj->GetCameraType();
if ( oType != OBJECT_MOBILEfa &&
oType != OBJECT_MOBILEta &&
@@ -3255,7 +3255,7 @@ void CRobotMain::ChangeCamera()
if ( type == CAMERA_PLANE ) type = CAMERA_BACK;
else if ( type == CAMERA_BACK ) type = CAMERA_PLANE;
}
- else if ( pObj->RetTrainer() ) // trainer?
+ else if ( pObj->GetTrainer() ) // trainer?
{
if ( type == CAMERA_ONBOARD ) type = CAMERA_FIX;
else if ( type == CAMERA_FIX ) type = CAMERA_PLANE;
@@ -3282,26 +3282,26 @@ void CRobotMain::KeyCamera(EventMsg event, long param)
if ( event == EVENT_KEYUP )
{
- if ( param == m_engine->RetKey(KEYRANK_LEFT, 0) ||
- param == m_engine->RetKey(KEYRANK_LEFT, 1) )
+ if ( param == m_engine->GetKey(KEYRANK_LEFT, 0) ||
+ param == m_engine->GetKey(KEYRANK_LEFT, 1) )
{
m_cameraPan = 0.0f;
}
- if ( param == m_engine->RetKey(KEYRANK_RIGHT, 0) ||
- param == m_engine->RetKey(KEYRANK_RIGHT, 1) )
+ if ( param == m_engine->GetKey(KEYRANK_RIGHT, 0) ||
+ param == m_engine->GetKey(KEYRANK_RIGHT, 1) )
{
m_cameraPan = 0.0f;
}
- if ( param == m_engine->RetKey(KEYRANK_UP, 0) ||
- param == m_engine->RetKey(KEYRANK_UP, 1) )
+ if ( param == m_engine->GetKey(KEYRANK_UP, 0) ||
+ param == m_engine->GetKey(KEYRANK_UP, 1) )
{
m_cameraZoom = 0.0f;
}
- if ( param == m_engine->RetKey(KEYRANK_DOWN, 0) ||
- param == m_engine->RetKey(KEYRANK_DOWN, 1) )
+ if ( param == m_engine->GetKey(KEYRANK_DOWN, 0) ||
+ param == m_engine->GetKey(KEYRANK_DOWN, 1) )
{
m_cameraZoom = 0.0f;
}
@@ -3313,30 +3313,30 @@ void CRobotMain::KeyCamera(EventMsg event, long param)
pObj = RetSelect();
if ( pObj == 0 ) return;
- if ( !pObj->RetTrainer() ) return;
+ if ( !pObj->GetTrainer() ) return;
if ( event == EVENT_KEYDOWN )
{
- if ( param == m_engine->RetKey(KEYRANK_LEFT, 0) ||
- param == m_engine->RetKey(KEYRANK_LEFT, 1) )
+ if ( param == m_engine->GetKey(KEYRANK_LEFT, 0) ||
+ param == m_engine->GetKey(KEYRANK_LEFT, 1) )
{
m_cameraPan = -1.0f;
}
- if ( param == m_engine->RetKey(KEYRANK_RIGHT, 0) ||
- param == m_engine->RetKey(KEYRANK_RIGHT, 1) )
+ if ( param == m_engine->GetKey(KEYRANK_RIGHT, 0) ||
+ param == m_engine->GetKey(KEYRANK_RIGHT, 1) )
{
m_cameraPan = 1.0f;
}
- if ( param == m_engine->RetKey(KEYRANK_UP, 0) ||
- param == m_engine->RetKey(KEYRANK_UP, 1) )
+ if ( param == m_engine->GetKey(KEYRANK_UP, 0) ||
+ param == m_engine->GetKey(KEYRANK_UP, 1) )
{
m_cameraZoom = -1.0f;
}
- if ( param == m_engine->RetKey(KEYRANK_DOWN, 0) ||
- param == m_engine->RetKey(KEYRANK_DOWN, 1) )
+ if ( param == m_engine->GetKey(KEYRANK_DOWN, 0) ||
+ param == m_engine->GetKey(KEYRANK_DOWN, 1) )
{
m_cameraZoom = 1.0f;
}
@@ -3351,14 +3351,14 @@ void CRobotMain::RemoteCamera(float pan, float zoom, float rTime)
if ( pan != 0.0f )
{
- value = m_camera->RetRemotePan();
+ value = m_camera->GetRemotePan();
value += pan*rTime*1.5f;
m_camera->SetRemotePan(value);
}
if ( zoom != 0.0f )
{
- value = m_camera->RetRemoteZoom();
+ value = m_camera->GetRemoteZoom();
value += zoom*rTime*0.3f;
m_camera->SetRemoteZoom(value);
}
@@ -3379,7 +3379,7 @@ void CRobotMain::AbortMovie()
pObj = (CObject*)m_iMan->SearchInstance(CLASS_OBJECT, i);
if ( pObj == 0 ) break;
- automat = pObj->RetAuto();
+ automat = pObj->GetAuto();
if ( automat != 0 )
{
automat->Abort();
@@ -3404,7 +3404,7 @@ void CRobotMain::UpdateInfoText()
pObj = RetSelect();
if ( pObj != 0 )
{
- pos = pObj->RetPosition(0);
+ pos = pObj->GetPosition(0);
sprintf(info, "Pos = %.2f ; %.2f", pos.x/g_unit, pos.z/g_unit);
m_engine->SetInfoText(4, info);
}
@@ -3474,8 +3474,8 @@ bool CRobotMain::EventFrame(const Event &event)
pObj = (CObject*)m_iMan->SearchInstance(CLASS_OBJECT, i);
if ( pObj == 0 ) break;
if ( pm != 0 ) pm->UpdateObject(pObj);
- if ( pObj->RetTruck() != 0 ) continue;
- type = pObj->RetType();
+ if ( pObj->GetTruck() != 0 ) continue;
+ type = pObj->GetType();
if ( type == OBJECT_TOTO )
{
toto = pObj;
@@ -3490,7 +3490,7 @@ bool CRobotMain::EventFrame(const Event &event)
{
pObj = (CObject*)m_iMan->SearchInstance(CLASS_OBJECT, i);
if ( pObj == 0 ) break;
- if ( pObj->RetTruck() == 0 ) continue;
+ if ( pObj->GetTruck() == 0 ) continue;
pObj->EventProcess(event);
}
@@ -3515,9 +3515,9 @@ bool CRobotMain::EventFrame(const Event &event)
{
m_camera->EventProcess(event);
- if ( m_engine->RetFog() )
+ if ( m_engine->GetFog() )
{
- m_camera->SetOverBaseColor(m_particle->RetFogColor(m_engine->RetEyePt()));
+ m_camera->SetOverBaseColor(m_particule->GetFogColor(m_engine->GetEyePt()));
}
}
if ( m_phase == PHASE_PERSO ||
@@ -3541,7 +3541,7 @@ bool CRobotMain::EventFrame(const Event &event)
m_model->EventProcess(event);
}
- HiliteFrame(event.rTime);
+ HighlightFrame(event.rTime);
// Moves the film indicator.
if ( m_bMovieLock && !m_bEditLock ) // movie in progress?
@@ -3605,7 +3605,7 @@ bool CRobotMain::EventFrame(const Event &event)
}
// Will move the arrow to visit.
- if ( m_camera->RetType() == CAMERA_VISIT )
+ if ( m_camera->GetType() == CAMERA_VISIT )
{
FrameVisit(event.rTime);
}
@@ -3738,8 +3738,8 @@ void CRobotMain::Convert()
Math::Vector pos;
float value;
- base = m_dialog->RetSceneName();
- rank = m_dialog->RetSceneRank();
+ base = m_dialog->GetSceneName();
+ rank = m_dialog->GetSceneRank();
m_dialog->BuildSceneName(line, base, rank);
file = fopen(line, "r");
@@ -3951,7 +3951,7 @@ void CRobotMain::ScenePerso()
pObj->SetDrawFront(true); // draws the interface
- mh = (CMotionHuman*)pObj->RetMotion();
+ mh = (CMotionHuman*)pObj->GetMotion();
if ( mh != 0 )
{
mh->StartDisplayPerso();
@@ -3980,10 +3980,10 @@ void CRobotMain::CreateScene(bool bSoluce, bool bFixScene, bool bResetObject)
//? Convert();
- base = m_dialog->RetSceneName();
- rank = m_dialog->RetSceneRank();
- read = m_dialog->RetSceneRead();
- stack = m_dialog->RetStackRead();
+ base = m_dialog->GetSceneName();
+ rank = m_dialog->GetSceneRank();
+ read = m_dialog->GetSceneRead();
+ stack = m_dialog->GetStackRead();
m_dialog->SetUserDir(base, rank);
m_bFixScene = bFixScene;
@@ -4522,7 +4522,7 @@ void CRobotMain::CreateScene(bool bSoluce, bool bFixScene, bool bResetObject)
pObj->SetCheckToken(OpInt(line, "checkToken", 1));
pObj->SetManual(OpInt(line, "manual", 0));
- motion = pObj->RetMotion();
+ motion = pObj->GetMotion();
if ( motion != 0 )
{
p = SearchOp(line, "param");
@@ -4536,7 +4536,7 @@ void CRobotMain::CreateScene(bool bSoluce, bool bFixScene, bool bResetObject)
}
run = -1;
- pBrain = pObj->RetBrain();
+ pBrain = pObj->GetBrain();
if ( pBrain != 0 )
{
for ( i=0 ; i<10 ; i++ )
@@ -4544,7 +4544,7 @@ void CRobotMain::CreateScene(bool bSoluce, bool bFixScene, bool bResetObject)
sprintf(op, "script%d", i+1); // script1..script10
OpString(line, op, name);
#if _SCHOOL
- if ( !m_dialog->RetSoluce4() && i == 3 ) continue;
+ if ( !m_dialog->GetSoluce4() && i == 3 ) continue;
#endif
if ( name[0] != 0 )
{
@@ -4559,7 +4559,7 @@ void CRobotMain::CreateScene(bool bSoluce, bool bFixScene, bool bResetObject)
pBrain->SetScriptRun(run);
}
}
- pAuto = pObj->RetAuto();
+ pAuto = pObj->GetAuto();
if ( pAuto != 0 )
{
type = OpTypeObject(line, "autoType", OBJECT_NULL);
@@ -4576,7 +4576,7 @@ void CRobotMain::CreateScene(bool bSoluce, bool bFixScene, bool bResetObject)
if ( i != -1 )
{
if ( i != PARAM_FIXSCENE &&
- !m_dialog->RetMovies() ) i = 0;
+ !m_dialog->GetMovies() ) i = 0;
pAuto->Start(i); // starts the film
}
}
@@ -4587,8 +4587,8 @@ void CRobotMain::CreateScene(bool bSoluce, bool bFixScene, bool bResetObject)
pBrain->SetSoluceName(name);
}
- pObj->SetResetPosition(pObj->RetPosition(0));
- pObj->SetResetAngle(pObj->RetAngle(0));
+ pObj->SetResetPosition(pObj->GetPosition(0));
+ pObj->SetResetAngle(pObj->GetAngle(0));
pObj->SetResetRun(run);
if ( OpInt(line, "reset", 0) == 1 )
@@ -4874,7 +4874,7 @@ void CRobotMain::CreateScene(bool bSoluce, bool bFixScene, bool bResetObject)
SelectObject(pObj);
m_camera->SetObject(pObj);
//? m_camera->SetType(CAMERA_BACK);
- m_camera->SetType(pObj->RetCameraType());
+ m_camera->SetType(pObj->GetCameraType());
}
}
if ( m_bFixScene )
@@ -4884,7 +4884,7 @@ void CRobotMain::CreateScene(bool bSoluce, bool bFixScene, bool bResetObject)
if ( read[0] != 0 && pSel != 0 ) // loading file?
{
- pos = pSel->RetPosition(0);
+ pos = pSel->GetPosition(0);
m_camera->Init(pos, pos, 0.0f);
m_camera->FixCamera();
@@ -4942,7 +4942,7 @@ CObject* CRobotMain::CreateObject(Math::Vector pos, float angle, float zoom, flo
pObject = new CObject(m_iMan);
pObject->CreateBuilding(pos, angle, height, type, power);
- automat = pObject->RetAuto();
+ automat = pObject->GetAuto();
if ( automat != 0 )
{
automat->Init();
@@ -5225,7 +5225,7 @@ CObject* CRobotMain::CreateObject(Math::Vector pos, float angle, float zoom, flo
{
CMotion* motion;
- motion = pObject->RetMotion();
+ motion = pObject->GetMotion();
if ( m_phase == PHASE_WIN ) motion->SetAction(MHS_WIN, 0.4f);
if ( m_phase == PHASE_LOST ) motion->SetAction(MHS_LOST, 0.5f);
}
@@ -5322,9 +5322,9 @@ int CRobotMain::CreateSpot(Math::Vector pos, D3DCOLORVALUE color)
D3DLIGHT7 light;
int obj;
- if ( !m_engine->RetLightMode() ) return -1;
+ if ( !m_engine->GetLightMode() ) return -1;
- pos.y += m_terrain->RetFloorLevel(pos);
+ pos.y += m_terrain->GetFloorLevel(pos);
ZeroMemory(&light, sizeof(D3DLIGHT7));
light.dltType = D3DLIGHT_SPOT;
@@ -5367,11 +5367,11 @@ void CRobotMain::ChangeColor()
colorRef1.r = 206.0f/256.0f;
colorRef1.g = 206.0f/256.0f;
colorRef1.b = 204.0f/256.0f; // ~white
- colorNew1 = m_dialog->RetGamerColorCombi();
+ colorNew1 = m_dialog->GetGamerColorCombi();
colorRef2.r = 255.0f/256.0f;
colorRef2.g = 132.0f/256.0f;
colorRef2.b = 1.0f/256.0f; // orange
- colorNew2 = m_dialog->RetGamerColorBand();
+ colorNew2 = m_dialog->GetGamerColorBand();
exclu[0] = Math::Point(192.0f/256.0f, 0.0f/256.0f);
exclu[1] = Math::Point(256.0f/256.0f, 64.0f/256.0f); // crystals + cylinders
exclu[2] = Math::Point(208.0f/256.0f, 224.0f/256.0f);
@@ -5409,7 +5409,7 @@ void CRobotMain::ChangeColor()
colorRef1.b = 0.0f/256.0f; // yellow
tolerance = 0.20f;
}
- colorNew1 = m_dialog->RetGamerColorHair();
+ colorNew1 = m_dialog->GetGamerColorHair();
colorRef2.r = 0.0f;
colorRef2.g = 0.0f;
colorRef2.b = 0.0f;
@@ -5489,7 +5489,7 @@ bool CRobotMain::TestGadgetQuantity(int rank)
static int table80[10] = {0,1,1,1,1,1,0,1,1,1};
static int table90[10] = {0,1,1,1,1,1,1,1,1,1};
- percent = m_engine->RetGadgetQuantity();
+ percent = m_engine->GetGadgetQuantity();
if ( percent == 0.0f ) return false;
if ( percent == 1.0f ) return true;
@@ -5524,15 +5524,15 @@ float CRobotMain::SearchNearestObject(Math::Vector center, CObject *exclu)
pObj = (CObject*)m_iMan->SearchInstance(CLASS_OBJECT, i);
if ( pObj == 0 ) break;
- if ( !pObj->RetActif() ) continue; // inactive?
- if ( pObj->RetTruck() != 0 ) continue; // object carries?
+ if ( !pObj->GetActif() ) continue; // inactive?
+ if ( pObj->GetTruck() != 0 ) continue; // object carries?
if ( pObj == exclu ) continue;
- type = pObj->RetType();
+ type = pObj->GetType();
if ( type == OBJECT_BASE )
{
- oPos = pObj->RetPosition(0);
+ oPos = pObj->GetPosition(0);
if ( oPos.x != center.x ||
oPos.z != center.z )
{
@@ -5547,7 +5547,7 @@ float CRobotMain::SearchNearestObject(Math::Vector center, CObject *exclu)
type == OBJECT_REPAIR ||
type == OBJECT_DESTROYER )
{
- oPos = pObj->RetPosition(0);
+ oPos = pObj->GetPosition(0);
dist = Math::Distance(center, oPos)-8.0f;
if ( dist < 0.0f ) dist = 0.0f;
min = Math::Min(min, dist);
@@ -5590,7 +5590,7 @@ bool CRobotMain::FreeSpace(Math::Vector &center, float minRadius, float maxRadiu
dist = SearchNearestObject(pos, exclu);
if ( dist >= space )
{
- flat = m_terrain->RetFlatZoneRadius(pos, dist/2.0f);
+ flat = m_terrain->GetFlatZoneRadius(pos, dist/2.0f);
if ( flat >= dist/2.0f )
{
center = pos;
@@ -5617,7 +5617,7 @@ bool CRobotMain::FreeSpace(Math::Vector &center, float minRadius, float maxRadiu
dist = SearchNearestObject(pos, exclu);
if ( dist >= space )
{
- flat = m_terrain->RetFlatZoneRadius(pos, dist/2.0f);
+ flat = m_terrain->GetFlatZoneRadius(pos, dist/2.0f);
if ( flat >= dist/2.0f )
{
center = pos;
@@ -5632,7 +5632,7 @@ bool CRobotMain::FreeSpace(Math::Vector &center, float minRadius, float maxRadiu
// Calculates the maximum radius of a free space.
-float CRobotMain::RetFlatZoneRadius(Math::Vector center, float maxRadius,
+float CRobotMain::GetFlatZoneRadius(Math::Vector center, float maxRadius,
CObject *exclu)
{
float dist;
@@ -5643,7 +5643,7 @@ float CRobotMain::RetFlatZoneRadius(Math::Vector center, float maxRadius,
{
maxRadius = dist;
}
- return m_terrain->RetFlatZoneRadius(center, maxRadius);
+ return m_terrain->GetFlatZoneRadius(center, maxRadius);
}
@@ -5676,7 +5676,7 @@ void CRobotMain::ShowDropZone(CObject* metal, CObject* truck)
if ( metal == 0 ) return;
- center = metal->RetPosition(0);
+ center = metal->GetPosition(0);
// Calculates the maximum radius possible depending on other items.
oMax = 30.0f; // radius to build the biggest building
@@ -5685,15 +5685,15 @@ void CRobotMain::ShowDropZone(CObject* metal, CObject* truck)
pObj = (CObject*)m_iMan->SearchInstance(CLASS_OBJECT, i);
if ( pObj == 0 ) break;
- if ( !pObj->RetActif() ) continue; // inactive?
- if ( pObj->RetTruck() != 0 ) continue; // object carried?
+ if ( !pObj->GetActif() ) continue; // inactive?
+ if ( pObj->GetTruck() != 0 ) continue; // object carried?
if ( pObj == metal ) continue;
if ( pObj == truck ) continue;
- type = pObj->RetType();
+ type = pObj->GetType();
if ( type == OBJECT_BASE )
{
- oPos = pObj->RetPosition(0);
+ oPos = pObj->GetPosition(0);
dist = Math::Distance(center, oPos)-80.0f;
oMax = Math::Min(oMax, dist);
}
@@ -5738,7 +5738,7 @@ void CRobotMain::ShowDropZone(CObject* metal, CObject* truck)
// Calculates the maximum possible radius depending on terrain.
if ( oMax >= 2.0f )
{
- tMax = m_terrain->RetFlatZoneRadius(center, 30.0f);
+ tMax = m_terrain->GetFlatZoneRadius(center, 30.0f);
}
else
{
@@ -5843,7 +5843,7 @@ void CRobotMain::FrameShowLimit(float rTime)
float angle, factor, speed;
int i, j;
- if ( m_engine->RetPause() ) return;
+ if ( m_engine->GetPause() ) return;
for ( i=0 ; i<MAXSHOWLIMIT ; i++ )
{
@@ -5935,20 +5935,20 @@ void CRobotMain::CompileScript(bool bSoluce)
{
pObj = (CObject*)m_iMan->SearchInstance(CLASS_OBJECT, i);
if ( pObj == 0 ) break;
- if ( pObj->RetTruck() != 0 ) continue;
+ if ( pObj->GetTruck() != 0 ) continue;
- brain = pObj->RetBrain();
+ brain = pObj->GetBrain();
if ( brain == 0 ) continue;
for ( j=0 ; j<10 ; j++ )
{
- if ( brain->RetCompile(j) ) continue;
+ if ( brain->GetCompile(j) ) continue;
- name = brain->RetScriptName(j);
+ name = brain->GetScriptName(j);
if ( name[0] != 0 )
{
brain->ReadProgram(j, name);
- if ( !brain->RetCompile(j) ) nbError++;
+ if ( !brain->GetCompile(j) ) nbError++;
}
}
@@ -5964,12 +5964,12 @@ void CRobotMain::CompileScript(bool bSoluce)
{
pObj = (CObject*)m_iMan->SearchInstance(CLASS_OBJECT, i);
if ( pObj == 0 ) break;
- if ( pObj->RetTruck() != 0 ) continue;
+ if ( pObj->GetTruck() != 0 ) continue;
- brain = pObj->RetBrain();
+ brain = pObj->GetBrain();
if ( brain == 0 ) continue;
- name = brain->RetSoluceName();
+ name = brain->GetSoluceName();
if ( name[0] != 0 )
{
brain->ReadSoluce(name); // load solution
@@ -5982,12 +5982,12 @@ void CRobotMain::CompileScript(bool bSoluce)
{
pObj = (CObject*)m_iMan->SearchInstance(CLASS_OBJECT, i);
if ( pObj == 0 ) break;
- if ( pObj->RetTruck() != 0 ) continue;
+ if ( pObj->GetTruck() != 0 ) continue;
- brain = pObj->RetBrain();
+ brain = pObj->GetBrain();
if ( brain == 0 ) continue;
- run = brain->RetScriptRun();
+ run = brain->GetScriptRun();
if ( run != -1 )
{
brain->RunProgram(run); // starts the program
@@ -6005,29 +6005,29 @@ void CRobotMain::LoadOneScript(CObject *pObj, int &nbError)
char* name;
int rank, i, objRank;
- brain = pObj->RetBrain();
+ brain = pObj->GetBrain();
if ( brain == 0 ) return;
if ( !IsSelectable(pObj) ) return;
- type = pObj->RetType();
+ type = pObj->GetType();
if ( type == OBJECT_HUMAN ) return;
- objRank = pObj->RetDefRank();
+ objRank = pObj->GetDefRank();
if ( objRank == -1 ) return;
- name = m_dialog->RetSceneName();
- rank = m_dialog->RetSceneRank();
+ name = m_dialog->GetSceneName();
+ rank = m_dialog->GetSceneRank();
for ( i=0 ; i<BRAINMAXSCRIPT ; i++ )
{
- if ( brain->RetCompile(i) ) continue;
+ if ( brain->GetCompile(i) ) continue;
//? if ( brain->ProgramExist(i) ) continue;
sprintf(filename, "%s\\%s\\%c%.3d%.3d%.1d.txt",
RetSavegameDir(), m_gamerName, name[0], rank, objRank, i);
brain->ReadProgram(i, filename);
- if ( !brain->RetCompile(i) ) nbError++;
+ if ( !brain->GetCompile(i) ) nbError++;
}
}
@@ -6045,14 +6045,14 @@ void CRobotMain::LoadFileScript(CObject *pObj, char* filename, int objRank,
if ( objRank == -1 ) return;
- brain = pObj->RetBrain();
+ brain = pObj->GetBrain();
if ( brain == 0 ) return;
- type = pObj->RetType();
+ type = pObj->GetType();
if ( type == OBJECT_HUMAN ) return;
- name = m_dialog->RetSceneName();
- rank = m_dialog->RetSceneRank();
+ name = m_dialog->GetSceneName();
+ rank = m_dialog->GetSceneRank();
strcpy(fn, filename);
ldir = SearchLastDir(fn);
@@ -6060,12 +6060,12 @@ void CRobotMain::LoadFileScript(CObject *pObj, char* filename, int objRank,
for ( i=0 ; i<BRAINMAXSCRIPT ; i++ )
{
- if ( brain->RetCompile(i) ) continue;
+ if ( brain->GetCompile(i) ) continue;
//? if ( brain->ProgramExist(i) ) continue;
sprintf(ldir, "\\prog%.3d%.1d.txt", objRank, i);
brain->ReadProgram(i, fn);
- if ( !brain->RetCompile(i) ) nbError++;
+ if ( !brain->GetCompile(i) ) nbError++;
}
}
@@ -6096,19 +6096,19 @@ void CRobotMain::SaveOneScript(CObject *pObj)
char* name;
int rank, i, objRank;
- brain = pObj->RetBrain();
+ brain = pObj->GetBrain();
if ( brain == 0 ) return;
if ( !IsSelectable(pObj) ) return;
- type = pObj->RetType();
+ type = pObj->GetType();
if ( type == OBJECT_HUMAN ) return;
- objRank = pObj->RetDefRank();
+ objRank = pObj->GetDefRank();
if ( objRank == -1 ) return;
- name = m_dialog->RetSceneName();
- rank = m_dialog->RetSceneRank();
+ name = m_dialog->GetSceneName();
+ rank = m_dialog->GetSceneRank();
for ( i=0 ; i<BRAINMAXSCRIPT ; i++ )
{
@@ -6132,14 +6132,14 @@ void CRobotMain::SaveFileScript(CObject *pObj, char* filename, int objRank)
if ( objRank == -1 ) return;
- brain = pObj->RetBrain();
+ brain = pObj->GetBrain();
if ( brain == 0 ) return;
- type = pObj->RetType();
+ type = pObj->GetType();
if ( type == OBJECT_HUMAN ) return;
- name = m_dialog->RetSceneName();
- rank = m_dialog->RetSceneRank();
+ name = m_dialog->GetSceneName();
+ rank = m_dialog->GetSceneRank();
strcpy(fn, filename);
ldir = SearchLastDir(fn);
@@ -6161,10 +6161,10 @@ bool CRobotMain::SaveFileStack(CObject *pObj, FILE *file, int objRank)
if ( objRank == -1 ) return true;
- brain = pObj->RetBrain();
+ brain = pObj->GetBrain();
if ( brain == 0 ) return true;
- type = pObj->RetType();
+ type = pObj->GetType();
if ( type == OBJECT_HUMAN ) return true;
return brain->WriteStack(file);
@@ -6179,10 +6179,10 @@ bool CRobotMain::ReadFileStack(CObject *pObj, FILE *file, int objRank)
if ( objRank == -1 ) return true;
- brain = pObj->RetBrain();
+ brain = pObj->GetBrain();
if ( brain == 0 ) return true;
- type = pObj->RetType();
+ type = pObj->GetType();
if ( type == OBJECT_HUMAN ) return true;
return brain->ReadStack(file);
@@ -6223,7 +6223,7 @@ bool CRobotMain::AddNewScriptName(ObjectType type, char *name)
// Seeks a script name for a given type.
-char* CRobotMain::RetNewScriptName(ObjectType type, int rank)
+char* CRobotMain::GetNewScriptName(ObjectType type, int rank)
{
int i;
@@ -6258,16 +6258,16 @@ bool CRobotMain::IsBusy()
pObj = (CObject*)m_iMan->SearchInstance(CLASS_OBJECT, i);
if ( pObj == 0 ) break;
- pBrain = pObj->RetBrain();
+ pBrain = pObj->GetBrain();
if ( pBrain != 0 )
{
if ( pBrain->IsBusy() ) return true;
}
-//? pAuto = pObj->RetAuto();
+//? pAuto = pObj->GetAuto();
//? if ( pAuto != 0 )
//? {
-//? if ( pAuto->RetBusy() ) return true;
+//? if ( pAuto->GetBusy() ) return true;
//? }
}
return false;
@@ -6283,33 +6283,33 @@ void CRobotMain::IOWriteObject(FILE *file, CObject* pObj, char *cmd)
char name[100];
int run, i;
- if ( pObj->RetType() == OBJECT_FIX ) return;
+ if ( pObj->GetType() == OBJECT_FIX ) return;
strcpy(line, cmd);
- sprintf(name, " type=%s", GetTypeObject(pObj->RetType()));
+ sprintf(name, " type=%s", GetTypeObject(pObj->GetType()));
strcat(line, name);
- sprintf(name, " id=%d", pObj->RetID());
+ sprintf(name, " id=%d", pObj->GetID());
strcat(line, name);
- pos = pObj->RetPosition(0)/g_unit;
+ pos = pObj->GetPosition(0)/g_unit;
sprintf(name, " pos=%.2f;%.2f;%.2f", pos.x, pos.y, pos.z);
strcat(line, name);
- pos = pObj->RetAngle(0)/(Math::PI/180.0f);
+ pos = pObj->GetAngle(0)/(Math::PI/180.0f);
sprintf(name, " angle=%.2f;%.2f;%.2f", pos.x, pos.y, pos.z);
strcat(line, name);
- pos = pObj->RetZoom(0);
+ pos = pObj->GetZoom(0);
sprintf(name, " zoom=%.2f;%.2f;%.2f", pos.x, pos.y, pos.z);
strcat(line, name);
for ( i=1 ; i<OBJECTMAXPART ; i++ )
{
- if ( pObj->RetObjectRank(i) == -1 ) continue;
+ if ( pObj->GetObjectRank(i) == -1 ) continue;
- pos = pObj->RetPosition(i);
+ pos = pObj->GetPosition(i);
if ( pos.x != 0.0f || pos.y != 0.0f || pos.z != 0.0f )
{
pos /= g_unit;
@@ -6317,7 +6317,7 @@ void CRobotMain::IOWriteObject(FILE *file, CObject* pObj, char *cmd)
strcat(line, name);
}
- pos = pObj->RetAngle(i);
+ pos = pObj->GetAngle(i);
if ( pos.x != 0.0f || pos.y != 0.0f || pos.z != 0.0f )
{
pos /= (Math::PI/180.0f);
@@ -6325,7 +6325,7 @@ void CRobotMain::IOWriteObject(FILE *file, CObject* pObj, char *cmd)
strcat(line, name);
}
- pos = pObj->RetZoom(i);
+ pos = pObj->GetZoom(i);
if ( pos.x != 1.0f || pos.y != 1.0f || pos.z != 1.0f )
{
sprintf(name, " z%d=%.2f;%.2f;%.2f", i, pos.x, pos.y, pos.z);
@@ -6333,10 +6333,10 @@ void CRobotMain::IOWriteObject(FILE *file, CObject* pObj, char *cmd)
}
}
- sprintf(name, " trainer=%d", pObj->RetTrainer());
+ sprintf(name, " trainer=%d", pObj->GetTrainer());
strcat(line, name);
- sprintf(name, " option=%d", pObj->RetOption());
+ sprintf(name, " option=%d", pObj->GetOption());
strcat(line, name);
if ( pObj == m_infoObject ) // selects object?
@@ -6347,16 +6347,16 @@ void CRobotMain::IOWriteObject(FILE *file, CObject* pObj, char *cmd)
pObj->Write(line);
- if ( pObj->RetType() == OBJECT_BASE )
+ if ( pObj->GetType() == OBJECT_BASE )
{
sprintf(name, " run=3"); // stops and open (PARAM_FIXSCENE)
strcat(line, name);
}
- pBrain = pObj->RetBrain();
+ pBrain = pObj->GetBrain();
if ( pBrain != 0 )
{
- run = pBrain->RetProgram();
+ run = pBrain->GetProgram();
if ( run != -1 )
{
sprintf(name, " run=%d", run+1);
@@ -6389,18 +6389,18 @@ bool CRobotMain::IOWriteScene(char *filename, char *filecbot, char *info)
sprintf(line, "Version maj=%d min=%d\n", 0, 1);
fputs(line, file);
- name = m_dialog->RetSceneName();
+ name = m_dialog->GetSceneName();
if ( strcmp(name, "user") == 0 )
{
- sprintf(line, "Mission base=\"%s\" rank=%.3d dir=\"%s\"\n", name, m_dialog->RetSceneRank(), m_dialog->RetSceneDir());
+ sprintf(line, "Mission base=\"%s\" rank=%.3d dir=\"%s\"\n", name, m_dialog->GetSceneRank(), m_dialog->GetSceneDir());
}
else
{
- sprintf(line, "Mission base=\"%s\" rank=%.3d\n", name, m_dialog->RetSceneRank());
+ sprintf(line, "Mission base=\"%s\" rank=%.3d\n", name, m_dialog->GetSceneRank());
}
fputs(line, file);
- sprintf(line, "Map zoom=%.2f\n", m_map->RetZoomMap());
+ sprintf(line, "Map zoom=%.2f\n", m_map->GetZoomMap());
fputs(line, file);
sprintf(line, "DoneResearch bits=%d\n", g_researchDone);
@@ -6418,15 +6418,15 @@ bool CRobotMain::IOWriteScene(char *filename, char *filecbot, char *info)
pObj = (CObject*)m_iMan->SearchInstance(CLASS_OBJECT, i);
if ( pObj == 0 ) break;
- if ( pObj->RetType() == OBJECT_TOTO ) continue;
- if ( pObj->RetType() == OBJECT_FIX ) continue;
- if ( pObj->RetTruck() != 0 ) continue;
- if ( pObj->RetBurn() ) continue;
- if ( pObj->RetDead() ) continue;
- if ( pObj->RetExplo() ) continue;
+ if ( pObj->GetType() == OBJECT_TOTO ) continue;
+ if ( pObj->GetType() == OBJECT_FIX ) continue;
+ if ( pObj->GetTruck() != 0 ) continue;
+ if ( pObj->GetBurn() ) continue;
+ if ( pObj->GetDead() ) continue;
+ if ( pObj->GetExplo() ) continue;
- pPower = pObj->RetPower();
- pFret = pObj->RetFret();
+ pPower = pObj->GetPower();
+ pFret = pObj->GetFret();
if ( pFret != 0 ) // object transported?
{
@@ -6460,11 +6460,11 @@ bool CRobotMain::IOWriteScene(char *filename, char *filecbot, char *info)
pObj = (CObject*)m_iMan->SearchInstance(CLASS_OBJECT, i);
if ( pObj == 0 ) break;
- if ( pObj->RetType() == OBJECT_TOTO ) continue;
- if ( pObj->RetType() == OBJECT_FIX ) continue;
- if ( pObj->RetTruck() != 0 ) continue;
- if ( pObj->RetBurn() ) continue;
- if ( pObj->RetDead() ) continue;
+ if ( pObj->GetType() == OBJECT_TOTO ) continue;
+ if ( pObj->GetType() == OBJECT_FIX ) continue;
+ if ( pObj->GetTruck() != 0 ) continue;
+ if ( pObj->GetBurn() ) continue;
+ if ( pObj->GetDead() ) continue;
if ( !SaveFileStack(pObj, file, objRank++) ) break;
}
@@ -6511,7 +6511,7 @@ CObject* CRobotMain::IOReadObject(char *line, char* filename, int objRank)
for ( i=1 ; i<OBJECTMAXPART ; i++ )
{
- if ( pObj->RetObjectRank(i) == -1 ) continue;
+ if ( pObj->GetObjectRank(i) == -1 ) continue;
sprintf(op, "p%d", i);
pos = OpDir(line, op);
@@ -6549,14 +6549,14 @@ CObject* CRobotMain::IOReadObject(char *line, char* filename, int objRank)
{
#if CBOT_STACK
#else
- pBrain = pObj->RetBrain();
+ pBrain = pObj->GetBrain();
if ( pBrain != 0 )
{
pBrain->RunProgram(run-1); // starts the program
}
#endif
- pAuto = pObj->RetAuto();
+ pAuto = pObj->GetAuto();
if ( pAuto != 0 )
{
pAuto->Start(run); // starts the film
@@ -6669,9 +6669,9 @@ CObject* CRobotMain::IOReadScene(char *filename, char *filecbot)
{
pObj = (CObject*)m_iMan->SearchInstance(CLASS_OBJECT, i);
if ( pObj == 0 ) break;
- if ( pObj->RetTruck() != 0 ) continue;
+ if ( pObj->GetTruck() != 0 ) continue;
- objRank = pObj->RetDefRank();
+ objRank = pObj->GetDefRank();
if ( objRank == -1 ) continue;
LoadFileScript(pObj, filename, objRank, nbError);
@@ -6695,11 +6695,11 @@ CObject* CRobotMain::IOReadScene(char *filename, char *filecbot)
pObj = (CObject*)m_iMan->SearchInstance(CLASS_OBJECT, i);
if ( pObj == 0 ) break;
- if ( pObj->RetType() == OBJECT_TOTO ) continue;
- if ( pObj->RetType() == OBJECT_FIX ) continue;
- if ( pObj->RetTruck() != 0 ) continue;
- if ( pObj->RetBurn() ) continue;
- if ( pObj->RetDead() ) continue;
+ if ( pObj->GetType() == OBJECT_TOTO ) continue;
+ if ( pObj->GetType() == OBJECT_FIX ) continue;
+ if ( pObj->GetTruck() != 0 ) continue;
+ if ( pObj->GetBurn() ) continue;
+ if ( pObj->GetDead() ) continue;
if ( !ReadFileStack(pObj, file, objRank++) ) break;
}
@@ -6797,12 +6797,12 @@ void CRobotMain::ResetObject()
pObj = (CObject*)m_iMan->SearchInstance(CLASS_OBJECT, i);
if ( pObj == 0 ) break;
- cap = pObj->RetResetCap();
+ cap = pObj->GetResetCap();
if ( cap == RESET_NONE ) continue;
if ( cap == RESET_DELETE )
{
- pTruck = pObj->RetTruck();
+ pTruck = pObj->GetTruck();
if ( pTruck != 0 )
{
pTruck->SetFret(0);
@@ -6814,22 +6814,22 @@ void CRobotMain::ResetObject()
continue;
}
- pAuto = pObj->RetAuto();
+ pAuto = pObj->GetAuto();
if ( pAuto != 0 )
{
pAuto->Abort();
}
- if ( pObj->RetEnable() ) // object still active?
+ if ( pObj->GetEnable() ) // object still active?
{
- brain = pObj->RetBrain();
+ brain = pObj->GetBrain();
if ( brain != 0 )
{
- pos = pObj->RetResetPosition();
- angle = pObj->RetResetAngle();
+ pos = pObj->GetResetPosition();
+ angle = pObj->GetResetAngle();
- if ( pos == pObj->RetPosition(0) &&
- angle == pObj->RetAngle(0) ) continue;
+ if ( pos == pObj->GetPosition(0) &&
+ angle == pObj->GetAngle(0) ) continue;
brain->StartTaskReset(pos, angle);
continue;
}
@@ -6837,19 +6837,19 @@ void CRobotMain::ResetObject()
pObj->SetEnable(true); // active again
- pos = pObj->RetResetPosition();
- angle = pObj->RetResetAngle();
+ pos = pObj->GetResetPosition();
+ angle = pObj->GetResetAngle();
- if ( pos == pObj->RetPosition(0) &&
- angle == pObj->RetAngle(0) ) continue;
+ if ( pos == pObj->GetPosition(0) &&
+ angle == pObj->GetAngle(0) ) continue;
pyro = new CPyro(m_iMan);
pyro->Create(PT_RESET, pObj);
- brain = pObj->RetBrain();
+ brain = pObj->GetBrain();
if ( brain != 0 )
{
- brain->RunProgram(pObj->RetResetRun());
+ brain->RunProgram(pObj->GetResetRun());
}
}
#else
@@ -6885,7 +6885,7 @@ void CRobotMain::ResetCreate()
m_iMan->Flush(CLASS_PYRO);
m_camera->SetType(CAMERA_DIALOG);
- CreateScene(m_dialog->RetSceneSoluce(), false, true);
+ CreateScene(m_dialog->GetSceneSoluce(), false, true);
if ( !RetNiceReset() ) return;
@@ -6894,7 +6894,7 @@ void CRobotMain::ResetCreate()
pObj = (CObject*)m_iMan->SearchInstance(CLASS_OBJECT, i);
if ( pObj == 0 ) break;
- cap = pObj->RetResetCap();
+ cap = pObj->GetResetCap();
if ( cap == RESET_NONE ) continue;
pyro = new CPyro(m_iMan);
@@ -6926,11 +6926,11 @@ Error CRobotMain::CheckEndMission(bool bFrame)
// Do not use RetActif () because an invisible worm (underground)
// should be regarded as existing here!
- if ( pObj->RetLock() ) continue;
- if ( pObj->RetRuin() ) continue;
- if ( !pObj->RetEnable() ) continue;
+ if ( pObj->GetLock() ) continue;
+ if ( pObj->GetRuin() ) continue;
+ if ( !pObj->GetEnable() ) continue;
- type = pObj->RetType();
+ type = pObj->GetType();
if ( type == OBJECT_SCRAP2 ||
type == OBJECT_SCRAP3 ||
type == OBJECT_SCRAP4 ||
@@ -6940,13 +6940,13 @@ Error CRobotMain::CheckEndMission(bool bFrame)
}
if ( type != m_endTake[t].type ) continue;
- if ( pObj->RetTruck() == 0 )
+ if ( pObj->GetTruck() == 0 )
{
- oPos = pObj->RetPosition(0);
+ oPos = pObj->GetPosition(0);
}
else
{
- oPos = pObj->RetTruck()->RetPosition(0);
+ oPos = pObj->GetTruck()->GetPosition(0);
}
oPos.y = 0.0f;
if ( Math::DistanceProjected(oPos, bPos) <= m_endTake[t].dist )
@@ -7048,14 +7048,14 @@ void CRobotMain::CheckEndMessage(const char *message)
// Returns the number of instructions required.
-int CRobotMain::RetObligatoryToken()
+int CRobotMain::GetObligatoryToken()
{
return m_obligatoryTotal;
}
// Returns the name of a required instruction.
-char* CRobotMain::RetObligatoryToken(int i)
+char* CRobotMain::GetObligatoryToken(int i)
{
return m_obligatoryToken[i];
}
@@ -7095,99 +7095,99 @@ bool CRobotMain::IsProhibitedToken(const char *token)
// Indicates whether it is possible to control a driving robot.
-bool CRobotMain::RetTrainerPilot()
+bool CRobotMain::GetTrainerPilot()
{
return m_bTrainerPilot;
}
// Indicates whether the scene is fixed, without interaction.
-bool CRobotMain::RetFixScene()
+bool CRobotMain::GetFixScene()
{
return m_bFixScene;
}
-char* CRobotMain::RetTitle()
+char* CRobotMain::GetTitle()
{
return m_title;
}
-char* CRobotMain::RetResume()
+char* CRobotMain::GetResume()
{
return m_resume;
}
-char* CRobotMain::RetScriptName()
+char* CRobotMain::GetScriptName()
{
return m_scriptName;
}
-char* CRobotMain::RetScriptFile()
+char* CRobotMain::GetScriptFile()
{
return m_scriptFile;
}
-bool CRobotMain::RetGlint()
+bool CRobotMain::GetGlint()
{
- return m_dialog->RetGlint();
+ return m_dialog->GetGlint();
}
-bool CRobotMain::RetSoluce4()
+bool CRobotMain::GetSoluce4()
{
- return m_dialog->RetSoluce4();
+ return m_dialog->GetSoluce4();
}
-bool CRobotMain::RetMovies()
+bool CRobotMain::GetMovies()
{
- return m_dialog->RetMovies();
+ return m_dialog->GetMovies();
}
-bool CRobotMain::RetNiceReset()
+bool CRobotMain::GetNiceReset()
{
- return m_dialog->RetNiceReset();
+ return m_dialog->GetNiceReset();
}
-bool CRobotMain::RetHimselfDamage()
+bool CRobotMain::GetHimselfDamage()
{
- return m_dialog->RetHimselfDamage();
+ return m_dialog->GetHimselfDamage();
}
-bool CRobotMain::RetShowSoluce()
+bool CRobotMain::GetShowSoluce()
{
return m_bShowSoluce;
}
-bool CRobotMain::RetSceneSoluce()
+bool CRobotMain::GetSceneSoluce()
{
if ( m_infoFilename[SATCOM_SOLUCE][0] == 0 ) return false;
- return m_dialog->RetSceneSoluce();
+ return m_dialog->GetSceneSoluce();
}
-bool CRobotMain::RetShowAll()
+bool CRobotMain::GetShowAll()
{
return m_bShowAll;
}
-bool CRobotMain::RetCheatRadar()
+bool CRobotMain::GetCheatRadar()
{
return m_bCheatRadar;
}
-char* CRobotMain::RetSavegameDir()
+char* CRobotMain::GetSavegameDir()
{
- return m_dialog->RetSavegameDir();
+ return m_dialog->GetSavegameDir();
}
-char* CRobotMain::RetPublicDir()
+char* CRobotMain::GetPublicDir()
{
- return m_dialog->RetPublicDir();
+ return m_dialog->GetPublicDir();
}
-char* CRobotMain::RetFilesDir()
+char* CRobotMain::GetFilesDir()
{
- return m_dialog->RetFilesDir();
+ return m_dialog->GetFilesDir();
}
@@ -7202,7 +7202,7 @@ void CRobotMain::SetGamerName(char *name)
// Getes the player's name.
-char* CRobotMain::RetGamerName()
+char* CRobotMain::GetGamerName()
{
return m_gamerName;
}
@@ -7210,30 +7210,30 @@ char* CRobotMain::RetGamerName()
// Returns the representation to use for the player.
-int CRobotMain::RetGamerFace()
+int CRobotMain::GetGamerFace()
{
- return m_dialog->RetGamerFace();
+ return m_dialog->GetGamerFace();
}
// Returns the representation to use for the player.
-int CRobotMain::RetGamerGlasses()
+int CRobotMain::GetGamerGlasses()
{
- return m_dialog->RetGamerGlasses();
+ return m_dialog->GetGamerGlasses();
}
// Returns the mode with just the head.
-bool CRobotMain::RetGamerOnlyHead()
+bool CRobotMain::GetGamerOnlyHead()
{
- return m_dialog->RetGamerOnlyHead();
+ return m_dialog->GetGamerOnlyHead();
}
// Returns the angle of presentation.
-float CRobotMain::RetPersoAngle()
+float CRobotMain::GetPersoAngle()
{
- return m_dialog->RetPersoAngle();
+ return m_dialog->GetPersoAngle();
}
@@ -7246,7 +7246,7 @@ void CRobotMain::ChangePause(bool bPause)
m_sound->MuteAll(m_bPause);
CreateShortcuts();
- if ( m_bPause ) HiliteClear();
+ if ( m_bPause ) HighlightClear();
}
@@ -7275,9 +7275,9 @@ void CRobotMain::SetSpeed(float speed)
}
}
-float CRobotMain::RetSpeed()
+float CRobotMain::GetSpeed()
{
- return m_engine->RetSpeed();
+ return m_engine->GetSpeed();
}
@@ -7299,9 +7299,9 @@ void CRobotMain::UpdateMap()
// Indicates whether the mini-map is visible.
-bool CRobotMain::RetShowMap()
+bool CRobotMain::GetShowMap()
{
- return m_map->RetShowMap() && m_bMapShow;
+ return m_map->GetShowMap() && m_bMapShow;
}
@@ -7314,16 +7314,16 @@ void CRobotMain::SetMovieLock(bool bLock)
CreateShortcuts();
m_map->ShowMap(!m_bMovieLock && m_bMapShow);
- if ( m_bMovieLock ) HiliteClear();
+ if ( m_bMovieLock ) HighlightClear();
m_engine->SetMouseHide(m_bMovieLock);
}
-bool CRobotMain::RetMovieLock()
+bool CRobotMain::GetMovieLock()
{
return m_bMovieLock;
}
-bool CRobotMain::RetInfoLock()
+bool CRobotMain::GetInfoLock()
{
return ( m_displayInfo != 0 ); // info in progress?
}
@@ -7335,7 +7335,7 @@ void CRobotMain::SetSatComLock(bool bLock)
m_bSatComLock = bLock;
}
-bool CRobotMain::RetSatComLock()
+bool CRobotMain::GetSatComLock()
{
return m_bSatComLock;
}
@@ -7349,7 +7349,7 @@ void CRobotMain::SetEditLock(bool bLock, bool bEdit)
CreateShortcuts();
// Do not remove the card if it contains a still image.
- if ( !bLock || !m_map->RetFixImage() )
+ if ( !bLock || !m_map->GetFixImage() )
{
m_map->ShowMap(!m_bEditLock && m_bMapShow);
}
@@ -7359,7 +7359,7 @@ void CRobotMain::SetEditLock(bool bLock, bool bEdit)
if ( m_bEditLock )
{
- HiliteClear();
+ HighlightClear();
}
else
{
@@ -7367,7 +7367,7 @@ void CRobotMain::SetEditLock(bool bLock, bool bEdit)
}
}
-bool CRobotMain::RetEditLock()
+bool CRobotMain::GetEditLock()
{
return m_bEditLock;
}
@@ -7379,13 +7379,13 @@ void CRobotMain::SetEditFull(bool bFull)
m_bEditFull = bFull;
}
-bool CRobotMain::RetEditFull()
+bool CRobotMain::GetEditFull()
{
return m_bEditFull;
}
-bool CRobotMain::RetFreePhoto()
+bool CRobotMain::GetFreePhoto()
{
return m_bFreePhoto;
}
@@ -7398,7 +7398,7 @@ void CRobotMain::SetFriendAim(bool bFriend)
m_bFriendAim = bFriend;
}
-bool CRobotMain::RetFriendAim()
+bool CRobotMain::GetFriendAim()
{
return m_bFriendAim;
}
@@ -7411,9 +7411,9 @@ void CRobotMain::SetTracePrecision(float factor)
m_engine->SetTracePrecision(factor);
}
-float CRobotMain::RetTracePrecision()
+float CRobotMain::GetTracePrecision()
{
- return m_engine->RetTracePrecision();
+ return m_engine->GetTracePrecision();
}
@@ -7432,7 +7432,7 @@ void CRobotMain::StartMusic()
void CRobotMain::ClearInterface()
{
- HiliteClear(); // removes setting evidence
+ HighlightClear(); // removes setting evidence
m_tooltipName[0] = 0; // really removes the tooltip
}
diff --git a/src/object/robotmain.h b/src/object/robotmain.h
index 1370cd6..c649aab 100644
--- a/src/object/robotmain.h
+++ b/src/object/robotmain.h
@@ -300,9 +300,9 @@ protected:
Math::Vector LookatPoint( Math::Vector eye, float angleH, float angleV, float length );
CObject* CreateObject(Math::Vector pos, float angle, float zoom, float height, ObjectType type, float power=1.0f, bool bTrainer=false, bool bToy=false, int option=0);
int CreateLight(Math::Vector direction, Gfx::Color color);
- void HiliteClear();
- void HiliteObject(Math::Point pos);
- void HiliteFrame(float rTime);
+ void HighlightClear();
+ void HighlightObject(Math::Point pos);
+ void HighlightFrame(float rTime);
void CreateTooltip(Math::Point pos, char* text);
void ClearTooltip();
CObject* DetectObject(Math::Point pos);
@@ -379,7 +379,7 @@ protected:
bool m_bEditLock; // edition in progress?
bool m_bEditFull; // edition in full screen?
bool m_bPause; // simulation paused
- bool m_bHilite;
+ bool m_bHighlight;
bool m_bTrainerPilot; // remote trainer?
bool m_bSuspend;
bool m_bFriendAim;
diff --git a/src/script/cbottoken.cpp b/src/script/cbottoken.cpp
index b0bf67b..4d33bca 100644
--- a/src/script/cbottoken.cpp
+++ b/src/script/cbottoken.cpp
@@ -33,7 +33,7 @@
// Seeking the name of an object.
-const char* GetObjectName(ObjectType type)
+char* GetObjectName(ObjectType type)
{
if ( type == OBJECT_PORTICO ) return "Portico";
if ( type == OBJECT_BASE ) return "SpaceShip";
@@ -126,7 +126,7 @@ const char* GetObjectName(ObjectType type)
// Seeking the name of a secondary object.
// (because Otto thinks that Germans do not like nuclear power)
-const char* GetObjectAlias(ObjectType type)
+char* GetObjectAlias(ObjectType type)
{
if ( type == OBJECT_NUCLEAR ) return "FuelCellPlant";
if ( type == OBJECT_URANIUM ) return "PlatinumOre";
@@ -139,7 +139,7 @@ const char* GetObjectAlias(ObjectType type)
// Returns the help file to use for the object.
-const char* GetHelpFilename(ObjectType type)
+char* GetHelpFilename(ObjectType type)
{
if ( type == OBJECT_BASE ) return "help\\object\\base.txt";
if ( type == OBJECT_DERRICK ) return "help\\object\\derrick.txt";
@@ -224,7 +224,7 @@ const char* GetHelpFilename(ObjectType type)
// Returns the help file to use for instruction.
-const char* GetHelpFilename(const char *token)
+char* GetHelpFilename(const char *token)
{
if ( strcmp(token, "if" ) == 0 ) return "help\\cbot\\if.txt";
if ( strcmp(token, "else" ) == 0 ) return "help\\cbot\\if.txt";
@@ -436,7 +436,7 @@ bool IsFunction(const char *token)
// Returns using a compact instruction.
-const char* GetHelpText(const char *token)
+char* GetHelpText(const char *token)
{
if ( strcmp(token, "if" ) == 0 ) return "if ( condition ) { bloc }";
if ( strcmp(token, "else" ) == 0 ) return "else { bloc }";
diff --git a/src/script/cbottoken.h b/src/script/cbottoken.h
index a4d69ea..4be5f03 100644
--- a/src/script/cbottoken.h
+++ b/src/script/cbottoken.h
@@ -25,10 +25,10 @@
// Procedures.
-extern const char* GetObjectName(ObjectType type);
-extern const char* GetObjectAlias(ObjectType type);
-extern const char* GetHelpFilename(ObjectType type);
-extern const char* GetHelpFilename(const char *token);
+extern char* GetObjectName(ObjectType type);
+extern char* GetObjectAlias(ObjectType type);
+extern char* GetHelpFilename(ObjectType type);
+extern char* GetHelpFilename(const char *token);
extern bool IsType(const char *token);
extern bool IsFunction(const char *token);
extern char* GetHelpText(const char *token);
diff --git a/src/ui/button.cpp b/src/ui/button.cpp
index 1f11a0c..b8934c4 100644
--- a/src/ui/button.cpp
+++ b/src/ui/button.cpp
@@ -16,20 +16,14 @@
// * along with this program. If not, see http://www.gnu.org/licenses/.
-//#include <windows.h>
-//#include <stdio.h>
-//#include <d3d.h>
-
-//#include "common/struct.h"
-//#include "old/d3dengine.h"
-#include "graphics/engine/engine.h"
-//#include "common/language.h"
-//#include "old/math3d.h"
-#include "common/event.h"
-#include "common/misc.h"
-#include "common/iman.h"
-#include "common/restext.h"
-#include "ui/button.h"
+
+#include "button.h"
+
+#include <common/event.h>
+#include <common/misc.h>
+#include <common/restext.h>
+
+#include <graphics/engine/engine.h>
namespace Ui {
diff --git a/src/ui/button.h b/src/ui/button.h
index 924a4d8..ffaf220 100644
--- a/src/ui/button.h
+++ b/src/ui/button.h
@@ -19,39 +19,36 @@
#pragma once
+#include "control.h"
-#include "ui/control.h"
+namespace Ui {
-namespace Gfx{
-class CEngine;
-}
-namespace Ui {
-class CButton : public CControl
-{
-public:
- CButton();
- virtual ~CButton();
+ class CButton : public CControl
+ {
+ public:
+ CButton();
+ virtual ~CButton();
- bool Create(Math::Point pos, Math::Point dim, int icon, EventType eventType);
+ bool Create(Math::Point pos, Math::Point dim, int icon, EventType eventType);
- bool EventProcess(const Event &event);
+ bool EventProcess(const Event &event);
- void Draw();
+ void Draw();
- void SetImmediat(bool bRepeat);
- bool GetImmediat();
+ void SetImmediat(bool bRepeat);
+ bool GetImmediat();
- void SetRepeat(bool bRepeat);
- bool GetRepeat();
+ void SetRepeat(bool bRepeat);
+ bool GetRepeat();
-protected:
+ protected:
-protected:
- bool m_bCapture;
- bool m_bImmediat;
- bool m_bRepeat;
- float m_repeat;
-};
+ protected:
+ bool m_bCapture;
+ bool m_bImmediat;
+ bool m_bRepeat;
+ float m_repeat;
+ };
}
diff --git a/src/ui/check.cpp b/src/ui/check.cpp
index b4ddf4a..5c076d4 100644
--- a/src/ui/check.cpp
+++ b/src/ui/check.cpp
@@ -16,21 +16,16 @@
// * along with this program. If not, see http://www.gnu.org/licenses/.
-//#include <windows.h>
-//#include <stdio.h>
-//#include <d3d.h>
-
-//#include "common/struct.h"
-//#include "old/d3dengine.h"
-#include "graphics/engine/engine.h"
-//#include "old/math3d.h"
-#include "common/event.h"
-#include "common/misc.h"
-#include "common/iman.h"
-#include "common/restext.h"
-//#include "old/text.h"
-#include "graphics/engine/text.h"
-#include "ui/check.h"
+#include "check.h"
+
+#include <common/event.h>
+#include <common/iman.h>
+#include <common/misc.h>
+#include <common/restext.h>
+
+#include <graphics/engine/engine.h>
+#include <graphics/engine/text.h>
+
namespace Ui {
diff --git a/src/ui/check.h b/src/ui/check.h
index 0b6a1f2..1ad8a3a 100644
--- a/src/ui/check.h
+++ b/src/ui/check.h
@@ -19,30 +19,30 @@
#pragma once
+#include "control.h"
-#include "ui/control.h"
namespace Gfx{
-class CEngine;
+ class CEngine;
}
namespace Ui {
-class CCheck : public CControl
-{
-public:
- CCheck();
- virtual ~CCheck();
+ class CCheck : public CControl
+ {
+ public:
+ CCheck();
+ virtual ~CCheck();
- bool Create(Math::Point pos, Math::Point dim, int icon, EventType eventType);
+ bool Create(Math::Point pos, Math::Point dim, int icon, EventType eventType);
- bool EventProcess(const Event &event);
+ bool EventProcess(const Event &event);
- void Draw();
+ void Draw();
-protected:
+ protected:
-protected:
-};
+ protected:
+ };
}
diff --git a/src/ui/color.cpp b/src/ui/color.cpp
index 2d463b5..c8588b8 100644
--- a/src/ui/color.cpp
+++ b/src/ui/color.cpp
@@ -16,21 +16,15 @@
// * along with this program. If not, see http://www.gnu.org/licenses/.
-//#include <windows.h>
-//#include <stdio.h>
-//#include <d3d.h>
+#include "color.h"
-//#include "common/struct.h"
-//#include "old/d3dengine.h"
-#include "graphics/engine/engine.h"
-#include "graphics/core/device.h"
-//#include "common/language.h"
-//#include "old/math3d.h"
#include "common/event.h"
-#include "common/misc.h"
#include "common/iman.h"
+#include "common/misc.h"
#include "common/restext.h"
-#include "ui/color.h"
+
+#include "graphics/core/device.h"
+#include "graphics/engine/engine.h"
namespace Ui {
diff --git a/src/ui/color.h b/src/ui/color.h
index 2666f94..c282429 100644
--- a/src/ui/color.h
+++ b/src/ui/color.h
@@ -20,41 +20,40 @@
#pragma once
-#include "ui/control.h"
-//#include "graphics/engine/engine.h"
+#include "control.h"
namespace Gfx{
-class CEngine;
-struct Color;
+ class CEngine;
+ struct Color;
}
namespace Ui {
-class CColor : public CControl
-{
-public:
-// CColor(CInstanceManager* iMan);
- CColor();
- virtual ~CColor();
+ class CColor : public CControl
+ {
+ public:
+ // CColor(CInstanceManager* iMan);
+ CColor();
+ virtual ~CColor();
- bool Create(Math::Point pos, Math::Point dim, int icon, EventType eventType);
+ bool Create(Math::Point pos, Math::Point dim, int icon, EventType eventType);
- bool EventProcess(const Event &event);
+ bool EventProcess(const Event &event);
- void Draw();
+ void Draw();
- void SetRepeat(bool bRepeat);
- bool GetRepeat();
+ void SetRepeat(bool bRepeat);
+ bool GetRepeat();
- void SetColor(Gfx::Color color);
- Gfx::Color GetColor();
+ void SetColor(Gfx::Color color);
+ Gfx::Color GetColor();
-protected:
+ protected:
-protected:
- bool m_bRepeat;
- float m_repeat;
- Gfx::Color m_color;
-};
+ protected:
+ bool m_bRepeat;
+ float m_repeat;
+ Gfx::Color m_color;
+ };
}
diff --git a/src/ui/compass.cpp b/src/ui/compass.cpp
index 95e75b3..1969710 100644
--- a/src/ui/compass.cpp
+++ b/src/ui/compass.cpp
@@ -15,23 +15,16 @@
// * You should have received a copy of the GNU General Public License
// * along with this program. If not, see http://www.gnu.org/licenses/.
+#include "compass.h"
-//#include <windows.h>
-//#include <stdio.h>
-//#include <d3d.h>
-
-//#include "common/struct.h"
-#include "math/geometry.h"
-//#include "old/d3dengine.h"
-#include "graphics/engine/engine.h"
-#include "graphics/core/device.h"
-//#include "old/math3d.h"
#include "common/event.h"
-#include "common/misc.h"
#include "common/iman.h"
-#include "ui/compass.h"
+#include "common/misc.h"
+#include "graphics/core/device.h"
+#include "graphics/engine/engine.h"
+#include "math/geometry.h"
namespace Ui {
// Object's constructor.
diff --git a/src/ui/compass.h b/src/ui/compass.h
index 1d48907..e8ccc17 100644
--- a/src/ui/compass.h
+++ b/src/ui/compass.h
@@ -20,34 +20,35 @@
#pragma once
-#include "ui/control.h"
+#include "control.h"
namespace Gfx {
-class CEngine;
+ class CEngine;
}
namespace Ui {
-class CCompass : public CControl
-{
-public:
-// CCompass(CInstanceManager* iMan);
- CCompass();
- virtual ~CCompass();
- bool Create(Math::Point pos, Math::Point dim, int icon, EventType eventType);
+ class CCompass : public CControl
+ {
+ public:
+ // CCompass(CInstanceManager* iMan);
+ CCompass();
+ virtual ~CCompass();
- bool EventProcess(const Event &event);
+ bool Create(Math::Point pos, Math::Point dim, int icon, EventType eventType);
- void Draw();
+ bool EventProcess(const Event &event);
- void SetDirection(float dir);
- float GetDirection();
+ void Draw();
-protected:
+ void SetDirection(float dir);
+ float GetDirection();
-protected:
- float m_dir;
-};
+ protected:
+
+ protected:
+ float m_dir;
+ };
}
diff --git a/src/ui/control.cpp b/src/ui/control.cpp
index 6adaac2..c5d505e 100644
--- a/src/ui/control.cpp
+++ b/src/ui/control.cpp
@@ -16,29 +16,7 @@
// * along with this program. If not, see http://www.gnu.org/licenses/.
-//#include <windows.h>
-#include <stdio.h>
-//#include <d3d.h>
-
-#include "graphics/core/device.h"
-//#include "common/struct.h"
-//#include "old/d3dengine.h"
-#include "graphics/engine/engine.h"
-#include "common/language.h"
-#include "common/restext.h"
-//#include "old/math3d.h"
-#include "common/event.h"
-#include "common/misc.h"
-#include "object/robotmain.h"
-//#include "old/particule.h"
-#include "graphics/engine/particle.h"
-#include "common/iman.h"
-//#include "old/text.h"
-#include "graphics/engine/text.h"
-//#include "old/sound.h"
-#include "sound/sound.h"
-#include "ui/control.h"
-
+#include "control.h"
namespace Ui {
@@ -60,8 +38,6 @@ CControl::CControl()
m_fontType = Gfx::FONT_COLOBOT;
m_textAlign = Gfx::TEXT_ALIGN_CENTER; //instead m_justify
// m_justif = 0;
- m_name[0] = 0;
- m_tooltip[0] = 0;
m_bFocus = false;
m_bCapture = false;
@@ -84,10 +60,11 @@ CControl::~CControl()
bool CControl::Create(Math::Point pos, Math::Point dim, int icon, EventType eventType)
{
- char text[100];
- char* p;
+ char text[100];
+ std::string str_text;
- if ( eventType == EVENT_NULL ) eventType = GetUniqueEventType();
+ if ( eventType == EVENT_NULL )
+ eventType = GetUniqueEventType();
m_pos = pos;
m_dim = dim;
@@ -99,17 +76,13 @@ bool CControl::Create(Math::Point pos, Math::Point dim, int icon, EventType even
GlintCreate(pos);
GetResource(RES_EVENT, m_eventType, text);
- p = strchr(text, '\\');
- if ( p == 0 )
- {
+ str_text = std::string(text);
+ auto p = str_text.find("\\");
+ if ( p == std::string::npos ) {
if ( icon != -1 )
- {
- strcpy(m_tooltip, text);
- }
- }
- else
- {
- strcpy(m_tooltip, p+1); // text after "\\"
+ m_tooltip = str_text;
+ } else {
+ m_tooltip = str_text.substr(p + 1);
}
return true;
@@ -202,41 +175,21 @@ int CControl::GetIcon()
// Management of the button name.
-void CControl::SetName(char* name, bool bTooltip)
+void CControl::SetName(std::string name, bool bTooltip)
{
- char* p;
-
- if ( bTooltip )
- {
- p = strchr(name, '\\');
- if ( p == 0 )
- {
- strncpy(m_name, name, 100);
- m_name[100-1] = 0;
+ if ( bTooltip ) {
+ auto p = name.find("\\");
+ if ( p == std::string::npos )
+ m_name = name;
+ else {
+ m_tooltip = name.substr(p + 1);
+ m_name = name.substr(0, p);
}
- else
- {
- char buffer[100];
-
- strncpy(m_tooltip, p+1, 100); // text after "\\"
- m_tooltip[100-1] = 0;
-
- strncpy(buffer, name, 100);
- buffer[100-1] = 0;
- p = strchr(buffer, '\\');
- if ( p != 0 ) *p = 0;
- strncpy(m_name, buffer, 100);
- m_name[100-1] = 0;
- }
- }
- else
- {
- strncpy(m_name, name, 100);
- m_name[100-1] = 0;
- }
+ } else
+ m_name = name;
}
-char* CControl::GetName()
+std::string CControl::GetName()
{
return m_name;
}
@@ -298,21 +251,21 @@ Gfx::FontType CControl::GetFontType()
// Specifies the tooltip.
-bool CControl::SetTooltip(const char* name)
+bool CControl::SetTooltip(std::string name)
{
- strcpy(m_tooltip, name);
+ m_tooltip = name;
return true;
}
-bool CControl::GetTooltip(Math::Point pos, char* name)
+bool CControl::GetTooltip(Math::Point pos, std::string &name)
{
- if ( m_tooltip[0] == 0 ) return false;
- if ( (m_state & STATE_VISIBLE) == 0 ) return false;
+ if ( m_tooltip.length() == 0 ) return false;
+ if ( (m_state & STATE_VISIBLE) == 0 ) return false;
if ( (m_state & STATE_ENABLE) == 0 ) return false;
if ( m_state & STATE_DEAD ) return false;
if ( !Detect(pos) ) return false;
- strcpy(name, m_tooltip);
+ name = m_tooltip;
return true;
}
@@ -454,7 +407,7 @@ void CControl::GlintFrame(const Event &event)
(m_state & STATE_ENABLE ) == 0 ||
(m_state & STATE_VISIBLE) == 0 ) return;
- if ( !m_main->RetGlint() ) return;
+ if ( !m_main->GetGlint() ) return;
m_glintProgress += event.rTime;
diff --git a/src/ui/control.h b/src/ui/control.h
index c3a35f4..48c3ef9 100644
--- a/src/ui/control.h
+++ b/src/ui/control.h
@@ -1,5 +1,6 @@
// * This file is part of the COLOBOT source code
// * Copyright (C) 2001-2008, Daniel ROUX & EPSITEC SA, www.epsitec.ch
+// * Copyright (C) 2012 Polish Portal of Colobot (PPC)
// *
// * 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
@@ -18,129 +19,130 @@
#pragma once
+#include <string>
-//#include "old/text.h"
-#include "graphics/engine/text.h"
-//#include "common/struct.h"
-#include "common/event.h"
+#include <common/event.h>
+#include <common/iman.h>
+#include <common/language.h>
+#include <common/misc.h>
+#include <common/restext.h>
+
+#include <graphics/core/device.h>
+#include <graphics/engine/engine.h>
+#include <graphics/engine/particle.h>
+#include <graphics/engine/text.h>
+
+#include <object/robotmain.h>
+
+#include <sound/sound.h>
-namespace Gfx {
-class CEngine;
-class CParticle;
-};
-class CInstanceManager;
-class CEvent;
-//class Gfx::CEngine;
-class CRobotMain;
-//class Gfx::CParticle;
-class CSoundInterface;
namespace Ui {
-enum ControlState
-{
- STATE_ENABLE = (1<<0), // active
- STATE_CHECK = (1<<1), // pressed
- STATE_HILIGHT = (1<<2), // overflown by mouse
- STATE_PRESS = (1<<3), // pressed by mouse
- STATE_VISIBLE = (1<<4), // visible
- STATE_DEAD = (1<<5), // inaccessible (x)
- STATE_DEFAULT = (1<<6), // actuated by RETURN
- STATE_OKAY = (1<<7), // green point at the bottom right
- STATE_SHADOW = (1<<8), // shadow
- STATE_GLINT = (1<<9), // dynamic reflection
- STATE_CARD = (1<<10), // tab
- STATE_EXTEND = (1<<11), // extended mode
- STATE_SIMPLY = (1<<12), // undecorated
- STATE_FRAME = (1<<13), // framework highlighting
- STATE_WARNING = (1<<14), // framework hatched yellow / black
- STATE_VALUE = (1<<15), // displays the value
- STATE_RUN = (1<<16) // running program
-};
-
-
-
-class CControl
-{
-public:
-// CControl(CInstanceManager* iMan);
- CControl ();
- virtual ~CControl();
-
- virtual bool Create(Math::Point pos, Math::Point dim, int icon, EventType eventType);
-
- virtual bool EventProcess(const Event &event);
-
- virtual void SetPos(Math::Point pos);
- virtual Math::Point GetPos();
- virtual void SetDim(Math::Point dim);
- virtual Math::Point GetDim();
- virtual bool SetState(int state, bool bState);
- virtual bool SetState(int state);
- virtual bool ClearState(int state);
- virtual bool TestState(int state);
- virtual int GetState();
- virtual void SetIcon(int icon);
- virtual int GetIcon();
- virtual void SetName(char* name, bool bTooltip=true);
- virtual char* GetName();
- virtual void SetTextAlign(Gfx::TextAlign mode);
- virtual int GetTextAlign();
- virtual void SetFontSize(float size);
- virtual float GetFontSize();
- virtual void SetFontStretch(float stretch);
- virtual float GetFontStretch();
- virtual void SetFontType(Gfx::FontType font);
- virtual Gfx::FontType GetFontType();
- virtual bool SetTooltip(const char* name);
- virtual bool GetTooltip(Math::Point pos, char* name);
- virtual void SetFocus(bool bFocus);
- virtual bool GetFocus();
-
- virtual EventType GetEventType();
-
- virtual void Draw();
-
-protected:
- void GlintDelete();
- void GlintCreate(Math::Point ref, bool bLeft=true, bool bUp=true);
- void GlintFrame(const Event &event);
- void DrawPart(int icon, float zoom, float ex);
- void DrawIcon(Math::Point pos, Math::Point dim, Math::Point uv1, Math::Point uv2, float ex=0.0f);
- void DrawIcon(Math::Point pos, Math::Point dim, Math::Point uv1, Math::Point uv2, Math::Point corner, float ex);
- void DrawWarning(Math::Point pos, Math::Point dim);
- void DrawShadow(Math::Point pos, Math::Point dim, float deep=1.0f);
- virtual bool Detect(Math::Point pos);
-
-protected:
- CInstanceManager* m_iMan;
- Gfx::CEngine* m_engine;
- CEventQueue* m_event;
- CRobotMain* m_main;
- Gfx::CParticle* m_particle;
- CSoundInterface* m_sound;
-
- Math::Point m_pos; // corner upper / left
- Math::Point m_dim; // dimensions
- int m_icon;
- EventType m_eventType; // message to send when clicking
- int m_state; // states (STATE_ *)
- float m_fontSize; // size of the button name
- float m_fontStretch; // stretch of the font
- Gfx::FontType m_fontType; // type of font
- Gfx::TextAlign m_textAlign; //type of alignment //comes in the place of m_justif
-// int m_justif; // type of justification (-1,0,1)
- char m_name[100]; // name of the button
- char m_tooltip[100]; // name of tooltip
- bool m_bFocus;
- bool m_bCapture;
-
- bool m_bGlint;
- Math::Point m_glintCorner1;
- Math::Point m_glintCorner2;
- float m_glintProgress;
- Math::Point m_glintMouse;
-};
+ enum ControlState
+ {
+ STATE_ENABLE = (1<<0), // active
+ STATE_CHECK = (1<<1), // pressed
+ STATE_HILIGHT = (1<<2), // overflown by mouse
+ STATE_PRESS = (1<<3), // pressed by mouse
+ STATE_VISIBLE = (1<<4), // visible
+ STATE_DEAD = (1<<5), // inaccessible (x)
+ STATE_DEFAULT = (1<<6), // actuated by RETURN
+ STATE_OKAY = (1<<7), // green point at the bottom right
+ STATE_SHADOW = (1<<8), // shadow
+ STATE_GLINT = (1<<9), // dynamic reflection
+ STATE_CARD = (1<<10), // tab
+ STATE_EXTEND = (1<<11), // extended mode
+ STATE_SIMPLY = (1<<12), // undecorated
+ STATE_FRAME = (1<<13), // framework highlighting
+ STATE_WARNING = (1<<14), // framework hatched yellow / black
+ STATE_VALUE = (1<<15), // displays the value
+ STATE_RUN = (1<<16) // running program
+ };
+
+
+
+ class CControl
+ {
+ public:
+ // CControl(CInstanceManager* iMan);
+ CControl ();
+ virtual ~CControl();
+
+ virtual bool Create(Math::Point pos, Math::Point dim, int icon, EventType eventType);
+
+ virtual bool EventProcess(const Event &event);
+
+ virtual void SetPos(Math::Point pos);
+ virtual Math::Point GetPos();
+ virtual void SetDim(Math::Point dim);
+ virtual Math::Point GetDim();
+ virtual bool SetState(int state, bool bState);
+ virtual bool SetState(int state);
+ virtual bool ClearState(int state);
+ virtual bool TestState(int state);
+ virtual int GetState();
+ virtual void SetIcon(int icon);
+ virtual int GetIcon();
+ virtual void SetName(std::string name, bool bTooltip=true);
+ virtual std::string GetName();
+ virtual void SetTextAlign(Gfx::TextAlign mode);
+ virtual int GetTextAlign();
+ virtual void SetFontSize(float size);
+ virtual float GetFontSize();
+ virtual void SetFontStretch(float stretch);
+ virtual float GetFontStretch();
+ virtual void SetFontType(Gfx::FontType font);
+ virtual Gfx::FontType GetFontType();
+ virtual bool SetTooltip(std::string name);
+ virtual bool GetTooltip(Math::Point pos, std::string &name);
+ virtual void SetFocus(bool bFocus);
+ virtual bool GetFocus();
+
+ virtual EventType GetEventType();
+
+ virtual void Draw();
+
+ protected:
+ void GlintDelete();
+ void GlintCreate(Math::Point ref, bool bLeft=true, bool bUp=true);
+ void GlintFrame(const Event &event);
+ void DrawPart(int icon, float zoom, float ex);
+ void DrawIcon(Math::Point pos, Math::Point dim, Math::Point uv1, Math::Point uv2, float ex=0.0f);
+ void DrawIcon(Math::Point pos, Math::Point dim, Math::Point uv1, Math::Point uv2, Math::Point corner, float ex);
+ void DrawWarning(Math::Point pos, Math::Point dim);
+ void DrawShadow(Math::Point pos, Math::Point dim, float deep=1.0f);
+ virtual bool Detect(Math::Point pos);
+
+ protected:
+ CInstanceManager* m_iMan;
+ Gfx::CEngine* m_engine;
+ CEventQueue* m_event;
+ CRobotMain* m_main;
+ Gfx::CParticle* m_particle;
+ CSoundInterface* m_sound;
+
+ Math::Point m_pos; // corner upper / left
+ Math::Point m_dim; // dimensions
+ int m_icon;
+ EventType m_eventType; // message to send when clicking
+ int m_state; // states (STATE_ *)
+ float m_fontSize; // size of the button name
+ float m_fontStretch; // stretch of the font
+ Gfx::FontType m_fontType; // type of font
+ Gfx::TextAlign m_textAlign; //type of alignment //comes in the place of m_justif
+ // int m_justif; // type of justification (-1,0,1)
+ std::string m_name; // name of the button
+ std::string m_tooltip; // name of tooltip
+ bool m_bFocus;
+ bool m_bCapture;
+
+ bool m_bGlint;
+ Math::Point m_glintCorner1;
+ Math::Point m_glintCorner2;
+ float m_glintProgress;
+ Math::Point m_glintMouse;
+ };
}
diff --git a/src/ui/displayinfo.cpp b/src/ui/displayinfo.cpp
index bbd3740..2cba9e3 100644
--- a/src/ui/displayinfo.cpp
+++ b/src/ui/displayinfo.cpp
@@ -18,37 +18,32 @@
// displayinfo.cpp
-//#include <windows.h>
-//#include <stdio.h>
-//#include <d3d.h>
+#include "displayinfo.h"
-//#include "common/struct.h"
-//#include "old/d3dengine.h"
-//#include "old/d3dmath.h"
-#include "graphics/engine/engine.h"
+#include "interface.h"
+#include "button.h"
+#include "slider.h"
+#include "edit.h"
+#include "group.h"
+#include "window.h"
+
+#include "common/iman.h"
#include "common/language.h"
-#include "common/event.h"
#include "common/misc.h"
-#include "common/iman.h"
#include "common/restext.h"
-//#include "old/math3d.h"
-#include "object/robotmain.h"
-//#include "old/camera.h"
+
+#include "graphics/core/light.h"
+#include "graphics/engine/engine.h"
+#include "graphics/engine/lightman.h"
+#include "graphics/engine/particle.h"
+
#include "object/object.h"
+#include "object/robotmain.h"
#include "object/motion/motion.h"
#include "object/motion/motiontoto.h"
-#include "ui/interface.h"
-#include "ui/button.h"
-#include "ui/slider.h"
-#include "ui/edit.h"
-#include "ui/group.h"
-#include "ui/window.h"
-//#include "old/particule.h"
-#include "graphics/engine/particle.h"
-//#include "old/light.h"
-//#include "old/text.h"
+
#include "script/cbottoken.h"
-#include "ui/displayinfo.h"
+
@@ -67,7 +62,7 @@ CDisplayInfo::CDisplayInfo()
m_main = static_cast <CRobotMain*> (m_iMan->SearchInstance(CLASS_MAIN));
m_camera = static_cast <Gfx::CCamera*> (m_iMan->SearchInstance(CLASS_CAMERA));
m_particle = static_cast <Gfx::CParticle*> (m_iMan->SearchInstance(CLASS_PARTICULE));
- m_light = static_cast <Gfx::CLight*> (m_iMan->SearchInstance(CLASS_LIGHT));
+ m_light = static_cast <Gfx::CLightManager*> (m_iMan->SearchInstance(CLASS_LIGHT));
m_bInfoMaximized = true;
m_bInfoMinimized = false;
@@ -338,9 +333,9 @@ void CDisplayInfo::HyperUpdate()
// Beginning of the display of information.
-void CDisplayInfo::StartDisplayInfo(char *filename, int index, bool bSoluce)
+void CDisplayInfo::StartDisplayInfo(std::string filename, int index, bool bSoluce)
{
- Gfx::CLight light;
+ Gfx::Light light;
Math::Point pos, dim;
Ui::CWindow* pw;
Ui::CEdit* edit;
@@ -389,8 +384,8 @@ void CDisplayInfo::StartDisplayInfo(char *filename, int index, bool bSoluce)
edit->SetMaxChar(10000);
edit->SetFontType(Gfx::FONT_COLOBOT);
edit->SetSoluceMode(bSoluce);
- edit->ReadText(filename);
- edit->HyperHome(filename);
+ edit->ReadText(filename.c_str());
+ edit->HyperHome(filename.c_str());
edit->SetEditCap(false); // just to see!
edit->SetHiliteCap(false);
edit->SetFocus(true);
@@ -435,7 +430,7 @@ void CDisplayInfo::StartDisplayInfo(char *filename, int index, bool bSoluce)
button->SetState(STATE_SHADOW);
slider = pw->CreateSlider(pos, dim, 0, EVENT_STUDIO_SIZE);
slider->SetState(STATE_SHADOW);
- slider->SetVisibleValue((m_main->RetFontSize()-9.0f)/6.0f);
+ slider->SetVisibleValue((m_main->GetFontSize()-9.0f)/6.0f);
button = pw->CreateButton(pos, dim, 61, EVENT_HYPER_COPY);
button->SetState(STATE_SHADOW);
HyperUpdate();
@@ -464,16 +459,14 @@ void CDisplayInfo::StartDisplayInfo(char *filename, int index, bool bSoluce)
toto->StartDisplayInfo();
}
}
-// TODO
- ZeroMemory(&light, sizeof(light));
- light.dltType = D3DLIGHT_DIRECTIONAL;
- light.dcvDiffuse.r = 1.0f;
- light.dcvDiffuse.g = 1.0f;
- light.dcvDiffuse.b = 1.0f;
- light.dvDirection = D3DVECTOR(1.0f, 0.0f, 1.0f);
+
+ light.type = Gfx::LIGHT_DIRECTIONAL;
+ light.diffuse = Gfx::Color(1.0f, 0.1f, 0.1f);
+ light.direction = Math::Vector(1.0f, 0.0f, 1.0f);
+
m_lightSuppl = m_light->CreateLight();
m_light->SetLight(m_lightSuppl, light);
- m_light->SetLightExcluType(m_lightSuppl, TYPETERRAIN);
+ m_light->SetLightExcludeType(m_lightSuppl, Gfx::ENG_OBJTYPE_TERRAIN);
}
// Repositions all controls editing.
@@ -719,7 +712,7 @@ void CDisplayInfo::UpdateIndexButton()
if ( button != 0 )
{
button->SetState(STATE_CHECK, m_index==SATCOM_HUSTON);
- filename = m_main->RetDisplayInfoName(SATCOM_HUSTON);
+ filename = m_main->GetDisplayInfoName(SATCOM_HUSTON);
button->SetState(STATE_VISIBLE, filename[0]!=0);
}
@@ -727,7 +720,7 @@ void CDisplayInfo::UpdateIndexButton()
if ( button != 0 )
{
button->SetState(STATE_CHECK, m_index==SATCOM_SAT);
- filename = m_main->RetDisplayInfoName(SATCOM_SAT);
+ filename = m_main->GetDisplayInfoName(SATCOM_SAT);
button->SetState(STATE_VISIBLE, filename[0]!=0);
}
@@ -735,7 +728,7 @@ void CDisplayInfo::UpdateIndexButton()
//? if ( button != 0 )
//? {
//? button->SetState(STATE_CHECK, m_index==SATCOM_OBJECT);
-//? filename = m_main->RetDisplayInfoName(SATCOM_OBJECT);
+//? filename = m_main->GetDisplayInfoName(SATCOM_OBJECT);
//? button->SetState(STATE_VISIBLE, filename[0]!=0);
//? }
@@ -744,7 +737,7 @@ void CDisplayInfo::UpdateIndexButton()
if ( button != 0 )
{
button->SetState(STATE_CHECK, m_index==SATCOM_LOADING);
- loading = m_main->RetDisplayInfoName(SATCOM_LOADING);
+ loading = m_main->GetDisplayInfoName(SATCOM_LOADING);
button->SetState(STATE_VISIBLE, loading[0]!=0);
}
@@ -752,7 +745,7 @@ void CDisplayInfo::UpdateIndexButton()
if ( button != 0 )
{
button->SetState(STATE_CHECK, m_index==SATCOM_PROG);
- filename = m_main->RetDisplayInfoName(SATCOM_PROG);
+ filename = m_main->GetDisplayInfoName(SATCOM_PROG);
button->SetState(STATE_VISIBLE, filename[0]!=0 && (m_index==SATCOM_LOADING||m_index==SATCOM_PROG||(loading!=0&&loading[0]==0)));
}
@@ -760,7 +753,7 @@ void CDisplayInfo::UpdateIndexButton()
if ( button != 0 )
{
button->SetState(STATE_CHECK, m_index==SATCOM_SOLUCE);
- filename = m_main->RetDisplayInfoName(SATCOM_SOLUCE);
+ filename = m_main->GetDisplayInfoName(SATCOM_SOLUCE);
button->SetState(STATE_VISIBLE, filename[0]!=0 && m_bSoluce);
}
@@ -858,12 +851,12 @@ void CDisplayInfo::StopDisplayInfo()
m_engine->SetDrawWorld(true); // draws all on the interface
m_engine->SetDrawFront(false); // draws nothing on the interface
m_particle->SetFrameUpdate(Gfx::SH_WORLD, true);
- m_particle->FlushParticule(Gfx::SH_FRONT);
- m_particle->FlushParticule(Gfx::SH_INTERFACE);
+ m_particle->FlushParticle(Gfx::SH_FRONT);
+ m_particle->FlushParticle(Gfx::SH_INTERFACE);
if ( m_toto != 0 )
{
- toto = (CMotionToto*)m_toto->GetMotion();
+ toto = static_cast<CMotionToto*>(m_toto->GetMotion());
if ( toto != 0 )
{
toto->StopDisplayInfo();
@@ -915,7 +908,7 @@ void CDisplayInfo::ViewDisplayInfo()
{
Ui::CWindow* pw;
Ui::CEdit* edit;
- Math::Point dim;
+ Math::IntPoint dim;
pw = static_cast<Ui::CWindow*>(m_interface->SearchControl(EVENT_WINDOW4));
if ( pw == 0 ) return;
@@ -923,7 +916,7 @@ void CDisplayInfo::ViewDisplayInfo()
edit = static_cast<Ui::CEdit*>(pw->SearchControl(EVENT_EDIT1));
if ( edit == 0 ) return;
- dim = m_engine->GetDim();
+ dim = m_engine->GetWindowSize();
edit->SetFontSize(m_main->GetFontSize()/(dim.x / 640.0f));
}
diff --git a/src/ui/displayinfo.h b/src/ui/displayinfo.h
index 1eaa39b..2eabbf2 100644
--- a/src/ui/displayinfo.h
+++ b/src/ui/displayinfo.h
@@ -19,83 +19,81 @@
#pragma once
+#include <string>
-#include "common/struct.h"
-#include "old/camera.h"
+#include "common/event.h"
+#include "graphics/engine/camera.h"
class CInstanceManager;
-//class CD3DEngine;
-class CEvent;
class CRobotMain;
-//class CCamera;
-
class CObject;
-//class CLight;
+class CEventQueue;
+
+struct Event;
namespace Gfx {
-class CEngine;
-class Camera;
-class Particle;
-class CLight;
+ class CEngine;
+ class CParticle;
+ class CLightManager;
}
namespace Ui {
-class CInterface;
-
-class CDisplayInfo
-{
-public:
-// CDisplayInfo(CInstanceManager* iMan);
- CDisplayInfo();
- ~CDisplayInfo();
-
- bool EventProcess(const Event &event);
-
- void StartDisplayInfo(char *filename, int index, bool bSoluce);
- void StopDisplayInfo();
-
- void SetPosition(int pos);
- int GetPosition();
-
-protected:
- bool EventFrame(const Event &event);
- void HyperUpdate();
- void AdjustDisplayInfo(Math::Point wpos, Math::Point wdim);
- void ChangeIndexButton(int index);
- void UpdateIndexButton();
- void UpdateCopyButton();
- void ViewDisplayInfo();
- CObject* SearchToto();
- void CreateObjectsFile();
-
-protected:
- CInstanceManager* m_iMan;
- Gfx::CEngine* m_engine;
- CEventQueue* m_event;
- CRobotMain* m_main;
- Gfx::CCamera* m_camera;
- CInterface* m_interface;
- Gfx::CParticle* m_particle;
- Gfx::CLight* m_light;
-
- bool m_bInfoMaximized;
- bool m_bInfoMinimized;
-
- int m_index;
- Gfx::CameraType m_infoCamera;
- Math::Point m_infoNormalPos;
- Math::Point m_infoNormalDim;
- Math::Point m_infoActualPos;
- Math::Point m_infoActualDim;
- Math::Point m_infoFinalPos;
- Math::Point m_infoFinalDim;
- int m_lightSuppl;
- bool m_bEditLock;
- bool m_bInitPause;
- bool m_bSoluce;
- CObject* m_toto;
-};
+ class CInterface;
+
+ class CDisplayInfo
+ {
+ public:
+ // CDisplayInfo(CInstanceManager* iMan);
+ CDisplayInfo();
+ ~CDisplayInfo();
+
+ bool EventProcess(const Event &event);
+
+ void StartDisplayInfo(std::string filename, int index, bool bSoluce);
+ void StopDisplayInfo();
+
+ void SetPosition(int pos);
+ int GetPosition();
+
+ protected:
+ bool EventFrame(const Event &event);
+ void HyperUpdate();
+ void AdjustDisplayInfo(Math::Point wpos, Math::Point wdim);
+ void ChangeIndexButton(int index);
+ void UpdateIndexButton();
+ void UpdateCopyButton();
+ void ViewDisplayInfo();
+ CObject* SearchToto();
+ void CreateObjectsFile();
+
+ protected:
+ CInstanceManager* m_iMan;
+ Gfx::CEngine* m_engine;
+ CEventQueue* m_event;
+ CRobotMain* m_main;
+ Gfx::CCamera* m_camera;
+ CInterface* m_interface;
+ Gfx::CParticle* m_particle;
+ Gfx::CLightManager* m_light;
+
+ bool m_bInfoMaximized;
+ bool m_bInfoMinimized;
+
+ int m_index;
+ Gfx::CameraType m_infoCamera;
+ Math::Point m_infoNormalPos;
+ Math::Point m_infoNormalDim;
+ Math::Point m_infoActualPos;
+ Math::Point m_infoActualDim;
+ Math::Point m_infoFinalPos;
+ Math::Point m_infoFinalDim;
+ int m_lightSuppl;
+ bool m_bEditLock;
+ bool m_bInitPause;
+ bool m_bSoluce;
+ CObject* m_toto;
+ };
}
diff --git a/src/ui/displaytext.cpp b/src/ui/displaytext.cpp
index 3fe8cdb..aa51653 100644
--- a/src/ui/displaytext.cpp
+++ b/src/ui/displaytext.cpp
@@ -18,29 +18,26 @@
// displaytext.cpp
-//#include <windows.h>
-//#include <stdio.h>
-//#include <d3d.h>
+#include "displaytext.h"
+
+#include "interface.h"
+#include "button.h"
+#include "label.h"
+#include "window.h"
+#include "group.h"
-//#include "common/struct.h"
-//#include "old/d3dengine.h"
-#include "graphics/engine/engine.h"
#include "common/event.h"
+#include "common/iman.h"
#include "common/misc.h"
#include "common/restext.h"
-#include "common/iman.h"
+
+#include "graphics/engine/engine.h"
+
#include "object/object.h"
#include "object/motion/motion.h"
#include "object/motion/motiontoto.h"
-#include "ui/interface.h"
-#include "ui/button.h"
-#include "ui/label.h"
-#include "ui/window.h"
-#include "ui/group.h"
-//#include "old/text.h"
-//#include "old/sound.h"
-//#include "sound/sound.h"
-#include "ui/displaytext.h"
+
+
namespace Ui {
@@ -183,7 +180,7 @@ void CDisplayText::DisplayError(Error err, Math::Vector goal, float height,
// Displays text.
-void CDisplayText::DisplayText(const char *text, CObject* pObj,
+void CDisplayText::DisplayText(char *text, CObject* pObj,
float time, TextType type)
{
Math::Vector pos;
@@ -199,7 +196,7 @@ void CDisplayText::DisplayText(const char *text, CObject* pObj,
// Displays text.
-void CDisplayText::DisplayText(const char *text, Math::Vector goal, float height,
+void CDisplayText::DisplayText(char *text, Math::Vector goal, float height,
float dist, float time, TextType type)
{
CObject* toto;
diff --git a/src/ui/displaytext.h b/src/ui/displaytext.h
index 9268088..b8af97e 100644
--- a/src/ui/displaytext.h
+++ b/src/ui/displaytext.h
@@ -22,8 +22,9 @@
#include "common/event.h"
#include "common/misc.h"
+
#include "sound/sound.h"
-//#include "old/d3dengine.h"
+
class CInstanceManager;
@@ -31,6 +32,10 @@ class CInstanceManager;
class CObject;
class CSound;
+namespace Gfx {
+ class CEngine;
+}
+
namespace Ui {;
class CInterface;
@@ -59,8 +64,8 @@ public:
void DisplayError(Error err, CObject* pObj, float time=10.0f);
void DisplayError(Error err, Math::Vector goal, float height=15.0f, float dist=60.0f, float time=10.0f);
- void DisplayText(const char *text, CObject* pObj, float time=10.0f, TextType type=TT_INFO);
- void DisplayText(const char *text, Math::Vector goal, float height=15.0f, float dist=60.0f, float time=10.0f, TextType type=TT_INFO);
+ void DisplayText(char *text, CObject* pObj, float time=10.0f, TextType type=TT_INFO);
+ void DisplayText(char *text, Math::Vector goal, float height=15.0f, float dist=60.0f, float time=10.0f, TextType type=TT_INFO);
void HideText(bool bHide);
void ClearText();
bool ClearLastText();
diff --git a/src/ui/edit.cpp b/src/ui/edit.cpp
index 86f0011..cc911a4 100644
--- a/src/ui/edit.cpp
+++ b/src/ui/edit.cpp
@@ -18,26 +18,7 @@
// edit.cpp
-#include <stdlib.h>
-#include <stdio.h>
-#include <ctype.h>
-//#include <windows.h>
-//#include <d3d.h>
-
-//#include "common/struct.h"
-//#include "old/d3dengine.h"
-#include "graphics/engine/engine.h"
-#include "common/language.h"
-//#include "old/math3d.h"
-#include "common/event.h"
-#include "common/misc.h"
-#include "common/iman.h"
-#include "common/restext.h"
-#include "ui/scroll.h"
-//#include "old/text.h"
-#include "graphics/engine/text.h"
-//#include "graphics/engine/color.h"
-#include "ui/edit.h"
+#include "edit.h"
namespace Ui {
@@ -96,9 +77,9 @@ CEdit::CEdit () : CControl ()
int i;
m_maxChar = 100;
- m_text = new char* [sizeof(char)*(m_maxChar+1)]; // TODO
- m_format = 0;
+ m_text = new char[sizeof(char)*(m_maxChar+1)];
m_len = 0;
+ m_app = CApplication::GetInstancePointer();
m_fontType = Gfx::FONT_COURIER;
m_scroll = 0;
@@ -139,7 +120,6 @@ CEdit::~CEdit()
}
delete m_text;
- delete m_format;
delete m_scroll;
}
@@ -565,7 +545,7 @@ bool CEdit::IsLinkPos(Math::Point pos)
{
int i;
- if ( m_format == 0 ) return false;
+ if ( m_format.size() == 0 ) return false;
i = MouseDetect(pos);
if ( i == -1 ) return false;
@@ -645,7 +625,7 @@ void CEdit::MouseRelease(Math::Point mouse)
if ( !m_bEdit )
{
- if ( m_format != 0 && i < m_len && m_cursor1 == m_cursor2 &&
+ if ( m_format.size() > 0 && i < m_len && m_cursor1 == m_cursor2 &&
(m_format[i]&Gfx::FONT_MASK_HIGHLIGHT) == Gfx::FONT_HIGHLIGHT_LINK) //TODO
{
rank = -1;
@@ -712,7 +692,7 @@ int CEdit::MouseDetect(Math::Point mouse)
pos.y = m_pos.y+m_dim.y-m_lineHeight-(m_bMulti?MARGY:MARGY1);
for ( i=m_lineFirst ; i<m_lineTotal ; i++ )
{
- bTitle = ( m_format != 0 && (m_format[m_lineOffset[i]]&Gfx::FONT_MASK_TITLE) == Gfx::FONT_TITLE_BIG );
+ bTitle = ( m_format.size() > 0 && (m_format[m_lineOffset[i]]&Gfx::FONT_MASK_TITLE) == Gfx::FONT_TITLE_BIG );
if ( i >= m_lineFirst+m_lineVisible ) break;
@@ -729,12 +709,12 @@ int CEdit::MouseDetect(Math::Point mouse)
{
len = m_lineOffset[i+1] - m_lineOffset[i];
- if ( m_format == 0 )
+ if ( m_format.size() == 0 )
{
// c = m_engine->GetText()->Detect(m_text+m_lineOffset[i],
// len, offset, m_fontSize,
// m_fontStretch, m_fontType);
- c = m_engine->GetText()->Detect(m_text+m_lineOffset[i], m_fontType, m_fontSize, offset); // TODO check if good
+ c = m_engine->GetText()->Detect(std::string(m_text+m_lineOffset[i]), m_fontType, m_fontSize, offset); // TODO check if good
}
else
{
@@ -745,7 +725,10 @@ int CEdit::MouseDetect(Math::Point mouse)
// m_format+m_lineOffset[i],
// len, offset, size,
// m_fontStretch);
- c = m_engine->GetText()->Detect(m_text+m_lineOffset[i],m_format+m_lineOffset[i], size, offset); // TODO check if good
+ c = m_engine->GetText()->Detect(std::string(m_text+m_lineOffset[i]),
+ std::vector<Gfx::FontMetaChar>(m_format.begin()+m_lineOffset[i], m_format.end()),
+ size,
+ offset); // TODO check if good
}
return m_lineOffset[i]+c;
}
@@ -767,7 +750,7 @@ void CEdit::HyperFlush()
// Indicates which is the home page.
-void CEdit::HyperHome(char *filename)
+void CEdit::HyperHome(const char *filename)
{
HyperFlush();
HyperAdd(filename, 0);
@@ -775,7 +758,7 @@ void CEdit::HyperHome(char *filename)
// Performs a hyper jump through a link.
-void CEdit::HyperJump(char *name, char *marker)
+void CEdit::HyperJump(const char *name, const char *marker)
{
char filename[100];
char sMarker[100];
@@ -826,7 +809,7 @@ void CEdit::HyperJump(char *name, char *marker)
// Adds text to the history of visited.
-bool CEdit::HyperAdd(char *filename, int firstLine)
+bool CEdit::HyperAdd(const char *filename, int firstLine)
{
if ( m_historyCurrent >= EDITHISTORYMAX-1 ) return false;
@@ -958,7 +941,7 @@ void CEdit::Draw()
size = m_fontSize;
// Headline \b;?
- if ( beg+len < m_len && m_format != 0 &&
+ if ( beg+len < m_len && m_format.size() > 0 &&
(m_format[beg]&Gfx::FONT_MASK_TITLE) == Gfx::FONT_TITLE_BIG )
{
start.x = ppos.x-MARGX;
@@ -972,7 +955,7 @@ void CEdit::Draw()
}
// As \t;?
- if ( beg+len < m_len && m_format != 0 &&
+ if ( beg+len < m_len && m_format.size() > 0 &&
(m_format[beg]&Gfx::FONT_MASK_TITLE) == Gfx::FONT_TITLE_NORM )
{
start.x = ppos.x-MARGX;
@@ -983,7 +966,7 @@ void CEdit::Draw()
}
// Subtitle \s;?
- if ( beg+len < m_len && m_format != 0 &&
+ if ( beg+len < m_len && m_format.size() > 0 &&
(m_format[beg]&Gfx::FONT_MASK_TITLE) == Gfx::FONT_TITLE_LITTLE )
{
start.x = ppos.x-MARGX;
@@ -994,7 +977,7 @@ void CEdit::Draw()
}
// Table \tab;?
- if ( beg+len < m_len && m_format != 0 &&
+ if ( beg+len < m_len && m_format.size() > 0 &&
(m_format[beg]&Gfx::FONT_MASK_HIGHLIGHT) == Gfx::FONT_HIGHLIGHT_TABLE )
{
start.x = ppos.x-MARGX;
@@ -1005,7 +988,7 @@ void CEdit::Draw()
}
// Image \image; ?
- if ( beg+len < m_len && m_format != 0 &&
+ if ( beg+len < m_len && m_format.size() > 0 &&
(m_format[beg]&Gfx::FONT_MASK_IMAGE) != 0 )
{
line = 1;
@@ -1034,20 +1017,24 @@ void CEdit::Draw()
o1 = c1; if ( o1 < beg ) o1 = beg;
o2 = c2; if ( o2 > beg+len ) o2 = beg+len;
- if ( m_format == 0 )
+ if ( m_format.size() == 0 )
{
- start.x = ppos.x+m_engine->GetText()->GetStringWidth(m_text+beg, m_fontType, size);
- end.x = m_engine->GetText()->GetStringWidth(m_text+o1, m_fontType, size);
+ start.x = ppos.x+m_engine->GetText()->GetStringWidth(std::string(m_text+beg), m_fontType, size);
+ end.x = m_engine->GetText()->GetStringWidth(std::string(m_text+o1), m_fontType, size);
}
else
{
- start.x = ppos.x+m_engine->GetText()->GetStringWidth(m_text+beg, m_format+beg, size);
- end.x = m_engine->GetText()->GetStringWidth(m_text+o1, m_format+o1, size);
+ start.x = ppos.x+m_engine->GetText()->GetStringWidth(std::string(m_text+beg),
+ std::vector<Gfx::FontMetaChar>(m_format.begin()+beg, m_format.end()),
+ size);
+ end.x = m_engine->GetText()->GetStringWidth(std::string(m_text+o1),
+ std::vector<Gfx::FontMetaChar>(m_format.begin()+o1, m_format.end()),
+ size);
}
start.y = ppos.y-(m_bMulti?0.0f:MARGY1);
end.y = m_lineHeight;
- if ( m_format != 0 && (m_format[beg]&Gfx::FONT_MASK_TITLE) == Gfx::FONT_TITLE_BIG) end.y *= BIG_FONT;
+ if ( m_format.size() > 0 && (m_format[beg]&Gfx::FONT_MASK_TITLE) == Gfx::FONT_TITLE_BIG) end.y *= BIG_FONT;
DrawPart(start, end, 1); // plain yellow background
}
@@ -1062,13 +1049,19 @@ void CEdit::Draw()
eol = 2; // square (eot)
}
if ( !m_bMulti || !m_bDisplaySpec ) eol = 0;
- if ( m_format == 0 )
+ if ( m_format.size() == 0 )
{
- m_engine->GetText()->DrawText(m_text+beg, m_fontType, size, ppos, m_dim.x, Gfx::TEXT_ALIGN_RIGHT, eol);
+ m_engine->GetText()->DrawText(std::string(m_text+beg), m_fontType, size, ppos, m_dim.x, Gfx::TEXT_ALIGN_RIGHT, eol);
}
else
{
- m_engine->GetText()->DrawText(m_text+beg, m_format+beg, size, ppos, m_dim.x, Gfx::TEXT_ALIGN_RIGHT, eol);
+ m_engine->GetText()->DrawText(std::string(m_text+beg),
+ std::vector<Gfx::FontMetaChar>(m_format.begin()+beg, m_format.end()),
+ size,
+ ppos,
+ m_dim.x,
+ Gfx::TEXT_ALIGN_RIGHT,
+ eol);
}
pos.y -= m_lineHeight;
@@ -1096,16 +1089,16 @@ void CEdit::Draw()
len = m_cursor1 - m_lineOffset[i];
- if ( m_format == 0 )
+ if ( m_format.size() == 0 )
{
- m_engine->GetText()->SizeText(m_text+m_lineOffset[i], m_fontType,
+ m_engine->GetText()->SizeText(std::string(m_text+m_lineOffset[i]), m_fontType,
size, pos, Gfx::TEXT_ALIGN_RIGHT,
start, end);
}
else
{
- m_engine->GetText()->SizeText(m_text+m_lineOffset[i],
- m_format+m_lineOffset[i],
+ m_engine->GetText()->SizeText(std::string(m_text+m_lineOffset[i]),
+ std::vector<Gfx::FontMetaChar>(m_format.begin()+m_lineOffset[i], m_format.end()),
size, pos, Gfx::TEXT_ALIGN_RIGHT,
start, end);
}
@@ -1129,7 +1122,7 @@ void CEdit::Draw()
// Draw an image part.
-void CEdit::DrawImage(Math::Point pos, char *name, float width,
+void CEdit::DrawImage(Math::Point pos, const char *name, float width,
float offset, float height, int nbLine)
{
Math::Point uv1, uv2, dim;
@@ -1242,7 +1235,7 @@ void CEdit::DrawPart(Math::Point pos, Math::Point dim, int icon)
// Give the text to edit.
-void CEdit::SetText(char *text, bool bNew)
+void CEdit::SetText(const char *text, bool bNew)
{
int i, j, font;
bool bBOL;
@@ -1252,7 +1245,7 @@ void CEdit::SetText(char *text, bool bNew)
m_len = strlen(text);
if ( m_len > m_maxChar ) m_len = m_maxChar;
- if ( m_format == 0 )
+ if ( m_format.size() == 0 )
{
if ( m_bAutoIndent )
{
@@ -1382,7 +1375,7 @@ int CEdit::GetTextLength()
// Returns a name in a command.
// \x nom1 nom2 nom3;
-void GetNameParam(char *cmd, int rank, char *buffer)
+void GetNameParam(const char *cmd, int rank, char *buffer)
{
int i;
@@ -1405,7 +1398,7 @@ void GetNameParam(char *cmd, int rank, char *buffer)
// Returns a number of a command.
// \x nom n1 n2;
-int GetValueParam(char *cmd, int rank)
+int GetValueParam(const char *cmd, int rank)
{
int n, i;
@@ -1440,7 +1433,7 @@ void CEdit::FreeImage()
// Reads the texture of an image.
-void CEdit::LoadImage(char *name)
+void CEdit::LoadImage(const char *name)
{
char filename[100];
@@ -1452,7 +1445,7 @@ void CEdit::LoadImage(char *name)
// Read from a text file.
-bool CEdit::ReadText(char *filename, int addSize)
+bool CEdit::ReadText(const char *filename, int addSize)
{
FILE *file = NULL;
char *buffer;
@@ -1482,10 +1475,9 @@ bool CEdit::ReadText(char *filename, int addSize)
buffer = new char[sizeof(char)*(m_maxChar+1)];
fread(buffer, 1, len, file);
- if ( m_format != 0 )
+ if ( m_format.size() > 0 )
{
- delete m_format;
- m_format = new char[sizeof(char)*m_maxChar];
+ m_format.clear();
}
fclose(file);
@@ -1507,7 +1499,7 @@ bool CEdit::ReadText(char *filename, int addSize)
if ( !bBOL )
{
m_text[j] = buffer[i];
- if ( m_format != 0 ) m_format[j] = font;
+ if ( m_format.size() > 0 ) m_format[j] = font;
j ++;
}
i ++;
@@ -1520,7 +1512,7 @@ bool CEdit::ReadText(char *filename, int addSize)
{
i ++;
}
- else if ( m_format != 0 && buffer[i] == '\\' && buffer[i+2] == ';' )
+ else if ( m_format.size() > 0 && buffer[i] == '\\' && buffer[i+2] == ';' )
{
if ( buffer[i+1] == 'n' ) // normal ?
{
@@ -1581,7 +1573,7 @@ bool CEdit::ReadText(char *filename, int addSize)
i += 3;
}
}
- else if ( m_format != 0 &&
+ else if ( m_format.size() > 0 &&
buffer[i+0] == '\\' && // \u marker name; ?
buffer[i+1] == 'u' &&
buffer[i+2] == ' ' )
@@ -1598,7 +1590,7 @@ bool CEdit::ReadText(char *filename, int addSize)
}
i += strchr(buffer+i, ';')-(buffer+i)+1;
}
- else if ( m_format != 0 &&
+ else if ( m_format.size() > 0 &&
buffer[i+0] == '\\' && // \m marker; ?
buffer[i+1] == 'm' &&
buffer[i+2] == ' ' )
@@ -1614,7 +1606,7 @@ bool CEdit::ReadText(char *filename, int addSize)
}
i += strchr(buffer+i, ';')-(buffer+i)+1;
}
- else if ( m_format != 0 &&
+ else if ( m_format.size() > 0 &&
buffer[i+0] == '\\' && // \image name lx ly; ?
buffer[i+1] == 'i' &&
buffer[i+2] == 'm' &&
@@ -1651,7 +1643,7 @@ bool CEdit::ReadText(char *filename, int addSize)
}
i += strchr(buffer+i, ';')-(buffer+i)+1;
}
- else if ( m_format != 0 &&
+ else if ( m_format.size() > 0 &&
buffer[i+0] == '\\' && // \button; ?
buffer[i+1] == 'b' &&
buffer[i+2] == 'u' &&
@@ -1669,7 +1661,7 @@ bool CEdit::ReadText(char *filename, int addSize)
}
i += strchr(buffer+i, ';')-(buffer+i)+1;
}
- else if ( m_format != 0 &&
+ else if ( m_format.size() > 0 &&
buffer[i+0] == '\\' && // \token; ?
buffer[i+1] == 't' &&
buffer[i+2] == 'o' &&
@@ -1685,7 +1677,7 @@ bool CEdit::ReadText(char *filename, int addSize)
}
i += 7;
}
- else if ( m_format != 0 &&
+ else if ( m_format.size() > 0 &&
buffer[i+0] == '\\' && // \type; ?
buffer[i+1] == 't' &&
buffer[i+2] == 'y' &&
@@ -1700,7 +1692,7 @@ bool CEdit::ReadText(char *filename, int addSize)
}
i += 6;
}
- else if ( m_format != 0 &&
+ else if ( m_format.size() > 0 &&
buffer[i+0] == '\\' && // \const; ?
buffer[i+1] == 'c' &&
buffer[i+2] == 'o' &&
@@ -1716,7 +1708,7 @@ bool CEdit::ReadText(char *filename, int addSize)
}
i += 7;
}
- else if ( m_format != 0 &&
+ else if ( m_format.size() > 0 &&
buffer[i+0] == '\\' && // \key; ?
buffer[i+1] == 'k' &&
buffer[i+2] == 'e' &&
@@ -1730,7 +1722,7 @@ bool CEdit::ReadText(char *filename, int addSize)
}
i += 5;
}
- else if ( m_format != 0 &&
+ else if ( m_format.size() > 0 &&
buffer[i+0] == '\\' && // \tab; ?
buffer[i+1] == 't' &&
buffer[i+2] == 'a' &&
@@ -1743,7 +1735,7 @@ bool CEdit::ReadText(char *filename, int addSize)
}
i += 5;
}
- else if ( m_format != 0 &&
+ else if ( m_format.size() > 0 &&
buffer[i+0] == '\\' && // \norm; ?
buffer[i+1] == 'n' &&
buffer[i+2] == 'o' &&
@@ -1757,7 +1749,7 @@ bool CEdit::ReadText(char *filename, int addSize)
}
i += 6;
}
- else if ( m_format != 0 &&
+ else if ( m_format.size() > 0 &&
buffer[i+0] == '\\' && // \begin soluce; ?
buffer[i+1] == 'b' &&
buffer[i+2] == 's' &&
@@ -1766,7 +1758,7 @@ bool CEdit::ReadText(char *filename, int addSize)
bInSoluce = true;
i += 4;
}
- else if ( m_format != 0 &&
+ else if ( m_format.size() > 0 &&
buffer[i+0] == '\\' && // \end soluce; ?
buffer[i+1] == 'e' &&
buffer[i+2] == 's' &&
@@ -1775,7 +1767,7 @@ bool CEdit::ReadText(char *filename, int addSize)
bInSoluce = false;
i += 4;
}
- else if ( m_format != 0 &&
+ else if ( m_format.size() > 0 &&
buffer[i+0] == '\\' && // \key name; ?
buffer[i+1] == 'k' &&
buffer[i+2] == 'e' &&
@@ -1786,7 +1778,7 @@ bool CEdit::ReadText(char *filename, int addSize)
{
if ( SearchKey(buffer+i+5, key) )
{
- res = m_engine->GetKey(key, 0); // TODO
+ res = m_app->GetKey(key, 0); // TODO
if ( res != 0 )
{
if ( GetResource(RES_KEY, res, iName) )
@@ -1805,7 +1797,7 @@ bool CEdit::ReadText(char *filename, int addSize)
m_format[j] = font;
j ++;
- res = m_engine->GetKey(key, 1); // TODO
+ res = m_app->GetKey(key, 1); // TODO
if ( res != 0 )
{
if ( GetResource(RES_KEY, res, iName) )
@@ -1846,7 +1838,7 @@ bool CEdit::ReadText(char *filename, int addSize)
if ( m_bSoluce || !bInSoluce )
{
m_text[j] = buffer[i];
- if ( m_format != 0 ) m_format[j] = font;
+ if ( m_format.size() > 0 ) m_format[j] = font;
j ++;
}
i ++;
@@ -1871,7 +1863,7 @@ bool CEdit::ReadText(char *filename, int addSize)
// Writes all the text in a file.
-bool CEdit::WriteText(char *filename)
+bool CEdit::WriteText(const char *filename)
{
FILE* file;
char buffer[1000+20];
@@ -1943,10 +1935,9 @@ void CEdit::SetMaxChar(int max)
delete m_text;
m_text = (char*)malloc(sizeof(char)*(m_maxChar+1));
- if ( m_format != 0 )
+ if ( m_format.size() > 0 )
{
- delete m_format;
- m_format = (char*)malloc(sizeof(char)*m_maxChar);
+ m_format.clear();
}
m_len = 0;
@@ -2135,22 +2126,12 @@ bool CEdit::GetDisplaySpec()
void CEdit::SetMultiFont(bool bMulti)
{
- if ( bMulti )
- {
- delete m_format;
- m_format = (char*)malloc(sizeof(char)*m_maxChar);
- memset(m_format, 0, m_maxChar);
- }
- else
- {
- delete m_format;
- m_format = 0;
- }
+ m_format.clear();
}
bool CEdit::GetMultiFont()
{
- return ( m_format != 0 );
+ return ( m_format.size() > 0 );
}
@@ -2439,16 +2420,16 @@ void CEdit::MoveLine(int move, bool bWord, bool bSelect)
column -= indentLength*m_lineIndent[line];
}
- if ( m_format == 0 )
+ if ( m_format.size() == 0 )
{
- c = m_engine->GetText()->Detect(m_text+m_lineOffset[line],
+ c = m_engine->GetText()->Detect(std::string(m_text+m_lineOffset[line]),
m_fontType, m_fontSize,
m_lineOffset[line+1]-m_lineOffset[line]);
}
else
{
- c = m_engine->GetText()->Detect(m_text+m_lineOffset[line],
- m_format+m_lineOffset[line],
+ c = m_engine->GetText()->Detect(std::string(m_text+m_lineOffset[line]),
+ std::vector<Gfx::FontMetaChar>(m_format.begin()+m_lineOffset[line], m_format.end()),
m_fontSize,
m_lineOffset[line+1]-m_lineOffset[line]);
}
@@ -2469,17 +2450,17 @@ void CEdit::ColumnFix()
line = GetCursorLine(m_cursor1);
- if ( m_format == 0 )
+ if ( m_format.size() == 0 )
{
m_column = m_engine->GetText()->GetStringWidth(
- m_text+m_lineOffset[line],
+ std::string(m_text+m_lineOffset[line]),
m_fontType, m_fontSize);
}
else
{
m_column = m_engine->GetText()->GetStringWidth(
- m_text+m_lineOffset[line],
- m_format+m_lineOffset[line],
+ std::string(m_text+m_lineOffset[line]),
+ std::vector<Gfx::FontMetaChar>(m_format.begin()+m_lineOffset[line], m_format.end()),
m_fontSize
);
}
@@ -2497,7 +2478,7 @@ void CEdit::ColumnFix()
bool CEdit::Cut() // TODO MS Windows allocations
{
- HGLOBAL hg;
+ /* HGLOBAL hg;
char* text;
char c;
int c1, c2, start, len, i, j;
@@ -2570,7 +2551,7 @@ bool CEdit::Cut() // TODO MS Windows allocations
DeleteOne(0); // deletes the selected characters
Justif();
ColumnFix();
- SendModifEvent();
+ SendModifEvent();*/
return true;
}
@@ -2578,7 +2559,7 @@ bool CEdit::Cut() // TODO MS Windows allocations
bool CEdit::Copy() // TODO
{
- HGLOBAL hg;
+ /* HGLOBAL hg;
char* text;
char c;
int c1, c2, start, len, i, j;
@@ -2642,7 +2623,7 @@ bool CEdit::Copy() // TODO
return false;
}
CloseClipboard();
-
+*/
return true;
}
@@ -2650,7 +2631,7 @@ bool CEdit::Copy() // TODO
bool CEdit::Paste() // TODO
{
- HANDLE h;
+ /*HANDLE h;
char c;
char* p;
@@ -2688,7 +2669,7 @@ bool CEdit::Paste() // TODO
Justif();
ColumnFix();
- SendModifEvent();
+ SendModifEvent();*/
return true;
}
@@ -2821,7 +2802,7 @@ void CEdit::InsertOne(char character)
{
m_text[i] = m_text[i-1]; // shoot
- if ( m_format != 0 )
+ if ( m_format.size() > 0 )
{
m_format[i] = m_format[i-1]; // shoot
}
@@ -2831,7 +2812,7 @@ void CEdit::InsertOne(char character)
m_text[m_cursor1] = character;
- if ( m_format != 0 )
+ if ( m_format.size() > 0 )
{
m_format[m_cursor1] = 0;
}
@@ -2882,7 +2863,7 @@ void CEdit::DeleteOne(int dir)
{
m_text[i] = m_text[i+hole];
- if ( m_format != 0 )
+ if ( m_format.size() > 0 )
{
m_format[i] = m_format[i+hole];
}
@@ -3074,7 +3055,7 @@ void CEdit::Justif()
width -= indentLength*m_lineIndent[m_lineTotal-1];
}
- if ( m_format == 0 )
+ if ( m_format.size() == 0 )
{
// TODO check if good
i += m_engine->GetText()->Justify(m_text+i, m_fontType,
@@ -3097,8 +3078,10 @@ void CEdit::Justif()
else
{
// TODO check if good
- i += m_engine->GetText()->Justify(m_text+i, m_format+i,
- size, width);
+ i += m_engine->GetText()->Justify(std::string(m_text+i),
+ std::vector<Gfx::FontMetaChar>(m_format.begin()+i, m_format.end()),
+ size,
+ width);
}
}
@@ -3293,11 +3276,11 @@ bool CEdit::UndoRecall()
bool CEdit::ClearFormat()
{
- if ( m_format == 0 )
+ if ( m_format.size() == 0 )
{
SetMultiFont(true);
}
- memset(m_format, m_fontType, m_len);
+ m_format.clear();
return true;
}
@@ -3308,7 +3291,7 @@ bool CEdit::SetFormat(int cursor1, int cursor2, int format)
{
int i;
- if ( m_format == 0 ) return false;
+ if ( m_format.size() == 0 ) return false;
for ( i=cursor1 ; i<cursor2 ; i++ )
{
diff --git a/src/ui/edit.h b/src/ui/edit.h
index 99ec693..22ac577 100644
--- a/src/ui/edit.h
+++ b/src/ui/edit.h
@@ -24,15 +24,26 @@
#pragma once
-//#include "common/struct.h"
-#include "ui/control.h"
+#include <ui/control.h>
+#include <ui/scroll.h>
+
+#include <graphics/engine/engine.h>
+#include <graphics/engine/text.h>
+
+#include <common/language.h>
+#include <common/event.h>
+#include <common/misc.h>
+#include <common/iman.h>
+#include <common/restext.h>
+
+#include <app/app.h>
+
+#include <vector>
+
-namespace Gfx{
-class CEngine;
-};
namespace Ui {
-class CScroll;
+
//! maximum number of characters in CBOT edit
@@ -128,13 +139,13 @@ public:
bool EventProcess(const Event &event);
void Draw();
- void SetText(char *text, bool bNew=true);
+ void SetText(const char *text, bool bNew=true);
void GetText(char *buffer, int max);
char* GetText();
int GetTextLength();
- bool ReadText(char *filename, int addSize=0);
- bool WriteText(char *filename);
+ bool ReadText(const char *filename, int addSize=0);
+ bool WriteText(const char *filename);
void SetMaxChar(int max);
int GetMaxChar();
@@ -176,7 +187,7 @@ public:
bool Undo();
void HyperFlush();
- void HyperHome(char *filename);
+ void HyperHome(const char *filename);
bool HyperTest(EventType event);
bool HyperGo(EventType event);
@@ -195,15 +206,15 @@ protected:
int MouseDetect(Math::Point mouse);
void MoveAdjust();
- void HyperJump(char *name, char *marker);
- bool HyperAdd(char *filename, int firstLine);
+ void HyperJump(const char *name, const char *marker);
+ bool HyperAdd(const char *filename, int firstLine);
- void DrawImage(Math::Point pos, char *name, float width, float offset, float height, int nbLine);
+ void DrawImage(Math::Point pos, const char *name, float width, float offset, float height, int nbLine);
void DrawBack(Math::Point pos, Math::Point dim);
void DrawPart(Math::Point pos, Math::Point dim, int icon);
void FreeImage();
- void LoadImage(char *name);
+ void LoadImage(const char *name);
void Scroll(int pos, bool bAdjustCursor);
void Scroll();
void MoveChar(int move, bool bWord, bool bSelect);
@@ -232,10 +243,11 @@ protected:
int m_maxChar; // max length of the buffer m_text
char* m_text; // text (without zero terminator)
- char* m_format; // format characters
+ std::vector<Gfx::FontMetaChar> m_format; // format characters
int m_len; // length used in m_text
int m_cursor1; // offset cursor
int m_cursor2; // offset cursor
+ CApplication *m_app;
bool m_bMulti; // true -> multi-line
bool m_bEdit; // true -> editable
diff --git a/src/ui/gauge.cpp b/src/ui/gauge.cpp
index cc4eca0..20904f7 100644
--- a/src/ui/gauge.cpp
+++ b/src/ui/gauge.cpp
@@ -18,19 +18,7 @@
// gauge.cpp
-//#include <windows.h>
-//#include <stdio.h>
-//#include <d3d.h>
-
-//#include "common/struct.h"
-//#include "old/d3dengine.h"
-#include "graphics/engine/engine.h"
-//#include "old/math3d.h"
-#include "common/event.h"
-#include "common/misc.h"
-#include "common/iman.h"
-#include "ui/gauge.h"
-
+#include <ui/gauge.h>
namespace Ui {
diff --git a/src/ui/gauge.h b/src/ui/gauge.h
index b745834..8b7ef66 100644
--- a/src/ui/gauge.h
+++ b/src/ui/gauge.h
@@ -19,35 +19,36 @@
#pragma once
+#include <graphics/engine/engine.h>
-#include "ui/control.h"
+#include <common/event.h>
+#include <common/misc.h>
+
+#include <ui/control.h>
-namespace Gfx{
-class CEngine;
-};
namespace Ui {
class CGauge : public CControl
{
-public:
-// CGauge(CInstanceManager* iMan);
- CGauge();
- virtual ~CGauge();
+ public:
+ // CGauge(CInstanceManager* iMan);
+ CGauge();
+ virtual ~CGauge();
- bool Create(Math::Point pos, Math::Point dim, int icon, EventType eventType);
+ bool Create(Math::Point pos, Math::Point dim, int icon, EventType eventType);
- bool EventProcess(const Event &event);
+ bool EventProcess(const Event &event);
- void Draw();
+ void Draw();
- void SetLevel(float level);
- float GetLevel();
+ void SetLevel(float level);
+ float GetLevel();
-protected:
+ protected:
-protected:
- float m_level;
+ protected:
+ float m_level;
};
diff --git a/src/ui/interface.cpp b/src/ui/interface.cpp
index 6c96501..a042899 100644
--- a/src/ui/interface.cpp
+++ b/src/ui/interface.cpp
@@ -162,7 +162,7 @@ CImage* CInterface::CreateImage(Math::Point pos, Math::Point dim, int icon, Even
// Creates a new label.
-CLabel* CInterface::CreateLabel(Math::Point pos, Math::Point dim, int icon, EventType eventMsg, const char *name)
+CLabel* CInterface::CreateLabel(Math::Point pos, Math::Point dim, int icon, EventType eventMsg, std::string name)
{
CLabel* pc = CreateControl<CLabel>(pos, dim, icon, eventMsg);
if (pc != nullptr)
@@ -297,7 +297,7 @@ bool CInterface::EventProcess(const Event &event)
// Gives the tooltip binding to the window.
-bool CInterface::GetTooltip(Math::Point pos, const char* name)
+bool CInterface::GetTooltip(Math::Point pos, std::string &name)
{
for (int i = MAXCONTROL-1; i >= 0; i--) {
if (m_table[i] != nullptr) {
diff --git a/src/ui/interface.h b/src/ui/interface.h
index 02966ff..7123c05 100644
--- a/src/ui/interface.h
+++ b/src/ui/interface.h
@@ -19,6 +19,7 @@
#pragma once
+#include <string>
#include <common/event.h>
#include <common/struct.h>
@@ -30,29 +31,29 @@
#include <graphics/engine/camera.h>
#include <graphics/engine/engine.h>
+#include <ui/control.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/label.h>
+#include <ui/edit.h>
+#include <ui/editvalue.h>
+#include <ui/scroll.h>
+#include <ui/slider.h>
+#include <ui/list.h>
+#include <ui/shortcut.h>
+#include <ui/compass.h>
+#include <ui/target.h>
+#include <ui/map.h>
+#include <ui/window.h>
+
namespace Ui {
const int MAXCONTROL = 100;
-//Forward declaration
-class CButton;
-class CCheck;
-class CColor;
-class CCompass;
-class CControl;
-class CEdit;
-class CEditValue;
-class CGroup;
-class CImage;
-class CKey;
-class CLabel;
-class CList;
-class CMap;
-class CScroll;
-class CShortcut;
-class CSlider;
-class CTarget;
-class CWindow;
class CInterface
{
@@ -61,7 +62,7 @@ class CInterface
~CInterface();
bool EventProcess(const Event &event);
- bool GetTooltip(Math::Point pos, const char* name);
+ bool GetTooltip(Math::Point pos, std::string &name);
void Flush();
CButton* CreateButton(Math::Point pos, Math::Point dim, int icon, EventType eventMsg);
@@ -81,7 +82,7 @@ class CInterface
CWindow* CreateWindows(Math::Point pos, Math::Point dim, int icon, EventType eventMsg);
CList* CreateList(Math::Point pos, Math::Point dim, int icon, EventType eventMsg, float expand=1.2f);
- CLabel* CreateLabel(Math::Point pos, Math::Point dim, int icon, EventType eventMsg, const char *name);
+ CLabel* CreateLabel(Math::Point pos, Math::Point dim, int icon, EventType eventMsg, std::string name);
bool DeleteControl(EventType eventMsg);
CControl* SearchControl(EventType eventMsg);
diff --git a/src/ui/key.cpp b/src/ui/key.cpp
index 0cf74bc..89473a8 100644
--- a/src/ui/key.cpp
+++ b/src/ui/key.cpp
@@ -64,7 +64,7 @@ bool CKey::Create(Math::Point pos, Math::Point dim, int icon, EventType eventMsg
CControl::Create(pos, dim, icon, eventMsg);
GetResource(RES_EVENT, eventMsg, name);
- SetName(name);
+ SetName(std::string(name));
return true;
}
diff --git a/src/ui/maindialog.cpp b/src/ui/maindialog.cpp
index c8759e0..6b071c1 100644
--- a/src/ui/maindialog.cpp
+++ b/src/ui/maindialog.cpp
@@ -17,16 +17,7 @@
// maindialog.cpp
-#include <windows.h>
-#include <stdio.h>
-#include <time.h>
-#include <direct.h>
-#include <io.h>
-#include <d3d.h>
-
#include "common/struct.h"
-#include "old/d3dengine.h"
-#include "old/d3dmath.h"
#include "common/global.h"
#include "common/language.h"
#include "common/event.h"
@@ -34,8 +25,6 @@
#include "common/profile.h"
#include "common/iman.h"
#include "common/restext.h"
-#include "old/math3d.h"
-#include "old/particule.h"
#include "ui/interface.h"
#include "ui/button.h"
#include "ui/color.h"
@@ -50,9 +39,6 @@
#include "ui/window.h"
#include "ui/edit.h"
#include "ui/editvalue.h"
-#include "old/text.h"
-#include "old/camera.h"
-#include "old/sound.h"
#include "script/cmdtoken.h"
#include "object/robotmain.h"
#include "ui/maindialog.h"
diff --git a/src/ui/maindialog.h b/src/ui/maindialog.h
index cfd9564..bddd61f 100644
--- a/src/ui/maindialog.h
+++ b/src/ui/maindialog.h
@@ -20,7 +20,6 @@
#include "common/struct.h"
-#include "old/camera.h"
#include "object/robotmain.h"
diff --git a/src/ui/mainmap.cpp b/src/ui/mainmap.cpp
index 76e3627..e874fba 100644
--- a/src/ui/mainmap.cpp
+++ b/src/ui/mainmap.cpp
@@ -1,5 +1,6 @@
// * This file is part of the COLOBOT source code
// * Copyright (C) 2001-2008, Daniel ROUX & EPSITEC SA, www.epsitec.ch
+// * Copyright (C) 2012 Polish Portal of Colobot (PPC)
// *
// * 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
@@ -17,37 +18,21 @@
// mainmap.cpp
-#include <windows.h>
-#include <stdio.h>
-#include <d3d.h>
+#include <ui/mainmap.h>
-#include "common/struct.h"
-#include "old/d3dengine.h"
-#include "old/d3dmath.h"
-#include "common/global.h"
-#include "common/event.h"
-#include "common/iman.h"
-#include "ui/interface.h"
-#include "ui/map.h"
-#include "ui/image.h"
-#include "ui/group.h"
-#include "ui/slider.h"
-#include "ui/scroll.h"
-#include "ui/window.h"
-#include "ui/mainmap.h"
+namespace Ui {
const float ZOOM_MIN = 1.0f;
const float ZOOM_MAX = 16.0f;
-
// Constructor of the application card.
-CMainMap::CMainMap(CInstanceManager* iMan)
+CMainMap::CMainMap()
{
- m_iMan = iMan;
+ m_iMan = CInstanceManager::GetInstancePointer();
m_iMan->AddInstance(CLASS_MAP, this);
m_interface = (CInterface*)m_iMan->SearchInstance(CLASS_INTERFACE);
@@ -73,8 +58,7 @@ void CMainMap::CreateMap()
Math::Point pos, dim;
pw = (CWindow*)m_interface->SearchControl(EVENT_WINDOW1);
- if ( pw == 0 )
- {
+ if (pw == nullptr) {
pos.x = 0.0f;
pos.y = 0.0f;
dim.x = 0.0f;
@@ -82,10 +66,10 @@ void CMainMap::CreateMap()
pw = m_interface->CreateWindows(pos, dim, 10, EVENT_WINDOW1);
}
- dim.x = 10.0f/640.0f;
- dim.y = 10.0f/480.0f;
- pos.x = 10.0f/640.0f;
- pos.y = 10.0f/480.0f;
+ dim.x = 10.0f / 640.0f;
+ dim.y = 10.0f / 480.0f;
+ pos.x = 10.0f / 640.0f;
+ pos.y = 10.0f / 480.0f;
pw->CreateMap (pos, dim, 2, EVENT_OBJECT_MAP);
pw->CreateSlider(pos, dim, 0, EVENT_OBJECT_MAPZOOM);
@@ -94,16 +78,18 @@ void CMainMap::CreateMap()
// Indicates whether the mini-map should display a still image.
-void CMainMap::SetFixImage(char *filename)
+void CMainMap::SetFixImage(const char *filename)
{
CWindow* pw;
CMap* pm;
pw = (CWindow*)m_interface->SearchControl(EVENT_WINDOW1);
- if ( pw == 0 ) return;
+ if (pw == nullptr)
+ return;
pm = (CMap*)pw->SearchControl(EVENT_OBJECT_MAP);
- if ( pm == 0 ) return;
+ if (pm == nullptr)
+ return;
pw->DeleteControl(EVENT_OBJECT_MAPZOOM);
m_bFixImage = true;
@@ -113,17 +99,17 @@ void CMainMap::SetFixImage(char *filename)
// Choosing colors of soil and water for the mini-map.
-void CMainMap::FloorColorMap(D3DCOLORVALUE floor, D3DCOLORVALUE water)
+void CMainMap::FloorColorMap(Gfx::Color floor, Gfx::Color water)
{
CWindow* pw;
CMap* pm;
pw = (CWindow*)m_interface->SearchControl(EVENT_WINDOW1);
- if ( pw == 0 ) return;
+ if (pw == nullptr)
+ return;
pm = (CMap*)pw->SearchControl(EVENT_OBJECT_MAP);
- if ( pm != 0 )
- {
+ if (pm != nullptr) {
pm->SetFloorColor(floor);
pm->SetWaterColor(water);
}
@@ -138,25 +124,19 @@ void CMainMap::ShowMap(bool bShow)
CSlider* ps;
pw = (CWindow*)m_interface->SearchControl(EVENT_WINDOW1);
- if ( pw == 0 ) return;
+ if (pw == nullptr)
+ return;
- if ( bShow )
- {
+ if (bShow) {
DimMap();
- }
- else
- {
+ } else {
pm = (CMap*)pw->SearchControl(EVENT_OBJECT_MAP);
- if ( pm != 0 )
- {
+ if (pm != nullptr)
pm->ClearState(STATE_VISIBLE);
- }
ps = (CSlider*)pw->SearchControl(EVENT_OBJECT_MAPZOOM);
- if ( ps != 0 )
- {
+ if (ps != nullptr)
ps->ClearState(STATE_VISIBLE);
- }
}
}
@@ -171,9 +151,11 @@ void CMainMap::DimMap()
float value;
pw = (CWindow*)m_interface->SearchControl(EVENT_WINDOW1);
- if ( pw == 0 ) return;
+ if (pw == nullptr)
+ return;
pm = (CMap*)pw->SearchControl(EVENT_OBJECT_MAP);
- if ( pm == 0 ) return;
+ if (pm == nullptr)
+ return;
pm->SetState(STATE_VISIBLE, (m_mapMode != 0));
@@ -185,19 +167,18 @@ void CMainMap::DimMap()
pm->SetDim(dim);
ps = (CSlider*)pw->SearchControl(EVENT_OBJECT_MAPZOOM);
- if ( ps != 0 )
- {
+ if (ps != nullptr) {
ps->SetState(STATE_VISIBLE, (m_mapMode != 0));
dim.x = SCROLL_WIDTH;
- dim.y = 66.0f/480.0f;
- pos.x = 523.0f/640.0f;
- pos.y = 3.0f/480.0f;
+ dim.y = 66.0f / 480.0f;
+ pos.x = 523.0f / 640.0f;
+ pos.y = 3.0f / 480.0f;
ps->SetPos(pos);
ps->SetDim(dim);
- value = pm->RetZoom();
- value = (value-ZOOM_MIN)/(ZOOM_MAX-ZOOM_MIN);
+ value = pm->GetZoom();
+ value = (value-ZOOM_MIN) / (ZOOM_MAX-ZOOM_MIN);
value = powf(value, 0.5f);
ps->SetVisibleValue(value);
ps->SetArrowStep(0.2f);
@@ -206,22 +187,25 @@ void CMainMap::DimMap()
// Returns the current zoom of the minimap.
-float CMainMap::RetZoomMap()
+float CMainMap::GetZoomMap()
{
CWindow* pw;
CMap* pm;
CSlider* ps;
pw = (CWindow*)m_interface->SearchControl(EVENT_WINDOW1);
- if ( pw == 0 ) return ZOOM_MIN;
+ if (pw == nullptr)
+ return ZOOM_MIN;
pm = (CMap*)pw->SearchControl(EVENT_OBJECT_MAP);
- if ( pm == 0 ) return ZOOM_MIN;
+ if (pm == nullptr)
+ return ZOOM_MIN;
ps = (CSlider*)pw->SearchControl(EVENT_OBJECT_MAPZOOM);
- if ( ps == 0 ) return ZOOM_MIN;
+ if (ps == nullptr)
+ return ZOOM_MIN;
- return pm->RetZoom();
+ return pm->GetZoom();
}
// Zoom the mini-map of any factor.
@@ -233,15 +217,20 @@ void CMainMap::ZoomMap(float zoom)
CSlider* ps;
pw = (CWindow*)m_interface->SearchControl(EVENT_WINDOW1);
- if ( pw == 0 ) return;
+ if (pw == nullptr)
+ return;
pm = (CMap*)pw->SearchControl(EVENT_OBJECT_MAP);
- if ( pm == 0 ) return;
+ if (pm == nullptr)
+ return;
ps = (CSlider*)pw->SearchControl(EVENT_OBJECT_MAPZOOM);
- if ( ps == 0 ) return;
+ if (ps == nullptr)
+ return;
- if ( zoom < ZOOM_MIN ) zoom = ZOOM_MIN;
- if ( zoom > ZOOM_MAX ) zoom = ZOOM_MAX;
+ if (zoom < ZOOM_MIN)
+ zoom = ZOOM_MIN;
+ if (zoom > ZOOM_MAX)
+ zoom = ZOOM_MAX;
pm->SetZoom(zoom);
DimMap();
@@ -257,16 +246,20 @@ void CMainMap::ZoomMap()
float zoom;
pw = (CWindow*)m_interface->SearchControl(EVENT_WINDOW1);
- if ( pw == 0 ) return;
+ if (pw == nullptr)
+ return;
pm = (CMap*)pw->SearchControl(EVENT_OBJECT_MAP);
- if ( pm == 0 ) return;
+ if (pm == nullptr)
+ return;
ps = (CSlider*)pw->SearchControl(EVENT_OBJECT_MAPZOOM);
- if ( ps == 0 ) return;
+ if (ps == nullptr)
+ return;
+
- zoom = ps->RetVisibleValue();
+ zoom = ps->GetVisibleValue();
zoom = powf(zoom, 2.0f);
- zoom = ZOOM_MIN+zoom*(ZOOM_MAX-ZOOM_MIN);
+ zoom = ZOOM_MIN+zoom*(ZOOM_MAX - ZOOM_MIN);
pm->SetZoom(zoom);
DimMap();
@@ -281,19 +274,16 @@ void CMainMap::MapEnable(bool bEnable)
CSlider* ps;
pw = (CWindow*)m_interface->SearchControl(EVENT_WINDOW1);
- if ( pw == 0 ) return;
+ if (pw == nullptr)
+ return;
pm = (CMap*)pw->SearchControl(EVENT_OBJECT_MAP);
- if ( pm != 0 )
- {
+ if (pm != nullptr)
pm->SetEnable(bEnable);
- }
ps = (CSlider*)pw->SearchControl(EVENT_OBJECT_MAPZOOM);
- if ( ps != 0 )
- {
+ if (ps != nullptr)
ps->SetState(STATE_ENABLE, bEnable);
- }
}
// Specifies the type of icon for the selected object.
@@ -304,10 +294,12 @@ void CMainMap::SetToy(bool bToy)
CMap* pm;
pw = (CWindow*)m_interface->SearchControl(EVENT_WINDOW1);
- if ( pw == 0 ) return;
+ if (pw == nullptr)
+ return;
pm = (CMap*)pw->SearchControl(EVENT_OBJECT_MAP);
- if ( pm == 0 ) return;
+ if (pm == nullptr)
+ return;
pm->SetToy(bToy);
}
@@ -321,10 +313,12 @@ void CMainMap::SetFixParam(float zoom, float ox, float oy, float angle,
CMap* pm;
pw = (CWindow*)m_interface->SearchControl(EVENT_WINDOW1);
- if ( pw == 0 ) return;
+ if (pw == nullptr)
+ return;
pm = (CMap*)pw->SearchControl(EVENT_OBJECT_MAP);
- if ( pm == 0 ) return;
+ if (pm == nullptr)
+ return;
pm->SetZoom(zoom);
pm->SetOffset(ox, oy);
@@ -341,25 +335,24 @@ void CMainMap::UpdateMap()
CMap* pm;
pw = (CWindow*)m_interface->SearchControl(EVENT_WINDOW1);
- if ( pw == 0 ) return;
+ if (pw == nullptr)
+ return;
pm = (CMap*)pw->SearchControl(EVENT_OBJECT_MAP);
- if ( pm != 0 )
- {
+ if (pm != nullptr)
pm->UpdateTerrain();
- }
}
// Indicates if the mini-map is visible.
-bool CMainMap::RetShowMap()
+bool CMainMap::GetShowMap()
{
return ( m_mapMode != 0 );
}
// Indicates whether the mini-map displays a still image.
-bool CMainMap::RetFixImage()
+bool CMainMap::GetFixImage()
{
return m_bFixImage;
}
@@ -373,30 +366,32 @@ CObject* CMainMap::DetectMap(Math::Point pos, bool &bInMap)
CMap* pm;
pw = (CWindow*)m_interface->SearchControl(EVENT_WINDOW1);
- if ( pw == 0 ) return 0;
+ if (pw == nullptr)
+ return 0;
bInMap = false;
pm = (CMap*)pw->SearchControl(EVENT_OBJECT_MAP);
- if ( pm == 0 ) return 0;
+ if (pm == nullptr)
+ return 0;
return pm->DetectObject(pos, bInMap);
}
// Indicates the object with the mouse hovers over.
-void CMainMap::SetHilite(CObject* pObj)
+void CMainMap::SetHighlight(CObject* pObj)
{
- CWindow* pw;
+ CWindow* pw;
CMap* pm;
pw = (CWindow*)m_interface->SearchControl(EVENT_WINDOW1);
- if ( pw == 0 ) return;
+ if (pw == nullptr)
+ return;
pm = (CMap*)pw->SearchControl(EVENT_OBJECT_MAP);
- if ( pm != 0 )
- {
- pm->SetHilite(pObj);
- }
+ if (pm != nullptr)
+ pm->SetHighlight(pObj);
}
+}
diff --git a/src/ui/mainmap.h b/src/ui/mainmap.h
index dba87fc..91e93c9 100644
--- a/src/ui/mainmap.h
+++ b/src/ui/mainmap.h
@@ -1,5 +1,6 @@
// * This file is part of the COLOBOT source code
// * Copyright (C) 2001-2008, Daniel ROUX & EPSITEC SA, www.epsitec.ch
+// * Copyright (C) 2012 Polish Portal of Colobot (PPC)
// *
// * 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
@@ -18,53 +19,54 @@
#pragma once
+#include <graphics/core/color.h>
-#include "common/struct.h"
-#include "math/point.h"
+#include <common/struct.h>
+#include <common/event.h>
+#include <math/point.h>
-class CInstanceManager;
-class CEvent;
-class CD3DEngine;
-class CInterface;
-class CObject;
+#include <object/object.h>
+#include <ui/interface.h>
+namespace Ui {
class CMainMap
{
-public:
- CMainMap(CInstanceManager* iMan);
- ~CMainMap();
+ public:
+ CMainMap();
+ ~CMainMap();
- void UpdateMap();
- void CreateMap();
- void SetFixImage(char *filename);
- void FloorColorMap(D3DCOLORVALUE floor, D3DCOLORVALUE water);
- void ShowMap(bool bShow);
- void DimMap();
- float RetZoomMap();
- void ZoomMap(float zoom);
- void ZoomMap();
- void MapEnable(bool bEnable);
- bool RetShowMap();
- bool RetFixImage();
- CObject* DetectMap(Math::Point pos, bool &bInMap);
- void SetHilite(CObject* pObj);
- void SetToy(bool bToy);
- void SetFixParam(float zoom, float ox, float oy, float angle, int mode, bool bDebug);
+ void UpdateMap();
+ void CreateMap();
+ void SetFixImage(const char *filename);
+ void FloorColorMap(Gfx::Color floor, Gfx::Color water);
+ void ShowMap(bool bShow);
+ void DimMap();
+ float GetZoomMap();
+ void ZoomMap(float zoom);
+ void ZoomMap();
+ void MapEnable(bool bEnable);
+ bool GetShowMap();
+ bool GetFixImage();
+ CObject* DetectMap(Math::Point pos, bool &bInMap);
+ void SetHighlight(CObject* pObj);
+ void SetToy(bool bToy);
+ void SetFixParam(float zoom, float ox, float oy, float angle, int mode, bool bDebug);
-protected:
- void CenterMap();
+ protected:
+ void CenterMap();
-protected:
- CInstanceManager* m_iMan;
- CEvent* m_event;
- CD3DEngine* m_engine;
- CInterface* m_interface;
+ protected:
+ CInstanceManager* m_iMan;
+ CEvent* m_event;
+ CD3DEngine* m_engine;
+ CInterface* m_interface;
- int m_mapMode;
- bool m_bFixImage;
+ int m_mapMode;
+ bool m_bFixImage;
};
+}
diff --git a/src/ui/mainshort.cpp b/src/ui/mainshort.cpp
index f23354b..f51ee9b 100644
--- a/src/ui/mainshort.cpp
+++ b/src/ui/mainshort.cpp
@@ -1,5 +1,6 @@
// * This file is part of the COLOBOT source code
// * Copyright (C) 2001-2008, Daniel ROUX & EPSITEC SA, www.epsitec.ch
+// * Copyright (C) 2012 Polish Portal of Colobot (PPC)
// *
// * 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
@@ -17,36 +18,21 @@
// mainshort.cpp
-#include <windows.h>
-#include <stdio.h>
-#include <d3d.h>
-
-#include "common/struct.h"
-#include "old/d3dengine.h"
-#include "common/global.h"
-#include "common/event.h"
-#include "common/iman.h"
-#include "object/object.h"
-#include "ui/interface.h"
-#include "ui/map.h"
-#include "ui/button.h"
-#include "object/robotmain.h"
-#include "ui/mainshort.h"
-
-
+#include <ui/mainshort.h>
+namespace Ui {
// Constructor of the application card.
-CMainShort::CMainShort(CInstanceManager* iMan)
+CMainShort::CMainShort()
{
- m_iMan = iMan;
+ m_iMan = CInstanceManager::GetInstancePointer();
m_iMan->AddInstance(CLASS_SHORT, this);
- m_interface = (CInterface*)m_iMan->SearchInstance(CLASS_INTERFACE);
- m_event = (CEvent*)m_iMan->SearchInstance(CLASS_EVENT);
- m_engine = (CD3DEngine*)m_iMan->SearchInstance(CLASS_ENGINE);
- m_main = (CRobotMain*)m_iMan->SearchInstance(CLASS_MAIN);
+ m_interface = static_cast<CInterface*>(m_iMan->SearchInstance(CLASS_INTERFACE));
+ m_event = static_cast<CEvent*>(m_iMan->SearchInstance(CLASS_EVENT));
+ m_engine = static_cast<Gfx::CEngine*>(m_iMan->SearchInstance(CLASS_ENGINE));
+ m_main = static_cast<CRobotMain*>(m_iMan->SearchInstance(CLASS_MAIN));
FlushShortcuts();
}
@@ -78,7 +64,7 @@ void CMainShort::FlushShortcuts()
}
}
-static EventMsg table_sc_em[20] =
+static EventType table_sc_em[20] =
{
EVENT_OBJECT_SHORTCUT00,
EVENT_OBJECT_SHORTCUT01,
@@ -113,13 +99,13 @@ bool CMainShort::CreateShortcuts()
int i, rank, icon;
char name[100];
- if ( m_main->RetFixScene() ) return false;
+ if ( m_main->GetFixScene() ) return false;
m_interface->DeleteControl(EVENT_OBJECT_MOVIELOCK);
m_interface->DeleteControl(EVENT_OBJECT_EDITLOCK);
for ( i=0 ; i<20 ; i++ )
{
- if ( i != 0 && m_shortcuts[i] == 0 ) continue;
+ if ( i != 0 && m_shortcuts[i] == nullptr ) continue;
m_interface->DeleteControl(table_sc_em[i]);
m_shortcuts[i] = 0;
@@ -130,15 +116,15 @@ bool CMainShort::CreateShortcuts()
pos.x = 4.0f/640.0f;
pos.y = (480.0f-32.0f)/480.0f;
- if ( m_main->RetMovieLock() &&
- !m_main->RetEditLock() ) // hangs during film?
+ if ( m_main->GetMovieLock() &&
+ !m_main->GetEditLock() ) // hangs during film?
{
m_interface->CreateShortcut(pos, dim, 7, EVENT_OBJECT_MOVIELOCK);
return true;
}
- if ( !m_main->RetFreePhoto() &&
- (m_main->RetEditLock() ||
- m_engine->RetPause()) ) // hangs during edition?
+ if ( !m_main->GetFreePhoto() &&
+ (m_main->GetEditLock() ||
+ m_engine->GetPause()) ) // hangs during edition?
{
m_interface->CreateShortcut(pos, dim, 6, EVENT_OBJECT_EDITLOCK);
return true;
@@ -154,13 +140,13 @@ bool CMainShort::CreateShortcuts()
for ( i=0 ; i<1000000 ; i++ )
{
pObj = (CObject*)m_iMan->SearchInstance(CLASS_OBJECT, i);
- if ( pObj == 0 ) break;
+ if ( pObj == nullptr ) break;
- if ( !pObj->RetActif() ) continue;
- if ( !pObj->RetSelectable() ) continue;
- if ( pObj->RetProxyActivate() ) continue;
+ if ( !pObj->GetActif() ) continue;
+ if ( !pObj->GetSelectable() ) continue;
+ if ( pObj->GetProxyActivate() ) continue;
- type = pObj->RetType();
+ type = pObj->GetType();
icon = -1;
if ( m_bBuilding )
{
@@ -243,12 +229,12 @@ bool CMainShort::UpdateShortcuts()
for ( i=0 ; i<20 ; i++ )
{
- if ( m_shortcuts[i] == 0 ) continue;
+ if ( m_shortcuts[i] == nullptr ) continue;
pc = m_interface->SearchControl(table_sc_em[i]);
- if ( pc != 0 )
+ if ( pc != nullptr )
{
- pc->SetState(STATE_CHECK, m_shortcuts[i]->RetSelect());
+ pc->SetState(STATE_CHECK, m_shortcuts[i]->GetSelect());
pc->SetState(STATE_RUN, m_shortcuts[i]->IsProgram());
}
}
@@ -257,7 +243,7 @@ bool CMainShort::UpdateShortcuts()
// Selects an object through a shortcut.
-void CMainShort::SelectShortcut(EventMsg event)
+void CMainShort::SelectShortcut(EventType event)
{
int i;
@@ -265,7 +251,7 @@ void CMainShort::SelectShortcut(EventMsg event)
{
if ( event == table_sc_em[i] )
{
- if ( i != 0 && m_shortcuts[i] == 0 ) continue;
+ if ( i != 0 && m_shortcuts[i] == nullptr ) continue;
if ( i == 0 ) // buildings <-> vehicles?
{
@@ -289,9 +275,9 @@ void CMainShort::SelectNext()
CObject* pPrev;
int i;
- if ( m_main->RetMovieLock() ||
- m_main->RetEditLock() ||
- m_engine->RetPause() ) return;
+ if ( m_main->GetMovieLock() ||
+ m_main->GetEditLock() ||
+ m_engine->GetPause() ) return;
pPrev = m_main->DeselectAll();
@@ -299,12 +285,12 @@ void CMainShort::SelectNext()
{
if ( m_shortcuts[i] == pPrev )
{
- if ( m_shortcuts[++i] == 0 ) i = 1;
+ if ( m_shortcuts[++i] == nullptr ) i = 1;
break;
}
}
- if ( i == 20 || m_shortcuts[i] == 0 )
+ if ( i == 20 || m_shortcuts[i] == nullptr )
{
m_main->SelectHuman();
}
@@ -325,13 +311,13 @@ CObject* CMainShort::DetectShort(Math::Point pos)
for ( i=0 ; i<20 ; i++ )
{
- if ( m_shortcuts[i] == 0 ) continue;
+ if ( m_shortcuts[i] == nullptr ) continue;
pc = m_interface->SearchControl(table_sc_em[i]);
if ( pc != 0 )
{
- cpos = pc->RetPos();
- cdim = pc->RetDim();
+ cpos = pc->GetPos();
+ cdim = pc->GetDim();
if ( pos.x >= cpos.x &&
pos.x <= cpos.x+cdim.x &&
@@ -347,17 +333,17 @@ CObject* CMainShort::DetectShort(Math::Point pos)
// Reports the object with the mouse hovers over.
-void CMainShort::SetHilite(CObject* pObj)
+void CMainShort::SetHighlight(CObject* pObj)
{
CControl* pc;
int i;
for ( i=0 ; i<20 ; i++ )
{
- if ( m_shortcuts[i] == 0 ) continue;
+ if ( m_shortcuts[i] == nullptr ) continue;
pc = m_interface->SearchControl(table_sc_em[i]);
- if ( pc == 0 ) continue;
+ if ( pc == nullptr ) continue;
if ( m_shortcuts[i] == pObj )
{
@@ -372,3 +358,5 @@ void CMainShort::SetHilite(CObject* pObj)
}
}
+}
+
diff --git a/src/ui/mainshort.h b/src/ui/mainshort.h
index f260f0e..d570484 100644
--- a/src/ui/mainshort.h
+++ b/src/ui/mainshort.h
@@ -1,5 +1,6 @@
// * This file is part of the COLOBOT source code
// * Copyright (C) 2001-2008, Daniel ROUX & EPSITEC SA, www.epsitec.ch
+// * Copyright (C) 2012 Polish Portal of Colobot (PPC)
// *
// * 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
@@ -18,45 +19,45 @@
#pragma once
+#include <ui/interface.h>
-#include "common/event.h"
-#include "math/point.h"
+#include <common/event.h>
+#include <math/point.h>
-class CInstanceManager;
-class CD3DEngine;
-class CInterface;
-class CRobotMain;
-class CObject;
+#include <object/object.h>
+#include <graphics/engine/engine.h>
+
+namespace Ui {
class CMainShort
{
-public:
- CMainShort(CInstanceManager* iMan);
- ~CMainShort();
-
- void SetMode(bool bBuilding);
- void FlushShortcuts();
- bool CreateShortcuts();
- bool UpdateShortcuts();
- void SelectShortcut(EventMsg event);
- void SelectNext();
- CObject* DetectShort(Math::Point pos);
- void SetHilite(CObject* pObj);
-
-protected:
-
-protected:
- CInstanceManager* m_iMan;
- CEvent* m_event;
- CD3DEngine* m_engine;
- CInterface* m_interface;
- CRobotMain* m_main;
-
- CObject* m_shortcuts[20];
- bool m_bBuilding;
+ public:
+ CMainShort();
+ ~CMainShort();
+
+ void SetMode(bool bBuilding);
+ void FlushShortcuts();
+ bool CreateShortcuts();
+ bool UpdateShortcuts();
+ void SelectShortcut(EventType event);
+ void SelectNext();
+ CObject* DetectShort(Math::Point pos);
+ void SetHighlight(CObject* pObj);
+
+ protected:
+
+ protected:
+ CInstanceManager* m_iMan;
+ CEvent* m_event;
+ Gfx::CEngine* m_engine;
+ CInterface* m_interface;
+ CRobotMain* m_main;
+
+ CObject* m_shortcuts[20];
+ bool m_bBuilding;
};
-
+}
diff --git a/src/ui/map.cpp b/src/ui/map.cpp
index a74e557..5139d88 100644
--- a/src/ui/map.cpp
+++ b/src/ui/map.cpp
@@ -1,5 +1,6 @@
// * This file is part of the COLOBOT source code
// * Copyright (C) 2001-2008, Daniel ROUX & EPSITEC SA, www.epsitec.ch
+// * Copyright (C) 2012 Polish Portal of Colobot (PPC)
// *
// * 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
@@ -17,34 +18,20 @@
// map.cpp
-#include <windows.h>
-#include <stdio.h>
-#include <d3d.h>
+#include "map.h"
-#include "common/struct.h"
-#include "math/geometry.h"
-#include "old/d3dengine.h"
-#include "common/event.h"
-#include "old/math3d.h"
-#include "old/terrain.h"
-#include "old/water.h"
-#include "object/object.h"
-#include "common/event.h"
-#include "common/misc.h"
-#include "object/robotmain.h"
-#include "common/iman.h"
-#include "ui/map.h"
+namespace Ui {
// Object's constructor.
-CMap::CMap(CInstanceManager* iMan) : CControl(iMan)
+CMap::CMap() : CControl()
{
- m_main = (CRobotMain*)m_iMan->SearchInstance(CLASS_MAIN);
- m_terrain = (CTerrain*)m_iMan->SearchInstance(CLASS_TERRAIN);
- m_water = (CWater*)m_iMan->SearchInstance(CLASS_WATER);
+ m_main = static_cast<CRobotMain*>(m_iMan->SearchInstance(CLASS_MAIN));
+ m_terrain = static_cast<Gfx::CTerrain*>(m_iMan->SearchInstance(CLASS_TERRAIN));
+ m_water = static_cast<Gfx::CWater*>(m_iMan->SearchInstance(CLASS_WATER));
m_bEnable = true;
m_time = 0.0f;
@@ -61,9 +48,9 @@ CMap::CMap(CInstanceManager* iMan) : CControl(iMan)
m_waterColor.g = 0.80f;
m_waterColor.b = 1.00f; // blue
- m_half = m_terrain->RetMosaic()*m_terrain->RetBrick()*m_terrain->RetSize()/2.0f;
+ m_half = m_terrain->GetMosaic() * m_terrain->GetBrick() * m_terrain->GetSize() / 2.0f;
- m_hiliteRank = -1;
+ m_highlightRank = -1;
FlushObject();
m_fixImage[0] = 0;
@@ -81,9 +68,10 @@ CMap::~CMap()
// Creates a new button.
-bool CMap::Create(Math::Point pos, Math::Point dim, int icon, EventMsg eventMsg)
+bool CMap::Create(Math::Point pos, Math::Point dim, int icon, EventType eventMsg)
{
- if ( eventMsg == EVENT_NULL ) eventMsg = GetUniqueEventMsg();
+ if (eventMsg == EVENT_NULL)
+ eventMsg = GetUniqueEventType();
CControl::Create(pos, dim, icon, eventMsg);
return true;
@@ -96,7 +84,7 @@ void CMap::SetOffset(float ox, float oy)
{
m_offset.x = ox;
m_offset.y = oy;
- m_half = m_terrain->RetMosaic()*m_terrain->RetBrick()*m_terrain->RetSize()/2.0f;
+ m_half = m_terrain->GetMosaic() * m_terrain->GetBrick() * m_terrain->GetSize() / 2.0f;
}
// Choice of the global angle of rotation.
@@ -131,10 +119,10 @@ void CMap::SetDebug(bool bDebug)
void CMap::SetZoom(float value)
{
m_zoom = value;
- m_half = m_terrain->RetMosaic()*m_terrain->RetBrick()*m_terrain->RetSize()/2.0f;
+ m_half = m_terrain->GetMosaic() * m_terrain->GetBrick() * m_terrain->GetSize() / 2.0f;
}
-float CMap::RetZoom()
+float CMap::GetZoom()
{
return m_zoom;
}
@@ -149,7 +137,7 @@ void CMap::SetEnable(bool bEnable)
SetState(STATE_DEAD, !bEnable);
}
-bool CMap::RetEnable()
+bool CMap::GetEnable()
{
return m_bEnable;
}
@@ -157,14 +145,14 @@ bool CMap::RetEnable()
// Choosing the color of the soil.
-void CMap::SetFloorColor(D3DCOLORVALUE color)
+void CMap::SetFloorColor(Gfx::Color color)
{
m_floorColor = color;
}
// Choosing the color of the water.
-void CMap::SetWaterColor(D3DCOLORVALUE color)
+void CMap::SetWaterColor(Gfx::Color color)
{
m_waterColor = color;
}
@@ -172,14 +160,14 @@ void CMap::SetWaterColor(D3DCOLORVALUE color)
// Specifies a fixed image in place of the drawing of the relief.
-void CMap::SetFixImage(char *filename)
+void CMap::SetFixImage(const char *filename)
{
strcpy(m_fixImage, filename);
}
// Whether to use a still image.
-bool CMap::RetFixImage()
+bool CMap::GetFixImage()
{
return (m_fixImage[0] != 0);
}
@@ -189,30 +177,24 @@ bool CMap::RetFixImage()
bool CMap::EventProcess(const Event &event)
{
- bool bInMap;
+ bool bInMap;
- if ( (m_state & STATE_VISIBLE) == 0 ) return true;
+ if ( (m_state & STATE_VISIBLE) == 0 )
+ return true;
CControl::EventProcess(event);
- if ( event.event == EVENT_FRAME )
- {
+ if ( event.type == EVENT_FRAME )
m_time += event.rTime;
- }
- if ( event.event == EVENT_MOUSEMOVE && Detect(event.pos) )
- {
- m_engine->SetMouseType(D3DMOUSENORM);
+ if ( event.type == EVENT_MOUSE_MOVE && Detect(event.pos) ) {
+ m_engine->SetMouseType(Gfx::ENG_MOUSE_NORM);
if ( DetectObject(event.pos, bInMap) != 0 )
- {
- m_engine->SetMouseType(D3DMOUSEHAND);
- }
+ m_engine->SetMouseType(Gfx::ENG_MOUSE_HAND);
}
- if ( event.event == EVENT_LBUTTONDOWN )
- {
- if ( CControl::Detect(event.pos) )
- {
+ if ( event.type == EVENT_MOUSE_BUTTON_DOWN && event.mouseButton.button == 1 ) {
+ if ( CControl::Detect(event.pos) ) {
SelectObject(event.pos);
return false;
}
@@ -227,7 +209,7 @@ Math::Point CMap::AdjustOffset(Math::Point offset)
{
float limit;
- limit = m_half - m_half/m_zoom;
+ limit = m_half - m_half / m_zoom;
if ( offset.x < -limit ) offset.x = -limit;
if ( offset.x > limit ) offset.x = limit;
if ( offset.y < -limit ) offset.y = -limit;
@@ -238,21 +220,20 @@ Math::Point CMap::AdjustOffset(Math::Point offset)
// Indicates the object with the mouse hovers over.
-void CMap::SetHilite(CObject* pObj)
+void CMap::SetHighlight(CObject* pObj)
{
- int i;
-
- m_hiliteRank = -1;
- if ( m_bToy || m_fixImage[0] != 0 ) return; // card with still image?
- if ( pObj == 0 ) return;
+ m_highlightRank = -1;
+ if ( m_bToy || m_fixImage[0] != 0 )
+ return; // card with still image?
+ if ( pObj == nullptr )
+ return;
- for ( i=0 ; i<MAPMAXOBJECT ; i++ )
- {
- if ( !m_map[i].bUsed ) continue;
+ for (int i = 0; i < MAPMAXOBJECT; i++) {
+ if ( !m_map[i].bUsed )
+ continue;
- if ( m_map[i].object == pObj )
- {
- m_hiliteRank = i;
+ if ( m_map[i].object == pObj ) {
+ m_highlightRank = i;
break;
}
}
@@ -262,39 +243,43 @@ void CMap::SetHilite(CObject* pObj)
CObject* CMap::DetectObject(Math::Point pos, bool &bInMap)
{
- float dist, min;
- int i, best;
+ float dist, min;
+ int best;
bInMap = false;
- if ( pos.x < m_pos.x ||
- pos.y < m_pos.y ||
- pos.x > m_pos.x+m_dim.x ||
- pos.y > m_pos.y+m_dim.y ) return 0;
+ if ( pos.x < m_pos.x ||
+ pos.y < m_pos.y ||
+ pos.x > m_pos.x + m_dim.x ||
+ pos.y > m_pos.y + m_dim.y )
+ return 0;
bInMap = true;
- pos.x = (pos.x-m_pos.x)/m_dim.x*256.0f;
- pos.y = (pos.y-m_pos.y)/m_dim.y*256.0f; // 0..256
- pos.x = (pos.x-128.0f)*m_half/(m_zoom*128.0f)+m_offset.x;
- pos.y = (pos.y-128.0f)*m_half/(m_zoom*128.0f)+m_offset.y;
+ pos.x = (pos.x - m_pos.x) / m_dim.x * 256.0f;
+ pos.y = (pos.y - m_pos.y) / m_dim.y * 256.0f; // 0..256
+ pos.x = (pos.x - 128.0f) * m_half / (m_zoom * 128.0f) + m_offset.x;
+ pos.y = (pos.y - 128.0f) * m_half / (m_zoom * 128.0f) + m_offset.y;
min = 10000.0f;
best = -1;
- for ( i=MAPMAXOBJECT-1 ; i>=0 ; i-- )
- {
- if ( !m_map[i].bUsed ) continue;
- if ( m_map[i].color == MAPCOLOR_BBOX && !m_bRadar ) continue;
- if ( m_map[i].color == MAPCOLOR_ALIEN && !m_bRadar ) continue;
-
- dist = Math::Point(m_map[i].pos.x-pos.x, m_map[i].pos.y-pos.y).Length();
- if ( dist > m_half/m_zoom*8.0f/100.0f ) continue; // too far?
- if ( dist < min )
- {
+ for (int i = MAPMAXOBJECT - 1; i >= 0; i--) {
+ if ( !m_map[i].bUsed )
+ continue;
+ if ( m_map[i].color == MAPCOLOR_BBOX && !m_bRadar )
+ continue;
+ if ( m_map[i].color == MAPCOLOR_ALIEN && !m_bRadar )
+ continue;
+
+ dist = Math::Point(m_map[i].pos.x - pos.x, m_map[i].pos.y - pos.y).Length();
+ if ( dist > m_half / m_zoom * 8.0f / 100.0f )
+ continue; // too far?
+ if ( dist < min ) {
min = dist;
best = i;
}
}
- if ( best == -1 ) return 0;
+ if ( best == -1 )
+ return 0;
return m_map[best].object;
}
@@ -302,14 +287,12 @@ CObject* CMap::DetectObject(Math::Point pos, bool &bInMap)
void CMap::SelectObject(Math::Point pos)
{
- CObject *pObj;
- bool bInMap;
+ CObject *pObj;
+ bool bInMap;
pObj = DetectObject(pos, bInMap);
if ( pObj != 0 )
- {
m_main->SelectObject(pObj);
- }
}
@@ -318,34 +301,31 @@ void CMap::SelectObject(Math::Point pos)
void CMap::Draw()
{
Math::Point uv1, uv2;
- int i;
+ int i;
- if ( (m_state & STATE_VISIBLE) == 0 ) return;
+ if ( (m_state & STATE_VISIBLE) == 0 )
+ return;
CControl::Draw(); // draws the bottom (button)
- if ( !m_bEnable ) return;
+ if ( !m_bEnable )
+ return;
- if ( m_fixImage[0] == 0 && m_map[MAPMAXOBJECT-1].bUsed )
- {
- m_offset = AdjustOffset(m_map[MAPMAXOBJECT-1].pos);
- }
+ if ( m_fixImage[0] == 0 && m_map[MAPMAXOBJECT - 1].bUsed )
+ m_offset = AdjustOffset(m_map[MAPMAXOBJECT - 1].pos);
- if ( m_fixImage[0] == 0 ) // drawing of the relief?
- {
+ if ( m_fixImage[0] == 0 ) { // drawing of the relief?
m_engine->SetTexture("map.tga");
- m_engine->SetState(D3DSTATENORMAL);
- uv1.x = 0.5f+(m_offset.x-(m_half/m_zoom))/(m_half*2.0f);
- uv1.y = 0.5f-(m_offset.y+(m_half/m_zoom))/(m_half*2.0f);
- uv2.x = 0.5f+(m_offset.x+(m_half/m_zoom))/(m_half*2.0f);
- uv2.y = 0.5f-(m_offset.y-(m_half/m_zoom))/(m_half*2.0f);
+ m_engine->SetState(Gfx::ENG_RSTATE_NORMAL);
+ uv1.x = 0.5f + (m_offset.x - (m_half / m_zoom)) / (m_half * 2.0f);
+ uv1.y = 0.5f - (m_offset.y + (m_half / m_zoom)) / (m_half * 2.0f);
+ uv2.x = 0.5f + (m_offset.x + (m_half / m_zoom)) / (m_half * 2.0f);
+ uv2.y = 0.5f - (m_offset.y - (m_half / m_zoom)) / (m_half * 2.0f);
DrawVertex(uv1, uv2, 0.97f); // drawing the map
- }
- else // still image?
- {
+ } else { // still image?
m_engine->LoadTexture(m_fixImage);
m_engine->SetTexture(m_fixImage);
- m_engine->SetState(D3DSTATENORMAL);
+ m_engine->SetState(Gfx::ENG_RSTATE_NORMAL);
uv1.x = 0.0f;
uv1.y = 0.0f;
uv2.x = 1.0f;
@@ -355,33 +335,28 @@ void CMap::Draw()
i = MAPMAXOBJECT-1;
if ( m_map[i].bUsed ) // selection:
- {
DrawFocus(m_map[i].pos, m_map[i].dir, m_map[i].type, m_map[i].color);
- }
- for ( i=0 ; i<m_totalFix ; i++ ) // fixed objects:
- {
- if ( i == m_hiliteRank ) continue;
+ for ( i=0 ; i<m_totalFix ; i++ ) { // fixed objects:
+ if ( i == m_highlightRank )
+ continue;
DrawObject(m_map[i].pos, m_map[i].dir, m_map[i].type, m_map[i].color, false, false);
}
- for ( i=MAPMAXOBJECT-2 ; i>m_totalMove ; i-- ) // moving objects:
- {
- if ( i == m_hiliteRank ) continue;
+ for ( i=MAPMAXOBJECT-2 ; i>m_totalMove ; i-- ) { // moving objects:
+ if ( i == m_highlightRank )
+ continue;
DrawObject(m_map[i].pos, m_map[i].dir, m_map[i].type, m_map[i].color, false, false);
}
i = MAPMAXOBJECT-1;
- if ( m_map[i].bUsed && i != m_hiliteRank ) // selection:
- {
+ if ( m_map[i].bUsed && i != m_highlightRank ) // selection:
DrawObject(m_map[i].pos, m_map[i].dir, m_map[i].type, m_map[i].color, true, false);
- }
- if ( m_hiliteRank != -1 && m_map[m_hiliteRank].bUsed )
- {
- i = m_hiliteRank;
+ if ( m_highlightRank != -1 && m_map[m_highlightRank].bUsed ) {
+ i = m_highlightRank;
DrawObject(m_map[i].pos, m_map[i].dir, m_map[i].type, m_map[i].color, false, true);
- DrawHilite(m_map[i].pos);
+ DrawHighlight(m_map[i].pos);
}
}
@@ -392,35 +367,32 @@ Math::Point CMap::MapInter(Math::Point pos, float dir)
Math::Point p1;
float limit;
- p1.x = pos.x+1.0f;
+ p1.x = pos.x + 1.0f;
p1.y = pos.y;
p1 = Math::RotatePoint(pos, dir, p1);
p1.x -= pos.x;
p1.y -= pos.y;
- limit = m_mapPos.x+m_mapDim.x-pos.x;
- if ( p1.x > limit ) // exceeds the right?
- {
+ limit = m_mapPos.x + m_mapDim.x - pos.x;
+ if ( p1.x > limit ) { // exceeds the right?
p1.y = limit*p1.y/p1.x;
p1.x = limit;
}
- limit = m_mapPos.y*0.75f+m_mapDim.y*0.75f-pos.y;
- if ( p1.y > limit ) // exceeds the top?
- {
- p1.x = limit*p1.x/p1.y;
+ limit = m_mapPos.y * 0.75f + m_mapDim.y * 0.75f - pos.y;
+ if ( p1.y > limit ) { // exceeds the top?
+ p1.x = limit * p1.x / p1.y;
p1.y = limit;
}
- limit = m_mapPos.x-pos.x;
- if ( p1.x < limit ) // exceeds the left?
- {
- p1.y = limit*p1.y/p1.x;
+ limit = m_mapPos.x - pos.x;
+ if ( p1.x < limit ) { // exceeds the left?
+ p1.y = limit * p1.y / p1.x;
p1.x = limit;
}
- limit = m_mapPos.y*0.75f-pos.y;
- if ( p1.y < limit ) // exceeds the bottom?
- {
- p1.x = limit*p1.x/p1.y;
+
+ limit = m_mapPos.y * 0.75f - pos.y;
+ if ( p1.y < limit ) { // exceeds the bottom?
+ p1.x = limit * p1.x / p1.y;
p1.y = limit;
}
@@ -454,7 +426,7 @@ void CMap::DrawFocus(Math::Point pos, float dir, ObjectType type, MapColor color
pos.x = m_mapPos.x+m_mapDim.x*pos.x;
pos.y = m_mapPos.y*0.75f+m_mapDim.y*pos.y*0.75f;
- focus = m_engine->RetFocus();
+ focus = m_engine->GetFocus();
dir += Math::PI/2.0f;
aMin = Math::NormAngle(dir-Math::PI/4.0f*focus);
aMax = Math::NormAngle(dir+Math::PI/4.0f*focus);
@@ -484,7 +456,7 @@ void CMap::DrawFocus(Math::Point pos, float dir, ObjectType type, MapColor color
uv2.y = 255.0f/256.0f;
m_engine->SetTexture("button2.tga");
- m_engine->SetState(D3DSTATETTw);
+ m_engine->SetState(Gfx::ENG_RSTATE_TTEXTURE_WHITE);
bEnding = false;
do
@@ -492,7 +464,7 @@ void CMap::DrawFocus(Math::Point pos, float dir, ObjectType type, MapColor color
quart ++;
aOct = limit[quart%4];
if ( quart >= 4 ) aOct += Math::PI*2.0f;
- if ( aOct >= aMax-Math::VERY_SMALL )
+ if ( aOct >= aMax - Math::VERY_SMALL_NUM )
{
aOct = aMax;
bEnding = true;
@@ -544,7 +516,7 @@ void CMap::DrawObject(Math::Point pos, float dir, ObjectType type, MapColor colo
}
m_engine->SetTexture("button2.tga");
- m_engine->SetState(D3DSTATETTb);
+ m_engine->SetState(Gfx::ENG_RSTATE_TTEXTURE_BLACK);
if ( bUp )
{
uv1.x = 160.5f/256.0f; // yellow triangle ^
@@ -687,7 +659,7 @@ void CMap::DrawObject(Math::Point pos, float dir, ObjectType type, MapColor colo
if ( bSelect )
{
m_engine->SetTexture("button2.tga");
- m_engine->SetState(D3DSTATENORMAL);
+ m_engine->SetState(Gfx::ENG_RSTATE_NORMAL);
if ( m_bToy )
{
uv1.x = 164.5f/256.0f; // black pentagon
@@ -713,7 +685,7 @@ void CMap::DrawObject(Math::Point pos, float dir, ObjectType type, MapColor colo
if ( m_bRadar )
{
m_engine->SetTexture("button2.tga");
- m_engine->SetState(D3DSTATETTw);
+ m_engine->SetState(Gfx::ENG_RSTATE_TTEXTURE_WHITE);
uv1.x = 64.5f/256.0f; // blue triangle
uv1.y = 240.5f/256.0f;
uv2.x = 79.0f/256.0f;
@@ -733,7 +705,7 @@ void CMap::DrawObject(Math::Point pos, float dir, ObjectType type, MapColor colo
if ( color == MAPCOLOR_WAYPOINTb )
{
m_engine->SetTexture("button2.tga");
- m_engine->SetState(D3DSTATETTb);
+ m_engine->SetState(Gfx::ENG_RSTATE_TTEXTURE_BLACK);
uv1.x = 192.5f/256.0f; // blue cross
uv1.y = 240.5f/256.0f;
uv2.x = 207.0f/256.0f;
@@ -743,7 +715,7 @@ void CMap::DrawObject(Math::Point pos, float dir, ObjectType type, MapColor colo
if ( color == MAPCOLOR_WAYPOINTr )
{
m_engine->SetTexture("button2.tga");
- m_engine->SetState(D3DSTATETTb);
+ m_engine->SetState(Gfx::ENG_RSTATE_TTEXTURE_BLACK);
uv1.x = 208.5f/256.0f; // red cross
uv1.y = 240.5f/256.0f;
uv2.x = 223.0f/256.0f;
@@ -753,7 +725,7 @@ void CMap::DrawObject(Math::Point pos, float dir, ObjectType type, MapColor colo
if ( color == MAPCOLOR_WAYPOINTg )
{
m_engine->SetTexture("button2.tga");
- m_engine->SetState(D3DSTATETTb);
+ m_engine->SetState(Gfx::ENG_RSTATE_TTEXTURE_BLACK);
uv1.x = 224.5f/256.0f; // green cross
uv1.y = 240.5f/256.0f;
uv2.x = 239.0f/256.0f;
@@ -763,7 +735,7 @@ void CMap::DrawObject(Math::Point pos, float dir, ObjectType type, MapColor colo
if ( color == MAPCOLOR_WAYPOINTy )
{
m_engine->SetTexture("button2.tga");
- m_engine->SetState(D3DSTATETTb);
+ m_engine->SetState(Gfx::ENG_RSTATE_TTEXTURE_BLACK);
uv1.x = 240.5f/256.0f; // yellow cross
uv1.y = 240.5f/256.0f;
uv2.x = 255.0f/256.0f;
@@ -773,7 +745,7 @@ void CMap::DrawObject(Math::Point pos, float dir, ObjectType type, MapColor colo
if ( color == MAPCOLOR_WAYPOINTv )
{
m_engine->SetTexture("button2.tga");
- m_engine->SetState(D3DSTATETTb);
+ m_engine->SetState(Gfx::ENG_RSTATE_TTEXTURE_BLACK);
uv1.x = 192.5f/256.0f; // violet cross
uv1.y = 224.5f/256.0f;
uv2.x = 207.0f/256.0f;
@@ -794,7 +766,7 @@ void CMap::DrawObjectIcon(Math::Point pos, Math::Point dim, MapColor color,
dp = 0.5f/256.0f;
m_engine->SetTexture("button3.tga");
- m_engine->SetState(D3DSTATENORMAL);
+ m_engine->SetState(Gfx::ENG_RSTATE_NORMAL);
if ( color == MAPCOLOR_MOVE )
{
uv1.x = 160.0f/256.0f; // blue
@@ -877,7 +849,7 @@ void CMap::DrawObjectIcon(Math::Point pos, Math::Point dim, MapColor color,
if ( type == OBJECT_TEEN34 ) icon = 48; // stone
if ( icon == -1 ) return;
- m_engine->SetState(D3DSTATETTw);
+ m_engine->SetState(Gfx::ENG_RSTATE_TTEXTURE_WHITE);
uv1.x = (32.0f/256.0f)*(icon%8);
uv1.y = (32.0f/256.0f)*(icon/8);
uv2.x = uv1.x+32.0f/256.0f;
@@ -892,7 +864,7 @@ void CMap::DrawObjectIcon(Math::Point pos, Math::Point dim, MapColor color,
// Draw the object with the mouse hovers over.
-void CMap::DrawHilite(Math::Point pos)
+void CMap::DrawHighlight(Math::Point pos)
{
Math::Point dim, uv1, uv2;
bool bOut, bUp, bDown, bLeft, bRight;
@@ -916,7 +888,7 @@ void CMap::DrawHilite(Math::Point pos)
dim.y *= 2.0f+cosf(m_time*8.0f)*0.5f;
m_engine->SetTexture("button2.tga");
- m_engine->SetState(D3DSTATETTb);
+ m_engine->SetState(Gfx::ENG_RSTATE_TTEXTURE_BLACK);
uv1.x = 160.5f/256.0f; // hilite
uv1.y = 224.5f/256.0f;
uv2.x = 175.0f/256.0f;
@@ -930,19 +902,19 @@ void CMap::DrawHilite(Math::Point pos)
void CMap::DrawTriangle(Math::Point p1, Math::Point p2, Math::Point p3, Math::Point uv1, Math::Point uv2)
{
- LPDIRECT3DDEVICE7 device;
- D3DVERTEX2 vertex[3]; // 1 triangle
+ Gfx::CDevice* device;
+ Gfx::VertexTex2 vertex[3]; // 1 triangle
Math::Vector n;
- device = m_engine->RetD3DDevice();
+ device = m_engine->GetDevice();
n = Math::Vector(0.0f, 0.0f, -1.0f); // normal
- vertex[0] = D3DVERTEX2(Math::Vector(p1.x, p1.y, 0.0f), n, uv1.x,uv1.y);
- vertex[1] = D3DVERTEX2(Math::Vector(p2.x, p2.y, 0.0f), n, uv1.x,uv2.y);
- vertex[2] = D3DVERTEX2(Math::Vector(p3.x, p3.y, 0.0f), n, uv2.x,uv2.y);
+ vertex[0] = Gfx::VertexTex2(Math::Vector(p1.x, p1.y, 0.0f), n, Math::Point(uv1.x,uv1.y));
+ vertex[1] = Gfx::VertexTex2(Math::Vector(p2.x, p2.y, 0.0f), n, Math::Point(uv1.x,uv2.y));
+ vertex[2] = Gfx::VertexTex2(Math::Vector(p3.x, p3.y, 0.0f), n, Math::Point(uv2.x,uv2.y));
- device->DrawPrimitive(D3DPT_TRIANGLELIST, D3DFVF_VERTEX2, vertex, 3, NULL);
+ device->DrawPrimitive(Gfx::PRIMITIVE_TRIANGLES, vertex, 3);
m_engine->AddStatisticTriangle(1);
}
@@ -950,28 +922,28 @@ void CMap::DrawTriangle(Math::Point p1, Math::Point p2, Math::Point p3, Math::Po
void CMap::DrawPenta(Math::Point p1, Math::Point p2, Math::Point p3, Math::Point p4, Math::Point p5, Math::Point uv1, Math::Point uv2)
{
- LPDIRECT3DDEVICE7 device;
- D3DVERTEX2 vertex[5]; // 1 pentagon
+ Gfx::CDevice* device;
+ Gfx::VertexTex2 vertex[5]; // 1 pentagon
Math::Vector n;
- device = m_engine->RetD3DDevice();
+ device = m_engine->GetDevice();
n = Math::Vector(0.0f, 0.0f, -1.0f); // normal
#if 1
- vertex[0] = D3DVERTEX2(Math::Vector(p1.x, p1.y, 0.0f), n, uv1.x,uv1.y);
- vertex[1] = D3DVERTEX2(Math::Vector(p2.x, p2.y, 0.0f), n, uv1.x,uv2.y);
- vertex[2] = D3DVERTEX2(Math::Vector(p5.x, p5.y, 0.0f), n, uv2.x,uv2.y);
- vertex[3] = D3DVERTEX2(Math::Vector(p3.x, p3.y, 0.0f), n, uv2.x,uv2.y);
- vertex[4] = D3DVERTEX2(Math::Vector(p4.x, p4.y, 0.0f), n, uv2.x,uv2.y);
+ vertex[0] = Gfx::VertexTex2(Math::Vector(p1.x, p1.y, 0.0f), n, Math::Point(uv1.x,uv1.y));
+ vertex[1] = Gfx::VertexTex2(Math::Vector(p2.x, p2.y, 0.0f), n, Math::Point(uv1.x,uv2.y));
+ vertex[2] = Gfx::VertexTex2(Math::Vector(p5.x, p5.y, 0.0f), n, Math::Point(uv2.x,uv2.y));
+ vertex[3] = Gfx::VertexTex2(Math::Vector(p3.x, p3.y, 0.0f), n, Math::Point(uv2.x,uv2.y));
+ vertex[4] = Gfx::VertexTex2(Math::Vector(p4.x, p4.y, 0.0f), n, Math::Point(uv2.x,uv2.y));
- device->DrawPrimitive(D3DPT_TRIANGLESTRIP, D3DFVF_VERTEX2, vertex, 5, NULL);
+ device->DrawPrimitive(Gfx::PRIMITIVE_TRIANGLE_STRIP, vertex, 5);
#else
- vertex[0] = D3DVERTEX2(Math::Vector(p2.x, p2.y, 0.0f), n, uv1.x,uv1.y);
- vertex[1] = D3DVERTEX2(Math::Vector(p3.x, p3.y, 0.0f), n, uv1.x,uv2.y);
- vertex[2] = D3DVERTEX2(Math::Vector(p4.x, p4.y, 0.0f), n, uv2.x,uv2.y);
+ vertex[0] = Gfx::VertexTex2(Math::Vector(p2.x, p2.y, 0.0f), n, Math::Point(uv1.x,uv1.y));
+ vertex[1] = Gfx::VertexTex2(Math::Vector(p3.x, p3.y, 0.0f), n, Math::Point(uv1.x,uv2.y));
+ vertex[2] = Gfx::VertexTex2(Math::Vector(p4.x, p4.y, 0.0f), n, Math::Point(uv2.x,uv2.y));
- device->DrawPrimitive(D3DPT_TRIANGLELIST, D3DFVF_VERTEX2, vertex, 3, NULL);
+ device->DrawPrimitive(Gfx::PRIMITIVE_TRIANGLES, vertex, 3);
#endif
m_engine->AddStatisticTriangle(3);
}
@@ -980,12 +952,12 @@ void CMap::DrawPenta(Math::Point p1, Math::Point p2, Math::Point p3, Math::Point
void CMap::DrawVertex(Math::Point uv1, Math::Point uv2, float zoom)
{
- LPDIRECT3DDEVICE7 device;
- D3DVERTEX2 vertex[4]; // 2 triangles
+ Gfx::CDevice* device;
+ Gfx::VertexTex2 vertex[4]; // 2 triangles
Math::Point p1, p2, c;
Math::Vector n;
- device = m_engine->RetD3DDevice();
+ device = m_engine->GetDevice();
p1.x = m_pos.x;
p1.y = m_pos.y;
@@ -1007,12 +979,12 @@ void CMap::DrawVertex(Math::Point uv1, Math::Point uv2, float zoom)
n = Math::Vector(0.0f, 0.0f, -1.0f); // normal
- vertex[0] = D3DVERTEX2(Math::Vector(p1.x, p1.y, 0.0f), n, uv1.x,uv2.y);
- vertex[1] = D3DVERTEX2(Math::Vector(p1.x, p2.y, 0.0f), n, uv1.x,uv1.y);
- vertex[2] = D3DVERTEX2(Math::Vector(p2.x, p1.y, 0.0f), n, uv2.x,uv2.y);
- vertex[3] = D3DVERTEX2(Math::Vector(p2.x, p2.y, 0.0f), n, uv2.x,uv1.y);
+ vertex[0] = Gfx::VertexTex2(Math::Vector(p1.x, p1.y, 0.0f), n, Math::Point(uv1.x,uv2.y));
+ vertex[1] = Gfx::VertexTex2(Math::Vector(p1.x, p2.y, 0.0f), n, Math::Point(uv1.x,uv1.y));
+ vertex[2] = Gfx::VertexTex2(Math::Vector(p2.x, p1.y, 0.0f), n, Math::Point(uv2.x,uv2.y));
+ vertex[3] = Gfx::VertexTex2(Math::Vector(p2.x, p2.y, 0.0f), n, Math::Point(uv2.x,uv1.y));
- device->DrawPrimitive(D3DPT_TRIANGLESTRIP, D3DFVF_VERTEX2, vertex, 4, NULL);
+ device->DrawPrimitive(Gfx::PRIMITIVE_TRIANGLE_STRIP, vertex, 4);
m_engine->AddStatisticTriangle(2);
}
@@ -1021,7 +993,7 @@ void CMap::DrawVertex(Math::Point uv1, Math::Point uv2, float zoom)
void CMap::UpdateTerrain()
{
- D3DCOLORVALUE color;
+ Gfx::Color color;
Math::Vector pos;
float scale, water, level, intensity;
int x, y;
@@ -1029,8 +1001,8 @@ void CMap::UpdateTerrain()
if ( m_fixImage[0] != 0 ) return; // still image?
if ( !m_engine->OpenImage("map.tga") ) return;
- scale = m_terrain->RetScaleRelief();
- water = m_water->RetLevel();
+ scale = m_terrain->GetScaleRelief();
+ water = m_water->GetLevel();
color.a = 0.0f;
for ( y=0 ; y<256 ; y++ )
@@ -1044,7 +1016,7 @@ void CMap::UpdateTerrain()
if ( pos.x >= -m_half && pos.x <= m_half &&
pos.z >= -m_half && pos.z <= m_half )
{
- level = m_terrain->RetFloorLevel(pos, true)/scale;
+ level = m_terrain->GetFloorLevel(pos, true)/scale;
}
else
{
@@ -1080,7 +1052,7 @@ void CMap::UpdateTerrain()
void CMap::UpdateTerrain(int bx, int by, int ex, int ey)
{
- D3DCOLORVALUE color;
+ Gfx::Color color;
Math::Vector pos;
float scale, water, level, intensity;
int x, y;
@@ -1089,8 +1061,8 @@ void CMap::UpdateTerrain(int bx, int by, int ex, int ey)
if ( !m_engine->OpenImage("map.tga") ) return;
m_engine->LoadImage();
- scale = m_terrain->RetScaleRelief();
- water = m_water->RetLevel();
+ scale = m_terrain->GetScaleRelief();
+ water = m_water->GetLevel();
color.a = 0.0f;
for ( y=by ; y<ey ; y++ )
@@ -1104,7 +1076,7 @@ void CMap::UpdateTerrain(int bx, int by, int ex, int ey)
if ( pos.x >= -m_half && pos.x <= m_half &&
pos.z >= -m_half && pos.z <= m_half )
{
- level = m_terrain->RetFloorLevel(pos, true)/scale;
+ level = m_terrain->GetFloorLevel(pos, true)/scale;
}
else
{
@@ -1145,7 +1117,7 @@ void CMap::FlushObject()
m_totalFix = 0; // object index fixed
m_totalMove = MAPMAXOBJECT-2; // moving vehicles index
- m_bRadar = m_main->RetCheatRadar(); // no radar
+ //m_bRadar = m_main->GetCheatRadar(); // no radar
for ( i=0 ; i<MAPMAXOBJECT ; i++ )
{
@@ -1166,14 +1138,14 @@ void CMap::UpdateObject(CObject* pObj)
if ( !m_bEnable ) return;
if ( m_totalFix >= m_totalMove ) return; // full table?
- if ( !pObj->RetActif() ) return;
- if ( !pObj->RetSelectable() ) return;
- if ( pObj->RetProxyActivate() ) return;
- if ( pObj->RetTruck() != 0 ) return;
+ if ( !pObj->GetActif() ) return;
+ if ( !pObj->GetSelectable() ) return;
+ if ( pObj->GetProxyActivate() ) return;
+ if ( pObj->GetTruck() != 0 ) return;
- type = pObj->RetType();
- pos = pObj->RetPosition(0);
- dir = -(pObj->RetAngleY(0)+Math::PI/2.0f);
+ type = pObj->GetType();
+ pos = pObj->GetPosition(0);
+ dir = -(pObj->GetAngleY(0)+Math::PI/2.0f);
if ( m_angle != 0.0f )
{
@@ -1299,7 +1271,7 @@ void CMap::UpdateObject(CObject* pObj)
color != MAPCOLOR_MOVE ) return;
}
- if ( pObj->RetSelect() )
+ if ( pObj->GetSelect() )
{
m_map[MAPMAXOBJECT-1].type = type;
m_map[MAPMAXOBJECT-1].object = pObj;
@@ -1337,3 +1309,4 @@ void CMap::UpdateObject(CObject* pObj)
}
}
+}
diff --git a/src/ui/map.h b/src/ui/map.h
index 7e80e0a..18020af 100644
--- a/src/ui/map.h
+++ b/src/ui/map.h
@@ -1,5 +1,6 @@
// * This file is part of the COLOBOT source code
// * Copyright (C) 2001-2008, Daniel ROUX & EPSITEC SA, www.epsitec.ch
+// * Copyright (C) 2012 Polish Portal of Colobot (PPC)
// *
// * 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
@@ -22,11 +23,21 @@
#include <ui/control.h>
#include <object/object.h>
+#include <object/robotmain.h>
#include <common/event.h>
+#include <common/iman.h>
-class CTerrain;
-class CWater;
+#include <graphics/engine/terrain.h>
+#include <graphics/engine/water.h>
+#include <graphics/engine/engine.h>
+#include <graphics/core/device.h>
+#include <graphics/core/vertex.h>
+
+#include <math/geometry.h>
+
+
+namespace Ui {
const int MAPMAXOBJECT = 100;
@@ -51,7 +62,7 @@ struct MapObject
CObject* object;
MapColor color;
ObjectType type;
- Math::Point pos;
+ Math::Point pos;
float dir;
};
@@ -59,77 +70,78 @@ struct MapObject
class CMap : public CControl
{
-public:
- CMap();
- ~CMap();
-
- bool Create(Math::Point pos, Math::Point dim, int icon, EventType eventMsg);
- bool EventProcess(const Event &event);
- void Draw();
-
- void UpdateTerrain();
- void UpdateTerrain(int bx, int by, int ex, int ey);
-
- void SetFixImage(char *filename);
- bool RetFixImage();
-
- void SetOffset(float ox, float oy);
- void SetAngle(float angle);
- void SetMode(int mode);
- void SetToy(bool bToy);
- void SetDebug(bool bDebug);
-
- void SetZoom(float value);
- float RetZoom();
-
- void SetEnable(bool bEnable);
- bool RetEnable();
-
- void SetFloorColor(Gfx::Color color);
- void SetWaterColor(Gfx::Color color);
-
- void FlushObject();
- void UpdateObject(CObject* pObj);
-
- CObject* DetectObject(Math::Point pos, bool &bInMap);
- void SetHilite(CObject* pObj);
-
-protected:
- Math::Point AdjustOffset(Math::Point offset);
- void SelectObject(Math::Point pos);
- Math::Point MapInter(Math::Point pos, float dir);
- void DrawFocus(Math::Point pos, float dir, ObjectType type, MapColor color);
- void DrawObject(Math::Point pos, float dir, ObjectType type, MapColor color, bool bSelect, bool bHilite);
- void DrawObjectIcon(Math::Point pos, Math::Point dim, MapColor color, ObjectType type, bool bHilite);
- void DrawHilite(Math::Point pos);
- void DrawTriangle(Math::Point p1, Math::Point p2, Math::Point p3, Math::Point uv1, Math::Point uv2);
- void DrawPenta(Math::Point p1, Math::Point p2, Math::Point p3, Math::Point p4, Math::Point p5, Math::Point uv1, Math::Point uv2);
- void DrawVertex(Math::Point uv1, Math::Point uv2, float zoom);
-
-protected:
- CTerrain* m_terrain;
- CWater* m_water;
- CRobotMain* m_main;
-
- bool m_bEnable;
- float m_time;
- float m_half;
- float m_zoom;
- Math::Point m_offset;
- float m_angle;
- Gfx::Color m_floorColor;
- Gfx::Color m_waterColor;
- MapObject m_map[MAPMAXOBJECT];
- int m_totalFix;
- int m_totalMove;
- int m_hiliteRank;
- Math::Point m_mapPos;
- Math::Point m_mapDim;
- bool m_bRadar;
- char m_fixImage[100];
- int m_mode;
- bool m_bToy;
- bool m_bDebug;
+ public:
+ CMap();
+ ~CMap();
+
+ bool Create(Math::Point pos, Math::Point dim, int icon, EventType eventMsg);
+ bool EventProcess(const Event &event);
+ void Draw();
+
+ void UpdateTerrain();
+ void UpdateTerrain(int bx, int by, int ex, int ey);
+
+ void SetFixImage(const char *filename);
+ bool GetFixImage();
+
+ void SetOffset(float ox, float oy);
+ void SetAngle(float angle);
+ void SetMode(int mode);
+ void SetToy(bool bToy);
+ void SetDebug(bool bDebug);
+
+ void SetZoom(float value);
+ float GetZoom();
+
+ void SetEnable(bool bEnable);
+ bool GetEnable();
+
+ void SetFloorColor(Gfx::Color color);
+ void SetWaterColor(Gfx::Color color);
+
+ void FlushObject();
+ void UpdateObject(CObject* pObj);
+
+ CObject* DetectObject(Math::Point pos, bool &bInMap);
+ void SetHighlight(CObject* pObj);
+
+ protected:
+ Math::Point AdjustOffset(Math::Point offset);
+ void SelectObject(Math::Point pos);
+ Math::Point MapInter(Math::Point pos, float dir);
+ void DrawFocus(Math::Point pos, float dir, ObjectType type, MapColor color);
+ void DrawObject(Math::Point pos, float dir, ObjectType type, MapColor color, bool bSelect, bool bHilite);
+ void DrawObjectIcon(Math::Point pos, Math::Point dim, MapColor color, ObjectType type, bool bHilite);
+ void DrawHighlight(Math::Point pos);
+ void DrawTriangle(Math::Point p1, Math::Point p2, Math::Point p3, Math::Point uv1, Math::Point uv2);
+ void DrawPenta(Math::Point p1, Math::Point p2, Math::Point p3, Math::Point p4, Math::Point p5, Math::Point uv1, Math::Point uv2);
+ void DrawVertex(Math::Point uv1, Math::Point uv2, float zoom);
+
+ protected:
+ Gfx::CTerrain* m_terrain;
+ Gfx::CWater* m_water;
+ CRobotMain* m_main;
+
+ bool m_bEnable;
+ float m_time;
+ float m_half;
+ float m_zoom;
+ Math::Point m_offset;
+ float m_angle;
+ Gfx::Color m_floorColor;
+ Gfx::Color m_waterColor;
+ MapObject m_map[MAPMAXOBJECT];
+ int m_totalFix;
+ int m_totalMove;
+ int m_highlightRank;
+ Math::Point m_mapPos;
+ Math::Point m_mapDim;
+ bool m_bRadar;
+ char m_fixImage[100];
+ int m_mode;
+ bool m_bToy;
+ bool m_bDebug;
};
+}
diff --git a/src/ui/shortcut.cpp b/src/ui/shortcut.cpp
index fe9ca9b..05e5d2d 100644
--- a/src/ui/shortcut.cpp
+++ b/src/ui/shortcut.cpp
@@ -1,5 +1,6 @@
// * This file is part of the COLOBOT source code
// * Copyright (C) 2001-2008, Daniel ROUX & EPSITEC SA, www.epsitec.ch
+// * Copyright (C) 2012, Polish Portal of Colobot (PPC)
// *
// * 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
@@ -17,24 +18,27 @@
// shortcut.cpp
-#include <windows.h>
-#include <stdio.h>
-#include <d3d.h>
-
-#include "common/struct.h"
-#include "old/d3dengine.h"
-#include "old/math3d.h"
+//#include <windows.h>
+//#include <stdio.h>
+//#include <d3d.h>
+#include <math.h>
+//#include "common/struct.h"
+//#include "old/d3dengine.h"
+//#include "old/math3d.h"
+#include "graphics/engine/engine.h"
+#include "graphics/core/device.h"
#include "common/event.h"
#include "common/misc.h"
#include "common/iman.h"
#include "ui/shortcut.h"
-
+namespace Ui {
// Object's constructor.
-CShortcut::CShortcut(CInstanceManager* iMan) : CControl(iMan)
+//CShortcut::CShortcut(CInstanceManager* iMan) : CControl(iMan)
+CShortcut::CShortcut() : CControl()
{
m_time = 0.0f;
}
@@ -48,11 +52,11 @@ CShortcut::~CShortcut()
// Creates a new button.
-bool CShortcut::Create(Math::Point pos, Math::Point dim, int icon, EventMsg eventMsg)
+bool CShortcut::Create(Math::Point pos, Math::Point dim, int icon, EventType eventType)
{
- if ( eventMsg == EVENT_NULL ) eventMsg = GetUniqueEventMsg();
+ if ( eventType == EVENT_NULL ) eventType = GetUniqueEventType();
- CControl::Create(pos, dim, icon, eventMsg);
+ CControl::Create(pos, dim, icon, eventType);
return true;
}
@@ -63,17 +67,18 @@ bool CShortcut::EventProcess(const Event &event)
{
CControl::EventProcess(event);
- if ( event.event == EVENT_FRAME )
+ if ( event.type == EVENT_FRAME )
{
m_time += event.rTime;
}
- if ( event.event == EVENT_LBUTTONDOWN )
+ if ( event.type == EVENT_MOUSE_BUTTON_DOWN &&
+ event.mouseButton.button == 1)
{
if ( CControl::Detect(event.pos) )
{
Event newEvent = event;
- newEvent.event = m_eventMsg;
+ newEvent.type = m_eventType;
m_event->AddEvent(newEvent);
return false;
}
@@ -92,24 +97,24 @@ void CShortcut::Draw()
icon = 0;
zoom = 0.8f;
- mode = D3DSTATETTw;
+ mode = Gfx::ENG_RSTATE_TTEXTURE_WHITE;
if ( m_state & STATE_HILIGHT )
{
icon = 4;
zoom = 0.9f;
- mode = D3DSTATENORMAL;
+ mode = Gfx::ENG_RSTATE_NORMAL;
}
if ( m_state & STATE_CHECK )
{
icon = 1;
zoom = 0.8f;
- mode = D3DSTATENORMAL;
+ mode = Gfx::ENG_RSTATE_NORMAL;
}
if ( m_state & STATE_PRESS )
{
icon = 1;
zoom = 1.0f;
- mode = D3DSTATENORMAL;
+ mode = Gfx::ENG_RSTATE_NORMAL;
}
if ( m_icon == 6 || m_icon == 7 ) // pause or film?
{
@@ -125,7 +130,7 @@ void CShortcut::Draw()
DrawVertex(icon, 0.95f);
}
- m_engine->SetState(D3DSTATETTb);
+ m_engine->SetState(Gfx::ENG_RSTATE_TTEXTURE_BLACK);
DrawVertex(m_icon, zoom);
if ( m_state & STATE_FRAME )
@@ -134,7 +139,7 @@ void CShortcut::Draw()
float zoom, dp;
m_engine->SetTexture("button2.tga");
- m_engine->SetState(D3DSTATETTw);
+ m_engine->SetState(Gfx::ENG_RSTATE_TTEXTURE_WHITE);
zoom = 0.9f+sinf(m_time*8.0f)*0.1f;
@@ -174,7 +179,7 @@ void CShortcut::Draw()
float dp;
m_engine->SetTexture("button3.tga");
- m_engine->SetState(D3DSTATETTw);
+ m_engine->SetState(Gfx::ENG_RSTATE_TTEXTURE_WHITE);
uv1.x = 160.0f/256.0f;
uv1.y = 0.0f/256.0f;
@@ -195,13 +200,13 @@ void CShortcut::Draw()
void CShortcut::DrawVertex(int icon, float zoom)
{
- LPDIRECT3DDEVICE7 device;
- D3DVERTEX2 vertex[4]; // 2 triangles
+ Gfx::CDevice* device;
+ Gfx::Vertex vertex[4]; // 2 triangles
Math::Point p1, p2, c;
Math::Vector n;
float u1, u2, v1, v2, dp;
- device = m_engine->RetD3DDevice();
+ device = m_engine->GetDevice();
p1.x = m_pos.x;
p1.y = m_pos.y;
@@ -230,12 +235,13 @@ void CShortcut::DrawVertex(int icon, float zoom)
n = Math::Vector(0.0f, 0.0f, -1.0f); // normal
- vertex[0] = D3DVERTEX2(Math::Vector(p1.x, p1.y, 0.0f), n, u1,v2);
- vertex[1] = D3DVERTEX2(Math::Vector(p1.x, p2.y, 0.0f), n, u1,v1);
- vertex[2] = D3DVERTEX2(Math::Vector(p2.x, p1.y, 0.0f), n, u2,v2);
- vertex[3] = D3DVERTEX2(Math::Vector(p2.x, p2.y, 0.0f), n, u2,v1);
+ vertex[0] = Gfx::Vertex(Math::Vector(p1.x, p1.y, 0.0f), n, Math::Point(u1, v2));
+ vertex[1] = Gfx::Vertex(Math::Vector(p1.x, p2.y, 0.0f), n, Math::Point(u1, v1));
+ vertex[2] = Gfx::Vertex(Math::Vector(p2.x, p1.y, 0.0f), n, Math::Point(u2, v2));
+ vertex[3] = Gfx::Vertex(Math::Vector(p2.x, p2.y, 0.0f), n, Math::Point(u2, v1));
- device->DrawPrimitive(D3DPT_TRIANGLESTRIP, D3DFVF_VERTEX2, vertex, 4, NULL);
+ device->DrawPrimitive(Gfx::PRIMITIVE_TRIANGLE_STRIP, vertex, 4);
m_engine->AddStatisticTriangle(2);
}
+}
diff --git a/src/ui/shortcut.h b/src/ui/shortcut.h
index d819bf2..9ee97e0 100644
--- a/src/ui/shortcut.h
+++ b/src/ui/shortcut.h
@@ -1,5 +1,6 @@
// * This file is part of the COLOBOT source code
// * Copyright (C) 2001-2008, Daniel ROUX & EPSITEC SA, www.epsitec.ch
+// * Copyright (C) 2012, Polish Portal of Colobot (PPC)
// *
// * 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
@@ -22,6 +23,7 @@
#include <common/event.h>
+namespace Ui {
class CShortcut : public CControl
{
@@ -29,7 +31,7 @@ class CShortcut : public CControl
CShortcut();
~CShortcut();
- bool Create(Math::Point pos, Math::Point dim, int icon, EventType eventMsg);
+ bool Create(Math::Point pos, Math::Point dim, int icon, EventType eventType);
bool EventProcess(const Event &event);
@@ -43,3 +45,4 @@ class CShortcut : public CControl
};
+}
diff --git a/src/ui/slider.h b/src/ui/slider.h
index b0de011..0de9b3c 100644
--- a/src/ui/slider.h
+++ b/src/ui/slider.h
@@ -26,8 +26,6 @@
namespace Ui {
-class CButton;
-
class CSlider : public CControl
{
public:
diff --git a/src/ui/studio.cpp b/src/ui/studio.cpp
index 9de87cf..5062798 100644
--- a/src/ui/studio.cpp
+++ b/src/ui/studio.cpp
@@ -1,5 +1,6 @@
// * This file is part of the COLOBOT source code
// * Copyright (C) 2001-2008, Daniel ROUX & EPSITEC SA, www.epsitec.ch
+// * Copyright (C) 2012 Polish Portal of Colobot (PPC)
// *
// * 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
@@ -17,58 +18,27 @@
// studio.cpp
-#include <stdlib.h>
-#include <stdio.h>
-#include <ctype.h>
-#include <windows.h>
-#include <direct.h>
-#include <io.h>
-#include <time.h>
-#include <d3d.h>
-
-#include "common/struct.h"
-#include "old/d3dengine.h"
-#include "old/d3dmath.h"
-#include "common/language.h"
-#include "common/event.h"
-#include "common/misc.h"
-#include "common/iman.h"
-#include "common/restext.h"
-#include "old/math3d.h"
-#include "object/robotmain.h"
-#include "object/object.h"
-#include "old/camera.h"
-#include "old/sound.h"
-#include "script/script.h"
-#include "ui/interface.h"
-#include "ui/button.h"
-#include "ui/check.h"
-#include "ui/slider.h"
-#include "ui/edit.h"
-#include "ui/list.h"
-#include "ui/label.h"
-#include "ui/group.h"
-#include "ui/window.h"
-#include "old/text.h"
-#include "script/cbottoken.h"
-#include "ui/studio.h"
+#include "studio.h"
+#include <script/cbottoken.h>
+namespace Ui {
// Object's constructor.
-CStudio::CStudio(CInstanceManager* iMan)
+CStudio::CStudio()
{
- m_iMan = iMan;
+ m_iMan = CInstanceManager::GetInstancePointer();
m_iMan->AddInstance(CLASS_STUDIO, this);
- m_engine = (CD3DEngine*)m_iMan->SearchInstance(CLASS_ENGINE);
- m_event = (CEvent*)m_iMan->SearchInstance(CLASS_EVENT);
- m_interface = (CInterface*)m_iMan->SearchInstance(CLASS_INTERFACE);
- m_main = (CRobotMain*)m_iMan->SearchInstance(CLASS_MAIN);
- m_camera = (CCamera*)m_iMan->SearchInstance(CLASS_CAMERA);
- m_sound = (CSound*)m_iMan->SearchInstance(CLASS_SOUND);
+ m_engine = static_cast<Gfx::CEngine*>(m_iMan->SearchInstance(CLASS_ENGINE));
+ m_event = static_cast<CEventQueue*>(m_iMan->SearchInstance(CLASS_EVENT));
+ m_interface = static_cast<CInterface*>(m_iMan->SearchInstance(CLASS_INTERFACE));
+ m_main = static_cast<CRobotMain*>(m_iMan->SearchInstance(CLASS_MAIN));
+ m_camera = static_cast<CCamera*>(m_iMan->SearchInstance(CLASS_CAMERA));
+ m_sound = static_cast<CSoundInterface*>(m_iMan->SearchInstance(CLASS_SOUND));
+ m_app = CApplication::GetInstancePointer();
m_bEditMaximized = false;
m_bEditMinimized = false;
@@ -103,85 +73,85 @@ bool CStudio::EventProcess(const Event &event)
return EventDialog(event);
}
- if ( event.event == EVENT_FRAME )
+ if ( event.type == EVENT_FRAME )
{
EventFrame(event);
}
pw = (CWindow*)m_interface->SearchControl(EVENT_WINDOW3);
- if ( pw == 0 ) return false;
+ if ( pw == nullptr ) return false;
- edit = (CEdit*)pw->SearchControl(EVENT_STUDIO_EDIT);
+ edit = static_cast<CEdit*>(pw->SearchControl(EVENT_STUDIO_EDIT));
if ( edit == 0 ) return false;
- if ( event.event == pw->RetEventMsgClose() )
+ if ( event.type == pw->GetEventTypeClose() )
{
Event newEvent = event;
- newEvent.event = EVENT_STUDIO_OK;
+ newEvent.type = EVENT_STUDIO_OK;
m_event->AddEvent(newEvent);
}
- if ( event.event == EVENT_STUDIO_EDIT ) // text modifief?
+ if ( event.type == EVENT_STUDIO_EDIT ) // text modifief?
{
ColorizeScript(edit);
}
- if ( event.event == EVENT_STUDIO_LIST ) // list clicked?
+ if ( event.type == EVENT_STUDIO_LIST ) // list clicked?
{
- m_main->StartDisplayInfo(m_helpFilename, -1);
+ m_main->StartDisplayInfo(const_cast<char *>(m_helpFilename.c_str()), -1); // TODO change to std::string when RobotMain changes
}
- if ( event.event == EVENT_STUDIO_NEW ) // new?
+ if ( event.type == EVENT_STUDIO_NEW ) // new?
{
m_script->New(edit, "");
}
- if ( event.event == EVENT_STUDIO_OPEN ) // open?
+ if ( event.type == EVENT_STUDIO_OPEN ) // open?
{
StartDialog(SD_OPEN);
}
- if ( event.event == EVENT_STUDIO_SAVE ) // save?
+ if ( event.type == EVENT_STUDIO_SAVE ) // save?
{
StartDialog(SD_SAVE);
}
- if ( event.event == EVENT_STUDIO_UNDO ) // undo?
+ if ( event.type == EVENT_STUDIO_UNDO ) // undo?
{
edit->Undo();
}
- if ( event.event == EVENT_STUDIO_CUT ) // cut?
+ if ( event.type == EVENT_STUDIO_CUT ) // cut?
{
edit->Cut();
}
- if ( event.event == EVENT_STUDIO_COPY ) // copy?
+ if ( event.type == EVENT_STUDIO_COPY ) // copy?
{
edit->Copy();
}
- if ( event.event == EVENT_STUDIO_PASTE ) // paste?
+ if ( event.type == EVENT_STUDIO_PASTE ) // paste?
{
edit->Paste();
}
- if ( event.event == EVENT_STUDIO_SIZE ) // size?
+ if ( event.type == EVENT_STUDIO_SIZE ) // size?
{
slider = (CSlider*)pw->SearchControl(EVENT_STUDIO_SIZE);
if ( slider == 0 ) return false;
- m_main->SetFontSize(9.0f+slider->RetVisibleValue()*6.0f);
+ m_main->SetFontSize(9.0f+slider->GetVisibleValue()*6.0f);
ViewEditScript();
}
- if ( event.event == EVENT_STUDIO_TOOL && // instructions?
+ if ( event.type == EVENT_STUDIO_TOOL && // instructions?
m_dialog == SD_NULL )
{
m_main->StartDisplayInfo(SATCOM_HUSTON, false);
}
- if ( event.event == EVENT_STUDIO_HELP && // help?
+ if ( event.type == EVENT_STUDIO_HELP && // help?
m_dialog == SD_NULL )
{
m_main->StartDisplayInfo(SATCOM_PROG, false);
}
- if ( event.event == EVENT_STUDIO_COMPILE ) // compile?
+ if ( event.type == EVENT_STUDIO_COMPILE ) // compile?
{
char buffer[100];
@@ -197,12 +167,12 @@ bool CStudio::EventProcess(const Event &event)
}
}
- if ( event.event == EVENT_STUDIO_RUN ) // run/stop?
+ if ( event.type == EVENT_STUDIO_RUN ) // run/stop?
{
if ( m_script->IsRunning() )
{
Event newEvent = event;
- newEvent.event = EVENT_OBJECT_PROGSTOP;
+ newEvent.type = EVENT_OBJECT_PROGSTOP;
m_event->AddEvent(newEvent); // stop
}
else
@@ -212,7 +182,7 @@ bool CStudio::EventProcess(const Event &event)
SetInfoText("", false);
Event newEvent = event;
- newEvent.event = EVENT_OBJECT_PROGSTART;
+ newEvent.type = EVENT_OBJECT_PROGSTART;
m_event->AddEvent(newEvent); // start
}
else
@@ -224,7 +194,7 @@ bool CStudio::EventProcess(const Event &event)
}
}
- if ( event.event == EVENT_STUDIO_REALTIME ) // real time?
+ if ( event.type == EVENT_STUDIO_REALTIME ) // real time?
{
m_bRealTime = !m_bRealTime;
m_script->SetStepMode(!m_bRealTime);
@@ -232,37 +202,37 @@ bool CStudio::EventProcess(const Event &event)
UpdateButtons();
}
- if ( event.event == EVENT_STUDIO_STEP ) // step?
+ if ( event.type == EVENT_STUDIO_STEP ) // step?
{
m_script->Step(event);
}
- if ( event.event == EVENT_KEYDOWN )
+ if ( event.type == EVENT_KEY_DOWN )
{
- if ( event.param == m_engine->RetKey(KEYRANK_CBOT, 0) ||
- event.param == m_engine->RetKey(KEYRANK_CBOT, 1) )
+ if ( event.param == m_app->GetKey(KEYRANK_CBOT, 0) ||
+ event.param == m_app->GetKey(KEYRANK_CBOT, 1) )
{
- if ( m_helpFilename[0] != 0 )
+ if ( m_helpFilename.length() > 0 )
{
- m_main->StartDisplayInfo(m_helpFilename, -1);
+ m_main->StartDisplayInfo(const_cast<char *>(m_helpFilename.c_str()), -1); // TODO change to std::string when RobotMain changes
}
}
}
- if ( event.event == EVENT_WINDOW3 ) // window is moved?
+ if ( event.type == EVENT_WINDOW3 ) // window is moved?
{
- m_editActualPos = m_editFinalPos = pw->RetPos();
- m_editActualDim = m_editFinalDim = pw->RetDim();
+ m_editActualPos = m_editFinalPos = pw->GetPos();
+ m_editActualDim = m_editFinalDim = pw->GetDim();
m_main->SetWindowPos(m_editActualPos);
m_main->SetWindowDim(m_editActualDim);
AdjustEditScript();
}
- if ( event.event == pw->RetEventMsgReduce() )
+ if ( event.type == pw->GetEventTypeReduce() )
{
if ( m_bEditMinimized )
{
- m_editFinalPos = m_main->RetWindowPos();
- m_editFinalDim = m_main->RetWindowDim();
+ m_editFinalPos = m_main->GetWindowPos();
+ m_editFinalDim = m_main->GetWindowDim();
m_bEditMinimized = false;
m_bEditMaximized = false;
}
@@ -277,18 +247,18 @@ bool CStudio::EventProcess(const Event &event)
}
m_main->SetEditFull(m_bEditMaximized);
pw = (CWindow*)m_interface->SearchControl(EVENT_WINDOW3);
- if ( pw != 0 )
+ if ( pw != nullptr )
{
pw->SetMaximized(m_bEditMaximized);
pw->SetMinimized(m_bEditMinimized);
}
}
- if ( event.event == pw->RetEventMsgFull() )
+ if ( event.type == pw->GetEventTypeFull() )
{
if ( m_bEditMaximized )
{
- m_editFinalPos = m_main->RetWindowPos();
- m_editFinalDim = m_main->RetWindowDim();
+ m_editFinalPos = m_main->GetWindowPos();
+ m_editFinalDim = m_main->GetWindowDim();
m_bEditMinimized = false;
m_bEditMaximized = false;
}
@@ -303,7 +273,7 @@ bool CStudio::EventProcess(const Event &event)
}
m_main->SetEditFull(m_bEditMaximized);
pw = (CWindow*)m_interface->SearchControl(EVENT_WINDOW3);
- if ( pw != 0 )
+ if ( pw != nullptr )
{
pw->SetMaximized(m_bEditMaximized);
pw->SetMinimized(m_bEditMinimized);
@@ -349,7 +319,7 @@ bool CStudio::EventFrame(const Event &event)
m_fixInfoTextTime -= event.rTime;
pw = (CWindow*)m_interface->SearchControl(EVENT_WINDOW3);
- if ( pw == 0 ) return false;
+ if ( pw == nullptr ) return false;
edit = (CEdit*)pw->SearchControl(EVENT_STUDIO_EDIT);
if ( edit == 0 ) return false;
@@ -363,10 +333,10 @@ bool CStudio::EventFrame(const Event &event)
UpdateFlux(); // stop
AdjustEditScript();
GetResource(RES_TEXT, RT_STUDIO_PROGSTOP, res);
- SetInfoText(res, false);
+ SetInfoText(std::string(res), false);
Event newEvent = event;
- newEvent.event = EVENT_OBJECT_PROGSTOP;
+ newEvent.type = EVENT_OBJECT_PROGSTOP;
m_event->AddEvent(newEvent); // stop
}
@@ -419,7 +389,7 @@ bool IsToken(int character)
{
char c;
- c = tolower(RetNoAccent(character));
+ c = tolower(GetNoAccent(character));
return ( (c >= 'a' && c <= 'z') ||
(c >= '0' && c <= '9') ||
@@ -435,8 +405,8 @@ void CStudio::SearchToken(CEdit* edit)
char* text;
char token[100];
- text = edit->RetText();
- len = edit->RetTextLength();
+ text = edit->GetText();
+ len = edit->GetTextLength();
edit->GetCursor(cursor1, cursor2);
i = cursor1;
@@ -499,8 +469,8 @@ void CStudio::SearchToken(CEdit* edit)
}
token[i] = 0;
- strcpy(m_helpFilename, RetHelpFilename(token));
- if ( m_helpFilename[0] == 0 )
+ m_helpFilename = std::string(GetHelpFilename(token));
+ if ( m_helpFilename.length() == 0 )
{
for ( i=0 ; i<OBJECT_MAX ; i++ )
{
@@ -510,28 +480,28 @@ void CStudio::SearchToken(CEdit* edit)
{
if ( strcmp(token, text) == 0 )
{
- strcpy(m_helpFilename, RetHelpFilename(type));
- SetInfoText(token, true);
+ m_helpFilename = GetHelpFilename(type);
+ SetInfoText(std::string(token), true);
return;
}
}
- text = RetObjectAlias(type);
+ text = GetObjectAlias(type);
if ( text[0] != 0 )
{
if ( strcmp(token, text) == 0 )
{
- strcpy(m_helpFilename, RetHelpFilename(type));
- SetInfoText(token, true);
+ m_helpFilename = GetHelpFilename(type);
+ SetInfoText(std::string(token), true);
return;
}
}
}
}
- text = RetHelpText(token);
- if ( text[0] == 0 && m_helpFilename[0] != 0 )
+ text = GetHelpText(token);
+ if ( text[0] == 0 && m_helpFilename.length() > 0 )
{
- SetInfoText(token, true);
+ SetInfoText(std::string(token), true);
}
else
{
@@ -549,7 +519,7 @@ void CStudio::ColorizeScript(CEdit* edit)
// Starts editing a program.
-void CStudio::StartEditScript(CScript *script, char* name, int rank)
+void CStudio::StartEditScript(CScript *script, std::string name, int rank)
{
Math::Point pos, dim;
CWindow* pw;
@@ -564,10 +534,10 @@ void CStudio::StartEditScript(CScript *script, char* name, int rank)
m_main->SetEditLock(true, true);
m_main->SetEditFull(false);
- m_bInitPause = m_engine->RetPause();
+ m_bInitPause = m_engine->GetPause();
m_main->SetSpeed(1.0f);
- m_editCamera = m_camera->RetType();
- m_camera->SetType(CAMERA_EDIT);
+ m_editCamera = m_camera->GetType();
+ m_camera->SetType(CAM_TYPE_EDIT);
m_bRunning = m_script->IsRunning();
m_bRealTime = m_bRunning;
@@ -579,10 +549,10 @@ void CStudio::StartEditScript(CScript *script, char* name, int rank)
button->ClearState(STATE_VISIBLE);
}
- pos = m_editFinalPos = m_editActualPos = m_main->RetWindowPos();
- dim = m_editFinalDim = m_editActualDim = m_main->RetWindowDim();
+ pos = m_editFinalPos = m_editActualPos = m_main->GetWindowPos();
+ dim = m_editFinalDim = m_editActualDim = m_main->GetWindowDim();
pw = m_interface->CreateWindows(pos, dim, 8, EVENT_WINDOW3);
- if ( pw == 0 ) return;
+ if ( pw == nullptr ) return;
pw->SetState(STATE_SHADOW);
pw->SetRedim(true); // before SetName!
pw->SetMovable(true);
@@ -600,10 +570,10 @@ void CStudio::StartEditScript(CScript *script, char* name, int rank)
edit->SetInsideScroll(false);
//? if ( m_bRunning ) edit->SetEdit(false);
edit->SetMaxChar(EDITSTUDIOMAX);
- edit->SetFontType(FONT_COURIER);
+ edit->SetFontType(Gfx::FONT_COURIER);
edit->SetFontStretch(0.7f);
edit->SetDisplaySpec(true);
- edit->SetAutoIndent(m_engine->RetEditIndentMode());
+ edit->SetAutoIndent(m_engine->GetEditIndentMode());
m_script->PutScript(edit, name);
ColorizeScript(edit);
@@ -611,7 +581,7 @@ void CStudio::StartEditScript(CScript *script, char* name, int rank)
list = pw->CreateList(pos, dim, 1, EVENT_STUDIO_LIST, 1.2f);
list->SetState(STATE_SHADOW);
- list->SetFontType(FONT_COURIER);
+ list->SetFontType(Gfx::FONT_COURIER);
list->SetSelectCap(false);
list->SetFontSize(SMALLFONT*0.85f);
//? list->SetFontStretch(1.0f);
@@ -632,7 +602,7 @@ void CStudio::StartEditScript(CScript *script, char* name, int rank)
button->SetState(STATE_SHADOW);
slider = pw->CreateSlider(pos, dim, 0, EVENT_STUDIO_SIZE);
slider->SetState(STATE_SHADOW);
- slider->SetVisibleValue((m_main->RetFontSize()-9.0f)/6.0f);
+ slider->SetVisibleValue((m_main->GetFontSize()-9.0f)/6.0f);
pw->CreateGroup(pos, dim, 19, EVENT_LABEL1); // SatCom logo
button = pw->CreateButton(pos, dim, 128+57, EVENT_STUDIO_TOOL);
button->SetState(STATE_SHADOW);
@@ -674,11 +644,11 @@ void CStudio::AdjustEditScript()
wdim = m_editActualDim;
pw = (CWindow*)m_interface->SearchControl(EVENT_WINDOW3);
- if ( pw != 0 )
+ if ( pw != nullptr )
{
pw->SetPos(wpos);
pw->SetDim(wdim);
- wdim = pw->RetDim();
+ wdim = pw->GetDim();
}
if ( m_bRunning ) hList = 80.0f/480.0f;
@@ -852,7 +822,7 @@ bool CStudio::StopEditScript(bool bCancel)
char buffer[100];
pw = (CWindow*)m_interface->SearchControl(EVENT_WINDOW3);
- if ( pw == 0 ) return false;
+ if ( pw == nullptr ) return false;
if ( !bCancel && !m_script->IsRunning() )
{
@@ -898,7 +868,7 @@ void CStudio::SetInfoText(char *text, bool bClickable)
if ( !bClickable ) m_fixInfoTextTime = 8.0f;
pw = (CWindow*)m_interface->SearchControl(EVENT_WINDOW3);
- if ( pw == 0 ) return;
+ if ( pw == nullptr ) return;
list = (CList*)pw->SearchControl(EVENT_STUDIO_LIST);
if ( list == 0 ) return;
@@ -933,13 +903,13 @@ void CStudio::ViewEditScript()
POINT dim;
pw = (CWindow*)m_interface->SearchControl(EVENT_WINDOW3);
- if ( pw == 0 ) return;
+ if ( pw == nullptr ) return;
edit = (CEdit*)pw->SearchControl(EVENT_STUDIO_EDIT);
if ( edit == 0 ) return;
- dim = m_engine->RetDim();
- edit->SetFontSize(m_main->RetFontSize()/(dim.x/640.0f));
+ dim = m_engine->GetDim();
+ edit->SetFontSize(m_main->GetFontSize()/(dim.x/640.0f));
}
@@ -981,7 +951,7 @@ void CStudio::UpdateButtons()
CButton* button;
pw = (CWindow*)m_interface->SearchControl(EVENT_WINDOW3);
- if ( pw == 0 ) return;
+ if ( pw == nullptr ) return;
edit = (CEdit*)pw->SearchControl(EVENT_STUDIO_EDIT);
if ( edit == 0 ) return;
@@ -1034,37 +1004,37 @@ void CStudio::StartDialog(StudioDialog type)
m_dialog = type;
pw = (CWindow*)m_interface->SearchControl(EVENT_WINDOW0);
- if ( pw != 0 ) pw->ClearState(STATE_ENABLE);
+ if ( pw != nullptr ) pw->ClearState(STATE_ENABLE);
pw = (CWindow*)m_interface->SearchControl(EVENT_WINDOW1);
- if ( pw != 0 ) pw->ClearState(STATE_ENABLE);
+ if ( pw != nullptr ) pw->ClearState(STATE_ENABLE);
pw = (CWindow*)m_interface->SearchControl(EVENT_WINDOW3);
- if ( pw != 0 ) pw->ClearState(STATE_ENABLE);
+ if ( pw != nullptr ) pw->ClearState(STATE_ENABLE);
pw = (CWindow*)m_interface->SearchControl(EVENT_WINDOW3);
- if ( pw != 0 ) pw->ClearState(STATE_ENABLE);
+ if ( pw != nullptr ) pw->ClearState(STATE_ENABLE);
pw = (CWindow*)m_interface->SearchControl(EVENT_WINDOW4);
- if ( pw != 0 ) pw->ClearState(STATE_ENABLE);
+ if ( pw != nullptr ) pw->ClearState(STATE_ENABLE);
pw = (CWindow*)m_interface->SearchControl(EVENT_WINDOW5);
- if ( pw != 0 ) pw->ClearState(STATE_ENABLE);
+ if ( pw != nullptr ) pw->ClearState(STATE_ENABLE);
pw = (CWindow*)m_interface->SearchControl(EVENT_WINDOW6);
- if ( pw != 0 ) pw->ClearState(STATE_ENABLE);
+ if ( pw != nullptr ) pw->ClearState(STATE_ENABLE);
pw = (CWindow*)m_interface->SearchControl(EVENT_WINDOW7);
- if ( pw != 0 ) pw->ClearState(STATE_ENABLE);
+ if ( pw != nullptr ) pw->ClearState(STATE_ENABLE);
pw = (CWindow*)m_interface->SearchControl(EVENT_WINDOW8);
- if ( pw != 0 ) pw->ClearState(STATE_ENABLE);
+ if ( pw != nullptr ) pw->ClearState(STATE_ENABLE);
if ( m_dialog == SD_OPEN ||
m_dialog == SD_SAVE )
{
- pos = m_main->RetIOPos();
- dim = m_main->RetIODim();
+ pos = m_main->GetIOPos();
+ dim = m_main->GetIODim();
}
//? pw = m_interface->CreateWindows(pos, dim, 8, EVENT_WINDOW9);
pw = m_interface->CreateWindows(pos, dim, m_dialog==SD_OPEN?14:13, EVENT_WINDOW9);
@@ -1084,25 +1054,25 @@ void CStudio::StartDialog(StudioDialog type)
{
GetResource(RES_TEXT, RT_IO_LIST, name);
pla = pw->CreateLabel(pos, dim, 0, EVENT_DIALOG_LABEL1, name);
- pla->SetJustif(1);
+ pla->SetTextAlign(1);
pli = pw->CreateList(pos, dim, 0, EVENT_DIALOG_LIST);
pli->SetState(STATE_SHADOW);
GetResource(RES_TEXT, RT_IO_NAME, name);
pla = pw->CreateLabel(pos, dim, 0, EVENT_DIALOG_LABEL2, name);
- pla->SetJustif(1);
+ pla->SetTextAlign(1);
pe = pw->CreateEdit(pos, dim, 0, EVENT_DIALOG_EDIT);
pe->SetState(STATE_SHADOW);
if ( m_dialog == SD_SAVE )
{
- pe->SetText(m_script->RetFilename());
+ pe->SetText(m_script->GetFilename());
}
GetResource(RES_TEXT, RT_IO_DIR, name);
pla = pw->CreateLabel(pos, dim, 0, EVENT_DIALOG_LABEL3, name);
- pla->SetJustif(1);
+ pla->SetTextAlign(1);
pc = pw->CreateCheck(pos, dim, 0, EVENT_DIALOG_CHECK1);
GetResource(RES_TEXT, RT_IO_PRIVATE, name);
@@ -1153,31 +1123,31 @@ void CStudio::StopDialog()
m_dialog = SD_NULL;
pw = (CWindow*)m_interface->SearchControl(EVENT_WINDOW0);
- if ( pw != 0 ) pw->SetState(STATE_ENABLE);
+ if ( pw != nullptr ) pw->SetState(STATE_ENABLE);
pw = (CWindow*)m_interface->SearchControl(EVENT_WINDOW1);
- if ( pw != 0 ) pw->SetState(STATE_ENABLE);
+ if ( pw != nullptr ) pw->SetState(STATE_ENABLE);
pw = (CWindow*)m_interface->SearchControl(EVENT_WINDOW3);
- if ( pw != 0 ) pw->SetState(STATE_ENABLE);
+ if ( pw != nullptr ) pw->SetState(STATE_ENABLE);
pw = (CWindow*)m_interface->SearchControl(EVENT_WINDOW3);
- if ( pw != 0 ) pw->SetState(STATE_ENABLE);
+ if ( pw != nullptr ) pw->SetState(STATE_ENABLE);
pw = (CWindow*)m_interface->SearchControl(EVENT_WINDOW4);
- if ( pw != 0 ) pw->SetState(STATE_ENABLE);
+ if ( pw != nullptr ) pw->SetState(STATE_ENABLE);
pw = (CWindow*)m_interface->SearchControl(EVENT_WINDOW5);
- if ( pw != 0 ) pw->SetState(STATE_ENABLE);
+ if ( pw != nullptr ) pw->SetState(STATE_ENABLE);
pw = (CWindow*)m_interface->SearchControl(EVENT_WINDOW6);
- if ( pw != 0 ) pw->SetState(STATE_ENABLE);
+ if ( pw != nullptr ) pw->SetState(STATE_ENABLE);
pw = (CWindow*)m_interface->SearchControl(EVENT_WINDOW7);
- if ( pw != 0 ) pw->SetState(STATE_ENABLE);
+ if ( pw != nullptr ) pw->SetState(STATE_ENABLE);
pw = (CWindow*)m_interface->SearchControl(EVENT_WINDOW8);
- if ( pw != 0 ) pw->SetState(STATE_ENABLE);
+ if ( pw != nullptr ) pw->SetState(STATE_ENABLE);
m_interface->DeleteControl(EVENT_WINDOW9);
m_main->SetSatComLock(false); // possible to use the SatCom
@@ -1198,10 +1168,10 @@ void CStudio::AdjustDialog()
char name[100];
pw = (CWindow*)m_interface->SearchControl(EVENT_WINDOW9);
- if ( pw == 0 ) return;
+ if ( pw == nullptr ) return;
- wpos = pw->RetPos();
- wdim = pw->RetDim();
+ wpos = pw->GetPos();
+ wdim = pw->GetDim();
pw->SetPos(wpos); // to move the buttons on the titlebar
if ( m_dialog == SD_OPEN ||
@@ -1316,12 +1286,12 @@ bool CStudio::EventDialog(const Event &event)
Math::Point wpos, wdim;
pw = (CWindow*)m_interface->SearchControl(EVENT_WINDOW9);
- if ( pw == 0 ) return false;
+ if ( pw == nullptr ) return false;
- if ( event.event == EVENT_WINDOW9 ) // window is moved?
+ if ( event.type == EVENT_WINDOW9 ) // window is moved?
{
- wpos = pw->RetPos();
- wdim = pw->RetDim();
+ wpos = pw->GetPos();
+ wdim = pw->GetDim();
m_main->SetIOPos(wpos);
m_main->SetIODim(wdim);
AdjustDialog();
@@ -1330,22 +1300,22 @@ bool CStudio::EventDialog(const Event &event)
if ( m_dialog == SD_OPEN ||
m_dialog == SD_SAVE )
{
- if ( event.event == EVENT_DIALOG_LIST )
+ if ( event.type == EVENT_DIALOG_LIST )
{
UpdateChangeList();
}
- if ( event.event == EVENT_DIALOG_EDIT )
+ if ( event.type == EVENT_DIALOG_EDIT )
{
UpdateChangeEdit();
}
- if ( event.event == EVENT_DIALOG_CHECK1 ) // private?
+ if ( event.type == EVENT_DIALOG_CHECK1 ) // private?
{
m_main->SetIOPublic(false);
UpdateDialogPublic();
UpdateDialogList();
}
- if ( event.event == EVENT_DIALOG_CHECK2 ) // public?
+ if ( event.type == EVENT_DIALOG_CHECK2 ) // public?
{
m_main->SetIOPublic(true);
UpdateDialogPublic();
@@ -1353,8 +1323,8 @@ bool CStudio::EventDialog(const Event &event)
}
}
- if ( event.event == EVENT_DIALOG_OK ||
- (event.event == EVENT_KEYDOWN && event.param == VK_RETURN) )
+ if ( event.type == EVENT_DIALOG_OK ||
+ (event.type == EVENT_KEYDOWN && event.param == VK_RETURN) )
{
if ( m_dialog == SD_OPEN )
{
@@ -1369,9 +1339,9 @@ bool CStudio::EventDialog(const Event &event)
return true;
}
- if ( event.event == EVENT_DIALOG_CANCEL ||
- (event.event == EVENT_KEYDOWN && event.param == VK_ESCAPE) ||
- event.event == pw->RetEventMsgClose() )
+ if ( event.type == EVENT_DIALOG_CANCEL ||
+ (event.type == EVENT_KEYDOWN && event.param == VK_ESCAPE) ||
+ event.type == pw->GetEventTypeClose() )
{
StopDialog();
return true;
@@ -1391,14 +1361,14 @@ void CStudio::UpdateChangeList()
char* p;
pw = (CWindow*)m_interface->SearchControl(EVENT_WINDOW9);
- if ( pw == 0 ) return;
+ if ( pw == nullptr ) return;
pl = (CList*)pw->SearchControl(EVENT_DIALOG_LIST);
if ( pl == 0 ) return;
pe = (CEdit*)pw->SearchControl(EVENT_DIALOG_EDIT);
- if ( pe == 0 ) return;
+ if ( pe == nullptr ) return;
- strcpy(name, pl->RetName(pl->RetSelect()));
- name[pe->RetMaxChar()] = 0; // truncates according lg max editable
+ strcpy(name, pl->GetName(pl->GetSelect()));
+ name[pe->GetMaxChar()] = 0; // truncates according lg max editable
p = strchr(name, '\t'); // seeks first tab
if ( p != 0 ) *p = 0;
pe->SetText(name);
@@ -1416,7 +1386,7 @@ void CStudio::UpdateChangeEdit()
CList* pl;
pw = (CWindow*)m_interface->SearchControl(EVENT_WINDOW9);
- if ( pw == 0 ) return;
+ if ( pw == nullptr ) return;
pl = (CList*)pw->SearchControl(EVENT_DIALOG_LIST);
if ( pl == 0 ) return;
@@ -1437,9 +1407,9 @@ void CStudio::UpdateDialogAction()
bool bError;
pw = (CWindow*)m_interface->SearchControl(EVENT_WINDOW9);
- if ( pw == 0 ) return;
+ if ( pw == nullptr ) return;
pe = (CEdit*)pw->SearchControl(EVENT_DIALOG_EDIT);
- if ( pe == 0 ) return;
+ if ( pe == nullptr ) return;
pb = (CButton*)pw->SearchControl(EVENT_DIALOG_OK);
if ( pb == 0 ) return;
@@ -1481,18 +1451,18 @@ void CStudio::UpdateDialogPublic()
char text[_MAX_FNAME+100];
pw = (CWindow*)m_interface->SearchControl(EVENT_WINDOW9);
- if ( pw == 0 ) return;
+ if ( pw == nullptr ) return;
pc = (CCheck*)pw->SearchControl(EVENT_DIALOG_CHECK1);
if ( pc != 0 )
{
- pc->SetState(STATE_CHECK, !m_main->RetIOPublic());
+ pc->SetState(STATE_CHECK, !m_main->GetIOPublic());
}
pc = (CCheck*)pw->SearchControl(EVENT_DIALOG_CHECK2);
if ( pc != 0 )
{
- pc->SetState(STATE_CHECK, m_main->RetIOPublic());
+ pc->SetState(STATE_CHECK, m_main->GetIOPublic());
}
pl = (CLabel*)pw->SearchControl(EVENT_DIALOG_LABEL1);
@@ -1509,7 +1479,8 @@ void CStudio::UpdateDialogPublic()
void CStudio::UpdateDialogList()
{
- CWindow* pw;
+ // TODO rewrite to multiplatform
+ /*CWindow* pw;
CList* pl;
long hFile;
struct _finddata_t fileBuffer;
@@ -1520,7 +1491,7 @@ void CStudio::UpdateDialogList()
int nbFilenames, i;
pw = (CWindow*)m_interface->SearchControl(EVENT_WINDOW9);
- if ( pw == 0 ) return;
+ if ( pw == nullptr ) return;
pl = (CList*)pw->SearchControl(EVENT_DIALOG_LIST);
if ( pl == 0 ) return;
pl->Flush();
@@ -1565,7 +1536,7 @@ void CStudio::UpdateDialogList()
pl->SetName(i, temp);
}
- free(listBuffer);
+ free(listBuffer);*/
}
// Constructs the name of the folder or open/save.
@@ -1573,13 +1544,13 @@ void CStudio::UpdateDialogList()
void CStudio::SearchDirectory(char *dir, bool bCreate)
{
- if ( m_main->RetIOPublic() )
+ if ( m_main->GetIOPublic() )
{
- sprintf(dir, "%s\\", m_main->RetPublicDir());
+ sprintf(dir, "%s\\", m_main->GetPublicDir());
}
else
{
- sprintf(dir, "%s\\%s\\Program\\", m_main->RetSavegameDir(), m_main->RetGamerName());
+ sprintf(dir, "%s\\%s\\Program\\", m_main->GetSavegameDir(), m_main->GetGamerName());
}
if ( bCreate )
@@ -1599,10 +1570,10 @@ bool CStudio::ReadProgram()
char* p;
pw = (CWindow*)m_interface->SearchControl(EVENT_WINDOW9);
- if ( pw == 0 ) return false;
+ if ( pw == nullptr ) return false;
pe = (CEdit*)pw->SearchControl(EVENT_DIALOG_EDIT);
- if ( pe == 0 ) return false;
+ if ( pe == nullptr ) return false;
pe->GetText(filename, 100);
if ( filename[0] == 0 ) return false;
@@ -1615,9 +1586,9 @@ bool CStudio::ReadProgram()
strcat(dir, filename);
pw = (CWindow*)m_interface->SearchControl(EVENT_WINDOW3);
- if ( pw == 0 ) return false;
+ if ( pw == nullptr ) return false;
pe = (CEdit*)pw->SearchControl(EVENT_STUDIO_EDIT);
- if ( pe == 0 ) return false;
+ if ( pe == nullptr ) return false;
if ( !pe->ReadText(dir) ) return false;
@@ -1637,10 +1608,10 @@ bool CStudio::WriteProgram()
char* p;
pw = (CWindow*)m_interface->SearchControl(EVENT_WINDOW9);
- if ( pw == 0 ) return false;
+ if ( pw == nullptr ) return false;
pe = (CEdit*)pw->SearchControl(EVENT_DIALOG_EDIT);
- if ( pe == 0 ) return false;
+ if ( pe == nullptr ) return false;
pe->GetText(filename, 100);
if ( filename[0] == 0 ) return false;
@@ -1653,9 +1624,9 @@ bool CStudio::WriteProgram()
strcat(dir, filename);
pw = (CWindow*)m_interface->SearchControl(EVENT_WINDOW3);
- if ( pw == 0 ) return false;
+ if ( pw == nullptr ) return false;
pe = (CEdit*)pw->SearchControl(EVENT_STUDIO_EDIT);
- if ( pe == 0 ) return false;
+ if ( pe == nullptr ) return false;
if ( !pe->WriteText(dir) ) return false;
@@ -1663,3 +1634,4 @@ bool CStudio::WriteProgram()
return true;
}
+}
diff --git a/src/ui/studio.h b/src/ui/studio.h
index 687ab22..e9fb69c 100644
--- a/src/ui/studio.h
+++ b/src/ui/studio.h
@@ -1,5 +1,6 @@
// * This file is part of the COLOBOT source code
// * Copyright (C) 2001-2008, Daniel ROUX & EPSITEC SA, www.epsitec.ch
+// * Copyright (C) 2012 Polish Portal of Colobot (PPC)
// *
// * 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
@@ -18,23 +19,46 @@
#pragma once
+#include <string>
-#include "object/object.h"
-#include "script/script.h"
+#include <object/object.h>
+#include <script/script.h>
-class CInstanceManager;
-class CD3DEngine;
-class CEvent;
-class CRobotMain;
-class CCamera;
-class CSound;
-class CInterface;
-class CScript;
-class CList;
-class CEdit;
+#include <graphics/engine/engine.h>
+#include <graphics/engine/camera.h>
+#include <common/event.h>
+#include <common/struct.h>
+#include <common/misc.h>
+#include <common/iman.h>
+#include <sound/sound.h>
+
+#include <ui/control.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/label.h>
+#include <ui/edit.h>
+#include <ui/editvalue.h>
+#include <ui/scroll.h>
+#include <ui/slider.h>
+#include <ui/list.h>
+#include <ui/shortcut.h>
+#include <ui/compass.h>
+#include <ui/target.h>
+#include <ui/map.h>
+#include <ui/window.h>
+#include <ui/interface.h>
+
+#include <app/app.h>
+
+
+namespace Ui {
enum StudioDialog
{
@@ -49,67 +73,71 @@ enum StudioDialog
class CStudio
{
-public:
- CStudio(CInstanceManager* iMan);
- ~CStudio();
-
- bool EventProcess(const Event &event);
-
- void StartEditScript(CScript *script, char* name, int rank);
- bool StopEditScript(bool bCancel);
-
-protected:
- bool EventFrame(const Event &event);
- void SearchToken(CEdit* edit);
- void ColorizeScript(CEdit* edit);
- void AdjustEditScript();
- void SetInfoText(char *text, bool bClickable);
- void ViewEditScript();
- void UpdateFlux();
- void UpdateButtons();
-
- void StartDialog(StudioDialog type);
- void StopDialog();
- void AdjustDialog();
- bool EventDialog(const Event &event);
- void UpdateChangeList();
- void UpdateChangeEdit();
- void UpdateDialogAction();
- void UpdateDialogPublic();
- void UpdateDialogList();
- void SearchDirectory(char *dir, bool bCreate);
- bool ReadProgram();
- bool WriteProgram();
-
-protected:
- CInstanceManager* m_iMan;
- CD3DEngine* m_engine;
- CEvent* m_event;
- CRobotMain* m_main;
- CCamera* m_camera;
- CSound* m_sound;
- CInterface* m_interface;
-
- int m_rank;
- CScript* m_script;
-
- bool m_bEditMaximized;
- bool m_bEditMinimized;
-
- CameraType m_editCamera;
- Math::Point m_editActualPos;
- Math::Point m_editActualDim;
- Math::Point m_editFinalPos;
- Math::Point m_editFinalDim;
-
- float m_time;
- float m_fixInfoTextTime;
- bool m_bRunning;
- bool m_bRealTime;
- bool m_bInitPause;
- char m_helpFilename[100];
+ public:
+ CStudio();
+ ~CStudio();
+
+ bool EventProcess(const Event &event);
+
+ void StartEditScript(CScript *script, std::string name, int rank);
+ bool StopEditScript(bool bCancel);
+
+ protected:
+ bool EventFrame(const Event &event);
+ void SearchToken(CEdit* edit);
+ void ColorizeScript(CEdit* edit);
+ void AdjustEditScript();
+ void SetInfoText(std::string text, bool bClickable);
+ void ViewEditScript();
+ void UpdateFlux();
+ void UpdateButtons();
+
+ void StartDialog(StudioDialog type);
+ void StopDialog();
+ void AdjustDialog();
+ bool EventDialog(const Event &event);
+ void UpdateChangeList();
+ void UpdateChangeEdit();
+ void UpdateDialogAction();
+ void UpdateDialogPublic();
+ void UpdateDialogList();
+ void SearchDirectory(std::string dir, bool bCreate);
+ bool ReadProgram();
+ bool WriteProgram();
+
+ protected:
+ CInstanceManager* m_iMan;
+ Gfx::CEngine* m_engine;
+ CEventQueue* m_event;
+ CRobotMain* m_main;
+ CCamera* m_camera;
+ CSoundInterface* m_sound;
+ CInterface* m_interface;
+ CApplication *m_app;
+
+ int m_rank;
+ CScript* m_script;
+ Gfx::CameraType m_editCamera;
+
+ bool m_bEditMaximized;
+ bool m_bEditMinimized;
+
+ CameraType m_editCamera;
+ Math::Point m_editActualPos;
+ Math::Point m_editActualDim;
+ Math::Point m_editFinalPos;
+ Math::Point m_editFinalDim;
+
+ float m_time;
+ float m_fixInfoTextTime;
+ bool m_bRunning;
+ bool m_bRealTime;
+ bool m_bInitPause;
+ std::string m_helpFilename;
StudioDialog m_dialog;
};
+}
+
diff --git a/src/ui/target.cpp b/src/ui/target.cpp
index db478fe..f0ae70e 100644
--- a/src/ui/target.cpp
+++ b/src/ui/target.cpp
@@ -17,21 +17,7 @@
// target.cpp
-//#include <windows.h>
-//#include <stdio.h>
-//#include <d3d.h>
-
-//#include "common/struct.h"
-//#include "old/d3dengine.h"
-//#include "old/math3d.h"
-#include "graphics/engine/engine.h"
-#include "common/event.h"
-#include "common/misc.h"
-#include "common/iman.h"
-#include "object/robotmain.h"
-#include "object/object.h"
-#include "common/restext.h"
-#include "ui/target.h"
+#include <ui/target.h>
@@ -137,7 +123,7 @@ bool CTarget::EventProcess(const Event &event)
{
if ( CControl::Detect(event.pos) )
{
- if ( !m_main->RetFriendAim() )
+ if ( !m_main->GetFriendAim() )
{
Event newEvent = event;
newEvent.type = EVENT_OBJECT_FIRE;
@@ -162,7 +148,7 @@ void CTarget::Draw()
// Returns the tooltip.
-bool CTarget::GetTooltip(Math::Point pos, char* name)
+bool CTarget::GetTooltip(Math::Point pos, std::string &name)
{
#if 0
if ( (m_state&STATE_VISIBLE) && Detect(pos) ) // in the window?
@@ -181,9 +167,9 @@ bool CTarget::GetTooltip(Math::Point pos, char* name)
{
//? pObj = DetectFriendObject(pos);
//? if ( pObj == 0 )
- if ( !m_main->RetFriendAim() )
+ if ( !m_main->GetFriendAim() )
{
- strcpy(name, m_tooltip);
+ m_tooltip = name;
return true; // does not detect objects below!
}
}
diff --git a/src/ui/target.h b/src/ui/target.h
index 0b5b67d..1f7f256 100644
--- a/src/ui/target.h
+++ b/src/ui/target.h
@@ -18,11 +18,21 @@
#pragma once
+#include <string>
#include <ui/control.h>
+#include <common/misc.h>
+#include <common/iman.h>
+#include <common/restext.h>
#include <common/event.h>
+#include <graphics/engine/engine.h>
+
+#include <object/robotmain.h>
+#include <object/object.h>
+
+
namespace Ui {
class CTarget : public CControl
@@ -35,7 +45,7 @@ class CTarget : public CControl
bool EventProcess(const Event &event);
void Draw();
- bool GetTooltip(Math::Point pos, char* name);
+ bool GetTooltip(Math::Point pos, std::string &name);
protected:
CObject* DetectFriendObject(Math::Point pos);
diff --git a/src/ui/window.cpp b/src/ui/window.cpp
index fabd9c4..f922569 100644
--- a/src/ui/window.cpp
+++ b/src/ui/window.cpp
@@ -18,38 +18,7 @@
// window.cpp
-//#include <windows.h>
-//#include <stdio.h>
-//#include <d3d.h>
-
-//#include "common/struct.h"
-//#include "old/d3dengine.h"
-#include "common/language.h"
-//#include "old/math3d.h"
-#include "common/event.h"
-#include "common/misc.h"
-#include "common/restext.h"
-#include "common/iman.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/label.h"
-#include "ui/edit.h"
-#include "ui/editvalue.h"
-#include "ui/scroll.h"
-#include "ui/slider.h"
-#include "ui/list.h"
-#include "ui/shortcut.h"
-#include "ui/map.h"
-#include "ui/gauge.h"
-#include "ui/compass.h"
-#include "ui/target.h"
-//#include "old/text.h"
-#include "graphics/engine/text.h"
-#include "ui/window.h"
+#include <ui/window.h>
@@ -280,11 +249,9 @@ CImage* CWindow::CreateImage(Math::Point pos, Math::Point dim, int icon, EventTy
// Creates a new label.
-CLabel* CWindow::CreateLabel(Math::Point pos, Math::Point dim, int icon, EventType eventMsg,
- char *name)
+CLabel* CWindow::CreateLabel(Math::Point pos, Math::Point dim, int icon, EventType eventMsg, std::string name)
{
CLabel* pc;
- char* p;
int i;
if ( eventMsg == EVENT_NULL ) eventMsg = GetUniqueEventType();
@@ -298,22 +265,11 @@ CLabel* CWindow::CreateLabel(Math::Point pos, Math::Point dim, int icon, EventTy
pc = (CLabel*)m_table[i];
pc->Create(pos, dim, icon, eventMsg);
- p = strchr(name, '\\');
- if ( p == 0 )
- {
+ auto p = name.find("\\");
+ if ( p == std::string::npos )
pc->SetName(name);
- }
else
- {
- char text[100];
- strncpy(text, name, 100);
- text[100-1] = 0;
- if ( p-name < 100 )
- {
- text[p-name] = 0; // deletes text after "\\" (tooltip)
- }
- pc->SetName(text);
- }
+ pc->SetName(name.substr(0, p));
return pc;
}
}
@@ -589,7 +545,7 @@ CControl* CWindow::SearchControl(EventType eventMsg)
// Makes the tooltip binds to the window.
-bool CWindow::GetTooltip(Math::Point pos, char* name)
+bool CWindow::GetTooltip(Math::Point pos, std::string &name)
{
int i;
@@ -622,7 +578,7 @@ bool CWindow::GetTooltip(Math::Point pos, char* name)
if ( Detect(pos) ) // in the window?
{
- strcpy(name, m_tooltip);
+ name = m_tooltip;
return true;
}
@@ -632,7 +588,7 @@ bool CWindow::GetTooltip(Math::Point pos, char* name)
// Specifies the name for the title bar.
-void CWindow::SetName(char* name)
+void CWindow::SetName(std::string name)
{
CButton* pc;
bool bAdjust;
@@ -659,7 +615,7 @@ void CWindow::SetName(char* name)
bAdjust = false;
- if ( m_name[0] != 0 && m_bRedim ) // title bar exists?
+ if ( m_name.length() > 0 && m_bRedim ) // title bar exists?
{
m_buttonReduce = new CButton();
pc = (CButton*)m_buttonReduce;
@@ -672,7 +628,7 @@ void CWindow::SetName(char* name)
bAdjust = true;
}
- if ( m_name[0] != 0 && m_bClosable ) // title bar exists?
+ if ( m_name.length() > 0 && m_bClosable ) // title bar exists?
{
m_buttonClose = new CButton();
pc = (CButton*)m_buttonClose;
@@ -852,13 +808,13 @@ void CWindow::AdjustButtons()
{
m_buttonFull->SetIcon(54);
GetResource(RES_TEXT, RT_WINDOW_STANDARD, res);
- m_buttonFull->SetTooltip(res);
+ m_buttonFull->SetTooltip(std::string(res));
}
else
{
m_buttonFull->SetIcon(52);
GetResource(RES_TEXT, RT_WINDOW_MAXIMIZED, res);
- m_buttonFull->SetTooltip(res);
+ m_buttonFull->SetTooltip(std::string(res));
}
}
@@ -868,13 +824,13 @@ void CWindow::AdjustButtons()
{
m_buttonReduce->SetIcon(54);
GetResource(RES_TEXT, RT_WINDOW_STANDARD, res);
- m_buttonReduce->SetTooltip(res);
+ m_buttonReduce->SetTooltip(std::string(res));
}
else
{
m_buttonReduce->SetIcon(51);
GetResource(RES_TEXT, RT_WINDOW_MINIMIZED, res);
- m_buttonReduce->SetTooltip(res);
+ m_buttonReduce->SetTooltip(std::string(res));
}
}
@@ -882,7 +838,7 @@ void CWindow::AdjustButtons()
{
m_buttonClose->SetIcon(11); // x
GetResource(RES_TEXT, RT_WINDOW_CLOSE, res);
- m_buttonClose->SetTooltip(res);
+ m_buttonClose->SetTooltip(std::string(res));
}
}
@@ -992,7 +948,7 @@ bool CWindow::EventProcess(const Event &event)
{
m_pressMouse = Gfx::ENG_MOUSE_NORM;
- if ( m_name[0] != 0 && m_bMovable && // title bar?
+ if ( m_name.length() > 0 && m_bMovable && // title bar?
Detect(event.pos) )
{
flags = BorderDetect(event.pos);
@@ -1059,7 +1015,7 @@ bool CWindow::EventProcess(const Event &event)
{
if ( Detect(event.pos) )
{
- if ( m_name[0] != 0 && m_bMovable ) // title bar?
+ if ( m_name.length() > 0 && m_bMovable ) // title bar?
{
m_pressFlags = BorderDetect(event.pos);
if ( m_pressFlags != 0 )
@@ -1125,9 +1081,7 @@ bool CWindow::EventProcess(const Event &event)
m_event->AddEvent(newEvent);
}
- if ( event.type == EVENT_MOUSE_BUTTON_UP &&
- event.mouseButton == 1 &&
- m_bCapture )
+ if ( event.type == EVENT_MOUSE_BUTTON_UP && event.mouseButton.button == 1 && m_bCapture )
{
m_bCapture = false;
}
@@ -1153,7 +1107,7 @@ void CWindow::Draw()
DrawVertex(m_pos, m_dim, m_icon); // draws the background
- if ( m_name[0] != 0 ) // title bar?
+ if ( m_name.length() > 0 ) // title bar?
{
h = m_engine->GetText()->GetHeight(m_fontType, m_fontSize);
diff --git a/src/ui/window.h b/src/ui/window.h
index 92f7b50..9262a1a 100644
--- a/src/ui/window.h
+++ b/src/ui/window.h
@@ -19,15 +19,38 @@
#pragma once
-
+#include <string>
+
+#include <common/language.h>
+#include <common/event.h>
+#include <common/misc.h>
+#include <common/restext.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/label.h>
+#include <ui/edit.h>
+#include <ui/editvalue.h>
+#include <ui/scroll.h>
+#include <ui/slider.h>
+#include <ui/list.h>
+#include <ui/shortcut.h>
+#include <ui/map.h>
+#include <ui/gauge.h>
+#include <ui/compass.h>
+#include <ui/target.h>
#include <ui/control.h>
-//#include <common/event.h>
+
+#include <graphics/engine/text.h>
namespace Ui {
const int MAXWINDOW = 100;
-class CGauge;
class CWindow : public CControl
{
@@ -43,7 +66,7 @@ public:
CKey* CreateKey(Math::Point pos, Math::Point dim, int icon, EventType eventMsg);
CGroup* CreateGroup(Math::Point pos, Math::Point dim, int icon, EventType eventMsg);
CImage* CreateImage(Math::Point pos, Math::Point dim, int icon, EventType eventMsg);
- CLabel* CreateLabel(Math::Point pos, Math::Point dim, int icon, EventType eventMsg, char *name);
+ CLabel* CreateLabel(Math::Point pos, Math::Point dim, int icon, EventType eventMsg, std::string name);
CEdit* CreateEdit(Math::Point pos, Math::Point dim, int icon, EventType eventMsg);
CEditValue* CreateEditValue(Math::Point pos, Math::Point dim, int icon, EventType eventMsg);
CScroll* CreateScroll(Math::Point pos, Math::Point dim, int icon, EventType eventMsg);
@@ -61,7 +84,7 @@ public:
EventType GetEventTypeFull();
EventType GetEventTypeClose();
- void SetName(char* name);
+ void SetName(std::string name);
void SetTrashEvent(bool bTrash);
bool GetTrashEvent();
@@ -90,7 +113,7 @@ public:
void SetFixed(bool bFix);
bool GetFixed();
- bool GetTooltip(Math::Point pos, char* name);
+ bool GetTooltip(Math::Point pos, std::string &name);
bool EventProcess(const Event &event);