summaryrefslogtreecommitdiffstats
path: root/src/object
diff options
context:
space:
mode:
authorMichał Konopacki <konopacki.m@gmail.com>2012-09-15 16:54:35 +0200
committerMichał Konopacki <konopacki.m@gmail.com>2012-09-15 16:54:35 +0200
commit95d2f8da2c1df9a02fc1d668f2ce9c0b64c4bf65 (patch)
tree4bca38da7bc4983d47192adfcc3cc01407cfb776 /src/object
parentd439f4fa93eb45175dcdfa773af8f68efa1bad9d (diff)
parenta1400f496bbe9f78f71736dce43863b6833be669 (diff)
downloadcolobot-95d2f8da2c1df9a02fc1d668f2ce9c0b64c4bf65.tar.gz
colobot-95d2f8da2c1df9a02fc1d668f2ce9c0b64c4bf65.tar.bz2
colobot-95d2f8da2c1df9a02fc1d668f2ce9c0b64c4bf65.zip
Merge branch 'dev-object' into dev
Conflicts: src/object/robotmain.cpp src/object/robotmain.h
Diffstat (limited to 'src/object')
-rw-r--r--src/object/auto/auto.h4
-rw-r--r--src/object/auto/autobase.cpp23
-rw-r--r--src/object/auto/autoderrick.cpp2
-rw-r--r--src/object/auto/autonest.cpp2
-rw-r--r--src/object/brain.cpp387
-rw-r--r--src/object/brain.h38
-rw-r--r--src/object/mainmovie.cpp34
-rw-r--r--src/object/mainmovie.h17
-rw-r--r--src/object/motion/motion.cpp18
-rw-r--r--src/object/motion/motion.h66
-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.cpp312
-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.cpp350
-rw-r--r--src/object/motion/motionworm.cpp68
-rw-r--r--src/object/motion/motionworm.h4
-rw-r--r--src/object/robotmain.cpp4918
-rw-r--r--src/object/robotmain.h240
-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.cpp452
-rw-r--r--src/object/task/taskgungoal.cpp19
-rw-r--r--src/object/task/taskinfo.cpp55
-rw-r--r--src/object/task/taskinfo.h2
-rw-r--r--src/object/task/taskmanager.cpp42
-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.cpp170
-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
55 files changed, 4007 insertions, 5042 deletions
diff --git a/src/object/auto/auto.h b/src/object/auto/auto.h
index be7e66b..dd55904 100644
--- a/src/object/auto/auto.h
+++ b/src/object/auto/auto.h
@@ -95,8 +95,8 @@ protected:
Gfx::CLightManager* m_lightMan;
Gfx::CTerrain* m_terrain;
Gfx::CWater* m_water;
- Gfx::CCloud * m_cloud;
- Gfx::CPlanet * m_planet;
+ Gfx::CCloud* m_cloud;
+ Gfx::CPlanet* m_planet;
Gfx::CLightning* m_lightning;
Gfx::CCamera* m_camera;
Ui::CInterface* m_interface;
diff --git a/src/object/auto/autobase.cpp b/src/object/auto/autobase.cpp
index d5e8608..d196376 100644
--- a/src/object/auto/autobase.cpp
+++ b/src/object/auto/autobase.cpp
@@ -197,7 +197,7 @@ begin:
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;
@@ -335,7 +335,7 @@ begin:
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;
@@ -382,7 +382,7 @@ begin:
pos = m_pos;
pos.x -= 150.0f;
- m_terrain->MoveOnFloor(pos);
+ m_terrain->AdjustToFloor(pos);
pos.y += 10.0f;
m_camera->SetScriptEye(pos);
@@ -416,7 +416,7 @@ begin:
// Particles are ejected from the jet engine.
pos = m_object->GetPosition(0);
pos.y += 6.0f;
- h = m_terrain->GetFloorHeight(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);
@@ -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);
@@ -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);
@@ -785,7 +785,7 @@ 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);
@@ -1413,10 +1413,13 @@ void CAutoBase::BeginTransit()
m_engine->GetBackground(m_bgName, m_bgUp, m_bgDown, m_bgCloudUp, m_bgCloudDown, bFull, bQuarter);
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);
}
@@ -1433,7 +1436,7 @@ void CAutoBase::EndTransit()
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/autoderrick.cpp b/src/object/auto/autoderrick.cpp
index a560bc8..432c5ea 100644
--- a/src/object/auto/autoderrick.cpp
+++ b/src/object/auto/autoderrick.cpp
@@ -126,7 +126,7 @@ void CAutoDerrick::Init()
pos = Math::Vector(7.0f, 0.0f, 0.0f);
mat = m_object->GetWorldMatrix(0);
pos = Math::Transform(*mat, pos);
- m_terrain->MoveOnFloor(pos);
+ m_terrain->AdjustToFloor(pos);
m_fretPos = pos;
}
diff --git a/src/object/auto/autonest.cpp b/src/object/auto/autonest.cpp
index 9658e23..d7f94e1 100644
--- a/src/object/auto/autonest.cpp
+++ b/src/object/auto/autonest.cpp
@@ -76,7 +76,7 @@ void CAutoNest::Init()
m_lastParticle = 0.0f;
pos = m_object->GetPosition(0);
- m_terrain->MoveOnFloor(pos);
+ m_terrain->AdjustToFloor(pos);
m_fretPos = pos;
}
diff --git a/src/object/brain.cpp b/src/object/brain.cpp
index e322a3d..f32aea9 100644
--- a/src/object/brain.cpp
+++ b/src/object/brain.cpp
@@ -33,7 +33,8 @@
// #include "common/restext.h"
// #include "old/math3d.h"
// #include "object/robotmain.h"
-// #include "old/terrain.h"
+#include "graphics/core/color.h"
+#include "graphics/engine/terrain.h"
// #include "old/water.h"
// #include "old/camera.h"
// #include "object/object.h"
@@ -48,7 +49,7 @@
// #include "object/task/taskshield.h"
#include "script/script.h"
// #include "ui/studio.h"
-// #include "ui/interface.h"
+#include "ui/interface.h"
// #include "ui/button.h"
// #include "ui/color.h"
// #include "ui/edit.h"
@@ -86,11 +87,11 @@ CBrain::CBrain(CInstanceManager* iMan, CObject* object)
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<CInterface*>(m_iMan->SearchInstance(CLASS_INTERFACE));
- m_displayText = static_cast<CDisplayText*>(m_iMan->SearchInstance(CLASS_DISPLAYTEXT));
+ 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<CParticle*>(m_iMan->SearchInstance(CLASS_PARTICULE));
+ m_particle = static_cast<Gfx::CParticle*>(m_iMan->SearchInstance(CLASS_PARTICULE));
m_physics = 0;
m_motion = 0;
m_primaryTask = 0;
@@ -219,12 +220,12 @@ bool CBrain::EventProcess(const Event &event)
Ui::CWindow* pw;
Ui::CControl* pc;
Ui::CSlider* ps;
- Event action;
+ 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?
{
@@ -238,12 +239,12 @@ 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.param == m_engine->GetKey(KEYRANK_ACTION, 0) ||
+ event.param == m_engine->GetKey(KEYRANK_ACTION, 1) ) &&
+ !m_main->GetEditLock() )
{
- pw = (Ui::CWindow*)m_interface->SearchControl(EVENT_WINDOW0);
+ pw = static_cast< Ui::CWindow* >(m_interface->SearchControl(EVENT_WINDOW0));
if ( pw != 0 )
{
pc = pw->SearchControl(m_defaultEnter);
@@ -258,14 +259,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 )
@@ -274,7 +275,7 @@ bool CBrain::EventProcess(const Event &event)
}
// TODO uncoment when ui/studio will be implemented.
- if ( m_object->RetSelect() && // robot selected?
+ if ( m_object->GetSelect() && // robot selected?
/* m_studio != 0 */ ) // current issue?
{
// m_studio->EventProcess(event);
@@ -312,14 +313,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?
{
@@ -329,7 +330,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 ) )
@@ -352,13 +353,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;
}
@@ -379,7 +380,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;
}
@@ -403,8 +404,8 @@ bool CBrain::EventProcess(const Event &event)
axeY = event.axeY;
axeZ = event.axeZ;
- if ( !m_main->RetTrainerPilot() &&
- m_object->RetTrainer() ) // drive vehicle?
+ if ( !m_main->GetTrainerPilot() &&
+ m_object->GetTrainer() ) // drive vehicle?
{
axeX = 0.0f;
axeY = 0.0f;
@@ -418,7 +419,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;
@@ -430,7 +431,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;
@@ -440,13 +441,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 )
@@ -570,7 +571,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 )
@@ -595,26 +596,26 @@ bool CBrain::EventProcess(const Event &event)
if ( action == EVENT_OBJECT_DIMSHIELD )
{
- pw = (Ui::CWindow*)m_interface->SearchControl(EVENT_WINDOW0);
+ pw = static_cast< Ui::CWindow* >(m_interface->SearchControl(EVENT_WINDOW0));
if ( pw != 0 )
{
- ps = (Ui::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);
}
@@ -626,7 +627,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
@@ -691,7 +692,7 @@ bool CBrain::EventProcess(const Event &event)
TraceRecordStart();
}
UpdateInterface();
- pw = (Ui::CWindow*)m_interface->SearchControl(EVENT_WINDOW0);
+ pw = static_cast< Ui::CWindow* >(m_interface->SearchControl(EVENT_WINDOW0));
if ( pw != 0 )
{
UpdateScript(pw);
@@ -705,7 +706,7 @@ bool CBrain::EventProcess(const Event &event)
TraceRecordStop();
}
UpdateInterface();
- pw = (Ui::CWindow*)m_interface->SearchControl(EVENT_WINDOW0);
+ pw = static_cast< Ui::CWindow* >(m_interface->SearchControl(EVENT_WINDOW0));
if ( pw != 0 )
{
UpdateScript(pw);
@@ -723,8 +724,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;
@@ -736,8 +737,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;
@@ -766,7 +767,7 @@ 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));
}
// TODO uncoment when ui/studio will be implemented.
@@ -777,7 +778,7 @@ bool CBrain::EventFrame(const Event &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 ...
@@ -804,8 +805,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 )
@@ -842,7 +843,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()
{
@@ -879,7 +880,7 @@ void CBrain::SetActiveVirus(bool bActive)
}
}
-bool CBrain::RetActiveVirus()
+bool CBrain::GetActiveVirus()
{
return m_bActiveVirus;
}
@@ -1198,25 +1199,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_particle->CreateParticle(pos, speed, dim, PARTIGFLAT, 1.0f);
+ m_particle->CreateParticle(pos, speed, dim, Gfx::PARTIGFLAT, 1.0f);
}
@@ -1233,18 +1234,18 @@ void CBrain::ColorFlag(int color)
bool CBrain::CreateInterface(bool bSelect)
{
- ObjectType type;
- Ui::CWindow* pw;
- CButton* pb;
- CColor* pc;
- Ui::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 = (Ui::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
@@ -1257,17 +1258,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 = (Ui::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);
@@ -1278,7 +1279,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 ||
@@ -1346,7 +1347,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;
@@ -1369,7 +1370,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;
@@ -1390,7 +1391,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;
@@ -1505,19 +1506,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(GetColor(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(GetColor(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(GetColor(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(GetColor(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(GetColor(Gfx::Color(0.82f, 0.004f, 0.99f, 0.0f); //0x00d101fe
}
}
@@ -1525,7 +1526,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;
@@ -1534,7 +1535,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;
@@ -1547,7 +1548,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;
@@ -1556,7 +1557,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;
@@ -1590,7 +1591,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;
@@ -1604,7 +1605,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;
@@ -1627,35 +1628,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(GetColor(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(GetColor(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(GetColor(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(GetColor(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(GetColor(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(GetColor(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(GetColor(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(GetColor(Gfx::Color(0.53f, 0.27f, 0.0f, 0.0f)));//0x00884400));
pos.x = ox+sx*6.9f;
pos.y = oy+sy*1.2f;
@@ -1673,7 +1674,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;
@@ -1712,9 +1713,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;
@@ -1731,7 +1732,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;
@@ -1777,7 +1778,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);
}
@@ -1868,7 +1869,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(STATE_VISIBLE, m_main->GetShowMap());
}
}
#endif
@@ -1952,7 +1953,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 )
{
@@ -1963,21 +1964,21 @@ void CBrain::UpdateInterface(float rTime)
return;
}
- pw = (Ui::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
@@ -1998,19 +1999,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?
{
@@ -2019,7 +2020,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);
}
@@ -2038,13 +2039,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(STATE_VISIBLE, m_main->GetShowMap());
}
#if _TEEN
@@ -2062,16 +2063,16 @@ void CBrain::UpdateInterface(float rTime)
}
#endif
- bOnBoard = m_camera->RetType() == CAMERA_ONBOARD;
+ bOnBoard = m_camera->GetType() == CAMERA_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;
}
@@ -2082,11 +2083,11 @@ 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(STATE_VISIBLE, !m_main->GetFriendAim());
}
else
{
@@ -2094,7 +2095,7 @@ void CBrain::UpdateInterface(float rTime)
}
}
- ptg = (CTarget*)pw->SearchControl(EVENT_OBJECT_TARGET);
+ ptg = static_cast< Ui::CTarget* >(pw->SearchControl(EVENT_OBJECT_TARGET));
if ( ptg != 0 )
{
if ( bOnBoard )
@@ -2107,25 +2108,25 @@ void CBrain::UpdateInterface(float rTime)
}
}
- 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 = (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 = (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 = (CGroup*)pw->SearchControl(EVENT_OBJECT_CORNERdr);
+ pgr = static_cast< Ui::CGroup* >(pw->SearchControl(EVENT_OBJECT_CORNERdr));
if ( pgr != 0 )
{
pgr->SetState(STATE_VISIBLE, bOnBoard);
@@ -2138,7 +2139,7 @@ void CBrain::UpdateInterface()
{
ObjectType type;
Ui::CWindow* pw;
- CButton* pb;
+ Ui::CButton* pb;
Ui::CSlider* ps;
#if _TEEN
CColor* pc;
@@ -2147,12 +2148,12 @@ void CBrain::UpdateInterface()
bool bEnable, bFly, bRun;
char title[100];
- if ( !m_object->RetSelect() ) return;
+ if ( !m_object->GetSelect() ) return;
- pw = (Ui::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 );
@@ -2209,10 +2210,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(STATE_VISIBLE, m_engine->GetGroundSpot());
}
if ( type == OBJECT_HUMAN || // builder?
@@ -2242,21 +2243,21 @@ void CBrain::UpdateInterface()
DefaultEnter (pw, EVENT_OBJECT_ENDSHIELD, false);
}
- ps = (Ui::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);
@@ -2315,7 +2316,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
@@ -2341,51 +2342,51 @@ 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);
}
- 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 = (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 = (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 = (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 = (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 = (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 = (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 = (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);
@@ -2393,48 +2394,48 @@ void CBrain::UpdateInterface()
}
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);
}
- 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 = (CColor*)pw->SearchControl(EVENT_OBJECT_PEN2);
+ pc = static_cast< Ui::CColor* >(pw->SearchControl(EVENT_OBJECT_PEN2));
if ( pc != 0 )
{
pc->ClearState(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 = (CColor*)pw->SearchControl(EVENT_OBJECT_PEN4);
+ pc = static_cast< Ui::CColor* >(pw->SearchControl(EVENT_OBJECT_PEN4));
if ( pc != 0 )
{
pc->ClearState(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 = (CColor*)pw->SearchControl(EVENT_OBJECT_PEN6);
+ pc = static_cast< Ui::CColor* >(pw->SearchControl(EVENT_OBJECT_PEN6));
if ( pc != 0 )
{
pc->ClearState(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 = (CColor*)pw->SearchControl(EVENT_OBJECT_PEN8);
+ pc = static_cast< Ui::CColor* >(pw->SearchControl(EVENT_OBJECT_PEN8));
if ( pc != 0 )
{
pc->ClearState(STATE_CHECK);
@@ -2447,17 +2448,17 @@ void CBrain::UpdateInterface()
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
@@ -2491,20 +2492,20 @@ void CBrain::UpdateScript(Ui::CWindow *pw)
pl->ShowSelect(true);
}
-// Returns the rank of selected script.
+// Geturns the rank of selected script.
-int CBrain::RetSelScript()
+int CBrain::GetSelScript()
{
Ui::CWindow* pw;
- CList* pl;
+ Ui::CList* pl;
- pw = (Ui::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.
@@ -2512,14 +2513,14 @@ int CBrain::RetSelScript()
void CBrain::BlinkScript(bool bEnable)
{
Ui::CWindow* pw;
- CList* pl;
+ Ui::CList* pl;
- if ( !m_object->RetSelect() ) return; // robot not selected?
+ if ( !m_object->GetSelect() ) return; // robot not selected?
- pw = (Ui::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);
@@ -2527,7 +2528,7 @@ void CBrain::BlinkScript(bool bEnable)
// Check the status of a button interface.
-void CBrain::CheckInterface(Ui::CWindow *pw, EventMsg event, bool bState)
+void CBrain::CheckInterface(Ui::CWindow *pw, EventType event, bool bState)
{
Ui::CControl* control;
@@ -2539,7 +2540,7 @@ void CBrain::CheckInterface(Ui::CWindow *pw, EventMsg event, bool bState)
// Changes the state of a button interface.
-void CBrain::EnableInterface(Ui::CWindow *pw, EventMsg event, bool bState)
+void CBrain::EnableInterface(Ui::CWindow *pw, EventType event, bool bState)
{
Ui::CControl* control;
@@ -2551,7 +2552,7 @@ void CBrain::EnableInterface(Ui::CWindow *pw, EventMsg event, bool bState)
// Changes the state of a button on the interface.
-void CBrain::DeadInterface(Ui::CWindow *pw, EventMsg event, bool bState)
+void CBrain::DeadInterface(Ui::CWindow *pw, EventType event, bool bState)
{
Ui::CControl* control;
@@ -2563,7 +2564,7 @@ void CBrain::DeadInterface(Ui::CWindow *pw, EventMsg event, bool bState)
// Change the default input state of a button interface.
-void CBrain::DefaultEnter(Ui::CWindow *pw, EventMsg event, bool bState)
+void CBrain::DefaultEnter(Ui::CWindow *pw, EventType event, bool bState)
{
Ui::CControl* control;
@@ -2596,7 +2597,7 @@ void CBrain::SetActivity(bool bMode)
m_bActivity = bMode;
}
-bool CBrain::RetActivity()
+bool CBrain::GetActivity()
{
return m_bActivity;
}
@@ -2626,12 +2627,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()
{
@@ -2645,9 +2646,9 @@ int CBrain::FreeProgram()
}
-// Returns the current program.
+// Geturns the current program.
-int CBrain::RetProgram()
+int CBrain::GetProgram()
{
return m_program;
}
@@ -2660,7 +2661,7 @@ void CBrain::SetScriptRun(int rank)
m_scriptRun = rank;
}
-int CBrain::RetScriptRun()
+int CBrain::GetScriptRun()
{
return m_scriptRun;
}
@@ -2670,7 +2671,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];
}
@@ -2680,7 +2681,7 @@ void CBrain::SetSoluceName(char *name)
strcpy(m_soluceName, name);
}
-char* CBrain::RetSoluceName()
+char* CBrain::GetSoluceName()
{
return m_soluceName;
}
@@ -2732,10 +2733,10 @@ bool CBrain::ReadProgram(int rank, const 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.
@@ -2814,12 +2815,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?
{
@@ -2840,16 +2841,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?
{
@@ -2862,13 +2863,13 @@ 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);
}
@@ -2878,8 +2879,8 @@ void CBrain::TraceRecordFrame()
}
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;
}
}
diff --git a/src/object/brain.h b/src/object/brain.h
index b1ef9bc..3db5b4c 100644
--- a/src/object/brain.h
+++ b/src/object/brain.h
@@ -21,8 +21,9 @@
// #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"
@@ -34,23 +35,23 @@ class CObject;
class CPhysics;
class CMotion;
class CTaskManager;
-class CInterface;
-class CWindow;
-class CDisplayText;
class CScript;
class CRobotMain;
-class CStudio;
class CSoundInterface;
-class CParticle;
-namespace Gfx
-{
+namespace Ui {
+class CStudio;
+class CInterface;
+class CWindow;
+class CDisplayText;
+}
+namespace Gfx {
class CEngine;
class CTerrain;
class CWater;
class CCamera;
-
+class CParticle;
} /* Gfx */
@@ -149,14 +150,14 @@ protected:
void GroundFlat();
void ColorFlag(int color);
- void UpdateScript(CWindow *pw);
+ void UpdateScript(Ui::CWindow *pw);
int GetSelScript();
void BlinkScript(bool bEnable);
- void CheckInterface(CWindow *pw, EventType event, bool bState);
- void EnableInterface(CWindow *pw, EventType event, bool bState);
- void DeadInterface(CWindow *pw, EventType event, bool bState);
- void DefaultEnter(CWindow *pw, EventType 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();
@@ -170,15 +171,16 @@ protected:
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;
- CInterface* m_interface;
- CDisplayText* m_displayText;
+ Ui::CInterface* m_interface;
+ Ui::CDisplayText* m_displayText;
CRobotMain* m_main;
- CStudio* m_studio;
+ Ui::CStudio* m_studio;
CSoundInterface* m_sound;
- CParticle* m_particle;
+
CTaskManager* m_primaryTask;
CTaskManager* m_secondaryTask;
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 0c8d51c..27e4df3 100644
--- a/src/object/mainmovie.h
+++ b/src/object/mainmovie.h
@@ -24,17 +24,14 @@
class CInstanceManager;
-class CEvent;
-class CInterface;
class CRobotMain;
-class CCamera;
class CSoundInterface;
namespace Gfx
{
+ class CCamera;
class CEngine;
-} /* Gfx */
-
+};
enum MainMovieType
{
@@ -56,18 +53,16 @@ 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;
+ CInstanceManager* m_iMan;
Gfx::CEngine* m_engine;
- CInterface* m_interface;
CRobotMain* m_main;
- CCamera* m_camera;
+ Gfx::CCamera* m_camera;
CSoundInterface* m_sound;
MainMovieType m_type;
diff --git a/src/object/motion/motion.cpp b/src/object/motion/motion.cpp
index 6b22471..c3b74ee 100644
--- a/src/object/motion/motion.cpp
+++ b/src/object/motion/motion.cpp
@@ -34,14 +34,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;
@@ -98,7 +98,7 @@ bool CMotion::EventProcess(const Event &event)
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; // (*)
diff --git a/src/object/motion/motion.h b/src/object/motion/motion.h
index 2ec5c5d..ef943d2 100644
--- a/src/object/motion/motion.h
+++ b/src/object/motion/motion.h
@@ -25,17 +25,21 @@
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 GetAction();
+ 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 GetParam(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 void SetLinVibration(Math::Vector dir);
virtual Math::Vector GetLinVibration();
- virtual void SetCirVibration(Math::Vector dir);
+ virtual void SetCirVibration(Math::Vector dir);
virtual Math::Vector GetCirVibration();
- virtual void SetInclinaison(Math::Vector dir);
+ 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..2349e1e 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;
@@ -712,7 +712,7 @@ bool CMotionHuman::EventFrame(const Event &event)
int i, ii, st, nd, action, legAction, armAction;
bool bOnBoard, bSwim, bStop;
- 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,7 +832,7 @@ 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;
}
@@ -840,7 +840,7 @@ bool CMotionHuman::EventFrame(const Event &event)
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 +869,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 +908,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 +1022,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 +1074,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 +1147,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 +1182,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 +1201,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 +1211,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 +1225,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 +1235,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 +1248,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 +1258,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 +1271,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 +1281,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 +1289,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 +1303,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 +1322,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 +1331,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 +1349,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 +1358,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 +1373,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 +1393,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 +1402,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 +1420,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 +1429,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 +1437,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 +1467,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 +1494,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 +1505,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 +1515,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 +1524,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 +1554,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 +1563,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 +1575,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 +1602,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 +1627,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 +1651,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 +1670,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 +1680,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 +1737,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..af69d40 100644
--- a/src/object/motion/motionvehicle.cpp
+++ b/src/object/motion/motionvehicle.cpp
@@ -21,9 +21,9 @@
#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"
@@ -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.tga", "",
+ 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.tga", "",
+ 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.tga", "",
+ 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.tga", "",
+ 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/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/robotmain.cpp b/src/object/robotmain.cpp
index 8178ab4..3f7ad9e 100644
--- a/src/object/robotmain.cpp
+++ b/src/object/robotmain.cpp
@@ -17,67 +17,65 @@
// 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"
+
+
+
+// TODO: remove once using std::string
+const int MAX_FNAME = 255;
@@ -109,9 +107,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
@@ -600,38 +596,33 @@ 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_particle = (CParticle*)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->GetFilesDir();
@@ -646,32 +637,32 @@ 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_bHighlight = 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_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 +673,7 @@ CRobotMain::CRobotMain(CInstanceManager* iMan)
m_endingWinRank = 0;
m_endingLostRank = 0;
- m_bWinTerminate = false;
+ m_winTerminate = false;
FlushDisplayInfo();
@@ -690,22 +681,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;
+ float fValue;
+ int iValue;
+
+ /* TODO: profile
+ 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 +718,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 +734,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 = GetObjectName(type);
- if ( token[0] != 0 )
- {
+ ObjectType type = (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 +772,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,8 +812,7 @@ CRobotMain::CRobotMain(CInstanceManager* iMan)
CScript::InitFonctions();
}
-// Destructor of robot application.
-
+//! Destructor of robot application
CRobotMain::~CRobotMain()
{
delete m_movie;
@@ -826,59 +820,47 @@ CRobotMain::~CRobotMain()
delete m_short;
delete m_map;
delete m_terrain;
- delete m_model;
-}
+ 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;
-
- // colobot.ini don't exist?
- if ( !GetLocalProfileInt("Setup", "TotoMode", iValue) )
- {
- m_dialog->SetupMemorize();
- }
+ /* TODO: profile
+ int iValue;
+ // colobot.ini doesn't exist?
+ if (!GetLocalProfileInt("Setup", "TotoMode", iValue))
+ m_dialog->SetupMemorize();*/
}
-// Changes phase.
-
+//! Changes phase
void CRobotMain::ChangePhase(Phase phase)
{
- CEdit* pe;
- CButton* pb;
- D3DCOLORVALUE color;
- Math::Point pos, dim, ddim;
- float ox, oy, sx, sy;
- char* read;
- int rank, numTry;
- bool bLoading;
-
- if ( m_phase == PHASE_SIMUL ) // ends a simulation?
+ if (m_phase == PHASE_SIMUL) // ends a simulation?
{
SaveAllScript();
m_sound->StopMusic();
m_camera->SetObject(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->GetSceneRank();
- numTry = m_dialog->GetGamerInfoTry(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->GetSceneRank();
+ int rank = m_dialog->GetSceneRank();
m_dialog->SetGamerInfoPassed(rank, true);
m_dialog->NextMission(); // passes to the next mission
m_dialog->WriteGamerInfo();
@@ -889,186 +871,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_particle->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 = static_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->GetSceneRead();
- bLoading = (read[0] != 0);
+ char* read = m_dialog->GetSceneRead();
+ bool loading = (read[0] != 0);
m_map->CreateMap();
CreateScene(m_dialog->GetSceneSoluce(), false, false); // interactive scene
- if ( m_bMapImage )
- {
+ if (m_mapImage)
m_map->SetFixImage(m_mapFilename);
- }
+
+ Math::Point ddim;
pos.x = 620.0f/640.0f;
pos.y = 460.0f/480.0f;
@@ -1076,58 +991,57 @@ 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);
pe->SetFontType(FONT_COLOBOT);
pe->SetEditCap(false);
- pe->SetHighlightCap(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->SetHighlightCap(false);
+ pe->SetHiliteCap(false);
pe->ReadText("help\\win.txt");
-#endif
}
else
{
@@ -1138,20 +1052,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 +1075,32 @@ 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);
-
- CreateModel();
- }
-
- if ( m_phase == PHASE_LOADING )
- {
- m_engine->SetMouseHide(true);
- }
+ if (m_phase == PHASE_LOADING)
+ m_engine->SetMouseVisible(false);
else
- {
- m_engine->SetMouseHide(false);
- }
+ m_engine->SetMouseVisible(true);
- m_engine->LoadAllTexture();
+ m_engine->LoadAllTextures();
}
-// Processes an event.
-
+//! Processes an event
bool CRobotMain::EventProcess(const Event &event)
{
- CEdit* pe;
- CObject* pObj;
- Event newEvent;
- MainMovieType type;
- int i;
+ // TODO: rewrite key handling to input bindings
- 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->GetStopType();
- 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,301 +1111,266 @@ 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 = static_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 = static_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;
- HighlightObject(event.pos);
+ HiliteObject(event.pos);
}
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;
- HighlightObject(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->GetKey(KEYRANK_HELP, 0) ||
- event.param == m_engine->GetKey(KEYRANK_HELP, 1) ||
- event.param == m_engine->GetKey(KEYRANK_PROG, 0) ||
- event.param == m_engine->GetKey(KEYRANK_PROG, 1) ||
- event.param == VK_ESCAPE )
+ if (event.key.key == m_app->GetKey(KEYRANK_HELP, 0) ||
+ event.key.key == m_app->GetKey(KEYRANK_HELP, 1) ||
+ event.key.key == m_app->GetKey(KEYRANK_PROG, 0) ||
+ event.key.key == m_app->GetKey(KEYRANK_PROG, 1) ||
+ 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);
- HighlightClear();
- if ( event.param == VK_F11 )
+ case EVENT_KEY_DOWN:
+ KeyCamera(event.type, event.key.key);
+ HiliteClear();
+ if (event.key.key == KEY(F11))
{
- m_particle->WriteWheelTrace("Savegame\\t.bmp", 256, 256, Math::Vector(16.0f, 0.0f, -368.0f), Math::Vector(140.0f, 0.0f, -248.0f));
+ 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->GetKey(KEYRANK_HELP, 0) ||
- event.param == m_engine->GetKey(KEYRANK_HELP, 1) )
+ if (event.key.key == m_app->GetKey(KEYRANK_HELP, 0) ||
+ event.key.key == m_app->GetKey(KEYRANK_HELP, 1))
{
StartDisplayInfo(SATCOM_HUSTON, false);
return false;
}
- if ( event.param == m_engine->GetKey(KEYRANK_PROG, 0) ||
- event.param == m_engine->GetKey(KEYRANK_PROG, 1) )
+ if (event.key.key == m_app->GetKey(KEYRANK_PROG, 0) ||
+ event.key.key == m_app->GetKey(KEYRANK_PROG, 1))
{
StartDisplayInfo(SATCOM_PROG, false);
return false;
}
break;
}
- if ( m_bMovieLock ) // current movie?
+ if (m_movieLock) // current movie?
{
- if ( event.param == m_engine->GetKey(KEYRANK_QUIT, 0) ||
- event.param == m_engine->GetKey(KEYRANK_QUIT, 1) ||
- event.param == VK_ESCAPE )
+ if (event.key.key == m_app->GetKey(KEYRANK_QUIT, 0) ||
+ event.key.key == m_app->GetKey(KEYRANK_QUIT, 1) ||
+ event.key.key == KEY(ESCAPE))
{
AbortMovie();
}
return false;
}
- if ( m_camera->GetType() == CAMERA_VISIT )
+ if (m_camera->GetType() == Gfx::CAM_TYPE_VISIT)
{
- if ( event.param == m_engine->GetKey(KEYRANK_VISIT, 0) ||
- event.param == m_engine->GetKey(KEYRANK_VISIT, 1) )
+ if (event.key.key == m_app->GetKey(KEYRANK_VISIT, 0) ||
+ event.key.key == m_app->GetKey(KEYRANK_VISIT, 1))
{
StartDisplayVisit(EVENT_NULL);
}
- if ( event.param == m_engine->GetKey(KEYRANK_QUIT, 0) ||
- event.param == m_engine->GetKey(KEYRANK_QUIT, 1) ||
- event.param == VK_ESCAPE )
+ if (event.key.key == m_app->GetKey(KEYRANK_QUIT, 0) ||
+ event.key.key == m_app->GetKey(KEYRANK_QUIT, 1) ||
+ event.key.key == KEY(ESCAPE))
{
StopDisplayVisit();
}
return false;
}
- if ( event.param == m_engine->GetKey(KEYRANK_QUIT, 0) ||
- event.param == m_engine->GetKey(KEYRANK_QUIT, 1) )
+ if (event.key.key == m_app->GetKey(KEYRANK_QUIT, 0) ||
+ event.key.key == m_app->GetKey(KEYRANK_QUIT, 1))
{
- 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->GetType() != 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->GetPause());
}
}
- if ( event.param == m_engine->GetKey(KEYRANK_CAMERA, 0) ||
- event.param == m_engine->GetKey(KEYRANK_CAMERA, 1) )
+ if (event.key.key == m_app->GetKey(KEYRANK_CAMERA, 0) ||
+ event.key.key == m_app->GetKey(KEYRANK_CAMERA, 1))
{
ChangeCamera();
}
- if ( event.param == m_engine->GetKey(KEYRANK_DESEL, 0) ||
- event.param == m_engine->GetKey(KEYRANK_DESEL, 1) )
+ if (event.key.key == m_app->GetKey(KEYRANK_DESEL, 0) ||
+ event.key.key == m_app->GetKey(KEYRANK_DESEL, 1))
{
- if ( m_bShortCut )
- {
+ if (m_shortCut)
DeselectObject();
- }
}
- if ( event.param == m_engine->GetKey(KEYRANK_HUMAN, 0) ||
- event.param == m_engine->GetKey(KEYRANK_HUMAN, 1) )
+ if (event.key.key == m_app->GetKey(KEYRANK_HUMAN, 0) ||
+ event.key.key == m_app->GetKey(KEYRANK_HUMAN, 1))
{
SelectHuman();
}
- if ( event.param == m_engine->GetKey(KEYRANK_NEXT, 0) ||
- event.param == m_engine->GetKey(KEYRANK_NEXT, 1) )
+ if (event.key.key == m_app->GetKey(KEYRANK_NEXT, 0) ||
+ event.key.key == m_app->GetKey(KEYRANK_NEXT, 1))
{
- if ( m_bShortCut )
- {
+ if (m_shortCut)
m_short->SelectNext();
- }
}
- if ( event.param == m_engine->GetKey(KEYRANK_HELP, 0) ||
- event.param == m_engine->GetKey(KEYRANK_HELP, 1) )
+ if (event.key.key == m_app->GetKey(KEYRANK_HELP, 0) ||
+ event.key.key == m_app->GetKey(KEYRANK_HELP, 1))
{
StartDisplayInfo(SATCOM_HUSTON, true);
}
- if ( event.param == m_engine->GetKey(KEYRANK_PROG, 0) ||
- event.param == m_engine->GetKey(KEYRANK_PROG, 1) )
+ if (event.key.key == m_app->GetKey(KEYRANK_PROG, 0) ||
+ event.key.key == m_app->GetKey(KEYRANK_PROG, 1))
{
StartDisplayInfo(SATCOM_PROG, true);
}
- if ( event.param == m_engine->GetKey(KEYRANK_VISIT, 0) ||
- event.param == m_engine->GetKey(KEYRANK_VISIT, 1) )
+ if (event.key.key == m_app->GetKey(KEYRANK_VISIT, 0) ||
+ event.key.key == m_app->GetKey(KEYRANK_VISIT, 1))
{
StartDisplayVisit(EVENT_NULL);
}
- if ( event.param == m_engine->GetKey(KEYRANK_SPEED10, 0) ||
- event.param == m_engine->GetKey(KEYRANK_SPEED10, 1) )
+ if (event.key.key == m_app->GetKey(KEYRANK_SPEED10, 0) ||
+ event.key.key == m_app->GetKey(KEYRANK_SPEED10, 1))
{
SetSpeed(1.0f);
}
- if ( event.param == m_engine->GetKey(KEYRANK_SPEED15, 0) ||
- event.param == m_engine->GetKey(KEYRANK_SPEED15, 1) )
+ if (event.key.key == m_app->GetKey(KEYRANK_SPEED15, 0) ||
+ event.key.key == m_app->GetKey(KEYRANK_SPEED15, 1))
{
SetSpeed(1.5f);
}
- if ( event.param == m_engine->GetKey(KEYRANK_SPEED20, 0) ||
- event.param == m_engine->GetKey(KEYRANK_SPEED20, 1) )
+ if (event.key.key == m_app->GetKey(KEYRANK_SPEED20, 0) ||
+ event.key.key == m_app->GetKey(KEYRANK_SPEED20, 1))
{
SetSpeed(2.0f);
}
- if ( event.param == m_engine->GetKey(KEYRANK_SPEED30, 0) ||
- event.param == m_engine->GetKey(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->GetType() == 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 +1378,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 +1424,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 +1451,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 +1465,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 +1512,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 +1582,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 )
- {
+ 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 )
- {
+ 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->GetPower();
- if ( power != 0 )
- {
+ CObject* power = object->GetPower();
+ if (power != nullptr)
power->SetEnergy(1.0f);
- }
+
object->SetShield(1.0f);
- physics = object->GetPhysics();
- 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->GetPower();
- 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->GetPhysics();
- 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->GetDebugMode());
+ m_app->SetDebugMode(!m_app->GetDebugMode());
return;
}
- if ( strcmp(cmd, "showstat") == 0 )
+ if (strcmp(cmd, "showstat") == 0)
{
- m_engine->SetShowStat(!m_engine->GetShowStat());
+ m_engine->SetShowStats(!m_engine->GetShowStats());
return;
}
- if ( strcmp(cmd, "invshadow") == 0 )
+ if (strcmp(cmd, "invshadow") == 0)
{
m_engine->SetShadow(!m_engine->GetShadow());
return;
}
- if ( strcmp(cmd, "invdirty") == 0 )
+ if (strcmp(cmd, "invdirty") == 0)
{
m_engine->SetDirty(!m_engine->GetDirty());
return;
}
- if ( strcmp(cmd, "invfog") == 0 )
+ if (strcmp(cmd, "invfog") == 0)
{
m_engine->SetFog(!m_engine->GetFog());
return;
}
- if ( strcmp(cmd, "invlens") == 0 )
+ if (strcmp(cmd, "invlens") == 0)
{
m_engine->SetLensMode(!m_engine->GetLensMode());
return;
}
- if ( strcmp(cmd, "invwater") == 0 )
+ if (strcmp(cmd, "invwater") == 0)
{
m_engine->SetWaterMode(!m_engine->GetWaterMode());
return;
}
- if ( strcmp(cmd, "invsky") == 0 )
+ if (strcmp(cmd, "invsky") == 0)
{
m_engine->SetSkyMode(!m_engine->GetSkyMode());
return;
}
- if ( strcmp(cmd, "invplanet") == 0 )
+ if (strcmp(cmd, "invplanet") == 0)
{
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.
-
+//! Returns the type of current movie
MainMovieType CRobotMain::GetMainMovie()
{
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,190 +1786,151 @@ 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->GetType() == 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->GetMotion();
- if ( motion != 0 && motion->GetAction() == -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.
-
+//! Beginning of the displaying of instructions
void CRobotMain::StartDisplayInfo(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 = static_cast<Ui::CButton*>(m_interface->SearchControl(EVENT_BUTTON_QUIT));
+ if (pb != nullptr)
{
- pb->ClearState(STATE_VISIBLE);
+ pb->ClearState(Ui::STATE_VISIBLE);
}
- bSoluce = m_dialog->GetSceneSoluce();
+ 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 )
- {
+ 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 = static_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.
-
+//! Returns the name of the text display
char* CRobotMain::GetDisplayInfoName(int index)
{
return m_infoFilename[index];
}
-// Returns the name of the text display.
-
+//! 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 = static_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 = static_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
-
+//! Returns the absolute time of the game
float CRobotMain::GetGameTime()
{
return m_gameTime;
@@ -2203,12 +1938,12 @@ float CRobotMain::GetGameTime()
-// 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::GetFontSize()
@@ -2216,13 +1951,13 @@ 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::GetWindowPos()
@@ -2233,8 +1968,9 @@ Math::Point CRobotMain::GetWindowPos()
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::GetWindowDim()
@@ -2243,12 +1979,12 @@ Math::Point CRobotMain::GetWindowDim()
}
-// 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::GetIOPublic()
@@ -2259,8 +1995,9 @@ bool CRobotMain::GetIOPublic()
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::GetIOPos()
@@ -2271,8 +2008,9 @@ Math::Point CRobotMain::GetIOPos()
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::GetIODim()
@@ -2282,51 +2020,40 @@ Math::Point CRobotMain::GetIODim()
-// 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_editLock) return;
- if ( m_bEditLock ) return;
+ Ui::CWindow* pw = static_cast<Ui::CWindow*>(m_interface->SearchControl(EVENT_WINDOW2));
+ if (pw == nullptr) return;
- pw = (CWindow*)m_interface->SearchControl(EVENT_WINDOW2);
- if ( pw == 0 ) 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 = static_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 = static_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 +2063,7 @@ void CRobotMain::StartDisplayVisit(EventMsg event)
ClearInterface(); // removes setting evidence and tooltip
- if ( m_camera->GetType() == 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 +2074,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,13 +2085,14 @@ 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->GetVisitGoal(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->GetPosition(0);
@@ -2372,9 +2101,9 @@ void CRobotMain::StartDisplayVisit(EventMsg event)
m_visitArrow->SetPosition(0, m_visitPosArrow);
m_visitTime = 0.0;
- m_visitParticule = 0.0f;
+ m_visitParticle = 0.0f;
- m_particle->DeleteParticule(PARTISHOW);
+ m_particle->DeleteParticle(Gfx::PARTISHOW);
m_camera->StartVisit(m_displayText->GetVisitGoal(event),
m_displayText->GetVisitDist(event));
@@ -2382,42 +2111,37 @@ void CRobotMain::StartDisplayVisit(EventMsg 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->GetFloorLevel(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_particle->CreateParticle(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 +2150,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_particle->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 +2172,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.
-
+//! 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->GetSelect() ) 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;
-
- pObj->SetSelect(true, bDisplayError);
- m_camera->SetObject(pObj);
+ obj->SetSelect(true, displayError);
+ m_camera->SetObject(obj);
- type = pObj->GetType();
+ ObjectType type = obj->GetType();
if ( type == OBJECT_HUMAN ||
type == OBJECT_MOBILEfa ||
type == OBJECT_MOBILEta ||
@@ -2524,271 +2236,205 @@ void CRobotMain::SelectOneObject(CObject* pObj, bool bDisplayError)
type == OBJECT_MOBILEdr ||
type == OBJECT_APOLLO2 )
{
- m_camera->SetType(pObj->GetCameraType());
- m_camera->SetDist(pObj->GetCameraDist());
+ 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->GetMotion();
- 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->GetType() == 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;
-
- pPrev = DeselectAll();
+ CObject* obj = nullptr;
+ CObject* prev = 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->GetType();
- 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->GetType();
- 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->GetType();
- if ( type == OBJECT_TOTO ) continue;
+ ObjectType type = obj->GetType();
+ if (type == OBJECT_TOTO) continue;
- oPos = pObj->GetPosition(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.
-
+//! 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->GetSelect() )
- {
- 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->GetType() == 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->GetActif() ) continue;
- if ( pObj->GetProxyActivate() ) continue;
+ if (!obj->GetActif()) continue;
+ if (obj->GetProxyActivate()) continue;
- pTarget = 0;
- type = pObj->GetType();
+ CObject* target = nullptr;
+ ObjectType type = obj->GetType();
if ( type == OBJECT_PORTICO ||
type == OBJECT_BASE ||
type == OBJECT_DERRICK ||
@@ -2896,40 +2542,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->GetTruck() != 0 ) // battery used?
+ else if ((type == OBJECT_POWER ||
+ type == OBJECT_ATOMIC) &&
+ obj->GetTruck() != nullptr) // battery used?
{
- pTarget = pObj->GetTruck();
+ 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->GetObjectRank(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->GetSelectable() ) return false;
+ if (!obj->GetSelectable()) return false;
- type = pObj->GetType();
+ ObjectType type = obj->GetType();
if ( type == OBJECT_HUMAN ||
type == OBJECT_TOTO ||
type == OBJECT_MOBILEfa ||
@@ -2980,7 +2623,7 @@ bool CRobotMain::IsSelectable(CObject* pObj)
return true;
}
- if ( m_bSelectInsect )
+ if (m_selectInsect)
{
if ( type == OBJECT_MOTHER ||
type == OBJECT_ANT ||
@@ -2997,151 +2640,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.
-
-void CRobotMain::HighlightClear()
+//! 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_bHighlight ) return;
+ if (!m_hilite) return;
- i = -1;
- m_engine->SetHighlightRank(&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->SetHighlight(false);
+ obj->SetHilite(false);
m_map->SetHighlight(0);
m_short->SetHighlight(0);
}
- m_bHighlight = false;
+ m_hilite = false;
}
-// Highlights the object with the mouse hovers over.
-
-void CRobotMain::HighlightObject(Math::Point pos)
+//! 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->GetMouseHide() ) 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->GetTooltip() && m_interface->GetTooltip(pos, name) )
+ char name[100];
+
+ if (m_dialog->GetTooltip() && m_interface->GetTooltip(pos, name))
{
m_tooltipPos = pos;
strcpy(m_tooltipName, name);
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;
+ obj = m_map->DetectMap(pos, inMap);
+ if (obj == nullptr)
{
- if ( bInMap ) return;
+ if (inMap) return;
- pObj = DetectObject(pos);
+ obj = DetectObject(pos);
- if ( m_camera->GetType() == CAMERA_ONBOARD &&
- m_camera->GetObject() == pObj )
- {
+ if (m_camera->GetType() == Gfx::CAM_TYPE_ONBOARD &&
+ m_camera->GetObject() == obj)
return;
- }
}
}
- if ( pObj != 0 )
+ if (obj != nullptr)
{
- if ( m_dialog->GetTooltip() && 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->SetHighlight(true);
- m_map->SetHighlight(pObj);
- m_short->SetHighlight(pObj);
- m_bHighlight = true;
+ obj->SetHilite(true);
+ m_map->SetHilite(obj);
+ m_short->SetHilite(obj);
+ m_hilite = true;
}
}
}
-// Highlights the object with the mouse hovers over.
-
-void CRobotMain::HighlightFrame(float rTime)
+//! 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.
-
+//! Creates a tooltip
void CRobotMain::CreateTooltip(Math::Point pos, 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->GetText()->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 +2779,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 +2797,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 = static_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->GetText()->GetHeight(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->GetType());
- if ( filename[0] == 0 ) return;
+ 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->GetSelect() )
+ if (obj->GetSelect())
{
- if ( pObj->GetCameraLock() ) return;
+ if (obj->GetCameraLock()) return;
- oType = pObj->GetType();
- type = pObj->GetCameraType();
+ ObjectType oType = obj->GetType();
+ Gfx::CameraType type = obj->GetCameraType();
if ( oType != OBJECT_MOBILEfa &&
oType != OBJECT_MOBILEta &&
@@ -3250,115 +2872,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->GetTrainer() ) // 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, long key)
{
- CObject* pObj;
+ // TODO: rewrite key handling to input bindings
- if ( event == EVENT_KEYUP )
+ if (type == EVENT_KEY_UP)
{
- if ( param == m_engine->GetKey(KEYRANK_LEFT, 0) ||
- param == m_engine->GetKey(KEYRANK_LEFT, 1) )
+ if (key == m_app->GetKey(KEYRANK_LEFT, 0) ||
+ key == m_app->GetKey(KEYRANK_LEFT, 1))
{
m_cameraPan = 0.0f;
}
- if ( param == m_engine->GetKey(KEYRANK_RIGHT, 0) ||
- param == m_engine->GetKey(KEYRANK_RIGHT, 1) )
+ if (key == m_app->GetKey(KEYRANK_RIGHT, 0) ||
+ key == m_app->GetKey(KEYRANK_RIGHT, 1))
{
m_cameraPan = 0.0f;
}
- if ( param == m_engine->GetKey(KEYRANK_UP, 0) ||
- param == m_engine->GetKey(KEYRANK_UP, 1) )
+ if (key == m_app->GetKey(KEYRANK_UP, 0) ||
+ key == m_app->GetKey(KEYRANK_UP, 1))
{
m_cameraZoom = 0.0f;
}
- if ( param == m_engine->GetKey(KEYRANK_DOWN, 0) ||
- param == m_engine->GetKey(KEYRANK_DOWN, 1) )
+ if (key == m_app->GetKey(KEYRANK_DOWN, 0) ||
+ key == m_app->GetKey(KEYRANK_DOWN, 1))
{
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->GetTrainer() ) 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->GetKey(KEYRANK_LEFT, 0) ||
- param == m_engine->GetKey(KEYRANK_LEFT, 1) )
+ if (key == m_app->GetKey(KEYRANK_LEFT, 0) ||
+ key == m_app->GetKey(KEYRANK_LEFT, 1))
{
m_cameraPan = -1.0f;
}
- if ( param == m_engine->GetKey(KEYRANK_RIGHT, 0) ||
- param == m_engine->GetKey(KEYRANK_RIGHT, 1) )
+ if (key == m_app->GetKey(KEYRANK_RIGHT, 0) ||
+ key == m_app->GetKey(KEYRANK_RIGHT, 1))
{
m_cameraPan = 1.0f;
}
- if ( param == m_engine->GetKey(KEYRANK_UP, 0) ||
- param == m_engine->GetKey(KEYRANK_UP, 1) )
+ if (key == m_app->GetKey(KEYRANK_UP, 0) ||
+ key == m_app->GetKey(KEYRANK_UP, 1))
{
m_cameraZoom = -1.0f;
}
- if ( param == m_engine->GetKey(KEYRANK_DOWN, 0) ||
- param == m_engine->GetKey(KEYRANK_DOWN, 1) )
+ if (key == m_app->GetKey(KEYRANK_DOWN, 0) ||
+ key == m_app->GetKey(KEYRANK_DOWN, 1))
{
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->GetRemotePan();
+ 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->GetRemoteZoom();
+ float value = m_camera->GetRemoteZoom();
value += zoom*rTime*0.3f;
m_camera->SetRemoteZoom(value);
}
@@ -3366,199 +2984,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->GetAuto();
- 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->GetPosition(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 = static_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 = static_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->GetTruck() != 0 ) continue;
- type = pObj->GetType();
- 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->GetTruck() == 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->GetFog() )
- {
- m_camera->SetOverBaseColor(m_particule->GetFogColor(m_engine->GetEyePt()));
- }
+ 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);
- }
- HighlightFrame(event.rTime);
+ 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 +3144,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 +3165,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 +3177,84 @@ bool CRobotMain::EventFrame(const Event &event)
}
// Will move the arrow to visit.
- if ( m_camera->GetType() == 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 +3265,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->GetSceneName();
- rank = m_dialog->GetSceneRank();
+ 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 +3314,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 +3330,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 +3348,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 +3373,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 +3398,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 +3414,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 +3439,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 +3462,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_particle->FlushParticule();
+ m_lightMan->FlushLights();
+ m_particle->FlushParticle();
m_iMan->Flush(CLASS_OBJECT);
m_iMan->Flush(CLASS_PHYSICS);
m_iMan->Flush(CLASS_BRAIN);
@@ -3944,66 +3483,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;
-
- pObj->SetDrawFront(true); // draws the interface
+ obj->SetDrawFront(true); // draws the interface
- mh = (CMotionHuman*)pObj->GetMotion();
- if ( mh != 0 )
- {
+ CMotionHuman* mh = (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->GetSceneName();
- rank = m_dialog->GetSceneRank();
- read = m_dialog->GetSceneRead();
- stack = m_dialog->GetStackRead();
+ 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 +3529,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 +3563,143 @@ 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 )
- {
+ sprintf(op, "Title.%c", 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", 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", 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 +3718,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 +3742,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 )
+ if (Cmd(line, "TerrainRelief") && !resetObject)
{
OpString(line, "image", name);
UserDir(dir, name, "textures");
- m_terrain->ReliefFromBMP(dir, OpFloat(line, "factor", 1.0f), OpInt(line, "border", 1));
+ m_terrain->LoadRelief(dir, OpFloat(line, "factor", 1.0f), OpInt(line, "border", 1));
}
- if ( Cmd(line, "TerrainReliefDXF") && !bResetObject )
+ if (Cmd(line, "TerrainResource") && !resetObject)
{
OpString(line, "image", name);
UserDir(dir, name, "textures");
- m_terrain->ReliefFromDXF(dir, OpFloat(line, "factor", 1.0f));
+ m_terrain->LoadResources(dir);
}
- if ( Cmd(line, "TerrainResource") && !bResetObject )
- {
- OpString(line, "image", name);
- UserDir(dir, name, "textures");
- m_terrain->ResFromBMP(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 +3902,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);
- pType = OpPyro(line, "pyro");
- if ( pType != PT_NULL )
+ obj->SetCameraDist(OpFloat(line, "cameraDist", 50.0f));
+ obj->SetCameraLock(OpInt(line, "cameraLock", 0));
+
+ 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->GetMotion();
- 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->GetBrain();
- 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
+/* TODO: #if _SCHOOL
if ( !m_dialog->GetSoluce4() && i == 3 ) continue;
-#endif
- if ( name[0] != 0 )
- {
- pBrain->SetScriptName(i, name);
- }
+#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->GetAuto();
- 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->GetMovies() ) 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->GetPosition(0));
- pObj->SetResetAngle(pObj->GetAngle(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_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 +4145,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 +4163,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 +4186,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 +4239,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 +4257,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 +4265,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->FlushPressKey();
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->GetCameraType());
+ SelectObject(obj);
+ m_camera->SetObject(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->GetPosition(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->SetObject(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 +4349,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->GetAuto();
- if ( automat != 0 )
+ CAuto* automat = object->GetAuto();
+ if (automat != nullptr)
{
automat->Init();
}
@@ -4981,8 +4391,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 +4401,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 +4411,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 +4446,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 +4461,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 +4516,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 +4532,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 +4547,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 +4571,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 +4580,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 +4590,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 +4626,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->GetMotion();
- 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;
+ return object;
}
-
-// Creates the editable model.
-
-void CRobotMain::CreateModel()
+//! Creates a directional light
+int CRobotMain::CreateLight(Math::Vector direction, Gfx::Color color)
{
- 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;
-}
-
-
-// Creates a directional light.
-
-int CRobotMain::CreateLight(Math::Vector direction, D3DCOLORVALUE 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->GetLightMode()) return -1;
pos.y += m_terrain->GetFloorLevel(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;
@@ -5372,37 +4704,41 @@ void CRobotMain::ChangeColor()
colorRef2.g = 132.0f/256.0f;
colorRef2.b = 1.0f/256.0f; // orange
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);
+
+ float tolerance;
- face = RetGamerFace();
- if ( face == 0 ) // normal?
+ 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;
@@ -5416,12 +4752,14 @@ void CRobotMain::ChangeColor()
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 +4768,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 +4788,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 +4823,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->GetGadgetQuantity();
- 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->GetActif() ) continue; // inactive?
- if ( pObj->GetTruck() != 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->GetType();
+ ObjectType type = obj->GetType();
- if ( type == OBJECT_BASE )
+ if (type == OBJECT_BASE)
{
- oPos = pObj->GetPosition(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->GetPosition(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->GetFlatZoneRadius(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 +4929,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->GetFlatZoneRadius(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 +4959,71 @@ bool CRobotMain::FreeSpace(Math::Vector &center, float minRadius, float maxRadiu
return false;
}
-// Calculates the maximum radius of a free space.
-
+//! 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->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 == 0 ) return;
+ if (metal == nullptr) return;
- center = metal->GetPosition(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->GetActif() ) continue; // inactive?
- if ( pObj->GetTruck() != 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->GetType();
- if ( type == OBJECT_BASE )
+ Math::Vector oPos;
+ float oRadius;
+
+ ObjectType type = obj->GetType();
+ if (type == OBJECT_BASE)
{
- oPos = pObj->GetPosition(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 +5047,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 )
- {
+ 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_particle->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 +5109,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;
+ 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_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->GetPause() ) 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_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);
-//? m_particle->SetAngle(m_showLimit[i].parti[j], angle-Math::PI/2.0f);
angle += (2.0f*Math::PI)/m_showLimit[i].total;
}
@@ -5900,77 +5196,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->GetTruck() != 0 ) continue;
+ CObject* obj = static_cast<CObject*>(m_iMan->SearchInstance(CLASS_OBJECT, i));
+ if (obj == nullptr) break;
+ if (obj->GetTruck() != nullptr) continue;
- brain = pObj->GetBrain();
- 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->GetCompile(j) ) continue;
+ if (brain->GetCompile(j)) continue;
- name = brain->GetScriptName(j);
- if ( name[0] != 0 )
+ char* name = brain->GetScriptName(j);
+ if (name[0] != 0)
{
brain->ReadProgram(j, name);
- if ( !brain->GetCompile(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->GetTruck() != 0 ) continue;
+ CObject* obj = static_cast<CObject*>(m_iMan->SearchInstance(CLASS_OBJECT, i));
+ if (obj == 0) break;
+ if (obj->GetTruck() != 0) continue;
- brain = pObj->GetBrain();
- if ( brain == 0 ) continue;
+ CBrain* brain = obj->GetBrain();
+ if (brain == 0) continue;
- name = brain->GetSoluceName();
- if ( name[0] != 0 )
+ char* name = brain->GetSoluceName();
+ if (name[0] != 0)
{
brain->ReadSoluce(name); // load solution
}
@@ -5978,241 +5269,191 @@ 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->GetTruck() != 0 ) continue;
+ CObject* obj = static_cast<CObject*>(m_iMan->SearchInstance(CLASS_OBJECT, i));
+ if (obj == nullptr) break;
+ if (obj->GetTruck() != nullptr) continue;
- brain = pObj->GetBrain();
- if ( brain == 0 ) continue;
+ CBrain* brain = obj->GetBrain();
+ if (brain == nullptr) continue;
- run = brain->GetScriptRun();
- 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;
+ CBrain* brain = obj->GetBrain();
+ if (brain == nullptr) return;
- brain = pObj->GetBrain();
- if ( brain == 0 ) return;
+ if (!IsSelectable(obj)) return;
- if ( !IsSelectable(pObj) ) return;
+ ObjectType type = obj->GetType();
+ if (type == OBJECT_HUMAN) return;
- type = pObj->GetType();
- if ( type == OBJECT_HUMAN ) return;
+ int objRank = obj->GetDefRank();
+ if (objRank == -1) return;
- objRank = pObj->GetDefRank();
- if ( objRank == -1 ) return;
+ char* name = m_dialog->GetSceneName();
+ int rank = m_dialog->GetSceneRank();
- name = m_dialog->GetSceneName();
- rank = m_dialog->GetSceneRank();
-
- for ( i=0 ; i<BRAINMAXSCRIPT ; i++ )
+ for (int i = 0; i < BRAINMAXSCRIPT; i++)
{
- if ( brain->GetCompile(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->GetCompile(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;
+ CBrain* brain = obj->GetBrain();
+ if (brain == nullptr) return;
- brain = pObj->GetBrain();
- if ( brain == 0 ) return;
+ ObjectType type = obj->GetType();
+ if (type == OBJECT_HUMAN) return;
- type = pObj->GetType();
- if ( type == OBJECT_HUMAN ) return;
-
- name = m_dialog->GetSceneName();
- rank = m_dialog->GetSceneRank();
+ char* name = m_dialog->GetSceneName();
+ int rank = m_dialog->GetSceneRank();
+ 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->GetCompile(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->GetCompile(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;
-
- brain = pObj->GetBrain();
- if ( brain == 0 ) return;
+ CBrain* brain = obj->GetBrain();
+ if (brain == nullptr) return;
- if ( !IsSelectable(pObj) ) return;
+ if (!IsSelectable(obj)) return;
- type = pObj->GetType();
- if ( type == OBJECT_HUMAN ) return;
+ ObjectType type = obj->GetType();
+ if (type == OBJECT_HUMAN) return;
- objRank = pObj->GetDefRank();
- if ( objRank == -1 ) return;
+ int objRank = obj->GetDefRank();
+ if (objRank == -1) return;
- name = m_dialog->GetSceneName();
- rank = m_dialog->GetSceneRank();
+ char* name = m_dialog->GetSceneName();
+ int rank = m_dialog->GetSceneRank();
- 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;
-
- brain = pObj->GetBrain();
- if ( brain == 0 ) return;
+ if (objRank == -1) return;
- type = pObj->GetType();
- if ( type == OBJECT_HUMAN ) return;
+ CBrain* brain = obj->GetBrain();
+ if (brain == nullptr) return;
- name = m_dialog->GetSceneName();
- rank = m_dialog->GetSceneRank();
+ 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->GetBrain();
- if ( brain == 0 ) return true;
+ CBrain* brain = obj->GetBrain();
+ if (brain == nullptr) return true;
- type = pObj->GetType();
- 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;
- brain = pObj->GetBrain();
- if ( brain == 0 ) return true;
+ CBrain* brain = obj->GetBrain();
+ if (brain == nullptr) return true;
- type = pObj->GetType();
- 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 +5462,17 @@ bool CRobotMain::AddNewScriptName(ObjectType type, char *name)
return false;
}
-// Seeks a script name for a given type.
-
+//! 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 +5480,108 @@ char* CRobotMain::GetNewScriptName(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->GetBrain();
- if ( pBrain != 0 )
+ CBrain* brain = obj->GetBrain();
+ if (brain != nullptr)
{
- if ( pBrain->IsBusy() ) return true;
+ if (brain->IsBusy()) return true;
}
-
-//? pAuto = pObj->GetAuto();
-//? if ( pAuto != 0 )
-//? {
-//? if ( pAuto->GetBusy() ) 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, char *cmd)
{
- Math::Vector pos;
- CBrain* pBrain;
- char line[3000];
- char name[100];
- int run, i;
+ if (obj->GetType() == OBJECT_FIX) return;
- if ( pObj->GetType() == OBJECT_FIX ) return;
+ char line[3000];
+ char name[100];
strcpy(line, cmd);
- sprintf(name, " type=%s", GetTypeObject(pObj->GetType()));
+ sprintf(name, " type=%s", GetTypeObject(obj->GetType()));
strcat(line, name);
- sprintf(name, " id=%d", pObj->GetID());
+ sprintf(name, " id=%d", obj->GetID());
strcat(line, name);
- pos = pObj->GetPosition(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->GetAngle(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->GetZoom(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->GetObjectRank(i) == -1 ) continue;
+ if (obj->GetObjectRank(i) == -1) continue;
- pos = pObj->GetPosition(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->GetAngle(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->GetZoom(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->GetTrainer());
+ sprintf(name, " trainer=%d", obj->GetTrainer());
strcat(line, name);
- sprintf(name, " option=%d", pObj->GetOption());
+ 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->GetType() == OBJECT_BASE )
+ if (obj->GetType() == OBJECT_BASE)
{
sprintf(name, " run=3"); // stops and open (PARAM_FIXSCENE)
strcat(line, name);
}
- pBrain = pObj->GetBrain();
- if ( pBrain != 0 )
+ CBrain* brain = obj->GetBrain();
+ if (brain != nullptr)
{
- run = pBrain->GetProgram();
- if ( run != -1 )
+ int run = brain->GetProgram();
+ if (run != -1)
{
sprintf(name, " run=%d", run+1);
strcat(line, name);
@@ -6368,20 +5592,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,8 +5606,8 @@ 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->GetSceneName();
- 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->GetSceneRank(), m_dialog->GetSceneDir());
}
@@ -6406,67 +5623,64 @@ bool CRobotMain::IOWriteScene(char *filename, char *filecbot, char *info)
sprintf(line, "DoneResearch bits=%d\n", 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->GetType() == OBJECT_TOTO ) continue;
- if ( pObj->GetType() == OBJECT_FIX ) continue;
- if ( pObj->GetTruck() != 0 ) continue;
- if ( pObj->GetBurn() ) continue;
- if ( pObj->GetDead() ) continue;
- if ( pObj->GetExplo() ) continue;
+ 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->GetPower();
- pFret = pObj->GetFret();
+ 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->GetType() == OBJECT_TOTO ) continue;
- if ( pObj->GetType() == OBJECT_FIX ) continue;
- if ( pObj->GetTruck() != 0 ) continue;
- if ( pObj->GetBurn() ) continue;
- if ( pObj->GetDead() ) 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 +5690,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;
- for ( i=1 ; i<OBJECTMAXPART ; i++ )
+ if (zoom.x != 0.0f || zoom.y != 0.0f || zoom.z != 0.0f)
+ obj->SetZoom(0, zoom);
+
+ for (int i = 1; i < OBJECTMAXPART; i++)
{
- if ( pObj->GetObjectRank(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->GetBrain();
- 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->GetAuto();
- 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_bBase = false;
+ m_base = false;
- file = fopen(filename, "r");
- if ( file == NULL ) return 0;
+ FILE* 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->GetTruck() != 0 ) continue;
+ CObject* obj = static_cast<CObject*>(m_iMan->SearchInstance(CLASS_OBJECT, i));
+ if (obj == nullptr) break;
+ if (obj->GetTruck() != nullptr) continue;
- objRank = pObj->GetDefRank();
- 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->GetType() == OBJECT_TOTO ) continue;
- if ( pObj->GetType() == OBJECT_FIX ) continue;
- if ( pObj->GetTruck() != 0 ) continue;
- if ( pObj->GetBurn() ) continue;
- if ( pObj->GetDead() ) 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 +5897,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;
@@ -6787,179 +5966,166 @@ void CRobotMain::ResetObject()
}
// Removes all bullets in progress.
- m_particle->DeleteParticule(PARTIGUN1);
- m_particle->DeleteParticule(PARTIGUN2);
- m_particle->DeleteParticule(PARTIGUN3);
- m_particle->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->GetResetCap();
+ cap = obj->GetResetCap();
if ( cap == RESET_NONE ) continue;
if ( cap == RESET_DELETE )
{
- pTruck = pObj->GetTruck();
- 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->GetAuto();
- if ( pAuto != 0 )
+ objAuto = obj->GetAuto();
+ if ( objAuto != 0 )
{
- pAuto->Abort();
+ objAuto->Abort();
}
- if ( pObj->GetEnable() ) // object still active?
+ if ( obj->GetEnable() ) // object still active?
{
- brain = pObj->GetBrain();
+ brain = obj->GetBrain();
if ( brain != 0 )
{
- pos = pObj->GetResetPosition();
- angle = pObj->GetResetAngle();
+ pos = obj->GetResetPosition();
+ angle = obj->GetResetAngle();
- if ( pos == pObj->GetPosition(0) &&
- angle == pObj->GetAngle(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->GetResetPosition();
- angle = pObj->GetResetAngle();
+ pos = obj->GetResetPosition();
+ angle = obj->GetResetAngle();
- if ( pos == pObj->GetPosition(0) &&
- angle == pObj->GetAngle(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->GetBrain();
+ brain = obj->GetBrain();
if ( brain != 0 )
{
- brain->RunProgram(pObj->GetResetRun());
+ 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_particle->DeleteParticule(PARTIGUN1);
- m_particle->DeleteParticule(PARTIGUN2);
- m_particle->DeleteParticule(PARTIGUN3);
- m_particle->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_particle->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->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->GetResetCap();
- 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->GetLock() ) continue;
- if ( pObj->GetRuin() ) continue;
- if ( !pObj->GetEnable() ) continue;
-
- type = pObj->GetType();
- 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->GetTruck() == 0 )
- {
- oPos = pObj->GetPosition(0);
- }
+ if (type != m_endTake[t].type) continue;
+
+ if (obj->GetTruck() == 0)
+ oPos = obj->GetPosition(0);
else
- {
- oPos = pObj->GetTruck()->GetPosition(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 +6135,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 +6145,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 +6163,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 +6180,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 +6192,14 @@ Error CRobotMain::CheckEndMission(bool bFrame)
return ERR_OK; // mission ended
}
-// Checks if the mission is finished after displaying a message.
-
-void CRobotMain::CheckEndMessage(const char *message)
+//! Checks if the mission is finished after displaying a message
+void CRobotMain::CheckEndMessage(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,65 +6209,51 @@ void CRobotMain::CheckEndMessage(const char *message)
}
-// Returns the number of instructions required.
-
+//! Returns the number of instructions required
int CRobotMain::GetObligatoryToken()
{
return m_obligatoryTotal;
}
-// Returns the name of a required instruction.
-
+//! 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(const char *token)
+//! Checks if an instruction is part of the obligatory list
+int CRobotMain::IsObligatoryToken(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(const char *token)
+//! Checks if an instruction is not part of the banned list
+bool CRobotMain::IsProhibitedToken(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.
-
+//! 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.
-
+//! Indicates whether the scene is fixed, without interaction
bool CRobotMain::GetFixScene()
{
- return m_bFixScene;
+ return m_fixScene;
}
@@ -7156,23 +6305,23 @@ bool CRobotMain::GetHimselfDamage()
bool CRobotMain::GetShowSoluce()
{
- return m_bShowSoluce;
+ return m_showSoluce;
}
bool CRobotMain::GetSceneSoluce()
{
- if ( m_infoFilename[SATCOM_SOLUCE][0] == 0 ) return false;
+ if (m_infoFilename[SATCOM_SOLUCE][0] == 0) return false;
return m_dialog->GetSceneSoluce();
}
bool CRobotMain::GetShowAll()
{
- return m_bShowAll;
+ return m_showAll;
}
bool CRobotMain::GetCheatRadar()
{
- return m_bCheatRadar;
+ return m_cheatRadar;
}
char* CRobotMain::GetSavegameDir()
@@ -7191,8 +6340,7 @@ char* CRobotMain::GetFilesDir()
}
-// Change the player's name.
-
+//! Change the player's name
void CRobotMain::SetGamerName(char *name)
{
strcpy(m_gamerName, name);
@@ -7200,77 +6348,68 @@ void CRobotMain::SetGamerName(char *name)
ReadFreeParam();
}
-// Getes the player's name.
-
+//! Getes the player's name
char* CRobotMain::GetGamerName()
{
return m_gamerName;
}
-// Returns the representation to use for the player.
-
+//! Returns the representation to use for the player
int CRobotMain::GetGamerFace()
{
return m_dialog->GetGamerFace();
}
-// Returns the representation to use for the player.
-
+//! Returns the representation to use for the player
int CRobotMain::GetGamerGlasses()
{
return m_dialog->GetGamerGlasses();
}
-// Returns the mode with just the head.
-
+//! Returns the mode with just the head
bool CRobotMain::GetGamerOnlyHead()
{
return m_dialog->GetGamerOnlyHead();
}
-// Returns the angle of presentation.
-
+//! Returns the angle of presentation
float CRobotMain::GetPersoAngle()
{
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 ) HighlightClear();
+ if (m_pause) HiliteClear();
}
-// Changes game speed
-
+//! Changes game speed
void CRobotMain::SetSpeed(float speed)
{
- CButton* pb;
- char text[10];
+ // TODO: m_app->SetSimulationSpeed(speed);
- m_engine->SetSpeed(speed);
-
- pb = (CButton*)m_interface->SearchControl(EVENT_SPEED);
- if ( pb != 0 )
+ Ui::CButton* pb = static_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);
}
}
}
@@ -7281,131 +6420,116 @@ float CRobotMain::GetSpeed()
}
-// 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.
-
+//! Indicates whether the mini-map is visible
bool CRobotMain::GetShowMap()
{
- return m_map->GetShowMap() && 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 ) HighlightClear();
- m_engine->SetMouseHide(m_bMovieLock);
+ m_map->ShowMap(!m_movieLock && m_mapShow);
+ if (m_movieLock) HiliteClear();
+ m_engine->SetMouseVisible(! m_movieLock);
}
bool CRobotMain::GetMovieLock()
{
- return m_bMovieLock;
+ return m_movieLock;
}
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::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->GetFixImage() )
- {
- 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->FlushPressKey();
- if ( m_bEditLock )
- {
- HighlightClear();
- }
+ if (m_editLock)
+ HiliteClear();
else
- {
- m_bEditFull = false;
- }
+ m_editFull = false;
}
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::GetEditFull()
{
- return m_bEditFull;
+ return m_editFull;
}
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::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);
@@ -7417,23 +6541,19 @@ float CRobotMain::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()
{
- HighlightClear(); // removes setting evidence
+ 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 c649aab..4ec897b 100644
--- a/src/object/robotmain.h
+++ b/src/object/robotmain.h
@@ -18,15 +18,13 @@
#pragma once
-
-#include <stdio.h>
-
+#include "common/global.h"
#include "common/misc.h"
-#include "graphics/engine/engine.h"
+#include "graphics/engine/particle.h"
#include "object/object.h"
#include "object/mainmovie.h"
-#include "graphics/engine/camera.h"
-#include "graphics/engine/particle.h"
+
+#include <stdio.h>
enum Phase
{
@@ -68,36 +66,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 CSoundInterface;
+};
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];
};
@@ -105,7 +108,7 @@ const int MAXNEWSCRIPTNAME = 20;
struct NewScriptName
{
- bool bUsed;
+ bool used;
ObjectType type;
char name[40];
};
@@ -117,8 +120,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];
@@ -141,7 +144,7 @@ const int SATCOM_MAX = 6;
class CRobotMain
{
public:
- CRobotMain(CInstanceManager* iMan);
+ CRobotMain(CInstanceManager* iMan, CApplication* app);
~CRobotMain();
void CreateIni();
@@ -152,23 +155,23 @@ public:
bool CreateShortcuts();
void ScenePerso();
- void SetMovieLock(bool bLock);
+ void SetMovieLock(bool lock);
bool GetMovieLock();
bool GetInfoLock();
- void SetSatComLock(bool bLock);
+ void SetSatComLock(bool lock);
bool GetSatComLock();
- void SetEditLock(bool bLock, bool bEdit);
+ void SetEditLock(bool lock, bool edit);
bool GetEditLock();
- void SetEditFull(bool bFull);
+ void SetEditFull(bool full);
bool GetEditFull();
bool GetFreePhoto();
- void SetFriendAim(bool bFriend);
+ void SetFriendAim(bool friendAim);
bool GetFriendAim();
void SetTracePrecision(float factor);
float GetTracePrecision();
- void ChangePause(bool bPause);
+ void ChangePause(bool pause);
void SetSpeed(float speed);
float GetSpeed();
@@ -178,26 +181,26 @@ public:
CObject* SearchHuman();
CObject* SearchToto();
CObject* SearchNearest(Math::Vector pos, CObject* pExclu);
- bool SelectObject(CObject* pObj, bool bDisplayError=true);
+ bool SelectObject(CObject* pObj, bool displayError=true);
CObject* GetSelectObject();
CObject* DeselectAll();
bool DeleteObject();
void ResetObject();
void ResetCreate();
- Error CheckEndMission(bool bFrame);
- void CheckEndMessage(const char *message);
+ Error CheckEndMission(bool frame);
+ void CheckEndMessage(char *message);
int GetObligatoryToken();
char* GetObligatoryToken(int i);
- int IsObligatoryToken(const char *token);
- bool IsProhibitedToken(const char *token);
+ int IsObligatoryToken(char *token);
+ bool IsProhibitedToken(char *token);
void UpdateMap();
bool GetShowMap();
MainMovieType GetMainMovie();
void FlushDisplayInfo();
- void StartDisplayInfo(int index, bool bMovie);
+ void StartDisplayInfo(int index, bool movie);
void StartDisplayInfo(char *filename, int index);
void StopDisplayInfo();
char* GetDisplayInfoName(int index);
@@ -216,7 +219,7 @@ public:
void SetWindowDim(Math::Point dim);
Math::Point GetWindowDim();
- void SetIOPublic(bool bMode);
+ void SetIOPublic(bool mode);
bool GetIOPublic();
void SetIOPos(Math::Point pos);
Math::Point GetIOPos();
@@ -259,14 +262,15 @@ public:
void HideDropZone(CObject* metal);
void ShowDropZone(CObject* metal, CObject* truck);
void FlushShowLimit(int i);
- void SetShowLimit(int i, Gfx::ParticleType 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);
@@ -294,24 +298,26 @@ 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);
+ 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 HighlightClear();
- void HighlightObject(Math::Point pos);
- void HighlightFrame(float rTime);
+ void HiliteClear();
+ void HiliteObject(Math::Point pos);
+ void HiliteFrame(float rTime);
void CreateTooltip(Math::Point pos, char* text);
void ClearTooltip();
CObject* DetectObject(Math::Point pos);
void ChangeCamera();
void RemoteCamera(float pan, float zoom, float rTime);
- void KeyCamera(EventType event, long param);
+ void KeyCamera(EventType event, long 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();
@@ -325,70 +331,70 @@ protected:
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;
+ CInstanceManager* m_iMan;
+ CApplication* m_app;
+ CEventQueue* m_eventQueue;
+ CMainMovie* m_movie;
+ Gfx::CEngine* m_engine;
Gfx::CParticle* m_particle;
- 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;
+ 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;
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;
Gfx::Color 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;
+ 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_bHighlight;
- 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;
@@ -404,28 +410,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;
- EventType 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];
@@ -445,14 +451,14 @@ protected:
ShowLimit m_showLimit[MAXSHOWLIMIT];
- 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;
+ 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/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..6aa0ed2 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,9 +31,6 @@
#include "physics/physics.h"
#include "ui/displaytext.h"
-
-
-
// Object's constructor.
CTaskBuild::CTaskBuild(CInstanceManager* iMan, CObject* object)
@@ -68,7 +64,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 +98,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 +108,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 +135,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 +172,8 @@ void CTaskBuild::CreateLight()
void CTaskBuild::BlackLight()
{
- D3DCOLORVALUE color;
- int i;
+ Gfx::Color color;
+ int i;
for ( i=0 ; i<TBMAXLIGHT ; i++ )
{
@@ -187,8 +183,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 +199,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 +209,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 +221,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 +254,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 +266,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 +291,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 +333,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 +371,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 +390,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 +421,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 +462,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 +478,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 +490,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 +579,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 +597,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 +636,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 +687,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 +707,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 +716,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 +777,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 +789,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..fb3c9a2 100644
--- a/src/object/task/taskgoto.cpp
+++ b/src/object/task/taskgoto.cpp
@@ -23,8 +23,8 @@
#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"
@@ -59,14 +59,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 +84,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 +92,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 +126,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 +140,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 +173,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 +192,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 +227,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 +236,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 +292,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 +300,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 +319,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 +331,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 +358,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 +367,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 +383,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 +395,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 +407,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 +431,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 +450,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 +462,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 +493,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 +546,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 +558,7 @@ CObject* CTaskGoto::WormSearch(Math::Vector &impact)
}
if ( pBest == 0 ) return 0;
- impact = pBest->RetPosition(0);
+ impact = pBest->GetPosition(0);
return pBest;
}
@@ -603,7 +579,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 +603,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 +644,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 +679,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 +698,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 +719,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 +733,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 +753,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 +778,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 +800,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 +809,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 +837,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 +873,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 +888,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 +907,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 +915,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 +937,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 +945,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 +971,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 +1006,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 +1029,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 +1059,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 +1095,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 +1104,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 +1139,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 +1154,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 +1171,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 +1199,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 +1213,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 +1223,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 +1233,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 +1243,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 +1253,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 +1263,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 +1273,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 +1283,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 +1293,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 +1303,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 +1311,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 +1334,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 +1342,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 +1368,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 +1376,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 +1400,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 +1443,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 +1477,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 +1499,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 +1523,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 +1615,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 +1676,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 +1854,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 +1877,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 +1897,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 +1929,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 +1947,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 +1969,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 +2007,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 +2076,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 +2086,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 +2095,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 +2117,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 +2148,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 +2164,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..ab81d23 100644
--- a/src/object/task/taskinfo.cpp
+++ b/src/object/task/taskinfo.cpp
@@ -16,13 +16,10 @@
// 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"
@@ -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 171be1d..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,7 +131,7 @@ 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.
@@ -139,7 +139,7 @@ Error CTaskManager::StartTaskSearch()
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(const char *name, float value, float power, bo
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/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..f6dc897 100644
--- a/src/object/task/taskshield.cpp
+++ b/src/object/task/taskshield.cpp
@@ -16,14 +16,12 @@
// 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"
@@ -56,32 +54,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 +101,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 +121,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 +149,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 +184,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 +196,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 +238,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 +268,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 +295,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 +314,7 @@ Error CTaskShield::Stop()
m_camera->StopCentering(m_object, 4.0f);
- if ( m_object->RetSelect() )
+ if ( m_object->GetSelect() )
{
m_brain->UpdateInterface();
}
@@ -335,21 +333,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 +381,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 +460,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 +479,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 +522,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 +547,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;
}