class Engine
{
public:
virtual void function1() = 0;
virtual void function2() = 0;
virtual void function3() = 0;
virtual void function4() = 0;
virtual void function5() = 0;
virtual void function6() = 0;
virtual void function7() = 0;
virtual void function8() = 0;
virtual bool GetPlayerInfo(int ent_num, player_info_t *pinfo) = 0;
virtual int GetPlayerForUserID(int userID) = 0;
virtual void function9() = 0;
virtual bool Con_IsVisible() = 0;
virtual int GetLocalPlayer() = 0;
virtual void function10() = 0;
virtual void function11() = 0;
virtual void function12() = 0;
virtual void function13() = 0;
virtual void function14() = 0;
virtual void function15() = 0;
virtual void function16() = 0;
virtual void function17() = 0;
virtual int GetMaxClients() = 0;
virtual void function18() = 0;
virtual void function19() = 0;
virtual void function20() = 0;
virtual void function21() = 0;
virtual bool IsInGame() = 0;
virtual void function22() = 0;
virtual void function23() = 0;
virtual void function24() = 0;
virtual void function25() = 0;
virtual void function26() = 0;
virtual void function27() = 0;
virtual void function28() = 0;
virtual void function29() = 0;
virtual void function30() = 0;
virtual float* WorldToScreenMatrix() = 0;
};
bool ScreenTransform(Vector &point, Vector &screen)
{
float w;
float *WorldToScreen = engine->WorldToScreenMatrix(); //hier bekommste von der Engine die WorldToScreenMatrix
screen.x = WorldToScreen[0] * point.x + WorldToScreen[1] * point.y + WorldToScreen[2] * point.z + WorldToScreen[3];
screen.y = WorldToScreen[4] * point.x + WorldToScreen[5] * point.y + WorldToScreen[6] * point.z + WorldToScreen[7];
w = WorldToScreen[12] * point.x + WorldToScreen[13] * point.y + WorldToScreen[14] * point.z + WorldToScreen[15];
screen.z = 0.0f;
bool behind = false;
if (w < 0.001f)
{
behind = true;
}
else
{
behind = false;
float invw = 1.0f / w;
screen.x *= invw;
screen.y *= invw;
}
return behind;
}
//---------------------------------------------------------------------------
bool WorldToScreen(Vector &vOrigin, Vector &vScreen)
{
if (ScreenTransform(vOrigin, vScreen) == false)
{
int iScreenWidth = gui.Viewport.Width, iScreenHeight = gui.Viewport.Height;
float x = iScreenWidth / 2;
float y = iScreenHeight / 2;
x += 0.5 * vScreen.x * iScreenWidth + 0.5;
y -= 0.5 * vScreen.y * iScreenHeight + 0.5;
vScreen.x = x;
vScreen.y = y;
return true;
}
return false;
}