1
0
Fork 0
mirror of https://git.rip/DMCA_FUCKER/re3.git synced 2024-11-10 20:29:15 +00:00
re3/src/core/Placeable.cpp

65 lines
1 KiB
C++
Raw Normal View History

2019-05-15 14:52:37 +00:00
#include "common.h"
#include "Placeable.h"
2020-04-17 13:31:11 +00:00
2019-05-15 14:52:37 +00:00
CPlaceable::CPlaceable(void)
{
m_matrix.SetScale(1.0f);
}
2019-07-31 15:54:18 +00:00
CPlaceable::~CPlaceable(void) = default;
2019-05-15 14:52:37 +00:00
void
CPlaceable::SetHeading(float angle)
{
2020-05-05 01:45:18 +00:00
CVector pos = GetMatrix().GetPosition();
2019-05-15 14:52:37 +00:00
m_matrix.SetRotateZ(angle);
2020-05-05 01:45:18 +00:00
GetMatrix().Translate(pos);
2019-05-15 14:52:37 +00:00
}
bool
CPlaceable::IsWithinArea(float x1, float y1, float x2, float y2)
{
2019-06-24 18:01:15 +00:00
float tmp;
if(x1 > x2){
tmp = x1;
x1 = x2;
x2 = tmp;
2019-05-15 14:52:37 +00:00
}
2019-06-24 18:01:15 +00:00
if(y1 > y2){
tmp = y1;
y1 = y2;
y2 = tmp;
2019-05-15 14:52:37 +00:00
}
2019-06-24 18:01:15 +00:00
return x1 <= GetPosition().x && GetPosition().x <= x2 &&
y1 <= GetPosition().y && GetPosition().y <= y2;
2019-05-15 14:52:37 +00:00
}
bool
CPlaceable::IsWithinArea(float x1, float y1, float z1, float x2, float y2, float z2)
{
2019-06-24 18:01:15 +00:00
float tmp;
if(x1 > x2){
tmp = x1;
x1 = x2;
x2 = tmp;
2019-05-15 14:52:37 +00:00
}
2019-06-24 18:01:15 +00:00
if(y1 > y2){
tmp = y1;
y1 = y2;
y2 = tmp;
2019-05-15 14:52:37 +00:00
}
2019-06-24 18:01:15 +00:00
if(z1 > z2){
tmp = z1;
z1 = z2;
z2 = tmp;
2019-05-15 14:52:37 +00:00
}
2019-06-24 18:01:15 +00:00
return x1 <= GetPosition().x && GetPosition().x <= x2 &&
y1 <= GetPosition().y && GetPosition().y <= y2 &&
z1 <= GetPosition().z && GetPosition().z <= z2;
2019-05-15 14:52:37 +00:00
}