mirror of
https://github.com/s1lentq/ReGameDLL_CS.git
synced 2025-02-06 02:30:42 +03:00
parent
f53452fee0
commit
5afb52ffce
@ -507,12 +507,20 @@ void CFuncRotating::RampPitchVol(BOOL fUp)
|
|||||||
int pitch;
|
int pitch;
|
||||||
|
|
||||||
// get current angular velocity
|
// get current angular velocity
|
||||||
|
#ifdef REGAMEDLL_FIXES
|
||||||
|
vecCur = Q_abs(vecAVel.x != 0 ? vecAVel.x : (vecAVel.y != 0 ? vecAVel.y : vecAVel.z));
|
||||||
|
#else
|
||||||
vecCur = Q_abs(int(vecAVel.x != 0 ? vecAVel.x : (vecAVel.y != 0 ? vecAVel.y : vecAVel.z)));
|
vecCur = Q_abs(int(vecAVel.x != 0 ? vecAVel.x : (vecAVel.y != 0 ? vecAVel.y : vecAVel.z)));
|
||||||
|
#endif
|
||||||
|
|
||||||
// get target angular velocity
|
// get target angular velocity
|
||||||
vecFinal = (pev->movedir.x != 0 ? pev->movedir.x : (pev->movedir.y != 0 ? pev->movedir.y : pev->movedir.z));
|
vecFinal = (pev->movedir.x != 0 ? pev->movedir.x : (pev->movedir.y != 0 ? pev->movedir.y : pev->movedir.z));
|
||||||
vecFinal *= pev->speed;
|
vecFinal *= pev->speed;
|
||||||
|
#ifdef REGAMEDLL_FIXES
|
||||||
|
vecFinal = Q_abs(vecFinal);
|
||||||
|
#else
|
||||||
vecFinal = Q_abs(int(vecFinal));
|
vecFinal = Q_abs(int(vecFinal));
|
||||||
|
#endif
|
||||||
|
|
||||||
// calc volume and pitch as % of final vol and pitch
|
// calc volume and pitch as % of final vol and pitch
|
||||||
fpct = vecCur / vecFinal;
|
fpct = vecCur / vecFinal;
|
||||||
@ -543,19 +551,22 @@ void CFuncRotating::RampPitchVol(BOOL fUp)
|
|||||||
// Accelerates a non-moving func_rotating up to it's speed
|
// Accelerates a non-moving func_rotating up to it's speed
|
||||||
void CFuncRotating::SpinUp()
|
void CFuncRotating::SpinUp()
|
||||||
{
|
{
|
||||||
// rotational velocity
|
|
||||||
Vector vecAVel;
|
|
||||||
|
|
||||||
pev->nextthink = pev->ltime + 0.1;
|
pev->nextthink = pev->ltime + 0.1;
|
||||||
pev->avelocity = pev->avelocity + (pev->movedir * (pev->speed * m_flFanFriction));
|
pev->avelocity = pev->avelocity + (pev->movedir * (pev->speed * m_flFanFriction));
|
||||||
|
|
||||||
// cache entity's rotational velocity
|
// cache entity's rotational velocity
|
||||||
vecAVel = pev->avelocity;
|
Vector vecAVel = pev->avelocity;
|
||||||
|
|
||||||
// if we've met or exceeded target speed, set target speed and stop thinking
|
// if we've met or exceeded target speed, set target speed and stop thinking
|
||||||
|
#ifdef REGAMEDLL_FIXES
|
||||||
|
if (Q_abs(vecAVel.x) >= Q_abs(pev->movedir.x * pev->speed)
|
||||||
|
&& Q_abs(vecAVel.y) >= Q_abs(pev->movedir.y * pev->speed)
|
||||||
|
&& Q_abs(vecAVel.z) >= Q_abs(pev->movedir.z * pev->speed))
|
||||||
|
#else
|
||||||
if (Q_abs(int(vecAVel.x)) >= Q_abs(int(pev->movedir.x * pev->speed))
|
if (Q_abs(int(vecAVel.x)) >= Q_abs(int(pev->movedir.x * pev->speed))
|
||||||
&& Q_abs(int(vecAVel.y)) >= Q_abs(int(pev->movedir.y * pev->speed))
|
&& Q_abs(int(vecAVel.y)) >= Q_abs(int(pev->movedir.y * pev->speed))
|
||||||
&& Q_abs(int(vecAVel.z)) >= Q_abs(int(pev->movedir.z * pev->speed)))
|
&& Q_abs(int(vecAVel.z)) >= Q_abs(int(pev->movedir.z * pev->speed)))
|
||||||
|
#endif
|
||||||
{
|
{
|
||||||
// set speed in case we overshot
|
// set speed in case we overshot
|
||||||
pev->avelocity = pev->movedir * pev->speed;
|
pev->avelocity = pev->movedir * pev->speed;
|
||||||
|
@ -51,7 +51,11 @@ bool CCSBot::ShouldInvestigateNoise(float *retNoiseDist)
|
|||||||
float noiseDist = toNoise.Length();
|
float noiseDist = toNoise.Length();
|
||||||
|
|
||||||
float const oneStoreyHeight = 120.0f;
|
float const oneStoreyHeight = 120.0f;
|
||||||
|
#ifdef REGAMEDLL_FIXES
|
||||||
|
if (Q_abs(toNoise.z) > oneStoreyHeight)
|
||||||
|
#else
|
||||||
if (Q_abs(int64(toNoise.z)) > oneStoreyHeight)
|
if (Q_abs(int64(toNoise.z)) > oneStoreyHeight)
|
||||||
|
#endif
|
||||||
{
|
{
|
||||||
PathCost pc(this);
|
PathCost pc(this);
|
||||||
float travelDistToNoise = NavAreaTravelDistance(m_lastKnownArea, m_noiseArea, pc);
|
float travelDistToNoise = NavAreaTravelDistance(m_lastKnownArea, m_noiseArea, pc);
|
||||||
|
@ -323,7 +323,11 @@ bool CCSBot::UpdateLadderMovement()
|
|||||||
{
|
{
|
||||||
Vector2D perp(-m_pathLadder->m_dirVector.y, m_pathLadder->m_dirVector.x);
|
Vector2D perp(-m_pathLadder->m_dirVector.y, m_pathLadder->m_dirVector.x);
|
||||||
|
|
||||||
|
#ifdef REGAMEDLL_FIXES
|
||||||
|
if (Q_abs(d.x * perp.x + d.y * perp.y) < tolerance && d.Length() < closeToGoal)
|
||||||
|
#else
|
||||||
if (Q_abs(int64(d.x * perp.x + d.y * perp.y)) < tolerance && d.Length() < closeToGoal)
|
if (Q_abs(int64(d.x * perp.x + d.y * perp.y)) < tolerance && d.Length() < closeToGoal)
|
||||||
|
#endif
|
||||||
approached = true;
|
approached = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -321,7 +321,11 @@ void CCSBot::Attack(CBasePlayer *victim)
|
|||||||
Vector toEnemy = victim->pev->origin - pev->origin;
|
Vector toEnemy = victim->pev->origin - pev->origin;
|
||||||
Vector idealAngle = UTIL_VecToAngles(toEnemy);
|
Vector idealAngle = UTIL_VecToAngles(toEnemy);
|
||||||
|
|
||||||
|
#ifdef REGAMEDLL_FIXES
|
||||||
|
float_precision deltaYaw = float_precision(Q_abs(m_lookYaw - idealAngle.y));
|
||||||
|
#else
|
||||||
float_precision deltaYaw = float_precision(Q_abs(int64(m_lookYaw - idealAngle.y)));
|
float_precision deltaYaw = float_precision(Q_abs(int64(m_lookYaw - idealAngle.y)));
|
||||||
|
#endif
|
||||||
|
|
||||||
while (deltaYaw > 180.0f)
|
while (deltaYaw > 180.0f)
|
||||||
deltaYaw -= 360.0f;
|
deltaYaw -= 360.0f;
|
||||||
|
@ -506,8 +506,13 @@ void CCSBot::UpdateLookAround(bool updateNow)
|
|||||||
// figure out how far along the path segment we are
|
// figure out how far along the path segment we are
|
||||||
Vector delta = m_spotEncounter->path.to - m_spotEncounter->path.from;
|
Vector delta = m_spotEncounter->path.to - m_spotEncounter->path.from;
|
||||||
float_precision length = delta.Length();
|
float_precision length = delta.Length();
|
||||||
|
#ifdef REGAMEDLL_FIXES
|
||||||
|
float adx = Q_abs(delta.x);
|
||||||
|
float ady = Q_abs(delta.y);
|
||||||
|
#else
|
||||||
float adx = float(Q_abs(int64(delta.x)));
|
float adx = float(Q_abs(int64(delta.x)));
|
||||||
float ady = float(Q_abs(int64(delta.y)));
|
float ady = float(Q_abs(int64(delta.y)));
|
||||||
|
#endif
|
||||||
float_precision t;
|
float_precision t;
|
||||||
|
|
||||||
if (adx > ady)
|
if (adx > ady)
|
||||||
|
@ -546,14 +546,22 @@ void CBaseDoor::DoorGoUp()
|
|||||||
{
|
{
|
||||||
if (toActivator.y < loY)
|
if (toActivator.y < loY)
|
||||||
{
|
{
|
||||||
|
#ifdef REGAMEDLL_FIXES
|
||||||
|
if (Q_abs(momentArmY) > Q_abs(momentArmX))
|
||||||
|
#else
|
||||||
if (Q_abs(int(momentArmY)) > Q_abs(int(momentArmX)))
|
if (Q_abs(int(momentArmY)) > Q_abs(int(momentArmX)))
|
||||||
|
#endif
|
||||||
sign = (momentArmY < 0) ? 1 : -1;
|
sign = (momentArmY < 0) ? 1 : -1;
|
||||||
else
|
else
|
||||||
sign = (momentArmX > 0) ? 1 : -1;
|
sign = (momentArmX > 0) ? 1 : -1;
|
||||||
}
|
}
|
||||||
else if (toActivator.y > hiY)
|
else if (toActivator.y > hiY)
|
||||||
{
|
{
|
||||||
|
#ifdef REGAMEDLL_FIXES
|
||||||
|
if (Q_abs(momentArmY) > Q_abs(momentArmX))
|
||||||
|
#else
|
||||||
if (Q_abs(int(momentArmY)) > Q_abs(int(momentArmX)))
|
if (Q_abs(int(momentArmY)) > Q_abs(int(momentArmX)))
|
||||||
|
#endif
|
||||||
sign = (momentArmY < 0) ? 1 : -1;
|
sign = (momentArmY < 0) ? 1 : -1;
|
||||||
else
|
else
|
||||||
sign = (momentArmX < 0) ? 1 : -1;
|
sign = (momentArmX < 0) ? 1 : -1;
|
||||||
@ -572,14 +580,22 @@ void CBaseDoor::DoorGoUp()
|
|||||||
}
|
}
|
||||||
else if (toActivator.y < loY)
|
else if (toActivator.y < loY)
|
||||||
{
|
{
|
||||||
|
#ifdef REGAMEDLL_FIXES
|
||||||
|
if (Q_abs(momentArmY) > Q_abs(momentArmX))
|
||||||
|
#else
|
||||||
if (Q_abs(int(momentArmY)) > Q_abs(int(momentArmX)))
|
if (Q_abs(int(momentArmY)) > Q_abs(int(momentArmX)))
|
||||||
|
#endif
|
||||||
sign = (momentArmY > 0) ? 1 : -1;
|
sign = (momentArmY > 0) ? 1 : -1;
|
||||||
else
|
else
|
||||||
sign = (momentArmX > 0) ? 1 : -1;
|
sign = (momentArmX > 0) ? 1 : -1;
|
||||||
}
|
}
|
||||||
else if (toActivator.y > hiY)
|
else if (toActivator.y > hiY)
|
||||||
{
|
{
|
||||||
|
#ifdef REGAMEDLL_FIXES
|
||||||
|
if (Q_abs(momentArmY) > Q_abs(momentArmX))
|
||||||
|
#else
|
||||||
if (Q_abs(int(momentArmY)) > Q_abs(int(momentArmX)))
|
if (Q_abs(int(momentArmY)) > Q_abs(int(momentArmX)))
|
||||||
|
#endif
|
||||||
sign = (momentArmY > 0) ? 1 : -1;
|
sign = (momentArmY > 0) ? 1 : -1;
|
||||||
else
|
else
|
||||||
sign = (momentArmX < 0) ? 1 : -1;
|
sign = (momentArmX < 0) ? 1 : -1;
|
||||||
|
@ -188,7 +188,11 @@ void HostageFollowState::OnUpdate(CHostageImprov *improv)
|
|||||||
|
|
||||||
if (GetGroundHeight(&sideStepPos, &ground))
|
if (GetGroundHeight(&sideStepPos, &ground))
|
||||||
{
|
{
|
||||||
|
#ifdef REGAMEDLL_FIXES
|
||||||
|
if (Q_abs(ground - improv->GetFeet().z) < 18.0f)
|
||||||
|
#else
|
||||||
if (Q_abs(int(ground - improv->GetFeet().z)) < 18.0f)
|
if (Q_abs(int(ground - improv->GetFeet().z)) < 18.0f)
|
||||||
|
#endif
|
||||||
{
|
{
|
||||||
const float push = 20.0f;
|
const float push = 20.0f;
|
||||||
Vector lat = cross * push;
|
Vector lat = cross * push;
|
||||||
|
@ -1048,12 +1048,14 @@ void CFuncTrackTrain::StopSound()
|
|||||||
|
|
||||||
void CFuncTrackTrain::UpdateSound()
|
void CFuncTrackTrain::UpdateSound()
|
||||||
{
|
{
|
||||||
float flpitch;
|
|
||||||
|
|
||||||
if (!pev->noise)
|
if (!pev->noise)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
flpitch = TRAIN_STARTPITCH + (Q_abs(int(pev->speed)) * (TRAIN_MAXPITCH - TRAIN_STARTPITCH) / TRAIN_MAXSPEED);
|
#ifdef REGAMEDLL_FIXES
|
||||||
|
float flpitch = TRAIN_STARTPITCH + (Q_abs(pev->speed) * (TRAIN_MAXPITCH - TRAIN_STARTPITCH) / TRAIN_MAXSPEED);
|
||||||
|
#else
|
||||||
|
float flpitch = TRAIN_STARTPITCH + (Q_abs(int(pev->speed)) * (TRAIN_MAXPITCH - TRAIN_STARTPITCH) / TRAIN_MAXSPEED);
|
||||||
|
#endif
|
||||||
|
|
||||||
if (!m_soundPlaying)
|
if (!m_soundPlaying)
|
||||||
{
|
{
|
||||||
|
@ -4396,7 +4396,11 @@ void CBasePlayer::CheckTimeBasedDamage()
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
// only check for time based damage approx. every 2 seconds
|
// only check for time based damage approx. every 2 seconds
|
||||||
|
#ifdef REGAMEDLL_FIXES
|
||||||
|
if (Q_abs(gpGlobals->time - m_tbdPrev) < 2.0f)
|
||||||
|
#else
|
||||||
if (Q_abs(int64(gpGlobals->time - m_tbdPrev)) < 2.0f)
|
if (Q_abs(int64(gpGlobals->time - m_tbdPrev)) < 2.0f)
|
||||||
|
#endif
|
||||||
return;
|
return;
|
||||||
|
|
||||||
m_tbdPrev = gpGlobals->time;
|
m_tbdPrev = gpGlobals->time;
|
||||||
@ -7817,7 +7821,11 @@ void CBasePlayer::StudioEstimateGait()
|
|||||||
else
|
else
|
||||||
flYawDiff *= dt;
|
flYawDiff *= dt;
|
||||||
|
|
||||||
|
#ifdef REGAMEDLL_FIXES
|
||||||
|
if (float_precision(Q_abs(flYawDiff)) < 0.1f)
|
||||||
|
#else
|
||||||
if (float_precision(Q_abs(int64(flYawDiff))) < 0.1f)
|
if (float_precision(Q_abs(int64(flYawDiff))) < 0.1f)
|
||||||
|
#endif
|
||||||
flYawDiff = 0;
|
flYawDiff = 0;
|
||||||
|
|
||||||
m_flGaityaw += flYawDiff;
|
m_flGaityaw += flYawDiff;
|
||||||
|
@ -117,7 +117,11 @@ void CFuncVehicle::Blocked(CBaseEntity *pOther)
|
|||||||
float maxy = Q_max(vBackLeft.y, vBackRight.y);
|
float maxy = Q_max(vBackLeft.y, vBackRight.y);
|
||||||
|
|
||||||
float minz = pev->origin.z;
|
float minz = pev->origin.z;
|
||||||
|
#ifdef REGAMEDLL_FIXES
|
||||||
|
float maxz = pev->origin.z + (2 * Q_abs(pev->mins.z - pev->maxs.z));
|
||||||
|
#else
|
||||||
float maxz = pev->origin.z + (2 * Q_abs(int(pev->mins.z - pev->maxs.z)));
|
float maxz = pev->origin.z + (2 * Q_abs(int(pev->mins.z - pev->maxs.z)));
|
||||||
|
#endif
|
||||||
|
|
||||||
if (pOther->pev->origin.x < minx
|
if (pOther->pev->origin.x < minx
|
||||||
|| pOther->pev->origin.x > maxx
|
|| pOther->pev->origin.x > maxx
|
||||||
@ -261,7 +265,11 @@ void CFuncVehicle::UpdateSound()
|
|||||||
if (!pev->noise)
|
if (!pev->noise)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
#ifdef REGAMEDLL_FIXES
|
||||||
|
float flpitch = VEHICLE_STARTPITCH + (Q_abs(pev->speed) * (VEHICLE_MAXPITCH - VEHICLE_STARTPITCH) / VEHICLE_MAXSPEED);
|
||||||
|
#else
|
||||||
float flpitch = VEHICLE_STARTPITCH + (Q_abs(int(pev->speed)) * (VEHICLE_MAXPITCH - VEHICLE_STARTPITCH) / VEHICLE_MAXSPEED);
|
float flpitch = VEHICLE_STARTPITCH + (Q_abs(int(pev->speed)) * (VEHICLE_MAXPITCH - VEHICLE_STARTPITCH) / VEHICLE_MAXSPEED);
|
||||||
|
#endif
|
||||||
|
|
||||||
if (flpitch > 200)
|
if (flpitch > 200)
|
||||||
flpitch = 200;
|
flpitch = 200;
|
||||||
|
@ -351,7 +351,11 @@ inline float AngleDifference(float a, float b)
|
|||||||
|
|
||||||
inline bool AnglesAreEqual(float a, float b, float tolerance = 5.0f)
|
inline bool AnglesAreEqual(float a, float b, float tolerance = 5.0f)
|
||||||
{
|
{
|
||||||
|
#ifdef REGAMEDLL_FIXES
|
||||||
|
if (Q_abs(AngleDifference(a, b)) < tolerance)
|
||||||
|
#else
|
||||||
if (Q_abs(int64(AngleDifference(a, b))) < tolerance)
|
if (Q_abs(int64(AngleDifference(a, b))) < tolerance)
|
||||||
|
#endif
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user