rewritten a little weapon selection code
fixed bots do not chat when dead some code cleanup
This commit is contained in:
parent
c4d6ce3c45
commit
3c5d056fec
32 changed files with 794 additions and 1214 deletions
|
|
@ -4,7 +4,7 @@
|
|||
//
|
||||
// This software is licensed under the BSD-style license.
|
||||
// Additional exceptions apply. For full license details, see LICENSE.txt or visit:
|
||||
// http://yapb.jeefo.net/license
|
||||
// https://yapb.jeefo.net/license
|
||||
//
|
||||
|
||||
#pragma once
|
||||
|
|
@ -17,7 +17,7 @@ protected:
|
|||
unsigned long int m_textSize;
|
||||
unsigned long int m_codeSize;
|
||||
|
||||
byte m_textBuffer[N + F - 1];
|
||||
uint8 m_textBuffer[N + F - 1];
|
||||
int m_matchPosition;
|
||||
int m_matchLength;
|
||||
|
||||
|
|
@ -41,7 +41,7 @@ private:
|
|||
|
||||
int compare = 1;
|
||||
|
||||
byte *key = &m_textBuffer[node];
|
||||
uint8 *key = &m_textBuffer[node];
|
||||
int temp = N + 1 + key[0];
|
||||
|
||||
m_right[node] = m_left[node] = NIL;
|
||||
|
|
@ -172,16 +172,18 @@ public:
|
|||
memset (m_parent, 0, sizeof (m_parent));
|
||||
}
|
||||
|
||||
int InternalEncode (const char *fileName, byte *header, int headerSize, byte *buffer, int bufferSize)
|
||||
int InternalEncode (const char *fileName, uint8 *header, int headerSize, uint8 *buffer, int bufferSize)
|
||||
{
|
||||
int i, bit, length, node, strPtr, lastMatchLength, codeBufferPtr, bufferPtr = 0;
|
||||
byte codeBuffer[17], mask;
|
||||
int i, length, node, strPtr, lastMatchLength, codeBufferPtr, bufferPtr = 0;
|
||||
uint8 codeBuffer[17], mask;
|
||||
|
||||
File fp (fileName, "wb");
|
||||
|
||||
if (!fp.IsValid ())
|
||||
return -1;
|
||||
|
||||
uint8 bit;
|
||||
|
||||
fp.Write (header, headerSize, 1);
|
||||
InitTree ();
|
||||
|
||||
|
|
@ -219,8 +221,8 @@ public:
|
|||
}
|
||||
else
|
||||
{
|
||||
codeBuffer[codeBufferPtr++] = (unsigned char) m_matchPosition;
|
||||
codeBuffer[codeBufferPtr++] = (unsigned char) (((m_matchPosition >> 4) & 0xf0) | (m_matchLength - (THRESHOLD + 1)));
|
||||
codeBuffer[codeBufferPtr++] = (uint8) m_matchPosition;
|
||||
codeBuffer[codeBufferPtr++] = (uint8) (((m_matchPosition >> 4) & 0xf0) | (m_matchLength - (THRESHOLD + 1)));
|
||||
}
|
||||
|
||||
if ((mask <<= 1) == 0)
|
||||
|
|
@ -273,12 +275,14 @@ public:
|
|||
return m_codeSize;
|
||||
}
|
||||
|
||||
int InternalDecode (const char *fileName, int headerSize, byte *buffer, int bufferSize)
|
||||
int InternalDecode (const char *fileName, int headerSize, uint8 *buffer, int bufferSize)
|
||||
{
|
||||
int i, j, k, node, bit;
|
||||
int i, j, k, node;
|
||||
unsigned int flags;
|
||||
int bufferPtr = 0;
|
||||
|
||||
uint8 bit;
|
||||
|
||||
File fp (fileName, "rb");
|
||||
|
||||
if (!fp.IsValid ())
|
||||
|
|
@ -296,14 +300,14 @@ public:
|
|||
{
|
||||
if (((flags >>= 1) & 256) == 0)
|
||||
{
|
||||
if ((bit = fp.GetChar ()) == EOF)
|
||||
if ((bit = static_cast <uint8> (fp.GetChar ())) == EOF)
|
||||
break;
|
||||
flags = bit | 0xff00;
|
||||
}
|
||||
|
||||
if (flags & 1)
|
||||
{
|
||||
if ((bit = fp.GetChar ()) == EOF)
|
||||
if ((bit = static_cast <uint8> (fp.GetChar ())) == EOF)
|
||||
break;
|
||||
buffer[bufferPtr++] = bit;
|
||||
|
||||
|
|
@ -343,14 +347,14 @@ public:
|
|||
}
|
||||
|
||||
// external decoder
|
||||
static int Uncompress (const char *fileName, int headerSize, byte *buffer, int bufferSize)
|
||||
static int Uncompress (const char *fileName, int headerSize, uint8 *buffer, int bufferSize)
|
||||
{
|
||||
static Compressor compressor = Compressor ();
|
||||
return compressor.InternalDecode (fileName, headerSize, buffer, bufferSize);
|
||||
}
|
||||
|
||||
// external encoder
|
||||
static int Compress(const char *fileName, byte *header, int headerSize, byte *buffer, int bufferSize)
|
||||
static int Compress(const char *fileName, uint8 *header, int headerSize, uint8 *buffer, int bufferSize)
|
||||
{
|
||||
static Compressor compressor = Compressor ();
|
||||
return compressor.InternalEncode (fileName, header, headerSize, buffer, bufferSize);
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@
|
|||
//
|
||||
// This software is licensed under the BSD-style license.
|
||||
// Additional exceptions apply. For full license details, see LICENSE.txt or visit:
|
||||
// http://yapb.jeefo.net/license
|
||||
// https://yapb.jeefo.net/license
|
||||
//
|
||||
|
||||
#pragma once
|
||||
|
|
@ -13,7 +13,6 @@
|
|||
#include <stdio.h>
|
||||
#include <memory.h>
|
||||
|
||||
#include <dllapi.h>
|
||||
#include <meta_api.h>
|
||||
|
||||
using namespace Math;
|
||||
|
|
@ -625,21 +624,21 @@ struct Client
|
|||
// experience data hold in memory while playing
|
||||
struct Experience
|
||||
{
|
||||
unsigned short team0Damage;
|
||||
unsigned short team1Damage;
|
||||
signed short team0DangerIndex;
|
||||
signed short team1DangerIndex;
|
||||
signed short team0Value;
|
||||
signed short team1Value;
|
||||
uint16 team0Damage;
|
||||
uint16 team1Damage;
|
||||
int16 team0DangerIndex;
|
||||
int16 team1DangerIndex;
|
||||
int16 team0Value;
|
||||
int16 team1Value;
|
||||
};
|
||||
|
||||
// experience data when saving/loading
|
||||
struct ExperienceSave
|
||||
{
|
||||
unsigned char team0Damage;
|
||||
unsigned char team1Damage;
|
||||
signed char team0Value;
|
||||
signed char team1Value;
|
||||
uint8 team0Damage;
|
||||
uint8 team1Damage;
|
||||
int8 team0Value;
|
||||
int8 team1Value;
|
||||
};
|
||||
|
||||
// bot creation tab
|
||||
|
|
@ -668,7 +667,7 @@ struct WeaponProperty
|
|||
// define chatting collection structure
|
||||
struct ChatCollection
|
||||
{
|
||||
char chatProbability;
|
||||
int chatProbability;
|
||||
float chatDelay;
|
||||
float timeNextChat;
|
||||
int entityIndex;
|
||||
|
|
@ -775,7 +774,7 @@ private:
|
|||
Path *m_currentPath; // pointer to the current path waypoint
|
||||
|
||||
SearchPathType m_pathType; // which pathfinder to use
|
||||
unsigned char m_visibility; // visibility flags
|
||||
uint8 m_visibility; // visibility flags
|
||||
|
||||
int m_currentWaypointIndex; // current waypoint index
|
||||
int m_travelStartIndex; // travel start index to double jump action
|
||||
|
|
@ -784,7 +783,7 @@ private:
|
|||
int m_loosedBombWptIndex; // nearest to loosed bomb waypoint
|
||||
int m_plantedBombWptIndex;// nearest to planted bomb waypoint
|
||||
|
||||
unsigned short m_currentTravelFlags; // connection flags like jumping
|
||||
uint16 m_currentTravelFlags; // connection flags like jumping
|
||||
bool m_jumpFinished; // has bot finished jumping
|
||||
Vector m_desiredVelocity; // desired velocity for jump waypoints
|
||||
float m_navTimeset; // time waypoint chosen by Bot
|
||||
|
|
@ -941,7 +940,7 @@ private:
|
|||
|
||||
bool IsInViewCone (const Vector &origin);
|
||||
void ReactOnSound (void);
|
||||
bool CheckVisibility (edict_t *target, Vector *origin, byte *bodyPart);
|
||||
bool CheckVisibility (edict_t *target, Vector *origin, uint8 *bodyPart);
|
||||
bool IsEnemyViewable (edict_t *player);
|
||||
|
||||
edict_t *FindNearestButton (const char *className);
|
||||
|
|
@ -972,7 +971,7 @@ private:
|
|||
|
||||
float GetWalkSpeed (void);
|
||||
|
||||
bool ItemIsVisible (const Vector &dest, char *itemName);
|
||||
bool ItemIsVisible (const Vector &dest, const char *itemName);
|
||||
bool LastEnemyShootable (void);
|
||||
bool IsBehindSmokeClouds (edict_t *ent);
|
||||
void RunTask (void);
|
||||
|
|
@ -993,7 +992,7 @@ private:
|
|||
int GetBestSecondaryWeaponCarried (void);
|
||||
|
||||
void RunPlayerMovement (void);
|
||||
byte ThrottledMsec (void);
|
||||
uint8 ThrottledMsec (void);
|
||||
void GetValidWaypoint (void);
|
||||
int ChangeWptIndex (int waypointIndex);
|
||||
bool IsDeadlyDrop (const Vector &to);
|
||||
|
|
@ -1357,7 +1356,7 @@ private:
|
|||
int m_lastJumpWaypoint;
|
||||
int m_visibilityIndex;
|
||||
Vector m_lastWaypoint;
|
||||
unsigned char m_visLUT[MAX_WAYPOINTS][MAX_WAYPOINTS / 4];
|
||||
uint8 m_visLUT[MAX_WAYPOINTS][MAX_WAYPOINTS / 4];
|
||||
|
||||
float m_pathDisplayTime;
|
||||
float m_arrowDisplayTime;
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@
|
|||
//
|
||||
// This software is licensed under the BSD-style license.
|
||||
// Additional exceptions apply. For full license details, see LICENSE.txt or visit:
|
||||
// http://yapb.jeefo.net/license
|
||||
// https://yapb.jeefo.net/license
|
||||
//
|
||||
|
||||
#pragma once
|
||||
|
|
@ -27,6 +27,20 @@
|
|||
#include <sys/stat.h>
|
||||
#endif
|
||||
|
||||
//
|
||||
// Basic Types
|
||||
//
|
||||
typedef signed char int8;
|
||||
typedef signed short int16;
|
||||
typedef signed long int32;
|
||||
typedef unsigned char uint8;
|
||||
typedef unsigned short uint16;
|
||||
typedef unsigned long uint32;
|
||||
|
||||
// Own min/max implementation
|
||||
template <typename T> inline T A_min (T a, T b) { return a < b ? a : b; }
|
||||
template <typename T> inline T A_max (T a, T b) { return a > b ? a : b; }
|
||||
|
||||
//
|
||||
// Title: Utility Classes Header
|
||||
//
|
||||
|
|
@ -223,7 +237,7 @@ namespace Math
|
|||
*sine = sinf (rad);
|
||||
*cosine = cosf (rad);
|
||||
#elif defined (__linux__) || defined (GCC) || defined (__APPLE__)
|
||||
register double _cos, _sin;
|
||||
double _cos, _sin;
|
||||
__asm __volatile__ ("fsincos" : "=t" (_cos), "=u" (_sin) : "0" (rad));
|
||||
|
||||
*cosine = _cos;
|
||||
|
|
@ -277,7 +291,7 @@ private:
|
|||
public:
|
||||
RandomSequenceOfUnique (void)
|
||||
{
|
||||
unsigned int seedBase = time (NULL);
|
||||
unsigned int seedBase = static_cast <unsigned int> (time (NULL));
|
||||
unsigned int seedOffset = seedBase + 1;
|
||||
|
||||
m_index = PermuteQPR (PermuteQPR (seedBase) + 0x682f0161);
|
||||
|
|
@ -285,7 +299,7 @@ public:
|
|||
m_divider = (static_cast <unsigned long long> (1)) << 32;
|
||||
}
|
||||
|
||||
inline int Long (int low, int high)
|
||||
inline int Int (int low, int high)
|
||||
{
|
||||
return static_cast <int> (Random () * (static_cast <double> (high) - static_cast <double> (low) + 1.0) / m_divider + static_cast <double> (low));
|
||||
}
|
||||
|
|
@ -1609,7 +1623,7 @@ public:
|
|||
{
|
||||
extern class RandomSequenceOfUnique Random;
|
||||
|
||||
return m_elements[Random.Long (0, m_itemCount - 1)];
|
||||
return m_elements[Random.Int (0, m_itemCount - 1)];
|
||||
}
|
||||
|
||||
Array <T> &operator = (const Array <T> &other)
|
||||
|
|
@ -2028,7 +2042,7 @@ private:
|
|||
int delta = 4;
|
||||
|
||||
if (m_allocatedSize > 64)
|
||||
delta = m_allocatedSize * 0.5;
|
||||
delta = static_cast <int> (m_allocatedSize * 0.5);
|
||||
else if (m_allocatedSize > 8)
|
||||
delta = 16;
|
||||
|
||||
|
|
@ -2667,7 +2681,7 @@ public:
|
|||
String result;
|
||||
|
||||
for (int i = 0; i < GetLength (); i++)
|
||||
result += toupper (m_bufferPtr[i]);
|
||||
result += static_cast <char> (toupper (static_cast <int> (m_bufferPtr[i])));
|
||||
|
||||
return result;
|
||||
}
|
||||
|
|
@ -2684,7 +2698,7 @@ public:
|
|||
String result;
|
||||
|
||||
for (int i = 0; i < GetLength (); i++)
|
||||
result += tolower (m_bufferPtr[i]);
|
||||
result += static_cast <char> (tolower (static_cast <int> (m_bufferPtr[i])));
|
||||
|
||||
return result;
|
||||
}
|
||||
|
|
@ -3663,8 +3677,8 @@ public:
|
|||
class MemoryFile
|
||||
{
|
||||
public:
|
||||
typedef unsigned char *(*MF_Loader) (const char *, int *);
|
||||
typedef void (*MF_Unloader) (unsigned char *);
|
||||
typedef uint8 *(*MF_Loader) (const char *, int *);
|
||||
typedef void (*MF_Unloader) (uint8 *);
|
||||
|
||||
public:
|
||||
static MF_Loader Loader;
|
||||
|
|
@ -3673,7 +3687,7 @@ public:
|
|||
protected:
|
||||
int m_size;
|
||||
int m_pos;
|
||||
unsigned char *m_buffer;
|
||||
uint8 *m_buffer;
|
||||
|
||||
//
|
||||
// Group: (Con/De)structors
|
||||
|
|
@ -3843,7 +3857,7 @@ public:
|
|||
if (!m_buffer|| m_pos >= m_size || buffer == NULL || !size || !count)
|
||||
return 0;
|
||||
|
||||
int blocksRead = min ((m_size - m_pos) / size, count) * size;
|
||||
int blocksRead = A_min ((m_size - m_pos) / size, count) * size;
|
||||
|
||||
memcpy (buffer, &m_buffer[m_pos], blocksRead);
|
||||
m_pos += blocksRead;
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@
|
|||
//
|
||||
// This software is licensed under the BSD-style license.
|
||||
// Additional exceptions apply. For full license details, see LICENSE.txt or visit:
|
||||
// http://yapb.jeefo.net/license
|
||||
// https://yapb.jeefo.net/license
|
||||
//
|
||||
// Purpose: Engine & Game interfaces.
|
||||
//
|
||||
|
|
@ -92,7 +92,7 @@ struct MessageBlock
|
|||
class Engine : public Singleton <Engine>
|
||||
{
|
||||
private:
|
||||
short m_drawModels[DRAW_NUM];
|
||||
int m_drawModels[DRAW_NUM];
|
||||
|
||||
// bot client command
|
||||
bool m_isBotCommand;
|
||||
|
|
|
|||
|
|
@ -1,231 +0,0 @@
|
|||
/***
|
||||
*
|
||||
* Copyright (c) 1999-2005, Valve Corporation. All rights reserved.
|
||||
*
|
||||
* This product contains software technology licensed from Id
|
||||
* Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc.
|
||||
* All Rights Reserved.
|
||||
*
|
||||
* This source code contains proprietary and confidential information of
|
||||
* Valve LLC and its suppliers. Access to this code is restricted to
|
||||
* persons who have executed a written SDK license with Valve. Any access,
|
||||
* use or distribution of this code by or to any unlicensed person is illegal.
|
||||
*
|
||||
****/
|
||||
#ifndef ARCHTYPES_H
|
||||
#define ARCHTYPES_H
|
||||
|
||||
#ifdef _WIN32
|
||||
#pragma once
|
||||
#endif
|
||||
|
||||
#include <string.h>
|
||||
|
||||
// detects the build platform
|
||||
#if defined (__linux__) || defined (__debian__) || defined (__linux)
|
||||
#define __linux__ 1
|
||||
|
||||
#endif
|
||||
|
||||
// for when we care about how many bits we use
|
||||
typedef signed char int8;
|
||||
typedef signed short int16;
|
||||
typedef signed long int32;
|
||||
|
||||
#ifdef _WIN32
|
||||
#ifdef _MSC_VER
|
||||
typedef signed __int64 int64;
|
||||
#endif
|
||||
#elif defined __linux__
|
||||
typedef long long int64;
|
||||
#endif
|
||||
|
||||
typedef unsigned char uint8;
|
||||
typedef unsigned short uint16;
|
||||
typedef unsigned long uint32;
|
||||
|
||||
#ifdef _WIN32
|
||||
#ifdef _MSC_VER
|
||||
typedef unsigned __int64 uint64;
|
||||
#endif
|
||||
#elif defined __linux__
|
||||
typedef unsigned long long uint64;
|
||||
#endif
|
||||
|
||||
typedef float float32;
|
||||
typedef double float64;
|
||||
|
||||
// for when we don't care about how many bits we use
|
||||
typedef unsigned int uint;
|
||||
|
||||
// This can be used to ensure the size of pointers to members when declaring
|
||||
// a pointer type for a class that has only been forward declared
|
||||
#ifdef _MSC_VER
|
||||
#define SINGLE_INHERITANCE __single_inheritance
|
||||
#define MULTIPLE_INHERITANCE __multiple_inheritance
|
||||
#else
|
||||
#define SINGLE_INHERITANCE
|
||||
#define MULTIPLE_INHERITANCE
|
||||
#endif
|
||||
|
||||
// need these for the limits
|
||||
#include <limits.h>
|
||||
#include <float.h>
|
||||
|
||||
// Maximum and minimum representable values
|
||||
// fixing compiling againt maxosx10.10
|
||||
#if 0
|
||||
#define INT8_MAX SCHAR_MAX
|
||||
#define INT16_MAX SHRT_MAX
|
||||
#define INT32_MAX LONG_MAX
|
||||
#define INT64_MAX (((int64)~0) >> 1)
|
||||
|
||||
#define INT8_MIN SCHAR_MIN
|
||||
#define INT16_MIN SHRT_MIN
|
||||
#define INT32_MIN LONG_MIN
|
||||
#define INT64_MIN (((int64)1) << 63)
|
||||
|
||||
#define UINT8_MAX ((uint8)~0)
|
||||
#define UINT16_MAX ((uint16)~0)
|
||||
#define UINT32_MAX ((uint32)~0)
|
||||
#define UINT64_MAX ((uint64)~0)
|
||||
|
||||
#define UINT8_MIN 0
|
||||
#define UINT16_MIN 0
|
||||
#define UINT32_MIN 0
|
||||
#define UINT64_MIN 0
|
||||
|
||||
#ifndef UINT_MIN
|
||||
#define UINT_MIN UINT32_MIN
|
||||
#endif
|
||||
|
||||
#define FLOAT32_MAX FLT_MAX
|
||||
#define FLOAT64_MAX DBL_MAX
|
||||
|
||||
#define FLOAT32_MIN FLT_MIN
|
||||
#define FLOAT64_MIN DBL_MIN
|
||||
#endif
|
||||
|
||||
// portability / compiler settings
|
||||
#if defined(_WIN32) && !defined(WINDED)
|
||||
|
||||
#if defined(_M_IX86)
|
||||
#define __i386__ 1
|
||||
#endif
|
||||
|
||||
#elif __linux__
|
||||
typedef unsigned int DWORD;
|
||||
typedef unsigned short WORD;
|
||||
typedef void *HINSTANCE;
|
||||
|
||||
#define _MAX_PATH PATH_MAX
|
||||
#endif // defined(_WIN32) && !defined(WINDED)
|
||||
|
||||
// Defines MAX_PATH
|
||||
#ifndef MAX_PATH
|
||||
#define MAX_PATH 260
|
||||
#endif
|
||||
|
||||
// Used to step into the debugger
|
||||
#define DebuggerBreak() __asm { int 3 }
|
||||
|
||||
// C functions for external declarations that call the appropriate C++ methods
|
||||
#ifndef EXPORT
|
||||
#ifdef _WIN32
|
||||
#define EXPORT __declspec( dllexport )
|
||||
#else
|
||||
#define EXPORT /* */
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if defined __i386__ && !defined __linux__
|
||||
#define id386 1
|
||||
#else
|
||||
#define id386 0
|
||||
#endif // __i386__
|
||||
|
||||
#ifdef _WIN32
|
||||
// Used for dll exporting and importing
|
||||
#define DLL_EXPORT extern "C" __declspec( dllexport )
|
||||
#define DLL_IMPORT extern "C" __declspec( dllimport )
|
||||
|
||||
// Can't use extern "C" when DLL exporting a class
|
||||
#define DLL_CLASS_EXPORT __declspec( dllexport )
|
||||
#define DLL_CLASS_IMPORT __declspec( dllimport )
|
||||
|
||||
// Can't use extern "C" when DLL exporting a global
|
||||
#define DLL_GLOBAL_EXPORT extern __declspec( dllexport )
|
||||
#define DLL_GLOBAL_IMPORT extern __declspec( dllimport )
|
||||
#elif defined __linux__ || defined (__APPLE__)
|
||||
|
||||
// Used for dll exporting and importing
|
||||
#define DLL_EXPORT extern "C"
|
||||
#define DLL_IMPORT extern "C"
|
||||
|
||||
// Can't use extern "C" when DLL exporting a class
|
||||
#define DLL_CLASS_EXPORT
|
||||
#define DLL_CLASS_IMPORT
|
||||
|
||||
// Can't use extern "C" when DLL exporting a global
|
||||
#define DLL_GLOBAL_EXPORT extern
|
||||
#define DLL_GLOBAL_IMPORT extern
|
||||
|
||||
#else
|
||||
#error "Unsupported Platform."
|
||||
#endif
|
||||
|
||||
#ifndef _WIN32
|
||||
#define FAKEFUNC (void *) 0
|
||||
#else
|
||||
#define FAKEFUNC __noop
|
||||
#endif
|
||||
|
||||
// Used for standard calling conventions
|
||||
#ifdef _WIN32
|
||||
#define STDCALL __stdcall
|
||||
#define FASTCALL __fastcall
|
||||
#ifndef FORCEINLINE
|
||||
#define FORCEINLINE __forceinline
|
||||
#endif
|
||||
#else
|
||||
#define STDCALL
|
||||
#define FASTCALL
|
||||
#define FORCEINLINE inline
|
||||
#endif
|
||||
|
||||
// Force a function call site -not- to inlined. (useful for profiling)
|
||||
#define DONT_INLINE(a) (((int)(a)+1)?(a):(a))
|
||||
|
||||
// Pass hints to the compiler to prevent it from generating unnessecary / stupid code
|
||||
// in certain situations. Several compilers other than MSVC also have an equivilent
|
||||
// construct.
|
||||
//
|
||||
// Essentially the 'Hint' is that the condition specified is assumed to be true at
|
||||
// that point in the compilation. If '0' is passed, then the compiler assumes that
|
||||
// any subsequent code in the same 'basic block' is unreachable, and thus usually
|
||||
// removed.
|
||||
#ifdef _MSC_VER
|
||||
#define HINT(THE_HINT) __assume((THE_HINT))
|
||||
#else
|
||||
#define HINT(THE_HINT) 0
|
||||
#endif
|
||||
|
||||
// Marks the codepath from here until the next branch entry point as unreachable,
|
||||
// and asserts if any attempt is made to execute it.
|
||||
#define UNREACHABLE() { ASSERT(0); HINT(0); }
|
||||
|
||||
// In cases where no default is present or appropriate, this causes MSVC to generate
|
||||
// as little code as possible, and throw an assertion in debug.
|
||||
#define NO_DEFAULT default: UNREACHABLE();
|
||||
|
||||
#ifdef _WIN32
|
||||
// Alloca defined for this platform
|
||||
#define stackalloc( _size ) _alloca( _size )
|
||||
#define stackfree( _p ) 0
|
||||
#elif __linux__
|
||||
// Alloca defined for this platform
|
||||
#define stackalloc( _size ) alloca( _size )
|
||||
#define stackfree( _p ) 0
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
|
@ -602,10 +602,10 @@
|
|||
#define CHAN_NETWORKVOICE_END 500 // network voice data reserves slots (CHAN_NETWORKVOICE_BASE through CHAN_NETWORKVOICE_END).
|
||||
|
||||
// attenuation values
|
||||
#define ATTN_NONE 0
|
||||
#define ATTN_NORM (float)0.8
|
||||
#define ATTN_IDLE (float)2
|
||||
#define ATTN_STATIC (float)1.25
|
||||
#define ATTN_NONE 0.0f
|
||||
#define ATTN_NORM 0.8f
|
||||
#define ATTN_IDLE 2f
|
||||
#define ATTN_STATIC 1.25f
|
||||
|
||||
// pitch values
|
||||
#define PITCH_NORM 100 // non-pitch shifted
|
||||
|
|
@ -710,42 +710,6 @@ enum
|
|||
typedef int func_t;
|
||||
typedef int string_t;
|
||||
|
||||
typedef unsigned char byte;
|
||||
typedef unsigned short word;
|
||||
|
||||
#define _DEF_BYTE_
|
||||
|
||||
#undef true
|
||||
#undef false
|
||||
|
||||
#ifndef __cplusplus
|
||||
typedef enum
|
||||
{ false, true } int;
|
||||
#else
|
||||
#endif
|
||||
|
||||
typedef struct
|
||||
{
|
||||
byte r, g, b;
|
||||
} color24;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
unsigned r, g, b, a;
|
||||
} colorVec;
|
||||
|
||||
#ifdef _WIN32
|
||||
#pragma pack(push,2)
|
||||
#endif
|
||||
|
||||
typedef struct
|
||||
{
|
||||
unsigned short r, g, b, a;
|
||||
} PackedColorVec;
|
||||
|
||||
#ifdef _WIN32
|
||||
#pragma pack(pop)
|
||||
#endif
|
||||
typedef struct link_s
|
||||
{
|
||||
struct link_s *prev, *next;
|
||||
|
|
|
|||
|
|
@ -1,47 +0,0 @@
|
|||
/*
|
||||
* Copyright (c) 2001-2006 Will Day <willday@hpgx.net>
|
||||
*
|
||||
* This file is part of Metamod.
|
||||
*
|
||||
* Metamod 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.
|
||||
*
|
||||
* Metamod 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 Metamod; 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.
|
||||
*
|
||||
*/
|
||||
|
||||
// Simplified version by Wei Mingzhi
|
||||
|
||||
#ifndef DLLAPI_H
|
||||
#define DLLAPI_H
|
||||
|
||||
#undef DLLEXPORT
|
||||
#ifdef _WIN32
|
||||
#define DLLEXPORT __declspec(dllexport)
|
||||
#elif defined(linux) || defined (__APPLE__)
|
||||
#define DLLEXPORT /* */
|
||||
#define WINAPI /* */
|
||||
#endif /* linux */
|
||||
|
||||
#define C_DLLEXPORT extern "C" DLLEXPORT
|
||||
|
||||
#endif /* DLLAPI_H */
|
||||
|
|
@ -18,7 +18,6 @@
|
|||
#define INTERFACE_VERSION 140
|
||||
|
||||
#include <stdio.h>
|
||||
#include "archtypes.h"
|
||||
|
||||
#define FCVAR_ARCHIVE (1 << 0) // set to cause it to be saved to vars.rc
|
||||
#define FCVAR_USERINFO (1 << 1) // changes the client's info string
|
||||
|
|
@ -189,14 +188,14 @@ typedef struct enginefuncs_s
|
|||
void (*pfnGetAttachment) (const edict_t *ent, int iAttachment, float *rgflOrigin, float *rgflAngles);
|
||||
void (*pfnCRC32_Init) (CRC32_t *pulCRC);
|
||||
void (*pfnCRC32_ProcessBuffer) (CRC32_t *pulCRC, void *p, int len);
|
||||
void (*pfnCRC32_ProcessByte) (CRC32_t *pulCRC, unsigned char ch);
|
||||
void (*pfnCRC32_ProcessByte) (CRC32_t *pulCRC, uint8 ch);
|
||||
CRC32_t (*pfnCRC32_Final) (CRC32_t pulCRC);
|
||||
int32 (*pfnRandomLong) (int32 lLow, int32 lHigh);
|
||||
float (*pfnRandomFloat) (float flLow, float flHigh);
|
||||
void (*pfnSetView) (const edict_t *client, const edict_t *pViewent);
|
||||
float (*pfnTime) (void);
|
||||
void (*pfnCrosshairAngle) (const edict_t *client, float pitch, float yaw);
|
||||
byte *(*pfnLoadFileForMe) (char const *szFilename, int *pLength);
|
||||
uint8 *(*pfnLoadFileForMe) (char const *szFilename, int *pLength);
|
||||
void (*pfnFreeFile) (void *buffer);
|
||||
void (*pfnEndSection) (const char *pszSectionName); // trigger_endsection
|
||||
int (*pfnCompareFileTime) (char *filename1, char *filename2, int *compare);
|
||||
|
|
@ -204,10 +203,10 @@ typedef struct enginefuncs_s
|
|||
void (*pfnCvar_RegisterVariable) (cvar_t *variable);
|
||||
void (*pfnFadeClientVolume) (const edict_t *ent, int fadePercent, int fadeOutSeconds, int holdTime, int fadeInSeconds);
|
||||
void (*pfnSetClientMaxspeed) (const edict_t *ent, float fNewMaxspeed);
|
||||
edict_t *(*pfnCreateFakeClient) (const char *netname); // returns NULL if fake client can't be created
|
||||
void (*pfnRunPlayerMove) (edict_t *fakeclient, const float *viewangles, float forwardmove, float sidemove, float upmove, unsigned short buttons, byte impulse, byte msec);
|
||||
edict_t *(*pfnCreateFakeClient) (const char *netname); // returns nullptr if fake client can't be created
|
||||
void (*pfnRunPlayerMove) (edict_t *fakeclient, const float *viewangles, float forwardmove, float sidemove, float upmove, uint16 buttons, uint8 impulse, uint8 msec);
|
||||
int (*pfnNumberOfEntities) (void);
|
||||
char *(*pfnGetInfoKeyBuffer) (edict_t *e); // passing in NULL gets the serverinfo
|
||||
char *(*pfnGetInfoKeyBuffer) (edict_t *e); // passing in nullptr gets the serverinfo
|
||||
char *(*pfnInfoKeyValue) (char *infobuffer, char const *key);
|
||||
void (*pfnSetKeyValue) (char *infobuffer, char *key, char *value);
|
||||
void (*pfnSetClientKeyValue) (int clientIndex, char *infobuffer, char const *key, char const *value);
|
||||
|
|
@ -224,14 +223,14 @@ typedef struct enginefuncs_s
|
|||
const char *(*pfnGetPhysicsKeyValue) (const edict_t *client, const char *key);
|
||||
void (*pfnSetPhysicsKeyValue) (const edict_t *client, const char *key, const char *value);
|
||||
const char *(*pfnGetPhysicsInfoString) (const edict_t *client);
|
||||
unsigned short (*pfnPrecacheEvent) (int type, const char *psz);
|
||||
void (*pfnPlaybackEvent) (int flags, const edict_t *pInvoker, unsigned short evIndexOfEntity, float delay, float *origin, float *angles, float fparam1, float fparam2, int iparam1, int iparam2, int bparam1, int bparam2);
|
||||
unsigned char *(*pfnSetFatPVS) (float *org);
|
||||
unsigned char *(*pfnSetFatPAS) (float *org);
|
||||
int (*pfnCheckVisibility) (const edict_t *entity, unsigned char *pset);
|
||||
uint16 (*pfnPrecacheEvent) (int type, const char *psz);
|
||||
void (*pfnPlaybackEvent) (int flags, const edict_t *pInvoker, uint16 evIndexOfEntity, float delay, float *origin, float *angles, float fparam1, float fparam2, int iparam1, int iparam2, int bparam1, int bparam2);
|
||||
uint8 *(*pfnSetFatPVS) (float *org);
|
||||
uint8 *(*pfnSetFatPAS) (float *org);
|
||||
int (*pfnCheckVisibility) (const edict_t *entity, uint8 *pset);
|
||||
void (*pfnDeltaSetField) (struct delta_s *pFields, const char *fieldname);
|
||||
void (*pfnDeltaUnsetField) (struct delta_s *pFields, const char *fieldname);
|
||||
void (*pfnDeltaAddEncoder) (char *name, void (*conditionalencode) (struct delta_s *pFields, const unsigned char *from, const unsigned char *to));
|
||||
void (*pfnDeltaAddEncoder) (char *name, void (*conditionalencode) (struct delta_s *pFields, const uint8 *from, const uint8 *to));
|
||||
int (*pfnGetCurrentPlayer) (void);
|
||||
int (*pfnCanSkipPlayer) (const edict_t *player);
|
||||
int (*pfnDeltaFindField) (struct delta_s *pFields, const char *fieldname);
|
||||
|
|
@ -338,9 +337,9 @@ typedef struct
|
|||
void (*pfnPM_Move) (struct playermove_s *ppmove, int server);
|
||||
void (*pfnPM_Init) (struct playermove_s *ppmove);
|
||||
char (*pfnPM_FindTextureType) (char *name);
|
||||
void (*pfnSetupVisibility) (struct edict_s *pViewEntity, struct edict_s *client, unsigned char **pvs, unsigned char **pas);
|
||||
void (*pfnSetupVisibility) (struct edict_s *pViewEntity, struct edict_s *client, uint8 **pvs, uint8 **pas);
|
||||
void (*pfnUpdateClientData) (const struct edict_s *ent, int sendweapons, struct clientdata_s *cd);
|
||||
int (*pfnAddToFullPack) (struct entity_state_s *state, int e, edict_t *ent, edict_t *host, int hostflags, int player, unsigned char *pSet);
|
||||
int (*pfnAddToFullPack) (struct entity_state_s *state, int e, edict_t *ent, edict_t *host, int hostflags, int player, uint8 *pSet);
|
||||
void (*pfnCreateBaseline) (int player, int eindex, struct entity_state_s *baseline, struct edict_s *entity, int playermodelindex, float* player_mins, float* player_maxs);
|
||||
void (*pfnRegisterEncoders) (void);
|
||||
int (*pfnGetWeaponData) (struct edict_s *player, struct weapon_data_s *info);
|
||||
|
|
|
|||
|
|
@ -72,7 +72,7 @@ extern enginefuncs_t g_engfuncs;
|
|||
#define RANDOM_LONG (*g_engfuncs.pfnRandomLong)
|
||||
#define RANDOM_FLOAT (*g_engfuncs.pfnRandomFloat)
|
||||
#define GETPLAYERAUTHID (*g_engfuncs.pfnGetPlayerAuthId)
|
||||
static inline void MESSAGE_BEGIN (int msg_dest, int msg_type, const float *pOrigin = NULL, edict_t *ed = NULL)
|
||||
static inline void MESSAGE_BEGIN (int msg_dest, int msg_type, const float *pOrigin = nullptr, edict_t *ed = nullptr)
|
||||
{
|
||||
(*g_engfuncs.pfnMessageBegin) (msg_dest, msg_type, pOrigin, ed);
|
||||
}
|
||||
|
|
@ -95,7 +95,7 @@ static inline void MESSAGE_BEGIN (int msg_dest, int msg_type, const float *pOrig
|
|||
#define ALERT (*g_engfuncs.pfnAlertMessage)
|
||||
#define ENGINE_FPRINTF (*g_engfuncs.pfnEngineFprintf)
|
||||
#define ALLOC_PRIVATE (*g_engfuncs.pfnPvAllocEntPrivateData)
|
||||
#define GET_PRIVATE(pent) (pent ? (pent->pvPrivateData) : NULL);
|
||||
#define GET_PRIVATE(pent) (pent ? (pent->pvPrivateData) : nullptr);
|
||||
#define FREE_PRIVATE (*g_engfuncs.pfnFreeEntPrivateData)
|
||||
#define ALLOC_STRING (*g_engfuncs.pfnAllostring)
|
||||
#define FIND_ENTITY_BY_STRING (*g_engfuncs.pfnFindEntityByString)
|
||||
|
|
|
|||
|
|
@ -16,21 +16,7 @@
|
|||
#ifndef EXTDLL_H
|
||||
#define EXTDLL_H
|
||||
|
||||
#ifdef DLL_DEBUG
|
||||
#define DEBUG 1
|
||||
#endif
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#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 : 4715) // not all control paths return a value
|
||||
#pragma warning (disable : 4996) // function was declared deprecated
|
||||
#pragma warning (disable : 4702) // unreachable code
|
||||
#pragma warning (disable : 4706) // assignment within conditional expression
|
||||
|
||||
/* disable deprecation warnings concerning unsafe CRT functions */
|
||||
#if !defined _CRT_SECURE_NO_DEPRECATE
|
||||
#define _CRT_SECURE_NO_DEPRECATE
|
||||
|
|
@ -49,7 +35,7 @@
|
|||
#define FALSE 0
|
||||
#define TRUE (!FALSE)
|
||||
typedef unsigned long ULONG;
|
||||
typedef unsigned char BYTE;
|
||||
typedef uint8 BYTE;
|
||||
typedef int BOOL;
|
||||
|
||||
#define MAX_PATH PATH_MAX
|
||||
|
|
@ -68,8 +54,6 @@ typedef int BOOL;
|
|||
#include "stdlib.h"
|
||||
#include "math.h"
|
||||
|
||||
#include <archtypes.h>
|
||||
|
||||
typedef int func_t; //
|
||||
typedef int string_t; // from engine's pr_comp.h;
|
||||
typedef float vec_t; // needed before including progdefs.h
|
||||
|
|
|
|||
|
|
@ -8,6 +8,7 @@
|
|||
#ifndef META_API_H
|
||||
#define META_API_H
|
||||
|
||||
|
||||
typedef int (*GameAPI_t) (gamefuncs_t *, int);
|
||||
typedef int (*GameAPI2_t) (gamefuncs_t *, int *);
|
||||
typedef int (*NewAPI2_t) (gamefuncs_t *, int *);
|
||||
|
|
@ -18,9 +19,6 @@ typedef int (*GETENTITYAPI2_FN) (gamefuncs_t *pFunctionTable, int *interfaceVers
|
|||
typedef int (*GETNEWDLLFUNCTIONS_FN) (newgamefuncs_t *pFunctionTable, int *interfaceVersion);
|
||||
typedef int (*GET_ENGINE_FUNCTIONS_FN) (enginefuncs_t *pengfuncsFromEngine, int *interfaceVersion);
|
||||
|
||||
C_DLLEXPORT int GetEntityAPI (gamefuncs_t *pFunctionTable, int interfaceVersion);
|
||||
C_DLLEXPORT int GetEntityAPI2 (gamefuncs_t *pFunctionTable, int *interfaceVersion);
|
||||
C_DLLEXPORT int GetNewDLLFunctions (newgamefuncs_t *pNewFunctionTable, int *interfaceVersion);
|
||||
|
||||
#define META_INTERFACE_VERSION "5:13"
|
||||
|
||||
|
|
@ -159,26 +157,6 @@ extern mutil_funcs_t *gpMetaUtilFuncs;
|
|||
extern meta_globals_t *gpMetaGlobals;
|
||||
extern metamod_funcs_t gMetaFunctionTable;
|
||||
|
||||
C_DLLEXPORT void Meta_Init (void);
|
||||
typedef void (*META_INIT_FN) (void);
|
||||
|
||||
C_DLLEXPORT int Meta_Query (char *interfaceVersion, plugin_info_t **plinfo, mutil_funcs_t *pMetaUtilFuncs);
|
||||
typedef int (*META_QUERY_FN) (char *interfaceVersion, plugin_info_t **plinfo, mutil_funcs_t *pMetaUtilFuncs);
|
||||
|
||||
C_DLLEXPORT int Meta_Attach (PLUG_LOADTIME now, metamod_funcs_t *pFunctionTable, meta_globals_t *pMGlobals, gamedll_funcs_t *pGamedllFuncs);
|
||||
typedef int (*META_ATTACH_FN) (PLUG_LOADTIME now, metamod_funcs_t *pFunctionTable, meta_globals_t *pMGlobals, gamedll_funcs_t *pGamedllFuncs);
|
||||
|
||||
C_DLLEXPORT int Meta_Detach (PLUG_LOADTIME now, PL_UNLOAD_REASON reason);
|
||||
typedef int (*META_DETACH_FN) (PLUG_LOADTIME now, PL_UNLOAD_REASON reason);
|
||||
|
||||
C_DLLEXPORT int GetEntityAPI_Post (gamefuncs_t *pFunctionTable, int interfaceVersion);
|
||||
C_DLLEXPORT int GetEntityAPI2_Post (gamefuncs_t *pFunctionTable, int *interfaceVersion);
|
||||
|
||||
C_DLLEXPORT int GetNewDLLFunctions_Post (newgamefuncs_t *pNewFunctionTable, int *interfaceVersion);
|
||||
C_DLLEXPORT int GetEngineFunctions (enginefuncs_t *pengfuncsFromEngine, int *interfaceVersion);
|
||||
C_DLLEXPORT int GetEngineFunctions_Post (enginefuncs_t *pengfuncsFromEngine, int *interfaceVersion);
|
||||
|
||||
|
||||
|
||||
#define MDLL_FUNC gpGamedllFuncs->dllapi_table
|
||||
|
||||
|
|
|
|||
|
|
@ -1,14 +0,0 @@
|
|||
/*
|
||||
* Copyright (c) 2001-2006 Will Day <willday@hpgx.net>
|
||||
* See the file "dllapi.h" in this folder for full information
|
||||
*/
|
||||
|
||||
// Simplified version by Wei Mingzhi
|
||||
|
||||
#ifndef MUTIL_H
|
||||
#define MUTIL_H
|
||||
|
||||
#include "plinfo.h"
|
||||
#include "sdk_util.h"
|
||||
|
||||
#endif /* MUTIL_H */
|
||||
|
|
@ -1,11 +0,0 @@
|
|||
/*
|
||||
* Copyright (c) 2001-2006 Will Day <willday@hpgx.net>
|
||||
* See the file "dllapi.h" in this folder for full information
|
||||
*/
|
||||
|
||||
// Simplified version by Wei Mingzhi
|
||||
|
||||
#ifndef PLINFO_H
|
||||
#define PLINFO_H
|
||||
|
||||
#endif
|
||||
|
|
@ -116,8 +116,8 @@ typedef struct entvars_s
|
|||
float frame; // % playback position in animation sequences (0..255)
|
||||
float animtime; // world time when frame was set
|
||||
float framerate; // animation playback rate (-8x to 8x)
|
||||
byte controller[4]; // bone controller setting (0..255)
|
||||
byte blending[2]; // blending amount between sub-sequences (0..255)
|
||||
uint8 controller[4]; // bone controller setting (0..255)
|
||||
uint8 blending[2]; // blending amount between sub-sequences (0..255)
|
||||
|
||||
float scale; // sprite rendering scale (0..255)
|
||||
|
||||
|
|
|
|||
|
|
@ -1,23 +0,0 @@
|
|||
/*
|
||||
* Copyright (c) 2001-2006 Will Day <willday@hpgx.net>
|
||||
* See the file "dllapi.h" in this folder for full information
|
||||
*/
|
||||
|
||||
// Simplified version by Wei Mingzhi
|
||||
|
||||
#ifndef SDK_UTIL_H
|
||||
#define SDK_UTIL_H
|
||||
|
||||
#ifdef DEBUG
|
||||
#undef DEBUG
|
||||
#endif
|
||||
|
||||
#include <util.h>
|
||||
|
||||
|
||||
|
||||
|
||||
short FixedSigned16 (float value, float scale);
|
||||
unsigned short FixedUnsigned16 (float value, float scale);
|
||||
|
||||
#endif
|
||||
|
|
@ -73,94 +73,14 @@ typedef int BOOL;
|
|||
#define M_PI 3.1415926
|
||||
#endif
|
||||
|
||||
//
|
||||
// Conversion among the three types of "entity", including identity-conversions.
|
||||
//
|
||||
#if 0
|
||||
static inline edict_t *ENT (const entvars_t *pev)
|
||||
{
|
||||
return pev->pContainingEntity;
|
||||
}
|
||||
static inline edict_t *ENT (edict_t *pent)
|
||||
{
|
||||
return pent;
|
||||
}
|
||||
static inline edict_t *ENT (EOFFSET eoffset)
|
||||
{
|
||||
return (*g_engfuncs.pfnPEntityOfEntOffset) (eoffset);
|
||||
}
|
||||
static inline EOFFSET OFFSET (EOFFSET eoffset)
|
||||
{
|
||||
return eoffset;
|
||||
}
|
||||
static inline EOFFSET OFFSET (const edict_t *pent)
|
||||
{
|
||||
#if _DEBUG
|
||||
if (!pent)
|
||||
ALERT (at_error, "Bad ent in OFFSET()\n");
|
||||
#endif
|
||||
return (*g_engfuncs.pfnEntOffsetOfPEntity) (pent);
|
||||
}
|
||||
static inline EOFFSET OFFSET (entvars_t *pev)
|
||||
{
|
||||
#if _DEBUG
|
||||
if (!pev)
|
||||
ALERT (at_error, "Bad pev in OFFSET()\n");
|
||||
#endif
|
||||
return OFFSET (ENT (pev));
|
||||
}
|
||||
static inline entvars_t *VARS (entvars_t *pev)
|
||||
{
|
||||
return pev;
|
||||
}
|
||||
|
||||
static inline entvars_t *VARS (edict_t *pent)
|
||||
{
|
||||
if (!pent)
|
||||
return NULL;
|
||||
|
||||
return &pent->v;
|
||||
}
|
||||
|
||||
static inline entvars_t *VARS (EOFFSET eoffset)
|
||||
{
|
||||
return VARS (ENT (eoffset));
|
||||
}
|
||||
#endif
|
||||
short FixedSigned16 (float value, float scale);
|
||||
uint16 FixedUnsigned16 (float value, float scale);
|
||||
|
||||
static inline void MESSAGE_BEGIN (int msg_dest, int msg_type, const float *pOrigin, entvars_t *ent)
|
||||
{
|
||||
(*g_engfuncs.pfnMessageBegin) (msg_dest, msg_type, pOrigin, ent->pContainingEntity);
|
||||
}
|
||||
|
||||
#if 0
|
||||
// Testing the three types of "entity" for nullity
|
||||
#define eoNullEntity 0
|
||||
static inline BOOL FNullEnt (EOFFSET eoffset)
|
||||
{
|
||||
return eoffset == 0;
|
||||
}
|
||||
static inline BOOL FNullEnt (entvars_t *pev)
|
||||
{
|
||||
return pev == NULL || FNullEnt (OFFSET (pev));
|
||||
}
|
||||
static inline int FNullEnt (const edict_t *pent)
|
||||
{
|
||||
return !pent || !(*g_engfuncs.pfnEntOffsetOfPEntity) (pent);
|
||||
}
|
||||
|
||||
// Testing strings for nullity
|
||||
#define iStringNull 0
|
||||
static inline BOOL FStringNull (int stingPtr)
|
||||
{
|
||||
return stingPtr == iStringNull;
|
||||
}
|
||||
|
||||
#define cchMapNameMost 32
|
||||
|
||||
#define SAFE_FUNCTION_CALL(pfn,args) try { pfn args; } catch (...) { }
|
||||
#endif
|
||||
|
||||
// Dot products for view cone checking
|
||||
#define VIEW_FIELD_FULL (float)-1.0 // +-180 degrees
|
||||
#define VIEW_FIELD_WIDE (float)-0.7 // +-135 degrees 0.1 // +-85 degrees, used for full FOV checks
|
||||
|
|
@ -195,8 +115,8 @@ typedef struct hudtextparms_s
|
|||
float x;
|
||||
float y;
|
||||
int effect;
|
||||
byte r1, g1, b1, a1;
|
||||
byte r2, g2, b2, a2;
|
||||
uint8 r1, g1, b1, a1;
|
||||
uint8 r2, g2, b2, a2;
|
||||
float fadeinTime;
|
||||
float fadeoutTime;
|
||||
float holdTime;
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@
|
|||
//
|
||||
// This software is licensed under the BSD-style license.
|
||||
// Additional exceptions apply. For full license details, see LICENSE.txt or visit:
|
||||
// http://yapb.jeefo.net/license
|
||||
// https://yapb.jeefo.net/license
|
||||
//
|
||||
|
||||
#pragma once
|
||||
|
|
@ -69,7 +69,7 @@ extern gamefuncs_t g_functionTable;
|
|||
|
||||
static inline bool IsNullString (const char *input)
|
||||
{
|
||||
if (input == NULL)
|
||||
if (input == nullptr)
|
||||
return true;
|
||||
|
||||
return *input == '\0';
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@
|
|||
//
|
||||
// This software is licensed under the BSD-style license.
|
||||
// Additional exceptions apply. For full license details, see LICENSE.txt or visit:
|
||||
// http://yapb.jeefo.net/license
|
||||
// https://yapb.jeefo.net/license
|
||||
//
|
||||
|
||||
#pragma once
|
||||
|
|
@ -40,14 +40,14 @@
|
|||
#include <direct.h>
|
||||
#include <string.h>
|
||||
|
||||
#define DLL_ENTRYPOINT int STDCALL DllMain (HINSTANCE, DWORD dwReason, LPVOID)
|
||||
#define DLL_ENTRYPOINT int __stdcall DllMain (HINSTANCE, DWORD dwReason, LPVOID)
|
||||
#define DLL_DETACHING (dwReason == DLL_PROCESS_DETACH)
|
||||
#define DLL_RETENTRY return TRUE
|
||||
|
||||
#if defined (COMPILER_VISUALC)
|
||||
#define DLL_GIVEFNPTRSTODLL extern "C" void STDCALL
|
||||
#define DLL_GIVEFNPTRSTODLL extern "C" void __stdcall
|
||||
#elif defined (COMPILER_MINGW32)
|
||||
#define DLL_GIVEFNPTRSTODLL SHARED_LIBRARAY_EXPORT void STDCALL
|
||||
#define DLL_GIVEFNPTRSTODLL SHARED_LIBRARAY_EXPORT void __stdcall
|
||||
#endif
|
||||
|
||||
// specify export parameter
|
||||
|
|
@ -59,7 +59,7 @@
|
|||
typedef int (FAR *EntityAPI_t) (gamefuncs_t *, int);
|
||||
typedef int (FAR *NewEntityAPI_t) (newgamefuncs_t *, int *);
|
||||
typedef int (FAR *BlendAPI_t) (int, void **, void *, float (*)[3][4], float (*)[128][3][4]);
|
||||
typedef void (STDCALL *FuncPointers_t) (enginefuncs_t *, globalvars_t *);
|
||||
typedef void (__stdcall *FuncPointers_t) (enginefuncs_t *, globalvars_t *);
|
||||
typedef void (FAR *EntityPtr_t) (entvars_t *);
|
||||
|
||||
#elif defined (PLATFORM_LINUX) || defined (PLATFORM_OSX)
|
||||
|
|
@ -105,9 +105,9 @@ public:
|
|||
|
||||
Library (const char *fileName)
|
||||
{
|
||||
m_ptr = NULL;
|
||||
m_ptr = nullptr;
|
||||
|
||||
if (fileName == NULL)
|
||||
if (fileName == nullptr)
|
||||
return;
|
||||
|
||||
LoadLib (fileName);
|
||||
|
|
@ -140,7 +140,7 @@ public:
|
|||
template <typename R> R GetFuncAddr (const char *function)
|
||||
{
|
||||
if (!IsLoaded ())
|
||||
return NULL;
|
||||
return nullptr;
|
||||
|
||||
#ifdef PLATFORM_WIN32
|
||||
return reinterpret_cast <R> (GetProcAddress (static_cast <HMODULE> (m_ptr), function));
|
||||
|
|
@ -156,6 +156,6 @@ public:
|
|||
|
||||
inline bool IsLoaded (void) const
|
||||
{
|
||||
return m_ptr != NULL;
|
||||
return m_ptr != nullptr;
|
||||
}
|
||||
};
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@
|
|||
//
|
||||
// This software is licensed under the BSD-style license.
|
||||
// Additional exceptions apply. For full license details, see LICENSE.txt or visit:
|
||||
// http://yapb.jeefo.net/license
|
||||
// https://yapb.jeefo.net/license
|
||||
//
|
||||
|
||||
#pragma once
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue