diff --git a/regamedll/dlls/airtank.cpp b/regamedll/dlls/airtank.cpp index 0c1962f3..24baab42 100644 --- a/regamedll/dlls/airtank.cpp +++ b/regamedll/dlls/airtank.cpp @@ -12,7 +12,7 @@ TYPEDESCRIPTION CAirtank::m_SaveData[] = #else -TYPEDESCRIPTION IMPLEMENT_ARRAY_CLASS(CAirtank, m_SaveData)[1]; +TYPEDESCRIPTION IMPL_CLASS(CAirtank, m_SaveData)[1]; #endif // HOOK_GAMEDLL diff --git a/regamedll/dlls/airtank.h b/regamedll/dlls/airtank.h index 70510a30..cd182dce 100644 --- a/regamedll/dlls/airtank.h +++ b/regamedll/dlls/airtank.h @@ -57,21 +57,22 @@ public: int Save_(CSave &save); int Restore_(CRestore &restore); void Killed_(entvars_t *pevAttacker, int iGib); - int BloodColor_(void) - { - return BloodColor(); - } #endif // HOOK_GAMEDLL public: - static TYPEDESCRIPTION IMPLEMENT_ARRAY(m_SaveData)[1]; + static TYPEDESCRIPTION IMPL(m_SaveData)[1]; private: int m_state; }; +#ifdef HOOK_GAMEDLL + +// linked objects C_DLLEXPORT void item_airtank(entvars_t *pev); +#endif // HOOK_GAMEDLL + #endif // AIRTANK_H diff --git a/regamedll/dlls/ammo.h b/regamedll/dlls/ammo.h index c8e8702d..39409ba5 100644 --- a/regamedll/dlls/ammo.h +++ b/regamedll/dlls/ammo.h @@ -32,22 +32,22 @@ #pragma once #endif -/* <9792> ../cstrike/dlls/ammo.cpp:14 */ -class C9MMAmmo: public CBasePlayerAmmo -{ -public: +/* <9792> ../cstrike/dlls/ammo.cpp:14 */ +class C9MMAmmo: public CBasePlayerAmmo +{ +public: virtual void Spawn(void); virtual void Precache(void); - virtual BOOL AddAmmo(CBaseEntity *pOther); - -#ifdef HOOK_GAMEDLL - + virtual BOOL AddAmmo(CBaseEntity *pOther); + +#ifdef HOOK_GAMEDLL + void Spawn_(void); void Precache_(void); - BOOL AddAmmo_(CBaseEntity *pOther); - -#endif // HOOK_GAMEDLL - + BOOL AddAmmo_(CBaseEntity *pOther); + +#endif // HOOK_GAMEDLL + };/* size: 152, cachelines: 3, members: 1 */ /* <97df> ../cstrike/dlls/ammo.cpp:40 */ @@ -58,17 +58,17 @@ public: virtual void Precache(void); virtual BOOL AddAmmo(CBaseEntity *pOther); -#ifdef HOOK_GAMEDLL - +#ifdef HOOK_GAMEDLL + void Spawn_(void); void Precache_(void); - BOOL AddAmmo_(CBaseEntity *pOther); - + BOOL AddAmmo_(CBaseEntity *pOther); + #endif // HOOK_GAMEDLL };/* size: 152, cachelines: 3, members: 1 */ -/* <982c> ../cstrike/dlls/ammo.cpp:67 */ +/* <982c> ../cstrike/dlls/ammo.cpp:67 */ class C556NatoAmmo: public CBasePlayerAmmo { public: @@ -76,154 +76,154 @@ public: virtual void Precache(void); virtual BOOL AddAmmo(CBaseEntity *pOther); -#ifdef HOOK_GAMEDLL - +#ifdef HOOK_GAMEDLL + void Spawn_(void); void Precache_(void); - BOOL AddAmmo_(CBaseEntity *pOther); - + BOOL AddAmmo_(CBaseEntity *pOther); + #endif // HOOK_GAMEDLL };/* size: 152, cachelines: 3, members: 1 */ -/* <9879> ../cstrike/dlls/ammo.cpp:93 */ +/* <9879> ../cstrike/dlls/ammo.cpp:93 */ class C556NatoBoxAmmo: public CBasePlayerAmmo { -public: +public: virtual void Spawn(void); virtual void Precache(void); virtual BOOL AddAmmo(CBaseEntity *pOther); -#ifdef HOOK_GAMEDLL - +#ifdef HOOK_GAMEDLL + void Spawn_(void); void Precache_(void); - BOOL AddAmmo_(CBaseEntity *pOther); - + BOOL AddAmmo_(CBaseEntity *pOther); + #endif // HOOK_GAMEDLL - + };/* size: 152, cachelines: 3, members: 1 */ -/* <98c6> ../cstrike/dlls/ammo.cpp:119 */ +/* <98c6> ../cstrike/dlls/ammo.cpp:119 */ class C762NatoAmmo: public CBasePlayerAmmo { -public: +public: virtual void Spawn(void); virtual void Precache(void); virtual BOOL AddAmmo(CBaseEntity *pOther); -#ifdef HOOK_GAMEDLL - +#ifdef HOOK_GAMEDLL + void Spawn_(void); void Precache_(void); - BOOL AddAmmo_(CBaseEntity *pOther); - -#endif // HOOK_GAMEDLL - -};/* size: 152, cachelines: 3, members: 1 */ + BOOL AddAmmo_(CBaseEntity *pOther); -/* <9913> ../cstrike/dlls/ammo.cpp:145 */ +#endif // HOOK_GAMEDLL + +};/* size: 152, cachelines: 3, members: 1 */ + +/* <9913> ../cstrike/dlls/ammo.cpp:145 */ class C45ACPAmmo: public CBasePlayerAmmo { -public: +public: virtual void Spawn(void); virtual void Precache(void); virtual BOOL AddAmmo(CBaseEntity *pOther); -#ifdef HOOK_GAMEDLL - +#ifdef HOOK_GAMEDLL + void Spawn_(void); void Precache_(void); - BOOL AddAmmo_(CBaseEntity *pOther); - + BOOL AddAmmo_(CBaseEntity *pOther); + #endif // HOOK_GAMEDLL - + };/* size: 152, cachelines: 3, members: 1 */ -/* <9960> ../cstrike/dlls/ammo.cpp:171 */ +/* <9960> ../cstrike/dlls/ammo.cpp:171 */ class C50AEAmmo: public CBasePlayerAmmo { -public: +public: virtual void Spawn(void); virtual void Precache(void); virtual BOOL AddAmmo(CBaseEntity *pOther); -#ifdef HOOK_GAMEDLL - +#ifdef HOOK_GAMEDLL + void Spawn_(void); void Precache_(void); - BOOL AddAmmo_(CBaseEntity *pOther); - + BOOL AddAmmo_(CBaseEntity *pOther); + #endif // HOOK_GAMEDLL - + };/* size: 152, cachelines: 3, members: 1 */ -/* <99ad> ../cstrike/dlls/ammo.cpp:197 */ +/* <99ad> ../cstrike/dlls/ammo.cpp:197 */ class C338MagnumAmmo: public CBasePlayerAmmo { -public: +public: virtual void Spawn(void); virtual void Precache(void); virtual BOOL AddAmmo(CBaseEntity *pOther); -#ifdef HOOK_GAMEDLL - +#ifdef HOOK_GAMEDLL + void Spawn_(void); void Precache_(void); - BOOL AddAmmo_(CBaseEntity *pOther); - + BOOL AddAmmo_(CBaseEntity *pOther); + #endif // HOOK_GAMEDLL - + };/* size: 152, cachelines: 3, members: 1 */ -/* <99fa> ../cstrike/dlls/ammo.cpp:224 */ +/* <99fa> ../cstrike/dlls/ammo.cpp:224 */ class C57MMAmmo: public CBasePlayerAmmo { -public: +public: virtual void Spawn(void); virtual void Precache(void); virtual BOOL AddAmmo(CBaseEntity *pOther); -#ifdef HOOK_GAMEDLL - +#ifdef HOOK_GAMEDLL + void Spawn_(void); void Precache_(void); - BOOL AddAmmo_(CBaseEntity *pOther); - + BOOL AddAmmo_(CBaseEntity *pOther); + #endif // HOOK_GAMEDLL - + };/* size: 152, cachelines: 3, members: 1 */ -/* <9a47> ../cstrike/dlls/ammo.cpp:249 */ +/* <9a47> ../cstrike/dlls/ammo.cpp:249 */ class C357SIGAmmo: public CBasePlayerAmmo { -public: +public: virtual void Spawn(void); virtual void Precache(void); virtual BOOL AddAmmo(CBaseEntity *pOther); -#ifdef HOOK_GAMEDLL - +#ifdef HOOK_GAMEDLL + void Spawn_(void); void Precache_(void); - BOOL AddAmmo_(CBaseEntity *pOther); - + BOOL AddAmmo_(CBaseEntity *pOther); + #endif // HOOK_GAMEDLL - + };/* size: 152, cachelines: 3, members: 1 */ #ifdef HOOK_GAMEDLL -// linked objects -C_DLLEXPORT void ammo_9mm(entvars_t *pev); -C_DLLEXPORT void ammo_buckshot(entvars_t *pev); -C_DLLEXPORT void ammo_556nato(entvars_t *pev); -C_DLLEXPORT void ammo_556natobox(entvars_t *pev); -C_DLLEXPORT void ammo_762nato(entvars_t *pev); -C_DLLEXPORT void ammo_45acp(entvars_t *pev); -C_DLLEXPORT void ammo_50ae(entvars_t *pev); -C_DLLEXPORT void ammo_338magnum(entvars_t *pev); -C_DLLEXPORT void ammo_57mm(entvars_t *pev); +// linked objects +C_DLLEXPORT void ammo_9mm(entvars_t *pev); +C_DLLEXPORT void ammo_buckshot(entvars_t *pev); +C_DLLEXPORT void ammo_556nato(entvars_t *pev); +C_DLLEXPORT void ammo_556natobox(entvars_t *pev); +C_DLLEXPORT void ammo_762nato(entvars_t *pev); +C_DLLEXPORT void ammo_45acp(entvars_t *pev); +C_DLLEXPORT void ammo_50ae(entvars_t *pev); +C_DLLEXPORT void ammo_338magnum(entvars_t *pev); +C_DLLEXPORT void ammo_57mm(entvars_t *pev); C_DLLEXPORT void ammo_357sig(entvars_t *pev); #endif // HOOK_GAMEDLL diff --git a/regamedll/dlls/animating.cpp b/regamedll/dlls/animating.cpp index 1500c2e2..23604deb 100644 --- a/regamedll/dlls/animating.cpp +++ b/regamedll/dlls/animating.cpp @@ -16,104 +16,104 @@ TYPEDESCRIPTION CBaseAnimating::m_SaveData[] = #else -TYPEDESCRIPTION IMPLEMENT_ARRAY_CLASS(CBaseAnimating, m_SaveData)[5]; +TYPEDESCRIPTION IMPL_CLASS(CBaseAnimating, m_SaveData)[5]; #endif // HOOK_GAMEDLL /* <10583> ../cstrike/dlls/animating.cpp:38 */ IMPLEMENT_SAVERESTORE(CBaseAnimating, CBaseDelay); -/* <105cf> ../cstrike/dlls/animating.cpp:45 */ -float CBaseAnimating::StudioFrameAdvance(float flInterval) -{ - if (flInterval == 0.0f) - { - flInterval = gpGlobals->time - pev->animtime; - - if (flInterval <= 0.001) - { - pev->animtime = gpGlobals->time; - return 0; - } - } - - if (pev->animtime == 0.0f) - flInterval = 0; - - pev->frame += flInterval * m_flFrameRate * pev->framerate; - pev->animtime = gpGlobals->time; - - if (pev->frame < 0.0 || pev->frame >= 256.0) - { - if (m_fSequenceLoops) - pev->frame -= (int)(pev->frame / 256.0) * 256.0; - else - pev->frame = (pev->frame < 0) ? 0 : 255; - - m_fSequenceFinished = TRUE; +/* <105cf> ../cstrike/dlls/animating.cpp:45 */ +float CBaseAnimating::StudioFrameAdvance(float flInterval) +{ + if (flInterval == 0.0f) + { + flInterval = gpGlobals->time - pev->animtime; + + if (flInterval <= 0.001) + { + pev->animtime = gpGlobals->time; + return 0; + } } - return flInterval; + if (pev->animtime == 0.0f) + flInterval = 0; + + pev->frame += flInterval * m_flFrameRate * pev->framerate; + pev->animtime = gpGlobals->time; + + if (pev->frame < 0.0 || pev->frame >= 256.0) + { + if (m_fSequenceLoops) + pev->frame -= (int)(pev->frame / 256.0) * 256.0; + else + pev->frame = (pev->frame < 0) ? 0 : 255; + + m_fSequenceFinished = TRUE; + } + + return flInterval; } -/* <10605> ../cstrike/dlls/animating.cpp:77 */ -int CBaseAnimating::LookupActivity(int activity) -{ +/* <10605> ../cstrike/dlls/animating.cpp:77 */ +int CBaseAnimating::LookupActivity(int activity) +{ void *pmodel = GET_MODEL_PTR(ENT(pev)); - return ::LookupActivity(pmodel, pev, activity); + return ::LookupActivity(pmodel, pev, activity); } -/* <10653> ../cstrike/dlls/animating.cpp:91 */ -int CBaseAnimating::LookupActivityHeaviest(int activity) -{ +/* <10653> ../cstrike/dlls/animating.cpp:91 */ +int CBaseAnimating::LookupActivityHeaviest(int activity) +{ void *pmodel = GET_MODEL_PTR(ENT(pev)); - return ::LookupActivityHeaviest(pmodel, pev, activity); -} - -/* <107b1> ../cstrike/dlls/animating.cpp:136 */ -void CBaseAnimating::DispatchAnimEvents(float flInterval) -{ - MonsterEvent_t event; - void *pmodel = GET_MODEL_PTR(ENT(pev)); - - if (!pmodel) - { - ALERT(at_aiconsole, "Gibbed monster is thinking!\n"); - return; - } - - // FIXME: I have to do this or some events get missed, and this is probably causing the problem below - flInterval = 0.1f; - - // FIX: this still sometimes hits events twice - float flStart = pev->frame + (m_flLastEventCheck - pev->animtime) * m_flFrameRate * pev->framerate; - float flEnd = pev->frame + flInterval * m_flFrameRate * pev->framerate; - - m_fSequenceFinished = FALSE; - m_flLastEventCheck = pev->animtime + flInterval; - - if (flEnd >= 256.0f || flEnd <= 0.0f) - { - m_fSequenceFinished = TRUE; - } - - int index = 0; - while ((index = GetAnimationEvent(pmodel, pev, &event, flStart, flEnd, index)) != 0) - { - HandleAnimEvent(&event); - } -} - -/* <106a1> ../cstrike/dlls/animating.cpp:100 */ -int CBaseAnimating::LookupSequence(const char *label) -{ + return ::LookupActivityHeaviest(pmodel, pev, activity); +} + +/* <107b1> ../cstrike/dlls/animating.cpp:136 */ +void CBaseAnimating::DispatchAnimEvents(float flInterval) +{ + MonsterEvent_t event; void *pmodel = GET_MODEL_PTR(ENT(pev)); - return ::LookupSequence(pmodel, label); -} - -/* <10711> ../cstrike/dlls/animating.cpp:110 */ -void CBaseAnimating::ResetSequenceInfo(void) -{ + + if (!pmodel) + { + ALERT(at_aiconsole, "Gibbed monster is thinking!\n"); + return; + } + + // FIXME: I have to do this or some events get missed, and this is probably causing the problem below + flInterval = 0.1f; + + // FIX: this still sometimes hits events twice + float flStart = pev->frame + (m_flLastEventCheck - pev->animtime) * m_flFrameRate * pev->framerate; + float flEnd = pev->frame + flInterval * m_flFrameRate * pev->framerate; + + m_fSequenceFinished = FALSE; + m_flLastEventCheck = pev->animtime + flInterval; + + if (flEnd >= 256.0f || flEnd <= 0.0f) + { + m_fSequenceFinished = TRUE; + } + + int index = 0; + while ((index = GetAnimationEvent(pmodel, pev, &event, flStart, flEnd, index)) != 0) + { + HandleAnimEvent(&event); + } +} + +/* <106a1> ../cstrike/dlls/animating.cpp:100 */ +int CBaseAnimating::LookupSequence(const char *label) +{ + void *pmodel = GET_MODEL_PTR(ENT(pev)); + return ::LookupSequence(pmodel, label); +} + +/* <10711> ../cstrike/dlls/animating.cpp:110 */ +void CBaseAnimating::ResetSequenceInfo(void) +{ void *pmodel = GET_MODEL_PTR(ENT(pev)); GetSequenceInfo(pmodel, pev, &m_flFrameRate, &m_flGroundSpeed); @@ -122,175 +122,175 @@ void CBaseAnimating::ResetSequenceInfo(void) pev->framerate = 1.0f; m_fSequenceFinished = FALSE; - m_flLastEventCheck = gpGlobals->time; -} - -/* <1077c> ../cstrike/dlls/animating.cpp:126 */ -BOOL CBaseAnimating::GetSequenceFlags(void) -{ + m_flLastEventCheck = gpGlobals->time; +} + +/* <1077c> ../cstrike/dlls/animating.cpp:126 */ +BOOL CBaseAnimating::GetSequenceFlags(void) +{ void *pmodel = GET_MODEL_PTR(ENT(pev)); - return ::GetSequenceFlags(pmodel, pev); -} - -/* <10837> ../cstrike/dlls/animating.cpp:171 */ -float CBaseAnimating::SetBoneController(int iController, float flValue) -{ - void *pmodel = GET_MODEL_PTR(ENT(pev)); - - return SetController(pmodel, pev, iController, flValue); -} - -/* <10893> ../cstrike/dlls/animating.cpp:180 */ -void CBaseAnimating::InitBoneControllers(void) -{ + return ::GetSequenceFlags(pmodel, pev); +} + +/* <10837> ../cstrike/dlls/animating.cpp:171 */ +float CBaseAnimating::SetBoneController(int iController, float flValue) +{ + void *pmodel = GET_MODEL_PTR(ENT(pev)); + + return SetController(pmodel, pev, iController, flValue); +} + +/* <10893> ../cstrike/dlls/animating.cpp:180 */ +void CBaseAnimating::InitBoneControllers(void) +{ void *pmodel = GET_MODEL_PTR(ENT(pev)); SetController(pmodel, pev, 0, 0); SetController(pmodel, pev, 1, 0); SetController(pmodel, pev, 2, 0); - SetController(pmodel, pev, 3, 0); -} - -/* <108d3> ../cstrike/dlls/animating.cpp:192 */ -NOXREF float CBaseAnimating::SetBlending(int iBlender, float flValue) -{ - void *pmodel = GET_MODEL_PTR(ENT(pev)); - return ::SetBlending(pmodel, pev, iBlender, flValue); -} - -/* <1092f> ../cstrike/dlls/animating.cpp:201 */ -NOXREF void CBaseAnimating::GetBonePosition(int iBone, Vector &origin, Vector &angles) -{ - GET_BONE_POSITION(ENT(pev), iBone, origin, angles); -} - -/* <10984> ../cstrike/dlls/animating.cpp:208 */ -NOXREF void CBaseAnimating::GetAttachment(int iAttachment, Vector &origin, Vector &angles) -{ - GET_ATTACHMENT(ENT(pev), iAttachment, origin, angles); -} - -/* <109d4> ../cstrike/dlls/animating.cpp:215 */ -NOXREF int CBaseAnimating::FindTransition(int iEndingSequence, int iGoalSequence, int *piDir) -{ - void *pmodel = GET_MODEL_PTR(ENT(pev)); - - if (piDir == NULL) - { - int iDir; - int sequence = ::FindTransition(pmodel, iEndingSequence, iGoalSequence, &iDir); - - if (iDir != 1) - sequence = -1; - - return sequence; - } - - return ::FindTransition(pmodel, iEndingSequence, iGoalSequence, piDir); -} - -/* <10a5d> ../cstrike/dlls/animating.cpp:234 */ -NOXREF void CBaseAnimating::GetAutomovement(Vector &origin, Vector &angles, float flInterval) -{ - ; -} - -/* <10aad> ../cstrike/dlls/animating.cpp:239 */ -NOXREF void CBaseAnimating::SetBodygroup(int iGroup, int iValue) -{ - ::SetBodygroup(GET_MODEL_PTR(ENT(pev)), pev, iGroup, iValue); -} - -/* <10af0> ../cstrike/dlls/animating.cpp:244 */ -NOXREF int CBaseAnimating::GetBodygroup(int iGroup) -{ - return ::GetBodygroup(GET_MODEL_PTR(ENT(pev)), pev, iGroup); -} - -/* <10b5f> ../cstrike/dlls/animating.cpp:250 */ -int CBaseAnimating::ExtractBbox(int sequence, float *mins, float *maxs) -{ - return ::ExtractBbox(GET_MODEL_PTR(ENT(pev)), sequence, mins, maxs); -} - -/* <10b99> ../cstrike/dlls/animating.cpp:258 */ -void CBaseAnimating::SetSequenceBox(void) -{ - Vector mins, maxs; - - // Get sequence bbox - if (ExtractBbox(pev->sequence, mins, maxs)) - { - // expand box for rotation - // find min / max for rotations - float yaw = pev->angles.y * (M_PI / 180.0); - - Vector xvector, yvector; - xvector.x = cos(yaw); - xvector.y = sin(yaw); - yvector.x = -sin(yaw); - yvector.y = cos(yaw); - - Vector bounds[2]; - bounds[0] = mins; - bounds[1] = maxs; - - Vector rmin(9999, 9999, 9999); - Vector rmax(-9999, -9999, -9999); - - Vector base, transformed; - for (int i = 0; i <= 1; i++) - { - base.x = bounds[i].x; - for (int j = 0; j <= 1; j++) - { - base.y = bounds[j].y; - for (int k = 0; k <= 1; k++) - { - base.z = bounds[k].z; - - // transform the point - transformed.x = xvector.x * base.x + yvector.x * base.y; - transformed.y = xvector.y * base.x + yvector.y * base.y; - transformed.z = base.z; - - if (transformed.x < rmin.x) - rmin.x = transformed.x; - - if (transformed.x > rmax.x) - rmax.x = transformed.x; - - if (transformed.y < rmin.y) - rmin.y = transformed.y; - - if (transformed.y > rmax.y) - rmax.y = transformed.y; - - if (transformed.z < rmin.z) - rmin.z = transformed.z; - - if (transformed.z > rmax.z) - rmax.z = transformed.z; - } - } - } - - rmin.z = 0; - rmax.z = rmin.z + 1; - UTIL_SetSize(pev, rmin, rmax); - } -} - -#ifdef HOOK_GAMEDLL - -int CBaseAnimating::Save(CSave &save) -{ - return Save_(save); -} - -int CBaseAnimating::Restore(CRestore &restore) -{ - return Restore_(restore); -} - -#endif // HOOK_GAMEDLL + SetController(pmodel, pev, 3, 0); +} + +/* <108d3> ../cstrike/dlls/animating.cpp:192 */ +NOXREF float CBaseAnimating::SetBlending(int iBlender, float flValue) +{ + void *pmodel = GET_MODEL_PTR(ENT(pev)); + return ::SetBlending(pmodel, pev, iBlender, flValue); +} + +/* <1092f> ../cstrike/dlls/animating.cpp:201 */ +NOXREF void CBaseAnimating::GetBonePosition(int iBone, Vector &origin, Vector &angles) +{ + GET_BONE_POSITION(ENT(pev), iBone, origin, angles); +} + +/* <10984> ../cstrike/dlls/animating.cpp:208 */ +NOXREF void CBaseAnimating::GetAttachment(int iAttachment, Vector &origin, Vector &angles) +{ + GET_ATTACHMENT(ENT(pev), iAttachment, origin, angles); +} + +/* <109d4> ../cstrike/dlls/animating.cpp:215 */ +NOXREF int CBaseAnimating::FindTransition(int iEndingSequence, int iGoalSequence, int *piDir) +{ + void *pmodel = GET_MODEL_PTR(ENT(pev)); + + if (piDir == NULL) + { + int iDir; + int sequence = ::FindTransition(pmodel, iEndingSequence, iGoalSequence, &iDir); + + if (iDir != 1) + sequence = -1; + + return sequence; + } + + return ::FindTransition(pmodel, iEndingSequence, iGoalSequence, piDir); +} + +/* <10a5d> ../cstrike/dlls/animating.cpp:234 */ +NOXREF void CBaseAnimating::GetAutomovement(Vector &origin, Vector &angles, float flInterval) +{ + ; +} + +/* <10aad> ../cstrike/dlls/animating.cpp:239 */ +NOXREF void CBaseAnimating::SetBodygroup(int iGroup, int iValue) +{ + ::SetBodygroup(GET_MODEL_PTR(ENT(pev)), pev, iGroup, iValue); +} + +/* <10af0> ../cstrike/dlls/animating.cpp:244 */ +NOXREF int CBaseAnimating::GetBodygroup(int iGroup) +{ + return ::GetBodygroup(GET_MODEL_PTR(ENT(pev)), pev, iGroup); +} + +/* <10b5f> ../cstrike/dlls/animating.cpp:250 */ +int CBaseAnimating::ExtractBbox(int sequence, float *mins, float *maxs) +{ + return ::ExtractBbox(GET_MODEL_PTR(ENT(pev)), sequence, mins, maxs); +} + +/* <10b99> ../cstrike/dlls/animating.cpp:258 */ +void CBaseAnimating::SetSequenceBox(void) +{ + Vector mins, maxs; + + // Get sequence bbox + if (ExtractBbox(pev->sequence, mins, maxs)) + { + // expand box for rotation + // find min / max for rotations + float yaw = pev->angles.y * (M_PI / 180.0); + + Vector xvector, yvector; + xvector.x = cos(yaw); + xvector.y = sin(yaw); + yvector.x = -sin(yaw); + yvector.y = cos(yaw); + + Vector bounds[2]; + bounds[0] = mins; + bounds[1] = maxs; + + Vector rmin(9999, 9999, 9999); + Vector rmax(-9999, -9999, -9999); + + Vector base, transformed; + for (int i = 0; i <= 1; i++) + { + base.x = bounds[i].x; + for (int j = 0; j <= 1; j++) + { + base.y = bounds[j].y; + for (int k = 0; k <= 1; k++) + { + base.z = bounds[k].z; + + // transform the point + transformed.x = xvector.x * base.x + yvector.x * base.y; + transformed.y = xvector.y * base.x + yvector.y * base.y; + transformed.z = base.z; + + if (transformed.x < rmin.x) + rmin.x = transformed.x; + + if (transformed.x > rmax.x) + rmax.x = transformed.x; + + if (transformed.y < rmin.y) + rmin.y = transformed.y; + + if (transformed.y > rmax.y) + rmax.y = transformed.y; + + if (transformed.z < rmin.z) + rmin.z = transformed.z; + + if (transformed.z > rmax.z) + rmax.z = transformed.z; + } + } + } + + rmin.z = 0; + rmax.z = rmin.z + 1; + UTIL_SetSize(pev, rmin, rmax); + } +} + +#ifdef HOOK_GAMEDLL + +int CBaseAnimating::Save(CSave &save) +{ + return Save_(save); +} + +int CBaseAnimating::Restore(CRestore &restore) +{ + return Restore_(restore); +} + +#endif // HOOK_GAMEDLL diff --git a/regamedll/dlls/basemonster.h b/regamedll/dlls/basemonster.h index b2ed17f4..fb5580c2 100644 --- a/regamedll/dlls/basemonster.h +++ b/regamedll/dlls/basemonster.h @@ -73,28 +73,28 @@ public: virtual BOOL FInViewCone(CBaseEntity *pEntity); virtual BOOL FInViewCone(const Vector *pOrigin); -#ifdef HOOK_GAMEDLL - - void KeyValue_(KeyValueData *pkvd); - void TraceAttack_(entvars_t *pevAttacker, float flDamage, Vector vecDir, TraceResult *ptr, int bitsDamageType); - int TakeDamage_(entvars_t *pevInflictor, entvars_t *pevAttacker, float flDamage, int bitsDamageType); - int TakeHealth_(float flHealth, int bitsDamageType); - void Killed_(entvars_t *pevAttacker, int iGib); - float ChangeYaw_(int speed); - BOOL HasHumanGibs_(void); - BOOL HasAlienGibs_(void); - void FadeMonster_(void); - void GibMonster_(void); - Activity GetDeathActivity_(void); - void BecomeDead_(void); - BOOL ShouldFadeOnDeath_(void); - int IRelationship_(CBaseEntity *pTarget); - void MonsterInitDead_(void); - void Look_(int iDistance); - CBaseEntity *BestVisibleEnemy_(void); - BOOL FInViewCone_(CBaseEntity *pEntity); - BOOL FInViewCone_(const Vector *pOrigin); - +#ifdef HOOK_GAMEDLL + + void KeyValue_(KeyValueData *pkvd); + void TraceAttack_(entvars_t *pevAttacker, float flDamage, Vector vecDir, TraceResult *ptr, int bitsDamageType); + int TakeDamage_(entvars_t *pevInflictor, entvars_t *pevAttacker, float flDamage, int bitsDamageType); + int TakeHealth_(float flHealth, int bitsDamageType); + void Killed_(entvars_t *pevAttacker, int iGib); + float ChangeYaw_(int speed); + BOOL HasHumanGibs_(void); + BOOL HasAlienGibs_(void); + void FadeMonster_(void); + void GibMonster_(void); + Activity GetDeathActivity_(void); + void BecomeDead_(void); + BOOL ShouldFadeOnDeath_(void); + int IRelationship_(CBaseEntity *pTarget); + void MonsterInitDead_(void); + void Look_(int iDistance); + CBaseEntity *BestVisibleEnemy_(void); + BOOL FInViewCone_(CBaseEntity *pEntity); + BOOL FInViewCone_(const Vector *pOrigin); + #endif // HOOK_GAMEDLL public: diff --git a/regamedll/dlls/bmodels.cpp b/regamedll/dlls/bmodels.cpp index 428ea165..de4ce242 100644 --- a/regamedll/dlls/bmodels.cpp +++ b/regamedll/dlls/bmodels.cpp @@ -28,8 +28,8 @@ TYPEDESCRIPTION CPendulum::m_SaveData[] = #else -TYPEDESCRIPTION IMPLEMENT_ARRAY_CLASS(CFuncRotating, m_SaveData)[5]; -TYPEDESCRIPTION IMPLEMENT_ARRAY_CLASS(CPendulum, m_SaveData)[8]; +TYPEDESCRIPTION IMPL_CLASS(CFuncRotating, m_SaveData)[5]; +TYPEDESCRIPTION IMPL_CLASS(CPendulum, m_SaveData)[8]; #endif // HOOK_GAMEDLL diff --git a/regamedll/dlls/bmodels.h b/regamedll/dlls/bmodels.h index b1e711e2..3126cf06 100644 --- a/regamedll/dlls/bmodels.h +++ b/regamedll/dlls/bmodels.h @@ -209,7 +209,7 @@ public: void RampPitchVol(int fUp); public: - static TYPEDESCRIPTION IMPLEMENT_ARRAY(m_SaveData)[5]; + static TYPEDESCRIPTION IMPL(m_SaveData)[5]; public: float m_flFanFriction; @@ -254,7 +254,7 @@ public: // this touch func makes the pendulum a rope void EXPORT RopeTouch(CBaseEntity *pOther); - static TYPEDESCRIPTION IMPLEMENT_ARRAY(m_SaveData)[8]; + static TYPEDESCRIPTION IMPL(m_SaveData)[8]; public: float m_accel; // Acceleration diff --git a/regamedll/dlls/bot/cs_bot.cpp b/regamedll/dlls/bot/cs_bot.cpp index 7ff38e83..5bc54caa 100644 --- a/regamedll/dlls/bot/cs_bot.cpp +++ b/regamedll/dlls/bot/cs_bot.cpp @@ -110,16 +110,16 @@ NOBODY void CCSBot::BotTouch(CBaseEntity *other) /* <2e89e3> ../cstrike/dlls/bot/cs_bot.cpp:335 */ bool CCSBot::IsBusy(void) const { - if (IsAttacking() || - IsBuying() || - IsDefusingBomb() || - GetTask() == PLANT_BOMB || - GetTask() == RESCUE_HOSTAGES || - IsSniping()) - { - return true; - } - + if (IsAttacking() || + IsBuying() || + IsDefusingBomb() || + GetTask() == PLANT_BOMB || + GetTask() == RESCUE_HOSTAGES || + IsSniping()) + { + return true; + } + return false; } @@ -359,15 +359,15 @@ bool CCSBot::IsRogue(void) const { CCSBotManager *ctrl = TheCSBots(); - if (!ctrl->AllowRogues()) + if (!ctrl->AllowRogues()) return false; - // periodically re-evaluate our rogue status - if (m_rogueTimer.IsElapsed()) + // periodically re-evaluate our rogue status + if (m_rogueTimer.IsElapsed()) { m_rogueTimer.Start(RANDOM_FLOAT(10, 30)); - // our chance of going rogue is inversely proportional to our teamwork attribute + // our chance of going rogue is inversely proportional to our teamwork attribute const float rogueChance = 100.0f * (1.0f - GetProfile()->GetTeamwork()); m_isRogue = (RANDOM_FLOAT(0, 100) < rogueChance); @@ -468,13 +468,11 @@ NOBODY const Vector *FindNearbyRetreatSpot(CCSBot *me, float maxRange) } /* <2eaa1d> ../cstrike/dlls/bot/cs_bot.cpp:1116 */ -NOBODY float CCSBot::GetRangeToFarthestEscortedHostage(void) +float CCSBot::GetRangeToFarthestEscortedHostage(void) { -// { -// class FarthestHostage away; // 1118 -// ForEachHostage(const class CHostageManager *const this, -// class FarthestHostage &func); // 1120 -// } + FarthestHostage away(this); + g_pHostages->ForEachHostage(away); + return away.m_farRange; } #ifdef HOOK_GAMEDLL diff --git a/regamedll/dlls/bot/cs_bot.h b/regamedll/dlls/bot/cs_bot.h index 3602b3dd..85e10697 100644 --- a/regamedll/dlls/bot/cs_bot.h +++ b/regamedll/dlls/bot/cs_bot.h @@ -1247,7 +1247,7 @@ public: if (IsSpotOccupied(m_me, spot->GetPosition())) { // player is in hiding spot - /// @todo Check if player is moving or sitting still + // TODO: Check if player is moving or sitting still continue; } @@ -1283,21 +1283,34 @@ private: class FarthestHostage { public: - FarthestHostage(CCSBot *me)//, float range) + FarthestHostage(const CCSBot *me) { m_me = me; - //m_farRange = range; + m_farRange = -1.0; } bool operator()(CHostage *hostage) { - //TODO: untested + if (hostage->pev->takedamage != DAMAGE_YES) + return true; - if (!hostage->IsFollowing(m_me)) - return false; + if (hostage->m_improv != NULL) + { + if (!hostage->IsFollowingSomeone() || m_me != hostage->GetLeader()) + return true; + } + else if (!hostage->IsFollowing(m_me)) + return true; + + float range = (hostage->Center() - m_me->pev->origin).Length(); + + if (range > m_farRange) + { + m_farRange = range; + } return true; } -private: + const CCSBot *m_me; float m_farRange; diff --git a/regamedll/dlls/bot/cs_bot_event.cpp b/regamedll/dlls/bot/cs_bot_event.cpp index 96cf0375..1da7d58b 100644 --- a/regamedll/dlls/bot/cs_bot_event.cpp +++ b/regamedll/dlls/bot/cs_bot_event.cpp @@ -1,117 +1,117 @@ #include "precompiled.h" -/* <31d087> ../cstrike/dlls/bot/cs_bot_event.cpp:22 */ -void CCSBot::__MAKE_VHOOK(OnEvent)(GameEventType event, CBaseEntity *entity, CBaseEntity *other) -{ -// { -// class CCSBotManager *ctrl; // 63 -// class CBasePlayer *player; // 65 -// float range; // 363 -// enum PriorityType priority; // 364 -// bool isHostile; // 365 -// const Vector *newNoisePosition; // 419 -// float newNoiseDist; // 420 -// { -// class CBasePlayer *killer; // 81 -// { -// float const knifeAmbushChance; // 91 -// Hurry(CCSBot *const this, -// float duration); // 88 -// } -// } -// Say(BotChatterInterface *const this, -// const char *phraseName, -// float lifetime, -// float delay); // 221 -// { -// float const bombBeepHearRangeSq; // 242 -// operator-(const Vector *const this, -// const Vector &v); // 243 -// LengthSquared(const Vector *const this); // 243 -// { -// const class Zone *zone; // 248 -// } -// } -// { -// float const bombPickupHearRangeSq; // 229 -// operator-(const Vector *const this, -// const Vector &v); // 230 -// LengthSquared(const Vector *const this); // 230 -// } -// { -// class CBasePlayer *victim; // 111 -// class CBasePlayer *killer; // 113 -// GetNearbyEnemyCount(const class CCSBot *const this); // 175 -// { -// float delay; // 185 -// } -// GetTimeSinceLastSawEnemy(const class CCSBot *const this); // 155 -// SetTask(CCSBot *const this, -// enum TaskType task, -// class CBaseEntity *entity); // 164 -// GetEnemy(CCSBot *const this); // 164 -// Say(BotChatterInterface *const this, -// const char *phraseName, -// float lifetime, -// float delay); // 118 -// entindex(CBaseEntity *const this); // 124 -// } -// GetEnemy(CCSBot *const this); // 292 -// ForceRun(CCSBot *const this, -// float duration); // 294 -// { -// float const hearCallRange; // 329 -// Vector vecCenter; // 334 -// operator-(const Vector *const this, -// const Vector &v); // 330 -// IsLengthGreaterThan(const Vector *const this, -// float length); // 330 -// { -// enum RouteType route; // 343 -// SetTask(CCSBot *const this, -// enum TaskType task, -// class CBaseEntity *entity); // 338 -// SetGoalEntity(CCSBot *const this, -// class CBaseEntity *entity); // 340 -// } -// } -// operator-(const Vector *const this, -// const Vector &v); // 376 -// IsLengthGreaterThan(const Vector *const this, -// float length); // 376 -// { -// float const headOffChance; // 390 -// SetTask(CCSBot *const this, -// enum TaskType task, -// class CBaseEntity *entity); // 396 -// } -// operator-(const Vector *const this, -// const Vector &v); // 420 -// Length(const Vector *const this); // 420 -// { -// float const veryCloseRange; // 434 -// class CNavArea *noiseArea; // 461 -// float const maxErrorRadius; // 481 -// float const maxHearingRange; // 482 -// float errorRadius; // 483 -// { -// float const shortTermMemoryTime; // 445 -// { -// float oldNoiseDist; // 452 -// operator-(const Vector *const this, -// const Vector &v); // 452 -// Length(const Vector *const this); // 452 -// } -// } -// } -// } +/* <31d087> ../cstrike/dlls/bot/cs_bot_event.cpp:22 */ +void CCSBot::__MAKE_VHOOK(OnEvent)(GameEventType event, CBaseEntity *entity, CBaseEntity *other) +{ +// { +// class CCSBotManager *ctrl; // 63 +// class CBasePlayer *player; // 65 +// float range; // 363 +// enum PriorityType priority; // 364 +// bool isHostile; // 365 +// const Vector *newNoisePosition; // 419 +// float newNoiseDist; // 420 +// { +// class CBasePlayer *killer; // 81 +// { +// float const knifeAmbushChance; // 91 +// Hurry(CCSBot *const this, +// float duration); // 88 +// } +// } +// Say(BotChatterInterface *const this, +// const char *phraseName, +// float lifetime, +// float delay); // 221 +// { +// float const bombBeepHearRangeSq; // 242 +// operator-(const Vector *const this, +// const Vector &v); // 243 +// LengthSquared(const Vector *const this); // 243 +// { +// const class Zone *zone; // 248 +// } +// } +// { +// float const bombPickupHearRangeSq; // 229 +// operator-(const Vector *const this, +// const Vector &v); // 230 +// LengthSquared(const Vector *const this); // 230 +// } +// { +// class CBasePlayer *victim; // 111 +// class CBasePlayer *killer; // 113 +// GetNearbyEnemyCount(const class CCSBot *const this); // 175 +// { +// float delay; // 185 +// } +// GetTimeSinceLastSawEnemy(const class CCSBot *const this); // 155 +// SetTask(CCSBot *const this, +// enum TaskType task, +// class CBaseEntity *entity); // 164 +// GetEnemy(CCSBot *const this); // 164 +// Say(BotChatterInterface *const this, +// const char *phraseName, +// float lifetime, +// float delay); // 118 +// entindex(CBaseEntity *const this); // 124 +// } +// GetEnemy(CCSBot *const this); // 292 +// ForceRun(CCSBot *const this, +// float duration); // 294 +// { +// float const hearCallRange; // 329 +// Vector vecCenter; // 334 +// operator-(const Vector *const this, +// const Vector &v); // 330 +// IsLengthGreaterThan(const Vector *const this, +// float length); // 330 +// { +// enum RouteType route; // 343 +// SetTask(CCSBot *const this, +// enum TaskType task, +// class CBaseEntity *entity); // 338 +// SetGoalEntity(CCSBot *const this, +// class CBaseEntity *entity); // 340 +// } +// } +// operator-(const Vector *const this, +// const Vector &v); // 376 +// IsLengthGreaterThan(const Vector *const this, +// float length); // 376 +// { +// float const headOffChance; // 390 +// SetTask(CCSBot *const this, +// enum TaskType task, +// class CBaseEntity *entity); // 396 +// } +// operator-(const Vector *const this, +// const Vector &v); // 420 +// Length(const Vector *const this); // 420 +// { +// float const veryCloseRange; // 434 +// class CNavArea *noiseArea; // 461 +// float const maxErrorRadius; // 481 +// float const maxHearingRange; // 482 +// float errorRadius; // 483 +// { +// float const shortTermMemoryTime; // 445 +// { +// float oldNoiseDist; // 452 +// operator-(const Vector *const this, +// const Vector &v); // 452 +// Length(const Vector *const this); // 452 +// } +// } +// } +// } } - + #ifdef HOOK_GAMEDLL -void CCSBot::OnEvent(GameEventType event, CBaseEntity *entity, CBaseEntity *other) -{ - OnEvent_(event, entity, other); +void CCSBot::OnEvent(GameEventType event, CBaseEntity *entity, CBaseEntity *other) +{ + OnEvent_(event, entity, other); } #endif // HOOK_GAMEDLL diff --git a/regamedll/dlls/bot/cs_bot_manager.cpp b/regamedll/dlls/bot/cs_bot_manager.cpp index b0dc8f4a..15fe12d1 100644 --- a/regamedll/dlls/bot/cs_bot_manager.cpp +++ b/regamedll/dlls/bot/cs_bot_manager.cpp @@ -123,7 +123,7 @@ void CCSBotManager::__MAKE_VHOOK(RestartRound)(void) m_bombDefuser = NULL; m_earliestBombPlantTimestamp = gpGlobals->time + RANDOM_FLOAT(10, 30); - IMPLEMENT_ARRAY(m_editCmd) = EDIT_NONE; + IMPL(m_editCmd) = EDIT_NONE; ResetRadioMessageTimestamps(); m_lastSeenEnemyTimestamp = -9999.9f; @@ -209,7 +209,7 @@ NOBODY bool CCSBotManager::IsOnOffense(CBasePlayer *player) const void CCSBotManager::__MAKE_VHOOK(ServerActivate)(void) { DestroyNavigationMap(); - IMPLEMENT_ARRAY(m_isMapDataLoaded) = false; + IMPL(m_isMapDataLoaded) = false; m_zoneCount = 0; m_gameScenario = SCENARIO_DEATHMATCH; @@ -217,8 +217,8 @@ void CCSBotManager::__MAKE_VHOOK(ServerActivate)(void) ValidateMapData(); RestartRound(); - IMPLEMENT_ARRAY(m_isLearningMap) = false; - IMPLEMENT_ARRAY(m_isAnalysisRequested) = false; + IMPL(m_isLearningMap) = false; + IMPL(m_isAnalysisRequested) = false; m_bServerActive = true; AddServerCommands(); @@ -480,59 +480,59 @@ void CCSBotManager::__MAKE_VHOOK(ServerCommand)(const char *pcmd) } else if (FStrEq(pcmd, "bot_nav_delete")) { - IMPLEMENT_ARRAY_CLASS(CCSBotManager, m_editCmd) = EDIT_DELETE; + IMPL_CLASS(CCSBotManager, m_editCmd) = EDIT_DELETE; } else if (FStrEq(pcmd, "bot_nav_split")) { - IMPLEMENT_ARRAY_CLASS(CCSBotManager, m_editCmd) = EDIT_SPLIT; + IMPL_CLASS(CCSBotManager, m_editCmd) = EDIT_SPLIT; } else if (FStrEq(pcmd, "bot_nav_merge")) { - IMPLEMENT_ARRAY_CLASS(CCSBotManager, m_editCmd) = EDIT_MERGE; + IMPL_CLASS(CCSBotManager, m_editCmd) = EDIT_MERGE; } else if (FStrEq(pcmd, "bot_nav_mark")) { - IMPLEMENT_ARRAY_CLASS(CCSBotManager, m_editCmd) = EDIT_MARK; + IMPL_CLASS(CCSBotManager, m_editCmd) = EDIT_MARK; } else if (FStrEq(pcmd, "bot_nav_begin_area")) { - IMPLEMENT_ARRAY_CLASS(CCSBotManager, m_editCmd) = EDIT_BEGIN_AREA; + IMPL_CLASS(CCSBotManager, m_editCmd) = EDIT_BEGIN_AREA; } else if (FStrEq(pcmd, "bot_nav_end_area")) { - IMPLEMENT_ARRAY_CLASS(CCSBotManager, m_editCmd) = EDIT_END_AREA; + IMPL_CLASS(CCSBotManager, m_editCmd) = EDIT_END_AREA; } else if (FStrEq(pcmd, "bot_nav_connect")) { - IMPLEMENT_ARRAY_CLASS(CCSBotManager, m_editCmd) = EDIT_CONNECT; + IMPL_CLASS(CCSBotManager, m_editCmd) = EDIT_CONNECT; } else if (FStrEq(pcmd, "bot_nav_disconnect")) { - IMPLEMENT_ARRAY_CLASS(CCSBotManager, m_editCmd) = EDIT_DISCONNECT; + IMPL_CLASS(CCSBotManager, m_editCmd) = EDIT_DISCONNECT; } else if (FStrEq(pcmd, "bot_nav_splice")) { - IMPLEMENT_ARRAY_CLASS(CCSBotManager, m_editCmd) = EDIT_SPLICE; + IMPL_CLASS(CCSBotManager, m_editCmd) = EDIT_SPLICE; } else if (FStrEq(pcmd, "bot_nav_crouch")) { - IMPLEMENT_ARRAY_CLASS(CCSBotManager, m_editCmd) = EDIT_ATTRIB_CROUCH; + IMPL_CLASS(CCSBotManager, m_editCmd) = EDIT_ATTRIB_CROUCH; } else if (FStrEq(pcmd, "bot_nav_jump")) { - IMPLEMENT_ARRAY_CLASS(CCSBotManager, m_editCmd) = EDIT_ATTRIB_JUMP; + IMPL_CLASS(CCSBotManager, m_editCmd) = EDIT_ATTRIB_JUMP; } else if (FStrEq(pcmd, "bot_nav_precise")) { - IMPLEMENT_ARRAY_CLASS(CCSBotManager, m_editCmd) = EDIT_ATTRIB_PRECISE; + IMPL_CLASS(CCSBotManager, m_editCmd) = EDIT_ATTRIB_PRECISE; } else if (FStrEq(pcmd, "bot_nav_no_jump")) { - IMPLEMENT_ARRAY_CLASS(CCSBotManager, m_editCmd) = EDIT_ATTRIB_NO_JUMP; + IMPL_CLASS(CCSBotManager, m_editCmd) = EDIT_ATTRIB_NO_JUMP; } else if (FStrEq(pcmd, "bot_nav_analyze")) { - IMPLEMENT_ARRAY_CLASS(CCSBotManager, m_isAnalysisRequested) = true; + IMPL_CLASS(CCSBotManager, m_isAnalysisRequested) = true; } else if (FStrEq(pcmd, "bot_nav_strip")) { @@ -611,19 +611,19 @@ void CCSBotManager::__MAKE_VHOOK(ServerCommand)(const char *pcmd) } else if (FStrEq(pcmd, "bot_nav_toggle_place_mode")) { - IMPLEMENT_ARRAY_CLASS(CCSBotManager, m_editCmd) = EDIT_TOGGLE_PLACE_MODE; + IMPL_CLASS(CCSBotManager, m_editCmd) = EDIT_TOGGLE_PLACE_MODE; } else if (FStrEq(pcmd, "bot_nav_place_floodfill")) { - IMPLEMENT_ARRAY_CLASS(CCSBotManager, m_editCmd) = EDIT_PLACE_FLOODFILL; + IMPL_CLASS(CCSBotManager, m_editCmd) = EDIT_PLACE_FLOODFILL; } else if (FStrEq(pcmd, "bot_nav_place_pick")) { - IMPLEMENT_ARRAY_CLASS(CCSBotManager, m_editCmd) = EDIT_PLACE_PICK; + IMPL_CLASS(CCSBotManager, m_editCmd) = EDIT_PLACE_PICK; } else if (FStrEq(pcmd, "bot_nav_toggle_place_painting")) { - IMPLEMENT_ARRAY_CLASS(CCSBotManager, m_editCmd) = EDIT_TOGGLE_PLACE_PAINTING; + IMPL_CLASS(CCSBotManager, m_editCmd) = EDIT_TOGGLE_PLACE_PAINTING; } else if (FStrEq(pcmd, "bot_goto_mark")) { @@ -683,23 +683,23 @@ void CCSBotManager::__MAKE_VHOOK(ServerCommand)(const char *pcmd) } else if (FStrEq(pcmd, "bot_nav_mark_unnamed")) { - IMPLEMENT_ARRAY_CLASS(CCSBotManager, m_editCmd) = EDIT_MARK_UNNAMED; + IMPL_CLASS(CCSBotManager, m_editCmd) = EDIT_MARK_UNNAMED; } else if (FStrEq(pcmd, "bot_nav_warp")) { - IMPLEMENT_ARRAY_CLASS(CCSBotManager, m_editCmd) = EDIT_WARP_TO_MARK; + IMPL_CLASS(CCSBotManager, m_editCmd) = EDIT_WARP_TO_MARK; } else if (FStrEq(pcmd, "bot_nav_corner_select")) { - IMPLEMENT_ARRAY_CLASS(CCSBotManager, m_editCmd) = EDIT_SELECT_CORNER; + IMPL_CLASS(CCSBotManager, m_editCmd) = EDIT_SELECT_CORNER; } else if (FStrEq(pcmd, "bot_nav_corner_raise")) { - IMPLEMENT_ARRAY_CLASS(CCSBotManager, m_editCmd) = EDIT_RAISE_CORNER; + IMPL_CLASS(CCSBotManager, m_editCmd) = EDIT_RAISE_CORNER; } else if (FStrEq(pcmd, "bot_nav_corner_lower")) { - IMPLEMENT_ARRAY_CLASS(CCSBotManager, m_editCmd) = EDIT_LOWER_CORNER; + IMPL_CLASS(CCSBotManager, m_editCmd) = EDIT_LOWER_CORNER; } else if (FStrEq(pcmd, "bot_nav_check_consistency")) { @@ -716,7 +716,7 @@ void CCSBotManager::__MAKE_VHOOK(ServerCommand)(const char *pcmd) /* <36c3c2> ../cstrike/dlls/bot/cs_bot_manager.cpp:903 */ NOBODY bool CCSBotManager::BotAddCommand(BotProfileTeamType team, bool isFromConsole) { - if (IMPLEMENT_ARRAY(m_isLearningMap) || ENG_CHECK_PARM("-nobots", NULL)) + if (IMPL(m_isLearningMap) || ENG_CHECK_PARM("-nobots", NULL)) return false; const BotProfile *profile = NULL; @@ -815,12 +815,12 @@ NOBODY void CCSBotManager::MonitorBotCVars(void) /* <36b780> ../cstrike/dlls/bot/cs_bot_manager.cpp:1109 */ void CCSBotManager::ValidateMapData(void) { - if (IMPLEMENT_ARRAY(m_isMapDataLoaded) || !UTIL_IsGame("czero")) + if (IMPL(m_isMapDataLoaded) || !UTIL_IsGame("czero")) { return; } - IMPLEMENT_ARRAY(m_isMapDataLoaded) = true; + IMPL(m_isMapDataLoaded) = true; if (LoadNavigationMap()) { @@ -1092,15 +1092,15 @@ const CCSBotManager::Zone *CCSBotManager::GetClosestZone(const Vector *pos) cons const Zone *close = NULL; float closeRangeSq = 1e9f; - for (int z = 0; z < m_zoneCount; z++) - { - float rangeSq = (m_zone[z].m_center - (*pos)).LengthSquared(); - - if (rangeSq < closeRangeSq) - { - closeRangeSq = rangeSq; - close = &m_zone[z]; - } + for (int z = 0; z < m_zoneCount; z++) + { + float rangeSq = (m_zone[z].m_center - (*pos)).LengthSquared(); + + if (rangeSq < closeRangeSq) + { + closeRangeSq = rangeSq; + close = &m_zone[z]; + } } return close; diff --git a/regamedll/dlls/bot/cs_bot_manager.h b/regamedll/dlls/bot/cs_bot_manager.h index 26a9fc8f..d74d5d18 100644 --- a/regamedll/dlls/bot/cs_bot_manager.h +++ b/regamedll/dlls/bot/cs_bot_manager.h @@ -36,34 +36,34 @@ #define TheBots (*pTheBots) -#define cv_bot_traceview (*pcv_bot_traceview) -#define cv_bot_stop (*pcv_bot_stop) -#define cv_bot_show_nav (*pcv_bot_show_nav) -#define cv_bot_show_danger (*pcv_bot_show_danger) -#define cv_bot_nav_edit (*pcv_bot_nav_edit) -#define cv_bot_nav_zdraw (*pcv_bot_nav_zdraw) -#define cv_bot_walk (*pcv_bot_walk) -#define cv_bot_difficulty (*pcv_bot_difficulty) -#define cv_bot_debug (*pcv_bot_debug) -#define cv_bot_quicksave (*pcv_bot_quicksave) -#define cv_bot_quota (*pcv_bot_quota) -#define cv_bot_quota_match (*pcv_bot_quota_match) -#define cv_bot_prefix (*pcv_bot_prefix) -#define cv_bot_allow_rogues (*pcv_bot_allow_rogues) -#define cv_bot_allow_pistols (*pcv_bot_allow_pistols) -#define cv_bot_allow_shotguns (*pcv_bot_allow_shotguns) -#define cv_bot_allow_sub_machine_guns (*pcv_bot_allow_sub_machine_guns) -#define cv_bot_allow_rifles (*pcv_bot_allow_rifles) -#define cv_bot_allow_machine_guns (*pcv_bot_allow_machine_guns) -#define cv_bot_allow_grenades (*pcv_bot_allow_grenades) -#define cv_bot_allow_snipers (*pcv_bot_allow_snipers) -#define cv_bot_allow_shield (*pcv_bot_allow_shield) -#define cv_bot_join_team (*pcv_bot_join_team) -#define cv_bot_join_after_player (*pcv_bot_join_after_player) -#define cv_bot_auto_vacate (*pcv_bot_auto_vacate) -#define cv_bot_zombie (*pcv_bot_zombie) -#define cv_bot_defer_to_human (*pcv_bot_defer_to_human) -#define cv_bot_chatter (*pcv_bot_chatter) +#define cv_bot_traceview (*pcv_bot_traceview) +#define cv_bot_stop (*pcv_bot_stop) +#define cv_bot_show_nav (*pcv_bot_show_nav) +#define cv_bot_show_danger (*pcv_bot_show_danger) +#define cv_bot_nav_edit (*pcv_bot_nav_edit) +#define cv_bot_nav_zdraw (*pcv_bot_nav_zdraw) +#define cv_bot_walk (*pcv_bot_walk) +#define cv_bot_difficulty (*pcv_bot_difficulty) +#define cv_bot_debug (*pcv_bot_debug) +#define cv_bot_quicksave (*pcv_bot_quicksave) +#define cv_bot_quota (*pcv_bot_quota) +#define cv_bot_quota_match (*pcv_bot_quota_match) +#define cv_bot_prefix (*pcv_bot_prefix) +#define cv_bot_allow_rogues (*pcv_bot_allow_rogues) +#define cv_bot_allow_pistols (*pcv_bot_allow_pistols) +#define cv_bot_allow_shotguns (*pcv_bot_allow_shotguns) +#define cv_bot_allow_sub_machine_guns (*pcv_bot_allow_sub_machine_guns) +#define cv_bot_allow_rifles (*pcv_bot_allow_rifles) +#define cv_bot_allow_machine_guns (*pcv_bot_allow_machine_guns) +#define cv_bot_allow_grenades (*pcv_bot_allow_grenades) +#define cv_bot_allow_snipers (*pcv_bot_allow_snipers) +#define cv_bot_allow_shield (*pcv_bot_allow_shield) +#define cv_bot_join_team (*pcv_bot_join_team) +#define cv_bot_join_after_player (*pcv_bot_join_after_player) +#define cv_bot_auto_vacate (*pcv_bot_auto_vacate) +#define cv_bot_zombie (*pcv_bot_zombie) +#define cv_bot_defer_to_human (*pcv_bot_defer_to_human) +#define cv_bot_chatter (*pcv_bot_chatter) #define cv_bot_profile_db (*pcv_bot_profile_db) //#define m_flNextCVarCheck (*pm_flNextCVarCheck) @@ -77,34 +77,34 @@ extern CBotManager *TheBots; -extern cvar_t cv_bot_traceview; -extern cvar_t cv_bot_stop; -extern cvar_t cv_bot_show_nav; -extern cvar_t cv_bot_show_danger; -extern cvar_t cv_bot_nav_edit; -extern cvar_t cv_bot_nav_zdraw; -extern cvar_t cv_bot_walk; -extern cvar_t cv_bot_difficulty; -extern cvar_t cv_bot_debug; -extern cvar_t cv_bot_quicksave; -extern cvar_t cv_bot_quota; -extern cvar_t cv_bot_quota_match; -extern cvar_t cv_bot_prefix; -extern cvar_t cv_bot_allow_rogues; -extern cvar_t cv_bot_allow_pistols; -extern cvar_t cv_bot_allow_shotguns; -extern cvar_t cv_bot_allow_sub_machine_guns; -extern cvar_t cv_bot_allow_rifles; -extern cvar_t cv_bot_allow_machine_guns; -extern cvar_t cv_bot_allow_grenades; -extern cvar_t cv_bot_allow_snipers; -extern cvar_t cv_bot_allow_shield; -extern cvar_t cv_bot_join_team; -extern cvar_t cv_bot_join_after_player; -extern cvar_t cv_bot_auto_vacate; -extern cvar_t cv_bot_zombie; -extern cvar_t cv_bot_defer_to_human; -extern cvar_t cv_bot_chatter; +extern cvar_t cv_bot_traceview; +extern cvar_t cv_bot_stop; +extern cvar_t cv_bot_show_nav; +extern cvar_t cv_bot_show_danger; +extern cvar_t cv_bot_nav_edit; +extern cvar_t cv_bot_nav_zdraw; +extern cvar_t cv_bot_walk; +extern cvar_t cv_bot_difficulty; +extern cvar_t cv_bot_debug; +extern cvar_t cv_bot_quicksave; +extern cvar_t cv_bot_quota; +extern cvar_t cv_bot_quota_match; +extern cvar_t cv_bot_prefix; +extern cvar_t cv_bot_allow_rogues; +extern cvar_t cv_bot_allow_pistols; +extern cvar_t cv_bot_allow_shotguns; +extern cvar_t cv_bot_allow_sub_machine_guns; +extern cvar_t cv_bot_allow_rifles; +extern cvar_t cv_bot_allow_machine_guns; +extern cvar_t cv_bot_allow_grenades; +extern cvar_t cv_bot_allow_snipers; +extern cvar_t cv_bot_allow_shield; +extern cvar_t cv_bot_join_team; +extern cvar_t cv_bot_join_after_player; +extern cvar_t cv_bot_auto_vacate; +extern cvar_t cv_bot_zombie; +extern cvar_t cv_bot_defer_to_human; +extern cvar_t cv_bot_chatter; extern cvar_t cv_bot_profile_db; class CCSBotManager: public CBotManager @@ -149,35 +149,35 @@ public: void ValidateMapData(void); bool IsLearningMap(void) { - return IMPLEMENT_ARRAY(m_isLearningMap); + return IMPL(m_isLearningMap); } void SetLearningMapFlag(void) { - IMPLEMENT_ARRAY(m_isLearningMap) = true; + IMPL(m_isLearningMap) = true; } bool IsAnalysisRequested(void) { - return IMPLEMENT_ARRAY(m_isAnalysisRequested); + return IMPL(m_isAnalysisRequested); } void RequestAnalysis(void) { - IMPLEMENT_ARRAY(m_isAnalysisRequested) = true; + IMPL(m_isAnalysisRequested) = true; } void AckAnalysisRequest(void) { - IMPLEMENT_ARRAY(m_isAnalysisRequested) = false; + IMPL(m_isAnalysisRequested) = false; } static BotDifficultyType GetDifficultyLevel(void) { - if (cv_bot_difficulty.value < 0.9f) - return BOT_EASY; - - if (cv_bot_difficulty.value < 1.9f) - return BOT_NORMAL; - - if (cv_bot_difficulty.value < 2.9f) - return BOT_HARD; - + if (cv_bot_difficulty.value < 0.9f) + return BOT_EASY; + + if (cv_bot_difficulty.value < 1.9f) + return BOT_NORMAL; + + if (cv_bot_difficulty.value < 2.9f) + return BOT_HARD; + return BOT_EXPERT; } @@ -256,9 +256,9 @@ public: // pick a zone at random and return it const Zone *GetRandomZone(void) const { - if (!m_zoneCount) - return NULL; - + if (!m_zoneCount) + return NULL; + return &m_zone[ RANDOM_LONG(0, m_zoneCount - 1) ]; } // returns true if bomb has been planted @@ -394,43 +394,43 @@ private: #else public: #endif // HOOK_GAMEDLL - static float IMPLEMENT_ARRAY(m_flNextCVarCheck); - static bool IMPLEMENT_ARRAY(m_isMapDataLoaded); - static bool IMPLEMENT_ARRAY(m_isLearningMap); - static bool IMPLEMENT_ARRAY(m_isAnalysisRequested); + static float IMPL(m_flNextCVarCheck); + static bool IMPL(m_isMapDataLoaded); + static bool IMPL(m_isLearningMap); + static bool IMPL(m_isAnalysisRequested); #ifdef HOOK_GAMEDLL private: #endif // HOOK_GAMEDLL - - GameScenarioType m_gameScenario;// TODO: must be on Windows offsetof - 16 - Zone m_zone[ MAX_ZONES ]; - int m_zoneCount; - bool m_isBombPlanted; - float m_bombPlantTimestamp; - float m_earliestBombPlantTimestamp; - CBasePlayer *m_bombDefuser; - EHANDLE m_looseBomb; - CNavArea *m_looseBombArea; - bool m_isRoundOver; - float m_radioMsgTimestamp[24][2]; - float m_lastSeenEnemyTimestamp; - float m_roundStartTimestamp; - bool m_isDefenseRushing; - + + GameScenarioType m_gameScenario;// TODO: must be on Windows offsetof - 16 + Zone m_zone[ MAX_ZONES ]; + int m_zoneCount; + bool m_isBombPlanted; + float m_bombPlantTimestamp; + float m_earliestBombPlantTimestamp; + CBasePlayer *m_bombDefuser; + EHANDLE m_looseBomb; + CNavArea *m_looseBombArea; + bool m_isRoundOver; + float m_radioMsgTimestamp[24][2]; + float m_lastSeenEnemyTimestamp; + float m_roundStartTimestamp; + bool m_isDefenseRushing; + #ifndef HOOK_GAMEDLL private: #else public: -#endif // HOOK_GAMEDLL - static NavEditCmdType IMPLEMENT_ARRAY(m_editCmd); +#endif // HOOK_GAMEDLL + static NavEditCmdType IMPL(m_editCmd); #ifdef HOOK_GAMEDLL private: -#endif // HOOK_GAMEDLL - - unsigned int m_navPlace; - CountdownTimer m_respawnTimer; - bool m_isRespawnStarted; - bool m_canRespawn; +#endif // HOOK_GAMEDLL + + unsigned int m_navPlace; + CountdownTimer m_respawnTimer; + bool m_isRespawnStarted; + bool m_canRespawn; bool m_bServerActive; };/* size: 736, cachelines: 12, members: 25 */ diff --git a/regamedll/dlls/bot/cs_bot_nav.cpp b/regamedll/dlls/bot/cs_bot_nav.cpp index 497e3ec8..4b692f41 100644 --- a/regamedll/dlls/bot/cs_bot_nav.cpp +++ b/regamedll/dlls/bot/cs_bot_nav.cpp @@ -1,218 +1,218 @@ #include "precompiled.h" -/* <37c284> ../cstrike/dlls/bot/cs_bot_nav.cpp:16 */ -NOBODY void CCSBot::ResetStuckMonitor(void) -{ +/* <37c284> ../cstrike/dlls/bot/cs_bot_nav.cpp:16 */ +NOBODY void CCSBot::ResetStuckMonitor(void) +{ } -/* <37c2a6> ../cstrike/dlls/bot/cs_bot_nav.cpp:37 */ -NOBODY void CCSBot::StuckCheck(void) -{ -// { -// Vector delta; // 42 -// float const unstuckRange; // 44 -// operator-(const Vector *const this, -// const Vector &v); // 42 -// IsLengthGreaterThan(const Vector *const this, -// float length); // 45 -// ResetStuckMonitor(CCSBot *const this); // 48 -// } -// { -// Vector vel; // 57 -// float moveDist; // 64 -// float deltaT; // 66 -// operator-(const Vector *const this, -// const Vector &v); // 57 -// Length(const Vector *const this); // 64 -// { -// float avgVel; // 81 -// float stuckVel; // 88 -// { -// int t; // 82 -// } -// } -// } +/* <37c2a6> ../cstrike/dlls/bot/cs_bot_nav.cpp:37 */ +NOBODY void CCSBot::StuckCheck(void) +{ +// { +// Vector delta; // 42 +// float const unstuckRange; // 44 +// operator-(const Vector *const this, +// const Vector &v); // 42 +// IsLengthGreaterThan(const Vector *const this, +// float length); // 45 +// ResetStuckMonitor(CCSBot *const this); // 48 +// } +// { +// Vector vel; // 57 +// float moveDist; // 64 +// float deltaT; // 66 +// operator-(const Vector *const this, +// const Vector &v); // 57 +// Length(const Vector *const this); // 64 +// { +// float avgVel; // 81 +// float stuckVel; // 88 +// { +// int t; // 82 +// } +// } +// } } -/* <37c05d> ../cstrike/dlls/bot/cs_bot_nav.cpp:114 */ -NOBODY bool CCSBot::DiscontinuityJump(float ground, bool onlyJumpDown, bool mustJump) -{ -// { -// float dz; // 119 -// } +/* <37c05d> ../cstrike/dlls/bot/cs_bot_nav.cpp:114 */ +NOBODY bool CCSBot::DiscontinuityJump(float ground, bool onlyJumpDown, bool mustJump) +{ +// { +// float dz; // 119 +// } } -/* <37c448> ../cstrike/dlls/bot/cs_bot_nav.cpp:154 */ -NOBODY bool CCSBot::GetSimpleGroundHeightWithFloor(const Vector *pos, float *height, Vector *normal) -{ -// GetSimpleGroundHeightWithFloor(CCSBot *const this, -// const Vector *pos, -// float *height, -// Vector *normal); // 154 -} - -/* <37c4b8> ../cstrike/dlls/bot/cs_bot_nav.cpp:172 */ -NOBODY Place CCSBot::GetPlace(void) -{ -} - -/* <37c4de> ../cstrike/dlls/bot/cs_bot_nav.cpp:184 */ -NOBODY void CCSBot::MoveTowardsPosition(const Vector *pos) -{ -// { -// float angle; // 249 -// class Vector2D dir; // 251 -// class Vector2D lat; // 252 -// class Vector2D to; // 255 -// float toProj; // 259 -// float latProj; // 260 -// float const c; // 262 -// { -// float ground; // 200 -// Vector aheadRay; // 201 -// bool jumped; // 207 -// NormalizeInPlace(Vector *const this); // 202 -// { -// float const farLookAheadRange; // 210 -// Vector normal; // 211 -// Vector stepAhead; // 212 -// operator*(float fl, -// const Vector &v); // 212 -// GetSimpleGroundHeightWithFloor(CCSBot *const this, -// const Vector *pos, -// float *height, -// Vector *normal); // 215 -// operator+(const Vector *const this, -// const Vector &v); // 212 -// DiscontinuityJump(CCSBot *const this, -// float ground, -// bool onlyJumpDown, -// bool mustJump); // 218 -// } -// { -// float const lookAheadRange; // 225 -// Vector stepAhead; // 226 -// operator*(float fl, -// const Vector &v); // 226 -// operator+(const Vector *const this, -// const Vector &v); // 226 -// GetSimpleGroundHeightWithFloor(CCSBot *const this, -// const Vector *pos, -// float *height, -// Vector *normal); // 228 -// DiscontinuityJump(CCSBot *const this, -// float ground, -// bool onlyJumpDown, -// bool mustJump); // 230 -// } -// { -// float const lookAheadRange; // 237 -// Vector stepAhead; // 238 -// operator*(float fl, -// const Vector &v); // 238 -// operator+(const Vector *const this, -// const Vector &v); // 238 -// GetSimpleGroundHeightWithFloor(CCSBot *const this, -// const Vector *pos, -// float *height, -// Vector *normal); // 240 -// DiscontinuityJump(CCSBot *const this, -// float ground, -// bool onlyJumpDown, -// bool mustJump); // 242 -// } -// } -// NormalizeInPlace(Vector2D *const this); // 256 -// } -} - -/* <37ca96> ../cstrike/dlls/bot/cs_bot_nav.cpp:282 */ -NOBODY void CCSBot::MoveAwayFromPosition(const Vector *pos) -{ -// { -// float angle; // 285 -// class Vector2D dir; // 287 -// class Vector2D lat; // 288 -// class Vector2D to; // 291 -// float toProj; // 295 -// float latProj; // 296 -// float const c; // 298 -// NormalizeInPlace(Vector2D *const this); // 292 -// } -} - -/* <37cb85> ../cstrike/dlls/bot/cs_bot_nav.cpp:314 */ -NOBODY void CCSBot::StrafeAwayFromPosition(const Vector *pos) -{ -// { -// float angle; // 317 -// class Vector2D dir; // 319 -// class Vector2D lat; // 320 -// class Vector2D to; // 323 -// float latProj; // 326 -// NormalizeInPlace(Vector2D *const this); // 324 -// } -} - -/* <37cc52> ../cstrike/dlls/bot/cs_bot_nav.cpp:338 */ -NOBODY void CCSBot::Wiggle(void) -{ -// ResetStuckMonitor(CCSBot *const this); // 342 -} - -/* <37cc94> ../cstrike/dlls/bot/cs_bot_nav.cpp:383 */ -NOBODY void CCSBot::ComputeApproachPoints(void) -{ -// { -// Vector eye; // 391 -// Vector ap; // 393 -// float halfWidth; // 394 -// Vector(Vector *const this, -// const Vector &v); // 391 -// { -// int i; // 395 -// { -// const class ApproachInfo *info; // 397 -// Vector bendPoint; // 415 -// } -// GetApproachInfoCount(const class CNavArea *const this); // 395 -// } -// } -} - -/* <37cd67> ../cstrike/dlls/bot/cs_bot_nav.cpp:422 */ -NOBODY void CCSBot::DrawApproachPoints(void) -{ -// { -// int i; // 427 -// operator+(const Vector *const this, -// const Vector &v); // 428 -// Vector(Vector *const this, -// const Vector &v); // 428 -// } -} - -/* <37ce12> ../cstrike/dlls/bot/cs_bot_nav.cpp:435 */ -NOBODY bool CCSBot::FindApproachPointNearestPath(const Vector *pos) -{ -// { -// Vector target; // 446 -// Vector close; // 446 -// float targetRangeSq; // 447 -// bool found; // 448 -// int start; // 450 -// int end; // 451 -// float const nearPathSq; // 457 -// { -// int i; // 459 -// { -// float rangeSq; // 464 -// operator-(const Vector *const this, -// const Vector &v); // 464 -// LengthSquared(const Vector *const this); // 464 -// } -// } -// operator+(const Vector *const this, -// const Vector &v); // 478 -// } -} +/* <37c448> ../cstrike/dlls/bot/cs_bot_nav.cpp:154 */ +NOBODY bool CCSBot::GetSimpleGroundHeightWithFloor(const Vector *pos, float *height, Vector *normal) +{ +// GetSimpleGroundHeightWithFloor(CCSBot *const this, +// const Vector *pos, +// float *height, +// Vector *normal); // 154 +} + +/* <37c4b8> ../cstrike/dlls/bot/cs_bot_nav.cpp:172 */ +NOBODY Place CCSBot::GetPlace(void) +{ +} + +/* <37c4de> ../cstrike/dlls/bot/cs_bot_nav.cpp:184 */ +NOBODY void CCSBot::MoveTowardsPosition(const Vector *pos) +{ +// { +// float angle; // 249 +// class Vector2D dir; // 251 +// class Vector2D lat; // 252 +// class Vector2D to; // 255 +// float toProj; // 259 +// float latProj; // 260 +// float const c; // 262 +// { +// float ground; // 200 +// Vector aheadRay; // 201 +// bool jumped; // 207 +// NormalizeInPlace(Vector *const this); // 202 +// { +// float const farLookAheadRange; // 210 +// Vector normal; // 211 +// Vector stepAhead; // 212 +// operator*(float fl, +// const Vector &v); // 212 +// GetSimpleGroundHeightWithFloor(CCSBot *const this, +// const Vector *pos, +// float *height, +// Vector *normal); // 215 +// operator+(const Vector *const this, +// const Vector &v); // 212 +// DiscontinuityJump(CCSBot *const this, +// float ground, +// bool onlyJumpDown, +// bool mustJump); // 218 +// } +// { +// float const lookAheadRange; // 225 +// Vector stepAhead; // 226 +// operator*(float fl, +// const Vector &v); // 226 +// operator+(const Vector *const this, +// const Vector &v); // 226 +// GetSimpleGroundHeightWithFloor(CCSBot *const this, +// const Vector *pos, +// float *height, +// Vector *normal); // 228 +// DiscontinuityJump(CCSBot *const this, +// float ground, +// bool onlyJumpDown, +// bool mustJump); // 230 +// } +// { +// float const lookAheadRange; // 237 +// Vector stepAhead; // 238 +// operator*(float fl, +// const Vector &v); // 238 +// operator+(const Vector *const this, +// const Vector &v); // 238 +// GetSimpleGroundHeightWithFloor(CCSBot *const this, +// const Vector *pos, +// float *height, +// Vector *normal); // 240 +// DiscontinuityJump(CCSBot *const this, +// float ground, +// bool onlyJumpDown, +// bool mustJump); // 242 +// } +// } +// NormalizeInPlace(Vector2D *const this); // 256 +// } +} + +/* <37ca96> ../cstrike/dlls/bot/cs_bot_nav.cpp:282 */ +NOBODY void CCSBot::MoveAwayFromPosition(const Vector *pos) +{ +// { +// float angle; // 285 +// class Vector2D dir; // 287 +// class Vector2D lat; // 288 +// class Vector2D to; // 291 +// float toProj; // 295 +// float latProj; // 296 +// float const c; // 298 +// NormalizeInPlace(Vector2D *const this); // 292 +// } +} + +/* <37cb85> ../cstrike/dlls/bot/cs_bot_nav.cpp:314 */ +NOBODY void CCSBot::StrafeAwayFromPosition(const Vector *pos) +{ +// { +// float angle; // 317 +// class Vector2D dir; // 319 +// class Vector2D lat; // 320 +// class Vector2D to; // 323 +// float latProj; // 326 +// NormalizeInPlace(Vector2D *const this); // 324 +// } +} + +/* <37cc52> ../cstrike/dlls/bot/cs_bot_nav.cpp:338 */ +NOBODY void CCSBot::Wiggle(void) +{ +// ResetStuckMonitor(CCSBot *const this); // 342 +} + +/* <37cc94> ../cstrike/dlls/bot/cs_bot_nav.cpp:383 */ +NOBODY void CCSBot::ComputeApproachPoints(void) +{ +// { +// Vector eye; // 391 +// Vector ap; // 393 +// float halfWidth; // 394 +// Vector(Vector *const this, +// const Vector &v); // 391 +// { +// int i; // 395 +// { +// const class ApproachInfo *info; // 397 +// Vector bendPoint; // 415 +// } +// GetApproachInfoCount(const class CNavArea *const this); // 395 +// } +// } +} + +/* <37cd67> ../cstrike/dlls/bot/cs_bot_nav.cpp:422 */ +NOBODY void CCSBot::DrawApproachPoints(void) +{ +// { +// int i; // 427 +// operator+(const Vector *const this, +// const Vector &v); // 428 +// Vector(Vector *const this, +// const Vector &v); // 428 +// } +} + +/* <37ce12> ../cstrike/dlls/bot/cs_bot_nav.cpp:435 */ +NOBODY bool CCSBot::FindApproachPointNearestPath(const Vector *pos) +{ +// { +// Vector target; // 446 +// Vector close; // 446 +// float targetRangeSq; // 447 +// bool found; // 448 +// int start; // 450 +// int end; // 451 +// float const nearPathSq; // 457 +// { +// int i; // 459 +// { +// float rangeSq; // 464 +// operator-(const Vector *const this, +// const Vector &v); // 464 +// LengthSquared(const Vector *const this); // 464 +// } +// } +// operator+(const Vector *const this, +// const Vector &v); // 478 +// } +} diff --git a/regamedll/dlls/bot/cs_bot_update.cpp b/regamedll/dlls/bot/cs_bot_update.cpp index 3b890b7a..0bdac0d9 100644 --- a/regamedll/dlls/bot/cs_bot_update.cpp +++ b/regamedll/dlls/bot/cs_bot_update.cpp @@ -1,338 +1,338 @@ #include "precompiled.h" -/* <3c635f> ../cstrike/dlls/bot/cs_bot_update.cpp:26 */ -void CCSBot::__MAKE_VHOOK(Upkeep)(void) -{ - CCSBotManager *ctrl = TheCSBots(); - - if (ctrl->IsLearningMap() || !IsAlive()) - return; - - if (m_isRapidFiring) - TogglePrimaryAttack(); - - if (IsAimingAtEnemy()) - { - UpdateAimOffset(); - - if (m_enemy != NULL) - { - float feetOffset = pev->origin.z - GetFeetZ(); - - if (IsEnemyVisible()) - { - if (GetProfile()->GetSkill() > 0.5f) - { - const float k = 3.0f; - m_aimSpot = (m_enemy->pev->velocity - pev->velocity) * g_flBotCommandInterval * k + m_enemy->pev->origin; - } - else - m_aimSpot = m_enemy->pev->origin; - - bool aimBlocked = false; - - if (IsUsingAWP() || IsUsingShotgun() || IsUsingMachinegun() || GetProfile()->GetSkill() < 0.8f - || (IsActiveWeaponRecoilHigh() && !IsUsingPistol() && !IsUsingSniperRifle())) - { - if (IsEnemyPartVisible(CHEST)) - { - // No headshots in this game, go for the chest. - aimBlocked = true; - } - } - - if (aimBlocked) - m_aimSpot.z -= feetOffset * 0.25f; - - else if (!IsEnemyPartVisible(HEAD)) - { - if (IsEnemyPartVisible(CHEST)) - { - m_aimSpot.z -= feetOffset * 0.5f; - } - else if (IsEnemyPartVisible(LEFT_SIDE)) - { - Vector2D to = (m_enemy->pev->origin - pev->origin).Make2D(); - to.NormalizeInPlace(); - - m_aimSpot.x -= to.y * 16.0f; - m_aimSpot.y += to.x * 16.0f; - m_aimSpot.z -= feetOffset * 0.5f; - } - else if (IsEnemyPartVisible(RIGHT_SIDE)) - { - Vector2D to = (m_enemy->pev->origin - pev->origin).Make2D(); - to.NormalizeInPlace(); - - m_aimSpot.x += to.y * 16.0f; - m_aimSpot.y -= to.x * 16.0f; - m_aimSpot.z -= feetOffset * 0.5f; - } - else // FEET - m_aimSpot.z -= (feetOffset + feetOffset); - } - } - else - m_aimSpot = m_lastEnemyPosition; - - // add in aim error - m_aimSpot.x += m_aimOffset.x; - m_aimSpot.y += m_aimOffset.y; - m_aimSpot.z += m_aimOffset.z; - - Vector toEnemy = m_aimSpot - pev->origin; - Vector idealAngle = UTIL_VecToAngles(toEnemy); - - idealAngle.x = 360.0 - idealAngle.x; - SetLookAngles(idealAngle.y, idealAngle.x); - } - } - else - { - if (m_lookAtSpotClearIfClose) - { - // dont look at spots just in front of our face - it causes erratic view rotation - const float tooCloseRange = 100.0f; - if ((m_lookAtSpot - pev->origin).IsLengthLessThan(tooCloseRange)) - m_lookAtSpotState = NOT_LOOKING_AT_SPOT; - } - - switch (m_lookAtSpotState) - { - case NOT_LOOKING_AT_SPOT: - { - // look ahead - SetLookAngles(m_lookAheadAngle, 0); - break; - } - case LOOK_TOWARDS_SPOT: - { - UpdateLookAt(); - - if (IsLookingAtPosition(&m_lookAtSpot, m_lookAtSpotAngleTolerance)) - { - m_lookAtSpotState = LOOK_AT_SPOT; - m_lookAtSpotTimestamp = gpGlobals->time; - } - break; - } - case LOOK_AT_SPOT: - { - UpdateLookAt(); - - if (m_lookAtSpotDuration >= 0.0f && gpGlobals->time - m_lookAtSpotTimestamp > m_lookAtSpotDuration) - { - m_lookAtSpotState = NOT_LOOKING_AT_SPOT; - m_lookAtSpotDuration = 0.0f; - } - break; - } - } - - float driftAmplitude = 2.0f; - const float sharpshooter = 0.5f; - - // have view "drift" very slowly, so view looks "alive" - if (IsUsingSniperRifle() && IsUsingScope()) - driftAmplitude = sharpshooter; - - m_lookYaw += driftAmplitude * BotCOS(33.0f * gpGlobals->time); - m_lookPitch += driftAmplitude * BotSIN(13.0f * gpGlobals->time); - } - - // view angles can change quickly - UpdateLookAngles(); -} +/* <3c635f> ../cstrike/dlls/bot/cs_bot_update.cpp:26 */ +void CCSBot::__MAKE_VHOOK(Upkeep)(void) +{ + CCSBotManager *ctrl = TheCSBots(); + + if (ctrl->IsLearningMap() || !IsAlive()) + return; + + if (m_isRapidFiring) + TogglePrimaryAttack(); + + if (IsAimingAtEnemy()) + { + UpdateAimOffset(); + + if (m_enemy != NULL) + { + float feetOffset = pev->origin.z - GetFeetZ(); + + if (IsEnemyVisible()) + { + if (GetProfile()->GetSkill() > 0.5f) + { + const float k = 3.0f; + m_aimSpot = (m_enemy->pev->velocity - pev->velocity) * g_flBotCommandInterval * k + m_enemy->pev->origin; + } + else + m_aimSpot = m_enemy->pev->origin; + + bool aimBlocked = false; + + if (IsUsingAWP() || IsUsingShotgun() || IsUsingMachinegun() || GetProfile()->GetSkill() < 0.8f + || (IsActiveWeaponRecoilHigh() && !IsUsingPistol() && !IsUsingSniperRifle())) + { + if (IsEnemyPartVisible(CHEST)) + { + // No headshots in this game, go for the chest. + aimBlocked = true; + } + } + + if (aimBlocked) + m_aimSpot.z -= feetOffset * 0.25f; + + else if (!IsEnemyPartVisible(HEAD)) + { + if (IsEnemyPartVisible(CHEST)) + { + m_aimSpot.z -= feetOffset * 0.5f; + } + else if (IsEnemyPartVisible(LEFT_SIDE)) + { + Vector2D to = (m_enemy->pev->origin - pev->origin).Make2D(); + to.NormalizeInPlace(); + + m_aimSpot.x -= to.y * 16.0f; + m_aimSpot.y += to.x * 16.0f; + m_aimSpot.z -= feetOffset * 0.5f; + } + else if (IsEnemyPartVisible(RIGHT_SIDE)) + { + Vector2D to = (m_enemy->pev->origin - pev->origin).Make2D(); + to.NormalizeInPlace(); + + m_aimSpot.x += to.y * 16.0f; + m_aimSpot.y -= to.x * 16.0f; + m_aimSpot.z -= feetOffset * 0.5f; + } + else // FEET + m_aimSpot.z -= (feetOffset + feetOffset); + } + } + else + m_aimSpot = m_lastEnemyPosition; + + // add in aim error + m_aimSpot.x += m_aimOffset.x; + m_aimSpot.y += m_aimOffset.y; + m_aimSpot.z += m_aimOffset.z; + + Vector toEnemy = m_aimSpot - pev->origin; + Vector idealAngle = UTIL_VecToAngles(toEnemy); + + idealAngle.x = 360.0 - idealAngle.x; + SetLookAngles(idealAngle.y, idealAngle.x); + } + } + else + { + if (m_lookAtSpotClearIfClose) + { + // dont look at spots just in front of our face - it causes erratic view rotation + const float tooCloseRange = 100.0f; + if ((m_lookAtSpot - pev->origin).IsLengthLessThan(tooCloseRange)) + m_lookAtSpotState = NOT_LOOKING_AT_SPOT; + } + + switch (m_lookAtSpotState) + { + case NOT_LOOKING_AT_SPOT: + { + // look ahead + SetLookAngles(m_lookAheadAngle, 0); + break; + } + case LOOK_TOWARDS_SPOT: + { + UpdateLookAt(); + + if (IsLookingAtPosition(&m_lookAtSpot, m_lookAtSpotAngleTolerance)) + { + m_lookAtSpotState = LOOK_AT_SPOT; + m_lookAtSpotTimestamp = gpGlobals->time; + } + break; + } + case LOOK_AT_SPOT: + { + UpdateLookAt(); + + if (m_lookAtSpotDuration >= 0.0f && gpGlobals->time - m_lookAtSpotTimestamp > m_lookAtSpotDuration) + { + m_lookAtSpotState = NOT_LOOKING_AT_SPOT; + m_lookAtSpotDuration = 0.0f; + } + break; + } + } + + float driftAmplitude = 2.0f; + const float sharpshooter = 0.5f; + + // have view "drift" very slowly, so view looks "alive" + if (IsUsingSniperRifle() && IsUsingScope()) + driftAmplitude = sharpshooter; + + m_lookYaw += driftAmplitude * BotCOS(33.0f * gpGlobals->time); + m_lookPitch += driftAmplitude * BotSIN(13.0f * gpGlobals->time); + } + + // view angles can change quickly + UpdateLookAngles(); +} void (*pCCSBot__Update)(void); -/* <3c6e1e> ../cstrike/dlls/bot/cs_bot_update.cpp:208 */ -void __declspec(naked) CCSBot::__MAKE_VHOOK(Update)(void) -{ - __asm - { - jmp pCCSBot__Update - } -// { -// class CCSBotManager *ctrl; // 210 -// float const rememberNoiseDuration; // 401 -// float const recomputeApproachPointTolerance; // 419 -// class CBasePlayer *threat; // 459 -// float const seenRecentTime; // 572 -// float const safeRearmTime; // 676 -// float const avoidTime; // 691 -// float const earliestAutoFollowTime; // 807 -// float const minAutoFollowTeamwork; // 808 -// { -// Vector vecAiming; // 342 -// Vector vecSrc; // 344 -// operator+(const Vector *const this, -// const Vector &v); // 341 -// operator+(const Vector *const this, -// const Vector &v); // 349 -// operator*(float fl, -// const Vector &v); // 349 -// operator+(const Vector *const this, -// const Vector &v); // 351 -// operator*(float fl, -// const Vector &v); // 351 -// Vector(Vector *const this, -// const Vector &v); // 351 -// Vector(Vector *const this, -// const Vector &v); // 349 -// } -// { -// Vector dir; // 366 -// float length; // 367 -// const class SpotOrder *order; // 369 -// Vector along; // 370 -// Vector(Vector *const this, -// const Vector &v); // 364 -// Vector(Vector *const this, -// const Vector &v); // 364 -// operator-(const Vector *const this, -// const Vector &v); // 366 -// NormalizeInPlace(Vector *const this); // 367 -// { -// const_iterator iter; // 371 -// end(list> *const this); // 371 -// operator*(float fl, -// const Vector &v); // 375 -// operator+(const Vector *const this, -// const Vector &v); // 375 -// Vector(Vector *const this, -// const Vector &v); // 377 -// Vector(Vector *const this, -// const Vector &v); // 377 -// operator++(_List_const_iterator *const this); // 371 -// } -// } -// { -// Vector from; // 385 -// float const size; // 387 -// Vector arrow; // 389 -// GetEyePosition(const class CCSBot *const this); // 385 -// operator+(const Vector *const this, -// const Vector &v); // 391 -// Vector(Vector *const this, -// const Vector &v); // 391 -// } -// ForgetNoise(CCSBot *const this); // 403 -// SetClearedTimestamp(CNavArea *const this, -// int teamID); // 415 -// operator-(const Vector *const this, -// const Vector &v); // 420 -// IsLengthGreaterThan(const Vector *const this, -// float length); // 420 -// AckAnalysisRequest(CCSBotManager *const this); // 215 -// { -// float const selfDefenseRange; // 465 -// { -// float const knifeAttackRange; // 490 -// operator-(const Vector *const this, -// const Vector &v); // 491 -// IsLengthLessThan(const Vector *const this, -// float length); // 491 -// } -// GetEnemy(CCSBot *const this); // 485 -// operator-(const Vector *const this, -// const Vector &v); // 483 -// IsLengthLessThan(const Vector *const this, -// float length); // 483 -// { -// float const recentAttackDuration; // 512 -// GetTimeSinceAttacked(const class CCSBot *const this); // 513 -// } -// SetLastSeenEnemyTimestamp(CCSBotManager *const this); // 522 -// } -// IsAwareOfEnemyDeath(const class CCSBot *const this); // 530 -// GetTimeSinceLastSawEnemy(const class CCSBot *const this); // 573 -// { -// Vector target; // 591 -// } -// { -// bool doToss; // 601 -// IsElapsed(const class CountdownTimer *const this); // 605 -// } -// IsActiveWeaponReloading(const class CBot *const this); // 677 -// { -// float const duration; // 704 -// float crouchDelayTime; // 705 -// float standUpTime; // 706 -// float elapsed; // 708 -// } -// { -// unsigned char status; // 784 -// HostageWasTaken(CSGameState *const this); // 793 -// } -// { -// float gonnaBlowTime; // 755 -// } -// GetElapsedRoundTime(const class CCSBotManager *const this); // 809 -// { -// class CBasePlayer *leader; // 820 -// GetClosestVisibleHumanFriend(const class CCSBot *const this); // 820 -// IsAutoFollowAllowed(const class CBasePlayer *const this); // 821 -// { -// float const maxFollowCount; // 824 -// { -// float const autoFollowRange; // 827 -// operator-(const Vector *const this, -// const Vector &v); // 828 -// IsLengthLessThan(const Vector *const this, -// float length); // 828 -// { -// class CNavArea *leaderArea; // 830 -// { -// class PathCost pc; // 833 -// float travelRange; // 834 -// PathCost(PathCost *const this, -// class CCSBot *bot, -// enum RouteType route); // 833 -// NavAreaTravelDistance(CNavArea *startArea, -// class CNavArea *endArea, -// class PathCost &costFunc); // 834 -// } -// } -// } -// } -// } -// { -// class CBaseEntity *leader; // 865 -// float const highTeamwork; // 872 -// { -// float minFollowDuration; // 875 -// GetFollowDuration(const class CCSBot *const this); // 876 -// } -// } -// { -// float const campChance; // 890 -// } -// IsReloading(CBasePlayer *const this); // 920 -// IsElapsed(const class CountdownTimer *const this); // 927 -// { -// float const waitForHostageRange; // 929 -// Start(CountdownTimer *const this, -// float duration); // 936 -// IsElapsed(const class CountdownTimer *const this); // 941 -// Start(CountdownTimer *const this, -// float duration); // 945 -// } -// GetLooseBomb(CCSBotManager *const this); // 743 -// GetBomber(CCSBot *const this); // 740 -// GetTimeSinceLastSawEnemy(const class CCSBot *const this); // 678 -// } +/* <3c6e1e> ../cstrike/dlls/bot/cs_bot_update.cpp:208 */ +void __declspec(naked) CCSBot::__MAKE_VHOOK(Update)(void) +{ + __asm + { + jmp pCCSBot__Update + } +// { +// class CCSBotManager *ctrl; // 210 +// float const rememberNoiseDuration; // 401 +// float const recomputeApproachPointTolerance; // 419 +// class CBasePlayer *threat; // 459 +// float const seenRecentTime; // 572 +// float const safeRearmTime; // 676 +// float const avoidTime; // 691 +// float const earliestAutoFollowTime; // 807 +// float const minAutoFollowTeamwork; // 808 +// { +// Vector vecAiming; // 342 +// Vector vecSrc; // 344 +// operator+(const Vector *const this, +// const Vector &v); // 341 +// operator+(const Vector *const this, +// const Vector &v); // 349 +// operator*(float fl, +// const Vector &v); // 349 +// operator+(const Vector *const this, +// const Vector &v); // 351 +// operator*(float fl, +// const Vector &v); // 351 +// Vector(Vector *const this, +// const Vector &v); // 351 +// Vector(Vector *const this, +// const Vector &v); // 349 +// } +// { +// Vector dir; // 366 +// float length; // 367 +// const class SpotOrder *order; // 369 +// Vector along; // 370 +// Vector(Vector *const this, +// const Vector &v); // 364 +// Vector(Vector *const this, +// const Vector &v); // 364 +// operator-(const Vector *const this, +// const Vector &v); // 366 +// NormalizeInPlace(Vector *const this); // 367 +// { +// const_iterator iter; // 371 +// end(list> *const this); // 371 +// operator*(float fl, +// const Vector &v); // 375 +// operator+(const Vector *const this, +// const Vector &v); // 375 +// Vector(Vector *const this, +// const Vector &v); // 377 +// Vector(Vector *const this, +// const Vector &v); // 377 +// operator++(_List_const_iterator *const this); // 371 +// } +// } +// { +// Vector from; // 385 +// float const size; // 387 +// Vector arrow; // 389 +// GetEyePosition(const class CCSBot *const this); // 385 +// operator+(const Vector *const this, +// const Vector &v); // 391 +// Vector(Vector *const this, +// const Vector &v); // 391 +// } +// ForgetNoise(CCSBot *const this); // 403 +// SetClearedTimestamp(CNavArea *const this, +// int teamID); // 415 +// operator-(const Vector *const this, +// const Vector &v); // 420 +// IsLengthGreaterThan(const Vector *const this, +// float length); // 420 +// AckAnalysisRequest(CCSBotManager *const this); // 215 +// { +// float const selfDefenseRange; // 465 +// { +// float const knifeAttackRange; // 490 +// operator-(const Vector *const this, +// const Vector &v); // 491 +// IsLengthLessThan(const Vector *const this, +// float length); // 491 +// } +// GetEnemy(CCSBot *const this); // 485 +// operator-(const Vector *const this, +// const Vector &v); // 483 +// IsLengthLessThan(const Vector *const this, +// float length); // 483 +// { +// float const recentAttackDuration; // 512 +// GetTimeSinceAttacked(const class CCSBot *const this); // 513 +// } +// SetLastSeenEnemyTimestamp(CCSBotManager *const this); // 522 +// } +// IsAwareOfEnemyDeath(const class CCSBot *const this); // 530 +// GetTimeSinceLastSawEnemy(const class CCSBot *const this); // 573 +// { +// Vector target; // 591 +// } +// { +// bool doToss; // 601 +// IsElapsed(const class CountdownTimer *const this); // 605 +// } +// IsActiveWeaponReloading(const class CBot *const this); // 677 +// { +// float const duration; // 704 +// float crouchDelayTime; // 705 +// float standUpTime; // 706 +// float elapsed; // 708 +// } +// { +// unsigned char status; // 784 +// HostageWasTaken(CSGameState *const this); // 793 +// } +// { +// float gonnaBlowTime; // 755 +// } +// GetElapsedRoundTime(const class CCSBotManager *const this); // 809 +// { +// class CBasePlayer *leader; // 820 +// GetClosestVisibleHumanFriend(const class CCSBot *const this); // 820 +// IsAutoFollowAllowed(const class CBasePlayer *const this); // 821 +// { +// float const maxFollowCount; // 824 +// { +// float const autoFollowRange; // 827 +// operator-(const Vector *const this, +// const Vector &v); // 828 +// IsLengthLessThan(const Vector *const this, +// float length); // 828 +// { +// class CNavArea *leaderArea; // 830 +// { +// class PathCost pc; // 833 +// float travelRange; // 834 +// PathCost(PathCost *const this, +// class CCSBot *bot, +// enum RouteType route); // 833 +// NavAreaTravelDistance(CNavArea *startArea, +// class CNavArea *endArea, +// class PathCost &costFunc); // 834 +// } +// } +// } +// } +// } +// { +// class CBaseEntity *leader; // 865 +// float const highTeamwork; // 872 +// { +// float minFollowDuration; // 875 +// GetFollowDuration(const class CCSBot *const this); // 876 +// } +// } +// { +// float const campChance; // 890 +// } +// IsReloading(CBasePlayer *const this); // 920 +// IsElapsed(const class CountdownTimer *const this); // 927 +// { +// float const waitForHostageRange; // 929 +// Start(CountdownTimer *const this, +// float duration); // 936 +// IsElapsed(const class CountdownTimer *const this); // 941 +// Start(CountdownTimer *const this, +// float duration); // 945 +// } +// GetLooseBomb(CCSBotManager *const this); // 743 +// GetBomber(CCSBot *const this); // 740 +// GetTimeSinceLastSawEnemy(const class CCSBot *const this); // 678 +// } } #ifdef HOOK_GAMEDLL -void CCSBot::Upkeep(void) -{ - Upkeep_(); -} -void CCSBot::Update(void) -{ - Update_(); +void CCSBot::Upkeep(void) +{ + Upkeep_(); +} +void CCSBot::Update(void) +{ + Update_(); } #endif // HOOK_GAMEDLL diff --git a/regamedll/dlls/bot/cs_bot_weapon.cpp b/regamedll/dlls/bot/cs_bot_weapon.cpp index 15432d50..4f0d0e85 100644 --- a/regamedll/dlls/bot/cs_bot_weapon.cpp +++ b/regamedll/dlls/bot/cs_bot_weapon.cpp @@ -181,9 +181,9 @@ NOBODY bool CCSBot::IsSniper(void) /* <3ea4c1> ../cstrike/dlls/bot/cs_bot_weapon.cpp:405 */ bool CCSBot::IsSniping(void) const { - if (GetTask() == MOVE_TO_SNIPER_SPOT || GetTask() == SNIPING) - return true; - + if (GetTask() == MOVE_TO_SNIPER_SPOT || GetTask() == SNIPING) + return true; + return false; } diff --git a/regamedll/dlls/bot/states/cs_bot_attack.cpp b/regamedll/dlls/bot/states/cs_bot_attack.cpp index 62750e4b..21297bcc 100644 --- a/regamedll/dlls/bot/states/cs_bot_attack.cpp +++ b/regamedll/dlls/bot/states/cs_bot_attack.cpp @@ -33,12 +33,12 @@ NOBODY void AttackState::StopAttacking(CCSBot *me) { if (me->m_task == CCSBot::SNIPING) { - // stay in our hiding spot + // stay in our hiding spot me->Hide(me->GetLastKnownArea(), -1.0f, 50.0f); } - else - { - me->StopAttacking(); + else + { + me->StopAttacking(); } } diff --git a/regamedll/dlls/buttons.cpp b/regamedll/dlls/buttons.cpp index 32d001e1..eb9b06c4 100644 --- a/regamedll/dlls/buttons.cpp +++ b/regamedll/dlls/buttons.cpp @@ -52,11 +52,11 @@ TYPEDESCRIPTION CEnvSpark::m_SaveData[] = #else -TYPEDESCRIPTION IMPLEMENT_ARRAY_CLASS(CEnvGlobal, m_SaveData)[3]; -TYPEDESCRIPTION IMPLEMENT_ARRAY_CLASS(CMultiSource, m_SaveData)[4]; -TYPEDESCRIPTION IMPLEMENT_ARRAY_CLASS(CBaseButton, m_SaveData)[8]; -TYPEDESCRIPTION IMPLEMENT_ARRAY_CLASS(CMomentaryRotButton, m_SaveData)[6]; -TYPEDESCRIPTION IMPLEMENT_ARRAY_CLASS(CEnvSpark, m_SaveData)[1]; +TYPEDESCRIPTION IMPL_CLASS(CEnvGlobal, m_SaveData)[3]; +TYPEDESCRIPTION IMPL_CLASS(CMultiSource, m_SaveData)[4]; +TYPEDESCRIPTION IMPL_CLASS(CBaseButton, m_SaveData)[8]; +TYPEDESCRIPTION IMPL_CLASS(CMomentaryRotButton, m_SaveData)[6]; +TYPEDESCRIPTION IMPL_CLASS(CEnvSpark, m_SaveData)[1]; #endif // HOOK_GAMEDLL @@ -333,29 +333,29 @@ void CBaseButton::__MAKE_VHOOK(Precache)(void) // get sentence group names, for doors which are directly 'touched' to open switch (m_bLockedSentence) { - case 1: m_ls.sLockedSentence = MAKE_STRING("NA"); break; // access denied - case 2: m_ls.sLockedSentence = MAKE_STRING("ND"); break; // security lockout - case 3: m_ls.sLockedSentence = MAKE_STRING("NF"); break; // blast door - case 4: m_ls.sLockedSentence = MAKE_STRING("NFIRE"); break; // fire door - case 5: m_ls.sLockedSentence = MAKE_STRING("NCHEM"); break; // chemical door - case 6: m_ls.sLockedSentence = MAKE_STRING("NRAD"); break; // radiation door - case 7: m_ls.sLockedSentence = MAKE_STRING("NCON"); break; // gen containment - case 8: m_ls.sLockedSentence = MAKE_STRING("NH"); break; // maintenance door - case 9: m_ls.sLockedSentence = MAKE_STRING("NG"); break; // broken door - default: m_ls.sLockedSentence = 0; break; + case 1: m_ls.sLockedSentence = MAKE_STRING("NA"); break; // access denied + case 2: m_ls.sLockedSentence = MAKE_STRING("ND"); break; // security lockout + case 3: m_ls.sLockedSentence = MAKE_STRING("NF"); break; // blast door + case 4: m_ls.sLockedSentence = MAKE_STRING("NFIRE"); break; // fire door + case 5: m_ls.sLockedSentence = MAKE_STRING("NCHEM"); break; // chemical door + case 6: m_ls.sLockedSentence = MAKE_STRING("NRAD"); break; // radiation door + case 7: m_ls.sLockedSentence = MAKE_STRING("NCON"); break; // gen containment + case 8: m_ls.sLockedSentence = MAKE_STRING("NH"); break; // maintenance door + case 9: m_ls.sLockedSentence = MAKE_STRING("NG"); break; // broken door + default: m_ls.sLockedSentence = 0; break; } switch (m_bUnlockedSentence) { - case 1: m_ls.sUnlockedSentence = MAKE_STRING("EA"); break; // access granted - case 2: m_ls.sUnlockedSentence = MAKE_STRING("ED"); break; // security door - case 3: m_ls.sUnlockedSentence = MAKE_STRING("EF"); break; // blast door - case 4: m_ls.sUnlockedSentence = MAKE_STRING("EFIRE"); break; // fire door - case 5: m_ls.sUnlockedSentence = MAKE_STRING("ECHEM"); break; // chemical door - case 6: m_ls.sUnlockedSentence = MAKE_STRING("ERAD"); break; // radiation door - case 7: m_ls.sUnlockedSentence = MAKE_STRING("ECON"); break; // gen containment - case 8: m_ls.sUnlockedSentence = MAKE_STRING("EH"); break; // maintenance door - default: m_ls.sUnlockedSentence = 0; break; + case 1: m_ls.sUnlockedSentence = MAKE_STRING("EA"); break; // access granted + case 2: m_ls.sUnlockedSentence = MAKE_STRING("ED"); break; // security door + case 3: m_ls.sUnlockedSentence = MAKE_STRING("EF"); break; // blast door + case 4: m_ls.sUnlockedSentence = MAKE_STRING("EFIRE"); break; // fire door + case 5: m_ls.sUnlockedSentence = MAKE_STRING("ECHEM"); break; // chemical door + case 6: m_ls.sUnlockedSentence = MAKE_STRING("ERAD"); break; // radiation door + case 7: m_ls.sUnlockedSentence = MAKE_STRING("ECON"); break; // gen containment + case 8: m_ls.sUnlockedSentence = MAKE_STRING("EH"); break; // maintenance door + default: m_ls.sUnlockedSentence = 0; break; } } diff --git a/regamedll/dlls/buttons.h b/regamedll/dlls/buttons.h index a102a326..488a9adf 100644 --- a/regamedll/dlls/buttons.h +++ b/regamedll/dlls/buttons.h @@ -32,26 +32,26 @@ #pragma once #endif -#define SF_BUTTON_DONTMOVE 1 -#define SF_ROTBUTTON_NOTSOLID 1 -#define SF_BUTTON_TOGGLE 32 // button stays pushed until reactivated -#define SF_BUTTON_SPARK_IF_OFF 64 // button sparks in OFF state -#define SF_BUTTON_TOUCH_ONLY 256 // button only fires as a result of USE key. - +#define SF_BUTTON_DONTMOVE 1 +#define SF_ROTBUTTON_NOTSOLID 1 +#define SF_BUTTON_TOGGLE 32 // button stays pushed until reactivated +#define SF_BUTTON_SPARK_IF_OFF 64 // button sparks in OFF state +#define SF_BUTTON_TOUCH_ONLY 256 // button only fires as a result of USE key. + #define SF_GLOBAL_SET 1 // Set global state to initial state on spawn -#define SF_MULTI_INIT 1 - -// Make this button behave like a door (HACKHACK) -// This will disable use and make the button solid -// rotating buttons were made SOLID_NOT by default since their were some -// collision problems with them... +#define SF_MULTI_INIT 1 + +// Make this button behave like a door (HACKHACK) +// This will disable use and make the button solid +// rotating buttons were made SOLID_NOT by default since their were some +// collision problems with them... #define SF_MOMENTARY_DOOR 0x0001 #define SF_SPARK_TOOGLE 32 -#define SF_SPARK_IF_OFF 64 - -#define SF_BTARGET_USE 0x0001 +#define SF_SPARK_IF_OFF 64 + +#define SF_BTARGET_USE 0x0001 #define SF_BTARGET_ON 0x0002 /* <249a3> ../cstrike/dlls/buttons.cpp:38 */ @@ -75,7 +75,7 @@ public: #endif // HOOK_GAMEDLL public: - static TYPEDESCRIPTION IMPLEMENT_ARRAY(m_SaveData)[3]; + static TYPEDESCRIPTION IMPL(m_SaveData)[3]; public: string_t m_globalstate; @@ -84,7 +84,7 @@ public: };/* size: 164, cachelines: 3, members: 5 */ -/* <24b67> ../cstrike/dlls/buttons.cpp:800 */ +/* <24b67> ../cstrike/dlls/buttons.cpp:800 */ class CRotButton: public CBaseButton { public: @@ -108,13 +108,13 @@ public: virtual int Restore(CRestore &restore); virtual int ObjectCaps(void) { - int flags = CBaseToggle::ObjectCaps() & (~FCAP_ACROSS_TRANSITION); - - if (pev->spawnflags & SF_MOMENTARY_DOOR) - { - return flags; - } - + int flags = CBaseToggle::ObjectCaps() & (~FCAP_ACROSS_TRANSITION); + + if (pev->spawnflags & SF_MOMENTARY_DOOR) + { + return flags; + } + return (flags | FCAP_CONTINUOUS_USE); } virtual void Use(CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value); @@ -144,7 +144,7 @@ public: } public: - static TYPEDESCRIPTION IMPLEMENT_ARRAY(m_SaveData)[6]; + static TYPEDESCRIPTION IMPL(m_SaveData)[6]; public: int m_lastUsed; @@ -182,7 +182,7 @@ public: void EXPORT SparkStop(CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value); public: - static TYPEDESCRIPTION IMPLEMENT_ARRAY(m_SaveData)[1]; + static TYPEDESCRIPTION IMPL(m_SaveData)[1]; public: float m_flDelay; @@ -215,13 +215,13 @@ void DoSpark(entvars_t *pev, const Vector &location); #ifdef HOOK_GAMEDLL // linked objects -C_DLLEXPORT void env_global(entvars_t *pev); -C_DLLEXPORT void multisource(entvars_t *pev); -C_DLLEXPORT void func_button(entvars_t *pev); -C_DLLEXPORT void func_rot_button(entvars_t *pev); -C_DLLEXPORT void momentary_rot_button(entvars_t *pev); -C_DLLEXPORT void env_spark(entvars_t *pev); -C_DLLEXPORT void env_debris(entvars_t *pev); +C_DLLEXPORT void env_global(entvars_t *pev); +C_DLLEXPORT void multisource(entvars_t *pev); +C_DLLEXPORT void func_button(entvars_t *pev); +C_DLLEXPORT void func_rot_button(entvars_t *pev); +C_DLLEXPORT void momentary_rot_button(entvars_t *pev); +C_DLLEXPORT void env_spark(entvars_t *pev); +C_DLLEXPORT void env_debris(entvars_t *pev); C_DLLEXPORT void button_target(entvars_t *pev); #endif // HOOK_GAMEDLL diff --git a/regamedll/dlls/career_tasks.h b/regamedll/dlls/career_tasks.h index 9b50dc16..02605d5a 100644 --- a/regamedll/dlls/career_tasks.h +++ b/regamedll/dlls/career_tasks.h @@ -56,7 +56,6 @@ public: #endif // HOOK_GAMEDLL public: - static CCareerTask *NewTask(const char *taskName, GameEventType event, const char *weaponName, int n, bool mustLive, bool crossRounds, int id, bool isComplete); void OnWeaponKill(int weaponId, int weaponClassId, bool headshot, bool killerHasShield, CBasePlayer *pAttacker, CBasePlayer *pVictim); @@ -167,44 +166,44 @@ private: bool m_shouldLatchRoundEndMessage; };/* size: 36, cachelines: 1, members: 8 */ - -typedef CCareerTask *(*TaskFactoryFunction)(const char *taskName, GameEventType event, const char *weaponName, int eventCount, bool mustLive, bool crossRounds, int nextId, bool isComplete); - -struct TaskInfo -{ - const char *taskName; - GameEventType event; - TaskFactoryFunction factory; + +typedef CCareerTask *(*TaskFactoryFunction)(const char *taskName, GameEventType event, const char *weaponName, int eventCount, bool mustLive, bool crossRounds, int nextId, bool isComplete); + +struct TaskInfo +{ + const char *taskName; + GameEventType event; + TaskFactoryFunction factory; };/* size: 12, cachelines: 1, members: 3 */ /* <1ef56d> ../cstrike/dlls/career_tasks.cpp:139 */ -class CPreventDefuseTask: public CCareerTask -{ -public: - CPreventDefuseTask(const char *taskName, GameEventType event, const char *weaponName, int n, bool mustLive, bool crossRounds, int id, bool isComplete); -public: - virtual void OnEvent(GameEventType event, CBasePlayer *pAttacker, CBasePlayer *pVictim); - virtual void Reset(void); - virtual bool IsTaskCompletableThisRound(void) - { - return m_bombPlantedThisRound && !m_defuseStartedThisRound; - } - -#ifdef HOOK_GAMEDLL - - void OnEvent_(GameEventType event, CBasePlayer *pAttacker, CBasePlayer *pVictim); - void Reset_(void); - -#endif // HOOK_GAMEDLL - -public: - static CCareerTask *NewTask(const char *taskName, GameEventType event, const char *weaponName, int n, bool mustLive, bool crossRounds, int id, bool isComplete); - -protected: - bool m_bombPlantedThisRound; - bool m_defuseStartedThisRound; - +class CPreventDefuseTask: public CCareerTask +{ +public: + CPreventDefuseTask(const char *taskName, GameEventType event, const char *weaponName, int n, bool mustLive, bool crossRounds, int id, bool isComplete); +public: + virtual void OnEvent(GameEventType event, CBasePlayer *pAttacker, CBasePlayer *pVictim); + virtual void Reset(void); + virtual bool IsTaskCompletableThisRound(void) + { + return m_bombPlantedThisRound && !m_defuseStartedThisRound; + } + +#ifdef HOOK_GAMEDLL + + void OnEvent_(GameEventType event, CBasePlayer *pAttacker, CBasePlayer *pVictim); + void Reset_(void); + +#endif // HOOK_GAMEDLL + +public: + static CCareerTask *NewTask(const char *taskName, GameEventType event, const char *weaponName, int n, bool mustLive, bool crossRounds, int id, bool isComplete); + +protected: + bool m_bombPlantedThisRound; + bool m_defuseStartedThisRound; + };/* size: 48, cachelines: 1, members: 3 */ #ifdef HOOK_GAMEDLL diff --git a/regamedll/dlls/cbase.cpp b/regamedll/dlls/cbase.cpp index 39f2417c..08719c8f 100644 --- a/regamedll/dlls/cbase.cpp +++ b/regamedll/dlls/cbase.cpp @@ -7,61 +7,61 @@ static DLL_FUNCTIONS gFunctionTable = { - GameDLLInit, - DispatchSpawn, - DispatchThink, - DispatchUse, - DispatchTouch, - DispatchBlocked, - DispatchKeyValue, - DispatchSave, - DispatchRestore, - DispatchObjectCollsionBox, - SaveWriteFields, - SaveReadFields, - SaveGlobalState, - RestoreGlobalState, - ResetGlobalState, - ClientConnect, - ClientDisconnect, - ClientKill, - ClientPutInServer, - ClientCommand, - ClientUserInfoChanged, - ServerActivate, - ServerDeactivate, - PlayerPreThink, - PlayerPostThink, - StartFrame, - ParmsNewLevel, - ParmsChangeLevel, - GetGameDescription, - PlayerCustomization, - SpectatorConnect, - SpectatorDisconnect, - SpectatorThink, - Sys_Error, - PM_Move, - PM_Init, - PM_FindTextureType, - SetupVisibility, - UpdateClientData, - AddToFullPack, - CreateBaseline, - RegisterEncoders, - GetWeaponData, - CmdStart, - CmdEnd, - ConnectionlessPacket, - GetHullBounds, - CreateInstancedBaselines, - InconsistentFile, - AllowLagCompensation + &GameDLLInit, + &DispatchSpawn, + &DispatchThink, + &DispatchUse, + &DispatchTouch, + &DispatchBlocked, + &DispatchKeyValue, + &DispatchSave, + &DispatchRestore, + &DispatchObjectCollsionBox, + &SaveWriteFields, + &SaveReadFields, + &SaveGlobalState, + &RestoreGlobalState, + &ResetGlobalState, + &ClientConnect, + &ClientDisconnect, + &ClientKill, + &ClientPutInServer, + &ClientCommand, + &ClientUserInfoChanged, + &ServerActivate, + &ServerDeactivate, + &PlayerPreThink, + &PlayerPostThink, + &StartFrame, + &ParmsNewLevel, + &ParmsChangeLevel, + &GetGameDescription, + &PlayerCustomization, + &SpectatorConnect, + &SpectatorDisconnect, + &SpectatorThink, + &Sys_Error, + &PM_Move, + &PM_Init, + &PM_FindTextureType, + &SetupVisibility, + &UpdateClientData, + &AddToFullPack, + &CreateBaseline, + &RegisterEncoders, + &GetWeaponData, + &CmdStart, + &CmdEnd, + &ConnectionlessPacket, + &GetHullBounds, + &CreateInstancedBaselines, + &InconsistentFile, + &AllowLagCompensation }; static NEW_DLL_FUNCTIONS gNewDLLFunctions { - OnFreeEntPrivateData, + &OnFreeEntPrivateData, NULL, NULL }; @@ -83,7 +83,7 @@ BOOL gTouchDisabled = FALSE; DLL_FUNCTIONS gFunctionTable; NEW_DLL_FUNCTIONS gNewDLLFunctions; -TYPEDESCRIPTION IMPLEMENT_ARRAY_CLASS(CBaseEntity, m_SaveData)[5]; +TYPEDESCRIPTION IMPL_CLASS(CBaseEntity, m_SaveData)[5]; CMemoryPool hashItemMemPool; BOOL gTouchDisabled; @@ -428,7 +428,7 @@ C_DLLEXPORT int GetNewDLLFunctions(NEW_DLL_FUNCTIONS *pFunctionTable, int *inter } /* <30ab0> ../cstrike/dlls/cbase.cpp:498 */ -int DispatchSpawn(edict_t *pent) +int EXT_FUNC DispatchSpawn(edict_t *pent) { CBaseEntity *pEntity = (CBaseEntity *)GET_PRIVATE(pent); @@ -489,7 +489,7 @@ int DispatchSpawn(edict_t *pent) } /* <2e8a0> ../cstrike/dlls/cbase.cpp:549 */ -void DispatchKeyValue(edict_t *pentKeyvalue, KeyValueData *pkvd) +void EXT_FUNC DispatchKeyValue(edict_t *pentKeyvalue, KeyValueData *pkvd) { if (!pkvd || !pentKeyvalue) return; @@ -514,7 +514,7 @@ void DispatchKeyValue(edict_t *pentKeyvalue, KeyValueData *pkvd) // while it builds the graph /* <2e7db> ../cstrike/dlls/cbase.cpp:574 */ -void DispatchTouch(edict_t *pentTouched, edict_t *pentOther) +void EXT_FUNC DispatchTouch(edict_t *pentTouched, edict_t *pentOther) { if (gTouchDisabled) return; @@ -527,7 +527,7 @@ void DispatchTouch(edict_t *pentTouched, edict_t *pentOther) } /* <2fa9b> ../cstrike/dlls/cbase.cpp:587 */ -void DispatchUse(edict_t *pentUsed, edict_t *pentOther) +void EXT_FUNC DispatchUse(edict_t *pentUsed, edict_t *pentOther) { CBaseEntity *pEntity = (CBaseEntity *)GET_PRIVATE(pentUsed); CBaseEntity *pOther = (CBaseEntity *)GET_PRIVATE(pentOther); @@ -539,7 +539,7 @@ void DispatchUse(edict_t *pentUsed, edict_t *pentOther) } /* <2fb2f> ../cstrike/dlls/cbase.cpp:596 */ -void DispatchThink(edict_t *pent) +void EXT_FUNC DispatchThink(edict_t *pent) { CBaseEntity *pEntity = (CBaseEntity *)GET_PRIVATE(pent); @@ -555,7 +555,7 @@ void DispatchThink(edict_t *pent) } /* <2fb89> ../cstrike/dlls/cbase.cpp:612 */ -void DispatchBlocked(edict_t *pentBlocked, edict_t *pentOther) +void EXT_FUNC DispatchBlocked(edict_t *pentBlocked, edict_t *pentOther) { CBaseEntity *pEntity = (CBaseEntity *)GET_PRIVATE(pentBlocked); CBaseEntity *pOther = (CBaseEntity *)GET_PRIVATE(pentOther); @@ -567,7 +567,7 @@ void DispatchBlocked(edict_t *pentBlocked, edict_t *pentOther) } /* <2ff56> ../cstrike/dlls/cbase.cpp:621 */ -void DispatchSave(edict_t *pent, SAVERESTOREDATA *pSaveData) +void EXT_FUNC DispatchSave(edict_t *pent, SAVERESTOREDATA *pSaveData) { CBaseEntity *pEntity = (CBaseEntity *)GET_PRIVATE(pent); @@ -627,7 +627,7 @@ CBaseEntity *FindGlobalEntity(string_t classname, string_t globalname) } /* <3179c> ../cstrike/dlls/cbase.cpp:673 */ -int DispatchRestore(edict_t *pent, SAVERESTOREDATA *pSaveData, int globalEntity) +int EXT_FUNC DispatchRestore(edict_t *pent, SAVERESTOREDATA *pSaveData, int globalEntity) { CBaseEntity *pEntity = (CBaseEntity *)GET_PRIVATE(pent); @@ -742,7 +742,7 @@ int DispatchRestore(edict_t *pent, SAVERESTOREDATA *pSaveData, int globalEntity) } /* <2fdcd> ../cstrike/dlls/cbase.cpp:776 */ -void DispatchObjectCollsionBox(edict_t *pent) +void EXT_FUNC DispatchObjectCollsionBox(edict_t *pent) { CBaseEntity *pEntity = (CBaseEntity *)GET_PRIVATE(pent); @@ -756,14 +756,14 @@ void DispatchObjectCollsionBox(edict_t *pent) } /* <2fe94> ../cstrike/dlls/cbase.cpp:788 */ -void SaveWriteFields(SAVERESTOREDATA *pSaveData, const char *pname, void *pBaseData, TYPEDESCRIPTION *pFields, int fieldCount) +void EXT_FUNC SaveWriteFields(SAVERESTOREDATA *pSaveData, const char *pname, void *pBaseData, TYPEDESCRIPTION *pFields, int fieldCount) { CSave saveHelper(pSaveData); saveHelper.WriteFields(pname, pBaseData, pFields, fieldCount); } /* <30047> ../cstrike/dlls/cbase.cpp:795 */ -void SaveReadFields(SAVERESTOREDATA *pSaveData, const char *pname, void *pBaseData, TYPEDESCRIPTION *pFields, int fieldCount) +void EXT_FUNC SaveReadFields(SAVERESTOREDATA *pSaveData, const char *pname, void *pBaseData, TYPEDESCRIPTION *pFields, int fieldCount) { CRestore restoreHelper(pSaveData); restoreHelper.ReadFields(pname, pBaseData, pFields, fieldCount); @@ -922,7 +922,7 @@ int CBaseEntity::__MAKE_VHOOK(Save)(CSave &save) { if (save.WriteEntVars("ENTVARS", pev)) { - return save.WriteFields("BASE", this, IMPLEMENT_ARRAY(m_SaveData), ARRAYSIZE(IMPLEMENT_ARRAY(m_SaveData))); + return save.WriteFields("BASE", this, IMPL(m_SaveData), ARRAYSIZE(IMPL(m_SaveData))); } return 0; @@ -937,7 +937,7 @@ int CBaseEntity::__MAKE_VHOOK(Restore)(CRestore &restore) if (status) { - status = restore.ReadFields("BASE", this, IMPLEMENT_ARRAY(m_SaveData), ARRAYSIZE(IMPLEMENT_ARRAY(m_SaveData))); + status = restore.ReadFields("BASE", this, IMPL(m_SaveData), ARRAYSIZE(IMPL(m_SaveData))); } if (pev->modelindex != 0 && !FStringNull(pev->model)) diff --git a/regamedll/dlls/cbase.h b/regamedll/dlls/cbase.h index 2eb1b2bb..d6df7516 100644 --- a/regamedll/dlls/cbase.h +++ b/regamedll/dlls/cbase.h @@ -177,10 +177,10 @@ #define MS_MAX_TARGETS 32 #ifdef _WIN32 - #define C_EXPORT _declspec(dllexport) + #define EXPORT _declspec(dllexport) #else - #define C_EXPORT -#endif + #define EXPORT /**/ +#endif // _WIN32 enum hash_types_e { @@ -230,16 +230,6 @@ typedef enum } TRAIN_CODE; -// Things that toggle (buttons/triggers/doors) need this -typedef enum -{ - TS_AT_TOP, - TS_AT_BOTTOM, - TS_GOING_UP, - TS_GOING_DOWN, - -} TOGGLE_STATE; - class CGrenade; class CBaseEntity; class CBaseMonster; @@ -566,7 +556,7 @@ public: CBaseEntity *m_pGoalEnt; CBaseEntity *m_pLink; - static TYPEDESCRIPTION IMPLEMENT_ARRAY(m_SaveData)[5]; + static TYPEDESCRIPTION IMPL(m_SaveData)[5]; void (CBaseEntity::*m_pfnThink)(void); //int m_pfnThink_Flag; @@ -669,7 +659,7 @@ public: void EXPORT Register(void); public: - static TYPEDESCRIPTION IMPLEMENT_ARRAY(m_SaveData)[4]; + static TYPEDESCRIPTION IMPL(m_SaveData)[4]; EHANDLE m_rgEntities[MS_MAX_TARGETS]; int m_rgTriggered[MS_MAX_TARGETS]; @@ -698,7 +688,7 @@ public: void SUB_UseTargets(CBaseEntity *pActivator, USE_TYPE useType, float value); void EXPORT DelayThink(void); public: - static TYPEDESCRIPTION IMPLEMENT_ARRAY(m_SaveData)[2]; + static TYPEDESCRIPTION IMPL(m_SaveData)[2]; float m_flDelay; int m_iszKillTarget; @@ -742,7 +732,7 @@ public: int ExtractBbox(int sequence, float *mins, float *maxs); void SetSequenceBox(void); public: - static TYPEDESCRIPTION IMPLEMENT_ARRAY(m_SaveData)[5]; + static TYPEDESCRIPTION IMPL(m_SaveData)[5]; float m_flFrameRate; float m_flGroundSpeed; @@ -788,7 +778,7 @@ public: static float AxisDelta(int flags, const Vector &angle1, const Vector &angle2); public: - static TYPEDESCRIPTION IMPLEMENT_ARRAY(m_SaveData)[19]; + static TYPEDESCRIPTION IMPL(m_SaveData)[19]; TOGGLE_STATE m_toggle_state; float m_flActivateFinished; @@ -870,7 +860,7 @@ public: BUTTON_CODE ButtonResponseToTouch(void); public: - static TYPEDESCRIPTION IMPLEMENT_ARRAY(m_SaveData)[8]; + static TYPEDESCRIPTION IMPL(m_SaveData)[8]; BOOL m_fStayPushed; BOOL m_fRotating; diff --git a/regamedll/dlls/client.cpp b/regamedll/dlls/client.cpp index 7734b2b3..7ee539a1 100644 --- a/regamedll/dlls/client.cpp +++ b/regamedll/dlls/client.cpp @@ -75,7 +75,7 @@ int g_serveractive; #endif // HOOK_GAMEDLL -PLAYERPVSSTATUS g_PVSStatus[32]; +PLAYERPVSSTATUS g_PVSStatus[MAX_CLIENTS]; unsigned short m_usResetDecals; unsigned short g_iShadowSprite; @@ -154,13 +154,13 @@ void BlinkAccount(CBasePlayer *player, int numBlinks) } /* <47efd> ../cstrike/dlls/client.cpp:236 */ -BOOL ClientConnect(edict_t *pEntity, const char *pszName, const char *pszAddress, char *szRejectReason) +BOOL EXT_FUNC ClientConnect(edict_t *pEntity, const char *pszName, const char *pszAddress, char *szRejectReason) { return g_pGameRules->ClientConnected(pEntity, pszName, pszAddress, szRejectReason); } /* <47f5b> ../cstrike/dlls/client.cpp:255 */ -void ClientDisconnect(edict_t *pEntity) +void EXT_FUNC ClientDisconnect(edict_t *pEntity) { CBasePlayer *pPlayer = (CBasePlayer *)CBaseEntity::Instance(pEntity); @@ -216,7 +216,7 @@ void respawn(entvars_t *pev, BOOL fCopyCorpse) // Suicide... /* <48013> ../cstrike/dlls/client.cpp:347 */ -void ClientKill(edict_t *pEntity) +void EXT_FUNC ClientKill(edict_t *pEntity) { entvars_t *pev = &pEntity->v; CHalfLifeMultiplay *mp = g_pGameRules; @@ -496,7 +496,7 @@ void CheckStartMoney(void) } /* <4c084> ../cstrike/dlls/client.cpp:661 */ -void ClientPutInServer(edict_t *pEntity) +void EXT_FUNC ClientPutInServer(edict_t *pEntity) { entvars_t *pev = &pEntity->v; CBasePlayer *pPlayer = GetClassPtr((CBasePlayer *)pev); @@ -2898,7 +2898,7 @@ BOOL HandleRadioAliasCommands(CBasePlayer *pPlayer, const char *pszCommand) // Use CMD_ARGV, CMD_ARGV, and CMD_ARGC to get pointers the character string command. /* <4c6c1> ../cstrike/dlls/client.cpp:3234 */ -void ClientCommand(edict_t *pEntity) +void EXT_FUNC ClientCommand(edict_t *pEntity) { const char *pcmd = CMD_ARGV_(0); const char *pstr = NULL; @@ -3854,7 +3854,7 @@ void ClientCommand(edict_t *pEntity) } /* <4b959> ../cstrike/dlls/client.cpp:4282 */ -void ClientUserInfoChanged(edict_t *pEntity, char *infobuffer) +void EXT_FUNC ClientUserInfoChanged(edict_t *pEntity, char *infobuffer) { // Is the client spawned yet? if (!pEntity->pvPrivateData) @@ -3919,7 +3919,7 @@ void ClientUserInfoChanged(edict_t *pEntity, char *infobuffer) } /* <4a378> ../cstrike/dlls/client.cpp:4362 */ -void ServerDeactivate(void) +void EXT_FUNC ServerDeactivate(void) { // It's possible that the engine will call this function more times than is necessary // Therefore, only run it one time for each call to ServerActivate @@ -3946,7 +3946,7 @@ void ServerDeactivate(void) } /* <4a392> ../cstrike/dlls/client.cpp:4400 */ -void ServerActivate(edict_t *pEdictList, int edictCount, int clientMax) +void EXT_FUNC ServerActivate(edict_t *pEdictList, int edictCount, int clientMax) { int i; CBaseEntity *pClass; @@ -4000,7 +4000,7 @@ void ServerActivate(edict_t *pEdictList, int edictCount, int clientMax) } /* <4a404> ../cstrike/dlls/client.cpp:4459 */ -void PlayerPreThink(edict_t *pEntity) +void EXT_FUNC PlayerPreThink(edict_t *pEntity) { entvars_t *pev = &pEntity->v; CBasePlayer *pPlayer = (CBasePlayer *)GET_PRIVATE(pEntity); @@ -4012,7 +4012,7 @@ void PlayerPreThink(edict_t *pEntity) } /* <4a47c> ../cstrike/dlls/client.cpp:4475 */ -void PlayerPostThink(edict_t *pEntity) +void EXT_FUNC PlayerPostThink(edict_t *pEntity) { entvars_t *pev = &pEntity->v; CBasePlayer *pPlayer = (CBasePlayer *)GET_PRIVATE(pEntity); @@ -4024,13 +4024,13 @@ void PlayerPostThink(edict_t *pEntity) } /* <4a4f4> ../cstrike/dlls/client.cpp:4486 */ -void ParmsNewLevel(void) +void EXT_FUNC ParmsNewLevel(void) { ; } /* <4a50d> ../cstrike/dlls/client.cpp:4491 */ -void ParmsChangeLevel(void) +void EXT_FUNC ParmsChangeLevel(void) { // retrieve the pointer to the save data SAVERESTOREDATA *pSaveData = (SAVERESTOREDATA *)gpGlobals->pSaveData; @@ -4042,7 +4042,7 @@ void ParmsChangeLevel(void) } /* <4a548> ../cstrike/dlls/client.cpp:4504 */ -void StartFrame(void) +void EXT_FUNC StartFrame(void) { if (g_pGameRules != NULL) { @@ -4495,7 +4495,7 @@ void ClientPrecache(void) } /* <4a6e5> ../cstrike/dlls/client.cpp:4996 */ -const char *GetGameDescription(void) +const char *EXT_FUNC GetGameDescription(void) { if (UTIL_IsGame("czero")) return "Condition Zero"; @@ -4504,13 +4504,13 @@ const char *GetGameDescription(void) } /* <4a703> ../cstrike/dlls/client.cpp:5022 */ -void Sys_Error(const char *error_string) +void EXT_FUNC Sys_Error(const char *error_string) { ; } /* <4a731> ../cstrike/dlls/client.cpp:5039 */ -void PlayerCustomization(edict_t *pEntity, customization_t *pCust) +void EXT_FUNC PlayerCustomization(edict_t *pEntity, customization_t *pCust) { CBasePlayer *pPlayer = (CBasePlayer *)GET_PRIVATE(pEntity); @@ -4528,21 +4528,21 @@ void PlayerCustomization(edict_t *pEntity, customization_t *pCust) switch (pCust->resource.type) { - case t_decal: - pPlayer->SetCustomDecalFrames(pCust->nUserData2); - break; - case t_sound: - case t_skin: - case t_model: - break; - default: - ALERT(at_console, "PlayerCustomization: Unknown customization type!\n"); - break; + case t_decal: + pPlayer->SetCustomDecalFrames(pCust->nUserData2); + break; + case t_sound: + case t_skin: + case t_model: + break; + default: + ALERT(at_console, "PlayerCustomization: Unknown customization type!\n"); + break; } } /* <4a7b9> ../cstrike/dlls/client.cpp:5079 */ -void SpectatorConnect(edict_t *pEntity) +void EXT_FUNC SpectatorConnect(edict_t *pEntity) { CBaseSpectator *pPlayer = (CBaseSpectator *)GET_PRIVATE(pEntity); @@ -4553,7 +4553,7 @@ void SpectatorConnect(edict_t *pEntity) } /* <4a83d> ../cstrike/dlls/client.cpp:5095 */ -void SpectatorDisconnect(edict_t *pEntity) +void EXT_FUNC SpectatorDisconnect(edict_t *pEntity) { CBaseSpectator *pPlayer = (CBaseSpectator *)GET_PRIVATE(pEntity); @@ -4564,7 +4564,7 @@ void SpectatorDisconnect(edict_t *pEntity) } /* <4a8b5> ../cstrike/dlls/client.cpp:5111 */ -void SpectatorThink(edict_t *pEntity) +void EXT_FUNC SpectatorThink(edict_t *pEntity) { CBaseSpectator *pPlayer = (CBaseSpectator *)GET_PRIVATE(pEntity); @@ -4575,7 +4575,7 @@ void SpectatorThink(edict_t *pEntity) } /* <4a92d> ../cstrike/dlls/client.cpp:5160 */ -void SetupVisibility(edict_t *pViewEntity, edict_t *pClient, unsigned char **pvs, unsigned char **pas) +void EXT_FUNC SetupVisibility(edict_t *pViewEntity, edict_t *pClient, unsigned char **pvs, unsigned char **pas) { edict_t *pView = pClient; @@ -4673,7 +4673,7 @@ bool CheckEntityRecentlyInPVS(int clientnum, int entitynum, float currenttime) } /* <4ac57> ../cstrike/dlls/client.cpp:5312 */ -int AddToFullPack(struct entity_state_s *state, int e, edict_t *ent, edict_t *host, int hostflags, int player, unsigned char *pSet) +int EXT_FUNC AddToFullPack(struct entity_state_s *state, int e, edict_t *ent, edict_t *host, int hostflags, int player, unsigned char *pSet) { if ((ent->v.effects & EF_NODRAW) == EF_NODRAW && ent != host) return 0; @@ -4813,7 +4813,7 @@ int AddToFullPack(struct entity_state_s *state, int e, edict_t *ent, edict_t *ho // Creates baselines used for network encoding, especially for player data since players are not spawned until connect time. /* <4aef3> ../cstrike/dlls/client.cpp:5516 */ -void CreateBaseline(int player, int eindex, struct entity_state_s *baseline, struct edict_s *entity, int playermodelindex, Vector player_mins, Vector player_maxs) +void EXT_FUNC CreateBaseline(int player, int eindex, struct entity_state_s *baseline, struct edict_s *entity, int playermodelindex, Vector player_mins, Vector player_maxs) { baseline->origin = entity->v.origin; baseline->angles = entity->v.angles; @@ -5035,7 +5035,7 @@ void Custom_Encode(struct delta_s *pFields, const unsigned char *from, const uns } /* <4b08a> ../cstrike/dlls/client.cpp:5811 */ -void RegisterEncoders(void) +void EXT_FUNC RegisterEncoders(void) { DELTA_ADDENCODER("Entity_Encode", Entity_Encode); DELTA_ADDENCODER("Custom_Encode", Custom_Encode); @@ -5043,7 +5043,7 @@ void RegisterEncoders(void) } /* <4b0a4> ../cstrike/dlls/client.cpp:5818 */ -int GetWeaponData(edict_s *player, struct weapon_data_s *info) +int EXT_FUNC GetWeaponData(edict_s *player, struct weapon_data_s *info) { entvars_t *pev = &player->v; CBasePlayer *pl = reinterpret_cast(CBasePlayer::Instance(pev)); @@ -5098,7 +5098,7 @@ int GetWeaponData(edict_s *player, struct weapon_data_s *info) } /* <4b1fd> ../cstrike/dlls/client.cpp:5889 */ -void UpdateClientData(const struct edict_s *ent, int sendweapons, struct clientdata_s *cd) +void EXT_FUNC UpdateClientData(const struct edict_s *ent, int sendweapons, struct clientdata_s *cd) { if (!ent || !ent->pvPrivateData) { @@ -5219,7 +5219,7 @@ void UpdateClientData(const struct edict_s *ent, int sendweapons, struct clientd } /* <4b3ee> ../cstrike/dlls/client.cpp:6050 */ -void CmdStart(const edict_t *player, const struct usercmd_s *cmd, unsigned int random_seed) +void EXT_FUNC CmdStart(const edict_t *player, const struct usercmd_s *cmd, unsigned int random_seed) { entvars_t *pev = (entvars_t *)&player->v; CBasePlayer *pl = reinterpret_cast(CBasePlayer::Instance(pev)); @@ -5238,7 +5238,7 @@ void CmdStart(const edict_t *player, const struct usercmd_s *cmd, unsigned int r } /* <4b4eb> ../cstrike/dlls/client.cpp:6074 */ -void CmdEnd(const edict_t *player) +void EXT_FUNC CmdEnd(const edict_t *player) { entvars_t *pev = (entvars_t *)&player->v; CBasePlayer *pl = reinterpret_cast(CBasePlayer::Instance(pev)); @@ -5254,7 +5254,7 @@ void CmdEnd(const edict_t *player) } /* <4b644> ../cstrike/dlls/client.cpp:6101 */ -int ConnectionlessPacket(const struct netadr_s *net_from, const char *args, char *response_buffer, int *response_buffer_size) +int EXT_FUNC ConnectionlessPacket(const struct netadr_s *net_from, const char *args, char *response_buffer, int *response_buffer_size) { // Parse stuff from args int max_buffer_size = *response_buffer_size; @@ -5269,7 +5269,7 @@ int ConnectionlessPacket(const struct netadr_s *net_from, const char *args, char } /* <4b6c2> ../cstrike/dlls/client.cpp:6122 */ -int GetHullBounds(int hullnumber, float *mins, float *maxs) +int EXT_FUNC GetHullBounds(int hullnumber, float *mins, float *maxs) { return hullnumber < 3; } @@ -5278,7 +5278,7 @@ int GetHullBounds(int hullnumber, float *mins, float *maxs) // to be created during play ( e.g., grenades, ammo packs, projectiles, corpses, etc. ) /* <4b733> ../cstrike/dlls/client.cpp:6156 */ -void CreateInstancedBaselines(void) +void EXT_FUNC CreateInstancedBaselines(void) { int iret = 0; entity_state_t state; @@ -5293,7 +5293,7 @@ void CreateInstancedBaselines(void) } /* <4b77c> ../cstrike/dlls/client.cpp:6179 */ -int InconsistentFile(const edict_t *player, const char *filename, char *disconnect_message) +int EXT_FUNC InconsistentFile(const edict_t *player, const char *filename, char *disconnect_message) { // Server doesn't care? if (CVAR_GET_FLOAT("mp_consistency") != 1) @@ -5313,7 +5313,7 @@ int InconsistentFile(const edict_t *player, const char *filename, char *disconne // if you want. /* <4b7cf> ../cstrike/dlls/client.cpp:6204 */ -int AllowLagCompensation(void) +int EXT_FUNC AllowLagCompensation(void) { return 1; } diff --git a/regamedll/dlls/combat.cpp b/regamedll/dlls/combat.cpp index b54fe70f..c23275ae 100644 --- a/regamedll/dlls/combat.cpp +++ b/regamedll/dlls/combat.cpp @@ -299,7 +299,7 @@ void CBaseMonster::__MAKE_VHOOK(GibMonster)(void) // anim to play. /* <5f65e> ../cstrike/dlls/combat.cpp:355 */ -NOXREF Activity CBaseMonster::__MAKE_VHOOK(GetDeathActivity)(void) +Activity CBaseMonster::__MAKE_VHOOK(GetDeathActivity)(void) { Activity deathActivity; BOOL fTriedDirection; diff --git a/regamedll/dlls/debug.cpp b/regamedll/dlls/debug.cpp index d9a9ea4c..170a39ee 100644 --- a/regamedll/dlls/debug.cpp +++ b/regamedll/dlls/debug.cpp @@ -84,50 +84,50 @@ void PrintDebugFlags(void) /* <22fed4> ../cstrike/dlls/debug.cpp:94 */ void SetDebugFlag(const char *flagStr, bool state) { - if (flagStr != NULL) - { - DebugOutputType flag; - for (int i = 0; i < ARRAYSIZE(outputLevel); i++) - { - DebugOutputLevel level = outputLevel[ i ]; - - if (FStrEq(level.name, flagStr)) - { - flag = level.value; - - if (state) - theDebugOutputTypes |= flag; - else - theDebugOutputTypes &= ~flag; - - SERVER_PRINT(SharedVarArgs("mp_debug: %s is now %s\n", flagStr, state ? "on" : "off")); - return; - } - } - } - + if (flagStr != NULL) + { + DebugOutputType flag; + for (int i = 0; i < ARRAYSIZE(outputLevel); i++) + { + DebugOutputLevel level = outputLevel[ i ]; + + if (FStrEq(level.name, flagStr)) + { + flag = level.value; + + if (state) + theDebugOutputTypes |= flag; + else + theDebugOutputTypes &= ~flag; + + SERVER_PRINT(SharedVarArgs("mp_debug: %s is now %s\n", flagStr, state ? "on" : "off")); + return; + } + } + } + SERVER_PRINT(SharedVarArgs("mp_debug: unknown variable '%s'\n", flagStr)); } /* <23001f> ../cstrike/dlls/debug.cpp:126 */ void PrintDebugFlag(const char *flagStr) { - if (flagStr != NULL) - { - DebugOutputType flag; - for (int i = 0; i < ARRAYSIZE(outputLevel); i++) - { - DebugOutputLevel level = outputLevel[ i ]; - - if (FStrEq(level.name, flagStr)) - { - flag = level.value; - SERVER_PRINT(SharedVarArgs("mp_debug: %s is %s\n", flagStr, (flag & theDebugOutputTypes) ? "on" : "off")); - return; - } - } - } - + if (flagStr != NULL) + { + DebugOutputType flag; + for (int i = 0; i < ARRAYSIZE(outputLevel); i++) + { + DebugOutputLevel level = outputLevel[ i ]; + + if (FStrEq(level.name, flagStr)) + { + flag = level.value; + SERVER_PRINT(SharedVarArgs("mp_debug: %s is %s\n", flagStr, (flag & theDebugOutputTypes) ? "on" : "off")); + return; + } + } + } + SERVER_PRINT(SharedVarArgs("mp_debug: unknown variable '%s'\n", flagStr)); } diff --git a/regamedll/dlls/debug.h b/regamedll/dlls/debug.h index 0776ae6d..0e271921 100644 --- a/regamedll/dlls/debug.h +++ b/regamedll/dlls/debug.h @@ -47,11 +47,11 @@ typedef enum } DebugOutputType; -struct DebugOutputLevel -{ - const char *name; - DebugOutputType value; - +struct DebugOutputLevel +{ + const char *name; + DebugOutputType value; + };/* size: 8, cachelines: 1, members: 2 */ #ifdef HOOK_GAMEDLL diff --git a/regamedll/dlls/doors.cpp b/regamedll/dlls/doors.cpp index 837745f1..d22ac6af 100644 --- a/regamedll/dlls/doors.cpp +++ b/regamedll/dlls/doors.cpp @@ -23,8 +23,8 @@ TYPEDESCRIPTION CMomentaryDoor::m_SaveData[] = #else -TYPEDESCRIPTION IMPLEMENT_ARRAY_CLASS(CBaseDoor, m_SaveData)[7]; -TYPEDESCRIPTION IMPLEMENT_ARRAY_CLASS(CMomentaryDoor, m_SaveData)[1]; +TYPEDESCRIPTION IMPL_CLASS(CBaseDoor, m_SaveData)[7]; +TYPEDESCRIPTION IMPL_CLASS(CMomentaryDoor, m_SaveData)[1]; #endif // HOOK_GAMEDLL @@ -408,29 +408,29 @@ void CBaseDoor::__MAKE_VHOOK(Precache)(void) // get sentence group names, for doors which are directly 'touched' to open switch (m_bLockedSentence) { - case 1: m_ls.sLockedSentence = ALLOC_STRING("NA"); break; // access denied - case 2: m_ls.sLockedSentence = ALLOC_STRING("ND"); break; // security lockout - case 3: m_ls.sLockedSentence = ALLOC_STRING("NF"); break; // blast door - case 4: m_ls.sLockedSentence = ALLOC_STRING("NFIRE"); break; // fire door - case 5: m_ls.sLockedSentence = ALLOC_STRING("NCHEM"); break; // chemical door - case 6: m_ls.sLockedSentence = ALLOC_STRING("NRAD"); break; // radiation door - case 7: m_ls.sLockedSentence = ALLOC_STRING("NCON"); break; // gen containment - case 8: m_ls.sLockedSentence = ALLOC_STRING("NH"); break; // maintenance door - case 9: m_ls.sLockedSentence = ALLOC_STRING("NG"); break; // broken door - default: m_ls.sLockedSentence = 0; break; + case 1: m_ls.sLockedSentence = ALLOC_STRING("NA"); break; // access denied + case 2: m_ls.sLockedSentence = ALLOC_STRING("ND"); break; // security lockout + case 3: m_ls.sLockedSentence = ALLOC_STRING("NF"); break; // blast door + case 4: m_ls.sLockedSentence = ALLOC_STRING("NFIRE"); break; // fire door + case 5: m_ls.sLockedSentence = ALLOC_STRING("NCHEM"); break; // chemical door + case 6: m_ls.sLockedSentence = ALLOC_STRING("NRAD"); break; // radiation door + case 7: m_ls.sLockedSentence = ALLOC_STRING("NCON"); break; // gen containment + case 8: m_ls.sLockedSentence = ALLOC_STRING("NH"); break; // maintenance door + case 9: m_ls.sLockedSentence = ALLOC_STRING("NG"); break; // broken door + default: m_ls.sLockedSentence = 0; break; } switch (m_bUnlockedSentence) { - case 1: m_ls.sUnlockedSentence = ALLOC_STRING("EA"); break; // access granted - case 2: m_ls.sUnlockedSentence = ALLOC_STRING("ED"); break; // security door - case 3: m_ls.sUnlockedSentence = ALLOC_STRING("EF"); break; // blast door - case 4: m_ls.sUnlockedSentence = ALLOC_STRING("EFIRE"); break; // fire door - case 5: m_ls.sUnlockedSentence = ALLOC_STRING("ECHEM"); break; // chemical door - case 6: m_ls.sUnlockedSentence = ALLOC_STRING("ERAD"); break; // radiation door - case 7: m_ls.sUnlockedSentence = ALLOC_STRING("ECON"); break; // gen containment - case 8: m_ls.sUnlockedSentence = ALLOC_STRING("EH"); break; // maintenance door - default: m_ls.sUnlockedSentence = 0; break; + case 1: m_ls.sUnlockedSentence = ALLOC_STRING("EA"); break; // access granted + case 2: m_ls.sUnlockedSentence = ALLOC_STRING("ED"); break; // security door + case 3: m_ls.sUnlockedSentence = ALLOC_STRING("EF"); break; // blast door + case 4: m_ls.sUnlockedSentence = ALLOC_STRING("EFIRE"); break; // fire door + case 5: m_ls.sUnlockedSentence = ALLOC_STRING("ECHEM"); break; // chemical door + case 6: m_ls.sUnlockedSentence = ALLOC_STRING("ERAD"); break; // radiation door + case 7: m_ls.sUnlockedSentence = ALLOC_STRING("ECON"); break; // gen containment + case 8: m_ls.sUnlockedSentence = ALLOC_STRING("EH"); break; // maintenance door + default: m_ls.sUnlockedSentence = 0; break; } } diff --git a/regamedll/dlls/doors.h b/regamedll/dlls/doors.h index e40aabdb..91b65d8c 100644 --- a/regamedll/dlls/doors.h +++ b/regamedll/dlls/doors.h @@ -84,7 +84,7 @@ public: #endif // HOOK_GAMEDLL public: - static TYPEDESCRIPTION IMPLEMENT_ARRAY(m_SaveData)[7]; + static TYPEDESCRIPTION IMPL(m_SaveData)[7]; public: // used to selectivly override defaults @@ -157,7 +157,7 @@ public: #endif // HOOK_GAMEDLL public: - static TYPEDESCRIPTION IMPLEMENT_ARRAY(m_SaveData)[1]; + static TYPEDESCRIPTION IMPL(m_SaveData)[1]; public: BYTE m_bMoveSnd; // sound a door makes while moving diff --git a/regamedll/dlls/effects.cpp b/regamedll/dlls/effects.cpp index bea018f6..7be5863d 100644 --- a/regamedll/dlls/effects.cpp +++ b/regamedll/dlls/effects.cpp @@ -61,12 +61,12 @@ TYPEDESCRIPTION CGibShooter::m_SaveData[] = #else -TYPEDESCRIPTION IMPLEMENT_ARRAY_CLASS(CBubbling, m_SaveData)[3]; -TYPEDESCRIPTION IMPLEMENT_ARRAY_CLASS(CLightning, m_SaveData)[13]; -TYPEDESCRIPTION IMPLEMENT_ARRAY_CLASS(CLaser, m_SaveData)[3]; -TYPEDESCRIPTION IMPLEMENT_ARRAY_CLASS(CGlow, m_SaveData)[2]; -TYPEDESCRIPTION IMPLEMENT_ARRAY_CLASS(CSprite, m_SaveData)[2]; -TYPEDESCRIPTION IMPLEMENT_ARRAY_CLASS(CGibShooter, m_SaveData)[7]; +TYPEDESCRIPTION IMPL_CLASS(CBubbling, m_SaveData)[3]; +TYPEDESCRIPTION IMPL_CLASS(CLightning, m_SaveData)[13]; +TYPEDESCRIPTION IMPL_CLASS(CLaser, m_SaveData)[3]; +TYPEDESCRIPTION IMPL_CLASS(CGlow, m_SaveData)[2]; +TYPEDESCRIPTION IMPL_CLASS(CSprite, m_SaveData)[2]; +TYPEDESCRIPTION IMPL_CLASS(CGibShooter, m_SaveData)[7]; #endif // HOOK_GAMEDLL diff --git a/regamedll/dlls/effects.h b/regamedll/dlls/effects.h index 7e0bc992..74860a8a 100644 --- a/regamedll/dlls/effects.h +++ b/regamedll/dlls/effects.h @@ -160,7 +160,7 @@ public: void EXPORT AnimateUntilDead(void); static CSprite *SpriteCreate(const char *pSpriteName, const Vector &origin, BOOL animate); - static TYPEDESCRIPTION IMPLEMENT_ARRAY(m_SaveData)[2]; + static TYPEDESCRIPTION IMPL(m_SaveData)[2]; private: @@ -356,7 +356,7 @@ public: void EXPORT StrikeThink(void); public: - static TYPEDESCRIPTION IMPLEMENT_ARRAY(m_SaveData)[3]; + static TYPEDESCRIPTION IMPL(m_SaveData)[3]; public: CSprite *m_pSprite; @@ -395,7 +395,7 @@ public: void EXPORT FizzThink(void); public: - static TYPEDESCRIPTION IMPLEMENT_ARRAY(m_SaveData)[3]; + static TYPEDESCRIPTION IMPL(m_SaveData)[3]; public: int m_density; @@ -447,7 +447,7 @@ public: void BeamUpdateVars(void); public: - static TYPEDESCRIPTION IMPLEMENT_ARRAY(m_SaveData)[13]; + static TYPEDESCRIPTION IMPL(m_SaveData)[13]; public: int m_active; @@ -486,7 +486,7 @@ public: void Animate(float frames); public: - static TYPEDESCRIPTION IMPLEMENT_ARRAY(m_SaveData)[2]; + static TYPEDESCRIPTION IMPL(m_SaveData)[2]; public: float m_lastTime; @@ -542,7 +542,7 @@ public: public: void EXPORT ShootThink(void); public: - static TYPEDESCRIPTION IMPLEMENT_ARRAY(m_SaveData)[7]; + static TYPEDESCRIPTION IMPL(m_SaveData)[7]; public: int m_iGibs; diff --git a/regamedll/dlls/explode.cpp b/regamedll/dlls/explode.cpp index 891d6243..4fd26e56 100644 --- a/regamedll/dlls/explode.cpp +++ b/regamedll/dlls/explode.cpp @@ -13,239 +13,239 @@ TYPEDESCRIPTION CEnvExplosion::m_SaveData[] = #else // HOOK_GAMEDLL -TYPEDESCRIPTION IMPLEMENT_ARRAY_CLASS(CEnvExplosion, m_SaveData)[2]; +TYPEDESCRIPTION IMPL_CLASS(CEnvExplosion, m_SaveData)[2]; #endif // HOOK_GAMEDLL - -/* <7f660> ../cstrike/dlls/explode.cpp:37 */ -LINK_ENTITY_TO_CLASS(spark_shower, CShower); - -/* <7f49c> ../cstrike/dlls/explode.cpp:39 */ -void CShower::__MAKE_VHOOK(Spawn)(void) -{ - pev->velocity = RANDOM_FLOAT(200, 300) * pev->angles; - pev->velocity.x += RANDOM_FLOAT(-100, 100); - pev->velocity.y += RANDOM_FLOAT(-100, 100); - - if (pev->velocity.z >= 0) - pev->velocity.z += 200; - else - pev->velocity.z -= 200; - - pev->movetype = MOVETYPE_BOUNCE; - pev->gravity = 0.5f; - pev->nextthink = gpGlobals->time + 0.1f; - pev->solid = SOLID_NOT; - - // Need a model, just use the grenade, we don't draw it anyway - SET_MODEL(edict(), "models/grenade.mdl"); - UTIL_SetSize(pev, g_vecZero, g_vecZero); - - pev->effects |= EF_NODRAW; - pev->speed = RANDOM_FLOAT(0.5, 1.5); - pev->angles = g_vecZero; -} - -/* <7f475> ../cstrike/dlls/explode.cpp:61 */ -void CShower::__MAKE_VHOOK(Think)(void) -{ - UTIL_Sparks(pev->origin); - - pev->speed -= 0.1f; - - if (pev->speed > 0) - pev->nextthink = gpGlobals->time + 0.1f; - else - UTIL_Remove(this); - - pev->flags &= ~FL_ONGROUND; -} - -/* <7f122> ../cstrike/dlls/explode.cpp:73 */ -void CShower::__MAKE_VHOOK(Touch)(CBaseEntity *pOther) -{ - if (pev->flags & FL_ONGROUND) - pev->velocity = pev->velocity * 0.1f; - else - pev->velocity = pev->velocity * 0.6f; - - if ((pev->velocity.x * pev->velocity.x + pev->velocity.y * pev->velocity.y) < 10.0f) - { - pev->speed = 0; - } -} - -/* <7f566> ../cstrike/dlls/explode.cpp:106 */ -IMPLEMENT_SAVERESTORE(CEnvExplosion, CBaseMonster); - -/* <7f72a> ../cstrike/dlls/explode.cpp:107 */ -LINK_ENTITY_TO_CLASS(env_explosion, CEnvExplosion); - -/* <7f5b2> ../cstrike/dlls/explode.cpp:109 */ -void CEnvExplosion::__MAKE_VHOOK(KeyValue)(KeyValueData *pkvd) -{ - if (FStrEq(pkvd->szKeyName, "iMagnitude")) - { - m_iMagnitude = Q_atoi(pkvd->szValue); - pkvd->fHandled = TRUE; - } - else - CBaseEntity::KeyValue(pkvd); -} - -/* <7f1a5> ../cstrike/dlls/explode.cpp:120 */ -void CEnvExplosion::__MAKE_VHOOK(Spawn)(void) -{ - pev->solid = SOLID_NOT; - pev->effects = EF_NODRAW; - pev->movetype = MOVETYPE_NONE; - - float flSpriteScale = (m_iMagnitude - 50) * 0.6f; - - if (flSpriteScale < 10.0f) - { - flSpriteScale = 10.0f; - } - - m_spriteScale = (int)flSpriteScale; -} - -/* <7f233> ../cstrike/dlls/explode.cpp:150 */ -void CEnvExplosion::__MAKE_VHOOK(Use)(CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value) -{ - TraceResult tr; - - pev->model = iStringNull;//invisible - pev->solid = SOLID_NOT;//intangible - - Vector vecSpot;// trace starts here! - - vecSpot = pev->origin + Vector(0, 0, 8); - - UTIL_TraceLine(vecSpot, vecSpot + Vector (0, 0, -40), ignore_monsters, ENT(pev), & tr); - - // Pull out of the wall a bit - if (tr.flFraction != 1.0f) - { - pev->origin = tr.vecEndPos + (tr.vecPlaneNormal * (m_iMagnitude - 24) * 0.6f); - } - else - { - pev->origin = pev->origin; - } - - // draw decal - if (! (pev->spawnflags & SF_ENVEXPLOSION_NODECAL)) - { - if (RANDOM_FLOAT(0, 1) < 0.5) - { - UTIL_DecalTrace(&tr, DECAL_SCORCH1); - } - else - { - UTIL_DecalTrace(&tr, DECAL_SCORCH2); - } - } - - // draw fireball - if (!(pev->spawnflags & SF_ENVEXPLOSION_NOFIREBALL)) - { - MESSAGE_BEGIN(MSG_PAS, SVC_TEMPENTITY, pev->origin); - WRITE_BYTE(TE_EXPLOSION); - WRITE_COORD(pev->origin.x); - WRITE_COORD(pev->origin.y); - WRITE_COORD(pev->origin.z); - WRITE_SHORT(g_sModelIndexFireball); - WRITE_BYTE((byte)m_spriteScale); // scale * 10 - WRITE_BYTE(15); // framerate - WRITE_BYTE(TE_EXPLFLAG_NONE); - MESSAGE_END(); - } - else - { - MESSAGE_BEGIN(MSG_PAS, SVC_TEMPENTITY, pev->origin); - WRITE_BYTE(TE_EXPLOSION); - WRITE_COORD(pev->origin.x); - WRITE_COORD(pev->origin.y); - WRITE_COORD(pev->origin.z); - WRITE_SHORT(g_sModelIndexFireball); - WRITE_BYTE(0); // no sprite - WRITE_BYTE(15); // framerate - WRITE_BYTE(TE_EXPLFLAG_NONE); - MESSAGE_END(); - } - - // do damage - if (!(pev->spawnflags & SF_ENVEXPLOSION_NODAMAGE)) - { - RadiusDamage(pev, pev, m_iMagnitude, CLASS_NONE, DMG_BLAST); - } - - SetThink(&CEnvExplosion::Smoke); - pev->nextthink = gpGlobals->time + 0.3f; - - // draw sparks - if (!(pev->spawnflags & SF_ENVEXPLOSION_NOSPARKS)) - { - int sparkCount = RANDOM_LONG(0, 3); - - for (int i = 0; i < sparkCount; i++) - { - Create("spark_shower", pev->origin, tr.vecPlaneNormal, NULL); - } - } -} - -/* <7f1e1> ../cstrike/dlls/explode.cpp:235 */ -void CEnvExplosion::Smoke(void) -{ - if (!(pev->spawnflags & SF_ENVEXPLOSION_NOSMOKE)) - { - MESSAGE_BEGIN(MSG_PAS, SVC_TEMPENTITY, pev->origin); - WRITE_BYTE(TE_SMOKE); - WRITE_COORD(pev->origin.x); - WRITE_COORD(pev->origin.y); - WRITE_COORD(pev->origin.z); - WRITE_SHORT(g_sModelIndexSmoke); - WRITE_BYTE((byte)m_spriteScale); // scale * 10 - WRITE_BYTE(12); // framerate - MESSAGE_END(); - } - - if (!(pev->spawnflags & SF_ENVEXPLOSION_REPEATABLE)) - { - UTIL_Remove(this); - } -} - -// HACKHACK -- create one of these and fake a keyvalue to get the right explosion setup - -/* <7f7f4> ../cstrike/dlls/explode.cpp:258 */ -void ExplosionCreate(const Vector ¢er, Vector &angles, edict_t *pOwner, int magnitude, BOOL doDamage) -{ - KeyValueData kvd; - char buf[128]; - - CBaseEntity *pExplosion = CBaseEntity::Create("env_explosion", center, angles, pOwner); - - Q_sprintf(buf, "%3d", magnitude); - - kvd.szKeyName = "iMagnitude"; - kvd.szValue = buf; - - pExplosion->KeyValue(&kvd); - - if (!doDamage) - { - pExplosion->pev->spawnflags |= SF_ENVEXPLOSION_NODAMAGE; - } - - pExplosion->Spawn(); - pExplosion->Use(NULL, NULL, USE_TOGGLE, 0); -} - -#ifdef HOOK_GAMEDLL - + +/* <7f660> ../cstrike/dlls/explode.cpp:37 */ +LINK_ENTITY_TO_CLASS(spark_shower, CShower); + +/* <7f49c> ../cstrike/dlls/explode.cpp:39 */ +void CShower::__MAKE_VHOOK(Spawn)(void) +{ + pev->velocity = RANDOM_FLOAT(200, 300) * pev->angles; + pev->velocity.x += RANDOM_FLOAT(-100, 100); + pev->velocity.y += RANDOM_FLOAT(-100, 100); + + if (pev->velocity.z >= 0) + pev->velocity.z += 200; + else + pev->velocity.z -= 200; + + pev->movetype = MOVETYPE_BOUNCE; + pev->gravity = 0.5f; + pev->nextthink = gpGlobals->time + 0.1f; + pev->solid = SOLID_NOT; + + // Need a model, just use the grenade, we don't draw it anyway + SET_MODEL(edict(), "models/grenade.mdl"); + UTIL_SetSize(pev, g_vecZero, g_vecZero); + + pev->effects |= EF_NODRAW; + pev->speed = RANDOM_FLOAT(0.5, 1.5); + pev->angles = g_vecZero; +} + +/* <7f475> ../cstrike/dlls/explode.cpp:61 */ +void CShower::__MAKE_VHOOK(Think)(void) +{ + UTIL_Sparks(pev->origin); + + pev->speed -= 0.1f; + + if (pev->speed > 0) + pev->nextthink = gpGlobals->time + 0.1f; + else + UTIL_Remove(this); + + pev->flags &= ~FL_ONGROUND; +} + +/* <7f122> ../cstrike/dlls/explode.cpp:73 */ +void CShower::__MAKE_VHOOK(Touch)(CBaseEntity *pOther) +{ + if (pev->flags & FL_ONGROUND) + pev->velocity = pev->velocity * 0.1f; + else + pev->velocity = pev->velocity * 0.6f; + + if ((pev->velocity.x * pev->velocity.x + pev->velocity.y * pev->velocity.y) < 10.0f) + { + pev->speed = 0; + } +} + +/* <7f566> ../cstrike/dlls/explode.cpp:106 */ +IMPLEMENT_SAVERESTORE(CEnvExplosion, CBaseMonster); + +/* <7f72a> ../cstrike/dlls/explode.cpp:107 */ +LINK_ENTITY_TO_CLASS(env_explosion, CEnvExplosion); + +/* <7f5b2> ../cstrike/dlls/explode.cpp:109 */ +void CEnvExplosion::__MAKE_VHOOK(KeyValue)(KeyValueData *pkvd) +{ + if (FStrEq(pkvd->szKeyName, "iMagnitude")) + { + m_iMagnitude = Q_atoi(pkvd->szValue); + pkvd->fHandled = TRUE; + } + else + CBaseEntity::KeyValue(pkvd); +} + +/* <7f1a5> ../cstrike/dlls/explode.cpp:120 */ +void CEnvExplosion::__MAKE_VHOOK(Spawn)(void) +{ + pev->solid = SOLID_NOT; + pev->effects = EF_NODRAW; + pev->movetype = MOVETYPE_NONE; + + float flSpriteScale = (m_iMagnitude - 50) * 0.6f; + + if (flSpriteScale < 10.0f) + { + flSpriteScale = 10.0f; + } + + m_spriteScale = (int)flSpriteScale; +} + +/* <7f233> ../cstrike/dlls/explode.cpp:150 */ +void CEnvExplosion::__MAKE_VHOOK(Use)(CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value) +{ + TraceResult tr; + + pev->model = iStringNull;//invisible + pev->solid = SOLID_NOT;//intangible + + Vector vecSpot;// trace starts here! + + vecSpot = pev->origin + Vector(0, 0, 8); + + UTIL_TraceLine(vecSpot, vecSpot + Vector (0, 0, -40), ignore_monsters, ENT(pev), & tr); + + // Pull out of the wall a bit + if (tr.flFraction != 1.0f) + { + pev->origin = tr.vecEndPos + (tr.vecPlaneNormal * (m_iMagnitude - 24) * 0.6f); + } + else + { + pev->origin = pev->origin; + } + + // draw decal + if (! (pev->spawnflags & SF_ENVEXPLOSION_NODECAL)) + { + if (RANDOM_FLOAT(0, 1) < 0.5) + { + UTIL_DecalTrace(&tr, DECAL_SCORCH1); + } + else + { + UTIL_DecalTrace(&tr, DECAL_SCORCH2); + } + } + + // draw fireball + if (!(pev->spawnflags & SF_ENVEXPLOSION_NOFIREBALL)) + { + MESSAGE_BEGIN(MSG_PAS, SVC_TEMPENTITY, pev->origin); + WRITE_BYTE(TE_EXPLOSION); + WRITE_COORD(pev->origin.x); + WRITE_COORD(pev->origin.y); + WRITE_COORD(pev->origin.z); + WRITE_SHORT(g_sModelIndexFireball); + WRITE_BYTE((byte)m_spriteScale); // scale * 10 + WRITE_BYTE(15); // framerate + WRITE_BYTE(TE_EXPLFLAG_NONE); + MESSAGE_END(); + } + else + { + MESSAGE_BEGIN(MSG_PAS, SVC_TEMPENTITY, pev->origin); + WRITE_BYTE(TE_EXPLOSION); + WRITE_COORD(pev->origin.x); + WRITE_COORD(pev->origin.y); + WRITE_COORD(pev->origin.z); + WRITE_SHORT(g_sModelIndexFireball); + WRITE_BYTE(0); // no sprite + WRITE_BYTE(15); // framerate + WRITE_BYTE(TE_EXPLFLAG_NONE); + MESSAGE_END(); + } + + // do damage + if (!(pev->spawnflags & SF_ENVEXPLOSION_NODAMAGE)) + { + RadiusDamage(pev, pev, m_iMagnitude, CLASS_NONE, DMG_BLAST); + } + + SetThink(&CEnvExplosion::Smoke); + pev->nextthink = gpGlobals->time + 0.3f; + + // draw sparks + if (!(pev->spawnflags & SF_ENVEXPLOSION_NOSPARKS)) + { + int sparkCount = RANDOM_LONG(0, 3); + + for (int i = 0; i < sparkCount; i++) + { + Create("spark_shower", pev->origin, tr.vecPlaneNormal, NULL); + } + } +} + +/* <7f1e1> ../cstrike/dlls/explode.cpp:235 */ +void CEnvExplosion::Smoke(void) +{ + if (!(pev->spawnflags & SF_ENVEXPLOSION_NOSMOKE)) + { + MESSAGE_BEGIN(MSG_PAS, SVC_TEMPENTITY, pev->origin); + WRITE_BYTE(TE_SMOKE); + WRITE_COORD(pev->origin.x); + WRITE_COORD(pev->origin.y); + WRITE_COORD(pev->origin.z); + WRITE_SHORT(g_sModelIndexSmoke); + WRITE_BYTE((byte)m_spriteScale); // scale * 10 + WRITE_BYTE(12); // framerate + MESSAGE_END(); + } + + if (!(pev->spawnflags & SF_ENVEXPLOSION_REPEATABLE)) + { + UTIL_Remove(this); + } +} + +// HACKHACK -- create one of these and fake a keyvalue to get the right explosion setup + +/* <7f7f4> ../cstrike/dlls/explode.cpp:258 */ +void ExplosionCreate(const Vector ¢er, Vector &angles, edict_t *pOwner, int magnitude, BOOL doDamage) +{ + KeyValueData kvd; + char buf[128]; + + CBaseEntity *pExplosion = CBaseEntity::Create("env_explosion", center, angles, pOwner); + + Q_sprintf(buf, "%3d", magnitude); + + kvd.szKeyName = "iMagnitude"; + kvd.szValue = buf; + + pExplosion->KeyValue(&kvd); + + if (!doDamage) + { + pExplosion->pev->spawnflags |= SF_ENVEXPLOSION_NODAMAGE; + } + + pExplosion->Spawn(); + pExplosion->Use(NULL, NULL, USE_TOGGLE, 0); +} + +#ifdef HOOK_GAMEDLL + void CShower::Spawn(void) { Spawn_(); @@ -260,30 +260,30 @@ void CShower::Touch(CBaseEntity *pOther) { Touch_(pOther); } - -void CEnvExplosion::Spawn(void) -{ - Spawn_(); -} -void CEnvExplosion::KeyValue(KeyValueData *pkvd) -{ - KeyValue_(pkvd); -} +void CEnvExplosion::Spawn(void) +{ + Spawn_(); +} -int CEnvExplosion::Save(CSave &save) -{ - return Save_(save); -} +void CEnvExplosion::KeyValue(KeyValueData *pkvd) +{ + KeyValue_(pkvd); +} -int CEnvExplosion::Restore(CRestore &restore) -{ - return Restore_(restore); -} +int CEnvExplosion::Save(CSave &save) +{ + return Save_(save); +} -void CEnvExplosion::Use(CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value) -{ - Use_(pActivator, pCaller, useType, value); -} - -#endif // HOOK_GAMEDLL +int CEnvExplosion::Restore(CRestore &restore) +{ + return Restore_(restore); +} + +void CEnvExplosion::Use(CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value) +{ + Use_(pActivator, pCaller, useType, value); +} + +#endif // HOOK_GAMEDLL diff --git a/regamedll/dlls/explode.h b/regamedll/dlls/explode.h index 480a784c..0cc84255 100644 --- a/regamedll/dlls/explode.h +++ b/regamedll/dlls/explode.h @@ -39,7 +39,7 @@ #define SF_ENVEXPLOSION_NODECAL (1<<4) // don't make a scorch mark #define SF_ENVEXPLOSION_NOSPARKS (1<<5) // don't make a scorch mark -/* <7e4a8> ../cstrike/dlls/explode.cpp:29 */ +/* <7e4a8> ../cstrike/dlls/explode.cpp:29 */ class CShower: public CBaseEntity { public: @@ -59,9 +59,9 @@ public: #endif // HOOK_GAMEDLL -};/* size: 152, cachelines: 3, members: 1 */ +};/* size: 152, cachelines: 3, members: 1 */ -/* <7e66b> ../cstrike/dlls/explode.cpp:84 */ +/* <7e66b> ../cstrike/dlls/explode.cpp:84 */ class CEnvExplosion: public CBaseMonster { public: @@ -85,7 +85,7 @@ public: void EXPORT Smoke(void); public: - static TYPEDESCRIPTION IMPLEMENT_ARRAY(m_SaveData)[2]; + static TYPEDESCRIPTION IMPL(m_SaveData)[2]; public: int m_iMagnitude; diff --git a/regamedll/dlls/extdll.h b/regamedll/dlls/extdll.h index c593db24..87312901 100644 --- a/regamedll/dlls/extdll.h +++ b/regamedll/dlls/extdll.h @@ -32,11 +32,11 @@ #pragma once #endif -//#pragma warning(disable:4244) // int or float down-conversion -//#pragma warning(disable:4305) // int or float data truncation -//#pragma warning(disable:4201) // nameless struct/union -//#pragma warning(disable:4514) // unreferenced inline function removed -//#pragma warning(disable:4100) // unreferenced formal parameter +#pragma warning(disable:4244) // int or float down-conversion +#pragma warning(disable:4305) // int or float data truncation +#pragma warning(disable:4201) // nameless struct/union +#pragma warning(disable:4514) // unreferenced inline function removed +#pragma warning(disable:4100) // unreferenced formal parameter #include "archtypes.h" diff --git a/regamedll/dlls/func_break.cpp b/regamedll/dlls/func_break.cpp index c30b7482..cad60550 100644 --- a/regamedll/dlls/func_break.cpp +++ b/regamedll/dlls/func_break.cpp @@ -116,8 +116,8 @@ const char *(*CBreakable::ppSoundsGlass)[3]; char *(*CPushable::pm_soundNames)[3]; -TYPEDESCRIPTION IMPLEMENT_ARRAY_CLASS(CBreakable, m_SaveData)[5]; -TYPEDESCRIPTION IMPLEMENT_ARRAY_CLASS(CPushable, m_SaveData)[2]; +TYPEDESCRIPTION IMPL_CLASS(CBreakable, m_SaveData)[5]; +TYPEDESCRIPTION IMPL_CLASS(CPushable, m_SaveData)[2]; #endif // HOOK_GAMEDLL diff --git a/regamedll/dlls/func_break.h b/regamedll/dlls/func_break.h index 0b3d2068..2ecb6ec6 100644 --- a/regamedll/dlls/func_break.h +++ b/regamedll/dlls/func_break.h @@ -152,7 +152,7 @@ public: static const char *pSoundsConcrete[3]; static const char *pSpawnObjects[32]; - static TYPEDESCRIPTION IMPLEMENT_ARRAY(m_SaveData)[5]; + static TYPEDESCRIPTION IMPL(m_SaveData)[5]; public: Materials m_Material; @@ -213,7 +213,7 @@ public: } public: - static TYPEDESCRIPTION IMPLEMENT_ARRAY(m_SaveData)[2]; + static TYPEDESCRIPTION IMPL(m_SaveData)[2]; public: static char *m_soundNames[3]; diff --git a/regamedll/dlls/func_tank.cpp b/regamedll/dlls/func_tank.cpp index cda8ced8..7b7e5c8c 100644 --- a/regamedll/dlls/func_tank.cpp +++ b/regamedll/dlls/func_tank.cpp @@ -57,9 +57,9 @@ static Vector gTankSpread[] = #else -TYPEDESCRIPTION IMPLEMENT_ARRAY_CLASS(CFuncTank, m_SaveData)[26]; -TYPEDESCRIPTION IMPLEMENT_ARRAY_CLASS(CFuncTankLaser, m_SaveData)[2]; -TYPEDESCRIPTION IMPLEMENT_ARRAY_CLASS(CFuncTankControls, m_SaveData)[1]; +TYPEDESCRIPTION IMPL_CLASS(CFuncTank, m_SaveData)[26]; +TYPEDESCRIPTION IMPL_CLASS(CFuncTankLaser, m_SaveData)[2]; +TYPEDESCRIPTION IMPL_CLASS(CFuncTankControls, m_SaveData)[1]; Vector gTankSpread[5]; #endif // HOOK_GAMEDLL diff --git a/regamedll/dlls/func_tank.h b/regamedll/dlls/func_tank.h index 424e4076..8c7f4ce9 100644 --- a/regamedll/dlls/func_tank.h +++ b/regamedll/dlls/func_tank.h @@ -131,7 +131,7 @@ public: void ControllerPostFrame(void); public: - static TYPEDESCRIPTION IMPLEMENT_ARRAY(m_SaveData)[26]; + static TYPEDESCRIPTION IMPL(m_SaveData)[26]; protected: CBasePlayer *m_pController; @@ -209,7 +209,7 @@ public: CLaser *GetLaser(void); public: - static TYPEDESCRIPTION IMPLEMENT_ARRAY(m_SaveData)[2]; + static TYPEDESCRIPTION IMPL(m_SaveData)[2]; private: CLaser *m_pLaser; @@ -274,7 +274,7 @@ public: #endif // HOOK_GAMEDLL public: - static TYPEDESCRIPTION IMPLEMENT_ARRAY(m_SaveData)[1]; + static TYPEDESCRIPTION IMPL(m_SaveData)[1]; public: CFuncTank *m_pTank; diff --git a/regamedll/dlls/game.cpp b/regamedll/dlls/game.cpp index 31981715..823f1eb7 100644 --- a/regamedll/dlls/game.cpp +++ b/regamedll/dlls/game.cpp @@ -404,7 +404,7 @@ cvar_t sk_scientist_heal3; #endif // HOOK_GAMEDLL /* <9c900> ../cstrike/dlls/game.cpp:500 */ -void GameDLLInit(void) +void EXT_FUNC GameDLLInit(void) { g_psv_gravity = CVAR_GET_POINTER("sv_gravity"); g_psv_aim = CVAR_GET_POINTER("sv_aim"); diff --git a/regamedll/dlls/game.h b/regamedll/dlls/game.h index 217f166e..04985a11 100644 --- a/regamedll/dlls/game.h +++ b/regamedll/dlls/game.h @@ -46,90 +46,90 @@ #ifdef HOOK_GAMEDLL -#define g_psv_gravity (*pg_psv_gravity) -#define g_psv_aim (*pg_psv_aim) -#define g_footsteps (*pg_footsteps) -#define g_psv_accelerate (*pg_psv_accelerate) -#define g_psv_friction (*pg_psv_friction) -#define g_psv_stopspeed (*pg_psv_stopspeed) -#define displaysoundlist (*pdisplaysoundlist) -#define timelimit (*ptimelimit) -#define flashlight (*pflashlight) -#define decalfrequency (*pdecalfrequency) -#define fadetoblack (*pfadetoblack) -#define fragsleft (*pfragsleft) -#define timeleft (*ptimeleft) -#define friendlyfire (*pfriendlyfire) -#define allowmonsters (*pallowmonsters) -#define roundtime (*proundtime) -#define buytime (*pbuytime) -#define freezetime (*pfreezetime) -#define c4timer (*pc4timer) -#define ghostfrequency (*pghostfrequency) -#define autokick (*pautokick) -#define autokick_timeout (*pautokick_timeout) -#define restartround (*prestartround) -#define sv_restart (*psv_restart) -#define limitteams (*plimitteams) -#define autoteambalance (*pautoteambalance) -#define tkpunish (*ptkpunish) -#define hostagepenalty (*phostagepenalty) -#define mirrordamage (*pmirrordamage) -#define logmessages (*plogmessages) -#define forcecamera (*pforcecamera) -#define forcechasecam (*pforcechasecam) -#define mapvoteratio (*pmapvoteratio) -#define logdetail (*plogdetail) -#define startmoney (*pstartmoney) -#define maxrounds (*pmaxrounds) -#define winlimit (*pwinlimit) -#define windifference (*pwindifference) -#define playerid (*pplayerid) -#define allow_spectators (*pallow_spectators) -#define mp_chattime (*pmp_chattime) -#define kick_percent (*pkick_percent) -#define humans_join_team (*phumans_join_team) -#define sk_plr_9mm_bullet1 (*psk_plr_9mm_bullet1) -#define sk_plr_9mm_bullet2 (*psk_plr_9mm_bullet2) -#define sk_plr_9mm_bullet3 (*psk_plr_9mm_bullet3) -#define sk_plr_357_bullet1 (*psk_plr_357_bullet1) -#define sk_plr_357_bullet2 (*psk_plr_357_bullet2) -#define sk_plr_357_bullet3 (*psk_plr_357_bullet3) -#define sk_plr_9mmAR_bullet1 (*psk_plr_9mmAR_bullet1) -#define sk_plr_9mmAR_bullet2 (*psk_plr_9mmAR_bullet2) -#define sk_plr_9mmAR_bullet3 (*psk_plr_9mmAR_bullet3) -#define sk_plr_9mmAR_grenade1 (*psk_plr_9mmAR_grenade1) -#define sk_plr_9mmAR_grenade2 (*psk_plr_9mmAR_grenade2) -#define sk_plr_9mmAR_grenade3 (*psk_plr_9mmAR_grenade3) -#define sk_plr_buckshot1 (*psk_plr_buckshot1) -#define sk_plr_buckshot2 (*psk_plr_buckshot2) -#define sk_plr_buckshot3 (*psk_plr_buckshot3) -#define sk_plr_rpg1 (*psk_plr_rpg1) -#define sk_plr_rpg2 (*psk_plr_rpg2) -#define sk_plr_rpg3 (*psk_plr_rpg3) -#define sk_12mm_bullet1 (*psk_12mm_bullet1) -#define sk_12mm_bullet2 (*psk_12mm_bullet2) -#define sk_12mm_bullet3 (*psk_12mm_bullet3) -#define sk_9mmAR_bullet1 (*psk_9mmAR_bullet1) -#define sk_9mmAR_bullet2 (*psk_9mmAR_bullet2) -#define sk_9mmAR_bullet3 (*psk_9mmAR_bullet3) -#define sk_9mm_bullet1 (*psk_9mm_bullet1) -#define sk_9mm_bullet2 (*psk_9mm_bullet2) -#define sk_9mm_bullet3 (*psk_9mm_bullet3) -#define sk_suitcharger1 (*psk_suitcharger1) -#define sk_suitcharger2 (*psk_suitcharger2) -#define sk_suitcharger3 (*psk_suitcharger3) -#define sk_battery1 (*psk_battery1) -#define sk_battery2 (*psk_battery2) -#define sk_battery3 (*psk_battery3) -#define sk_healthcharger1 (*psk_healthcharger1) -#define sk_healthcharger2 (*psk_healthcharger2) -#define sk_healthcharger3 (*psk_healthcharger3) -#define sk_healthkit1 (*psk_healthkit1) -#define sk_healthkit2 (*psk_healthkit2) -#define sk_healthkit3 (*psk_healthkit3) -#define sk_scientist_heal1 (*psk_scientist_heal1) -#define sk_scientist_heal2 (*psk_scientist_heal2) +#define g_psv_gravity (*pg_psv_gravity) +#define g_psv_aim (*pg_psv_aim) +#define g_footsteps (*pg_footsteps) +#define g_psv_accelerate (*pg_psv_accelerate) +#define g_psv_friction (*pg_psv_friction) +#define g_psv_stopspeed (*pg_psv_stopspeed) +#define displaysoundlist (*pdisplaysoundlist) +#define timelimit (*ptimelimit) +#define flashlight (*pflashlight) +#define decalfrequency (*pdecalfrequency) +#define fadetoblack (*pfadetoblack) +#define fragsleft (*pfragsleft) +#define timeleft (*ptimeleft) +#define friendlyfire (*pfriendlyfire) +#define allowmonsters (*pallowmonsters) +#define roundtime (*proundtime) +#define buytime (*pbuytime) +#define freezetime (*pfreezetime) +#define c4timer (*pc4timer) +#define ghostfrequency (*pghostfrequency) +#define autokick (*pautokick) +#define autokick_timeout (*pautokick_timeout) +#define restartround (*prestartround) +#define sv_restart (*psv_restart) +#define limitteams (*plimitteams) +#define autoteambalance (*pautoteambalance) +#define tkpunish (*ptkpunish) +#define hostagepenalty (*phostagepenalty) +#define mirrordamage (*pmirrordamage) +#define logmessages (*plogmessages) +#define forcecamera (*pforcecamera) +#define forcechasecam (*pforcechasecam) +#define mapvoteratio (*pmapvoteratio) +#define logdetail (*plogdetail) +#define startmoney (*pstartmoney) +#define maxrounds (*pmaxrounds) +#define winlimit (*pwinlimit) +#define windifference (*pwindifference) +#define playerid (*pplayerid) +#define allow_spectators (*pallow_spectators) +#define mp_chattime (*pmp_chattime) +#define kick_percent (*pkick_percent) +#define humans_join_team (*phumans_join_team) +#define sk_plr_9mm_bullet1 (*psk_plr_9mm_bullet1) +#define sk_plr_9mm_bullet2 (*psk_plr_9mm_bullet2) +#define sk_plr_9mm_bullet3 (*psk_plr_9mm_bullet3) +#define sk_plr_357_bullet1 (*psk_plr_357_bullet1) +#define sk_plr_357_bullet2 (*psk_plr_357_bullet2) +#define sk_plr_357_bullet3 (*psk_plr_357_bullet3) +#define sk_plr_9mmAR_bullet1 (*psk_plr_9mmAR_bullet1) +#define sk_plr_9mmAR_bullet2 (*psk_plr_9mmAR_bullet2) +#define sk_plr_9mmAR_bullet3 (*psk_plr_9mmAR_bullet3) +#define sk_plr_9mmAR_grenade1 (*psk_plr_9mmAR_grenade1) +#define sk_plr_9mmAR_grenade2 (*psk_plr_9mmAR_grenade2) +#define sk_plr_9mmAR_grenade3 (*psk_plr_9mmAR_grenade3) +#define sk_plr_buckshot1 (*psk_plr_buckshot1) +#define sk_plr_buckshot2 (*psk_plr_buckshot2) +#define sk_plr_buckshot3 (*psk_plr_buckshot3) +#define sk_plr_rpg1 (*psk_plr_rpg1) +#define sk_plr_rpg2 (*psk_plr_rpg2) +#define sk_plr_rpg3 (*psk_plr_rpg3) +#define sk_12mm_bullet1 (*psk_12mm_bullet1) +#define sk_12mm_bullet2 (*psk_12mm_bullet2) +#define sk_12mm_bullet3 (*psk_12mm_bullet3) +#define sk_9mmAR_bullet1 (*psk_9mmAR_bullet1) +#define sk_9mmAR_bullet2 (*psk_9mmAR_bullet2) +#define sk_9mmAR_bullet3 (*psk_9mmAR_bullet3) +#define sk_9mm_bullet1 (*psk_9mm_bullet1) +#define sk_9mm_bullet2 (*psk_9mm_bullet2) +#define sk_9mm_bullet3 (*psk_9mm_bullet3) +#define sk_suitcharger1 (*psk_suitcharger1) +#define sk_suitcharger2 (*psk_suitcharger2) +#define sk_suitcharger3 (*psk_suitcharger3) +#define sk_battery1 (*psk_battery1) +#define sk_battery2 (*psk_battery2) +#define sk_battery3 (*psk_battery3) +#define sk_healthcharger1 (*psk_healthcharger1) +#define sk_healthcharger2 (*psk_healthcharger2) +#define sk_healthcharger3 (*psk_healthcharger3) +#define sk_healthkit1 (*psk_healthkit1) +#define sk_healthkit2 (*psk_healthkit2) +#define sk_healthkit3 (*psk_healthkit3) +#define sk_scientist_heal1 (*psk_scientist_heal1) +#define sk_scientist_heal2 (*psk_scientist_heal2) #define sk_scientist_heal3 (*psk_scientist_heal3) #endif // HOOK_GAMEDLL diff --git a/regamedll/dlls/ggrenade.cpp b/regamedll/dlls/ggrenade.cpp index 62465c57..ac3a36ff 100644 --- a/regamedll/dlls/ggrenade.cpp +++ b/regamedll/dlls/ggrenade.cpp @@ -26,7 +26,7 @@ TYPEDESCRIPTION CGrenade::m_SaveData[] = #else // HOOK_GAMEDLL -TYPEDESCRIPTION IMPLEMENT_ARRAY_CLASS(CGrenade, m_SaveData)[15]; +TYPEDESCRIPTION IMPL_CLASS(CGrenade, m_SaveData)[15]; #endif // HOOK_GAMEDLL diff --git a/regamedll/dlls/h_battery.cpp b/regamedll/dlls/h_battery.cpp index 74ad7bf9..2efe12c7 100644 --- a/regamedll/dlls/h_battery.cpp +++ b/regamedll/dlls/h_battery.cpp @@ -16,7 +16,7 @@ TYPEDESCRIPTION CRecharge::m_SaveData[] = #else -TYPEDESCRIPTION IMPLEMENT_ARRAY_CLASS(CRecharge, m_SaveData)[5]; +TYPEDESCRIPTION IMPL_CLASS(CRecharge, m_SaveData)[5]; #endif // HOOK_GAMEDLL @@ -66,8 +66,8 @@ void CRecharge::__MAKE_VHOOK(Spawn)(void) /* ../cstrike/dlls/h_battery.cpp:99 */ void CRecharge::__MAKE_VHOOK(Precache)(void) { - PRECACHE_SOUND("items/suitcharge1.wav"); - PRECACHE_SOUND("items/suitchargeno1.wav"); + PRECACHE_SOUND("items/suitcharge1.wav"); + PRECACHE_SOUND("items/suitchargeno1.wav"); PRECACHE_SOUND("items/suitchargeok1.wav"); } @@ -145,26 +145,26 @@ void CRecharge::__MAKE_VHOOK(Use)(CBaseEntity *pActivator, CBaseEntity *pCaller, /* ../cstrike/dlls/h_battery.cpp:178 */ void CRecharge::Recharge(void) { - m_iJuice = gSkillData.suitchargerCapacity; - pev->frame = 0; + m_iJuice = gSkillData.suitchargerCapacity; + pev->frame = 0; SetThink(&CRecharge::SUB_DoNothing); } /* ../cstrike/dlls/h_battery.cpp:185 */ void CRecharge::Off(void) { - // Stop looping sound. - if (m_iOn > 1) - STOP_SOUND(ENT(pev), CHAN_STATIC, "items/suitcharge1.wav"); - - m_iOn = 0; - - if (!m_iJuice && (m_iReactivate = g_pGameRules->FlHEVChargerRechargeTime()) > 0) - { - pev->nextthink = pev->ltime + m_iReactivate; - SetThink(&CRecharge::Recharge); - } - else + // Stop looping sound. + if (m_iOn > 1) + STOP_SOUND(ENT(pev), CHAN_STATIC, "items/suitcharge1.wav"); + + m_iOn = 0; + + if (!m_iJuice && (m_iReactivate = g_pGameRules->FlHEVChargerRechargeTime()) > 0) + { + pev->nextthink = pev->ltime + m_iReactivate; + SetThink(&CRecharge::Recharge); + } + else SetThink(&CRecharge::SUB_DoNothing); } diff --git a/regamedll/dlls/h_battery.h b/regamedll/dlls/h_battery.h index 38647ddf..f9ae441d 100644 --- a/regamedll/dlls/h_battery.h +++ b/regamedll/dlls/h_battery.h @@ -62,7 +62,7 @@ public: void EXPORT Recharge(void); public: - static TYPEDESCRIPTION IMPLEMENT_ARRAY(m_SaveData)[5]; + static TYPEDESCRIPTION IMPL(m_SaveData)[5]; float m_flNextCharge; int m_iReactivate; diff --git a/regamedll/dlls/h_cycler.cpp b/regamedll/dlls/h_cycler.cpp index fee17958..312d8050 100644 --- a/regamedll/dlls/h_cycler.cpp +++ b/regamedll/dlls/h_cycler.cpp @@ -24,9 +24,9 @@ TYPEDESCRIPTION CWreckage::m_SaveData[] = #else -TYPEDESCRIPTION IMPLEMENT_ARRAY_CLASS(CCycler, m_SaveData)[1]; -TYPEDESCRIPTION IMPLEMENT_ARRAY_CLASS(CCyclerSprite, m_SaveData)[3]; -TYPEDESCRIPTION IMPLEMENT_ARRAY_CLASS(CWreckage, m_SaveData)[1]; +TYPEDESCRIPTION IMPL_CLASS(CCycler, m_SaveData)[1]; +TYPEDESCRIPTION IMPL_CLASS(CCyclerSprite, m_SaveData)[3]; +TYPEDESCRIPTION IMPL_CLASS(CWreckage, m_SaveData)[1]; #endif // HOOK_GAMEDLL diff --git a/regamedll/dlls/h_cycler.h b/regamedll/dlls/h_cycler.h index 8bcd8a8a..1fd138fd 100644 --- a/regamedll/dlls/h_cycler.h +++ b/regamedll/dlls/h_cycler.h @@ -31,7 +31,7 @@ #ifdef _WIN32 #pragma once #endif - + /* ../cstrike/dlls/h_cycler.cpp:35 */ class CCycler: public CBaseMonster { @@ -68,14 +68,14 @@ public: void GenericCyclerSpawn(char *szModel, Vector vecMin, Vector vecMax); public: - static TYPEDESCRIPTION IMPLEMENT_ARRAY(m_SaveData)[1]; + static TYPEDESCRIPTION IMPL(m_SaveData)[1]; int m_animate; };/* size: 408, cachelines: 7, members: 3 */ - -// we should get rid of all the other cyclers and replace them with this. - + +// we should get rid of all the other cyclers and replace them with this. + /* ../cstrike/dlls/h_cycler.cpp:67 */ class CGenericCycler: public CCycler { @@ -88,10 +88,10 @@ public: #endif // HOOK_GAMEDLL -};/* size: 408, cachelines: 7, members: 1 */ - -// Probe droid imported for tech demo compatibility - +};/* size: 408, cachelines: 7, members: 1 */ + +// Probe droid imported for tech demo compatibility + /* ../cstrike/dlls/h_cycler.cpp:80 */ class CCyclerProbe: public CCycler { @@ -104,8 +104,8 @@ public: #endif // HOOK_GAMEDLL -};/* size: 408, cachelines: 7, members: 1 */ - +};/* size: 408, cachelines: 7, members: 1 */ + /* ../cstrike/dlls/h_cycler.cpp:218 */ class CCyclerSprite: public CBaseEntity { @@ -142,7 +142,7 @@ public: } public: - static TYPEDESCRIPTION IMPLEMENT_ARRAY(m_SaveData)[3]; + static TYPEDESCRIPTION IMPL(m_SaveData)[3]; int m_animate; float m_lastTime; @@ -154,7 +154,7 @@ public: };/* size: 188, cachelines: 3, members: 9 */ - + /* ../cstrike/dlls/h_cycler.cpp:344 */ class CWeaponCycler: public CBasePlayerWeapon { @@ -188,9 +188,9 @@ public: int m_iModel; };/* size: 344, cachelines: 6, members: 3 */ - -// Flaming Wreakage - + +// Flaming Wreakage + /* ../cstrike/dlls/h_cycler.cpp:427 */ class CWreckage: public CBaseMonster { @@ -212,7 +212,7 @@ public: #endif // HOOK_GAMEDLL public: - static TYPEDESCRIPTION IMPLEMENT_ARRAY(m_SaveData)[1]; + static TYPEDESCRIPTION IMPL(m_SaveData)[1]; int m_flStartTime; @@ -221,10 +221,10 @@ public: #ifdef HOOK_GAMEDLL // linked objects -C_DLLEXPORT void cycler(entvars_t *pev); -C_DLLEXPORT void cycler_prdroid(entvars_t *pev); -C_DLLEXPORT void cycler_sprite(entvars_t *pev); -C_DLLEXPORT void cycler_weapon(entvars_t *pev); +C_DLLEXPORT void cycler(entvars_t *pev); +C_DLLEXPORT void cycler_prdroid(entvars_t *pev); +C_DLLEXPORT void cycler_sprite(entvars_t *pev); +C_DLLEXPORT void cycler_weapon(entvars_t *pev); C_DLLEXPORT void cycler_wreckage(entvars_t *pev); #endif // HOOK_GAMEDLL diff --git a/regamedll/dlls/h_export.cpp b/regamedll/dlls/h_export.cpp index 5cdf44ed..489889e9 100644 --- a/regamedll/dlls/h_export.cpp +++ b/regamedll/dlls/h_export.cpp @@ -9,7 +9,7 @@ globalvars_t *gpGlobals; // do some setup operations here. /* ../cstrike/dlls/h_export.cpp:58 */ -C_DLLEXPORT void WINAPI GiveFnptrsToDll(enginefuncs_t *pEnginefuncsTable,globalvars_t *pGlobals) +C_DLLEXPORT void WINAPI GiveFnptrsToDll(enginefuncs_t *pEnginefuncsTable, globalvars_t *pGlobals) { Q_memcpy(&g_engfuncs, pEnginefuncsTable, sizeof(enginefuncs_t)); gpGlobals = pGlobals; diff --git a/regamedll/dlls/h_export.h b/regamedll/dlls/h_export.h index 8d9bc58e..97c30101 100644 --- a/regamedll/dlls/h_export.h +++ b/regamedll/dlls/h_export.h @@ -44,7 +44,7 @@ extern globalvars_t *gpGlobals; #ifdef HOOK_GAMEDLL -C_DLLEXPORT void WINAPI GiveFnptrsToDll(enginefuncs_t *pEnginefuncsTable,globalvars_t *pGlobals); +C_DLLEXPORT void WINAPI GiveFnptrsToDll(enginefuncs_t *pEnginefuncsTable, globalvars_t *pGlobals); #endif // HOOK_GAMEDLL diff --git a/regamedll/dlls/healthkit.cpp b/regamedll/dlls/healthkit.cpp index 68153ff5..4764ddb1 100644 --- a/regamedll/dlls/healthkit.cpp +++ b/regamedll/dlls/healthkit.cpp @@ -16,7 +16,7 @@ TYPEDESCRIPTION CWallHealth::m_SaveData[] = #else -TYPEDESCRIPTION IMPLEMENT_ARRAY_CLASS(CWallHealth, m_SaveData)[5]; +TYPEDESCRIPTION IMPL_CLASS(CWallHealth, m_SaveData)[5]; #endif // HOOK_GAMEDLL diff --git a/regamedll/dlls/healthkit.h b/regamedll/dlls/healthkit.h index 686b6c40..e92d94d1 100644 --- a/regamedll/dlls/healthkit.h +++ b/regamedll/dlls/healthkit.h @@ -32,7 +32,7 @@ #pragma once #endif -/* ../cstrike/dlls/healthkit.cpp:27 */ +/* ../cstrike/dlls/healthkit.cpp:27 */ class CHealthKit: public CItem { public: @@ -50,7 +50,7 @@ public: };/* size: 152, cachelines: 3, members: 1 */ -/* ../cstrike/dlls/healthkit.cpp:99 */ +/* ../cstrike/dlls/healthkit.cpp:99 */ class CWallHealth: public CBaseToggle { public: @@ -80,7 +80,7 @@ public: void EXPORT Off(void); void EXPORT Recharge(void); - static TYPEDESCRIPTION IMPLEMENT_ARRAY(m_SaveData)[5]; + static TYPEDESCRIPTION IMPL(m_SaveData)[5]; public: float m_flNextCharge; diff --git a/regamedll/dlls/hostage/hostage.cpp b/regamedll/dlls/hostage/hostage.cpp index 31e4c59f..4ac39323 100644 --- a/regamedll/dlls/hostage/hostage.cpp +++ b/regamedll/dlls/hostage/hostage.cpp @@ -139,7 +139,7 @@ void CHostage::__MAKE_VHOOK(Precache)(void) default: break; } - + m_whichModel = static_cast(which); if (++which > 3) @@ -191,199 +191,199 @@ void CHostage::SetActivity(int act) /* <45f194> ../cstrike/dlls/hostage/hostage.cpp:204 */ void CHostage::IdleThink(void) { - float flInterval; + float flInterval; const float upkeepRate = 0.3f; - const float giveUpTime = (1 / 30.0f); + const float giveUpTime = (1 / 30.0f); float const updateRate = 0.1f; - if (!TheNavAreaList.empty()) - { - if (!m_improv) - { - m_improv = new CHostageImprov(this); - - #if defined(HOOK_GAMEDLL) && defined(_WIN32) && !defined(REGAMEDLL_UNIT_TESTS) - VirtualTableInit((void *)m_improv, "CHostageImprov"); - #endif // HOOK_GAMEDLL && _WIN32 && !REGAMEDLL_UNIT_TESTS - } - } - else - { - if (m_improv != NULL) - { - delete m_improv; - } - - m_improv = NULL; - } - - pev->nextthink = gpGlobals->time + giveUpTime; - - flInterval = StudioFrameAdvance(0); - DispatchAnimEvents(flInterval); - - if (m_improv != NULL) - { - m_improv->OnUpkeep(upkeepRate); - } - - if (m_flNextFullThink > gpGlobals->time) - { - return; - } - - m_flNextFullThink = gpGlobals->time + 0.1; - - if (pev->deadflag == DEAD_DEAD) - { - UTIL_SetSize(pev, Vector(0, 0, 0), Vector(0, 0, 0)); - return; - } - - if (m_hTargetEnt != NULL && (m_bStuck && gpGlobals->time - m_flStuckTime > 5.0 || m_hTargetEnt->pev->deadflag != DEAD_NO)) - { - m_State = STAND; - m_hTargetEnt = NULL; - m_bStuck = FALSE; - } - - if (m_hTargetEnt != NULL || m_improv != NULL) - { - CBasePlayer *player = NULL; - - if (m_improv != NULL) - { - if (IsFollowingSomeone()) - { - player = (CBasePlayer *)m_improv->GetFollowLeader(); - } - } - else - { - player = GetClassPtr((CBasePlayer *)m_hTargetEnt->pev); - } - - if (!player || player->m_iTeam == CT) - { - if (!g_pGameRules->m_bMapHasRescueZone) - { - BOOL bContinue = FALSE; - BOOL bResHostagePt = FALSE; - - if (UTIL_FindEntityByClassname(NULL, "info_hostage_rescue")) - bResHostagePt = TRUE; - - CBaseEntity *pSpot = NULL; - - while ((pSpot = UTIL_FindEntityByClassname(pSpot, "info_hostage_rescue")) != NULL) - { - if ((pSpot->pev->origin - pev->origin).Length() < 256) - { - m_bRescueMe = TRUE; - break; - } - } - - if (!bResHostagePt) - { - pSpot = NULL; - - while ((pSpot = UTIL_FindEntityByClassname(pSpot, "info_player_start")) != NULL) - { - if ((pSpot->pev->origin - pev->origin).Length() < 256) - { - m_bRescueMe = TRUE; - break; - } - } - } - } - - if (m_bRescueMe) - { - if (TheBots != NULL) - { - TheBots->OnEvent(EVENT_HOSTAGE_RESCUED, player, this); - } - - if (TheCareerTasks != NULL && g_pGameRules->IsCareer() && player != NULL && !player->IsBot()) - { - TheCareerTasks->HandleEvent(EVENT_HOSTAGE_RESCUED, player); - } - - pev->deadflag = DEAD_RESPAWNABLE; - - if (player != NULL) - { - player->AddAccount(1000); - UTIL_LogPrintf("\"%s<%i><%s>\" triggered \"Rescued_A_Hostage\"\n", STRING(player->pev->netname), - GETPLAYERUSERID(player->edict()), GETPLAYERAUTHID(player->edict())); - } - - SendHostageEventMsg(); - - MESSAGE_BEGIN(MSG_SPEC, SVC_DIRECTOR); - WRITE_BYTE(9); - WRITE_BYTE(DRC_CMD_EVENT); - WRITE_SHORT((player != NULL) ? player->entindex() : 0); - WRITE_SHORT(player->entindex()); - WRITE_LONG(15); - MESSAGE_END(); - - pev->effects |= EF_NODRAW; - Remove(); - - g_pGameRules->m_iHostagesRescued++; - g_pGameRules->CheckWinConditions(); - - Broadcast((player != NULL) ? "rescued" : "escaped"); - } - } - } - - if (m_improv != NULL) - { - m_improv->OnUpdate(updateRate); - } - else - { - DoFollow(); - - if (gpGlobals->time >= m_flFlinchTime) - { - if (pev->velocity.Length() > 160) - { - SetActivity(ACT_RUN); - } - else if (pev->velocity.Length() > 15) - { - SetActivity(ACT_WALK); - } - else - { - SetActivity(ACT_IDLE); - } - } - } - - if (pev->deadflag != DEAD_DEAD && !(pev->effects & EF_NODRAW)) - { - if (m_flNextRadarTime <= gpGlobals->time) - { - Vector vDistance = m_vOldPos - pev->origin; - - if (vDistance.Length() > 1) - { - m_vOldPos = pev->origin; - - if (!g_pGameRules->m_fTeamCount) - { - SendHostagePositionMsg(); - } - } - - m_flNextRadarTime = gpGlobals->time + 1; - } + if (!TheNavAreaList.empty()) + { + if (!m_improv) + { + m_improv = new CHostageImprov(this); + + #if defined(HOOK_GAMEDLL) && defined(_WIN32) && !defined(REGAMEDLL_UNIT_TESTS) + VirtualTableInit((void *)m_improv, "CHostageImprov"); + #endif // HOOK_GAMEDLL && _WIN32 && !REGAMEDLL_UNIT_TESTS + } + } + else + { + if (m_improv != NULL) + { + delete m_improv; + } + + m_improv = NULL; + } + + pev->nextthink = gpGlobals->time + giveUpTime; + + flInterval = StudioFrameAdvance(0); + DispatchAnimEvents(flInterval); + + if (m_improv != NULL) + { + m_improv->OnUpkeep(upkeepRate); + } + + if (m_flNextFullThink > gpGlobals->time) + { + return; + } + + m_flNextFullThink = gpGlobals->time + 0.1; + + if (pev->deadflag == DEAD_DEAD) + { + UTIL_SetSize(pev, Vector(0, 0, 0), Vector(0, 0, 0)); + return; + } + + if (m_hTargetEnt != NULL && (m_bStuck && gpGlobals->time - m_flStuckTime > 5.0 || m_hTargetEnt->pev->deadflag != DEAD_NO)) + { + m_State = STAND; + m_hTargetEnt = NULL; + m_bStuck = FALSE; + } + + if (m_hTargetEnt != NULL || m_improv != NULL) + { + CBasePlayer *player = NULL; + + if (m_improv != NULL) + { + if (IsFollowingSomeone()) + { + player = (CBasePlayer *)m_improv->GetFollowLeader(); + } + } + else + { + player = GetClassPtr((CBasePlayer *)m_hTargetEnt->pev); + } + + if (!player || player->m_iTeam == CT) + { + if (!g_pGameRules->m_bMapHasRescueZone) + { + BOOL bContinue = FALSE; + BOOL bResHostagePt = FALSE; + + if (UTIL_FindEntityByClassname(NULL, "info_hostage_rescue")) + bResHostagePt = TRUE; + + CBaseEntity *pSpot = NULL; + + while ((pSpot = UTIL_FindEntityByClassname(pSpot, "info_hostage_rescue")) != NULL) + { + if ((pSpot->pev->origin - pev->origin).Length() < 256) + { + m_bRescueMe = TRUE; + break; + } + } + + if (!bResHostagePt) + { + pSpot = NULL; + + while ((pSpot = UTIL_FindEntityByClassname(pSpot, "info_player_start")) != NULL) + { + if ((pSpot->pev->origin - pev->origin).Length() < 256) + { + m_bRescueMe = TRUE; + break; + } + } + } + } + + if (m_bRescueMe) + { + if (TheBots != NULL) + { + TheBots->OnEvent(EVENT_HOSTAGE_RESCUED, player, this); + } + + if (TheCareerTasks != NULL && g_pGameRules->IsCareer() && player != NULL && !player->IsBot()) + { + TheCareerTasks->HandleEvent(EVENT_HOSTAGE_RESCUED, player); + } + + pev->deadflag = DEAD_RESPAWNABLE; + + if (player != NULL) + { + player->AddAccount(1000); + UTIL_LogPrintf("\"%s<%i><%s>\" triggered \"Rescued_A_Hostage\"\n", STRING(player->pev->netname), + GETPLAYERUSERID(player->edict()), GETPLAYERAUTHID(player->edict())); + } + + SendHostageEventMsg(); + + MESSAGE_BEGIN(MSG_SPEC, SVC_DIRECTOR); + WRITE_BYTE(9); + WRITE_BYTE(DRC_CMD_EVENT); + WRITE_SHORT((player != NULL) ? player->entindex() : 0); + WRITE_SHORT(player->entindex()); + WRITE_LONG(15); + MESSAGE_END(); + + pev->effects |= EF_NODRAW; + Remove(); + + g_pGameRules->m_iHostagesRescued++; + g_pGameRules->CheckWinConditions(); + + Broadcast((player != NULL) ? "rescued" : "escaped"); + } + } + } + + if (m_improv != NULL) + { + m_improv->OnUpdate(updateRate); + } + else + { + DoFollow(); + + if (gpGlobals->time >= m_flFlinchTime) + { + if (pev->velocity.Length() > 160) + { + SetActivity(ACT_RUN); + } + else if (pev->velocity.Length() > 15) + { + SetActivity(ACT_WALK); + } + else + { + SetActivity(ACT_IDLE); + } + } + } + + if (pev->deadflag != DEAD_DEAD && !(pev->effects & EF_NODRAW)) + { + if (m_flNextRadarTime <= gpGlobals->time) + { + Vector vDistance = m_vOldPos - pev->origin; + + if (vDistance.Length() > 1) + { + m_vOldPos = pev->origin; + + if (!g_pGameRules->m_fTeamCount) + { + SendHostagePositionMsg(); + } + } + + m_flNextRadarTime = gpGlobals->time + 1; + } } } @@ -614,12 +614,12 @@ void CHostage::SetDeathActivity(void) case HITGROUP_RIGHTLEG: SetActivity(ACT_DIESIMPLE); break; - case HITGROUP_HEAD: - SetActivity(ACT_DIE_HEADSHOT); - break; - case HITGROUP_CHEST: - SetActivity(ACT_DIE_CHESTSHOT); - break; + case HITGROUP_HEAD: + SetActivity(ACT_DIE_HEADSHOT); + break; + case HITGROUP_CHEST: + SetActivity(ACT_DIE_CHESTSHOT); + break; case HITGROUP_STOMACH: SetActivity(ACT_DIE_GUTSHOT); break; @@ -654,7 +654,7 @@ void CHostage::SetDeathActivity(void) void CHostage::AnnounceDeath(CBasePlayer *pAttacker) { ClientPrint(pAttacker->pev, HUD_PRINTCENTER, "#Killed_Hostage"); - + if (!(pAttacker->m_flDisplayHistory & DHF_HOSTAGE_KILLED)) { pAttacker->HintMessage("#Hint_lost_money"); @@ -713,7 +713,7 @@ void CHostage::__MAKE_VHOOK(Use)(CBaseEntity *pActivator, CBaseEntity *pCaller, return; CBasePlayer *pPlayer = (CBasePlayer *)pActivator; - + if (pPlayer->m_iTeam != CT) { if (!(pPlayer->m_flDisplayHistory & DHF_HOSTAGE_CTMOVE)) @@ -810,7 +810,7 @@ void CHostage::GiveCTTouchBonus(CBasePlayer *pPlayer) /* <45bf69> ../cstrike/dlls/hostage/hostage.cpp:869 */ int CHostage::__MAKE_VHOOK(ObjectCaps)(void) { - return CBaseMonster::ObjectCaps() | FCAP_MUST_SPAWN | FCAP_ONOFF_USE; + return (CBaseMonster::ObjectCaps() | FCAP_MUST_SPAWN | FCAP_ONOFF_USE); } /* <45c0e3> ../cstrike/dlls/hostage/hostage.cpp:876 */ @@ -856,104 +856,104 @@ void CHostage::DoFollow(void) { CBaseEntity *pFollowing; Vector vecDest; - float flRadius = 0; + float flRadius = 0; float flDistToDest; - - if (m_hTargetEnt == NULL) - return; - - if (cv_hostage_stop.value > 0.0) - { - m_State = STAND; - m_hTargetEnt = NULL; - m_hStoppedTargetEnt = NULL; - return; - } - - pFollowing = GetClassPtr((CBaseEntity *)m_hTargetEnt->pev); - m_LocalNav->SetTargetEnt(pFollowing); - - vecDest = pFollowing->pev->origin; - vecDest.z += pFollowing->pev->mins.z; - flDistToDest = (vecDest - pev->origin).Length(); - - if (flDistToDest < 80 && (m_fHasPath || m_LocalNav->PathTraversable(pev->origin, vecDest, TRUE))) - return; - - if (pev->flags & FL_ONGROUND) - { - if (m_flPathCheckInterval + m_flLastPathCheck < gpGlobals->time) - { - if (!m_fHasPath || pFollowing->pev->velocity.Length2D() > 1) - { - m_flLastPathCheck = gpGlobals->time; - m_LocalNav->RequestNav(this); - } - } - } - - if (m_fHasPath) - { - nTargetNode = m_LocalNav->GetFurthestTraversableNode(pev->origin, vecNodes, m_nPathNodes, TRUE); - - if (!nTargetNode) - { - if ((vecNodes[nTargetNode] - pev->origin).Length2D() < HOSTAGE_STEPSIZE) - nTargetNode = -1; - } - if (nTargetNode == -1) - { - m_fHasPath = FALSE; - m_flPathCheckInterval = 0.1f; - } - } - - if (gpGlobals->time < m_flFlinchTime) - return; - - if (nTargetNode != -1) - { - if (pev->flags & FL_ONGROUND) - PointAt(vecNodes[nTargetNode]); - - if (pev->movetype == MOVETYPE_FLY) - pev->v_angle.x = -60; - - MoveToward(vecNodes[nTargetNode]); - m_bStuck = FALSE; - } - else if (pev->takedamage == DAMAGE_YES) - { - if (m_improv != NULL) - { - if (IsFollowingSomeone()) - { - if (!m_bStuck && flDistToDest > 200) - { - m_bStuck = TRUE; - m_flStuckTime = gpGlobals->time; - } - } - } - else if (m_hTargetEnt != NULL && m_State == FOLLOW) - { - if (!m_bStuck && flDistToDest > 200) - { - m_bStuck = TRUE; - m_flStuckTime = gpGlobals->time; - } - } - } - - if (pev->flags & FL_ONGROUND) - { - if (m_flPathAcquired != -1 && m_flPathAcquired + 2 > gpGlobals->time) - { - if (pev->velocity.Length2D() < 1 || nTargetNode == -1) - { - Wiggle(); - } - } + + if (m_hTargetEnt == NULL) + return; + + if (cv_hostage_stop.value > 0.0) + { + m_State = STAND; + m_hTargetEnt = NULL; + m_hStoppedTargetEnt = NULL; + return; + } + + pFollowing = GetClassPtr((CBaseEntity *)m_hTargetEnt->pev); + m_LocalNav->SetTargetEnt(pFollowing); + + vecDest = pFollowing->pev->origin; + vecDest.z += pFollowing->pev->mins.z; + flDistToDest = (vecDest - pev->origin).Length(); + + if (flDistToDest < 80 && (m_fHasPath || m_LocalNav->PathTraversable(pev->origin, vecDest, TRUE))) + return; + + if (pev->flags & FL_ONGROUND) + { + if (m_flPathCheckInterval + m_flLastPathCheck < gpGlobals->time) + { + if (!m_fHasPath || pFollowing->pev->velocity.Length2D() > 1) + { + m_flLastPathCheck = gpGlobals->time; + m_LocalNav->RequestNav(this); + } + } + } + + if (m_fHasPath) + { + nTargetNode = m_LocalNav->GetFurthestTraversableNode(pev->origin, vecNodes, m_nPathNodes, TRUE); + + if (!nTargetNode) + { + if ((vecNodes[nTargetNode] - pev->origin).Length2D() < HOSTAGE_STEPSIZE) + nTargetNode = -1; + } + if (nTargetNode == -1) + { + m_fHasPath = FALSE; + m_flPathCheckInterval = 0.1f; + } + } + + if (gpGlobals->time < m_flFlinchTime) + return; + + if (nTargetNode != -1) + { + if (pev->flags & FL_ONGROUND) + PointAt(vecNodes[nTargetNode]); + + if (pev->movetype == MOVETYPE_FLY) + pev->v_angle.x = -60; + + MoveToward(vecNodes[nTargetNode]); + m_bStuck = FALSE; + } + else if (pev->takedamage == DAMAGE_YES) + { + if (m_improv != NULL) + { + if (IsFollowingSomeone()) + { + if (!m_bStuck && flDistToDest > 200) + { + m_bStuck = TRUE; + m_flStuckTime = gpGlobals->time; + } + } + } + else if (m_hTargetEnt != NULL && m_State == FOLLOW) + { + if (!m_bStuck && flDistToDest > 200) + { + m_bStuck = TRUE; + m_flStuckTime = gpGlobals->time; + } + } + } + + if (pev->flags & FL_ONGROUND) + { + if (m_flPathAcquired != -1 && m_flPathAcquired + 2 > gpGlobals->time) + { + if (pev->velocity.Length2D() < 1 || nTargetNode == -1) + { + Wiggle(); + } + } } } @@ -1621,7 +1621,7 @@ char *SimpleChatter::GetSound(HostageChatterType type, float *duration) /* <45ea1b> ../cstrike/dlls/hostage/hostage.cpp:1818 */ float SimpleChatter::PlaySound(CBaseEntity *entity, HostageChatterType type) -{ +{ CHostage *hostage; float duration; char *sound; diff --git a/regamedll/dlls/hostage/hostage.h b/regamedll/dlls/hostage/hostage.h index 29ee0705..d508e839 100644 --- a/regamedll/dlls/hostage/hostage.h +++ b/regamedll/dlls/hostage/hostage.h @@ -320,24 +320,20 @@ public: } template - bool ForEachHostage(T &func) + bool ForEachHostage(T &func) const { - UNTESTED - for (int i = 0; i < m_hostageCount; i++) { CHostage *pHostage = m_hostage[ i ]; - if (pHostage->deadflag != DEAD_NO || pHostage->takedamage != DAMAGE_YES) + if (pHostage->pev->deadflag == DEAD_DEAD) continue; - if (!pHostage->m_improv) - break; - - if (func(pHostage)) - return true; + if (func(pHostage) == false) + return false; } - return false; + + return true; } private: diff --git a/regamedll/dlls/hostage/hostage_localnav.cpp b/regamedll/dlls/hostage/hostage_localnav.cpp index 7a867ea4..2255b43e 100644 --- a/regamedll/dlls/hostage/hostage_localnav.cpp +++ b/regamedll/dlls/hostage/hostage_localnav.cpp @@ -29,30 +29,30 @@ int (*CLocalNav::ptot_hostages); #endif // HOOK_GAMEDLL -/* <485b67> ../cstrike/dlls/hostage/hostage_localnav.cpp:45 */ -CLocalNav::CLocalNav(CHostage *pOwner) -{ +/* <485b67> ../cstrike/dlls/hostage/hostage_localnav.cpp:45 */ +CLocalNav::CLocalNav(CHostage *pOwner) +{ m_pOwner = pOwner; m_pTargetEnt = NULL; - m_nodeArr = new localnode_t[MAX_NODES]; - + m_nodeArr = new localnode_t[MAX_NODES]; + if (tot_hostages >= MAX_HOSTAGES_NAV) - { - return; - } - - hostages[tot_hostages++] = pOwner; -} - -/* <485b09> ../cstrike/dlls/hostage/hostage_localnav.cpp:68 */ -CLocalNav::~CLocalNav(void) -{ - delete m_nodeArr; -} - -/* <485b91> ../cstrike/dlls/hostage/hostage_localnav.cpp:74 */ -node_index_t CLocalNav::AddNode(node_index_t nindexParent, Vector &vecLoc, int offsetX, int offsetY, byte bDepth) -{ + { + return; + } + + hostages[tot_hostages++] = pOwner; +} + +/* <485b09> ../cstrike/dlls/hostage/hostage_localnav.cpp:68 */ +CLocalNav::~CLocalNav(void) +{ + delete m_nodeArr; +} + +/* <485b91> ../cstrike/dlls/hostage/hostage_localnav.cpp:74 */ +node_index_t CLocalNav::AddNode(node_index_t nindexParent, Vector &vecLoc, int offsetX, int offsetY, byte bDepth) +{ localnode_t *nodeNew; if (m_nindexAvailableNode == MAX_NODES) @@ -67,54 +67,54 @@ node_index_t CLocalNav::AddNode(node_index_t nindexParent, Vector &vecLoc, int o nodeNew->fSearched = FALSE; nodeNew->nindexParent = nindexParent; - return m_nindexAvailableNode++; -} - -/* <485570> ../cstrike/dlls/hostage/hostage_localnav.cpp:94 */ -localnode_t *CLocalNav::GetNode(node_index_t nindex) -{ - return &m_nodeArr[ nindex ]; -} - -/* <485c01> ../cstrike/dlls/hostage/hostage_localnav.cpp:100 */ -node_index_t CLocalNav::NodeExists(int offsetX, int offsetY) -{ - node_index_t nindexCurrent = NODE_INVALID_EMPTY; - localnode_t *nodeCurrent; - - for (nindexCurrent = m_nindexAvailableNode - 1; nindexCurrent != NODE_INVALID_EMPTY; nindexCurrent--) - { - nodeCurrent = GetNode(nindexCurrent); - - if (nodeCurrent->offsetX == offsetX && nodeCurrent->offsetY == offsetY) - { - break; - } - } - - return nindexCurrent; -} - -/* <486d46> ../cstrike/dlls/hostage/hostage_localnav.cpp:123 */ -void CLocalNav::AddPathNodes(node_index_t nindexSource, int fNoMonsters) -{ - AddPathNode(nindexSource, 1, 0, fNoMonsters); - AddPathNode(nindexSource, -1, 0, fNoMonsters); - AddPathNode(nindexSource, 0, 1, fNoMonsters); - AddPathNode(nindexSource, 0, -1, fNoMonsters); - AddPathNode(nindexSource, 1, 1, fNoMonsters); - AddPathNode(nindexSource, 1, -1, fNoMonsters); - AddPathNode(nindexSource, -1, 1, fNoMonsters); - AddPathNode(nindexSource, -1, -1, fNoMonsters); -} - -/* <486adb> ../cstrike/dlls/hostage/hostage_localnav.cpp:138 */ -void CLocalNav::AddPathNode(node_index_t nindexSource, int offsetX, int offsetY, int fNoMonsters) -{ - int bDepth; + return m_nindexAvailableNode++; +} + +/* <485570> ../cstrike/dlls/hostage/hostage_localnav.cpp:94 */ +localnode_t *CLocalNav::GetNode(node_index_t nindex) +{ + return &m_nodeArr[ nindex ]; +} + +/* <485c01> ../cstrike/dlls/hostage/hostage_localnav.cpp:100 */ +node_index_t CLocalNav::NodeExists(int offsetX, int offsetY) +{ + node_index_t nindexCurrent = NODE_INVALID_EMPTY; + localnode_t *nodeCurrent; + + for (nindexCurrent = m_nindexAvailableNode - 1; nindexCurrent != NODE_INVALID_EMPTY; nindexCurrent--) + { + nodeCurrent = GetNode(nindexCurrent); + + if (nodeCurrent->offsetX == offsetX && nodeCurrent->offsetY == offsetY) + { + break; + } + } + + return nindexCurrent; +} + +/* <486d46> ../cstrike/dlls/hostage/hostage_localnav.cpp:123 */ +void CLocalNav::AddPathNodes(node_index_t nindexSource, int fNoMonsters) +{ + AddPathNode(nindexSource, 1, 0, fNoMonsters); + AddPathNode(nindexSource, -1, 0, fNoMonsters); + AddPathNode(nindexSource, 0, 1, fNoMonsters); + AddPathNode(nindexSource, 0, -1, fNoMonsters); + AddPathNode(nindexSource, 1, 1, fNoMonsters); + AddPathNode(nindexSource, 1, -1, fNoMonsters); + AddPathNode(nindexSource, -1, 1, fNoMonsters); + AddPathNode(nindexSource, -1, -1, fNoMonsters); +} + +/* <486adb> ../cstrike/dlls/hostage/hostage_localnav.cpp:138 */ +void CLocalNav::AddPathNode(node_index_t nindexSource, int offsetX, int offsetY, int fNoMonsters) +{ + int bDepth; Vector vecSource, vecDest; int offsetXAbs, offsetYAbs; - + if (nindexSource == -1) { bDepth = 1; @@ -124,9 +124,9 @@ void CLocalNav::AddPathNode(node_index_t nindexSource, int offsetX, int offsetY, vecSource = m_vecStartingLoc; vecDest = vecSource + Vector(((float_precision)offsetX * HOSTAGE_STEPSIZE), ((float_precision)offsetY * HOSTAGE_STEPSIZE), 0); - } - else - { + } + else + { localnode_t *nodeSource; localnode_t *nodeCurrent; node_index_t nindexCurrent; @@ -144,7 +144,7 @@ void CLocalNav::AddPathNode(node_index_t nindexSource, int offsetX, int offsetY, vecSource = nodeCurrent->vecLoc; vecDest = vecSource + Vector(((float_precision)offsetX * HOSTAGE_STEPSIZE), ((float_precision)offsetY * HOSTAGE_STEPSIZE), 0); - + if (m_nindexAvailableNode) { nindexCurrent = m_nindexAvailableNode; @@ -198,37 +198,37 @@ void CLocalNav::AddPathNode(node_index_t nindexSource, int offsetX, int offsetY, } vecSource = nodeCurrent->vecLoc; - bDepth = ((int)nodeCurrent->bDepth) + 1; - } - + bDepth = ((int)nodeCurrent->bDepth) + 1; + } + if (PathTraversable(vecSource, vecDest, fNoMonsters) != PATH_TRAVERSABLE_EMPTY) - { - AddNode(nindexSource, vecDest, offsetXAbs, offsetYAbs, bDepth); - } -} - -/* <485c63> ../cstrike/dlls/hostage/hostage_localnav.cpp:205 */ -node_index_t CLocalNav::GetBestNode(Vector &vecOrigin, Vector &vecDest) -{ - node_index_t nindexCurrent; - localnode_t *nodeCurrent; - node_index_t nindexBest; - float flBestVal; - + { + AddNode(nindexSource, vecDest, offsetXAbs, offsetYAbs, bDepth); + } +} + +/* <485c63> ../cstrike/dlls/hostage/hostage_localnav.cpp:205 */ +node_index_t CLocalNav::GetBestNode(Vector &vecOrigin, Vector &vecDest) +{ + node_index_t nindexCurrent; + localnode_t *nodeCurrent; + node_index_t nindexBest; + float flBestVal; + nindexBest = -1; - nindexCurrent = 0; - flBestVal = 1000000.0; - + nindexCurrent = 0; + flBestVal = 1000000.0; + while (nindexCurrent < m_nindexAvailableNode) { nodeCurrent = GetNode(nindexCurrent); if (!nodeCurrent->fSearched) { - float_precision flCurrentVal; - float_precision flDistFromStart; - - float flDistToDest; + float_precision flCurrentVal; + float_precision flDistFromStart; + + float flDistToDest; float_precision flZDiff = -1.0; flDistFromStart = LengthSubtract @@ -255,13 +255,13 @@ node_index_t CLocalNav::GetBestNode(Vector &vecOrigin, Vector &vecDest) } nindexCurrent++; - } - - return nindexBest; -} - -/* <485d79> ../cstrike/dlls/hostage/hostage_localnav.cpp:263 */ -int CLocalNav::SetupPathNodes(node_index_t nindex, Vector *vecNodes, int fNoMonsters) + } + + return nindexBest; +} + +/* <485d79> ../cstrike/dlls/hostage/hostage_localnav.cpp:263 */ +int CLocalNav::SetupPathNodes(node_index_t nindex, Vector *vecNodes, int fNoMonsters) { node_index_t nCurrentIndex = nindex; int nNodeCount = 0; @@ -275,12 +275,12 @@ int CLocalNav::SetupPathNodes(node_index_t nindex, Vector *vecNodes, int fNoMons nCurrentIndex = nodeCurrent->nindexParent; } - return nNodeCount; -} - -/* <486a56> ../cstrike/dlls/hostage/hostage_localnav.cpp:290 */ -int CLocalNav::GetFurthestTraversableNode(Vector &vecStartingLoc, Vector *vecNodes, int nTotalNodes, int fNoMonsters) -{ + return nNodeCount; +} + +/* <486a56> ../cstrike/dlls/hostage/hostage_localnav.cpp:290 */ +int CLocalNav::GetFurthestTraversableNode(Vector &vecStartingLoc, Vector *vecNodes, int nTotalNodes, int fNoMonsters) +{ int nCount = 0; while (nCount < nTotalNodes) { @@ -290,11 +290,11 @@ int CLocalNav::GetFurthestTraversableNode(Vector &vecStartingLoc, Vector *vecNod nCount++; } - return -1; -} - -/* <486d8d> ../cstrike/dlls/hostage/hostage_localnav.cpp:304 */ -node_index_t CLocalNav::FindPath(Vector &vecStart, Vector &vecDest, float flTargetRadius, int fNoMonsters) + return -1; +} + +/* <486d8d> ../cstrike/dlls/hostage/hostage_localnav.cpp:304 */ +node_index_t CLocalNav::FindPath(Vector &vecStart, Vector &vecDest, float flTargetRadius, int fNoMonsters) { node_index_t nIndexBest = FindDirectPath(vecStart, vecDest, flTargetRadius, fNoMonsters); @@ -388,29 +388,29 @@ node_index_t CLocalNav::FindPath(Vector &vecStart, Vector &vecDest, float flTarg else nodeval += 169; - return nIndexBest; -} - -/* <4867dc> ../cstrike/dlls/hostage/hostage_localnav.cpp:413 */ -node_index_t CLocalNav::FindDirectPath(Vector &vecStart, Vector &vecDest, float flTargetRadius, int fNoMonsters) -{ + return nIndexBest; +} + +/* <4867dc> ../cstrike/dlls/hostage/hostage_localnav.cpp:413 */ +node_index_t CLocalNav::FindDirectPath(Vector &vecStart, Vector &vecDest, float flTargetRadius, int fNoMonsters) +{ Vector vecActualDest; Vector vecPathDir; Vector vecNodeLoc; node_index_t nindexLast; vecPathDir = NormalizeSubtract(vecStart, vecDest); - vecActualDest = vecDest - (vecPathDir * flTargetRadius); - - if (PathTraversable(vecStart, vecActualDest, fNoMonsters) == PATH_TRAVERSABLE_EMPTY) - { - return -1; - } - - nindexLast = -1; - vecNodeLoc = vecStart; - m_nindexAvailableNode = 0; - + vecActualDest = vecDest - (vecPathDir * flTargetRadius); + + if (PathTraversable(vecStart, vecActualDest, fNoMonsters) == PATH_TRAVERSABLE_EMPTY) + { + return -1; + } + + nindexLast = -1; + vecNodeLoc = vecStart; + m_nindexAvailableNode = 0; + while ((vecNodeLoc - vecActualDest).Length2D() >= HOSTAGE_STEPSIZE) { node_index_t nindexCurrent = nindexLast; @@ -420,14 +420,14 @@ node_index_t CLocalNav::FindDirectPath(Vector &vecStart, Vector &vecDest, float if (nindexLast == -1) break; - } - - return nindexLast; -} - -/* <485e40> ../cstrike/dlls/hostage/hostage_localnav.cpp:449 */ -BOOL CLocalNav::PathClear(Vector &vecOrigin, Vector &vecDest, int fNoMonsters, TraceResult &tr) -{ + } + + return nindexLast; +} + +/* <485e40> ../cstrike/dlls/hostage/hostage_localnav.cpp:449 */ +BOOL CLocalNav::PathClear(Vector &vecOrigin, Vector &vecDest, int fNoMonsters, TraceResult &tr) +{ TRACE_MONSTER_HULL(m_pOwner->edict(), vecOrigin, vecDest, fNoMonsters, m_pOwner->edict(), &tr); if (tr.fStartSolid) @@ -442,46 +442,46 @@ BOOL CLocalNav::PathClear(Vector &vecOrigin, Vector &vecDest, int fNoMonsters, T return TRUE; } - return FALSE; -} - -/* <485ecf> ../cstrike/dlls/hostage/hostage_localnav.cpp:472 */ -int CLocalNav::PathTraversable(Vector &vecSource, Vector &vecDest, int fNoMonsters) -{ - TraceResult tr; - Vector vecSrcTmp; - Vector vecDestTmp; - Vector vecDir; - float_precision flTotal; - int retval = PATH_TRAVERSABLE_EMPTY; - - vecSrcTmp = vecSource; - vecDestTmp = vecDest - vecSource; - - vecDir = vecDestTmp.NormalizePrecision(); - vecDir.z = 0; - - flTotal = vecDestTmp.Length2D(); - - while (flTotal > 1.0) - { - if (flTotal >= s_flStepSize) - { -#ifndef HOOK_GAMEDLL - vecDestTmp = vecSrcTmp + (vecDir * s_flStepSize); -#else - // fix test demo + return FALSE; +} + +/* <485ecf> ../cstrike/dlls/hostage/hostage_localnav.cpp:472 */ +int CLocalNav::PathTraversable(Vector &vecSource, Vector &vecDest, int fNoMonsters) +{ + TraceResult tr; + Vector vecSrcTmp; + Vector vecDestTmp; + Vector vecDir; + float_precision flTotal; + int retval = PATH_TRAVERSABLE_EMPTY; + + vecSrcTmp = vecSource; + vecDestTmp = vecDest - vecSource; + + vecDir = vecDestTmp.NormalizePrecision(); + vecDir.z = 0; + + flTotal = vecDestTmp.Length2D(); + + while (flTotal > 1.0) + { + if (flTotal >= s_flStepSize) + { +#ifndef HOOK_GAMEDLL + vecDestTmp = vecSrcTmp + (vecDir * s_flStepSize); +#else + // fix test demo vecDestTmp[0] = vecSrcTmp[0] + (vecDir[0] * s_flStepSize); vecDestTmp[1] = vecSrcTmp[1] + (float)(vecDir[1] * s_flStepSize); - vecDestTmp[2] = vecSrcTmp[2] + (vecDir[2] * s_flStepSize); -#endif // HOOK_GAMEDLL - - } - else - vecDestTmp = vecDest; - - m_fTargetEntHit = FALSE; - + vecDestTmp[2] = vecSrcTmp[2] + (vecDir[2] * s_flStepSize); +#endif // HOOK_GAMEDLL + + } + else + vecDestTmp = vecDest; + + m_fTargetEntHit = FALSE; + if (PathClear(vecSrcTmp, vecDestTmp, fNoMonsters, tr)) { vecDestTmp = tr.vecEndPos; @@ -508,8 +508,8 @@ int CLocalNav::PathTraversable(Vector &vecSource, Vector &vecDest, int fNoMonste vecSrcTmp = tr.vecEndPos; - if (tr.vecPlaneNormal.z <= 0.7) - { + if (tr.vecPlaneNormal.z <= 0.7) + { if (StepTraversable(vecSrcTmp, vecDestTmp, fNoMonsters, tr)) { if (retval == PATH_TRAVERSABLE_EMPTY) @@ -527,30 +527,30 @@ int CLocalNav::PathTraversable(Vector &vecSource, Vector &vecDest, int fNoMonste if (retval == PATH_TRAVERSABLE_EMPTY) { retval = PATH_TRAVERSABLE_STEPJUMPABLE; - } - } - } - else - { + } + } + } + else + { if (!SlopeTraversable(vecSrcTmp, vecDestTmp, fNoMonsters, tr)) { return PATH_TRAVERSABLE_EMPTY; } if (retval == PATH_TRAVERSABLE_EMPTY) - { - retval = PATH_TRAVERSABLE_SLOPE; + { + retval = PATH_TRAVERSABLE_SLOPE; } } } - + Vector vecDropDest = vecDestTmp - Vector(0, 0, 300); if (PathClear(vecDestTmp, vecDropDest, fNoMonsters, tr)) - { - return PATH_TRAVERSABLE_EMPTY; - } - + { + return PATH_TRAVERSABLE_EMPTY; + } + if (!tr.fStartSolid) vecDestTmp = tr.vecEndPos; @@ -561,17 +561,17 @@ int CLocalNav::PathTraversable(Vector &vecSource, Vector &vecDest, int fNoMonste if (fProgressThisTime) break; - - flTotal = vecSrcThisTime.Length2D(); - } + + flTotal = vecSrcThisTime.Length2D(); + } vecDest = vecDestTmp; - return retval; -} - -/* <486ea0> ../cstrike/dlls/hostage/hostage_localnav.cpp:593 */ -BOOL CLocalNav::SlopeTraversable(Vector &vecSource, Vector &vecDest, int fNoMonsters, TraceResult &tr) + return retval; +} + +/* <486ea0> ../cstrike/dlls/hostage/hostage_localnav.cpp:593 */ +BOOL CLocalNav::SlopeTraversable(Vector &vecSource, Vector &vecDest, int fNoMonsters, TraceResult &tr) { Vector vecSlopeEnd; Vector vecDown; @@ -607,12 +607,12 @@ BOOL CLocalNav::SlopeTraversable(Vector &vecSource, Vector &vecDest, int fNoMons } vecDest = tr.vecEndPos; - return TRUE; -} - -/* <487085> ../cstrike/dlls/hostage/hostage_localnav.cpp:635 */ -BOOL CLocalNav::LadderTraversable(Vector &vecSource, Vector &vecDest, int fNoMonsters, TraceResult &tr) -{ + return TRUE; +} + +/* <487085> ../cstrike/dlls/hostage/hostage_localnav.cpp:635 */ +BOOL CLocalNav::LadderTraversable(Vector &vecSource, Vector &vecDest, int fNoMonsters, TraceResult &tr) +{ Vector vecStepStart; Vector vecStepDest; @@ -632,12 +632,12 @@ BOOL CLocalNav::LadderTraversable(Vector &vecSource, Vector &vecDest, int fNoMon vecStepStart = tr.vecEndPos; vecDest.z = tr.vecEndPos.z; - return PathTraversable(vecStepStart, vecDest, fNoMonsters); -} - -/* <4871ef> ../cstrike/dlls/hostage/hostage_localnav.cpp:662 */ -BOOL CLocalNav::StepTraversable(Vector &vecSource, Vector &vecDest, int fNoMonsters, TraceResult &tr) -{ + return PathTraversable(vecStepStart, vecDest, fNoMonsters); +} + +/* <4871ef> ../cstrike/dlls/hostage/hostage_localnav.cpp:662 */ +BOOL CLocalNav::StepTraversable(Vector &vecSource, Vector &vecDest, int fNoMonsters, TraceResult &tr) +{ Vector vecStepStart; Vector vecStepDest; //BOOL fFwdTrace = FALSE; // unused? @@ -675,12 +675,12 @@ BOOL CLocalNav::StepTraversable(Vector &vecSource, Vector &vecDest, int fNoMonst } vecDest = tr.vecEndPos; - return TRUE; -} - -/* <4873b3> ../cstrike/dlls/hostage/hostage_localnav.cpp:713 */ -BOOL CLocalNav::StepJumpable(Vector &vecSource, Vector &vecDest, int fNoMonsters, TraceResult &tr) -{ + return TRUE; +} + +/* <4873b3> ../cstrike/dlls/hostage/hostage_localnav.cpp:713 */ +BOOL CLocalNav::StepJumpable(Vector &vecSource, Vector &vecDest, int fNoMonsters, TraceResult &tr) +{ Vector vecStepStart; Vector vecStepDest; //BOOL fFwdTrace = FALSE; // unused? @@ -730,12 +730,12 @@ BOOL CLocalNav::StepJumpable(Vector &vecSource, Vector &vecDest, int fNoMonsters return TRUE; } - return FALSE; -} - -/* <487588> ../cstrike/dlls/hostage/hostage_localnav.cpp:824 */ -BOOL CLocalNav::LadderHit(Vector &vecSource, Vector &vecDest, TraceResult &tr) -{ + return FALSE; +} + +/* <487588> ../cstrike/dlls/hostage/hostage_localnav.cpp:824 */ +BOOL CLocalNav::LadderHit(Vector &vecSource, Vector &vecDest, TraceResult &tr) +{ Vector vecFwd, vecRight, vecUp; Vector vecAngles, vecOrigin; @@ -771,12 +771,12 @@ BOOL CLocalNav::LadderHit(Vector &vecSource, Vector &vecDest, TraceResult &tr) if (UTIL_PointContents(vecOrigin) == CONTENTS_LADDER) return true; - return false; -} - -/* <487eeb> ../cstrike/dlls/hostage/hostage_localnav.cpp:851 */ -void CLocalNav::Think(void) -{ + return false; +} + +/* <487eeb> ../cstrike/dlls/hostage/hostage_localnav.cpp:851 */ +void CLocalNav::Think(void) +{ EHANDLE hCallback; static cvar_t *sv_stepsize = NULL; @@ -840,20 +840,20 @@ void CLocalNav::Think(void) tot_inqueue--; pHostage->NavReady(); } - } -} - -/* <487ccd> ../cstrike/dlls/hostage/hostage_localnav.cpp:922 */ -void CLocalNav::RequestNav(CHostage *pCaller) -{ + } +} + +/* <487ccd> ../cstrike/dlls/hostage/hostage_localnav.cpp:922 */ +void CLocalNav::RequestNav(CHostage *pCaller) +{ int curr = qptr; - int found = 0; - - if (nodeval <= 17 && !tot_inqueue) - { - pCaller->NavReady(); - return; - } + int found = 0; + + if (nodeval <= 17 && !tot_inqueue) + { + pCaller->NavReady(); + return; + } if (tot_inqueue >= MAX_HOSTAGES_NAV) { @@ -872,28 +872,28 @@ void CLocalNav::RequestNav(CHostage *pCaller) } _queue[curr] = pCaller; - tot_inqueue++; -} - -/* <487e03> ../cstrike/dlls/hostage/hostage_localnav.cpp:964 */ -void CLocalNav::Reset(void) -{ + tot_inqueue++; +} + +/* <487e03> ../cstrike/dlls/hostage/hostage_localnav.cpp:964 */ +void CLocalNav::Reset(void) +{ flNextCvarCheck = 0; flLastThinkTime = 0; tot_inqueue = 0; qptr = 0; nodeval = 0; - tot_hostages = 0; -} - -/* <487e14> ../cstrike/dlls/hostage/hostage_localnav.cpp:976 */ -void CLocalNav::HostagePrethink(void) -{ + tot_hostages = 0; +} + +/* <487e14> ../cstrike/dlls/hostage/hostage_localnav.cpp:976 */ +void CLocalNav::HostagePrethink(void) +{ for (int iCount = 0; iCount < tot_hostages; iCount++) { if (hostages[ iCount ] != NULL) { GetClassPtr((CHostage *)hostages[ iCount ]->pev)->PreThink(); - } - } -} + } + } +} diff --git a/regamedll/dlls/hostage/hostage_localnav.h b/regamedll/dlls/hostage/hostage_localnav.h index 78bbc9a8..3d182de9 100644 --- a/regamedll/dlls/hostage/hostage_localnav.h +++ b/regamedll/dlls/hostage/hostage_localnav.h @@ -81,65 +81,65 @@ public: CLocalNav(CHostage *pOwner); virtual ~CLocalNav(void); - void SetTargetEnt(CBaseEntity *pTarget) - { + void SetTargetEnt(CBaseEntity *pTarget) + { if (pTarget) m_pTargetEnt = pTarget->edict(); else - m_pTargetEnt = NULL; - } - - node_index_t FindPath(Vector &vecStart, Vector &vecDest, float flTargetRadius, int fNoMonsters); - int SetupPathNodes(node_index_t nindex, Vector *vecNodes, int fNoMonsters); - int GetFurthestTraversableNode(Vector &vecStartingLoc, Vector *vecNodes, int nTotalNodes, int fNoMonsters); - int PathTraversable(Vector &vecSource, Vector &vecDest, int fNoMonsters); - BOOL PathClear(Vector &vecOrigin, Vector &vecDest, int fNoMonsters, TraceResult &tr); - BOOL PathClear(Vector &vecSource, Vector &vecDest, BOOL fNoMonsters) - { + m_pTargetEnt = NULL; + } + + node_index_t FindPath(Vector &vecStart, Vector &vecDest, float flTargetRadius, int fNoMonsters); + int SetupPathNodes(node_index_t nindex, Vector *vecNodes, int fNoMonsters); + int GetFurthestTraversableNode(Vector &vecStartingLoc, Vector *vecNodes, int nTotalNodes, int fNoMonsters); + int PathTraversable(Vector &vecSource, Vector &vecDest, int fNoMonsters); + BOOL PathClear(Vector &vecOrigin, Vector &vecDest, int fNoMonsters, TraceResult &tr); + BOOL PathClear(Vector &vecSource, Vector &vecDest, BOOL fNoMonsters) + { TraceResult tr; - return PathClear(vecSource, vecDest, fNoMonsters, tr); - } - node_index_t AddNode(node_index_t nindexParent, Vector &vecLoc, int offsetX = 0, int offsetY = 0, byte bDepth = 0); - localnode_t *GetNode(node_index_t nindex); - node_index_t NodeExists(int offsetX, int offsetY); - void AddPathNodes(node_index_t nindexSource, int fNoMonsters); - void AddPathNode(node_index_t nindexSource, int offsetX, int offsetY, int fNoMonsters); - node_index_t GetBestNode(Vector &vecOrigin, Vector &vecDest); - BOOL SlopeTraversable(Vector &vecSource, Vector &vecDest, int fNoMonsters, TraceResult &tr); - BOOL LadderTraversable(Vector &vecSource, Vector &vecDest, int fNoMonsters, TraceResult &tr); - BOOL StepTraversable(Vector &vecSource, Vector &vecDest, int fNoMonsters, TraceResult &tr); - BOOL StepJumpable(Vector &vecSource, Vector &vecDest, int fNoMonsters, TraceResult &tr); - node_index_t FindDirectPath(Vector &vecStart, Vector &vecDest, float flTargetRadius, int fNoMonsters); + return PathClear(vecSource, vecDest, fNoMonsters, tr); + } + node_index_t AddNode(node_index_t nindexParent, Vector &vecLoc, int offsetX = 0, int offsetY = 0, byte bDepth = 0); + localnode_t *GetNode(node_index_t nindex); + node_index_t NodeExists(int offsetX, int offsetY); + void AddPathNodes(node_index_t nindexSource, int fNoMonsters); + void AddPathNode(node_index_t nindexSource, int offsetX, int offsetY, int fNoMonsters); + node_index_t GetBestNode(Vector &vecOrigin, Vector &vecDest); + BOOL SlopeTraversable(Vector &vecSource, Vector &vecDest, int fNoMonsters, TraceResult &tr); + BOOL LadderTraversable(Vector &vecSource, Vector &vecDest, int fNoMonsters, TraceResult &tr); + BOOL StepTraversable(Vector &vecSource, Vector &vecDest, int fNoMonsters, TraceResult &tr); + BOOL StepJumpable(Vector &vecSource, Vector &vecDest, int fNoMonsters, TraceResult &tr); + node_index_t FindDirectPath(Vector &vecStart, Vector &vecDest, float flTargetRadius, int fNoMonsters); BOOL LadderHit(Vector &vecSource, Vector &vecDest, TraceResult &tr); - static void Think(void); - static void RequestNav(CHostage *pCaller); - static void Reset(void); + static void Think(void); + static void RequestNav(CHostage *pCaller); + static void Reset(void); static void HostagePrethink(void); static float s_flStepSize; #ifndef HOOK_GAMEDLL private: #endif // HOOK_GAMEDLL - - static EHANDLE _queue[ MAX_HOSTAGES_NAV ]; - static int qptr; - static int tot_inqueue; - static float nodeval; - static float flNextCvarCheck; - static float flLastThinkTime; - static EHANDLE hostages[ MAX_HOSTAGES_NAV ]; + + static EHANDLE _queue[ MAX_HOSTAGES_NAV ]; + static int qptr; + static int tot_inqueue; + static float nodeval; + static float flNextCvarCheck; + static float flLastThinkTime; + static EHANDLE hostages[ MAX_HOSTAGES_NAV ]; static int tot_hostages; #ifdef HOOK_GAMEDLL private: #endif // HOOK_GAMEDLL - CHostage *m_pOwner; - edict_t *m_pTargetEnt; - BOOL m_fTargetEntHit; - localnode_t *m_nodeArr; - node_index_t m_nindexAvailableNode; + CHostage *m_pOwner; + edict_t *m_pTargetEnt; + BOOL m_fTargetEntHit; + localnode_t *m_nodeArr; + node_index_t m_nindexAvailableNode; Vector m_vecStartingLoc; };/* size: 36, cachelines: 1, members: 16 */ diff --git a/regamedll/dlls/items.h b/regamedll/dlls/items.h index f3ce5dd5..a2def420 100644 --- a/regamedll/dlls/items.h +++ b/regamedll/dlls/items.h @@ -32,10 +32,10 @@ #pragma once #endif -// constant items -#define ITEM_HEALTHKIT 1 -#define ITEM_ANTIDOTE 2 -#define ITEM_SECURITY 3 +// constant items +#define ITEM_HEALTHKIT 1 +#define ITEM_ANTIDOTE 2 +#define ITEM_SECURITY 3 #define ITEM_BATTERY 4 #define ITEM_SUIT 5 @@ -63,7 +63,7 @@ public: };/* size: 152, cachelines: 3, members: 1 */ -/* ../cstrike/dlls/items.cpp:38 */ +/* ../cstrike/dlls/items.cpp:38 */ class CWorldItem: public CBaseEntity { public: @@ -82,7 +82,7 @@ public: };/* size: 156, cachelines: 3, members: 2 */ -/* ../cstrike/dlls/items.cpp:188 */ +/* ../cstrike/dlls/items.cpp:188 */ class CItemSuit: public CItem { public: @@ -100,7 +100,7 @@ public: };/* size: 152, cachelines: 3, members: 1 */ -/* ../cstrike/dlls/items.cpp:219 */ +/* ../cstrike/dlls/items.cpp:219 */ class CItemBattery: public CItem { public: @@ -118,7 +118,7 @@ public: };/* size: 152, cachelines: 3, members: 1 */ -/* ../cstrike/dlls/items.cpp:269 */ +/* ../cstrike/dlls/items.cpp:269 */ class CItemAntidote: public CItem { public: @@ -136,7 +136,7 @@ public: };/* size: 152, cachelines: 3, members: 1 */ -/* ../cstrike/dlls/items.cpp:293 */ +/* ../cstrike/dlls/items.cpp:293 */ class CItemSecurity: public CItem { public: @@ -154,7 +154,7 @@ public: };/* size: 152, cachelines: 3, members: 1 */ -/* ../cstrike/dlls/items.cpp:314 */ +/* ../cstrike/dlls/items.cpp:314 */ class CItemLongJump: public CItem { public: @@ -172,7 +172,7 @@ public: };/* size: 152, cachelines: 3, members: 1 */ -/* ../cstrike/dlls/items.cpp:352 */ +/* ../cstrike/dlls/items.cpp:352 */ class CItemKevlar: public CItem { public: @@ -190,7 +190,7 @@ public: };/* size: 152, cachelines: 3, members: 1 */ -/* ../cstrike/dlls/items.cpp:393 */ +/* ../cstrike/dlls/items.cpp:393 */ class CItemAssaultSuit: public CItem { public: @@ -208,7 +208,7 @@ public: };/* size: 152, cachelines: 3, members: 1 */ -/* ../cstrike/dlls/items.cpp:432 */ +/* ../cstrike/dlls/items.cpp:432 */ class CItemThighPack: public CItem { public: diff --git a/regamedll/dlls/lights.cpp b/regamedll/dlls/lights.cpp index f5b95b5c..46b7dab1 100644 --- a/regamedll/dlls/lights.cpp +++ b/regamedll/dlls/lights.cpp @@ -13,7 +13,7 @@ TYPEDESCRIPTION CLight::m_SaveData[] = #else -TYPEDESCRIPTION IMPLEMENT_ARRAY_CLASS(CLight, m_SaveData)[2]; +TYPEDESCRIPTION IMPL_CLASS(CLight, m_SaveData)[2]; #endif // HOOK_GAMEDLL diff --git a/regamedll/dlls/lights.h b/regamedll/dlls/lights.h index a2994b2c..ab8eafb5 100644 --- a/regamedll/dlls/lights.h +++ b/regamedll/dlls/lights.h @@ -56,7 +56,7 @@ public: #endif // HOOK_GAMEDLL - static TYPEDESCRIPTION IMPLEMENT_ARRAY(m_SaveData)[2]; + static TYPEDESCRIPTION IMPL(m_SaveData)[2]; private: int m_iStyle; diff --git a/regamedll/dlls/maprules.cpp b/regamedll/dlls/maprules.cpp index c9da1ab6..9cbc0062 100644 --- a/regamedll/dlls/maprules.cpp +++ b/regamedll/dlls/maprules.cpp @@ -27,9 +27,9 @@ TYPEDESCRIPTION CGamePlayerZone::m_SaveData[] = #else -TYPEDESCRIPTION IMPLEMENT_ARRAY_CLASS(CRuleEntity, m_SaveData)[1]; -TYPEDESCRIPTION IMPLEMENT_ARRAY_CLASS(CGameText, m_SaveData)[1]; -TYPEDESCRIPTION IMPLEMENT_ARRAY_CLASS(CGamePlayerZone, m_SaveData)[4]; +TYPEDESCRIPTION IMPL_CLASS(CRuleEntity, m_SaveData)[1]; +TYPEDESCRIPTION IMPL_CLASS(CGameText, m_SaveData)[1]; +TYPEDESCRIPTION IMPL_CLASS(CGamePlayerZone, m_SaveData)[4]; #endif // HOOK_GAMEDLL diff --git a/regamedll/dlls/maprules.h b/regamedll/dlls/maprules.h index 54cbe8a7..7b135c83 100644 --- a/regamedll/dlls/maprules.h +++ b/regamedll/dlls/maprules.h @@ -32,30 +32,30 @@ #pragma once #endif -#define MAX_EQUIP 32 -#define SF_SCORE_NEGATIVE 0x0001 -#define SF_SCORE_TEAM 0x0002 +#define MAX_EQUIP 32 +#define SF_SCORE_NEGATIVE 0x0001 +#define SF_SCORE_TEAM 0x0002 -#define SF_ENVTEXT_ALLPLAYERS 0x0001 +#define SF_ENVTEXT_ALLPLAYERS 0x0001 -#define SF_TEAMMASTER_FIREONCE 0x0001 -#define SF_TEAMMASTER_ANYTEAM 0x0002 +#define SF_TEAMMASTER_FIREONCE 0x0001 +#define SF_TEAMMASTER_ANYTEAM 0x0002 -#define SF_TEAMSET_FIREONCE 0x0001 -#define SF_TEAMSET_CLEARTEAM 0x0002 +#define SF_TEAMSET_FIREONCE 0x0001 +#define SF_TEAMSET_CLEARTEAM 0x0002 -#define SF_PKILL_FIREONCE 0x0001 +#define SF_PKILL_FIREONCE 0x0001 -#define SF_GAMECOUNT_FIREONCE 0x0001 -#define SF_GAMECOUNT_RESET 0x0002 +#define SF_GAMECOUNT_FIREONCE 0x0001 +#define SF_GAMECOUNT_RESET 0x0002 -#define SF_GAMECOUNTSET_FIREONCE 0x0001 +#define SF_GAMECOUNTSET_FIREONCE 0x0001 -#define SF_PLAYEREQUIP_USEONLY 0x0001 +#define SF_PLAYEREQUIP_USEONLY 0x0001 -#define SF_PTEAM_FIREONCE 0x0001 -#define SF_PTEAM_KILL 0x0002 -#define SF_PTEAM_GIB 0x0004 +#define SF_PTEAM_FIREONCE 0x0001 +#define SF_PTEAM_KILL 0x0002 +#define SF_PTEAM_GIB 0x0004 /* ../cstrike/dlls/maprules.cpp:34 */ class CRuleEntity: public CBaseEntity @@ -76,7 +76,7 @@ public: #endif // HOOK_GAMEDLL public: - static TYPEDESCRIPTION IMPLEMENT_ARRAY(m_SaveData)[1]; + static TYPEDESCRIPTION IMPL(m_SaveData)[1]; void SetMaster(int iszMaster) { @@ -216,7 +216,7 @@ public: } public: - static TYPEDESCRIPTION IMPLEMENT_ARRAY(m_SaveData)[1]; + static TYPEDESCRIPTION IMPL(m_SaveData)[1]; private: hudtextparms_t m_textParms; @@ -321,7 +321,7 @@ public: #endif // HOOK_GAMEDLL public: - static TYPEDESCRIPTION IMPLEMENT_ARRAY(m_SaveData)[4]; + static TYPEDESCRIPTION IMPL(m_SaveData)[4]; private: string_t m_iszInTarget; diff --git a/regamedll/dlls/monsters.h b/regamedll/dlls/monsters.h index 689892ba..6f2e4caf 100644 --- a/regamedll/dlls/monsters.h +++ b/regamedll/dlls/monsters.h @@ -66,18 +66,18 @@ #define R_NM 3 // (NEMESIS) A monster Will ALWAYS attack its nemsis, no matter what #define MEMORY_CLEAR 0 -#define bits_MEMORY_PROVOKED (1<<0) // right now only used for houndeyes. -#define bits_MEMORY_INCOVER (1<<1) // monster knows it is in a covered position. -#define bits_MEMORY_SUSPICIOUS (1<<2) // Ally is suspicious of the player, and will move to provoked more easily -#define bits_MEMORY_PATH_FINISHED (1<<3) // Finished monster path (just used by big momma for now) -#define bits_MEMORY_ON_PATH (1<<4) // Moving on a path -#define bits_MEMORY_MOVE_FAILED (1<<5) // Movement has already failed -#define bits_MEMORY_FLINCHED (1<<6) // Has already flinched -#define bits_MEMORY_KILLED (1<<7) // HACKHACK -- remember that I've already called my Killed() -#define bits_MEMORY_CUSTOM4 (1<<28) // Monster-specific memory -#define bits_MEMORY_CUSTOM3 (1<<29) // Monster-specific memory -#define bits_MEMORY_CUSTOM2 (1<<30) // Monster-specific memory -#define bits_MEMORY_CUSTOM1 (1<<31) // Monster-specific memory +#define bits_MEMORY_PROVOKED (1 << 0) // right now only used for houndeyes. +#define bits_MEMORY_INCOVER (1 << 1) // monster knows it is in a covered position. +#define bits_MEMORY_SUSPICIOUS (1 << 2) // Ally is suspicious of the player, and will move to provoked more easily +#define bits_MEMORY_PATH_FINISHED (1 << 3) // Finished monster path (just used by big momma for now) +#define bits_MEMORY_ON_PATH (1 << 4) // Moving on a path +#define bits_MEMORY_MOVE_FAILED (1 << 5) // Movement has already failed +#define bits_MEMORY_FLINCHED (1 << 6) // Has already flinched +#define bits_MEMORY_KILLED (1 << 7) // HACKHACK -- remember that I've already called my Killed() +#define bits_MEMORY_CUSTOM4 (1 << 28) // Monster-specific memory +#define bits_MEMORY_CUSTOM3 (1 << 29) // Monster-specific memory +#define bits_MEMORY_CUSTOM2 (1 << 30) // Monster-specific memory +#define bits_MEMORY_CUSTOM1 (1 << 31) // Monster-specific memory //TODO: unused? enum diff --git a/regamedll/dlls/mortar.cpp b/regamedll/dlls/mortar.cpp index d143d9e2..58f46fe4 100644 --- a/regamedll/dlls/mortar.cpp +++ b/regamedll/dlls/mortar.cpp @@ -17,7 +17,7 @@ TYPEDESCRIPTION CFuncMortarField::m_SaveData[] = #else -TYPEDESCRIPTION IMPLEMENT_ARRAY_CLASS(CFuncMortarField, m_SaveData)[6]; +TYPEDESCRIPTION IMPL_CLASS(CFuncMortarField, m_SaveData)[6]; #endif // HOOK_GAMEDLL @@ -94,44 +94,44 @@ void CFuncMortarField::FieldUse(CBaseEntity *pActivator, CBaseEntity *pCaller, U switch (m_fControl) { - // random - case 0: - break; - // Trigger Activator - case 1: + // random + case 0: + break; + // Trigger Activator + case 1: + { + if (pActivator != NULL) { - if (pActivator != NULL) - { - vecStart.x = pActivator->pev->origin.x; - vecStart.y = pActivator->pev->origin.y; - } - break; + vecStart.x = pActivator->pev->origin.x; + vecStart.y = pActivator->pev->origin.y; } - // table - case 2: + break; + } + // table + case 2: + { + CBaseEntity *pController; + + if (!FStringNull(m_iszXController)) { - CBaseEntity *pController; + pController = UTIL_FindEntityByTargetname(NULL, STRING(m_iszXController)); - if (!FStringNull(m_iszXController)) + if (pController != NULL) { - pController = UTIL_FindEntityByTargetname(NULL, STRING(m_iszXController)); - - if (pController != NULL) - { - vecStart.x = pev->mins.x + pController->pev->ideal_yaw * pev->size.x; - } + vecStart.x = pev->mins.x + pController->pev->ideal_yaw * pev->size.x; } - if (!FStringNull(m_iszYController)) - { - pController = UTIL_FindEntityByTargetname(NULL, STRING(m_iszYController)); - - if (pController != NULL) - { - vecStart.y = pev->mins.y + pController->pev->ideal_yaw * pev->size.y; - } - } - break; } + if (!FStringNull(m_iszYController)) + { + pController = UTIL_FindEntityByTargetname(NULL, STRING(m_iszYController)); + + if (pController != NULL) + { + vecStart.y = pev->mins.y + pController->pev->ideal_yaw * pev->size.y; + } + } + break; + } } int pitch = RANDOM_LONG(95, 124); diff --git a/regamedll/dlls/mortar.h b/regamedll/dlls/mortar.h index 2111cec6..e5bb50af 100644 --- a/regamedll/dlls/mortar.h +++ b/regamedll/dlls/mortar.h @@ -32,7 +32,7 @@ #pragma once #endif -/* ../cstrike/dlls/mortar.cpp:31 */ +/* ../cstrike/dlls/mortar.cpp:31 */ class CFuncMortarField: public CBaseToggle { public: @@ -62,7 +62,7 @@ public: void EXPORT FieldUse(CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value); public: - static TYPEDESCRIPTION IMPLEMENT_ARRAY(m_SaveData)[6]; + static TYPEDESCRIPTION IMPL(m_SaveData)[6]; public: int m_iszXController; @@ -74,7 +74,7 @@ public: };/* size: 336, cachelines: 6, members: 8 */ -/* ../cstrike/dlls/mortar.cpp:192 */ +/* ../cstrike/dlls/mortar.cpp:192 */ class CMortar: public CGrenade { public: diff --git a/regamedll/dlls/mpstubb.cpp b/regamedll/dlls/mpstubb.cpp index 476385dc..b4915665 100644 --- a/regamedll/dlls/mpstubb.cpp +++ b/regamedll/dlls/mpstubb.cpp @@ -121,163 +121,163 @@ void CBaseMonster::__MAKE_VHOOK(KeyValue)(KeyValueData *pkvd) /* ../cstrike/dlls/mpstubb.cpp:104 */ int CBaseMonster::__MAKE_VHOOK(IRelationship)(CBaseEntity *pTarget) { - static int const iEnemy[14][14] = - { - // NONE MACH PLYR HPASS HMIL AMIL APASS AMONST APREY APRED INSECT PLRALY PBWPN ABWPN - { R_NO, R_NO, R_NO, R_NO, R_NO, R_NO, R_NO, R_NO, R_NO, R_NO, R_NO, R_NO, R_NO, R_NO }, // NONE - { R_NO, R_NO, R_DL, R_DL, R_NO, R_DL, R_DL, R_DL, R_DL, R_DL, R_NO, R_DL, R_DL, R_DL }, // MACHINE - { R_NO, R_DL, R_NO, R_NO, R_DL, R_DL, R_DL, R_DL, R_DL, R_DL, R_NO, R_NO, R_DL, R_DL }, // PLAYER - { R_NO, R_NO, R_AL, R_AL, R_HT, R_FR, R_NO, R_HT, R_DL, R_FR, R_NO, R_AL, R_NO, R_NO }, // HUMANPASSIVE - { R_NO, R_NO, R_HT, R_DL, R_NO, R_HT, R_DL, R_DL, R_DL, R_DL, R_NO, R_HT, R_NO, R_NO }, // HUMANMILITAR - { R_NO, R_DL, R_HT, R_DL, R_HT, R_NO, R_NO, R_NO, R_NO, R_NO, R_NO, R_DL, R_NO, R_NO }, // ALIENMILITAR - { R_NO, R_NO, R_NO, R_NO, R_NO, R_NO, R_NO, R_NO, R_NO, R_NO, R_NO, R_NO, R_NO, R_NO }, // ALIENPASSIVE - { R_NO, R_DL, R_DL, R_DL, R_DL, R_NO, R_NO, R_NO, R_NO, R_NO, R_NO, R_DL, R_NO, R_NO }, // ALIENMONSTER - { R_NO, R_NO, R_DL, R_DL, R_DL, R_NO, R_NO, R_NO, R_NO, R_FR, R_NO, R_DL, R_NO, R_NO }, // ALIENPREY - { R_NO, R_NO, R_DL, R_DL, R_DL, R_NO, R_NO, R_NO, R_HT, R_DL, R_NO, R_DL, R_NO, R_NO }, // ALIENPREDATO - { R_FR, R_FR, R_FR, R_FR, R_FR, R_NO, R_FR, R_FR, R_FR, R_FR, R_NO, R_FR, R_NO, R_NO }, // INSECT - { R_NO, R_DL, R_AL, R_AL, R_DL, R_DL, R_DL, R_DL, R_DL, R_DL, R_NO, R_NO, R_NO, R_NO }, // PLAYERALLY - { R_NO, R_NO, R_DL, R_DL, R_DL, R_DL, R_DL, R_DL, R_DL, R_DL, R_NO, R_DL, R_NO, R_DL }, // PBIOWEAPON - { R_NO, R_NO, R_DL, R_DL, R_DL, R_AL, R_NO, R_DL, R_DL, R_NO, R_NO, R_DL, R_DL, R_NO } // ABIOWEAPON - }; - + static int const iEnemy[14][14] = + { + // NONE MACH PLYR HPASS HMIL AMIL APASS AMONST APREY APRED INSECT PLRALY PBWPN ABWPN + { R_NO, R_NO, R_NO, R_NO, R_NO, R_NO, R_NO, R_NO, R_NO, R_NO, R_NO, R_NO, R_NO, R_NO }, // NONE + { R_NO, R_NO, R_DL, R_DL, R_NO, R_DL, R_DL, R_DL, R_DL, R_DL, R_NO, R_DL, R_DL, R_DL }, // MACHINE + { R_NO, R_DL, R_NO, R_NO, R_DL, R_DL, R_DL, R_DL, R_DL, R_DL, R_NO, R_NO, R_DL, R_DL }, // PLAYER + { R_NO, R_NO, R_AL, R_AL, R_HT, R_FR, R_NO, R_HT, R_DL, R_FR, R_NO, R_AL, R_NO, R_NO }, // HUMANPASSIVE + { R_NO, R_NO, R_HT, R_DL, R_NO, R_HT, R_DL, R_DL, R_DL, R_DL, R_NO, R_HT, R_NO, R_NO }, // HUMANMILITAR + { R_NO, R_DL, R_HT, R_DL, R_HT, R_NO, R_NO, R_NO, R_NO, R_NO, R_NO, R_DL, R_NO, R_NO }, // ALIENMILITAR + { R_NO, R_NO, R_NO, R_NO, R_NO, R_NO, R_NO, R_NO, R_NO, R_NO, R_NO, R_NO, R_NO, R_NO }, // ALIENPASSIVE + { R_NO, R_DL, R_DL, R_DL, R_DL, R_NO, R_NO, R_NO, R_NO, R_NO, R_NO, R_DL, R_NO, R_NO }, // ALIENMONSTER + { R_NO, R_NO, R_DL, R_DL, R_DL, R_NO, R_NO, R_NO, R_NO, R_FR, R_NO, R_DL, R_NO, R_NO }, // ALIENPREY + { R_NO, R_NO, R_DL, R_DL, R_DL, R_NO, R_NO, R_NO, R_HT, R_DL, R_NO, R_DL, R_NO, R_NO }, // ALIENPREDATO + { R_FR, R_FR, R_FR, R_FR, R_FR, R_NO, R_FR, R_FR, R_FR, R_FR, R_NO, R_FR, R_NO, R_NO }, // INSECT + { R_NO, R_DL, R_AL, R_AL, R_DL, R_DL, R_DL, R_DL, R_DL, R_DL, R_NO, R_NO, R_NO, R_NO }, // PLAYERALLY + { R_NO, R_NO, R_DL, R_DL, R_DL, R_DL, R_DL, R_DL, R_DL, R_DL, R_NO, R_DL, R_NO, R_DL }, // PBIOWEAPON + { R_NO, R_NO, R_DL, R_DL, R_DL, R_AL, R_NO, R_DL, R_DL, R_NO, R_NO, R_DL, R_DL, R_NO } // ABIOWEAPON + }; + return iEnemy[ Classify() ][ pTarget->Classify() ]; } -// Look - Base class monster function to find enemies or -// food by sight. iDistance is distance (in units) that the -// monster can see. -// -// Sets the sight bits of the m_afConditions mask to indicate -// which types of entities were sighted. -// Function also sets the Looker's m_pLink -// to the head of a link list that contains all visible ents. +// Look - Base class monster function to find enemies or +// food by sight. iDistance is distance (in units) that the +// monster can see. +// +// Sets the sight bits of the m_afConditions mask to indicate +// which types of entities were sighted. +// Function also sets the Looker's m_pLink +// to the head of a link list that contains all visible ents. // (linked via each ent's m_pLink field) /* ../cstrike/dlls/mpstubb.cpp:140 */ void CBaseMonster::__MAKE_VHOOK(Look)(int iDistance) { - int iSighted = 0; - - // DON'T let visibility information from last frame sit around! - ClearConditions(bits_COND_SEE_HATE | bits_COND_SEE_DISLIKE | bits_COND_SEE_ENEMY | bits_COND_SEE_FEAR | bits_COND_SEE_NEMESIS | bits_COND_SEE_CLIENT); - - m_pLink = NULL; - - // the current visible entity that we're dealing with - CBaseEntity *pSightEnt = NULL; - CBaseEntity *pList[100]; - - Vector delta = Vector(iDistance, iDistance, iDistance); - - // 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)); - for (int i = 0; i < count; i++) - { - pSightEnt = pList[i]; - if (pSightEnt != this && pSightEnt->pev->health > 0) - { - // the looker will want to consider this entity - // don't check anything else about an entity that can't be seen, or an entity that you don't care about. - if (IRelationship(pSightEnt) != R_NO && FInViewCone(pSightEnt) && !(pSightEnt->pev->flags & FL_NOTARGET) && FVisible(pSightEnt)) - { - if (pSightEnt->IsPlayer()) - { - // if we see a client, remember that (mostly for scripted AI) - iSighted |= bits_COND_SEE_CLIENT; - } - - pSightEnt->m_pLink = m_pLink; - m_pLink = pSightEnt; - - if (pSightEnt == m_hEnemy) - { - // we know this ent is visible, so if it also happens to be our enemy, store that now. - iSighted |= bits_COND_SEE_ENEMY; - } - - // don't add the Enemy's relationship to the conditions. We only want to worry about conditions when - // we see monsters other than the Enemy. - switch (IRelationship (pSightEnt)) - { - case R_NM: - iSighted |= bits_COND_SEE_NEMESIS; - break; - case R_HT: - iSighted |= bits_COND_SEE_HATE; - break; - case R_DL: - iSighted |= bits_COND_SEE_DISLIKE; - break; - case R_FR: - iSighted |= bits_COND_SEE_FEAR; - break; - case R_AL: - break; - default: - ALERT(at_aiconsole, "%s can't assess %s\n", STRING(pev->classname), STRING(pSightEnt->pev->classname)); - break; - } - } - } - } - + int iSighted = 0; + + // DON'T let visibility information from last frame sit around! + ClearConditions(bits_COND_SEE_HATE | bits_COND_SEE_DISLIKE | bits_COND_SEE_ENEMY | bits_COND_SEE_FEAR | bits_COND_SEE_NEMESIS | bits_COND_SEE_CLIENT); + + m_pLink = NULL; + + // the current visible entity that we're dealing with + CBaseEntity *pSightEnt = NULL; + CBaseEntity *pList[100]; + + Vector delta = Vector(iDistance, iDistance, iDistance); + + // 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)); + for (int i = 0; i < count; i++) + { + pSightEnt = pList[i]; + if (pSightEnt != this && pSightEnt->pev->health > 0) + { + // the looker will want to consider this entity + // don't check anything else about an entity that can't be seen, or an entity that you don't care about. + if (IRelationship(pSightEnt) != R_NO && FInViewCone(pSightEnt) && !(pSightEnt->pev->flags & FL_NOTARGET) && FVisible(pSightEnt)) + { + if (pSightEnt->IsPlayer()) + { + // if we see a client, remember that (mostly for scripted AI) + iSighted |= bits_COND_SEE_CLIENT; + } + + pSightEnt->m_pLink = m_pLink; + m_pLink = pSightEnt; + + if (pSightEnt == m_hEnemy) + { + // we know this ent is visible, so if it also happens to be our enemy, store that now. + iSighted |= bits_COND_SEE_ENEMY; + } + + // don't add the Enemy's relationship to the conditions. We only want to worry about conditions when + // we see monsters other than the Enemy. + switch (IRelationship (pSightEnt)) + { + case R_NM: + iSighted |= bits_COND_SEE_NEMESIS; + break; + case R_HT: + iSighted |= bits_COND_SEE_HATE; + break; + case R_DL: + iSighted |= bits_COND_SEE_DISLIKE; + break; + case R_FR: + iSighted |= bits_COND_SEE_FEAR; + break; + case R_AL: + break; + default: + ALERT(at_aiconsole, "%s can't assess %s\n", STRING(pev->classname), STRING(pSightEnt->pev->classname)); + break; + } + } + } + } + SetConditions(iSighted); } -// BestVisibleEnemy - this functions searches the link -// list whose head is the caller's m_pLink field, and returns -// a pointer to the enemy entity in that list that is nearest the -// caller. -// -// !!!UNDONE - currently, this only returns the closest enemy. +// BestVisibleEnemy - this functions searches the link +// list whose head is the caller's m_pLink field, and returns +// a pointer to the enemy entity in that list that is nearest the +// caller. +// +// !!!UNDONE - currently, this only returns the closest enemy. // we'll want to consider distance, relationship, attack types, back turned, etc. /* ../cstrike/dlls/mpstubb.cpp:220 */ CBaseEntity *CBaseMonster::__MAKE_VHOOK(BestVisibleEnemy)(void) { - CBaseEntity *pReturn; - CBaseEntity *pNextEnt; - int iNearest; - int iDist; - int iBestRelationship; - - // so first visible entity will become the closest. - iNearest = 8192; - pNextEnt = m_pLink; - pReturn = NULL; - iBestRelationship = R_NO; - - while (pNextEnt != NULL) - { - if (pNextEnt->IsAlive()) - { - if (IRelationship(pNextEnt) > iBestRelationship) - { - // this entity is disliked MORE than the entity that we - // currently think is the best visible enemy. No need to do - // a distance check, just get mad at this one for now. - iBestRelationship = IRelationship(pNextEnt); - iNearest = (pNextEnt->pev->origin - pev->origin).Length(); - pReturn = pNextEnt; - } - else if (IRelationship(pNextEnt) == iBestRelationship) - { - // this entity is disliked just as much as the entity that - // we currently think is the best visible enemy, so we only - // get mad at it if it is closer. - iDist = (pNextEnt->pev->origin - pev->origin).Length(); - - if (iDist <= iNearest) - { - iNearest = iDist; - iBestRelationship = IRelationship(pNextEnt); - pReturn = pNextEnt; - } - } - } - - pNextEnt = pNextEnt->m_pLink; - } - + CBaseEntity *pReturn; + CBaseEntity *pNextEnt; + int iNearest; + int iDist; + int iBestRelationship; + + // so first visible entity will become the closest. + iNearest = 8192; + pNextEnt = m_pLink; + pReturn = NULL; + iBestRelationship = R_NO; + + while (pNextEnt != NULL) + { + if (pNextEnt->IsAlive()) + { + if (IRelationship(pNextEnt) > iBestRelationship) + { + // this entity is disliked MORE than the entity that we + // currently think is the best visible enemy. No need to do + // a distance check, just get mad at this one for now. + iBestRelationship = IRelationship(pNextEnt); + iNearest = (pNextEnt->pev->origin - pev->origin).Length(); + pReturn = pNextEnt; + } + else if (IRelationship(pNextEnt) == iBestRelationship) + { + // this entity is disliked just as much as the entity that + // we currently think is the best visible enemy, so we only + // get mad at it if it is closer. + iDist = (pNextEnt->pev->origin - pev->origin).Length(); + + if (iDist <= iNearest) + { + iNearest = iDist; + iBestRelationship = IRelationship(pNextEnt); + pReturn = pNextEnt; + } + } + } + + pNextEnt = pNextEnt->m_pLink; + } + return pReturn; } diff --git a/regamedll/dlls/multiplay_gamerules.cpp b/regamedll/dlls/multiplay_gamerules.cpp index 55ce55bc..41582b38 100644 --- a/regamedll/dlls/multiplay_gamerules.cpp +++ b/regamedll/dlls/multiplay_gamerules.cpp @@ -998,14 +998,14 @@ void CHalfLifeMultiplay::QueueCareerRoundEndMenu(float tmDelay, int iWinStatus) if (m_iNumTerroristWins < m_iCareerMatchWins || (m_iNumTerroristWins - m_iNumCTWins < m_iRoundWinDifference)) canTsWin = false; - - if (!TheCareerTasks->AreAllTasksComplete()) - { - if (humansAreCTs) - return; - - canTsWin = false; - } + + if (!TheCareerTasks->AreAllTasksComplete()) + { + if (humansAreCTs) + return; + + canTsWin = false; + } if (canCTsWin || canTsWin) { @@ -2593,28 +2593,28 @@ void CHalfLifeMultiplay::__MAKE_VHOOK(Think)(void) } else { - if (m_fCareerMatchMenuTime + 10 <= gpGlobals->time || !IsBotSpeaking()) - { - UTIL_CareerDPrintf("Ending career match...one team has won the specified number of rounds\n"); - - MESSAGE_BEGIN(MSG_ALL, gmsgCZCareer); - WRITE_STRING("MATCH"); - WRITE_LONG(m_iNumCTWins); - WRITE_LONG(m_iNumTerroristWins); - MESSAGE_END(); - - MESSAGE_BEGIN(MSG_ALL, gmsgCZCareerHUD); - WRITE_STRING("MATCH"); - WRITE_LONG(m_iNumCTWins); - WRITE_LONG(m_iNumTerroristWins); - WRITE_BYTE(m_iCareerMatchWins); - WRITE_BYTE(m_iRoundWinDifference); - WRITE_BYTE(m_iRoundWinStatus); - MESSAGE_END(); - - UTIL_LogPrintf("Career Match %d %d %d %d\n", m_iRoundWinStatus, m_iNumCTWins, m_iNumTerroristWins, TheCareerTasks->AreAllTasksComplete()); - - SERVER_COMMAND("setpause\n"); + if (m_fCareerMatchMenuTime + 10 <= gpGlobals->time || !IsBotSpeaking()) + { + UTIL_CareerDPrintf("Ending career match...one team has won the specified number of rounds\n"); + + MESSAGE_BEGIN(MSG_ALL, gmsgCZCareer); + WRITE_STRING("MATCH"); + WRITE_LONG(m_iNumCTWins); + WRITE_LONG(m_iNumTerroristWins); + MESSAGE_END(); + + MESSAGE_BEGIN(MSG_ALL, gmsgCZCareerHUD); + WRITE_STRING("MATCH"); + WRITE_LONG(m_iNumCTWins); + WRITE_LONG(m_iNumTerroristWins); + WRITE_BYTE(m_iCareerMatchWins); + WRITE_BYTE(m_iRoundWinDifference); + WRITE_BYTE(m_iRoundWinStatus); + MESSAGE_END(); + + UTIL_LogPrintf("Career Match %d %d %d %d\n", m_iRoundWinStatus, m_iNumCTWins, m_iNumTerroristWins, TheCareerTasks->AreAllTasksComplete()); + + SERVER_COMMAND("setpause\n"); } } } @@ -2665,9 +2665,9 @@ bool CHalfLifeMultiplay::CheckTimeLimit(void) if (!IsCareer()) { - if (fTimeLimit != 0.0f) - { - g_flTimeLimit = g_flResetTime + fTimeLimit * 60.0f; + if (fTimeLimit != 0.0f) + { + g_flTimeLimit = g_flResetTime + fTimeLimit * 60.0f; } if (fTimeLimit > 0 && gpGlobals->time >= g_flTimeLimit) diff --git a/regamedll/dlls/observer.cpp b/regamedll/dlls/observer.cpp index d7d5ca87..142a8330 100644 --- a/regamedll/dlls/observer.cpp +++ b/regamedll/dlls/observer.cpp @@ -1,7 +1,6 @@ #include "precompiled.h" -/* <11c190> ../cstrike/dlls/observer.cpp:36 */ -int GetForceCamera(void) +int GetForceCamera_api(CBasePlayer *pObserver) { int retVal; @@ -18,19 +17,30 @@ int GetForceCamera(void) return retVal; } +/* <11c190> ../cstrike/dlls/observer.cpp:36 */ +int GetForceCamera(CBasePlayer *pObserver) +{ + return g_ReGameHookchains.m_GetForceCamera.callChain(GetForceCamera_api, pObserver); +} + +CBasePlayer *Observer_IsValidTarget_api(CBasePlayer *pPlayer, CBasePlayer *pEntity, int iPlayerIndex, bool bSameTeam) +{ + // Don't spec observers or players who haven't picked a class yet + if (!pEntity || pEntity == pPlayer || pEntity->has_disconnected || pEntity->IsObserver() || (pEntity->pev->effects & EF_NODRAW) || pEntity->m_iTeam == UNASSIGNED || (bSameTeam && pEntity->m_iTeam != pPlayer->m_iTeam)) + return NULL; + + return pEntity; +} + /* <11c4fa> ../cstrike/dlls/observer.cpp:49 */ CBaseEntity *CBasePlayer::Observer_IsValidTarget(int iPlayerIndex, bool bSameTeam) { if (iPlayerIndex > gpGlobals->maxClients || iPlayerIndex < 1) return NULL; - CBaseEntity *pEnt = UTIL_PlayerByIndex(iPlayerIndex); + CBasePlayer *pEnt = (CBasePlayer *)UTIL_PlayerByIndex(iPlayerIndex); - // Don't spec observers or players who haven't picked a class yet - if (!pEnt || pEnt == this || pEnt->has_disconnected || ((CBasePlayer *)pEnt)->IsObserver() || (pEnt->pev->effects & EF_NODRAW) || ((CBasePlayer *)pEnt)->m_iTeam == UNASSIGNED || (bSameTeam && ((CBasePlayer *)pEnt)->m_iTeam != m_iTeam)) - return NULL; - - return pEnt; + return g_ReGameHookchains.m_Observer_IsValidTarget.callChain(Observer_IsValidTarget_api, this, pEnt, iPlayerIndex, bSameTeam); } /* <11c2c7> ../cstrike/dlls/observer.cpp:82 */ @@ -147,7 +157,7 @@ void CBasePlayer::Observer_FindNextPlayer(bool bReverse, const char *name) iDir = bReverse ? -1 : 1; - bForceSameTeam = (GetForceCamera() != CAMERA_MODE_SPEC_ANYONE && m_iTeam != SPECTATOR); + bForceSameTeam = (GetForceCamera(this) != CAMERA_MODE_SPEC_ANYONE && m_iTeam != SPECTATOR); do { @@ -441,7 +451,7 @@ void CBasePlayer::Observer_SetMode(int iMode) if (iMode == pev->iuser1) return; - _forcecamera = GetForceCamera(); + _forcecamera = GetForceCamera(this); // is valid mode ? if (iMode < OBS_CHASE_LOCKED || iMode > OBS_MAP_CHASE) diff --git a/regamedll/dlls/observer.h b/regamedll/dlls/observer.h index b3cd5f64..46bc5487 100644 --- a/regamedll/dlls/observer.h +++ b/regamedll/dlls/observer.h @@ -36,7 +36,7 @@ #define CAMERA_MODE_SPEC_ONLY_TEAM 1 #define CAMERA_MODE_SPEC_ONLY_FRIST_PERSON 2 -int GetForceCamera(void); +int GetForceCamera(CBasePlayer *pObserver); void UpdateClientEffects(CBasePlayer *pObserver, int oldMode); #endif // OBSERVER_H diff --git a/regamedll/dlls/pathcorner.cpp b/regamedll/dlls/pathcorner.cpp index b637002c..e9a6c3dd 100644 --- a/regamedll/dlls/pathcorner.cpp +++ b/regamedll/dlls/pathcorner.cpp @@ -21,8 +21,8 @@ TYPEDESCRIPTION CPathTrack::m_SaveData[] = #else -TYPEDESCRIPTION IMPLEMENT_ARRAY_CLASS(CPathCorner, m_SaveData)[1]; -TYPEDESCRIPTION IMPLEMENT_ARRAY_CLASS(CPathTrack, m_SaveData)[5]; +TYPEDESCRIPTION IMPL_CLASS(CPathCorner, m_SaveData)[1]; +TYPEDESCRIPTION IMPL_CLASS(CPathTrack, m_SaveData)[5]; #endif // HOOK_GAMEDLL diff --git a/regamedll/dlls/pathcorner.h b/regamedll/dlls/pathcorner.h index 26bfc926..7370236e 100644 --- a/regamedll/dlls/pathcorner.h +++ b/regamedll/dlls/pathcorner.h @@ -55,7 +55,7 @@ public: #endif // HOOK_GAMEDLL public: - static TYPEDESCRIPTION IMPLEMENT_ARRAY(m_SaveData)[1]; + static TYPEDESCRIPTION IMPL(m_SaveData)[1]; private: float m_flWait; diff --git a/regamedll/dlls/plats.cpp b/regamedll/dlls/plats.cpp index 41519319..7ced4996 100644 --- a/regamedll/dlls/plats.cpp +++ b/regamedll/dlls/plats.cpp @@ -61,12 +61,12 @@ TYPEDESCRIPTION CGunTarget::m_SaveData[] = #else -TYPEDESCRIPTION IMPLEMENT_ARRAY_CLASS(CBasePlatTrain, m_SaveData)[3]; -TYPEDESCRIPTION IMPLEMENT_ARRAY_CLASS(CFuncPlatRot, m_SaveData)[2]; -TYPEDESCRIPTION IMPLEMENT_ARRAY_CLASS(CFuncTrain, m_SaveData)[3]; -TYPEDESCRIPTION IMPLEMENT_ARRAY_CLASS(CFuncTrackTrain, m_SaveData)[12]; -TYPEDESCRIPTION IMPLEMENT_ARRAY_CLASS(CFuncTrackChange, m_SaveData)[9]; -TYPEDESCRIPTION IMPLEMENT_ARRAY_CLASS(CGunTarget, m_SaveData)[1]; +TYPEDESCRIPTION IMPL_CLASS(CBasePlatTrain, m_SaveData)[3]; +TYPEDESCRIPTION IMPL_CLASS(CFuncPlatRot, m_SaveData)[2]; +TYPEDESCRIPTION IMPL_CLASS(CFuncTrain, m_SaveData)[3]; +TYPEDESCRIPTION IMPL_CLASS(CFuncTrackTrain, m_SaveData)[12]; +TYPEDESCRIPTION IMPL_CLASS(CFuncTrackChange, m_SaveData)[9]; +TYPEDESCRIPTION IMPL_CLASS(CGunTarget, m_SaveData)[1]; #endif // HOOK_GAMEDLL @@ -1621,12 +1621,12 @@ void CFuncTrackTrain::__MAKE_VHOOK(Precache)(void) // no sound pev->noise = 0; break; - case 1: PRECACHE_SOUND("plats/ttrain1.wav"); pev->noise = MAKE_STRING("plats/ttrain1.wav");break; - case 2: PRECACHE_SOUND("plats/ttrain2.wav"); pev->noise = MAKE_STRING("plats/ttrain2.wav");break; - case 3: PRECACHE_SOUND("plats/ttrain3.wav"); pev->noise = MAKE_STRING("plats/ttrain3.wav");break; - case 4: PRECACHE_SOUND("plats/ttrain4.wav"); pev->noise = MAKE_STRING("plats/ttrain4.wav");break; - case 5: PRECACHE_SOUND("plats/ttrain6.wav"); pev->noise = MAKE_STRING("plats/ttrain6.wav");break; - case 6: PRECACHE_SOUND("plats/ttrain7.wav"); pev->noise = MAKE_STRING("plats/ttrain7.wav");break; + case 1: PRECACHE_SOUND("plats/ttrain1.wav"); pev->noise = MAKE_STRING("plats/ttrain1.wav"); break; + case 2: PRECACHE_SOUND("plats/ttrain2.wav"); pev->noise = MAKE_STRING("plats/ttrain2.wav"); break; + case 3: PRECACHE_SOUND("plats/ttrain3.wav"); pev->noise = MAKE_STRING("plats/ttrain3.wav"); break; + case 4: PRECACHE_SOUND("plats/ttrain4.wav"); pev->noise = MAKE_STRING("plats/ttrain4.wav"); break; + case 5: PRECACHE_SOUND("plats/ttrain6.wav"); pev->noise = MAKE_STRING("plats/ttrain6.wav"); break; + case 6: PRECACHE_SOUND("plats/ttrain7.wav"); pev->noise = MAKE_STRING("plats/ttrain7.wav"); break; } PRECACHE_SOUND("plats/ttrain_brake1.wav"); diff --git a/regamedll/dlls/plats.h b/regamedll/dlls/plats.h index 5cf1aca5..a50e01fa 100644 --- a/regamedll/dlls/plats.h +++ b/regamedll/dlls/plats.h @@ -75,7 +75,7 @@ public: #endif // HOOK_GAMEDLL public: - static TYPEDESCRIPTION IMPLEMENT_ARRAY(m_SaveData)[3]; + static TYPEDESCRIPTION IMPL(m_SaveData)[3]; public: BYTE m_bMoveSnd; @@ -171,7 +171,7 @@ public: void RotMove(Vector &destAngle, float time); public: - static TYPEDESCRIPTION IMPLEMENT_ARRAY(m_SaveData)[2]; + static TYPEDESCRIPTION IMPL(m_SaveData)[2]; public: Vector m_end; @@ -214,7 +214,7 @@ public: void EXPORT Next(void); public: - static TYPEDESCRIPTION IMPLEMENT_ARRAY(m_SaveData)[3]; + static TYPEDESCRIPTION IMPL(m_SaveData)[3]; public: Vector m_vStartPosition; @@ -308,7 +308,7 @@ public: } public: - static TYPEDESCRIPTION IMPLEMENT_ARRAY(m_SaveData)[9]; + static TYPEDESCRIPTION IMPL(m_SaveData)[9]; public: CPathTrack *m_trackTop; @@ -350,7 +350,7 @@ public: virtual int Restore(CRestore &restore); virtual int ObjectCaps(void) { - return CBaseEntity::ObjectCaps() & ~FCAP_ACROSS_TRANSITION; + return (CBaseEntity::ObjectCaps() & ~FCAP_ACROSS_TRANSITION); } virtual void Activate(void); virtual int Classify(void) @@ -386,7 +386,7 @@ public: void Stop(void); public: - static TYPEDESCRIPTION IMPLEMENT_ARRAY(m_SaveData)[1]; + static TYPEDESCRIPTION IMPL(m_SaveData)[1]; private: BOOL m_on; diff --git a/regamedll/dlls/player.cpp b/regamedll/dlls/player.cpp index 64e53778..f52630b7 100644 --- a/regamedll/dlls/player.cpp +++ b/regamedll/dlls/player.cpp @@ -275,8 +275,8 @@ int gmsgShowTimer; BOOL gInitHUD; cvar_t *sv_aim; -TYPEDESCRIPTION IMPLEMENT_ARRAY_CLASS(CRevertSaved, m_SaveData)[2]; -TYPEDESCRIPTION IMPLEMENT_ARRAY_CLASS(CBasePlayer, m_playerSaveData)[40]; +TYPEDESCRIPTION IMPL_CLASS(CRevertSaved, m_SaveData)[2]; +TYPEDESCRIPTION IMPL_CLASS(CBasePlayer, m_playerSaveData)[40]; WeaponStruct g_weaponStruct[ MAX_WEAPONS ]; char *(*CDeadHEV::pm_szPoses)[4]; @@ -395,7 +395,7 @@ void WriteSigonMessages(void) { for (int i = 0; i < MAX_WEAPONS; i++) { - ItemInfo &II = IMPLEMENT_ARRAY_CLASS(CBasePlayerItem, ItemInfoArray)[i]; + ItemInfo &II = IMPL_CLASS(CBasePlayerItem, ItemInfoArray)[i]; if (!II.iId) continue; @@ -1520,7 +1520,7 @@ void packPlayerItem(CBasePlayer *pPlayer, CBasePlayerItem *pItem, bool packAmmo) if (packAmmo) { - pWeaponBox->PackAmmo(MAKE_STRING(IMPLEMENT_ARRAY_CLASS(CBasePlayerItem, ItemInfoArray)[pItem->m_iId].pszAmmo1), pPlayer->m_rgAmmo[pItem->PrimaryAmmoIndex()]); + pWeaponBox->PackAmmo(MAKE_STRING(IMPL_CLASS(CBasePlayerItem, ItemInfoArray)[pItem->m_iId].pszAmmo1), pPlayer->m_rgAmmo[pItem->PrimaryAmmoIndex()]); } SET_MODEL(ENT(pWeaponBox->pev), modelName); } @@ -5587,7 +5587,7 @@ int CBasePlayer::__MAKE_VHOOK(Save)(CSave &save) if (!CBaseMonster::Save(save)) return 0; - return save.WriteFields("PLAYER", this, IMPLEMENT_ARRAY_CLASS(CBasePlayer, m_playerSaveData), ARRAYSIZE(IMPLEMENT_ARRAY_CLASS(CBasePlayer, m_playerSaveData))); + return save.WriteFields("PLAYER", this, IMPL_CLASS(CBasePlayer, m_playerSaveData), ARRAYSIZE(IMPL_CLASS(CBasePlayer, m_playerSaveData))); } /* <153355> ../cstrike/dlls/player.cpp:6685 */ @@ -5622,7 +5622,7 @@ int CBasePlayer::__MAKE_VHOOK(Restore)(CRestore &restore) if (!CBaseMonster::Restore(restore)) return 0; - int status = restore.ReadFields("PLAYER", this, IMPLEMENT_ARRAY_CLASS(CBasePlayer, m_playerSaveData), ARRAYSIZE(IMPLEMENT_ARRAY_CLASS(CBasePlayer, m_playerSaveData))); + int status = restore.ReadFields("PLAYER", this, IMPL_CLASS(CBasePlayer, m_playerSaveData), ARRAYSIZE(IMPL_CLASS(CBasePlayer, m_playerSaveData))); SAVERESTOREDATA *pSaveData = (SAVERESTOREDATA *)gpGlobals->pSaveData; // landmark isn't present. @@ -6622,10 +6622,10 @@ int CBasePlayer::GetAmmoIndex(const char *psz) for (int i = 1; i < MAX_AMMO_SLOTS; i++) { - if (!IMPLEMENT_ARRAY_CLASS(CBasePlayerItem, AmmoInfoArray)[ i ].pszName) + if (!IMPL_CLASS(CBasePlayerItem, AmmoInfoArray)[ i ].pszName) continue; - if (!Q_stricmp(psz, IMPLEMENT_ARRAY_CLASS(CBasePlayerItem, AmmoInfoArray)[ i ].pszName)) + if (!Q_stricmp(psz, IMPL_CLASS(CBasePlayerItem, AmmoInfoArray)[ i ].pszName)) return i; } return -1; diff --git a/regamedll/dlls/player.h b/regamedll/dlls/player.h index 8eb730af..9dda0201 100644 --- a/regamedll/dlls/player.h +++ b/regamedll/dlls/player.h @@ -270,7 +270,7 @@ struct WeaponStruct };/* size: 20, cachelines: 1, members: 5 */ -#define DEFINE_WEAPON(m_wpnid, m_cost, m_slotnum, m_acost)\ +#define DEFINE_WEAPON(m_wpnid, m_cost, m_slotnum, m_acost)\ { m_wpnid, m_cost, 3, m_slotnum, m_acost } #ifdef HOOK_GAMEDLL @@ -758,7 +758,6 @@ public: //m_musicState = INTENSE; //m_intenseTimestamp = gpGlobals->time; } - public: enum { MaxLocationLen = 32 }; @@ -913,7 +912,7 @@ public: float m_flNextDecalTime; char m_szTeamName[ TEAM_NAME_LENGTH ]; - static TYPEDESCRIPTION IMPLEMENT_ARRAY(m_playerSaveData)[40]; + static TYPEDESCRIPTION IMPL(m_playerSaveData)[40]; /*protected:*/ int m_modelIndexPlayer; diff --git a/regamedll/dlls/revert_saved.h b/regamedll/dlls/revert_saved.h index cc0c10e8..fca0fc49 100644 --- a/regamedll/dlls/revert_saved.h +++ b/regamedll/dlls/revert_saved.h @@ -89,7 +89,7 @@ public: } public: - static TYPEDESCRIPTION IMPLEMENT_ARRAY(m_SaveData)[2]; + static TYPEDESCRIPTION IMPL(m_SaveData)[2]; public: float m_messageTime; diff --git a/regamedll/dlls/saverestore.h b/regamedll/dlls/saverestore.h index 37b480d0..6cebc2ba 100644 --- a/regamedll/dlls/saverestore.h +++ b/regamedll/dlls/saverestore.h @@ -40,6 +40,7 @@ #define IMPLEMENT_ARRAY(var)\ var +#define IMPL_CLASS IMPLEMENT_ARRAY_CLASS #define IMPLEMENT_ARRAY_CLASS(baseClass,var)\ baseClass::var @@ -49,6 +50,7 @@ #define IMPLEMENT_ARRAY(var)\ (*p##var) +#define IMPL_CLASS IMPLEMENT_ARRAY_CLASS #define IMPLEMENT_ARRAY_CLASS(baseClass,var)\ (*baseClass::p##var) diff --git a/regamedll/dlls/singleplay_gamerules.cpp b/regamedll/dlls/singleplay_gamerules.cpp index 14266ce0..2e88bfe2 100644 --- a/regamedll/dlls/singleplay_gamerules.cpp +++ b/regamedll/dlls/singleplay_gamerules.cpp @@ -34,17 +34,17 @@ BOOL CHalfLifeRules::__MAKE_VHOOK(IsCoOp)(void) /* <166df5> ../cstrike/dlls/singleplay_gamerules.cpp:68 */ BOOL CHalfLifeRules::__MAKE_VHOOK(FShouldSwitchWeapon)(CBasePlayer *pPlayer, CBasePlayerItem *pWeapon) { - if (!pPlayer->m_pActiveItem) - { - // player doesn't have an active item! - return TRUE; - } - - if (!pPlayer->m_pActiveItem->CanHolster()) - { - return FALSE; - } - + if (!pPlayer->m_pActiveItem) + { + // player doesn't have an active item! + return TRUE; + } + + if (!pPlayer->m_pActiveItem->CanHolster()) + { + return FALSE; + } + return TRUE; } @@ -75,7 +75,7 @@ void CHalfLifeRules::__MAKE_VHOOK(ClientDisconnected)(edict_t *pClient) /* <166f3f> ../cstrike/dlls/singleplay_gamerules.cpp:110 */ float CHalfLifeRules::__MAKE_VHOOK(FlPlayerFallDamage)(CBasePlayer *pPlayer) { - // subtract off the speed at which a player is allowed to fall without being hurt, + // subtract off the speed at which a player is allowed to fall without being hurt, // so damage will be based on speed beyond that, not the entire fall pPlayer->m_flFallVelocity -= PLAYER_MAX_SAFE_FALL_SPEED; return pPlayer->m_flFallVelocity * DAMAGE_FOR_FALL_SPEED; @@ -171,14 +171,14 @@ edict_t *CHalfLifeRules::__MAKE_VHOOK(GetPlayerSpawnSpot)(CBasePlayer *pPlayer) ALERT(at_error, "PutClientInServer: no info_player_start on level"); return INDEXENT(0); } - - pPlayer->pev->origin = pSpot->pev->origin + Vector(0, 0, 1); - pPlayer->pev->v_angle = g_vecZero; - pPlayer->pev->velocity = g_vecZero; - pPlayer->pev->angles = pSpot->pev->angles; - pPlayer->pev->punchangle = g_vecZero; - pPlayer->pev->fixangle = 1; - + + pPlayer->pev->origin = pSpot->pev->origin + Vector(0, 0, 1); + pPlayer->pev->v_angle = g_vecZero; + pPlayer->pev->velocity = g_vecZero; + pPlayer->pev->angles = pSpot->pev->angles; + pPlayer->pev->punchangle = g_vecZero; + pPlayer->pev->fixangle = 1; + return pSpot->edict(); } @@ -269,7 +269,7 @@ int CHalfLifeRules::__MAKE_VHOOK(DeadPlayerAmmo)(CBasePlayer *pPlayer) /* <16757c> ../cstrike/dlls/singleplay_gamerules.cpp:343 */ int CHalfLifeRules::__MAKE_VHOOK(PlayerRelationship)(CBasePlayer *pPlayer, CBaseEntity *pTarget) { - // why would a single player in half life need this? + // why would a single player in half life need this? return GR_NOTTEAMMATE; } @@ -281,199 +281,199 @@ BOOL CHalfLifeRules::__MAKE_VHOOK(FAllowMonsters)(void) #ifdef HOOK_GAMEDLL -void CHalfLifeRules::Think(void) -{ - Think_(); -} - -BOOL CHalfLifeRules::IsAllowedToSpawn(CBaseEntity *pEntity) -{ - return IsAllowedToSpawn_(pEntity); -} - -BOOL CHalfLifeRules::FShouldSwitchWeapon(CBasePlayer *pPlayer, CBasePlayerItem *pWeapon) -{ - return FShouldSwitchWeapon_(pPlayer, pWeapon); -} - -BOOL CHalfLifeRules::GetNextBestWeapon(CBasePlayer *pPlayer, CBasePlayerItem *pCurrentWeapon) -{ - return GetNextBestWeapon_(pPlayer, pCurrentWeapon); -} - -BOOL CHalfLifeRules::IsMultiplayer(void) -{ - return IsMultiplayer_(); -} - -BOOL CHalfLifeRules::IsDeathmatch(void) -{ - return IsDeathmatch_(); -} - -BOOL CHalfLifeRules::IsCoOp(void) -{ - return IsCoOp_(); -} - -BOOL CHalfLifeRules::ClientConnected(edict_t *pEntity, const char *pszName, const char *pszAddress, char szRejectReason[128]) -{ - return ClientConnected_(pEntity, pszName, pszAddress, szRejectReason); -} - -void CHalfLifeRules::InitHUD(CBasePlayer *pl) -{ - InitHUD_(pl); -} - -void CHalfLifeRules::ClientDisconnected(edict_t *pClient) -{ - ClientDisconnected_(pClient); -} - -float CHalfLifeRules::FlPlayerFallDamage(CBasePlayer *pPlayer) -{ - return FlPlayerFallDamage_(pPlayer); -} - -void CHalfLifeRules::PlayerSpawn(CBasePlayer *pPlayer) -{ - PlayerSpawn_(pPlayer); -} - -void CHalfLifeRules::PlayerThink(CBasePlayer *pPlayer) -{ - PlayerThink_(pPlayer); -} - -BOOL CHalfLifeRules::FPlayerCanRespawn(CBasePlayer *pPlayer) -{ - return FPlayerCanRespawn_(pPlayer); -} - -float CHalfLifeRules::FlPlayerSpawnTime(CBasePlayer *pPlayer) -{ - return FlPlayerSpawnTime_(pPlayer); -} - -edict_t *CHalfLifeRules::GetPlayerSpawnSpot(CBasePlayer *pPlayer) -{ - return GetPlayerSpawnSpot_(pPlayer); -} - -BOOL CHalfLifeRules::AllowAutoTargetCrosshair(void) -{ - return AllowAutoTargetCrosshair_(); -} - -int CHalfLifeRules::IPointsForKill(CBasePlayer *pAttacker, CBasePlayer *pKilled) -{ - return IPointsForKill_(pAttacker, pKilled); -} - -void CHalfLifeRules::PlayerKilled(CBasePlayer *pVictim, entvars_t *pKiller, entvars_t *pInflictor) -{ - PlayerKilled_(pVictim, pKiller, pInflictor); -} - -void CHalfLifeRules::DeathNotice(CBasePlayer *pVictim, entvars_t *pKiller, entvars_t *pInflictor) -{ - DeathNotice_(pVictim, pKiller, pInflictor); -} - -void CHalfLifeRules::PlayerGotWeapon(CBasePlayer *pPlayer, CBasePlayerItem *pWeapon) -{ - PlayerGotWeapon_(pPlayer, pWeapon); -} - -int CHalfLifeRules::WeaponShouldRespawn(CBasePlayerItem *pWeapon) -{ - return WeaponShouldRespawn_(pWeapon); -} - -float CHalfLifeRules::FlWeaponRespawnTime(CBasePlayerItem *pWeapon) -{ - return FlWeaponRespawnTime_(pWeapon); -} - -float CHalfLifeRules::FlWeaponTryRespawn(CBasePlayerItem *pWeapon) -{ - return FlWeaponTryRespawn_(pWeapon); -} - -Vector CHalfLifeRules::VecWeaponRespawnSpot(CBasePlayerItem *pWeapon) -{ - return VecWeaponRespawnSpot_(pWeapon); -} - -BOOL CHalfLifeRules::CanHaveItem(CBasePlayer *pPlayer, CItem *pItem) -{ - return CanHaveItem_(pPlayer, pItem); -} - -void CHalfLifeRules::PlayerGotItem(CBasePlayer *pPlayer, CItem *pItem) -{ - PlayerGotItem_(pPlayer, pItem); -} - -int CHalfLifeRules::ItemShouldRespawn(CItem *pItem) -{ - return ItemShouldRespawn_(pItem); -} - -float CHalfLifeRules::FlItemRespawnTime(CItem *pItem) -{ - return FlItemRespawnTime_(pItem); -} - -Vector CHalfLifeRules::VecItemRespawnSpot(CItem *pItem) -{ - return VecItemRespawnSpot_(pItem); -} - -void CHalfLifeRules::PlayerGotAmmo(CBasePlayer *pPlayer, char *szName, int iCount) -{ - PlayerGotAmmo_(pPlayer, szName, iCount); -} - -int CHalfLifeRules::AmmoShouldRespawn(CBasePlayerAmmo *pAmmo) -{ - return AmmoShouldRespawn_(pAmmo); -} - -float CHalfLifeRules::FlAmmoRespawnTime(CBasePlayerAmmo *pAmmo) -{ - return FlAmmoRespawnTime_(pAmmo); -} - -Vector CHalfLifeRules::VecAmmoRespawnSpot(CBasePlayerAmmo *pAmmo) -{ - return VecAmmoRespawnSpot_(pAmmo); -} - -float CHalfLifeRules::FlHealthChargerRechargeTime(void) -{ - return FlHealthChargerRechargeTime_(); -} - -int CHalfLifeRules::DeadPlayerWeapons(CBasePlayer *pPlayer) -{ - return DeadPlayerWeapons_(pPlayer); -} - -int CHalfLifeRules::DeadPlayerAmmo(CBasePlayer *pPlayer) -{ - return DeadPlayerAmmo_(pPlayer); -} - -int CHalfLifeRules::PlayerRelationship(CBasePlayer *pPlayer, CBaseEntity *pTarget) -{ - return PlayerRelationship_(pPlayer, pTarget); -} - -BOOL CHalfLifeRules::FAllowMonsters(void) -{ - return FAllowMonsters_(); +void CHalfLifeRules::Think(void) +{ + Think_(); +} + +BOOL CHalfLifeRules::IsAllowedToSpawn(CBaseEntity *pEntity) +{ + return IsAllowedToSpawn_(pEntity); +} + +BOOL CHalfLifeRules::FShouldSwitchWeapon(CBasePlayer *pPlayer, CBasePlayerItem *pWeapon) +{ + return FShouldSwitchWeapon_(pPlayer, pWeapon); +} + +BOOL CHalfLifeRules::GetNextBestWeapon(CBasePlayer *pPlayer, CBasePlayerItem *pCurrentWeapon) +{ + return GetNextBestWeapon_(pPlayer, pCurrentWeapon); +} + +BOOL CHalfLifeRules::IsMultiplayer(void) +{ + return IsMultiplayer_(); +} + +BOOL CHalfLifeRules::IsDeathmatch(void) +{ + return IsDeathmatch_(); +} + +BOOL CHalfLifeRules::IsCoOp(void) +{ + return IsCoOp_(); +} + +BOOL CHalfLifeRules::ClientConnected(edict_t *pEntity, const char *pszName, const char *pszAddress, char szRejectReason[128]) +{ + return ClientConnected_(pEntity, pszName, pszAddress, szRejectReason); +} + +void CHalfLifeRules::InitHUD(CBasePlayer *pl) +{ + InitHUD_(pl); +} + +void CHalfLifeRules::ClientDisconnected(edict_t *pClient) +{ + ClientDisconnected_(pClient); +} + +float CHalfLifeRules::FlPlayerFallDamage(CBasePlayer *pPlayer) +{ + return FlPlayerFallDamage_(pPlayer); +} + +void CHalfLifeRules::PlayerSpawn(CBasePlayer *pPlayer) +{ + PlayerSpawn_(pPlayer); +} + +void CHalfLifeRules::PlayerThink(CBasePlayer *pPlayer) +{ + PlayerThink_(pPlayer); +} + +BOOL CHalfLifeRules::FPlayerCanRespawn(CBasePlayer *pPlayer) +{ + return FPlayerCanRespawn_(pPlayer); +} + +float CHalfLifeRules::FlPlayerSpawnTime(CBasePlayer *pPlayer) +{ + return FlPlayerSpawnTime_(pPlayer); +} + +edict_t *CHalfLifeRules::GetPlayerSpawnSpot(CBasePlayer *pPlayer) +{ + return GetPlayerSpawnSpot_(pPlayer); +} + +BOOL CHalfLifeRules::AllowAutoTargetCrosshair(void) +{ + return AllowAutoTargetCrosshair_(); +} + +int CHalfLifeRules::IPointsForKill(CBasePlayer *pAttacker, CBasePlayer *pKilled) +{ + return IPointsForKill_(pAttacker, pKilled); +} + +void CHalfLifeRules::PlayerKilled(CBasePlayer *pVictim, entvars_t *pKiller, entvars_t *pInflictor) +{ + PlayerKilled_(pVictim, pKiller, pInflictor); +} + +void CHalfLifeRules::DeathNotice(CBasePlayer *pVictim, entvars_t *pKiller, entvars_t *pInflictor) +{ + DeathNotice_(pVictim, pKiller, pInflictor); +} + +void CHalfLifeRules::PlayerGotWeapon(CBasePlayer *pPlayer, CBasePlayerItem *pWeapon) +{ + PlayerGotWeapon_(pPlayer, pWeapon); +} + +int CHalfLifeRules::WeaponShouldRespawn(CBasePlayerItem *pWeapon) +{ + return WeaponShouldRespawn_(pWeapon); +} + +float CHalfLifeRules::FlWeaponRespawnTime(CBasePlayerItem *pWeapon) +{ + return FlWeaponRespawnTime_(pWeapon); +} + +float CHalfLifeRules::FlWeaponTryRespawn(CBasePlayerItem *pWeapon) +{ + return FlWeaponTryRespawn_(pWeapon); +} + +Vector CHalfLifeRules::VecWeaponRespawnSpot(CBasePlayerItem *pWeapon) +{ + return VecWeaponRespawnSpot_(pWeapon); +} + +BOOL CHalfLifeRules::CanHaveItem(CBasePlayer *pPlayer, CItem *pItem) +{ + return CanHaveItem_(pPlayer, pItem); +} + +void CHalfLifeRules::PlayerGotItem(CBasePlayer *pPlayer, CItem *pItem) +{ + PlayerGotItem_(pPlayer, pItem); +} + +int CHalfLifeRules::ItemShouldRespawn(CItem *pItem) +{ + return ItemShouldRespawn_(pItem); +} + +float CHalfLifeRules::FlItemRespawnTime(CItem *pItem) +{ + return FlItemRespawnTime_(pItem); +} + +Vector CHalfLifeRules::VecItemRespawnSpot(CItem *pItem) +{ + return VecItemRespawnSpot_(pItem); +} + +void CHalfLifeRules::PlayerGotAmmo(CBasePlayer *pPlayer, char *szName, int iCount) +{ + PlayerGotAmmo_(pPlayer, szName, iCount); +} + +int CHalfLifeRules::AmmoShouldRespawn(CBasePlayerAmmo *pAmmo) +{ + return AmmoShouldRespawn_(pAmmo); +} + +float CHalfLifeRules::FlAmmoRespawnTime(CBasePlayerAmmo *pAmmo) +{ + return FlAmmoRespawnTime_(pAmmo); +} + +Vector CHalfLifeRules::VecAmmoRespawnSpot(CBasePlayerAmmo *pAmmo) +{ + return VecAmmoRespawnSpot_(pAmmo); +} + +float CHalfLifeRules::FlHealthChargerRechargeTime(void) +{ + return FlHealthChargerRechargeTime_(); +} + +int CHalfLifeRules::DeadPlayerWeapons(CBasePlayer *pPlayer) +{ + return DeadPlayerWeapons_(pPlayer); +} + +int CHalfLifeRules::DeadPlayerAmmo(CBasePlayer *pPlayer) +{ + return DeadPlayerAmmo_(pPlayer); +} + +int CHalfLifeRules::PlayerRelationship(CBasePlayer *pPlayer, CBaseEntity *pTarget) +{ + return PlayerRelationship_(pPlayer, pTarget); +} + +BOOL CHalfLifeRules::FAllowMonsters(void) +{ + return FAllowMonsters_(); } #endif // HOOK_GAMEDLL \ No newline at end of file diff --git a/regamedll/dlls/skill.h b/regamedll/dlls/skill.h index 7fde7375..25a44385 100644 --- a/regamedll/dlls/skill.h +++ b/regamedll/dlls/skill.h @@ -38,20 +38,20 @@ struct skilldata_t { - int iSkillLevel; - float plrDmg9MM; - float plrDmg357; - float plrDmgMP5; - float plrDmgM203Grenade; - float plrDmgBuckshot; - float plrDmgCrossbowClient; - float plrDmgRPG; - float monDmg9MM; - float monDmgMP5; - float monDmg12MM; - float suitchargerCapacity; - float batteryCapacity; - float healthchargerCapacity; + int iSkillLevel; + float plrDmg9MM; + float plrDmg357; + float plrDmgMP5; + float plrDmgM203Grenade; + float plrDmgBuckshot; + float plrDmgCrossbowClient; + float plrDmgRPG; + float monDmg9MM; + float monDmgMP5; + float monDmg12MM; + float suitchargerCapacity; + float batteryCapacity; + float healthchargerCapacity; float healthkitCapacity; };/* size: 60, cachelines: 1, members: 15 */ diff --git a/regamedll/dlls/sound.cpp b/regamedll/dlls/sound.cpp index cb249b7b..fe6df99b 100644 --- a/regamedll/dlls/sound.cpp +++ b/regamedll/dlls/sound.cpp @@ -69,9 +69,9 @@ dynpitchvol_t rgdpvpreset[CDPVPRESETMAX]; int fSentencesInit; int gcallsentences; -TYPEDESCRIPTION IMPLEMENT_ARRAY_CLASS(CAmbientGeneric, m_SaveData)[4]; -TYPEDESCRIPTION IMPLEMENT_ARRAY_CLASS(CEnvSound, m_SaveData)[2]; -TYPEDESCRIPTION IMPLEMENT_ARRAY_CLASS(CSpeaker, m_SaveData)[1]; +TYPEDESCRIPTION IMPL_CLASS(CAmbientGeneric, m_SaveData)[4]; +TYPEDESCRIPTION IMPL_CLASS(CEnvSound, m_SaveData)[2]; +TYPEDESCRIPTION IMPL_CLASS(CSpeaker, m_SaveData)[1]; #endif // HOOK_GAMEDLL diff --git a/regamedll/dlls/sound.h b/regamedll/dlls/sound.h index 5057f122..e8e0a581 100644 --- a/regamedll/dlls/sound.h +++ b/regamedll/dlls/sound.h @@ -140,7 +140,7 @@ public: void InitModulationParms(void); public: - static TYPEDESCRIPTION IMPLEMENT_ARRAY(m_SaveData)[4]; + static TYPEDESCRIPTION IMPL(m_SaveData)[4]; float m_flAttenuation; // attenuation value dynpitchvol_t m_dpv; @@ -170,7 +170,7 @@ public: #endif // HOOK_GAMEDLL public: - static TYPEDESCRIPTION IMPLEMENT_ARRAY(m_SaveData)[2]; + static TYPEDESCRIPTION IMPL(m_SaveData)[2]; float m_flRadius; float m_flRoomtype; @@ -205,7 +205,7 @@ public: void EXPORT ToggleUse(CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value); void EXPORT SpeakerThink(void); public: - static TYPEDESCRIPTION IMPLEMENT_ARRAY(m_SaveData)[1]; + static TYPEDESCRIPTION IMPL(m_SaveData)[1]; int m_preset; // preset number diff --git a/regamedll/dlls/subs.cpp b/regamedll/dlls/subs.cpp index 0f4434e4..c99ae5a6 100644 --- a/regamedll/dlls/subs.cpp +++ b/regamedll/dlls/subs.cpp @@ -38,8 +38,8 @@ TYPEDESCRIPTION CBaseToggle::m_SaveData[] = #else // HOOK_GAMEDLL -TYPEDESCRIPTION IMPLEMENT_ARRAY_CLASS(CBaseDelay, m_SaveData)[2]; -TYPEDESCRIPTION IMPLEMENT_ARRAY_CLASS(CBaseToggle, m_SaveData)[19]; +TYPEDESCRIPTION IMPL_CLASS(CBaseDelay, m_SaveData)[2]; +TYPEDESCRIPTION IMPL_CLASS(CBaseToggle, m_SaveData)[19]; #endif // HOOK_GAMEDLL diff --git a/regamedll/dlls/training_gamerules.cpp b/regamedll/dlls/training_gamerules.cpp index 751a1f84..c3f8370e 100644 --- a/regamedll/dlls/training_gamerules.cpp +++ b/regamedll/dlls/training_gamerules.cpp @@ -26,8 +26,8 @@ TYPEDESCRIPTION CBaseGrenCatch::m_SaveData[] = #else -TYPEDESCRIPTION IMPLEMENT_ARRAY_CLASS(CFuncWeaponCheck, m_SaveData)[6]; -TYPEDESCRIPTION IMPLEMENT_ARRAY_CLASS(CBaseGrenCatch, m_SaveData)[5]; +TYPEDESCRIPTION IMPL_CLASS(CFuncWeaponCheck, m_SaveData)[6]; +TYPEDESCRIPTION IMPL_CLASS(CBaseGrenCatch, m_SaveData)[5]; #endif // HOOK_GAMEDLL diff --git a/regamedll/dlls/training_gamerules.h b/regamedll/dlls/training_gamerules.h index 37767b19..2e6b3bf7 100644 --- a/regamedll/dlls/training_gamerules.h +++ b/regamedll/dlls/training_gamerules.h @@ -106,7 +106,7 @@ public: #endif // HOOK_GAMEDLL public: - static TYPEDESCRIPTION IMPLEMENT_ARRAY(m_SaveData)[5]; + static TYPEDESCRIPTION IMPL(m_SaveData)[5]; int m_NeedGrenadeType; string_t sTriggerOnGrenade; @@ -137,7 +137,7 @@ public: #endif // HOOK_GAMEDLL public: - static TYPEDESCRIPTION IMPLEMENT_ARRAY(m_SaveData)[6]; + static TYPEDESCRIPTION IMPL(m_SaveData)[6]; private: string_t sTriggerWithItems; diff --git a/regamedll/dlls/trains.h b/regamedll/dlls/trains.h index 74a6e26f..c77fd2c5 100644 --- a/regamedll/dlls/trains.h +++ b/regamedll/dlls/trains.h @@ -88,7 +88,7 @@ public: CPathTrack *GetPrevious(void); public: - static TYPEDESCRIPTION IMPLEMENT_ARRAY(m_SaveData)[5]; + static TYPEDESCRIPTION IMPL(m_SaveData)[5]; float m_length; string_t m_altName; @@ -150,7 +150,7 @@ public: static CFuncTrackTrain *Instance(edict_t *pent); public: - static TYPEDESCRIPTION IMPLEMENT_ARRAY(m_SaveData)[12]; + static TYPEDESCRIPTION IMPL(m_SaveData)[12]; CPathTrack *m_ppath; float m_length; @@ -234,7 +234,7 @@ public: static CFuncVehicle *Instance(edict_t *pent); public: - static TYPEDESCRIPTION IMPLEMENT_ARRAY(m_SaveData)[12]; + static TYPEDESCRIPTION IMPL(m_SaveData)[12]; CPathTrack *m_ppath; float m_length; diff --git a/regamedll/dlls/triggers.cpp b/regamedll/dlls/triggers.cpp index d98a71c4..ca5b8c3f 100644 --- a/regamedll/dlls/triggers.cpp +++ b/regamedll/dlls/triggers.cpp @@ -68,13 +68,13 @@ FILE_GLOBAL char st_szNextSpot[cchMapNameMost]; #else -TYPEDESCRIPTION IMPLEMENT_ARRAY_CLASS(CFrictionModifier, m_SaveData)[1]; -TYPEDESCRIPTION IMPLEMENT_ARRAY_CLASS(CAutoTrigger, m_SaveData)[2]; -TYPEDESCRIPTION IMPLEMENT_ARRAY_CLASS(CTriggerRelay, m_SaveData)[1]; -TYPEDESCRIPTION IMPLEMENT_ARRAY_CLASS(CMultiManager, m_SaveData)[5]; -TYPEDESCRIPTION IMPLEMENT_ARRAY_CLASS(CChangeLevel, m_SaveData)[4]; -TYPEDESCRIPTION IMPLEMENT_ARRAY_CLASS(CTriggerChangeTarget, m_SaveData)[1]; -TYPEDESCRIPTION IMPLEMENT_ARRAY_CLASS(CTriggerCamera, m_SaveData)[13]; +TYPEDESCRIPTION IMPL_CLASS(CFrictionModifier, m_SaveData)[1]; +TYPEDESCRIPTION IMPL_CLASS(CAutoTrigger, m_SaveData)[2]; +TYPEDESCRIPTION IMPL_CLASS(CTriggerRelay, m_SaveData)[1]; +TYPEDESCRIPTION IMPL_CLASS(CMultiManager, m_SaveData)[5]; +TYPEDESCRIPTION IMPL_CLASS(CChangeLevel, m_SaveData)[4]; +TYPEDESCRIPTION IMPL_CLASS(CTriggerChangeTarget, m_SaveData)[1]; +TYPEDESCRIPTION IMPL_CLASS(CTriggerCamera, m_SaveData)[13]; char st_szNextMap[cchMapNameMost]; char st_szNextSpot[cchMapNameMost]; diff --git a/regamedll/dlls/triggers.h b/regamedll/dlls/triggers.h index 5aaeb0c2..700d9d1f 100644 --- a/regamedll/dlls/triggers.h +++ b/regamedll/dlls/triggers.h @@ -38,16 +38,16 @@ #define MAX_ITEM_COUNTS 32 #define MAX_ENTITY 512 // We can only ever move 512 entities across a transition -// triggers -#define SF_TRIGGER_ALLOWMONSTERS 1 // monsters allowed to fire this trigger -#define SF_TRIGGER_NOCLIENTS 2 // players not allowed to fire this trigger +// triggers +#define SF_TRIGGER_ALLOWMONSTERS 1 // monsters allowed to fire this trigger +#define SF_TRIGGER_NOCLIENTS 2 // players not allowed to fire this trigger #define SF_TRIGGER_PUSHABLES 4 // only pushables can fire this trigger -#define SF_TRIGGER_PUSH_START_OFF 2 // spawnflag that makes trigger_push spawn turned OFF -#define SF_TRIGGER_HURT_TARGETONCE 1 // Only fire hurt target once -#define SF_TRIGGER_HURT_START_OFF 2 // spawnflag that makes trigger_push spawn turned OFF -#define SF_TRIGGER_HURT_NO_CLIENTS 8 // spawnflag that makes trigger_push spawn turned OFF -#define SF_TRIGGER_HURT_CLIENTONLYFIRE 16 // trigger hurt will only fire its target if it is hurting a client +#define SF_TRIGGER_PUSH_START_OFF 2 // spawnflag that makes trigger_push spawn turned OFF +#define SF_TRIGGER_HURT_TARGETONCE 1 // Only fire hurt target once +#define SF_TRIGGER_HURT_START_OFF 2 // spawnflag that makes trigger_push spawn turned OFF +#define SF_TRIGGER_HURT_NO_CLIENTS 8 // spawnflag that makes trigger_push spawn turned OFF +#define SF_TRIGGER_HURT_CLIENTONLYFIRE 16 // trigger hurt will only fire its target if it is hurting a client #define SF_TRIGGER_HURT_CLIENTONLYTOUCH 32 // only clients may touch this trigger. #define SF_AUTO_FIREONCE 0x0001 @@ -62,11 +62,11 @@ #define SF_CAMERA_PLAYER_TARGET 2 #define SF_CAMERA_PLAYER_TAKECONTROL 4 -// Flags to indicate masking off various render parameters that are normally copied to the targets -#define SF_RENDER_MASKFX (1<<0) -#define SF_RENDER_MASKAMT (1<<1) -#define SF_RENDER_MASKMODE (1<<2) -#define SF_RENDER_MASKCOLOR (1<<3) +// Flags to indicate masking off various render parameters that are normally copied to the targets +#define SF_RENDER_MASKFX (1 << 0) +#define SF_RENDER_MASKAMT (1 << 1) +#define SF_RENDER_MASKMODE (1 << 2) +#define SF_RENDER_MASKCOLOR (1 << 3) class CFrictionModifier: public CBaseEntity { @@ -93,13 +93,13 @@ public: void EXPORT ChangeFriction(CBaseEntity *pOther); public: - static TYPEDESCRIPTION IMPLEMENT_ARRAY(m_SaveData)[1]; + static TYPEDESCRIPTION IMPL(m_SaveData)[1]; float m_frictionFraction; };/* size: 156, cachelines: 3, members: 3 */ -// This trigger will fire when the level spawns (or respawns if not fire once) +// This trigger will fire when the level spawns (or respawns if not fire once) // It will check a global state before firing. It supports delay and killtargets /* <19e39c> ../cstrike/dlls/triggers.cpp:108 */ @@ -129,7 +129,7 @@ public: #endif // HOOK_GAMEDLL public: - static TYPEDESCRIPTION IMPLEMENT_ARRAY(m_SaveData)[2]; + static TYPEDESCRIPTION IMPL(m_SaveData)[2]; int m_globalstate; USE_TYPE triggerType; @@ -161,15 +161,15 @@ public: #endif // HOOK_GAMEDLL public: - static TYPEDESCRIPTION IMPLEMENT_ARRAY(m_SaveData)[1]; + static TYPEDESCRIPTION IMPL(m_SaveData)[1]; USE_TYPE triggerType; };/* size: 164, cachelines: 3, members: 3 */ -// The Multimanager Entity - when fired, will fire up to 16 targets -// at specified times. -// FLAG: THREAD (create clones when triggered) +// The Multimanager Entity - when fired, will fire up to 16 targets +// at specified times. +// FLAG: THREAD (create clones when triggered) // FLAG: CLONE (this is a clone for a threaded execution) /* <19e4d6> ../cstrike/dlls/triggers.cpp:264 */ @@ -231,7 +231,7 @@ private: CMultiManager *Clone(void); public: - static TYPEDESCRIPTION IMPLEMENT_ARRAY(m_SaveData)[5]; + static TYPEDESCRIPTION IMPL(m_SaveData)[5]; int m_cTargets;//312 int m_index; @@ -242,9 +242,9 @@ public: };/* size: 452, cachelines: 8, members: 7 */ /* Linux - 452 | Windows - 432 */ -// Render parameters trigger -// -// This entity will copy its render parameters (renderfx, rendermode, rendercolor, renderamt) +// Render parameters trigger +// +// This entity will copy its render parameters (renderfx, rendermode, rendercolor, renderamt) // to its targets when triggered. /* <19e50c> ../cstrike/dlls/triggers.cpp:525 */ @@ -292,7 +292,7 @@ public: };/* size: 312, cachelines: 5, members: 1 */ -// trigger_hurt - hurts anything that touches it. if the trigger has a targetname, firing it will toggle state +// trigger_hurt - hurts anything that touches it. if the trigger has a targetname, firing it will toggle state // int gfToggleState = 0; // used to determine when all radiation trigger hurts have called 'RadiationThink' /* <19e5b2> ../cstrike/dlls/triggers.cpp:629 */ @@ -377,20 +377,20 @@ public: };/* size: 152, cachelines: 3, members: 1 */ -// QUAKED trigger_multiple (.5 .5 .5) ? notouch -// Variable sized repeatable trigger. Must be targeted at one or more entities. -// If "health" is set, the trigger must be killed to activate each time. -// If "delay" is set, the trigger waits some time after activating before firing. -// "wait" : Seconds between triggerings. (.2 default) -// If notouch is set, the trigger is only fired by other entities, not by touching. -// NOTOUCH has been obsoleted by trigger_relay! -// sounds -// 1) secret -// 2) beep beep -// 3) large switch -// 4) -// NEW -// if a trigger has a NETNAME, that NETNAME will become the TARGET of the triggered object. +// QUAKED trigger_multiple (.5 .5 .5) ? notouch +// Variable sized repeatable trigger. Must be targeted at one or more entities. +// If "health" is set, the trigger must be killed to activate each time. +// If "delay" is set, the trigger waits some time after activating before firing. +// "wait" : Seconds between triggerings. (.2 default) +// If notouch is set, the trigger is only fired by other entities, not by touching. +// NOTOUCH has been obsoleted by trigger_relay! +// sounds +// 1) secret +// 2) beep beep +// 3) large switch +// 4) +// NEW +// if a trigger has a NETNAME, that NETNAME will become the TARGET of the triggered object. /* <19e725> ../cstrike/dlls/triggers.cpp:1080 */ class CTriggerMultiple: public CBaseTrigger @@ -406,16 +406,16 @@ public: };/* size: 312, cachelines: 5, members: 1 */ -// QUAKED trigger_once (.5 .5 .5) ? notouch -// Variable sized trigger. Triggers once, then removes itself. You must set the key "target" to the name of another object in the level that has a matching -// "targetname". If "health" is set, the trigger must be killed to activate. -// If notouch is set, the trigger is only fired by other entities, not by touching. -// if "killtarget" is set, any objects that have a matching "target" will be removed when the trigger is fired. -// if "angle" is set, the trigger will only fire when someone is facing the direction of the angle. Use "360" for an angle of 0. -// sounds -// 1) secret -// 2) beep beep -// 3) large switch +// QUAKED trigger_once (.5 .5 .5) ? notouch +// Variable sized trigger. Triggers once, then removes itself. You must set the key "target" to the name of another object in the level that has a matching +// "targetname". If "health" is set, the trigger must be killed to activate. +// If notouch is set, the trigger is only fired by other entities, not by touching. +// if "killtarget" is set, any objects that have a matching "target" will be removed when the trigger is fired. +// if "angle" is set, the trigger will only fire when someone is facing the direction of the angle. Use "360" for an angle of 0. +// sounds +// 1) secret +// 2) beep beep +// 3) large switch // 4) /* <19e77d> ../cstrike/dlls/triggers.cpp:1129 */ @@ -432,11 +432,11 @@ public: };/* size: 312, cachelines: 5, members: 1 */ -// QUAKED trigger_counter (.5 .5 .5) ? nomessage -// Acts as an intermediary for an action that takes multiple inputs. -// If nomessage is not set, it will print "1 more.. " etc when triggered and -// "sequence complete" when finished. After the counter has been triggered "cTriggersLeft" -// times (default 2), it will fire all of it's targets and remove itself. +// QUAKED trigger_counter (.5 .5 .5) ? nomessage +// Acts as an intermediary for an action that takes multiple inputs. +// If nomessage is not set, it will print "1 more.. " etc when triggered and +// "sequence complete" when finished. After the counter has been triggered "cTriggersLeft" +// times (default 2), it will fire all of it's targets and remove itself. /* <19e7d5> ../cstrike/dlls/triggers.cpp:1273 */ class CTriggerCounter: public CBaseTrigger @@ -492,7 +492,7 @@ public: };/* size: 160, cachelines: 3, members: 1 */ -// QUAKED trigger_changelevel (0.5 0.5 0.5) ? NO_INTERMISSION +// QUAKED trigger_changelevel (0.5 0.5 0.5) ? NO_INTERMISSION // When the player touches this, he gets sent to the map listed in the "map" variable. Unless the NO_INTERMISSION flag is set, the view will go to the info_intermission spot and display stats. /* <19e906> ../cstrike/dlls/triggers.cpp:1345 */ @@ -526,7 +526,7 @@ public: static int InTransitionVolume(CBaseEntity *pEntity, char *pVolumeName); public: - static TYPEDESCRIPTION IMPLEMENT_ARRAY(m_SaveData)[4]; + static TYPEDESCRIPTION IMPL(m_SaveData)[4]; char m_szMapName[ cchMapNameMost ]; // trigger_changelevel only: next map char m_szLandmarkName[ cchMapNameMost ]; // trigger_changelevel only: landmark on next map @@ -747,7 +747,7 @@ public: #endif // HOOK_GAMEDLL public: - static TYPEDESCRIPTION IMPLEMENT_ARRAY(m_SaveData)[1]; + static TYPEDESCRIPTION IMPL(m_SaveData)[1]; private: int m_iszNewTarget; @@ -783,7 +783,7 @@ public: void Move(void); public: - static TYPEDESCRIPTION IMPLEMENT_ARRAY(m_SaveData)[13]; + static TYPEDESCRIPTION IMPL(m_SaveData)[13]; EHANDLE m_hPlayer; EHANDLE m_hTarget; @@ -843,7 +843,7 @@ public: #endif // HOOK_GAMEDLL -extern char st_szNextMap[cchMapNameMost]; +extern char st_szNextMap[cchMapNameMost]; extern char st_szNextSpot[cchMapNameMost]; void PlayCDTrack(int iTrack); @@ -853,40 +853,40 @@ NOXREF void NextLevel(void); #ifdef HOOK_GAMEDLL // linked objects -C_DLLEXPORT void func_friction(entvars_t *pev); -C_DLLEXPORT void trigger_auto(entvars_t *pev); -C_DLLEXPORT void trigger_relay(entvars_t *pev); -C_DLLEXPORT void multi_manager(entvars_t *pev); -C_DLLEXPORT void env_render(entvars_t *pev); -C_DLLEXPORT void trigger(entvars_t *pev); -C_DLLEXPORT void trigger_hurt(entvars_t *pev); -C_DLLEXPORT void trigger_monsterjump(entvars_t *pev); -C_DLLEXPORT void trigger_cdaudio(entvars_t *pev); -C_DLLEXPORT void target_cdaudio(entvars_t *pev); -C_DLLEXPORT void trigger_multiple(entvars_t *pev); -C_DLLEXPORT void trigger_once(entvars_t *pev); -C_DLLEXPORT void trigger_counter(entvars_t *pev); -C_DLLEXPORT void trigger_transition(entvars_t *pev); -C_DLLEXPORT void fireanddie(entvars_t *pev); -C_DLLEXPORT void trigger_changelevel(entvars_t *pev); -C_DLLEXPORT void func_ladder(entvars_t *pev); -C_DLLEXPORT void trigger_push(entvars_t *pev); -C_DLLEXPORT void trigger_teleport(entvars_t *pev); -C_DLLEXPORT void info_teleport_destination(entvars_t *pev); -C_DLLEXPORT void func_buyzone(entvars_t *pev); -C_DLLEXPORT void func_bomb_target(entvars_t *pev); -C_DLLEXPORT void func_hostage_rescue(entvars_t *pev); -C_DLLEXPORT void func_escapezone(entvars_t *pev); -C_DLLEXPORT void func_vip_safetyzone(entvars_t *pev); -C_DLLEXPORT void trigger_autosave(entvars_t *pev); -C_DLLEXPORT void trigger_endsection(entvars_t *pev); -C_DLLEXPORT void trigger_gravity(entvars_t *pev); -C_DLLEXPORT void trigger_changetarget(entvars_t *pev); -C_DLLEXPORT void trigger_camera(entvars_t *pev); -C_DLLEXPORT void env_snow(entvars_t *pev); -C_DLLEXPORT void func_snow(entvars_t *pev); -C_DLLEXPORT void env_rain(entvars_t *pev); -C_DLLEXPORT void func_rain(entvars_t *pev); +C_DLLEXPORT void func_friction(entvars_t *pev); +C_DLLEXPORT void trigger_auto(entvars_t *pev); +C_DLLEXPORT void trigger_relay(entvars_t *pev); +C_DLLEXPORT void multi_manager(entvars_t *pev); +C_DLLEXPORT void env_render(entvars_t *pev); +C_DLLEXPORT void trigger(entvars_t *pev); +C_DLLEXPORT void trigger_hurt(entvars_t *pev); +C_DLLEXPORT void trigger_monsterjump(entvars_t *pev); +C_DLLEXPORT void trigger_cdaudio(entvars_t *pev); +C_DLLEXPORT void target_cdaudio(entvars_t *pev); +C_DLLEXPORT void trigger_multiple(entvars_t *pev); +C_DLLEXPORT void trigger_once(entvars_t *pev); +C_DLLEXPORT void trigger_counter(entvars_t *pev); +C_DLLEXPORT void trigger_transition(entvars_t *pev); +C_DLLEXPORT void fireanddie(entvars_t *pev); +C_DLLEXPORT void trigger_changelevel(entvars_t *pev); +C_DLLEXPORT void func_ladder(entvars_t *pev); +C_DLLEXPORT void trigger_push(entvars_t *pev); +C_DLLEXPORT void trigger_teleport(entvars_t *pev); +C_DLLEXPORT void info_teleport_destination(entvars_t *pev); +C_DLLEXPORT void func_buyzone(entvars_t *pev); +C_DLLEXPORT void func_bomb_target(entvars_t *pev); +C_DLLEXPORT void func_hostage_rescue(entvars_t *pev); +C_DLLEXPORT void func_escapezone(entvars_t *pev); +C_DLLEXPORT void func_vip_safetyzone(entvars_t *pev); +C_DLLEXPORT void trigger_autosave(entvars_t *pev); +C_DLLEXPORT void trigger_endsection(entvars_t *pev); +C_DLLEXPORT void trigger_gravity(entvars_t *pev); +C_DLLEXPORT void trigger_changetarget(entvars_t *pev); +C_DLLEXPORT void trigger_camera(entvars_t *pev); +C_DLLEXPORT void env_snow(entvars_t *pev); +C_DLLEXPORT void func_snow(entvars_t *pev); +C_DLLEXPORT void env_rain(entvars_t *pev); +C_DLLEXPORT void func_rain(entvars_t *pev); C_DLLEXPORT void env_fog(entvars_t *pev); #endif // HOOK_GAMEDLL diff --git a/regamedll/dlls/tutor.h b/regamedll/dlls/tutor.h index e26422b7..b6d90f6c 100644 --- a/regamedll/dlls/tutor.h +++ b/regamedll/dlls/tutor.h @@ -37,15 +37,15 @@ #define s_tutorDisabledThisGame (*ps_tutorDisabledThisGame) #define s_nextCvarCheckTime (*ps_nextCvarCheckTime) -#define cv_tutor_message_repeats (*pcv_tutor_message_repeats) -#define cv_tutor_debug_level (*pcv_tutor_debug_level) -#define cv_tutor_view_distance (*pcv_tutor_view_distance) -#define cv_tutor_viewable_check_interval (*pcv_tutor_viewable_check_interval) -#define cv_tutor_look_distance (*pcv_tutor_look_distance) -#define cv_tutor_look_angle (*pcv_tutor_look_angle) -#define cv_tutor_examine_time (*pcv_tutor_examine_time) -#define cv_tutor_message_minimum_display_time (*pcv_tutor_message_minimum_display_time) -#define cv_tutor_message_character_display_time_coefficient (*pcv_tutor_message_character_display_time_coefficient) +#define cv_tutor_message_repeats (*pcv_tutor_message_repeats) +#define cv_tutor_debug_level (*pcv_tutor_debug_level) +#define cv_tutor_view_distance (*pcv_tutor_view_distance) +#define cv_tutor_viewable_check_interval (*pcv_tutor_viewable_check_interval) +#define cv_tutor_look_distance (*pcv_tutor_look_distance) +#define cv_tutor_look_angle (*pcv_tutor_look_angle) +#define cv_tutor_examine_time (*pcv_tutor_examine_time) +#define cv_tutor_message_minimum_display_time (*pcv_tutor_message_minimum_display_time) +#define cv_tutor_message_character_display_time_coefficient (*pcv_tutor_message_character_display_time_coefficient) #define cv_tutor_hint_interval_time (*pcv_tutor_hint_interval_time) #endif // HOOK_GAMEDLL diff --git a/regamedll/dlls/tutor_base_tutor.cpp b/regamedll/dlls/tutor_base_tutor.cpp index 51b761ad..2c95f705 100644 --- a/regamedll/dlls/tutor_base_tutor.cpp +++ b/regamedll/dlls/tutor_base_tutor.cpp @@ -456,22 +456,22 @@ bool CBaseTutor::IsEntityInViewOfPlayer(CBaseEntity *entity, CBasePlayer *player { return IsEntityInViewOfPlayer_(entity, player); } - + bool CBaseTutor::IsBombsiteInViewOfPlayer(CBaseEntity *entity, CBasePlayer *player) { return IsBombsiteInViewOfPlayer_(entity, player); } - + bool CBaseTutor::IsEntityInBombsite(CBaseEntity *bombsite, CBaseEntity *entity) { return IsEntityInBombsite_(bombsite, entity); } - + bool CBaseTutor::IsPlayerLookingAtPosition(Vector *origin, CBasePlayer *player) { return IsPlayerLookingAtPosition_(origin, player); } - + bool CBaseTutor::IsPlayerLookingAtEntity(CBaseEntity *entity, CBasePlayer *player) { return IsPlayerLookingAtEntity_(entity, player); diff --git a/regamedll/dlls/tutor_base_tutor.h b/regamedll/dlls/tutor_base_tutor.h index e02b4485..6ee8c1d6 100644 --- a/regamedll/dlls/tutor_base_tutor.h +++ b/regamedll/dlls/tutor_base_tutor.h @@ -38,26 +38,26 @@ public: TutorMessageEvent(int mid, int duplicateID, float time, float lifetime, int priority); virtual ~TutorMessageEvent(void); - bool IsActive(float time); - int GetPriority(void); - float GetTimeActive(float time); - void SetActivationTime(float time); - int GetID(void); - int GetDuplicateID(void); - void AddParameter(char *str); - char *GetNextParameter(char *buf, int buflen); - int GetNumParameters(void); - void SetNext(TutorMessageEvent *next); + bool IsActive(float time); + int GetPriority(void); + float GetTimeActive(float time); + void SetActivationTime(float time); + int GetID(void); + int GetDuplicateID(void); + void AddParameter(char *str); + char *GetNextParameter(char *buf, int buflen); + int GetNumParameters(void); + void SetNext(TutorMessageEvent *next); TutorMessageEvent *GetNext(void); private: - int m_messageID; - int m_duplicateID; - float m_activationTime; - float m_lifetime; - int m_priority; - int m_numParameters; - struct TutorMessageEventParam *m_paramList; + int m_messageID; + int m_duplicateID; + float m_activationTime; + float m_lifetime; + int m_priority; + int m_numParameters; + struct TutorMessageEventParam *m_paramList; TutorMessageEvent *m_next; };/* size: 36, cachelines: 1, members: 9 */ @@ -68,47 +68,47 @@ public: CBaseTutor(void); virtual ~CBaseTutor(void); - virtual void TutorThink(float time) = 0; - virtual void PurgeMessages(void) = 0; - virtual void CallEventHandler(GameEventType event, CBaseEntity *entity, CBaseEntity *other) = 0; - virtual void ShowTutorMessage(TutorMessageEvent *event) = 0; - - virtual bool IsEntityInViewOfPlayer(CBaseEntity *entity, CBasePlayer *player); - virtual bool IsBombsiteInViewOfPlayer(CBaseEntity *entity, CBasePlayer *player); - virtual bool IsEntityInBombsite(CBaseEntity *bombsite, CBaseEntity *entity); - virtual bool IsPlayerLookingAtPosition(Vector *origin, CBasePlayer *player); - virtual bool IsPlayerLookingAtEntity(CBaseEntity *entity, CBasePlayer *player); - - virtual void HandleShotFired(Vector source, Vector target) = 0; - virtual struct TutorMessage *GetTutorMessageDefinition(int messageID) = 0; - -#ifdef HOOK_GAMEDLL - - bool IsEntityInViewOfPlayer_(CBaseEntity *entity, CBasePlayer *player); - bool IsBombsiteInViewOfPlayer_(CBaseEntity *entity, CBasePlayer *player); - bool IsEntityInBombsite_(CBaseEntity *bombsite, CBaseEntity *entity); - bool IsPlayerLookingAtPosition_(Vector *origin, CBasePlayer *player); - bool IsPlayerLookingAtEntity_(CBaseEntity *entity, CBasePlayer *player); - -#endif // HOOK_GAMEDLL - -public: - void StartFrame(float time); - void OnEvent(GameEventType event, CBaseEntity *entity = NULL, CBaseEntity *other = NULL); - - void ShotFired(Vector source, Vector target); - void DisplayMessageToPlayer(CBasePlayer *player, int id, const char *szMessage, TutorMessageEvent *event); - NOXREF void DrawLineToEntity(CBasePlayer *player, int entindex, int id); - void DisplayNewStateDescriptionToPlayer(void); - void CloseCurrentWindow(void); - void CheckForStateTransition(GameEventType event, CBaseEntity *entity, CBaseEntity *other); - void CalculatePathForObjective(CBaseEntity *player); + virtual void TutorThink(float time) = 0; + virtual void PurgeMessages(void) = 0; + virtual void CallEventHandler(GameEventType event, CBaseEntity *entity, CBaseEntity *other) = 0; + virtual void ShowTutorMessage(TutorMessageEvent *event) = 0; + + virtual bool IsEntityInViewOfPlayer(CBaseEntity *entity, CBasePlayer *player); + virtual bool IsBombsiteInViewOfPlayer(CBaseEntity *entity, CBasePlayer *player); + virtual bool IsEntityInBombsite(CBaseEntity *bombsite, CBaseEntity *entity); + virtual bool IsPlayerLookingAtPosition(Vector *origin, CBasePlayer *player); + virtual bool IsPlayerLookingAtEntity(CBaseEntity *entity, CBasePlayer *player); + + virtual void HandleShotFired(Vector source, Vector target) = 0; + virtual struct TutorMessage *GetTutorMessageDefinition(int messageID) = 0; + +#ifdef HOOK_GAMEDLL + + bool IsEntityInViewOfPlayer_(CBaseEntity *entity, CBasePlayer *player); + bool IsBombsiteInViewOfPlayer_(CBaseEntity *entity, CBasePlayer *player); + bool IsEntityInBombsite_(CBaseEntity *bombsite, CBaseEntity *entity); + bool IsPlayerLookingAtPosition_(Vector *origin, CBasePlayer *player); + bool IsPlayerLookingAtEntity_(CBaseEntity *entity, CBasePlayer *player); + +#endif // HOOK_GAMEDLL + +public: + void StartFrame(float time); + void OnEvent(GameEventType event, CBaseEntity *entity = NULL, CBaseEntity *other = NULL); + + void ShotFired(Vector source, Vector target); + void DisplayMessageToPlayer(CBasePlayer *player, int id, const char *szMessage, TutorMessageEvent *event); + NOXREF void DrawLineToEntity(CBasePlayer *player, int entindex, int id); + void DisplayNewStateDescriptionToPlayer(void); + void CloseCurrentWindow(void); + void CheckForStateTransition(GameEventType event, CBaseEntity *entity, CBaseEntity *other); + void CalculatePathForObjective(CBaseEntity *player); bool DoMessagesHaveSameID(int id1, int id2); -protected: - CBaseTutorStateSystem *m_stateSystem; - TutorMessageEvent *m_eventList; - float m_deadAirStartTime; +protected: + CBaseTutorStateSystem *m_stateSystem; + TutorMessageEvent *m_eventList; + float m_deadAirStartTime; float m_roundStartTime; };/* size: 20, cachelines: 1, members: 5 */ diff --git a/regamedll/dlls/tutor_cs_states.h b/regamedll/dlls/tutor_cs_states.h index b6de0652..61ac6a01 100644 --- a/regamedll/dlls/tutor_cs_states.h +++ b/regamedll/dlls/tutor_cs_states.h @@ -36,39 +36,39 @@ #define TUTOR_STATE_FLAG_1 0x00000014 #define TUTOR_STATE_FLAG_2 0x00000013 -enum TutorStateType -{ - TUTORSTATE_UNDEFINED = 0, - TUTORSTATE_LOOKING_FOR_HOSTAGE, - TUTORSTATE_ESCORTING_HOSTAGE, - TUTORSTATE_LOOKING_FOR_LOST_HOSTAGE, - TUTORSTATE_FOLLOWING_HOSTAGE_ESCORT, - TUTORSTATE_MOVING_TO_BOMBSITE, - TUTORSTATE_LOOKING_FOR_BOMB_CARRIER, - TUTORSTATE_GUARDING_LOOSE_BOMB, - TUTORSTATE_DEFUSING_BOMB, - TUTORSTATE_GUARDING_HOSTAGE, - TUTORSTATE_MOVING_TO_INTERCEPT_ENEMY, - TUTORSTATE_LOOKING_FOR_HOSTAGE_ESCORT, - TUTORSTATE_ATTACKING_HOSTAGE_ESCORT, - TUTORSTATE_ESCORTING_BOMB_CARRIER, - TUTORSTATE_MOVING_TO_BOMB_SITE, - TUTORSTATE_PLANTING_BOMB, - TUTORSTATE_GUARDING_BOMB, - TUTORSTATE_LOOKING_FOR_LOOSE_BOMB, - TUTORSTATE_RUNNING_AWAY_FROM_TICKING_BOMB, - TUTORSTATE_BUYTIME, - TUTORSTATE_WAITING_FOR_START, +enum TutorStateType +{ + TUTORSTATE_UNDEFINED = 0, + TUTORSTATE_LOOKING_FOR_HOSTAGE, + TUTORSTATE_ESCORTING_HOSTAGE, + TUTORSTATE_LOOKING_FOR_LOST_HOSTAGE, + TUTORSTATE_FOLLOWING_HOSTAGE_ESCORT, + TUTORSTATE_MOVING_TO_BOMBSITE, + TUTORSTATE_LOOKING_FOR_BOMB_CARRIER, + TUTORSTATE_GUARDING_LOOSE_BOMB, + TUTORSTATE_DEFUSING_BOMB, + TUTORSTATE_GUARDING_HOSTAGE, + TUTORSTATE_MOVING_TO_INTERCEPT_ENEMY, + TUTORSTATE_LOOKING_FOR_HOSTAGE_ESCORT, + TUTORSTATE_ATTACKING_HOSTAGE_ESCORT, + TUTORSTATE_ESCORTING_BOMB_CARRIER, + TUTORSTATE_MOVING_TO_BOMB_SITE, + TUTORSTATE_PLANTING_BOMB, + TUTORSTATE_GUARDING_BOMB, + TUTORSTATE_LOOKING_FOR_LOOSE_BOMB, + TUTORSTATE_RUNNING_AWAY_FROM_TICKING_BOMB, + TUTORSTATE_BUYTIME, + TUTORSTATE_WAITING_FOR_START, }; /* <22bf75> ../cstrike/dlls/tutor_cs_states.cpp:53 */ -class CCSTutorStateSystem: public CBaseTutorStateSystem -{ -public: - CCSTutorStateSystem(void); - - virtual ~CCSTutorStateSystem(void); - virtual bool UpdateState(GameEventType event, CBaseEntity *entity, CBaseEntity *other); +class CCSTutorStateSystem: public CBaseTutorStateSystem +{ +public: + CCSTutorStateSystem(void); + + virtual ~CCSTutorStateSystem(void); + virtual bool UpdateState(GameEventType event, CBaseEntity *entity, CBaseEntity *other); virtual char *GetCurrentStateString(void); #ifdef HOOK_GAMEDLL @@ -78,10 +78,10 @@ public: CBaseTutorState *ConstructNewState_(int stateType); #endif // HOOK_GAMEDLL - -protected: - virtual CBaseTutorState *ConstructNewState(int stateType); - + +protected: + virtual CBaseTutorState *ConstructNewState(int stateType); + };/* size: 8, cachelines: 1, members: 1 */ /* <22bfcb> ../cstrike/dlls/tutor_cs_states.cpp:141 */ @@ -94,11 +94,11 @@ public: virtual int CheckForStateTransition(GameEventType event, CBaseEntity *entity, CBaseEntity *other); virtual char *GetStateString(void); -#ifdef HOOK_GAMEDLL - - int CheckForStateTransition_(GameEventType event, CBaseEntity *entity, CBaseEntity *other); - char *GetStateString_(void); - +#ifdef HOOK_GAMEDLL + + int CheckForStateTransition_(GameEventType event, CBaseEntity *entity, CBaseEntity *other); + char *GetStateString_(void); + #endif // HOOK_GAMEDLL protected: @@ -116,11 +116,11 @@ public: virtual int CheckForStateTransition(GameEventType event, CBaseEntity *entity, CBaseEntity *other); virtual char *GetStateString(void); -#ifdef HOOK_GAMEDLL - - int CheckForStateTransition_(GameEventType event, CBaseEntity *entity, CBaseEntity *other); - char *GetStateString_(void); - +#ifdef HOOK_GAMEDLL + + int CheckForStateTransition_(GameEventType event, CBaseEntity *entity, CBaseEntity *other); + char *GetStateString_(void); + #endif // HOOK_GAMEDLL protected: @@ -140,11 +140,11 @@ public: virtual int CheckForStateTransition(GameEventType event, CBaseEntity *entity, CBaseEntity *other); virtual char *GetStateString(void); -#ifdef HOOK_GAMEDLL - - int CheckForStateTransition_(GameEventType event, CBaseEntity *entity, CBaseEntity *other); - char *GetStateString_(void); - +#ifdef HOOK_GAMEDLL + + int CheckForStateTransition_(GameEventType event, CBaseEntity *entity, CBaseEntity *other); + char *GetStateString_(void); + #endif // HOOK_GAMEDLL protected: diff --git a/regamedll/dlls/tutor_cs_tutor.h b/regamedll/dlls/tutor_cs_tutor.h index d4c474f7..ae9c7666 100644 --- a/regamedll/dlls/tutor_cs_tutor.h +++ b/regamedll/dlls/tutor_cs_tutor.h @@ -40,60 +40,60 @@ enum TutorMessageClass TUTORMESSAGECLASS_EXAMINE, }; -enum TutorMessageType -{ - TUTORMESSAGETYPE_DEFAULT = (1 << 0), // icon info | color green - TUTORMESSAGETYPE_FRIEND_DEATH = (1 << 1), // icon skull | color red - TUTORMESSAGETYPE_ENEMY_DEATH = (1 << 2), // icon skull | color blue - TUTORMESSAGETYPE_SCENARIO = (1 << 3), // icon info | color yellow - TUTORMESSAGETYPE_BUY = (1 << 4), // icon info | color green - TUTORMESSAGETYPE_CAREER = (1 << 5), // icon info | color green - TUTORMESSAGETYPE_HINT = (1 << 6), // icon info | color green - TUTORMESSAGETYPE_INGAME_HINT = (1 << 7), // icon info | color green - TUTORMESSAGETYPE_END_GAME = (1 << 8), // icon info | color yellow - - TUTORMESSAGETYPE_LAST, - TUTORMESSAGETYPE_ALL = (1 << 9) - 1 -}; - -enum TutorMessageInterruptFlag -{ - TUTORMESSAGEINTERRUPTFLAG_DEFAULT = 0, - TUTORMESSAGEINTERRUPTFLAG_NOW_DAMMIT, -}; - -enum TutorMessageKeepOldType -{ - TUTORMESSAGEKEEPOLDTYPE_DONT_KEEP_OLD = 0, - TUTORMESSAGEKEEPOLDTYPE_KEEP_OLD, - TUTORMESSAGEKEEPOLDTYPE_UPDATE_CONTENT, -}; - -struct TutorMessage -{ - char *m_text; - unsigned char m_priority; - unsigned char m_duration; - TutorMessageKeepOldType m_keepOld; - TutorMessageClass m_class; - unsigned char m_decay; - TutorMessageType m_type; - int m_lifetime; - TutorMessageInterruptFlag m_interruptFlag; - int m_duplicateID; - float m_examineStartTime; - int m_timesShown; - float m_minDisplayTimeOverride; - float m_minRepeatInterval; - float m_lastCloseTime; - -};/* size: 56, cachelines: 1, members: 15 */ - -struct TutorMessageEventParam -{ - char *m_data; - TutorMessageEventParam *m_next; - +enum TutorMessageType +{ + TUTORMESSAGETYPE_DEFAULT = (1 << 0), // icon info | color green + TUTORMESSAGETYPE_FRIEND_DEATH = (1 << 1), // icon skull | color red + TUTORMESSAGETYPE_ENEMY_DEATH = (1 << 2), // icon skull | color blue + TUTORMESSAGETYPE_SCENARIO = (1 << 3), // icon info | color yellow + TUTORMESSAGETYPE_BUY = (1 << 4), // icon info | color green + TUTORMESSAGETYPE_CAREER = (1 << 5), // icon info | color green + TUTORMESSAGETYPE_HINT = (1 << 6), // icon info | color green + TUTORMESSAGETYPE_INGAME_HINT = (1 << 7), // icon info | color green + TUTORMESSAGETYPE_END_GAME = (1 << 8), // icon info | color yellow + + TUTORMESSAGETYPE_LAST, + TUTORMESSAGETYPE_ALL = (1 << 9) - 1 +}; + +enum TutorMessageInterruptFlag +{ + TUTORMESSAGEINTERRUPTFLAG_DEFAULT = 0, + TUTORMESSAGEINTERRUPTFLAG_NOW_DAMMIT, +}; + +enum TutorMessageKeepOldType +{ + TUTORMESSAGEKEEPOLDTYPE_DONT_KEEP_OLD = 0, + TUTORMESSAGEKEEPOLDTYPE_KEEP_OLD, + TUTORMESSAGEKEEPOLDTYPE_UPDATE_CONTENT, +}; + +struct TutorMessage +{ + char *m_text; + unsigned char m_priority; + unsigned char m_duration; + TutorMessageKeepOldType m_keepOld; + TutorMessageClass m_class; + unsigned char m_decay; + TutorMessageType m_type; + int m_lifetime; + TutorMessageInterruptFlag m_interruptFlag; + int m_duplicateID; + float m_examineStartTime; + int m_timesShown; + float m_minDisplayTimeOverride; + float m_minRepeatInterval; + float m_lastCloseTime; + +};/* size: 56, cachelines: 1, members: 15 */ + +struct TutorMessageEventParam +{ + char *m_data; + TutorMessageEventParam *m_next; + };/* size: 8, cachelines: 1, members: 2 */ enum TutorMessageID @@ -278,147 +278,147 @@ public: bool m_hasBeenShown; TutorMessageEvent *m_event; }; - - virtual ~CCSTutor(void); - - virtual void TutorThink(float time); - virtual void PurgeMessages(void); - virtual void CallEventHandler(GameEventType event, CBaseEntity *entity, CBaseEntity *other); - virtual void ShowTutorMessage(TutorMessageEvent *event); - virtual void HandleShotFired(Vector source, Vector target); - virtual TutorMessage *GetTutorMessageDefinition(int messageID); - - void CreateAndAddEventToList(TutorMessageID mid, CBaseEntity *entity = NULL, CBaseEntity *other = NULL); - TutorMessageEvent *CreateTutorMessageEvent(TutorMessageID mid, CBaseEntity *entity = NULL, CBaseEntity *other = NULL); - void AddToEventList(TutorMessageEvent *event); - void DeleteEventFromEventList(TutorMessageEvent *event); - void ClearEventList(void); - void ClearCurrentEvent(bool closeWindow = true, bool processDeathsForEvent = true); - void DeleteEvent(TutorMessageEvent *event); - bool ShouldShowMessageEvent(TutorMessageEvent *event, float time); - NOXREF bool ShouldUpdateCurrentMessage(TutorMessageID messageID); - void ComputeDisplayTimesForMessage(void); - void UpdateCurrentMessage(TutorMessageEvent *event); - void ConstructMessageAndDisplay(void); - NOXREF void LookupHotKey(TutorMessageID mid, int paramNum, wchar_t *buf, int buflen); - void CheckForWindowClose(float time); - void CheckForContentUpdate(void); - bool HasCurrentWindowBeenActiveLongEnough(float time); - void CheckForInterruptingMessageEvent(float time); - void CheckForInactiveEvents(float time); - void CancelEvent(TutorMessageID mid); - void ProcessShownDeathsForEvent(TutorMessageEvent *event); - void TransferDeathEvents(TutorMessageEvent *oldEvent, TutorMessageEvent *newEvent); - TutorMessageEvent *GetTutorMessageUpdateEvent(void); - bool GetDuplicateMessagesFromEventList(TutorMessageEvent *&event1, TutorMessageEvent *&event2); - bool IsBombMap(void); - bool IsHostageMap(void); -public: - void HandleWeaponFired(CBaseEntity *entity, CBaseEntity *other); - void HandleWeaponFiredOnEmpty(CBaseEntity *entity, CBaseEntity *other); - void HandleWeaponReloaded(CBaseEntity *entity, CBaseEntity *other); - void HandlePlayerDied(CBaseEntity *entity, CBaseEntity *other); - void HandlePlayerSpawned(CBaseEntity *entity, CBaseEntity *other); - NOXREF void HandleClientCorpseSpawned(CBaseEntity *entity, CBaseEntity *other); - void HandlePlayerTookDamage(CBaseEntity *entity, CBaseEntity *other); - void HandlePlayerBlindedByFlashbang(CBaseEntity *entity, CBaseEntity *other); - NOXREF void HandleBuyTimeStart(CBaseEntity *entity, CBaseEntity *other); - void HandlePlayerLeftBuyZone(CBaseEntity *entity, CBaseEntity *other); - void HandleBombPlanted(CBaseEntity *entity, CBaseEntity *other); - void HandleRoundStart(CBaseEntity *entity, CBaseEntity *other); - void HandleBombDefused(CBaseEntity *entity, CBaseEntity *other); - void HandleBombExploded(CBaseEntity *entity, CBaseEntity *other); - void HandleHostageUsed(CBaseEntity *entity, CBaseEntity *other); - void HandleHostageRescued(CBaseEntity *entity, CBaseEntity *other); - void HandleHostageDamaged(CBaseEntity *entity, CBaseEntity *other); - void HandleHostageKilled(CBaseEntity *entity, CBaseEntity *other); - void HandleAllHostagesRescued(CBaseEntity *entity, CBaseEntity *other); - void HandleBeingShotAt(CBaseEntity *entity, CBaseEntity *other); - void HandleRoundDraw(CBaseEntity *entity, CBaseEntity *other); - void HandleCTWin(CBaseEntity *entity, CBaseEntity *other); - void HandleTWin(CBaseEntity *entity, CBaseEntity *other); - void HandleDeathCameraStart(CBaseEntity *entity, CBaseEntity *other); - void HandleBombDefusing(CBaseEntity *entity, CBaseEntity *other); - void HandleRadioCoverMe(CBaseEntity *entity, CBaseEntity *other); - void HandleRadioYouTakeThePoint(CBaseEntity *entity, CBaseEntity *other); - void HandleRadioHoldThisPosition(CBaseEntity *entity, CBaseEntity *other); - void HandleRadioRegroupTeam(CBaseEntity *entity, CBaseEntity *other); - void HandleRadioFollowMe(CBaseEntity *entity, CBaseEntity *other); - void HandleRadioTakingFire(CBaseEntity *entity, CBaseEntity *other); - void HandleRadioGoGoGo(CBaseEntity *entity, CBaseEntity *other); - void HandleRadioTeamFallBack(CBaseEntity *entity, CBaseEntity *other); - void HandleRadioStickTogetherTeam(CBaseEntity *entity, CBaseEntity *other); - void HandleRadioGetInPositionAndWait(CBaseEntity *entity, CBaseEntity *other); - void HandleRadioStormTheFront(CBaseEntity *entity, CBaseEntity *other); - void HandleRadioReportInTeam(CBaseEntity *entity, CBaseEntity *other); - void HandleRadioAffirmative(CBaseEntity *entity, CBaseEntity *other); - void HandleRadioEnemySpotted(CBaseEntity *entity, CBaseEntity *other); - void HandleRadioNeedBackup(CBaseEntity *entity, CBaseEntity *other); - void HandleRadioSectorClear(CBaseEntity *entity, CBaseEntity *other); - void HandleRadioInPosition(CBaseEntity *entity, CBaseEntity *other); - void HandleRadioReportingIn(CBaseEntity *entity, CBaseEntity *other); - void HandleRadioGetOutOfThere(CBaseEntity *entity, CBaseEntity *other); - void HandleRadioNegative(CBaseEntity *entity, CBaseEntity *other); - void HandleRadioEnemyDown(CBaseEntity *entity, CBaseEntity *other); - void HandleBuyMenuOpenned(CBaseEntity *entity, CBaseEntity *other); - void HandleAutoBuy(CBaseEntity *entity, CBaseEntity *other); - void HandleNotBuyingAnything(CBaseEntity *entity, CBaseEntity *other); - void HandleNeedToBuyPrimaryWeapon(CBaseEntity *entity, CBaseEntity *other); - void HandleNeedToBuyPrimaryAmmo(CBaseEntity *entity, CBaseEntity *other); - void HandleNeedToBuySecondaryAmmo(CBaseEntity *entity, CBaseEntity *other); - void HandleNeedToBuyArmor(CBaseEntity *entity, CBaseEntity *other); - void HandleNeedToBuyDefuseKit(CBaseEntity *entity, CBaseEntity *other); - void HandleNeedToBuyGrenade(CBaseEntity *entity, CBaseEntity *other); - void HandleCareerTaskDone(CBaseEntity *entity, CBaseEntity *other); - - void GetNumPlayersAliveOnTeams(int &numT, int &numCT); - void CheckForBombViewable(void); - void CheckForLooseWeaponViewable(void); - void CheckForLooseDefuserViewable(void); - void CheckForBombsiteViewable(void); - TutorMessageID CheckForInBombZone(void); - void CheckForHostageViewable(void); - void CheckForTimeRunningOut(void); - void CheckForAllHostagesDead(void); - bool CheckForAllHostagesFollowingSomeone(void); - void CheckHintMessages(float time); - void CheckInGameHintMessages(float time); - void CheckExamineMessages(float time); - void CheckForNeedToReload(bool isPassiveCheck = false); - bool CanLocalPlayerBuyStuff(void); - void CheckBuyZoneMessages(void); - bool IsBombPlantedInBombsite(CBaseEntity *bombTarget); - void ReadTutorMessageFile(void); - void ApplyPersistentDecay(void); - CBaseEntity *GetEntityForMessageID(int messageID, CBaseEntity *last = NULL); - void ResetPlayerDeathInfo(void); + + virtual ~CCSTutor(void); + + virtual void TutorThink(float time); + virtual void PurgeMessages(void); + virtual void CallEventHandler(GameEventType event, CBaseEntity *entity, CBaseEntity *other); + virtual void ShowTutorMessage(TutorMessageEvent *event); + virtual void HandleShotFired(Vector source, Vector target); + virtual TutorMessage *GetTutorMessageDefinition(int messageID); + + void CreateAndAddEventToList(TutorMessageID mid, CBaseEntity *entity = NULL, CBaseEntity *other = NULL); + TutorMessageEvent *CreateTutorMessageEvent(TutorMessageID mid, CBaseEntity *entity = NULL, CBaseEntity *other = NULL); + void AddToEventList(TutorMessageEvent *event); + void DeleteEventFromEventList(TutorMessageEvent *event); + void ClearEventList(void); + void ClearCurrentEvent(bool closeWindow = true, bool processDeathsForEvent = true); + void DeleteEvent(TutorMessageEvent *event); + bool ShouldShowMessageEvent(TutorMessageEvent *event, float time); + NOXREF bool ShouldUpdateCurrentMessage(TutorMessageID messageID); + void ComputeDisplayTimesForMessage(void); + void UpdateCurrentMessage(TutorMessageEvent *event); + void ConstructMessageAndDisplay(void); + NOXREF void LookupHotKey(TutorMessageID mid, int paramNum, wchar_t *buf, int buflen); + void CheckForWindowClose(float time); + void CheckForContentUpdate(void); + bool HasCurrentWindowBeenActiveLongEnough(float time); + void CheckForInterruptingMessageEvent(float time); + void CheckForInactiveEvents(float time); + void CancelEvent(TutorMessageID mid); + void ProcessShownDeathsForEvent(TutorMessageEvent *event); + void TransferDeathEvents(TutorMessageEvent *oldEvent, TutorMessageEvent *newEvent); + TutorMessageEvent *GetTutorMessageUpdateEvent(void); + bool GetDuplicateMessagesFromEventList(TutorMessageEvent *&event1, TutorMessageEvent *&event2); + bool IsBombMap(void); + bool IsHostageMap(void); +public: + void HandleWeaponFired(CBaseEntity *entity, CBaseEntity *other); + void HandleWeaponFiredOnEmpty(CBaseEntity *entity, CBaseEntity *other); + void HandleWeaponReloaded(CBaseEntity *entity, CBaseEntity *other); + void HandlePlayerDied(CBaseEntity *entity, CBaseEntity *other); + void HandlePlayerSpawned(CBaseEntity *entity, CBaseEntity *other); + NOXREF void HandleClientCorpseSpawned(CBaseEntity *entity, CBaseEntity *other); + void HandlePlayerTookDamage(CBaseEntity *entity, CBaseEntity *other); + void HandlePlayerBlindedByFlashbang(CBaseEntity *entity, CBaseEntity *other); + NOXREF void HandleBuyTimeStart(CBaseEntity *entity, CBaseEntity *other); + void HandlePlayerLeftBuyZone(CBaseEntity *entity, CBaseEntity *other); + void HandleBombPlanted(CBaseEntity *entity, CBaseEntity *other); + void HandleRoundStart(CBaseEntity *entity, CBaseEntity *other); + void HandleBombDefused(CBaseEntity *entity, CBaseEntity *other); + void HandleBombExploded(CBaseEntity *entity, CBaseEntity *other); + void HandleHostageUsed(CBaseEntity *entity, CBaseEntity *other); + void HandleHostageRescued(CBaseEntity *entity, CBaseEntity *other); + void HandleHostageDamaged(CBaseEntity *entity, CBaseEntity *other); + void HandleHostageKilled(CBaseEntity *entity, CBaseEntity *other); + void HandleAllHostagesRescued(CBaseEntity *entity, CBaseEntity *other); + void HandleBeingShotAt(CBaseEntity *entity, CBaseEntity *other); + void HandleRoundDraw(CBaseEntity *entity, CBaseEntity *other); + void HandleCTWin(CBaseEntity *entity, CBaseEntity *other); + void HandleTWin(CBaseEntity *entity, CBaseEntity *other); + void HandleDeathCameraStart(CBaseEntity *entity, CBaseEntity *other); + void HandleBombDefusing(CBaseEntity *entity, CBaseEntity *other); + void HandleRadioCoverMe(CBaseEntity *entity, CBaseEntity *other); + void HandleRadioYouTakeThePoint(CBaseEntity *entity, CBaseEntity *other); + void HandleRadioHoldThisPosition(CBaseEntity *entity, CBaseEntity *other); + void HandleRadioRegroupTeam(CBaseEntity *entity, CBaseEntity *other); + void HandleRadioFollowMe(CBaseEntity *entity, CBaseEntity *other); + void HandleRadioTakingFire(CBaseEntity *entity, CBaseEntity *other); + void HandleRadioGoGoGo(CBaseEntity *entity, CBaseEntity *other); + void HandleRadioTeamFallBack(CBaseEntity *entity, CBaseEntity *other); + void HandleRadioStickTogetherTeam(CBaseEntity *entity, CBaseEntity *other); + void HandleRadioGetInPositionAndWait(CBaseEntity *entity, CBaseEntity *other); + void HandleRadioStormTheFront(CBaseEntity *entity, CBaseEntity *other); + void HandleRadioReportInTeam(CBaseEntity *entity, CBaseEntity *other); + void HandleRadioAffirmative(CBaseEntity *entity, CBaseEntity *other); + void HandleRadioEnemySpotted(CBaseEntity *entity, CBaseEntity *other); + void HandleRadioNeedBackup(CBaseEntity *entity, CBaseEntity *other); + void HandleRadioSectorClear(CBaseEntity *entity, CBaseEntity *other); + void HandleRadioInPosition(CBaseEntity *entity, CBaseEntity *other); + void HandleRadioReportingIn(CBaseEntity *entity, CBaseEntity *other); + void HandleRadioGetOutOfThere(CBaseEntity *entity, CBaseEntity *other); + void HandleRadioNegative(CBaseEntity *entity, CBaseEntity *other); + void HandleRadioEnemyDown(CBaseEntity *entity, CBaseEntity *other); + void HandleBuyMenuOpenned(CBaseEntity *entity, CBaseEntity *other); + void HandleAutoBuy(CBaseEntity *entity, CBaseEntity *other); + void HandleNotBuyingAnything(CBaseEntity *entity, CBaseEntity *other); + void HandleNeedToBuyPrimaryWeapon(CBaseEntity *entity, CBaseEntity *other); + void HandleNeedToBuyPrimaryAmmo(CBaseEntity *entity, CBaseEntity *other); + void HandleNeedToBuySecondaryAmmo(CBaseEntity *entity, CBaseEntity *other); + void HandleNeedToBuyArmor(CBaseEntity *entity, CBaseEntity *other); + void HandleNeedToBuyDefuseKit(CBaseEntity *entity, CBaseEntity *other); + void HandleNeedToBuyGrenade(CBaseEntity *entity, CBaseEntity *other); + void HandleCareerTaskDone(CBaseEntity *entity, CBaseEntity *other); + + void GetNumPlayersAliveOnTeams(int &numT, int &numCT); + void CheckForBombViewable(void); + void CheckForLooseWeaponViewable(void); + void CheckForLooseDefuserViewable(void); + void CheckForBombsiteViewable(void); + TutorMessageID CheckForInBombZone(void); + void CheckForHostageViewable(void); + void CheckForTimeRunningOut(void); + void CheckForAllHostagesDead(void); + bool CheckForAllHostagesFollowingSomeone(void); + void CheckHintMessages(float time); + void CheckInGameHintMessages(float time); + void CheckExamineMessages(float time); + void CheckForNeedToReload(bool isPassiveCheck = false); + bool CanLocalPlayerBuyStuff(void); + void CheckBuyZoneMessages(void); + bool IsBombPlantedInBombsite(CBaseEntity *bombTarget); + void ReadTutorMessageFile(void); + void ApplyPersistentDecay(void); + CBaseEntity *GetEntityForMessageID(int messageID, CBaseEntity *last = NULL); + void ResetPlayerDeathInfo(void); void ConstructRecentDeathsList(TeamName team, char *buf, int buflen, TutorMessageEvent *event); #ifdef HOOK_GAMEDLL - void TutorThink_(float time); - void PurgeMessages_(void); - void CallEventHandler_(GameEventType event, CBaseEntity *entity, CBaseEntity *other); - void ShowTutorMessage_(TutorMessageEvent *event); - void HandleShotFired_(Vector source, Vector target); + void TutorThink_(float time); + void PurgeMessages_(void); + void CallEventHandler_(GameEventType event, CBaseEntity *entity, CBaseEntity *other); + void ShowTutorMessage_(TutorMessageEvent *event); + void HandleShotFired_(Vector source, Vector target); TutorMessage *GetTutorMessageDefinition_(int messageID); #endif // HOOK_GAMEDLL private: - float m_nextViewableCheckTime; - TutorMessageMap m_messageMap; - TutorMessageID m_currentlyShownMessageID; - float m_currentlyShownMessageCloseTime; - float m_currentlyShownMessageStartTime; - float m_currentlyShownMessageMinimumCloseTime; - TutorMessageEvent *m_currentMessageEvent; - TutorMessageEvent *m_lastScenarioEvent; - TutorMessageID m_lastHintShown; - TutorMessageID m_lastInGameHintShown; - ClientCorpseList m_clientCorpseList; - int m_messageTypeMask; - bool m_haveSpawned; + float m_nextViewableCheckTime; + TutorMessageMap m_messageMap; + TutorMessageID m_currentlyShownMessageID; + float m_currentlyShownMessageCloseTime; + float m_currentlyShownMessageStartTime; + float m_currentlyShownMessageMinimumCloseTime; + TutorMessageEvent *m_currentMessageEvent; + TutorMessageEvent *m_lastScenarioEvent; + TutorMessageID m_lastHintShown; + TutorMessageID m_lastInGameHintShown; + ClientCorpseList m_clientCorpseList; + int m_messageTypeMask; + bool m_haveSpawned; PlayerDeathStruct m_playerDeathInfo[32]; };/* size: 356, cachelines: 6, members: 15 */ diff --git a/regamedll/dlls/util.cpp b/regamedll/dlls/util.cpp index caa2340a..77369368 100644 --- a/regamedll/dlls/util.cpp +++ b/regamedll/dlls/util.cpp @@ -135,13 +135,13 @@ const int gSizes[18]; #endif //HOOK_GAMEDLL -float UTIL_WeaponTimeBase(void) -{ -#ifdef CLIENT_WEAPONS - return 0.0; -#else - return gpGlobals->time; -#endif // CLIENT_WEAPONS +float UTIL_WeaponTimeBase(void) +{ +#ifdef CLIENT_WEAPONS + return 0.0; +#else + return gpGlobals->time; +#endif // CLIENT_WEAPONS } /* <1ac4be> ../cstrike/dlls/util.cpp:59 */ @@ -553,7 +553,7 @@ CBaseEntity *UTIL_FindEntityGeneric(const char *szWhatever, const Vector &vecSrc } /* <1ad347> ../cstrike/dlls/util.cpp:711 */ -CBaseEntity *UTIL_PlayerByIndex(int playerIndex) +CBaseEntity *EXT_FUNC UTIL_PlayerByIndex(int playerIndex) { CBaseEntity *pPlayer = NULL; if (playerIndex > 0 && playerIndex <= gpGlobals->maxClients) @@ -1343,10 +1343,6 @@ void UTIL_StringToVector(float *pVector, const char *pString) Q_strcpy(tempString, pString); -#ifdef GAMEDLL_FIXES - tempString[127] = 0; -#endif // GAMEDLL_FIXES - pstr = tempString; pfront = tempString; @@ -1698,7 +1694,7 @@ extern "C" return num; } } -#endif +#endif // _WIN32 /* <1b04b5> ../cstrike/dlls/util.cpp:1971 */ unsigned int CSaveRestoreBuffer::HashString(const char *pszToken) @@ -1726,12 +1722,13 @@ unsigned short CSaveRestoreBuffer::TokenHash(const char *pszToken) return index; } } + ALERT(at_error, "CSaveRestoreBuffer :: TokenHash() is COMPLETELY FULL!"); return 0; } /* <1b06a5> ../cstrike/dlls/util.cpp:2020 */ -NOXREF void CSave::WriteData(const char *pname, int size, const char *pdata) +void CSave::WriteData(const char *pname, int size, const char *pdata) { BufferField(pname, size, pdata); } @@ -1743,19 +1740,19 @@ NOXREF void CSave::WriteShort(const char *pname, const short *data, int count) } /* <1b0a7b> ../cstrike/dlls/util.cpp:2032 */ -NOXREF void CSave::WriteInt(const char *pname, const int *data, int count) +void CSave::WriteInt(const char *pname, const int *data, int count) { BufferField(pname, sizeof(int) * count, (const char *)data); } /* <1b0c77> ../cstrike/dlls/util.cpp:2038 */ -NOXREF void CSave::WriteFloat(const char *pname, const float *data, int count) +void CSave::WriteFloat(const char *pname, const float *data, int count) { BufferField(pname, sizeof(float) * count, (const char *)data); } /* <1b0ea5> ../cstrike/dlls/util.cpp:2044 */ -NOXREF void CSave::WriteTime(const char *pname, const float *data, int count) +void CSave::WriteTime(const char *pname, const float *data, int count) { int i; BufferHeader(pname, sizeof(float) * count); @@ -1779,7 +1776,7 @@ NOXREF void CSave::WriteString(const char *pname, const char *pdata) } /* <1b121f> ../cstrike/dlls/util.cpp:2076 */ -NOXREF void CSave::WriteString(const char *pname, const int *stringId, int count) +void CSave::WriteString(const char *pname, const int *stringId, int count) { int i; int size = 0; @@ -1796,13 +1793,13 @@ NOXREF void CSave::WriteString(const char *pname, const int *stringId, int count } /* <1b1480> ../cstrike/dlls/util.cpp:2099 */ -NOXREF void CSave::WriteVector(const char *pname, const Vector &value) +void CSave::WriteVector(const char *pname, const Vector &value) { WriteVector(pname, &value.x, 1); } /* <1b1630> ../cstrike/dlls/util.cpp:2105 */ -NOXREF void CSave::WriteVector(const char *pname, const float *value, int count) +void CSave::WriteVector(const char *pname, const float *value, int count) { BufferHeader(pname, sizeof(float) * 3 * count); BufferData((const char *)value, sizeof(float) * 3 * count); @@ -1820,7 +1817,7 @@ NOXREF void CSave::WritePositionVector(const char *pname, const Vector &value) } /* <1b1bde> ../cstrike/dlls/util.cpp:2126 */ -NOXREF void CSave::WritePositionVector(const char *pname, const float *value, int count) +void CSave::WritePositionVector(const char *pname, const float *value, int count) { BufferHeader(pname, sizeof(float) * 3 * count); for (int i = 0; i < count; i++) @@ -1836,7 +1833,7 @@ NOXREF void CSave::WritePositionVector(const char *pname, const float *value, in } /* <1b2ca4> ../cstrike/dlls/util.cpp:2145 */ -NOXREF void CSave::WriteFunction(const char *pname, void **data, int count) +void CSave::WriteFunction(const char *pname, void **data, int count) { const char *functionName = NAME_FOR_FUNCTION((uint32)*data); @@ -2009,7 +2006,7 @@ NOXREF void CSave::BufferString(char *pdata, int len) } /* <1b3f5d> ../cstrike/dlls/util.cpp:2333 */ -NOXREF int CSave::DataEmpty(const char *pdata, int size) +int CSave::DataEmpty(const char *pdata, int size) { for (int i = 0; i < size; i++) { @@ -2264,7 +2261,7 @@ int CRestore::ReadFields(const char *pname, void *pBaseData, TYPEDESCRIPTION *pF } /* <1b46b1> ../cstrike/dlls/util.cpp:2595 */ -NOXREF void CRestore::BufferReadHeader(HEADER *pheader) +void CRestore::BufferReadHeader(HEADER *pheader) { pheader->size = ReadShort(); pheader->token = ReadShort(); @@ -2274,7 +2271,7 @@ NOXREF void CRestore::BufferReadHeader(HEADER *pheader) } /* <1b4654> ../cstrike/dlls/util.cpp:2605 */ -NOXREF short CRestore::ReadShort(void) +short CRestore::ReadShort(void) { short tmp = 0; BufferReadBytes((char *)&tmp, sizeof(short)); @@ -2282,7 +2279,7 @@ NOXREF short CRestore::ReadShort(void) } /* <1b45f5> ../cstrike/dlls/util.cpp:2614 */ -NOXREF int CRestore::ReadInt(void) +int CRestore::ReadInt(void) { int tmp = 0; BufferReadBytes((char *)&tmp, sizeof(int)); @@ -2306,7 +2303,7 @@ NOXREF char *CRestore::ReadNamedString(const char *pName) } /* <1b453a> ../cstrike/dlls/util.cpp:2644 */ -NOXREF char *CRestore::BufferPointer(void) +char *CRestore::BufferPointer(void) { if (!m_pdata) return NULL; @@ -2335,7 +2332,7 @@ void CRestore::BufferReadBytes(char *pOutput, int size) } /* <1b5092> ../cstrike/dlls/util.cpp:2673 */ -NOXREF void CRestore::BufferSkipBytes(int bytes) +void CRestore::BufferSkipBytes(int bytes) { BufferReadBytes(NULL, bytes); } diff --git a/regamedll/dlls/util.h b/regamedll/dlls/util.h index 5f48e7fd..e9d3f52c 100644 --- a/regamedll/dlls/util.h +++ b/regamedll/dlls/util.h @@ -161,7 +161,7 @@ extern globalvars_t *gpGlobals; #endif // HOOK_GAMEDLL #define LINK_ENTITY_TO_CLASS(mapClassName, DLLClassName)\ - C_DLLEXPORT void mapClassName(entvars_t *pev);\ + C_DLLEXPORT void EXT_FUNC mapClassName(entvars_t *pev);\ void mapClassName(entvars_t *pev)\ {\ GetClassPtr((DLLClassName *)pev);\ @@ -204,6 +204,16 @@ typedef enum } MONSTERSTATE; +// Things that toggle (buttons/triggers/doors) need this +typedef enum +{ + TS_AT_TOP, + TS_AT_BOTTOM, + TS_GOING_UP, + TS_GOING_DOWN, + +} TOGGLE_STATE; + typedef struct hudtextparms_s { float x; diff --git a/regamedll/dlls/vector.h b/regamedll/dlls/vector.h index f517e303..0de54539 100644 --- a/regamedll/dlls/vector.h +++ b/regamedll/dlls/vector.h @@ -121,8 +121,8 @@ public: float_precision flLen = Length(); if (flLen > 0.0) { - x /= (vec_t)flLen; - y /= (vec_t)flLen; + x = (vec_t)(1 / flLen * x); + y = (vec_t)(1 / flLen * y); } else { diff --git a/regamedll/dlls/vehicle.cpp b/regamedll/dlls/vehicle.cpp index db54af35..18aa6732 100644 --- a/regamedll/dlls/vehicle.cpp +++ b/regamedll/dlls/vehicle.cpp @@ -23,7 +23,7 @@ TYPEDESCRIPTION CFuncVehicle::m_SaveData[] = #else -TYPEDESCRIPTION IMPLEMENT_ARRAY_CLASS(CFuncVehicle, m_SaveData)[12]; +TYPEDESCRIPTION IMPL_CLASS(CFuncVehicle, m_SaveData)[12]; #endif // HOOK_GAMEDLL @@ -960,30 +960,12 @@ void CFuncVehicle::__MAKE_VHOOK(Precache)(void) switch (m_sounds) { - case 1: - PRECACHE_SOUND("plats/vehicle1.wav"); - pev->noise = MAKE_STRING("plats/vehicle1.wav"); - break; - case 2: - PRECACHE_SOUND("plats/vehicle2.wav"); - pev->noise = MAKE_STRING("plats/vehicle2.wav"); - break; - case 3: - PRECACHE_SOUND("plats/vehicle3.wav"); - pev->noise = MAKE_STRING("plats/vehicle3.wav"); - break; - case 4: - PRECACHE_SOUND("plats/vehicle4.wav"); - pev->noise = MAKE_STRING("plats/vehicle4.wav"); - break; - case 5: - PRECACHE_SOUND("plats/vehicle6.wav"); - pev->noise = MAKE_STRING("plats/vehicle6.wav"); - break; - case 6: - PRECACHE_SOUND("plats/vehicle7.wav"); - pev->noise = MAKE_STRING("plats/vehicle7.wav"); - break; + case 1: PRECACHE_SOUND("plats/vehicle1.wav");pev->noise = MAKE_STRING("plats/vehicle1.wav"); break; + case 2: PRECACHE_SOUND("plats/vehicle2.wav");pev->noise = MAKE_STRING("plats/vehicle2.wav"); break; + case 3: PRECACHE_SOUND("plats/vehicle3.wav");pev->noise = MAKE_STRING("plats/vehicle3.wav"); break; + case 4: PRECACHE_SOUND("plats/vehicle4.wav");pev->noise = MAKE_STRING("plats/vehicle4.wav"); break; + case 5: PRECACHE_SOUND("plats/vehicle6.wav");pev->noise = MAKE_STRING("plats/vehicle6.wav"); break; + case 6: PRECACHE_SOUND("plats/vehicle7.wav");pev->noise = MAKE_STRING("plats/vehicle7.wav"); break; } PRECACHE_SOUND("plats/vehicle_brake1.wav"); diff --git a/regamedll/dlls/weapons.cpp b/regamedll/dlls/weapons.cpp index c756b51f..d3efb25a 100644 --- a/regamedll/dlls/weapons.cpp +++ b/regamedll/dlls/weapons.cpp @@ -38,12 +38,12 @@ const char *g_pModelNameLaser = "sprites/laserbeam.spr"; #else // HOOK_GAMEDLL -ItemInfo IMPLEMENT_ARRAY_CLASS(CBasePlayerItem, ItemInfoArray)[32]; -AmmoInfo IMPLEMENT_ARRAY_CLASS(CBasePlayerItem, AmmoInfoArray)[32]; +ItemInfo IMPL_CLASS(CBasePlayerItem, ItemInfoArray)[32]; +AmmoInfo IMPL_CLASS(CBasePlayerItem, AmmoInfoArray)[32]; -TYPEDESCRIPTION IMPLEMENT_ARRAY_CLASS(CBasePlayerItem, m_SaveData)[3]; -TYPEDESCRIPTION IMPLEMENT_ARRAY_CLASS(CBasePlayerWeapon, m_SaveData)[7]; -TYPEDESCRIPTION IMPLEMENT_ARRAY_CLASS(CWeaponBox, m_SaveData)[4]; +TYPEDESCRIPTION IMPL_CLASS(CBasePlayerItem, m_SaveData)[3]; +TYPEDESCRIPTION IMPL_CLASS(CBasePlayerWeapon, m_SaveData)[7]; +TYPEDESCRIPTION IMPL_CLASS(CWeaponBox, m_SaveData)[4]; const char *g_pModelNameLaser; @@ -80,7 +80,7 @@ int MaxAmmoCarry(int iszName) { for (int i = 0; i < MAX_WEAPONS; i++) { - ItemInfo *info = &IMPLEMENT_ARRAY_CLASS(CBasePlayerItem, ItemInfoArray)[ i ]; + ItemInfo *info = &IMPL_CLASS(CBasePlayerItem, ItemInfoArray)[ i ]; if (info->pszAmmo1 && !Q_strcmp(STRING(iszName), info->pszAmmo1)) { @@ -231,10 +231,10 @@ void AddAmmoNameToAmmoRegistry(const char *szAmmoname) // make sure it's not already in the registry for (int i = 0; i < MAX_AMMO_SLOTS; i++) { - if (!IMPLEMENT_ARRAY_CLASS(CBasePlayerItem, AmmoInfoArray)[ i ].pszName) + if (!IMPL_CLASS(CBasePlayerItem, AmmoInfoArray)[ i ].pszName) continue; - if (!Q_stricmp(IMPLEMENT_ARRAY_CLASS(CBasePlayerItem, AmmoInfoArray)[ i ].pszName, szAmmoname)) + if (!Q_stricmp(IMPL_CLASS(CBasePlayerItem, AmmoInfoArray)[ i ].pszName, szAmmoname)) { // ammo already in registry, just quite return; @@ -249,10 +249,10 @@ void AddAmmoNameToAmmoRegistry(const char *szAmmoname) giAmmoIndex = 0; } - IMPLEMENT_ARRAY_CLASS(CBasePlayerItem, AmmoInfoArray)[ giAmmoIndex ].pszName = szAmmoname; + IMPL_CLASS(CBasePlayerItem, AmmoInfoArray)[ giAmmoIndex ].pszName = szAmmoname; // yes, this info is redundant - IMPLEMENT_ARRAY_CLASS(CBasePlayerItem, AmmoInfoArray)[ giAmmoIndex ].iId = giAmmoIndex; + IMPL_CLASS(CBasePlayerItem, AmmoInfoArray)[ giAmmoIndex ].iId = giAmmoIndex; } // Precaches the weapon and queues the weapon info for sending to clients @@ -278,7 +278,7 @@ void UTIL_PrecacheOtherWeapon(const char *szClassname) pEntity->Precache(); if (((CBasePlayerItem *)pEntity)->GetItemInfo(&II)) { - IMPLEMENT_ARRAY_CLASS(CBasePlayerItem, ItemInfoArray)[ II.iId ] = II; + IMPL_CLASS(CBasePlayerItem, ItemInfoArray)[ II.iId ] = II; if (II.pszAmmo1 != NULL && *II.pszAmmo1 != '\0') { @@ -317,7 +317,7 @@ NOXREF void UTIL_PrecacheOtherWeapon2(const char *szClassname) if (((CBasePlayerItem *)pEntity)->GetItemInfo(&II)) { - IMPLEMENT_ARRAY_CLASS(CBasePlayerItem, ItemInfoArray)[ II.iId ] = II; + IMPL_CLASS(CBasePlayerItem, ItemInfoArray)[ II.iId ] = II; if (II.pszAmmo1 != NULL && *II.pszAmmo1 != '\0') { @@ -339,8 +339,8 @@ NOXREF void UTIL_PrecacheOtherWeapon2(const char *szClassname) /* <1d3191> ../cstrike/dlls/weapons.cpp:345 */ void W_Precache(void) { - Q_memset(IMPLEMENT_ARRAY_CLASS(CBasePlayerItem, ItemInfoArray), 0, ARRAYSIZE(IMPLEMENT_ARRAY_CLASS(CBasePlayerItem, ItemInfoArray))); - Q_memset(IMPLEMENT_ARRAY_CLASS(CBasePlayerItem, AmmoInfoArray), 0, ARRAYSIZE(IMPLEMENT_ARRAY_CLASS(CBasePlayerItem, AmmoInfoArray))); + Q_memset(IMPL_CLASS(CBasePlayerItem, ItemInfoArray), 0, ARRAYSIZE(IMPL_CLASS(CBasePlayerItem, ItemInfoArray))); + Q_memset(IMPL_CLASS(CBasePlayerItem, AmmoInfoArray), 0, ARRAYSIZE(IMPL_CLASS(CBasePlayerItem, AmmoInfoArray))); giAmmoIndex = 0; // custom items... @@ -2317,51 +2317,51 @@ void CArmoury::ArmouryTouch(CBaseEntity *pOther) { switch (m_iItem) { - case ARMOURY_FLASHBANG: - { - if (p->AmmoInventory(p->GetAmmoIndex("Flashbang")) >= 2) - return; + case ARMOURY_FLASHBANG: + { + if (p->AmmoInventory(p->GetAmmoIndex("Flashbang")) >= 2) + return; - p->GiveNamedItem("weapon_flashbang"); - m_iCount--; - break; - } - case ARMOURY_HEGRENADE: - { - if (p->AmmoInventory(p->GetAmmoIndex("HEGrenade")) >= 1) - return; + p->GiveNamedItem("weapon_flashbang"); + m_iCount--; + break; + } + case ARMOURY_HEGRENADE: + { + if (p->AmmoInventory(p->GetAmmoIndex("HEGrenade")) >= 1) + return; - p->GiveNamedItem("weapon_hegrenade"); - m_iCount--; - break; - } - case ARMOURY_KEVLAR: - { - if (p->m_iKevlar == ARMOR_TYPE_KEVLAR) - return; + p->GiveNamedItem("weapon_hegrenade"); + m_iCount--; + break; + } + case ARMOURY_KEVLAR: + { + if (p->m_iKevlar == ARMOR_TYPE_KEVLAR) + return; - p->GiveNamedItem("item_kevlar"); - m_iCount--; - break; - } - case ARMOURY_ASSAULT: - { - if (p->m_iKevlar == ARMOR_TYPE_HELMET) - return; + p->GiveNamedItem("item_kevlar"); + m_iCount--; + break; + } + case ARMOURY_ASSAULT: + { + if (p->m_iKevlar == ARMOR_TYPE_HELMET) + return; - p->GiveNamedItem("item_assaultsuit"); - m_iCount--; - break; - } - case ARMOURY_SMOKEGRENADE: - { - if (p->AmmoInventory(p->GetAmmoIndex("SmokeGrenade")) >= 1) - return; + p->GiveNamedItem("item_assaultsuit"); + m_iCount--; + break; + } + case ARMOURY_SMOKEGRENADE: + { + if (p->AmmoInventory(p->GetAmmoIndex("SmokeGrenade")) >= 1) + return; - p->GiveNamedItem("weapon_smokegrenade"); - m_iCount--; - break; - } + p->GiveNamedItem("weapon_smokegrenade"); + m_iCount--; + break; + } } } diff --git a/regamedll/dlls/weapons.h b/regamedll/dlls/weapons.h index 9796aeb5..d580145e 100644 --- a/regamedll/dlls/weapons.h +++ b/regamedll/dlls/weapons.h @@ -46,29 +46,29 @@ class CBasePlayer; #define ITEM_FLAG_EXHAUSTIBLE 16 // A player can totally exhaust their ammo supply and lose this weapon #define WEAPON_IS_ONTARGET 0x40 - -#define ARMOR_TYPE_EMPTY 0 -#define ARMOR_TYPE_KEVLAR 1 // Armor -#define ARMOR_TYPE_HELMET 2 // Armor and helmet - -// the maximum amount of ammo each weapon's clip can hold + +#define ARMOR_TYPE_EMPTY 0 +#define ARMOR_TYPE_KEVLAR 1 // Armor +#define ARMOR_TYPE_HELMET 2 // Armor and helmet + +// the maximum amount of ammo each weapon's clip can hold #define WEAPON_NOCLIP -1 -#define LOUD_GUN_VOLUME 1000 -#define NORMAL_GUN_VOLUME 600 -#define QUIET_GUN_VOLUME 200 - -#define BRIGHT_GUN_FLASH 512 -#define NORMAL_GUN_FLASH 256 -#define DIM_GUN_FLASH 128 - -#define BIG_EXPLOSION_VOLUME 2048 -#define NORMAL_EXPLOSION_VOLUME 1024 -#define SMALL_EXPLOSION_VOLUME 512 - +#define LOUD_GUN_VOLUME 1000 +#define NORMAL_GUN_VOLUME 600 +#define QUIET_GUN_VOLUME 200 + +#define BRIGHT_GUN_FLASH 512 +#define NORMAL_GUN_FLASH 256 +#define DIM_GUN_FLASH 128 + +#define BIG_EXPLOSION_VOLUME 2048 +#define NORMAL_EXPLOSION_VOLUME 1024 +#define SMALL_EXPLOSION_VOLUME 512 + #define WEAPON_ACTIVITY_VOLUME 64 -// spawn flags +// spawn flags #define SF_DETONATE 0x0001 // Grenades flagged with this will be triggered when the owner calls detonateSatchelCharges // custom enum @@ -234,7 +234,7 @@ public: void EXPORT C4Think(void); public: - static TYPEDESCRIPTION IMPLEMENT_ARRAY(m_SaveData)[15]; + static TYPEDESCRIPTION IMPL(m_SaveData)[15]; bool m_bStartDefuse; bool m_bIsC4; @@ -301,14 +301,11 @@ public: return TRUE; } virtual void Holster(int skiplocal = 0); - virtual void UpdateItemInfo(void) {} virtual void ItemPreFrame(void) {} virtual void ItemPostFrame(void) {} - virtual void Drop(void); virtual void Kill(void); - virtual void AttachToPlayer(CBasePlayer *pPlayer); virtual int PrimaryAmmoIndex(void) { @@ -337,14 +334,14 @@ public: #ifdef HOOK_GAMEDLL - int Save_(CSave &save); - int Restore_(CRestore &restore); - void SetObjectCollisionBox_(void); - CBaseEntity *Respawn_(void); - int AddToPlayer_(CBasePlayer *pPlayer); - void Holster_(int skiplocal); - void Drop_(void); - void Kill_(void); + int Save_(CSave &save); + int Restore_(CRestore &restore); + void SetObjectCollisionBox_(void); + CBaseEntity *Respawn_(void); + int AddToPlayer_(CBasePlayer *pPlayer); + void Holster_(int skiplocal); + void Drop_(void); + void Kill_(void); void AttachToPlayer_(CBasePlayer *pPlayer); #endif // HOOK_GAMEDLL @@ -359,47 +356,47 @@ public: void FallInit(void); void CheckRespawn(void); public: - inline int iItemPosition(void) - { - return IMPLEMENT_ARRAY(ItemInfoArray)[ m_iId ].iPosition; - } - inline const char *pszAmmo1(void) - { - return IMPLEMENT_ARRAY(ItemInfoArray)[ m_iId ].pszAmmo1; - } - inline int iMaxAmmo1(void) - { - return IMPLEMENT_ARRAY(ItemInfoArray)[ m_iId ].iMaxAmmo1; - } - inline const char *pszAmmo2(void) - { - return IMPLEMENT_ARRAY(ItemInfoArray)[ m_iId ].pszAmmo2; - } - inline int iMaxAmmo2(void) - { - return IMPLEMENT_ARRAY(ItemInfoArray)[ m_iId ].iMaxAmmo2; - } - inline const char *pszName(void) - { - return IMPLEMENT_ARRAY(ItemInfoArray)[ m_iId ].pszName; - } - inline int iMaxClip(void) - { - return IMPLEMENT_ARRAY(ItemInfoArray)[ m_iId ].iMaxClip; - } - inline int iWeight(void) - { - return IMPLEMENT_ARRAY(ItemInfoArray)[ m_iId ].iWeight; - } - inline int iFlags(void) - { - return IMPLEMENT_ARRAY(ItemInfoArray)[ m_iId ].iFlags; + inline int iItemPosition(void) + { + return IMPL(ItemInfoArray)[ m_iId ].iPosition; + } + inline const char *pszAmmo1(void) + { + return IMPL(ItemInfoArray)[ m_iId ].pszAmmo1; + } + inline int iMaxAmmo1(void) + { + return IMPL(ItemInfoArray)[ m_iId ].iMaxAmmo1; + } + inline const char *pszAmmo2(void) + { + return IMPL(ItemInfoArray)[ m_iId ].pszAmmo2; + } + inline int iMaxAmmo2(void) + { + return IMPL(ItemInfoArray)[ m_iId ].iMaxAmmo2; + } + inline const char *pszName(void) + { + return IMPL(ItemInfoArray)[ m_iId ].pszName; + } + inline int iMaxClip(void) + { + return IMPL(ItemInfoArray)[ m_iId ].iMaxClip; + } + inline int iWeight(void) + { + return IMPL(ItemInfoArray)[ m_iId ].iWeight; + } + inline int iFlags(void) + { + return IMPL(ItemInfoArray)[ m_iId ].iFlags; } public: - static TYPEDESCRIPTION IMPLEMENT_ARRAY(m_SaveData)[3]; - static ItemInfo IMPLEMENT_ARRAY(ItemInfoArray)[32]; - static AmmoInfo IMPLEMENT_ARRAY(AmmoInfoArray)[32]; + static TYPEDESCRIPTION IMPL(m_SaveData)[3]; + static ItemInfo IMPL(ItemInfoArray)[32]; + static AmmoInfo IMPL(AmmoInfoArray)[32]; CBasePlayer *m_pPlayer; CBasePlayerItem *m_pNext; @@ -458,22 +455,22 @@ public: #ifdef HOOK_GAMEDLL - int Save_(CSave &save); - int Restore_(CRestore &restore); - int AddToPlayer_(CBasePlayer *pPlayer); - int AddDuplicate_(CBasePlayerItem *pItem); - BOOL CanDeploy_(void); - void Holster_(int skiplocal = 0); - void ItemPostFrame_(void); - int PrimaryAmmoIndex_(void); - int SecondaryAmmoIndex_(void); - int UpdateClientData_(CBasePlayer *pPlayer); - int ExtractAmmo_(CBasePlayerWeapon *pWeapon); - int ExtractClipAmmo_(CBasePlayerWeapon *pWeapon); - BOOL PlayEmptySound_(void); - void ResetEmptySound_(void); - void SendWeaponAnim_(int iAnim, int skiplocal = 0); - BOOL IsUseable_(void); + int Save_(CSave &save); + int Restore_(CRestore &restore); + int AddToPlayer_(CBasePlayer *pPlayer); + int AddDuplicate_(CBasePlayerItem *pItem); + BOOL CanDeploy_(void); + void Holster_(int skiplocal = 0); + void ItemPostFrame_(void); + int PrimaryAmmoIndex_(void); + int SecondaryAmmoIndex_(void); + int UpdateClientData_(CBasePlayer *pPlayer); + int ExtractAmmo_(CBasePlayerWeapon *pWeapon); + int ExtractClipAmmo_(CBasePlayerWeapon *pWeapon); + BOOL PlayEmptySound_(void); + void ResetEmptySound_(void); + void SendWeaponAnim_(int iAnim, int skiplocal = 0); + BOOL IsUseable_(void); void RetireWeapon_(void); #endif // HOOK_GAMEDLL @@ -501,7 +498,7 @@ public: bool ShieldSecondaryFire(int iUpAnim, int iDownAnim); public: - static TYPEDESCRIPTION IMPLEMENT_ARRAY(m_SaveData)[7]; + static TYPEDESCRIPTION IMPL(m_SaveData)[7]; int m_iPlayEmptySound; int m_fFireOnEmpty; @@ -601,7 +598,7 @@ public: BOOL PackAmmo(int iszName, int iCount); public: - static TYPEDESCRIPTION IMPLEMENT_ARRAY(m_SaveData)[4]; + static TYPEDESCRIPTION IMPL(m_SaveData)[4]; CBasePlayerItem *m_rgpPlayerItems[ MAX_ITEM_TYPES ]; int m_rgiszAmmo[ MAX_AMMO_SLOTS ]; @@ -633,7 +630,11 @@ public: virtual void WeaponIdle(void); virtual BOOL UseDecrement(void) { + #ifdef CLIENT_WEAPONS return TRUE; + #else + return FALSE; + #endif } virtual BOOL IsPistol(void) { @@ -676,7 +677,7 @@ public: virtual BOOL Deploy(void); virtual float GetMaxSpeed(void) { - return 250.0f; + return MP5N_MAX_SPEED; } int iItemSlot(void) { @@ -685,9 +686,13 @@ public: virtual void PrimaryAttack(void); virtual void Reload(void); virtual void WeaponIdle(void); - BOOL UseDecrement(void) + virtual BOOL UseDecrement(void) { + #ifdef CLIENT_WEAPONS return TRUE; + #else + return FALSE; + #endif } #ifdef HOOK_GAMEDLL @@ -733,7 +738,11 @@ public: virtual void WeaponIdle(void); virtual BOOL UseDecrement(void) { + #ifdef CLIENT_WEAPONS return TRUE; + #else + return FALSE; + #endif } #ifdef HOOK_GAMEDLL @@ -772,7 +781,7 @@ public: virtual BOOL Deploy(void); virtual float GetMaxSpeed(void) { - return 221.0f; + return AK47_MAX_SPEED; } virtual int iItemSlot(void) { @@ -784,7 +793,11 @@ public: virtual void WeaponIdle(void); virtual BOOL UseDecrement(void) { + #ifdef CLIENT_WEAPONS return TRUE; + #else + return FALSE; + #endif } #ifdef HOOK_GAMEDLL @@ -822,7 +835,7 @@ public: virtual BOOL Deploy(void); virtual float GetMaxSpeed(void) { - return 240.0f; + return AUG_MAX_SPEED; } virtual int iItemSlot(void) { @@ -834,7 +847,11 @@ public: virtual void WeaponIdle(void); virtual BOOL UseDecrement(void) { + #ifdef CLIENT_WEAPONS return TRUE; + #else + return FALSE; + #endif } #ifdef HOOK_GAMEDLL @@ -881,10 +898,10 @@ public: virtual void WeaponIdle(void); virtual BOOL UseDecrement(void) { - #ifdef CLIENT_WEAPONS - return TRUE; - #else - return FALSE; + #ifdef CLIENT_WEAPONS + return TRUE; + #else + return FALSE; #endif } @@ -933,7 +950,11 @@ public: virtual void WeaponIdle(void); virtual BOOL UseDecrement(void) { + #ifdef CLIENT_WEAPONS return TRUE; + #else + return FALSE; + #endif } #ifdef HOOK_GAMEDLL @@ -945,6 +966,7 @@ public: int GetItemInfo_(ItemInfo *p); BOOL Deploy_(void); void Holster_(int skiplocal); + float GetMaxSpeed_(void); void PrimaryAttack_(void); void WeaponIdle_(void); @@ -981,7 +1003,11 @@ public: virtual void WeaponIdle(void); virtual BOOL UseDecrement(void) { + #ifdef CLIENT_WEAPONS return TRUE; + #else + return FALSE; + #endif } virtual BOOL IsPistol(void) { @@ -1039,7 +1065,11 @@ public: virtual void WeaponIdle(void); virtual BOOL UseDecrement(void) { + #ifdef CLIENT_WEAPONS return TRUE; + #else + return FALSE; + #endif } virtual BOOL IsPistol(void) { @@ -1091,7 +1121,11 @@ public: virtual void WeaponIdle(void); virtual BOOL UseDecrement(void) { + #ifdef CLIENT_WEAPONS return TRUE; + #else + return FALSE; + #endif } #ifdef HOOK_GAMEDLL @@ -1141,7 +1175,11 @@ public: virtual void WeaponIdle(void); virtual BOOL UseDecrement(void) { + #ifdef CLIENT_WEAPONS return TRUE; + #else + return FALSE; + #endif } virtual BOOL IsPistol(void) { @@ -1197,7 +1235,11 @@ public: virtual void WeaponIdle(void); virtual BOOL UseDecrement(void) { + #ifdef CLIENT_WEAPONS return TRUE; + #else + return FALSE; + #endif } #ifdef HOOK_GAMEDLL @@ -1249,19 +1291,23 @@ public: virtual void SecondaryAttack(void); virtual BOOL UseDecrement(void) { + #ifdef CLIENT_WEAPONS return TRUE; + #else + return FALSE; + #endif } virtual void WeaponIdle(void); #ifdef HOOK_GAMEDLL - void Spawn_(void); - void Precache_(void); - int GetItemInfo_(ItemInfo *p); - BOOL Deploy_(void); - void Holster_(int skiplocal); - void PrimaryAttack_(void); - void SecondaryAttack_(void); + void Spawn_(void); + void Precache_(void); + int GetItemInfo_(ItemInfo *p); + BOOL Deploy_(void); + void Holster_(int skiplocal); + void PrimaryAttack_(void); + void SecondaryAttack_(void); void WeaponIdle_(void); #endif // HOOK_GAMEDLL @@ -1296,7 +1342,7 @@ public: virtual BOOL Deploy(void); virtual float GetMaxSpeed(void) { - return 220.0f; + return M249_MAX_SPEED; } virtual int iItemSlot(void) { @@ -1305,9 +1351,13 @@ public: virtual void PrimaryAttack(void); virtual void Reload(void); virtual void WeaponIdle(void); - BOOL UseDecrement(void) + virtual BOOL UseDecrement(void) { + #ifdef CLIENT_WEAPONS return TRUE; + #else + return FALSE; + #endif } #ifdef HOOK_GAMEDLL @@ -1344,7 +1394,7 @@ public: virtual BOOL Deploy(void); virtual float GetMaxSpeed(void) { - return 230.0f; + return M3_MAX_SPEED; } virtual int iItemSlot(void) { @@ -1355,7 +1405,11 @@ public: virtual void WeaponIdle(void); virtual BOOL UseDecrement(void) { + #ifdef CLIENT_WEAPONS return TRUE; + #else + return FALSE; + #endif } #ifdef HOOK_GAMEDLL @@ -1398,7 +1452,11 @@ public: virtual void WeaponIdle(void); virtual BOOL UseDecrement(void) { + #ifdef CLIENT_WEAPONS return TRUE; + #else + return FALSE; + #endif } #ifdef HOOK_GAMEDLL @@ -1437,7 +1495,7 @@ public: virtual BOOL Deploy(void); virtual float GetMaxSpeed(void) { - return 250.0f; + return MAC10_MAX_SPEED; } virtual int iItemSlot(void) { @@ -1448,16 +1506,20 @@ public: virtual void WeaponIdle(void); virtual BOOL UseDecrement(void) { + #ifdef CLIENT_WEAPONS return TRUE; + #else + return FALSE; + #endif } #ifdef HOOK_GAMEDLL - void Spawn_(void); - void Precache_(void); - int GetItemInfo_(ItemInfo *p); - BOOL Deploy_(void); - void PrimaryAttack_(void); + void Spawn_(void); + void Precache_(void); + int GetItemInfo_(ItemInfo *p); + BOOL Deploy_(void); + void PrimaryAttack_(void); void Reload_(void); void WeaponIdle_(void); @@ -1497,7 +1559,11 @@ public: virtual void WeaponIdle(void); virtual BOOL UseDecrement(void) { + #ifdef CLIENT_WEAPONS return TRUE; + #else + return FALSE; + #endif } virtual BOOL IsPistol(void) { @@ -1518,8 +1584,8 @@ public: #endif // HOOK_GAMEDLL public: - void P228Fire(float flSpread, float flCycleTime, BOOL fUseSemi); - NOXREF void MakeBeam(void); + void P228Fire(float flSpread, float flCycleTime, BOOL fUseSemi); + NOXREF void MakeBeam(void); NOXREF void BeamUpdate(void); public: @@ -1548,7 +1614,11 @@ public: virtual void WeaponIdle(void); virtual BOOL UseDecrement(void) { + #ifdef CLIENT_WEAPONS return TRUE; + #else + return FALSE; + #endif } #ifdef HOOK_GAMEDLL @@ -1595,7 +1665,11 @@ public: virtual void WeaponIdle(void); virtual BOOL UseDecrement(void) { + #ifdef CLIENT_WEAPONS return TRUE; + #else + return FALSE; + #endif } #ifdef HOOK_GAMEDLL @@ -1650,19 +1724,23 @@ public: virtual void WeaponIdle(void); virtual BOOL UseDecrement(void) { + #ifdef CLIENT_WEAPONS return TRUE; + #else + return FALSE; + #endif } #ifdef HOOK_GAMEDLL - void Spawn_(void); - void Precache_(void); - int GetItemInfo_(ItemInfo *p); - BOOL CanDeploy_(void); - BOOL Deploy_(void); - void Holster_(int skiplocal); - void PrimaryAttack_(void); - void SecondaryAttack_(void); + void Spawn_(void); + void Precache_(void); + int GetItemInfo_(ItemInfo *p); + BOOL CanDeploy_(void); + BOOL Deploy_(void); + void Holster_(int skiplocal); + void PrimaryAttack_(void); + void SecondaryAttack_(void); void WeaponIdle_(void); #endif // HOOK_GAMEDLL @@ -1687,7 +1765,7 @@ public: virtual BOOL Deploy(void); virtual float GetMaxSpeed(void) { - return 250.0f; + return TMP_MAX_SPEED; } virtual int iItemSlot(void) { @@ -1698,16 +1776,20 @@ public: virtual void WeaponIdle(void); virtual BOOL UseDecrement(void) { + #ifdef CLIENT_WEAPONS return TRUE; + #else + return FALSE; + #endif } #ifdef HOOK_GAMEDLL - void Spawn_(void); - void Precache_(void); - int GetItemInfo_(ItemInfo *p); - BOOL Deploy_(void); - void PrimaryAttack_(void); + void Spawn_(void); + void Precache_(void); + int GetItemInfo_(ItemInfo *p); + BOOL Deploy_(void); + void PrimaryAttack_(void); void Reload_(void); void WeaponIdle_(void); @@ -1735,7 +1817,7 @@ public: virtual BOOL Deploy(void); virtual float GetMaxSpeed(void) { - return 240.0f; + return XM1014_MAX_SPEED; } virtual int iItemSlot(void) { @@ -1746,7 +1828,11 @@ public: virtual void WeaponIdle(void); virtual BOOL UseDecrement(void) { + #ifdef CLIENT_WEAPONS return TRUE; + #else + return FALSE; + #endif } #ifdef HOOK_GAMEDLL @@ -1780,7 +1866,7 @@ public: virtual BOOL Deploy(void); virtual float GetMaxSpeed(void) { - return 250.0f; + return ELITE_MAX_SPEED; } virtual int iItemSlot(void) { @@ -1791,7 +1877,11 @@ public: virtual void WeaponIdle(void); virtual BOOL UseDecrement(void) { + #ifdef CLIENT_WEAPONS return TRUE; + #else + return FALSE; + #endif } virtual BOOL IsPistol(void) { @@ -1842,7 +1932,11 @@ public: virtual void WeaponIdle(void); virtual BOOL UseDecrement(void) { + #ifdef CLIENT_WEAPONS return TRUE; + #else + return FALSE; + #endif } virtual BOOL IsPistol(void) { @@ -1885,7 +1979,7 @@ public: virtual BOOL Deploy(void); virtual float GetMaxSpeed(void) { - return 250.0f; + return UMP45_MAX_SPEED; } virtual int iItemSlot(void) { @@ -1896,7 +1990,11 @@ public: virtual void WeaponIdle(void); virtual BOOL UseDecrement(void) { + #ifdef CLIENT_WEAPONS return TRUE; + #else + return FALSE; + #endif } #ifdef HOOK_GAMEDLL @@ -1942,7 +2040,11 @@ public: virtual void WeaponIdle(void); virtual BOOL UseDecrement(void) { + #ifdef CLIENT_WEAPONS return TRUE; + #else + return FALSE; + #endif } #ifdef HOOK_GAMEDLL @@ -1980,7 +2082,7 @@ public: virtual BOOL Deploy(void); virtual float GetMaxSpeed(void) { - return 240.0f; + return GALIL_MAX_SPEED; } virtual int iItemSlot(void) { @@ -1992,7 +2094,11 @@ public: virtual void WeaponIdle(void); virtual BOOL UseDecrement(void) { + #ifdef CLIENT_WEAPONS return TRUE; + #else + return FALSE; + #endif } #ifdef HOOK_GAMEDLL @@ -2030,7 +2136,7 @@ public: virtual BOOL Deploy(void); virtual float GetMaxSpeed(void) { - return 240.0f; + return FAMAS_MAX_SPEED; } virtual int iItemSlot(void) { @@ -2042,7 +2148,11 @@ public: virtual void WeaponIdle(void); virtual BOOL UseDecrement(void) { + #ifdef CLIENT_WEAPONS return TRUE; + #else + return FALSE; + #endif } #ifdef HOOK_GAMEDLL @@ -2066,53 +2176,53 @@ public: int iShellOn; };/* size: 344, cachelines: 6, members: 3 */ - -#ifdef HOOK_GAMEDLL - -#define g_sModelIndexLaser (*pg_sModelIndexLaser) -#define g_pModelNameLaser (*pg_pModelNameLaser) -#define g_sModelIndexLaserDot (*pg_sModelIndexLaserDot) - -#define g_sModelIndexFireball (*pg_sModelIndexFireball) -#define g_sModelIndexSmoke (*pg_sModelIndexSmoke) -#define g_sModelIndexWExplosion (*pg_sModelIndexWExplosion) -#define g_sModelIndexBubbles (*pg_sModelIndexBubbles) -#define g_sModelIndexBloodDrop (*pg_sModelIndexBloodDrop) -#define g_sModelIndexBloodSpray (*pg_sModelIndexBloodSpray) -#define g_sModelIndexSmokePuff (*pg_sModelIndexSmokePuff) -#define g_sModelIndexFireball2 (*pg_sModelIndexFireball2) -#define g_sModelIndexFireball3 (*pg_sModelIndexFireball3) -#define g_sModelIndexFireball4 (*pg_sModelIndexFireball4) -#define g_sModelIndexCTGhost (*pg_sModelIndexCTGhost) -#define g_sModelIndexTGhost (*pg_sModelIndexTGhost) -#define g_sModelIndexC4Glow (*pg_sModelIndexC4Glow) -#define giAmmoIndex (*pgiAmmoIndex) -#define g_sModelIndexRadio (*pg_sModelIndexRadio) -#define gMultiDamage (*pgMultiDamage) - -#endif // HOOK_GAMEDLL - -extern short g_sModelIndexLaser; -extern const char *g_pModelNameLaser; -extern short g_sModelIndexLaserDot; - -extern short g_sModelIndexFireball; -extern short g_sModelIndexSmoke; -extern short g_sModelIndexWExplosion; -extern short g_sModelIndexBubbles; -extern short g_sModelIndexBloodDrop; -extern short g_sModelIndexBloodSpray; -extern short g_sModelIndexSmokePuff; -extern short g_sModelIndexFireball2; -extern short g_sModelIndexFireball3; -extern short g_sModelIndexFireball4; -extern short g_sModelIndexCTGhost; -extern short g_sModelIndexTGhost; -extern short g_sModelIndexC4Glow; - -extern int giAmmoIndex; -extern short g_sModelIndexRadio; -extern MULTIDAMAGE gMultiDamage; + +#ifdef HOOK_GAMEDLL + +#define g_sModelIndexLaser (*pg_sModelIndexLaser) +#define g_pModelNameLaser (*pg_pModelNameLaser) +#define g_sModelIndexLaserDot (*pg_sModelIndexLaserDot) + +#define g_sModelIndexFireball (*pg_sModelIndexFireball) +#define g_sModelIndexSmoke (*pg_sModelIndexSmoke) +#define g_sModelIndexWExplosion (*pg_sModelIndexWExplosion) +#define g_sModelIndexBubbles (*pg_sModelIndexBubbles) +#define g_sModelIndexBloodDrop (*pg_sModelIndexBloodDrop) +#define g_sModelIndexBloodSpray (*pg_sModelIndexBloodSpray) +#define g_sModelIndexSmokePuff (*pg_sModelIndexSmokePuff) +#define g_sModelIndexFireball2 (*pg_sModelIndexFireball2) +#define g_sModelIndexFireball3 (*pg_sModelIndexFireball3) +#define g_sModelIndexFireball4 (*pg_sModelIndexFireball4) +#define g_sModelIndexCTGhost (*pg_sModelIndexCTGhost) +#define g_sModelIndexTGhost (*pg_sModelIndexTGhost) +#define g_sModelIndexC4Glow (*pg_sModelIndexC4Glow) +#define giAmmoIndex (*pgiAmmoIndex) +#define g_sModelIndexRadio (*pg_sModelIndexRadio) +#define gMultiDamage (*pgMultiDamage) + +#endif // HOOK_GAMEDLL + +extern short g_sModelIndexLaser; +extern const char *g_pModelNameLaser; +extern short g_sModelIndexLaserDot; + +extern short g_sModelIndexFireball; +extern short g_sModelIndexSmoke; +extern short g_sModelIndexWExplosion; +extern short g_sModelIndexBubbles; +extern short g_sModelIndexBloodDrop; +extern short g_sModelIndexBloodSpray; +extern short g_sModelIndexSmokePuff; +extern short g_sModelIndexFireball2; +extern short g_sModelIndexFireball3; +extern short g_sModelIndexFireball4; +extern short g_sModelIndexCTGhost; +extern short g_sModelIndexTGhost; +extern short g_sModelIndexC4Glow; + +extern int giAmmoIndex; +extern short g_sModelIndexRadio; +extern MULTIDAMAGE gMultiDamage; void FindHullIntersection(Vector &vecSrc, TraceResult &tr, float *mins, float *maxs, edict_t *pEntity); void AnnounceFlashInterval(float interval, float offset = 0); @@ -2135,34 +2245,34 @@ BOOL CanAttack(float attack_time, float curtime, BOOL isPredicted); #ifdef HOOK_GAMEDLL // linked object -C_DLLEXPORT void weapon_knife(entvars_t *pev); -C_DLLEXPORT void weapon_glock18(entvars_t *pev); -C_DLLEXPORT void weapon_c4(entvars_t *pev); -C_DLLEXPORT void weapon_usp(entvars_t *pev); -C_DLLEXPORT void weapon_smokegrenade(entvars_t *pev); -C_DLLEXPORT void weapon_m4a1(entvars_t *pev); -C_DLLEXPORT void weapon_hegrenade(entvars_t *pev); -C_DLLEXPORT void weapon_flashbang(entvars_t *pev); -C_DLLEXPORT void weapon_famas(entvars_t *pev); -C_DLLEXPORT void weapon_elite(entvars_t *pev); -C_DLLEXPORT void weapon_fiveseven(entvars_t *pev); -C_DLLEXPORT void weapon_p228(entvars_t *pev); -C_DLLEXPORT void weapon_xm1014(entvars_t *pev); -C_DLLEXPORT void weapon_g3sg1(entvars_t *pev); -C_DLLEXPORT void weapon_sg550(entvars_t *pev); -C_DLLEXPORT void weapon_deagle(entvars_t *pev); -C_DLLEXPORT void weapon_awp(entvars_t *pev); -C_DLLEXPORT void weapon_scout(entvars_t *pev); -C_DLLEXPORT void weapon_sg552(entvars_t *pev); -C_DLLEXPORT void weapon_m3(entvars_t *pev); -C_DLLEXPORT void weapon_aug(entvars_t *pev); -C_DLLEXPORT void weapon_galil(entvars_t *pev); -C_DLLEXPORT void weapon_ak47(entvars_t *pev); -C_DLLEXPORT void weapon_m249(entvars_t *pev); -C_DLLEXPORT void weapon_p90(entvars_t *pev); -C_DLLEXPORT void weapon_mac10(entvars_t *pev); -C_DLLEXPORT void weapon_ump45(entvars_t *pev); -C_DLLEXPORT void weapon_mp5navy(entvars_t *pev); +C_DLLEXPORT void weapon_knife(entvars_t *pev); +C_DLLEXPORT void weapon_glock18(entvars_t *pev); +C_DLLEXPORT void weapon_c4(entvars_t *pev); +C_DLLEXPORT void weapon_usp(entvars_t *pev); +C_DLLEXPORT void weapon_smokegrenade(entvars_t *pev); +C_DLLEXPORT void weapon_m4a1(entvars_t *pev); +C_DLLEXPORT void weapon_hegrenade(entvars_t *pev); +C_DLLEXPORT void weapon_flashbang(entvars_t *pev); +C_DLLEXPORT void weapon_famas(entvars_t *pev); +C_DLLEXPORT void weapon_elite(entvars_t *pev); +C_DLLEXPORT void weapon_fiveseven(entvars_t *pev); +C_DLLEXPORT void weapon_p228(entvars_t *pev); +C_DLLEXPORT void weapon_xm1014(entvars_t *pev); +C_DLLEXPORT void weapon_g3sg1(entvars_t *pev); +C_DLLEXPORT void weapon_sg550(entvars_t *pev); +C_DLLEXPORT void weapon_deagle(entvars_t *pev); +C_DLLEXPORT void weapon_awp(entvars_t *pev); +C_DLLEXPORT void weapon_scout(entvars_t *pev); +C_DLLEXPORT void weapon_sg552(entvars_t *pev); +C_DLLEXPORT void weapon_m3(entvars_t *pev); +C_DLLEXPORT void weapon_aug(entvars_t *pev); +C_DLLEXPORT void weapon_galil(entvars_t *pev); +C_DLLEXPORT void weapon_ak47(entvars_t *pev); +C_DLLEXPORT void weapon_m249(entvars_t *pev); +C_DLLEXPORT void weapon_p90(entvars_t *pev); +C_DLLEXPORT void weapon_mac10(entvars_t *pev); +C_DLLEXPORT void weapon_ump45(entvars_t *pev); +C_DLLEXPORT void weapon_mp5navy(entvars_t *pev); C_DLLEXPORT void weapon_tmp(entvars_t *pev); C_DLLEXPORT void armoury_entity(entvars_t *pev); diff --git a/regamedll/dlls/weapontype.h b/regamedll/dlls/weapontype.h index 40d18689..49ba93f8 100644 --- a/regamedll/dlls/weapontype.h +++ b/regamedll/dlls/weapontype.h @@ -128,14 +128,14 @@ enum WeaponCostType SHIELDGUN_PRICE = 2200, }; -enum WeaponState -{ - WPNSTATE_USP_SILENCED = (1 << 0), - WPNSTATE_GLOCK18_BURST_MODE = (1 << 1), - WPNSTATE_M4A1_SILENCED = (1 << 2), - WPNSTATE_ELITE_LEFT = (1 << 3), - WPNSTATE_FAMAS_BURST_MODE = (1 << 4), - WPNSTATE_SHIELD_DRAWN = (1 << 5), +enum WeaponState +{ + WPNSTATE_USP_SILENCED = (1 << 0), + WPNSTATE_GLOCK18_BURST_MODE = (1 << 1), + WPNSTATE_M4A1_SILENCED = (1 << 2), + WPNSTATE_ELITE_LEFT = (1 << 3), + WPNSTATE_FAMAS_BURST_MODE = (1 << 4), + WPNSTATE_SHIELD_DRAWN = (1 << 5), }; // custom enum @@ -324,8 +324,8 @@ enum shieldgun_e //custom enum shieldgren_e { - SHIELDREN_IDLE = 4, - SHIELDREN_UP, + SHIELDREN_IDLE = 4, + SHIELDREN_UP, SHIELDREN_DOWN }; diff --git a/regamedll/dlls/world.cpp b/regamedll/dlls/world.cpp index b96f5183..cb224bf6 100644 --- a/regamedll/dlls/world.cpp +++ b/regamedll/dlls/world.cpp @@ -71,7 +71,7 @@ TYPEDESCRIPTION gGlobalEntitySaveData[] = DLL_DECALLIST gDecals[42]; -TYPEDESCRIPTION IMPLEMENT_ARRAY_CLASS(CGlobalState, m_SaveData)[1]; +TYPEDESCRIPTION IMPL_CLASS(CGlobalState, m_SaveData)[1]; TYPEDESCRIPTION gGlobalEntitySaveData[3]; #endif // HOOK_GAMEDLL @@ -324,7 +324,7 @@ int CGlobalState::Save(CSave &save) int i; globalentity_t *pEntity; - if (!save.WriteFields("GLOBAL", this, IMPLEMENT_ARRAY(m_SaveData), ARRAYSIZE(IMPLEMENT_ARRAY(m_SaveData)))) + if (!save.WriteFields("GLOBAL", this, IMPL(m_SaveData), ARRAYSIZE(IMPL(m_SaveData)))) { return 0; } @@ -351,7 +351,7 @@ int CGlobalState::Restore(CRestore &restore) ClearStates(); - if (!restore.ReadFields("GLOBAL", this, IMPLEMENT_ARRAY(m_SaveData), ARRAYSIZE(IMPLEMENT_ARRAY(m_SaveData)))) + if (!restore.ReadFields("GLOBAL", this, IMPL(m_SaveData), ARRAYSIZE(IMPL(m_SaveData)))) { return 0; } @@ -403,21 +403,21 @@ void CGlobalState::ClearStates(void) } /* <1dbc13> ../cstrike/dlls/world.cpp:466 */ -void SaveGlobalState(SAVERESTOREDATA *pSaveData) +void EXT_FUNC SaveGlobalState(SAVERESTOREDATA *pSaveData) { CSave saveHelper(pSaveData); gGlobalState.Save(saveHelper); } /* <1dbcde> ../cstrike/dlls/world.cpp:473 */ -void RestoreGlobalState(SAVERESTOREDATA *pSaveData) +void EXT_FUNC RestoreGlobalState(SAVERESTOREDATA *pSaveData) { CRestore restoreHelper(pSaveData); gGlobalState.Restore(restoreHelper); } /* <1dbe72> ../cstrike/dlls/world.cpp:480 */ -void ResetGlobalState(void) +void EXT_FUNC ResetGlobalState(void) { gGlobalState.ClearStates(); diff --git a/regamedll/dlls/wpn_shared/wpn_aug.cpp b/regamedll/dlls/wpn_shared/wpn_aug.cpp index 406b8308..478cd415 100644 --- a/regamedll/dlls/wpn_shared/wpn_aug.cpp +++ b/regamedll/dlls/wpn_shared/wpn_aug.cpp @@ -6,171 +6,171 @@ LINK_ENTITY_TO_CLASS(weapon_aug, CAUG); /* <23a711> ../cstrike/dlls/wpn_shared/wpn_aug.cpp:52 */ void CAUG::__MAKE_VHOOK(Spawn)(void) { - Precache(); - m_iId = WEAPON_AUG; - SET_MODEL(edict(), "models/w_aug.mdl"); - - m_iDefaultAmmo = AUG_DEFAULT_GIVE; - m_flAccuracy = 0.2; - m_iShotsFired = 0; - + Precache(); + m_iId = WEAPON_AUG; + SET_MODEL(edict(), "models/w_aug.mdl"); + + m_iDefaultAmmo = AUG_DEFAULT_GIVE; + m_flAccuracy = 0.2; + m_iShotsFired = 0; + FallInit(); } /* <23a66a> ../cstrike/dlls/wpn_shared/wpn_aug.cpp:66 */ void CAUG::__MAKE_VHOOK(Precache)(void) { - PRECACHE_MODEL("models/v_aug.mdl"); - PRECACHE_MODEL("models/w_aug.mdl"); - - PRECACHE_SOUND("weapons/aug-1.wav"); - PRECACHE_SOUND("weapons/aug_clipout.wav"); - PRECACHE_SOUND("weapons/aug_clipin.wav"); - PRECACHE_SOUND("weapons/aug_boltpull.wav"); - PRECACHE_SOUND("weapons/aug_boltslap.wav"); - PRECACHE_SOUND("weapons/aug_forearm.wav"); - - m_iShell = PRECACHE_MODEL("models/rshell.mdl"); + PRECACHE_MODEL("models/v_aug.mdl"); + PRECACHE_MODEL("models/w_aug.mdl"); + + PRECACHE_SOUND("weapons/aug-1.wav"); + PRECACHE_SOUND("weapons/aug_clipout.wav"); + PRECACHE_SOUND("weapons/aug_clipin.wav"); + PRECACHE_SOUND("weapons/aug_boltpull.wav"); + PRECACHE_SOUND("weapons/aug_boltslap.wav"); + PRECACHE_SOUND("weapons/aug_forearm.wav"); + + m_iShell = PRECACHE_MODEL("models/rshell.mdl"); m_usFireAug = PRECACHE_EVENT(1, "events/aug.sc"); } /* <23a691> ../cstrike/dlls/wpn_shared/wpn_aug.cpp:83 */ int CAUG::__MAKE_VHOOK(GetItemInfo)(ItemInfo *p) { - p->pszName = STRING(pev->classname); - p->pszAmmo1 = "556Nato"; - p->iMaxAmmo1 = MAX_AMMO_556NATO; - p->pszAmmo2 = NULL; - p->iMaxAmmo2 = -1; - p->iMaxClip = AUG_MAX_CLIP; - p->iSlot = 0; - p->iPosition = 14; - p->iId = m_iId = WEAPON_AUG; - p->iFlags = 0; - p->iWeight = AUG_WEIGHT; - + p->pszName = STRING(pev->classname); + p->pszAmmo1 = "556Nato"; + p->iMaxAmmo1 = MAX_AMMO_556NATO; + p->pszAmmo2 = NULL; + p->iMaxAmmo2 = -1; + p->iMaxClip = AUG_MAX_CLIP; + p->iSlot = 0; + p->iPosition = 14; + p->iId = m_iId = WEAPON_AUG; + p->iFlags = 0; + p->iWeight = AUG_WEIGHT; + return 1; } /* <23a6ea> ../cstrike/dlls/wpn_shared/wpn_aug.cpp:100 */ BOOL CAUG::__MAKE_VHOOK(Deploy)(void) { - m_flAccuracy = 0.2; - m_iShotsFired = 0; - iShellOn = 1; - + m_flAccuracy = 0.2; + m_iShotsFired = 0; + iShellOn = 1; + return DefaultDeploy("models/v_aug.mdl", "models/p_aug.mdl", AUG_DRAW, "carbine", UseDecrement() != FALSE); } /* <23a6c4> ../cstrike/dlls/wpn_shared/wpn_aug.cpp:109 */ void CAUG::__MAKE_VHOOK(SecondaryAttack)(void) { - if (m_pPlayer->m_iFOV == DEFAULT_FOV) - m_pPlayer->pev->fov = m_pPlayer->m_iFOV = 55; - else - m_pPlayer->pev->fov = m_pPlayer->m_iFOV = 90; - + if (m_pPlayer->m_iFOV == DEFAULT_FOV) + m_pPlayer->pev->fov = m_pPlayer->m_iFOV = 55; + else + m_pPlayer->pev->fov = m_pPlayer->m_iFOV = 90; + m_flNextSecondaryAttack = UTIL_WeaponTimeBase() + 0.3; } /* <23aa31> ../cstrike/dlls/wpn_shared/wpn_aug.cpp:130 */ void CAUG::__MAKE_VHOOK(PrimaryAttack)(void) { - if (!(m_pPlayer->pev->flags & FL_ONGROUND)) - { - AUGFire(0.035 + (0.4 * m_flAccuracy), 0.0825, FALSE); - } - else if (m_pPlayer->pev->velocity.Length2D() > 140) - { - AUGFire(0.035 + (0.07 * m_flAccuracy), 0.0825, FALSE); - } - else if (m_pPlayer->pev->fov == DEFAULT_FOV) - { - AUGFire(0.02 * m_flAccuracy, 0.0825, FALSE); - } - else - { - AUGFire(0.02 * m_flAccuracy, 0.135, FALSE); + if (!(m_pPlayer->pev->flags & FL_ONGROUND)) + { + AUGFire(0.035 + (0.4 * m_flAccuracy), 0.0825, FALSE); + } + else if (m_pPlayer->pev->velocity.Length2D() > 140) + { + AUGFire(0.035 + (0.07 * m_flAccuracy), 0.0825, FALSE); + } + else if (m_pPlayer->pev->fov == DEFAULT_FOV) + { + AUGFire(0.02 * m_flAccuracy, 0.0825, FALSE); + } + else + { + AUGFire(0.02 * m_flAccuracy, 0.135, FALSE); } } /* <23a8e9> ../cstrike/dlls/wpn_shared/wpn_aug.cpp:143 */ void CAUG::AUGFire(float flSpread, float flCycleTime, BOOL fUseAutoAim) { - Vector vecAiming, vecSrc, vecDir; - int flag; - - m_bDelayFire = true; - m_iShotsFired++; - - m_flAccuracy = ((m_iShotsFired * m_iShotsFired * m_iShotsFired) / 215) + 0.3; - - if (m_flAccuracy > 1) - m_flAccuracy = 1; - - if (m_iClip <= 0) - { - if (m_fFireOnEmpty) - { - PlayEmptySound(); - m_flNextPrimaryAttack = GetNextAttackDelay(0.2); - } - - if (TheBots != NULL) - { - TheBots->OnEvent(EVENT_WEAPON_FIRED_ON_EMPTY, m_pPlayer); - } - - return; + Vector vecAiming, vecSrc, vecDir; + int flag; + + m_bDelayFire = true; + m_iShotsFired++; + + m_flAccuracy = ((m_iShotsFired * m_iShotsFired * m_iShotsFired) / 215) + 0.3; + + if (m_flAccuracy > 1) + m_flAccuracy = 1; + + if (m_iClip <= 0) + { + if (m_fFireOnEmpty) + { + PlayEmptySound(); + m_flNextPrimaryAttack = GetNextAttackDelay(0.2); + } + + if (TheBots != NULL) + { + TheBots->OnEvent(EVENT_WEAPON_FIRED_ON_EMPTY, m_pPlayer); + } + + return; } - m_iClip--; - m_pPlayer->pev->effects |= EF_MUZZLEFLASH; - m_pPlayer->SetAnimation(PLAYER_ATTACK1); - - m_pPlayer->m_iWeaponVolume = NORMAL_GUN_VOLUME; - m_pPlayer->m_iWeaponFlash = BRIGHT_GUN_FLASH; - - UTIL_MakeVectors(m_pPlayer->pev->v_angle + m_pPlayer->pev->punchangle); - - vecSrc = m_pPlayer->GetGunPosition(); - vecAiming = gpGlobals->v_forward; - - vecDir = m_pPlayer->FireBullets3(vecSrc, vecAiming, flSpread, 8192, 2, BULLET_PLAYER_556MM, - AUG_DAMAGE, AUG_RANGE_MODIFER, m_pPlayer->pev, false, m_pPlayer->random_seed); + m_iClip--; + m_pPlayer->pev->effects |= EF_MUZZLEFLASH; + m_pPlayer->SetAnimation(PLAYER_ATTACK1); -#ifdef CLIENT_WEAPONS - flag = FEV_NOTHOST; -#else - flag = 0; -#endif // CLIENT_WEAPONS - - PLAYBACK_EVENT_FULL(flag, m_pPlayer->edict(), m_usFireAug, 0, (float *)&g_vecZero, (float *)&g_vecZero, vecDir.x, vecDir.y, - (int)(m_pPlayer->pev->punchangle.x * 100), (int)(m_pPlayer->pev->punchangle.y * 100), FALSE, FALSE); - - m_flNextPrimaryAttack = m_flNextSecondaryAttack = GetNextAttackDelay(flCycleTime); - - if (!m_iClip && m_pPlayer->m_rgAmmo[m_iPrimaryAmmoType] <= 0) - { - m_pPlayer->SetSuitUpdate("!HEV_AMO0", FALSE, 0); - } - - m_flTimeWeaponIdle = UTIL_WeaponTimeBase() + 1.9; + m_pPlayer->m_iWeaponVolume = NORMAL_GUN_VOLUME; + m_pPlayer->m_iWeaponFlash = BRIGHT_GUN_FLASH; + + UTIL_MakeVectors(m_pPlayer->pev->v_angle + m_pPlayer->pev->punchangle); + + vecSrc = m_pPlayer->GetGunPosition(); + vecAiming = gpGlobals->v_forward; + + vecDir = m_pPlayer->FireBullets3(vecSrc, vecAiming, flSpread, 8192, 2, BULLET_PLAYER_556MM, + AUG_DAMAGE, AUG_RANGE_MODIFER, m_pPlayer->pev, false, m_pPlayer->random_seed); + +#ifdef CLIENT_WEAPONS + flag = FEV_NOTHOST; +#else + flag = 0; +#endif // CLIENT_WEAPONS + + PLAYBACK_EVENT_FULL(flag, m_pPlayer->edict(), m_usFireAug, 0, (float *)&g_vecZero, (float *)&g_vecZero, vecDir.x, vecDir.y, + (int)(m_pPlayer->pev->punchangle.x * 100), (int)(m_pPlayer->pev->punchangle.y * 100), FALSE, FALSE); + + m_flNextPrimaryAttack = m_flNextSecondaryAttack = GetNextAttackDelay(flCycleTime); + + if (!m_iClip && m_pPlayer->m_rgAmmo[m_iPrimaryAmmoType] <= 0) + { + m_pPlayer->SetSuitUpdate("!HEV_AMO0", FALSE, 0); + } + + m_flTimeWeaponIdle = UTIL_WeaponTimeBase() + 1.9; if (m_pPlayer->pev->velocity.Length2D() > 0) - { + { KickBack(1.0, 0.45, 0.275, 0.05, 4.0, 2.5, 7); - } + } else if (!(m_pPlayer->pev->flags & FL_ONGROUND)) - { + { KickBack(1.25, 0.45, 0.22, 0.18, 5.5, 4.0, 5); - } + } else if (m_pPlayer->pev->flags & FL_DUCKING) - { + { KickBack(0.575, 0.325, 0.2, 0.011, 3.25, 2.0, 8); - } + } else - { + { KickBack(0.625, 0.375, 0.25, 0.0125, 3.5, 2.25, 8); } } @@ -178,38 +178,38 @@ void CAUG::AUGFire(float flSpread, float flCycleTime, BOOL fUseAutoAim) /* <23a7c2> ../cstrike/dlls/wpn_shared/wpn_aug.cpp:225 */ void CAUG::__MAKE_VHOOK(Reload)(void) { - if (m_pPlayer->ammo_556nato <= 0) - { - return; - } - - if (DefaultReload(AUG_MAX_CLIP, AUG_RELOAD, AUG_RELOAD_TIME)) - { - m_pPlayer->SetAnimation(PLAYER_RELOAD); - - if (m_pPlayer->m_iFOV != DEFAULT_FOV) - { - SecondaryAttack(); - } - - m_flAccuracy = 0; - m_iShotsFired = 0; - m_bDelayFire = false; + if (m_pPlayer->ammo_556nato <= 0) + { + return; + } + + if (DefaultReload(AUG_MAX_CLIP, AUG_RELOAD, AUG_RELOAD_TIME)) + { + m_pPlayer->SetAnimation(PLAYER_RELOAD); + + if (m_pPlayer->m_iFOV != DEFAULT_FOV) + { + SecondaryAttack(); + } + + m_flAccuracy = 0; + m_iShotsFired = 0; + m_bDelayFire = false; } } /* <23a787> ../cstrike/dlls/wpn_shared/wpn_aug.cpp:245 */ void CAUG::__MAKE_VHOOK(WeaponIdle)(void) { - ResetEmptySound(); - m_pPlayer->GetAutoaimVector(AUTOAIM_10DEGREES); - - if (m_flTimeWeaponIdle > UTIL_WeaponTimeBase()) - { - return; - } - - m_flTimeWeaponIdle = UTIL_WeaponTimeBase() + 20; + ResetEmptySound(); + m_pPlayer->GetAutoaimVector(AUTOAIM_10DEGREES); + + if (m_flTimeWeaponIdle > UTIL_WeaponTimeBase()) + { + return; + } + + m_flTimeWeaponIdle = UTIL_WeaponTimeBase() + 20; SendWeaponAnim(AUG_IDLE1, UseDecrement() != FALSE); } diff --git a/regamedll/dlls/wpn_shared/wpn_c4.cpp b/regamedll/dlls/wpn_shared/wpn_c4.cpp index 063ebe85..3347381f 100644 --- a/regamedll/dlls/wpn_shared/wpn_c4.cpp +++ b/regamedll/dlls/wpn_shared/wpn_c4.cpp @@ -336,7 +336,7 @@ void CC4::__MAKE_VHOOK(Use)(CBaseEntity *pActivator, CBaseEntity *pCaller, USE_T } /* <2463cc> ../cstrike/dlls/weapons.h:732 */ -float CC4::GetMaxSpeed(void) +float CC4::__MAKE_VHOOK(GetMaxSpeed)(void) { return C4_MAX_SPEED; } @@ -378,6 +378,11 @@ void CC4::Holster(int skiplocal) Holster_(skiplocal); } +float CC4::GetMaxSpeed(void) +{ + return GetMaxSpeed_(); +} + void CC4::PrimaryAttack(void) { PrimaryAttack_(); diff --git a/regamedll/dlls/wpn_shared/wpn_famas.cpp b/regamedll/dlls/wpn_shared/wpn_famas.cpp index 95747114..c56e8832 100644 --- a/regamedll/dlls/wpn_shared/wpn_famas.cpp +++ b/regamedll/dlls/wpn_shared/wpn_famas.cpp @@ -6,51 +6,51 @@ LINK_ENTITY_TO_CLASS(weapon_famas, CFamas); /* <2c0284> ../cstrike/dlls/wpn_shared/wpn_famas.cpp:52 */ void CFamas::__MAKE_VHOOK(Spawn)(void) { - Precache(); - m_iId = WEAPON_FAMAS; - SET_MODEL(edict(), "models/w_famas.mdl"); - - m_iDefaultAmmo = FAMAS_DEFAULT_GIVE; - m_iFamasShotsFired = 0; - m_flFamasShoot = 0; - + Precache(); + m_iId = WEAPON_FAMAS; + SET_MODEL(edict(), "models/w_famas.mdl"); + + m_iDefaultAmmo = FAMAS_DEFAULT_GIVE; + m_iFamasShotsFired = 0; + m_flFamasShoot = 0; + FallInit(); } /* <2c01dc> ../cstrike/dlls/wpn_shared/wpn_famas.cpp:66 */ void CFamas::__MAKE_VHOOK(Precache)(void) { - PRECACHE_MODEL("models/v_famas.mdl"); - PRECACHE_MODEL("models/w_famas.mdl"); - - PRECACHE_SOUND("weapons/famas-1.wav"); - PRECACHE_SOUND("weapons/famas-2.wav"); - PRECACHE_SOUND("weapons/famas_clipout.wav"); - PRECACHE_SOUND("weapons/famas_clipin.wav"); - PRECACHE_SOUND("weapons/famas_boltpull.wav"); - PRECACHE_SOUND("weapons/famas_boltslap.wav"); - PRECACHE_SOUND("weapons/famas_forearm.wav"); - PRECACHE_SOUND("weapons/famas-burst.wav"); - - m_iShell = PRECACHE_MODEL("models/rshell.mdl"); + PRECACHE_MODEL("models/v_famas.mdl"); + PRECACHE_MODEL("models/w_famas.mdl"); + + PRECACHE_SOUND("weapons/famas-1.wav"); + PRECACHE_SOUND("weapons/famas-2.wav"); + PRECACHE_SOUND("weapons/famas_clipout.wav"); + PRECACHE_SOUND("weapons/famas_clipin.wav"); + PRECACHE_SOUND("weapons/famas_boltpull.wav"); + PRECACHE_SOUND("weapons/famas_boltslap.wav"); + PRECACHE_SOUND("weapons/famas_forearm.wav"); + PRECACHE_SOUND("weapons/famas-burst.wav"); + + m_iShell = PRECACHE_MODEL("models/rshell.mdl"); m_usFireFamas = PRECACHE_EVENT(1, "events/famas.sc"); } /* <2c0203> ../cstrike/dlls/wpn_shared/wpn_famas.cpp:85 */ int CFamas::__MAKE_VHOOK(GetItemInfo)(ItemInfo *p) { - p->pszName = STRING(pev->classname); - p->pszAmmo1 = "556Nato"; - p->iMaxAmmo1 = MAX_AMMO_556NATO; - p->pszAmmo2 = NULL; - p->iMaxAmmo2 = -1; - p->iMaxClip = FAMAS_MAX_CLIP; - p->iSlot = 0; - p->iPosition = 18; - p->iId = m_iId = WEAPON_FAMAS; - p->iFlags = 0; - p->iWeight = FAMAS_WEIGHT; - + p->pszName = STRING(pev->classname); + p->pszAmmo1 = "556Nato"; + p->iMaxAmmo1 = MAX_AMMO_556NATO; + p->pszAmmo2 = NULL; + p->iMaxAmmo2 = -1; + p->iMaxClip = FAMAS_MAX_CLIP; + p->iSlot = 0; + p->iPosition = 18; + p->iId = m_iId = WEAPON_FAMAS; + p->iFlags = 0; + p->iWeight = FAMAS_WEIGHT; + return 1; } @@ -58,55 +58,55 @@ int CFamas::__MAKE_VHOOK(GetItemInfo)(ItemInfo *p) BOOL CFamas::__MAKE_VHOOK(Deploy)(void) { m_iShotsFired = 0; - m_iFamasShotsFired = 0; - m_flFamasShoot = 0; - m_flAccuracy = 0.2; - - iShellOn = 1; - + m_iFamasShotsFired = 0; + m_flFamasShoot = 0; + m_flAccuracy = 0.2; + + iShellOn = 1; + return DefaultDeploy("models/v_famas.mdl", "models/p_famas.mdl", FAMAS_DRAW, "carbine", UseDecrement() != FALSE); } /* <2c0236> ../cstrike/dlls/wpn_shared/wpn_famas.cpp:114 */ void CFamas::__MAKE_VHOOK(SecondaryAttack)(void) { - if (m_iWeaponState & WPNSTATE_FAMAS_BURST_MODE) - { - ClientPrint(m_pPlayer->pev, HUD_PRINTCENTER, "#Switch_To_FullAuto"); - m_iWeaponState &= ~WPNSTATE_FAMAS_BURST_MODE; - } - else - { - ClientPrint(m_pPlayer->pev, HUD_PRINTCENTER, "#Switch_To_BurstFire"); - m_iWeaponState |= WPNSTATE_FAMAS_BURST_MODE; - } - + if (m_iWeaponState & WPNSTATE_FAMAS_BURST_MODE) + { + ClientPrint(m_pPlayer->pev, HUD_PRINTCENTER, "#Switch_To_FullAuto"); + m_iWeaponState &= ~WPNSTATE_FAMAS_BURST_MODE; + } + else + { + ClientPrint(m_pPlayer->pev, HUD_PRINTCENTER, "#Switch_To_BurstFire"); + m_iWeaponState |= WPNSTATE_FAMAS_BURST_MODE; + } + m_flNextSecondaryAttack = UTIL_WeaponTimeBase() + 0.3; } /* <2c04fe> ../cstrike/dlls/wpn_shared/wpn_famas.cpp:129 */ void CFamas::__MAKE_VHOOK(PrimaryAttack)(void) { - if (m_pPlayer->pev->waterlevel == 3) - { - PlayEmptySound(); - m_flNextPrimaryAttack = GetNextAttackDelay(0.15); - return; - } - - bool bFireBurst = (m_iWeaponState & WPNSTATE_FAMAS_BURST_MODE) == WPNSTATE_FAMAS_BURST_MODE; - - if (!(m_pPlayer->pev->flags & FL_ONGROUND)) - { - FamasFire(0.030 + 0.3 * m_flAccuracy, 0.0825, FALSE, bFireBurst); - } - else if (m_pPlayer->pev->velocity.Length2D() > 140) - { - FamasFire(0.030 + 0.07 * m_flAccuracy, 0.0825, FALSE, bFireBurst); - } - else - { - FamasFire(0.02 * m_flAccuracy, 0.0825, FALSE, bFireBurst); + if (m_pPlayer->pev->waterlevel == 3) + { + PlayEmptySound(); + m_flNextPrimaryAttack = GetNextAttackDelay(0.15); + return; + } + + bool bFireBurst = (m_iWeaponState & WPNSTATE_FAMAS_BURST_MODE) == WPNSTATE_FAMAS_BURST_MODE; + + if (!(m_pPlayer->pev->flags & FL_ONGROUND)) + { + FamasFire(0.030 + 0.3 * m_flAccuracy, 0.0825, FALSE, bFireBurst); + } + else if (m_pPlayer->pev->velocity.Length2D() > 140) + { + FamasFire(0.030 + 0.07 * m_flAccuracy, 0.0825, FALSE, bFireBurst); + } + else + { + FamasFire(0.02 * m_flAccuracy, 0.0825, FALSE, bFireBurst); } } @@ -117,132 +117,132 @@ void CFamas::FamasFire(float flSpread, float flCycleTime, BOOL fUseAutoAim, BOOL int flag; //int mask; - if (bFireBurst) - { - m_iFamasShotsFired = 0; - flCycleTime = 0.55; - } - else - { - flSpread += 0.01; - } - - m_bDelayFire = true; - m_iShotsFired++; - - m_flAccuracy = (m_iShotsFired * m_iShotsFired * m_iShotsFired / 215) + 0.3; - - if (m_flAccuracy > 1) - m_flAccuracy = 1; - - if (m_iClip <= 0) - { - if (m_fFireOnEmpty) - { - PlayEmptySound(); - m_flNextPrimaryAttack = GetNextAttackDelay(0.2); - } - - if (TheBots != NULL) - { - TheBots->OnEvent(EVENT_WEAPON_FIRED_ON_EMPTY, m_pPlayer); - } - - return; + if (bFireBurst) + { + m_iFamasShotsFired = 0; + flCycleTime = 0.55; + } + else + { + flSpread += 0.01; } - m_iClip--; - - m_pPlayer->pev->effects |= EF_MUZZLEFLASH; - m_pPlayer->SetAnimation(PLAYER_ATTACK1); - - UTIL_MakeVectors(m_pPlayer->pev->v_angle + m_pPlayer->pev->punchangle); - - m_pPlayer->m_iWeaponVolume = NORMAL_GUN_VOLUME; - m_pPlayer->m_iWeaponFlash = BRIGHT_GUN_FLASH; - - vecSrc = m_pPlayer->GetGunPosition(); - vecAiming = gpGlobals->v_forward; - + m_bDelayFire = true; + m_iShotsFired++; + + m_flAccuracy = (m_iShotsFired * m_iShotsFired * m_iShotsFired / 215) + 0.3; + + if (m_flAccuracy > 1) + m_flAccuracy = 1; + + if (m_iClip <= 0) + { + if (m_fFireOnEmpty) + { + PlayEmptySound(); + m_flNextPrimaryAttack = GetNextAttackDelay(0.2); + } + + if (TheBots != NULL) + { + TheBots->OnEvent(EVENT_WEAPON_FIRED_ON_EMPTY, m_pPlayer); + } + + return; + } + + m_iClip--; + + m_pPlayer->pev->effects |= EF_MUZZLEFLASH; + m_pPlayer->SetAnimation(PLAYER_ATTACK1); + + UTIL_MakeVectors(m_pPlayer->pev->v_angle + m_pPlayer->pev->punchangle); + + m_pPlayer->m_iWeaponVolume = NORMAL_GUN_VOLUME; + m_pPlayer->m_iWeaponFlash = BRIGHT_GUN_FLASH; + + vecSrc = m_pPlayer->GetGunPosition(); + vecAiming = gpGlobals->v_forward; + vecDir = m_pPlayer->FireBullets3(vecSrc, vecAiming, flSpread, 8192, 2, BULLET_PLAYER_556MM, bFireBurst ? FAMAS_DAMAGE_BURST : FAMAS_DAMAGE, FAMAS_RANGE_MODIFER, m_pPlayer->pev, false, m_pPlayer->random_seed); -#ifdef CLIENT_WEAPONS - flag = FEV_NOTHOST; -#else - flag = 0; -#endif // CLIENT_WEAPONS - +#ifdef CLIENT_WEAPONS + flag = FEV_NOTHOST; +#else + flag = 0; +#endif // CLIENT_WEAPONS + PLAYBACK_EVENT_FULL(flag, m_pPlayer->edict(), m_usFireFamas, 0, (float *)&g_vecZero, (float *)&g_vecZero, vecDir.x, vecDir.y, (int)(m_pPlayer->pev->punchangle.x * 10000000), (int)(m_pPlayer->pev->punchangle.y * 10000000), FALSE, FALSE); - m_flNextPrimaryAttack = m_flNextSecondaryAttack = GetNextAttackDelay(flCycleTime); - - if (!m_iClip && m_pPlayer->m_rgAmmo[m_iPrimaryAmmoType] <= 0) - { - m_pPlayer->SetSuitUpdate("!HEV_AMO0", FALSE, 0); - } - - m_flTimeWeaponIdle = UTIL_WeaponTimeBase() + 1.1; - - if (m_pPlayer->pev->velocity.Length2D() > 0) - { - KickBack(1.0, 0.45, 0.275, 0.05, 4.0, 2.5, 7); - } - else if (!(m_pPlayer->pev->flags & FL_ONGROUND)) - { - KickBack(1.25, 0.45, 0.22, 0.18, 5.5, 4.0, 5); - } - else if (m_pPlayer->pev->flags & FL_DUCKING) - { - KickBack(0.575, 0.325, 0.2, 0.011, 3.25, 2.0, 8); - } - else - { - KickBack(0.625, 0.375, 0.25, 0.0125, 3.5, 2.25, 8); - } - - if (bFireBurst) - { - m_iFamasShotsFired++; - m_fBurstSpread = flSpread; - m_flFamasShoot = gpGlobals->time + 0.05; + m_flNextPrimaryAttack = m_flNextSecondaryAttack = GetNextAttackDelay(flCycleTime); + + if (!m_iClip && m_pPlayer->m_rgAmmo[m_iPrimaryAmmoType] <= 0) + { + m_pPlayer->SetSuitUpdate("!HEV_AMO0", FALSE, 0); + } + + m_flTimeWeaponIdle = UTIL_WeaponTimeBase() + 1.1; + + if (m_pPlayer->pev->velocity.Length2D() > 0) + { + KickBack(1.0, 0.45, 0.275, 0.05, 4.0, 2.5, 7); + } + else if (!(m_pPlayer->pev->flags & FL_ONGROUND)) + { + KickBack(1.25, 0.45, 0.22, 0.18, 5.5, 4.0, 5); + } + else if (m_pPlayer->pev->flags & FL_DUCKING) + { + KickBack(0.575, 0.325, 0.2, 0.011, 3.25, 2.0, 8); + } + else + { + KickBack(0.625, 0.375, 0.25, 0.0125, 3.5, 2.25, 8); + } + + if (bFireBurst) + { + m_iFamasShotsFired++; + m_fBurstSpread = flSpread; + m_flFamasShoot = gpGlobals->time + 0.05; } } /* <2c0336> ../cstrike/dlls/wpn_shared/wpn_famas.cpp:262 */ void CFamas::__MAKE_VHOOK(Reload)(void) { - if (m_pPlayer->ammo_556nato <= 0) - { - return; - } - - if (DefaultReload(FAMAS_MAX_CLIP, FAMAS_RELOAD, FAMAS_RELOAD_TIME)) - { - m_pPlayer->SetAnimation(PLAYER_RELOAD); - - if (m_pPlayer->m_iFOV != DEFAULT_FOV) - { - SecondaryAttack(); - } - - m_flAccuracy = 0; - m_iShotsFired = 0; - m_bDelayFire = false; + if (m_pPlayer->ammo_556nato <= 0) + { + return; + } + + if (DefaultReload(FAMAS_MAX_CLIP, FAMAS_RELOAD, FAMAS_RELOAD_TIME)) + { + m_pPlayer->SetAnimation(PLAYER_RELOAD); + + if (m_pPlayer->m_iFOV != DEFAULT_FOV) + { + SecondaryAttack(); + } + + m_flAccuracy = 0; + m_iShotsFired = 0; + m_bDelayFire = false; } } /* <2c02fa> ../cstrike/dlls/wpn_shared/wpn_famas.cpp:284 */ void CFamas::__MAKE_VHOOK(WeaponIdle)(void) { - ResetEmptySound(); - m_pPlayer->GetAutoaimVector(AUTOAIM_10DEGREES); - - if (m_flTimeWeaponIdle <= UTIL_WeaponTimeBase()) - { - m_flTimeWeaponIdle = UTIL_WeaponTimeBase() + 20.0; - SendWeaponAnim(FAMAS_IDLE1, UseDecrement() != FALSE); + ResetEmptySound(); + m_pPlayer->GetAutoaimVector(AUTOAIM_10DEGREES); + + if (m_flTimeWeaponIdle <= UTIL_WeaponTimeBase()) + { + m_flTimeWeaponIdle = UTIL_WeaponTimeBase() + 20.0; + SendWeaponAnim(FAMAS_IDLE1, UseDecrement() != FALSE); } } diff --git a/regamedll/dlls/wpn_shared/wpn_m249.cpp b/regamedll/dlls/wpn_shared/wpn_m249.cpp index 2e59b811..510e940f 100644 --- a/regamedll/dlls/wpn_shared/wpn_m249.cpp +++ b/regamedll/dlls/wpn_shared/wpn_m249.cpp @@ -6,157 +6,157 @@ LINK_ENTITY_TO_CLASS(weapon_m249, CM249); /* <276951> ../cstrike/dlls/wpn_shared/wpn_m249.cpp:51 */ void CM249::__MAKE_VHOOK(Spawn)(void) { - Precache(); - m_iId = WEAPON_M249; - SET_MODEL(edict(), "models/w_m249.mdl"); - - m_iDefaultAmmo = M249_DEFAULT_GIVE; - m_flAccuracy = 0.2; - m_iShotsFired = 0; - + Precache(); + m_iId = WEAPON_M249; + SET_MODEL(edict(), "models/w_m249.mdl"); + + m_iDefaultAmmo = M249_DEFAULT_GIVE; + m_flAccuracy = 0.2; + m_iShotsFired = 0; + FallInit(); } /* <2768d0> ../cstrike/dlls/wpn_shared/wpn_m249.cpp:65 */ void CM249::__MAKE_VHOOK(Precache)(void) { - PRECACHE_MODEL("models/v_m249.mdl"); - PRECACHE_MODEL("models/w_m249.mdl"); - - PRECACHE_SOUND("weapons/m249-1.wav"); - PRECACHE_SOUND("weapons/m249-2.wav"); - PRECACHE_SOUND("weapons/m249_boxout.wav"); - PRECACHE_SOUND("weapons/m249_boxin.wav"); - PRECACHE_SOUND("weapons/m249_chain.wav"); - PRECACHE_SOUND("weapons/m249_coverup.wav"); - PRECACHE_SOUND("weapons/m249_coverdown.wav"); - - m_iShell = PRECACHE_MODEL("models/rshell.mdl"); + PRECACHE_MODEL("models/v_m249.mdl"); + PRECACHE_MODEL("models/w_m249.mdl"); + + PRECACHE_SOUND("weapons/m249-1.wav"); + PRECACHE_SOUND("weapons/m249-2.wav"); + PRECACHE_SOUND("weapons/m249_boxout.wav"); + PRECACHE_SOUND("weapons/m249_boxin.wav"); + PRECACHE_SOUND("weapons/m249_chain.wav"); + PRECACHE_SOUND("weapons/m249_coverup.wav"); + PRECACHE_SOUND("weapons/m249_coverdown.wav"); + + m_iShell = PRECACHE_MODEL("models/rshell.mdl"); m_usFireM249 = PRECACHE_EVENT(1, "events/m249.sc"); } /* <2768f7> ../cstrike/dlls/wpn_shared/wpn_m249.cpp:84 */ int CM249::__MAKE_VHOOK(GetItemInfo)(ItemInfo *p) { - p->pszName = STRING(pev->classname); - p->pszAmmo1 = "556NatoBox"; - p->iMaxAmmo1 = MAX_AMMO_556NATOBOX; - p->pszAmmo2 = NULL; - p->iMaxAmmo2 = -1; - p->iMaxClip = M249_MAX_CLIP; - p->iSlot = 0; - p->iPosition = 4; - p->iId = m_iId = WEAPON_M249; - p->iFlags = 0; - p->iWeight = M249_WEIGHT; - + p->pszName = STRING(pev->classname); + p->pszAmmo1 = "556NatoBox"; + p->iMaxAmmo1 = MAX_AMMO_556NATOBOX; + p->pszAmmo2 = NULL; + p->iMaxAmmo2 = -1; + p->iMaxClip = M249_MAX_CLIP; + p->iSlot = 0; + p->iPosition = 4; + p->iId = m_iId = WEAPON_M249; + p->iFlags = 0; + p->iWeight = M249_WEIGHT; + return 1; } /* <27692a> ../cstrike/dlls/wpn_shared/wpn_m249.cpp:101 */ BOOL CM249::__MAKE_VHOOK(Deploy)(void) { - m_flAccuracy = 0.2; - m_iShotsFired = 0; - iShellOn = 1; - + m_flAccuracy = 0.2; + m_iShotsFired = 0; + iShellOn = 1; + return DefaultDeploy("models/v_m249.mdl", "models/p_m249.mdl", M249_DRAW, "m249", UseDecrement() != FALSE); } /* <276b73> ../cstrike/dlls/wpn_shared/wpn_m249.cpp:111 */ void CM249::__MAKE_VHOOK(PrimaryAttack)(void) { - if (!(m_pPlayer->pev->flags & FL_ONGROUND)) - { - M249Fire(0.045 + (0.5 * m_flAccuracy), 0.1, FALSE); - } - else if (m_pPlayer->pev->velocity.Length2D() > 140) - { - M249Fire(0.045 + (0.095 * m_flAccuracy), 0.1, FALSE); - } - else - { - M249Fire(0.03 * m_flAccuracy, 0.1, FALSE); + if (!(m_pPlayer->pev->flags & FL_ONGROUND)) + { + M249Fire(0.045 + (0.5 * m_flAccuracy), 0.1, FALSE); + } + else if (m_pPlayer->pev->velocity.Length2D() > 140) + { + M249Fire(0.045 + (0.095 * m_flAccuracy), 0.1, FALSE); + } + else + { + M249Fire(0.03 * m_flAccuracy, 0.1, FALSE); } } /* <276c87> ../cstrike/dlls/wpn_shared/wpn_m249.cpp:121 */ void CM249::M249Fire(float flSpread, float flCycleTime, BOOL fUseAutoAim) { - Vector vecAiming, vecSrc, vecDir; - int flag; - - m_bDelayFire = true; - m_iShotsFired++; - - m_flAccuracy = ((m_iShotsFired * m_iShotsFired * m_iShotsFired) / 175) + 0.4; - - if (m_flAccuracy > 0.9) - m_flAccuracy = 0.9; - - if (m_iClip <= 0) - { - if (m_fFireOnEmpty) - { - PlayEmptySound(); - m_flNextPrimaryAttack = GetNextAttackDelay(0.2); - } - - if (TheBots != NULL) - { - TheBots->OnEvent(EVENT_WEAPON_FIRED_ON_EMPTY, m_pPlayer); - } - - return; + Vector vecAiming, vecSrc, vecDir; + int flag; + + m_bDelayFire = true; + m_iShotsFired++; + + m_flAccuracy = ((m_iShotsFired * m_iShotsFired * m_iShotsFired) / 175) + 0.4; + + if (m_flAccuracy > 0.9) + m_flAccuracy = 0.9; + + if (m_iClip <= 0) + { + if (m_fFireOnEmpty) + { + PlayEmptySound(); + m_flNextPrimaryAttack = GetNextAttackDelay(0.2); + } + + if (TheBots != NULL) + { + TheBots->OnEvent(EVENT_WEAPON_FIRED_ON_EMPTY, m_pPlayer); + } + + return; } - m_iClip--; - m_pPlayer->pev->effects |= EF_MUZZLEFLASH; - m_pPlayer->SetAnimation(PLAYER_ATTACK1); - - UTIL_MakeVectors(m_pPlayer->pev->v_angle + m_pPlayer->pev->punchangle); - - m_pPlayer->m_iWeaponVolume = NORMAL_GUN_VOLUME; - m_pPlayer->m_iWeaponFlash = BRIGHT_GUN_FLASH; - - vecSrc = m_pPlayer->GetGunPosition(); - vecAiming = gpGlobals->v_forward; - - vecDir = m_pPlayer->FireBullets3(vecSrc, vecAiming, flSpread, 8192, 2, BULLET_PLAYER_556MM, - M249_DAMAGE, M249_RANGE_MODIFER, m_pPlayer->pev, false, m_pPlayer->random_seed); + m_iClip--; + m_pPlayer->pev->effects |= EF_MUZZLEFLASH; + m_pPlayer->SetAnimation(PLAYER_ATTACK1); -#ifdef CLIENT_WEAPONS - flag = FEV_NOTHOST; -#else - flag = 0; -#endif // CLIENT_WEAPONS - - PLAYBACK_EVENT_FULL(flag, m_pPlayer->edict(), m_usFireM249, 0, (float *)&g_vecZero, (float *)&g_vecZero, vecDir.x, vecDir.y, - (int)(m_pPlayer->pev->punchangle.x * 100), (int)(m_pPlayer->pev->punchangle.y * 100), FALSE, FALSE); - - m_flNextPrimaryAttack = m_flNextSecondaryAttack = GetNextAttackDelay(flCycleTime); - - if (!m_iClip && m_pPlayer->m_rgAmmo[m_iPrimaryAmmoType] <= 0) - { - m_pPlayer->SetSuitUpdate("!HEV_AMO0", FALSE, 0); - } - - m_flTimeWeaponIdle = UTIL_WeaponTimeBase() + 1.6; + UTIL_MakeVectors(m_pPlayer->pev->v_angle + m_pPlayer->pev->punchangle); + + m_pPlayer->m_iWeaponVolume = NORMAL_GUN_VOLUME; + m_pPlayer->m_iWeaponFlash = BRIGHT_GUN_FLASH; + + vecSrc = m_pPlayer->GetGunPosition(); + vecAiming = gpGlobals->v_forward; + + vecDir = m_pPlayer->FireBullets3(vecSrc, vecAiming, flSpread, 8192, 2, BULLET_PLAYER_556MM, + M249_DAMAGE, M249_RANGE_MODIFER, m_pPlayer->pev, false, m_pPlayer->random_seed); + +#ifdef CLIENT_WEAPONS + flag = FEV_NOTHOST; +#else + flag = 0; +#endif // CLIENT_WEAPONS + + PLAYBACK_EVENT_FULL(flag, m_pPlayer->edict(), m_usFireM249, 0, (float *)&g_vecZero, (float *)&g_vecZero, vecDir.x, vecDir.y, + (int)(m_pPlayer->pev->punchangle.x * 100), (int)(m_pPlayer->pev->punchangle.y * 100), FALSE, FALSE); + + m_flNextPrimaryAttack = m_flNextSecondaryAttack = GetNextAttackDelay(flCycleTime); + + if (!m_iClip && m_pPlayer->m_rgAmmo[m_iPrimaryAmmoType] <= 0) + { + m_pPlayer->SetSuitUpdate("!HEV_AMO0", FALSE, 0); + } + + m_flTimeWeaponIdle = UTIL_WeaponTimeBase() + 1.6; if (!(m_pPlayer->pev->flags & FL_ONGROUND)) - { + { KickBack(1.8, 0.65, 0.45, 0.125, 5.0, 3.5, 8); - } + } else if (m_pPlayer->pev->velocity.Length2D() > 0) - { + { KickBack(1.1, 0.5, 0.3, 0.06, 4.0, 3.0, 8); - } + } else if (m_pPlayer->pev->flags & FL_DUCKING) - { + { KickBack(0.75, 0.325, 0.25, 0.025, 3.5, 2.5, 9); - } + } else - { + { KickBack(0.8, 0.35, 0.3, 0.03, 3.75, 3.0, 9); } } @@ -166,34 +166,34 @@ void CM249::__MAKE_VHOOK(Reload)(void) { #ifdef REGAMEDLL_FIXES // to prevent reload if not enough ammo - if (m_pPlayer->ammo_556natobox <= 0) - { - return; - } -#endif // REGAMEDLL_FIXES - - if (DefaultReload(M249_MAX_CLIP, M249_RELOAD, M249_RELOAD_TIME)) - { - m_pPlayer->SetAnimation(PLAYER_RELOAD); - - m_flAccuracy = 0.2; - m_bDelayFire = false; - m_iShotsFired = 0; + if (m_pPlayer->ammo_556natobox <= 0) + { + return; + } +#endif // REGAMEDLL_FIXES + + if (DefaultReload(M249_MAX_CLIP, M249_RELOAD, M249_RELOAD_TIME)) + { + m_pPlayer->SetAnimation(PLAYER_RELOAD); + + m_flAccuracy = 0.2; + m_bDelayFire = false; + m_iShotsFired = 0; } } /* <2769c7> ../cstrike/dlls/wpn_shared/wpn_m249.cpp:222 */ void CM249::__MAKE_VHOOK(WeaponIdle)(void) { - ResetEmptySound(); - m_pPlayer->GetAutoaimVector(AUTOAIM_10DEGREES); - - if (m_flTimeWeaponIdle > UTIL_WeaponTimeBase()) - { - return; - } - - m_flTimeWeaponIdle = UTIL_WeaponTimeBase() + 20; + ResetEmptySound(); + m_pPlayer->GetAutoaimVector(AUTOAIM_10DEGREES); + + if (m_flTimeWeaponIdle > UTIL_WeaponTimeBase()) + { + return; + } + + m_flTimeWeaponIdle = UTIL_WeaponTimeBase() + 20; SendWeaponAnim(M249_IDLE1, UseDecrement() != FALSE); } diff --git a/regamedll/engine/common.h b/regamedll/engine/common.h index 030a39fb..b7e5717f 100644 --- a/regamedll/engine/common.h +++ b/regamedll/engine/common.h @@ -26,11 +26,11 @@ * */ -#ifndef COMMON_H -#define COMMON_H -#ifdef _WIN32 -#pragma once -#endif +#ifndef COMMON_H +#define COMMON_H +#ifdef _WIN32 +#pragma once +#endif #include "maintypes.h" #include "bspfile.h" @@ -111,6 +111,7 @@ typedef struct incomingtransfer_s #define Q_snprintf _snprintf #define Q_atoi atoi #define Q_atof atof +#define Q_memmove memmove //#define Q_strtoull strtoull //#define Q_FileNameCmp FileNameCmp #define Q_vsnprintf _vsnprintf diff --git a/regamedll/engine/unicode_strtools.h b/regamedll/engine/unicode_strtools.h index d9135d45..ee213dab 100644 --- a/regamedll/engine/unicode_strtools.h +++ b/regamedll/engine/unicode_strtools.h @@ -59,30 +59,30 @@ enum EStringConvertErrorPolicy STRINGCONVERT_ASSERT_FAIL = 6, }; -bool Q_IsValidUChar32(uchar32 uVal); -int Q_UTF32ToUChar32(const uchar32 *pUTF32, uchar32 &uVal, bool &bErr); -int Q_UChar32ToUTF32Len(uchar32 uVal); -int Q_UChar32ToUTF32(uchar32 uVal, uchar32 *pUTF32); -int Q_UChar32ToUTF8Len(uchar32 uVal); -int Q_UChar32ToUTF16Len(uchar32 uVal); -int Q_UChar32ToUTF16(uchar32 uVal, uchar16 *pUTF16Out); -int Q_UChar32ToUTF8(uchar32 uVal, char *pUTF8Out); -int Q_UTF16ToUChar32(const uchar16 *pUTF16, uchar32 &uValueOut, bool &bErrorOut); -int Q_UTF8ToUTF16(const char *pUTF8, uchar16 *pUTF16, int cubDestSizeInBytes, EStringConvertErrorPolicy ePolicy); -int Q_UTF8ToUTF32(const char *pUTF8, uchar32 *pUTF32, int cubDestSizeInBytes, EStringConvertErrorPolicy ePolicy); -int Q_UTF16ToUTF8(const uchar16 *pUTF16, char *pUTF8, int cubDestSizeInBytes, EStringConvertErrorPolicy ePolicy); -NOXREF int Q_UTF16ToUTF32(const uchar16 *pUTF16, uchar32 *pUTF32, int cubDestSizeInBytes, EStringConvertErrorPolicy ePolicy); -int Q_UTF32ToUTF8(const uchar32 *pUTF32, char *pUTF8, int cubDestSizeInBytes, EStringConvertErrorPolicy ePolicy); -NOXREF int Q_UTF32ToUTF16(const uchar32 *pUTF32, uchar16 *pUTF16, int cubDestSizeInBytes, EStringConvertErrorPolicy ePolicy); -int Q_UTF8ToUChar32(const char *pUTF8_, uchar32 &uValueOut, bool &bErrorOut); -qboolean Q_UnicodeValidate(const char *pUTF8); -NOXREF int Q_UnicodeLength(const char *pUTF8); -NOXREF char *Q_UnicodeAdvance(char *pUTF8, int nChars); -//bool Q_IsMeanSpaceW(uchar16 wch); -bool Q_IsDeprecatedW(uchar16 wch); -uchar16 *StripUnprintableWorker(uchar16 *pwch, bool *pbStrippedAny); -qboolean Q_StripUnprintableAndSpace(char *pch); -NOXREF qboolean V_UTF8ToUChar32(const char *pUTF8_, uchar32 *uValueOut); -NOXREF int Q_UnicodeRepair(char *pUTF8); +bool Q_IsValidUChar32(uchar32 uVal); +int Q_UTF32ToUChar32(const uchar32 *pUTF32, uchar32 &uVal, bool &bErr); +int Q_UChar32ToUTF32Len(uchar32 uVal); +int Q_UChar32ToUTF32(uchar32 uVal, uchar32 *pUTF32); +int Q_UChar32ToUTF8Len(uchar32 uVal); +int Q_UChar32ToUTF16Len(uchar32 uVal); +int Q_UChar32ToUTF16(uchar32 uVal, uchar16 *pUTF16Out); +int Q_UChar32ToUTF8(uchar32 uVal, char *pUTF8Out); +int Q_UTF16ToUChar32(const uchar16 *pUTF16, uchar32 &uValueOut, bool &bErrorOut); +int Q_UTF8ToUTF16(const char *pUTF8, uchar16 *pUTF16, int cubDestSizeInBytes, EStringConvertErrorPolicy ePolicy); +int Q_UTF8ToUTF32(const char *pUTF8, uchar32 *pUTF32, int cubDestSizeInBytes, EStringConvertErrorPolicy ePolicy); +int Q_UTF16ToUTF8(const uchar16 *pUTF16, char *pUTF8, int cubDestSizeInBytes, EStringConvertErrorPolicy ePolicy); +NOXREF int Q_UTF16ToUTF32(const uchar16 *pUTF16, uchar32 *pUTF32, int cubDestSizeInBytes, EStringConvertErrorPolicy ePolicy); +int Q_UTF32ToUTF8(const uchar32 *pUTF32, char *pUTF8, int cubDestSizeInBytes, EStringConvertErrorPolicy ePolicy); +NOXREF int Q_UTF32ToUTF16(const uchar32 *pUTF32, uchar16 *pUTF16, int cubDestSizeInBytes, EStringConvertErrorPolicy ePolicy); +int Q_UTF8ToUChar32(const char *pUTF8_, uchar32 &uValueOut, bool &bErrorOut); +qboolean Q_UnicodeValidate(const char *pUTF8); +NOXREF int Q_UnicodeLength(const char *pUTF8); +NOXREF char *Q_UnicodeAdvance(char *pUTF8, int nChars); +//bool Q_IsMeanSpaceW(uchar16 wch); +bool Q_IsDeprecatedW(uchar16 wch); +uchar16 *StripUnprintableWorker(uchar16 *pwch, bool *pbStrippedAny); +qboolean Q_StripUnprintableAndSpace(char *pch); +NOXREF qboolean V_UTF8ToUChar32(const char *pUTF8_, uchar32 *uValueOut); +NOXREF int Q_UnicodeRepair(char *pUTF8); #endif // UNICODE_STR_TOOLS_H diff --git a/regamedll/game_shared/GameEvent.h b/regamedll/game_shared/GameEvent.h index ee933357..6ba3ba9d 100644 --- a/regamedll/game_shared/GameEvent.h +++ b/regamedll/game_shared/GameEvent.h @@ -35,48 +35,54 @@ enum GameEventType { EVENT_INVALID = 0, - EVENT_WEAPON_FIRED, - EVENT_WEAPON_FIRED_ON_EMPTY, - EVENT_WEAPON_RELOADED, - EVENT_HE_GRENADE_EXPLODED, - EVENT_FLASHBANG_GRENADE_EXPLODED, - EVENT_SMOKE_GRENADE_EXPLODED, + EVENT_WEAPON_FIRED, // tell bots the player is attack (argumens: 1 = attacker, 2 = NULL) + EVENT_WEAPON_FIRED_ON_EMPTY, // tell bots the player is attack without clip ammo (argumens: 1 = attacker, 2 = NULL) + EVENT_WEAPON_RELOADED, // tell bots the player is reloading his weapon (argumens: 1 = reloader, 2 = NULL) + + EVENT_HE_GRENADE_EXPLODED, // tell bots the HE grenade is exploded (argumens: 1 = grenade thrower, 2 = NULL) + EVENT_FLASHBANG_GRENADE_EXPLODED, // tell bots the flashbang grenade is exploded (argumens: 1 = grenade thrower, 2 = explosion origin) + EVENT_SMOKE_GRENADE_EXPLODED, // tell bots the smoke grenade is exploded (argumens: 1 = grenade thrower, 2 = NULL) EVENT_GRENADE_BOUNCED, + EVENT_BEING_SHOT_AT, - EVENT_PLAYER_BLINDED_BY_FLASHBANG, - EVENT_PLAYER_FOOTSTEP, - EVENT_PLAYER_JUMPED, - EVENT_PLAYER_DIED, - EVENT_PLAYER_LANDED_FROM_HEIGHT, - EVENT_PLAYER_TOOK_DAMAGE, - EVENT_HOSTAGE_DAMAGED, - EVENT_HOSTAGE_KILLED, - EVENT_DOOR, - EVENT_BREAK_GLASS, - EVENT_BREAK_WOOD, - EVENT_BREAK_METAL, - EVENT_BREAK_FLESH, - EVENT_BREAK_CONCRETE, - EVENT_BOMB_PLANTED, - EVENT_BOMB_DROPPED, - EVENT_BOMB_PICKED_UP, - EVENT_BOMB_BEEP, - EVENT_BOMB_DEFUSING, - EVENT_BOMB_DEFUSE_ABORTED, - EVENT_BOMB_DEFUSED, - EVENT_BOMB_EXPLODED, - EVENT_HOSTAGE_USED, - EVENT_HOSTAGE_RESCUED, - EVENT_ALL_HOSTAGES_RESCUED, - EVENT_VIP_ESCAPED, - EVENT_VIP_ASSASSINATED, - EVENT_TERRORISTS_WIN, - EVENT_CTS_WIN, - EVENT_ROUND_DRAW, - EVENT_ROUND_WIN, - EVENT_ROUND_LOSS, - EVENT_ROUND_START, - EVENT_PLAYER_SPAWNED, + EVENT_PLAYER_BLINDED_BY_FLASHBANG, // tell bots the player is flashed (argumens: 1 = flashed player, 2 = NULL) + EVENT_PLAYER_FOOTSTEP, // tell bots the player is running (argumens: 1 = runner, 2 = NULL) + EVENT_PLAYER_JUMPED, // tell bots the player is jumped (argumens: 1 = jumper, 2 = NULL) + EVENT_PLAYER_DIED, // tell bots the player is killed (argumens: 1 = victim, 2 = killer) + EVENT_PLAYER_LANDED_FROM_HEIGHT, // tell bots the player is fell with some damage (argumens: 1 = felled player, 2 = NULL) + EVENT_PLAYER_TOOK_DAMAGE, // tell bots the player is take damage (argumens: 1 = victim, 2 = attacker) + EVENT_HOSTAGE_DAMAGED, // tell bots the player has injured a hostage (argumens: 1 = hostage, 2 = injurer) + EVENT_HOSTAGE_KILLED, // tell bots the player has killed a hostage (argumens: 1 = hostage, 2 = killer) + + EVENT_DOOR, // tell bots the door is moving (argumens: 1 = door, 2 = NULL) + EVENT_BREAK_GLASS, // tell bots the glass has break (argumens: 1 = glass, 2 = NULL) + EVENT_BREAK_WOOD, // tell bots the wood has break (argumens: 1 = wood, 2 = NULL) + EVENT_BREAK_METAL, // tell bots the metal/computer has break (argumens: 1 = metal/computer, 2 = NULL) + EVENT_BREAK_FLESH, // tell bots the flesh has break (argumens: 1 = flesh, 2 = NULL) + EVENT_BREAK_CONCRETE, // tell bots the concrete has break (argumens: 1 = concrete, 2 = NULL) + + EVENT_BOMB_PLANTED, // tell bots the bomb has been planted (argumens: 1 = planter, 2 = NULL) + EVENT_BOMB_DROPPED, // tell bots the bomb has been dropped (argumens: 1 = NULL, 2 = NULL) + EVENT_BOMB_PICKED_UP, // let the bots hear the bomb pickup (argumens: 1 = player that pickup c4, 2 = NULL) + EVENT_BOMB_BEEP, // let the bots hear the bomb beeping (argumens: 1 = c4, 2 = NULL) + EVENT_BOMB_DEFUSING, // tell the bots someone has started defusing (argumens: 1 = defuser, 2 = NULL) + EVENT_BOMB_DEFUSE_ABORTED, // tell the bots someone has aborted defusing (argumens: 1 = NULL, 2 = NULL) + EVENT_BOMB_DEFUSED, // tell the bots the bomb is defused (argumens: 1 = defuser, 2 = NULL) + EVENT_BOMB_EXPLODED, // let the bots hear the bomb exploding (argumens: 1 = NULL, 2 = NULL) + + EVENT_HOSTAGE_USED, // tell bots the hostage is used (argumens: 1 = user, 2 = NULL) + EVENT_HOSTAGE_RESCUED, // tell bots the hostage is rescued (argumens: 1 = rescuer (CBasePlayer *), 2 = hostage (CHostage *)) + EVENT_ALL_HOSTAGES_RESCUED, // tell bots the all hostages are rescued (argumens: 1 = NULL, 2 = NULL) + + EVENT_VIP_ESCAPED, // tell bots the VIP is escaped (argumens: 1 = NULL, 2 = NULL) + EVENT_VIP_ASSASSINATED, // tell bots the VIP is assassinated (argumens: 1 = NULL, 2 = NULL) + EVENT_TERRORISTS_WIN, // tell bots the terrorists won the round (argumens: 1 = NULL, 2 = NULL) + EVENT_CTS_WIN, // tell bots the CTs won the round (argumens: 1 = NULL, 2 = NULL) + EVENT_ROUND_DRAW, // tell bots the round was a draw (argumens: 1 = NULL, 2 = NULL) + EVENT_ROUND_WIN, // tell carreer the round was a win (argumens: 1 = NULL, 2 = NULL) + EVENT_ROUND_LOSS, // tell carreer the round was a loss (argumens: 1 = NULL, 2 = NULL) + EVENT_ROUND_START, // tell bots the round was started (when freeze period is expired) (argumens: 1 = NULL, 2 = NULL) + EVENT_PLAYER_SPAWNED, // tell bots the player is spawned (argumens: 1 = spawned player, 2 = NULL) EVENT_CLIENT_CORPSE_SPAWNED, EVENT_BUY_TIME_START, EVENT_PLAYER_LEFT_BUY_ZONE, @@ -98,6 +104,7 @@ enum GameEventType EVENT_TUTOR_NEED_TO_BUY_DEFUSE_KIT, EVENT_TUTOR_NEED_TO_BUY_GRENADE, EVENT_CAREER_TASK_DONE, + EVENT_START_RADIO_1, EVENT_RADIO_COVER_ME, EVENT_RADIO_YOU_TAKE_THE_POINT, @@ -123,12 +130,13 @@ enum GameEventType EVENT_RADIO_NEGATIVE, EVENT_RADIO_ENEMY_DOWN, EVENT_END_RADIO, - EVENT_NEW_MATCH, - EVENT_PLAYER_CHANGED_TEAM, - EVENT_BULLET_IMPACT, - EVENT_GAME_COMMENCE, - EVENT_WEAPON_ZOOMED, - EVENT_HOSTAGE_CALLED_FOR_HELP, + + EVENT_NEW_MATCH, // tell bots the game is new (argumens: 1 = NULL, 2 = NULL) + EVENT_PLAYER_CHANGED_TEAM, // tell bots the player is switch his team (also called from ClientPutInServer()) (argumens: 1 = switcher, 2 = NULL) + EVENT_BULLET_IMPACT, // tell bots the player is shoot at wall (argumens: 1 = shooter, 2 = shoot trace end position) + EVENT_GAME_COMMENCE, // tell bots the game is commencing (argumens: 1 = NULL, 2 = NULL) + EVENT_WEAPON_ZOOMED, // tell bots the player is switch weapon zoom (argumens: 1 = zoom switcher, 2 = NULL) + EVENT_HOSTAGE_CALLED_FOR_HELP, // tell bots the hostage is talking (argumens: 1 = listener, 2 = NULL) NUM_GAME_EVENTS, }; diff --git a/regamedll/game_shared/bot/bot.cpp b/regamedll/game_shared/bot/bot.cpp index 625f17f7..9ff6d645 100644 --- a/regamedll/game_shared/bot/bot.cpp +++ b/regamedll/game_shared/bot/bot.cpp @@ -228,7 +228,7 @@ void CBot::__MAKE_VHOOK(ExecuteCommand)(void) } /* <4900fa> ../game_shared/bot/bot.cpp:362 */ -NOXREF void CBot::ResetCommand(void) +void CBot::ResetCommand(void) { m_forwardSpeed = 0.0f; m_strafeSpeed = 0.0f; @@ -237,7 +237,7 @@ NOXREF void CBot::ResetCommand(void) } /* <49011b> ../game_shared/bot/bot.cpp:372 */ -NOXREF byte CBot::ThrottledMsec(void) const +byte CBot::ThrottledMsec(void) const { int iNewMsec; diff --git a/regamedll/game_shared/bot/bot.h b/regamedll/game_shared/bot/bot.h index 180581c1..f176a235 100644 --- a/regamedll/game_shared/bot/bot.h +++ b/regamedll/game_shared/bot/bot.h @@ -282,8 +282,8 @@ protected: const BotProfile *m_profile; private: - NOXREF void ResetCommand(void); - NOXREF byte ThrottledMsec(void) const; + void ResetCommand(void); + byte ThrottledMsec(void) const; // returns current movement speed (for walk/run) float GetMoveSpeed(void); diff --git a/regamedll/game_shared/bot/bot_manager.h b/regamedll/game_shared/bot/bot_manager.h index e594e78d..bde086d3 100644 --- a/regamedll/game_shared/bot/bot_manager.h +++ b/regamedll/game_shared/bot/bot_manager.h @@ -24,19 +24,19 @@ * you do not wish to do so, delete this exception statement from your * version. * -*/ - +*/ + #ifndef BOT_MANAGER_H #define BOT_MANAGER_H #ifdef _WIN32 #pragma once -#endif +#endif -// STL uses exceptions, but we are not compiling with them - ignore warning -#pragma warning(disable : 4530) - -#include -#include "game_shared/GameEvent.h" +// STL uses exceptions, but we are not compiling with them - ignore warning +#pragma warning(disable : 4530) + +#include +#include "game_shared/GameEvent.h" #ifndef _WIN32 @@ -49,105 +49,105 @@ //#endif // min #endif // _WIN32 - -class CNavArea; -class CGrenade; - -class ActiveGrenade -{ -public: - ActiveGrenade(int weaponID, CGrenade *grenadeEntity); - - void OnEntityGone(void); - bool IsValid(void) const; - NOXREF bool IsEntity(CGrenade *grenade) const - { - return (grenade == m_entity) ? true : false; - } - int GetID(void) const - { - return m_id; - } - const Vector *GetDetonationPosition(void) const - { - return &m_detonationPosition; - } - NOXREF const Vector *GetPosition(void) const; - -private: - int m_id; - CGrenade *m_entity; - Vector m_detonationPosition; - float m_dieTimestamp; - -};/* size: 24, cachelines: 1, members: 4 */ - -typedef std::list ActiveGrenadeList; - -class CBotManager -{ -public: - CBotManager(void); - - virtual void ClientDisconnect(CBasePlayer *pPlayer) = 0; - virtual BOOL ClientCommand(CBasePlayer *pPlayer, const char *pcmd) = 0; - - virtual void ServerActivate(void) = 0; - virtual void ServerDeactivate(void) = 0; - - virtual void ServerCommand(const char *pcmd) = 0; - virtual void AddServerCommand(const char *cmd) = 0; - virtual void AddServerCommands(void) = 0; - - virtual void RestartRound(void); - virtual void StartFrame(void); - - // Invoked when event occurs in the game (some events have NULL entity). - // Events are propogated to all bots. - virtual void OnEvent(GameEventType event, CBaseEntity *entity = NULL, CBaseEntity *other = NULL); - - // return priority of player (0 = max pri) - virtual unsigned int GetPlayerPriority(CBasePlayer *player) const = 0; - - // return the filename for this map's "nav" file - const char *GetNavMapFilename(void) const; - - // add an active grenade to the bot's awareness - void AddGrenade(int type, CGrenade *grenade); - - // the grenade entity in the world is going away - void RemoveGrenade(CGrenade *grenade); - - // destroy any invalid active grenades - NOXREF void ValidateActiveGrenades(void); - void DestroyAllGrenades(void); - - // return true if line intersects smoke volume - bool IsLineBlockedBySmoke(const Vector *from, const Vector *to); - - // return true if position is inside a smoke cloud - bool IsInsideSmokeCloud(const Vector *pos); - -#ifdef HOOK_GAMEDLL - - void RestartRound_(void); - void StartFrame_(void); - void OnEvent_(GameEventType event, CBaseEntity *entity = NULL, CBaseEntity *other = NULL); - -#endif // HOOK_GAMEDLL - -private: - -#if defined(_WIN32) && defined(HOOK_GAMEDLL) - // The member m_activeGrenadeList on Windows must be with offset +8 - // on Linux : +4 - - int unknown_padding; -#endif // HOOK_GAMEDLL - - // the list of active grenades the bots are aware of - ActiveGrenadeList m_activeGrenadeList; -// -};/* size: 12, cachelines: 1, members: 2 */ - -#endif // BOT_MANAGER_H + +class CNavArea; +class CGrenade; + +class ActiveGrenade +{ +public: + ActiveGrenade(int weaponID, CGrenade *grenadeEntity); + + void OnEntityGone(void); + bool IsValid(void) const; + NOXREF bool IsEntity(CGrenade *grenade) const + { + return (grenade == m_entity) ? true : false; + } + int GetID(void) const + { + return m_id; + } + const Vector *GetDetonationPosition(void) const + { + return &m_detonationPosition; + } + NOXREF const Vector *GetPosition(void) const; + +private: + int m_id; + CGrenade *m_entity; + Vector m_detonationPosition; + float m_dieTimestamp; + +};/* size: 24, cachelines: 1, members: 4 */ + +typedef std::list ActiveGrenadeList; + +class CBotManager +{ +public: + CBotManager(void); + + virtual void ClientDisconnect(CBasePlayer *pPlayer) = 0; + virtual BOOL ClientCommand(CBasePlayer *pPlayer, const char *pcmd) = 0; + + virtual void ServerActivate(void) = 0; + virtual void ServerDeactivate(void) = 0; + + virtual void ServerCommand(const char *pcmd) = 0; + virtual void AddServerCommand(const char *cmd) = 0; + virtual void AddServerCommands(void) = 0; + + virtual void RestartRound(void); + virtual void StartFrame(void); + + // Invoked when event occurs in the game (some events have NULL entity). + // Events are propogated to all bots. + virtual void OnEvent(GameEventType event, CBaseEntity *entity = NULL, CBaseEntity *other = NULL); + + // return priority of player (0 = max pri) + virtual unsigned int GetPlayerPriority(CBasePlayer *player) const = 0; + + // return the filename for this map's "nav" file + const char *GetNavMapFilename(void) const; + + // add an active grenade to the bot's awareness + void AddGrenade(int type, CGrenade *grenade); + + // the grenade entity in the world is going away + void RemoveGrenade(CGrenade *grenade); + + // destroy any invalid active grenades + NOXREF void ValidateActiveGrenades(void); + void DestroyAllGrenades(void); + + // return true if line intersects smoke volume + bool IsLineBlockedBySmoke(const Vector *from, const Vector *to); + + // return true if position is inside a smoke cloud + bool IsInsideSmokeCloud(const Vector *pos); + +#ifdef HOOK_GAMEDLL + + void RestartRound_(void); + void StartFrame_(void); + void OnEvent_(GameEventType event, CBaseEntity *entity = NULL, CBaseEntity *other = NULL); + +#endif // HOOK_GAMEDLL + +private: + +#if defined(_WIN32) && defined(HOOK_GAMEDLL) + // The member m_activeGrenadeList on Windows must be with offset +8 + // on Linux : +4 + + int unknown_padding; +#endif // HOOK_GAMEDLL + + // the list of active grenades the bots are aware of + ActiveGrenadeList m_activeGrenadeList; +// +};/* size: 12, cachelines: 1, members: 2 */ + +#endif // BOT_MANAGER_H diff --git a/regamedll/game_shared/bot/bot_profile.h b/regamedll/game_shared/bot/bot_profile.h index 5a10e51c..9d1192c1 100644 --- a/regamedll/game_shared/bot/bot_profile.h +++ b/regamedll/game_shared/bot/bot_profile.h @@ -1,289 +1,289 @@ -/* -* -* This program is free software; you can redistribute it and/or modify it -* under the terms of the GNU General Public License as published by the -* Free Software Foundation; either version 2 of the License, or (at -* your option) any later version. -* -* This program is distributed in the hope that it will be useful, but -* WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -* General Public License for more details. -* -* You should have received a copy of the GNU General Public License -* along with this program; if not, write to the Free Software Foundation, -* Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -* -* In addition, as a special exception, the author gives permission to -* link the code of this program with the Half-Life Game Engine ("HL -* Engine") and Modified Game Libraries ("MODs") developed by Valve, -* L.L.C ("Valve"). You must obey the GNU General Public License in all -* respects for all of the code used other than the HL Engine and MODs -* from Valve. If you modify this file, you may extend this exception -* to your version of the file, but you are not obligated to do so. If -* you do not wish to do so, delete this exception statement from your -* version. -* -*/ - -#ifndef BOT_PROFILE -#define BOT_PROFILE -#ifdef _WIN32 -#pragma once -#endif - -// long STL names get truncated in browse info. -#pragma warning(disable : 4786) - -#ifndef _WIN32 -#include -#include -#endif // _WIN32 - -#undef min -#undef max - -#include -#include - -#include "bot_constants.h" - -enum -{ - FirstCustomSkin = 100, - NumCustomSkins = 100, - LastCustomSkin = FirstCustomSkin + NumCustomSkins - 1, -}; - -enum BotProfileTeamType -{ - BOT_TEAM_T, - BOT_TEAM_CT, - BOT_TEAM_ANY -}; - -/* <4a79de> ../game_shared/bot/bot_profile.h:46 */ -class BotProfile -{ -public: - BotProfile(void) - { - m_name = NULL; - m_aggression = 0.0f; - m_skill = 0.0f; - m_teamwork = 0.0f; - m_weaponPreferenceCount = 0; - m_cost = 0; - m_skin = 0; - m_difficultyFlags = 0; - m_voicePitch = 100; - m_reactionTime = 0.3f; - m_attackDelay = 0.0f; - m_teams = BOT_TEAM_ANY; - m_voiceBank = 0; - m_prefersSilencer = false; - } - - const char *GetName(void) const - { - return m_name; - } - float GetAggression(void) const - { - return m_aggression; - } - float GetSkill(void) const - { - return m_skill; - } - float GetTeamwork(void) const - { - return m_teamwork; - } - int GetWeaponPreference(int i) - { - return m_weaponPreference[i]; - } - NOBODY const char *GetWeaponPreferenceAsString(int i) const; - int GetWeaponPreferenceCount(void) const - { - return m_weaponPreferenceCount; - } - - NOBODY bool HasPrimaryPreference(void) const; - NOBODY bool HasPistolPreference(void) const; - - int GetCost(void) const - { - return m_cost; - } - int GetSkin(void) const - { - return m_skin; - } - NOBODY bool IsDifficulty(BotDifficultyType diff) const; - int GetVoicePitch(void) const - { - return m_voicePitch; - } - float GetReactionTime(void) const - { - return m_reactionTime; - } - float GetAttackDelay(void) const - { - return m_attackDelay; - } - int GetVoiceBank(void) const - { - return m_voiceBank; - } - bool IsValidForTeam(BotProfileTeamType team) const; - bool PrefersSilencer(void) const - { - return m_prefersSilencer; - } - // TODO: it func private - NOBODY void Inherit(const BotProfile *parent, const BotProfile *baseline); - -private: - - friend class BotProfileManager; - - char *m_name; - float m_aggression; - float m_skill; - float m_teamwork; - - enum { MAX_WEAPON_PREFS = 16 }; - - int m_weaponPreference[MAX_WEAPON_PREFS]; - int m_weaponPreferenceCount; - - int m_cost; - int m_skin; - - unsigned char m_difficultyFlags; - int m_voicePitch; - float m_reactionTime; - float m_attackDelay; - enum BotProfileTeamType m_teams; - bool m_prefersSilencer; - int m_voiceBank; - -}; /* size: 120, cachelines: 2, members: 15 */ - -/* <4a666f> ../game_shared/bot/bot_profile.h:115 */ -inline bool BotProfile::IsDifficulty(BotDifficultyType diff) const -{ - return (m_difficultyFlags & (1 << diff)) ? true : false; -} - -/* <4a7a20> ../game_shared/bot/bot_profile.h:123 */ -inline void BotProfile::Inherit(const BotProfile *parent, const BotProfile *baseline) -{ - if (parent->m_aggression != baseline->m_aggression) - m_aggression = parent->m_aggression; - - if (parent->m_skill != baseline->m_skill) - m_skill = parent->m_skill; - - if (parent->m_teamwork != baseline->m_teamwork) - m_teamwork = parent->m_teamwork; - - if (parent->m_weaponPreferenceCount != baseline->m_weaponPreferenceCount) - { - m_weaponPreferenceCount = parent->m_weaponPreferenceCount; - for (int i = 0; im_weaponPreferenceCount; i++) - m_weaponPreference[i] = parent->m_weaponPreference[i]; - } - - if (parent->m_cost != baseline->m_cost) - m_cost = parent->m_cost; - - if (parent->m_skin != baseline->m_skin) - m_skin = parent->m_skin; - - if (parent->m_difficultyFlags != baseline->m_difficultyFlags) - m_difficultyFlags = parent->m_difficultyFlags; - - if (parent->m_voicePitch != baseline->m_voicePitch) - m_voicePitch = parent->m_voicePitch; - - if (parent->m_reactionTime != baseline->m_reactionTime) - m_reactionTime = parent->m_reactionTime; - - if (parent->m_attackDelay != baseline->m_attackDelay) - m_attackDelay = parent->m_attackDelay; - - if (parent->m_teams != baseline->m_teams) - m_teams = parent->m_teams; - - if (parent->m_voiceBank != baseline->m_voiceBank) - m_voiceBank = parent->m_voiceBank; -} - -typedef std::list BotProfileList; - -/* <36a051> ../game_shared/bot/bot_profile.h:180 */ -class BotProfileManager -{ -public: - BotProfileManager(void); - ~BotProfileManager(void); - - void Init(const char *filename, unsigned int *checksum = NULL); - void Reset(void); - - const BotProfile *GetProfile(const char *name, BotProfileTeamType team) const - { - for (BotProfileList::const_iterator iter = m_profileList.begin(); iter != m_profileList.end(); ++iter) - if (!Q_stricmp(name, (*iter)->GetName()) && (*iter)->IsValidForTeam(team)) - return *iter; - - return NULL; - } - const BotProfileList *GetProfileList(void) const - { - return &m_profileList; - } - const BotProfile *GetRandomProfile(BotDifficultyType difficulty, BotProfileTeamType team) const; - - const char *GetCustomSkin(int index); - const char *GetCustomSkinModelname(int index); - const char *GetCustomSkinFname(int index); - int GetCustomSkinIndex(const char *name, const char *filename = NULL); - - typedef std::vector VoiceBankList; - - const VoiceBankList *GetVoiceBanks() const - { - return &m_voiceBanks; - } - int FindVoiceBankIndex(const char *filename); - -protected: +/* +* +* This program is free software; you can redistribute it and/or modify it +* under the terms of the GNU General Public License as published by the +* Free Software Foundation; either version 2 of the License, or (at +* your option) any later version. +* +* This program is distributed in the hope that it will be useful, but +* WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +* General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with this program; if not, write to the Free Software Foundation, +* Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +* +* In addition, as a special exception, the author gives permission to +* link the code of this program with the Half-Life Game Engine ("HL +* Engine") and Modified Game Libraries ("MODs") developed by Valve, +* L.L.C ("Valve"). You must obey the GNU General Public License in all +* respects for all of the code used other than the HL Engine and MODs +* from Valve. If you modify this file, you may extend this exception +* to your version of the file, but you are not obligated to do so. If +* you do not wish to do so, delete this exception statement from your +* version. +* +*/ + +#ifndef BOT_PROFILE +#define BOT_PROFILE +#ifdef _WIN32 +#pragma once +#endif + +// long STL names get truncated in browse info. +#pragma warning(disable : 4786) + +#ifndef _WIN32 +#include +#include +#endif // _WIN32 + +#undef min +#undef max + +#include +#include + +#include "bot_constants.h" + +enum +{ + FirstCustomSkin = 100, + NumCustomSkins = 100, + LastCustomSkin = FirstCustomSkin + NumCustomSkins - 1, +}; + +enum BotProfileTeamType +{ + BOT_TEAM_T, + BOT_TEAM_CT, + BOT_TEAM_ANY +}; + +/* <4a79de> ../game_shared/bot/bot_profile.h:46 */ +class BotProfile +{ +public: + BotProfile(void) + { + m_name = NULL; + m_aggression = 0.0f; + m_skill = 0.0f; + m_teamwork = 0.0f; + m_weaponPreferenceCount = 0; + m_cost = 0; + m_skin = 0; + m_difficultyFlags = 0; + m_voicePitch = 100; + m_reactionTime = 0.3f; + m_attackDelay = 0.0f; + m_teams = BOT_TEAM_ANY; + m_voiceBank = 0; + m_prefersSilencer = false; + } + + const char *GetName(void) const + { + return m_name; + } + float GetAggression(void) const + { + return m_aggression; + } + float GetSkill(void) const + { + return m_skill; + } + float GetTeamwork(void) const + { + return m_teamwork; + } + int GetWeaponPreference(int i) + { + return m_weaponPreference[i]; + } + NOBODY const char *GetWeaponPreferenceAsString(int i) const; + int GetWeaponPreferenceCount(void) const + { + return m_weaponPreferenceCount; + } + + NOBODY bool HasPrimaryPreference(void) const; + NOBODY bool HasPistolPreference(void) const; + + int GetCost(void) const + { + return m_cost; + } + int GetSkin(void) const + { + return m_skin; + } + NOBODY bool IsDifficulty(BotDifficultyType diff) const; + int GetVoicePitch(void) const + { + return m_voicePitch; + } + float GetReactionTime(void) const + { + return m_reactionTime; + } + float GetAttackDelay(void) const + { + return m_attackDelay; + } + int GetVoiceBank(void) const + { + return m_voiceBank; + } + bool IsValidForTeam(BotProfileTeamType team) const; + bool PrefersSilencer(void) const + { + return m_prefersSilencer; + } + // TODO: it func private + NOBODY void Inherit(const BotProfile *parent, const BotProfile *baseline); + +private: + + friend class BotProfileManager; + + char *m_name; + float m_aggression; + float m_skill; + float m_teamwork; + + enum { MAX_WEAPON_PREFS = 16 }; + + int m_weaponPreference[MAX_WEAPON_PREFS]; + int m_weaponPreferenceCount; + + int m_cost; + int m_skin; + + unsigned char m_difficultyFlags; + int m_voicePitch; + float m_reactionTime; + float m_attackDelay; + enum BotProfileTeamType m_teams; + bool m_prefersSilencer; + int m_voiceBank; + +}; /* size: 120, cachelines: 2, members: 15 */ + +/* <4a666f> ../game_shared/bot/bot_profile.h:115 */ +inline bool BotProfile::IsDifficulty(BotDifficultyType diff) const +{ + return (m_difficultyFlags & (1 << diff)) ? true : false; +} + +/* <4a7a20> ../game_shared/bot/bot_profile.h:123 */ +inline void BotProfile::Inherit(const BotProfile *parent, const BotProfile *baseline) +{ + if (parent->m_aggression != baseline->m_aggression) + m_aggression = parent->m_aggression; + + if (parent->m_skill != baseline->m_skill) + m_skill = parent->m_skill; + + if (parent->m_teamwork != baseline->m_teamwork) + m_teamwork = parent->m_teamwork; + + if (parent->m_weaponPreferenceCount != baseline->m_weaponPreferenceCount) + { + m_weaponPreferenceCount = parent->m_weaponPreferenceCount; + for (int i = 0; im_weaponPreferenceCount; i++) + m_weaponPreference[i] = parent->m_weaponPreference[i]; + } + + if (parent->m_cost != baseline->m_cost) + m_cost = parent->m_cost; + + if (parent->m_skin != baseline->m_skin) + m_skin = parent->m_skin; + + if (parent->m_difficultyFlags != baseline->m_difficultyFlags) + m_difficultyFlags = parent->m_difficultyFlags; + + if (parent->m_voicePitch != baseline->m_voicePitch) + m_voicePitch = parent->m_voicePitch; + + if (parent->m_reactionTime != baseline->m_reactionTime) + m_reactionTime = parent->m_reactionTime; + + if (parent->m_attackDelay != baseline->m_attackDelay) + m_attackDelay = parent->m_attackDelay; + + if (parent->m_teams != baseline->m_teams) + m_teams = parent->m_teams; + + if (parent->m_voiceBank != baseline->m_voiceBank) + m_voiceBank = parent->m_voiceBank; +} + +typedef std::list BotProfileList; + +/* <36a051> ../game_shared/bot/bot_profile.h:180 */ +class BotProfileManager +{ +public: + BotProfileManager(void); + ~BotProfileManager(void); + + void Init(const char *filename, unsigned int *checksum = NULL); + void Reset(void); + + const BotProfile *GetProfile(const char *name, BotProfileTeamType team) const + { + for (BotProfileList::const_iterator iter = m_profileList.begin(); iter != m_profileList.end(); ++iter) + if (!Q_stricmp(name, (*iter)->GetName()) && (*iter)->IsValidForTeam(team)) + return *iter; + + return NULL; + } + const BotProfileList *GetProfileList(void) const + { + return &m_profileList; + } + const BotProfile *GetRandomProfile(BotDifficultyType difficulty, BotProfileTeamType team) const; + + const char *GetCustomSkin(int index); + const char *GetCustomSkinModelname(int index); + const char *GetCustomSkinFname(int index); + int GetCustomSkinIndex(const char *name, const char *filename = NULL); + + typedef std::vector VoiceBankList; + + const VoiceBankList *GetVoiceBanks() const + { + return &m_voiceBanks; + } + int FindVoiceBankIndex(const char *filename); + +protected: #if defined(_WIN32) && defined(HOOK_GAMEDLL) int unknown_padding1; #endif // HOOK_GAMEDLL - - BotProfileList m_profileList; - VoiceBankList m_voiceBanks; - - char *m_skins[NumCustomSkins]; - char *m_skinModelnames[NumCustomSkins]; - char *m_skinFilenames[NumCustomSkins]; - int m_nextSkin; - -};/* size: 1224, cachelines: 20, members: 6 */ - -#ifdef HOOK_GAMEDLL - -#define TheBotProfiles (*pTheBotProfiles) - -#endif // HOOK_GAMEDLL - -extern BotProfileManager *TheBotProfiles; - -#endif // BOT_PROFILE + + BotProfileList m_profileList; + VoiceBankList m_voiceBanks; + + char *m_skins[NumCustomSkins]; + char *m_skinModelnames[NumCustomSkins]; + char *m_skinFilenames[NumCustomSkins]; + int m_nextSkin; + +};/* size: 1224, cachelines: 20, members: 6 */ + +#ifdef HOOK_GAMEDLL + +#define TheBotProfiles (*pTheBotProfiles) + +#endif // HOOK_GAMEDLL + +extern BotProfileManager *TheBotProfiles; + +#endif // BOT_PROFILE diff --git a/regamedll/game_shared/bot/bot_util.cpp b/regamedll/game_shared/bot/bot_util.cpp index 8973d4ed..df1e0559 100644 --- a/regamedll/game_shared/bot/bot_util.cpp +++ b/regamedll/game_shared/bot/bot_util.cpp @@ -332,7 +332,7 @@ NOBODY bool UTIL_IsTeamAllBots(int team) NOBODY /*extern*/ CBasePlayer *UTIL_GetClosestPlayer(const Vector *pos, int team, float *distance) { CBasePlayer *closePlayer = NULL; - float closeDistSq = 999999999999.9f; + float closeDistSq = 1.0e12f; // 999999999999.9f for (int i = 1; i <= gpGlobals->maxClients; i++) { diff --git a/regamedll/game_shared/bot/bot_util.h b/regamedll/game_shared/bot/bot_util.h index 235c97dc..b906ba13 100644 --- a/regamedll/game_shared/bot/bot_util.h +++ b/regamedll/game_shared/bot/bot_util.h @@ -211,9 +211,7 @@ inline bool IsIntersecting2D(const Vector &startA, const Vector &endA, const Vec // If functor returns false, stop iteration and return false. /* <4700e1> ../game_shared/bot/bot_util.h:294 */ -template < - typename Functor -> +template bool ForEachPlayer(Functor &func) { for (int i = 1; i <= gpGlobals->maxClients; i++) @@ -228,6 +226,7 @@ bool ForEachPlayer(Functor &func) if (func(player) == false) return false; } + return true; } diff --git a/regamedll/game_shared/bot/improv.h b/regamedll/game_shared/bot/improv.h index faf1d90f..de9cb3c8 100644 --- a/regamedll/game_shared/bot/improv.h +++ b/regamedll/game_shared/bot/improv.h @@ -24,119 +24,119 @@ * you do not wish to do so, delete this exception statement from your * version. * -*/ - -#ifndef IMPROV_H +*/ + +#ifndef IMPROV_H #define IMPROV_H #ifdef _WIN32 #pragma once -#endif - -class CBaseEntity; -class CNavLadder; - -// Improv-specific events - -/* <46f4d9> ../game_shared/bot/improv.h:17 */ -class IImprovEvent -{ -public: - virtual void OnMoveToSuccess(const Vector &goal) {}; // invoked when an improv reaches its MoveTo goal - - enum MoveToFailureType - { - FAIL_INVALID_PATH = 0, - FAIL_STUCK, - FAIL_FELL_OFF, - }; - - virtual void OnMoveToFailure(const Vector &goal, MoveToFailureType reason) {}; // invoked when an improv fails to reach a MoveTo goal - virtual void OnInjury(float amount) {}; // invoked when the improv is injured - -};/* size: 4, cachelines: 1, members: 1 */ - -// The Improv interface definition -// An "Improv" is an improvisational actor that simulates the -// behavor of a human in an unscripted, "make it up as you go" manner. - -class CImprov: public IImprovEvent -{ -public: - virtual ~CImprov(void) {}; - - virtual bool IsAlive(void) const = 0; // return true if this improv is alive - - virtual void MoveTo(const Vector &goal) = 0; // move improv towards far-away goal (pathfind) - virtual void LookAt(const Vector &target) = 0; // define desired view target - virtual void ClearLookAt(void) = 0; // remove view goal - virtual void FaceTo(const Vector &goal) = 0; // orient body towards goal - virtual void ClearFaceTo(void) = 0; // remove body orientation goal - - virtual bool IsAtMoveGoal(float error = 20.0f) const = 0; // return true if improv is standing on its movement goal - virtual bool HasLookAt(void) const = 0; // return true if improv has a look at goal - virtual bool HasFaceTo(void) const = 0; // return true if improv has a face to goal - virtual bool IsAtFaceGoal(void) const = 0; // return true if improv is facing towards its face goal - virtual bool IsFriendInTheWay(const Vector &goalPos) const = 0; // return true if a friend is blocking our line to the given goal position - virtual bool IsFriendInTheWay(CBaseEntity *myFriend, const Vector &goalPos) const = 0; // return true if the given friend is blocking our line to the given goal position - - virtual void MoveForward(void) = 0; - virtual void MoveBackward(void) = 0; - virtual void StrafeLeft(void) = 0; - virtual void StrafeRight(void) = 0; - virtual bool Jump(void) = 0; - virtual void Crouch(void) = 0; - virtual void StandUp(void) = 0; // "un-crouch" - - virtual void TrackPath(const Vector &pathGoal, float deltaT) = 0; // move along path by following "pathGoal" - virtual void StartLadder(const CNavLadder *ladder, enum NavTraverseType how, const Vector *approachPos, const Vector *departPos) = 0; // invoked when a ladder is encountered while following a path - - virtual bool TraverseLadder(const CNavLadder *ladder, enum NavTraverseType how, const Vector *approachPos, const Vector *departPos, float deltaT) = 0; // traverse given ladder - virtual bool GetSimpleGroundHeightWithFloor(const Vector *pos, float *height, Vector *normal = NULL) = 0; // find "simple" ground height, treating current nav area as part of the floor - - virtual void Run(void) = 0; - virtual void Walk(void) = 0; - virtual void Stop(void) = 0; - - virtual float GetMoveAngle(void) const = 0; // return direction of movement - virtual float GetFaceAngle(void) const = 0; // return direction of view - - virtual const Vector &GetFeet(void) const = 0; // return position of "feet" - point below centroid of improv at feet level - virtual const Vector &GetCentroid(void) const = 0; - virtual const Vector &GetEyes(void) const = 0; - - virtual bool IsRunning(void) const = 0; - virtual bool IsWalking(void) const = 0; - virtual bool IsStopped(void) const = 0; - - virtual bool IsCrouching(void) const = 0; - virtual bool IsJumping(void) const = 0; - virtual bool IsUsingLadder(void) const = 0; - virtual bool IsOnGround(void) const = 0; - virtual bool IsMoving(void) const = 0; // if true, improv is walking, crawling, running somewhere - - virtual bool CanRun(void) const = 0; - virtual bool CanCrouch(void) const = 0; - virtual bool CanJump(void) const = 0; - virtual bool IsVisible(const Vector &pos, bool testFOV = false) const = 0; // return true if improv can see position - virtual bool IsPlayerLookingAtMe(CBasePlayer *other, float cosTolerance = 0.95f) const = 0; // return true if 'other' is looking right at me - virtual CBasePlayer *IsAnyPlayerLookingAtMe(int team = 0, float cosTolerance = 0.95f) const = 0; // return player on given team that is looking right at me (team == 0 means any team), NULL otherwise - - virtual CBasePlayer *GetClosestPlayerByTravelDistance(int team = 0, float *range = NULL) const = 0; // return actual travel distance to closest player on given team (team == 0 means any team) - virtual CNavArea *GetLastKnownArea(void) const = 0; - - virtual void OnUpdate(float deltaT) = 0; // a less frequent, full update 'tick' - virtual void OnUpkeep(float deltaT) = 0; // a frequent, lightweight update 'tick' - virtual void OnReset(void) = 0; // reset improv to initial state - virtual void OnGameEvent(GameEventType event, CBaseEntity *entity, CBaseEntity *other) = 0; // invoked when an event occurs in the game - virtual void OnTouch(CBaseEntity *other) = 0; // "other" has touched us - -};/* size: 4, cachelines: 1, members: 1 */ - -#ifdef HOOK_GAMEDLL - +#endif + +class CBaseEntity; +class CNavLadder; + +// Improv-specific events + +/* <46f4d9> ../game_shared/bot/improv.h:17 */ +class IImprovEvent +{ +public: + virtual void OnMoveToSuccess(const Vector &goal) {}; // invoked when an improv reaches its MoveTo goal + + enum MoveToFailureType + { + FAIL_INVALID_PATH = 0, + FAIL_STUCK, + FAIL_FELL_OFF, + }; + + virtual void OnMoveToFailure(const Vector &goal, MoveToFailureType reason) {}; // invoked when an improv fails to reach a MoveTo goal + virtual void OnInjury(float amount) {}; // invoked when the improv is injured + +};/* size: 4, cachelines: 1, members: 1 */ + +// The Improv interface definition +// An "Improv" is an improvisational actor that simulates the +// behavor of a human in an unscripted, "make it up as you go" manner. + +class CImprov: public IImprovEvent +{ +public: + virtual ~CImprov(void) {}; + + virtual bool IsAlive(void) const = 0; // return true if this improv is alive + + virtual void MoveTo(const Vector &goal) = 0; // move improv towards far-away goal (pathfind) + virtual void LookAt(const Vector &target) = 0; // define desired view target + virtual void ClearLookAt(void) = 0; // remove view goal + virtual void FaceTo(const Vector &goal) = 0; // orient body towards goal + virtual void ClearFaceTo(void) = 0; // remove body orientation goal + + virtual bool IsAtMoveGoal(float error = 20.0f) const = 0; // return true if improv is standing on its movement goal + virtual bool HasLookAt(void) const = 0; // return true if improv has a look at goal + virtual bool HasFaceTo(void) const = 0; // return true if improv has a face to goal + virtual bool IsAtFaceGoal(void) const = 0; // return true if improv is facing towards its face goal + virtual bool IsFriendInTheWay(const Vector &goalPos) const = 0; // return true if a friend is blocking our line to the given goal position + virtual bool IsFriendInTheWay(CBaseEntity *myFriend, const Vector &goalPos) const = 0; // return true if the given friend is blocking our line to the given goal position + + virtual void MoveForward(void) = 0; + virtual void MoveBackward(void) = 0; + virtual void StrafeLeft(void) = 0; + virtual void StrafeRight(void) = 0; + virtual bool Jump(void) = 0; + virtual void Crouch(void) = 0; + virtual void StandUp(void) = 0; // "un-crouch" + + virtual void TrackPath(const Vector &pathGoal, float deltaT) = 0; // move along path by following "pathGoal" + virtual void StartLadder(const CNavLadder *ladder, enum NavTraverseType how, const Vector *approachPos, const Vector *departPos) = 0; // invoked when a ladder is encountered while following a path + + virtual bool TraverseLadder(const CNavLadder *ladder, enum NavTraverseType how, const Vector *approachPos, const Vector *departPos, float deltaT) = 0; // traverse given ladder + virtual bool GetSimpleGroundHeightWithFloor(const Vector *pos, float *height, Vector *normal = NULL) = 0; // find "simple" ground height, treating current nav area as part of the floor + + virtual void Run(void) = 0; + virtual void Walk(void) = 0; + virtual void Stop(void) = 0; + + virtual float GetMoveAngle(void) const = 0; // return direction of movement + virtual float GetFaceAngle(void) const = 0; // return direction of view + + virtual const Vector &GetFeet(void) const = 0; // return position of "feet" - point below centroid of improv at feet level + virtual const Vector &GetCentroid(void) const = 0; + virtual const Vector &GetEyes(void) const = 0; + + virtual bool IsRunning(void) const = 0; + virtual bool IsWalking(void) const = 0; + virtual bool IsStopped(void) const = 0; + + virtual bool IsCrouching(void) const = 0; + virtual bool IsJumping(void) const = 0; + virtual bool IsUsingLadder(void) const = 0; + virtual bool IsOnGround(void) const = 0; + virtual bool IsMoving(void) const = 0; // if true, improv is walking, crawling, running somewhere + + virtual bool CanRun(void) const = 0; + virtual bool CanCrouch(void) const = 0; + virtual bool CanJump(void) const = 0; + virtual bool IsVisible(const Vector &pos, bool testFOV = false) const = 0; // return true if improv can see position + virtual bool IsPlayerLookingAtMe(CBasePlayer *other, float cosTolerance = 0.95f) const = 0; // return true if 'other' is looking right at me + virtual CBasePlayer *IsAnyPlayerLookingAtMe(int team = 0, float cosTolerance = 0.95f) const = 0; // return player on given team that is looking right at me (team == 0 means any team), NULL otherwise + + virtual CBasePlayer *GetClosestPlayerByTravelDistance(int team = 0, float *range = NULL) const = 0; // return actual travel distance to closest player on given team (team == 0 means any team) + virtual CNavArea *GetLastKnownArea(void) const = 0; + + virtual void OnUpdate(float deltaT) = 0; // a less frequent, full update 'tick' + virtual void OnUpkeep(float deltaT) = 0; // a frequent, lightweight update 'tick' + virtual void OnReset(void) = 0; // reset improv to initial state + virtual void OnGameEvent(GameEventType event, CBaseEntity *entity, CBaseEntity *other) = 0; // invoked when an event occurs in the game + virtual void OnTouch(CBaseEntity *other) = 0; // "other" has touched us + +};/* size: 4, cachelines: 1, members: 1 */ + +#ifdef HOOK_GAMEDLL + typedef bool (CImprov::*IS_FRIEND_INT_THEWAY_VECTOR)(const Vector &goalPos) const; -typedef bool (CImprov::*IS_FRIEND_INT_THEWAY_CBASEENTITY)(CBaseEntity *myFriend, const Vector &goalPos) const; - -#endif // HOOK_GAMEDLL - -#endif // IMPROV_H +typedef bool (CImprov::*IS_FRIEND_INT_THEWAY_CBASEENTITY)(CBaseEntity *myFriend, const Vector &goalPos) const; + +#endif // HOOK_GAMEDLL + +#endif // IMPROV_H diff --git a/regamedll/game_shared/bot/nav_area.cpp b/regamedll/game_shared/bot/nav_area.cpp index cbd69a2a..4d4b7f63 100644 --- a/regamedll/game_shared/bot/nav_area.cpp +++ b/regamedll/game_shared/bot/nav_area.cpp @@ -62,18 +62,18 @@ FILE_GLOBAL int BlockedIDCount = 0; #else // HOOK_GAMEDLL -unsigned int IMPLEMENT_ARRAY_CLASS(CNavArea, m_nextID); -unsigned int IMPLEMENT_ARRAY_CLASS(CNavArea, m_masterMarker); +unsigned int IMPL_CLASS(CNavArea, m_nextID); +unsigned int IMPL_CLASS(CNavArea, m_masterMarker); -unsigned int IMPLEMENT_ARRAY_CLASS(HidingSpot, m_nextID); -unsigned int IMPLEMENT_ARRAY_CLASS(HidingSpot, m_masterMarker); +unsigned int IMPL_CLASS(HidingSpot, m_nextID); +unsigned int IMPL_CLASS(HidingSpot, m_masterMarker); NavLadderList TheNavLadderList; HidingSpotList TheHidingSpotList; NavAreaList TheNavAreaList; CNavAreaGrid TheNavAreaGrid; -CNavArea *IMPLEMENT_ARRAY_CLASS(CNavArea, m_openList); -bool IMPLEMENT_ARRAY_CLASS(CNavArea, m_isReset); +CNavArea *IMPL_CLASS(CNavArea, m_openList); +bool IMPL_CLASS(CNavArea, m_isReset); float lastDrawTimestamp; NavAreaList goodSizedAreaList; @@ -121,7 +121,7 @@ void DestroyHidingSpots(void) area->m_hidingSpotList.clear(); } - IMPLEMENT_ARRAY_CLASS(HidingSpot, m_nextID) = 0; + IMPL_CLASS(HidingSpot, m_nextID) = 0; // free all the HidingSpots for (HidingSpotList::iterator iter = TheHidingSpotList.begin(); iter != TheHidingSpotList.end(); iter++) @@ -314,9 +314,7 @@ CNavArea::~CNavArea(void) { // if we are resetting the system, don't bother cleaning up - all areas are being destroyed if (IMPL(m_isReset)) - { return; - } // tell the other areas we are going away NavAreaList::iterator iter; @@ -621,7 +619,7 @@ bool CNavArea::SplitEdit(bool splitAlongX, float splitEdge, CNavArea **outAlpha, // Return true if given area is connected in given direction // if dir == NUM_DIRECTIONS, check all directions (direction is unknown) -// @todo Formalize "asymmetric" flag on connections +// TODO: Formalize "asymmetric" flag on connections /* <4c7708> ../game_shared/bot/nav_area.cpp:615 */ bool CNavArea::IsConnected(const CNavArea *area, NavDirType dir) const @@ -676,7 +674,7 @@ bool CNavArea::IsConnected(const CNavArea *area, NavDirType dir) const } // Compute change in height from this area to given area -// @todo This is approximate for now +// TODO: This is approximate for now /* <4c89fd> ../game_shared/bot/nav_area.cpp:674 */ float CNavArea::ComputeHeightChange(const CNavArea *area) @@ -993,7 +991,7 @@ void DestroyLadders(void) /* <4d6733> ../game_shared/bot/nav_area.cpp:994 */ void DestroyNavigationMap(void) { - IMPLEMENT_ARRAY_CLASS(CNavArea, m_isReset) = true; + IMPL_CLASS(CNavArea, m_isReset) = true; // remove each element of the list and delete them while (!TheNavAreaList.empty()) @@ -1003,8 +1001,7 @@ void DestroyNavigationMap(void) delete area; } - //TheNavAreaList.clear(); - IMPLEMENT_ARRAY_CLASS(CNavArea, m_isReset) = false; + IMPL_CLASS(CNavArea, m_isReset) = false; // destroy ladder representations DestroyLadders(); @@ -1014,13 +1011,13 @@ void DestroyNavigationMap(void) // destroy navigation nodes created during map learning CNavNode *node, *next; - for (node = IMPLEMENT_ARRAY_CLASS(CNavNode, m_list); node; node = next) + for (node = IMPL_CLASS(CNavNode, m_list); node; node = next) { next = node->m_next; delete node; } - IMPLEMENT_ARRAY_CLASS(CNavNode, m_list) = NULL; + IMPL_CLASS(CNavNode, m_list) = NULL; // reset the grid TheNavAreaGrid.Reset(); @@ -1193,13 +1190,13 @@ void ConnectGeneratedAreas(void) // south edge - this edge's nodes are actually part of adjacent areas // move one node north, and scan west to east - /// @todo This allows one-node-wide areas - do we want this? + // TODO: This allows one-node-wide areas - do we want this? node = area->m_node[ SOUTH_WEST ]; node = node->GetConnectedNode(NORTH); if (node) { CNavNode *end = area->m_node[ SOUTH_EAST ]->GetConnectedNode(NORTH); - /// @todo Figure out why cs_backalley gets a NULL node in here... + // TODO: Figure out why cs_backalley gets a NULL node in here... for (; node && node != end; node = node->GetConnectedNode(EAST)) { CNavNode *adj = node->GetConnectedNode(SOUTH); @@ -1603,7 +1600,7 @@ int BuildArea(CNavNode *node, int width, int height) if (!nwNode || !neNode || !seNode || !swNode) { - CONSOLE_ECHO("ERROR: BuildArea - NULL node.\n"); + CONSOLE_ECHO("ERROR: BuildArea - NULL node. (%p)(%p)(%p)(%p)\n", nwNode, neNode, seNode, swNode); return -1; } @@ -2636,7 +2633,7 @@ void CNavArea::AddToOpenList(void) } // A smaller value has been found, update this area on the open list -// @todo "bubbling" does unnecessary work, since the order of all other nodes will be unchanged - only this node is altered +// TODO: "bubbling" does unnecessary work, since the order of all other nodes will be unchanged - only this node is altered /* <4cbd73> ../game_shared/bot/nav_area.cpp:2685 */ void CNavArea::UpdateOnOpenList(void) @@ -2671,7 +2668,7 @@ void CNavArea::RemoveFromOpenList(void) if (m_prevOpen) m_prevOpen->m_nextOpen = m_nextOpen; else - IMPLEMENT_ARRAY(m_openList) = m_nextOpen; + IMPL(m_openList) = m_nextOpen; if (m_nextOpen) m_nextOpen->m_prevOpen = m_prevOpen; @@ -3361,7 +3358,7 @@ public: if (IsSpotOccupied(m_me, spot->GetPosition())) { // player is in hiding spot - /// @todo Check if player is moving or sitting still + // TODO: Check if player is moving or sitting still continue; } @@ -3404,7 +3401,7 @@ public: // Do a breadth-first search to find a nearby hiding spot and return it. // Don't pick a hiding spot that a Player is currently occupying. -// @todo Clean up this mess +// TODO: Clean up this mess /* <4d1806> ../game_shared/bot/nav_area.cpp:3477 */ const Vector *FindNearbyHidingSpot(CBaseEntity *me, const Vector *pos, CNavArea *startArea, float maxRange, bool isSniper, bool useNearest) @@ -3617,7 +3614,7 @@ const Vector *FindNearbyRetreatSpot(CBaseEntity *me, const Vector *start, CNavAr } // Return number of players with given teamID in this area (teamID == 0 means any/all) -// @todo Keep pointers to contained Players to make this a zero-time query +// TODO: Keep pointers to contained Players to make this a zero-time query /* <4ce934> ../game_shared/bot/nav_area.cpp:3707 */ int CNavArea::GetPlayerCount(int teamID, CBasePlayer *ignore) const @@ -4642,7 +4639,7 @@ public: // Can we see this area? // For now, if we can see any corner, we can see the area -// @todo Need to check LOS to more than the corners for large and/or long areas +// TODO: Need to check LOS to more than the corners for large and/or long areas /* <4c4182> ../game_shared/bot/nav_area.cpp:4791 */ inline bool IsAreaVisible(const Vector *pos, const CNavArea *area) @@ -4673,8 +4670,6 @@ inline bool IsAreaVisible(const Vector *pos, const CNavArea *area) /* <4cf54c> ../game_shared/bot/nav_area.cpp:4817 */ void CNavArea::ComputeApproachAreas(void) { - _LOG_TRACE - m_approachCount = 0; if (cv_bot_quicksave.value > 0.0f) diff --git a/regamedll/game_shared/bot/nav_area.h b/regamedll/game_shared/bot/nav_area.h index 610863bf..0e7344e8 100644 --- a/regamedll/game_shared/bot/nav_area.h +++ b/regamedll/game_shared/bot/nav_area.h @@ -892,7 +892,7 @@ bool NavAreaBuildPath(CNavArea *startArea, CNavArea *goalArea, const Vector *goa if (ladderUp) { - ladder = *ladderIter; + ladder = (*ladderIter); if (ladder->m_isDangling) { ++ladderIter; diff --git a/regamedll/game_shared/bot/nav_file.cpp b/regamedll/game_shared/bot/nav_file.cpp index e4cbbb33..195b9af8 100644 --- a/regamedll/game_shared/bot/nav_file.cpp +++ b/regamedll/game_shared/bot/nav_file.cpp @@ -165,13 +165,9 @@ void CNavArea::Save(FILE *fp) const fprintf(fp, "v %f %f %f\n", m_extent.lo.x, m_extent.hi.y, m_swZ); static int base = 1; - fprintf(fp, "\n\ng %04dArea%s%s%s%s\n", - m_id, - (GetAttributes() & NAV_CROUCH) ? "CROUCH" : "", - (GetAttributes() & NAV_JUMP) ? "JUMP" : "", - (GetAttributes() & NAV_PRECISE) ? "PRECISE" : "", - (GetAttributes() & NAV_NO_JUMP) ? "NO_JUMP" : "" - ); + fprintf(fp, "\n\ng %04dArea%s%s%s%s\n", m_id, + (GetAttributes() & NAV_CROUCH) ? "CROUCH" : "", (GetAttributes() & NAV_JUMP) ? "JUMP" : "", + (GetAttributes() & NAV_PRECISE) ? "PRECISE" : "", (GetAttributes() & NAV_NO_JUMP) ? "NO_JUMP" : ""); fprintf(fp, "f %d %d %d %d\n\n", base, base + 1, base + 2, base + 3); base += 4; @@ -209,9 +205,7 @@ NOBODY void CNavArea::Save(int fd, unsigned int version) } } - // // Store hiding spots for this area - // unsigned char count; if (m_hidingSpotList.size() > 255) { @@ -238,10 +232,7 @@ NOBODY void CNavArea::Save(int fd, unsigned int version) break; } - // // Save the approach areas for this area - // - // save number of approach areas Q_write(fd, &m_approachCount, sizeof(unsigned char)); if (cv_bot_debug.value > 0.0f) @@ -274,9 +265,7 @@ NOBODY void CNavArea::Save(int fd, unsigned int version) Q_write(fd, &type, sizeof(unsigned char)); } - // // Save encounter spots for this area - // { // save number of encounter paths for this area unsigned int count = m_spotEncounterList.size(); @@ -350,8 +339,8 @@ NOBODY void CNavArea::Load(SteamFile *file, unsigned int version) file->Read(&m_id, sizeof(unsigned int)); // update nextID to avoid collisions - if (m_id >= IMPLEMENT_ARRAY(m_nextID)) - IMPLEMENT_ARRAY(m_nextID) = m_id + 1; + if (m_id >= IMPL(m_nextID)) + IMPL(m_nextID) = m_id + 1; // load attribute flags file->Read(&m_attributeFlags, sizeof(unsigned char)); @@ -384,10 +373,7 @@ NOBODY void CNavArea::Load(SteamFile *file, unsigned int version) } } - // // Load hiding spots - // - // load number of hiding spots unsigned char hidingSpotCount; file->Read(&hidingSpotCount, sizeof(unsigned char)); @@ -420,9 +406,7 @@ NOBODY void CNavArea::Load(SteamFile *file, unsigned int version) } } - // // Load number of approach areas - // file->Read(&m_approachCount, sizeof(unsigned char)); // load approach area info (IDs) @@ -440,9 +424,7 @@ NOBODY void CNavArea::Load(SteamFile *file, unsigned int version) m_approach[a].hereToNextHow = (NavTraverseType)type; } - // // Load encounter paths for this area - // unsigned int count; file->Read(&count, sizeof(unsigned int)); @@ -511,9 +493,7 @@ NOBODY void CNavArea::Load(SteamFile *file, unsigned int version) if (version < 5) return; - // // Load Place data - // PlaceDirectory::EntryType entry; file->Read(&entry, sizeof(entry)); @@ -616,7 +596,7 @@ NOBODY NavErrorType CNavArea::PostLoad(void) } // build overlap list - /// @todo Optimize this + // TODO: Optimize this for (NavAreaList::iterator oiter = TheNavAreaList.begin(); oiter != TheNavAreaList.end(); ++oiter) { CNavArea *area = *oiter; @@ -658,9 +638,7 @@ NOBODY bool SaveNavigationMap(const char *filename) if (filename == NULL) return false; - // // Store the NAV file - // COM_FixSlashes(const_cast(filename)); #ifdef WIN32 @@ -697,9 +675,7 @@ NOBODY bool SaveNavigationMap(const char *filename) Q_write(fd, &bspSize, sizeof(unsigned int)); - // // Build a directory of the Places in this map - // placeDirectory.Reset(); NavAreaList::iterator it; @@ -716,10 +692,7 @@ NOBODY bool SaveNavigationMap(const char *filename) placeDirectory.Save(fd); - // // Store navigation areas - // - // store number of areas unsigned int count = TheNavAreaList.size(); Q_write(fd, &count, sizeof(unsigned int)); @@ -902,7 +875,7 @@ NOBODY NavErrorType __declspec(naked) LoadNavigationMap(void) DestroyNavigationMap(); placeDirectory.Reset(); - IMPLEMENT_ARRAY_CLASS(CNavArea, m_nextID) = 1; + IMPL_CLASS(CNavArea, m_nextID) = 1; SteamFile navFile(filename); @@ -1015,9 +988,7 @@ NOBODY NavErrorType __declspec(naked) LoadNavigationMap(void) LoadLocationFile(filename); } - // // Set up all the ladders - // BuildLadders(); return NAV_OK; diff --git a/regamedll/game_shared/bot/nav_node.cpp b/regamedll/game_shared/bot/nav_node.cpp index 459ca471..a0a75221 100644 --- a/regamedll/game_shared/bot/nav_node.cpp +++ b/regamedll/game_shared/bot/nav_node.cpp @@ -16,8 +16,8 @@ unsigned int CNavNode::m_listLength = 0; //NavDirType Opposite[ NUM_DIRECTIONS ]; -CNavNode *IMPLEMENT_ARRAY_CLASS(CNavNode, m_list); -unsigned int IMPLEMENT_ARRAY_CLASS(CNavNode, m_listLength); +CNavNode *IMPL_CLASS(CNavNode, m_list); +unsigned int IMPL_CLASS(CNavNode, m_listLength); //Extent NodeMapExtent; diff --git a/regamedll/game_shared/bot/nav_node.h b/regamedll/game_shared/bot/nav_node.h index 5cfa8597..b2416326 100644 --- a/regamedll/game_shared/bot/nav_node.h +++ b/regamedll/game_shared/bot/nav_node.h @@ -85,7 +85,7 @@ public: BOOL IsBiLinked(NavDirType dir) const; // node is bidirectionally linked to another node in the given direction BOOL IsClosedCell(void) const; // node is the NW corner of a bi-linked quad of nodes - // @todo Should pass in area that is covering + // TODO: Should pass in area that is covering void Cover(void) { m_isCovered = true; diff --git a/regamedll/game_shared/bot/nav_path.h b/regamedll/game_shared/bot/nav_path.h index e9f10cbf..6b539694 100644 --- a/regamedll/game_shared/bot/nav_path.h +++ b/regamedll/game_shared/bot/nav_path.h @@ -91,9 +91,7 @@ public: void Optimize(void); // Compute shortest path from 'start' to 'goal' via A* algorithm - template< - typename CostFunctor - > + template bool Compute(const Vector *start, const Vector *goal, CostFunctor &costFunc) { Invalidate(); @@ -209,7 +207,7 @@ public: return m_isStuck ? m_stuckTimer.GetElapsedTime() : 0.0f; } -/*private:*/ +private: bool m_isStuck; // if true, we are stuck Vector m_stuckSpot; // the location where we became stuck IntervalTimer m_stuckTimer; // how long we have been stuck diff --git a/regamedll/game_shared/bot/simple_state_machine.h b/regamedll/game_shared/bot/simple_state_machine.h index 13992c74..1e764f2e 100644 --- a/regamedll/game_shared/bot/simple_state_machine.h +++ b/regamedll/game_shared/bot/simple_state_machine.h @@ -33,9 +33,7 @@ #endif // Encapsulation of a finite-state-machine state -template< - typename T -> +template /* <5c4388> ../game_shared/bot/simple_state_machine.h:21 */ class SimpleState { @@ -65,10 +63,7 @@ private: }; // Encapsulation of a finite state machine -template< - typename T, - typename S -> +template /* <5c4bab> ../game_shared/bot/simple_state_machine.h:68 */ class SimpleStateMachine { diff --git a/regamedll/game_shared/steam_util.h b/regamedll/game_shared/steam_util.h index e5520eae..af6b6439 100644 --- a/regamedll/game_shared/steam_util.h +++ b/regamedll/game_shared/steam_util.h @@ -1,86 +1,86 @@ -/* -* -* This program is free software; you can redistribute it and/or modify it -* under the terms of the GNU General Public License as published by the -* Free Software Foundation; either version 2 of the License, or (at -* your option) any later version. -* -* This program is distributed in the hope that it will be useful, but -* WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -* General Public License for more details. -* -* You should have received a copy of the GNU General Public License -* along with this program; if not, write to the Free Software Foundation, -* Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -* -* In addition, as a special exception, the author gives permission to -* link the code of this program with the Half-Life Game Engine ("HL -* Engine") and Modified Game Libraries ("MODs") developed by Valve, -* L.L.C ("Valve"). You must obey the GNU General Public License in all -* respects for all of the code used other than the HL Engine and MODs -* from Valve. If you modify this file, you may extend this exception -* to your version of the file, but you are not obligated to do so. If -* you do not wish to do so, delete this exception statement from your -* version. -* -*/ - -#ifndef STEAM_UTIL_H -#define STEAM_UTIL_H -#ifdef _WIN32 -#pragma once -#endif - -class SteamFile -{ -public: - SteamFile(const char *filename); - ~SteamFile(void); - - bool IsValid(void) const - { - return (m_fileData) ? true : false; - } - bool Read(void *data, int length); - -private: - byte *m_fileData; - int m_fileDataLength; - - byte *m_cursor; - int m_bytesLeft; - -};/* size: 16, cachelines: 1, members: 4 */ - -/* <4eb7b4> ../game_shared/steam_util.h:29 */ -inline SteamFile::SteamFile(const char *filename) -{ +/* +* +* This program is free software; you can redistribute it and/or modify it +* under the terms of the GNU General Public License as published by the +* Free Software Foundation; either version 2 of the License, or (at +* your option) any later version. +* +* This program is distributed in the hope that it will be useful, but +* WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +* General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with this program; if not, write to the Free Software Foundation, +* Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +* +* In addition, as a special exception, the author gives permission to +* link the code of this program with the Half-Life Game Engine ("HL +* Engine") and Modified Game Libraries ("MODs") developed by Valve, +* L.L.C ("Valve"). You must obey the GNU General Public License in all +* respects for all of the code used other than the HL Engine and MODs +* from Valve. If you modify this file, you may extend this exception +* to your version of the file, but you are not obligated to do so. If +* you do not wish to do so, delete this exception statement from your +* version. +* +*/ + +#ifndef STEAM_UTIL_H +#define STEAM_UTIL_H +#ifdef _WIN32 +#pragma once +#endif + +class SteamFile +{ +public: + SteamFile(const char *filename); + ~SteamFile(void); + + bool IsValid(void) const + { + return (m_fileData) ? true : false; + } + bool Read(void *data, int length); + +private: + byte *m_fileData; + int m_fileDataLength; + + byte *m_cursor; + int m_bytesLeft; + +};/* size: 16, cachelines: 1, members: 4 */ + +/* <4eb7b4> ../game_shared/steam_util.h:29 */ +inline SteamFile::SteamFile(const char *filename) +{ m_fileData = (byte *)LOAD_FILE_FOR_ME(const_cast(filename), &m_fileDataLength); m_cursor = m_fileData; - m_bytesLeft = m_fileDataLength; -} - -/* <4eb65d> ../game_shared/steam_util.h:36 */ -inline SteamFile::~SteamFile(void) -{ - if (m_fileData) - FREE_FILE(m_fileData); -} - -/* <4bfdfa> ../game_shared/steam_util.h:42 */ -inline bool SteamFile::Read(void *data, int length) -{ - if (length > m_bytesLeft || m_cursor == NULL || m_bytesLeft <= 0) - return false; - - byte *readCursor = static_cast(data); - for (int i = 0; i < length; i++) - { - *readCursor++ = *m_cursor++; - --m_bytesLeft; - } - return true; -} - -#endif // STEAM_UTIL_H + m_bytesLeft = m_fileDataLength; +} + +/* <4eb65d> ../game_shared/steam_util.h:36 */ +inline SteamFile::~SteamFile(void) +{ + if (m_fileData) + FREE_FILE(m_fileData); +} + +/* <4bfdfa> ../game_shared/steam_util.h:42 */ +inline bool SteamFile::Read(void *data, int length) +{ + if (length > m_bytesLeft || m_cursor == NULL || m_bytesLeft <= 0) + return false; + + byte *readCursor = static_cast(data); + for (int i = 0; i < length; i++) + { + *readCursor++ = *m_cursor++; + --m_bytesLeft; + } + return true; +} + +#endif // STEAM_UTIL_H diff --git a/regamedll/game_shared/voice_gamemgr.h b/regamedll/game_shared/voice_gamemgr.h index 7f880932..976fb1c1 100644 --- a/regamedll/game_shared/voice_gamemgr.h +++ b/regamedll/game_shared/voice_gamemgr.h @@ -24,77 +24,77 @@ * you do not wish to do so, delete this exception statement from your * version. * -*/ - -#ifndef VOICE_GAMEMGR_H -#define VOICE_GAMEMGR_H -#ifdef _WIN32 -#pragma once -#endif - -#define UPDATE_INTERVAL 0.3 - -#include "voice_common.h" - -#ifdef HOOK_GAMEDLL - -#define voice_serverdebug (*pvoice_serverdebug) -#define sv_alltalk (*psv_alltalk) - -#define g_PlayerModEnable (*pg_PlayerModEnable) -#define g_BanMasks (*pg_BanMasks) -#define g_SentGameRulesMasks (*pg_SentGameRulesMasks) -#define g_SentBanMasks (*pg_SentBanMasks) -#define g_bWantModEnable (*pg_bWantModEnable) - -#endif // HOOK_GAMEDLL - -extern cvar_t voice_serverdebug; -extern cvar_t sv_alltalk; - -extern CPlayerBitVec g_PlayerModEnable; -extern CBitVec< VOICE_MAX_PLAYERS > g_BanMasks[ VOICE_MAX_PLAYERS ]; -extern CBitVec< VOICE_MAX_PLAYERS > g_SentGameRulesMasks[ VOICE_MAX_PLAYERS ]; -extern CBitVec< VOICE_MAX_PLAYERS > g_SentBanMasks[ VOICE_MAX_PLAYERS ]; -extern CPlayerBitVec g_bWantModEnable; - -/* <111716> ../game_shared/voice_gamemgr.h:23 */ -class IVoiceGameMgrHelper -{ -public: - virtual ~IVoiceGameMgrHelper() {} - virtual bool CanPlayerHearPlayer(CBasePlayer *pListener, CBasePlayer *pTalker) = 0; - -};/* size: 4, cachelines: 1, members: 1 */ - -class CVoiceGameMgr -{ -public: - CVoiceGameMgr(void); - virtual ~CVoiceGameMgr(void); - - bool Init(IVoiceGameMgrHelper *pHelper, int maxClients); - NOXREF void SetHelper(IVoiceGameMgrHelper *pHelper); - void Update(double frametime); - void ClientConnected(edict_t *pEdict); - bool ClientCommand(CBasePlayer *pPlayer, const char *cmd); - bool PlayerHasBlockedPlayer(CBasePlayer *pReceiver, CBasePlayer *pSender); - -#ifndef HOOK_GAMEDLL -private: -#endif // HOOK_GAMEDLL - - void UpdateMasks(void); - -private: - int m_msgPlayerVoiceMask; - int m_msgRequestState; - IVoiceGameMgrHelper *m_pHelper; - int m_nMaxPlayers; - double m_UpdateInterval; - -};/* size: 28, cachelines: 1, members: 6 */ - -void VoiceServerDebug(const char *pFmt, ...); - -#endif // VOICE_GAMEMGR_H +*/ + +#ifndef VOICE_GAMEMGR_H +#define VOICE_GAMEMGR_H +#ifdef _WIN32 +#pragma once +#endif + +#define UPDATE_INTERVAL 0.3 + +#include "voice_common.h" + +#ifdef HOOK_GAMEDLL + +#define voice_serverdebug (*pvoice_serverdebug) +#define sv_alltalk (*psv_alltalk) + +#define g_PlayerModEnable (*pg_PlayerModEnable) +#define g_BanMasks (*pg_BanMasks) +#define g_SentGameRulesMasks (*pg_SentGameRulesMasks) +#define g_SentBanMasks (*pg_SentBanMasks) +#define g_bWantModEnable (*pg_bWantModEnable) + +#endif // HOOK_GAMEDLL + +extern cvar_t voice_serverdebug; +extern cvar_t sv_alltalk; + +extern CPlayerBitVec g_PlayerModEnable; +extern CBitVec< VOICE_MAX_PLAYERS > g_BanMasks[ VOICE_MAX_PLAYERS ]; +extern CBitVec< VOICE_MAX_PLAYERS > g_SentGameRulesMasks[ VOICE_MAX_PLAYERS ]; +extern CBitVec< VOICE_MAX_PLAYERS > g_SentBanMasks[ VOICE_MAX_PLAYERS ]; +extern CPlayerBitVec g_bWantModEnable; + +/* <111716> ../game_shared/voice_gamemgr.h:23 */ +class IVoiceGameMgrHelper +{ +public: + virtual ~IVoiceGameMgrHelper() {} + virtual bool CanPlayerHearPlayer(CBasePlayer *pListener, CBasePlayer *pTalker) = 0; + +};/* size: 4, cachelines: 1, members: 1 */ + +class CVoiceGameMgr +{ +public: + CVoiceGameMgr(void); + virtual ~CVoiceGameMgr(void); + + bool Init(IVoiceGameMgrHelper *pHelper, int maxClients); + NOXREF void SetHelper(IVoiceGameMgrHelper *pHelper); + void Update(double frametime); + void ClientConnected(edict_t *pEdict); + bool ClientCommand(CBasePlayer *pPlayer, const char *cmd); + bool PlayerHasBlockedPlayer(CBasePlayer *pReceiver, CBasePlayer *pSender); + +#ifndef HOOK_GAMEDLL +private: +#endif // HOOK_GAMEDLL + + void UpdateMasks(void); + +private: + int m_msgPlayerVoiceMask; + int m_msgRequestState; + IVoiceGameMgrHelper *m_pHelper; + int m_nMaxPlayers; + double m_UpdateInterval; + +};/* size: 28, cachelines: 1, members: 6 */ + +void VoiceServerDebug(const char *pFmt, ...); + +#endif // VOICE_GAMEMGR_H diff --git a/regamedll/hookers/memory.cpp b/regamedll/hookers/memory.cpp index 9945387f..09da73b0 100644 --- a/regamedll/hookers/memory.cpp +++ b/regamedll/hookers/memory.cpp @@ -715,6 +715,13 @@ bool HIDDEN GetAddress(Module *module, Address *addr, size_t baseOffset) return true; } + +#if HOOK_GAMEDLL +void *addr_orig; +char patchByte[5]; +char patchByteOriginal[5]; +#endif // HOOK_GAMEDLL + bool HIDDEN HookFunction(Module *module, FunctionHook *hook) { if (hook->originalAddress == NULL) @@ -725,8 +732,15 @@ bool HIDDEN HookFunction(Module *module, FunctionHook *hook) *(size_t *)&patch[1] = hook->handlerFunc - hook->originalAddress - 5; patch[0] = 0xE9; -#if 0 - if (strcmp(hook->symbolName,"_ZNK9BotPhrase12GetSpeakableEiPf")==0) +#if HOOK_GAMEDLL + //static DWORD oldProtection; + ///VirtualProtect(addr_orig,5,PAGE_EXECUTE_READWRITE,&oldProtection); + //memcpy(addr_orig,patchByteOriginal,5); + //pWeaponUSP(a); + //int seedad = pUTIL_SharedRandomLong(seed,low,high); + //memcpy(addr_orig,patchByte,5); + + if (strcmp(hook->symbolName,"_ZNK14CHostageImprov16IsFriendInTheWayEv")==0) { addr_orig = (void *)hook->originalAddress; @@ -866,12 +880,12 @@ void HIDDEN GetAddressVtableByClassname(const char *szClassName, const int iOffs void *addr = GetFunctionEntity(szClassName); - if (addr == NULL) - { - //can't create object. - printf2(__FUNCTION__ ":: Not found export function of binaries. Presumably looks '__declspec(dllexport) void %s(entvars_t *pev)'", szClassName); - REMOVE_ENTITY(pObject); - return; + if (addr == NULL) + { + //can't create object. + printf2(__FUNCTION__ ":: Not found export function of binaries. Presumably looks '__declspec(dllexport) void %s(entvars_t *pev)'", szClassName); + REMOVE_ENTITY(pObject); + return; } // call link to class GetClassPtr(pev); diff --git a/regamedll/hookers/memory.h b/regamedll/hookers/memory.h index 32ebb8d7..fbe6bbf2 100644 --- a/regamedll/hookers/memory.h +++ b/regamedll/hookers/memory.h @@ -152,4 +152,10 @@ void HIDDEN GetAddressVtableByClassname(const char *szClassName, const int iOffs #endif // _WIN32 && REGAMEDLL_UNIT_TESTS +#ifdef HOOK_GAMEDLL +extern void *addr_orig; +extern char patchByte[5]; +extern char patchByteOriginal[5]; +#endif // HOOK_GAMEDLL + #endif // _MEMORY_H diff --git a/regamedll/hookers/osconfig.h b/regamedll/hookers/osconfig.h index 1e1f224a..b5dff9f2 100644 --- a/regamedll/hookers/osconfig.h +++ b/regamedll/hookers/osconfig.h @@ -149,6 +149,9 @@ #define STDCALL __stdcall #define HIDDEN + #define NOINLINE __declspec(noinline) + #define ALIGN16 __declspec(align(16)) + #define FORCE_STACK_ALIGN // Attributes to specify an "exported" function, visible from outside the // DLL. @@ -187,6 +190,9 @@ #define CDECL __attribute__ ((cdecl)) #define STDCALL __attribute__ ((stdcall)) #define HIDDEN __attribute__((visibility("hidden"))) + #define NOINLINE __attribute__((noinline)) + #define ALIGN16 __attribute__((aligned(16))) + #define FORCE_STACK_ALIGN __attribute__((force_align_arg_pointer)) #undef DLLEXPORT #define DLLEXPORT __attribute__((visibility("default"))) @@ -230,7 +236,9 @@ static const bool __isLinux = true; #endif +#define EXT_FUNC /*FORCE_STACK_ALIGN*/ + extern void regamedll_log(const char *fmt, ...); -extern void regamedll_syserror(const char *fmt, ...); +extern void __declspec(noreturn) regamedll_syserror(const char *fmt, ...); #endif // OSCONFIG_H diff --git a/regamedll/msvc/ReGameDLL.vcxproj b/regamedll/msvc/ReGameDLL.vcxproj index 6c3c98c6..0ef36650 100644 --- a/regamedll/msvc/ReGameDLL.vcxproj +++ b/regamedll/msvc/ReGameDLL.vcxproj @@ -643,17 +643,8 @@ - - true - true - true - true - true - true - true - - + @@ -673,6 +664,8 @@ precompiled.h + + true @@ -881,6 +874,9 @@ + + + @@ -904,21 +900,19 @@ - - - - - + + + @@ -1097,11 +1091,11 @@ Setup version from SVN revision - $(ProjectDir)\..\;$(ProjectDir)\..\hookers\;$(ProjectDir)\..\common;$(ProjectDir)\..\dlls;$(ProjectDir)\..\engine;$(ProjectDir)\..\public;$(ProjectDir)\..\pm_shared;$(ProjectDir)\..\regamedll\;$(ProjectDir)\..\testsuite\;$(VCInstallDir)UnitTest\include;$(SolutionDir)..\dep\bzip2\include\;$(SolutionDir)..\dep\cppunitlite\include\;%(AdditionalIncludeDirectories) + $(ProjectDir)\..\;$(ProjectDir)\..\hookers\;$(ProjectDir)\..\common;$(ProjectDir)\..\dlls;$(ProjectDir)\..\engine;$(ProjectDir)\..\public;$(ProjectDir)\..\public\regamedll;$(ProjectDir)\..\pm_shared;$(ProjectDir)\..\regamedll\;$(ProjectDir)\..\testsuite\;$(VCInstallDir)UnitTest\include;$(SolutionDir)..\dep\bzip2\include\;$(SolutionDir)..\dep\cppunitlite\include\;%(AdditionalIncludeDirectories) Level3 Disabled true - HOOK_GAMEDLL;REGAMEDLL_FIXES;REGAMEDLL_CHECKS;CLIENT_WEAPONS;USE_BREAKPAD_HANDLER;DEDICATED;_CRT_SECURE_NO_WARNINGS;_DEBUG;_ITERATOR_DEBUG_LEVEL=0;NOMINMAX;%(PreprocessorDefinitions) + HOOK_GAMEDLL;REGAMEDLL_SELF;REGAMEDLL_FIXES;REGAMEDLL_CHECKS;CLIENT_WEAPONS;USE_BREAKPAD_HANDLER;DEDICATED;_CRT_SECURE_NO_WARNINGS;_DEBUG;_ITERATOR_DEBUG_LEVEL=0;NOMINMAX;%(PreprocessorDefinitions) Precise /arch:IA32 %(AdditionalOptions) MultiThreadedDebug @@ -1134,11 +1128,11 @@ Setup version from SVN revision - $(ProjectDir)\..\;$(ProjectDir)\..\hookers\;$(ProjectDir)\..\common;$(ProjectDir)\..\dlls;$(ProjectDir)\..\engine;$(ProjectDir)\..\public;$(ProjectDir)\..\pm_shared;$(ProjectDir)\..\regamedll\;$(ProjectDir)\..\testsuite\;$(VCInstallDir)UnitTest\include;$(SolutionDir)..\dep\bzip2\include\;$(SolutionDir)..\dep\cppunitlite\include\;%(AdditionalIncludeDirectories) + $(ProjectDir)\..\;$(ProjectDir)\..\hookers\;$(ProjectDir)\..\common;$(ProjectDir)\..\dlls;$(ProjectDir)\..\engine;$(ProjectDir)\..\public;$(ProjectDir)\..\public\regamedll;$(ProjectDir)\..\pm_shared;$(ProjectDir)\..\regamedll\;$(ProjectDir)\..\testsuite\;$(VCInstallDir)UnitTest\include;$(SolutionDir)..\dep\bzip2\include\;$(SolutionDir)..\dep\cppunitlite\include\;%(AdditionalIncludeDirectories) Level3 Disabled true - HOOK_GAMEDLL;REGAMEDLL_CHECKS;CLIENT_WEAPONS;USE_BREAKPAD_HANDLER;DEDICATED;_CRT_SECURE_NO_WARNINGS;_DEBUG;_ITERATOR_DEBUG_LEVEL=0;%(PreprocessorDefinitions) + HOOK_GAMEDLL;REGAMEDLL_SELF;REGAMEDLL_CHECKS;CLIENT_WEAPONS;USE_BREAKPAD_HANDLER;DEDICATED;_CRT_SECURE_NO_WARNINGS;_DEBUG;_ITERATOR_DEBUG_LEVEL=0;%(PreprocessorDefinitions) Precise /arch:IA32 %(AdditionalOptions) MultiThreadedDebug @@ -1170,11 +1164,11 @@ Setup version from SVN revision - $(ProjectDir)\..\;$(ProjectDir)\..\hookers\;$(ProjectDir)\..\common;$(ProjectDir)\..\dlls;$(ProjectDir)\..\engine;$(ProjectDir)\..\public;$(ProjectDir)\..\pm_shared;$(ProjectDir)\..\regamedll\;$(ProjectDir)\..\testsuite\;$(VCInstallDir)UnitTest\include;$(SolutionDir)..\dep\bzip2\include\;$(SolutionDir)..\dep\cppunitlite\include\;%(AdditionalIncludeDirectories) + $(ProjectDir)\..\;$(ProjectDir)\..\hookers\;$(ProjectDir)\..\common;$(ProjectDir)\..\dlls;$(ProjectDir)\..\engine;$(ProjectDir)\..\public;$(ProjectDir)\..\public\regamedll;$(ProjectDir)\..\pm_shared;$(ProjectDir)\..\regamedll\;$(ProjectDir)\..\testsuite\;$(VCInstallDir)UnitTest\include;$(SolutionDir)..\dep\bzip2\include\;$(SolutionDir)..\dep\cppunitlite\include\;%(AdditionalIncludeDirectories) Level3 Disabled true - CSTRIKE;REGAMEDLL_CHECKS;CLIENT_WEAPONS;USE_BREAKPAD_HANDLER;DEDICATED;_CRT_SECURE_NO_WARNINGS;_DEBUG;_ITERATOR_DEBUG_LEVEL=0;%(PreprocessorDefinitions) + CSTRIKE;REGAMEDLL_SELF;REGAMEDLL_CHECKS;CLIENT_WEAPONS;USE_BREAKPAD_HANDLER;DEDICATED;_CRT_SECURE_NO_WARNINGS;_DEBUG;_ITERATOR_DEBUG_LEVEL=0;%(PreprocessorDefinitions) Precise /arch:IA32 %(AdditionalOptions) MultiThreadedDebug @@ -1206,11 +1200,11 @@ Setup version from SVN revision - $(ProjectDir)\..\;$(ProjectDir)\..\hookers\;$(ProjectDir)\..\common;$(ProjectDir)\..\dlls;$(ProjectDir)\..\engine;$(ProjectDir)\..\public;$(ProjectDir)\..\pm_shared;$(ProjectDir)\..\regamedll\;$(ProjectDir)\..\testsuite\;$(VCInstallDir)UnitTest\include;$(SolutionDir)..\dep\bzip2\include\;$(SolutionDir)..\dep\cppunitlite\include\;%(AdditionalIncludeDirectories) + $(ProjectDir)\..\;$(ProjectDir)\..\hookers\;$(ProjectDir)\..\common;$(ProjectDir)\..\dlls;$(ProjectDir)\..\engine;$(ProjectDir)\..\public;$(ProjectDir)\..\public\regamedll;$(ProjectDir)\..\pm_shared;$(ProjectDir)\..\regamedll\;$(ProjectDir)\..\testsuite\;$(VCInstallDir)UnitTest\include;$(SolutionDir)..\dep\bzip2\include\;$(SolutionDir)..\dep\cppunitlite\include\;%(AdditionalIncludeDirectories) Level3 Disabled true - REGAMEDLL_CHECKS;CLIENT_WEAPONS;USE_BREAKPAD_HANDLER;DEDICATED;_CRT_SECURE_NO_WARNINGS;_DEBUG;_ITERATOR_DEBUG_LEVEL=0;%(PreprocessorDefinitions) + REGAMEDLL_SELF;REGAMEDLL_CHECKS;CLIENT_WEAPONS;USE_BREAKPAD_HANDLER;DEDICATED;_CRT_SECURE_NO_WARNINGS;_DEBUG;_ITERATOR_DEBUG_LEVEL=0;%(PreprocessorDefinitions) Precise /arch:IA32 %(AdditionalOptions) MultiThreadedDebug @@ -1242,11 +1236,11 @@ Setup version from SVN revision - $(ProjectDir)\..\;$(ProjectDir)\..\hookers\;$(ProjectDir)\..\common;$(ProjectDir)\..\dlls;$(ProjectDir)\..\engine;$(ProjectDir)\..\public;$(ProjectDir)\..\pm_shared;$(ProjectDir)\..\regamedll\;$(ProjectDir)\..\testsuite\;$(VCInstallDir)UnitTest\include;$(SolutionDir)..\dep\bzip2\include\;$(SolutionDir)..\dep\cppunitlite\include\;%(AdditionalIncludeDirectories) + $(ProjectDir)\..\;$(ProjectDir)\..\hookers\;$(ProjectDir)\..\common;$(ProjectDir)\..\dlls;$(ProjectDir)\..\engine;$(ProjectDir)\..\public;$(ProjectDir)\..\public\regamedll;$(ProjectDir)\..\pm_shared;$(ProjectDir)\..\regamedll\;$(ProjectDir)\..\testsuite\;$(VCInstallDir)UnitTest\include;$(SolutionDir)..\dep\bzip2\include\;$(SolutionDir)..\dep\cppunitlite\include\;%(AdditionalIncludeDirectories) Level3 Disabled true - REGAMEDLL_FIXES;DEDICATED;REGAMEDLL_SELF;HOOK_GAMEDLL;_BUILD_FROM_IDE;USE_BREAKPAD_HANDLER;DEDICATED;_CRT_SECURE_NO_WARNINGS;_ITERATOR_DEBUG_LEVEL=0;_DEBUG;%(PreprocessorDefinitions) + REGAMEDLL_SELF;REGAMEDLL_FIXES;DEDICATED;REGAMEDLL_SELF;HOOK_GAMEDLL;_BUILD_FROM_IDE;USE_BREAKPAD_HANDLER;DEDICATED;_CRT_SECURE_NO_WARNINGS;_ITERATOR_DEBUG_LEVEL=0;_DEBUG;%(PreprocessorDefinitions) MultiThreadedDebug Use precompiled.h @@ -1278,13 +1272,13 @@ Setup version from SVN revision - $(ProjectDir)\..\;$(ProjectDir)\..\hookers\;$(ProjectDir)\..\common;$(ProjectDir)\..\dlls;$(ProjectDir)\..\engine;$(ProjectDir)\..\public;$(ProjectDir)\..\pm_shared;$(ProjectDir)\..\regamedll\;$(ProjectDir)\..\testsuite\;$(VCInstallDir)UnitTest\include;$(SolutionDir)..\dep\bzip2\include\;$(SolutionDir)..\dep\cppunitlite\include\;%(AdditionalIncludeDirectories) + $(ProjectDir)\..\;$(ProjectDir)\..\hookers\;$(ProjectDir)\..\common;$(ProjectDir)\..\dlls;$(ProjectDir)\..\engine;$(ProjectDir)\..\public;$(ProjectDir)\..\public\regamedll;$(ProjectDir)\..\pm_shared;$(ProjectDir)\..\regamedll\;$(ProjectDir)\..\testsuite\;$(VCInstallDir)UnitTest\include;$(SolutionDir)..\dep\bzip2\include\;$(SolutionDir)..\dep\cppunitlite\include\;%(AdditionalIncludeDirectories) Level3 MaxSpeed true true true - HOOK_GAMEDLL;REGAMEDLL_FIXES;REGAMEDLL_CHECKS;CLIENT_WEAPONS;USE_BREAKPAD_HANDLER;DEDICATED;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions) + HOOK_GAMEDLL;REGAMEDLL_SELF;REGAMEDLL_FIXES;REGAMEDLL_CHECKS;CLIENT_WEAPONS;USE_BREAKPAD_HANDLER;DEDICATED;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions) MultiThreaded /arch:IA32 %(AdditionalOptions) Use @@ -1317,13 +1311,13 @@ Setup version from SVN revision - $(ProjectDir)\..\;$(ProjectDir)\..\hookers\;$(ProjectDir)\..\common;$(ProjectDir)\..\dlls;$(ProjectDir)\..\engine;$(ProjectDir)\..\public;$(ProjectDir)\..\pm_shared;$(ProjectDir)\..\regamedll\;$(ProjectDir)\..\testsuite\;$(VCInstallDir)UnitTest\include;$(SolutionDir)..\dep\bzip2\include\;$(SolutionDir)..\dep\cppunitlite\include\;%(AdditionalIncludeDirectories) + $(ProjectDir)\..\;$(ProjectDir)\..\hookers\;$(ProjectDir)\..\common;$(ProjectDir)\..\dlls;$(ProjectDir)\..\engine;$(ProjectDir)\..\public;$(ProjectDir)\..\public\regamedll;$(ProjectDir)\..\pm_shared;$(ProjectDir)\..\regamedll\;$(ProjectDir)\..\testsuite\;$(VCInstallDir)UnitTest\include;$(SolutionDir)..\dep\bzip2\include\;$(SolutionDir)..\dep\cppunitlite\include\;%(AdditionalIncludeDirectories) Level3 MaxSpeed true true true - HOOK_GAMEDLL;REGAMEDLL_CHECKS;CLIENT_WEAPONS;USE_BREAKPAD_HANDLER;DEDICATED;_CRT_SECURE_NO_WARNINGS;NOMINMAX;%(PreprocessorDefinitions) + REGAMEDLL_SELF;HOOK_GAMEDLL;REGAMEDLL_CHECKS;CLIENT_WEAPONS;USE_BREAKPAD_HANDLER;DEDICATED;_CRT_SECURE_NO_WARNINGS;NOMINMAX;%(PreprocessorDefinitions) MultiThreaded /arch:IA32 %(AdditionalOptions) Use diff --git a/regamedll/msvc/ReGameDLL.vcxproj.filters b/regamedll/msvc/ReGameDLL.vcxproj.filters index f12523bd..a285c68b 100644 --- a/regamedll/msvc/ReGameDLL.vcxproj.filters +++ b/regamedll/msvc/ReGameDLL.vcxproj.filters @@ -40,9 +40,6 @@ {73fb61d4-c4ca-4159-8967-0e98666e1d4d} - - {57885e8e-0086-47a7-8dc8-7706a51e1067} - {1d2d9bb7-4ba0-4fe6-a0d9-6fae9f96ec3c} @@ -82,6 +79,12 @@ {e0c6021c-de51-464f-b971-89942190e545} + + {8f5a4004-ab6b-4802-a23b-091948576ad0} + + + {00d15c50-66d7-4210-9239-e8cd8fb9f052} + @@ -99,15 +102,6 @@ regamedll - - public\tier0 - - - public\tier0 - - - public\tier0 - dlls @@ -564,6 +558,18 @@ dlls + + regamedll + + + regamedll + + + regamedll + + + public\tier0 + @@ -668,27 +674,6 @@ dlls - - public\tier0 - - - public\tier0 - - - public\tier0 - - - public\tier0 - - - public\tier0 - - - public\tier0 - - - public\tier0 - regamedll @@ -1127,6 +1112,30 @@ hookers\stl + + regamedll + + + regamedll + + + regamedll + + + public\regamedll + + + public\regamedll + + + public\regamedll + + + public\tier0 + + + public\tier0 + diff --git a/regamedll/pm_shared/pm_shared.cpp b/regamedll/pm_shared/pm_shared.cpp index cfcb3682..83120358 100644 --- a/regamedll/pm_shared/pm_shared.cpp +++ b/regamedll/pm_shared/pm_shared.cpp @@ -155,7 +155,7 @@ void PM_InitTextureTypes(void) } /* <2cc7c5> ../cstrike/pm_shared/pm_shared.c:283 */ -char PM_FindTextureType(char *name) +char EXT_FUNC PM_FindTextureType(char *name) { int left, right, pivot; int val; @@ -506,13 +506,13 @@ void PM_UpdateStepSound(void) } } - if (pmove->flags & FL_DUCKING || fLadder) + if ((pmove->flags & FL_DUCKING) || fLadder) { pmove->flTimeStepSound += 100; // slower step time if ducking // play the sound // 35% volume if ducking - if (pmove->flags & FL_DUCKING && pmove->flDuckTime < 950.0) + if ((pmove->flags & FL_DUCKING) && pmove->flDuckTime < 950.0) { fvol *= 0.35; } @@ -3159,7 +3159,7 @@ void PM_CreateStuckTable(void) // and client. This will ensure that prediction behaves appropriately. /* <2ce182> ../cstrike/pm_shared/pm_shared.c:3596 */ -void PM_Move(struct playermove_s *ppmove, int server) +void EXT_FUNC PM_Move(struct playermove_s *ppmove, int server) { assert(pm_shared_initialized); @@ -3201,7 +3201,7 @@ NOXREF int PM_GetPhysEntInfo(int ent) } /* <2ce21b> ../cstrike/pm_shared/pm_shared.c:3638 */ -void PM_Init(struct playermove_s *ppmove) +void EXT_FUNC PM_Init(struct playermove_s *ppmove) { assert(!pm_shared_initialized); diff --git a/regamedll/public/MemPool.cpp b/regamedll/public/MemPool.cpp index e858f9e3..7856a0bc 100644 --- a/regamedll/public/MemPool.cpp +++ b/regamedll/public/MemPool.cpp @@ -1,100 +1,100 @@ -#include "precompiled.h" - +#include "precompiled.h" + /* <3fea40> ../public/MemPool.cpp:35 */ CMemoryPool::CMemoryPool(int blockSize, int numElements) { - _blocksPerBlob = numElements; - _blockSize = blockSize; - _numBlobs = 0; - _numElements = 0; - - AddNewBlob(); - - _peakAlloc = 0; + _blocksPerBlob = numElements; + _blockSize = blockSize; + _numBlobs = 0; + _numElements = 0; + + AddNewBlob(); + + _peakAlloc = 0; _blocksAllocated = 0; -} - -/* <3fe967> ../public/MemPool.cpp:52 */ -CMemoryPool::~CMemoryPool(void) -{ - for (int i = 0; i < _numBlobs; i++) - free(_memBlob[i]); -} - -/* <3fe99c> ../public/MemPool.cpp:109 */ -void CMemoryPool::AddNewBlob(void) -{ - int sizeMultiplier = pow(2.0, _numBlobs); - int nElements = _blocksPerBlob * sizeMultiplier; - int blobSize = _blockSize * nElements; - - _memBlob[_numBlobs] = malloc(blobSize); - -#ifdef _WIN32 - if (!_memBlob[_numBlobs]) - DebugBreak(); -#endif // _WIN32 - - _headOfFreeList = _memBlob[_numBlobs]; - -#ifdef _WIN32 - if (!_headOfFreeList) - DebugBreak(); -#endif // _WIN32 - - void **newBlob = (void **)_headOfFreeList; - for (int j = 0; j < nElements - 1; j++) - { - newBlob[0] = (char *)newBlob + _blockSize; - newBlob = (void **)newBlob[0]; - } - - newBlob[0] = NULL; - - _numElements += nElements; - _numBlobs++; - -#ifdef _WIN32 - if (_numBlobs >= MAX_BLOBS - 1) - DebugBreak(); -#endif // _WIN32 - -} - -/* <3fea72> ../public/MemPool.cpp:157 */ -void *CMemoryPool::Alloc(unsigned int amount) -{ - void *returnBlock; - if (amount > (unsigned int)_blockSize) - return NULL; - - _blocksAllocated++; - _peakAlloc = Q_max(_peakAlloc, _blocksAllocated); - - if (_blocksAllocated >= _numElements) - AddNewBlob(); - -#ifdef _WIN32 - if (!_headOfFreeList) - DebugBreak(); -#endif // _WIN32 - - returnBlock = _headOfFreeList; - _headOfFreeList = *((void **)_headOfFreeList); - return returnBlock; -} - -/* <3feabe> ../public/MemPool.cpp:193 */ -void CMemoryPool::Free(void *memblock) -{ - if (!memblock) - return; - -#ifdef _DEBUG - Q_memset(memblock, 0xDD, _blockSize); -#endif // _DEBUG - - _blocksAllocated--; - *((void **)memblock) = _headOfFreeList; - _headOfFreeList = memblock; -} +} + +/* <3fe967> ../public/MemPool.cpp:52 */ +CMemoryPool::~CMemoryPool(void) +{ + for (int i = 0; i < _numBlobs; i++) + free(_memBlob[i]); +} + +/* <3fe99c> ../public/MemPool.cpp:109 */ +void CMemoryPool::AddNewBlob(void) +{ + int sizeMultiplier = pow(2.0, _numBlobs); + int nElements = _blocksPerBlob * sizeMultiplier; + int blobSize = _blockSize * nElements; + + _memBlob[_numBlobs] = malloc(blobSize); + +#ifdef _WIN32 + if (!_memBlob[_numBlobs]) + DebugBreak(); +#endif // _WIN32 + + _headOfFreeList = _memBlob[_numBlobs]; + +#ifdef _WIN32 + if (!_headOfFreeList) + DebugBreak(); +#endif // _WIN32 + + void **newBlob = (void **)_headOfFreeList; + for (int j = 0; j < nElements - 1; j++) + { + newBlob[0] = (char *)newBlob + _blockSize; + newBlob = (void **)newBlob[0]; + } + + newBlob[0] = NULL; + + _numElements += nElements; + _numBlobs++; + +#ifdef _WIN32 + if (_numBlobs >= MAX_BLOBS - 1) + DebugBreak(); +#endif // _WIN32 + +} + +/* <3fea72> ../public/MemPool.cpp:157 */ +void *CMemoryPool::Alloc(unsigned int amount) +{ + void *returnBlock; + if (amount > (unsigned int)_blockSize) + return NULL; + + _blocksAllocated++; + _peakAlloc = Q_max(_peakAlloc, _blocksAllocated); + + if (_blocksAllocated >= _numElements) + AddNewBlob(); + +#ifdef _WIN32 + if (!_headOfFreeList) + DebugBreak(); +#endif // _WIN32 + + returnBlock = _headOfFreeList; + _headOfFreeList = *((void **)_headOfFreeList); + return returnBlock; +} + +/* <3feabe> ../public/MemPool.cpp:193 */ +void CMemoryPool::Free(void *memblock) +{ + if (!memblock) + return; + +#ifdef _DEBUG + Q_memset(memblock, 0xDD, _blockSize); +#endif // _DEBUG + + _blocksAllocated--; + *((void **)memblock) = _headOfFreeList; + _headOfFreeList = memblock; +} diff --git a/regamedll/public/regamedll/hookchains.h b/regamedll/public/regamedll/hookchains.h new file mode 100644 index 00000000..599c4c7c --- /dev/null +++ b/regamedll/public/regamedll/hookchains.h @@ -0,0 +1,69 @@ +/* +* +* This program is free software; you can redistribute it and/or modify it +* under the terms of the GNU General Public License as published by the +* Free Software Foundation; either version 2 of the License, or (at +* your option) any later version. +* +* This program is distributed in the hope that it will be useful, but +* WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +* General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with this program; if not, write to the Free Software Foundation, +* Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +* +* In addition, as a special exception, the author gives permission to +* link the code of this program with the Half-Life Game Engine ("HL +* Engine") and Modified Game Libraries ("MODs") developed by Valve, +* L.L.C ("Valve"). You must obey the GNU General Public License in all +* respects for all of the code used other than the HL Engine and MODs +* from Valve. If you modify this file, you may extend this exception +* to your version of the file, but you are not obligated to do so. If +* you do not wish to do so, delete this exception statement from your +* version. +* +*/ +#pragma once + +template +class IHookChain { +protected: + virtual ~IHookChain() {} + +public: + virtual t_ret callNext(t_args... args) = 0; + virtual t_ret callOriginal(t_args... args) = 0; +}; + +template +class IVoidHookChain +{ +protected: + virtual ~IVoidHookChain() {} + +public: + virtual void callNext(t_args... args) = 0; + virtual void callOriginal(t_args... args) = 0; +}; + +// Hook chain registry(for hooks [un]registration) +template +class IHookChainRegistry { +public: + typedef t_ret(*hookfunc_t)(IHookChain*, t_args...); + + virtual void registerHook(hookfunc_t hook) = 0; + virtual void unregisterHook(hookfunc_t hook) = 0; +}; + +// Hook chain registry(for hooks [un]registration) +template +class IVoidHookChainRegistry { +public: + typedef void(*hookfunc_t)(IVoidHookChain*, t_args...); + + virtual void registerHook(hookfunc_t hook) = 0; + virtual void unregisterHook(hookfunc_t hook) = 0; +}; diff --git a/regamedll/public/regamedll/regamedll_api.h b/regamedll/public/regamedll/regamedll_api.h new file mode 100644 index 00000000..8254d2b3 --- /dev/null +++ b/regamedll/public/regamedll/regamedll_api.h @@ -0,0 +1,68 @@ +/* +* +* This program is free software; you can redistribute it and/or modify it +* under the terms of the GNU General Public License as published by the +* Free Software Foundation; either version 2 of the License, or (at +* your option) any later version. +* +* This program is distributed in the hope that it will be useful, but +* WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +* General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with this program; if not, write to the Free Software Foundation, +* Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +* +* In addition, as a special exception, the author gives permission to +* link the code of this program with the Half-Life Game Engine ("HL +* Engine") and Modified Game Libraries ("MODs") developed by Valve, +* L.L.C ("Valve"). You must obey the GNU General Public License in all +* respects for all of the code used other than the HL Engine and MODs +* from Valve. If you modify this file, you may extend this exception +* to your version of the file, but you are not obligated to do so. If +* you do not wish to do so, delete this exception statement from your +* version. +* +*/ +#pragma once +#include "archtypes.h" +#include "regamedll_interfaces.h" +#include "hookchains.h" +#include "interface.h" + +#define REGAMEDLL_API_VERSION_MAJOR 1 +#define REGAMEDLL_API_VERSION_MINOR 0 + +// Observer_IsValidTarget hook +typedef IHookChain IReGameHook_Observer_IsValidTarget; +typedef IHookChainRegistry IReGameHookRegistry_Observer_IsValidTarget; + +// GetForceCamera hook +typedef IHookChain IReGameHook_GetForceCamera; +typedef IHookChainRegistry IReGameHookRegistry_GetForceCamera; + +class IReGameHookchains { +public: + virtual ~IReGameHookchains() { } + + virtual IReGameHookRegistry_Observer_IsValidTarget* Observer_IsValidTarget() = 0; + virtual IReGameHookRegistry_GetForceCamera* GetForceCamera() = 0; +}; + +struct ReGameFuncs_t { + class CBaseEntity *(*UTIL_PlayerByIndex)(int playerIndex); +}; + +class IReGameApi { +public: + virtual ~IReGameApi() { } + + virtual int GetMajorVersion() = 0; + virtual int GetMinorVersion() = 0; + virtual const ReGameFuncs_t* GetFuncs() = 0; + virtual IReGameHookchains* GetHookchains() = 0; + +}; + +#define VREHLDS_HLDS_API_VERSION "VRE_GAMEDLL_API_VERSION001" diff --git a/regamedll/public/regamedll/regamedll_interfaces.h b/regamedll/public/regamedll/regamedll_interfaces.h new file mode 100644 index 00000000..60cc3782 --- /dev/null +++ b/regamedll/public/regamedll/regamedll_interfaces.h @@ -0,0 +1,28 @@ +/* +* +* This program is free software; you can redistribute it and/or modify it +* under the terms of the GNU General Public License as published by the +* Free Software Foundation; either version 2 of the License, or (at +* your option) any later version. +* +* This program is distributed in the hope that it will be useful, but +* WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +* General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with this program; if not, write to the Free Software Foundation, +* Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +* +* In addition, as a special exception, the author gives permission to +* link the code of this program with the Half-Life Game Engine ("HL +* Engine") and Modified Game Libraries ("MODs") developed by Valve, +* L.L.C ("Valve"). You must obey the GNU General Public License in all +* respects for all of the code used other than the HL Engine and MODs +* from Valve. If you modify this file, you may extend this exception +* to your version of the file, but you are not obligated to do so. If +* you do not wish to do so, delete this exception statement from your +* version. +* +*/ +#pragma once diff --git a/regamedll/public/tier0/fasttimer.h b/regamedll/public/tier0/fasttimer.h deleted file mode 100644 index d6ef9790..00000000 --- a/regamedll/public/tier0/fasttimer.h +++ /dev/null @@ -1,424 +0,0 @@ -//========= Copyright © 1996-2001, Valve LLC, All rights reserved. ============ -// -// Purpose: -// -// $NoKeywords: $ -//============================================================================= - -#ifndef FASTTIMER_H -#define FASTTIMER_H -#ifdef _WIN32 -#pragma once -#endif - -#include "osconfig.h" -#include "tier0/platform.h" - - -PLATFORM_INTERFACE __int64 g_ClockSpeed; -PLATFORM_INTERFACE unsigned long g_dwClockSpeed; - -PLATFORM_INTERFACE double g_ClockSpeedMicrosecondsMultiplier; -PLATFORM_INTERFACE double g_ClockSpeedMillisecondsMultiplier; -PLATFORM_INTERFACE double g_ClockSpeedSecondsMultiplier; - - - -class CCycleCount -{ - friend class CFastTimer; - - -public: - CCycleCount(); - - void Sample(); // Sample the clock. This takes about 34 clocks to execute (or 26,000 calls per millisecond on a P900). - - void Init(); // Set to zero. - void Init(float initTimeMsec); - bool IsLessThan(CCycleCount const &other) const; // Compare two counts. - - // Convert to other time representations. These functions are slow, so it's preferable to call them - // during display rather than inside a timing block. - unsigned long GetCycles() const; - - unsigned long GetMicroseconds() const; - double GetMicrosecondsF() const; - - unsigned long GetMilliseconds() const; - double GetMillisecondsF() const; - - double GetSeconds() const; - - CCycleCount& operator+=(CCycleCount const &other); - - // dest = rSrc1 + rSrc2 - static void Add(CCycleCount const &rSrc1, CCycleCount const &rSrc2, CCycleCount &dest); // Add two samples together. - - // dest = rSrc1 - rSrc2 - static void Sub(CCycleCount const &rSrc1, CCycleCount const &rSrc2, CCycleCount &dest); // Add two samples together. - - - __int64 m_Int64; -}; - -class CClockSpeedInit -{ -public: - CClockSpeedInit() - { - Init(); - } - - static void Init() - { - const CPUInformation& pi = GetCPUInformation(); - - g_ClockSpeed = pi.m_Speed; - g_dwClockSpeed = (unsigned long)g_ClockSpeed; - - g_ClockSpeedMicrosecondsMultiplier = 1000000.0 / (double)g_ClockSpeed; - g_ClockSpeedMillisecondsMultiplier = 1000.0 / (double)g_ClockSpeed; - g_ClockSpeedSecondsMultiplier = 1.0f / (double)g_ClockSpeed; - } - -}; - -class CFastTimer -{ -public: - // These functions are fast to call and should be called from your sampling code. - void Start(); - void End(); - - const CCycleCount & GetDuration() const; // Get the elapsed time between Start and End calls. - CCycleCount GetDurationInProgress() const; // Call without ending. Not that cheap. - - // Return number of cycles per second on this processor. - static inline unsigned long GetClockSpeed(); - -private: - - CCycleCount m_Duration; -}; - - -// This is a helper class that times whatever block of code it's in -class CTimeScope -{ -public: - CTimeScope(CFastTimer *pTimer); - ~CTimeScope(); - -private: - CFastTimer *m_pTimer; -}; - -inline CTimeScope::CTimeScope(CFastTimer *pTotal) -{ - m_pTimer = pTotal; - m_pTimer->Start(); -} - -inline CTimeScope::~CTimeScope() -{ - m_pTimer->End(); -} - -// This is a helper class that times whatever block of code it's in and -// adds the total (int microseconds) to a global counter. -class CTimeAdder -{ -public: - CTimeAdder(CCycleCount *pTotal); - ~CTimeAdder(); - - void End(); - -private: - CCycleCount *m_pTotal; - CFastTimer m_Timer; -}; - -inline CTimeAdder::CTimeAdder(CCycleCount *pTotal) -{ - m_pTotal = pTotal; - m_Timer.Start(); -} - -inline CTimeAdder::~CTimeAdder() -{ - End(); -} - -inline void CTimeAdder::End() -{ - if (m_pTotal) - { - m_Timer.End(); - *m_pTotal += m_Timer.GetDuration(); - m_pTotal = 0; - } -} - - - -// -------------------------------------------------------------------------- // -// Simple tool to support timing a block of code, and reporting the results on -// program exit -// -------------------------------------------------------------------------- // - -#define PROFILE_SCOPE(name) \ - class C##name##ACC : public CAverageCycleCounter \ - { \ - public: \ - ~C##name##ACC() \ - { \ - Msg("%-48s: %6.3f avg (%8.1f total, %7.3f peak, %5d iters)\n", \ - #name, \ - GetAverageMilliseconds(), \ - GetTotalMilliseconds(), \ - GetPeakMilliseconds(), \ - GetIters() ); \ - } \ - }; \ - static C##name##ACC name##_ACC; \ - CAverageTimeMarker name##_ATM( &name##_ACC ) - -// -------------------------------------------------------------------------- // - -class CAverageCycleCounter -{ -public: - CAverageCycleCounter(); - - void Init(); - void MarkIter(const CCycleCount &duration); - - unsigned GetIters() const; - - double GetAverageMilliseconds() const; - double GetTotalMilliseconds() const; - double GetPeakMilliseconds() const; - -private: - unsigned m_nIters; - CCycleCount m_Total; - CCycleCount m_Peak; - bool m_fReport; - const char *m_pszName; -}; - -// -------------------------------------------------------------------------- // - -class CAverageTimeMarker -{ -public: - CAverageTimeMarker(CAverageCycleCounter *pCounter); - ~CAverageTimeMarker(); - -private: - CAverageCycleCounter *m_pCounter; - CFastTimer m_Timer; -}; -// -------------------------------------------------------------------------- // -// CCycleCount inlines. -// -------------------------------------------------------------------------- // - -inline CCycleCount::CCycleCount() -{ - m_Int64 = 0; -} - -inline void CCycleCount::Init() -{ - m_Int64 = 0; -} - -inline void CCycleCount::Init(float initTimeMsec) -{ - if (g_ClockSpeedMillisecondsMultiplier > 0) - m_Int64 = initTimeMsec / g_ClockSpeedMillisecondsMultiplier; - else - m_Int64 = 0; -} - -inline void CCycleCount::Sample() -{ - unsigned long* pSample = (unsigned long *)&m_Int64; - __asm - { - // force the cpu to synchronize the instruction queue - // NJS: CPUID can really impact performance in tight loops. - //cpuid - //cpuid - //cpuid - mov ecx, pSample - rdtsc - mov[ecx], eax - mov[ecx + 4], edx - } -} - - -inline CCycleCount& CCycleCount::operator+=(CCycleCount const &other) -{ - m_Int64 += other.m_Int64; - return *this; -} - - -inline void CCycleCount::Add(CCycleCount const &rSrc1, CCycleCount const &rSrc2, CCycleCount &dest) -{ - dest.m_Int64 = rSrc1.m_Int64 + rSrc2.m_Int64; -} - -inline void CCycleCount::Sub(CCycleCount const &rSrc1, CCycleCount const &rSrc2, CCycleCount &dest) -{ - dest.m_Int64 = rSrc1.m_Int64 - rSrc2.m_Int64; -} - -inline bool CCycleCount::IsLessThan(CCycleCount const &other) const -{ - return m_Int64 < other.m_Int64; -} - - -inline unsigned long CCycleCount::GetCycles() const -{ - return (unsigned long)m_Int64; -} - - -inline unsigned long CCycleCount::GetMicroseconds() const -{ - return (unsigned long)((m_Int64 * 1000000) / g_ClockSpeed); -} - - -inline double CCycleCount::GetMicrosecondsF() const -{ - return (double)(m_Int64 * g_ClockSpeedMicrosecondsMultiplier); -} - - -inline unsigned long CCycleCount::GetMilliseconds() const -{ - return (unsigned long)((m_Int64 * 1000) / g_ClockSpeed); -} - - -inline double CCycleCount::GetMillisecondsF() const -{ - return (double)(m_Int64 * g_ClockSpeedMillisecondsMultiplier); -} - - -inline double CCycleCount::GetSeconds() const -{ - return (double)(m_Int64 * g_ClockSpeedSecondsMultiplier); -} - - -// -------------------------------------------------------------------------- // -// CFastTimer inlines. -// -------------------------------------------------------------------------- // -inline void CFastTimer::Start() -{ - m_Duration.Sample(); -} - - -inline void CFastTimer::End() -{ - CCycleCount cnt; - cnt.Sample(); - m_Duration.m_Int64 = cnt.m_Int64 - m_Duration.m_Int64; -} - -inline CCycleCount CFastTimer::GetDurationInProgress() const -{ - CCycleCount cnt; - cnt.Sample(); - - CCycleCount result; - result.m_Int64 = cnt.m_Int64 - m_Duration.m_Int64; - - return result; -} - - -inline unsigned long CFastTimer::GetClockSpeed() -{ - return g_dwClockSpeed; -} - - -inline CCycleCount const& CFastTimer::GetDuration() const -{ - return m_Duration; -} - - -// -------------------------------------------------------------------------- // -// CAverageCycleCounter inlines - -inline CAverageCycleCounter::CAverageCycleCounter() - : m_nIters(0) -{ -} - -inline void CAverageCycleCounter::Init() -{ - m_Total.Init(); - m_Peak.Init(); - m_nIters = 0; -} - -inline void CAverageCycleCounter::MarkIter(const CCycleCount &duration) -{ - ++m_nIters; - m_Total += duration; - if (m_Peak.IsLessThan(duration)) - m_Peak = duration; -} - -inline unsigned CAverageCycleCounter::GetIters() const -{ - return m_nIters; -} - -inline double CAverageCycleCounter::GetAverageMilliseconds() const -{ - if (m_nIters) - return (m_Total.GetMillisecondsF() / (double)m_nIters); - else - return 0; -} - -inline double CAverageCycleCounter::GetTotalMilliseconds() const -{ - return m_Total.GetMillisecondsF(); -} - -inline double CAverageCycleCounter::GetPeakMilliseconds() const -{ - return m_Peak.GetMillisecondsF(); -} - -// -------------------------------------------------------------------------- // - -inline CAverageTimeMarker::CAverageTimeMarker(CAverageCycleCounter *pCounter) -{ - m_pCounter = pCounter; - m_Timer.Start(); -} - -inline CAverageTimeMarker::~CAverageTimeMarker() -{ - m_Timer.End(); - m_pCounter->MarkIter(m_Timer.GetDuration()); -} - - -#endif // FASTTIMER_H \ No newline at end of file diff --git a/regamedll/public/tier0/mem.h b/regamedll/public/tier0/mem.h deleted file mode 100644 index 5171ffee..00000000 --- a/regamedll/public/tier0/mem.h +++ /dev/null @@ -1,37 +0,0 @@ -//========= Copyright © 1996-2001, Valve LLC, All rights reserved. ============ -// -// Purpose: Memory allocation! -// -// $NoKeywords: $ -//============================================================================= - -#ifndef TIER0_MEM_H -#define TIER0_MEM_H - -#ifdef _WIN32 -#pragma once -#endif - -#include "osconfig.h" -#include -#include "tier0/platform.h" - -#ifdef TIER0_DLL_EXPORT -# define MEM_INTERFACE DLL_EXPORT -#else -# define MEM_INTERFACE DLL_IMPORT -#endif - - -//----------------------------------------------------------------------------- -// DLL-exported methods for particular kinds of memory -//----------------------------------------------------------------------------- -MEM_INTERFACE void *MemAllocScratch(int nMemSize); -MEM_INTERFACE void MemFreeScratch(); - -#ifdef __linux__ -MEM_INTERFACE void ZeroMemory(void *mem, size_t length); -#endif - - -#endif /* TIER0_MEM_H */ diff --git a/regamedll/public/tier0/memalloc.h b/regamedll/public/tier0/memalloc.h deleted file mode 100644 index 165d6d1e..00000000 --- a/regamedll/public/tier0/memalloc.h +++ /dev/null @@ -1,77 +0,0 @@ -//========= Copyright © 1996-2001, Valve LLC, All rights reserved. ============ -// -// Purpose: This header should never be used directly from leaf code!!! -// Instead, just add the file memoverride.cpp into your project and all this -// will automagically be used -// -// $NoKeywords: $ -//============================================================================= - -#ifndef TIER0_MEMALLOC_H -#define TIER0_MEMALLOC_H - -#ifdef _WIN32 -#pragma once -#endif - -#include "osconfig.h" -#include -#include "tier0/mem.h" - -struct _CrtMemState; - -//----------------------------------------------------------------------------- -// NOTE! This should never be called directly from leaf code -// Just use new,delete,malloc,free etc. They will call into this eventually -//----------------------------------------------------------------------------- -class IMemAlloc -{ -public: - // Release versions - virtual void *Alloc(size_t nSize) = 0; - virtual void *Realloc(void *pMem, size_t nSize) = 0; - virtual void Free(void *pMem) = 0; - virtual void *Expand(void *pMem, size_t nSize) = 0; - - // Debug versions - virtual void *Alloc(size_t nSize, const char *pFileName, int nLine) = 0; - virtual void *Realloc(void *pMem, size_t nSize, const char *pFileName, int nLine) = 0; - virtual void Free(void *pMem, const char *pFileName, int nLine) = 0; - virtual void *Expand(void *pMem, size_t nSize, const char *pFileName, int nLine) = 0; - - // Returns size of a particular allocation - virtual size_t GetSize(void *pMem) = 0; - - // Force file + line information for an allocation - virtual void PushAllocDbgInfo(const char *pFileName, int nLine) = 0; - virtual void PopAllocDbgInfo() = 0; - - // FIXME: Remove when we have our own allocator - // these methods of the Crt debug code is used in our codebase currently - virtual long CrtSetBreakAlloc(long lNewBreakAlloc) = 0; - virtual int CrtSetReportMode(int nReportType, int nReportMode) = 0; - virtual int CrtIsValidHeapPointer(const void *pMem) = 0; - virtual int CrtCheckMemory(void) = 0; - virtual int CrtSetDbgFlag(int nNewFlag) = 0; - virtual void CrtMemCheckpoint(_CrtMemState *pState) = 0; - - // FIXME: Make a better stats interface - virtual void DumpStats() = 0; - - // FIXME: Remove when we have our own allocator - virtual void* CrtSetReportFile(int nRptType, void* hFile) = 0; - virtual void* CrtSetReportHook(void* pfnNewHook) = 0; - virtual int CrtDbgReport(int nRptType, const char * szFile, - int nLine, const char * szModule, const char * pMsg) = 0; - - virtual int heapchk() = 0; -}; - - -//----------------------------------------------------------------------------- -// Singleton interface -//----------------------------------------------------------------------------- -IMemAlloc *g_pMemAlloc; - - -#endif /* TIER0_MEMALLOC_H */ diff --git a/regamedll/public/tier0/memdbgoff.h b/regamedll/public/tier0/memdbgoff.h deleted file mode 100644 index 7abf9e82..00000000 --- a/regamedll/public/tier0/memdbgoff.h +++ /dev/null @@ -1,21 +0,0 @@ -//========= Copyright © 1996-2003, Valve LLC, All rights reserved. ============ -// -// Purpose: This header, which must be the final line of a .h file, -// causes all crt methods to stop using debugging versions of the memory allocators. -// NOTE: Use memdbgon.h to re-enable memory debugging. -// -// $NoKeywords: $ -//============================================================================= - -#ifdef MEM_DEBUG_ON - -#undef malloc -#undef realloc -#undef calloc -#undef free -#undef _expand -#undef _msize -#undef new -#undef MEM_DEBUG_ON - -#endif diff --git a/regamedll/public/tier0/memdbgon.h b/regamedll/public/tier0/memdbgon.h deleted file mode 100644 index 3090b8f9..00000000 --- a/regamedll/public/tier0/memdbgon.h +++ /dev/null @@ -1,93 +0,0 @@ -//========= Copyright © 1996-2003, Valve LLC, All rights reserved. ============ -// -// Purpose: This header, which must be the final include in a .cpp (or .h) file, -// causes all crt methods to use debugging versions of the memory allocators. -// NOTE: Use memdbgoff.h to disable memory debugging. -// -// $NoKeywords: $ -//============================================================================= - -// SPECIAL NOTE! This file must *not* use include guards; we need to be able -// to include this potentially multiple times (since we can deactivate debugging -// by including memdbgoff.h) - -// SPECIAL NOTE #2: This must be the final include in a .cpp or .h file!!! -#include "osconfig.h" - -#ifdef _DEBUG - -#include -#include -#include -#include - -#include "tier0/memdbgoff.h" - -#define MEM_DEBUG_ON 1 - -#undef malloc -#undef realloc -#undef calloc -#undef _expand -#undef free -#undef _msize - -#define malloc(s) _malloc_dbg(s, _NORMAL_BLOCK, __FILE__, __LINE__) -#define calloc(c, s) _calloc_dbg(c, s, _NORMAL_BLOCK, __FILE__, __LINE__) -#define realloc(p, s) _realloc_dbg(p, s, _NORMAL_BLOCK, __FILE__, __LINE__) -#define free(p) _free_dbg(p, _NORMAL_BLOCK) -#define _msize(p) _msize_dbg(p, _NORMAL_BLOCK) -#define _expand(p, s) _expand_dbg(p, s, _NORMAL_BLOCK, __FILE__, __LINE__) - - -#if defined(__AFX_H__) && defined(DEBUG_NEW) -#define new DEBUG_NEW -#else -#undef new -#define MEMALL_DEBUG_NEW new(_NORMAL_BLOCK, __FILE__, __LINE__) -#define new MEMALL_DEBUG_NEW -#endif - -#undef _strdup -#undef strdup -#undef _wcsdup -#undef wcsup - -#define _strdup(s) strdup_dbg(s, __FILE__, __LINE__) -#define strdup(s) strdup_dbg(s, __FILE__, __LINE__) -#define _wcsdup(s) wcsdup_dbg(s, __FILE__, __LINE__) -#define wcsdup(s) wcsdup_dbg(s, __FILE__, __LINE__) - -// Make sure we don't define strdup twice -#ifndef MEM_DBG_DEFINED_STRDUP -#define MEM_DBG_DEFINED_STRDUP 1 - -inline char *strdup_dbg(const char *pString, const char *pFileName, unsigned nLine) -{ - char *pMemory; - - if (!pString) - return NULL; - - if ((pMemory = (char *)_malloc_dbg(strlen(pString) + 1, _NORMAL_BLOCK, pFileName, nLine)) != NULL) - return strcpy(pMemory, pString); - - return NULL; -} - -inline wchar_t *wcsdup_dbg(const wchar_t *pString, const char *pFileName, unsigned nLine) -{ - wchar_t *pMemory; - - if (!pString) - return NULL; - - if ((pMemory = (wchar_t *)_malloc_dbg((wcslen(pString) + 1) * sizeof(wchar_t), _NORMAL_BLOCK, pFileName, nLine)) != NULL) - return wcscpy(pMemory, pString); - - return NULL; -} - -#endif // DBMEM_DEFINED_STRDUP - -#endif // _DEBUG diff --git a/regamedll/public/tier0/platform_linux.cpp b/regamedll/public/tier0/platform_linux.cpp deleted file mode 100644 index 079902a1..00000000 --- a/regamedll/public/tier0/platform_linux.cpp +++ /dev/null @@ -1,66 +0,0 @@ -//========= Copyright © 1996-2002, Valve LLC, All rights reserved. ============ -// -// Purpose: -// -// $NoKeywords: $ -//============================================================================= - -#include "precompiled.h" -#include "tier0/platform.h" -#include "tier0/memalloc.h" -#include "tier0/dbg.h" - -#include -#include - - -double Plat_FloatTime() -{ - struct timeval tp; - static int secbase = 0; - - gettimeofday(&tp, NULL); - - if (!secbase) - { - secbase = tp.tv_sec; - return (tp.tv_usec / 1000000.0); - } - - return ((tp.tv_sec - secbase) + tp.tv_usec / 1000000.0); -} - -unsigned long Plat_MSTime() -{ - struct timeval tp; - static int secbase = 0; - - gettimeofday(&tp, NULL); - - if (!secbase) - { - secbase = tp.tv_sec; - return (tp.tv_usec / 1000000.0); - } - - return (unsigned long)((tp.tv_sec - secbase) + tp.tv_usec / 1000000.0); - -} - - - -bool vtune(bool resume) -{ - return true; -} - - -// -------------------------------------------------------------------------------------------------- // -// Memory stuff. -// -------------------------------------------------------------------------------------------------- // - - -void Plat_SetThreadName(unsigned long dwThreadID, const char *pName) -{ - Assert("Plat_SetThreadName not implemented"); -} diff --git a/regamedll/public/tier0/platform_win32.cpp b/regamedll/public/tier0/platform_win32.cpp deleted file mode 100644 index 4b56f4c9..00000000 --- a/regamedll/public/tier0/platform_win32.cpp +++ /dev/null @@ -1,81 +0,0 @@ -#include "precompiled.h" -#include "tier0/platform.h" -#include "tier0/memalloc.h" - -// memdbgon must be the last include file in a .cpp file!!! -#include "tier0/memdbgon.h" - -static LARGE_INTEGER g_PerformanceFrequency; -static LARGE_INTEGER g_MSPerformanceFrequency; -static LARGE_INTEGER g_ClockStart; - -static void InitTime() -{ - if (!g_PerformanceFrequency.QuadPart) - { - QueryPerformanceFrequency(&g_PerformanceFrequency); - g_MSPerformanceFrequency.QuadPart = g_PerformanceFrequency.QuadPart / 1000; - QueryPerformanceCounter(&g_ClockStart); - } -} - -double Plat_FloatTime() -{ - InitTime(); - - LARGE_INTEGER CurrentTime; - - QueryPerformanceCounter(&CurrentTime); - - double fRawSeconds = (double)(CurrentTime.QuadPart - g_ClockStart.QuadPart) / (double)(g_PerformanceFrequency.QuadPart); - - return fRawSeconds; -} - -unsigned long Plat_MSTime() -{ - InitTime(); - - LARGE_INTEGER CurrentTime; - - QueryPerformanceCounter(&CurrentTime); - - return (unsigned long)((CurrentTime.QuadPart - g_ClockStart.QuadPart) / g_MSPerformanceFrequency.QuadPart); -} - -bool vtune(bool resume) -{ - static bool bInitialized = false; - static void(__cdecl *VTResume)(void) = NULL; - static void(__cdecl *VTPause) (void) = NULL; - - // Grab the Pause and Resume function pointers from the VTune DLL the first time through: - if (!bInitialized) - { - bInitialized = true; - - HINSTANCE pVTuneDLL = LoadLibrary("vtuneapi.dll"); - - if (pVTuneDLL) - { - VTResume = (void(__cdecl *)())GetProcAddress(pVTuneDLL, "VTResume"); - VTPause = (void(__cdecl *)())GetProcAddress(pVTuneDLL, "VTPause"); - } - } - - // Call the appropriate function, as indicated by the argument: - if (resume && VTResume) - { - VTResume(); - return true; - - } - else if (!resume && VTPause) - { - VTPause(); - return true; - } - - return false; - -} diff --git a/regamedll/public/trie1/dbg.h b/regamedll/public/trie1/dbg.h deleted file mode 100644 index 8e4f8de1..00000000 --- a/regamedll/public/trie1/dbg.h +++ /dev/null @@ -1,454 +0,0 @@ -//=========== (C) Copyright 1999 Valve, L.L.C. All rights reserved. =========== -// -// The copyright to the contents herein is the property of Valve, L.L.C. -// The contents may be used and/or copied only with the written permission of -// Valve, L.L.C., or in accordance with the terms and conditions stipulated in -// the agreement/contract under which the contents have been supplied. -// -// $Header: $ -// $NoKeywords: $ -// -// The main debug library interfaces -//============================================================================= - - -#ifndef DBG_H -#define DBG_H - -#ifdef _WIN32 -#pragma once -#endif - -#include "osconfig.h" -#include "basetypes.h" -#include "tier0/platform.h" -#include -#include -#include - - -//----------------------------------------------------------------------------- -// dll export stuff -//----------------------------------------------------------------------------- - -#ifdef TIER0_DLL_EXPORT -#define DBG_INTERFACE DLL_EXPORT -#define DBG_OVERLOAD DLL_GLOBAL_EXPORT -#define DBG_CLASS DLL_CLASS_EXPORT -#else -#define DBG_INTERFACE DLL_IMPORT -#define DBG_OVERLOAD DLL_GLOBAL_IMPORT -#define DBG_CLASS DLL_CLASS_IMPORT -#endif - - -//----------------------------------------------------------------------------- -// Usage model for the Dbg library -// -// 1. Spew. -// -// Spew can be used in a static and a dynamic mode. The static -// mode allows us to display assertions and other messages either only -// in debug builds, or in non-release builds. The dynamic mode allows us to -// turn on and off certain spew messages while the application is running. -// -// Static Spew messages: -// -// Assertions are used to detect and warn about invalid states -// Spews are used to display a particular status/warning message. -// -// To use an assertion, use -// -// Assert( (f == 5) ); -// AssertMsg( (f == 5), ("F needs to be %d here!\n", 5) ); -// AssertFunc( (f == 5), BadFunc() ); -// AssertEquals( f, 5 ); -// AssertFloatEquals( f, 5.0f, 1e-3 ); -// -// The first will simply report that an assertion failed on a particular -// code file and line. The second version will display a print-f formatted message -// along with the file and line, the third will display a generic message and -// will also cause the function BadFunc to be executed, and the last two -// will report an error if f is not equal to 5 (the last one asserts within -// a particular tolerance). -// -// To use a warning, use -// -// Warning("Oh I feel so %s all over\n", "yummy"); -// -// Warning will do its magic in only Debug builds. To perform spew in *all* -// builds, use RelWarning. -// -// Three other spew types, Msg, Log, and Error, are compiled into all builds. -// These error types do *not* need two sets of parenthesis. -// -// Msg( "Isn't this exciting %d?", 5 ); -// Error( "I'm just thrilled" ); -// -// Dynamic Spew messages -// -// It is possible to dynamically turn spew on and off. Dynamic spew is -// identified by a spew group and priority level. To turn spew on for a -// particular spew group, use SpewActivate( "group", level ). This will -// cause all spew in that particular group with priority levels <= the -// level specified in the SpewActivate function to be printed. Use DSpew -// to perform the spew: -// -// DWarning( "group", level, "Oh I feel even yummier!\n" ); -// -// Priority level 0 means that the spew will *always* be printed, and group -// '*' is the default spew group. If a DWarning is encountered using a group -// whose priority has not been set, it will use the priority of the default -// group. The priority of the default group is initially set to 0. -// -// Spew output -// -// The output of the spew system can be redirected to an externally-supplied -// function which is responsible for outputting the spew. By default, the -// spew is simply printed using printf. -// -// To redirect spew output, call SpewOutput. -// -// SpewOutputFunc( OutputFunc ); -// -// This will cause OutputFunc to be called every time a spew message is -// generated. OutputFunc will be passed a spew type and a message to print. -// It must return a value indicating whether the debugger should be invoked, -// whether the program should continue running, or whether the program -// should abort. -// -// 2. Code activation -// -// To cause code to be run only in debug builds, use DBG_CODE: -// An example is below. -// -// DBG_CODE( -// { -// int x = 5; -// ++x; -// } -// ); -// -// Code can be activated based on the dynamic spew groups also. Use -// -// DBG_DCODE( "group", level, -// { int x = 5; ++x; } -// ); -// -// 3. Breaking into the debugger. -// -// To cause an unconditional break into the debugger in debug builds only, use DBG_BREAK -// -// DBG_BREAK(); -// -// You can force a break in any build (release or debug) using -// -// DebuggerBreak(); -//----------------------------------------------------------------------------- - -/* Various types of spew messages */ -// I'm sure you're asking yourself why SPEW_ instead of DBG_ ? -// It's because DBG_ is used all over the place in windows.h -// For example, DBG_CONTINUE is defined. Feh. -enum SpewType_t -{ - SPEW_MESSAGE = 0, - SPEW_WARNING, - SPEW_ASSERT, - SPEW_ERROR, - SPEW_LOG, - - SPEW_TYPE_COUNT -}; - -enum SpewRetval_t -{ - SPEW_DEBUGGER = 0, - SPEW_CONTINUE, - SPEW_ABORT -}; - -/* type of externally defined function used to display debug spew */ -typedef SpewRetval_t(*SpewOutputFunc_t)(SpewType_t spewType, char const *pMsg); - -/* Used to redirect spew output */ -void SpewOutputFunc(SpewOutputFunc_t func); - -/* Used ot get the current spew output function */ -SpewOutputFunc_t GetSpewOutputFunc(void); - -/* Used to manage spew groups and subgroups */ -void SpewActivate(char const* pGroupName, int level); -bool IsSpewActive(char const* pGroupName, int level); - -/* Used to display messages, should never be called directly. */ -void _SpewInfo(SpewType_t type, char const* pFile, int line); -SpewRetval_t _SpewMessage(char const* pMsg, ...); -SpewRetval_t _DSpewMessage(char const *pGroupName, int level, char const* pMsg, ...); - -/* Used to define macros, never use these directly. */ -#define _Assert( _exp ) do { \ - if (!(_exp)) \ - { \ - _SpewInfo( SPEW_ASSERT, __FILE__, __LINE__ ); \ - if (_SpewMessage("Assertion Failed: " #_exp) == SPEW_DEBUGGER) \ - { \ - DebuggerBreak(); \ - } \ - } \ - } while (0) - -#define _AssertMsg( _exp, _msg ) do { \ - if (!(_exp)) \ - { \ - _SpewInfo( SPEW_ASSERT, __FILE__, __LINE__ ); \ - if (_SpewMessage(_msg) == SPEW_DEBUGGER) \ - { \ - DebuggerBreak(); \ - } \ - } \ - } while (0) - -#define _AssertFunc( _exp, _f ) do { \ - if (!(_exp)) \ - { \ - _SpewInfo( SPEW_ASSERT, __FILE__, __LINE__ ); \ - SpewRetval_t ret = _SpewMessage("Assertion Failed!" #_exp); \ - _f; \ - if (ret == SPEW_DEBUGGER) \ - { \ - DebuggerBreak(); \ - } \ - } \ - } while (0) - -#define _AssertEquals( _exp, _expectedValue ) \ - do { \ - if ((_exp) != (_expectedValue)) \ - { \ - _SpewInfo( SPEW_ASSERT, __FILE__, __LINE__ ); \ - SpewRetval_t ret = _SpewMessage("Expected %d but got %d!", (_expectedValue), (_exp)); \ - if (ret == SPEW_DEBUGGER) \ - { \ - DebuggerBreak(); \ - } \ - } \ - } while (0) - -#define _AssertFloatEquals( _exp, _expectedValue, _tol ) \ - do { \ - if (fabs((_exp) - (_expectedValue)) > (_tol)) \ - { \ - _SpewInfo( SPEW_ASSERT, __FILE__, __LINE__ ); \ - SpewRetval_t ret = _SpewMessage("Expected %f but got %f!", (_expectedValue), (_exp)); \ - if (ret == SPEW_DEBUGGER) \ - { \ - DebuggerBreak(); \ - } \ - } \ - } while (0) - -/* Spew macros... */ - -#ifdef _DEBUG - -#define Assert( _exp ) _Assert( _exp ) -#define AssertMsg( _exp, _msg ) _AssertMsg( _exp, _msg ) -#define AssertFunc( _exp, _f ) _AssertFunc( _exp, _f ) -#define AssertEquals( _exp, _expectedValue ) _AssertEquals( _exp, _expectedValue ) -#define AssertFloatEquals( _exp, _expectedValue, _tol ) _AssertFloatEquals( _exp, _expectedValue, _tol ) -#define Verify( _exp ) _Assert( _exp ) - -#define AssertMsg1( _exp, _msg, a1 ) _AssertMsg( _exp, CDbgFmtMsg( _msg, a1 ) ) -#define AssertMsg2( _exp, _msg, a1, a2 ) _AssertMsg( _exp, CDbgFmtMsg( _msg, a1, a2 ) ) -#define AssertMsg3( _exp, _msg, a1, a2, a3 ) _AssertMsg( _exp, CDbgFmtMsg( _msg, a1, a2, a3 ) ) -#define AssertMsg4( _exp, _msg, a1, a2, a3, a4 ) _AssertMsg( _exp, CDbgFmtMsg( _msg, a1, a2, a3, a4 ) ) -#define AssertMsg5( _exp, _msg, a1, a2, a3, a4, a5 ) _AssertMsg( _exp, CDbgFmtMsg( _msg, a1, a2, a3, a4, a5 ) ) -#define AssertMsg6( _exp, _msg, a1, a2, a3, a4, a5, a6 ) _AssertMsg( _exp, CDbgFmtMsg( _msg, a1, a2, a3, a4, a5, a6 ) ) -#define AssertMsg6( _exp, _msg, a1, a2, a3, a4, a5, a6 ) _AssertMsg( _exp, CDbgFmtMsg( _msg, a1, a2, a3, a4, a5, a6 ) ) -#define AssertMsg7( _exp, _msg, a1, a2, a3, a4, a5, a6, a7 ) _AssertMsg( _exp, CDbgFmtMsg( _msg, a1, a2, a3, a4, a5, a6, a7 ) ) -#define AssertMsg8( _exp, _msg, a1, a2, a3, a4, a5, a6, a7, a8 ) _AssertMsg( _exp, CDbgFmtMsg( _msg, a1, a2, a3, a4, a5, a6, a7, a8 ) ) -#define AssertMsg9( _exp, _msg, a1, a2, a3, a4, a5, a6, a7, a8, a9 ) _AssertMsg( _exp, CDbgFmtMsg( _msg, a1, a2, a3, a4, a5, a6, a7, a8, a9 ) ) - - -#else /* Not _DEBUG */ - -#define Assert( _exp ) ((void)0) -#define AssertMsg( _exp, _msg ) ((void)0) -#define AssertFunc( _exp, _f ) ((void)0) -#define AssertEquals( _exp, _expectedValue ) ((void)0) -#define AssertFloatEquals( _exp, _expectedValue, _tol ) ((void)0) -#define Verify( _exp ) (_exp) - -#define AssertMsg1( _exp, _msg, a1 ) ((void)0) -#define AssertMsg2( _exp, _msg, a1, a2 ) ((void)0) -#define AssertMsg3( _exp, _msg, a1, a2, a3 ) ((void)0) -#define AssertMsg4( _exp, _msg, a1, a2, a3, a4 ) ((void)0) -#define AssertMsg5( _exp, _msg, a1, a2, a3, a4, a5 ) ((void)0) -#define AssertMsg6( _exp, _msg, a1, a2, a3, a4, a5, a6 ) ((void)0) -#define AssertMsg6( _exp, _msg, a1, a2, a3, a4, a5, a6 ) ((void)0) -#define AssertMsg7( _exp, _msg, a1, a2, a3, a4, a5, a6, a7 ) ((void)0) -#define AssertMsg8( _exp, _msg, a1, a2, a3, a4, a5, a6, a7, a8 ) ((void)0) -#define AssertMsg9( _exp, _msg, a1, a2, a3, a4, a5, a6, a7, a8, a9 ) ((void)0) - -#endif /* _DEBUG */ - - - -/* These are always compiled in */ -void Msg(char const* pMsg, ...); -void DMsg(char const *pGroupName, int level, char const *pMsg, ...); - -void Warning(char const *pMsg, ...); -void DWarning(char const *pGroupName, int level, char const *pMsg, ...); - -void Log(char const *pMsg, ...); -void DLog(char const *pGroupName, int level, char const *pMsg, ...); - -void Error(char const *pMsg, ...); - -// You can use this macro like a runtime assert macro. -// If the condition fails, then Error is called with the message. This macro is called -// like AssertMsg, where msg must be enclosed in parenthesis: -// -// ErrorIfNot( bCondition, ("a b c %d %d %d", 1, 2, 3) ); -#define ErrorIfNot( condition, msg ) \ - if ( (condition) ) \ - ; \ - else \ - { \ - Error msg; \ - } - -/* A couple of super-common dynamic spew messages, here for convenience */ -/* These looked at the "developer" group */ -void DevMsg(int level, char const* pMsg, ...); -void DevWarning(int level, char const *pMsg, ...); -void DevLog(int level, char const *pMsg, ...); - -/* default level versions (level 1) */ -void DevMsg(char const* pMsg, ...); -void DevWarning(char const *pMsg, ...); -void DevLog(char const *pMsg, ...); - -/* Code macros, debugger interface */ - -#ifdef _DEBUG - -#define DBG_CODE( _code ) if (0) ; else { _code } -#define DBG_DCODE( _g, _l, _code ) if (IsSpewActive( _g, _l )) { _code } else {} -#define DBG_BREAK() DebuggerBreak() /* defined in platform.h */ - -#else /* not _DEBUG */ - -#define DBG_CODE( _code ) ((void)0) -#define DBG_DCODE( _g, _l, _code ) ((void)0) -#define DBG_BREAK() ((void)0) - -#endif /* _DEBUG */ - -//----------------------------------------------------------------------------- -// Macro to assist in asserting constant invariants during compilation - -#define UID_PREFIX generated_id_ -#define UID_CAT1(a,c) a ## c -#define UID_CAT2(a,c) UID_CAT1(a,c) -#define UNIQUE_ID UID_CAT2(UID_PREFIX,__LINE__) - - -#ifdef _DEBUG -#define COMPILE_TIME_ASSERT( pred ) switch(0){case 0:case pred:;} -#define ASSERT_INVARIANT( pred ) static void UNIQUE_ID() { COMPILE_TIME_ASSERT( pred ) } -#else -#define COMPILE_TIME_ASSERT( pred ) -#define ASSERT_INVARIANT( pred ) -#endif - - -//----------------------------------------------------------------------------- -// Templates to assist in validating pointers: - -// Have to use these stubs so we don't have to include windows.h here. -void _AssertValidReadPtr(void* ptr, int count = 1); -void _AssertValidWritePtr(void* ptr, int count = 1); -void _AssertValidReadWritePtr(void* ptr, int count = 1); - - void AssertValidStringPtr(const char* ptr, int maxchar = 0xFFFFFF); -template inline void AssertValidReadPtr(T* ptr, int count = 1) { _AssertValidReadPtr((void*)ptr, count); } -template inline void AssertValidWritePtr(T* ptr, int count = 1) { _AssertValidWritePtr((void*)ptr, count); } -template inline void AssertValidReadWritePtr(T* ptr, int count = 1) { _AssertValidReadWritePtr((void*)ptr, count); } - -#define AssertValidThis() AssertValidReadWritePtr(this,sizeof(*this)) - -//----------------------------------------------------------------------------- -// Macro to protect functions that are not reentrant - -#ifdef _DEBUG -class CReentryGuard -{ -public: - CReentryGuard(int *pSemaphore) - : m_pSemaphore(pSemaphore) - { - ++(*m_pSemaphore); - } - - ~CReentryGuard() - { - --(*m_pSemaphore); - } - -private: - int *m_pSemaphore; -}; - -#define ASSERT_NO_REENTRY() \ - static int fSemaphore##__LINE__; \ - Assert( !fSemaphore##__LINE__ ); \ - CReentryGuard ReentryGuard##__LINE__( &fSemaphore##__LINE__ ) -#else -#define ASSERT_NO_REENTRY() -#endif - -//----------------------------------------------------------------------------- -// -// Purpose: Inline string formatter -// - -class CDbgFmtMsg -{ -public: - CDbgFmtMsg(const char *pszFormat, ...) - { - va_list arg_ptr; - - va_start(arg_ptr, pszFormat); - _vsnprintf(m_szBuf, sizeof(m_szBuf) - 1, pszFormat, arg_ptr); - va_end(arg_ptr); - - m_szBuf[sizeof(m_szBuf) - 1] = 0; - } - - operator const char *() const - { - return m_szBuf; - } - -private: - char m_szBuf[256]; -}; - -//----------------------------------------------------------------------------- -// -// Purpose: Embed debug info in each file. -// -#ifdef _WIN32 - -#ifdef _DEBUG -#pragma comment(compiler) -#pragma comment(exestr,"*** DEBUG file detected, Last Compile: " __DATE__ ", " __TIME__ " ***") -#endif - -#endif - -#endif /* DBG_H */ \ No newline at end of file diff --git a/regamedll/public/utlmemory.h b/regamedll/public/utlmemory.h index 70a336af..fdcd33f8 100644 --- a/regamedll/public/utlmemory.h +++ b/regamedll/public/utlmemory.h @@ -34,9 +34,9 @@ #endif #include "osconfig.h" -#include "tier0/dbg.h" +//#include "tier0/dbg.h" #include -#include "tier0/platform.h" +//#include "tier0/platform.h" #pragma warning (disable:4100) #pragma warning (disable:4514) diff --git a/regamedll/public/utlvector.h b/regamedll/public/utlvector.h index 46a21f44..d46f5aa8 100644 --- a/regamedll/public/utlvector.h +++ b/regamedll/public/utlvector.h @@ -5,7 +5,7 @@ #endif #include "utlmemory.h" -#include "tier0/platform.h" +//#include "tier0/platform.h" template< class T > class CUtlVector diff --git a/regamedll/regamedll/RegameDLLRuntimeConfig.cpp b/regamedll/regamedll/RegameDLLRuntimeConfig.cpp index af9505eb..1c039751 100644 --- a/regamedll/regamedll/RegameDLLRuntimeConfig.cpp +++ b/regamedll/regamedll/RegameDLLRuntimeConfig.cpp @@ -18,26 +18,26 @@ void CRegameDLLRuntimeConfig::parseFromConfigFile(void) if (strlen(testConfigFileName) <= 0) return; - std::string str; - std::string path( bIsZero ? "./czero/server.cfg" : "./cstrike/server.cfg" ); - std::string pattern = "exec tests/"; - - std::ifstream intput_file( path ); + std::string str; + std::string path( bIsZero ? "./czero/server.cfg" : "./cstrike/server.cfg" ); + std::string pattern = "exec tests/"; + + std::ifstream intput_file( path ); std::vector< std::string > out; - - bool bFound = false; - while (std::getline(intput_file, str)) - { - if (str.find( pattern ) != -1) + + bool bFound = false; + while (std::getline(intput_file, str)) + { + if (str.find( pattern ) != -1) { bFound = true; - - std::ostringstream stringStream; - stringStream << pattern << testConfigFileName; - str = stringStream.str(); - } - - out.push_back( str.c_str() ); + + std::ostringstream stringStream; + stringStream << pattern << testConfigFileName; + str = stringStream.str(); + } + + out.push_back( str.c_str() ); } if (!bFound) @@ -47,14 +47,14 @@ void CRegameDLLRuntimeConfig::parseFromConfigFile(void) out.push_back( stringStream.str() ); } - - intput_file.close(); - - std::ofstream output_file( path ); - std::ostream_iterator< std::string > output_iterator(output_file, "\n"); - std::copy(out.begin(), out.end(), output_iterator); - - out.clear(); + + intput_file.close(); + + std::ofstream output_file( path ); + std::ostream_iterator< std::string > output_iterator(output_file, "\n"); + std::copy(out.begin(), out.end(), output_iterator); + + out.clear(); output_file.close(); #endif // _WIN32 diff --git a/regamedll/regamedll/dlls.h b/regamedll/regamedll/dlls.h index 2484c785..72f04568 100644 --- a/regamedll/regamedll/dlls.h +++ b/regamedll/regamedll/dlls.h @@ -51,6 +51,9 @@ // GameInit #include "game.h" +// weapon shared +#include "wpn_shared.h" + //PM #include "pm_shared/pm_defs.h" #include "pm_shared/pm_materials.h" @@ -95,9 +98,6 @@ #include "plats.h" #include "buttons.h" -// weapon shared -#include "wpn_shared.h" - // CSBOT and Nav #include "game_shared/bot/bot_util.h" #include "game_shared/bot/simple_state_machine.h" diff --git a/regamedll/regamedll/hookchains_impl.cpp b/regamedll/regamedll/hookchains_impl.cpp new file mode 100644 index 00000000..c27fc190 --- /dev/null +++ b/regamedll/regamedll/hookchains_impl.cpp @@ -0,0 +1,52 @@ +/* +* +* This program is free software; you can redistribute it and/or modify it +* under the terms of the GNU General Public License as published by the +* Free Software Foundation; either version 2 of the License, or (at +* your option) any later version. +* +* This program is distributed in the hope that it will be useful, but +* WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +* General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with this program; if not, write to the Free Software Foundation, +* Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +* +*/ + +#include "precompiled.h" +#include "hookchains_impl.h" + +AbstractHookChainRegistry::AbstractHookChainRegistry() +{ + Q_memset(m_Hooks, 0, sizeof(m_Hooks)); + m_NumHooks = 0; +} + +void AbstractHookChainRegistry::addHook(void* hookFunc) { + if (m_NumHooks >= MAX_HOOKS_IN_CHAIN) { + regamedll_syserror("MAX_HOOKS_IN_CHAIN limit hit"); + } + + m_Hooks[m_NumHooks++] = hookFunc; +} + +void AbstractHookChainRegistry::removeHook(void* hookFunc) { + + // erase hook + for (int i = 0; i < m_NumHooks; i++) { + if (hookFunc == m_Hooks[i]) { + if (--m_NumHooks != i) + { + Q_memmove(&m_Hooks[i], &m_Hooks[i + 1], (m_NumHooks - i) * sizeof(m_Hooks[0])); + m_Hooks[m_NumHooks] = NULL; + } + else + m_Hooks[i] = NULL; + + return; + } + } +} diff --git a/regamedll/regamedll/hookchains_impl.h b/regamedll/regamedll/hookchains_impl.h new file mode 100644 index 00000000..701eca33 --- /dev/null +++ b/regamedll/regamedll/hookchains_impl.h @@ -0,0 +1,158 @@ +/* +* +* This program is free software; you can redistribute it and/or modify it +* under the terms of the GNU General Public License as published by the +* Free Software Foundation; either version 2 of the License, or (at +* your option) any later version. +* +* This program is distributed in the hope that it will be useful, but +* WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +* General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with this program; if not, write to the Free Software Foundation, +* Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +* +* In addition, as a special exception, the author gives permission to +* link the code of this program with the Half-Life Game Engine ("HL +* Engine") and Modified Game Libraries ("MODs") developed by Valve, +* L.L.C ("Valve"). You must obey the GNU General Public License in all +* respects for all of the code used other than the HL Engine and MODs +* from Valve. If you modify this file, you may extend this exception +* to your version of the file, but you are not obligated to do so. If +* you do not wish to do so, delete this exception statement from your +* version. +* +*/ +#pragma once +#include "hookchains.h" + +#define MAX_HOOKS_IN_CHAIN 64 + +// Implementation for chains in modules +template +class IHookChainImpl : public IHookChain { +public: + typedef t_ret(*hookfunc_t)(IHookChain*, t_args...); + typedef t_ret(*origfunc_t)(t_args...); + + IHookChainImpl(void** hooks, origfunc_t orig) : m_Hooks(hooks), m_OriginalFunc(orig) + { + if (orig == NULL) + regamedll_syserror("Non-void HookChain without original function."); + } + + virtual ~IHookChainImpl() {} + + virtual t_ret callNext(t_args... args) { + hookfunc_t nexthook = (hookfunc_t)m_Hooks[0]; + + if (nexthook) + { + IHookChainImpl nextChain(m_Hooks + 1, m_OriginalFunc); + return nexthook(&nextChain, args...); + } + + return m_OriginalFunc(args...); + } + + virtual t_ret callOriginal(t_args... args) { + return m_OriginalFunc(args...); + } + +private: + void** m_Hooks; + origfunc_t m_OriginalFunc; +}; + +// Implementation for void chains in modules +template +class IVoidHookChainImpl : public IVoidHookChain { +public: + typedef void(*hookfunc_t)(IVoidHookChain*, t_args...); + typedef void(*origfunc_t)(t_args...); + + IVoidHookChainImpl(void** hooks, origfunc_t orig) : m_Hooks(hooks), m_OriginalFunc(orig) {} + virtual ~IVoidHookChainImpl() {} + + virtual void callNext(t_args... args) { + hookfunc_t nexthook = (hookfunc_t)m_Hooks[0]; + + if (nexthook) + { + IVoidHookChainImpl nextChain(m_Hooks + 1, m_OriginalFunc); + nexthook(&nextChain, args...); + } + else + { + if (m_OriginalFunc) + m_OriginalFunc(args...); + } + } + + virtual void callOriginal(t_args... args) { + origfunc_t origfunc = (origfunc_t)m_OriginalFunc; + origfunc(args...); + } + +private: + void** m_Hooks; + origfunc_t m_OriginalFunc; +}; + +class AbstractHookChainRegistry { +protected: + void* m_Hooks[MAX_HOOKS_IN_CHAIN + 1]; // +1 for null + int m_NumHooks; + +protected: + void addHook(void* hookFunc); + void removeHook(void* hookFunc); + +public: + AbstractHookChainRegistry(); +}; + +template +class IHookChainRegistryImpl : public IHookChainRegistry < t_ret, t_args...>, public AbstractHookChainRegistry { +public: + typedef t_ret(*hookfunc_t)(IHookChain*, t_args...); + typedef t_ret(*origfunc_t)(t_args...); + + virtual ~IHookChainRegistryImpl() { } + + t_ret callChain(origfunc_t origFunc, t_args... args) { + IHookChainImpl chain(m_Hooks, origFunc); + return chain.callNext(args...); + } + + virtual void registerHook(hookfunc_t hook) { + addHook((void*)hook); + } + virtual void unregisterHook(hookfunc_t hook) { + removeHook((void*)hook); + } +}; + +template +class IVoidHookChainRegistryImpl : public IVoidHookChainRegistry , public AbstractHookChainRegistry { +public: + typedef void(*hookfunc_t)(IVoidHookChain*, t_args...); + typedef void(*origfunc_t)(t_args...); + + virtual ~IVoidHookChainRegistryImpl() { } + + void callChain(origfunc_t origFunc, t_args... args) { + IVoidHookChainImpl chain(m_Hooks, origFunc); + chain.callNext(args...); + } + + virtual void registerHook(hookfunc_t hook) { + addHook((void*)hook); + } + + virtual void unregisterHook(hookfunc_t hook) { + removeHook((void*)hook); + } +}; diff --git a/regamedll/regamedll/mem.cpp b/regamedll/regamedll/mem.cpp index cb83dc68..a954369c 100644 --- a/regamedll/regamedll/mem.cpp +++ b/regamedll/regamedll/mem.cpp @@ -4,15 +4,15 @@ void *_malloc_mhook_(size_t n) { - void *ptr = malloc(n); + void *ptr = malloc(n); Regamedll_Debug_logAlloc(n, ptr); return ptr; } void *_realloc_mhook_(void *memblock, size_t size) { - void *ptr = realloc(memblock, size); - Regamedll_Debug_logRealloc(size, memblock, ptr); + void *ptr = realloc(memblock, size); + Regamedll_Debug_logRealloc(size, memblock, ptr); return ptr; } @@ -24,14 +24,14 @@ void _free_mhook_(void *p) void *_calloc_mhook_(size_t n, size_t s) { - void *ptr = calloc(n, s); - Regamedll_Debug_logAlloc(s * n, ptr); + void *ptr = calloc(n, s); + Regamedll_Debug_logAlloc(s * n, ptr); return ptr; } void *__nh_malloc_mhook_(size_t n) { - void *ptr = malloc(n); + void *ptr = malloc(n); Regamedll_Debug_logAlloc(n, ptr); return ptr; } diff --git a/regamedll/regamedll/mem.h b/regamedll/regamedll/mem.h index 681c9c98..c76b1c24 100644 --- a/regamedll/regamedll/mem.h +++ b/regamedll/regamedll/mem.h @@ -9,7 +9,7 @@ void *_malloc_mhook_(size_t n); void *_realloc_mhook_(void *memblock, size_t size); void _free_mhook_(void *p); -void *_calloc_mhook_(size_t n, size_t s); +void *_calloc_mhook_(size_t n, size_t s); void *__nh_malloc_mhook_(size_t n); char *_strdup_mhook_(const char *s); diff --git a/regamedll/regamedll/platform.cpp b/regamedll/regamedll/platform.cpp index d846ebfe..f9cab949 100644 --- a/regamedll/regamedll/platform.cpp +++ b/regamedll/regamedll/platform.cpp @@ -29,7 +29,7 @@ void regamedll_log(const char *fmt, ...) #endif // _WIN32 } -void regamedll_syserror(const char *fmt, ...) +void __declspec(noreturn) regamedll_syserror(const char *fmt, ...) { va_list argptr; static char string[8192]; @@ -44,12 +44,11 @@ void regamedll_syserror(const char *fmt, ...) fprintf(fl, "%s\n", string); fclose(fl); -#ifdef _WIN32 +#if defined(HOOK_GAMEDLL) && defined(_WIN32) printf2(__FUNCTION__ ":: demo failed"); #endif // _WIN32 //TerminateProcess(GetCurrentProcess(), 1); - *((int *)NULL) = 0; while (true); } @@ -216,66 +215,66 @@ int CSimplePlatform::WSAGetLastError() #endif //WIN32 -void CSimplePlatform::SteamAPI_SetBreakpadAppID(uint32 unAppID) -{ - return ::SteamAPI_SetBreakpadAppID(unAppID); -} - -void CSimplePlatform::SteamAPI_UseBreakpadCrashHandler(char const *pchVersion, char const *pchDate, char const *pchTime, bool bFullMemoryDumps, void *pvContext, PFNPreMinidumpCallback m_pfnPreMinidumpCallback) -{ - ::SteamAPI_UseBreakpadCrashHandler(pchVersion, pchDate, pchTime, bFullMemoryDumps, pvContext, m_pfnPreMinidumpCallback); -} - -void CSimplePlatform::SteamAPI_RegisterCallback(CCallbackBase *pCallback, int iCallback) -{ - ::SteamAPI_RegisterCallback(pCallback, iCallback); -} - -bool CSimplePlatform::SteamAPI_Init() -{ - //return false; - return ::SteamAPI_Init(); -} - -void CSimplePlatform::SteamAPI_UnregisterCallResult(class CCallbackBase *pCallback, SteamAPICall_t hAPICall) -{ - return ::SteamAPI_UnregisterCallResult(pCallback, hAPICall); -} - -ISteamApps *CSimplePlatform::SteamApps() -{ - //return NULL; - return ::SteamApps(); -} - -bool CSimplePlatform::SteamGameServer_Init(uint32 unIP, uint16 usSteamPort, uint16 usGamePort, uint16 usQueryPort, EServerMode eServerMode, const char *pchVersionString) -{ - //return false; - return ::SteamGameServer_Init(unIP, usSteamPort, usGamePort, usQueryPort, eServerMode, pchVersionString); -} - -ISteamGameServer *CSimplePlatform::SteamGameServer() -{ - //return NULL; - return ::SteamGameServer(); -} - -void CSimplePlatform::SteamGameServer_RunCallbacks() -{ - ::SteamGameServer_RunCallbacks(); -} - -void CSimplePlatform::SteamAPI_RunCallbacks() -{ - ::SteamAPI_RunCallbacks(); -} - -void CSimplePlatform::SteamGameServer_Shutdown() -{ - ::SteamGameServer_Shutdown(); -} - -void CSimplePlatform::SteamAPI_UnregisterCallback(CCallbackBase *pCallback) -{ - ::SteamAPI_UnregisterCallback(pCallback); -} +void CSimplePlatform::SteamAPI_SetBreakpadAppID(uint32 unAppID) +{ + return ::SteamAPI_SetBreakpadAppID(unAppID); +} + +void CSimplePlatform::SteamAPI_UseBreakpadCrashHandler(char const *pchVersion, char const *pchDate, char const *pchTime, bool bFullMemoryDumps, void *pvContext, PFNPreMinidumpCallback m_pfnPreMinidumpCallback) +{ + ::SteamAPI_UseBreakpadCrashHandler(pchVersion, pchDate, pchTime, bFullMemoryDumps, pvContext, m_pfnPreMinidumpCallback); +} + +void CSimplePlatform::SteamAPI_RegisterCallback(CCallbackBase *pCallback, int iCallback) +{ + ::SteamAPI_RegisterCallback(pCallback, iCallback); +} + +bool CSimplePlatform::SteamAPI_Init() +{ + //return false; + return ::SteamAPI_Init(); +} + +void CSimplePlatform::SteamAPI_UnregisterCallResult(class CCallbackBase *pCallback, SteamAPICall_t hAPICall) +{ + return ::SteamAPI_UnregisterCallResult(pCallback, hAPICall); +} + +ISteamApps *CSimplePlatform::SteamApps() +{ + //return NULL; + return ::SteamApps(); +} + +bool CSimplePlatform::SteamGameServer_Init(uint32 unIP, uint16 usSteamPort, uint16 usGamePort, uint16 usQueryPort, EServerMode eServerMode, const char *pchVersionString) +{ + //return false; + return ::SteamGameServer_Init(unIP, usSteamPort, usGamePort, usQueryPort, eServerMode, pchVersionString); +} + +ISteamGameServer *CSimplePlatform::SteamGameServer() +{ + //return NULL; + return ::SteamGameServer(); +} + +void CSimplePlatform::SteamGameServer_RunCallbacks() +{ + ::SteamGameServer_RunCallbacks(); +} + +void CSimplePlatform::SteamAPI_RunCallbacks() +{ + ::SteamAPI_RunCallbacks(); +} + +void CSimplePlatform::SteamGameServer_Shutdown() +{ + ::SteamGameServer_Shutdown(); +} + +void CSimplePlatform::SteamAPI_UnregisterCallback(CCallbackBase *pCallback) +{ + ::SteamAPI_UnregisterCallback(pCallback); +} diff --git a/regamedll/regamedll/precompiled.h b/regamedll/regamedll/precompiled.h index 49ae1316..fcc5a235 100644 --- a/regamedll/regamedll/precompiled.h +++ b/regamedll/regamedll/precompiled.h @@ -1,8 +1,4 @@ -#ifndef PRECOMPILED_H -#define PRECOMPILED_H -#ifdef _WIN32 #pragma once -#endif #include "version/appversion.h" @@ -27,13 +23,13 @@ #endif // HOOK_GAMEDLL -#include "dlls.h" -#include "basetypes.h" - //valve libs stuff #include "tier0/platform.h" #include "tier0/dbg.h" +#include "dlls.h" +#include "basetypes.h" + #include "interface.h" #include "utlbuffer.h" #include "utlrbtree.h" @@ -47,4 +43,8 @@ #include "bzip2/bzlib.h" -#endif // PRECOMPILED_H +#include "hookchains_impl.h" +#include "regamedll_interfaces.h" +#include "regamedll_interfaces_impl.h" +#include "regamedll_api.h" +#include "regamedll_api_impl.h" diff --git a/regamedll/regamedll/regamedll_api_impl.cpp b/regamedll/regamedll/regamedll_api_impl.cpp new file mode 100644 index 00000000..a113c066 --- /dev/null +++ b/regamedll/regamedll/regamedll_api_impl.cpp @@ -0,0 +1,67 @@ +/* +* +* This program is free software; you can redistribute it and/or modify it +* under the terms of the GNU General Public License as published by the +* Free Software Foundation; either version 2 of the License, or (at +* your option) any later version. +* +* This program is distributed in the hope that it will be useful, but +* WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +* General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with this program; if not, write to the Free Software Foundation, +* Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +* +* In addition, as a special exception, the author gives permission to +* link the code of this program with the Half-Life Game Engine ("HL +* Engine") and Modified Game Libraries ("MODs") developed by Valve, +* L.L.C ("Valve"). You must obey the GNU General Public License in all +* respects for all of the code used other than the HL Engine and MODs +* from Valve. If you modify this file, you may extend this exception +* to your version of the file, but you are not obligated to do so. If +* you do not wish to do so, delete this exception statement from your +* version. +* +*/ +#include "precompiled.h" + +CReGameHookchains g_ReGameHookchains; +ReGameFuncs_t g_ReGameApiFuncs = +{ + &UTIL_PlayerByIndex + +}; + +IReGameHookRegistry_Observer_IsValidTarget* CReGameHookchains::Observer_IsValidTarget() +{ + return &m_Observer_IsValidTarget; +} + +IReGameHookRegistry_GetForceCamera* CReGameHookchains::GetForceCamera() +{ + return &m_GetForceCamera; +} + +int CReGameApi::GetMajorVersion() +{ + return REGAMEDLL_API_VERSION_MAJOR; +} + +int CReGameApi::GetMinorVersion() +{ + return REGAMEDLL_API_VERSION_MINOR; +} + +const ReGameFuncs_t *CReGameApi::GetFuncs() +{ + return &g_ReGameApiFuncs; +} + +IReGameHookchains *CReGameApi::GetHookchains() +{ + return &g_ReGameHookchains; +} + +EXPOSE_SINGLE_INTERFACE(CReGameApi, IReGameApi, VREHLDS_HLDS_API_VERSION); diff --git a/regamedll/regamedll/regamedll_api_impl.h b/regamedll/regamedll/regamedll_api_impl.h new file mode 100644 index 00000000..cddbda8a --- /dev/null +++ b/regamedll/regamedll/regamedll_api_impl.h @@ -0,0 +1,62 @@ +/* +* +* This program is free software; you can redistribute it and/or modify it +* under the terms of the GNU General Public License as published by the +* Free Software Foundation; either version 2 of the License, or (at +* your option) any later version. +* +* This program is distributed in the hope that it will be useful, but +* WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +* General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with this program; if not, write to the Free Software Foundation, +* Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +* +* In addition, as a special exception, the author gives permission to +* link the code of this program with the Half-Life Game Engine ("HL +* Engine") and Modified Game Libraries ("MODs") developed by Valve, +* L.L.C ("Valve"). You must obey the GNU General Public License in all +* respects for all of the code used other than the HL Engine and MODs +* from Valve. If you modify this file, you may extend this exception +* to your version of the file, but you are not obligated to do so. If +* you do not wish to do so, delete this exception statement from your +* version. +* +*/ +#pragma once + +#include "archtypes.h" +#include "regamedll_api.h" +#include "regamedll_interfaces_impl.h" + +// Observer_IsValidTarget +typedef IHookChainImpl CReGameHook_Observer_IsValidTarget; +typedef IHookChainRegistryImpl CReGameHookRegistry_Observer_IsValidTarget; + +// GetForceCamera +typedef IHookChainImpl CReGameHook_GetForceCamera; +typedef IHookChainRegistryImpl CReGameHookRegistry_GetForceCamera; + +class CReGameHookchains : public IReGameHookchains { +public: + CReGameHookRegistry_Observer_IsValidTarget m_Observer_IsValidTarget; + CReGameHookRegistry_GetForceCamera m_GetForceCamera; + +public: + virtual IReGameHookRegistry_Observer_IsValidTarget* Observer_IsValidTarget(); + virtual IReGameHookRegistry_GetForceCamera* GetForceCamera(); +}; + +extern CReGameHookchains g_ReGameHookchains; +extern ReGameFuncs_t g_ReGameApiFuncs; + +class CReGameApi : public IReGameApi { +public: + virtual int GetMajorVersion(); + virtual int GetMinorVersion(); + + virtual const ReGameFuncs_t *GetFuncs(); + virtual IReGameHookchains *GetHookchains(); +}; diff --git a/regamedll/regamedll/regamedll_interfaces_impl.cpp b/regamedll/regamedll/regamedll_interfaces_impl.cpp new file mode 100644 index 00000000..938550fb --- /dev/null +++ b/regamedll/regamedll/regamedll_interfaces_impl.cpp @@ -0,0 +1,30 @@ +/* +* +* This program is free software; you can redistribute it and/or modify it +* under the terms of the GNU General Public License as published by the +* Free Software Foundation; either version 2 of the License, or (at +* your option) any later version. +* +* This program is distributed in the hope that it will be useful, but +* WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +* General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with this program; if not, write to the Free Software Foundation, +* Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +* +* In addition, as a special exception, the author gives permission to +* link the code of this program with the Half-Life Game Engine ("HL +* Engine") and Modified Game Libraries ("MODs") developed by Valve, +* L.L.C ("Valve"). You must obey the GNU General Public License in all +* respects for all of the code used other than the HL Engine and MODs +* from Valve. If you modify this file, you may extend this exception +* to your version of the file, but you are not obligated to do so. If +* you do not wish to do so, delete this exception statement from your +* version. +* +*/ + +#include "precompiled.h" + diff --git a/regamedll/regamedll/regamedll_interfaces_impl.h b/regamedll/regamedll/regamedll_interfaces_impl.h new file mode 100644 index 00000000..4cd6e926 --- /dev/null +++ b/regamedll/regamedll/regamedll_interfaces_impl.h @@ -0,0 +1,31 @@ +/* +* +* This program is free software; you can redistribute it and/or modify it +* under the terms of the GNU General Public License as published by the +* Free Software Foundation; either version 2 of the License, or (at +* your option) any later version. +* +* This program is distributed in the hope that it will be useful, but +* WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +* General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with this program; if not, write to the Free Software Foundation, +* Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +* +* In addition, as a special exception, the author gives permission to +* link the code of this program with the Half-Life Game Engine ("HL +* Engine") and Modified Game Libraries ("MODs") developed by Valve, +* L.L.C ("Valve"). You must obey the GNU General Public License in all +* respects for all of the code used other than the HL Engine and MODs +* from Valve. If you modify this file, you may extend this exception +* to your version of the file, but you are not obligated to do so. If +* you do not wish to do so, delete this exception statement from your +* version. +* +*/ +#pragma once + +#include "maintypes.h" +#include "regamedll_interfaces.h"