2005-09-12 22:04:26 +02:00
|
|
|
#include "precompiled.h"
|
|
|
|
|
|
|
|
// TODO: organise things better, rather than sticking them in Misc
|
|
|
|
|
|
|
|
#include "Messages.h"
|
|
|
|
|
2006-03-21 21:55:45 +01:00
|
|
|
#include "maths/Vector3D.h"
|
|
|
|
#include "ps/Game.h"
|
|
|
|
#include "graphics/GameView.h"
|
2005-09-12 22:04:26 +02:00
|
|
|
|
|
|
|
void AtlasMessage::Position::GetWorldSpace(CVector3D& vec) const
|
|
|
|
{
|
|
|
|
switch (type)
|
|
|
|
{
|
|
|
|
case 0:
|
|
|
|
vec.Set(type0.x, type0.y, type0.z);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case 1:
|
|
|
|
vec = g_Game->GetView()->GetCamera()->GetWorldCoordinates(type1.x, type1.y);
|
|
|
|
break;
|
|
|
|
|
2005-10-09 05:26:16 +02:00
|
|
|
case 2:
|
|
|
|
debug_warn("Invalid Position acquisition (unchanged without previous)");
|
|
|
|
vec.Set(0.f, 0.f, 0.f);
|
|
|
|
break;
|
|
|
|
|
2005-09-12 22:04:26 +02:00
|
|
|
default:
|
|
|
|
debug_warn("Invalid Position type");
|
|
|
|
vec.Set(0.f, 0.f, 0.f);
|
|
|
|
}
|
|
|
|
}
|
2005-09-15 07:31:49 +02:00
|
|
|
|
2005-12-02 22:08:10 +01:00
|
|
|
void AtlasMessage::Position::GetWorldSpace(CVector3D& vec, float h) const
|
|
|
|
{
|
|
|
|
switch (type)
|
|
|
|
{
|
|
|
|
case 1:
|
|
|
|
vec = g_Game->GetView()->GetCamera()->GetWorldCoordinates(type1.x, type1.y, h);
|
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
|
|
|
GetWorldSpace(vec);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2005-10-09 05:26:16 +02:00
|
|
|
void AtlasMessage::Position::GetWorldSpace(CVector3D& vec, const CVector3D& prev) const
|
|
|
|
{
|
|
|
|
switch (type)
|
|
|
|
{
|
|
|
|
case 2:
|
|
|
|
vec = prev;
|
|
|
|
break;
|
2005-12-02 22:08:10 +01:00
|
|
|
|
2005-10-09 05:26:16 +02:00
|
|
|
default:
|
|
|
|
GetWorldSpace(vec);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2005-09-15 07:31:49 +02:00
|
|
|
void AtlasMessage::Position::GetScreenSpace(float& x, float& y) const
|
|
|
|
{
|
|
|
|
switch (type)
|
|
|
|
{
|
|
|
|
case 0:
|
|
|
|
g_Game->GetView()->GetCamera()->GetScreenCoordinates(CVector3D(type0.x, type0.y, type0.x), x, y);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case 1:
|
|
|
|
x = type1.x;
|
|
|
|
y = type1.y;
|
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
|
|
|
debug_warn("Invalid Position type");
|
|
|
|
x = y = 0.f;
|
|
|
|
}
|
|
|
|
}
|