summaryrefslogtreecommitdiffstats
path: root/src/object/auto
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/auto
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/auto')
-rw-r--r--src/object/auto/autobase.cpp116
-rw-r--r--src/object/auto/autobase.h8
-rw-r--r--src/object/auto/autoconvert.cpp16
-rw-r--r--src/object/auto/autoderrick.cpp25
-rw-r--r--src/object/auto/autoderrick.h6
-rw-r--r--src/object/auto/autodestroyer.cpp18
-rw-r--r--src/object/auto/autoegg.cpp5
-rw-r--r--src/object/auto/autoenergy.cpp16
-rw-r--r--src/object/auto/autofactory.cpp33
-rw-r--r--src/object/auto/autofactory.h2
-rw-r--r--src/object/auto/autoflag.cpp4
-rw-r--r--src/object/auto/autohuston.cpp44
-rw-r--r--src/object/auto/autohuston.h2
-rw-r--r--src/object/auto/autoinfo.cpp8
-rw-r--r--src/object/auto/autoinfo.h2
-rw-r--r--src/object/auto/autojostle.cpp4
-rw-r--r--src/object/auto/autokid.cpp4
-rw-r--r--src/object/auto/autolabo.cpp12
-rw-r--r--src/object/auto/automush.cpp12
-rw-r--r--src/object/auto/autonest.cpp16
-rw-r--r--src/object/auto/autonest.h6
-rw-r--r--src/object/auto/autonuclear.cpp17
-rw-r--r--src/object/auto/autonuclear.h2
-rw-r--r--src/object/auto/autopara.cpp11
-rw-r--r--src/object/auto/autopara.h2
-rw-r--r--src/object/auto/autoportico.cpp8
-rw-r--r--src/object/auto/autoportico.h4
-rw-r--r--src/object/auto/autoradar.cpp8
-rw-r--r--src/object/auto/autoradar.h2
-rw-r--r--src/object/auto/autorepair.cpp6
-rw-r--r--src/object/auto/autoresearch.cpp11
-rw-r--r--src/object/auto/autoroot.cpp13
-rw-r--r--src/object/auto/autoroot.h2
-rw-r--r--src/object/auto/autosafe.cpp26
-rw-r--r--src/object/auto/autosafe.h2
-rw-r--r--src/object/auto/autostation.cpp13
-rw-r--r--src/object/auto/autostation.h2
-rw-r--r--src/object/auto/autotower.cpp16
-rw-r--r--src/object/auto/autotower.h4
39 files changed, 258 insertions, 250 deletions
diff --git a/src/object/auto/autobase.cpp b/src/object/auto/autobase.cpp
index 2091091..abd231f 100644
--- a/src/object/auto/autobase.cpp
+++ b/src/object/auto/autobase.cpp
@@ -127,10 +127,10 @@ void CAutoBase::Start(int param)
bool CAutoBase::EventProcess(const Event &event)
{
- D3DMATRIX* mat;
+ Math::Matrix* mat;
Event newEvent;
CObject* pObj;
- D3DVECTOR pos, speed, vibCir, iPos;
+ Math::Vector pos, speed, vibCir, iPos;
Math::Point dim, p;
Error err;
float angle, dist, time, h, len, vSpeed;
@@ -162,8 +162,8 @@ begin:
m_object->SetAngleZ(1+i, Math::PI/2.0f-124.0f*Math::PI/180.0f);
m_object->SetAngleX(10+i, -10.0f*Math::PI/180.0f);
m_object->SetAngleX(18+i, 10.0f*Math::PI/180.0f);
- m_object->SetPosition(10+i, D3DVECTOR(23.5f, 0.0f, -11.5f));
- m_object->SetPosition(18+i, D3DVECTOR(23.5f, 0.0f, 11.5f));
+ m_object->SetPosition(10+i, Math::Vector(23.5f, 0.0f, -11.5f));
+ m_object->SetPosition(18+i, Math::Vector(23.5f, 0.0f, 11.5f));
}
pObj = m_main->RetSelectObject();
@@ -193,8 +193,8 @@ begin:
m_object->SetAngleZ(1+i, Math::PI/2.0f-124.0f*Math::PI/180.0f);
m_object->SetAngleX(10+i, -10.0f*Math::PI/180.0f);
m_object->SetAngleX(18+i, 10.0f*Math::PI/180.0f);
- m_object->SetPosition(10+i, D3DVECTOR(23.5f, 0.0f, -11.5f));
- m_object->SetPosition(18+i, D3DVECTOR(23.5f, 0.0f, 11.5f));
+ m_object->SetPosition(10+i, Math::Vector(23.5f, 0.0f, -11.5f));
+ m_object->SetPosition(18+i, Math::Vector(23.5f, 0.0f, 11.5f));
}
}
@@ -280,31 +280,31 @@ begin:
BeginTransit();
mat = m_object->RetWorldMatrix(0);
- speed = D3DVECTOR(0.0f, 0.0f, 0.0f);
+ speed = Math::Vector(0.0f, 0.0f, 0.0f);
dim.x = 10.0f;
dim.y = dim.x;
- pos = D3DVECTOR(42.0f, -2.0f, 17.0f);
+ pos = Math::Vector(42.0f, -2.0f, 17.0f);
pos = Transform(*mat, pos);
m_partiChannel[0] = m_particule->CreateParticule(pos, speed, dim, PARTILENS1, BASE_TRANSIT_TIME+1.0f, 0.0f, 0.0f);
- pos = D3DVECTOR(17.0f, -2.0f, 42.0f);
+ pos = Math::Vector(17.0f, -2.0f, 42.0f);
pos = Transform(*mat, pos);
m_partiChannel[1] = m_particule->CreateParticule(pos, speed, dim, PARTILENS1, BASE_TRANSIT_TIME+1.0f, 0.0f, 0.0f);
- pos = D3DVECTOR(42.0f, -2.0f, -17.0f);
+ pos = Math::Vector(42.0f, -2.0f, -17.0f);
pos = Transform(*mat, pos);
m_partiChannel[2] = m_particule->CreateParticule(pos, speed, dim, PARTILENS1, BASE_TRANSIT_TIME+1.0f, 0.0f, 0.0f);
- pos = D3DVECTOR(17.0f, -2.0f, -42.0f);
+ pos = Math::Vector(17.0f, -2.0f, -42.0f);
pos = Transform(*mat, pos);
m_partiChannel[3] = m_particule->CreateParticule(pos, speed, dim, PARTILENS1, BASE_TRANSIT_TIME+1.0f, 0.0f, 0.0f);
- pos = D3DVECTOR(-42.0f, -2.0f, 17.0f);
+ pos = Math::Vector(-42.0f, -2.0f, 17.0f);
pos = Transform(*mat, pos);
m_partiChannel[4] = m_particule->CreateParticule(pos, speed, dim, PARTILENS1, BASE_TRANSIT_TIME+1.0f, 0.0f, 0.0f);
- pos = D3DVECTOR(-17.0f, -2.0f, 42.0f);
+ pos = Math::Vector(-17.0f, -2.0f, 42.0f);
pos = Transform(*mat, pos);
m_partiChannel[5] = m_particule->CreateParticule(pos, speed, dim, PARTILENS1, BASE_TRANSIT_TIME+1.0f, 0.0f, 0.0f);
- pos = D3DVECTOR(-42.0f, -2.0f, -17.0f);
+ pos = Math::Vector(-42.0f, -2.0f, -17.0f);
pos = Transform(*mat, pos);
m_partiChannel[6] = m_particule->CreateParticule(pos, speed, dim, PARTILENS1, BASE_TRANSIT_TIME+1.0f, 0.0f, 0.0f);
- pos = D3DVECTOR(-17.0f, -2.0f, -42.0f);
+ pos = Math::Vector(-17.0f, -2.0f, -42.0f);
pos = Transform(*mat, pos);
m_partiChannel[7] = m_particule->CreateParticule(pos, speed, dim, PARTILENS1, BASE_TRANSIT_TIME+1.0f, 0.0f, 0.0f);
@@ -459,7 +459,7 @@ begin:
m_bMotor = false; // put out the reactor
m_object->SetPosition(0, m_pos); // setting down
- m_object->SetCirVibration(D3DVECTOR(0.0f, 0.0f, 0.0f));
+ m_object->SetCirVibration(Math::Vector(0.0f, 0.0f, 0.0f));
MoveCargo(); // all cargo moves
// Impact with the ground.
@@ -471,7 +471,7 @@ begin:
pos = m_pos;
pos.x += p.x;
pos.z += p.y;
- speed = D3DVECTOR(0.0f, 0.0f, 0.0f);
+ speed = Math::Vector(0.0f, 0.0f, 0.0f);
dim.x = Math::Rand()*10.0f+10.0f;
dim.y = dim.x;
time = Math::Rand()*2.0f+1.5f;
@@ -565,7 +565,7 @@ begin:
pos = m_pos;
pos.x += p.x;
pos.z += p.y;
- speed = D3DVECTOR(0.0f, 0.0f, 0.0f);
+ speed = Math::Vector(0.0f, 0.0f, 0.0f);
dim.x = Math::Rand()*8.0f+8.0f;
dim.y = dim.x;
time = Math::Rand()*2.0f+1.5f;
@@ -589,8 +589,8 @@ begin:
len = 7.0f-m_progress*(7.0f+11.5f);
for ( i=0 ; i<8 ; i++ )
{
- m_object->SetPosition(10+i, D3DVECTOR(23.5f, 0.0f, len));
- m_object->SetPosition(18+i, D3DVECTOR(23.5f, 0.0f, -len));
+ m_object->SetPosition(10+i, Math::Vector(23.5f, 0.0f, len));
+ m_object->SetPosition(18+i, Math::Vector(23.5f, 0.0f, -len));
m_object->SetAngleX(10+i, -10.0f*Math::PI/180.0f*m_progress);
m_object->SetAngleX(18+i, 10.0f*Math::PI/180.0f*m_progress);
}
@@ -614,8 +614,8 @@ begin:
{
for ( i=0 ; i<8 ; i++ )
{
- m_object->SetPosition(10+i, D3DVECTOR(23.5f, 0.0f, -11.5f));
- m_object->SetPosition(18+i, D3DVECTOR(23.5f, 0.0f, 11.5f));
+ m_object->SetPosition(10+i, Math::Vector(23.5f, 0.0f, -11.5f));
+ m_object->SetPosition(18+i, Math::Vector(23.5f, 0.0f, 11.5f));
m_object->SetAngleX(10+i, -10.0f*Math::PI/180.0f);
m_object->SetAngleX(18+i, 10.0f*Math::PI/180.0f);
}
@@ -668,8 +668,8 @@ begin:
len = 7.0f-(1.0f-m_progress)*(7.0f+11.5f);
for ( i=0 ; i<8 ; i++ )
{
- m_object->SetPosition(10+i, D3DVECTOR(23.5f, 0.0f, len));
- m_object->SetPosition(18+i, D3DVECTOR(23.5f, 0.0f, -len));
+ m_object->SetPosition(10+i, Math::Vector(23.5f, 0.0f, len));
+ m_object->SetPosition(18+i, Math::Vector(23.5f, 0.0f, -len));
m_object->SetAngleX(10+i, -10.0f*Math::PI/180.0f*(1.0f-m_progress));
m_object->SetAngleX(18+i, 10.0f*Math::PI/180.0f*(1.0f-m_progress));
}
@@ -678,8 +678,8 @@ begin:
{
for ( i=0 ; i<8 ; i++ )
{
- m_object->SetPosition(10+i, D3DVECTOR(23.5f, 0.0f, 7.0f));
- m_object->SetPosition(18+i, D3DVECTOR(23.5f, 0.0f, -7.0f));
+ m_object->SetPosition(10+i, Math::Vector(23.5f, 0.0f, 7.0f));
+ m_object->SetPosition(18+i, Math::Vector(23.5f, 0.0f, -7.0f));
m_object->SetAngleX(10+i, 0.0f);
m_object->SetAngleX(18+i, 0.0f);
}
@@ -723,7 +723,7 @@ begin:
pos.x += p.x;
pos.z += p.y;
pos.y += 85.0f;
- speed = D3DVECTOR(0.0f, 0.0f, 0.0f);
+ speed = Math::Vector(0.0f, 0.0f, 0.0f);
dim.x = Math::Rand()*3.0f+3.0f;
dim.y = dim.x;
time = Math::Rand()*1.0f+1.0f;
@@ -912,7 +912,7 @@ begin:
pos = m_pos;
pos.x += p.x;
pos.z += p.y;
- speed = D3DVECTOR(0.0f, 0.0f, 0.0f);
+ speed = Math::Vector(0.0f, 0.0f, 0.0f);
dim.x = Math::Rand()*10.0f+10.0f;
dim.y = dim.x;
time = Math::Rand()*2.0f+1.5f;
@@ -1005,7 +1005,7 @@ begin:
if ( vSpeed < 0.0f ) vSpeed *= 1.5f;
}
- pos = D3DVECTOR(0.0f, 6.0f, 0.0f);
+ pos = Math::Vector(0.0f, 6.0f, 0.0f);
speed.x = (Math::Rand()-0.5f)*4.0f;
speed.z = (Math::Rand()-0.5f)*4.0f;
speed.y = vSpeed*0.8f-(8.0f+Math::Rand()*6.0f);
@@ -1021,72 +1021,72 @@ begin:
if ( m_phase == ABP_TRANSIT_MOVE )
{
- speed = D3DVECTOR(0.0f, 0.0f, 0.0f);
+ speed = Math::Vector(0.0f, 0.0f, 0.0f);
dim.x = 12.0f;
dim.y = dim.x;
- pos = D3DVECTOR(0.0f, 7.0f, 0.0f);
+ pos = Math::Vector(0.0f, 7.0f, 0.0f);
pos.x += (Math::Rand()-0.5f)*2.0f; pos.z += (Math::Rand()-0.5f)*2.0f;
pos = Transform(*mat, pos);
m_particule->CreateParticule(pos, speed, dim, PARTIGAS, 1.0f, 0.0f, 0.0f);
- speed = D3DVECTOR(0.0f, 0.0f, 0.0f);
+ speed = Math::Vector(0.0f, 0.0f, 0.0f);
dim.x = 4.0f;
dim.y = dim.x;
- pos = D3DVECTOR(42.0f, 0.0f, 17.0f);
+ pos = Math::Vector(42.0f, 0.0f, 17.0f);
pos.x += (Math::Rand()-0.5f)*2.0f; pos.z += (Math::Rand()-0.5f)*2.0f;
pos = Transform(*mat, pos);
m_particule->CreateParticule(pos, speed, dim, PARTIGAS, 0.5f, 0.0f, 0.0f);
- pos = D3DVECTOR(17.0f, 0.0f, 42.0f);
+ pos = Math::Vector(17.0f, 0.0f, 42.0f);
pos.x += (Math::Rand()-0.5f)*2.0f; pos.z += (Math::Rand()-0.5f)*2.0f;
pos = Transform(*mat, pos);
m_particule->CreateParticule(pos, speed, dim, PARTIGAS, 0.5f, 0.0f, 0.0f);
- pos = D3DVECTOR(42.0f, 0.0f, -17.0f);
+ pos = Math::Vector(42.0f, 0.0f, -17.0f);
pos.x += (Math::Rand()-0.5f)*2.0f; pos.z += (Math::Rand()-0.5f)*2.0f;
pos = Transform(*mat, pos);
m_particule->CreateParticule(pos, speed, dim, PARTIGAS, 0.5f, 0.0f, 0.0f);
- pos = D3DVECTOR(17.0f, 0.0f, -42.0f);
+ pos = Math::Vector(17.0f, 0.0f, -42.0f);
pos.x += (Math::Rand()-0.5f)*2.0f; pos.z += (Math::Rand()-0.5f)*2.0f;
pos = Transform(*mat, pos);
m_particule->CreateParticule(pos, speed, dim, PARTIGAS, 0.5f, 0.0f, 0.0f);
- pos = D3DVECTOR(-42.0f, 0.0f, 17.0f);
+ pos = Math::Vector(-42.0f, 0.0f, 17.0f);
pos.x += (Math::Rand()-0.5f)*2.0f; pos.z += (Math::Rand()-0.5f)*2.0f;
pos = Transform(*mat, pos);
m_particule->CreateParticule(pos, speed, dim, PARTIGAS, 0.5f, 0.0f, 0.0f);
- pos = D3DVECTOR(-17.0f, 0.0f, 42.0f);
+ pos = Math::Vector(-17.0f, 0.0f, 42.0f);
pos.x += (Math::Rand()-0.5f)*2.0f; pos.z += (Math::Rand()-0.5f)*2.0f;
pos = Transform(*mat, pos);
m_particule->CreateParticule(pos, speed, dim, PARTIGAS, 0.5f, 0.0f, 0.0f);
- pos = D3DVECTOR(-42.0f, 0.0f, -17.0f);
+ pos = Math::Vector(-42.0f, 0.0f, -17.0f);
pos.x += (Math::Rand()-0.5f)*2.0f; pos.z += (Math::Rand()-0.5f)*2.0f;
pos = Transform(*mat, pos);
m_particule->CreateParticule(pos, speed, dim, PARTIGAS, 0.5f, 0.0f, 0.0f);
- pos = D3DVECTOR(-17.0f, 0.0f, -42.0f);
+ pos = Math::Vector(-17.0f, 0.0f, -42.0f);
pos.x += (Math::Rand()-0.5f)*2.0f; pos.z += (Math::Rand()-0.5f)*2.0f;
pos = Transform(*mat, pos);
m_particule->CreateParticule(pos, speed, dim, PARTIGAS, 0.5f, 0.0f, 0.0f);
- pos = D3DVECTOR(42.0f, -2.0f, 17.0f);
+ pos = Math::Vector(42.0f, -2.0f, 17.0f);
pos = Transform(*mat, pos);
m_particule->SetPosition(m_partiChannel[0], pos);
- pos = D3DVECTOR(17.0f, -2.0f, 42.0f);
+ pos = Math::Vector(17.0f, -2.0f, 42.0f);
pos = Transform(*mat, pos);
m_particule->SetPosition(m_partiChannel[1], pos);
- pos = D3DVECTOR(42.0f, -2.0f, -17.0f);
+ pos = Math::Vector(42.0f, -2.0f, -17.0f);
pos = Transform(*mat, pos);
m_particule->SetPosition(m_partiChannel[2], pos);
- pos = D3DVECTOR(17.0f, -2.0f, -42.0f);
+ pos = Math::Vector(17.0f, -2.0f, -42.0f);
pos = Transform(*mat, pos);
m_particule->SetPosition(m_partiChannel[3], pos);
- pos = D3DVECTOR(-42.0f, -2.0f, 17.0f);
+ pos = Math::Vector(-42.0f, -2.0f, 17.0f);
pos = Transform(*mat, pos);
m_particule->SetPosition(m_partiChannel[4], pos);
- pos = D3DVECTOR(-17.0f, -2.0f, 42.0f);
+ pos = Math::Vector(-17.0f, -2.0f, 42.0f);
pos = Transform(*mat, pos);
m_particule->SetPosition(m_partiChannel[5], pos);
- pos = D3DVECTOR(-42.0f, -2.0f, -17.0f);
+ pos = Math::Vector(-42.0f, -2.0f, -17.0f);
pos = Transform(*mat, pos);
m_particule->SetPosition(m_partiChannel[6], pos);
- pos = D3DVECTOR(-17.0f, -2.0f, -42.0f);
+ pos = Math::Vector(-17.0f, -2.0f, -42.0f);
pos = Transform(*mat, pos);
m_particule->SetPosition(m_partiChannel[7], pos);
}
@@ -1140,8 +1140,8 @@ bool CAutoBase::Abort()
m_object->SetAngleZ(1+i, Math::PI/2.0f-124.0f*Math::PI/180.0f);
m_object->SetAngleX(10+i, -10.0f*Math::PI/180.0f);
m_object->SetAngleX(18+i, 10.0f*Math::PI/180.0f);
- m_object->SetPosition(10+i, D3DVECTOR(23.5f, 0.0f, -11.5f));
- m_object->SetPosition(18+i, D3DVECTOR(23.5f, 0.0f, 11.5f));
+ m_object->SetPosition(10+i, Math::Vector(23.5f, 0.0f, -11.5f));
+ m_object->SetPosition(18+i, Math::Vector(23.5f, 0.0f, 11.5f));
}
}
else
@@ -1155,15 +1155,15 @@ bool CAutoBase::Abort()
m_bOpen = true;
m_object->SetPosition(0, m_pos); // setting down
- m_object->SetCirVibration(D3DVECTOR(0.0f, 0.0f, 0.0f));
+ m_object->SetCirVibration(Math::Vector(0.0f, 0.0f, 0.0f));
MoveCargo(); // all cargo moves
for ( i=0 ; i<8 ; i++ )
{
m_object->SetAngleZ(1+i, Math::PI/2.0f-124.0f*Math::PI/180.0f);
m_object->SetAngleX(10+i, -10.0f*Math::PI/180.0f);
m_object->SetAngleX(18+i, 10.0f*Math::PI/180.0f);
- m_object->SetPosition(10+i, D3DVECTOR(23.5f, 0.0f, -11.5f));
- m_object->SetPosition(18+i, D3DVECTOR(23.5f, 0.0f, 11.5f));
+ m_object->SetPosition(10+i, Math::Vector(23.5f, 0.0f, -11.5f));
+ m_object->SetPosition(18+i, Math::Vector(23.5f, 0.0f, 11.5f));
}
m_main->SetMovieLock(false); // you can play!
@@ -1294,7 +1294,7 @@ void CAutoBase::FreezeCargo(bool bFreeze)
{
CObject* pObj;
CPhysics* physics;
- D3DVECTOR oPos;
+ Math::Vector oPos;
float dist;
int i;
@@ -1309,7 +1309,7 @@ void CAutoBase::FreezeCargo(bool bFreeze)
if ( pObj->RetTruck() != 0 ) continue; // transport object?
oPos = pObj->RetPosition(0);
- dist = Length2d(m_pos, oPos);
+ dist = Math::DistanceProjected(m_pos, oPos);
if ( dist < 32.0f )
{
if ( bFreeze )
@@ -1331,7 +1331,7 @@ void CAutoBase::FreezeCargo(bool bFreeze)
void CAutoBase::MoveCargo()
{
CObject* pObj;
- D3DVECTOR oPos, sPos;
+ Math::Vector oPos, sPos;
int i;
sPos = m_object->RetPosition(0);
@@ -1360,7 +1360,7 @@ void CAutoBase::MoveCargo()
Error CAutoBase::CheckCloseDoor()
{
CObject* pObj;
- D3DVECTOR oPos;
+ Math::Vector oPos;
ObjectType type;
float oRad, dist;
int i, j;
@@ -1379,7 +1379,7 @@ Error CAutoBase::CheckCloseDoor()
j = 0;
while ( pObj->GetCrashSphere(j++, oPos, oRad) )
{
- dist = Length2d(m_pos, oPos);
+ dist = Math::DistanceProjected(m_pos, oPos);
if ( dist+oRad > 32.0f &&
dist-oRad < 72.0f )
{
diff --git a/src/object/auto/autobase.h b/src/object/auto/autobase.h
index 513f16e..aed5a47 100644
--- a/src/object/auto/autobase.h
+++ b/src/object/auto/autobase.h
@@ -102,10 +102,10 @@ protected:
float m_lastMotorParticule;
float m_fogStart;
float m_deepView;
- D3DVECTOR m_pos;
- D3DVECTOR m_posSound;
- D3DVECTOR m_finalPos;
- D3DVECTOR m_lastPos;
+ Math::Vector m_pos;
+ Math::Vector m_posSound;
+ Math::Vector m_finalPos;
+ Math::Vector m_lastPos;
int m_param;
int m_soundChannel;
int m_partiChannel[8];
diff --git a/src/object/auto/autoconvert.cpp b/src/object/auto/autoconvert.cpp
index 75dcc9c..ef5fbb1 100644
--- a/src/object/auto/autoconvert.cpp
+++ b/src/object/auto/autoconvert.cpp
@@ -109,7 +109,7 @@ void CAutoConvert::Init()
bool CAutoConvert::EventProcess(const Event &event)
{
CObject* fret;
- D3DVECTOR pos, speed;
+ Math::Vector pos, speed;
Math::Point dim, c, p;
float angle;
@@ -230,7 +230,7 @@ bool CAutoConvert::EventProcess(const Event &event)
pos.x = p.x;
pos.z = p.y;
pos.y += 1.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.0f;
dim.y = dim.x;
m_particule->CreateParticule(pos, speed, dim, PARTIGAS, 1.0f, 0.0f, 0.0f);
@@ -276,7 +276,7 @@ bool CAutoConvert::EventProcess(const Event &event)
pos.x += (Math::Rand()-0.5f)*6.0f;
pos.z += (Math::Rand()-0.5f)*6.0f;
pos.y += Math::Rand()*4.0f;
- speed = D3DVECTOR(0.0f, 0.0f, 0.0f);
+ speed = Math::Vector(0.0f, 0.0f, 0.0f);
dim.x = Math::Rand()*4.0f+3.0f;
dim.y = dim.x;
m_particule->CreateParticule(pos, speed, dim, PARTIBLUE, 1.0f, 0.0f, 0.0f);
@@ -420,7 +420,7 @@ bool CAutoConvert::Read(char *line)
CObject* CAutoConvert::SearchStone(ObjectType type)
{
CObject* pObj;
- D3DVECTOR cPos, oPos;
+ Math::Vector cPos, oPos;
ObjectType oType;
float dist;
int i;
@@ -437,7 +437,7 @@ CObject* CAutoConvert::SearchStone(ObjectType type)
if ( pObj->RetTruck() != 0 ) continue;
oPos = pObj->RetPosition(0);
- dist = Length(oPos, cPos);
+ dist = Math::Distance(oPos, cPos);
if ( dist <= 5.0f ) return pObj;
}
@@ -450,7 +450,7 @@ CObject* CAutoConvert::SearchStone(ObjectType type)
bool CAutoConvert::SearchVehicle()
{
CObject* pObj;
- D3DVECTOR cPos, oPos;
+ Math::Vector cPos, oPos;
ObjectType type;
float oRadius, dist;
int i;
@@ -505,7 +505,7 @@ bool CAutoConvert::SearchVehicle()
type != OBJECT_WORM ) continue;
if ( !pObj->GetCrashSphere(0, oPos, oRadius) ) continue;
- dist = Length(oPos, cPos)-oRadius;
+ dist = Math::Distance(oPos, cPos)-oRadius;
if ( dist < 8.0f ) return true;
}
@@ -517,7 +517,7 @@ bool CAutoConvert::SearchVehicle()
void CAutoConvert::CreateMetal()
{
- D3DVECTOR pos;
+ Math::Vector pos;
float angle;
CObject* fret;
diff --git a/src/object/auto/autoderrick.cpp b/src/object/auto/autoderrick.cpp
index 7f40da0..3e33466 100644
--- a/src/object/auto/autoderrick.cpp
+++ b/src/object/auto/autoderrick.cpp
@@ -20,6 +20,7 @@
#include <d3d.h>
#include "common/struct.h"
+#include "math/geometry.h"
#include "graphics/d3d/d3dengine.h"
#include "math/old/d3dmath.h"
#include "common/event.h"
@@ -95,8 +96,8 @@ void CAutoDerrick::DeleteObject(bool bAll)
void CAutoDerrick::Init()
{
- D3DMATRIX* mat;
- D3DVECTOR pos;
+ Math::Matrix* mat;
+ Math::Vector pos;
TerrainRes res;
pos = m_object->RetPosition(0);
@@ -133,9 +134,9 @@ void CAutoDerrick::Init()
m_lastParticule = 0.0f;
m_lastTrack = 0.0f;
- pos = D3DVECTOR(7.0f, 0.0f, 0.0f);
+ pos = Math::Vector(7.0f, 0.0f, 0.0f);
mat = m_object->RetWorldMatrix(0);
- pos = Transform(*mat, pos);
+ pos = Math::Transform(*mat, pos);
m_terrain->MoveOnFloor(pos);
m_fretPos = pos;
}
@@ -146,7 +147,7 @@ void CAutoDerrick::Init()
bool CAutoDerrick::EventProcess(const Event &event)
{
CObject* fret;
- D3DVECTOR pos, speed;
+ Math::Vector pos, speed;
Math::Point dim;
float angle, duration, factor;
@@ -345,7 +346,7 @@ bool CAutoDerrick::EventProcess(const Event &event)
pos.x += (Math::Rand()-0.5f)*5.0f;
pos.z += (Math::Rand()-0.5f)*5.0f;
pos.y += (Math::Rand()-0.5f)*5.0f;
- speed = D3DVECTOR(0.0f, 0.0f, 0.0f);
+ speed = Math::Vector(0.0f, 0.0f, 0.0f);
dim.x = 3.0f;
dim.y = dim.x;
m_particule->CreateParticule(pos, speed, dim, PARTIFIRE, 1.0f, 0.0f, 0.0f);
@@ -356,7 +357,7 @@ bool CAutoDerrick::EventProcess(const Event &event)
pos.x += (Math::Rand()-0.5f)*5.0f;
pos.z += (Math::Rand()-0.5f)*5.0f;
pos.y += Math::Rand()*2.5f;
- speed = D3DVECTOR(0.0f, 0.0f, 0.0f);
+ speed = Math::Vector(0.0f, 0.0f, 0.0f);
dim.x = 1.0f;
dim.y = dim.x;
m_particule->CreateParticule(pos, speed, dim, PARTIGLINT, 2.0f, 0.0f, 0.0f);
@@ -481,7 +482,7 @@ bool CAutoDerrick::Read(char *line)
CObject* CAutoDerrick::SearchFret()
{
CObject* pObj;
- D3DVECTOR oPos;
+ Math::Vector oPos;
ObjectType type;
int i;
@@ -504,10 +505,10 @@ CObject* CAutoDerrick::SearchFret()
// Seeks if a site is free.
-bool CAutoDerrick::SearchFree(D3DVECTOR pos)
+bool CAutoDerrick::SearchFree(Math::Vector pos)
{
CObject* pObj;
- D3DVECTOR sPos;
+ Math::Vector sPos;
ObjectType type;
float sRadius, distance;
int i, j;
@@ -523,7 +524,7 @@ bool CAutoDerrick::SearchFree(D3DVECTOR pos)
j = 0;
while ( pObj->GetCrashSphere(j++, sPos, sRadius) )
{
- distance = Length(sPos, pos);
+ distance = Math::Distance(sPos, pos);
distance -= sRadius;
if ( distance < 2.0f ) return false; // location occupied
}
@@ -534,7 +535,7 @@ bool CAutoDerrick::SearchFree(D3DVECTOR pos)
// Create a transportable object.
-void CAutoDerrick::CreateFret(D3DVECTOR pos, float angle, ObjectType type,
+void CAutoDerrick::CreateFret(Math::Vector pos, float angle, ObjectType type,
float height)
{
CObject* fret;
diff --git a/src/object/auto/autoderrick.h b/src/object/auto/autoderrick.h
index 9306a86..fb39bc3 100644
--- a/src/object/auto/autoderrick.h
+++ b/src/object/auto/autoderrick.h
@@ -63,8 +63,8 @@ public:
protected:
CObject* SearchFret();
- bool SearchFree(D3DVECTOR pos);
- void CreateFret(D3DVECTOR pos, float angle, ObjectType type, float height);
+ bool SearchFree(Math::Vector pos);
+ void CreateFret(Math::Vector pos, float angle, ObjectType type, float height);
bool ExistKey();
protected:
@@ -74,7 +74,7 @@ protected:
float m_timeVirus;
float m_lastParticule;
float m_lastTrack;
- D3DVECTOR m_fretPos;
+ Math::Vector m_fretPos;
int m_soundChannel;
bool m_bSoundFall;
};
diff --git a/src/object/auto/autodestroyer.cpp b/src/object/auto/autodestroyer.cpp
index b7c1221..76648f1 100644
--- a/src/object/auto/autodestroyer.cpp
+++ b/src/object/auto/autodestroyer.cpp
@@ -91,7 +91,7 @@ bool CAutoDestroyer::EventProcess(const Event &event)
{
CObject* scrap;
CPyro* pyro;
- D3DVECTOR pos, speed;
+ Math::Vector pos, speed;
Math::Point dim;
CAuto::EventProcess(event);
@@ -161,13 +161,13 @@ bool CAutoDestroyer::EventProcess(const Event &event)
if ( m_progress < 1.0f )
{
- pos = D3DVECTOR(0.0f, -10.0f, 0.0f);
+ pos = Math::Vector(0.0f, -10.0f, 0.0f);
pos.y = -Math::Bounce(m_progress, 0.3f)*10.0f;
m_object->SetPosition(1, pos);
}
else
{
- m_object->SetPosition(1, D3DVECTOR(0.0f, -10.0f, 0.0f));
+ m_object->SetPosition(1, Math::Vector(0.0f, -10.0f, 0.0f));
m_sound->Play(SOUND_REPAIR, m_object->RetPosition(0));
m_phase = ADEP_REPAIR;
@@ -195,13 +195,13 @@ bool CAutoDestroyer::EventProcess(const Event &event)
{
if ( m_progress < 1.0f )
{
- pos = D3DVECTOR(0.0f, -10.0f, 0.0f);
+ pos = Math::Vector(0.0f, -10.0f, 0.0f);
pos.y = -(1.0f-m_progress)*10.0f;
m_object->SetPosition(1, pos);
}
else
{
- m_object->SetPosition(1, D3DVECTOR(0.0f, 0.0f, 0.0f));
+ m_object->SetPosition(1, Math::Vector(0.0f, 0.0f, 0.0f));
m_phase = ADEP_WAIT;
m_progress = 0.0f;
@@ -248,7 +248,7 @@ bool CAutoDestroyer::CreateInterface(bool bSelect)
CObject* CAutoDestroyer::SearchPlastic()
{
CObject* pObj;
- D3DVECTOR sPos, oPos;
+ Math::Vector sPos, oPos;
ObjectType type;
float dist;
int i;
@@ -265,7 +265,7 @@ CObject* CAutoDestroyer::SearchPlastic()
type != OBJECT_SCRAP5 ) continue;
oPos = pObj->RetPosition(0);
- dist = Length(oPos, sPos);
+ dist = Math::Distance(oPos, sPos);
if ( dist <= 5.0f ) return pObj;
}
@@ -277,7 +277,7 @@ CObject* CAutoDestroyer::SearchPlastic()
bool CAutoDestroyer::SearchVehicle()
{
CObject* pObj;
- D3DVECTOR cPos, oPos;
+ Math::Vector cPos, oPos;
ObjectType type;
float oRadius, dist;
int i;
@@ -325,7 +325,7 @@ bool CAutoDestroyer::SearchVehicle()
type != OBJECT_WORM ) continue;
if ( !pObj->GetCrashSphere(0, oPos, oRadius) ) continue;
- dist = Length(oPos, cPos)-oRadius;
+ dist = Math::Distance(oPos, cPos)-oRadius;
if ( dist < 20.0f ) return true;
}
diff --git a/src/object/auto/autoegg.cpp b/src/object/auto/autoegg.cpp
index c6400f8..56a2899 100644
--- a/src/object/auto/autoegg.cpp
+++ b/src/object/auto/autoegg.cpp
@@ -20,6 +20,7 @@
#include <d3d.h>
#include "common/struct.h"
+#include "math/geometry.h"
#include "graphics/d3d/d3dengine.h"
#include "math/old/d3dmath.h"
#include "common/event.h"
@@ -283,7 +284,7 @@ CObject* CAutoEgg::SearchAlien()
{
CObject* pObj;
CObject* pBest;
- D3DVECTOR cPos, oPos;
+ Math::Vector cPos, oPos;
ObjectType type;
float dist, min;
int i;
@@ -305,7 +306,7 @@ CObject* CAutoEgg::SearchAlien()
type != OBJECT_WORM ) continue;
oPos = pObj->RetPosition(0);
- dist = Length2d(oPos, cPos);
+ dist = Math::DistanceProjected(oPos, cPos);
if ( dist < 8.0f && dist < min )
{
min = dist;
diff --git a/src/object/auto/autoenergy.cpp b/src/object/auto/autoenergy.cpp
index d4f4ce9..351db83 100644
--- a/src/object/auto/autoenergy.cpp
+++ b/src/object/auto/autoenergy.cpp
@@ -122,7 +122,7 @@ void CAutoEnergy::Init()
bool CAutoEnergy::EventProcess(const Event &event)
{
CObject* fret;
- D3DVECTOR pos, ppos, speed;
+ Math::Vector pos, ppos, speed;
Math::Point dim, c, p;
TerrainRes res;
float big;
@@ -201,7 +201,7 @@ bool CAutoEnergy::EventProcess(const Event &event)
pos = m_object->RetPosition(0);
pos.y += 4.0f;
- speed = D3DVECTOR(0.0f, 0.0f, 0.0f);
+ speed = Math::Vector(0.0f, 0.0f, 0.0f);
dim.x = 3.0f;
dim.y = dim.x;
m_partiSphere = m_particule->CreateParticule(pos, speed, dim, PARTISPHERE1, ENERGY_DELAY, 0.0f, 0.0f);
@@ -290,7 +290,7 @@ bool CAutoEnergy::EventProcess(const Event &event)
pos.x = p.x;
pos.z = p.y;
pos.y += 2.5f+Math::Rand()*3.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.0f;
dim.y = dim.x;
m_particule->CreateParticule(pos, speed, dim, PARTIGLINT, 1.0f, 0.0f, 0.0f);
@@ -333,7 +333,7 @@ bool CAutoEnergy::EventProcess(const Event &event)
fret->SetZoom(0, 1.0f);
fret->SetLock(false); // usable battery
fret->SetTruck(m_object);
- fret->SetPosition(0, D3DVECTOR(0.0f, 3.0f, 0.0f));
+ fret->SetPosition(0, Math::Vector(0.0f, 3.0f, 0.0f));
m_object->SetPower(fret);
m_displayText->DisplayError(INFO_ENERGY, m_object);
@@ -408,7 +408,7 @@ CObject* CAutoEnergy::SearchMetal()
bool CAutoEnergy::SearchVehicle()
{
CObject* pObj;
- D3DVECTOR cPos, oPos;
+ Math::Vector cPos, oPos;
ObjectType type;
float oRadius, dist;
int i;
@@ -456,7 +456,7 @@ bool CAutoEnergy::SearchVehicle()
type != OBJECT_WORM ) continue;
if ( !pObj->GetCrashSphere(0, oPos, oRadius) ) continue;
- dist = Length(oPos, cPos)-oRadius;
+ dist = Math::Distance(oPos, cPos)-oRadius;
if ( dist < 10.0f ) return true;
}
@@ -469,7 +469,7 @@ bool CAutoEnergy::SearchVehicle()
void CAutoEnergy::CreatePower()
{
CObject* power;
- D3DVECTOR pos;
+ Math::Vector pos;
float angle;
pos = m_object->RetPosition(0);
@@ -494,7 +494,7 @@ void CAutoEnergy::CreatePower()
CObject* CAutoEnergy::SearchPower()
{
CObject* pObj;
- D3DVECTOR cPos, oPos;
+ Math::Vector cPos, oPos;
ObjectType type;
int i;
diff --git a/src/object/auto/autofactory.cpp b/src/object/auto/autofactory.cpp
index 1fc669f..f552440 100644
--- a/src/object/auto/autofactory.cpp
+++ b/src/object/auto/autofactory.cpp
@@ -20,6 +20,7 @@
#include <d3d.h>
#include "math/const.h"
+#include "math/geometry.h"
#include "common/struct.h"
#include "graphics/d3d/d3dengine.h"
#include "math/old/d3dmath.h"
@@ -125,9 +126,9 @@ bool CAutoFactory::EventProcess(const Event &event)
{
CObject* fret;
CObject* vehicle;
- D3DMATRIX* mat;
+ Math::Matrix* mat;
CPhysics* physics;
- D3DVECTOR pos, speed;
+ Math::Vector pos, speed;
Math::Point dim;
ObjectType type;
float zoom, angle, prog;
@@ -348,8 +349,8 @@ bool CAutoFactory::EventProcess(const Event &event)
m_particule->CreateParticule(pos, speed, dim, PARTIBLUE, 1.0f, 0.0f, 0.0f);
#else
mat = m_object->RetWorldMatrix(0);
- pos = D3DVECTOR(-12.0f, 20.0f, -4.0f); // position of chimney
- pos = Transform(*mat, pos);
+ pos = Math::Vector(-12.0f, 20.0f, -4.0f); // position of chimney
+ pos = Math::Transform(*mat, pos);
pos.y += 2.0f;
pos.x += (Math::Rand()-0.5f)*2.0f;
pos.z += (Math::Rand()-0.5f)*2.0f;
@@ -416,7 +417,7 @@ bool CAutoFactory::EventProcess(const Event &event)
pos.x += (Math::Rand()-0.5f)*10.0f;
pos.z += (Math::Rand()-0.5f)*10.0f;
pos.y += Math::Rand()*10.0f;
- speed = D3DVECTOR(0.0f, 0.0f, 0.0f);
+ speed = Math::Vector(0.0f, 0.0f, 0.0f);
dim.x = 2.0f;
dim.y = dim.x;
m_particule->CreateParticule(pos, speed, dim, PARTIGLINT, 2.0f, 0.0f, 0.0f);
@@ -459,7 +460,7 @@ bool CAutoFactory::EventProcess(const Event &event)
pos.x += (Math::Rand()-0.5f)*10.0f;
pos.z += (Math::Rand()-0.5f)*10.0f;
pos.y += Math::Rand()*10.0f;
- speed = D3DVECTOR(0.0f, 0.0f, 0.0f);
+ speed = Math::Vector(0.0f, 0.0f, 0.0f);
dim.x = 2.0f;
dim.y = dim.x;
m_particule->CreateParticule(pos, speed, dim, PARTIGLINT, 2.0f, 0.0f, 0.0f);
@@ -535,7 +536,7 @@ bool CAutoFactory::Read(char *line)
CObject* CAutoFactory::SearchFret()
{
CObject* pObj;
- D3DVECTOR oPos;
+ Math::Vector oPos;
ObjectType type;
float dist;
int i;
@@ -550,7 +551,7 @@ CObject* CAutoFactory::SearchFret()
if ( pObj->RetTruck() != 0 ) continue;
oPos = pObj->RetPosition(0);
- dist = Length(oPos, m_fretPos);
+ dist = Math::Distance(oPos, m_fretPos);
if ( dist < 8.0f ) return pObj;
}
@@ -563,7 +564,7 @@ CObject* CAutoFactory::SearchFret()
bool CAutoFactory::NearestVehicle()
{
CObject* pObj;
- D3DVECTOR cPos, oPos;
+ Math::Vector cPos, oPos;
ObjectType type;
float oRadius, dist;
int i;
@@ -611,7 +612,7 @@ bool CAutoFactory::NearestVehicle()
type != OBJECT_WORM ) continue;
if ( !pObj->GetCrashSphere(0, oPos, oRadius) ) continue;
- dist = Length(oPos, cPos)-oRadius;
+ dist = Math::Distance(oPos, cPos)-oRadius;
if ( dist < 10.0f ) return true;
}
@@ -625,9 +626,9 @@ bool CAutoFactory::NearestVehicle()
bool CAutoFactory::CreateVehicle()
{
CObject* vehicle;
- D3DMATRIX* mat;
+ Math::Matrix* mat;
CPhysics* physics;
- D3DVECTOR pos;
+ Math::Vector pos;
float angle;
char* name;
int i;
@@ -640,11 +641,11 @@ bool CAutoFactory::CreateVehicle()
m_type == OBJECT_MOBILErr ||
m_type == OBJECT_MOBILErs )
{
- pos = D3DVECTOR(2.0f, 0.0f, 0.0f);
+ pos = Math::Vector(2.0f, 0.0f, 0.0f);
}
else
{
- pos = D3DVECTOR(4.0f, 0.0f, 0.0f);
+ pos = Math::Vector(4.0f, 0.0f, 0.0f);
}
pos = Transform(*mat, pos);
@@ -680,7 +681,7 @@ bool CAutoFactory::CreateVehicle()
CObject* CAutoFactory::SearchVehicle()
{
CObject* pObj;
- D3DVECTOR oPos;
+ Math::Vector oPos;
ObjectType type;
float dist;
int i;
@@ -697,7 +698,7 @@ CObject* CAutoFactory::SearchVehicle()
if ( pObj->RetTruck() != 0 ) continue;
oPos = pObj->RetPosition(0);
- dist = Length(oPos, m_fretPos);
+ dist = Math::Distance(oPos, m_fretPos);
if ( dist < 8.0f ) return pObj;
}
diff --git a/src/object/auto/autofactory.h b/src/object/auto/autofactory.h
index 82e2a96..30692c8 100644
--- a/src/object/auto/autofactory.h
+++ b/src/object/auto/autofactory.h
@@ -76,7 +76,7 @@ protected:
float m_progress;
float m_speed;
float m_lastParticule;
- D3DVECTOR m_fretPos;
+ Math::Vector m_fretPos;
int m_channelSound;
};
diff --git a/src/object/auto/autoflag.cpp b/src/object/auto/autoflag.cpp
index c75f914..b6497eb 100644
--- a/src/object/auto/autoflag.cpp
+++ b/src/object/auto/autoflag.cpp
@@ -73,7 +73,7 @@ void CAutoFlag::DeleteObject(bool bAll)
void CAutoFlag::Init()
{
- D3DVECTOR wind;
+ Math::Vector wind;
float angle;
m_time = 0.0f;
@@ -84,7 +84,7 @@ void CAutoFlag::Init()
angle = Math::RotateAngle(wind.x, -wind.z);
m_object->SetAngleY(0, angle); // directs the flag in the wind
- m_strong = Length(wind);
+ m_strong = wind.Length();
}
diff --git a/src/object/auto/autohuston.cpp b/src/object/auto/autohuston.cpp
index 9ff5197..256d394 100644
--- a/src/object/auto/autohuston.cpp
+++ b/src/object/auto/autohuston.cpp
@@ -44,7 +44,7 @@
CAutoHuston::CAutoHuston(CInstanceManager* iMan, CObject* object)
: CAuto(iMan, object)
{
- D3DVECTOR pos;
+ Math::Vector pos;
int i;
for ( i=0 ; i<HUSTONMAXLENS ; i++ )
@@ -57,10 +57,10 @@ CAutoHuston::CAutoHuston(CInstanceManager* iMan, CObject* object)
m_lens[1].type = PARTISELR;
m_lens[2].type = PARTISELR;
m_lens[3].type = PARTISELR;
- m_lens[0].pos = pos+D3DVECTOR(0.0f+13.0f, 34.0f, 30.0f );
- m_lens[1].pos = pos+D3DVECTOR(0.0f-13.0f, 34.0f, 30.0f );
- m_lens[2].pos = pos+D3DVECTOR(0.0f , 34.0f, 30.0f+13.0f);
- m_lens[3].pos = pos+D3DVECTOR(0.0f , 34.0f, 30.0f-13.0f);
+ m_lens[0].pos = pos+Math::Vector(0.0f+13.0f, 34.0f, 30.0f );
+ m_lens[1].pos = pos+Math::Vector(0.0f-13.0f, 34.0f, 30.0f );
+ m_lens[2].pos = pos+Math::Vector(0.0f , 34.0f, 30.0f+13.0f);
+ m_lens[3].pos = pos+Math::Vector(0.0f , 34.0f, 30.0f-13.0f);
m_lens[0].dim = 4.0f;
m_lens[1].dim = 4.0f;
m_lens[2].dim = 4.0f;
@@ -77,46 +77,46 @@ CAutoHuston::CAutoHuston(CInstanceManager* iMan, CObject* object)
// Part under the radar.
i = 4;
m_lens[i].type = PARTISELR;
- m_lens[i].pos = pos+D3DVECTOR(-7.0f, 9.9f, 40.1f);
+ m_lens[i].pos = pos+Math::Vector(-7.0f, 9.9f, 40.1f);
m_lens[i].dim = 1.8f;
m_lens[i].total = 0.4f;
m_lens[i].off = 0.2f;
i ++;
m_lens[i].type = PARTISELY;
- m_lens[i].pos = pos+D3DVECTOR(-7.0f, 7.2f, 34.8f);
+ m_lens[i].pos = pos+Math::Vector(-7.0f, 7.2f, 34.8f);
m_lens[i].dim = 0.4f;
m_lens[i].total = 0.7f;
m_lens[i].off = 0.3f;
i ++;
m_lens[i].type = PARTISELY;
- m_lens[i].pos = pos+D3DVECTOR(-7.0f, 6.5f, 34.3f);
+ m_lens[i].pos = pos+Math::Vector(-7.0f, 6.5f, 34.3f);
m_lens[i].dim = 0.4f;
m_lens[i].total = 0.7f;
m_lens[i].off = 0.3f;
i ++;
m_lens[i].type = PARTISELR;
- m_lens[i].pos = pos+D3DVECTOR(-7.0f, 6.5f, 33.4f);
+ m_lens[i].pos = pos+Math::Vector(-7.0f, 6.5f, 33.4f);
m_lens[i].dim = 0.4f;
m_lens[i].total = 0.0f;
m_lens[i].off = 0.0f;
i ++;
m_lens[i].type = PARTISELR;
- m_lens[i].pos = pos+D3DVECTOR(-7.0f, 6.5f, 33.0f);
+ m_lens[i].pos = pos+Math::Vector(-7.0f, 6.5f, 33.0f);
m_lens[i].dim = 0.4f;
m_lens[i].total = 1.0f;
m_lens[i].off = 0.5f;
i ++;
m_lens[i].type = PARTISELY;
- m_lens[i].pos = pos+D3DVECTOR(-7.0f, 8.5f, 14.0f);
+ m_lens[i].pos = pos+Math::Vector(-7.0f, 8.5f, 14.0f);
m_lens[i].dim = 1.2f;
m_lens[i].total = 0.8f;
m_lens[i].off = 0.2f;
i ++;
m_lens[i].type = PARTISELR;
- m_lens[i].pos = pos+D3DVECTOR(4.0f, 6.0f, 8.6f);
+ m_lens[i].pos = pos+Math::Vector(4.0f, 6.0f, 8.6f);
m_lens[i].dim = 1.0f;
m_lens[i].total = 0.9f;
m_lens[i].off = 0.7f;
@@ -124,53 +124,53 @@ CAutoHuston::CAutoHuston(CInstanceManager* iMan, CObject* object)
// Part with three windows.
m_lens[i].type = PARTISELR;
- m_lens[i].pos = pos+D3DVECTOR(-7.0f, 9.9f, -19.9f);
+ m_lens[i].pos = pos+Math::Vector(-7.0f, 9.9f, -19.9f);
m_lens[i].dim = 1.0f;
m_lens[i].total = 0.6f;
m_lens[i].off = 0.3f;
i ++;
m_lens[i].type = PARTISELY;
- m_lens[i].pos = pos+D3DVECTOR(-7.0f, 7.2f, 34.8f-60.0f);
+ m_lens[i].pos = pos+Math::Vector(-7.0f, 7.2f, 34.8f-60.0f);
m_lens[i].dim = 0.4f;
m_lens[i].total = 0.7f;
m_lens[i].off = 0.3f;
i ++;
m_lens[i].type = PARTISELY;
- m_lens[i].pos = pos+D3DVECTOR(-7.0f, 6.5f, 34.3f-60.0f);
+ m_lens[i].pos = pos+Math::Vector(-7.0f, 6.5f, 34.3f-60.0f);
m_lens[i].dim = 0.4f;
m_lens[i].total = 0.0f;
m_lens[i].off = 0.0f;
i ++;
m_lens[i].type = PARTISELR;
- m_lens[i].pos = pos+D3DVECTOR(-7.0f, 6.5f, 33.4f-60.0f);
+ m_lens[i].pos = pos+Math::Vector(-7.0f, 6.5f, 33.4f-60.0f);
m_lens[i].dim = 0.4f;
m_lens[i].total = 0.6f;
m_lens[i].off = 0.4f;
i ++;
m_lens[i].type = PARTISELR;
- m_lens[i].pos = pos+D3DVECTOR(-7.0f, 6.5f, 33.0f-60.0f);
+ m_lens[i].pos = pos+Math::Vector(-7.0f, 6.5f, 33.0f-60.0f);
m_lens[i].dim = 0.4f;
m_lens[i].total = 0.8f;
m_lens[i].off = 0.2f;
i ++;
m_lens[i].type = PARTISELY;
- m_lens[i].pos = pos+D3DVECTOR(-6.5f, 13.5f, -37.0f);
+ m_lens[i].pos = pos+Math::Vector(-6.5f, 13.5f, -37.0f);
m_lens[i].dim = 1.0f;
m_lens[i].total = 0.0f;
m_lens[i].off = 0.0f;
i ++;
m_lens[i].type = PARTISELY;
- m_lens[i].pos = pos+D3DVECTOR(-7.0f, 12.2f, -39.8f);
+ m_lens[i].pos = pos+Math::Vector(-7.0f, 12.2f, -39.8f);
m_lens[i].dim = 1.8f;
m_lens[i].total = 1.5f;
m_lens[i].off = 0.5f;
i ++;
m_lens[i].type = PARTISELY;
- m_lens[i].pos = pos+D3DVECTOR(-7.0f, 8.5f, -47.0f);
+ m_lens[i].pos = pos+Math::Vector(-7.0f, 8.5f, -47.0f);
m_lens[i].dim = 0.6f;
m_lens[i].total = 0.7f;
m_lens[i].off = 0.5f;
@@ -218,7 +218,7 @@ void CAutoHuston::Start(int param)
bool CAutoHuston::EventProcess(const Event &event)
{
- D3DVECTOR speed;
+ Math::Vector speed;
Math::Point dim;
float angle;
int i;
@@ -237,7 +237,7 @@ bool CAutoHuston::EventProcess(const Event &event)
m_progress += event.rTime*m_speed;
// Flashes the keys.
- speed = D3DVECTOR(0.0f, 0.0f, 0.0f);
+ speed = Math::Vector(0.0f, 0.0f, 0.0f);
for ( i=0 ; i<m_lensTotal ; i++ )
{
if ( m_lens[i].total != 0.0f &&
diff --git a/src/object/auto/autohuston.h b/src/object/auto/autohuston.h
index 552def8..4e79a9c 100644
--- a/src/object/auto/autohuston.h
+++ b/src/object/auto/autohuston.h
@@ -37,7 +37,7 @@ struct HustonLens
{
int parti;
ParticuleType type;
- D3DVECTOR pos;
+ Math::Vector pos;
float dim;
float total;
float off;
diff --git a/src/object/auto/autoinfo.cpp b/src/object/auto/autoinfo.cpp
index f96808c..783dd56 100644
--- a/src/object/auto/autoinfo.cpp
+++ b/src/object/auto/autoinfo.cpp
@@ -83,7 +83,7 @@ void CAutoInfo::Init()
void CAutoInfo::Start(int param)
{
- D3DVECTOR pos, speed;
+ Math::Vector pos, speed;
Math::Point dim;
if ( param == 0 ) // instruction "receive" ?
@@ -112,7 +112,7 @@ void CAutoInfo::Start(int param)
{
pos = m_goal;
pos.y += 9.5f;
- speed = D3DVECTOR(0.0f, 0.0f, 0.0f);
+ speed = Math::Vector(0.0f, 0.0f, 0.0f);
dim.x = 30.0f;
dim.y = dim.x;
m_particule->CreateParticule(pos, speed, dim, PARTISPHERE4, 1.5f, 0.0f, 0.0f);
@@ -123,7 +123,7 @@ void CAutoInfo::Start(int param)
{
pos = m_goal;
pos.y += 9.5f;
- speed = D3DVECTOR(0.0f, 0.0f, 0.0f);
+ speed = Math::Vector(0.0f, 0.0f, 0.0f);
dim.x = 50.0f;
dim.y = dim.x;
m_particule->CreateParticule(pos, speed, dim, PARTISPHERE6, 1.5f, 0.0f, 0.0f);
@@ -141,7 +141,7 @@ void CAutoInfo::Start(int param)
bool CAutoInfo::EventProcess(const Event &event)
{
- D3DVECTOR pos, speed;
+ Math::Vector pos, speed;
Math::Point dim;
float duration, angle, rTime;
int i;
diff --git a/src/object/auto/autoinfo.h b/src/object/auto/autoinfo.h
index 7cd3002..7596c41 100644
--- a/src/object/auto/autoinfo.h
+++ b/src/object/auto/autoinfo.h
@@ -71,7 +71,7 @@ protected:
float m_speed;
float m_timeVirus;
float m_lastParticule;
- D3DVECTOR m_goal;
+ Math::Vector m_goal;
bool m_bLastVirus;
};
diff --git a/src/object/auto/autojostle.cpp b/src/object/auto/autojostle.cpp
index ee09d93..c2e3eea 100644
--- a/src/object/auto/autojostle.cpp
+++ b/src/object/auto/autojostle.cpp
@@ -105,7 +105,7 @@ void CAutoJostle::Start(int param, float force)
bool CAutoJostle::EventProcess(const Event &event)
{
- D3DVECTOR dir;
+ Math::Vector dir;
float factor, angle, zoom;
CAuto::EventProcess(event);
@@ -145,7 +145,7 @@ bool CAutoJostle::EventProcess(const Event &event)
{
m_object->SetAngleX(0, 0.0f);
m_object->SetAngleZ(0, 0.0f);
- m_object->SetZoom(0, D3DVECTOR(1.0f, 1.0f, 1.0f));
+ m_object->SetZoom(0, Math::Vector(1.0f, 1.0f, 1.0f));
m_error = ERR_STOP;
}
diff --git a/src/object/auto/autokid.cpp b/src/object/auto/autokid.cpp
index 5507d0f..f2f90b3 100644
--- a/src/object/auto/autokid.cpp
+++ b/src/object/auto/autokid.cpp
@@ -73,7 +73,7 @@ void CAutoKid::DeleteObject(bool bAll)
void CAutoKid::Init()
{
- D3DVECTOR pos;
+ Math::Vector pos;
m_speed = 1.0f/1.0f;
m_progress = 0.0f;
@@ -108,7 +108,7 @@ void CAutoKid::Init()
bool CAutoKid::EventProcess(const Event &event)
{
- D3DVECTOR vib, pos, speed;
+ Math::Vector vib, pos, speed;
Math::Point dim;
CAuto::EventProcess(event);
diff --git a/src/object/auto/autolabo.cpp b/src/object/auto/autolabo.cpp
index 7033318..828e1c2 100644
--- a/src/object/auto/autolabo.cpp
+++ b/src/object/auto/autolabo.cpp
@@ -128,7 +128,7 @@ void CAutoLabo::Init()
bool CAutoLabo::EventProcess(const Event &event)
{
CObject* power;
- D3DVECTOR pos, goal, speed;
+ Math::Vector pos, goal, speed;
Math::Point dim, rot;
float angle;
int i;
@@ -243,7 +243,7 @@ bool CAutoLabo::EventProcess(const Event &event)
}
else
{
- m_object->SetPosition(1, D3DVECTOR(-9.0f, 13.0f, 0.0f));
+ m_object->SetPosition(1, Math::Vector(-9.0f, 13.0f, 0.0f));
SoundManip(1.5f, 1.0f, 0.5f);
m_phase = ALAP_OPEN3;
@@ -284,7 +284,7 @@ bool CAutoLabo::EventProcess(const Event &event)
pos = m_object->RetPosition(0);
pos.y += 4.0f;
- speed = D3DVECTOR(0.0f, 0.0f, 0.0f);
+ speed = Math::Vector(0.0f, 0.0f, 0.0f);
dim.x = 4.0f;
dim.y = dim.x;
m_partiSphere = m_particule->CreateParticule(pos, speed, dim, PARTISPHERE2, LABO_DELAY, 0.0f, 0.0f);
@@ -400,7 +400,7 @@ bool CAutoLabo::EventProcess(const Event &event)
}
else
{
- m_object->SetPosition(1, D3DVECTOR(-9.0f, 3.0f, 0.0f));
+ m_object->SetPosition(1, Math::Vector(-9.0f, 3.0f, 0.0f));
SoundManip(1.0f, 1.0f, 1.0f);
m_phase = ALAP_CLOSE3;
@@ -578,7 +578,7 @@ void CAutoLabo::SoundManip(float time, float amplitude, float frequency)
bool CAutoLabo::Write(char *line)
{
- D3DVECTOR pos;
+ Math::Vector pos;
char name[100];
if ( m_phase == ALAP_WAIT ) return false;
@@ -607,7 +607,7 @@ bool CAutoLabo::Write(char *line)
bool CAutoLabo::Read(char *line)
{
- D3DVECTOR pos;
+ Math::Vector pos;
if ( OpInt(line, "aExist", 0) == 0 ) return false;
diff --git a/src/object/auto/automush.cpp b/src/object/auto/automush.cpp
index 44272d0..90dc13a 100644
--- a/src/object/auto/automush.cpp
+++ b/src/object/auto/automush.cpp
@@ -79,7 +79,7 @@ void CAutoMush::Init()
bool CAutoMush::EventProcess(const Event &event)
{
- D3DVECTOR pos, speed, dir;
+ Math::Vector pos, speed, dir;
Math::Point dim;
float factor, zoom, size, angle;
int i, channel;
@@ -223,7 +223,7 @@ bool CAutoMush::EventProcess(const Event &event)
{
m_object->SetAngleX(0, 0.0f);
m_object->SetAngleZ(0, 0.0f);
- m_object->SetZoom(0, D3DVECTOR(1.0f, 1.0f, 1.0f));
+ m_object->SetZoom(0, Math::Vector(1.0f, 1.0f, 1.0f));
}
return true;
@@ -235,7 +235,7 @@ bool CAutoMush::EventProcess(const Event &event)
bool CAutoMush::SearchTarget()
{
CObject* pObj;
- D3DVECTOR iPos, oPos;
+ Math::Vector iPos, oPos;
ObjectType type;
float dist;
int i;
@@ -294,7 +294,7 @@ bool CAutoMush::SearchTarget()
type != OBJECT_HUMAN ) continue;
oPos = pObj->RetPosition(0);
- dist = Length(oPos, iPos);
+ dist = Math::Distance(oPos, iPos);
if ( dist < 50.0f ) return true;
}
@@ -314,7 +314,7 @@ Error CAutoMush::RetError()
bool CAutoMush::Write(char *line)
{
- D3DVECTOR pos;
+ Math::Vector pos;
char name[100];
if ( m_phase == AMP_WAIT ) return false;
@@ -340,7 +340,7 @@ bool CAutoMush::Write(char *line)
bool CAutoMush::Read(char *line)
{
- D3DVECTOR pos;
+ Math::Vector pos;
if ( OpInt(line, "aExist", 0) == 0 ) return false;
diff --git a/src/object/auto/autonest.cpp b/src/object/auto/autonest.cpp
index a566444..3644318 100644
--- a/src/object/auto/autonest.cpp
+++ b/src/object/auto/autonest.cpp
@@ -76,7 +76,7 @@ void CAutoNest::DeleteObject(bool bAll)
void CAutoNest::Init()
{
- D3DVECTOR pos;
+ Math::Vector pos;
m_phase = ANP_WAIT;
m_progress = 0.0f;
@@ -155,10 +155,10 @@ bool CAutoNest::EventProcess(const Event &event)
// Seeks if a site is free.
-bool CAutoNest::SearchFree(D3DVECTOR pos)
+bool CAutoNest::SearchFree(Math::Vector pos)
{
CObject* pObj;
- D3DVECTOR sPos;
+ Math::Vector sPos;
ObjectType type;
float sRadius, distance;
int i, j;
@@ -174,7 +174,7 @@ bool CAutoNest::SearchFree(D3DVECTOR pos)
j = 0;
while ( pObj->GetCrashSphere(j++, sPos, sRadius) )
{
- distance = Length(sPos, pos);
+ distance = Math::Distance(sPos, pos);
distance -= sRadius;
if ( distance < 2.0f ) return false; // location occupied
}
@@ -185,7 +185,7 @@ bool CAutoNest::SearchFree(D3DVECTOR pos)
// Create a transportable object.
-void CAutoNest::CreateFret(D3DVECTOR pos, float angle, ObjectType type)
+void CAutoNest::CreateFret(Math::Vector pos, float angle, ObjectType type)
{
CObject* fret;
@@ -204,7 +204,7 @@ void CAutoNest::CreateFret(D3DVECTOR pos, float angle, ObjectType type)
CObject* CAutoNest::SearchFret()
{
CObject* pObj;
- D3DVECTOR oPos;
+ Math::Vector oPos;
ObjectType type;
int i;
@@ -242,7 +242,7 @@ Error CAutoNest::RetError()
bool CAutoNest::Write(char *line)
{
- D3DVECTOR pos;
+ Math::Vector pos;
char name[100];
if ( m_phase == ANP_WAIT ) return false;
@@ -268,7 +268,7 @@ bool CAutoNest::Write(char *line)
bool CAutoNest::Read(char *line)
{
- D3DVECTOR pos;
+ Math::Vector pos;
if ( OpInt(line, "aExist", 0) == 0 ) return false;
diff --git a/src/object/auto/autonest.h b/src/object/auto/autonest.h
index 55ee2f0..faf9235 100644
--- a/src/object/auto/autonest.h
+++ b/src/object/auto/autonest.h
@@ -56,8 +56,8 @@ public:
bool Read(char *line);
protected:
- bool SearchFree(D3DVECTOR pos);
- void CreateFret(D3DVECTOR pos, float angle, ObjectType type);
+ bool SearchFree(Math::Vector pos);
+ void CreateFret(Math::Vector pos, float angle, ObjectType type);
CObject* SearchFret();
protected:
@@ -65,6 +65,6 @@ protected:
float m_progress;
float m_speed;
float m_lastParticule;
- D3DVECTOR m_fretPos;
+ Math::Vector m_fretPos;
};
diff --git a/src/object/auto/autonuclear.cpp b/src/object/auto/autonuclear.cpp
index 49ae0bd..8b9ff36 100644
--- a/src/object/auto/autonuclear.cpp
+++ b/src/object/auto/autonuclear.cpp
@@ -20,6 +20,7 @@
#include <d3d.h>
#include "common/struct.h"
+#include "math/geometry.h"
#include "graphics/d3d/d3dengine.h"
#include "math/old/d3dmath.h"
#include "common/global.h"
@@ -95,14 +96,14 @@ void CAutoNuclear::DeleteObject(bool bAll)
void CAutoNuclear::Init()
{
- D3DMATRIX* mat;
+ Math::Matrix* mat;
m_time = 0.0f;
m_timeVirus = 0.0f;
m_lastParticule = 0.0f;
mat = m_object->RetWorldMatrix(0);
- m_pos = Transform(*mat, D3DVECTOR(22.0f, 4.0f, 0.0f));
+ m_pos = Math::Transform(*mat, Math::Vector(22.0f, 4.0f, 0.0f));
m_phase = ANUP_WAIT; // waiting ...
m_progress = 0.0f;
@@ -117,8 +118,8 @@ void CAutoNuclear::Init()
bool CAutoNuclear::EventProcess(const Event &event)
{
CObject* fret;
- D3DMATRIX* mat;
- D3DVECTOR pos, goal, speed;
+ Math::Matrix* mat;
+ Math::Vector pos, goal, speed;
Math::Point dim, rot;
float angle;
int i, max;
@@ -345,7 +346,7 @@ CObject* CAutoNuclear::SearchUranium()
bool CAutoNuclear::SearchVehicle()
{
CObject* pObj;
- D3DVECTOR oPos;
+ Math::Vector oPos;
ObjectType type;
float oRadius, dist;
int i;
@@ -391,7 +392,7 @@ bool CAutoNuclear::SearchVehicle()
type != OBJECT_WORM ) continue;
if ( !pObj->GetCrashSphere(0, oPos, oRadius) ) continue;
- dist = Length(oPos, m_pos)-oRadius;
+ dist = Math::Distance(oPos, m_pos)-oRadius;
if ( dist < 10.0f ) return true;
}
@@ -404,7 +405,7 @@ bool CAutoNuclear::SearchVehicle()
void CAutoNuclear::CreatePower()
{
CObject* power;
- D3DVECTOR pos;
+ Math::Vector pos;
float angle;
pos = m_object->RetPosition(0);
@@ -419,7 +420,7 @@ void CAutoNuclear::CreatePower()
}
power->SetTruck(m_object);
- power->SetPosition(0, D3DVECTOR(22.0f, 3.0f, 0.0f));
+ power->SetPosition(0, Math::Vector(22.0f, 3.0f, 0.0f));
m_object->SetPower(power);
}
diff --git a/src/object/auto/autonuclear.h b/src/object/auto/autonuclear.h
index 36b3483..df34601 100644
--- a/src/object/auto/autonuclear.h
+++ b/src/object/auto/autonuclear.h
@@ -71,7 +71,7 @@ protected:
float m_speed;
float m_timeVirus;
float m_lastParticule;
- D3DVECTOR m_pos;
+ Math::Vector m_pos;
int m_channelSound;
};
diff --git a/src/object/auto/autopara.cpp b/src/object/auto/autopara.cpp
index 46a34f9..568156b 100644
--- a/src/object/auto/autopara.cpp
+++ b/src/object/auto/autopara.cpp
@@ -20,6 +20,7 @@
#include <d3d.h>
#include "common/struct.h"
+#include "math/geometry.h"
#include "graphics/d3d/d3dengine.h"
#include "math/old/d3dmath.h"
#include "common/global.h"
@@ -79,14 +80,14 @@ void CAutoPara::DeleteObject(bool bAll)
void CAutoPara::Init()
{
- D3DMATRIX* mat;
+ Math::Matrix* mat;
m_time = 0.0f;
m_timeVirus = 0.0f;
m_lastParticule = 0.0f;
mat = m_object->RetWorldMatrix(0);
- m_pos = Transform(*mat, D3DVECTOR(22.0f, 4.0f, 0.0f));
+ m_pos = Math::Transform(*mat, Math::Vector(22.0f, 4.0f, 0.0f));
m_phase = APAP_WAIT; // waiting ...
m_progress = 0.0f;
@@ -110,7 +111,7 @@ void CAutoPara::StartBlitz()
bool CAutoPara::EventProcess(const Event &event)
{
- D3DVECTOR pos, speed;
+ Math::Vector pos, speed;
Math::Point dim;
int i;
@@ -253,7 +254,7 @@ void CAutoPara::ChargeObject(float rTime)
{
CObject* pObj;
CObject* power;
- D3DVECTOR sPos, oPos;
+ Math::Vector sPos, oPos;
float dist, energy;
int i;
@@ -265,7 +266,7 @@ void CAutoPara::ChargeObject(float rTime)
if ( pObj == 0 ) break;
oPos = pObj->RetPosition(0);
- dist = Length(oPos, sPos);
+ dist = Math::Distance(oPos, sPos);
if ( dist > 20.0f ) continue;
if ( pObj->RetTruck() == 0 && pObj->RetType() == OBJECT_POWER )
diff --git a/src/object/auto/autopara.h b/src/object/auto/autopara.h
index 9eab4d7..6878c42 100644
--- a/src/object/auto/autopara.h
+++ b/src/object/auto/autopara.h
@@ -68,7 +68,7 @@ protected:
float m_speed;
float m_timeVirus;
float m_lastParticule;
- D3DVECTOR m_pos;
+ Math::Vector m_pos;
int m_channelSound;
};
diff --git a/src/object/auto/autoportico.cpp b/src/object/auto/autoportico.cpp
index cedb1d7..388bfcc 100644
--- a/src/object/auto/autoportico.cpp
+++ b/src/object/auto/autoportico.cpp
@@ -123,7 +123,7 @@ void CAutoPortico::Init()
void CAutoPortico::Start(int param)
{
- D3DVECTOR pos;
+ Math::Vector pos;
pos = m_object->RetPosition(0);
m_finalPos = pos;
@@ -131,7 +131,7 @@ void CAutoPortico::Start(int param)
m_object->SetPosition(0, pos);
m_finalPos.z += PORTICO_TIME_OPEN*5.3f;
- m_object->SetPosition(1, D3DVECTOR(0.0f, PORTICO_POSa, 0.0f));
+ m_object->SetPosition(1, Math::Vector(0.0f, PORTICO_POSa, 0.0f));
m_object->SetAngleY(2, PORTICO_ANGLE1a);
m_object->SetAngleY(3, PORTICO_ANGLE2a);
m_object->SetAngleY(4, PORTICO_ANGLE3a);
@@ -152,7 +152,7 @@ void CAutoPortico::Start(int param)
bool CAutoPortico::EventProcess(const Event &event)
{
CObject* pObj;
- D3DVECTOR pos;
+ Math::Vector pos;
float angle;
CAuto::EventProcess(event);
@@ -372,7 +372,7 @@ bool CAutoPortico::Abort()
CObject* pObj;
m_object->SetPosition(0, m_finalPos);
- m_object->SetPosition(1, D3DVECTOR(0.0f, PORTICO_POSb, 0.0f));
+ m_object->SetPosition(1, Math::Vector(0.0f, PORTICO_POSb, 0.0f));
m_object->SetAngleY(2, PORTICO_ANGLE1b);
m_object->SetAngleY(3, PORTICO_ANGLE2b);
m_object->SetAngleY(4, PORTICO_ANGLE3b);
diff --git a/src/object/auto/autoportico.h b/src/object/auto/autoportico.h
index 196140d..c6ce6d7 100644
--- a/src/object/auto/autoportico.h
+++ b/src/object/auto/autoportico.h
@@ -69,8 +69,8 @@ protected:
float m_cameraProgress;
float m_cameraSpeed;
float m_lastParticule;
- D3DVECTOR m_finalPos;
- D3DVECTOR m_startPos;
+ Math::Vector m_finalPos;
+ Math::Vector m_startPos;
float m_posTrack;
int m_param;
int m_soundChannel;
diff --git a/src/object/auto/autoradar.cpp b/src/object/auto/autoradar.cpp
index 535bfee..0f91d08 100644
--- a/src/object/auto/autoradar.cpp
+++ b/src/object/auto/autoradar.cpp
@@ -85,7 +85,7 @@ void CAutoRadar::Init()
bool CAutoRadar::EventProcess(const Event &event)
{
- D3DVECTOR pos, ePos;
+ Math::Vector pos, ePos;
float speed, angle, prog, freq, ampl;
CAuto::EventProcess(event);
@@ -274,11 +274,11 @@ void CAutoRadar::UpdateInterface()
// Seeking the position of an enemy.
-bool CAutoRadar::SearchEnemy(D3DVECTOR &pos)
+bool CAutoRadar::SearchEnemy(Math::Vector &pos)
{
CObject* pObj;
CObject* pBest = 0;
- D3DVECTOR iPos, oPos;
+ Math::Vector iPos, oPos;
ObjectType oType;
float distance, min;
int i;
@@ -304,7 +304,7 @@ bool CAutoRadar::SearchEnemy(D3DVECTOR &pos)
m_totalDetect ++;
oPos = pObj->RetPosition(0);
- distance = Length(oPos, iPos);
+ distance = Math::Distance(oPos, iPos);
if ( distance < min )
{
min = distance;
diff --git a/src/object/auto/autoradar.h b/src/object/auto/autoradar.h
index 616a6eb..9681789 100644
--- a/src/object/auto/autoradar.h
+++ b/src/object/auto/autoradar.h
@@ -57,7 +57,7 @@ public:
protected:
void UpdateInterface();
- bool SearchEnemy(D3DVECTOR &pos);
+ bool SearchEnemy(Math::Vector &pos);
protected:
AutoRadarPhase m_phase;
diff --git a/src/object/auto/autorepair.cpp b/src/object/auto/autorepair.cpp
index 79bccc8..fdfb072 100644
--- a/src/object/auto/autorepair.cpp
+++ b/src/object/auto/autorepair.cpp
@@ -90,7 +90,7 @@ void CAutoRepair::Init()
bool CAutoRepair::EventProcess(const Event &event)
{
CObject* vehicule;
- D3DVECTOR pos, speed;
+ Math::Vector pos, speed;
Math::Point dim;
float angle, shield;
@@ -247,7 +247,7 @@ CObject* CAutoRepair::SearchVehicle()
{
CObject* pObj;
CPhysics* physics;
- D3DVECTOR sPos, oPos;
+ Math::Vector sPos, oPos;
ObjectType type;
float dist;
int i;
@@ -292,7 +292,7 @@ CObject* CAutoRepair::SearchVehicle()
if ( physics != 0 && !physics->RetLand() ) continue; // in flight?
oPos = pObj->RetPosition(0);
- dist = Length(oPos, sPos);
+ dist = Math::Distance(oPos, sPos);
if ( dist <= 5.0f ) return pObj;
}
diff --git a/src/object/auto/autoresearch.cpp b/src/object/auto/autoresearch.cpp
index f1602cf..07c64c1 100644
--- a/src/object/auto/autoresearch.cpp
+++ b/src/object/auto/autoresearch.cpp
@@ -20,6 +20,7 @@
#include <d3d.h>
#include "math/const.h"
+#include "math/geometry.h"
#include "common/struct.h"
#include "graphics/d3d/d3dengine.h"
#include "math/old/d3dmath.h"
@@ -108,7 +109,7 @@ void CAutoResearch::Init()
bool CAutoResearch::EventProcess(const Event &event)
{
CObject* power;
- D3DVECTOR pos, speed;
+ Math::Vector pos, speed;
Error message;
Math::Point dim;
float angle, time;
@@ -512,8 +513,8 @@ void CAutoResearch::SetResearch(EventMsg event)
void CAutoResearch::FireStopUpdate(float progress, bool bLightOn)
{
- D3DMATRIX* mat;
- D3DVECTOR pos, speed;
+ Math::Matrix* mat;
+ Math::Vector pos, speed;
Math::Point dim;
int i;
@@ -542,7 +543,7 @@ void CAutoResearch::FireStopUpdate(float progress, bool bLightOn)
mat = m_object->RetWorldMatrix(0);
- speed = D3DVECTOR(0.0f, 0.0f, 0.0f);
+ speed = Math::Vector(0.0f, 0.0f, 0.0f);
dim.x = 2.0f;
dim.y = dim.x;
@@ -563,7 +564,7 @@ void CAutoResearch::FireStopUpdate(float progress, bool bLightOn)
pos.x = listpos[i*2+0];
pos.y = 11.5f;
pos.z = listpos[i*2+1];
- pos = Transform(*mat, pos);
+ pos = Math::Transform(*mat, pos);
m_partiStop[i] = m_particule->CreateParticule(pos, speed,
dim, PARTISELY,
1.0f, 0.0f, 0.0f);
diff --git a/src/object/auto/autoroot.cpp b/src/object/auto/autoroot.cpp
index 8b16615..df7f0cb 100644
--- a/src/object/auto/autoroot.cpp
+++ b/src/object/auto/autoroot.cpp
@@ -20,6 +20,7 @@
#include <d3d.h>
#include "common/struct.h"
+#include "math/geometry.h"
#include "graphics/d3d/d3dengine.h"
#include "math/old/d3dmath.h"
#include "common/event.h"
@@ -63,19 +64,19 @@ void CAutoRoot::DeleteObject(bool bAll)
void CAutoRoot::Init()
{
- D3DMATRIX* mat;
- D3DVECTOR pos, speed;
+ Math::Matrix* mat;
+ Math::Vector pos, speed;
Math::Point dim;
m_time = 0.0f;
m_lastParticule = 0.0f;
mat = m_object->RetWorldMatrix(0);
- pos = D3DVECTOR(-5.0f, 28.0f, -4.0f); // peak position
- pos = Transform(*mat, pos);
+ pos = Math::Vector(-5.0f, 28.0f, -4.0f); // peak position
+ pos = Math::Transform(*mat, pos);
m_center = pos;
- speed = D3DVECTOR(0.0f, 0.0f, 0.0f);
+ speed = Math::Vector(0.0f, 0.0f, 0.0f);
dim.x = 100.0f;
dim.y = dim.x;
m_particule->CreateParticule(m_center, speed, dim, PARTISPHERE5, 0.5f, 0.0f, 0.0f);
@@ -88,7 +89,7 @@ void CAutoRoot::Init()
bool CAutoRoot::EventProcess(const Event &event)
{
- D3DVECTOR pos, speed;
+ Math::Vector pos, speed;
Math::Point dim;
CAuto::EventProcess(event);
diff --git a/src/object/auto/autoroot.h b/src/object/auto/autoroot.h
index 0be9b24..8e2a279 100644
--- a/src/object/auto/autoroot.h
+++ b/src/object/auto/autoroot.h
@@ -48,6 +48,6 @@ protected:
protected:
float m_lastParticule;
- D3DVECTOR m_center;
+ Math::Vector m_center;
};
diff --git a/src/object/auto/autosafe.cpp b/src/object/auto/autosafe.cpp
index 6cdccf5..97434f9 100644
--- a/src/object/auto/autosafe.cpp
+++ b/src/object/auto/autosafe.cpp
@@ -125,7 +125,7 @@ void CAutoSafe::Init()
bool CAutoSafe::EventProcess(const Event &event)
{
CObject* pObj;
- D3DVECTOR pos, speed;
+ Math::Vector pos, speed;
Math::Point dim;
int i, count;
@@ -256,7 +256,7 @@ bool CAutoSafe::EventProcess(const Event &event)
}
m_object->FlushCrashShere();
- m_object->SetGlobalSphere(D3DVECTOR(0.0f, 0.0f, 0.0f), 0.0f);
+ m_object->SetGlobalSphere(Math::Vector(0.0f, 0.0f, 0.0f), 0.0f);
m_sound->Play(SOUND_FINDING, m_object->RetPosition(0));
@@ -294,7 +294,7 @@ bool CAutoSafe::EventProcess(const Event &event)
}
// Blinks the keys.
- speed = D3DVECTOR(0.0f, 0.0f, 0.0f);
+ speed = Math::Vector(0.0f, 0.0f, 0.0f);
dim.x = 2.0f;
dim.y = dim.x;
for ( i=0 ; i<4 ; i++ )
@@ -412,7 +412,7 @@ bool CAutoSafe::Read(char *line)
int CAutoSafe::CountKeys()
{
CObject* pObj;
- D3DVECTOR cPos, oPos;
+ Math::Vector cPos, oPos;
Math::Point rot;
ObjectType oType;
float dist, angle, limit, cAngle, oAngle;
@@ -441,7 +441,7 @@ int CAutoSafe::CountKeys()
oType != OBJECT_KEYd ) continue;
oPos = pObj->RetPosition(0);
- dist = Length2d(oPos, cPos);
+ dist = Math::DistanceProjected(oPos, cPos);
if ( dist > 20.0f ) continue;
if ( oType == OBJECT_KEYa )
@@ -497,7 +497,7 @@ int CAutoSafe::CountKeys()
void CAutoSafe::LockKeys()
{
CObject* pObj;
- D3DVECTOR cPos, oPos;
+ Math::Vector cPos, oPos;
ObjectType oType;
float dist;
int i;
@@ -518,7 +518,7 @@ void CAutoSafe::LockKeys()
oType != OBJECT_KEYd ) continue;
oPos = pObj->RetPosition(0);
- dist = Length2d(oPos, cPos);
+ dist = Math::DistanceProjected(oPos, cPos);
if ( dist > 20.0f ) continue;
pObj->SetLock(true);
@@ -530,7 +530,7 @@ void CAutoSafe::LockKeys()
void CAutoSafe::DownKeys(float progress)
{
CObject* pObj;
- D3DVECTOR cPos, oPos;
+ Math::Vector cPos, oPos;
ObjectType oType;
float dist;
int i;
@@ -551,7 +551,7 @@ void CAutoSafe::DownKeys(float progress)
oType != OBJECT_KEYd ) continue;
oPos = pObj->RetPosition(0);
- dist = Length2d(oPos, cPos);
+ dist = Math::DistanceProjected(oPos, cPos);
if ( dist > 20.0f ) continue;
oPos.y = cPos.y+1.0f-progress*2.2f;
@@ -564,7 +564,7 @@ void CAutoSafe::DownKeys(float progress)
void CAutoSafe::DeleteKeys()
{
CObject* pObj;
- D3DVECTOR cPos, oPos;
+ Math::Vector cPos, oPos;
ObjectType oType;
float dist;
int i;
@@ -589,7 +589,7 @@ void CAutoSafe::DeleteKeys()
oType != OBJECT_KEYd ) continue;
oPos = pObj->RetPosition(0);
- dist = Length2d(oPos, cPos);
+ dist = Math::DistanceProjected(oPos, cPos);
if ( dist > 20.0f ) continue;
pObj->DeleteObject();
@@ -605,7 +605,7 @@ void CAutoSafe::DeleteKeys()
CObject* CAutoSafe::SearchVehicle()
{
CObject* pObj;
- D3DVECTOR cPos, oPos;
+ Math::Vector cPos, oPos;
ObjectType oType;
float dist;
int i;
@@ -622,7 +622,7 @@ CObject* CAutoSafe::SearchVehicle()
if ( pObj->RetTruck() != 0 ) continue;
oPos = pObj->RetPosition(0);
- dist = Length2d(oPos, cPos);
+ dist = Math::DistanceProjected(oPos, cPos);
if ( dist <= 4.0f ) return pObj;
}
return 0;
diff --git a/src/object/auto/autosafe.h b/src/object/auto/autosafe.h
index 2e43359..083f06b 100644
--- a/src/object/auto/autosafe.h
+++ b/src/object/auto/autosafe.h
@@ -77,7 +77,7 @@ protected:
float m_actualAngle;
float m_finalAngle;
bool m_bKey[4];
- D3DVECTOR m_keyPos[4];
+ Math::Vector m_keyPos[4];
int m_keyParti[4];
};
diff --git a/src/object/auto/autostation.cpp b/src/object/auto/autostation.cpp
index cc93545..9ec48d5 100644
--- a/src/object/auto/autostation.cpp
+++ b/src/object/auto/autostation.cpp
@@ -20,6 +20,7 @@
#include <d3d.h>
#include "common/struct.h"
+#include "math/geometry.h"
#include "graphics/d3d/d3dengine.h"
#include "math/old/d3dmath.h"
#include "common/event.h"
@@ -90,8 +91,8 @@ void CAutoStation::Init()
bool CAutoStation::EventProcess(const Event &event)
{
- D3DMATRIX* mat;
- D3DVECTOR pos, ppos, speed;
+ Math::Matrix* mat;
+ Math::Vector pos, ppos, speed;
Math::Point dim;
CObject* vehicule;
CObject* power;
@@ -201,8 +202,8 @@ bool CAutoStation::EventProcess(const Event &event)
m_lastParticule = m_time;
mat = m_object->RetWorldMatrix(0);
- pos = D3DVECTOR(-15.0f, 7.0f, 0.0f); // battery position
- pos = Transform(*mat, pos);
+ pos = Math::Vector(-15.0f, 7.0f, 0.0f); // battery position
+ pos = Math::Transform(*mat, pos);
speed.x = (Math::Rand()-0.5f)*20.0f;
speed.y = (Math::Rand()-0.5f)*20.0f;
speed.z = (Math::Rand()-0.5f)*20.0f;
@@ -251,7 +252,7 @@ bool CAutoStation::EventProcess(const Event &event)
CObject* CAutoStation::SearchVehicle()
{
CObject* pObj;
- D3DVECTOR sPos, oPos;
+ Math::Vector sPos, oPos;
ObjectType type;
float dist;
int i;
@@ -293,7 +294,7 @@ CObject* CAutoStation::SearchVehicle()
type != OBJECT_MOBILEdr ) continue;
oPos = pObj->RetPosition(0);
- dist = Length(oPos, sPos);
+ dist = Math::Distance(oPos, sPos);
if ( dist <= 5.0f ) return pObj;
}
diff --git a/src/object/auto/autostation.h b/src/object/auto/autostation.h
index 04f6b46..f2b50a8 100644
--- a/src/object/auto/autostation.h
+++ b/src/object/auto/autostation.h
@@ -58,7 +58,7 @@ protected:
float m_lastUpdateTime;
float m_lastParticule;
int m_soundChannel;
- D3DVECTOR m_fretPos;
+ Math::Vector m_fretPos;
bool m_bLastVirus;
float m_energyVirus;
};
diff --git a/src/object/auto/autotower.cpp b/src/object/auto/autotower.cpp
index a76260e..227a1e9 100644
--- a/src/object/auto/autotower.cpp
+++ b/src/object/auto/autotower.cpp
@@ -105,7 +105,7 @@ bool CAutoTower::EventProcess(const Event &event)
{
CObject* power;
CObject* target;
- D3DVECTOR pos;
+ Math::Vector pos;
float angle, energy, quick;
CAuto::EventProcess(event);
@@ -209,7 +209,7 @@ bool CAutoTower::EventProcess(const Event &event)
m_angleYactual = Math::NormAngle(m_object->RetAngleY(1));
m_angleZfinal = -Math::PI/2.0f;
- m_angleZfinal -= Math::RotateAngle(Length2d(m_targetPos, pos), pos.y-m_targetPos.y); // CW !
+ m_angleZfinal -= Math::RotateAngle(Math::DistanceProjected(m_targetPos, pos), pos.y-m_targetPos.y); // CW !
m_angleZactual = m_object->RetAngleZ(2);
m_phase = ATP_TURN;
@@ -274,12 +274,12 @@ bool CAutoTower::EventProcess(const Event &event)
// Seeks the nearest target object.
-CObject* CAutoTower::SearchTarget(D3DVECTOR &impact)
+CObject* CAutoTower::SearchTarget(Math::Vector &impact)
{
CObject* pObj;
CObject* pBest = 0;
CPhysics* physics;
- D3DVECTOR iPos, oPos;
+ Math::Vector iPos, oPos;
ObjectType oType;
float distance, min, radius, speed;
int i;
@@ -313,7 +313,7 @@ CObject* CAutoTower::SearchTarget(D3DVECTOR &impact)
}
if ( !pObj->GetCrashSphere(0, oPos, radius) ) continue;
- distance = Length(oPos, iPos);
+ distance = Math::Distance(oPos, iPos);
if ( distance > TOWER_SCOPE ) continue; // too far
if ( distance < min )
{
@@ -359,8 +359,8 @@ Error CAutoTower::RetError()
void CAutoTower::FireStopUpdate(float progress, bool bLightOn)
{
- D3DMATRIX* mat;
- D3DVECTOR pos, speed;
+ Math::Matrix* mat;
+ Math::Vector pos, speed;
Math::Point dim;
int i;
@@ -387,7 +387,7 @@ void CAutoTower::FireStopUpdate(float progress, bool bLightOn)
mat = m_object->RetWorldMatrix(0);
- speed = D3DVECTOR(0.0f, 0.0f, 0.0f);
+ speed = Math::Vector(0.0f, 0.0f, 0.0f);
dim.x = 2.0f;
dim.y = dim.x;
diff --git a/src/object/auto/autotower.h b/src/object/auto/autotower.h
index cf4fc3b..57b941d 100644
--- a/src/object/auto/autotower.h
+++ b/src/object/auto/autotower.h
@@ -63,7 +63,7 @@ public:
protected:
void UpdateInterface(float rTime);
- CObject* SearchTarget(D3DVECTOR &impact);
+ CObject* SearchTarget(Math::Vector &impact);
void FireStopUpdate(float progress, bool bLightOn);
protected:
@@ -73,7 +73,7 @@ protected:
float m_timeVirus;
float m_lastUpdateTime;
float m_lastParticule;
- D3DVECTOR m_targetPos;
+ Math::Vector m_targetPos;
float m_angleYactual;
float m_angleZactual;
float m_angleYfinal;