summaryrefslogtreecommitdiffstats
path: root/src/object
diff options
context:
space:
mode:
Diffstat (limited to 'src/object')
-rw-r--r--src/object/auto/auto.cpp125
-rw-r--r--src/object/auto/auto.h75
-rw-r--r--src/object/auto/autobase.cpp299
-rw-r--r--src/object/auto/autobase.h27
-rw-r--r--src/object/auto/autoconvert.cpp76
-rw-r--r--src/object/auto/autoconvert.h5
-rw-r--r--src/object/auto/autoderrick.cpp134
-rw-r--r--src/object/auto/autoderrick.h5
-rw-r--r--src/object/auto/autodestroyer.cpp64
-rw-r--r--src/object/auto/autodestroyer.h5
-rw-r--r--src/object/auto/autoegg.cpp40
-rw-r--r--src/object/auto/autoegg.h3
-rw-r--r--src/object/auto/autoenergy.cpp141
-rw-r--r--src/object/auto/autoenergy.h5
-rw-r--r--src/object/auto/autofactory.cpp146
-rw-r--r--src/object/auto/autofactory.h5
-rw-r--r--src/object/auto/autoflag.cpp19
-rw-r--r--src/object/auto/autoflag.h3
-rw-r--r--src/object/auto/autohuston.cpp63
-rw-r--r--src/object/auto/autohuston.h15
-rw-r--r--src/object/auto/autoinfo.cpp94
-rw-r--r--src/object/auto/autoinfo.h5
-rw-r--r--src/object/auto/autojostle.cpp11
-rw-r--r--src/object/auto/autojostle.h3
-rw-r--r--src/object/auto/autokid.cpp46
-rw-r--r--src/object/auto/autokid.h5
-rw-r--r--src/object/auto/autolabo.cpp109
-rw-r--r--src/object/auto/autolabo.h13
-rw-r--r--src/object/auto/automush.cpp49
-rw-r--r--src/object/auto/automush.h5
-rw-r--r--src/object/auto/autonest.cpp38
-rw-r--r--src/object/auto/autonest.h7
-rw-r--r--src/object/auto/autonuclear.cpp79
-rw-r--r--src/object/auto/autonuclear.h5
-rw-r--r--src/object/auto/autopara.cpp73
-rw-r--r--src/object/auto/autopara.h9
-rw-r--r--src/object/auto/autoportico.cpp64
-rw-r--r--src/object/auto/autoportico.h5
-rw-r--r--src/object/auto/autoradar.cpp61
-rw-r--r--src/object/auto/autoradar.h5
-rw-r--r--src/object/auto/autorepair.cpp58
-rw-r--r--src/object/auto/autorepair.h5
-rw-r--r--src/object/auto/autoresearch.cpp126
-rw-r--r--src/object/auto/autoresearch.h13
-rw-r--r--src/object/auto/autoroot.cpp28
-rw-r--r--src/object/auto/autoroot.h5
-rw-r--r--src/object/auto/autosafe.cpp106
-rw-r--r--src/object/auto/autosafe.h5
-rw-r--r--src/object/auto/autostation.cpp89
-rw-r--r--src/object/auto/autostation.h5
-rw-r--r--src/object/auto/autotower.cpp103
-rw-r--r--src/object/auto/autotower.h5
-rw-r--r--src/object/brain.cpp590
-rw-r--r--src/object/brain.h169
-rw-r--r--src/object/mainmovie.cpp34
-rw-r--r--src/object/mainmovie.h39
-rw-r--r--src/object/motion/motion.cpp49
-rw-r--r--src/object/motion/motion.h74
-rw-r--r--src/object/motion/motionant.cpp146
-rw-r--r--src/object/motion/motionant.h2
-rw-r--r--src/object/motion/motionbee.cpp94
-rw-r--r--src/object/motion/motionhuman.cpp315
-rw-r--r--src/object/motion/motionmother.cpp72
-rw-r--r--src/object/motion/motionspider.cpp128
-rw-r--r--src/object/motion/motionspider.h2
-rw-r--r--src/object/motion/motiontoto.cpp120
-rw-r--r--src/object/motion/motiontoto.h2
-rw-r--r--src/object/motion/motionvehicle.cpp354
-rw-r--r--src/object/motion/motionvehicle.h6
-rw-r--r--src/object/motion/motionworm.cpp68
-rw-r--r--src/object/motion/motionworm.h4
-rw-r--r--src/object/object.cpp1418
-rw-r--r--src/object/object.h132
-rw-r--r--src/object/robotmain.cpp5287
-rw-r--r--src/object/robotmain.h423
-rw-r--r--src/object/task/task.cpp26
-rw-r--r--src/object/task/task.h53
-rw-r--r--src/object/task/taskadvance.cpp19
-rw-r--r--src/object/task/taskbuild.cpp210
-rw-r--r--src/object/task/taskbuild.h36
-rw-r--r--src/object/task/taskfire.cpp77
-rw-r--r--src/object/task/taskfire.h2
-rw-r--r--src/object/task/taskfireant.cpp35
-rw-r--r--src/object/task/taskfireant.h2
-rw-r--r--src/object/task/taskflag.cpp80
-rw-r--r--src/object/task/taskgoto.cpp453
-rw-r--r--src/object/task/taskgungoal.cpp19
-rw-r--r--src/object/task/taskinfo.cpp57
-rw-r--r--src/object/task/taskinfo.h2
-rw-r--r--src/object/task/taskmanager.cpp44
-rw-r--r--src/object/task/taskmanager.h2
-rw-r--r--src/object/task/taskmanip.cpp255
-rw-r--r--src/object/task/taskpen.cpp49
-rw-r--r--src/object/task/taskpen.h4
-rw-r--r--src/object/task/taskrecover.cpp74
-rw-r--r--src/object/task/taskrecover.h4
-rw-r--r--src/object/task/taskreset.cpp57
-rw-r--r--src/object/task/taskreset.h2
-rw-r--r--src/object/task/tasksearch.cpp69
-rw-r--r--src/object/task/tasksearch.h2
-rw-r--r--src/object/task/taskshield.cpp171
-rw-r--r--src/object/task/taskshield.h6
-rw-r--r--src/object/task/taskspiderexplo.cpp19
-rw-r--r--src/object/task/tasktake.cpp127
-rw-r--r--src/object/task/tasktake.h3
-rw-r--r--src/object/task/taskterraform.cpp90
-rw-r--r--src/object/task/taskterraform.h4
-rw-r--r--src/object/task/taskturn.cpp21
-rw-r--r--src/object/task/taskwait.cpp13
109 files changed, 6647 insertions, 7457 deletions
diff --git a/src/object/auto/auto.cpp b/src/object/auto/auto.cpp
index d112721..711497d 100644
--- a/src/object/auto/auto.cpp
+++ b/src/object/auto/auto.cpp
@@ -15,8 +15,6 @@
// * along with this program. If not, see http://www.gnu.org/licenses/.
-#include <stdio.h>
-
#include "object/auto/auto.h"
@@ -26,7 +24,8 @@
#include "ui/gauge.h"
#include "ui/window.h"
-
+#include <stdio.h>
+#include <string.h>
// Object's constructor.
@@ -37,22 +36,22 @@ CAuto::CAuto(CInstanceManager* iMan, CObject* object)
m_iMan->AddInstance(CLASS_AUTO, this, 100);
m_object = object;
- m_event = (CEvent*)m_iMan->SearchInstance(CLASS_EVENT);
- m_engine = (CD3DEngine*)m_iMan->SearchInstance(CLASS_ENGINE);
- m_particule = (CParticule*)m_iMan->SearchInstance(CLASS_PARTICULE);
- m_light = (CLight*)m_iMan->SearchInstance(CLASS_LIGHT);
- m_terrain = (CTerrain*)m_iMan->SearchInstance(CLASS_TERRAIN);
- m_water = (CWater*)m_iMan->SearchInstance(CLASS_WATER);
- m_cloud = (CCloud*)m_iMan->SearchInstance(CLASS_CLOUD);
- m_planet = (CPlanet*)m_iMan->SearchInstance(CLASS_PLANET);
- m_blitz = (CBlitz*)m_iMan->SearchInstance(CLASS_BLITZ);
- m_camera = (CCamera*)m_iMan->SearchInstance(CLASS_CAMERA);
- m_interface = (CInterface*)m_iMan->SearchInstance(CLASS_INTERFACE);
- m_main = (CRobotMain*)m_iMan->SearchInstance(CLASS_MAIN);
- m_displayText = (CDisplayText*)m_iMan->SearchInstance(CLASS_DISPLAYTEXT);
- m_sound = (CSound*)m_iMan->SearchInstance(CLASS_SOUND);
-
- m_type = m_object->RetType();
+ m_event = static_cast< CEventQueue* >(m_iMan->SearchInstance(CLASS_EVENT));
+ m_engine = static_cast< Gfx::CEngine* >(m_iMan->SearchInstance(CLASS_ENGINE));
+ m_particle = static_cast< Gfx::CParticle* >(m_iMan->SearchInstance(CLASS_PARTICULE));
+ m_lightMan = static_cast< Gfx::CLightManager* >(m_iMan->SearchInstance(CLASS_LIGHT));
+ m_terrain = static_cast< Gfx::CTerrain* >(m_iMan->SearchInstance(CLASS_TERRAIN));
+ m_water = static_cast< Gfx::CWater* >(m_iMan->SearchInstance(CLASS_WATER));
+ m_cloud = static_cast< Gfx::CCloud* >(m_iMan->SearchInstance(CLASS_CLOUD));
+ m_planet = static_cast< Gfx::CPlanet* >(m_iMan->SearchInstance(CLASS_PLANET));
+ m_lightning = static_cast< Gfx::CLightning* >(m_iMan->SearchInstance(CLASS_BLITZ));
+ m_camera = static_cast< Gfx::CCamera* >(m_iMan->SearchInstance(CLASS_CAMERA));
+ m_interface = static_cast< Ui::CInterface* >(m_iMan->SearchInstance(CLASS_INTERFACE));
+ m_main = static_cast< CRobotMain* >(m_iMan->SearchInstance(CLASS_MAIN));
+ m_displayText = static_cast< Ui::CDisplayText* >(m_iMan->SearchInstance(CLASS_DISPLAYTEXT));
+ m_sound = static_cast< CSoundInterface* >(m_iMan->SearchInstance(CLASS_SOUND));
+
+ m_type = m_object->GetType();
m_time = 0.0f;
m_lastUpdateTime = 0.0f;
m_bMotor = false;
@@ -117,14 +116,14 @@ bool CAuto::SetString(char *string)
bool CAuto::EventProcess(const Event &event)
{
- if ( event.event == EVENT_FRAME &&
- !m_engine->RetPause() )
+ if ( event.type == EVENT_FRAME &&
+ !m_engine->GetPause() )
{
m_time += event.rTime;
UpdateInterface(event.rTime);
}
- if ( !m_object->RetSelect() ) // robot not selected?
+ if ( !m_object->GetSelect() ) // robot not selected?
{
return true;
}
@@ -151,13 +150,13 @@ bool CAuto::Abort()
bool CAuto::CreateInterface(bool bSelect)
{
- CWindow* pw;
+ Ui::CWindow* pw;
Math::Point pos, dim, ddim;
float ox, oy, sx, sy;
char name[100];
- pw = (CWindow*)m_interface->SearchControl(EVENT_WINDOW0);
- if ( pw != 0 )
+ pw = static_cast<Ui::CWindow*>(m_interface->SearchControl(EVENT_WINDOW0));
+ if ( pw != nullptr )
{
pw->Flush(); // destroys the window buttons
m_interface->DeleteControl(EVENT_WINDOW0); // destroys the window
@@ -171,7 +170,7 @@ bool CAuto::CreateInterface(bool bSelect)
//? dim.y = 70.0f/480.0f;
dim.y = 86.0f/480.0f;
m_interface->CreateWindows(pos, dim, 3, EVENT_WINDOW0);
- pw = (CWindow*)m_interface->SearchControl(EVENT_WINDOW0);
+ pw = static_cast<Ui::CWindow*>(m_interface->SearchControl(EVENT_WINDOW0));
if ( pw == 0 ) return false;
m_object->GetTooltipName(name);
@@ -214,7 +213,7 @@ bool CAuto::CreateInterface(bool bSelect)
pos.y = oy+sy*0;
pw->CreateButton(pos, dim, 19, EVENT_OBJECT_HELP);
- if ( m_main->RetSceneSoluce() )
+ if ( m_main->GetSceneSoluce() )
{
pos.x = ox+sx*13.4f;
pos.y = oy+sy*1;
@@ -263,62 +262,62 @@ bool CAuto::CreateInterface(bool bSelect)
// Change the state of a button interface.
-void CAuto::CheckInterface(CWindow *pw, EventMsg event, bool bState)
+void CAuto::CheckInterface(Ui::CWindow *pw, EventType event, bool bState)
{
- CControl* control;
+ Ui::CControl* control;
control = pw->SearchControl(event);
- if ( control == 0 ) return;
+ if ( control == nullptr ) return;
- control->SetState(STATE_CHECK, bState);
+ control->SetState(Ui::STATE_CHECK, bState);
}
// Change the state of a button interface.
-void CAuto::EnableInterface(CWindow *pw, EventMsg event, bool bState)
+void CAuto::EnableInterface(Ui::CWindow *pw, EventType event, bool bState)
{
- CControl* control;
+ Ui::CControl* control;
control = pw->SearchControl(event);
- if ( control == 0 ) return;
+ if ( control == nullptr ) return;
- control->SetState(STATE_ENABLE, bState);
+ control->SetState(Ui::STATE_ENABLE, bState);
}
// Change the state of a button interface.
-void CAuto::VisibleInterface(CWindow *pw, EventMsg event, bool bState)
+void CAuto::VisibleInterface(Ui::CWindow *pw, EventType event, bool bState)
{
- CControl* control;
+ Ui::CControl* control;
control = pw->SearchControl(event);
- if ( control == 0 ) return;
+ if ( control == nullptr ) return;
- control->SetState(STATE_VISIBLE, bState);
+ control->SetState(Ui::STATE_VISIBLE, bState);
}
// Change the state of a button interface.
-void CAuto::DeadInterface(CWindow *pw, EventMsg event, bool bState)
+void CAuto::DeadInterface(Ui::CWindow *pw, EventType event, bool bState)
{
- CControl* control;
+ Ui::CControl* control;
control = pw->SearchControl(event);
- if ( control == 0 ) return;
+ if ( control == nullptr ) return;
- control->SetState(STATE_DEAD, !bState);
+ control->SetState(Ui::STATE_DEAD, !bState);
}
// Change the state of a button interface.
void CAuto::UpdateInterface()
{
- CWindow* pw;
+ Ui::CWindow* pw;
- if ( !m_object->RetSelect() ) return;
+ if ( !m_object->GetSelect() ) return;
- pw = (CWindow*)m_interface->SearchControl(EVENT_WINDOW0);
- if ( pw == 0 ) return;
+ pw = static_cast<Ui::CWindow*>(m_interface->SearchControl(EVENT_WINDOW0));
+ if ( pw == nullptr ) return;
VisibleInterface(pw, EVENT_OBJECT_GPROGRESS, m_bBusy);
}
@@ -328,34 +327,34 @@ void CAuto::UpdateInterface()
void CAuto::UpdateInterface(float rTime)
{
- CWindow* pw;
- CGauge* pg;
+ Ui::CWindow* pw;
+ Ui::CGauge* pg;
if ( m_time < m_lastUpdateTime+0.1f ) return;
m_lastUpdateTime = m_time;
- if ( !m_object->RetSelect() ) return;
+ if ( !m_object->GetSelect() ) return;
- pw = (CWindow*)m_interface->SearchControl(EVENT_WINDOW0);
- if ( pw == 0 ) return;
+ pw = static_cast<Ui::CWindow*>(m_interface->SearchControl(EVENT_WINDOW0));
+ if ( pw == nullptr ) return;
- pg = (CGauge*)pw->SearchControl(EVENT_OBJECT_GSHIELD);
- if ( pg != 0 )
+ pg = static_cast<Ui::CGauge*>(pw->SearchControl(EVENT_OBJECT_GSHIELD));
+ if ( pg != nullptr )
{
- pg->SetLevel(m_object->RetShield());
+ pg->SetLevel(m_object->GetShield());
}
- pg = (CGauge*)pw->SearchControl(EVENT_OBJECT_GPROGRESS);
- if ( pg != 0 )
+ pg = static_cast<Ui::CGauge*>(pw->SearchControl(EVENT_OBJECT_GPROGRESS));
+ if ( pg != nullptr )
{
pg->SetLevel(m_progressTime);
}
}
-// Returns an error due the state of the automation.
+// Geturns an error due the state of the automation.
-Error CAuto::RetError()
+Error CAuto::GetError()
{
return ERR_OK;
}
@@ -363,7 +362,7 @@ Error CAuto::RetError()
// Management of the occupation.
-bool CAuto::RetBusy()
+bool CAuto::GetBusy()
{
return m_bBusy;
}
@@ -387,7 +386,7 @@ void CAuto::EventProgress(float rTime)
// Engine management.
-bool CAuto::RetMotor()
+bool CAuto::GetMotor()
{
return m_bMotor;
}
@@ -422,11 +421,11 @@ bool CAuto::Write(char *line)
return false;
}
-// Return all settings to the controller.
+// Geturn all settings to the controller.
bool CAuto::Read(char *line)
{
- m_type = (ObjectType)OpInt(line, "aType", OBJECT_NULL);
+ m_type = static_cast<ObjectType>(OpInt(line, "aType", OBJECT_NULL));
m_bBusy = OpInt(line, "aBusy", 0);
m_time = OpFloat(line, "aTime", 0.0f);
m_progressTime = OpFloat(line, "aProgressTime", 0.0f);
diff --git a/src/object/auto/auto.h b/src/object/auto/auto.h
index 09efdd9..2194924 100644
--- a/src/object/auto/auto.h
+++ b/src/object/auto/auto.h
@@ -19,27 +19,32 @@
#pragma once
-#include "common/misc.h"
+#include "common/global.h"
#include "object/object.h"
class CInstanceManager;
-class CD3DEngine;
-class CParticule;
-class CLight;
-class CTerrain;
-class CWater;
-class CCloud;
-class CPlanet;
-class CBlitz;
-class CCamera;
-class CInterface;
class CRobotMain;
+class CSoundInterface;
+
+namespace Ui {
class CDisplayText;
+class CInterface;
class CWindow;
-class CSound;
+} /* Ui */
+namespace Gfx {
+class CEngine;
+class CParticle;
+class CLightManager;
+class CTarrain;
+class CWater;
+class CCloud;
+class CCamera;
+class CPlanet;
+class CLightning;
+} /* Gfx */
class CAuto
@@ -61,44 +66,44 @@ public:
virtual bool SetString(char *string);
virtual bool CreateInterface(bool bSelect);
- virtual Error RetError();
+ virtual Error GetError();
- virtual bool RetBusy();
+ virtual bool GetBusy();
virtual void SetBusy(bool bBuse);
virtual void InitProgressTotal(float total);
virtual void EventProgress(float rTime);
- virtual bool RetMotor();
+ virtual bool GetMotor();
virtual void SetMotor(bool bMotor);
virtual bool Write(char *line);
virtual bool Read(char *line);
protected:
- void CheckInterface(CWindow *pw, EventMsg event, bool bState);
- void EnableInterface(CWindow *pw, EventMsg event, bool bState);
- void VisibleInterface(CWindow *pw, EventMsg event, bool bState);
- void DeadInterface(CWindow *pw, EventMsg event, bool bState);
+ void CheckInterface(Ui::CWindow *pw, EventType event, bool bState);
+ void EnableInterface(Ui::CWindow *pw, EventType event, bool bState);
+ void VisibleInterface(Ui::CWindow *pw, EventType event, bool bState);
+ void DeadInterface(Ui::CWindow *pw, EventType event, bool bState);
void UpdateInterface();
void UpdateInterface(float rTime);
protected:
- CInstanceManager* m_iMan;
- CEvent* m_event;
- CD3DEngine* m_engine;
- CParticule* m_particule;
- CLight* m_light;
- CTerrain* m_terrain;
- CWater* m_water;
- CCloud * m_cloud;
- CPlanet * m_planet;
- CBlitz* m_blitz;
- CCamera* m_camera;
- CInterface* m_interface;
- CRobotMain* m_main;
- CDisplayText* m_displayText;
- CObject* m_object;
- CSound* m_sound;
+ CInstanceManager* m_iMan;
+ CEventQueue* m_event;
+ Gfx::CEngine* m_engine;
+ Gfx::CParticle* m_particle;
+ Gfx::CLightManager* m_lightMan;
+ Gfx::CTerrain* m_terrain;
+ Gfx::CWater* m_water;
+ Gfx::CCloud* m_cloud;
+ Gfx::CPlanet* m_planet;
+ Gfx::CLightning* m_lightning;
+ Gfx::CCamera* m_camera;
+ Ui::CInterface* m_interface;
+ Ui::CDisplayText* m_displayText;
+ CRobotMain* m_main;
+ CObject* m_object;
+ CSoundInterface* m_sound;
ObjectType m_type;
bool m_bBusy;
diff --git a/src/object/auto/autobase.cpp b/src/object/auto/autobase.cpp
index 19382b7..d7b3ca1 100644
--- a/src/object/auto/autobase.cpp
+++ b/src/object/auto/autobase.cpp
@@ -20,10 +20,10 @@
#include "object/auto/autobase.h"
#include "common/iman.h"
-#include "old/terrain.h"
-#include "old/cloud.h"
-#include "old/planet.h"
-#include "old/blitz.h"
+#include "graphics/engine/terrain.h"
+#include "graphics/engine/cloud.h"
+#include "graphics/engine/planet.h"
+#include "graphics/engine/lightning.h"
#include "math/geometry.h"
#include "object/robotmain.h"
#include "physics/physics.h"
@@ -50,8 +50,8 @@ const float BASE_TRANSIT_TIME = 15.0f; // transit duration
CAutoBase::CAutoBase(CInstanceManager* iMan, CObject* object)
: CAuto(iMan, object)
{
- m_fogStart = m_engine->RetFogStart();
- m_deepView = m_engine->RetDeepView();
+ m_fogStart = m_engine->GetFogStart();
+ m_deepView = m_engine->GetDeepView();
Init();
m_phase = ABP_WAIT;
m_soundChannel = -1;
@@ -85,10 +85,10 @@ void CAutoBase::Init()
{
m_bOpen = false;
m_time = 0.0f;
- m_lastParticule = 0.0f;
- m_lastMotorParticule = 0.0f;
+ m_lastParticle = 0.0f;
+ m_lastMotorParticle = 0.0f;
- m_pos = m_object->RetPosition(0);
+ m_pos = m_object->GetPosition(0);
m_lastPos = m_pos;
m_phase = ABP_WAIT;
@@ -124,10 +124,10 @@ bool CAutoBase::EventProcess(const Event &event)
CAuto::EventProcess(event);
- if ( m_engine->RetPause() ) return true;
+ if ( m_engine->GetPause() ) return true;
begin:
- iPos = m_object->RetPosition(0);
+ iPos = m_object->GetPosition(0);
if ( m_phase == ABP_START )
{
@@ -152,17 +152,17 @@ begin:
m_object->SetPosition(18+i, Math::Vector(23.5f, 0.0f, 11.5f));
}
- pObj = m_main->RetSelectObject();
+ pObj = m_main->GetSelectObject();
m_main->SelectObject(pObj);
- m_camera->SetObject(pObj);
+ m_camera->SetControllingObject(pObj);
if ( pObj == 0 )
{
- m_camera->SetType(CAMERA_BACK);
+ m_camera->SetType(Gfx::CAM_TYPE_BACK);
}
else
{
- m_camera->SetType(pObj->RetCameraType());
- m_camera->SetDist(pObj->RetCameraDist());
+ m_camera->SetType(pObj->GetCameraType());
+ m_camera->SetDist(pObj->GetCameraDist());
}
m_main->StartMusic();
@@ -193,16 +193,16 @@ begin:
m_main->SetMovieLock(true); // blocks everything until the end of the landing
m_bMotor = true; // lights the jet engine
- m_camera->SetType(CAMERA_SCRIPT);
+ m_camera->SetType(Gfx::CAM_TYPE_SCRIPT);
pos = m_pos;
pos.x -= 150.0f;
- m_terrain->MoveOnFloor(pos);
+ m_terrain->AdjustToFloor(pos);
pos.y += 10.0f;
m_camera->SetScriptEye(pos);
m_posSound = pos;
- pos = m_object->RetPosition(0);
+ pos = m_object->GetPosition(0);
pos.y += 300.0f+50.0f;
m_camera->SetScriptLookat(pos);
@@ -223,7 +223,7 @@ begin:
if ( m_param == PARAM_PORTICO ) // gate on the porch?
{
- pos = m_object->RetPosition(0);
+ pos = m_object->GetPosition(0);
m_finalPos = pos;
pos.z += BASE_PORTICO_TIME_MOVE*5.0f; // back
pos.y += 10.0f; // rises (the gate)
@@ -246,7 +246,7 @@ begin:
m_speed = 1.0f/BASE_TRANSIT_TIME;
m_object->SetAngleZ(0, -Math::PI/2.0f);
- pos = m_object->RetPosition(0);
+ pos = m_object->GetPosition(0);
pos.y += 10000.0f; // in space
m_finalPos = pos;
m_object->SetPosition(0, pos);
@@ -254,7 +254,7 @@ begin:
m_main->SetMovieLock(true); // blocks everything until the end of the landing
m_bMotor = true; // lights the jet engine
- m_camera->SetType(CAMERA_SCRIPT);
+ m_camera->SetType(Gfx::CAM_TYPE_SCRIPT);
pos.x += 1000.0f;
pos.z -= 60.0f;
pos.y += 80.0f;
@@ -265,34 +265,34 @@ begin:
BeginTransit();
- mat = m_object->RetWorldMatrix(0);
+ mat = m_object->GetWorldMatrix(0);
speed = Math::Vector(0.0f, 0.0f, 0.0f);
dim.x = 10.0f;
dim.y = dim.x;
pos = Math::Vector(42.0f, -2.0f, 17.0f);
pos = Transform(*mat, pos);
- m_partiChannel[0] = m_particule->CreateParticule(pos, speed, dim, PARTILENS1, BASE_TRANSIT_TIME+1.0f, 0.0f, 0.0f);
+ m_partiChannel[0] = m_particle->CreateParticle(pos, speed, dim, Gfx::PARTILENS1, BASE_TRANSIT_TIME+1.0f, 0.0f, 0.0f);
pos = Math::Vector(17.0f, -2.0f, 42.0f);
pos = Transform(*mat, pos);
- m_partiChannel[1] = m_particule->CreateParticule(pos, speed, dim, PARTILENS1, BASE_TRANSIT_TIME+1.0f, 0.0f, 0.0f);
+ m_partiChannel[1] = m_particle->CreateParticle(pos, speed, dim, Gfx::PARTILENS1, BASE_TRANSIT_TIME+1.0f, 0.0f, 0.0f);
pos = Math::Vector(42.0f, -2.0f, -17.0f);
pos = Transform(*mat, pos);
- m_partiChannel[2] = m_particule->CreateParticule(pos, speed, dim, PARTILENS1, BASE_TRANSIT_TIME+1.0f, 0.0f, 0.0f);
+ m_partiChannel[2] = m_particle->CreateParticle(pos, speed, dim, Gfx::PARTILENS1, BASE_TRANSIT_TIME+1.0f, 0.0f, 0.0f);
pos = Math::Vector(17.0f, -2.0f, -42.0f);
pos = Transform(*mat, pos);
- m_partiChannel[3] = m_particule->CreateParticule(pos, speed, dim, PARTILENS1, BASE_TRANSIT_TIME+1.0f, 0.0f, 0.0f);
+ m_partiChannel[3] = m_particle->CreateParticle(pos, speed, dim, Gfx::PARTILENS1, BASE_TRANSIT_TIME+1.0f, 0.0f, 0.0f);
pos = Math::Vector(-42.0f, -2.0f, 17.0f);
pos = Transform(*mat, pos);
- m_partiChannel[4] = m_particule->CreateParticule(pos, speed, dim, PARTILENS1, BASE_TRANSIT_TIME+1.0f, 0.0f, 0.0f);
+ m_partiChannel[4] = m_particle->CreateParticle(pos, speed, dim, Gfx::PARTILENS1, BASE_TRANSIT_TIME+1.0f, 0.0f, 0.0f);
pos = Math::Vector(-17.0f, -2.0f, 42.0f);
pos = Transform(*mat, pos);
- m_partiChannel[5] = m_particule->CreateParticule(pos, speed, dim, PARTILENS1, BASE_TRANSIT_TIME+1.0f, 0.0f, 0.0f);
+ m_partiChannel[5] = m_particle->CreateParticle(pos, speed, dim, Gfx::PARTILENS1, BASE_TRANSIT_TIME+1.0f, 0.0f, 0.0f);
pos = Math::Vector(-42.0f, -2.0f, -17.0f);
pos = Transform(*mat, pos);
- m_partiChannel[6] = m_particule->CreateParticule(pos, speed, dim, PARTILENS1, BASE_TRANSIT_TIME+1.0f, 0.0f, 0.0f);
+ m_partiChannel[6] = m_particle->CreateParticle(pos, speed, dim, Gfx::PARTILENS1, BASE_TRANSIT_TIME+1.0f, 0.0f, 0.0f);
pos = Math::Vector(-17.0f, -2.0f, -42.0f);
pos = Transform(*mat, pos);
- m_partiChannel[7] = m_particule->CreateParticule(pos, speed, dim, PARTILENS1, BASE_TRANSIT_TIME+1.0f, 0.0f, 0.0f);
+ m_partiChannel[7] = m_particle->CreateParticle(pos, speed, dim, Gfx::PARTILENS1, BASE_TRANSIT_TIME+1.0f, 0.0f, 0.0f);
if ( m_soundChannel == -1 )
{
@@ -303,12 +303,12 @@ begin:
}
}
- if ( event.event == EVENT_UPDINTERFACE )
+ if ( event.type == EVENT_UPDINTERFACE )
{
- if ( m_object->RetSelect() ) CreateInterface(true);
+ if ( m_object->GetSelect() ) CreateInterface(true);
}
- if ( event.event == EVENT_OBJECT_BTAKEOFF )
+ if ( event.type == EVENT_OBJECT_BTAKEOFF )
{
err = CheckCloseDoor();
if ( err != ERR_OK )
@@ -328,19 +328,19 @@ begin:
m_main->SetMovieLock(true); // blocks everything until the end
m_main->DeselectAll();
- m_event->MakeEvent(newEvent, EVENT_UPDINTERFACE);
+ newEvent.type = EVENT_UPDINTERFACE;
m_event->AddEvent(newEvent);
- m_camera->SetType(CAMERA_SCRIPT);
+ m_camera->SetType(Gfx::CAM_TYPE_SCRIPT);
pos = m_pos;
pos.x -= 110.0f;
- m_terrain->MoveOnFloor(pos);
+ m_terrain->AdjustToFloor(pos);
pos.y += 10.0f;
m_camera->SetScriptEye(pos);
m_posSound = pos;
- pos = m_object->RetPosition(0);
+ pos = m_object->GetPosition(0);
pos.y += 50.0f;
m_camera->SetScriptLookat(pos);
@@ -356,7 +356,7 @@ begin:
return true;
}
- if ( event.event != EVENT_FRAME ) return true;
+ if ( event.type != EVENT_FRAME ) return true;
if ( m_phase == ABP_WAIT ) return true;
m_progress += event.rTime*m_speed;
@@ -382,19 +382,19 @@ begin:
pos = m_pos;
pos.x -= 150.0f;
- m_terrain->MoveOnFloor(pos);
+ m_terrain->AdjustToFloor(pos);
pos.y += 10.0f;
m_camera->SetScriptEye(pos);
- pos = m_object->RetPosition(0);
+ pos = m_object->GetPosition(0);
pos.y += 50.0f;
m_camera->SetScriptLookat(pos);
m_engine->SetFocus(1.0f+(1.0f-m_progress));
- if ( m_lastParticule+m_engine->ParticuleAdapt(0.10f) <= m_time )
+ if ( m_lastParticle+m_engine->ParticleAdapt(0.10f) <= m_time )
{
- m_lastParticule = m_time;
+ m_lastParticle = m_time;
// Dust thrown to the ground.
pos = m_pos;
@@ -410,19 +410,19 @@ begin:
dim.y = dim.x;
if ( dim.x >= 1.0f )
{
- m_particule->CreateParticule(pos, speed, dim, PARTICRASH, 2.0f, 0.0f, 2.0f);
+ m_particle->CreateParticle(pos, speed, dim, Gfx::PARTICRASH, 2.0f, 0.0f, 2.0f);
}
// Particles are ejected from the jet engine.
- pos = m_object->RetPosition(0);
+ pos = m_object->GetPosition(0);
pos.y += 6.0f;
- h = m_terrain->RetFloorHeight(pos)/300.0f;
+ h = m_terrain->GetHeightToFloor(pos)/300.0f;
speed.x = (Math::Rand()-0.5f)*(80.0f-50.0f*h);
speed.z = (Math::Rand()-0.5f)*(80.0f-50.0f*h);
speed.y = -(Math::Rand()*(h+1.0f)*40.0f+(h+1.0f)*40.0f);
dim.x = Math::Rand()*2.0f+2.0f;
dim.y = dim.x;
- m_particule->CreateParticule(pos, speed, dim, PARTIGAS, 2.0f, 10.0f, 2.0f);
+ m_particle->CreateParticle(pos, speed, dim, Gfx::PARTIGAS, 2.0f, 10.0f, 2.0f);
// Black smoke from the jet engine.
if ( m_progress > 0.8f )
@@ -436,7 +436,7 @@ begin:
speed.y = 0.0f;
dim.x = Math::Rand()*4.0f+4.0f;
dim.y = dim.x;
- m_particule->CreateParticule(pos, speed, dim, PARTISMOKE3, 4.0f, 0.0f, 2.0f);
+ m_particle->CreateParticle(pos, speed, dim, Gfx::PARTISMOKE3, 4.0f, 0.0f, 2.0f);
}
}
}
@@ -449,7 +449,7 @@ begin:
MoveCargo(); // all cargo moves
// Impact with the ground.
- max = (int)(50.0f*m_engine->RetParticuleDensity());
+ max = static_cast<int>(50.0f*m_engine->GetParticleDensity());
for ( i=0 ; i<max ; i++ )
{
angle = Math::Rand()*(Math::PI*2.0f);
@@ -461,11 +461,11 @@ begin:
dim.x = Math::Rand()*10.0f+10.0f;
dim.y = dim.x;
time = Math::Rand()*2.0f+1.5f;
- m_particule->CreateParticule(pos, speed, dim, PARTICRASH, time, 0.0f, 2.0f);
+ m_particle->CreateParticle(pos, speed, dim, Gfx::PARTICRASH, time, 0.0f, 2.0f);
}
//? m_camera->StartEffect(CE_CRASH, m_pos, 1.0f);
- m_camera->StartEffect(CE_EXPLO, m_pos, 2.0f);
+ m_camera->StartEffect(Gfx::CAM_EFFECT_EXPLO, m_pos, 2.0f);
m_engine->SetFocus(1.0f);
m_sound->Play(SOUND_BOUM, m_posSound, 0.6f, 0.5f);
@@ -479,9 +479,9 @@ begin:
{
if ( m_progress < 1.0f )
{
- if ( m_lastParticule+m_engine->ParticuleAdapt(0.10f) <= m_time )
+ if ( m_lastParticle+m_engine->ParticleAdapt(0.10f) <= m_time )
{
- m_lastParticule = m_time;
+ m_lastParticle = m_time;
// Black smoke from the reactor.
pos = m_pos;
@@ -493,7 +493,7 @@ begin:
speed.y = 0.0f;
dim.x = Math::Rand()*4.0f+4.0f;
dim.y = dim.x;
- m_particule->CreateParticule(pos, speed, dim, PARTISMOKE3, 4.0f, 0.0f, 2.0f);
+ m_particle->CreateParticle(pos, speed, dim, Gfx::PARTISMOKE3, 4.0f, 0.0f, 2.0f);
}
}
else
@@ -526,7 +526,7 @@ begin:
pos = m_pos;
pos.x += p.x;
pos.z += p.y;
- m_terrain->MoveOnFloor(pos);
+ m_terrain->AdjustToFloor(pos);
pos.y += 10.0f;
pos.y += m_progress*40.0f;
m_camera->SetScriptEye(pos);
@@ -542,7 +542,7 @@ begin:
}
// Clash the doors with the ground.
- max = (int)(20.0f*m_engine->RetParticuleDensity());
+ max = static_cast<int>(20.0f*m_engine->GetParticleDensity());
for ( i=0 ; i<max ; i++ )
{
angle = Math::Rand()*(20.0f*Math::PI/180.0f)-(10.0f*Math::PI/180.0f);
@@ -555,7 +555,7 @@ begin:
dim.x = Math::Rand()*8.0f+8.0f;
dim.y = dim.x;
time = Math::Rand()*2.0f+1.5f;
- m_particule->CreateParticule(pos, speed, dim, PARTICRASH, time, 0.0f, 2.0f);
+ m_particle->CreateParticle(pos, speed, dim, Gfx::PARTICRASH, time, 0.0f, 2.0f);
}
m_soundChannel = m_sound->Play(SOUND_MANIP, m_posSound, 0.3f, 1.5f, true);
@@ -588,7 +588,7 @@ begin:
pos = m_pos;
pos.x += p.x;
pos.z += p.y;
- m_terrain->MoveOnFloor(pos);
+ m_terrain->AdjustToFloor(pos);
pos.y += 10.0f;
pos.y += m_progress*40.0f;
m_camera->SetScriptEye(pos);
@@ -622,19 +622,19 @@ begin:
{
m_main->SetMovieLock(false); // you can play!
- pObj = m_main->RetSelectObject();
+ pObj = m_main->GetSelectObject();
m_main->SelectObject(pObj);
- m_camera->SetObject(pObj);
+ m_camera->SetControllingObject(pObj);
if ( pObj == 0 )
{
- m_camera->SetType(CAMERA_BACK);
+ m_camera->SetType(Gfx::CAM_TYPE_BACK);
}
else
{
- m_camera->SetType(pObj->RetCameraType());
- m_camera->SetDist(pObj->RetCameraDist());
+ m_camera->SetType(pObj->GetCameraType());
+ m_camera->SetDist(pObj->GetCameraDist());
}
- m_sound->Play(SOUND_BOUM, m_object->RetPosition(0));
+ m_sound->Play(SOUND_BOUM, m_object->GetPosition(0));
m_soundChannel = -1;
m_engine->SetFogStart(m_fogStart);
@@ -700,7 +700,7 @@ begin:
m_bMotor = true; // lights the jet engine
// Shock of the closing doors.
- max = (int)(20.0f*m_engine->RetParticuleDensity());
+ max = static_cast<int>(20.0f*m_engine->GetParticleDensity());
for ( i=0 ; i<max ; i++ )
{
angle = Math::Rand()*Math::PI*2.0f;
@@ -713,9 +713,9 @@ begin:
dim.x = Math::Rand()*3.0f+3.0f;
dim.y = dim.x;
time = Math::Rand()*1.0f+1.0f;
- m_particule->CreateParticule(pos, speed, dim, PARTICRASH, time);
+ m_particle->CreateParticle(pos, speed, dim, Gfx::PARTICRASH, time);
}
- m_sound->Play(SOUND_BOUM, m_object->RetPosition(0));
+ m_sound->Play(SOUND_BOUM, m_object->GetPosition(0));
m_soundChannel = -1;
m_bOpen = false;
@@ -742,19 +742,19 @@ begin:
vibCir *= m_progress*1.0f;
m_object->SetCirVibration(vibCir);
- if ( m_lastParticule+m_engine->ParticuleAdapt(0.05f) <= m_time )
+ if ( m_lastParticle+m_engine->ParticleAdapt(0.05f) <= m_time )
{
- m_lastParticule = m_time;
+ m_lastParticle = m_time;
// Particles are ejected from the reactor.
- pos = m_object->RetPosition(0);
+ pos = m_object->GetPosition(0);
pos.y += 6.0f;
speed.x = (Math::Rand()-0.5f)*160.0f;
speed.z = (Math::Rand()-0.5f)*160.0f;
speed.y = -(Math::Rand()*10.0f+10.0f);
dim.x = Math::Rand()*2.0f+2.0f;
dim.y = dim.x;
- m_particule->CreateParticule(pos, speed, dim, PARTIGAS, 2.0f, 10.0f, 2.0f);
+ m_particle->CreateParticle(pos, speed, dim, Gfx::PARTIGAS, 2.0f, 10.0f, 2.0f);
}
m_engine->SetFogStart(m_fogStart+(0.9f-m_fogStart)*m_progress);
@@ -785,19 +785,19 @@ begin:
pos = m_pos;
pos.x -= 110.0f+m_progress*250.0f;
- m_terrain->MoveOnFloor(pos);
+ m_terrain->AdjustToFloor(pos);
pos.y += 10.0f;
m_camera->SetScriptEye(pos);
- pos = m_object->RetPosition(0);
+ pos = m_object->GetPosition(0);
pos.y += 50.0f;
m_camera->SetScriptLookat(pos);
m_engine->SetFocus(1.0f+m_progress);
- if ( m_lastParticule+m_engine->ParticuleAdapt(0.10f) <= m_time )
+ if ( m_lastParticle+m_engine->ParticleAdapt(0.10f) <= m_time )
{
- m_lastParticule = m_time;
+ m_lastParticle = m_time;
// Dust thrown to the ground.
pos = m_pos;
@@ -813,11 +813,11 @@ begin:
dim.y = dim.x;
if ( dim.x >= 1.0f )
{
- m_particule->CreateParticule(pos, speed, dim, PARTICRASH, 2.0f, 0.0f, 2.0f);
+ m_particle->CreateParticle(pos, speed, dim, Gfx::PARTICRASH, 2.0f, 0.0f, 2.0f);
}
// Particles are ejected from the reactor.
- pos = m_object->RetPosition(0);
+ pos = m_object->GetPosition(0);
pos.y += 6.0f;
speed.x = (Math::Rand()-0.5f)*40.0f;
speed.z = (Math::Rand()-0.5f)*40.0f;
@@ -826,23 +826,23 @@ begin:
time = 2.0f+m_progress*12.0f;
dim.x = Math::Rand()*time+time;
dim.y = dim.x;
- m_particule->CreateParticule(pos, speed, dim, PARTIGAS, 2.0f, 10.0f, 2.0f);
+ m_particle->CreateParticle(pos, speed, dim, Gfx::PARTIGAS, 2.0f, 10.0f, 2.0f);
// Black smoke from the reactor.
- pos = m_object->RetPosition(0);
+ pos = m_object->GetPosition(0);
pos.y += 3.0f;
speed.x = (Math::Rand()-0.5f)*10.0f*(4.0f-m_progress*3.0f);
speed.z = (Math::Rand()-0.5f)*10.0f*(4.0f-m_progress*3.0f);
speed.y = 0.0f;
dim.x = Math::Rand()*20.0f+20.0f;
dim.y = dim.x;
- m_particule->CreateParticule(pos, speed, dim, PARTISMOKE3, 10.0f, 0.0f, 2.0f);
+ m_particle->CreateParticle(pos, speed, dim, Gfx::PARTISMOKE3, 10.0f, 0.0f, 2.0f);
}
}
else
{
m_soundChannel = -1;
- m_event->MakeEvent(newEvent, EVENT_WIN);
+ newEvent.type = EVENT_WIN;
m_event->AddEvent(newEvent);
m_phase = ABP_WAIT;
@@ -855,7 +855,7 @@ begin:
{
if ( m_progress < 1.0f )
{
- pos = m_object->RetPosition(0);
+ pos = m_object->GetPosition(0);
pos.z -= event.rTime*5.0f;
m_object->SetPosition(0, pos);
MoveCargo(); // all cargo moves
@@ -882,7 +882,7 @@ begin:
{
if ( m_progress < 1.0f )
{
- pos = m_object->RetPosition(0);
+ pos = m_object->GetPosition(0);
pos.y -= event.rTime*(10.0f/BASE_PORTICO_TIME_DOWN);
m_object->SetPosition(0, pos);
MoveCargo(); // all cargo moves
@@ -890,7 +890,7 @@ begin:
else
{
// Impact with the ground.
- max = (int)(50.0f*m_engine->RetParticuleDensity());
+ max = static_cast<int>(50.0f*m_engine->GetParticleDensity());
for ( i=0 ; i<max ; i++ )
{
angle = Math::Rand()*(Math::PI*2.0f);
@@ -902,7 +902,7 @@ begin:
dim.x = Math::Rand()*10.0f+10.0f;
dim.y = dim.x;
time = Math::Rand()*2.0f+1.5f;
- m_particule->CreateParticule(pos, speed, dim, PARTICRASH, time, 0.0f, 2.0f);
+ m_particle->CreateParticle(pos, speed, dim, Gfx::PARTICRASH, time, 0.0f, 2.0f);
}
m_phase = ABP_PORTICO_WAIT2;
@@ -938,7 +938,7 @@ begin:
{
if ( m_progress < 1.0f )
{
- pos = m_object->RetPosition(0);
+ pos = m_object->GetPosition(0);
pos.x += event.rTime*(2000.0f/BASE_TRANSIT_TIME);
m_object->SetPosition(0, pos);
pos.x += 60.0f;
@@ -967,11 +967,11 @@ begin:
if ( m_bMotor )
{
- if ( m_lastMotorParticule+m_engine->ParticuleAdapt(0.02f) <= m_time )
+ if ( m_lastMotorParticle+m_engine->ParticleAdapt(0.02f) <= m_time )
{
- m_lastMotorParticule = m_time;
+ m_lastMotorParticle = m_time;
- mat = m_object->RetWorldMatrix(0);
+ mat = m_object->GetWorldMatrix(0);
if ( event.rTime == 0.0f )
{
@@ -979,7 +979,7 @@ begin:
}
else
{
- pos = m_object->RetPosition(0);
+ pos = m_object->GetPosition(0);
if ( m_phase == ABP_TRANSIT_MOVE )
{
vSpeed = (pos.x-iPos.x)/event.rTime;
@@ -1003,7 +1003,7 @@ begin:
dim.x = 4.0f+Math::Rand()*4.0f;
dim.y = dim.x;
- m_particule->CreateParticule(pos, speed, dim, PARTIBASE, 3.0f, 0.0f, 0.0f);
+ m_particle->CreateParticle(pos, speed, dim, Gfx::PARTIBASE, 3.0f, 0.0f, 0.0f);
if ( m_phase == ABP_TRANSIT_MOVE )
{
@@ -1013,7 +1013,7 @@ begin:
pos = Math::Vector(0.0f, 7.0f, 0.0f);
pos.x += (Math::Rand()-0.5f)*2.0f; pos.z += (Math::Rand()-0.5f)*2.0f;
pos = Transform(*mat, pos);
- m_particule->CreateParticule(pos, speed, dim, PARTIGAS, 1.0f, 0.0f, 0.0f);
+ m_particle->CreateParticle(pos, speed, dim, Gfx::PARTIGAS, 1.0f, 0.0f, 0.0f);
speed = Math::Vector(0.0f, 0.0f, 0.0f);
dim.x = 4.0f;
@@ -1021,67 +1021,67 @@ begin:
pos = Math::Vector(42.0f, 0.0f, 17.0f);
pos.x += (Math::Rand()-0.5f)*2.0f; pos.z += (Math::Rand()-0.5f)*2.0f;
pos = Transform(*mat, pos);
- m_particule->CreateParticule(pos, speed, dim, PARTIGAS, 0.5f, 0.0f, 0.0f);
+ m_particle->CreateParticle(pos, speed, dim, Gfx::PARTIGAS, 0.5f, 0.0f, 0.0f);
pos = Math::Vector(17.0f, 0.0f, 42.0f);
pos.x += (Math::Rand()-0.5f)*2.0f; pos.z += (Math::Rand()-0.5f)*2.0f;
pos = Transform(*mat, pos);
- m_particule->CreateParticule(pos, speed, dim, PARTIGAS, 0.5f, 0.0f, 0.0f);
+ m_particle->CreateParticle(pos, speed, dim, Gfx::PARTIGAS, 0.5f, 0.0f, 0.0f);
pos = Math::Vector(42.0f, 0.0f, -17.0f);
pos.x += (Math::Rand()-0.5f)*2.0f; pos.z += (Math::Rand()-0.5f)*2.0f;
pos = Transform(*mat, pos);
- m_particule->CreateParticule(pos, speed, dim, PARTIGAS, 0.5f, 0.0f, 0.0f);
+ m_particle->CreateParticle(pos, speed, dim, Gfx::PARTIGAS, 0.5f, 0.0f, 0.0f);
pos = Math::Vector(17.0f, 0.0f, -42.0f);
pos.x += (Math::Rand()-0.5f)*2.0f; pos.z += (Math::Rand()-0.5f)*2.0f;
pos = Transform(*mat, pos);
- m_particule->CreateParticule(pos, speed, dim, PARTIGAS, 0.5f, 0.0f, 0.0f);
+ m_particle->CreateParticle(pos, speed, dim, Gfx::PARTIGAS, 0.5f, 0.0f, 0.0f);
pos = Math::Vector(-42.0f, 0.0f, 17.0f);
pos.x += (Math::Rand()-0.5f)*2.0f; pos.z += (Math::Rand()-0.5f)*2.0f;
pos = Transform(*mat, pos);
- m_particule->CreateParticule(pos, speed, dim, PARTIGAS, 0.5f, 0.0f, 0.0f);
+ m_particle->CreateParticle(pos, speed, dim, Gfx::PARTIGAS, 0.5f, 0.0f, 0.0f);
pos = Math::Vector(-17.0f, 0.0f, 42.0f);
pos.x += (Math::Rand()-0.5f)*2.0f; pos.z += (Math::Rand()-0.5f)*2.0f;
pos = Transform(*mat, pos);
- m_particule->CreateParticule(pos, speed, dim, PARTIGAS, 0.5f, 0.0f, 0.0f);
+ m_particle->CreateParticle(pos, speed, dim, Gfx::PARTIGAS, 0.5f, 0.0f, 0.0f);
pos = Math::Vector(-42.0f, 0.0f, -17.0f);
pos.x += (Math::Rand()-0.5f)*2.0f; pos.z += (Math::Rand()-0.5f)*2.0f;
pos = Transform(*mat, pos);
- m_particule->CreateParticule(pos, speed, dim, PARTIGAS, 0.5f, 0.0f, 0.0f);
+ m_particle->CreateParticle(pos, speed, dim, Gfx::PARTIGAS, 0.5f, 0.0f, 0.0f);
pos = Math::Vector(-17.0f, 0.0f, -42.0f);
pos.x += (Math::Rand()-0.5f)*2.0f; pos.z += (Math::Rand()-0.5f)*2.0f;
pos = Transform(*mat, pos);
- m_particule->CreateParticule(pos, speed, dim, PARTIGAS, 0.5f, 0.0f, 0.0f);
+ m_particle->CreateParticle(pos, speed, dim, Gfx::PARTIGAS, 0.5f, 0.0f, 0.0f);
pos = Math::Vector(42.0f, -2.0f, 17.0f);
pos = Transform(*mat, pos);
- m_particule->SetPosition(m_partiChannel[0], pos);
+ m_particle->SetPosition(m_partiChannel[0], pos);
pos = Math::Vector(17.0f, -2.0f, 42.0f);
pos = Transform(*mat, pos);
- m_particule->SetPosition(m_partiChannel[1], pos);
+ m_particle->SetPosition(m_partiChannel[1], pos);
pos = Math::Vector(42.0f, -2.0f, -17.0f);
pos = Transform(*mat, pos);
- m_particule->SetPosition(m_partiChannel[2], pos);
+ m_particle->SetPosition(m_partiChannel[2], pos);
pos = Math::Vector(17.0f, -2.0f, -42.0f);
pos = Transform(*mat, pos);
- m_particule->SetPosition(m_partiChannel[3], pos);
+ m_particle->SetPosition(m_partiChannel[3], pos);
pos = Math::Vector(-42.0f, -2.0f, 17.0f);
pos = Transform(*mat, pos);
- m_particule->SetPosition(m_partiChannel[4], pos);
+ m_particle->SetPosition(m_partiChannel[4], pos);
pos = Math::Vector(-17.0f, -2.0f, 42.0f);
pos = Transform(*mat, pos);
- m_particule->SetPosition(m_partiChannel[5], pos);
+ m_particle->SetPosition(m_partiChannel[5], pos);
pos = Math::Vector(-42.0f, -2.0f, -17.0f);
pos = Transform(*mat, pos);
- m_particule->SetPosition(m_partiChannel[6], pos);
+ m_particle->SetPosition(m_partiChannel[6], pos);
pos = Math::Vector(-17.0f, -2.0f, -42.0f);
pos = Transform(*mat, pos);
- m_particule->SetPosition(m_partiChannel[7], pos);
+ m_particle->SetPosition(m_partiChannel[7], pos);
}
}
}
if ( m_soundChannel != -1 )
{
- pos = m_engine->RetEyePt();
+ pos = m_engine->GetEyePt();
m_sound->Position(m_soundChannel, pos);
}
@@ -1154,17 +1154,17 @@ bool CAutoBase::Abort()
m_main->SetMovieLock(false); // you can play!
- pObj = m_main->RetSelectObject();
+ pObj = m_main->GetSelectObject();
m_main->SelectObject(pObj);
- m_camera->SetObject(pObj);
+ m_camera->SetControllingObject(pObj);
if ( pObj == 0 )
{
- m_camera->SetType(CAMERA_BACK);
+ m_camera->SetType(Gfx::CAM_TYPE_BACK);
}
else
{
- m_camera->SetType(pObj->RetCameraType());
- m_camera->SetDist(pObj->RetCameraDist());
+ m_camera->SetType(pObj->GetCameraType());
+ m_camera->SetDist(pObj->GetCameraDist());
}
m_engine->SetFogStart(m_fogStart);
@@ -1175,7 +1175,7 @@ bool CAutoBase::Abort()
m_phase == ABP_TOWAIT ||
m_phase == ABP_TAKEOFF ) // off?
{
- m_event->MakeEvent(newEvent, EVENT_WIN);
+ newEvent.type = EVENT_WIN;
m_event->AddEvent(newEvent);
}
}
@@ -1198,9 +1198,9 @@ bool CAutoBase::Abort()
}
-// Returns an error due the state of the automation.
+// Geturns an error due the state of the automation.
-Error CAutoBase::RetError()
+Error CAutoBase::GetError()
{
return ERR_OK;
}
@@ -1210,7 +1210,7 @@ Error CAutoBase::RetError()
bool CAutoBase::CreateInterface(bool bSelect)
{
- CWindow* pw;
+ Ui::CWindow* pw;
Math::Point pos, dim, ddim;
float ox, oy, sx, sy;
float sleep, delay, magnetic, progress;
@@ -1219,8 +1219,8 @@ bool CAutoBase::CreateInterface(bool bSelect)
if ( !bSelect ) return true;
- pw = (CWindow*)m_interface->SearchControl(EVENT_WINDOW0);
- if ( pw == 0 ) return false;
+ pw = static_cast<Ui::CWindow*>(m_interface->SearchControl(EVENT_WINDOW0));
+ if ( pw == nullptr ) return false;
dim.x = 33.0f/640.0f;
dim.y = 33.0f/480.0f;
@@ -1240,7 +1240,7 @@ bool CAutoBase::CreateInterface(bool bSelect)
pos.y = oy+sy*0.25f;
pw->CreateButton(pos, ddim, 28, EVENT_OBJECT_BTAKEOFF);
- if ( m_blitz->GetStatus(sleep, delay, magnetic, progress) )
+ if ( m_lightning->GetStatus(sleep, delay, magnetic, progress) )
{
pos.x = ox+sx*10.2f;
pos.y = oy+sy*0.5f;
@@ -1264,13 +1264,13 @@ bool CAutoBase::CreateInterface(bool bSelect)
void CAutoBase::UpdateInterface()
{
- CWindow* pw;
+// Ui::CWindow* pw;
- if ( !m_object->RetSelect() ) return;
+ if ( !m_object->GetSelect() ) return;
CAuto::UpdateInterface();
- pw = (CWindow*)m_interface->SearchControl(EVENT_WINDOW0);
+// pw = static_cast< Ui::CWindow* >( m_interface->SearchControl(EVENT_WINDOW0));
}
@@ -1286,15 +1286,15 @@ void CAutoBase::FreezeCargo(bool bFreeze)
for ( i=0 ; i<1000000 ; i++ )
{
- pObj = (CObject*)m_iMan->SearchInstance(CLASS_OBJECT, i);
+ pObj = static_cast<CObject*>(m_iMan->SearchInstance(CLASS_OBJECT, i));
if ( pObj == 0 ) break;
pObj->SetCargo(false);
if ( pObj == m_object ) continue; // yourself?
- if ( pObj->RetTruck() != 0 ) continue; // transport object?
+ if ( pObj->GetTruck() != 0 ) continue; // transport object?
- oPos = pObj->RetPosition(0);
+ oPos = pObj->GetPosition(0);
dist = Math::DistanceProjected(m_pos, oPos);
if ( dist < 32.0f )
{
@@ -1303,7 +1303,7 @@ void CAutoBase::FreezeCargo(bool bFreeze)
pObj->SetCargo(true);
}
- physics = pObj->RetPhysics();
+ physics = pObj->GetPhysics();
if ( physics != 0 )
{
physics->SetFreeze(bFreeze);
@@ -1320,18 +1320,18 @@ void CAutoBase::MoveCargo()
Math::Vector oPos, sPos;
int i;
- sPos = m_object->RetPosition(0);
+ sPos = m_object->GetPosition(0);
for ( i=0 ; i<1000000 ; i++ )
{
- pObj = (CObject*)m_iMan->SearchInstance(CLASS_OBJECT, i);
+ pObj = static_cast < CObject* > (m_iMan->SearchInstance(CLASS_OBJECT, i));
if ( pObj == 0 ) break;
- if ( !pObj->RetCargo() ) continue;
+ if ( !pObj->GetCargo() ) continue;
- oPos = pObj->RetPosition(0);
+ oPos = pObj->GetPosition(0);
oPos.y = sPos.y+30.0f;
- oPos.y += pObj->RetCharacter()->height;
+ oPos.y += pObj->GetCharacter()->height;
oPos.x += sPos.x-m_lastPos.x;
oPos.z += sPos.z-m_lastPos.z;
pObj->SetPosition(0, oPos);
@@ -1353,13 +1353,13 @@ Error CAutoBase::CheckCloseDoor()
for ( i=0 ; i<1000000 ; i++ )
{
- pObj = (CObject*)m_iMan->SearchInstance(CLASS_OBJECT, i);
+ pObj = static_cast< CObject* > (m_iMan->SearchInstance(CLASS_OBJECT, i));
if ( pObj == 0 ) break;
if ( pObj == m_object ) continue; // yourself?
- if ( !pObj->RetActif() ) continue; // inactive?
+ if ( !pObj->GetActif() ) continue; // inactive?
- type = pObj->RetType();
+ type = pObj->GetType();
if ( type == OBJECT_PORTICO ) continue;
j = 0;
@@ -1387,22 +1387,20 @@ Error CAutoBase::CheckCloseDoor()
void CAutoBase::BeginTransit()
{
- bool bFull, bQuarter;
-
if ( m_param == PARAM_TRANSIT2 )
{
- strcpy(m_bgBack, "back01.tga"); // clouds orange / blue
+ m_bgBack = "back01.png"; // clouds orange / blue
}
else if ( m_param == PARAM_TRANSIT3 )
{
- strcpy(m_bgBack, "back22.tga"); // blueberries clouds
+ m_bgBack = "back22.png"; // blueberries clouds
}
else
{
#if _DEMO
- strcpy(m_bgBack, "back46b.tga"); // paintings
+ m_bgBack = "back46b.png"; // paintings
#else
- strcpy(m_bgBack, "back46.tga"); // paintings
+ m_bgBack = "back46.png"; // paintings
#endif
}
@@ -1410,13 +1408,18 @@ void CAutoBase::BeginTransit()
m_engine->SetDeepView(2000.0f); // we see very far
m_engine->ApplyChange();
- m_engine->RetBackground(m_bgName, m_bgUp, m_bgDown, m_bgCloudUp, m_bgCloudDown, bFull, bQuarter);
- m_engine->FreeTexture(m_bgName);
+ Math::Point scale;
+ bool full;
+ m_engine->GetBackground(m_bgName, m_bgUp, m_bgDown, m_bgCloudUp, m_bgCloudDown, full, scale);
+ m_engine->DeleteTexture(m_bgName);
- m_engine->SetBackground(m_bgBack, 0x00000000, 0x00000000, 0x00000000, 0x00000000);
+ m_engine->SetBackground(m_bgBack, Gfx::Color(0.0f, 0.0f, 0.0f, 0.0f),
+ Gfx::Color(0.0f, 0.0f, 0.0f, 0.0f),
+ Gfx::Color(0.0f, 0.0f, 0.0f, 0.0f),
+ Gfx::Color(0.0f, 0.0f, 0.0f, 0.0f));
m_engine->LoadTexture(m_bgBack);
- m_cloud->SetEnable(false); // cache clouds
+ m_cloud->SetEnabled(false); // cache clouds
m_planet->SetMode(1);
}
@@ -1428,12 +1431,12 @@ void CAutoBase::EndTransit()
m_engine->SetDeepView(m_deepView); // gives initial depth
m_engine->ApplyChange();
- m_engine->FreeTexture(m_bgBack);
+ m_engine->DeleteTexture(m_bgBack);
m_engine->SetBackground(m_bgName, m_bgUp, m_bgDown, m_bgCloudUp, m_bgCloudDown);
m_engine->LoadTexture(m_bgName);
- m_cloud->SetEnable(true); // gives the clouds
+ m_cloud->SetEnabled(true); // gives the clouds
m_planet->SetMode(0);
m_main->StartMusic();
diff --git a/src/object/auto/autobase.h b/src/object/auto/autobase.h
index eb47a93..439d414 100644
--- a/src/object/auto/autobase.h
+++ b/src/object/auto/autobase.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
@@ -73,7 +74,7 @@ public:
void Start(int param);
bool EventProcess(const Event &event);
bool Abort();
- Error RetError();
+ Error GetError();
bool CreateInterface(bool bSelect);
@@ -90,23 +91,23 @@ protected:
bool m_bOpen;
float m_progress;
float m_speed;
- float m_lastParticule;
- float m_lastMotorParticule;
+ float m_lastParticle;
+ float m_lastMotorParticle;
float m_fogStart;
float m_deepView;
- Math::Vector m_pos;
- Math::Vector m_posSound;
- Math::Vector m_finalPos;
- Math::Vector m_lastPos;
+ Math::Vector m_pos;
+ Math::Vector m_posSound;
+ Math::Vector m_finalPos;
+ Math::Vector m_lastPos;
int m_param;
int m_soundChannel;
int m_partiChannel[8];
- char m_bgBack[100];
- char m_bgName[100];
- D3DCOLOR m_bgUp;
- D3DCOLOR m_bgDown;
- D3DCOLOR m_bgCloudUp;
- D3DCOLOR m_bgCloudDown;
+ std::string m_bgBack;
+ std::string m_bgName;
+ Gfx::Color m_bgUp;
+ Gfx::Color m_bgDown;
+ Gfx::Color m_bgCloudUp;
+ Gfx::Color m_bgCloudDown;
};
diff --git a/src/object/auto/autoconvert.cpp b/src/object/auto/autoconvert.cpp
index b5ad43a..ec4392b 100644
--- a/src/object/auto/autoconvert.cpp
+++ b/src/object/auto/autoconvert.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
@@ -15,8 +16,6 @@
// * along with this program. If not, see http://www.gnu.org/licenses/.
-#include <stdio.h>
-
#include "object/auto/autoconvert.h"
#include "common/iman.h"
@@ -26,7 +25,8 @@
#include "ui/window.h"
#include "ui/displaytext.h"
-
+#include <stdio.h>
+#include <string.h>
// Object's constructor.
@@ -83,7 +83,7 @@ void CAutoConvert::Init()
m_speed = 1.0f/2.0f;
m_time = 0.0f;
m_timeVirus = 0.0f;
- m_lastParticule = 0.0f;
+ m_lastParticle = 0.0f;
CAuto::Init();
}
@@ -100,13 +100,13 @@ bool CAutoConvert::EventProcess(const Event &event)
CAuto::EventProcess(event);
- if ( m_engine->RetPause() ) return true;
- if ( event.event != EVENT_FRAME ) return true;
+ if ( m_engine->GetPause() ) return true;
+ if ( event.type != EVENT_FRAME ) return true;
m_progress += event.rTime*m_speed;
m_timeVirus -= event.rTime;
- if ( m_object->RetVirusMode() ) // contaminated by a virus?
+ if ( m_object->GetVirusMode() ) // contaminated by a virus?
{
if ( m_timeVirus <= 0.0f )
{
@@ -146,7 +146,7 @@ bool CAutoConvert::EventProcess(const Event &event)
InitProgressTotal(3.0f+10.0f+1.5f);
UpdateInterface();
- m_sound->Play(SOUND_OPEN, m_object->RetPosition(0), 1.0f, 1.0f);
+ m_sound->Play(SOUND_OPEN, m_object->GetPosition(0), 1.0f, 1.0f);
m_bSoundClose = false;
m_phase = ACP_CLOSE;
@@ -163,7 +163,7 @@ bool CAutoConvert::EventProcess(const Event &event)
if ( m_progress >= 0.8f && !m_bSoundClose )
{
m_bSoundClose = true;
- m_sound->Play(SOUND_CLOSE, m_object->RetPosition(0), 1.0f, 0.8f);
+ m_sound->Play(SOUND_CLOSE, m_object->GetPosition(0), 1.0f, 0.8f);
}
angle = -Math::PI*0.35f*(1.0f-Math::Bounce(m_progress, 0.85f, 0.05f));
m_object->SetAngleX(2, angle);
@@ -174,7 +174,7 @@ bool CAutoConvert::EventProcess(const Event &event)
m_object->SetAngleX(2, 0.0f);
m_object->SetAngleX(3, 0.0f);
- m_soundChannel = m_sound->Play(SOUND_CONVERT, m_object->RetPosition(0), 0.0f, 0.25f, true);
+ m_soundChannel = m_sound->Play(SOUND_CONVERT, m_object->GetPosition(0), 0.0f, 0.25f, true);
m_sound->AddEnvelope(m_soundChannel, 1.0f, 0.25f, 0.5f, SOPER_CONTINUE);
m_sound->AddEnvelope(m_soundChannel, 1.0f, 1.00f, 4.5f, SOPER_CONTINUE);
m_sound->AddEnvelope(m_soundChannel, 1.0f, 0.25f, 4.5f, SOPER_CONTINUE);
@@ -202,11 +202,11 @@ bool CAutoConvert::EventProcess(const Event &event)
m_object->SetAngleY(2, angle);
m_object->SetAngleY(3, angle+Math::PI);
- if ( m_lastParticule+m_engine->ParticuleAdapt(0.05f) <= m_time )
+ if ( m_lastParticle+m_engine->ParticleAdapt(0.05f) <= m_time )
{
- m_lastParticule = m_time;
+ m_lastParticle = m_time;
- pos = m_object->RetPosition(0);
+ pos = m_object->GetPosition(0);
c.x = pos.x;
c.y = pos.z;
p.x = c.x;
@@ -218,7 +218,7 @@ bool CAutoConvert::EventProcess(const Event &event)
speed = Math::Vector(0.0f, 0.0f, 0.0f);
dim.x = Math::Rand()*2.0f+1.0f;
dim.y = dim.x;
- m_particule->CreateParticule(pos, speed, dim, PARTIGAS, 1.0f, 0.0f, 0.0f);
+ m_particle->CreateParticle(pos, speed, dim, Gfx::PARTIGAS, 1.0f, 0.0f, 0.0f);
}
}
else
@@ -230,13 +230,13 @@ bool CAutoConvert::EventProcess(const Event &event)
fret = SearchStone(OBJECT_STONE);
if ( fret != 0 )
{
- m_bResetDelete = ( fret->RetResetCap() != RESET_NONE );
+ m_bResetDelete = ( fret->GetResetCap() != RESET_NONE );
fret->DeleteObject(); // destroy the stone
delete fret;
}
CreateMetal(); // Create the metal
- m_sound->Play(SOUND_OPEN, m_object->RetPosition(0), 1.0f, 1.5f);
+ m_sound->Play(SOUND_OPEN, m_object->GetPosition(0), 1.0f, 1.5f);
m_phase = ACP_OPEN;
m_progress = 0.0f;
@@ -253,18 +253,18 @@ bool CAutoConvert::EventProcess(const Event &event)
m_object->SetAngleX(3, angle);
if ( m_progress < 0.9f &&
- m_lastParticule+m_engine->ParticuleAdapt(0.05f) <= m_time )
+ m_lastParticle+m_engine->ParticleAdapt(0.05f) <= m_time )
{
- m_lastParticule = m_time;
+ m_lastParticle = m_time;
- pos = m_object->RetPosition(0);
+ pos = m_object->GetPosition(0);
pos.x += (Math::Rand()-0.5f)*6.0f;
pos.z += (Math::Rand()-0.5f)*6.0f;
pos.y += Math::Rand()*4.0f;
speed = Math::Vector(0.0f, 0.0f, 0.0f);
dim.x = Math::Rand()*4.0f+3.0f;
dim.y = dim.x;
- m_particule->CreateParticule(pos, speed, dim, PARTIBLUE, 1.0f, 0.0f, 0.0f);
+ m_particle->CreateParticle(pos, speed, dim, Gfx::PARTIBLUE, 1.0f, 0.0f, 0.0f);
}
}
else
@@ -285,11 +285,11 @@ bool CAutoConvert::EventProcess(const Event &event)
return true;
}
-// Returns an error due the state of the automation.
+// Geturns an error due the state of the automation.
-Error CAutoConvert::RetError()
+Error CAutoConvert::GetError()
{
- if ( m_object->RetVirusMode() )
+ if ( m_object->GetVirusMode() )
{
return ERR_BAT_VIRUS;
}
@@ -330,7 +330,7 @@ bool CAutoConvert::Abort()
bool CAutoConvert::CreateInterface(bool bSelect)
{
- CWindow* pw;
+ Ui::CWindow* pw;
Math::Point pos, ddim;
float ox, oy, sx, sy;
@@ -338,8 +338,8 @@ bool CAutoConvert::CreateInterface(bool bSelect)
if ( !bSelect ) return true;
- pw = (CWindow*)m_interface->SearchControl(EVENT_WINDOW0);
- if ( pw == 0 ) return false;
+ pw = static_cast< Ui::CWindow* >(m_interface->SearchControl(EVENT_WINDOW0));
+ if ( pw == nullptr ) return false;
ox = 3.0f/640.0f;
oy = 3.0f/480.0f;
@@ -390,11 +390,11 @@ bool CAutoConvert::Read(char *line)
CAuto::Read(line);
- m_phase = (AutoConvertPhase)OpInt(line, "aPhase", ACP_WAIT);
+ m_phase = static_cast< AutoConvertPhase >(OpInt(line, "aPhase", ACP_WAIT));
m_progress = OpFloat(line, "aProgress", 0.0f);
m_speed = OpFloat(line, "aSpeed", 1.0f);
- m_lastParticule = 0.0f;
+ m_lastParticle = 0.0f;
return true;
}
@@ -410,18 +410,18 @@ CObject* CAutoConvert::SearchStone(ObjectType type)
float dist;
int i;
- cPos = m_object->RetPosition(0);
+ cPos = m_object->GetPosition(0);
for ( i=0 ; i<1000000 ; i++ )
{
- pObj = (CObject*)m_iMan->SearchInstance(CLASS_OBJECT, i);
+ pObj = static_cast< CObject* >(m_iMan->SearchInstance(CLASS_OBJECT, i));
if ( pObj == 0 ) break;
- oType = pObj->RetType();
+ oType = pObj->GetType();
if ( oType != type ) continue;
- if ( pObj->RetTruck() != 0 ) continue;
+ if ( pObj->GetTruck() != 0 ) continue;
- oPos = pObj->RetPosition(0);
+ oPos = pObj->GetPosition(0);
dist = Math::Distance(oPos, cPos);
if ( dist <= 5.0f ) return pObj;
@@ -440,14 +440,14 @@ bool CAutoConvert::SearchVehicle()
float oRadius, dist;
int i;
- cPos = m_object->RetPosition(0);
+ cPos = m_object->GetPosition(0);
for ( i=0 ; i<1000000 ; i++ )
{
- pObj = (CObject*)m_iMan->SearchInstance(CLASS_OBJECT, i);
+ pObj = static_cast< CObject* >(m_iMan->SearchInstance(CLASS_OBJECT, i));
if ( pObj == 0 ) break;
- type = pObj->RetType();
+ type = pObj->GetType();
if ( type != OBJECT_HUMAN &&
type != OBJECT_MOBILEfa &&
type != OBJECT_MOBILEta &&
@@ -506,8 +506,8 @@ void CAutoConvert::CreateMetal()
float angle;
CObject* fret;
- pos = m_object->RetPosition(0);
- angle = m_object->RetAngleY(0);
+ pos = m_object->GetPosition(0);
+ angle = m_object->GetAngleY(0);
fret = new CObject(m_iMan);
if ( !fret->CreateResource(pos, angle, OBJECT_METAL) )
diff --git a/src/object/auto/autoconvert.h b/src/object/auto/autoconvert.h
index c2042cf..b21690f 100644
--- a/src/object/auto/autoconvert.h
+++ b/src/object/auto/autoconvert.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
@@ -44,7 +45,7 @@ public:
void Init();
bool EventProcess(const Event &event);
- Error RetError();
+ Error GetError();
bool Abort();
bool CreateInterface(bool bSelect);
@@ -62,7 +63,7 @@ protected:
float m_progress;
float m_speed;
float m_timeVirus;
- float m_lastParticule;
+ float m_lastParticle;
bool m_bResetDelete;
bool m_bSoundClose;
int m_soundChannel;
diff --git a/src/object/auto/autoderrick.cpp b/src/object/auto/autoderrick.cpp
index 3f1cda5..3578c0d 100644
--- a/src/object/auto/autoderrick.cpp
+++ b/src/object/auto/autoderrick.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
@@ -15,19 +16,18 @@
// * along with this program. If not, see http://www.gnu.org/licenses/.
-#include <stdio.h>
-
#include "object/auto/autoderrick.h"
#include "common/iman.h"
-#include "old/terrain.h"
+#include "graphics/engine/terrain.h"
#include "math/geometry.h"
#include "script/cmdtoken.h"
#include "ui/interface.h"
#include "ui/window.h"
#include "ui/displaytext.h"
-
+#include <stdio.h>
+#include <string.h>
const float DERRICK_DELAY = 10.0f; // duration of the extraction
@@ -62,7 +62,7 @@ void CAutoDerrick::DeleteObject(bool bAll)
if ( !bAll )
{
fret = SearchFret();
- if ( fret != 0 && fret->RetLock() )
+ if ( fret != 0 && fret->GetLock() )
{
fret->DeleteObject();
delete fret;
@@ -86,25 +86,25 @@ void CAutoDerrick::Init()
{
Math::Matrix* mat;
Math::Vector pos;
- TerrainRes res;
+ Gfx::TerrainRes res;
- pos = m_object->RetPosition(0);
- res = m_terrain->RetResource(pos);
+ pos = m_object->GetPosition(0);
+ res = m_terrain->GetResource(pos);
- if ( res == TR_STONE ||
- res == TR_URANIUM ||
- res == TR_KEYa ||
- res == TR_KEYb ||
- res == TR_KEYc ||
- res == TR_KEYd )
+ if ( res == Gfx::TR_STONE ||
+ res == Gfx::TR_URANIUM ||
+ res == Gfx::TR_KEY_A ||
+ res == Gfx::TR_KEY_B ||
+ res == Gfx::TR_KEY_C ||
+ res == Gfx::TR_KEY_D )
{
m_type = OBJECT_FRET;
- if ( res == TR_STONE ) m_type = OBJECT_STONE;
- if ( res == TR_URANIUM ) m_type = OBJECT_URANIUM;
- if ( res == TR_KEYa ) m_type = OBJECT_KEYa;
- if ( res == TR_KEYb ) m_type = OBJECT_KEYb;
- if ( res == TR_KEYc ) m_type = OBJECT_KEYc;
- if ( res == TR_KEYd ) m_type = OBJECT_KEYd;
+ if ( res == Gfx::TR_STONE ) m_type = OBJECT_STONE;
+ if ( res == Gfx::TR_URANIUM ) m_type = OBJECT_URANIUM;
+ if ( res == Gfx::TR_KEY_A ) m_type = OBJECT_KEYa;
+ if ( res == Gfx::TR_KEY_B ) m_type = OBJECT_KEYb;
+ if ( res == Gfx::TR_KEY_C ) m_type = OBJECT_KEYc;
+ if ( res == Gfx::TR_KEY_D ) m_type = OBJECT_KEYd;
m_phase = ADP_EXCAVATE;
m_progress = 0.0f;
@@ -119,13 +119,13 @@ void CAutoDerrick::Init()
m_time = 0.0f;
m_timeVirus = 0.0f;
- m_lastParticule = 0.0f;
+ m_lastParticle = 0.0f;
m_lastTrack = 0.0f;
pos = Math::Vector(7.0f, 0.0f, 0.0f);
- mat = m_object->RetWorldMatrix(0);
+ mat = m_object->GetWorldMatrix(0);
pos = Math::Transform(*mat, pos);
- m_terrain->MoveOnFloor(pos);
+ m_terrain->AdjustToFloor(pos);
m_fretPos = pos;
}
@@ -141,14 +141,14 @@ bool CAutoDerrick::EventProcess(const Event &event)
CAuto::EventProcess(event);
- if ( m_engine->RetPause() ) return true;
- if ( event.event != EVENT_FRAME ) return true;
+ if ( m_engine->GetPause() ) return true;
+ if ( event.type != EVENT_FRAME ) return true;
if ( m_phase == ADP_WAIT ) return true;
m_progress += event.rTime*m_speed;
m_timeVirus -= event.rTime;
- if ( m_object->RetVirusMode() ) // contaminated by a virus?
+ if ( m_object->GetVirusMode() ) // contaminated by a virus?
{
if ( m_timeVirus <= 0.0f )
{
@@ -176,7 +176,7 @@ bool CAutoDerrick::EventProcess(const Event &event)
{
factor = 1.0f;
}
- m_soundChannel = m_sound->Play(SOUND_DERRICK, m_object->RetPosition(0), 1.0f, 0.5f, true);
+ m_soundChannel = m_sound->Play(SOUND_DERRICK, m_object->GetPosition(0), 1.0f, 0.5f, true);
m_sound->AddEnvelope(m_soundChannel, 1.0f, 0.5f, 4.0f*factor, SOPER_CONTINUE);
m_sound->AddEnvelope(m_soundChannel, 1.0f, 0.3f, 6.0f*factor, SOPER_CONTINUE);
m_sound->AddEnvelope(m_soundChannel, 1.0f, 0.5f, 1.0f, SOPER_CONTINUE);
@@ -184,25 +184,25 @@ bool CAutoDerrick::EventProcess(const Event &event)
}
if ( m_progress >= 6.0f/16.0f && // penetrates into the ground?
- m_lastParticule+m_engine->ParticuleAdapt(0.05f) <= m_time )
+ m_lastParticle+m_engine->ParticleAdapt(0.05f) <= m_time )
{
- m_lastParticule = m_time;
+ m_lastParticle = m_time;
- pos = m_object->RetPosition(0);
+ pos = m_object->GetPosition(0);
speed.x = (Math::Rand()-0.5f)*10.0f;
speed.z = (Math::Rand()-0.5f)*10.0f;
speed.y = Math::Rand()*5.0f;
dim.x = Math::Rand()*3.0f+2.0f;
dim.y = dim.x;
- m_particule->CreateParticule(pos, speed, dim, PARTICRASH, 2.0f);
+ m_particle->CreateParticle(pos, speed, dim, Gfx::PARTICRASH, 2.0f);
}
if ( m_progress >= 6.0f/16.0f && // penetrates into the ground?
- m_lastTrack+m_engine->ParticuleAdapt(0.5f) <= m_time )
+ m_lastTrack+m_engine->ParticleAdapt(0.5f) <= m_time )
{
m_lastTrack = m_time;
- pos = m_object->RetPosition(0);
+ pos = m_object->GetPosition(0);
speed.x = (Math::Rand()-0.5f)*12.0f;
speed.z = (Math::Rand()-0.5f)*12.0f;
speed.y = Math::Rand()*10.0f+10.0f;
@@ -210,7 +210,7 @@ bool CAutoDerrick::EventProcess(const Event &event)
dim.y = dim.x;
pos.y += dim.y;
duration = Math::Rand()*2.0f+2.0f;
- m_particule->CreateTrack(pos, speed, dim, PARTITRACK5,
+ m_particle->CreateTrack(pos, speed, dim, Gfx::PARTITRACK5,
duration, Math::Rand()*10.0f+15.0f,
duration*0.2f, 1.0f);
}
@@ -222,7 +222,7 @@ bool CAutoDerrick::EventProcess(const Event &event)
pos.y = -m_progress*16.0f;
m_object->SetPosition(1, pos); // down the drill
- angle = m_object->RetAngleY(1);
+ angle = m_object->GetAngleY(1);
angle += event.rTime*8.0f;
m_object->SetAngleY(1, angle); // rotates the drill
}
@@ -237,25 +237,25 @@ bool CAutoDerrick::EventProcess(const Event &event)
if ( m_phase == ADP_ASCEND )
{
if ( m_progress <= 7.0f/16.0f &&
- m_lastParticule+m_engine->ParticuleAdapt(0.1f) <= m_time )
+ m_lastParticle+m_engine->ParticleAdapt(0.1f) <= m_time )
{
- m_lastParticule = m_time;
+ m_lastParticle = m_time;
- pos = m_object->RetPosition(0);
+ pos = m_object->GetPosition(0);
speed.x = (Math::Rand()-0.5f)*10.0f;
speed.z = (Math::Rand()-0.5f)*10.0f;
speed.y = Math::Rand()*5.0f;
dim.x = Math::Rand()*3.0f+2.0f;
dim.y = dim.x;
- m_particule->CreateParticule(pos, speed, dim, PARTICRASH, 2.0f);
+ m_particle->CreateParticle(pos, speed, dim, Gfx::PARTICRASH, 2.0f);
}
if ( m_progress <= 4.0f/16.0f &&
- m_lastTrack+m_engine->ParticuleAdapt(1.0f) <= m_time )
+ m_lastTrack+m_engine->ParticleAdapt(1.0f) <= m_time )
{
m_lastTrack = m_time;
- pos = m_object->RetPosition(0);
+ pos = m_object->GetPosition(0);
speed.x = (Math::Rand()-0.5f)*12.0f;
speed.z = (Math::Rand()-0.5f)*12.0f;
speed.y = Math::Rand()*10.0f+10.0f;
@@ -263,7 +263,7 @@ bool CAutoDerrick::EventProcess(const Event &event)
dim.y = dim.x;
pos.y += dim.y;
duration = Math::Rand()*2.0f+2.0f;
- m_particule->CreateTrack(pos, speed, dim, PARTITRACK5,
+ m_particle->CreateTrack(pos, speed, dim, Gfx::PARTITRACK5,
duration, Math::Rand()*10.0f+15.0f,
duration*0.2f, 1.0f);
}
@@ -275,7 +275,7 @@ bool CAutoDerrick::EventProcess(const Event &event)
pos.y = -(1.0f-m_progress)*16.0f;
m_object->SetPosition(1, pos); // back the drill
- angle = m_object->RetAngleY(1);
+ angle = m_object->GetAngleY(1);
angle -= event.rTime*2.0f;
m_object->SetAngleY(1, angle); // rotates the drill
}
@@ -308,7 +308,7 @@ bool CAutoDerrick::EventProcess(const Event &event)
{
if ( SearchFree(m_fretPos) )
{
- angle = m_object->RetAngleY(0);
+ angle = m_object->GetAngleY(0);
CreateFret(m_fretPos, angle, m_type, 16.0f);
}
else
@@ -324,31 +324,31 @@ bool CAutoDerrick::EventProcess(const Event &event)
if ( fret != 0 &&
m_progress <= 0.5f &&
- m_lastParticule+m_engine->ParticuleAdapt(0.1f) <= m_time )
+ m_lastParticle+m_engine->ParticleAdapt(0.1f) <= m_time )
{
- m_lastParticule = m_time;
+ m_lastParticle = m_time;
if ( m_progress < 0.3f )
{
- pos = fret->RetPosition(0);
+ pos = fret->GetPosition(0);
pos.x += (Math::Rand()-0.5f)*5.0f;
pos.z += (Math::Rand()-0.5f)*5.0f;
pos.y += (Math::Rand()-0.5f)*5.0f;
speed = Math::Vector(0.0f, 0.0f, 0.0f);
dim.x = 3.0f;
dim.y = dim.x;
- m_particule->CreateParticule(pos, speed, dim, PARTIFIRE, 1.0f, 0.0f, 0.0f);
+ m_particle->CreateParticle(pos, speed, dim, Gfx::PARTIFIRE, 1.0f, 0.0f, 0.0f);
}
else
{
- pos = fret->RetPosition(0);
+ pos = fret->GetPosition(0);
pos.x += (Math::Rand()-0.5f)*5.0f;
pos.z += (Math::Rand()-0.5f)*5.0f;
pos.y += Math::Rand()*2.5f;
speed = Math::Vector(0.0f, 0.0f, 0.0f);
dim.x = 1.0f;
dim.y = dim.x;
- m_particule->CreateParticule(pos, speed, dim, PARTIGLINT, 2.0f, 0.0f, 0.0f);
+ m_particle->CreateParticle(pos, speed, dim, Gfx::PARTIGLINT, 2.0f, 0.0f, 0.0f);
}
}
@@ -356,7 +356,7 @@ bool CAutoDerrick::EventProcess(const Event &event)
{
if ( fret != 0 )
{
- pos = fret->RetPosition(0);
+ pos = fret->GetPosition(0);
pos.y -= event.rTime*20.0f; // grave
if ( !m_bSoundFall && pos.y < m_fretPos.y )
{
@@ -396,7 +396,7 @@ bool CAutoDerrick::EventProcess(const Event &event)
bool CAutoDerrick::CreateInterface(bool bSelect)
{
- CWindow* pw;
+ Ui::CWindow* pw;
Math::Point pos, ddim;
float ox, oy, sx, sy;
@@ -404,7 +404,7 @@ bool CAutoDerrick::CreateInterface(bool bSelect)
if ( !bSelect ) return true;
- pw = (CWindow*)m_interface->SearchControl(EVENT_WINDOW0);
+ pw = static_cast< Ui::CWindow* >(m_interface->SearchControl(EVENT_WINDOW0));
if ( pw == 0 ) return false;
ox = 3.0f/640.0f;
@@ -455,11 +455,11 @@ bool CAutoDerrick::Read(char *line)
CAuto::Read(line);
- m_phase = (AutoDerrickPhase)OpInt(line, "aPhase", ADP_WAIT);
+ m_phase = static_cast< AutoDerrickPhase >(OpInt(line, "aPhase", ADP_WAIT));
m_progress = OpFloat(line, "aProgress", 0.0f);
m_speed = OpFloat(line, "aSpeed", 1.0f);
- m_lastParticule = 0.0f;
+ m_lastParticle = 0.0f;
return true;
}
@@ -476,13 +476,13 @@ CObject* CAutoDerrick::SearchFret()
for ( i=0 ; i<1000000 ; i++ )
{
- pObj = (CObject*)m_iMan->SearchInstance(CLASS_OBJECT, i);
+ pObj = static_cast< CObject* >(m_iMan->SearchInstance(CLASS_OBJECT, i));
if ( pObj == 0 ) break;
- type = pObj->RetType();
+ type = pObj->GetType();
if ( type == OBJECT_DERRICK ) continue;
- oPos = pObj->RetPosition(0);
+ oPos = pObj->GetPosition(0);
if ( oPos.x == m_fretPos.x &&
oPos.z == m_fretPos.z ) return pObj;
@@ -503,10 +503,10 @@ bool CAutoDerrick::SearchFree(Math::Vector pos)
for ( i=0 ; i<1000000 ; i++ )
{
- pObj = (CObject*)m_iMan->SearchInstance(CLASS_OBJECT, i);
+ pObj = static_cast< CObject* >(m_iMan->SearchInstance(CLASS_OBJECT, i));
if ( pObj == 0 ) break;
- type = pObj->RetType();
+ type = pObj->GetType();
if ( type == OBJECT_DERRICK ) continue;
j = 0;
@@ -537,12 +537,12 @@ void CAutoDerrick::CreateFret(Math::Vector pos, float angle, ObjectType type,
}
fret->SetLock(true); // object not yet usable
- if ( m_object->RetResetCap() == RESET_MOVE )
+ if ( m_object->GetResetCap() == RESET_MOVE )
{
fret->SetResetCap(RESET_DELETE);
}
- pos = fret->RetPosition(0);
+ pos = fret->GetPosition(0);
pos.y += height;
fret->SetPosition(0, pos);
}
@@ -562,10 +562,10 @@ bool CAutoDerrick::ExistKey()
for ( i=0 ; i<1000000 ; i++ )
{
- pObj = (CObject*)m_iMan->SearchInstance(CLASS_OBJECT, i);
+ pObj = static_cast< CObject* >(m_iMan->SearchInstance(CLASS_OBJECT, i));
if ( pObj == 0 ) break;
- type = pObj->RetType();
+ type = pObj->GetType();
if ( type == m_type ) return true;
}
@@ -573,11 +573,11 @@ bool CAutoDerrick::ExistKey()
}
-// Returns an error due the state of the automaton.
+// returns an error due the state of the automaton.
-Error CAutoDerrick::RetError()
+Error CAutoDerrick::GetError()
{
- if ( m_object->RetVirusMode() )
+ if ( m_object->GetVirusMode() )
{
return ERR_BAT_VIRUS;
}
diff --git a/src/object/auto/autoderrick.h b/src/object/auto/autoderrick.h
index 61a1ff1..b52f93b 100644
--- a/src/object/auto/autoderrick.h
+++ b/src/object/auto/autoderrick.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
@@ -44,7 +45,7 @@ public:
void Init();
bool EventProcess(const Event &event);
- Error RetError();
+ Error GetError();
bool CreateInterface(bool bSelect);
@@ -62,7 +63,7 @@ protected:
float m_progress;
float m_speed;
float m_timeVirus;
- float m_lastParticule;
+ float m_lastParticle;
float m_lastTrack;
Math::Vector m_fretPos;
int m_soundChannel;
diff --git a/src/object/auto/autodestroyer.cpp b/src/object/auto/autodestroyer.cpp
index b40c374..740f600 100644
--- a/src/object/auto/autodestroyer.cpp
+++ b/src/object/auto/autodestroyer.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
@@ -15,8 +16,6 @@
// * along with this program. If not, see http://www.gnu.org/licenses/.
-#include <stdio.h>
-
#include "object/auto/autodestroyer.h"
#include "common/iman.h"
@@ -24,7 +23,8 @@
#include "ui/interface.h"
#include "ui/window.h"
-
+#include <stdio.h>
+#include <string.h>
// Object's constructor.
@@ -61,7 +61,7 @@ void CAutoDestroyer::Init()
m_time = 0.0f;
m_timeVirus = 0.0f;
- m_lastParticule = 0.0f;
+ m_lastParticle = 0.0f;
CAuto::Init();
}
@@ -72,19 +72,19 @@ void CAutoDestroyer::Init()
bool CAutoDestroyer::EventProcess(const Event &event)
{
CObject* scrap;
- CPyro* pyro;
+ Gfx::CPyro* pyro;
Math::Vector pos, speed;
Math::Point dim;
CAuto::EventProcess(event);
- if ( m_engine->RetPause() ) return true;
- if ( event.event != EVENT_FRAME ) return true;
+ if ( m_engine->GetPause() ) return true;
+ if ( event.type != EVENT_FRAME ) return true;
m_progress += event.rTime*m_speed;
m_timeVirus -= event.rTime;
- if ( m_object->RetVirusMode() ) // contaminated by a virus?
+ if ( m_object->GetVirusMode() ) // contaminated by a virus?
{
if ( m_timeVirus <= 0.0f )
{
@@ -117,7 +117,7 @@ bool CAutoDestroyer::EventProcess(const Event &event)
}
else
{
- m_sound->Play(SOUND_PSHHH2, m_object->RetPosition(0), 1.0f, 1.0f);
+ m_sound->Play(SOUND_PSHHH2, m_object->GetPosition(0), 1.0f, 1.0f);
m_phase = ADEP_DOWN;
m_progress = 0.0f;
@@ -133,10 +133,10 @@ bool CAutoDestroyer::EventProcess(const Event &event)
if ( m_progress >= 0.3f-0.05f && !m_bExplo )
{
scrap = SearchPlastic();
- if ( scrap != 0 )
+ if ( scrap != nullptr )
{
- pyro = new CPyro(m_iMan);
- pyro->Create(PT_FRAGT, scrap);
+ pyro = new Gfx::CPyro(m_iMan);
+ pyro->Create(Gfx::PT_FRAGT, scrap);
}
m_bExplo = true;
}
@@ -150,7 +150,7 @@ bool CAutoDestroyer::EventProcess(const Event &event)
else
{
m_object->SetPosition(1, Math::Vector(0.0f, -10.0f, 0.0f));
- m_sound->Play(SOUND_REPAIR, m_object->RetPosition(0));
+ m_sound->Play(SOUND_REPAIR, m_object->GetPosition(0));
m_phase = ADEP_REPAIR;
m_progress = 0.0f;
@@ -165,7 +165,7 @@ bool CAutoDestroyer::EventProcess(const Event &event)
}
else
{
- m_sound->Play(SOUND_OPEN, m_object->RetPosition(0), 1.0f, 0.8f);
+ m_sound->Play(SOUND_OPEN, m_object->GetPosition(0), 1.0f, 0.8f);
m_phase = ADEP_UP;
m_progress = 0.0f;
@@ -199,7 +199,7 @@ bool CAutoDestroyer::EventProcess(const Event &event)
bool CAutoDestroyer::CreateInterface(bool bSelect)
{
- CWindow* pw;
+ Ui::CWindow* pw;
Math::Point pos, ddim;
float ox, oy, sx, sy;
@@ -207,8 +207,8 @@ bool CAutoDestroyer::CreateInterface(bool bSelect)
if ( !bSelect ) return true;
- pw = (CWindow*)m_interface->SearchControl(EVENT_WINDOW0);
- if ( pw == 0 ) return false;
+ pw = static_cast< Ui::CWindow* >(m_interface->SearchControl(EVENT_WINDOW0));
+ if ( pw == nullptr ) return false;
ox = 3.0f/640.0f;
oy = 3.0f/480.0f;
@@ -235,23 +235,23 @@ CObject* CAutoDestroyer::SearchPlastic()
float dist;
int i;
- sPos = m_object->RetPosition(0);
+ sPos = m_object->GetPosition(0);
for ( i=0 ; i<1000000 ; i++ )
{
- pObj = (CObject*)m_iMan->SearchInstance(CLASS_OBJECT, i);
- if ( pObj == 0 ) break;
+ pObj = static_cast< CObject* >(m_iMan->SearchInstance(CLASS_OBJECT, i));
+ if ( pObj == nullptr ) break;
- type = pObj->RetType();
+ type = pObj->GetType();
if ( type != OBJECT_SCRAP4 &&
type != OBJECT_SCRAP5 ) continue;
- oPos = pObj->RetPosition(0);
+ oPos = pObj->GetPosition(0);
dist = Math::Distance(oPos, sPos);
if ( dist <= 5.0f ) return pObj;
}
- return 0;
+ return nullptr;
}
// Seeks if one vehicle is too close.
@@ -264,14 +264,14 @@ bool CAutoDestroyer::SearchVehicle()
float oRadius, dist;
int i;
- cPos = m_object->RetPosition(0);
+ cPos = m_object->GetPosition(0);
for ( i=0 ; i<1000000 ; i++ )
{
- pObj = (CObject*)m_iMan->SearchInstance(CLASS_OBJECT, i);
- if ( pObj == 0 ) break;
+ pObj = static_cast< CObject* >(m_iMan->SearchInstance(CLASS_OBJECT, i));
+ if ( pObj == nullptr ) break;
- type = pObj->RetType();
+ type = pObj->GetType();
if ( type != OBJECT_HUMAN &&
type != OBJECT_MOBILEfa &&
type != OBJECT_MOBILEta &&
@@ -316,11 +316,11 @@ bool CAutoDestroyer::SearchVehicle()
}
-// Returns an error due the state of the automation.
+// Geturns an error due the state of the automation.
-Error CAutoDestroyer::RetError()
+Error CAutoDestroyer::GetError()
{
- if ( m_object->RetVirusMode() )
+ if ( m_object->GetVirusMode() )
{
return ERR_BAT_VIRUS;
}
@@ -362,11 +362,11 @@ bool CAutoDestroyer::Read(char *line)
CAuto::Read(line);
- m_phase = (AutoDestroyerPhase)OpInt(line, "aPhase", ADEP_WAIT);
+ m_phase = static_cast< AutoDestroyerPhase >(OpInt(line, "aPhase", ADEP_WAIT));
m_progress = OpFloat(line, "aProgress", 0.0f);
m_speed = OpFloat(line, "aSpeed", 1.0f);
- m_lastParticule = 0.0f;
+ m_lastParticle = 0.0f;
return true;
}
diff --git a/src/object/auto/autodestroyer.h b/src/object/auto/autodestroyer.h
index 88c93ea..50858d3 100644
--- a/src/object/auto/autodestroyer.h
+++ b/src/object/auto/autodestroyer.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
@@ -43,7 +44,7 @@ public:
void Init();
bool EventProcess(const Event &event);
- Error RetError();
+ Error GetError();
bool CreateInterface(bool bSelect);
@@ -59,7 +60,7 @@ protected:
float m_progress;
float m_speed;
float m_timeVirus;
- float m_lastParticule;
+ float m_lastParticle;
bool m_bExplo;
};
diff --git a/src/object/auto/autoegg.cpp b/src/object/auto/autoegg.cpp
index 4b999a9..35a6add 100644
--- a/src/object/auto/autoegg.cpp
+++ b/src/object/auto/autoegg.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
@@ -15,15 +16,14 @@
// * along with this program. If not, see http://www.gnu.org/licenses/.
-#include <stdio.h>
-
#include "object/auto/autoegg.h"
#include "math/geometry.h"
#include "common/iman.h"
#include "script/cmdtoken.h"
-
+#include <stdio.h>
+#include <string.h>
// Object's constructor.
@@ -61,8 +61,8 @@ void CAutoEgg::DeleteObject(bool bAll)
if ( alien != 0 )
{
// Probably the intended action
- // Original code: ( alien->RetZoom(0) == 1.0f )
- if ( alien->RetZoomY(0) == 1.0f )
+ // Original code: ( alien->GetZoom(0) == 1.0f )
+ if ( alien->GetZoomY(0) == 1.0f )
{
alien->SetLock(false);
alien->SetActivity(true); // the insect is active
@@ -98,7 +98,7 @@ void CAutoEgg::Init()
m_speed = 1.0f/5.0f;
m_time = 0.0f;
- m_type = alien->RetType();
+ m_type = alien->GetType();
if ( m_type == OBJECT_ANT ||
m_type == OBJECT_SPIDER ||
@@ -164,9 +164,9 @@ bool CAutoEgg::EventProcess(const Event &event)
CAuto::EventProcess(event);
- if ( m_engine->RetPause() ) return true;
+ if ( m_engine->GetPause() ) return true;
- if ( event.event != EVENT_FRAME ) return true;
+ if ( event.type != EVENT_FRAME ) return true;
if ( m_phase == AEP_NULL ) return true;
if ( m_phase == AEP_DELAY )
@@ -175,7 +175,7 @@ bool CAutoEgg::EventProcess(const Event &event)
if ( m_progress < 1.0f ) return true;
alien = new CObject(m_iMan);
- if ( !alien->CreateInsect(m_object->RetPosition(0), m_object->RetAngleY(0), m_type) )
+ if ( !alien->CreateInsect(m_object->GetPosition(0), m_object->GetAngleY(0), m_type) )
{
delete alien;
m_phase = AEP_DELAY;
@@ -213,7 +213,7 @@ bool CAutoEgg::EventProcess(const Event &event)
Error CAutoEgg::IsEnded()
{
CObject* alien;
- CPyro* pyro;
+ Gfx::CPyro* pyro;
if ( m_phase == AEP_DELAY )
{
@@ -236,8 +236,8 @@ Error CAutoEgg::IsEnded()
{
if ( m_progress < 1.0f ) return ERR_CONTINUE;
- pyro = new CPyro(m_iMan);
- pyro->Create(PT_EGG, m_object); // exploding egg
+ pyro = new Gfx::CPyro(m_iMan);
+ pyro->Create(Gfx::PT_EGG, m_object); // exploding egg
alien->SetZoom(0, 1.0f); // this is a big boy now
@@ -258,9 +258,9 @@ Error CAutoEgg::IsEnded()
}
-// Returns an error due the state of the automation.
+// Geturns an error due the state of the automation.
-Error CAutoEgg::RetError()
+Error CAutoEgg::GetError()
{
return ERR_OK;
}
@@ -277,23 +277,23 @@ CObject* CAutoEgg::SearchAlien()
float dist, min;
int i;
- cPos = m_object->RetPosition(0);
+ cPos = m_object->GetPosition(0);
min = 100000.0f;
pBest = 0;
for ( i=0 ; i<1000000 ; i++ )
{
- pObj = (CObject*)m_iMan->SearchInstance(CLASS_OBJECT, i);
+ pObj = static_cast< CObject* >(m_iMan->SearchInstance(CLASS_OBJECT, i));
if ( pObj == 0 ) break;
- if ( pObj->RetTruck() != 0 ) continue;
+ if ( pObj->GetTruck() != 0 ) continue;
- type = pObj->RetType();
+ type = pObj->GetType();
if ( type != OBJECT_ANT &&
type != OBJECT_BEE &&
type != OBJECT_SPIDER &&
type != OBJECT_WORM ) continue;
- oPos = pObj->RetPosition(0);
+ oPos = pObj->GetPosition(0);
dist = Math::DistanceProjected(oPos, cPos);
if ( dist < 8.0f && dist < min )
{
@@ -347,7 +347,7 @@ bool CAutoEgg::Read(char *line)
CAuto::Read(line);
- m_phase = (AutoEggPhase)OpInt(line, "aPhase", AEP_NULL);
+ m_phase = static_cast< AutoEggPhase >(OpInt(line, "aPhase", AEP_NULL));
m_progress = OpFloat(line, "aProgress", 0.0f);
m_speed = OpFloat(line, "aSpeed", 1.0f);
m_type = OpTypeObject(line, "aParamType", OBJECT_NULL);
diff --git a/src/object/auto/autoegg.h b/src/object/auto/autoegg.h
index 443dff6..fec07a6 100644
--- a/src/object/auto/autoegg.h
+++ b/src/object/auto/autoegg.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
@@ -45,7 +46,7 @@ public:
void Start(int param);
bool EventProcess(const Event &event);
Error IsEnded();
- Error RetError();
+ Error GetError();
bool SetType(ObjectType type);
bool SetValue(int rank, float value);
diff --git a/src/object/auto/autoenergy.cpp b/src/object/auto/autoenergy.cpp
index 409e282..18a21ab 100644
--- a/src/object/auto/autoenergy.cpp
+++ b/src/object/auto/autoenergy.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
@@ -15,12 +16,10 @@
// * along with this program. If not, see http://www.gnu.org/licenses/.
-#include <stdio.h>
-
#include "object/auto/autoenergy.h"
#include "common/iman.h"
-#include "old/terrain.h"
+#include "graphics/engine/terrain.h"
#include "math/geometry.h"
#include "script/cmdtoken.h"
#include "ui/interface.h"
@@ -28,6 +27,8 @@
#include "ui/window.h"
#include "ui/displaytext.h"
+#include <stdio.h>
+#include <string.h>
const float ENERGY_POWER = 0.4f; // Necessary energy for a battery
@@ -60,7 +61,7 @@ void CAutoEnergy::DeleteObject(bool bAll)
if ( m_partiSphere != -1 )
{
- m_particule->DeleteParticule(m_partiSphere);
+ m_particle->DeleteParticle(m_partiSphere);
m_partiSphere = -1;
}
@@ -92,7 +93,7 @@ void CAutoEnergy::Init()
m_time = 0.0f;
m_timeVirus = 0.0f;
m_lastUpdateTime = 0.0f;
- m_lastParticule = 0.0f;
+ m_lastParticle = 0.0f;
m_phase = AENP_WAIT; // waiting ...
m_progress = 0.0f;
@@ -109,35 +110,35 @@ bool CAutoEnergy::EventProcess(const Event &event)
CObject* fret;
Math::Vector pos, ppos, speed;
Math::Point dim, c, p;
- TerrainRes res;
+ Gfx::TerrainRes res;
float big;
bool bGO;
CAuto::EventProcess(event);
- if ( m_engine->RetPause() ) return true;
- if ( event.event != EVENT_FRAME ) return true;
+ if ( m_engine->GetPause() ) return true;
+ if ( event.type != EVENT_FRAME ) return true;
m_progress += event.rTime*m_speed;
m_timeVirus -= event.rTime;
- if ( m_object->RetVirusMode() ) // contaminated by a virus?
+ if ( m_object->GetVirusMode() ) // contaminated by a virus?
{
if ( m_timeVirus <= 0.0f )
{
m_timeVirus = 0.1f+Math::Rand()*0.3f;
- if ( m_lastParticule+m_engine->ParticuleAdapt(0.05f) <= m_time )
+ if ( m_lastParticle+m_engine->ParticleAdapt(0.05f) <= m_time )
{
- m_lastParticule = m_time;
- pos = m_object->RetPosition(0);
+ m_lastParticle = m_time;
+ pos = m_object->GetPosition(0);
pos.y += 10.0f;
speed.x = (Math::Rand()-0.5f)*10.0f;
speed.z = (Math::Rand()-0.5f)*10.0f;
speed.y = -7.0f;
dim.x = Math::Rand()*0.5f+0.5f;
dim.y = dim.x;
- m_particule->CreateParticule(pos, speed, dim, PARTIFIREZ, 1.0f, 0.0f, 0.0f);
+ m_particle->CreateParticle(pos, speed, dim, Gfx::PARTIFIREZ, 1.0f, 0.0f, 0.0f);
}
}
return true;
@@ -146,10 +147,10 @@ bool CAutoEnergy::EventProcess(const Event &event)
UpdateInterface(event.rTime);
EventProgress(event.rTime);
- big = m_object->RetEnergy();
+ big = m_object->GetEnergy();
- res = m_terrain->RetResource(m_object->RetPosition(0));
- if ( res == TR_POWER )
+ res = m_terrain->GetResource(m_object->GetPosition(0));
+ if ( res == Gfx::TR_POWER )
{
big += event.rTime*0.01f; // recharges the big pile
}
@@ -162,7 +163,7 @@ bool CAutoEnergy::EventProcess(const Event &event)
fret = SearchMetal(); // transform metal?
if ( fret != 0 )
{
- if ( fret->RetType() == OBJECT_METAL )
+ if ( fret->GetType() == OBJECT_METAL )
{
if ( big > ENERGY_POWER ) bGO = true;
}
@@ -174,7 +175,7 @@ bool CAutoEnergy::EventProcess(const Event &event)
if ( bGO )
{
- if ( fret->RetType() == OBJECT_METAL )
+ if ( fret->GetType() == OBJECT_METAL )
{
fret->SetLock(true); // usable metal
CreatePower(); // creates the battery
@@ -184,12 +185,12 @@ bool CAutoEnergy::EventProcess(const Event &event)
InitProgressTotal(ENERGY_DELAY);
CAuto::UpdateInterface();
- pos = m_object->RetPosition(0);
+ pos = m_object->GetPosition(0);
pos.y += 4.0f;
speed = Math::Vector(0.0f, 0.0f, 0.0f);
dim.x = 3.0f;
dim.y = dim.x;
- m_partiSphere = m_particule->CreateParticule(pos, speed, dim, PARTISPHERE1, ENERGY_DELAY, 0.0f, 0.0f);
+ m_partiSphere = m_particle->CreateParticle(pos, speed, dim, Gfx::PARTISPHERE1, ENERGY_DELAY, 0.0f, 0.0f);
m_phase = AENP_CREATE;
m_progress = 0.0f;
@@ -217,17 +218,17 @@ bool CAutoEnergy::EventProcess(const Event &event)
{
if ( m_progress < 1.0f && big > 0.01f )
{
- if ( m_lastParticule+m_engine->ParticuleAdapt(0.05f) <= m_time )
+ if ( m_lastParticle+m_engine->ParticleAdapt(0.05f) <= m_time )
{
- m_lastParticule = m_time;
- pos = m_object->RetPosition(0);
+ m_lastParticle = m_time;
+ pos = m_object->GetPosition(0);
pos.y += 10.0f;
speed.x = (Math::Rand()-0.5f)*1.0f;
speed.z = (Math::Rand()-0.5f)*1.0f;
speed.y = -7.0f;
dim.x = Math::Rand()*0.5f+0.5f;
dim.y = dim.x;
- m_particule->CreateParticule(pos, speed, dim, PARTIFIREZ, 1.0f, 0.0f, 0.0f);
+ m_particle->CreateParticle(pos, speed, dim, Gfx::PARTIFIREZ, 1.0f, 0.0f, 0.0f);
}
}
else
@@ -245,7 +246,7 @@ bool CAutoEnergy::EventProcess(const Event &event)
fret = SearchMetal();
if ( fret != 0 )
{
- if ( fret->RetType() == OBJECT_METAL )
+ if ( fret->GetType() == OBJECT_METAL )
{
big -= event.rTime/ENERGY_DELAY*ENERGY_POWER;
}
@@ -262,11 +263,11 @@ bool CAutoEnergy::EventProcess(const Event &event)
fret->SetZoom(0, m_progress);
}
- if ( m_lastParticule+m_engine->ParticuleAdapt(0.10f) <= m_time )
+ if ( m_lastParticle+m_engine->ParticleAdapt(0.10f) <= m_time )
{
- m_lastParticule = m_time;
+ m_lastParticle = m_time;
- pos = m_object->RetPosition(0);
+ pos = m_object->GetPosition(0);
c.x = pos.x;
c.y = pos.z;
p.x = c.x;
@@ -278,27 +279,27 @@ bool CAutoEnergy::EventProcess(const Event &event)
speed = Math::Vector(0.0f, 0.0f, 0.0f);
dim.x = Math::Rand()*2.0f+1.0f;
dim.y = dim.x;
- m_particule->CreateParticule(pos, speed, dim, PARTIGLINT, 1.0f, 0.0f, 0.0f);
+ m_particle->CreateParticle(pos, speed, dim, Gfx::PARTIGLINT, 1.0f, 0.0f, 0.0f);
- pos = m_object->RetPosition(0);
+ pos = m_object->GetPosition(0);
pos.y += 3.0f;
speed.x = (Math::Rand()-0.5f)*30.0f;
speed.z = (Math::Rand()-0.5f)*30.0f;
speed.y = Math::Rand()*20.0f+10.0f;
dim.x = Math::Rand()*0.4f+0.4f;
dim.y = dim.x;
- m_particule->CreateTrack(pos, speed, dim, PARTITRACK2, 2.0f, 50.0f, 1.2f, 1.2f);
+ m_particle->CreateTrack(pos, speed, dim, Gfx::PARTITRACK2, 2.0f, 50.0f, 1.2f, 1.2f);
- pos = m_object->RetPosition(0);
+ pos = m_object->GetPosition(0);
pos.y += 10.0f;
speed.x = (Math::Rand()-0.5f)*1.5f;
speed.z = (Math::Rand()-0.5f)*1.5f;
speed.y = -6.0f;
dim.x = Math::Rand()*1.0f+1.0f;
dim.y = dim.x;
- m_particule->CreateParticule(pos, speed, dim, PARTIFIREZ, 1.0f, 0.0f, 0.0f);
+ m_particle->CreateParticle(pos, speed, dim, Gfx::PARTIFIREZ, 1.0f, 0.0f, 0.0f);
- m_sound->Play(SOUND_ENERGY, m_object->RetPosition(0),
+ m_sound->Play(SOUND_ENERGY, m_object->GetPosition(0),
1.0f, 1.0f+Math::Rand()*1.5f);
}
}
@@ -337,11 +338,11 @@ bool CAutoEnergy::EventProcess(const Event &event)
{
if ( m_progress < 1.0f )
{
- if ( m_lastParticule+m_engine->ParticuleAdapt(0.05f) <= m_time )
+ if ( m_lastParticle+m_engine->ParticleAdapt(0.05f) <= m_time )
{
- m_lastParticule = m_time;
+ m_lastParticle = m_time;
- pos = m_object->RetPosition(0);
+ pos = m_object->GetPosition(0);
pos.y += 17.0f;
pos.x += (Math::Rand()-0.5f)*3.0f;
pos.z += (Math::Rand()-0.5f)*3.0f;
@@ -350,7 +351,7 @@ bool CAutoEnergy::EventProcess(const Event &event)
speed.y = 6.0f+Math::Rand()*6.0f;
dim.x = Math::Rand()*1.5f+1.0f;
dim.y = dim.x;
- m_particule->CreateParticule(pos, speed, dim, PARTISMOKE3, 4.0f);
+ m_particle->CreateParticle(pos, speed, dim, Gfx::PARTISMOKE3, 4.0f);
}
}
else
@@ -376,10 +377,10 @@ CObject* CAutoEnergy::SearchMetal()
CObject* pObj;
ObjectType type;
- pObj = m_object->RetPower();
+ pObj = m_object->GetPower();
if ( pObj == 0 ) return 0;
- type = pObj->RetType();
+ type = pObj->GetType();
if ( type == OBJECT_METAL ||
type == OBJECT_SCRAP1 ||
type == OBJECT_SCRAP2 ||
@@ -398,14 +399,14 @@ bool CAutoEnergy::SearchVehicle()
float oRadius, dist;
int i;
- cPos = m_object->RetPosition(0);
+ cPos = m_object->GetPosition(0);
for ( i=0 ; i<1000000 ; i++ )
{
- pObj = (CObject*)m_iMan->SearchInstance(CLASS_OBJECT, i);
+ pObj = static_cast< CObject* >(m_iMan->SearchInstance(CLASS_OBJECT, i));
if ( pObj == 0 ) break;
- type = pObj->RetType();
+ type = pObj->GetType();
if ( type != OBJECT_HUMAN &&
type != OBJECT_MOBILEfa &&
type != OBJECT_MOBILEta &&
@@ -457,8 +458,8 @@ void CAutoEnergy::CreatePower()
Math::Vector pos;
float angle;
- pos = m_object->RetPosition(0);
- angle = m_object->RetAngleY(0);
+ pos = m_object->GetPosition(0);
+ angle = m_object->GetAngleY(0);
power = new CObject(m_iMan);
if ( !power->CreateResource(pos, angle, OBJECT_POWER) )
@@ -469,7 +470,7 @@ void CAutoEnergy::CreatePower()
}
power->SetLock(true); // battery not yet usable
- pos = power->RetPosition(0);
+ pos = power->GetPosition(0);
pos.y += 3.0f;
power->SetPosition(0, pos);
}
@@ -483,19 +484,19 @@ CObject* CAutoEnergy::SearchPower()
ObjectType type;
int i;
- cPos = m_object->RetPosition(0);
+ cPos = m_object->GetPosition(0);
for ( i=0 ; i<1000000 ; i++ )
{
- pObj = (CObject*)m_iMan->SearchInstance(CLASS_OBJECT, i);
+ pObj = static_cast< CObject* >(m_iMan->SearchInstance(CLASS_OBJECT, i));
if ( pObj == 0 ) break;
- if ( !pObj->RetLock() ) continue;
+ if ( !pObj->GetLock() ) continue;
- type = pObj->RetType();
+ type = pObj->GetType();
if ( type != OBJECT_POWER ) continue;
- oPos = pObj->RetPosition(0);
+ oPos = pObj->GetPosition(0);
if ( oPos.x == cPos.x &&
oPos.z == cPos.z )
{
@@ -507,15 +508,15 @@ CObject* CAutoEnergy::SearchPower()
}
-// Returns an error due the state of the automation.
+// Geturns an error due the state of the automation.
-Error CAutoEnergy::RetError()
+Error CAutoEnergy::GetError()
{
CObject* pObj;
ObjectType type;
- TerrainRes res;
+ Gfx::TerrainRes res;
- if ( m_object->RetVirusMode() )
+ if ( m_object->GetVirusMode() )
{
return ERR_BAT_VIRUS;
}
@@ -523,14 +524,14 @@ Error CAutoEnergy::RetError()
if ( m_phase != AENP_WAIT &&
m_phase != AENP_BLITZ ) return ERR_OK;
- res = m_terrain->RetResource(m_object->RetPosition(0));
- if ( res != TR_POWER ) return ERR_ENERGY_NULL;
+ res = m_terrain->GetResource(m_object->GetPosition(0));
+ if ( res != Gfx::TR_POWER ) return ERR_ENERGY_NULL;
- if ( m_object->RetEnergy() < ENERGY_POWER ) return ERR_ENERGY_LOW;
+ if ( m_object->GetEnergy() < ENERGY_POWER ) return ERR_ENERGY_LOW;
- pObj = m_object->RetPower();
+ pObj = m_object->GetPower();
if ( pObj == 0 ) return ERR_ENERGY_EMPTY;
- type = pObj->RetType();
+ type = pObj->GetType();
if ( type == OBJECT_POWER ) return ERR_OK;
if ( type != OBJECT_METAL &&
type != OBJECT_SCRAP1 &&
@@ -545,7 +546,7 @@ Error CAutoEnergy::RetError()
bool CAutoEnergy::CreateInterface(bool bSelect)
{
- CWindow* pw;
+ Ui::CWindow* pw;
Math::Point pos, ddim;
float ox, oy, sx, sy;
@@ -553,7 +554,7 @@ bool CAutoEnergy::CreateInterface(bool bSelect)
if ( !bSelect ) return true;
- pw = (CWindow*)m_interface->SearchControl(EVENT_WINDOW0);
+ pw = static_cast< Ui::CWindow* >(m_interface->SearchControl(EVENT_WINDOW0));
if ( pw == 0 ) return false;
ox = 3.0f/640.0f;
@@ -581,23 +582,23 @@ bool CAutoEnergy::CreateInterface(bool bSelect)
void CAutoEnergy::UpdateInterface(float rTime)
{
- CWindow* pw;
- CGauge* pg;
+ Ui::CWindow* pw;
+ Ui::CGauge* pg;
CAuto::UpdateInterface(rTime);
if ( m_time < m_lastUpdateTime+0.1f ) return;
m_lastUpdateTime = m_time;
- if ( !m_object->RetSelect() ) return;
+ if ( !m_object->GetSelect() ) return;
- pw = (CWindow*)m_interface->SearchControl(EVENT_WINDOW0);
+ pw = static_cast< Ui::CWindow* >(m_interface->SearchControl(EVENT_WINDOW0));
if ( pw == 0 ) return;
- pg = (CGauge*)pw->SearchControl(EVENT_OBJECT_GENERGY);
+ pg = static_cast< Ui::CGauge* >(pw->SearchControl(EVENT_OBJECT_GENERGY));
if ( pg != 0 )
{
- pg->SetLevel(m_object->RetEnergy());
+ pg->SetLevel(m_object->GetEnergy());
}
}
@@ -636,12 +637,12 @@ bool CAutoEnergy::Read(char *line)
CAuto::Read(line);
- m_phase = (AutoEnergyPhase)OpInt(line, "aPhase", AENP_WAIT);
+ m_phase = static_cast< AutoEnergyPhase >(OpInt(line, "aPhase", AENP_WAIT));
m_progress = OpFloat(line, "aProgress", 0.0f);
m_speed = OpFloat(line, "aSpeed", 1.0f);
m_lastUpdateTime = 0.0f;
- m_lastParticule = 0.0f;
+ m_lastParticle = 0.0f;
return true;
}
diff --git a/src/object/auto/autoenergy.h b/src/object/auto/autoenergy.h
index 727f2c3..53d47b6 100644
--- a/src/object/auto/autoenergy.h
+++ b/src/object/auto/autoenergy.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
@@ -44,7 +45,7 @@ public:
void Init();
bool EventProcess(const Event &event);
- Error RetError();
+ Error GetError();
bool CreateInterface(bool bSelect);
@@ -65,7 +66,7 @@ protected:
float m_speed;
float m_timeVirus;
float m_lastUpdateTime;
- float m_lastParticule;
+ float m_lastParticle;
int m_partiSphere;
};
diff --git a/src/object/auto/autofactory.cpp b/src/object/auto/autofactory.cpp
index f02195c..0789443 100644
--- a/src/object/auto/autofactory.cpp
+++ b/src/object/auto/autofactory.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
@@ -15,8 +16,6 @@
// * along with this program. If not, see http://www.gnu.org/licenses/.
-#include <stdio.h>
-
#include "object/auto/autofactory.h"
#include "common/global.h"
@@ -29,7 +28,8 @@
#include "ui/window.h"
#include "ui/displaytext.h"
-
+#include <stdio.h>
+#include <string.h>
@@ -95,9 +95,9 @@ void CAutoFactory::Init()
m_speed = 1.0f/2.0f;
m_time = 0.0f;
- m_lastParticule = 0.0f;
+ m_lastParticle = 0.0f;
- m_fretPos = m_object->RetPosition(0);
+ m_fretPos = m_object->GetPosition(0);
CAuto::Init();
}
@@ -119,37 +119,37 @@ bool CAutoFactory::EventProcess(const Event &event)
CAuto::EventProcess(event);
- if ( m_engine->RetPause() ) return true;
+ if ( m_engine->GetPause() ) return true;
- if ( m_object->RetSelect() ) // factory selected?
+ if ( m_object->GetSelect() ) // factory selected?
{
- if ( event.event == EVENT_UPDINTERFACE )
+ if ( event.type == EVENT_UPDINTERFACE )
{
CreateInterface(true);
}
type = OBJECT_NULL;
- if ( event.event == EVENT_OBJECT_FACTORYwa ) type = OBJECT_MOBILEwa;
- if ( event.event == EVENT_OBJECT_FACTORYta ) type = OBJECT_MOBILEta;
- if ( event.event == EVENT_OBJECT_FACTORYfa ) type = OBJECT_MOBILEfa;
- if ( event.event == EVENT_OBJECT_FACTORYia ) type = OBJECT_MOBILEia;
- if ( event.event == EVENT_OBJECT_FACTORYws ) type = OBJECT_MOBILEws;
- if ( event.event == EVENT_OBJECT_FACTORYts ) type = OBJECT_MOBILEts;
- if ( event.event == EVENT_OBJECT_FACTORYfs ) type = OBJECT_MOBILEfs;
- if ( event.event == EVENT_OBJECT_FACTORYis ) type = OBJECT_MOBILEis;
- if ( event.event == EVENT_OBJECT_FACTORYwc ) type = OBJECT_MOBILEwc;
- if ( event.event == EVENT_OBJECT_FACTORYtc ) type = OBJECT_MOBILEtc;
- if ( event.event == EVENT_OBJECT_FACTORYfc ) type = OBJECT_MOBILEfc;
- if ( event.event == EVENT_OBJECT_FACTORYic ) type = OBJECT_MOBILEic;
- if ( event.event == EVENT_OBJECT_FACTORYwi ) type = OBJECT_MOBILEwi;
- if ( event.event == EVENT_OBJECT_FACTORYti ) type = OBJECT_MOBILEti;
- if ( event.event == EVENT_OBJECT_FACTORYfi ) type = OBJECT_MOBILEfi;
- if ( event.event == EVENT_OBJECT_FACTORYii ) type = OBJECT_MOBILEii;
- if ( event.event == EVENT_OBJECT_FACTORYrt ) type = OBJECT_MOBILErt;
- if ( event.event == EVENT_OBJECT_FACTORYrc ) type = OBJECT_MOBILErc;
- if ( event.event == EVENT_OBJECT_FACTORYrr ) type = OBJECT_MOBILErr;
- if ( event.event == EVENT_OBJECT_FACTORYrs ) type = OBJECT_MOBILErs;
- if ( event.event == EVENT_OBJECT_FACTORYsa ) type = OBJECT_MOBILEsa;
+ if ( event.type == EVENT_OBJECT_FACTORYwa ) type = OBJECT_MOBILEwa;
+ if ( event.type == EVENT_OBJECT_FACTORYta ) type = OBJECT_MOBILEta;
+ if ( event.type == EVENT_OBJECT_FACTORYfa ) type = OBJECT_MOBILEfa;
+ if ( event.type == EVENT_OBJECT_FACTORYia ) type = OBJECT_MOBILEia;
+ if ( event.type == EVENT_OBJECT_FACTORYws ) type = OBJECT_MOBILEws;
+ if ( event.type == EVENT_OBJECT_FACTORYts ) type = OBJECT_MOBILEts;
+ if ( event.type == EVENT_OBJECT_FACTORYfs ) type = OBJECT_MOBILEfs;
+ if ( event.type == EVENT_OBJECT_FACTORYis ) type = OBJECT_MOBILEis;
+ if ( event.type == EVENT_OBJECT_FACTORYwc ) type = OBJECT_MOBILEwc;
+ if ( event.type == EVENT_OBJECT_FACTORYtc ) type = OBJECT_MOBILEtc;
+ if ( event.type == EVENT_OBJECT_FACTORYfc ) type = OBJECT_MOBILEfc;
+ if ( event.type == EVENT_OBJECT_FACTORYic ) type = OBJECT_MOBILEic;
+ if ( event.type == EVENT_OBJECT_FACTORYwi ) type = OBJECT_MOBILEwi;
+ if ( event.type == EVENT_OBJECT_FACTORYti ) type = OBJECT_MOBILEti;
+ if ( event.type == EVENT_OBJECT_FACTORYfi ) type = OBJECT_MOBILEfi;
+ if ( event.type == EVENT_OBJECT_FACTORYii ) type = OBJECT_MOBILEii;
+ if ( event.type == EVENT_OBJECT_FACTORYrt ) type = OBJECT_MOBILErt;
+ if ( event.type == EVENT_OBJECT_FACTORYrc ) type = OBJECT_MOBILErc;
+ if ( event.type == EVENT_OBJECT_FACTORYrr ) type = OBJECT_MOBILErr;
+ if ( event.type == EVENT_OBJECT_FACTORYrs ) type = OBJECT_MOBILErs;
+ if ( event.type == EVENT_OBJECT_FACTORYsa ) type = OBJECT_MOBILEsa;
if ( type != OBJECT_NULL )
{
@@ -186,7 +186,7 @@ bool CAutoFactory::EventProcess(const Event &event)
}
}
- if ( event.event != EVENT_FRAME ) return true;
+ if ( event.type != EVENT_FRAME ) return true;
m_progress += event.rTime*m_speed;
EventProgress(event.rTime);
@@ -249,7 +249,7 @@ bool CAutoFactory::EventProcess(const Event &event)
m_object->SetAngleZ(10+i, 0.0f);
}
- m_channelSound = m_sound->Play(SOUND_FACTORY, m_object->RetPosition(0), 0.0f, 1.0f, true);
+ m_channelSound = m_sound->Play(SOUND_FACTORY, m_object->GetPosition(0), 0.0f, 1.0f, true);
m_sound->AddEnvelope(m_channelSound, 1.0f, 1.0f, 2.0f, SOPER_CONTINUE);
m_sound->AddEnvelope(m_channelSound, 1.0f, 1.0f, 11.0f, SOPER_CONTINUE);
m_sound->AddEnvelope(m_channelSound, 0.0f, 1.0f, 2.0f, SOPER_STOP);
@@ -300,7 +300,7 @@ bool CAutoFactory::EventProcess(const Event &event)
{
prog = 1.0f-m_progress;
}
- angle = powf(prog*10.0f, 2.0f)+m_object->RetAngleY(0);
+ angle = powf(prog*10.0f, 2.0f)+m_object->GetAngleY(0);
vehicle = SearchVehicle();
if ( vehicle != 0 )
@@ -315,9 +315,9 @@ bool CAutoFactory::EventProcess(const Event &event)
fret->SetZoom(0, 1.0f-m_progress);
}
- if ( m_lastParticule+m_engine->ParticuleAdapt(0.05f) <= m_time )
+ if ( m_lastParticle+m_engine->ParticleAdapt(0.05f) <= m_time )
{
- m_lastParticule = m_time;
+ m_lastParticle = m_time;
#if 0
pos = m_fretPos;
@@ -329,9 +329,9 @@ bool CAutoFactory::EventProcess(const Event &event)
speed.y = Math::Rand()*12.0f;
dim.x = Math::Rand()*12.0f+10.0f;
dim.y = dim.x;
- m_particule->CreateParticule(pos, speed, dim, PARTIBLUE, 1.0f, 0.0f, 0.0f);
+ m_particle->CreateParticle(pos, speed, dim, PARTIBLUE, 1.0f, 0.0f, 0.0f);
#else
- mat = m_object->RetWorldMatrix(0);
+ mat = m_object->GetWorldMatrix(0);
pos = Math::Vector(-12.0f, 20.0f, -4.0f); // position of chimney
pos = Math::Transform(*mat, pos);
pos.y += 2.0f;
@@ -342,7 +342,7 @@ bool CAutoFactory::EventProcess(const Event &event)
speed.y = 6.0f+Math::Rand()*6.0f;
dim.x = Math::Rand()*1.5f+1.0f;
dim.y = dim.x;
- m_particule->CreateParticule(pos, speed, dim, PARTISMOKE3, 4.0f);
+ m_particle->CreateParticle(pos, speed, dim, Gfx::PARTISMOKE3, 4.0f);
#endif
}
}
@@ -361,15 +361,15 @@ bool CAutoFactory::EventProcess(const Event &event)
vehicle = SearchVehicle();
if ( vehicle != 0 )
{
- physics = vehicle->RetPhysics();
+ physics = vehicle->GetPhysics();
if ( physics != 0 )
{
physics->SetFreeze(false); // can move
}
vehicle->SetLock(false); // vehicle useable
-//? vehicle->RetPhysics()->RetBrain()->StartTaskAdvance(16.0f);
- vehicle->SetAngleY(0, m_object->RetAngleY(0)+Math::PI);
+//? vehicle->GetPhysics()->GetBrain()->StartTaskAdvance(16.0f);
+ vehicle->SetAngleY(0, m_object->GetAngleY(0)+Math::PI);
vehicle->SetZoom(0, 1.0f);
}
@@ -392,9 +392,9 @@ bool CAutoFactory::EventProcess(const Event &event)
m_object->SetAngleZ(10+i, -angle);
}
- if ( m_lastParticule+m_engine->ParticuleAdapt(0.1f) <= m_time )
+ if ( m_lastParticle+m_engine->ParticleAdapt(0.1f) <= m_time )
{
- m_lastParticule = m_time;
+ m_lastParticle = m_time;
pos = m_fretPos;
pos.x += (Math::Rand()-0.5f)*10.0f;
@@ -403,7 +403,7 @@ bool CAutoFactory::EventProcess(const Event &event)
speed = Math::Vector(0.0f, 0.0f, 0.0f);
dim.x = 2.0f;
dim.y = dim.x;
- m_particule->CreateParticule(pos, speed, dim, PARTIGLINT, 2.0f, 0.0f, 0.0f);
+ m_particle->CreateParticle(pos, speed, dim, Gfx::PARTIGLINT, 2.0f, 0.0f, 0.0f);
}
}
else
@@ -435,9 +435,9 @@ bool CAutoFactory::EventProcess(const Event &event)
m_object->SetZoomZ(10+i, zoom);
}
- if ( m_lastParticule+m_engine->ParticuleAdapt(0.1f) <= m_time )
+ if ( m_lastParticle+m_engine->ParticleAdapt(0.1f) <= m_time )
{
- m_lastParticule = m_time;
+ m_lastParticle = m_time;
pos = m_fretPos;
pos.x += (Math::Rand()-0.5f)*10.0f;
@@ -446,7 +446,7 @@ bool CAutoFactory::EventProcess(const Event &event)
speed = Math::Vector(0.0f, 0.0f, 0.0f);
dim.x = 2.0f;
dim.y = dim.x;
- m_particule->CreateParticule(pos, speed, dim, PARTIGLINT, 2.0f, 0.0f, 0.0f);
+ m_particle->CreateParticle(pos, speed, dim, Gfx::PARTIGLINT, 2.0f, 0.0f, 0.0f);
}
}
else
@@ -503,12 +503,12 @@ bool CAutoFactory::Read(char *line)
CAuto::Read(line);
- m_phase = (AutoFactoryPhase)OpInt(line, "aPhase", AFP_WAIT);
+ m_phase = static_cast< AutoFactoryPhase >(OpInt(line, "aPhase", AFP_WAIT));
m_progress = OpFloat(line, "aProgress", 0.0f);
m_speed = OpFloat(line, "aSpeed", 1.0f);
- m_lastParticule = 0.0f;
- m_fretPos = m_object->RetPosition(0);
+ m_lastParticle = 0.0f;
+ m_fretPos = m_object->GetPosition(0);
return true;
}
@@ -526,14 +526,14 @@ CObject* CAutoFactory::SearchFret()
for ( i=0 ; i<1000000 ; i++ )
{
- pObj = (CObject*)m_iMan->SearchInstance(CLASS_OBJECT, i);
+ pObj = static_cast< CObject* >(m_iMan->SearchInstance(CLASS_OBJECT, i));
if ( pObj == 0 ) break;
- type = pObj->RetType();
+ type = pObj->GetType();
if ( type != OBJECT_METAL ) continue;
- if ( pObj->RetTruck() != 0 ) continue;
+ if ( pObj->GetTruck() != 0 ) continue;
- oPos = pObj->RetPosition(0);
+ oPos = pObj->GetPosition(0);
dist = Math::Distance(oPos, m_fretPos);
if ( dist < 8.0f ) return pObj;
@@ -552,14 +552,14 @@ bool CAutoFactory::NearestVehicle()
float oRadius, dist;
int i;
- cPos = m_object->RetPosition(0);
+ cPos = m_object->GetPosition(0);
for ( i=0 ; i<1000000 ; i++ )
{
- pObj = (CObject*)m_iMan->SearchInstance(CLASS_OBJECT, i);
+ pObj = static_cast< CObject* >(m_iMan->SearchInstance(CLASS_OBJECT, i));
if ( pObj == 0 ) break;
- type = pObj->RetType();
+ type = pObj->GetType();
if ( type != OBJECT_HUMAN &&
type != OBJECT_MOBILEfa &&
type != OBJECT_MOBILEta &&
@@ -616,9 +616,9 @@ bool CAutoFactory::CreateVehicle()
char* name;
int i;
- angle = m_object->RetAngleY(0);
+ angle = m_object->GetAngleY(0);
- mat = m_object->RetWorldMatrix(0);
+ mat = m_object->GetWorldMatrix(0);
if ( m_type == OBJECT_MOBILErt ||
m_type == OBJECT_MOBILErc ||
m_type == OBJECT_MOBILErr ||
@@ -643,7 +643,7 @@ bool CAutoFactory::CreateVehicle()
vehicle->SetLock(true); // not usable
vehicle->SetRange(30.0f);
- physics = vehicle->RetPhysics();
+ physics = vehicle->GetPhysics();
if ( physics != 0 )
{
physics->SetFreeze(true); // it doesn't move
@@ -651,7 +651,7 @@ bool CAutoFactory::CreateVehicle()
for ( i=0 ; i<10 ; i++ )
{
- name = m_main->RetNewScriptName(m_type, i);
+ name = m_main->GetNewScriptName(m_type, i);
if ( name == 0 ) break;
vehicle->ReadProgram(i, name);
}
@@ -671,16 +671,16 @@ CObject* CAutoFactory::SearchVehicle()
for ( i=0 ; i<1000000 ; i++ )
{
- pObj = (CObject*)m_iMan->SearchInstance(CLASS_OBJECT, i);
+ pObj = static_cast< CObject* >(m_iMan->SearchInstance(CLASS_OBJECT, i));
if ( pObj == 0 ) break;
- if ( !pObj->RetLock() ) continue;
+ if ( !pObj->GetLock() ) continue;
- type = pObj->RetType();
+ type = pObj->GetType();
if ( type != m_type ) continue;
- if ( pObj->RetTruck() != 0 ) continue;
+ if ( pObj->GetTruck() != 0 ) continue;
- oPos = pObj->RetPosition(0);
+ oPos = pObj->GetPosition(0);
dist = Math::Distance(oPos, m_fretPos);
if ( dist < 8.0f ) return pObj;
@@ -694,7 +694,7 @@ CObject* CAutoFactory::SearchVehicle()
bool CAutoFactory::CreateInterface(bool bSelect)
{
- CWindow* pw;
+ Ui::CWindow* pw;
Math::Point pos, dim, ddim;
float ox, oy, sx, sy;
@@ -702,8 +702,8 @@ bool CAutoFactory::CreateInterface(bool bSelect)
if ( !bSelect ) return true;
- pw = (CWindow*)m_interface->SearchControl(EVENT_WINDOW0);
- if ( pw == 0 ) return false;
+ pw = static_cast< Ui::CWindow* >(m_interface->SearchControl(EVENT_WINDOW0));
+ if ( pw == nullptr ) return false;
dim.x = 33.0f/640.0f;
dim.y = 33.0f/480.0f;
@@ -786,13 +786,13 @@ bool CAutoFactory::CreateInterface(bool bSelect)
void CAutoFactory::UpdateInterface()
{
- CWindow* pw;
+ Ui::CWindow* pw;
- if ( !m_object->RetSelect() ) return;
+ if ( !m_object->GetSelect() ) return;
CAuto::UpdateInterface();
- pw = (CWindow*)m_interface->SearchControl(EVENT_WINDOW0);
+ pw = static_cast< Ui::CWindow* >(m_interface->SearchControl(EVENT_WINDOW0));
UpdateButton(pw, EVENT_OBJECT_FACTORYwa, m_bBusy);
UpdateButton(pw, EVENT_OBJECT_FACTORYta, m_bBusy);
@@ -819,7 +819,7 @@ void CAutoFactory::UpdateInterface()
// Updates the status of one interface button.
-void CAutoFactory::UpdateButton(CWindow *pw, EventMsg event, bool bBusy)
+void CAutoFactory::UpdateButton(Ui::CWindow *pw, EventType event, bool bBusy)
{
bool bEnable = true;
@@ -933,7 +933,7 @@ void CAutoFactory::SoundManip(float time, float amplitude, float frequency)
{
int i;
- i = m_sound->Play(SOUND_MANIP, m_object->RetPosition(0), 0.0f, 0.3f*frequency, true);
+ i = m_sound->Play(SOUND_MANIP, m_object->GetPosition(0), 0.0f, 0.3f*frequency, true);
m_sound->AddEnvelope(i, 0.5f*amplitude, 1.0f*frequency, 0.1f, SOPER_CONTINUE);
m_sound->AddEnvelope(i, 0.5f*amplitude, 1.0f*frequency, time-0.1f, SOPER_CONTINUE);
m_sound->AddEnvelope(i, 0.0f, 0.3f*frequency, 0.1f, SOPER_STOP);
diff --git a/src/object/auto/autofactory.h b/src/object/auto/autofactory.h
index acbdf40..f62080d 100644
--- a/src/object/auto/autofactory.h
+++ b/src/object/auto/autofactory.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
@@ -54,7 +55,7 @@ public:
protected:
void UpdateInterface();
- void UpdateButton(CWindow *pw, EventMsg event, bool bBusy);
+ void UpdateButton(Ui::CWindow *pw, EventType event, bool bBusy);
CObject* SearchFret();
bool NearestVehicle();
@@ -67,7 +68,7 @@ protected:
AutoFactoryPhase m_phase;
float m_progress;
float m_speed;
- float m_lastParticule;
+ float m_lastParticle;
Math::Vector m_fretPos;
int m_channelSound;
};
diff --git a/src/object/auto/autoflag.cpp b/src/object/auto/autoflag.cpp
index ea74b17..e88ee3a 100644
--- a/src/object/auto/autoflag.cpp
+++ b/src/object/auto/autoflag.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
@@ -15,12 +16,12 @@
// * along with this program. If not, see http://www.gnu.org/licenses/.
-#include <stdio.h>
-
#include "object/auto/autoflag.h"
#include "math/geometry.h"
-#include "old/terrain.h"
+#include "graphics/engine/terrain.h"
+
+#include <stdio.h>
@@ -68,7 +69,7 @@ void CAutoFlag::Init()
m_param = 0;
m_progress = 0.0f;
- wind = m_terrain->RetWind();
+ wind = m_terrain->GetWind();
angle = Math::RotateAngle(wind.x, -wind.z);
m_object->SetAngleY(0, angle); // directs the flag in the wind
@@ -98,7 +99,7 @@ bool CAutoFlag::EventProcess(const Event &event)
CAuto::EventProcess(event);
#if ADJUST_ANGLE
- if ( event.event == EVENT_KEYDOWN )
+ if ( event.type == EVENT_KEYDOWN )
{
if ( event.param == 'E' ) g_flag1 += 0.1f;
if ( event.param == 'D' ) g_flag1 -= 0.1f;
@@ -109,8 +110,8 @@ bool CAutoFlag::EventProcess(const Event &event)
}
#endif
- if ( m_engine->RetPause() ) return true;
- if ( event.event != EVENT_FRAME ) return true;
+ if ( m_engine->GetPause() ) return true;
+ if ( event.type != EVENT_FRAME ) return true;
if ( m_param == 1 ) // shakes?
{
@@ -152,9 +153,9 @@ bool CAutoFlag::EventProcess(const Event &event)
}
-// Returns an error due the state of the automation
+// Geturns an error due the state of the automation
-Error CAutoFlag::RetError()
+Error CAutoFlag::GetError()
{
return ERR_OK;
}
diff --git a/src/object/auto/autoflag.h b/src/object/auto/autoflag.h
index fdec682..3c6cf99 100644
--- a/src/object/auto/autoflag.h
+++ b/src/object/auto/autoflag.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
@@ -34,7 +35,7 @@ public:
void Init();
void Start(int param);
bool EventProcess(const Event &event);
- Error RetError();
+ Error GetError();
protected:
diff --git a/src/object/auto/autohuston.cpp b/src/object/auto/autohuston.cpp
index a96bcb8..1e81a65 100644
--- a/src/object/auto/autohuston.cpp
+++ b/src/object/auto/autohuston.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
@@ -15,14 +16,12 @@
// * along with this program. If not, see http://www.gnu.org/licenses/.
-#include <stdio.h>
-
#include "object/auto/autohuston.h"
#include "ui/interface.h"
#include "ui/window.h"
-
+#include <stdio.h>
// Object's constructor.
@@ -38,11 +37,11 @@ CAutoHuston::CAutoHuston(CInstanceManager* iMan, CObject* object)
m_lens[i].parti = -1;
}
- pos = m_object->RetPosition(0);
- m_lens[0].type = PARTISELR;
- m_lens[1].type = PARTISELR;
- m_lens[2].type = PARTISELR;
- m_lens[3].type = PARTISELR;
+ pos = m_object->GetPosition(0);
+ m_lens[0].type = Gfx::PARTISELR;
+ m_lens[1].type = Gfx::PARTISELR;
+ m_lens[2].type = Gfx::PARTISELR;
+ m_lens[3].type = Gfx::PARTISELR;
m_lens[0].pos = pos+Math::Vector(0.0f+13.0f, 34.0f, 30.0f );
m_lens[1].pos = pos+Math::Vector(0.0f-13.0f, 34.0f, 30.0f );
m_lens[2].pos = pos+Math::Vector(0.0f , 34.0f, 30.0f+13.0f);
@@ -62,46 +61,46 @@ CAutoHuston::CAutoHuston(CInstanceManager* iMan, CObject* object)
// Part under the radar.
i = 4;
- m_lens[i].type = PARTISELR;
+ m_lens[i].type = Gfx::PARTISELR;
m_lens[i].pos = pos+Math::Vector(-7.0f, 9.9f, 40.1f);
m_lens[i].dim = 1.8f;
m_lens[i].total = 0.4f;
m_lens[i].off = 0.2f;
i ++;
- m_lens[i].type = PARTISELY;
+ m_lens[i].type = Gfx::PARTISELY;
m_lens[i].pos = pos+Math::Vector(-7.0f, 7.2f, 34.8f);
m_lens[i].dim = 0.4f;
m_lens[i].total = 0.7f;
m_lens[i].off = 0.3f;
i ++;
- m_lens[i].type = PARTISELY;
+ m_lens[i].type = Gfx::PARTISELY;
m_lens[i].pos = pos+Math::Vector(-7.0f, 6.5f, 34.3f);
m_lens[i].dim = 0.4f;
m_lens[i].total = 0.7f;
m_lens[i].off = 0.3f;
i ++;
- m_lens[i].type = PARTISELR;
+ m_lens[i].type = Gfx::PARTISELR;
m_lens[i].pos = pos+Math::Vector(-7.0f, 6.5f, 33.4f);
m_lens[i].dim = 0.4f;
m_lens[i].total = 0.0f;
m_lens[i].off = 0.0f;
i ++;
- m_lens[i].type = PARTISELR;
+ m_lens[i].type = Gfx::PARTISELR;
m_lens[i].pos = pos+Math::Vector(-7.0f, 6.5f, 33.0f);
m_lens[i].dim = 0.4f;
m_lens[i].total = 1.0f;
m_lens[i].off = 0.5f;
i ++;
- m_lens[i].type = PARTISELY;
+ m_lens[i].type = Gfx::PARTISELY;
m_lens[i].pos = pos+Math::Vector(-7.0f, 8.5f, 14.0f);
m_lens[i].dim = 1.2f;
m_lens[i].total = 0.8f;
m_lens[i].off = 0.2f;
i ++;
- m_lens[i].type = PARTISELR;
+ m_lens[i].type = Gfx::PARTISELR;
m_lens[i].pos = pos+Math::Vector(4.0f, 6.0f, 8.6f);
m_lens[i].dim = 1.0f;
m_lens[i].total = 0.9f;
@@ -109,53 +108,53 @@ CAutoHuston::CAutoHuston(CInstanceManager* iMan, CObject* object)
i ++;
// Part with three windows.
- m_lens[i].type = PARTISELR;
+ m_lens[i].type = Gfx::PARTISELR;
m_lens[i].pos = pos+Math::Vector(-7.0f, 9.9f, -19.9f);
m_lens[i].dim = 1.0f;
m_lens[i].total = 0.6f;
m_lens[i].off = 0.3f;
i ++;
- m_lens[i].type = PARTISELY;
+ m_lens[i].type = Gfx::PARTISELY;
m_lens[i].pos = pos+Math::Vector(-7.0f, 7.2f, 34.8f-60.0f);
m_lens[i].dim = 0.4f;
m_lens[i].total = 0.7f;
m_lens[i].off = 0.3f;
i ++;
- m_lens[i].type = PARTISELY;
+ m_lens[i].type = Gfx::PARTISELY;
m_lens[i].pos = pos+Math::Vector(-7.0f, 6.5f, 34.3f-60.0f);
m_lens[i].dim = 0.4f;
m_lens[i].total = 0.0f;
m_lens[i].off = 0.0f;
i ++;
- m_lens[i].type = PARTISELR;
+ m_lens[i].type = Gfx::PARTISELR;
m_lens[i].pos = pos+Math::Vector(-7.0f, 6.5f, 33.4f-60.0f);
m_lens[i].dim = 0.4f;
m_lens[i].total = 0.6f;
m_lens[i].off = 0.4f;
i ++;
- m_lens[i].type = PARTISELR;
+ m_lens[i].type = Gfx::PARTISELR;
m_lens[i].pos = pos+Math::Vector(-7.0f, 6.5f, 33.0f-60.0f);
m_lens[i].dim = 0.4f;
m_lens[i].total = 0.8f;
m_lens[i].off = 0.2f;
i ++;
- m_lens[i].type = PARTISELY;
+ m_lens[i].type = Gfx::PARTISELY;
m_lens[i].pos = pos+Math::Vector(-6.5f, 13.5f, -37.0f);
m_lens[i].dim = 1.0f;
m_lens[i].total = 0.0f;
m_lens[i].off = 0.0f;
i ++;
- m_lens[i].type = PARTISELY;
+ m_lens[i].type = Gfx::PARTISELY;
m_lens[i].pos = pos+Math::Vector(-7.0f, 12.2f, -39.8f);
m_lens[i].dim = 1.8f;
m_lens[i].total = 1.5f;
m_lens[i].off = 0.5f;
i ++;
- m_lens[i].type = PARTISELY;
+ m_lens[i].type = Gfx::PARTISELY;
m_lens[i].pos = pos+Math::Vector(-7.0f, 8.5f, -47.0f);
m_lens[i].dim = 0.6f;
m_lens[i].total = 0.7f;
@@ -211,14 +210,14 @@ bool CAutoHuston::EventProcess(const Event &event)
CAuto::EventProcess(event);
- if ( m_engine->RetPause() ) return true;
+ if ( m_engine->GetPause() ) return true;
angle = -m_time*1.0f;
m_object->SetAngleY(1, angle); // rotates the radar
angle = sinf(m_time*4.0f)*0.3f;
m_object->SetAngleX(2, angle);
- if ( event.event != EVENT_FRAME ) return true;
+ if ( event.type != EVENT_FRAME ) return true;
m_progress += event.rTime*m_speed;
@@ -231,7 +230,7 @@ bool CAutoHuston::EventProcess(const Event &event)
{
if ( m_lens[i].parti != -1 )
{
- m_particule->DeleteParticule(m_lens[i].parti);
+ m_particle->DeleteParticle(m_lens[i].parti);
m_lens[i].parti = -1;
}
}
@@ -241,7 +240,7 @@ bool CAutoHuston::EventProcess(const Event &event)
{
dim.x = m_lens[i].dim;
dim.y = dim.x;
- m_lens[i].parti = m_particule->CreateParticule(m_lens[i].pos, speed, dim, m_lens[i].type, 1.0f, 0.0f, 0.0f);
+ m_lens[i].parti = m_particle->CreateParticle(m_lens[i].pos, speed, dim, m_lens[i].type, 1.0f, 0.0f, 0.0f);
}
}
}
@@ -261,7 +260,7 @@ bool CAutoHuston::Abort()
bool CAutoHuston::CreateInterface(bool bSelect)
{
- CWindow* pw;
+ Ui::CWindow* pw;
Math::Point pos, ddim;
float ox, oy, sx, sy;
@@ -269,8 +268,8 @@ bool CAutoHuston::CreateInterface(bool bSelect)
if ( !bSelect ) return true;
- pw = (CWindow*)m_interface->SearchControl(EVENT_WINDOW0);
- if ( pw == 0 ) return false;
+ pw = static_cast< Ui::CWindow* >(m_interface->SearchControl(EVENT_WINDOW0));
+ if ( pw == nullptr ) return false;
ox = 3.0f/640.0f;
oy = 3.0f/480.0f;
@@ -287,9 +286,9 @@ bool CAutoHuston::CreateInterface(bool bSelect)
}
-// Returns an error due to state of the automation.
+// Geturns an error due to state of the automation.
-Error CAutoHuston::RetError()
+Error CAutoHuston::GetError()
{
return ERR_OK;
}
diff --git a/src/object/auto/autohuston.h b/src/object/auto/autohuston.h
index a59f8f2..27b016b 100644
--- a/src/object/auto/autohuston.h
+++ b/src/object/auto/autohuston.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
@@ -20,18 +21,18 @@
#include "object/auto/auto.h"
-#include "old/particule.h"
+#include "graphics/engine/particle.h"
struct HustonLens
{
- int parti;
- ParticuleType type;
+ int parti;
+ Gfx::ParticleType type;
Math::Vector pos;
- float dim;
- float total;
- float off;
+ float dim;
+ float total;
+ float off;
};
@@ -50,7 +51,7 @@ public:
void Start(int param);
bool EventProcess(const Event &event);
bool Abort();
- Error RetError();
+ Error GetError();
bool CreateInterface(bool bSelect);
diff --git a/src/object/auto/autoinfo.cpp b/src/object/auto/autoinfo.cpp
index 56fd8c7..78cc249 100644
--- a/src/object/auto/autoinfo.cpp
+++ b/src/object/auto/autoinfo.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
@@ -15,8 +16,6 @@
// * along with this program. If not, see http://www.gnu.org/licenses/.
-#include <stdio.h>
-
#include "object/auto/autoinfo.h"
#include "script/cmdtoken.h"
@@ -24,7 +23,8 @@
#include "ui/list.h"
#include "ui/window.h"
-
+#include <stdio.h>
+#include <string.h>
@@ -90,8 +90,8 @@ void CAutoInfo::Start(int param)
m_speed = 1.0f/2.0f;
}
- m_lastParticule = 0;
- m_goal = m_object->RetPosition(0);
+ m_lastParticle = 0;
+ m_goal = m_object->GetPosition(0);
if ( m_phase == AIP_EMETTE )
{
@@ -100,7 +100,7 @@ void CAutoInfo::Start(int param)
speed = Math::Vector(0.0f, 0.0f, 0.0f);
dim.x = 30.0f;
dim.y = dim.x;
- m_particule->CreateParticule(pos, speed, dim, PARTISPHERE4, 1.5f, 0.0f, 0.0f);
+ m_particle->CreateParticle(pos, speed, dim, Gfx::PARTISPHERE4, 1.5f, 0.0f, 0.0f);
m_sound->Play(SOUND_LABO, pos, 1.0f, 2.0f);
}
@@ -111,7 +111,7 @@ void CAutoInfo::Start(int param)
speed = Math::Vector(0.0f, 0.0f, 0.0f);
dim.x = 50.0f;
dim.y = dim.x;
- m_particule->CreateParticule(pos, speed, dim, PARTISPHERE6, 1.5f, 0.0f, 0.0f);
+ m_particle->CreateParticle(pos, speed, dim, Gfx::PARTISPHERE6, 1.5f, 0.0f, 0.0f);
m_sound->Play(SOUND_LABO, pos, 1.0f, 2.0f);
}
@@ -133,18 +133,18 @@ bool CAutoInfo::EventProcess(const Event &event)
CAuto::EventProcess(event);
- if ( m_engine->RetPause() ) return true;
- if ( event.event != EVENT_FRAME ) return true;
+ if ( m_engine->GetPause() ) return true;
+ if ( event.type != EVENT_FRAME ) return true;
m_timeVirus -= event.rTime;
- if ( m_object->RetVirusMode() ) // contaminated by a virus?
+ if ( m_object->GetVirusMode() ) // contaminated by a virus?
{
if ( m_timeVirus <= 0.0f )
{
m_timeVirus = 0.1f+Math::Rand()*0.3f;
- angle = m_object->RetAngleY(1);
+ angle = m_object->GetAngleY(1);
angle += Math::Rand()*0.3f;
m_object->SetAngleY(1, angle);
@@ -170,7 +170,7 @@ bool CAutoInfo::EventProcess(const Event &event)
}
else
{
- if ( m_object->RetInfoUpdate() )
+ if ( m_object->GetInfoUpdate() )
{
UpdateList(); // updates the list
}
@@ -184,9 +184,9 @@ bool CAutoInfo::EventProcess(const Event &event)
if ( m_phase == AIP_EMETTE ) // instruction "receive" ?
{
if ( m_progress < 0.5f &&
- m_lastParticule+m_engine->ParticuleAdapt(0.05f) <= m_time )
+ m_lastParticle+m_engine->ParticleAdapt(0.05f) <= m_time )
{
- m_lastParticule = m_time;
+ m_lastParticle = m_time;
for ( i=0 ; i<4 ; i++ )
{
@@ -199,7 +199,7 @@ bool CAutoInfo::EventProcess(const Event &event)
dim.x = 0.6f;
dim.y = dim.x;
duration = Math::Rand()*0.5f+0.5f;
- m_particule->CreateTrack(pos, speed, dim, PARTITRACK6,
+ m_particle->CreateTrack(pos, speed, dim, Gfx::PARTITRACK6,
duration, 0.0f,
duration*0.9f, 0.7f);
}
@@ -230,9 +230,9 @@ bool CAutoInfo::EventProcess(const Event &event)
if ( m_phase == AIP_RECEIVE ) // instruction "send" ?
{
if ( m_progress < 0.5f &&
- m_lastParticule+m_engine->ParticuleAdapt(0.05f) <= m_time )
+ m_lastParticle+m_engine->ParticleAdapt(0.05f) <= m_time )
{
- m_lastParticule = m_time;
+ m_lastParticle = m_time;
for ( i=0 ; i<4 ; i++ )
{
@@ -247,7 +247,7 @@ bool CAutoInfo::EventProcess(const Event &event)
dim.x = 0.6f;
dim.y = dim.x;
duration = Math::Rand()*0.5f+0.5f;
- m_particule->CreateTrack(pos, speed, dim, PARTITRACK6,
+ m_particle->CreateTrack(pos, speed, dim, Gfx::PARTITRACK6,
duration, 0.0f,
duration*0.9f, 0.7f);
}
@@ -278,9 +278,9 @@ bool CAutoInfo::EventProcess(const Event &event)
if ( m_phase == AIP_ERROR )
{
if ( m_progress < 0.5f &&
- m_lastParticule+m_engine->ParticuleAdapt(0.05f) <= m_time )
+ m_lastParticle+m_engine->ParticleAdapt(0.05f) <= m_time )
{
- m_lastParticule = m_time;
+ m_lastParticle = m_time;
pos = m_goal;
speed.x = (Math::Rand()-0.5f)*5.0f;
@@ -289,7 +289,7 @@ bool CAutoInfo::EventProcess(const Event &event)
dim.x = 5.0f+Math::Rand()*5.0f;
dim.y = dim.x;
duration = Math::Rand()*0.5f+0.5f;
- m_particule->CreateParticule(pos, speed, dim, PARTISMOKE1, 4.0f);
+ m_particle->CreateParticle(pos, speed, dim, Gfx::PARTISMOKE1, 4.0f);
}
if ( m_progress < 1.0f )
@@ -327,7 +327,7 @@ bool CAutoInfo::EventProcess(const Event &event)
}
}
- angle = m_object->RetAngleY(1);
+ angle = m_object->GetAngleY(1);
angle += rTime*0.5f;
m_object->SetAngleY(1, angle);
@@ -339,11 +339,11 @@ bool CAutoInfo::EventProcess(const Event &event)
}
-// Returns an error due the state of the automation.
+// Geturns an error due the state of the automation.
-Error CAutoInfo::RetError()
+Error CAutoInfo::GetError()
{
- if ( m_object->RetVirusMode() )
+ if ( m_object->GetVirusMode() )
{
return ERR_BAT_VIRUS;
}
@@ -356,8 +356,8 @@ Error CAutoInfo::RetError()
bool CAutoInfo::CreateInterface(bool bSelect)
{
- CWindow* pw;
- CList* pl;
+ Ui::CWindow* pw;
+ Ui::CList* pl;
Math::Point pos, ddim;
float ox, oy, sx, sy;
@@ -365,7 +365,7 @@ bool CAutoInfo::CreateInterface(bool bSelect)
if ( !bSelect ) return true;
- pw = (CWindow*)m_interface->SearchControl(EVENT_WINDOW0);
+ pw = static_cast< Ui::CWindow* >(m_interface->SearchControl(EVENT_WINDOW0));
if ( pw == 0 ) return false;
ox = 3.0f/640.0f;
@@ -403,31 +403,31 @@ void CAutoInfo::UpdateInterface(float rTime)
void CAutoInfo::UpdateList()
{
- CWindow* pw;
- CList* pl;
+ Ui::CWindow* pw;
+ Ui::CList* pl;
Info info;
int total, i;
char text[100];
- pw = (CWindow*)m_interface->SearchControl(EVENT_WINDOW0);
- if ( pw == 0 ) return;
+ pw = static_cast< Ui::CWindow* >(m_interface->SearchControl(EVENT_WINDOW0));
+ if ( pw == nullptr ) return;
- pl = (CList*)pw->SearchControl(EVENT_OBJECT_GINFO);
- if ( pl == 0 ) return;
+ pl = static_cast< Ui::CList* >(pw->SearchControl(EVENT_OBJECT_GINFO));
+ if ( pl == nullptr ) return;
pl->Flush();
- total = m_object->RetInfoTotal();
+ total = m_object->GetInfoTotal();
if ( total == 0 )
{
- pl->ClearState(STATE_ENABLE);
+ pl->ClearState(Ui::STATE_ENABLE);
}
else
{
- pl->SetState(STATE_ENABLE);
+ pl->SetState(Ui::STATE_ENABLE);
for ( i=0 ; i<total ; i++ )
{
- info = m_object->RetInfo(i);
+ info = m_object->GetInfo(i);
sprintf(text, "%s = %.2f", info.name, info.value);
pl->SetName(i, text);
}
@@ -440,28 +440,28 @@ void CAutoInfo::UpdateList()
void CAutoInfo::UpdateListVirus()
{
- CWindow* pw;
- CList* pl;
+ Ui::CWindow* pw;
+ Ui::CList* pl;
int i, j, max;
char text[100];
- pw = (CWindow*)m_interface->SearchControl(EVENT_WINDOW0);
+ pw = static_cast< Ui::CWindow* >(m_interface->SearchControl(EVENT_WINDOW0));
if ( pw == 0 ) return;
- pl = (CList*)pw->SearchControl(EVENT_OBJECT_GINFO);
+ pl = static_cast< Ui::CList* >(pw->SearchControl(EVENT_OBJECT_GINFO));
if ( pl == 0 ) return;
- pl->SetState(STATE_ENABLE);
+ pl->SetState(Ui::STATE_ENABLE);
pl->Flush();
for ( i=0 ; i<4 ; i++ )
{
- max = (int)(2.0f+Math::Rand()*10.0f);
+ max = static_cast< int >(2.0f+Math::Rand()*10.0f);
for ( j=0 ; j<max ; j++ )
{
do
{
- text[j] = ' '+(int)(Math::Rand()*94.0f);
+ text[j] = ' '+static_cast< int >(Math::Rand()*94.0f);
}
while ( text[j] == '\\' );
}
@@ -505,11 +505,11 @@ bool CAutoInfo::Read(char *line)
CAuto::Read(line);
- m_phase = (AutoInfoPhase)OpInt(line, "aPhase", AIP_WAIT);
+ m_phase = static_cast< AutoInfoPhase > (OpInt(line, "aPhase", AIP_WAIT));
m_progress = OpFloat(line, "aProgress", 0.0f);
m_speed = OpFloat(line, "aSpeed", 1.0f);
- m_lastParticule = 0.0f;
+ m_lastParticle = 0.0f;
return true;
}
diff --git a/src/object/auto/autoinfo.h b/src/object/auto/autoinfo.h
index cfe3c1b..30481bb 100644
--- a/src/object/auto/autoinfo.h
+++ b/src/object/auto/autoinfo.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
@@ -44,7 +45,7 @@ public:
void Init();
void Start(int param);
bool EventProcess(const Event &event);
- Error RetError();
+ Error GetError();
bool CreateInterface(bool bSelect);
@@ -61,7 +62,7 @@ protected:
float m_progress;
float m_speed;
float m_timeVirus;
- float m_lastParticule;
+ float m_lastParticle;
Math::Vector m_goal;
bool m_bLastVirus;
};
diff --git a/src/object/auto/autojostle.cpp b/src/object/auto/autojostle.cpp
index 3944297..788b562 100644
--- a/src/object/auto/autojostle.cpp
+++ b/src/object/auto/autojostle.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
@@ -15,11 +16,9 @@
// * along with this program. If not, see http://www.gnu.org/licenses/.
-#include <stdio.h>
-
#include "object/auto/autojostle.h"
-
+#include <stdio.h>
// Object's constructor.
@@ -71,7 +70,7 @@ void CAutoJostle::Start(int param, float force)
m_time = 0.0f;
m_error = ERR_CONTINUE;
- type = m_object->RetType();
+ type = m_object->GetType();
if ( type >= OBJECT_PLANT5 &&
type <= OBJECT_PLANT7 ) // clover?
{
@@ -89,8 +88,8 @@ bool CAutoJostle::EventProcess(const Event &event)
CAuto::EventProcess(event);
- if ( m_engine->RetPause() ) return true;
- if ( event.event != EVENT_FRAME ) return true;
+ if ( m_engine->GetPause() ) return true;
+ if ( event.type != EVENT_FRAME ) return true;
if ( m_progress < 1.0f )
{
diff --git a/src/object/auto/autojostle.h b/src/object/auto/autojostle.h
index 70bb5e6..c156893 100644
--- a/src/object/auto/autojostle.h
+++ b/src/object/auto/autojostle.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
@@ -42,7 +43,7 @@ protected:
float m_force;
float m_progress;
float m_speed;
- float m_lastParticule;
+ float m_lastParticle;
Error m_error;
};
diff --git a/src/object/auto/autokid.cpp b/src/object/auto/autokid.cpp
index e5987cc..7004e6b 100644
--- a/src/object/auto/autokid.cpp
+++ b/src/object/auto/autokid.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
@@ -15,13 +16,12 @@
// * along with this program. If not, see http://www.gnu.org/licenses/.
-#include <stdio.h>
-
#include "object/auto/autokid.h"
-#include "old/particule.h"
-#include "old/water.h"
+#include "graphics/engine/particle.h"
+#include "graphics/engine/water.h"
+#include <stdio.h>
// Object's constructor.
@@ -62,18 +62,18 @@ void CAutoKid::Init()
m_speed = 1.0f/1.0f;
m_progress = 0.0f;
- m_lastParticule = 0.0f;
+ m_lastParticle = 0.0f;
if ( m_type == OBJECT_TEEN36 ) // trunk ?
{
- pos = m_object->RetPosition(0);
+ pos = m_object->GetPosition(0);
m_speed = 1.0f/(1.0f+(Math::Mod(pos.x/10.0f-0.5f, 1.0f)*0.2f));
m_progress = Math::Mod(pos.x/10.0f, 1.0f);
}
if ( m_type == OBJECT_TEEN37 ) // boat?
{
- pos = m_object->RetPosition(0);
+ pos = m_object->GetPosition(0);
m_speed = 1.0f/(1.0f+(Math::Mod(pos.x/10.0f-0.5f, 1.0f)*0.2f))*2.5f;
m_progress = Math::Mod(pos.x/10.0f, 1.0f);
}
@@ -82,7 +82,7 @@ void CAutoKid::Init()
{
if ( m_soundChannel == -1 )
{
-//? m_soundChannel = m_sound->Play(SOUND_MANIP, m_object->RetPosition(0), 1.0f, 0.5f, true);
+//? m_soundChannel = m_sound->Play(SOUND_MANIP, m_object->GetPosition(0), 1.0f, 0.5f, true);
m_bSilent = false;
}
}
@@ -100,7 +100,7 @@ bool CAutoKid::EventProcess(const Event &event)
if ( m_soundChannel != -1 )
{
- if ( m_engine->RetPause() )
+ if ( m_engine->GetPause() )
{
if ( !m_bSilent )
{
@@ -118,8 +118,8 @@ bool CAutoKid::EventProcess(const Event &event)
}
}
- if ( m_engine->RetPause() ) return true;
- if ( event.event != EVENT_FRAME ) return true;
+ if ( m_engine->GetPause() ) return true;
+ if ( event.type != EVENT_FRAME ) return true;
m_progress += event.rTime*m_speed;
@@ -135,12 +135,12 @@ bool CAutoKid::EventProcess(const Event &event)
vib.z = sinf(m_progress*0.5f)*0.05f;
m_object->SetCirVibration(vib);
- if ( m_lastParticule+m_engine->ParticuleAdapt(0.15f) <= m_time )
+ if ( m_lastParticle+m_engine->ParticleAdapt(0.15f) <= m_time )
{
- m_lastParticule = m_time;
+ m_lastParticle = m_time;
- pos = m_object->RetPosition(0);
- pos.y = m_water->RetLevel()+1.0f;
+ pos = m_object->GetPosition(0);
+ pos.y = m_water->GetLevel()+1.0f;
pos.x += (Math::Rand()-0.5f)*50.0f;
pos.z += (Math::Rand()-0.5f)*50.0f;
speed.y = 0.0f;
@@ -148,7 +148,7 @@ bool CAutoKid::EventProcess(const Event &event)
speed.z = 0.0f;
dim.x = 50.0f;
dim.y = dim.x;
- m_particule->CreateParticule(pos, speed, dim, PARTIFLIC, 3.0f, 0.0f, 0.0f);
+ m_particle->CreateParticle(pos, speed, dim, Gfx::PARTIFLIC, 3.0f, 0.0f, 0.0f);
}
}
@@ -164,12 +164,12 @@ bool CAutoKid::EventProcess(const Event &event)
vib.z = sinf(m_progress*0.5f)*0.15f;
m_object->SetCirVibration(vib);
- if ( m_lastParticule+m_engine->ParticuleAdapt(0.15f) <= m_time )
+ if ( m_lastParticle+m_engine->ParticleAdapt(0.15f) <= m_time )
{
- m_lastParticule = m_time;
+ m_lastParticle = m_time;
- pos = m_object->RetPosition(0);
- pos.y = m_water->RetLevel()+1.0f;
+ pos = m_object->GetPosition(0);
+ pos.y = m_water->GetLevel()+1.0f;
pos.x += (Math::Rand()-0.5f)*20.0f;
pos.z += (Math::Rand()-0.5f)*20.0f;
speed.y = 0.0f;
@@ -177,7 +177,7 @@ bool CAutoKid::EventProcess(const Event &event)
speed.z = 0.0f;
dim.x = 20.0f;
dim.y = dim.x;
- m_particule->CreateParticule(pos, speed, dim, PARTIFLIC, 3.0f, 0.0f, 0.0f);
+ m_particle->CreateParticle(pos, speed, dim, Gfx::PARTIFLIC, 3.0f, 0.0f, 0.0f);
}
}
@@ -191,9 +191,9 @@ bool CAutoKid::EventProcess(const Event &event)
}
-// Returns an error due the state of the automation.
+// Geturns an error due the state of the automation.
-Error CAutoKid::RetError()
+Error CAutoKid::GetError()
{
return ERR_OK;
}
diff --git a/src/object/auto/autokid.h b/src/object/auto/autokid.h
index 6d4258f..3e2fba7 100644
--- a/src/object/auto/autokid.h
+++ b/src/object/auto/autokid.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
@@ -33,14 +34,14 @@ public:
void Init();
bool EventProcess(const Event &event);
- Error RetError();
+ Error GetError();
protected:
protected:
float m_speed;
float m_progress;
- float m_lastParticule;
+ float m_lastParticle;
int m_soundChannel;
bool m_bSilent;
};
diff --git a/src/object/auto/autolabo.cpp b/src/object/auto/autolabo.cpp
index 270ec09..af780e0 100644
--- a/src/object/auto/autolabo.cpp
+++ b/src/object/auto/autolabo.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
@@ -15,8 +16,6 @@
// * along with this program. If not, see http://www.gnu.org/licenses/.
-#include <stdio.h>
-
#include "object/auto/autolabo.h"
#include "common/global.h"
@@ -28,6 +27,8 @@
#include "ui/window.h"
#include "ui/displaytext.h"
+#include <stdio.h>
+#include <string.h>
const float LABO_DELAY = 20.0f; // duration of the analysis
@@ -69,14 +70,14 @@ void CAutoLabo::DeleteObject(bool bAll)
{
if ( m_partiRank[i] != -1 )
{
- m_particule->DeleteParticule(m_partiRank[i]);
+ m_particle->DeleteParticle(m_partiRank[i]);
m_partiRank[i] = -1;
}
}
if ( m_partiSphere != -1 )
{
- m_particule->DeleteParticule(m_partiSphere);
+ m_particle->DeleteParticle(m_partiSphere);
m_partiSphere = -1;
}
@@ -97,7 +98,7 @@ void CAutoLabo::Init()
{
m_time = 0.0f;
m_timeVirus = 0.0f;
- m_lastParticule = 0.0f;
+ m_lastParticle = 0.0f;
m_phase = ALAP_WAIT; // waiting ...
m_progress = 0.0f;
@@ -119,23 +120,23 @@ bool CAutoLabo::EventProcess(const Event &event)
CAuto::EventProcess(event);
- if ( m_engine->RetPause() ) return true;
+ if ( m_engine->GetPause() ) return true;
- if ( event.event == EVENT_UPDINTERFACE )
+ if ( event.type == EVENT_UPDINTERFACE )
{
- if ( m_object->RetSelect() ) CreateInterface(true);
+ if ( m_object->GetSelect() ) CreateInterface(true);
}
- if ( m_object->RetSelect() && // center selected?
- (event.event == EVENT_OBJECT_RiPAW ||
- event.event == EVENT_OBJECT_RiGUN) )
+ if ( m_object->GetSelect() && // center selected?
+ (event.type == EVENT_OBJECT_RiPAW ||
+ event.type == EVENT_OBJECT_RiGUN) )
{
if ( m_phase != ALAP_WAIT )
{
return false;
}
- m_research = event.event;
+ m_research = event.type;
if ( TestResearch(m_research) )
{
@@ -143,13 +144,13 @@ bool CAutoLabo::EventProcess(const Event &event)
return false;
}
- power = m_object->RetPower();
+ power = m_object->GetPower();
if ( power == 0 )
{
m_displayText->DisplayError(ERR_LABO_NULL, m_object);
return false;
}
- if ( power->RetType() != OBJECT_BULLET )
+ if ( power->GetType() != OBJECT_BULLET )
{
m_displayText->DisplayError(ERR_LABO_BAD, m_object);
return false;
@@ -168,12 +169,12 @@ bool CAutoLabo::EventProcess(const Event &event)
return true;
}
- if ( event.event != EVENT_FRAME ) return true;
+ if ( event.type != EVENT_FRAME ) return true;
m_progress += event.rTime*m_speed;
m_timeVirus -= event.rTime;
- if ( m_object->RetVirusMode() ) // contaminated by a virus?
+ if ( m_object->GetVirusMode() ) // contaminated by a virus?
{
if ( m_timeVirus <= 0.0f )
{
@@ -247,31 +248,32 @@ bool CAutoLabo::EventProcess(const Event &event)
{
m_object->SetAngleZ(1, 0.0f);
- goal = m_object->RetPosition(0);
+ goal = m_object->GetPosition(0);
goal.y += 3.0f;
pos = goal;
pos.x -= 4.0f;
pos.y += 4.0f;
for ( i=0 ; i<3 ; i++ )
{
- m_partiRank[i] = m_particule->CreateRay(pos, goal,
- PARTIRAY2,
+ m_partiRank[i] = m_particle->CreateRay(pos, goal,
+ Gfx::PARTIRAY2,
Math::Point(2.9f, 2.9f),
LABO_DELAY);
}
- m_soundChannel = m_sound->Play(SOUND_LABO, m_object->RetPosition(0), 0.0f, 0.25f, true);
+ m_soundChannel = m_sound->Play(SOUND_LABO, m_object->GetPosition(0), 0.0f, 0.25f, true);
m_sound->AddEnvelope(m_soundChannel, 1.0f, 0.60f, 2.0f, SOPER_CONTINUE);
m_sound->AddEnvelope(m_soundChannel, 1.0f, 2.00f, 8.0f, SOPER_CONTINUE);
m_sound->AddEnvelope(m_soundChannel, 1.0f, 0.60f, 8.0f, SOPER_CONTINUE);
m_sound->AddEnvelope(m_soundChannel, 0.0f, 0.25f, 2.0f, SOPER_STOP);
- pos = m_object->RetPosition(0);
+ pos = m_object->GetPosition(0);
pos.y += 4.0f;
speed = Math::Vector(0.0f, 0.0f, 0.0f);
dim.x = 4.0f;
dim.y = dim.x;
- m_partiSphere = m_particule->CreateParticule(pos, speed, dim, PARTISPHERE2, LABO_DELAY, 0.0f, 0.0f);
+ m_partiSphere = m_particle->CreateParticle(pos, speed,
+ dim, Gfx::PARTISPHERE2, LABO_DELAY, 0.0f, 0.0f);
m_phase = ALAP_ANALYSE;
m_progress = 0.0f;
@@ -283,13 +285,13 @@ bool CAutoLabo::EventProcess(const Event &event)
{
if ( m_progress < 1.0f )
{
- power = m_object->RetPower();
+ power = m_object->GetPower();
if ( power != 0 )
{
power->SetZoom(0, 1.0f-m_progress);
}
- angle = m_object->RetAngleY(2);
+ angle = m_object->GetAngleY(2);
if ( m_progress < 0.5f )
{
angle -= event.rTime*m_progress*20.0f;
@@ -300,27 +302,27 @@ bool CAutoLabo::EventProcess(const Event &event)
}
m_object->SetAngleY(2, angle); // rotates the analyzer
- angle += m_object->RetAngleY(0);
+ angle += m_object->GetAngleY(0);
for ( i=0 ; i<3 ; i++ )
{
rot = Math::RotatePoint(-angle, -4.0f);
- pos = m_object->RetPosition(0);
+ pos = m_object->GetPosition(0);
pos.x += rot.x;
pos.z += rot.y;
pos.y += 3.0f+4.0f;;
- m_particule->SetPosition(m_partiRank[i], pos); // adjusts ray
+ m_particle->SetPosition(m_partiRank[i], pos); // adjusts ray
angle += Math::PI*2.0f/3.0f;
}
- if ( m_lastParticule+m_engine->ParticuleAdapt(0.05f) <= m_time )
+ if ( m_lastParticle+m_engine->ParticleAdapt(0.05f) <= m_time )
{
- m_lastParticule = m_time;
+ m_lastParticle = m_time;
if ( m_progress > 0.25f &&
m_progress < 0.80f )
{
- pos = m_object->RetPosition(0);
+ pos = m_object->GetPosition(0);
pos.y += 3.0f;
pos.x += (Math::Rand()-0.5f)*2.0f;
pos.z += (Math::Rand()-0.5f)*2.0f;
@@ -329,7 +331,7 @@ bool CAutoLabo::EventProcess(const Event &event)
speed.z = (Math::Rand()-0.5f)*10.0f;
dim.x = Math::Rand()*0.4f*m_progress+1.0f;
dim.y = dim.x;
- m_particule->CreateTrack(pos, speed, dim, PARTITRACK2,
+ m_particle->CreateTrack(pos, speed, dim, Gfx::PARTITRACK2,
2.0f+2.0f*m_progress, 10.0f, 1.5f, 1.4f);
}
}
@@ -338,7 +340,7 @@ bool CAutoLabo::EventProcess(const Event &event)
{
SetResearch(m_research); // research done
- power = m_object->RetPower();
+ power = m_object->GetPower();
if ( power != 0 )
{
m_object->SetPower(0);
@@ -421,21 +423,21 @@ bool CAutoLabo::EventProcess(const Event &event)
}
-// Returns an error due the state of the automation.
+// Geturns an error due the state of the automation.
-Error CAutoLabo::RetError()
+Error CAutoLabo::GetError()
{
CObject* pObj;
ObjectType type;
- if ( m_object->RetVirusMode() )
+ if ( m_object->GetVirusMode() )
{
return ERR_BAT_VIRUS;
}
- pObj = m_object->RetPower();
+ pObj = m_object->GetPower();
if ( pObj == 0 ) return ERR_LABO_NULL;
- type = pObj->RetType();
+ type = pObj->GetType();
if ( type != OBJECT_BULLET ) return ERR_LABO_BAD;
return ERR_OK;
@@ -446,7 +448,7 @@ Error CAutoLabo::RetError()
bool CAutoLabo::CreateInterface(bool bSelect)
{
- CWindow* pw;
+ Ui::CWindow* pw;
Math::Point pos, dim, ddim;
float ox, oy, sx, sy;
@@ -454,7 +456,7 @@ bool CAutoLabo::CreateInterface(bool bSelect)
if ( !bSelect ) return true;
- pw = (CWindow*)m_interface->SearchControl(EVENT_WINDOW0);
+ pw = static_cast< Ui::CWindow* >(m_interface->SearchControl(EVENT_WINDOW0));
if ( pw == 0 ) return false;
dim.x = 33.0f/640.0f;
@@ -487,13 +489,13 @@ bool CAutoLabo::CreateInterface(bool bSelect)
void CAutoLabo::UpdateInterface()
{
- CWindow* pw;
+ Ui::CWindow* pw;
- if ( !m_object->RetSelect() ) return;
+ if ( !m_object->GetSelect() ) return;
CAuto::UpdateInterface();
- pw = (CWindow*)m_interface->SearchControl(EVENT_WINDOW0);
+ pw = static_cast< Ui::CWindow* >(m_interface->SearchControl(EVENT_WINDOW0));
if ( pw == 0 ) return;
DeadInterface(pw, EVENT_OBJECT_RiPAW, g_researchEnable&RESEARCH_iPAW);
@@ -508,20 +510,20 @@ void CAutoLabo::UpdateInterface()
// Indicates the research conducted for a button.
-void CAutoLabo::OkayButton(CWindow *pw, EventMsg event)
+void CAutoLabo::OkayButton(Ui::CWindow *pw, EventType event)
{
- CControl* control;
+ Ui::CControl* control;
control = pw->SearchControl(event);
if ( control == 0 ) return;
- control->SetState(STATE_OKAY, TestResearch(event));
+ control->SetState(Ui::STATE_OKAY, TestResearch(event));
}
// Test whether a search has already been done.
-bool CAutoLabo::TestResearch(EventMsg event)
+bool CAutoLabo::TestResearch(EventType event)
{
if ( event == EVENT_OBJECT_RiPAW ) return (g_researchDone & RESEARCH_iPAW);
if ( event == EVENT_OBJECT_RiGUN ) return (g_researchDone & RESEARCH_iGUN);
@@ -531,16 +533,17 @@ bool CAutoLabo::TestResearch(EventMsg event)
// Indicates a search as made.
-void CAutoLabo::SetResearch(EventMsg event)
+void CAutoLabo::SetResearch(EventType event)
{
- Event newEvent;
+
if ( event == EVENT_OBJECT_RiPAW ) g_researchDone |= RESEARCH_iPAW;
if ( event == EVENT_OBJECT_RiGUN ) g_researchDone |= RESEARCH_iGUN;
m_main->WriteFreeParam();
- m_event->MakeEvent(newEvent, EVENT_UPDINTERFACE);
+ Event newEvent(EVENT_UPDINTERFACE);
+// m_event->MakeEvent(newEvent, EVENT_UPDINTERFACE);
m_event->AddEvent(newEvent);
UpdateInterface();
}
@@ -551,7 +554,7 @@ void CAutoLabo::SoundManip(float time, float amplitude, float frequency)
{
int i;
- i = m_sound->Play(SOUND_MANIP, m_object->RetPosition(0), 0.0f, 0.3f*frequency, true);
+ i = m_sound->Play(SOUND_MANIP, m_object->GetPosition(0), 0.0f, 0.3f*frequency, true);
m_sound->AddEnvelope(i, 0.5f*amplitude, 1.0f*frequency, 0.1f, SOPER_CONTINUE);
m_sound->AddEnvelope(i, 0.5f*amplitude, 1.0f*frequency, time-0.1f, SOPER_CONTINUE);
m_sound->AddEnvelope(i, 0.0f, 0.3f*frequency, 0.1f, SOPER_STOP);
@@ -597,12 +600,12 @@ bool CAutoLabo::Read(char *line)
CAuto::Read(line);
- m_phase = (AutoLaboPhase)OpInt(line, "aPhase", ALAP_WAIT);
+ m_phase = static_cast< AutoLaboPhase >(OpInt(line, "aPhase", ALAP_WAIT));
m_progress = OpFloat(line, "aProgress", 0.0f);
m_speed = OpFloat(line, "aSpeed", 1.0f);
- m_research = (EventMsg)OpInt(line, "aResearch", 0);
+ m_research = static_cast< EventType >(OpInt(line, "aResearch", 0));
- m_lastParticule = 0.0f;
+ m_lastParticle = 0.0f;
return true;
}
diff --git a/src/object/auto/autolabo.h b/src/object/auto/autolabo.h
index 244e633..8225462 100644
--- a/src/object/auto/autolabo.h
+++ b/src/object/auto/autolabo.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
@@ -47,7 +48,7 @@ public:
void Init();
bool EventProcess(const Event &event);
- Error RetError();
+ Error GetError();
bool CreateInterface(bool bSelect);
@@ -56,9 +57,9 @@ public:
protected:
void UpdateInterface();
- void OkayButton(CWindow *pw, EventMsg event);
- bool TestResearch(EventMsg event);
- void SetResearch(EventMsg event);
+ void OkayButton(Ui::CWindow *pw, EventType event);
+ bool TestResearch(EventType event);
+ void SetResearch(EventType event);
void SoundManip(float time, float amplitude, float frequency);
protected:
@@ -66,8 +67,8 @@ protected:
float m_progress;
float m_speed;
float m_timeVirus;
- float m_lastParticule;
- EventMsg m_research;
+ float m_lastParticle;
+ EventType m_research;
int m_partiRank[3];
int m_partiSphere;
int m_soundChannel;
diff --git a/src/object/auto/automush.cpp b/src/object/auto/automush.cpp
index c3eaaaf..d7aa98e 100644
--- a/src/object/auto/automush.cpp
+++ b/src/object/auto/automush.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
@@ -15,14 +16,14 @@
// * along with this program. If not, see http://www.gnu.org/licenses/.
-#include <stdio.h>
-
#include "object/auto/automush.h"
#include "common/iman.h"
#include "script/cmdtoken.h"
+#include <stdio.h>
+#include <string.h>
// Object's constructor.
@@ -57,7 +58,7 @@ void CAutoMush::Init()
m_speed = 1.0f/4.0f;
m_time = 0.0f;
- m_lastParticule = 0.0f;
+ m_lastParticle = 0.0f;
}
@@ -72,8 +73,8 @@ bool CAutoMush::EventProcess(const Event &event)
CAuto::EventProcess(event);
- if ( m_engine->RetPause() ) return true;
- if ( event.event != EVENT_FRAME ) return true;
+ if ( m_engine->GetPause() ) return true;
+ if ( event.type != EVENT_FRAME ) return true;
m_progress += event.rTime*m_speed;
@@ -122,7 +123,7 @@ bool CAutoMush::EventProcess(const Event &event)
}
else
{
- m_sound->Play(SOUND_MUSHROOM, m_object->RetPosition(0));
+ m_sound->Play(SOUND_MUSHROOM, m_object->GetPosition(0));
m_phase = AMP_FIRE;
m_progress = 0.0f;
@@ -137,21 +138,21 @@ bool CAutoMush::EventProcess(const Event &event)
factor = 1.0f-m_progress;
size = 1.0f+(1.0f-m_progress)*0.3f;
- if ( m_lastParticule+m_engine->ParticuleAdapt(0.05f) <= m_time )
+ if ( m_lastParticle+m_engine->ParticleAdapt(0.05f) <= m_time )
{
- m_lastParticule = m_time;
+ m_lastParticle = m_time;
for ( i=0 ; i<10 ; i++ )
{
- pos = m_object->RetPosition(0);
+ pos = m_object->GetPosition(0);
pos.y += 5.0f;
speed.x = (Math::Rand()-0.5f)*200.0f;
speed.z = (Math::Rand()-0.5f)*200.0f;
speed.y = -(20.0f+Math::Rand()*20.0f);
dim.x = 1.0f;
dim.y = dim.x;
- channel = m_particule->CreateParticule(pos, speed, dim, PARTIGUN2, 2.0f, 100.0f, 0.0f);
- m_particule->SetObjectFather(channel, m_object);
+ channel = m_particle->CreateParticle(pos, speed, dim, Gfx::PARTIGUN2, 2.0f, 100.0f, 0.0f);
+ m_particle->SetObjectFather(channel, m_object);
}
}
}
@@ -167,18 +168,18 @@ bool CAutoMush::EventProcess(const Event &event)
{
if ( m_progress < 1.0f )
{
- if ( m_lastParticule+m_engine->ParticuleAdapt(0.10f) <= m_time )
+ if ( m_lastParticle+m_engine->ParticleAdapt(0.10f) <= m_time )
{
- m_lastParticule = m_time;
+ m_lastParticle = m_time;
- pos = m_object->RetPosition(0);
+ pos = m_object->GetPosition(0);
pos.y += 5.0f;
speed.x = (Math::Rand()-0.5f)*4.0f;
speed.z = (Math::Rand()-0.5f)*4.0f;
speed.y = -(0.5f+Math::Rand()*0.5f);
dim.x = Math::Rand()*2.5f+2.0f;
dim.y = dim.x;
- m_particule->CreateParticule(pos, speed, dim, PARTISMOKE3, 4.0f, 0.0f, 0.0f);
+ m_particle->CreateParticle(pos, speed, dim, Gfx::PARTISMOKE3, 4.0f, 0.0f, 0.0f);
}
}
else
@@ -226,16 +227,16 @@ bool CAutoMush::SearchTarget()
float dist;
int i;
- iPos = m_object->RetPosition(0);
+ iPos = m_object->GetPosition(0);
for ( i=0 ; i<1000000 ; i++ )
{
- pObj = (CObject*)m_iMan->SearchInstance(CLASS_OBJECT, i);
+ pObj = static_cast< CObject* >(m_iMan->SearchInstance(CLASS_OBJECT, i));
if ( pObj == 0 ) break;
- if ( pObj->RetLock() ) continue;
+ if ( pObj->GetLock() ) continue;
- type = pObj->RetType();
+ type = pObj->GetType();
if ( type != OBJECT_MOBILEfa &&
type != OBJECT_MOBILEta &&
type != OBJECT_MOBILEwa &&
@@ -279,7 +280,7 @@ bool CAutoMush::SearchTarget()
type != OBJECT_PARA &&
type != OBJECT_HUMAN ) continue;
- oPos = pObj->RetPosition(0);
+ oPos = pObj->GetPosition(0);
dist = Math::Distance(oPos, iPos);
if ( dist < 50.0f ) return true;
}
@@ -288,9 +289,9 @@ bool CAutoMush::SearchTarget()
}
-// Returns an error due the state of the automation.
+// Geturns an error due the state of the automation.
-Error CAutoMush::RetError()
+Error CAutoMush::GetError()
{
return ERR_OK;
}
@@ -332,11 +333,11 @@ bool CAutoMush::Read(char *line)
CAuto::Read(line);
- m_phase = (AutoMushPhase)OpInt(line, "aPhase", AMP_WAIT);
+ m_phase = static_cast< AutoMushPhase >(OpInt(line, "aPhase", AMP_WAIT));
m_progress = OpFloat(line, "aProgress", 0.0f);
m_speed = OpFloat(line, "aSpeed", 1.0f);
- m_lastParticule = 0.0f;
+ m_lastParticle = 0.0f;
return true;
}
diff --git a/src/object/auto/automush.h b/src/object/auto/automush.h
index 113d22f..245393a 100644
--- a/src/object/auto/automush.h
+++ b/src/object/auto/automush.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
@@ -44,7 +45,7 @@ public:
void Init();
bool EventProcess(const Event &event);
- Error RetError();
+ Error GetError();
bool Write(char *line);
bool Read(char *line);
@@ -56,6 +57,6 @@ protected:
AutoMushPhase m_phase;
float m_progress;
float m_speed;
- float m_lastParticule;
+ float m_lastParticle;
};
diff --git a/src/object/auto/autonest.cpp b/src/object/auto/autonest.cpp
index f3c70fb..4a8132a 100644
--- a/src/object/auto/autonest.cpp
+++ b/src/object/auto/autonest.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
@@ -15,15 +16,14 @@
// * along with this program. If not, see http://www.gnu.org/licenses/.
-#include <stdio.h>
-
#include "object/auto/autonest.h"
#include "common/iman.h"
-#include "old/terrain.h"
+#include "graphics/engine/terrain.h"
#include "script/cmdtoken.h"
-
+#include <stdio.h>
+#include <string.h>
// Object's constructor.
@@ -72,10 +72,10 @@ void CAutoNest::Init()
m_speed = 1.0f/4.0f;
m_time = 0.0f;
- m_lastParticule = 0.0f;
+ m_lastParticle = 0.0f;
- pos = m_object->RetPosition(0);
- m_terrain->MoveOnFloor(pos);
+ pos = m_object->GetPosition(0);
+ m_terrain->AdjustToFloor(pos);
m_fretPos = pos;
}
@@ -88,8 +88,8 @@ bool CAutoNest::EventProcess(const Event &event)
CAuto::EventProcess(event);
- if ( m_engine->RetPause() ) return true;
- if ( event.event != EVENT_FRAME ) return true;
+ if ( m_engine->GetPause() ) return true;
+ if ( event.type != EVENT_FRAME ) return true;
m_progress += event.rTime*m_speed;
@@ -154,10 +154,10 @@ bool CAutoNest::SearchFree(Math::Vector pos)
for ( i=0 ; i<1000000 ; i++ )
{
- pObj = (CObject*)m_iMan->SearchInstance(CLASS_OBJECT, i);
+ pObj = static_cast< CObject* >(m_iMan->SearchInstance(CLASS_OBJECT, i));
if ( pObj == 0 ) break;
- type = pObj->RetType();
+ type = pObj->GetType();
if ( type == OBJECT_NEST ) continue;
j = 0;
@@ -199,15 +199,15 @@ CObject* CAutoNest::SearchFret()
for ( i=0 ; i<1000000 ; i++ )
{
- pObj = (CObject*)m_iMan->SearchInstance(CLASS_OBJECT, i);
+ pObj = static_cast< CObject* >(m_iMan->SearchInstance(CLASS_OBJECT, i));
if ( pObj == 0 ) break;
- if ( !pObj->RetLock() ) continue;
+ if ( !pObj->GetLock() ) continue;
- type = pObj->RetType();
+ type = pObj->GetType();
if ( type != OBJECT_BULLET ) continue;
- oPos = pObj->RetPosition(0);
+ oPos = pObj->GetPosition(0);
if ( oPos.x == m_fretPos.x &&
oPos.z == m_fretPos.z )
{
@@ -219,9 +219,9 @@ CObject* CAutoNest::SearchFret()
}
-// Returns an error due the state of the automation.
+// Geturns an error due the state of the automation.
-Error CAutoNest::RetError()
+Error CAutoNest::GetError()
{
return ERR_OK;
}
@@ -263,11 +263,11 @@ bool CAutoNest::Read(char *line)
CAuto::Read(line);
- m_phase = (AutoNestPhase)OpInt(line, "aPhase", ANP_WAIT);
+ m_phase = static_cast< AutoNestPhase >(OpInt(line, "aPhase", ANP_WAIT));
m_progress = OpFloat(line, "aProgress", 0.0f);
m_speed = OpFloat(line, "aSpeed", 1.0f);
- m_lastParticule = 0.0f;
+ m_lastParticle = 0.0f;
return true;
}
diff --git a/src/object/auto/autonest.h b/src/object/auto/autonest.h
index 612551d..1009457 100644
--- a/src/object/auto/autonest.h
+++ b/src/object/auto/autonest.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
@@ -41,7 +42,7 @@ public:
void Init();
bool EventProcess(const Event &event);
- Error RetError();
+ Error GetError();
bool Write(char *line);
bool Read(char *line);
@@ -55,7 +56,7 @@ protected:
AutoNestPhase m_phase;
float m_progress;
float m_speed;
- float m_lastParticule;
- Math::Vector m_fretPos;
+ float m_lastParticle;
+ Math::Vector m_fretPos;
};
diff --git a/src/object/auto/autonuclear.cpp b/src/object/auto/autonuclear.cpp
index 05f0b29..bb20dde 100644
--- a/src/object/auto/autonuclear.cpp
+++ b/src/object/auto/autonuclear.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
@@ -15,8 +16,6 @@
// * along with this program. If not, see http://www.gnu.org/licenses/.
-#include <stdio.h>
-
#include "object/auto/autonuclear.h"
#include "common/iman.h"
@@ -26,6 +25,8 @@
#include "ui/window.h"
#include "ui/displaytext.h"
+#include <stdio.h>
+#include <string.h>
const float NUCLEAR_DELAY = 30.0f; // duration of the generation
@@ -84,9 +85,9 @@ void CAutoNuclear::Init()
m_time = 0.0f;
m_timeVirus = 0.0f;
- m_lastParticule = 0.0f;
+ m_lastParticle = 0.0f;
- mat = m_object->RetWorldMatrix(0);
+ mat = m_object->GetWorldMatrix(0);
m_pos = Math::Transform(*mat, Math::Vector(22.0f, 4.0f, 0.0f));
m_phase = ANUP_WAIT; // waiting ...
@@ -110,13 +111,13 @@ bool CAutoNuclear::EventProcess(const Event &event)
CAuto::EventProcess(event);
- if ( m_engine->RetPause() ) return true;
- if ( event.event != EVENT_FRAME ) return true;
+ if ( m_engine->GetPause() ) return true;
+ if ( event.type != EVENT_FRAME ) return true;
m_progress += event.rTime*m_speed;
m_timeVirus -= event.rTime;
- if ( m_object->RetVirusMode() ) // contaminated by a virus?
+ if ( m_object->GetVirusMode() ) // contaminated by a virus?
{
if ( m_timeVirus <= 0.0f )
{
@@ -146,7 +147,7 @@ bool CAutoNuclear::EventProcess(const Event &event)
InitProgressTotal(1.5f+NUCLEAR_DELAY+1.5f);
UpdateInterface();
- m_sound->Play(SOUND_OPEN, m_object->RetPosition(0), 1.0f, 1.4f);
+ m_sound->Play(SOUND_OPEN, m_object->GetPosition(0), 1.0f, 1.4f);
m_phase = ANUP_CLOSE;
m_progress = 0.0f;
@@ -166,8 +167,8 @@ bool CAutoNuclear::EventProcess(const Event &event)
{
m_object->SetAngleZ(1, 0.0f);
- mat = m_object->RetWorldMatrix(0);
- max = (int)(10.0f*m_engine->RetParticuleDensity());
+ mat = m_object->GetWorldMatrix(0);
+ max = static_cast< int >(10.0f*m_engine->GetParticleDensity());
for ( i=0 ; i<max ; i++ )
{
pos.x = 27.0f;
@@ -179,12 +180,12 @@ bool CAutoNuclear::EventProcess(const Event &event)
speed.z = 0.0f;
dim.x = Math::Rand()*1.0f+1.0f;
dim.y = dim.x;
- m_particule->CreateParticule(pos, speed, dim, PARTICRASH);
+ m_particle->CreateParticle(pos, speed, dim, Gfx::PARTICRASH);
}
- m_sound->Play(SOUND_CLOSE, m_object->RetPosition(0), 1.0f, 1.0f);
+ m_sound->Play(SOUND_CLOSE, m_object->GetPosition(0), 1.0f, 1.0f);
- m_channelSound = m_sound->Play(SOUND_NUCLEAR, m_object->RetPosition(0), 1.0f, 0.1f, true);
+ m_channelSound = m_sound->Play(SOUND_NUCLEAR, m_object->GetPosition(0), 1.0f, 0.1f, true);
m_sound->AddEnvelope(m_channelSound, 1.0f, 1.0f, NUCLEAR_DELAY-1.0f, SOPER_CONTINUE);
m_sound->AddEnvelope(m_channelSound, 0.0f, 1.0f, 2.0f, SOPER_STOP);
@@ -198,11 +199,11 @@ bool CAutoNuclear::EventProcess(const Event &event)
{
if ( m_progress < 1.0f )
{
- if ( m_lastParticule+m_engine->ParticuleAdapt(0.10f) <= m_time )
+ if ( m_lastParticle+m_engine->ParticleAdapt(0.10f) <= m_time )
{
- m_lastParticule = m_time;
+ m_lastParticle = m_time;
- pos = m_object->RetPosition(0);
+ pos = m_object->GetPosition(0);
pos.y += 30.0f;
pos.x += (Math::Rand()-0.5f)*6.0f;
pos.z += (Math::Rand()-0.5f)*6.0f;
@@ -211,7 +212,7 @@ bool CAutoNuclear::EventProcess(const Event &event)
speed.z = 0.0f;
dim.x = Math::Rand()*8.0f+8.0f;
dim.y = dim.x;
- m_particule->CreateParticule(pos, speed, dim, PARTICRASH);
+ m_particle->CreateParticle(pos, speed, dim, Gfx::PARTICRASH);
pos = m_pos;
speed.x = (Math::Rand()-0.5f)*20.0f;
@@ -219,7 +220,7 @@ bool CAutoNuclear::EventProcess(const Event &event)
speed.z = (Math::Rand()-0.5f)*20.0f;
dim.x = 2.0f;
dim.y = dim.x;
- m_particule->CreateParticule(pos, speed, dim, PARTIBLITZ, 1.0f, 0.0f, 0.0f);
+ m_particle->CreateParticle(pos, speed, dim, Gfx::PARTIBLITZ, 1.0f, 0.0f, 0.0f);
}
}
else
@@ -234,7 +235,7 @@ bool CAutoNuclear::EventProcess(const Event &event)
CreatePower(); // creates the atomic cell
- max = (int)(20.0f*m_engine->RetParticuleDensity());
+ max = static_cast< int >(20.0f*m_engine->GetParticleDensity());
for ( i=0 ; i<max ; i++ )
{
pos = m_pos;
@@ -246,10 +247,10 @@ bool CAutoNuclear::EventProcess(const Event &event)
speed.z = 0.0f;
dim.x = Math::Rand()*2.0f+2.0f;
dim.y = dim.x;
- m_particule->CreateParticule(pos, speed, dim, PARTIBLUE, Math::Rand()*5.0f+5.0f, 0.0f, 0.0f);
+ m_particle->CreateParticle(pos, speed, dim, Gfx::PARTIBLUE, Math::Rand()*5.0f+5.0f, 0.0f, 0.0f);
}
- m_sound->Play(SOUND_OPEN, m_object->RetPosition(0), 1.0f, 1.4f);
+ m_sound->Play(SOUND_OPEN, m_object->GetPosition(0), 1.0f, 1.4f);
m_phase = ANUP_OPEN;
m_progress = 0.0f;
@@ -287,7 +288,7 @@ bool CAutoNuclear::EventProcess(const Event &event)
bool CAutoNuclear::CreateInterface(bool bSelect)
{
- CWindow* pw;
+ Ui::CWindow* pw;
Math::Point pos, ddim;
float ox, oy, sx, sy;
@@ -295,7 +296,7 @@ bool CAutoNuclear::CreateInterface(bool bSelect)
if ( !bSelect ) return true;
- pw = (CWindow*)m_interface->SearchControl(EVENT_WINDOW0);
+ pw = static_cast< Ui::CWindow* >(m_interface->SearchControl(EVENT_WINDOW0));
if ( pw == 0 ) return false;
ox = 3.0f/640.0f;
@@ -319,9 +320,9 @@ CObject* CAutoNuclear::SearchUranium()
{
CObject* pObj;
- pObj = m_object->RetPower();
+ pObj = m_object->GetPower();
if ( pObj == 0 ) return 0;
- if ( pObj->RetType() == OBJECT_URANIUM ) return pObj;
+ if ( pObj->GetType() == OBJECT_URANIUM ) return pObj;
return 0;
}
@@ -337,10 +338,10 @@ bool CAutoNuclear::SearchVehicle()
for ( i=0 ; i<1000000 ; i++ )
{
- pObj = (CObject*)m_iMan->SearchInstance(CLASS_OBJECT, i);
+ pObj = static_cast< CObject* >(m_iMan->SearchInstance(CLASS_OBJECT, i));
if ( pObj == 0 ) break;
- type = pObj->RetType();
+ type = pObj->GetType();
if ( type != OBJECT_HUMAN &&
type != OBJECT_MOBILEfa &&
type != OBJECT_MOBILEta &&
@@ -392,8 +393,8 @@ void CAutoNuclear::CreatePower()
Math::Vector pos;
float angle;
- pos = m_object->RetPosition(0);
- angle = m_object->RetAngleY(0);
+ pos = m_object->GetPosition(0);
+ angle = m_object->GetAngleY(0);
power = new CObject(m_iMan);
if ( !power->CreateResource(pos, angle, OBJECT_ATOMIC) )
@@ -409,28 +410,28 @@ void CAutoNuclear::CreatePower()
}
-// Returns an error due the state of the automation.
+// Geturns an error due the state of the automation.
-Error CAutoNuclear::RetError()
+Error CAutoNuclear::GetError()
{
CObject* pObj;
ObjectType type;
//? TerrainRes res;
- if ( m_object->RetVirusMode() )
+ if ( m_object->GetVirusMode() )
{
return ERR_BAT_VIRUS;
}
-//? res = m_terrain->RetResource(m_object->RetPosition(0));
+//? res = m_terrain->GetResource(m_object->GetPosition(0));
//? if ( res != TR_POWER ) return ERR_NUCLEAR_NULL;
-//? if ( m_object->RetEnergy() < ENERGY_POWER ) return ERR_NUCLEAR_LOW;
+//? if ( m_object->GetEnergy() < ENERGY_POWER ) return ERR_NUCLEAR_LOW;
- pObj = m_object->RetPower();
+ pObj = m_object->GetPower();
if ( pObj == 0 ) return ERR_NUCLEAR_EMPTY;
- if ( pObj->RetLock() ) return ERR_OK;
- type = pObj->RetType();
+ if ( pObj->GetLock() ) return ERR_OK;
+ type = pObj->GetType();
if ( type == OBJECT_ATOMIC ) return ERR_OK;
if ( type != OBJECT_URANIUM ) return ERR_NUCLEAR_BAD;
@@ -472,11 +473,11 @@ bool CAutoNuclear::Read(char *line)
CAuto::Read(line);
- m_phase = (AutoNuclearPhase)OpInt(line, "aPhase", ANUP_WAIT);
+ m_phase = static_cast< AutoNuclearPhase >(OpInt(line, "aPhase", ANUP_WAIT));
m_progress = OpFloat(line, "aProgress", 0.0f);
m_speed = OpFloat(line, "aSpeed", 1.0f);
- m_lastParticule = 0.0f;
+ m_lastParticle = 0.0f;
return true;
}
diff --git a/src/object/auto/autonuclear.h b/src/object/auto/autonuclear.h
index 8a4b0da..06a99af 100644
--- a/src/object/auto/autonuclear.h
+++ b/src/object/auto/autonuclear.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
@@ -44,7 +45,7 @@ public:
void Init();
bool EventProcess(const Event &event);
- Error RetError();
+ Error GetError();
bool CreateInterface(bool bSelect);
@@ -61,7 +62,7 @@ protected:
float m_progress;
float m_speed;
float m_timeVirus;
- float m_lastParticule;
+ float m_lastParticle;
Math::Vector m_pos;
int m_channelSound;
};
diff --git a/src/object/auto/autopara.cpp b/src/object/auto/autopara.cpp
index 80ce90a..b52344f 100644
--- a/src/object/auto/autopara.cpp
+++ b/src/object/auto/autopara.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
@@ -15,8 +16,6 @@
// * along with this program. If not, see http://www.gnu.org/licenses/.
-#include <stdio.h>
-
#include "object/auto/autopara.h"
@@ -26,6 +25,8 @@
#include "ui/interface.h"
#include "ui/window.h"
+#include <stdio.h>
+#include <string.h>
@@ -68,9 +69,9 @@ void CAutoPara::Init()
m_time = 0.0f;
m_timeVirus = 0.0f;
- m_lastParticule = 0.0f;
+ m_lastParticle = 0.0f;
- mat = m_object->RetWorldMatrix(0);
+ mat = m_object->GetWorldMatrix(0);
m_pos = Math::Transform(*mat, Math::Vector(22.0f, 4.0f, 0.0f));
m_phase = APAP_WAIT; // waiting ...
@@ -83,9 +84,9 @@ void CAutoPara::Init()
// Reception of lightning.
-void CAutoPara::StartBlitz()
+void CAutoPara::StartLightning()
{
- m_phase = APAP_BLITZ;
+ m_phase = APAP_LIGHTNING;
m_progress = 0.0f;
m_speed = 1.0f/2.0f;
}
@@ -101,13 +102,13 @@ bool CAutoPara::EventProcess(const Event &event)
CAuto::EventProcess(event);
- if ( m_engine->RetPause() ) return true;
- if ( event.event != EVENT_FRAME ) return true;
+ if ( m_engine->GetPause() ) return true;
+ if ( event.type != EVENT_FRAME ) return true;
m_progress += event.rTime*m_speed;
m_timeVirus -= event.rTime;
- if ( m_object->RetVirusMode() ) // contaminated by a virus?
+ if ( m_object->GetVirusMode() ) // contaminated by a virus?
{
if ( m_timeVirus <= 0.0f )
{
@@ -118,17 +119,17 @@ bool CAutoPara::EventProcess(const Event &event)
EventProgress(event.rTime);
- if ( m_phase == APAP_BLITZ )
+ if ( m_phase == APAP_LIGHTNING )
{
if ( m_progress < 1.0f )
{
- if ( m_lastParticule+m_engine->ParticuleAdapt(0.05f) <= m_time )
+ if ( m_lastParticle+m_engine->ParticleAdapt(0.05f) <= m_time )
{
- m_lastParticule = m_time;
+ m_lastParticle = m_time;
for ( i=0 ; i<10 ; i++ )
{
- pos = m_object->RetPosition(0);
+ pos = m_object->GetPosition(0);
pos.x += (Math::Rand()-0.5f)*m_progress*40.0f;
pos.z += (Math::Rand()-0.5f)*m_progress*40.0f;
pos.y += 50.0f-m_progress*50.0f;
@@ -137,7 +138,7 @@ bool CAutoPara::EventProcess(const Event &event)
speed.y = 5.0f+Math::Rand()*5.0f;
dim.x = 2.0f;
dim.y = dim.x;
- m_particule->CreateParticule(pos, speed, dim, PARTIBLITZ, 1.0f, 20.0f, 0.5f);
+ m_particle->CreateParticle(pos, speed, dim, Gfx::PARTIBLITZ, 1.0f, 20.0f, 0.5f);
}
}
}
@@ -153,20 +154,20 @@ bool CAutoPara::EventProcess(const Event &event)
{
if ( m_progress < 1.0f )
{
- if ( m_lastParticule+m_engine->ParticuleAdapt(0.05f) <= m_time )
+ if ( m_lastParticle+m_engine->ParticleAdapt(0.05f) <= m_time )
{
- m_lastParticule = m_time;
+ m_lastParticle = m_time;
for ( i=0 ; i<2 ; i++ )
{
- pos = m_object->RetPosition(0);
+ pos = m_object->GetPosition(0);
pos.y += 16.0f;
speed.x = (Math::Rand()-0.5f)*10.0f;
speed.z = (Math::Rand()-0.5f)*10.0f;
speed.y = -Math::Rand()*30.0f;
dim.x = 1.0f;
dim.y = dim.x;
- m_particule->CreateParticule(pos, speed, dim, PARTIBLITZ, 1.0f, 0.0f, 0.0f);
+ m_particle->CreateParticle(pos, speed, dim, Gfx::PARTIBLITZ, 1.0f, 0.0f, 0.0f);
}
}
@@ -188,7 +189,7 @@ bool CAutoPara::EventProcess(const Event &event)
bool CAutoPara::CreateInterface(bool bSelect)
{
- CWindow* pw;
+ Ui::CWindow* pw;
Math::Point pos, ddim;
float ox, oy, sx, sy;
@@ -196,7 +197,7 @@ bool CAutoPara::CreateInterface(bool bSelect)
if ( !bSelect ) return true;
- pw = (CWindow*)m_interface->SearchControl(EVENT_WINDOW0);
+ pw = static_cast< Ui::CWindow* >(m_interface->SearchControl(EVENT_WINDOW0));
if ( pw == 0 ) return false;
ox = 3.0f/640.0f;
@@ -220,11 +221,11 @@ bool CAutoPara::CreateInterface(bool bSelect)
}
-// Returns an error due the state of the automation.
+// Geturns an error due the state of the automation.
-Error CAutoPara::RetError()
+Error CAutoPara::GetError()
{
- if ( m_object->RetVirusMode() )
+ if ( m_object->GetVirusMode() )
{
return ERR_BAT_VIRUS;
}
@@ -242,38 +243,38 @@ void CAutoPara::ChargeObject(float rTime)
float dist, energy;
int i;
- sPos = m_object->RetPosition(0);
+ sPos = m_object->GetPosition(0);
for ( i=0 ; i<1000000 ; i++ )
{
- pObj = (CObject*)m_iMan->SearchInstance(CLASS_OBJECT, i);
+ pObj = static_cast< CObject* >(m_iMan->SearchInstance(CLASS_OBJECT, i));
if ( pObj == 0 ) break;
- oPos = pObj->RetPosition(0);
+ oPos = pObj->GetPosition(0);
dist = Math::Distance(oPos, sPos);
if ( dist > 20.0f ) continue;
- if ( pObj->RetTruck() == 0 && pObj->RetType() == OBJECT_POWER )
+ if ( pObj->GetTruck() == 0 && pObj->GetType() == OBJECT_POWER )
{
- energy = pObj->RetEnergy();
+ energy = pObj->GetEnergy();
energy += rTime/2.0f;
if ( energy > 1.0f ) energy = 1.0f;
pObj->SetEnergy(energy);
}
- power = pObj->RetPower();
- if ( power != 0 && power->RetType() == OBJECT_POWER )
+ power = pObj->GetPower();
+ if ( power != 0 && power->GetType() == OBJECT_POWER )
{
- energy = power->RetEnergy();
+ energy = power->GetEnergy();
energy += rTime/2.0f;
if ( energy > 1.0f ) energy = 1.0f;
power->SetEnergy(energy);
}
- power = pObj->RetFret();
- if ( power != 0 && power->RetType() == OBJECT_POWER )
+ power = pObj->GetFret();
+ if ( power != 0 && power->GetType() == OBJECT_POWER )
{
- energy = power->RetEnergy();
+ energy = power->GetEnergy();
energy += rTime/2.0f;
if ( energy > 1.0f ) energy = 1.0f;
power->SetEnergy(energy);
@@ -315,11 +316,11 @@ bool CAutoPara::Read(char *line)
CAuto::Read(line);
- m_phase = (AutoParaPhase)OpInt(line, "aPhase", APAP_WAIT);
+ m_phase = static_cast< AutoParaPhase >(OpInt(line, "aPhase", APAP_WAIT));
m_progress = OpFloat(line, "aProgress", 0.0f);
m_speed = OpFloat(line, "aSpeed", 1.0f);
- m_lastParticule = 0.0f;
+ m_lastParticle = 0.0f;
return true;
}
diff --git a/src/object/auto/autopara.h b/src/object/auto/autopara.h
index b230fd2..10a33a8 100644
--- a/src/object/auto/autopara.h
+++ b/src/object/auto/autopara.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
@@ -26,7 +27,7 @@
enum AutoParaPhase
{
APAP_WAIT = 1,
- APAP_BLITZ = 2,
+ APAP_LIGHTNING = 2,
APAP_CHARGE = 3,
};
@@ -42,8 +43,8 @@ public:
void Init();
bool EventProcess(const Event &event);
- Error RetError();
- void StartBlitz();
+ Error GetError();
+ void StartLightning();
bool CreateInterface(bool bSelect);
@@ -58,7 +59,7 @@ protected:
float m_progress;
float m_speed;
float m_timeVirus;
- float m_lastParticule;
+ float m_lastParticle;
Math::Vector m_pos;
int m_channelSound;
};
diff --git a/src/object/auto/autoportico.cpp b/src/object/auto/autoportico.cpp
index 5665556..9d04982 100644
--- a/src/object/auto/autoportico.cpp
+++ b/src/object/auto/autoportico.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
@@ -15,14 +16,13 @@
// * along with this program. If not, see http://www.gnu.org/licenses/.
-#include <stdio.h>
-
#include "object/auto/autoportico.h"
#include "object/robotmain.h"
-
+#include <stdio.h>
+#include <string.h>
const int PARAM_DEPOSE = 2; // run=2 -> deposits the spaceship
@@ -90,7 +90,7 @@ void CAutoPortico::DeleteObject(bool bAll)
void CAutoPortico::Init()
{
m_time = 0.0f;
- m_lastParticule = 0.0f;
+ m_lastParticle = 0.0f;
m_posTrack = 0.0f;
m_phase = APOP_WAIT;
@@ -108,7 +108,7 @@ void CAutoPortico::Start(int param)
{
Math::Vector pos;
- pos = m_object->RetPosition(0);
+ pos = m_object->GetPosition(0);
m_finalPos = pos;
pos.z += PORTICO_TIME_MOVE*5.0f; // back to start
m_object->SetPosition(0, pos);
@@ -140,15 +140,15 @@ bool CAutoPortico::EventProcess(const Event &event)
CAuto::EventProcess(event);
- if ( m_engine->RetPause() ) return true;
+ if ( m_engine->GetPause() ) return true;
if ( m_phase == APOP_START )
{
if ( m_param == PARAM_DEPOSE ) // deposits the ship?
{
- m_startPos = m_object->RetPosition(0);
+ m_startPos = m_object->GetPosition(0);
- m_soundChannel = m_sound->Play(SOUND_MOTORr, m_object->RetPosition(0), 0.0f, 0.3f, true);
+ m_soundChannel = m_sound->Play(SOUND_MOTORr, m_object->GetPosition(0), 0.0f, 0.3f, true);
m_sound->AddEnvelope(m_soundChannel, 0.5f, 0.6f, 0.5f, SOPER_CONTINUE);
m_sound->AddEnvelope(m_soundChannel, 0.5f, 0.6f, PORTICO_TIME_MOVE-0.5f, SOPER_CONTINUE);
m_sound->AddEnvelope(m_soundChannel, 0.0f, 0.3f, 0.5f, SOPER_STOP);
@@ -159,7 +159,7 @@ bool CAutoPortico::EventProcess(const Event &event)
m_main->SetMovieLock(true); // blocks everything until the end of the landing
- m_camera->SetType(CAMERA_SCRIPT);
+ m_camera->SetType(Gfx::CAM_TYPE_SCRIPT);
pos = m_startPos;
pos.x += -100.0f;
@@ -167,7 +167,7 @@ bool CAutoPortico::EventProcess(const Event &event)
pos.z += -200.0f;
m_camera->SetScriptEye(pos);
- pos = m_object->RetPosition(0);
+ pos = m_object->GetPosition(0);
pos.x += 0.0f;
pos.y += 10.0f;
pos.z += -40.0f;
@@ -187,7 +187,7 @@ bool CAutoPortico::EventProcess(const Event &event)
angle = sinf(m_time*4.0f)*0.3f;
m_object->SetAngleX(11, angle);
- if ( event.event != EVENT_FRAME ) return true;
+ if ( event.type != EVENT_FRAME ) return true;
if ( m_phase == APOP_WAIT ) return true;
m_progress += event.rTime*m_speed;
@@ -197,7 +197,7 @@ bool CAutoPortico::EventProcess(const Event &event)
{
if ( m_progress < 1.0f )
{
- pos = m_object->RetPosition(0);
+ pos = m_object->GetPosition(0);
pos.z -= event.rTime*5.0f; // advance
m_object->SetPosition(0, pos);
@@ -216,7 +216,7 @@ bool CAutoPortico::EventProcess(const Event &event)
{
if ( m_progress >= 1.0f )
{
- m_soundChannel = m_sound->Play(SOUND_MANIP, m_object->RetPosition(0), 0.0f, 0.3f, true);
+ m_soundChannel = m_sound->Play(SOUND_MANIP, m_object->GetPosition(0), 0.0f, 0.3f, true);
m_sound->AddEnvelope(m_soundChannel, 0.3f, 0.5f, 1.0f, SOPER_CONTINUE);
m_sound->AddEnvelope(m_soundChannel, 0.3f, 0.6f, PORTICO_TIME_DOWN-1.5f, SOPER_CONTINUE);
m_sound->AddEnvelope(m_soundChannel, 0.0f, 0.3f, 1.0f, SOPER_STOP);
@@ -253,12 +253,12 @@ bool CAutoPortico::EventProcess(const Event &event)
{
if ( m_progress >= 1.0f )
{
- m_soundChannel = m_sound->Play(SOUND_MANIP, m_object->RetPosition(0), 0.0f, 0.5f, true);
+ m_soundChannel = m_sound->Play(SOUND_MANIP, m_object->GetPosition(0), 0.0f, 0.5f, true);
m_sound->AddEnvelope(m_soundChannel, 0.5f, 1.0f, 0.5f, SOPER_CONTINUE);
m_sound->AddEnvelope(m_soundChannel, 0.5f, 1.0f, PORTICO_TIME_OPEN/2.0f-0.5f, SOPER_CONTINUE);
m_sound->AddEnvelope(m_soundChannel, 0.0f, 0.5f, 0.5f, SOPER_STOP);
- m_soundChannel = m_sound->Play(SOUND_MOTORr, m_object->RetPosition(0), 0.0f, 0.3f, true);
+ m_soundChannel = m_sound->Play(SOUND_MOTORr, m_object->GetPosition(0), 0.0f, 0.3f, true);
m_sound->AddEnvelope(m_soundChannel, 0.5f, 0.6f, 0.5f, SOPER_CONTINUE);
m_sound->AddEnvelope(m_soundChannel, 0.5f, 0.6f, PORTICO_TIME_OPEN-0.5f, SOPER_CONTINUE);
m_sound->AddEnvelope(m_soundChannel, 0.0f, 0.3f, 0.5f, SOPER_STOP);
@@ -273,7 +273,7 @@ bool CAutoPortico::EventProcess(const Event &event)
{
if ( m_progress < 1.0f )
{
- pos = m_object->RetPosition(0);
+ pos = m_object->GetPosition(0);
pos.z += event.rTime*5.3f; // back
m_object->SetPosition(0, pos);
@@ -308,8 +308,8 @@ bool CAutoPortico::EventProcess(const Event &event)
pObj = m_main->SearchHuman();
m_main->SelectObject(pObj);
- m_camera->SetObject(pObj);
- m_camera->SetType(CAMERA_BACK);
+ m_camera->SetControllingObject(pObj);
+ m_camera->SetType(Gfx::CAM_TYPE_BACK);
m_phase = APOP_WAIT;
m_progress = 0.0f;
@@ -319,8 +319,8 @@ bool CAutoPortico::EventProcess(const Event &event)
if ( m_soundChannel != -1 )
{
-//? m_sound->Position(m_soundChannel, m_object->RetPosition(0));
- pos = m_engine->RetEyePt();
+//? m_sound->Position(m_soundChannel, m_object->GetPosition(0));
+ pos = m_engine->GetEyePt();
m_sound->Position(m_soundChannel, pos);
}
@@ -338,7 +338,7 @@ bool CAutoPortico::EventProcess(const Event &event)
m_camera->SetScriptEye(pos);
}
- pos = m_object->RetPosition(0);
+ pos = m_object->GetPosition(0);
pos.x += 0.0f;
pos.y += 10.0f;
pos.z += -40.0f;
@@ -367,8 +367,8 @@ bool CAutoPortico::Abort()
pObj = m_main->SearchHuman();
m_main->SelectObject(pObj);
- m_camera->SetObject(pObj);
- m_camera->SetType(CAMERA_BACK);
+ m_camera->SetControllingObject(pObj);
+ m_camera->SetType(Gfx::CAM_TYPE_BACK);
if ( m_soundChannel != -1 )
{
@@ -385,9 +385,9 @@ bool CAutoPortico::Abort()
}
-// Returns an error due the state of the automation.
+// Geturns an error due the state of the automation.
-Error CAutoPortico::RetError()
+Error CAutoPortico::GetError()
{
return ERR_OK;
}
@@ -397,11 +397,11 @@ Error CAutoPortico::RetError()
void CAutoPortico::UpdateTrackMapping(float left, float right)
{
- D3DMATERIAL7 mat;
+ Gfx::Material mat;
float limit[2];
int rank;
- ZeroMemory( &mat, sizeof(D3DMATERIAL7) );
+ memset( &mat, 0, sizeof(Gfx::Material));
mat.diffuse.r = 1.0f;
mat.diffuse.g = 1.0f;
mat.diffuse.b = 1.0f; // blank
@@ -409,17 +409,17 @@ void CAutoPortico::UpdateTrackMapping(float left, float right)
mat.ambient.g = 0.5f;
mat.ambient.b = 0.5f;
- rank = m_object->RetObjectRank(0);
+ rank = m_object->GetObjectRank(0);
limit[0] = 0.0f;
limit[1] = 1000000.0f;
- m_engine->TrackTextureMapping(rank, mat, D3DSTATEPART1, "lemt.tga", "",
- limit[0], limit[1], D3DMAPPINGX,
+ m_engine->TrackTextureMapping(rank, mat, Gfx::ENG_RSTATE_PART1, "lemt.png", "",
+ limit[0], limit[1], Gfx::ENG_TEX_MAPPING_X,
right, 8.0f, 8.0f, 192.0f, 256.0f);
- m_engine->TrackTextureMapping(rank, mat, D3DSTATEPART2, "lemt.tga", "",
- limit[0], limit[1], D3DMAPPINGX,
+ m_engine->TrackTextureMapping(rank, mat, Gfx::ENG_RSTATE_PART2, "lemt.png", "",
+ limit[0], limit[1], Gfx::ENG_TEX_MAPPING_X,
left, 8.0f, 8.0f, 192.0f, 256.0f);
}
diff --git a/src/object/auto/autoportico.h b/src/object/auto/autoportico.h
index f2cd6d1..c211d37 100644
--- a/src/object/auto/autoportico.h
+++ b/src/object/auto/autoportico.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
@@ -48,7 +49,7 @@ public:
void Start(int param);
bool EventProcess(const Event &event);
bool Abort();
- Error RetError();
+ Error GetError();
protected:
void UpdateTrackMapping(float left, float right);
@@ -59,7 +60,7 @@ protected:
float m_speed;
float m_cameraProgress;
float m_cameraSpeed;
- float m_lastParticule;
+ float m_lastParticle;
Math::Vector m_finalPos;
Math::Vector m_startPos;
float m_posTrack;
diff --git a/src/object/auto/autoradar.cpp b/src/object/auto/autoradar.cpp
index 1cb20d6..b586521 100644
--- a/src/object/auto/autoradar.cpp
+++ b/src/object/auto/autoradar.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
@@ -15,8 +16,6 @@
// * along with this program. If not, see http://www.gnu.org/licenses/.
-#include <stdio.h>
-
#include "object/auto/autoradar.h"
#include "common/iman.h"
@@ -25,6 +24,8 @@
#include "ui/window.h"
#include "ui/gauge.h"
+#include <stdio.h>
+
// Object's constructor.
@@ -74,31 +75,31 @@ bool CAutoRadar::EventProcess(const Event &event)
CAuto::EventProcess(event);
- if ( m_engine->RetPause() ) return true;
- if ( event.event != EVENT_FRAME ) return true;
+ if ( m_engine->GetPause() ) return true;
+ if ( event.type != EVENT_FRAME ) return true;
if ( m_phase == ARAP_WAIT ) return true;
m_progress += event.rTime*m_speed;
m_aTime += event.rTime;
m_timeVirus -= event.rTime;
- if ( m_object->RetVirusMode() ) // contaminated by a virus?
+ if ( m_object->GetVirusMode() ) // contaminated by a virus?
{
if ( m_timeVirus <= 0.0f )
{
m_timeVirus = 0.1f+Math::Rand()*0.3f;
- angle = m_object->RetAngleY(1);
+ angle = m_object->GetAngleY(1);
angle += (Math::Rand()-0.2f)*0.5f;
m_object->SetAngleY(1, angle);
- angle = m_object->RetAngleY(2);
+ angle = m_object->GetAngleY(2);
angle += (Math::Rand()-0.8f)*1.0f;
m_object->SetAngleY(2, angle);
m_object->SetAngleX(3, (Math::Rand()-0.5f)*0.3f);
- m_totalDetect = (int)(Math::Rand()*10.0f);
+ m_totalDetect = static_cast< int >(Math::Rand()*10.0f);
UpdateInterface();
}
return true;
@@ -109,7 +110,7 @@ bool CAutoRadar::EventProcess(const Event &event)
if ( m_progress < 1.0f )
{
speed = Math::Min(10.0f, m_progress*50.0f);
- angle = m_object->RetAngleY(1);
+ angle = m_object->GetAngleY(1);
angle += event.rTime*speed;
m_object->SetAngleY(1, angle);
}
@@ -123,11 +124,11 @@ bool CAutoRadar::EventProcess(const Event &event)
}
else
{
- pos = m_object->RetPosition(0);
- m_start = m_object->RetAngleY(1);
+ pos = m_object->GetPosition(0);
+ m_start = m_object->GetAngleY(1);
m_angle = m_start-Math::NormAngle(m_start)+Math::PI*2.0f;
m_angle += Math::RotateAngle(pos.x-ePos.x, ePos.z-pos.z);
- m_angle += Math::PI-m_object->RetAngleY(0);
+ m_angle += Math::PI-m_object->GetAngleY(0);
m_phase = ARAP_SHOW;
m_progress = 0.0f;
@@ -145,7 +146,7 @@ bool CAutoRadar::EventProcess(const Event &event)
}
else
{
- m_sound->Play(SOUND_RADAR, m_object->RetPosition(0));
+ m_sound->Play(SOUND_RADAR, m_object->GetPosition(0));
m_phase = ARAP_SINUS;
m_progress = 0.0f;
@@ -182,11 +183,11 @@ bool CAutoRadar::EventProcess(const Event &event)
}
-// Returns an error due the state of the automation.
+// Geturns an error due the state of the automation.
-Error CAutoRadar::RetError()
+Error CAutoRadar::GetError()
{
- if ( m_object->RetVirusMode() )
+ if ( m_object->GetVirusMode() )
{
return ERR_BAT_VIRUS;
}
@@ -199,7 +200,7 @@ Error CAutoRadar::RetError()
bool CAutoRadar::CreateInterface(bool bSelect)
{
- CWindow* pw;
+ Ui::CWindow* pw;
Math::Point pos, dim, ddim;
float ox, oy, sx, sy;
@@ -207,7 +208,7 @@ bool CAutoRadar::CreateInterface(bool bSelect)
if ( !bSelect ) return true;
- pw = (CWindow*)m_interface->SearchControl(EVENT_WINDOW0);
+ pw = static_cast< Ui::CWindow* >(m_interface->SearchControl(EVENT_WINDOW0));
if ( pw == 0 ) return false;
ox = 3.0f/640.0f;
@@ -235,21 +236,21 @@ bool CAutoRadar::CreateInterface(bool bSelect)
void CAutoRadar::UpdateInterface()
{
- CWindow* pw;
- CGauge* pg;
+ Ui::CWindow* pw;
+ Ui::CGauge* pg;
float level;
- if ( !m_object->RetSelect() ) return;
+ if ( !m_object->GetSelect() ) return;
CAuto::UpdateInterface();
- pw = (CWindow*)m_interface->SearchControl(EVENT_WINDOW0);
+ pw = static_cast< Ui::CWindow* >(m_interface->SearchControl(EVENT_WINDOW0));
if ( pw == 0 ) return;
- pg = (CGauge*)pw->SearchControl(EVENT_OBJECT_GRADAR);
+ pg = static_cast< Ui::CGauge* >(pw->SearchControl(EVENT_OBJECT_GRADAR));
if ( pg != 0 )
{
- level = (float)m_totalDetect*(1.0f/8.0f);
+ level = static_cast< float >(m_totalDetect*(1.0f/8.0f));
if ( level > 1.0f ) level = 1.0f;
pg->SetLevel(level);
}
@@ -267,18 +268,18 @@ bool CAutoRadar::SearchEnemy(Math::Vector &pos)
float distance, min;
int i;
- iPos = m_object->RetPosition(0);
+ iPos = m_object->GetPosition(0);
min = 1000000.0f;
m_totalDetect = 0;
for ( i=0 ; i<1000000 ; i++ )
{
- pObj = (CObject*)m_iMan->SearchInstance(CLASS_OBJECT, i);
+ pObj = static_cast< CObject* >(m_iMan->SearchInstance(CLASS_OBJECT, i));
if ( pObj == 0 ) break;
- if ( !pObj->RetActif() ) continue;
+ if ( !pObj->GetActif() ) continue;
- oType = pObj->RetType();
+ oType = pObj->GetType();
if ( oType != OBJECT_ANT &&
oType != OBJECT_SPIDER &&
oType != OBJECT_BEE &&
@@ -287,7 +288,7 @@ bool CAutoRadar::SearchEnemy(Math::Vector &pos)
m_totalDetect ++;
- oPos = pObj->RetPosition(0);
+ oPos = pObj->GetPosition(0);
distance = Math::Distance(oPos, iPos);
if ( distance < min )
{
@@ -299,7 +300,7 @@ bool CAutoRadar::SearchEnemy(Math::Vector &pos)
UpdateInterface();
if ( pBest == 0 ) return false;
- pos = pBest->RetPosition(0);
+ pos = pBest->GetPosition(0);
return true;
}
diff --git a/src/object/auto/autoradar.h b/src/object/auto/autoradar.h
index 8b38ff9..e2c9df5 100644
--- a/src/object/auto/autoradar.h
+++ b/src/object/auto/autoradar.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
@@ -44,7 +45,7 @@ public:
void Init();
bool EventProcess(const Event &event);
bool CreateInterface(bool bSelect);
- Error RetError();
+ Error GetError();
protected:
void UpdateInterface();
@@ -56,7 +57,7 @@ protected:
float m_speed;
float m_aTime;
float m_timeVirus;
- float m_lastParticule;
+ float m_lastParticle;
float m_angle;
float m_start;
int m_totalDetect;
diff --git a/src/object/auto/autorepair.cpp b/src/object/auto/autorepair.cpp
index ad5deee..4662699 100644
--- a/src/object/auto/autorepair.cpp
+++ b/src/object/auto/autorepair.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
@@ -15,8 +16,6 @@
// * along with this program. If not, see http://www.gnu.org/licenses/.
-#include <stdio.h>
-
#include "object/auto/autorepair.h"
#include "common/iman.h"
@@ -25,6 +24,9 @@
#include "ui/interface.h"
#include "ui/window.h"
+#include <stdio.h>
+#include <string.h>
+
// Object's constructor.
@@ -60,7 +62,7 @@ void CAutoRepair::Init()
m_time = 0.0f;
m_timeVirus = 0.0f;
- m_lastParticule = 0.0f;
+ m_lastParticle = 0.0f;
CAuto::Init();
}
@@ -77,13 +79,13 @@ bool CAutoRepair::EventProcess(const Event &event)
CAuto::EventProcess(event);
- if ( m_engine->RetPause() ) return true;
- if ( event.event != EVENT_FRAME ) return true;
+ if ( m_engine->GetPause() ) return true;
+ if ( event.type != EVENT_FRAME ) return true;
m_progress += event.rTime*m_speed;
m_timeVirus -= event.rTime;
- if ( m_object->RetVirusMode() ) // contaminated by a virus?
+ if ( m_object->GetVirusMode() ) // contaminated by a virus?
{
if ( m_timeVirus <= 0.0f )
{
@@ -104,7 +106,7 @@ bool CAutoRepair::EventProcess(const Event &event)
}
else
{
- m_sound->Play(SOUND_OPEN, m_object->RetPosition(0), 1.0f, 0.8f);
+ m_sound->Play(SOUND_OPEN, m_object->GetPosition(0), 1.0f, 0.8f);
m_phase = ARP_DOWN;
m_progress = 0.0f;
@@ -123,7 +125,7 @@ bool CAutoRepair::EventProcess(const Event &event)
else
{
m_object->SetAngleZ(1, 0.0f);
- m_sound->Play(SOUND_REPAIR, m_object->RetPosition(0));
+ m_sound->Play(SOUND_REPAIR, m_object->GetPosition(0));
m_phase = ARP_REPAIR;
m_progress = 0.0f;
@@ -135,21 +137,21 @@ bool CAutoRepair::EventProcess(const Event &event)
{
vehicule = SearchVehicle();
if ( m_progress < 1.0f ||
- (vehicule != 0 && vehicule->RetShield() < 1.0f) )
+ (vehicule != 0 && vehicule->GetShield() < 1.0f) )
{
if ( vehicule != 0 )
{
- shield = vehicule->RetShield();
+ shield = vehicule->GetShield();
shield += event.rTime*0.2f;
if ( shield > 1.0f ) shield = 1.0f;
vehicule->SetShield(shield);
}
- if ( m_lastParticule+m_engine->ParticuleAdapt(0.05f) <= m_time )
+ if ( m_lastParticle+m_engine->ParticleAdapt(0.05f) <= m_time )
{
- m_lastParticule = m_time;
+ m_lastParticle = m_time;
- pos = m_object->RetPosition(0);
+ pos = m_object->GetPosition(0);
pos.x += (Math::Rand()-0.5f)*5.0f;
pos.z += (Math::Rand()-0.5f)*5.0f;
pos.y += 1.0f;
@@ -158,12 +160,12 @@ bool CAutoRepair::EventProcess(const Event &event)
speed.y = Math::Rand()*15.0f;
dim.x = Math::Rand()*6.0f+4.0f;
dim.y = dim.x;
- m_particule->CreateParticule(pos, speed, dim, PARTIBLUE, 1.0f, 0.0f, 0.0f);
+ m_particle->CreateParticle(pos, speed, dim, Gfx::PARTIBLUE, 1.0f, 0.0f, 0.0f);
}
}
else
{
- m_sound->Play(SOUND_OPEN, m_object->RetPosition(0), 1.0f, 0.8f);
+ m_sound->Play(SOUND_OPEN, m_object->GetPosition(0), 1.0f, 0.8f);
m_phase = ARP_UP;
m_progress = 0.0f;
@@ -196,7 +198,7 @@ bool CAutoRepair::EventProcess(const Event &event)
bool CAutoRepair::CreateInterface(bool bSelect)
{
- CWindow* pw;
+ Ui::CWindow* pw;
Math::Point pos, ddim;
float ox, oy, sx, sy;
@@ -204,7 +206,7 @@ bool CAutoRepair::CreateInterface(bool bSelect)
if ( !bSelect ) return true;
- pw = (CWindow*)m_interface->SearchControl(EVENT_WINDOW0);
+ pw = static_cast< Ui::CWindow* >(m_interface->SearchControl(EVENT_WINDOW0));
if ( pw == 0 ) return false;
ox = 3.0f/640.0f;
@@ -233,14 +235,14 @@ CObject* CAutoRepair::SearchVehicle()
float dist;
int i;
- sPos = m_object->RetPosition(0);
+ sPos = m_object->GetPosition(0);
for ( i=0 ; i<1000000 ; i++ )
{
- pObj = (CObject*)m_iMan->SearchInstance(CLASS_OBJECT, i);
+ pObj = static_cast< CObject* >(m_iMan->SearchInstance(CLASS_OBJECT, i));
if ( pObj == 0 ) break;
- type = pObj->RetType();
+ type = pObj->GetType();
if ( type != OBJECT_MOBILEfa &&
type != OBJECT_MOBILEta &&
type != OBJECT_MOBILEwa &&
@@ -269,10 +271,10 @@ CObject* CAutoRepair::SearchVehicle()
type != OBJECT_MOBILEit &&
type != OBJECT_MOBILEdr ) continue;
- physics = pObj->RetPhysics();
- if ( physics != 0 && !physics->RetLand() ) continue; // in flight?
+ physics = pObj->GetPhysics();
+ if ( physics != 0 && !physics->GetLand() ) continue; // in flight?
- oPos = pObj->RetPosition(0);
+ oPos = pObj->GetPosition(0);
dist = Math::Distance(oPos, sPos);
if ( dist <= 5.0f ) return pObj;
}
@@ -281,11 +283,11 @@ CObject* CAutoRepair::SearchVehicle()
}
-// Returns an error due the state of the automation.
+// Geturns an error due the state of the automation.
-Error CAutoRepair::RetError()
+Error CAutoRepair::GetError()
{
- if ( m_object->RetVirusMode() )
+ if ( m_object->GetVirusMode() )
{
return ERR_BAT_VIRUS;
}
@@ -327,11 +329,11 @@ bool CAutoRepair::Read(char *line)
CAuto::Read(line);
- m_phase = (AutoRepairPhase)OpInt(line, "aPhase", ARP_WAIT);
+ m_phase = static_cast< AutoRepairPhase >(OpInt(line, "aPhase", ARP_WAIT));
m_progress = OpFloat(line, "aProgress", 0.0f);
m_speed = OpFloat(line, "aSpeed", 1.0f);
- m_lastParticule = 0.0f;
+ m_lastParticle = 0.0f;
return true;
}
diff --git a/src/object/auto/autorepair.h b/src/object/auto/autorepair.h
index 1279ba3..e8bb0b1 100644
--- a/src/object/auto/autorepair.h
+++ b/src/object/auto/autorepair.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
@@ -44,7 +45,7 @@ public:
void Init();
bool EventProcess(const Event &event);
- Error RetError();
+ Error GetError();
bool CreateInterface(bool bSelect);
@@ -59,7 +60,7 @@ protected:
float m_progress;
float m_speed;
float m_timeVirus;
- float m_lastParticule;
+ float m_lastParticle;
};
diff --git a/src/object/auto/autoresearch.cpp b/src/object/auto/autoresearch.cpp
index 410e6ac..a3ce464 100644
--- a/src/object/auto/autoresearch.cpp
+++ b/src/object/auto/autoresearch.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
@@ -15,8 +16,6 @@
// * along with this program. If not, see http://www.gnu.org/licenses/.
-#include <stdio.h>
-
#include "object/auto/autoresearch.h"
#include "common/global.h"
@@ -28,6 +27,8 @@
#include "ui/window.h"
#include "ui/displaytext.h"
+#include <stdio.h>
+#include <string.h>
const float SEARCH_TIME = 30.0f; // duration of a research
@@ -84,7 +85,7 @@ void CAutoResearch::Init()
m_time = 0.0f;
m_timeVirus = 0.0f;
m_lastUpdateTime = 0.0f;
- m_lastParticule = 0.0f;
+ m_lastParticle = 0.0f;
}
@@ -100,29 +101,29 @@ bool CAutoResearch::EventProcess(const Event &event)
CAuto::EventProcess(event);
- if ( m_engine->RetPause() ) return true;
+ if ( m_engine->GetPause() ) return true;
- if ( event.event == EVENT_UPDINTERFACE )
+ if ( event.type == EVENT_UPDINTERFACE )
{
- if ( m_object->RetSelect() ) CreateInterface(true);
+ if ( m_object->GetSelect() ) CreateInterface(true);
}
- if ( m_object->RetSelect() && // center selected?
- (event.event == EVENT_OBJECT_RTANK ||
- event.event == EVENT_OBJECT_RFLY ||
- event.event == EVENT_OBJECT_RTHUMP ||
- event.event == EVENT_OBJECT_RCANON ||
- event.event == EVENT_OBJECT_RTOWER ||
- event.event == EVENT_OBJECT_RPHAZER ||
- event.event == EVENT_OBJECT_RSHIELD ||
- event.event == EVENT_OBJECT_RATOMIC ) )
+ if ( m_object->GetSelect() && // center selected?
+ (event.type == EVENT_OBJECT_RTANK ||
+ event.type == EVENT_OBJECT_RFLY ||
+ event.type == EVENT_OBJECT_RTHUMP ||
+ event.type == EVENT_OBJECT_RCANON ||
+ event.type == EVENT_OBJECT_RTOWER ||
+ event.type == EVENT_OBJECT_RPHAZER ||
+ event.type == EVENT_OBJECT_RSHIELD ||
+ event.type == EVENT_OBJECT_RATOMIC ) )
{
if ( m_phase != ALP_WAIT )
{
return false;
}
- m_research = event.event;
+ m_research = event.type;
if ( TestResearch(m_research) )
{
@@ -130,33 +131,33 @@ bool CAutoResearch::EventProcess(const Event &event)
return false;
}
- power = m_object->RetPower();
+ power = m_object->GetPower();
if ( power == 0 )
{
m_displayText->DisplayError(ERR_RESEARCH_POWER, m_object);
return false;
}
- if ( power->RetCapacity() > 1.0f )
+ if ( power->GetCapacity() > 1.0f )
{
m_displayText->DisplayError(ERR_RESEARCH_TYPE, m_object);
return false;
}
- if ( power->RetEnergy() < 1.0f )
+ if ( power->GetEnergy() < 1.0f )
{
m_displayText->DisplayError(ERR_RESEARCH_ENERGY, m_object);
return false;
}
time = SEARCH_TIME;
- if ( event.event == EVENT_OBJECT_RTANK ) time *= 0.3f;
- if ( event.event == EVENT_OBJECT_RFLY ) time *= 0.3f;
- if ( event.event == EVENT_OBJECT_RATOMIC ) time *= 2.0f;
+ if ( event.type == EVENT_OBJECT_RTANK ) time *= 0.3f;
+ if ( event.type == EVENT_OBJECT_RFLY ) time *= 0.3f;
+ if ( event.type == EVENT_OBJECT_RATOMIC ) time *= 2.0f;
SetBusy(true);
InitProgressTotal(time);
UpdateInterface();
- m_channelSound = m_sound->Play(SOUND_RESEARCH, m_object->RetPosition(0), 0.0f, 1.0f, true);
+ m_channelSound = m_sound->Play(SOUND_RESEARCH, m_object->GetPosition(0), 0.0f, 1.0f, true);
m_sound->AddEnvelope(m_channelSound, 1.0f, 1.0f, 2.0f, SOPER_CONTINUE);
m_sound->AddEnvelope(m_channelSound, 1.0f, 1.0f, time-4.0f, SOPER_CONTINUE);
m_sound->AddEnvelope(m_channelSound, 0.0f, 1.0f, 2.0f, SOPER_STOP);
@@ -167,12 +168,12 @@ bool CAutoResearch::EventProcess(const Event &event)
return true;
}
- if ( event.event != EVENT_FRAME ) return true;
+ if ( event.type != EVENT_FRAME ) return true;
m_progress += event.rTime*m_speed;
m_timeVirus -= event.rTime;
- if ( m_object->RetVirusMode() ) // contaminated by a virus?
+ if ( m_object->GetVirusMode() ) // contaminated by a virus?
{
if ( m_timeVirus <= 0.0f )
{
@@ -201,7 +202,7 @@ bool CAutoResearch::EventProcess(const Event &event)
FireStopUpdate(m_progress, true); // flashes
if ( m_progress < 1.0f )
{
- power = m_object->RetPower();
+ power = m_object->GetPower();
if ( power == 0 ) // more battery?
{
SetBusy(false);
@@ -214,11 +215,11 @@ bool CAutoResearch::EventProcess(const Event &event)
}
power->SetEnergy(1.0f-m_progress);
- if ( m_lastParticule+m_engine->ParticuleAdapt(0.05f) <= m_time )
+ if ( m_lastParticle+m_engine->ParticleAdapt(0.05f) <= m_time )
{
- m_lastParticule = m_time;
+ m_lastParticle = m_time;
- pos = m_object->RetPosition(0);
+ pos = m_object->GetPosition(0);
pos.x += (Math::Rand()-0.5f)*6.0f;
pos.z += (Math::Rand()-0.5f)*6.0f;
pos.y += 11.0f;
@@ -227,7 +228,7 @@ bool CAutoResearch::EventProcess(const Event &event)
speed.y = Math::Rand()*20.0f;
dim.x = Math::Rand()*1.0f+1.0f;
dim.y = dim.x;
- m_particule->CreateParticule(pos, speed, dim, PARTIVAPOR);
+ m_particle->CreateParticle(pos, speed, dim, Gfx::PARTIVAPOR);
}
}
else
@@ -262,9 +263,9 @@ bool CAutoResearch::EventProcess(const Event &event)
}
-// Returns an error due the state of the automation.
+// Geturns an error due the state of the automation.
-Error CAutoResearch::RetError()
+Error CAutoResearch::GetError()
{
CObject* power;
@@ -273,21 +274,21 @@ Error CAutoResearch::RetError()
return ERR_OK;
}
- if ( m_object->RetVirusMode() )
+ if ( m_object->GetVirusMode() )
{
return ERR_BAT_VIRUS;
}
- power = m_object->RetPower();
+ power = m_object->GetPower();
if ( power == 0 )
{
return ERR_RESEARCH_POWER;
}
- if ( power != 0 && power->RetCapacity() > 1.0f )
+ if ( power != 0 && power->GetCapacity() > 1.0f )
{
return ERR_RESEARCH_TYPE;
}
- if ( power != 0 && power->RetEnergy() < 1.0f )
+ if ( power != 0 && power->GetEnergy() < 1.0f )
{
return ERR_RESEARCH_ENERGY;
}
@@ -300,7 +301,7 @@ Error CAutoResearch::RetError()
bool CAutoResearch::CreateInterface(bool bSelect)
{
- CWindow* pw;
+ Ui::CWindow* pw;
Math::Point pos, dim, ddim;
float ox, oy, sx, sy;
@@ -308,7 +309,7 @@ bool CAutoResearch::CreateInterface(bool bSelect)
if ( !bSelect ) return true;
- pw = (CWindow*)m_interface->SearchControl(EVENT_WINDOW0);
+ pw = static_cast< Ui::CWindow* >(m_interface->SearchControl(EVENT_WINDOW0));
if ( pw == 0 ) return false;
dim.x = 33.0f/640.0f;
@@ -371,13 +372,13 @@ bool CAutoResearch::CreateInterface(bool bSelect)
void CAutoResearch::UpdateInterface()
{
- CWindow* pw;
+ Ui::CWindow* pw;
- if ( !m_object->RetSelect() ) return;
+ if ( !m_object->GetSelect() ) return;
CAuto::UpdateInterface();
- pw = (CWindow*)m_interface->SearchControl(EVENT_WINDOW0);
+ pw = static_cast< Ui::CWindow* >(m_interface->SearchControl(EVENT_WINDOW0));
if ( pw == 0 ) return;
DeadInterface(pw, EVENT_OBJECT_RTANK, g_researchEnable&RESEARCH_TANK);
@@ -413,8 +414,8 @@ void CAutoResearch::UpdateInterface()
void CAutoResearch::UpdateInterface(float rTime)
{
- CWindow* pw;
- CGauge* pg;
+ Ui::CWindow* pw;
+ Ui::CGauge* pg;
CObject* power;
float energy;
@@ -423,19 +424,19 @@ void CAutoResearch::UpdateInterface(float rTime)
if ( m_time < m_lastUpdateTime+0.1f ) return;
m_lastUpdateTime = m_time;
- if ( !m_object->RetSelect() ) return;
+ if ( !m_object->GetSelect() ) return;
- pw = (CWindow*)m_interface->SearchControl(EVENT_WINDOW0);
+ pw = static_cast< Ui::CWindow* >(m_interface->SearchControl(EVENT_WINDOW0));
if ( pw == 0 ) return;
- pg = (CGauge*)pw->SearchControl(EVENT_OBJECT_GENERGY);
+ pg = static_cast< Ui::CGauge* >(pw->SearchControl(EVENT_OBJECT_GENERGY));
if ( pg != 0 )
{
energy = 0.0f;
- power = m_object->RetPower();
+ power = m_object->GetPower();
if ( power != 0 )
{
- energy = power->RetEnergy();
+ energy = power->GetEnergy();
}
pg->SetLevel(energy);
}
@@ -443,20 +444,20 @@ void CAutoResearch::UpdateInterface(float rTime)
// Research shows already performed button.
-void CAutoResearch::OkayButton(CWindow *pw, EventMsg event)
+void CAutoResearch::OkayButton(Ui::CWindow *pw, EventType event)
{
- CControl* control;
+ Ui::CControl* control;
control = pw->SearchControl(event);
if ( control == 0 ) return;
- control->SetState(STATE_OKAY, TestResearch(event));
+ control->SetState(Ui::STATE_OKAY, TestResearch(event));
}
// Test whether a search has already been done.
-bool CAutoResearch::TestResearch(EventMsg event)
+bool CAutoResearch::TestResearch(EventType event)
{
if ( event == EVENT_OBJECT_RTANK ) return (g_researchDone & RESEARCH_TANK );
if ( event == EVENT_OBJECT_RFLY ) return (g_researchDone & RESEARCH_FLY );
@@ -472,9 +473,8 @@ bool CAutoResearch::TestResearch(EventMsg event)
// Indicates a search as made.
-void CAutoResearch::SetResearch(EventMsg event)
+void CAutoResearch::SetResearch(EventType event)
{
- Event newEvent;
if ( event == EVENT_OBJECT_RTANK ) g_researchDone |= RESEARCH_TANK;
if ( event == EVENT_OBJECT_RFLY ) g_researchDone |= RESEARCH_FLY;
@@ -487,7 +487,7 @@ void CAutoResearch::SetResearch(EventMsg event)
m_main->WriteFreeParam();
- m_event->MakeEvent(newEvent, EVENT_UPDINTERFACE);
+ Event newEvent(EVENT_UPDINTERFACE);
m_event->AddEvent(newEvent);
UpdateInterface();
}
@@ -518,14 +518,14 @@ void CAutoResearch::FireStopUpdate(float progress, bool bLightOn)
{
if ( m_partiStop[i] != -1 )
{
- m_particule->DeleteParticule(m_partiStop[i]);
+ m_particle->DeleteParticle(m_partiStop[i]);
m_partiStop[i] = -1;
}
}
return;
}
- mat = m_object->RetWorldMatrix(0);
+ mat = m_object->GetWorldMatrix(0);
speed = Math::Vector(0.0f, 0.0f, 0.0f);
dim.x = 2.0f;
@@ -537,7 +537,7 @@ void CAutoResearch::FireStopUpdate(float progress, bool bLightOn)
{
if ( m_partiStop[i] != -1 )
{
- m_particule->DeleteParticule(m_partiStop[i]);
+ m_particle->DeleteParticle(m_partiStop[i]);
m_partiStop[i] = -1;
}
}
@@ -549,8 +549,8 @@ void CAutoResearch::FireStopUpdate(float progress, bool bLightOn)
pos.y = 11.5f;
pos.z = listpos[i*2+1];
pos = Math::Transform(*mat, pos);
- m_partiStop[i] = m_particule->CreateParticule(pos, speed,
- dim, PARTISELY,
+ m_partiStop[i] = m_particle->CreateParticle(pos, speed,
+ dim, Gfx::PARTISELY,
1.0f, 0.0f, 0.0f);
}
}
@@ -594,13 +594,13 @@ bool CAutoResearch::Read(char *line)
CAuto::Read(line);
- m_phase = (AutoResearchPhase)OpInt(line, "aPhase", ALP_WAIT);
+ m_phase = static_cast< AutoResearchPhase >(OpInt(line, "aPhase", ALP_WAIT));
m_progress = OpFloat(line, "aProgress", 0.0f);
m_speed = OpFloat(line, "aSpeed", 1.0f);
- m_research = (EventMsg)OpInt(line, "aResearch", 0);
+ m_research = static_cast< EventType >(OpInt(line, "aResearch", 0));
m_lastUpdateTime = 0.0f;
- m_lastParticule = 0.0f;
+ m_lastParticle = 0.0f;
return true;
}
diff --git a/src/object/auto/autoresearch.h b/src/object/auto/autoresearch.h
index b60f4bd..a838e64 100644
--- a/src/object/auto/autoresearch.h
+++ b/src/object/auto/autoresearch.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
@@ -41,7 +42,7 @@ public:
void Init();
bool EventProcess(const Event &event);
- Error RetError();
+ Error GetError();
bool CreateInterface(bool bSelect);
@@ -51,9 +52,9 @@ public:
protected:
void UpdateInterface();
void UpdateInterface(float rTime);
- void OkayButton(CWindow *pw, EventMsg event);
- bool TestResearch(EventMsg event);
- void SetResearch(EventMsg event);
+ void OkayButton(Ui::CWindow *pw, EventType event);
+ bool TestResearch(EventType event);
+ void SetResearch(EventType event);
void FireStopUpdate(float progress, bool bLightOn);
protected:
@@ -62,8 +63,8 @@ protected:
float m_speed;
float m_timeVirus;
float m_lastUpdateTime;
- float m_lastParticule;
- EventMsg m_research;
+ float m_lastParticle;
+ EventType m_research;
int m_partiStop[6];
int m_channelSound;
};
diff --git a/src/object/auto/autoroot.cpp b/src/object/auto/autoroot.cpp
index 9282a01..4413d56 100644
--- a/src/object/auto/autoroot.cpp
+++ b/src/object/auto/autoroot.cpp
@@ -15,15 +15,13 @@
// * along with this program. If not, see http://www.gnu.org/licenses/.
-#include <stdio.h>
-
#include "object/auto/autoroot.h"
-#include "old/particule.h"
-#include "old/terrain.h"
+#include "graphics/engine/particle.h"
+#include "graphics/engine/terrain.h"
#include "math/geometry.h"
-
+#include <stdio.h>
// Object's constructor.
@@ -58,9 +56,9 @@ void CAutoRoot::Init()
Math::Point dim;
m_time = 0.0f;
- m_lastParticule = 0.0f;
+ m_lastParticle = 0.0f;
- mat = m_object->RetWorldMatrix(0);
+ mat = m_object->GetWorldMatrix(0);
pos = Math::Vector(-5.0f, 28.0f, -4.0f); // peak position
pos = Math::Transform(*mat, pos);
m_center = pos;
@@ -68,7 +66,7 @@ void CAutoRoot::Init()
speed = Math::Vector(0.0f, 0.0f, 0.0f);
dim.x = 100.0f;
dim.y = dim.x;
- m_particule->CreateParticule(m_center, speed, dim, PARTISPHERE5, 0.5f, 0.0f, 0.0f);
+ m_particle->CreateParticle(m_center, speed, dim, Gfx::PARTISPHERE5, 0.5f, 0.0f, 0.0f);
m_terrain->AddFlyingLimit(pos, 100.0f, 80.0f, pos.y-60.0f);
}
@@ -83,16 +81,16 @@ bool CAutoRoot::EventProcess(const Event &event)
CAuto::EventProcess(event);
- if ( m_engine->RetPause() ) return true;
- if ( event.event != EVENT_FRAME ) return true;
+ if ( m_engine->GetPause() ) return true;
+ if ( event.type != EVENT_FRAME ) return true;
m_object->SetZoomX(1, 1.0f+sinf(m_time*2.0f)*0.2f);
m_object->SetZoomY(1, 1.0f+sinf(m_time*2.3f)*0.2f);
m_object->SetZoomZ(1, 1.0f+sinf(m_time*2.7f)*0.2f);
- if ( m_lastParticule+m_engine->ParticuleAdapt(0.10f) <= m_time )
+ if ( m_lastParticle+m_engine->ParticleAdapt(0.10f) <= m_time )
{
- m_lastParticule = m_time;
+ m_lastParticle = m_time;
pos = m_center;
pos.x += (Math::Rand()-0.5f)*8.0f;
@@ -103,16 +101,16 @@ bool CAutoRoot::EventProcess(const Event &event)
speed.y = Math::Rand()*12.0f;
dim.x = Math::Rand()*6.0f+4.0f;
dim.y = dim.x;
- m_particule->CreateParticule(pos, speed, dim, PARTIROOT, 1.0f, 0.0f, 0.0f);
+ m_particle->CreateParticle(pos, speed, dim, Gfx::PARTIROOT, 1.0f, 0.0f, 0.0f);
}
return true;
}
-// Returns an error due the state of the automation.
+// Geturns an error due the state of the automation.
-Error CAutoRoot::RetError()
+Error CAutoRoot::GetError()
{
return ERR_OK;
}
diff --git a/src/object/auto/autoroot.h b/src/object/auto/autoroot.h
index 1ecd5ba..d80abe8 100644
--- a/src/object/auto/autoroot.h
+++ b/src/object/auto/autoroot.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
@@ -33,12 +34,12 @@ public:
void Init();
bool EventProcess(const Event &event);
- Error RetError();
+ Error GetError();
protected:
protected:
- float m_lastParticule;
+ float m_lastParticle;
Math::Vector m_center;
};
diff --git a/src/object/auto/autosafe.cpp b/src/object/auto/autosafe.cpp
index 11aac18..ea0c183 100644
--- a/src/object/auto/autosafe.cpp
+++ b/src/object/auto/autosafe.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
@@ -15,8 +16,6 @@
// * along with this program. If not, see http://www.gnu.org/licenses/.
-#include <stdio.h>
-
#include "object/auto/autosafe.h"
#include "common/iman.h"
@@ -26,6 +25,9 @@
#include "ui/interface.h"
#include "ui/window.h"
+#include <stdio.h>
+#include <string.h>
+
const float OPEN_DELAY = 8.0f; // duration of opening
@@ -44,7 +46,7 @@ CAutoSafe::CAutoSafe(CInstanceManager* iMan, CObject* object)
}
m_bLock = false;
- m_lastParticule = 0.0f;
+ m_lastParticle = 0.0f;
m_channelSound = -1;
Init();
}
@@ -86,7 +88,7 @@ void CAutoSafe::Init()
{
m_time = 0.0f;
m_timeVirus = 0.0f;
- m_lastParticule = 0.0f;
+ m_lastParticle = 0.0f;
m_countKeys = 0;
m_actualAngle = 0.0f;
@@ -111,13 +113,13 @@ bool CAutoSafe::EventProcess(const Event &event)
CAuto::EventProcess(event);
- if ( m_engine->RetPause() ) return true;
- if ( event.event != EVENT_FRAME ) return true;
+ if ( m_engine->GetPause() ) return true;
+ if ( event.type != EVENT_FRAME ) return true;
m_progress += event.rTime*m_speed;
m_timeVirus -= event.rTime;
- if ( m_object->RetVirusMode() ) // contaminated by a virus?
+ if ( m_object->GetVirusMode() ) // contaminated by a virus?
{
if ( m_timeVirus <= 0.0f )
{
@@ -158,7 +160,7 @@ bool CAutoSafe::EventProcess(const Event &event)
{
LockKeys();
- m_channelSound = m_sound->Play(SOUND_MANIP, m_object->RetPosition(0), 1.0f, 0.25f, true);
+ m_channelSound = m_sound->Play(SOUND_MANIP, m_object->GetPosition(0), 1.0f, 0.25f, true);
m_sound->AddEnvelope(m_channelSound, 1.0f, 2.00f, OPEN_DELAY, SOPER_STOP);
m_phase = ASAP_OPEN;
@@ -168,7 +170,7 @@ bool CAutoSafe::EventProcess(const Event &event)
}
else
{
- m_channelSound = m_sound->Play(SOUND_MANIP, m_object->RetPosition(0), 1.0f, 0.25f, true);
+ m_channelSound = m_sound->Play(SOUND_MANIP, m_object->GetPosition(0), 1.0f, 0.25f, true);
m_sound->AddEnvelope(m_channelSound, 1.0f, 0.35f, 0.5f, SOPER_STOP);
}
}
@@ -185,13 +187,13 @@ bool CAutoSafe::EventProcess(const Event &event)
{
DownKeys(m_progress);
- if ( m_lastParticule+m_engine->ParticuleAdapt(0.05f) <= m_time )
+ if ( m_lastParticle+m_engine->ParticleAdapt(0.05f) <= m_time )
{
- m_lastParticule = m_time;
+ m_lastParticle = m_time;
for ( i=0 ; i<10 ; i++ )
{
- pos = m_object->RetPosition(0);
+ pos = m_object->GetPosition(0);
pos.x += (Math::Rand()-0.5f)*10.0f;
pos.z += (Math::Rand()-0.5f)*10.0f;
speed.x = (Math::Rand()-0.5f)*4.0f;
@@ -199,10 +201,10 @@ bool CAutoSafe::EventProcess(const Event &event)
speed.y = Math::Rand()*15.0f;
dim.x = Math::Rand()*6.0f+4.0f;
dim.y = dim.x;
- m_particule->CreateParticule(pos, speed, dim, PARTIBLUE, 1.0f, 0.0f, 0.0f);
+ m_particle->CreateParticle(pos, speed, dim, Gfx::PARTIBLUE, 1.0f, 0.0f, 0.0f);
}
- pos = m_object->RetPosition(0);
+ pos = m_object->GetPosition(0);
pos.x += (Math::Rand()-0.5f)*10.0f;
pos.z += (Math::Rand()-0.5f)*10.0f;
speed.x = (Math::Rand()-0.5f)*4.0f;
@@ -210,7 +212,7 @@ bool CAutoSafe::EventProcess(const Event &event)
speed.y = Math::Rand()*10.0f;
dim.x = Math::Rand()*3.0f+2.0f;
dim.y = dim.x;
- m_particule->CreateParticule(pos, speed, dim, PARTIGLINT, 1.0f, 0.0f, 0.0f);
+ m_particle->CreateParticle(pos, speed, dim, Gfx::PARTIGLINT, 1.0f, 0.0f, 0.0f);
for ( i=0 ; i<4 ; i++ )
{
@@ -220,7 +222,7 @@ bool CAutoSafe::EventProcess(const Event &event)
speed.y = 1.0f+Math::Rand()*1.0f;
dim.x = Math::Rand()*1.5f+1.5f;
dim.y = dim.x;
- m_particule->CreateParticule(pos, speed, dim, PARTISMOKE3, 4.0f, 0.0f, 0.0f);
+ m_particle->CreateParticle(pos, speed, dim, Gfx::PARTISMOKE3, 4.0f, 0.0f, 0.0f);
}
}
}
@@ -238,7 +240,7 @@ bool CAutoSafe::EventProcess(const Event &event)
m_object->FlushCrashShere();
m_object->SetGlobalSphere(Math::Vector(0.0f, 0.0f, 0.0f), 0.0f);
- m_sound->Play(SOUND_FINDING, m_object->RetPosition(0));
+ m_sound->Play(SOUND_FINDING, m_object->GetPosition(0));
m_phase = ASAP_FINISH;
m_progress = 0.0f;
@@ -283,7 +285,7 @@ bool CAutoSafe::EventProcess(const Event &event)
{
if ( m_keyParti[i] != -1 )
{
- m_particule->DeleteParticule(m_keyParti[i]);
+ m_particle->DeleteParticle(m_keyParti[i]);
m_keyParti[i] = -1;
}
}
@@ -293,7 +295,7 @@ bool CAutoSafe::EventProcess(const Event &event)
{
pos = m_keyPos[i];
pos.y += 2.2f;
- m_keyParti[i] = m_particule->CreateParticule(pos, speed, dim, PARTISELY, 1.0f, 0.0f, 0.0f);
+ m_keyParti[i] = m_particle->CreateParticle(pos, speed, dim, Gfx::PARTISELY, 1.0f, 0.0f, 0.0f);
}
}
}
@@ -306,7 +308,7 @@ bool CAutoSafe::EventProcess(const Event &event)
bool CAutoSafe::CreateInterface(bool bSelect)
{
- CWindow* pw;
+ Ui::CWindow* pw;
Math::Point pos, ddim;
float ox, oy, sx, sy;
@@ -314,7 +316,7 @@ bool CAutoSafe::CreateInterface(bool bSelect)
if ( !bSelect ) return true;
- pw = (CWindow*)m_interface->SearchControl(EVENT_WINDOW0);
+ pw = static_cast< Ui::CWindow* >(m_interface->SearchControl(EVENT_WINDOW0));
if ( pw == 0 ) return false;
ox = 3.0f/640.0f;
@@ -332,11 +334,11 @@ bool CAutoSafe::CreateInterface(bool bSelect)
}
-// Returns an error due the state of the automation.
+// Geturns an error due the state of the automation.
-Error CAutoSafe::RetError()
+Error CAutoSafe::GetError()
{
- if ( m_object->RetVirusMode() )
+ if ( m_object->GetVirusMode() )
{
return ERR_BAT_VIRUS;
}
@@ -377,11 +379,11 @@ bool CAutoSafe::Read(char *line)
CAuto::Read(line);
- m_phase = (AutoSafePhase)OpInt(line, "aPhase", ASAP_WAIT);
+ m_phase = static_cast< AutoSafePhase >(OpInt(line, "aPhase", ASAP_WAIT));
m_progress = OpFloat(line, "aProgress", 0.0f);
m_speed = OpFloat(line, "aSpeed", 1.0f);
- m_lastParticule = 0.0f;
+ m_lastParticle = 0.0f;
return true;
}
@@ -398,8 +400,8 @@ int CAutoSafe::CountKeys()
float dist, angle, limit, cAngle, oAngle;
int i, index;
- cPos = m_object->RetPosition(0);
- cAngle = m_object->RetAngleY(0);
+ cPos = m_object->GetPosition(0);
+ cAngle = m_object->GetAngleY(0);
for ( index=0 ; index<4 ; index++ )
{
@@ -409,18 +411,18 @@ int CAutoSafe::CountKeys()
for ( i=0 ; i<1000000 ; i++ )
{
- pObj = (CObject*)m_iMan->SearchInstance(CLASS_OBJECT, i);
+ pObj = static_cast< CObject* >(m_iMan->SearchInstance(CLASS_OBJECT, i));
if ( pObj == 0 ) break;
- oType = pObj->RetType();
- if ( pObj->RetTruck() != 0 ) continue;
+ if ( pObj->GetTruck() != 0 ) continue;
+ oType = pObj->GetType();
if ( oType != OBJECT_KEYa &&
oType != OBJECT_KEYb &&
oType != OBJECT_KEYc &&
oType != OBJECT_KEYd ) continue;
- oPos = pObj->RetPosition(0);
+ oPos = pObj->GetPosition(0);
dist = Math::DistanceProjected(oPos, cPos);
if ( dist > 20.0f ) continue;
@@ -482,22 +484,22 @@ void CAutoSafe::LockKeys()
float dist;
int i;
- cPos = m_object->RetPosition(0);
+ cPos = m_object->GetPosition(0);
for ( i=0 ; i<1000000 ; i++ )
{
- pObj = (CObject*)m_iMan->SearchInstance(CLASS_OBJECT, i);
+ pObj = static_cast< CObject* >(m_iMan->SearchInstance(CLASS_OBJECT, i));
if ( pObj == 0 ) break;
- oType = pObj->RetType();
- if ( pObj->RetTruck() != 0 ) continue;
+ oType = pObj->GetType();
+ if ( pObj->GetTruck() != 0 ) continue;
if ( oType != OBJECT_KEYa &&
oType != OBJECT_KEYb &&
oType != OBJECT_KEYc &&
oType != OBJECT_KEYd ) continue;
- oPos = pObj->RetPosition(0);
+ oPos = pObj->GetPosition(0);
dist = Math::DistanceProjected(oPos, cPos);
if ( dist > 20.0f ) continue;
@@ -515,22 +517,22 @@ void CAutoSafe::DownKeys(float progress)
float dist;
int i;
- cPos = m_object->RetPosition(0);
+ cPos = m_object->GetPosition(0);
for ( i=0 ; i<1000000 ; i++ )
{
- pObj = (CObject*)m_iMan->SearchInstance(CLASS_OBJECT, i);
+ pObj = static_cast< CObject* >(m_iMan->SearchInstance(CLASS_OBJECT, i));
if ( pObj == 0 ) break;
- oType = pObj->RetType();
- if ( pObj->RetTruck() != 0 ) continue;
+ oType = pObj->GetType();
+ if ( pObj->GetTruck() != 0 ) continue;
if ( oType != OBJECT_KEYa &&
oType != OBJECT_KEYb &&
oType != OBJECT_KEYc &&
oType != OBJECT_KEYd ) continue;
- oPos = pObj->RetPosition(0);
+ oPos = pObj->GetPosition(0);
dist = Math::DistanceProjected(oPos, cPos);
if ( dist > 20.0f ) continue;
@@ -550,25 +552,25 @@ void CAutoSafe::DeleteKeys()
int i;
bool bDelete;
- cPos = m_object->RetPosition(0);
+ cPos = m_object->GetPosition(0);
do
{
bDelete = false;
for ( i=0 ; i<1000000 ; i++ )
{
- pObj = (CObject*)m_iMan->SearchInstance(CLASS_OBJECT, i);
+ pObj = static_cast< CObject* >(m_iMan->SearchInstance(CLASS_OBJECT, i));
if ( pObj == 0 ) break;
- oType = pObj->RetType();
- if ( pObj->RetTruck() != 0 ) continue;
+ oType = pObj->GetType();
+ if ( pObj->GetTruck() != 0 ) continue;
if ( oType != OBJECT_KEYa &&
oType != OBJECT_KEYb &&
oType != OBJECT_KEYc &&
oType != OBJECT_KEYd ) continue;
- oPos = pObj->RetPosition(0);
+ oPos = pObj->GetPosition(0);
dist = Math::DistanceProjected(oPos, cPos);
if ( dist > 20.0f ) continue;
@@ -586,22 +588,20 @@ CObject* CAutoSafe::SearchVehicle()
{
CObject* pObj;
Math::Vector cPos, oPos;
- ObjectType oType;
float dist;
int i;
- cPos = m_object->RetPosition(0);
+ cPos = m_object->GetPosition(0);
for ( i=0 ; i<1000000 ; i++ )
{
- pObj = (CObject*)m_iMan->SearchInstance(CLASS_OBJECT, i);
+ pObj = static_cast< CObject* >(m_iMan->SearchInstance(CLASS_OBJECT, i));
if ( pObj == 0 ) break;
- oType = pObj->RetType();
if ( pObj == m_object ) continue;
- if ( pObj->RetTruck() != 0 ) continue;
+ if ( pObj->GetTruck() != 0 ) continue;
- oPos = pObj->RetPosition(0);
+ oPos = pObj->GetPosition(0);
dist = Math::DistanceProjected(oPos, cPos);
if ( dist <= 4.0f ) return pObj;
}
diff --git a/src/object/auto/autosafe.h b/src/object/auto/autosafe.h
index d17435b..3c0bcce 100644
--- a/src/object/auto/autosafe.h
+++ b/src/object/auto/autosafe.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
@@ -42,7 +43,7 @@ public:
void Init();
bool EventProcess(const Event &event);
- Error RetError();
+ Error GetError();
bool CreateInterface(bool bSelect);
@@ -61,7 +62,7 @@ protected:
float m_progress;
float m_speed;
float m_timeVirus;
- float m_lastParticule;
+ float m_lastParticle;
int m_channelSound;
bool m_bLock;
int m_countKeys;
diff --git a/src/object/auto/autostation.cpp b/src/object/auto/autostation.cpp
index dba4ed8..1dbcf26 100644
--- a/src/object/auto/autostation.cpp
+++ b/src/object/auto/autostation.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
@@ -15,19 +16,17 @@
// * along with this program. If not, see http://www.gnu.org/licenses/.
-#include <stdio.h>
-
#include "object/auto/autostation.h"
#include "common/iman.h"
-#include "old/particule.h"
-#include "old/terrain.h"
+#include "graphics/engine/particle.h"
+#include "graphics/engine/terrain.h"
#include "math/geometry.h"
#include "ui/interface.h"
#include "ui/gauge.h"
#include "ui/window.h"
-
+#include <stdio.h>
// Object's constructor.
@@ -66,7 +65,7 @@ void CAutoStation::Init()
m_time = 0.0f;
m_timeVirus = 0.0f;
m_lastUpdateTime = 0.0f;
- m_lastParticule = 0.0f;
+ m_lastParticle = 0.0f;
m_soundChannel = -1;
m_bLastVirus = false;
@@ -83,22 +82,22 @@ bool CAutoStation::EventProcess(const Event &event)
Math::Point dim;
CObject* vehicule;
CObject* power;
- TerrainRes res;
+ Gfx::TerrainRes res;
float big, energy, used, add, freq;
CAuto::EventProcess(event);
- if ( m_engine->RetPause() ) return true;
- if ( event.event != EVENT_FRAME ) return true;
+ if ( m_engine->GetPause() ) return true;
+ if ( event.type != EVENT_FRAME ) return true;
m_timeVirus -= event.rTime;
- if ( m_object->RetVirusMode() ) // contaminated by a virus?
+ if ( m_object->GetVirusMode() ) // contaminated by a virus?
{
if ( !m_bLastVirus )
{
m_bLastVirus = true;
- m_energyVirus = m_object->RetEnergy();
+ m_energyVirus = m_object->GetEnergy();
}
if ( m_timeVirus <= 0.0f )
@@ -120,10 +119,10 @@ bool CAutoStation::EventProcess(const Event &event)
UpdateInterface(event.rTime);
- big = m_object->RetEnergy();
+ big = m_object->GetEnergy();
- res = m_terrain->RetResource(m_object->RetPosition(0));
- if ( res == TR_POWER )
+ res = m_terrain->GetResource(m_object->GetPosition(0));
+ if ( res == Gfx::TR_POWER )
{
big += event.rTime*0.01f; // recharges the large battery
}
@@ -135,10 +134,10 @@ bool CAutoStation::EventProcess(const Event &event)
vehicule = SearchVehicle();
if ( vehicule != 0 )
{
- power = vehicule->RetPower();
- if ( power != 0 && power->RetCapacity() == 1.0f )
+ power = vehicule->GetPower();
+ if ( power != 0 && power->GetCapacity() == 1.0f )
{
- energy = power->RetEnergy();
+ energy = power->GetEnergy();
add = event.rTime*0.2f;
if ( add > big*4.0f ) add = big*4.0f;
if ( add > 1.0f-energy ) add = 1.0f-energy;
@@ -148,10 +147,10 @@ bool CAutoStation::EventProcess(const Event &event)
big -= add/4.0f; // discharge the large battery
}
- power = vehicule->RetFret();
- if ( power != 0 && power->RetType() == OBJECT_POWER )
+ power = vehicule->GetFret();
+ if ( power != 0 && power->GetType() == OBJECT_POWER )
{
- energy = power->RetEnergy();
+ energy = power->GetEnergy();
add = event.rTime*0.2f;
if ( add > big*4.0f ) add = big*4.0f;
if ( add > 1.0f-energy ) add = 1.0f-energy;
@@ -169,7 +168,7 @@ bool CAutoStation::EventProcess(const Event &event)
freq = 1.0f+3.0f*freq;
if ( m_soundChannel == -1 )
{
- m_soundChannel = m_sound->Play(SOUND_STATION, m_object->RetPosition(0),
+ m_soundChannel = m_sound->Play(SOUND_STATION, m_object->GetPosition(0),
0.3f, freq, true);
}
m_sound->Frequency(m_soundChannel, freq);
@@ -184,11 +183,11 @@ bool CAutoStation::EventProcess(const Event &event)
}
if ( used != 0.0f &&
- m_lastParticule+m_engine->ParticuleAdapt(0.05f) <= m_time )
+ m_lastParticle+m_engine->ParticleAdapt(0.05f) <= m_time )
{
- m_lastParticule = m_time;
+ m_lastParticle = m_time;
- mat = m_object->RetWorldMatrix(0);
+ mat = m_object->GetWorldMatrix(0);
pos = Math::Vector(-15.0f, 7.0f, 0.0f); // battery position
pos = Math::Transform(*mat, pos);
speed.x = (Math::Rand()-0.5f)*20.0f;
@@ -199,7 +198,7 @@ bool CAutoStation::EventProcess(const Event &event)
ppos.z = pos.z;
dim.x = 1.5f;
dim.y = 1.5f;
- m_particule->CreateParticule(ppos, speed, dim, PARTIBLITZ, 1.0f, 0.0f, 0.0f);
+ m_particle->CreateParticle(ppos, speed, dim, Gfx::PARTIBLITZ, 1.0f, 0.0f, 0.0f);
#if 0
ppos = pos;
@@ -211,7 +210,7 @@ bool CAutoStation::EventProcess(const Event &event)
speed.y = 2.5f+Math::Rand()*6.0f;
dim.x = Math::Rand()*1.5f+1.0f;
dim.y = dim.x;
- m_particule->CreateParticule(ppos, speed, dim, PARTISMOKE3, 4.0f);
+ m_particle->CreateParticle(ppos, speed, dim, Gfx::PARTISMOKE3, 4.0f);
#else
ppos = pos;
ppos.y += 1.0f;
@@ -222,7 +221,7 @@ bool CAutoStation::EventProcess(const Event &event)
speed.y = 2.5f+Math::Rand()*5.0f;
dim.x = Math::Rand()*1.0f+0.6f;
dim.y = dim.x;
- m_particule->CreateParticule(ppos, speed, dim, PARTIVAPOR, 3.0f);
+ m_particle->CreateParticle(ppos, speed, dim, Gfx::PARTIVAPOR, 3.0f);
#endif
}
@@ -244,14 +243,14 @@ CObject* CAutoStation::SearchVehicle()
float dist;
int i;
- sPos = m_object->RetPosition(0);
+ sPos = m_object->GetPosition(0);
for ( i=0 ; i<1000000 ; i++ )
{
- pObj = (CObject*)m_iMan->SearchInstance(CLASS_OBJECT, i);
+ pObj = static_cast< CObject* >(m_iMan->SearchInstance(CLASS_OBJECT, i));
if ( pObj == 0 ) break;
- type = pObj->RetType();
+ type = pObj->GetType();
if ( type != OBJECT_HUMAN &&
type != OBJECT_MOBILEfa &&
type != OBJECT_MOBILEta &&
@@ -280,7 +279,7 @@ CObject* CAutoStation::SearchVehicle()
type != OBJECT_MOBILEit &&
type != OBJECT_MOBILEdr ) continue;
- oPos = pObj->RetPosition(0);
+ oPos = pObj->GetPosition(0);
dist = Math::Distance(oPos, sPos);
if ( dist <= 5.0f ) return pObj;
}
@@ -289,19 +288,19 @@ CObject* CAutoStation::SearchVehicle()
}
-// Returns an error due the state of the automation.
+// Geturns an error due the state of the automation.
-Error CAutoStation::RetError()
+Error CAutoStation::GetError()
{
- TerrainRes res;
+ Gfx::TerrainRes res;
- if ( m_object->RetVirusMode() )
+ if ( m_object->GetVirusMode() )
{
return ERR_BAT_VIRUS;
}
- res = m_terrain->RetResource(m_object->RetPosition(0));
- if ( res != TR_POWER ) return ERR_STATION_NULL;
+ res = m_terrain->GetResource(m_object->GetPosition(0));
+ if ( res != Gfx::TR_POWER ) return ERR_STATION_NULL;
return ERR_OK;
}
@@ -311,7 +310,7 @@ Error CAutoStation::RetError()
bool CAutoStation::CreateInterface(bool bSelect)
{
- CWindow* pw;
+ Ui::CWindow* pw;
Math::Point pos, ddim;
float ox, oy, sx, sy;
@@ -319,7 +318,7 @@ bool CAutoStation::CreateInterface(bool bSelect)
if ( !bSelect ) return true;
- pw = (CWindow*)m_interface->SearchControl(EVENT_WINDOW0);
+ pw = static_cast< Ui::CWindow* >(m_interface->SearchControl(EVENT_WINDOW0));
if ( pw == 0 ) return false;
ox = 3.0f/640.0f;
@@ -347,23 +346,23 @@ bool CAutoStation::CreateInterface(bool bSelect)
void CAutoStation::UpdateInterface(float rTime)
{
- CWindow* pw;
- CGauge* pg;
+ Ui::CWindow* pw;
+ Ui::CGauge* pg;
CAuto::UpdateInterface(rTime);
if ( m_time < m_lastUpdateTime+0.1f ) return;
m_lastUpdateTime = m_time;
- if ( !m_object->RetSelect() ) return;
+ if ( !m_object->GetSelect() ) return;
- pw = (CWindow*)m_interface->SearchControl(EVENT_WINDOW0);
+ pw = static_cast< Ui::CWindow* >(m_interface->SearchControl(EVENT_WINDOW0));
if ( pw == 0 ) return;
- pg = (CGauge*)pw->SearchControl(EVENT_OBJECT_GENERGY);
+ pg = static_cast< Ui::CGauge* >(pw->SearchControl(EVENT_OBJECT_GENERGY));
if ( pg != 0 )
{
- pg->SetLevel(m_object->RetEnergy());
+ pg->SetLevel(m_object->GetEnergy());
}
}
diff --git a/src/object/auto/autostation.h b/src/object/auto/autostation.h
index 5bf2b72..cb8be2b 100644
--- a/src/object/auto/autostation.h
+++ b/src/object/auto/autostation.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
@@ -33,7 +34,7 @@ public:
void Init();
bool EventProcess(const Event &event);
- Error RetError();
+ Error GetError();
bool CreateInterface(bool bSelect);
@@ -47,7 +48,7 @@ protected:
float m_speed;
float m_timeVirus;
float m_lastUpdateTime;
- float m_lastParticule;
+ float m_lastParticle;
int m_soundChannel;
Math::Vector m_fretPos;
bool m_bLastVirus;
diff --git a/src/object/auto/autotower.cpp b/src/object/auto/autotower.cpp
index 5f185fe..7674794 100644
--- a/src/object/auto/autotower.cpp
+++ b/src/object/auto/autotower.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
@@ -15,8 +16,6 @@
// * along with this program. If not, see http://www.gnu.org/licenses/.
-#include <stdio.h>
-
#include "object/auto/autotower.h"
#include "common/iman.h"
@@ -28,6 +27,9 @@
#include "ui/window.h"
#include "ui/gauge.h"
+#include <stdio.h>
+#include <string.h>
+
const float TOWER_SCOPE = 200.0f; // range of beam
const float ENERGY_FIRE = 0.125f; // energy consumed by fire
@@ -78,7 +80,7 @@ void CAutoTower::Init()
m_time = 0.0f;
m_timeVirus = 0.0f;
m_lastUpdateTime = 0.0f;
- m_lastParticule = 0.0f;
+ m_lastParticle = 0.0f;
}
@@ -93,18 +95,18 @@ bool CAutoTower::EventProcess(const Event &event)
CAuto::EventProcess(event);
- if ( m_engine->RetPause() ) return true;
- if ( event.event != EVENT_FRAME ) return true;
+ if ( m_engine->GetPause() ) return true;
+ if ( event.type != EVENT_FRAME ) return true;
m_timeVirus -= event.rTime;
- if ( m_object->RetVirusMode() ) // contaminated by a virus?
+ if ( m_object->GetVirusMode() ) // contaminated by a virus?
{
if ( m_timeVirus <= 0.0f )
{
m_timeVirus = 0.1f+Math::Rand()*0.3f;
- angle = m_object->RetAngleY(1);
+ angle = m_object->GetAngleY(1);
angle += Math::Rand()*0.5f;
m_object->SetAngleY(1, angle);
@@ -125,10 +127,10 @@ bool CAutoTower::EventProcess(const Event &event)
if ( m_progress < 1.0f )
{
energy = 0.0f;
- power = m_object->RetPower();
+ power = m_object->GetPower();
if ( power != 0 )
{
- energy = power->RetEnergy();
+ energy = power->GetEnergy();
}
if ( energy >= ENERGY_FIRE )
{
@@ -153,11 +155,11 @@ bool CAutoTower::EventProcess(const Event &event)
quick = 1.0f;
//? if ( g_researchDone & RESEARCH_QUICK ) quick = 3.0f;
- angle = m_object->RetAngleY(1);
+ angle = m_object->GetAngleY(1);
angle -= event.rTime*quick*2.0f;
m_object->SetAngleY(1, angle);
- angle = m_object->RetAngleZ(2);
+ angle = m_object->GetAngleZ(2);
angle += event.rTime*quick*0.5f;
if ( angle > 0.0f ) angle = 0.0f;
m_object->SetAngleZ(2, angle);
@@ -165,10 +167,10 @@ bool CAutoTower::EventProcess(const Event &event)
else
{
energy = 0.0f;
- power = m_object->RetPower();
+ power = m_object->GetPower();
if ( power != 0 )
{
- energy = power->RetEnergy();
+ energy = power->GetEnergy();
}
target = SearchTarget(m_targetPos);
@@ -184,16 +186,16 @@ bool CAutoTower::EventProcess(const Event &event)
}
else
{
- pos = m_object->RetPosition(0);
+ pos = m_object->GetPosition(0);
pos.y += 24.5f;
m_angleYfinal = Math::RotateAngle(m_targetPos.x-pos.x, pos.z-m_targetPos.z); // CW !
m_angleYfinal += Math::PI*2.0f;
- m_angleYfinal -= m_object->RetAngleY(0);
- m_angleYactual = Math::NormAngle(m_object->RetAngleY(1));
+ m_angleYfinal -= m_object->GetAngleY(0);
+ m_angleYactual = Math::NormAngle(m_object->GetAngleY(1));
m_angleZfinal = -Math::PI/2.0f;
m_angleZfinal -= Math::RotateAngle(Math::DistanceProjected(m_targetPos, pos), pos.y-m_targetPos.y); // CW !
- m_angleZactual = m_object->RetAngleZ(2);
+ m_angleZactual = m_object->GetAngleZ(2);
m_phase = ATP_TURN;
m_progress = 0.0f;
@@ -218,15 +220,15 @@ bool CAutoTower::EventProcess(const Event &event)
m_object->SetAngleY(1, m_angleYfinal);
m_object->SetAngleZ(2, m_angleZfinal);
- power = m_object->RetPower();
+ power = m_object->GetPower();
if ( power != 0 )
{
- energy = power->RetEnergy();
- energy -= ENERGY_FIRE/power->RetCapacity();
+ energy = power->GetEnergy();
+ energy -= ENERGY_FIRE/power->GetCapacity();
power->SetEnergy(energy);
}
- m_sound->Play(SOUND_GGG, m_object->RetPosition(0));
+ m_sound->Play(SOUND_GGG, m_object->GetPosition(0));
m_phase = ATP_FIRE;
m_progress = 0.0f;
@@ -238,9 +240,9 @@ bool CAutoTower::EventProcess(const Event &event)
{
if ( m_progress == 0.0f )
{
- pos = m_object->RetPosition(0);
+ pos = m_object->GetPosition(0);
pos.y += 24.5f;
- m_particule->CreateRay(pos, m_targetPos, PARTIRAY1,
+ m_particle->CreateRay(pos, m_targetPos, Gfx::PARTIRAY1,
Math::Point(5.0f, 5.0f), 1.5f);
}
if ( m_progress >= 1.0f )
@@ -267,30 +269,30 @@ CObject* CAutoTower::SearchTarget(Math::Vector &impact)
float distance, min, radius, speed;
int i;
- iPos = m_object->RetPosition(0);
+ iPos = m_object->GetPosition(0);
min = 1000000.0f;
for ( i=0 ; i<1000000 ; i++ )
{
- pObj = (CObject*)m_iMan->SearchInstance(CLASS_OBJECT, i);
+ pObj = static_cast< CObject* >(m_iMan->SearchInstance(CLASS_OBJECT, i));
if ( pObj == 0 ) break;
- oType = pObj->RetType();
+ oType = pObj->GetType();
if ( oType != OBJECT_MOTHER &&
oType != OBJECT_ANT &&
oType != OBJECT_SPIDER &&
oType != OBJECT_BEE &&
oType != OBJECT_WORM ) continue;
- if ( !pObj->RetActif() ) continue; // inactive?
+ if ( !pObj->GetActif() ) continue; // inactive?
//? if ( g_researchDone & RESEARCH_QUICK )
if ( false )
{
- physics = pObj->RetPhysics();
+ physics = pObj->GetPhysics();
if ( physics != 0 )
{
- speed = fabs(physics->RetLinMotionX(MO_REASPEED));
+ speed = fabs(physics->GetLinMotionX(MO_REASPEED));
if ( speed > 20.0f ) continue; // moving too fast?
}
}
@@ -306,30 +308,30 @@ CObject* CAutoTower::SearchTarget(Math::Vector &impact)
}
if ( pBest == 0 ) return 0;
- impact = pBest->RetPosition(0);
+ impact = pBest->GetPosition(0);
return pBest;
}
-// Returns an error due the state of the automation.
+// Geturns an error due the state of the automation.
-Error CAutoTower::RetError()
+Error CAutoTower::GetError()
{
CObject* power;
- if ( m_object->RetVirusMode() )
+ if ( m_object->GetVirusMode() )
{
return ERR_BAT_VIRUS;
}
- power = m_object->RetPower();
+ power = m_object->GetPower();
if ( power == 0 )
{
return ERR_TOWER_POWER; // no battery
}
else
{
- if ( power->RetEnergy() < ENERGY_FIRE )
+ if ( power->GetEnergy() < ENERGY_FIRE )
{
return ERR_TOWER_ENERGY; // not enough energy
}
@@ -361,14 +363,14 @@ void CAutoTower::FireStopUpdate(float progress, bool bLightOn)
{
if ( m_partiStop[i] != -1 )
{
- m_particule->DeleteParticule(m_partiStop[i]);
+ m_particle->DeleteParticle(m_partiStop[i]);
m_partiStop[i] = -1;
}
}
return;
}
- mat = m_object->RetWorldMatrix(0);
+ mat = m_object->GetWorldMatrix(0);
speed = Math::Vector(0.0f, 0.0f, 0.0f);
dim.x = 2.0f;
@@ -380,7 +382,7 @@ void CAutoTower::FireStopUpdate(float progress, bool bLightOn)
{
if ( m_partiStop[i] != -1 )
{
- m_particule->DeleteParticule(m_partiStop[i]);
+ m_particle->DeleteParticle(m_partiStop[i]);
m_partiStop[i] = -1;
}
}
@@ -392,8 +394,9 @@ void CAutoTower::FireStopUpdate(float progress, bool bLightOn)
pos.y = 18.0f;
pos.z = listpos[i*2+1];
pos = Transform(*mat, pos);
- m_partiStop[i] = m_particule->CreateParticule(pos, speed,
- dim, PARTISELR,
+
+ m_partiStop[i] = m_particle->CreateParticle(pos, speed,
+ dim, Gfx::PARTISELR,
1.0f, 0.0f, 0.0f);
}
}
@@ -405,7 +408,7 @@ void CAutoTower::FireStopUpdate(float progress, bool bLightOn)
bool CAutoTower::CreateInterface(bool bSelect)
{
- CWindow* pw;
+ Ui::CWindow* pw;
Math::Point pos, ddim;
float ox, oy, sx, sy;
@@ -413,7 +416,7 @@ bool CAutoTower::CreateInterface(bool bSelect)
if ( !bSelect ) return true;
- pw = (CWindow*)m_interface->SearchControl(EVENT_WINDOW0);
+ pw = static_cast< Ui::CWindow* >(m_interface->SearchControl(EVENT_WINDOW0));
if ( pw == 0 ) return false;
ox = 3.0f/640.0f;
@@ -447,8 +450,8 @@ bool CAutoTower::CreateInterface(bool bSelect)
void CAutoTower::UpdateInterface(float rTime)
{
- CWindow* pw;
- CGauge* pg;
+ Ui::CWindow* pw;
+ Ui::CGauge* pg;
CObject* power;
float energy;
@@ -457,19 +460,19 @@ void CAutoTower::UpdateInterface(float rTime)
if ( m_time < m_lastUpdateTime+0.1f ) return;
m_lastUpdateTime = m_time;
- if ( !m_object->RetSelect() ) return;
+ if ( !m_object->GetSelect() ) return;
- pw = (CWindow*)m_interface->SearchControl(EVENT_WINDOW0);
+ pw = static_cast< Ui::CWindow* >(m_interface->SearchControl(EVENT_WINDOW0));
if ( pw == 0 ) return;
- pg = (CGauge*)pw->SearchControl(EVENT_OBJECT_GENERGY);
+ pg = static_cast< Ui::CGauge* >(pw->SearchControl(EVENT_OBJECT_GENERGY));
if ( pg != 0 )
{
energy = 0.0f;
- power = m_object->RetPower();
+ power = m_object->GetPower();
if ( power != 0 )
{
- energy = power->RetEnergy();
+ energy = power->GetEnergy();
}
pg->SetLevel(energy);
}
@@ -524,7 +527,7 @@ bool CAutoTower::Read(char *line)
CAuto::Read(line);
- m_phase = (AutoTowerPhase)OpInt(line, "aPhase", ATP_WAIT);
+ m_phase = static_cast< AutoTowerPhase >(OpInt(line, "aPhase", ATP_WAIT));
m_progress = OpFloat(line, "aProgress", 0.0f);
m_speed = OpFloat(line, "aSpeed", 1.0f);
m_targetPos = OpDir(line, "aTargetPos");
diff --git a/src/object/auto/autotower.h b/src/object/auto/autotower.h
index c9393ff..b29ba85 100644
--- a/src/object/auto/autotower.h
+++ b/src/object/auto/autotower.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
@@ -44,7 +45,7 @@ public:
void Init();
bool EventProcess(const Event &event);
- Error RetError();
+ Error GetError();
bool CreateInterface(bool bSelect);
@@ -63,7 +64,7 @@ protected:
float m_speed;
float m_timeVirus;
float m_lastUpdateTime;
- float m_lastParticule;
+ float m_lastParticle;
Math::Vector m_targetPos;
float m_angleYactual;
float m_angleZactual;
diff --git a/src/object/brain.cpp b/src/object/brain.cpp
index ef55e73..953f878 100644
--- a/src/object/brain.cpp
+++ b/src/object/brain.cpp
@@ -15,56 +15,23 @@
// * along with this program. If not, see http://www.gnu.org/licenses/.
-#include <stdio.h>
-
#include "object/brain.h"
-#include "CBot/CBotDll.h"
-#include "common/struct.h"
-#include "math/geometry.h"
-#include "math/const.h"
-#include "old/d3dengine.h"
-#include "old/d3dmath.h"
-#include "common/language.h"
-#include "common/global.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/terrain.h"
-#include "old/water.h"
-#include "old/camera.h"
-#include "object/object.h"
-#include "physics/physics.h"
+#include "graphics/core/color.h"
+#include "graphics/engine/terrain.h"
#include "object/motion/motion.h"
-#include "object/motion/motionspider.h"
-#include "old/pyro.h"
#include "object/task/taskmanager.h"
-#include "object/task/task.h"
-#include "object/task/taskmanip.h"
-#include "object/task/taskflag.h"
-#include "object/task/taskshield.h"
+#include "physics/physics.h"
+#include "script/cmdtoken.h"
#include "script/script.h"
-#include "ui/studio.h"
+#include "sound/sound.h"
+#include "ui/displaytext.h"
#include "ui/interface.h"
-#include "ui/button.h"
-#include "ui/color.h"
-#include "ui/edit.h"
-#include "ui/list.h"
-#include "ui/label.h"
-#include "ui/group.h"
-#include "ui/gauge.h"
#include "ui/slider.h"
-#include "ui/compass.h"
-#include "ui/target.h"
+#include "ui/studio.h"
#include "ui/window.h"
-#include "ui/displaytext.h"
-#include "old/text.h"
-#include "old/sound.h"
-#include "old/particule.h"
-#include "script/cmdtoken.h"
@@ -82,15 +49,15 @@ CBrain::CBrain(CInstanceManager* iMan, CObject* object)
m_iMan->AddInstance(CLASS_BRAIN, this, 100);
m_object = object;
- m_engine = (CD3DEngine*)m_iMan->SearchInstance(CLASS_ENGINE);
- m_terrain = (CTerrain*)m_iMan->SearchInstance(CLASS_TERRAIN);
- m_water = (CWater*)m_iMan->SearchInstance(CLASS_WATER);
- m_camera = (CCamera*)m_iMan->SearchInstance(CLASS_CAMERA);
- m_interface = (CInterface*)m_iMan->SearchInstance(CLASS_INTERFACE);
- m_displayText = (CDisplayText*)m_iMan->SearchInstance(CLASS_DISPLAYTEXT);
- m_main = (CRobotMain*)m_iMan->SearchInstance(CLASS_MAIN);
- m_sound = (CSound*)m_iMan->SearchInstance(CLASS_SOUND);
- m_particule = (CParticule*)m_iMan->SearchInstance(CLASS_PARTICULE);
+ m_engine = static_cast<Gfx::CEngine*>(m_iMan->SearchInstance(CLASS_ENGINE));
+ m_terrain = static_cast<Gfx::CTerrain*>(m_iMan->SearchInstance(CLASS_TERRAIN));
+ m_water = static_cast<Gfx::CWater*>(m_iMan->SearchInstance(CLASS_WATER));
+ m_camera = static_cast<Gfx::CCamera*>(m_iMan->SearchInstance(CLASS_CAMERA));
+ m_interface = static_cast<Ui::CInterface*>(m_iMan->SearchInstance(CLASS_INTERFACE));
+ m_displayText = static_cast<Ui::CDisplayText*>(m_iMan->SearchInstance(CLASS_DISPLAYTEXT));
+ m_main = static_cast<CRobotMain*>(m_iMan->SearchInstance(CLASS_MAIN));
+ m_sound = static_cast<CSoundInterface*>(m_iMan->SearchInstance(CLASS_SOUND));
+ m_particle = static_cast<Gfx::CParticle*>(m_iMan->SearchInstance(CLASS_PARTICULE));
m_physics = 0;
m_motion = 0;
m_primaryTask = 0;
@@ -213,15 +180,15 @@ bool CBrain::Read(char *line)
bool CBrain::EventProcess(const Event &event)
{
- CWindow* pw;
- CControl* pc;
- CSlider* ps;
- EventMsg action;
- ObjectType type;
- Error err;
- float axeX, axeY, axeZ, factor;
+ Ui::CWindow* pw;
+ Ui::CControl* pc;
+ Ui::CSlider* ps;
+ EventType action;
+ ObjectType type;
+ Error err;
+ float axeX, axeY, axeZ, factor;
- type = m_object->RetType();
+ type = m_object->GetType();
if ( m_primaryTask != 0 ) // current task?
{
@@ -235,18 +202,18 @@ bool CBrain::EventProcess(const Event &event)
action = EVENT_NULL;
- if ( event.event == EVENT_KEYDOWN &&
- (event.param == m_engine->RetKey(KEYRANK_ACTION, 0) ||
- event.param == m_engine->RetKey(KEYRANK_ACTION, 1) ) &&
- !m_main->RetEditLock() )
+ if ( event.type == EVENT_KEY_DOWN &&
+ (event.key.key == m_main->GetInputBinding(INPUT_SLOT_ACTION).key ||
+ event.key.key == m_main->GetInputBinding(INPUT_SLOT_ACTION).joy ) &&
+ !m_main->GetEditLock() )
{
- pw = (CWindow*)m_interface->SearchControl(EVENT_WINDOW0);
+ pw = static_cast< Ui::CWindow* >(m_interface->SearchControl(EVENT_WINDOW0));
if ( pw != 0 )
{
pc = pw->SearchControl(m_defaultEnter);
if ( pc != 0 )
{
- if ( pc->TestState(STATE_ENABLE) )
+ if ( pc->TestState(Ui::STATE_ENABLE) )
{
action = m_defaultEnter;
}
@@ -255,14 +222,14 @@ bool CBrain::EventProcess(const Event &event)
}
else
{
- action = event.event;
+ action = event.type;
}
if ( action == EVENT_NULL ) return true;
if ( action == EVENT_UPDINTERFACE )
{
- if ( m_object->RetSelect() ) CreateInterface(true);
+ if ( m_object->GetSelect() ) CreateInterface(true);
}
if ( action == EVENT_FRAME )
@@ -270,10 +237,10 @@ bool CBrain::EventProcess(const Event &event)
EventFrame(event);
}
- if ( m_object->RetSelect() && // robot selected?
- m_studio != 0 ) // current issue?
+ if ( m_object->GetSelect() && // robot selected?
+ m_studio != 0 ) // current issue?
{
- m_studio->EventProcess(event);
+ // m_studio->EventProcess(event);
if ( action == EVENT_OBJECT_PROGRUN )
{
@@ -308,14 +275,14 @@ bool CBrain::EventProcess(const Event &event)
return true;
}
- if ( !m_object->RetSelect() && // robot pas sélectionné ?
+ if ( !m_object->GetSelect() && // robot pas sélectionné ?
m_program == -1 &&
m_primaryTask == 0 )
{
axeX = 0.0f;
axeY = 0.0f;
axeZ = 0.0f;
- if ( m_object->RetBurn() ) // Gifted?
+ if ( m_object->GetBurn() ) // Gifted?
{
if ( !m_bBurn ) // beginning?
{
@@ -325,7 +292,7 @@ bool CBrain::EventProcess(const Event &event)
axeZ = -1.0f; // tomb
- if ( !m_object->RetFixed() &&
+ if ( !m_object->GetFixed() &&
(type == OBJECT_ANT ||
type == OBJECT_SPIDER ||
type == OBJECT_WORM ) )
@@ -348,13 +315,13 @@ bool CBrain::EventProcess(const Event &event)
}
if ( m_program != -1 &&
- m_object->RetRuin() )
+ m_object->GetRuin() )
{
StopProgram();
return true;
}
- if ( !m_object->RetSelect() ) // robot not selected?
+ if ( !m_object->GetSelect() ) // robot not selected?
{
return true;
}
@@ -375,7 +342,7 @@ bool CBrain::EventProcess(const Event &event)
}
if ( action == EVENT_OBJECT_PROGEDIT )
{
- StartEditScript(m_selScript, m_main->RetScriptName());
+ StartEditScript(m_selScript, m_main->GetScriptName());
}
if ( m_primaryTask == 0 || !m_primaryTask->IsPilot() ) return true;
}
@@ -389,18 +356,17 @@ bool CBrain::EventProcess(const Event &event)
{
m_buttonAxe = action;
}
- if ( action == EVENT_LBUTTONUP ||
- action == EVENT_RBUTTONUP )
+ if ( action == EVENT_MOUSE_BUTTON_UP )
{
m_buttonAxe = EVENT_NULL;
}
- axeX = event.axeX;
- axeY = event.axeY;
- axeZ = event.axeZ;
+ axeX = event.motionInput.x;
+ axeY = event.motionInput.y;
+ axeZ = event.motionInput.z;
- if ( !m_main->RetTrainerPilot() &&
- m_object->RetTrainer() ) // drive vehicle?
+ if ( !m_main->GetTrainerPilot() &&
+ m_object->GetTrainer() ) // drive vehicle?
{
axeX = 0.0f;
axeY = 0.0f;
@@ -414,7 +380,7 @@ bool CBrain::EventProcess(const Event &event)
if ( m_buttonAxe == EVENT_OBJECT_GASUP ) axeZ = 1.0f;
if ( m_buttonAxe == EVENT_OBJECT_GASDOWN ) axeZ = -1.0f;
- if ( m_object->RetManual() ) // scribbler in manual mode?
+ if ( m_object->GetManual() ) // scribbler in manual mode?
{
if ( axeX != 0.0f ) axeY = 0.0f; // if running -> not moving!
axeX *= 0.5f;
@@ -426,7 +392,7 @@ bool CBrain::EventProcess(const Event &event)
axeZ = -1.0f; // tomb
}
- axeX += m_camera->RetMotorTurn(); // additional power according to camera
+ axeX += m_camera->GetMotorTurn(); // additional power according to camera
if ( axeX > 1.0f ) axeX = 1.0f;
if ( axeX < -1.0f ) axeX = -1.0f;
@@ -436,13 +402,13 @@ bool CBrain::EventProcess(const Event &event)
if ( action == EVENT_OBJECT_PROGLIST )
{
- m_selScript = RetSelScript();
+ m_selScript = GetSelScript();
UpdateInterface();
}
if ( action == EVENT_OBJECT_PROGEDIT )
{
- StartEditScript(m_selScript, m_main->RetScriptName());
+ StartEditScript(m_selScript, m_main->GetScriptName());
}
if ( action == EVENT_OBJECT_PROGRUN )
@@ -566,7 +532,7 @@ bool CBrain::EventProcess(const Event &event)
action == EVENT_OBJECT_FCOLORy ||
action == EVENT_OBJECT_FCOLORv )
{
- ColorFlag(action-EVENT_OBJECT_FCOLORb);
+ ColorFlag(action - EVENT_OBJECT_FCOLORb);
}
if ( action == EVENT_OBJECT_SEARCH )
@@ -591,26 +557,26 @@ bool CBrain::EventProcess(const Event &event)
if ( action == EVENT_OBJECT_DIMSHIELD )
{
- pw = (CWindow*)m_interface->SearchControl(EVENT_WINDOW0);
+ pw = static_cast< Ui::CWindow* >(m_interface->SearchControl(EVENT_WINDOW0));
if ( pw != 0 )
{
- ps = (CSlider*)pw->SearchControl(EVENT_OBJECT_DIMSHIELD);
+ ps = static_cast< Ui::CSlider* >(pw->SearchControl(EVENT_OBJECT_DIMSHIELD));
if ( ps != 0 )
{
- m_object->SetParam((ps->RetVisibleValue()-(RADIUS_SHIELD_MIN/g_unit))/((RADIUS_SHIELD_MAX-RADIUS_SHIELD_MIN)/g_unit));
+ m_object->SetParam((ps->GetVisibleValue()-(RADIUS_SHIELD_MIN/g_unit))/((RADIUS_SHIELD_MAX-RADIUS_SHIELD_MIN)/g_unit));
}
}
}
- if ( action == EVENT_OBJECT_FIRE && m_primaryTask == 0 && !m_object->RetTrainer())
+ if ( action == EVENT_OBJECT_FIRE && m_primaryTask == 0 && !m_object->GetTrainer())
{
- if ( m_camera->RetType() != CAMERA_ONBOARD )
+ if ( m_camera->GetType() != Gfx::CAM_TYPE_ONBOARD )
{
- m_camera->SetType(CAMERA_ONBOARD);
+ m_camera->SetType(Gfx::CAM_TYPE_ONBOARD);
}
err = StartTaskFire(0.0f);
}
- if ( action == EVENT_OBJECT_TARGET && !m_object->RetTrainer() )
+ if ( action == EVENT_OBJECT_TARGET && !m_object->GetTrainer() )
{
err = StartTaskGunGoal((event.pos.y-0.50f)*1.3f, (event.pos.x-0.50f)*2.0f);
}
@@ -622,7 +588,7 @@ bool CBrain::EventProcess(const Event &event)
if ( action == EVENT_OBJECT_PEN0 ) // up
{
- err = StartTaskPen(false, m_object->RetTraceColor());
+ err = StartTaskPen(false, m_object->GetTraceColor());
m_object->SetTraceDown(false);
}
if ( action == EVENT_OBJECT_PEN1 ) // black
@@ -687,7 +653,7 @@ bool CBrain::EventProcess(const Event &event)
TraceRecordStart();
}
UpdateInterface();
- pw = (CWindow*)m_interface->SearchControl(EVENT_WINDOW0);
+ pw = static_cast< Ui::CWindow* >(m_interface->SearchControl(EVENT_WINDOW0));
if ( pw != 0 )
{
UpdateScript(pw);
@@ -701,7 +667,7 @@ bool CBrain::EventProcess(const Event &event)
TraceRecordStop();
}
UpdateInterface();
- pw = (CWindow*)m_interface->SearchControl(EVENT_WINDOW0);
+ pw = static_cast< Ui::CWindow* >(m_interface->SearchControl(EVENT_WINDOW0));
if ( pw != 0 )
{
UpdateScript(pw);
@@ -719,8 +685,8 @@ bool CBrain::EventProcess(const Event &event)
{
Math::Vector p1, p2;
float h;
- p1 = m_object->RetPosition(0);
- h = m_terrain->RetFloorLevel(p1);
+ p1 = m_object->GetPosition(0);
+ h = m_terrain->GetFloorLevel(p1);
p2 = p1;
p1.x -= 20.0f;
p1.z -= 20.0f;
@@ -732,8 +698,8 @@ bool CBrain::EventProcess(const Event &event)
{
Math::Vector p1, p2;
float h;
- p1 = m_object->RetPosition(0);
- h = m_terrain->RetFloorLevel(p1);
+ p1 = m_object->GetPosition(0);
+ h = m_terrain->GetFloorLevel(p1);
p2 = p1;
p1.x -= 20.0f;
p1.z -= 20.0f;
@@ -762,17 +728,17 @@ bool CBrain::EventFrame(const Event &event)
if ( m_soundChannelAlarm != -1 )
{
- m_sound->Position(m_soundChannelAlarm, m_object->RetPosition(0));
+ m_sound->Position(m_soundChannelAlarm, m_object->GetPosition(0));
}
- if ( m_studio != 0 ) // �urrent edition?
+ if ( m_studio != 0 ) // current edition?
{
m_studio->EventProcess(event);
}
UpdateInterface(event.rTime);
- if ( m_engine->RetPause() ) return true;
+ if ( m_engine->GetPause() ) return true;
if ( !m_bActivity ) return true; // expected if idle
if ( EndedTask() == ERR_CONTINUE ) return true; // expected if not finished ...
@@ -799,8 +765,8 @@ void CBrain::StopProgram()
{
StopTask();
- if ( m_object->RetType() == OBJECT_HUMAN ||
- m_object->RetType() == OBJECT_TECH ) return;
+ if ( m_object->GetType() == OBJECT_HUMAN ||
+ m_object->GetType() == OBJECT_TECH ) return;
if ( m_program != -1 &&
m_script[m_program] != 0 )
@@ -820,7 +786,7 @@ void CBrain::StopProgram()
UpdateInterface();
m_main->UpdateShortcuts();
- m_object->CreateSelectParticule();
+ m_object->CreateSelectParticle();
}
// Stops the current task.
@@ -837,7 +803,7 @@ void CBrain::StopTask()
// Introduces a virus into a program.
-// Returns true if it was inserted.
+// Geturns true if it was inserted.
bool CBrain::IntroduceVirus()
{
@@ -874,7 +840,7 @@ void CBrain::SetActiveVirus(bool bActive)
}
}
-bool CBrain::RetActiveVirus()
+bool CBrain::GetActiveVirus()
{
return m_bActiveVirus;
}
@@ -891,7 +857,7 @@ void CBrain::StartEditScript(int rank, char* name)
m_script[rank] = new CScript(m_iMan, m_object, &m_secondaryTask);
}
- m_studio = new CStudio(m_iMan);
+ m_studio = new Ui::CStudio();
m_studio->StartEditScript(m_script[rank], name, rank);
}
@@ -1191,25 +1157,25 @@ void CBrain::GroundFlat()
Error err;
float level;
- if ( !m_physics->RetLand() )
+ if ( !m_physics->GetLand() )
{
err = ERR_FLAG_FLY;
- pos = m_object->RetPosition(0);
- if ( pos.y < m_water->RetLevel() ) err = ERR_FLAG_WATER;
+ pos = m_object->GetPosition(0);
+ if ( pos.y < m_water->GetLevel() ) err = ERR_FLAG_WATER;
m_displayText->DisplayError(err, m_object);
return;
}
- pos = m_object->RetPosition(0);
- m_terrain->GroundFlat(pos);
+ pos = m_object->GetPosition(0);
+ m_terrain->ShowFlatGround(pos);
m_sound->Play(SOUND_GFLAT, pos);
- level = m_terrain->RetFloorLevel(pos)+2.0f;
+ level = m_terrain->GetFloorLevel(pos)+2.0f;
if ( pos.y < level ) pos.y = level; // not below the soil
speed = Math::Vector(0.0f, 0.0f, 0.0f);
dim.x = 40.0f;
dim.y = dim.x;
- m_particule->CreateParticule(pos, speed, dim, PARTIGFLAT, 1.0f);
+ m_particle->CreateParticle(pos, speed, dim, Gfx::PARTIGFLAT, 1.0f);
}
@@ -1226,18 +1192,18 @@ void CBrain::ColorFlag(int color)
bool CBrain::CreateInterface(bool bSelect)
{
- ObjectType type;
- CWindow* pw;
- CButton* pb;
- CColor* pc;
- CSlider* ps;
- CTarget* pt;
- CLabel* pl;
- Math::Point pos, dim, ddim;
+ ObjectType type;
+ Ui::CWindow* pw;
+ Ui::CButton* pb;
+ Ui::CSlider* ps;
+ Ui::CColor* pc;
+ Ui::CTarget* pt;
+ Ui::CLabel* pl;
+ Math::Point pos, dim, ddim;
float ox, oy, sx, sy;
char name[100];
- pw = (CWindow*)m_interface->SearchControl(EVENT_WINDOW0);
+ pw = static_cast< Ui::CWindow* >(m_interface->SearchControl(EVENT_WINDOW0));
if ( pw != 0 )
{
pw->Flush(); // destroys the window buttons
@@ -1250,17 +1216,17 @@ bool CBrain::CreateInterface(bool bSelect)
pos.x = 0.0f;
pos.y = 0.0f;
dim.x = 540.0f/640.0f;
- if ( !m_main->RetShowMap() ) dim.x = 640.0f/640.0f;
+ if ( !m_main->GetShowMap() ) dim.x = 640.0f/640.0f;
dim.y = 86.0f/480.0f;
m_interface->CreateWindows(pos, dim, 3, EVENT_WINDOW0);
- pw = (CWindow*)m_interface->SearchControl(EVENT_WINDOW0);
+ pw = static_cast< Ui::CWindow* >(m_interface->SearchControl(EVENT_WINDOW0));
if ( pw == 0 ) return false;
m_object->GetTooltipName(name);
pos.x = 0.0f;
pos.y = 64.0f/480.0f;
ddim.x = 540.0f/640.0f;
- if ( !m_main->RetShowMap() ) ddim.x = 640.0f/640.0f;
+ if ( !m_main->GetShowMap() ) ddim.x = 640.0f/640.0f;
ddim.y = 16.0f/480.0f;
pw->CreateLabel(pos, ddim, 0, EVENT_LABEL0, name);
@@ -1271,7 +1237,7 @@ bool CBrain::CreateInterface(bool bSelect)
sx = 33.0f/640.0f;
sy = 33.0f/480.0f;
- type = m_object->RetType();
+ type = m_object->GetType();
if ( type == OBJECT_MOBILEfa ||
type == OBJECT_MOBILEta ||
@@ -1339,7 +1305,7 @@ bool CBrain::CreateInterface(bool bSelect)
pb->SetImmediat(true);
if ( type != OBJECT_HUMAN ||
- m_object->RetOption() != 2 )
+ m_object->GetOption() != 2 )
{
pos.x = ox+sx*15.3f;
pos.y = oy+sy*0;
@@ -1362,7 +1328,7 @@ bool CBrain::CreateInterface(bool bSelect)
type == OBJECT_MOBILEta ||
type == OBJECT_MOBILEwa ||
type == OBJECT_MOBILEia ) && // arm?
- !m_object->RetTrainer() )
+ !m_object->GetTrainer() )
{
pos.x = ox+sx*7.7f;
pos.y = oy+sy*0.5f;
@@ -1383,7 +1349,7 @@ bool CBrain::CreateInterface(bool bSelect)
}
if ( type == OBJECT_MOBILEsa && // underwater?
- !m_object->RetTrainer() )
+ !m_object->GetTrainer() )
{
pos.x = ox+sx*7.7f;
pos.y = oy+sy*0.5f;
@@ -1498,19 +1464,19 @@ bool CBrain::CreateInterface(bool bSelect)
pos.x = ox+sx*10.1f;
pos.y = oy+sy*2.0f-ddim.y;
pc = pw->CreateColor(pos, ddim, -1, EVENT_OBJECT_FCOLORb);
- pc->SetColor(RetColor((D3DCOLOR)0x004890ff));
+ pc->SetColor(Gfx::Color(0.28f, 0.56f, 1.0f, 0.0f));
pos.x += ddim.x;
pc = pw->CreateColor(pos, ddim, -1, EVENT_OBJECT_FCOLORr);
- pc->SetColor(RetColor((D3DCOLOR)0x00ff0000));
+ pc->SetColor(Gfx::Color(1.0f, 0.0f, 0.0f, 0.0f));
pos.x += ddim.x;
pc = pw->CreateColor(pos, ddim, -1, EVENT_OBJECT_FCOLORg);
- pc->SetColor(RetColor((D3DCOLOR)0x0000ce00));
+ pc->SetColor(Gfx::Color(0.0f, 0.8f, 0.0f, 0.0f));
pos.x += ddim.x;
pc = pw->CreateColor(pos, ddim, -1, EVENT_OBJECT_FCOLORy);
- pc->SetColor(RetColor((D3DCOLOR)0x00ffec00));
+ pc->SetColor(Gfx::Color(1.0f, 0.93f, 0.0f, 0.0f)); //0x00ffec00
pos.x += ddim.x;
pc = pw->CreateColor(pos, ddim, -1, EVENT_OBJECT_FCOLORv);
- pc->SetColor(RetColor((D3DCOLOR)0x00d101fe));
+ pc->SetColor(Gfx::Color(0.82f, 0.004f, 0.99f, 0.0f)); //0x00d101fe
}
}
@@ -1518,7 +1484,7 @@ bool CBrain::CreateInterface(bool bSelect)
type == OBJECT_MOBILEts ||
type == OBJECT_MOBILEws ||
type == OBJECT_MOBILEis ) && // Investigator?
- !m_object->RetTrainer() )
+ !m_object->GetTrainer() )
{
pos.x = ox+sx*7.7f;
pos.y = oy+sy*0.5f;
@@ -1527,7 +1493,7 @@ bool CBrain::CreateInterface(bool bSelect)
}
if ( type == OBJECT_MOBILErt && // Terraformer?
- !m_object->RetTrainer() )
+ !m_object->GetTrainer() )
{
pos.x = ox+sx*7.7f;
pos.y = oy+sy*0.5f;
@@ -1540,7 +1506,7 @@ bool CBrain::CreateInterface(bool bSelect)
}
if ( type == OBJECT_MOBILErr && // recoverer?
- !m_object->RetTrainer() )
+ !m_object->GetTrainer() )
{
pos.x = ox+sx*7.7f;
pos.y = oy+sy*0.5f;
@@ -1549,7 +1515,7 @@ bool CBrain::CreateInterface(bool bSelect)
}
if ( type == OBJECT_MOBILErs && // shield?
- !m_object->RetTrainer() )
+ !m_object->GetTrainer() )
{
pos.x = ox+sx*7.7f;
pos.y = oy+sy*0.5f;
@@ -1569,7 +1535,7 @@ bool CBrain::CreateInterface(bool bSelect)
ddim.x = dim.x*0.5f;
ddim.y = dim.y*2.0f;
ps = pw->CreateSlider(pos, ddim, 0, EVENT_OBJECT_DIMSHIELD);
- ps->SetState(STATE_VALUE);
+ ps->SetState(Ui::STATE_VALUE);
ps->SetLimit((RADIUS_SHIELD_MIN/g_unit), (RADIUS_SHIELD_MAX/g_unit));
ps->SetArrowStep(1.0f);
}
@@ -1583,7 +1549,7 @@ bool CBrain::CreateInterface(bool bSelect)
type == OBJECT_MOBILEwi ||
type == OBJECT_MOBILEii ||
type == OBJECT_MOBILErc ) && // cannon?
- !m_object->RetTrainer() )
+ !m_object->GetTrainer() )
{
pos.x = ox+sx*7.7f;
pos.y = oy+sy*0.5f;
@@ -1597,7 +1563,7 @@ bool CBrain::CreateInterface(bool bSelect)
}
if ( type == OBJECT_MOBILEdr &&
- m_object->RetManual() ) // scribbler in manual mode?
+ m_object->GetManual() ) // scribbler in manual mode?
{
pos.x = ox+sx*6.9f;
pos.y = oy+sy*0.0f;
@@ -1620,35 +1586,35 @@ bool CBrain::CreateInterface(bool bSelect)
pos.x = ox+sx*10.15f;
pos.y = oy+sy*1.50f;
pc = pw->CreateColor(pos, ddim, -1, EVENT_OBJECT_PEN1); // black
- pc->SetColor(RetColor((D3DCOLOR)0x00000000));
+ pc->SetColor(Gfx::Color(0.0f, 0.0f, 0.0f, 0.0f));
pos.x = ox+sx*10.65f;
pos.y = oy+sy*1.25f;
pc = pw->CreateColor(pos, ddim, -1, EVENT_OBJECT_PEN2); // yellow
- pc->SetColor(RetColor((D3DCOLOR)0x00ffff00));
+ pc->SetColor(Gfx::Color(1.0f, 1.0f, 0.0f, 0.0f ));
pos.x = ox+sx*10.90f;
pos.y = oy+sy*0.75f;
pc = pw->CreateColor(pos, ddim, -1, EVENT_OBJECT_PEN3); // orange
- pc->SetColor(RetColor((D3DCOLOR)0x00ff8800));
+ pc->SetColor(Gfx::Color(1.0f, 0.53f, 0x00, 0x00));
pos.x = ox+sx*10.65f;
pos.y = oy+sy*0.25f;
pc = pw->CreateColor(pos, ddim, -1, EVENT_OBJECT_PEN4); // red
- pc->SetColor(RetColor((D3DCOLOR)0x00ff0000));
+ pc->SetColor(Gfx::Color(1.0f, 0.0f, 0.0f, 0.0f));
pos.x = ox+sx*10.15f;
pos.y = oy+sy*0.00f;
pc = pw->CreateColor(pos, ddim, -1, EVENT_OBJECT_PEN5); // violet
- pc->SetColor(RetColor((D3DCOLOR)0x00ff00ff));
+ pc->SetColor(Gfx::Color(1.0f, 0.0f, 1.0f, 0.0f));
pos.x = ox+sx*9.65f;
pos.y = oy+sy*0.25f;
pc = pw->CreateColor(pos, ddim, -1, EVENT_OBJECT_PEN6); // blue
- pc->SetColor(RetColor((D3DCOLOR)0x000066ff));
+ pc->SetColor(Gfx::Color(0.0f, 0.4f, 1.0f, 0.0f));//0x000066ff));
pos.x = ox+sx*9.40f;
pos.y = oy+sy*0.75f;
pc = pw->CreateColor(pos, ddim, -1, EVENT_OBJECT_PEN7); // green
- pc->SetColor(RetColor((D3DCOLOR)0x0000cc00));
+ pc->SetColor(Gfx::Color(0.0f, 0.0f, 0.8f, 0.0f));//0x0000cc00));
pos.x = ox+sx*9.65f;
pos.y = oy+sy*1.25f;
pc = pw->CreateColor(pos, ddim, -1, EVENT_OBJECT_PEN8); // brown
- pc->SetColor(RetColor((D3DCOLOR)0x00884400));
+ pc->SetColor(Gfx::Color(0.53f, 0.27f, 0.0f, 0.0f));//0x00884400));
pos.x = ox+sx*6.9f;
pos.y = oy+sy*1.2f;
@@ -1666,7 +1632,7 @@ bool CBrain::CreateInterface(bool bSelect)
pw->CreateButton(pos, dim, 45, EVENT_OBJECT_STOP);
}
- if ( m_object->RetToy() )
+ if ( m_object->GetToy() )
{
pos.x = ox+sx*12.1f;
pos.y = oy+sy*-0.1f;
@@ -1705,9 +1671,9 @@ bool CBrain::CreateInterface(bool bSelect)
if ( type != OBJECT_HUMAN &&
type != OBJECT_TECH &&
- !m_object->RetCameraLock() )
+ !m_object->GetCameraLock() )
{
-//? if ( m_main->RetShowMap() )
+//? if ( m_main->GetShowMap() )
if ( true )
{
pos.x = ox+sx*13.4f;
@@ -1724,7 +1690,7 @@ bool CBrain::CreateInterface(bool bSelect)
}
}
- if ( m_object->RetToy() && !m_object->RetManual() )
+ if ( m_object->GetToy() && !m_object->GetManual() )
{
#if 0
ddim.x = dim.x*0.66f;
@@ -1770,7 +1736,7 @@ bool CBrain::CreateInterface(bool bSelect)
#if _TEEN
pw->CreateButton(pos, dim, 9, EVENT_OBJECT_RESET);
#else
- if ( m_object->RetTrainer() ) // Training?
+ if ( m_object->GetTrainer() ) // Training?
{
pw->CreateButton(pos, dim, 9, EVENT_OBJECT_RESET);
}
@@ -1861,7 +1827,7 @@ bool CBrain::CreateInterface(bool bSelect)
pc = (CCompass*)pw->SearchControl(EVENT_OBJECT_COMPASS);
if ( pc != 0 )
{
- pc->SetState(STATE_VISIBLE, m_main->RetShowMap());
+ pc->SetState(Ui::STATE_VISIBLE, m_main->GetShowMap());
}
}
#endif
@@ -1887,7 +1853,7 @@ bool CBrain::CreateInterface(bool bSelect)
ddim.x = 600.0f/640.0f;
ddim.y = 340.0f/480.0f;
pt = pw->CreateTarget(pos, ddim, 0, EVENT_OBJECT_TARGET);
- pt->ClearState(STATE_GLINT);
+ pt->ClearState(Ui::STATE_GLINT);
}
ddim.x = 64.0f/640.0f;
@@ -1926,15 +1892,15 @@ bool CBrain::CreateInterface(bool bSelect)
void CBrain::UpdateInterface(float rTime)
{
- CWindow* pw;
-#if _TEEN
- CButton* pb;
-#endif
- CGauge* pg;
- CCompass* pc;
- CGroup* pgr;
- CTarget* ptg;
- CObject* power;
+ Ui::CWindow* pw;
+/* TODO: #if _TEEN
+ Ui::CButton* pb;
+#endif*/
+ Ui::CGauge* pg;
+ Ui::CCompass* pc;
+ Ui::CGroup* pgr;
+ Ui::CTarget* ptg;
+ CObject* power;
Math::Vector pos, hPos;
Math::Point ppos;
float energy, limit, angle, range;
@@ -1945,7 +1911,7 @@ void CBrain::UpdateInterface(float rTime)
if ( m_time < m_lastUpdateTime+0.1f ) return;
m_lastUpdateTime = m_time;
- if ( !m_object->RetSelect() )
+ if ( !m_object->GetSelect() )
{
if ( m_soundChannelAlarm != -1 )
{
@@ -1956,21 +1922,21 @@ void CBrain::UpdateInterface(float rTime)
return;
}
- pw = (CWindow*)m_interface->SearchControl(EVENT_WINDOW0);
+ pw = static_cast< Ui::CWindow* >(m_interface->SearchControl(EVENT_WINDOW0));
if ( pw == 0 ) return;
- pg = (CGauge*)pw->SearchControl(EVENT_OBJECT_GENERGY);
+ pg = static_cast< Ui::CGauge* >(pw->SearchControl(EVENT_OBJECT_GENERGY));
if ( pg != 0 )
{
- power = m_object->RetPower();
+ power = m_object->GetPower();
if ( power == 0 )
{
energy = 0.0f;
}
else
{
- energy = power->RetEnergy();
- limit = energy*power->RetCapacity();
+ energy = power->GetEnergy();
+ limit = energy*power->GetCapacity();
}
icon = 0; // red/green
@@ -1991,19 +1957,19 @@ void CBrain::UpdateInterface(float rTime)
pg->SetIcon(icon);
}
- pg = (CGauge*)pw->SearchControl(EVENT_OBJECT_GSHIELD);
+ pg = static_cast< Ui::CGauge* >(pw->SearchControl(EVENT_OBJECT_GSHIELD));
if ( pg != 0 )
{
- pg->SetLevel(m_object->RetShield());
+ pg->SetLevel(m_object->GetShield());
}
- pg = (CGauge*)pw->SearchControl(EVENT_OBJECT_GRANGE);
+ pg = static_cast< Ui::CGauge* >(pw->SearchControl(EVENT_OBJECT_GRANGE));
if ( pg != 0 )
{
icon = 2; // blue/red
- range = m_physics->RetReactorRange();
+ range = m_physics->GetReactorRange();
- if ( range < 0.2f && range != 0.0f && !m_physics->RetLand() )
+ if ( range < 0.2f && range != 0.0f && !m_physics->GetLand() )
{
if ( Math::Mod(m_time, 0.5f) >= 0.2f ) // blinks?
{
@@ -2012,7 +1978,7 @@ void CBrain::UpdateInterface(float rTime)
}
if ( m_soundChannelAlarm == -1 )
{
- m_soundChannelAlarm = m_sound->Play(SOUND_ALARMt, m_object->RetPosition(0), 0.0f, 0.1f, true);
+ m_soundChannelAlarm = m_sound->Play(SOUND_ALARMt, m_object->GetPosition(0), 0.0f, 0.1f, true);
m_sound->AddEnvelope(m_soundChannelAlarm, 1.0f, 1.0f, 1.0f, SOPER_CONTINUE);
m_sound->AddEnvelope(m_soundChannelAlarm, 1.0f, 1.0f, 1.0f, SOPER_LOOP);
}
@@ -2031,13 +1997,13 @@ void CBrain::UpdateInterface(float rTime)
pg->SetIcon(icon);
}
- pc = (CCompass*)pw->SearchControl(EVENT_OBJECT_COMPASS);
+ pc = static_cast< Ui::CCompass* >(pw->SearchControl(EVENT_OBJECT_COMPASS));
if ( pc != 0 )
{
- angle = -(m_object->RetAngleY(0)+Math::PI/2.0f);
+ angle = -(m_object->GetAngleY(0)+Math::PI/2.0f);
pc->SetDirection(angle);
- pc->SetState(STATE_VISIBLE, m_main->RetShowMap());
+ pc->SetState(Ui::STATE_VISIBLE, m_main->GetShowMap());
}
#if _TEEN
@@ -2046,25 +2012,25 @@ void CBrain::UpdateInterface(float rTime)
{
if ( m_bTraceRecord && Math::Mod(m_time, 0.4f) >= 0.2f )
{
- pb->SetState(STATE_CHECK);
+ pb->SetState(Ui::STATE_CHECK);
}
else
{
- pb->ClearState(STATE_CHECK);
+ pb->ClearState(Ui::STATE_CHECK);
}
}
#endif
- bOnBoard = m_camera->RetType() == CAMERA_ONBOARD;
+ bOnBoard = m_camera->GetType() == Gfx::CAM_TYPE_ONBOARD;
- pgr = (CGroup*)pw->SearchControl(EVENT_OBJECT_CROSSHAIR);
+ pgr = static_cast< Ui::CGroup* >(pw->SearchControl(EVENT_OBJECT_CROSSHAIR));
if ( pgr != 0 )
{
if ( bOnBoard )
{
#if 0
- angle = m_object->RetGunGoalV();
- if ( m_object->RetType() != OBJECT_MOBILErc )
+ angle = m_object->GetGunGoalV();
+ if ( m_object->GetType() != OBJECT_MOBILErc )
{
angle += 10.0f*Math::PI/360.0f;
}
@@ -2075,53 +2041,53 @@ void CBrain::UpdateInterface(float rTime)
#else
ppos.x = 0.50f-(64.0f/640.0f)/2.0f;
ppos.y = 0.50f-(64.0f/480.0f)/2.0f;
- ppos.x += m_object->RetGunGoalH()/2.0f;
- ppos.y += m_object->RetGunGoalV()/1.3f;
+ ppos.x += m_object->GetGunGoalH()/2.0f;
+ ppos.y += m_object->GetGunGoalV()/1.3f;
pgr->SetPos(ppos);
#endif
- pgr->SetState(STATE_VISIBLE, !m_main->RetFriendAim());
+ pgr->SetState(Ui::STATE_VISIBLE, !m_main->GetFriendAim());
}
else
{
- pgr->ClearState(STATE_VISIBLE);
+ pgr->ClearState(Ui::STATE_VISIBLE);
}
}
- ptg = (CTarget*)pw->SearchControl(EVENT_OBJECT_TARGET);
+ ptg = static_cast< Ui::CTarget* >(pw->SearchControl(EVENT_OBJECT_TARGET));
if ( ptg != 0 )
{
if ( bOnBoard )
{
- ptg->SetState(STATE_VISIBLE);
+ ptg->SetState(Ui::STATE_VISIBLE);
}
else
{
- ptg->ClearState(STATE_VISIBLE);
+ ptg->ClearState(Ui::STATE_VISIBLE);
}
}
- pgr = (CGroup*)pw->SearchControl(EVENT_OBJECT_CORNERul);
+ pgr = static_cast< Ui::CGroup* >(pw->SearchControl(EVENT_OBJECT_CORNERul));
if ( pgr != 0 )
{
- pgr->SetState(STATE_VISIBLE, bOnBoard);
+ pgr->SetState(Ui::STATE_VISIBLE, bOnBoard);
}
- pgr = (CGroup*)pw->SearchControl(EVENT_OBJECT_CORNERur);
+ pgr = static_cast< Ui::CGroup* >(pw->SearchControl(EVENT_OBJECT_CORNERur));
if ( pgr != 0 )
{
- pgr->SetState(STATE_VISIBLE, bOnBoard);
+ pgr->SetState(Ui::STATE_VISIBLE, bOnBoard);
}
- pgr = (CGroup*)pw->SearchControl(EVENT_OBJECT_CORNERdl);
+ pgr = static_cast< Ui::CGroup* >(pw->SearchControl(EVENT_OBJECT_CORNERdl));
if ( pgr != 0 )
{
- pgr->SetState(STATE_VISIBLE, bOnBoard);
+ pgr->SetState(Ui::STATE_VISIBLE, bOnBoard);
}
- pgr = (CGroup*)pw->SearchControl(EVENT_OBJECT_CORNERdr);
+ pgr = static_cast< Ui::CGroup* >(pw->SearchControl(EVENT_OBJECT_CORNERdr));
if ( pgr != 0 )
{
- pgr->SetState(STATE_VISIBLE, bOnBoard);
+ pgr->SetState(Ui::STATE_VISIBLE, bOnBoard);
}
}
@@ -2130,9 +2096,9 @@ void CBrain::UpdateInterface(float rTime)
void CBrain::UpdateInterface()
{
ObjectType type;
- CWindow* pw;
- CButton* pb;
- CSlider* ps;
+ Ui::CWindow* pw;
+ Ui::CButton* pb;
+ Ui::CSlider* ps;
#if _TEEN
CColor* pc;
int color;
@@ -2140,12 +2106,12 @@ void CBrain::UpdateInterface()
bool bEnable, bFly, bRun;
char title[100];
- if ( !m_object->RetSelect() ) return;
+ if ( !m_object->GetSelect() ) return;
- pw = (CWindow*)m_interface->SearchControl(EVENT_WINDOW0);
+ pw = static_cast< Ui::CWindow* >(m_interface->SearchControl(EVENT_WINDOW0));
if ( pw == 0 ) return;
- type = m_object->RetType();
+ type = m_object->GetType();
bEnable = ( m_secondaryTask == 0 && m_program == -1 );
@@ -2202,10 +2168,10 @@ void CBrain::UpdateInterface()
EnableInterface(pw, EVENT_OBJECT_BXXXX, bEnable);
}
- pb = (CButton*)pw->SearchControl(EVENT_OBJECT_GFLAT);
+ pb = static_cast< Ui::CButton* >(pw->SearchControl(EVENT_OBJECT_GFLAT));
if ( pb != 0 )
{
- pb->SetState(STATE_VISIBLE, m_engine->RetGroundSpot());
+ pb->SetState(Ui::STATE_VISIBLE, m_engine->GetGroundSpot());
}
if ( type == OBJECT_HUMAN || // builder?
@@ -2235,21 +2201,21 @@ void CBrain::UpdateInterface()
DefaultEnter (pw, EVENT_OBJECT_ENDSHIELD, false);
}
- ps = (CSlider*)pw->SearchControl(EVENT_OBJECT_DIMSHIELD);
+ ps = static_cast< Ui::CSlider* >(pw->SearchControl(EVENT_OBJECT_DIMSHIELD));
if ( ps != 0 )
{
- ps->SetVisibleValue((RADIUS_SHIELD_MIN/g_unit)+m_object->RetParam()*((RADIUS_SHIELD_MAX-RADIUS_SHIELD_MIN)/g_unit));
+ ps->SetVisibleValue((RADIUS_SHIELD_MIN/g_unit)+m_object->GetParam()*((RADIUS_SHIELD_MAX-RADIUS_SHIELD_MIN)/g_unit));
}
}
bFly = bEnable;
if ( bFly && (type == OBJECT_HUMAN || type == OBJECT_TECH) )
{
- if ( m_object->RetFret() != 0 ) bFly = false; // if holder -> not fly
+ if ( m_object->GetFret() != 0 ) bFly = false; // if holder -> not fly
}
EnableInterface(pw, EVENT_OBJECT_GASUP, bFly);
EnableInterface(pw, EVENT_OBJECT_GASDOWN, bFly);
- if ( m_object->RetTrainer() ) // Training?
+ if ( m_object->GetTrainer() ) // Training?
{
DeadInterface(pw, EVENT_OBJECT_GASUP, false);
DeadInterface(pw, EVENT_OBJECT_GASDOWN, false);
@@ -2308,7 +2274,7 @@ void CBrain::UpdateInterface()
if ( m_bTraceRecord ) bRun = false;
EnableInterface(pw, EVENT_OBJECT_PROGRUN, bRun);
- pb = (CButton*)pw->SearchControl(EVENT_OBJECT_PROGRUN);
+ pb = static_cast< Ui::CButton* >(pw->SearchControl(EVENT_OBJECT_PROGRUN));
if ( pb != 0 )
{
pb->SetIcon(m_program==-1?21:8); // run/stop
@@ -2334,103 +2300,103 @@ void CBrain::UpdateInterface()
}
#if _TEEN
- if ( m_object->RetTraceDown() )
+ if ( m_object->GetTraceDown() )
{
- pb = (CButton*)pw->SearchControl(EVENT_OBJECT_PEN0);
+ pb = static_cast< Ui::CButton* >(pw->SearchControl(EVENT_OBJECT_PEN0));
if ( pb != 0 )
{
- pb->ClearState(STATE_CHECK);
+ pb->ClearState(Ui::STATE_CHECK);
}
- color = m_object->RetTraceColor();
- pc = (CColor*)pw->SearchControl(EVENT_OBJECT_PEN1);
+ color = m_object->GetTraceColor();
+ pc = static_cast< Ui::CColor* >(pw->SearchControl(EVENT_OBJECT_PEN1));
if ( pc != 0 )
{
- pc->SetState(STATE_CHECK, color==1);
+ pc->SetState(Ui::STATE_CHECK, color==1);
}
- pc = (CColor*)pw->SearchControl(EVENT_OBJECT_PEN2);
+ pc = static_cast< Ui::CColor* >(pw->SearchControl(EVENT_OBJECT_PEN2));
if ( pc != 0 )
{
- pc->SetState(STATE_CHECK, color==8);
+ pc->SetState(Ui::STATE_CHECK, color==8);
}
- pc = (CColor*)pw->SearchControl(EVENT_OBJECT_PEN3);
+ pc = static_cast< Ui::CColor* >(pw->SearchControl(EVENT_OBJECT_PEN3));
if ( pc != 0 )
{
- pc->SetState(STATE_CHECK, color==7);
+ pc->SetState(Ui::STATE_CHECK, color==7);
}
- pc = (CColor*)pw->SearchControl(EVENT_OBJECT_PEN4);
+ pc = static_cast< Ui::CColor* >(pw->SearchControl(EVENT_OBJECT_PEN4));
if ( pc != 0 )
{
- pc->SetState(STATE_CHECK, color==4);
+ pc->SetState(Ui::STATE_CHECK, color==4);
}
- pc = (CColor*)pw->SearchControl(EVENT_OBJECT_PEN5);
+ pc = static_cast< Ui::CColor* >(pw->SearchControl(EVENT_OBJECT_PEN5));
if ( pc != 0 )
{
- pc->SetState(STATE_CHECK, color==6);
+ pc->SetState(Ui::STATE_CHECK, color==6);
}
- pc = (CColor*)pw->SearchControl(EVENT_OBJECT_PEN6);
+ pc = static_cast< Ui::CColor* >(pw->SearchControl(EVENT_OBJECT_PEN6));
if ( pc != 0 )
{
- pc->SetState(STATE_CHECK, color==14);
+ pc->SetState(Ui::STATE_CHECK, color==14);
}
- pc = (CColor*)pw->SearchControl(EVENT_OBJECT_PEN7);
+ pc = static_cast< Ui::CColor* >(pw->SearchControl(EVENT_OBJECT_PEN7));
if ( pc != 0 )
{
- pc->SetState(STATE_CHECK, color==12);
+ pc->SetState(Ui::STATE_CHECK, color==12);
}
- pc = (CColor*)pw->SearchControl(EVENT_OBJECT_PEN8);
+ pc = static_cast< Ui::CColor* >(pw->SearchControl(EVENT_OBJECT_PEN8));
if ( pc != 0 )
{
- pc->SetState(STATE_CHECK, color==10);
+ pc->SetState(Ui::STATE_CHECK, color==10);
}
}
else
{
- pb = (CButton*)pw->SearchControl(EVENT_OBJECT_PEN0);
+ pb = static_cast< Ui::CButton* >(pw->SearchControl(EVENT_OBJECT_PEN0));
if ( pb != 0 )
{
- pb->SetState(STATE_CHECK);
+ pb->SetState(Ui::STATE_CHECK);
}
- pc = (CColor*)pw->SearchControl(EVENT_OBJECT_PEN1);
+ pc = static_cast< Ui::CColor* >(pw->SearchControl(EVENT_OBJECT_PEN1));
if ( pc != 0 )
{
- pc->ClearState(STATE_CHECK);
+ pc->ClearState(Ui::STATE_CHECK);
}
- pc = (CColor*)pw->SearchControl(EVENT_OBJECT_PEN2);
+ pc = static_cast< Ui::CColor* >(pw->SearchControl(EVENT_OBJECT_PEN2));
if ( pc != 0 )
{
- pc->ClearState(STATE_CHECK);
+ pc->ClearState(Ui::STATE_CHECK);
}
- pc = (CColor*)pw->SearchControl(EVENT_OBJECT_PEN3);
+ pc = static_cast< Ui::CColor* >(pw->SearchControl(EVENT_OBJECT_PEN3));
if ( pc != 0 )
{
- pc->ClearState(STATE_CHECK);
+ pc->ClearState(Ui::STATE_CHECK);
}
- pc = (CColor*)pw->SearchControl(EVENT_OBJECT_PEN4);
+ pc = static_cast< Ui::CColor* >(pw->SearchControl(EVENT_OBJECT_PEN4));
if ( pc != 0 )
{
- pc->ClearState(STATE_CHECK);
+ pc->ClearState(Ui::STATE_CHECK);
}
- pc = (CColor*)pw->SearchControl(EVENT_OBJECT_PEN5);
+ pc = static_cast< Ui::CColor* >(pw->SearchControl(EVENT_OBJECT_PEN5));
if ( pc != 0 )
{
- pc->ClearState(STATE_CHECK);
+ pc->ClearState(Ui::STATE_CHECK);
}
- pc = (CColor*)pw->SearchControl(EVENT_OBJECT_PEN6);
+ pc = static_cast< Ui::CColor* >(pw->SearchControl(EVENT_OBJECT_PEN6));
if ( pc != 0 )
{
- pc->ClearState(STATE_CHECK);
+ pc->ClearState(Ui::STATE_CHECK);
}
- pc = (CColor*)pw->SearchControl(EVENT_OBJECT_PEN7);
+ pc = static_cast< Ui::CColor* >(pw->SearchControl(EVENT_OBJECT_PEN7));
if ( pc != 0 )
{
- pc->ClearState(STATE_CHECK);
+ pc->ClearState(Ui::STATE_CHECK);
}
- pc = (CColor*)pw->SearchControl(EVENT_OBJECT_PEN8);
+ pc = static_cast< Ui::CColor* >(pw->SearchControl(EVENT_OBJECT_PEN8));
if ( pc != 0 )
{
- pc->ClearState(STATE_CHECK);
+ pc->ClearState(Ui::STATE_CHECK);
}
}
#endif
@@ -2438,19 +2404,19 @@ void CBrain::UpdateInterface()
// Updates the list of programs.
-void CBrain::UpdateScript(CWindow *pw)
+void CBrain::UpdateScript(Ui::CWindow *pw)
{
- CList* pl;
+ Ui::CList* pl;
char name[100];
char title[100];
int i;
bool bSoluce;
- pl = (CList*)pw->SearchControl(EVENT_OBJECT_PROGLIST);
+ pl = static_cast< Ui::CList* >(pw->SearchControl(EVENT_OBJECT_PROGLIST));
if ( pl == 0 ) return;
#if _SCHOOL
- bSoluce = m_main->RetSoluce4();
+ bSoluce = m_main->GetSoluce4();
#else
bSoluce = true;
#endif
@@ -2484,35 +2450,35 @@ void CBrain::UpdateScript(CWindow *pw)
pl->ShowSelect(true);
}
-// Returns the rank of selected script.
+// Geturns the rank of selected script.
-int CBrain::RetSelScript()
+int CBrain::GetSelScript()
{
- CWindow* pw;
- CList* pl;
+ Ui::CWindow* pw;
+ Ui::CList* pl;
- pw = (CWindow*)m_interface->SearchControl(EVENT_WINDOW0);
+ pw = static_cast< Ui::CWindow* >(m_interface->SearchControl(EVENT_WINDOW0));
if ( pw == 0 ) return -1;
- pl = (CList*)pw->SearchControl(EVENT_OBJECT_PROGLIST);
+ pl = static_cast< Ui::CList* >(pw->SearchControl(EVENT_OBJECT_PROGLIST));
if ( pl == 0 ) return -1;
- return pl->RetSelect();
+ return pl->GetSelect();
}
// Blinks the running program.
void CBrain::BlinkScript(bool bEnable)
{
- CWindow* pw;
- CList* pl;
+ Ui::CWindow* pw;
+ Ui::CList* pl;
- if ( !m_object->RetSelect() ) return; // robot not selected?
+ if ( !m_object->GetSelect() ) return; // robot not selected?
- pw = (CWindow*)m_interface->SearchControl(EVENT_WINDOW0);
+ pw = static_cast< Ui::CWindow* >(m_interface->SearchControl(EVENT_WINDOW0));
if ( pw == 0 ) return;
- pl = (CList*)pw->SearchControl(EVENT_OBJECT_PROGLIST);
+ pl = static_cast< Ui::CList* >(pw->SearchControl(EVENT_OBJECT_PROGLIST));
if ( pl == 0 ) return;
pl->SetBlink(bEnable);
@@ -2520,57 +2486,57 @@ void CBrain::BlinkScript(bool bEnable)
// Check the status of a button interface.
-void CBrain::CheckInterface(CWindow *pw, EventMsg event, bool bState)
+void CBrain::CheckInterface(Ui::CWindow *pw, EventType event, bool bState)
{
- CControl* control;
+ Ui::CControl* control;
control = pw->SearchControl(event);
if ( control == 0 ) return;
- control->SetState(STATE_CHECK, bState);
+ control->SetState(Ui::STATE_CHECK, bState);
}
// Changes the state of a button interface.
-void CBrain::EnableInterface(CWindow *pw, EventMsg event, bool bState)
+void CBrain::EnableInterface(Ui::CWindow *pw, EventType event, bool bState)
{
- CControl* control;
+ Ui::CControl* control;
control = pw->SearchControl(event);
if ( control == 0 ) return;
- control->SetState(STATE_ENABLE, bState);
+ control->SetState(Ui::STATE_ENABLE, bState);
}
// Changes the state of a button on the interface.
-void CBrain::DeadInterface(CWindow *pw, EventMsg event, bool bState)
+void CBrain::DeadInterface(Ui::CWindow *pw, EventType event, bool bState)
{
- CControl* control;
+ Ui::CControl* control;
control = pw->SearchControl(event);
if ( control == 0 ) return;
- control->SetState(STATE_DEAD, !bState);
+ control->SetState(Ui::STATE_DEAD, !bState);
}
// Change the default input state of a button interface.
-void CBrain::DefaultEnter(CWindow *pw, EventMsg event, bool bState)
+void CBrain::DefaultEnter(Ui::CWindow *pw, EventType event, bool bState)
{
- CControl* control;
+ Ui::CControl* control;
control = pw->SearchControl(event);
if ( control == 0 ) return;
if ( bState )
{
- control->SetState(STATE_DEFAULT);
+ control->SetState(Ui::STATE_DEFAULT);
m_defaultEnter = event;
}
else
{
- control->ClearState(STATE_DEFAULT);
+ control->ClearState(Ui::STATE_DEFAULT);
}
}
@@ -2589,7 +2555,7 @@ void CBrain::SetActivity(bool bMode)
m_bActivity = bMode;
}
-bool CBrain::RetActivity()
+bool CBrain::GetActivity()
{
return m_bActivity;
}
@@ -2619,12 +2585,12 @@ void CBrain::RunProgram(int rank)
{
m_program = rank; // start new program
BlinkScript(true); // blink
- m_object->CreateSelectParticule();
+ m_object->CreateSelectParticle();
m_main->UpdateShortcuts();
}
}
-// Returns the first free program.
+// Geturns the first free program.
int CBrain::FreeProgram()
{
@@ -2638,9 +2604,9 @@ int CBrain::FreeProgram()
}
-// Returns the current program.
+// Geturns the current program.
-int CBrain::RetProgram()
+int CBrain::GetProgram()
{
return m_program;
}
@@ -2653,7 +2619,7 @@ void CBrain::SetScriptRun(int rank)
m_scriptRun = rank;
}
-int CBrain::RetScriptRun()
+int CBrain::GetScriptRun()
{
return m_scriptRun;
}
@@ -2663,7 +2629,7 @@ void CBrain::SetScriptName(int rank, char *name)
strcpy(m_scriptName[rank], name);
}
-char* CBrain::RetScriptName(int rank)
+char* CBrain::GetScriptName(int rank)
{
return m_scriptName[rank];
}
@@ -2673,7 +2639,7 @@ void CBrain::SetSoluceName(char *name)
strcpy(m_soluceName, name);
}
-char* CBrain::RetSoluceName()
+char* CBrain::GetSoluceName()
{
return m_soluceName;
}
@@ -2708,7 +2674,7 @@ bool CBrain::ReadSoluce(char* filename)
// Load a script with a text file.
-bool CBrain::ReadProgram(int rank, char* filename)
+bool CBrain::ReadProgram(int rank, const char* filename)
{
if ( m_script[rank] == 0 )
{
@@ -2725,10 +2691,10 @@ bool CBrain::ReadProgram(int rank, char* filename)
// Indicates whether a program is compiled correctly.
-bool CBrain::RetCompile(int rank)
+bool CBrain::GetCompile(int rank)
{
if ( m_script[rank] == 0 ) return false;
- return m_script[rank]->RetCompile();
+ return m_script[rank]->GetCompile();
}
// Saves a script in a text file.
@@ -2807,12 +2773,12 @@ void CBrain::TraceRecordStart()
{
m_traceOper = TO_STOP;
- m_tracePos = m_object->RetPosition(0);
- m_traceAngle = m_object->RetAngleY(0);
+ m_tracePos = m_object->GetPosition(0);
+ m_traceAngle = m_object->GetAngleY(0);
- if ( m_object->RetTraceDown() ) // pencil down?
+ if ( m_object->GetTraceDown() ) // pencil down?
{
- m_traceColor = m_object->RetTraceColor();
+ m_traceColor = m_object->GetTraceColor();
}
else // pen up?
{
@@ -2820,7 +2786,7 @@ void CBrain::TraceRecordStart()
}
delete m_traceRecordBuffer;
- m_traceRecordBuffer = (TraceRecord*)malloc(sizeof(TraceRecord)*MAXTRACERECORD);
+ m_traceRecordBuffer = static_cast<TraceRecord*>(malloc(sizeof(TraceRecord)*MAXTRACERECORD));
m_traceRecordIndex = 0;
}
@@ -2833,16 +2799,16 @@ void CBrain::TraceRecordFrame()
float angle, len, speed;
int color;
- speed = m_physics->RetLinMotionX(MO_REASPEED);
+ speed = m_physics->GetLinMotionX(MO_REASPEED);
if ( speed > 0.0f ) oper = TO_ADVANCE;
if ( speed < 0.0f ) oper = TO_RECEDE;
- speed = m_physics->RetCirMotionY(MO_REASPEED);
+ speed = m_physics->GetCirMotionY(MO_REASPEED);
if ( speed != 0.0f ) oper = TO_TURN;
- if ( m_object->RetTraceDown() ) // pencil down?
+ if ( m_object->GetTraceDown() ) // pencil down?
{
- color = m_object->RetTraceColor();
+ color = m_object->GetTraceColor();
}
else // pen up?
{
@@ -2855,24 +2821,24 @@ void CBrain::TraceRecordFrame()
if ( m_traceOper == TO_ADVANCE ||
m_traceOper == TO_RECEDE )
{
- pos = m_object->RetPosition(0);
+ pos = m_object->GetPosition(0);
len = Math::DistanceProjected(pos, m_tracePos);
TraceRecordOper(m_traceOper, len);
}
if ( m_traceOper == TO_TURN )
{
- angle = m_object->RetAngleY(0)-m_traceAngle;
+ angle = m_object->GetAngleY(0)-m_traceAngle;
TraceRecordOper(m_traceOper, angle);
}
if ( color != m_traceColor )
{
- TraceRecordOper(TO_PEN, (float)color);
+ TraceRecordOper(TO_PEN, static_cast<float>(color));
}
m_traceOper = oper;
- m_tracePos = m_object->RetPosition(0);
- m_traceAngle = m_object->RetAngleY(0);
+ m_tracePos = m_object->GetPosition(0);
+ m_traceAngle = m_object->GetAngleY(0);
m_traceColor = color;
}
}
@@ -2889,7 +2855,7 @@ void CBrain::TraceRecordStop()
if ( m_traceRecordBuffer == 0 ) return;
max = 10000;
- buffer = (char*)malloc(max);
+ buffer = static_cast<char*>(malloc(max));
*buffer = 0;
strncat(buffer, "extern void object::AutoDraw()\n{\n", max-1);
@@ -2975,14 +2941,14 @@ bool CBrain::TraceRecordPut(char *buffer, int max, TraceOper oper, float param)
if ( oper == TO_TURN )
{
param = -param*180.0f/Math::PI;
- sprintf(line, "\tturn(%d);\n", (int)param);
+ sprintf(line, "\tturn(%d);\n", static_cast<int>(param));
//? sprintf(line, "\tturn(%.1f);\n", param);
strncat(buffer, line, max-1);
}
if ( oper == TO_PEN )
{
- color = (int)param;
+ color = static_cast<int>(param);
if ( color == -1 ) strncat(buffer, "\tpenup();\n", max-1);
if ( color == 1 ) strncat(buffer, "\tpendown(Black);\n", max-1);
if ( color == 8 ) strncat(buffer, "\tpendown(Yellow);\n", max-1);
diff --git a/src/object/brain.h b/src/object/brain.h
index 0220ffc..008fb67 100644
--- a/src/object/brain.h
+++ b/src/object/brain.h
@@ -18,11 +18,9 @@
#pragma once
-
-#include <stdio.h>
-
-#include "common/misc.h"
#include "common/event.h"
+#include "common/misc.h"
+
#include "object/object.h"
#include "object/task/taskmanip.h"
#include "object/task/taskflag.h"
@@ -30,22 +28,28 @@
class CInstanceManager;
-class CD3DEngine;
-class CTerrain;
-class CWater;
-class CCamera;
class CObject;
class CPhysics;
class CMotion;
class CTaskManager;
-class CInterface;
-class CWindow;
-class CDisplayText;
class CScript;
class CRobotMain;
+class CSoundInterface;
+
+namespace Ui {
class CStudio;
-class CSound;
-class CParticule;
+class CInterface;
+class CWindow;
+class CDisplayText;
+}
+
+namespace Gfx {
+class CEngine;
+class CTerrain;
+class CWater;
+class CCamera;
+class CParticle;
+} /* Gfx */
const int BRAINMAXSCRIPT = 10;
@@ -88,29 +92,29 @@ public:
bool IsBusy();
void SetActivity(bool bMode);
- bool RetActivity();
+ bool GetActivity();
bool IsProgram();
bool ProgramExist(int rank);
void RunProgram(int rank);
int FreeProgram();
- int RetProgram();
+ int GetProgram();
void StopProgram();
void StopTask();
bool IntroduceVirus();
void SetActiveVirus(bool bActive);
- bool RetActiveVirus();
+ bool GetActiveVirus();
void SetScriptRun(int rank);
- int RetScriptRun();
+ int GetScriptRun();
void SetScriptName(int rank, char *name);
- char* RetScriptName(int rank);
+ char* GetScriptName(int rank);
void SetSoluceName(char *name);
- char* RetSoluceName();
+ char* GetSoluceName();
bool ReadSoluce(char* filename);
- bool ReadProgram(int rank, char* filename);
- bool RetCompile(int rank);
+ bool ReadProgram(int rank, const char* filename);
+ bool GetCompile(int rank);
bool WriteProgram(int rank, char* filename);
bool ReadStack(FILE *file);
bool WriteStack(FILE *file);
@@ -143,14 +147,14 @@ protected:
void GroundFlat();
void ColorFlag(int color);
- void UpdateScript(CWindow *pw);
- int RetSelScript();
+ void UpdateScript(Ui::CWindow *pw);
+ int GetSelScript();
void BlinkScript(bool bEnable);
- void CheckInterface(CWindow *pw, EventMsg event, bool bState);
- void EnableInterface(CWindow *pw, EventMsg event, bool bState);
- void DeadInterface(CWindow *pw, EventMsg event, bool bState);
- void DefaultEnter(CWindow *pw, EventMsg event, bool bState=true);
+ void CheckInterface(Ui::CWindow *pw, EventType event, bool bState);
+ void EnableInterface(Ui::CWindow *pw, EventType event, bool bState);
+ void DeadInterface(Ui::CWindow *pw, EventType event, bool bState);
+ void DefaultEnter(Ui::CWindow *pw, EventType event, bool bState=true);
void TraceRecordStart();
void TraceRecordFrame();
@@ -159,60 +163,61 @@ protected:
bool TraceRecordPut(char *buffer, int max, TraceOper oper, float param);
protected:
- CInstanceManager* m_iMan;
- CD3DEngine* m_engine;
- CTerrain* m_terrain;
- CWater* m_water;
- CCamera* m_camera;
- CObject* m_object;
- CPhysics* m_physics;
- CMotion* m_motion;
- CInterface* m_interface;
- CDisplayText* m_displayText;
- CRobotMain* m_main;
- CStudio* m_studio;
- CSound* m_sound;
- CParticule* m_particule;
- CTaskManager* m_primaryTask;
- CTaskManager* m_secondaryTask;
-
- CScript* m_script[BRAINMAXSCRIPT];
- int m_selScript; // rank of the selected script
- int m_program; // rank of the executed program / ​​-1
- bool m_bActivity;
- bool m_bBurn;
- bool m_bActiveVirus;
-
- int m_scriptRun;
- char m_scriptName[BRAINMAXSCRIPT][50];
- char m_soluceName[50];
-
- EventMsg m_buttonAxe;
- EventMsg m_manipStyle;
- EventMsg m_defaultEnter;
- EventMsg m_interfaceEvent[100];
-
- CObject* m_antTarget;
- CObject* m_beeBullet;
- float m_beeBulletSpeed;
- Math::Vector m_startPos;
- float m_time;
- float m_burnTime;
- float m_lastUpdateTime;
- float m_lastHumanTime;
- float m_lastSpiderTime;
- float m_lastWormTime;
- float m_lastBulletTime;
- float m_lastAlarmTime;
- int m_soundChannelAlarm;
- int m_flagColor;
-
- bool m_bTraceRecord;
- TraceOper m_traceOper;
- Math::Vector m_tracePos;
- float m_traceAngle;
- int m_traceColor;
- int m_traceRecordIndex;
- TraceRecord* m_traceRecordBuffer;
+ CInstanceManager* m_iMan;
+ Gfx::CEngine* m_engine;
+ Gfx::CTerrain* m_terrain;
+ Gfx::CWater* m_water;
+ Gfx::CCamera* m_camera;
+ Gfx::CParticle* m_particle;
+ CObject* m_object;
+ CPhysics* m_physics;
+ CMotion* m_motion;
+ Ui::CInterface* m_interface;
+ Ui::CDisplayText* m_displayText;
+ CRobotMain* m_main;
+ Ui::CStudio* m_studio;
+ CSoundInterface* m_sound;
+
+ CTaskManager* m_primaryTask;
+ CTaskManager* m_secondaryTask;
+
+ CScript* m_script[BRAINMAXSCRIPT];
+ int m_selScript; // rank of the selected script
+ int m_program; // rank of the executed program / ​​-1
+ bool m_bActivity;
+ bool m_bBurn;
+ bool m_bActiveVirus;
+
+ int m_scriptRun;
+ char m_scriptName[BRAINMAXSCRIPT][50];
+ char m_soluceName[50];
+
+ EventType m_buttonAxe;
+ EventType m_manipStyle;
+ EventType m_defaultEnter;
+ EventType m_interfaceEvent[100];
+
+ CObject* m_antTarget;
+ CObject* m_beeBullet;
+ float m_beeBulletSpeed;
+ Math::Vector m_startPos;
+ float m_time;
+ float m_burnTime;
+ float m_lastUpdateTime;
+ float m_lastHumanTime;
+ float m_lastSpiderTime;
+ float m_lastWormTime;
+ float m_lastBulletTime;
+ float m_lastAlarmTime;
+ int m_soundChannelAlarm;
+ int m_flagColor;
+
+ bool m_bTraceRecord;
+ TraceOper m_traceOper;
+ Math::Vector m_tracePos;
+ float m_traceAngle;
+ int m_traceColor;
+ int m_traceRecordIndex;
+ TraceRecord* m_traceRecordBuffer;
};
diff --git a/src/object/mainmovie.cpp b/src/object/mainmovie.cpp
index 7049842..346f370 100644
--- a/src/object/mainmovie.cpp
+++ b/src/object/mainmovie.cpp
@@ -37,12 +37,10 @@ CMainMovie::CMainMovie(CInstanceManager* iMan)
m_iMan = iMan;
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_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_main = static_cast< CRobotMain* >(m_iMan->SearchInstance(CLASS_MAIN));
+ m_camera = static_cast< Gfx::CCamera* >(m_iMan->SearchInstance(CLASS_CAMERA));
+ m_sound = static_cast< CSoundInterface* >(m_iMan->SearchInstance(CLASS_SOUND));
Flush();
}
@@ -84,20 +82,20 @@ bool CMainMovie::Start(MainMovieType type, float time)
return true;
}
- motion = pObj->RetMotion();
+ motion = pObj->GetMotion();
if ( motion != 0 )
{
motion->SetAction(MHS_SATCOM, 0.5f); // reads the SatCom
}
- m_camera->RetCamera(m_initialEye, m_initialLookat);
- m_camera->SetType(CAMERA_SCRIPT);
- m_camera->SetSmooth(CS_HARD);
+ m_camera->GetCamera(m_initialEye, m_initialLookat);
+ m_camera->SetType(Gfx::CAM_TYPE_SCRIPT);
+ m_camera->SetSmooth(Gfx::CAM_SMOOTH_HARD);
m_camera->SetScriptEye(m_initialEye);
m_camera->SetScriptLookat(m_initialLookat);
m_camera->FixCamera();
- mat = pObj->RetWorldMatrix(0);
+ mat = pObj->GetWorldMatrix(0);
m_finalLookat[0] = Math::Transform(*mat, Math::Vector( 1.6f, 1.0f, 1.2f));
m_finalEye[0] = Math::Transform(*mat, Math::Vector(-1.5f, 5.0f, 3.0f));
m_finalLookat[1] = Math::Transform(*mat, Math::Vector( 1.6f, 1.0f, 1.2f));
@@ -109,14 +107,14 @@ bool CMainMovie::Start(MainMovieType type, float time)
pObj = m_main->SearchHuman();
if ( pObj != 0 )
{
- motion = pObj->RetMotion();
+ motion = pObj->GetMotion();
if ( motion != 0 )
{
motion->SetAction(-1); // finishes reading SatCom
}
}
- m_camera->SetType(CAMERA_BACK);
+ m_camera->SetType(Gfx::CAM_TYPE_BACK);
m_type = MM_NONE; // it's already over!
}
@@ -135,7 +133,7 @@ bool CMainMovie::Stop()
pObj = m_main->SearchHuman();
if ( pObj != 0 )
{
- motion = pObj->RetMotion();
+ motion = pObj->GetMotion();
if ( motion != 0 )
{
motion->SetAction(-1); // finishes reading SatCom
@@ -221,16 +219,16 @@ bool CMainMovie::EventProcess(const Event &event)
}
-// Returns the type of the current movie.
+// Geturns the type of the current movie.
-MainMovieType CMainMovie::RetType()
+MainMovieType CMainMovie::GetType()
{
return m_type;
}
-// Returns the type of movie stop.
+// Geturns the type of movie stop.
-MainMovieType CMainMovie::RetStopType()
+MainMovieType CMainMovie::GetStopType()
{
return m_stopType;
}
diff --git a/src/object/mainmovie.h b/src/object/mainmovie.h
index 23721fb..27e4df3 100644
--- a/src/object/mainmovie.h
+++ b/src/object/mainmovie.h
@@ -24,15 +24,14 @@
class CInstanceManager;
-class CEvent;
-class CD3DEngine;
-class CInterface;
class CRobotMain;
-class CCamera;
-class CSound;
-
-
+class CSoundInterface;
+namespace Gfx
+{
+ class CCamera;
+ class CEngine;
+};
enum MainMovieType
{
@@ -54,24 +53,22 @@ public:
bool Stop();
bool IsExist();
bool EventProcess(const Event &event);
- MainMovieType RetType();
- MainMovieType RetStopType();
+ MainMovieType GetType();
+ MainMovieType GetStopType();
protected:
protected:
- CInstanceManager* m_iMan;
- CEvent* m_event;
- CD3DEngine* m_engine;
- CInterface* m_interface;
- CRobotMain* m_main;
- CCamera* m_camera;
- CSound* m_sound;
-
- MainMovieType m_type;
- MainMovieType m_stopType;
- float m_speed;
- float m_progress;
+ CInstanceManager* m_iMan;
+ Gfx::CEngine* m_engine;
+ CRobotMain* m_main;
+ Gfx::CCamera* m_camera;
+ CSoundInterface* m_sound;
+
+ MainMovieType m_type;
+ MainMovieType m_stopType;
+ float m_speed;
+ float m_progress;
Math::Vector m_initialEye;
Math::Vector m_initialLookat;
Math::Vector m_finalEye[2];
diff --git a/src/object/motion/motion.cpp b/src/object/motion/motion.cpp
index 6278627..df8a4be 100644
--- a/src/object/motion/motion.cpp
+++ b/src/object/motion/motion.cpp
@@ -17,14 +17,13 @@
// motion.cpp
-#include <stdio.h>
-
#include "object/motion/motion.h"
#include "common/iman.h"
#include "script/cmdtoken.h"
-
+#include <stdio.h>
+#include <string.h>
// Object's constructor.
@@ -34,14 +33,14 @@ CMotion::CMotion(CInstanceManager* iMan, CObject* object)
m_iMan = iMan;
m_iMan->AddInstance(CLASS_MOTION, this, 100);
- m_engine = (CD3DEngine*)m_iMan->SearchInstance(CLASS_ENGINE);
- m_light = (CLight*)m_iMan->SearchInstance(CLASS_LIGHT);
- m_particule = (CParticule*)m_iMan->SearchInstance(CLASS_PARTICULE);
- m_terrain = (CTerrain*)m_iMan->SearchInstance(CLASS_TERRAIN);
- m_water = (CWater*)m_iMan->SearchInstance(CLASS_WATER);
- m_camera = (CCamera*)m_iMan->SearchInstance(CLASS_CAMERA);
- m_main = (CRobotMain*)m_iMan->SearchInstance(CLASS_MAIN);
- m_sound = (CSound*)m_iMan->SearchInstance(CLASS_SOUND);
+ m_engine = static_cast< Gfx::CEngine* >(m_iMan->SearchInstance(CLASS_ENGINE));
+ m_light = static_cast< Gfx::CLight* >(m_iMan->SearchInstance(CLASS_LIGHT));
+ m_particle = static_cast< Gfx::CParticle* >(m_iMan->SearchInstance(CLASS_PARTICULE));
+ m_terrain = static_cast< Gfx::CTerrain* >(m_iMan->SearchInstance(CLASS_TERRAIN));
+ m_water = static_cast< Gfx::CWater* >(m_iMan->SearchInstance(CLASS_WATER));
+ m_camera = static_cast< Gfx::CCamera* >(m_iMan->SearchInstance(CLASS_CAMERA));
+ m_main = static_cast< CRobotMain* >(m_iMan->SearchInstance(CLASS_MAIN));
+ m_sound = static_cast< CSoundInterface* >(m_iMan->SearchInstance(CLASS_SOUND));
m_object = object;
m_physics = 0;
@@ -95,16 +94,16 @@ bool CMotion::EventProcess(const Event &event)
Math::Vector pos, dir;
float time;
- if ( m_object->RetType() != OBJECT_TOTO &&
- m_engine->RetPause() ) return true;
+ if ( m_object->GetType() != OBJECT_TOTO &&
+ m_engine->GetPause() ) return true;
- if ( event.event != EVENT_FRAME ) return true;
+ if ( event.type != EVENT_FRAME ) return true;
m_progress += event.rTime*m_actionTime;
if ( m_progress > 1.0f ) m_progress = 1.0f; // (*)
- pos = m_object->RetPosition(0);
- if ( pos.y < m_water->RetLevel(m_object) ) // underwater?
+ pos = m_object->GetPosition(0);
+ if ( pos.y < m_water->GetLevel(m_object) ) // underwater?
{
time = event.rTime*3.0f; // everything is slower
}
@@ -113,19 +112,19 @@ bool CMotion::EventProcess(const Event &event)
time = event.rTime*10.0f;
}
- dir = m_object->RetLinVibration();
+ dir = m_object->GetLinVibration();
dir.x = Math::Smooth(dir.x, m_linVibration.x, time);
dir.y = Math::Smooth(dir.y, m_linVibration.y, time);
dir.z = Math::Smooth(dir.z, m_linVibration.z, time);
m_object->SetLinVibration(dir);
- dir = m_object->RetCirVibration();
+ dir = m_object->GetCirVibration();
dir.x = Math::Smooth(dir.x, m_cirVibration.x, time);
dir.y = Math::Smooth(dir.y, m_cirVibration.y, time);
dir.z = Math::Smooth(dir.z, m_cirVibration.z, time);
m_object->SetCirVibration(dir);
- dir = m_object->RetInclinaison();
+ dir = m_object->GetInclinaison();
dir.x = Math::Smooth(dir.x, m_inclinaison.x, time);
dir.y = Math::Smooth(dir.y, m_inclinaison.y, time);
dir.z = Math::Smooth(dir.z, m_inclinaison.z, time);
@@ -148,9 +147,9 @@ Error CMotion::SetAction(int action, float time)
return ERR_OK;
}
-// Returns the current action.
+// Geturns the current action.
-int CMotion::RetAction()
+int CMotion::GetAction()
{
return m_actionType;
}
@@ -163,7 +162,7 @@ bool CMotion::SetParam(int rank, float value)
return false;
}
-float CMotion::RetParam(int rank)
+float CMotion::GetParam(int rank)
{
return 0.0f;
}
@@ -208,7 +207,7 @@ void CMotion::SetLinVibration(Math::Vector dir)
m_linVibration = dir;
}
-Math::Vector CMotion::RetLinVibration()
+Math::Vector CMotion::GetLinVibration()
{
return m_linVibration;
}
@@ -220,7 +219,7 @@ void CMotion::SetCirVibration(Math::Vector dir)
m_cirVibration = dir;
}
-Math::Vector CMotion::RetCirVibration()
+Math::Vector CMotion::GetCirVibration()
{
return m_cirVibration;
}
@@ -232,7 +231,7 @@ void CMotion::SetInclinaison(Math::Vector dir)
m_inclinaison = dir;
}
-Math::Vector CMotion::RetInclinaison()
+Math::Vector CMotion::GetInclinaison()
{
return m_inclinaison;
}
diff --git a/src/object/motion/motion.h b/src/object/motion/motion.h
index 9828283..d195e65 100644
--- a/src/object/motion/motion.h
+++ b/src/object/motion/motion.h
@@ -20,22 +20,26 @@
#include "common/event.h"
-#include "common/misc.h"
+#include "common/global.h"
#include "object/object.h"
class CInstanceManager;
-class CD3DEngine;
+
+namespace Gfx {
+class CEngine;
class CLight;
-class CParticule;
+class CParticle;
class CTerrain;
class CWater;
class CCamera;
+}
+
class CBrain;
class CPhysics;
class CObject;
class CRobotMain;
-class CSound;
+class CSoundInterface;
class CMotion
@@ -47,44 +51,44 @@ public:
void SetPhysics(CPhysics* physics);
void SetBrain(CBrain* brain);
- virtual void DeleteObject(bool bAll=false);
- virtual bool Create(Math::Vector pos, float angle, ObjectType type, float power);
- virtual bool EventProcess(const Event &event);
- virtual Error SetAction(int action, float time=0.2f);
- virtual int RetAction();
+ virtual void DeleteObject(bool bAll=false);
+ virtual bool Create(Math::Vector pos, float angle, ObjectType type, float power);
+ virtual bool EventProcess(const Event &event);
+ virtual Error SetAction(int action, float time=0.2f);
+ virtual int GetAction();
- virtual bool SetParam(int rank, float value);
- virtual float RetParam(int rank);
+ virtual bool SetParam(int rank, float value);
+ virtual float GetParam(int rank);
- virtual bool Write(char *line);
- virtual bool Read(char *line);
+ virtual bool Write(char *line);
+ virtual bool Read(char *line);
- virtual void SetLinVibration(Math::Vector dir);
- virtual Math::Vector RetLinVibration();
- virtual void SetCirVibration(Math::Vector dir);
- virtual Math::Vector RetCirVibration();
- virtual void SetInclinaison(Math::Vector dir);
- virtual Math::Vector RetInclinaison();
+ virtual void SetLinVibration(Math::Vector dir);
+ virtual Math::Vector GetLinVibration();
+ virtual void SetCirVibration(Math::Vector dir);
+ virtual Math::Vector GetCirVibration();
+ virtual void SetInclinaison(Math::Vector dir);
+ virtual Math::Vector GetInclinaison();
protected:
protected:
- CInstanceManager* m_iMan;
- CD3DEngine* m_engine;
- CLight* m_light;
- CParticule* m_particule;
- CTerrain* m_terrain;
- CWater* m_water;
- CCamera* m_camera;
- CObject* m_object;
- CBrain* m_brain;
- CPhysics* m_physics;
- CRobotMain* m_main;
- CSound* m_sound;
-
- int m_actionType;
- float m_actionTime;
- float m_progress;
+ CInstanceManager* m_iMan;
+ Gfx::CEngine* m_engine;
+ Gfx::CLight* m_light;
+ Gfx::CParticle* m_particle;
+ Gfx::CTerrain* m_terrain;
+ Gfx::CWater* m_water;
+ Gfx::CCamera* m_camera;
+ CObject* m_object;
+ CBrain* m_brain;
+ CPhysics* m_physics;
+ CRobotMain* m_main;
+ CSoundInterface* m_sound;
+
+ int m_actionType;
+ float m_actionTime;
+ float m_progress;
Math::Vector m_linVibration; // linear vibration
Math::Vector m_cirVibration; // circular vibration
diff --git a/src/object/motion/motionant.cpp b/src/object/motion/motionant.cpp
index c6a9357..6259856 100644
--- a/src/object/motion/motionant.cpp
+++ b/src/object/motion/motionant.cpp
@@ -21,8 +21,8 @@
#include "object/motion/motionant.h"
-#include "old/modfile.h"
-#include "old/particule.h"
+#include "graphics/engine/modelfile.h"
+#include "graphics/engine/particle.h"
#include "physics/physics.h"
@@ -46,7 +46,7 @@ CMotionAnt::CMotionAnt(CInstanceManager* iMan, CObject* object)
m_armMemberIndex = 0;
m_armLastAction = -1;
m_bArmStop = false;
- m_lastParticule = 0.0f;
+ m_lastParticle = 0.0f;
}
// Object's destructor.
@@ -68,18 +68,18 @@ void CMotionAnt::DeleteObject(bool bAll)
bool CMotionAnt::Create(Math::Vector pos, float angle, ObjectType type,
float power)
{
- CModFile* pModFile;
+ Gfx::CModelFile* pModFile;
int rank;
- if ( m_engine->RetRestCreate() < 3+18 ) return false;
+// if ( m_engine->GetRestCreate() < 3+18 ) return false;
- pModFile = new CModFile(m_iMan);
+ pModFile = new Gfx::CModelFile(m_iMan);
m_object->SetType(type);
// Creates the main base.
rank = m_engine->CreateObject();
- m_engine->SetObjectType(rank, TYPEVEHICULE); // this is a moving object
+ m_engine->SetObjectType(rank, Gfx::ENG_OBJTYPE_VEHICULE); // this is a moving object
m_object->SetObjectRank(0, rank);
pModFile->ReadModel("objects\\ant1.mod");
@@ -95,7 +95,7 @@ bool CMotionAnt::Create(Math::Vector pos, float angle, ObjectType type,
// Creates the head.
rank = m_engine->CreateObject();
- m_engine->SetObjectType(rank, TYPEDESCENDANT);
+ m_engine->SetObjectType(rank,Gfx::ENG_OBJTYPE_DESCENDANT);
m_object->SetObjectRank(1, rank);
m_object->SetObjectParent(1, 0);
pModFile->ReadModel("objects\\ant2.mod");
@@ -104,7 +104,7 @@ bool CMotionAnt::Create(Math::Vector pos, float angle, ObjectType type,
// Creates the tail.
rank = m_engine->CreateObject();
- m_engine->SetObjectType(rank, TYPEDESCENDANT);
+ m_engine->SetObjectType(rank,Gfx::ENG_OBJTYPE_DESCENDANT);
m_object->SetObjectRank(2, rank);
m_object->SetObjectParent(2, 0);
pModFile->ReadModel("objects\\ant3.mod");
@@ -113,7 +113,7 @@ bool CMotionAnt::Create(Math::Vector pos, float angle, ObjectType type,
// Creates a right-back thigh.
rank = m_engine->CreateObject();
- m_engine->SetObjectType(rank, TYPEDESCENDANT);
+ m_engine->SetObjectType(rank,Gfx::ENG_OBJTYPE_DESCENDANT);
m_object->SetObjectRank(3, rank);
m_object->SetObjectParent(3, 0);
pModFile->ReadModel("objects\\ant4.mod");
@@ -122,7 +122,7 @@ bool CMotionAnt::Create(Math::Vector pos, float angle, ObjectType type,
// Creates a right-back leg.
rank = m_engine->CreateObject();
- m_engine->SetObjectType(rank, TYPEDESCENDANT);
+ m_engine->SetObjectType(rank,Gfx::ENG_OBJTYPE_DESCENDANT);
m_object->SetObjectRank(4, rank);
m_object->SetObjectParent(4, 3);
pModFile->ReadModel("objects\\ant5.mod");
@@ -131,7 +131,7 @@ bool CMotionAnt::Create(Math::Vector pos, float angle, ObjectType type,
// Creates a right-back foot.
rank = m_engine->CreateObject();
- m_engine->SetObjectType(rank, TYPEDESCENDANT);
+ m_engine->SetObjectType(rank,Gfx::ENG_OBJTYPE_DESCENDANT);
m_object->SetObjectRank(5, rank);
m_object->SetObjectParent(5, 4);
pModFile->ReadModel("objects\\ant6.mod");
@@ -140,7 +140,7 @@ bool CMotionAnt::Create(Math::Vector pos, float angle, ObjectType type,
// Creates two middle-right thighs.
rank = m_engine->CreateObject();
- m_engine->SetObjectType(rank, TYPEDESCENDANT);
+ m_engine->SetObjectType(rank,Gfx::ENG_OBJTYPE_DESCENDANT);
m_object->SetObjectRank(6, rank);
m_object->SetObjectParent(6, 0);
pModFile->ReadModel("objects\\ant4.mod");
@@ -149,7 +149,7 @@ bool CMotionAnt::Create(Math::Vector pos, float angle, ObjectType type,
// Creates two middle-right legs.
rank = m_engine->CreateObject();
- m_engine->SetObjectType(rank, TYPEDESCENDANT);
+ m_engine->SetObjectType(rank,Gfx::ENG_OBJTYPE_DESCENDANT);
m_object->SetObjectRank(7, rank);
m_object->SetObjectParent(7, 6);
pModFile->ReadModel("objects\\ant5.mod");
@@ -158,7 +158,7 @@ bool CMotionAnt::Create(Math::Vector pos, float angle, ObjectType type,
// Creates two middle-right foots.
rank = m_engine->CreateObject();
- m_engine->SetObjectType(rank, TYPEDESCENDANT);
+ m_engine->SetObjectType(rank,Gfx::ENG_OBJTYPE_DESCENDANT);
m_object->SetObjectRank(8, rank);
m_object->SetObjectParent(8, 7);
pModFile->ReadModel("objects\\ant6.mod");
@@ -167,7 +167,7 @@ bool CMotionAnt::Create(Math::Vector pos, float angle, ObjectType type,
// Creates the right front thigh.
rank = m_engine->CreateObject();
- m_engine->SetObjectType(rank, TYPEDESCENDANT);
+ m_engine->SetObjectType(rank,Gfx::ENG_OBJTYPE_DESCENDANT);
m_object->SetObjectRank(9, rank);
m_object->SetObjectParent(9, 0);
pModFile->ReadModel("objects\\ant4.mod");
@@ -176,7 +176,7 @@ bool CMotionAnt::Create(Math::Vector pos, float angle, ObjectType type,
// Creates the right front leg.
rank = m_engine->CreateObject();
- m_engine->SetObjectType(rank, TYPEDESCENDANT);
+ m_engine->SetObjectType(rank,Gfx::ENG_OBJTYPE_DESCENDANT);
m_object->SetObjectRank(10, rank);
m_object->SetObjectParent(10, 9);
pModFile->ReadModel("objects\\ant5.mod");
@@ -185,7 +185,7 @@ bool CMotionAnt::Create(Math::Vector pos, float angle, ObjectType type,
// Creates the right front foot.
rank = m_engine->CreateObject();
- m_engine->SetObjectType(rank, TYPEDESCENDANT);
+ m_engine->SetObjectType(rank,Gfx::ENG_OBJTYPE_DESCENDANT);
m_object->SetObjectRank(11, rank);
m_object->SetObjectParent(11, 10);
pModFile->ReadModel("objects\\ant6.mod");
@@ -194,7 +194,7 @@ bool CMotionAnt::Create(Math::Vector pos, float angle, ObjectType type,
// Creates a left-back thigh.
rank = m_engine->CreateObject();
- m_engine->SetObjectType(rank, TYPEDESCENDANT);
+ m_engine->SetObjectType(rank,Gfx::ENG_OBJTYPE_DESCENDANT);
m_object->SetObjectRank(12, rank);
m_object->SetObjectParent(12, 0);
pModFile->ReadModel("objects\\ant4.mod");
@@ -204,7 +204,7 @@ bool CMotionAnt::Create(Math::Vector pos, float angle, ObjectType type,
// Creates a left-back leg.
rank = m_engine->CreateObject();
- m_engine->SetObjectType(rank, TYPEDESCENDANT);
+ m_engine->SetObjectType(rank,Gfx::ENG_OBJTYPE_DESCENDANT);
m_object->SetObjectRank(13, rank);
m_object->SetObjectParent(13, 12);
pModFile->ReadModel("objects\\ant5.mod");
@@ -214,7 +214,7 @@ bool CMotionAnt::Create(Math::Vector pos, float angle, ObjectType type,
// Creates a left-back foot.
rank = m_engine->CreateObject();
- m_engine->SetObjectType(rank, TYPEDESCENDANT);
+ m_engine->SetObjectType(rank,Gfx::ENG_OBJTYPE_DESCENDANT);
m_object->SetObjectRank(14, rank);
m_object->SetObjectParent(14, 13);
pModFile->ReadModel("objects\\ant6.mod");
@@ -224,7 +224,7 @@ bool CMotionAnt::Create(Math::Vector pos, float angle, ObjectType type,
// Creates two middle-left thighs.
rank = m_engine->CreateObject();
- m_engine->SetObjectType(rank, TYPEDESCENDANT);
+ m_engine->SetObjectType(rank,Gfx::ENG_OBJTYPE_DESCENDANT);
m_object->SetObjectRank(15, rank);
m_object->SetObjectParent(15, 0);
pModFile->ReadModel("objects\\ant4.mod");
@@ -234,7 +234,7 @@ bool CMotionAnt::Create(Math::Vector pos, float angle, ObjectType type,
// Creates two middle-left legs.
rank = m_engine->CreateObject();
- m_engine->SetObjectType(rank, TYPEDESCENDANT);
+ m_engine->SetObjectType(rank,Gfx::ENG_OBJTYPE_DESCENDANT);
m_object->SetObjectRank(16, rank);
m_object->SetObjectParent(16, 15);
pModFile->ReadModel("objects\\ant5.mod");
@@ -244,7 +244,7 @@ bool CMotionAnt::Create(Math::Vector pos, float angle, ObjectType type,
// Creates two middle-left foot.
rank = m_engine->CreateObject();
- m_engine->SetObjectType(rank, TYPEDESCENDANT);
+ m_engine->SetObjectType(rank,Gfx::ENG_OBJTYPE_DESCENDANT);
m_object->SetObjectRank(17, rank);
m_object->SetObjectParent(17, 16);
pModFile->ReadModel("objects\\ant6.mod");
@@ -254,7 +254,7 @@ bool CMotionAnt::Create(Math::Vector pos, float angle, ObjectType type,
// Creates the left front thigh.
rank = m_engine->CreateObject();
- m_engine->SetObjectType(rank, TYPEDESCENDANT);
+ m_engine->SetObjectType(rank,Gfx::ENG_OBJTYPE_DESCENDANT);
m_object->SetObjectRank(18, rank);
m_object->SetObjectParent(18, 0);
pModFile->ReadModel("objects\\ant4.mod");
@@ -264,7 +264,7 @@ bool CMotionAnt::Create(Math::Vector pos, float angle, ObjectType type,
// Creates the left front leg.
rank = m_engine->CreateObject();
- m_engine->SetObjectType(rank, TYPEDESCENDANT);
+ m_engine->SetObjectType(rank,Gfx::ENG_OBJTYPE_DESCENDANT);
m_object->SetObjectRank(19, rank);
m_object->SetObjectParent(19, 18);
pModFile->ReadModel("objects\\ant5.mod");
@@ -274,7 +274,7 @@ bool CMotionAnt::Create(Math::Vector pos, float angle, ObjectType type,
// Creates the left front foot.
rank = m_engine->CreateObject();
- m_engine->SetObjectType(rank, TYPEDESCENDANT);
+ m_engine->SetObjectType(rank,Gfx::ENG_OBJTYPE_DESCENDANT);
m_object->SetObjectRank(20, rank);
m_object->SetObjectParent(20, 19);
pModFile->ReadModel("objects\\ant6.mod");
@@ -287,10 +287,10 @@ bool CMotionAnt::Create(Math::Vector pos, float angle, ObjectType type,
CreatePhysics();
m_object->SetFloorHeight(0.0f);
- pos = m_object->RetPosition(0);
+ pos = m_object->GetPosition(0);
m_object->SetPosition(0, pos); // to display the shadows immediately
- m_engine->LoadAllTexture();
+ m_engine->LoadAllTextures();
delete pModFile;
return true;
@@ -373,7 +373,7 @@ void CMotionAnt::CreatePhysics()
m_physics->SetType(TYPE_ROLLING);
- character = m_object->RetCharacter();
+ character = m_object->GetCharacter();
character->wheelFront = 3.0f;
character->wheelBack = 3.0f;
character->wheelLeft = 5.0f;
@@ -418,12 +418,12 @@ bool CMotionAnt::EventProcess(const Event &event)
{
CMotion::EventProcess(event);
- if ( event.event == EVENT_FRAME )
+ if ( event.type == EVENT_FRAME )
{
return EventFrame(event);
}
- if ( event.event == EVENT_KEYDOWN )
+ if ( event.type == EVENT_KEY_DOWN )
{
#if ADJUST_ANGLE
int i;
@@ -467,11 +467,11 @@ bool CMotionAnt::EventFrame(const Event &event)
int i, ii, st, nd, action;
bool bStop;
- if ( m_engine->RetPause() ) return true;
- if ( !m_engine->IsVisiblePoint(m_object->RetPosition(0)) ) return true;
+ if ( m_engine->GetPause() ) return true;
+ if ( !m_engine->IsVisiblePoint(m_object->GetPosition(0)) ) return true;
- s = m_physics->RetLinMotionX(MO_MOTSPEED)*1.5f;
- a = fabs(m_physics->RetCirMotionY(MO_MOTSPEED)*2.0f);
+ s = m_physics->GetLinMotionX(MO_MOTSPEED)*1.5f;
+ a = fabs(m_physics->GetCirMotionY(MO_MOTSPEED)*2.0f);
if ( s == 0.0f && a != 0.0f ) a *= 1.5f;
@@ -495,13 +495,13 @@ bool CMotionAnt::EventFrame(const Event &event)
m_armMember += a;
}
- if ( m_object->RetRuin() ) // destroyed?
+ if ( m_object->GetRuin() ) // destroyed?
{
m_actionType = MAS_RUIN;
}
- if ( m_object->RetBurn() ) // burning?
+ if ( m_object->GetBurn() ) // burning?
{
- if ( m_object->RetFixed() )
+ if ( m_object->GetFixed() )
{
m_actionType = MAS_BURN;
}
@@ -526,7 +526,7 @@ bool CMotionAnt::EventFrame(const Event &event)
else prog = Math::Mod(m_armMember+(2.0f-(i%3))*0.33f+0.3f, 1.0f);
if ( m_bArmStop )
{
- prog = (float)m_armTimeIndex/3.0f;
+ prog = static_cast< float >(m_armTimeIndex/3.0f);
}
if ( prog < 0.33f ) // t0..t1 ?
{
@@ -586,32 +586,32 @@ bool CMotionAnt::EventFrame(const Event &event)
if ( i < 3 ) // right leg (1..3) ?
{
- m_object->SetAngleX(3+3*i+0, Math::Smooth(m_object->RetAngleX(3+3*i+0), Math::PropAngle(tSt[0], tNd[0], prog), time));
- m_object->SetAngleY(3+3*i+0, Math::Smooth(m_object->RetAngleY(3+3*i+0), Math::PropAngle(tSt[1], tNd[1], prog), time));
- m_object->SetAngleZ(3+3*i+0, Math::Smooth(m_object->RetAngleZ(3+3*i+0), Math::PropAngle(tSt[2], tNd[2], prog), time));
- m_object->SetAngleX(3+3*i+1, Math::Smooth(m_object->RetAngleX(3+3*i+1), Math::PropAngle(tSt[3], tNd[3], prog), time));
- m_object->SetAngleY(3+3*i+1, Math::Smooth(m_object->RetAngleY(3+3*i+1), Math::PropAngle(tSt[4], tNd[4], prog), time));
- m_object->SetAngleZ(3+3*i+1, Math::Smooth(m_object->RetAngleZ(3+3*i+1), Math::PropAngle(tSt[5], tNd[5], prog), time));
- m_object->SetAngleX(3+3*i+2, Math::Smooth(m_object->RetAngleX(3+3*i+2), Math::PropAngle(tSt[6], tNd[6], prog), time));
- m_object->SetAngleY(3+3*i+2, Math::Smooth(m_object->RetAngleY(3+3*i+2), Math::PropAngle(tSt[7], tNd[7], prog), time));
- m_object->SetAngleZ(3+3*i+2, Math::Smooth(m_object->RetAngleZ(3+3*i+2), Math::PropAngle(tSt[8], tNd[8], prog), time));
+ m_object->SetAngleX(3+3*i+0, Math::Smooth(m_object->GetAngleX(3+3*i+0), Math::PropAngle(tSt[0], tNd[0], prog), time));
+ m_object->SetAngleY(3+3*i+0, Math::Smooth(m_object->GetAngleY(3+3*i+0), Math::PropAngle(tSt[1], tNd[1], prog), time));
+ m_object->SetAngleZ(3+3*i+0, Math::Smooth(m_object->GetAngleZ(3+3*i+0), Math::PropAngle(tSt[2], tNd[2], prog), time));
+ m_object->SetAngleX(3+3*i+1, Math::Smooth(m_object->GetAngleX(3+3*i+1), Math::PropAngle(tSt[3], tNd[3], prog), time));
+ m_object->SetAngleY(3+3*i+1, Math::Smooth(m_object->GetAngleY(3+3*i+1), Math::PropAngle(tSt[4], tNd[4], prog), time));
+ m_object->SetAngleZ(3+3*i+1, Math::Smooth(m_object->GetAngleZ(3+3*i+1), Math::PropAngle(tSt[5], tNd[5], prog), time));
+ m_object->SetAngleX(3+3*i+2, Math::Smooth(m_object->GetAngleX(3+3*i+2), Math::PropAngle(tSt[6], tNd[6], prog), time));
+ m_object->SetAngleY(3+3*i+2, Math::Smooth(m_object->GetAngleY(3+3*i+2), Math::PropAngle(tSt[7], tNd[7], prog), time));
+ m_object->SetAngleZ(3+3*i+2, Math::Smooth(m_object->GetAngleZ(3+3*i+2), Math::PropAngle(tSt[8], tNd[8], prog), time));
}
else // left leg (4..6) ?
{
- m_object->SetAngleX(3+3*i+0, Math::Smooth(m_object->RetAngleX(3+3*i+0), Math::PropAngle(-tSt[0], -tNd[0], prog), time));
- m_object->SetAngleY(3+3*i+0, Math::Smooth(m_object->RetAngleY(3+3*i+0), Math::PropAngle(-tSt[1], -tNd[1], prog), time));
- m_object->SetAngleZ(3+3*i+0, Math::Smooth(m_object->RetAngleZ(3+3*i+0), Math::PropAngle( tSt[2], tNd[2], prog), time));
- m_object->SetAngleX(3+3*i+1, Math::Smooth(m_object->RetAngleX(3+3*i+1), Math::PropAngle(-tSt[3], -tNd[3], prog), time));
- m_object->SetAngleY(3+3*i+1, Math::Smooth(m_object->RetAngleY(3+3*i+1), Math::PropAngle(-tSt[4], -tNd[4], prog), time));
- m_object->SetAngleZ(3+3*i+1, Math::Smooth(m_object->RetAngleZ(3+3*i+1), Math::PropAngle( tSt[5], tNd[5], prog), time));
- m_object->SetAngleX(3+3*i+2, Math::Smooth(m_object->RetAngleX(3+3*i+2), Math::PropAngle(-tSt[6], -tNd[6], prog), time));
- m_object->SetAngleY(3+3*i+2, Math::Smooth(m_object->RetAngleY(3+3*i+2), Math::PropAngle(-tSt[7], -tNd[7], prog), time));
- m_object->SetAngleZ(3+3*i+2, Math::Smooth(m_object->RetAngleZ(3+3*i+2), Math::PropAngle( tSt[8], tNd[8], prog), time));
+ m_object->SetAngleX(3+3*i+0, Math::Smooth(m_object->GetAngleX(3+3*i+0), Math::PropAngle(-tSt[0], -tNd[0], prog), time));
+ m_object->SetAngleY(3+3*i+0, Math::Smooth(m_object->GetAngleY(3+3*i+0), Math::PropAngle(-tSt[1], -tNd[1], prog), time));
+ m_object->SetAngleZ(3+3*i+0, Math::Smooth(m_object->GetAngleZ(3+3*i+0), Math::PropAngle( tSt[2], tNd[2], prog), time));
+ m_object->SetAngleX(3+3*i+1, Math::Smooth(m_object->GetAngleX(3+3*i+1), Math::PropAngle(-tSt[3], -tNd[3], prog), time));
+ m_object->SetAngleY(3+3*i+1, Math::Smooth(m_object->GetAngleY(3+3*i+1), Math::PropAngle(-tSt[4], -tNd[4], prog), time));
+ m_object->SetAngleZ(3+3*i+1, Math::Smooth(m_object->GetAngleZ(3+3*i+1), Math::PropAngle( tSt[5], tNd[5], prog), time));
+ m_object->SetAngleX(3+3*i+2, Math::Smooth(m_object->GetAngleX(3+3*i+2), Math::PropAngle(-tSt[6], -tNd[6], prog), time));
+ m_object->SetAngleY(3+3*i+2, Math::Smooth(m_object->GetAngleY(3+3*i+2), Math::PropAngle(-tSt[7], -tNd[7], prog), time));
+ m_object->SetAngleZ(3+3*i+2, Math::Smooth(m_object->GetAngleZ(3+3*i+2), Math::PropAngle( tSt[8], tNd[8], prog), time));
}
}
#if ADJUST_ANGLE
- if ( m_object->RetSelect() )
+ if ( m_object->GetSelect() )
{
char s[100];
sprintf(s, "A:time=%d Q:part=%d W:member=%d", m_armTimeIndex, m_armPartIndex, m_armMemberIndex);
@@ -664,8 +664,8 @@ bool CMotionAnt::EventFrame(const Event &event)
SetInclinaison(dir);
time = event.rTime*1.0f;
- m_object->SetAngleZ(1, Math::Smooth(m_object->RetAngleZ(1), 0.0f, time)); // head
- m_object->SetAngleZ(2, Math::Smooth(m_object->RetAngleZ(2), 0.0f, time)); // tail
+ m_object->SetAngleZ(1, Math::Smooth(m_object->GetAngleZ(1), 0.0f, time)); // head
+ m_object->SetAngleZ(2, Math::Smooth(m_object->GetAngleZ(2), 0.0f, time)); // tail
}
else if ( m_actionType == MAS_RUIN ) // destroyed?
{
@@ -676,17 +676,17 @@ bool CMotionAnt::EventFrame(const Event &event)
}
else if ( m_actionType == MAS_BACK1 ) // starts on the back?
{
- if ( m_lastParticule+m_engine->ParticuleAdapt(0.05f) <= m_armTimeAbs )
+ if ( m_lastParticle+m_engine->ParticleAdapt(0.05f) <= m_armTimeAbs )
{
- m_lastParticule = m_armTimeAbs;
+ m_lastParticle = m_armTimeAbs;
- pos = m_object->RetPosition(0);
+ pos = m_object->GetPosition(0);
speed.x = (Math::Rand()-0.5f)*10.0f;
speed.z = (Math::Rand()-0.5f)*10.0f;
speed.y = Math::Rand()*5.0f;
dim.x = Math::Rand()*3.0f+2.0f;
dim.y = dim.x;
- m_particule->CreateParticule(pos, speed, dim, PARTICRASH, 2.0f);
+ m_particle->CreateParticle(pos, speed, dim, Gfx::PARTICRASH, 2.0f);
}
if ( m_progress < 0.5f )
@@ -718,13 +718,13 @@ bool CMotionAnt::EventFrame(const Event &event)
}
else if ( m_actionType == MAS_BACK2 ) // moves on the back?
{
- if ( m_lastParticule+m_engine->ParticuleAdapt(0.05f) <= m_armTimeAbs )
+ if ( m_lastParticle+m_engine->ParticleAdapt(0.05f) <= m_armTimeAbs )
{
- m_lastParticule = m_armTimeAbs;
+ m_lastParticle = m_armTimeAbs;
if ( rand()%10 == 0 )
{
- pos = m_object->RetPosition(0);
+ pos = m_object->GetPosition(0);
pos.x += (Math::Rand()-0.5f)*5.0f;
pos.z += (Math::Rand()-0.5f)*5.0f;
pos.y -= 1.0f;
@@ -733,7 +733,7 @@ bool CMotionAnt::EventFrame(const Event &event)
speed.y = Math::Rand()*2.0f;
dim.x = Math::Rand()*1.0f+1.0f;
dim.y = dim.x;
- m_particule->CreateParticule(pos, speed, dim, PARTICRASH, 2.0f);
+ m_particle->CreateParticle(pos, speed, dim, Gfx::PARTICRASH, 2.0f);
}
}
@@ -767,17 +767,17 @@ bool CMotionAnt::EventFrame(const Event &event)
}
else if ( m_actionType == MAS_BACK3 ) // goes back on the legs?
{
- if ( m_lastParticule+m_engine->ParticuleAdapt(0.05f) <= m_armTimeAbs )
+ if ( m_lastParticle+m_engine->ParticleAdapt(0.05f) <= m_armTimeAbs )
{
- m_lastParticule = m_armTimeAbs;
+ m_lastParticle = m_armTimeAbs;
- pos = m_object->RetPosition(0);
+ pos = m_object->GetPosition(0);
speed.x = (Math::Rand()-0.5f)*10.0f;
speed.z = (Math::Rand()-0.5f)*10.0f;
speed.y = Math::Rand()*5.0f;
dim.x = Math::Rand()*3.0f+2.0f;
dim.y = dim.x;
- m_particule->CreateParticule(pos, speed, dim, PARTICRASH, 2.0f);
+ m_particle->CreateParticle(pos, speed, dim, Gfx::PARTICRASH, 2.0f);
}
if ( m_progress < 0.5f )
diff --git a/src/object/motion/motionant.h b/src/object/motion/motionant.h
index 8ddd789..68a3b7f 100644
--- a/src/object/motion/motionant.h
+++ b/src/object/motion/motionant.h
@@ -68,6 +68,6 @@ protected:
int m_armMemberIndex;
int m_armLastAction;
bool m_bArmStop;
- float m_lastParticule;
+ float m_lastParticle;
};
diff --git a/src/object/motion/motionbee.cpp b/src/object/motion/motionbee.cpp
index e5c6b24..c679876 100644
--- a/src/object/motion/motionbee.cpp
+++ b/src/object/motion/motionbee.cpp
@@ -21,7 +21,7 @@
#include "object/motion/motionbee.h"
-#include "old/modfile.h"
+#include "graphics/engine/modelfile.h"
#include "physics/physics.h"
@@ -66,18 +66,18 @@ void CMotionBee::DeleteObject(bool bAll)
bool CMotionBee::Create(Math::Vector pos, float angle, ObjectType type,
float power)
{
- CModFile* pModFile;
+ Gfx::CModelFile* pModFile;
int rank;
- if ( m_engine->RetRestCreate() < 3+18+2 ) return false;
+// if ( m_engine->GetRestCreate() < 3+18+2 ) return false;
- pModFile = new CModFile(m_iMan);
+ pModFile = new Gfx::CModelFile(m_iMan);
m_object->SetType(type);
// Creates main base.
rank = m_engine->CreateObject();
- m_engine->SetObjectType(rank, TYPEVEHICULE); // this is a moving object
+ m_engine->SetObjectType(rank, Gfx::ENG_OBJTYPE_VEHICULE); // this is a moving object
m_object->SetObjectRank(0, rank);
pModFile->ReadModel("objects\\bee1.mod");
@@ -93,7 +93,7 @@ bool CMotionBee::Create(Math::Vector pos, float angle, ObjectType type,
// Creates the head.
rank = m_engine->CreateObject();
- m_engine->SetObjectType(rank, TYPEDESCENDANT);
+ m_engine->SetObjectType(rank, Gfx::ENG_OBJTYPE_DESCENDANT);
m_object->SetObjectRank(1, rank);
m_object->SetObjectParent(1, 0);
pModFile->ReadModel("objects\\bee2.mod");
@@ -102,7 +102,7 @@ bool CMotionBee::Create(Math::Vector pos, float angle, ObjectType type,
// Creates the tail.
rank = m_engine->CreateObject();
- m_engine->SetObjectType(rank, TYPEDESCENDANT);
+ m_engine->SetObjectType(rank, Gfx::ENG_OBJTYPE_DESCENDANT);
m_object->SetObjectRank(2, rank);
m_object->SetObjectParent(2, 0);
pModFile->ReadModel("objects\\bee3.mod");
@@ -111,7 +111,7 @@ bool CMotionBee::Create(Math::Vector pos, float angle, ObjectType type,
// Creates a right-back thigh.
rank = m_engine->CreateObject();
- m_engine->SetObjectType(rank, TYPEDESCENDANT);
+ m_engine->SetObjectType(rank, Gfx::ENG_OBJTYPE_DESCENDANT);
m_object->SetObjectRank(3, rank);
m_object->SetObjectParent(3, 0);
pModFile->ReadModel("objects\\ant4.mod");
@@ -120,7 +120,7 @@ bool CMotionBee::Create(Math::Vector pos, float angle, ObjectType type,
// Creates a right-back leg.
rank = m_engine->CreateObject();
- m_engine->SetObjectType(rank, TYPEDESCENDANT);
+ m_engine->SetObjectType(rank, Gfx::ENG_OBJTYPE_DESCENDANT);
m_object->SetObjectRank(4, rank);
m_object->SetObjectParent(4, 3);
pModFile->ReadModel("objects\\ant5.mod");
@@ -129,7 +129,7 @@ bool CMotionBee::Create(Math::Vector pos, float angle, ObjectType type,
// Creates a right-back foot.
rank = m_engine->CreateObject();
- m_engine->SetObjectType(rank, TYPEDESCENDANT);
+ m_engine->SetObjectType(rank, Gfx::ENG_OBJTYPE_DESCENDANT);
m_object->SetObjectRank(5, rank);
m_object->SetObjectParent(5, 4);
pModFile->ReadModel("objects\\ant6.mod");
@@ -138,7 +138,7 @@ bool CMotionBee::Create(Math::Vector pos, float angle, ObjectType type,
// Creates two middle-right thighs.
rank = m_engine->CreateObject();
- m_engine->SetObjectType(rank, TYPEDESCENDANT);
+ m_engine->SetObjectType(rank, Gfx::ENG_OBJTYPE_DESCENDANT);
m_object->SetObjectRank(6, rank);
m_object->SetObjectParent(6, 0);
pModFile->ReadModel("objects\\ant4.mod");
@@ -147,7 +147,7 @@ bool CMotionBee::Create(Math::Vector pos, float angle, ObjectType type,
// Creates two middle-right legs.
rank = m_engine->CreateObject();
- m_engine->SetObjectType(rank, TYPEDESCENDANT);
+ m_engine->SetObjectType(rank, Gfx::ENG_OBJTYPE_DESCENDANT);
m_object->SetObjectRank(7, rank);
m_object->SetObjectParent(7, 6);
pModFile->ReadModel("objects\\ant5.mod");
@@ -156,7 +156,7 @@ bool CMotionBee::Create(Math::Vector pos, float angle, ObjectType type,
// Creates two middle-right feet.
rank = m_engine->CreateObject();
- m_engine->SetObjectType(rank, TYPEDESCENDANT);
+ m_engine->SetObjectType(rank, Gfx::ENG_OBJTYPE_DESCENDANT);
m_object->SetObjectRank(8, rank);
m_object->SetObjectParent(8, 7);
pModFile->ReadModel("objects\\ant6.mod");
@@ -165,7 +165,7 @@ bool CMotionBee::Create(Math::Vector pos, float angle, ObjectType type,
// Creates the right front thigh.
rank = m_engine->CreateObject();
- m_engine->SetObjectType(rank, TYPEDESCENDANT);
+ m_engine->SetObjectType(rank, Gfx::ENG_OBJTYPE_DESCENDANT);
m_object->SetObjectRank(9, rank);
m_object->SetObjectParent(9, 0);
pModFile->ReadModel("objects\\ant4.mod");
@@ -174,7 +174,7 @@ bool CMotionBee::Create(Math::Vector pos, float angle, ObjectType type,
// Creates the right front leg.
rank = m_engine->CreateObject();
- m_engine->SetObjectType(rank, TYPEDESCENDANT);
+ m_engine->SetObjectType(rank, Gfx::ENG_OBJTYPE_DESCENDANT);
m_object->SetObjectRank(10, rank);
m_object->SetObjectParent(10, 9);
pModFile->ReadModel("objects\\ant5.mod");
@@ -183,7 +183,7 @@ bool CMotionBee::Create(Math::Vector pos, float angle, ObjectType type,
// Creates the right front foot.
rank = m_engine->CreateObject();
- m_engine->SetObjectType(rank, TYPEDESCENDANT);
+ m_engine->SetObjectType(rank, Gfx::ENG_OBJTYPE_DESCENDANT);
m_object->SetObjectRank(11, rank);
m_object->SetObjectParent(11, 10);
pModFile->ReadModel("objects\\ant6.mod");
@@ -192,7 +192,7 @@ bool CMotionBee::Create(Math::Vector pos, float angle, ObjectType type,
// Creates a left-back thigh.
rank = m_engine->CreateObject();
- m_engine->SetObjectType(rank, TYPEDESCENDANT);
+ m_engine->SetObjectType(rank, Gfx::ENG_OBJTYPE_DESCENDANT);
m_object->SetObjectRank(12, rank);
m_object->SetObjectParent(12, 0);
pModFile->ReadModel("objects\\ant4.mod");
@@ -202,7 +202,7 @@ bool CMotionBee::Create(Math::Vector pos, float angle, ObjectType type,
// Creates a left-back leg.
rank = m_engine->CreateObject();
- m_engine->SetObjectType(rank, TYPEDESCENDANT);
+ m_engine->SetObjectType(rank, Gfx::ENG_OBJTYPE_DESCENDANT);
m_object->SetObjectRank(13, rank);
m_object->SetObjectParent(13, 12);
pModFile->ReadModel("objects\\ant5.mod");
@@ -211,7 +211,7 @@ bool CMotionBee::Create(Math::Vector pos, float angle, ObjectType type,
// Creates a left-back foot.
rank = m_engine->CreateObject();
- m_engine->SetObjectType(rank, TYPEDESCENDANT);
+ m_engine->SetObjectType(rank, Gfx::ENG_OBJTYPE_DESCENDANT);
m_object->SetObjectRank(14, rank);
m_object->SetObjectParent(14, 13);
pModFile->ReadModel("objects\\ant6.mod");
@@ -220,7 +220,7 @@ bool CMotionBee::Create(Math::Vector pos, float angle, ObjectType type,
// Creates two middle-left thigh.
rank = m_engine->CreateObject();
- m_engine->SetObjectType(rank, TYPEDESCENDANT);
+ m_engine->SetObjectType(rank, Gfx::ENG_OBJTYPE_DESCENDANT);
m_object->SetObjectRank(15, rank);
m_object->SetObjectParent(15, 0);
pModFile->ReadModel("objects\\ant4.mod");
@@ -230,7 +230,7 @@ bool CMotionBee::Create(Math::Vector pos, float angle, ObjectType type,
// Creates two middle-left legs.
rank = m_engine->CreateObject();
- m_engine->SetObjectType(rank, TYPEDESCENDANT);
+ m_engine->SetObjectType(rank, Gfx::ENG_OBJTYPE_DESCENDANT);
m_object->SetObjectRank(16, rank);
m_object->SetObjectParent(16, 15);
pModFile->ReadModel("objects\\ant5.mod");
@@ -239,7 +239,7 @@ bool CMotionBee::Create(Math::Vector pos, float angle, ObjectType type,
// Creates two middle-left feet.
rank = m_engine->CreateObject();
- m_engine->SetObjectType(rank, TYPEDESCENDANT);
+ m_engine->SetObjectType(rank, Gfx::ENG_OBJTYPE_DESCENDANT);
m_object->SetObjectRank(17, rank);
m_object->SetObjectParent(17, 16);
pModFile->ReadModel("objects\\ant6.mod");
@@ -248,7 +248,7 @@ bool CMotionBee::Create(Math::Vector pos, float angle, ObjectType type,
// Creates front-left thigh.
rank = m_engine->CreateObject();
- m_engine->SetObjectType(rank, TYPEDESCENDANT);
+ m_engine->SetObjectType(rank, Gfx::ENG_OBJTYPE_DESCENDANT);
m_object->SetObjectRank(18, rank);
m_object->SetObjectParent(18, 0);
pModFile->ReadModel("objects\\ant4.mod");
@@ -258,7 +258,7 @@ bool CMotionBee::Create(Math::Vector pos, float angle, ObjectType type,
// Creates front-left leg.
rank = m_engine->CreateObject();
- m_engine->SetObjectType(rank, TYPEDESCENDANT);
+ m_engine->SetObjectType(rank, Gfx::ENG_OBJTYPE_DESCENDANT);
m_object->SetObjectRank(19, rank);
m_object->SetObjectParent(19, 18);
pModFile->ReadModel("objects\\ant5.mod");
@@ -267,7 +267,7 @@ bool CMotionBee::Create(Math::Vector pos, float angle, ObjectType type,
// Creates front-left foot.
rank = m_engine->CreateObject();
- m_engine->SetObjectType(rank, TYPEDESCENDANT);
+ m_engine->SetObjectType(rank, Gfx::ENG_OBJTYPE_DESCENDANT);
m_object->SetObjectRank(20, rank);
m_object->SetObjectParent(20, 19);
pModFile->ReadModel("objects\\ant6.mod");
@@ -276,7 +276,7 @@ bool CMotionBee::Create(Math::Vector pos, float angle, ObjectType type,
// Creates the right wing.
rank = m_engine->CreateObject();
- m_engine->SetObjectType(rank, TYPEDESCENDANT);
+ m_engine->SetObjectType(rank, Gfx::ENG_OBJTYPE_DESCENDANT);
m_object->SetObjectRank(21, rank);
m_object->SetObjectParent(21, 0);
pModFile->ReadModel("objects\\bee7.mod");
@@ -285,7 +285,7 @@ bool CMotionBee::Create(Math::Vector pos, float angle, ObjectType type,
// Creates the left wing.
rank = m_engine->CreateObject();
- m_engine->SetObjectType(rank, TYPEDESCENDANT);
+ m_engine->SetObjectType(rank, Gfx::ENG_OBJTYPE_DESCENDANT);
m_object->SetObjectRank(22, rank);
m_object->SetObjectParent(22, 0);
pModFile->ReadModel("objects\\bee7.mod");
@@ -298,10 +298,10 @@ bool CMotionBee::Create(Math::Vector pos, float angle, ObjectType type,
CreatePhysics();
m_object->SetFloorHeight(0.0f);
- pos = m_object->RetPosition(0);
+ pos = m_object->GetPosition(0);
m_object->SetPosition(0, pos); // to display the shadows immediately
- m_engine->LoadAllTexture();
+ m_engine->LoadAllTextures();
delete pModFile;
return true;
@@ -348,7 +348,7 @@ void CMotionBee::CreatePhysics()
m_physics->SetType(TYPE_FLYING);
- character = m_object->RetCharacter();
+ character = m_object->GetCharacter();
character->wheelFront = 3.0f;
character->wheelBack = 3.0f;
character->wheelLeft = 5.0f;
@@ -394,12 +394,12 @@ bool CMotionBee::EventProcess(const Event &event)
{
CMotion::EventProcess(event);
- if ( event.event == EVENT_FRAME )
+ if ( event.type == EVENT_FRAME )
{
return EventFrame(event);
}
- if ( event.event == EVENT_KEYDOWN )
+ if ( event.type == EVENT_KEY_DOWN )
{
#if ADJUST_ANGLE
int i;
@@ -441,11 +441,11 @@ bool CMotionBee::EventFrame(const Event &event)
int action, i, st, nd;
bool bStop;
- if ( m_engine->RetPause() ) return true;
- if ( !m_engine->IsVisiblePoint(m_object->RetPosition(0)) ) return true;
+ if ( m_engine->GetPause() ) return true;
+ if ( !m_engine->IsVisiblePoint(m_object->GetPosition(0)) ) return true;
- s = m_physics->RetLinMotionX(MO_MOTSPEED)*0.30f;
- a = fabs(m_physics->RetCirMotionY(MO_MOTSPEED)*2.00f);
+ s = m_physics->GetLinMotionX(MO_MOTSPEED)*0.30f;
+ a = fabs(m_physics->GetCirMotionY(MO_MOTSPEED)*2.00f);
if ( s == 0.0f && a != 0.0f ) a *= 1.5f;
@@ -454,7 +454,7 @@ bool CMotionBee::EventFrame(const Event &event)
m_armMember += (s+a)*event.rTime*0.15f;
bStop = ( a == 0.0f && s == 0.0f ); // stopped?
- if ( !m_physics->RetLand() ) bStop = true;
+ if ( !m_physics->GetLand() ) bStop = true;
if ( bStop )
{
@@ -467,13 +467,13 @@ bool CMotionBee::EventFrame(const Event &event)
action = MB_MARCH; // flying
m_actionType = -1;
- if ( m_object->RetFret() != 0 ) m_actionType = MBS_HOLD; // carries the ball
+ if ( m_object->GetFret() != 0 ) m_actionType = MBS_HOLD; // carries the ball
- if ( m_object->RetRuin() ) // destroyed?
+ if ( m_object->GetRuin() ) // destroyed?
{
m_actionType = MBS_RUIN;
}
- if ( m_object->RetBurn() ) // burning?
+ if ( m_object->GetBurn() ) // burning?
{
m_actionType = MBS_BURN;
}
@@ -491,7 +491,7 @@ bool CMotionBee::EventFrame(const Event &event)
else prog = Math::Mod(m_armMember+(2.0f-(i%3))*0.33f+0.3f, 1.0f);
if ( m_bArmStop )
{
- prog = (float)m_armTimeIndex/3.0f;
+ prog = static_cast< float >(m_armTimeIndex/3.0f);
}
if ( prog < 0.33f ) // t0..t1 ?
{
@@ -542,7 +542,7 @@ bool CMotionBee::EventFrame(const Event &event)
}
#if ADJUST_ANGLE
- if ( m_object->RetSelect() )
+ if ( m_object->GetSelect() )
{
char s[100];
sprintf(s, "A:time=%d Q:part=%d W:member=%d", m_armTimeIndex, m_armPartIndex, m_armMemberIndex);
@@ -550,12 +550,12 @@ bool CMotionBee::EventFrame(const Event &event)
}
#endif
- if ( m_physics->RetLand() ) // on the ground?
+ if ( m_physics->GetLand() ) // on the ground?
{
- if ( m_object->RetRuin() )
+ if ( m_object->GetRuin() )
{
}
- else if ( bStop || m_object->RetBurn() )
+ else if ( bStop || m_object->GetBurn() )
{
m_object->SetAngleZ(2, sinf(m_armTimeAbs*1.7f)*0.15f+0.35f); // tail
}
@@ -595,7 +595,7 @@ bool CMotionBee::EventFrame(const Event &event)
}
}
- if ( m_physics->RetLand() )
+ if ( m_physics->GetLand() )
{
if ( bStop ) prog = 0.05f;
else prog = 0.15f;
@@ -628,7 +628,7 @@ bool CMotionBee::EventFrame(const Event &event)
m_object->SetAngleY(1, sinf(m_armTimeAbs*2.1f)*0.50f); // head
#if 0
- h = m_terrain->RetFloorHeight(RetPosition(0));
+ h = m_terrain->GetFloorHeight(GetPosition(0));
radius = 4.0f+h/4.0f;
color.r = 0.3f+h/80.0f;
color.g = color.r;
diff --git a/src/object/motion/motionhuman.cpp b/src/object/motion/motionhuman.cpp
index ba3003a..560a0de 100644
--- a/src/object/motion/motionhuman.cpp
+++ b/src/object/motion/motionhuman.cpp
@@ -21,9 +21,9 @@
#include "object/motion/motionhuman.h"
-#include "old/modfile.h"
-#include "old/terrain.h"
-#include "old/water.h"
+#include "graphics/engine/modelfile.h"
+#include "graphics/engine/terrain.h"
+#include "graphics/engine/water.h"
#include "math/geometry.h"
#include "object/robotmain.h"
#include "physics/physics.h"
@@ -72,7 +72,7 @@ void CMotionHuman::DeleteObject(bool bAll)
{
if ( m_partiReactor != -1 )
{
- m_particule->DeleteParticule(m_partiReactor);
+ m_particle->DeleteParticle(m_partiReactor);
m_partiReactor = -1;
}
}
@@ -93,32 +93,32 @@ Error CMotionHuman::SetAction(int action, float time)
bool CMotionHuman::Create(Math::Vector pos, float angle, ObjectType type,
float power)
{
- CModFile* pModFile;
+ Gfx::CModelFile* pModFile;
char filename[100];
int rank, option, face, glasses;
- if ( m_engine->RetRestCreate() < 16 ) return false;
+// if ( m_engine->GetRestCreate() < 16 ) return false;
- pModFile = new CModFile(m_iMan);
+ pModFile = new Gfx::CModelFile(m_iMan);
m_object->SetType(type);
- option = m_object->RetOption();
+ option = m_object->GetOption();
- if ( m_main->RetGamerOnlyHead() )
+ if ( m_main->GetGamerOnlyHead() )
{
rank = m_engine->CreateObject();
- m_engine->SetObjectType(rank, TYPEVEHICULE); // this is a moving object
+ m_engine->SetObjectType(rank, Gfx::ENG_OBJTYPE_VEHICULE); // this is a moving object
m_object->SetObjectRank(0, rank);
- face = m_main->RetGamerFace();
+ face = m_main->GetGamerFace();
sprintf(filename, "objects\\human2h%d.mod", face+1);
pModFile->ReadModel(filename);
pModFile->CreateEngineObject(rank);
- glasses = m_main->RetGamerGlasses();
+ glasses = m_main->GetGamerGlasses();
if ( glasses != 0 )
{
rank = m_engine->CreateObject();
- m_engine->SetObjectType(rank, TYPEDESCENDANT);
+ m_engine->SetObjectType(rank, Gfx::ENG_OBJTYPE_DESCENDANT);
m_object->SetObjectRank(1, rank);
m_object->SetObjectParent(1, 0);
sprintf(filename, "objects\\human2g%d.mod", glasses);
@@ -129,7 +129,7 @@ bool CMotionHuman::Create(Math::Vector pos, float angle, ObjectType type,
CreatePhysics(type);
m_object->SetFloorHeight(0.0f);
- m_engine->LoadAllTexture();
+ m_engine->LoadAllTextures();
delete pModFile;
return true;
@@ -137,7 +137,7 @@ bool CMotionHuman::Create(Math::Vector pos, float angle, ObjectType type,
// Creates the main base.
rank = m_engine->CreateObject();
- m_engine->SetObjectType(rank, TYPEVEHICULE); // this is a moving object
+ m_engine->SetObjectType(rank, Gfx::ENG_OBJTYPE_VEHICULE); // this is a moving object
m_object->SetObjectRank(0, rank);
if ( option == 0 ) // head in helmet?
@@ -163,7 +163,7 @@ bool CMotionHuman::Create(Math::Vector pos, float angle, ObjectType type,
// Creates the head.
rank = m_engine->CreateObject();
- m_engine->SetObjectType(rank, TYPEDESCENDANT);
+ m_engine->SetObjectType(rank, Gfx::ENG_OBJTYPE_DESCENDANT);
m_object->SetObjectRank(1, rank);
m_object->SetObjectParent(1, 0);
@@ -171,14 +171,14 @@ bool CMotionHuman::Create(Math::Vector pos, float angle, ObjectType type,
{
if ( option == 0 ) // head in helmet?
{
- face = m_main->RetGamerFace();
+ face = m_main->GetGamerFace();
sprintf(filename, "objects\\human2c%d.mod", face+1);
pModFile->ReadModel(filename);
}
if ( option == 1 || // head without helmet?
option == 2 ) // without a backpack?
{
- face = m_main->RetGamerFace();
+ face = m_main->GetGamerFace();
sprintf(filename, "objects\\human2h%d.mod", face+1);
pModFile->ReadModel(filename);
}
@@ -196,11 +196,11 @@ bool CMotionHuman::Create(Math::Vector pos, float angle, ObjectType type,
}
// Creates the glasses.
- glasses = m_main->RetGamerGlasses();
+ glasses = m_main->GetGamerGlasses();
if ( glasses != 0 && type == OBJECT_HUMAN )
{
rank = m_engine->CreateObject();
- m_engine->SetObjectType(rank, TYPEDESCENDANT);
+ m_engine->SetObjectType(rank, Gfx::ENG_OBJTYPE_DESCENDANT);
m_object->SetObjectRank(15, rank);
m_object->SetObjectParent(15, 1);
sprintf(filename, "objects\\human2g%d.mod", glasses);
@@ -210,7 +210,7 @@ bool CMotionHuman::Create(Math::Vector pos, float angle, ObjectType type,
// Creates the right arm.
rank = m_engine->CreateObject();
- m_engine->SetObjectType(rank, TYPEDESCENDANT);
+ m_engine->SetObjectType(rank, Gfx::ENG_OBJTYPE_DESCENDANT);
m_object->SetObjectRank(2, rank);
m_object->SetObjectParent(2, 0);
pModFile->ReadModel("objects\\human3.mod");
@@ -220,7 +220,7 @@ bool CMotionHuman::Create(Math::Vector pos, float angle, ObjectType type,
// Creates the right forearm.
rank = m_engine->CreateObject();
- m_engine->SetObjectType(rank, TYPEDESCENDANT);
+ m_engine->SetObjectType(rank, Gfx::ENG_OBJTYPE_DESCENDANT);
m_object->SetObjectRank(3, rank);
m_object->SetObjectParent(3, 2);
pModFile->ReadModel("objects\\human4r.mod");
@@ -230,7 +230,7 @@ bool CMotionHuman::Create(Math::Vector pos, float angle, ObjectType type,
// Creates right hand.
rank = m_engine->CreateObject();
- m_engine->SetObjectType(rank, TYPEDESCENDANT);
+ m_engine->SetObjectType(rank, Gfx::ENG_OBJTYPE_DESCENDANT);
m_object->SetObjectRank(4, rank);
m_object->SetObjectParent(4, 3);
pModFile->ReadModel("objects\\human5.mod");
@@ -239,7 +239,7 @@ bool CMotionHuman::Create(Math::Vector pos, float angle, ObjectType type,
// Creates the right thigh.
rank = m_engine->CreateObject();
- m_engine->SetObjectType(rank, TYPEDESCENDANT);
+ m_engine->SetObjectType(rank, Gfx::ENG_OBJTYPE_DESCENDANT);
m_object->SetObjectRank(5, rank);
m_object->SetObjectParent(5, 0);
pModFile->ReadModel("objects\\human6.mod");
@@ -249,7 +249,7 @@ bool CMotionHuman::Create(Math::Vector pos, float angle, ObjectType type,
// Creates the right leg.
rank = m_engine->CreateObject();
- m_engine->SetObjectType(rank, TYPEDESCENDANT);
+ m_engine->SetObjectType(rank, Gfx::ENG_OBJTYPE_DESCENDANT);
m_object->SetObjectRank(6, rank);
m_object->SetObjectParent(6, 5);
pModFile->ReadModel("objects\\human7.mod");
@@ -259,7 +259,7 @@ bool CMotionHuman::Create(Math::Vector pos, float angle, ObjectType type,
// Creates the right foot.
rank = m_engine->CreateObject();
- m_engine->SetObjectType(rank, TYPEDESCENDANT);
+ m_engine->SetObjectType(rank, Gfx::ENG_OBJTYPE_DESCENDANT);
m_object->SetObjectRank(7, rank);
m_object->SetObjectParent(7, 6);
pModFile->ReadModel("objects\\human8.mod");
@@ -269,7 +269,7 @@ bool CMotionHuman::Create(Math::Vector pos, float angle, ObjectType type,
// Creates the left arm.
rank = m_engine->CreateObject();
- m_engine->SetObjectType(rank, TYPEDESCENDANT);
+ m_engine->SetObjectType(rank, Gfx::ENG_OBJTYPE_DESCENDANT);
m_object->SetObjectRank(8, rank);
m_object->SetObjectParent(8, 0);
pModFile->ReadModel("objects\\human3.mod");
@@ -280,7 +280,7 @@ bool CMotionHuman::Create(Math::Vector pos, float angle, ObjectType type,
// Creates the left forearm.
rank = m_engine->CreateObject();
- m_engine->SetObjectType(rank, TYPEDESCENDANT);
+ m_engine->SetObjectType(rank, Gfx::ENG_OBJTYPE_DESCENDANT);
m_object->SetObjectRank(9, rank);
m_object->SetObjectParent(9, 8);
pModFile->ReadModel("objects\\human4l.mod");
@@ -291,7 +291,7 @@ bool CMotionHuman::Create(Math::Vector pos, float angle, ObjectType type,
// Creates left hand.
rank = m_engine->CreateObject();
- m_engine->SetObjectType(rank, TYPEDESCENDANT);
+ m_engine->SetObjectType(rank, Gfx::ENG_OBJTYPE_DESCENDANT);
m_object->SetObjectRank(10, rank);
m_object->SetObjectParent(10, 9);
pModFile->ReadModel("objects\\human5.mod");
@@ -301,7 +301,7 @@ bool CMotionHuman::Create(Math::Vector pos, float angle, ObjectType type,
// Creates the left thigh.
rank = m_engine->CreateObject();
- m_engine->SetObjectType(rank, TYPEDESCENDANT);
+ m_engine->SetObjectType(rank, Gfx::ENG_OBJTYPE_DESCENDANT);
m_object->SetObjectRank(11, rank);
m_object->SetObjectParent(11, 0);
pModFile->ReadModel("objects\\human6.mod");
@@ -312,7 +312,7 @@ bool CMotionHuman::Create(Math::Vector pos, float angle, ObjectType type,
// Creates the left leg.
rank = m_engine->CreateObject();
- m_engine->SetObjectType(rank, TYPEDESCENDANT);
+ m_engine->SetObjectType(rank, Gfx::ENG_OBJTYPE_DESCENDANT);
m_object->SetObjectRank(12, rank);
m_object->SetObjectParent(12, 11);
pModFile->ReadModel("objects\\human7.mod");
@@ -323,7 +323,7 @@ bool CMotionHuman::Create(Math::Vector pos, float angle, ObjectType type,
// Creates the left foot.
rank = m_engine->CreateObject();
- m_engine->SetObjectType(rank, TYPEDESCENDANT);
+ m_engine->SetObjectType(rank, Gfx::ENG_OBJTYPE_DESCENDANT);
m_object->SetObjectRank(13, rank);
m_object->SetObjectParent(13, 12);
pModFile->ReadModel("objects\\human8.mod");
@@ -336,7 +336,7 @@ bool CMotionHuman::Create(Math::Vector pos, float angle, ObjectType type,
if ( option != 2 ) // with backpack?
{
rank = m_engine->CreateObject();
- m_engine->SetObjectType(rank, TYPEDESCENDANT);
+ m_engine->SetObjectType(rank, Gfx::ENG_OBJTYPE_DESCENDANT);
m_object->SetObjectRank(14, rank);
m_object->SetObjectParent(14, 0);
pModFile->ReadModel("objects\\human9.mod");
@@ -350,10 +350,10 @@ bool CMotionHuman::Create(Math::Vector pos, float angle, ObjectType type,
CreatePhysics(type);
m_object->SetFloorHeight(0.0f);
- pos = m_object->RetPosition(0);
+ pos = m_object->GetPosition(0);
m_object->SetPosition(0, pos); // to display the shadows immediately
- m_engine->LoadAllTexture();
+ m_engine->LoadAllTextures();
delete pModFile;
return true;
@@ -560,7 +560,7 @@ void CMotionHuman::CreatePhysics(ObjectType type)
m_physics->SetType(TYPE_FLYING);
- character = m_object->RetCharacter();
+ character = m_object->GetCharacter();
character->wheelFront = 4.0f;
character->wheelBack = 4.0f;
character->wheelLeft = 4.0f;
@@ -653,12 +653,12 @@ bool CMotionHuman::EventProcess(const Event &event)
{
CMotion::EventProcess(event);
- if ( event.event == EVENT_FRAME )
+ if ( event.type == EVENT_FRAME )
{
return EventFrame(event);
}
- if ( event.event == EVENT_KEYDOWN )
+ if ( event.type == EVENT_KEY_DOWN )
{
#if ADJUST_ANGLE
int i;
@@ -710,9 +710,9 @@ bool CMotionHuman::EventFrame(const Event &event)
float tSt[9], tNd[9];
float aa, bb, shield, deadFactor, level;
int i, ii, st, nd, action, legAction, armAction;
- bool bOnBoard, bSwim, bStop;
+ bool bOnBoard, bSwim;
- if ( m_engine->RetPause() )
+ if ( m_engine->GetPause() )
{
if ( m_actionType == MHS_SATCOM )
{
@@ -725,35 +725,35 @@ bool CMotionHuman::EventFrame(const Event &event)
}
bOnBoard = false;
- if ( m_object->RetSelect() &&
- m_camera->RetType() == CAMERA_ONBOARD )
+ if ( m_object->GetSelect() &&
+ m_camera->GetType() == Gfx::CAM_TYPE_ONBOARD )
{
bOnBoard = true;
}
- if ( m_bDisplayPerso && m_main->RetGamerOnlyHead() )
+ if ( m_bDisplayPerso && m_main->GetGamerOnlyHead() )
{
m_time += event.rTime;
m_object->SetLinVibration(Math::Vector(0.0f, -0.55f, 0.0f));
- m_object->SetCirVibration(Math::Vector(0.0f, m_main->RetPersoAngle(), 0.0f));
+ m_object->SetCirVibration(Math::Vector(0.0f, m_main->GetPersoAngle(), 0.0f));
return true;
}
if ( m_bDisplayPerso )
{
- m_object->SetCirVibration(Math::Vector(0.0f, m_main->RetPersoAngle()+0.2f, 0.0f));
+ m_object->SetCirVibration(Math::Vector(0.0f, m_main->GetPersoAngle()+0.2f, 0.0f));
}
- shield = m_object->RetShield();
+ shield = m_object->GetShield();
shield += event.rTime*(1.0f/120.0f); // regeneration in 120 seconds
if ( shield > 1.0f ) shield = 1.0f;
m_object->SetShield(shield);
- bSwim = m_physics->RetSwim();
+ bSwim = m_physics->GetSwim();
#if 0
- rot = m_physics->RetCirMotionY(MO_MOTSPEED);
- s = m_physics->RetLinMotionX(MO_REASPEED)*2.0f;
- a = m_physics->RetLinMotionX(MO_TERSPEED);
+ rot = m_physics->GetCirMotionY(MO_MOTSPEED);
+ s = m_physics->GetLinMotionX(MO_REASPEED)*2.0f;
+ a = m_physics->GetLinMotionX(MO_TERSPEED);
if ( a < 0.0f ) // rises?
{
if ( s > 0.0f && s < 20.0f ) s = 20.0f; // moving slowly?
@@ -766,44 +766,44 @@ bool CMotionHuman::EventFrame(const Event &event)
}
a = fabs(rot*12.0f);
- if ( !m_physics->RetLand() && !bSwim ) // in flight?
+ if ( !m_physics->GetLand() && !bSwim ) // in flight?
{
s = 0.0f;
}
- if ( m_object->RetFret() != 0 ) // carries something?
+ if ( m_object->GetFret() != 0 ) // carries something?
{
s *= 1.3f;
}
#else
- rot = m_physics->RetCirMotionY(MO_MOTSPEED);
+ rot = m_physics->GetCirMotionY(MO_MOTSPEED);
#if 0
- s = m_physics->RetLinMotionX(MO_REASPEED);
+ s = m_physics->GetLinMotionX(MO_REASPEED);
#else
- a = m_physics->RetLinMotionX(MO_REASPEED);
- s = m_physics->RetLinMotionX(MO_MOTSPEED)*0.2f;
+ a = m_physics->GetLinMotionX(MO_REASPEED);
+ s = m_physics->GetLinMotionX(MO_MOTSPEED)*0.2f;
if ( fabs(a) > fabs(s) ) s = a; // the highest value
#endif
- a = m_physics->RetLinMotionX(MO_TERSPEED);
+ a = m_physics->GetLinMotionX(MO_TERSPEED);
if ( a < 0.0f ) // rises?
{
- a += m_physics->RetLinMotionX(MO_TERSLIDE);
+ a += m_physics->GetLinMotionX(MO_TERSLIDE);
if ( a < 0.0f ) s -= a;
}
if ( a > 0.0f ) // falls?
{
- a -= m_physics->RetLinMotionX(MO_TERSLIDE);
+ a -= m_physics->GetLinMotionX(MO_TERSLIDE);
if ( a > 0.0f ) s -= a;
}
s *= 2.0f;
a = fabs(rot*12.0f);
- if ( !m_physics->RetLand() && !bSwim ) // in flight?
+ if ( !m_physics->GetLand() && !bSwim ) // in flight?
{
s = 0.0f;
}
- if ( m_object->RetFret() != 0 ) // carries something?
+ if ( m_object->GetFret() != 0 ) // carries something?
{
s *= 1.3f;
}
@@ -815,7 +815,7 @@ bool CMotionHuman::EventFrame(const Event &event)
m_armMember += s*event.rTime*0.05f;
// Fatigue management when short.
- if ( m_physics->RetLand() && s != 0.0f ) // on the ground?
+ if ( m_physics->GetLand() && s != 0.0f ) // on the ground?
{
m_tired += event.rTime*0.1f;
if ( m_tired > 1.0f )
@@ -832,15 +832,14 @@ bool CMotionHuman::EventFrame(const Event &event)
if ( bSwim ) // swims?
{
- s += fabs(m_physics->RetLinMotionY(MO_REASPEED)*2.0f);
+ s += fabs(m_physics->GetLinMotionY(MO_REASPEED)*2.0f);
a *= 2.0f;
m_armTimeSwim += Math::Min(Math::Max(s,a,3.0f),15.0f)*event.rTime*0.05f;
}
- bStop = ( s == 0.0f ); // stop?
prog = 0.0f;
- if ( m_physics->RetLand() ) // on the ground?
+ if ( m_physics->GetLand() ) // on the ground?
{
if ( s == 0.0f && a == 0.0f )
{
@@ -869,7 +868,7 @@ bool CMotionHuman::EventFrame(const Event &event)
else
{
action = MH_MARCH; // walking
- if ( m_object->RetFret() != 0 ) action = MH_MARCHTAKE; // take walking
+ if ( m_object->GetFret() != 0 ) action = MH_MARCHTAKE; // take walking
rTime[0] = rTime[1] = m_armMember;
lTime[0] = lTime[1] = m_armMember+0.5f;
}
@@ -908,34 +907,34 @@ bool CMotionHuman::EventFrame(const Event &event)
armAction = action;
legAction = action;
- if ( m_object->RetFret() != 0 ) // carries something?
+ if ( m_object->GetFret() != 0 ) // carries something?
{
armAction = MH_MARCHTAKE; // take walking
}
- if ( m_physics->RetLand() ) // on the ground?
+ if ( m_physics->GetLand() ) // on the ground?
{
- a = m_object->RetAngleY(0);
- pos = m_object->RetPosition(0);
- m_terrain->MoveOnFloor(pos);
+ a = m_object->GetAngleY(0);
+ pos = m_object->GetPosition(0);
+ m_terrain->AdjustToFloor(pos);
pf.x = pos.x+cosf(a+Math::PI*1.5f)*0.7f;
pf.y = pos.y;
pf.z = pos.z-sinf(a+Math::PI*1.5f)*0.7f;
- m_terrain->MoveOnFloor(pf);
+ m_terrain->AdjustToFloor(pf);
al = atanf((pf.y-pos.y)/0.7f); // angle for left leg
pf = pos;
pf.x = pos.x+cosf(a+Math::PI*0.5f)*0.7f;
pf.y = pos.y;
pf.z = pos.z-sinf(a+Math::PI*0.5f)*0.7f;
- m_terrain->MoveOnFloor(pf);
+ m_terrain->AdjustToFloor(pf);
ar = atanf((pf.y-pos.y)/0.7f); // angle to right leg
pf.x = pos.x+cosf(a+Math::PI)*0.3f;
pf.y = pos.y;
pf.z = pos.z-sinf(a+Math::PI)*0.3f;
- m_terrain->MoveOnFloor(pf);
+ m_terrain->AdjustToFloor(pf);
af = atanf((pf.y-pos.y)/0.3f); // angle for feet
}
else
@@ -1022,7 +1021,7 @@ bool CMotionHuman::EventFrame(const Event &event)
aa = 0.5f;
if ( i%2 == 0 ) // arm?
{
- if ( m_object->RetFret() == 0 ) // does nothing?
+ if ( m_object->GetFret() == 0 ) // does nothing?
{
aa = 2.0f; // moves a lot
}
@@ -1074,15 +1073,15 @@ bool CMotionHuman::EventFrame(const Event &event)
if ( a < -0.2f ) a = -0.2f;
if ( a > 0.2f ) a = 0.2f;
- pos = m_object->RetPosition(ii+0);
+ pos = m_object->GetPosition(ii+0);
pos.y = 0.0f+a;
m_object->SetPosition(ii+0, pos); // lengthens / shortcuts thigh
- pos = m_object->RetPosition(ii+1);
+ pos = m_object->GetPosition(ii+1);
pos.y = -1.5f+a;
m_object->SetPosition(ii+1, pos); // lengthens / shortcuts leg
- pos = m_object->RetPosition(ii+2);
+ pos = m_object->GetPosition(ii+2);
pos.y = -1.5f+a;
m_object->SetPosition(ii+2, pos); // lengthens / shortcuts foot
@@ -1147,32 +1146,32 @@ bool CMotionHuman::EventFrame(const Event &event)
if ( i < 2 ) // right member (0..1) ?
{
- m_object->SetAngleX(2+3*i+0, Math::Smooth(m_object->RetAngleX(2+3*i+0), Math::PropAngle(tSt[0], tNd[0], prog), time));
- m_object->SetAngleY(2+3*i+0, Math::Smooth(m_object->RetAngleY(2+3*i+0), Math::PropAngle(tSt[1], tNd[1], prog), time));
- m_object->SetAngleZ(2+3*i+0, Math::Smooth(m_object->RetAngleZ(2+3*i+0), Math::PropAngle(tSt[2], tNd[2], prog), time));
- m_object->SetAngleX(2+3*i+1, Math::Smooth(m_object->RetAngleX(2+3*i+1), Math::PropAngle(tSt[3], tNd[3], prog), time));
- m_object->SetAngleY(2+3*i+1, Math::Smooth(m_object->RetAngleY(2+3*i+1), Math::PropAngle(tSt[4], tNd[4], prog), time));
- m_object->SetAngleZ(2+3*i+1, Math::Smooth(m_object->RetAngleZ(2+3*i+1), Math::PropAngle(tSt[5], tNd[5], prog), time));
- m_object->SetAngleX(2+3*i+2, Math::Smooth(m_object->RetAngleX(2+3*i+2), Math::PropAngle(tSt[6], tNd[6], prog), time));
- m_object->SetAngleY(2+3*i+2, Math::Smooth(m_object->RetAngleY(2+3*i+2), Math::PropAngle(tSt[7], tNd[7], prog), time));
- m_object->SetAngleZ(2+3*i+2, Math::Smooth(m_object->RetAngleZ(2+3*i+2), Math::PropAngle(tSt[8], tNd[8], prog), time));
+ m_object->SetAngleX(2+3*i+0, Math::Smooth(m_object->GetAngleX(2+3*i+0), Math::PropAngle(tSt[0], tNd[0], prog), time));
+ m_object->SetAngleY(2+3*i+0, Math::Smooth(m_object->GetAngleY(2+3*i+0), Math::PropAngle(tSt[1], tNd[1], prog), time));
+ m_object->SetAngleZ(2+3*i+0, Math::Smooth(m_object->GetAngleZ(2+3*i+0), Math::PropAngle(tSt[2], tNd[2], prog), time));
+ m_object->SetAngleX(2+3*i+1, Math::Smooth(m_object->GetAngleX(2+3*i+1), Math::PropAngle(tSt[3], tNd[3], prog), time));
+ m_object->SetAngleY(2+3*i+1, Math::Smooth(m_object->GetAngleY(2+3*i+1), Math::PropAngle(tSt[4], tNd[4], prog), time));
+ m_object->SetAngleZ(2+3*i+1, Math::Smooth(m_object->GetAngleZ(2+3*i+1), Math::PropAngle(tSt[5], tNd[5], prog), time));
+ m_object->SetAngleX(2+3*i+2, Math::Smooth(m_object->GetAngleX(2+3*i+2), Math::PropAngle(tSt[6], tNd[6], prog), time));
+ m_object->SetAngleY(2+3*i+2, Math::Smooth(m_object->GetAngleY(2+3*i+2), Math::PropAngle(tSt[7], tNd[7], prog), time));
+ m_object->SetAngleZ(2+3*i+2, Math::Smooth(m_object->GetAngleZ(2+3*i+2), Math::PropAngle(tSt[8], tNd[8], prog), time));
}
else // left member (2..3) ?
{
- m_object->SetAngleX(2+3*i+0, Math::Smooth(m_object->RetAngleX(2+3*i+0), Math::PropAngle(-tSt[0], -tNd[0], prog), time));
- m_object->SetAngleY(2+3*i+0, Math::Smooth(m_object->RetAngleY(2+3*i+0), Math::PropAngle(-tSt[1], -tNd[1], prog), time));
- m_object->SetAngleZ(2+3*i+0, Math::Smooth(m_object->RetAngleZ(2+3*i+0), Math::PropAngle( tSt[2], tNd[2], prog), time));
- m_object->SetAngleX(2+3*i+1, Math::Smooth(m_object->RetAngleX(2+3*i+1), Math::PropAngle(-tSt[3], -tNd[3], prog), time));
- m_object->SetAngleY(2+3*i+1, Math::Smooth(m_object->RetAngleY(2+3*i+1), Math::PropAngle(-tSt[4], -tNd[4], prog), time));
- m_object->SetAngleZ(2+3*i+1, Math::Smooth(m_object->RetAngleZ(2+3*i+1), Math::PropAngle( tSt[5], tNd[5], prog), time));
- m_object->SetAngleX(2+3*i+2, Math::Smooth(m_object->RetAngleX(2+3*i+2), Math::PropAngle(-tSt[6], -tNd[6], prog), time));
- m_object->SetAngleY(2+3*i+2, Math::Smooth(m_object->RetAngleY(2+3*i+2), Math::PropAngle(-tSt[7], -tNd[7], prog), time));
- m_object->SetAngleZ(2+3*i+2, Math::Smooth(m_object->RetAngleZ(2+3*i+2), Math::PropAngle( tSt[8], tNd[8], prog), time));
+ m_object->SetAngleX(2+3*i+0, Math::Smooth(m_object->GetAngleX(2+3*i+0), Math::PropAngle(-tSt[0], -tNd[0], prog), time));
+ m_object->SetAngleY(2+3*i+0, Math::Smooth(m_object->GetAngleY(2+3*i+0), Math::PropAngle(-tSt[1], -tNd[1], prog), time));
+ m_object->SetAngleZ(2+3*i+0, Math::Smooth(m_object->GetAngleZ(2+3*i+0), Math::PropAngle( tSt[2], tNd[2], prog), time));
+ m_object->SetAngleX(2+3*i+1, Math::Smooth(m_object->GetAngleX(2+3*i+1), Math::PropAngle(-tSt[3], -tNd[3], prog), time));
+ m_object->SetAngleY(2+3*i+1, Math::Smooth(m_object->GetAngleY(2+3*i+1), Math::PropAngle(-tSt[4], -tNd[4], prog), time));
+ m_object->SetAngleZ(2+3*i+1, Math::Smooth(m_object->GetAngleZ(2+3*i+1), Math::PropAngle( tSt[5], tNd[5], prog), time));
+ m_object->SetAngleX(2+3*i+2, Math::Smooth(m_object->GetAngleX(2+3*i+2), Math::PropAngle(-tSt[6], -tNd[6], prog), time));
+ m_object->SetAngleY(2+3*i+2, Math::Smooth(m_object->GetAngleY(2+3*i+2), Math::PropAngle(-tSt[7], -tNd[7], prog), time));
+ m_object->SetAngleZ(2+3*i+2, Math::Smooth(m_object->GetAngleZ(2+3*i+2), Math::PropAngle( tSt[8], tNd[8], prog), time));
}
}
#if ADJUST_ANGLE
- if ( m_object->RetSelect() )
+ if ( m_object->GetSelect() )
{
char s[100];
sprintf(s, "A:time=%d Q:part=%d W:member=%d", m_armTimeIndex, m_armPartIndex, m_armMemberIndex);
@@ -1182,14 +1181,14 @@ bool CMotionHuman::EventFrame(const Event &event)
// calculates the height lowering as a function
// of the position of the legs.
- hr = 1.5f*(1.0f-cosf(m_object->RetAngleZ(5))) +
- 1.5f*(1.0f-cosf(m_object->RetAngleZ(5)+m_object->RetAngleZ(6)));
- a = 1.0f*sinf(m_object->RetAngleZ(5)+m_object->RetAngleZ(6)+m_object->RetAngleZ(7));
+ hr = 1.5f*(1.0f-cosf(m_object->GetAngleZ(5))) +
+ 1.5f*(1.0f-cosf(m_object->GetAngleZ(5)+m_object->GetAngleZ(6)));
+ a = 1.0f*sinf(m_object->GetAngleZ(5)+m_object->GetAngleZ(6)+m_object->GetAngleZ(7));
if ( a < 0.0f ) hr += a;
- hl = 1.5f*(1.0f-cosf(m_object->RetAngleZ(11))) +
- 1.5f*(1.0f-cosf(m_object->RetAngleZ(11)+m_object->RetAngleZ(12)));
- a = 1.0f*sinf(m_object->RetAngleZ(11)+m_object->RetAngleZ(12)+m_object->RetAngleZ(13));
+ hl = 1.5f*(1.0f-cosf(m_object->GetAngleZ(11))) +
+ 1.5f*(1.0f-cosf(m_object->GetAngleZ(11)+m_object->GetAngleZ(12)));
+ a = 1.0f*sinf(m_object->GetAngleZ(11)+m_object->GetAngleZ(12)+m_object->GetAngleZ(13));
if ( a < 0.0f ) hl += a;
hr = Math::Min(hr, hl);
@@ -1201,7 +1200,7 @@ bool CMotionHuman::EventFrame(const Event &event)
dir.x = (Math::Rand()-0.5f)/8.0f;
dir.z = (Math::Rand()-0.5f)/8.0f;
dir.y = -0.5f; // slightly lower
- actual = m_object->RetLinVibration();
+ actual = m_object->GetLinVibration();
dir.x = Math::Smooth(actual.x, dir.x, time);
//? dir.y = Math::Smooth(actual.y, dir.y, time);
dir.y = -hr;
@@ -1211,7 +1210,7 @@ bool CMotionHuman::EventFrame(const Event &event)
dir.x = 0.0f;
dir.y = (Math::Rand()-0.5f)/3.0f;
dir.z = -0.1f; // slightly leaning forward
- actual = m_object->RetInclinaison();
+ actual = m_object->GetInclinaison();
dir.x = Math::Smooth(actual.x, dir.x, time);
dir.y = Math::Smooth(actual.y, dir.y, time);
dir.z = Math::Smooth(actual.z, dir.z, time);
@@ -1225,7 +1224,7 @@ bool CMotionHuman::EventFrame(const Event &event)
dir.x = 0.0f;
dir.z = 0.0f;
dir.y = -1.5f; // slightly lower
- actual = m_object->RetLinVibration();
+ actual = m_object->GetLinVibration();
dir.x = Math::Smooth(actual.x, dir.x, time);
//? dir.y = Math::Smooth(actual.y, dir.y, time);
dir.y = -hr;
@@ -1235,7 +1234,7 @@ bool CMotionHuman::EventFrame(const Event &event)
dir.x = 0.0f;
dir.y = 0.0f;
dir.z = -0.2f;
- actual = m_object->RetInclinaison();
+ actual = m_object->GetInclinaison();
dir.x = Math::Smooth(actual.x, dir.x, time);
dir.y = Math::Smooth(actual.y, dir.y, time);
dir.z = Math::Smooth(actual.z, dir.z, time);
@@ -1248,7 +1247,7 @@ bool CMotionHuman::EventFrame(const Event &event)
dir.x = 0.4f; // slightly forward
dir.z = 0.0f;
dir.y = 0.0f;
- actual = m_object->RetLinVibration();
+ actual = m_object->GetLinVibration();
dir.x = Math::Smooth(actual.x, dir.x, time);
//? dir.y = Math::Smooth(actual.y, dir.y, time);
dir.y = -hr;
@@ -1258,7 +1257,7 @@ bool CMotionHuman::EventFrame(const Event &event)
dir.x = 0.0f;
dir.y = 0.0f;
dir.z = -0.2f;
- actual = m_object->RetInclinaison();
+ actual = m_object->GetInclinaison();
dir.x = Math::Smooth(actual.x, dir.x, time);
dir.y = Math::Smooth(actual.y, dir.y, time);
dir.z = Math::Smooth(actual.z, dir.z, time);
@@ -1271,7 +1270,7 @@ bool CMotionHuman::EventFrame(const Event &event)
dir.x = 0.0f;
dir.z = 0.0f;
dir.y = -2.0f; // slightly lower
- actual = m_object->RetLinVibration();
+ actual = m_object->GetLinVibration();
dir.x = Math::Smooth(actual.x, dir.x, time);
//? dir.y = Math::Smooth(actual.y, dir.y, time);
dir.y = -hr;
@@ -1281,7 +1280,7 @@ bool CMotionHuman::EventFrame(const Event &event)
dir.x = 0.0f;
dir.y = 0.0f;
dir.z = -0.4f;
- actual = m_object->RetInclinaison();
+ actual = m_object->GetInclinaison();
dir.x = Math::Smooth(actual.x, dir.x, time);
dir.y = Math::Smooth(actual.y, dir.y, time);
dir.z = Math::Smooth(actual.z, dir.z, time);
@@ -1289,7 +1288,7 @@ bool CMotionHuman::EventFrame(const Event &event)
}
else if ( m_actionType == MHS_DEADg ) // shooting death (falls)?
{
- if ( m_physics->RetLand() ) // on the ground?
+ if ( m_physics->GetLand() ) // on the ground?
{
SetAction(MHS_DEADg1, 0.5f); // knees
}
@@ -1303,16 +1302,16 @@ bool CMotionHuman::EventFrame(const Event &event)
for ( i=0 ; i<10 ; i++ )
{
- pos = m_object->RetPosition(0);
+ pos = m_object->GetPosition(0);
pos.x += (Math::Rand()-0.5f)*4.0f;
pos.z += (Math::Rand()-0.5f)*4.0f;
- m_terrain->MoveOnFloor(pos);
+ m_terrain->AdjustToFloor(pos);
speed = Math::Vector(0.0f, 0.0f, 0.0f);
dim.x = 1.2f+Math::Rand()*1.2f;
dim.y = dim.x;
- m_particule->CreateParticule(pos, speed, dim, PARTICRASH, 2.0f, 0.0f, 0.0f);
+ m_particle->CreateParticle(pos, speed, dim, Gfx::PARTICRASH, 2.0f, 0.0f, 0.0f);
}
- m_sound->Play(SOUND_BOUMv, m_object->RetPosition(0));
+ m_sound->Play(SOUND_BOUMv, m_object->GetPosition(0));
SetAction(MHS_DEADg2, 1.0f); // expects knees
}
@@ -1322,7 +1321,7 @@ bool CMotionHuman::EventFrame(const Event &event)
dir.x = 0.0f;
dir.z = 0.0f;
dir.y = -1.5f*prog;
- actual = m_object->RetLinVibration();
+ actual = m_object->GetLinVibration();
dir.x = Math::Smooth(actual.x, dir.x, time);
dir.y = Math::Smooth(actual.y, dir.y, time);
dir.z = Math::Smooth(actual.z, dir.z, time);
@@ -1331,7 +1330,7 @@ bool CMotionHuman::EventFrame(const Event &event)
dir.x = 0.0f;
dir.y = 0.0f;
dir.z = -(20.0f*Math::PI/180.0f)*prog;
- actual = m_object->RetInclinaison();
+ actual = m_object->GetInclinaison();
dir.x = Math::Smooth(actual.x, dir.x, time);
dir.y = Math::Smooth(actual.y, dir.y, time);
dir.z = Math::Smooth(actual.z, dir.z, time);
@@ -1349,7 +1348,7 @@ bool CMotionHuman::EventFrame(const Event &event)
dir.x = 0.0f;
dir.z = 0.0f;
dir.y = -1.5f;
- actual = m_object->RetLinVibration();
+ actual = m_object->GetLinVibration();
dir.x = Math::Smooth(actual.x, dir.x, time);
dir.y = Math::Smooth(actual.y, dir.y, time);
dir.z = Math::Smooth(actual.z, dir.z, time);
@@ -1358,7 +1357,7 @@ bool CMotionHuman::EventFrame(const Event &event)
dir.x = 0.0f;
dir.y = 0.0f;
dir.z = -(20.0f*Math::PI/180.0f);
- actual = m_object->RetInclinaison();
+ actual = m_object->GetInclinaison();
dir.x = Math::Smooth(actual.x, dir.x, time);
dir.y = Math::Smooth(actual.y, dir.y, time);
dir.z = Math::Smooth(actual.z, dir.z, time);
@@ -1373,16 +1372,16 @@ bool CMotionHuman::EventFrame(const Event &event)
for ( i=0 ; i<20 ; i++ )
{
- pos = m_object->RetPosition(0);
+ pos = m_object->GetPosition(0);
pos.x += (Math::Rand()-0.5f)*8.0f;
pos.z += (Math::Rand()-0.5f)*8.0f;
- m_terrain->MoveOnFloor(pos);
+ m_terrain->AdjustToFloor(pos);
speed = Math::Vector(0.0f, 0.0f, 0.0f);
dim.x = 2.0f+Math::Rand()*1.5f;
dim.y = dim.x;
- m_particule->CreateParticule(pos, speed, dim, PARTICRASH, 2.0f, 0.0f, 0.0f);
+ m_particle->CreateParticle(pos, speed, dim, Gfx::PARTICRASH, 2.0f, 0.0f, 0.0f);
}
- m_sound->Play(SOUND_BOUMv, m_object->RetPosition(0));
+ m_sound->Play(SOUND_BOUMv, m_object->GetPosition(0));
SetAction(MHS_DEADg4, 3.0f); // expects face down
}
@@ -1393,7 +1392,7 @@ bool CMotionHuman::EventFrame(const Event &event)
dir.y = -(1.5f+1.5f*prog);
dir.x = 0.0f;
dir.z = 0.0f;
- actual = m_object->RetLinVibration();
+ actual = m_object->GetLinVibration();
dir.x = Math::Smooth(actual.x, dir.x, time);
dir.y = Math::Smooth(actual.y, dir.y, time);
dir.z = Math::Smooth(actual.z, dir.z, time);
@@ -1402,7 +1401,7 @@ bool CMotionHuman::EventFrame(const Event &event)
dir.z = -((20.0f*Math::PI/180.0f)+(70.0f*Math::PI/180.0f)*prog);
dir.x = 0.0f;
dir.y = 0.0f;
- actual = m_object->RetInclinaison();
+ actual = m_object->GetInclinaison();
dir.x = Math::Smooth(actual.x, dir.x, time);
dir.y = Math::Smooth(actual.y, dir.y, time);
dir.z = Math::Smooth(actual.z, dir.z, time);
@@ -1420,7 +1419,7 @@ bool CMotionHuman::EventFrame(const Event &event)
dir.y = -(1.5f+1.5f);
dir.x = 0.0f;
dir.z = 0.0f;
- actual = m_object->RetLinVibration();
+ actual = m_object->GetLinVibration();
dir.x = Math::Smooth(actual.x, dir.x, time);
dir.y = Math::Smooth(actual.y, dir.y, time);
dir.z = Math::Smooth(actual.z, dir.z, time);
@@ -1429,7 +1428,7 @@ bool CMotionHuman::EventFrame(const Event &event)
dir.z = -((20.0f*Math::PI/180.0f)+(70.0f*Math::PI/180.0f));
dir.x = 0.0f;
dir.y = 0.0f;
- actual = m_object->RetInclinaison();
+ actual = m_object->GetInclinaison();
dir.x = Math::Smooth(actual.x, dir.x, time);
dir.y = Math::Smooth(actual.y, dir.y, time);
dir.z = Math::Smooth(actual.z, dir.z, time);
@@ -1437,8 +1436,8 @@ bool CMotionHuman::EventFrame(const Event &event)
}
else if ( m_actionType == MHS_DEADw ) // drowned?
{
- pos = m_object->RetPosition(0);
- level = m_water->RetLevel()-0.5f;
+ pos = m_object->GetPosition(0);
+ level = m_water->GetLevel()-0.5f;
if ( pos.y < level )
{
pos.y += 4.0f*event.rTime; // back to the surface
@@ -1467,7 +1466,7 @@ bool CMotionHuman::EventFrame(const Event &event)
dir.z = -(90.0f*Math::PI/180.0f)*prog;
dir.x = Math::Rand()*0.3f*deadFactor;
dir.y = Math::Rand()*0.3f*deadFactor;
- actual = m_object->RetInclinaison();
+ actual = m_object->GetInclinaison();
dir.x = Math::Smooth(actual.x, dir.x, time);
dir.y = Math::Smooth(actual.y, dir.y, time);
dir.z = Math::Smooth(actual.z, dir.z, time);
@@ -1494,7 +1493,7 @@ bool CMotionHuman::EventFrame(const Event &event)
m_object->SetLinVibration(dir);
SetLinVibration(dir);
- mat = m_object->RetWorldMatrix(0);
+ mat = m_object->GetWorldMatrix(0);
pos = Math::Vector(0.5f, 3.7f, 0.0f);
pos.x += (Math::Rand()-0.5f)*1.0f;
pos.y += (Math::Rand()-0.5f)*1.0f;
@@ -1505,7 +1504,7 @@ bool CMotionHuman::EventFrame(const Event &event)
speed.z = (Math::Rand()-0.5f)*0.5f;
dim.x = 0.5f+Math::Rand()*0.5f;
dim.y = dim.x;
- m_particule->CreateParticule(pos, speed, dim, PARTILENS1, 5.0f, 0.0f, 0.0f);
+ m_particle->CreateParticle(pos, speed, dim, Gfx::PARTILENS1, 5.0f, 0.0f, 0.0f);
}
else if ( m_actionType == MHS_SATCOM ) // look at the SatCom?
{
@@ -1515,7 +1514,7 @@ bool CMotionHuman::EventFrame(const Event &event)
}
else
{
- if ( m_physics->RetLand() ) // on the ground?
+ if ( m_physics->GetLand() ) // on the ground?
{
time = event.rTime*8.0f;
if ( bSwim ) time *= 0.25f;
@@ -1524,25 +1523,25 @@ bool CMotionHuman::EventFrame(const Event &event)
{
dir.x = sinf(Math::Mod(rTime[0]+0.5f, 1.0f)*Math::PI*2.0f)*0.10f;
dir.y = sinf(Math::Mod(rTime[0]+0.6f, 1.0f)*Math::PI*2.0f)*0.20f;
- s = m_physics->RetLinMotionX(MO_REASPEED)*0.03f;
+ s = m_physics->GetLinMotionX(MO_REASPEED)*0.03f;
}
else if ( action == MH_MARCHTAKE ) // takes walking?
{
dir.x = sinf(Math::Mod(rTime[0]+0.5f, 1.0f)*Math::PI*2.0f)*0.10f;
dir.y = sinf(Math::Mod(rTime[0]+0.6f, 1.0f)*Math::PI*2.0f)*0.15f;
- s = m_physics->RetLinMotionX(MO_REASPEED)*0.02f;
+ s = m_physics->GetLinMotionX(MO_REASPEED)*0.02f;
}
else
{
dir.x = 0.0f;
dir.y = 0.0f;
- s = m_physics->RetLinMotionX(MO_REASPEED)*0.03f;
+ s = m_physics->GetLinMotionX(MO_REASPEED)*0.03f;
}
if ( s < 0.0f ) s *= 0.5f;
dir.z = -s*0.7f;
- actual = m_object->RetInclinaison();
+ actual = m_object->GetInclinaison();
dir.x = Math::Smooth(actual.x, dir.x, time);
dir.y = Math::Smooth(actual.y, dir.y, time);
dir.z = Math::Smooth(actual.z, dir.z, time);
@@ -1554,7 +1553,7 @@ bool CMotionHuman::EventFrame(const Event &event)
{
p2.x = 0.0f;
p2.y = sinf(Math::Mod(rTime[0]+0.5f, 1.0f)*Math::PI*2.0f)*0.5f;
- p2 = Math::RotatePoint(-m_object->RetAngleY(0), p2);
+ p2 = Math::RotatePoint(-m_object->GetAngleY(0), p2);
dir.x = p2.x;
dir.z = p2.y;
dir.y = sinf(Math::Mod(rTime[0]*2.0f, 1.0f)*Math::PI*2.0f)*0.3f;
@@ -1563,7 +1562,7 @@ bool CMotionHuman::EventFrame(const Event &event)
{
p2.x = 0.0f;
p2.y = sinf(Math::Mod(rTime[0]+0.5f, 1.0f)*Math::PI*2.0f)*0.25f;
- p2 = Math::RotatePoint(-m_object->RetAngleY(0), p2);
+ p2 = Math::RotatePoint(-m_object->GetAngleY(0), p2);
dir.x = p2.x;
dir.z = p2.y;
dir.y = sinf(Math::Mod(rTime[0]*2.0f, 1.0f)*Math::PI*2.0f)*0.05f-0.3f;
@@ -1575,7 +1574,7 @@ bool CMotionHuman::EventFrame(const Event &event)
dir.y = 0.0f;
}
- actual = m_object->RetLinVibration();
+ actual = m_object->GetLinVibration();
dir.x = Math::Smooth(actual.x, dir.x, time);
if ( action == MH_MARCHTAKE ) // takes walking?
{
@@ -1602,16 +1601,16 @@ bool CMotionHuman::EventFrame(const Event &event)
if ( m_actionType == MHS_TAKE || // takes?
m_actionType == MHS_FLAG ) // takes?
{
- m_object->SetAngleZ(1, Math::Smooth(m_object->RetAngleZ(1), sinf(m_armTimeAbs*1.0f)*0.2f-0.6f, event.rTime*5.0f));
+ m_object->SetAngleZ(1, Math::Smooth(m_object->GetAngleZ(1), sinf(m_armTimeAbs*1.0f)*0.2f-0.6f, event.rTime*5.0f));
m_object->SetAngleX(1, sinf(m_armTimeAbs*1.1f)*0.1f);
- m_object->SetAngleY(1, Math::Smooth(m_object->RetAngleY(1), sinf(m_armTimeAbs*1.3f)*0.2f+rot*0.3f, event.rTime*5.0f));
+ m_object->SetAngleY(1, Math::Smooth(m_object->GetAngleY(1), sinf(m_armTimeAbs*1.3f)*0.2f+rot*0.3f, event.rTime*5.0f));
}
else if ( m_actionType == MHS_TAKEOTHER || // takes?
m_actionType == MHS_TAKEHIGH ) // takes?
{
- m_object->SetAngleZ(1, Math::Smooth(m_object->RetAngleZ(1), sinf(m_armTimeAbs*1.0f)*0.2f-0.3f, event.rTime*5.0f));
+ m_object->SetAngleZ(1, Math::Smooth(m_object->GetAngleZ(1), sinf(m_armTimeAbs*1.0f)*0.2f-0.3f, event.rTime*5.0f));
m_object->SetAngleX(1, sinf(m_armTimeAbs*1.1f)*0.1f);
- m_object->SetAngleY(1, Math::Smooth(m_object->RetAngleY(1), sinf(m_armTimeAbs*1.3f)*0.2f+rot*0.3f, event.rTime*5.0f));
+ m_object->SetAngleY(1, Math::Smooth(m_object->GetAngleY(1), sinf(m_armTimeAbs*1.3f)*0.2f+rot*0.3f, event.rTime*5.0f));
}
else if ( m_actionType == MHS_WIN ) // win
{
@@ -1627,14 +1626,14 @@ bool CMotionHuman::EventFrame(const Event &event)
m_object->SetAngleX(1, sinf(m_armTimeAbs*0.7f)*0.10f);
m_object->SetAngleY(1, sinf(m_armTimeAbs*3.0f)*0.30f*factor);
}
- else if ( m_object->RetDead() ) // dead?
+ else if ( m_object->GetDead() ) // dead?
{
}
else
{
- m_object->SetAngleZ(1, Math::Smooth(m_object->RetAngleZ(1), sinf(m_armTimeAbs*1.0f)*0.2f, event.rTime*5.0f));
+ m_object->SetAngleZ(1, Math::Smooth(m_object->GetAngleZ(1), sinf(m_armTimeAbs*1.0f)*0.2f, event.rTime*5.0f));
m_object->SetAngleX(1, sinf(m_armTimeAbs*1.1f)*0.1f);
- m_object->SetAngleY(1, Math::Smooth(m_object->RetAngleY(1), sinf(m_armTimeAbs*1.3f)*0.2f+rot*0.3f, event.rTime*5.0f));
+ m_object->SetAngleY(1, Math::Smooth(m_object->GetAngleY(1), sinf(m_armTimeAbs*1.3f)*0.2f+rot*0.3f, event.rTime*5.0f));
}
if ( bOnBoard )
@@ -1651,9 +1650,9 @@ bool CMotionHuman::EventFrame(const Event &event)
Sound sound[2];
float speed, synchro, volume[2], freq[2], hard, level;
- speed = m_physics->RetLinMotionX(MO_REASPEED);
+ speed = m_physics->GetLinMotionX(MO_REASPEED);
- if ( m_object->RetFret() == 0 )
+ if ( m_object->GetFret() == 0 )
{
if ( speed > 0.0f ) synchro = 0.21f; // synchro forward
else synchro = 0.29f; // synchro backward
@@ -1670,7 +1669,7 @@ bool CMotionHuman::EventFrame(const Event &event)
{
volume[0] = 0.5f;
freq[0] = 1.0f;
- if ( m_object->RetFret() != 0 )
+ if ( m_object->GetFret() != 0 )
{
//? volume[0] *= 2.0f;
freq[0] = 0.7f;
@@ -1680,16 +1679,16 @@ bool CMotionHuman::EventFrame(const Event &event)
sound[0] = SOUND_CLICK;
sound[1] = SOUND_CLICK;
- pos = m_object->RetPosition(0);
+ pos = m_object->GetPosition(0);
- level = m_water->RetLevel();
+ level = m_water->GetLevel();
if ( pos.y <= level+3.0f ) // underwater?
{
sound[0] = SOUND_STEPw;
}
else
{
- hard = m_terrain->RetHardness(pos);
+ hard = m_terrain->GetHardness(pos);
if ( hard >= 0.875 )
{
@@ -1737,17 +1736,17 @@ bool CMotionHuman::EventFrame(const Event &event)
if ( fabs(m_lastSoundMarch-time) > 0.9f &&
Math::Mod(time, 1.0f) < 0.1f )
{
- m_sound->Play(SOUND_SWIM, m_object->RetPosition(0), 0.5f);
+ m_sound->Play(SOUND_SWIM, m_object->GetPosition(0), 0.5f);
m_lastSoundMarch = time;
}
}
m_lastSoundHhh -= event.rTime;
if ( m_lastSoundHhh <= 0.0f &&
- m_object->RetSelect() &&
- m_object->RetOption() == 0 ) // helmet?
+ m_object->GetSelect() &&
+ m_object->GetOption() == 0 ) // helmet?
{
- m_sound->Play(SOUND_HUMAN1, m_object->RetPosition(0), (0.5f+m_tired*0.2f));
+ m_sound->Play(SOUND_HUMAN1, m_object->GetPosition(0), (0.5f+m_tired*0.2f));
m_lastSoundHhh = (4.0f-m_tired*2.5f)+(4.0f-m_tired*2.5f)*Math::Rand();
}
diff --git a/src/object/motion/motionmother.cpp b/src/object/motion/motionmother.cpp
index 0b783a3..d8850e2 100644
--- a/src/object/motion/motionmother.cpp
+++ b/src/object/motion/motionmother.cpp
@@ -21,7 +21,7 @@
#include "object/motion/motionmother.h"
-#include "old/modfile.h"
+#include "graphics/engine/modelfile.h"
#include "physics/physics.h"
@@ -67,18 +67,18 @@ void CMotionMother::DeleteObject(bool bAll)
bool CMotionMother::Create(Math::Vector pos, float angle, ObjectType type,
float power)
{
- CModFile* pModFile;
+ Gfx::CModelFile* pModFile;
int rank;
- if ( m_engine->RetRestCreate() < 2+12+6 ) return false;
+// if ( m_engine->GetRestCreate() < 2+12+6 ) return false;
- pModFile = new CModFile(m_iMan);
+ pModFile = new Gfx::CModelFile(m_iMan);
m_object->SetType(type);
// Creates main base.
rank = m_engine->CreateObject();
- m_engine->SetObjectType(rank, TYPEVEHICULE); // this is a moving object
+ m_engine->SetObjectType(rank, Gfx::ENG_OBJTYPE_VEHICULE); // this is a moving object
m_object->SetObjectRank(0, rank);
pModFile->ReadModel("objects\\mother1.mod");
@@ -94,7 +94,7 @@ bool CMotionMother::Create(Math::Vector pos, float angle, ObjectType type,
// Creates the head.
rank = m_engine->CreateObject();
- m_engine->SetObjectType(rank, TYPEDESCENDANT);
+ m_engine->SetObjectType(rank, Gfx::ENG_OBJTYPE_DESCENDANT);
m_object->SetObjectRank(1, rank);
m_object->SetObjectParent(1, 0);
pModFile->ReadModel("objects\\mother2.mod");
@@ -103,7 +103,7 @@ bool CMotionMother::Create(Math::Vector pos, float angle, ObjectType type,
// Creates a right-back leg.
rank = m_engine->CreateObject();
- m_engine->SetObjectType(rank, TYPEDESCENDANT);
+ m_engine->SetObjectType(rank, Gfx::ENG_OBJTYPE_DESCENDANT);
m_object->SetObjectRank(2, rank);
m_object->SetObjectParent(2, 0);
pModFile->ReadModel("objects\\mother3.mod");
@@ -112,7 +112,7 @@ bool CMotionMother::Create(Math::Vector pos, float angle, ObjectType type,
// Creates a right-back foot.
rank = m_engine->CreateObject();
- m_engine->SetObjectType(rank, TYPEDESCENDANT);
+ m_engine->SetObjectType(rank, Gfx::ENG_OBJTYPE_DESCENDANT);
m_object->SetObjectRank(3, rank);
m_object->SetObjectParent(3, 2);
pModFile->ReadModel("objects\\mother4.mod");
@@ -121,7 +121,7 @@ bool CMotionMother::Create(Math::Vector pos, float angle, ObjectType type,
// Creates a middle-right leg.
rank = m_engine->CreateObject();
- m_engine->SetObjectType(rank, TYPEDESCENDANT);
+ m_engine->SetObjectType(rank, Gfx::ENG_OBJTYPE_DESCENDANT);
m_object->SetObjectRank(4, rank);
m_object->SetObjectParent(4, 0);
pModFile->ReadModel("objects\\mother3.mod");
@@ -130,7 +130,7 @@ bool CMotionMother::Create(Math::Vector pos, float angle, ObjectType type,
// Creates a middle-right foot.
rank = m_engine->CreateObject();
- m_engine->SetObjectType(rank, TYPEDESCENDANT);
+ m_engine->SetObjectType(rank, Gfx::ENG_OBJTYPE_DESCENDANT);
m_object->SetObjectRank(5, rank);
m_object->SetObjectParent(5, 4);
pModFile->ReadModel("objects\\mother4.mod");
@@ -139,7 +139,7 @@ bool CMotionMother::Create(Math::Vector pos, float angle, ObjectType type,
// Creates a right-front leg.
rank = m_engine->CreateObject();
- m_engine->SetObjectType(rank, TYPEDESCENDANT);
+ m_engine->SetObjectType(rank, Gfx::ENG_OBJTYPE_DESCENDANT);
m_object->SetObjectRank(6, rank);
m_object->SetObjectParent(6, 0);
pModFile->ReadModel("objects\\mother3.mod");
@@ -148,7 +148,7 @@ bool CMotionMother::Create(Math::Vector pos, float angle, ObjectType type,
// Creates a right-front foot.
rank = m_engine->CreateObject();
- m_engine->SetObjectType(rank, TYPEDESCENDANT);
+ m_engine->SetObjectType(rank, Gfx::ENG_OBJTYPE_DESCENDANT);
m_object->SetObjectRank(7, rank);
m_object->SetObjectParent(7, 6);
pModFile->ReadModel("objects\\mother4.mod");
@@ -157,7 +157,7 @@ bool CMotionMother::Create(Math::Vector pos, float angle, ObjectType type,
// Creates a left-back leg.
rank = m_engine->CreateObject();
- m_engine->SetObjectType(rank, TYPEDESCENDANT);
+ m_engine->SetObjectType(rank, Gfx::ENG_OBJTYPE_DESCENDANT);
m_object->SetObjectRank(8, rank);
m_object->SetObjectParent(8, 0);
pModFile->ReadModel("objects\\mother3.mod");
@@ -167,7 +167,7 @@ bool CMotionMother::Create(Math::Vector pos, float angle, ObjectType type,
// Creates a left-back foot.
rank = m_engine->CreateObject();
- m_engine->SetObjectType(rank, TYPEDESCENDANT);
+ m_engine->SetObjectType(rank, Gfx::ENG_OBJTYPE_DESCENDANT);
m_object->SetObjectRank(9, rank);
m_object->SetObjectParent(9, 8);
pModFile->ReadModel("objects\\mother4.mod");
@@ -176,7 +176,7 @@ bool CMotionMother::Create(Math::Vector pos, float angle, ObjectType type,
// Creates a middle-left leg.
rank = m_engine->CreateObject();
- m_engine->SetObjectType(rank, TYPEDESCENDANT);
+ m_engine->SetObjectType(rank, Gfx::ENG_OBJTYPE_DESCENDANT);
m_object->SetObjectRank(10, rank);
m_object->SetObjectParent(10, 0);
pModFile->ReadModel("objects\\mother3.mod");
@@ -186,7 +186,7 @@ bool CMotionMother::Create(Math::Vector pos, float angle, ObjectType type,
// Creates a middle-left foot.
rank = m_engine->CreateObject();
- m_engine->SetObjectType(rank, TYPEDESCENDANT);
+ m_engine->SetObjectType(rank, Gfx::ENG_OBJTYPE_DESCENDANT);
m_object->SetObjectRank(11, rank);
m_object->SetObjectParent(11, 10);
pModFile->ReadModel("objects\\mother4.mod");
@@ -195,7 +195,7 @@ bool CMotionMother::Create(Math::Vector pos, float angle, ObjectType type,
// Creates a left-front leg.
rank = m_engine->CreateObject();
- m_engine->SetObjectType(rank, TYPEDESCENDANT);
+ m_engine->SetObjectType(rank, Gfx::ENG_OBJTYPE_DESCENDANT);
m_object->SetObjectRank(12, rank);
m_object->SetObjectParent(12, 0);
pModFile->ReadModel("objects\\mother3.mod");
@@ -205,7 +205,7 @@ bool CMotionMother::Create(Math::Vector pos, float angle, ObjectType type,
// Creates a left-front foot.
rank = m_engine->CreateObject();
- m_engine->SetObjectType(rank, TYPEDESCENDANT);
+ m_engine->SetObjectType(rank, Gfx::ENG_OBJTYPE_DESCENDANT);
m_object->SetObjectRank(13, rank);
m_object->SetObjectParent(13, 12);
pModFile->ReadModel("objects\\mother4.mod");
@@ -214,7 +214,7 @@ bool CMotionMother::Create(Math::Vector pos, float angle, ObjectType type,
// Creates the right antenna.
rank = m_engine->CreateObject();
- m_engine->SetObjectType(rank, TYPEDESCENDANT);
+ m_engine->SetObjectType(rank, Gfx::ENG_OBJTYPE_DESCENDANT);
m_object->SetObjectRank(14, rank);
m_object->SetObjectParent(14, 1);
pModFile->ReadModel("objects\\mother5.mod");
@@ -222,7 +222,7 @@ bool CMotionMother::Create(Math::Vector pos, float angle, ObjectType type,
m_object->SetPosition(14, Math::Vector(6.0f, 1.0f, -2.5f));
rank = m_engine->CreateObject();
- m_engine->SetObjectType(rank, TYPEDESCENDANT);
+ m_engine->SetObjectType(rank, Gfx::ENG_OBJTYPE_DESCENDANT);
m_object->SetObjectRank(15, rank);
m_object->SetObjectParent(15, 14);
pModFile->ReadModel("objects\\mother6.mod");
@@ -231,7 +231,7 @@ bool CMotionMother::Create(Math::Vector pos, float angle, ObjectType type,
// Creates the left antenna.
rank = m_engine->CreateObject();
- m_engine->SetObjectType(rank, TYPEDESCENDANT);
+ m_engine->SetObjectType(rank, Gfx::ENG_OBJTYPE_DESCENDANT);
m_object->SetObjectRank(16, rank);
m_object->SetObjectParent(16, 1);
pModFile->ReadModel("objects\\mother5.mod");
@@ -239,7 +239,7 @@ bool CMotionMother::Create(Math::Vector pos, float angle, ObjectType type,
m_object->SetPosition(16, Math::Vector(6.0f, 1.0f, 2.5f));
rank = m_engine->CreateObject();
- m_engine->SetObjectType(rank, TYPEDESCENDANT);
+ m_engine->SetObjectType(rank, Gfx::ENG_OBJTYPE_DESCENDANT);
m_object->SetObjectRank(17, rank);
m_object->SetObjectParent(17, 16);
pModFile->ReadModel("objects\\mother6.mod");
@@ -248,7 +248,7 @@ bool CMotionMother::Create(Math::Vector pos, float angle, ObjectType type,
// Creates the right claw.
rank = m_engine->CreateObject();
- m_engine->SetObjectType(rank, TYPEDESCENDANT);
+ m_engine->SetObjectType(rank, Gfx::ENG_OBJTYPE_DESCENDANT);
m_object->SetObjectRank(18, rank);
m_object->SetObjectParent(18, 1);
pModFile->ReadModel("objects\\mother7.mod");
@@ -258,7 +258,7 @@ bool CMotionMother::Create(Math::Vector pos, float angle, ObjectType type,
// Creates the left claw.
rank = m_engine->CreateObject();
- m_engine->SetObjectType(rank, TYPEDESCENDANT);
+ m_engine->SetObjectType(rank, Gfx::ENG_OBJTYPE_DESCENDANT);
m_object->SetObjectRank(19, rank);
m_object->SetObjectParent(19, 1);
pModFile->ReadModel("objects\\mother7.mod");
@@ -272,10 +272,10 @@ bool CMotionMother::Create(Math::Vector pos, float angle, ObjectType type,
CreatePhysics();
m_object->SetFloorHeight(0.0f);
- pos = m_object->RetPosition(0);
+ pos = m_object->GetPosition(0);
m_object->SetPosition(0, pos); // to display the shadows immediately
- m_engine->LoadAllTexture();
+ m_engine->LoadAllTextures();
delete pModFile;
return true;
@@ -306,7 +306,7 @@ void CMotionMother::CreatePhysics()
m_physics->SetType(TYPE_ROLLING);
- character = m_object->RetCharacter();
+ character = m_object->GetCharacter();
character->wheelFront = 10.0f;
character->wheelBack = 10.0f;
character->wheelLeft = 20.0f;
@@ -343,12 +343,12 @@ bool CMotionMother::EventProcess(const Event &event)
{
CMotion::EventProcess(event);
- if ( event.event == EVENT_FRAME )
+ if ( event.type == EVENT_FRAME )
{
return EventFrame(event);
}
- if ( event.event == EVENT_KEYDOWN )
+ if ( event.type == EVENT_KEY_DOWN )
{
#if ADJUST_ANGLE
int i;
@@ -390,11 +390,11 @@ bool CMotionMother::EventFrame(const Event &event)
int i, st, nd;
bool bStop;
- if ( m_engine->RetPause() ) return true;
- if ( !m_engine->IsVisiblePoint(m_object->RetPosition(0)) ) return true;
+ if ( m_engine->GetPause() ) return true;
+ if ( !m_engine->IsVisiblePoint(m_object->GetPosition(0)) ) return true;
- s = m_physics->RetLinMotionX(MO_MOTSPEED)*1.5f;
- a = fabs(m_physics->RetCirMotionY(MO_MOTSPEED)*26.0f);
+ s = m_physics->GetLinMotionX(MO_MOTSPEED)*1.5f;
+ a = fabs(m_physics->GetCirMotionY(MO_MOTSPEED)*26.0f);
if ( s == 0.0f && a != 0.0f ) a *= 1.5f;
@@ -418,7 +418,7 @@ bool CMotionMother::EventFrame(const Event &event)
else prog = Math::Mod(m_armMember+(2.0f-(i%3))*0.33f+0.3f, 1.0f);
if ( m_bArmStop )
{
- prog = (float)m_armTimeIndex/3.0f;
+ prog = static_cast< float >(m_armTimeIndex/3.0f);
}
if ( prog < 0.33f ) // t0..t1 ?
{
@@ -461,7 +461,7 @@ bool CMotionMother::EventFrame(const Event &event)
}
#if ADJUST_ANGLE
- if ( m_object->RetSelect() )
+ if ( m_object->GetSelect() )
{
char s[100];
sprintf(s, "A:time=%d Q:part=%d W:member=%d", m_armTimeIndex, m_armPartIndex, m_armMemberIndex);
@@ -469,7 +469,7 @@ bool CMotionMother::EventFrame(const Event &event)
}
#endif
- if ( !bStop && !m_object->RetRuin() )
+ if ( !bStop && !m_object->GetRuin() )
{
a = Math::Mod(m_armTimeMarch, 1.0f);
if ( a < 0.5f ) a = -1.0f+4.0f*a; // -1..1
diff --git a/src/object/motion/motionspider.cpp b/src/object/motion/motionspider.cpp
index be16e08..a3b55fc 100644
--- a/src/object/motion/motionspider.cpp
+++ b/src/object/motion/motionspider.cpp
@@ -21,8 +21,8 @@
#include "object/motion/motionspider.h"
-#include "old/modfile.h"
-#include "old/particule.h"
+#include "graphics/engine/modelfile.h"
+#include "graphics/engine/particle.h"
#include "physics/physics.h"
@@ -46,7 +46,7 @@ CMotionSpider::CMotionSpider(CInstanceManager* iMan, CObject* object)
m_armMemberIndex = 0;
m_armLastAction = -1;
m_bArmStop = false;
- m_lastParticule = 0.0f;
+ m_lastParticle = 0.0f;
}
// Object's destructor.
@@ -68,7 +68,7 @@ void CMotionSpider::DeleteObject(bool bAll)
bool CMotionSpider::Create(Math::Vector pos, float angle, ObjectType type,
float power)
{
- CModFile* pModFile;
+ Gfx::CModelFile* pModFile;
int rank, i, j, parent;
char name[50];
@@ -96,15 +96,15 @@ bool CMotionSpider::Create(Math::Vector pos, float angle, ObjectType type,
0.0f, 0.0f, -2.0f,
};
- if ( m_engine->RetRestCreate() < 3+32+2 ) return false;
+// if ( m_engine->GetRestCreate() < 3+32+2 ) return false;
- pModFile = new CModFile(m_iMan);
+ pModFile = new Gfx::CModelFile(m_iMan);
m_object->SetType(type);
// Creates the main base.
rank = m_engine->CreateObject();
- m_engine->SetObjectType(rank, TYPEVEHICULE); // this is a moving object
+ m_engine->SetObjectType(rank, Gfx::ENG_OBJTYPE_VEHICULE); // this is a moving object
m_object->SetObjectRank(0, rank);
pModFile->ReadModel("objects\\spider0.mod"); // doesn't exist
pModFile->CreateEngineObject(rank);
@@ -118,7 +118,7 @@ bool CMotionSpider::Create(Math::Vector pos, float angle, ObjectType type,
// Creates the abdomen.
rank = m_engine->CreateObject();
- m_engine->SetObjectType(rank, TYPEDESCENDANT);
+ m_engine->SetObjectType(rank, Gfx::ENG_OBJTYPE_DESCENDANT);
m_object->SetObjectRank(1, rank);
m_object->SetObjectParent(1, 0);
pModFile->ReadModel("objects\\spider1.mod");
@@ -127,7 +127,7 @@ bool CMotionSpider::Create(Math::Vector pos, float angle, ObjectType type,
// Creates the head.
rank = m_engine->CreateObject();
- m_engine->SetObjectType(rank, TYPEDESCENDANT);
+ m_engine->SetObjectType(rank, Gfx::ENG_OBJTYPE_DESCENDANT);
m_object->SetObjectRank(2, rank);
m_object->SetObjectParent(2, 0);
pModFile->ReadModel("objects\\spider2.mod");
@@ -143,7 +143,7 @@ bool CMotionSpider::Create(Math::Vector pos, float angle, ObjectType type,
// Creates the right leg.
rank = m_engine->CreateObject();
- m_engine->SetObjectType(rank, TYPEDESCENDANT);
+ m_engine->SetObjectType(rank, Gfx::ENG_OBJTYPE_DESCENDANT);
m_object->SetObjectRank(3+i*4+j, rank);
if ( j == 0 ) parent = 0;
else parent = 3+i*4+j-1;
@@ -157,7 +157,7 @@ bool CMotionSpider::Create(Math::Vector pos, float angle, ObjectType type,
// Creates the left leg.
rank = m_engine->CreateObject();
- m_engine->SetObjectType(rank, TYPEDESCENDANT);
+ m_engine->SetObjectType(rank, Gfx::ENG_OBJTYPE_DESCENDANT);
m_object->SetObjectRank(19+i*4+j, rank);
if ( j == 0 ) parent = 0;
else parent = 19+i*4+j-1;
@@ -174,7 +174,7 @@ bool CMotionSpider::Create(Math::Vector pos, float angle, ObjectType type,
// Creates the right mandible.
rank = m_engine->CreateObject();
- m_engine->SetObjectType(rank, TYPEDESCENDANT);
+ m_engine->SetObjectType(rank, Gfx::ENG_OBJTYPE_DESCENDANT);
m_object->SetObjectRank(35, rank);
m_object->SetObjectParent(35, 1);
pModFile->ReadModel("objects\\spider7.mod");
@@ -183,7 +183,7 @@ bool CMotionSpider::Create(Math::Vector pos, float angle, ObjectType type,
// Creates the left mandible.
rank = m_engine->CreateObject();
- m_engine->SetObjectType(rank, TYPEDESCENDANT);
+ m_engine->SetObjectType(rank, Gfx::ENG_OBJTYPE_DESCENDANT);
m_object->SetObjectRank(36, rank);
m_object->SetObjectParent(36, 1);
pModFile->ReadModel("objects\\spider7.mod");
@@ -196,10 +196,10 @@ bool CMotionSpider::Create(Math::Vector pos, float angle, ObjectType type,
CreatePhysics();
m_object->SetFloorHeight(0.0f);
- pos = m_object->RetPosition(0);
+ pos = m_object->GetPosition(0);
m_object->SetPosition(0, pos); // to display the shadows immediately
- m_engine->LoadAllTexture();
+ m_engine->LoadAllTextures();
delete pModFile;
return true;
@@ -286,7 +286,7 @@ void CMotionSpider::CreatePhysics()
m_physics->SetType(TYPE_ROLLING);
- character = m_object->RetCharacter();
+ character = m_object->GetCharacter();
character->wheelFront = 4.0f;
character->wheelBack = 4.0f;
character->wheelLeft = 6.0f;
@@ -331,12 +331,12 @@ bool CMotionSpider::EventProcess(const Event &event)
{
CMotion::EventProcess(event);
- if ( event.event == EVENT_FRAME )
+ if ( event.type == EVENT_FRAME )
{
return EventFrame(event);
}
- if ( event.event == EVENT_KEYDOWN )
+ if ( event.type == EVENT_KEY_DOWN )
{
#if ADJUST_ANGLE
int i;
@@ -381,11 +381,11 @@ bool CMotionSpider::EventFrame(const Event &event)
int i, ii, st, nd, action;
bool bStop;
- if ( m_engine->RetPause() ) return true;
- if ( !m_engine->IsVisiblePoint(m_object->RetPosition(0)) ) return true;
+ if ( m_engine->GetPause() ) return true;
+ if ( !m_engine->IsVisiblePoint(m_object->GetPosition(0)) ) return true;
- s = m_physics->RetLinMotionX(MO_MOTSPEED)*1.5f;
- a = fabs(m_physics->RetCirMotionY(MO_MOTSPEED)*2.0f);
+ s = m_physics->GetLinMotionX(MO_MOTSPEED)*1.5f;
+ a = fabs(m_physics->GetCirMotionY(MO_MOTSPEED)*2.0f);
if ( s == 0.0f && a != 0.0f ) a *= 1.5f;
@@ -410,13 +410,13 @@ bool CMotionSpider::EventFrame(const Event &event)
m_armMember += a;
}
- if ( m_object->RetRuin() ) // destroyed?
+ if ( m_object->GetRuin() ) // destroyed?
{
m_actionType = MSS_RUIN;
}
- if ( m_object->RetBurn() ) // burning?
+ if ( m_object->GetBurn() ) // burning?
{
- if ( m_object->RetFixed() )
+ if ( m_object->GetFixed() )
{
m_actionType = MSS_BURN;
}
@@ -443,7 +443,7 @@ bool CMotionSpider::EventFrame(const Event &event)
else prog = Math::Mod(m_armMember+(2.0f-(i%4))*0.25f+0.5f, 1.0f);
if ( m_bArmStop )
{
- prog = (float)m_armTimeIndex/3.0f;
+ prog = static_cast< float >(m_armTimeIndex/3.0f);
action = MS_MARCH;
}
if ( prog < 0.33f ) // t0..t1 ?
@@ -511,38 +511,38 @@ bool CMotionSpider::EventFrame(const Event &event)
if ( i < 4 ) // right leg (1..4) ?
{
- m_object->SetAngleX(3+4*i+0, Math::Smooth(m_object->RetAngleX(3+4*i+0), Math::PropAngle(tSt[ 0], tNd[ 0], prog), time));
- m_object->SetAngleY(3+4*i+0, Math::Smooth(m_object->RetAngleY(3+4*i+0), Math::PropAngle(tSt[ 1], tNd[ 1], prog), time));
- m_object->SetAngleZ(3+4*i+0, Math::Smooth(m_object->RetAngleZ(3+4*i+0), Math::PropAngle(tSt[ 2], tNd[ 2], prog), time));
- m_object->SetAngleX(3+4*i+1, Math::Smooth(m_object->RetAngleX(3+4*i+1), Math::PropAngle(tSt[ 3], tNd[ 3], prog), time));
- m_object->SetAngleY(3+4*i+1, Math::Smooth(m_object->RetAngleY(3+4*i+1), Math::PropAngle(tSt[ 4], tNd[ 4], prog), time));
- m_object->SetAngleZ(3+4*i+1, Math::Smooth(m_object->RetAngleZ(3+4*i+1), Math::PropAngle(tSt[ 5], tNd[ 5], prog), time));
- m_object->SetAngleX(3+4*i+2, Math::Smooth(m_object->RetAngleX(3+4*i+2), Math::PropAngle(tSt[ 6], tNd[ 6], prog), time));
- m_object->SetAngleY(3+4*i+2, Math::Smooth(m_object->RetAngleY(3+4*i+2), Math::PropAngle(tSt[ 7], tNd[ 7], prog), time));
- m_object->SetAngleZ(3+4*i+2, Math::Smooth(m_object->RetAngleZ(3+4*i+2), Math::PropAngle(tSt[ 8], tNd[ 8], prog), time));
- m_object->SetAngleX(3+4*i+3, Math::Smooth(m_object->RetAngleX(3+4*i+3), Math::PropAngle(tSt[ 9], tNd[ 9], prog), time));
- m_object->SetAngleY(3+4*i+3, Math::Smooth(m_object->RetAngleY(3+4*i+3), Math::PropAngle(tSt[10], tNd[10], prog), time));
- m_object->SetAngleZ(3+4*i+3, Math::Smooth(m_object->RetAngleZ(3+4*i+3), Math::PropAngle(tSt[11], tNd[11], prog), time));
+ m_object->SetAngleX(3+4*i+0, Math::Smooth(m_object->GetAngleX(3+4*i+0), Math::PropAngle(tSt[ 0], tNd[ 0], prog), time));
+ m_object->SetAngleY(3+4*i+0, Math::Smooth(m_object->GetAngleY(3+4*i+0), Math::PropAngle(tSt[ 1], tNd[ 1], prog), time));
+ m_object->SetAngleZ(3+4*i+0, Math::Smooth(m_object->GetAngleZ(3+4*i+0), Math::PropAngle(tSt[ 2], tNd[ 2], prog), time));
+ m_object->SetAngleX(3+4*i+1, Math::Smooth(m_object->GetAngleX(3+4*i+1), Math::PropAngle(tSt[ 3], tNd[ 3], prog), time));
+ m_object->SetAngleY(3+4*i+1, Math::Smooth(m_object->GetAngleY(3+4*i+1), Math::PropAngle(tSt[ 4], tNd[ 4], prog), time));
+ m_object->SetAngleZ(3+4*i+1, Math::Smooth(m_object->GetAngleZ(3+4*i+1), Math::PropAngle(tSt[ 5], tNd[ 5], prog), time));
+ m_object->SetAngleX(3+4*i+2, Math::Smooth(m_object->GetAngleX(3+4*i+2), Math::PropAngle(tSt[ 6], tNd[ 6], prog), time));
+ m_object->SetAngleY(3+4*i+2, Math::Smooth(m_object->GetAngleY(3+4*i+2), Math::PropAngle(tSt[ 7], tNd[ 7], prog), time));
+ m_object->SetAngleZ(3+4*i+2, Math::Smooth(m_object->GetAngleZ(3+4*i+2), Math::PropAngle(tSt[ 8], tNd[ 8], prog), time));
+ m_object->SetAngleX(3+4*i+3, Math::Smooth(m_object->GetAngleX(3+4*i+3), Math::PropAngle(tSt[ 9], tNd[ 9], prog), time));
+ m_object->SetAngleY(3+4*i+3, Math::Smooth(m_object->GetAngleY(3+4*i+3), Math::PropAngle(tSt[10], tNd[10], prog), time));
+ m_object->SetAngleZ(3+4*i+3, Math::Smooth(m_object->GetAngleZ(3+4*i+3), Math::PropAngle(tSt[11], tNd[11], prog), time));
}
else // left leg (5..8) ?
{
- m_object->SetAngleX(3+4*i+0, Math::Smooth(m_object->RetAngleX(3+4*i+0), Math::PropAngle(-tSt[ 0], -tNd[ 0], prog), time));
- m_object->SetAngleY(3+4*i+0, Math::Smooth(m_object->RetAngleY(3+4*i+0), Math::PropAngle(-tSt[ 1], -tNd[ 1], prog), time));
- m_object->SetAngleZ(3+4*i+0, Math::Smooth(m_object->RetAngleZ(3+4*i+0), Math::PropAngle( tSt[ 2], tNd[ 2], prog), time));
- m_object->SetAngleX(3+4*i+1, Math::Smooth(m_object->RetAngleX(3+4*i+1), Math::PropAngle(-tSt[ 3], -tNd[ 3], prog), time));
- m_object->SetAngleY(3+4*i+1, Math::Smooth(m_object->RetAngleY(3+4*i+1), Math::PropAngle(-tSt[ 4], -tNd[ 4], prog), time));
- m_object->SetAngleZ(3+4*i+1, Math::Smooth(m_object->RetAngleZ(3+4*i+1), Math::PropAngle( tSt[ 5], tNd[ 5], prog), time));
- m_object->SetAngleX(3+4*i+2, Math::Smooth(m_object->RetAngleX(3+4*i+2), Math::PropAngle(-tSt[ 6], -tNd[ 6], prog), time));
- m_object->SetAngleY(3+4*i+2, Math::Smooth(m_object->RetAngleY(3+4*i+2), Math::PropAngle(-tSt[ 7], -tNd[ 7], prog), time));
- m_object->SetAngleZ(3+4*i+2, Math::Smooth(m_object->RetAngleZ(3+4*i+2), Math::PropAngle( tSt[ 8], tNd[ 8], prog), time));
- m_object->SetAngleX(3+4*i+3, Math::Smooth(m_object->RetAngleX(3+4*i+3), Math::PropAngle(-tSt[ 9], -tNd[ 9], prog), time));
- m_object->SetAngleY(3+4*i+3, Math::Smooth(m_object->RetAngleY(3+4*i+3), Math::PropAngle(-tSt[10], -tNd[10], prog), time));
- m_object->SetAngleZ(3+4*i+3, Math::Smooth(m_object->RetAngleZ(3+4*i+3), Math::PropAngle( tSt[11], tNd[11], prog), time));
+ m_object->SetAngleX(3+4*i+0, Math::Smooth(m_object->GetAngleX(3+4*i+0), Math::PropAngle(-tSt[ 0], -tNd[ 0], prog), time));
+ m_object->SetAngleY(3+4*i+0, Math::Smooth(m_object->GetAngleY(3+4*i+0), Math::PropAngle(-tSt[ 1], -tNd[ 1], prog), time));
+ m_object->SetAngleZ(3+4*i+0, Math::Smooth(m_object->GetAngleZ(3+4*i+0), Math::PropAngle( tSt[ 2], tNd[ 2], prog), time));
+ m_object->SetAngleX(3+4*i+1, Math::Smooth(m_object->GetAngleX(3+4*i+1), Math::PropAngle(-tSt[ 3], -tNd[ 3], prog), time));
+ m_object->SetAngleY(3+4*i+1, Math::Smooth(m_object->GetAngleY(3+4*i+1), Math::PropAngle(-tSt[ 4], -tNd[ 4], prog), time));
+ m_object->SetAngleZ(3+4*i+1, Math::Smooth(m_object->GetAngleZ(3+4*i+1), Math::PropAngle( tSt[ 5], tNd[ 5], prog), time));
+ m_object->SetAngleX(3+4*i+2, Math::Smooth(m_object->GetAngleX(3+4*i+2), Math::PropAngle(-tSt[ 6], -tNd[ 6], prog), time));
+ m_object->SetAngleY(3+4*i+2, Math::Smooth(m_object->GetAngleY(3+4*i+2), Math::PropAngle(-tSt[ 7], -tNd[ 7], prog), time));
+ m_object->SetAngleZ(3+4*i+2, Math::Smooth(m_object->GetAngleZ(3+4*i+2), Math::PropAngle( tSt[ 8], tNd[ 8], prog), time));
+ m_object->SetAngleX(3+4*i+3, Math::Smooth(m_object->GetAngleX(3+4*i+3), Math::PropAngle(-tSt[ 9], -tNd[ 9], prog), time));
+ m_object->SetAngleY(3+4*i+3, Math::Smooth(m_object->GetAngleY(3+4*i+3), Math::PropAngle(-tSt[10], -tNd[10], prog), time));
+ m_object->SetAngleZ(3+4*i+3, Math::Smooth(m_object->GetAngleZ(3+4*i+3), Math::PropAngle( tSt[11], tNd[11], prog), time));
}
}
#if ADJUST_ANGLE
- if ( m_object->RetSelect() )
+ if ( m_object->GetSelect() )
{
char s[100];
sprintf(s, "A:time=%d Q:part=%d W:member=%d", m_armTimeIndex, m_armPartIndex, m_armMemberIndex);
@@ -559,7 +559,7 @@ bool CMotionSpider::EventFrame(const Event &event)
SetInclinaison(dir);
time = event.rTime*1.0f;
- m_object->SetAngleZ(1, Math::Smooth(m_object->RetAngleZ(1), 0.0f, time)); // head
+ m_object->SetAngleZ(1, Math::Smooth(m_object->GetAngleZ(1), 0.0f, time)); // head
}
else if ( m_actionType == MSS_RUIN ) // destroyed?
{
@@ -581,17 +581,17 @@ bool CMotionSpider::EventFrame(const Event &event)
}
else if ( m_actionType == MSS_BACK1 ) // turns on the back?
{
- if ( m_lastParticule+m_engine->ParticuleAdapt(0.05f) <= m_armTimeAbs )
+ if ( m_lastParticle+m_engine->ParticleAdapt(0.05f) <= m_armTimeAbs )
{
- m_lastParticule = m_armTimeAbs;
+ m_lastParticle = m_armTimeAbs;
- pos = m_object->RetPosition(0);
+ pos = m_object->GetPosition(0);
speed.x = (Math::Rand()-0.5f)*10.0f;
speed.z = (Math::Rand()-0.5f)*10.0f;
speed.y = Math::Rand()*5.0f;
dim.x = Math::Rand()*3.0f+2.0f;
dim.y = dim.x;
- m_particule->CreateParticule(pos, speed, dim, PARTICRASH, 2.0f);
+ m_particle->CreateParticle(pos, speed, dim, Gfx::PARTICRASH, 2.0f);
}
if ( m_progress < 0.5f )
@@ -623,13 +623,13 @@ bool CMotionSpider::EventFrame(const Event &event)
}
else if ( m_actionType == MSS_BACK2 ) // moves on the back?
{
- if ( m_lastParticule+m_engine->ParticuleAdapt(0.05f) <= m_armTimeAbs )
+ if ( m_lastParticle+m_engine->ParticleAdapt(0.05f) <= m_armTimeAbs )
{
- m_lastParticule = m_armTimeAbs;
+ m_lastParticle = m_armTimeAbs;
if ( rand()%10 == 0 )
{
- pos = m_object->RetPosition(0);
+ pos = m_object->GetPosition(0);
pos.x += (Math::Rand()-0.5f)*8.0f;
pos.z += (Math::Rand()-0.5f)*8.0f;
pos.y -= 1.0f;
@@ -638,7 +638,7 @@ bool CMotionSpider::EventFrame(const Event &event)
speed.y = Math::Rand()*2.0f;
dim.x = Math::Rand()*1.0f+1.0f;
dim.y = dim.x;
- m_particule->CreateParticule(pos, speed, dim, PARTICRASH, 2.0f);
+ m_particle->CreateParticle(pos, speed, dim, Gfx::PARTICRASH, 2.0f);
}
}
@@ -672,17 +672,17 @@ bool CMotionSpider::EventFrame(const Event &event)
}
else if ( m_actionType == MSS_BACK3 ) // recovers on the legs?
{
- if ( m_lastParticule+m_engine->ParticuleAdapt(0.05f) <= m_armTimeAbs )
+ if ( m_lastParticle+m_engine->ParticleAdapt(0.05f) <= m_armTimeAbs )
{
- m_lastParticule = m_armTimeAbs;
+ m_lastParticle = m_armTimeAbs;
- pos = m_object->RetPosition(0);
+ pos = m_object->GetPosition(0);
speed.x = (Math::Rand()-0.5f)*10.0f;
speed.z = (Math::Rand()-0.5f)*10.0f;
speed.y = Math::Rand()*5.0f;
dim.x = Math::Rand()*3.0f+2.0f;
dim.y = dim.x;
- m_particule->CreateParticule(pos, speed, dim, PARTICRASH, 2.0f);
+ m_particle->CreateParticle(pos, speed, dim, Gfx::PARTICRASH, 2.0f);
}
if ( m_progress < 0.5f )
diff --git a/src/object/motion/motionspider.h b/src/object/motion/motionspider.h
index e9f052c..fbf05f9 100644
--- a/src/object/motion/motionspider.h
+++ b/src/object/motion/motionspider.h
@@ -66,6 +66,6 @@ protected:
int m_armMemberIndex;
int m_armLastAction;
bool m_bArmStop;
- float m_lastParticule;
+ float m_lastParticle;
};
diff --git a/src/object/motion/motiontoto.cpp b/src/object/motion/motiontoto.cpp
index 6d39b36..af2cf6b 100644
--- a/src/object/motion/motiontoto.cpp
+++ b/src/object/motion/motiontoto.cpp
@@ -22,9 +22,9 @@
#include "object/motion/motiontoto.h"
#include "math/geometry.h"
-#include "old/terrain.h"
-#include "old/water.h"
-#include "old/modfile.h"
+#include "graphics/engine/terrain.h"
+#include "graphics/engine/water.h"
+#include "graphics/engine/modelfile.h"
#include "object/robotmain.h"
@@ -49,7 +49,7 @@ CMotionToto::CMotionToto(CInstanceManager* iMan, CObject* object)
m_clownTime = 0.0f;
m_blinkTime = 0.0f;
m_blinkProgress = -1.0f;
- m_lastMotorParticule = 0.0f;
+ m_lastMotorParticle = 0.0f;
m_type = OBJECT_NULL;
m_mousePos = Math::Point(0.0f, 0.0f);
}
@@ -78,18 +78,18 @@ void CMotionToto::DeleteObject(bool bAll)
bool CMotionToto::Create(Math::Vector pos, float angle, ObjectType type,
float power)
{
- CModFile* pModFile;
+ Gfx::CModelFile* pModFile;
int rank;
- if ( m_engine->RetRestCreate() < 10 ) return false;
+// if ( m_engine->GetRestCreate() < 10 ) return false;
- pModFile = new CModFile(m_iMan);
+ pModFile = new Gfx::CModelFile(m_iMan);
m_object->SetType(type);
// Creates the head.
rank = m_engine->CreateObject();
- m_engine->SetObjectType(rank, TYPEVEHICULE); // this is a moving object
+ m_engine->SetObjectType(rank, Gfx::ENG_OBJTYPE_VEHICULE); // this is a moving object
m_object->SetObjectRank(0, rank);
pModFile->ReadModel("objects\\toto1.mod");
pModFile->CreateEngineObject(rank);
@@ -98,7 +98,7 @@ bool CMotionToto::Create(Math::Vector pos, float angle, ObjectType type,
// Creates mouth.
rank = m_engine->CreateObject();
- m_engine->SetObjectType(rank, TYPEDESCENDANT);
+ m_engine->SetObjectType(rank, Gfx::ENG_OBJTYPE_DESCENDANT);
m_object->SetObjectRank(1, rank);
m_object->SetObjectParent(1, 0);
pModFile->ReadModel("objects\\toto2.mod");
@@ -107,7 +107,7 @@ bool CMotionToto::Create(Math::Vector pos, float angle, ObjectType type,
// Creates the left eye.
rank = m_engine->CreateObject();
- m_engine->SetObjectType(rank, TYPEDESCENDANT);
+ m_engine->SetObjectType(rank, Gfx::ENG_OBJTYPE_DESCENDANT);
m_object->SetObjectRank(2, rank);
m_object->SetObjectParent(2, 0);
pModFile->ReadModel("objects\\toto3.mod");
@@ -118,7 +118,7 @@ bool CMotionToto::Create(Math::Vector pos, float angle, ObjectType type,
// Creates the right eye.
rank = m_engine->CreateObject();
- m_engine->SetObjectType(rank, TYPEDESCENDANT);
+ m_engine->SetObjectType(rank, Gfx::ENG_OBJTYPE_DESCENDANT);
m_object->SetObjectRank(3, rank);
m_object->SetObjectParent(3, 0);
pModFile->ReadModel("objects\\toto3.mod");
@@ -128,7 +128,7 @@ bool CMotionToto::Create(Math::Vector pos, float angle, ObjectType type,
// Creates left antenna.
rank = m_engine->CreateObject();
- m_engine->SetObjectType(rank, TYPEDESCENDANT);
+ m_engine->SetObjectType(rank, Gfx::ENG_OBJTYPE_DESCENDANT);
m_object->SetObjectRank(4, rank);
m_object->SetObjectParent(4, 0);
pModFile->ReadModel("objects\\toto4.mod");
@@ -137,7 +137,7 @@ bool CMotionToto::Create(Math::Vector pos, float angle, ObjectType type,
m_object->SetAngleX(4, 30.0f*Math::PI/180.0f);
rank = m_engine->CreateObject();
- m_engine->SetObjectType(rank, TYPEDESCENDANT);
+ m_engine->SetObjectType(rank, Gfx::ENG_OBJTYPE_DESCENDANT);
m_object->SetObjectRank(5, rank);
m_object->SetObjectParent(5, 4);
pModFile->ReadModel("objects\\toto4.mod");
@@ -146,7 +146,7 @@ bool CMotionToto::Create(Math::Vector pos, float angle, ObjectType type,
m_object->SetAngleX(5, 30.0f*Math::PI/180.0f);
rank = m_engine->CreateObject();
- m_engine->SetObjectType(rank, TYPEDESCENDANT);
+ m_engine->SetObjectType(rank, Gfx::ENG_OBJTYPE_DESCENDANT);
m_object->SetObjectRank(6, rank);
m_object->SetObjectParent(6, 5);
pModFile->ReadModel("objects\\toto5.mod");
@@ -156,7 +156,7 @@ bool CMotionToto::Create(Math::Vector pos, float angle, ObjectType type,
// Creates right antenna.
rank = m_engine->CreateObject();
- m_engine->SetObjectType(rank, TYPEDESCENDANT);
+ m_engine->SetObjectType(rank, Gfx::ENG_OBJTYPE_DESCENDANT);
m_object->SetObjectRank(7, rank);
m_object->SetObjectParent(7, 0);
pModFile->ReadModel("objects\\toto4.mod");
@@ -165,7 +165,7 @@ bool CMotionToto::Create(Math::Vector pos, float angle, ObjectType type,
m_object->SetAngleX(7, -30.0f*Math::PI/180.0f);
rank = m_engine->CreateObject();
- m_engine->SetObjectType(rank, TYPEDESCENDANT);
+ m_engine->SetObjectType(rank, Gfx::ENG_OBJTYPE_DESCENDANT);
m_object->SetObjectRank(8, rank);
m_object->SetObjectParent(8, 7);
pModFile->ReadModel("objects\\toto4.mod");
@@ -174,7 +174,7 @@ bool CMotionToto::Create(Math::Vector pos, float angle, ObjectType type,
m_object->SetAngleX(8, -30.0f*Math::PI/180.0f);
rank = m_engine->CreateObject();
- m_engine->SetObjectType(rank, TYPEDESCENDANT);
+ m_engine->SetObjectType(rank, Gfx::ENG_OBJTYPE_DESCENDANT);
m_object->SetObjectRank(9, rank);
m_object->SetObjectParent(9, 8);
pModFile->ReadModel("objects\\toto5.mod");
@@ -185,10 +185,10 @@ bool CMotionToto::Create(Math::Vector pos, float angle, ObjectType type,
m_object->SetZoom(0, 0.5f); // is little
m_object->SetFloorHeight(0.0f);
- pos = m_object->RetPosition(0);
+ pos = m_object->GetPosition(0);
m_object->SetPosition(0, pos); // to display the shadows immediately
- m_engine->LoadAllTexture();
+ m_engine->LoadAllTextures();
delete pModFile;
return true;
@@ -233,7 +233,7 @@ bool CMotionToto::EventProcess(const Event &event)
{
CMotion::EventProcess(event);
- if ( event.event == EVENT_FRAME )
+ if ( event.type == EVENT_FRAME )
{
return EventFrame(event);
}
@@ -249,15 +249,15 @@ bool CMotionToto::EventFrame(const Event &event)
Math::Vector eye, lookat, dir, perp, nPos, aPos, pos, speed;
Math::Vector vibLin, vibCir, dirSpeed, aAntenna;
Math::Point dim;
- POINT wDim;
- ParticuleType type;
+ Math::IntPoint wDim;
+ Gfx::ParticleType type;
float progress, focus, distance, shift, verti, level, zoom;
float aAngle, nAngle, mAngle, angle, linSpeed, cirSpeed;
int sheet, i, r;
bool bHidden;
- if ( m_engine->RetPause() &&
- !m_main->RetInfoLock() ) return true;
+ if ( m_engine->GetPause() &&
+ !m_main->GetInfoLock() ) return true;
if ( m_bDisplayInfo ) // "looks" mouse?
{
@@ -267,13 +267,13 @@ bool CMotionToto::EventFrame(const Event &event)
{
bHidden = false;
- if ( m_main->RetMovieLock() ) // current movie?
+ if ( m_main->GetMovieLock() ) // current movie?
{
bHidden = true;
}
- if ( !m_engine->RetTotoMode() )
+ if ( !m_engine->GetTotoMode() )
{
- if ( !m_main->RetEditLock() ) // current edition?
+ if ( !m_main->GetEditLock() ) // current edition?
{
bHidden = true;
}
@@ -282,8 +282,8 @@ bool CMotionToto::EventFrame(const Event &event)
if ( bHidden )
{
- nPos = m_object->RetPosition(0);
- m_terrain->MoveOnFloor(nPos, true);
+ nPos = m_object->GetPosition(0);
+ m_terrain->AdjustToFloor(nPos, true);
nPos.y -= 100.0f; // hidden under the ground!
m_object->SetPosition(0, nPos);
return true;
@@ -319,9 +319,9 @@ bool CMotionToto::EventFrame(const Event &event)
m_clownDelay = 0.0f;
}
- focus = m_engine->RetFocus();
- eye = m_engine->RetEyePt();
- lookat = m_engine->RetLookatPt();
+ focus = m_engine->GetFocus();
+ eye = m_engine->GetEyePt();
+ lookat = m_engine->GetLookatPt();
vibLin = Math::Vector(0.0f, 0.0f, 0.0f);
vibCir = Math::Vector(0.0f, 0.0f, 0.0f);
@@ -331,8 +331,8 @@ bool CMotionToto::EventFrame(const Event &event)
// Calculates the new position.
if ( m_bDisplayInfo )
{
- wDim = m_engine->RetDim();
- nPos.x = -4.0f*((float)wDim.x/(float)wDim.y)/(640.0f/480.0f);
+ wDim = m_engine->GetWindowSize();
+ nPos.x = -4.0f*(static_cast< float >(wDim.x)/static_cast< float >(wDim.y))/(640.0f/480.0f);
nPos.y = -0.5f;
nPos.z = 7.0f; // in the left margin
@@ -394,8 +394,8 @@ bool CMotionToto::EventFrame(const Event &event)
m_clownRadius = 0.0f;
m_clownDelay = 2.0f+Math::Rand()*2.0f;
}
- pos = m_object->RetPosition(0);
- if ( pos.y < m_water->RetLevel() ) // underwater?
+ pos = m_object->GetPosition(0);
+ if ( pos.y < m_water->GetLevel() ) // underwater?
{
m_clownRadius /= 1.5f;
m_clownDelay *= 2.0f;
@@ -432,7 +432,7 @@ bool CMotionToto::EventFrame(const Event &event)
}
else
{
- aPos = m_object->RetPosition(0);
+ aPos = m_object->GetPosition(0);
if ( m_actionType == -1 )
{
level = 4.0f;
@@ -468,7 +468,7 @@ bool CMotionToto::EventFrame(const Event &event)
}
level = Math::Min(linSpeed*0.1f, 1.0f);
nAngle = nAngle*(1.0f-level) + mAngle*level;
- aAngle = Math::NormAngle(m_object->RetAngleY(0));
+ aAngle = Math::NormAngle(m_object->GetAngleY(0));
if ( nAngle < aAngle )
{
@@ -579,7 +579,7 @@ bool CMotionToto::EventFrame(const Event &event)
else
{
nPos.y += vibLin.y;
- level = m_terrain->RetFloorLevel(nPos);
+ level = m_terrain->GetFloorLevel(nPos);
if ( nPos.y < level+2.0f )
{
nPos.y = level+2.0f; // just above the ground
@@ -717,19 +717,19 @@ bool CMotionToto::EventFrame(const Event &event)
m_object->SetAngleX(3, 0.0f);
}
- mat = m_object->RetWorldMatrix(0); // must be done every time!
+ mat = m_object->GetWorldMatrix(0); // must be done every time!
// Generates particles.
- if ( m_time-m_lastMotorParticule >= m_engine->ParticuleAdapt(0.05f) )
+ if ( m_time-m_lastMotorParticle >= m_engine->ParticleAdapt(0.05f) )
{
- m_lastMotorParticule = m_time;
+ m_lastMotorParticle = m_time;
- if ( m_bDisplayInfo ) sheet = SH_FRONT;
- else sheet = SH_WORLD;
+ if ( m_bDisplayInfo ) sheet = Gfx::SH_FRONT;
+ else sheet = Gfx::SH_WORLD;
- pos = m_object->RetPosition(0);
+ pos = m_object->GetPosition(0);
if ( !m_bDisplayInfo &&
- pos.y < m_water->RetLevel() ) // underwater?
+ pos.y < m_water->GetLevel() ) // underwater?
{
float t = Math::Mod(m_time, 3.5f);
if ( t >= 2.2f || ( t >= 1.2f && t <= 1.4f ) ) // breathe?
@@ -747,7 +747,7 @@ bool CMotionToto::EventFrame(const Event &event)
dim.x = 0.12f;
dim.y = dim.x;
- m_particule->CreateParticule(pos, speed, dim, PARTIBUBBLE, 3.0f, 0.0f, 0.0f);
+ m_particle->CreateParticle(pos, speed, dim, Gfx::PARTIBUBBLE, 3.0f, 0.0f, 0.0f);
}
}
else // out of water?
@@ -760,13 +760,13 @@ bool CMotionToto::EventFrame(const Event &event)
speed.x += (Math::Rand()-0.5f)*2.0f;
speed.z += (Math::Rand()-0.5f)*2.0f;
-// mat = m_object->RetWorldMatrix(0);
+// mat = m_object->GetWorldMatrix(0);
pos = Transform(*mat, pos);
speed = Transform(*mat, speed)-pos;
dim.x = (Math::Rand()*0.4f+0.4f)*(1.0f+Math::Min(linSpeed*0.1f, 5.0f));
dim.y = dim.x;
- m_particule->CreateParticule(pos, speed, dim, PARTITOTO, 1.0f+Math::Rand()*1.0f, 0.0f, 1.0f, sheet);
+ m_particle->CreateParticle(pos, speed, dim, Gfx::PARTITOTO, 1.0f+Math::Rand()*1.0f, 0.0f, 1.0f, sheet);
}
if ( m_actionType != -1 && // current action?
@@ -779,21 +779,21 @@ bool CMotionToto::EventFrame(const Event &event)
speed = Math::Vector(0.0f, 0.0f, 0.0f);
dim.x = (Math::Rand()*0.3f+0.3f);
dim.y = dim.x;
- if ( m_actionType == MT_ERROR ) type = PARTIERROR;
- if ( m_actionType == MT_WARNING ) type = PARTIWARNING;
- if ( m_actionType == MT_INFO ) type = PARTIINFO;
- if ( m_actionType == MT_MESSAGE ) type = PARTIWARNING;
- m_particule->CreateParticule(pos, speed, dim, type, 0.5f+Math::Rand()*0.5f, 0.0f, 1.0f, sheet);
+ if ( m_actionType == MT_ERROR ) type = Gfx::PARTIERROR;
+ if ( m_actionType == MT_WARNING ) type = Gfx::PARTIWARNING;
+ if ( m_actionType == MT_INFO ) type = Gfx::PARTIINFO;
+ if ( m_actionType == MT_MESSAGE ) type = Gfx::PARTIWARNING;
+ m_particle->CreateParticle(pos, speed, dim, type, 0.5f+Math::Rand()*0.5f, 0.0f, 1.0f, sheet);
pos.x = 0.50f+(Math::Rand()-0.5f)*0.80f;
pos.y = 0.86f+(Math::Rand()-0.5f)*0.08f;
pos.z = 0.00f;
dim.x = (Math::Rand()*0.04f+0.04f);
dim.y = dim.x/0.75f;
- m_particule->CreateParticule(pos, speed, dim, type, 0.5f+Math::Rand()*0.5f, 0.0f, 1.0f, SH_INTERFACE);
+ m_particle->CreateParticle(pos, speed, dim, type, 0.5f+Math::Rand()*0.5f, 0.0f, 1.0f, Gfx::SH_INTERFACE);
}
-//? if ( m_bDisplayInfo && m_main->RetGlint() )
+//? if ( m_bDisplayInfo && m_main->GetGlint() )
if ( false )
{
pos.x = (Math::Rand()-0.5f)*1.4f;
@@ -803,7 +803,7 @@ bool CMotionToto::EventFrame(const Event &event)
speed = Math::Vector(0.0f, 0.0f, 0.0f);
dim.x = (Math::Rand()*0.5f+0.5f);
dim.y = dim.x;
- m_particule->CreateParticule(pos, speed, dim, PARTIERROR, 0.5f+Math::Rand()*0.5f, 0.0f, 1.0f, sheet);
+ m_particle->CreateParticle(pos, speed, dim, Gfx::PARTIERROR, 0.5f+Math::Rand()*0.5f, 0.0f, 1.0f, sheet);
for ( i=0 ; i<10 ; i++ )
{
@@ -817,7 +817,7 @@ bool CMotionToto::EventFrame(const Event &event)
else pos.y = 0.92f; // on the upper edge
dim.x = (Math::Rand()*0.02f+0.02f);
dim.y = dim.x/0.75f;
- m_particule->CreateParticule(pos, speed, dim, PARTIERROR, 0.5f+Math::Rand()*0.5f, 0.0f, 1.0f, SH_INTERFACE);
+ m_particle->CreateParticle(pos, speed, dim, Gfx::PARTIERROR, 0.5f+Math::Rand()*0.5f, 0.0f, 1.0f, Gfx::SH_INTERFACE);
}
}
}
@@ -825,7 +825,7 @@ bool CMotionToto::EventFrame(const Event &event)
// Move the sound.
if ( m_soundChannel != -1 )
{
- if ( !m_sound->Position(m_soundChannel, m_object->RetPosition(0)) )
+ if ( !m_sound->Position(m_soundChannel, m_object->GetPosition(0)) )
{
m_soundChannel = -1;
}
@@ -853,7 +853,7 @@ Error CMotionToto::SetAction(int action, float time)
if ( sound != SOUND_CLICK )
{
- m_soundChannel = m_sound->Play(sound, m_object->RetPosition(0));
+ m_soundChannel = m_sound->Play(sound, m_object->GetPosition(0));
}
return ERR_OK;
diff --git a/src/object/motion/motiontoto.h b/src/object/motion/motiontoto.h
index 9df2d99..4072b62 100644
--- a/src/object/motion/motiontoto.h
+++ b/src/object/motion/motiontoto.h
@@ -53,7 +53,7 @@ protected:
protected:
float m_time;
- float m_lastMotorParticule;
+ float m_lastMotorParticle;
bool m_bDisplayInfo;
bool m_bQuickPos;
bool m_bStartAction;
diff --git a/src/object/motion/motionvehicle.cpp b/src/object/motion/motionvehicle.cpp
index ff05695..1a4b98f 100644
--- a/src/object/motion/motionvehicle.cpp
+++ b/src/object/motion/motionvehicle.cpp
@@ -17,17 +17,17 @@
// motionvehicle.cpp
-#include <stdio.h>
-
#include "object/motion/motionvehicle.h"
-#include "old/modfile.h"
-#include "old/particule.h"
-#include "old/terrain.h"
+#include "graphics/engine/modelfile.h"
+#include "graphics/engine/particle.h"
+#include "graphics/engine/terrain.h"
#include "math/geometry.h"
#include "object/brain.h"
#include "physics/physics.h"
+#include <stdio.h>
+#include <string.h>
@@ -78,7 +78,7 @@ void CMotionVehicle::DeleteObject(bool bAll)
{
if ( m_partiReactor != -1 )
{
- m_particule->DeleteParticule(m_partiReactor);
+ m_particle->DeleteParticle(m_partiReactor);
m_partiReactor = -1;
}
}
@@ -89,21 +89,21 @@ void CMotionVehicle::DeleteObject(bool bAll)
bool CMotionVehicle::Create(Math::Vector pos, float angle, ObjectType type,
float power)
{
- CModFile* pModFile;
+ Gfx::CModelFile* pModFile;
CObject* pPower;
int rank, i, j, parent;
- D3DCOLORVALUE color;
+ Gfx::Color color;
char name[50];
- if ( m_engine->RetRestCreate() < 1+5+18+1 ) return false;
+// if ( m_engine->GetRestCreate() < 1+5+18+1 ) return false;
- pModFile = new CModFile(m_iMan);
+ pModFile = new Gfx::CModelFile(m_iMan);
m_object->SetType(type);
// Creates the main base.
rank = m_engine->CreateObject();
- m_engine->SetObjectType(rank, TYPEVEHICULE); // this is a moving object
+ m_engine->SetObjectType(rank, Gfx::ENG_OBJTYPE_VEHICULE); // this is a moving object
m_object->SetObjectRank(0, rank);
if ( type == OBJECT_MOBILEfa ||
@@ -125,7 +125,7 @@ bool CMotionVehicle::Create(Math::Vector pos, float angle, ObjectType type,
type == OBJECT_MOBILEwi ||
type == OBJECT_MOBILEws )
{
- if ( m_object->RetTrainer() )
+ if ( m_object->GetTrainer() )
{
pModFile->ReadModel("objects\\lem1wt.mod");
}
@@ -222,7 +222,7 @@ bool CMotionVehicle::Create(Math::Vector pos, float angle, ObjectType type,
{
// Creates the arm.
rank = m_engine->CreateObject();
- m_engine->SetObjectType(rank, TYPEDESCENDANT);
+ m_engine->SetObjectType(rank, Gfx::ENG_OBJTYPE_DESCENDANT);
m_object->SetObjectRank(1, rank);
m_object->SetObjectParent(1, 0);
pModFile->ReadModel("objects\\lem2.mod");
@@ -232,7 +232,7 @@ bool CMotionVehicle::Create(Math::Vector pos, float angle, ObjectType type,
// Creates the forearm.
rank = m_engine->CreateObject();
- m_engine->SetObjectType(rank, TYPEDESCENDANT);
+ m_engine->SetObjectType(rank, Gfx::ENG_OBJTYPE_DESCENDANT);
m_object->SetObjectRank(2, rank);
m_object->SetObjectParent(2, 1);
pModFile->ReadModel("objects\\lem3.mod");
@@ -242,7 +242,7 @@ bool CMotionVehicle::Create(Math::Vector pos, float angle, ObjectType type,
// Creates the hand.
rank = m_engine->CreateObject();
- m_engine->SetObjectType(rank, TYPEDESCENDANT);
+ m_engine->SetObjectType(rank, Gfx::ENG_OBJTYPE_DESCENDANT);
m_object->SetObjectRank(3, rank);
m_object->SetObjectParent(3, 2);
pModFile->ReadModel("objects\\lem4.mod");
@@ -253,7 +253,7 @@ bool CMotionVehicle::Create(Math::Vector pos, float angle, ObjectType type,
// Creates the close clamp.
rank = m_engine->CreateObject();
- m_engine->SetObjectType(rank, TYPEDESCENDANT);
+ m_engine->SetObjectType(rank, Gfx::ENG_OBJTYPE_DESCENDANT);
m_object->SetObjectRank(4, rank);
m_object->SetObjectParent(4, 3);
pModFile->ReadModel("objects\\lem5.mod");
@@ -263,7 +263,7 @@ bool CMotionVehicle::Create(Math::Vector pos, float angle, ObjectType type,
// Creates the remote clamp.
rank = m_engine->CreateObject();
- m_engine->SetObjectType(rank, TYPEDESCENDANT);
+ m_engine->SetObjectType(rank, Gfx::ENG_OBJTYPE_DESCENDANT);
m_object->SetObjectRank(5, rank);
m_object->SetObjectParent(5, 3);
pModFile->ReadModel("objects\\lem6.mod");
@@ -279,7 +279,7 @@ bool CMotionVehicle::Create(Math::Vector pos, float angle, ObjectType type,
{
// Creates the arm.
rank = m_engine->CreateObject();
- m_engine->SetObjectType(rank, TYPEDESCENDANT);
+ m_engine->SetObjectType(rank, Gfx::ENG_OBJTYPE_DESCENDANT);
m_object->SetObjectRank(1, rank);
m_object->SetObjectParent(1, 0);
pModFile->ReadModel("objects\\lem2.mod");
@@ -289,7 +289,7 @@ bool CMotionVehicle::Create(Math::Vector pos, float angle, ObjectType type,
// Creates the forearm.
rank = m_engine->CreateObject();
- m_engine->SetObjectType(rank, TYPEDESCENDANT);
+ m_engine->SetObjectType(rank, Gfx::ENG_OBJTYPE_DESCENDANT);
m_object->SetObjectRank(2, rank);
m_object->SetObjectParent(2, 1);
pModFile->ReadModel("objects\\lem3.mod");
@@ -299,7 +299,7 @@ bool CMotionVehicle::Create(Math::Vector pos, float angle, ObjectType type,
// Creates the sensor.
rank = m_engine->CreateObject();
- m_engine->SetObjectType(rank, TYPEDESCENDANT);
+ m_engine->SetObjectType(rank, Gfx::ENG_OBJTYPE_DESCENDANT);
m_object->SetObjectRank(3, rank);
m_object->SetObjectParent(3, 2);
pModFile->ReadModel("objects\\lem4s.mod");
@@ -315,7 +315,7 @@ bool CMotionVehicle::Create(Math::Vector pos, float angle, ObjectType type,
{
// Creates the cannon.
rank = m_engine->CreateObject();
- m_engine->SetObjectType(rank, TYPEDESCENDANT);
+ m_engine->SetObjectType(rank, Gfx::ENG_OBJTYPE_DESCENDANT);
m_object->SetObjectRank(1, rank);
m_object->SetObjectParent(1, 0);
pModFile->ReadModel("objects\\canon.mod");
@@ -332,7 +332,7 @@ bool CMotionVehicle::Create(Math::Vector pos, float angle, ObjectType type,
{
// Creates the insect cannon.
rank = m_engine->CreateObject();
- m_engine->SetObjectType(rank, TYPEDESCENDANT);
+ m_engine->SetObjectType(rank, Gfx::ENG_OBJTYPE_DESCENDANT);
m_object->SetObjectRank(1, rank);
m_object->SetObjectParent(1, 0);
pModFile->ReadModel("objects\\canoni1.mod");
@@ -341,7 +341,7 @@ bool CMotionVehicle::Create(Math::Vector pos, float angle, ObjectType type,
m_object->SetAngleZ(1, 0.0f);
rank = m_engine->CreateObject();
- m_engine->SetObjectType(rank, TYPEDESCENDANT);
+ m_engine->SetObjectType(rank, Gfx::ENG_OBJTYPE_DESCENDANT);
m_object->SetObjectRank(2, rank);
m_object->SetObjectParent(2, 1);
pModFile->ReadModel("objects\\canoni2.mod");
@@ -358,7 +358,7 @@ bool CMotionVehicle::Create(Math::Vector pos, float angle, ObjectType type,
{
// Creates the right-back wheel.
rank = m_engine->CreateObject();
- m_engine->SetObjectType(rank, TYPEDESCENDANT);
+ m_engine->SetObjectType(rank, Gfx::ENG_OBJTYPE_DESCENDANT);
m_object->SetObjectRank(6, rank);
m_object->SetObjectParent(6, 0);
pModFile->ReadModel("objects\\lem2w.mod");
@@ -367,7 +367,7 @@ bool CMotionVehicle::Create(Math::Vector pos, float angle, ObjectType type,
// Creates the left-back wheel.
rank = m_engine->CreateObject();
- m_engine->SetObjectType(rank, TYPEDESCENDANT);
+ m_engine->SetObjectType(rank, Gfx::ENG_OBJTYPE_DESCENDANT);
m_object->SetObjectRank(7, rank);
m_object->SetObjectParent(7, 0);
pModFile->ReadModel("objects\\lem2w.mod");
@@ -377,7 +377,7 @@ bool CMotionVehicle::Create(Math::Vector pos, float angle, ObjectType type,
// Creates the right-front wheel.
rank = m_engine->CreateObject();
- m_engine->SetObjectType(rank, TYPEDESCENDANT);
+ m_engine->SetObjectType(rank, Gfx::ENG_OBJTYPE_DESCENDANT);
m_object->SetObjectRank(8, rank);
m_object->SetObjectParent(8, 0);
pModFile->ReadModel("objects\\lem2w.mod");
@@ -386,7 +386,7 @@ bool CMotionVehicle::Create(Math::Vector pos, float angle, ObjectType type,
// Creates the left-front wheel.
rank = m_engine->CreateObject();
- m_engine->SetObjectType(rank, TYPEDESCENDANT);
+ m_engine->SetObjectType(rank, Gfx::ENG_OBJTYPE_DESCENDANT);
m_object->SetObjectRank(9, rank);
m_object->SetObjectParent(9, 0);
pModFile->ReadModel("objects\\lem2w.mod");
@@ -399,7 +399,7 @@ bool CMotionVehicle::Create(Math::Vector pos, float angle, ObjectType type,
{
// Creates the right-back wheel.
rank = m_engine->CreateObject();
- m_engine->SetObjectType(rank, TYPEDESCENDANT);
+ m_engine->SetObjectType(rank, Gfx::ENG_OBJTYPE_DESCENDANT);
m_object->SetObjectRank(6, rank);
m_object->SetObjectParent(6, 0);
pModFile->ReadModel("objects\\lem2w.mod");
@@ -408,7 +408,7 @@ bool CMotionVehicle::Create(Math::Vector pos, float angle, ObjectType type,
// Creates the left-back wheel.
rank = m_engine->CreateObject();
- m_engine->SetObjectType(rank, TYPEDESCENDANT);
+ m_engine->SetObjectType(rank, Gfx::ENG_OBJTYPE_DESCENDANT);
m_object->SetObjectRank(7, rank);
m_object->SetObjectParent(7, 0);
pModFile->ReadModel("objects\\lem2w.mod");
@@ -418,7 +418,7 @@ bool CMotionVehicle::Create(Math::Vector pos, float angle, ObjectType type,
// Creates the right-front wheel.
rank = m_engine->CreateObject();
- m_engine->SetObjectType(rank, TYPEDESCENDANT);
+ m_engine->SetObjectType(rank, Gfx::ENG_OBJTYPE_DESCENDANT);
m_object->SetObjectRank(8, rank);
m_object->SetObjectParent(8, 0);
pModFile->ReadModel("objects\\lem2w.mod");
@@ -427,7 +427,7 @@ bool CMotionVehicle::Create(Math::Vector pos, float angle, ObjectType type,
// Creates the left-front wheel.
rank = m_engine->CreateObject();
- m_engine->SetObjectType(rank, TYPEDESCENDANT);
+ m_engine->SetObjectType(rank, Gfx::ENG_OBJTYPE_DESCENDANT);
m_object->SetObjectRank(9, rank);
m_object->SetObjectParent(9, 0);
pModFile->ReadModel("objects\\lem2w.mod");
@@ -443,7 +443,7 @@ bool CMotionVehicle::Create(Math::Vector pos, float angle, ObjectType type,
{
// Creates the right caterpillar.
rank = m_engine->CreateObject();
- m_engine->SetObjectType(rank, TYPEDESCENDANT);
+ m_engine->SetObjectType(rank, Gfx::ENG_OBJTYPE_DESCENDANT);
m_object->SetObjectRank(6, rank);
m_object->SetObjectParent(6, 0);
pModFile->ReadModel("objects\\lem2t.mod");
@@ -452,7 +452,7 @@ bool CMotionVehicle::Create(Math::Vector pos, float angle, ObjectType type,
// Creates the left caterpillar.
rank = m_engine->CreateObject();
- m_engine->SetObjectType(rank, TYPEDESCENDANT);
+ m_engine->SetObjectType(rank, Gfx::ENG_OBJTYPE_DESCENDANT);
m_object->SetObjectRank(7, rank);
m_object->SetObjectParent(7, 0);
pModFile->ReadModel("objects\\lem3t.mod");
@@ -467,7 +467,7 @@ bool CMotionVehicle::Create(Math::Vector pos, float angle, ObjectType type,
{
// Creates the right caterpillar.
rank = m_engine->CreateObject();
- m_engine->SetObjectType(rank, TYPEDESCENDANT);
+ m_engine->SetObjectType(rank, Gfx::ENG_OBJTYPE_DESCENDANT);
m_object->SetObjectRank(6, rank);
m_object->SetObjectParent(6, 0);
pModFile->ReadModel("objects\\roller2.mod");
@@ -476,7 +476,7 @@ bool CMotionVehicle::Create(Math::Vector pos, float angle, ObjectType type,
// Creates the left caterpillar.
rank = m_engine->CreateObject();
- m_engine->SetObjectType(rank, TYPEDESCENDANT);
+ m_engine->SetObjectType(rank, Gfx::ENG_OBJTYPE_DESCENDANT);
m_object->SetObjectRank(7, rank);
m_object->SetObjectParent(7, 0);
pModFile->ReadModel("objects\\roller3.mod");
@@ -488,7 +488,7 @@ bool CMotionVehicle::Create(Math::Vector pos, float angle, ObjectType type,
{
// Creates the right caterpillar.
rank = m_engine->CreateObject();
- m_engine->SetObjectType(rank, TYPEDESCENDANT);
+ m_engine->SetObjectType(rank, Gfx::ENG_OBJTYPE_DESCENDANT);
m_object->SetObjectRank(6, rank);
m_object->SetObjectParent(6, 0);
pModFile->ReadModel("objects\\subm4.mod");
@@ -497,7 +497,7 @@ bool CMotionVehicle::Create(Math::Vector pos, float angle, ObjectType type,
// Creates the left caterpillar.
rank = m_engine->CreateObject();
- m_engine->SetObjectType(rank, TYPEDESCENDANT);
+ m_engine->SetObjectType(rank, Gfx::ENG_OBJTYPE_DESCENDANT);
m_object->SetObjectRank(7, rank);
m_object->SetObjectParent(7, 0);
pModFile->ReadModel("objects\\subm5.mod");
@@ -509,7 +509,7 @@ bool CMotionVehicle::Create(Math::Vector pos, float angle, ObjectType type,
{
// Creates the right caterpillar.
rank = m_engine->CreateObject();
- m_engine->SetObjectType(rank, TYPEDESCENDANT);
+ m_engine->SetObjectType(rank, Gfx::ENG_OBJTYPE_DESCENDANT);
m_object->SetObjectRank(6, rank);
m_object->SetObjectParent(6, 0);
pModFile->ReadModel("objects\\drawer2.mod");
@@ -518,7 +518,7 @@ bool CMotionVehicle::Create(Math::Vector pos, float angle, ObjectType type,
// Creates the left caterpillar.
rank = m_engine->CreateObject();
- m_engine->SetObjectType(rank, TYPEDESCENDANT);
+ m_engine->SetObjectType(rank, Gfx::ENG_OBJTYPE_DESCENDANT);
m_object->SetObjectRank(7, rank);
m_object->SetObjectParent(7, 0);
pModFile->ReadModel("objects\\drawer3.mod");
@@ -534,7 +534,7 @@ bool CMotionVehicle::Create(Math::Vector pos, float angle, ObjectType type,
{
// Creates the front foot.
rank = m_engine->CreateObject();
- m_engine->SetObjectType(rank, TYPEDESCENDANT);
+ m_engine->SetObjectType(rank, Gfx::ENG_OBJTYPE_DESCENDANT);
m_object->SetObjectRank(6, rank);
m_object->SetObjectParent(6, 0);
pModFile->ReadModel("objects\\lem2f.mod");
@@ -543,7 +543,7 @@ bool CMotionVehicle::Create(Math::Vector pos, float angle, ObjectType type,
// Creates the right-back foot.
rank = m_engine->CreateObject();
- m_engine->SetObjectType(rank, TYPEDESCENDANT);
+ m_engine->SetObjectType(rank, Gfx::ENG_OBJTYPE_DESCENDANT);
m_object->SetObjectRank(7, rank);
m_object->SetObjectParent(7, 0);
pModFile->ReadModel("objects\\lem2f.mod");
@@ -553,7 +553,7 @@ bool CMotionVehicle::Create(Math::Vector pos, float angle, ObjectType type,
// Creates the left-back foot.
rank = m_engine->CreateObject();
- m_engine->SetObjectType(rank, TYPEDESCENDANT);
+ m_engine->SetObjectType(rank, Gfx::ENG_OBJTYPE_DESCENDANT);
m_object->SetObjectRank(8, rank);
m_object->SetObjectParent(8, 0);
pModFile->ReadModel("objects\\lem2f.mod");
@@ -591,7 +591,7 @@ bool CMotionVehicle::Create(Math::Vector pos, float angle, ObjectType type,
// Creates the right leg.
rank = m_engine->CreateObject();
- m_engine->SetObjectType(rank, TYPEDESCENDANT);
+ m_engine->SetObjectType(rank, Gfx::ENG_OBJTYPE_DESCENDANT);
m_object->SetObjectRank(6+i*3+j, rank);
if ( j == 0 ) parent = 0;
else parent = 6+i*3+j-1;
@@ -605,7 +605,7 @@ bool CMotionVehicle::Create(Math::Vector pos, float angle, ObjectType type,
// Creates the left leg.
rank = m_engine->CreateObject();
- m_engine->SetObjectType(rank, TYPEDESCENDANT);
+ m_engine->SetObjectType(rank, Gfx::ENG_OBJTYPE_DESCENDANT);
m_object->SetObjectRank(15+i*3+j, rank);
if ( j == 0 ) parent = 0;
else parent = 15+i*3+j-1;
@@ -625,7 +625,7 @@ bool CMotionVehicle::Create(Math::Vector pos, float angle, ObjectType type,
{
// Creates the holder.
rank = m_engine->CreateObject();
- m_engine->SetObjectType(rank, TYPEDESCENDANT);
+ m_engine->SetObjectType(rank, Gfx::ENG_OBJTYPE_DESCENDANT);
m_object->SetObjectRank(1, rank);
m_object->SetObjectParent(1, 0);
pModFile->ReadModel("objects\\roller2t.mod");
@@ -635,7 +635,7 @@ bool CMotionVehicle::Create(Math::Vector pos, float angle, ObjectType type,
// Creates the pestle.
rank = m_engine->CreateObject();
- m_engine->SetObjectType(rank, TYPEDESCENDANT);
+ m_engine->SetObjectType(rank, Gfx::ENG_OBJTYPE_DESCENDANT);
m_object->SetObjectRank(2, rank);
m_object->SetObjectParent(2, 0);
pModFile->ReadModel("objects\\roller3t.mod");
@@ -648,7 +648,7 @@ bool CMotionVehicle::Create(Math::Vector pos, float angle, ObjectType type,
{
// Creates the holder.
rank = m_engine->CreateObject();
- m_engine->SetObjectType(rank, TYPEDESCENDANT);
+ m_engine->SetObjectType(rank, Gfx::ENG_OBJTYPE_DESCENDANT);
m_object->SetObjectRank(1, rank);
m_object->SetObjectParent(1, 0);
pModFile->ReadModel("objects\\roller2c.mod");
@@ -658,7 +658,7 @@ bool CMotionVehicle::Create(Math::Vector pos, float angle, ObjectType type,
// Creates the cannon.
rank = m_engine->CreateObject();
- m_engine->SetObjectType(rank, TYPEDESCENDANT);
+ m_engine->SetObjectType(rank, Gfx::ENG_OBJTYPE_DESCENDANT);
m_object->SetObjectRank(2, rank);
m_object->SetObjectParent(2, 0);
pModFile->ReadModel("objects\\roller3p.mod");
@@ -671,7 +671,7 @@ bool CMotionVehicle::Create(Math::Vector pos, float angle, ObjectType type,
{
// Creates the holder.
rank = m_engine->CreateObject();
- m_engine->SetObjectType(rank, TYPEDESCENDANT);
+ m_engine->SetObjectType(rank, Gfx::ENG_OBJTYPE_DESCENDANT);
m_object->SetObjectRank(1, rank);
m_object->SetObjectParent(1, 0);
pModFile->ReadModel("objects\\recover1.mod");
@@ -680,7 +680,7 @@ bool CMotionVehicle::Create(Math::Vector pos, float angle, ObjectType type,
// Creates the right arm.
rank = m_engine->CreateObject();
- m_engine->SetObjectType(rank, TYPEDESCENDANT);
+ m_engine->SetObjectType(rank, Gfx::ENG_OBJTYPE_DESCENDANT);
m_object->SetObjectRank(2, rank);
m_object->SetObjectParent(2, 1);
pModFile->ReadModel("objects\\recover2.mod");
@@ -690,7 +690,7 @@ bool CMotionVehicle::Create(Math::Vector pos, float angle, ObjectType type,
// Creates the right forearm.
rank = m_engine->CreateObject();
- m_engine->SetObjectType(rank, TYPEDESCENDANT);
+ m_engine->SetObjectType(rank, Gfx::ENG_OBJTYPE_DESCENDANT);
m_object->SetObjectRank(3, rank);
m_object->SetObjectParent(3, 2);
pModFile->ReadModel("objects\\recover3.mod");
@@ -700,7 +700,7 @@ bool CMotionVehicle::Create(Math::Vector pos, float angle, ObjectType type,
// Creates the left arm.
rank = m_engine->CreateObject();
- m_engine->SetObjectType(rank, TYPEDESCENDANT);
+ m_engine->SetObjectType(rank, Gfx::ENG_OBJTYPE_DESCENDANT);
m_object->SetObjectRank(4, rank);
m_object->SetObjectParent(4, 1);
pModFile->ReadModel("objects\\recover2.mod");
@@ -711,7 +711,7 @@ bool CMotionVehicle::Create(Math::Vector pos, float angle, ObjectType type,
// Creates the left forearm.
rank = m_engine->CreateObject();
- m_engine->SetObjectType(rank, TYPEDESCENDANT);
+ m_engine->SetObjectType(rank, Gfx::ENG_OBJTYPE_DESCENDANT);
m_object->SetObjectRank(5, rank);
m_object->SetObjectParent(5, 4);
pModFile->ReadModel("objects\\recover3.mod");
@@ -725,7 +725,7 @@ bool CMotionVehicle::Create(Math::Vector pos, float angle, ObjectType type,
{
// Creates the holder.
rank = m_engine->CreateObject();
- m_engine->SetObjectType(rank, TYPEDESCENDANT);
+ m_engine->SetObjectType(rank, Gfx::ENG_OBJTYPE_DESCENDANT);
m_object->SetObjectRank(1, rank);
m_object->SetObjectParent(1, 0);
pModFile->ReadModel("objects\\roller2s.mod");
@@ -735,7 +735,7 @@ bool CMotionVehicle::Create(Math::Vector pos, float angle, ObjectType type,
// Creates the intermediate piston.
rank = m_engine->CreateObject();
- m_engine->SetObjectType(rank, TYPEDESCENDANT);
+ m_engine->SetObjectType(rank, Gfx::ENG_OBJTYPE_DESCENDANT);
m_object->SetObjectRank(2, rank);
m_object->SetObjectParent(2, 1);
pModFile->ReadModel("objects\\roller3s.mod");
@@ -745,7 +745,7 @@ bool CMotionVehicle::Create(Math::Vector pos, float angle, ObjectType type,
// Creates the piston with the sphere.
rank = m_engine->CreateObject();
- m_engine->SetObjectType(rank, TYPEDESCENDANT);
+ m_engine->SetObjectType(rank, Gfx::ENG_OBJTYPE_DESCENDANT);
m_object->SetObjectRank(3, rank);
m_object->SetObjectParent(3, 2);
pModFile->ReadModel("objects\\roller4s.mod");
@@ -758,7 +758,7 @@ bool CMotionVehicle::Create(Math::Vector pos, float angle, ObjectType type,
{
// Creates the holder.
rank = m_engine->CreateObject();
- m_engine->SetObjectType(rank, TYPEDESCENDANT);
+ m_engine->SetObjectType(rank, Gfx::ENG_OBJTYPE_DESCENDANT);
m_object->SetObjectRank(1, rank);
m_object->SetObjectParent(1, 0);
pModFile->ReadModel("objects\\subm2.mod");
@@ -767,7 +767,7 @@ bool CMotionVehicle::Create(Math::Vector pos, float angle, ObjectType type,
// Creates the right tong.
rank = m_engine->CreateObject();
- m_engine->SetObjectType(rank, TYPEDESCENDANT);
+ m_engine->SetObjectType(rank, Gfx::ENG_OBJTYPE_DESCENDANT);
m_object->SetObjectRank(2, rank);
m_object->SetObjectParent(2, 1);
pModFile->ReadModel("objects\\subm3.mod");
@@ -776,7 +776,7 @@ bool CMotionVehicle::Create(Math::Vector pos, float angle, ObjectType type,
// Creates the left tong.
rank = m_engine->CreateObject();
- m_engine->SetObjectType(rank, TYPEDESCENDANT);
+ m_engine->SetObjectType(rank, Gfx::ENG_OBJTYPE_DESCENDANT);
m_object->SetObjectRank(3, rank);
m_object->SetObjectParent(3, 1);
pModFile->ReadModel("objects\\subm3.mod");
@@ -789,7 +789,7 @@ bool CMotionVehicle::Create(Math::Vector pos, float angle, ObjectType type,
{
// Creates the carousel.
rank = m_engine->CreateObject();
- m_engine->SetObjectType(rank, TYPEDESCENDANT);
+ m_engine->SetObjectType(rank, Gfx::ENG_OBJTYPE_DESCENDANT);
m_object->SetObjectRank(1, rank);
m_object->SetObjectParent(1, 0);
pModFile->ReadModel("objects\\drawer4.mod");
@@ -797,10 +797,10 @@ bool CMotionVehicle::Create(Math::Vector pos, float angle, ObjectType type,
m_object->SetPosition(1, Math::Vector(-3.0f, 3.0f, 0.0f));
// Creates the key.
- if ( m_object->RetToy() )
+ if ( m_object->GetToy() )
{
rank = m_engine->CreateObject();
- m_engine->SetObjectType(rank, TYPEDESCENDANT);
+ m_engine->SetObjectType(rank, Gfx::ENG_OBJTYPE_DESCENDANT);
m_object->SetObjectRank(2, rank);
m_object->SetObjectParent(2, 0);
pModFile->ReadModel("objects\\drawer5.mod");
@@ -814,7 +814,7 @@ bool CMotionVehicle::Create(Math::Vector pos, float angle, ObjectType type,
for ( i=0 ; i<8 ; i++ )
{
rank = m_engine->CreateObject();
- m_engine->SetObjectType(rank, TYPEDESCENDANT);
+ m_engine->SetObjectType(rank, Gfx::ENG_OBJTYPE_DESCENDANT);
m_object->SetObjectRank(10+i, rank);
m_object->SetObjectParent(10+i, 1);
sprintf(name, "objects\\drawer%d.mod", 10+i);
@@ -828,10 +828,10 @@ bool CMotionVehicle::Create(Math::Vector pos, float angle, ObjectType type,
if ( type == OBJECT_MOBILEwt )
{
// Creates the key.
- if ( m_object->RetToy() )
+ if ( m_object->GetToy() )
{
rank = m_engine->CreateObject();
- m_engine->SetObjectType(rank, TYPEDESCENDANT);
+ m_engine->SetObjectType(rank, Gfx::ENG_OBJTYPE_DESCENDANT);
m_object->SetObjectRank(2, rank);
m_object->SetObjectParent(2, 0);
pModFile->ReadModel("objects\\drawer5.mod");
@@ -846,7 +846,7 @@ bool CMotionVehicle::Create(Math::Vector pos, float angle, ObjectType type,
{
// Creates the accessories.
rank = m_engine->CreateObject();
- m_engine->SetObjectType(rank, TYPEDESCENDANT);
+ m_engine->SetObjectType(rank, Gfx::ENG_OBJTYPE_DESCENDANT);
m_object->SetObjectRank(1, rank);
m_object->SetObjectParent(1, 0);
pModFile->ReadModel("objects\\apolloj2.mod"); // antenna
@@ -856,7 +856,7 @@ bool CMotionVehicle::Create(Math::Vector pos, float angle, ObjectType type,
m_object->SetAngleZ(1, 45.0f*Math::PI/180.0f);
rank = m_engine->CreateObject();
- m_engine->SetObjectType(rank, TYPEDESCENDANT);
+ m_engine->SetObjectType(rank, Gfx::ENG_OBJTYPE_DESCENDANT);
m_object->SetObjectRank(2, rank);
m_object->SetObjectParent(2, 0);
pModFile->ReadModel("objects\\apolloj3.mod"); // camera
@@ -866,7 +866,7 @@ bool CMotionVehicle::Create(Math::Vector pos, float angle, ObjectType type,
// Creates the wheels.
rank = m_engine->CreateObject();
- m_engine->SetObjectType(rank, TYPEDESCENDANT);
+ m_engine->SetObjectType(rank, Gfx::ENG_OBJTYPE_DESCENDANT);
m_object->SetObjectRank(6, rank);
m_object->SetObjectParent(6, 0);
pModFile->ReadModel("objects\\apolloj4.mod"); // wheel
@@ -874,7 +874,7 @@ bool CMotionVehicle::Create(Math::Vector pos, float angle, ObjectType type,
m_object->SetPosition(6, Math::Vector(-5.75f, 1.65f, -5.0f));
rank = m_engine->CreateObject();
- m_engine->SetObjectType(rank, TYPEDESCENDANT);
+ m_engine->SetObjectType(rank, Gfx::ENG_OBJTYPE_DESCENDANT);
m_object->SetObjectRank(7, rank);
m_object->SetObjectParent(7, 0);
pModFile->ReadModel("objects\\apolloj4.mod"); // wheel
@@ -882,7 +882,7 @@ bool CMotionVehicle::Create(Math::Vector pos, float angle, ObjectType type,
m_object->SetPosition(7, Math::Vector(-5.75f, 1.65f, 5.0f));
rank = m_engine->CreateObject();
- m_engine->SetObjectType(rank, TYPEDESCENDANT);
+ m_engine->SetObjectType(rank, Gfx::ENG_OBJTYPE_DESCENDANT);
m_object->SetObjectRank(8, rank);
m_object->SetObjectParent(8, 0);
pModFile->ReadModel("objects\\apolloj4.mod"); // wheel
@@ -890,7 +890,7 @@ bool CMotionVehicle::Create(Math::Vector pos, float angle, ObjectType type,
m_object->SetPosition(8, Math::Vector(5.75f, 1.65f, -5.0f));
rank = m_engine->CreateObject();
- m_engine->SetObjectType(rank, TYPEDESCENDANT);
+ m_engine->SetObjectType(rank, Gfx::ENG_OBJTYPE_DESCENDANT);
m_object->SetObjectRank(9, rank);
m_object->SetObjectParent(9, 0);
pModFile->ReadModel("objects\\apolloj4.mod"); // wheel
@@ -899,7 +899,7 @@ bool CMotionVehicle::Create(Math::Vector pos, float angle, ObjectType type,
// Creates mud guards.
rank = m_engine->CreateObject();
- m_engine->SetObjectType(rank, TYPEDESCENDANT);
+ m_engine->SetObjectType(rank, Gfx::ENG_OBJTYPE_DESCENDANT);
m_object->SetObjectRank(10, rank);
m_object->SetObjectParent(10, 0);
pModFile->ReadModel("objects\\apolloj6.mod"); // wheel
@@ -907,7 +907,7 @@ bool CMotionVehicle::Create(Math::Vector pos, float angle, ObjectType type,
m_object->SetPosition(10, Math::Vector(-5.75f, 1.65f, -5.0f));
rank = m_engine->CreateObject();
- m_engine->SetObjectType(rank, TYPEDESCENDANT);
+ m_engine->SetObjectType(rank, Gfx::ENG_OBJTYPE_DESCENDANT);
m_object->SetObjectRank(11, rank);
m_object->SetObjectParent(11, 0);
pModFile->ReadModel("objects\\apolloj6.mod"); // wheel
@@ -915,7 +915,7 @@ bool CMotionVehicle::Create(Math::Vector pos, float angle, ObjectType type,
m_object->SetPosition(11, Math::Vector(-5.75f, 1.65f, 5.0f));
rank = m_engine->CreateObject();
- m_engine->SetObjectType(rank, TYPEDESCENDANT);
+ m_engine->SetObjectType(rank, Gfx::ENG_OBJTYPE_DESCENDANT);
m_object->SetObjectRank(12, rank);
m_object->SetObjectParent(12, 0);
pModFile->ReadModel("objects\\apolloj5.mod"); // wheel
@@ -923,7 +923,7 @@ bool CMotionVehicle::Create(Math::Vector pos, float angle, ObjectType type,
m_object->SetPosition(12, Math::Vector(5.75f, 1.65f, -5.0f));
rank = m_engine->CreateObject();
- m_engine->SetObjectType(rank, TYPEDESCENDANT);
+ m_engine->SetObjectType(rank, Gfx::ENG_OBJTYPE_DESCENDANT);
m_object->SetObjectRank(13, rank);
m_object->SetObjectParent(13, 0);
pModFile->ReadModel("objects\\apolloj5.mod"); // wheel
@@ -1035,14 +1035,14 @@ bool CMotionVehicle::Create(Math::Vector pos, float angle, ObjectType type,
pPower->SetType(power<=1.0f?OBJECT_POWER:OBJECT_ATOMIC);
rank = m_engine->CreateObject();
- m_engine->SetObjectType(rank, TYPEFIX);
+ m_engine->SetObjectType(rank, Gfx::ENG_OBJTYPE_FIX);
pPower->SetObjectRank(0, rank);
if ( power <= 1.0f ) pModFile->ReadModel("objects\\power.mod");
else pModFile->ReadModel("objects\\atomic.mod");
pModFile->CreateEngineObject(rank);
- pPower->SetPosition(0, m_object->RetCharacter()->posPower);
+ pPower->SetPosition(0, m_object->GetCharacter()->posPower);
pPower->CreateCrashSphere(Math::Vector(0.0f, 1.0f, 0.0f), 1.0f, SOUND_BOUMm, 0.45f);
pPower->SetGlobalSphere(Math::Vector(0.0f, 1.0f, 0.0f), 1.5f);
@@ -1053,10 +1053,10 @@ bool CMotionVehicle::Create(Math::Vector pos, float angle, ObjectType type,
else pPower->SetEnergy(power/100.0f);
}
- pos = m_object->RetPosition(0);
+ pos = m_object->GetPosition(0);
m_object->SetPosition(0, pos); //to display the shadows immediately
- m_engine->LoadAllTexture();
+ m_engine->LoadAllTextures();
delete pModFile;
return true;
@@ -1068,7 +1068,7 @@ void CMotionVehicle::CreatePhysics(ObjectType type)
{
Character* character;
- character = m_object->RetCharacter();
+ character = m_object->GetCharacter();
if ( type == OBJECT_MOBILEwa ||
type == OBJECT_MOBILEwc ||
@@ -1352,12 +1352,12 @@ bool CMotionVehicle::EventProcess(const Event &event)
{
CMotion::EventProcess(event);
- if ( event.event == EVENT_FRAME )
+ if ( event.type == EVENT_FRAME )
{
return EventFrame(event);
}
- if ( event.event == EVENT_KEYDOWN )
+ if ( event.type == EVENT_KEY_DOWN )
{
}
@@ -1375,10 +1375,10 @@ bool CMotionVehicle::EventFrame(const Event &event)
float s, a, speedBL, speedBR, speedFL, speedFR, h, a1, a2;
float back, front, dist, radius, limit[2];
- if ( m_engine->RetPause() ) return true;
- if ( !m_engine->IsVisiblePoint(m_object->RetPosition(0)) ) return true;
+ if ( m_engine->GetPause() ) return true;
+ if ( !m_engine->IsVisiblePoint(m_object->GetPosition(0)) ) return true;
- type = m_object->RetType();
+ type = m_object->GetType();
if ( type == OBJECT_MOBILEwa ||
type == OBJECT_MOBILEwc ||
@@ -1388,8 +1388,8 @@ bool CMotionVehicle::EventFrame(const Event &event)
type == OBJECT_MOBILEtg ||
type == OBJECT_APOLLO2 ) // wheels?
{
- s = m_physics->RetLinMotionX(MO_MOTSPEED)*1.0f;
- a = m_physics->RetCirMotionY(MO_MOTSPEED)*3.0f;
+ s = m_physics->GetLinMotionX(MO_MOTSPEED)*1.0f;
+ a = m_physics->GetCirMotionY(MO_MOTSPEED)*3.0f;
if ( type == OBJECT_APOLLO2 ) s *= 0.5f;
@@ -1398,10 +1398,10 @@ bool CMotionVehicle::EventFrame(const Event &event)
speedFR = -s+a;
speedFL = s+a;
- m_object->SetAngleZ(6, m_object->RetAngleZ(6)+event.rTime*speedBR); // turning the wheels
- m_object->SetAngleZ(7, m_object->RetAngleZ(7)+event.rTime*speedBL);
- m_object->SetAngleZ(8, m_object->RetAngleZ(8)+event.rTime*speedFR);
- m_object->SetAngleZ(9, m_object->RetAngleZ(9)+event.rTime*speedFL);
+ m_object->SetAngleZ(6, m_object->GetAngleZ(6)+event.rTime*speedBR); // turning the wheels
+ m_object->SetAngleZ(7, m_object->GetAngleZ(7)+event.rTime*speedBL);
+ m_object->SetAngleZ(8, m_object->GetAngleZ(8)+event.rTime*speedFR);
+ m_object->SetAngleZ(9, m_object->GetAngleZ(9)+event.rTime*speedFL);
if ( s > 0.0f )
{
@@ -1424,21 +1424,21 @@ bool CMotionVehicle::EventFrame(const Event &event)
m_wheelTurn[2] = -fabs(a)*0.05f;
m_wheelTurn[3] = fabs(a)*0.05f+Math::PI;
}
- m_object->SetAngleY(6, m_object->RetAngleY(6)+(m_wheelTurn[0]-m_object->RetAngleY(6))*event.rTime*8.0f);
- m_object->SetAngleY(7, m_object->RetAngleY(7)+(m_wheelTurn[1]-m_object->RetAngleY(7))*event.rTime*8.0f);
- m_object->SetAngleY(8, m_object->RetAngleY(8)+(m_wheelTurn[2]-m_object->RetAngleY(8))*event.rTime*8.0f);
- m_object->SetAngleY(9, m_object->RetAngleY(9)+(m_wheelTurn[3]-m_object->RetAngleY(9))*event.rTime*8.0f);
+ m_object->SetAngleY(6, m_object->GetAngleY(6)+(m_wheelTurn[0]-m_object->GetAngleY(6))*event.rTime*8.0f);
+ m_object->SetAngleY(7, m_object->GetAngleY(7)+(m_wheelTurn[1]-m_object->GetAngleY(7))*event.rTime*8.0f);
+ m_object->SetAngleY(8, m_object->GetAngleY(8)+(m_wheelTurn[2]-m_object->GetAngleY(8))*event.rTime*8.0f);
+ m_object->SetAngleY(9, m_object->GetAngleY(9)+(m_wheelTurn[3]-m_object->GetAngleY(9))*event.rTime*8.0f);
if ( type == OBJECT_APOLLO2 )
{
- m_object->SetAngleY(10, m_object->RetAngleY(6)+(m_wheelTurn[0]-m_object->RetAngleY(6))*event.rTime*8.0f);
- m_object->SetAngleY(11, m_object->RetAngleY(7)+(m_wheelTurn[1]-m_object->RetAngleY(7))*event.rTime*8.0f+Math::PI);
- m_object->SetAngleY(12, m_object->RetAngleY(8)+(m_wheelTurn[2]-m_object->RetAngleY(8))*event.rTime*8.0f);
- m_object->SetAngleY(13, m_object->RetAngleY(9)+(m_wheelTurn[3]-m_object->RetAngleY(9))*event.rTime*8.0f+Math::PI);
+ m_object->SetAngleY(10, m_object->GetAngleY(6)+(m_wheelTurn[0]-m_object->GetAngleY(6))*event.rTime*8.0f);
+ m_object->SetAngleY(11, m_object->GetAngleY(7)+(m_wheelTurn[1]-m_object->GetAngleY(7))*event.rTime*8.0f+Math::PI);
+ m_object->SetAngleY(12, m_object->GetAngleY(8)+(m_wheelTurn[2]-m_object->GetAngleY(8))*event.rTime*8.0f);
+ m_object->SetAngleY(13, m_object->GetAngleY(9)+(m_wheelTurn[3]-m_object->GetAngleY(9))*event.rTime*8.0f+Math::PI);
}
- pos = m_object->RetPosition(0);
- angle = m_object->RetAngle(0);
+ pos = m_object->GetPosition(0);
+ angle = m_object->GetAngle(0);
if ( pos.x != m_wheelLastPos.x ||
pos.y != m_wheelLastPos.y ||
pos.z != m_wheelLastPos.z ||
@@ -1471,16 +1471,16 @@ bool CMotionVehicle::EventFrame(const Event &event)
radius = 1.0f;
}
- if ( Math::Distance(pos, m_engine->RetEyePt()) < 50.0f ) // suspension?
+ if ( Math::Distance(pos, m_engine->GetEyePt()) < 50.0f ) // suspension?
{
- character = m_object->RetCharacter();
- mat = m_object->RetWorldMatrix(0);
+ character = m_object->GetCharacter();
+ mat = m_object->GetWorldMatrix(0);
pos.x = -character->wheelBack; // right back wheel
pos.z = -character->wheelRight;
pos.y = 0.0f;
pos = Math::Transform(*mat, pos);
- h = m_terrain->RetFloorHeight(pos);
+ h = m_terrain->GetHeightToFloor(pos);
if ( h > 0.5f ) h = 0.5f;
if ( h < -0.5f ) h = -0.5f;
pos.x = back;
@@ -1493,7 +1493,7 @@ bool CMotionVehicle::EventFrame(const Event &event)
pos.z = character->wheelLeft;
pos.y = 0.0f;
pos = Math::Transform(*mat, pos);
- h = m_terrain->RetFloorHeight(pos);
+ h = m_terrain->GetHeightToFloor(pos);
if ( h > 0.5f ) h = 0.5f;
if ( h < -0.5f ) h = -0.5f;
pos.x = back;
@@ -1506,7 +1506,7 @@ bool CMotionVehicle::EventFrame(const Event &event)
pos.z = -character->wheelRight;
pos.y = 0.0f;
pos = Math::Transform(*mat, pos);
- h = m_terrain->RetFloorHeight(pos);
+ h = m_terrain->GetHeightToFloor(pos);
if ( h > 0.5f ) h = 0.5f;
if ( h < -0.5f ) h = -0.5f;
pos.x = front;
@@ -1519,7 +1519,7 @@ bool CMotionVehicle::EventFrame(const Event &event)
pos.z = character->wheelLeft;
pos.y = 0.0f;
pos = Math::Transform(*mat, pos);
- h = m_terrain->RetFloorHeight(pos);
+ h = m_terrain->GetHeightToFloor(pos);
if ( h > 0.5f ) h = 0.5f;
if ( h < -0.5f ) h = -0.5f;
pos.x = front;
@@ -1557,16 +1557,16 @@ bool CMotionVehicle::EventFrame(const Event &event)
type == OBJECT_MOBILEsa ||
type == OBJECT_MOBILEdr ) // caterpillars?
{
- s = m_physics->RetLinMotionX(MO_MOTSPEED)*0.7f;
- a = m_physics->RetCirMotionY(MO_MOTSPEED)*2.5f;
+ s = m_physics->GetLinMotionX(MO_MOTSPEED)*0.7f;
+ a = m_physics->GetCirMotionY(MO_MOTSPEED)*2.5f;
m_posTrackLeft += event.rTime*(s+a);
m_posTrackRight += event.rTime*(s-a);
UpdateTrackMapping(m_posTrackLeft, m_posTrackRight, type);
- pos = m_object->RetPosition(0);
- angle = m_object->RetAngle(0);
+ pos = m_object->GetPosition(0);
+ angle = m_object->GetAngle(0);
if ( pos.x != m_wheelLastPos.x ||
pos.y != m_wheelLastPos.y ||
pos.z != m_wheelLastPos.z ||
@@ -1601,22 +1601,22 @@ bool CMotionVehicle::EventFrame(const Event &event)
limit[1] = -10.0f*Math::PI/180.0f;
}
- if ( Math::Distance(pos, m_engine->RetEyePt()) < 50.0f ) // suspension?
+ if ( Math::Distance(pos, m_engine->GetEyePt()) < 50.0f ) // suspension?
{
- character = m_object->RetCharacter();
- mat = m_object->RetWorldMatrix(0);
+ character = m_object->GetCharacter();
+ mat = m_object->GetWorldMatrix(0);
pos.x = character->wheelFront; // right front wheel
pos.z = -character->wheelRight;
pos.y = 0.0f;
pos = Transform(*mat, pos);
- a1 = atanf(m_terrain->RetFloorHeight(pos)/character->wheelFront);
+ a1 = atanf(m_terrain->GetHeightToFloor(pos)/character->wheelFront);
pos.x = -character->wheelBack; // right back wheel
pos.z = -character->wheelRight;
pos.y = 0.0f;
pos = Transform(*mat, pos);
- a2 = atanf(m_terrain->RetFloorHeight(pos)/character->wheelBack);
+ a2 = atanf(m_terrain->GetHeightToFloor(pos)/character->wheelBack);
a = (a2-a1)/2.0f;
if ( a > limit[0] ) a = limit[0];
@@ -1627,13 +1627,13 @@ bool CMotionVehicle::EventFrame(const Event &event)
pos.z = character->wheelLeft;
pos.y = 0.0f;
pos = Transform(*mat, pos);
- a1 = atanf(m_terrain->RetFloorHeight(pos)/character->wheelFront);
+ a1 = atanf(m_terrain->GetHeightToFloor(pos)/character->wheelFront);
pos.x = -character->wheelBack; // left back wheel
pos.z = character->wheelLeft;
pos.y = 0.0f;
pos = Transform(*mat, pos);
- a2 = atanf(m_terrain->RetFloorHeight(pos)/character->wheelBack);
+ a2 = atanf(m_terrain->GetHeightToFloor(pos)/character->wheelBack);
a = (a2-a1)/2.0f;
if ( a > limit[0] ) a = limit[0];
@@ -1652,16 +1652,16 @@ bool CMotionVehicle::EventFrame(const Event &event)
type == OBJECT_MOBILEdr ) // toy is key?
{
pos = m_posKey;
- if ( m_object->RetSelect() &&
- m_camera->RetType() == CAMERA_ONBOARD )
+ if ( m_object->GetSelect() &&
+ m_camera->GetType() == Gfx::CAM_TYPE_ONBOARD )
{
pos.y += 10.0f; // out of sight!
}
m_object->SetPosition(2, pos);
- s = -fabs(m_physics->RetLinMotionX(MO_MOTSPEED)*0.1f);
- s += -fabs(m_physics->RetCirMotionY(MO_MOTSPEED)*1.5f);
- m_object->SetAngleY(2, m_object->RetAngleY(2)+event.rTime*s); // turns the key
+ s = -fabs(m_physics->GetLinMotionX(MO_MOTSPEED)*0.1f);
+ s += -fabs(m_physics->GetCirMotionY(MO_MOTSPEED)*1.5f);
+ m_object->SetAngleY(2, m_object->GetAngleY(2)+event.rTime*s); // turns the key
}
if ( type == OBJECT_MOBILEfa ||
@@ -1701,8 +1701,8 @@ bool CMotionVehicle::EventFrameFly(const Event &event)
float hope[3], actual, final, h, a;
int i;
- pos = m_object->RetPosition(0);
- angle = m_object->RetAngle(0);
+ pos = m_object->GetPosition(0);
+ angle = m_object->GetAngle(0);
if ( m_bFlyFix &&
pos.x == m_wheelLastPos.x &&
pos.y == m_wheelLastPos.y &&
@@ -1714,16 +1714,16 @@ bool CMotionVehicle::EventFrameFly(const Event &event)
m_wheelLastPos = pos;
m_wheelLastAngle = angle;
- if ( m_physics->RetLand() ) // on the ground?
+ if ( m_physics->GetLand() ) // on the ground?
{
- mat = m_object->RetWorldMatrix(0);
+ mat = m_object->GetWorldMatrix(0);
paw[0] = Transform(*mat, Math::Vector( 4.2f, 0.0f, 0.0f)); // front
paw[1] = Transform(*mat, Math::Vector(-3.0f, 0.0f, -3.7f)); // right back
paw[2] = Transform(*mat, Math::Vector(-3.0f, 0.0f, 3.7f)); // left back
for ( i=0 ; i<3 ; i++ )
{
- h = m_terrain->RetFloorHeight(paw[i]);
+ h = m_terrain->GetHeightToFloor(paw[i]);
a = -atanf(h*0.5f);
if ( a > Math::PI*0.2f ) a = Math::PI*0.2f;
if ( a < -Math::PI*0.2f ) a = -Math::PI*0.2f;
@@ -1740,7 +1740,7 @@ bool CMotionVehicle::EventFrameFly(const Event &event)
m_bFlyFix = true;
for ( i=0 ; i<3 ; i++ )
{
- actual = m_object->RetAngleZ(6+i);
+ actual = m_object->GetAngleZ(6+i);
final = Math::Smooth(actual, hope[i], event.rTime*5.0f);
if ( final != actual )
{
@@ -1782,14 +1782,14 @@ bool CMotionVehicle::EventFrameInsect(const Event &event)
};
bOnBoard = false;
- if ( m_object->RetSelect() &&
- m_camera->RetType() == CAMERA_ONBOARD )
+ if ( m_object->GetSelect() &&
+ m_camera->GetType() == Gfx::CAM_TYPE_ONBOARD )
{
bOnBoard = true;
}
- s = m_physics->RetLinMotionX(MO_MOTSPEED)*1.5f;
- a = fabs(m_physics->RetCirMotionY(MO_MOTSPEED)*2.0f);
+ s = m_physics->GetLinMotionX(MO_MOTSPEED)*1.5f;
+ a = fabs(m_physics->GetCirMotionY(MO_MOTSPEED)*2.0f);
if ( s == 0.0f && a != 0.0f ) a *= 1.5f;
@@ -1812,7 +1812,7 @@ bool CMotionVehicle::EventFrameInsect(const Event &event)
m_armMember += a;
}
- if ( m_object->RetRuin() ) // burn or explode?
+ if ( m_object->GetRuin() ) // burn or explode?
{
action = 3;
}
@@ -1856,27 +1856,27 @@ bool CMotionVehicle::EventFrameInsect(const Event &event)
if ( i < 3 ) // right leg (1..3) ?
{
- m_object->SetAngleX(6+3*i+0, Math::Smooth(m_object->RetAngleX(6+3*i+0), Math::PropAngle(table[st+ 0], table[nd+ 0], prog), time));
- m_object->SetAngleY(6+3*i+0, Math::Smooth(m_object->RetAngleY(6+3*i+0), Math::PropAngle(table[st+ 1], table[nd+ 1], prog), time));
- m_object->SetAngleZ(6+3*i+0, Math::Smooth(m_object->RetAngleZ(6+3*i+0), Math::PropAngle(table[st+ 2], table[nd+ 2], prog), time));
- m_object->SetAngleX(6+3*i+1, Math::Smooth(m_object->RetAngleX(6+3*i+1), Math::PropAngle(table[st+ 9], table[nd+ 9], prog), time));
- m_object->SetAngleY(6+3*i+1, Math::Smooth(m_object->RetAngleY(6+3*i+1), Math::PropAngle(table[st+10], table[nd+10], prog), time));
- m_object->SetAngleZ(6+3*i+1, Math::Smooth(m_object->RetAngleZ(6+3*i+1), Math::PropAngle(table[st+11], table[nd+11], prog), time));
- m_object->SetAngleX(6+3*i+2, Math::Smooth(m_object->RetAngleX(6+3*i+2), Math::PropAngle(table[st+18], table[nd+18], prog), time));
- m_object->SetAngleY(6+3*i+2, Math::Smooth(m_object->RetAngleY(6+3*i+2), Math::PropAngle(table[st+19], table[nd+19], prog), time));
- m_object->SetAngleZ(6+3*i+2, Math::Smooth(m_object->RetAngleZ(6+3*i+2), Math::PropAngle(table[st+20], table[nd+20], prog), time));
+ m_object->SetAngleX(6+3*i+0, Math::Smooth(m_object->GetAngleX(6+3*i+0), Math::PropAngle(table[st+ 0], table[nd+ 0], prog), time));
+ m_object->SetAngleY(6+3*i+0, Math::Smooth(m_object->GetAngleY(6+3*i+0), Math::PropAngle(table[st+ 1], table[nd+ 1], prog), time));
+ m_object->SetAngleZ(6+3*i+0, Math::Smooth(m_object->GetAngleZ(6+3*i+0), Math::PropAngle(table[st+ 2], table[nd+ 2], prog), time));
+ m_object->SetAngleX(6+3*i+1, Math::Smooth(m_object->GetAngleX(6+3*i+1), Math::PropAngle(table[st+ 9], table[nd+ 9], prog), time));
+ m_object->SetAngleY(6+3*i+1, Math::Smooth(m_object->GetAngleY(6+3*i+1), Math::PropAngle(table[st+10], table[nd+10], prog), time));
+ m_object->SetAngleZ(6+3*i+1, Math::Smooth(m_object->GetAngleZ(6+3*i+1), Math::PropAngle(table[st+11], table[nd+11], prog), time));
+ m_object->SetAngleX(6+3*i+2, Math::Smooth(m_object->GetAngleX(6+3*i+2), Math::PropAngle(table[st+18], table[nd+18], prog), time));
+ m_object->SetAngleY(6+3*i+2, Math::Smooth(m_object->GetAngleY(6+3*i+2), Math::PropAngle(table[st+19], table[nd+19], prog), time));
+ m_object->SetAngleZ(6+3*i+2, Math::Smooth(m_object->GetAngleZ(6+3*i+2), Math::PropAngle(table[st+20], table[nd+20], prog), time));
}
else // left leg (4..6) ?
{
- m_object->SetAngleX(6+3*i+0, Math::Smooth(m_object->RetAngleX(6+3*i+0), Math::PropAngle(-table[st+ 0], -table[nd+ 0], prog), time));
- m_object->SetAngleY(6+3*i+0, Math::Smooth(m_object->RetAngleY(6+3*i+0), Math::PropAngle(-table[st+ 1], -table[nd+ 1], prog), time));
- m_object->SetAngleZ(6+3*i+0, Math::Smooth(m_object->RetAngleZ(6+3*i+0), Math::PropAngle( table[st+ 2], table[nd+ 2], prog), time));
- m_object->SetAngleX(6+3*i+1, Math::Smooth(m_object->RetAngleX(6+3*i+1), Math::PropAngle(-table[st+ 9], -table[nd+ 9], prog), time));
- m_object->SetAngleY(6+3*i+1, Math::Smooth(m_object->RetAngleY(6+3*i+1), Math::PropAngle(-table[st+10], -table[nd+10], prog), time));
- m_object->SetAngleZ(6+3*i+1, Math::Smooth(m_object->RetAngleZ(6+3*i+1), Math::PropAngle( table[st+11], table[nd+11], prog), time));
- m_object->SetAngleX(6+3*i+2, Math::Smooth(m_object->RetAngleX(6+3*i+2), Math::PropAngle(-table[st+18], -table[nd+18], prog), time));
- m_object->SetAngleY(6+3*i+2, Math::Smooth(m_object->RetAngleY(6+3*i+2), Math::PropAngle(-table[st+19], -table[nd+19], prog), time));
- m_object->SetAngleZ(6+3*i+2, Math::Smooth(m_object->RetAngleZ(6+3*i+2), Math::PropAngle( table[st+20], table[nd+20], prog), time));
+ m_object->SetAngleX(6+3*i+0, Math::Smooth(m_object->GetAngleX(6+3*i+0), Math::PropAngle(-table[st+ 0], -table[nd+ 0], prog), time));
+ m_object->SetAngleY(6+3*i+0, Math::Smooth(m_object->GetAngleY(6+3*i+0), Math::PropAngle(-table[st+ 1], -table[nd+ 1], prog), time));
+ m_object->SetAngleZ(6+3*i+0, Math::Smooth(m_object->GetAngleZ(6+3*i+0), Math::PropAngle( table[st+ 2], table[nd+ 2], prog), time));
+ m_object->SetAngleX(6+3*i+1, Math::Smooth(m_object->GetAngleX(6+3*i+1), Math::PropAngle(-table[st+ 9], -table[nd+ 9], prog), time));
+ m_object->SetAngleY(6+3*i+1, Math::Smooth(m_object->GetAngleY(6+3*i+1), Math::PropAngle(-table[st+10], -table[nd+10], prog), time));
+ m_object->SetAngleZ(6+3*i+1, Math::Smooth(m_object->GetAngleZ(6+3*i+1), Math::PropAngle( table[st+11], table[nd+11], prog), time));
+ m_object->SetAngleX(6+3*i+2, Math::Smooth(m_object->GetAngleX(6+3*i+2), Math::PropAngle(-table[st+18], -table[nd+18], prog), time));
+ m_object->SetAngleY(6+3*i+2, Math::Smooth(m_object->GetAngleY(6+3*i+2), Math::PropAngle(-table[st+19], -table[nd+19], prog), time));
+ m_object->SetAngleZ(6+3*i+2, Math::Smooth(m_object->GetAngleZ(6+3*i+2), Math::PropAngle( table[st+20], table[nd+20], prog), time));
}
}
@@ -1916,20 +1916,20 @@ bool CMotionVehicle::EventFrameCanoni(const Event &event)
m_canonTime += event.rTime;
- if ( m_object->RetSelect() &&
- m_camera->RetType() == CAMERA_ONBOARD )
+ if ( m_object->GetSelect() &&
+ m_camera->GetType() == Gfx::CAM_TYPE_ONBOARD )
{
bOnBoard = true;
}
- power = m_object->RetPower();
+ power = m_object->GetPower();
if ( power == 0 )
{
energy = 0.0f;
}
else
{
- energy = power->RetEnergy();
+ energy = power->GetEnergy();
}
if ( energy == 0.0f ) return true;
@@ -1961,13 +1961,13 @@ bool CMotionVehicle::EventFrameCanoni(const Event &event)
{
m_lastTimeCanon = m_engine->ParticuleAdapt(0.5f+Math::Rand()*0.5f);
- pos = m_object->RetPosition(0);
+ pos = m_object->GetPosition(0);
pos.y += 8.0f;
speed.y = 7.0f+Math::Rand()*3.0f;
speed.x = (Math::Rand()-0.5f)*2.0f;
speed.z = 2.0f+Math::Rand()*2.0f;
if ( Math::Rand() < 0.5f ) speed.z = -speed.z;
- mat = m_object->RetRotateMatrix(0);
+ mat = m_object->GetRotateMatrix(0);
speed = Transform(*mat, speed);
dim.x = Math::Rand()*0.1f+0.1f;
if ( bOnBoard ) dim.x *= 0.4f;
@@ -1984,11 +1984,11 @@ bool CMotionVehicle::EventFrameCanoni(const Event &event)
void CMotionVehicle::UpdateTrackMapping(float left, float right, ObjectType type)
{
- D3DMATERIAL7 mat;
+ Gfx::Material mat;
float limit[4];
int rRank, lRank, i;
- ZeroMemory( &mat, sizeof(D3DMATERIAL7) );
+ memset( &mat, 0, sizeof(Gfx::Material) );
mat.diffuse.r = 1.0f;
mat.diffuse.g = 1.0f;
mat.diffuse.b = 1.0f; // white
@@ -1996,8 +1996,8 @@ void CMotionVehicle::UpdateTrackMapping(float left, float right, ObjectType type
mat.ambient.g = 0.5f;
mat.ambient.b = 0.5f;
- rRank = m_object->RetObjectRank(6);
- lRank = m_object->RetObjectRank(7);
+ rRank = m_object->GetObjectRank(6);
+ lRank = m_object->GetObjectRank(7);
if ( type == OBJECT_MOBILEdr )
@@ -2005,31 +2005,31 @@ void CMotionVehicle::UpdateTrackMapping(float left, float right, ObjectType type
limit[0] = 0.0f;
limit[1] = 1000000.0f;
limit[2] = limit[1];
- limit[3] = m_engine->RetLimitLOD(1);
+ limit[3] = m_engine->GetLimitLOD(1);
- m_engine->TrackTextureMapping(rRank, mat, D3DSTATEPART1, "drawer.tga", "",
- limit[0], limit[1], D3DMAPPINGX,
+ m_engine->TrackTextureMapping(rRank, mat, Gfx::ENG_RSTATE_PART1, "drawer.png", "",
+ limit[0], limit[1], Gfx::ENG_TEX_MAPPING_X,
right, 1.0f, 8.0f, 192.0f, 256.0f);
- m_engine->TrackTextureMapping(lRank, mat, D3DSTATEPART2, "drawer.tga", "",
- limit[0], limit[1], D3DMAPPINGX,
+ m_engine->TrackTextureMapping(lRank, mat, Gfx::ENG_RSTATE_PART2, "drawer.png", "",
+ limit[0], limit[1], Gfx::ENG_TEX_MAPPING_X,
left, 1.0f, 8.0f, 192.0f, 256.0f);
}
else
{
limit[0] = 0.0f;
- limit[1] = m_engine->RetLimitLOD(0);
+ limit[1] = m_engine->GetLimitLOD(0);
limit[2] = limit[1];
- limit[3] = m_engine->RetLimitLOD(1);
+ limit[3] = m_engine->GetLimitLOD(1);
for ( i=0 ; i<2 ; i++ )
{
- m_engine->TrackTextureMapping(rRank, mat, D3DSTATEPART1, "lemt.tga", "",
- limit[i*2+0], limit[i*2+1], D3DMAPPINGX,
+ m_engine->TrackTextureMapping(rRank, mat, Gfx::ENG_RSTATE_PART1, "lemt.png", "",
+ limit[i*2+0], limit[i*2+1], Gfx::ENG_TEX_MAPPING_X,
right, 1.0f, 8.0f, 192.0f, 256.0f);
- m_engine->TrackTextureMapping(lRank, mat, D3DSTATEPART2, "lemt.tga", "",
- limit[i*2+0], limit[i*2+1], D3DMAPPINGX,
+ m_engine->TrackTextureMapping(lRank, mat, Gfx::ENG_RSTATE_PART2, "lemt.png", "",
+ limit[i*2+0], limit[i*2+1], Gfx::ENG_TEX_MAPPING_X,
left, 1.0f, 8.0f, 192.0f, 256.0f);
}
}
@@ -2040,7 +2040,7 @@ void CMotionVehicle::UpdateTrackMapping(float left, float right, ObjectType type
// State management of the pencil drawing robot.
-bool CMotionVehicle::RetTraceDown()
+bool CMotionVehicle::GetTraceDown()
{
return m_bTraceDown;
}
@@ -2050,7 +2050,7 @@ void CMotionVehicle::SetTraceDown(bool bDown)
m_bTraceDown = bDown;
}
-int CMotionVehicle::RetTraceColor()
+int CMotionVehicle::GetTraceColor()
{
return m_traceColor;
}
@@ -2060,7 +2060,7 @@ void CMotionVehicle::SetTraceColor(int color)
m_traceColor = color;
}
-float CMotionVehicle::RetTraceWidth()
+float CMotionVehicle::GetTraceWidth()
{
return m_traceWidth;
}
diff --git a/src/object/motion/motionvehicle.h b/src/object/motion/motionvehicle.h
index 5ca97cd..ca60c1e 100644
--- a/src/object/motion/motionvehicle.h
+++ b/src/object/motion/motionvehicle.h
@@ -33,11 +33,11 @@ public:
bool Create(Math::Vector pos, float angle, ObjectType type, float power);
bool EventProcess(const Event &event);
- bool RetTraceDown();
+ bool GetTraceDown();
void SetTraceDown(bool bDown);
- int RetTraceColor();
+ int GetTraceColor();
void SetTraceColor(int color);
- float RetTraceWidth();
+ float GetTraceWidth();
void SetTraceWidth(float width);
protected:
diff --git a/src/object/motion/motionworm.cpp b/src/object/motion/motionworm.cpp
index daf74ff..ce9ded2 100644
--- a/src/object/motion/motionworm.cpp
+++ b/src/object/motion/motionworm.cpp
@@ -21,9 +21,9 @@
#include "object/motion/motionworm.h"
-#include "old/modfile.h"
-#include "old/particule.h"
-#include "old/terrain.h"
+#include "graphics/engine/modelfile.h"
+#include "graphics/engine/particle.h"
+#include "graphics/engine/terrain.h"
#include "math/geometry.h"
#include "physics/physics.h"
@@ -55,7 +55,7 @@ CMotionWorm::CMotionWorm(CInstanceManager* iMan, CObject* object)
m_armCirSpeed = 0.0f;
m_armLastAction = -1;
m_specAction = -1;
- m_lastParticule = 0.0f;
+ m_lastParticle = 0.0f;
m_bArmStop = false;
}
@@ -78,19 +78,19 @@ void CMotionWorm::DeleteObject(bool bAll)
bool CMotionWorm::Create(Math::Vector pos, float angle, ObjectType type,
float power)
{
- CModFile* pModFile;
+ Gfx::CModelFile* pModFile;
int rank, i;
float px;
- if ( m_engine->RetRestCreate() < 2+WORM_PART+1 ) return false;
+// if ( m_engine->GetRestCreate() < 2+WORM_PART+1 ) return false;
- pModFile = new CModFile(m_iMan);
+ pModFile = new Gfx::CModelFile(m_iMan);
m_object->SetType(type);
// Creates the main base.
rank = m_engine->CreateObject();
- m_engine->SetObjectType(rank, TYPEVEHICULE); // this is a moving object
+ m_engine->SetObjectType(rank, Gfx::ENG_OBJTYPE_VEHICULE); // this is a moving object
m_object->SetObjectRank(0, rank);
pModFile->ReadModel("objects\\worm0.mod"); // there is no purpose!
pModFile->CreateEngineObject(rank);
@@ -105,7 +105,7 @@ bool CMotionWorm::Create(Math::Vector pos, float angle, ObjectType type,
// Creates the head.
rank = m_engine->CreateObject();
- m_engine->SetObjectType(rank, TYPEDESCENDANT);
+ m_engine->SetObjectType(rank, Gfx::ENG_OBJTYPE_DESCENDANT);
m_object->SetObjectRank(1, rank);
m_object->SetObjectParent(1, 0);
pModFile->ReadModel("objects\\worm1.mod");
@@ -117,7 +117,7 @@ bool CMotionWorm::Create(Math::Vector pos, float angle, ObjectType type,
for ( i=0 ; i<WORM_PART ; i++ )
{
rank = m_engine->CreateObject();
- m_engine->SetObjectType(rank, TYPEDESCENDANT);
+ m_engine->SetObjectType(rank, Gfx::ENG_OBJTYPE_DESCENDANT);
m_object->SetObjectRank(2+i, rank);
m_object->SetObjectParent(2+i, 0);
pModFile->ReadModel("objects\\worm2.mod");
@@ -128,22 +128,22 @@ bool CMotionWorm::Create(Math::Vector pos, float angle, ObjectType type,
// Creates the tail.
rank = m_engine->CreateObject();
- m_engine->SetObjectType(rank, TYPEDESCENDANT);
+ m_engine->SetObjectType(rank, Gfx::ENG_OBJTYPE_DESCENDANT);
m_object->SetObjectRank(2+WORM_PART, rank);
m_object->SetObjectParent(2+WORM_PART, 0);
pModFile->ReadModel("objects\\worm3.mod");
pModFile->CreateEngineObject(rank);
m_object->SetPosition(2+WORM_PART, Math::Vector(px, 0.0f, 0.0f));
- m_object->CreateShadowCircle(0.0f, 1.0f, D3DSHADOWWORM);
+ m_object->CreateShadowCircle(0.0f, 1.0f, Gfx::ENG_SHADOW_WORM);
CreatePhysics();
m_object->SetFloorHeight(0.0f);
- pos = m_object->RetPosition(0);
+ pos = m_object->GetPosition(0);
m_object->SetPosition(0, pos); // to display the shadows immediately
- m_engine->LoadAllTexture();
+ m_engine->LoadAllTextures();
delete pModFile;
return true;
@@ -157,7 +157,7 @@ void CMotionWorm::CreatePhysics()
m_physics->SetType(TYPE_ROLLING);
- character = m_object->RetCharacter();
+ character = m_object->GetCharacter();
character->wheelFront = 10.0f;
character->wheelBack = 10.0f;
character->wheelLeft = 2.0f;
@@ -203,7 +203,7 @@ bool CMotionWorm::SetParam(int rank, float value)
return false;
}
-float CMotionWorm::RetParam(int rank)
+float CMotionWorm::GetParam(int rank)
{
if ( rank == 0 ) return m_timeDown;
if ( rank == 1 ) return m_timeUp;
@@ -218,12 +218,12 @@ bool CMotionWorm::EventProcess(const Event &event)
{
CMotion::EventProcess(event);
- if ( event.event == EVENT_FRAME )
+ if ( event.type == EVENT_FRAME )
{
return EventFrame(event);
}
- if ( event.event == EVENT_KEYDOWN )
+ if ( event.type == EVENT_KEY_DOWN )
{
}
@@ -241,10 +241,10 @@ bool CMotionWorm::EventFrame(const Event &event)
float floor, a, s, px, curve, phase, h, zoom, radius;
int i, under;
- if ( m_engine->RetPause() ) return true;
+ if ( m_engine->GetPause() ) return true;
- s = m_physics->RetLinMotionX(MO_MOTSPEED)/m_physics->RetLinMotionX(MO_ADVSPEED);
- a = m_physics->RetCirMotionY(MO_MOTSPEED)/m_physics->RetCirMotionY(MO_ADVSPEED);
+ s = m_physics->GetLinMotionX(MO_MOTSPEED)/m_physics->GetLinMotionX(MO_ADVSPEED);
+ a = m_physics->GetCirMotionY(MO_MOTSPEED)/m_physics->GetCirMotionY(MO_ADVSPEED);
if ( s == 0.0f && a != 0.0f ) s = a;
@@ -275,7 +275,7 @@ bool CMotionWorm::EventFrame(const Event &event)
{
h = 0.0f;
}
- if ( m_object->RetBurn() ) // is burning?
+ if ( m_object->GetBurn() ) // is burning?
{
h = 0.0f; // remains on earth
}
@@ -284,12 +284,12 @@ bool CMotionWorm::EventFrame(const Event &event)
}
m_object->SetVisible(under!=WORM_PART+2);
- if ( !m_engine->IsVisiblePoint(m_object->RetPosition(0)) ) return true;
+ if ( !m_engine->IsVisiblePoint(m_object->GetPosition(0)) ) return true;
- pos = m_object->RetPosition(0);
- floor = m_terrain->RetFloorLevel(pos, true);
+ pos = m_object->GetPosition(0);
+ floor = m_terrain->GetFloorLevel(pos, true);
- mat = m_object->RetWorldMatrix(0);
+ mat = m_object->GetWorldMatrix(0);
px = 1.0f+WORM_PART/2;
for ( i=0 ; i<WORM_PART+2 ; i++ )
@@ -298,14 +298,14 @@ bool CMotionWorm::EventFrame(const Event &event)
radius = radius*1.3f-0.3f;
if ( radius < 0.0f ) radius = 0.0f;
radius *= 5.0f;
- m_engine->SetObjectShadowRadius(m_object->RetObjectRank(0), radius);
+ m_engine->SetObjectShadowRadius(m_object->GetObjectRank(0), radius);
pos.x = px+ sinf(m_armTimeMarch*4.0f+0.5f*i)*0.6f;
pos.y = height[i]+sinf(m_armTimeMarch*4.0f+0.5f*i)*0.2f*m_armLinSpeed;
pos.y += sinf(m_armTimeAbs *1.3f+0.2f*i)*0.1f;
pos.z = sinf(m_armTimeAbs *2.0f+0.7f*i)*0.2f;
- curve = ((float)i-(WORM_PART+2)/2)*m_armCirSpeed*0.1f;
+ curve = (static_cast< float >(i) -(WORM_PART+2)/2)*m_armCirSpeed*0.1f;
center.x = 0.0f;
center.y = 0.0f;
pp.x = pos.x;
@@ -315,7 +315,7 @@ bool CMotionWorm::EventFrame(const Event &event)
pos.z = pp.y;
p = Transform(*mat, pos);
- pos.y += m_terrain->RetFloorLevel(p, true)-floor;
+ pos.y += m_terrain->GetFloorLevel(p, true)-floor;
m_object->SetPosition(i+1, pos);
zoom = Math::Mod(m_armTimeAbs*0.5f+100.0f-i*0.1f, 2.0f);
@@ -326,9 +326,9 @@ bool CMotionWorm::EventFrame(const Event &event)
m_object->SetZoomZ(i+1, zoom);
if ( height[i] >= -1.0f && height[i] < -0.2f &&
- m_lastParticule+m_engine->ParticuleAdapt(0.2f) <= m_armTimeMarch )
+ m_lastParticle+m_engine->ParticleAdapt(0.2f) <= m_armTimeMarch )
{
- m_lastParticule = m_armTimeMarch;
+ m_lastParticle = m_armTimeMarch;
pos = p;
pos.y += -height[i];
@@ -337,7 +337,7 @@ bool CMotionWorm::EventFrame(const Event &event)
speed = Math::Vector(0.0f, 0.0f, 0.0f);
dim.x = Math::Rand()*2.0f+1.5f;
dim.y = dim.x;
- m_particule->CreateParticule(pos, speed, dim, PARTICRASH, 2.0f);
+ m_particle->CreateParticle(pos, speed, dim, Gfx::PARTICRASH, 2.0f);
}
px -= 1.0f;
@@ -345,8 +345,8 @@ bool CMotionWorm::EventFrame(const Event &event)
for ( i=0 ; i<WORM_PART+1 ; i++ )
{
- pos = m_object->RetPosition(i+2);
- pos -= m_object->RetPosition(i+1);
+ pos = m_object->GetPosition(i+2);
+ pos -= m_object->GetPosition(i+1);
angle.z = -Math::RotateAngle(Math::Point(pos.x, pos.z).Length(), pos.y);
angle.y = Math::PI-Math::RotateAngle(pos.x, pos.z);
diff --git a/src/object/motion/motionworm.h b/src/object/motion/motionworm.h
index 1b2abf9..aed5a23 100644
--- a/src/object/motion/motionworm.h
+++ b/src/object/motion/motionworm.h
@@ -34,7 +34,7 @@ public:
bool EventProcess(const Event &event);
bool SetParam(int rank, float value);
- float RetParam(int rank);
+ float GetParam(int rank);
protected:
void CreatePhysics();
@@ -57,6 +57,6 @@ protected:
int m_specAction;
float m_specTime;
bool m_bArmStop;
- float m_lastParticule;
+ float m_lastParticle;
};
diff --git a/src/object/object.cpp b/src/object/object.cpp
index e2e52e5..dd46e0e 100644
--- a/src/object/object.cpp
+++ b/src/object/object.cpp
@@ -17,76 +17,74 @@
// object.cpp
-#include <windows.h>
-#include <stdio.h>
-#include <d3d.h>
-
+//---------CBot
#include "CBot/CBotDll.h"
-#include "common/struct.h"
-#include "math/const.h"
-#include "math/geometry.h"
-#include "old/d3dengine.h"
-#include "old/d3dmath.h"
-#include "old/d3dutil.h"
+
+//---------Common
#include "common/global.h"
-#include "common/event.h"
-#include "common/misc.h"
#include "common/iman.h"
#include "common/restext.h"
-#include "old/math3d.h"
-#include "object/mainmovie.h"
-#include "object/robotmain.h"
-#include "old/light.h"
-#include "old/terrain.h"
-#include "old/water.h"
-#include "old/blitz.h"
-#include "old/camera.h"
-#include "old/particule.h"
-#include "physics/physics.h"
-#include "object/brain.h"
-#include "object/motion/motion.h"
-#include "object/motion/motionhuman.h"
-#include "object/motion/motiontoto.h"
-#include "object/motion/motionvehicle.h"
-#include "object/motion/motionmother.h"
-#include "object/motion/motionant.h"
-#include "object/motion/motionspider.h"
-#include "object/motion/motionbee.h"
-#include "object/motion/motionworm.h"
-#include "old/modfile.h"
+
+//---------Graphic
+#include "graphics/engine/lightman.h"
+#include "graphics/engine/lightning.h"
+#include "graphics/engine/modelfile.h"
+#include "graphics/engine/particle.h"
+#include "graphics/engine/pyro.h"
+#include "graphics/engine/terrain.h"
+
+//---------Math
+#include "math/geometry.h"
+
+//---------Object
#include "object/auto/auto.h"
#include "object/auto/autobase.h"
-#include "object/auto/autoportico.h"
+#include "object/auto/autoconvert.h"
#include "object/auto/autoderrick.h"
-#include "object/auto/autofactory.h"
-#include "object/auto/autorepair.h"
#include "object/auto/autodestroyer.h"
-#include "object/auto/autostation.h"
-#include "object/auto/autoenergy.h"
-#include "object/auto/autoconvert.h"
-#include "object/auto/autotower.h"
-#include "object/auto/autoresearch.h"
-#include "object/auto/autolabo.h"
-#include "object/auto/autonuclear.h"
-#include "object/auto/autoradar.h"
#include "object/auto/autoegg.h"
-#include "object/auto/autonest.h"
-#include "object/auto/autoroot.h"
+#include "object/auto/autoenergy.h"
+#include "object/auto/autofactory.h"
#include "object/auto/autoflag.h"
+#include "object/auto/autohuston.h"
#include "object/auto/autoinfo.h"
#include "object/auto/autojostle.h"
+#include "object/auto/autokid.h"
+#include "object/auto/autolabo.h"
+#include "object/auto/automush.h"
+#include "object/auto/autonest.h"
+#include "object/auto/autonuclear.h"
#include "object/auto/autopara.h"
+#include "object/auto/autoportico.h"
+#include "object/auto/autoradar.h"
+#include "object/auto/autorepair.h"
+#include "object/auto/autoresearch.h"
+#include "object/auto/autoroot.h"
#include "object/auto/autosafe.h"
-#include "object/auto/autohuston.h"
-#include "object/auto/automush.h"
-#include "object/auto/autokid.h"
-#include "object/task/task.h"
-#include "old/pyro.h"
-#include "ui/displaytext.h"
-#include "script/cmdtoken.h"
-#include "script/cbottoken.h"
-#include "old/sound.h"
+#include "object/auto/autostation.h"
+#include "object/auto/autotower.h"
+#include "object/brain.h"
+#include "object/motion/motion.h"
+#include "object/motion/motionant.h"
+#include "object/motion/motionbee.h"
+#include "object/motion/motionhuman.h"
+#include "object/motion/motionmother.h"
+#include "object/motion/motionspider.h"
+#include "object/motion/motiontoto.h"
+#include "object/motion/motionvehicle.h"
+#include "object/motion/motionworm.h"
#include "object/object.h"
+#include "object/robotmain.h"
+
+//---------Physics
+#include "physics/physics.h"
+
+//---------Script
+#include "script/cbottoken.h"
+#include "script/cmdtoken.h"
+
+//---------Ui
+#include "ui/displaytext.h"
@@ -116,7 +114,7 @@ static float debug_arm3 = 0.0f;
void uObject(CBotVar* botThis, void* user)
{
- CObject* object = (CObject*)user;
+ CObject* object = static_cast<CObject*>(user);
CObject* power;
CObject* fret;
CPhysics* physics;
@@ -128,19 +126,19 @@ void uObject(CBotVar* botThis, void* user)
if ( object == 0 ) return;
- physics = object->RetPhysics();
+ physics = object->GetPhysics();
// Updates the object's type.
pVar = botThis->GetItemList(); // "category"
- type = object->RetType();
- pVar->SetValInt(type, object->RetName());
+ type = object->GetType();
+ pVar->SetValInt(type, object->GetName());
// Updates the position of the object.
pVar = pVar->GetNext(); // "position"
- if ( object->RetTruck() == 0 )
+ if ( object->GetTruck() == 0 )
{
- pos = object->RetPosition(0);
- pos.y -= object->RetWaterLevel(); // relative to sea level!
+ pos = object->GetPosition(0);
+ pos.y -= object->GetWaterLevel(); // relative to sea level!
pSub = pVar->GetItemList(); // "x"
pSub->SetValFloat(pos.x/g_unit);
pSub = pSub->GetNext(); // "y"
@@ -159,8 +157,8 @@ void uObject(CBotVar* botThis, void* user)
}
// Updates the angle.
- pos = object->RetAngle(0);
- pos += object->RetInclinaison();
+ pos = object->GetAngle(0);
+ pos += object->GetInclinaison();
pVar = pVar->GetNext(); // "orientation"
pVar->SetValFloat(360.0f-Math::Mod(pos.y*180.0f/Math::PI, 360.0f));
pVar = pVar->GetNext(); // "pitch"
@@ -170,47 +168,47 @@ void uObject(CBotVar* botThis, void* user)
// Updates the energy level of the object.
pVar = pVar->GetNext(); // "energyLevel"
- value = object->RetEnergy();
+ value = object->GetEnergy();
pVar->SetValFloat(value);
// Updates the shield level of the object.
pVar = pVar->GetNext(); // "shieldLevel"
- value = object->RetShield();
+ value = object->GetShield();
pVar->SetValFloat(value);
// Updates the temperature of the reactor.
pVar = pVar->GetNext(); // "temperature"
if ( physics == 0 ) value = 0.0f;
- else value = 1.0f-physics->RetReactorRange();
+ else value = 1.0f-physics->GetReactorRange();
pVar->SetValFloat(value);
// Updates the height above the ground.
pVar = pVar->GetNext(); // "altitude"
if ( physics == 0 ) value = 0.0f;
- else value = physics->RetFloorHeight();
+ else value = physics->GetFloorHeight();
pVar->SetValFloat(value/g_unit);
// Updates the lifetime of the object.
pVar = pVar->GetNext(); // "lifeTime"
- value = object->RetAbsTime();
+ value = object->GetAbsTime();
pVar->SetValFloat(value);
// Updates the material of the object.
pVar = pVar->GetNext(); // "material"
- iValue = object->RetMaterial();
+ iValue = object->GetMaterial();
pVar->SetValInt(iValue);
// Updates the type of battery.
pVar = pVar->GetNext(); // "energyCell"
- power = object->RetPower();
+ power = object->GetPower();
if ( power == 0 ) pVar->SetPointer(0);
- else pVar->SetPointer(power->RetBotVar());
+ else pVar->SetPointer(power->GetBotVar());
// Updates the transported object's type.
pVar = pVar->GetNext(); // "load"
- fret = object->RetFret();
+ fret = object->GetFret();
if ( fret == 0 ) pVar->SetPointer(0);
- else pVar->SetPointer(fret->RetBotVar());
+ else pVar->SetPointer(fret->GetBotVar());
}
@@ -225,15 +223,15 @@ CObject::CObject(CInstanceManager* iMan)
m_iMan = iMan;
m_iMan->AddInstance(CLASS_OBJECT, this, 500);
- m_engine = (CD3DEngine*)m_iMan->SearchInstance(CLASS_ENGINE);
- m_light = (CLight*)m_iMan->SearchInstance(CLASS_LIGHT);
- m_terrain = (CTerrain*)m_iMan->SearchInstance(CLASS_TERRAIN);
- m_water = (CWater*)m_iMan->SearchInstance(CLASS_WATER);
- m_particule = (CParticule*)m_iMan->SearchInstance(CLASS_PARTICULE);
- m_camera = (CCamera*)m_iMan->SearchInstance(CLASS_CAMERA);
- m_displayText = (CDisplayText*)m_iMan->SearchInstance(CLASS_DISPLAYTEXT);
- m_main = (CRobotMain*)m_iMan->SearchInstance(CLASS_MAIN);
- m_sound = (CSound*)m_iMan->SearchInstance(CLASS_SOUND);
+ m_engine = static_cast<Gfx::CEngine*>(m_iMan->SearchInstance(CLASS_ENGINE));
+ m_lightMan = static_cast<Gfx::CLightManager*>(m_iMan->SearchInstance(CLASS_LIGHT));
+ m_terrain = static_cast<Gfx::CTerrain*>(m_iMan->SearchInstance(CLASS_TERRAIN));
+ m_water = static_cast<Gfx::CWater*>(m_iMan->SearchInstance(CLASS_WATER));
+ m_particle = static_cast<Gfx::CParticle*>(m_iMan->SearchInstance(CLASS_PARTICULE));
+ m_camera = static_cast<Gfx::CCamera*>(m_iMan->SearchInstance(CLASS_CAMERA));
+ m_displayText = static_cast<Ui::CDisplayText*>(m_iMan->SearchInstance(CLASS_DISPLAYTEXT));
+ m_main = static_cast<CRobotMain*>(m_iMan->SearchInstance(CLASS_MAIN));
+ m_sound = static_cast<CSoundInterface*>(m_iMan->SearchInstance(CLASS_SOUND));
m_physics = 0;
m_brain = 0;
m_motion = 0;
@@ -250,7 +248,7 @@ CObject::CObject(CInstanceManager* iMan)
m_linVibration = Math::Vector(0.0f, 0.0f, 0.0f);
m_cirVibration = Math::Vector(0.0f, 0.0f, 0.0f);
m_inclinaison = Math::Vector(0.0f, 0.0f, 0.0f);
- m_lastParticule = 0.0f;
+ m_lastParticle = 0.0f;
m_power = 0;
m_fret = 0;
@@ -281,7 +279,7 @@ CObject::CObject(CInstanceManager* iMan)
m_shotTime = 0.0f;
m_bVirusMode = false;
m_virusTime = 0.0f;
- m_lastVirusParticule = 0.0f;
+ m_lastVirusParticle = 0.0f;
m_totalDesectList = 0;
m_bLock = false;
m_bExplo = false;
@@ -297,7 +295,7 @@ CObject::CObject(CInstanceManager* iMan)
m_proxyDistance = 60.0f;
m_param = 0.0f;
- ZeroMemory(&m_character, sizeof(Character));
+ memset(&m_character, 0, sizeof(m_character));
m_character.wheelFront = 1.0f;
m_character.wheelBack = 1.0f;
m_character.wheelLeft = 1.0f;
@@ -309,7 +307,7 @@ CObject::CObject(CInstanceManager* iMan)
m_resetAngle = Math::Vector(0.0f, 0.0f, 0.0f);
m_resetRun = -1;
- m_cameraType = CAMERA_BACK;
+ m_cameraType = Gfx::CAM_TYPE_BACK;
m_cameraDist = 50.0f;
m_bCameraLock = false;
@@ -376,7 +374,7 @@ CObject::~CObject()
void CObject::DeleteObject(bool bAll)
{
CObject* pObj;
- CPyro* pPyro;
+ Gfx::CPyro* pPyro;
int i;
if ( m_botVar != 0 )
@@ -384,14 +382,14 @@ void CObject::DeleteObject(bool bAll)
m_botVar->SetUserPtr(OBJECTDELETED);
}
- if ( m_camera->RetObject() == this )
+ if ( m_camera->GetControllingObject() == this )
{
- m_camera->SetObject(0);
+ m_camera->SetControllingObject(0);
}
for ( i=0 ; i<1000000 ; i++ )
{
- pObj = (CObject*)m_iMan->SearchInstance(CLASS_OBJECT, i);
+ pObj = static_cast<CObject*>(m_iMan->SearchInstance(CLASS_OBJECT, i));
if ( pObj == 0 ) break;
pObj->DeleteDeselList(this);
@@ -400,29 +398,29 @@ void CObject::DeleteObject(bool bAll)
if ( !bAll )
{
#if 0
- type = m_camera->RetType();
- if ( (type == CAMERA_BACK ||
- type == CAMERA_FIX ||
- type == CAMERA_EXPLO ||
- type == CAMERA_ONBOARD) &&
- m_camera->RetObject() == this )
+ type = m_camera->GetType();
+ if ( (type == Gfx::CAM_TYPE_BACK ||
+ type == Gfx::CAM_TYPE_FIX ||
+ type == Gfx::CAM_TYPE_EXPLO ||
+ type == Gfx::CAM_TYPE_ONBOARD) &&
+ m_camera->GetControllingObject() == this )
{
- pObj = m_main->SearchNearest(RetPosition(0), this);
+ pObj = m_main->SearchNearest(GetPosition(0), this);
if ( pObj == 0 )
{
- m_camera->SetObject(0);
- m_camera->SetType(CAMERA_FREE);
+ m_camera->SetControllingObject(0);
+ m_camera->SetType(Gfx::CAM_TYPE_FREE);
}
else
{
- m_camera->SetObject(pObj);
- m_camera->SetType(CAMERA_BACK);
+ m_camera->SetControllingObject(pObj);
+ m_camera->SetType(Gfx::CAM_TYPE_BACK);
}
}
#endif
for ( i=0 ; i<1000000 ; i++ )
{
- pPyro = (CPyro*)m_iMan->SearchInstance(CLASS_PYRO, i);
+ pPyro = static_cast<Gfx::CPyro*>(m_iMan->SearchInstance(CLASS_PYRO, i));
if ( pPyro == 0 ) break;
pPyro->CutObjectLink(this); // the object no longer exists
@@ -453,7 +451,7 @@ void CObject::DeleteObject(bool bAll)
m_type == OBJECT_START ||
m_type == OBJECT_END ) // building?
{
- m_terrain->DeleteBuildingLevel(RetPosition(0)); // flattens the field
+ m_terrain->DeleteBuildingLevel(GetPosition(0)); // flattens the field
}
}
@@ -461,19 +459,19 @@ void CObject::DeleteObject(bool bAll)
if ( m_partiReactor != -1 )
{
- m_particule->DeleteParticule(m_partiReactor);
+ m_particle->DeleteParticle(m_partiReactor);
m_partiReactor = -1;
}
if ( m_shadowLight != -1 )
{
- m_light->DeleteLight(m_shadowLight);
+ m_lightMan->DeleteLight(m_shadowLight);
m_shadowLight = -1;
}
if ( m_effectLight != -1 )
{
- m_light->DeleteLight(m_effectLight);
+ m_lightMan->DeleteLight(m_effectLight);
m_effectLight = -1;
}
@@ -506,7 +504,7 @@ void CObject::DeleteObject(bool bAll)
if ( m_objectPart[i].masterParti != -1 )
{
- m_particule->DeleteParticule(m_objectPart[i].masterParti);
+ m_particle->DeleteParticle(m_objectPart[i].masterParti);
m_objectPart[i].masterParti = -1;
}
}
@@ -569,8 +567,8 @@ void CObject::Simplify()
bool CObject::ExploObject(ExploType type, float force, float decay)
{
- PyroType pyroType;
- CPyro* pyro;
+ Gfx::PyroType pyroType;
+ Gfx::CPyro* pyro;
float loss, shield;
if ( type == EXPLO_BURN )
@@ -627,7 +625,7 @@ bool CObject::ExploObject(ExploType type, float force, float decay)
loss *= decay;
// Decreases the power of the shield.
- shield = RetShield();
+ shield = GetShield();
shield -= loss;
if ( shield < 0.0f ) shield = 0.0f;
SetShield(shield);
@@ -638,26 +636,26 @@ bool CObject::ExploObject(ExploType type, float force, float decay)
{
if ( m_type == OBJECT_HUMAN )
{
- pyroType = PT_SHOTH;
+ pyroType = Gfx::PT_SHOTH;
}
else
{
- pyroType = PT_SHOTW;
+ pyroType = Gfx::PT_SHOTW;
}
}
else
{
if ( m_type == OBJECT_HUMAN )
{
- pyroType = PT_SHOTH;
+ pyroType = Gfx::PT_SHOTH;
}
else if ( m_type == OBJECT_MOTHER )
{
- pyroType = PT_SHOTM;
+ pyroType = Gfx::PT_SHOTM;
}
else
{
- pyroType = PT_SHOTT;
+ pyroType = Gfx::PT_SHOTT;
}
}
}
@@ -672,16 +670,16 @@ bool CObject::ExploObject(ExploType type, float force, float decay)
m_type == OBJECT_WORM ||
m_type == OBJECT_BULLET )
{
- pyroType = PT_BURNO;
+ pyroType = Gfx::PT_BURNO;
SetBurn(true);
}
else if ( m_type == OBJECT_HUMAN )
{
- pyroType = PT_DEADG;
+ pyroType = Gfx::PT_DEADG;
}
else
{
- pyroType = PT_BURNT;
+ pyroType = Gfx::PT_BURNT;
SetBurn(true);
}
SetVirusMode(false);
@@ -690,11 +688,11 @@ bool CObject::ExploObject(ExploType type, float force, float decay)
{
if ( m_type == OBJECT_HUMAN )
{
- pyroType = PT_DEADW;
+ pyroType = Gfx::PT_DEADW;
}
else
{
- pyroType = PT_FRAGW;
+ pyroType = Gfx::PT_FRAGW;
}
}
else // explosion?
@@ -704,17 +702,17 @@ bool CObject::ExploObject(ExploType type, float force, float decay)
m_type == OBJECT_BEE ||
m_type == OBJECT_WORM )
{
- pyroType = PT_EXPLOO;
+ pyroType = Gfx::PT_EXPLOO;
}
else if ( m_type == OBJECT_MOTHER ||
m_type == OBJECT_NEST ||
m_type == OBJECT_BULLET )
{
- pyroType = PT_FRAGO;
+ pyroType = Gfx::PT_FRAGO;
}
else if ( m_type == OBJECT_HUMAN )
{
- pyroType = PT_DEADG;
+ pyroType = Gfx::PT_DEADG;
}
else if ( m_type == OBJECT_BASE ||
m_type == OBJECT_DERRICK ||
@@ -737,24 +735,24 @@ bool CObject::ExploObject(ExploType type, float force, float decay)
m_type == OBJECT_START ||
m_type == OBJECT_END ) // building?
{
- pyroType = PT_FRAGT;
+ pyroType = Gfx::PT_FRAGT;
}
else if ( m_type == OBJECT_MOBILEtg ||
m_type == OBJECT_TEEN28 || // cylinder?
m_type == OBJECT_TEEN31 ) // basket?
{
- pyroType = PT_FRAGT;
+ pyroType = Gfx::PT_FRAGT;
}
else
{
- pyroType = PT_EXPLOT;
+ pyroType = Gfx::PT_EXPLOT;
}
}
loss = 1.0f;
}
- pyro = new CPyro(m_iMan);
+ pyro = new Gfx::CPyro(m_iMan);
pyro->Create(pyroType, this, loss);
if ( shield == 0.0f ) // dead?
@@ -768,10 +766,10 @@ bool CObject::ExploObject(ExploType type, float force, float decay)
if ( shield > 0.0f ) return false; // not dead yet
- if ( RetSelect() )
+ if ( GetSelect() )
{
SetSelect(false); // deselects the object
- m_camera->SetType(CAMERA_EXPLO);
+ m_camera->SetType(Gfx::CAM_TYPE_EXPLO);
m_main->DeselectAll();
}
DeleteDeselList(this);
@@ -830,7 +828,7 @@ void CObject::InitPart(int part)
}
// Creates a new part, and returns its number.
-// Returns -1 on error.
+// Geturns -1 on error.
int CObject::CreatePart()
{
@@ -855,7 +853,7 @@ void CObject::DeletePart(int part)
if ( m_objectPart[part].masterParti != -1 )
{
- m_particule->DeleteParticule(m_objectPart[part].masterParti);
+ m_particle->DeleteParticle(m_objectPart[part].masterParti);
m_objectPart[part].masterParti = -1;
}
@@ -891,9 +889,9 @@ void CObject::SetObjectRank(int part, int objRank)
m_objectPart[part].object = objRank;
}
-// Returns the number of part.
+// Geturns the number of part.
-int CObject::RetObjectRank(int part)
+int CObject::GetObjectRank(int part)
{
if ( !m_objectPart[part].bUsed ) return -1;
return m_objectPart[part].object;
@@ -914,7 +912,7 @@ void CObject::SetObjectParent(int part, int parent)
void CObject::SetType(ObjectType type)
{
m_type = type;
- strcpy(m_name, RetObjectName(m_type));
+ strcpy(m_name, GetObjectName(m_type));
if ( m_type == OBJECT_MOBILErs )
{
@@ -940,16 +938,16 @@ void CObject::SetType(ObjectType type)
m_type == OBJECT_MOBILEii ||
m_type == OBJECT_MOBILErc ) // cannon vehicle?
{
- m_cameraType = CAMERA_ONBOARD;
+ m_cameraType = Gfx::CAM_TYPE_ONBOARD;
}
}
-ObjectType CObject::RetType()
+ObjectType CObject::GetType()
{
return m_type;
}
-char* CObject::RetName()
+char* CObject::GetName()
{
return m_name;
}
@@ -962,7 +960,7 @@ void CObject::SetOption(int option)
m_option = option;
}
-int CObject::RetOption()
+int CObject::GetOption()
{
return m_option;
}
@@ -980,7 +978,7 @@ void CObject::SetID(int id)
}
}
-int CObject::RetID()
+int CObject::GetID()
{
return m_id;
}
@@ -996,115 +994,115 @@ bool CObject::Write(char *line)
float value;
int i;
- sprintf(name, " camera=%s", GetCamera(RetCameraType()));
+ sprintf(name, " camera=%s", GetCamera(GetCameraType()));
strcat(line, name);
- if ( RetCameraLock() != 0 )
+ if ( GetCameraLock() != 0 )
{
- sprintf(name, " cameraLock=%d", RetCameraLock());
+ sprintf(name, " cameraLock=%d", GetCameraLock());
strcat(line, name);
}
- if ( RetEnergy() != 0.0f )
+ if ( GetEnergy() != 0.0f )
{
- sprintf(name, " energy=%.2f", RetEnergy());
+ sprintf(name, " energy=%.2f", GetEnergy());
strcat(line, name);
}
- if ( RetCapacity() != 1.0f )
+ if ( GetCapacity() != 1.0f )
{
- sprintf(name, " capacity=%.2f", RetCapacity());
+ sprintf(name, " capacity=%.2f", GetCapacity());
strcat(line, name);
}
- if ( RetShield() != 1.0f )
+ if ( GetShield() != 1.0f )
{
- sprintf(name, " shield=%.2f", RetShield());
+ sprintf(name, " shield=%.2f", GetShield());
strcat(line, name);
}
- if ( RetRange() != 1.0f )
+ if ( GetRange() != 1.0f )
{
- sprintf(name, " range=%.2f", RetRange());
+ sprintf(name, " range=%.2f", GetRange());
strcat(line, name);
}
- if ( RetSelectable() != 1 )
+ if ( GetSelectable() != 1 )
{
- sprintf(name, " selectable=%d", RetSelectable());
+ sprintf(name, " selectable=%d", GetSelectable());
strcat(line, name);
}
- if ( RetEnable() != 1 )
+ if ( GetEnable() != 1 )
{
- sprintf(name, " enable=%d", RetEnable());
+ sprintf(name, " enable=%d", GetEnable());
strcat(line, name);
}
- if ( RetFixed() != 0 )
+ if ( GetFixed() != 0 )
{
- sprintf(name, " fixed=%d", RetFixed());
+ sprintf(name, " fixed=%d", GetFixed());
strcat(line, name);
}
- if ( RetClip() != 1 )
+ if ( GetClip() != 1 )
{
- sprintf(name, " clip=%d", RetClip());
+ sprintf(name, " clip=%d", GetClip());
strcat(line, name);
}
- if ( RetLock() != 0 )
+ if ( GetLock() != 0 )
{
- sprintf(name, " lock=%d", RetLock());
+ sprintf(name, " lock=%d", GetLock());
strcat(line, name);
}
- if ( RetProxyActivate() != 0 )
+ if ( GetProxyActivate() != 0 )
{
- sprintf(name, " proxyActivate=%d", RetProxyActivate());
+ sprintf(name, " proxyActivate=%d", GetProxyActivate());
strcat(line, name);
- sprintf(name, " proxyDistance=%.2f", RetProxyDistance()/g_unit);
+ sprintf(name, " proxyDistance=%.2f", GetProxyDistance()/g_unit);
strcat(line, name);
}
- if ( RetMagnifyDamage() != 1.0f )
+ if ( GetMagnifyDamage() != 1.0f )
{
- sprintf(name, " magnifyDamage=%.2f", RetMagnifyDamage());
+ sprintf(name, " magnifyDamage=%.2f", GetMagnifyDamage());
strcat(line, name);
}
- if ( RetGunGoalV() != 0.0f )
+ if ( GetGunGoalV() != 0.0f )
{
- sprintf(name, " aimV=%.2f", RetGunGoalV());
+ sprintf(name, " aimV=%.2f", GetGunGoalV());
strcat(line, name);
}
- if ( RetGunGoalH() != 0.0f )
+ if ( GetGunGoalH() != 0.0f )
{
- sprintf(name, " aimH=%.2f", RetGunGoalH());
+ sprintf(name, " aimH=%.2f", GetGunGoalH());
strcat(line, name);
}
- if ( RetParam() != 0.0f )
+ if ( GetParam() != 0.0f )
{
- sprintf(name, " param=%.2f", RetParam());
+ sprintf(name, " param=%.2f", GetParam());
strcat(line, name);
}
- if ( RetResetCap() != 0 )
+ if ( GetResetCap() != 0 )
{
- sprintf(name, " resetCap=%d", RetResetCap());
+ sprintf(name, " resetCap=%d", GetResetCap());
strcat(line, name);
- pos = RetResetPosition()/g_unit;
+ pos = GetResetPosition()/g_unit;
sprintf(name, " resetPos=%.2f;%.2f;%.2f", pos.x, pos.y, pos.z);
strcat(line, name);
- pos = RetResetAngle()/(Math::PI/180.0f);
+ pos = GetResetAngle()/(Math::PI/180.0f);
sprintf(name, " resetAngle=%.2f;%.2f;%.2f", pos.x, pos.y, pos.z);
strcat(line, name);
- sprintf(name, " resetRun=%d", RetResetRun());
+ sprintf(name, " resetRun=%d", GetResetRun());
strcat(line, name);
}
@@ -1123,7 +1121,7 @@ bool CObject::Write(char *line)
// Puts information in terminal (OBJECT_INFO).
for ( i=0 ; i<m_infoTotal ; i++ )
{
- info = RetInfo(i);
+ info = GetInfo(i);
if ( info.name[0] == 0 ) break;
sprintf(name, " info%d=\"%s=%.2f\"", i+1, info.name, info.value);
@@ -1133,7 +1131,7 @@ bool CObject::Write(char *line)
// Sets the parameters of the command line.
for ( i=0 ; i<OBJECTMAXCMDLINE ; i++ )
{
- value = RetCmdLine(i);
+ value = GetCmdLine(i);
if ( value == NAN ) break;
if ( i == 0 ) sprintf(name, " cmdline=%.2f", value);
@@ -1164,21 +1162,21 @@ bool CObject::Write(char *line)
return true;
}
-// Returns all parameters of the object.
+// Geturns all parameters of the object.
bool CObject::Read(char *line)
{
Math::Vector pos, dir;
- Info info;
- CameraType cType;
- char op[20];
- char text[100];
- char* p;
- float value;
- int i;
+ Info info;
+ Gfx::CameraType cType;
+ char op[20];
+ char text[100];
+ char* p;
+ float value;
+ int i;
cType = OpCamera(line, "camera");
- if ( cType != CAMERA_NULL )
+ if ( cType != Gfx::CAM_TYPE_NULL )
{
SetCameraType(cType);
}
@@ -1200,7 +1198,7 @@ bool CObject::Read(char *line)
SetGunGoalV(OpFloat(line, "aimV", 0.0f));
SetGunGoalH(OpFloat(line, "aimH", 0.0f));
SetParam(OpFloat(line, "param", 0.0f));
- SetResetCap((ResetCap)OpInt(line, "resetCap", 0));
+ SetResetCap(static_cast<ResetCap>(OpInt(line, "resetCap", 0)));
SetResetPosition(OpDir(line, "resetPos")*g_unit);
SetResetAngle(OpDir(line, "resetAngle")*(Math::PI/180.0f));
SetResetRun(OpInt(line, "resetRun", 0));
@@ -1291,7 +1289,7 @@ int CObject::CreateCrashSphere(Math::Vector pos, float radius, Sound sound,
if ( m_crashSphereUsed >= MAXCRASHSPHERE ) return -1;
- zoom = RetZoomX(0);
+ zoom = GetZoomX(0);
m_crashSpherePos[m_crashSphereUsed] = pos;
m_crashSphereRadius[m_crashSphereUsed] = radius*zoom;
m_crashSphereHardness[m_crashSphereUsed] = hardness;
@@ -1299,14 +1297,14 @@ int CObject::CreateCrashSphere(Math::Vector pos, float radius, Sound sound,
return m_crashSphereUsed++;
}
-// Returns the number of spheres.
+// Geturns the number of spheres.
-int CObject::RetCrashSphereTotal()
+int CObject::GetCrashSphereTotal()
{
return m_crashSphereUsed;
}
-// Returns a sphere for collisions.
+// Geturns a sphere for collisions.
// The position is absolute in the world.
bool CObject::GetCrashSphere(int rank, Math::Vector &pos, float &radius)
@@ -1318,7 +1316,7 @@ bool CObject::GetCrashSphere(int rank, Math::Vector &pos, float &radius)
return false;
}
- // Returns to the sphere collisions,
+ // Geturns to the sphere collisions,
// which ignores the inclination of the vehicle.
// This is necessary to collisions with vehicles,
// so as not to reflect SetInclinaison, for example.
@@ -1342,16 +1340,16 @@ bool CObject::GetCrashSphere(int rank, Math::Vector &pos, float &radius)
return true;
}
-// Returns the hardness of a sphere.
+// Geturns the hardness of a sphere.
-Sound CObject::RetCrashSphereSound(int rank)
+Sound CObject::GetCrashSphereSound(int rank)
{
return m_crashSphereSound[rank];
}
-// Returns the hardness of a sphere.
+// Geturns the hardness of a sphere.
-float CObject::RetCrashSphereHardness(int rank)
+float CObject::GetCrashSphereHardness(int rank)
{
return m_crashSphereHardness[rank];
}
@@ -1378,12 +1376,12 @@ void CObject::SetGlobalSphere(Math::Vector pos, float radius)
{
float zoom;
- zoom = RetZoomX(0);
+ zoom = GetZoomX(0);
m_globalSpherePos = pos;
m_globalSphereRadius = radius*zoom;
}
-// Returns the global sphere, in the world.
+// Geturns the global sphere, in the world.
void CObject::GetGlobalSphere(Math::Vector &pos, float &radius)
{
@@ -1416,9 +1414,9 @@ void CObject::SetShieldRadius(float radius)
m_shieldRadius = radius;
}
-// Returns the radius of the shield.
+// Geturns the radius of the shield.
-float CObject::RetShieldRadius()
+float CObject::GetShieldRadius()
{
return m_shieldRadius;
}
@@ -1431,7 +1429,7 @@ void CObject::SetFloorHeight(float height)
Math::Vector pos;
pos = m_objectPart[0].position;
- m_terrain->MoveOnFloor(pos);
+ m_terrain->AdjustToFloor(pos);
if ( m_physics != 0 )
{
@@ -1451,7 +1449,7 @@ void CObject::FloorAdjust()
Math::Point nn;
float a;
- pos = RetPosition(0);
+ pos = GetPosition(0);
if ( m_terrain->GetNormal(n, pos) )
{
#if 0
@@ -1459,7 +1457,7 @@ void CObject::FloorAdjust()
SetAngleZ(0, -sinf(n.x));
SetAngleY(0, 0.0f);
#else
- a = RetAngleY(0);
+ a = GetAngleY(0);
nn = Math::RotatePoint(-a, Math::Point(n.z, n.x));
SetAngleX(0, sinf(nn.x));
SetAngleZ(0, -sinf(nn.y));
@@ -1481,7 +1479,7 @@ void CObject::SetLinVibration(Math::Vector dir)
}
}
-Math::Vector CObject::RetLinVibration()
+Math::Vector CObject::GetLinVibration()
{
return m_linVibration;
}
@@ -1499,7 +1497,7 @@ void CObject::SetCirVibration(Math::Vector dir)
}
}
-Math::Vector CObject::RetCirVibration()
+Math::Vector CObject::GetCirVibration()
{
return m_cirVibration;
}
@@ -1517,7 +1515,7 @@ void CObject::SetInclinaison(Math::Vector dir)
}
}
-Math::Vector CObject::RetInclinaison()
+Math::Vector CObject::GetInclinaison()
{
return m_inclinaison;
}
@@ -1539,10 +1537,10 @@ void CObject::SetPosition(int part, const Math::Vector &pos)
rank = m_objectPart[0].object;
shPos = pos;
- m_terrain->MoveOnFloor(shPos, true);
+ m_terrain->AdjustToFloor(shPos, true);
m_engine->SetObjectShadowPos(rank, shPos);
- if ( m_physics != 0 && m_physics->RetType() == TYPE_FLYING )
+ if ( m_physics != 0 && m_physics->GetType() == TYPE_FLYING )
{
height = pos.y-shPos.y;
}
@@ -1554,7 +1552,7 @@ void CObject::SetPosition(int part, const Math::Vector &pos)
// Calculating the normal to the ground in nine strategic locations,
// then perform a weighted average (the dots in the center are more important).
- radius = m_engine->RetObjectShadowRadius(rank);
+ radius = m_engine->GetObjectShadowRadius(rank);
i = 0;
m_terrain->GetNormal(norm, pos);
@@ -1619,7 +1617,7 @@ void CObject::SetPosition(int part, const Math::Vector &pos)
{
norm += n[j];
}
- norm /= (float)i; // average vector
+ norm /= static_cast<float>(i); // average vector
m_engine->SetObjectShadowNormal(rank, norm);
@@ -1627,14 +1625,14 @@ void CObject::SetPosition(int part, const Math::Vector &pos)
{
shPos = pos;
shPos.y += m_shadowHeight;
- m_light->SetLightPos(m_shadowLight, shPos);
+ m_lightMan->SetLightPos(m_shadowLight, shPos);
}
if ( m_effectLight != -1 )
{
shPos = pos;
shPos.y += m_effectHeight;
- m_light->SetLightPos(m_effectLight, shPos);
+ m_lightMan->SetLightPos(m_effectLight, shPos);
}
if ( m_bShowLimit )
@@ -1644,7 +1642,7 @@ void CObject::SetPosition(int part, const Math::Vector &pos)
}
}
-Math::Vector CObject::RetPosition(int part)
+Math::Vector CObject::GetPosition(int part)
{
return m_objectPart[part].position;
}
@@ -1662,7 +1660,7 @@ void CObject::SetAngle(int part, const Math::Vector &angle)
}
}
-Math::Vector CObject::RetAngle(int part)
+Math::Vector CObject::GetAngle(int part)
{
return m_objectPart[part].angle;
}
@@ -1696,17 +1694,17 @@ void CObject::SetAngleZ(int part, float angle)
m_objectPart[part].bRotate = true; //it will recalculate the matrices
}
-float CObject::RetAngleY(int part)
+float CObject::GetAngleY(int part)
{
return m_objectPart[part].angle.y;
}
-float CObject::RetAngleX(int part)
+float CObject::GetAngleX(int part)
{
return m_objectPart[part].angle.x;
}
-float CObject::RetAngleZ(int part)
+float CObject::GetAngleZ(int part)
{
return m_objectPart[part].angle.z;
}
@@ -1736,7 +1734,7 @@ void CObject::SetZoom(int part, Math::Vector zoom)
m_objectPart[part].zoom.z != 1.0f );
}
-Math::Vector CObject::RetZoom(int part)
+Math::Vector CObject::GetZoom(int part)
{
return m_objectPart[part].zoom;
}
@@ -1771,27 +1769,27 @@ void CObject::SetZoomZ(int part, float zoom)
m_objectPart[part].zoom.z != 1.0f );
}
-float CObject::RetZoomX(int part)
+float CObject::GetZoomX(int part)
{
return m_objectPart[part].zoom.x;
}
-float CObject::RetZoomY(int part)
+float CObject::GetZoomY(int part)
{
return m_objectPart[part].zoom.y;
}
-float CObject::RetZoomZ(int part)
+float CObject::GetZoomZ(int part)
{
return m_objectPart[part].zoom.z;
}
-// Returns the water level.
+// Geturns the water level.
-float CObject::RetWaterLevel()
+float CObject::GetWaterLevel()
{
- return m_water->RetLevel();
+ return m_water->GetLevel();
}
@@ -1801,11 +1799,11 @@ void CObject::SetTrainer(bool bEnable)
if ( m_bTrainer ) // training?
{
- m_cameraType = CAMERA_FIX;
+ m_cameraType = Gfx::CAM_TYPE_FIX;
}
}
-bool CObject::RetTrainer()
+bool CObject::GetTrainer()
{
return m_bTrainer;
}
@@ -1815,7 +1813,7 @@ void CObject::SetToy(bool bEnable)
m_bToy = bEnable;
}
-bool CObject::RetToy()
+bool CObject::GetToy()
{
return m_bToy;
}
@@ -1825,7 +1823,7 @@ void CObject::SetManual(bool bManual)
m_bManual = bManual;
}
-bool CObject::RetManual()
+bool CObject::GetManual()
{
return m_bManual;
}
@@ -1835,7 +1833,7 @@ void CObject::SetResetCap(ResetCap cap)
m_resetCap = cap;
}
-ResetCap CObject::RetResetCap()
+ResetCap CObject::GetResetCap()
{
return m_resetCap;
}
@@ -1845,7 +1843,7 @@ void CObject::SetResetBusy(bool bBusy)
m_bResetBusy = bBusy;
}
-bool CObject::RetResetBusy()
+bool CObject::GetResetBusy()
{
return m_bResetBusy;
}
@@ -1855,7 +1853,7 @@ void CObject::SetResetPosition(const Math::Vector &pos)
m_resetPosition = pos;
}
-Math::Vector CObject::RetResetPosition()
+Math::Vector CObject::GetResetPosition()
{
return m_resetPosition;
}
@@ -1865,12 +1863,12 @@ void CObject::SetResetAngle(const Math::Vector &angle)
m_resetAngle = angle;
}
-Math::Vector CObject::RetResetAngle()
+Math::Vector CObject::GetResetAngle()
{
return m_resetAngle;
}
-int CObject::RetResetRun()
+int CObject::GetResetRun()
{
return m_resetRun;
}
@@ -1883,12 +1881,12 @@ void CObject::SetResetRun(int run)
// Management of the particle master.
-void CObject::SetMasterParticule(int part, int parti)
+void CObject::SetMasterParticle(int part, int parti)
{
m_objectPart[part].masterParti = parti;
}
-int CObject::RetMasterParticule(int part)
+int CObject::GetMasterParticle(int part)
{
return m_objectPart[part].masterParti;
}
@@ -1901,7 +1899,7 @@ void CObject::SetPower(CObject* power)
m_power = power;
}
-CObject* CObject::RetPower()
+CObject* CObject::GetPower()
{
return m_power;
}
@@ -1913,7 +1911,7 @@ void CObject::SetFret(CObject* fret)
m_fret = fret;
}
-CObject* CObject::RetFret()
+CObject* CObject::GetFret()
{
return m_fret;
}
@@ -1928,7 +1926,7 @@ void CObject::SetTruck(CObject* truck)
m_engine->SetObjectShadowHide(m_objectPart[0].object, (m_truck != 0));
}
-CObject* CObject::RetTruck()
+CObject* CObject::GetTruck()
{
return m_truck;
}
@@ -1940,7 +1938,7 @@ void CObject::SetTruckPart(int part)
m_truckLink = part;
}
-int CObject::RetTruckPart()
+int CObject::GetTruckPart()
{
return m_truckLink;
}
@@ -1977,13 +1975,13 @@ void CObject::SetInfo(int rank, Info info)
m_bInfoUpdate = true;
}
-Info CObject::RetInfo(int rank)
+Info CObject::GetInfo(int rank)
{
if ( rank < 0 || rank >= OBJECTMAXINFO ) rank = 0;
return m_info[rank];
}
-int CObject::RetInfoTotal()
+int CObject::GetInfoTotal()
{
return m_infoTotal;
}
@@ -1993,7 +1991,7 @@ void CObject::SetInfoReturn(float value)
m_infoReturn = value;
}
-float CObject::RetInfoReturn()
+float CObject::GetInfoReturn()
{
return m_infoReturn;
}
@@ -2003,7 +2001,7 @@ void CObject::SetInfoUpdate(bool bUpdate)
m_bInfoUpdate = bUpdate;
}
-bool CObject::RetInfoUpdate()
+bool CObject::GetInfoUpdate()
{
return m_bInfoUpdate;
}
@@ -2016,31 +2014,31 @@ bool CObject::SetCmdLine(int rank, float value)
return true;
}
-float CObject::RetCmdLine(int rank)
+float CObject::GetCmdLine(int rank)
{
if ( rank < 0 || rank >= OBJECTMAXCMDLINE ) return 0.0f;
return m_cmdLine[rank];
}
-// Returns matrices of an object portion.
+// Geturns matrices of an object portion.
-Math::Matrix* CObject::RetRotateMatrix(int part)
+Math::Matrix* CObject::GetRotateMatrix(int part)
{
return &m_objectPart[part].matRotate;
}
-Math::Matrix* CObject::RetTranslateMatrix(int part)
+Math::Matrix* CObject::GetTranslateMatrix(int part)
{
return &m_objectPart[part].matTranslate;
}
-Math::Matrix* CObject::RetTransformMatrix(int part)
+Math::Matrix* CObject::GetTransformMatrix(int part)
{
return &m_objectPart[part].matTransform;
}
-Math::Matrix* CObject::RetWorldMatrix(int part)
+Math::Matrix* CObject::GetWorldMatrix(int part)
{
if ( m_objectPart[0].bTranslate ||
m_objectPart[0].bRotate )
@@ -2062,7 +2060,7 @@ void CObject::SetDrawWorld(bool bDraw)
{
if ( m_objectPart[i].bUsed )
{
- m_engine->SetDrawWorld(m_objectPart[i].object, bDraw);
+ m_engine->SetObjectDrawWorld(m_objectPart[i].object, bDraw);
}
}
}
@@ -2077,7 +2075,7 @@ void CObject::SetDrawFront(bool bDraw)
{
if ( m_objectPart[i].bUsed )
{
- m_engine->SetDrawFront(m_objectPart[i].object, bDraw);
+ m_engine->SetObjectDrawFront(m_objectPart[i].object, bDraw);
}
}
}
@@ -2242,94 +2240,93 @@ bool CObject::CreateInsect(Math::Vector pos, float angle, ObjectType type)
// Creates shade under a vehicle as a negative light.
-bool CObject::CreateShadowLight(float height, D3DCOLORVALUE color)
+bool CObject::CreateShadowLight(float height, Gfx::Color color)
{
- D3DLIGHT7 light;
+ Gfx::Light light;
Math::Vector pos;
- if ( !m_engine->RetLightMode() ) return true;
+ if ( !m_engine->GetLightMode() ) return true;
- pos = RetPosition(0);
+ pos = GetPosition(0);
m_shadowHeight = height;
- ZeroMemory( &light, sizeof(light) );
- light.dltType = D3DLIGHT_SPOT;
- light.dcvDiffuse.r = color.r;
- light.dcvDiffuse.g = color.g;
- light.dcvDiffuse.b = color.b;
- light.dvPosition.x = pos.x;
- light.dvPosition.y = pos.y+height;
- light.dvPosition.z = pos.z;
- light.dvDirection.x = 0.0f;
- light.dvDirection.y = -1.0f; // against the bottom
- light.dvDirection.z = 0.0f;
- light.dvRange = D3DLIGHT_RANGE_MAX;
- light.dvFalloff = 1.0f;
- light.dvAttenuation0 = 1.0f;
- light.dvAttenuation1 = 0.0f;
- light.dvAttenuation2 = 0.0f;
- light.dvTheta = 0.0f;
- light.dvPhi = Math::PI/4.0f;
-
- m_shadowLight = m_light->CreateLight();
+ light.type = Gfx::LIGHT_SPOT;
+ light.diffuse.r = color.r;
+ light.diffuse.g = color.g;
+ light.diffuse.b = color.b;
+ light.position.x = pos.x;
+ light.position.y = pos.y+height;
+ light.position.z = pos.z;
+ light.direction.x = 0.0f;
+ light.direction.y = -1.0f; // against the bottom
+ light.direction.z = 0.0f;
+ //TODO Is this value correct
+ light.spotIntensity = 128;
+ light.attenuation0 = 1.0f;
+ light.attenuation1 = 0.0f;
+ light.attenuation2 = 0.0f;
+ //TODO Is this value correct
+ light.spotAngle = 90;
+
+ m_shadowLight = m_lightMan->CreateLight();
if ( m_shadowLight == -1 ) return false;
- m_light->SetLight(m_shadowLight, light);
+ m_lightMan->SetLight(m_shadowLight, light);
// Only illuminates the objects on the ground.
- m_light->SetLightIncluType(m_shadowLight, TYPETERRAIN);
+ m_lightMan->SetLightIncludeType(m_shadowLight, Gfx::ENG_OBJTYPE_TERRAIN);
return true;
}
-// Returns the number of negative light shade.
+// Geturns the number of negative light shade.
-int CObject::RetShadowLight()
+int CObject::GetShadowLight()
{
return m_shadowLight;
}
// Creates light for the effects of a vehicle.
-bool CObject::CreateEffectLight(float height, D3DCOLORVALUE color)
+bool CObject::CreateEffectLight(float height, Gfx::Color color)
{
- D3DLIGHT7 light;
+ Gfx::Light light;
- if ( !m_engine->RetLightMode() ) return true;
+ if ( !m_engine->GetLightMode() ) return true;
m_effectHeight = height;
- ZeroMemory( &light, sizeof(light) );
- light.dltType = D3DLIGHT_SPOT;
- light.dcvDiffuse.r = color.r;
- light.dcvDiffuse.g = color.g;
- light.dcvDiffuse.b = color.b;
- light.dvPosition.x = 0.0f;
- light.dvPosition.y = 0.0f+height;
- light.dvPosition.z = 0.0f;
- light.dvDirection.x = 0.0f;
- light.dvDirection.y = -1.0f; // against the bottom
- light.dvDirection.z = 0.0f;
- light.dvRange = D3DLIGHT_RANGE_MAX;
- light.dvFalloff = 1.0f;
- light.dvAttenuation0 = 1.0f;
- light.dvAttenuation1 = 0.0f;
- light.dvAttenuation2 = 0.0f;
- light.dvTheta = 0.0f;
- light.dvPhi = Math::PI/4.0f;
-
- m_effectLight = m_light->CreateLight();
+ memset( &light, 0, sizeof(light) );
+ light.type = Gfx::LIGHT_SPOT;
+ light.diffuse.r = color.r;
+ light.diffuse.g = color.g;
+ light.diffuse.b = color.b;
+ light.position.x = 0.0f;
+ light.position.y = 0.0f+height;
+ light.position.z = 0.0f;
+ light.direction.x = 0.0f;
+ light.direction.y = -1.0f; // against the bottom
+ light.direction.z = 0.0f;
+ //TODO Is this value correct
+ light.spotIntensity = 1.0f;
+ light.attenuation0 = 1.0f;
+ light.attenuation1 = 0.0f;
+ light.attenuation2 = 0.0f;
+ //TODO Is this value correct
+ light.spotAngle = 90;
+
+ m_effectLight = m_lightMan->CreateLight();
if ( m_effectLight == -1 ) return false;
- m_light->SetLight(m_effectLight, light);
- m_light->SetLightIntensity(m_effectLight, 0.0f);
+ m_lightMan->SetLight(m_effectLight, light);
+ m_lightMan->SetLightIntensity(m_effectLight, 0.0f);
return true;
}
-// Returns the number of light effects.
+// Geturns the number of light effects.
-int CObject::RetEffectLight()
+int CObject::GetEffectLight()
{
return m_effectLight;
}
@@ -2337,15 +2334,15 @@ int CObject::RetEffectLight()
// Creates the circular shadow underneath a vehicle.
bool CObject::CreateShadowCircle(float radius, float intensity,
- D3DShadowType type)
+ Gfx::EngineShadowType type)
{
float zoom;
if ( intensity == 0.0f ) return true;
- zoom = RetZoomX(0);
+ zoom = GetZoomX(0);
- m_engine->ShadowCreate(m_objectPart[0].object);
+ m_engine->CreateShadow(m_objectPart[0].object);
m_engine->SetObjectShadowRadius(m_objectPart[0].object, radius*zoom);
m_engine->SetObjectShadowIntensity(m_objectPart[0].object, intensity);
@@ -2361,18 +2358,16 @@ bool CObject::CreateShadowCircle(float radius, float intensity,
bool CObject::CreateBuilding(Math::Vector pos, float angle, float height,
ObjectType type, float power)
{
- CModFile* pModFile;
+ Gfx::CModelFile* pModFile;
Math::Point p;
int rank, i;
- if ( m_engine->RetRestCreate() < 20 ) return false;
-
- pModFile = new CModFile(m_iMan);
+ pModFile = new Gfx::CModelFile(m_iMan);
SetType(type);
rank = m_engine->CreateObject();
- m_engine->SetObjectType(rank, TYPEFIX); // it is a stationary object
+ m_engine->SetObjectType(rank, Gfx::ENG_OBJTYPE_FIX); // it is a stationary object
SetObjectRank(0, rank);
if ( m_type == OBJECT_PORTICO )
@@ -2384,7 +2379,7 @@ bool CObject::CreateBuilding(Math::Vector pos, float angle, float height,
SetFloorHeight(0.0f);
rank = m_engine->CreateObject();
- m_engine->SetObjectType(rank, TYPEDESCENDANT);
+ m_engine->SetObjectType(rank, Gfx::ENG_OBJTYPE_DESCENDANT);
SetObjectRank(1, rank);
SetObjectParent(1, 0);
pModFile->ReadModel("objects\\portico2.mod");
@@ -2392,7 +2387,7 @@ bool CObject::CreateBuilding(Math::Vector pos, float angle, float height,
SetPosition(1, Math::Vector(0.0f, 67.0f, 0.0f));
rank = m_engine->CreateObject();
- m_engine->SetObjectType(rank, TYPEDESCENDANT);
+ m_engine->SetObjectType(rank, Gfx::ENG_OBJTYPE_DESCENDANT);
SetObjectRank(2, rank);
SetObjectParent(2, 1);
pModFile->ReadModel("objects\\portico3.mod");
@@ -2401,7 +2396,7 @@ bool CObject::CreateBuilding(Math::Vector pos, float angle, float height,
SetAngleY(2, 45.0f*Math::PI/180.0f);
rank = m_engine->CreateObject();
- m_engine->SetObjectType(rank, TYPEDESCENDANT);
+ m_engine->SetObjectType(rank, Gfx::ENG_OBJTYPE_DESCENDANT);
SetObjectRank(3, rank);
SetObjectParent(3, 2);
pModFile->ReadModel("objects\\portico4.mod");
@@ -2410,7 +2405,7 @@ bool CObject::CreateBuilding(Math::Vector pos, float angle, float height,
SetAngleY(3, -60.0f*Math::PI/180.0f);
rank = m_engine->CreateObject();
- m_engine->SetObjectType(rank, TYPEDESCENDANT);
+ m_engine->SetObjectType(rank, Gfx::ENG_OBJTYPE_DESCENDANT);
SetObjectRank(4, rank);
SetObjectParent(4, 3);
pModFile->ReadModel("objects\\portico5.mod");
@@ -2419,7 +2414,7 @@ bool CObject::CreateBuilding(Math::Vector pos, float angle, float height,
SetAngleY(4, -55.0f*Math::PI/180.0f);
rank = m_engine->CreateObject();
- m_engine->SetObjectType(rank, TYPEDESCENDANT);
+ m_engine->SetObjectType(rank, Gfx::ENG_OBJTYPE_DESCENDANT);
SetObjectRank(5, rank);
SetObjectParent(5, 1);
pModFile->ReadModel("objects\\portico3.mod");
@@ -2428,7 +2423,7 @@ bool CObject::CreateBuilding(Math::Vector pos, float angle, float height,
SetAngleY(5, -45.0f*Math::PI/180.0f);
rank = m_engine->CreateObject();
- m_engine->SetObjectType(rank, TYPEDESCENDANT);
+ m_engine->SetObjectType(rank, Gfx::ENG_OBJTYPE_DESCENDANT);
SetObjectRank(6, rank);
SetObjectParent(6, 5);
pModFile->ReadModel("objects\\portico4.mod");
@@ -2437,7 +2432,7 @@ bool CObject::CreateBuilding(Math::Vector pos, float angle, float height,
SetAngleY(6, 60.0f*Math::PI/180.0f);
rank = m_engine->CreateObject();
- m_engine->SetObjectType(rank, TYPEDESCENDANT);
+ m_engine->SetObjectType(rank, Gfx::ENG_OBJTYPE_DESCENDANT);
SetObjectRank(7, rank);
SetObjectParent(7, 6);
pModFile->ReadModel("objects\\portico5.mod");
@@ -2446,7 +2441,7 @@ bool CObject::CreateBuilding(Math::Vector pos, float angle, float height,
SetAngleY(7, 55.0f*Math::PI/180.0f);
rank = m_engine->CreateObject();
- m_engine->SetObjectType(rank, TYPEDESCENDANT);
+ m_engine->SetObjectType(rank, Gfx::ENG_OBJTYPE_DESCENDANT);
SetObjectRank(8, rank);
SetObjectParent(8, 0);
pModFile->ReadModel("objects\\portico6.mod");
@@ -2456,7 +2451,7 @@ bool CObject::CreateBuilding(Math::Vector pos, float angle, float height,
SetZoom(8, 2.0f);
rank = m_engine->CreateObject();
- m_engine->SetObjectType(rank, TYPEDESCENDANT);
+ m_engine->SetObjectType(rank, Gfx::ENG_OBJTYPE_DESCENDANT);
SetObjectRank(9, rank);
SetObjectParent(9, 8);
pModFile->ReadModel("objects\\portico7.mod");
@@ -2464,7 +2459,7 @@ bool CObject::CreateBuilding(Math::Vector pos, float angle, float height,
SetPosition(9, Math::Vector(0.0f, 4.5f, 1.9f));
rank = m_engine->CreateObject();
- m_engine->SetObjectType(rank, TYPEDESCENDANT);
+ m_engine->SetObjectType(rank, Gfx::ENG_OBJTYPE_DESCENDANT);
SetObjectRank(10, rank);
SetObjectParent(10, 0);
pModFile->ReadModel("objects\\portico6.mod");
@@ -2474,7 +2469,7 @@ bool CObject::CreateBuilding(Math::Vector pos, float angle, float height,
SetZoom(10, 2.0f);
rank = m_engine->CreateObject();
- m_engine->SetObjectType(rank, TYPEDESCENDANT);
+ m_engine->SetObjectType(rank, Gfx::ENG_OBJTYPE_DESCENDANT);
SetObjectRank(11, rank);
SetObjectParent(11, 10);
pModFile->ReadModel("objects\\portico7.mod");
@@ -2508,7 +2503,7 @@ bool CObject::CreateBuilding(Math::Vector pos, float angle, float height,
for ( i=0 ; i<8 ; i++ )
{
rank = m_engine->CreateObject();
- m_engine->SetObjectType(rank, TYPEDESCENDANT);
+ m_engine->SetObjectType(rank, Gfx::ENG_OBJTYPE_DESCENDANT);
SetObjectRank(1+i, rank);
SetObjectParent(1+i, 0);
pModFile->ReadModel("objects\\base2.mod");
@@ -2519,7 +2514,7 @@ bool CObject::CreateBuilding(Math::Vector pos, float angle, float height,
SetAngleZ(1+i, Math::PI/2.0f);
rank = m_engine->CreateObject();
- m_engine->SetObjectType(rank, TYPEDESCENDANT);
+ m_engine->SetObjectType(rank, Gfx::ENG_OBJTYPE_DESCENDANT);
SetObjectRank(10+i, rank);
SetObjectParent(10+i, 1+i);
pModFile->ReadModel("objects\\base4.mod");
@@ -2527,7 +2522,7 @@ bool CObject::CreateBuilding(Math::Vector pos, float angle, float height,
SetPosition(10+i, Math::Vector(23.5f, 0.0f, 7.0f));
rank = m_engine->CreateObject();
- m_engine->SetObjectType(rank, TYPEDESCENDANT);
+ m_engine->SetObjectType(rank, Gfx::ENG_OBJTYPE_DESCENDANT);
SetObjectRank(18+i, rank);
SetObjectParent(18+i, 1+i);
pModFile->ReadModel("objects\\base4.mod");
@@ -2537,7 +2532,7 @@ bool CObject::CreateBuilding(Math::Vector pos, float angle, float height,
}
rank = m_engine->CreateObject();
- m_engine->SetObjectType(rank, TYPEDESCENDANT);
+ m_engine->SetObjectType(rank, Gfx::ENG_OBJTYPE_DESCENDANT);
SetObjectRank(9, rank);
SetObjectParent(9, 0);
pModFile->ReadModel("objects\\base3.mod"); // central pillar
@@ -2578,7 +2573,7 @@ bool CObject::CreateBuilding(Math::Vector pos, float angle, float height,
SetFloorHeight(0.0f);
rank = m_engine->CreateObject();
- m_engine->SetObjectType(rank, TYPEDESCENDANT);
+ m_engine->SetObjectType(rank, Gfx::ENG_OBJTYPE_DESCENDANT);
SetObjectRank(1, rank);
SetObjectParent(1, 0);
pModFile->ReadModel("objects\\derrick2.mod");
@@ -2603,7 +2598,7 @@ bool CObject::CreateBuilding(Math::Vector pos, float angle, float height,
SetFloorHeight(0.0f);
rank = m_engine->CreateObject();
- m_engine->SetObjectType(rank, TYPEDESCENDANT);
+ m_engine->SetObjectType(rank, Gfx::ENG_OBJTYPE_DESCENDANT);
SetObjectRank(1, rank);
SetObjectParent(1, 0);
pModFile->ReadModel("objects\\search2.mod");
@@ -2611,7 +2606,7 @@ bool CObject::CreateBuilding(Math::Vector pos, float angle, float height,
SetPosition(1, Math::Vector(0.0f, 13.0f, 0.0f));
rank = m_engine->CreateObject();
- m_engine->SetObjectType(rank, TYPEDESCENDANT);
+ m_engine->SetObjectType(rank, Gfx::ENG_OBJTYPE_DESCENDANT);
SetObjectRank(2, rank);
SetObjectParent(2, 1);
pModFile->ReadModel("objects\\search3.mod");
@@ -2638,7 +2633,7 @@ bool CObject::CreateBuilding(Math::Vector pos, float angle, float height,
SetFloorHeight(0.0f);
rank = m_engine->CreateObject();
- m_engine->SetObjectType(rank, TYPEDESCENDANT);
+ m_engine->SetObjectType(rank, Gfx::ENG_OBJTYPE_DESCENDANT);
SetObjectRank(1, rank);
SetObjectParent(1, 0);
pModFile->ReadModel("objects\\radar2.mod");
@@ -2646,7 +2641,7 @@ bool CObject::CreateBuilding(Math::Vector pos, float angle, float height,
SetPosition(1, Math::Vector(0.0f, 5.0f, 0.0f));
rank = m_engine->CreateObject();
- m_engine->SetObjectType(rank, TYPEDESCENDANT);
+ m_engine->SetObjectType(rank, Gfx::ENG_OBJTYPE_DESCENDANT);
SetObjectRank(2, rank);
SetObjectParent(2, 0);
pModFile->ReadModel("objects\\radar3.mod");
@@ -2655,7 +2650,7 @@ bool CObject::CreateBuilding(Math::Vector pos, float angle, float height,
SetAngleY(2, -Math::PI/2.0f);
rank = m_engine->CreateObject();
- m_engine->SetObjectType(rank, TYPEDESCENDANT);
+ m_engine->SetObjectType(rank, Gfx::ENG_OBJTYPE_DESCENDANT);
SetObjectRank(3, rank);
SetObjectParent(3, 2);
pModFile->ReadModel("objects\\radar4.mod");
@@ -2678,7 +2673,7 @@ bool CObject::CreateBuilding(Math::Vector pos, float angle, float height,
SetFloorHeight(0.0f);
rank = m_engine->CreateObject();
- m_engine->SetObjectType(rank, TYPEDESCENDANT);
+ m_engine->SetObjectType(rank, Gfx::ENG_OBJTYPE_DESCENDANT);
SetObjectRank(1, rank);
SetObjectParent(1, 0);
pModFile->ReadModel("objects\\info2.mod");
@@ -2688,7 +2683,7 @@ bool CObject::CreateBuilding(Math::Vector pos, float angle, float height,
for ( i=0 ; i<3 ; i++ )
{
rank = m_engine->CreateObject();
- m_engine->SetObjectType(rank, TYPEDESCENDANT);
+ m_engine->SetObjectType(rank, Gfx::ENG_OBJTYPE_DESCENDANT);
SetObjectRank(2+i*2, rank);
SetObjectParent(2+i*2, 1);
pModFile->ReadModel("objects\\info3.mod");
@@ -2696,7 +2691,7 @@ bool CObject::CreateBuilding(Math::Vector pos, float angle, float height,
SetPosition(2+i*2, Math::Vector(0.0f, 4.5f, 0.0f));
rank = m_engine->CreateObject();
- m_engine->SetObjectType(rank, TYPEDESCENDANT);
+ m_engine->SetObjectType(rank, Gfx::ENG_OBJTYPE_DESCENDANT);
SetObjectRank(3+i*2, rank);
SetObjectParent(3+i*2, 2+i*2);
pModFile->ReadModel("objects\\radar4.mod");
@@ -2741,7 +2736,7 @@ bool CObject::CreateBuilding(Math::Vector pos, float angle, float height,
SetFloorHeight(0.0f);
rank = m_engine->CreateObject();
- m_engine->SetObjectType(rank, TYPEDESCENDANT);
+ m_engine->SetObjectType(rank, Gfx::ENG_OBJTYPE_DESCENDANT);
SetObjectRank(1, rank);
SetObjectParent(1, 0);
pModFile->ReadModel("objects\\labo2.mod");
@@ -2750,7 +2745,7 @@ bool CObject::CreateBuilding(Math::Vector pos, float angle, float height,
SetAngleZ(1, Math::PI/2.0f);
rank = m_engine->CreateObject();
- m_engine->SetObjectType(rank, TYPEDESCENDANT);
+ m_engine->SetObjectType(rank, Gfx::ENG_OBJTYPE_DESCENDANT);
SetObjectRank(2, rank);
SetObjectParent(2, 1);
pModFile->ReadModel("objects\\labo3.mod");
@@ -2758,7 +2753,7 @@ bool CObject::CreateBuilding(Math::Vector pos, float angle, float height,
SetPosition(2, Math::Vector(9.0f, -1.0f, 0.0f));
rank = m_engine->CreateObject();
- m_engine->SetObjectType(rank, TYPEDESCENDANT);
+ m_engine->SetObjectType(rank, Gfx::ENG_OBJTYPE_DESCENDANT);
SetObjectRank(3, rank);
SetObjectParent(3, 2);
pModFile->ReadModel("objects\\labo4.mod");
@@ -2767,7 +2762,7 @@ bool CObject::CreateBuilding(Math::Vector pos, float angle, float height,
SetAngleZ(3, 80.0f*Math::PI/180.0f);
rank = m_engine->CreateObject();
- m_engine->SetObjectType(rank, TYPEDESCENDANT);
+ m_engine->SetObjectType(rank, Gfx::ENG_OBJTYPE_DESCENDANT);
SetObjectRank(4, rank);
SetObjectParent(4, 2);
pModFile->ReadModel("objects\\labo4.mod");
@@ -2777,7 +2772,7 @@ bool CObject::CreateBuilding(Math::Vector pos, float angle, float height,
SetAngleY(4, Math::PI*2.0f/3.0f);
rank = m_engine->CreateObject();
- m_engine->SetObjectType(rank, TYPEDESCENDANT);
+ m_engine->SetObjectType(rank, Gfx::ENG_OBJTYPE_DESCENDANT);
SetObjectRank(5, rank);
SetObjectParent(5, 2);
pModFile->ReadModel("objects\\labo4.mod");
@@ -2809,7 +2804,7 @@ bool CObject::CreateBuilding(Math::Vector pos, float angle, float height,
for ( i=0 ; i<9 ; i++ )
{
rank = m_engine->CreateObject();
- m_engine->SetObjectType(rank, TYPEDESCENDANT);
+ m_engine->SetObjectType(rank, Gfx::ENG_OBJTYPE_DESCENDANT);
SetObjectRank(1+i, rank);
SetObjectParent(1+i, 0);
pModFile->ReadModel("objects\\factory2.mod");
@@ -2819,7 +2814,7 @@ bool CObject::CreateBuilding(Math::Vector pos, float angle, float height,
SetZoomZ(1+i, 0.30f);
rank = m_engine->CreateObject();
- m_engine->SetObjectType(rank, TYPEDESCENDANT);
+ m_engine->SetObjectType(rank, Gfx::ENG_OBJTYPE_DESCENDANT);
SetObjectRank(10+i, rank);
SetObjectParent(10+i, 0);
pModFile->ReadModel("objects\\factory2.mod");
@@ -2832,7 +2827,7 @@ bool CObject::CreateBuilding(Math::Vector pos, float angle, float height,
for ( i=0 ; i<2 ; i++ )
{
- float s = (float)(i*2-1);
+ float s = static_cast<float>(i*2-1);
CreateCrashSphere(Math::Vector(-10.0f, 2.0f, 11.0f*s), 4.0f, SOUND_BOUMm, 0.45f);
CreateCrashSphere(Math::Vector( -3.0f, 2.0f, 11.0f*s), 4.0f, SOUND_BOUMm, 0.45f);
CreateCrashSphere(Math::Vector( 3.0f, 2.0f, 11.0f*s), 4.0f, SOUND_BOUMm, 0.45f);
@@ -2867,7 +2862,7 @@ bool CObject::CreateBuilding(Math::Vector pos, float angle, float height,
SetFloorHeight(0.0f);
rank = m_engine->CreateObject();
- m_engine->SetObjectType(rank, TYPEDESCENDANT);
+ m_engine->SetObjectType(rank, Gfx::ENG_OBJTYPE_DESCENDANT);
SetObjectRank(1, rank);
SetObjectParent(1, 0);
pModFile->ReadModel("objects\\repair2.mod");
@@ -2893,7 +2888,7 @@ bool CObject::CreateBuilding(Math::Vector pos, float angle, float height,
SetFloorHeight(0.0f);
rank = m_engine->CreateObject();
- m_engine->SetObjectType(rank, TYPEDESCENDANT);
+ m_engine->SetObjectType(rank, Gfx::ENG_OBJTYPE_DESCENDANT);
SetObjectRank(1, rank);
SetObjectParent(1, 0);
pModFile->ReadModel("objects\\destroy2.mod");
@@ -2936,7 +2931,7 @@ bool CObject::CreateBuilding(Math::Vector pos, float angle, float height,
SetFloorHeight(0.0f);
rank = m_engine->CreateObject();
- m_engine->SetObjectType(rank, TYPEDESCENDANT);
+ m_engine->SetObjectType(rank, Gfx::ENG_OBJTYPE_DESCENDANT);
SetObjectRank(1, rank);
SetObjectParent(1, 0);
pModFile->ReadModel("objects\\convert2.mod");
@@ -2944,7 +2939,7 @@ bool CObject::CreateBuilding(Math::Vector pos, float angle, float height,
SetPosition(1, Math::Vector(0.0f, 14.0f, 0.0f));
rank = m_engine->CreateObject();
- m_engine->SetObjectType(rank, TYPEDESCENDANT);
+ m_engine->SetObjectType(rank, Gfx::ENG_OBJTYPE_DESCENDANT);
SetObjectRank(2, rank);
SetObjectParent(2, 0);
pModFile->ReadModel("objects\\convert3.mod");
@@ -2953,7 +2948,7 @@ bool CObject::CreateBuilding(Math::Vector pos, float angle, float height,
SetAngleX(2, -Math::PI*0.35f);
rank = m_engine->CreateObject();
- m_engine->SetObjectType(rank, TYPEDESCENDANT);
+ m_engine->SetObjectType(rank, Gfx::ENG_OBJTYPE_DESCENDANT);
SetObjectRank(3, rank);
SetObjectParent(3, 0);
pModFile->ReadModel("objects\\convert3.mod");
@@ -2980,7 +2975,7 @@ bool CObject::CreateBuilding(Math::Vector pos, float angle, float height,
SetFloorHeight(0.0f);
rank = m_engine->CreateObject();
- m_engine->SetObjectType(rank, TYPEDESCENDANT);
+ m_engine->SetObjectType(rank, Gfx::ENG_OBJTYPE_DESCENDANT);
SetObjectRank(1, rank);
SetObjectParent(1, 0);
pModFile->ReadModel("objects\\roller2c.mod");
@@ -2989,7 +2984,7 @@ bool CObject::CreateBuilding(Math::Vector pos, float angle, float height,
SetAngleZ(1, Math::PI/2.0f);
rank = m_engine->CreateObject();
- m_engine->SetObjectType(rank, TYPEDESCENDANT);
+ m_engine->SetObjectType(rank, Gfx::ENG_OBJTYPE_DESCENDANT);
SetObjectRank(2, rank);
SetObjectParent(2, 1);
pModFile->ReadModel("objects\\roller3c.mod");
@@ -3006,7 +3001,7 @@ bool CObject::CreateBuilding(Math::Vector pos, float angle, float height,
m_character.posPower = Math::Vector(5.0f, 3.0f, 0.0f);
CreateShadowCircle(6.0f, 1.0f);
- m_showLimitRadius = BLITZPARA;
+ m_showLimitRadius = Gfx::BLITZPARA;
}
if ( m_type == OBJECT_NUCLEAR )
@@ -3018,7 +3013,7 @@ bool CObject::CreateBuilding(Math::Vector pos, float angle, float height,
SetFloorHeight(0.0f);
rank = m_engine->CreateObject();
- m_engine->SetObjectType(rank, TYPEDESCENDANT);
+ m_engine->SetObjectType(rank, Gfx::ENG_OBJTYPE_DESCENDANT);
SetObjectRank(1, rank);
SetObjectParent(1, 0);
pModFile->ReadModel("objects\\nuclear2.mod");
@@ -3059,7 +3054,7 @@ bool CObject::CreateBuilding(Math::Vector pos, float angle, float height,
SetGlobalSphere(Math::Vector(0.0f, 10.0f, 0.0f), 20.0f);
CreateShadowCircle(21.0f, 1.0f);
- m_showLimitRadius = BLITZPARA;
+ m_showLimitRadius = Gfx::BLITZPARA;
}
if ( m_type == OBJECT_SAFE )
@@ -3071,7 +3066,7 @@ bool CObject::CreateBuilding(Math::Vector pos, float angle, float height,
SetFloorHeight(0.0f);
rank = m_engine->CreateObject();
- m_engine->SetObjectType(rank, TYPEDESCENDANT);
+ m_engine->SetObjectType(rank, Gfx::ENG_OBJTYPE_DESCENDANT);
SetObjectRank(1, rank);
SetObjectParent(1, 0);
pModFile->ReadModel("objects\\safe2.mod");
@@ -3079,7 +3074,7 @@ bool CObject::CreateBuilding(Math::Vector pos, float angle, float height,
SetZoom(1, 1.05f);
rank = m_engine->CreateObject();
- m_engine->SetObjectType(rank, TYPEDESCENDANT);
+ m_engine->SetObjectType(rank, Gfx::ENG_OBJTYPE_DESCENDANT);
SetObjectRank(2, rank);
SetObjectParent(2, 0);
pModFile->ReadModel("objects\\safe3.mod");
@@ -3103,7 +3098,7 @@ bool CObject::CreateBuilding(Math::Vector pos, float angle, float height,
SetFloorHeight(0.0f);
rank = m_engine->CreateObject();
- m_engine->SetObjectType(rank, TYPEDESCENDANT);
+ m_engine->SetObjectType(rank, Gfx::ENG_OBJTYPE_DESCENDANT);
SetObjectRank(1, rank);
SetObjectParent(1, 0);
pModFile->ReadModel("objects\\huston2.mod");
@@ -3113,7 +3108,7 @@ bool CObject::CreateBuilding(Math::Vector pos, float angle, float height,
SetZoom(1, 3.0f);
rank = m_engine->CreateObject();
- m_engine->SetObjectType(rank, TYPEDESCENDANT);
+ m_engine->SetObjectType(rank, Gfx::ENG_OBJTYPE_DESCENDANT);
SetObjectRank(2, rank);
SetObjectParent(2, 1);
pModFile->ReadModel("objects\\huston3.mod");
@@ -3223,14 +3218,14 @@ bool CObject::CreateBuilding(Math::Vector pos, float angle, float height,
pPower->SetType(power<=1.0f?OBJECT_POWER:OBJECT_ATOMIC);
rank = m_engine->CreateObject();
- m_engine->SetObjectType(rank, TYPEFIX);
+ m_engine->SetObjectType(rank, Gfx::ENG_OBJTYPE_FIX);
pPower->SetObjectRank(0, rank);
if ( power <= 1.0f ) pModFile->ReadModel("objects\\power.mod");
else pModFile->ReadModel("objects\\atomic.mod");
pModFile->CreateEngineObject(rank);
- pPower->SetPosition(0, RetCharacter()->posPower);
+ pPower->SetPosition(0, GetCharacter()->posPower);
pPower->CreateCrashSphere(Math::Vector(0.0f, 1.0f, 0.0f), 1.0f, SOUND_BOUMm, 0.45f);
pPower->SetGlobalSphere(Math::Vector(0.0f, 1.0f, 0.0f), 1.5f);
@@ -3242,12 +3237,12 @@ bool CObject::CreateBuilding(Math::Vector pos, float angle, float height,
}
#endif
- pos = RetPosition(0);
+ pos = GetPosition(0);
pos.y += height;
SetPosition(0, pos); // to display the shadows immediately
CreateOtherObject(type);
- m_engine->LoadAllTexture();
+ m_engine->LoadAllTextures();
delete pModFile;
return true;
@@ -3258,22 +3253,17 @@ bool CObject::CreateBuilding(Math::Vector pos, float angle, float height,
bool CObject::CreateResource(Math::Vector pos, float angle, ObjectType type,
float power)
{
- CModFile* pModFile;
+ Gfx::CModelFile* pModFile;
char name[50];
int rank;
float radius, height;
- if ( type != OBJECT_SHOW )
- {
- if ( m_engine->RetRestCreate() < 1 ) return false;
- }
-
- pModFile = new CModFile(m_iMan);
+ pModFile = new Gfx::CModelFile(m_iMan);
SetType(type);
rank = m_engine->CreateObject();
- m_engine->SetObjectType(rank, TYPEFIX); // it is a stationary object
+ m_engine->SetObjectType(rank, Gfx::ENG_OBJTYPE_FIX); // it is a stationary object
SetObjectRank(0, rank);
SetEnergy(power);
@@ -3363,10 +3353,10 @@ bool CObject::CreateResource(Math::Vector pos, float angle, ObjectType type,
SetFloorHeight(0.0f);
CreateOtherObject(type);
- m_engine->LoadAllTexture();
+ m_engine->LoadAllTextures();
FloorAdjust();
- pos = RetPosition(0);
+ pos = GetPosition(0);
pos.y += height;
SetPosition(0, pos); // to display the shadows immediately
@@ -3378,13 +3368,11 @@ bool CObject::CreateResource(Math::Vector pos, float angle, ObjectType type,
bool CObject::CreateFlag(Math::Vector pos, float angle, ObjectType type)
{
- CModFile* pModFile;
+ Gfx::CModelFile* pModFile;
char name[50];
int rank, i;
- if ( m_engine->RetRestCreate() < 1+4 ) return false;
-
- pModFile = new CModFile(m_iMan);
+ pModFile = new Gfx::CModelFile(m_iMan);
SetType(type);
@@ -3396,7 +3384,7 @@ bool CObject::CreateFlag(Math::Vector pos, float angle, ObjectType type)
if ( type == OBJECT_FLAGv ) strcpy(name, "objects\\flag1v.mod");
rank = m_engine->CreateObject();
- m_engine->SetObjectType(rank, TYPEFIX); // it is a stationary object
+ m_engine->SetObjectType(rank, Gfx::ENG_OBJTYPE_FIX); // it is a stationary object
SetObjectRank(0, rank);
pModFile->ReadModel(name);
pModFile->CreateEngineObject(rank);
@@ -3413,7 +3401,7 @@ bool CObject::CreateFlag(Math::Vector pos, float angle, ObjectType type)
for ( i=0 ; i<4 ; i++ )
{
rank = m_engine->CreateObject();
- m_engine->SetObjectType(rank, TYPEDESCENDANT);
+ m_engine->SetObjectType(rank, Gfx::ENG_OBJTYPE_DESCENDANT);
SetObjectRank(1+i, rank);
SetObjectParent(1+i, i);
pModFile->ReadModel(name);
@@ -3427,10 +3415,10 @@ bool CObject::CreateFlag(Math::Vector pos, float angle, ObjectType type)
SetFloorHeight(0.0f);
CreateOtherObject(type);
- m_engine->LoadAllTexture();
+ m_engine->LoadAllTextures();
FloorAdjust();
- pos = RetPosition(0);
+ pos = GetPosition(0);
SetPosition(0, pos); // to display the shadows immediately
delete pModFile;
@@ -3442,19 +3430,17 @@ bool CObject::CreateFlag(Math::Vector pos, float angle, ObjectType type)
bool CObject::CreateBarrier(Math::Vector pos, float angle, float height,
ObjectType type)
{
- CModFile* pModFile;
+ Gfx::CModelFile* pModFile;
int rank;
- if ( m_engine->RetRestCreate() < 1 ) return false;
-
- pModFile = new CModFile(m_iMan);
+ pModFile = new Gfx::CModelFile(m_iMan);
SetType(type);
if ( type == OBJECT_BARRIER0 )
{
rank = m_engine->CreateObject();
- m_engine->SetObjectType(rank, TYPEFIX);
+ m_engine->SetObjectType(rank, Gfx::ENG_OBJTYPE_FIX);
SetObjectRank(0, rank);
pModFile->ReadModel("objects\\barrier0.mod");
pModFile->CreateEngineObject(rank);
@@ -3465,13 +3451,13 @@ bool CObject::CreateBarrier(Math::Vector pos, float angle, float height,
CreateCrashSphere(Math::Vector( 0.0f, 3.0f, 0.0f), 0.7f, SOUND_BOUMm, 0.45f);
CreateCrashSphere(Math::Vector(-3.5f, 3.0f, 0.0f), 0.7f, SOUND_BOUMm, 0.45f);
- CreateShadowCircle(6.0f, 0.5f, D3DSHADOWWORM);
+ CreateShadowCircle(6.0f, 0.5f, Gfx::ENG_SHADOW_WORM);
}
if ( type == OBJECT_BARRIER1 )
{
rank = m_engine->CreateObject();
- m_engine->SetObjectType(rank, TYPEFIX);
+ m_engine->SetObjectType(rank, Gfx::ENG_OBJTYPE_FIX);
SetObjectRank(0, rank);
pModFile->ReadModel("objects\\barrier1.mod");
pModFile->CreateEngineObject(rank);
@@ -3484,13 +3470,13 @@ bool CObject::CreateBarrier(Math::Vector pos, float angle, float height,
CreateCrashSphere(Math::Vector(-3.5f, 3.0f, 0.0f), 0.7f, SOUND_BOUMm, 0.45f);
CreateCrashSphere(Math::Vector(-8.5f, 3.0f, 0.0f), 0.7f, SOUND_BOUMm, 0.45f);
- CreateShadowCircle(12.0f, 0.5f, D3DSHADOWWORM);
+ CreateShadowCircle(12.0f, 0.5f, Gfx::ENG_SHADOW_WORM);
}
if ( type == OBJECT_BARRIER2 ) // cardboard?
{
rank = m_engine->CreateObject();
- m_engine->SetObjectType(rank, TYPEFIX);
+ m_engine->SetObjectType(rank, Gfx::ENG_OBJTYPE_FIX);
SetObjectRank(0, rank);
pModFile->ReadModel("objects\\barrier2.mod");
pModFile->CreateEngineObject(rank);
@@ -3503,13 +3489,13 @@ bool CObject::CreateBarrier(Math::Vector pos, float angle, float height,
CreateCrashSphere(Math::Vector(-3.5f, 3.0f, 0.0f), 0.7f, SOUND_BOUMm, 0.45f);
CreateCrashSphere(Math::Vector(-8.5f, 3.0f, 0.0f), 0.7f, SOUND_BOUMm, 0.45f);
- CreateShadowCircle(12.0f, 0.8f, D3DSHADOWWORM);
+ CreateShadowCircle(12.0f, 0.8f, Gfx::ENG_SHADOW_WORM);
}
if ( type == OBJECT_BARRIER3 ) // match + straw?
{
rank = m_engine->CreateObject();
- m_engine->SetObjectType(rank, TYPEFIX);
+ m_engine->SetObjectType(rank, Gfx::ENG_OBJTYPE_FIX);
SetObjectRank(0, rank);
pModFile->ReadModel("objects\\barrier3.mod");
pModFile->CreateEngineObject(rank);
@@ -3522,17 +3508,17 @@ bool CObject::CreateBarrier(Math::Vector pos, float angle, float height,
CreateCrashSphere(Math::Vector(-3.5f, 3.0f, 0.0f), 0.7f, SOUND_BOUMm, 0.45f);
CreateCrashSphere(Math::Vector(-8.5f, 3.0f, 0.0f), 0.7f, SOUND_BOUMm, 0.45f);
- CreateShadowCircle(10.0f, 0.5f, D3DSHADOWWORM);
+ CreateShadowCircle(10.0f, 0.5f, Gfx::ENG_SHADOW_WORM);
}
- pos = RetPosition(0);
+ pos = GetPosition(0);
SetPosition(0, pos); // to display the shadows immediately
SetFloorHeight(0.0f);
CreateOtherObject(type);
FloorAdjust();
- pos = RetPosition(0);
+ pos = GetPosition(0);
pos.y += height;
SetPosition(0, pos);
@@ -3545,12 +3531,10 @@ bool CObject::CreateBarrier(Math::Vector pos, float angle, float height,
bool CObject::CreatePlant(Math::Vector pos, float angle, float height,
ObjectType type)
{
- CModFile* pModFile;
+ Gfx::CModelFile* pModFile;
int rank;
- if ( m_engine->RetRestCreate() < 1 ) return false;
-
- pModFile = new CModFile(m_iMan);
+ pModFile = new Gfx::CModelFile(m_iMan);
SetType(type);
@@ -3561,7 +3545,7 @@ bool CObject::CreatePlant(Math::Vector pos, float angle, float height,
type == OBJECT_PLANT4 ) // standard?
{
rank = m_engine->CreateObject();
- m_engine->SetObjectType(rank, TYPEFIX);
+ m_engine->SetObjectType(rank, Gfx::ENG_OBJTYPE_FIX);
SetObjectRank(0, rank);
if ( type == OBJECT_PLANT0 ) pModFile->ReadModel("objects\\plant0.mod");
if ( type == OBJECT_PLANT1 ) pModFile->ReadModel("objects\\plant1.mod");
@@ -3586,7 +3570,7 @@ bool CObject::CreatePlant(Math::Vector pos, float angle, float height,
type == OBJECT_PLANT7 ) // clover?
{
rank = m_engine->CreateObject();
- m_engine->SetObjectType(rank, TYPEFIX);
+ m_engine->SetObjectType(rank, Gfx::ENG_OBJTYPE_FIX);
SetObjectRank(0, rank);
if ( type == OBJECT_PLANT5 ) pModFile->ReadModel("objects\\plant5.mod");
if ( type == OBJECT_PLANT6 ) pModFile->ReadModel("objects\\plant6.mod");
@@ -3605,7 +3589,7 @@ bool CObject::CreatePlant(Math::Vector pos, float angle, float height,
type == OBJECT_PLANT9 ) // squash?
{
rank = m_engine->CreateObject();
- m_engine->SetObjectType(rank, TYPEFIX);
+ m_engine->SetObjectType(rank, Gfx::ENG_OBJTYPE_FIX);
SetObjectRank(0, rank);
if ( type == OBJECT_PLANT8 ) pModFile->ReadModel("objects\\plant8.mod");
if ( type == OBJECT_PLANT9 ) pModFile->ReadModel("objects\\plant9.mod");
@@ -3626,7 +3610,7 @@ bool CObject::CreatePlant(Math::Vector pos, float angle, float height,
type == OBJECT_PLANT14 ) // succulent?
{
rank = m_engine->CreateObject();
- m_engine->SetObjectType(rank, TYPEFIX);
+ m_engine->SetObjectType(rank, Gfx::ENG_OBJTYPE_FIX);
SetObjectRank(0, rank);
if ( type == OBJECT_PLANT10 ) pModFile->ReadModel("objects\\plant10.mod");
if ( type == OBJECT_PLANT11 ) pModFile->ReadModel("objects\\plant11.mod");
@@ -3651,7 +3635,7 @@ bool CObject::CreatePlant(Math::Vector pos, float angle, float height,
type == OBJECT_PLANT19 ) // fern?
{
rank = m_engine->CreateObject();
- m_engine->SetObjectType(rank, TYPEFIX);
+ m_engine->SetObjectType(rank, Gfx::ENG_OBJTYPE_FIX);
SetObjectRank(0, rank);
if ( type == OBJECT_PLANT15 ) pModFile->ReadModel("objects\\plant15.mod");
if ( type == OBJECT_PLANT16 ) pModFile->ReadModel("objects\\plant16.mod");
@@ -3675,7 +3659,7 @@ bool CObject::CreatePlant(Math::Vector pos, float angle, float height,
if ( type == OBJECT_TREE0 )
{
rank = m_engine->CreateObject();
- m_engine->SetObjectType(rank, TYPEFIX);
+ m_engine->SetObjectType(rank, Gfx::ENG_OBJTYPE_FIX);
SetObjectRank(0, rank);
pModFile->ReadModel("objects\\tree0.mod");
pModFile->CreateEngineObject(rank);
@@ -3693,7 +3677,7 @@ bool CObject::CreatePlant(Math::Vector pos, float angle, float height,
if ( type == OBJECT_TREE1 )
{
rank = m_engine->CreateObject();
- m_engine->SetObjectType(rank, TYPEFIX);
+ m_engine->SetObjectType(rank, Gfx::ENG_OBJTYPE_FIX);
SetObjectRank(0, rank);
pModFile->ReadModel("objects\\tree1.mod");
pModFile->CreateEngineObject(rank);
@@ -3712,7 +3696,7 @@ bool CObject::CreatePlant(Math::Vector pos, float angle, float height,
if ( type == OBJECT_TREE2 )
{
rank = m_engine->CreateObject();
- m_engine->SetObjectType(rank, TYPEFIX);
+ m_engine->SetObjectType(rank, Gfx::ENG_OBJTYPE_FIX);
SetObjectRank(0, rank);
pModFile->ReadModel("objects\\tree2.mod");
pModFile->CreateEngineObject(rank);
@@ -3731,7 +3715,7 @@ bool CObject::CreatePlant(Math::Vector pos, float angle, float height,
if ( type == OBJECT_TREE3 )
{
rank = m_engine->CreateObject();
- m_engine->SetObjectType(rank, TYPEFIX);
+ m_engine->SetObjectType(rank, Gfx::ENG_OBJTYPE_FIX);
SetObjectRank(0, rank);
pModFile->ReadModel("objects\\tree3.mod");
pModFile->CreateEngineObject(rank);
@@ -3749,7 +3733,7 @@ bool CObject::CreatePlant(Math::Vector pos, float angle, float height,
if ( type == OBJECT_TREE4 )
{
rank = m_engine->CreateObject();
- m_engine->SetObjectType(rank, TYPEFIX);
+ m_engine->SetObjectType(rank, Gfx::ENG_OBJTYPE_FIX);
SetObjectRank(0, rank);
pModFile->ReadModel("objects\\tree4.mod");
pModFile->CreateEngineObject(rank);
@@ -3766,7 +3750,7 @@ bool CObject::CreatePlant(Math::Vector pos, float angle, float height,
if ( type == OBJECT_TREE5 ) // giant tree (for the world "teen")
{
rank = m_engine->CreateObject();
- m_engine->SetObjectType(rank, TYPEFIX);
+ m_engine->SetObjectType(rank, Gfx::ENG_OBJTYPE_FIX);
SetObjectRank(0, rank);
pModFile->ReadModel("objects\\tree5.mod");
pModFile->CreateEngineObject(rank);
@@ -3780,13 +3764,13 @@ bool CObject::CreatePlant(Math::Vector pos, float angle, float height,
CreateShadowCircle(50.0f, 0.5f);
}
- pos = RetPosition(0);
+ pos = GetPosition(0);
SetPosition(0, pos); // to display the shadows immediately
SetFloorHeight(0.0f);
CreateOtherObject(type);
- pos = RetPosition(0);
+ pos = GetPosition(0);
pos.y += height;
SetPosition(0, pos);
@@ -3799,19 +3783,17 @@ bool CObject::CreatePlant(Math::Vector pos, float angle, float height,
bool CObject::CreateMushroom(Math::Vector pos, float angle, float height,
ObjectType type)
{
- CModFile* pModFile;
+ Gfx::CModelFile* pModFile;
int rank;
- if ( m_engine->RetRestCreate() < 1 ) return false;
-
- pModFile = new CModFile(m_iMan);
+ pModFile = new Gfx::CModelFile(m_iMan);
SetType(type);
if ( type == OBJECT_MUSHROOM1 )
{
rank = m_engine->CreateObject();
- m_engine->SetObjectType(rank, TYPEFIX);
+ m_engine->SetObjectType(rank, Gfx::ENG_OBJTYPE_FIX);
SetObjectRank(0, rank);
pModFile->ReadModel("objects\\mush1.mod");
pModFile->CreateEngineObject(rank);
@@ -3828,7 +3810,7 @@ bool CObject::CreateMushroom(Math::Vector pos, float angle, float height,
if ( type == OBJECT_MUSHROOM2 )
{
rank = m_engine->CreateObject();
- m_engine->SetObjectType(rank, TYPEFIX);
+ m_engine->SetObjectType(rank, Gfx::ENG_OBJTYPE_FIX);
SetObjectRank(0, rank);
pModFile->ReadModel("objects\\mush2.mod");
pModFile->CreateEngineObject(rank);
@@ -3842,13 +3824,13 @@ bool CObject::CreateMushroom(Math::Vector pos, float angle, float height,
CreateShadowCircle(5.0f, 0.5f);
}
- pos = RetPosition(0);
+ pos = GetPosition(0);
SetPosition(0, pos); // to display the shadows immediately
SetFloorHeight(0.0f);
CreateOtherObject(type);
- pos = RetPosition(0);
+ pos = GetPosition(0);
pos.y += height;
SetPosition(0, pos);
@@ -3861,16 +3843,14 @@ bool CObject::CreateMushroom(Math::Vector pos, float angle, float height,
bool CObject::CreateTeen(Math::Vector pos, float angle, float zoom, float height,
ObjectType type)
{
- CModFile* pModFile;
+ Gfx::CModelFile* pModFile;
Math::Matrix* mat;
- D3DCOLORVALUE color;
- int rank;
- float fShadow;
- bool bFloorAdjust = true;
-
- if ( m_engine->RetRestCreate() < 1 ) return false;
+ Gfx::Color color;
+ int rank;
+ float fShadow;
+ bool bFloorAdjust = true;
- pModFile = new CModFile(m_iMan);
+ pModFile = new Gfx::CModelFile(m_iMan);
SetType(type);
@@ -3879,7 +3859,7 @@ bool CObject::CreateTeen(Math::Vector pos, float angle, float zoom, float height
if ( type == OBJECT_TEEN0 ) // orange pencil lg=10
{
rank = m_engine->CreateObject();
- m_engine->SetObjectType(rank, TYPEFIX);
+ m_engine->SetObjectType(rank, Gfx::ENG_OBJTYPE_FIX);
SetObjectRank(0, rank);
pModFile->ReadModel("objects\\teen0.mod");
pModFile->CreateEngineObject(rank);
@@ -3893,13 +3873,13 @@ bool CObject::CreateTeen(Math::Vector pos, float angle, float zoom, float height
CreateCrashSphere(Math::Vector(-2.5f, 1.0f, 0.0f), 1.0f, SOUND_BOUMm, 0.45f);
CreateCrashSphere(Math::Vector(-5.0f, 1.0f, 0.0f), 1.0f, SOUND_BOUMm, 0.45f);
- CreateShadowCircle(5.0f, 0.8f*fShadow, D3DSHADOWWORM);
+ CreateShadowCircle(5.0f, 0.8f*fShadow, Gfx::ENG_SHADOW_WORM);
}
if ( type == OBJECT_TEEN1 ) // blue pencil lg=14
{
rank = m_engine->CreateObject();
- m_engine->SetObjectType(rank, TYPEFIX);
+ m_engine->SetObjectType(rank, Gfx::ENG_OBJTYPE_FIX);
SetObjectRank(0, rank);
pModFile->ReadModel("objects\\teen1.mod");
pModFile->CreateEngineObject(rank);
@@ -3915,13 +3895,13 @@ bool CObject::CreateTeen(Math::Vector pos, float angle, float zoom, float height
CreateCrashSphere(Math::Vector(-4.0f, 1.0f, 0.0f), 1.0f, SOUND_BOUMm, 0.45f);
CreateCrashSphere(Math::Vector(-6.0f, 1.0f, 0.0f), 1.0f, SOUND_BOUMm, 0.45f);
- CreateShadowCircle(6.0f, 0.8f*fShadow, D3DSHADOWWORM);
+ CreateShadowCircle(6.0f, 0.8f*fShadow, Gfx::ENG_SHADOW_WORM);
}
if ( type == OBJECT_TEEN2 ) // red pencil lg=16
{
rank = m_engine->CreateObject();
- m_engine->SetObjectType(rank, TYPEFIX);
+ m_engine->SetObjectType(rank, Gfx::ENG_OBJTYPE_FIX);
SetObjectRank(0, rank);
pModFile->ReadModel("objects\\teen2.mod");
pModFile->CreateEngineObject(rank);
@@ -3937,14 +3917,14 @@ bool CObject::CreateTeen(Math::Vector pos, float angle, float zoom, float height
CreateCrashSphere(Math::Vector(-4.7f, 1.0f, 0.0f), 1.0f, SOUND_BOUMm, 0.45f);
CreateCrashSphere(Math::Vector(-7.0f, 1.0f, 0.0f), 1.0f, SOUND_BOUMm, 0.45f);
- CreateShadowCircle(6.0f, 0.8f*fShadow, D3DSHADOWWORM);
+ CreateShadowCircle(6.0f, 0.8f*fShadow, Gfx::ENG_SHADOW_WORM);
}
if ( type == OBJECT_TEEN3 ) // jar with pencils
{
rank = m_engine->CreateObject();
-//? m_engine->SetObjectType(rank, TYPEFIX);
- m_engine->SetObjectType(rank, TYPEMETAL);
+//? m_engine->SetObjectType(rank, Gfx::ENG_OBJTYPE_FIX);
+ m_engine->SetObjectType(rank, Gfx::ENG_OBJTYPE_METAL);
SetObjectRank(0, rank);
pModFile->ReadModel("objects\\teen3.mod");
pModFile->CreateEngineObject(rank);
@@ -3960,7 +3940,7 @@ bool CObject::CreateTeen(Math::Vector pos, float angle, float zoom, float height
if ( type == OBJECT_TEEN4 ) // scissors
{
rank = m_engine->CreateObject();
- m_engine->SetObjectType(rank, TYPEFIX);
+ m_engine->SetObjectType(rank, Gfx::ENG_OBJTYPE_FIX);
SetObjectRank(0, rank);
pModFile->ReadModel("objects\\teen4.mod");
pModFile->CreateEngineObject(rank);
@@ -3976,13 +3956,13 @@ bool CObject::CreateTeen(Math::Vector pos, float angle, float zoom, float height
CreateCrashSphere(Math::Vector( 8.0f, 1.0f, 2.2f), 2.3f, SOUND_BOUMm, 0.45f);
CreateCrashSphere(Math::Vector( 9.4f, 1.0f,-2.0f), 2.0f, SOUND_BOUMm, 0.45f);
- CreateShadowCircle(10.0f, 0.5f*fShadow, D3DSHADOWWORM);
+ CreateShadowCircle(10.0f, 0.5f*fShadow, Gfx::ENG_SHADOW_WORM);
}
if ( type == OBJECT_TEEN5 ) // CD
{
rank = m_engine->CreateObject();
- m_engine->SetObjectType(rank, TYPEFIX);
+ m_engine->SetObjectType(rank, Gfx::ENG_OBJTYPE_FIX);
SetObjectRank(0, rank);
pModFile->ReadModel("objects\\teen5.mod");
pModFile->CreateEngineObject(rank);
@@ -3999,7 +3979,7 @@ bool CObject::CreateTeen(Math::Vector pos, float angle, float zoom, float height
if ( type == OBJECT_TEEN6 ) // book 1
{
rank = m_engine->CreateObject();
- m_engine->SetObjectType(rank, TYPEFIX);
+ m_engine->SetObjectType(rank, Gfx::ENG_OBJTYPE_FIX);
SetObjectRank(0, rank);
pModFile->ReadModel("objects\\teen6.mod");
pModFile->CreateEngineObject(rank);
@@ -4020,7 +4000,7 @@ bool CObject::CreateTeen(Math::Vector pos, float angle, float zoom, float height
if ( type == OBJECT_TEEN7 ) // book 2
{
rank = m_engine->CreateObject();
- m_engine->SetObjectType(rank, TYPEFIX);
+ m_engine->SetObjectType(rank, Gfx::ENG_OBJTYPE_FIX);
SetObjectRank(0, rank);
pModFile->ReadModel("objects\\teen7.mod");
pModFile->CreateEngineObject(rank);
@@ -4041,7 +4021,7 @@ bool CObject::CreateTeen(Math::Vector pos, float angle, float zoom, float height
if ( type == OBJECT_TEEN8 ) // a stack of books 1
{
rank = m_engine->CreateObject();
- m_engine->SetObjectType(rank, TYPEFIX);
+ m_engine->SetObjectType(rank, Gfx::ENG_OBJTYPE_FIX);
SetObjectRank(0, rank);
pModFile->ReadModel("objects\\teen8.mod");
pModFile->CreateEngineObject(rank);
@@ -4063,7 +4043,7 @@ bool CObject::CreateTeen(Math::Vector pos, float angle, float zoom, float height
if ( type == OBJECT_TEEN9 ) // a stack of books 2
{
rank = m_engine->CreateObject();
- m_engine->SetObjectType(rank, TYPEFIX);
+ m_engine->SetObjectType(rank, Gfx::ENG_OBJTYPE_FIX);
SetObjectRank(0, rank);
pModFile->ReadModel("objects\\teen9.mod");
pModFile->CreateEngineObject(rank);
@@ -4085,7 +4065,7 @@ bool CObject::CreateTeen(Math::Vector pos, float angle, float zoom, float height
if ( type == OBJECT_TEEN10 ) // bookcase
{
rank = m_engine->CreateObject();
- m_engine->SetObjectType(rank, TYPEFIX);
+ m_engine->SetObjectType(rank, Gfx::ENG_OBJTYPE_FIX);
SetObjectRank(0, rank);
pModFile->ReadModel("objects\\teen10.mod");
pModFile->CreateEngineObject(rank);
@@ -4111,7 +4091,7 @@ bool CObject::CreateTeen(Math::Vector pos, float angle, float zoom, float height
if ( type == OBJECT_TEEN11 ) // lamp
{
rank = m_engine->CreateObject();
- m_engine->SetObjectType(rank, TYPEFIX);
+ m_engine->SetObjectType(rank, Gfx::ENG_OBJTYPE_FIX);
SetObjectRank(0, rank);
pModFile->ReadModel("objects\\teen11.mod");
pModFile->CreateEngineObject(rank);
@@ -4120,9 +4100,9 @@ bool CObject::CreateTeen(Math::Vector pos, float angle, float zoom, float height
SetFloorHeight(0.0f);
SetZoom(0, zoom);
- mat = RetWorldMatrix(0);
+ mat = GetWorldMatrix(0);
pos = Math::Transform(*mat, Math::Vector(-56.0f, 22.0f, 0.0f));
- m_particule->CreateParticule(pos, Math::Vector(0.0f, 0.0f, 0.0f), Math::Point(20.0f, 20.0f), PARTISELY, 1.0f, 0.0f, 0.0f);
+ m_particle->CreateParticle(pos, Math::Vector(0.0f, 0.0f, 0.0f), Math::Point(20.0f, 20.0f), Gfx::PARTISELY, 1.0f, 0.0f, 0.0f);
pos = Math::Transform(*mat, Math::Vector(-65.0f, 40.0f, 0.0f));
color.r = 4.0f;
@@ -4135,8 +4115,8 @@ bool CObject::CreateTeen(Math::Vector pos, float angle, float zoom, float height
if ( type == OBJECT_TEEN12 ) // coke
{
rank = m_engine->CreateObject();
-//? m_engine->SetObjectType(rank, TYPEFIX);
- m_engine->SetObjectType(rank, TYPEMETAL);
+//? m_engine->SetObjectType(rank, Gfx::ENG_OBJTYPE_FIX);
+ m_engine->SetObjectType(rank, Gfx::ENG_OBJTYPE_METAL);
SetObjectRank(0, rank);
pModFile->ReadModel("objects\\teen12.mod");
pModFile->CreateEngineObject(rank);
@@ -4152,7 +4132,7 @@ bool CObject::CreateTeen(Math::Vector pos, float angle, float zoom, float height
if ( type == OBJECT_TEEN13 ) // cardboard farm
{
rank = m_engine->CreateObject();
- m_engine->SetObjectType(rank, TYPEFIX);
+ m_engine->SetObjectType(rank, Gfx::ENG_OBJTYPE_FIX);
SetObjectRank(0, rank);
pModFile->ReadModel("objects\\teen13.mod");
pModFile->CreateEngineObject(rank);
@@ -4177,7 +4157,7 @@ bool CObject::CreateTeen(Math::Vector pos, float angle, float zoom, float height
if ( type == OBJECT_TEEN14 ) // open box
{
rank = m_engine->CreateObject();
- m_engine->SetObjectType(rank, TYPEFIX);
+ m_engine->SetObjectType(rank, Gfx::ENG_OBJTYPE_FIX);
SetObjectRank(0, rank);
pModFile->ReadModel("objects\\teen14.mod");
pModFile->CreateEngineObject(rank);
@@ -4202,7 +4182,7 @@ bool CObject::CreateTeen(Math::Vector pos, float angle, float zoom, float height
if ( type == OBJECT_TEEN15 ) // stack of cartons
{
rank = m_engine->CreateObject();
- m_engine->SetObjectType(rank, TYPEFIX);
+ m_engine->SetObjectType(rank, Gfx::ENG_OBJTYPE_FIX);
SetObjectRank(0, rank);
pModFile->ReadModel("objects\\teen15.mod");
pModFile->CreateEngineObject(rank);
@@ -4227,7 +4207,7 @@ bool CObject::CreateTeen(Math::Vector pos, float angle, float zoom, float height
if ( type == OBJECT_TEEN16 ) // watering can
{
rank = m_engine->CreateObject();
- m_engine->SetObjectType(rank, TYPEFIX);
+ m_engine->SetObjectType(rank, Gfx::ENG_OBJTYPE_FIX);
SetObjectRank(0, rank);
pModFile->ReadModel("objects\\teen16.mod");
pModFile->CreateEngineObject(rank);
@@ -4245,7 +4225,7 @@ bool CObject::CreateTeen(Math::Vector pos, float angle, float zoom, float height
if ( type == OBJECT_TEEN17 ) // wheel |
{
rank = m_engine->CreateObject();
- m_engine->SetObjectType(rank, TYPEFIX);
+ m_engine->SetObjectType(rank, Gfx::ENG_OBJTYPE_FIX);
SetObjectRank(0, rank);
pModFile->ReadModel("objects\\teen17.mod");
pModFile->CreateEngineObject(rank);
@@ -4261,7 +4241,7 @@ bool CObject::CreateTeen(Math::Vector pos, float angle, float zoom, float height
if ( type == OBJECT_TEEN18 ) // wheel /
{
rank = m_engine->CreateObject();
- m_engine->SetObjectType(rank, TYPEFIX);
+ m_engine->SetObjectType(rank, Gfx::ENG_OBJTYPE_FIX);
SetObjectRank(0, rank);
pModFile->ReadModel("objects\\teen18.mod");
pModFile->CreateEngineObject(rank);
@@ -4277,7 +4257,7 @@ bool CObject::CreateTeen(Math::Vector pos, float angle, float zoom, float height
if ( type == OBJECT_TEEN19 ) // wheel =
{
rank = m_engine->CreateObject();
- m_engine->SetObjectType(rank, TYPEFIX);
+ m_engine->SetObjectType(rank, Gfx::ENG_OBJTYPE_FIX);
SetObjectRank(0, rank);
pModFile->ReadModel("objects\\teen19.mod");
pModFile->CreateEngineObject(rank);
@@ -4293,7 +4273,7 @@ bool CObject::CreateTeen(Math::Vector pos, float angle, float zoom, float height
if ( type == OBJECT_TEEN20 ) // wall with shelf
{
rank = m_engine->CreateObject();
- m_engine->SetObjectType(rank, TYPEFIX);
+ m_engine->SetObjectType(rank, Gfx::ENG_OBJTYPE_FIX);
SetObjectRank(0, rank);
pModFile->ReadModel("objects\\teen20.mod");
pModFile->CreateEngineObject(rank);
@@ -4314,7 +4294,7 @@ bool CObject::CreateTeen(Math::Vector pos, float angle, float zoom, float height
if ( type == OBJECT_TEEN21 ) // wall with window
{
rank = m_engine->CreateObject();
- m_engine->SetObjectType(rank, TYPEFIX);
+ m_engine->SetObjectType(rank, Gfx::ENG_OBJTYPE_FIX);
SetObjectRank(0, rank);
pModFile->ReadModel("objects\\teen21.mod");
pModFile->CreateEngineObject(rank);
@@ -4326,7 +4306,7 @@ bool CObject::CreateTeen(Math::Vector pos, float angle, float zoom, float height
if ( type == OBJECT_TEEN22 ) // wall with door and shelf
{
rank = m_engine->CreateObject();
- m_engine->SetObjectType(rank, TYPEFIX);
+ m_engine->SetObjectType(rank, Gfx::ENG_OBJTYPE_FIX);
SetObjectRank(0, rank);
pModFile->ReadModel("objects\\teen22.mod");
pModFile->CreateEngineObject(rank);
@@ -4343,7 +4323,7 @@ bool CObject::CreateTeen(Math::Vector pos, float angle, float zoom, float height
if ( type == OBJECT_TEEN23 ) // skateboard on wheels
{
rank = m_engine->CreateObject();
- m_engine->SetObjectType(rank, TYPEFIX);
+ m_engine->SetObjectType(rank, Gfx::ENG_OBJTYPE_FIX);
SetObjectRank(0, rank);
pModFile->ReadModel("objects\\teen23.mod");
pModFile->CreateEngineObject(rank);
@@ -4364,13 +4344,13 @@ bool CObject::CreateTeen(Math::Vector pos, float angle, float zoom, float height
CreateCrashSphere(Math::Vector( 23.0f, 2.0f, 0.0f), 3.0f, SOUND_BOUMm, 0.45f);
CreateCrashSphere(Math::Vector( 23.0f, 2.0f,-7.0f), 3.0f, SOUND_BOUMm, 0.45f);
- CreateShadowCircle(35.0f, 0.8f*fShadow, D3DSHADOWWORM);
+ CreateShadowCircle(35.0f, 0.8f*fShadow, Gfx::ENG_SHADOW_WORM);
}
if ( type == OBJECT_TEEN24 ) // skate /
{
rank = m_engine->CreateObject();
- m_engine->SetObjectType(rank, TYPEFIX);
+ m_engine->SetObjectType(rank, Gfx::ENG_OBJTYPE_FIX);
SetObjectRank(0, rank);
pModFile->ReadModel("objects\\teen24.mod");
pModFile->CreateEngineObject(rank);
@@ -4386,7 +4366,7 @@ bool CObject::CreateTeen(Math::Vector pos, float angle, float zoom, float height
if ( type == OBJECT_TEEN25 ) // skate /
{
rank = m_engine->CreateObject();
- m_engine->SetObjectType(rank, TYPEFIX);
+ m_engine->SetObjectType(rank, Gfx::ENG_OBJTYPE_FIX);
SetObjectRank(0, rank);
pModFile->ReadModel("objects\\teen25.mod");
pModFile->CreateEngineObject(rank);
@@ -4402,7 +4382,7 @@ bool CObject::CreateTeen(Math::Vector pos, float angle, float zoom, float height
if ( type == OBJECT_TEEN26 ) // ceiling lamp
{
rank = m_engine->CreateObject();
- m_engine->SetObjectType(rank, TYPEFIX);
+ m_engine->SetObjectType(rank, Gfx::ENG_OBJTYPE_FIX);
SetObjectRank(0, rank);
pModFile->ReadModel("objects\\teen26.mod");
pModFile->CreateEngineObject(rank);
@@ -4411,9 +4391,9 @@ bool CObject::CreateTeen(Math::Vector pos, float angle, float zoom, float height
SetZoom(0, zoom);
SetFloorHeight(0.0f);
- mat = RetWorldMatrix(0);
+ mat = GetWorldMatrix(0);
pos = Math::Transform(*mat, Math::Vector(0.0f, 50.0f, 0.0f));
- m_particule->CreateParticule(pos, Math::Vector(0.0f, 0.0f, 0.0f), Math::Point(100.0f, 100.0f), PARTISELY, 1.0f, 0.0f, 0.0f);
+ m_particle->CreateParticle(pos, Math::Vector(0.0f, 0.0f, 0.0f), Math::Point(100.0f, 100.0f), Gfx::PARTISELY, 1.0f, 0.0f, 0.0f);
pos = Math::Transform(*mat, Math::Vector(0.0f, 50.0f, 0.0f));
color.r = 4.0f;
@@ -4426,7 +4406,7 @@ bool CObject::CreateTeen(Math::Vector pos, float angle, float zoom, float height
if ( type == OBJECT_TEEN27 ) // large plant?
{
rank = m_engine->CreateObject();
- m_engine->SetObjectType(rank, TYPEFIX);
+ m_engine->SetObjectType(rank, Gfx::ENG_OBJTYPE_FIX);
SetObjectRank(0, rank);
pModFile->ReadModel("objects\\teen27.mod");
pModFile->CreateEngineObject(rank);
@@ -4441,8 +4421,8 @@ bool CObject::CreateTeen(Math::Vector pos, float angle, float zoom, float height
if ( type == OBJECT_TEEN28 ) // bottle?
{
rank = m_engine->CreateObject();
-//? m_engine->SetObjectType(rank, TYPEFIX);
- m_engine->SetObjectType(rank, TYPEMETAL);
+//? m_engine->SetObjectType(rank, Gfx::ENG_OBJTYPE_FIX);
+ m_engine->SetObjectType(rank, Gfx::ENG_OBJTYPE_METAL);
SetObjectRank(0, rank);
pModFile->ReadModel("objects\\teen28.mod");
pModFile->CreateEngineObject(rank);
@@ -4457,7 +4437,7 @@ bool CObject::CreateTeen(Math::Vector pos, float angle, float zoom, float height
if ( type == OBJECT_TEEN29 ) // bridge?
{
rank = m_engine->CreateObject();
- m_engine->SetObjectType(rank, TYPEFIX);
+ m_engine->SetObjectType(rank, Gfx::ENG_OBJTYPE_FIX);
SetObjectRank(0, rank);
pModFile->ReadModel("objects\\teen29.mod");
pModFile->CreateEngineObject(rank);
@@ -4470,7 +4450,7 @@ bool CObject::CreateTeen(Math::Vector pos, float angle, float zoom, float height
if ( type == OBJECT_TEEN30 ) // jump?
{
rank = m_engine->CreateObject();
- m_engine->SetObjectType(rank, TYPEFIX);
+ m_engine->SetObjectType(rank, Gfx::ENG_OBJTYPE_FIX);
SetObjectRank(0, rank);
pModFile->ReadModel("objects\\teen30.mod");
pModFile->CreateEngineObject(rank);
@@ -4486,7 +4466,7 @@ bool CObject::CreateTeen(Math::Vector pos, float angle, float zoom, float height
if ( type == OBJECT_TEEN31 ) // basket?
{
rank = m_engine->CreateObject();
- m_engine->SetObjectType(rank, TYPEFIX);
+ m_engine->SetObjectType(rank, Gfx::ENG_OBJTYPE_FIX);
SetObjectRank(0, rank);
pModFile->ReadModel("objects\\teen31.mod");
pModFile->CreateEngineObject(rank);
@@ -4505,7 +4485,7 @@ bool CObject::CreateTeen(Math::Vector pos, float angle, float zoom, float height
if ( type == OBJECT_TEEN32 ) // chair?
{
rank = m_engine->CreateObject();
- m_engine->SetObjectType(rank, TYPEFIX);
+ m_engine->SetObjectType(rank, Gfx::ENG_OBJTYPE_FIX);
SetObjectRank(0, rank);
pModFile->ReadModel("objects\\teen32.mod");
pModFile->CreateEngineObject(rank);
@@ -4524,7 +4504,7 @@ bool CObject::CreateTeen(Math::Vector pos, float angle, float zoom, float height
if ( type == OBJECT_TEEN33 ) // panel?
{
rank = m_engine->CreateObject();
- m_engine->SetObjectType(rank, TYPEFIX);
+ m_engine->SetObjectType(rank, Gfx::ENG_OBJTYPE_FIX);
SetObjectRank(0, rank);
pModFile->ReadModel("objects\\teen33.mod");
pModFile->CreateEngineObject(rank);
@@ -4539,7 +4519,7 @@ bool CObject::CreateTeen(Math::Vector pos, float angle, float zoom, float height
if ( type == OBJECT_TEEN34 ) // stone?
{
rank = m_engine->CreateObject();
- m_engine->SetObjectType(rank, TYPEFIX);
+ m_engine->SetObjectType(rank, Gfx::ENG_OBJTYPE_FIX);
SetObjectRank(0, rank);
pModFile->ReadModel("objects\\teen34.mod");
pModFile->CreateEngineObject(rank);
@@ -4554,7 +4534,7 @@ bool CObject::CreateTeen(Math::Vector pos, float angle, float zoom, float height
if ( type == OBJECT_TEEN35 ) // pipe?
{
rank = m_engine->CreateObject();
- m_engine->SetObjectType(rank, TYPEFIX);
+ m_engine->SetObjectType(rank, Gfx::ENG_OBJTYPE_FIX);
SetObjectRank(0, rank);
pModFile->ReadModel("objects\\teen35.mod");
pModFile->CreateEngineObject(rank);
@@ -4567,13 +4547,13 @@ bool CObject::CreateTeen(Math::Vector pos, float angle, float zoom, float height
CreateCrashSphere(Math::Vector( 0.0f, 5.0f, 0.0f), 10.0f, SOUND_BOUM, 0.10f);
CreateCrashSphere(Math::Vector( 20.0f, 5.0f, 0.0f), 10.0f, SOUND_BOUM, 0.10f);
CreateCrashSphere(Math::Vector( 40.0f, 5.0f, 0.0f), 10.0f, SOUND_BOUM, 0.10f);
- CreateShadowCircle(40.0f, 0.8f*fShadow, D3DSHADOWWORM);
+ CreateShadowCircle(40.0f, 0.8f*fShadow, Gfx::ENG_SHADOW_WORM);
}
if ( type == OBJECT_TEEN36 ) // trunk?
{
rank = m_engine->CreateObject();
- m_engine->SetObjectType(rank, TYPEFIX);
+ m_engine->SetObjectType(rank, Gfx::ENG_OBJTYPE_FIX);
SetObjectRank(0, rank);
pModFile->ReadModel("objects\\teen36.mod");
pModFile->CreateEngineObject(rank);
@@ -4586,7 +4566,7 @@ bool CObject::CreateTeen(Math::Vector pos, float angle, float zoom, float height
if ( type == OBJECT_TEEN37 ) // boat?
{
rank = m_engine->CreateObject();
- m_engine->SetObjectType(rank, TYPEFIX);
+ m_engine->SetObjectType(rank, Gfx::ENG_OBJTYPE_FIX);
SetObjectRank(0, rank);
pModFile->ReadModel("objects\\teen37.mod");
pModFile->CreateEngineObject(rank);
@@ -4599,7 +4579,7 @@ bool CObject::CreateTeen(Math::Vector pos, float angle, float zoom, float height
if ( type == OBJECT_TEEN38 ) // fan?
{
rank = m_engine->CreateObject();
- m_engine->SetObjectType(rank, TYPEFIX);
+ m_engine->SetObjectType(rank, Gfx::ENG_OBJTYPE_FIX);
SetObjectRank(0, rank);
pModFile->ReadModel("objects\\teen38a.mod");
pModFile->CreateEngineObject(rank);
@@ -4608,7 +4588,7 @@ bool CObject::CreateTeen(Math::Vector pos, float angle, float zoom, float height
SetZoom(0, zoom);
rank = m_engine->CreateObject();
- m_engine->SetObjectType(rank, TYPEDESCENDANT);
+ m_engine->SetObjectType(rank, Gfx::ENG_OBJTYPE_DESCENDANT);
SetObjectRank(1, rank);
SetObjectParent(1, 0);
pModFile->ReadModel("objects\\teen38b.mod"); // engine
@@ -4616,7 +4596,7 @@ bool CObject::CreateTeen(Math::Vector pos, float angle, float zoom, float height
SetPosition(1, Math::Vector(0.0f, 30.0f, 0.0f));
rank = m_engine->CreateObject();
- m_engine->SetObjectType(rank, TYPEDESCENDANT);
+ m_engine->SetObjectType(rank, Gfx::ENG_OBJTYPE_DESCENDANT);
SetObjectRank(2, rank);
SetObjectParent(2, 1);
pModFile->ReadModel("objects\\teen38c.mod"); // propeller
@@ -4631,7 +4611,7 @@ bool CObject::CreateTeen(Math::Vector pos, float angle, float zoom, float height
if ( type == OBJECT_TEEN39 ) // potted plant?
{
rank = m_engine->CreateObject();
- m_engine->SetObjectType(rank, TYPEFIX);
+ m_engine->SetObjectType(rank, Gfx::ENG_OBJTYPE_FIX);
SetObjectRank(0, rank);
pModFile->ReadModel("objects\\teen39.mod");
pModFile->CreateEngineObject(rank);
@@ -4647,7 +4627,7 @@ bool CObject::CreateTeen(Math::Vector pos, float angle, float zoom, float height
if ( type == OBJECT_TEEN40 ) // balloon?
{
rank = m_engine->CreateObject();
- m_engine->SetObjectType(rank, TYPEFIX);
+ m_engine->SetObjectType(rank, Gfx::ENG_OBJTYPE_FIX);
SetObjectRank(0, rank);
pModFile->ReadModel("objects\\teen40.mod");
pModFile->CreateEngineObject(rank);
@@ -4663,7 +4643,7 @@ bool CObject::CreateTeen(Math::Vector pos, float angle, float zoom, float height
if ( type == OBJECT_TEEN41 ) // fence?
{
rank = m_engine->CreateObject();
- m_engine->SetObjectType(rank, TYPEFIX);
+ m_engine->SetObjectType(rank, Gfx::ENG_OBJTYPE_FIX);
SetObjectRank(0, rank);
pModFile->ReadModel("objects\\teen41.mod");
pModFile->CreateEngineObject(rank);
@@ -4675,7 +4655,7 @@ bool CObject::CreateTeen(Math::Vector pos, float angle, float zoom, float height
if ( type == OBJECT_TEEN42 ) // clover?
{
rank = m_engine->CreateObject();
- m_engine->SetObjectType(rank, TYPEFIX);
+ m_engine->SetObjectType(rank, Gfx::ENG_OBJTYPE_FIX);
SetObjectRank(0, rank);
pModFile->ReadModel("objects\\teen42.mod");
pModFile->CreateEngineObject(rank);
@@ -4690,7 +4670,7 @@ bool CObject::CreateTeen(Math::Vector pos, float angle, float zoom, float height
if ( type == OBJECT_TEEN43 ) // clover?
{
rank = m_engine->CreateObject();
- m_engine->SetObjectType(rank, TYPEFIX);
+ m_engine->SetObjectType(rank, Gfx::ENG_OBJTYPE_FIX);
SetObjectRank(0, rank);
pModFile->ReadModel("objects\\teen43.mod");
pModFile->CreateEngineObject(rank);
@@ -4705,7 +4685,7 @@ bool CObject::CreateTeen(Math::Vector pos, float angle, float zoom, float height
if ( type == OBJECT_TEEN44 ) // car?
{
rank = m_engine->CreateObject();
- m_engine->SetObjectType(rank, TYPEFIX);
+ m_engine->SetObjectType(rank, Gfx::ENG_OBJTYPE_FIX);
SetObjectRank(0, rank);
pModFile->ReadModel("objects\\teen44.mod");
pModFile->CreateEngineObject(rank);
@@ -4718,7 +4698,7 @@ bool CObject::CreateTeen(Math::Vector pos, float angle, float zoom, float height
CreateShadowCircle(55.0f, 1.0f*fShadow);
}
- pos = RetPosition(0);
+ pos = GetPosition(0);
SetPosition(0, pos); // to display the shadows immediately
if ( bFloorAdjust )
@@ -4729,7 +4709,7 @@ bool CObject::CreateTeen(Math::Vector pos, float angle, float zoom, float height
CreateOtherObject(type);
- pos = RetPosition(0);
+ pos = GetPosition(0);
pos.y += height;
SetPosition(0, pos);
@@ -4742,20 +4722,18 @@ bool CObject::CreateTeen(Math::Vector pos, float angle, float zoom, float height
bool CObject::CreateQuartz(Math::Vector pos, float angle, float height,
ObjectType type)
{
- CModFile* pModFile;
+ Gfx::CModelFile* pModFile;
float radius;
int rank;
- if ( m_engine->RetRestCreate() < 1 ) return false;
-
- pModFile = new CModFile(m_iMan);
+ pModFile = new Gfx::CModelFile(m_iMan);
SetType(type);
if ( type == OBJECT_QUARTZ0 )
{
rank = m_engine->CreateObject();
- m_engine->SetObjectType(rank, TYPEQUARTZ);
+ m_engine->SetObjectType(rank, Gfx::ENG_OBJTYPE_QUARTZ);
SetObjectRank(0, rank);
pModFile->ReadModel("objects\\quartz0.mod");
pModFile->CreateEngineObject(rank);
@@ -4770,7 +4748,7 @@ bool CObject::CreateQuartz(Math::Vector pos, float angle, float height,
if ( type == OBJECT_QUARTZ1 )
{
rank = m_engine->CreateObject();
- m_engine->SetObjectType(rank, TYPEQUARTZ);
+ m_engine->SetObjectType(rank, Gfx::ENG_OBJTYPE_QUARTZ);
SetObjectRank(0, rank);
pModFile->ReadModel("objects\\quartz1.mod");
pModFile->CreateEngineObject(rank);
@@ -4785,7 +4763,7 @@ bool CObject::CreateQuartz(Math::Vector pos, float angle, float height,
if ( type == OBJECT_QUARTZ2 )
{
rank = m_engine->CreateObject();
- m_engine->SetObjectType(rank, TYPEQUARTZ);
+ m_engine->SetObjectType(rank, Gfx::ENG_OBJTYPE_QUARTZ);
SetObjectRank(0, rank);
pModFile->ReadModel("objects\\quartz2.mod");
pModFile->CreateEngineObject(rank);
@@ -4800,7 +4778,7 @@ bool CObject::CreateQuartz(Math::Vector pos, float angle, float height,
if ( type == OBJECT_QUARTZ3 )
{
rank = m_engine->CreateObject();
- m_engine->SetObjectType(rank, TYPEQUARTZ);
+ m_engine->SetObjectType(rank, Gfx::ENG_OBJTYPE_QUARTZ);
SetObjectRank(0, rank);
pModFile->ReadModel("objects\\quartz3.mod");
pModFile->CreateEngineObject(rank);
@@ -4813,13 +4791,13 @@ bool CObject::CreateQuartz(Math::Vector pos, float angle, float height,
CreateShadowCircle(10.0f, 0.5f);
}
- pos = RetPosition(0);
+ pos = GetPosition(0);
SetPosition(0, pos); // to display the shadows immediately
SetFloorHeight(0.0f);
CreateOtherObject(type);
- pos = RetPosition(0);
+ pos = GetPosition(0);
pos.y += height;
SetPosition(0, pos);
@@ -4843,8 +4821,8 @@ bool CObject::CreateQuartz(Math::Vector pos, float angle, float height,
pos.y += 16.0f;
radius = 8.0f;
}
- m_particule->CreateParticule(pos, pos, Math::Point(2.0f, 2.0f), PARTIQUARTZ, 0.7f+Math::Rand()*0.7f, radius, 0.0f);
- m_particule->CreateParticule(pos, pos, Math::Point(2.0f, 2.0f), PARTIQUARTZ, 0.7f+Math::Rand()*0.7f, radius, 0.0f);
+ m_particle->CreateParticle(pos, pos, Math::Point(2.0f, 2.0f), Gfx::PARTIQUARTZ, 0.7f+Math::Rand()*0.7f, radius, 0.0f);
+ m_particle->CreateParticle(pos, pos, Math::Point(2.0f, 2.0f), Gfx::PARTIQUARTZ, 0.7f+Math::Rand()*0.7f, radius, 0.0f);
delete pModFile;
return true;
@@ -4855,19 +4833,17 @@ bool CObject::CreateQuartz(Math::Vector pos, float angle, float height,
bool CObject::CreateRoot(Math::Vector pos, float angle, float height,
ObjectType type)
{
- CModFile* pModFile;
+ Gfx::CModelFile* pModFile;
int rank;
- if ( m_engine->RetRestCreate() < 1 ) return false;
-
- pModFile = new CModFile(m_iMan);
+ pModFile = new Gfx::CModelFile(m_iMan);
SetType(type);
if ( type == OBJECT_ROOT0 )
{
rank = m_engine->CreateObject();
- m_engine->SetObjectType(rank, TYPEFIX);
+ m_engine->SetObjectType(rank, Gfx::ENG_OBJTYPE_FIX);
SetObjectRank(0, rank);
pModFile->ReadModel("objects\\root0.mod");
pModFile->CreateEngineObject(rank);
@@ -4889,7 +4865,7 @@ bool CObject::CreateRoot(Math::Vector pos, float angle, float height,
if ( type == OBJECT_ROOT1 )
{
rank = m_engine->CreateObject();
- m_engine->SetObjectType(rank, TYPEFIX);
+ m_engine->SetObjectType(rank, Gfx::ENG_OBJTYPE_FIX);
SetObjectRank(0, rank);
pModFile->ReadModel("objects\\root1.mod");
pModFile->CreateEngineObject(rank);
@@ -4911,7 +4887,7 @@ bool CObject::CreateRoot(Math::Vector pos, float angle, float height,
if ( type == OBJECT_ROOT2 )
{
rank = m_engine->CreateObject();
- m_engine->SetObjectType(rank, TYPEFIX);
+ m_engine->SetObjectType(rank, Gfx::ENG_OBJTYPE_FIX);
SetObjectRank(0, rank);
pModFile->ReadModel("objects\\root2.mod");
pModFile->CreateEngineObject(rank);
@@ -4932,7 +4908,7 @@ bool CObject::CreateRoot(Math::Vector pos, float angle, float height,
if ( type == OBJECT_ROOT3 )
{
rank = m_engine->CreateObject();
- m_engine->SetObjectType(rank, TYPEFIX);
+ m_engine->SetObjectType(rank, Gfx::ENG_OBJTYPE_FIX);
SetObjectRank(0, rank);
pModFile->ReadModel("objects\\root3.mod");
pModFile->CreateEngineObject(rank);
@@ -4955,7 +4931,7 @@ bool CObject::CreateRoot(Math::Vector pos, float angle, float height,
if ( type == OBJECT_ROOT4 )
{
rank = m_engine->CreateObject();
- m_engine->SetObjectType(rank, TYPEFIX);
+ m_engine->SetObjectType(rank, Gfx::ENG_OBJTYPE_FIX);
SetObjectRank(0, rank);
pModFile->ReadModel("objects\\root4.mod");
pModFile->CreateEngineObject(rank);
@@ -4980,7 +4956,7 @@ bool CObject::CreateRoot(Math::Vector pos, float angle, float height,
if ( type == OBJECT_ROOT5 ) // gravity root ?
{
rank = m_engine->CreateObject();
- m_engine->SetObjectType(rank, TYPEFIX);
+ m_engine->SetObjectType(rank, Gfx::ENG_OBJTYPE_FIX);
SetObjectRank(0, rank);
pModFile->ReadModel("objects\\root4.mod");
pModFile->CreateEngineObject(rank);
@@ -4989,7 +4965,7 @@ bool CObject::CreateRoot(Math::Vector pos, float angle, float height,
SetZoom(0, 2.0f);
rank = m_engine->CreateObject();
- m_engine->SetObjectType(rank, TYPEDESCENDANT);
+ m_engine->SetObjectType(rank, Gfx::ENG_OBJTYPE_DESCENDANT);
SetObjectRank(1, rank);
SetObjectParent(1, 0);
pModFile->ReadModel("objects\\root5.mod");
@@ -5013,13 +4989,13 @@ bool CObject::CreateRoot(Math::Vector pos, float angle, float height,
CreateShadowCircle(30.0f, 0.5f);
}
- pos = RetPosition(0);
+ pos = GetPosition(0);
SetPosition(0, pos); // to display the shadows immediately
SetFloorHeight(0.0f);
CreateOtherObject(type);
- pos = RetPosition(0);
+ pos = GetPosition(0);
pos.y += height;
SetPosition(0, pos);
@@ -5032,19 +5008,17 @@ bool CObject::CreateRoot(Math::Vector pos, float angle, float height,
bool CObject::CreateHome(Math::Vector pos, float angle, float height,
ObjectType type)
{
- CModFile* pModFile;
+ Gfx::CModelFile* pModFile;
int rank;
- if ( m_engine->RetRestCreate() < 1 ) return false;
-
- pModFile = new CModFile(m_iMan);
+ pModFile = new Gfx::CModelFile(m_iMan);
SetType(type);
if ( type == OBJECT_HOME1 )
{
rank = m_engine->CreateObject();
- m_engine->SetObjectType(rank, TYPEFIX);
+ m_engine->SetObjectType(rank, Gfx::ENG_OBJTYPE_FIX);
SetObjectRank(0, rank);
pModFile->ReadModel("objects\\home1.mod");
pModFile->CreateEngineObject(rank);
@@ -5057,13 +5031,13 @@ bool CObject::CreateHome(Math::Vector pos, float angle, float height,
CreateShadowCircle(16.0f, 0.5f);
}
- pos = RetPosition(0);
+ pos = GetPosition(0);
SetPosition(0, pos); // to display the shadows immediately
SetFloorHeight(0.0f);
CreateOtherObject(type);
- pos = RetPosition(0);
+ pos = GetPosition(0);
pos.y += height;
SetPosition(0, pos);
@@ -5076,18 +5050,16 @@ bool CObject::CreateHome(Math::Vector pos, float angle, float height,
bool CObject::CreateRuin(Math::Vector pos, float angle, float height,
ObjectType type)
{
- CModFile* pModFile;
+ Gfx::CModelFile* pModFile;
char name[50];
int rank;
- if ( m_engine->RetRestCreate() < 1+4 ) return false;
-
- pModFile = new CModFile(m_iMan);
+ pModFile = new Gfx::CModelFile(m_iMan);
SetType(type);
rank = m_engine->CreateObject();
- m_engine->SetObjectType(rank, TYPEFIX); // it is a stationary object
+ m_engine->SetObjectType(rank, Gfx::ENG_OBJTYPE_FIX); // it is a stationary object
SetObjectRank(0, rank);
name[0] = 0;
@@ -5115,7 +5087,7 @@ bool CObject::CreateRuin(Math::Vector pos, float angle, float height,
{
// Creates the right-back wheel.
rank = m_engine->CreateObject();
- m_engine->SetObjectType(rank, TYPEDESCENDANT);
+ m_engine->SetObjectType(rank, Gfx::ENG_OBJTYPE_DESCENDANT);
SetObjectRank(6, rank);
SetObjectParent(6, 0);
@@ -5127,7 +5099,7 @@ bool CObject::CreateRuin(Math::Vector pos, float angle, float height,
// Creates the left-back wheel.
rank = m_engine->CreateObject();
- m_engine->SetObjectType(rank, TYPEDESCENDANT);
+ m_engine->SetObjectType(rank, Gfx::ENG_OBJTYPE_DESCENDANT);
SetObjectRank(7, rank);
SetObjectParent(7, 0);
@@ -5140,7 +5112,7 @@ bool CObject::CreateRuin(Math::Vector pos, float angle, float height,
// Creates the right-front wheel.
rank = m_engine->CreateObject();
- m_engine->SetObjectType(rank, TYPEDESCENDANT);
+ m_engine->SetObjectType(rank, Gfx::ENG_OBJTYPE_DESCENDANT);
SetObjectRank(8, rank);
SetObjectParent(8, 0);
@@ -5152,7 +5124,7 @@ bool CObject::CreateRuin(Math::Vector pos, float angle, float height,
// Creates the left-front wheel.
rank = m_engine->CreateObject();
- m_engine->SetObjectType(rank, TYPEDESCENDANT);
+ m_engine->SetObjectType(rank, Gfx::ENG_OBJTYPE_DESCENDANT);
SetObjectRank(9, rank);
SetObjectParent(9, 0);
@@ -5173,7 +5145,7 @@ bool CObject::CreateRuin(Math::Vector pos, float angle, float height,
{
// Creates the left-back wheel.
rank = m_engine->CreateObject();
- m_engine->SetObjectType(rank, TYPEDESCENDANT);
+ m_engine->SetObjectType(rank, Gfx::ENG_OBJTYPE_DESCENDANT);
SetObjectRank(7, rank);
SetObjectParent(7, 0);
@@ -5186,7 +5158,7 @@ bool CObject::CreateRuin(Math::Vector pos, float angle, float height,
// Creates the left-front wheel.
rank = m_engine->CreateObject();
- m_engine->SetObjectType(rank, TYPEDESCENDANT);
+ m_engine->SetObjectType(rank, Gfx::ENG_OBJTYPE_DESCENDANT);
SetObjectRank(9, rank);
SetObjectParent(9, 0);
@@ -5207,7 +5179,7 @@ bool CObject::CreateRuin(Math::Vector pos, float angle, float height,
{
// Creates the cannon.
rank = m_engine->CreateObject();
- m_engine->SetObjectType(rank, TYPEDESCENDANT);
+ m_engine->SetObjectType(rank, Gfx::ENG_OBJTYPE_DESCENDANT);
SetObjectRank(1, rank);
SetObjectParent(1, 0);
@@ -5339,7 +5311,7 @@ bool CObject::CreateRuin(Math::Vector pos, float angle, float height,
CreateShadowCircle(30.0f, 1.0f);
}
- pos = RetPosition(0);
+ pos = GetPosition(0);
SetPosition(0, pos); //to display the shadows immediately
SetFloorHeight(0.0f);
@@ -5352,145 +5324,145 @@ bool CObject::CreateRuin(Math::Vector pos, float angle, float height,
FloorAdjust();
}
- pos = RetPosition(0);
+ pos = GetPosition(0);
pos.y += height;
SetPosition(0, pos); //to display the shadows immediately
if ( type == OBJECT_RUINmobilew1 )
{
- pos = RetPosition(0);
+ pos = GetPosition(0);
pos.y -= 0.5f;
SetPosition(0, pos);
- angle = RetAngleX(0)-0.1f;
+ angle = GetAngleX(0)-0.1f;
SetAngleX(0, angle);
}
if ( type == OBJECT_RUINmobilew2 )
{
- pos = RetPosition(0);
+ pos = GetPosition(0);
pos.y -= 1.5f;
SetPosition(0, pos);
- angle = RetAngleX(0)-0.9f;
+ angle = GetAngleX(0)-0.9f;
SetAngleX(0, angle);
- angle = RetAngleZ(0)-0.1f;
+ angle = GetAngleZ(0)-0.1f;
SetAngleZ(0, angle);
}
if ( type == OBJECT_RUINmobilet1 )
{
- pos = RetPosition(0);
+ pos = GetPosition(0);
pos.y -= 0.9f;
SetPosition(0, pos);
- angle = RetAngleX(0)-0.3f;
+ angle = GetAngleX(0)-0.3f;
SetAngleX(0, angle);
}
if ( type == OBJECT_RUINmobilet2 )
{
- pos = RetPosition(0);
+ pos = GetPosition(0);
pos.y -= 1.5f;
SetPosition(0, pos);
- angle = RetAngleX(0)-0.3f;
+ angle = GetAngleX(0)-0.3f;
SetAngleX(0, angle);
- angle = RetAngleZ(0)+0.8f;
+ angle = GetAngleZ(0)+0.8f;
SetAngleZ(0, angle);
}
if ( type == OBJECT_RUINmobiler1 )
{
- pos = RetPosition(0);
+ pos = GetPosition(0);
pos.y += 4.0f;
SetPosition(0, pos);
- angle = RetAngleX(0)-Math::PI*0.6f;
+ angle = GetAngleX(0)-Math::PI*0.6f;
SetAngleX(0, angle);
- angle = RetAngleZ(0)-0.2f;
+ angle = GetAngleZ(0)-0.2f;
SetAngleZ(0, angle);
}
if ( type == OBJECT_RUINmobiler2 )
{
- pos = RetPosition(0);
+ pos = GetPosition(0);
pos.y += 2.0f;
SetPosition(0, pos);
- angle = RetAngleX(0)-0.1f;
+ angle = GetAngleX(0)-0.1f;
SetAngleX(0, angle);
- angle = RetAngleZ(0)-0.3f;
+ angle = GetAngleZ(0)-0.3f;
SetAngleZ(0, angle);
}
if ( type == OBJECT_RUINdoor )
{
- pos = RetPosition(0);
+ pos = GetPosition(0);
pos.y -= 0.5f;
SetPosition(0, pos);
- angle = RetAngleZ(0)-0.1f;
+ angle = GetAngleZ(0)-0.1f;
SetAngleZ(0, angle);
}
if ( type == OBJECT_RUINsupport )
{
- pos = RetPosition(0);
+ pos = GetPosition(0);
pos.y += 0.5f;
SetPosition(0, pos);
-//? angle = RetAngleY(0)+0.1f;
+//? angle = GetAngleY(0)+0.1f;
//? SetAngleY(0, angle);
- angle = RetAngleX(0)+0.1f;
+ angle = GetAngleX(0)+0.1f;
SetAngleX(0, angle);
- angle = RetAngleZ(0)+0.1f;
+ angle = GetAngleZ(0)+0.1f;
SetAngleZ(0, angle);
}
if ( type == OBJECT_RUINradar )
{
- pos = RetPosition(0);
+ pos = GetPosition(0);
pos.y -= 0.5f;
SetPosition(0, pos);
- angle = RetAngleX(0)+0.15f;
+ angle = GetAngleX(0)+0.15f;
SetAngleX(0, angle);
- angle = RetAngleZ(0)+0.1f;
+ angle = GetAngleZ(0)+0.1f;
SetAngleZ(0, angle);
}
if ( type == OBJECT_RUINconvert )
{
- pos = RetPosition(0);
+ pos = GetPosition(0);
pos.y -= 1.0f;
SetPosition(0, pos);
}
if ( type == OBJECT_RUINbase )
{
- pos = RetPosition(0);
+ pos = GetPosition(0);
pos.y -= 1.0f;
SetPosition(0, pos);
- angle = RetAngleX(0)+0.15f;
+ angle = GetAngleX(0)+0.15f;
SetAngleX(0, angle);
}
if ( type == OBJECT_RUINhead )
{
- pos = RetPosition(0);
+ pos = GetPosition(0);
pos.y += 8.0f;
SetPosition(0, pos);
- angle = RetAngleX(0)+Math::PI*0.4f;
+ angle = GetAngleX(0)+Math::PI*0.4f;
SetAngleX(0, angle);
}
@@ -5502,19 +5474,17 @@ bool CObject::CreateRuin(Math::Vector pos, float angle, float height,
bool CObject::CreateApollo(Math::Vector pos, float angle, ObjectType type)
{
- CModFile* pModFile;
+ Gfx::CModelFile* pModFile;
int rank, i;
- if ( m_engine->RetRestCreate() < 6 ) return false;
-
- pModFile = new CModFile(m_iMan);
+ pModFile = new Gfx::CModelFile(m_iMan);
SetType(type);
if ( type == OBJECT_APOLLO1 ) // LEM ?
{
rank = m_engine->CreateObject();
- m_engine->SetObjectType(rank, TYPEFIX); // it is a stationary object
+ m_engine->SetObjectType(rank, Gfx::ENG_OBJTYPE_FIX); // it is a stationary object
SetObjectRank(0, rank);
pModFile->ReadModel("objects\\apollol1.mod");
pModFile->CreateEngineObject(rank);
@@ -5526,7 +5496,7 @@ bool CObject::CreateApollo(Math::Vector pos, float angle, ObjectType type)
for ( i=0 ; i<4 ; i++ ) // creates feet
{
rank = m_engine->CreateObject();
- m_engine->SetObjectType(rank, TYPEDESCENDANT);
+ m_engine->SetObjectType(rank, Gfx::ENG_OBJTYPE_DESCENDANT);
SetObjectRank(i+1, rank);
SetObjectParent(i+1, 0);
pModFile->ReadModel("objects\\apollol2.mod");
@@ -5535,7 +5505,7 @@ bool CObject::CreateApollo(Math::Vector pos, float angle, ObjectType type)
}
rank = m_engine->CreateObject();
- m_engine->SetObjectType(rank, TYPEDESCENDANT);
+ m_engine->SetObjectType(rank, Gfx::ENG_OBJTYPE_DESCENDANT);
SetObjectRank(5, rank);
SetObjectParent(5, 0);
pModFile->ReadModel("objects\\apollol3.mod"); // ladder
@@ -5557,7 +5527,7 @@ bool CObject::CreateApollo(Math::Vector pos, float angle, ObjectType type)
if ( type == OBJECT_APOLLO2 ) // jeep
{
rank = m_engine->CreateObject();
- m_engine->SetObjectType(rank, TYPEFIX); //it is a stationary object
+ m_engine->SetObjectType(rank, Gfx::ENG_OBJTYPE_FIX); //it is a stationary object
SetObjectRank(0, rank);
pModFile->ReadModel("objects\\apolloj1.mod");
pModFile->CreateEngineObject(rank);
@@ -5567,7 +5537,7 @@ bool CObject::CreateApollo(Math::Vector pos, float angle, ObjectType type)
// Wheels.
rank = m_engine->CreateObject();
- m_engine->SetObjectType(rank, TYPEDESCENDANT);
+ m_engine->SetObjectType(rank, Gfx::ENG_OBJTYPE_DESCENDANT);
SetObjectRank(1, rank);
SetObjectParent(1, 0);
pModFile->ReadModel("objects\\apolloj4.mod"); // wheel
@@ -5575,7 +5545,7 @@ bool CObject::CreateApollo(Math::Vector pos, float angle, ObjectType type)
SetPosition(1, Math::Vector(-5.75f, 1.65f, -5.0f));
rank = m_engine->CreateObject();
- m_engine->SetObjectType(rank, TYPEDESCENDANT);
+ m_engine->SetObjectType(rank, Gfx::ENG_OBJTYPE_DESCENDANT);
SetObjectRank(2, rank);
SetObjectParent(2, 0);
pModFile->ReadModel("objects\\apolloj4.mod"); // wheel
@@ -5583,7 +5553,7 @@ bool CObject::CreateApollo(Math::Vector pos, float angle, ObjectType type)
SetPosition(2, Math::Vector(-5.75f, 1.65f, 5.0f));
rank = m_engine->CreateObject();
- m_engine->SetObjectType(rank, TYPEDESCENDANT);
+ m_engine->SetObjectType(rank, Gfx::ENG_OBJTYPE_DESCENDANT);
SetObjectRank(3, rank);
SetObjectParent(3, 0);
pModFile->ReadModel("objects\\apolloj4.mod"); // wheel
@@ -5591,7 +5561,7 @@ bool CObject::CreateApollo(Math::Vector pos, float angle, ObjectType type)
SetPosition(3, Math::Vector(5.75f, 1.65f, -5.0f));
rank = m_engine->CreateObject();
- m_engine->SetObjectType(rank, TYPEDESCENDANT);
+ m_engine->SetObjectType(rank, Gfx::ENG_OBJTYPE_DESCENDANT);
SetObjectRank(4, rank);
SetObjectParent(4, 0);
pModFile->ReadModel("objects\\apolloj4.mod"); // wheel
@@ -5600,7 +5570,7 @@ bool CObject::CreateApollo(Math::Vector pos, float angle, ObjectType type)
// Accessories:
rank = m_engine->CreateObject();
- m_engine->SetObjectType(rank, TYPEDESCENDANT);
+ m_engine->SetObjectType(rank, Gfx::ENG_OBJTYPE_DESCENDANT);
SetObjectRank(5, rank);
SetObjectParent(5, 0);
pModFile->ReadModel("objects\\apolloj2.mod"); // antenna
@@ -5610,7 +5580,7 @@ bool CObject::CreateApollo(Math::Vector pos, float angle, ObjectType type)
SetAngleZ(5, 45.0f*Math::PI/180.0f);
rank = m_engine->CreateObject();
- m_engine->SetObjectType(rank, TYPEDESCENDANT);
+ m_engine->SetObjectType(rank, Gfx::ENG_OBJTYPE_DESCENDANT);
SetObjectRank(6, rank);
SetObjectParent(6, 0);
pModFile->ReadModel("objects\\apolloj3.mod"); // camera
@@ -5630,7 +5600,7 @@ bool CObject::CreateApollo(Math::Vector pos, float angle, ObjectType type)
if ( type == OBJECT_APOLLO3 ) // flag?
{
rank = m_engine->CreateObject();
- m_engine->SetObjectType(rank, TYPEFIX); // it is a stationary object
+ m_engine->SetObjectType(rank, Gfx::ENG_OBJTYPE_FIX); // it is a stationary object
SetObjectRank(0, rank);
pModFile->ReadModel("objects\\apollof.mod");
pModFile->CreateEngineObject(rank);
@@ -5645,7 +5615,7 @@ bool CObject::CreateApollo(Math::Vector pos, float angle, ObjectType type)
if ( type == OBJECT_APOLLO4 ) // module?
{
rank = m_engine->CreateObject();
- m_engine->SetObjectType(rank, TYPEFIX); // it is a stationary object
+ m_engine->SetObjectType(rank, Gfx::ENG_OBJTYPE_FIX); // it is a stationary object
SetObjectRank(0, rank);
pModFile->ReadModel("objects\\apollom.mod");
pModFile->CreateEngineObject(rank);
@@ -5662,7 +5632,7 @@ bool CObject::CreateApollo(Math::Vector pos, float angle, ObjectType type)
if ( type == OBJECT_APOLLO5 ) // antenna?
{
rank = m_engine->CreateObject();
- m_engine->SetObjectType(rank, TYPEFIX); // it is a stationary object
+ m_engine->SetObjectType(rank, Gfx::ENG_OBJTYPE_FIX); // it is a stationary object
SetObjectRank(0, rank);
pModFile->ReadModel("objects\\apolloa.mod");
pModFile->CreateEngineObject(rank);
@@ -5671,7 +5641,7 @@ bool CObject::CreateApollo(Math::Vector pos, float angle, ObjectType type)
SetFloorHeight(0.0f);
rank = m_engine->CreateObject();
- m_engine->SetObjectType(rank, TYPEDESCENDANT);
+ m_engine->SetObjectType(rank, Gfx::ENG_OBJTYPE_DESCENDANT);
SetObjectRank(1, rank);
SetObjectParent(1, 0);
pModFile->ReadModel("objects\\apolloj2.mod"); // antenna
@@ -5686,7 +5656,7 @@ bool CObject::CreateApollo(Math::Vector pos, float angle, ObjectType type)
CreateOtherObject(type);
- pos = RetPosition(0);
+ pos = GetPosition(0);
SetPosition(0, pos); // to display the shadows immediately
delete pModFile;
@@ -5804,7 +5774,7 @@ void CObject::CreateOtherObject(ObjectType type)
// Reads a program.
-bool CObject::ReadProgram(int rank, char* filename)
+bool CObject::ReadProgram(int rank, const char* filename)
{
if ( m_brain != 0 )
{
@@ -5845,7 +5815,7 @@ bool CObject::RunProgram(int rank)
// Calculates the matrix for transforming the object.
-// Returns true if the matrix has changed.
+// Geturns true if the matrix has changed.
// The rotations occur in the order Y, Z and X.
bool CObject::UpdateTransformObject(int part, bool bForceUpdate)
@@ -5916,7 +5886,7 @@ bool CObject::UpdateTransformObject(int part, bool bForceUpdate)
if ( part == 0 && m_truck != 0 ) // transported by a truck?
{
Math::Matrix* matWorldTruck;
- matWorldTruck = m_truck->RetWorldMatrix(m_truckLink);
+ matWorldTruck = m_truck->GetWorldMatrix(m_truckLink);
m_objectPart[part].matWorld = Math::MultiplyMatrices(*matWorldTruck,
m_objectPart[part].matTransform);
}
@@ -6043,7 +6013,7 @@ void CObject::FlatParent()
void CObject::UpdateEnergyMapping()
{
- D3DMATERIAL7 mat;
+ Gfx::Material mat;
float a, b, i, s, au, bu;
float limit[6];
int j;
@@ -6051,7 +6021,7 @@ void CObject::UpdateEnergyMapping()
if ( fabs(m_energy-m_lastEnergy) < 0.01f ) return;
m_lastEnergy = m_energy;
- ZeroMemory( &mat, sizeof(D3DMATERIAL7) );
+ memset(&mat, 0, sizeof(mat));
mat.diffuse.r = 1.0f;
mat.diffuse.g = 1.0f;
mat.diffuse.b = 1.0f; // white
@@ -6083,17 +6053,17 @@ void CObject::UpdateEnergyMapping()
bu = s-b*(s-i)/(b-a);
limit[0] = 0.0f;
- limit[1] = m_engine->RetLimitLOD(0);
+ limit[1] = m_engine->GetLimitLOD(0);
limit[2] = limit[1];
- limit[3] = m_engine->RetLimitLOD(1);
+ limit[3] = m_engine->GetLimitLOD(1);
limit[4] = limit[3];
limit[5] = 1000000.0f;
for ( j=0 ; j<3 ; j++ )
{
m_engine->ChangeTextureMapping(m_objectPart[0].object,
- mat, D3DSTATEPART3, "lemt.tga", "",
- limit[j*2+0], limit[j*2+1], D3DMAPPING1Y,
+ mat, Gfx::ENG_RSTATE_PART3, "lemt.png", "",
+ limit[j*2+0], limit[j*2+1], Gfx::ENG_TEX_MAPPING_1Y,
au, bu, 1.0f, 0.0f);
}
}
@@ -6103,7 +6073,7 @@ void CObject::UpdateEnergyMapping()
bool CObject::EventProcess(const Event &event)
{
- if ( event.event == EVENT_KEYDOWN )
+ if ( event.type == EVENT_KEY_DOWN )
{
#if ADJUST_ONBOARD
if ( m_bSelect )
@@ -6147,12 +6117,12 @@ bool CObject::EventProcess(const Event &event)
{
if ( !m_physics->EventProcess(event) ) // object destroyed?
{
- if ( RetSelect() &&
+ if ( GetSelect() &&
m_type != OBJECT_ANT &&
m_type != OBJECT_SPIDER &&
m_type != OBJECT_BEE )
{
- if ( !m_bDead ) m_camera->SetType(CAMERA_EXPLO);
+ if ( !m_bDead ) m_camera->SetType(Gfx::CAM_TYPE_EXPLO);
m_main->DeselectAll();
}
return false;
@@ -6163,7 +6133,7 @@ bool CObject::EventProcess(const Event &event)
{
m_auto->EventProcess(event);
- if ( event.event == EVENT_FRAME &&
+ if ( event.type == EVENT_FRAME &&
m_auto->IsEnded() != ERR_CONTINUE )
{
m_auto->DeleteObject();
@@ -6177,7 +6147,7 @@ bool CObject::EventProcess(const Event &event)
m_motion->EventProcess(event);
}
- if ( event.event == EVENT_FRAME )
+ if ( event.type == EVENT_FRAME )
{
return EventFrame(event);
}
@@ -6190,13 +6160,13 @@ bool CObject::EventProcess(const Event &event)
bool CObject::EventFrame(const Event &event)
{
- if ( m_type == OBJECT_HUMAN && m_main->RetMainMovie() == MM_SATCOMopen )
+ if ( m_type == OBJECT_HUMAN && m_main->GetMainMovie() == MM_SATCOMopen )
{
UpdateTransformObject();
return true;
}
- if ( m_type != OBJECT_SHOW && m_engine->RetPause() ) return true;
+ if ( m_type != OBJECT_SHOW && m_engine->GetPause() ) return true;
m_aTime += event.rTime;
m_shotTime += event.rTime;
@@ -6206,23 +6176,23 @@ bool CObject::EventFrame(const Event &event)
UpdateMapping();
UpdateTransformObject();
- UpdateSelectParticule();
+ UpdateSelectParticle();
if ( m_bProxyActivate ) // active if it is near?
{
- CPyro* pyro;
+ Gfx::CPyro* pyro;
Math::Vector eye;
float dist;
- eye = m_engine->RetLookatPt();
- dist = Math::Distance(eye, RetPosition(0));
+ eye = m_engine->GetLookatPt();
+ dist = Math::Distance(eye, GetPosition(0));
if ( dist < m_proxyDistance )
{
m_bProxyActivate = false;
m_main->CreateShortcuts();
m_sound->Play(SOUND_FINDING);
- pyro = new CPyro(m_iMan);
- pyro->Create(PT_FINDING, this, 0.0f);
+ pyro = new Gfx::CPyro(m_iMan);
+ pyro->Create(Gfx::PT_FINDING, this, 0.0f);
m_displayText->DisplayError(INFO_FINDING, this);
}
}
@@ -6248,10 +6218,10 @@ void CObject::UpdateMapping()
void CObject::VirusFrame(float rTime)
{
- ParticuleType type;
+ Gfx::ParticleType type;
Math::Vector pos, speed;
Math::Point dim;
- int r;
+ int r;
if ( !m_bVirusMode ) return; // healthy object?
@@ -6261,23 +6231,23 @@ void CObject::VirusFrame(float rTime)
m_bVirusMode = false; // the virus is no longer active
}
- if ( m_lastVirusParticule+m_engine->ParticuleAdapt(0.2f) <= m_aTime )
+ if ( m_lastVirusParticle+m_engine->ParticleAdapt(0.2f) <= m_aTime )
{
- m_lastVirusParticule = m_aTime;
+ m_lastVirusParticle = m_aTime;
r = rand()%10;
- if ( r == 0 ) type = PARTIVIRUS1;
- if ( r == 1 ) type = PARTIVIRUS2;
- if ( r == 2 ) type = PARTIVIRUS3;
- if ( r == 3 ) type = PARTIVIRUS4;
- if ( r == 4 ) type = PARTIVIRUS5;
- if ( r == 5 ) type = PARTIVIRUS6;
- if ( r == 6 ) type = PARTIVIRUS7;
- if ( r == 7 ) type = PARTIVIRUS8;
- if ( r == 8 ) type = PARTIVIRUS9;
- if ( r == 9 ) type = PARTIVIRUS10;
-
- pos = RetPosition(0);
+ if ( r == 0 ) type = Gfx::PARTIVIRUS1;
+ if ( r == 1 ) type = Gfx::PARTIVIRUS2;
+ if ( r == 2 ) type = Gfx::PARTIVIRUS3;
+ if ( r == 3 ) type = Gfx::PARTIVIRUS4;
+ if ( r == 4 ) type = Gfx::PARTIVIRUS5;
+ if ( r == 5 ) type = Gfx::PARTIVIRUS6;
+ if ( r == 6 ) type = Gfx::PARTIVIRUS7;
+ if ( r == 7 ) type = Gfx::PARTIVIRUS8;
+ if ( r == 8 ) type = Gfx::PARTIVIRUS9;
+ if ( r == 9 ) type = Gfx::PARTIVIRUS10;
+
+ pos = GetPosition(0);
pos.x += (Math::Rand()-0.5f)*10.0f;
pos.z += (Math::Rand()-0.5f)*10.0f;
speed.x = (Math::Rand()-0.5f)*2.0f;
@@ -6286,7 +6256,7 @@ void CObject::VirusFrame(float rTime)
dim.x = Math::Rand()*0.3f+0.3f;
dim.y = dim.x;
- m_particule->CreateParticule(pos, speed, dim, type, 3.0f);
+ m_particle->CreateParticle(pos, speed, dim, type, 3.0f);
}
}
@@ -6304,7 +6274,7 @@ void CObject::PartiFrame(float rTime)
channel = m_objectPart[i].masterParti;
if ( channel == -1 ) continue;
- if ( !m_particule->GetPosition(channel, pos) )
+ if ( !m_particle->GetPosition(channel, pos) )
{
m_objectPart[i].masterParti = -1; // particle no longer exists!
continue;
@@ -6322,7 +6292,7 @@ void CObject::PartiFrame(float rTime)
case 4: factor = Math::Vector( 0.4f, 0.1f,-0.7f); break;
}
- angle = RetAngle(i);
+ angle = GetAngle(i);
angle += rTime*Math::PI*factor;
SetAngle(i, angle);
}
@@ -6334,7 +6304,7 @@ void CObject::PartiFrame(float rTime)
void CObject::SetViewFromHere(Math::Vector &eye, float &dirH, float &dirV,
Math::Vector &lookat, Math::Vector &upVec,
- CameraType type)
+ Gfx::CameraType type)
{
float speed;
int part;
@@ -6429,7 +6399,7 @@ void CObject::SetViewFromHere(Math::Vector &eye, float &dirH, float &dirV,
m_engine->SetInfoText(4, s);
#endif
- if ( type == CAMERA_BACK )
+ if ( type == Gfx::CAM_TYPE_BACK )
{
eye.x -= 20.0f;
eye.y += 1.0f;
@@ -6446,20 +6416,20 @@ void CObject::SetViewFromHere(Math::Vector &eye, float &dirH, float &dirV,
upVec = Math::Vector(0.0f, 1.0f, 0.0f);
if ( m_physics != 0 )
{
- if ( m_physics->RetLand() ) // on ground?
+ if ( m_physics->GetLand() ) // on ground?
{
- speed = m_physics->RetLinMotionX(MO_REASPEED);
+ speed = m_physics->GetLinMotionX(MO_REASPEED);
lookat.y -= speed*0.002f;
- speed = m_physics->RetCirMotionY(MO_REASPEED);
+ speed = m_physics->GetCirMotionY(MO_REASPEED);
upVec.z -= speed*0.04f;
}
else // in flight?
{
- speed = m_physics->RetLinMotionX(MO_REASPEED);
+ speed = m_physics->GetLinMotionX(MO_REASPEED);
lookat.y += speed*0.002f;
- speed = m_physics->RetCirMotionY(MO_REASPEED);
+ speed = m_physics->GetCirMotionY(MO_REASPEED);
upVec.z += speed*0.08f;
}
}
@@ -6475,23 +6445,23 @@ void CObject::SetViewFromHere(Math::Vector &eye, float &dirH, float &dirV,
void CObject::SetCharacter(Character* character)
{
- CopyMemory(&m_character, character, sizeof(Character));
+ memcpy(&m_character, character, sizeof(m_character));
}
void CObject::GetCharacter(Character* character)
{
- CopyMemory(character, &m_character, sizeof(Character));
+ memcpy(character, &m_character, sizeof(character));
}
-Character* CObject::RetCharacter()
+Character* CObject::GetCharacter()
{
return &m_character;
}
-// Returns the absolute time.
+// Geturns the absolute time.
-float CObject::RetAbsTime()
+float CObject::GetAbsTime()
{
return m_aTime;
}
@@ -6507,7 +6477,7 @@ void CObject::SetEnergy(float level)
m_energy = level;
}
-float CObject::RetEnergy()
+float CObject::GetEnergy()
{
if ( m_type != OBJECT_POWER &&
m_type != OBJECT_ATOMIC &&
@@ -6526,7 +6496,7 @@ void CObject::SetCapacity(float capacity)
m_capacity = capacity;
}
-float CObject::RetCapacity()
+float CObject::GetCapacity()
{
return m_capacity;
}
@@ -6539,7 +6509,7 @@ void CObject::SetShield(float level)
m_shield = level;
}
-float CObject::RetShield()
+float CObject::GetShield()
{
if ( m_type == OBJECT_FRET ||
m_type == OBJECT_STONE ||
@@ -6582,7 +6552,7 @@ void CObject::SetRange(float delay)
m_range = delay;
}
-float CObject::RetRange()
+float CObject::GetRange()
{
return m_range;
}
@@ -6610,7 +6580,7 @@ void CObject::SetTransparency(float value)
}
}
-float CObject::RetTransparency()
+float CObject::GetTransparency()
{
return m_transparency;
}
@@ -6618,7 +6588,7 @@ float CObject::RetTransparency()
// Management of the object matter.
-ObjectMaterial CObject::RetMaterial()
+ObjectMaterial CObject::GetMaterial()
{
if ( m_type == OBJECT_HUMAN )
{
@@ -6642,7 +6612,7 @@ void CObject::SetGadget(bool bMode)
m_bGadget = bMode;
}
-bool CObject::RetGadget()
+bool CObject::GetGadget()
{
return m_bGadget;
}
@@ -6655,7 +6625,7 @@ void CObject::SetFixed(bool bFixed)
m_bFixed = bFixed;
}
-bool CObject::RetFixed()
+bool CObject::GetFixed()
{
return m_bFixed;
}
@@ -6668,7 +6638,7 @@ void CObject::SetClip(bool bClip)
m_bClip = bClip;
}
-bool CObject::RetClip()
+bool CObject::GetClip()
{
return m_bClip;
}
@@ -6696,7 +6666,7 @@ bool CObject::JostleObject(float force)
if ( m_auto != 0 ) return false;
m_auto = new CAutoJostle(m_iMan, this);
- pa = (CAutoJostle*)m_auto;
+ pa = static_cast<CAutoJostle*>(m_auto);
pa->Start(0, force);
}
@@ -6712,7 +6682,7 @@ void CObject::StartDetectEffect(CObject *target, bool bFound)
Math::Vector pos, goal;
Math::Point dim;
- mat = RetWorldMatrix(0);
+ mat = GetWorldMatrix(0);
pos = Math::Transform(*mat, Math::Vector(2.0f, 3.0f, 0.0f));
if ( target == 0 )
@@ -6721,24 +6691,24 @@ void CObject::StartDetectEffect(CObject *target, bool bFound)
}
else
{
- goal = target->RetPosition(0);
+ goal = target->GetPosition(0);
goal.y += 3.0f;
goal = Math::SegmentPoint(pos, goal, Math::Distance(pos, goal)-3.0f);
}
dim.x = 3.0f;
dim.y = dim.x;
- m_particule->CreateRay(pos, goal, PARTIRAY2, dim, 0.2f);
+ m_particle->CreateRay(pos, goal, Gfx::PARTIRAY2, dim, 0.2f);
if ( target != 0 )
{
- goal = target->RetPosition(0);
+ goal = target->GetPosition(0);
goal.y += 3.0f;
goal = Math::SegmentPoint(pos, goal, Math::Distance(pos, goal)-1.0f);
dim.x = 6.0f;
dim.y = dim.x;
- m_particule->CreateParticule(goal, Math::Vector(0.0f, 0.0f, 0.0f), dim,
- bFound?PARTIGLINT:PARTIGLINTr, 0.5f);
+ m_particle->CreateParticle(goal, Math::Vector(0.0f, 0.0f, 0.0f), dim,
+ bFound?Gfx::PARTIGLINT:Gfx::PARTIGLINTr, 0.5f);
}
m_sound->Play(bFound?SOUND_BUILD:SOUND_RECOVER);
@@ -6761,12 +6731,12 @@ void CObject::SetVirusMode(bool bEnable)
}
}
-bool CObject::RetVirusMode()
+bool CObject::GetVirusMode()
{
return m_bVirusMode;
}
-float CObject::RetVirusTime()
+float CObject::GetVirusTime()
{
return m_virusTime;
}
@@ -6774,12 +6744,12 @@ float CObject::RetVirusTime()
// Management mode of the camera.
-void CObject::SetCameraType(CameraType type)
+void CObject::SetCameraType(Gfx::CameraType type)
{
m_cameraType = type;
}
-CameraType CObject::RetCameraType()
+Gfx::CameraType CObject::GetCameraType()
{
return m_cameraType;
}
@@ -6789,7 +6759,7 @@ void CObject::SetCameraDist(float dist)
m_cameraDist = dist;
}
-float CObject::RetCameraDist()
+float CObject::GetCameraDist()
{
return m_cameraDist;
}
@@ -6799,7 +6769,7 @@ void CObject::SetCameraLock(bool bLock)
m_bCameraLock = bLock;
}
-bool CObject::RetCameraLock()
+bool CObject::GetCameraLock()
{
return m_bCameraLock;
}
@@ -6827,11 +6797,11 @@ void CObject::SetHilite(bool bMode)
}
list[j] = -1; // terminate
- m_engine->SetHiliteRank(list); // gives the list of selected parts
+ m_engine->SetHighlightRank(list); // gives the list of selected parts
}
}
-bool CObject::RetHilite()
+bool CObject::GetHilite()
{
return m_bHilite;
}
@@ -6855,7 +6825,7 @@ void CObject::SetSelect(bool bMode, bool bDisplayError)
m_auto->CreateInterface(m_bSelect);
}
- CreateSelectParticule(); // creates / removes particles
+ CreateSelectParticle(); // creates / removes particles
if ( !m_bSelect )
{
@@ -6866,11 +6836,11 @@ void CObject::SetSelect(bool bMode, bool bDisplayError)
err = ERR_OK;
if ( m_physics != 0 )
{
- err = m_physics->RetError();
+ err = m_physics->GetError();
}
if ( m_auto != 0 )
{
- err = m_auto->RetError();
+ err = m_auto->GetError();
}
if ( err != ERR_OK && bDisplayError )
{
@@ -6880,9 +6850,9 @@ void CObject::SetSelect(bool bMode, bool bDisplayError)
// Indicates whether the object is selected or not.
-bool CObject::RetSelect(bool bReal)
+bool CObject::GetSelect(bool bReal)
{
- if ( !bReal && m_main->RetFixScene() ) return false;
+ if ( !bReal && m_main->GetFixScene() ) return false;
return m_bSelect;
}
@@ -6896,7 +6866,7 @@ void CObject::SetSelectable(bool bMode)
// Indicates whether the object is selecionnable or not.
-bool CObject::RetSelectable()
+bool CObject::GetSelectable()
{
return m_bSelectable;
}
@@ -6912,11 +6882,11 @@ void CObject::SetActivity(bool bMode)
}
}
-bool CObject::RetActivity()
+bool CObject::GetActivity()
{
if ( m_brain != 0 )
{
- return m_brain->RetActivity();
+ return m_brain->GetActivity();
}
return false;
}
@@ -6931,7 +6901,7 @@ void CObject::SetCheckToken(bool bMode)
// Indicates if necessary to check the tokens of the object.
-bool CObject::RetCheckToken()
+bool CObject::GetCheckToken()
{
return m_bCheckToken;
}
@@ -6946,7 +6916,7 @@ void CObject::SetVisible(bool bVisible)
m_bVisible = bVisible;
}
-bool CObject::RetVisible()
+bool CObject::GetVisible()
{
return m_bVisible;
}
@@ -6962,7 +6932,7 @@ void CObject::SetEnable(bool bEnable)
m_bEnable = bEnable;
}
-bool CObject::RetEnable()
+bool CObject::GetEnable()
{
return m_bEnable;
}
@@ -6975,7 +6945,7 @@ void CObject::SetProxyActivate(bool bActivate)
m_bProxyActivate = bActivate;
}
-bool CObject::RetProxyActivate()
+bool CObject::GetProxyActivate()
{
return m_bProxyActivate;
}
@@ -6985,7 +6955,7 @@ void CObject::SetProxyDistance(float distance)
m_proxyDistance = distance;
}
-float CObject::RetProxyDistance()
+float CObject::GetProxyDistance()
{
return m_proxyDistance;
}
@@ -6998,7 +6968,7 @@ void CObject::SetMagnifyDamage(float factor)
m_magnifyDamage = factor;
}
-float CObject::RetMagnifyDamage()
+float CObject::GetMagnifyDamage()
{
return m_magnifyDamage;
}
@@ -7011,7 +6981,7 @@ void CObject::SetParam(float value)
m_param = value;
}
-float CObject::RetParam()
+float CObject::GetParam()
{
return m_param;
}
@@ -7026,7 +6996,7 @@ void CObject::SetLock(bool bLock)
m_bLock = bLock;
}
-bool CObject::RetLock()
+bool CObject::GetLock()
{
return m_bLock;
}
@@ -7039,7 +7009,7 @@ void CObject::SetExplo(bool bExplo)
m_bExplo = bExplo;
}
-bool CObject::RetExplo()
+bool CObject::GetExplo()
{
return m_bExplo;
}
@@ -7052,7 +7022,7 @@ void CObject::SetCargo(bool bCargo)
m_bCargo = bCargo;
}
-bool CObject::RetCargo()
+bool CObject::GetCargo()
{
return m_bCargo;
}
@@ -7071,7 +7041,7 @@ void CObject::SetBurn(bool bBurn)
//? }
}
-bool CObject::RetBurn()
+bool CObject::GetBurn()
{
return m_bBurn;
}
@@ -7092,17 +7062,17 @@ void CObject::SetDead(bool bDead)
//? }
}
-bool CObject::RetDead()
+bool CObject::GetDead()
{
return m_bDead;
}
-bool CObject::RetRuin()
+bool CObject::GetRuin()
{
return m_bBurn|m_bFlat;
}
-bool CObject::RetActif()
+bool CObject::GetActif()
{
return !m_bLock && !m_bBurn && !m_bFlat && m_bVisible && m_bEnable;
}
@@ -7178,12 +7148,12 @@ void CObject::SetGunGoalH(float gunGoal)
m_gunGoalH = gunGoal;
}
-float CObject::RetGunGoalV()
+float CObject::GetGunGoalV()
{
return m_gunGoalV;
}
-float CObject::RetGunGoalH()
+float CObject::GetGunGoalH()
{
return m_gunGoalH;
}
@@ -7196,7 +7166,7 @@ bool CObject::StartShowLimit()
{
if ( m_showLimitRadius == 0.0f ) return false;
- m_main->SetShowLimit(0, PARTILIMIT1, this, RetPosition(0), m_showLimitRadius);
+ m_main->SetShowLimit(0, Gfx::PARTILIMIT1, this, GetPosition(0), m_showLimitRadius);
m_bShowLimit = true;
return true;
}
@@ -7219,7 +7189,7 @@ bool CObject::IsProgram()
// Creates or removes particles associated to the object.
-void CObject::CreateSelectParticule()
+void CObject::CreateSelectParticle()
{
Math::Vector pos, speed;
Math::Point dim;
@@ -7230,7 +7200,7 @@ void CObject::CreateSelectParticule()
{
if ( m_partiSel[i] != -1 )
{
- m_particule->DeleteParticule(m_partiSel[i]);
+ m_particle->DeleteParticle(m_partiSel[i]);
m_partiSel[i] = -1;
}
}
@@ -7270,18 +7240,18 @@ void CObject::CreateSelectParticule()
speed = Math::Vector(0.0f, 0.0f, 0.0f);
dim.x = 0.0f;
dim.y = 0.0f;
- m_partiSel[0] = m_particule->CreateParticule(pos, speed, dim, PARTISELY, 1.0f, 0.0f, 0.0f);
- m_partiSel[1] = m_particule->CreateParticule(pos, speed, dim, PARTISELY, 1.0f, 0.0f, 0.0f);
- m_partiSel[2] = m_particule->CreateParticule(pos, speed, dim, PARTISELR, 1.0f, 0.0f, 0.0f);
- m_partiSel[3] = m_particule->CreateParticule(pos, speed, dim, PARTISELR, 1.0f, 0.0f, 0.0f);
- UpdateSelectParticule();
+ m_partiSel[0] = m_particle->CreateParticle(pos, speed, dim, Gfx::PARTISELY, 1.0f, 0.0f, 0.0f);
+ m_partiSel[1] = m_particle->CreateParticle(pos, speed, dim, Gfx::PARTISELY, 1.0f, 0.0f, 0.0f);
+ m_partiSel[2] = m_particle->CreateParticle(pos, speed, dim, Gfx::PARTISELR, 1.0f, 0.0f, 0.0f);
+ m_partiSel[3] = m_particle->CreateParticle(pos, speed, dim, Gfx::PARTISELR, 1.0f, 0.0f, 0.0f);
+ UpdateSelectParticle();
}
}
}
// Updates the particles associated to the object.
-void CObject::UpdateSelectParticule()
+void CObject::UpdateSelectParticle()
{
Math::Vector pos[4];
Math::Point dim[4];
@@ -7405,7 +7375,7 @@ void CObject::UpdateSelectParticule()
pos[3] = Math::Vector(-5.3f, 2.7f, -1.8f);
}
- angle = RetAngleY(0)/Math::PI;
+ angle = GetAngleY(0)/Math::PI;
zoom[0] = 1.0f;
zoom[1] = 1.0f;
@@ -7426,7 +7396,7 @@ void CObject::UpdateSelectParticule()
{
pos[i] = Math::Transform(m_objectPart[0].matWorld, pos[i]);
dim[i].y = dim[i].x;
- m_particule->SetParam(m_partiSel[i], pos[i], dim[i], zoom[i], angle, 1.0f);
+ m_particle->SetParam(m_partiSel[i], pos[i], dim[i], zoom[i], angle, 1.0f);
}
}
@@ -7438,42 +7408,42 @@ void CObject::SetRunScript(CScript* script)
m_runScript = script;
}
-CScript* CObject::RetRunScript()
+CScript* CObject::GetRunScript()
{
return m_runScript;
}
-// Returns the variables of "this" for CBOT.
+// Geturns the variables of "this" for CBOT.
-CBotVar* CObject::RetBotVar()
+CBotVar* CObject::GetBotVar()
{
return m_botVar;
}
-// Returns the physics associated to the object.
+// Geturns the physics associated to the object.
-CPhysics* CObject::RetPhysics()
+CPhysics* CObject::GetPhysics()
{
return m_physics;
}
-// Returns the brain associated to the object.
+// Geturns the brain associated to the object.
-CBrain* CObject::RetBrain()
+CBrain* CObject::GetBrain()
{
return m_brain;
}
-// Returns the movement associated to the object.
+// Geturns the movement associated to the object.
-CMotion* CObject::RetMotion()
+CMotion* CObject::GetMotion()
{
return m_motion;
}
-// Returns the controller associated to the object.
+// Geturns the controller associated to the object.
-CAuto* CObject::RetAuto()
+CAuto* CObject::GetAuto()
{
return m_auto;
}
@@ -7492,7 +7462,7 @@ void CObject::SetDefRank(int rank)
m_defRank = rank;
}
-int CObject::RetDefRank()
+int CObject::GetDefRank()
{
return m_defRank;
}
@@ -7555,51 +7525,51 @@ void CObject::DeleteDeselList(CObject* pObj)
// Management of the state of the pencil drawing robot.
-bool CObject::RetTraceDown()
+bool CObject::GetTraceDown()
{
CMotionVehicle* mv;
if ( m_motion == 0 ) return false;
- mv = (CMotionVehicle*)m_motion;
- return mv->RetTraceDown();
+ mv = dynamic_cast<CMotionVehicle*>(m_motion);
+ return mv->GetTraceDown();
}
void CObject::SetTraceDown(bool bDown)
{
CMotionVehicle* mv;
if ( m_motion == 0 ) return;
- mv = (CMotionVehicle*)m_motion;
+ mv = dynamic_cast<CMotionVehicle*>(m_motion);
mv->SetTraceDown(bDown);
}
-int CObject::RetTraceColor()
+int CObject::GetTraceColor()
{
CMotionVehicle* mv;
if ( m_motion == 0 ) return 0;
- mv = (CMotionVehicle*)m_motion;
- return mv->RetTraceColor();
+ mv = dynamic_cast<CMotionVehicle*>(m_motion);
+ return mv->GetTraceColor();
}
void CObject::SetTraceColor(int color)
{
CMotionVehicle* mv;
if ( m_motion == 0 ) return;
- mv = (CMotionVehicle*)m_motion;
+ mv = dynamic_cast<CMotionVehicle*>(m_motion);
mv->SetTraceColor(color);
}
-float CObject::RetTraceWidth()
+float CObject::GetTraceWidth()
{
CMotionVehicle* mv;
if ( m_motion == 0 ) return 0.0f;
- mv = (CMotionVehicle*)m_motion;
- return mv->RetTraceWidth();
+ mv = dynamic_cast<CMotionVehicle*>(m_motion);
+ return mv->GetTraceWidth();
}
void CObject::SetTraceWidth(float width)
{
CMotionVehicle* mv;
if ( m_motion == 0 ) return;
- mv = (CMotionVehicle*)m_motion;
+ mv = dynamic_cast<CMotionVehicle*>(m_motion);
mv->SetTraceWidth(width);
}
diff --git a/src/object/object.h b/src/object/object.h
index 88ae486..1301768 100644
--- a/src/object/object.h
+++ b/src/object/object.h
@@ -35,7 +35,10 @@ class CRobotMain;
class CBotVar;
class CScript;
-
+namespace Ui
+{
+class CDisplayText;
+}
// The father of all parts must always be the part number zero!
@@ -46,69 +49,70 @@ const int OBJECTMAXDESELLIST = 10;
const int OBJECTMAXINFO = 10;
const int OBJECTMAXCMDLINE = 20;
+
enum ObjectMaterial
{
- OM_METAL = 0, // metal
- OM_PLASTIC = 1, // plastic
- OM_HUMAN = 2, // cosmonaut
- OM_ANIMAL = 3, // insect
- OM_VEGETAL = 4, // plant
- OM_MINERAL = 5, // stone
+ OM_METAL = 0, // metal
+ OM_PLASTIC = 1, // plastic
+ OM_HUMAN = 2, // cosmonaut
+ OM_ANIMAL = 3, // insect
+ OM_VEGETAL = 4, // plant
+ OM_MINERAL = 5, // stone
};
struct ObjectPart
{
- char bUsed;
- int object; // number of the object in CEngine
- int parentPart; // number of father part
- int masterParti; // master canal of the particle
- Math::Vector position;
- Math::Vector angle;
- Math::Vector zoom;
- char bTranslate;
- char bRotate;
- char bZoom;
- Math::Matrix matTranslate;
- Math::Matrix matRotate;
- Math::Matrix matTransform;
- Math::Matrix matWorld;
+ char bUsed;
+ int object; // number of the object in CEngine
+ int parentPart; // number of father part
+ int masterParti; // master canal of the particle
+ Math::Vector position;
+ Math::Vector angle;
+ Math::Vector zoom;
+ char bTranslate;
+ char bRotate;
+ char bZoom;
+ Math::Matrix matTranslate;
+ Math::Matrix matRotate;
+ Math::Matrix matTransform;
+ Math::Matrix matWorld;
};
struct Character
{
- float wheelFront; // position X of the front wheels
- float wheelBack; // position X of the back wheels
- float wheelLeft; // position Z of the left wheels
- float wheelRight; // position Z of the right wheels
- float height; // normal height on top of ground
- Math::Vector posPower; // position of the battery
+ float wheelFront; // position X of the front wheels
+ float wheelBack; // position X of the back wheels
+ float wheelLeft; // position Z of the left wheels
+ float wheelRight; // position Z of the right wheels
+ float height; // normal height on top of ground
+ Math::Vector posPower; // position of the battery
};
struct Info
{
- char name[20]; // name of the information
- float value; // value of the information
+ char name[20]; // name of the information
+ float value; // value of the information
};
enum ExploType
{
- EXPLO_BOUM = 1,
- EXPLO_BURN = 2,
- EXPLO_WATER = 3,
+ EXPLO_BOUM = 1,
+ EXPLO_BURN = 2,
+ EXPLO_WATER = 3,
};
enum ResetCap
{
- RESET_NONE = 0,
- RESET_MOVE = 1,
- RESET_DELETE = 2,
+ RESET_NONE = 0,
+ RESET_MOVE = 1,
+ RESET_DELETE = 2,
};
enum RadarFilter
{
- FILTER_NONE = 0,
- FILTER_ONLYLANDING = 1,
- FILTER_ONLYFLYING = 2,
+ FILTER_NONE = 0,
+ FILTER_ONLYLANDING = 1,
+ FILTER_ONLYFLYING = 2,
};
@@ -162,7 +166,7 @@ public:
bool CreateRuin(Math::Vector pos, float angle, float height, ObjectType type);
bool CreateApollo(Math::Vector pos, float angle, ObjectType type);
- bool ReadProgram(int rank, char* filename);
+ bool ReadProgram(int rank, const char* filename);
bool WriteProgram(int rank, char* filename);
bool RunProgram(int rank);
@@ -235,8 +239,8 @@ public:
void SetResetRun(int run);
int GetResetRun();
- void SetMasterParticule(int part, int parti);
- int GetMasterParticule(int part);
+ void SetMasterParticle(int part, int parti);
+ int GetMasterParticle(int part);
void SetPower(CObject* power);
CObject* GetPower();
@@ -252,8 +256,8 @@ public:
void SetInfo(int rank, Info info);
Info GetInfo(int rank);
int GetInfoTotal();
- void SetInfoGeturn(float value);
- float GetInfoGeturn();
+ void SetInfoReturn(float value);
+ float GetInfoReturn();
void SetInfoUpdate(bool bUpdate);
bool GetInfoUpdate();
@@ -370,7 +374,7 @@ public:
void StopShowLimit();
bool IsProgram();
- void CreateSelectParticule();
+ void CreateSelectParticle();
void SetRunScript(CScript* script);
CScript* GetRunScript();
@@ -414,25 +418,25 @@ protected:
void UpdateEnergyMapping();
bool UpdateTransformObject(int part, bool bForceUpdate);
bool UpdateTransformObject();
- void UpdateSelectParticule();
+ void UpdateSelectParticle();
protected:
- CInstanceManager* m_iMan;
- Gfx::CEngine* m_engine;
- Gfx::CLightManager* m_lightMan;
- Gfx::CTerrain* m_terrain;
- Gfx::CWater* m_water;
- Gfx::CCamera* m_camera;
- Gfx::CParticle* m_particle;
- CPhysics* m_physics;
- CBrain* m_brain;
- CMotion* m_motion;
- CAuto* m_auto;
- CDisplayText* m_displayText;
- CRobotMain* m_main;
- CSoundInterface* m_sound;
- CBotVar* m_botVar;
- CScript* m_runScript;
+ CInstanceManager* m_iMan;
+ Gfx::CEngine* m_engine;
+ Gfx::CLightManager* m_lightMan;
+ Gfx::CTerrain* m_terrain;
+ Gfx::CWater* m_water;
+ Gfx::CCamera* m_camera;
+ Gfx::CParticle* m_particle;
+ CPhysics* m_physics;
+ CBrain* m_brain;
+ CMotion* m_motion;
+ CAuto* m_auto;
+ Ui::CDisplayText* m_displayText;
+ CRobotMain* m_main;
+ CSoundInterface* m_sound;
+ CBotVar* m_botVar;
+ CScript* m_runScript;
ObjectType m_type; // OBJECT_*
int m_id; // unique identifier
@@ -462,8 +466,8 @@ protected:
float m_shotTime; // time since last shot
bool m_bVirusMode; // virus activated/triggered
float m_virusTime; // lifetime of the virus
- float m_lastVirusParticule;
- float m_lastParticule;
+ float m_lastVirusParticle;
+ float m_lastParticle;
bool m_bHilite;
bool m_bSelect; // object selected
bool m_bSelectable; // selectable object
@@ -522,7 +526,7 @@ protected:
int m_infoTotal;
Info m_info[OBJECTMAXINFO];
- float m_infoGeturn;
+ float m_infoReturn;
bool m_bInfoUpdate;
float m_cmdLine[OBJECTMAXCMDLINE];
diff --git a/src/object/robotmain.cpp b/src/object/robotmain.cpp
index 83eca52..8048b5b 100644
--- a/src/object/robotmain.cpp
+++ b/src/object/robotmain.cpp
@@ -17,67 +17,67 @@
// robotmain.cpp
-#include <windows.h>
-#include <stdio.h>
-#include <d3d.h>
+#include "object/robotmain.h"
#include "CBot/CBotDll.h"
-#include "common/struct.h"
-#include "math/const.h"
-#include "math/geometry.h"
-#include "math/conv.h"
-#include "old/d3dengine.h"
-#include "old/d3dmath.h"
-#include "common/language.h"
-#include "common/global.h"
+
+#include "app/app.h"
#include "common/event.h"
+#include "common/global.h"
+#include "common/iman.h"
#include "common/misc.h"
#include "common/profile.h"
-#include "common/iman.h"
#include "common/restext.h"
-#include "old/math3d.h"
-#include "old/light.h"
-#include "old/particule.h"
-#include "old/terrain.h"
-#include "old/water.h"
-#include "old/cloud.h"
-#include "old/blitz.h"
-#include "old/planet.h"
-#include "object/object.h"
+#include "graphics/engine/camera.h"
+#include "graphics/engine/cloud.h"
+#include "graphics/engine/engine.h"
+#include "graphics/engine/lightman.h"
+#include "graphics/engine/lightning.h"
+#include "graphics/engine/modelfile.h"
+#include "graphics/engine/particle.h"
+#include "graphics/engine/planet.h"
+#include "graphics/engine/pyro.h"
+#include "graphics/engine/terrain.h"
+#include "graphics/engine/text.h"
+#include "graphics/engine/water.h"
+#include "math/const.h"
+#include "math/geometry.h"
+#include "object/auto/auto.h"
+#include "object/auto/autobase.h"
+#include "object/brain.h"
+#include "object/mainmovie.h"
#include "object/motion/motion.h"
-#include "object/motion/motiontoto.h"
#include "object/motion/motionhuman.h"
-#include "physics/physics.h"
-#include "object/brain.h"
-#include "old/pyro.h"
-#include "old/modfile.h"
-#include "old/model.h"
-#include "old/camera.h"
+#include "object/motion/motiontoto.h"
+#include "object/object.h"
#include "object/task/task.h"
-#include "object/task/taskmanip.h"
#include "object/task/taskbuild.h"
-#include "object/auto/auto.h"
-#include "object/auto/autobase.h"
+#include "object/task/taskmanip.h"
+#include "physics/physics.h"
+#include "script/cbottoken.h"
+#include "script/cmdtoken.h"
+#include "script/script.h"
+#include "sound/sound.h"
+#include "ui/button.h"
#include "ui/displayinfo.h"
+#include "ui/displaytext.h"
+#include "ui/edit.h"
#include "ui/interface.h"
-#include "ui/shortcut.h"
-#include "ui/map.h"
#include "ui/label.h"
-#include "ui/button.h"
-#include "ui/slider.h"
-#include "ui/window.h"
-#include "ui/edit.h"
-#include "ui/displaytext.h"
-#include "old/text.h"
-#include "old/sound.h"
-#include "script/cbottoken.h"
-#include "script/cmdtoken.h"
-#include "object/mainmovie.h"
#include "ui/maindialog.h"
-#include "ui/mainshort.h"
#include "ui/mainmap.h"
-#include "script/script.h"
-#include "object/robotmain.h"
+#include "ui/mainshort.h"
+#include "ui/map.h"
+#include "ui/shortcut.h"
+#include "ui/slider.h"
+#include "ui/window.h"
+
+
+template<> CRobotMain* CSingleton<CRobotMain>::mInstance = nullptr;
+
+
+// TODO: remove once using std::string
+const int MAX_FNAME = 255;
@@ -89,8 +89,8 @@ const float UNIT = 4.0f;
// Global variables.
long g_id; // unique identifier
-long g_build; // constructible buildings
-long g_researchDone; // research done
+int g_build; // constructible buildings
+int g_researchDone; // research done
long g_researchEnable; // research available
float g_unit; // conversion factor
@@ -109,9 +109,7 @@ static char* m_filesDir;
void PrepareFilename(CBotString &filename)
{
- int pos;
-
- pos = filename.ReverseFind('\\');
+ int pos = filename.ReverseFind('\\');
if ( pos > 0 )
{
filename = filename.Mid(pos+1); // Remove files with
@@ -176,7 +174,7 @@ bool rfconstruct (CBotVar* pThis, CBotVar* pVar, CBotVar* pResult, int& Exceptio
// save the channel file
pVar = pThis->GetItem("handle");
- pVar->SetValInt((long)pFile);
+ pVar->SetValInt(reinterpret_cast<long>(pFile));
}
return true;
@@ -219,7 +217,7 @@ bool rfdestruct (CBotVar* pThis, CBotVar* pVar, CBotVar* pResult, int& Exception
// don't open? no problem :)
if ( pVar->GetInit() != IS_DEF) return true;
- FILE* pFile= (FILE*)pVar->GetValInt();
+ FILE* pFile= reinterpret_cast<FILE*>(pVar->GetValInt());
fclose(pFile);
m_CompteurFileOpen --;
@@ -286,7 +284,7 @@ bool rfopen (CBotVar* pThis, CBotVar* pVar, CBotVar* pResult, int& Exception)
// Registered the channel file
pVar = pThis->GetItem("handle");
- pVar->SetValInt((long)pFile);
+ pVar->SetValInt(reinterpret_cast<long>(pFile));
pResult->SetValInt(true);
return true;
@@ -332,7 +330,7 @@ bool rfclose (CBotVar* pThis, CBotVar* pVar, CBotVar* pResult, int& Exception)
if ( pVar->GetInit() != IS_DEF) { Exception = CBotErrNotOpen; return false; }
- FILE* pFile= (FILE*)pVar->GetValInt();
+ FILE* pFile= reinterpret_cast<FILE*>(pVar->GetValInt());
fclose(pFile);
m_CompteurFileOpen --;
@@ -369,7 +367,7 @@ bool rfwrite (CBotVar* pThis, CBotVar* pVar, CBotVar* pResult, int& Exception)
if ( pVar->GetInit() != IS_DEF) { Exception = CBotErrNotOpen; return false; }
- FILE* pFile= (FILE*)pVar->GetValInt();
+ FILE* pFile= reinterpret_cast<FILE*>(pVar->GetValInt());
int res = fputs(param+CBotString("\n"), pFile);
@@ -408,7 +406,7 @@ bool rfread (CBotVar* pThis, CBotVar* pVar, CBotVar* pResult, int& Exception)
if ( pVar->GetInit() != IS_DEF) { Exception = CBotErrNotOpen; return false; }
- FILE* pFile= (FILE*)pVar->GetValInt();
+ FILE* pFile= reinterpret_cast<FILE*>(pVar->GetValInt());
char chaine[2000];
int i;
@@ -449,7 +447,7 @@ bool rfeof (CBotVar* pThis, CBotVar* pVar, CBotVar* pResult, int& Exception)
if ( pVar->GetInit() != IS_DEF) { Exception = CBotErrNotOpen; return false; }
- FILE* pFile= (FILE*)pVar->GetValInt();
+ FILE* pFile= reinterpret_cast<FILE*>(pVar->GetValInt());
pResult->SetValInt( feof( pFile ) );
@@ -600,41 +598,36 @@ bool rPoint(CBotVar* pThis, CBotVar* var, CBotVar* pResult, int& Exception)
-// Constructor of robot application.
-
-CRobotMain::CRobotMain(CInstanceManager* iMan)
+//! Constructor of robot application
+CRobotMain::CRobotMain(CInstanceManager* iMan, CApplication* app)
{
- ObjectType type;
- float fValue;
- int iValue, i;
- char* token;
-
m_iMan = iMan;
m_iMan->AddInstance(CLASS_MAIN, this);
- m_event = (CEvent*)m_iMan->SearchInstance(CLASS_EVENT);
- m_engine = (CD3DEngine*)m_iMan->SearchInstance(CLASS_ENGINE);
- m_light = (CLight*)m_iMan->SearchInstance(CLASS_LIGHT);
- m_particule = (CParticule*)m_iMan->SearchInstance(CLASS_PARTICULE);
- m_water = (CWater*)m_iMan->SearchInstance(CLASS_WATER);
- m_cloud = (CCloud*)m_iMan->SearchInstance(CLASS_CLOUD);
- m_blitz = (CBlitz*)m_iMan->SearchInstance(CLASS_BLITZ);
- m_planet = (CPlanet*)m_iMan->SearchInstance(CLASS_PLANET);
- m_sound = (CSound*)m_iMan->SearchInstance(CLASS_SOUND);
-
- m_interface = new CInterface(m_iMan);
- m_terrain = new CTerrain(m_iMan);
- m_model = new CModel(m_iMan);
- m_camera = new CCamera(m_iMan);
- m_displayText = new CDisplayText(m_iMan);
+ m_app = app;
+
+ m_eventQueue = static_cast<CEventQueue*>(m_iMan->SearchInstance(CLASS_EVENT));
+ m_engine = static_cast<Gfx::CEngine*>(m_iMan->SearchInstance(CLASS_ENGINE));
+ m_lightMan = static_cast<Gfx::CLightManager*>(m_iMan->SearchInstance(CLASS_LIGHT));
+ m_particle = static_cast<Gfx::CParticle*>(m_iMan->SearchInstance(CLASS_PARTICULE));
+ m_water = static_cast<Gfx::CWater*>(m_iMan->SearchInstance(CLASS_WATER));
+ m_cloud = static_cast<Gfx::CCloud*>(m_iMan->SearchInstance(CLASS_CLOUD));
+ m_lightning = static_cast<Gfx::CLightning*>(m_iMan->SearchInstance(CLASS_BLITZ));
+ m_planet = static_cast<Gfx::CPlanet*>(m_iMan->SearchInstance(CLASS_PLANET));
+ m_sound = static_cast<CSoundInterface*>(m_iMan->SearchInstance(CLASS_SOUND));
+
+ m_interface = new Ui::CInterface();
+ m_terrain = new Gfx::CTerrain(m_iMan);
+ m_camera = new Gfx::CCamera(m_iMan);
+ m_displayText = new Ui::CDisplayText();
m_movie = new CMainMovie(m_iMan);
- m_dialog = new CMainDialog(m_iMan);
- m_short = new CMainShort(m_iMan);
- m_map = new CMainMap(m_iMan);
- m_displayInfo = 0;
+ m_dialog = new Ui::CMainDialog(m_iMan);
+ m_short = new Ui::CMainShort();
+ m_map = new Ui::CMainMap();
+ m_displayInfo = nullptr;
m_engine->SetTerrain(m_terrain);
- m_filesDir = m_dialog->RetFilesDir();
+ m_filesDir = m_dialog->GetFilesDir();
m_time = 0.0f;
m_gameTime = 0.0f;
@@ -646,32 +639,33 @@ CRobotMain::CRobotMain(CInstanceManager* iMan)
m_visitObject = 0;
m_visitArrow = 0;
m_audioTrack = 0;
- m_bAudioRepeat = true;
+ m_audioRepeat = true;
m_delayWriteMessage = 0;
m_selectObject = 0;
m_infoUsed = 0;
- m_bBeginSatCom = false;
- m_bMovieLock = false;
- m_bSatComLock = false;
- m_bEditLock = false;
- m_bEditFull = false;
- m_bPause = false;
- m_bHilite = false;
- m_bFreePhoto = false;
- m_bShowPos = false;
- m_bSelectInsect = false;
- m_bShowSoluce = false;
- m_bShowAll = false;
- m_bCheatRadar = false;
- m_bFixScene = false;
- m_bTrainerPilot = false;
- m_bSuspend = false;
- m_bFriendAim = false;
- m_bResetCreate = false;
- m_bShortCut = true;
-
- m_engine->SetMovieLock(m_bMovieLock);
+ m_immediatSatCom = false;
+ m_beginSatCom = false;
+ m_movieLock = false;
+ m_satComLock = false;
+ m_editLock = false;
+ m_editFull = false;
+ m_pause = false;
+ m_hilite = false;
+ m_freePhoto = false;
+ m_showPos = false;
+ m_selectInsect = false;
+ m_showSoluce = false;
+ m_showAll = false;
+ m_cheatRadar = false;
+ m_fixScene = false;
+ m_trainerPilot = false;
+ m_suspend = false;
+ m_friendAim = false;
+ m_resetCreate = false;
+ m_shortCut = true;
+
+ m_engine->SetMovieLock(m_movieLock);
m_movie->Flush();
m_movieInfoIndex = -1;
@@ -682,7 +676,10 @@ CRobotMain::CRobotMain(CInstanceManager* iMan)
m_endingWinRank = 0;
m_endingLostRank = 0;
- m_bWinTerminate = false;
+ m_winTerminate = false;
+
+ m_joystickDeadzone = 0.2f;
+ SetDefaultInputBindings();
FlushDisplayInfo();
@@ -690,22 +687,27 @@ CRobotMain::CRobotMain(CInstanceManager* iMan)
m_windowPos = Math::Point(0.15f, 0.17f);
m_windowDim = Math::Point(0.70f, 0.66f);
- if ( GetLocalProfileFloat("Edit", "FontSize", fValue) ) m_fontSize = fValue;
- if ( GetLocalProfileFloat("Edit", "WindowPos.x", fValue) ) m_windowPos.x = fValue;
- if ( GetLocalProfileFloat("Edit", "WindowPos.y", fValue) ) m_windowPos.y = fValue;
- if ( GetLocalProfileFloat("Edit", "WindowDim.x", fValue) ) m_windowDim.x = fValue;
- if ( GetLocalProfileFloat("Edit", "WindowDim.y", fValue) ) m_windowDim.y = fValue;
+ // TODO: profile
+ // float fValue;
+ // int iValue;
+
+ // if (GetLocalProfileFloat("Edit", "FontSize", fValue)) m_fontSize = fValue;
+ // if (GetLocalProfileFloat("Edit", "WindowPos.x", fValue)) m_windowPos.x = fValue;
+ // if (GetLocalProfileFloat("Edit", "WindowPos.y", fValue)) m_windowPos.y = fValue;
+ // if (GetLocalProfileFloat("Edit", "WindowDim.x", fValue)) m_windowDim.x = fValue;
+ // if (GetLocalProfileFloat("Edit", "WindowDim.y", fValue)) m_windowDim.y = fValue;
m_IOPublic = false;
m_IODim = Math::Point(320.0f/640.0f, (121.0f+18.0f*8)/480.0f);
m_IOPos.x = (1.0f-m_IODim.x)/2.0f; // in the middle
m_IOPos.y = (1.0f-m_IODim.y)/2.0f;
- if ( GetLocalProfileInt ("Edit", "IOPublic", iValue) ) m_IOPublic = iValue;
- if ( GetLocalProfileFloat("Edit", "IOPos.x", fValue) ) m_IOPos.x = fValue;
- if ( GetLocalProfileFloat("Edit", "IOPos.y", fValue) ) m_IOPos.y = fValue;
- if ( GetLocalProfileFloat("Edit", "IODim.x", fValue) ) m_IODim.x = fValue;
- if ( GetLocalProfileFloat("Edit", "IODim.y", fValue) ) m_IODim.y = fValue;
+ /* TODO: profile
+ if (GetLocalProfileInt ("Edit", "IOPublic", iValue)) m_IOPublic = iValue;
+ if (GetLocalProfileFloat("Edit", "IOPos.x", fValue)) m_IOPos.x = fValue;
+ if (GetLocalProfileFloat("Edit", "IOPos.y", fValue)) m_IOPos.y = fValue;
+ if (GetLocalProfileFloat("Edit", "IODim.x", fValue)) m_IODim.x = fValue;
+ if (GetLocalProfileFloat("Edit", "IODim.y", fValue)) m_IODim.y = fValue; */
m_short->FlushShortcuts();
InitEye();
@@ -722,14 +724,15 @@ CRobotMain::CRobotMain(CInstanceManager* iMan)
g_unit = 4.0f;
m_gamerName[0] = 0;
- GetProfile()->GetLocalProfileString("Gamer", "LastName", m_gamerName, 100);
+ /* TODO: profile
+ GetLocalProfileString("Gamer", "LastName", m_gamerName, 100); */
SetGlobalGamerName(m_gamerName);
ReadFreeParam();
m_dialog->SetupRecall();
- for ( i=0 ; i<MAXSHOWLIMIT ; i++ )
+ for (int i = 0; i < MAXSHOWLIMIT; i++)
{
- m_showLimit[i].bUsed = false;
+ m_showLimit[i].used = false;
m_showLimit[i].total = 0;
m_showLimit[i].link = 0;
}
@@ -737,19 +740,16 @@ CRobotMain::CRobotMain(CInstanceManager* iMan)
CBotProgram::SetTimer(100);
CBotProgram::Init();
- for ( i=0 ; i<OBJECT_MAX ; i++ )
+ for (int i = 0; i < OBJECT_MAX; i++)
{
- type = (ObjectType)i;
- token = RetObjectName(type);
- if ( token[0] != 0 )
- {
+ ObjectType type = static_cast<ObjectType>(i);
+ const char* token = GetObjectName(type);
+ if (token[0] != 0)
CBotProgram::DefineNum(token, type);
- }
- token = RetObjectAlias(type);
- if ( token[0] != 0 )
- {
+
+ token = GetObjectAlias(type);
+ if (token[0] != 0)
CBotProgram::DefineNum(token, type);
- }
}
CBotProgram::DefineNum("White", 0);
@@ -778,17 +778,18 @@ CRobotMain::CRobotMain(CInstanceManager* iMan)
CBotProgram::DefineNum("Behind", TMA_FBACK);
CBotProgram::DefineNum("EnergyCell", TMA_POWER);
- CBotProgram::DefineNum("DisplayError", TT_ERROR);
- CBotProgram::DefineNum("DisplayWarning", TT_WARNING);
- CBotProgram::DefineNum("DisplayInfo", TT_INFO);
- CBotProgram::DefineNum("DisplayMessage", TT_MESSAGE);
+ CBotProgram::DefineNum("DisplayError", Ui::TT_ERROR);
+ CBotProgram::DefineNum("DisplayWarning", Ui::TT_WARNING);
+ CBotProgram::DefineNum("DisplayInfo", Ui::TT_INFO);
+ CBotProgram::DefineNum("DisplayMessage", Ui::TT_MESSAGE);
CBotProgram::DefineNum("FilterNone", FILTER_NONE);
CBotProgram::DefineNum("FilterOnlyLanding", FILTER_ONLYLANDING);
CBotProgram::DefineNum("FilterOnlyFliying", FILTER_ONLYFLYING);
- // Add the class Point.
CBotClass* bc;
+
+ // Add the class Point.
bc = new CBotClass("point", NULL, true); // intrinsic class
bc->AddItem("x", CBotTypFloat);
bc->AddItem("y", CBotTypFloat);
@@ -817,68 +818,166 @@ CRobotMain::CRobotMain(CInstanceManager* iMan)
CScript::InitFonctions();
}
-// Destructor of robot application.
-
+//! Destructor of robot application
CRobotMain::~CRobotMain()
{
+ delete m_displayText;
+ m_displayText = nullptr;
+
+ delete m_interface;
+ m_interface = nullptr;
+
+ delete m_terrain;
+ m_terrain = nullptr;
+
+ delete m_camera;
+ m_camera = nullptr;
+
+ delete m_displayText;
+ m_displayText = nullptr;
+
delete m_movie;
+ m_movie = nullptr;
+
delete m_dialog;
+ m_dialog = nullptr;
+
delete m_short;
+ m_short = nullptr;
+
delete m_map;
- delete m_terrain;
- delete m_model;
-}
+ m_map = nullptr;
+ m_iMan = nullptr;
+ m_app = nullptr;
+}
-// Creates the file colobot.ini at the first time.
+//! Creates the file colobot.ini at the first time
void CRobotMain::CreateIni()
{
- int iValue;
+ /* TODO: profile
+ int iValue;
+ // colobot.ini doesn't exist?
+ if (!GetLocalProfileInt("Setup", "TotoMode", iValue))
+ m_dialog->SetupMemorize();*/
+}
- // colobot.ini don't exist?
- if ( !GetLocalProfileInt("Setup", "TotoMode", iValue) )
+void CRobotMain::SetDefaultInputBindings()
+{
+ for (int i = 0; i < INPUT_SLOT_MAX; i++)
{
- m_dialog->SetupMemorize();
+ m_inputBindings[i].key = m_inputBindings[i].joy = KEY_INVALID;
}
+
+ for (int i = 0; i < JOY_AXIS_SLOT_MAX; i++)
+ {
+ m_joyAxisBindings[i].axis = AXIS_INVALID;
+ m_joyAxisBindings[i].invert = false;
+ }
+
+ m_inputBindings[INPUT_SLOT_LEFT ].key = KEY(LEFT);
+ m_inputBindings[INPUT_SLOT_RIGHT ].key = KEY(RIGHT);
+ m_inputBindings[INPUT_SLOT_UP ].key = KEY(UP);
+ m_inputBindings[INPUT_SLOT_DOWN ].key = KEY(DOWN);
+ m_inputBindings[INPUT_SLOT_GUP ].key = VIRTUAL_KMOD(SHIFT);
+ m_inputBindings[INPUT_SLOT_GDOWN ].key = VIRTUAL_KMOD(CTRL);
+ m_inputBindings[INPUT_SLOT_CAMERA ].key = KEY(SPACE);
+ m_inputBindings[INPUT_SLOT_CAMERA ].joy = VIRTUAL_JOY(2);
+ m_inputBindings[INPUT_SLOT_DESEL ].key = KEY(KP0);
+ m_inputBindings[INPUT_SLOT_DESEL ].joy = VIRTUAL_JOY(6);
+ m_inputBindings[INPUT_SLOT_ACTION ].key = KEY(RETURN);
+ m_inputBindings[INPUT_SLOT_ACTION ].joy = VIRTUAL_JOY(1);
+ m_inputBindings[INPUT_SLOT_NEAR ].key = KEY(KP_PLUS);
+ m_inputBindings[INPUT_SLOT_NEAR ].joy = VIRTUAL_JOY(5);
+ m_inputBindings[INPUT_SLOT_AWAY ].key = KEY(KP_MINUS);
+ m_inputBindings[INPUT_SLOT_AWAY ].joy = VIRTUAL_JOY(4);
+ m_inputBindings[INPUT_SLOT_NEXT ].key = KEY(TAB);
+ m_inputBindings[INPUT_SLOT_NEXT ].joy = VIRTUAL_JOY(3);
+ m_inputBindings[INPUT_SLOT_HUMAN ].key = KEY(HOME);
+ m_inputBindings[INPUT_SLOT_HUMAN ].joy = VIRTUAL_JOY(7);
+ m_inputBindings[INPUT_SLOT_QUIT ].key = KEY(ESCAPE);
+ m_inputBindings[INPUT_SLOT_HELP ].key = KEY(F1);
+ m_inputBindings[INPUT_SLOT_PROG ].key = KEY(F2);
+ m_inputBindings[INPUT_SLOT_CBOT ].key = KEY(F3);
+ m_inputBindings[INPUT_SLOT_VISIT ].key = KEY(KP_PERIOD);
+ m_inputBindings[INPUT_SLOT_SPEED10].key = KEY(F4);
+ m_inputBindings[INPUT_SLOT_SPEED15].key = KEY(F5);
+ m_inputBindings[INPUT_SLOT_SPEED20].key = KEY(F6);
+
+ m_joyAxisBindings[JOY_AXIS_SLOT_X].axis = 0;
+ m_joyAxisBindings[JOY_AXIS_SLOT_Y].axis = 1;
+ m_joyAxisBindings[JOY_AXIS_SLOT_Z].axis = 2;
}
+void CRobotMain::SetInputBinding(InputSlot slot, InputBinding binding)
+{
+ unsigned int index = static_cast<unsigned int>(slot);
+ assert(index >= 0 && index < INPUT_SLOT_MAX);
+ m_inputBindings[index] = binding;
+}
-// Changes phase.
+const InputBinding& CRobotMain::GetInputBinding(InputSlot slot)
+{
+ unsigned int index = static_cast<unsigned int>(slot);
+ assert(index >= 0 && index < INPUT_SLOT_MAX);
+ return m_inputBindings[index];
+}
-void CRobotMain::ChangePhase(Phase phase)
+void CRobotMain::SetJoyAxisBinding(JoyAxisSlot slot, JoyAxisBinding binding)
+{
+ unsigned int index = static_cast<unsigned int>(slot);
+ assert(index >= 0 && index < JOY_AXIS_SLOT_MAX);
+ m_joyAxisBindings[index] = binding;
+}
+
+const JoyAxisBinding& CRobotMain::GetJoyAxisBinding(JoyAxisSlot slot)
+{
+ unsigned int index = static_cast<unsigned int>(slot);
+ assert(index >= 0 && index < JOY_AXIS_SLOT_MAX);
+ return m_joyAxisBindings[index];
+}
+
+void CRobotMain::SetJoystickDeadzone(float zone)
+{
+ m_joystickDeadzone = zone;
+}
+
+float CRobotMain::GetJoystickDeadzone()
{
- CEdit* pe;
- CButton* pb;
- D3DCOLORVALUE color;
- Math::Point pos, dim, ddim;
- float ox, oy, sx, sy;
- char* read;
- int rank, numTry;
- bool bLoading;
+ return m_joystickDeadzone;
+}
+
+void CRobotMain::ResetKeyStates()
+{
+ m_keyMotion = Math::Vector(0.0f, 0.0f, 0.0f);
+ m_joyMotion = Math::Vector(0.0f, 0.0f, 0.0f);
+}
- if ( m_phase == PHASE_SIMUL ) // ends a simulation?
+//! Changes phase
+void CRobotMain::ChangePhase(Phase phase)
+{
+ if (m_phase == PHASE_SIMUL) // ends a simulation?
{
SaveAllScript();
m_sound->StopMusic();
- m_camera->SetObject(0);
+ m_camera->SetControllingObject(0);
-#if _SCHOOL
+/* TODO: #if _SCHOOL
if ( true )
-#else
- if ( m_gameTime > 10.0f ) // did you play at least 10 seconds?
-#endif
+#else*/
+ if (m_gameTime > 10.0f) // did you play at least 10 seconds?
{
- rank = m_dialog->RetSceneRank();
- numTry = m_dialog->RetGamerInfoTry(rank);
+ int rank = m_dialog->GetSceneRank();
+ int numTry = m_dialog->GetGamerInfoTry(rank);
m_dialog->SetGamerInfoTry(rank, numTry+1);
m_dialog->WriteGamerInfo();
}
}
- if ( phase == PHASE_WIN ) // wins a simulation?
+ if (phase == PHASE_WIN) // wins a simulation?
{
- rank = m_dialog->RetSceneRank();
+ int rank = m_dialog->GetSceneRank();
m_dialog->SetGamerInfoPassed(rank, true);
m_dialog->NextMission(); // passes to the next mission
m_dialog->WriteGamerInfo();
@@ -889,186 +988,119 @@ void CRobotMain::ChangePhase(Phase phase)
m_phase = phase;
m_winDelay = 0.0f;
m_lostDelay = 0.0f;
- m_bBeginSatCom = false;
- m_bMovieLock = false;
- m_bSatComLock = false;
- m_bEditLock = false;
- m_bFreePhoto = false;
- m_bResetCreate = false;
-
- m_engine->SetMovieLock(m_bMovieLock);
+ m_beginSatCom = false;
+ m_movieLock = false;
+ m_satComLock = false;
+ m_editLock = false;
+ m_freePhoto = false;
+ m_resetCreate = false;
+
+ m_engine->SetMovieLock(m_movieLock);
ChangePause(false);
FlushDisplayInfo();
m_engine->SetRankView(0);
m_engine->FlushObject();
- color.r = color.g = color.b = color.a = 0.0f;
- m_engine->SetWaterAddColor(color);
+ m_engine->SetWaterAddColor(Gfx::Color(0.0f, 0.0f, 0.0f, 0.0f));
m_engine->SetBackground("");
m_engine->SetBackForce(false);
- m_engine->SetFrontsizeName("");
+ m_engine->SetForegroundName("");
m_engine->SetOverColor();
- m_engine->GroundMarkDelete(0);
+ m_engine->DeleteGroundMark(0);
SetSpeed(1.0f);
m_terrain->SetWind(Math::Vector(0.0f, 0.0f, 0.0f));
m_terrain->FlushBuildingLevel();
m_terrain->FlushFlyingLimit();
- m_light->FlushLight();
- m_particule->FlushParticule();
+ m_lightMan->FlushLights();
+ m_particle->FlushParticle();
m_water->Flush();
m_cloud->Flush();
- m_blitz->Flush();
+ m_lightning->Flush();
m_planet->Flush();
m_iMan->Flush(CLASS_OBJECT);
m_iMan->Flush(CLASS_PHYSICS);
m_iMan->Flush(CLASS_BRAIN);
m_iMan->Flush(CLASS_PYRO);
- m_model->StopUserAction();
m_interface->Flush();
ClearInterface();
FlushNewScriptName();
m_sound->SetListener(Math::Vector(0.0f, 0.0f, 0.0f), Math::Vector(0.0f, 0.0f, 1.0f));
- m_camera->SetType(CAMERA_DIALOG);
+ m_camera->SetType(Gfx::CAM_TYPE_DIALOG);
m_movie->Flush();
m_movieInfoIndex = -1;
m_cameraPan = 0.0f;
m_cameraZoom = 0.0f;
- m_bShortCut = true;
+ m_shortCut = true;
+
+ Math::Point dim, pos;
// Creates and hide the command console.
dim.x = 200.0f/640.0f;
dim.y = 18.0f/480.0f;
pos.x = 50.0f/640.0f;
pos.y = 452.0f/480.0f;
- pe = m_interface->CreateEdit(pos, dim, 0, EVENT_CMD);
- if ( pe == 0 ) return;
- pe->ClearState(STATE_VISIBLE);
- m_bCmdEdit = false; // hidden for now
+ Ui::CEdit* pe = dynamic_cast<Ui::CEdit*>(m_interface->CreateEdit(pos, dim, 0, EVENT_CMD));
+ if (pe == nullptr) return;
+ pe->ClearState(Ui::STATE_VISIBLE);
+ m_cmdEdit = false; // hidden for now
// Creates the speedometer.
-#if _TEEN
+/* TODO: #if _TEEN
dim.x = 30.0f/640.0f;
dim.y = 20.0f/480.0f;
pos.x = 4.0f/640.0f;
pos.y = 454.0f/480.0f;
-#else
+#else*/
dim.x = 30.0f/640.0f;
dim.y = 20.0f/480.0f;
pos.x = 4.0f/640.0f;
pos.y = 426.0f/480.0f;
-#endif
- pb = m_interface->CreateButton(pos, dim, 0, EVENT_SPEED);
- if ( pb == 0 ) return;
- pb->SetState(STATE_SIMPLY);
- pb->ClearState(STATE_VISIBLE);
+
+ Ui::CButton* pb = m_interface->CreateButton(pos, dim, 0, EVENT_SPEED);
+ if (pb == nullptr) return;
+ pb->SetState(Ui::STATE_SIMPLY);
+ pb->ClearState(Ui::STATE_VISIBLE);
m_dialog->ChangePhase(m_phase);
dim.x = 32.0f/640.0f;
dim.y = 32.0f/480.0f;
- ox = 3.0f/640.0f;
- oy = 3.0f/480.0f;
- sx = (32.0f+2.0f)/640.0f;
- sy = (32.0f+2.0f)/480.0f;
+ float ox = 3.0f/640.0f;
+ float oy = 3.0f/480.0f;
+ float sx = (32.0f+2.0f)/640.0f;
+ float sy = (32.0f+2.0f)/480.0f;
- if ( m_phase != PHASE_PERSO )
+ if (m_phase != PHASE_PERSO)
{
m_engine->SetDrawWorld(true);
m_engine->SetDrawFront(false);
- m_bFixScene = false;
+ m_fixScene = false;
}
- if ( m_phase == PHASE_INIT )
+ if (m_phase == PHASE_INIT)
{
-#if _NEWLOOK
- m_engine->FreeTexture("generna.tga");
- m_engine->FreeTexture("genernb.tga");
- m_engine->FreeTexture("genernc.tga");
- m_engine->FreeTexture("genernd.tga");
-#else
-#if _FRENCH
-#if _DEMO
- m_engine->FreeTexture("genedfa.tga");
- m_engine->FreeTexture("genedfb.tga");
- m_engine->FreeTexture("genedfc.tga");
- m_engine->FreeTexture("genedfd.tga");
-#else
- m_engine->FreeTexture("generfa.tga");
- m_engine->FreeTexture("generfb.tga");
- m_engine->FreeTexture("generfc.tga");
- m_engine->FreeTexture("generfd.tga");
-#endif
-#endif
-#if _ENGLISH
-#if _DEMO
- m_engine->FreeTexture("genedea.tga");
- m_engine->FreeTexture("genedeb.tga");
- m_engine->FreeTexture("genedec.tga");
- m_engine->FreeTexture("geneded.tga");
-#else
- m_engine->FreeTexture("generea.tga");
- m_engine->FreeTexture("genereb.tga");
- m_engine->FreeTexture("generec.tga");
- m_engine->FreeTexture("genered.tga");
-#endif
-#endif
-#if _GERMAN
-#if _DEMO
- m_engine->FreeTexture("genedda.tga");
- m_engine->FreeTexture("geneddb.tga");
- m_engine->FreeTexture("geneddc.tga");
- m_engine->FreeTexture("geneddd.tga");
-#else
- m_engine->FreeTexture("generea.tga");
- m_engine->FreeTexture("genereb.tga");
- m_engine->FreeTexture("generec.tga");
- m_engine->FreeTexture("genered.tga");
-#endif
-#endif
-#if _WG
-#if _DEMO
- m_engine->FreeTexture("genedda.tga");
- m_engine->FreeTexture("geneddb.tga");
- m_engine->FreeTexture("geneddc.tga");
- m_engine->FreeTexture("geneddd.tga");
-#else
- m_engine->FreeTexture("generda.tga");
- m_engine->FreeTexture("generdb.tga");
- m_engine->FreeTexture("generdc.tga");
- m_engine->FreeTexture("generdd.tga");
-#endif
-#endif
-#if _POLISH
-#if _DEMO
- m_engine->FreeTexture("genedpa.tga");
- m_engine->FreeTexture("genedpb.tga");
- m_engine->FreeTexture("genedpc.tga");
- m_engine->FreeTexture("genedpd.tga");
-#else
- m_engine->FreeTexture("generpa.tga");
- m_engine->FreeTexture("generpb.tga");
- m_engine->FreeTexture("generpc.tga");
- m_engine->FreeTexture("generpd.tga");
-#endif
-#endif
-#endif
+ // TODO: replace with new textures once done
+ m_engine->DeleteTexture("generna.png");
+ m_engine->DeleteTexture("genernb.png");
+ m_engine->DeleteTexture("genernc.png");
+ m_engine->DeleteTexture("genernd.png");
}
- if ( m_phase == PHASE_SIMUL )
+ if (m_phase == PHASE_SIMUL)
{
- m_engine->FreeTexture("inter01a.tga");
- m_engine->FreeTexture("inter01b.tga");
- m_engine->FreeTexture("inter01c.tga");
- m_engine->FreeTexture("inter01d.tga");
+ m_engine->DeleteTexture("inter01a.png");
+ m_engine->DeleteTexture("inter01b.png");
+ m_engine->DeleteTexture("inter01c.png");
+ m_engine->DeleteTexture("inter01d.png");
- read = m_dialog->RetSceneRead();
- bLoading = (read[0] != 0);
+ char* read = m_dialog->GetSceneRead();
+ bool loading = (read[0] != 0);
m_map->CreateMap();
- CreateScene(m_dialog->RetSceneSoluce(), false, false); // interactive scene
- if ( m_bMapImage )
- {
+ CreateScene(m_dialog->GetSceneSoluce(), false, false); // interactive scene
+ if (m_mapImage)
m_map->SetFixImage(m_mapFilename);
- }
+
+ Math::Point ddim;
pos.x = 620.0f/640.0f;
pos.y = 460.0f/480.0f;
@@ -1076,41 +1108,40 @@ void CRobotMain::ChangePhase(Phase phase)
ddim.y = 20.0f/480.0f;
m_interface->CreateButton(pos, ddim, 11, EVENT_BUTTON_QUIT);
- if ( m_bImmediatSatCom && !bLoading &&
- m_infoFilename[SATCOM_HUSTON][0] != 0 )
- {
+ if (m_immediatSatCom && !loading &&
+ m_infoFilename[SATCOM_HUSTON][0] != 0)
StartDisplayInfo(SATCOM_HUSTON, false); // shows the instructions
- }
m_sound->StopMusic();
- if ( !m_bBase || bLoading ) StartMusic();
+ if (!m_base || loading) StartMusic();
}
- if ( m_phase == PHASE_WIN )
+ if (m_phase == PHASE_WIN)
{
- if ( m_endingWinRank == -1 )
+ if (m_endingWinRank == -1)
{
ChangePhase(PHASE_TERM);
}
else
{
-#if _TEEN
- m_bWinTerminate = (m_endingWinRank == 900);
+/* TODO: #if _TEEN
+ m_winTerminate = (m_endingWinRank == 900);
m_dialog->SetSceneName("teenw");
-#else
- m_bWinTerminate = (m_endingWinRank == 904);
+#else*/
+ m_winTerminate = (m_endingWinRank == 904);
m_dialog->SetSceneName("win");
-#endif
+
m_dialog->SetSceneRank(m_endingWinRank);
CreateScene(false, true, false); // sets scene
pos.x = ox+sx*1; pos.y = oy+sy*1;
+ Math::Point ddim;
ddim.x = dim.x*2; ddim.y = dim.y*2;
m_interface->CreateButton(pos, ddim, 16, EVENT_BUTTON_OK);
- if ( m_bWinTerminate )
+ if (m_winTerminate)
{
-#if _TEEN
+/* TODO: #if _TEEN
pos.x = ox+sx*3; pos.y = oy+sy*1;
ddim.x = dim.x*15; ddim.y = dim.y*2;
pe = m_interface->CreateEdit(pos, ddim, 0, EVENT_EDIT0);
@@ -1118,16 +1149,16 @@ void CRobotMain::ChangePhase(Phase phase)
pe->SetEditCap(false);
pe->SetHiliteCap(false);
pe->ReadText("help\\teenw.txt");
-#else
+#else*/
+
pos.x = ox+sx*3; pos.y = oy+sy*0.2f;
ddim.x = dim.x*15; ddim.y = dim.y*3.0f;
pe = m_interface->CreateEdit(pos, ddim, 0, EVENT_EDIT0);
pe->SetGenericMode(true);
- pe->SetFontType(FONT_COLOBOT);
+ pe->SetFontType(Gfx::FONT_COLOBOT);
pe->SetEditCap(false);
pe->SetHiliteCap(false);
pe->ReadText("help\\win.txt");
-#endif
}
else
{
@@ -1138,20 +1169,21 @@ void CRobotMain::ChangePhase(Phase phase)
StartMusic();
}
- if ( m_phase == PHASE_LOST )
+ if (m_phase == PHASE_LOST)
{
- if ( m_endingLostRank == -1 )
+ if (m_endingLostRank == -1)
{
ChangePhase(PHASE_TERM);
}
else
{
- m_bWinTerminate = false;
+ m_winTerminate = false;
m_dialog->SetSceneName("lost");
m_dialog->SetSceneRank(m_endingLostRank);
CreateScene(false, true, false); // sets scene
pos.x = ox+sx*1; pos.y = oy+sy*1;
+ Math::Point ddim;
ddim.x = dim.x*2; ddim.y = dim.y*2;
m_interface->CreateButton(pos, ddim, 16, EVENT_BUTTON_OK);
m_displayText->DisplayError(INFO_LOST, Math::Vector(0.0f,0.0f,0.0f), 15.0f, 60.0f, 1000.0f);
@@ -1160,49 +1192,89 @@ void CRobotMain::ChangePhase(Phase phase)
StartMusic();
}
- if ( m_phase == PHASE_MODEL )
- {
- pos.x = ox+sx*0; pos.y = oy+sy*0;
- m_interface->CreateButton(pos, dim, 11, EVENT_BUTTON_CANCEL);
+ if (m_phase == PHASE_LOADING)
+ m_engine->SetMouseVisible(false);
+ else
+ m_engine->SetMouseVisible(true);
- CreateModel();
- }
+ m_engine->LoadAllTextures();
+}
+
+//! Processes an event
+bool CRobotMain::EventProcess(Event &event)
+{
+ /* Motion vector management */
- if ( m_phase == PHASE_LOADING )
+ if (event.type == EVENT_KEY_DOWN)
{
- m_engine->SetMouseHide(true);
+ if (event.key.key == GetInputBinding(INPUT_SLOT_UP ).key) m_keyMotion.y = 1.0f;
+ if (event.key.key == GetInputBinding(INPUT_SLOT_UP ).joy) m_keyMotion.y = 1.0f;
+ if (event.key.key == GetInputBinding(INPUT_SLOT_DOWN ).key) m_keyMotion.y = -1.0f;
+ if (event.key.key == GetInputBinding(INPUT_SLOT_DOWN ).joy) m_keyMotion.y = -1.0f;
+ if (event.key.key == GetInputBinding(INPUT_SLOT_LEFT ).key) m_keyMotion.x = -1.0f;
+ if (event.key.key == GetInputBinding(INPUT_SLOT_LEFT ).joy) m_keyMotion.x = -1.0f;
+ if (event.key.key == GetInputBinding(INPUT_SLOT_RIGHT).key) m_keyMotion.x = 1.0f;
+ if (event.key.key == GetInputBinding(INPUT_SLOT_RIGHT).joy) m_keyMotion.x = 1.0f;
+ if (event.key.key == GetInputBinding(INPUT_SLOT_GUP ).key) m_keyMotion.z = 1.0f;
+ if (event.key.key == GetInputBinding(INPUT_SLOT_GUP ).joy) m_keyMotion.z = 1.0f;
+ if (event.key.key == GetInputBinding(INPUT_SLOT_GDOWN).key) m_keyMotion.z = -1.0f;
+ if (event.key.key == GetInputBinding(INPUT_SLOT_GDOWN).joy) m_keyMotion.z = -1.0f;
}
- else
+ else if (event.type == EVENT_KEY_UP)
{
- m_engine->SetMouseHide(false);
+ if (event.key.key == GetInputBinding(INPUT_SLOT_UP ).key) m_keyMotion.y = 0.0f;
+ if (event.key.key == GetInputBinding(INPUT_SLOT_UP ).joy) m_keyMotion.y = 0.0f;
+ if (event.key.key == GetInputBinding(INPUT_SLOT_DOWN ).key) m_keyMotion.y = 0.0f;
+ if (event.key.key == GetInputBinding(INPUT_SLOT_DOWN ).joy) m_keyMotion.y = 0.0f;
+ if (event.key.key == GetInputBinding(INPUT_SLOT_LEFT ).key) m_keyMotion.x = 0.0f;
+ if (event.key.key == GetInputBinding(INPUT_SLOT_LEFT ).joy) m_keyMotion.x = 0.0f;
+ if (event.key.key == GetInputBinding(INPUT_SLOT_RIGHT).key) m_keyMotion.x = 0.0f;
+ if (event.key.key == GetInputBinding(INPUT_SLOT_RIGHT).joy) m_keyMotion.x = 0.0f;
+ if (event.key.key == GetInputBinding(INPUT_SLOT_GUP ).key) m_keyMotion.z = 0.0f;
+ if (event.key.key == GetInputBinding(INPUT_SLOT_GUP ).joy) m_keyMotion.z = 0.0f;
+ if (event.key.key == GetInputBinding(INPUT_SLOT_GDOWN).key) m_keyMotion.z = 0.0f;
+ if (event.key.key == GetInputBinding(INPUT_SLOT_GDOWN).joy) m_keyMotion.z = 0.0f;
}
+ else if (event.type == EVENT_JOY_AXIS)
+ {
+ if (event.joyAxis.axis == GetJoyAxisBinding(JOY_AXIS_SLOT_X).axis)
+ {
+ m_joyMotion.x = Math::Neutral(event.joyAxis.value / 32768.0f, m_joystickDeadzone);
+ if (GetJoyAxisBinding(JOY_AXIS_SLOT_X).invert)
+ m_joyMotion.x *= -1.0f;
+ }
- m_engine->LoadAllTexture();
-}
+ if (event.joyAxis.axis == GetJoyAxisBinding(JOY_AXIS_SLOT_Y).axis)
+ {
+ m_joyMotion.y = Math::Neutral(event.joyAxis.value / 32768.0f, m_joystickDeadzone);
+ if (GetJoyAxisBinding(JOY_AXIS_SLOT_Y).invert)
+ m_joyMotion.y *= -1.0f;
+ }
+ if (event.joyAxis.axis == GetJoyAxisBinding(JOY_AXIS_SLOT_Z).axis)
+ {
+ m_joyMotion.z = Math::Neutral(event.joyAxis.value / 32768.0f, m_joystickDeadzone);
+ if (GetJoyAxisBinding(JOY_AXIS_SLOT_Z).invert)
+ m_joyMotion.z *= -1.0f;
+ }
+ }
+
+ event.motionInput = Math::Clamp(m_joyMotion + m_keyMotion, Math::Vector(-1.0f, -1.0f, -1.0f), Math::Vector(1.0f, 1.0f, 1.0f));
-// Processes an event.
-bool CRobotMain::EventProcess(const Event &event)
-{
- CEdit* pe;
- CObject* pObj;
- Event newEvent;
- MainMovieType type;
- int i;
- if ( event.event == EVENT_FRAME )
+ if (event.type == EVENT_FRAME)
{
- if ( !m_movie->EventProcess(event) ) // end of the movie?
+ if (!m_movie->EventProcess(event)) // end of the movie?
{
- type = m_movie->RetStopType();
- if ( type == MM_SATCOMopen )
+ MainMovieType type = m_movie->GetStopType();
+ if (type == MM_SATCOMopen)
{
ChangePause(false);
SelectObject(m_infoObject, false); // hands over the command buttons
- m_map->ShowMap(m_bMapShow);
+ m_map->ShowMap(m_mapShow);
m_displayText->HideText(false);
- i = m_movieInfoIndex;
+ int i = m_movieInfoIndex;
StartDisplayInfo(m_movieInfoIndex, false);
m_movieInfoIndex = i;
}
@@ -1213,59 +1285,48 @@ bool CRobotMain::EventProcess(const Event &event)
RemoteCamera(m_cameraPan, m_cameraZoom, event.rTime);
m_interface->EventProcess(event);
- if ( m_displayInfo != 0 ) // current edition?
- {
+ if (m_displayInfo != nullptr) // current edition?
m_displayInfo->EventProcess(event);
- }
+
return EventFrame(event);
}
// Management of the console.
-#if 0
- if ( m_phase != PHASE_NAME &&
- !m_movie->IsExist() &&
- event.event == EVENT_KEYDOWN &&
- event.param == VK_PAUSE &&
- (event.keyState&KS_CONTROL) != 0 )
-#else
- if ( m_phase != PHASE_NAME &&
- !m_movie->IsExist() &&
- event.event == EVENT_KEYDOWN &&
- event.param == VK_CANCEL ) // Ctrl+Pause ?
-#endif
- {
- pe = (CEdit*)m_interface->SearchControl(EVENT_CMD);
- if ( pe == 0 ) return false;
- pe->SetState(STATE_VISIBLE);
+ if (m_phase != PHASE_NAME &&
+ !m_movie->IsExist() &&
+ event.type == EVENT_KEY_DOWN &&
+ event.key.key == KEY(PAUSE)) // Pause ?
+ {
+ Ui::CEdit* pe = dynamic_cast<Ui::CEdit*>(m_interface->SearchControl(EVENT_CMD));
+ if (pe == nullptr) return false;
+ pe->SetState(Ui::STATE_VISIBLE);
pe->SetFocus(true);
- if ( m_phase == PHASE_SIMUL ) ChangePause(true);
- m_bCmdEdit = true;
+ if (m_phase == PHASE_SIMUL) ChangePause(true);
+ m_cmdEdit = true;
return false;
}
- if ( event.event == EVENT_KEYDOWN &&
- event.param == VK_RETURN && m_bCmdEdit )
+ if (event.type == EVENT_KEY_DOWN &&
+ event.key.key == KEY(RETURN) && m_cmdEdit)
{
- char cmd[50];
- pe = (CEdit*)m_interface->SearchControl(EVENT_CMD);
- if ( pe == 0 ) return false;
+ char cmd[50];
+ Ui::CEdit* pe = dynamic_cast<Ui::CEdit*>(m_interface->SearchControl(EVENT_CMD));
+ if (pe == nullptr) return false;
pe->GetText(cmd, 50);
pe->SetText("");
- pe->ClearState(STATE_VISIBLE);
- if ( m_phase == PHASE_SIMUL ) ChangePause(false);
+ pe->ClearState(Ui::STATE_VISIBLE);
+ if (m_phase == PHASE_SIMUL) ChangePause(false);
ExecuteCmd(cmd);
- m_bCmdEdit = false;
+ m_cmdEdit = false;
return false;
}
// Management of the speed change.
- if ( event.event == EVENT_SPEED )
- {
+ if (event.type == EVENT_SPEED)
SetSpeed(1.0f);
- }
- if ( !m_dialog->EventProcess(event) )
+ if (!m_dialog->EventProcess(event))
{
- if ( event.event == EVENT_MOUSEMOVE )
+ if (event.type == EVENT_MOUSE_MOVE)
{
m_lastMousePos = event.pos;
HiliteObject(event.pos);
@@ -1273,241 +1334,217 @@ bool CRobotMain::EventProcess(const Event &event)
return false;
}
- if ( !m_displayText->EventProcess(event) )
- {
+ if (!m_displayText->EventProcess(event))
return false;
- }
- if ( event.event == EVENT_MOUSEMOVE )
+ if (event.type == EVENT_MOUSE_MOVE)
{
m_lastMousePos = event.pos;
HiliteObject(event.pos);
}
- if ( m_displayInfo != 0 ) // current info?
+ if (m_displayInfo != nullptr) // current info?
{
m_displayInfo->EventProcess(event);
- if ( event.event == EVENT_KEYDOWN )
+ if (event.type == EVENT_KEY_DOWN)
{
- 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) ||
- event.param == VK_ESCAPE )
+ if (event.key.key == GetInputBinding(INPUT_SLOT_HELP).key ||
+ event.key.key == GetInputBinding(INPUT_SLOT_HELP).joy ||
+ event.key.key == GetInputBinding(INPUT_SLOT_PROG).key ||
+ event.key.key == GetInputBinding(INPUT_SLOT_PROG).joy ||
+ event.key.key == KEY(ESCAPE))
{
StopDisplayInfo();
}
}
- if ( event.event == EVENT_OBJECT_INFOOK )
- {
+
+ if (event.type == EVENT_OBJECT_INFOOK)
StopDisplayInfo();
- }
+
return false;
}
+ CObject* obj;
+
// Simulation phase of the game
- if ( m_phase == PHASE_SIMUL )
+ if (m_phase == PHASE_SIMUL)
{
UpdateInfoText();
- if ( !m_bEditFull )
- {
+ if (!m_editFull)
m_camera->EventProcess(event);
- }
- switch( event.event )
+ switch (event.type)
{
- case EVENT_KEYDOWN:
- KeyCamera(event.event, event.param);
+ case EVENT_KEY_DOWN:
+ KeyCamera(event.type, event.key.key);
HiliteClear();
- if ( event.param == VK_F11 )
+ if (event.key.key == KEY(F11))
{
- m_particule->WriteWheelTrace("Savegame\\t.bmp", 256, 256, Math::Vector(16.0f, 0.0f, -368.0f), Math::Vector(140.0f, 0.0f, -248.0f));
+ m_particle->WriteWheelTrace("Savegame\\t.png", 256, 256, Math::Vector(16.0f, 0.0f, -368.0f), Math::Vector(140.0f, 0.0f, -248.0f));
return false;
}
- if ( m_bEditLock ) // current edition?
+ if (m_editLock) // current edition?
{
- if ( event.param == m_engine->RetKey(KEYRANK_HELP, 0) ||
- event.param == m_engine->RetKey(KEYRANK_HELP, 1) )
+ if (event.key.key == GetInputBinding(INPUT_SLOT_HELP).key ||
+ event.key.key == GetInputBinding(INPUT_SLOT_HELP).joy)
{
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.key.key == GetInputBinding(INPUT_SLOT_PROG).key ||
+ event.key.key == GetInputBinding(INPUT_SLOT_PROG).joy)
{
StartDisplayInfo(SATCOM_PROG, false);
return false;
}
break;
}
- if ( m_bMovieLock ) // current movie?
+ if (m_movieLock) // current movie?
{
- if ( event.param == m_engine->RetKey(KEYRANK_QUIT, 0) ||
- event.param == m_engine->RetKey(KEYRANK_QUIT, 1) ||
- event.param == VK_ESCAPE )
+ if (event.key.key == GetInputBinding(INPUT_SLOT_QUIT).key ||
+ event.key.key == GetInputBinding(INPUT_SLOT_QUIT).joy ||
+ event.key.key == KEY(ESCAPE))
{
AbortMovie();
}
return false;
}
- if ( m_camera->RetType() == CAMERA_VISIT )
+ if (m_camera->GetType() == Gfx::CAM_TYPE_VISIT)
{
- if ( event.param == m_engine->RetKey(KEYRANK_VISIT, 0) ||
- event.param == m_engine->RetKey(KEYRANK_VISIT, 1) )
+ if (event.key.key == GetInputBinding(INPUT_SLOT_VISIT).key ||
+ event.key.key == GetInputBinding(INPUT_SLOT_VISIT).joy)
{
StartDisplayVisit(EVENT_NULL);
}
- if ( event.param == m_engine->RetKey(KEYRANK_QUIT, 0) ||
- event.param == m_engine->RetKey(KEYRANK_QUIT, 1) ||
- event.param == VK_ESCAPE )
+ if (event.key.key == GetInputBinding(INPUT_SLOT_QUIT).key ||
+ event.key.key == GetInputBinding(INPUT_SLOT_QUIT).joy ||
+ event.key.key == KEY(ESCAPE))
{
StopDisplayVisit();
}
return false;
}
- if ( event.param == m_engine->RetKey(KEYRANK_QUIT, 0) ||
- event.param == m_engine->RetKey(KEYRANK_QUIT, 1) )
+ if (event.key.key == GetInputBinding(INPUT_SLOT_QUIT).key ||
+ event.key.key == GetInputBinding(INPUT_SLOT_QUIT).joy)
{
- if ( m_movie->IsExist() )
- {
+ if (m_movie->IsExist())
StartDisplayInfo(SATCOM_HUSTON, false);
- }
- else if ( m_winDelay > 0.0f )
- {
+ else if (m_winDelay > 0.0f)
ChangePhase(PHASE_WIN);
- }
- else if ( m_lostDelay > 0.0f )
- {
+ else if (m_lostDelay > 0.0f)
ChangePhase(PHASE_LOST);
- }
else
- {
m_dialog->StartAbort(); // do you want to leave?
- }
}
- if ( event.param == VK_PAUSE )
+ if (event.key.key == KEY(PAUSE))
{
- if ( !m_bMovieLock && !m_bEditLock && !m_bCmdEdit &&
- m_camera->RetType() != CAMERA_VISIT &&
- !m_movie->IsExist() )
+ if (!m_movieLock && !m_editLock && !m_cmdEdit &&
+ m_camera->GetType() != Gfx::CAM_TYPE_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.key.key == GetInputBinding(INPUT_SLOT_CAMERA).key ||
+ event.key.key == GetInputBinding(INPUT_SLOT_CAMERA).joy)
{
ChangeCamera();
}
- if ( event.param == m_engine->RetKey(KEYRANK_DESEL, 0) ||
- event.param == m_engine->RetKey(KEYRANK_DESEL, 1) )
+ if (event.key.key == GetInputBinding(INPUT_SLOT_DESEL).key ||
+ event.key.key == GetInputBinding(INPUT_SLOT_DESEL).joy)
{
- if ( m_bShortCut )
- {
+ if (m_shortCut)
DeselectObject();
- }
}
- if ( event.param == m_engine->RetKey(KEYRANK_HUMAN, 0) ||
- event.param == m_engine->RetKey(KEYRANK_HUMAN, 1) )
+ if (event.key.key == GetInputBinding(INPUT_SLOT_HUMAN).key ||
+ event.key.key == GetInputBinding(INPUT_SLOT_HUMAN).joy)
{
SelectHuman();
}
- if ( event.param == m_engine->RetKey(KEYRANK_NEXT, 0) ||
- event.param == m_engine->RetKey(KEYRANK_NEXT, 1) )
+ if (event.key.key == GetInputBinding(INPUT_SLOT_NEXT).key ||
+ event.key.key == GetInputBinding(INPUT_SLOT_NEXT).joy)
{
- if ( m_bShortCut )
- {
+ if (m_shortCut)
m_short->SelectNext();
- }
}
- if ( event.param == m_engine->RetKey(KEYRANK_HELP, 0) ||
- event.param == m_engine->RetKey(KEYRANK_HELP, 1) )
+ if (event.key.key == GetInputBinding(INPUT_SLOT_HELP).key ||
+ event.key.key == GetInputBinding(INPUT_SLOT_HELP).joy)
{
StartDisplayInfo(SATCOM_HUSTON, true);
}
- if ( event.param == m_engine->RetKey(KEYRANK_PROG, 0) ||
- event.param == m_engine->RetKey(KEYRANK_PROG, 1) )
+ if (event.key.key == GetInputBinding(INPUT_SLOT_PROG).key ||
+ event.key.key == GetInputBinding(INPUT_SLOT_PROG).joy)
{
StartDisplayInfo(SATCOM_PROG, true);
}
- if ( event.param == m_engine->RetKey(KEYRANK_VISIT, 0) ||
- event.param == m_engine->RetKey(KEYRANK_VISIT, 1) )
+ if (event.key.key == GetInputBinding(INPUT_SLOT_VISIT).key ||
+ event.key.key == GetInputBinding(INPUT_SLOT_VISIT).joy)
{
StartDisplayVisit(EVENT_NULL);
}
- if ( event.param == m_engine->RetKey(KEYRANK_SPEED10, 0) ||
- event.param == m_engine->RetKey(KEYRANK_SPEED10, 1) )
+ if (event.key.key == GetInputBinding(INPUT_SLOT_SPEED10).key ||
+ event.key.key == GetInputBinding(INPUT_SLOT_SPEED10).joy)
{
SetSpeed(1.0f);
}
- if ( event.param == m_engine->RetKey(KEYRANK_SPEED15, 0) ||
- event.param == m_engine->RetKey(KEYRANK_SPEED15, 1) )
+ if (event.key.key == GetInputBinding(INPUT_SLOT_SPEED15).key ||
+ event.key.key == GetInputBinding(INPUT_SLOT_SPEED15).joy)
{
SetSpeed(1.5f);
}
- if ( event.param == m_engine->RetKey(KEYRANK_SPEED20, 0) ||
- event.param == m_engine->RetKey(KEYRANK_SPEED20, 1) )
+ if (event.key.key == GetInputBinding(INPUT_SLOT_SPEED20).key ||
+ event.key.key == GetInputBinding(INPUT_SLOT_SPEED20).joy)
{
SetSpeed(2.0f);
}
- if ( event.param == m_engine->RetKey(KEYRANK_SPEED30, 0) ||
- event.param == m_engine->RetKey(KEYRANK_SPEED30, 1) )
- {
- SetSpeed(3.0f);
- }
break;
- case EVENT_KEYUP:
- KeyCamera(event.event, event.param);
+ case EVENT_KEY_UP:
+ KeyCamera(event.type, event.key.key);
break;
- case EVENT_LBUTTONDOWN:
- pObj = DetectObject(event.pos);
- if ( !m_bShortCut ) pObj = 0;
- if ( pObj != 0 && pObj->RetType() == OBJECT_TOTO )
+ case EVENT_MOUSE_BUTTON_DOWN:
+ if (event.mouseButton.button != 1) // only left mouse button
+ break;
+
+ obj = DetectObject(event.pos);
+ if (!m_shortCut) obj = nullptr;
+ if (obj != nullptr && obj->GetType() == OBJECT_TOTO)
{
- if ( m_displayInfo != 0 ) // current info?
+ if (m_displayInfo != nullptr) // current info?
{
StopDisplayInfo();
}
else
{
- if ( !m_bEditLock )
- {
+ if (!m_editLock)
StartDisplayInfo(SATCOM_HUSTON, true);
- }
}
}
else
- {
- SelectObject(pObj);
- }
+ SelectObject(obj);
break;
- case EVENT_LBUTTONUP:
+ case EVENT_MOUSE_BUTTON_UP:
+ if (event.mouseButton.button != 1) // only left mouse button
+ break;
+
m_cameraPan = 0.0f;
m_cameraZoom = 0.0f;
break;
case EVENT_BUTTON_QUIT:
- if ( m_movie->IsExist() )
- {
+ if (m_movie->IsExist())
StartDisplayInfo(SATCOM_HUSTON, false);
- }
- else if ( m_winDelay > 0.0f )
- {
+ else if (m_winDelay > 0.0f)
ChangePhase(PHASE_WIN);
- }
- else if ( m_lostDelay > 0.0f )
- {
+ else if (m_lostDelay > 0.0f)
+
ChangePhase(PHASE_LOST);
- }
else
- {
m_dialog->StartAbort(); // do you want to leave?
- }
break;
case EVENT_OBJECT_LIMIT:
@@ -1515,10 +1552,8 @@ bool CRobotMain::EventProcess(const Event &event)
break;
case EVENT_OBJECT_DESELECT:
- if ( m_bShortCut )
- {
+ if (m_shortCut)
DeselectObject();
- }
break;
case EVENT_OBJECT_HELP:
@@ -1563,7 +1598,7 @@ bool CRobotMain::EventProcess(const Event &event)
case EVENT_DT_VISIT2:
case EVENT_DT_VISIT3:
case EVENT_DT_VISIT4:
- StartDisplayVisit(event.event);
+ StartDisplayVisit(event.type);
break;
case EVENT_DT_END:
@@ -1590,7 +1625,7 @@ bool CRobotMain::EventProcess(const Event &event)
case EVENT_OBJECT_SHORTCUT17:
case EVENT_OBJECT_SHORTCUT18:
case EVENT_OBJECT_SHORTCUT19:
- m_short->SelectShortcut(event.event);
+ m_short->SelectShortcut(event.type);
break;
case EVENT_OBJECT_MOVIELOCK:
@@ -1604,74 +1639,46 @@ bool CRobotMain::EventProcess(const Event &event)
case EVENT_LOST:
ChangePhase(PHASE_LOST);
break;
+
+ default:
+ break;
}
EventObject(event);
return false;
}
- if ( m_phase == PHASE_PERSO )
- {
+ if (m_phase == PHASE_PERSO)
EventObject(event);
- }
- if ( m_phase == PHASE_WIN ||
- m_phase == PHASE_LOST )
+ if (m_phase == PHASE_WIN ||
+ m_phase == PHASE_LOST)
{
EventObject(event);
- switch( event.event )
+ switch (event.type)
{
- case EVENT_KEYDOWN:
- if ( event.param == VK_ESCAPE ||
- event.param == VK_RETURN )
+ case EVENT_KEY_DOWN:
+ if (event.key.key == KEY(ESCAPE) ||
+ event.key.key == KEY(RETURN))
{
- if ( m_bWinTerminate )
- {
+ if (m_winTerminate)
ChangePhase(PHASE_INIT);
- }
else
- {
ChangePhase(PHASE_TERM);
- }
}
break;
case EVENT_BUTTON_OK:
- if ( m_bWinTerminate )
- {
+ if (m_winTerminate)
ChangePhase(PHASE_INIT);
- }
else
- {
ChangePhase(PHASE_TERM);
- }
- break;
- }
- }
-
- if ( m_phase == PHASE_MODEL )
- {
- switch( event.event )
- {
- case EVENT_KEYDOWN:
- if ( event.param == VK_ESCAPE )
- {
- ChangePhase(PHASE_INIT);
- }
- if ( event.param == VK_HOME )
- {
- InitEye();
- }
break;
- case EVENT_BUTTON_CANCEL:
- ChangePhase(PHASE_INIT);
+ default:
break;
}
-
- m_model->EventProcess(event);
- return false;
}
return true;
@@ -1679,84 +1686,69 @@ bool CRobotMain::EventProcess(const Event &event)
-// Executes a command.
-
+//! Executes a command
void CRobotMain::ExecuteCmd(char *cmd)
{
- if ( cmd[0] == 0 ) return;
+ if (cmd[0] == 0) return;
- if ( m_phase == PHASE_SIMUL )
+ if (m_phase == PHASE_SIMUL)
{
- if ( strcmp(cmd, "winmission") == 0 )
- {
- Event newEvent;
- m_event->MakeEvent(newEvent, EVENT_WIN);
- m_event->AddEvent(newEvent);
- }
+ if (strcmp(cmd, "winmission") == 0)
+ m_eventQueue->AddEvent(Event(EVENT_WIN));
- if ( strcmp(cmd, "lostmission") == 0 )
- {
- Event newEvent;
- m_event->MakeEvent(newEvent, EVENT_LOST);
- m_event->AddEvent(newEvent);
- }
+ if (strcmp(cmd, "lostmission") == 0)
+ m_eventQueue->AddEvent(Event(EVENT_LOST));
- if ( strcmp(cmd, "trainerpilot") == 0 )
+ if (strcmp(cmd, "trainerpilot") == 0)
{
- m_bTrainerPilot = !m_bTrainerPilot;
+ m_trainerPilot = !m_trainerPilot;
return;
}
- if ( strcmp(cmd, "fly") == 0 )
+ if (strcmp(cmd, "fly") == 0)
{
- Event newEvent;
-
g_researchDone |= RESEARCH_FLY;
- m_event->MakeEvent(newEvent, EVENT_UPDINTERFACE);
- m_event->AddEvent(newEvent);
+ m_eventQueue->AddEvent(Event(EVENT_UPDINTERFACE));
return;
}
- if ( strcmp(cmd, "allresearch") == 0 )
+ if (strcmp(cmd, "allresearch") == 0)
{
- Event newEvent;
-
g_researchDone = -1; // all research are done
- m_event->MakeEvent(newEvent, EVENT_UPDINTERFACE);
- m_event->AddEvent(newEvent);
+ m_eventQueue->AddEvent(Event(EVENT_UPDINTERFACE));
return;
}
- if ( strcmp(cmd, "nolimit") == 0 )
+ if (strcmp(cmd, "nolimit") == 0)
{
m_terrain->SetFlyingMaxHeight(280.0f);
return;
}
- if ( strcmp(cmd, "photo1") == 0 )
+ if (strcmp(cmd, "photo1") == 0)
{
- m_bFreePhoto = !m_bFreePhoto;
- if ( m_bFreePhoto )
+ m_freePhoto = !m_freePhoto;
+ if (m_freePhoto)
{
- m_camera->SetType(CAMERA_FREE);
+ m_camera->SetType(Gfx::CAM_TYPE_FREE);
ChangePause(true);
}
else
{
- m_camera->SetType(CAMERA_BACK);
+ m_camera->SetType(Gfx::CAM_TYPE_BACK);
ChangePause(false);
}
return;
}
- if ( strcmp(cmd, "photo2") == 0 )
+ if (strcmp(cmd, "photo2") == 0)
{
- m_bFreePhoto = !m_bFreePhoto;
- if ( m_bFreePhoto )
+ m_freePhoto = !m_freePhoto;
+ if (m_freePhoto)
{
- m_camera->SetType(CAMERA_FREE);
+ m_camera->SetType(Gfx::CAM_TYPE_FREE);
ChangePause(true);
DeselectAll(); // removes the control buttons
m_map->ShowMap(false);
@@ -1764,246 +1756,202 @@ void CRobotMain::ExecuteCmd(char *cmd)
}
else
{
- m_camera->SetType(CAMERA_BACK);
+ m_camera->SetType(Gfx::CAM_TYPE_BACK);
ChangePause(false);
- m_map->ShowMap(m_bMapShow);
+ m_map->ShowMap(m_mapShow);
m_displayText->HideText(false);
}
return;
}
- if ( strcmp(cmd, "noclip") == 0 )
+ if (strcmp(cmd, "noclip") == 0)
{
- CObject* object;
-
- object = RetSelect();
- if ( object != 0 )
- {
+ CObject* object = GetSelect();
+ if (object != nullptr)
object->SetClip(false);
- }
return;
}
- if ( strcmp(cmd, "clip") == 0 )
+ if (strcmp(cmd, "clip") == 0)
{
- CObject* object;
-
- object = RetSelect();
- if ( object != 0 )
- {
+ CObject* object = GetSelect();
+ if (object != nullptr)
object->SetClip(true);
- }
return;
}
- if ( strcmp(cmd, "addhusky") == 0 )
+ if (strcmp(cmd, "addhusky") == 0)
{
- CObject* object;
-
- object = RetSelect();
- if ( object != 0 )
- {
- object->SetMagnifyDamage(object->RetMagnifyDamage()*0.1f);
- }
+ CObject* object = GetSelect();
+ if (object != nullptr)
+ object->SetMagnifyDamage(object->GetMagnifyDamage()*0.1f);
return;
}
- if ( strcmp(cmd, "addfreezer") == 0 )
+ if (strcmp(cmd, "addfreezer") == 0)
{
- CObject* object;
-
- object = RetSelect();
- if ( object != 0 )
- {
- object->SetRange(object->RetRange()*10.0f);
- }
+ CObject* object = GetSelect();
+ if (object != nullptr)
+ object->SetRange(object->GetRange()*10.0f);
return;
}
- if ( strcmp(cmd, "fullpower") == 0 )
+ if (strcmp(cmd, "fullpower") == 0)
{
- CObject* object;
- CObject* power;
- CPhysics* physics;
-
- object = RetSelect();
- if ( object != 0 )
+ CObject* object = GetSelect();
+ if (object != nullptr)
{
- power = object->RetPower();
- if ( power != 0 )
- {
+ CObject* power = object->GetPower();
+ if (power != nullptr)
power->SetEnergy(1.0f);
- }
+
object->SetShield(1.0f);
- physics = object->RetPhysics();
- if ( physics != 0 )
- {
+ CPhysics* physics = object->GetPhysics();
+ if (physics != nullptr)
physics->SetReactorRange(1.0f);
- }
}
return;
}
- if ( strcmp(cmd, "fullenergy") == 0 )
+ if (strcmp(cmd, "fullenergy") == 0)
{
- CObject* object;
- CObject* power;
-
- object = RetSelect();
- if ( object != 0 )
+ CObject* object = GetSelect();
+ if (object != nullptr)
{
- power = object->RetPower();
- if ( power != 0 )
- {
+ CObject* power = object->GetPower();
+ if (power != nullptr)
power->SetEnergy(1.0f);
- }
}
return;
}
- if ( strcmp(cmd, "fullshield") == 0 )
+ if (strcmp(cmd, "fullshield") == 0)
{
- CObject* object;
-
- object = RetSelect();
- if ( object != 0 )
- {
+ CObject* object = GetSelect();
+ if (object != nullptr)
object->SetShield(1.0f);
- }
return;
}
- if ( strcmp(cmd, "fullrange") == 0 )
+ if (strcmp(cmd, "fullrange") == 0)
{
- CObject* object;
- CPhysics* physics;
-
- object = RetSelect();
- if ( object != 0 )
+ CObject* object = GetSelect();
+ if (object != nullptr)
{
- physics = object->RetPhysics();
- if ( physics != 0 )
- {
+ CPhysics* physics = object->GetPhysics();
+ if (physics != nullptr)
physics->SetReactorRange(1.0f);
- }
}
return;
}
}
- if ( strcmp(cmd, "debugmode") == 0 )
+ if (strcmp(cmd, "debugmode") == 0)
{
- m_engine->SetDebugMode(!m_engine->RetDebugMode());
+ m_app->SetDebugMode(!m_app->GetDebugMode());
return;
}
- if ( strcmp(cmd, "showstat") == 0 )
+ if (strcmp(cmd, "showstat") == 0)
{
- m_engine->SetShowStat(!m_engine->RetShowStat());
+ m_engine->SetShowStats(!m_engine->GetShowStats());
return;
}
- if ( strcmp(cmd, "invshadow") == 0 )
+ if (strcmp(cmd, "invshadow") == 0)
{
- m_engine->SetShadow(!m_engine->RetShadow());
+ m_engine->SetShadow(!m_engine->GetShadow());
return;
}
- if ( strcmp(cmd, "invdirty") == 0 )
+ if (strcmp(cmd, "invdirty") == 0)
{
- m_engine->SetDirty(!m_engine->RetDirty());
+ m_engine->SetDirty(!m_engine->GetDirty());
return;
}
- if ( strcmp(cmd, "invfog") == 0 )
+ if (strcmp(cmd, "invfog") == 0)
{
- m_engine->SetFog(!m_engine->RetFog());
+ m_engine->SetFog(!m_engine->GetFog());
return;
}
- if ( strcmp(cmd, "invlens") == 0 )
+ if (strcmp(cmd, "invlens") == 0)
{
- m_engine->SetLensMode(!m_engine->RetLensMode());
+ m_engine->SetLensMode(!m_engine->GetLensMode());
return;
}
- if ( strcmp(cmd, "invwater") == 0 )
+ if (strcmp(cmd, "invwater") == 0)
{
- m_engine->SetWaterMode(!m_engine->RetWaterMode());
+ m_engine->SetWaterMode(!m_engine->GetWaterMode());
return;
}
- if ( strcmp(cmd, "invsky") == 0 )
+ if (strcmp(cmd, "invsky") == 0)
{
- m_engine->SetSkyMode(!m_engine->RetSkyMode());
+ m_engine->SetSkyMode(!m_engine->GetSkyMode());
return;
}
- if ( strcmp(cmd, "invplanet") == 0 )
+ if (strcmp(cmd, "invplanet") == 0)
{
- m_engine->SetPlanetMode(!m_engine->RetPlanetMode());
+ m_engine->SetPlanetMode(!m_engine->GetPlanetMode());
return;
}
- if ( strcmp(cmd, "showpos") == 0 )
+ if (strcmp(cmd, "showpos") == 0)
{
- m_bShowPos = !m_bShowPos;
+ m_showPos = !m_showPos;
return;
}
- if ( strcmp(cmd, "selectinsect") == 0 )
+ if (strcmp(cmd, "selectinsect") == 0)
{
- m_bSelectInsect = !m_bSelectInsect;
+ m_selectInsect = !m_selectInsect;
return;
}
- if ( strcmp(cmd, "showsoluce") == 0 )
+ if (strcmp(cmd, "showsoluce") == 0)
{
- m_bShowSoluce = !m_bShowSoluce;
+ m_showSoluce = !m_showSoluce;
m_dialog->ShowSoluceUpdate();
return;
}
-#if _TEEN
- if ( strcmp(cmd, "allteens") == 0 )
-#else
- if ( strcmp(cmd, "allmission") == 0 )
-#endif
+/* TODO: #if _TEEN
+ if (strcmp(cmd, "allteens") == 0)
+#else*/
+ if (strcmp(cmd, "allmission") == 0)
{
- m_bShowAll = !m_bShowAll;
+ m_showAll = !m_showAll;
m_dialog->AllMissionUpdate();
return;
}
- if ( strcmp(cmd, "invradar") == 0 )
+ if (strcmp(cmd, "invradar") == 0)
{
- m_bCheatRadar = !m_bCheatRadar;
+ m_cheatRadar = !m_cheatRadar;
return;
}
- if ( m_phase == PHASE_SIMUL )
- {
+ if (m_phase == PHASE_SIMUL)
m_displayText->DisplayError(ERR_CMD, Math::Vector(0.0f,0.0f,0.0f));
- }
}
-// Returns the type of current movie.
-
-MainMovieType CRobotMain::RetMainMovie()
+//! Returns the type of current movie
+MainMovieType CRobotMain::GetMainMovie()
{
- return m_movie->RetType();
+ return m_movie->GetType();
}
-// Clears the display of instructions.
-
+//! Clears the display of instructions
void CRobotMain::FlushDisplayInfo()
{
- int i;
-
- for ( i=0 ; i<SATCOM_MAX ; i++ )
+ for (int i = 0; i < SATCOM_MAX; i++)
{
m_infoFilename[i][0] = 0;
m_infoPos[i] = 0;
@@ -2012,220 +1960,181 @@ void CRobotMain::FlushDisplayInfo()
m_infoIndex = 0;
}
-// Beginning of the displaying of instructions.
-// index: SATCOM_*
-
-void CRobotMain::StartDisplayInfo(int index, bool bMovie)
+//! Beginning of the displaying of instructions.
+//! index: SATCOM_*
+void CRobotMain::StartDisplayInfo(int index, bool movie)
{
- CObject* pObj;
- CMotion* motion;
- bool bHuman;
-
- if ( m_bCmdEdit || m_bSatComLock ) return;
+ if (m_cmdEdit || m_satComLock) return;
- pObj = RetSelect();
- bHuman = ( pObj != 0 && pObj->RetType() == OBJECT_HUMAN );
+ CObject* obj = GetSelect();
+ bool human = obj != nullptr && obj->GetType() == OBJECT_HUMAN;
- if ( !m_bEditLock && bMovie && !m_movie->IsExist() && bHuman )
+ if (!m_editLock && movie && !m_movie->IsExist() && human)
{
- motion = pObj->RetMotion();
- if ( motion != 0 && motion->RetAction() == -1 )
+ CMotion* motion = obj->GetMotion();
+ if (motion != nullptr && motion->GetAction() == -1)
{
m_movieInfoIndex = index;
m_movie->Start(MM_SATCOMopen, 2.5f);
ChangePause(true);
-//? m_map->ShowMap(false);
m_infoObject = DeselectAll(); // removes the control buttons
m_displayText->HideText(true);
return;
}
}
- if ( m_movie->IsExist() )
+ if (m_movie->IsExist())
{
m_movie->Stop();
ChangePause(false);
SelectObject(m_infoObject, false); // hands over the command buttons
-//? m_map->ShowMap(m_bMapShow);
m_displayText->HideText(false);
}
StartDisplayInfo(m_infoFilename[index], index);
}
-// Beginning of the displaying of instructions.
-
-void CRobotMain::StartDisplayInfo(char *filename, int index)
+//! Beginning of the displaying of instructions
+void CRobotMain::StartDisplayInfo(const char *filename, int index)
{
- CButton* pb;
- bool bSoluce;
-
- if ( m_bCmdEdit ) return;
+ if (m_cmdEdit) return;
m_movieInfoIndex = -1;
ClearInterface(); // removes setting evidence and tooltip
- if ( !m_bEditLock )
+ if (!m_editLock)
{
-//? m_map->ShowMap(false);
m_infoObject = DeselectAll(); // removes the control buttons
m_displayText->HideText(true);
m_sound->MuteAll(true);
}
- pb = (CButton*)m_interface->SearchControl(EVENT_BUTTON_QUIT);
- if ( pb != 0 )
+ Ui::CButton* pb = dynamic_cast<Ui::CButton*>(m_interface->SearchControl(EVENT_BUTTON_QUIT));
+ if (pb != nullptr)
{
- pb->ClearState(STATE_VISIBLE);
+ pb->ClearState(Ui::STATE_VISIBLE);
}
- bSoluce = m_dialog->RetSceneSoluce();
+ bool soluce = m_dialog->GetSceneSoluce();
- m_displayInfo = new CDisplayInfo(m_iMan);
- m_displayInfo->StartDisplayInfo(filename, index, bSoluce);
+ m_displayInfo = new Ui::CDisplayInfo();
+ m_displayInfo->StartDisplayInfo(filename, index, soluce);
m_infoIndex = index;
- if ( index != -1 )
- {
+ if (index != -1)
m_displayInfo->SetPosition(m_infoPos[index]);
- }
}
-// End of displaying of instructions.
-
+//! End of displaying of instructions
void CRobotMain::StopDisplayInfo()
{
- CButton* pb;
-
- if ( m_movieInfoIndex != -1 ) // film to read the SatCom?
- {
+ if (m_movieInfoIndex != -1) // film to read the SatCom?
m_movie->Start(MM_SATCOMclose, 2.0f);
- }
- if ( m_infoIndex != -1 )
- {
- m_infoPos[m_infoIndex] = m_displayInfo->RetPosition();
- }
+ if (m_infoIndex != -1)
+ m_infoPos[m_infoIndex] = m_displayInfo->GetPosition();
+
m_displayInfo->StopDisplayInfo();
delete m_displayInfo;
- m_displayInfo = 0;
+ m_displayInfo = nullptr;
- if ( !m_bEditLock )
+ if (!m_editLock)
{
- pb = (CButton*)m_interface->SearchControl(EVENT_BUTTON_QUIT);
- if ( pb != 0 )
- {
- pb->SetState(STATE_VISIBLE);
- }
+ Ui::CButton* pb = dynamic_cast<Ui::CButton*>(m_interface->SearchControl(EVENT_BUTTON_QUIT));
+ if (pb != nullptr)
+ pb->SetState(Ui::STATE_VISIBLE);
SelectObject(m_infoObject, false); // gives the command buttons
-//? m_map->ShowMap(m_bMapShow);
m_displayText->HideText(false);
m_sound->MuteAll(false);
}
- if ( m_infoUsed == 0 )
- {
+ if (m_infoUsed == 0)
m_displayText->ClearText(); // removes message "see SatCom ..."
- }
m_infoUsed ++;
}
-// Returns the name of the text display.
-
-char* CRobotMain::RetDisplayInfoName(int index)
+//! Returns the name of the text display
+char* CRobotMain::GetDisplayInfoName(int index)
{
return m_infoFilename[index];
}
-// Returns the name of the text display.
-
-int CRobotMain::RetDisplayInfoPosition(int index)
+//! Returns the name of the text display
+int CRobotMain::GetDisplayInfoPosition(int index)
{
return m_infoPos[index];
}
-// Returns the name of the text display.
-
+//! Returns the name of the text display
void CRobotMain::SetDisplayInfoPosition(int index, int pos)
{
m_infoPos[index] = pos;
}
-// Beginning of a dialogue during the game,
-
+//! Beginning of a dialogue during the game
void CRobotMain::StartSuspend()
{
- CButton* pb;
-
m_map->ShowMap(false);
m_infoObject = DeselectAll(); // removes the control buttons
m_displayText->HideText(true);
- pb = (CButton*)m_interface->SearchControl(EVENT_BUTTON_QUIT);
- if ( pb != 0 )
- {
- pb->ClearState(STATE_VISIBLE);
- }
+ Ui::CButton* pb = dynamic_cast<Ui::CButton*>(m_interface->SearchControl(EVENT_BUTTON_QUIT));
+ if (pb != nullptr)
+ pb->ClearState(Ui::STATE_VISIBLE);
- m_bSuspend = true;
+ m_suspend = true;
}
-// End of dialogue during the game,
-
+//! End of dialogue during the game
void CRobotMain::StopSuspend()
{
- CButton* pb;
-
- pb = (CButton*)m_interface->SearchControl(EVENT_BUTTON_QUIT);
- if ( pb != 0 )
- {
- pb->SetState(STATE_VISIBLE);
- }
+ Ui::CButton* pb = dynamic_cast<Ui::CButton*>(m_interface->SearchControl(EVENT_BUTTON_QUIT));
+ if (pb != nullptr)
+ pb->SetState(Ui::STATE_VISIBLE);
SelectObject(m_infoObject, false); // gives the command buttons
- m_map->ShowMap(m_bMapShow);
+ m_map->ShowMap(m_mapShow);
m_displayText->HideText(false);
- m_bSuspend = false;
+ m_suspend = false;
}
-// Returns the absolute time of the game
-
-float CRobotMain::RetGameTime()
+//! Returns the absolute time of the game
+float CRobotMain::GetGameTime()
{
return m_gameTime;
}
-// Managing the size of the default fonts.
-
+//! Managing the size of the default fonts
void CRobotMain::SetFontSize(float size)
{
m_fontSize = size;
- SetLocalProfileFloat("Edit", "FontSize", m_fontSize);
+ /* TODO: profile
+ SetLocalProfileFloat("Edit", "FontSize", m_fontSize); */
}
-float CRobotMain::RetFontSize()
+float CRobotMain::GetFontSize()
{
return m_fontSize;
}
-// Managing the size of the default window.
-
+//! Managing the size of the default window
void CRobotMain::SetWindowPos(Math::Point pos)
{
m_windowPos = pos;
+ /* TODO: profile
SetLocalProfileFloat("Edit", "WindowPos.x", m_windowPos.x);
- SetLocalProfileFloat("Edit", "WindowPos.y", m_windowPos.y);
+ SetLocalProfileFloat("Edit", "WindowPos.y", m_windowPos.y); */
}
-Math::Point CRobotMain::RetWindowPos()
+Math::Point CRobotMain::GetWindowPos()
{
return m_windowPos;
}
@@ -2233,25 +2142,26 @@ Math::Point CRobotMain::RetWindowPos()
void CRobotMain::SetWindowDim(Math::Point dim)
{
m_windowDim = dim;
+ /* TODO: profile
SetLocalProfileFloat("Edit", "WindowDim.x", m_windowDim.x);
- SetLocalProfileFloat("Edit", "WindowDim.y", m_windowDim.y);
+ SetLocalProfileFloat("Edit", "WindowDim.y", m_windowDim.y); */
}
-Math::Point CRobotMain::RetWindowDim()
+Math::Point CRobotMain::GetWindowDim()
{
return m_windowDim;
}
-// Managing windows open/save.
-
-void CRobotMain::SetIOPublic(bool bMode)
+//! Managing windows open/save
+void CRobotMain::SetIOPublic(bool mode)
{
- m_IOPublic = bMode;
- SetLocalProfileInt("Edit", "IOPublic", m_IOPublic);
+ m_IOPublic = mode;
+ /* TODO: profile
+ SetLocalProfileInt("Edit", "IOPublic", m_IOPublic); */
}
-bool CRobotMain::RetIOPublic()
+bool CRobotMain::GetIOPublic()
{
return m_IOPublic;
}
@@ -2259,11 +2169,12 @@ bool CRobotMain::RetIOPublic()
void CRobotMain::SetIOPos(Math::Point pos)
{
m_IOPos = pos;
+ /* TODO: profile
SetLocalProfileFloat("Edit", "IOPos.x", m_IOPos.x);
- SetLocalProfileFloat("Edit", "IOPos.y", m_IOPos.y);
+ SetLocalProfileFloat("Edit", "IOPos.y", m_IOPos.y); */
}
-Math::Point CRobotMain::RetIOPos()
+Math::Point CRobotMain::GetIOPos()
{
return m_IOPos;
}
@@ -2271,62 +2182,52 @@ Math::Point CRobotMain::RetIOPos()
void CRobotMain::SetIODim(Math::Point dim)
{
m_IODim = dim;
+ /* TODO: profile
SetLocalProfileFloat("Edit", "IODim.x", m_IODim.x);
- SetLocalProfileFloat("Edit", "IODim.y", m_IODim.y);
+ SetLocalProfileFloat("Edit", "IODim.y", m_IODim.y); */
}
-Math::Point CRobotMain::RetIODim()
+Math::Point CRobotMain::GetIODim()
{
return m_IODim;
}
-// Start of the visit instead of an error.
-
-void CRobotMain::StartDisplayVisit(EventMsg event)
+//! Start of the visit instead of an error
+void CRobotMain::StartDisplayVisit(EventType event)
{
- CWindow* pw;
- CButton* button;
- CGroup* group;
- Math::Vector goal;
- Math::Point pos, dim;
- int i, j;
-
- if ( m_bEditLock ) return;
+ if (m_editLock) return;
- pw = (CWindow*)m_interface->SearchControl(EVENT_WINDOW2);
- if ( pw == 0 ) return;
+ Ui::CWindow* pw = dynamic_cast<Ui::CWindow*>(m_interface->SearchControl(EVENT_WINDOW2));
+ if (pw == nullptr) return;
- if ( event == EVENT_NULL ) // visit by keyboard shortcut?
+ if (event == EVENT_NULL) // visit by keyboard shortcut?
{
- if ( m_visitLast != EVENT_NULL ) // already a current visit?
- {
+ int i;
+ if (m_visitLast != EVENT_NULL) // already a current visit?
i = m_visitLast-EVENT_DT_VISIT0;
- }
else
- {
- i = MAXDTLINE;
- }
+ i = Ui::MAXDTLINE;
// Seeks the last.
- for ( j=0 ; j<MAXDTLINE ; j++ )
+ for (int j = 0; j < Ui::MAXDTLINE; j++)
{
i --;
- if ( i < 0 ) i = MAXDTLINE-1;
+ if (i < 0) i = Ui::MAXDTLINE-1;
- button = (CButton*)pw->SearchControl(EventMsg(EVENT_DT_VISIT0+i));
- if ( button == 0 || !button->TestState(STATE_ENABLE) ) continue;
+ Ui::CButton* button = dynamic_cast<Ui::CButton*>(pw->SearchControl(static_cast<EventType>(EVENT_DT_VISIT0+i)));
+ if (button == nullptr || !button->TestState(Ui::STATE_ENABLE)) continue;
- group = (CGroup*)pw->SearchControl(EventMsg(EVENT_DT_GROUP0+i));
- if ( group != 0 )
+ Ui::CGroup* group = dynamic_cast<Ui::CGroup*>(pw->SearchControl(static_cast<EventType>(EVENT_DT_GROUP0+i)));
+ if (group != nullptr)
{
- event = EventMsg(EVENT_DT_VISIT0+i);
+ event = static_cast<EventType>(EVENT_DT_VISIT0+i);
break;
}
}
}
- if ( event == EVENT_NULL )
+ if (event == EVENT_NULL)
{
m_sound->Play(SOUND_TZOING); // nothing to do!
return;
@@ -2336,7 +2237,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() == Gfx::CAM_TYPE_VISIT) // already a current visit?
{
m_camera->StopVisit();
m_displayText->ClearVisit();
@@ -2347,8 +2248,9 @@ void CRobotMain::StartDisplayVisit(EventMsg event)
}
// Creates the "continue" button.
- if ( m_interface->SearchControl(EVENT_DT_END) == 0 )
+ if (m_interface->SearchControl(EVENT_DT_END) == 0)
{
+ Math::Point pos, dim;
pos.x = 10.0f/640.0f;
pos.y = 10.0f/480.0f;
dim.x = 50.0f/640.0f;
@@ -2357,67 +2259,63 @@ void CRobotMain::StartDisplayVisit(EventMsg event)
}
// Creates the arrow to show the place.
- if ( m_visitArrow != 0 )
+ if (m_visitArrow != 0)
{
m_visitArrow->DeleteObject();
delete m_visitArrow;
m_visitArrow = 0;
}
- goal = m_displayText->RetVisitGoal(event);
+
+ Math::Vector 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;
- m_visitParticule = 0.0f;
+ m_visitParticle = 0.0f;
- m_particule->DeleteParticule(PARTISHOW);
+ m_particle->DeleteParticle(Gfx::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);
}
-// Move the arrow to visit.
-
+//! Move the arrow to visit
void CRobotMain::FrameVisit(float rTime)
{
- Math::Vector pos, speed;
- Math::Point dim;
- float level;
-
- if ( m_visitArrow == 0 ) return;
+ if (m_visitArrow == 0) return;
// Moves the arrow.
m_visitTime += rTime;
- pos = m_visitPosArrow;
+ Math::Vector pos = m_visitPosArrow;
pos.y += 1.5f+sinf(m_visitTime*4.0f)*4.0f;
m_visitArrow->SetPosition(0, pos);
m_visitArrow->SetAngleY(0, m_visitTime*2.0f);
// Manages the particles "arrows".
- m_visitParticule -= rTime;
- if ( m_visitParticule <= 0.0f )
+ m_visitParticle -= rTime;
+ if (m_visitParticle <= 0.0f)
{
- m_visitParticule = 1.5f;
+ m_visitParticle = 1.5f;
pos = m_visitPos;
- level = m_terrain->RetFloorLevel(pos)+2.0f;
- if ( pos.y < level ) pos.y = level; // not below the ground
- speed = Math::Vector(0.0f, 0.0f, 0.0f);
+ float level = m_terrain->GetFloorLevel(pos)+2.0f;
+ if (pos.y < level) pos.y = level; // not below the ground
+ Math::Vector speed(0.0f, 0.0f, 0.0f);
+ Math::Point dim;
dim.x = 30.0f;
dim.y = dim.x;
- m_particule->CreateParticule(pos, speed, dim, PARTISHOW, 2.0f);
+ m_particle->CreateParticle(pos, speed, dim, Gfx::PARTISHOW, 2.0f);
}
}
-// End of the visit instead of an error.
-
+//! End of the visit instead of an error
void CRobotMain::StopDisplayVisit()
{
m_visitLast = EVENT_NULL;
@@ -2426,20 +2324,20 @@ void CRobotMain::StopDisplayVisit()
m_interface->DeleteControl(EVENT_DT_END);
// Removes the arrow.
- if ( m_visitArrow != 0 )
+ if (m_visitArrow != nullptr)
{
m_visitArrow->DeleteObject();
delete m_visitArrow;
- m_visitArrow = 0;
+ m_visitArrow = nullptr;
}
// Removes particles "arrows".
- m_particule->DeleteParticule(PARTISHOW);
+ m_particle->DeleteParticle(Gfx::PARTISHOW);
m_camera->StopVisit();
m_displayText->ClearVisit();
ChangePause(false);
- if ( m_visitObject != 0 )
+ if (m_visitObject != 0)
{
SelectObject(m_visitObject, false); // gives the command buttons
m_visitObject = 0;
@@ -2448,53 +2346,41 @@ void CRobotMain::StopDisplayVisit()
-// Updates all the shortcuts.
-
+//! Updates all the shortcuts
void CRobotMain::UpdateShortcuts()
{
m_short->UpdateShortcuts();
}
-// Returns the object that default was select after the creation of a scene.
-
-CObject* CRobotMain::RetSelectObject()
+//! Returns the object that default was select after the creation of a scene
+CObject* CRobotMain::GetSelectObject()
{
- if ( m_selectObject != 0 ) return m_selectObject;
+ if (m_selectObject != nullptr) return m_selectObject;
return SearchHuman();
}
-// Deselects everything, and returns the object that was selected.
-
+//! Deselects everything, and returns the object that was selected
CObject* CRobotMain::DeselectAll()
{
- CObject* pObj;
- CObject* pPrev;
- int i;
-
- pPrev = 0;
- for ( i=0 ; i<1000000 ; i++ )
+ CObject* prev = nullptr;
+ for (int i = 0; i < 1000000; i++)
{
- pObj = (CObject*)m_iMan->SearchInstance(CLASS_OBJECT, i);
- if ( pObj == 0 ) break;
+ CObject* obj = static_cast<CObject*>(m_iMan->SearchInstance(CLASS_OBJECT, i));
+ if (obj == nullptr) break;
- if ( pObj->RetSelect() ) pPrev = pObj;
- pObj->SetSelect(false);
+ if (obj->GetSelect()) prev = obj;
+ obj->SetSelect(false);
}
- return pPrev;
+ return prev;
}
-// Selects an object, without attending to deselect the rest.
-
-void CRobotMain::SelectOneObject(CObject* pObj, bool bDisplayError)
+//! Selects an object, without attending to deselect the rest
+void CRobotMain::SelectOneObject(CObject* obj, bool displayError)
{
- ObjectType type;
- CObject* toto;
- CMotionToto* mt;
+ obj->SetSelect(true, displayError);
+ m_camera->SetControllingObject(obj);
- pObj->SetSelect(true, bDisplayError);
- m_camera->SetObject(pObj);
-
- type = pObj->RetType();
+ ObjectType type = obj->GetType();
if ( type == OBJECT_HUMAN ||
type == OBJECT_MOBILEfa ||
type == OBJECT_MOBILEta ||
@@ -2524,271 +2410,205 @@ 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(obj->GetCameraType());
+ m_camera->SetDist(obj->GetCameraDist());
}
else
{
- m_camera->SetType(CAMERA_BACK);
+ m_camera->SetType(Gfx::CAM_TYPE_BACK);
}
- toto = SearchToto();
- if ( toto != 0 )
+ CObject* toto = SearchToto();
+ if (toto != nullptr)
{
- mt = (CMotionToto*)toto->RetMotion();
- if ( mt != 0 )
- {
+ CMotionToto* mt = dynamic_cast<CMotionToto*>(toto->GetMotion());
+ if (mt != nullptr)
mt->SetLinkType(type);
- }
}
}
-// Selects the object aimed by the mouse.
-
-bool CRobotMain::SelectObject(CObject* pObj, bool bDisplayError)
+//! Selects the object aimed by the mouse
+bool CRobotMain::SelectObject(CObject* obj, bool displayError)
{
- CObject* pPrev;
-
- if ( m_camera->RetType() == CAMERA_VISIT )
- {
+ if (m_camera->GetType() == Gfx::CAM_TYPE_VISIT)
StopDisplayVisit();
- }
- if ( m_bMovieLock || m_bEditLock || m_bPause ) return false;
- if ( m_movie->IsExist() ) return false;
- if ( pObj == 0 || !IsSelectable(pObj) ) return false;
+ if (m_movieLock || m_editLock || m_pause) return false;
+ if (m_movie->IsExist()) return false;
+ if (obj == nullptr || !IsSelectable(obj)) return false;
- pPrev = DeselectAll();
+ CObject* prev = DeselectAll();
- if ( pPrev != 0 && pPrev != pObj )
- {
- pObj->AddDeselList(pPrev);
- }
+ if (prev != nullptr && prev != obj)
+ obj->AddDeselList(prev);
- SelectOneObject(pObj, bDisplayError);
+ SelectOneObject(obj, displayError);
m_short->UpdateShortcuts();
return true;
}
-// Deselects the selected object.
-
+//! Deselects the selected object
bool CRobotMain::DeselectObject()
{
- CObject* pObj;
- CObject* pPrev;
+ CObject* obj = nullptr;
+ CObject* prev = DeselectAll();
- pPrev = DeselectAll();
-
- if ( pPrev == 0 )
- {
- pObj = SearchHuman();
- }
+ if (prev == nullptr)
+ obj = SearchHuman();
else
- {
- pObj = pPrev->SubDeselList();
- }
- if ( pObj == 0 )
- {
- pObj = SearchHuman();
- }
+ obj = prev->SubDeselList();
- if ( pObj != 0 )
- {
- SelectOneObject(pObj);
- }
+ if (obj == nullptr)
+ obj = SearchHuman();
+
+ if (obj != nullptr)
+ SelectOneObject(obj);
else
- {
- m_camera->SetType(CAMERA_FREE);
- }
+ m_camera->SetType(Gfx::CAM_TYPE_FREE);
m_short->UpdateShortcuts();
return true;
}
-// Quickly removes all objects.
-
+//! Quickly removes all objects
void CRobotMain::DeleteAllObjects()
{
- CPyro* pyro;
- CObject* pObj;
- int i;
-
// Removes all pyrotechnic effects in progress.
- while ( true )
+ while (true)
{
- pyro = (CPyro*)m_iMan->SearchInstance(CLASS_PYRO, 0);
- if ( pyro == 0 ) break;
+ Gfx::CPyro* pyro = static_cast<Gfx::CPyro*>(m_iMan->SearchInstance(CLASS_PYRO, 0));
+ if (pyro == nullptr) break;
pyro->DeleteObject();
delete pyro;
}
// Removes the arrow.
- if ( m_visitArrow != 0 )
+ if (m_visitArrow != nullptr)
{
m_visitArrow->DeleteObject();
delete m_visitArrow;
- m_visitArrow = 0;
+ m_visitArrow = nullptr;
}
- for ( i=0 ; i<MAXSHOWLIMIT ; i++ )
- {
+ for (int i = 0; i < MAXSHOWLIMIT; i++)
FlushShowLimit(i);
- }
- while ( true )
+ while (true)
{
- pObj = (CObject*)m_iMan->SearchInstance(CLASS_OBJECT, 0);
- if ( pObj == 0 ) break;
+ CObject* obj = static_cast<CObject*>(m_iMan->SearchInstance(CLASS_OBJECT, 0));
+ if (obj == nullptr) break;
- pObj->DeleteObject(true); // destroys rapidly
- delete pObj;
+ obj->DeleteObject(true); // destroys rapidly
+ delete obj;
}
}
-// Selects the human.
-
+//! Selects the human
void CRobotMain::SelectHuman()
{
SelectObject(SearchHuman());
}
-// Returns the object human.
-
+//! Returns the object human
CObject* CRobotMain::SearchHuman()
{
- ObjectType type;
- CObject* pObj;
- int i;
-
- for ( i=0 ; i<1000000 ; i++ )
+ for (int i = 0; i < 1000000; i++)
{
- pObj = (CObject*)m_iMan->SearchInstance(CLASS_OBJECT, i);
- if ( pObj == 0 ) break;
+ CObject* obj = static_cast<CObject*>(m_iMan->SearchInstance(CLASS_OBJECT, i));
+ if (obj == 0) break;
- type = pObj->RetType();
- if ( type == OBJECT_HUMAN )
- {
- return pObj;
- }
+ ObjectType type = obj->GetType();
+ if (type == OBJECT_HUMAN)
+ return obj;
}
return 0;
}
-// Returns the object toto.
-
+//! Returns the object toto
CObject* CRobotMain::SearchToto()
{
- ObjectType type;
- CObject* pObj;
- int i;
-
- for ( i=0 ; i<1000000 ; i++ )
+ for (int i = 0; i < 1000000; i++)
{
- pObj = (CObject*)m_iMan->SearchInstance(CLASS_OBJECT, i);
- if ( pObj == 0 ) break;
+ CObject* obj = static_cast<CObject*>(m_iMan->SearchInstance(CLASS_OBJECT, i));
+ if (obj == nullptr) break;
- type = pObj->RetType();
- if ( type == OBJECT_TOTO )
- {
- return pObj;
- }
+ ObjectType type = obj->GetType();
+ if (type == OBJECT_TOTO)
+ return obj;
}
- return 0;
+ return nullptr;
}
-// Returns the nearest selectable object from a given position.
-
-CObject* CRobotMain::SearchNearest(Math::Vector pos, CObject* pExclu)
+//! Returns the nearest selectable object from a given position
+CObject* CRobotMain::SearchNearest(Math::Vector pos, CObject* exclu)
{
- ObjectType type;
- CObject *pObj, *pBest;
- Math::Vector oPos;
- float min, dist;
- int i;
-
- min = 100000.0f;
- pBest = 0;
- for ( i=0 ; i<1000000 ; i++ )
+ float min = 100000.0f;
+ CObject* best = 0;
+ for (int i = 0; i < 1000000; i++)
{
- pObj = (CObject*)m_iMan->SearchInstance(CLASS_OBJECT, i);
- if ( pObj == 0 ) break;
+ CObject* obj = static_cast<CObject*>(m_iMan->SearchInstance(CLASS_OBJECT, i));
+ if (obj == nullptr) break;
- if ( pObj == pExclu ) continue;
- if ( !IsSelectable(pObj) ) continue;
+ if (obj == exclu) continue;
+ if (!IsSelectable(obj)) continue;
- type = pObj->RetType();
- if ( type == OBJECT_TOTO ) continue;
+ ObjectType type = obj->GetType();
+ if (type == OBJECT_TOTO) continue;
- oPos = pObj->RetPosition(0);
- dist = Math::DistanceProjected(oPos, pos);
- if ( dist < min )
+ Math::Vector oPos = obj->GetPosition(0);
+ float dist = Math::DistanceProjected(oPos, pos);
+ if (dist < min)
{
min = dist;
- pBest = pObj;
+ best = obj;
}
}
- return pBest;
+ return best;
}
-// Returns the selected object.
-
-CObject* CRobotMain::RetSelect()
+//! Returns the selected object
+CObject* CRobotMain::GetSelect()
{
- CObject* pObj;
- int i;
-
- for ( i=0 ; i<1000000 ; i++ )
+ for (int i = 0; i < 1000000; i++)
{
- pObj = (CObject*)m_iMan->SearchInstance(CLASS_OBJECT, i);
- if ( pObj == 0 ) break;
+ CObject* obj = static_cast<CObject*>(m_iMan->SearchInstance(CLASS_OBJECT, i));
+ if (obj == nullptr) break;
- if ( pObj->RetSelect() )
- {
- return pObj;
- }
+ if (obj->GetSelect())
+ return obj;
}
- return 0;
+ return nullptr;
}
CObject* CRobotMain::SearchObject(ObjectType type)
{
- CObject* pObj;
- int i;
-
- for ( i=0 ; i<1000000 ; i++ )
+ for (int i = 0; i < 1000000; i++)
{
- pObj = (CObject*)m_iMan->SearchInstance(CLASS_OBJECT, i);
- if ( pObj == 0 ) break;
+ CObject* obj = static_cast<CObject*>(m_iMan->SearchInstance(CLASS_OBJECT, i));
+ if (obj == nullptr) break;
- if ( pObj->RetType() == type )
- {
- return pObj;
- }
+ if (obj->GetType() == type)
+ return obj;
}
- return 0;
+ return nullptr;
}
-// Detects the object aimed by the mouse.
-
+//! Detects the object aimed by the mouse
CObject* CRobotMain::DetectObject(Math::Point pos)
{
- ObjectType type;
- CObject *pObj, *pTarget;
- int objRank, i, j, rank;
-
- objRank = m_engine->DetectObject(pos);
+ int objRank = m_engine->DetectObject(pos);
- for ( i=0 ; i<1000000 ; i++ )
+ for (int i = 0; i < 1000000; i++)
{
- pObj = (CObject*)m_iMan->SearchInstance(CLASS_OBJECT, i);
- if ( pObj == 0 ) break;
+ CObject* obj = static_cast<CObject*>(m_iMan->SearchInstance(CLASS_OBJECT, i));
+ if (obj == nullptr) break;
- if ( !pObj->RetActif() ) continue;
- if ( pObj->RetProxyActivate() ) continue;
+ if (!obj->GetActif()) continue;
+ if (obj->GetProxyActivate()) continue;
- pTarget = 0;
- type = pObj->RetType();
+ CObject* target = nullptr;
+ ObjectType type = obj->GetType();
if ( type == OBJECT_PORTICO ||
type == OBJECT_BASE ||
type == OBJECT_DERRICK ||
@@ -2896,40 +2716,37 @@ CObject* CRobotMain::DetectObject(Math::Point pos)
type == OBJECT_APOLLO4 ||
type == OBJECT_APOLLO5 )
{
- pTarget = pObj;
+ target = obj;
}
- else if ( (type == OBJECT_POWER ||
- type == OBJECT_ATOMIC ) &&
- pObj->RetTruck() != 0 ) // battery used?
+ else if ((type == OBJECT_POWER ||
+ type == OBJECT_ATOMIC) &&
+ obj->GetTruck() != nullptr) // battery used?
{
- pTarget = pObj->RetTruck();
+ target = obj->GetTruck();
}
- else if ( type == OBJECT_POWER ||
- type == OBJECT_ATOMIC )
+ else if (type == OBJECT_POWER ||
+ type == OBJECT_ATOMIC)
{
- pTarget = pObj;
+ target = obj;
}
- for ( j=0 ; j<OBJECTMAXPART ; j++ )
+ for (int j = 0; j < OBJECTMAXPART; j++)
{
- rank = pObj->RetObjectRank(j);
- if ( rank == -1 ) continue;
- if ( rank != objRank ) continue;
- return pTarget;
+ int rank = obj->GetObjectRank(j);
+ if (rank == -1) continue;
+ if (rank != objRank) continue;
+ return target;
}
}
return 0;
}
-// Indicates whether an object is selectable.
-
-bool CRobotMain::IsSelectable(CObject* pObj)
+//! Indicates whether an object is selectable
+bool CRobotMain::IsSelectable(CObject* obj)
{
- ObjectType type;
-
- if ( !pObj->RetSelectable() ) return false;
+ if (!obj->GetSelectable()) return false;
- type = pObj->RetType();
+ ObjectType type = obj->GetType();
if ( type == OBJECT_HUMAN ||
type == OBJECT_TOTO ||
type == OBJECT_MOBILEfa ||
@@ -2980,7 +2797,7 @@ bool CRobotMain::IsSelectable(CObject* pObj)
return true;
}
- if ( m_bSelectInsect )
+ if (m_selectInsect)
{
if ( type == OBJECT_MOTHER ||
type == OBJECT_ANT ||
@@ -2997,151 +2814,138 @@ bool CRobotMain::IsSelectable(CObject* pObj)
}
-// Deletes the selected object.
-
+//! Deletes the selected object
bool CRobotMain::DeleteObject()
{
- CObject* pObj;
- CPyro* pyro;
-
- pObj = RetSelect();
- if ( pObj == 0 ) return false;
+ CObject* obj = GetSelect();
+ if (obj == nullptr) return false;
- pyro = new CPyro(m_iMan);
- pyro->Create(PT_FRAGT, pObj);
+ Gfx::CPyro* pyro = new Gfx::CPyro(m_iMan);
+ pyro->Create(Gfx::PT_FRAGT, obj);
- pObj->SetSelect(false); // deselects the object
- m_camera->SetType(CAMERA_EXPLO);
+ obj->SetSelect(false); // deselects the object
+ m_camera->SetType(Gfx::CAM_TYPE_EXPLO);
DeselectAll();
- pObj->DeleteDeselList(pObj);
+ obj->DeleteDeselList(obj);
return true;
}
-// Removes setting evidence of the object with the mouse hovers over.
-
+//! Removes setting evidence of the object with the mouse hovers over
void CRobotMain::HiliteClear()
{
- CObject* pObj;
- int i;
-
ClearTooltip();
m_tooltipName[0] = 0; // really removes the tooltip
- if ( !m_bHilite ) return;
+ if (!m_hilite) return;
- i = -1;
- m_engine->SetHiliteRank(&i); // nothing more selected
+ int rank = -1;
+ m_engine->SetHighlightRank(&rank); // nothing more selected
- for ( i=0 ; i<1000000 ; i++ )
+ for (int i = 0; i < 1000000; i++)
{
- pObj = (CObject*)m_iMan->SearchInstance(CLASS_OBJECT, i);
- if ( pObj == 0 ) break;
+ CObject* obj = static_cast<CObject*>(m_iMan->SearchInstance(CLASS_OBJECT, i));
+ if (obj == nullptr) break;
- pObj->SetHilite(false);
- m_map->SetHilite(0);
- m_short->SetHilite(0);
+ obj->SetHilite(false);
+ m_map->SetHighlight(0);
+ m_short->SetHighlight(0);
}
- m_bHilite = false;
+ m_hilite = false;
}
-// Highlights the object with the mouse hovers over.
-
+//! Highlights the object with the mouse hovers over
void CRobotMain::HiliteObject(Math::Point pos)
{
- CObject* pObj;
- char name[100];
- bool bInMap;
-
- if ( m_bFixScene && m_phase != PHASE_PERSO ) return;
- if ( m_bMovieLock ) return;
- if ( m_movie->IsExist() ) return;
- if ( m_engine->RetMouseHide() ) return;
+ if (m_fixScene && m_phase != PHASE_PERSO) return;
+ if (m_movieLock) return;
+ if (m_movie->IsExist()) return;
+ if (!m_engine->GetMouseVisible()) return;
ClearInterface(); // removes setting evidence and tooltip
- pObj = m_short->DetectShort(pos);
+ CObject* obj = m_short->DetectShort(pos);
- if ( m_dialog->RetTooltip() && m_interface->GetTooltip(pos, name) )
+ std::string nameStr;
+ if (m_dialog->GetTooltip() && m_interface->GetTooltip(pos, nameStr))
{
m_tooltipPos = pos;
- strcpy(m_tooltipName, name);
+ strcpy(m_tooltipName, nameStr.c_str());
m_tooltipTime = 0.0f;
- if ( pObj == 0 ) return;
+ if (obj == nullptr) return;
}
- if ( m_bSuspend ) return;
+ if (m_suspend) return;
- if ( pObj == 0 )
+ if (obj == nullptr)
{
- pObj = m_map->DetectMap(pos, bInMap);
- if ( pObj == 0 )
+ bool inMap = false;
+ obj = m_map->DetectMap(pos, inMap);
+ if (obj == nullptr)
{
- if ( bInMap ) return;
+ if (inMap) return;
- pObj = DetectObject(pos);
+ obj = DetectObject(pos);
- if ( m_camera->RetType() == CAMERA_ONBOARD &&
- m_camera->RetObject() == pObj )
- {
+ if ((m_camera->GetType() == Gfx::CAM_TYPE_ONBOARD) &&
+ (m_camera->GetControllingObject() == obj))
return;
- }
}
}
- if ( pObj != 0 )
+ char name[100];
+ if (obj != nullptr)
{
- if ( m_dialog->RetTooltip() && pObj->GetTooltipName(name) )
+ if (m_dialog->GetTooltip() && obj->GetTooltipName(name))
{
m_tooltipPos = pos;
strcpy(m_tooltipName, name);
m_tooltipTime = 0.0f;
}
- if ( IsSelectable(pObj) )
+ if (IsSelectable(obj))
{
- pObj->SetHilite(true);
- m_map->SetHilite(pObj);
- m_short->SetHilite(pObj);
- m_bHilite = true;
+ obj->SetHilite(true);
+ m_map->SetHighlight(obj);
+ m_short->SetHighlight(obj);
+ m_hilite = true;
}
}
}
-// Highlights the object with the mouse hovers over.
-
+//! Highlights the object with the mouse hovers over
void CRobotMain::HiliteFrame(float rTime)
{
- if ( m_bFixScene && m_phase != PHASE_PERSO ) return;
- if ( m_bMovieLock ) return;
- if ( m_movie->IsExist() ) return;
+ if (m_fixScene && m_phase != PHASE_PERSO) return;
+ if (m_movieLock) return;
+ if (m_movie->IsExist()) return;
m_tooltipTime += rTime;
ClearTooltip();
- if ( m_tooltipTime >= 0.2f &&
- m_tooltipName[0] != 0 )
+ if (m_tooltipTime >= 0.2f &&
+ m_tooltipName[0] != 0)
{
CreateTooltip(m_tooltipPos, m_tooltipName);
}
}
-// Creates a tooltip.
-
-void CRobotMain::CreateTooltip(Math::Point pos, char* text)
+//! Creates a tooltip
+void CRobotMain::CreateTooltip(Math::Point pos, const char* text)
{
- CWindow* pw;
- Math::Point start, end, dim, offset, corner;
-
+ Math::Point corner;
corner.x = pos.x+0.022f;
corner.y = pos.y-0.052f;
- m_engine->RetText()->DimText(text, corner, 1,
- SMALLFONT, NORMSTRETCH, FONT_COLOBOT,
- start, end);
+ Math::Point start, end;
+
+ m_engine->GetText()->SizeText(text, Gfx::FONT_COLOBOT, Gfx::FONT_SIZE_SMALL,
+ corner, Gfx::TEXT_ALIGN_LEFT,
+ start, end);
+
start.x -= 0.010f;
start.y -= 0.002f;
end.x += 0.010f;
@@ -3149,13 +2953,16 @@ void CRobotMain::CreateTooltip(Math::Point pos, char* text)
pos.x = start.x;
pos.y = start.y;
+
+ Math::Point dim;
dim.x = end.x-start.x;
dim.y = end.y-start.y;
+ Math::Point offset;
offset.x = 0.0f;
offset.y = 0.0f;
- if ( pos.x+dim.x > 1.0f ) offset.x = 1.0f-(pos.x+dim.x);
- if ( pos.y < 0.0f ) offset.y = -pos.y;
+ if (pos.x+dim.x > 1.0f) offset.x = 1.0f-(pos.x+dim.x);
+ if (pos.y < 0.0f) offset.y = -pos.y;
corner.x += offset.x;
corner.y += offset.y;
@@ -3164,62 +2971,51 @@ void CRobotMain::CreateTooltip(Math::Point pos, char* text)
m_interface->CreateWindows(pos, dim, 1, EVENT_TOOLTIP);
- pw = (CWindow*)m_interface->SearchControl(EVENT_TOOLTIP);
- if ( pw != 0 )
+ Ui::CWindow* pw = dynamic_cast<Ui::CWindow*>(m_interface->SearchControl(EVENT_TOOLTIP));
+ if (pw != nullptr)
{
- pw->SetState(STATE_SHADOW);
+ pw->SetState(Ui::STATE_SHADOW);
pw->SetTrashEvent(false);
- pos.y -= m_engine->RetText()->RetHeight(SMALLFONT, FONT_COLOBOT)/2.0f;
+ pos.y -= m_engine->GetText()->GetHeight(Gfx::FONT_COLOBOT, Gfx::FONT_SIZE_SMALL) / 2.0f;
pw->CreateLabel(pos, dim, -1, EVENT_LABEL2, text);
}
}
-// Clears the previous tooltip.
-
+//! Clears the previous tooltip
void CRobotMain::ClearTooltip()
{
m_interface->DeleteControl(EVENT_TOOLTIP);
}
-// Displays help for an object.
-
+//! Displays help for an object
void CRobotMain::HelpObject()
{
- CObject* pObj;
- char* filename;
+ CObject* obj = GetSelect();
+ if (obj == nullptr) return;
- pObj = RetSelect();
- if ( pObj == 0 ) return;
-
- filename = RetHelpFilename(pObj->RetType());
- if ( filename[0] == 0 ) return;
+ const char* filename = GetHelpFilename(obj->GetType());
+ if (filename[0] == 0) return;
StartDisplayInfo(filename, -1);
}
-// Change the mode of the camera.
-
+//! Change the mode of the camera
void CRobotMain::ChangeCamera()
{
- CObject* pObj;
- ObjectType oType;
- CameraType type;
- int i;
-
- for ( i=0 ; i<1000000 ; i++ )
+ for (int i = 0; i < 1000000; i++)
{
- pObj = (CObject*)m_iMan->SearchInstance(CLASS_OBJECT, i);
- if ( pObj == 0 ) break;
+ CObject* obj = static_cast<CObject*>(m_iMan->SearchInstance(CLASS_OBJECT, i));
+ if (obj == nullptr) break;
- if ( pObj->RetSelect() )
+ if (obj->GetSelect())
{
- if ( pObj->RetCameraLock() ) return;
+ if (obj->GetCameraLock()) return;
- oType = pObj->RetType();
- type = pObj->RetCameraType();
+ ObjectType oType = obj->GetType();
+ Gfx::CameraType type = obj->GetCameraType();
if ( oType != OBJECT_MOBILEfa &&
oType != OBJECT_MOBILEta &&
@@ -3250,115 +3046,111 @@ void CRobotMain::ChangeCamera()
oType != OBJECT_MOBILEdr &&
oType != OBJECT_APOLLO2 ) return;
- if ( oType == OBJECT_MOBILEdr ) // designer?
+ if (oType == OBJECT_MOBILEdr) // designer?
{
- if ( type == CAMERA_PLANE ) type = CAMERA_BACK;
- else if ( type == CAMERA_BACK ) type = CAMERA_PLANE;
+ if (type == Gfx::CAM_TYPE_PLANE ) type = Gfx::CAM_TYPE_BACK;
+ else if (type == Gfx::CAM_TYPE_BACK ) type = Gfx::CAM_TYPE_PLANE;
}
- else if ( pObj->RetTrainer() ) // trainer?
+ else if (obj->GetTrainer()) // trainer?
{
- if ( type == CAMERA_ONBOARD ) type = CAMERA_FIX;
- else if ( type == CAMERA_FIX ) type = CAMERA_PLANE;
- else if ( type == CAMERA_PLANE ) type = CAMERA_BACK;
- else if ( type == CAMERA_BACK ) type = CAMERA_ONBOARD;
+ if (type == Gfx::CAM_TYPE_ONBOARD) type = Gfx::CAM_TYPE_FIX;
+ else if (type == Gfx::CAM_TYPE_FIX ) type = Gfx::CAM_TYPE_PLANE;
+ else if (type == Gfx::CAM_TYPE_PLANE ) type = Gfx::CAM_TYPE_BACK;
+ else if (type == Gfx::CAM_TYPE_BACK ) type = Gfx::CAM_TYPE_ONBOARD;
}
else
{
- if ( type == CAMERA_ONBOARD ) type = CAMERA_BACK;
- else if ( type == CAMERA_BACK ) type = CAMERA_ONBOARD;
+ if (type == Gfx::CAM_TYPE_ONBOARD) type = Gfx::CAM_TYPE_BACK;
+ else if (type == Gfx::CAM_TYPE_BACK ) type = Gfx::CAM_TYPE_ONBOARD;
}
- pObj->SetCameraType(type);
+ obj->SetCameraType(type);
m_camera->SetType(type);
}
}
}
-// Remote control the camera using the arrow keys.
-
-void CRobotMain::KeyCamera(EventMsg event, long param)
+//! Remote control the camera using the arrow keys
+void CRobotMain::KeyCamera(EventType type, unsigned int key)
{
- CObject* pObj;
+ // TODO: rewrite key handling to input bindings
- if ( event == EVENT_KEYUP )
+ if (type == EVENT_KEY_UP)
{
- if ( param == m_engine->RetKey(KEYRANK_LEFT, 0) ||
- param == m_engine->RetKey(KEYRANK_LEFT, 1) )
+ if (key == GetInputBinding(INPUT_SLOT_LEFT).key ||
+ key == GetInputBinding(INPUT_SLOT_LEFT).joy)
{
m_cameraPan = 0.0f;
}
- if ( param == m_engine->RetKey(KEYRANK_RIGHT, 0) ||
- param == m_engine->RetKey(KEYRANK_RIGHT, 1) )
+ if (key == GetInputBinding(INPUT_SLOT_RIGHT).key ||
+ key == GetInputBinding(INPUT_SLOT_RIGHT).joy)
{
m_cameraPan = 0.0f;
}
- if ( param == m_engine->RetKey(KEYRANK_UP, 0) ||
- param == m_engine->RetKey(KEYRANK_UP, 1) )
+ if (key == GetInputBinding(INPUT_SLOT_UP).key ||
+ key == GetInputBinding(INPUT_SLOT_UP).joy)
{
m_cameraZoom = 0.0f;
}
- if ( param == m_engine->RetKey(KEYRANK_DOWN, 0) ||
- param == m_engine->RetKey(KEYRANK_DOWN, 1) )
+ if (key == GetInputBinding(INPUT_SLOT_DOWN).key ||
+ key == GetInputBinding(INPUT_SLOT_DOWN).joy)
{
m_cameraZoom = 0.0f;
}
}
- if ( m_phase != PHASE_SIMUL ) return;
- if ( m_bEditLock ) return; // current edition?
- if ( m_bTrainerPilot ) return;
+ if (m_phase != PHASE_SIMUL) return;
+ if (m_editLock) return; // current edition?
+ if (m_trainerPilot) return;
- pObj = RetSelect();
- if ( pObj == 0 ) return;
- if ( !pObj->RetTrainer() ) return;
+ CObject* obj = GetSelect();
+ if (obj == nullptr) return;
+ if (!obj->GetTrainer()) return;
- if ( event == EVENT_KEYDOWN )
+ if (type == EVENT_KEY_DOWN)
{
- if ( param == m_engine->RetKey(KEYRANK_LEFT, 0) ||
- param == m_engine->RetKey(KEYRANK_LEFT, 1) )
+ if (key == GetInputBinding(INPUT_SLOT_LEFT).key ||
+ key == GetInputBinding(INPUT_SLOT_LEFT).joy)
{
m_cameraPan = -1.0f;
}
- if ( param == m_engine->RetKey(KEYRANK_RIGHT, 0) ||
- param == m_engine->RetKey(KEYRANK_RIGHT, 1) )
+ if (key == GetInputBinding(INPUT_SLOT_RIGHT).key ||
+ key == GetInputBinding(INPUT_SLOT_RIGHT).joy)
{
m_cameraPan = 1.0f;
}
- if ( param == m_engine->RetKey(KEYRANK_UP, 0) ||
- param == m_engine->RetKey(KEYRANK_UP, 1) )
+ if (key == GetInputBinding(INPUT_SLOT_UP).key ||
+ key == GetInputBinding(INPUT_SLOT_UP).joy)
{
m_cameraZoom = -1.0f;
}
- if ( param == m_engine->RetKey(KEYRANK_DOWN, 0) ||
- param == m_engine->RetKey(KEYRANK_DOWN, 1) )
+ if (key == GetInputBinding(INPUT_SLOT_DOWN).key ||
+ key == GetInputBinding(INPUT_SLOT_DOWN).joy)
{
m_cameraZoom = 1.0f;
}
}
}
-// Panned with the camera if a button is pressed.
-
+//! Panned with the camera if a button is pressed
void CRobotMain::RemoteCamera(float pan, float zoom, float rTime)
{
- float value;
-
- if ( pan != 0.0f )
+ if (pan != 0.0f)
{
- value = m_camera->RetRemotePan();
+ float value = m_camera->GetRemotePan();
value += pan*rTime*1.5f;
m_camera->SetRemotePan(value);
}
- if ( zoom != 0.0f )
+ if (zoom != 0.0f)
{
- value = m_camera->RetRemoteZoom();
+ float value = m_camera->GetRemoteZoom();
value += zoom*rTime*0.3f;
m_camera->SetRemoteZoom(value);
}
@@ -3366,199 +3158,155 @@ void CRobotMain::RemoteCamera(float pan, float zoom, float rTime)
-// Cancels the current movie.
-
+//! Cancels the current movie
void CRobotMain::AbortMovie()
{
- CObject* pObj;
- CAuto* automat;
- int i;
-
- for ( i=0 ; i<1000000 ; i++ )
+ for (int i = 0; i < 1000000; i++)
{
- pObj = (CObject*)m_iMan->SearchInstance(CLASS_OBJECT, i);
- if ( pObj == 0 ) break;
+ CObject* obj = static_cast<CObject*>(m_iMan->SearchInstance(CLASS_OBJECT, i));
+ if (obj == nullptr) break;
- automat = pObj->RetAuto();
- if ( automat != 0 )
- {
+ CAuto* automat = obj->GetAuto();
+ if (automat != 0)
automat->Abort();
- }
}
- m_engine->SetMouseHide(false);
+ m_engine->SetMouseVisible(true);
}
-// Updates the text information.
-
+//! Updates the text information
void CRobotMain::UpdateInfoText()
{
- CObject* pObj;
- Math::Vector pos;
- char info[100];
-
- if ( m_bShowPos )
+ if (m_showPos)
{
- pObj = RetSelect();
- if ( pObj != 0 )
+ CObject* obj = GetSelect();
+ if (obj != nullptr)
{
- pos = pObj->RetPosition(0);
+ Math::Vector pos = obj->GetPosition(0);
+ char info[100];
sprintf(info, "Pos = %.2f ; %.2f", pos.x/g_unit, pos.z/g_unit);
- m_engine->SetInfoText(4, info);
+ //TODO: m_engine->SetInfoText(4, info);
}
}
}
-// Initializes the view.
-
+//! Initializes the view
void CRobotMain::InitEye()
{
- if ( m_phase == PHASE_SIMUL )
- {
+ if (m_phase == PHASE_SIMUL)
m_camera->Init(Math::Vector( 0.0f, 10.0f, 0.0f),
Math::Vector(10.0f, 5.0f, 0.0f), 0.0f);
- }
-
- if ( m_phase == PHASE_MODEL )
- {
- m_model->InitView();
- }
}
-// Advances the entire scene.
-
+//! Advances the entire scene
bool CRobotMain::EventFrame(const Event &event)
{
- ObjectType type;
- CObject *pObj, *toto;
- CPyro* pPyro;
- CWindow* pw;
- CMap* pm;
- int i;
-
m_time += event.rTime;
- if ( !m_bMovieLock ) m_gameTime += event.rTime;
+ if (!m_movieLock) m_gameTime += event.rTime;
- if ( !m_bImmediatSatCom && !m_bBeginSatCom &&
- m_gameTime > 0.1f && m_phase == PHASE_SIMUL )
+ if (!m_immediatSatCom && !m_beginSatCom &&
+ m_gameTime > 0.1f && m_phase == PHASE_SIMUL)
{
m_displayText->DisplayError(INFO_BEGINSATCOM, Math::Vector(0.0f,0.0f,0.0f));
- m_bBeginSatCom = true; // message appears
+ m_beginSatCom = true; // message appears
}
m_water->EventProcess(event);
m_cloud->EventProcess(event);
- m_blitz->EventProcess(event);
+ m_lightning->EventProcess(event);
m_planet->EventProcess(event);
- pw = (CWindow*)m_interface->SearchControl(EVENT_WINDOW1);
- if ( pw == 0 )
+ Ui::CMap* pm = nullptr;
+ Ui::CWindow* pw = dynamic_cast<Ui::CWindow*>(m_interface->SearchControl(EVENT_WINDOW1));
+ if (pw == nullptr)
{
- pm = 0;
+ pm = nullptr;
}
else
{
- pm = (CMap*)pw->SearchControl(EVENT_OBJECT_MAP);
- if ( pm != 0 ) pm->FlushObject();
+ pm = dynamic_cast<Ui::CMap*>(pw->SearchControl(EVENT_OBJECT_MAP));
+ if (pm != nullptr) pm->FlushObject();
}
- toto = 0;
- if ( !m_bFreePhoto )
+ CObject* toto = nullptr;
+ if (!m_freePhoto)
{
// Advances all the robots, but not toto.
- for ( i=0 ; i<1000000 ; i++ )
- {
- 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 ( type == OBJECT_TOTO )
- {
- toto = pObj;
- }
+ for (int i = 0; i < 1000000; i++)
+ {
+ CObject* obj = static_cast<CObject*>(m_iMan->SearchInstance(CLASS_OBJECT, i));
+ if (obj == nullptr) break;
+ if (pm != nullptr) pm->UpdateObject(obj);
+ if (obj->GetTruck() != nullptr) continue;
+ ObjectType type = obj->GetType();
+ if (type == OBJECT_TOTO)
+ toto = obj;
else
- {
- pObj->EventProcess(event);
- }
+ obj->EventProcess(event);
}
// Advances all objects transported by robots.
- for ( i=0 ; i<1000000 ; i++ )
+ for (int i = 0; i < 1000000; i++)
{
- pObj = (CObject*)m_iMan->SearchInstance(CLASS_OBJECT, i);
- if ( pObj == 0 ) break;
- if ( pObj->RetTruck() == 0 ) continue;
- pObj->EventProcess(event);
+ CObject* obj = static_cast<CObject*>(m_iMan->SearchInstance(CLASS_OBJECT, i));
+ if (obj == nullptr) break;
+ if (obj->GetTruck() == nullptr) continue;
+ obj->EventProcess(event);
}
// Advances pyrotechnic effects.
- for ( i=0 ; i<1000000 ; i++ )
+ for (int i = 0; i < 1000000; i++)
{
- pPyro = (CPyro*)m_iMan->SearchInstance(CLASS_PYRO, i);
- if ( pPyro == 0 ) break;
+ Gfx::CPyro* pyro = static_cast<Gfx::CPyro*>(m_iMan->SearchInstance(CLASS_PYRO, i));
+ if (pyro == nullptr) break;
- pPyro->EventProcess(event);
- if ( pPyro->IsEnded() != ERR_CONTINUE )
+ pyro->EventProcess(event);
+ if (pyro->IsEnded() != ERR_CONTINUE)
{
- pPyro->DeleteObject();
- delete pPyro;
+ pyro->DeleteObject();
+ delete pyro;
}
}
}
// The camera follows the object, because its position
- // may depend on the selected object (CAMERA_ONBOARD or CAMERA_BACK).
- if ( m_phase == PHASE_SIMUL && !m_bEditFull )
+ // may depend on the selected object (Gfx::CAM_TYPE_ONBOARD or Gfx::CAM_TYPE_BACK).
+ if (m_phase == PHASE_SIMUL && !m_editFull)
{
m_camera->EventProcess(event);
- if ( m_engine->RetFog() )
- {
- m_camera->SetOverBaseColor(m_particule->RetFogColor(m_engine->RetEyePt()));
- }
+ if (m_engine->GetFog())
+ m_camera->SetOverBaseColor(m_particle->GetFogColor(m_engine->GetEyePt()));
}
- if ( m_phase == PHASE_PERSO ||
- m_phase == PHASE_WIN ||
- m_phase == PHASE_LOST )
+ if (m_phase == PHASE_PERSO ||
+ m_phase == PHASE_WIN ||
+ m_phase == PHASE_LOST)
{
m_camera->EventProcess(event);
}
// Advances toto following the camera, because its position depends on the camera.
- if ( toto != 0 )
- {
+ if (toto != nullptr)
toto->EventProcess(event);
- }
-
- // Advances model.
- if ( m_phase == PHASE_MODEL )
- {
- m_model->ViewMove(event, 2.0f);
- m_model->UpdateView();
- m_model->EventProcess(event);
- }
HiliteFrame(event.rTime);
// Moves the film indicator.
- if ( m_bMovieLock && !m_bEditLock ) // movie in progress?
+ if (m_movieLock && !m_editLock) // movie in progress?
{
- CControl* pc;
- Math::Point pos, dim;
- float zoom;
-
- pc = m_interface->SearchControl(EVENT_OBJECT_MOVIELOCK);
- if ( pc != 0 )
+ Ui::CControl* pc = m_interface->SearchControl(EVENT_OBJECT_MOVIELOCK);
+ if (pc != nullptr)
{
+ Math::Point pos, dim;
+
dim.x = 32.0f/640.0f;
dim.y = 32.0f/480.0f;
pos.x = 20.0f/640.0f;
pos.y = (480.0f-24.0f)/480.0f;
- zoom = 1.0f+sinf(m_time*6.0f)*0.1f; // 0.9 .. 1.1
+ float zoom = 1.0f+sinf(m_time*6.0f)*0.1f; // 0.9 .. 1.1
dim.x *= zoom;
dim.y *= zoom;
pos.x -= dim.x/2.0f;
@@ -3570,16 +3318,14 @@ bool CRobotMain::EventFrame(const Event &event)
}
// Moves edition indicator.
- if ( m_bEditLock || m_bPause ) // edition in progress?
+ if (m_editLock || m_pause) // edition in progress?
{
- CControl* pc;
- Math::Point pos, dim;
- float zoom;
-
- pc = m_interface->SearchControl(EVENT_OBJECT_EDITLOCK);
- if ( pc != 0 )
+ Ui::CControl* pc = m_interface->SearchControl(EVENT_OBJECT_EDITLOCK);
+ if (pc != nullptr)
{
- if ( m_bEditFull || m_bEditLock )
+ Math::Point pos, dim;
+
+ if (m_editFull || m_editLock)
{
dim.x = 10.0f/640.0f;
dim.y = 10.0f/480.0f;
@@ -3593,7 +3339,7 @@ bool CRobotMain::EventFrame(const Event &event)
pos.x = 20.0f/640.0f;
pos.y = (480.0f-24.0f)/480.0f;
- zoom = 1.0f+sinf(m_time*6.0f)*0.1f; // 0.9 .. 1.1
+ float zoom = 1.0f+sinf(m_time*6.0f)*0.1f; // 0.9 .. 1.1
dim.x *= zoom;
dim.y *= zoom;
pos.x -= dim.x/2.0f;
@@ -3605,107 +3351,84 @@ bool CRobotMain::EventFrame(const Event &event)
}
// Will move the arrow to visit.
- if ( m_camera->RetType() == CAMERA_VISIT )
- {
+ if (m_camera->GetType() == Gfx::CAM_TYPE_VISIT)
FrameVisit(event.rTime);
- }
// Moves the boundaries.
FrameShowLimit(event.rTime);
- if ( m_phase == PHASE_SIMUL )
+ if (m_phase == PHASE_SIMUL)
{
- if ( !m_bEditLock && m_checkEndTime+1.0f < m_time )
+ if (!m_editLock && m_checkEndTime+1.0f < m_time)
{
m_checkEndTime = m_time;
CheckEndMission(true);
}
- if ( m_winDelay > 0.0f && !m_bEditLock )
+ if (m_winDelay > 0.0f && !m_editLock)
{
m_winDelay -= event.rTime;
- if ( m_winDelay <= 0.0f )
+ if (m_winDelay <= 0.0f)
{
- if ( m_bMovieLock )
- {
+ if (m_movieLock)
m_winDelay = 1.0f;
- }
else
- {
- Event newEvent;
- m_event->MakeEvent(newEvent, EVENT_WIN);
- m_event->AddEvent(newEvent);
- }
+ m_eventQueue->AddEvent(Event(EVENT_WIN));
}
}
- if ( m_lostDelay > 0.0f && !m_bEditLock )
+ if (m_lostDelay > 0.0f && !m_editLock)
{
m_lostDelay -= event.rTime;
- if ( m_lostDelay <= 0.0f )
+ if (m_lostDelay <= 0.0f)
{
- if ( m_bMovieLock )
- {
+ if (m_movieLock)
m_winDelay = 1.0f;
- }
else
- {
- Event newEvent;
- m_event->MakeEvent(newEvent, EVENT_LOST);
- m_event->AddEvent(newEvent);
- }
+ m_eventQueue->AddEvent(Event(EVENT_LOST));
}
}
}
- if ( m_delayWriteMessage > 0 )
+ if (m_delayWriteMessage > 0)
{
m_delayWriteMessage --;
- if ( m_delayWriteMessage == 0 )
+ if (m_delayWriteMessage == 0)
{
m_displayText->DisplayError(INFO_WRITEOK, Math::Vector(0.0f,0.0f,0.0f));
}
}
- return S_OK;
+ return true;
}
-// Makes the event for all robots.
-
+//! Makes the event for all robots
bool CRobotMain::EventObject(const Event &event)
{
- CObject* pObj;
- int i;
+ if (m_freePhoto) return true;
- if ( m_bFreePhoto ) return S_OK;
+ m_resetCreate = false;
- m_bResetCreate = false;
-
- for ( i=0 ; i<1000000 ; i++ )
+ for (int i = 0; i < 1000000; i++)
{
- pObj = (CObject*)m_iMan->SearchInstance(CLASS_OBJECT, i);
- if ( pObj == 0 ) break;
+ CObject* obj = static_cast<CObject*>(m_iMan->SearchInstance(CLASS_OBJECT, i));
+ if (obj == nullptr) break;
- pObj->EventProcess(event);
+ obj->EventProcess(event);
}
- if ( m_bResetCreate )
- {
+ if (m_resetCreate)
ResetCreate();
- }
- return S_OK;
+ return true;
}
-// Calculates the point of arrival of the camera.
-
+//! Calculates the point of arrival of the camera
Math::Vector CRobotMain::LookatPoint(Math::Vector eye, float angleH, float angleV,
float length)
{
- Math::Vector lookat;
-
- lookat = eye;
+ Math::Vector lookat = eye;
lookat.z += length;
RotatePoint(eye, angleH, angleV, lookat);
@@ -3716,49 +3439,42 @@ Math::Vector CRobotMain::LookatPoint(Math::Vector eye, float angleH, float angle
char* SkipNum(char *p)
{
- while ( *p == ' ' || *p == '.' || *p == '-' || (*p >= '0' && *p <= '9') )
+ while (*p == ' ' || *p == '.' || *p == '-' || (*p >= '0' && *p <= '9'))
{
p++;
}
return p;
}
-// Conversion of units.
-
+//! Conversion of units
void CRobotMain::Convert()
{
- FILE* file = NULL;
- FILE* fileNew = NULL;
- char line[500];
- char lineNew[500];
- char s[200];
- char* base;
- char* p;
- int rank;
- Math::Vector pos;
- float value;
+ char* base = m_dialog->GetSceneName();
+ int rank = m_dialog->GetSceneRank();
- base = m_dialog->RetSceneName();
- rank = m_dialog->RetSceneRank();
+ char line[500];
m_dialog->BuildSceneName(line, base, rank);
- file = fopen(line, "r");
- if ( file == NULL ) return;
+ FILE* file = fopen(line, "r");
+ if (file == NULL) return;
strcpy(line+strlen(line)-4, ".new");
- fileNew = fopen(line, "w");
- if ( fileNew == NULL ) return;
+ FILE* fileNew = fopen(line, "w");
+ if (fileNew == NULL) return;
+
+ char lineNew[500];
+ char s[200];
- while ( fgets(line, 500, file) != NULL )
+ while (fgets(line, 500, file) != NULL)
{
strcpy(lineNew, line);
- if ( Cmd(line, "DeepView") )
+ if (Cmd(line, "DeepView"))
{
- p = strstr(line, "air=");
- if ( p != 0 )
+ char* p = strstr(line, "air=");
+ if (p != 0)
{
- value = OpFloat(line, "air", 500.0f);
+ float value = OpFloat(line, "air", 500.0f);
value /= g_unit;
p[0] = 0;
p = SkipNum(p+4);
@@ -3772,9 +3488,9 @@ void CRobotMain::Convert()
strcpy(line, lineNew);
p = strstr(line, "water=");
- if ( p != 0 )
+ if (p != 0)
{
- value = OpFloat(line, "water", 100.0f);
+ float value = OpFloat(line, "water", 100.0f);
value /= g_unit;
p[0] = 0;
p = SkipNum(p+6);
@@ -3788,12 +3504,12 @@ void CRobotMain::Convert()
strcpy(line, lineNew);
}
- if ( Cmd(line, "TerrainGenerate") )
+ if (Cmd(line, "TerrainGenerate"))
{
- p = strstr(line, "vision=");
- if ( p != 0 )
+ char* p = strstr(line, "vision=");
+ if (p != 0)
{
- value = OpFloat(line, "vision", 500.0f);
+ float value = OpFloat(line, "vision", 500.0f);
value /= g_unit;
p[0] = 0;
p = SkipNum(p+7);
@@ -3806,13 +3522,13 @@ void CRobotMain::Convert()
}
}
- if ( Cmd(line, "CreateObject") ||
- Cmd(line, "CreateSpot") )
+ if (Cmd(line, "CreateObject") ||
+ Cmd(line, "CreateSpot"))
{
- p = strstr(line, "pos=");
- if ( p != 0 )
+ char* p = strstr(line, "pos=");
+ if (p != 0)
{
- pos = OpPos(line, "pos");
+ Math::Vector pos = OpPos(line, "pos");
pos.x /= g_unit;
pos.y /= g_unit;
pos.z /= g_unit;
@@ -3831,12 +3547,12 @@ void CRobotMain::Convert()
}
}
- if ( Cmd(line, "EndMissionTake") )
+ if (Cmd(line, "EndMissionTake"))
{
- p = strstr(line, "pos=");
- if ( p != 0 )
+ char* p = strstr(line, "pos=");
+ if (p != 0)
{
- pos = OpPos(line, "pos");
+ Math::Vector pos = OpPos(line, "pos");
pos.x /= g_unit;
pos.y /= g_unit;
pos.z /= g_unit;
@@ -3856,9 +3572,9 @@ void CRobotMain::Convert()
strcpy(line, lineNew);
p = strstr(line, "dist=");
- if ( p != 0 )
+ if (p != 0)
{
- value = OpFloat(line, "dist", 32.0f);
+ float value = OpFloat(line, "dist", 32.0f);
value /= g_unit;
p[0] = 0;
p = SkipNum(p+5);
@@ -3872,12 +3588,12 @@ void CRobotMain::Convert()
strcpy(line, lineNew);
}
- if ( Cmd(line, "Camera") )
+ if (Cmd(line, "Camera"))
{
- p = strstr(line, "pos=");
- if ( p != 0 )
+ char* p = strstr(line, "pos=");
+ if (p != 0)
{
- pos = OpPos(line, "pos");
+ Math::Vector pos = OpPos(line, "pos");
pos.x /= g_unit;
pos.y /= g_unit;
pos.z /= g_unit;
@@ -3897,9 +3613,9 @@ void CRobotMain::Convert()
strcpy(line, lineNew);
p = strstr(line, "h=");
- if ( p != 0 )
+ if (p != 0)
{
- value = OpFloat(line, "h", 32.0f);
+ float value = OpFloat(line, "h", 32.0f);
value /= g_unit;
p[0] = 0;
p = SkipNum(p+2);
@@ -3920,19 +3636,16 @@ void CRobotMain::Convert()
fclose(file);
}
-// Load the scene for the character.
-
+//! Load the scene for the character
void CRobotMain::ScenePerso()
{
- CObject* pObj;
-
DeleteAllObjects(); // removes all the current 3D Scene
m_engine->FlushObject();
m_terrain->FlushRelief(); // all flat
m_terrain->FlushBuildingLevel();
m_terrain->FlushFlyingLimit();
- m_light->FlushLight();
- m_particule->FlushParticule();
+ m_lightMan->FlushLights();
+ m_particle->FlushParticle();
m_iMan->Flush(CLASS_OBJECT);
m_iMan->Flush(CLASS_PHYSICS);
m_iMan->Flush(CLASS_BRAIN);
@@ -3944,66 +3657,44 @@ void CRobotMain::ScenePerso()
m_engine->SetDrawWorld(false); // does not draw anything on the interface
m_engine->SetDrawFront(true); // draws on the human interface
- pObj = SearchHuman();
- if ( pObj != 0 )
+ CObject* obj = SearchHuman();
+ if (obj != nullptr)
{
- CMotionHuman* mh;
+ obj->SetDrawFront(true); // draws the interface
- pObj->SetDrawFront(true); // draws the interface
-
- mh = (CMotionHuman*)pObj->RetMotion();
- if ( mh != 0 )
- {
+ CMotionHuman* mh = static_cast<CMotionHuman*>(obj->GetMotion());
+ if (mh != nullptr)
mh->StartDisplayPerso();
- }
}
}
-// Creates the whole stage.
-
-void CRobotMain::CreateScene(bool bSoluce, bool bFixScene, bool bResetObject)
+//! Creates the whole scene
+void CRobotMain::CreateScene(bool soluce, bool fixScene, bool resetObject)
{
- CObject* pObj;
- CObject* pSel;
- CMotion* motion;
- FILE* file = NULL;
- char line[500];
- char name[200];
- char dir[100];
- char op[100];
- char* read;
- char* stack;
- char* base;
- D3DCOLORVALUE color;
- Math::Vector pos;
- int rank, obj, i, rankObj, rankGadget;
-
-//? Convert();
-
- base = m_dialog->RetSceneName();
- rank = m_dialog->RetSceneRank();
- read = m_dialog->RetSceneRead();
- stack = m_dialog->RetStackRead();
+ char* base = m_dialog->GetSceneName();
+ int rank = m_dialog->GetSceneRank();
+ char* read = m_dialog->GetSceneRead();
+ char* stack = m_dialog->GetStackRead();
m_dialog->SetUserDir(base, rank);
- m_bFixScene = bFixScene;
+ m_fixScene = fixScene;
g_id = 0;
- m_bBase = false;
+ m_base = false;
- if ( !bResetObject )
+ if (!resetObject)
{
g_build = 0;
g_researchDone = 0; // no research done
g_researchEnable = 0;
FlushDisplayInfo();
- m_terrain->LevelFlush();
+ m_terrain->FlushMaterials();
m_audioTrack = 0;
- m_bAudioRepeat = true;
+ m_audioRepeat = true;
m_displayText->SetDelay(1.0f);
m_displayText->SetEnable(true);
- m_bImmediatSatCom = false;
+ m_immediatSatCom = false;
m_endingWinRank = 0;
m_endingLostRank = 0;
m_endTakeTotal = 0;
@@ -4012,8 +3703,8 @@ void CRobotMain::CreateScene(bool bSoluce, bool bFixScene, bool bResetObject)
m_endTakeLostDelay = 2.0f;
m_obligatoryTotal = 0;
m_prohibitedTotal = 0;
- m_bMapShow = true;
- m_bMapImage = false;
+ m_mapShow = true;
+ m_mapImage = false;
m_mapFilename[0] = 0;
m_colorRefBot.r = 10.0f/256.0f;
@@ -4046,159 +3737,144 @@ void CRobotMain::CreateScene(bool bSoluce, bool bFixScene, bool bResetObject)
m_scriptFile[0] = 0;
}
+ char line[500];
+ char name[200];
+ char dir[100];
+ char op[100];
+
m_dialog->BuildSceneName(line, base, rank);
- file = fopen(line, "r");
- if ( file == NULL ) return;
+ FILE* file = fopen(line, "r");
+ if (file == NULL) return;
- rankObj = 0;
- rankGadget = 0;
- pSel = 0;
+ int rankObj = 0;
+ int rankGadget = 0;
+ CObject* sel = 0;
- while ( fgets(line, 500, file) != NULL )
+ while (fgets(line, 500, file) != NULL)
{
- for ( i=0 ; i<500 ; i++ )
+ for (int i = 0; i < 500; i++)
{
- if ( line[i] == '\t' ) line[i] = ' '; // replace tab by space
- if ( line[i] == '/' && line[i+1] == '/' )
+ if (line[i] == '\t' ) line[i] = ' '; // replace tab by space
+ if (line[i] == '/' && line[i+1] == '/')
{
line[i] = 0;
break;
}
}
- sprintf(op, "Title.%c", RetLanguageLetter());
- if ( Cmd(line, op) && !bResetObject )
- {
+ // TODO: language letters
+ sprintf(op, "Title.%c", 'E' /*GetLanguageLetter()*/);
+ if (Cmd(line, op) && !resetObject)
OpString(line, "text", m_title);
- }
- sprintf(op, "Resume.%c", RetLanguageLetter());
- if ( Cmd(line, op) && !bResetObject )
- {
+ sprintf(op, "Resume.%c", 'E' /*GetLanguageLetter()*/);
+ if (Cmd(line, op) && !resetObject)
OpString(line, "text", m_resume);
- }
- sprintf(op, "ScriptName.%c", RetLanguageLetter());
- if ( Cmd(line, op) && !bResetObject )
- {
+ sprintf(op, "ScriptName.%c", 'E' /*GetLanguageLetter()*/);
+ if (Cmd(line, op) && !resetObject)
OpString(line, "text", m_scriptName);
- }
- if ( Cmd(line, "ScriptFile") && !bResetObject )
- {
+ if (Cmd(line, "ScriptFile") && !resetObject)
OpString(line, "name", m_scriptFile);
- }
- if ( Cmd(line, "Instructions") && !bResetObject )
+ if (Cmd(line, "Instructions") && !resetObject)
{
OpString(line, "name", name);
-//? sprintf(m_infoFilename[SATCOM_HUSTON], "help\\%s", name);
UserDir(m_infoFilename[SATCOM_HUSTON], name, "help");
- m_bImmediatSatCom = OpInt(line, "immediat", 0);
+ m_immediatSatCom = OpInt(line, "immediat", 0);
}
- if ( Cmd(line, "Satellite") && !bResetObject )
+ if (Cmd(line, "Satellite") && !resetObject)
{
OpString(line, "name", name);
-//? sprintf(m_infoFilename[SATCOM_SAT], "help\\%s", name);
UserDir(m_infoFilename[SATCOM_SAT], name, "help");
}
- if ( Cmd(line, "Loading") && !bResetObject )
+ if (Cmd(line, "Loading") && !resetObject)
{
OpString(line, "name", name);
-//? sprintf(m_infoFilename[SATCOM_LOADING], "help\\%s", name);
UserDir(m_infoFilename[SATCOM_LOADING], name, "help");
}
- if ( Cmd(line, "HelpFile") && !bResetObject )
+ if (Cmd(line, "HelpFile") && !resetObject)
{
OpString(line, "name", name);
-//? sprintf(m_infoFilename[SATCOM_PROG], "help\\%s", name);
UserDir(m_infoFilename[SATCOM_PROG], name, "help");
}
- if ( Cmd(line, "SoluceFile") && !bResetObject )
+ if (Cmd(line, "SoluceFile") && !resetObject)
{
OpString(line, "name", name);
-//? sprintf(m_infoFilename[SATCOM_SOLUCE], "help\\%s", name);
UserDir(m_infoFilename[SATCOM_SOLUCE], name, "help");
}
- if ( Cmd(line, "EndingFile") && !bResetObject )
+ if (Cmd(line, "EndingFile") && !resetObject)
{
m_endingWinRank = OpInt(line, "win", 0);
m_endingLostRank = OpInt(line, "lost", 0);
}
- if ( Cmd(line, "MessageDelay") && !bResetObject )
+ if (Cmd(line, "MessageDelay") && !resetObject)
{
m_displayText->SetDelay(OpFloat(line, "factor", 1.0f));
}
- if ( Cmd(line, "Audio") && !bResetObject )
+ if (Cmd(line, "Audio") && !resetObject)
{
m_audioTrack = OpInt(line, "track", 0);
- m_bAudioRepeat = OpInt(line, "repeat", 1);
+ m_audioRepeat = OpInt(line, "repeat", 1);
}
- if ( Cmd(line, "AmbiantColor") && !bResetObject )
+ if (Cmd(line, "AmbientColor") && !resetObject)
{
- m_engine->SetAmbiantColor(OpColor(line, "air", 0x88888888), 0);
- m_engine->SetAmbiantColor(OpColor(line, "water", 0x88888888), 1);
+ m_engine->SetAmbientColor(OpColor(line, "air", Gfx::Color(0.533f, 0.533f, 0.533f, 0.533f)), 0);
+ m_engine->SetAmbientColor(OpColor(line, "water", Gfx::Color(0.533f, 0.533f, 0.533f, 0.533f)), 1);
}
- if ( Cmd(line, "FogColor") && !bResetObject )
+ if (Cmd(line, "FogColor") && !resetObject)
{
- m_engine->SetFogColor(OpColor(line, "air", 0x88888888), 0);
- m_engine->SetFogColor(OpColor(line, "water", 0x88888888), 1);
+ m_engine->SetFogColor(OpColor(line, "air", Gfx::Color(0.533f, 0.533f, 0.533f, 0.533f)), 0);
+ m_engine->SetFogColor(OpColor(line, "water", Gfx::Color(0.533f, 0.533f, 0.533f, 0.533f)), 1);
}
- if ( Cmd(line, "VehicleColor") && !bResetObject )
- {
- m_colorNewBot = RetColor(OpColor(line, "color", 0x88888888));
- }
+ if (Cmd(line, "VehicleColor") && !resetObject)
+ m_colorNewBot = OpColor(line, "color", Gfx::Color(0.533f, 0.533f, 0.533f, 0.533f));
- if ( Cmd(line, "InsectColor") && !bResetObject )
- {
- m_colorNewAlien = RetColor(OpColor(line, "color", 0x88888888));
- }
+ if (Cmd(line, "InsectColor") && !resetObject)
+ m_colorNewAlien = OpColor(line, "color", Gfx::Color(0.533f, 0.533f, 0.533f, 0.533f));
- if ( Cmd(line, "GreeneryColor") && !bResetObject )
- {
- m_colorNewGreen = RetColor(OpColor(line, "color", 0x88888888));
- }
+ if (Cmd(line, "GreeneryColor") && !resetObject)
+ m_colorNewGreen = OpColor(line, "color", Gfx::Color(0.533f, 0.533f, 0.533f, 0.533f));
- if ( Cmd(line, "DeepView") && !bResetObject )
+ if (Cmd(line, "DeepView") && !resetObject)
{
m_engine->SetDeepView(OpFloat(line, "air", 500.0f)*UNIT, 0, true);
m_engine->SetDeepView(OpFloat(line, "water", 100.0f)*UNIT, 1, true);
}
- if ( Cmd(line, "FogStart") && !bResetObject )
+ if (Cmd(line, "FogStart") && !resetObject)
{
m_engine->SetFogStart(OpFloat(line, "air", 0.5f), 0);
m_engine->SetFogStart(OpFloat(line, "water", 0.5f), 1);
}
- if ( Cmd(line, "SecondTexture") && !bResetObject )
- {
+ if (Cmd(line, "SecondTexture") && !resetObject)
m_engine->SetSecondTexture(OpInt(line, "rank", 1));
- }
- if ( Cmd(line, "Background") && !bResetObject )
+ if (Cmd(line, "Background") && !resetObject)
{
OpString(line, "image", name);
UserDir(dir, name, "");
m_engine->SetBackground(dir,
- OpColor(line, "up", 0x00000000),
- OpColor(line, "down", 0x00000000),
- OpColor(line, "cloudUp", 0x00000000),
- OpColor(line, "cloudDown", 0x00000000),
+ OpColor(line, "up", Gfx::Color(0.0f, 0.0f, 0.0f, 0.0f)),
+ OpColor(line, "down", Gfx::Color(0.0f, 0.0f, 0.0f, 0.0f)),
+ OpColor(line, "cloudUp", Gfx::Color(0.0f, 0.0f, 0.0f, 0.0f)),
+ OpColor(line, "cloudDown", Gfx::Color(0.0f, 0.0f, 0.0f, 0.0f)),
OpInt(line, "full", 0));
}
- if ( Cmd(line, "Planet") && !bResetObject )
+ if (Cmd(line, "Planet") && !resetObject)
{
Math::Vector ppos, uv1, uv2;
@@ -4217,21 +3893,21 @@ void CRobotMain::CreateScene(bool bSoluce, bool bFixScene, bool bResetObject)
Math::Point(uv2.x, uv2.z));
}
- if ( Cmd(line, "FrontsizeName") && !bResetObject )
+ if (Cmd(line, "FrontsizeName") && !resetObject)
{
OpString(line, "image", name);
UserDir(dir, name, "");
- m_engine->SetFrontsizeName(dir);
+ m_engine->SetForegroundName(dir);
}
- if ( Cmd(line, "Global") && !bResetObject )
+ if (Cmd(line, "Global") && !resetObject)
{
g_unit = OpFloat(line, "unitScale", 4.0f);
m_engine->SetTracePrecision(OpFloat(line, "traceQuality", 1.0f));
- m_bShortCut = OpInt(line, "shortcut", 1);
+ m_shortCut = OpInt(line, "shortcut", 1);
}
- if ( Cmd(line, "TerrainGenerate") && !bResetObject )
+ if (Cmd(line, "TerrainGenerate") && !resetObject)
{
m_terrain->Generate(OpInt(line, "mosaic", 20),
OpInt(line, "brick", 3),
@@ -4241,182 +3917,138 @@ void CRobotMain::CreateScene(bool bSoluce, bool bFixScene, bool bResetObject)
OpFloat(line, "hard", 0.5f));
}
- if ( Cmd(line, "TerrainWind") && !bResetObject )
- {
+ if (Cmd(line, "TerrainWind") && !resetObject)
m_terrain->SetWind(OpPos(line, "speed"));
- }
-
- if ( Cmd(line, "TerrainRelief") && !bResetObject )
- {
- OpString(line, "image", name);
- UserDir(dir, name, "textures");
- m_terrain->ReliefFromBMP(dir, OpFloat(line, "factor", 1.0f), OpInt(line, "border", 1));
- }
- if ( Cmd(line, "TerrainReliefDXF") && !bResetObject )
+ if (Cmd(line, "TerrainRelief") && !resetObject)
{
OpString(line, "image", name);
UserDir(dir, name, "textures");
- m_terrain->ReliefFromDXF(dir, OpFloat(line, "factor", 1.0f));
+ m_terrain->LoadRelief(dir, OpFloat(line, "factor", 1.0f), OpInt(line, "border", 1));
}
- if ( Cmd(line, "TerrainResource") && !bResetObject )
+ if (Cmd(line, "TerrainResource") && !resetObject)
{
OpString(line, "image", name);
UserDir(dir, name, "textures");
- m_terrain->ResFromBMP(dir);
+ m_terrain->LoadResources(dir);
}
- if ( Cmd(line, "TerrainWater") && !bResetObject )
+ if (Cmd(line, "TerrainWater") && !resetObject)
{
OpString(line, "image", name);
UserDir(dir, name, "");
+ Math::Vector pos;
pos.x = OpFloat(line, "moveX", 0.0f);
pos.y = OpFloat(line, "moveY", 0.0f);
pos.z = pos.x;
- m_water->Create(OpTypeWater(line, "air", WATER_TT),
- OpTypeWater(line, "water", WATER_TT),
+ m_water->Create(OpTypeWater(line, "air", Gfx::WATER_TT),
+ OpTypeWater(line, "water", Gfx::WATER_TT),
dir,
- RetColor(OpColor(line, "diffuse", 0xffffffff)),
- RetColor(OpColor(line, "ambiant", 0xffffffff)),
+ OpColor(line, "diffuse", Gfx::Color(1.0f, 1.0f, 1.0f, 1.0f)),
+ OpColor(line, "ambiant", Gfx::Color(1.0f, 1.0f, 1.0f, 1.0f)),
OpFloat(line, "level", 100.0f)*UNIT,
OpFloat(line, "glint", 1.0f),
pos);
- m_colorNewWater = RetColor(OpColor(line, "color", RetColor(m_colorRefWater)));
+ m_colorNewWater = OpColor(line, "color", m_colorRefWater);
m_colorShiftWater = OpFloat(line, "brightness", 0.0f);
}
- if ( Cmd(line, "TerrainLava") && !bResetObject )
- {
+ if (Cmd(line, "TerrainLava") && !resetObject)
m_water->SetLava(OpInt(line, "mode", 0));
- }
- if ( Cmd(line, "TerrainCloud") && !bResetObject )
+ if (Cmd(line, "TerrainCloud") && !resetObject)
{
OpString(line, "image", name);
UserDir(dir, name, "");
m_cloud->Create(dir,
- RetColor(OpColor(line, "diffuse", 0xffffffff)),
- RetColor(OpColor(line, "ambiant", 0xffffffff)),
- OpFloat(line, "level", 500.0f)*UNIT);
+ OpColor(line, "diffuse", Gfx::Color(1.0f, 1.0f, 1.0f, 1.0f)),
+ OpColor(line, "ambiant", Gfx::Color(1.0f, 1.0f, 1.0f, 1.0f)),
+ OpFloat(line, "level", 500.0f) * UNIT);
}
- if ( Cmd(line, "TerrainBlitz") && !bResetObject )
+ if (Cmd(line, "TerrainBlitz") && !resetObject)
{
- m_blitz->Create(OpFloat(line, "sleep", 0.0f),
+ m_lightning->Create(OpFloat(line, "sleep", 0.0f),
OpFloat(line, "delay", 3.0f),
- OpFloat(line, "magnetic", 50.0f)*UNIT);
+ OpFloat(line, "magnetic", 50.0f) * UNIT);
}
- if ( Cmd(line, "TerrainInitTextures") && !bResetObject )
+ if (Cmd(line, "TerrainInitTextures") && !resetObject)
{
- int dx, dy, tt[100];
- char* op;
-
OpString(line, "image", name);
- AddExt(name, ".tga");
- dx = OpInt(line, "dx", 1);
- dy = OpInt(line, "dy", 1);
- op = SearchOp(line, "table");
- for ( i=0 ; i<dx*dy ; i++ )
- {
+ AddExt(name, ".png");
+ int dx = OpInt(line, "dx", 1);
+ int dy = OpInt(line, "dy", 1);
+ char* op = SearchOp(line, "table");
+ int tt[100];
+ for (int i = 0; i < dx*dy; i++)
tt[i] = GetInt(op, i, 0);
- }
- if ( strstr(name, "%user%") != 0 )
- {
+ if (strstr(name, "%user%") != 0)
CopyFileListToTemp(name, tt, dx*dy);
- }
m_terrain->InitTextures(name, tt, dx, dy);
}
- if ( Cmd(line, "TerrainInit") && !bResetObject )
- {
- m_terrain->LevelInit(OpInt(line, "id", 1));
- }
+ if (Cmd(line, "TerrainInit") && !resetObject)
+ m_terrain->InitMaterials(OpInt(line, "id", 1));
- if ( Cmd(line, "TerrainMaterial") && !bResetObject )
+ if (Cmd(line, "TerrainMaterial") && !resetObject)
{
OpString(line, "image", name);
- AddExt(name, ".tga");
- if ( strstr(name, "%user%") != 0 )
- {
+ AddExt(name, ".png");
+ if (strstr(name, "%user%") != 0)
CopyFileToTemp(name);
- }
- m_terrain->LevelMaterial(OpInt(line, "id", 0),
- name,
- OpFloat(line, "u", 0.0f),
- OpFloat(line, "v", 0.0f),
- OpInt(line, "up", 1),
- OpInt(line, "right", 1),
- OpInt(line, "down", 1),
- OpInt(line, "left", 1),
- OpFloat(line, "hard", 0.5f));
+ m_terrain->AddMaterial(OpInt(line, "id", 0),
+ name,
+ Math::Point(OpFloat(line, "u", 0.0f),
+ OpFloat(line, "v", 0.0f)),
+ OpInt(line, "up", 1),
+ OpInt(line, "right", 1),
+ OpInt(line, "down", 1),
+ OpInt(line, "left", 1),
+ OpFloat(line, "hard", 0.5f));
}
- if ( Cmd(line, "TerrainLevel") && !bResetObject )
+ if (Cmd(line, "TerrainLevel") && !resetObject)
{
- int id[50];
- char* op;
-
- op = SearchOp(line, "id");
- i = 0;
- while ( true )
+ char* op = SearchOp(line, "id");
+ int id[50];
+ int i = 0;
+ while (i < 50)
{
id[i] = GetInt(op, i, 0);
- if ( id[i++] == 0 ) break;
+ if (id[i++] == 0) break;
}
- m_terrain->LevelGenerate(id,
- OpFloat(line, "min", 0.0f)*UNIT,
- OpFloat(line, "max", 100.0f)*UNIT,
- OpFloat(line, "slope", 5.0f),
- OpFloat(line, "freq", 100.0f),
- OpPos(line, "center")*g_unit,
- OpFloat(line, "radius", 0.0f)*g_unit);
+ m_terrain->GenerateMaterials(id,
+ OpFloat(line, "min", 0.0f)*UNIT,
+ OpFloat(line, "max", 100.0f)*UNIT,
+ OpFloat(line, "slope", 5.0f),
+ OpFloat(line, "freq", 100.0f),
+ OpPos(line, "center")*g_unit,
+ OpFloat(line, "radius", 0.0f)*g_unit);
}
- if ( Cmd(line, "TerrainCreate") && !bResetObject )
- {
- m_terrain->CreateObjects(true);
- }
+ if (Cmd(line, "TerrainCreate") && !resetObject)
+ m_terrain->CreateObjects();
- if ( Cmd(line, "BeginObject") )
+ if (Cmd(line, "BeginObject"))
{
InitEye();
SetMovieLock(false);
- if ( !m_bFixScene )
- {
-//? CreateObject(Math::Vector(0.0f, 0.0f, 0.0f), 0.0f, 0.0f, OBJECT_TOTO);
- }
- if ( read[0] != 0 ) // loading file ?
- {
- pSel = IOReadScene(read, stack);
- }
+ if (read[0] != 0) // loading file ?
+ sel = IOReadScene(read, stack);
}
- if ( Cmd(line, "CreateObject") && read[0] == 0 )
+ if (Cmd(line, "CreateObject") && read[0] == 0)
{
- CObject* pObj;
- CBrain* pBrain;
- CAuto* pAuto;
- CPyro* pyro;
- ObjectType type;
- PyroType pType;
- CameraType cType;
- Info info;
- float dir;
- char op[20];
- char text[100];
- char* p;
- int run, gadget;
+ ObjectType type = OpTypeObject(line, "type", OBJECT_NULL);
- type = OpTypeObject(line, "type", OBJECT_NULL);
-
- gadget = OpInt(line, "gadget", -1);
+ int gadget = OpInt(line, "gadget", -1);
if ( gadget == -1 )
{
gadget = 0;
@@ -4445,270 +4077,238 @@ void CRobotMain::CreateScene(bool bSoluce, bool bFixScene, bool bResetObject)
}
}
}
- if ( gadget != 0 ) // is this a gadget?
+ if (gadget != 0) // is this a gadget?
{
- if ( !TestGadgetQuantity(rankGadget++) ) continue;
+ if (!TestGadgetQuantity(rankGadget++)) continue;
}
- pos = OpPos(line, "pos")*g_unit;
- dir = OpFloat(line, "dir", 0.0f)*Math::PI;
- pObj = CreateObject(pos, dir,
- OpFloat(line, "z", 1.0f),
- OpFloat(line, "h", 0.0f),
- type,
- OpFloat(line, "power", 1.0f),
- OpInt(line, "trainer", 0),
- OpInt(line, "toy", 0),
- OpInt(line, "option", 0));
-
- if ( pObj != 0 )
+ Math::Vector pos = OpPos(line, "pos")*g_unit;
+ float dir = OpFloat(line, "dir", 0.0f)*Math::PI;
+ CObject* obj = CreateObject(pos, dir,
+ OpFloat(line, "z", 1.0f),
+ OpFloat(line, "h", 0.0f),
+ type,
+ OpFloat(line, "power", 1.0f),
+ OpInt(line, "trainer", 0),
+ OpInt(line, "toy", 0),
+ OpInt(line, "option", 0));
+
+ if (obj != nullptr)
{
- pObj->SetDefRank(rankObj);
+ obj->SetDefRank(rankObj);
- if ( type == OBJECT_BASE ) m_bBase = true;
+ if (type == OBJECT_BASE) m_base = true;
- cType = OpCamera(line, "camera");
- if ( cType != CAMERA_NULL )
- {
- pObj->SetCameraType(cType);
- }
- pObj->SetCameraDist(OpFloat(line, "cameraDist", 50.0f));
- pObj->SetCameraLock(OpInt(line, "cameraLock", 0));
+ Gfx::CameraType cType = OpCamera(line, "camera");
+ if (cType != Gfx::CAM_TYPE_NULL)
+ obj->SetCameraType(cType);
+
+ obj->SetCameraDist(OpFloat(line, "cameraDist", 50.0f));
+ obj->SetCameraLock(OpInt(line, "cameraLock", 0));
- pType = OpPyro(line, "pyro");
- if ( pType != PT_NULL )
+ Gfx::PyroType pType = OpPyro(line, "pyro");
+ if (pType != Gfx::PT_NULL)
{
- pyro = new CPyro(m_iMan);
- pyro->Create(pType, pObj);
+ Gfx::CPyro* pyro = new Gfx::CPyro(m_iMan);
+ pyro->Create(pType, obj);
}
// Puts information in terminal (OBJECT_INFO).
- for ( i=0 ; i<OBJECTMAXINFO ; i++ )
+ for (int i = 0; i < OBJECTMAXINFO; i++)
{
sprintf(op, "info%d", i+1);
+ char text[100];
OpString(line, op, text);
- if ( text[0] == 0 ) break;
- p = strchr(text, '=');
- if ( p == 0 ) break;
+ if (text[0] == 0) break;
+ char* p = strchr(text, '=');
+ if (p == 0) break;
*p = 0;
+ Info info;
strcpy(info.name, text);
sscanf(p+1, "%f", &info.value);
- pObj->SetInfo(i, info);
+ obj->SetInfo(i, info);
}
// Sets the parameters of the command line.
- p = SearchOp(line, "cmdline");
- for ( i=0 ; i<OBJECTMAXCMDLINE ; i++ )
+ char* p = SearchOp(line, "cmdline");
+ for (int i = 0; i < OBJECTMAXCMDLINE; i++)
{
- float value;
- value = GetFloat(p, i, NAN);
- if ( value == NAN ) break;
- pObj->SetCmdLine(i, value);
+ float value = GetFloat(p, i, NAN);
+ if (value == NAN) break;
+ obj->SetCmdLine(i, value);
}
- if ( OpInt(line, "select", 0) == 1 )
+ if (OpInt(line, "select", 0) == 1)
{
- pSel = pObj;
+ sel = obj;
}
- pObj->SetSelectable(OpInt(line, "selectable", 1));
- pObj->SetEnable(OpInt(line, "enable", 1));
- pObj->SetProxyActivate(OpInt(line, "proxyActivate", 0));
- pObj->SetProxyDistance(OpFloat(line, "proxyDistance", 15.0f)*g_unit);
- pObj->SetRange(OpFloat(line, "range", 30.0f));
- pObj->SetShield(OpFloat(line, "shield", 1.0f));
- pObj->SetMagnifyDamage(OpFloat(line, "magnifyDamage", 1.0f));
- pObj->SetClip(OpInt(line, "clip", 1));
- pObj->SetCheckToken(OpInt(line, "checkToken", 1));
- pObj->SetManual(OpInt(line, "manual", 0));
-
- motion = pObj->RetMotion();
- if ( motion != 0 )
+ obj->SetSelectable(OpInt(line, "selectable", 1));
+ obj->SetEnable(OpInt(line, "enable", 1));
+ obj->SetProxyActivate(OpInt(line, "proxyActivate", 0));
+ obj->SetProxyDistance(OpFloat(line, "proxyDistance", 15.0f)*g_unit);
+ obj->SetRange(OpFloat(line, "range", 30.0f));
+ obj->SetShield(OpFloat(line, "shield", 1.0f));
+ obj->SetMagnifyDamage(OpFloat(line, "magnifyDamage", 1.0f));
+ obj->SetClip(OpInt(line, "clip", 1));
+ obj->SetCheckToken(OpInt(line, "checkToken", 1));
+ obj->SetManual(OpInt(line, "manual", 0));
+
+ CMotion* motion = obj->GetMotion();
+ if (motion != nullptr)
{
p = SearchOp(line, "param");
- for ( i=0 ; i<10 ; i++ )
+ for (int i = 0; i < 10; i++)
{
float value;
value = GetFloat(p, i, NAN);
- if ( value == NAN ) break;
+ if (value == NAN) break;
motion->SetParam(i, value);
}
}
- run = -1;
- pBrain = pObj->RetBrain();
- if ( pBrain != 0 )
+ int run = -1;
+ CBrain* brain = obj->GetBrain();
+ if (brain != nullptr)
{
- for ( i=0 ; i<10 ; i++ )
+ for (int i = 0; i < 10; i++)
{
sprintf(op, "script%d", i+1); // script1..script10
OpString(line, op, name);
-#if _SCHOOL
- if ( !m_dialog->RetSoluce4() && i == 3 ) continue;
-#endif
- if ( name[0] != 0 )
- {
- pBrain->SetScriptName(i, name);
- }
+/* TODO: #if _SCHOOL
+ if ( !m_dialog->GetSoluce4() && i == 3 ) continue;
+#endif*/
+ if (name[0] != 0)
+ brain->SetScriptName(i, name);
+
}
- i = OpInt(line, "run", 0);
- if ( i != 0 )
+ int i = OpInt(line, "run", 0);
+ if (i != 0)
{
run = i-1;
- pBrain->SetScriptRun(run);
+ brain->SetScriptRun(run);
}
}
- pAuto = pObj->RetAuto();
- if ( pAuto != 0 )
+ CAuto* automat = obj->GetAuto();
+ if (automat != nullptr)
{
type = OpTypeObject(line, "autoType", OBJECT_NULL);
- pAuto->SetType(type);
- for ( i=0 ; i<5 ; i++ )
+ automat->SetType(type);
+ for (int i = 0; i < 5; i++)
{
sprintf(op, "autoValue%d", i+1); // autoValue1..autoValue5
- pAuto->SetValue(i, OpFloat(line, op, 0.0f));
+ automat->SetValue(i, OpFloat(line, op, 0.0f));
}
OpString(line, "autoString", name);
- pAuto->SetString(name);
+ automat->SetString(name);
- i = OpInt(line, "run", -1);
- if ( i != -1 )
+ int i = OpInt(line, "run", -1);
+ if (i != -1)
{
- if ( i != PARAM_FIXSCENE &&
- !m_dialog->RetMovies() ) i = 0;
- pAuto->Start(i); // starts the film
+ if (i != PARAM_FIXSCENE &&
+ !m_dialog->GetMovies()) i = 0;
+ automat->Start(i); // starts the film
}
}
OpString(line, "soluce", name);
- if ( bSoluce && pBrain != 0 && name[0] != 0 )
- {
- pBrain->SetSoluceName(name);
- }
+ if (soluce && brain != 0 && name[0] != 0)
+ brain->SetSoluceName(name);
- pObj->SetResetPosition(pObj->RetPosition(0));
- pObj->SetResetAngle(pObj->RetAngle(0));
- pObj->SetResetRun(run);
+ obj->SetResetPosition(obj->GetPosition(0));
+ obj->SetResetAngle(obj->GetAngle(0));
+ obj->SetResetRun(run);
- if ( OpInt(line, "reset", 0) == 1 )
- {
- pObj->SetResetCap(RESET_MOVE);
- }
+ if (OpInt(line, "reset", 0) == 1)
+ obj->SetResetCap(RESET_MOVE);
}
rankObj ++;
}
- if ( Cmd(line, "CreateFog") && !bResetObject )
+ if (Cmd(line, "CreateFog") && !resetObject)
{
- ParticuleType type;
- Math::Point dim;
- float height, ddim, delay;
-
- type = (ParticuleType)(PARTIFOG0+OpInt(line, "type", 0));
- pos = OpPos(line, "pos")*g_unit;
- height = OpFloat(line, "height", 1.0f)*g_unit;
- ddim = OpFloat(line, "dim", 50.0f)*g_unit;
- delay = OpFloat(line, "delay", 2.0f);
- m_terrain->MoveOnFloor(pos);
+ Gfx::ParticleType type = static_cast<Gfx::ParticleType>((Gfx::PARTIFOG0+OpInt(line, "type", 0)));
+ Math::Vector pos = OpPos(line, "pos")*g_unit;
+ float height = OpFloat(line, "height", 1.0f)*g_unit;
+ float ddim = OpFloat(line, "dim", 50.0f)*g_unit;
+ float delay = OpFloat(line, "delay", 2.0f);
+ m_terrain->AdjustToFloor(pos);
pos.y += height;
+ Math::Point dim;
dim.x = ddim;
dim.y = dim.x;
- m_particule->CreateParticule(pos, Math::Vector(0.0f, 0.0f, 0.0f), dim, type, delay, 0.0f, 0.0f);
+ m_particle->CreateParticle(pos, Math::Vector(0.0f, 0.0f, 0.0f), dim, type, delay, 0.0f, 0.0f);
}
- if ( Cmd(line, "CreateLight") && !bResetObject )
+ if (Cmd(line, "CreateLight") && !resetObject)
{
- D3DTypeObj type;
+ Gfx::EngineObjectType type;
- color.r = 0.5f;
- color.g = 0.5f;
- color.b = 0.5f;
- color.a = 1.0f;
- obj = CreateLight(OpDir(line, "dir"),
- OpColorValue(line, "color", color));
+ int lightRank = CreateLight(OpDir(line, "dir"),
+ OpColor(line, "color", Gfx::Color(0.5f, 0.5f, 0.5f, 1.0f)));
- type = OpTypeTerrain(line, "type", TYPENULL);
- if ( type == TYPETERRAIN )
- {
- m_light->SetLightIncluType(obj, TYPETERRAIN);
- }
- if ( type == TYPEQUARTZ )
- {
- m_light->SetLightIncluType(obj, TYPEQUARTZ);
- }
- if ( type == TYPEMETAL )
- {
- m_light->SetLightIncluType(obj, TYPEMETAL);
- }
- if ( type == TYPEFIX )
- {
- m_light->SetLightExcluType(obj, TYPETERRAIN);
- }
+ type = OpTypeTerrain(line, "type", Gfx::ENG_OBJTYPE_NULL);
+ if (type == Gfx::ENG_OBJTYPE_TERRAIN)
+ m_lightMan->SetLightIncludeType(lightRank, Gfx::ENG_OBJTYPE_TERRAIN);
+
+ if (type == Gfx::ENG_OBJTYPE_QUARTZ)
+ m_lightMan->SetLightIncludeType(lightRank, Gfx::ENG_OBJTYPE_QUARTZ);
+
+ if (type == Gfx::ENG_OBJTYPE_METAL)
+ m_lightMan->SetLightIncludeType(lightRank, Gfx::ENG_OBJTYPE_METAL);
+
+ if (type == Gfx::ENG_OBJTYPE_FIX)
+ m_lightMan->SetLightExcludeType(lightRank, Gfx::ENG_OBJTYPE_TERRAIN);
}
- if ( Cmd(line, "CreateSpot") && !bResetObject )
+ if (Cmd(line, "CreateSpot") && !resetObject)
{
- D3DTypeObj type;
+ Gfx::EngineObjectType type;
- color.r = 0.5f;
- color.g = 0.5f;
- color.b = 0.5f;
- color.a = 1.0f;
- obj = CreateSpot(OpDir(line, "pos")*g_unit,
- OpColorValue(line, "color", color));
+ int rankLight = CreateSpot(OpDir(line, "pos")*g_unit,
+ OpColor(line, "color", Gfx::Color(0.5f, 0.5f, 0.5f, 1.0f)));
- type = OpTypeTerrain(line, "type", TYPENULL);
- if ( type == TYPETERRAIN )
- {
- m_light->SetLightIncluType(obj, TYPETERRAIN);
- }
- if ( type == TYPEQUARTZ )
- {
- m_light->SetLightIncluType(obj, TYPEQUARTZ);
- }
- if ( type == TYPEMETAL )
- {
- m_light->SetLightIncluType(obj, TYPEMETAL);
- }
- if ( type == TYPEFIX )
- {
- m_light->SetLightExcluType(obj, TYPETERRAIN);
- }
+ type = OpTypeTerrain(line, "type", Gfx::ENG_OBJTYPE_NULL);
+ if (type == Gfx::ENG_OBJTYPE_TERRAIN)
+ m_lightMan->SetLightIncludeType(rankLight, Gfx::ENG_OBJTYPE_TERRAIN);
+
+ if (type == Gfx::ENG_OBJTYPE_QUARTZ)
+ m_lightMan->SetLightIncludeType(rankLight, Gfx::ENG_OBJTYPE_QUARTZ);
+
+ if (type == Gfx::ENG_OBJTYPE_METAL)
+ m_lightMan->SetLightIncludeType(rankLight, Gfx::ENG_OBJTYPE_METAL);
+
+ if (type == Gfx::ENG_OBJTYPE_FIX)
+ m_lightMan->SetLightExcludeType(rankLight, Gfx::ENG_OBJTYPE_TERRAIN);
}
- if ( Cmd(line, "GroundSpot") && !bResetObject )
+ if (Cmd(line, "GroundSpot") && !resetObject)
{
- rank = m_engine->GroundSpotCreate();
- if ( rank != -1 )
+ rank = m_engine->CreateGroundSpot();
+ if (rank != -1)
{
m_engine->SetObjectGroundSpotPos(rank, OpPos(line, "pos")*g_unit);
m_engine->SetObjectGroundSpotRadius(rank, OpFloat(line, "radius", 10.0f)*g_unit);
- m_engine->SetObjectGroundSpotColor(rank, RetColor(OpColor(line, "color", 0x88888888)));
+ m_engine->SetObjectGroundSpotColor(rank, OpColor(line, "color", Gfx::Color(0.533f, 0.533f, 0.533f, 0.533f)));
m_engine->SetObjectGroundSpotSmooth(rank, OpFloat(line, "smooth", 1.0f));
m_engine->SetObjectGroundSpotMinMax(rank, OpFloat(line, "min", 0.0f)*g_unit,
OpFloat(line, "max", 0.0f)*g_unit);
}
}
- if ( Cmd(line, "WaterColor") && !bResetObject )
- {
- color.r = 0.0f;
- color.g = 0.0f;
- color.b = 0.0f;
- color.a = 1.0f;
- m_engine->SetWaterAddColor(OpColorValue(line, "color", color));
- }
+ if (Cmd(line, "WaterColor") && !resetObject)
+ m_engine->SetWaterAddColor(OpColor(line, "color", Gfx::Color(0.0f, 0.0f, 0.0f, 1.0f)));
- if ( Cmd(line, "MapColor") && !bResetObject )
+ if (Cmd(line, "MapColor") && !resetObject)
{
- m_map->FloorColorMap(RetColor(OpColor(line, "floor", 0x88888888)),
- RetColor(OpColor(line, "water", 0x88888888)));
- m_bMapShow = OpInt(line, "show", 1);
- m_map->ShowMap(m_bMapShow);
+ m_map->FloorColorMap(OpColor(line, "floor", Gfx::Color(0.533f, 0.533f, 0.533f, 0.533f)),
+ OpColor(line, "water", Gfx::Color(0.533f, 0.533f, 0.533f, 0.533f)));
+ m_mapShow = OpInt(line, "show", 1);
+ m_map->ShowMap(m_mapShow);
m_map->SetToy(OpInt(line, "toyIcon", 0));
- m_bMapImage = OpInt(line, "image", 0);
- if ( m_bMapImage )
+ m_mapImage = OpInt(line, "image", 0);
+ if (m_mapImage)
{
Math::Vector offset;
OpString(line, "filename", m_mapFilename);
@@ -4720,17 +4320,17 @@ void CRobotMain::CreateScene(bool bSoluce, bool bFixScene, bool bResetObject)
OpInt(line, "debug", 0));
}
}
- if ( Cmd(line, "MapZoom") && !bResetObject )
+ if (Cmd(line, "MapZoom") && !resetObject)
{
m_map->ZoomMap(OpFloat(line, "factor", 2.0f));
m_map->MapEnable(OpInt(line, "enable", 1));
}
- if ( Cmd(line, "MaxFlyingHeight") && !bResetObject )
+ if (Cmd(line, "MaxFlyingHeight") && !resetObject)
{
m_terrain->SetFlyingMaxHeight(OpFloat(line, "max", 280.0f)*g_unit);
}
- if ( Cmd(line, "AddFlyingHeight") && !bResetObject )
+ if (Cmd(line, "AddFlyingHeight") && !resetObject)
{
m_terrain->AddFlyingLimit(OpPos(line, "center")*g_unit,
OpFloat(line, "extRadius", 20.0f)*g_unit,
@@ -4738,23 +4338,22 @@ void CRobotMain::CreateScene(bool bSoluce, bool bFixScene, bool bResetObject)
OpFloat(line, "maxHeight", 200.0f));
}
- if ( Cmd(line, "Camera") )
+ if (Cmd(line, "Camera"))
{
m_camera->Init(OpDir(line, "eye")*g_unit,
OpDir(line, "lookat")*g_unit,
- bResetObject?0.0f:OpFloat(line, "delay", 0.0f));
+ resetObject?0.0f:OpFloat(line, "delay", 0.0f));
+
+ if (OpInt(line, "fadeIn", 0) == 1)
+ m_camera->StartOver(Gfx::CAM_OVER_EFFECT_FADEIN_WHITE, Math::Vector(0.0f, 0.0f, 0.0f), 1.0f);
- if ( OpInt(line, "fadeIn", 0) == 1 )
- {
- m_camera->StartOver(OE_FADEINw, Math::Vector(0.0f, 0.0f, 0.0f), 1.0f);
- }
m_camera->SetFixDirection(OpFloat(line, "fixDirection", 0.25f)*Math::PI);
}
- if ( Cmd(line, "EndMissionTake") && !bResetObject )
+ if (Cmd(line, "EndMissionTake") && !resetObject)
{
- i = m_endTakeTotal;
- if ( i < 10 )
+ int i = m_endTakeTotal;
+ if (i < 10)
{
m_endTake[i].pos = OpPos(line, "pos")*g_unit;
m_endTake[i].dist = OpFloat(line, "dist", 8.0f)*g_unit;
@@ -4762,56 +4361,51 @@ void CRobotMain::CreateScene(bool bSoluce, bool bFixScene, bool bResetObject)
m_endTake[i].min = OpInt(line, "min", 1);
m_endTake[i].max = OpInt(line, "max", 9999);
m_endTake[i].lost = OpInt(line, "lost", -1);
- m_endTake[i].bImmediat = OpInt(line, "immediat", 0);
+ m_endTake[i].immediat = OpInt(line, "immediat", 0);
OpString(line, "message", m_endTake[i].message);
m_endTakeTotal ++;
}
}
- if ( Cmd(line, "EndMissionDelay") && !bResetObject )
+ if (Cmd(line, "EndMissionDelay") && !resetObject)
{
m_endTakeWinDelay = OpFloat(line, "win", 2.0f);
m_endTakeLostDelay = OpFloat(line, "lost", 2.0f);
}
- if ( Cmd(line, "EndMissionResearch") && !bResetObject )
+ if (Cmd(line, "EndMissionResearch") && !resetObject)
{
m_endTakeResearch |= OpResearch(line, "type");
}
- if ( Cmd(line, "ObligatoryToken") && !bResetObject )
+ if (Cmd(line, "ObligatoryToken") && !resetObject)
{
- i = m_obligatoryTotal;
- if ( i < 100 )
+ int i = m_obligatoryTotal;
+ if (i < 100)
{
OpString(line, "text", m_obligatoryToken[i]);
m_obligatoryTotal ++;
}
}
- if ( Cmd(line, "ProhibitedToken") && !bResetObject )
+ if (Cmd(line, "ProhibitedToken") && !resetObject)
{
- i = m_prohibitedTotal;
- if ( i < 100 )
+ int i = m_prohibitedTotal;
+ if (i < 100)
{
OpString(line, "text", m_prohibitedToken[i]);
m_prohibitedTotal ++;
}
}
- if ( Cmd(line, "EnableBuild") && !bResetObject )
- {
+ if (Cmd(line, "EnableBuild") && !resetObject)
g_build |= OpBuild(line, "type");
- }
- if ( Cmd(line, "EnableResearch") && !bResetObject )
- {
+ if (Cmd(line, "EnableResearch") && !resetObject)
g_researchEnable |= OpResearch(line, "type");
- }
- if ( Cmd(line, "DoneResearch") && read[0] == 0 && !bResetObject ) // not loading file?
- {
+
+ if (Cmd(line, "DoneResearch") && read[0] == 0 && !resetObject) // not loading file?
g_researchDone |= OpResearch(line, "type");
- }
- if ( Cmd(line, "NewScript") && !bResetObject )
+ if (Cmd(line, "NewScript") && !resetObject)
{
OpString(line, "name", name);
AddNewScriptName(OpTypeObject(line, "type", OBJECT_NULL), name);
@@ -4820,16 +4414,13 @@ void CRobotMain::CreateScene(bool bSoluce, bool bFixScene, bool bResetObject)
fclose(file);
- if ( read[0] == 0 )
- {
- CompileScript(bSoluce); // compiles all scripts
- }
+ if (read[0] == 0)
+ CompileScript(soluce); // compiles all scripts
- if ( strcmp(base, "scene") == 0 && !bResetObject ) // mission?
- {
+ if (strcmp(base, "scene") == 0 && !resetObject) // mission?
WriteFreeParam();
- }
- if ( strcmp(base, "free") == 0 && !bResetObject ) // free play?
+
+ if (strcmp(base, "free") == 0 && !resetObject) // free play?
{
g_researchDone = m_freeResearch;
@@ -4841,7 +4432,7 @@ void CRobotMain::CreateScene(bool bSoluce, bool bFixScene, bool bResetObject)
g_build |= BUILD_FLAG;
}
- if ( !bResetObject )
+ if (!resetObject)
{
ChangeColor(); // changes the colors of texture
m_short->SetMode(false); // vehicles?
@@ -4849,70 +4440,64 @@ void CRobotMain::CreateScene(bool bSoluce, bool bFixScene, bool bResetObject)
CreateShortcuts();
m_map->UpdateMap();
- m_engine->TimeInit();
- m_engine->FlushPressKey();
+ // TODO: m_engine->TimeInit(); ??
+ m_app->ResetKeyStates();
m_time = 0.0f;
m_gameTime = 0.0f;
m_checkEndTime = 0.0f;
m_infoUsed = 0;
- m_selectObject = pSel;
+ m_selectObject = sel;
- if ( !m_bBase && // no main base?
- !m_bFixScene ) // interractive scene?
+ if (!m_base && // no main base?
+ !m_fixScene) // interractive scene?
{
- if ( pSel == 0 )
- {
- pObj = SearchHuman();
- }
+ CObject* obj;
+ if (sel == nullptr)
+ obj = SearchHuman();
else
+ obj = sel;
+
+ if (obj != nullptr)
{
- pObj = pSel;
- }
- if ( pObj != 0 )
- {
- SelectObject(pObj);
- m_camera->SetObject(pObj);
-//? m_camera->SetType(CAMERA_BACK);
- m_camera->SetType(pObj->RetCameraType());
+ SelectObject(obj);
+ m_camera->SetControllingObject(obj);
+ m_camera->SetType(obj->GetCameraType());
}
}
- if ( m_bFixScene )
- {
- m_camera->SetType(CAMERA_SCRIPT);
- }
- if ( read[0] != 0 && pSel != 0 ) // loading file?
+ if (m_fixScene)
+ m_camera->SetType(Gfx::CAM_TYPE_SCRIPT);
+
+ if (read[0] != 0 && sel != 0) // loading file?
{
- pos = pSel->RetPosition(0);
+ Math::Vector pos = sel->GetPosition(0);
m_camera->Init(pos, pos, 0.0f);
m_camera->FixCamera();
- SelectObject(pSel);
- m_camera->SetObject(pSel);
+ SelectObject(sel);
+ m_camera->SetControllingObject(sel);
- m_bBeginSatCom = true; // message already displayed
+ m_beginSatCom = true; // message already displayed
}
m_dialog->SetSceneRead("");
m_dialog->SetStackRead("");
}
-// Creates an object of decoration mobile or stationary.
-
+//! Creates an object of decoration mobile or stationary
CObject* CRobotMain::CreateObject(Math::Vector pos, float angle, float zoom, float height,
ObjectType type, float power,
- bool bTrainer, bool bToy,
+ bool trainer, bool toy,
int option)
{
- CObject* pObject = 0;
- CAuto* automat;
+ CObject* object = nullptr;
- if ( type == OBJECT_NULL ) return 0;
+ if ( type == OBJECT_NULL ) return nullptr;
if ( type == OBJECT_HUMAN ||
type == OBJECT_TECH )
{
- bTrainer = false; // necessarily
+ trainer = false; // necessarily
}
if ( type == OBJECT_PORTICO ||
@@ -4939,11 +4524,11 @@ CObject* CRobotMain::CreateObject(Math::Vector pos, float angle, float zoom, flo
type == OBJECT_START ||
type == OBJECT_END )
{
- pObject = new CObject(m_iMan);
- pObject->CreateBuilding(pos, angle, height, type, power);
+ object = new CObject(m_iMan);
+ object->CreateBuilding(pos, angle, height, type, power);
- automat = pObject->RetAuto();
- if ( automat != 0 )
+ CAuto* automat = object->GetAuto();
+ if (automat != nullptr)
{
automat->Init();
}
@@ -4981,8 +4566,8 @@ CObject* CRobotMain::CreateObject(Math::Vector pos, float angle, float zoom, flo
type == OBJECT_MARKKEYd ||
type == OBJECT_EGG )
{
- pObject = new CObject(m_iMan);
- pObject->CreateResource(pos, angle, type, power);
+ object = new CObject(m_iMan);
+ object->CreateResource(pos, angle, type, power);
}
else
if ( type == OBJECT_FLAGb ||
@@ -4991,8 +4576,8 @@ CObject* CRobotMain::CreateObject(Math::Vector pos, float angle, float zoom, flo
type == OBJECT_FLAGy ||
type == OBJECT_FLAGv )
{
- pObject = new CObject(m_iMan);
- pObject->CreateFlag(pos, angle, type);
+ object = new CObject(m_iMan);
+ object->CreateFlag(pos, angle, type);
}
else
if ( type == OBJECT_BARRIER0 ||
@@ -5001,8 +4586,8 @@ CObject* CRobotMain::CreateObject(Math::Vector pos, float angle, float zoom, flo
type == OBJECT_BARRIER3 ||
type == OBJECT_BARRIER4 )
{
- pObject = new CObject(m_iMan);
- pObject->CreateBarrier(pos, angle, height, type);
+ object = new CObject(m_iMan);
+ object->CreateBarrier(pos, angle, height, type);
}
else
if ( type == OBJECT_PLANT0 ||
@@ -5036,8 +4621,8 @@ CObject* CRobotMain::CreateObject(Math::Vector pos, float angle, float zoom, flo
type == OBJECT_TREE8 ||
type == OBJECT_TREE9 )
{
- pObject = new CObject(m_iMan);
- pObject->CreatePlant(pos, angle, height, type);
+ object = new CObject(m_iMan);
+ object->CreatePlant(pos, angle, height, type);
}
else
if ( type == OBJECT_MUSHROOM0 ||
@@ -5051,8 +4636,8 @@ CObject* CRobotMain::CreateObject(Math::Vector pos, float angle, float zoom, flo
type == OBJECT_MUSHROOM8 ||
type == OBJECT_MUSHROOM9 )
{
- pObject = new CObject(m_iMan);
- pObject->CreateMushroom(pos, angle, height, type);
+ object = new CObject(m_iMan);
+ object->CreateMushroom(pos, angle, height, type);
}
else
if ( type == OBJECT_TEEN0 ||
@@ -5106,9 +4691,9 @@ CObject* CRobotMain::CreateObject(Math::Vector pos, float angle, float zoom, flo
type == OBJECT_TEEN48 ||
type == OBJECT_TEEN49 )
{
- pObject = new CObject(m_iMan);
- pObject->SetOption(option);
- pObject->CreateTeen(pos, angle, zoom, height, type);
+ object = new CObject(m_iMan);
+ object->SetOption(option);
+ object->CreateTeen(pos, angle, zoom, height, type);
}
else
if ( type == OBJECT_QUARTZ0 ||
@@ -5122,8 +4707,8 @@ CObject* CRobotMain::CreateObject(Math::Vector pos, float angle, float zoom, flo
type == OBJECT_QUARTZ8 ||
type == OBJECT_QUARTZ9 )
{
- pObject = new CObject(m_iMan);
- pObject->CreateQuartz(pos, angle, height, type);
+ object = new CObject(m_iMan);
+ object->CreateQuartz(pos, angle, height, type);
}
else
if ( type == OBJECT_ROOT0 ||
@@ -5137,14 +4722,14 @@ CObject* CRobotMain::CreateObject(Math::Vector pos, float angle, float zoom, flo
type == OBJECT_ROOT8 ||
type == OBJECT_ROOT9 )
{
- pObject = new CObject(m_iMan);
- pObject->CreateRoot(pos, angle, height, type);
+ object = new CObject(m_iMan);
+ object->CreateRoot(pos, angle, height, type);
}
else
if ( type == OBJECT_HOME1 )
{
- pObject = new CObject(m_iMan);
- pObject->CreateHome(pos, angle, height, type);
+ object = new CObject(m_iMan);
+ object->CreateHome(pos, angle, height, type);
}
else
if ( type == OBJECT_RUINmobilew1 ||
@@ -5161,8 +4746,8 @@ CObject* CRobotMain::CreateObject(Math::Vector pos, float angle, float zoom, flo
type == OBJECT_RUINbase ||
type == OBJECT_RUINhead )
{
- pObject = new CObject(m_iMan);
- pObject->CreateRuin(pos, angle, height, type);
+ object = new CObject(m_iMan);
+ object->CreateRuin(pos, angle, height, type);
}
else
if ( type == OBJECT_APOLLO1 ||
@@ -5170,8 +4755,8 @@ CObject* CRobotMain::CreateObject(Math::Vector pos, float angle, float zoom, flo
type == OBJECT_APOLLO4 ||
type == OBJECT_APOLLO5 )
{
- pObject = new CObject(m_iMan);
- pObject->CreateApollo(pos, angle, type);
+ object = new CObject(m_iMan);
+ object->CreateApollo(pos, angle, type);
}
else
if ( type == OBJECT_MOTHER ||
@@ -5180,8 +4765,8 @@ CObject* CRobotMain::CreateObject(Math::Vector pos, float angle, float zoom, flo
type == OBJECT_BEE ||
type == OBJECT_WORM )
{
- pObject = new CObject(m_iMan);
- pObject->CreateInsect(pos, angle, type); // no eggs
+ object = new CObject(m_iMan);
+ object->CreateInsect(pos, angle, type); // no eggs
}
else
if ( type == OBJECT_HUMAN ||
@@ -5216,150 +4801,72 @@ CObject* CRobotMain::CreateObject(Math::Vector pos, float angle, float zoom, flo
type == OBJECT_MOBILEdr ||
type == OBJECT_APOLLO2 )
{
- pObject = new CObject(m_iMan);
- pObject->SetOption(option);
- pObject->CreateVehicle(pos, angle, type, power, bTrainer, bToy);
+ object = new CObject(m_iMan);
+ object->SetOption(option);
+ object->CreateVehicle(pos, angle, type, power, trainer, toy);
}
- if ( m_bFixScene && type == OBJECT_HUMAN )
+ if (m_fixScene && type == OBJECT_HUMAN)
{
- CMotion* motion;
-
- motion = pObject->RetMotion();
- if ( m_phase == PHASE_WIN ) motion->SetAction(MHS_WIN, 0.4f);
- if ( m_phase == PHASE_LOST ) motion->SetAction(MHS_LOST, 0.5f);
+ CMotion* motion = object->GetMotion();
+ if (m_phase == PHASE_WIN ) motion->SetAction(MHS_WIN, 0.4f);
+ if (m_phase == PHASE_LOST) motion->SetAction(MHS_LOST, 0.5f);
}
- return pObject;
-}
-
-
-// Creates the editable model.
-
-void CRobotMain::CreateModel()
-{
- Math::Vector direction;
- D3DCOLORVALUE color;
-
- m_engine->SetAmbiantColor(0xC0C0C0C0); // gray
- m_engine->SetBackground("", 0x80808080, 0x80808080, 0x80808080, 0x80808080);
- m_engine->SetFogColor(0x80808080);
- m_engine->SetDeepView(500.0f, 0);
- m_engine->SetDeepView(100.0f, 1);
- m_engine->SetFogStart(0.5f);
-
- m_model->StartUserAction();
-
- direction = Math::Vector(1.0f, -1.0f, 1.0f);
- color.r = 0.7f;
- color.g = 0.7f;
- color.b = 0.7f; // white
- CreateLight(direction, color);
-
- direction = Math::Vector(-1.0f, -1.0f, 1.0f);
- color.r = 0.7f;
- color.g = 0.7f;
- color.b = 0.7f; // white
- CreateLight(direction, color);
-
- direction = Math::Vector(1.0f, -1.0f, -1.0f);
- color.r = 0.7f;
- color.g = 0.7f;
- color.b = 0.7f; // white
- CreateLight(direction, color);
-
- direction = Math::Vector(-1.0f, -1.0f, -1.0f);
- color.r = 0.7f;
- color.g = 0.7f;
- color.b = 0.7f; // white
- CreateLight(direction, color);
-
- direction = Math::Vector(0.0f, 1.0f, 0.0f);
- color.r = 0.7f;
- color.g = 0.7f;
- color.b = 0.7f; // white
- CreateLight(direction, color);
-
- InitEye();
-
- m_engine->TimeInit();
- m_time = 0.0f;
- m_gameTime = 0.0f;
- m_checkEndTime = 0.0f;
+ return object;
}
-
-// Creates a directional light.
-
-int CRobotMain::CreateLight(Math::Vector direction, D3DCOLORVALUE color)
+//! Creates a directional light
+int CRobotMain::CreateLight(Math::Vector direction, Gfx::Color color)
{
- D3DLIGHT7 light;
- int obj;
-
- if ( direction.x == 0.0f &&
- direction.y == 0.0f &&
- direction.z == 0.0f )
+ if (direction.x == 0.0f &&
+ direction.y == 0.0f &&
+ direction.z == 0.0f)
{
direction.y = -1.0f;
}
- ZeroMemory(&light, sizeof(D3DLIGHT7));
- light.dltType = D3DLIGHT_DIRECTIONAL;
- light.dcvDiffuse.r = color.r;
- light.dcvDiffuse.g = color.g;
- light.dcvDiffuse.b = color.b;
- light.dvDirection = VEC_TO_D3DVEC(direction);
- obj = m_light->CreateLight();
- m_light->SetLight(obj, light);
+ Gfx::Light light;
+ light.type = Gfx::LIGHT_DIRECTIONAL;
+ light.diffuse = color;
+ light.direction = direction;
+ int obj = m_lightMan->CreateLight();
+ m_lightMan->SetLight(obj, light);
return obj;
}
-// Creates a light spot.
-
-int CRobotMain::CreateSpot(Math::Vector pos, D3DCOLORVALUE color)
+//! Creates a light spot
+int CRobotMain::CreateSpot(Math::Vector pos, Gfx::Color color)
{
- D3DLIGHT7 light;
- int obj;
+ if (!m_engine->GetLightMode()) return -1;
- if ( !m_engine->RetLightMode() ) return -1;
+ pos.y += m_terrain->GetFloorLevel(pos);
- pos.y += m_terrain->RetFloorLevel(pos);
-
- ZeroMemory(&light, sizeof(D3DLIGHT7));
- light.dltType = D3DLIGHT_SPOT;
- light.dcvDiffuse.r = color.r;
- light.dcvDiffuse.g = color.g;
- light.dcvDiffuse.b = color.b;
- light.dvPosition = VEC_TO_D3DVEC(pos);
- light.dvDirection = D3DVECTOR(0.0f, -1.0f, 0.0f);
- light.dvRange = D3DLIGHT_RANGE_MAX;
- light.dvFalloff = 1.0f;
- light.dvTheta = 10.0f*Math::PI/180.0f;
- light.dvPhi = 90.0f*Math::PI/180.0f;
- light.dvAttenuation0 = 2.0f;
- light.dvAttenuation1 = 0.0f;
- light.dvAttenuation2 = 0.0f;
- obj = m_light->CreateLight();
- m_light->SetLight(obj, light);
+ Gfx::Light light;
+ light.type = Gfx::LIGHT_SPOT;
+ light.diffuse = color;
+ light.position = pos;
+ light.direction = Math::Vector(0.0f, -1.0f, 0.0f);
+ light.spotIntensity = 1.0f;
+ light.spotAngle = 90.0f*Math::PI/180.0f;
+ light.attenuation0 = 2.0f;
+ light.attenuation1 = 0.0f;
+ light.attenuation2 = 0.0f;
+ int obj = m_lightMan->CreateLight();
+ m_lightMan->SetLight(obj, light);
return obj;
}
-// Change the colors and textures.
-
+//! Change the colors and textures
void CRobotMain::ChangeColor()
{
- D3DCOLORVALUE colorRef1, colorNew1, colorRef2, colorNew2;
- Math::Point ts, ti;
- Math::Point exclu[6];
- char name[100];
- int face;
- float tolerance;
+ Math::Point ts = Math::Point(0.0f, 0.0f);
+ Math::Point ti = Math::Point(1.0f, 1.0f); // the entire image
- ts = Math::Point(0.0f, 0.0f);
- ti = Math::Point(1.0f, 1.0f); // the entire image
+ Gfx::Color colorRef1, colorNew1, colorRef2, colorNew2;
colorRef1.a = 0.0f;
colorRef2.a = 0.0f;
@@ -5367,61 +4874,67 @@ 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();
+
+ Math::Point exclu[6];
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);
exclu[3] = Math::Point(256.0f/256.0f, 256.0f/256.0f); // SatCom screen
exclu[4] = Math::Point(0.0f, 0.0f);
exclu[5] = Math::Point(0.0f, 0.0f); // terminator
- m_engine->ChangeColor("human.tga", colorRef1, colorNew1, colorRef2, colorNew2, 0.30f, 0.01f, ts, ti, exclu);
+ // TODO: m_engine->ChangeColor("human.png", colorRef1, colorNew1, colorRef2, colorNew2, 0.30f, 0.01f, ts, ti, exclu);
- face = RetGamerFace();
- if ( face == 0 ) // normal?
+ float tolerance;
+
+ int face = GetGamerFace();
+ if (face == 0) // normal?
{
colorRef1.r = 90.0f/256.0f;
colorRef1.g = 95.0f/256.0f;
colorRef1.b = 85.0f/256.0f; // black
tolerance = 0.15f;
}
- if ( face == 1 ) // bald?
+ if (face == 1) // bald?
{
colorRef1.r = 74.0f/256.0f;
colorRef1.g = 58.0f/256.0f;
colorRef1.b = 46.0f/256.0f; // brown
tolerance = 0.20f;
}
- if ( face == 2 ) // carlos?
+ if (face == 2) // carlos?
{
colorRef1.r = 70.0f/256.0f;
colorRef1.g = 40.0f/256.0f;
colorRef1.b = 8.0f/256.0f; // brown
tolerance = 0.30f;
}
- if ( face == 3 ) // blonde?
+ if (face == 3) // blonde?
{
colorRef1.r = 74.0f/256.0f;
colorRef1.g = 16.0f/256.0f;
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;
colorNew2.r = 0.0f;
colorNew2.g = 0.0f;
colorNew2.b = 0.0f;
- sprintf(name, "face%.2d.tga", face+1);
+
+ char name[100];
+ sprintf(name, "face%.2d.png", face+1);
exclu[0] = Math::Point(105.0f/256.0f, 47.0f/166.0f);
exclu[1] = Math::Point(153.0f/256.0f, 79.0f/166.0f); // blue canister
exclu[2] = Math::Point(0.0f, 0.0f);
exclu[3] = Math::Point(0.0f, 0.0f); // terminator
- m_engine->ChangeColor(name, colorRef1, colorNew1, colorRef2, colorNew2, tolerance, 0.00f, ts, ti, exclu);
+ // TODO: m_engine->ChangeColor(name, colorRef1, colorNew1, colorRef2, colorNew2, tolerance, 0.00f, ts, ti, exclu);
colorRef2.r = 0.0f;
colorRef2.g = 0.0f;
@@ -5430,19 +4943,19 @@ void CRobotMain::ChangeColor()
colorNew2.g = 0.0f;
colorNew2.b = 0.0f;
- m_engine->ChangeColor("base1.tga", m_colorRefBot, m_colorNewBot, colorRef2, colorNew2, 0.10f, -1.0f, ts, ti, 0, 0, true);
- m_engine->ChangeColor("convert.tga", m_colorRefBot, m_colorNewBot, colorRef2, colorNew2, 0.10f, -1.0f, ts, ti, 0, 0, true);
- m_engine->ChangeColor("derrick.tga", m_colorRefBot, m_colorNewBot, colorRef2, colorNew2, 0.10f, -1.0f, ts, ti, 0, 0, true);
- m_engine->ChangeColor("factory.tga", m_colorRefBot, m_colorNewBot, colorRef2, colorNew2, 0.10f, -1.0f, ts, ti, 0, 0, true);
- m_engine->ChangeColor("lemt.tga", m_colorRefBot, m_colorNewBot, colorRef2, colorNew2, 0.10f, -1.0f, ts, ti, 0, 0, true);
- m_engine->ChangeColor("roller.tga", m_colorRefBot, m_colorNewBot, colorRef2, colorNew2, 0.10f, -1.0f, ts, ti, 0, 0, true);
- m_engine->ChangeColor("search.tga", m_colorRefBot, m_colorNewBot, colorRef2, colorNew2, 0.10f, -1.0f, ts, ti, 0, 0, true);
+ // TODO: m_engine->ChangeColor("base1.png", m_colorRefBot, m_colorNewBot, colorRef2, colorNew2, 0.10f, -1.0f, ts, ti, 0, 0, true);
+ // TODO: m_engine->ChangeColor("convert.png", m_colorRefBot, m_colorNewBot, colorRef2, colorNew2, 0.10f, -1.0f, ts, ti, 0, 0, true);
+ // TODO: m_engine->ChangeColor("derrick.png", m_colorRefBot, m_colorNewBot, colorRef2, colorNew2, 0.10f, -1.0f, ts, ti, 0, 0, true);
+ // TODO: m_engine->ChangeColor("factory.png", m_colorRefBot, m_colorNewBot, colorRef2, colorNew2, 0.10f, -1.0f, ts, ti, 0, 0, true);
+ // TODO: m_engine->ChangeColor("lemt.png", m_colorRefBot, m_colorNewBot, colorRef2, colorNew2, 0.10f, -1.0f, ts, ti, 0, 0, true);
+ // TODO: m_engine->ChangeColor("roller.png", m_colorRefBot, m_colorNewBot, colorRef2, colorNew2, 0.10f, -1.0f, ts, ti, 0, 0, true);
+ // TODO: m_engine->ChangeColor("search.png", m_colorRefBot, m_colorNewBot, colorRef2, colorNew2, 0.10f, -1.0f, ts, ti, 0, 0, true);
exclu[0] = Math::Point( 0.0f/256.0f, 160.0f/256.0f);
exclu[1] = Math::Point(256.0f/256.0f, 256.0f/256.0f); // pencils
exclu[2] = Math::Point(0.0f, 0.0f);
exclu[3] = Math::Point(0.0f, 0.0f); // terminator
- m_engine->ChangeColor("drawer.tga", m_colorRefBot, m_colorNewBot, colorRef2, colorNew2, 0.10f, -1.0f, ts, ti, exclu, 0, true);
+ // TODO: m_engine->ChangeColor("drawer.png", m_colorRefBot, m_colorNewBot, colorRef2, colorNew2, 0.10f, -1.0f, ts, ti, exclu, 0, true);
exclu[0] = Math::Point(237.0f/256.0f, 176.0f/256.0f);
exclu[1] = Math::Point(256.0f/256.0f, 220.0f/256.0f); // blue canister
@@ -5450,35 +4963,31 @@ void CRobotMain::ChangeColor()
exclu[3] = Math::Point(130.0f/256.0f, 214.0f/256.0f); // safe location
exclu[4] = Math::Point(0.0f, 0.0f);
exclu[5] = Math::Point(0.0f, 0.0f); // terminator
- m_engine->ChangeColor("subm.tga", m_colorRefBot, m_colorNewBot, colorRef2, colorNew2, 0.10f, -1.0f, ts, ti, exclu, 0, true);
+ // TODO: m_engine->ChangeColor("subm.png", m_colorRefBot, m_colorNewBot, colorRef2, colorNew2, 0.10f, -1.0f, ts, ti, exclu, 0, true);
exclu[0] = Math::Point(128.0f/256.0f, 160.0f/256.0f);
exclu[1] = Math::Point(256.0f/256.0f, 256.0f/256.0f); // SatCom
exclu[2] = Math::Point(0.0f, 0.0f);
exclu[3] = Math::Point(0.0f, 0.0f); // terminator
- m_engine->ChangeColor("ant.tga", m_colorRefAlien, m_colorNewAlien, colorRef2, colorNew2, 0.50f, -1.0f, ts, ti, exclu);
- m_engine->ChangeColor("mother.tga", m_colorRefAlien, m_colorNewAlien, colorRef2, colorNew2, 0.50f, -1.0f, ts, ti);
+ // TODO: m_engine->ChangeColor("ant.png", m_colorRefAlien, m_colorNewAlien, colorRef2, colorNew2, 0.50f, -1.0f, ts, ti, exclu);
+ // TODO: m_engine->ChangeColor("mother.png", m_colorRefAlien, m_colorNewAlien, colorRef2, colorNew2, 0.50f, -1.0f, ts, ti);
- m_engine->ChangeColor("plant.tga", m_colorRefGreen, m_colorNewGreen, colorRef2, colorNew2, 0.50f, -1.0f, ts, ti);
+ // TODO: m_engine->ChangeColor("plant.png", m_colorRefGreen, m_colorNewGreen, colorRef2, colorNew2, 0.50f, -1.0f, ts, ti);
// PARTIPLOUF0 and PARTIDROP :
ts = Math::Point(0.500f, 0.500f);
ti = Math::Point(0.875f, 0.750f);
- m_engine->ChangeColor("effect00.tga", m_colorRefWater, m_colorNewWater, colorRef2, colorNew2, 0.20f, -1.0f, ts, ti, 0, m_colorShiftWater, true);
+ // TODO: m_engine->ChangeColor("effect00.png", m_colorRefWater, m_colorNewWater, colorRef2, colorNew2, 0.20f, -1.0f, ts, ti, 0, m_colorShiftWater, true);
// PARTIFLIC :
ts = Math::Point(0.00f, 0.75f);
ti = Math::Point(0.25f, 1.00f);
- m_engine->ChangeColor("effect02.tga", m_colorRefWater, m_colorNewWater, colorRef2, colorNew2, 0.20f, -1.0f, ts, ti, 0, m_colorShiftWater, true);
+ // TODO: m_engine->ChangeColor("effect02.png", m_colorRefWater, m_colorNewWater, colorRef2, colorNew2, 0.20f, -1.0f, ts, ti, 0, m_colorShiftWater, true);
}
-// Updates the number of unnecessary objects.
-
+//! Updates the number of unnecessary objects
bool CRobotMain::TestGadgetQuantity(int rank)
{
- float percent;
- int *table;
-
static int table10[10] = {0,1,0,0,0,0,0,0,0,0};
static int table20[10] = {0,1,0,0,0,1,0,0,0,0};
static int table30[10] = {0,1,0,1,0,1,0,0,0,0};
@@ -5489,109 +4998,102 @@ 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();
- if ( percent == 0.0f ) return false;
- if ( percent == 1.0f ) return true;
-
- if ( percent <= 0.15f ) table = table10;
- else if ( percent <= 0.25f ) table = table20;
- else if ( percent <= 0.35f ) table = table30;
- else if ( percent <= 0.45f ) table = table40;
- else if ( percent <= 0.55f ) table = table50;
- else if ( percent <= 0.65f ) table = table60;
- else if ( percent <= 0.75f ) table = table70;
- else if ( percent <= 0.85f ) table = table80;
- else table = table90;
+ float percent = m_engine->GetGadgetQuantity();
+ if (percent == 0.0f) return false;
+ if (percent == 1.0f) return true;
+
+ int *table;
+ if (percent <= 0.15f) table = table10;
+ else if (percent <= 0.25f) table = table20;
+ else if (percent <= 0.35f) table = table30;
+ else if (percent <= 0.45f) table = table40;
+ else if (percent <= 0.55f) table = table50;
+ else if (percent <= 0.65f) table = table60;
+ else if (percent <= 0.75f) table = table70;
+ else if (percent <= 0.85f) table = table80;
+ else table = table90;
return table[rank%10];
}
-// Calculates the distance to the nearest object.
-
+//! Calculates the distance to the nearest object
float CRobotMain::SearchNearestObject(Math::Vector center, CObject *exclu)
{
- CObject* pObj;
- ObjectType type;
- Math::Vector oPos;
- float min, dist, oRadius;
- int i, j;
-
- min = 100000.0f;
- for ( i=0 ; i<1000000 ; i++ )
+ float min = 100000.0f;
+ for (int i = 0; i < 1000000; i++)
{
- pObj = (CObject*)m_iMan->SearchInstance(CLASS_OBJECT, i);
- if ( pObj == 0 ) break;
+ CObject* obj = static_cast<CObject*>(m_iMan->SearchInstance(CLASS_OBJECT, i));
+ if (obj == nullptr) break;
- if ( !pObj->RetActif() ) continue; // inactive?
- if ( pObj->RetTruck() != 0 ) continue; // object carries?
- if ( pObj == exclu ) continue;
+ if (!obj->GetActif()) continue; // inactive?
+ if (obj->GetTruck() != nullptr) continue; // object carries?
+ if (obj == exclu) continue;
- type = pObj->RetType();
+ ObjectType type = obj->GetType();
- if ( type == OBJECT_BASE )
+ if (type == OBJECT_BASE)
{
- oPos = pObj->RetPosition(0);
- if ( oPos.x != center.x ||
- oPos.z != center.z )
+ Math::Vector oPos = obj->GetPosition(0);
+ if (oPos.x != center.x ||
+ oPos.z != center.z)
{
- dist = Math::Distance(center, oPos)-80.0f;
- if ( dist < 0.0f ) dist = 0.0f;
+ float dist = Math::Distance(center, oPos)-80.0f;
+ if (dist < 0.0f) dist = 0.0f;
min = Math::Min(min, dist);
continue;
}
}
- if ( type == OBJECT_STATION ||
- type == OBJECT_REPAIR ||
- type == OBJECT_DESTROYER )
+ if (type == OBJECT_STATION ||
+ type == OBJECT_REPAIR ||
+ type == OBJECT_DESTROYER)
{
- oPos = pObj->RetPosition(0);
- dist = Math::Distance(center, oPos)-8.0f;
- if ( dist < 0.0f ) dist = 0.0f;
+ Math::Vector oPos = obj->GetPosition(0);
+ float dist = Math::Distance(center, oPos)-8.0f;
+ if (dist < 0.0f) dist = 0.0f;
min = Math::Min(min, dist);
}
- j = 0;
- while ( pObj->GetCrashSphere(j++, oPos, oRadius) )
+ int j = 0;
+ Math::Vector oPos;
+ float oRadius;
+ while (obj->GetCrashSphere(j++, oPos, oRadius))
{
- dist = Math::Distance(center, oPos)-oRadius;
- if ( dist < 0.0f ) dist = 0.0f;
+ float dist = Math::Distance(center, oPos)-oRadius;
+ if (dist < 0.0f) dist = 0.0f;
min = Math::Min(min, dist);
}
}
return min;
}
-// Calculates a free space.
-
+//! Calculates a free space
bool CRobotMain::FreeSpace(Math::Vector &center, float minRadius, float maxRadius,
float space, CObject *exclu)
{
- Math::Vector pos;
- Math::Point p;
- float radius, ia, angle, dist, flat;
-
- if ( minRadius < maxRadius ) // from internal to external?
+ if (minRadius < maxRadius) // from internal to external?
{
- for ( radius=minRadius ; radius<=maxRadius ; radius+=space )
+ for (float radius = minRadius; radius <= maxRadius; radius += space)
{
- ia = space/radius;
- for ( angle=0.0f ; angle<Math::PI*2.0f ; angle+=ia )
+ float ia = space/radius;
+ for (float angle = 0.0f; angle < Math::PI*2.0f; angle += ia)
{
+ Math::Point p;
p.x = center.x+radius;
p.y = center.z;
p = Math::RotatePoint(Math::Point(center.x, center.z), angle, p);
+ Math::Vector pos;
pos.x = p.x;
pos.z = p.y;
pos.y = 0.0f;
- m_terrain->MoveOnFloor(pos, true);
- dist = SearchNearestObject(pos, exclu);
- if ( dist >= space )
+ m_terrain->AdjustToFloor(pos, true);
+ float dist = SearchNearestObject(pos, exclu);
+ if (dist >= space)
{
- flat = m_terrain->RetFlatZoneRadius(pos, dist/2.0f);
- if ( flat >= dist/2.0f )
+ float flat = m_terrain->GetFlatZoneRadius(pos, dist/2.0f);
+ if (flat >= dist/2.0f)
{
center = pos;
return true;
@@ -5602,23 +5104,25 @@ bool CRobotMain::FreeSpace(Math::Vector &center, float minRadius, float maxRadiu
}
else // from external to internal?
{
- for ( radius=maxRadius ; radius>=minRadius ; radius-=space )
+ for (float radius=maxRadius; radius >= minRadius; radius -= space)
{
- ia = space/radius;
- for ( angle=0.0f ; angle<Math::PI*2.0f ; angle+=ia )
+ float ia = space/radius;
+ for (float angle=0.0f ; angle<Math::PI*2.0f ; angle+=ia )
{
+ Math::Point p;
p.x = center.x+radius;
p.y = center.z;
p = Math::RotatePoint(Math::Point(center.x, center.z), angle, p);
+ Math::Vector pos;
pos.x = p.x;
pos.z = p.y;
pos.y = 0.0f;
- m_terrain->MoveOnFloor(pos, true);
- dist = SearchNearestObject(pos, exclu);
- if ( dist >= space )
+ m_terrain->AdjustToFloor(pos, true);
+ float dist = SearchNearestObject(pos, exclu);
+ if (dist >= space)
{
- flat = m_terrain->RetFlatZoneRadius(pos, dist/2.0f);
- if ( flat >= dist/2.0f )
+ float flat = m_terrain->GetFlatZoneRadius(pos, dist/2.0f);
+ if (flat >= dist/2.0f)
{
center = pos;
return true;
@@ -5630,79 +5134,71 @@ bool CRobotMain::FreeSpace(Math::Vector &center, float minRadius, float maxRadiu
return false;
}
-// Calculates the maximum radius of a free space.
-
-float CRobotMain::RetFlatZoneRadius(Math::Vector center, float maxRadius,
+//! Calculates the maximum radius of a free space
+float CRobotMain::GetFlatZoneRadius(Math::Vector center, float maxRadius,
CObject *exclu)
{
- float dist;
-
- dist = SearchNearestObject(center, exclu);
- if ( dist == 0.0f ) return 0.0f;
- if ( dist < maxRadius )
- {
+ float dist = SearchNearestObject(center, exclu);
+ if (dist == 0.0f) return 0.0f;
+ if (dist < maxRadius)
maxRadius = dist;
- }
- return m_terrain->RetFlatZoneRadius(center, maxRadius);
-}
+ return m_terrain->GetFlatZoneRadius(center, maxRadius);
+}
-// Hides buildable area when a cube of metal is taken up.
+//! Hides buildable area when a cube of metal is taken up
void CRobotMain::HideDropZone(CObject* metal)
{
- if ( m_showLimit[1].bUsed &&
- m_showLimit[1].link == metal )
+ if (m_showLimit[1].used &&
+ m_showLimit[1].link == metal)
{
FlushShowLimit(1);
}
- if ( m_showLimit[2].bUsed &&
- m_showLimit[2].link == metal )
+ if (m_showLimit[2].used &&
+ m_showLimit[2].link == metal)
{
FlushShowLimit(2);
}
}
-// Shows the buildable area when a cube of metal is deposited.
-
+//! Shows the buildable area when a cube of metal is deposited
void CRobotMain::ShowDropZone(CObject* metal, CObject* truck)
{
- CObject* pObj;
- ObjectType type;
- Math::Vector center, oPos;
- float oMax, tMax, dist, oRadius, radius;
- int i, j;
+ if (metal == nullptr) return;
- if ( metal == 0 ) return;
-
- center = metal->RetPosition(0);
+ Math::Vector center = metal->GetPosition(0);
// Calculates the maximum radius possible depending on other items.
- oMax = 30.0f; // radius to build the biggest building
- for ( i=0 ; i<1000000 ; i++ )
+ float oMax = 30.0f; // radius to build the biggest building
+ float tMax;
+ for (int i = 0; i < 1000000; i++)
{
- pObj = (CObject*)m_iMan->SearchInstance(CLASS_OBJECT, i);
- if ( pObj == 0 ) break;
+ CObject* obj = static_cast<CObject*>(m_iMan->SearchInstance(CLASS_OBJECT, i));
+ if (obj == nullptr) break;
- if ( !pObj->RetActif() ) continue; // inactive?
- if ( pObj->RetTruck() != 0 ) continue; // object carried?
- if ( pObj == metal ) continue;
- if ( pObj == truck ) continue;
+ if (!obj->GetActif()) continue; // inactive?
+ if (obj->GetTruck() != nullptr) continue; // object carried?
+ if (obj == metal) continue;
+ if (obj == truck) continue;
- type = pObj->RetType();
- if ( type == OBJECT_BASE )
+ Math::Vector oPos;
+ float oRadius;
+
+ ObjectType type = obj->GetType();
+ if (type == OBJECT_BASE)
{
- oPos = pObj->RetPosition(0);
- dist = Math::Distance(center, oPos)-80.0f;
+ oPos = obj->GetPosition(0);
+ float dist = Math::Distance(center, oPos)-80.0f;
oMax = Math::Min(oMax, dist);
}
else
{
- j = 0;
- while ( pObj->GetCrashSphere(j++, oPos, oRadius) )
+ int j = 0;
+ while (obj->GetCrashSphere(j++, oPos, oRadius))
{
- dist = Math::Distance(center, oPos)-oRadius;
+ float dist = Math::Distance(center, oPos)-oRadius;
oMax = Math::Min(oMax, dist);
}
}
@@ -5726,70 +5222,58 @@ void CRobotMain::ShowDropZone(CObject* metal, CObject* truck)
type == OBJECT_SAFE ||
type == OBJECT_HUSTON ) // building?
{
- j = 0;
- while ( pObj->GetCrashSphere(j++, oPos, oRadius) )
+ int j = 0;
+ while (obj->GetCrashSphere(j++, oPos, oRadius))
{
- dist = Math::Distance(center, oPos)-oRadius-BUILDMARGIN;
+ float dist = Math::Distance(center, oPos)-oRadius-BUILDMARGIN;
oMax = Math::Min(oMax, dist);
}
}
}
// Calculates the maximum possible radius depending on terrain.
- if ( oMax >= 2.0f )
- {
- tMax = m_terrain->RetFlatZoneRadius(center, 30.0f);
- }
+ if (oMax >= 2.0f)
+ tMax = m_terrain->GetFlatZoneRadius(center, 30.0f);
else
- {
tMax = 0.0f;
- }
- radius = Math::Min(oMax, tMax);
- if ( radius >= 2.0f )
- {
- SetShowLimit(1, PARTILIMIT2, metal, center, radius, 10.0f);
- }
+ float radius = Math::Min(oMax, tMax);
+ if (radius >= 2.0f)
+ SetShowLimit(1, Gfx::PARTILIMIT2, metal, center, radius, 10.0f);
}
-// Erases the boundaries shown.
-
+//! Erases the boundaries shown
void CRobotMain::FlushShowLimit(int i)
{
- int j;
-
- if ( m_showLimit[i].link != 0 )
+ if (m_showLimit[i].link != 0)
{
m_showLimit[i].link->StopShowLimit();
}
- for ( j=0 ; j<m_showLimit[i].total ; j++ )
+ for (int j = 0; j < m_showLimit[i].total; j++)
{
- if ( m_showLimit[i].parti[j] == 0 ) continue;
+ if (m_showLimit[i].parti[j] == 0) continue;
- m_particule->DeleteParticule(m_showLimit[i].parti[j]);
+ m_particle->DeleteParticle(m_showLimit[i].parti[j]);
m_showLimit[i].parti[j] = 0;
}
m_showLimit[i].total = 0;
m_showLimit[i].link = 0;
- m_showLimit[i].bUsed = false;
+ m_showLimit[i].used = false;
}
-// Specifies the boundaries to show.
-
-void CRobotMain::SetShowLimit(int i, ParticuleType parti, CObject *pObj,
+//! Specifies the boundaries to show
+void CRobotMain::SetShowLimit(int i, Gfx::ParticleType parti, CObject *obj,
Math::Vector pos, float radius, float duration)
{
- Math::Point dim;
- float dist;
- int j;
-
FlushShowLimit(i); // erases the current boundaries
- if ( radius <= 0.0f ) return;
+ if (radius <= 0.0f) return;
- if ( radius <= 50.0f )
+ Math::Point dim;
+ float dist;
+ if (radius <= 50.0f)
{
dim = Math::Point(0.3f, 0.3f);
dist = 2.5f;
@@ -5800,98 +5284,85 @@ void CRobotMain::SetShowLimit(int i, ParticuleType parti, CObject *pObj,
dist = 10.0f;
}
- m_showLimit[i].bUsed = true;
- m_showLimit[i].link = pObj;
+ m_showLimit[i].used = true;
+ m_showLimit[i].link = obj;
m_showLimit[i].pos = pos;
m_showLimit[i].radius = radius;
m_showLimit[i].duration = duration;
- m_showLimit[i].total = (int)((radius*2.0f*Math::PI)/dist);
- if ( m_showLimit[i].total > MAXSHOWPARTI ) m_showLimit[i].total = MAXSHOWPARTI;
+ m_showLimit[i].total = static_cast<int>((radius*2.0f*Math::PI)/dist);
+ if (m_showLimit[i].total > MAXSHOWPARTI) m_showLimit[i].total = MAXSHOWPARTI;
m_showLimit[i].time = 0.0f;
- for ( j=0 ; j<m_showLimit[i].total ; j++ )
+ for (int j = 0; j < m_showLimit[i].total; j++)
{
- m_showLimit[i].parti[j] = m_particule->CreateParticule(pos, Math::Vector(0.0f, 0.0f, 0.0f), dim, parti, duration);
+ m_showLimit[i].parti[j] = m_particle->CreateParticle(pos, Math::Vector(0.0f, 0.0f, 0.0f), dim, parti, duration);
}
}
-// Adjusts the boundaries to show.
-
+//! Adjusts the boundaries to show
void CRobotMain::AdjustShowLimit(int i, Math::Vector pos)
{
m_showLimit[i].pos = pos;
}
-// Mount the boundaries of the selected object.
-
+//! Mount the boundaries of the selected object
void CRobotMain::StartShowLimit()
{
- CObject* pObj;
+ CObject* obj = GetSelect();
+ if (obj == nullptr) return;
- pObj = RetSelect();
- if ( pObj == 0 ) return;
-
- pObj->StartShowLimit();
+ obj->StartShowLimit();
}
-// Advances the boundaries shown.
-
+//! Advances the boundaries shown
void CRobotMain::FrameShowLimit(float rTime)
{
- Math::Vector pos;
- Math::Point center, rotate;
- float angle, factor, speed;
- int i, j;
-
- if ( m_engine->RetPause() ) return;
+ if (m_engine->GetPause()) return;
- for ( i=0 ; i<MAXSHOWLIMIT ; i++ )
+ for (int i = 0; i < MAXSHOWLIMIT; i++)
{
- if ( !m_showLimit[i].bUsed ) continue;
+ if (!m_showLimit[i].used) continue;
m_showLimit[i].time += rTime;
- if ( m_showLimit[i].time >= m_showLimit[i].duration )
+ if (m_showLimit[i].time >= m_showLimit[i].duration)
{
FlushShowLimit(i);
continue;
}
- if ( m_showLimit[i].time < 1.0f )
- {
+ float factor;
+ if (m_showLimit[i].time < 1.0f)
factor = m_showLimit[i].time;
- }
- else if ( m_showLimit[i].time > m_showLimit[i].duration-1.0f )
- {
+ else if (m_showLimit[i].time > m_showLimit[i].duration-1.0f)
factor = m_showLimit[i].duration-m_showLimit[i].time;
- }
else
- {
factor = 1.0f;
- }
- speed = 0.4f-m_showLimit[i].radius*0.001f;
- if ( speed < 0.1f ) speed = 0.1f;
- angle = m_showLimit[i].time*speed;
+ float speed = 0.4f-m_showLimit[i].radius*0.001f;
+ if (speed < 0.1f) speed = 0.1f;
+ float angle = m_showLimit[i].time*speed;
- for ( j=0 ; j<m_showLimit[i].total ; j++ )
+ for (int j = 0; j < m_showLimit[i].total; j++)
{
- if ( m_showLimit[i].parti[j] == 0 ) continue;
+ if (m_showLimit[i].parti[j] == 0) continue;
+ Math::Point center;
center.x = m_showLimit[i].pos.x;
center.y = m_showLimit[i].pos.z;
+ Math::Point rotate;
rotate.x = center.x+m_showLimit[i].radius*factor;
rotate.y = center.y;
rotate = Math::RotatePoint(center, angle, rotate);
+ Math::Vector pos;
pos.x = rotate.x;
pos.z = rotate.y;
pos.y = 0.0f;
- m_terrain->MoveOnFloor(pos, true);
- if ( m_showLimit[i].radius <= 50.0f ) pos.y += 0.5f;
- else pos.y += 2.0f;
- m_particule->SetPosition(m_showLimit[i].parti[j], pos);
-//? m_particule->SetAngle(m_showLimit[i].parti[j], angle-Math::PI/2.0f);
+ m_terrain->AdjustToFloor(pos, true);
+ if (m_showLimit[i].radius <= 50.0f) pos.y += 0.5f;
+ else pos.y += 2.0f;
+ m_particle->SetPosition(m_showLimit[i].parti[j], pos);
angle += (2.0f*Math::PI)/m_showLimit[i].total;
}
@@ -5900,77 +5371,72 @@ void CRobotMain::FrameShowLimit(float rTime)
-// Returns a pointer to the last backslash in a filename.
-
+//! Returns a pointer to the last backslash in a filename.
char* SearchLastDir(char *filename)
{
- char* p = filename;
+ char* p = filename;
- while ( *p++ != 0 );
+ while (*p++ != 0);
p --; // ^on the zero terminator
- while ( p != filename )
+ while (p != filename)
{
- if ( *(--p) == '\\' ) return p;
+ if (*(--p) == '\\') return p;
}
return 0;
}
-// Compiles all scripts of robots.
-
-void CRobotMain::CompileScript(bool bSoluce)
+//! Compiles all scripts of robots
+void CRobotMain::CompileScript(bool soluce)
{
- CObject* pObj;
- CBrain* brain;
- int i, j, nbError, lastError, run;
- char* name;
+ int nbError = 0;
+ int lastError = 0;
- nbError = 0;
do
{
lastError = nbError;
nbError = 0;
- for ( i=0 ; i<1000000 ; i++ )
+ for (int i = 0; i < 1000000; i++)
{
- pObj = (CObject*)m_iMan->SearchInstance(CLASS_OBJECT, i);
- if ( pObj == 0 ) break;
- if ( pObj->RetTruck() != 0 ) continue;
+ CObject* obj = static_cast<CObject*>(m_iMan->SearchInstance(CLASS_OBJECT, i));
+ if (obj == nullptr) break;
+ if (obj->GetTruck() != nullptr) continue;
- brain = pObj->RetBrain();
- if ( brain == 0 ) continue;
+ CBrain* brain = obj->GetBrain();
+ if (brain == nullptr) continue;
- for ( j=0 ; j<10 ; j++ )
+ for (int j = 0; j < 10; j++)
{
- if ( brain->RetCompile(j) ) continue;
+ if (brain->GetCompile(j)) continue;
- name = brain->RetScriptName(j);
- if ( name[0] != 0 )
+ char* name = brain->GetScriptName(j);
+ if (name[0] != 0)
{
brain->ReadProgram(j, name);
- if ( !brain->RetCompile(j) ) nbError++;
+ if (!brain->GetCompile(j)) nbError++;
}
}
- LoadOneScript(pObj, nbError);
+ LoadOneScript(obj, nbError);
}
}
- while ( nbError > 0 && nbError != lastError );
+ while (nbError > 0 && nbError != lastError);
// Load all solutions.
- if ( bSoluce )
+ if (soluce)
{
- for ( i=0 ; i<1000000 ; i++ )
+ for (int i = 0; i < 1000000; i++)
{
- pObj = (CObject*)m_iMan->SearchInstance(CLASS_OBJECT, i);
- if ( pObj == 0 ) break;
- if ( pObj->RetTruck() != 0 ) continue;
+ CObject* obj = static_cast<CObject*>(m_iMan->SearchInstance(CLASS_OBJECT, i));
+ if (obj == 0) break;
+ if (obj->GetTruck() != 0) continue;
- brain = pObj->RetBrain();
- if ( brain == 0 ) continue;
+ CBrain* brain = obj->GetBrain();
+ if (brain == 0) continue;
- name = brain->RetSoluceName();
- if ( name[0] != 0 )
+ char* name = brain->GetSoluceName();
+ if (name[0] != 0)
{
brain->ReadSoluce(name); // load solution
}
@@ -5978,241 +5444,189 @@ void CRobotMain::CompileScript(bool bSoluce)
}
// Start all programs according to the command "run".
- for ( i=0 ; i<1000000 ; i++ )
+ for (int i = 0; i < 1000000; i++)
{
- pObj = (CObject*)m_iMan->SearchInstance(CLASS_OBJECT, i);
- if ( pObj == 0 ) break;
- if ( pObj->RetTruck() != 0 ) continue;
+ CObject* obj = static_cast<CObject*>(m_iMan->SearchInstance(CLASS_OBJECT, i));
+ if (obj == nullptr) break;
+ if (obj->GetTruck() != nullptr) continue;
- brain = pObj->RetBrain();
- if ( brain == 0 ) continue;
+ CBrain* brain = obj->GetBrain();
+ if (brain == nullptr) continue;
- run = brain->RetScriptRun();
- if ( run != -1 )
+ int run = brain->GetScriptRun();
+ if (run != -1)
{
brain->RunProgram(run); // starts the program
}
}
}
-// Load all programs of the robot.
-
-void CRobotMain::LoadOneScript(CObject *pObj, int &nbError)
+//! Load all programs of the robot
+void CRobotMain::LoadOneScript(CObject *obj, int &nbError)
{
- ObjectType type;
- CBrain* brain;
- char filename[_MAX_FNAME];
- char* name;
- int rank, i, objRank;
-
- brain = pObj->RetBrain();
- if ( brain == 0 ) return;
+ CBrain* brain = obj->GetBrain();
+ if (brain == nullptr) return;
- if ( !IsSelectable(pObj) ) return;
+ if (!IsSelectable(obj)) return;
- type = pObj->RetType();
- if ( type == OBJECT_HUMAN ) return;
+ ObjectType type = obj->GetType();
+ if (type == OBJECT_HUMAN) return;
- objRank = pObj->RetDefRank();
- if ( objRank == -1 ) return;
+ int objRank = obj->GetDefRank();
+ if (objRank == -1) return;
- name = m_dialog->RetSceneName();
- rank = m_dialog->RetSceneRank();
+ char* name = m_dialog->GetSceneName();
+ int rank = m_dialog->GetSceneRank();
- for ( i=0 ; i<BRAINMAXSCRIPT ; i++ )
+ for (int i = 0; i < BRAINMAXSCRIPT; i++)
{
- if ( brain->RetCompile(i) ) continue;
-//? if ( brain->ProgramExist(i) ) continue;
+ if (brain->GetCompile(i)) continue;
+ char filename[MAX_FNAME];
sprintf(filename, "%s\\%s\\%c%.3d%.3d%.1d.txt",
- RetSavegameDir(), m_gamerName, name[0], rank, objRank, i);
+ GetSavegameDir(), m_gamerName, name[0], rank, objRank, i);
brain->ReadProgram(i, filename);
- if ( !brain->RetCompile(i) ) nbError++;
+ if (!brain->GetCompile(i)) nbError++;
}
}
-// Load all programs of the robot.
-
-void CRobotMain::LoadFileScript(CObject *pObj, char* filename, int objRank,
+//! Load all programs of the robot
+void CRobotMain::LoadFileScript(CObject *obj, char* filename, int objRank,
int &nbError)
{
- ObjectType type;
- CBrain* brain;
- char fn[_MAX_FNAME];
- char* ldir;
- char* name;
- int rank, i;
-
- if ( objRank == -1 ) return;
+ if (objRank == -1) return;
- brain = pObj->RetBrain();
- if ( brain == 0 ) return;
+ CBrain* brain = obj->GetBrain();
+ if (brain == nullptr) return;
- type = pObj->RetType();
- if ( type == OBJECT_HUMAN ) return;
+ ObjectType type = obj->GetType();
+ if (type == OBJECT_HUMAN) return;
- name = m_dialog->RetSceneName();
- rank = m_dialog->RetSceneRank();
+ char fn[MAX_FNAME];
strcpy(fn, filename);
- ldir = SearchLastDir(fn);
- if ( ldir == 0 ) return;
+ char* ldir = SearchLastDir(fn);
+ if (ldir == 0) return;
- for ( i=0 ; i<BRAINMAXSCRIPT ; i++ )
+ for (int i = 0; i < BRAINMAXSCRIPT; i++)
{
- if ( brain->RetCompile(i) ) continue;
-//? if ( brain->ProgramExist(i) ) continue;
+ if (brain->GetCompile(i)) continue;
sprintf(ldir, "\\prog%.3d%.1d.txt", objRank, i);
brain->ReadProgram(i, fn);
- if ( !brain->RetCompile(i) ) nbError++;
+ if (!brain->GetCompile(i)) nbError++;
}
}
-// Saves all programs of all the robots.
-
+//! Saves all programs of all the robots
void CRobotMain::SaveAllScript()
{
- CObject* pObj;
- int i;
-
- for ( i=0 ; i<1000000 ; i++ )
+ for (int i = 0; i < 1000000; i++)
{
- pObj = (CObject*)m_iMan->SearchInstance(CLASS_OBJECT, i);
- if ( pObj == 0 ) break;
+ CObject* obj = static_cast<CObject*>(m_iMan->SearchInstance(CLASS_OBJECT, i));
+ if (obj == nullptr) break;
- SaveOneScript(pObj);
+ SaveOneScript(obj);
}
}
-// Saves all programs of the robot.
-// If a program does not exist, the corresponding file is destroyed.
-
-void CRobotMain::SaveOneScript(CObject *pObj)
+//! Saves all programs of the robot.
+//! If a program does not exist, the corresponding file is destroyed.
+void CRobotMain::SaveOneScript(CObject *obj)
{
- ObjectType type;
- CBrain* brain;
- char filename[_MAX_FNAME];
- char* name;
- int rank, i, objRank;
+ CBrain* brain = obj->GetBrain();
+ if (brain == nullptr) return;
- brain = pObj->RetBrain();
- if ( brain == 0 ) return;
+ if (!IsSelectable(obj)) return;
- if ( !IsSelectable(pObj) ) return;
+ ObjectType type = obj->GetType();
+ if (type == OBJECT_HUMAN) return;
- type = pObj->RetType();
- if ( type == OBJECT_HUMAN ) return;
+ int objRank = obj->GetDefRank();
+ if (objRank == -1) return;
- objRank = pObj->RetDefRank();
- if ( objRank == -1 ) return;
+ char* name = m_dialog->GetSceneName();
+ int rank = m_dialog->GetSceneRank();
- name = m_dialog->RetSceneName();
- rank = m_dialog->RetSceneRank();
-
- for ( i=0 ; i<BRAINMAXSCRIPT ; i++ )
+ for (int i = 0; i < BRAINMAXSCRIPT; i++)
{
+ char filename[MAX_FNAME];
sprintf(filename, "%s\\%s\\%c%.3d%.3d%.1d.txt",
- RetSavegameDir(), m_gamerName, name[0], rank, objRank, i);
+ GetSavegameDir(), m_gamerName, name[0], rank, objRank, i);
brain->WriteProgram(i, filename);
}
}
-// Saves all programs of the robot.
-// If a program does not exist, the corresponding file is destroyed.
-
-void CRobotMain::SaveFileScript(CObject *pObj, char* filename, int objRank)
+//! Saves all programs of the robot.
+//! If a program does not exist, the corresponding file is destroyed.
+void CRobotMain::SaveFileScript(CObject *obj, char* filename, int objRank)
{
- ObjectType type;
- CBrain* brain;
- char fn[_MAX_FNAME];
- char* ldir;
- char* name;
- int rank, i;
+ if (objRank == -1) return;
- if ( objRank == -1 ) return;
+ CBrain* brain = obj->GetBrain();
+ if (brain == nullptr) return;
- brain = pObj->RetBrain();
- if ( brain == 0 ) return;
-
- type = pObj->RetType();
- if ( type == OBJECT_HUMAN ) return;
-
- name = m_dialog->RetSceneName();
- rank = m_dialog->RetSceneRank();
+ ObjectType type = obj->GetType();
+ if (type == OBJECT_HUMAN) return;
+ char fn[MAX_FNAME];
strcpy(fn, filename);
- ldir = SearchLastDir(fn);
- if ( ldir == 0 ) return;
+ char* ldir = SearchLastDir(fn);
+ if (ldir == 0) return;
- for ( i=0 ; i<BRAINMAXSCRIPT ; i++ )
+ for (int i = 0; i < BRAINMAXSCRIPT; i++)
{
sprintf(ldir, "\\prog%.3d%.1d.txt", objRank, i);
brain->WriteProgram(i, fn);
}
}
-// Saves the stack of the program in execution of a robot.
-
-bool CRobotMain::SaveFileStack(CObject *pObj, FILE *file, int objRank)
+//! Saves the stack of the program in execution of a robot
+bool CRobotMain::SaveFileStack(CObject *obj, FILE *file, int objRank)
{
- ObjectType type;
- CBrain* brain;
-
- if ( objRank == -1 ) return true;
+ if (objRank == -1) return true;
- brain = pObj->RetBrain();
- if ( brain == 0 ) return true;
+ CBrain* brain = obj->GetBrain();
+ if (brain == nullptr) return true;
- type = pObj->RetType();
- if ( type == OBJECT_HUMAN ) return true;
+ ObjectType type = obj->GetType();
+ if (type == OBJECT_HUMAN) return true;
return brain->WriteStack(file);
}
-// Resumes the execution stack of the program in a robot.
-
-bool CRobotMain::ReadFileStack(CObject *pObj, FILE *file, int objRank)
+//! Resumes the execution stack of the program in a robot
+bool CRobotMain::ReadFileStack(CObject *obj, FILE *file, int objRank)
{
- ObjectType type;
- CBrain* brain;
+ if (objRank == -1) return true;
- if ( objRank == -1 ) return true;
+ CBrain* brain = obj->GetBrain();
+ if (brain == nullptr) return true;
- brain = pObj->RetBrain();
- if ( brain == 0 ) return true;
-
- type = pObj->RetType();
- if ( type == OBJECT_HUMAN ) return true;
+ ObjectType type = obj->GetType();
+ if (type == OBJECT_HUMAN) return true;
return brain->ReadStack(file);
}
-// Empty the list.
-
+//! Empty the list
bool CRobotMain::FlushNewScriptName()
{
- int i;
+ for (int i = 0; i < MAXNEWSCRIPTNAME; i++)
+ m_newScriptName[i].used = false;
- for ( i=0 ; i<MAXNEWSCRIPTNAME ; i++ )
- {
- m_newScriptName[i].bUsed = false;
- }
return true;
}
-// Adds a script name.
-
+//! Adds a script name
bool CRobotMain::AddNewScriptName(ObjectType type, char *name)
{
- int i;
-
- for ( i=0 ; i<MAXNEWSCRIPTNAME ; i++ )
+ for (int i = 0; i < MAXNEWSCRIPTNAME; i++)
{
- if ( !m_newScriptName[i].bUsed )
+ if (!m_newScriptName[i].used)
{
- m_newScriptName[i].bUsed = true;
+ m_newScriptName[i].used = true;
m_newScriptName[i].type = type;
strcpy(m_newScriptName[i].name, name);
return true;
@@ -6221,20 +5635,17 @@ bool CRobotMain::AddNewScriptName(ObjectType type, char *name)
return false;
}
-// Seeks a script name for a given type.
-
-char* CRobotMain::RetNewScriptName(ObjectType type, int rank)
+//! Seeks a script name for a given type
+char* CRobotMain::GetNewScriptName(ObjectType type, int rank)
{
- int i;
-
- for ( i=0 ; i<MAXNEWSCRIPTNAME ; i++ )
+ for (int i = 0; i < MAXNEWSCRIPTNAME; i++)
{
- if ( m_newScriptName[i].bUsed &&
- (m_newScriptName[i].type == type ||
- m_newScriptName[i].type == OBJECT_NULL ) )
+ if (m_newScriptName[i].used &&
+ (m_newScriptName[i].type == type ||
+ m_newScriptName[i].type == OBJECT_NULL))
{
- if ( rank == 0 ) return m_newScriptName[i].name;
- else rank --;
+ if (rank == 0) return m_newScriptName[i].name;
+ else rank --;
}
}
@@ -6242,122 +5653,108 @@ char* CRobotMain::RetNewScriptName(ObjectType type, int rank)
}
-// Seeks if an object occupies in a spot, to prevent a backup of the game.
-
+//! Seeks if an object occupies in a spot, to prevent a backup of the game
bool CRobotMain::IsBusy()
{
- CObject* pObj;
- CBrain* pBrain;
-//? CAuto* pAuto;
- int i;
-
- if ( m_CompteurFileOpen > 0 ) return true;
+ if (m_CompteurFileOpen > 0) return true;
- for ( i=0 ; i<1000000 ; i++ )
+ for (int i = 0; i < 1000000; i++)
{
- pObj = (CObject*)m_iMan->SearchInstance(CLASS_OBJECT, i);
- if ( pObj == 0 ) break;
+ CObject* obj = static_cast<CObject*>(m_iMan->SearchInstance(CLASS_OBJECT, i));
+ if (obj == nullptr) break;
- pBrain = pObj->RetBrain();
- if ( pBrain != 0 )
+ CBrain* brain = obj->GetBrain();
+ if (brain != nullptr)
{
- if ( pBrain->IsBusy() ) return true;
+ if (brain->IsBusy()) return true;
}
-
-//? pAuto = pObj->RetAuto();
-//? if ( pAuto != 0 )
-//? {
-//? if ( pAuto->RetBusy() ) return true;
-//? }
}
return false;
}
-// Writes an object into the backup file.
-
-void CRobotMain::IOWriteObject(FILE *file, CObject* pObj, char *cmd)
+//! Writes an object into the backup file
+void CRobotMain::IOWriteObject(FILE *file, CObject* obj, const char *cmd)
{
- Math::Vector pos;
- CBrain* pBrain;
- char line[3000];
- char name[100];
- int run, i;
+ if (obj->GetType() == OBJECT_FIX) return;
- if ( pObj->RetType() == OBJECT_FIX ) return;
+ char line[3000];
+ char name[100];
strcpy(line, cmd);
- sprintf(name, " type=%s", GetTypeObject(pObj->RetType()));
+ sprintf(name, " type=%s", GetTypeObject(obj->GetType()));
strcat(line, name);
- sprintf(name, " id=%d", pObj->RetID());
+ sprintf(name, " id=%d", obj->GetID());
strcat(line, name);
- pos = pObj->RetPosition(0)/g_unit;
+ Math::Vector pos;
+
+ pos = obj->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 = obj->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 = obj->GetZoom(0);
sprintf(name, " zoom=%.2f;%.2f;%.2f", pos.x, pos.y, pos.z);
strcat(line, name);
- for ( i=1 ; i<OBJECTMAXPART ; i++ )
+ for (int i = 1; i < OBJECTMAXPART; i++)
{
- if ( pObj->RetObjectRank(i) == -1 ) continue;
+ if (obj->GetObjectRank(i) == -1) continue;
- pos = pObj->RetPosition(i);
- if ( pos.x != 0.0f || pos.y != 0.0f || pos.z != 0.0f )
+ pos = obj->GetPosition(i);
+ if (pos.x != 0.0f || pos.y != 0.0f || pos.z != 0.0f)
{
pos /= g_unit;
sprintf(name, " p%d=%.2f;%.2f;%.2f", i, pos.x, pos.y, pos.z);
strcat(line, name);
}
- pos = pObj->RetAngle(i);
- if ( pos.x != 0.0f || pos.y != 0.0f || pos.z != 0.0f )
+ pos = obj->GetAngle(i);
+ if (pos.x != 0.0f || pos.y != 0.0f || pos.z != 0.0f)
{
pos /= (Math::PI/180.0f);
sprintf(name, " a%d=%.2f;%.2f;%.2f", i, pos.x, pos.y, pos.z);
strcat(line, name);
}
- pos = pObj->RetZoom(i);
- if ( pos.x != 1.0f || pos.y != 1.0f || pos.z != 1.0f )
+ pos = obj->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);
strcat(line, name);
}
}
- sprintf(name, " trainer=%d", pObj->RetTrainer());
+ sprintf(name, " trainer=%d", obj->GetTrainer());
strcat(line, name);
- sprintf(name, " option=%d", pObj->RetOption());
+ sprintf(name, " option=%d", obj->GetOption());
strcat(line, name);
- if ( pObj == m_infoObject ) // selects object?
+ if (obj == m_infoObject) // selects object?
{
sprintf(name, " select=1");
strcat(line, name);
}
- pObj->Write(line);
+ obj->Write(line);
- if ( pObj->RetType() == OBJECT_BASE )
+ if (obj->GetType() == OBJECT_BASE)
{
sprintf(name, " run=3"); // stops and open (PARAM_FIXSCENE)
strcat(line, name);
}
- pBrain = pObj->RetBrain();
- if ( pBrain != 0 )
+ CBrain* brain = obj->GetBrain();
+ if (brain != nullptr)
{
- run = pBrain->RetProgram();
- if ( run != -1 )
+ int run = brain->GetProgram();
+ if (run != -1)
{
sprintf(name, " run=%d", run+1);
strcat(line, name);
@@ -6368,20 +5765,13 @@ void CRobotMain::IOWriteObject(FILE *file, CObject* pObj, char *cmd)
fputs(line, file);
}
-// Saves the current game.
-
+//! Saves the current game
bool CRobotMain::IOWriteScene(char *filename, char *filecbot, char *info)
{
- FILE* file;
- char line[500];
- char* name;
- CObject *pObj, *pPower, *pFret;
- float sleep, delay, magnetic, progress;
- int i, objRank;
- long version;
+ FILE* file = fopen(filename, "w");
+ if (file == NULL) return false;
- file = fopen(filename, "w");
- if ( file == NULL ) return false;
+ char line[500];
sprintf(line, "Title text=\"%s\"\n", info);
fputs(line, file);
@@ -6389,84 +5779,81 @@ 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();
- if ( strcmp(name, "user") == 0 )
+ char* 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);
+ sprintf(line, "DoneResearch bits=%d\n", static_cast<int>(g_researchDone));
fputs(line, file);
- if ( m_blitz->GetStatus(sleep, delay, magnetic, progress) )
+ float sleep, delay, magnetic, progress;
+ if (m_lightning->GetStatus(sleep, delay, magnetic, progress))
{
sprintf(line, "BlitzMode sleep=%.2f delay=%.2f magnetic=%.2f progress=%.2f\n", sleep, delay, magnetic/g_unit, progress);
fputs(line, file);
}
- objRank = 0;
- for ( i=0 ; i<1000000 ; i++ )
+ int objRank = 0;
+ for (int i = 0; i < 1000000; i++)
{
- pObj = (CObject*)m_iMan->SearchInstance(CLASS_OBJECT, i);
- if ( pObj == 0 ) break;
+ CObject* obj = static_cast<CObject*>(m_iMan->SearchInstance(CLASS_OBJECT, i));
+ if (obj == nullptr) 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 (obj->GetType() == OBJECT_TOTO) continue;
+ if (obj->GetType() == OBJECT_FIX) continue;
+ if (obj->GetTruck() != nullptr) continue;
+ if (obj->GetBurn()) continue;
+ if (obj->GetDead()) continue;
+ if (obj->GetExplo()) continue;
- pPower = pObj->RetPower();
- pFret = pObj->RetFret();
+ CObject* power = obj->GetPower();
+ CObject* fret = obj->GetFret();
- if ( pFret != 0 ) // object transported?
- {
- IOWriteObject(file, pFret, "CreateFret");
- }
+ if (fret != nullptr) // object transported?
+ IOWriteObject(file, fret, "CreateFret");
- if ( pPower != 0 ) // battery transported?
- {
- IOWriteObject(file, pPower, "CreatePower");
- }
+ if (power != nullptr) // battery transported?
+ IOWriteObject(file, power, "CreatePower");
- IOWriteObject(file, pObj, "CreateObject");
+ IOWriteObject(file, obj, "CreateObject");
- SaveFileScript(pObj, filename, objRank++);
+ SaveFileScript(obj, filename, objRank++);
}
fclose(file);
#if CBOT_STACK
// Writes the file of stacks of execution.
file = fOpen(filecbot, "wb");
- if ( file == NULL ) return false;
+ if (file == NULL) return false;
- version = 1;
+ long version = 1;
fWrite(&version, sizeof(long), 1, file); // version of COLOBOT
version = CBotProgram::GetVersion();
fWrite(&version, sizeof(long), 1, file); // version of CBOT
objRank = 0;
- for ( i=0 ; i<1000000 ; i++ )
+ for (int i = 0; i < 1000000; i++)
{
- pObj = (CObject*)m_iMan->SearchInstance(CLASS_OBJECT, i);
- if ( pObj == 0 ) break;
+ CObject* obj = static_cast<CObject*>(m_iMan->SearchInstance(CLASS_OBJECT, i));
+ if (obj == nullptr) 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 (obj->GetType() == OBJECT_TOTO) continue;
+ if (obj->GetType() == OBJECT_FIX) continue;
+ if (obj->GetTruck() != nullptr) continue;
+ if (obj->GetBurn()) continue;
+ if (obj->GetDead()) continue;
- if ( !SaveFileStack(pObj, file, objRank++) ) break;
+ if (!SaveFileStack(obj, file, objRank++)) break;
}
CBotClass::SaveStaticState(file);
fClose(file);
@@ -6476,232 +5863,205 @@ bool CRobotMain::IOWriteScene(char *filename, char *filecbot, char *info)
return true;
}
-// Resumes the game.
-
+//! Resumes the game
CObject* CRobotMain::IOReadObject(char *line, char* filename, int objRank)
{
- CObject* pObj;
-//? CBrain* pBrain;
- CAuto* pAuto;
- Math::Vector pos, dir, zoom;
- ObjectType type;
- int id, run, trainer, toy, option, i;
- char op[10];
+ Math::Vector pos = OpDir(line, "pos")*g_unit;
+ Math::Vector dir = OpDir(line, "angle")*(Math::PI/180.0f);
+ Math::Vector zoom = OpDir(line, "zoom");
- pos = OpDir(line, "pos")*g_unit;
- dir = OpDir(line, "angle")*(Math::PI/180.0f);
- zoom = OpDir(line, "zoom");
- type = OpTypeObject(line, "type", OBJECT_NULL);
- id = OpInt(line, "id", 0);
- if ( type == OBJECT_NULL ) return 0;
- trainer = OpInt(line, "trainer", 0);
- toy = OpInt(line, "toy", 0);
- option = OpInt(line, "option", 0);
- pObj = CreateObject(pos, dir.y, 1.0f, 0.0f, type, 0.0f, trainer, toy, option);
- pObj->SetDefRank(objRank);
- pObj->SetPosition(0, pos);
- pObj->SetAngle(0, dir);
- pObj->SetID(id);
- if ( g_id < id ) g_id = id;
+ ObjectType type = OpTypeObject(line, "type", OBJECT_NULL);
+ int id = OpInt(line, "id", 0);
+ if (type == OBJECT_NULL)
+ return nullptr;
- if ( zoom.x != 0.0f || zoom.y != 0.0f || zoom.z != 0.0f )
- {
- pObj->SetZoom(0, zoom);
- }
+ int trainer = OpInt(line, "trainer", 0);
+ int toy = OpInt(line, "toy", 0);
+ int option = OpInt(line, "option", 0);
+
+ CObject* obj = CreateObject(pos, dir.y, 1.0f, 0.0f, type, 0.0f, trainer, toy, option);
+ obj->SetDefRank(objRank);
+ obj->SetPosition(0, pos);
+ obj->SetAngle(0, dir);
+ obj->SetID(id);
+ if (g_id < id) g_id = id;
+
+ if (zoom.x != 0.0f || zoom.y != 0.0f || zoom.z != 0.0f)
+ obj->SetZoom(0, zoom);
- for ( i=1 ; i<OBJECTMAXPART ; i++ )
+ for (int i = 1; i < OBJECTMAXPART; i++)
{
- if ( pObj->RetObjectRank(i) == -1 ) continue;
+ if (obj->GetObjectRank(i) == -1) continue;
+ char op[10];
sprintf(op, "p%d", i);
- pos = OpDir(line, op);
- if ( pos.x != 0.0f || pos.y != 0.0f || pos.z != 0.0f )
+ pos = OpDir(line, op);
+ if (pos.x != 0.0f || pos.y != 0.0f || pos.z != 0.0f)
{
- pObj->SetPosition(i, pos*g_unit);
+ obj->SetPosition(i, pos*g_unit);
}
sprintf(op, "a%d", i);
- dir = OpDir(line, op);
- if ( dir.x != 0.0f || dir.y != 0.0f || dir.z != 0.0f )
+ dir = OpDir(line, op);
+ if (dir.x != 0.0f || dir.y != 0.0f || dir.z != 0.0f)
{
- pObj->SetAngle(i, dir*(Math::PI/180.0f));
+ obj->SetAngle(i, dir*(Math::PI/180.0f));
}
sprintf(op, "z%d", i);
zoom = OpDir(line, op);
- if ( zoom.x != 0.0f || zoom.y != 0.0f || zoom.z != 0.0f )
+ if (zoom.x != 0.0f || zoom.y != 0.0f || zoom.z != 0.0f)
{
- pObj->SetZoom(i, zoom);
+ obj->SetZoom(i, zoom);
}
}
- if ( type == OBJECT_BASE ) m_bBase = true;
+ if (type == OBJECT_BASE) m_base = true;
- pObj->Read(line);
+ obj->Read(line);
#if CBOT_STACK
#else
- LoadFileScript(pObj, filename, objRank, i);
+ LoadFileScript(obj, filename, objRank, i);
#endif
- run = OpInt(line, "run", -1);
- if ( run != -1 )
+ int run = OpInt(line, "run", -1);
+ if (run != -1)
{
#if CBOT_STACK
#else
- pBrain = pObj->RetBrain();
- if ( pBrain != 0 )
- {
- pBrain->RunProgram(run-1); // starts the program
- }
+ CBrain* brain = obj->GetBrain();
+ if (brain != nullptr)
+ brain->RunProgram(run-1); // starts the program
#endif
- pAuto = pObj->RetAuto();
- if ( pAuto != 0 )
- {
- pAuto->Start(run); // starts the film
- }
+ CAuto* automat = obj->GetAuto();
+ if (automat != nullptr)
+ automat->Start(run); // starts the film
}
- return pObj;
+ return obj;
}
-// Resumes some part of the game.
-
+//! Resumes some part of the game
CObject* CRobotMain::IOReadScene(char *filename, char *filecbot)
{
- FILE* file;
- CObject *pObj, *pPower, *pFret, *pSel;
- char line[3000];
- float sleep, delay, progress, magnetic;
- int i, objRank, nbError, lastError;
- long version;
+ m_base = false;
- m_bBase = false;
+ FILE* file = fopen(filename, "r");
+ if (file == NULL) return 0;
- file = fopen(filename, "r");
- if ( file == NULL ) return 0;
-
- pFret = 0;
- pPower = 0;
- pSel = 0;
- objRank = 0;
- while ( fgets(line, 3000, file) != NULL )
+ CObject* fret = nullptr;
+ CObject* power = nullptr;
+ CObject* sel = nullptr;
+ int objRank = 0;
+ char line[3000];
+ while (fgets(line, 3000, file) != NULL)
{
- for ( i=0 ; i<3000 ; i++ )
+ for (int i = 0; i < 3000; i++)
{
- if ( line[i] == '\t' ) line[i] = ' '; // replace tab by space
- if ( line[i] == '/' && line[i+1] == '/' )
+ if (line[i] == '\t') line[i] = ' '; // replace tab by space
+ if (line[i] == '/' && line[i+1] == '/')
{
line[i] = 0;
break;
}
}
- if ( Cmd(line, "Map") )
- {
+ if (Cmd(line, "Map"))
m_map->ZoomMap(OpFloat(line, "zoom", 1.0f));
- }
- if ( Cmd(line, "DoneResearch") )
- {
+ if (Cmd(line, "DoneResearch"))
g_researchDone = OpInt(line, "bits", 0);
- }
- if ( Cmd(line, "BlitzMode") )
+ if (Cmd(line, "BlitzMode"))
{
- sleep = OpFloat(line, "sleep", 0.0f);
- delay = OpFloat(line, "delay", 3.0f);
- magnetic = OpFloat(line, "magnetic", 50.0f)*g_unit;
- progress = OpFloat(line, "progress", 0.0f);
- m_blitz->SetStatus(sleep, delay, magnetic, progress);
+ float sleep = OpFloat(line, "sleep", 0.0f);
+ float delay = OpFloat(line, "delay", 3.0f);
+ float magnetic = OpFloat(line, "magnetic", 50.0f)*g_unit;
+ float progress = OpFloat(line, "progress", 0.0f);
+ m_lightning->SetStatus(sleep, delay, magnetic, progress);
}
- if ( Cmd(line, "CreateFret") )
- {
- pFret = IOReadObject(line, filename, -1);
- }
+ if (Cmd(line, "CreateFret"))
+ fret = IOReadObject(line, filename, -1);
- if ( Cmd(line, "CreatePower") )
- {
- pPower = IOReadObject(line, filename, -1);
- }
+ if (Cmd(line, "CreatePower"))
+ power = IOReadObject(line, filename, -1);
- if ( Cmd(line, "CreateObject") )
+ if (Cmd(line, "CreateObject"))
{
- pObj = IOReadObject(line, filename, objRank++);
+ CObject* obj = IOReadObject(line, filename, objRank++);
- if ( OpInt(line, "select", 0) )
- {
- pSel = pObj;
- }
+ if (OpInt(line, "select", 0))
+ sel = obj;
- if ( pFret != 0 )
+ if (fret != nullptr)
{
- CTaskManip* task;
-
- pObj->SetFret(pFret);
- task = new CTaskManip(m_iMan, pObj);
+ obj->SetFret(fret);
+ CTaskManip* task = new CTaskManip(m_iMan, obj);
task->Start(TMO_AUTO, TMA_GRAB); // holds the object!
delete task;
}
- if ( pPower != 0 )
+ if (power != nullptr)
{
- pObj->SetPower(pPower);
- pPower->SetTruck(pObj);
+ obj->SetPower(power);
+ power->SetTruck(obj);
}
- pFret = 0;
- pPower = 0;
+ fret = nullptr;
+ power = nullptr;
}
}
fclose(file);
#if CBOT_STACK
// Compiles scripts.
- nbError = 0;
+ int nbError = 0;
+ int lastError = 0;
do
{
lastError = nbError;
nbError = 0;
- for ( i=0 ; i<1000000 ; i++ )
+ for (int i = 0; i < 1000000; i++)
{
- pObj = (CObject*)m_iMan->SearchInstance(CLASS_OBJECT, i);
- if ( pObj == 0 ) break;
- if ( pObj->RetTruck() != 0 ) continue;
+ CObject* obj = static_cast<CObject*>(m_iMan->SearchInstance(CLASS_OBJECT, i));
+ if (obj == nullptr) break;
+ if (obj->GetTruck() != nullptr) continue;
- objRank = pObj->RetDefRank();
- if ( objRank == -1 ) continue;
+ objRank = obj->GetDefRank();
+ if (objRank == -1) continue;
- LoadFileScript(pObj, filename, objRank, nbError);
+ LoadFileScript(obj, filename, objRank, nbError);
}
}
- while ( nbError > 0 && nbError != lastError );
+ while (nbError > 0 && nbError != lastError);
// Reads the file of stacks of execution.
file = fOpen(filecbot, "rb");
- if ( file != NULL )
+ if (file != NULL)
{
+ long version;
fRead(&version, sizeof(long), 1, file); // version of COLOBOT
- if ( version == 1 )
+ if (version == 1)
{
fRead(&version, sizeof(long), 1, file); // version of CBOT
- if ( version == CBotProgram::GetVersion() )
+ if (version == CBotProgram::GetVersion())
{
objRank = 0;
- for ( i=0 ; i<1000000 ; i++ )
+ for (int i = 0; i < 1000000; i++)
{
- pObj = (CObject*)m_iMan->SearchInstance(CLASS_OBJECT, i);
- if ( pObj == 0 ) break;
+ CObject* obj = static_cast<CObject*>(m_iMan->SearchInstance(CLASS_OBJECT, i));
+ if (obj == nullptr) 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 (obj->GetType() == OBJECT_TOTO) continue;
+ if (obj->GetType() == OBJECT_FIX) continue;
+ if (obj->GetTruck() != nullptr) continue;
+ if (obj->GetBurn()) continue;
+ if (obj->GetDead()) continue;
- if ( !ReadFileStack(pObj, file, objRank++) ) break;
+ if (!ReadFileStack(obj, file, objRank++)) break;
}
}
}
@@ -6710,66 +6070,58 @@ CObject* CRobotMain::IOReadScene(char *filename, char *filecbot)
}
#endif
- return pSel;
+ return sel;
}
-// Writes the global parameters for free play.
-
+//! Writes the global parameters for free play
void CRobotMain::WriteFreeParam()
{
- FILE* file;
- char filename[_MAX_FNAME];
- char line[100];
-
m_freeResearch |= g_researchDone;
m_freeBuild |= g_build;
- if ( m_gamerName[0] == 0 ) return;
+ if (m_gamerName[0] == 0) return;
- sprintf(filename, "%s\\%s\\research.gam", RetSavegameDir(), m_gamerName);
- file = fopen(filename, "w");
- if ( file == NULL ) return;
+ char filename[MAX_FNAME];
+ sprintf(filename, "%s\\%s\\research.gam", GetSavegameDir(), m_gamerName);
+ FILE* file = fopen(filename, "w");
+ if (file == NULL) return;
+ char line[100];
sprintf(line, "research=%d build=%d\n", m_freeResearch, m_freeBuild);
fputs(line, file);
fclose(file);
}
-// Reads the global parameters for free play.
-
+//! Reads the global parameters for free play
void CRobotMain::ReadFreeParam()
{
- FILE* file;
- char filename[_MAX_FNAME];
- char line[100];
-
m_freeResearch = 0;
m_freeBuild = 0;
- if ( m_gamerName[0] == 0 ) return;
+ if (m_gamerName[0] == 0) return;
- sprintf(filename, "%s\\%s\\research.gam", RetSavegameDir(), m_gamerName);
- file = fopen(filename, "r");
- if ( file == NULL ) return;
+ char filename[MAX_FNAME];
+ sprintf(filename, "%s\\%s\\research.gam", GetSavegameDir(), m_gamerName);
+ FILE* file = fopen(filename, "r");
+ if (file == NULL) return;
- if ( fgets(line, 100, file) != NULL )
- {
+ char line[100];
+ if (fgets(line, 100, file) != NULL)
sscanf(line, "research=%d build=%d\n", &m_freeResearch, &m_freeBuild);
- }
fclose(file);
}
-// Resets all objects to their original position.
-
+//! Resets all objects to their original position
void CRobotMain::ResetObject()
{
+// TODO: ?
#if 0
- CObject* pObj;
- CObject* pTruck;
- CAuto* pAuto;
+ CObject* obj;
+ CObject* truck;
+ CAuto* objAuto;
CBrain* brain;
CPyro* pyro;
ResetCap cap;
@@ -6779,7 +6131,7 @@ void CRobotMain::ResetObject()
// Removes all pyrotechnic effects in progress.
while ( true )
{
- pyro = (CPyro*)m_iMan->SearchInstance(CLASS_PYRO, 0);
+ pyro = static_cast<CPyro*>(m_iMan->SearchInstance(CLASS_PYRO, 0));
if ( pyro == 0 ) break;
pyro->DeleteObject();
@@ -6787,179 +6139,166 @@ void CRobotMain::ResetObject()
}
// Removes all bullets in progress.
- m_particule->DeleteParticule(PARTIGUN1);
- m_particule->DeleteParticule(PARTIGUN2);
- m_particule->DeleteParticule(PARTIGUN3);
- m_particule->DeleteParticule(PARTIGUN4);
+ m_particle->DeleteParticle(PARTIGUN1);
+ m_particle->DeleteParticle(PARTIGUN2);
+ m_particle->DeleteParticle(PARTIGUN3);
+ m_particle->DeleteParticle(PARTIGUN4);
for ( i=0 ; i<1000000 ; i++ )
{
- pObj = (CObject*)m_iMan->SearchInstance(CLASS_OBJECT, i);
- if ( pObj == 0 ) break;
+ obj = static_cast<CObject*>(m_iMan->SearchInstance(CLASS_OBJECT, i));
+ if ( obj == 0 ) break;
- cap = pObj->RetResetCap();
+ cap = obj->GetResetCap();
if ( cap == RESET_NONE ) continue;
if ( cap == RESET_DELETE )
{
- pTruck = pObj->RetTruck();
- if ( pTruck != 0 )
+ truck = obj->GetTruck();
+ if ( truck != 0 )
{
- pTruck->SetFret(0);
- pObj->SetTruck(0);
+ truck->SetFret(0);
+ obj->SetTruck(0);
}
- pObj->DeleteObject();
- delete pObj;
+ obj->DeleteObject();
+ delete obj;
i --;
continue;
}
- pAuto = pObj->RetAuto();
- if ( pAuto != 0 )
+ objAuto = obj->GetAuto();
+ if ( objAuto != 0 )
{
- pAuto->Abort();
+ objAuto->Abort();
}
- if ( pObj->RetEnable() ) // object still active?
+ if ( obj->GetEnable() ) // object still active?
{
- brain = pObj->RetBrain();
+ brain = obj->GetBrain();
if ( brain != 0 )
{
- pos = pObj->RetResetPosition();
- angle = pObj->RetResetAngle();
+ pos = obj->GetResetPosition();
+ angle = obj->GetResetAngle();
- if ( pos == pObj->RetPosition(0) &&
- angle == pObj->RetAngle(0) ) continue;
+ if ( pos == obj->GetPosition(0) &&
+ angle == obj->GetAngle(0) ) continue;
brain->StartTaskReset(pos, angle);
continue;
}
}
- pObj->SetEnable(true); // active again
+ obj->SetEnable(true); // active again
- pos = pObj->RetResetPosition();
- angle = pObj->RetResetAngle();
+ pos = obj->GetResetPosition();
+ angle = obj->GetResetAngle();
- if ( pos == pObj->RetPosition(0) &&
- angle == pObj->RetAngle(0) ) continue;
+ if ( pos == obj->GetPosition(0) &&
+ angle == obj->GetAngle(0) ) continue;
pyro = new CPyro(m_iMan);
- pyro->Create(PT_RESET, pObj);
+ pyro->Create(PT_RESET, obj);
- brain = pObj->RetBrain();
+ brain = obj->GetBrain();
if ( brain != 0 )
{
- brain->RunProgram(pObj->RetResetRun());
+ brain->RunProgram(obj->GetResetRun());
}
}
#else
- m_bResetCreate = true;
+ m_resetCreate = true;
#endif
}
-// Resets all objects to their original position.
-
+//! Resets all objects to their original position
void CRobotMain::ResetCreate()
{
- CObject* pObj;
- CPyro* pyro;
- ResetCap cap;
- int i;
-
SaveAllScript();
// Removes all bullets in progress.
- m_particule->DeleteParticule(PARTIGUN1);
- m_particule->DeleteParticule(PARTIGUN2);
- m_particule->DeleteParticule(PARTIGUN3);
- m_particule->DeleteParticule(PARTIGUN4);
+ m_particle->DeleteParticle(Gfx::PARTIGUN1);
+ m_particle->DeleteParticle(Gfx::PARTIGUN2);
+ m_particle->DeleteParticle(Gfx::PARTIGUN3);
+ m_particle->DeleteParticle(Gfx::PARTIGUN4);
DeselectAll(); // removes the control buttons
DeleteAllObjects(); // removes all the current 3D Scene
- m_particule->FlushParticule();
+ m_particle->FlushParticle();
m_terrain->FlushBuildingLevel();
m_iMan->Flush(CLASS_OBJECT);
m_iMan->Flush(CLASS_PHYSICS);
m_iMan->Flush(CLASS_BRAIN);
m_iMan->Flush(CLASS_PYRO);
- m_camera->SetType(CAMERA_DIALOG);
+ m_camera->SetType(Gfx::CAM_TYPE_DIALOG);
- CreateScene(m_dialog->RetSceneSoluce(), false, true);
+ CreateScene(m_dialog->GetSceneSoluce(), false, true);
- if ( !RetNiceReset() ) return;
+ if (!GetNiceReset()) return;
- for ( i=0 ; i<1000000 ; i++ )
+ for (int i = 0; i < 1000000; i++)
{
- pObj = (CObject*)m_iMan->SearchInstance(CLASS_OBJECT, i);
- if ( pObj == 0 ) break;
+ CObject* obj = static_cast<CObject*>(m_iMan->SearchInstance(CLASS_OBJECT, i));
+ if (obj == nullptr) break;
- cap = pObj->RetResetCap();
- if ( cap == RESET_NONE ) continue;
+ ResetCap cap = obj->GetResetCap();
+ if (cap == RESET_NONE) continue;
- pyro = new CPyro(m_iMan);
- pyro->Create(PT_RESET, pObj);
+ Gfx::CPyro* pyro = new Gfx::CPyro(m_iMan);
+ pyro->Create(Gfx::PT_RESET, obj);
}
}
-// Checks if the mission is over.
-
-Error CRobotMain::CheckEndMission(bool bFrame)
+//! Checks if the mission is over
+Error CRobotMain::CheckEndMission(bool frame)
{
- CObject* pObj;
- Math::Vector bPos, oPos;
- ObjectType type;
- int t, i, nb;
-
- for ( t=0 ; t<m_endTakeTotal ; t++ )
+ for (int t = 0; t < m_endTakeTotal; t++)
{
- if ( m_endTake[t].message[0] != 0 ) continue;
+ if (m_endTake[t].message[0] != 0) continue;
- bPos = m_endTake[t].pos;
+ Math::Vector bPos = m_endTake[t].pos;
bPos.y = 0.0f;
- nb = 0;
- for ( i=0 ; i<1000000 ; i++ )
+ Math::Vector oPos;
+
+ int nb = 0;
+ for (int i = 0; i < 1000000; i++)
{
- pObj = (CObject*)m_iMan->SearchInstance(CLASS_OBJECT, i);
- if ( pObj == 0 ) break;
+ CObject* obj = static_cast<CObject*>(m_iMan->SearchInstance(CLASS_OBJECT, i));
+ if (obj == nullptr) break;
- // Do not use RetActif () because an invisible worm (underground)
+ // Do not use GetActif () because an invisible worm (underground)
// should be regarded as existing here!
- if ( pObj->RetLock() ) continue;
- if ( pObj->RetRuin() ) continue;
- if ( !pObj->RetEnable() ) continue;
-
- type = pObj->RetType();
- if ( type == OBJECT_SCRAP2 ||
- type == OBJECT_SCRAP3 ||
- type == OBJECT_SCRAP4 ||
- type == OBJECT_SCRAP5 ) // wastes?
+ if (obj->GetLock()) continue;
+ if (obj->GetRuin()) continue;
+ if (!obj->GetEnable()) continue;
+
+ ObjectType type = obj->GetType();
+ if (type == OBJECT_SCRAP2 ||
+ type == OBJECT_SCRAP3 ||
+ type == OBJECT_SCRAP4 ||
+ type == OBJECT_SCRAP5) // wastes?
{
type = OBJECT_SCRAP1;
}
- if ( type != m_endTake[t].type ) continue;
- if ( pObj->RetTruck() == 0 )
- {
- oPos = pObj->RetPosition(0);
- }
+ if (type != m_endTake[t].type) continue;
+
+ if (obj->GetTruck() == 0)
+ oPos = obj->GetPosition(0);
else
- {
- oPos = pObj->RetTruck()->RetPosition(0);
- }
+ oPos = obj->GetTruck()->GetPosition(0);
+
oPos.y = 0.0f;
- if ( Math::DistanceProjected(oPos, bPos) <= m_endTake[t].dist )
- {
+
+ if (Math::DistanceProjected(oPos, bPos) <= m_endTake[t].dist)
nb ++;
- }
}
- if ( nb <= m_endTake[t].lost )
+ if (nb <= m_endTake[t].lost)
{
- if ( m_endTake[t].type == OBJECT_HUMAN )
+ if (m_endTake[t].type == OBJECT_HUMAN)
{
- if ( m_lostDelay == 0.0f )
+ if (m_lostDelay == 0.0f)
{
m_lostDelay = 0.1f; // lost immediately
m_winDelay = 0.0f;
@@ -6969,7 +6308,7 @@ Error CRobotMain::CheckEndMission(bool bFrame)
}
else
{
- if ( m_lostDelay == 0.0f )
+ if (m_lostDelay == 0.0f)
{
m_displayText->DisplayError(INFO_LOST, Math::Vector(0.0f,0.0f,0.0f));
m_lostDelay = m_endTakeLostDelay; // lost in 6 seconds
@@ -6979,15 +6318,15 @@ Error CRobotMain::CheckEndMission(bool bFrame)
return INFO_LOST;
}
}
- if ( nb < m_endTake[t].min ||
- nb > m_endTake[t].max )
+ if (nb < m_endTake[t].min ||
+ nb > m_endTake[t].max)
{
m_displayText->SetEnable(true);
return ERR_MISSION_NOTERM;
}
- if ( m_endTake[t].bImmediat )
+ if (m_endTake[t].immediat)
{
- if ( m_winDelay == 0.0f )
+ if (m_winDelay == 0.0f)
{
m_winDelay = m_endTakeWinDelay; // wins in x seconds
m_lostDelay = 0.0f;
@@ -6997,16 +6336,16 @@ Error CRobotMain::CheckEndMission(bool bFrame)
}
}
- if ( m_endTakeResearch != 0 )
+ if (m_endTakeResearch != 0)
{
- if ( m_endTakeResearch != (m_endTakeResearch&g_researchDone) )
+ if (m_endTakeResearch != (m_endTakeResearch&g_researchDone))
{
m_displayText->SetEnable(true);
return ERR_MISSION_NOTERM;
}
}
- if ( m_endTakeWinDelay == -1.0f )
+ if (m_endTakeWinDelay == -1.0f)
{
m_winDelay = 1.0f; // wins in one second
m_lostDelay = 0.0f;
@@ -7014,9 +6353,9 @@ Error CRobotMain::CheckEndMission(bool bFrame)
return ERR_OK; // mission ended
}
- if ( bFrame && m_bBase ) return ERR_MISSION_NOTERM;
+ if (frame && m_base) return ERR_MISSION_NOTERM;
- if ( m_winDelay == 0.0f )
+ if (m_winDelay == 0.0f)
{
m_displayText->DisplayError(INFO_WIN, Math::Vector(0.0f,0.0f,0.0f));
m_winDelay = m_endTakeWinDelay; // wins in two seconds
@@ -7026,17 +6365,14 @@ Error CRobotMain::CheckEndMission(bool bFrame)
return ERR_OK; // mission ended
}
-// Checks if the mission is finished after displaying a message.
-
-void CRobotMain::CheckEndMessage(char *message)
+//! Checks if the mission is finished after displaying a message
+void CRobotMain::CheckEndMessage(const char* message)
{
- int t;
-
- for ( t=0 ; t<m_endTakeTotal ; t++ )
+ for (int t = 0; t < m_endTakeTotal; t++)
{
- if ( m_endTake[t].message[0] == 0 ) continue;
+ if (m_endTake[t].message[0] == 0) continue;
- if ( strcmp(m_endTake[t].message, message) == 0 )
+ if (strcmp(m_endTake[t].message, message) == 0)
{
m_displayText->DisplayError(INFO_WIN, Math::Vector(0.0f,0.0f,0.0f));
m_winDelay = m_endTakeWinDelay; // wins in 2 seconds
@@ -7046,394 +6382,351 @@ void CRobotMain::CheckEndMessage(char *message)
}
-// Returns the number of instructions required.
-
-int CRobotMain::RetObligatoryToken()
+//! Returns the number of instructions required
+int CRobotMain::GetObligatoryToken()
{
return m_obligatoryTotal;
}
-// Returns the name of a required instruction.
-
-char* CRobotMain::RetObligatoryToken(int i)
+//! Returns the name of a required instruction
+char* CRobotMain::GetObligatoryToken(int i)
{
return m_obligatoryToken[i];
}
-// Checks if an instruction is part of the obligatory list.
-
-int CRobotMain::IsObligatoryToken(char *token)
+//! Checks if an instruction is part of the obligatory list
+int CRobotMain::IsObligatoryToken(const char* token)
{
- int i;
-
- for ( i=0 ; i<m_obligatoryTotal ; i++ )
+ for (int i = 0; i < m_obligatoryTotal; i++)
{
- if ( strcmp(token, m_obligatoryToken[i]) == 0 )
- {
+ if (strcmp(token, m_obligatoryToken[i]) == 0)
return i;
- }
}
return -1;
}
-// Checks if an instruction is not part of the banned list.
-
-bool CRobotMain::IsProhibitedToken(char *token)
+//! Checks if an instruction is not part of the banned list
+bool CRobotMain::IsProhibitedToken(const char* token)
{
- int i;
-
- for ( i=0 ; i<m_prohibitedTotal ; i++ )
+ for (int i = 0; i < m_prohibitedTotal; i++)
{
- if ( strcmp(token, m_prohibitedToken[i]) == 0 )
- {
+ if (strcmp(token, m_prohibitedToken[i]) == 0)
return false;
- }
}
return true;
}
-// Indicates whether it is possible to control a driving robot.
-
-bool CRobotMain::RetTrainerPilot()
+//! Indicates whether it is possible to control a driving robot
+bool CRobotMain::GetTrainerPilot()
{
- return m_bTrainerPilot;
+ return m_trainerPilot;
}
-// Indicates whether the scene is fixed, without interaction.
-
-bool CRobotMain::RetFixScene()
+//! Indicates whether the scene is fixed, without interaction
+bool CRobotMain::GetFixScene()
{
- return m_bFixScene;
+ return m_fixScene;
}
-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;
+ return m_showSoluce;
}
-bool CRobotMain::RetSceneSoluce()
+bool CRobotMain::GetSceneSoluce()
{
- if ( m_infoFilename[SATCOM_SOLUCE][0] == 0 ) return false;
- return m_dialog->RetSceneSoluce();
+ if (m_infoFilename[SATCOM_SOLUCE][0] == 0) return false;
+ return m_dialog->GetSceneSoluce();
}
-bool CRobotMain::RetShowAll()
+bool CRobotMain::GetShowAll()
{
- return m_bShowAll;
+ return m_showAll;
}
-bool CRobotMain::RetCheatRadar()
+bool CRobotMain::GetCheatRadar()
{
- return m_bCheatRadar;
+ return m_cheatRadar;
}
-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();
}
-// Change the player's name.
-
-void CRobotMain::SetGamerName(char *name)
+//! Change the player's name
+void CRobotMain::SetGamerName(const char *name)
{
strcpy(m_gamerName, name);
SetGlobalGamerName(m_gamerName);
ReadFreeParam();
}
-// Getes the player's name.
-
-char* CRobotMain::RetGamerName()
+//! Getes the player's name
+char* CRobotMain::GetGamerName()
{
return m_gamerName;
}
-// Returns the representation to use for the player.
-
-int CRobotMain::RetGamerFace()
+//! Returns the representation to use for the player
+int CRobotMain::GetGamerFace()
{
- return m_dialog->RetGamerFace();
+ return m_dialog->GetGamerFace();
}
-// Returns the representation to use for the player.
-
-int CRobotMain::RetGamerGlasses()
+//! Returns the representation to use for the player
+int CRobotMain::GetGamerGlasses()
{
- return m_dialog->RetGamerGlasses();
+ return m_dialog->GetGamerGlasses();
}
-// Returns the mode with just the head.
-
-bool CRobotMain::RetGamerOnlyHead()
+//! Returns the mode with just the head
+bool CRobotMain::GetGamerOnlyHead()
{
- return m_dialog->RetGamerOnlyHead();
+ return m_dialog->GetGamerOnlyHead();
}
-// Returns the angle of presentation.
-
-float CRobotMain::RetPersoAngle()
+//! Returns the angle of presentation
+float CRobotMain::GetPersoAngle()
{
- return m_dialog->RetPersoAngle();
+ return m_dialog->GetPersoAngle();
}
-// Changes on the pause mode.
-
-void CRobotMain::ChangePause(bool bPause)
+//! Changes on the pause mode
+void CRobotMain::ChangePause(bool pause)
{
- m_bPause = bPause;
- m_engine->SetPause(m_bPause);
+ m_pause = pause;
+ m_engine->SetPause(m_pause);
- m_sound->MuteAll(m_bPause);
+ m_sound->MuteAll(m_pause);
CreateShortcuts();
- if ( m_bPause ) HiliteClear();
+ if (m_pause) HiliteClear();
}
-// Changes game speed
-
+//! Changes game speed
void CRobotMain::SetSpeed(float speed)
{
- CButton* pb;
- char text[10];
-
- m_engine->SetSpeed(speed);
+ // TODO: m_app->SetSimulationSpeed(speed);
- pb = (CButton*)m_interface->SearchControl(EVENT_SPEED);
- if ( pb != 0 )
+ Ui::CButton* pb = dynamic_cast<Ui::CButton*>(m_interface->SearchControl(EVENT_SPEED));
+ if (pb != nullptr)
{
- if ( speed == 1.0f )
+ if (speed == 1.0f)
{
- pb->ClearState(STATE_VISIBLE);
+ pb->ClearState(Ui::STATE_VISIBLE);
}
else
{
+ char text[10];
sprintf(text, "x%.1f", speed);
pb->SetName(text);
- pb->SetState(STATE_VISIBLE);
+ pb->SetState(Ui::STATE_VISIBLE);
}
}
}
-float CRobotMain::RetSpeed()
+float CRobotMain::GetSpeed()
{
- return m_engine->RetSpeed();
+ return m_app->GetSimulationSpeed();
}
-// Creates interface shortcuts to the units.
-
+//! Creates interface shortcuts to the units
bool CRobotMain::CreateShortcuts()
{
- if ( m_phase != PHASE_SIMUL ) return false;
- if ( !m_bShortCut ) return false;
+ if (m_phase != PHASE_SIMUL) return false;
+ if (!m_shortCut) return false;
return m_short->CreateShortcuts();
}
-// Updates the map.
-
+//! Updates the map
void CRobotMain::UpdateMap()
{
m_map->UpdateMap();
}
-// Indicates whether the mini-map is visible.
-
-bool CRobotMain::RetShowMap()
+//! Indicates whether the mini-map is visible
+bool CRobotMain::GetShowMap()
{
- return m_map->RetShowMap() && m_bMapShow;
+ return m_map->GetShowMap() && m_mapShow;
}
-// Management of the lock mode for movies.
-
-void CRobotMain::SetMovieLock(bool bLock)
+//! Management of the lock mode for movies
+void CRobotMain::SetMovieLock(bool lock)
{
- m_bMovieLock = bLock;
- m_engine->SetMovieLock(m_bMovieLock);
+ m_movieLock = lock;
+ m_engine->SetMovieLock(m_movieLock);
CreateShortcuts();
- m_map->ShowMap(!m_bMovieLock && m_bMapShow);
- if ( m_bMovieLock ) HiliteClear();
- m_engine->SetMouseHide(m_bMovieLock);
+ m_map->ShowMap(!m_movieLock && m_mapShow);
+ if (m_movieLock) HiliteClear();
+ m_engine->SetMouseVisible(! m_movieLock);
}
-bool CRobotMain::RetMovieLock()
+bool CRobotMain::GetMovieLock()
{
- return m_bMovieLock;
+ return m_movieLock;
}
-bool CRobotMain::RetInfoLock()
+bool CRobotMain::GetInfoLock()
{
- return ( m_displayInfo != 0 ); // info in progress?
+ return m_displayInfo != nullptr; // info in progress?
}
-// Management of the blocking of the call of SatCom.
-
-void CRobotMain::SetSatComLock(bool bLock)
+//! Management of the blocking of the call of SatCom
+void CRobotMain::SetSatComLock(bool lock)
{
- m_bSatComLock = bLock;
+ m_satComLock = lock;
}
-bool CRobotMain::RetSatComLock()
+bool CRobotMain::GetSatComLock()
{
- return m_bSatComLock;
+ return m_satComLock;
}
-// Management of the lock mode for the edition.
-
-void CRobotMain::SetEditLock(bool bLock, bool bEdit)
+//! Management of the lock mode for the edition
+void CRobotMain::SetEditLock(bool lock, bool edit)
{
- m_bEditLock = bLock;
+ m_editLock = lock;
CreateShortcuts();
// Do not remove the card if it contains a still image.
- if ( !bLock || !m_map->RetFixImage() )
- {
- m_map->ShowMap(!m_bEditLock && m_bMapShow);
- }
+ if (!lock || !m_map->GetFixImage())
+ m_map->ShowMap(!m_editLock && m_mapShow);
- m_displayText->HideText(bLock);
- m_engine->FlushPressKey();
+ m_displayText->HideText(lock);
+ m_app->ResetKeyStates();
- if ( m_bEditLock )
- {
+ if (m_editLock)
HiliteClear();
- }
else
- {
- m_bEditFull = false;
- }
+ m_editFull = false;
}
-bool CRobotMain::RetEditLock()
+bool CRobotMain::GetEditLock()
{
- return m_bEditLock;
+ return m_editLock;
}
-// Management of the fullscreen mode during editing.
-
-void CRobotMain::SetEditFull(bool bFull)
+//! Management of the fullscreen mode during editing
+void CRobotMain::SetEditFull(bool full)
{
- m_bEditFull = bFull;
+ m_editFull = full;
}
-bool CRobotMain::RetEditFull()
+bool CRobotMain::GetEditFull()
{
- return m_bEditFull;
+ return m_editFull;
}
-bool CRobotMain::RetFreePhoto()
+bool CRobotMain::GetFreePhoto()
{
- return m_bFreePhoto;
+ return m_freePhoto;
}
-// Indicates whether mouse is on an friend object, on which we should not shoot.
-
-void CRobotMain::SetFriendAim(bool bFriend)
+//! Indicates whether mouse is on an friend object, on which we should not shoot
+void CRobotMain::SetFriendAim(bool friendAim)
{
- m_bFriendAim = bFriend;
+ m_friendAim = friendAim;
}
-bool CRobotMain::RetFriendAim()
+bool CRobotMain::GetFriendAim()
{
- return m_bFriendAim;
+ return m_friendAim;
}
-// Management of the precision of drawing the ground.
-
+//! Management of the precision of drawing the ground
void CRobotMain::SetTracePrecision(float factor)
{
m_engine->SetTracePrecision(factor);
}
-float CRobotMain::RetTracePrecision()
+float CRobotMain::GetTracePrecision()
{
- return m_engine->RetTracePrecision();
+ return m_engine->GetTracePrecision();
}
-// Starts music with a mission.
-
+//! Starts music with a mission
void CRobotMain::StartMusic()
{
- if ( m_audioTrack != 0 )
+ if (m_audioTrack != 0)
{
m_sound->StopMusic();
- m_sound->PlayMusic(m_audioTrack, m_bAudioRepeat);
+ m_sound->PlayMusic(m_audioTrack, m_audioRepeat);
}
}
-// Removes hilite and tooltip.
-
+//! Removes hilite and tooltip
void CRobotMain::ClearInterface()
{
HiliteClear(); // removes setting evidence
m_tooltipName[0] = 0; // really removes the tooltip
}
-
-
diff --git a/src/object/robotmain.h b/src/object/robotmain.h
index 559453b..0a5a5a2 100644
--- a/src/object/robotmain.h
+++ b/src/object/robotmain.h
@@ -18,16 +18,15 @@
#pragma once
+#include "common/global.h"
+#include "common/singleton.h"
-#include <stdio.h>
+#include "graphics/engine/particle.h"
-#include "common/misc.h"
-#include "old/d3dengine.h"
#include "object/object.h"
#include "object/mainmovie.h"
-#include "old/camera.h"
-#include "old/particule.h"
+#include <stdio.h>
enum Phase
{
@@ -69,36 +68,41 @@ enum Phase
class CInstanceManager;
-class CMainDialog;
-class CMainShort;
-class CMainMap;
-class CEvent;
-class CD3DEngine;
-class CLight;
+class CEventQueue;
+class CSoundInterface;
+
+namespace Gfx
+{
+class CEngine;
+class CLightManager;
class CWater;
class CCloud;
-class CBlitz;
+class CLightning;
class CPlanet;
class CTerrain;
-class CModel;
+};
+
+namespace Ui
+{
+class CMainDialog;
+class CMainShort;
+class CMainMap;
class CInterface;
-class CWindow;
-class CControl;
class CDisplayText;
class CDisplayInfo;
-class CSound;
+};
struct EndTake
{
- Math::Vector pos;
- float dist;
- ObjectType type;
- int min; // wins if>
- int max; // wins if <
- int lost; // lost if <=
- bool bImmediat;
- char message[100];
+ Math::Vector pos;
+ float dist;
+ ObjectType type;
+ int min; // wins if>
+ int max; // wins if <
+ int lost; // lost if <=
+ bool immediat;
+ char message[100];
};
@@ -106,7 +110,7 @@ const int MAXNEWSCRIPTNAME = 20;
struct NewScriptName
{
- bool bUsed;
+ bool used;
ObjectType type;
char name[40];
};
@@ -118,8 +122,8 @@ const float SHOWLIMITTIME = 20.0f;
struct ShowLimit
{
- bool bUsed;
- Math::Vector pos;
+ bool used;
+ Math::Vector pos;
float radius;
int total;
int parti[MAXSHOWPARTI];
@@ -138,117 +142,169 @@ const int SATCOM_SOLUCE = 5;
const int SATCOM_MAX = 6;
+/**
+ * \struct InputBinding
+ * \brief Binding for input slot
+ */
+struct InputBinding
+{
+ //! Keyboard binding code (can be regular or virtual)
+ unsigned int key;
+ //! Joystick binding code (virtual)
+ unsigned int joy;
+
+ InputBinding() : key(KEY_INVALID), joy(KEY_INVALID) {}
+};
-class CRobotMain
+/**
+ * \struct JoyAxisBinding
+ * \brief Binding for joystick axis
+ */
+struct JoyAxisBinding
+{
+ //! Axis index or AXIS_INVALID
+ int axis;
+ //! True to invert axis value
+ bool invert;
+};
+
+//! Invalid value for axis binding (no axis assigned)
+const int AXIS_INVALID = -1;
+
+class CRobotMain : public CSingleton<CRobotMain>
{
public:
- CRobotMain(CInstanceManager* iMan);
+ CRobotMain(CInstanceManager* iMan, CApplication* app);
~CRobotMain();
void CreateIni();
+ //! Sets the default input bindings (key and axes)
+ void SetDefaultInputBindings();
+
+ //! Management of input bindings
+ //@{
+ void SetInputBinding(InputSlot slot, InputBinding binding);
+ const InputBinding& GetInputBinding(InputSlot slot);
+ //@}
+
+ //! Management of joystick axis bindings
+ //@{
+ void SetJoyAxisBinding(JoyAxisSlot slot, JoyAxisBinding binding);
+ const JoyAxisBinding& GetJoyAxisBinding(JoyAxisSlot slot);
+ //@}
+
+ //! Management of joystick deadzone
+ //@{
+ void SetJoystickDeadzone(float zone);
+ float GetJoystickDeadzone();
+ //@}
+
+ //! Resets tracked key states (motion vectors)
+ void ResetKeyStates();
+
void ChangePhase(Phase phase);
- bool EventProcess(const Event &event);
+ bool EventProcess(Event &event);
bool CreateShortcuts();
void ScenePerso();
- void SetMovieLock(bool bLock);
- bool RetMovieLock();
- bool RetInfoLock();
- void SetSatComLock(bool bLock);
- bool RetSatComLock();
- void SetEditLock(bool bLock, bool bEdit);
- bool RetEditLock();
- void SetEditFull(bool bFull);
- bool RetEditFull();
- bool RetFreePhoto();
- void SetFriendAim(bool bFriend);
- bool RetFriendAim();
+ void SetMovieLock(bool lock);
+ bool GetMovieLock();
+ bool GetInfoLock();
+ void SetSatComLock(bool lock);
+ bool GetSatComLock();
+ void SetEditLock(bool lock, bool edit);
+ bool GetEditLock();
+ void SetEditFull(bool full);
+ bool GetEditFull();
+ bool GetFreePhoto();
+ void SetFriendAim(bool friendAim);
+ bool GetFriendAim();
void SetTracePrecision(float factor);
- float RetTracePrecision();
+ float GetTracePrecision();
- void ChangePause(bool bPause);
+ void ChangePause(bool pause);
void SetSpeed(float speed);
- float RetSpeed();
+ float GetSpeed();
void UpdateShortcuts();
void SelectHuman();
CObject* SearchHuman();
CObject* SearchToto();
CObject* SearchNearest(Math::Vector pos, CObject* pExclu);
- bool SelectObject(CObject* pObj, bool bDisplayError=true);
- CObject* RetSelectObject();
+ bool SelectObject(CObject* pObj, bool displayError=true);
+ CObject* GetSelectObject();
CObject* DeselectAll();
bool DeleteObject();
void ResetObject();
void ResetCreate();
- Error CheckEndMission(bool bFrame);
- void CheckEndMessage(char *message);
- int RetObligatoryToken();
- char* RetObligatoryToken(int i);
- int IsObligatoryToken(char *token);
- bool IsProhibitedToken(char *token);
+ Error CheckEndMission(bool frame);
+ void CheckEndMessage(const char* message);
+ int GetObligatoryToken();
+ char* GetObligatoryToken(int i);
+ int IsObligatoryToken(const char* token);
+ bool IsProhibitedToken(const char* token);
void UpdateMap();
- bool RetShowMap();
+ bool GetShowMap();
- MainMovieType RetMainMovie();
+ MainMovieType GetMainMovie();
void FlushDisplayInfo();
- void StartDisplayInfo(int index, bool bMovie);
- void StartDisplayInfo(char *filename, int index);
+ void StartDisplayInfo(int index, bool movie);
+ void StartDisplayInfo(const char *filename, int index);
void StopDisplayInfo();
- char* RetDisplayInfoName(int index);
- int RetDisplayInfoPosition(int index);
+ char* GetDisplayInfoName(int index);
+ int GetDisplayInfoPosition(int index);
void SetDisplayInfoPosition(int index, int pos);
void StartSuspend();
void StopSuspend();
- float RetGameTime();
+ float GetGameTime();
void SetFontSize(float size);
- float RetFontSize();
+ float GetFontSize();
void SetWindowPos(Math::Point pos);
- Math::Point RetWindowPos();
+ Math::Point GetWindowPos();
void SetWindowDim(Math::Point dim);
- Math::Point RetWindowDim();
+ Math::Point GetWindowDim();
- void SetIOPublic(bool bMode);
- bool RetIOPublic();
+ void SetIOPublic(bool mode);
+ bool GetIOPublic();
void SetIOPos(Math::Point pos);
- Math::Point RetIOPos();
+ Math::Point GetIOPos();
void SetIODim(Math::Point dim);
- Math::Point RetIODim();
-
- char* RetTitle();
- char* RetResume();
- char* RetScriptName();
- char* RetScriptFile();
- bool RetTrainerPilot();
- bool RetFixScene();
- bool RetGlint();
- bool RetSoluce4();
- bool RetMovies();
- bool RetNiceReset();
- bool RetHimselfDamage();
- bool RetShowSoluce();
- bool RetSceneSoluce();
- bool RetShowAll();
- bool RetCheatRadar();
- char* RetSavegameDir();
- char* RetPublicDir();
- char* RetFilesDir();
-
- void SetGamerName(char *name);
- char* RetGamerName();
- int RetGamerFace();
- int RetGamerGlasses();
- bool RetGamerOnlyHead();
- float RetPersoAngle();
+ Math::Point GetIODim();
+
+ char* GetTitle();
+ char* GetResume();
+ char* GetScriptName();
+ char* GetScriptFile();
+ bool GetTrainerPilot();
+ bool GetFixScene();
+ bool GetGlint();
+ bool GetSoluce4();
+ bool GetMovies();
+ bool GetNiceReset();
+ bool GetHimselfDamage();
+ bool GetShowSoluce();
+ bool GetSceneSoluce();
+ bool GetShowAll();
+ bool GetCheatRadar();
+ char* GetSavegameDir();
+ char* GetPublicDir();
+ char* GetFilesDir();
+
+ void SetGamerName(const char *name);
+ char* GetGamerName();
+ int GetGamerFace();
+ int GetGamerGlasses();
+ bool GetGamerOnlyHead();
+ float GetPersoAngle();
void StartMusic();
void ClearInterface();
@@ -256,18 +312,19 @@ public:
float SearchNearestObject(Math::Vector center, CObject *exclu);
bool FreeSpace(Math::Vector &center, float minRadius, float maxRadius, float space, CObject *exclu);
- float RetFlatZoneRadius(Math::Vector center, float maxRadius, CObject *exclu);
+ float GetFlatZoneRadius(Math::Vector center, float maxRadius, CObject *exclu);
void HideDropZone(CObject* metal);
void ShowDropZone(CObject* metal, CObject* truck);
void FlushShowLimit(int i);
- void SetShowLimit(int i, ParticuleType parti, CObject *pObj, Math::Vector pos, float radius, float duration=SHOWLIMITTIME);
+ void SetShowLimit(int i, Gfx::ParticleType parti, CObject *pObj, Math::Vector pos,
+ float radius, float duration=SHOWLIMITTIME);
void AdjustShowLimit(int i, Math::Vector pos);
void StartShowLimit();
void FrameShowLimit(float rTime);
- void CompileScript(bool bSoluce);
- void LoadOneScript(CObject *pObj, int &nbError);
- void LoadFileScript(CObject *pObj, char* filename, int objRank, int &nbError);
+ void CompileScript(bool soluce);
+ void LoadOneScript(CObject *pObj, int &nerror);
+ void LoadFileScript(CObject *pObj, char* filename, int objRank, int &nerror);
void SaveAllScript();
void SaveOneScript(CObject *pObj);
void SaveFileScript(CObject *pObj, char* filename, int objRank);
@@ -276,7 +333,7 @@ public:
bool FlushNewScriptName();
bool AddNewScriptName(ObjectType type, char *name);
- char* RetNewScriptName(ObjectType type, int rank);
+ char* GetNewScriptName(ObjectType type, int rank);
void WriteFreeParam();
void ReadFreeParam();
@@ -284,10 +341,10 @@ public:
bool IsBusy();
bool IOWriteScene(char *filename, char *filecbot, char *info);
CObject* IOReadScene(char *filename, char *filecbot);
- void IOWriteObject(FILE *file, CObject* pObj, char *cmd);
+ void IOWriteObject(FILE *file, CObject* pObj, const char *cmd);
CObject* IOReadObject(char *line, char* filename, int objRank);
- int CreateSpot(Math::Vector pos, D3DCOLORVALUE color);
+ int CreateSpot(Math::Vector pos, Gfx::Color color);
protected:
bool EventFrame(const Event &event);
@@ -295,101 +352,113 @@ protected:
void InitEye();
void Convert();
- void CreateScene(bool bSoluce, bool bFixScene, bool bResetObject);
+ void CreateScene(bool soluce, bool fixScene, bool resetObject);
void CreateModel();
- 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, D3DCOLORVALUE color);
+ 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 trainer=false, bool toy=false, int option=0);
+ int CreateLight(Math::Vector direction, Gfx::Color color);
void HiliteClear();
void HiliteObject(Math::Point pos);
void HiliteFrame(float rTime);
- void CreateTooltip(Math::Point pos, char* text);
+ void CreateTooltip(Math::Point pos, const char* text);
void ClearTooltip();
CObject* DetectObject(Math::Point pos);
void ChangeCamera();
void RemoteCamera(float pan, float zoom, float rTime);
- void KeyCamera(EventMsg event, long param);
+ void KeyCamera(EventType event, unsigned int key);
void AbortMovie();
bool IsSelectable(CObject* pObj);
- void SelectOneObject(CObject* pObj, bool bDisplayError=true);
+ void SelectOneObject(CObject* pObj, bool displayError=true);
void HelpObject();
bool DeselectObject();
void DeleteAllObjects();
void UpdateInfoText();
CObject* SearchObject(ObjectType type);
- CObject* RetSelect();
- void StartDisplayVisit(EventMsg event);
+ CObject* GetSelect();
+ void StartDisplayVisit(EventType event);
void FrameVisit(float rTime);
void StopDisplayVisit();
void ExecuteCmd(char *cmd);
bool TestGadgetQuantity(int rank);
protected:
- CInstanceManager* m_iMan;
- CMainMovie* m_movie;
- CMainDialog* m_dialog;
- CMainShort* m_short;
- CMainMap* m_map;
- CEvent* m_event;
- CD3DEngine* m_engine;
- CParticule* m_particule;
- CWater* m_water;
- CCloud* m_cloud;
- CBlitz* m_blitz;
- CPlanet* m_planet;
- CLight* m_light;
- CTerrain* m_terrain;
- CModel* m_model;
- CInterface* m_interface;
- CCamera* m_camera;
- CDisplayText* m_displayText;
- CDisplayInfo* m_displayInfo;
- CSound* m_sound;
+ CInstanceManager* m_iMan;
+ CApplication* m_app;
+ CEventQueue* m_eventQueue;
+ CMainMovie* m_movie;
+ Gfx::CEngine* m_engine;
+ Gfx::CParticle* m_particle;
+ Gfx::CWater* m_water;
+ Gfx::CCloud* m_cloud;
+ Gfx::CLightning* m_lightning;
+ Gfx::CPlanet* m_planet;
+ Gfx::CLightManager* m_lightMan;
+ Gfx::CTerrain* m_terrain;
+ Gfx::CCamera* m_camera;
+ Ui::CMainDialog* m_dialog;
+ Ui::CMainShort* m_short;
+ Ui::CMainMap* m_map;
+ Ui::CInterface* m_interface;
+ Ui::CDisplayText* m_displayText;
+ Ui::CDisplayInfo* m_displayInfo;
+ CSoundInterface* m_sound;
+
+ //! Bindings for user inputs
+ InputBinding m_inputBindings[INPUT_SLOT_MAX];
+ JoyAxisBinding m_joyAxisBindings[JOY_AXIS_SLOT_MAX];
+ float m_joystickDeadzone;
+ //! Motion vector set by keyboard or joystick buttons
+ Math::Vector m_keyMotion;
+ //! Motion vector set by joystick axes
+ Math::Vector m_joyMotion;
+
float m_time;
float m_gameTime;
float m_checkEndTime;
float m_winDelay;
float m_lostDelay;
- bool m_bFixScene; // scene fixed, no interraction
- bool m_bBase; // OBJECT_BASE exists in mission
- Math::Point m_lastMousePos;
+ bool m_fixScene; // scene fixed, no interraction
+ bool m_base; // OBJECT_BASE exists in mission
+ Math::Point m_lastMousePos;
CObject* m_selectObject;
Phase m_phase;
int m_cameraRank;
- D3DCOLORVALUE m_color;
- bool m_bFreePhoto;
- bool m_bCmdEdit;
- bool m_bShowPos;
- bool m_bSelectInsect;
- bool m_bShowSoluce;
- bool m_bShowAll;
- bool m_bCheatRadar;
- bool m_bAudioRepeat;
- bool m_bShortCut;
+ Gfx::Color m_color;
+ bool m_freePhoto;
+ bool m_cmdEdit;
+ bool m_showPos;
+ bool m_selectInsect;
+ bool m_showSoluce;
+ bool m_showAll;
+ bool m_cheatRadar;
+ bool m_audioRepeat;
+ bool m_shortCut;
int m_audioTrack;
int m_delayWriteMessage;
int m_movieInfoIndex;
- bool m_bImmediatSatCom; // SatCom immediately?
- bool m_bBeginSatCom; // messages SatCom poster?
- bool m_bMovieLock; // movie in progress?
- bool m_bSatComLock; // call of SatCom is possible?
- bool m_bEditLock; // edition in progress?
- bool m_bEditFull; // edition in full screen?
- bool m_bPause; // simulation paused
- bool m_bHilite;
- bool m_bTrainerPilot; // remote trainer?
- bool m_bSuspend;
- bool m_bFriendAim;
- bool m_bResetCreate;
- bool m_bMapShow;
- bool m_bMapImage;
+ bool m_immediatSatCom; // SatCom immediately?
+ bool m_beginSatCom; // messages SatCom poster?
+ bool m_movieLock; // movie in progress?
+ bool m_satComLock; // call of SatCom is possible?
+ bool m_editLock; // edition in progress?
+ bool m_editFull; // edition in full screen?
+ bool m_pause; // simulation paused
+ bool m_hilite;
+ bool m_trainerPilot; // remote trainer?
+ bool m_suspend;
+ bool m_friendAim;
+ bool m_resetCreate;
+ bool m_mapShow;
+ bool m_mapImage;
char m_mapFilename[100];
- Math::Point m_tooltipPos;
+ Math::Point m_tooltipPos;
char m_tooltipName[100];
float m_tooltipTime;
@@ -405,28 +474,28 @@ protected:
char m_scriptFile[100];
int m_endingWinRank;
int m_endingLostRank;
- bool m_bWinTerminate;
+ bool m_winTerminate;
float m_fontSize;
- Math::Point m_windowPos;
- Math::Point m_windowDim;
+ Math::Point m_windowPos;
+ Math::Point m_windowDim;
bool m_IOPublic;
- Math::Point m_IOPos;
- Math::Point m_IODim;
+ Math::Point m_IOPos;
+ Math::Point m_IODim;
NewScriptName m_newScriptName[MAXNEWSCRIPTNAME];
float m_cameraPan;
float m_cameraZoom;
- EventMsg m_visitLast;
+ EventType m_visitLast;
CObject* m_visitObject;
CObject* m_visitArrow;
float m_visitTime;
- float m_visitParticule;
- Math::Vector m_visitPos;
- Math::Vector m_visitPosArrow;
+ float m_visitParticle;
+ Math::Vector m_visitPos;
+ Math::Vector m_visitPosArrow;
int m_endTakeTotal;
EndTake m_endTake[10];
@@ -441,19 +510,19 @@ protected:
char m_gamerName[100];
- long m_freeBuild; // constructible buildings
- long m_freeResearch; // researches possible
+ int m_freeBuild; // constructible buildings
+ int m_freeResearch; // researches possible
ShowLimit m_showLimit[MAXSHOWLIMIT];
- D3DCOLORVALUE m_colorRefBot;
- D3DCOLORVALUE m_colorNewBot;
- D3DCOLORVALUE m_colorRefAlien;
- D3DCOLORVALUE m_colorNewAlien;
- D3DCOLORVALUE m_colorRefGreen;
- D3DCOLORVALUE m_colorNewGreen;
- D3DCOLORVALUE m_colorRefWater;
- D3DCOLORVALUE m_colorNewWater;
+ Gfx::Color m_colorRefBot;
+ Gfx::Color m_colorNewBot;
+ Gfx::Color m_colorRefAlien;
+ Gfx::Color m_colorNewAlien;
+ Gfx::Color m_colorRefGreen;
+ Gfx::Color m_colorNewGreen;
+ Gfx::Color m_colorRefWater;
+ Gfx::Color m_colorNewWater;
float m_colorShiftWater;
};
diff --git a/src/object/task/task.cpp b/src/object/task/task.cpp
index f910ea2..b310fd5 100644
--- a/src/object/task/task.cpp
+++ b/src/object/task/task.cpp
@@ -17,7 +17,7 @@
// task.cpp
-#include <stdio.h>
+// #include <stdio.h>
#include "object/task/task.h"
@@ -32,20 +32,20 @@ CTask::CTask(CInstanceManager* iMan, CObject* object)
{
m_iMan = iMan;
- m_engine = (CD3DEngine*)m_iMan->SearchInstance(CLASS_ENGINE);
- m_light = (CLight*)m_iMan->SearchInstance(CLASS_LIGHT);
- m_particule = (CParticule*)m_iMan->SearchInstance(CLASS_PARTICULE);
- m_terrain = (CTerrain*)m_iMan->SearchInstance(CLASS_TERRAIN);
- m_water = (CWater*)m_iMan->SearchInstance(CLASS_WATER);
- m_camera = (CCamera*)m_iMan->SearchInstance(CLASS_CAMERA);
- m_main = (CRobotMain*)m_iMan->SearchInstance(CLASS_MAIN);
- m_displayText = (CDisplayText*)m_iMan->SearchInstance(CLASS_DISPLAYTEXT);
- m_sound = (CSound*)m_iMan->SearchInstance(CLASS_SOUND);
+ m_engine = static_cast<Gfx::CEngine*>(m_iMan->SearchInstance(CLASS_ENGINE));
+ m_lightMan = static_cast<Gfx::CLightManager*>(m_iMan->SearchInstance(CLASS_LIGHT));
+ m_terrain = static_cast<Gfx::CTerrain*>(m_iMan->SearchInstance(CLASS_TERRAIN));
+ m_water = static_cast<Gfx::CWater*>(m_iMan->SearchInstance(CLASS_WATER));
+ m_particle = static_cast<Gfx::CParticle*>(m_iMan->SearchInstance(CLASS_PARTICULE));
+ m_camera = static_cast<Gfx::CCamera*>(m_iMan->SearchInstance(CLASS_CAMERA));
+ m_displayText = static_cast<Ui::CDisplayText*>(m_iMan->SearchInstance(CLASS_DISPLAYTEXT));
+ m_main = static_cast<CRobotMain*>(m_iMan->SearchInstance(CLASS_MAIN));
+ m_sound = static_cast<CSoundInterface*>(m_iMan->SearchInstance(CLASS_SOUND));
m_object = object;
- m_physics = m_object->RetPhysics();
- m_brain = m_object->RetBrain();
- m_motion = m_object->RetMotion();
+ m_physics = m_object->GetPhysics();
+ m_brain = m_object->GetBrain();
+ m_motion = m_object->GetMotion();
}
// Object's destructor.
diff --git a/src/object/task/task.h b/src/object/task/task.h
index a3ec62c..7239d48 100644
--- a/src/object/task/task.h
+++ b/src/object/task/task.h
@@ -19,24 +19,31 @@
#pragma once
-#include "common/misc.h"
+#include "common/event.h"
+#include "common/global.h"
#include "math/const.h"
class CInstanceManager;
-class CD3DEngine;
-class CLight;
-class CParticule;
-class CTerrain;
-class CWater;
-class CCamera;
class CBrain;
class CPhysics;
class CMotion;
class CObject;
class CRobotMain;
+class CSoundInterface;
+
+namespace Ui {
class CDisplayText;
-class CSound;
+} /* Ui */
+
+namespace Gfx {
+class CEngine;
+class CLightManager;
+class CParticle;
+class CTerrain;
+class CWater;
+class CCamera;
+} /* Gfx */
const float TAKE_DIST = 6.0f; // distance to an object to pick it
@@ -66,21 +73,19 @@ public:
virtual bool Abort();
protected:
-
-protected:
- CInstanceManager* m_iMan;
- CD3DEngine* m_engine;
- CLight* m_light;
- CParticule* m_particule;
- CTerrain* m_terrain;
- CWater* m_water;
- CCamera* m_camera;
- CMotion* m_motion;
- CBrain* m_brain;
- CPhysics* m_physics;
- CObject* m_object;
- CRobotMain* m_main;
- CDisplayText* m_displayText;
- CSound* m_sound;
+ CInstanceManager* m_iMan;
+ Gfx::CEngine* m_engine;
+ Gfx::CLightManager* m_lightMan;
+ Gfx::CParticle* m_particle;
+ Gfx::CTerrain* m_terrain;
+ Gfx::CWater* m_water;
+ Gfx::CCamera* m_camera;
+ CMotion* m_motion;
+ CBrain* m_brain;
+ CPhysics* m_physics;
+ CObject* m_object;
+ CRobotMain* m_main;
+ Ui::CDisplayText* m_displayText;
+ CSoundInterface* m_sound;
};
diff --git a/src/object/task/taskadvance.cpp b/src/object/task/taskadvance.cpp
index e50cb08..0d159d2 100644
--- a/src/object/task/taskadvance.cpp
+++ b/src/object/task/taskadvance.cpp
@@ -16,9 +16,6 @@
// taskadvance.cpp
-
-#include <stdio.h>
-
#include "object/task/taskadvance.h"
#include "math/geometry.h"
@@ -45,13 +42,13 @@ CTaskAdvance::~CTaskAdvance()
bool CTaskAdvance::EventProcess(const Event &event)
{
- if ( m_engine->RetPause() ) return true;
- if ( event.event != EVENT_FRAME ) return true;
+ if ( m_engine->GetPause() ) return true;
+ if ( event.type != EVENT_FRAME ) return true;
m_fixTime += event.rTime;
// Momentarily stationary object (ant on the back)?
- if ( m_object->RetFixed() )
+ if ( m_object->GetFixed() )
{
m_physics->SetMotorSpeedX(0.0f); // stops the advance
m_physics->SetMotorSpeedZ(0.0f); // stops the rotation
@@ -70,12 +67,12 @@ Error CTaskAdvance::Start(float length)
{
m_direction = (length>=0.0f)?1.0f:-1.0f;
m_totalLength = fabs(length);
- m_advanceLength = m_physics->RetLinLength(length);
- m_startPos = m_object->RetPosition(0);
+ m_advanceLength = m_physics->GetLinLength(length);
+ m_startPos = m_object->GetPosition(0);
m_lastDist = 0.0f;
m_fixTime = 0.0f;
- m_timeLimit = m_physics->RetLinTimeLength(m_totalLength, m_direction)*3.0f;
+ m_timeLimit = m_physics->GetLinTimeLength(m_totalLength, m_direction)*3.0f;
if ( m_timeLimit < 2.0f ) m_timeLimit = 2.0f;
m_physics->SetMotorSpeedX(m_direction*1.0f); // forward/backward
@@ -93,7 +90,7 @@ Error CTaskAdvance::IsEnded()
Math::Vector pos;
float length;
- if ( m_engine->RetPause() ) return ERR_CONTINUE;
+ if ( m_engine->GetPause() ) return ERR_CONTINUE;
if ( m_bError )
{
@@ -106,7 +103,7 @@ Error CTaskAdvance::IsEnded()
return ERR_MOVE_IMPOSSIBLE;
}
- pos = m_object->RetPosition(0);
+ pos = m_object->GetPosition(0);
length = Math::DistanceProjected(pos, m_startPos);
if ( length > m_lastDist ) // forward?
diff --git a/src/object/task/taskbuild.cpp b/src/object/task/taskbuild.cpp
index ecbf898..469e9cb 100644
--- a/src/object/task/taskbuild.cpp
+++ b/src/object/task/taskbuild.cpp
@@ -16,15 +16,14 @@
// taskbuild.cpp
-
-#include <stdio.h>
-
#include "object/task/taskbuild.h"
#include "common/iman.h"
-#include "old/light.h"
-#include "old/terrain.h"
-#include "old/water.h"
+#include "graphics/core/color.h"
+#include "graphics/core/light.h"
+#include "graphics/engine/lightman.h"
+#include "graphics/engine/terrain.h"
+#include "graphics/engine/water.h"
#include "math/geometry.h"
#include "object/auto/auto.h"
#include "object/motion/motionhuman.h"
@@ -32,8 +31,7 @@
#include "physics/physics.h"
#include "ui/displaytext.h"
-
-
+#include <string.h>
// Object's constructor.
@@ -68,7 +66,7 @@ CTaskBuild::~CTaskBuild()
for ( i=0 ; i<TBMAXLIGHT ; i++ )
{
if ( m_lightRank[i] == -1 ) continue;
- m_light->DeleteLight(m_lightRank[i]);
+ m_lightMan->DeleteLight(m_lightRank[i]);
}
}
@@ -102,7 +100,7 @@ bool CTaskBuild::CreateBuilding(Math::Vector pos, float angle)
if ( m_type == OBJECT_INFO ) m_buildingHeight = 19.0f;
m_buildingHeight *= 0.25f;
- m_buildingPos = m_building->RetPosition(0);
+ m_buildingPos = m_building->GetPosition(0);
m_buildingPos.y -= m_buildingHeight;
m_building->SetPosition(0, m_buildingPos);
return true;
@@ -112,21 +110,21 @@ bool CTaskBuild::CreateBuilding(Math::Vector pos, float angle)
void CTaskBuild::CreateLight()
{
- D3DLIGHT7 light;
- D3DCOLORVALUE color;
- Math::Vector center, pos, dir;
- Math::Point c, p;
- float angle;
- int i;
+ Gfx::Light light;
+ Gfx::Color color;
+ Math::Vector center, pos, dir;
+ Math::Point c, p;
+ float angle;
+ int i;
- if ( !m_engine->RetLightMode() ) return;
+ if ( !m_engine->GetLightMode() ) return;
- center = m_metal->RetPosition(0);
+ center = m_metal->GetPosition(0);
angle = 0;
for ( i=0 ; i<TBMAXLIGHT ; i++ )
{
- m_lightRank[i] = m_light->CreateLight();
+ m_lightRank[i] = m_lightMan->CreateLight();
if ( m_lightRank[i] == -1 ) continue;
c.x = center.x;
@@ -139,32 +137,32 @@ void CTaskBuild::CreateLight()
pos.y = center.y+40.0f;
dir = center-pos;
- ZeroMemory( &light, sizeof(light) );
- light.dltType = D3DLIGHT_SPOT;
- light.dcvDiffuse.r = 0.0f;
- light.dcvDiffuse.g = 0.0f;
- light.dcvDiffuse.b = 0.0f; // white (invisible)
- light.dvPosition.x = pos.x;
- light.dvPosition.y = pos.y;
- light.dvPosition.z = pos.z;
- light.dvDirection.x = dir.x;
- light.dvDirection.y = dir.y;
- light.dvDirection.z = dir.z;
- light.dvRange = D3DLIGHT_RANGE_MAX;
- light.dvFalloff = 1.0f;
- light.dvAttenuation0 = 1.0f;
- light.dvAttenuation1 = 0.0f;
- light.dvAttenuation2 = 0.0f;
- light.dvTheta = 0.0f;
- light.dvPhi = Math::PI/4.0f;
- m_light->SetLight(m_lightRank[i], light);
+ memset(&light, 0, sizeof(light));
+ light.type = Gfx::LIGHT_SPOT;
+ light.diffuse.r = 0.0f;
+ light.diffuse.g = 0.0f;
+ light.diffuse.b = 0.0f; // white (invisible)
+ light.position.x = pos.x;
+ light.position.y = pos.y;
+ light.position.z = pos.z;
+ light.direction.x = dir.x;
+ light.direction.y = dir.y;
+ light.direction.z = dir.z;
+ //TODO Is this value correct
+ light.spotIntensity = 128;
+ light.attenuation0 = 1.0f;
+ light.attenuation1 = 0.0f;
+ light.attenuation2 = 0.0f;
+ //TODO Is this value correct
+ light.spotAngle = 90;
+ m_lightMan->SetLight(m_lightRank[i], light);
color.r = -1.0f;
color.g = -1.0f;
color.b = -0.5f; // violet
color.a = 0.0f;
- m_light->SetLightColor(m_lightRank[i], color);
- m_light->SetLightColorSpeed(m_lightRank[i], 1.0f/((1.0f/m_speed)*0.25f));
+ m_lightMan->SetLightColor(m_lightRank[i], color);
+ m_lightMan->SetLightColorSpeed(m_lightRank[i], 1.0f/((1.0f/m_speed)*0.25f));
angle += (Math::PI*2.0f)/TBMAXLIGHT;
}
@@ -176,8 +174,8 @@ void CTaskBuild::CreateLight()
void CTaskBuild::BlackLight()
{
- D3DCOLORVALUE color;
- int i;
+ Gfx::Color color;
+ int i;
for ( i=0 ; i<TBMAXLIGHT ; i++ )
{
@@ -187,8 +185,8 @@ void CTaskBuild::BlackLight()
color.g = 0.0f;
color.b = 0.0f; // white (invisible)
color.a = 0.0f;
- m_light->SetLightColor(m_lightRank[i], color);
- m_light->SetLightColorSpeed(m_lightRank[i], 1.0f/((1.0f/m_speed)*0.75f));
+ m_lightMan->SetLightColor(m_lightRank[i], color);
+ m_lightMan->SetLightColorSpeed(m_lightRank[i], 1.0f/((1.0f/m_speed)*0.75f));
}
m_bBlack = true;
@@ -203,8 +201,8 @@ bool CTaskBuild::EventProcess(const Event &event)
Math::Point dim;
float a, g, cirSpeed, dist, linSpeed;
- if ( m_engine->RetPause() ) return true;
- if ( event.event != EVENT_FRAME ) return true;
+ if ( m_engine->GetPause() ) return true;
+ if ( event.type != EVENT_FRAME ) return true;
if ( m_bError ) return false;
m_time += event.rTime;
@@ -213,7 +211,7 @@ bool CTaskBuild::EventProcess(const Event &event)
if ( m_phase == TBP_TURN ) // preliminary rotation?
{
- a = m_object->RetAngleY(0);
+ a = m_object->GetAngleY(0);
g = m_angleY;
cirSpeed = Math::Direction(a, g)*1.0f;
if ( cirSpeed > 1.0f ) cirSpeed = 1.0f;
@@ -225,7 +223,7 @@ bool CTaskBuild::EventProcess(const Event &event)
if ( m_phase == TBP_MOVE ) // preliminary forward/backward?
{
- dist = Math::Distance(m_object->RetPosition(0), m_metal->RetPosition(0));
+ dist = Math::Distance(m_object->GetPosition(0), m_metal->GetPosition(0));
linSpeed = 0.0f;
if ( dist > 30.0f ) linSpeed = 1.0f;
if ( dist < 30.0f ) linSpeed = -1.0f;
@@ -258,8 +256,8 @@ bool CTaskBuild::EventProcess(const Event &event)
{
m_bBuild = true;
- pos = m_metal->RetPosition(0);
- a = m_object->RetAngleY(0);
+ pos = m_metal->GetPosition(0);
+ a = m_object->GetAngleY(0);
if ( !CreateBuilding(pos, a+Math::PI) )
{
m_metal->SetLock(false); // usable again
@@ -270,7 +268,7 @@ bool CTaskBuild::EventProcess(const Event &event)
m_camera->FlushEffect();
Abort();
m_bError = true;
- m_displayText->DisplayError(ERR_TOOMANY, m_object->RetPosition(0));
+ m_displayText->DisplayError(ERR_TOOMANY, m_object->GetPosition(0));
return false;
}
CreateLight();
@@ -295,32 +293,32 @@ bool CTaskBuild::EventProcess(const Event &event)
BlackLight();
}
- if ( m_lastParticule+m_engine->ParticuleAdapt(0.05f) <= m_time )
+ if ( m_lastParticle+m_engine->ParticleAdapt(0.05f) <= m_time )
{
- m_lastParticule = m_time;
+ m_lastParticle = m_time;
- pos = m_metal->RetPosition(0);
+ pos = m_metal->GetPosition(0);
speed.x = (Math::Rand()-0.5f)*20.0f;
speed.z = (Math::Rand()-0.5f)*20.0f;
speed.y = Math::Rand()*10.0f;
dim.x = Math::Rand()*6.0f+4.0f;
dim.y = dim.x;
- m_particule->CreateParticule(pos, speed, dim, PARTIFIRE);
+ m_particle->CreateParticle(pos, speed, dim, Gfx::PARTIFIRE);
pos = Math::Vector(0.0f, 0.5f, 0.0f);
- mat = m_object->RetWorldMatrix(14);
+ mat = m_object->GetWorldMatrix(14);
pos = Transform(*mat, pos);
- speed = m_metal->RetPosition(0);
+ speed = m_metal->GetPosition(0);
speed.x += (Math::Rand()-0.5f)*5.0f;
speed.z += (Math::Rand()-0.5f)*5.0f;
speed -= pos;
dim.x = 2.0f;
dim.y = dim.x;
- m_particule->CreateParticule(pos, speed, dim, PARTIFIREZ);
+ m_particle->CreateParticle(pos, speed, dim, Gfx::PARTIFIREZ);
if ( Math::Rand() < 0.3f )
{
- m_sound->Play(SOUND_BUILD, m_object->RetPosition(0), 0.5f, 1.0f*Math::Rand()*1.5f);
+ m_sound->Play(SOUND_BUILD, m_object->GetPosition(0), 0.5f, 1.0f*Math::Rand()*1.5f);
}
}
@@ -337,25 +335,25 @@ Error CTaskBuild::Start(ObjectType type)
float iAngle, oAngle;
m_type = type;
- m_lastParticule = 0.0f;
+ m_lastParticle = 0.0f;
m_progress = 0.0f;
- iAngle = m_object->RetAngleY(0);
+ iAngle = m_object->GetAngleY(0);
iAngle = Math::NormAngle(iAngle); // 0..2*Math::PI
oAngle = iAngle;
m_bError = true; // operation impossible
- pos = m_object->RetPosition(0);
- if ( pos.y < m_water->RetLevel() ) return ERR_BUILD_WATER;
+ pos = m_object->GetPosition(0);
+ if ( pos.y < m_water->GetLevel() ) return ERR_BUILD_WATER;
- if ( !m_physics->RetLand() ) return ERR_BUILD_FLY;
+ if ( !m_physics->GetLand() ) return ERR_BUILD_FLY;
- speed = m_physics->RetMotorSpeed();
+ speed = m_physics->GetMotorSpeed();
if ( speed.x != 0.0f ||
speed.z != 0.0f ) return ERR_BUILD_MOTOR;
- if ( m_object->RetFret() != 0 ) return ERR_MANIP_BUSY;
+ if ( m_object->GetFret() != 0 ) return ERR_MANIP_BUSY;
m_metal = SearchMetalObject(oAngle, 2.0f, 100.0f, Math::PI*0.25f, err);
if ( err == ERR_BUILD_METALNEAR && m_metal != 0 )
@@ -375,9 +373,9 @@ Error CTaskBuild::Start(ObjectType type)
m_phase = TBP_TURN; // rotation necessary preliminary
m_angleY = oAngle; // angle was reached
- pv = m_object->RetPosition(0);
+ pv = m_object->GetPosition(0);
pv.y += 8.3f;
- pm = m_metal->RetPosition(0);
+ pm = m_metal->GetPosition(0);
m_angleZ = Math::RotateAngle(Math::DistanceProjected(pv, pm), fabs(pv.y-pm.y));
m_physics->SetFreeze(true); // it does not move
@@ -394,27 +392,27 @@ Error CTaskBuild::IsEnded()
CAuto* automat;
float angle, dist, time;
- if ( m_engine->RetPause() ) return ERR_CONTINUE;
+ if ( m_engine->GetPause() ) return ERR_CONTINUE;
if ( m_bError ) return ERR_STOP;
if ( m_phase == TBP_TURN ) // preliminary rotation?
{
- angle = m_object->RetAngleY(0);
+ angle = m_object->GetAngleY(0);
angle = Math::NormAngle(angle); // 0..2*Math::PI
if ( Math::TestAngle(angle, m_angleY-Math::PI*0.01f, m_angleY+Math::PI*0.01f) )
{
m_physics->SetMotorSpeedZ(0.0f);
- dist = Math::Distance(m_object->RetPosition(0), m_metal->RetPosition(0));
+ dist = Math::Distance(m_object->GetPosition(0), m_metal->GetPosition(0));
if ( dist > 30.0f )
{
- time = m_physics->RetLinTimeLength(dist-30.0f, 1.0f);
+ time = m_physics->GetLinTimeLength(dist-30.0f, 1.0f);
m_speed = 1.0f/time;
}
else
{
- time = m_physics->RetLinTimeLength(30.0f-dist, -1.0f);
+ time = m_physics->GetLinTimeLength(30.0f-dist, -1.0f);
m_speed = 1.0f/time;
}
m_phase = TBP_MOVE;
@@ -425,7 +423,7 @@ Error CTaskBuild::IsEnded()
if ( m_phase == TBP_MOVE ) // preliminary forward/backward?
{
- dist = Math::Distance(m_object->RetPosition(0), m_metal->RetPosition(0));
+ dist = Math::Distance(m_object->GetPosition(0), m_metal->GetPosition(0));
if ( dist >= 25.0f && dist <= 35.0f )
{
@@ -466,12 +464,12 @@ Error CTaskBuild::IsEnded()
{
if ( m_progress < 1.0f ) return ERR_CONTINUE;
- m_soundChannel = m_sound->Play(SOUND_TREMBLE, m_object->RetPosition(0), 0.0f, 1.0f, true);
+ m_soundChannel = m_sound->Play(SOUND_TREMBLE, m_object->GetPosition(0), 0.0f, 1.0f, true);
m_sound->AddEnvelope(m_soundChannel, 0.7f, 1.0f, 1.0f, SOPER_CONTINUE);
m_sound->AddEnvelope(m_soundChannel, 0.7f, 1.5f, 7.0f, SOPER_CONTINUE);
m_sound->AddEnvelope(m_soundChannel, 0.0f, 1.5f, 2.0f, SOPER_STOP);
- m_camera->StartEffect(CE_VIBRATION, m_metal->RetPosition(0), 1.0f);
+ m_camera->StartEffect(Gfx::CAM_EFFECT_VIBRATION, m_metal->GetPosition(0), 1.0f);
m_phase = TBP_BUILD;
m_speed = 1.0f/10.f; // duration of 10s
@@ -482,7 +480,7 @@ Error CTaskBuild::IsEnded()
{
if ( m_progress < 1.0f ) return ERR_CONTINUE;
- DeleteMark(m_metal->RetPosition(0), 20.0f);
+ DeleteMark(m_metal->GetPosition(0), 20.0f);
m_metal->DeleteObject(); // removes the metal
delete m_metal;
@@ -494,7 +492,7 @@ Error CTaskBuild::IsEnded()
m_main->CreateShortcuts();
m_displayText->DisplayError(INFO_BUILD, m_buildingPos, 10.0f, 50.0f);
- automat = m_building->RetAuto();
+ automat = m_building->GetAuto();
if ( automat != 0 )
{
automat->Init();
@@ -583,16 +581,16 @@ Error CTaskBuild::FlatFloor()
if ( m_type == OBJECT_INFO ) radius = 5.0f;
if ( radius == 0.0f ) return ERR_GENERIC;
- center = m_metal->RetPosition(0);
- angle = m_terrain->RetFineSlope(center);
- bLittleFlat = ( angle < FLATLIMIT );
+ center = m_metal->GetPosition(0);
+ angle = m_terrain->GetFineSlope(center);
+ bLittleFlat = ( angle < Gfx::TERRAIN_FLATLIMIT);
- max = m_terrain->RetFlatZoneRadius(center, radius);
+ max = m_terrain->GetFlatZoneRadius(center, radius);
if ( max < radius ) // area too small?
{
if ( bLittleFlat )
{
- m_main->SetShowLimit(1, PARTILIMIT3, m_metal, center, max, 10.0f);
+ m_main->SetShowLimit(1, Gfx::PARTILIMIT3, m_metal, center, max, 10.0f);
}
return bLittleFlat?ERR_BUILD_FLATLIT:ERR_BUILD_FLAT;
}
@@ -601,18 +599,18 @@ Error CTaskBuild::FlatFloor()
bBase = false;
for ( i=0 ; i<1000000 ; i++ )
{
- pObj = (CObject*)m_iMan->SearchInstance(CLASS_OBJECT, i);
+ pObj = static_cast<CObject*>(m_iMan->SearchInstance(CLASS_OBJECT, i));
if ( pObj == 0 ) break;
- if ( !pObj->RetActif() ) continue; // inactive?
- if ( pObj->RetTruck() != 0 ) continue; // object transported?
+ if ( !pObj->GetActif() ) continue; // inactive?
+ if ( pObj->GetTruck() != 0 ) continue; // object transported?
if ( pObj == m_metal ) continue;
if ( pObj == m_object ) 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;
if ( dist < max )
{
@@ -640,24 +638,24 @@ Error CTaskBuild::FlatFloor()
}
if ( max < radius )
{
- m_main->SetShowLimit(1, PARTILIMIT2, m_metal, center, max, 10.0f);
+ m_main->SetShowLimit(1, Gfx::PARTILIMIT2, m_metal, center, max, 10.0f);
if ( bRadius < 2.0f ) bRadius = 2.0f;
- m_main->SetShowLimit(2, PARTILIMIT3, m_metal, bPos, bRadius, 10.0f);
+ m_main->SetShowLimit(2, Gfx::PARTILIMIT3, m_metal, bPos, bRadius, 10.0f);
return bBase?ERR_BUILD_BASE:ERR_BUILD_BUSY;
}
max = 100000.0f;
for ( i=0 ; i<1000000 ; i++ )
{
- pObj = (CObject*)m_iMan->SearchInstance(CLASS_OBJECT, i);
+ pObj = static_cast<CObject*>(m_iMan->SearchInstance(CLASS_OBJECT, i));
if ( pObj == 0 ) break;
- if ( !pObj->RetActif() ) continue; // inactive?
- if ( pObj->RetTruck() != 0 ) continue; // object transported?
+ if ( !pObj->GetActif() ) continue; // inactive?
+ if ( pObj->GetTruck() != 0 ) continue; // object transported?
if ( pObj == m_metal ) continue;
if ( pObj == m_object ) continue;
- type = pObj->RetType();
+ type = pObj->GetType();
if ( type == OBJECT_DERRICK ||
type == OBJECT_FACTORY ||
type == OBJECT_STATION ||
@@ -691,8 +689,8 @@ Error CTaskBuild::FlatFloor()
}
if ( max-BUILDMARGIN < radius )
{
- m_main->SetShowLimit(1, PARTILIMIT2, m_metal, center, max-BUILDMARGIN, 10.0f);
- m_main->SetShowLimit(2, PARTILIMIT3, m_metal, bPos, bRadius+BUILDMARGIN, 10.0f);
+ m_main->SetShowLimit(1, Gfx::PARTILIMIT2, m_metal, center, max-BUILDMARGIN, 10.0f);
+ m_main->SetShowLimit(2, Gfx::PARTILIMIT3, m_metal, bPos, bRadius+BUILDMARGIN, 10.0f);
return bBase?ERR_BUILD_BASE:ERR_BUILD_NARROW;
}
@@ -711,8 +709,8 @@ CObject* CTaskBuild::SearchMetalObject(float &angle, float dMin, float dMax,
int i;
bool bMetal;
- iPos = m_object->RetPosition(0);
- iAngle = m_object->RetAngleY(0);
+ iPos = m_object->GetPosition(0);
+ iAngle = m_object->GetAngleY(0);
iAngle = Math::NormAngle(iAngle); // 0..2*Math::PI
min = 1000000.0f;
@@ -720,18 +718,18 @@ CObject* CTaskBuild::SearchMetalObject(float &angle, float dMin, float dMax,
bMetal = false;
for ( i=0 ; i<1000000 ; i++ )
{
- pObj = (CObject*)m_iMan->SearchInstance(CLASS_OBJECT, i);
+ pObj = static_cast<CObject*>(m_iMan->SearchInstance(CLASS_OBJECT, i));
if ( pObj == 0 ) break;
- if ( !pObj->RetActif() ) continue; // objet inactive?
- if ( pObj->RetTruck() != 0 ) continue; // object transported?
+ if ( !pObj->GetActif() ) continue; // objet inactive?
+ if ( pObj->GetTruck() != 0 ) continue; // object transported?
- type = pObj->RetType();
+ type = pObj->GetType();
if ( type != OBJECT_METAL ) continue;
bMetal = true; // metal exists
- oPos = pObj->RetPosition(0);
+ oPos = pObj->GetPosition(0);
distance = Math::Distance(oPos, iPos);
a = Math::RotateAngle(oPos.x-iPos.x, iPos.z-oPos.z); // CW!
@@ -781,10 +779,10 @@ void CTaskBuild::DeleteMark(Math::Vector pos, float radius)
for ( i=0 ; i<1000000 ; i++ )
{
- pObj = (CObject*)m_iMan->SearchInstance(CLASS_OBJECT, i);
+ pObj = static_cast<CObject*>(m_iMan->SearchInstance(CLASS_OBJECT, i));
if ( pObj == 0 ) break;
- type = pObj->RetType();
+ type = pObj->GetType();
if ( type != OBJECT_MARKSTONE &&
type != OBJECT_MARKURANIUM &&
type != OBJECT_MARKKEYa &&
@@ -793,7 +791,7 @@ void CTaskBuild::DeleteMark(Math::Vector pos, float radius)
type != OBJECT_MARKKEYd &&
type != OBJECT_MARKPOWER ) continue;
- oPos = pObj->RetPosition(0);
+ oPos = pObj->GetPosition(0);
distance = Math::Distance(oPos, pos);
if ( distance <= radius )
{
diff --git a/src/object/task/taskbuild.h b/src/object/task/taskbuild.h
index 682086d..25300b3 100644
--- a/src/object/task/taskbuild.h
+++ b/src/object/task/taskbuild.h
@@ -63,23 +63,23 @@ protected:
void DeleteMark(Math::Vector pos, float radius);
protected:
- ObjectType m_type; // type of construction
- CObject* m_metal; // transforms metal object
- CObject* m_power; // the vehicle battery
- CObject* m_building; // building built
- TaskBuildPhase m_phase; // phase of the operation
- bool m_bError; // true -> operation impossible
- bool m_bBuild; // true -> building built
- bool m_bBlack; // true -> lights black -> white
- float m_time; // absolute time
- float m_lastParticule; // time of generation last particle
- float m_progress; // progression (0..1)
- float m_speed; // speed of progression
- float m_angleY; // rotation angle of the vehicle
- float m_angleZ; // angle of rotation of the gun
- Math::Vector m_buildingPos; // initial position of the building
- float m_buildingHeight; // height of the building
- int m_lightRank[TBMAXLIGHT];// lights for the effects
- int m_soundChannel;
+ ObjectType m_type; // type of construction
+ CObject* m_metal; // transforms metal object
+ CObject* m_power; // the vehicle battery
+ CObject* m_building; // building built
+ TaskBuildPhase m_phase; // phase of the operation
+ bool m_bError; // true -> operation impossible
+ bool m_bBuild; // true -> building built
+ bool m_bBlack; // true -> lights black -> white
+ float m_time; // absolute time
+ float m_lastParticle; // time of generation last particle
+ float m_progress; // progression (0..1)
+ float m_speed; // speed of progression
+ float m_angleY; // rotation angle of the vehicle
+ float m_angleZ; // angle of rotation of the gun
+ Math::Vector m_buildingPos; // initial position of the building
+ float m_buildingHeight; // height of the building
+ int m_lightRank[TBMAXLIGHT]; // lights for the effects
+ int m_soundChannel;
};
diff --git a/src/object/task/taskfire.cpp b/src/object/task/taskfire.cpp
index 92c51da..99a88b8 100644
--- a/src/object/task/taskfire.cpp
+++ b/src/object/task/taskfire.cpp
@@ -16,12 +16,9 @@
// taskfire.cpp
-
-#include <stdio.h>
-
#include "object/task/taskfire.h"
-#include "old/particule.h"
+#include "graphics/engine/particle.h"
#include "math/geometry.h"
#include "physics/physics.h"
@@ -66,32 +63,32 @@ bool CTaskFire::EventProcess(const Event &event)
float energy, fire;
int i, channel;
- if ( m_engine->RetPause() ) return true;
- if ( event.event != EVENT_FRAME ) return true;
+ if ( m_engine->GetPause() ) return true;
+ if ( event.type != EVENT_FRAME ) return true;
if ( m_bError ) return false;
m_time += event.rTime;
m_lastSound -= event.rTime;
m_progress += event.rTime*m_speed;
- power = m_object->RetPower();
+ power = m_object->GetPower();
if ( power != 0 )
{
- energy = power->RetEnergy();
+ energy = power->GetEnergy();
if ( m_bOrganic ) fire = ENERGY_FIREi;
else if ( m_bRay ) fire = ENERGY_FIREr;
else fire = ENERGY_FIRE;
- energy -= event.rTime*fire/power->RetCapacity();
+ energy -= event.rTime*fire/power->GetCapacity();
power->SetEnergy(energy);
}
- if ( m_lastParticule+0.05f <= m_time )
+ if ( m_lastParticle+0.05f <= m_time )
{
- m_lastParticule = m_time;
+ m_lastParticle = m_time;
if ( m_bOrganic )
{
- mat = m_object->RetWorldMatrix(1); // insect-cannon
+ mat = m_object->GetWorldMatrix(1); // insect-cannon
for ( i=0 ; i<6 ; i++ )
{
@@ -100,10 +97,10 @@ bool CTaskFire::EventProcess(const Event &event)
speed = Math::Vector(200.0f, 0.0f, 0.0f);
- physics = m_object->RetPhysics();
+ physics = m_object->GetPhysics();
if ( physics != 0 )
{
- speed += physics->RetLinMotion(MO_REASPEED);
+ speed += physics->GetLinMotion(MO_REASPEED);
}
speed.x += (Math::Rand()-0.5f)*10.0f;
@@ -115,13 +112,13 @@ bool CTaskFire::EventProcess(const Event &event)
dim.x = Math::Rand()*0.5f+0.5f;
dim.y = dim.x;
- channel = m_particule->CreateParticule(pos, speed, dim, PARTIGUN4, 0.8f, 0.0f, 0.0f);
- m_particule->SetObjectFather(channel, m_object);
+ channel = m_particle->CreateParticle(pos, speed, dim, Gfx::PARTIGUN4, 0.8f, 0.0f, 0.0f);
+ m_particle->SetObjectFather(channel, m_object);
}
}
else if ( m_bRay )
{
- mat = m_object->RetWorldMatrix(2); // cannon
+ mat = m_object->GetWorldMatrix(2); // cannon
for ( i=0 ; i<4 ; i++ )
{
@@ -139,9 +136,9 @@ bool CTaskFire::EventProcess(const Event &event)
dim.x = 1.0f;
dim.y = dim.x;
- channel = m_particule->CreateTrack(pos, speed, dim, PARTITRACK11,
+ channel = m_particle->CreateTrack(pos, speed, dim, Gfx::PARTITRACK11,
2.0f, 200.0f, 0.5f, 1.0f);
- m_particule->SetObjectFather(channel, m_object);
+ m_particle->SetObjectFather(channel, m_object);
speed = Math::Vector(5.0f, 0.0f, 0.0f);
speed.x += (Math::Rand()-0.5f)*1.0f;
@@ -153,20 +150,20 @@ bool CTaskFire::EventProcess(const Event &event)
dim.x = 2.0f;
dim.y = dim.x;
- m_particule->CreateParticule(pos, speed, dim, PARTISMOKE2, 2.0f, 0.0f, 0.5f);
+ m_particle->CreateParticle(pos, speed, dim, Gfx::PARTISMOKE2, 2.0f, 0.0f, 0.5f);
}
}
else
{
- type = m_object->RetType();
+ type = m_object->GetType();
if ( type == OBJECT_MOBILErc )
{
- mat = m_object->RetWorldMatrix(2); // cannon
+ mat = m_object->GetWorldMatrix(2); // cannon
}
else
{
- mat = m_object->RetWorldMatrix(1); // cannon
+ mat = m_object->GetWorldMatrix(1); // cannon
}
for ( i=0 ; i<3 ; i++ )
@@ -185,10 +182,10 @@ bool CTaskFire::EventProcess(const Event &event)
speed = Math::Vector(200.0f, 0.0f, 0.0f);
- physics = m_object->RetPhysics();
+ physics = m_object->GetPhysics();
if ( physics != 0 )
{
- speed += physics->RetLinMotion(MO_REASPEED);
+ speed += physics->GetLinMotion(MO_REASPEED);
}
speed.x += (Math::Rand()-0.5f)*3.0f;
@@ -200,8 +197,8 @@ bool CTaskFire::EventProcess(const Event &event)
dim.x = Math::Rand()*0.7f+0.7f;
dim.y = dim.x;
- channel = m_particule->CreateParticule(pos, speed, dim, PARTIGUN1, 0.8f, 0.0f, 0.0f);
- m_particule->SetObjectFather(channel, m_object);
+ channel = m_particle->CreateParticle(pos, speed, dim, Gfx::PARTIGUN1, 0.8f, 0.0f, 0.0f);
+ m_particle->SetObjectFather(channel, m_object);
}
if ( type != OBJECT_MOBILErc &&
@@ -222,8 +219,8 @@ bool CTaskFire::EventProcess(const Event &event)
dim.x = Math::Rand()*1.2f+1.2f;
dim.y = dim.x;
- m_particule->CreateParticule(pos, speed, dim, PARTICRASH, 2.0f, 0.0f, 0.0f);
-//? m_particule->CreateParticule(pos, speed, dim, PARTISMOKE2, 4.0f, 0.0f, 0.0f);
+ m_particle->CreateParticle(pos, speed, dim, Gfx::PARTICRASH, 2.0f, 0.0f, 0.0f);
+//? m_particle->CreateParticle(pos, speed, dim, PARTISMOKE2, 4.0f, 0.0f, 0.0f);
}
}
@@ -256,7 +253,7 @@ bool CTaskFire::EventProcess(const Event &event)
if ( m_bRay && m_lastSound <= 0.0f )
{
m_lastSound = Math::Rand()*0.4f+0.4f;
- m_sound->Play(SOUND_FIREp, m_object->RetPosition(0));
+ m_sound->Play(SOUND_FIREp, m_object->GetPosition(0));
}
return true;
@@ -274,7 +271,7 @@ Error CTaskFire::Start(float delay)
m_bError = true; // operation impossible
- type = m_object->RetType();
+ type = m_object->GetType();
if ( type != OBJECT_MOBILEfc &&
type != OBJECT_MOBILEtc &&
type != OBJECT_MOBILEwc &&
@@ -285,9 +282,9 @@ Error CTaskFire::Start(float delay)
type != OBJECT_MOBILEii &&
type != OBJECT_MOBILErc ) return ERR_FIRE_VEH;
-//? if ( !m_physics->RetLand() ) return ERR_FIRE_FLY;
+//? if ( !m_physics->GetLand() ) return ERR_FIRE_FLY;
- speed = m_physics->RetMotorSpeed();
+ speed = m_physics->GetMotorSpeed();
//? if ( speed.x != 0.0f ||
//? speed.z != 0.0f ) return ERR_FIRE_MOTOR;
@@ -309,18 +306,18 @@ Error CTaskFire::Start(float delay)
}
m_delay = delay;
- power = m_object->RetPower();
+ power = m_object->GetPower();
if ( power == 0 ) return ERR_FIRE_ENERGY;
- energy = power->RetEnergy();
+ energy = power->GetEnergy();
if ( m_bOrganic ) fire = m_delay*ENERGY_FIREi;
else if ( m_bRay ) fire = m_delay*ENERGY_FIREr;
else fire = m_delay*ENERGY_FIRE;
- if ( energy < fire/power->RetCapacity()+0.05f ) return ERR_FIRE_ENERGY;
+ if ( energy < fire/power->GetCapacity()+0.05f ) return ERR_FIRE_ENERGY;
m_speed = 1.0f/m_delay;
m_progress = 0.0f;
m_time = 0.0f;
- m_lastParticule = 0.0f;
+ m_lastParticle = 0.0f;
m_lastSound = 0.0f;
m_bError = false; // ok
@@ -328,7 +325,7 @@ Error CTaskFire::Start(float delay)
if ( m_bOrganic )
{
- m_soundChannel = m_sound->Play(SOUND_FIREi, m_object->RetPosition(0), 1.0f, 1.0f, true);
+ m_soundChannel = m_sound->Play(SOUND_FIREi, m_object->GetPosition(0), 1.0f, 1.0f, true);
if ( m_soundChannel != -1 )
{
m_sound->AddEnvelope(m_soundChannel, 1.0f, 1.0f, m_delay, SOPER_CONTINUE);
@@ -340,7 +337,7 @@ Error CTaskFire::Start(float delay)
}
else
{
- m_soundChannel = m_sound->Play(SOUND_FIRE, m_object->RetPosition(0), 1.0f, 1.0f, true);
+ m_soundChannel = m_sound->Play(SOUND_FIRE, m_object->GetPosition(0), 1.0f, 1.0f, true);
if ( m_soundChannel != -1 )
{
m_sound->AddEnvelope(m_soundChannel, 1.0f, 1.0f, m_delay, SOPER_CONTINUE);
@@ -355,7 +352,7 @@ Error CTaskFire::Start(float delay)
Error CTaskFire::IsEnded()
{
- if ( m_engine->RetPause() ) return ERR_CONTINUE;
+ if ( m_engine->GetPause() ) return ERR_CONTINUE;
if ( m_bError ) return ERR_STOP;
if ( m_progress < 1.0f ) return ERR_CONTINUE;
diff --git a/src/object/task/taskfire.h b/src/object/task/taskfire.h
index f06b9f6..5cf4f0c 100644
--- a/src/object/task/taskfire.h
+++ b/src/object/task/taskfire.h
@@ -45,7 +45,7 @@ protected:
bool m_bOrganic;
float m_time;
float m_speed;
- float m_lastParticule;
+ float m_lastParticle;
float m_lastSound;
int m_soundChannel;
};
diff --git a/src/object/task/taskfireant.cpp b/src/object/task/taskfireant.cpp
index 8eb2217..2044685 100644
--- a/src/object/task/taskfireant.cpp
+++ b/src/object/task/taskfireant.cpp
@@ -16,12 +16,9 @@
// taskfireant.cpp
-
-#include <stdio.h>
-
#include "object/task/taskfireant.h"
-#include "old/particule.h"
+#include "graphics/engine/particle.h"
#include "math/geometry.h"
#include "object/motion/motionant.h"
#include "physics/physics.h"
@@ -51,11 +48,11 @@ bool CTaskFireAnt::EventProcess(const Event &event)
Math::Vector dir, vib;
float a, g, cirSpeed;
- if ( m_engine->RetPause() ) return true;
- if ( event.event != EVENT_FRAME ) return true;
+ if ( m_engine->GetPause() ) return true;
+ if ( event.type != EVENT_FRAME ) return true;
if ( m_bError ) return false;
- if ( m_object->RetFixed() ) // insect on its back?
+ if ( m_object->GetFixed() ) // insect on its back?
{
m_bError = true;
return false;
@@ -66,7 +63,7 @@ bool CTaskFireAnt::EventProcess(const Event &event)
if ( m_phase == TFA_TURN ) // preliminary rotation?
{
- a = m_object->RetAngleY(0);
+ a = m_object->GetAngleY(0);
g = m_angle;
cirSpeed = Math::Direction(a, g)*2.0f;
if ( cirSpeed > 2.0f ) cirSpeed = 2.0f;
@@ -89,24 +86,24 @@ Error CTaskFireAnt::Start(Math::Vector impact)
m_impact = impact;
m_bError = true; // operation impossible
- if ( !m_physics->RetLand() ) return ERR_FIRE_VEH;
+ if ( !m_physics->GetLand() ) return ERR_FIRE_VEH;
- type = m_object->RetType();
+ type = m_object->GetType();
if ( type != OBJECT_ANT ) return ERR_FIRE_VEH;
// Insect on its back?
- if ( m_object->RetFixed() ) return ERR_FIRE_VEH;
+ if ( m_object->GetFixed() ) return ERR_FIRE_VEH;
m_physics->SetMotorSpeed(Math::Vector(0.0f, 0.0f, 0.0f));
- pos = m_object->RetPosition(0);
+ pos = m_object->GetPosition(0);
m_angle = Math::RotateAngle(m_impact.x-pos.x, pos.z-m_impact.z); // CW !
m_phase = TFA_TURN;
m_speed = 1.0f/1.0f;
m_progress = 0.0f;
m_time = 0.0f;
- m_lastParticule = 0.0f;
+ m_lastParticle = 0.0f;
m_bError = false; // ok
m_bFire = false; // once!
@@ -123,13 +120,13 @@ Error CTaskFireAnt::IsEnded()
float angle, dist;
int i, channel;
- if ( m_engine->RetPause() ) return ERR_CONTINUE;
+ if ( m_engine->GetPause() ) return ERR_CONTINUE;
if ( m_bError ) return ERR_STOP;
- if ( m_object->RetFixed() ) return ERR_STOP; // insect on its back?
+ if ( m_object->GetFixed() ) return ERR_STOP; // insect on its back?
if ( m_phase == TFA_TURN ) // rotation ?
{
- angle = m_object->RetAngleY(0);
+ angle = m_object->GetAngleY(0);
angle = Math::NormAngle(angle); // 0..2*Math::PI
if ( !Math::TestAngle(angle, m_angle-Math::PI*0.05f, m_angle+Math::PI*0.05f) ) return ERR_CONTINUE;
@@ -164,7 +161,7 @@ Error CTaskFireAnt::IsEnded()
for ( i=0 ; i<20 ; i++ )
{
pos = Math::Vector(-2.5f, -0.7f, 0.0f);
- mat = m_object->RetWorldMatrix(2);
+ mat = m_object->GetWorldMatrix(2);
pos = Math::Transform(*mat, pos);
dist = Math::Distance(pos, m_impact);
speed = m_impact-pos;
@@ -173,8 +170,8 @@ Error CTaskFireAnt::IsEnded()
speed.z += (Math::Rand()-0.5f)*dist*1.2f;
dim.x = 1.0f;
dim.y = dim.x;
- channel = m_particule->CreateParticule(pos, speed, dim, PARTIGUN2, 2.0f, 100.0f, 0.0f);
- m_particule->SetObjectFather(channel, m_object);
+ channel = m_particle->CreateParticle(pos, speed, dim, Gfx::PARTIGUN2, 2.0f, 100.0f, 0.0f);
+ m_particle->SetObjectFather(channel, m_object);
}
}
diff --git a/src/object/task/taskfireant.h b/src/object/task/taskfireant.h
index 1d8ef62..4fa77b8 100644
--- a/src/object/task/taskfireant.h
+++ b/src/object/task/taskfireant.h
@@ -58,6 +58,6 @@ protected:
bool m_bError;
bool m_bFire;
float m_time;
- float m_lastParticule;
+ float m_lastParticle;
};
diff --git a/src/object/task/taskflag.cpp b/src/object/task/taskflag.cpp
index 7fba689..d45fff4 100644
--- a/src/object/task/taskflag.cpp
+++ b/src/object/task/taskflag.cpp
@@ -16,15 +16,13 @@
// taskflag.cpp
-
-#include <stdio.h>
-
#include "object/task/taskflag.h"
#include "math/geometry.h"
#include "common/iman.h"
-#include "old/water.h"
-#include "old/pyro.h"
+#include "graphics/engine/particle.h"
+#include "graphics/engine/pyro.h"
+#include "graphics/engine/water.h"
#include "physics/physics.h"
#include "object/motion/motionhuman.h"
@@ -51,8 +49,8 @@ CTaskFlag::~CTaskFlag()
bool CTaskFlag::EventProcess(const Event &event)
{
if ( m_bError ) return true;
- if ( m_engine->RetPause() ) return true;
- if ( event.event != EVENT_FRAME ) return true;
+ if ( m_engine->GetPause() ) return true;
+ if ( event.type != EVENT_FRAME ) return true;
m_time += event.rTime;
@@ -72,18 +70,18 @@ Error CTaskFlag::Start(TaskFlagOrder order, int rank)
m_time = 0.0f;
m_bError = true; // operation impossible
- if ( !m_physics->RetLand() )
+ if ( !m_physics->GetLand() )
{
- pos = m_object->RetPosition(0);
- if ( pos.y < m_water->RetLevel() ) return ERR_FLAG_WATER;
+ pos = m_object->GetPosition(0);
+ if ( pos.y < m_water->GetLevel() ) return ERR_FLAG_WATER;
return ERR_FLAG_FLY;
}
- speed = m_physics->RetMotorSpeed();
+ speed = m_physics->GetMotorSpeed();
if ( speed.x != 0.0f ||
speed.z != 0.0f ) return ERR_FLAG_MOTOR;
- if ( m_object->RetFret() != 0 ) return ERR_FLAG_BUSY;
+ if ( m_object->GetFret() != 0 ) return ERR_FLAG_BUSY;
if ( order == TFL_CREATE )
{
@@ -109,7 +107,7 @@ Error CTaskFlag::Start(TaskFlagOrder order, int rank)
Error CTaskFlag::IsEnded()
{
- if ( m_engine->RetPause() ) return ERR_CONTINUE;
+ if ( m_engine->GetPause() ) return ERR_CONTINUE;
if ( m_bError ) return ERR_STOP;
if ( m_time < 2.0f ) return ERR_CONTINUE;
@@ -143,12 +141,12 @@ CObject* CTaskFlag::SearchNearest(Math::Vector pos, ObjectType type)
pBest = 0;
for ( i=0 ; i<1000000 ; i++ )
{
- pObj = (CObject*)m_iMan->SearchInstance(CLASS_OBJECT, i);
+ pObj = static_cast<CObject*>(m_iMan->SearchInstance(CLASS_OBJECT, i));
if ( pObj == 0 ) break;
- if ( !pObj->RetEnable() ) continue;
+ if ( !pObj->GetEnable() ) continue;
- oType = pObj->RetType();
+ oType = pObj->GetType();
if ( type == OBJECT_NULL )
{
if ( oType != OBJECT_FLAGb &&
@@ -162,7 +160,7 @@ CObject* CTaskFlag::SearchNearest(Math::Vector pos, ObjectType type)
if ( oType != type ) continue;
}
- oPos = pObj->RetPosition(0);
+ oPos = pObj->GetPosition(0);
dist = Math::DistanceProjected(oPos, pos);
if ( dist < min )
{
@@ -185,12 +183,12 @@ int CTaskFlag::CountObject(ObjectType type)
count = 0;
for ( i=0 ; i<1000000 ; i++ )
{
- pObj = (CObject*)m_iMan->SearchInstance(CLASS_OBJECT, i);
+ pObj = static_cast<CObject*>(m_iMan->SearchInstance(CLASS_OBJECT, i));
if ( pObj == 0 ) break;
- if ( !pObj->RetEnable() ) continue;
+ if ( !pObj->GetEnable() ) continue;
- oType = pObj->RetType();
+ oType = pObj->GetType();
if ( type == OBJECT_NULL )
{
if ( oType != OBJECT_FLAGb &&
@@ -213,13 +211,13 @@ int CTaskFlag::CountObject(ObjectType type)
Error CTaskFlag::CreateFlag(int rank)
{
- CObject* pObj;
- CObject* pNew;
- CPyro* pyro;
- Math::Matrix* mat;
- Math::Vector pos;
- float dist;
- int i;
+ CObject* pObj;
+ CObject* pNew;
+ Gfx::CPyro* pyro;
+ Math::Matrix* mat;
+ Math::Vector pos;
+ float dist;
+ int i;
ObjectType table[5] =
{
@@ -230,13 +228,13 @@ Error CTaskFlag::CreateFlag(int rank)
OBJECT_FLAGv,
};
- mat = m_object->RetWorldMatrix(0);
+ mat = m_object->GetWorldMatrix(0);
pos = Transform(*mat, Math::Vector(4.0f, 0.0f, 0.0f));
pObj = SearchNearest(pos, OBJECT_NULL);
if ( pObj != 0 )
{
- dist = Math::Distance(pos, pObj->RetPosition(0));
+ dist = Math::Distance(pos, pObj->GetPosition(0));
if ( dist < 10.0f )
{
return ERR_FLAG_PROXY;
@@ -258,8 +256,8 @@ Error CTaskFlag::CreateFlag(int rank)
pNew->SetZoom(0, 0.0f);
m_sound->Play(SOUND_WAYPOINT, pos);
- pyro = new CPyro(m_iMan);
- pyro->Create(PT_FLCREATE, pNew);
+ pyro = new Gfx::CPyro(m_iMan);
+ pyro->Create(Gfx::PT_FLCREATE, pNew);
return ERR_OK;
}
@@ -268,13 +266,13 @@ Error CTaskFlag::CreateFlag(int rank)
Error CTaskFlag::DeleteFlag()
{
- CObject* pObj;
- CPyro* pyro;
- Math::Vector iPos, oPos;
- float iAngle, angle, aLimit, dist;
+ CObject* pObj;
+ Gfx::CPyro* pyro;
+ Math::Vector iPos, oPos;
+ float iAngle, angle, aLimit, dist;
- iPos = m_object->RetPosition(0);
- iAngle = m_object->RetAngleY(0);
+ iPos = m_object->GetPosition(0);
+ iAngle = m_object->GetAngleY(0);
iAngle = Math::NormAngle(iAngle); // 0..2*Math::PI
pObj = SearchNearest(iPos, OBJECT_NULL);
@@ -282,13 +280,13 @@ Error CTaskFlag::DeleteFlag()
{
return ERR_FLAG_DELETE;
}
- dist = Math::Distance(iPos, pObj->RetPosition(0));
+ dist = Math::Distance(iPos, pObj->GetPosition(0));
if ( dist > 10.0f )
{
return ERR_FLAG_DELETE;
}
- oPos = pObj->RetPosition(0);
+ oPos = pObj->GetPosition(0);
angle = Math::RotateAngle(oPos.x-iPos.x, iPos.z-oPos.z); // CW !
aLimit = 45.0f*Math::PI/180.0f;
if ( !Math::TestAngle(angle, iAngle-aLimit, iAngle+aLimit) )
@@ -297,8 +295,8 @@ Error CTaskFlag::DeleteFlag()
}
m_sound->Play(SOUND_WAYPOINT, iPos);
- pyro = new CPyro(m_iMan);
- pyro->Create(PT_FLDELETE, pObj);
+ pyro = new Gfx::CPyro(m_iMan);
+ pyro->Create(Gfx::PT_FLDELETE, pObj);
return ERR_OK;
}
diff --git a/src/object/task/taskgoto.cpp b/src/object/task/taskgoto.cpp
index 5fd6cbe..ce778ef 100644
--- a/src/object/task/taskgoto.cpp
+++ b/src/object/task/taskgoto.cpp
@@ -23,11 +23,12 @@
#include "common/event.h"
#include "common/iman.h"
-#include "old/terrain.h"
-#include "old/water.h"
+#include "graphics/engine/terrain.h"
+#include "graphics/engine/water.h"
#include "math/geometry.h"
#include "physics/physics.h"
+#include <string.h>
const float FLY_DIST_GROUND = 80.0f; // minimum distance to remain on the ground
@@ -59,14 +60,14 @@ bool CTaskGoto::EventProcess(const Event &event)
{
Math::Vector pos, goal;
Math::Point rot, repulse;
- float a, g, dist, linSpeed, cirSpeed, h, hh, factor, dir;
- Error ret;
+ float a, g, dist, linSpeed, cirSpeed, h, hh, factor, dir;
+ Error ret;
- if ( m_engine->RetPause() ) return true;
- if ( event.event != EVENT_FRAME ) return true;
+ if ( m_engine->GetPause() ) return true;
+ if ( event.type != EVENT_FRAME ) return true;
// Momentarily stationary object (ant on the back)?
- if ( m_object->RetFixed() )
+ if ( m_object->GetFixed() )
{
m_physics->SetMotorSpeedX(0.0f); // stops the advance
m_physics->SetMotorSpeedZ(0.0f); // stops the rotation
@@ -84,7 +85,7 @@ bool CTaskGoto::EventProcess(const Event &event)
{
m_leakTime += event.rTime;
- pos = m_object->RetPosition(0);
+ pos = m_object->GetPosition(0);
rot.x = m_leakPos.x-pos.x;
rot.y = m_leakPos.z-pos.z;
@@ -92,7 +93,7 @@ bool CTaskGoto::EventProcess(const Event &event)
rot.x /= dist;
rot.y /= dist;
- a = m_object->RetAngleY(0);
+ a = m_object->GetAngleY(0);
g = Math::RotateAngle(rot.x, -rot.y); // CW !
a = Math::Direction(a, g)*1.0f;
cirSpeed = a;
@@ -126,10 +127,10 @@ bool CTaskGoto::EventProcess(const Event &event)
if ( m_bmStep == 0 )
{
// Frees the area around the departure.
- BitmapClearCircle(m_object->RetPosition(0), BM_DIM_STEP*1.8f);
+ BitmapClearCircle(m_object->GetPosition(0), BM_DIM_STEP*1.8f);
}
- pos = m_object->RetPosition(0);
+ pos = m_object->GetPosition(0);
if ( m_bmFretObject == 0 )
{
@@ -140,44 +141,20 @@ bool CTaskGoto::EventProcess(const Event &event)
{
goal = m_goalObject;
dist = TAKE_DIST+2.0f;
- if ( m_bmFretObject->RetType() == OBJECT_BASE ) dist = 12.0f;
+ if ( m_bmFretObject->GetType() == OBJECT_BASE ) dist = 12.0f;
}
ret = BeamSearch(pos, goal, dist);
if ( ret == ERR_OK )
{
-#if 0
- Math::Vector min, max;
- min = pos;
- max = m_goal;
- if ( min.x > max.x ) Math::Swap(min.x, max.x);
- if ( min.z > max.z ) Math::Swap(min.z, max.z);
- min.x -= 50.0f;
- min.z -= 50.0f;
- max.x += 50.0f;
- max.z += 50.0f;
- BitmapDebug(min, max, m_object->RetPosition(0), m_goal);
-#endif
- if ( m_physics->RetLand() ) m_phase = TGP_BEAMWCOLD;
+ if ( m_physics->GetLand() ) m_phase = TGP_BEAMWCOLD;
else m_phase = TGP_BEAMGOTO;
m_bmIndex = 0;
- m_bmWatchDogPos = m_object->RetPosition(0);
+ m_bmWatchDogPos = m_object->GetPosition(0);
m_bmWatchDogTime = 0.0f;
}
if ( ret == ERR_GOTO_IMPOSSIBLE || ret == ERR_GOTO_ITER )
{
-#if 0
- Math::Vector min, max;
- min = pos;
- max = m_goal;
- if ( min.x > max.x ) Math::Swap(min.x, max.x);
- if ( min.z > max.z ) Math::Swap(min.z, max.z);
- min.x -= 50.0f;
- min.z -= 50.0f;
- max.x += 50.0f;
- max.z += 50.0f;
- BitmapDebug(min, max, m_object->RetPosition(0), m_goal);
-#endif
m_error = ret;
return false;
}
@@ -197,16 +174,16 @@ bool CTaskGoto::EventProcess(const Event &event)
if ( m_phase == TGP_BEAMGOTO ) // goto dot list? (?)
{
- if ( m_physics->RetCollision() ) // collision?
+ if ( m_physics->GetCollision() ) // collision?
{
m_physics->SetCollision(false); // there's more
}
- pos = m_object->RetPosition(0);
+ pos = m_object->GetPosition(0);
- if ( m_physics->RetType() == TYPE_FLYING && m_altitude == 0.0f )
+ if ( m_physics->GetType() == TYPE_FLYING && m_altitude == 0.0f )
{
- if ( m_physics->RetLand() )
+ if ( m_physics->GetLand() )
{
m_physics->SetMotorSpeedY(0.0f);
}
@@ -216,21 +193,21 @@ bool CTaskGoto::EventProcess(const Event &event)
}
}
- if ( m_physics->RetType() == TYPE_FLYING && m_altitude > 0.0f )
+ if ( m_physics->GetType() == TYPE_FLYING && m_altitude > 0.0f )
{
goal = m_bmPoints[m_bmIndex];
goal.y = pos.y;
- h = m_terrain->RetFloorHeight(goal, true, true);
+ h = m_terrain->GetHeightToFloor(goal, true, true);
dist = Math::DistanceProjected(pos, goal);
if ( dist != 0.0f ) // anticipates?
{
- linSpeed = m_physics->RetLinMotionX(MO_REASPEED);
- linSpeed /= m_physics->RetLinMotionX(MO_ADVSPEED);
+ linSpeed = m_physics->GetLinMotionX(MO_REASPEED);
+ linSpeed /= m_physics->GetLinMotionX(MO_ADVSPEED);
goal.x = pos.x + (goal.x-pos.x)*linSpeed*20.0f/dist;
goal.z = pos.z + (goal.z-pos.z)*linSpeed*20.0f/dist;
}
goal.y = pos.y;
- hh = m_terrain->RetFloorHeight(goal, true, true);
+ hh = m_terrain->GetHeightToFloor(goal, true, true);
h = Math::Min(h, hh);
linSpeed = 0.0f;
if ( h < m_altitude-1.0f )
@@ -251,7 +228,7 @@ bool CTaskGoto::EventProcess(const Event &event)
rot.x /= dist;
rot.y /= dist;
- a = m_object->RetAngleY(0);
+ a = m_object->GetAngleY(0);
g = Math::RotateAngle(rot.x, -rot.y); // CW !
cirSpeed = Math::Direction(a, g)*2.0f;
if ( cirSpeed > 1.0f ) cirSpeed = 1.0f;
@@ -260,7 +237,7 @@ bool CTaskGoto::EventProcess(const Event &event)
if ( m_bmIndex == m_bmTotal ) // last point?
{
- linSpeed = dist/(m_physics->RetLinStopLength()*1.5f);
+ linSpeed = dist/(m_physics->GetLinStopLength()*1.5f);
if ( linSpeed > 1.0f ) linSpeed = 1.0f;
}
else
@@ -316,7 +293,7 @@ bool CTaskGoto::EventProcess(const Event &event)
{
if ( m_crashMode == TGC_HALT )
{
- if ( m_physics->RetCollision() ) // collision?
+ if ( m_physics->GetCollision() ) // collision?
{
m_physics->SetCollision(false); // there's more
m_error = ERR_STOP;
@@ -324,11 +301,11 @@ bool CTaskGoto::EventProcess(const Event &event)
}
}
- pos = m_object->RetPosition(0);
+ pos = m_object->GetPosition(0);
if ( m_altitude > 0.0f )
{
- h = m_terrain->RetFloorHeight(pos, true, true);
+ h = m_terrain->GetHeightToFloor(pos, true, true);
linSpeed = 0.0f;
if ( h < m_altitude )
{
@@ -343,7 +320,7 @@ bool CTaskGoto::EventProcess(const Event &event)
rot.x = m_goal.x-pos.x;
rot.y = m_goal.z-pos.z;
- a = m_object->RetAngleY(0);
+ a = m_object->GetAngleY(0);
g = Math::RotateAngle(rot.x, -rot.y); // CW !
cirSpeed = Math::Direction(a, g)*1.0f;
if ( cirSpeed > 1.0f ) cirSpeed = 1.0f;
@@ -355,16 +332,16 @@ bool CTaskGoto::EventProcess(const Event &event)
}
if ( m_phase != TGP_TURN &&
- m_physics->RetType() == TYPE_FLYING &&
+ m_physics->GetType() == TYPE_FLYING &&
m_altitude > 0.0f )
{
- pos = m_object->RetPosition(0);
+ pos = m_object->GetPosition(0);
dist = Math::DistanceProjected(m_goal, pos);
factor = (dist-20.0f)/20.0f;
if ( factor < 0.0f ) factor = 0.0f;
if ( factor > 1.0f ) factor = 1.0f;
- h = m_terrain->RetFloorHeight(m_object->RetPosition(0), true, true);
+ h = m_terrain->GetHeightToFloor(m_object->GetPosition(0), true, true);
linSpeed = 0.0f;
if ( h < (m_altitude-0.5f)*factor && factor == 1.0f )
{
@@ -382,7 +359,7 @@ bool CTaskGoto::EventProcess(const Event &event)
if ( m_phase == TGP_ADVANCE ) // going towards the goal?
{
- if ( m_physics->RetCollision() ) // collision?
+ if ( m_physics->GetCollision() ) // collision?
{
m_physics->SetCollision(false); // there's more
m_time = 0.0f;
@@ -391,15 +368,15 @@ bool CTaskGoto::EventProcess(const Event &event)
}
#if 0
- pos = m_object->RetPosition(0);
- a = m_object->RetAngleY(0);
+ pos = m_object->GetPosition(0);
+ a = m_object->GetAngleY(0);
g = Math::RotateAngle(m_goal.x-pos.x, pos.z-m_goal.z); // CW !
cirSpeed = Math::Direction(a, g)*1.0f;
if ( cirSpeed > 1.0f ) cirSpeed = 1.0f;
if ( cirSpeed < -1.0f ) cirSpeed = -1.0f;
dist = Math::DistanceProjected(m_goal, pos);
- linSpeed = dist/(m_physics->RetLinStopLength()*1.5f);
+ linSpeed = dist/(m_physics->GetLinStopLength()*1.5f);
if ( linSpeed > 1.0f ) linSpeed = 1.0f;
if ( dist < 20.0f && fabs(cirSpeed) >= 0.5f )
@@ -407,7 +384,7 @@ bool CTaskGoto::EventProcess(const Event &event)
linSpeed = 0.0f; // turns first, then advance
}
#else
- pos = m_object->RetPosition(0);
+ pos = m_object->GetPosition(0);
rot.x = m_goal.x-pos.x;
rot.y = m_goal.z-pos.z;
@@ -419,11 +396,11 @@ bool CTaskGoto::EventProcess(const Event &event)
rot.x += repulse.x*2.0f;
rot.y += repulse.y*2.0f;
- a = m_object->RetAngleY(0);
+ a = m_object->GetAngleY(0);
g = Math::RotateAngle(rot.x, -rot.y); // CW !
cirSpeed = Math::Direction(a, g)*1.0f;
-//? if ( m_physics->RetType() == TYPE_FLYING &&
-//? m_physics->RetLand() ) // flying on the ground?
+//? if ( m_physics->GetType() == TYPE_FLYING &&
+//? m_physics->GetLand() ) // flying on the ground?
//? {
//? cirSpeed *= 4.0f; // more fishing
//? }
@@ -431,9 +408,9 @@ bool CTaskGoto::EventProcess(const Event &event)
if ( cirSpeed < -1.0f ) cirSpeed = -1.0f;
dist = Math::DistanceProjected(m_goal, pos);
- linSpeed = dist/(m_physics->RetLinStopLength()*1.5f);
-//? if ( m_physics->RetType() == TYPE_FLYING &&
-//? m_physics->RetLand() ) // flying on the ground?
+ linSpeed = dist/(m_physics->GetLinStopLength()*1.5f);
+//? if ( m_physics->GetType() == TYPE_FLYING &&
+//? m_physics->GetLand() ) // flying on the ground?
//? {
//? linSpeed *= 8.0f; // more fishing
//? }
@@ -455,7 +432,7 @@ bool CTaskGoto::EventProcess(const Event &event)
m_phase == TGP_CRTURN || // turns after collision?
m_phase == TGP_CLTURN ) // turns after collision?
{
- a = m_object->RetAngleY(0);
+ a = m_object->GetAngleY(0);
g = m_angle;
cirSpeed = Math::Direction(a, g)*1.0f;
if ( cirSpeed > 1.0f ) cirSpeed = 1.0f;
@@ -474,7 +451,7 @@ bool CTaskGoto::EventProcess(const Event &event)
if ( m_phase == TGP_CRADVANCE ) // advance after collision?
{
- if ( m_physics->RetCollision() ) // collision?
+ if ( m_physics->GetCollision() ) // collision?
{
m_physics->SetCollision(false); // there's more
m_time = 0.0f;
@@ -486,7 +463,7 @@ bool CTaskGoto::EventProcess(const Event &event)
if ( m_phase == TGP_CLADVANCE ) // advance after collision?
{
- if ( m_physics->RetCollision() ) // collision?
+ if ( m_physics->GetCollision() ) // collision?
{
m_physics->SetCollision(false); // there's more
m_time = 0.0f;
@@ -517,15 +494,15 @@ CObject* CTaskGoto::WormSearch(Math::Vector &impact)
float distance, min, radius;
int i;
- iPos = m_object->RetPosition(0);
+ iPos = m_object->GetPosition(0);
min = 1000000.0f;
for ( i=0 ; i<1000000 ; i++ )
{
- pObj = (CObject*)m_iMan->SearchInstance(CLASS_OBJECT, i);
+ pObj = static_cast<CObject*>(m_iMan->SearchInstance(CLASS_OBJECT, i));
if ( pObj == 0 ) break;
- oType = pObj->RetType();
+ oType = pObj->GetType();
if ( oType != OBJECT_MOBILEfa &&
oType != OBJECT_MOBILEta &&
oType != OBJECT_MOBILEwa &&
@@ -570,7 +547,7 @@ CObject* CTaskGoto::WormSearch(Math::Vector &impact)
oType != OBJECT_SAFE &&
oType != OBJECT_HUSTON ) continue;
- if ( pObj->RetVirusMode() ) continue; // object infected?
+ if ( pObj->GetVirusMode() ) continue; // object infected?
if ( !pObj->GetCrashSphere(0, oPos, radius) ) continue;
distance = Math::DistanceProjected(oPos, iPos);
@@ -582,7 +559,7 @@ CObject* CTaskGoto::WormSearch(Math::Vector &impact)
}
if ( pBest == 0 ) return 0;
- impact = pBest->RetPosition(0);
+ impact = pBest->GetPosition(0);
return pBest;
}
@@ -603,7 +580,7 @@ void CTaskGoto::WormFrame(float rTime)
pObj = WormSearch(impact);
if ( pObj != 0 )
{
- pos = m_object->RetPosition(0);
+ pos = m_object->GetPosition(0);
dist = Math::Distance(pos, impact);
if ( dist <= 15.0f )
{
@@ -627,7 +604,7 @@ Error CTaskGoto::Start(Math::Vector goal, float altitude,
float dist;
int x, y;
- type = m_object->RetType();
+ type = m_object->GetType();
if ( goalMode == TGG_DEFAULT )
{
@@ -668,7 +645,7 @@ Error CTaskGoto::Start(Math::Vector goal, float altitude,
m_bmFretObject = 0;
m_bmFinalMove = 0.0f;
- pos = m_object->RetPosition(0);
+ pos = m_object->GetPosition(0);
dist = Math::DistanceProjected(pos, m_goal);
if ( dist < 10.0f && m_crashMode == TGC_BEAM )
{
@@ -703,7 +680,7 @@ Error CTaskGoto::Start(Math::Vector goal, float altitude,
target = SearchTarget(goal, 1.0f);
if ( target != 0 )
{
- m_goal = target->RetPosition(0);
+ m_goal = target->GetPosition(0);
dist = 0.0f;
if ( !AdjustBuilding(m_goal, 1.0f, dist) )
{
@@ -722,7 +699,7 @@ Error CTaskGoto::Start(Math::Vector goal, float altitude,
target = SearchTarget(goal, 1.0f);
if ( target != 0 )
{
- m_goal = target->RetPosition(0);
+ m_goal = target->GetPosition(0);
dist = 4.0f;
if ( AdjustBuilding(m_goal, 1.0f, dist) )
{
@@ -743,9 +720,9 @@ Error CTaskGoto::Start(Math::Vector goal, float altitude,
m_bTake = true; // object was taken on arrival (final rotation)
}
- if ( m_physics->RetType() == TYPE_FLYING && m_altitude == 0.0f )
+ if ( m_physics->GetType() == TYPE_FLYING && m_altitude == 0.0f )
{
- pos = m_object->RetPosition(0);
+ pos = m_object->GetPosition(0);
dist = Math::DistanceProjected(pos, m_goal);
if ( dist > FLY_DIST_GROUND ) // over 20 meters?
{
@@ -757,22 +734,10 @@ Error CTaskGoto::Start(Math::Vector goal, float altitude,
if ( m_bmFretObject == 0 )
{
- x = (int)((m_goal.x+1600.0f)/BM_DIM_STEP);
- y = (int)((m_goal.z+1600.0f)/BM_DIM_STEP);
+ x = static_cast<int>((m_goal.x+1600.0f)/BM_DIM_STEP);
+ y = static_cast<int>((m_goal.z+1600.0f)/BM_DIM_STEP);
if ( BitmapTestDot(0, x, y) ) // arrival occupied?
{
-#if 0
- Math::Vector min, max;
- min = m_object->RetPosition(0);
- max = m_goal;
- if ( min.x > max.x ) Math::Swap(min.x, max.x);
- if ( min.z > max.z ) Math::Swap(min.z, max.z);
- min.x -= 50.0f;
- min.z -= 50.0f;
- max.x += 50.0f;
- max.z += 50.0f;
- BitmapDebug(min, max, m_object->RetPosition(0), m_goal);
-#endif
m_error = ERR_GOTO_BUSY;
return m_error;
}
@@ -789,10 +754,10 @@ Error CTaskGoto::IsEnded()
Math::Vector pos;
float limit, angle, dist, h, level;
- if ( m_engine->RetPause() ) return ERR_CONTINUE;
+ if ( m_engine->GetPause() ) return ERR_CONTINUE;
if ( m_error != ERR_OK ) return m_error;
- pos = m_object->RetPosition(0);
+ pos = m_object->GetPosition(0);
if ( m_phase == TGP_BEAMLEAK ) // leak?
{
@@ -814,17 +779,17 @@ Error CTaskGoto::IsEnded()
if ( m_phase == TGP_BEAMWCOLD ) // expects cool reactor?
{
if ( m_altitude != 0.0f &&
- m_physics->RetReactorRange() < 1.0f ) return ERR_CONTINUE;
+ m_physics->GetReactorRange() < 1.0f ) return ERR_CONTINUE;
m_phase = TGP_BEAMUP;
}
if ( m_phase == TGP_BEAMUP ) // off?
{
- if ( m_physics->RetType() == TYPE_FLYING && m_altitude > 0.0f )
+ if ( m_physics->GetType() == TYPE_FLYING && m_altitude > 0.0f )
{
- level = m_terrain->RetFloorLevel(pos, true, true);
+ level = m_terrain->GetFloorLevel(pos, true, true);
h = level+m_altitude-20.0f;
- limit = m_terrain->RetFlyingMaxHeight();
+ limit = m_terrain->GetFlyingMaxHeight();
if ( h > limit ) h = limit;
if ( pos.y < h-1.0f ) return ERR_CONTINUE;
@@ -836,7 +801,7 @@ Error CTaskGoto::IsEnded()
if ( m_phase == TGP_BEAMGOTO ) // goto dot list ?
{
if ( m_altitude != 0.0f &&
- m_physics->RetReactorRange() < 0.1f ) // overheating?
+ m_physics->GetReactorRange() < 0.1f ) // overheating?
{
m_physics->SetMotorSpeedX(0.0f); // stops the advance
m_physics->SetMotorSpeedZ(0.0f); // stops the rotation
@@ -845,7 +810,7 @@ Error CTaskGoto::IsEnded()
return ERR_CONTINUE;
}
- if ( m_physics->RetLand() ) // on the ground?
+ if ( m_physics->GetLand() ) // on the ground?
{
limit = 1.0f;
}
@@ -873,9 +838,9 @@ Error CTaskGoto::IsEnded()
if ( m_phase == TGP_BEAMDOWN ) // landed?
{
- if ( m_physics->RetType() == TYPE_FLYING && m_altitude > 0.0f )
+ if ( m_physics->GetType() == TYPE_FLYING && m_altitude > 0.0f )
{
- if ( !m_physics->RetLand() ) return ERR_CONTINUE;
+ if ( !m_physics->GetLand() ) return ERR_CONTINUE;
m_physics->SetMotorSpeedY(0.0f); // stops the descent
m_altitude = 0.0f;
@@ -909,7 +874,7 @@ Error CTaskGoto::IsEnded()
if ( m_phase == TGP_ADVANCE ) // going towards the goal?
{
- if ( m_physics->RetLand() ) limit = 0.1f; // on the ground
+ if ( m_physics->GetLand() ) limit = 0.1f; // on the ground
else limit = 1.0f; // flying
if ( m_bApprox ) limit = 2.0f;
@@ -924,9 +889,9 @@ Error CTaskGoto::IsEnded()
if ( m_phase == TGP_LAND ) // landed?
{
- if ( m_physics->RetType() == TYPE_FLYING && m_altitude > 0.0f )
+ if ( m_physics->GetType() == TYPE_FLYING && m_altitude > 0.0f )
{
- if ( !m_physics->RetLand() ) return ERR_CONTINUE;
+ if ( !m_physics->GetLand() ) return ERR_CONTINUE;
m_physics->SetMotorSpeedY(0.0f);
}
@@ -943,7 +908,7 @@ Error CTaskGoto::IsEnded()
if ( m_phase == TGP_TURN ) // turns to the object?
{
- angle = Math::NormAngle(m_object->RetAngleY(0));
+ angle = Math::NormAngle(m_object->GetAngleY(0));
limit = 0.02f;
if ( m_bApprox ) limit = 0.10f;
if ( fabs(angle-m_angle) < limit )
@@ -951,9 +916,9 @@ Error CTaskGoto::IsEnded()
m_physics->SetMotorSpeedZ(0.0f); // stops the rotation
if ( m_bmFinalMove == 0.0f ) return ERR_STOP;
- m_bmFinalPos = m_object->RetPosition(0);
- m_bmFinalDist = m_physics->RetLinLength(m_bmFinalMove);
- m_bmTimeLimit = m_physics->RetLinTimeLength(fabs(m_bmFinalMove))*1.5f;
+ m_bmFinalPos = m_object->GetPosition(0);
+ m_bmFinalDist = m_physics->GetLinLength(m_bmFinalMove);
+ m_bmTimeLimit = m_physics->GetLinTimeLength(fabs(m_bmFinalMove))*1.5f;
if ( m_bmTimeLimit < 0.5f ) m_bmTimeLimit = 0.5f;
m_phase = TGP_MOVE;
}
@@ -973,7 +938,7 @@ Error CTaskGoto::IsEnded()
if ( m_crashMode == TGC_RIGHTLEFT ||
m_crashMode == TGC_RIGHT ) angle = Math::PI/2.0f; // 90 deegres to the right
else angle = -Math::PI/2.0f; // 90 deegres to the left
- m_angle = Math::NormAngle(m_object->RetAngleY(0)+angle);
+ m_angle = Math::NormAngle(m_object->GetAngleY(0)+angle);
m_phase = TGP_CRTURN;
//? m_phase = TGP_ADVANCE;
}
@@ -981,7 +946,7 @@ Error CTaskGoto::IsEnded()
if ( m_phase == TGP_CRTURN ) // turns after collision?
{
- angle = Math::NormAngle(m_object->RetAngleY(0));
+ angle = Math::NormAngle(m_object->GetAngleY(0));
limit = 0.1f;
if ( fabs(angle-m_angle) < limit )
{
@@ -1007,14 +972,14 @@ Error CTaskGoto::IsEnded()
if ( m_crashMode == TGC_LEFTRIGHT ) angle = Math::PI;
if ( m_crashMode == TGC_RIGHT ) angle = Math::PI/2.0f;
if ( m_crashMode == TGC_LEFT ) angle = -Math::PI/2.0f;
- m_angle = Math::NormAngle(m_object->RetAngleY(0)+angle);
+ m_angle = Math::NormAngle(m_object->GetAngleY(0)+angle);
m_phase = TGP_CLTURN;
}
}
if ( m_phase == TGP_CLTURN ) // turns after collision?
{
- angle = Math::NormAngle(m_object->RetAngleY(0));
+ angle = Math::NormAngle(m_object->GetAngleY(0));
limit = 0.1f;
if ( fabs(angle-m_angle) < limit )
{
@@ -1042,7 +1007,7 @@ Error CTaskGoto::IsEnded()
return ERR_STOP;
}
- dist = Math::Distance(m_bmFinalPos, m_object->RetPosition(0));
+ dist = Math::Distance(m_bmFinalPos, m_object->GetPosition(0));
if ( dist < m_bmFinalDist ) return ERR_CONTINUE;
m_physics->SetMotorSpeedX(0.0f); // stops the advance
return ERR_STOP;
@@ -1065,13 +1030,13 @@ CObject* CTaskGoto::SearchTarget(Math::Vector pos, float margin)
min = 1000000.0f;
for ( i=0 ; i<1000000 ; i++ )
{
- pObj = (CObject*)m_iMan->SearchInstance(CLASS_OBJECT, i);
+ pObj = static_cast<CObject*>(m_iMan->SearchInstance(CLASS_OBJECT, i));
if ( pObj == 0 ) break;
- if ( !pObj->RetActif() ) continue;
- if ( pObj->RetTruck() != 0 ) continue; // object transtorted?
+ if ( !pObj->GetActif() ) continue;
+ if ( pObj->GetTruck() != 0 ) continue; // object transtorted?
- oPos = pObj->RetPosition(0);
+ oPos = pObj->GetPosition(0);
dist = Math::DistanceProjected(pos, oPos);
if ( dist <= margin && dist <= min )
@@ -1095,15 +1060,15 @@ bool CTaskGoto::AdjustTarget(CObject* pObj, Math::Vector &pos, float &distance)
Math::Vector goal;
float dist, suppl;
- type = m_object->RetType();
+ type = m_object->GetType();
if ( type == OBJECT_BEE ||
type == OBJECT_WORM )
{
- pos = pObj->RetPosition(0);
+ pos = pObj->GetPosition(0);
return false; // single approach
}
- type = pObj->RetType();
+ type = pObj->GetType();
if ( type == OBJECT_FRET ||
type == OBJECT_STONE ||
@@ -1131,8 +1096,8 @@ bool CTaskGoto::AdjustTarget(CObject* pObj, Math::Vector &pos, float &distance)
type == OBJECT_RUINmobiler1 ||
type == OBJECT_RUINmobiler2 )
{
- pos = m_object->RetPosition(0);
- goal = pObj->RetPosition(0);
+ pos = m_object->GetPosition(0);
+ goal = pObj->GetPosition(0);
dist = Math::Distance(goal, pos);
pos = (pos-goal)*(TAKE_DIST+distance)/dist + goal;
return true; // approach from all sites
@@ -1140,8 +1105,8 @@ bool CTaskGoto::AdjustTarget(CObject* pObj, Math::Vector &pos, float &distance)
if ( type == OBJECT_BASE )
{
- pos = m_object->RetPosition(0);
- goal = pObj->RetPosition(0);
+ pos = m_object->GetPosition(0);
+ goal = pObj->GetPosition(0);
dist = Math::Distance(goal, pos);
pos = (pos-goal)*(TAKE_DIST+distance)/dist + goal;
return true; // approach from all sites
@@ -1175,10 +1140,10 @@ bool CTaskGoto::AdjustTarget(CObject* pObj, Math::Vector &pos, float &distance)
type == OBJECT_MOBILEit ||
type == OBJECT_MOBILEdr )
{
- character = pObj->RetCharacter();
+ character = pObj->GetCharacter();
pos = character->posPower;
pos.x -= TAKE_DIST+TAKE_DIST_OTHER+distance;
- mat = pObj->RetWorldMatrix(0);
+ mat = pObj->GetWorldMatrix(0);
pos = Transform(*mat, pos);
return false; // single approach
}
@@ -1190,7 +1155,7 @@ bool CTaskGoto::AdjustTarget(CObject* pObj, Math::Vector &pos, float &distance)
return false; // single approach
}
- pos = pObj->RetPosition(0);
+ pos = pObj->GetPosition(0);
distance = 0.0f;
return false; // single approach
}
@@ -1207,11 +1172,11 @@ bool CTaskGoto::AdjustBuilding(Math::Vector &pos, float margin, float &distance)
for ( i=0 ; i<1000000 ; i++ )
{
- pObj = (CObject*)m_iMan->SearchInstance(CLASS_OBJECT, i);
+ pObj = static_cast<CObject*>(m_iMan->SearchInstance(CLASS_OBJECT, i));
if ( pObj == 0 ) break;
- if ( !pObj->RetActif() ) continue;
- if ( pObj->RetTruck() != 0 ) continue; // object transported?
+ if ( !pObj->GetActif() ) continue;
+ if ( pObj->GetTruck() != 0 ) continue; // object transported?
if ( !GetHotPoint(pObj, oPos, false, 0.0f, suppl) ) continue;
dist = Math::DistanceProjected(pos, oPos);
@@ -1235,11 +1200,11 @@ bool CTaskGoto::GetHotPoint(CObject *pObj, Math::Vector &pos,
pos = Math::Vector(0.0f, 0.0f, 0.0f);
suppl = 0.0f;
- type = pObj->RetType();
+ type = pObj->GetType();
if ( type == OBJECT_DERRICK )
{
- mat = pObj->RetWorldMatrix(0);
+ mat = pObj->GetWorldMatrix(0);
pos.x += 8.0f;
if ( bTake && distance != 0.0f ) suppl = 4.0f;
if ( bTake ) pos.x += TAKE_DIST+distance+suppl;
@@ -1249,7 +1214,7 @@ bool CTaskGoto::GetHotPoint(CObject *pObj, Math::Vector &pos,
if ( type == OBJECT_CONVERT )
{
- mat = pObj->RetWorldMatrix(0);
+ mat = pObj->GetWorldMatrix(0);
pos.x += 0.0f;
if ( bTake && distance != 0.0f ) suppl = 4.0f;
if ( bTake ) pos.x += TAKE_DIST+distance+suppl;
@@ -1259,7 +1224,7 @@ bool CTaskGoto::GetHotPoint(CObject *pObj, Math::Vector &pos,
if ( type == OBJECT_RESEARCH )
{
- mat = pObj->RetWorldMatrix(0);
+ mat = pObj->GetWorldMatrix(0);
pos.x += 10.0f;
if ( bTake && distance != 0.0f ) suppl = 2.5f;
if ( bTake ) pos.x += TAKE_DIST+TAKE_DIST_OTHER+distance+suppl;
@@ -1269,7 +1234,7 @@ bool CTaskGoto::GetHotPoint(CObject *pObj, Math::Vector &pos,
if ( type == OBJECT_ENERGY )
{
- mat = pObj->RetWorldMatrix(0);
+ mat = pObj->GetWorldMatrix(0);
pos.x += 6.0f;
if ( bTake && distance != 0.0f ) suppl = 6.0f;
if ( bTake ) pos.x += TAKE_DIST+TAKE_DIST_OTHER+distance;
@@ -1279,7 +1244,7 @@ bool CTaskGoto::GetHotPoint(CObject *pObj, Math::Vector &pos,
if ( type == OBJECT_TOWER )
{
- mat = pObj->RetWorldMatrix(0);
+ mat = pObj->GetWorldMatrix(0);
pos.x += 5.0f;
if ( bTake && distance != 0.0f ) suppl = 4.0f;
if ( bTake ) pos.x += TAKE_DIST+TAKE_DIST_OTHER+distance+suppl;
@@ -1289,7 +1254,7 @@ bool CTaskGoto::GetHotPoint(CObject *pObj, Math::Vector &pos,
if ( type == OBJECT_LABO )
{
- mat = pObj->RetWorldMatrix(0);
+ mat = pObj->GetWorldMatrix(0);
pos.x += 6.0f;
if ( bTake && distance != 0.0f ) suppl = 6.0f;
if ( bTake ) pos.x += TAKE_DIST+TAKE_DIST_OTHER+distance;
@@ -1299,7 +1264,7 @@ bool CTaskGoto::GetHotPoint(CObject *pObj, Math::Vector &pos,
if ( type == OBJECT_NUCLEAR )
{
- mat = pObj->RetWorldMatrix(0);
+ mat = pObj->GetWorldMatrix(0);
pos.x += 22.0f;
if ( bTake && distance != 0.0f ) suppl = 4.0f;
if ( bTake ) pos.x += TAKE_DIST+TAKE_DIST_OTHER+distance+suppl;
@@ -1309,7 +1274,7 @@ bool CTaskGoto::GetHotPoint(CObject *pObj, Math::Vector &pos,
if ( type == OBJECT_FACTORY )
{
- mat = pObj->RetWorldMatrix(0);
+ mat = pObj->GetWorldMatrix(0);
pos.x += 4.0f;
if ( bTake && distance != 0.0f ) suppl = 6.0f;
if ( bTake ) pos.x += TAKE_DIST+distance+suppl;
@@ -1319,7 +1284,7 @@ bool CTaskGoto::GetHotPoint(CObject *pObj, Math::Vector &pos,
if ( type == OBJECT_STATION )
{
- mat = pObj->RetWorldMatrix(0);
+ mat = pObj->GetWorldMatrix(0);
pos.x += 4.0f;
if ( bTake && distance != 0.0f ) suppl = 4.0f;
if ( bTake ) pos.x += distance;
@@ -1329,7 +1294,7 @@ bool CTaskGoto::GetHotPoint(CObject *pObj, Math::Vector &pos,
if ( type == OBJECT_REPAIR )
{
- mat = pObj->RetWorldMatrix(0);
+ mat = pObj->GetWorldMatrix(0);
pos.x += 4.0f;
if ( bTake && distance != 0.0f ) suppl = 4.0f;
if ( bTake ) pos.x += distance;
@@ -1339,7 +1304,7 @@ bool CTaskGoto::GetHotPoint(CObject *pObj, Math::Vector &pos,
if ( type == OBJECT_DESTROYER )
{
- mat = pObj->RetWorldMatrix(0);
+ mat = pObj->GetWorldMatrix(0);
pos.x += 0.0f;
if ( bTake && distance != 0.0f ) suppl = 4.0f;
if ( bTake ) pos.x += TAKE_DIST+distance+suppl;
@@ -1347,9 +1312,9 @@ bool CTaskGoto::GetHotPoint(CObject *pObj, Math::Vector &pos,
return true;
}
- if ( type == OBJECT_PARA && m_physics->RetType() == TYPE_FLYING )
+ if ( type == OBJECT_PARA && m_physics->GetType() == TYPE_FLYING )
{
- mat = pObj->RetWorldMatrix(0);
+ mat = pObj->GetWorldMatrix(0);
if ( bTake && distance != 0.0f ) suppl = 20.0f;
if ( bTake ) pos.x += distance+suppl;
pos = Transform(*mat, pos);
@@ -1370,7 +1335,7 @@ bool CTaskGoto::LeakSearch(Math::Vector &pos, float &delay)
float iRadius, oRadius, bRadius, dist, min, dir;
int i, j;
- if ( !m_physics->RetLand() ) return false; // in flight?
+ if ( !m_physics->GetLand() ) return false; // in flight?
m_object->GetCrashSphere(0, iPos, iRadius);
@@ -1378,12 +1343,12 @@ bool CTaskGoto::LeakSearch(Math::Vector &pos, float &delay)
bRadius = 0.0f;
for ( i=0 ; i<1000000 ; i++ )
{
- pObj = (CObject*)m_iMan->SearchInstance(CLASS_OBJECT, i);
+ pObj = static_cast<CObject*>(m_iMan->SearchInstance(CLASS_OBJECT, i));
if ( pObj == 0 ) break;
if ( pObj == m_object ) continue;
- if ( !pObj->RetActif() ) continue;
- if ( pObj->RetTruck() != 0 ) continue; // object transported?
+ if ( !pObj->GetActif() ) continue;
+ if ( pObj->GetTruck() != 0 ) continue; // object transported?
j = 0;
while ( pObj->GetCrashSphere(j++, oPos, oRadius) )
@@ -1404,7 +1369,7 @@ bool CTaskGoto::LeakSearch(Math::Vector &pos, float &delay)
dist = 4.0f;
dir = 1.0f;
- if ( pObstacle->RetType() == OBJECT_FACTORY )
+ if ( pObstacle->GetType() == OBJECT_FACTORY )
{
dist = 16.0f;
dir = -1.0f;
@@ -1412,7 +1377,7 @@ bool CTaskGoto::LeakSearch(Math::Vector &pos, float &delay)
}
pos = bPos;
- delay = m_physics->RetLinTimeLength(dist, dir);
+ delay = m_physics->GetLinTimeLength(dist, dir);
return true;
}
@@ -1436,18 +1401,18 @@ void CTaskGoto::ComputeRepulse(Math::Point &dir)
for ( i=0 ; i<1000000 ; i++ )
{
- pObj = (CObject*)m_iMan->SearchInstance(CLASS_OBJECT, i);
+ pObj = static_cast<CObject*>(m_iMan->SearchInstance(CLASS_OBJECT, i));
if ( pObj == 0 ) break;
if ( pObj == m_object ) continue;
- if ( pObj->RetTruck() != 0 ) continue;
+ if ( pObj->GetTruck() != 0 ) continue;
- oPos = pObj->RetPosition(0);
+ oPos = pObj->GetPosition(0);
dist = Math::Distance(oPos, m_goalObject);
if ( dist <= 1.0f ) continue;
pObj->GetGlobalSphere(oPos, oRadius);
- oRadius += iRadius+m_physics->RetLinStopLength()*1.1f;
+ oRadius += iRadius+m_physics->GetLinStopLength()*1.1f;
dist = Math::DistanceProjected(oPos, iPos);
if ( dist <= oRadius )
{
@@ -1479,13 +1444,13 @@ void CTaskGoto::ComputeRepulse(Math::Point &dir)
dir.y = 0.0f;
// The worm goes everywhere and through everything!
- iType = m_object->RetType();
+ iType = m_object->GetType();
if ( iType == OBJECT_WORM ) return;
m_object->GetCrashSphere(0, iPos, iRadius);
gDist = Math::Distance(iPos, m_goal);
- add = m_physics->RetLinStopLength()*1.1f; // braking distance
+ add = m_physics->GetLinStopLength()*1.1f; // braking distance
fac = 2.0f;
if ( iType == OBJECT_MOBILEwa ||
@@ -1513,7 +1478,7 @@ void CTaskGoto::ComputeRepulse(Math::Point &dir)
iType == OBJECT_MOBILEfs ||
iType == OBJECT_MOBILEft ) // flying?
{
- if ( m_physics->RetLand() )
+ if ( m_physics->GetLand() )
{
add = 5.0f;
fac = 1.5f;
@@ -1535,7 +1500,7 @@ void CTaskGoto::ComputeRepulse(Math::Point &dir)
}
if ( iType == OBJECT_BEE ) // wasp?
{
- if ( m_physics->RetLand() )
+ if ( m_physics->GetLand() )
{
add = 3.0f;
fac = 1.5f;
@@ -1559,13 +1524,13 @@ void CTaskGoto::ComputeRepulse(Math::Point &dir)
for ( i=0 ; i<1000000 ; i++ )
{
- pObj = (CObject*)m_iMan->SearchInstance(CLASS_OBJECT, i);
+ pObj = static_cast<CObject*>(m_iMan->SearchInstance(CLASS_OBJECT, i));
if ( pObj == 0 ) break;
if ( pObj == m_object ) continue;
- if ( pObj->RetTruck() != 0 ) continue;
+ if ( pObj->GetTruck() != 0 ) continue;
- oType = pObj->RetType();
+ oType = pObj->GetType();
if ( oType == OBJECT_WORM ) continue;
@@ -1651,13 +1616,13 @@ void CTaskGoto::ComputeFlyingRepulse(float &dir)
for ( i=0 ; i<1000000 ; i++ )
{
- pObj = (CObject*)m_iMan->SearchInstance(CLASS_OBJECT, i);
+ pObj = static_cast<CObject*>(m_iMan->SearchInstance(CLASS_OBJECT, i));
if ( pObj == 0 ) break;
if ( pObj == m_object ) continue;
- if ( pObj->RetTruck() != 0 ) continue;
+ if ( pObj->GetTruck() != 0 ) continue;
- oType = pObj->RetType();
+ oType = pObj->GetType();
if ( oType == OBJECT_WORM ) continue;
@@ -1712,7 +1677,7 @@ void CTaskGoto::BeamStart()
BitmapOpen();
BitmapObject();
- min = m_object->RetPosition(0);
+ min = m_object->GetPosition(0);
max = m_goal;
if ( min.x > max.x ) Math::Swap(min.x, max.x);
if ( min.z > max.z ) Math::Swap(min.z, max.z);
@@ -1890,84 +1855,6 @@ Math::Vector CTaskGoto::BeamPoint(const Math::Vector &startPoint,
return resPoint;
}
-// Displays a bitmap part.
-
-void CTaskGoto::BitmapDebug(const Math::Vector &min, const Math::Vector &max,
- const Math::Vector &start, const Math::Vector &goal)
-{
- int minx, miny, maxx, maxy, x, y, i ,n;
- char s[2000];
-
- minx = (int)((min.x+1600.0f)/BM_DIM_STEP);
- miny = (int)((min.z+1600.0f)/BM_DIM_STEP);
- maxx = (int)((max.x+1600.0f)/BM_DIM_STEP);
- maxy = (int)((max.z+1600.0f)/BM_DIM_STEP);
-
- if ( minx > maxx ) Math::Swap(minx, maxx);
- if ( miny > maxy ) Math::Swap(miny, maxy);
-
- OutputDebugString("Bitmap :\n");
- for ( y=miny ; y<=maxy ; y++ )
- {
- s[0] = 0;
- for ( x=minx ; x<=maxx ; x++ )
- {
- n = -1;
- for ( i=0 ; i<=m_bmTotal ; i++ )
- {
- if ( x == (int)((m_bmPoints[i].x+1600.0f)/BM_DIM_STEP) &&
- y == (int)((m_bmPoints[i].z+1600.0f)/BM_DIM_STEP) )
- {
- n = i;
- break;
- }
- }
-
- if ( BitmapTestDot(0, x,y) )
- {
- strcat(s, "o");
- }
- else
- {
- if ( BitmapTestDot(1, x,y) )
- {
- strcat(s, "-");
- }
- else
- {
- strcat(s, ".");
- }
- }
-
- if ( x == (int)((start.x+1600.0f)/BM_DIM_STEP) &&
- y == (int)((start.z+1600.0f)/BM_DIM_STEP) )
- {
- strcat(s, "s");
- }
- else
- if ( x == (int)((goal.x+1600.0f)/BM_DIM_STEP) &&
- y == (int)((goal.z+1600.0f)/BM_DIM_STEP) )
- {
- strcat(s, "g");
- }
- else
- if ( n != -1 )
- {
- char ss[2];
- ss[0] = 'A'+n;
- ss[1] = 0;
- strcat(s, ss);
- }
- else
- {
- strcat(s, " ");
- }
- }
- strcat(s, "\n");
- OutputDebugString(s);
- }
-}
-
// Tests if a path along a straight line is possible.
bool CTaskGoto::BitmapTestLine(const Math::Vector &start, const Math::Vector &goal,
@@ -1991,12 +1878,12 @@ bool CTaskGoto::BitmapTestLine(const Math::Vector &start, const Math::Vector &go
if ( bSecond )
{
- x = (int)((pos.x+1600.0f)/BM_DIM_STEP);
- y = (int)((pos.z+1600.0f)/BM_DIM_STEP);
+ x = static_cast<int>((pos.x+1600.0f)/BM_DIM_STEP);
+ y = static_cast<int>((pos.z+1600.0f)/BM_DIM_STEP);
BitmapSetDot(1, x, y); // puts the flag as the starting point
}
- max = (int)(dist/step);
+ max = static_cast<int>(dist/step);
if ( max == 0 ) max = 1;
distNoB2 = BM_DIM_STEP*sqrtf(2.0f)/sinf(stepAngle);
for ( i=0 ; i<max ; i++ )
@@ -2011,8 +1898,8 @@ bool CTaskGoto::BitmapTestLine(const Math::Vector &start, const Math::Vector &go
pos.z += inc.z;
}
- x = (int)((pos.x+1600.0f)/BM_DIM_STEP);
- y = (int)((pos.z+1600.0f)/BM_DIM_STEP);
+ x = static_cast<int>((pos.x+1600.0f)/BM_DIM_STEP);
+ y = static_cast<int>((pos.z+1600.0f)/BM_DIM_STEP);
if ( bSecond )
{
@@ -2043,17 +1930,17 @@ void CTaskGoto::BitmapObject()
for ( i=0 ; i<1000000 ; i++ )
{
- pObj = (CObject*)m_iMan->SearchInstance(CLASS_OBJECT, i);
+ pObj = static_cast<CObject*>(m_iMan->SearchInstance(CLASS_OBJECT, i));
if ( pObj == 0 ) break;
- type = pObj->RetType();
+ type = pObj->GetType();
if ( pObj == m_object ) continue;
if ( pObj == m_bmFretObject ) continue;
- if ( pObj->RetTruck() != 0 ) continue;
+ if ( pObj->GetTruck() != 0 ) continue;
- h = m_terrain->RetFloorLevel(pObj->RetPosition(0), false);
- if ( m_physics->RetType() == TYPE_FLYING && m_altitude > 0.0f )
+ h = m_terrain->GetFloorLevel(pObj->GetPosition(0), false);
+ if ( m_physics->GetType() == TYPE_FLYING && m_altitude > 0.0f )
{
h += m_altitude;
}
@@ -2061,7 +1948,7 @@ void CTaskGoto::BitmapObject()
j = 0;
while ( pObj->GetCrashSphere(j++, oPos, oRadius) )
{
- if ( m_physics->RetType() == TYPE_FLYING && m_altitude > 0.0f ) // flying?
+ if ( m_physics->GetType() == TYPE_FLYING && m_altitude > 0.0f ) // flying?
{
if ( oPos.y-oRadius > h+8.0f ||
oPos.y+oRadius < h-8.0f ) continue;
@@ -2083,10 +1970,10 @@ void CTaskGoto::BitmapTerrain(const Math::Vector &min, const Math::Vector &max)
{
int minx, miny, maxx, maxy;
- minx = (int)((min.x+1600.0f)/BM_DIM_STEP);
- miny = (int)((min.z+1600.0f)/BM_DIM_STEP);
- maxx = (int)((max.x+1600.0f)/BM_DIM_STEP);
- maxy = (int)((max.z+1600.0f)/BM_DIM_STEP);
+ minx = static_cast<int>((min.x+1600.0f)/BM_DIM_STEP);
+ miny = static_cast<int>((min.z+1600.0f)/BM_DIM_STEP);
+ maxx = static_cast<int>((max.x+1600.0f)/BM_DIM_STEP);
+ maxy = static_cast<int>((max.z+1600.0f)/BM_DIM_STEP);
BitmapTerrain(minx, miny, maxx, maxy);
}
@@ -2121,7 +2008,7 @@ void CTaskGoto::BitmapTerrain(int minx, int miny, int maxx, int maxy)
bAcceptWater = false;
bFly = false;
- type = m_object->RetType();
+ type = m_object->GetType();
if ( type == OBJECT_MOBILEwa ||
type == OBJECT_MOBILEwc ||
@@ -2190,8 +2077,8 @@ void CTaskGoto::BitmapTerrain(int minx, int miny, int maxx, int maxy)
if ( bFly ) // flying robot?
{
- h = m_terrain->RetFloorLevel(p, true);
- if ( h >= m_terrain->RetFlyingMaxHeight()-5.0f )
+ h = m_terrain->GetFloorLevel(p, true);
+ if ( h >= m_terrain->GetFlyingMaxHeight()-5.0f )
{
BitmapSetDot(0, x, y);
}
@@ -2200,8 +2087,8 @@ void CTaskGoto::BitmapTerrain(int minx, int miny, int maxx, int maxy)
if ( !bAcceptWater ) // not going underwater?
{
- h = m_terrain->RetFloorLevel(p, true);
- if ( h < m_water->RetLevel()-2.0f ) // under water (*)?
+ h = m_terrain->GetFloorLevel(p, true);
+ if ( h < m_water->GetLevel()-2.0f ) // under water (*)?
{
//? BitmapSetDot(0, x, y);
BitmapSetCircle(p, BM_DIM_STEP*1.0f);
@@ -2209,7 +2096,7 @@ void CTaskGoto::BitmapTerrain(int minx, int miny, int maxx, int maxy)
}
}
- angle = m_terrain->RetFineSlope(p);
+ angle = m_terrain->GetFineSlope(p);
if ( angle > aLimit )
{
BitmapSetDot(0, x, y);
@@ -2231,9 +2118,9 @@ bool CTaskGoto::BitmapOpen()
{
BitmapClose();
- m_bmSize = (int)(3200.0f/BM_DIM_STEP);
- m_bmArray = (unsigned char*)malloc(m_bmSize*m_bmSize/8*2);
- ZeroMemory(m_bmArray, m_bmSize*m_bmSize/8*2);
+ m_bmSize = static_cast<int>(3200.0f/BM_DIM_STEP);
+ m_bmArray = static_cast<unsigned char*>(malloc(m_bmSize*m_bmSize/8*2));
+ memset(m_bmArray, 0, m_bmSize*m_bmSize/8*2);
m_bmOffset = m_bmSize/2;
m_bmLine = m_bmSize/8;
@@ -2262,15 +2149,15 @@ void CTaskGoto::BitmapSetCircle(const Math::Vector &pos, float radius)
float d, r;
int cx, cy, ix, iy;
- cx = (int)((pos.x+1600.0f)/BM_DIM_STEP);
- cy = (int)((pos.z+1600.0f)/BM_DIM_STEP);
+ cx = static_cast<int>((pos.x+1600.0f)/BM_DIM_STEP);
+ cy = static_cast<int>((pos.z+1600.0f)/BM_DIM_STEP);
r = radius/BM_DIM_STEP;
- for ( iy=cy-(int)r ; iy<=cy+(int)r ; iy++ )
+ for ( iy=cy-static_cast<int>(r) ; iy<=cy+static_cast<int>(r) ; iy++ )
{
- for ( ix=cx-(int)r ; ix<=cx+(int)r ; ix++ )
+ for ( ix=cx-static_cast<int>(r) ; ix<=cx+static_cast<int>(r) ; ix++ )
{
- d = Math::Point((float)(ix-cx), (float)(iy-cy)).Length();
+ d = Math::Point(static_cast<float>(ix-cx), static_cast<float>(iy-cy)).Length();
if ( d > r ) continue;
BitmapSetDot(0, ix, iy);
}
@@ -2278,21 +2165,21 @@ void CTaskGoto::BitmapSetCircle(const Math::Vector &pos, float radius)
}
// Removes a circle in the bitmap.
-
+//TODO this method is almost same as above one
void CTaskGoto::BitmapClearCircle(const Math::Vector &pos, float radius)
{
float d, r;
int cx, cy, ix, iy;
- cx = (int)((pos.x+1600.0f)/BM_DIM_STEP);
- cy = (int)((pos.z+1600.0f)/BM_DIM_STEP);
+ cx = static_cast<int>((pos.x+1600.0f)/BM_DIM_STEP);
+ cy = static_cast<int>((pos.z+1600.0f)/BM_DIM_STEP);
r = radius/BM_DIM_STEP;
- for ( iy=cy-(int)r ; iy<=cy+(int)r ; iy++ )
+ for ( iy=cy-static_cast<int>(r) ; iy<=cy+static_cast<int>(r) ; iy++ )
{
- for ( ix=cx-(int)r ; ix<=cx+(int)r ; ix++ )
+ for ( ix=cx-static_cast<int>(r) ; ix<=cx+static_cast<int>(r) ; ix++ )
{
- d = Math::Point((float)(ix-cx), (float)(iy-cy)).Length();
+ d = Math::Point(static_cast<float>(ix-cx), static_cast<float>(iy-cy)).Length();
if ( d > r ) continue;
BitmapClearDot(0, ix, iy);
}
diff --git a/src/object/task/taskgungoal.cpp b/src/object/task/taskgungoal.cpp
index e259ca8..aed3355 100644
--- a/src/object/task/taskgungoal.cpp
+++ b/src/object/task/taskgungoal.cpp
@@ -16,9 +16,6 @@
// taskgungoal.cpp
-
-#include <stdio.h>
-
#include "object/task/taskgungoal.h"
#include "object/object.h"
@@ -46,8 +43,8 @@ bool CTaskGunGoal::EventProcess(const Event &event)
{
float dir;
- if ( m_engine->RetPause() ) return true;
- if ( event.event != EVENT_FRAME ) return true;
+ if ( m_engine->GetPause() ) return true;
+ if ( event.type != EVENT_FRAME ) return true;
m_progress += event.rTime*m_speed;
@@ -82,9 +79,9 @@ Error CTaskGunGoal::Start(float dirV, float dirH)
float speedV, speedH;
int i;
- m_initialDirV = m_object->RetGunGoalV();
+ m_initialDirV = m_object->GetGunGoalV();
m_object->SetGunGoalV(dirV);
- m_finalDirV = m_object->RetGunGoalV(); // possible direction
+ m_finalDirV = m_object->GetGunGoalV(); // possible direction
m_object->SetGunGoalV(m_initialDirV); // gives initial direction
if ( m_finalDirV == m_initialDirV )
@@ -96,9 +93,9 @@ Error CTaskGunGoal::Start(float dirV, float dirH)
speedV = 1.0f/(fabs(m_finalDirV-m_initialDirV)*1.0f);
}
- m_initialDirH = m_object->RetGunGoalH();
+ m_initialDirH = m_object->GetGunGoalH();
m_object->SetGunGoalH(dirH);
- m_finalDirH = m_object->RetGunGoalH(); // possible direction
+ m_finalDirH = m_object->GetGunGoalH(); // possible direction
m_object->SetGunGoalH(m_initialDirH); // gives initial direction
if ( m_finalDirH == m_initialDirH )
@@ -115,7 +112,7 @@ Error CTaskGunGoal::Start(float dirV, float dirH)
if ( m_finalDirV != m_initialDirV ||
m_finalDirH != m_initialDirH )
{
- i = m_sound->Play(SOUND_MANIP, m_object->RetPosition(0), 0.3f, 1.5f, true);
+ i = m_sound->Play(SOUND_MANIP, m_object->GetPosition(0), 0.3f, 1.5f, true);
m_sound->AddEnvelope(i, 0.3f, 1.5f, 1.0f/m_speed, SOPER_STOP);
}
@@ -128,7 +125,7 @@ Error CTaskGunGoal::Start(float dirV, float dirH)
Error CTaskGunGoal::IsEnded()
{
- if ( m_engine->RetPause() ) return ERR_CONTINUE;
+ if ( m_engine->GetPause() ) return ERR_CONTINUE;
if ( m_initialDirV == m_finalDirV &&
m_initialDirH == m_finalDirH ) return ERR_STOP;
diff --git a/src/object/task/taskinfo.cpp b/src/object/task/taskinfo.cpp
index 6d1f486..4e64584 100644
--- a/src/object/task/taskinfo.cpp
+++ b/src/object/task/taskinfo.cpp
@@ -16,16 +16,13 @@
// taskinfo.cpp
-
-#include <stdio.h>
-
#include "object/task/taskinfo.h"
#include "common/iman.h"
-#include "old/particule.h"
+#include "graphics/engine/particle.h"
#include "object/auto/autoinfo.h"
-
+#include <string.h>
@@ -47,8 +44,8 @@ CTaskInfo::~CTaskInfo()
bool CTaskInfo::EventProcess(const Event &event)
{
- if ( m_engine->RetPause() ) return true;
- if ( event.event != EVENT_FRAME ) return true;
+ if ( m_engine->GetPause() ) return true;
+ if ( event.type != EVENT_FRAME ) return true;
if ( m_bError ) return false;
m_progress += event.rTime*m_speed; // other advance
@@ -60,7 +57,7 @@ bool CTaskInfo::EventProcess(const Event &event)
// Assigns the goal was achieved.
-Error CTaskInfo::Start(char *name, float value, float power, bool bSend)
+Error CTaskInfo::Start(const char *name, float value, float power, bool bSend)
{
CObject* pInfo;
CAutoInfo* pAuto;
@@ -77,7 +74,7 @@ Error CTaskInfo::Start(char *name, float value, float power, bool bSend)
return ERR_INFO_NULL;
}
- pAuto = (CAutoInfo*)pInfo->RetAuto();
+ pAuto = static_cast<CAutoInfo*>(pInfo->GetAuto());
if ( pAuto == 0 )
{
return ERR_INFO_NULL;
@@ -86,10 +83,10 @@ Error CTaskInfo::Start(char *name, float value, float power, bool bSend)
op = 1; // transmission impossible
if ( bSend ) // send?
{
- total = pInfo->RetInfoTotal();
+ total = pInfo->GetInfoTotal();
for ( i=0 ; i<total ; i++ )
{
- info = pInfo->RetInfo(i);
+ info = pInfo->GetInfo(i);
if ( strcmp(info.name, name) == 0 )
{
info.value = value;
@@ -114,10 +111,10 @@ Error CTaskInfo::Start(char *name, float value, float power, bool bSend)
}
else // receive?
{
- total = pInfo->RetInfoTotal();
+ total = pInfo->GetInfoTotal();
for ( i=0 ; i<total ; i++ )
{
- info = pInfo->RetInfo(i);
+ info = pInfo->GetInfo(i);
if ( strcmp(info.name, name) == 0 )
{
m_object->SetInfoReturn(info.value);
@@ -134,19 +131,19 @@ Error CTaskInfo::Start(char *name, float value, float power, bool bSend)
if ( op == 0 ) // transmission?
{
- pos = pInfo->RetPosition(0);
+ pos = pInfo->GetPosition(0);
pos.y += 9.5f;
- goal = m_object->RetPosition(0);
+ goal = m_object->GetPosition(0);
goal.y += 4.0f;
- m_particule->CreateRay(pos, goal, PARTIRAY3, Math::Point(2.0f, 2.0f), 1.0f);
+ m_particle->CreateRay(pos, goal, Gfx::PARTIRAY3, Math::Point(2.0f, 2.0f), 1.0f);
}
if ( op == 2 ) // reception?
{
- goal = pInfo->RetPosition(0);
+ goal = pInfo->GetPosition(0);
goal.y += 9.5f;
- pos = m_object->RetPosition(0);
+ pos = m_object->GetPosition(0);
pos.y += 4.0f;
- m_particule->CreateRay(pos, goal, PARTIRAY3, Math::Point(2.0f, 2.0f), 1.0f);
+ m_particle->CreateRay(pos, goal, Gfx::PARTIRAY3, Math::Point(2.0f, 2.0f), 1.0f);
}
m_progress = 0.0f;
@@ -162,7 +159,7 @@ Error CTaskInfo::Start(char *name, float value, float power, bool bSend)
Error CTaskInfo::IsEnded()
{
- if ( m_engine->RetPause() ) return ERR_CONTINUE;
+ if ( m_engine->GetPause() ) return ERR_CONTINUE;
if ( m_bError ) return ERR_STOP;
if ( m_progress < 1.0f ) return ERR_CONTINUE;
@@ -184,27 +181,27 @@ bool CTaskInfo::Abort()
CObject* CTaskInfo::SearchInfo(float power)
{
- CObject *pObj, *pBest;
- Math::Vector iPos, oPos;
- ObjectType type;
- float dist, min;
- int i;
+ CObject *pObj, *pBest;
+ Math::Vector iPos, oPos;
+ ObjectType type;
+ float dist, min;
+ int i;
- iPos = m_object->RetPosition(0);
+ iPos = m_object->GetPosition(0);
min = 100000.0f;
pBest = 0;
for ( i=0 ; i<1000000 ; i++ )
{
- pObj = (CObject*)m_iMan->SearchInstance(CLASS_OBJECT, i);
+ pObj = static_cast<CObject*>(m_iMan->SearchInstance(CLASS_OBJECT, i));
if ( pObj == 0 ) break;
- type = pObj->RetType();
+ type = pObj->GetType();
if ( type != OBJECT_INFO ) continue;
- if ( !pObj->RetActif() ) continue;
+ if ( !pObj->GetActif() ) continue;
- oPos = pObj->RetPosition(0);
+ oPos = pObj->GetPosition(0);
dist = Math::Distance(oPos, iPos);
if ( dist > power ) continue; // too far?
if ( dist < min )
diff --git a/src/object/task/taskinfo.h b/src/object/task/taskinfo.h
index 21a4392..036b57d 100644
--- a/src/object/task/taskinfo.h
+++ b/src/object/task/taskinfo.h
@@ -31,7 +31,7 @@ public:
bool EventProcess(const Event &event);
- Error Start(char *name, float value, float power, bool bSend);
+ Error Start(const char *name, float value, float power, bool bSend);
Error IsEnded();
bool Abort();
diff --git a/src/object/task/taskmanager.cpp b/src/object/task/taskmanager.cpp
index d81fb5b..26e389d 100644
--- a/src/object/task/taskmanager.cpp
+++ b/src/object/task/taskmanager.cpp
@@ -67,7 +67,7 @@ CTaskManager::~CTaskManager()
Error CTaskManager::StartTaskWait(float time)
{
m_task = new CTaskWait(m_iMan, m_object);
- return ((CTaskWait*)m_task)->Start(time);
+ return (static_cast<CTaskWait*>(m_task))->Start(time);
}
// Advance straight ahead a certain distance.
@@ -75,7 +75,7 @@ Error CTaskManager::StartTaskWait(float time)
Error CTaskManager::StartTaskAdvance(float length)
{
m_task = new CTaskAdvance(m_iMan, m_object);
- return ((CTaskAdvance*)m_task)->Start(length);
+ return (static_cast<CTaskAdvance*>(m_task))->Start(length);
}
// Turns through an certain angle.
@@ -83,7 +83,7 @@ Error CTaskManager::StartTaskAdvance(float length)
Error CTaskManager::StartTaskTurn(float angle)
{
m_task = new CTaskTurn(m_iMan, m_object);
- return ((CTaskTurn*)m_task)->Start(angle);
+ return (static_cast<CTaskTurn*>(m_task))->Start(angle);
}
// Reaches a given position.
@@ -91,7 +91,7 @@ Error CTaskManager::StartTaskTurn(float angle)
Error CTaskManager::StartTaskGoto(Math::Vector pos, float altitude, TaskGotoGoal goalMode, TaskGotoCrash crashMode)
{
m_task = new CTaskGoto(m_iMan, m_object);
- return ((CTaskGoto*)m_task)->Start(pos, altitude, goalMode, crashMode);
+ return (static_cast<CTaskGoto*>(m_task))->Start(pos, altitude, goalMode, crashMode);
}
// Move the manipulator arm.
@@ -99,7 +99,7 @@ Error CTaskManager::StartTaskGoto(Math::Vector pos, float altitude, TaskGotoGoal
Error CTaskManager::StartTaskTake()
{
m_task = new CTaskTake(m_iMan, m_object);
- return ((CTaskTake*)m_task)->Start();
+ return (static_cast<CTaskTake*>(m_task))->Start();
}
// Move the manipulator arm.
@@ -107,7 +107,7 @@ Error CTaskManager::StartTaskTake()
Error CTaskManager::StartTaskManip(TaskManipOrder order, TaskManipArm arm)
{
m_task = new CTaskManip(m_iMan, m_object);
- return ((CTaskManip*)m_task)->Start(order, arm);
+ return (static_cast<CTaskManip*>(m_task))->Start(order, arm);
}
// Puts or removes a flag.
@@ -115,7 +115,7 @@ Error CTaskManager::StartTaskManip(TaskManipOrder order, TaskManipArm arm)
Error CTaskManager::StartTaskFlag(TaskFlagOrder order, int rank)
{
m_task = new CTaskFlag(m_iMan, m_object);
- return ((CTaskFlag*)m_task)->Start(order, rank);
+ return (static_cast<CTaskFlag*>(m_task))->Start(order, rank);
}
// Builds a building.
@@ -123,7 +123,7 @@ Error CTaskManager::StartTaskFlag(TaskFlagOrder order, int rank)
Error CTaskManager::StartTaskBuild(ObjectType type)
{
m_task = new CTaskBuild(m_iMan, m_object);
- return ((CTaskBuild*)m_task)->Start(type);
+ return (static_cast<CTaskBuild*>(m_task))->Start(type);
}
// Probe the ground.
@@ -131,15 +131,15 @@ Error CTaskManager::StartTaskBuild(ObjectType type)
Error CTaskManager::StartTaskSearch()
{
m_task = new CTaskSearch(m_iMan, m_object);
- return ((CTaskSearch*)m_task)->Start();
+ return (static_cast<CTaskSearch*>(m_task))->Start();
}
// Reads an information terminal.
-Error CTaskManager::StartTaskInfo(char *name, float value, float power, bool bSend)
+Error CTaskManager::StartTaskInfo(const char *name, float value, float power, bool bSend)
{
m_task = new CTaskInfo(m_iMan, m_object);
- return ((CTaskInfo*)m_task)->Start(name, value, power, bSend);
+ return (static_cast<CTaskInfo*>(m_task))->Start(name, value, power, bSend);
}
// Terraforms the ground.
@@ -147,7 +147,7 @@ Error CTaskManager::StartTaskInfo(char *name, float value, float power, bool bSe
Error CTaskManager::StartTaskTerraform()
{
m_task = new CTaskTerraform(m_iMan, m_object);
- return ((CTaskTerraform*)m_task)->Start();
+ return (static_cast<CTaskTerraform*>(m_task))->Start();
}
// Changes the pencil.
@@ -155,7 +155,7 @@ Error CTaskManager::StartTaskTerraform()
Error CTaskManager::StartTaskPen(bool bDown, int color)
{
m_task = new CTaskPen(m_iMan, m_object);
- return ((CTaskPen*)m_task)->Start(bDown, color);
+ return (static_cast<CTaskPen*>(m_task))->Start(bDown, color);
}
// Recovers a ruin.
@@ -163,7 +163,7 @@ Error CTaskManager::StartTaskPen(bool bDown, int color)
Error CTaskManager::StartTaskRecover()
{
m_task = new CTaskRecover(m_iMan, m_object);
- return ((CTaskRecover*)m_task)->Start();
+ return (static_cast<CTaskRecover*>(m_task))->Start();
}
// Deploys the shield.
@@ -173,15 +173,15 @@ Error CTaskManager::StartTaskShield(TaskShieldMode mode, float delay)
if ( mode == TSM_UP )
{
m_task = new CTaskShield(m_iMan, m_object);
- return ((CTaskShield*)m_task)->Start(mode, delay);
+ return (static_cast<CTaskShield*>(m_task))->Start(mode, delay);
}
if ( mode == TSM_DOWN && m_task != 0 )
{
- return ((CTaskShield*)m_task)->Start(mode, delay);
+ return (static_cast<CTaskShield*>(m_task))->Start(mode, delay);
}
if ( mode == TSM_UPDATE && m_task != 0 )
{
- return ((CTaskShield*)m_task)->Start(mode, delay);
+ return (static_cast<CTaskShield*>(m_task))->Start(mode, delay);
}
return ERR_GENERIC;
}
@@ -192,7 +192,7 @@ Error CTaskManager::StartTaskFire(float delay)
{
m_bPilot = true;
m_task = new CTaskFire(m_iMan, m_object);
- return ((CTaskFire*)m_task)->Start(delay);
+ return (static_cast<CTaskFire*>(m_task))->Start(delay);
}
// Shoots with the ant.
@@ -200,7 +200,7 @@ Error CTaskManager::StartTaskFire(float delay)
Error CTaskManager::StartTaskFireAnt(Math::Vector impact)
{
m_task = new CTaskFireAnt(m_iMan, m_object);
- return ((CTaskFireAnt*)m_task)->Start(impact);
+ return (static_cast<CTaskFireAnt*>(m_task))->Start(impact);
}
// Adjusts higher.
@@ -208,7 +208,7 @@ Error CTaskManager::StartTaskFireAnt(Math::Vector impact)
Error CTaskManager::StartTaskGunGoal(float dirV, float dirH)
{
m_task = new CTaskGunGoal(m_iMan, m_object);
- return ((CTaskGunGoal*)m_task)->Start(dirV, dirH);
+ return (static_cast<CTaskGunGoal*>(m_task))->Start(dirV, dirH);
}
// Suicide of the spider.
@@ -216,7 +216,7 @@ Error CTaskManager::StartTaskGunGoal(float dirV, float dirH)
Error CTaskManager::StartTaskSpiderExplo()
{
m_task = new CTaskSpiderExplo(m_iMan, m_object);
- return ((CTaskSpiderExplo*)m_task)->Start();
+ return (static_cast<CTaskSpiderExplo*>(m_task))->Start();
}
// Reset.
@@ -224,7 +224,7 @@ Error CTaskManager::StartTaskSpiderExplo()
Error CTaskManager::StartTaskReset(Math::Vector goal, Math::Vector angle)
{
m_task = new CTaskReset(m_iMan, m_object);
- return ((CTaskReset*)m_task)->Start(goal, angle);
+ return (static_cast<CTaskReset*>(m_task))->Start(goal, angle);
}
diff --git a/src/object/task/taskmanager.h b/src/object/task/taskmanager.h
index 14fc276..6ce023a 100644
--- a/src/object/task/taskmanager.h
+++ b/src/object/task/taskmanager.h
@@ -43,7 +43,7 @@ public:
Error StartTaskFlag(TaskFlagOrder order, int rank);
Error StartTaskBuild(ObjectType type);
Error StartTaskSearch();
- Error StartTaskInfo(char *name, float value, float power, bool bSend);
+ Error StartTaskInfo(const char *name, float value, float power, bool bSend);
Error StartTaskTerraform();
Error StartTaskPen(bool bDown, int color);
Error StartTaskRecover();
diff --git a/src/object/task/taskmanip.cpp b/src/object/task/taskmanip.cpp
index 456f274..b0b146c 100644
--- a/src/object/task/taskmanip.cpp
+++ b/src/object/task/taskmanip.cpp
@@ -16,14 +16,11 @@
// taskmanip.cpp
-
-#include <stdio.h>
-
#include "object/task/taskmanip.h"
#include "common/iman.h"
-#include "old/terrain.h"
-#include "old/pyro.h"
+#include "graphics/engine/terrain.h"
+#include "graphics/engine/pyro.h"
#include "math/geometry.h"
#include "object/robotmain.h"
#include "physics/physics.h"
@@ -65,8 +62,8 @@ bool CTaskManip::EventProcess(const Event &event)
float angle, a, g, cirSpeed, progress;
int i;
- if ( m_engine->RetPause() ) return true;
- if ( event.event != EVENT_FRAME ) return true;
+ if ( m_engine->GetPause() ) return true;
+ if ( event.type != EVENT_FRAME ) return true;
if ( m_bError ) return false;
if ( m_bBee ) // bee?
@@ -76,10 +73,10 @@ bool CTaskManip::EventProcess(const Event &event)
if ( m_bTurn ) // preliminary rotation?
{
- a = m_object->RetAngleY(0);
+ a = m_object->GetAngleY(0);
g = m_angle;
cirSpeed = Math::Direction(a, g)*1.0f;
- if ( m_physics->RetType() == TYPE_FLYING ) // flying on the ground?
+ if ( m_physics->GetType() == TYPE_FLYING ) // flying on the ground?
{
cirSpeed *= 4.0f; // more fishing
}
@@ -107,23 +104,23 @@ bool CTaskManip::EventProcess(const Event &event)
{
if ( m_step == 0 ) // fall?
{
- pos = m_object->RetPosition(1);
+ pos = m_object->GetPosition(1);
pos.y = 3.0f-progress*2.0f;
m_object->SetPosition(1, pos);
}
if ( m_step == 1 ) // farm?
{
- pos = m_object->RetPosition(2);
+ pos = m_object->GetPosition(2);
pos.z = -1.5f+progress*0.5f;
m_object->SetPosition(2, pos);
- pos = m_object->RetPosition(3);
+ pos = m_object->GetPosition(3);
pos.z = 1.5f-progress*0.5f;
m_object->SetPosition(3, pos);
}
if ( m_step == 2 ) // up?
{
- pos = m_object->RetPosition(1);
+ pos = m_object->GetPosition(1);
pos.y = 3.0f-(1.0f-progress)*2.0f;
m_object->SetPosition(1, pos);
}
@@ -132,23 +129,23 @@ bool CTaskManip::EventProcess(const Event &event)
{
if ( m_step == 0 ) // fall?
{
- pos = m_object->RetPosition(1);
+ pos = m_object->GetPosition(1);
pos.y = 3.0f-progress*2.0f;
m_object->SetPosition(1, pos);
}
if ( m_step == 1 ) // farm?
{
- pos = m_object->RetPosition(2);
+ pos = m_object->GetPosition(2);
pos.z = -1.5f+(1.0f-progress)*0.5f;
m_object->SetPosition(2, pos);
- pos = m_object->RetPosition(3);
+ pos = m_object->GetPosition(3);
pos.z = 1.5f-(1.0f-progress)*0.5f;
m_object->SetPosition(3, pos);
}
if ( m_step == 2 ) // up?
{
- pos = m_object->RetPosition(1);
+ pos = m_object->GetPosition(1);
pos.y = 3.0f-(1.0f-progress)*2.0f;
m_object->SetPosition(1, pos);
}
@@ -238,7 +235,7 @@ void CTaskManip::InitAngle()
for ( i=0 ; i<5 ; i++ )
{
- m_initialAngle[i] = m_object->RetAngleZ(i+1);
+ m_initialAngle[i] = m_object->GetAngleZ(i+1);
}
max = 0.0f;
@@ -250,10 +247,10 @@ void CTaskManip::InitAngle()
if ( m_speed > 3.0f ) m_speed = 3.0f; // piano, ma non troppo (?)
energy = 0.0f;
- power = m_object->RetPower();
+ power = m_object->GetPower();
if ( power != 0 )
{
- energy = power->RetEnergy();
+ energy = power->GetEnergy();
}
if ( energy == 0.0f )
@@ -288,12 +285,12 @@ bool TestFriend(ObjectType oType, ObjectType fType)
Error CTaskManip::Start(TaskManipOrder order, TaskManipArm arm)
{
- ObjectType type;
- CObject *front, *other, *power;
- CPyro *pyro;
- float iAngle, dist, len;
- float fDist, fAngle, oDist, oAngle, oHeight;
- Math::Vector pos, fPos, oPos;
+ ObjectType type;
+ CObject *front, *other, *power;
+ Gfx::CPyro *pyro;
+ float iAngle, dist, len;
+ float fDist, fAngle, oDist, oAngle, oHeight;
+ Math::Vector pos, fPos, oPos;
m_arm = arm;
m_height = 0.0f;
@@ -301,7 +298,7 @@ Error CTaskManip::Start(TaskManipOrder order, TaskManipArm arm)
m_progress = 0.0f;
m_speed = 1.0f/1.5f;
- iAngle = m_object->RetAngleY(0);
+ iAngle = m_object->GetAngleY(0);
iAngle = Math::NormAngle(iAngle); // 0..2*Math::PI
oAngle = iAngle;
@@ -314,12 +311,12 @@ Error CTaskManip::Start(TaskManipOrder order, TaskManipArm arm)
m_physics->SetMotorSpeed(Math::Vector(0.0f, 0.0f, 0.0f));
- type = m_object->RetType();
+ type = m_object->GetType();
if ( type == OBJECT_BEE ) // bee?
{
- if ( m_object->RetFret() == 0 )
+ if ( m_object->GetFret() == 0 )
{
- if ( !m_physics->RetLand() ) return ERR_MANIP_FLY;
+ if ( !m_physics->GetLand() ) return ERR_MANIP_FLY;
other = SearchTakeUnderObject(m_targetPos, MARGIN_BEE);
if ( other == 0 ) return ERR_MANIP_NIL;
@@ -330,19 +327,19 @@ Error CTaskManip::Start(TaskManipOrder order, TaskManipArm arm)
}
else
{
- other = m_object->RetFret(); // other = ball
+ other = m_object->GetFret(); // other = ball
m_object->SetFret(0); // lick the ball
other->SetTruck(0);
- pos = m_object->RetPosition(0);
+ pos = m_object->GetPosition(0);
pos.y -= 3.0f;
other->SetPosition(0, pos);
- pos = m_object->RetPosition(0);
+ pos = m_object->GetPosition(0);
pos.y += 2.0f;
m_object->SetPosition(0, pos); // against the top of jump
- pyro = new CPyro(m_iMan);
- pyro->Create(PT_FALL, other); // the ball falls
+ pyro = new Gfx::CPyro(m_iMan);
+ pyro->Create(Gfx::PT_FALL, other); // the ball falls
}
m_bBee = true;
@@ -361,13 +358,13 @@ Error CTaskManip::Start(TaskManipOrder order, TaskManipArm arm)
}
m_energy = 0.0f;
- power = m_object->RetPower();
+ power = m_object->GetPower();
if ( power != 0 )
{
- m_energy = power->RetEnergy();
+ m_energy = power->GetEnergy();
}
- if ( !m_physics->RetLand() ) return ERR_MANIP_FLY;
+ if ( !m_physics->GetLand() ) return ERR_MANIP_FLY;
if ( type != OBJECT_MOBILEfa &&
type != OBJECT_MOBILEta &&
@@ -385,7 +382,7 @@ Error CTaskManip::Start(TaskManipOrder order, TaskManipArm arm)
if ( order == TMO_AUTO )
{
- if ( m_object->RetFret() == 0 )
+ if ( m_object->GetFret() == 0 )
{
m_order = TMO_GRAB;
}
@@ -399,16 +396,16 @@ Error CTaskManip::Start(TaskManipOrder order, TaskManipArm arm)
m_order = order;
}
- if ( m_order == TMO_GRAB && m_object->RetFret() != 0 )
+ if ( m_order == TMO_GRAB && m_object->GetFret() != 0 )
{
return ERR_MANIP_BUSY;
}
- if ( m_order == TMO_DROP && m_object->RetFret() == 0 )
+ if ( m_order == TMO_DROP && m_object->GetFret() == 0 )
{
return ERR_MANIP_EMPTY;
}
-//? speed = m_physics->RetMotorSpeed();
+//? speed = m_physics->GetMotorSpeed();
//? if ( speed.x != 0.0f ||
//? speed.z != 0.0f ) return ERR_MANIP_MOTOR;
@@ -427,7 +424,7 @@ Error CTaskManip::Start(TaskManipOrder order, TaskManipArm arm)
}
else if ( other != 0 && oDist < fDist )
{
- if ( other->RetPower() == 0 ) return ERR_MANIP_NIL;
+ if ( other->GetPower() == 0 ) return ERR_MANIP_NIL;
m_targetPos = oPos;
m_angle = oAngle;
m_height = oHeight;
@@ -451,7 +448,7 @@ Error CTaskManip::Start(TaskManipOrder order, TaskManipArm arm)
}
if ( m_arm == TMA_POWER )
{
- if ( m_object->RetPower() == 0 ) return ERR_MANIP_NIL;
+ if ( m_object->GetPower() == 0 ) return ERR_MANIP_NIL;
}
}
@@ -460,7 +457,7 @@ Error CTaskManip::Start(TaskManipOrder order, TaskManipArm arm)
if ( m_arm == TMA_FFRONT )
{
other = SearchOtherObject(true, oPos, oDist, oAngle, oHeight);
- if ( other != 0 && other->RetPower() == 0 )
+ if ( other != 0 && other->GetPower() == 0 )
{
m_targetPos = oPos;
m_angle = oAngle;
@@ -479,27 +476,27 @@ Error CTaskManip::Start(TaskManipOrder order, TaskManipArm arm)
}
if ( m_arm == TMA_POWER )
{
- if ( m_object->RetPower() != 0 ) return ERR_MANIP_OCC;
+ if ( m_object->GetPower() != 0 ) return ERR_MANIP_OCC;
}
}
- dist = Math::Distance(m_object->RetPosition(0), m_targetPos);
+ dist = Math::Distance(m_object->GetPosition(0), m_targetPos);
len = dist-TAKE_DIST;
if ( m_arm == TMA_OTHER ) len -= TAKE_DIST_OTHER;
if ( len < 0.0f ) len = 0.0f;
if ( m_arm == TMA_FBACK ) len = -len;
- m_advanceLength = dist-m_physics->RetLinLength(len);
+ m_advanceLength = dist-m_physics->GetLinLength(len);
if ( dist <= m_advanceLength+0.2f ) m_move = 0.0f; // not necessary to advance
if ( m_energy == 0.0f ) m_move = 0.0f;
if ( m_move != 0.0f ) // forward or backward?
{
- m_timeLimit = m_physics->RetLinTimeLength(fabs(len))*1.5f;
+ m_timeLimit = m_physics->GetLinTimeLength(fabs(len))*1.5f;
if ( m_timeLimit < 0.5f ) m_timeLimit = 0.5f;
}
- if ( m_object->RetFret() == 0 ) // not carrying anything?
+ if ( m_object->GetFret() == 0 ) // not carrying anything?
{
m_hand = TMH_OPEN; // open clamp
}
@@ -540,7 +537,7 @@ Error CTaskManip::IsEnded()
float angle, dist;
int i;
- if ( m_engine->RetPause() ) return ERR_CONTINUE;
+ if ( m_engine->GetPause() ) return ERR_CONTINUE;
if ( m_bError ) return ERR_STOP;
if ( m_bBee ) // bee?
@@ -550,7 +547,7 @@ Error CTaskManip::IsEnded()
if ( m_bTurn ) // preliminary rotation?
{
- angle = m_object->RetAngleY(0);
+ angle = m_object->GetAngleY(0);
angle = Math::NormAngle(angle); // 0..2*Math::PI
if ( Math::TestAngle(angle, m_angle-Math::PI*0.01f, m_angle+Math::PI*0.01f) )
@@ -570,7 +567,7 @@ Error CTaskManip::IsEnded()
if ( m_timeLimit <= 0.0f )
{
//OK 1.9
- dist = Math::Distance(m_object->RetPosition(0), m_targetPos);
+ dist = Math::Distance(m_object->GetPosition(0), m_targetPos);
if ( dist <= m_advanceLength + 2.0f )
{
m_move = 0.0f; // advance ended
@@ -588,7 +585,7 @@ Error CTaskManip::IsEnded()
}
}
- dist = Math::Distance(m_object->RetPosition(0), m_targetPos);
+ dist = Math::Distance(m_object->GetPosition(0), m_targetPos);
if ( dist <= m_advanceLength )
{
m_move = 0.0f; // advance ended
@@ -624,7 +621,7 @@ Error CTaskManip::IsEnded()
{
if ( m_bSubm ) m_speed = 1.0f/1.5f;
if ( !TruckTakeObject() &&
- m_object->RetFret() == 0 )
+ m_object->GetFret() == 0 )
{
m_hand = TMH_OPEN; // reopens the clamp
m_arm = TMA_NEUTRAL;
@@ -638,7 +635,7 @@ Error CTaskManip::IsEnded()
(m_fretType == OBJECT_POWER ||
m_fretType == OBJECT_ATOMIC ) )
{
- m_sound->Play(SOUND_POWEROFF, m_object->RetPosition(0));
+ m_sound->Play(SOUND_POWEROFF, m_object->GetPosition(0));
}
m_arm = TMA_STOCK;
InitAngle();
@@ -653,7 +650,7 @@ Error CTaskManip::IsEnded()
if ( m_step == 1 )
{
if ( m_bSubm ) m_speed = 1.0f/0.7f;
- fret = m_object->RetFret();
+ fret = m_object->GetFret();
if ( TruckDeposeObject() )
{
if ( (m_arm == TMA_OTHER ||
@@ -661,7 +658,7 @@ Error CTaskManip::IsEnded()
(m_fretType == OBJECT_POWER ||
m_fretType == OBJECT_ATOMIC ) )
{
- m_sound->Play(SOUND_POWERON, m_object->RetPosition(0));
+ m_sound->Play(SOUND_POWERON, m_object->GetPosition(0));
}
if ( fret != 0 && m_fretType == OBJECT_METAL && m_arm == TMA_FFRONT )
{
@@ -693,7 +690,7 @@ bool CTaskManip::Abort()
{
int i;
- if ( m_object->RetFret() == 0 ) // not carrying anything?
+ if ( m_object->GetFret() == 0 ) // not carrying anything?
{
m_hand = TMH_OPEN; // open clamp
m_arm = TMA_NEUTRAL;
@@ -729,16 +726,16 @@ CObject* CTaskManip::SearchTakeUnderObject(Math::Vector &pos, float dLimit)
float min, distance;
int i;
- iPos = m_object->RetPosition(0);
+ iPos = m_object->GetPosition(0);
min = 1000000.0f;
pBest = 0;
for ( i=0 ; i<1000000 ; i++ )
{
- pObj = (CObject*)m_iMan->SearchInstance(CLASS_OBJECT, i);
+ pObj = static_cast<CObject*>(m_iMan->SearchInstance(CLASS_OBJECT, i));
if ( pObj == 0 ) break;
- type = pObj->RetType();
+ type = pObj->GetType();
if ( type != OBJECT_FRET &&
type != OBJECT_STONE &&
@@ -754,11 +751,11 @@ CObject* CTaskManip::SearchTakeUnderObject(Math::Vector &pos, float dLimit)
type != OBJECT_KEYd &&
type != OBJECT_TNT ) continue;
- if ( pObj->RetTruck() != 0 ) continue; // object transported?
- if ( pObj->RetLock() ) continue;
- if ( pObj->RetZoomY(0) != 1.0f ) continue;
+ if ( pObj->GetTruck() != 0 ) continue; // object transported?
+ if ( pObj->GetLock() ) continue;
+ if ( pObj->GetZoomY(0) != 1.0f ) continue;
- oPos = pObj->RetPosition(0);
+ oPos = pObj->GetPosition(0);
distance = Math::Distance(oPos, iPos);
if ( distance <= dLimit &&
distance < min )
@@ -769,7 +766,7 @@ CObject* CTaskManip::SearchTakeUnderObject(Math::Vector &pos, float dLimit)
}
if ( pBest != 0 )
{
- pos = pBest->RetPosition(0);
+ pos = pBest->GetPosition(0);
}
return pBest;
}
@@ -785,8 +782,8 @@ CObject* CTaskManip::SearchTakeFrontObject(bool bAdvance, Math::Vector &pos,
float min, iAngle, bAngle, aLimit, dLimit, f;
int i;
- iPos = m_object->RetPosition(0);
- iAngle = m_object->RetAngleY(0);
+ iPos = m_object->GetPosition(0);
+ iAngle = m_object->GetAngleY(0);
iAngle = Math::NormAngle(iAngle); // 0..2*Math::PI
if ( bAdvance && m_energy > 0.0f )
@@ -806,10 +803,10 @@ CObject* CTaskManip::SearchTakeFrontObject(bool bAdvance, Math::Vector &pos,
bAngle = 0.0f;
for ( i=0 ; i<1000000 ; i++ )
{
- pObj = (CObject*)m_iMan->SearchInstance(CLASS_OBJECT, i);
+ pObj = static_cast<CObject*>(m_iMan->SearchInstance(CLASS_OBJECT, i));
if ( pObj == 0 ) break;
- type = pObj->RetType();
+ type = pObj->GetType();
if ( type != OBJECT_FRET &&
type != OBJECT_STONE &&
@@ -830,11 +827,11 @@ CObject* CTaskManip::SearchTakeFrontObject(bool bAdvance, Math::Vector &pos,
type != OBJECT_SCRAP4 &&
type != OBJECT_SCRAP5 ) continue;
- if ( pObj->RetTruck() != 0 ) continue; // object transported?
- if ( pObj->RetLock() ) continue;
- if ( pObj->RetZoomY(0) != 1.0f ) continue;
+ if ( pObj->GetTruck() != 0 ) continue; // object transported?
+ if ( pObj->GetLock() ) continue;
+ if ( pObj->GetZoomY(0) != 1.0f ) continue;
- oPos = pObj->RetPosition(0);
+ oPos = pObj->GetPosition(0);
distance = fabs(Math::Distance(oPos, iPos)-TAKE_DIST);
f = 1.0f-distance/50.0f;
if ( f < 0.5f ) f = 0.5f;
@@ -859,7 +856,7 @@ CObject* CTaskManip::SearchTakeFrontObject(bool bAdvance, Math::Vector &pos,
}
else
{
- pos = pBest->RetPosition(0);
+ pos = pBest->GetPosition(0);
distance = min;
angle = bAngle;
}
@@ -877,8 +874,8 @@ CObject* CTaskManip::SearchTakeBackObject(bool bAdvance, Math::Vector &pos,
float min, iAngle, bAngle, aLimit, dLimit, f;
int i;
- iPos = m_object->RetPosition(0);
- iAngle = m_object->RetAngleY(0)+Math::PI;
+ iPos = m_object->GetPosition(0);
+ iAngle = m_object->GetAngleY(0)+Math::PI;
iAngle = Math::NormAngle(iAngle); // 0..2*Math::PI
if ( bAdvance && m_energy > 0.0f )
@@ -897,10 +894,10 @@ CObject* CTaskManip::SearchTakeBackObject(bool bAdvance, Math::Vector &pos,
bAngle = 0.0f;
for ( i=0 ; i<1000000 ; i++ )
{
- pObj = (CObject*)m_iMan->SearchInstance(CLASS_OBJECT, i);
+ pObj = static_cast<CObject*>(m_iMan->SearchInstance(CLASS_OBJECT, i));
if ( pObj == 0 ) break;
- type = pObj->RetType();
+ type = pObj->GetType();
if ( type != OBJECT_FRET &&
type != OBJECT_STONE &&
@@ -921,11 +918,11 @@ CObject* CTaskManip::SearchTakeBackObject(bool bAdvance, Math::Vector &pos,
type != OBJECT_SCRAP4 &&
type != OBJECT_SCRAP5 ) continue;
- if ( pObj->RetTruck() != 0 ) continue; // object transported?
- if ( pObj->RetLock() ) continue;
- if ( pObj->RetZoomY(0) != 1.0f ) continue;
+ if ( pObj->GetTruck() != 0 ) continue; // object transported?
+ if ( pObj->GetLock() ) continue;
+ if ( pObj->GetZoomY(0) != 1.0f ) continue;
- oPos = pObj->RetPosition(0);
+ oPos = pObj->GetPosition(0);
distance = fabs(Math::Distance(oPos, iPos)-TAKE_DIST);
f = 1.0f-distance/50.0f;
if ( f < 0.5f ) f = 0.5f;
@@ -950,7 +947,7 @@ CObject* CTaskManip::SearchTakeBackObject(bool bAdvance, Math::Vector &pos,
}
else
{
- pos = pBest->RetPosition(0);
+ pos = pBest->GetPosition(0);
distance = min;
angle = bAngle;
}
@@ -978,7 +975,7 @@ CObject* CTaskManip::SearchOtherObject(bool bAdvance, Math::Vector &pos,
if ( m_bSubm ) return 0; // impossible with the submarine
if ( !m_object->GetCrashSphere(0, iPos, iRad) ) return 0;
- iAngle = m_object->RetAngleY(0);
+ iAngle = m_object->GetAngleY(0);
iAngle = Math::NormAngle(iAngle); // 0..2*Math::PI
if ( bAdvance && m_energy > 0.0f )
@@ -994,12 +991,12 @@ CObject* CTaskManip::SearchOtherObject(bool bAdvance, Math::Vector &pos,
for ( i=0 ; i<1000000 ; i++ )
{
- pObj = (CObject*)m_iMan->SearchInstance(CLASS_OBJECT, i);
+ pObj = static_cast<CObject*>(m_iMan->SearchInstance(CLASS_OBJECT, i));
if ( pObj == 0 ) break;
if ( pObj == m_object ) continue; // yourself?
- type = pObj->RetType();
+ type = pObj->GetType();
if ( type != OBJECT_MOBILEfa &&
type != OBJECT_MOBILEta &&
type != OBJECT_MOBILEwa &&
@@ -1032,22 +1029,22 @@ CObject* CTaskManip::SearchOtherObject(bool bAdvance, Math::Vector &pos,
type != OBJECT_LABO &&
type != OBJECT_NUCLEAR ) continue;
- pPower = pObj->RetPower();
+ pPower = pObj->GetPower();
if ( pPower != 0 )
{
- if ( pPower->RetLock() ) continue;
- if ( pPower->RetZoomY(0) != 1.0f ) continue;
+ if ( pPower->GetLock() ) continue;
+ if ( pPower->GetZoomY(0) != 1.0f ) continue;
- powerType = pPower->RetType();
+ powerType = pPower->GetType();
if ( powerType == OBJECT_NULL ||
powerType == OBJECT_FIX ) continue;
}
- mat = pObj->RetWorldMatrix(0);
- character = pObj->RetCharacter();
+ mat = pObj->GetWorldMatrix(0);
+ character = pObj->GetCharacter();
oPos = Transform(*mat, character->posPower);
- oAngle = pObj->RetAngleY(0);
+ oAngle = pObj->GetAngleY(0);
if ( type == OBJECT_TOWER ||
type == OBJECT_RESEARCH )
{
@@ -1080,7 +1077,7 @@ CObject* CTaskManip::SearchOtherObject(bool bAdvance, Math::Vector &pos,
angle = Math::RotateAngle(oPos.x-iPos.x, iPos.z-oPos.z); // CW !
if ( Math::TestAngle(angle, iAngle-aLimit, iAngle+aLimit) )
{
- character = pObj->RetCharacter();
+ character = pObj->GetCharacter();
height = character->posPower.y;
pos = oPos;
return pObj;
@@ -1105,12 +1102,12 @@ bool CTaskManip::TruckTakeObject()
if ( m_arm == TMA_GRAB ) // takes immediately?
{
- fret = m_object->RetFret();
+ fret = m_object->GetFret();
if ( fret == 0 ) return false; // nothing to take?
- m_fretType = fret->RetType();
+ m_fretType = fret->GetType();
- if ( m_object->RetType() == OBJECT_HUMAN ||
- m_object->RetType() == OBJECT_TECH )
+ if ( m_object->GetType() == OBJECT_HUMAN ||
+ m_object->GetType() == OBJECT_TECH )
{
fret->SetTruck(m_object);
fret->SetTruckPart(4); // takes with the hand
@@ -1150,7 +1147,7 @@ bool CTaskManip::TruckTakeObject()
{
fret = SearchTakeFrontObject(false, pos, dist, angle);
if ( fret == 0 ) return false; // nothing to take?
- m_fretType = fret->RetType();
+ m_fretType = fret->GetType();
if ( m_bSubm )
{
@@ -1182,7 +1179,7 @@ bool CTaskManip::TruckTakeObject()
{
fret = SearchTakeBackObject(false, pos, dist, angle);
if ( fret == 0 ) return false; // nothing to take?
- m_fretType = fret->RetType();
+ m_fretType = fret->GetType();
fret->SetTruck(m_object);
fret->SetTruckPart(3); // takes with the hand
@@ -1198,9 +1195,9 @@ bool CTaskManip::TruckTakeObject()
if ( m_arm == TMA_POWER ) // takes battery in the back?
{
- fret = m_object->RetPower();
+ fret = m_object->GetPower();
if ( fret == 0 ) return false; // no battery?
- m_fretType = fret->RetType();
+ m_fretType = fret->GetType();
pos = Math::Vector(4.7f, 0.0f, 0.0f); // relative to the hand (lem4)
fret->SetPosition(0, pos);
@@ -1218,9 +1215,9 @@ bool CTaskManip::TruckTakeObject()
other = SearchOtherObject(false, pos, dist, angle, m_height);
if ( other == 0 ) return false;
- fret = other->RetPower();
+ fret = other->GetPower();
if ( fret == 0 ) return false; // the other does not have a battery?
- m_fretType = fret->RetType();
+ m_fretType = fret->GetType();
other->SetPower(0);
fret->SetTruck(m_object);
@@ -1251,15 +1248,15 @@ bool CTaskManip::TruckDeposeObject()
if ( m_arm == TMA_FFRONT ) // deposits on the ground in front?
{
- fret = m_object->RetFret();
+ fret = m_object->GetFret();
if ( fret == 0 ) return false; // nothing transported?
- m_fretType = fret->RetType();
+ m_fretType = fret->GetType();
- mat = fret->RetWorldMatrix(0);
+ mat = fret->GetWorldMatrix(0);
pos = Transform(*mat, Math::Vector(0.0f, 1.0f, 0.0f));
- m_terrain->MoveOnFloor(pos);
+ m_terrain->AdjustToFloor(pos);
fret->SetPosition(0, pos);
- fret->SetAngleY(0, m_object->RetAngleY(0)+Math::PI/2.0f);
+ fret->SetAngleY(0, m_object->GetAngleY(0)+Math::PI/2.0f);
fret->SetAngleX(0, 0.0f);
fret->SetAngleZ(0, 0.0f);
fret->FloorAdjust(); // plate well on the ground
@@ -1270,15 +1267,15 @@ bool CTaskManip::TruckDeposeObject()
if ( m_arm == TMA_FBACK ) // deposited on the ground behind?
{
- fret = m_object->RetFret();
+ fret = m_object->GetFret();
if ( fret == 0 ) return false; // nothing transported?
- m_fretType = fret->RetType();
+ m_fretType = fret->GetType();
- mat = fret->RetWorldMatrix(0);
+ mat = fret->GetWorldMatrix(0);
pos = Transform(*mat, Math::Vector(0.0f, 1.0f, 0.0f));
- m_terrain->MoveOnFloor(pos);
+ m_terrain->AdjustToFloor(pos);
fret->SetPosition(0, pos);
- fret->SetAngleY(0, m_object->RetAngleY(0)+Math::PI/2.0f);
+ fret->SetAngleY(0, m_object->GetAngleY(0)+Math::PI/2.0f);
fret->SetAngleX(0, 0.0f);
fret->SetAngleZ(0, 0.0f);
@@ -1288,16 +1285,16 @@ bool CTaskManip::TruckDeposeObject()
if ( m_arm == TMA_POWER ) // deposits battery in the back?
{
- fret = m_object->RetFret();
+ fret = m_object->GetFret();
if ( fret == 0 ) return false; // nothing transported?
- m_fretType = fret->RetType();
+ m_fretType = fret->GetType();
- if ( m_object->RetPower() != 0 ) return false;
+ if ( m_object->GetPower() != 0 ) return false;
fret->SetTruck(m_object);
fret->SetTruckPart(0); // carried by the base
- character = m_object->RetCharacter();
+ character = m_object->GetCharacter();
fret->SetPosition(0, character->posPower);
fret->SetAngleY(0, 0.0f);
fret->SetAngleX(0, 0.0f);
@@ -1312,17 +1309,17 @@ bool CTaskManip::TruckDeposeObject()
other = SearchOtherObject(false, pos, dist, angle, m_height);
if ( other == 0 ) return false;
- fret = other->RetPower();
+ fret = other->GetPower();
if ( fret != 0 ) return false; // the other already has a battery?
- fret = m_object->RetFret();
+ fret = m_object->GetFret();
if ( fret == 0 ) return false;
- m_fretType = fret->RetType();
+ m_fretType = fret->GetType();
other->SetPower(fret);
fret->SetTruck(other);
- character = other->RetCharacter();
+ character = other->GetCharacter();
fret->SetPosition(0, character->posPower);
fret->SetAngleY(0, 0.0f);
fret->SetAngleX(0, 0.0f);
@@ -1345,17 +1342,17 @@ bool CTaskManip::IsFreeDeposeObject(Math::Vector pos)
float oRadius;
int i, j;
- mat = m_object->RetWorldMatrix(0);
+ mat = m_object->GetWorldMatrix(0);
iPos = Transform(*mat, pos);
for ( i=0 ; i<1000000 ; i++ )
{
- pObj = (CObject*)m_iMan->SearchInstance(CLASS_OBJECT, i);
+ pObj = static_cast<CObject*>(m_iMan->SearchInstance(CLASS_OBJECT, i));
if ( pObj == 0 ) break;
if ( pObj == m_object ) continue;
- if ( !pObj->RetActif() ) continue; // inactive?
- if ( pObj->RetTruck() != 0 ) continue; // object transported?
+ if ( !pObj->GetActif() ) continue; // inactive?
+ if ( pObj->GetTruck() != 0 ) continue; // object transported?
j = 0;
while ( pObj->GetCrashSphere(j++, oPos, oRadius) )
@@ -1375,7 +1372,7 @@ void CTaskManip::SoundManip(float time, float amplitude, float frequency)
{
int i;
- i = m_sound->Play(SOUND_MANIP, m_object->RetPosition(0), 0.0f, 0.3f*frequency, true);
+ i = m_sound->Play(SOUND_MANIP, m_object->GetPosition(0), 0.0f, 0.3f*frequency, true);
m_sound->AddEnvelope(i, 0.5f*amplitude, 1.0f*frequency, 0.1f, SOPER_CONTINUE);
m_sound->AddEnvelope(i, 0.5f*amplitude, 1.0f*frequency, time-0.1f, SOPER_CONTINUE);
m_sound->AddEnvelope(i, 0.0f, 0.3f*frequency, 0.1f, SOPER_STOP);
diff --git a/src/object/task/taskpen.cpp b/src/object/task/taskpen.cpp
index c3a9aef..6e04233 100644
--- a/src/object/task/taskpen.cpp
+++ b/src/object/task/taskpen.cpp
@@ -16,12 +16,9 @@
// taskpen.cpp
-
-#include <stdio.h>
-
#include "object/task/taskpen.h"
-#include "old/particule.h"
+#include "graphics/engine/particle.h"
#include "math/geometry.h"
#include "object/object.h"
@@ -49,8 +46,8 @@ bool CTaskPen::EventProcess(const Event &event)
Math::Point dim;
int i;
- if ( m_engine->RetPause() ) return true;
- if ( event.event != EVENT_FRAME ) return true;
+ if ( m_engine->GetPause() ) return true;
+ if ( event.type != EVENT_FRAME ) return true;
if ( m_bError ) return false;
if ( m_delay == 0.0f )
@@ -67,17 +64,17 @@ bool CTaskPen::EventProcess(const Event &event)
if ( m_phase == TPP_UP ) // back the pencil
{
- i = AngleToRank(m_object->RetAngleY(1));
- pos = m_object->RetPosition(10+i);
+ i = AngleToRank(m_object->GetAngleY(1));
+ pos = m_object->GetPosition(10+i);
pos.y = -3.2f*(1.0f-m_progress);
m_object->SetPosition(10+i, pos);
}
if ( m_phase == TPP_TURN ) // turns the carousel?
{
- if ( m_lastParticule+m_engine->ParticuleAdapt(0.05f) <= m_time )
+ if ( m_lastParticle+m_engine->ParticleAdapt(0.05f) <= m_time )
{
- m_lastParticule = m_time;
+ m_lastParticle = m_time;
pos = m_supportPos;
pos.x += (Math::Rand()-0.5f)*5.0f;
@@ -87,7 +84,7 @@ bool CTaskPen::EventProcess(const Event &event)
speed.y = Math::Rand()*2.0f;
dim.x = Math::Rand()*1.5f+2.0f;
dim.y = dim.x;
- m_particule->CreateParticule(pos, speed, dim, PARTISMOKE3, 4.0f);
+ m_particle->CreateParticle(pos, speed, dim, Gfx::PARTISMOKE3, 4.0f);
}
m_object->SetAngleY(1, m_oldAngle+(m_newAngle-m_oldAngle)*m_progress);
@@ -95,9 +92,9 @@ bool CTaskPen::EventProcess(const Event &event)
if ( m_phase == TPP_DOWN ) // down the pencil?
{
- if ( m_lastParticule+m_engine->ParticuleAdapt(0.05f) <= m_time )
+ if ( m_lastParticle+m_engine->ParticleAdapt(0.05f) <= m_time )
{
- m_lastParticule = m_time;
+ m_lastParticle = m_time;
pos = m_supportPos;
pos.x += (Math::Rand()-0.5f)*5.0f;
@@ -107,11 +104,11 @@ bool CTaskPen::EventProcess(const Event &event)
speed.y = Math::Rand()*5.0f;
dim.x = Math::Rand()*1.0f+1.0f;
dim.y = dim.x;
- m_particule->CreateParticule(pos, speed, dim, PARTIVAPOR, 4.0f);
+ m_particle->CreateParticle(pos, speed, dim, Gfx::PARTIVAPOR, 4.0f);
}
- i = AngleToRank(m_object->RetAngleY(1));
- pos = m_object->RetPosition(10+i);
+ i = AngleToRank(m_object->GetAngleY(1));
+ pos = m_object->GetPosition(10+i);
if ( m_timeDown == 0.0f )
{
pos.y = 0.0f;
@@ -138,16 +135,16 @@ Error CTaskPen::Start(bool bDown, int color)
m_bError = true; // operation impossible
- type = m_object->RetType();
+ type = m_object->GetType();
if ( type != OBJECT_MOBILEdr ) return ERR_FIRE_VEH;
m_bError = false; // ok
- m_oldAngle = m_object->RetAngleY(1);
+ m_oldAngle = m_object->GetAngleY(1);
m_newAngle = ColorToAngle(color);
i = AngleToRank(m_oldAngle);
- pos = m_object->RetPosition(10+i);
+ pos = m_object->GetPosition(10+i);
if ( pos.y == 0.0f ) // pencil at the top?
{
@@ -167,7 +164,7 @@ Error CTaskPen::Start(bool bDown, int color)
m_timeDown = 0.0f;
}
- mat = m_object->RetWorldMatrix(0);
+ mat = m_object->GetWorldMatrix(0);
pos = Math::Vector(-3.0f, 7.0f, 0.0f);
pos = Math::Transform(*mat, pos); // position of carousel
m_supportPos = pos;
@@ -182,7 +179,7 @@ Error CTaskPen::Start(bool bDown, int color)
SoundManip(m_timeUp, 1.0f, 0.5f);
}
- m_lastParticule = 0.0f;
+ m_lastParticle = 0.0f;
//? m_camera->StartCentering(m_object, Math::PI*0.60f, 99.9f, 5.0f, 0.5f);
@@ -193,7 +190,7 @@ Error CTaskPen::Start(bool bDown, int color)
Error CTaskPen::IsEnded()
{
- if ( m_engine->RetPause() ) return ERR_CONTINUE;
+ if ( m_engine->GetPause() ) return ERR_CONTINUE;
if ( m_bError ) return ERR_STOP;
if ( m_progress < 1.0f ) return ERR_CONTINUE;
@@ -205,7 +202,7 @@ Error CTaskPen::IsEnded()
m_progress = 0.0f;
m_delay = fabs(m_oldAngle-m_newAngle)/Math::PI;
m_time = 0.0f;
- m_lastParticule = 0.0f;
+ m_lastParticle = 0.0f;
if ( m_delay > 0.0f )
{
SoundManip(m_delay, 1.0f, 1.0f);
@@ -220,7 +217,7 @@ Error CTaskPen::IsEnded()
m_progress = 0.0f;
m_delay = m_timeDown;
m_time = 0.0f;
- m_lastParticule = 0.0f;
+ m_lastParticle = 0.0f;
return ERR_CONTINUE;
}
@@ -243,7 +240,7 @@ void CTaskPen::SoundManip(float time, float amplitude, float frequency)
{
int i;
- i = m_sound->Play(SOUND_MANIP, m_object->RetPosition(0), 0.0f, 0.3f*frequency, true);
+ i = m_sound->Play(SOUND_MANIP, m_object->GetPosition(0), 0.0f, 0.3f*frequency, true);
m_sound->AddEnvelope(i, 0.5f*amplitude, 1.0f*frequency, 0.1f, SOPER_CONTINUE);
m_sound->AddEnvelope(i, 0.5f*amplitude, 1.0f*frequency, time-0.1f, SOPER_CONTINUE);
m_sound->AddEnvelope(i, 0.0f, 0.3f*frequency, 0.1f, SOPER_STOP);
@@ -257,7 +254,7 @@ int CTaskPen::AngleToRank(float angle)
//? return (int)(angle/(-45.0f*Math::PI/180.0f));
angle = -angle;
angle += (45.0f*Math::PI/180.0f)/2.0f;
- return (int)(angle/(45.0f*Math::PI/180.0f));
+ return static_cast<int>(angle/(45.0f*Math::PI/180.0f));
}
// Converting a color to the angle of carousel of pencils.
diff --git a/src/object/task/taskpen.h b/src/object/task/taskpen.h
index b41c513..0974322 100644
--- a/src/object/task/taskpen.h
+++ b/src/object/task/taskpen.h
@@ -57,8 +57,8 @@ protected:
float m_progress;
float m_delay;
float m_time;
- float m_lastParticule;
- Math::Vector m_supportPos;
+ float m_lastParticle;
+ Math::Vector m_supportPos;
float m_timeUp;
float m_oldAngle;
diff --git a/src/object/task/taskrecover.cpp b/src/object/task/taskrecover.cpp
index 02cefb8..4c8ead8 100644
--- a/src/object/task/taskrecover.cpp
+++ b/src/object/task/taskrecover.cpp
@@ -23,7 +23,7 @@
#include "math/geometry.h"
#include "common/iman.h"
-#include "old/particule.h"
+#include "graphics/engine/particle.h"
#include "physics/physics.h"
#include "ui/displaytext.h"
@@ -58,13 +58,13 @@ bool CTaskRecover::EventProcess(const Event &event)
Math::Point dim;
float a, g, cirSpeed, angle, energy, dist, linSpeed;
- if ( m_engine->RetPause() ) return true;
- if ( event.event != EVENT_FRAME ) return true;
+ if ( m_engine->GetPause() ) return true;
+ if ( event.type != EVENT_FRAME ) return true;
if ( m_bError ) return false;
if ( m_phase == TRP_TURN ) // preliminary rotation?
{
- a = m_object->RetAngleY(0);
+ a = m_object->GetAngleY(0);
g = m_angle;
cirSpeed = Math::Direction(a, g)*1.0f;
if ( cirSpeed > 1.0f ) cirSpeed = 1.0f;
@@ -90,7 +90,7 @@ bool CTaskRecover::EventProcess(const Event &event)
if ( m_phase == TRP_MOVE ) // preliminary forward/backward?
{
- dist = Math::Distance(m_object->RetPosition(0), m_ruin->RetPosition(0));
+ dist = Math::Distance(m_object->GetPosition(0), m_ruin->GetPosition(0));
linSpeed = 0.0f;
if ( dist > RECOVER_DIST ) linSpeed = 1.0f;
if ( dist < RECOVER_DIST ) linSpeed = -1.0f;
@@ -100,10 +100,10 @@ bool CTaskRecover::EventProcess(const Event &event)
if ( m_phase == TRP_OPER )
{
- power = m_object->RetPower();
+ power = m_object->GetPower();
if ( power != 0 )
{
- energy = power->RetEnergy();
+ energy = power->GetEnergy();
power->SetEnergy(energy-ENERGY_RECOVER*event.rTime*m_speed);
}
@@ -122,9 +122,9 @@ bool CTaskRecover::EventProcess(const Event &event)
m_metal->SetZoom(0, (m_progress-0.5f)/0.3f);
}
- if ( m_lastParticule+m_engine->ParticuleAdapt(0.02f) <= m_time )
+ if ( m_lastParticle+m_engine->ParticleAdapt(0.02f) <= m_time )
{
- m_lastParticule = m_time;
+ m_lastParticle = m_time;
pos = m_recoverPos;
pos.x += (Math::Rand()-0.5f)*8.0f*(1.0f-m_progress);
@@ -135,7 +135,7 @@ bool CTaskRecover::EventProcess(const Event &event)
speed.y = Math::Rand()*15.0f;
dim.x = Math::Rand()*2.0f+1.5f;
dim.y = dim.x;
- m_particule->CreateParticule(pos, speed, dim, PARTIRECOVER, 1.0f, 0.0f, 0.0f);
+ m_particle->CreateParticle(pos, speed, dim, Gfx::PARTIRECOVER, 1.0f, 0.0f, 0.0f);
}
}
@@ -149,9 +149,9 @@ bool CTaskRecover::EventProcess(const Event &event)
m_object->SetAngleZ(3, angle);
m_object->SetAngleZ(5, angle);
- if ( m_lastParticule+m_engine->ParticuleAdapt(0.02f) <= m_time )
+ if ( m_lastParticle+m_engine->ParticleAdapt(0.02f) <= m_time )
{
- m_lastParticule = m_time;
+ m_lastParticle = m_time;
pos = m_recoverPos;
pos.y -= 4.0f;
@@ -160,7 +160,7 @@ bool CTaskRecover::EventProcess(const Event &event)
speed.y = Math::Rand()*15.0f;
dim.x = Math::Rand()*2.0f+1.5f;
dim.y = dim.x;
- m_particule->CreateParticule(pos, speed, dim, PARTIRECOVER, 1.0f, 0.0f, 0.0f);
+ m_particle->CreateParticle(pos, speed, dim, Gfx::PARTIRECOVER, 1.0f, 0.0f, 0.0f);
}
}
@@ -180,17 +180,17 @@ Error CTaskRecover::Start()
ObjectType type;
m_bError = true; // operation impossible
- if ( !m_physics->RetLand() ) return ERR_RECOVER_VEH;
+ if ( !m_physics->GetLand() ) return ERR_RECOVER_VEH;
- type = m_object->RetType();
+ type = m_object->GetType();
if ( type != OBJECT_MOBILErr ) return ERR_RECOVER_VEH;
- power = m_object->RetPower();
+ power = m_object->GetPower();
if ( power == 0 ) return ERR_RECOVER_ENERGY;
- energy = power->RetEnergy();
- if ( energy < ENERGY_RECOVER/power->RetCapacity()+0.05f ) return ERR_RECOVER_ENERGY;
+ energy = power->GetEnergy();
+ if ( energy < ENERGY_RECOVER/power->GetCapacity()+0.05f ) return ERR_RECOVER_ENERGY;
- mat = m_object->RetWorldMatrix(0);
+ mat = m_object->GetWorldMatrix(0);
pos = Math::Vector(RECOVER_DIST, 3.3f, 0.0f);
pos = Transform(*mat, pos); // position in front
m_recoverPos = pos;
@@ -199,8 +199,8 @@ Error CTaskRecover::Start()
if ( m_ruin == 0 ) return ERR_RECOVER_NULL;
m_ruin->SetLock(true); // ruin no longer usable
- iPos = m_object->RetPosition(0);
- oPos = m_ruin->RetPosition(0);
+ iPos = m_object->GetPosition(0);
+ oPos = m_ruin->GetPosition(0);
m_angle = Math::RotateAngle(oPos.x-iPos.x, iPos.z-oPos.z); // CW !
m_metal = 0;
@@ -209,7 +209,7 @@ Error CTaskRecover::Start()
m_progress = 0.0f;
m_speed = 1.0f/1.0f;
m_time = 0.0f;
- m_lastParticule = 0.0f;
+ m_lastParticle = 0.0f;
m_bError = false; // ok
@@ -227,27 +227,27 @@ Error CTaskRecover::IsEnded()
float angle, dist, time;
int i;
- if ( m_engine->RetPause() ) return ERR_CONTINUE;
+ if ( m_engine->GetPause() ) return ERR_CONTINUE;
if ( m_bError ) return ERR_STOP;
if ( m_phase == TRP_TURN ) // preliminary rotation?
{
- angle = m_object->RetAngleY(0);
+ angle = m_object->GetAngleY(0);
angle = Math::NormAngle(angle); // 0..2*Math::PI
if ( Math::TestAngle(angle, m_angle-Math::PI*0.01f, m_angle+Math::PI*0.01f) )
{
m_physics->SetMotorSpeedZ(0.0f);
- dist = Math::Distance(m_object->RetPosition(0), m_ruin->RetPosition(0));
+ dist = Math::Distance(m_object->GetPosition(0), m_ruin->GetPosition(0));
if ( dist > RECOVER_DIST )
{
- time = m_physics->RetLinTimeLength(dist-RECOVER_DIST, 1.0f);
+ time = m_physics->GetLinTimeLength(dist-RECOVER_DIST, 1.0f);
m_speed = 1.0f/time;
}
else
{
- time = m_physics->RetLinTimeLength(RECOVER_DIST-dist, -1.0f);
+ time = m_physics->GetLinTimeLength(RECOVER_DIST-dist, -1.0f);
m_speed = 1.0f/time;
}
m_phase = TRP_MOVE;
@@ -258,19 +258,19 @@ Error CTaskRecover::IsEnded()
if ( m_phase == TRP_MOVE ) // preliminary advance?
{
- dist = Math::Distance(m_object->RetPosition(0), m_ruin->RetPosition(0));
+ dist = Math::Distance(m_object->GetPosition(0), m_ruin->GetPosition(0));
if ( dist >= RECOVER_DIST-1.0f &&
dist <= RECOVER_DIST+1.0f )
{
m_physics->SetMotorSpeedX(0.0f);
- mat = m_object->RetWorldMatrix(0);
+ mat = m_object->GetWorldMatrix(0);
pos = Math::Vector(RECOVER_DIST, 3.3f, 0.0f);
pos = Transform(*mat, pos); // position in front
m_recoverPos = pos;
- i = m_sound->Play(SOUND_MANIP, m_object->RetPosition(0), 0.0f, 0.9f, true);
+ i = m_sound->Play(SOUND_MANIP, m_object->GetPosition(0), 0.0f, 0.9f, true);
m_sound->AddEnvelope(i, 1.0f, 1.5f, 0.3f, SOPER_CONTINUE);
m_sound->AddEnvelope(i, 1.0f, 1.5f, 1.0f, SOPER_CONTINUE);
m_sound->AddEnvelope(i, 0.0f, 0.9f, 0.3f, SOPER_STOP);
@@ -310,15 +310,15 @@ Error CTaskRecover::IsEnded()
m_metal->SetLock(true); // metal not yet usable
m_metal->SetZoom(0, 0.0f);
- mat = m_object->RetWorldMatrix(0);
+ mat = m_object->GetWorldMatrix(0);
pos = Math::Vector(RECOVER_DIST, 3.1f, 3.9f);
pos = Transform(*mat, pos);
goal = Math::Vector(RECOVER_DIST, 3.1f, -3.9f);
goal = Transform(*mat, goal);
- m_particule->CreateRay(pos, goal, PARTIRAY2,
+ m_particle->CreateRay(pos, goal, Gfx::PARTIRAY2,
Math::Point(2.0f, 2.0f), 8.0f);
- m_soundChannel = m_sound->Play(SOUND_RECOVER, m_ruin->RetPosition(0), 0.0f, 1.0f, true);
+ m_soundChannel = m_sound->Play(SOUND_RECOVER, m_ruin->GetPosition(0), 0.0f, 1.0f, true);
m_sound->AddEnvelope(m_soundChannel, 0.6f, 1.0f, 2.0f, SOPER_CONTINUE);
m_sound->AddEnvelope(m_soundChannel, 0.6f, 1.0f, 4.0f, SOPER_CONTINUE);
m_sound->AddEnvelope(m_soundChannel, 0.0f, 0.7f, 2.0f, SOPER_STOP);
@@ -338,7 +338,7 @@ Error CTaskRecover::IsEnded()
m_soundChannel = -1;
- i = m_sound->Play(SOUND_MANIP, m_object->RetPosition(0), 0.0f, 0.9f, true);
+ i = m_sound->Play(SOUND_MANIP, m_object->GetPosition(0), 0.0f, 0.9f, true);
m_sound->AddEnvelope(i, 1.0f, 1.5f, 0.3f, SOPER_CONTINUE);
m_sound->AddEnvelope(i, 1.0f, 1.5f, 1.0f, SOPER_CONTINUE);
m_sound->AddEnvelope(i, 0.0f, 0.9f, 0.3f, SOPER_STOP);
@@ -389,10 +389,10 @@ CObject* CTaskRecover::SearchRuin()
min = 100000.0f;
for ( i=0 ; i<1000000 ; i++ )
{
- pObj = (CObject*)m_iMan->SearchInstance(CLASS_OBJECT, i);
+ pObj = static_cast<CObject*>(m_iMan->SearchInstance(CLASS_OBJECT, i));
if ( pObj == 0 ) break;
- type = pObj->RetType();
+ type = pObj->GetType();
if ( type == OBJECT_RUINmobilew1 ||
type == OBJECT_RUINmobilew2 ||
type == OBJECT_RUINmobilet1 ||
@@ -400,7 +400,7 @@ CObject* CTaskRecover::SearchRuin()
type == OBJECT_RUINmobiler1 ||
type == OBJECT_RUINmobiler2 ) // vehicle in ruin?
{
- oPos = pObj->RetPosition(0);
+ oPos = pObj->GetPosition(0);
dist = Math::Distance(oPos, m_recoverPos);
if ( dist > 40.0f ) continue;
diff --git a/src/object/task/taskrecover.h b/src/object/task/taskrecover.h
index 8af6353..151ab6b 100644
--- a/src/object/task/taskrecover.h
+++ b/src/object/task/taskrecover.h
@@ -56,11 +56,11 @@ protected:
float m_speed;
float m_time;
float m_angle;
- float m_lastParticule;
+ float m_lastParticle;
bool m_bError;
CObject* m_ruin;
CObject* m_metal;
- Math::Vector m_recoverPos;
+ Math::Vector m_recoverPos;
int m_soundChannel;
};
diff --git a/src/object/task/taskreset.cpp b/src/object/task/taskreset.cpp
index 2366fea..7e097bf 100644
--- a/src/object/task/taskreset.cpp
+++ b/src/object/task/taskreset.cpp
@@ -16,9 +16,6 @@
// taskreset.cpp
-
-#include <stdio.h>
-
#include "object/task/taskreset.h"
#include "common/iman.h"
@@ -55,8 +52,8 @@ bool CTaskReset::EventProcess(const Event &event)
Math::Point dim;
float angle, duration;
- if ( m_engine->RetPause() ) return true;
- if ( event.event != EVENT_FRAME ) return true;
+ if ( m_engine->GetPause() ) return true;
+ if ( event.type != EVENT_FRAME ) return true;
if ( m_bError ) return false;
m_time += event.rTime;
@@ -69,9 +66,9 @@ bool CTaskReset::EventProcess(const Event &event)
m_object->SetAngleY(0, angle);
m_object->SetZoom(0, 1.0f-m_progress);
- if ( m_lastParticule+m_engine->ParticuleAdapt(0.05f) <= m_time )
+ if ( m_lastParticle+m_engine->ParticleAdapt(0.05f) <= m_time )
{
- m_lastParticule = m_time;
+ m_lastParticle = m_time;
pos = m_begin;
pos.x += (Math::Rand()-0.5f)*5.0f;
@@ -81,7 +78,7 @@ bool CTaskReset::EventProcess(const Event &event)
speed.y = 5.0f+Math::Rand()*5.0f;
dim.x = Math::Rand()*2.0f+2.0f;
dim.y = dim.x;
- m_particule->CreateParticule(pos, speed, dim, PARTIGLINTb, 2.0f);
+ m_particle->CreateParticle(pos, speed, dim, Gfx::PARTIGLINTb, 2.0f);
pos = m_begin;
speed.x = (Math::Rand()-0.5f)*20.0f;
@@ -94,7 +91,7 @@ bool CTaskReset::EventProcess(const Event &event)
dim.y = dim.x;
pos.y += dim.y;
duration = Math::Rand()*1.5f+1.5f;
- m_particule->CreateTrack(pos, speed, dim, PARTITRACK6,
+ m_particle->CreateTrack(pos, speed, dim, Gfx::PARTITRACK6,
duration, 0.0f,
duration*0.9f, 0.7f);
}
@@ -105,9 +102,9 @@ bool CTaskReset::EventProcess(const Event &event)
pos = m_begin+(m_goal-m_begin)*m_progress;
m_object->SetPosition(0, pos);
- if ( m_lastParticule+m_engine->ParticuleAdapt(0.05f) <= m_time )
+ if ( m_lastParticle+m_engine->ParticleAdapt(0.05f) <= m_time )
{
- m_lastParticule = m_time;
+ m_lastParticle = m_time;
pos.x += (Math::Rand()-0.5f)*5.0f;
pos.z += (Math::Rand()-0.5f)*5.0f;
@@ -116,7 +113,7 @@ bool CTaskReset::EventProcess(const Event &event)
speed.y = 2.0f+Math::Rand()*2.0f;
dim.x = Math::Rand()*2.0f+2.0f;
dim.y = dim.x;
- m_particule->CreateParticule(pos, speed, dim, PARTIGLINTb, 2.0f);
+ m_particle->CreateParticle(pos, speed, dim, Gfx::PARTIGLINTb, 2.0f);
}
}
@@ -127,9 +124,9 @@ bool CTaskReset::EventProcess(const Event &event)
m_object->SetAngleY(0, angle);
m_object->SetZoom(0, m_progress);
- if ( m_lastParticule+m_engine->ParticuleAdapt(0.05f) <= m_time )
+ if ( m_lastParticle+m_engine->ParticleAdapt(0.05f) <= m_time )
{
- m_lastParticule = m_time;
+ m_lastParticle = m_time;
pos = m_goal;
pos.x += (Math::Rand()-0.5f)*5.0f;
@@ -139,7 +136,7 @@ bool CTaskReset::EventProcess(const Event &event)
speed.y = 5.0f+Math::Rand()*5.0f;
dim.x = Math::Rand()*2.0f+2.0f;
dim.y = dim.x;
- m_particule->CreateParticule(pos, speed, dim, PARTIGLINTb, 2.0f);
+ m_particle->CreateParticle(pos, speed, dim, Gfx::PARTIGLINTb, 2.0f);
pos = m_goal;
speed.x = (Math::Rand()-0.5f)*20.0f;
@@ -150,7 +147,7 @@ bool CTaskReset::EventProcess(const Event &event)
dim.y = dim.x;
pos.y += dim.y;
duration = Math::Rand()*1.5f+1.5f;
- m_particule->CreateTrack(pos, speed, dim, PARTITRACK6,
+ m_particle->CreateTrack(pos, speed, dim, Gfx::PARTITRACK6,
duration, 0.0f,
duration*0.9f, 0.7f);
}
@@ -168,24 +165,24 @@ Error CTaskReset::Start(Math::Vector goal, Math::Vector angle)
CObject* fret;
int i;
- fret = m_object->RetFret();
- if ( fret != 0 && fret->RetResetCap() == RESET_MOVE )
+ fret = m_object->GetFret();
+ if ( fret != 0 && fret->GetResetCap() == RESET_MOVE )
{
fret->SetTruck(0);
m_object->SetFret(0); // does nothing
}
- if ( !m_main->RetNiceReset() ) // quick return?
+ if ( !m_main->GetNiceReset() ) // quick return?
{
m_object->SetPosition(0, goal);
m_object->SetAngle(0, angle);
- m_brain->RunProgram(m_object->RetResetRun());
+ m_brain->RunProgram(m_object->GetResetRun());
m_bError = false;
return ERR_OK;
}
- m_begin = m_object->RetPosition(0);
+ m_begin = m_object->GetPosition(0);
m_goal = goal;
m_angle = angle;
@@ -195,12 +192,12 @@ Error CTaskReset::Start(Math::Vector goal, Math::Vector angle)
return ERR_RESET_NEAR;
}
- m_iAngle = m_object->RetAngleY(0);
+ m_iAngle = m_object->GetAngleY(0);
m_time = 0.0f;
m_phase = TRSP_ZOUT;
m_speed = 1.0f/RESET_DELAY_ZOOM;
m_progress = 0.0f;
- m_lastParticule = 0.0f;
+ m_lastParticle = 0.0f;
m_object->SetResetBusy(true);
@@ -219,12 +216,12 @@ Error CTaskReset::IsEnded()
float dist;
int i;
- if ( !m_main->RetNiceReset() ) // quick return?
+ if ( !m_main->GetNiceReset() ) // quick return?
{
return ERR_STOP;
}
- if ( m_engine->RetPause() ) return ERR_CONTINUE;
+ if ( m_engine->GetPause() ) return ERR_CONTINUE;
if ( m_bError ) return ERR_STOP;
if ( m_progress < 1.0f ) return ERR_CONTINUE;
@@ -254,13 +251,13 @@ Error CTaskReset::IsEnded()
m_object->SetAngle(0, m_angle);
m_object->SetZoom(0, 1.0f);
- power = m_object->RetPower();
+ power = m_object->GetPower();
if ( power != 0 )
{
- power->SetEnergy(power->RetCapacity()); // refueling
+ power->SetEnergy(power->GetCapacity()); // refueling
}
- m_brain->RunProgram(m_object->RetResetRun());
+ m_brain->RunProgram(m_object->GetResetRun());
m_object->SetResetBusy(false);
return ERR_STOP;
}
@@ -278,12 +275,12 @@ bool CTaskReset::SearchVehicle()
for ( i=0 ; i<1000000 ; i++ )
{
- pObj = (CObject*)m_iMan->SearchInstance(CLASS_OBJECT, i);
+ pObj = static_cast<CObject*>(m_iMan->SearchInstance(CLASS_OBJECT, i));
if ( pObj == 0 ) break;
if ( pObj == m_object ) continue;
- type = pObj->RetType();
+ type = pObj->GetType();
if ( type != OBJECT_HUMAN &&
type != OBJECT_TECH &&
type != OBJECT_MOBILEfa &&
diff --git a/src/object/task/taskreset.h b/src/object/task/taskreset.h
index 17a4441..e3dacf7 100644
--- a/src/object/task/taskreset.h
+++ b/src/object/task/taskreset.h
@@ -57,7 +57,7 @@ protected:
float m_time;
float m_speed;
float m_progress;
- float m_lastParticule; // time of generation last particle
+ float m_lastParticle; // time of generation last particle
float m_iAngle;
};
diff --git a/src/object/task/tasksearch.cpp b/src/object/task/tasksearch.cpp
index 8c083dd..578b41e 100644
--- a/src/object/task/tasksearch.cpp
+++ b/src/object/task/tasksearch.cpp
@@ -16,15 +16,12 @@
// tasksearch.cpp
-
-#include <stdio.h>
-
#include "object/task/tasksearch.h"
#include "math/geometry.h"
#include "common/iman.h"
-#include "old/particule.h"
-#include "old/terrain.h"
+#include "graphics/engine/particle.h"
+#include "graphics/engine/terrain.h"
#include "physics/physics.h"
#include "ui/displaytext.h"
@@ -56,8 +53,8 @@ bool CTaskSearch::EventProcess(const Event &event)
float angle;
int i;
- if ( m_engine->RetPause() ) return true;
- if ( event.event != EVENT_FRAME ) return true;
+ if ( m_engine->GetPause() ) return true;
+ if ( event.type != EVENT_FRAME ) return true;
if ( m_bError ) return false;
m_progress += event.rTime*m_speed; // others advance
@@ -75,11 +72,11 @@ bool CTaskSearch::EventProcess(const Event &event)
}
if ( m_phase == TSP_SEARCH &&
- m_lastParticule+m_engine->ParticuleAdapt(0.05f) <= m_time )
+ m_lastParticle+m_engine->ParticleAdapt(0.05f) <= m_time )
{
- m_lastParticule = m_time;
+ m_lastParticle = m_time;
- mat = m_object->RetWorldMatrix(0);
+ mat = m_object->GetWorldMatrix(0);
pos = Math::Vector(6.5f, 0.2f, 0.0f);
pos = Math::Transform(*mat, pos); // sensor position
@@ -88,7 +85,7 @@ bool CTaskSearch::EventProcess(const Event &event)
speed.y = 0.0f;
dim.x = Math::Rand()*1.0f+1.0f;
dim.y = dim.x;
- m_particule->CreateParticule(pos, speed, dim, PARTIGAS);
+ m_particle->CreateParticle(pos, speed, dim, Gfx::PARTIGAS);
}
return true;
@@ -116,7 +113,7 @@ void CTaskSearch::InitAngle()
for ( i=0 ; i<3 ; i++ )
{
- m_initialAngle[i] = m_object->RetAngleZ(i+1);
+ m_initialAngle[i] = m_object->GetAngleZ(i+1);
}
}
@@ -130,13 +127,13 @@ Error CTaskSearch::Start()
int i;
m_bError = true;
- if ( !m_physics->RetLand() ) return ERR_SEARCH_FLY;
+ if ( !m_physics->GetLand() ) return ERR_SEARCH_FLY;
- speed = m_physics->RetMotorSpeed();
+ speed = m_physics->GetMotorSpeed();
if ( speed.x != 0.0f ||
speed.z != 0.0f ) return ERR_SEARCH_MOTOR;
- type = m_object->RetType();
+ type = m_object->GetType();
if ( type != OBJECT_MOBILEfs &&
type != OBJECT_MOBILEts &&
type != OBJECT_MOBILEws &&
@@ -147,14 +144,14 @@ Error CTaskSearch::Start()
m_progress = 0.0f;
m_speed = 1.0f/1.0f;
m_time = 0.0f;
- m_lastParticule = 0.0f;
+ m_lastParticle = 0.0f;
InitAngle();
m_bError = false; // ok
m_camera->StartCentering(m_object, Math::PI*0.50f, 99.9f, 0.0f, 1.0f);
- i = m_sound->Play(SOUND_MANIP, m_object->RetPosition(0), 0.0f, 0.3f, true);
+ i = m_sound->Play(SOUND_MANIP, m_object->GetPosition(0), 0.0f, 0.3f, true);
m_sound->AddEnvelope(i, 0.5f, 1.0f, 0.1f, SOPER_CONTINUE);
m_sound->AddEnvelope(i, 0.5f, 1.0f, 0.9f, SOPER_CONTINUE);
m_sound->AddEnvelope(i, 0.0f, 0.3f, 0.1f, SOPER_STOP);
@@ -170,7 +167,7 @@ Error CTaskSearch::IsEnded()
{
int i;
- if ( m_engine->RetPause() ) return ERR_CONTINUE;
+ if ( m_engine->GetPause() ) return ERR_CONTINUE;
if ( m_bError ) return ERR_STOP;
if ( m_progress < 1.0f ) return ERR_CONTINUE;
@@ -187,7 +184,7 @@ Error CTaskSearch::IsEnded()
if ( m_phase == TSP_DOWN )
{
- m_sound->Play(SOUND_REPAIR, m_object->RetPosition(0));
+ m_sound->Play(SOUND_REPAIR, m_object->GetPosition(0));
m_phase = TSP_SEARCH;
m_speed = 1.0f/4.0f;
@@ -201,7 +198,7 @@ Error CTaskSearch::IsEnded()
m_hand = TSH_UP;
InitAngle();
- i = m_sound->Play(SOUND_MANIP, m_object->RetPosition(0), 0.0f, 0.3f, true);
+ i = m_sound->Play(SOUND_MANIP, m_object->GetPosition(0), 0.0f, 0.3f, true);
m_sound->AddEnvelope(i, 0.5f, 1.0f, 0.1f, SOPER_CONTINUE);
m_sound->AddEnvelope(i, 0.5f, 1.0f, 0.9f, SOPER_CONTINUE);
m_sound->AddEnvelope(i, 0.0f, 0.3f, 0.1f, SOPER_STOP);
@@ -229,52 +226,52 @@ bool CTaskSearch::Abort()
bool CTaskSearch::CreateMark()
{
- CObject* fret;
- ObjectType type;
+ CObject* fret;
+ ObjectType type;
Math::Matrix* mat;
Math::Vector pos;
- TerrainRes res;
- Error info;
+ Gfx::TerrainRes res;
+ Error info;
- mat = m_object->RetWorldMatrix(0);
+ mat = m_object->GetWorldMatrix(0);
pos = Math::Vector(7.5f, 0.0f, 0.0f);
pos = Math::Transform(*mat, pos); // sensor position
- res = m_terrain->RetResource(pos);
- if ( res == TR_NULL ) return false;
+ res = m_terrain->GetResource(pos);
+ if ( res == Gfx::TR_NULL ) return false;
type = OBJECT_NULL;
- if ( res == TR_STONE )
+ if ( res == Gfx::TR_STONE )
{
type = OBJECT_MARKSTONE;
info = INFO_MARKSTONE;
}
- if ( res == TR_URANIUM )
+ if ( res == Gfx::TR_URANIUM )
{
type = OBJECT_MARKURANIUM;
info = INFO_MARKURANIUM;
}
- if ( res == TR_POWER )
+ if ( res == Gfx::TR_POWER )
{
type = OBJECT_MARKPOWER;
info = INFO_MARKPOWER;
}
- if ( res == TR_KEYa )
+ if ( res == Gfx::TR_KEY_A )
{
type = OBJECT_MARKKEYa;
info = INFO_MARKKEYa;
}
- if ( res == TR_KEYb )
+ if ( res == Gfx::TR_KEY_B )
{
type = OBJECT_MARKKEYb;
info = INFO_MARKKEYb;
}
- if ( res == TR_KEYc )
+ if ( res == Gfx::TR_KEY_C )
{
type = OBJECT_MARKKEYc;
info = INFO_MARKKEYc;
}
- if ( res == TR_KEYd )
+ if ( res == Gfx::TR_KEY_D )
{
type = OBJECT_MARKKEYd;
info = INFO_MARKKEYd;
@@ -306,10 +303,10 @@ void CTaskSearch::DeleteMark(ObjectType type)
for ( i=0 ; i<1000000 ; i++ )
{
- pObj = (CObject*)m_iMan->SearchInstance(CLASS_OBJECT, i);
+ pObj = static_cast<CObject*>(m_iMan->SearchInstance(CLASS_OBJECT, i));
if ( pObj == 0 ) break;
- if ( type == pObj->RetType() )
+ if ( type == pObj->GetType() )
{
pObj->DeleteObject(); // removes the mark
delete pObj;
diff --git a/src/object/task/tasksearch.h b/src/object/task/tasksearch.h
index 304473d..bffec16 100644
--- a/src/object/task/tasksearch.h
+++ b/src/object/task/tasksearch.h
@@ -62,7 +62,7 @@ protected:
float m_progress;
float m_speed;
float m_time;
- float m_lastParticule;
+ float m_lastParticle;
float m_initialAngle[3];
float m_finalAngle[3];
bool m_bError;
diff --git a/src/object/task/taskshield.cpp b/src/object/task/taskshield.cpp
index aa62f7b..682bcb1 100644
--- a/src/object/task/taskshield.cpp
+++ b/src/object/task/taskshield.cpp
@@ -16,18 +16,17 @@
// taskshield.cpp
-
-#include <stdio.h>
-
#include "object/task/taskshield.h"
#include "common/iman.h"
-#include "old/light.h"
-#include "old/particule.h"
+#include "graphics/core/light.h"
+#include "graphics/engine/particle.h"
+#include "graphics/engine/lightman.h"
#include "math/geometry.h"
#include "object/brain.h"
#include "physics/physics.h"
+#include <string.h>
const float ENERGY_TIME = 20.0f; // maximum duration if full battery
@@ -56,32 +55,32 @@ CTaskShield::~CTaskShield()
bool CTaskShield::EventProcess(const Event &event)
{
CObject* power;
- Math::Matrix* mat;
- Math::Matrix matrix;
- Math::Vector pos, speed, goal, angle;
- D3DCOLORVALUE color;
- Math::Point dim;
+ Math::Matrix* mat;
+ Math::Matrix matrix;
+ Math::Vector pos, speed, goal, angle;
+ Gfx::Color color;
+ Math::Point dim;
float energy;
- if ( m_engine->RetPause() ) return true;
- if ( event.event != EVENT_FRAME ) return true;
+ if ( m_engine->GetPause() ) return true;
+ if ( event.type != EVENT_FRAME ) return true;
if ( m_bError ) return false;
m_progress += event.rTime*m_speed; // others advance
m_time += event.rTime;
m_delay -= event.rTime;
- mat = m_object->RetWorldMatrix(0);
+ mat = m_object->GetWorldMatrix(0);
pos = Math::Vector(7.0f, 15.0f, 0.0f);
pos = Math::Transform(*mat, pos); // sphere position
m_shieldPos = pos;
if ( m_rankSphere != -1 )
{
- m_particule->SetPosition(m_rankSphere, m_shieldPos);
- dim.x = RetRadius();
+ m_particle->SetPosition(m_rankSphere, m_shieldPos);
+ dim.x = GetRadius();
dim.y = dim.x;
- m_particule->SetDimension(m_rankSphere, dim);
+ m_particle->SetDimension(m_rankSphere, dim);
}
if ( m_phase == TS_UP1 )
@@ -103,11 +102,11 @@ bool CTaskShield::EventProcess(const Event &event)
if ( m_phase == TS_SHIELD )
{
energy = (1.0f/ENERGY_TIME)*event.rTime;
- energy *= RetRadius()/RADIUS_SHIELD_MAX;
- power = m_object->RetPower();
+ energy *= GetRadius()/RADIUS_SHIELD_MAX;
+ power = m_object->GetPower();
if ( power != 0 )
{
- power->SetEnergy(power->RetEnergy()-energy/power->RetCapacity());
+ power->SetEnergy(power->GetEnergy()-energy/power->GetCapacity());
}
m_energyUsed += energy;
@@ -123,25 +122,25 @@ bool CTaskShield::EventProcess(const Event &event)
}
pos = m_shieldPos;
- pos.y += RetRadius()*(2.0f+sinf(m_time*9.0f)*0.2f);
+ pos.y += GetRadius()*(2.0f+sinf(m_time*9.0f)*0.2f);
if ( m_effectLight == -1 )
{
CreateLight(pos);
}
else
{
- m_light->SetLightPos(m_effectLight, pos);
+ m_lightMan->SetLightPos(m_effectLight, pos);
color.r = 0.0f+sinf(m_time*33.2f)*0.2f;
color.g = 0.5f+sinf(m_time*20.0f)*0.5f;
color.b = 0.5f+sinf(m_time*21.3f)*1.0f;
color.a = 0.0f;
- m_light->SetLightColor(m_effectLight, color);
+ m_lightMan->SetLightColor(m_effectLight, color);
}
- if ( m_lastParticule+m_engine->ParticuleAdapt(0.05f) <= m_time )
+ if ( m_lastParticle+m_engine->ParticleAdapt(0.05f) <= m_time )
{
- m_lastParticule = m_time;
+ m_lastParticle = m_time;
pos = m_shieldPos;
pos.x += (Math::Rand()-0.5f)*5.0f;
@@ -151,23 +150,23 @@ bool CTaskShield::EventProcess(const Event &event)
speed.y = Math::Rand()*15.0f;
dim.x = Math::Rand()*6.0f+4.0f;
dim.y = dim.x;
- m_particule->CreateParticule(pos, speed, dim, PARTIBLUE, 1.0f, 0.0f, 0.0f);
+ m_particle->CreateParticle(pos, speed, dim, Gfx::PARTIBLUE, 1.0f, 0.0f, 0.0f);
}
- if ( m_lastRay+m_engine->ParticuleAdapt(0.05f) <= m_time )
+ if ( m_lastRay+m_engine->ParticleAdapt(0.05f) <= m_time )
{
m_lastRay = m_time;
pos = m_shieldPos;
- dim.x = RetRadius()/20.0f;
+ dim.x = GetRadius()/20.0f;
dim.y = dim.x;
angle.x = (Math::Rand()-0.5f)*Math::PI*1.2f;
angle.y = 0.0f;
angle.z = (Math::Rand()-0.5f)*Math::PI*1.2f;
Math::LoadRotationXZYMatrix(matrix, angle);
- goal = Math::Transform(matrix, Math::Vector(0.0f, RetRadius()-dim.x, 0.0f));
+ goal = Math::Transform(matrix, Math::Vector(0.0f, GetRadius()-dim.x, 0.0f));
goal += pos;
- m_particule->CreateRay(pos, goal, PARTIRAY2, dim, 0.3f);
+ m_particle->CreateRay(pos, goal, Gfx::PARTIRAY2, dim, 0.3f);
}
if ( m_lastIncrease+0.2f <= m_time )
@@ -186,9 +185,9 @@ bool CTaskShield::EventProcess(const Event &event)
m_soundChannel = -1;
}
- if ( m_lastParticule+m_engine->ParticuleAdapt(0.05f) <= m_time )
+ if ( m_lastParticle+m_engine->ParticleAdapt(0.05f) <= m_time )
{
- m_lastParticule = m_time;
+ m_lastParticle = m_time;
pos = m_shieldPos;
pos.x += (Math::Rand()-0.5f)*5.0f;
@@ -198,7 +197,7 @@ bool CTaskShield::EventProcess(const Event &event)
speed.y = (Math::Rand()-0.5f)*3.0f;
dim.x = Math::Rand()*1.5f+2.0f;
dim.y = dim.x;
- m_particule->CreateParticule(pos, speed, dim, PARTISMOKE3, 4.0f);
+ m_particle->CreateParticle(pos, speed, dim, Gfx::PARTISMOKE3, 4.0f);
}
}
@@ -240,25 +239,25 @@ Error CTaskShield::Start(TaskShieldMode mode, float delay)
if ( mode == TSM_UPDATE )
{
- if ( m_object->RetSelect() )
+ if ( m_object->GetSelect() )
{
m_brain->UpdateInterface();
}
return ERR_OK;
}
- type = m_object->RetType();
+ type = m_object->GetType();
if ( type != OBJECT_MOBILErs ) return ERR_SHIELD_VEH;
m_bError = true; // operation impossible
- if ( !m_physics->RetLand() ) return ERR_SHIELD_VEH;
+ if ( !m_physics->GetLand() ) return ERR_SHIELD_VEH;
- power = m_object->RetPower();
+ power = m_object->GetPower();
if ( power == 0 ) return ERR_SHIELD_ENERGY;
- energy = power->RetEnergy();
+ energy = power->GetEnergy();
if ( energy == 0.0f ) return ERR_SHIELD_ENERGY;
- mat = m_object->RetWorldMatrix(0);
+ mat = m_object->GetWorldMatrix(0);
pos = Math::Vector(7.0f, 15.0f, 0.0f);
pos = Transform(*mat, pos); // sphere position
m_shieldPos = pos;
@@ -270,18 +269,18 @@ Error CTaskShield::Start(TaskShieldMode mode, float delay)
m_speed = 1.0f/1.0f;
m_time = 0.0f;
m_delay = delay;
- m_lastParticule = 0.0f;
+ m_lastParticle = 0.0f;
m_lastRay = 0.0f;
m_lastIncrease = 0.0f;
m_energyUsed = 0.0f;
m_bError = false; // ok
- if ( m_object->RetSelect() )
+ if ( m_object->GetSelect() )
{
m_brain->UpdateInterface();
}
-//? m_camera->StartCentering(m_object, Math::PI*0.85f, -Math::PI*0.15f, RetRadius()+40.0f, 3.0f);
+//? m_camera->StartCentering(m_object, Math::PI*0.85f, -Math::PI*0.15f, GetRadius()+40.0f, 3.0f);
return ERR_OK;
}
@@ -297,13 +296,13 @@ Error CTaskShield::Stop()
if ( m_rankSphere != -1 )
{
- m_particule->SetPhase(m_rankSphere, PARPHEND, 3.0f);
+ m_particle->SetPhase(m_rankSphere, Gfx::PARPHEND, 3.0f);
m_rankSphere = -1;
}
if ( m_effectLight != -1 )
{
- m_light->DeleteLight(m_effectLight);
+ m_lightMan->DeleteLight(m_effectLight);
m_effectLight = -1;
}
@@ -316,7 +315,7 @@ Error CTaskShield::Stop()
m_camera->StopCentering(m_object, 4.0f);
- if ( m_object->RetSelect() )
+ if ( m_object->GetSelect() )
{
m_brain->UpdateInterface();
}
@@ -335,21 +334,21 @@ Error CTaskShield::IsEnded()
Math::Point dim;
float energy;
- if ( m_engine->RetPause() ) return ERR_CONTINUE;
+ if ( m_engine->GetPause() ) return ERR_CONTINUE;
if ( m_bError ) return ERR_STOP;
if ( m_phase == TS_SHIELD )
{
- m_object->SetShieldRadius(RetRadius());
+ m_object->SetShieldRadius(GetRadius());
- power = m_object->RetPower();
+ power = m_object->GetPower();
if ( power == 0 )
{
energy = 0.0f;
}
else
{
- energy = power->RetEnergy();
+ energy = power->GetEnergy();
}
if ( energy == 0.0f || m_delay <= 0.0f )
@@ -383,18 +382,18 @@ Error CTaskShield::IsEnded()
pos.z = 0.0f;
m_object->SetPosition(3, pos);
- m_object->SetShieldRadius(RetRadius());
+ m_object->SetShieldRadius(GetRadius());
pos = m_shieldPos;
speed = Math::Vector(0.0f, 0.0f, 0.0f);
- dim.x = RetRadius();
+ dim.x = GetRadius();
dim.y = dim.x;
- m_rankSphere = m_particule->CreateParticule(pos, speed, dim, PARTISPHERE3, 2.0f, 0.0f, 0.0f);
+ m_rankSphere = m_particle->CreateParticle(pos, speed, dim, Gfx::PARTISPHERE3, 2.0f, 0.0f, 0.0f);
m_phase = TS_SHIELD;
m_speed = 1.0f/999.9f;
- if ( m_object->RetSelect() )
+ if ( m_object->GetSelect() )
{
m_brain->UpdateInterface();
}
@@ -462,13 +461,13 @@ bool CTaskShield::Abort()
if ( m_rankSphere != -1 )
{
- m_particule->SetPhase(m_rankSphere, PARPHEND, 3.0f);
+ m_particle->SetPhase(m_rankSphere, Gfx::PARPHEND, 3.0f);
m_rankSphere = -1;
}
if ( m_effectLight != -1 )
{
- m_light->DeleteLight(m_effectLight);
+ m_lightMan->DeleteLight(m_effectLight);
m_effectLight = -1;
}
@@ -481,34 +480,32 @@ bool CTaskShield::Abort()
bool CTaskShield::CreateLight(Math::Vector pos)
{
- D3DLIGHT7 light;
-
- if ( !m_engine->RetLightMode() ) return true;
-
- ZeroMemory( &light, sizeof(light) );
- light.dltType = D3DLIGHT_SPOT;
- light.dcvDiffuse.r = 0.0f;
- light.dcvDiffuse.g = 1.0f;
- light.dcvDiffuse.b = 2.0f;
- light.dvPosition.x = pos.x;
- light.dvPosition.y = pos.y;
- light.dvPosition.z = pos.z;
- light.dvDirection.x = 0.0f;
- light.dvDirection.y = -1.0f; // against the bottom
- light.dvDirection.z = 0.0f;
- light.dvRange = D3DLIGHT_RANGE_MAX;
- light.dvFalloff = 1.0f;
- light.dvAttenuation0 = 1.0f;
- light.dvAttenuation1 = 0.0f;
- light.dvAttenuation2 = 0.0f;
- light.dvTheta = 0.0f;
- light.dvPhi = Math::PI/4.0f;
-
- m_effectLight = m_light->CreateLight();
+ Gfx::Light light;
+
+ if ( !m_engine->GetLightMode() ) return true;
+
+ memset(&light, 0, sizeof(light));
+ light.type = Gfx::LIGHT_SPOT;
+ light.diffuse.r = 0.0f;
+ light.diffuse.g = 1.0f;
+ light.diffuse.b = 2.0f;
+ light.position.x = pos.x;
+ light.position.y = pos.y;
+ light.position.z = pos.z;
+ light.direction.x = 0.0f;
+ light.direction.y = -1.0f; // against the bottom
+ light.direction.z = 0.0f;
+ light.spotIntensity = 128;
+ light.attenuation0 = 1.0f;
+ light.attenuation1 = 0.0f;
+ light.attenuation2 = 0.0f;
+ light.spotAngle = 90;
+
+ m_effectLight = m_lightMan->CreateLight();
if ( m_effectLight == -1 ) return false;
- m_light->SetLight(m_effectLight, light);
- m_light->SetLightIntensity(m_effectLight, 1.0f);
+ m_lightMan->SetLight(m_effectLight, light);
+ m_lightMan->SetLightIntensity(m_effectLight, 1.0f);
return true;
}
@@ -526,21 +523,21 @@ void CTaskShield::IncreaseShield()
for ( i=0 ; i<1000000 ; i++ )
{
- pObj = (CObject*)m_iMan->SearchInstance(CLASS_OBJECT, i);
+ pObj = static_cast<CObject*>(m_iMan->SearchInstance(CLASS_OBJECT, i));
if ( pObj == 0 ) break;
- type = pObj->RetType();
+ type = pObj->GetType();
if ( type == OBJECT_MOTHER ||
type == OBJECT_ANT ||
type == OBJECT_SPIDER ||
type == OBJECT_BEE ||
type == OBJECT_WORM ) continue;
- oPos = pObj->RetPosition(0);
+ oPos = pObj->GetPosition(0);
dist = Math::Distance(oPos, m_shieldPos);
- if ( dist <= RetRadius()+10.0f )
+ if ( dist <= GetRadius()+10.0f )
{
- shield = pObj->RetShield();
+ shield = pObj->GetShield();
shield += 0.1f;
if ( shield > 1.0f ) shield = 1.0f;
pObj->SetShield(shield);
@@ -551,9 +548,9 @@ void CTaskShield::IncreaseShield()
// Returns the radius of the shield.
-float CTaskShield::RetRadius()
+float CTaskShield::GetRadius()
{
- return RADIUS_SHIELD_MIN + (RADIUS_SHIELD_MAX-RADIUS_SHIELD_MIN)*m_object->RetParam();
+ return RADIUS_SHIELD_MIN + (RADIUS_SHIELD_MAX-RADIUS_SHIELD_MIN)*m_object->GetParam();
}
diff --git a/src/object/task/taskshield.h b/src/object/task/taskshield.h
index 5842ae0..4a6811c 100644
--- a/src/object/task/taskshield.h
+++ b/src/object/task/taskshield.h
@@ -63,7 +63,7 @@ protected:
Error Stop();
bool CreateLight(Math::Vector pos);
void IncreaseShield();
- float RetRadius();
+ float GetRadius();
protected:
TaskShieldPhase m_phase;
@@ -71,12 +71,12 @@ protected:
float m_speed;
float m_time;
float m_delay;
- float m_lastParticule;
+ float m_lastParticle;
float m_lastRay;
float m_lastIncrease;
float m_energyUsed;
bool m_bError;
- Math::Vector m_shieldPos;
+ Math::Vector m_shieldPos;
int m_rankSphere;
int m_soundChannel;
int m_effectLight;
diff --git a/src/object/task/taskspiderexplo.cpp b/src/object/task/taskspiderexplo.cpp
index fa505b1..8110870 100644
--- a/src/object/task/taskspiderexplo.cpp
+++ b/src/object/task/taskspiderexplo.cpp
@@ -16,12 +16,9 @@
// taskspiderexplo.cpp
-
-#include <stdio.h>
-
#include "object/task/taskspiderexplo.h"
-#include "old/pyro.h"
+#include "graphics/engine/pyro.h"
#include "object/motion/motionspider.h"
#include "physics/physics.h"
@@ -48,11 +45,11 @@ CTaskSpiderExplo::~CTaskSpiderExplo()
bool CTaskSpiderExplo::EventProcess(const Event &event)
{
- if ( m_engine->RetPause() ) return true;
- if ( event.event != EVENT_FRAME ) return true;
+ if ( m_engine->GetPause() ) return true;
+ if ( event.type != EVENT_FRAME ) return true;
// Momentarily stationary object (ant on the back)?
- if ( m_object->RetFixed() )
+ if ( m_object->GetFixed() )
{
m_bError = true;
return true;
@@ -82,9 +79,9 @@ Error CTaskSpiderExplo::Start()
Error CTaskSpiderExplo::IsEnded()
{
- CPyro* pyro;
+ Gfx::CPyro* pyro;
- if ( m_engine->RetPause() ) return ERR_CONTINUE;
+ if ( m_engine->GetPause() ) return ERR_CONTINUE;
if ( m_bError )
{
@@ -94,8 +91,8 @@ Error CTaskSpiderExplo::IsEnded()
if ( m_time < 1.0f ) return ERR_CONTINUE;
- pyro = new CPyro(m_iMan);
- pyro->Create(PT_SPIDER, m_object); // the spider explodes (suicide)
+ pyro = new Gfx::CPyro(m_iMan);
+ pyro->Create(Gfx::PT_SPIDER, m_object); // the spider explodes (suicide)
Abort();
return ERR_STOP;
diff --git a/src/object/task/tasktake.cpp b/src/object/task/tasktake.cpp
index 1a50f06..2737324 100644
--- a/src/object/task/tasktake.cpp
+++ b/src/object/task/tasktake.cpp
@@ -16,14 +16,11 @@
// tasktake.cpp
-
-#include <stdio.h>
-
#include "object/task/tasktake.h"
#include "common/iman.h"
-#include "old/terrain.h"
-#include "old/water.h"
+#include "graphics/engine/terrain.h"
+#include "graphics/engine/water.h"
#include "math/geometry.h"
#include "object/motion/motionhuman.h"
#include "object/robotmain.h"
@@ -37,7 +34,7 @@
CTaskTake::CTaskTake(CInstanceManager* iMan, CObject* object)
: CTask(iMan, object)
{
- m_terrain = (CTerrain*)m_iMan->SearchInstance(CLASS_TERRAIN);
+ m_terrain = static_cast<Gfx::CTerrain*>(m_iMan->SearchInstance(CLASS_TERRAIN));
m_arm = TTA_NEUTRAL;
}
@@ -55,13 +52,13 @@ bool CTaskTake::EventProcess(const Event &event)
{
float a, g, cirSpeed;
- if ( m_engine->RetPause() ) return true;
- if ( event.event != EVENT_FRAME ) return true;
+ if ( m_engine->GetPause() ) return true;
+ if ( event.type != EVENT_FRAME ) return true;
if ( m_bError ) return false;
if ( m_bTurn ) // preliminary rotation?
{
- a = m_object->RetAngleY(0);
+ a = m_object->GetAngleY(0);
g = m_angle;
cirSpeed = Math::Direction(a, g)*2.0f;
if ( cirSpeed > 1.0f ) cirSpeed = 1.0f;
@@ -92,26 +89,26 @@ Error CTaskTake::Start()
m_step = 0;
m_progress = 0.0f;
- iAngle = m_object->RetAngleY(0);
+ iAngle = m_object->GetAngleY(0);
iAngle = Math::NormAngle(iAngle); // 0..2*Math::PI
oAngle = iAngle;
m_bError = true; // operation impossible
- if ( !m_physics->RetLand() )
+ if ( !m_physics->GetLand() )
{
- pos = m_object->RetPosition(0);
- h = m_water->RetLevel(m_object);
+ pos = m_object->GetPosition(0);
+ h = m_water->GetLevel(m_object);
if ( pos.y < h ) return ERR_MANIP_WATER; // impossible under water
return ERR_MANIP_FLY;
}
- type = m_object->RetType();
+ type = m_object->GetType();
if ( type != OBJECT_HUMAN &&
type != OBJECT_TECH ) return ERR_MANIP_VEH;
m_physics->SetMotorSpeed(Math::Vector(0.0f, 0.0f, 0.0f));
- if ( m_object->RetFret() == 0 )
+ if ( m_object->GetFret() == 0 )
{
m_order = TTO_TAKE;
}
@@ -122,14 +119,14 @@ Error CTaskTake::Start()
if ( m_order == TTO_TAKE )
{
- pos = m_object->RetPosition(0);
- h = m_water->RetLevel(m_object);
+ pos = m_object->GetPosition(0);
+ h = m_water->GetLevel(m_object);
if ( pos.y < h ) return ERR_MANIP_WATER; // impossible under water
other = SearchFriendObject(oAngle, 1.5f, Math::PI*0.50f);
- if ( other != 0 && other->RetPower() != 0 )
+ if ( other != 0 && other->GetPower() != 0 )
{
- type = other->RetPower()->RetType();
+ type = other->GetPower()->GetType();
if ( type == OBJECT_URANIUM ) return ERR_MANIP_RADIO;
if ( type != OBJECT_FRET &&
type != OBJECT_STONE &&
@@ -150,7 +147,7 @@ Error CTaskTake::Start()
{
other = SearchTakeObject(oAngle, 1.5f, Math::PI*0.45f);
if ( other == 0 ) return ERR_MANIP_NIL;
- type = other->RetType();
+ type = other->GetType();
if ( type == OBJECT_URANIUM ) return ERR_MANIP_RADIO;
//? m_camera->StartCentering(m_object, Math::PI*0.3f, 99.9f, 0.0f, 0.8f);
m_arm = TTA_FFRONT;
@@ -160,12 +157,12 @@ Error CTaskTake::Start()
if ( m_order == TTO_DEPOSE )
{
-//? speed = m_physics->RetMotorSpeed();
+//? speed = m_physics->GetMotorSpeed();
//? if ( speed.x != 0.0f ||
//? speed.z != 0.0f ) return ERR_MANIP_MOTOR;
other = SearchFriendObject(oAngle, 1.5f, Math::PI*0.50f);
- if ( other != 0 && other->RetPower() == 0 )
+ if ( other != 0 && other->GetPower() == 0 )
{
//? m_camera->StartCentering(m_object, Math::PI*0.3f, -Math::PI*0.1f, 0.0f, 0.8f);
m_arm = TTA_FRIEND;
@@ -194,12 +191,12 @@ Error CTaskTake::IsEnded()
CObject* fret;
float angle;
- if ( m_engine->RetPause() ) return ERR_CONTINUE;
+ if ( m_engine->GetPause() ) return ERR_CONTINUE;
if ( m_bError ) return ERR_STOP;
if ( m_bTurn ) // preliminary rotation?
{
- angle = m_object->RetAngleY(0);
+ angle = m_object->GetAngleY(0);
angle = Math::NormAngle(angle); // 0..2*Math::PI
if ( Math::TestAngle(angle, m_angle-Math::PI*0.01f, m_angle+Math::PI*0.01f) )
@@ -243,7 +240,7 @@ Error CTaskTake::IsEnded()
(m_fretType == OBJECT_POWER ||
m_fretType == OBJECT_ATOMIC ) )
{
- m_sound->Play(SOUND_POWEROFF, m_object->RetPosition(0));
+ m_sound->Play(SOUND_POWEROFF, m_object->GetPosition(0));
}
}
m_motion->SetAction(MHS_UPRIGHT, 0.4f); // gets up
@@ -258,13 +255,13 @@ Error CTaskTake::IsEnded()
{
if ( m_step == 1 )
{
- fret = m_object->RetFret();
+ fret = m_object->GetFret();
TruckDeposeObject();
if ( m_arm == TTA_FRIEND &&
(m_fretType == OBJECT_POWER ||
m_fretType == OBJECT_ATOMIC ) )
{
- m_sound->Play(SOUND_POWERON, m_object->RetPosition(0));
+ m_sound->Play(SOUND_POWERON, m_object->GetPosition(0));
}
if ( fret != 0 && m_fretType == OBJECT_METAL && m_arm == TTA_FFRONT )
{
@@ -304,8 +301,8 @@ CObject* CTaskTake::SearchTakeObject(float &angle,
float min, iAngle, bAngle, a, distance;
int i;
- iPos = m_object->RetPosition(0);
- iAngle = m_object->RetAngleY(0);
+ iPos = m_object->GetPosition(0);
+ iAngle = m_object->GetAngleY(0);
iAngle = Math::NormAngle(iAngle); // 0..2*Math::PI
min = 1000000.0f;
@@ -313,10 +310,10 @@ CObject* CTaskTake::SearchTakeObject(float &angle,
bAngle = 0.0f;
for ( i=0 ; i<1000000 ; i++ )
{
- pObj = (CObject*)m_iMan->SearchInstance(CLASS_OBJECT, i);
+ pObj = static_cast<CObject*>(m_iMan->SearchInstance(CLASS_OBJECT, i));
if ( pObj == 0 ) break;
- type = pObj->RetType();
+ type = pObj->GetType();
if ( type != OBJECT_FRET &&
type != OBJECT_STONE &&
@@ -332,11 +329,11 @@ CObject* CTaskTake::SearchTakeObject(float &angle,
type != OBJECT_KEYd &&
type != OBJECT_TNT ) continue;
- if ( pObj->RetTruck() != 0 ) continue; // object transported?
- if ( pObj->RetLock() ) continue;
- if ( pObj->RetZoomY(0) != 1.0f ) continue;
+ if ( pObj->GetTruck() != 0 ) continue; // object transported?
+ if ( pObj->GetLock() ) continue;
+ if ( pObj->GetZoomY(0) != 1.0f ) continue;
- oPos = pObj->RetPosition(0);
+ oPos = pObj->GetPosition(0);
distance = Math::Distance(oPos, iPos);
if ( distance >= 4.0f-dLimit &&
distance <= 4.0f+dLimit )
@@ -374,17 +371,17 @@ CObject* CTaskTake::SearchFriendObject(float &angle,
int i;
if ( !m_object->GetCrashSphere(0, iPos, iRad) ) return 0;
- iAngle = m_object->RetAngleY(0);
+ iAngle = m_object->GetAngleY(0);
iAngle = Math::NormAngle(iAngle); // 0..2*Math::PI
for ( i=0 ; i<1000000 ; i++ )
{
- pObj = (CObject*)m_iMan->SearchInstance(CLASS_OBJECT, i);
+ pObj = static_cast<CObject*>(m_iMan->SearchInstance(CLASS_OBJECT, i));
if ( pObj == 0 ) break;
if ( pObj == m_object ) continue; // yourself?
- type = pObj->RetType();
+ type = pObj->GetType();
if ( type != OBJECT_MOBILEfa &&
type != OBJECT_MOBILEta &&
type != OBJECT_MOBILEwa &&
@@ -417,19 +414,19 @@ CObject* CTaskTake::SearchFriendObject(float &angle,
type != OBJECT_LABO &&
type != OBJECT_NUCLEAR ) continue;
- pPower = pObj->RetPower();
+ pPower = pObj->GetPower();
if ( pPower != 0 )
{
- if ( pPower->RetLock() ) continue;
- if ( pPower->RetZoomY(0) != 1.0f ) continue;
+ if ( pPower->GetLock() ) continue;
+ if ( pPower->GetZoomY(0) != 1.0f ) continue;
- powerType = pPower->RetType();
+ powerType = pPower->GetType();
if ( powerType == OBJECT_NULL ||
powerType == OBJECT_FIX ) continue;
}
- mat = pObj->RetWorldMatrix(0);
- character = pObj->RetCharacter();
+ mat = pObj->GetWorldMatrix(0);
+ character = pObj->GetCharacter();
oPos = Transform(*mat, character->posPower);
distance = fabs(Math::Distance(oPos, iPos) - (iRad+1.0f));
@@ -438,7 +435,7 @@ CObject* CTaskTake::SearchFriendObject(float &angle,
angle = Math::RotateAngle(oPos.x-iPos.x, iPos.z-oPos.z); // CW !
if ( Math::TestAngle(angle, iAngle-aLimit, iAngle+aLimit) )
{
- character = pObj->RetCharacter();
+ character = pObj->GetCharacter();
m_height = character->posPower.y;
return pObj;
}
@@ -452,17 +449,17 @@ CObject* CTaskTake::SearchFriendObject(float &angle,
bool CTaskTake::TruckTakeObject()
{
- CObject* fret;
- CObject* other;
- Math::Matrix matRotate;
- float angle;
+ CObject* fret;
+ CObject* other;
+ Math::Matrix matRotate;
+ float angle;
if ( m_arm == TTA_FFRONT ) // takes on the ground in front?
{
//? fret = SearchTakeObject(angle, 1.5f, Math::PI*0.04f);
fret = SearchTakeObject(angle, 1.5f, Math::PI*0.15f); //OK 1.9
if ( fret == 0 ) return false; // rien � prendre ?
- m_fretType = fret->RetType();
+ m_fretType = fret->GetType();
fret->SetTruck(m_object);
fret->SetTruckPart(4); // takes with the hand
@@ -481,9 +478,9 @@ bool CTaskTake::TruckTakeObject()
other = SearchFriendObject(angle, 1.5f, Math::PI*0.04f);
if ( other == 0 ) return false;
- fret = other->RetPower();
+ fret = other->GetPower();
if ( fret == 0 ) return false; // the other does not have a battery?
- m_fretType = fret->RetType();
+ m_fretType = fret->GetType();
other->SetPower(0);
fret->SetTruck(m_object);
@@ -514,15 +511,15 @@ bool CTaskTake::TruckDeposeObject()
if ( m_arm == TTA_FFRONT ) // deposes on the ground in front?
{
- fret = m_object->RetFret();
+ fret = m_object->GetFret();
if ( fret == 0 ) return false; // does nothing?
- m_fretType = fret->RetType();
+ m_fretType = fret->GetType();
- mat = fret->RetWorldMatrix(0);
+ mat = fret->GetWorldMatrix(0);
pos = Transform(*mat, Math::Vector(-0.5f, 1.0f, 0.0f));
- m_terrain->MoveOnFloor(pos);
+ m_terrain->AdjustToFloor(pos);
fret->SetPosition(0, pos);
- fret->SetAngleY(0, m_object->RetAngleY(0)+Math::PI/2.0f);
+ fret->SetAngleY(0, m_object->GetAngleY(0)+Math::PI/2.0f);
fret->SetAngleX(0, 0.0f);
fret->SetAngleZ(0, 0.0f);
fret->FloorAdjust(); // plate well on the ground
@@ -536,17 +533,17 @@ bool CTaskTake::TruckDeposeObject()
other = SearchFriendObject(angle, 1.5f, Math::PI*0.04f);
if ( other == 0 ) return false;
- fret = other->RetPower();
+ fret = other->GetPower();
if ( fret != 0 ) return false; // the other already has a battery?
- fret = m_object->RetFret();
+ fret = m_object->GetFret();
if ( fret == 0 ) return false;
- m_fretType = fret->RetType();
+ m_fretType = fret->GetType();
other->SetPower(fret);
fret->SetTruck(other);
- character = other->RetCharacter();
+ character = other->GetCharacter();
fret->SetPosition(0, character->posPower);
fret->SetAngleY(0, 0.0f);
fret->SetAngleX(0, 0.0f);
@@ -569,17 +566,17 @@ bool CTaskTake::IsFreeDeposeObject(Math::Vector pos)
float oRadius;
int i, j;
- mat = m_object->RetWorldMatrix(0);
+ mat = m_object->GetWorldMatrix(0);
iPos = Transform(*mat, pos);
for ( i=0 ; i<1000000 ; i++ )
{
- pObj = (CObject*)m_iMan->SearchInstance(CLASS_OBJECT, i);
+ pObj = static_cast<CObject*>(m_iMan->SearchInstance(CLASS_OBJECT, i));
if ( pObj == 0 ) break;
if ( pObj == m_object ) continue;
- if ( !pObj->RetActif() ) continue; // inactive?
- if ( pObj->RetTruck() != 0 ) continue; // object transported?
+ if ( !pObj->GetActif() ) continue; // inactive?
+ if ( pObj->GetTruck() != 0 ) continue; // object transported?
j = 0;
while ( pObj->GetCrashSphere(j++, oPos, oRadius) )
diff --git a/src/object/task/tasktake.h b/src/object/task/tasktake.h
index b0553a0..c7950fe 100644
--- a/src/object/task/tasktake.h
+++ b/src/object/task/tasktake.h
@@ -59,7 +59,8 @@ protected:
bool IsFreeDeposeObject(Math::Vector pos);
protected:
- CTerrain* m_terrain;
+ //TODO this is same member as in base class, probable should be deleted
+ Gfx::CTerrain* m_terrain;
TaskTakeOrder m_order;
TaskTakeArm m_arm;
diff --git a/src/object/task/taskterraform.cpp b/src/object/task/taskterraform.cpp
index 3a16008..6afece4 100644
--- a/src/object/task/taskterraform.cpp
+++ b/src/object/task/taskterraform.cpp
@@ -23,10 +23,10 @@
#include "math/geometry.h"
#include "common/iman.h"
-#include "old/particule.h"
-#include "old/terrain.h"
+#include "graphics/engine/pyro.h"
+#include "graphics/engine/particle.h"
+#include "graphics/engine/terrain.h"
#include "physics/physics.h"
-#include "old/pyro.h"
#include "object/brain.h"
#include "object/motion/motionant.h"
#include "object/motion/motionspider.h"
@@ -42,7 +42,7 @@ const float ACTION_RADIUS = 400.0f;
CTaskTerraform::CTaskTerraform(CInstanceManager* iMan, CObject* object)
: CTask(iMan, object)
{
- m_lastParticule = 0.0f;
+ m_lastParticle = 0.0f;
m_soundChannel = -1;
}
@@ -63,8 +63,8 @@ bool CTaskTerraform::EventProcess(const Event &event)
Math::Point dim;
float energy;
- if ( m_engine->RetPause() ) return true;
- if ( event.event != EVENT_FRAME ) return true;
+ if ( m_engine->GetPause() ) return true;
+ if ( event.type != EVENT_FRAME ) return true;
if ( m_bError ) return false;
m_progress += event.rTime*m_speed; // others advance
@@ -75,11 +75,11 @@ bool CTaskTerraform::EventProcess(const Event &event)
if ( m_soundChannel == -1 )
{
#if _TEEN
- m_soundChannel = m_sound->Play(SOUND_GGG, m_object->RetPosition(0), 1.0f, 0.5f, true);
+ m_soundChannel = m_sound->Play(SOUND_GGG, m_object->GetPosition(0), 1.0f, 0.5f, true);
m_sound->AddEnvelope(m_soundChannel, 1.0f, 2.0f, 1.5f, SOPER_CONTINUE);
m_sound->AddEnvelope(m_soundChannel, 0.0f, 0.5f, 0.5f, SOPER_STOP);
#else
- m_soundChannel = m_sound->Play(SOUND_GGG, m_object->RetPosition(0), 1.0f, 0.5f, true);
+ m_soundChannel = m_sound->Play(SOUND_GGG, m_object->GetPosition(0), 1.0f, 0.5f, true);
m_sound->AddEnvelope(m_soundChannel, 1.0f, 2.0f, 4.0f, SOPER_CONTINUE);
m_sound->AddEnvelope(m_soundChannel, 0.0f, 0.5f, 0.5f, SOPER_STOP);
#endif
@@ -92,13 +92,13 @@ bool CTaskTerraform::EventProcess(const Event &event)
m_object->SetZoom(0, 1.0f+m_progress*0.2f);
- power = m_object->RetPower();
+ power = m_object->GetPower();
if ( power != 0 )
{
power->SetZoom(0, 1.0f+m_progress*1.0f);
- energy = power->RetEnergy();
- energy -= event.rTime*ENERGY_TERRA/power->RetCapacity()/4.0f;
+ energy = power->GetEnergy();
+ energy -= event.rTime*ENERGY_TERRA/power->GetCapacity()/4.0f;
if ( energy < 0.0f ) energy = 0.0f;
power->SetEnergy(energy);
}
@@ -131,18 +131,18 @@ bool CTaskTerraform::EventProcess(const Event &event)
dir.x = 0.0f;
dir.y = 0.0f;
dir.z = 0.0f;
- pos = m_object->RetPosition(2);
+ pos = m_object->GetPosition(2);
if ( pos.y < 0.0f )
{
dir.z = -atanf((pos.y/2.0f)/9.0f);
}
m_object->SetInclinaison(dir);
- if ( m_time-m_lastParticule >= m_engine->ParticuleAdapt(0.05f) )
+ if ( m_time-m_lastParticle >= m_engine->ParticleAdapt(0.05f) )
{
- m_lastParticule = m_time;
+ m_lastParticle = m_time;
- mat = m_object->RetWorldMatrix(0);
+ mat = m_object->GetWorldMatrix(0);
if ( m_phase == TTP_CHARGE )
{
@@ -156,7 +156,7 @@ bool CTaskTerraform::EventProcess(const Event &event)
speed.y = 6.0f+Math::Rand()*4.0f*(1.0f+m_progress*2.0f);
dim.x = 0.5f+1.5f*m_progress;
dim.y = dim.x;
- m_particule->CreateParticule(pos, speed, dim, PARTIBLITZ, 2.0f, 20.0f);
+ m_particle->CreateParticle(pos, speed, dim, Gfx::PARTIBLITZ, 2.0f, 20.0f);
}
if ( m_phase != TTP_CHARGE )
@@ -170,10 +170,10 @@ bool CTaskTerraform::EventProcess(const Event &event)
speed.z = Math::Rand()*2.0f;
speed.y = 2.5f+Math::Rand()*1.0f;
speed = Math::Transform(*mat, speed);
- speed -= m_object->RetPosition(0);
+ speed -= m_object->GetPosition(0);
dim.x = Math::Rand()*1.0f+1.0f;
dim.y = dim.x;
- m_particule->CreateParticule(pos, speed, dim, PARTISMOKE1, 3.0f);
+ m_particle->CreateParticle(pos, speed, dim, Gfx::PARTISMOKE1, 3.0f);
// Right grid.
pos = Math::Vector(-1.0f, 5.8f, -3.5f);
@@ -184,10 +184,10 @@ bool CTaskTerraform::EventProcess(const Event &event)
speed.z = -Math::Rand()*2.0f;
speed.y = 2.5f+Math::Rand()*1.0f;
speed = Math::Transform(*mat, speed);
- speed -= m_object->RetPosition(0);
+ speed -= m_object->GetPosition(0);
dim.x = Math::Rand()*1.0f+1.0f;
dim.y = dim.x;
- m_particule->CreateParticule(pos, speed, dim, PARTISMOKE1, 3.0f);
+ m_particle->CreateParticle(pos, speed, dim, Gfx::PARTISMOKE1, 3.0f);
}
}
@@ -207,21 +207,21 @@ Error CTaskTerraform::Start()
ObjectType type;
m_bError = true; // operation impossible
- if ( !m_physics->RetLand() ) return ERR_TERRA_VEH;
+ if ( !m_physics->GetLand() ) return ERR_TERRA_VEH;
- type = m_object->RetType();
+ type = m_object->GetType();
if ( type != OBJECT_MOBILErt ) return ERR_TERRA_VEH;
- power = m_object->RetPower();
+ power = m_object->GetPower();
if ( power == 0 ) return ERR_TERRA_ENERGY;
- energy = power->RetEnergy();
- if ( energy < ENERGY_TERRA/power->RetCapacity()+0.05f ) return ERR_TERRA_ENERGY;
+ energy = power->GetEnergy();
+ if ( energy < ENERGY_TERRA/power->GetCapacity()+0.05f ) return ERR_TERRA_ENERGY;
- speed = m_physics->RetMotorSpeed();
+ speed = m_physics->GetMotorSpeed();
if ( speed.x != 0.0f ||
speed.z != 0.0f ) return ERR_MANIP_MOTOR;
- mat = m_object->RetWorldMatrix(0);
+ mat = m_object->GetWorldMatrix(0);
pos = Math::Vector(9.0f, 0.0f, 0.0f);
pos = Math::Transform(*mat, pos); // battery position
m_terraPos = pos;
@@ -251,7 +251,7 @@ Error CTaskTerraform::IsEnded()
float dist, duration;
int i, max;
- if ( m_engine->RetPause() ) return ERR_CONTINUE;
+ if ( m_engine->GetPause() ) return ERR_CONTINUE;
if ( m_bError ) return ERR_STOP;
if ( m_progress < 1.0f ) return ERR_CONTINUE;
@@ -277,24 +277,24 @@ Error CTaskTerraform::IsEnded()
m_object->SetCirVibration(Math::Vector(0.0f, 0.0f, 0.0f));
m_object->SetZoom(0, 1.0f);
- power = m_object->RetPower();
+ power = m_object->GetPower();
if ( power != 0 )
{
power->SetZoom(0, 1.0f);
}
- max= (int)(50.0f*m_engine->RetParticuleDensity());
+ max= static_cast<int>(50.0f*m_engine->GetParticleDensity());
for ( i=0 ; i<max ; i++ )
{
pos.x = m_terraPos.x+(Math::Rand()-0.5f)*80.0f;
pos.z = m_terraPos.z+(Math::Rand()-0.5f)*80.0f;
pos.y = m_terraPos.y;
- m_terrain->MoveOnFloor(pos);
+ m_terrain->AdjustToFloor(pos);
dist = Math::Distance(pos, m_terraPos);
speed = Math::Vector(0.0f, 0.0f, 0.0f);
dim.x = 2.0f+(40.0f-dist)/(1.0f+Math::Rand()*4.0f);
dim.y = dim.x;
- m_particule->CreateParticule(pos, speed, dim, PARTICRASH, 2.0f);
+ m_particle->CreateParticle(pos, speed, dim, Gfx::PARTICRASH, 2.0f);
pos = m_terraPos;
speed.x = (Math::Rand()-0.5f)*40.0f;
@@ -304,7 +304,7 @@ Error CTaskTerraform::IsEnded()
dim.y = dim.x;
pos.y += dim.y;
duration = Math::Rand()*3.0f+3.0f;
- m_particule->CreateTrack(pos, speed, dim, PARTITRACK5,
+ m_particle->CreateTrack(pos, speed, dim, Gfx::PARTITRACK5,
duration, Math::Rand()*10.0f+15.0f,
duration*0.2f, 1.0f);
}
@@ -343,7 +343,7 @@ bool CTaskTerraform::Abort()
m_object->SetCirVibration(Math::Vector(0.0f, 0.0f, 0.0f));
m_object->SetZoom(0, 1.0f);
- power = m_object->RetPower();
+ power = m_object->GetPower();
if ( power != 0 )
{
power->SetZoom(0, 1.0f);
@@ -361,49 +361,49 @@ bool CTaskTerraform::Terraform()
CObject* pObj;
CBrain* brain;
CMotion* motion;
- CPyro* pyro;
+ Gfx::CPyro* pyro;
ObjectType type;
float dist;
int i;
- m_camera->StartEffect(CE_TERRAFORM, m_terraPos, 1.0f);
+ m_camera->StartEffect(Gfx::CAM_EFFECT_TERRAFORM, m_terraPos, 1.0f);
m_sound->Play(SOUND_THUMP, m_terraPos);
for ( i=0 ; i<1000000 ; i++ )
{
- pObj = (CObject*)m_iMan->SearchInstance(CLASS_OBJECT, i);
+ pObj = static_cast<CObject*>(m_iMan->SearchInstance(CLASS_OBJECT, i));
if ( pObj == 0 ) break;
- type = pObj->RetType();
+ type = pObj->GetType();
if ( type == OBJECT_NULL ) continue;
if ( type == OBJECT_TEEN34 ) // stone?
{
- dist = Math::Distance(m_terraPos, pObj->RetPosition(0));
+ dist = Math::Distance(m_terraPos, pObj->GetPosition(0));
if ( dist > 20.0f ) continue;
- pyro = new CPyro(m_iMan);
- pyro->Create(PT_FRAGT, pObj);
+ pyro = new Gfx::CPyro(m_iMan);
+ pyro->Create(Gfx::PT_FRAGT, pObj);
}
else
{
- motion = pObj->RetMotion();
+ motion = pObj->GetMotion();
if ( motion == 0 ) continue;
- dist = Math::Distance(m_terraPos, pObj->RetPosition(0));
+ dist = Math::Distance(m_terraPos, pObj->GetPosition(0));
if ( dist > ACTION_RADIUS ) continue;
if ( type == OBJECT_ANT )
{
- brain = pObj->RetBrain();
+ brain = pObj->GetBrain();
if ( brain != 0 ) brain->StopTask();
motion->SetAction(MAS_BACK1, 0.8f+Math::Rand()*0.3f);
pObj->SetFixed(true); // not moving
}
if ( type == OBJECT_SPIDER )
{
- brain = pObj->RetBrain();
+ brain = pObj->GetBrain();
if ( brain != 0 ) brain->StopTask();
motion->SetAction(MSS_BACK1, 0.8f+Math::Rand()*0.3f);
pObj->SetFixed(true); // not moving
diff --git a/src/object/task/taskterraform.h b/src/object/task/taskterraform.h
index 5c9c114..91526b6 100644
--- a/src/object/task/taskterraform.h
+++ b/src/object/task/taskterraform.h
@@ -54,9 +54,9 @@ protected:
float m_progress;
float m_speed;
float m_time;
- float m_lastParticule;
+ float m_lastParticle;
int m_soundChannel;
bool m_bError;
- Math::Vector m_terraPos;
+ Math::Vector m_terraPos;
};
diff --git a/src/object/task/taskturn.cpp b/src/object/task/taskturn.cpp
index f8bf26c..8f4bbd2 100644
--- a/src/object/task/taskturn.cpp
+++ b/src/object/task/taskturn.cpp
@@ -16,12 +16,9 @@
// taskturn.cpp
-
-#include <stdio.h>
-
#include "object/task/taskturn.h"
-#include "old/terrain.h"
+#include "graphics/engine/terrain.h"
#include "physics/physics.h"
@@ -45,11 +42,11 @@ CTaskTurn::~CTaskTurn()
bool CTaskTurn::EventProcess(const Event &event)
{
- if ( m_engine->RetPause() ) return true;
- if ( event.event != EVENT_FRAME ) return true;
+ if ( m_engine->GetPause() ) return true;
+ if ( event.type != EVENT_FRAME ) return true;
// Momentarily stationary object (ant on the back)?
- if ( m_object->RetFixed() )
+ if ( m_object->GetFixed() )
{
m_physics->SetMotorSpeedX(0.0f); // stops the advance
m_physics->SetMotorSpeedZ(0.0f); // stops the rotation
@@ -66,18 +63,18 @@ bool CTaskTurn::EventProcess(const Event &event)
Error CTaskTurn::Start(float angle)
{
- m_startAngle = m_object->RetAngleY(0);
+ m_startAngle = m_object->GetAngleY(0);
m_finalAngle = m_startAngle+angle;
if ( angle < 0.0f )
{
- m_angle = angle+m_physics->RetCirStopLength();
+ m_angle = angle+m_physics->GetCirStopLength();
m_physics->SetMotorSpeedZ(-1.0f); // turns left
m_bLeft = true;
}
else
{
- m_angle = angle-m_physics->RetCirStopLength();
+ m_angle = angle-m_physics->GetCirStopLength();
m_physics->SetMotorSpeedZ(1.0f); // turns right
m_bLeft = false;
}
@@ -94,14 +91,14 @@ Error CTaskTurn::IsEnded()
{
float angle;
- if ( m_engine->RetPause() ) return ERR_CONTINUE;
+ if ( m_engine->GetPause() ) return ERR_CONTINUE;
if ( m_bError )
{
return ERR_STOP;
}
- angle = m_object->RetAngleY(0);
+ angle = m_object->GetAngleY(0);
if ( m_bLeft )
{
diff --git a/src/object/task/taskwait.cpp b/src/object/task/taskwait.cpp
index 03bddcb..f612c24 100644
--- a/src/object/task/taskwait.cpp
+++ b/src/object/task/taskwait.cpp
@@ -16,14 +16,9 @@
// taskwait.cpp
-
-#include <stdio.h>
-
#include "object/task/taskwait.h"
-#include "old/d3dengine.h"
-
-
+#include "graphics/engine/engine.h"
// Object's constructor.
@@ -43,8 +38,8 @@ CTaskWait::~CTaskWait()
bool CTaskWait::EventProcess(const Event &event)
{
- if ( m_engine->RetPause() ) return true;
- if ( event.event != EVENT_FRAME ) return true;
+ if ( m_engine->GetPause() ) return true;
+ if ( event.type != EVENT_FRAME ) return true;
m_passTime += event.rTime;
m_bEnded = (m_passTime >= m_waitTime);
@@ -66,7 +61,7 @@ Error CTaskWait::Start(float time)
Error CTaskWait::IsEnded()
{
- if ( m_engine->RetPause() ) return ERR_CONTINUE;
+ if ( m_engine->GetPause() ) return ERR_CONTINUE;
if ( m_bEnded ) return ERR_STOP;
return ERR_CONTINUE;
}