From 9f784e81f81651bed087902f9f3afee113e56148 Mon Sep 17 00:00:00 2001 From: Piotr Dziwinski Date: Tue, 19 Jun 2012 20:11:47 +0200 Subject: 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 --- src/ui/compass.cpp | 18 ++++----- src/ui/control.cpp | 100 ++++++++++++++++++++++++------------------------- src/ui/displayinfo.cpp | 2 +- src/ui/displaytext.cpp | 16 ++++---- src/ui/displaytext.h | 8 ++-- src/ui/maindialog.cpp | 28 +++++++------- src/ui/map.cpp | 50 ++++++++++++------------- src/ui/shortcut.cpp | 12 +++--- 8 files changed, 117 insertions(+), 117 deletions(-) (limited to 'src/ui') diff --git a/src/ui/compass.cpp b/src/ui/compass.cpp index e7e1eee..94c2d1e 100644 --- a/src/ui/compass.cpp +++ b/src/ui/compass.cpp @@ -84,7 +84,7 @@ void CCompass::Draw() LPDIRECT3DDEVICE7 device; D3DVERTEX2 vertex[4]; // 2 triangles Math::Point p1, p2, p3, c, uv1, uv2; - D3DVECTOR n; + Math::Vector n; float dp; if ( (m_state & STATE_VISIBLE) == 0 ) return; @@ -113,12 +113,12 @@ void CCompass::Draw() uv2.x -= dp; uv2.y -= dp; - n = D3DVECTOR(0.0f, 0.0f, -1.0f); // normal + n = Math::Vector(0.0f, 0.0f, -1.0f); // normal - vertex[0] = D3DVERTEX2(D3DVECTOR(p1.x, p1.y, 0.0f), n, uv1.x,uv2.y); - vertex[1] = D3DVERTEX2(D3DVECTOR(p1.x, p2.y, 0.0f), n, uv1.x,uv1.y); - vertex[2] = D3DVERTEX2(D3DVECTOR(p2.x, p1.y, 0.0f), n, uv2.x,uv2.y); - vertex[3] = D3DVERTEX2(D3DVECTOR(p2.x, p2.y, 0.0f), n, uv2.x,uv1.y); + vertex[0] = D3DVERTEX2(Math::Vector(p1.x, p1.y, 0.0f), n, uv1.x,uv2.y); + vertex[1] = D3DVERTEX2(Math::Vector(p1.x, p2.y, 0.0f), n, uv1.x,uv1.y); + vertex[2] = D3DVERTEX2(Math::Vector(p2.x, p1.y, 0.0f), n, uv2.x,uv2.y); + vertex[3] = D3DVERTEX2(Math::Vector(p2.x, p2.y, 0.0f), n, uv2.x,uv1.y); device->DrawPrimitive(D3DPT_TRIANGLESTRIP, D3DFVF_VERTEX2, vertex, 4, NULL); m_engine->AddStatisticTriangle(2); @@ -150,9 +150,9 @@ void CCompass::Draw() uv2.x -= dp; uv2.y -= dp; - vertex[0] = D3DVERTEX2(D3DVECTOR(p1.x, p1.y, 0.0f), n, uv1.x,uv1.y); - vertex[1] = D3DVERTEX2(D3DVECTOR(p2.x, p2.y, 0.0f), n, uv1.x,uv2.y); - vertex[2] = D3DVERTEX2(D3DVECTOR(p3.x, p3.y, 0.0f), n, uv2.x,uv2.y); + vertex[0] = D3DVERTEX2(Math::Vector(p1.x, p1.y, 0.0f), n, uv1.x,uv1.y); + vertex[1] = D3DVERTEX2(Math::Vector(p2.x, p2.y, 0.0f), n, uv1.x,uv2.y); + vertex[2] = D3DVERTEX2(Math::Vector(p3.x, p3.y, 0.0f), n, uv2.x,uv2.y); device->DrawPrimitive(D3DPT_TRIANGLELIST, D3DFVF_VERTEX2, vertex, 3, NULL); m_engine->AddStatisticTriangle(1); diff --git a/src/ui/control.cpp b/src/ui/control.cpp index ee08e9f..77fc9ab 100644 --- a/src/ui/control.cpp +++ b/src/ui/control.cpp @@ -439,7 +439,7 @@ void CControl::GlintCreate(Math::Point ref, bool bLeft, bool bUp) void CControl::GlintFrame(const Event &event) { - D3DVECTOR pos, speed; + Math::Vector pos, speed; Math::Point dim; if ( (m_state & STATE_GLINT ) == 0 || @@ -455,7 +455,7 @@ void CControl::GlintFrame(const Event &event) pos.x = m_glintCorner1.x + (m_glintCorner2.x-m_glintCorner1.x)*Math::Rand(); pos.y = m_glintCorner1.y + (m_glintCorner2.y-m_glintCorner1.y)*Math::Rand(); pos.z = 0.0f; - speed = D3DVECTOR(0.0f, 0.0f, 0.0f); + speed = Math::Vector(0.0f, 0.0f, 0.0f); dim.x = ((15.0f+Math::Rand()*15.0f)/640.0f); dim.y = dim.x/0.75f; m_particule->CreateParticule(pos, speed, dim, PARTICONTROL, @@ -655,7 +655,7 @@ void CControl::DrawIcon(Math::Point pos, Math::Point dim, Math::Point uv1, Math: LPDIRECT3DDEVICE7 device; D3DVERTEX2 vertex[8]; // 6 triangles Math::Point p1, p2, p3, p4; - D3DVECTOR n; + Math::Vector n; device = m_engine->RetD3DDevice(); @@ -664,14 +664,14 @@ void CControl::DrawIcon(Math::Point pos, Math::Point dim, Math::Point uv1, Math: p2.x = pos.x + dim.x; p2.y = pos.y + dim.y; - n = D3DVECTOR(0.0f, 0.0f, -1.0f); // normal + n = Math::Vector(0.0f, 0.0f, -1.0f); // normal if ( ex == 0.0f ) // one piece? { - vertex[0] = D3DVERTEX2(D3DVECTOR(p1.x, p1.y, 0.0f), n, uv1.x,uv2.y); - vertex[1] = D3DVERTEX2(D3DVECTOR(p1.x, p2.y, 0.0f), n, uv1.x,uv1.y); - vertex[2] = D3DVERTEX2(D3DVECTOR(p2.x, p1.y, 0.0f), n, uv2.x,uv2.y); - vertex[3] = D3DVERTEX2(D3DVECTOR(p2.x, p2.y, 0.0f), n, uv2.x,uv1.y); + vertex[0] = D3DVERTEX2(Math::Vector(p1.x, p1.y, 0.0f), n, uv1.x,uv2.y); + vertex[1] = D3DVERTEX2(Math::Vector(p1.x, p2.y, 0.0f), n, uv1.x,uv1.y); + vertex[2] = D3DVERTEX2(Math::Vector(p2.x, p1.y, 0.0f), n, uv2.x,uv2.y); + vertex[3] = D3DVERTEX2(Math::Vector(p2.x, p2.y, 0.0f), n, uv2.x,uv1.y); device->DrawPrimitive(D3DPT_TRIANGLESTRIP, D3DFVF_VERTEX2, vertex, 4, NULL); m_engine->AddStatisticTriangle(2); @@ -683,14 +683,14 @@ void CControl::DrawIcon(Math::Point pos, Math::Point dim, Math::Point uv1, Math: p3.x = p1.x + ex*dim.y/(uv2.y-uv1.y); p4.x = p2.x - ex*dim.y/(uv2.y-uv1.y); - vertex[0] = D3DVERTEX2(D3DVECTOR(p1.x, p1.y, 0.0f), n, uv1.x, uv2.y); - vertex[1] = D3DVERTEX2(D3DVECTOR(p1.x, p2.y, 0.0f), n, uv1.x, uv1.y); - vertex[2] = D3DVERTEX2(D3DVECTOR(p3.x, p1.y, 0.0f), n, uv1.x+ex,uv2.y); - vertex[3] = D3DVERTEX2(D3DVECTOR(p3.x, p2.y, 0.0f), n, uv1.x+ex,uv1.y); - vertex[4] = D3DVERTEX2(D3DVECTOR(p4.x, p1.y, 0.0f), n, uv2.x-ex,uv2.y); - vertex[5] = D3DVERTEX2(D3DVECTOR(p4.x, p2.y, 0.0f), n, uv2.x-ex,uv1.y); - vertex[6] = D3DVERTEX2(D3DVECTOR(p2.x, p1.y, 0.0f), n, uv2.x, uv2.y); - vertex[7] = D3DVERTEX2(D3DVECTOR(p2.x, p2.y, 0.0f), n, uv2.x, uv1.y); + vertex[0] = D3DVERTEX2(Math::Vector(p1.x, p1.y, 0.0f), n, uv1.x, uv2.y); + vertex[1] = D3DVERTEX2(Math::Vector(p1.x, p2.y, 0.0f), n, uv1.x, uv1.y); + vertex[2] = D3DVERTEX2(Math::Vector(p3.x, p1.y, 0.0f), n, uv1.x+ex,uv2.y); + vertex[3] = D3DVERTEX2(Math::Vector(p3.x, p2.y, 0.0f), n, uv1.x+ex,uv1.y); + vertex[4] = D3DVERTEX2(Math::Vector(p4.x, p1.y, 0.0f), n, uv2.x-ex,uv2.y); + vertex[5] = D3DVERTEX2(Math::Vector(p4.x, p2.y, 0.0f), n, uv2.x-ex,uv1.y); + vertex[6] = D3DVERTEX2(Math::Vector(p2.x, p1.y, 0.0f), n, uv2.x, uv2.y); + vertex[7] = D3DVERTEX2(Math::Vector(p2.x, p2.y, 0.0f), n, uv2.x, uv1.y); device->DrawPrimitive(D3DPT_TRIANGLESTRIP, D3DFVF_VERTEX2, vertex, 8, NULL); m_engine->AddStatisticTriangle(6); @@ -700,14 +700,14 @@ void CControl::DrawIcon(Math::Point pos, Math::Point dim, Math::Point uv1, Math: p3.y = p1.y + ex*dim.x/(uv2.x-uv1.x); p4.y = p2.y - ex*dim.x/(uv2.x-uv1.x); - vertex[0] = D3DVERTEX2(D3DVECTOR(p2.x, p1.y, 0.0f), n, uv2.x,uv2.y ); - vertex[1] = D3DVERTEX2(D3DVECTOR(p1.x, p1.y, 0.0f), n, uv1.x,uv2.y ); - vertex[2] = D3DVERTEX2(D3DVECTOR(p2.x, p3.y, 0.0f), n, uv2.x,uv2.y-ex); - vertex[3] = D3DVERTEX2(D3DVECTOR(p1.x, p3.y, 0.0f), n, uv1.x,uv2.y-ex); - vertex[4] = D3DVERTEX2(D3DVECTOR(p2.x, p4.y, 0.0f), n, uv2.x,uv1.y+ex); - vertex[5] = D3DVERTEX2(D3DVECTOR(p1.x, p4.y, 0.0f), n, uv1.x,uv1.y+ex); - vertex[6] = D3DVERTEX2(D3DVECTOR(p2.x, p2.y, 0.0f), n, uv2.x,uv1.y ); - vertex[7] = D3DVERTEX2(D3DVECTOR(p1.x, p2.y, 0.0f), n, uv1.x,uv1.y ); + vertex[0] = D3DVERTEX2(Math::Vector(p2.x, p1.y, 0.0f), n, uv2.x,uv2.y ); + vertex[1] = D3DVERTEX2(Math::Vector(p1.x, p1.y, 0.0f), n, uv1.x,uv2.y ); + vertex[2] = D3DVERTEX2(Math::Vector(p2.x, p3.y, 0.0f), n, uv2.x,uv2.y-ex); + vertex[3] = D3DVERTEX2(Math::Vector(p1.x, p3.y, 0.0f), n, uv1.x,uv2.y-ex); + vertex[4] = D3DVERTEX2(Math::Vector(p2.x, p4.y, 0.0f), n, uv2.x,uv1.y+ex); + vertex[5] = D3DVERTEX2(Math::Vector(p1.x, p4.y, 0.0f), n, uv1.x,uv1.y+ex); + vertex[6] = D3DVERTEX2(Math::Vector(p2.x, p2.y, 0.0f), n, uv2.x,uv1.y ); + vertex[7] = D3DVERTEX2(Math::Vector(p1.x, p2.y, 0.0f), n, uv1.x,uv1.y ); device->DrawPrimitive(D3DPT_TRIANGLESTRIP, D3DFVF_VERTEX2, vertex, 8, NULL); m_engine->AddStatisticTriangle(6); @@ -723,7 +723,7 @@ void CControl::DrawIcon(Math::Point pos, Math::Point dim, Math::Point uv1, Math: LPDIRECT3DDEVICE7 device; D3DVERTEX2 vertex[8]; // 6 triangles Math::Point p1, p2, p3, p4; - D3DVECTOR n; + Math::Vector n; device = m_engine->RetD3DDevice(); @@ -732,7 +732,7 @@ void CControl::DrawIcon(Math::Point pos, Math::Point dim, Math::Point uv1, Math: p2.x = pos.x + dim.x; p2.y = pos.y + dim.y; - n = D3DVECTOR(0.0f, 0.0f, -1.0f); // normal + n = Math::Vector(0.0f, 0.0f, -1.0f); // normal if ( corner.x > dim.x/2.0f ) corner.x = dim.x/2.0f; if ( corner.y > dim.y/2.0f ) corner.y = dim.y/2.0f; @@ -747,38 +747,38 @@ void CControl::DrawIcon(Math::Point pos, Math::Point dim, Math::Point uv1, Math: p4.y = p2.y - corner.y; // Bottom horizontal band. - vertex[0] = D3DVERTEX2(D3DVECTOR(p1.x, p1.y, 0.0f), n, uv1.x, uv2.y ); - vertex[1] = D3DVERTEX2(D3DVECTOR(p1.x, p3.y, 0.0f), n, uv1.x, uv2.y-ex); - vertex[2] = D3DVERTEX2(D3DVECTOR(p3.x, p1.y, 0.0f), n, uv1.x+ex,uv2.y ); - vertex[3] = D3DVERTEX2(D3DVECTOR(p3.x, p3.y, 0.0f), n, uv1.x+ex,uv2.y-ex); - vertex[4] = D3DVERTEX2(D3DVECTOR(p4.x, p1.y, 0.0f), n, uv2.x-ex,uv2.y ); - vertex[5] = D3DVERTEX2(D3DVECTOR(p4.x, p3.y, 0.0f), n, uv2.x-ex,uv2.y-ex); - vertex[6] = D3DVERTEX2(D3DVECTOR(p2.x, p1.y, 0.0f), n, uv2.x, uv2.y ); - vertex[7] = D3DVERTEX2(D3DVECTOR(p2.x, p3.y, 0.0f), n, uv2.x, uv2.y-ex); + vertex[0] = D3DVERTEX2(Math::Vector(p1.x, p1.y, 0.0f), n, uv1.x, uv2.y ); + vertex[1] = D3DVERTEX2(Math::Vector(p1.x, p3.y, 0.0f), n, uv1.x, uv2.y-ex); + vertex[2] = D3DVERTEX2(Math::Vector(p3.x, p1.y, 0.0f), n, uv1.x+ex,uv2.y ); + vertex[3] = D3DVERTEX2(Math::Vector(p3.x, p3.y, 0.0f), n, uv1.x+ex,uv2.y-ex); + vertex[4] = D3DVERTEX2(Math::Vector(p4.x, p1.y, 0.0f), n, uv2.x-ex,uv2.y ); + vertex[5] = D3DVERTEX2(Math::Vector(p4.x, p3.y, 0.0f), n, uv2.x-ex,uv2.y-ex); + vertex[6] = D3DVERTEX2(Math::Vector(p2.x, p1.y, 0.0f), n, uv2.x, uv2.y ); + vertex[7] = D3DVERTEX2(Math::Vector(p2.x, p3.y, 0.0f), n, uv2.x, uv2.y-ex); device->DrawPrimitive(D3DPT_TRIANGLESTRIP, D3DFVF_VERTEX2, vertex, 8, NULL); m_engine->AddStatisticTriangle(6); // Central horizontal band. - vertex[0] = D3DVERTEX2(D3DVECTOR(p1.x, p3.y, 0.0f), n, uv1.x, uv2.y-ex); - vertex[1] = D3DVERTEX2(D3DVECTOR(p1.x, p4.y, 0.0f), n, uv1.x, uv1.y+ex); - vertex[2] = D3DVERTEX2(D3DVECTOR(p3.x, p3.y, 0.0f), n, uv1.x+ex,uv2.y-ex); - vertex[3] = D3DVERTEX2(D3DVECTOR(p3.x, p4.y, 0.0f), n, uv1.x+ex,uv1.y+ex); - vertex[4] = D3DVERTEX2(D3DVECTOR(p4.x, p3.y, 0.0f), n, uv2.x-ex,uv2.y-ex); - vertex[5] = D3DVERTEX2(D3DVECTOR(p4.x, p4.y, 0.0f), n, uv2.x-ex,uv1.y+ex); - vertex[6] = D3DVERTEX2(D3DVECTOR(p2.x, p3.y, 0.0f), n, uv2.x, uv2.y-ex); - vertex[7] = D3DVERTEX2(D3DVECTOR(p2.x, p4.y, 0.0f), n, uv2.x, uv1.y+ex); + vertex[0] = D3DVERTEX2(Math::Vector(p1.x, p3.y, 0.0f), n, uv1.x, uv2.y-ex); + vertex[1] = D3DVERTEX2(Math::Vector(p1.x, p4.y, 0.0f), n, uv1.x, uv1.y+ex); + vertex[2] = D3DVERTEX2(Math::Vector(p3.x, p3.y, 0.0f), n, uv1.x+ex,uv2.y-ex); + vertex[3] = D3DVERTEX2(Math::Vector(p3.x, p4.y, 0.0f), n, uv1.x+ex,uv1.y+ex); + vertex[4] = D3DVERTEX2(Math::Vector(p4.x, p3.y, 0.0f), n, uv2.x-ex,uv2.y-ex); + vertex[5] = D3DVERTEX2(Math::Vector(p4.x, p4.y, 0.0f), n, uv2.x-ex,uv1.y+ex); + vertex[6] = D3DVERTEX2(Math::Vector(p2.x, p3.y, 0.0f), n, uv2.x, uv2.y-ex); + vertex[7] = D3DVERTEX2(Math::Vector(p2.x, p4.y, 0.0f), n, uv2.x, uv1.y+ex); device->DrawPrimitive(D3DPT_TRIANGLESTRIP, D3DFVF_VERTEX2, vertex, 8, NULL); m_engine->AddStatisticTriangle(6); // Top horizontal band. - vertex[0] = D3DVERTEX2(D3DVECTOR(p1.x, p4.y, 0.0f), n, uv1.x, uv1.y+ex); - vertex[1] = D3DVERTEX2(D3DVECTOR(p1.x, p2.y, 0.0f), n, uv1.x, uv1.y ); - vertex[2] = D3DVERTEX2(D3DVECTOR(p3.x, p4.y, 0.0f), n, uv1.x+ex,uv1.y+ex); - vertex[3] = D3DVERTEX2(D3DVECTOR(p3.x, p2.y, 0.0f), n, uv1.x+ex,uv1.y ); - vertex[4] = D3DVERTEX2(D3DVECTOR(p4.x, p4.y, 0.0f), n, uv2.x-ex,uv1.y+ex); - vertex[5] = D3DVERTEX2(D3DVECTOR(p4.x, p2.y, 0.0f), n, uv2.x-ex,uv1.y ); - vertex[6] = D3DVERTEX2(D3DVECTOR(p2.x, p4.y, 0.0f), n, uv2.x, uv1.y+ex); - vertex[7] = D3DVERTEX2(D3DVECTOR(p2.x, p2.y, 0.0f), n, uv2.x, uv1.y ); + vertex[0] = D3DVERTEX2(Math::Vector(p1.x, p4.y, 0.0f), n, uv1.x, uv1.y+ex); + vertex[1] = D3DVERTEX2(Math::Vector(p1.x, p2.y, 0.0f), n, uv1.x, uv1.y ); + vertex[2] = D3DVERTEX2(Math::Vector(p3.x, p4.y, 0.0f), n, uv1.x+ex,uv1.y+ex); + vertex[3] = D3DVERTEX2(Math::Vector(p3.x, p2.y, 0.0f), n, uv1.x+ex,uv1.y ); + vertex[4] = D3DVERTEX2(Math::Vector(p4.x, p4.y, 0.0f), n, uv2.x-ex,uv1.y+ex); + vertex[5] = D3DVERTEX2(Math::Vector(p4.x, p2.y, 0.0f), n, uv2.x-ex,uv1.y ); + vertex[6] = D3DVERTEX2(Math::Vector(p2.x, p4.y, 0.0f), n, uv2.x, uv1.y+ex); + vertex[7] = D3DVERTEX2(Math::Vector(p2.x, p2.y, 0.0f), n, uv2.x, uv1.y ); device->DrawPrimitive(D3DPT_TRIANGLESTRIP, D3DFVF_VERTEX2, vertex, 8, NULL); m_engine->AddStatisticTriangle(6); } diff --git a/src/ui/displayinfo.cpp b/src/ui/displayinfo.cpp index 5921453..f788445 100644 --- a/src/ui/displayinfo.cpp +++ b/src/ui/displayinfo.cpp @@ -466,7 +466,7 @@ void CDisplayInfo::StartDisplayInfo(char *filename, int index, bool bSoluce) light.dcvDiffuse.r = 1.0f; light.dcvDiffuse.g = 1.0f; light.dcvDiffuse.b = 1.0f; - light.dvDirection = D3DVECTOR(1.0f, 0.0f, 1.0f); + light.dvDirection = D3DVECTOR(1.0f, 0.0f, 1.0f); m_lightSuppl = m_light->CreateLight(); m_light->SetLight(m_lightSuppl, light); m_light->SetLightExcluType(m_lightSuppl, TYPETERRAIN); diff --git a/src/ui/displaytext.cpp b/src/ui/displaytext.cpp index 3fa2687..f1dba43 100644 --- a/src/ui/displaytext.cpp +++ b/src/ui/displaytext.cpp @@ -61,7 +61,7 @@ CDisplayText::CDisplayText(CInstanceManager* iMan) for ( i=0 ; iDeleteControl(EventMsg(EVENT_DT_VISIT0+i)); } m_bExist[i] = false; - m_visitGoal[i] = D3DVECTOR(0.0f, 0.0f, 0.0f); + m_visitGoal[i] = Math::Vector(0.0f, 0.0f, 0.0f); m_visitDist[i] = 0.0f; m_visitHeight[i] = 0.0f; m_time[i] = 0.0f; @@ -453,12 +453,12 @@ void CDisplayText::SetEnable(bool bEnable) // Returns the goal during a visit. -D3DVECTOR CDisplayText::RetVisitGoal(EventMsg event) +Math::Vector CDisplayText::RetVisitGoal(EventMsg event) { int i; i = event-EVENT_DT_VISIT0; - if ( i < 0 || i >= MAXDTLINE ) return D3DVECTOR(0.0f, 0.0f, 0.0f); + if ( i < 0 || i >= MAXDTLINE ) return Math::Vector(0.0f, 0.0f, 0.0f); return m_visitGoal[i]; } diff --git a/src/ui/displaytext.h b/src/ui/displaytext.h index 381e2f6..f0c6992 100644 --- a/src/ui/displaytext.h +++ b/src/ui/displaytext.h @@ -53,16 +53,16 @@ public: bool EventProcess(const Event &event); void DisplayError(Error err, CObject* pObj, float time=10.0f); - void DisplayError(Error err, D3DVECTOR goal, float height=15.0f, float dist=60.0f, float time=10.0f); + void DisplayError(Error err, Math::Vector goal, float height=15.0f, float dist=60.0f, float time=10.0f); void DisplayText(char *text, CObject* pObj, float time=10.0f, TextType type=TT_INFO); - void DisplayText(char *text, D3DVECTOR goal, float height=15.0f, float dist=60.0f, float time=10.0f, TextType type=TT_INFO); + void DisplayText(char *text, Math::Vector goal, float height=15.0f, float dist=60.0f, float time=10.0f, TextType type=TT_INFO); void HideText(bool bHide); void ClearText(); bool ClearLastText(); void SetDelay(float factor); void SetEnable(bool bEnable); - D3DVECTOR RetVisitGoal(EventMsg event); + Math::Vector RetVisitGoal(EventMsg event); float RetVisitDist(EventMsg event); float RetVisitHeight(EventMsg event); @@ -84,7 +84,7 @@ protected: bool m_bExist[MAXDTLINE]; float m_time[MAXDTLINE]; - D3DVECTOR m_visitGoal[MAXDTLINE]; + Math::Vector m_visitGoal[MAXDTLINE]; float m_visitDist[MAXDTLINE]; float m_visitHeight[MAXDTLINE]; diff --git a/src/ui/maindialog.cpp b/src/ui/maindialog.cpp index f57a913..7e80fcf 100644 --- a/src/ui/maindialog.cpp +++ b/src/ui/maindialog.cpp @@ -3253,9 +3253,9 @@ void CMainDialog::GlintMove() // Returns the position for a sound. -D3DVECTOR SoundPos(Math::Point pos) +Math::Vector SoundPos(Math::Point pos) { - D3DVECTOR s; + Math::Vector s; s.x = (pos.x-0.5f)*2.0f; s.y = (pos.y-0.5f)*2.0f; @@ -3266,9 +3266,9 @@ D3DVECTOR SoundPos(Math::Point pos) // Returns a random position for a sound. -D3DVECTOR SoundRand() +Math::Vector SoundRand() { - D3DVECTOR s; + Math::Vector s; s.x = (Math::Rand()-0.5f)*2.0f; s.y = (Math::Rand()-0.5f)*2.0f; @@ -3283,7 +3283,7 @@ void CMainDialog::FrameParticule(float rTime) { #if _NEWLOOK #else - D3DVECTOR pos, speed; + Math::Vector pos, speed; Math::Point dim; float *pParti, *pGlint; int nParti, nGlint; @@ -3570,7 +3570,7 @@ void CMainDialog::FrameParticule(float rTime) void CMainDialog::NiceParticule(Math::Point mouse, bool bPress) { - D3DVECTOR pos, speed; + Math::Vector pos, speed; Math::Point dim; if ( !m_bRain ) return; @@ -4199,15 +4199,15 @@ void CMainDialog::CameraPerso() { if ( m_persoTab == 0 ) { -//? m_camera->Init(D3DVECTOR(4.0f, 0.0f, 0.0f), -//? D3DVECTOR(0.0f, 0.0f, 1.0f), 0.0f); - m_camera->Init(D3DVECTOR(6.0f, 0.0f, 0.0f), - D3DVECTOR(0.0f, 0.2f, 1.5f), 0.0f); +//? m_camera->Init(Math::Vector(4.0f, 0.0f, 0.0f), +//? Math::Vector(0.0f, 0.0f, 1.0f), 0.0f); + m_camera->Init(Math::Vector(6.0f, 0.0f, 0.0f), + Math::Vector(0.0f, 0.2f, 1.5f), 0.0f); } else { - m_camera->Init(D3DVECTOR(18.0f, 0.0f, 4.5f), - D3DVECTOR(0.0f, 1.6f, 4.5f), 0.0f); + m_camera->Init(Math::Vector(18.0f, 0.0f, 4.5f), + Math::Vector(0.0f, 1.6f, 4.5f), 0.0f); } m_camera->SetType(CAMERA_SCRIPT); @@ -6360,7 +6360,7 @@ void CMainDialog::StartDialog(Math::Point dim, bool bFire, bool bOK, bool bCance void CMainDialog::FrameDialog(float rTime) { CWindow* pw; - D3DVECTOR pos, speed; + Math::Vector pos, speed; Math::Point dim, dpos, ddim; float zoom; int i; @@ -6409,7 +6409,7 @@ void CMainDialog::FrameDialog(float rTime) ddim = m_dialogDim; pos.z = 0.0f; - speed = D3DVECTOR(0.0f, 0.0f, 0.0f); + speed = Math::Vector(0.0f, 0.0f, 0.0f); for ( i=0 ; i<2 ; i++ ) { diff --git a/src/ui/map.cpp b/src/ui/map.cpp index 437ad58..7c62d3a 100644 --- a/src/ui/map.cpp +++ b/src/ui/map.cpp @@ -286,7 +286,7 @@ CObject* CMap::DetectObject(Math::Point pos, bool &bInMap) if ( m_map[i].color == MAPCOLOR_BBOX && !m_bRadar ) continue; if ( m_map[i].color == MAPCOLOR_ALIEN && !m_bRadar ) continue; - dist = Length(m_map[i].pos.x-pos.x, m_map[i].pos.y-pos.y); + dist = Math::Point(m_map[i].pos.x-pos.x, m_map[i].pos.y-pos.y).Length(); if ( dist > m_half/m_zoom*8.0f/100.0f ) continue; // too far? if ( dist < min ) { @@ -932,15 +932,15 @@ void CMap::DrawTriangle(Math::Point p1, Math::Point p2, Math::Point p3, Math::Po { LPDIRECT3DDEVICE7 device; D3DVERTEX2 vertex[3]; // 1 triangle - D3DVECTOR n; + Math::Vector n; device = m_engine->RetD3DDevice(); - n = D3DVECTOR(0.0f, 0.0f, -1.0f); // normal + n = Math::Vector(0.0f, 0.0f, -1.0f); // normal - vertex[0] = D3DVERTEX2(D3DVECTOR(p1.x, p1.y, 0.0f), n, uv1.x,uv1.y); - vertex[1] = D3DVERTEX2(D3DVECTOR(p2.x, p2.y, 0.0f), n, uv1.x,uv2.y); - vertex[2] = D3DVERTEX2(D3DVECTOR(p3.x, p3.y, 0.0f), n, uv2.x,uv2.y); + vertex[0] = D3DVERTEX2(Math::Vector(p1.x, p1.y, 0.0f), n, uv1.x,uv1.y); + vertex[1] = D3DVERTEX2(Math::Vector(p2.x, p2.y, 0.0f), n, uv1.x,uv2.y); + vertex[2] = D3DVERTEX2(Math::Vector(p3.x, p3.y, 0.0f), n, uv2.x,uv2.y); device->DrawPrimitive(D3DPT_TRIANGLELIST, D3DFVF_VERTEX2, vertex, 3, NULL); m_engine->AddStatisticTriangle(1); @@ -952,24 +952,24 @@ void CMap::DrawPenta(Math::Point p1, Math::Point p2, Math::Point p3, Math::Point { LPDIRECT3DDEVICE7 device; D3DVERTEX2 vertex[5]; // 1 pentagon - D3DVECTOR n; + Math::Vector n; device = m_engine->RetD3DDevice(); - n = D3DVECTOR(0.0f, 0.0f, -1.0f); // normal + n = Math::Vector(0.0f, 0.0f, -1.0f); // normal #if 1 - vertex[0] = D3DVERTEX2(D3DVECTOR(p1.x, p1.y, 0.0f), n, uv1.x,uv1.y); - vertex[1] = D3DVERTEX2(D3DVECTOR(p2.x, p2.y, 0.0f), n, uv1.x,uv2.y); - vertex[2] = D3DVERTEX2(D3DVECTOR(p5.x, p5.y, 0.0f), n, uv2.x,uv2.y); - vertex[3] = D3DVERTEX2(D3DVECTOR(p3.x, p3.y, 0.0f), n, uv2.x,uv2.y); - vertex[4] = D3DVERTEX2(D3DVECTOR(p4.x, p4.y, 0.0f), n, uv2.x,uv2.y); + vertex[0] = D3DVERTEX2(Math::Vector(p1.x, p1.y, 0.0f), n, uv1.x,uv1.y); + vertex[1] = D3DVERTEX2(Math::Vector(p2.x, p2.y, 0.0f), n, uv1.x,uv2.y); + vertex[2] = D3DVERTEX2(Math::Vector(p5.x, p5.y, 0.0f), n, uv2.x,uv2.y); + vertex[3] = D3DVERTEX2(Math::Vector(p3.x, p3.y, 0.0f), n, uv2.x,uv2.y); + vertex[4] = D3DVERTEX2(Math::Vector(p4.x, p4.y, 0.0f), n, uv2.x,uv2.y); device->DrawPrimitive(D3DPT_TRIANGLESTRIP, D3DFVF_VERTEX2, vertex, 5, NULL); #else - vertex[0] = D3DVERTEX2(D3DVECTOR(p2.x, p2.y, 0.0f), n, uv1.x,uv1.y); - vertex[1] = D3DVERTEX2(D3DVECTOR(p3.x, p3.y, 0.0f), n, uv1.x,uv2.y); - vertex[2] = D3DVERTEX2(D3DVECTOR(p4.x, p4.y, 0.0f), n, uv2.x,uv2.y); + vertex[0] = D3DVERTEX2(Math::Vector(p2.x, p2.y, 0.0f), n, uv1.x,uv1.y); + vertex[1] = D3DVERTEX2(Math::Vector(p3.x, p3.y, 0.0f), n, uv1.x,uv2.y); + vertex[2] = D3DVERTEX2(Math::Vector(p4.x, p4.y, 0.0f), n, uv2.x,uv2.y); device->DrawPrimitive(D3DPT_TRIANGLELIST, D3DFVF_VERTEX2, vertex, 3, NULL); #endif @@ -983,7 +983,7 @@ void CMap::DrawVertex(Math::Point uv1, Math::Point uv2, float zoom) LPDIRECT3DDEVICE7 device; D3DVERTEX2 vertex[4]; // 2 triangles Math::Point p1, p2, c; - D3DVECTOR n; + Math::Vector n; device = m_engine->RetD3DDevice(); @@ -1005,12 +1005,12 @@ void CMap::DrawVertex(Math::Point uv1, Math::Point uv2, float zoom) m_mapDim.x = p2.x-p1.x; m_mapDim.y = p2.y-p1.y; - n = D3DVECTOR(0.0f, 0.0f, -1.0f); // normal + n = Math::Vector(0.0f, 0.0f, -1.0f); // normal - vertex[0] = D3DVERTEX2(D3DVECTOR(p1.x, p1.y, 0.0f), n, uv1.x,uv2.y); - vertex[1] = D3DVERTEX2(D3DVECTOR(p1.x, p2.y, 0.0f), n, uv1.x,uv1.y); - vertex[2] = D3DVERTEX2(D3DVECTOR(p2.x, p1.y, 0.0f), n, uv2.x,uv2.y); - vertex[3] = D3DVERTEX2(D3DVECTOR(p2.x, p2.y, 0.0f), n, uv2.x,uv1.y); + vertex[0] = D3DVERTEX2(Math::Vector(p1.x, p1.y, 0.0f), n, uv1.x,uv2.y); + vertex[1] = D3DVERTEX2(Math::Vector(p1.x, p2.y, 0.0f), n, uv1.x,uv1.y); + vertex[2] = D3DVERTEX2(Math::Vector(p2.x, p1.y, 0.0f), n, uv2.x,uv2.y); + vertex[3] = D3DVERTEX2(Math::Vector(p2.x, p2.y, 0.0f), n, uv2.x,uv1.y); device->DrawPrimitive(D3DPT_TRIANGLESTRIP, D3DFVF_VERTEX2, vertex, 4, NULL); m_engine->AddStatisticTriangle(2); @@ -1022,7 +1022,7 @@ void CMap::DrawVertex(Math::Point uv1, Math::Point uv2, float zoom) void CMap::UpdateTerrain() { D3DCOLORVALUE color; - D3DVECTOR pos; + Math::Vector pos; float scale, water, level, intensity; int x, y; @@ -1081,7 +1081,7 @@ void CMap::UpdateTerrain() void CMap::UpdateTerrain(int bx, int by, int ex, int ey) { D3DCOLORVALUE color; - D3DVECTOR pos; + Math::Vector pos; float scale, water, level, intensity; int x, y; @@ -1159,7 +1159,7 @@ void CMap::UpdateObject(CObject* pObj) { ObjectType type; MapColor color; - D3DVECTOR pos; + Math::Vector pos; Math::Point ppos; float dir; diff --git a/src/ui/shortcut.cpp b/src/ui/shortcut.cpp index c96cc92..7651c63 100644 --- a/src/ui/shortcut.cpp +++ b/src/ui/shortcut.cpp @@ -198,7 +198,7 @@ void CShortcut::DrawVertex(int icon, float zoom) LPDIRECT3DDEVICE7 device; D3DVERTEX2 vertex[4]; // 2 triangles Math::Point p1, p2, c; - D3DVECTOR n; + Math::Vector n; float u1, u2, v1, v2, dp; device = m_engine->RetD3DDevice(); @@ -228,12 +228,12 @@ void CShortcut::DrawVertex(int icon, float zoom) u2 -= dp; v2 -= dp; - n = D3DVECTOR(0.0f, 0.0f, -1.0f); // normal + n = Math::Vector(0.0f, 0.0f, -1.0f); // normal - vertex[0] = D3DVERTEX2(D3DVECTOR(p1.x, p1.y, 0.0f), n, u1,v2); - vertex[1] = D3DVERTEX2(D3DVECTOR(p1.x, p2.y, 0.0f), n, u1,v1); - vertex[2] = D3DVERTEX2(D3DVECTOR(p2.x, p1.y, 0.0f), n, u2,v2); - vertex[3] = D3DVERTEX2(D3DVECTOR(p2.x, p2.y, 0.0f), n, u2,v1); + vertex[0] = D3DVERTEX2(Math::Vector(p1.x, p1.y, 0.0f), n, u1,v2); + vertex[1] = D3DVERTEX2(Math::Vector(p1.x, p2.y, 0.0f), n, u1,v1); + vertex[2] = D3DVERTEX2(Math::Vector(p2.x, p1.y, 0.0f), n, u2,v2); + vertex[3] = D3DVERTEX2(Math::Vector(p2.x, p2.y, 0.0f), n, u2,v1); device->DrawPrimitive(D3DPT_TRIANGLESTRIP, D3DFVF_VERTEX2, vertex, 4, NULL); m_engine->AddStatisticTriangle(2); -- cgit v1.2.3-1-g7c22