mirror of
https://github.com/s1lentq/ReGameDLL_CS.git
synced 2025-01-27 22:18:03 +03:00
Implement CCSEntity::FireBuckshots
(#651)
This commit is contained in:
parent
d079f26fc1
commit
983500c9bd
@ -33,6 +33,11 @@ void CCSEntity::FireBullets(int iShots, Vector &vecSrc, Vector &vecDirShooting,
|
||||
m_pContainingEntity->FireBullets(iShots, vecSrc, vecDirShooting, vecSpread, flDistance, iBulletType, iTracerFreq, iDamage, pevAttacker);
|
||||
}
|
||||
|
||||
void CCSEntity::FireBuckshots(ULONG cShots, Vector &vecSrc, Vector &vecDirShooting, Vector &vecSpread, float flDistance, int iTracerFreq, int iDamage, entvars_t *pevAttacker)
|
||||
{
|
||||
m_pContainingEntity->FireBuckshots(cShots, vecSrc, vecDirShooting, vecSpread, flDistance, iTracerFreq, iDamage, pevAttacker);
|
||||
}
|
||||
|
||||
Vector CCSEntity::FireBullets3(Vector &vecSrc, Vector &vecDirShooting, float vecSpread, float flDistance, int iPenetration, int iBulletType, int iDamage, float flRangeModifier, entvars_t *pevAttacker, bool bPistol, int shared_rand)
|
||||
{
|
||||
return m_pContainingEntity->FireBullets3(vecSrc, vecDirShooting, vecSpread, flDistance, iPenetration, iBulletType, iDamage, flRangeModifier, pevAttacker, bPistol, shared_rand);
|
||||
|
@ -1146,87 +1146,87 @@ LINK_HOOK_CLASS_VOID_CHAIN(CBaseEntity, FireBuckshots, (ULONG cShots, VectorRef
|
||||
|
||||
void CBaseEntity::__API_HOOK(FireBuckshots)(ULONG cShots, VectorRef vecSrc, VectorRef vecDirShooting, VectorRef vecSpread, float flDistance, int iTracerFreq, int iDamage, entvars_t *pevAttacker)
|
||||
{
|
||||
static int tracerCount;
|
||||
int tracer;
|
||||
static int tracerCount;
|
||||
int tracer;
|
||||
|
||||
TraceResult tr;
|
||||
Vector vecRight, vecUp;
|
||||
TraceResult tr;
|
||||
Vector vecRight, vecUp;
|
||||
|
||||
vecRight = gpGlobals->v_right;
|
||||
vecUp = gpGlobals->v_up;
|
||||
vecRight = gpGlobals->v_right;
|
||||
vecUp = gpGlobals->v_up;
|
||||
|
||||
if (!pevAttacker)
|
||||
{
|
||||
// the default attacker is ourselves
|
||||
pevAttacker = pev;
|
||||
}
|
||||
if (!pevAttacker)
|
||||
{
|
||||
// the default attacker is ourselves
|
||||
pevAttacker = pev;
|
||||
}
|
||||
|
||||
ClearMultiDamage();
|
||||
gMultiDamage.type = (DMG_BULLET | DMG_NEVERGIB);
|
||||
ClearMultiDamage();
|
||||
gMultiDamage.type = (DMG_BULLET | DMG_NEVERGIB);
|
||||
|
||||
for (ULONG iShot = 1; iShot <= cShots; iShot++)
|
||||
{
|
||||
// get circular gaussian spread
|
||||
float x, y, z;
|
||||
for (ULONG iShot = 1; iShot <= cShots; iShot++)
|
||||
{
|
||||
// get circular gaussian spread
|
||||
float x, y, z;
|
||||
|
||||
do
|
||||
{
|
||||
x = RANDOM_FLOAT(-0.5, 0.5) + RANDOM_FLOAT(-0.5, 0.5);
|
||||
y = RANDOM_FLOAT(-0.5, 0.5) + RANDOM_FLOAT(-0.5, 0.5);
|
||||
z = x * x + y * y;
|
||||
}
|
||||
while (z > 1);
|
||||
do
|
||||
{
|
||||
x = RANDOM_FLOAT(-0.5, 0.5) + RANDOM_FLOAT(-0.5, 0.5);
|
||||
y = RANDOM_FLOAT(-0.5, 0.5) + RANDOM_FLOAT(-0.5, 0.5);
|
||||
z = x * x + y * y;
|
||||
}
|
||||
while (z > 1);
|
||||
|
||||
Vector vecDir, vecEnd;
|
||||
Vector vecDir, vecEnd;
|
||||
|
||||
vecDir = vecDirShooting + x * vecSpread.x * vecRight + y * vecSpread.y * vecUp;
|
||||
vecEnd = vecSrc + vecDir * flDistance;
|
||||
vecDir = vecDirShooting + x * vecSpread.x * vecRight + y * vecSpread.y * vecUp;
|
||||
vecEnd = vecSrc + vecDir * flDistance;
|
||||
|
||||
UTIL_TraceLine(vecSrc, vecEnd, dont_ignore_monsters, ENT(pev), &tr);
|
||||
tracer = 0;
|
||||
UTIL_TraceLine(vecSrc, vecEnd, dont_ignore_monsters, ENT(pev), &tr);
|
||||
tracer = 0;
|
||||
|
||||
if (iTracerFreq != 0 && !(tracerCount++ % iTracerFreq))
|
||||
{
|
||||
Vector vecTracerSrc;
|
||||
if (iTracerFreq != 0 && !(tracerCount++ % iTracerFreq))
|
||||
{
|
||||
Vector vecTracerSrc;
|
||||
|
||||
if (IsPlayer())
|
||||
{
|
||||
// adjust tracer position for player
|
||||
vecTracerSrc = vecSrc + Vector(0, 0, -4) + gpGlobals->v_right * 2 + gpGlobals->v_forward * 16;
|
||||
}
|
||||
else
|
||||
{
|
||||
vecTracerSrc = vecSrc;
|
||||
}
|
||||
if (IsPlayer())
|
||||
{
|
||||
// adjust tracer position for player
|
||||
vecTracerSrc = vecSrc + Vector(0, 0, -4) + gpGlobals->v_right * 2 + gpGlobals->v_forward * 16;
|
||||
}
|
||||
else
|
||||
{
|
||||
vecTracerSrc = vecSrc;
|
||||
}
|
||||
|
||||
// guns that always trace also always decal
|
||||
if (iTracerFreq != 1)
|
||||
tracer = 1;
|
||||
// guns that always trace also always decal
|
||||
if (iTracerFreq != 1)
|
||||
tracer = 1;
|
||||
|
||||
MESSAGE_BEGIN(MSG_PAS, SVC_TEMPENTITY, vecTracerSrc);
|
||||
WRITE_BYTE(TE_TRACER);
|
||||
WRITE_COORD(vecTracerSrc.x);
|
||||
WRITE_COORD(vecTracerSrc.y);
|
||||
WRITE_COORD(vecTracerSrc.z);
|
||||
WRITE_COORD(tr.vecEndPos.x);
|
||||
WRITE_COORD(tr.vecEndPos.y);
|
||||
WRITE_COORD(tr.vecEndPos.z);
|
||||
MESSAGE_END();
|
||||
}
|
||||
MESSAGE_BEGIN(MSG_PAS, SVC_TEMPENTITY, vecTracerSrc);
|
||||
WRITE_BYTE(TE_TRACER);
|
||||
WRITE_COORD(vecTracerSrc.x);
|
||||
WRITE_COORD(vecTracerSrc.y);
|
||||
WRITE_COORD(vecTracerSrc.z);
|
||||
WRITE_COORD(tr.vecEndPos.x);
|
||||
WRITE_COORD(tr.vecEndPos.y);
|
||||
WRITE_COORD(tr.vecEndPos.z);
|
||||
MESSAGE_END();
|
||||
}
|
||||
|
||||
// do damage, paint decals
|
||||
if (tr.flFraction != 1.0f)
|
||||
{
|
||||
CBaseEntity *pEntity = CBaseEntity::Instance(tr.pHit);
|
||||
float flDamage = ((1 - tr.flFraction) * iDamage);
|
||||
pEntity->TraceAttack(pevAttacker, int(flDamage), vecDir, &tr, DMG_BULLET);
|
||||
}
|
||||
// do damage, paint decals
|
||||
if (tr.flFraction != 1.0f)
|
||||
{
|
||||
CBaseEntity *pEntity = CBaseEntity::Instance(tr.pHit);
|
||||
float flDamage = ((1 - tr.flFraction) * iDamage);
|
||||
pEntity->TraceAttack(pevAttacker, int(flDamage), vecDir, &tr, DMG_BULLET);
|
||||
}
|
||||
|
||||
// make bullet trails
|
||||
UTIL_BubbleTrail(vecSrc, tr.vecEndPos, int((flDistance * tr.flFraction) / 64));
|
||||
}
|
||||
// make bullet trails
|
||||
UTIL_BubbleTrail(vecSrc, tr.vecEndPos, int((flDistance * tr.flFraction) / 64));
|
||||
}
|
||||
|
||||
ApplyMultiDamage(pev, pevAttacker);
|
||||
ApplyMultiDamage(pev, pevAttacker);
|
||||
}
|
||||
|
||||
bool EXT_FUNC IsPenetrableEntity_default(Vector &vecSrc, Vector &vecEnd, entvars_t *pevAttacker, edict_t *pHit)
|
||||
|
@ -39,8 +39,46 @@ public:
|
||||
|
||||
virtual ~CCSEntity() {}
|
||||
virtual void FireBullets(int iShots, Vector &vecSrc, Vector &vecDirShooting, Vector &vecSpread, float flDistance, int iBulletType, int iTracerFreq, int iDamage, entvars_t *pevAttacker);
|
||||
virtual void FireBuckshots(ULONG cShots, Vector &vecSrc, Vector &vecDirShooting, Vector &vecSpread, float flDistance, int iTracerFreq, int iDamage, entvars_t *pevAttacker);
|
||||
virtual Vector FireBullets3(Vector &vecSrc, Vector &vecDirShooting, float vecSpread, float flDistance, int iPenetration, int iBulletType, int iDamage, float flRangeModifier, entvars_t *pevAttacker, bool bPistol, int shared_rand);
|
||||
|
||||
#if defined(_MSC_VER)
|
||||
#pragma region reserve_vfuncs_Region
|
||||
#endif
|
||||
virtual void func_reserve1() {};
|
||||
virtual void func_reserve2() {};
|
||||
virtual void func_reserve3() {};
|
||||
virtual void func_reserve4() {};
|
||||
virtual void func_reserve5() {};
|
||||
virtual void func_reserve6() {};
|
||||
virtual void func_reserve7() {};
|
||||
virtual void func_reserve8() {};
|
||||
virtual void func_reserve9() {};
|
||||
virtual void func_reserve10() {};
|
||||
virtual void func_reserve11() {};
|
||||
virtual void func_reserve12() {};
|
||||
virtual void func_reserve13() {};
|
||||
virtual void func_reserve14() {};
|
||||
virtual void func_reserve15() {};
|
||||
virtual void func_reserve16() {};
|
||||
virtual void func_reserve17() {};
|
||||
virtual void func_reserve18() {};
|
||||
virtual void func_reserve19() {};
|
||||
virtual void func_reserve20() {};
|
||||
virtual void func_reserve21() {};
|
||||
virtual void func_reserve22() {};
|
||||
virtual void func_reserve23() {};
|
||||
virtual void func_reserve24() {};
|
||||
virtual void func_reserve25() {};
|
||||
virtual void func_reserve26() {};
|
||||
virtual void func_reserve27() {};
|
||||
virtual void func_reserve28() {};
|
||||
virtual void func_reserve29() {};
|
||||
virtual void func_reserve30() {};
|
||||
#if defined(_MSC_VER)
|
||||
#pragma endregion
|
||||
#endif
|
||||
|
||||
public:
|
||||
CBaseEntity *m_pContainingEntity;
|
||||
};
|
||||
@ -69,4 +107,4 @@ public:
|
||||
|
||||
};
|
||||
|
||||
#define CSENTITY_API_INTERFACE_VERSION "CSENTITY_API_INTERFACE_VERSION001"
|
||||
#define CSENTITY_API_INTERFACE_VERSION "CSENTITY_API_INTERFACE_VERSION002"
|
||||
|
Loading…
x
Reference in New Issue
Block a user