fixed stack corruption in sound code
This commit is contained in:
parent
9e820b0a34
commit
a27d39a394
13 changed files with 155 additions and 143 deletions
|
|
@ -606,7 +606,7 @@ struct Client
|
|||
Vector soundPosition; // position sound was played
|
||||
|
||||
int team; // bot team
|
||||
int realTeam; // real bot team in free for all mode (csdm)
|
||||
int team2; // real bot team in free for all mode (csdm)
|
||||
int flags; // client flags
|
||||
|
||||
float hearingDistance; // distance this sound is heared
|
||||
|
|
@ -1237,8 +1237,8 @@ private:
|
|||
bool m_economicsGood[2]; // is team able to buy anything
|
||||
bool m_deathMsgSent; // for fakeping
|
||||
|
||||
Array <entity_t> m_activeGrenades; // holds currently active grenades in the map
|
||||
Array <entity_t> m_trackedPlayers; // holds array of connected players, and waits the player joins team
|
||||
Array <edict_t *> m_activeGrenades; // holds currently active grenades in the map
|
||||
Array <edict_t *> m_trackedPlayers; // holds array of connected players, and waits the player joins team
|
||||
|
||||
edict_t *m_killerEntity; // killer entity for bots
|
||||
|
||||
|
|
@ -1304,7 +1304,7 @@ public:
|
|||
|
||||
// grenades
|
||||
void UpdateActiveGrenades (void);
|
||||
const Array <entity_t> &GetActiveGrenades (void);
|
||||
const Array <edict_t *> &GetActiveGrenades (void);
|
||||
|
||||
inline bool HasActiveGrenades (void)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -704,10 +704,10 @@ public:
|
|||
//
|
||||
// Function: BuildVectors
|
||||
//
|
||||
// Builds a 3D referential from a view angle, that is to say, the relative "forward", "right" and "upward" direction
|
||||
// that a player would have if he were facing this view angle. World angles are stored in Vector structs too, the
|
||||
// "x" component corresponding to the X angle (horizontal angle), and the "y" component corresponding to the Y angle
|
||||
// (vertical angle).
|
||||
// Builds a 3D referential from a view angle, that is to say, the relative "forward", "right" and "upward" direction
|
||||
// that a player would have if he were facing this view angle. World angles are stored in Vector structs too, the
|
||||
// "x" component corresponding to the X angle (horizontal angle), and the "y" component corresponding to the Y angle
|
||||
// (vertical angle).
|
||||
//
|
||||
// Parameters:
|
||||
// forward - Forward referential vector.
|
||||
|
|
@ -3965,8 +3965,7 @@ public:
|
|||
//
|
||||
static FORCEINLINE T *GetObject (void)
|
||||
{
|
||||
static T reference;
|
||||
return &reference;
|
||||
return &GetReference ();
|
||||
}
|
||||
|
||||
//
|
||||
|
|
|
|||
|
|
@ -63,35 +63,34 @@ enum NetMsgId
|
|||
NETMSG_NUM = 21
|
||||
};
|
||||
|
||||
// variable reg pair
|
||||
struct VarPair
|
||||
{
|
||||
VarType type;
|
||||
cvar_t reg;
|
||||
bool regMissing;
|
||||
class ConVar *self;
|
||||
};
|
||||
|
||||
// translation pair
|
||||
struct TranslatorPair
|
||||
{
|
||||
const char *original;
|
||||
const char *translated;
|
||||
};
|
||||
|
||||
// network message block
|
||||
struct MessageBlock
|
||||
{
|
||||
int bot;
|
||||
int state;
|
||||
int msg;
|
||||
int regMsgs[NETMSG_NUM];
|
||||
};
|
||||
|
||||
// provides utility functions to not call original engine (less call-cost)
|
||||
class Engine : public Singleton <Engine>
|
||||
{
|
||||
public:
|
||||
// variable reg pair
|
||||
struct VarPair
|
||||
{
|
||||
VarType type;
|
||||
cvar_t reg;
|
||||
bool regMissing;
|
||||
class ConVar *self;
|
||||
};
|
||||
|
||||
// translation pair
|
||||
struct TranslatorPair
|
||||
{
|
||||
const char *original;
|
||||
const char *translated;
|
||||
};
|
||||
|
||||
// network message block
|
||||
struct MessageBlock
|
||||
{
|
||||
int bot;
|
||||
int state;
|
||||
int msg;
|
||||
int regMsgs[NETMSG_NUM];
|
||||
};
|
||||
|
||||
private:
|
||||
short m_drawModels[DRAW_NUM];
|
||||
|
||||
|
|
@ -186,13 +185,13 @@ public:
|
|||
public:
|
||||
|
||||
// get the current time on server
|
||||
inline float Time (void)
|
||||
FORCEINLINE float Time (void)
|
||||
{
|
||||
return g_pGlobals->time;
|
||||
}
|
||||
|
||||
// get "maxplayers" limit on server
|
||||
inline int MaxClients (void)
|
||||
FORCEINLINE int MaxClients (void)
|
||||
{
|
||||
return g_pGlobals->maxClients;
|
||||
}
|
||||
|
|
@ -227,19 +226,19 @@ public:
|
|||
}
|
||||
|
||||
// gets edict pointer out of entity index
|
||||
inline edict_t *EntityOfIndex (const int index)
|
||||
FORCEINLINE edict_t *EntityOfIndex (const int index)
|
||||
{
|
||||
return static_cast <edict_t *> (m_startEntity + index);
|
||||
};
|
||||
|
||||
// gets edict index out of it's pointer
|
||||
inline int IndexOfEntity (const edict_t *ent)
|
||||
FORCEINLINE int IndexOfEntity (const edict_t *ent)
|
||||
{
|
||||
return static_cast <int> (ent - m_startEntity);
|
||||
};
|
||||
|
||||
// verify entity isn't null
|
||||
inline bool IsNullEntity (const edict_t *ent)
|
||||
FORCEINLINE bool IsNullEntity (const edict_t *ent)
|
||||
{
|
||||
return !ent || !IndexOfEntity (ent);
|
||||
}
|
||||
|
|
@ -295,7 +294,7 @@ public:
|
|||
}
|
||||
|
||||
// tries to set needed message id
|
||||
void TryCaptureMessage (int type, int msgId)
|
||||
FORCEINLINE void TryCaptureMessage (int type, int msgId)
|
||||
{
|
||||
if (type == m_msgBlock.regMsgs[msgId])
|
||||
SetOngoingMessageId (msgId);
|
||||
|
|
@ -315,11 +314,11 @@ public:
|
|||
public:
|
||||
ConVar (const char *name, const char *initval, VarType type = VT_NOSERVER, bool regMissing = false);
|
||||
|
||||
inline bool GetBool (void) { return m_eptr->value > 0.0f; }
|
||||
inline int GetInt (void) { return static_cast <int> (m_eptr->value); }
|
||||
inline float GetFloat (void) { return m_eptr->value; }
|
||||
inline const char *GetString (void) { return m_eptr->string; }
|
||||
inline void SetFloat (float val) { m_eptr->value = val; }
|
||||
inline void SetInt (int val) { SetFloat (static_cast <float> (val)); }
|
||||
inline void SetString (const char *val) { g_engfuncs.pfnCvar_DirectSet (m_eptr, const_cast <char *> (val)); }
|
||||
FORCEINLINE bool GetBool (void) { return m_eptr->value > 0.0f; }
|
||||
FORCEINLINE int GetInt (void) { return static_cast <int> (m_eptr->value); }
|
||||
FORCEINLINE float GetFloat (void) { return m_eptr->value; }
|
||||
FORCEINLINE const char *GetString (void) { return m_eptr->string; }
|
||||
FORCEINLINE void SetFloat (float val) { m_eptr->value = val; }
|
||||
FORCEINLINE void SetInt (int val) { SetFloat (static_cast <float> (val)); }
|
||||
FORCEINLINE void SetString (const char *val) { g_engfuncs.pfnCvar_DirectSet (m_eptr, const_cast <char *> (val)); }
|
||||
};
|
||||
|
|
|
|||
|
|
@ -100,8 +100,6 @@ typedef struct
|
|||
int iHitgroup; // 0 == generic, non zero is specific body part
|
||||
} TraceResult;
|
||||
|
||||
typedef edict_t *entity_t;
|
||||
|
||||
typedef uint32 CRC32_t;
|
||||
|
||||
// Engine hands this to DLLs for functionality callbacks
|
||||
|
|
|
|||
|
|
@ -137,18 +137,18 @@ public:
|
|||
return m_ptr;
|
||||
}
|
||||
|
||||
template <typename R> R GetFuncAddr (const char *function)
|
||||
inline void *GetFuncAddr (const char *function)
|
||||
{
|
||||
#ifdef PLATFORM_WIN32
|
||||
return reinterpret_cast <R> (GetProcAddress (GetHandle <HMODULE> (), function));
|
||||
return reinterpret_cast <void *> (GetProcAddress (static_cast <HMODULE> (m_ptr), function));
|
||||
#else
|
||||
return reinterpret_cast <R> (dlsym (m_ptr, function));
|
||||
return reinterpret_cast <void *> (dlsym (m_ptr, function));
|
||||
#endif
|
||||
}
|
||||
|
||||
template <typename R> R GetHandle (void)
|
||||
inline void *GetHandle (void)
|
||||
{
|
||||
return (R) m_ptr;
|
||||
return m_ptr;
|
||||
}
|
||||
|
||||
inline bool IsLoaded (void) const
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue