summaryrefslogtreecommitdiffstats
path: root/src/object/motion/motionworm.cpp
diff options
context:
space:
mode:
authorPiotr Dziwinski <piotrdz@gmail.com>2012-06-19 20:11:47 +0200
committerPiotr Dziwinski <piotrdz@gmail.com>2012-06-19 20:11:47 +0200
commit9f784e81f81651bed087902f9f3afee113e56148 (patch)
treeae89f6dabe2443b39aba292673027d197fc120e6 /src/object/motion/motionworm.cpp
parentb8027ce9a7f050b95846a668a02f5801331e127f (diff)
downloadcolobot-9f784e81f81651bed087902f9f3afee113e56148.tar.gz
colobot-9f784e81f81651bed087902f9f3afee113e56148.tar.bz2
colobot-9f784e81f81651bed087902f9f3afee113e56148.zip
Switched to new implementation of the rest of math module
- changed structs from D3DVECTOR to Math::Vector and from D3DMATRIX to Math::Matrix - changed functions to new Math namespace functions - moved mainmovie module from graphics to object - added Get and Set to Math::Matrix
Diffstat (limited to 'src/object/motion/motionworm.cpp')
-rw-r--r--src/object/motion/motionworm.cpp20
1 files changed, 10 insertions, 10 deletions
diff --git a/src/object/motion/motionworm.cpp b/src/object/motion/motionworm.cpp
index ab3f946..0918a0f 100644
--- a/src/object/motion/motionworm.cpp
+++ b/src/object/motion/motionworm.cpp
@@ -87,7 +87,7 @@ void CMotionWorm::DeleteObject(bool bAll)
// Creates a vehicle traveling any lands on the ground.
-bool CMotionWorm::Create(D3DVECTOR pos, float angle, ObjectType type,
+bool CMotionWorm::Create(Math::Vector pos, float angle, ObjectType type,
float power)
{
CModFile* pModFile;
@@ -110,8 +110,8 @@ bool CMotionWorm::Create(D3DVECTOR pos, float angle, ObjectType type,
m_object->SetAngleY(0, angle);
// A vehicle must have a obligatory collision with a sphere of center (0, y, 0) (see GetCrashSphere).
- m_object->CreateCrashSphere(D3DVECTOR(0.0f, 0.0f, 0.0f), 4.0f, SOUND_BOUM, 0.20f);
- m_object->SetGlobalSphere(D3DVECTOR(0.0f, 0.0f, 0.0f), 5.0f);
+ m_object->CreateCrashSphere(Math::Vector(0.0f, 0.0f, 0.0f), 4.0f, SOUND_BOUM, 0.20f);
+ m_object->SetGlobalSphere(Math::Vector(0.0f, 0.0f, 0.0f), 5.0f);
px = 1.0f+WORM_PART/2;
@@ -122,7 +122,7 @@ bool CMotionWorm::Create(D3DVECTOR pos, float angle, ObjectType type,
m_object->SetObjectParent(1, 0);
pModFile->ReadModel("objects\\worm1.mod");
pModFile->CreateEngineObject(rank);
- m_object->SetPosition(1, D3DVECTOR(px, 0.0f, 0.0f));
+ m_object->SetPosition(1, Math::Vector(px, 0.0f, 0.0f));
px -= 1.0f;
// Creates the body.
@@ -134,7 +134,7 @@ bool CMotionWorm::Create(D3DVECTOR pos, float angle, ObjectType type,
m_object->SetObjectParent(2+i, 0);
pModFile->ReadModel("objects\\worm2.mod");
pModFile->CreateEngineObject(rank);
- m_object->SetPosition(2+i, D3DVECTOR(px, 0.0f, 0.0f));
+ m_object->SetPosition(2+i, Math::Vector(px, 0.0f, 0.0f));
px -= 1.0f;
}
@@ -145,7 +145,7 @@ bool CMotionWorm::Create(D3DVECTOR pos, float angle, ObjectType type,
m_object->SetObjectParent(2+WORM_PART, 0);
pModFile->ReadModel("objects\\worm3.mod");
pModFile->CreateEngineObject(rank);
- m_object->SetPosition(2+WORM_PART, D3DVECTOR(px, 0.0f, 0.0f));
+ m_object->SetPosition(2+WORM_PART, Math::Vector(px, 0.0f, 0.0f));
m_object->CreateShadowCircle(0.0f, 1.0f, D3DSHADOWWORM);
@@ -246,8 +246,8 @@ bool CMotionWorm::EventProcess(const Event &event)
bool CMotionWorm::EventFrame(const Event &event)
{
- D3DMATRIX* mat;
- D3DVECTOR pos, p, angle, speed;
+ Math::Matrix* mat;
+ Math::Vector pos, p, angle, speed;
Math::Point center, pp, dim;
float height[WORM_PART+2];
float floor, a, s, px, curve, phase, h, zoom, radius;
@@ -346,7 +346,7 @@ bool CMotionWorm::EventFrame(const Event &event)
pos.y += -height[i];
pos.x += (Math::Rand()-0.5f)*4.0f;
pos.z += (Math::Rand()-0.5f)*4.0f;
- speed = D3DVECTOR(0.0f, 0.0f, 0.0f);
+ 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);
@@ -360,7 +360,7 @@ bool CMotionWorm::EventFrame(const Event &event)
pos = m_object->RetPosition(i+2);
pos -= m_object->RetPosition(i+1);
- angle.z = -Math::RotateAngle(Length(pos.x, pos.z), pos.y);
+ angle.z = -Math::RotateAngle(Math::Point(pos.x, pos.z).Length(), pos.y);
angle.y = Math::PI-Math::RotateAngle(pos.x, pos.z);
angle.x = 0.0f;
m_object->SetAngle(i+1, angle);