Added gradle task buildFixes for faster building.

This commit is contained in:
s1lentq 2016-07-18 04:09:31 +07:00
parent 8914b84129
commit 1e8180f5ad
23 changed files with 563 additions and 233 deletions

View File

@ -66,10 +66,15 @@ icc (ICC) 15.0.1 20141023
### Building ### Building
On Windows: On Windows:
<pre>gradlew --max-workers=1 clean buildRelease</pre> <pre>gradlew --max-workers=1 clean buildRelease</pre>
* For faster building without unit tests use this:exclamation:
<pre>gradlew --max-workers=1 clean buildFixes</pre>
On Linux: On Linux:
<pre>./gradlew --max-workers=1 clean buildRelease</pre> <pre>./gradlew --max-workers=1 clean buildRelease</pre>
* For faster building without unit tests use this:exclamation:
<pre>./gradlew --max-workers=1 clean buildFixes</pre>
Compiled binaries will be placed in the build/binaries/ directory Compiled binaries will be placed in the build/binaries/ directory
### Credits ### Credits

View File

@ -317,6 +317,24 @@ task buildRelease {
} }
} }
task buildFixes {
dependsOn binaries.withType(SharedLibraryBinarySpec).matching {
SharedLibraryBinarySpec blib -> blib.buildable && blib.buildType.name == 'release' && blib.flavor.name == 'regamedllFixes' && blib.component.name == 'regamedll_mp_gamedll'
}
}
gradle.taskGraph.whenReady { graph ->
if (!graph.hasTask(buildFixes)) {
return;
}
// skip all tasks with the matched substrings in the name like "test"
def tasks = graph.getAllTasks();
tasks.findAll { it.name.toLowerCase().contains("test") }.each { task ->
task.enabled = false;
}
}
task prepareDevEnvTests { task prepareDevEnvTests {
def regamedllTests = new File(project.projectDir, '_dev/testDemos') def regamedllTests = new File(project.projectDir, '_dev/testDemos')

View File

@ -26,11 +26,7 @@
* *
*/ */
#ifndef MATHLIB_H
#define MATHLIB_H
#ifdef _WIN32
#pragma once #pragma once
#endif
#ifdef PLAY_GAMEDLL #ifdef PLAY_GAMEDLL
@ -59,15 +55,41 @@ typedef union DLONG_u
#define M_PI 3.14159265358979323846 #define M_PI 3.14159265358979323846
template <typename T> #ifdef __cplusplus
T Q_min(T a, T b) { return (a < b) ? a : b; } #ifdef min
#undef min
#endif
#ifdef max
#undef max
#endif
#ifdef clamp
#undef clamp
#endif
template <typename T> template <typename T>
T Q_max(T a, T b) { return (a > b) ? a : b; } T min(T a, T b) { return (a < b) ? a : b; }
template <typename T>
T max(T a, T b) { return (a > b) ? a : b; }
template <typename T> template <typename T>
T clamp(T a, T min, T max) { return (a > max) ? max : (a < min) ? min : a; } T clamp(T a, T min, T max) { return (a > max) ? max : (a < min) ? min : a; }
#else // __cplusplus
#ifndef max
#define max(a,b) (((a) > (b)) ? (a) : (b))
#endif
#ifndef min
#define min(a,b) (((a) < (b)) ? (a) : (b))
#endif
#define clamp(val, min, max) (((val) > (max)) ? (max) : (((val) < (min)) ? (min) : (val)))
#endif // __cplusplus
// bitwise operators templates // bitwise operators templates
template<class T, class type=typename std::underlying_type<T>::type> template<class T, class type=typename std::underlying_type<T>::type>
inline T operator~ (T a) { return (T)~(type)a; } inline T operator~ (T a) { return (T)~(type)a; }
@ -84,9 +106,22 @@ inline T& operator&= (T& a, T b) { return (T&)((type&)a &= (type)b); }
template<class T, class type=typename std::underlying_type<T>::type> template<class T, class type=typename std::underlying_type<T>::type>
inline T& operator^= (T& a, T b) { return (T&)((type&)a ^= (type)b); } inline T& operator^= (T& a, T b) { return (T&)((type&)a ^= (type)b); }
inline double M_sqrt(int value) {
return sqrt(value);
}
inline float M_sqrt(float value) {
return _mm_cvtss_f32(_mm_sqrt_ss(_mm_load_ss(&value)));
}
inline double M_sqrt(double value) {
double ret;
auto v = _mm_load_sd(&value);
_mm_store_sd(&ret, _mm_sqrt_sd(v, v));
return ret;
}
#define VectorSubtract(a,b,c) {(c)[0]=(a)[0]-(b)[0];(c)[1]=(a)[1]-(b)[1];(c)[2]=(a)[2]-(b)[2];} #define VectorSubtract(a,b,c) {(c)[0]=(a)[0]-(b)[0];(c)[1]=(a)[1]-(b)[1];(c)[2]=(a)[2]-(b)[2];}
#define VectorAdd(a,b,c) {(c)[0]=(a)[0]+(b)[0];(c)[1]=(a)[1]+(b)[1];(c)[2]=(a)[2]+(b)[2];} #define VectorAdd(a,b,c) {(c)[0]=(a)[0]+(b)[0];(c)[1]=(a)[1]+(b)[1];(c)[2]=(a)[2]+(b)[2];}
#define VectorCopy(a,b) {(b)[0]=(a)[0];(b)[1]=(a)[1];(b)[2]=(a)[2];} #define VectorCopy(a,b) {(b)[0]=(a)[0];(b)[1]=(a)[1];(b)[2]=(a)[2];}
#define VectorClear(a) {(a)[0]=0.0;(a)[1]=0.0;(a)[2]=0.0;} #define VectorClear(a) {(a)[0]=0.0;(a)[1]=0.0;(a)[2]=0.0;}
#endif // MATHLIB_H

View File

@ -0,0 +1,39 @@
//========= Copyright (c) 1996-2002, Valve LLC, All rights reserved. ==========
//
// Purpose:
//
// $NoKeywords: $
//=============================================================================
#ifndef QLIMITS_H
#define QLIMITS_H
#if defined( _WIN32 )
#pragma once
#endif
// DATA STRUCTURE INFO
#define MAX_NUM_ARGVS 50
// SYSTEM INFO
#define MAX_QPATH 64 // max length of a game pathname
#define MAX_OSPATH 260 // max length of a filesystem pathname
#define ON_EPSILON 0.1 // point on plane side epsilon
#define MAX_LIGHTSTYLE_INDEX_BITS 6
#define MAX_LIGHTSTYLES (1<<MAX_LIGHTSTYLE_INDEX_BITS)
// Resource counts;
#define MAX_MODEL_INDEX_BITS 9 // sent as a short
#define MAX_MODELS (1<<MAX_MODEL_INDEX_BITS)
#define MAX_SOUND_INDEX_BITS 9
#define MAX_SOUNDS (1<<MAX_SOUND_INDEX_BITS)
#define MAX_GENERIC_INDEX_BITS 9
#define MAX_GENERIC (1<<MAX_GENERIC_INDEX_BITS)
#define MAX_DECAL_INDEX_BITS 9
#define MAX_BASE_DECALS (1<<MAX_DECAL_INDEX_BITS)
#endif // QLIMITS_H

View File

@ -26,11 +26,7 @@
* *
*/ */
#ifndef EXTDLL_H
#define EXTDLL_H
#ifdef _WIN32
#pragma once #pragma once
#endif
#pragma warning(disable:4244) // int or float down-conversion #pragma warning(disable:4244) // int or float down-conversion
#pragma warning(disable:4305) // int or float data truncation #pragma warning(disable:4305) // int or float data truncation
@ -39,9 +35,10 @@
#pragma warning(disable:4100) // unreferenced formal parameter #pragma warning(disable:4100) // unreferenced formal parameter
#include "archtypes.h" #include "archtypes.h"
#include "maintypes.h"
#include "regamedll_common.h"
#ifdef _WIN32 #ifdef _WIN32
#define WIN32_LEAN_AND_MEAN #define WIN32_LEAN_AND_MEAN
#define NOWINRES #define NOWINRES
#define NOSERVICE #define NOSERVICE
@ -52,11 +49,9 @@
#include "winsani_out.h" #include "winsani_out.h"
#undef PlaySound #undef PlaySound
#else #else
#include <limits.h> #include <limits.h>
#include <stdarg.h> #include <stdarg.h>
#include <string.h> #include <string.h>
#endif // _WIN32 #endif // _WIN32
// Misc C-runtime library headers // Misc C-runtime library headers
@ -82,5 +77,4 @@ typedef float vec_t; // needed before including progdefs.h
#include "eiface.h" #include "eiface.h"
// Shared header between the client DLL and the game DLLs // Shared header between the client DLL and the game DLLs
#include "cdll_dll.h" #include "cdll_dll.h"
#include "extdef.h"
#endif // EXTDLL_H

View File

@ -597,7 +597,7 @@ void CBasePlayer::Radio(const char *msg_id, const char *msg_verbose, short pitch
Place playerPlace = TheNavAreaGrid.GetPlace(&pev->origin); Place playerPlace = TheNavAreaGrid.GetPlace(&pev->origin);
const BotPhraseList *placeList = TheBotPhrases->GetPlaceList(); const BotPhraseList *placeList = TheBotPhrases->GetPlaceList();
for (BotPhraseList::const_iterator iter = placeList->begin(); iter != placeList->end(); ++iter) for (auto iter = placeList->begin(); iter != placeList->end(); ++iter)
{ {
if ((*iter)->GetID() == playerPlace) if ((*iter)->GetID() == playerPlace)
{ {

View File

@ -26,33 +26,31 @@
* *
*/ */
#ifndef COMMON_H
#define COMMON_H
#ifdef _WIN32
#pragma once #pragma once
#endif
#include "maintypes.h" #include "const.h"
#include "bspfile.h" #include "qlimits.h"
#include "FileSystem.h"
#include "info.h"
// Don't allow overflow // Don't allow overflow
#define SIZEBUF_CHECK_OVERFLOW 0 #define SIZEBUF_CHECK_OVERFLOW 0
#define SIZEBUF_ALLOW_OVERFLOW BIT(0) #define SIZEBUF_ALLOW_OVERFLOW BIT(0)
#define SIZEBUF_OVERFLOWED BIT(1) #define SIZEBUF_OVERFLOWED BIT(1)
/* <6ae> ../common/common.h:82 */ #define MAX_NUM_ARGVS 50
#define NUM_SAFE_ARGVS 7
#define COM_COPY_CHUNK_SIZE 1024
#define COM_MAX_CMD_LINE 256
typedef struct sizebuf_s typedef struct sizebuf_s
{ {
const char *buffername; const char *buffername;
uint16_t flags; uint16 flags;
byte *data; byte *data;
int maxsize; int maxsize;
int cursize; int cursize;
} sizebuf_t; } sizebuf_t;
/* <270aa> ../common/common.h:297 */
typedef struct downloadtime_s typedef struct downloadtime_s
{ {
qboolean bUsed; qboolean bUsed;
@ -60,7 +58,6 @@ typedef struct downloadtime_s
int nBytesRemaining; int nBytesRemaining;
} downloadtime_t; } downloadtime_t;
/* <19fa2> ../common/common.h:303 */
typedef struct incomingtransfer_s typedef struct incomingtransfer_s
{ {
qboolean doneregistering; qboolean doneregistering;
@ -74,90 +71,3 @@ typedef struct incomingtransfer_s
float fLastStatusUpdate; float fLastStatusUpdate;
qboolean custom; qboolean custom;
} incomingtransfer_t; } incomingtransfer_t;
#ifndef _WIN32
#define _strlwr(p) for (int i = 0; p[i] != 0; i++) p[i] = tolower(p[i]);
#endif // _WIN32
inline double M_sqrt(int value) {
return sqrt(value);
}
inline float M_sqrt(float value) {
return _mm_cvtss_f32(_mm_sqrt_ss(_mm_load_ss(&value)));
}
inline double M_sqrt(double value) {
double ret;
auto v = _mm_load_sd(&value);
_mm_store_sd(&ret, _mm_sqrt_sd(v, v));
return ret;
}
#define printf2 _printf2
#define chatf _print_chat
#define Q_isspace isspace
#define Q_isalnum isalnum
#define Q_isalpha isalpha
#define Q_malloc malloc
#define Q_calloc calloc
#define Q_alloca alloca
#define Q_free free
#define Q_access _access
#define Q_close _close
#define Q_write _write
#define Q_memset memset
#define Q_memcpy memcpy
#define Q_strlen strlen
#define Q_memcmp memcmp
#define Q_strcpy strcpy
#define Q_strncpy strncpy
#define Q_strrchr strrchr
#define Q_strcat strcat
#define Q_strncat strncat
#define Q_strcmp strcmp
#define Q_strncmp strncmp
//#define Q_strcasecmp _stricmp // Use Q_stricmp
//#define Q_strncasecmp _strnicmp // Use Q_strnicmp
#define Q_sscanf sscanf
#define Q_strdup _strdup
#define Q_stricmp _stricmp
#define Q_strnicmp _strnicmp
#define Q_strstr strstr
#define Q_strchr strchr
#define Q_strrchr strrchr
#define Q_strlwr _strlwr
#define Q_sprintf sprintf
#define Q_snprintf _snprintf
#define Q_atoi atoi
#define Q_atof atof
#define Q_toupper toupper
#define Q_memmove memmove
//#define Q_strtoull strtoull
//#define Q_FileNameCmp FileNameCmp
#define Q_vsnprintf _vsnprintf
#define Q_vsnwprintf _vsnwprintf
#define Q_abs abs
#define Q_fabs fabs
#define Q_tan tan
#define Q_atan atan
#define Q_atan2 atan2
#define Q_acos acos
#define Q_cos cos
#define Q_sin sin
#define Q_sqrt sqrt
#define Q_pow pow
#define Q_fmod fmod
#define Q_fopen fopen
#define Q_fprintf fprintf
#define Q_fclose fclose
#ifdef REGAMEDLL_FIXES
#undef Q_sqrt
#define Q_sqrt M_sqrt
#endif
#endif // COMMON_H

View File

@ -1,37 +1,51 @@
/*** /*
* *
* Copyright (c) 1996-2002, Valve LLC. All rights reserved. * 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 product contains software technology licensed from Id * This program is distributed in the hope that it will be useful, but
* Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc. * WITHOUT ANY WARRANTY; without even the implied warranty of
* All Rights Reserved. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
* *
* Use, distribution, and modification of this source code and/or resulting * You should have received a copy of the GNU General Public License
* object code is restricted to non-commercial enhancements to products from * along with this program; if not, write to the Free Software Foundation,
* Valve LLC. All other use, distribution, or modification is prohibited * Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
* without written permission from Valve LLC.
* *
****/ * 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 MATHLIB_H #pragma once
#define MATHLIB_H
#ifdef PLAY_GAMEDLL
// probably gamedll compiled with flag /fpmath:fasted,
// so we need to use type double, otherwise will be the test failed
typedef double float_precision;
#else
typedef float float_precision;
#endif // PLAY_GAMEDLL
/* <42b7f> ../common/mathlib.h:3 */
typedef float vec_t; typedef float vec_t;
/* <42b91> ../common/mathlib.h:6 */
#if !defined DID_VEC3_T_DEFINE && !defined vec3_t
#define DID_VEC3_T_DEFINE
typedef vec_t vec3_t[3]; typedef vec_t vec3_t[3];
#endif
/* <80013> ../common/mathlib.h:8 */
typedef vec_t vec4_t[4]; typedef vec_t vec4_t[4];
typedef int fixed16_t;
/* <42bac> ../common/mathlib.h:18 */
typedef int fixed16_t; /* size: 4 */
/* <42bb7> ../common/mathlib.h:60 */
typedef union DLONG_u typedef union DLONG_u
{ {
int i[2]; int i[2];
@ -55,36 +69,16 @@ typedef union DLONG_u
#endif #endif
template <typename T> template <typename T>
inline T min(T a, T b) { T min(T a, T b) { return (a < b) ? a : b; }
return (a < b) ? a : b;
}
template <typename T> template <typename T>
inline T max(T a, T b) { T max(T a, T b) { return (a > b) ? a : b; }
return (a < b) ? b : a;
}
template <typename T> template <typename T>
inline T clamp(T a, T min, T max) { T clamp(T a, T min, T max) { return (a > max) ? max : (a < min) ? min : a; }
return (a > max) ? max : (a < min) ? min : a;
}
template <typename T>
inline T bswap(T s) {
switch (sizeof(T)) {
#ifdef _WIN32
case 2: {auto res = _byteswap_ushort(*(uint16 *)&s); return *(T *)&res;}
case 4: {auto res = _byteswap_ulong(*(uint32 *)(&s)); return *(T *)&res;}
case 8: {auto res = _byteswap_uint64(*(uint64 *)&s); return *(T *)&res;}
#else
case 2: {auto res = _bswap16(*(uint16 *)&s); return *(T *)&res;}
case 4: {auto res = _bswap(*(uint32 *)&s); return *(T *)&res;}
case 8: {auto res = _bswap64(*(uint64 *)&s); return *(T *)&res;}
#endif
default: return s;
}
}
#else // __cplusplus #else // __cplusplus
#ifndef max #ifndef max
#define max(a,b) (((a) > (b)) ? (a) : (b)) #define max(a,b) (((a) > (b)) ? (a) : (b))
#endif #endif
@ -96,4 +90,38 @@ inline T bswap(T s) {
#define clamp(val, min, max) (((val) > (max)) ? (max) : (((val) < (min)) ? (min) : (val))) #define clamp(val, min, max) (((val) > (max)) ? (max) : (((val) < (min)) ? (min) : (val)))
#endif // __cplusplus #endif // __cplusplus
#endif // MATHLIB_H // bitwise operators templates
template<class T, class type=typename std::underlying_type<T>::type>
inline T operator~ (T a) { return (T)~(type)a; }
template<class T, class type=typename std::underlying_type<T>::type>
inline T operator| (T a, T b) { return (T)((type)a | (type)b); }
template<class T, class type=typename std::underlying_type<T>::type>
inline T operator& (T a, T b) { return (T)((type)a & (type)b); }
template<class T, class type=typename std::underlying_type<T>::type>
inline T operator^ (T a, T b) { return (T)((type)a ^ (type)b); }
template<class T, class type=typename std::underlying_type<T>::type>
inline T& operator|= (T& a, T b) { return (T&)((type&)a |= (type)b); }
template<class T, class type=typename std::underlying_type<T>::type>
inline T& operator&= (T& a, T b) { return (T&)((type&)a &= (type)b); }
template<class T, class type=typename std::underlying_type<T>::type>
inline T& operator^= (T& a, T b) { return (T&)((type&)a ^= (type)b); }
inline double M_sqrt(int value) {
return sqrt(value);
}
inline float M_sqrt(float value) {
return _mm_cvtss_f32(_mm_sqrt_ss(_mm_load_ss(&value)));
}
inline double M_sqrt(double value) {
double ret;
auto v = _mm_load_sd(&value);
_mm_store_sd(&ret, _mm_sqrt_sd(v, v));
return ret;
}
#define VectorSubtract(a,b,c) {(c)[0]=(a)[0]-(b)[0];(c)[1]=(a)[1]-(b)[1];(c)[2]=(a)[2]-(b)[2];}
#define VectorAdd(a,b,c) {(c)[0]=(a)[0]+(b)[0];(c)[1]=(a)[1]+(b)[1];(c)[2]=(a)[2]+(b)[2];}
#define VectorCopy(a,b) {(b)[0]=(a)[0];(b)[1]=(a)[1];(b)[2]=(a)[2];}
#define VectorClear(a) {(a)[0]=0.0;(a)[1]=0.0;(a)[2]=0.0;}

View File

@ -29,6 +29,28 @@
#include "regamedll_const.h" #include "regamedll_const.h"
#ifdef _WIN32
// Attributes to specify an "exported" function, visible from outside the
// DLL.
#undef DLLEXPORT
#define DLLEXPORT __declspec(dllexport)
// WINAPI should be provided in the windows compiler headers.
// It's usually defined to something like "__stdcall".
#else
#undef DLLEXPORT
#define DLLEXPORT __attribute__((visibility("default")))
#define WINAPI /* */
#endif // _WIN32
// Simplified macro for declaring/defining exported DLL functions. They
// need to be 'extern "C"' so that the C++ compiler enforces parameter
// type-matching, rather than considering routines with mis-matched
// arguments/types to be overloaded functions...
//
// AFAIK, this is os-independent, but it's included here in osdep.h where
// DLLEXPORT is defined, for convenience.
#define C_DLLEXPORT extern "C" DLLEXPORT
enum hash_types_e { CLASSNAME }; enum hash_types_e { CLASSNAME };
// Things that toggle (buttons/triggers/doors) need this // Things that toggle (buttons/triggers/doors) need this

View File

@ -25,6 +25,7 @@
* version. * version.
* *
*/ */
#pragma once #pragma once
#pragma warning(disable:4244) // int or float down-conversion #pragma warning(disable:4244) // int or float down-conversion
@ -35,9 +36,9 @@
#include "archtypes.h" #include "archtypes.h"
#include "maintypes.h" #include "maintypes.h"
#include "regamedll_common.h"
#ifdef _WIN32 #ifdef _WIN32
#define WIN32_LEAN_AND_MEAN #define WIN32_LEAN_AND_MEAN
#define NOWINRES #define NOWINRES
#define NOSERVICE #define NOSERVICE
@ -48,11 +49,9 @@
#include "winsani_out.h" #include "winsani_out.h"
#undef PlaySound #undef PlaySound
#else #else
#include <limits.h> #include <limits.h>
#include <stdarg.h> #include <stdarg.h>
#include <string.h> #include <string.h>
#endif // _WIN32 #endif // _WIN32
// Misc C-runtime library headers // Misc C-runtime library headers

View File

@ -0,0 +1,95 @@
/*
*
* 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
#ifndef _WIN32
#define _strlwr(p) for (int i = 0; p[i] != 0; i++) p[i] = tolower(p[i]);
#endif
#define Q_isspace isspace
#define Q_isalnum isalnum
#define Q_isalpha isalpha
#define Q_malloc malloc
#define Q_calloc calloc
#define Q_alloca alloca
#define Q_free free
#define Q_min min
#define Q_max max
#define Q_clamp clamp
#define Q_access _access
#define Q_close _close
#define Q_write _write
#define Q_memset memset
#define Q_memcpy memcpy
#define Q_strlen strlen
#define Q_memcmp memcmp
#define Q_strcpy strcpy
#define Q_strncpy strncpy
#define Q_strrchr strrchr
#define Q_strcat strcat
#define Q_strncat strncat
#define Q_strcmp strcmp
#define Q_strncmp strncmp
#define Q_sscanf sscanf
#define Q_strdup _strdup
#define Q_stricmp _stricmp
#define Q_strnicmp _strnicmp
#define Q_strstr strstr
#define Q_strchr strchr
#define Q_strrchr strrchr
#define Q_strlwr _strlwr
#define Q_sprintf sprintf
#define Q_snprintf _snprintf
#define Q_atoi atoi
#define Q_atof atof
#define Q_toupper toupper
#define Q_memmove memmove
#define Q_vsnprintf _vsnprintf
#define Q_vsnwprintf _vsnwprintf
#define Q_abs abs
#define Q_fabs fabs
#define Q_tan tan
#define Q_atan atan
#define Q_atan2 atan2
#define Q_acos acos
#define Q_cos cos
#define Q_sin sin
#define Q_pow pow
#define Q_fmod fmod
#define Q_fopen fopen
#define Q_fprintf fprintf
#define Q_fclose fclose
#ifdef REGAMEDLL_FIXES
#define Q_sqrt M_sqrt
#else
#define Q_sqrt sqrt
#endif

View File

@ -86,6 +86,10 @@ public:
virtual bool JoinTeam(TeamName team); virtual bool JoinTeam(TeamName team);
virtual void StartObserver(Vector& vecPosition, Vector& vecViewAngle); virtual void StartObserver(Vector& vecPosition, Vector& vecViewAngle);
virtual void TeamChangeUpdate(); virtual void TeamChangeUpdate();
virtual void DropSecondary();
virtual void DropPrimary();
virtual bool HasPlayerItem(CBasePlayerItem *pCheckItem);
virtual bool HasNamedPlayerItem(const char *pszItemName);
CBasePlayer *BasePlayer() const; CBasePlayer *BasePlayer() const;
public: public:

View File

@ -29,10 +29,8 @@
#include "archtypes.h" #include "archtypes.h"
/* <8f1> ../engine/cmd.h:65 */
typedef void(*xcommand_t)(void); typedef void(*xcommand_t)(void);
/* <904> ../engine/cmd.h:71 */
typedef struct cmd_function_s typedef struct cmd_function_s
{ {
struct cmd_function_s *next; struct cmd_function_s *next;
@ -41,7 +39,6 @@ typedef struct cmd_function_s
int flags; int flags;
} cmd_function_t; } cmd_function_t;
/* <95a> ../engine/cmd.h:80 */
typedef enum cmd_source_s typedef enum cmd_source_s
{ {
src_client = 0, // came in over a net connection as a clc_stringcmd. host_client will be valid during this state. src_client = 0, // came in over a net connection as a clc_stringcmd. host_client will be valid during this state.

View File

@ -25,17 +25,12 @@
* version. * version.
* *
*/ */
#pragma once #pragma once
#include "const.h" #include "const.h"
#include "qlimits.h" #include "qlimits.h"
#ifdef REHLDS_FIXES
#define COM_TOKEN_LEN 2048
#else
#define COM_TOKEN_LEN 1024
#endif
// Don't allow overflow // Don't allow overflow
#define SIZEBUF_CHECK_OVERFLOW 0 #define SIZEBUF_CHECK_OVERFLOW 0
#define SIZEBUF_ALLOW_OVERFLOW BIT(0) #define SIZEBUF_ALLOW_OVERFLOW BIT(0)
@ -47,7 +42,6 @@
#define COM_COPY_CHUNK_SIZE 1024 #define COM_COPY_CHUNK_SIZE 1024
#define COM_MAX_CMD_LINE 256 #define COM_MAX_CMD_LINE 256
/* <6ae> ../common/common.h:82 */
typedef struct sizebuf_s typedef struct sizebuf_s
{ {
const char *buffername; const char *buffername;
@ -57,7 +51,6 @@ typedef struct sizebuf_s
int cursize; int cursize;
} sizebuf_t; } sizebuf_t;
/* <270aa> ../common/common.h:297 */
typedef struct downloadtime_s typedef struct downloadtime_s
{ {
qboolean bUsed; qboolean bUsed;
@ -65,7 +58,6 @@ typedef struct downloadtime_s
int nBytesRemaining; int nBytesRemaining;
} downloadtime_t; } downloadtime_t;
/* <19fa2> ../common/common.h:303 */
typedef struct incomingtransfer_s typedef struct incomingtransfer_s
{ {
qboolean doneregistering; qboolean doneregistering;

View File

@ -27,12 +27,10 @@
*/ */
#pragma once #pragma once
#include "common.h"
#ifndef _WIN32 #ifndef _WIN32
#include <string.h> #include <string.h>
#include <wchar.h> #include <wchar.h>
#endif // _WIN32 #endif
// Simple utility function to allocate memory and duplicate a string // Simple utility function to allocate memory and duplicate a string
inline char *CloneString(const char *str) inline char *CloneString(const char *str)

View File

@ -0,0 +1,123 @@
/*************************** asmlib.h ***************************************
* Author: Agner Fog
* Date created: 2003-12-12
* Last modified: 2013-10-04
* Project: asmlib.zip
* Source URL: www.agner.org/optimize
*
* Description:
* Header file for the asmlib function library.
* This library is available in many versions for different platforms.
* See asmlib-instructions.pdf for details.
*
* (c) Copyright 2003 - 2013 by Agner Fog.
* GNU General Public License http://www.gnu.org/licenses/gpl.html
*****************************************************************************/
#ifndef ASMLIB_H
#define ASMLIB_H
/***********************************************************************
Define compiler-specific types and directives
***********************************************************************/
// Define type size_t
#ifndef _SIZE_T_DEFINED
#include "stddef.h"
#endif
// Define integer types with known size: int32_t, uint32_t, int64_t, uint64_t.
// If this doesn't work then insert compiler-specific definitions here:
#if defined(__GNUC__) || (defined(_MSC_VER) && _MSC_VER >= 1600)
// Compilers supporting C99 or C++0x have stdint.h defining these integer types
#include <stdint.h>
#define INT64_SUPPORTED // Remove this if the compiler doesn't support 64-bit integers
#elif defined(_MSC_VER)
// Older Microsoft compilers have their own definition
typedef signed __int16 int16_t;
typedef unsigned __int16 uint16_t;
typedef signed __int32 int32_t;
typedef unsigned __int32 uint32_t;
typedef signed __int64 int64_t;
typedef unsigned __int64 uint64_t;
#define INT64_SUPPORTED // Remove this if the compiler doesn't support 64-bit integers
#else
// This works with most compilers
typedef signed short int int16_t;
typedef unsigned short int uint16_t;
typedef signed int int32_t;
typedef unsigned int uint32_t;
typedef long long int64_t;
typedef unsigned long long uint64_t;
#define INT64_SUPPORTED // Remove this if the compiler doesn't support 64-bit integers
#endif
// Turn off name mangling
#ifdef __cplusplus
extern "C" {
#endif
/***********************************************************************
Function prototypes, memory and string functions
***********************************************************************/
void * A_memcpy (void * dest, const void * src, size_t count); // Copy count bytes from src to dest
void * A_memmove(void * dest, const void * src, size_t count); // Same as memcpy, allows overlap between src and dest
void * A_memset (void * dest, int c, size_t count); // Set count bytes in dest to (char)c
int A_memcmp (const void * buf1, const void * buf2, size_t num); // Compares two blocks of memory
size_t GetMemcpyCacheLimit(void); // Data blocks bigger than this will be copied uncached by memcpy and memmove
void SetMemcpyCacheLimit(size_t); // Change limit in GetMemcpyCacheLimit
size_t GetMemsetCacheLimit(void); // Data blocks bigger than this will be stored uncached by memset
void SetMemsetCacheLimit(size_t); // Change limit in GetMemsetCacheLimit
char * A_strcat (char * dest, const char * src); // Concatenate strings dest and src. Store result in dest
char * A_strcpy (char * dest, const char * src); // Copy string src to dest
size_t A_strlen (const char * str); // Get length of zero-terminated string
int A_strcmp (const char * a, const char * b); // Compare strings. Case sensitive
int A_stricmp (const char *string1, const char *string2); // Compare strings. Case insensitive for A-Z only
char * A_strstr (char * haystack, const char * needle); // Search for substring in string
void A_strtolower(char * string); // Convert string to lower case for A-Z only
void A_strtoupper(char * string); // Convert string to upper case for a-z only
size_t A_substring(char * dest, const char * source, size_t pos, size_t len); // Copy a substring for source into dest
size_t A_strspn (const char * str, const char * set); // Find span of characters that belong to set
size_t A_strcspn(const char * str, const char * set); // Find span of characters that don't belong to set
size_t strCountInSet(const char * str, const char * set); // Count characters that belong to set
size_t strcount_UTF8(const char * str); // Counts the number of characters in a UTF-8 encoded string
/***********************************************************************
Function prototypes, miscellaneous functions
***********************************************************************/
uint32_t A_popcount(uint32_t x); // Count 1-bits in 32-bit integer
int RoundD (double x); // Round to nearest or even
int RoundF (float x); // Round to nearest or even
int InstructionSet(void); // Tell which instruction set is supported
char * ProcessorName(void); // ASCIIZ text describing microprocessor
void CpuType(int * vendor, int * family, int * model); // Get CPU vendor, family and model
size_t DataCacheSize(int level); // Get size of data cache
void A_DebugBreak(void); // Makes a debug breakpoint
#ifdef INT64_SUPPORTED
uint64_t ReadTSC(void); // Read microprocessor internal clock (64 bits)
#else
uint32_t ReadTSC(void); // Read microprocessor internal clock (only 32 bits supported by compiler)
#endif
void cpuid_ex (int abcd[4], int eax, int ecx); // call CPUID instruction
static inline void cpuid_abcd (int abcd[4], int eax) {
cpuid_ex(abcd, eax, 0);}
#ifdef __cplusplus
} // end of extern "C"
// Define overloaded versions if compiling as C++
static inline int Round (double x) { // Overload name Round
return RoundD(x);}
static inline int Round (float x) { // Overload name Round
return RoundF(x);}
static inline const char * A_strstr(const char * haystack, const char * needle) {
return A_strstr((char*)haystack, needle);} // Overload A_strstr with const char * version
#endif // __cplusplus
#endif // ASMLIB_H

View File

@ -27,28 +27,7 @@
// need this for memset // need this for memset
#include <string.h> #include <string.h>
// for when we care about how many bits we use #include "archtypes.h"
typedef signed char int8;
typedef signed short int16;
#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;
#ifdef _WIN32
#ifdef _MSC_VER
typedef unsigned __int64 uint64;
#endif
#elif defined __linux__
typedef unsigned long long uint64;
#endif
typedef float float32; typedef float float32;
typedef double float64; typedef double float64;
@ -86,7 +65,7 @@ FIXME: Enable this when we no longer fear change =)
#define UINT8_MAX ((uint8)~0) #define UINT8_MAX ((uint8)~0)
#define UINT16_MAX ((uint16)~0) #define UINT16_MAX ((uint16)~0)
#define UINT32_MAX ((uint32_t)~0) #define UINT32_MAX ((uint32)~0)
#define UINT64_MAX ((uint64)~0) #define UINT64_MAX ((uint64)~0)
#define UINT8_MIN 0 #define UINT8_MIN 0
@ -259,12 +238,12 @@ inline T WordSwapC(T w)
template <typename T> template <typename T>
inline T DWordSwapC(T dw) inline T DWordSwapC(T dw)
{ {
uint32_t temp; uint32 temp;
temp = *((uint32_t *)&dw) >> 24; temp = *((uint32 *)&dw) >> 24;
temp |= ((*((uint32_t *)&dw) & 0x00FF0000) >> 8); temp |= ((*((uint32 *)&dw) & 0x00FF0000) >> 8);
temp |= ((*((uint32_t *)&dw) & 0x0000FF00) << 8); temp |= ((*((uint32 *)&dw) & 0x0000FF00) << 8);
temp |= ((*((uint32_t *)&dw) & 0x000000FF) << 24); temp |= ((*((uint32 *)&dw) & 0x000000FF) << 24);
return *((T*)&temp); return *((T*)&temp);
} }
@ -363,12 +342,12 @@ inline float DWordSwapAsm<float>(float f)
inline short BigShort(short val) { int test = 1; return (*(char *)&test == 1) ? WordSwap(val) : val; } inline short BigShort(short val) { int test = 1; return (*(char *)&test == 1) ? WordSwap(val) : val; }
inline uint16 BigWord(uint16 val) { int test = 1; return (*(char *)&test == 1) ? WordSwap(val) : val; } inline uint16 BigWord(uint16 val) { int test = 1; return (*(char *)&test == 1) ? WordSwap(val) : val; }
inline long BigLong(long val) { int test = 1; return (*(char *)&test == 1) ? DWordSwap(val) : val; } inline long BigLong(long val) { int test = 1; return (*(char *)&test == 1) ? DWordSwap(val) : val; }
inline uint32_t BigDWord(uint32_t val) { int test = 1; return (*(char *)&test == 1) ? DWordSwap(val) : val; } inline uint32 BigDWord(uint32 val) { int test = 1; return (*(char *)&test == 1) ? DWordSwap(val) : val; }
inline float BigFloat(float val) { int test = 1; return (*(char *)&test == 1) ? DWordSwap(val) : val; } inline float BigFloat(float val) { int test = 1; return (*(char *)&test == 1) ? DWordSwap(val) : val; }
inline short LittleShort(short val) { int test = 1; return (*(char *)&test == 1) ? val : WordSwap(val); } inline short LittleShort(short val) { int test = 1; return (*(char *)&test == 1) ? val : WordSwap(val); }
inline uint16 LittleWord(uint16 val) { int test = 1; return (*(char *)&test == 1) ? val : WordSwap(val); } inline uint16 LittleWord(uint16 val) { int test = 1; return (*(char *)&test == 1) ? val : WordSwap(val); }
inline long LittleLong(long val) { int test = 1; return (*(char *)&test == 1) ? val : DWordSwap(val); } inline long LittleLong(long val) { int test = 1; return (*(char *)&test == 1) ? val : DWordSwap(val); }
inline uint32_t LittleDWord(uint32_t val) { int test = 1; return (*(char *)&test == 1) ? val : DWordSwap(val); } inline uint32 LittleDWord(uint32 val) { int test = 1; return (*(char *)&test == 1) ? val : DWordSwap(val); }
inline float LittleFloat(float val) { int test = 1; return (*(char *)&test == 1) ? val : DWordSwap(val); } inline float LittleFloat(float val) { int test = 1; return (*(char *)&test == 1) ? val : DWordSwap(val); }
#endif #endif

View File

@ -26,18 +26,12 @@
* *
*/ */
#ifndef SHARED_UTIL
#define SHARED_UTIL
#ifdef _WIN32
#pragma once #pragma once
#endif
#include "common.h"
#ifndef _WIN32 #ifndef _WIN32
#include <string.h> #include <string.h>
#include <wchar.h> #include <wchar.h>
#endif // _WIN32 #endif
wchar_t *SharedWVarArgs(wchar_t *format, ...); wchar_t *SharedWVarArgs(wchar_t *format, ...);
char *SharedVarArgs(char *format, ...); char *SharedVarArgs(char *format, ...);
@ -80,4 +74,3 @@ inline wchar_t *CloneWString(const wchar_t *str)
return cloneStr; return cloneStr;
} }
#endif // SHARED_UTIL

View File

@ -0,0 +1,95 @@
/*
*
* 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
#ifndef _WIN32
#define _strlwr(p) for (int i = 0; p[i] != 0; i++) p[i] = tolower(p[i]);
#endif
#define Q_isspace isspace
#define Q_isalnum isalnum
#define Q_isalpha isalpha
#define Q_malloc malloc
#define Q_calloc calloc
#define Q_alloca alloca
#define Q_free free
#define Q_min min
#define Q_max max
#define Q_clamp clamp
#define Q_access _access
#define Q_close _close
#define Q_write _write
#define Q_memset memset
#define Q_memcpy memcpy
#define Q_strlen strlen
#define Q_memcmp memcmp
#define Q_strcpy strcpy
#define Q_strncpy strncpy
#define Q_strrchr strrchr
#define Q_strcat strcat
#define Q_strncat strncat
#define Q_strcmp strcmp
#define Q_strncmp strncmp
#define Q_sscanf sscanf
#define Q_strdup _strdup
#define Q_stricmp _stricmp
#define Q_strnicmp _strnicmp
#define Q_strstr strstr
#define Q_strchr strchr
#define Q_strrchr strrchr
#define Q_strlwr _strlwr
#define Q_sprintf sprintf
#define Q_snprintf _snprintf
#define Q_atoi atoi
#define Q_atof atof
#define Q_toupper toupper
#define Q_memmove memmove
#define Q_vsnprintf _vsnprintf
#define Q_vsnwprintf _vsnwprintf
#define Q_abs abs
#define Q_fabs fabs
#define Q_tan tan
#define Q_atan atan
#define Q_atan2 atan2
#define Q_acos acos
#define Q_cos cos
#define Q_sin sin
#define Q_pow pow
#define Q_fmod fmod
#define Q_fopen fopen
#define Q_fprintf fprintf
#define Q_fclose fclose
#ifdef REGAMEDLL_FIXES
#define Q_sqrt M_sqrt
#else
#define Q_sqrt sqrt
#endif

View File

@ -27,7 +27,6 @@
*/ */
#include "extdll.h" #include "extdll.h"
#include "extdef.h"
// declared virtual function's and globals for hooks // declared virtual function's and globals for hooks
#ifdef HOOK_GAMEDLL #ifdef HOOK_GAMEDLL

View File

@ -26,6 +26,7 @@
* *
*/ */
#include "maintypes.h"
#include "common.h" #include "common.h"
#include "cmd.h" #include "cmd.h"
#include "unicode_strtools.h" #include "unicode_strtools.h"

View File

@ -3,7 +3,9 @@
#include "version/appversion.h" #include "version/appversion.h"
#include "osconfig.h" #include "osconfig.h"
#include "basetypes.h" #include "basetypes.h"
#include "archtypes.h"
#include "asmlib.h" #include "asmlib.h"
#include "sse_mathfun.h" #include "sse_mathfun.h"

View File

@ -1,6 +1,8 @@
#pragma once #pragma once
#define _logf regamedll_log #define _logf regamedll_log
#define printf2 _printf2
#define chatf _print_chat
extern void _printf2(const char *fmt, ...); extern void _printf2(const char *fmt, ...);
extern void _print_chat(class CBasePlayer *pPlayer, const char *fmt, ...); extern void _print_chat(class CBasePlayer *pPlayer, const char *fmt, ...);