Skip to content

Commit

Permalink
Refactor: Keep old behavior changed by previous commit
Browse files Browse the repository at this point in the history
The following usages across the code base were changed
`flt_min`  -> `flt_lowest`
`flt_zero` -> `flt_min`
`dbl_zero` -> `dbl_min`
  • Loading branch information
AMS21 committed Dec 4, 2023
1 parent 14d22d6 commit fda0f0a
Show file tree
Hide file tree
Showing 25 changed files with 34 additions and 34 deletions.
4 changes: 2 additions & 2 deletions src/Layers/xrRenderPC_R1/LightProjector.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -243,7 +243,7 @@ void CLightProjector::calculate()
v.sub(v_Cs, v_C);
;
#ifdef DEBUG
if ((v.x * v.x + v.y * v.y + v.z * v.z) <= flt_zero)
if ((v.x * v.x + v.y * v.y + v.z * v.z) <= flt_min)
{
IGameObject* OO = dynamic_cast<IGameObject*>(R.O);
Msg("Object[%s] Visual[%s] has invalid position. ", *OO->cName(), *OO->cNameVisual());
Expand Down Expand Up @@ -274,7 +274,7 @@ void CLightProjector::calculate()
}
#endif
// handle invalid object-bug
if ((v.x * v.x + v.y * v.y + v.z * v.z) <= flt_zero)
if ((v.x * v.x + v.y * v.y + v.z * v.z) <= flt_min)
{
// invalidate record, so that object will be unshadowed, but doesn't crash
R.dwTimeValid = Device.dwTimeGlobal;
Expand Down
2 changes: 1 addition & 1 deletion src/utils/xrAI/space_restrictor_wrapper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ void CSpaceRestrictorWrapper::fill_shape(const CShapeData::shape_def& shape)
Fvector().set(-.5f, +.5f, -.5f), Fvector().set(-.5f, +.5f, +.5f), Fvector().set(+.5f, -.5f, -.5f),
Fvector().set(+.5f, -.5f, +.5f), Fvector().set(+.5f, +.5f, -.5f), Fvector().set(+.5f, +.5f, +.5f)};
start = Fvector().set(flt_max, flt_max, flt_max);
dest = Fvector().set(flt_min, flt_min, flt_min);
dest = Fvector().set(flt_lowest, flt_lowest, flt_lowest);
Fmatrix Q;
Q.mul_43(m_xform, shape.data.box);
Fvector temp;
Expand Down
4 changes: 2 additions & 2 deletions src/utils/xrLC/OGF_Face.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -210,7 +210,7 @@ void OGF::Optimize()
// 1. Calc bounds
Fvector2 Tmin,Tmax;
Tmin.set(flt_max,flt_max);
Tmax.set(flt_min,flt_min);
Tmax.set(flt_lowest,flt_lowest);
for (size_t j=0; j<x_vertices.size(); j++) {
x_vertex& V = x_vertices[j];
//Tmin.min (V.UV);
Expand Down Expand Up @@ -291,7 +291,7 @@ void OGF::Optimize()
{
Fvector2 Tmin, Tmax;
Tmin.set(flt_max, flt_max);
Tmax.set(flt_min, flt_min);
Tmax.set(flt_lowest, flt_lowest);
for (size_t j = 0; j < selection.size(); j++)
{
OGF_Vertex& V = data.vertices[selection[j]];
Expand Down
2 changes: 1 addition & 1 deletion src/utils/xrLC_Light/MeshStructure.h
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,7 @@ struct MESHSTRUCTURE_API Tface : public DataVertexType::DataFaceType, public vec
t2.sub(v2, v1);
dN.crossproduct(t1, t2);
double mag = dN.magnitude();
if (mag < dbl_zero)
if (mag < dbl_min)
{
Failure();
Dvector Nabs;
Expand Down
6 changes: 3 additions & 3 deletions src/utils/xrMiscMath/matrix.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ _matrix<T>& _matrix<T>::invert(const _matrix<T>& a) // important: this is 4x3
a._12 * (a._21 * a._33 - a._23 * a._31) +
a._13 * (a._21 * a._32 - a._22 * a._31));

VERIFY(_abs(fDetInv) > flt_zero);
VERIFY(_abs(fDetInv) > flt_min);
fDetInv = 1.0f / fDetInv;

_11 = fDetInv * (a._22 * a._33 - a._23 * a._32);
Expand Down Expand Up @@ -188,7 +188,7 @@ bool _matrix<T>::invert_b(const _matrix<T>& a) // important: this is 4x3 inver
a._12 * (a._21 * a._33 - a._23 * a._31) +
a._13 * (a._21 * a._32 - a._22 * a._31));

if (_abs(fDetInv) <= flt_zero) return false;
if (_abs(fDetInv) <= flt_min) return false;
fDetInv = 1.0f / fDetInv;

_11 = fDetInv * (a._22 * a._33 - a._23 * a._32);
Expand Down Expand Up @@ -234,7 +234,7 @@ _matrix<T>& _matrix<T>::invert_44(const _matrix<T>& a)
T A14 = -(a21 * mn3 - a22 * mn5 + a23 * mn6);

T detInv = a11 * A11 + a12 * A12 + a13 * A13 + a14 * A14;
VERIFY(_abs(detInv) > flt_zero);
VERIFY(_abs(detInv) > flt_min);

detInv = 1.f / detInv;

Expand Down
2 changes: 1 addition & 1 deletion src/utils/xrMiscMath/vector.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -315,7 +315,7 @@ _vector3<T>& _vector3<T>::normalize_safe()
template <typename T>
_vector3<T>& _vector3<T>::normalize(const _vector3<T>& v)
{
VERIFY((v.x*v.x + v.y*v.y + v.z*v.z) > flt_zero);
VERIFY((v.x*v.x + v.y*v.y + v.z*v.z) > flt_min);
T mag = _sqrt(1 / (v.x*v.x + v.y*v.y + v.z*v.z));
x = v.x*mag;
y = v.y*mag;
Expand Down
2 changes: 1 addition & 1 deletion src/xrCDB/Frustum.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -307,7 +307,7 @@ void CFrustum::SimplifyPoly_AABB(sPoly* poly, Fplane& plane)
// Project and find extents
Fvector2 min, max;
min.set(flt_max, flt_max);
max.set(flt_min, flt_min);
max.set(flt_lowest, flt_lowest);
for (auto& v : *poly)
{
Fvector2 tmp;
Expand Down
2 changes: 1 addition & 1 deletion src/xrCore/_fbox.h
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ struct Fbox3
auto& invalidate()
{
vMin.set(type_max<float>, type_max<float>, type_max<float>);
vMax.set(type_min<float>, type_min<float>, type_min<float>);
vMax.set(type_lowest<float>, type_lowest<float>, type_lowest<float>);
return *this;
}

Expand Down
2 changes: 1 addition & 1 deletion src/xrCore/_fbox2.h
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ struct Fbox2
auto& invalidate()
{
min.set(type_max<float>, type_max<float>);
max.set(type_min<float>, type_min<float>);
max.set(type_lowest<float>, type_lowest<float>);
return *this;
}

Expand Down
4 changes: 2 additions & 2 deletions src/xrCore/_rect.h
Original file line number Diff line number Diff line change
Expand Up @@ -70,8 +70,8 @@ struct _rect
{
lt.x = type_max<T>;
lt.y = type_max<T>;
rb.x = type_min<T>;
rb.y = type_min<T>;
rb.x = type_lowest<T>;
rb.y = type_lowest<T>;
return *this;
};
IC bool valide() { return lt.x1 < rb.x && lt.y < rb.y; }
Expand Down
2 changes: 1 addition & 1 deletion src/xrEngine/FDemoPlay.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ void CDemoPlay::stat_Stop()

// min/max/average
rfps_min = flt_max;
rfps_max = flt_min;
rfps_max = flt_lowest;
rfps_middlepoint = 0;

// Filtered FPS
Expand Down
2 changes: 1 addition & 1 deletion src/xrEngine/xrSASH.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ void xrSASH::ReportNative(pcstr pszTestName)

// min/max/average
float fMinFps = flt_max;
float fMaxFps = flt_min;
float fMaxFps = flt_lowest;

const u32 iWindowSize = 15;

Expand Down
2 changes: 1 addition & 1 deletion src/xrGame/DynamicHeightMap.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,7 @@ float CHM_Static::Query(float x, float z)

//
void CHM_Dynamic::Update() {}
float CHM_Dynamic::Query(float x, float z) { return flt_min; }
float CHM_Dynamic::Query(float x, float z) { return flt_lowest; }
//
float CHeightMap::Query(float x, float z)
{
Expand Down
2 changes: 1 addition & 1 deletion src/xrGame/DynamicHeightMap.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ class CHM_Static
{
for (u32 i = 0; i < dhm_precision; ++i)
for (u32 j = 0; j < dhm_precision; ++j)
data[i][j] = flt_min;
data[i][j] = flt_lowest;
}
Slot()
{
Expand Down
2 changes: 1 addition & 1 deletion src/xrGame/Level_bullet_manager_firetrace.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -237,7 +237,7 @@ void CBulletManager::FireShotmark(SBullet* bullet, const Fvector& vDir, const Fv
if ((ps_name && ShowMark) || (bullet->flags.explosive && bStatic))
{
VERIFY2((particle_dir.x * particle_dir.x + particle_dir.y * particle_dir.y + particle_dir.z * particle_dir.z) >
flt_zero,
flt_min,
make_string("[%f][%f][%f]", VPUSH(particle_dir)));
Fmatrix pos;
pos.k.normalize(particle_dir);
Expand Down
2 changes: 1 addition & 1 deletion src/xrGame/WeaponBinocularsVision.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ void SBinocVisibleObj::Update()

Fmatrix xform;
xform.mul(Device.mFullTransform, m_object->XFORM());
Fvector2 mn = {flt_max, flt_max}, mx = {flt_min, flt_min};
Fvector2 mn = {flt_max, flt_max}, mx = {flt_lowest, flt_lowest};

for (u32 k = 0; k < 8; ++k)
{
Expand Down
2 changes: 1 addition & 1 deletion src/xrGame/ai/monsters/basemonster/base_monster.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1037,7 +1037,7 @@ float CBaseMonster::get_screen_space_coverage_diagonal()

Fmatrix xform;
xform.mul(Device.mFullTransform, XFORM());
Fvector2 mn = {flt_max, flt_max}, mx = {flt_min, flt_min};
Fvector2 mn = {flt_max, flt_max}, mx = {flt_lowest, flt_lowest};

for (u32 k = 0; k < 8; ++k)
{
Expand Down
2 changes: 1 addition & 1 deletion src/xrGame/ai_obstacle.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ void ai_obstacle::compute_matrix(Fmatrix& result, const Fvector& additional)
void ai_obstacle::prepare_inside(Fvector& min, Fvector& max)
{
min = Fvector().set(flt_max, flt_max, flt_max);
max = Fvector().set(flt_min, flt_min, flt_min);
max = Fvector().set(flt_lowest, flt_lowest, flt_lowest);

Fmatrix matrix;
float half_cell_size = (use_additional_radius ? 1.f : 0.f) * ai().level_graph().header().cell_size() * .5f;
Expand Down
4 changes: 2 additions & 2 deletions src/xrGame/inventory_upgrade_manager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -493,7 +493,7 @@ LPCSTR Manager::get_upgrade_by_index(CInventoryItem& item, Ivector2 const& index
bool Manager::compute_range(LPCSTR parameter, float& low, float& high)
{
low = flt_max;
high = flt_min;
high = flt_lowest;

Roots_type::iterator ib = m_roots.begin();
Roots_type::iterator ie = m_roots.end();
Expand All @@ -509,7 +509,7 @@ bool Manager::compute_range(LPCSTR parameter, float& low, float& high)
compute_range_section(((*uib).second)->section(), parameter, low, high);
}

return (low != flt_max) && (high != flt_min);
return (low != flt_max) && (high != flt_lowest);
}

void Manager::compute_range_section(LPCSTR section, LPCSTR parameter, float& low, float& high)
Expand Down
4 changes: 2 additions & 2 deletions src/xrGame/smart_cover_detail.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,10 @@ namespace detail
{
typedef RestrictionSpace::CTimeIntrusiveBase intrusive_base_time;

float parse_float(luabind::adl::object const& table, LPCSTR identifier, float const& min_threshold = flt_min,
float parse_float(luabind::adl::object const& table, LPCSTR identifier, float const& min_threshold = flt_lowest,
float const& max_threshold = flt_max);
bool parse_float(float& output, luabind::adl::object const& table, LPCSTR identifier,
float const& min_threshold = flt_min, float const& max_threshold = flt_max);
float const& min_threshold = flt_lowest, float const& max_threshold = flt_max);
LPCSTR parse_string(luabind::adl::object const& table, LPCSTR identifier);
void parse_table(luabind::adl::object const& table, LPCSTR identifier, luabind::adl::object& result);
bool parse_bool(luabind::adl::object const& table, LPCSTR identifier);
Expand Down
2 changes: 1 addition & 1 deletion src/xrGame/space_restriction_shape.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ void CSpaceRestrictionShape::fill_shape(const CCF_Shape::shape_def& shape)
Fvector().set(-.5f, +.5f, -.5f), Fvector().set(-.5f, +.5f, +.5f), Fvector().set(+.5f, -.5f, -.5f),
Fvector().set(+.5f, -.5f, +.5f), Fvector().set(+.5f, +.5f, -.5f), Fvector().set(+.5f, +.5f, +.5f)};
start = Fvector().set(flt_max, flt_max, flt_max);
dest = Fvector().set(flt_min, flt_min, flt_min);
dest = Fvector().set(flt_lowest, flt_lowest, flt_lowest);
Fmatrix Q;
Q.mul_43(m_restrictor->XFORM(), shape.data.box);
Fvector temp;
Expand Down
4 changes: 2 additions & 2 deletions src/xrServerEntities/PropertiesListHelper.h
Original file line number Diff line number Diff line change
Expand Up @@ -84,9 +84,9 @@ class CPropHelper : public IPropHelper
PropItemVec& items, shared_str key, float* val, float mn = 0.f, float mx = 86400.f);
virtual ShortcutValue* CreateShortcut(PropItemVec& items, shared_str key, xr_shortcut* val);

virtual FloatValue* CreateAngle(PropItemVec& items, shared_str key, float* val, float mn = flt_min,
virtual FloatValue* CreateAngle(PropItemVec& items, shared_str key, float* val, float mn = flt_lowest,
float mx = flt_max, float inc = 0.01f, int decim = 2);
virtual VectorValue* CreateAngle3(PropItemVec& items, shared_str key, Fvector* val, float mn = flt_min,
virtual VectorValue* CreateAngle3(PropItemVec& items, shared_str key, Fvector* val, float mn = flt_lowest,
float mx = flt_max, float inc = 0.01f, int decim = 2);
virtual RTextValue* CreateName(PropItemVec& items, shared_str key, shared_str* val, ListItem* owner);
virtual RTextValue* CreateNameCB(PropItemVec& items, shared_str key, shared_str* val,
Expand Down
2 changes: 1 addition & 1 deletion src/xrServerEntities/alife_monster_brain.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ void CALifeMonsterBrain::select_task(const bool forced)

m_last_search_time = current_time;

float best_value = flt_min;
float best_value = flt_lowest;
CALifeSmartTerrainRegistry::OBJECTS::const_iterator I = ai().alife().smart_terrains().objects().begin();
CALifeSmartTerrainRegistry::OBJECTS::const_iterator E = ai().alife().smart_terrains().objects().end();
for (; I != E; ++I)
Expand Down
4 changes: 2 additions & 2 deletions src/xrServerEntities/xrEProps.h
Original file line number Diff line number Diff line change
Expand Up @@ -138,9 +138,9 @@ class XR_EPROPS_API IPropHelper
PropItemVec& items, shared_str key, float* val, float mn = 0.f, float mx = 86400.f) = 0;
virtual ShortcutValue* CreateShortcut(PropItemVec& items, shared_str key, xr_shortcut* val) = 0;

virtual FloatValue* CreateAngle(PropItemVec& items, shared_str key, float* val, float mn = flt_min,
virtual FloatValue* CreateAngle(PropItemVec& items, shared_str key, float* val, float mn = flt_lowest,
float mx = flt_max, float inc = 0.01f, int decim = 2) = 0;
virtual VectorValue* CreateAngle3(PropItemVec& items, shared_str key, Fvector* val, float mn = flt_min,
virtual VectorValue* CreateAngle3(PropItemVec& items, shared_str key, Fvector* val, float mn = flt_lowest,
float mx = flt_max, float inc = 0.01f, int decim = 2) = 0;
virtual RTextValue* CreateName(PropItemVec& items, shared_str key, shared_str* val, ListItem* owner) = 0;
virtual RTextValue* CreateNameCB(PropItemVec& items, shared_str key, shared_str* val,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,7 @@ Fvector parse_fvector(luabind::object const& table, LPCSTR identifier)
return (luabind::object_cast<Fvector>(result));
}

float parse_float(luabind::object const& table, LPCSTR identifier, float const& min_threshold = flt_min,
float parse_float(luabind::object const& table, LPCSTR identifier, float const& min_threshold = flt_lowest,
float const& max_threshold = flt_max)
{
VERIFY2(luabind::type(table) == LUA_TTABLE, "invalid loophole description passed");
Expand Down

0 comments on commit fda0f0a

Please sign in to comment.