bool OnScreen(CVector vect) { SF->getCLEO()->callOpcode("00C2: %f %f %f 0.0", vect.fX, vect.fY, vect.fZ); return SF->getCLEO()->GetCondResult(); }
CVector2D get_screen_coords(CVector vecWorld) { float x, y, z; double fRecip; const D3DXMATRIX m{ reinterpret_cast(0xB6FA2C) }; unsigned long dwLenX = *reinterpret_cast(0xC17044); unsigned long dwLenY = *reinterpret_cast(0xC17048); x = (vecWorld.fZ * m._31) + (vecWorld.fY * m._21) + (vecWorld.fX * m._11) + m._41; y = (vecWorld.fZ * m._32) + (vecWorld.fY * m._22) + (vecWorld.fX * m._12) + m._42; z = (vecWorld.fZ * m._33) + (vecWorld.fY * m._23) + (vecWorld.fX * m._13) + m._43; fRecip = 1.0 / z; x *= static_cast(fRecip * dwLenX); y *= static_cast(fRecip * dwLenY); return { x, y }; } bool is_point_on_screen(CVector vecWorld) { const D3DXMATRIX m{ reinterpret_cast(0xB6FA2C) }; const unsigned long dwLenX = *reinterpret_cast(0xC17044); const unsigned long dwLenY = *reinterpret_cast(0xC17048); float z; z = (vecWorld.fZ * m._33) + (vecWorld.fY * m._23) + (vecWorld.fX * m._13) + m._43; return z >= 1.0f; }