Mini-refactoring.

Added at weaponInfo name for weapon_shield
This commit is contained in:
s1lentq 2016-05-11 20:06:43 +06:00
parent 13e12cc0ae
commit 0d209c1cd4
13 changed files with 23 additions and 28 deletions

View File

@ -1524,12 +1524,12 @@ inline float CCSBot::GetFeetZ() const
{ {
if (IsCrouching()) if (IsCrouching())
{ {
const Vector crouch = Vector(0, 0, -StepHeight); const Vector crouch(0, 0, -StepHeight);
return (pev->origin + crouch).z; return (pev->origin + crouch).z;
} }
else else
{ {
const Vector stand = Vector(0, 0, -HalfHumanHeight); const Vector stand(0, 0, -HalfHumanHeight);
return (pev->origin + stand).z; return (pev->origin + stand).z;
} }
} }

View File

@ -409,7 +409,7 @@ NOXREF bool CCSBot::FindApproachPointNearestPath(Vector *pos)
if (m_approachPointCount == 0) if (m_approachPointCount == 0)
return false; return false;
Vector target = Vector(0, 0, 0), close; Vector target(0, 0, 0), close;
float targetRangeSq = 0.0f; float targetRangeSq = 0.0f;
bool found = false; bool found = false;

View File

@ -633,7 +633,7 @@ int CCSBot::FindOurPositionOnPath(Vector *close, bool local) const
return -1; return -1;
Vector along, toFeet; Vector along, toFeet;
Vector feet = Vector(pev->origin.x, pev->origin.y, GetFeetZ()); Vector feet(pev->origin.x, pev->origin.y, GetFeetZ());
Vector eyes = feet + Vector(0, 0, HalfHumanHeight); // in case we're crouching Vector eyes = feet + Vector(0, 0, HalfHumanHeight); // in case we're crouching
Vector pos; Vector pos;
const Vector *from, *to; const Vector *from, *to;
@ -857,7 +857,7 @@ int CCSBot::FindPathPoint(float aheadRange, Vector *point, int *prevIndex)
Vector initDir = m_path[ startIndex ].pos - m_path[ startIndex - 1 ].pos; Vector initDir = m_path[ startIndex ].pos - m_path[ startIndex - 1 ].pos;
initDir.NormalizeInPlace(); initDir.NormalizeInPlace();
Vector feet = Vector(pev->origin.x, pev->origin.y, GetFeetZ()); Vector feet(pev->origin.x, pev->origin.y, GetFeetZ());
Vector eyes = feet + Vector(0, 0, HalfHumanHeight); Vector eyes = feet + Vector(0, 0, HalfHumanHeight);
float rangeSoFar = 0; float rangeSoFar = 0;
@ -1172,7 +1172,7 @@ void CCSBot::FeelerReflexAdjustment(Vector *goalPosition)
// correct the sideways vector // correct the sideways vector
lat = CrossProduct(dir, normal); lat = CrossProduct(dir, normal);
Vector feet = Vector(pev->origin.x, pev->origin.y, GetFeetZ()); Vector feet(pev->origin.x, pev->origin.y, GetFeetZ());
feet.z += feelerHeight; feet.z += feelerHeight;
Vector from = feet + feelerOffset * lat; Vector from = feet + feelerOffset * lat;

View File

@ -3645,8 +3645,8 @@ void ClientPrecache()
PRECACHE_MODEL("models/w_shield.mdl"); PRECACHE_MODEL("models/w_shield.mdl");
Vector temp = g_vecZero; Vector temp = g_vecZero;
Vector vMin = Vector(-38, -24, -41); Vector vMin(-38, -24, -41);
Vector vMax = Vector(38, 24, 41); Vector vMax(38, 24, 41);
for (i = 0; i < numPlayerModels; ++i) for (i = 0; i < numPlayerModels; ++i)
ENGINE_FORCE_UNMODIFIED(force_model_specifybounds, (float *)&vMin, (float *)&vMax, sPlayerModelFiles[i]); ENGINE_FORCE_UNMODIFIED(force_model_specifybounds, (float *)&vMin, (float *)&vMax, sPlayerModelFiles[i]);

View File

@ -15,15 +15,13 @@ void CGib::LimitVelocity()
NOXREF void CGib::SpawnStickyGibs(entvars_t *pevVictim, Vector vecOrigin, int cGibs) NOXREF void CGib::SpawnStickyGibs(entvars_t *pevVictim, Vector vecOrigin, int cGibs)
{ {
int i;
if (g_Language == LANGUAGE_GERMAN) if (g_Language == LANGUAGE_GERMAN)
{ {
// no sticky gibs in germany right now! // no sticky gibs in germany right now!
return; return;
} }
for (i = 0; i < cGibs; ++i) for (int i = 0; i < cGibs; ++i)
{ {
CGib *pGib = GetClassPtr<CCSGib>((CGib *)NULL); CGib *pGib = GetClassPtr<CCSGib>((CGib *)NULL);
@ -67,7 +65,7 @@ NOXREF void CGib::SpawnStickyGibs(entvars_t *pevVictim, Vector vecOrigin, int cG
pGib->pev->movetype = MOVETYPE_TOSS; pGib->pev->movetype = MOVETYPE_TOSS;
pGib->pev->solid = SOLID_BBOX; pGib->pev->solid = SOLID_BBOX;
UTIL_SetSize(pGib->pev, Vector (0, 0,0), Vector (0, 0, 0)); UTIL_SetSize(pGib->pev, Vector(0, 0,0), Vector(0, 0, 0));
pGib->SetTouch(&CGib::StickyGibTouch); pGib->SetTouch(&CGib::StickyGibTouch);
pGib->SetThink(NULL); pGib->SetThink(NULL);
} }
@ -734,9 +732,6 @@ int CBaseMonster::__MAKE_VHOOK(TakeHealth)(float flHealth, int bitsDamageType)
// When a monster is poisoned via an arrow etc it takes all the poison damage at once. // When a monster is poisoned via an arrow etc it takes all the poison damage at once.
int CBaseMonster::__MAKE_VHOOK(TakeDamage)(entvars_t *pevInflictor, entvars_t *pevAttacker, float flDamage, int bitsDamageType) int CBaseMonster::__MAKE_VHOOK(TakeDamage)(entvars_t *pevInflictor, entvars_t *pevAttacker, float flDamage, int bitsDamageType)
{ {
float flTake;
Vector vecDir;
if (pev->takedamage == DAMAGE_NO) if (pev->takedamage == DAMAGE_NO)
return 0; return 0;
@ -752,13 +747,13 @@ int CBaseMonster::__MAKE_VHOOK(TakeDamage)(entvars_t *pevInflictor, entvars_t *p
} }
// LATER: make armor consideration here! // LATER: make armor consideration here!
flTake = flDamage; float flTake = flDamage;
// set damage type sustained // set damage type sustained
m_bitsDamageType |= bitsDamageType; m_bitsDamageType |= bitsDamageType;
// grab the vector of the incoming attack. ( pretend that the inflictor is a little lower than it really is, so the body will tend to fly upward a bit). // grab the vector of the incoming attack. ( pretend that the inflictor is a little lower than it really is, so the body will tend to fly upward a bit).
vecDir = Vector(0, 0, 0); Vector vecDir(0, 0, 0);
if (!FNullEnt(pevInflictor)) if (!FNullEnt(pevInflictor))
{ {
@ -849,7 +844,7 @@ int CBaseMonster::__MAKE_VHOOK(TakeDamage)(entvars_t *pevInflictor, entvars_t *p
int CBaseMonster::DeadTakeDamage(entvars_t *pevInflictor, entvars_t *pevAttacker, float flDamage, int bitsDamageType) int CBaseMonster::DeadTakeDamage(entvars_t *pevInflictor, entvars_t *pevAttacker, float flDamage, int bitsDamageType)
{ {
// grab the vector of the incoming attack. ( pretend that the inflictor is a little lower than it really is, so the body will tend to fly upward a bit). // grab the vector of the incoming attack. ( pretend that the inflictor is a little lower than it really is, so the body will tend to fly upward a bit).
Vector vecDir = Vector(0, 0, 0); Vector vecDir(0, 0, 0);
if (!FNullEnt(pevInflictor)) if (!FNullEnt(pevInflictor))
{ {

View File

@ -715,7 +715,7 @@ void CLightning::RandomArea()
for (int iLoops = 0; iLoops < 10; iLoops++) for (int iLoops = 0; iLoops < 10; iLoops++)
{ {
Vector vecSrc = pev->origin; Vector vecSrc = pev->origin;
Vector vecDir1 = Vector(RANDOM_FLOAT(-1, 1), RANDOM_FLOAT(-1, 1), RANDOM_FLOAT(-1, 1)); Vector vecDir1(RANDOM_FLOAT(-1, 1), RANDOM_FLOAT(-1, 1), RANDOM_FLOAT(-1, 1));
vecDir1 = vecDir1.Normalize(); vecDir1 = vecDir1.Normalize();
TraceResult tr1; TraceResult tr1;
@ -756,7 +756,7 @@ void CLightning::RandomPoint(Vector &vecSrc)
{ {
for (int iLoops = 0; iLoops < 10; iLoops++) for (int iLoops = 0; iLoops < 10; iLoops++)
{ {
Vector vecDir1 = Vector(RANDOM_FLOAT(-1, 1), RANDOM_FLOAT(-1, 1), RANDOM_FLOAT(-1, 1)); Vector vecDir1(RANDOM_FLOAT(-1, 1), RANDOM_FLOAT(-1, 1), RANDOM_FLOAT(-1, 1));
vecDir1 = vecDir1.Normalize(); vecDir1 = vecDir1.Normalize();
TraceResult tr1; TraceResult tr1;

View File

@ -5,7 +5,7 @@
*/ */
#ifndef HOOK_GAMEDLL #ifndef HOOK_GAMEDLL
const Vector g_vecZero = Vector(0, 0, 0); const Vector g_vecZero(0, 0, 0);
NOXREF u_long g_ulFrameCount = 0; NOXREF u_long g_ulFrameCount = 0;
#endif #endif

View File

@ -1082,7 +1082,7 @@ void CHostage::SendHostageEventMsg()
void CHostage::Wiggle() void CHostage::Wiggle()
{ {
TraceResult tr; TraceResult tr;
Vector vec = Vector(0, 0, 0); Vector vec(0, 0, 0);
Vector wiggle_directions[] = Vector wiggle_directions[] =
{ {
Vector(50, 0, 0), Vector(50, 0, 0),

View File

@ -1349,7 +1349,7 @@ void CHostageImprov::__MAKE_VHOOK(OnTouch)(CBaseEntity *other)
{ {
const float lookAheadRange = 30.0f; const float lookAheadRange = 30.0f;
float ground; float ground;
Vector normal = Vector(0, 0, 1); Vector normal(0, 0, 1);
Vector alongFloor; Vector alongFloor;
TraceResult result; TraceResult result;
bool isStep = false; bool isStep = false;
@ -1385,7 +1385,7 @@ void CHostageImprov::__MAKE_VHOOK(OnTouch)(CBaseEntity *other)
if (isStep) if (isStep)
{ {
float stepAheadGround = pos.z; float stepAheadGround = pos.z;
Vector stepAheadNormal = Vector(0, 0, stepAheadGround); Vector stepAheadNormal(0, 0, stepAheadGround);
m_inhibitObstacleAvoidance.Start(0.5); m_inhibitObstacleAvoidance.Start(0.5);

View File

@ -149,7 +149,7 @@ void CBaseMonster::__MAKE_VHOOK(Look)(int iDistance)
CBaseEntity *pSightEnt = NULL; CBaseEntity *pSightEnt = NULL;
CBaseEntity *pList[100]; CBaseEntity *pList[100];
Vector delta = Vector(iDistance, iDistance, iDistance); Vector delta(iDistance, iDistance, iDistance);
// Find only monsters/clients in box, NOT limited to PVS // Find only monsters/clients in box, NOT limited to PVS
int count = UTIL_EntitiesInBox(pList, ARRAYSIZE(pList), pev->origin - delta, pev->origin + delta, (FL_CLIENT | FL_MONSTER)); int count = UTIL_EntitiesInBox(pList, ARRAYSIZE(pList), pev->origin - delta, pev->origin + delta, (FL_CLIENT | FL_MONSTER));

View File

@ -6087,7 +6087,7 @@ void CBasePlayer::CheatImpulseCommands(int iImpulse)
case 204: case 204:
{ {
TraceResult tr; TraceResult tr;
Vector dir = Vector(0, 0, 1); Vector dir(0, 0, 1);
UTIL_BloodDrips(pev->origin, dir, BLOOD_COLOR_RED, 2000); UTIL_BloodDrips(pev->origin, dir, BLOOD_COLOR_RED, 2000);

View File

@ -1938,7 +1938,7 @@ void CSave::BufferData(const char *pdata, int size)
int CRestore::ReadField(void *pBaseData, TYPEDESCRIPTION *pFields, int fieldCount, int startField, int size, char *pName, void *pData) int CRestore::ReadField(void *pBaseData, TYPEDESCRIPTION *pFields, int fieldCount, int startField, int size, char *pName, void *pData)
{ {
float time = 0.0f; float time = 0.0f;
Vector position = Vector(0, 0, 0); Vector position(0, 0, 0);
if (m_pdata) if (m_pdata)
{ {

View File

@ -252,7 +252,7 @@ WeaponInfoStruct weaponInfo_default[] =
{ WEAPON_SG552, SG552_PRICE, AMMO_556MM_PRICE, AMMO_556NATO_BUY, SG552_MAX_CLIP, MAX_AMMO_556NATO, AMMO_556NATO, "weapon_sg552", "ammo_556nato" }, { WEAPON_SG552, SG552_PRICE, AMMO_556MM_PRICE, AMMO_556NATO_BUY, SG552_MAX_CLIP, MAX_AMMO_556NATO, AMMO_556NATO, "weapon_sg552", "ammo_556nato" },
{ WEAPON_AK47, AK47_PRICE, AMMO_762MM_PRICE, AMMO_762NATO_BUY, AK47_MAX_CLIP, MAX_AMMO_762NATO, AMMO_762NATO, "weapon_ak47", "ammo_762nato" }, { WEAPON_AK47, AK47_PRICE, AMMO_762MM_PRICE, AMMO_762NATO_BUY, AK47_MAX_CLIP, MAX_AMMO_762NATO, AMMO_762NATO, "weapon_ak47", "ammo_762nato" },
{ WEAPON_P90, P90_PRICE, AMMO_57MM_PRICE, AMMO_57MM_BUY, P90_MAX_CLIP, MAX_AMMO_57MM, AMMO_57MM, "weapon_p90", "ammo_57mm" }, { WEAPON_P90, P90_PRICE, AMMO_57MM_PRICE, AMMO_57MM_BUY, P90_MAX_CLIP, MAX_AMMO_57MM, AMMO_57MM, "weapon_p90", "ammo_57mm" },
{ WEAPON_SHIELDGUN, SHIELDGUN_PRICE, 0, 0, 0, 0, AMMO_NONE, nullptr, nullptr }, { WEAPON_SHIELDGUN, SHIELDGUN_PRICE, 0, 0, 0, 0, AMMO_NONE, "weapon_shield", nullptr },
{ 0, 0, 0, 0, 0, 0, AMMO_NONE, nullptr, nullptr } { 0, 0, 0, 0, 0, 0, AMMO_NONE, nullptr, nullptr }
}; };