├── evobot ├── metamod │ ├── mhook.h │ ├── mqueue.h │ ├── thread_logparse.h │ ├── info_name.h │ ├── studioapi.h │ ├── vdate.h │ ├── game_autodetect.h │ ├── h_export.h │ ├── reg_support.h │ ├── game_support.h │ ├── vers_meta.h │ ├── new_baseclass.h │ ├── ret_type.h │ ├── osdep_p.h │ ├── engine_t.h │ ├── commands_meta.h │ ├── types_meta.h │ ├── enginecallbacks.h │ ├── tqueue.h │ ├── plinfo.h │ ├── mplayer.h │ ├── conf_meta.h │ ├── comp_dep.h │ ├── mlist.h │ ├── linkent.h │ ├── log_meta.h │ ├── sdk_util.h │ ├── mutil.h │ └── mm_pextensions.h ├── HLSDK │ ├── common │ │ ├── hltv.h │ │ ├── nowin.h │ │ ├── com_model.h │ │ ├── dll_state.h │ │ ├── exefuncs.h │ │ ├── interface.h │ │ ├── net_api.h │ │ ├── ivoicetweak.h │ │ ├── r_studioint.h │ │ ├── screenfade.h │ │ ├── director_cmds.h │ │ ├── engine_launcher_api.h │ │ ├── entity_types.h │ │ ├── studio_event.h │ │ ├── demo_api.h │ │ ├── netadr.h │ │ ├── con_nprint.h │ │ ├── dlight.h │ │ ├── qfont.h │ │ ├── event_args.h │ │ ├── in_buttons.h │ │ ├── weaponinfo.h │ │ ├── usercmd.h │ │ ├── pmtrace.h │ │ ├── cvardef.h │ │ ├── particledef.h │ │ ├── event_flags.h │ │ ├── crc.h │ │ ├── ref_params.h │ │ ├── beamdef.h │ │ ├── triangleapi.h │ │ ├── event_api.h │ │ ├── cl_entity.h │ │ ├── entity_state.h │ │ └── mathlib.h │ ├── engine │ │ ├── keydefs.h │ │ ├── edict.h │ │ ├── archtypes.h │ │ ├── customentity.h │ │ ├── shake.h │ │ ├── progs.h │ │ └── custom.h │ ├── pm_shared │ │ ├── pm_movevars.h │ │ ├── pm_info.h │ │ ├── pm_debug.h │ │ ├── pm_materials.h │ │ └── pm_shared.h │ ├── hlsdk_readme.txt │ └── dlls │ │ ├── cdll_dll.h │ │ └── extdll.h ├── CMakeLists.txt ├── src │ ├── bot_bsp.h │ ├── h_export.cpp │ ├── bot_alien.h │ ├── sdk_util.cpp │ ├── bot_weapons.h │ ├── bot_marine.h │ ├── bot_bsp.cpp │ ├── game_state.h │ ├── general_util.h │ ├── bot_config.h │ └── meta_api.cpp └── fastlz │ ├── README.TXT │ └── fastlz.h ├── .gitignore ├── Detour ├── CMakeLists.txt ├── Include │ ├── DetourMath.h │ ├── DetourAssert.h │ ├── DetourAlloc.h │ └── DetourStatus.h ├── License.txt └── Source │ ├── DetourAssert.cpp │ └── DetourAlloc.cpp ├── DetourTileCache ├── CMakeLists.txt └── License.txt ├── License.txt ├── CMakeLists.txt ├── BUILD_AMBUILD.md ├── configure.py ├── CMakePresets.json └── .github └── workflows └── build-on-push.yml /evobot/metamod/mhook.h: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /evobot/metamod/mqueue.h: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /evobot/metamod/thread_logparse.h: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /evobot/HLSDK/common/hltv.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RGreenlees/evobot_mm/HEAD/evobot/HLSDK/common/hltv.h -------------------------------------------------------------------------------- /evobot/metamod/info_name.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RGreenlees/evobot_mm/HEAD/evobot/metamod/info_name.h -------------------------------------------------------------------------------- /evobot/HLSDK/common/nowin.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RGreenlees/evobot_mm/HEAD/evobot/HLSDK/common/nowin.h -------------------------------------------------------------------------------- /evobot/HLSDK/common/com_model.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RGreenlees/evobot_mm/HEAD/evobot/HLSDK/common/com_model.h -------------------------------------------------------------------------------- /evobot/HLSDK/common/dll_state.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RGreenlees/evobot_mm/HEAD/evobot/HLSDK/common/dll_state.h -------------------------------------------------------------------------------- /evobot/HLSDK/common/exefuncs.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RGreenlees/evobot_mm/HEAD/evobot/HLSDK/common/exefuncs.h -------------------------------------------------------------------------------- /evobot/HLSDK/common/interface.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RGreenlees/evobot_mm/HEAD/evobot/HLSDK/common/interface.h -------------------------------------------------------------------------------- /evobot/HLSDK/common/net_api.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RGreenlees/evobot_mm/HEAD/evobot/HLSDK/common/net_api.h -------------------------------------------------------------------------------- /evobot/HLSDK/engine/keydefs.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RGreenlees/evobot_mm/HEAD/evobot/HLSDK/engine/keydefs.h -------------------------------------------------------------------------------- /evobot/HLSDK/common/ivoicetweak.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RGreenlees/evobot_mm/HEAD/evobot/HLSDK/common/ivoicetweak.h -------------------------------------------------------------------------------- /evobot/HLSDK/common/r_studioint.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RGreenlees/evobot_mm/HEAD/evobot/HLSDK/common/r_studioint.h -------------------------------------------------------------------------------- /evobot/HLSDK/common/screenfade.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RGreenlees/evobot_mm/HEAD/evobot/HLSDK/common/screenfade.h -------------------------------------------------------------------------------- /evobot/HLSDK/common/director_cmds.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RGreenlees/evobot_mm/HEAD/evobot/HLSDK/common/director_cmds.h -------------------------------------------------------------------------------- /evobot/HLSDK/pm_shared/pm_movevars.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RGreenlees/evobot_mm/HEAD/evobot/HLSDK/pm_shared/pm_movevars.h -------------------------------------------------------------------------------- /evobot/HLSDK/common/engine_launcher_api.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RGreenlees/evobot_mm/HEAD/evobot/HLSDK/common/engine_launcher_api.h -------------------------------------------------------------------------------- /evobot/HLSDK/hlsdk_readme.txt: -------------------------------------------------------------------------------- 1 | This HLSDK is without CBaseEntity and other gamedll internal headers. 2 | Mainly for metamod-p and plugin compiles. -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | CMakeLists.txt.user 2 | CMakeCache.txt 3 | CMakeFiles 4 | CMakeScripts 5 | Testing 6 | Makefile 7 | cmake_install.cmake 8 | install_manifest.txt 9 | compile_commands.json 10 | CTestTestfile.cmake 11 | _deps 12 | out/ 13 | .vs/ 14 | build/ 15 | -------------------------------------------------------------------------------- /Detour/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | file(GLOB_RECURSE HeaderFiles LIST_DIRECTORIES false ${PROJECT_SOURCE_DIR}/Detour/Include/*.h) 2 | file(GLOB_RECURSE SourceFiles LIST_DIRECTORIES false ${PROJECT_SOURCE_DIR}/Detour/Source/*.cpp) 3 | 4 | target_sources(Detour 5 | PRIVATE ${SourceFiles} 6 | PUBLIC FILE_SET HEADERS 7 | BASE_DIRS ${PROJECT_SOURCE_DIR} 8 | FILES ${HeaderFiles} ) 9 | 10 | target_include_directories(Detour PRIVATE Include) -------------------------------------------------------------------------------- /DetourTileCache/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | file(GLOB_RECURSE HeaderFiles LIST_DIRECTORIES false ${PROJECT_SOURCE_DIR}/DetourTileCache/Include/*.h) 2 | file(GLOB_RECURSE SourceFiles LIST_DIRECTORIES false ${PROJECT_SOURCE_DIR}/DetourTileCache/Source/*.cpp) 3 | 4 | target_sources(DetourTileCache 5 | PRIVATE ${SourceFiles} 6 | PUBLIC FILE_SET HEADERS 7 | BASE_DIRS ${PROJECT_SOURCE_DIR} 8 | FILES ${HeaderFiles} ) 9 | 10 | target_include_directories(DetourTileCache PRIVATE Include) 11 | target_include_directories(DetourTileCache PRIVATE ../Detour/Include) -------------------------------------------------------------------------------- /evobot/HLSDK/engine/edict.h: -------------------------------------------------------------------------------- 1 | #if !defined EDICT_H 2 | #define EDICT_H 3 | #ifdef _WIN32 4 | #ifndef __MINGW32__ 5 | #pragma once 6 | #endif /* not __MINGW32__ */ 7 | #endif 8 | #define MAX_ENT_LEAFS 48 9 | 10 | #include "progdefs.h" 11 | 12 | struct edict_s 13 | { 14 | qboolean free; 15 | int serialnumber; 16 | link_t area; // linked to a division node or leaf 17 | 18 | int headnode; // -1 to use normal leaf check 19 | int num_leafs; 20 | short leafnums[MAX_ENT_LEAFS]; 21 | 22 | float freetime; // sv.time when the object was freed 23 | 24 | void* pvPrivateData; // Alloced and freed by engine, used by DLLs 25 | 26 | entvars_t v; // C exported fields from progs 27 | 28 | // other fields from progs come immediately after 29 | }; 30 | 31 | #endif 32 | -------------------------------------------------------------------------------- /evobot/HLSDK/pm_shared/pm_info.h: -------------------------------------------------------------------------------- 1 | /*** 2 | * 3 | * Copyright (c) 1999, 2000, Valve LLC. All rights reserved. 4 | * 5 | * This product contains software technology licensed from Id 6 | * Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc. 7 | * All Rights Reserved. 8 | * 9 | * Use, distribution, and modification of this source code and/or resulting 10 | * object code is restricted to non-commercial enhancements to products from 11 | * Valve LLC. All other use, distribution, or modification is prohibited 12 | * without written permission from Valve LLC. 13 | * 14 | ****/ 15 | // Physics info string definition 16 | #if !defined( PM_INFOH ) 17 | #define PM_INFOH 18 | #ifdef _WIN32 19 | #ifndef __MINGW32__ 20 | #pragma once 21 | #endif /* not __MINGW32__ */ 22 | #endif 23 | 24 | #define MAX_PHYSINFO_STRING 256 25 | 26 | #endif // PM_INFOH 27 | -------------------------------------------------------------------------------- /Detour/Include/DetourMath.h: -------------------------------------------------------------------------------- 1 | /** 2 | @defgroup detour Detour 3 | 4 | Members in this module are wrappers around the standard math library 5 | */ 6 | 7 | #ifndef DETOURMATH_H 8 | #define DETOURMATH_H 9 | 10 | #include 11 | // This include is required because libstdc++ has problems with isfinite 12 | // if cmath is included before math.h. 13 | #include 14 | 15 | inline float dtMathFabsf(float x) { return fabsf(x); } 16 | inline float dtMathSqrtf(float x) { return sqrtf(x); } 17 | inline float dtMathFloorf(float x) { return floorf(x); } 18 | inline float dtMathCeilf(float x) { return ceilf(x); } 19 | inline float dtMathCosf(float x) { return cosf(x); } 20 | inline float dtMathSinf(float x) { return sinf(x); } 21 | inline float dtMathAtan2f(float y, float x) { return atan2f(y, x); } 22 | inline bool dtMathIsfinite(float x) { return std::isfinite(x); } 23 | 24 | #endif 25 | -------------------------------------------------------------------------------- /License.txt: -------------------------------------------------------------------------------- 1 | Copyright (c) 2023 Richard Greenlees 2 | 3 | This software is provided 'as-is', without any express or implied 4 | warranty. In no event will the authors be held liable for any damages 5 | arising from the use of this software. 6 | 7 | Permission is granted to anyone to use this software for any purpose, 8 | including commercial applications, and to alter it and redistribute it 9 | freely, subject to the following restrictions: 10 | 11 | 1. The origin of this software must not be misrepresented; you must not 12 | claim that you wrote the original software. If you use this software 13 | in a product, an acknowledgment in the product documentation would be 14 | appreciated but is not required. 15 | 2. Altered source versions must be plainly marked as such, and must not be 16 | misrepresented as being the original software. 17 | 3. This notice may not be removed or altered from any source distribution. -------------------------------------------------------------------------------- /evobot/HLSDK/common/entity_types.h: -------------------------------------------------------------------------------- 1 | /*** 2 | * 3 | * Copyright (c) 1996-2002, Valve LLC. All rights reserved. 4 | * 5 | * This product contains software technology licensed from Id 6 | * Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc. 7 | * All Rights Reserved. 8 | * 9 | * Use, distribution, and modification of this source code and/or resulting 10 | * object code is restricted to non-commercial enhancements to products from 11 | * Valve LLC. All other use, distribution, or modification is prohibited 12 | * without written permission from Valve LLC. 13 | * 14 | ****/ 15 | // entity_types.h 16 | #if !defined( ENTITY_TYPESH ) 17 | #define ENTITY_TYPESH 18 | 19 | #define ET_NORMAL 0 20 | #define ET_PLAYER 1 21 | #define ET_TEMPENTITY 2 22 | #define ET_BEAM 3 23 | // BMODEL or SPRITE that was split across BSP nodes 24 | #define ET_FRAGMENTED 4 25 | 26 | #endif // !ENTITY_TYPESH 27 | -------------------------------------------------------------------------------- /Detour/License.txt: -------------------------------------------------------------------------------- 1 | Copyright (c) 2009 Mikko Mononen memon@inside.org 2 | 3 | This software is provided 'as-is', without any express or implied 4 | warranty. In no event will the authors be held liable for any damages 5 | arising from the use of this software. 6 | 7 | Permission is granted to anyone to use this software for any purpose, 8 | including commercial applications, and to alter it and redistribute it 9 | freely, subject to the following restrictions: 10 | 11 | 1. The origin of this software must not be misrepresented; you must not 12 | claim that you wrote the original software. If you use this software 13 | in a product, an acknowledgment in the product documentation would be 14 | appreciated but is not required. 15 | 2. Altered source versions must be plainly marked as such, and must not be 16 | misrepresented as being the original software. 17 | 3. This notice may not be removed or altered from any source distribution. -------------------------------------------------------------------------------- /DetourTileCache/License.txt: -------------------------------------------------------------------------------- 1 | Copyright (c) 2009 Mikko Mononen memon@inside.org 2 | 3 | This software is provided 'as-is', without any express or implied 4 | warranty. In no event will the authors be held liable for any damages 5 | arising from the use of this software. 6 | 7 | Permission is granted to anyone to use this software for any purpose, 8 | including commercial applications, and to alter it and redistribute it 9 | freely, subject to the following restrictions: 10 | 11 | 1. The origin of this software must not be misrepresented; you must not 12 | claim that you wrote the original software. If you use this software 13 | in a product, an acknowledgment in the product documentation would be 14 | appreciated but is not required. 15 | 2. Altered source versions must be plainly marked as such, and must not be 16 | misrepresented as being the original software. 17 | 3. This notice may not be removed or altered from any source distribution. -------------------------------------------------------------------------------- /evobot/HLSDK/common/studio_event.h: -------------------------------------------------------------------------------- 1 | /*** 2 | * 3 | * Copyright (c) 1999, 2000, Valve LLC. All rights reserved. 4 | * 5 | * This product contains software technology licensed from Id 6 | * Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc. 7 | * All Rights Reserved. 8 | * 9 | * Use, distribution, and modification of this source code and/or resulting 10 | * object code is restricted to non-commercial enhancements to products from 11 | * Valve LLC. All other use, distribution, or modification is prohibited 12 | * without written permission from Valve LLC. 13 | * 14 | ****/ 15 | #if !defined( STUDIO_EVENTH ) 16 | #define STUDIO_EVENTH 17 | #ifdef _WIN32 18 | #ifndef __MINGW32__ 19 | #pragma once 20 | #endif /* not __MINGW32__ */ 21 | #endif 22 | 23 | typedef struct mstudioevent_s 24 | { 25 | int frame; 26 | int event; 27 | int type; 28 | char options[64]; 29 | } mstudioevent_t; 30 | 31 | #endif // STUDIO_EVENTH 32 | -------------------------------------------------------------------------------- /evobot/HLSDK/pm_shared/pm_debug.h: -------------------------------------------------------------------------------- 1 | /*** 2 | * 3 | * Copyright (c) 1996-2002, Valve LLC. All rights reserved. 4 | * 5 | * This product contains software technology licensed from Id 6 | * Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc. 7 | * All Rights Reserved. 8 | * 9 | * Use, distribution, and modification of this source code and/or resulting 10 | * object code is restricted to non-commercial enhancements to products from 11 | * Valve LLC. All other use, distribution, or modification is prohibited 12 | * without written permission from Valve LLC. 13 | * 14 | ****/ 15 | #ifndef PM_DEBUG_H 16 | #define PM_DEBUG_H 17 | #ifdef _WIN32 18 | #ifndef __MINGW32__ 19 | #pragma once 20 | #endif /* not __MINGW32__ */ 21 | #endif 22 | 23 | void PM_ViewEntity( void ); 24 | void PM_DrawBBox(vec3_t mins, vec3_t maxs, vec3_t origin, int pcolor, float life); 25 | void PM_ParticleLine(vec3_t start, vec3_t end, int pcolor, float life, float vert); 26 | void PM_ShowClipBox( void ); 27 | 28 | #endif // PMOVEDBG_H 29 | -------------------------------------------------------------------------------- /evobot/HLSDK/common/demo_api.h: -------------------------------------------------------------------------------- 1 | /*** 2 | * 3 | * Copyright (c) 1996-2002, Valve LLC. All rights reserved. 4 | * 5 | * This product contains software technology licensed from Id 6 | * Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc. 7 | * All Rights Reserved. 8 | * 9 | * Use, distribution, and modification of this source code and/or resulting 10 | * object code is restricted to non-commercial enhancements to products from 11 | * Valve LLC. All other use, distribution, or modification is prohibited 12 | * without written permission from Valve LLC. 13 | * 14 | ****/ 15 | #if !defined ( DEMO_APIH ) 16 | #define DEMO_APIH 17 | #ifdef _WIN32 18 | #ifndef __MINGW32__ 19 | #pragma once 20 | #endif /* not __MINGW32__ */ 21 | #endif 22 | 23 | typedef struct demo_api_s 24 | { 25 | int ( *IsRecording ) ( void ); 26 | int ( *IsPlayingback ) ( void ); 27 | int ( *IsTimeDemo ) ( void ); 28 | void ( *WriteBuffer ) ( int size, unsigned char *buffer ); 29 | } demo_api_t; 30 | 31 | extern demo_api_t demoapi; 32 | 33 | #endif 34 | -------------------------------------------------------------------------------- /evobot/HLSDK/engine/archtypes.h: -------------------------------------------------------------------------------- 1 | // 2 | // Word size dependent definitions 3 | // DAL 1/03 4 | // 5 | #ifndef ARCHTYPES_H 6 | #define ARCHTYPES_H 7 | 8 | #ifdef __x86_64__ 9 | #define X64BITS 10 | #endif 11 | 12 | #if defined( _WIN32 ) && (! defined( __MINGW32__ )) 13 | 14 | typedef __int16 int16; 15 | typedef unsigned __int16 uint16; 16 | typedef __int32 int32; 17 | typedef unsigned __int32 uint32; 18 | typedef __int64 int64; 19 | typedef unsigned __int64 uint64; 20 | typedef __int32 intp; // intp is an integer that can accomodate a pointer 21 | typedef unsigned __int32 uintp; // (ie, sizeof(intp) >= sizeof(int) && sizeof(intp) >= sizeof(void *) 22 | 23 | #else /* _WIN32 */ 24 | 25 | typedef short int16; 26 | typedef unsigned short uint16; 27 | typedef int int32; 28 | typedef unsigned int uint32; 29 | typedef long long int64; 30 | typedef unsigned long long uint64; 31 | #ifdef X64BITS 32 | typedef long long intp; 33 | typedef unsigned long long uintp; 34 | #else 35 | typedef int intp; 36 | typedef unsigned int uintp; 37 | #endif 38 | 39 | #endif /* else _WIN32 */ 40 | 41 | #endif /* ARCHTYPES_H */ 42 | -------------------------------------------------------------------------------- /evobot/HLSDK/common/netadr.h: -------------------------------------------------------------------------------- 1 | /*** 2 | * 3 | * Copyright (c) 1996-2002, Valve LLC. All rights reserved. 4 | * 5 | * This product contains software technology licensed from Id 6 | * Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc. 7 | * All Rights Reserved. 8 | * 9 | * Use, distribution, and modification of this source code and/or resulting 10 | * object code is restricted to non-commercial enhancements to products from 11 | * Valve LLC. All other use, distribution, or modification is prohibited 12 | * without written permission from Valve LLC. 13 | * 14 | ****/ 15 | // netadr.h 16 | #ifndef NETADR_H 17 | #define NETADR_H 18 | #ifdef _WIN32 19 | #ifndef __MINGW32__ 20 | #pragma once 21 | #endif /* not __MINGW32__ */ 22 | #endif 23 | 24 | typedef enum 25 | { 26 | NA_UNUSED, 27 | NA_LOOPBACK, 28 | NA_BROADCAST, 29 | NA_IP, 30 | NA_IPX, 31 | NA_BROADCAST_IPX, 32 | } netadrtype_t; 33 | 34 | typedef struct netadr_s 35 | { 36 | netadrtype_t type; 37 | unsigned char ip[4]; 38 | unsigned char ipx[10]; 39 | unsigned short port; 40 | } netadr_t; 41 | 42 | #endif // NETADR_H 43 | -------------------------------------------------------------------------------- /evobot/HLSDK/common/con_nprint.h: -------------------------------------------------------------------------------- 1 | /*** 2 | * 3 | * Copyright (c) 1996-2002, Valve LLC. All rights reserved. 4 | * 5 | * This product contains software technology licensed from Id 6 | * Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc. 7 | * All Rights Reserved. 8 | * 9 | * Use, distribution, and modification of this source code and/or resulting 10 | * object code is restricted to non-commercial enhancements to products from 11 | * Valve LLC. All other use, distribution, or modification is prohibited 12 | * without written permission from Valve LLC. 13 | * 14 | ****/ 15 | #if !defined( CON_NPRINTH ) 16 | #define CON_NPRINTH 17 | #ifdef _WIN32 18 | #ifndef __MINGW32__ 19 | #pragma once 20 | #endif /* not __MINGW32__ */ 21 | #endif 22 | 23 | typedef struct con_nprint_s 24 | { 25 | int index; // Row # 26 | float time_to_live; // # of seconds before it dissappears 27 | float color[ 3 ]; // RGB colors ( 0.0 -> 1.0 scale ) 28 | } con_nprint_t; 29 | 30 | void Con_NPrintf( int idx, char *fmt, ... ); 31 | void Con_NXPrintf( struct con_nprint_s *info, char *fmt, ... ); 32 | 33 | #endif 34 | -------------------------------------------------------------------------------- /evobot/HLSDK/common/dlight.h: -------------------------------------------------------------------------------- 1 | /*** 2 | * 3 | * Copyright (c) 1996-2002, Valve LLC. All rights reserved. 4 | * 5 | * This product contains software technology licensed from Id 6 | * Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc. 7 | * All Rights Reserved. 8 | * 9 | * Use, distribution, and modification of this source code and/or resulting 10 | * object code is restricted to non-commercial enhancements to products from 11 | * Valve LLC. All other use, distribution, or modification is prohibited 12 | * without written permission from Valve LLC. 13 | * 14 | ****/ 15 | #if !defined ( DLIGHTH ) 16 | #define DLIGHTH 17 | #ifdef _WIN32 18 | #ifndef __MINGW32__ 19 | #pragma once 20 | #endif /* not __MINGW32__ */ 21 | #endif 22 | 23 | typedef struct dlight_s 24 | { 25 | vec3_t origin; 26 | float radius; 27 | color24 color; 28 | float die; // stop lighting after this time 29 | float decay; // drop this each second 30 | float minlight; // don't add when contributing less 31 | int key; 32 | qboolean dark; // subtracts light instead of adding 33 | } dlight_t; 34 | 35 | #endif 36 | -------------------------------------------------------------------------------- /evobot/HLSDK/common/qfont.h: -------------------------------------------------------------------------------- 1 | /*** 2 | * 3 | * Copyright (c) 1996-2002, Valve LLC. All rights reserved. 4 | * 5 | * This product contains software technology licensed from Id 6 | * Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc. 7 | * All Rights Reserved. 8 | * 9 | * Use, distribution, and modification of this source code and/or resulting 10 | * object code is restricted to non-commercial enhancements to products from 11 | * Valve LLC. All other use, distribution, or modification is prohibited 12 | * without written permission from Valve LLC. 13 | * 14 | ****/ 15 | #if !defined( QFONTH ) 16 | #define QFONTH 17 | #ifdef _WIN32 18 | #ifndef __MINGW32__ 19 | #pragma once 20 | #endif /* not __MINGW32__ */ 21 | #endif 22 | 23 | // Font stuff 24 | 25 | #define NUM_GLYPHS 256 26 | 27 | typedef struct 28 | { 29 | short startoffset; 30 | short charwidth; 31 | } charinfo; 32 | 33 | typedef struct qfont_s 34 | { 35 | int width, height; 36 | int rowcount; 37 | int rowheight; 38 | charinfo fontinfo[ NUM_GLYPHS ]; 39 | byte data[4]; 40 | } qfont_t; 41 | 42 | #endif // qfont.h 43 | -------------------------------------------------------------------------------- /evobot/HLSDK/engine/customentity.h: -------------------------------------------------------------------------------- 1 | /*** 2 | * 3 | * Copyright (c) 1996-2002, Valve LLC. All rights reserved. 4 | * 5 | * This product contains software technology licensed from Id 6 | * Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc. 7 | * All Rights Reserved. 8 | * 9 | * Use, distribution, and modification of this source code and/or resulting 10 | * object code is restricted to non-commercial enhancements to products from 11 | * Valve LLC. All other use, distribution, or modification is prohibited 12 | * without written permission from Valve LLC. 13 | * 14 | ****/ 15 | #ifndef CUSTOMENTITY_H 16 | #define CUSTOMENTITY_H 17 | 18 | // Custom Entities 19 | 20 | // Start/End Entity is encoded as 12 bits of entity index, and 4 bits of attachment (4:12) 21 | #define BEAMENT_ENTITY(x) ((x)&0xFFF) 22 | #define BEAMENT_ATTACHMENT(x) (((x)>>12)&0xF) 23 | 24 | // Beam types, encoded as a byte 25 | enum 26 | { 27 | BEAM_POINTS = 0, 28 | BEAM_ENTPOINT, 29 | BEAM_ENTS, 30 | BEAM_HOSE, 31 | }; 32 | 33 | #define BEAM_FSINE 0x10 34 | #define BEAM_FSOLID 0x20 35 | #define BEAM_FSHADEIN 0x40 36 | #define BEAM_FSHADEOUT 0x80 37 | 38 | #endif //CUSTOMENTITY_H 39 | -------------------------------------------------------------------------------- /evobot/HLSDK/pm_shared/pm_materials.h: -------------------------------------------------------------------------------- 1 | /*** 2 | * 3 | * Copyright (c) 1996-2002, Valve LLC. All rights reserved. 4 | * 5 | * This product contains software technology licensed from Id 6 | * Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc. 7 | * All Rights Reserved. 8 | * 9 | * Use, distribution, and modification of this source code and/or resulting 10 | * object code is restricted to non-commercial enhancements to products from 11 | * Valve LLC. All other use, distribution, or modification is prohibited 12 | * without written permission from Valve LLC. 13 | * 14 | ****/ 15 | #if !defined( PM_MATERIALSH ) 16 | #define PM_MATERIALSH 17 | #ifdef _WIN32 18 | #ifndef __MINGW32__ 19 | #pragma once 20 | #endif /* not __MINGW32__ */ 21 | #endif 22 | 23 | #define CBTEXTURENAMEMAX 13 // only load first n chars of name 24 | 25 | #define CHAR_TEX_CONCRETE 'C' // texture types 26 | #define CHAR_TEX_METAL 'M' 27 | #define CHAR_TEX_DIRT 'D' 28 | #define CHAR_TEX_VENT 'V' 29 | #define CHAR_TEX_GRATE 'G' 30 | #define CHAR_TEX_TILE 'T' 31 | #define CHAR_TEX_SLOSH 'S' 32 | #define CHAR_TEX_WOOD 'W' 33 | #define CHAR_TEX_COMPUTER 'P' 34 | #define CHAR_TEX_GLASS 'Y' 35 | #define CHAR_TEX_FLESH 'F' 36 | 37 | #endif // !PM_MATERIALSH 38 | -------------------------------------------------------------------------------- /evobot/HLSDK/pm_shared/pm_shared.h: -------------------------------------------------------------------------------- 1 | /*** 2 | * 3 | * Copyright (c) 1996-2002, Valve LLC. All rights reserved. 4 | * 5 | * This product contains software technology licensed from Id 6 | * Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc. 7 | * All Rights Reserved. 8 | * 9 | * Use, distribution, and modification of this source code and/or resulting 10 | * object code is restricted to non-commercial enhancements to products from 11 | * Valve LLC. All other use, distribution, or modification is prohibited 12 | * without written permission from Valve LLC. 13 | * 14 | ****/ 15 | 16 | // 17 | // pm_shared.h 18 | // 19 | #if !defined( PM_SHAREDH ) 20 | #define PM_SHAREDH 21 | #ifdef _WIN32 22 | #ifndef __MINGW32__ 23 | #pragma once 24 | #endif /* not __MINGW32__ */ 25 | #endif 26 | 27 | void PM_Init( struct playermove_s *ppmove ); 28 | void PM_Move ( struct playermove_s *ppmove, int server ); 29 | char PM_FindTextureType( char *name ); 30 | 31 | // Spectator Movement modes (stored in pev->iuser1, so the physics code can get at them) 32 | #define OBS_NONE 0 33 | #define OBS_CHASE_LOCKED 1 34 | #define OBS_CHASE_FREE 2 35 | #define OBS_ROAMING 3 36 | #define OBS_IN_EYE 4 37 | #define OBS_MAP_FREE 5 38 | #define OBS_MAP_CHASE 6 39 | 40 | #endif 41 | -------------------------------------------------------------------------------- /evobot/HLSDK/common/event_args.h: -------------------------------------------------------------------------------- 1 | /*** 2 | * 3 | * Copyright (c) 1996-2002, Valve LLC. All rights reserved. 4 | * 5 | * This product contains software technology licensed from Id 6 | * Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc. 7 | * All Rights Reserved. 8 | * 9 | * Use, distribution, and modification of this source code and/or resulting 10 | * object code is restricted to non-commercial enhancements to products from 11 | * Valve LLC. All other use, distribution, or modification is prohibited 12 | * without written permission from Valve LLC. 13 | * 14 | ****/ 15 | #if !defined( EVENT_ARGSH ) 16 | #define EVENT_ARGSH 17 | #ifdef _WIN32 18 | #ifndef __MINGW32__ 19 | #pragma once 20 | #endif /* not __MINGW32__ */ 21 | #endif 22 | 23 | // Event was invoked with stated origin 24 | #define FEVENT_ORIGIN ( 1<<0 ) 25 | 26 | // Event was invoked with stated angles 27 | #define FEVENT_ANGLES ( 1<<1 ) 28 | 29 | typedef struct event_args_s 30 | { 31 | int flags; 32 | 33 | // Transmitted 34 | int entindex; 35 | 36 | float origin[3]; 37 | float angles[3]; 38 | float velocity[3]; 39 | 40 | int ducking; 41 | 42 | float fparam1; 43 | float fparam2; 44 | 45 | int iparam1; 46 | int iparam2; 47 | 48 | int bparam1; 49 | int bparam2; 50 | } event_args_t; 51 | 52 | #endif 53 | -------------------------------------------------------------------------------- /evobot/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | file(GLOB_RECURSE HeaderFiles LIST_DIRECTORIES false ${PROJECT_SOURCE_DIR}/evobot/src/*.h) 2 | file(GLOB_RECURSE SourceFiles LIST_DIRECTORIES false ${PROJECT_SOURCE_DIR}/evobot/src/*.cpp) 3 | 4 | target_sources(evobot 5 | PRIVATE ${SourceFiles} 6 | PUBLIC FILE_SET HEADERS 7 | BASE_DIRS ${PROJECT_SOURCE_DIR} 8 | FILES ${HeaderFiles} ) 9 | 10 | if (MSVC) 11 | set(RESOURCE_FILES ${PROJECT_SOURCE_DIR}/evobot/fastlz/fastlz.c) 12 | endif() 13 | 14 | set_source_files_properties(SourceFiles PROPERTIES COMPILE_OPTIONS "-Wwrite-strings") 15 | 16 | target_include_directories(evobot PRIVATE ${PROJECT_SOURCE_DIR}/evobot/metamod) 17 | target_include_directories(evobot PRIVATE ${PROJECT_SOURCE_DIR}/evobot/HLSDK/common) 18 | target_include_directories(evobot PRIVATE ${PROJECT_SOURCE_DIR}/evobot/HLSDK/dlls) 19 | target_include_directories(evobot PRIVATE ${PROJECT_SOURCE_DIR}/evobot/HLSDK/engine) 20 | target_include_directories(evobot PRIVATE ${PROJECT_SOURCE_DIR}/evobot/HLSDK/pm_shared) 21 | target_include_directories(evobot PRIVATE ${PROJECT_SOURCE_DIR}/Detour/Include) 22 | target_include_directories(evobot PRIVATE ${PROJECT_SOURCE_DIR}/DetourTileCache/Include) 23 | target_include_directories(evobot PRIVATE ${PROJECT_SOURCE_DIR}/metamod) 24 | target_include_directories(evobot PRIVATE ${PROJECT_SOURCE_DIR}/evobot/fastlz) 25 | -------------------------------------------------------------------------------- /CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 3.23) 2 | project(EvoBot LANGUAGES CXX) 3 | 4 | #Necessary for shared library on Windows 5 | if (MSVC) 6 | set(CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS ON) 7 | add_definitions(-D_CRT_SECURE_NO_WARNINGS) 8 | add_definitions(-DNOMINMAX) 9 | endif() 10 | 11 | if (LINUX) 12 | set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-write-strings -Wno-format-security -fPIC -m32") 13 | SET(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -ldl -lm -static-libgcc -static-libstdc++ -static") 14 | endif() 15 | 16 | set(CMAKE_SHARED_LIBRARY_PREFIX "") 17 | set(CMAKE_STATIC_LIBRARY_PREFIX "") 18 | 19 | add_library(Detour STATIC) 20 | target_include_directories(Detour PRIVATE "${PROJECT_SOURCE_DIR}") 21 | add_subdirectory("Detour") 22 | 23 | add_library(DetourTileCache STATIC) 24 | target_include_directories(DetourTileCache PRIVATE "${PROJECT_SOURCE_DIR}") 25 | add_subdirectory("DetourTileCache") 26 | 27 | add_library(evobot SHARED) 28 | add_dependencies(evobot Detour DetourTileCache) 29 | target_include_directories(evobot PRIVATE "${PROJECT_SOURCE_DIR}") 30 | target_link_libraries(evobot PRIVATE Detour DetourTileCache) 31 | add_subdirectory("evobot") 32 | set_target_properties(evobot PROPERTIES OUTPUT_NAME "evobot_mm") 33 | 34 | install(TARGETS Detour FILE_SET HEADERS) 35 | install(TARGETS DetourTileCache FILE_SET HEADERS) -------------------------------------------------------------------------------- /Detour/Source/DetourAssert.cpp: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) 2009-2010 Mikko Mononen memon@inside.org 3 | // 4 | // This software is provided 'as-is', without any express or implied 5 | // warranty. In no event will the authors be held liable for any damages 6 | // arising from the use of this software. 7 | // Permission is granted to anyone to use this software for any purpose, 8 | // including commercial applications, and to alter it and redistribute it 9 | // freely, subject to the following restrictions: 10 | // 1. The origin of this software must not be misrepresented; you must not 11 | // claim that you wrote the original software. If you use this software 12 | // in a product, an acknowledgment in the product documentation would be 13 | // appreciated but is not required. 14 | // 2. Altered source versions must be plainly marked as such, and must not be 15 | // misrepresented as being the original software. 16 | // 3. This notice may not be removed or altered from any source distribution. 17 | // 18 | 19 | #include "DetourAssert.h" 20 | 21 | #ifndef NDEBUG 22 | 23 | static dtAssertFailFunc* sAssertFailFunc = 0; 24 | 25 | void dtAssertFailSetCustom(dtAssertFailFunc *assertFailFunc) 26 | { 27 | sAssertFailFunc = assertFailFunc; 28 | } 29 | 30 | dtAssertFailFunc* dtAssertFailGetCustom() 31 | { 32 | return sAssertFailFunc; 33 | } 34 | 35 | #endif 36 | -------------------------------------------------------------------------------- /evobot/HLSDK/common/in_buttons.h: -------------------------------------------------------------------------------- 1 | /*** 2 | * 3 | * Copyright (c) 1999, 2000, Valve LLC. All rights reserved. 4 | * 5 | * This product contains software technology licensed from Id 6 | * Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc. 7 | * All Rights Reserved. 8 | * 9 | * Use, distribution, and modification of this source code and/or resulting 10 | * object code is restricted to non-commercial enhancements to products from 11 | * Valve LLC. All other use, distribution, or modification is prohibited 12 | * without written permission from Valve LLC. 13 | * 14 | ****/ 15 | #ifndef IN_BUTTONS_H 16 | #define IN_BUTTONS_H 17 | #ifdef _WIN32 18 | #ifndef __MINGW32__ 19 | #pragma once 20 | #endif /* not __MINGW32__ */ 21 | #endif 22 | 23 | #define IN_ATTACK (1 << 0) 24 | #define IN_JUMP (1 << 1) 25 | #define IN_DUCK (1 << 2) 26 | #define IN_FORWARD (1 << 3) 27 | #define IN_BACK (1 << 4) 28 | #define IN_USE (1 << 5) 29 | #define IN_CANCEL (1 << 6) 30 | #define IN_LEFT (1 << 7) 31 | #define IN_RIGHT (1 << 8) 32 | #define IN_MOVELEFT (1 << 9) 33 | #define IN_MOVERIGHT (1 << 10) 34 | #define IN_ATTACK2 (1 << 11) 35 | #define IN_RUN (1 << 12) 36 | #define IN_RELOAD (1 << 13) 37 | #define IN_ALT1 (1 << 14) 38 | #define IN_SCORE (1 << 15) // Used by client.dll for when scoreboard is held down 39 | 40 | #endif // IN_BUTTONS_H 41 | -------------------------------------------------------------------------------- /evobot/src/bot_bsp.h: -------------------------------------------------------------------------------- 1 | // 2 | // EvoBot - Neoptolemus' Natural Selection bot, based on Botman's HPB bot template 3 | // 4 | // bot_bsp.h 5 | // 6 | // Contains some helper functions for parsing BSP files 7 | // 8 | 9 | #pragma once 10 | 11 | #ifndef BOT_BSP_H 12 | #define BOT_BSP_H 13 | 14 | #include 15 | 16 | 17 | #define LUMP_ENTITIES 0 18 | #define HEADER_LUMPS 15 19 | 20 | #define MAX_MAP_ENTITIES 2048 21 | 22 | typedef struct _BSPLUMP 23 | { 24 | int nOffset; // File offset to data 25 | int nLength; // Length of data 26 | } BSPLUMP; 27 | 28 | 29 | typedef struct _BSPHEADER 30 | { 31 | int nVersion; // Must be 30 for a valid HL BSP file 32 | BSPLUMP lump[HEADER_LUMPS]; // Stores the directory of lumps 33 | } BSPHEADER; 34 | 35 | typedef struct _BSPENTITYPROPERTY 36 | { 37 | char propertyName[1024]; 38 | char propertyValue[1024]; 39 | } BSPENTITYPROPERTY; 40 | 41 | typedef struct _BSPENTITYDEF 42 | { 43 | char TargetName[1024]; 44 | char Target[1024]; 45 | int startPos; 46 | int endPos; 47 | char data[1024]; 48 | int numProperties; 49 | BSPENTITYPROPERTY properties[10]; 50 | } BSPENTITYDEF; 51 | 52 | typedef struct _BUTTONDEF 53 | { 54 | char TargetName[64]; 55 | char Target[64]; 56 | float Delay = 0.0f; 57 | 58 | } BUTTONDEF; 59 | 60 | 61 | 62 | void BSP_RegisterWeldables(); 63 | char* GetEntityDefClassname(BSPENTITYDEF* entity); 64 | 65 | #endif -------------------------------------------------------------------------------- /evobot/HLSDK/dlls/cdll_dll.h: -------------------------------------------------------------------------------- 1 | /*** 2 | * 3 | * Copyright (c) 1999, Valve LLC. All rights reserved. 4 | * 5 | * This product contains software technology licensed from Id 6 | * Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc. 7 | * All Rights Reserved. 8 | * 9 | * Use, distribution, and modification of this source code and/or resulting 10 | * object code is restricted to non-commercial enhancements to products from 11 | * Valve LLC. All other use, distribution, or modification is prohibited 12 | * without written permission from Valve LLC. 13 | * 14 | ****/ 15 | // 16 | // cdll_dll.h 17 | 18 | // this file is included by both the game-dll and the client-dll, 19 | 20 | #ifndef CDLL_DLL_H 21 | #define CDLL_DLL_H 22 | 23 | #define MAX_WEAPONS 32 // ??? 24 | 25 | #define MAX_WEAPON_SLOTS 5 // hud item selection slots 26 | #define MAX_ITEM_TYPES 6 // hud item selection slots 27 | 28 | #define MAX_ITEMS 5 // hard coded item types 29 | 30 | #define HIDEHUD_WEAPONS ( 1<<0 ) 31 | #define HIDEHUD_FLASHLIGHT ( 1<<1 ) 32 | #define HIDEHUD_ALL ( 1<<2 ) 33 | #define HIDEHUD_HEALTH ( 1<<3 ) 34 | 35 | #define MAX_AMMO_TYPES 32 // ??? 36 | #define MAX_AMMO_SLOTS 32 // not really slots 37 | 38 | #define HUD_PRINTNOTIFY 1 39 | #define HUD_PRINTCONSOLE 2 40 | #define HUD_PRINTTALK 3 41 | #define HUD_PRINTCENTER 4 42 | 43 | 44 | #define WEAPON_SUIT 31 45 | 46 | #endif 47 | -------------------------------------------------------------------------------- /evobot/src/h_export.cpp: -------------------------------------------------------------------------------- 1 | // vi: set ts=4 sw=4 : 2 | // vim: set tw=75 : 3 | 4 | // From SDK dlls/h_export.cpp: 5 | 6 | /*** 7 | * 8 | * Copyright (c) 1999, 2000 Valve LLC. All rights reserved. 9 | * 10 | * This product contains software technology licensed from Id 11 | * Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc. 12 | * All Rights Reserved. 13 | * 14 | * Use, distribution, and modification of this source code and/or resulting 15 | * object code is restricted to non-commercial enhancements to products from 16 | * Valve LLC. All other use, distribution, or modification is prohibited 17 | * without written permission from Valve LLC. 18 | * 19 | ****/ 20 | /* 21 | 22 | ===== h_export.cpp ======================================================== 23 | 24 | Entity classes exported by Halflife. 25 | 26 | */ 27 | 28 | #include 29 | 30 | #include 31 | 32 | // From SDK dlls/h_export.cpp: 33 | 34 | //! Holds engine functionality callbacks 35 | enginefuncs_t g_engfuncs; 36 | globalvars_t *gpGlobals; 37 | 38 | char g_argv[1024]; 39 | 40 | // Receive engine function table from engine. 41 | // This appears to be the _first_ DLL routine called by the engine, so we 42 | // do some setup operations here. 43 | void WINAPI GiveFnptrsToDll( enginefuncs_t* pengfuncsFromEngine, globalvars_t *pGlobals ) 44 | { 45 | memcpy(&g_engfuncs, pengfuncsFromEngine, sizeof(enginefuncs_t)); 46 | gpGlobals = pGlobals; 47 | } 48 | -------------------------------------------------------------------------------- /evobot/HLSDK/common/weaponinfo.h: -------------------------------------------------------------------------------- 1 | /*** 2 | * 3 | * Copyright (c) 1999, 2000, Valve LLC. All rights reserved. 4 | * 5 | * This product contains software technology licensed from Id 6 | * Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc. 7 | * All Rights Reserved. 8 | * 9 | * Use, distribution, and modification of this source code and/or resulting 10 | * object code is restricted to non-commercial enhancements to products from 11 | * Valve LLC. All other use, distribution, or modification is prohibited 12 | * without written permission from Valve LLC. 13 | * 14 | ****/ 15 | #if !defined ( WEAPONINFOH ) 16 | #define WEAPONINFOH 17 | #ifdef _WIN32 18 | #ifndef __MINGW32__ 19 | #pragma once 20 | #endif /* not __MINGW32__ */ 21 | #endif 22 | 23 | // Info about weapons player might have in his/her possession 24 | typedef struct weapon_data_s 25 | { 26 | int m_iId; 27 | int m_iClip; 28 | 29 | float m_flNextPrimaryAttack; 30 | float m_flNextSecondaryAttack; 31 | float m_flTimeWeaponIdle; 32 | 33 | int m_fInReload; 34 | int m_fInSpecialReload; 35 | float m_flNextReload; 36 | float m_flPumpTime; 37 | float m_fReloadTime; 38 | 39 | float m_fAimedDamage; 40 | float m_fNextAimBonus; 41 | int m_fInZoom; 42 | int m_iWeaponState; 43 | 44 | int iuser1; 45 | int iuser2; 46 | int iuser3; 47 | int iuser4; 48 | float fuser1; 49 | float fuser2; 50 | float fuser3; 51 | float fuser4; 52 | } weapon_data_t; 53 | 54 | #endif 55 | -------------------------------------------------------------------------------- /evobot/HLSDK/common/usercmd.h: -------------------------------------------------------------------------------- 1 | /*** 2 | * 3 | * Copyright (c) 1996-2002, Valve LLC. All rights reserved. 4 | * 5 | * This product contains software technology licensed from Id 6 | * Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc. 7 | * All Rights Reserved. 8 | * 9 | * Use, distribution, and modification of this source code and/or resulting 10 | * object code is restricted to non-commercial enhancements to products from 11 | * Valve LLC. All other use, distribution, or modification is prohibited 12 | * without written permission from Valve LLC. 13 | * 14 | ****/ 15 | #ifndef USERCMD_H 16 | #define USERCMD_H 17 | #ifdef _WIN32 18 | #ifndef __MINGW32__ 19 | #pragma once 20 | #endif /* not __MINGW32__ */ 21 | #endif 22 | 23 | typedef struct usercmd_s 24 | { 25 | short lerp_msec; // Interpolation time on client 26 | byte msec; // Duration in ms of command 27 | vec3_t viewangles; // Command view angles. 28 | 29 | // intended velocities 30 | float forwardmove; // Forward velocity. 31 | float sidemove; // Sideways velocity. 32 | float upmove; // Upward velocity. 33 | byte lightlevel; // Light level at spot where we are standing. 34 | unsigned short buttons; // Attack buttons 35 | byte impulse; // Impulse command issued. 36 | byte weaponselect; // Current weapon id 37 | 38 | // Experimental player impact stuff. 39 | int impact_index; 40 | vec3_t impact_position; 41 | } usercmd_t; 42 | 43 | #endif // USERCMD_H 44 | -------------------------------------------------------------------------------- /evobot/HLSDK/common/pmtrace.h: -------------------------------------------------------------------------------- 1 | /*** 2 | * 3 | * Copyright (c) 1996-2002, Valve LLC. All rights reserved. 4 | * 5 | * This product contains software technology licensed from Id 6 | * Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc. 7 | * All Rights Reserved. 8 | * 9 | * Use, distribution, and modification of this source code and/or resulting 10 | * object code is restricted to non-commercial enhancements to products from 11 | * Valve LLC. All other use, distribution, or modification is prohibited 12 | * without written permission from Valve LLC. 13 | * 14 | ****/ 15 | #if !defined( PMTRACEH ) 16 | #define PMTRACEH 17 | #ifdef _WIN32 18 | #ifndef __MINGW32__ 19 | #pragma once 20 | #endif /* not __MINGW32__ */ 21 | #endif 22 | 23 | typedef struct 24 | { 25 | vec3_t normal; 26 | float dist; 27 | } pmplane_t; 28 | 29 | typedef struct pmtrace_s pmtrace_t; 30 | 31 | struct pmtrace_s 32 | { 33 | qboolean allsolid; // if true, plane is not valid 34 | qboolean startsolid; // if true, the initial point was in a solid area 35 | qboolean inopen, inwater; // End point is in empty space or in water 36 | float fraction; // time completed, 1.0 = didn't hit anything 37 | vec3_t endpos; // final position 38 | pmplane_t plane; // surface normal at impact 39 | int ent; // entity at impact 40 | vec3_t deltavelocity; // Change in player's velocity caused by impact. 41 | // Only run on server. 42 | int hitgroup; 43 | }; 44 | 45 | #endif 46 | -------------------------------------------------------------------------------- /BUILD_AMBUILD.md: -------------------------------------------------------------------------------- 1 | Building Evobot with AMBuild 2 | =============== 3 | 4 | # Requirements 5 | 6 | ## Windows 7 | 8 | * Visual C++ 2017 or higher. 9 | * Python 3.3 or higher. 10 | * [Git] 11 | * [AMBuild] 12 | 13 | ## Linux 14 | 15 | * Python 3.3 or higher. 16 | * A C++ compiler such as gcc or clang. 17 | * If building on a 64-bit system, you must install the 32-bit binaries for the compiler. 18 | * Install git from your system package manager. 19 | * [AMBuild] 20 | 21 | # Building 22 | 23 | After cloning the current repo, you must configure the build. 24 | 25 | First create a folder called **build** and then run *configure.py*. Example: 26 | 27 | ``` 28 | cd evobot_mm 29 | mkdir build 30 | cd build 31 | python ../configure.py 32 | ``` 33 | 34 | You may also need to run Python as `python3` instead of `python` on some systems. 35 | 36 | It is safe to reconfigure over an old build. However, it's probably a bad idea to configure inside a random, non-empty folder. 37 | 38 | There are a few extra options you can pass to *configure*: 39 | 40 | * --enable-optimize - Compile with optimization. 41 | * --enable-debug - Compile with symbols and debug checks. 42 | * --enable-static-lib - Statically link the sanitizer runtime (Linux only). 43 | * --enable-shared-lib - Dynamically link the sanitizer runtime (Linux only). 44 | * --symbol-files - Split debugging symbols from binaries into separate symbol files. 45 | 46 | To build, simply type: `ambuild` 47 | 48 | [AMBuild]: https://wiki.alliedmods.net/Ambuild 49 | [Git]: https://git-scm.com/ 50 | 51 | All thanks to Anonymous Player for writing the build script and configuration. -------------------------------------------------------------------------------- /evobot/HLSDK/common/cvardef.h: -------------------------------------------------------------------------------- 1 | /*** 2 | * 3 | * Copyright (c) 1999, 2000, Valve LLC. All rights reserved. 4 | * 5 | * This product contains software technology licensed from Id 6 | * Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc. 7 | * All Rights Reserved. 8 | * 9 | * Use, distribution, and modification of this source code and/or resulting 10 | * object code is restricted to non-commercial enhancements to products from 11 | * Valve LLC. All other use, distribution, or modification is prohibited 12 | * without written permission from Valve LLC. 13 | * 14 | ****/ 15 | #ifndef CVARDEF_H 16 | #define CVARDEF_H 17 | 18 | #define FCVAR_ARCHIVE (1<<0) // set to cause it to be saved to vars.rc 19 | #define FCVAR_USERINFO (1<<1) // changes the client's info string 20 | #define FCVAR_SERVER (1<<2) // notifies players when changed 21 | #define FCVAR_EXTDLL (1<<3) // defined by external DLL 22 | #define FCVAR_CLIENTDLL (1<<4) // defined by the client dll 23 | #define FCVAR_PROTECTED (1<<5) // It's a server cvar, but we don't send the data since it's a password, etc. Sends 1 if it's not bland/zero, 0 otherwise as value 24 | #define FCVAR_SPONLY (1<<6) // This cvar cannot be changed by clients connected to a multiplayer server. 25 | #define FCVAR_PRINTABLEONLY (1<<7) // This cvar's string cannot contain unprintable characters ( e.g., used for player name etc ). 26 | #define FCVAR_UNLOGGED (1<<8) // If this is a FCVAR_SERVER, don't log changes to the log file / console if we are creating a log 27 | 28 | typedef struct cvar_s 29 | { 30 | char *name; 31 | char *string; 32 | int flags; 33 | float value; 34 | struct cvar_s *next; 35 | } cvar_t; 36 | #endif 37 | -------------------------------------------------------------------------------- /evobot/HLSDK/common/particledef.h: -------------------------------------------------------------------------------- 1 | /*** 2 | * 3 | * Copyright (c) 1996-2002, Valve LLC. All rights reserved. 4 | * 5 | * This product contains software technology licensed from Id 6 | * Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc. 7 | * All Rights Reserved. 8 | * 9 | * Use, distribution, and modification of this source code and/or resulting 10 | * object code is restricted to non-commercial enhancements to products from 11 | * Valve LLC. All other use, distribution, or modification is prohibited 12 | * without written permission from Valve LLC. 13 | * 14 | ****/ 15 | #if !defined( PARTICLEDEFH ) 16 | #define PARTICLEDEFH 17 | #ifdef _WIN32 18 | #ifndef __MINGW32__ 19 | #pragma once 20 | #endif /* not __MINGW32__ */ 21 | #endif 22 | 23 | typedef enum { 24 | pt_static, 25 | pt_grav, 26 | pt_slowgrav, 27 | pt_fire, 28 | pt_explode, 29 | pt_explode2, 30 | pt_blob, 31 | pt_blob2, 32 | pt_vox_slowgrav, 33 | pt_vox_grav, 34 | pt_clientcustom // Must have callback function specified 35 | } ptype_t; 36 | 37 | // !!! if this is changed, it must be changed in d_ifacea.h too !!! 38 | typedef struct particle_s 39 | { 40 | // driver-usable fields 41 | vec3_t org; 42 | short color; 43 | short packedColor; 44 | // drivers never touch the following fields 45 | struct particle_s *next; 46 | vec3_t vel; 47 | float ramp; 48 | float die; 49 | ptype_t type; 50 | void (*deathfunc)( struct particle_s *particle ); 51 | 52 | // for pt_clientcusttom, we'll call this function each frame 53 | void (*callback)( struct particle_s *particle, float frametime ); 54 | 55 | // For deathfunc, etc. 56 | unsigned char context; 57 | } particle_t; 58 | 59 | #endif 60 | -------------------------------------------------------------------------------- /configure.py: -------------------------------------------------------------------------------- 1 | # AMBuild Configuration Script for EvoBot, written by Anonymous Player 2 | # vim: set sts=4 ts=8 sw=4 tw=99 et: 3 | API_VERSION = '2.2.3' 4 | 5 | import sys 6 | try: 7 | from ambuild2 import run 8 | if not run.HasAPI(API_VERSION): 9 | raise Exception() 10 | except: 11 | sys.stderr.write('AMBuild {0} must be installed to build this project.\n'.format(API_VERSION)) 12 | sys.stderr.write('http://www.alliedmods.net/ambuild\n') 13 | sys.exit(1) 14 | 15 | def make_objdir_name(p): 16 | return 'obj-' + util.Platform() + '-' + p.target_arch 17 | 18 | builder = run.BuildParser(sourcePath = sys.path[0], api=API_VERSION) 19 | builder.default_arch = 'x86' 20 | builder.default_build_folder = make_objdir_name 21 | # builder.options.add_argument('--hl1sdk', type=str, dest='hl1sdk_path', default=None, 22 | # help='Half-Life 1 SDK source tree folder') 23 | # builder.options.add_argument('--mm-path', type=str, dest='mm_path', default=None, 24 | # help='Metamod source tree folder') 25 | builder.options.add_argument('--enable-optimize', action='store_const', const='1', dest='optimize', 26 | help='Enable optimization') 27 | builder.options.add_argument('--enable-debug', action='store_const', const='1', dest='debug', 28 | help='Enable debug') 29 | builder.options.add_argument('--enable-static-lib', action='store_const', const='1', dest='staticlib', 30 | help='Enable statically link the sanitizer runtime') 31 | builder.options.add_argument('--enable-shared-lib', action='store_const', const='1', dest='sharedlib', 32 | help='Enable dynamically link the sanitizer runtime') 33 | builder.Configure() -------------------------------------------------------------------------------- /Detour/Source/DetourAlloc.cpp: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) 2009-2010 Mikko Mononen memon@inside.org 3 | // 4 | // This software is provided 'as-is', without any express or implied 5 | // warranty. In no event will the authors be held liable for any damages 6 | // arising from the use of this software. 7 | // Permission is granted to anyone to use this software for any purpose, 8 | // including commercial applications, and to alter it and redistribute it 9 | // freely, subject to the following restrictions: 10 | // 1. The origin of this software must not be misrepresented; you must not 11 | // claim that you wrote the original software. If you use this software 12 | // in a product, an acknowledgment in the product documentation would be 13 | // appreciated but is not required. 14 | // 2. Altered source versions must be plainly marked as such, and must not be 15 | // misrepresented as being the original software. 16 | // 3. This notice may not be removed or altered from any source distribution. 17 | // 18 | 19 | #include 20 | #include "DetourAlloc.h" 21 | 22 | static void *dtAllocDefault(size_t size, dtAllocHint) 23 | { 24 | return malloc(size); 25 | } 26 | 27 | static void dtFreeDefault(void *ptr) 28 | { 29 | free(ptr); 30 | } 31 | 32 | static dtAllocFunc* sAllocFunc = dtAllocDefault; 33 | static dtFreeFunc* sFreeFunc = dtFreeDefault; 34 | 35 | void dtAllocSetCustom(dtAllocFunc *allocFunc, dtFreeFunc *freeFunc) 36 | { 37 | sAllocFunc = allocFunc ? allocFunc : dtAllocDefault; 38 | sFreeFunc = freeFunc ? freeFunc : dtFreeDefault; 39 | } 40 | 41 | void* dtAlloc(size_t size, dtAllocHint hint) 42 | { 43 | return sAllocFunc(size, hint); 44 | } 45 | 46 | void dtFree(void* ptr) 47 | { 48 | if (ptr) 49 | sFreeFunc(ptr); 50 | } 51 | -------------------------------------------------------------------------------- /evobot/metamod/studioapi.h: -------------------------------------------------------------------------------- 1 | // vi: set ts=4 sw=4 : 2 | // vim: set tw=75 : 3 | 4 | // studio.cpp - player model blending interfaces 5 | 6 | /* 7 | * Copyright (c) 2001-2006 Will Day 8 | * 9 | * This file is part of Metamod. 10 | * 11 | * Metamod is free software; you can redistribute it and/or modify it 12 | * under the terms of the GNU General Public License as published by the 13 | * Free Software Foundation; either version 2 of the License, or (at 14 | * your option) any later version. 15 | * 16 | * Metamod is distributed in the hope that it will be useful, but 17 | * WITHOUT ANY WARRANTY; without even the implied warranty of 18 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 19 | * General Public License for more details. 20 | * 21 | * You should have received a copy of the GNU General Public License 22 | * along with Metamod; if not, write to the Free Software Foundation, 23 | * Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 24 | * 25 | * In addition, as a special exception, the author gives permission to 26 | * link the code of this program with the Half-Life Game Engine ("HL 27 | * Engine") and Modified Game Libraries ("MODs") developed by Valve, 28 | * L.L.C ("Valve"). You must obey the GNU General Public License in all 29 | * respects for all of the code used other than the HL Engine and MODs 30 | * from Valve. If you modify this file, you may extend this exception 31 | * to your version of the file, but you are not obligated to do so. If 32 | * you do not wish to do so, delete this exception statement from your 33 | * version. 34 | * 35 | */ 36 | 37 | //Jussi Kivilinna: This forwarder function to gamedll is not needed anymore, dynamic 38 | // linkent code handles this too! 39 | -------------------------------------------------------------------------------- /evobot/HLSDK/common/event_flags.h: -------------------------------------------------------------------------------- 1 | /*** 2 | * 3 | * Copyright (c) 1999, 2000, Valve LLC. All rights reserved. 4 | * 5 | * This product contains software technology licensed from Id 6 | * Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc. 7 | * All Rights Reserved. 8 | * 9 | * Use, distribution, and modification of this source code and/or resulting 10 | * object code is restricted to non-commercial enhancements to products from 11 | * Valve LLC. All other use, distribution, or modification is prohibited 12 | * without written permission from Valve LLC. 13 | * 14 | ****/ 15 | #if !defined( EVENT_FLAGSH ) 16 | #define EVENT_FLAGSH 17 | #ifdef _WIN32 18 | #ifndef __MINGW32__ 19 | #pragma once 20 | #endif /* not __MINGW32__ */ 21 | #endif 22 | 23 | // Skip local host for event send. 24 | #define FEV_NOTHOST (1<<0) 25 | 26 | // Send the event reliably. You must specify the origin and angles and use 27 | // PLAYBACK_EVENT_FULL for this to work correctly on the server for anything 28 | // that depends on the event origin/angles. I.e., the origin/angles are not 29 | // taken from the invoking edict for reliable events. 30 | #define FEV_RELIABLE (1<<1) 31 | 32 | // Don't restrict to PAS/PVS, send this event to _everybody_ on the server ( useful for stopping CHAN_STATIC 33 | // sounds started by client event when client is not in PVS anymore ( hwguy in TFC e.g. ). 34 | #define FEV_GLOBAL (1<<2) 35 | 36 | // If this client already has one of these events in its queue, just update the event instead of sending it as a duplicate 37 | // 38 | #define FEV_UPDATE (1<<3) 39 | 40 | // Only send to entity specified as the invoker 41 | #define FEV_HOSTONLY (1<<4) 42 | 43 | // Only send if the event was created on the server. 44 | #define FEV_SERVER (1<<5) 45 | 46 | // Only issue event client side ( from shared code ) 47 | #define FEV_CLIENT (1<<6) 48 | 49 | #endif 50 | -------------------------------------------------------------------------------- /evobot/metamod/vdate.h: -------------------------------------------------------------------------------- 1 | // vi: set ts=4 sw=4 : 2 | // vim: set tw=75 : 3 | 4 | // vdate.h - compile-time version date 5 | 6 | /* 7 | * Copyright (c) 2001-2006 Will Day 8 | * 9 | * This file is part of Metamod. 10 | * 11 | * Metamod is free software; you can redistribute it and/or modify it 12 | * under the terms of the GNU General Public License as published by the 13 | * Free Software Foundation; either version 2 of the License, or (at 14 | * your option) any later version. 15 | * 16 | * Metamod is distributed in the hope that it will be useful, but 17 | * WITHOUT ANY WARRANTY; without even the implied warranty of 18 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 19 | * General Public License for more details. 20 | * 21 | * You should have received a copy of the GNU General Public License 22 | * along with Metamod; if not, write to the Free Software Foundation, 23 | * Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 24 | * 25 | * In addition, as a special exception, the author gives permission to 26 | * link the code of this program with the Half-Life Game Engine ("HL 27 | * Engine") and Modified Game Libraries ("MODs") developed by Valve, 28 | * L.L.C ("Valve"). You must obey the GNU General Public License in all 29 | * respects for all of the code used other than the HL Engine and MODs 30 | * from Valve. If you modify this file, you may extend this exception 31 | * to your version of the file, but you are not obligated to do so. If 32 | * you do not wish to do so, delete this exception statement from your 33 | * version. 34 | * 35 | */ 36 | 37 | #ifndef VDATE_H 38 | #define VDATE_H 39 | 40 | #include "comp_dep.h" 41 | 42 | extern char const *COMPILE_TIME DLLHIDDEN; 43 | extern char const *COMPILE_TZONE DLLHIDDEN; 44 | 45 | #endif /* VDATE_H */ 46 | -------------------------------------------------------------------------------- /evobot/metamod/game_autodetect.h: -------------------------------------------------------------------------------- 1 | // vi: set ts=4 sw=4 : 2 | // vim: set tw=75 : 3 | 4 | // autodetect.h - GameDLL search and autodetection. 5 | 6 | /* 7 | * Copyright (c) 2004-2006 Jussi Kivilinna 8 | * 9 | * This file is part of "Metamod All-Mod-Support"-patch for Metamod. 10 | * 11 | * Metamod is free software; you can redistribute it and/or modify it 12 | * under the terms of the GNU General Public License as published by the 13 | * Free Software Foundation; either version 2 of the License, or (at 14 | * your option) any later version. 15 | * 16 | * Metamod is distributed in the hope that it will be useful, but 17 | * WITHOUT ANY WARRANTY; without even the implied warranty of 18 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 19 | * General Public License for more details. 20 | * 21 | * You should have received a copy of the GNU General Public License 22 | * along with Metamod; if not, write to the Free Software Foundation, 23 | * Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 24 | * 25 | * In addition, as a special exception, the author gives permission to 26 | * link the code of this program with the Half-Life Game Engine ("HL 27 | * Engine") and Modified Game Libraries ("MODs") developed by Valve, 28 | * L.L.C ("Valve"). You must obey the GNU General Public License in all 29 | * respects for all of the code used other than the HL Engine and MODs 30 | * from Valve. If you modify this file, you may extend this exception 31 | * to your version of the file, but you are not obligated to do so. If 32 | * you do not wish to do so, delete this exception statement from your 33 | * version. 34 | * 35 | */ 36 | 37 | #ifndef GAME_AUTODETECT_H 38 | #define GAME_AUTODETECT_H 39 | 40 | #include "metamod.h" 41 | const char * DLLINTERNAL autodetect_gamedll(const gamedll_t *gamedll, const char *knownfn); 42 | 43 | #endif /*GAME_AUTODETECT_H*/ 44 | -------------------------------------------------------------------------------- /evobot/HLSDK/common/crc.h: -------------------------------------------------------------------------------- 1 | /*** 2 | * 3 | * Copyright (c) 1999, 2000, Valve LLC. All rights reserved. 4 | * 5 | * This product contains software technology licensed from Id 6 | * Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc. 7 | * All Rights Reserved. 8 | * 9 | * Use, distribution, and modification of this source code and/or resulting 10 | * object code is restricted to non-commercial enhancements to products from 11 | * Valve LLC. All other use, distribution, or modification is prohibited 12 | * without written permission from Valve LLC. 13 | * 14 | ****/ 15 | /* crc.h */ 16 | #ifndef CRC_H 17 | #define CRC_H 18 | #ifdef _WIN32 19 | #ifndef __MINGW32__ 20 | #pragma once 21 | #endif /* not __MINGW32__ */ 22 | #endif 23 | 24 | // MD5 Hash 25 | typedef struct 26 | { 27 | unsigned int buf[4]; 28 | unsigned int bits[2]; 29 | unsigned char in[64]; 30 | } MD5Context_t; 31 | 32 | 33 | typedef unsigned long CRC32_t; 34 | void CRC32_Init(CRC32_t *pulCRC); 35 | CRC32_t CRC32_Final(CRC32_t pulCRC); 36 | void CRC32_ProcessBuffer(CRC32_t *pulCRC, void *p, int len); 37 | void CRC32_ProcessByte(CRC32_t *pulCRC, unsigned char ch); 38 | int CRC_File(CRC32_t *crcvalue, char *pszFileName); 39 | 40 | unsigned char COM_BlockSequenceCRCByte (unsigned char *base, int length, int sequence); 41 | 42 | void MD5Init(MD5Context_t *context); 43 | void MD5Update(MD5Context_t *context, unsigned char const *buf, 44 | unsigned int len); 45 | void MD5Final(unsigned char digest[16], MD5Context_t *context); 46 | void Transform(unsigned int buf[4], unsigned int const in[16]); 47 | 48 | int MD5_Hash_File(unsigned char digest[16], char *pszFileName, int bUsefopen, int bSeed, unsigned int seed[4]); 49 | char *MD5_Print(unsigned char hash[16]); 50 | int MD5_Hash_CachedFile(unsigned char digest[16], unsigned char *pCache, int nFileSize, int bSeed, unsigned int seed[4]); 51 | 52 | int CRC_MapFile(CRC32_t *crcvalue, char *pszFileName); 53 | 54 | #endif 55 | -------------------------------------------------------------------------------- /evobot/HLSDK/common/ref_params.h: -------------------------------------------------------------------------------- 1 | /*** 2 | * 3 | * Copyright (c) 1996-2002, Valve LLC. All rights reserved. 4 | * 5 | * This product contains software technology licensed from Id 6 | * Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc. 7 | * All Rights Reserved. 8 | * 9 | * Use, distribution, and modification of this source code and/or resulting 10 | * object code is restricted to non-commercial enhancements to products from 11 | * Valve LLC. All other use, distribution, or modification is prohibited 12 | * without written permission from Valve LLC. 13 | * 14 | ****/ 15 | #if !defined( REF_PARAMSH ) 16 | #define REF_PARAMSH 17 | 18 | typedef struct ref_params_s 19 | { 20 | // Output 21 | float vieworg[3]; 22 | float viewangles[3]; 23 | 24 | float forward[3]; 25 | float right[3]; 26 | float up[3]; 27 | 28 | // Client frametime; 29 | float frametime; 30 | // Client time 31 | float time; 32 | 33 | // Misc 34 | int intermission; 35 | int paused; 36 | int spectator; 37 | int onground; 38 | int waterlevel; 39 | 40 | float simvel[3]; 41 | float simorg[3]; 42 | 43 | float viewheight[3]; 44 | float idealpitch; 45 | 46 | float cl_viewangles[3]; 47 | 48 | int health; 49 | float crosshairangle[3]; 50 | float viewsize; 51 | 52 | float punchangle[3]; 53 | int maxclients; 54 | int viewentity; 55 | int playernum; 56 | int max_entities; 57 | int demoplayback; 58 | int hardware; 59 | 60 | int smoothing; 61 | 62 | // Last issued usercmd 63 | struct usercmd_s *cmd; 64 | 65 | // Movevars 66 | struct movevars_s *movevars; 67 | 68 | int viewport[4]; // the viewport coordinates x ,y , width, height 69 | 70 | int nextView; // the renderer calls ClientDLL_CalcRefdef() and Renderview 71 | // so long in cycles until this value is 0 (multiple views) 72 | int onlyClientDraw; // if !=0 nothing is drawn by the engine except clientDraw functions 73 | } ref_params_t; 74 | 75 | #endif // !REF_PARAMSH 76 | -------------------------------------------------------------------------------- /evobot/HLSDK/common/beamdef.h: -------------------------------------------------------------------------------- 1 | /*** 2 | * 3 | * Copyright (c) 1996-2002, Valve LLC. All rights reserved. 4 | * 5 | * This product contains software technology licensed from Id 6 | * Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc. 7 | * All Rights Reserved. 8 | * 9 | * Use, distribution, and modification of this source code and/or resulting 10 | * object code is restricted to non-commercial enhancements to products from 11 | * Valve LLC. All other use, distribution, or modification is prohibited 12 | * without written permission from Valve LLC. 13 | * 14 | ****/ 15 | #if !defined ( BEAMDEFH ) 16 | #define BEAMDEFH 17 | #ifdef _WIN32 18 | #ifndef __MINGW32__ 19 | #pragma once 20 | #endif /* not __MINGW32__ */ 21 | #endif 22 | 23 | #define FBEAM_STARTENTITY 0x00000001 24 | #define FBEAM_ENDENTITY 0x00000002 25 | #define FBEAM_FADEIN 0x00000004 26 | #define FBEAM_FADEOUT 0x00000008 27 | #define FBEAM_SINENOISE 0x00000010 28 | #define FBEAM_SOLID 0x00000020 29 | #define FBEAM_SHADEIN 0x00000040 30 | #define FBEAM_SHADEOUT 0x00000080 31 | #define FBEAM_STARTVISIBLE 0x10000000 // Has this client actually seen this beam's start entity yet? 32 | #define FBEAM_ENDVISIBLE 0x20000000 // Has this client actually seen this beam's end entity yet? 33 | #define FBEAM_ISACTIVE 0x40000000 34 | #define FBEAM_FOREVER 0x80000000 35 | 36 | typedef struct beam_s BEAM; 37 | struct beam_s 38 | { 39 | BEAM *next; 40 | int type; 41 | int flags; 42 | vec3_t source; 43 | vec3_t target; 44 | vec3_t delta; 45 | float t; // 0 .. 1 over lifetime of beam 46 | float freq; 47 | float die; 48 | float width; 49 | float amplitude; 50 | float r, g, b; 51 | float brightness; 52 | float speed; 53 | float frameRate; 54 | float frame; 55 | int segments; 56 | int startEntity; 57 | int endEntity; 58 | int modelIndex; 59 | int frameCount; 60 | struct model_s *pFollowModel; 61 | struct particle_s *particles; 62 | }; 63 | 64 | #endif 65 | -------------------------------------------------------------------------------- /evobot/metamod/h_export.h: -------------------------------------------------------------------------------- 1 | // vi: set ts=4 sw=4 : 2 | // vim: set tw=75 : 3 | 4 | // h_export.h - prototypes for h_export.cpp 5 | 6 | /* 7 | * Copyright (c) 2001-2006 Will Day 8 | * 9 | * This file is part of Metamod. 10 | * 11 | * Metamod is free software; you can redistribute it and/or modify it 12 | * under the terms of the GNU General Public License as published by the 13 | * Free Software Foundation; either version 2 of the License, or (at 14 | * your option) any later version. 15 | * 16 | * Metamod is distributed in the hope that it will be useful, but 17 | * WITHOUT ANY WARRANTY; without even the implied warranty of 18 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 19 | * General Public License for more details. 20 | * 21 | * You should have received a copy of the GNU General Public License 22 | * along with Metamod; if not, write to the Free Software Foundation, 23 | * Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 24 | * 25 | * In addition, as a special exception, the author gives permission to 26 | * link the code of this program with the Half-Life Game Engine ("HL 27 | * Engine") and Modified Game Libraries ("MODs") developed by Valve, 28 | * L.L.C ("Valve"). You must obey the GNU General Public License in all 29 | * respects for all of the code used other than the HL Engine and MODs 30 | * from Valve. If you modify this file, you may extend this exception 31 | * to your version of the file, but you are not obligated to do so. If 32 | * you do not wish to do so, delete this exception statement from your 33 | * version. 34 | * 35 | */ 36 | 37 | #ifndef H_EXPORT_H 38 | #define H_EXPORT_H 39 | 40 | #include "osdep.h" // DLLEXPORT, WINAPI, etc 41 | 42 | // Our GiveFnptrsToDll, called by engine. 43 | typedef void (WINAPI *GIVE_ENGINE_FUNCTIONS_FN) (enginefuncs_t 44 | *pengfuncsFromEngine, globalvars_t *pGlobals); 45 | 46 | C_DLLEXPORT void WINAPI GiveFnptrsToDll(enginefuncs_t *pengfuncsFromEngine, 47 | globalvars_t *pGlobals); 48 | 49 | #endif /* H_EXPORT_H */ 50 | -------------------------------------------------------------------------------- /evobot/HLSDK/common/triangleapi.h: -------------------------------------------------------------------------------- 1 | /*** 2 | * 3 | * Copyright (c) 1996-2002, Valve LLC. All rights reserved. 4 | * 5 | * This product contains software technology licensed from Id 6 | * Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc. 7 | * All Rights Reserved. 8 | * 9 | * Use, distribution, and modification of this source code and/or resulting 10 | * object code is restricted to non-commercial enhancements to products from 11 | * Valve LLC. All other use, distribution, or modification is prohibited 12 | * without written permission from Valve LLC. 13 | * 14 | ****/ 15 | #if !defined( TRIANGLEAPIH ) 16 | #define TRIANGLEAPIH 17 | #ifdef _WIN32 18 | #ifndef __MINGW32__ 19 | #pragma once 20 | #endif /* not __MINGW32__ */ 21 | #endif 22 | 23 | typedef enum 24 | { 25 | TRI_FRONT = 0, 26 | TRI_NONE = 1, 27 | } TRICULLSTYLE; 28 | 29 | #define TRI_API_VERSION 1 30 | 31 | #define TRI_TRIANGLES 0 32 | #define TRI_TRIANGLE_FAN 1 33 | #define TRI_QUADS 2 34 | #define TRI_POLYGON 3 35 | #define TRI_LINES 4 36 | #define TRI_TRIANGLE_STRIP 5 37 | #define TRI_QUAD_STRIP 6 38 | 39 | typedef struct triangleapi_s 40 | { 41 | int version; 42 | 43 | void ( *RenderMode )( int mode ); 44 | void ( *Begin )( int primitiveCode ); 45 | void ( *End ) ( void ); 46 | 47 | void ( *Color4f ) ( float r, float g, float b, float a ); 48 | void ( *Color4ub ) ( unsigned char r, unsigned char g, unsigned char b, unsigned char a ); 49 | void ( *TexCoord2f ) ( float u, float v ); 50 | void ( *Vertex3fv ) ( float *worldPnt ); 51 | void ( *Vertex3f ) ( float x, float y, float z ); 52 | void ( *Brightness ) ( float brightness ); 53 | void ( *CullFace ) ( TRICULLSTYLE style ); 54 | int ( *SpriteTexture ) ( struct model_s *pSpriteModel, int frame ); 55 | int ( *WorldToScreen ) ( float *world, float *screen ); // Returns 1 if it's z clipped 56 | void ( *Fog ) ( float flFogColor[3], float flStart, float flEnd, int bOn ); //Works just like GL_FOG, flFogColor is r/g/b. 57 | void ( *ScreenToWorld ) ( float *screen, float *world ); 58 | 59 | } triangleapi_t; 60 | 61 | #endif // !TRIANGLEAPIH 62 | -------------------------------------------------------------------------------- /evobot/HLSDK/engine/shake.h: -------------------------------------------------------------------------------- 1 | /*** 2 | * 3 | * Copyright (c) 1996-2002, Valve LLC. All rights reserved. 4 | * 5 | * This product contains software technology licensed from Id 6 | * Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc. 7 | * All Rights Reserved. 8 | * 9 | * Use, distribution, and modification of this source code and/or resulting 10 | * object code is restricted to non-commercial enhancements to products from 11 | * Valve LLC. All other use, distribution, or modification is prohibited 12 | * without written permission from Valve LLC. 13 | * 14 | ****/ 15 | #ifndef SHAKE_H 16 | #define SHAKE_H 17 | 18 | // Screen / View effects 19 | 20 | // screen shake 21 | extern int gmsgShake; 22 | 23 | // This structure is sent over the net to describe a screen shake event 24 | typedef struct 25 | { 26 | unsigned short amplitude; // FIXED 4.12 amount of shake 27 | unsigned short duration; // FIXED 4.12 seconds duration 28 | unsigned short frequency; // FIXED 8.8 noise frequency (low frequency is a jerk,high frequency is a rumble) 29 | } ScreenShake; 30 | 31 | extern void V_ApplyShake( float *origin, float *angles, float factor ); 32 | extern void V_CalcShake( void ); 33 | extern int V_ScreenShake( const char *pszName, int iSize, void *pbuf ); 34 | extern int V_ScreenFade( const char *pszName, int iSize, void *pbuf ); 35 | 36 | 37 | // Fade in/out 38 | extern int gmsgFade; 39 | 40 | #define FFADE_IN 0x0000 // Just here so we don't pass 0 into the function 41 | #define FFADE_OUT 0x0001 // Fade out (not in) 42 | #define FFADE_MODULATE 0x0002 // Modulate (don't blend) 43 | #define FFADE_STAYOUT 0x0004 // ignores the duration, stays faded out until new ScreenFade message received 44 | 45 | // This structure is sent over the net to describe a screen fade event 46 | typedef struct 47 | { 48 | unsigned short duration; // FIXED 4.12 seconds duration 49 | unsigned short holdTime; // FIXED 4.12 seconds duration until reset (fade & hold) 50 | short fadeFlags; // flags 51 | byte r, g, b, a; // fade to color ( max alpha ) 52 | } ScreenFade; 53 | 54 | #endif // SHAKE_H 55 | 56 | -------------------------------------------------------------------------------- /evobot/fastlz/README.TXT: -------------------------------------------------------------------------------- 1 | FastLZ - lightning-fast lossless compression library 2 | 3 | Author: Ariya Hidayat 4 | Official website: http://www.fastlz.org 5 | 6 | FastLZ is distributed using the MIT license, see file LICENSE 7 | for details. 8 | 9 | FastLZ consists of two files: fastlz.h and fastlz.c. Just add these 10 | files to your project in order to use FastLZ. For information on 11 | compression and decompression routines, see fastlz.h. 12 | 13 | A simple file compressor called 6pack is included as an example 14 | on how to use FastLZ. The corresponding decompressor is 6unpack. 15 | 16 | To compile using GCC: 17 | 18 | gcc -o 6pack 6pack.c fastlz.c 19 | gcc -o 6unpack 6unpack.c fastlz.c 20 | 21 | To compile using MinGW: 22 | 23 | mingw32-gcc -o 6pack 6pack.c fastlz.c 24 | mingw32-gcc -o 6unpack 6unpack.c fastlz.c 25 | 26 | To compile using Microsoft Visual C++: 27 | 28 | cl 6pack.c fastlz.c 29 | cl 6unpack.c fastlz.c 30 | 31 | To compile using Borland C++: 32 | 33 | bcc32 6pack.c fastlz.c 34 | bcc32 6unpack.c fastlz.c 35 | 36 | To compile using OpenWatcom C/C++: 37 | 38 | cl386 6pack.c fastlz.c 39 | cl386 6unpack.c fastlz.c 40 | 41 | To compile using Intel C++ compiler for Windows: 42 | 43 | icl 6pack.c fastlz.c 44 | icl 6unpack.c fastlz.c 45 | 46 | To compile using Intel C++ compiler for Linux: 47 | 48 | icc -o 6pack 6pack.c fastlz.c 49 | icc -o 6unpack 6unpack.c fastlz.c 50 | 51 | To compile 6pack using LCC-Win32: 52 | 53 | lc 6pack.c fastlz.c 54 | lc 6unpack.c fastlz.c 55 | 56 | To compile 6pack using Pelles C: 57 | 58 | pocc 6pack.c 59 | pocc 6unpack.c 60 | pocc fastlz.c 61 | polink 6pack.obj fastlz.obj 62 | polink 6unpack.obj fastlz.obj 63 | 64 | For speed optimization, always use proper compile flags for optimization options. 65 | Typical compiler flags are given below: 66 | 67 | * GCC (pre 4.2): -march=pentium -O3 -fomit-frame-pointer -mtune=pentium 68 | * GCC 4.2 or later: -march=pentium -O3 -fomit-frame-pointer -mtune=generic 69 | * Digital Mars C/C++: -o+all -5 70 | * Intel C++ (Windows): /O3 /Qipo 71 | * Intel C++ (Linux): -O2 -march=pentium -mtune=pentium 72 | * Borland C++: -O2 -5 73 | * LCC-Win32: -O 74 | * Pelles C: /O2 75 | 76 | -------------------------------------------------------------------------------- /evobot/metamod/reg_support.h: -------------------------------------------------------------------------------- 1 | // vi: set ts=4 sw=4 : 2 | // vim: set tw=75 : 3 | 4 | // reg_support.h - functions for "registered" cmd/cvar/msg support 5 | 6 | /* 7 | * Copyright (c) 2001-2006 Will Day 8 | * 9 | * This file is part of Metamod. 10 | * 11 | * Metamod is free software; you can redistribute it and/or modify it 12 | * under the terms of the GNU General Public License as published by the 13 | * Free Software Foundation; either version 2 of the License, or (at 14 | * your option) any later version. 15 | * 16 | * Metamod is distributed in the hope that it will be useful, but 17 | * WITHOUT ANY WARRANTY; without even the implied warranty of 18 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 19 | * General Public License for more details. 20 | * 21 | * You should have received a copy of the GNU General Public License 22 | * along with Metamod; if not, write to the Free Software Foundation, 23 | * Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 24 | * 25 | * In addition, as a special exception, the author gives permission to 26 | * link the code of this program with the Half-Life Game Engine ("HL 27 | * Engine") and Modified Game Libraries ("MODs") developed by Valve, 28 | * L.L.C ("Valve"). You must obey the GNU General Public License in all 29 | * respects for all of the code used other than the HL Engine and MODs 30 | * from Valve. If you modify this file, you may extend this exception 31 | * to your version of the file, but you are not obligated to do so. If 32 | * you do not wish to do so, delete this exception statement from your 33 | * version. 34 | * 35 | */ 36 | 37 | #ifndef REG_SUPPORT_H 38 | #define REG_SUPPORT_H 39 | 40 | #include "mreg.h" // REG_CMD_FN, etc 41 | 42 | // these are only 'hidden' because called from outside (plugins and engine) 43 | void DLLHIDDEN meta_command_handler(void); 44 | void DLLHIDDEN meta_AddServerCommand(char *cmd_name, REG_CMD_FN function); 45 | void DLLHIDDEN meta_CVarRegister(cvar_t *pCvar); 46 | int DLLHIDDEN meta_RegUserMsg(const char *pszName, int iSize); 47 | void DLLHIDDEN meta_QueryClientCvarValue(const edict_t *player, const char *cvarName); 48 | 49 | #endif /* REG_SUPPORT_H */ 50 | -------------------------------------------------------------------------------- /evobot/HLSDK/dlls/extdll.h: -------------------------------------------------------------------------------- 1 | /*** 2 | * 3 | * Copyright (c) 1999, Valve LLC. All rights reserved. 4 | * 5 | * This product contains software technology licensed from Id 6 | * Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc. 7 | * All Rights Reserved. 8 | * 9 | * Use, distribution, and modification of this source code and/or resulting 10 | * object code is restricted to non-commercial enhancements to products from 11 | * Valve LLC. All other use, distribution, or modification is prohibited 12 | * without written permission from Valve LLC. 13 | * 14 | ****/ 15 | #ifndef EXTDLL_H 16 | #define EXTDLL_H 17 | 18 | 19 | // 20 | // Global header file for extension DLLs 21 | // 22 | 23 | // Allow "DEBUG" in addition to default "_DEBUG" 24 | #ifdef _DEBUG 25 | #define DEBUG 1 26 | #endif 27 | 28 | 29 | 30 | // Prevent tons of unused windows definitions 31 | #ifdef _WIN32 32 | #define WIN32_LEAN_AND_MEAN 33 | #define NOWINRES 34 | #define NOSERVICE 35 | #define NOMCX 36 | #define NOIME 37 | #include "windows.h" 38 | #else // _WIN32 39 | #define FALSE 0 40 | #define TRUE (!FALSE) 41 | typedef unsigned int ULONG; 42 | typedef unsigned char BYTE; 43 | typedef int BOOL; 44 | #define MAX_PATH PATH_MAX 45 | #include 46 | #include 47 | #ifndef min 48 | #define min(a,b) (((a) < (b)) ? (a) : (b)) 49 | #endif 50 | #ifndef max 51 | #define max(a,b) (((a) > (b)) ? (a) : (b)) 52 | #define _vsnprintf(a,b,c,d) vsnprintf(a,b,c,d) 53 | #endif 54 | #endif //_WIN32 55 | 56 | // Misc C-runtime library headers 57 | #include "stdio.h" 58 | #include "stdlib.h" 59 | #include "math.h" 60 | 61 | // Header file containing definition of globalvars_t and entvars_t 62 | typedef int func_t; // 63 | typedef int string_t; // from engine's pr_comp.h; 64 | typedef float vec_t; // needed before including progdefs.h 65 | 66 | // Vector class 67 | #include "vector.h" 68 | 69 | // Defining it as a (bogus) struct helps enforce type-checking 70 | #define vec3_t Vector 71 | 72 | // Shared engine/DLL constants 73 | #include "const.h" 74 | #include "progdefs.h" 75 | #include "edict.h" 76 | 77 | // Shared header describing protocol between engine and DLLs 78 | #include "eiface.h" 79 | 80 | // Shared header between the client DLL and the game DLLs 81 | #include "cdll_dll.h" 82 | 83 | #endif //EXTDLL_H 84 | -------------------------------------------------------------------------------- /evobot/src/bot_alien.h: -------------------------------------------------------------------------------- 1 | // 2 | // EvoBot - Neoptolemus' Natural Selection bot, based on Botman's HPB bot template 3 | // 4 | // bot_alien.h 5 | // 6 | // Contains all behaviour code for alien AI players 7 | // 8 | 9 | #pragma once 10 | 11 | #ifndef BOT_ALIEN_H 12 | #define BOT_ALIEN_H 13 | 14 | #include "bot_structs.h" 15 | 16 | 17 | void AlienThink(bot_t* pBot); 18 | void AlienCombatModeThink(bot_t* pBot); 19 | 20 | void AlienCheckWantsAndNeeds(bot_t* pBot); 21 | void AlienCheckCombatModeWantsAndNeeds(bot_t* pBot); 22 | 23 | int GetDesiredAlienUpgrade(const bot_t* pBot, const HiveTechStatus TechType); 24 | 25 | bool CanAlienSwitchRole(bot_t* pBot); 26 | BotRole AlienGetBestBotRole(bot_t* pBot); 27 | BotRole AlienGetBestCombatModeRole(const bot_t* pBot); 28 | 29 | bool IsHarasserRoleStillValid(bot_t* pBot); 30 | 31 | void BotAlienSetPrimaryTask(bot_t* pBot, bot_task* Task); 32 | void AlienCapperSetPrimaryTask(bot_t* pBot, bot_task* Task); 33 | void AlienHarasserSetPrimaryTask(bot_t* pBot, bot_task* Task); 34 | void AlienBuilderSetPrimaryTask(bot_t* pBot, bot_task* Task); 35 | void AlienDestroyerSetPrimaryTask(bot_t* pBot, bot_task* Task); 36 | 37 | void BotAlienSetCombatModePrimaryTask(bot_t* pBot, bot_task* Task); 38 | void AlienHarasserSetCombatModePrimaryTask(bot_t* pBot, bot_task* Task); 39 | void AlienBuilderSetCombatModePrimaryTask(bot_t* pBot, bot_task* Task); 40 | void AlienDestroyerSetCombatModePrimaryTask(bot_t* pBot, bot_task* Task); 41 | 42 | void BotAlienSetSecondaryTask(bot_t* pBot, bot_task* Task); 43 | void AlienSetCombatModeSecondaryTask(bot_t* pBot, bot_task* Task); 44 | void AlienBuilderSetSecondaryTask(bot_t* pBot, bot_task* Task); 45 | void AlienCapperSetSecondaryTask(bot_t* pBot, bot_task* Task); 46 | void AlienHarasserSetSecondaryTask(bot_t* pBot, bot_task* Task); 47 | void AlienDestroyerSetSecondaryTask(bot_t* pBot, bot_task* Task); 48 | 49 | void AlienCombatThink(bot_t* pBot); 50 | void SkulkCombatThink(bot_t* pBot); 51 | void GorgeCombatThink(bot_t* pBot); 52 | void LerkCombatThink(bot_t* pBot); 53 | void FadeCombatThink(bot_t* pBot); 54 | void OnosCombatThink(bot_t* pBot); 55 | 56 | int CalcNumAlienBuildersRequired(); 57 | 58 | CombatModeAlienUpgrade AlienGetNextCombatUpgrade(bot_t* pBot); 59 | 60 | bool IsAlienBuilderTaskNeeded(bot_t* pBot); 61 | bool IsAlienCapperTaskNeeded(); 62 | 63 | #endif -------------------------------------------------------------------------------- /evobot/metamod/game_support.h: -------------------------------------------------------------------------------- 1 | // vi: set ts=4 sw=4 : 2 | // vim: set tw=75 : 3 | 4 | // game_support.h - structures for supporting different HL mod "games" 5 | 6 | /* 7 | * Copyright (c) 2001-2006 Will Day 8 | * 9 | * This file is part of Metamod. 10 | * 11 | * Metamod is free software; you can redistribute it and/or modify it 12 | * under the terms of the GNU General Public License as published by the 13 | * Free Software Foundation; either version 2 of the License, or (at 14 | * your option) any later version. 15 | * 16 | * Metamod is distributed in the hope that it will be useful, but 17 | * WITHOUT ANY WARRANTY; without even the implied warranty of 18 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 19 | * General Public License for more details. 20 | * 21 | * You should have received a copy of the GNU General Public License 22 | * along with Metamod; if not, write to the Free Software Foundation, 23 | * Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 24 | * 25 | * In addition, as a special exception, the author gives permission to 26 | * link the code of this program with the Half-Life Game Engine ("HL 27 | * Engine") and Modified Game Libraries ("MODs") developed by Valve, 28 | * L.L.C ("Valve"). You must obey the GNU General Public License in all 29 | * respects for all of the code used other than the HL Engine and MODs 30 | * from Valve. If you modify this file, you may extend this exception 31 | * to your version of the file, but you are not obligated to do so. If 32 | * you do not wish to do so, delete this exception statement from your 33 | * version. 34 | * 35 | */ 36 | 37 | #ifndef GAME_SUPPORT_H 38 | #define GAME_SUPPORT_H 39 | 40 | #include "types_meta.h" // mBOOL 41 | #include "metamod.h" // gamedll_t 42 | 43 | // Information we have about each game/mod DLL. 44 | typedef struct game_modinfo_s { 45 | const char *name; // name (the game dir) 46 | const char *linux_so; // filename of linux shared lib 47 | const char *win_dll; // filename of win32 dll 48 | const char *desc; // our long-name description 49 | } game_modinfo_t; 50 | 51 | typedef game_modinfo_t game_modlist_t[]; 52 | 53 | const DLLINTERNAL game_modinfo_t *lookup_game(const char *name); 54 | mBOOL DLLINTERNAL setup_gamedll(gamedll_t *gamedll); 55 | 56 | #endif /* GAME_SUPPORT_H */ 57 | -------------------------------------------------------------------------------- /evobot/metamod/vers_meta.h: -------------------------------------------------------------------------------- 1 | // vi: set ts=4 sw=4 : 2 | // vim: set tw=75 : 3 | 4 | // vers_meta.h - version info, intended to be common among DLLs distributed 5 | // with metamod. 6 | 7 | /* 8 | * Copyright (c) 2001-2013 Will Day 9 | * 10 | * This file is part of Metamod. 11 | * 12 | * Metamod is free software; you can redistribute it and/or modify it 13 | * under the terms of the GNU General Public License as published by the 14 | * Free Software Foundation; either version 2 of the License, or (at 15 | * your option) any later version. 16 | * 17 | * Metamod is distributed in the hope that it will be useful, but 18 | * WITHOUT ANY WARRANTY; without even the implied warranty of 19 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 20 | * General Public License for more details. 21 | * 22 | * You should have received a copy of the GNU General Public License 23 | * along with Metamod; if not, write to the Free Software Foundation, 24 | * Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 25 | * 26 | * In addition, as a special exception, the author gives permission to 27 | * link the code of this program with the Half-Life Game Engine ("HL 28 | * Engine") and Modified Game Libraries ("MODs") developed by Valve, 29 | * L.L.C ("Valve"). You must obey the GNU General Public License in all 30 | * respects for all of the code used other than the HL Engine and MODs 31 | * from Valve. If you modify this file, you may extend this exception 32 | * to your version of the file, but you are not obligated to do so. If 33 | * you do not wish to do so, delete this exception statement from your 34 | * version. 35 | * 36 | */ 37 | 38 | #ifndef VERS_META_H 39 | #define VERS_META_H 40 | 41 | #ifndef OPT_TYPE 42 | #define OPT_TYPE "default" 43 | #endif /* not OPT_TYPE */ 44 | 45 | 46 | #define VDATE "2018/02/11" 47 | #define VPATCH_COPYRIGHT_YEAR "2018" 48 | #define VMETA_VERSION "1.21" 49 | 50 | #define VPATCH_NAME "Metamod-P (mm-p)" 51 | #define VPATCH_IVERSION 38 52 | #define VPATCH_VERSION "38" 53 | #define VPATCH_AUTHOR "Jussi Kivilinna" 54 | #define VPATCH_WEBSITE "http://metamod-p.sourceforge.net/" 55 | 56 | #define VVERSION VMETA_VERSION "p" VPATCH_VERSION 57 | #define RC_VERS_DWORD 1,21,0,VPATCH_IVERSION // Version Windows DLL Resources in res_meta.rc 58 | 59 | 60 | 61 | #endif /* VERS_META_H */ 62 | -------------------------------------------------------------------------------- /evobot/metamod/new_baseclass.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2004-2006 Jussi Kivilinna 3 | * 4 | * This file is part of "Metamod All-Mod-Support"-patch for Metamod. 5 | * 6 | * Metamod is free software; you can redistribute it and/or modify it 7 | * under the terms of the GNU General Public License as published by the 8 | * Free Software Foundation; either version 2 of the License, or (at 9 | * your option) any later version. 10 | * 11 | * Metamod is distributed in the hope that it will be useful, but 12 | * WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 | * General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with Metamod; if not, write to the Free Software Foundation, 18 | * Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 19 | * 20 | * In addition, as a special exception, the author gives permission to 21 | * link the code of this program with the Half-Life Game Engine ("HL 22 | * Engine") and Modified Game Libraries ("MODs") developed by Valve, 23 | * L.L.C ("Valve"). You must obey the GNU General Public License in all 24 | * respects for all of the code used other than the HL Engine and MODs 25 | * from Valve. If you modify this file, you may extend this exception 26 | * to your version of the file, but you are not obligated to do so. If 27 | * you do not wish to do so, delete this exception statement from your 28 | * version. 29 | * 30 | */ 31 | #ifndef METAMOD_NEW_BASECLASS_H 32 | #define METAMOD_NEW_BASECLASS_H 33 | 34 | #include 35 | 36 | #include "comp_dep.h" 37 | 38 | //new/delete operators with malloc/free to remove need for libstdc++ 39 | 40 | class class_metamod_new { 41 | public: 42 | // Construction 43 | class_metamod_new(void) { }; 44 | 45 | // Operators 46 | inline void * operator new(size_t size) { 47 | if(size==0) 48 | return(calloc(1, 1)); 49 | return(calloc(1, size)); 50 | } 51 | 52 | inline void * operator new[](size_t size) { 53 | if(size==0) 54 | return(calloc(1, 1)); 55 | return(calloc(1, size)); 56 | } 57 | 58 | inline void operator delete(void *ptr) { 59 | if(ptr) 60 | free(ptr); 61 | } 62 | 63 | inline void operator delete[](void *ptr) { 64 | if(ptr) 65 | free(ptr); 66 | } 67 | }; 68 | 69 | #endif /*METAMOD_NEW_BASECLASS_H*/ 70 | -------------------------------------------------------------------------------- /evobot/HLSDK/engine/progs.h: -------------------------------------------------------------------------------- 1 | /*** 2 | * 3 | * Copyright (c) 1996-2002, Valve LLC. All rights reserved. 4 | * 5 | * This product contains software technology licensed from Id 6 | * Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc. 7 | * All Rights Reserved. 8 | * 9 | * Use, distribution, and modification of this source code and/or resulting 10 | * object code is restricted to non-commercial enhancements to products from 11 | * Valve LLC. All other use, distribution, or modification is prohibited 12 | * without written permission from Valve LLC. 13 | * 14 | ****/ 15 | #ifndef PROGS_H 16 | #define PROGS_H 17 | 18 | #include "progdefs.h" 19 | 20 | // 16 simultaneous events, max 21 | #define MAX_EVENT_QUEUE 64 22 | 23 | #define DEFAULT_EVENT_RESENDS 1 24 | 25 | #include "event_flags.h" 26 | 27 | typedef struct event_info_s event_info_t; 28 | 29 | #include "event_args.h" 30 | 31 | struct event_info_s 32 | { 33 | unsigned short index; // 0 implies not in use 34 | 35 | short packet_index; // Use data from state info for entity in delta_packet . -1 implies separate info based on event 36 | // parameter signature 37 | short entity_index; // The edict this event is associated with 38 | 39 | float fire_time; // if non-zero, the time when the event should be fired ( fixed up on the client ) 40 | 41 | event_args_t args; 42 | 43 | // CLIENT ONLY 44 | int flags; // Reliable or not, etc. 45 | 46 | }; 47 | 48 | typedef struct event_state_s event_state_t; 49 | 50 | struct event_state_s 51 | { 52 | struct event_info_s ei[ MAX_EVENT_QUEUE ]; 53 | }; 54 | 55 | #if !defined( ENTITY_STATEH ) 56 | #include "entity_state.h" 57 | #endif 58 | 59 | #if !defined( EDICT_H ) 60 | #include "edict.h" 61 | #endif 62 | 63 | #define STRUCT_FROM_LINK(l,t,m) ((t *)((byte *)l - (int)&(((t *)0)->m))) 64 | #define EDICT_FROM_AREA(l) STRUCT_FROM_LINK(l,edict_t,area) 65 | 66 | //============================================================================ 67 | 68 | extern char *pr_strings; 69 | extern globalvars_t gGlobalVariables; 70 | 71 | //============================================================================ 72 | 73 | edict_t *ED_Alloc (void); 74 | void ED_Free (edict_t *ed); 75 | void ED_LoadFromFile (char *data); 76 | 77 | edict_t *EDICT_NUM(int n); 78 | int NUM_FOR_EDICT(const edict_t *e); 79 | 80 | #define PROG_TO_EDICT(e) ((edict_t *)((byte *)sv.edicts + e)) 81 | 82 | #endif // PROGS_H 83 | -------------------------------------------------------------------------------- /Detour/Include/DetourAssert.h: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) 2009-2010 Mikko Mononen memon@inside.org 3 | // 4 | // This software is provided 'as-is', without any express or implied 5 | // warranty. In no event will the authors be held liable for any damages 6 | // arising from the use of this software. 7 | // Permission is granted to anyone to use this software for any purpose, 8 | // including commercial applications, and to alter it and redistribute it 9 | // freely, subject to the following restrictions: 10 | // 1. The origin of this software must not be misrepresented; you must not 11 | // claim that you wrote the original software. If you use this software 12 | // in a product, an acknowledgment in the product documentation would be 13 | // appreciated but is not required. 14 | // 2. Altered source versions must be plainly marked as such, and must not be 15 | // misrepresented as being the original software. 16 | // 3. This notice may not be removed or altered from any source distribution. 17 | // 18 | 19 | #ifndef DETOURASSERT_H 20 | #define DETOURASSERT_H 21 | 22 | // Note: This header file's only purpose is to include define assert. 23 | // Feel free to change the file and include your own implementation instead. 24 | 25 | #ifdef NDEBUG 26 | 27 | // From http://cnicholson.net/2009/02/stupid-c-tricks-adventures-in-assert/ 28 | # define dtAssert(x) do { (void)sizeof(x); } while((void)(__LINE__==-1),false) 29 | 30 | #else 31 | 32 | /// An assertion failure function. 33 | // @param[in] expression asserted expression. 34 | // @param[in] file Filename of the failed assertion. 35 | // @param[in] line Line number of the failed assertion. 36 | /// @see dtAssertFailSetCustom 37 | typedef void (dtAssertFailFunc)(const char* expression, const char* file, int line); 38 | 39 | /// Sets the base custom assertion failure function to be used by Detour. 40 | /// @param[in] assertFailFunc The function to be invoked in case of failure of #dtAssert 41 | void dtAssertFailSetCustom(dtAssertFailFunc *assertFailFunc); 42 | 43 | /// Gets the base custom assertion failure function to be used by Detour. 44 | dtAssertFailFunc* dtAssertFailGetCustom(); 45 | 46 | # include 47 | # define dtAssert(expression) \ 48 | { \ 49 | dtAssertFailFunc* failFunc = dtAssertFailGetCustom(); \ 50 | if(failFunc == NULL) { assert(expression); } \ 51 | else if(!(expression)) { (*failFunc)(#expression, __FILE__, __LINE__); } \ 52 | } 53 | 54 | #endif 55 | 56 | #endif // DETOURASSERT_H 57 | -------------------------------------------------------------------------------- /evobot/HLSDK/common/event_api.h: -------------------------------------------------------------------------------- 1 | /*** 2 | * 3 | * Copyright (c) 1996-2002, Valve LLC. All rights reserved. 4 | * 5 | * This product contains software technology licensed from Id 6 | * Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc. 7 | * All Rights Reserved. 8 | * 9 | * Use, distribution, and modification of this source code and/or resulting 10 | * object code is restricted to non-commercial enhancements to products from 11 | * Valve LLC. All other use, distribution, or modification is prohibited 12 | * without written permission from Valve LLC. 13 | * 14 | ****/ 15 | #if !defined ( EVENT_APIH ) 16 | #define EVENT_APIH 17 | #ifdef _WIN32 18 | #ifndef __MINGW32__ 19 | #pragma once 20 | #endif /* not __MINGW32__ */ 21 | #endif 22 | 23 | #define EVENT_API_VERSION 1 24 | 25 | typedef struct event_api_s 26 | { 27 | int version; 28 | void ( *EV_PlaySound ) ( int ent, float *origin, int channel, const char *sample, float volume, float attenuation, int fFlags, int pitch ); 29 | void ( *EV_StopSound ) ( int ent, int channel, const char *sample ); 30 | int ( *EV_FindModelIndex )( const char *pmodel ); 31 | int ( *EV_IsLocal ) ( int playernum ); 32 | int ( *EV_LocalPlayerDucking ) ( void ); 33 | void ( *EV_LocalPlayerViewheight ) ( float * ); 34 | void ( *EV_LocalPlayerBounds ) ( int hull, float *mins, float *maxs ); 35 | int ( *EV_IndexFromTrace) ( struct pmtrace_s *pTrace ); 36 | struct physent_s *( *EV_GetPhysent ) ( int idx ); 37 | void ( *EV_SetUpPlayerPrediction ) ( int dopred, int bIncludeLocalClient ); 38 | void ( *EV_PushPMStates ) ( void ); 39 | void ( *EV_PopPMStates ) ( void ); 40 | void ( *EV_SetSolidPlayers ) (int playernum); 41 | void ( *EV_SetTraceHull ) ( int hull ); 42 | void ( *EV_PlayerTrace ) ( float *start, float *end, int traceFlags, int ignore_pe, struct pmtrace_s *tr ); 43 | void ( *EV_WeaponAnimation ) ( int sequence, int body ); 44 | unsigned short ( *EV_PrecacheEvent ) ( int type, const char* psz ); 45 | void ( *EV_PlaybackEvent ) ( int flags, const struct edict_s *pInvoker, unsigned short eventindex, float delay, float *origin, float *angles, float fparam1, float fparam2, int iparam1, int iparam2, int bparam1, int bparam2 ); 46 | const char *( *EV_TraceTexture ) ( int ground, float *vstart, float *vend ); 47 | void ( *EV_StopAllSounds ) ( int entnum, int entchannel ); 48 | void ( *EV_KillEvents ) ( int entnum, const char *eventname ); 49 | } event_api_t; 50 | 51 | extern event_api_t eventapi; 52 | 53 | #endif 54 | -------------------------------------------------------------------------------- /evobot/src/sdk_util.cpp: -------------------------------------------------------------------------------- 1 | // vi: set ts=4 sw=4 : 2 | // vim: set tw=75 : 3 | 4 | // Selected portions of dlls/util.cpp from SDK 2.1. 5 | // Functions copied from there as needed... 6 | // And modified to avoid buffer overflows (argh). 7 | 8 | /*** 9 | * 10 | * Copyright (c) 1999, 2000 Valve LLC. All rights reserved. 11 | * 12 | * This product contains software technology licensed from Id 13 | * Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc. 14 | * All Rights Reserved. 15 | * 16 | * Use, distribution, and modification of this source code and/or resulting 17 | * object code is restricted to non-commercial enhancements to products from 18 | * Valve LLC. All other use, distribution, or modification is prohibited 19 | * without written permission from Valve LLC. 20 | * 21 | ****/ 22 | /* 23 | 24 | ===== util.cpp ======================================================== 25 | 26 | Utility code. Really not optional after all. 27 | 28 | */ 29 | 30 | #include 31 | #include 32 | #include // ALERT() 33 | 34 | #include "osdep.h" // win32 vsnprintf, etc 35 | 36 | //========================================================= 37 | // UTIL_LogPrintf - Prints a logged message to console. 38 | // Preceded by LOG: ( timestamp ) < message > 39 | //========================================================= 40 | void UTIL_LogPrintf( char *fmt, ... ) 41 | { 42 | va_list argptr; 43 | static char string[1024]; 44 | 45 | va_start ( argptr, fmt ); 46 | vsnprintf ( string, sizeof(string), fmt, argptr ); 47 | va_end ( argptr ); 48 | 49 | // Print to server console 50 | ALERT( at_logged, "%s", string ); 51 | } 52 | 53 | // Overloaded to add IGNORE_GLASS 54 | void UTIL_TraceLine(const Vector& vecStart, const Vector& vecEnd, IGNORE_MONSTERS igmon, IGNORE_GLASS ignoreGlass, edict_t* pentIgnore, TraceResult* ptr) 55 | { 56 | TRACE_LINE(vecStart, vecEnd, (igmon == ignore_monsters ? 1 : 0) | (ignoreGlass ? 0x100 : 0), pentIgnore, ptr); 57 | } 58 | 59 | void UTIL_TraceLine(const Vector& vecStart, const Vector& vecEnd, IGNORE_MONSTERS igmon, edict_t* pentIgnore, TraceResult* ptr) 60 | { 61 | TRACE_LINE(vecStart, vecEnd, (igmon == ignore_monsters ? 1 : 0), pentIgnore, ptr); 62 | } 63 | 64 | void UTIL_TraceHull(const Vector& vecStart, const Vector& vecEnd, IGNORE_MONSTERS igmon, int HullNum, edict_t* pentIgnore, TraceResult* ptr) 65 | { 66 | TRACE_HULL(vecStart, vecEnd, (igmon == ignore_monsters ? 1 : 0), HullNum, pentIgnore, ptr); 67 | } -------------------------------------------------------------------------------- /evobot/src/bot_weapons.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #ifndef BOT_WEAPONS_H 4 | #define BOT_WEAPONS_H 5 | 6 | #include "bot_structs.h" 7 | 8 | int BotGetCurrentWeaponClipAmmo(const bot_t* pBot); 9 | int BotGetCurrentWeaponMaxClipAmmo(const bot_t* pBot); 10 | int BotGetCurrentWeaponReserveAmmo(const bot_t* pBot); 11 | NSWeapon GetBotCurrentWeapon(const bot_t* pBot); 12 | 13 | NSWeapon GetBotPrimaryWeapon(const bot_t* pBot); 14 | 15 | NSWeapon GetBotMarinePrimaryWeapon(const bot_t* pBot); 16 | int BotGetPrimaryWeaponClipAmmo(const bot_t* pBot); 17 | int BotGetPrimaryWeaponMaxClipSize(const bot_t* pBot); 18 | int BotGetPrimaryWeaponAmmoReserve(bot_t* pBot); 19 | int BotGetPrimaryWeaponMaxAmmoReserve(bot_t* pBot); 20 | 21 | NSWeapon GetBotMarineSecondaryWeapon(const bot_t* pBot); 22 | int BotGetSecondaryWeaponClipAmmo(const bot_t* pBot); 23 | int BotGetSecondaryWeaponMaxClipSize(const bot_t* pBot); 24 | int BotGetSecondaryWeaponAmmoReserve(bot_t* pBot); 25 | int BotGetSecondaryWeaponMaxAmmoReserve(bot_t* pBot); 26 | 27 | NSWeapon GetBotAlienPrimaryWeapon(const bot_t* pBot); 28 | 29 | float GetEnergyCostForWeapon(const NSWeapon Weapon); 30 | float UTIL_GetProjectileVelocityForWeapon(const NSWeapon Weapon); 31 | 32 | float GetMaxIdealWeaponRange(const NSWeapon Weapon); 33 | float GetMinIdealWeaponRange(const NSWeapon Weapon); 34 | 35 | bool WeaponCanBeReloaded(const NSWeapon CheckWeapon); 36 | bool IsMeleeWeapon(const NSWeapon Weapon); 37 | 38 | Vector UTIL_GetGrenadeThrowTarget(edict_t* Player, const Vector TargetLocation, const float ExplosionRadius, bool bPrecise); 39 | 40 | NSWeapon BotMarineChooseBestWeaponForStructure(bot_t* pBot, edict_t* target); 41 | NSWeapon BotAlienChooseBestWeaponForStructure(bot_t* pBot, edict_t* target); 42 | 43 | // Helper function to pick the best weapon for any given situation and target type. 44 | NSWeapon BotMarineChooseBestWeapon(bot_t* pBot, edict_t* target); 45 | 46 | NSWeapon FadeGetBestWeaponForCombatTarget(bot_t* pBot, edict_t* Target); 47 | NSWeapon OnosGetBestWeaponForCombatTarget(bot_t* pBot, edict_t* Target); 48 | NSWeapon SkulkGetBestWeaponForCombatTarget(bot_t* pBot, edict_t* Target); 49 | NSWeapon GorgeGetBestWeaponForCombatTarget(bot_t* pBot, edict_t* Target); 50 | NSWeapon LerkGetBestWeaponForCombatTarget(bot_t* pBot, edict_t* Target); 51 | 52 | float GetReloadTimeForWeapon(NSWeapon Weapon); 53 | 54 | bool CanInterruptWeaponReload(NSWeapon Weapon); 55 | 56 | void InterruptReload(bot_t* pBot); 57 | 58 | bool IsHitscanWeapon(NSWeapon Weapon); 59 | 60 | #endif -------------------------------------------------------------------------------- /evobot/src/bot_marine.h: -------------------------------------------------------------------------------- 1 | // 2 | // EvoBot - Neoptolemus' Natural Selection bot, based on Botman's HPB bot template 3 | // 4 | // bot_gorge.h 5 | // 6 | // Contains gorge-related functions. Needs refactoring into helper function file 7 | // 8 | 9 | #pragma once 10 | 11 | #ifndef BOT_MARINE_H 12 | #define BOT_MARINE_H 13 | 14 | #include "bot_structs.h" 15 | 16 | void MarineThink(bot_t* pBot); 17 | void MarineCombatModeThink(bot_t* pBot); 18 | 19 | bool MarineCombatThink(bot_t* pBot); 20 | void MarineBombardierCombatThink(bot_t* pBot); 21 | void MarineHuntEnemy(bot_t* pBot, enemy_status* TrackedEnemy); 22 | 23 | 24 | 25 | void MarineCheckWantsAndNeeds(bot_t* pBot); 26 | void MarineCombatModeCheckWantsAndNeeds(bot_t* pBot); 27 | 28 | void MarineSetSecondaryTask(bot_t* pBot, bot_task* Task); 29 | void MarineSetCombatModeSecondaryTask(bot_t* pBot, bot_task* Task); 30 | 31 | void MarineSweeperSetPrimaryTask(bot_t* pBot, bot_task* Task); 32 | void MarineCapperSetPrimaryTask(bot_t* pBot, bot_task* Task); 33 | void MarineAssaultSetPrimaryTask(bot_t* pBot, bot_task* Task); 34 | void MarineBombardierSetPrimaryTask(bot_t* pBot, bot_task* Task); 35 | 36 | void MarineSweeperSetCombatModePrimaryTask(bot_t* pBot, bot_task* Task); 37 | void MarineAssaultSetCombatModePrimaryTask(bot_t* pBot, bot_task* Task); 38 | 39 | void MarineSweeperSetSecondaryTask(bot_t* pBot, bot_task* Task); 40 | void MarineCapperSetSecondaryTask(bot_t* pBot, bot_task* Task); 41 | void MarineAssaultSetSecondaryTask(bot_t* pBot, bot_task* Task); 42 | 43 | // Determines the individual bot's most appropriate role at this moment based on the state of play. 44 | BotRole MarineGetBestBotRole(const bot_t* pBot); 45 | BotRole MarineGetBestCombatModeRole(const bot_t* pBot); 46 | 47 | void BotMarineSetPrimaryTask(bot_t* pBot, bot_task* Task); 48 | void BotMarineSetCombatModePrimaryTask(bot_t* pBot, bot_task* Task); 49 | 50 | void BotReceiveCommanderOrder(bot_t* pBot, AvHOrderType orderType, AvHUser3 TargetType, Vector destination); 51 | void BotReceiveMoveToOrder(bot_t* pBot, Vector destination); 52 | void BotReceiveBuildOrder(bot_t* pBot, AvHUser3 TargetType, Vector destination); 53 | void BotReceiveAttackOrder(bot_t* pBot, AvHUser3 TargetType, Vector destination); 54 | void BotReceiveGuardOrder(bot_t* pBot, AvHUser3 TargetType, Vector destination); 55 | void BotReceiveWeldOrder(bot_t* pBot, AvHUser3 TargetType, Vector destination); 56 | 57 | // Sets the bot's next desired combat upgrade to get / save for 58 | CombatModeMarineUpgrade MarineGetNextCombatUpgrade(bot_t* pBot); 59 | 60 | #endif -------------------------------------------------------------------------------- /evobot/metamod/ret_type.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2004-2006 Jussi Kivilinna 3 | * 4 | * This file is part of "Metamod All-Mod-Support"-patch for Metamod. 5 | * 6 | * Metamod is free software; you can redistribute it and/or modify it 7 | * under the terms of the GNU General Public License as published by the 8 | * Free Software Foundation; either version 2 of the License, or (at 9 | * your option) any later version. 10 | * 11 | * Metamod is distributed in the hope that it will be useful, but 12 | * WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 | * General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with Metamod; if not, write to the Free Software Foundation, 18 | * Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 19 | * 20 | * In addition, as a special exception, the author gives permission to 21 | * link the code of this program with the Half-Life Game Engine ("HL 22 | * Engine") and Modified Game Libraries ("MODs") developed by Valve, 23 | * L.L.C ("Valve"). You must obey the GNU General Public License in all 24 | * respects for all of the code used other than the HL Engine and MODs 25 | * from Valve. If you modify this file, you may extend this exception 26 | * to your version of the file, but you are not obligated to do so. If 27 | * you do not wish to do so, delete this exception statement from your 28 | * version. 29 | * 30 | */ 31 | #ifndef RET_TYPE_H 32 | #define RET_TYPE_H 33 | 34 | #include "new_baseclass.h" 35 | 36 | class class_ret_t : public class_metamod_new { 37 | public: 38 | // Construction 39 | inline class_ret_t(void) { }; 40 | inline class_ret_t(float f) { data.f = f; }; 41 | inline class_ret_t(void * p) { data.p = p; }; 42 | inline class_ret_t(const char * pc) { data.pc = pc; }; 43 | inline class_ret_t(int i) { data.i = i; }; 44 | inline class_ret_t(short s) { data.i = s; }; 45 | inline class_ret_t(char c) { data.i = c; }; 46 | inline class_ret_t(unsigned int ui) { data.ui = ui; }; 47 | inline class_ret_t(unsigned long ui) { data.ui = ui; }; 48 | inline class_ret_t(unsigned short us) { data.ui = us; }; 49 | inline class_ret_t(unsigned char uc) { data.ui = uc; }; 50 | 51 | // Reading/Writing 52 | inline void * getptr(void) { return(&data); }; 53 | 54 | #define SET_RET_CLASS(ret,type,x) \ 55 | *(type*)((ret).getptr()) = (type)(x) 56 | #define GET_RET_CLASS(ret,type) \ 57 | (*(type*)((ret).getptr())) 58 | private: 59 | //Data (select data size of largest type) (x86: 32bit, x86_64: 64bit) 60 | union { 61 | void * p; 62 | const char * pc; 63 | float f; 64 | long i; 65 | unsigned long ui; 66 | } data; 67 | }; 68 | 69 | #endif /*RET_TYPE_H*/ 70 | -------------------------------------------------------------------------------- /evobot/metamod/osdep_p.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2004-2006 Jussi Kivilinna 3 | * 4 | * This file is part of "Metamod All-Mod-Support"-patch for Metamod. 5 | * 6 | * Metamod is free software; you can redistribute it and/or modify it 7 | * under the terms of the GNU General Public License as published by the 8 | * Free Software Foundation; either version 2 of the License, or (at 9 | * your option) any later version. 10 | * 11 | * Metamod is distributed in the hope that it will be useful, but 12 | * WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 | * General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with Metamod; if not, write to the Free Software Foundation, 18 | * Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 19 | * 20 | * In addition, as a special exception, the author gives permission to 21 | * link the code of this program with the Half-Life Game Engine ("HL 22 | * Engine") and Modified Game Libraries ("MODs") developed by Valve, 23 | * L.L.C ("Valve"). You must obey the GNU General Public License in all 24 | * respects for all of the code used other than the HL Engine and MODs 25 | * from Valve. If you modify this file, you may extend this exception 26 | * to your version of the file, but you are not obligated to do so. If 27 | * you do not wish to do so, delete this exception statement from your 28 | * version. 29 | * 30 | */ 31 | 32 | #ifndef OSDEP_P_H 33 | #define OSDEP_P_H 34 | 35 | #include "types_meta.h" // mBOOL 36 | #include "osdep.h" // PATH_MAX 37 | 38 | // Checks if file is hlsdk api game dll 39 | // (osdep_detect_gamedll_linux.cpp and osdep_detect_gamedll_win32.cpp) 40 | // --Jussi Kivilinna 41 | mBOOL DLLINTERNAL is_gamedll(const char *filename); 42 | 43 | // MSVC doesn't provide opendir/readdir/closedir, so we write our own. 44 | // --Jussi Kivilinna 45 | #ifdef _WIN32 46 | struct my_dirent { 47 | char d_name[PATH_MAX]; 48 | }; 49 | typedef struct { 50 | HANDLE handle; 51 | WIN32_FIND_DATAA find_data; 52 | struct my_dirent ent; 53 | int not_found; 54 | } my_DIR; 55 | 56 | #define dirent my_dirent 57 | #define DIR my_DIR 58 | 59 | DIR * DLLINTERNAL my_opendir(const char *); 60 | struct dirent * DLLINTERNAL my_readdir(DIR *); 61 | void DLLINTERNAL my_closedir(DIR *); 62 | 63 | #define opendir(x) my_opendir(x) 64 | #define readdir(x) my_readdir(x) 65 | #define closedir(x) my_closedir(x) 66 | #else 67 | #include 68 | #endif /* _WIN32 */ 69 | 70 | DLHANDLE DLLINTERNAL get_module_handle_of_memptr(void * memptr); 71 | 72 | #ifdef linux 73 | void * DLLINTERNAL get_dlsym_pointer(void); 74 | #endif 75 | 76 | #endif /* OSDEP_P_H */ 77 | -------------------------------------------------------------------------------- /Detour/Include/DetourAlloc.h: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) 2009-2010 Mikko Mononen memon@inside.org 3 | // 4 | // This software is provided 'as-is', without any express or implied 5 | // warranty. In no event will the authors be held liable for any damages 6 | // arising from the use of this software. 7 | // Permission is granted to anyone to use this software for any purpose, 8 | // including commercial applications, and to alter it and redistribute it 9 | // freely, subject to the following restrictions: 10 | // 1. The origin of this software must not be misrepresented; you must not 11 | // claim that you wrote the original software. If you use this software 12 | // in a product, an acknowledgment in the product documentation would be 13 | // appreciated but is not required. 14 | // 2. Altered source versions must be plainly marked as such, and must not be 15 | // misrepresented as being the original software. 16 | // 3. This notice may not be removed or altered from any source distribution. 17 | // 18 | 19 | #ifndef DETOURALLOCATOR_H 20 | #define DETOURALLOCATOR_H 21 | 22 | #include 23 | 24 | /// Provides hint values to the memory allocator on how long the 25 | /// memory is expected to be used. 26 | enum dtAllocHint 27 | { 28 | DT_ALLOC_PERM, ///< Memory persist after a function call. 29 | DT_ALLOC_TEMP ///< Memory used temporarily within a function. 30 | }; 31 | 32 | /// A memory allocation function. 33 | // @param[in] size The size, in bytes of memory, to allocate. 34 | // @param[in] rcAllocHint A hint to the allocator on how long the memory is expected to be in use. 35 | // @return A pointer to the beginning of the allocated memory block, or null if the allocation failed. 36 | /// @see dtAllocSetCustom 37 | typedef void* (dtAllocFunc)(size_t size, dtAllocHint hint); 38 | 39 | /// A memory deallocation function. 40 | /// @param[in] ptr A pointer to a memory block previously allocated using #dtAllocFunc. 41 | /// @see dtAllocSetCustom 42 | typedef void (dtFreeFunc)(void* ptr); 43 | 44 | /// Sets the base custom allocation functions to be used by Detour. 45 | /// @param[in] allocFunc The memory allocation function to be used by #dtAlloc 46 | /// @param[in] freeFunc The memory de-allocation function to be used by #dtFree 47 | void dtAllocSetCustom(dtAllocFunc *allocFunc, dtFreeFunc *freeFunc); 48 | 49 | /// Allocates a memory block. 50 | /// @param[in] size The size, in bytes of memory, to allocate. 51 | /// @param[in] hint A hint to the allocator on how long the memory is expected to be in use. 52 | /// @return A pointer to the beginning of the allocated memory block, or null if the allocation failed. 53 | /// @see dtFree 54 | void* dtAlloc(size_t size, dtAllocHint hint); 55 | 56 | /// Deallocates a memory block. 57 | /// @param[in] ptr A pointer to a memory block previously allocated using #dtAlloc. 58 | /// @see dtAlloc 59 | void dtFree(void* ptr); 60 | 61 | #endif 62 | -------------------------------------------------------------------------------- /CMakePresets.json: -------------------------------------------------------------------------------- 1 | { 2 | "version": 3, 3 | "configurePresets": [ 4 | { 5 | "name": "windows-base", 6 | "hidden": true, 7 | "generator": "Ninja", 8 | "binaryDir": "${sourceDir}/out/build/${presetName}", 9 | "installDir": "${sourceDir}/out/install/${presetName}", 10 | "cacheVariables": { 11 | "CMAKE_C_COMPILER": "cl.exe", 12 | "CMAKE_CXX_COMPILER": "cl.exe" 13 | }, 14 | "condition": { 15 | "type": "equals", 16 | "lhs": "${hostSystemName}", 17 | "rhs": "Windows" 18 | } 19 | }, 20 | { 21 | "name": "x86-debug", 22 | "displayName": "x86 Debug", 23 | "inherits": "windows-base", 24 | "architecture": { 25 | "value": "x86", 26 | "strategy": "external" 27 | }, 28 | "cacheVariables": { 29 | "CMAKE_BUILD_TYPE": "Debug" 30 | } 31 | }, 32 | { 33 | "name": "x86-release", 34 | "displayName": "x86 Release", 35 | "inherits": "x86-debug", 36 | "cacheVariables": { 37 | "CMAKE_BUILD_TYPE": "Release" 38 | } 39 | }, 40 | { 41 | "name": "linux-debug", 42 | "displayName": "Linux Debug", 43 | "generator": "Ninja", 44 | "binaryDir": "${sourceDir}/out/build/${presetName}", 45 | "installDir": "${sourceDir}/out/install/${presetName}", 46 | "cacheVariables": { 47 | "CMAKE_BUILD_TYPE": "Debug" 48 | }, 49 | "condition": { 50 | "type": "equals", 51 | "lhs": "${hostSystemName}", 52 | "rhs": "Linux" 53 | }, 54 | "vendor": { 55 | "microsoft.com/VisualStudioRemoteSettings/CMake/1.0": { 56 | "sourceDir": "$env{HOME}/.vs/$ms{projectDirName}" 57 | } 58 | } 59 | }, 60 | { 61 | "name": "linux-release", 62 | "displayName": "Linux Release", 63 | "generator": "Ninja", 64 | "binaryDir": "${sourceDir}/out/build/${presetName}", 65 | "installDir": "${sourceDir}/out/install/${presetName}", 66 | "cacheVariables": { 67 | "CMAKE_BUILD_TYPE": "Release" 68 | }, 69 | "condition": { 70 | "type": "equals", 71 | "lhs": "${hostSystemName}", 72 | "rhs": "Linux" 73 | }, 74 | "vendor": { 75 | "microsoft.com/VisualStudioRemoteSettings/CMake/1.0": { 76 | "sourceDir": "$env{HOME}/.vs/$ms{projectDirName}" 77 | } 78 | } 79 | } 80 | ] 81 | } 82 | -------------------------------------------------------------------------------- /.github/workflows/build-on-push.yml: -------------------------------------------------------------------------------- 1 | name: Build on Push 2 | 3 | # Workflow is triggered when a push is made to ANY branch or on pull request open/reopen! 4 | on: 5 | push: 6 | pull_request: 7 | types: [opened, reopened] 8 | 9 | jobs: 10 | build_main: 11 | name: Build for ${{ matrix.os_short }} (${{ matrix.type }}) 12 | runs-on: ${{ matrix.os }} 13 | 14 | strategy: 15 | fail-fast: false 16 | matrix: 17 | os: 18 | - ubuntu-20.04 19 | - ubuntu-latest 20 | - windows-latest 21 | type: [ optimized, debug ] 22 | include: 23 | - os: ubuntu-latest 24 | os_short: linux-latest 25 | binary_ext: so 26 | debug_ext: dbg 27 | cc: clang-14 28 | cxx: clang++-14 29 | 30 | - os: ubuntu-20.04 31 | os_short: linux-old 32 | binary_ext: so 33 | debug_ext: dbg 34 | cc: clang-9 35 | cxx: clang++-9 36 | 37 | - os: windows-latest 38 | os_short: windows-latest 39 | binary_ext: dll 40 | debug_ext: pdb 41 | cc: not-used 42 | cxx: not-used 43 | - type: optimized 44 | ambuild_params: "--enable-optimize --symbol-files" 45 | - type: debug 46 | ambuild_params: "--enable-debug" 47 | 48 | steps: 49 | - name: Install (Linux) 50 | if: runner.os == 'Linux' 51 | run: | 52 | sudo dpkg --add-architecture i386 53 | sudo apt-get update 54 | sudo apt-get install -y ${{ matrix.cc }} ${{ matrix.cxx }} g++-multilib 55 | echo "CC=${{ matrix.cc }}" >> $GITHUB_ENV 56 | echo "CXX=${{ matrix.cxx }}" >> $GITHUB_ENV 57 | 58 | - name: Setup MSBuild (Windows) 59 | if: runner.os == 'Windows' 60 | uses: microsoft/setup-msbuild@v1.3.1 61 | 62 | - name: Setup Python 63 | uses: actions/setup-python@v4.7.0 64 | with: 65 | python-version: '3.11' 66 | 67 | - name: Setup ambuild 68 | run: | 69 | python -m pip install wheel 70 | pip install git+https://github.com/alliedmodders/ambuild 71 | 72 | - name: Fetch Evobot MM 73 | uses: actions/checkout@v3.6.0 74 | with: 75 | path: evobot_mm 76 | 77 | - name: Build Files 78 | working-directory: evobot_mm 79 | run: | 80 | mkdir build 81 | cd build 82 | python3 ../configure.py ${{ matrix.ambuild_params }} 83 | ambuild 84 | 85 | - uses: benjlevesque/short-sha@v2.2 86 | id: short-sha 87 | 88 | - name: Upload Build Artifacts 89 | uses: actions/upload-artifact@v3.1.2 90 | with: 91 | name: evobot_mm-${{ matrix.os_short }}-${{ matrix.type }}-${{ steps.short-sha.outputs.sha }} 92 | path: | 93 | evobot_mm/build/**/*.${{ matrix.binary_ext }} 94 | evobot_mm/build/**/*.${{ matrix.debug_ext }} 95 | -------------------------------------------------------------------------------- /Detour/Include/DetourStatus.h: -------------------------------------------------------------------------------- 1 | // 2 | // Copyright (c) 2009-2010 Mikko Mononen memon@inside.org 3 | // 4 | // This software is provided 'as-is', without any express or implied 5 | // warranty. In no event will the authors be held liable for any damages 6 | // arising from the use of this software. 7 | // Permission is granted to anyone to use this software for any purpose, 8 | // including commercial applications, and to alter it and redistribute it 9 | // freely, subject to the following restrictions: 10 | // 1. The origin of this software must not be misrepresented; you must not 11 | // claim that you wrote the original software. If you use this software 12 | // in a product, an acknowledgment in the product documentation would be 13 | // appreciated but is not required. 14 | // 2. Altered source versions must be plainly marked as such, and must not be 15 | // misrepresented as being the original software. 16 | // 3. This notice may not be removed or altered from any source distribution. 17 | // 18 | 19 | #ifndef DETOURSTATUS_H 20 | #define DETOURSTATUS_H 21 | 22 | typedef unsigned int dtStatus; 23 | 24 | // High level status. 25 | static const unsigned int DT_FAILURE = 1u << 31; // Operation failed. 26 | static const unsigned int DT_SUCCESS = 1u << 30; // Operation succeed. 27 | static const unsigned int DT_IN_PROGRESS = 1u << 29; // Operation still in progress. 28 | 29 | // Detail information for status. 30 | static const unsigned int DT_STATUS_DETAIL_MASK = 0x0ffffff; 31 | static const unsigned int DT_WRONG_MAGIC = 1 << 0; // Input data is not recognized. 32 | static const unsigned int DT_WRONG_VERSION = 1 << 1; // Input data is in wrong version. 33 | static const unsigned int DT_OUT_OF_MEMORY = 1 << 2; // Operation ran out of memory. 34 | static const unsigned int DT_INVALID_PARAM = 1 << 3; // An input parameter was invalid. 35 | static const unsigned int DT_BUFFER_TOO_SMALL = 1 << 4; // Result buffer for the query was too small to store all results. 36 | static const unsigned int DT_OUT_OF_NODES = 1 << 5; // Query ran out of nodes during search. 37 | static const unsigned int DT_PARTIAL_RESULT = 1 << 6; // Query did not reach the end location, returning best guess. 38 | static const unsigned int DT_ALREADY_OCCUPIED = 1 << 7; // A tile has already been assigned to the given x,y coordinate 39 | 40 | 41 | // Returns true of status is success. 42 | inline bool dtStatusSucceed(dtStatus status) 43 | { 44 | return (status & DT_SUCCESS) != 0; 45 | } 46 | 47 | // Returns true of status is failure. 48 | inline bool dtStatusFailed(dtStatus status) 49 | { 50 | return (status & DT_FAILURE) != 0; 51 | } 52 | 53 | // Returns true of status is in progress. 54 | inline bool dtStatusInProgress(dtStatus status) 55 | { 56 | return (status & DT_IN_PROGRESS) != 0; 57 | } 58 | 59 | // Returns true if specific detail is set. 60 | inline bool dtStatusDetail(dtStatus status, unsigned int detail) 61 | { 62 | return (status & detail) != 0; 63 | } 64 | 65 | #endif // DETOURSTATUS_H 66 | -------------------------------------------------------------------------------- /evobot/metamod/engine_t.h: -------------------------------------------------------------------------------- 1 | // vi: set ts=4 sw=4 : 2 | // vim: set tw=75 : 3 | 4 | // engine_t.h - The engine_t type 5 | 6 | /* 7 | * Copyright (c) 2001-2006 Will Day 8 | * 9 | * This file is part of Metamod. 10 | * 11 | * Metamod is free software; you can redistribute it and/or modify it 12 | * under the terms of the GNU General Public License as published by the 13 | * Free Software Foundation; either version 2 of the License, or (at 14 | * your option) any later version. 15 | * 16 | * Metamod is distributed in the hope that it will be useful, but 17 | * WITHOUT ANY WARRANTY; without even the implied warranty of 18 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 19 | * General Public License for more details. 20 | * 21 | * You should have received a copy of the GNU General Public License 22 | * along with Metamod; if not, write to the Free Software Foundation, 23 | * Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 24 | * 25 | * In addition, as a special exception, the author gives permission to 26 | * link the code of this program with the Half-Life Game Engine ("HL 27 | * Engine") and Modified Game Libraries ("MODs") developed by Valve, 28 | * L.L.C ("Valve"). You must obey the GNU General Public License in all 29 | * respects for all of the code used other than the HL Engine and MODs 30 | * from Valve. If you modify this file, you may extend this exception 31 | * to your version of the file, but you are not obligated to do so. If 32 | * you do not wish to do so, delete this exception statement from your 33 | * version. 34 | * 35 | */ 36 | 37 | #ifndef MM_ENGINE_T_H 38 | #define MM_ENGINE_T_H 39 | 40 | #include "eiface.h" // engfuncs_t, globalvars_t 41 | #include "engineinfo.h" // EngineInfo 42 | #include "comp_dep.h" 43 | #include "osdep.h" //unlikely, OPEN_ARGS 44 | 45 | // Our structure for storing engine references. 46 | struct engine_t { 47 | engine_t() DLLINTERNAL; 48 | engine_t(const engine_t&) DLLINTERNAL; 49 | engine_t& operator=(const engine_t&) DLLINTERNAL; 50 | 51 | enginefuncs_t *funcs; // engine funcs 52 | globalvars_t *globals; // engine globals 53 | enginefuncs_t *pl_funcs; // "modified" eng funcs we give to plugins 54 | EngineInfo info; // some special info elements 55 | }; 56 | 57 | inline engine_t::engine_t() 58 | : funcs(NULL), globals(NULL), pl_funcs(NULL), info() 59 | { 60 | } 61 | 62 | 63 | inline engine_t::engine_t(const engine_t& _rhs) 64 | : funcs(_rhs.funcs), globals(_rhs.globals), pl_funcs(_rhs.pl_funcs), info(_rhs.info) 65 | { 66 | } 67 | 68 | 69 | inline engine_t& engine_t::operator=(const engine_t& _rhs) 70 | { 71 | funcs = _rhs.funcs; 72 | globals = _rhs.globals; 73 | pl_funcs = _rhs.pl_funcs; 74 | info = _rhs.info; 75 | return *this; 76 | } 77 | 78 | 79 | extern engine_t Engine DLLHIDDEN; 80 | 81 | #endif /* MM_ENGINE_T_H */ 82 | 83 | -------------------------------------------------------------------------------- /evobot/src/bot_bsp.cpp: -------------------------------------------------------------------------------- 1 | // 2 | // EvoBot - Neoptolemus' Natural Selection bot, based on Botman's HPB bot template 3 | // 4 | // bot_bsp.cpp 5 | // 6 | // Handles parsing of BSP files for useful info that cannot be obtained from within the game 7 | // 8 | 9 | #include "bot_bsp.h" 10 | #include "general_util.h" 11 | #include "bot_navigation.h" 12 | 13 | #include 14 | #include 15 | 16 | void BSP_RegisterWeldables() 17 | { 18 | char filename[256]; // Full path to BSP file 19 | 20 | UTIL_BuildFileName(filename, "maps", STRING(gpGlobals->mapname), NULL, NULL); 21 | strcat(filename, ".bsp"); 22 | 23 | FILE* bspfile = fopen(filename, "rb"); 24 | 25 | if (!bspfile) 26 | { 27 | return; 28 | } 29 | 30 | BSPHEADER fileHeader; // The BSP file header 31 | 32 | fread(&fileHeader, sizeof(fileHeader), 1, bspfile); 33 | 34 | int entitiesLength = fileHeader.lump[LUMP_ENTITIES].nLength; 35 | 36 | char* entitiesText = (char*)malloc(entitiesLength); 37 | 38 | if (!entitiesText) { return; } 39 | 40 | memset(entitiesText, 0, entitiesLength); 41 | 42 | fseek(bspfile, fileHeader.lump[LUMP_ENTITIES].nOffset, SEEK_SET); 43 | fread(entitiesText, entitiesLength, 1, bspfile); 44 | 45 | // First count how many entities we have 46 | int nEntities = 0; 47 | 48 | int propertyCounter = 0; 49 | char* propPos = strchr(entitiesText, '"'); 50 | 51 | BSPENTITYDEF CurrEntityDef; 52 | memset(&CurrEntityDef, 0, sizeof(BSPENTITYDEF)); 53 | 54 | BUTTONDEF Buttons[32]; 55 | memset(Buttons, 0, sizeof(Buttons)); 56 | int nButtons = 0; 57 | 58 | float CurrDelay = 0.0f; 59 | 60 | char CurrTargetOnFinish[64]; 61 | 62 | char ThisKey[1024]; 63 | char ThisValue[1024]; 64 | 65 | bool bIsWeldable = false; 66 | 67 | while (propPos != NULL) 68 | { 69 | int startName = (int)(propPos - entitiesText + 1); 70 | propPos = strchr(propPos + 1, '"'); 71 | int endName = (int)(propPos - entitiesText); 72 | 73 | memcpy(ThisKey, &entitiesText[startName], endName - startName); 74 | ThisKey[endName - startName] = '\0'; 75 | 76 | propPos = strchr(propPos + 1, '"'); 77 | int startValue = (int)(propPos - entitiesText + 1); 78 | propPos = strchr(propPos + 1, '"'); 79 | int endValue = (int)(propPos - entitiesText); 80 | 81 | memcpy(ThisValue, &entitiesText[startValue], endValue - startValue); 82 | ThisValue[endValue - startValue] = '\0'; 83 | 84 | if (FStrEq(ThisKey, "targetOnFinish")) 85 | { 86 | bIsWeldable = true; 87 | memcpy(CurrTargetOnFinish, ThisValue, endValue - startValue); 88 | CurrTargetOnFinish[endValue - startValue] = '\0'; 89 | } 90 | 91 | if (FStrEq(ThisKey, "classname")) 92 | { 93 | if (bIsWeldable) 94 | { 95 | UTIL_MarkDoorWeldable(CurrTargetOnFinish); 96 | } 97 | bIsWeldable = false; 98 | 99 | CurrTargetOnFinish[0] = '\0'; 100 | } 101 | 102 | propPos = strchr(propPos + 1, '"'); 103 | } 104 | 105 | } 106 | 107 | char* GetEntityDefClassname(BSPENTITYDEF* entity) 108 | { 109 | return entity->properties[entity->numProperties - 1].propertyValue; 110 | } -------------------------------------------------------------------------------- /evobot/src/game_state.h: -------------------------------------------------------------------------------- 1 | // 2 | // EvoBot - Neoptolemus' Natural Selection bot, based on Botman's HPB bot template 3 | // 4 | // game_state.h 5 | // 6 | // Contains all functionality related to monitoring and maintaining player counts 7 | // 8 | 9 | #pragma once 10 | 11 | #ifndef GAME_STATE_H 12 | #define GAME_STATE_H 13 | 14 | #include "bot_structs.h" 15 | 16 | #include 17 | 18 | static const int MAX_CLIENTS = 32; 19 | 20 | typedef enum 21 | { 22 | GAME_STATUS_NOTSTARTED, 23 | GAME_STATUS_ACTIVE, 24 | GAME_STATUS_ENDED 25 | } 26 | NSGameStatus; 27 | 28 | typedef struct _TRACKED_EVOLUTION 29 | { 30 | edict_t* PlayerEdict = nullptr; 31 | int LastKnownRes = 0; 32 | NSPlayerClass EvolvingClass = CLASS_NONE; 33 | NSPlayerClass LastSeenClass = CLASS_NONE; 34 | bool bIsEvolving = false; 35 | } TrackedEvolution; 36 | 37 | NSGameMode GAME_GetGameMode(); 38 | 39 | void GAME_SetGameStatus(NSGameStatus NewStatus); 40 | NSGameStatus GAME_GetGameStatus(); 41 | 42 | void GAME_AddClient(edict_t* NewClient); 43 | void GAME_RemoveClient(edict_t* DisconnectedClient); 44 | 45 | int GAME_GetClientIndex(edict_t* Client); 46 | 47 | void GAME_Reset(); 48 | 49 | void GAME_SetListenServerEdict(edict_t* ListenEdict); 50 | edict_t* GAME_GetListenServerEdict(); 51 | 52 | void GAME_ClearClientList(); 53 | 54 | int GAME_GetNumPlayersOnTeam(const int Team); 55 | int GAME_GetNumHumansOnTeam(const int Team); 56 | 57 | int GAME_GetNumDeadPlayersOnTeam(const int Team); 58 | int GAME_GetNumActivePlayersOnTeam(const int Team); 59 | 60 | void GAME_SetBotDeltaTime(float NewDelta); 61 | float GAME_GetBotDeltaTime(); 62 | 63 | bool GAME_IsAnyHumanOnTeam(const int Team); 64 | 65 | int GAME_GetBotsWithRoleType(BotRole RoleType, const int Team, const edict_t* IgnorePlayer); 66 | 67 | int GAME_GetNumPlayersOnTeamOfClass(const int Team, const NSPlayerClass SearchClass); 68 | 69 | void GAME_BotSpawnInit(bot_t* pBot); 70 | 71 | void GAME_UpdateBotCounts(); 72 | void GAME_HandleFillTeams(); 73 | void GAME_HandleManualFillTeams(); 74 | void GAME_HandleTeamBalance(); 75 | 76 | int GAME_GetNumBotsInGame(); 77 | int GAME_GetNumBotsOnTeam(const int Team); 78 | void GAME_AddBotToTeam(const int Team); 79 | void GAME_RemoveBotFromTeam(const int Team); 80 | 81 | bool GAME_IsDedicatedServer(); 82 | 83 | bool GAME_UseComplexFOV(); 84 | void GAME_SetUseComplexFOV(bool bNewValue); 85 | 86 | EvobotDebugMode GAME_GetDebugMode(); 87 | 88 | void GAME_OnGameStart(); 89 | 90 | void GAME_RemoveAllBots(); 91 | void GAME_RemoveAllBotsInReadyRoom(); 92 | 93 | const char* UTIL_GameModeToChar(const NSGameMode GameMode); 94 | 95 | void EvoBot_ServerCommand(void); 96 | 97 | void GAME_UpdateServerMSecVal(const double DeltaTime); 98 | int GAME_GetServerMSecVal(); 99 | 100 | void DEBUG_SetShowBotPath(bool bNewValue); 101 | void DEBUG_SetShowTaskInfo(bool bNewValue); 102 | bool DEBUG_ShouldShowTaskInfo(); 103 | bool DEBUG_ShouldShowBotPath(); 104 | 105 | void GAME_TrackPlayerEvolutions(); 106 | bool GAME_IsAnyPlayerEvolvingToClass(NSPlayerClass Class); 107 | int GAME_GetNumPlayersEvolvingToClass(NSPlayerClass Class); 108 | bool GAME_IsAnyPlayerEvolvingToClass(NSPlayerClass Class, edict_t* IgnorePlayer); 109 | int GAME_GetNumPlayersEvolvingToClass(NSPlayerClass Class, edict_t* IgnorePlayer); 110 | bool GAME_IsPlayerEvolvingToClass(NSPlayerClass Class, edict_t* Player); 111 | 112 | float GAME_GetLastLerkSeenTime(); 113 | 114 | #endif -------------------------------------------------------------------------------- /evobot/metamod/commands_meta.h: -------------------------------------------------------------------------------- 1 | // vi: set ts=4 sw=4 : 2 | // vim: set tw=75 : 3 | 4 | // commands_meta.h - prototypes for console commands 5 | 6 | /* 7 | * Copyright (c) 2001-2006 Will Day 8 | * 9 | * This file is part of Metamod. 10 | * 11 | * Metamod is free software; you can redistribute it and/or modify it 12 | * under the terms of the GNU General Public License as published by the 13 | * Free Software Foundation; either version 2 of the License, or (at 14 | * your option) any later version. 15 | * 16 | * Metamod is distributed in the hope that it will be useful, but 17 | * WITHOUT ANY WARRANTY; without even the implied warranty of 18 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 19 | * General Public License for more details. 20 | * 21 | * You should have received a copy of the GNU General Public License 22 | * along with Metamod; if not, write to the Free Software Foundation, 23 | * Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 24 | * 25 | * In addition, as a special exception, the author gives permission to 26 | * link the code of this program with the Half-Life Game Engine ("HL 27 | * Engine") and Modified Game Libraries ("MODs") developed by Valve, 28 | * L.L.C ("Valve"). You must obey the GNU General Public License in all 29 | * respects for all of the code used other than the HL Engine and MODs 30 | * from Valve. If you modify this file, you may extend this exception 31 | * to your version of the file, but you are not obligated to do so. If 32 | * you do not wish to do so, delete this exception statement from your 33 | * version. 34 | * 35 | */ 36 | 37 | #ifndef COMMANDS_META_H 38 | #define COMMANDS_META_H 39 | 40 | #include "types_meta.h" // mBOOL 41 | #include "comp_dep.h" 42 | 43 | // Flags to use for meta_cmd_doplug(), to operate on existing plugins; note 44 | // "load" operates on a non-existing plugin thus isn't included here. 45 | typedef enum { 46 | PC_NULL = 0, 47 | PC_PAUSE, // pause the plugin 48 | PC_UNPAUSE, // unpause the plugin 49 | PC_UNLOAD, // unload the plugin 50 | PC_RELOAD, // unload the plugin and load it again 51 | PC_RETRY, // retry a failed operation (usually load/attach) 52 | PC_INFO, // show all info about the plugin 53 | PC_CLEAR, // remove a failed plugin from the list 54 | PC_FORCE_UNLOAD, // forcibly unload the plugin 55 | PC_REQUIRE, // require that this plugin is loaded/running 56 | } PLUG_CMD; 57 | 58 | void DLLINTERNAL meta_register_cmdcvar(); 59 | 60 | void DLLHIDDEN svr_meta(void); // only hidden because called from outside! 61 | 62 | void DLLINTERNAL cmd_meta_usage(void); 63 | void DLLINTERNAL cmd_meta_version(void); 64 | void DLLINTERNAL cmd_meta_gpl(void); 65 | 66 | void DLLINTERNAL cmd_meta_game(void); 67 | void DLLINTERNAL cmd_meta_refresh(void); 68 | void DLLINTERNAL cmd_meta_load(void); 69 | 70 | void DLLINTERNAL cmd_meta_pluginlist(void); 71 | void DLLINTERNAL cmd_meta_cmdlist(void); 72 | void DLLINTERNAL cmd_meta_cvarlist(void); 73 | void DLLINTERNAL cmd_meta_config(void); 74 | 75 | void DLLINTERNAL cmd_doplug(PLUG_CMD pcmd); 76 | 77 | void DLLINTERNAL client_meta(edict_t *pEntity); 78 | void DLLINTERNAL client_meta_usage(edict_t *pEntity); 79 | void DLLINTERNAL client_meta_version(edict_t *pEntity); 80 | void DLLINTERNAL client_meta_pluginlist(edict_t *pEntity); 81 | void DLLINTERNAL client_meta_aybabtu(edict_t *pEntity); 82 | 83 | #endif /* COMMANDS_META_H */ 84 | -------------------------------------------------------------------------------- /evobot/metamod/types_meta.h: -------------------------------------------------------------------------------- 1 | // vi: set ts=4 sw=4 : 2 | // vim: set tw=75 : 3 | 4 | // types_meta.h - common internal type, etc definitions 5 | 6 | /* 7 | * Copyright (c) 2001-2006 Will Day 8 | * 9 | * This file is part of Metamod. 10 | * 11 | * Metamod is free software; you can redistribute it and/or modify it 12 | * under the terms of the GNU General Public License as published by the 13 | * Free Software Foundation; either version 2 of the License, or (at 14 | * your option) any later version. 15 | * 16 | * Metamod is distributed in the hope that it will be useful, but 17 | * WITHOUT ANY WARRANTY; without even the implied warranty of 18 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 19 | * General Public License for more details. 20 | * 21 | * You should have received a copy of the GNU General Public License 22 | * along with Metamod; if not, write to the Free Software Foundation, 23 | * Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 24 | * 25 | * In addition, as a special exception, the author gives permission to 26 | * link the code of this program with the Half-Life Game Engine ("HL 27 | * Engine") and Modified Game Libraries ("MODs") developed by Valve, 28 | * L.L.C ("Valve"). You must obey the GNU General Public License in all 29 | * respects for all of the code used other than the HL Engine and MODs 30 | * from Valve. If you modify this file, you may extend this exception 31 | * to your version of the file, but you are not obligated to do so. If 32 | * you do not wish to do so, delete this exception statement from your 33 | * version. 34 | * 35 | */ 36 | 37 | #ifndef TYPES_META_H 38 | #define TYPES_META_H 39 | 40 | #include "comp_dep.h" 41 | 42 | 43 | // Our own boolean type, for stricter type matching. 44 | typedef enum mBOOL { 45 | mFALSE = 0, 46 | mTRUE, 47 | } mBOOL; 48 | 49 | // Like C's errno, for our various functions; describes causes of failure 50 | // or mFALSE returns. 51 | typedef enum { 52 | ME_NOERROR = 0, 53 | ME_FORMAT, // invalid format 54 | ME_COMMENT, // ignored comment 55 | ME_BLANK, // ignored blank (empty) line 56 | ME_ALREADY, // request had already been done 57 | ME_DELAYED, // request is delayed 58 | ME_NOTALLOWED, // request not allowed 59 | ME_SKIPPED, // request is being skipped for whatever reason 60 | ME_BADREQ, // invalid request for this 61 | ME_ARGUMENT, // invalid arguments 62 | ME_NULLRESULT, // resulting data was empty or null 63 | ME_MAXREACHED, // reached max/limit 64 | ME_NOTUNIQ, // not unique (ambigious match) 65 | ME_NOTFOUND, // in find operation, match not found 66 | ME_NOFILE, // file empty or missing 67 | ME_NOMEM, // malloc failed 68 | ME_BADMEMPTR, // invalid memory address 69 | ME_OSNOTSUP, // OS doesn't support this operation 70 | ME_DLOPEN, // failed to open shared lib/dll 71 | ME_DLMISSING, // symbol missing in lib/dll 72 | ME_DLERROR, // some other error encountered calling functions from dll 73 | ME_IFVERSION, // incompatible interface version 74 | ME_UNLOAD_UNLOADER, // tried to unload unloader 75 | ME_UNLOAD_SELF, // tried to unload self 76 | } META_ERRNO; 77 | extern META_ERRNO meta_errno DLLHIDDEN; 78 | 79 | #define RETURN_ERRNO(retval, errval) \ 80 | do { meta_errno=errval; return(retval); } while(0) 81 | 82 | #define RETURN_LOGERR_ERRNO(errargs, retval, errval) \ 83 | do { META_ERROR errargs ; meta_errno=errval; return(retval); } while(0) 84 | 85 | #endif /* TYPES_META_H */ 86 | -------------------------------------------------------------------------------- /evobot/metamod/enginecallbacks.h: -------------------------------------------------------------------------------- 1 | // vi: set ts=4 sw=4 : 2 | // vim: set tw=75 : 3 | 4 | // enginecallbacks.h - wrapper for 5 | 6 | /* 7 | * Copyright (c) 2001-2006 Will Day 8 | * 9 | * This file is part of Metamod. 10 | * 11 | * Metamod is free software; you can redistribute it and/or modify it 12 | * under the terms of the GNU General Public License as published by the 13 | * Free Software Foundation; either version 2 of the License, or (at 14 | * your option) any later version. 15 | * 16 | * Metamod is distributed in the hope that it will be useful, but 17 | * WITHOUT ANY WARRANTY; without even the implied warranty of 18 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 19 | * General Public License for more details. 20 | * 21 | * You should have received a copy of the GNU General Public License 22 | * along with Metamod; if not, write to the Free Software Foundation, 23 | * Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 24 | * 25 | * In addition, as a special exception, the author gives permission to 26 | * link the code of this program with the Half-Life Game Engine ("HL 27 | * Engine") and Modified Game Libraries ("MODs") developed by Valve, 28 | * L.L.C ("Valve"). You must obey the GNU General Public License in all 29 | * respects for all of the code used other than the HL Engine and MODs 30 | * from Valve. If you modify this file, you may extend this exception 31 | * to your version of the file, but you are not obligated to do so. If 32 | * you do not wish to do so, delete this exception statement from your 33 | * version. 34 | * 35 | */ 36 | 37 | #ifndef MM_ENGINECALLBACKS_H 38 | #define MM_ENGINECALLBACKS_H 39 | 40 | // This file is a wrapper around the SDK's enginecallback.h file. We need 41 | // this because we use a different type for the global object g_engfuncs, 42 | // which is still compatible with the enginefuncs_t that the SDK 43 | // uses. 44 | // This is only done for files that belong to Metamod, not other projects 45 | // like plugins that use this file, or others that include it, too. 46 | // Since we don't have a clean seperation of include files right now we 47 | // "hack" our way around that by using a flag METAMOD_CORE which is set 48 | // when compiling Metamod proper. 49 | 50 | #ifdef __METAMOD_BUILD__ 51 | # include "meta_eiface.h" // HL_enginefuncs_t 52 | 53 | // Use a #define to bend the enginefuncs_t type to our HL_enginefuncs_t 54 | // type instead as we now use that for the global object g_engfuncs. 55 | # define enginefuncs_t HL_enginefuncs_t 56 | #endif /* METAMOD_CORE */ 57 | 58 | #include // ALERT, etc 59 | 60 | #ifdef __METAMOD_BUILD__ 61 | # undef enginefuncs_t 62 | #endif /* METAMOD_CORE */ 63 | 64 | // Also, create some additional macros for engine callback functions, which 65 | // weren't in SDK dlls/enginecallbacks.h but probably should have been. 66 | 67 | #define GET_INFOKEYBUFFER (*g_engfuncs.pfnGetInfoKeyBuffer) 68 | #define INFOKEY_VALUE (*g_engfuncs.pfnInfoKeyValue) 69 | #define SET_CLIENT_KEYVALUE (*g_engfuncs.pfnSetClientKeyValue) 70 | #define REG_SVR_COMMAND (*g_engfuncs.pfnAddServerCommand) 71 | #define SERVER_PRINT (*g_engfuncs.pfnServerPrint) 72 | #define SET_SERVER_KEYVALUE (*g_engfuncs.pfnSetKeyValue) 73 | #define QUERY_CLIENT_CVAR_VALUE (*g_engfuncs.pfnQueryClientCvarValue) 74 | #define QUERY_CLIENT_CVAR_VALUE2 (*g_engfuncs.pfnQueryClientCvarValue2) 75 | 76 | 77 | #endif /* MM_ENGINECALLBACKS_H */ 78 | 79 | -------------------------------------------------------------------------------- /evobot/metamod/tqueue.h: -------------------------------------------------------------------------------- 1 | // vi: set ts=4 sw=4 : 2 | // vim: set tw=75 : 3 | 4 | // tqueue.h - template classes for Queue and QItem 5 | 6 | /* 7 | * Copyright (c) 2001-2006 Will Day 8 | * 9 | * This file is part of Metamod. 10 | * 11 | * Metamod is free software; you can redistribute it and/or modify it 12 | * under the terms of the GNU General Public License as published by the 13 | * Free Software Foundation; either version 2 of the License, or (at 14 | * your option) any later version. 15 | * 16 | * Metamod is distributed in the hope that it will be useful, but 17 | * WITHOUT ANY WARRANTY; without even the implied warranty of 18 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 19 | * General Public License for more details. 20 | * 21 | * You should have received a copy of the GNU General Public License 22 | * along with Metamod; if not, write to the Free Software Foundation, 23 | * Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 24 | * 25 | * In addition, as a special exception, the author gives permission to 26 | * link the code of this program with the Half-Life Game Engine ("HL 27 | * Engine") and Modified Game Libraries ("MODs") developed by Valve, 28 | * L.L.C ("Valve"). You must obey the GNU General Public License in all 29 | * respects for all of the code used other than the HL Engine and MODs 30 | * from Valve. If you modify this file, you may extend this exception 31 | * to your version of the file, but you are not obligated to do so. If 32 | * you do not wish to do so, delete this exception statement from your 33 | * version. 34 | * 35 | */ 36 | /* 37 | #ifndef TQUEUE_H 38 | #define TQUEUE_H 39 | 40 | #include "new_baseclass.h" 41 | 42 | // Forward declarations. 43 | template class Queue; 44 | 45 | // Template for Queue. 46 | template class Queue : public class_metamod_new { 47 | private: 48 | // private copy/assign constructors: 49 | Queue(const Queue &src); 50 | void operator=(const Queue &src); 51 | protected: 52 | // structs: 53 | class QItem : public class_metamod_new { 54 | private: 55 | // private copy/assign constructors: 56 | QItem(const QItem &src); 57 | void operator=(const QItem &src); 58 | public: 59 | qdata_t *data; 60 | QItem *next; 61 | QItem(void) :data(NULL), next(NULL) { }; 62 | QItem(qdata_t *dnew) :data(dnew), next(NULL) { }; 63 | }; 64 | // data: 65 | int size; 66 | QItem *front; 67 | QItem *end; 68 | public: 69 | // constructor: 70 | Queue(void) :size(0), front(NULL), end(NULL) {}; 71 | // functions: 72 | void push(qdata_t *qadd); 73 | qdata_t * pop(void); 74 | }; 75 | 76 | 77 | ///// Template Queue: 78 | 79 | // Push onto the queue (at end). 80 | template inline void Queue::push(qdata_t *qadd) { 81 | QItem *qnew = new QItem(qadd); 82 | 83 | if(size==0) 84 | front=qnew; 85 | else 86 | end->next=qnew; 87 | 88 | end=qnew; 89 | 90 | size++; 91 | } 92 | 93 | // Pop from queue (from front). Wait for an item to actually be available 94 | // on the queue (block until there's something there). 95 | template inline qdata_t* Queue::pop(void) { 96 | QItem *qtmp; 97 | qdata_t *ret; 98 | 99 | if(size==0) 100 | return(NULL); 101 | 102 | qtmp=front; 103 | 104 | ret=front->data; 105 | front=front->next; 106 | 107 | delete qtmp; 108 | 109 | size--; 110 | 111 | return(ret); 112 | } 113 | 114 | #endif*/ /* TQUEUE_H */ 115 | -------------------------------------------------------------------------------- /evobot/metamod/plinfo.h: -------------------------------------------------------------------------------- 1 | // vi: set ts=4 sw=4 : 2 | // vim: set tw=75 : 3 | 4 | // plinfo.h - typedefs for plugin info structure 5 | 6 | /* 7 | * Copyright (c) 2001-2006 Will Day 8 | * 9 | * This file is part of Metamod. 10 | * 11 | * Metamod is free software; you can redistribute it and/or modify it 12 | * under the terms of the GNU General Public License as published by the 13 | * Free Software Foundation; either version 2 of the License, or (at 14 | * your option) any later version. 15 | * 16 | * Metamod is distributed in the hope that it will be useful, but 17 | * WITHOUT ANY WARRANTY; without even the implied warranty of 18 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 19 | * General Public License for more details. 20 | * 21 | * You should have received a copy of the GNU General Public License 22 | * along with Metamod; if not, write to the Free Software Foundation, 23 | * Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 24 | * 25 | * In addition, as a special exception, the author gives permission to 26 | * link the code of this program with the Half-Life Game Engine ("HL 27 | * Engine") and Modified Game Libraries ("MODs") developed by Valve, 28 | * L.L.C ("Valve"). You must obey the GNU General Public License in all 29 | * respects for all of the code used other than the HL Engine and MODs 30 | * from Valve. If you modify this file, you may extend this exception 31 | * to your version of the file, but you are not obligated to do so. If 32 | * you do not wish to do so, delete this exception statement from your 33 | * version. 34 | * 35 | */ 36 | 37 | #ifndef PLINFO_H 38 | #define PLINFO_H 39 | 40 | #include "comp_dep.h" 41 | 42 | // Flags for plugin to indicate when it can be be loaded/unloaded. 43 | // NOTE: order is crucial, as greater/less comparisons are made. 44 | typedef enum { 45 | PT_NEVER = 0, 46 | PT_STARTUP, // should only be loaded/unloaded at initial hlds execution 47 | PT_CHANGELEVEL, // can be loaded/unloaded between maps 48 | PT_ANYTIME, // can be loaded/unloaded at any time 49 | PT_ANYPAUSE, // can be loaded/unloaded at any time, and can be "paused" during a map 50 | } PLUG_LOADTIME; 51 | 52 | // Flags to indicate why the plugin is being unloaded. 53 | typedef enum { 54 | PNL_NULL = 0, 55 | PNL_INI_DELETED, // was deleted from plugins.ini 56 | PNL_FILE_NEWER, // file on disk is newer than last load 57 | PNL_COMMAND, // requested by server/console command 58 | PNL_CMD_FORCED, // forced by server/console command 59 | PNL_DELAYED, // delayed from previous request; can't tell origin 60 | //only used for 'real_reason' on MPlugin::unload() 61 | PNL_PLUGIN, // requested by plugin function call 62 | PNL_PLG_FORCED, // forced by plugin function call 63 | //only used internally for 'meta reload' 64 | PNL_RELOAD, // forced unload by reload() 65 | } PL_UNLOAD_REASON; 66 | 67 | // Information plugin provides about itself. 68 | typedef struct { 69 | char *ifvers; // meta_interface version 70 | char *name; // full name of plugin 71 | char *version; // version 72 | char *date; // date 73 | char *author; // author name/email 74 | char *url; // URL 75 | char *logtag; // log message prefix (unused right now) 76 | PLUG_LOADTIME loadable; // when loadable 77 | PLUG_LOADTIME unloadable; // when unloadable 78 | } plugin_info_t; 79 | extern plugin_info_t Plugin_info DLLHIDDEN; 80 | 81 | // Plugin identifier, passed to all Meta Utility Functions. 82 | typedef plugin_info_t* plid_t; 83 | #define PLID &Plugin_info 84 | 85 | #endif /* PLINFO_H */ 86 | -------------------------------------------------------------------------------- /evobot/metamod/mplayer.h: -------------------------------------------------------------------------------- 1 | // vi: set ts=4 sw=4 : 2 | // vim: set tw=75 : 3 | 4 | // mplayer.h - class to keep info about a player and a class listing all 5 | // players 6 | 7 | /* 8 | * Copyright (c) 2005-2006 Will Day 9 | * 10 | * This file is part of Metamod. 11 | * 12 | * Metamod is free software; you can redistribute it and/or modify it 13 | * under the terms of the GNU General Public License as published by the 14 | * Free Software Foundation; either version 2 of the License, or (at 15 | * your option) any later version. 16 | * 17 | * Metamod is distributed in the hope that it will be useful, but 18 | * WITHOUT ANY WARRANTY; without even the implied warranty of 19 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 20 | * General Public License for more details. 21 | * 22 | * You should have received a copy of the GNU General Public License 23 | * along with Metamod; if not, write to the Free Software Foundation, 24 | * Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 25 | * 26 | * In addition, as a special exception, the author gives permission to 27 | * link the code of this program with the Half-Life Game Engine ("HL 28 | * Engine") and Modified Game Libraries ("MODs") developed by Valve, 29 | * L.L.C ("Valve"). You must obey the GNU General Public License in all 30 | * respects for all of the code used other than the HL Engine and MODs 31 | * from Valve. If you modify this file, you may extend this exception 32 | * to your version of the file, but you are not obligated to do so. If 33 | * you do not wish to do so, delete this exception statement from your 34 | * version. 35 | * 36 | */ 37 | 38 | #ifndef INCLUDE_METAMOD_PLAYER_H 39 | #define INCLUDE_METAMOD_PLAYER_H 40 | 41 | #include "plinfo.h" // plugin_info_t, etc 42 | #include "mutil.h" // query_callback_t 43 | #include "types_meta.h" // mBOOL 44 | #include "new_baseclass.h" // class_metamod_new 45 | 46 | 47 | // Numbers of players limit set by the engine 48 | #define MAX_PLAYERS 32 49 | 50 | 51 | // Info on an individual player 52 | class MPlayer : public class_metamod_new 53 | { 54 | private: 55 | mBOOL isQueried; // is this player currently queried for a cvar value 56 | char *cvarName; // name of the cvar if getting queried 57 | 58 | MPlayer (const MPlayer&) DLLINTERNAL; 59 | MPlayer& operator=(const MPlayer&) DLLINTERNAL; 60 | 61 | 62 | public: 63 | MPlayer() DLLINTERNAL; 64 | ~MPlayer() DLLINTERNAL; 65 | void DLLINTERNAL set_cvar_query(const char *cvar); // mark this player as querying a client cvar 66 | void DLLINTERNAL clear_cvar_query(const char *cvar=NULL); // unmark this player as querying a client cvar 67 | const char *DLLINTERNAL is_querying_cvar(void); // check if a player is querying a cvar. returns 68 | // NULL if not or the name of the cvar 69 | }; 70 | 71 | 72 | 73 | // A list of players. The number of max players is fixed and small enough 74 | // to use an array. 75 | class MPlayerList 76 | { 77 | private: 78 | enum { NUM_SLOTS = MAX_PLAYERS + 1 }; 79 | 80 | MPlayer players[NUM_SLOTS]; // array of players 81 | 82 | 83 | public: 84 | void DLLINTERNAL set_player_cvar_query(const edict_t *pEntity, const char *cvar); 85 | void DLLINTERNAL clear_player_cvar_query(const edict_t *pEntity, const char *cvar=NULL); 86 | void DLLINTERNAL clear_all_cvar_queries(void); 87 | const char *DLLINTERNAL is_querying_cvar(const edict_t *pEntity); 88 | }; 89 | 90 | 91 | #endif /* INCLUDE_METAMOD_PLAYER_H */ 92 | -------------------------------------------------------------------------------- /evobot/metamod/conf_meta.h: -------------------------------------------------------------------------------- 1 | // vi: set ts=4 sw=4 : 2 | // vim: set tw=75 : 3 | 4 | // conf_meta.h - configfile reading 5 | 6 | // Modeled after mutt/init.[ch]. 7 | 8 | /* 9 | * Copyright (c) 2001-2006 Will Day 10 | * 11 | * This file is part of Metamod. 12 | * 13 | * Metamod is free software; you can redistribute it and/or modify it 14 | * under the terms of the GNU General Public License as published by the 15 | * Free Software Foundation; either version 2 of the License, or (at 16 | * your option) any later version. 17 | * 18 | * Metamod is distributed in the hope that it will be useful, but 19 | * WITHOUT ANY WARRANTY; without even the implied warranty of 20 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 21 | * General Public License for more details. 22 | * 23 | * You should have received a copy of the GNU General Public License 24 | * along with Metamod; if not, write to the Free Software Foundation, 25 | * Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 26 | * 27 | * In addition, as a special exception, the author gives permission to 28 | * link the code of this program with the Half-Life Game Engine ("HL 29 | * Engine") and Modified Game Libraries ("MODs") developed by Valve, 30 | * L.L.C ("Valve"). You must obey the GNU General Public License in all 31 | * respects for all of the code used other than the HL Engine and MODs 32 | * from Valve. If you modify this file, you may extend this exception 33 | * to your version of the file, but you are not obligated to do so. If 34 | * you do not wish to do so, delete this exception statement from your 35 | * version. 36 | * 37 | */ 38 | 39 | #ifndef CONF_META_H 40 | #define CONF_META_H 41 | 42 | #include "types_meta.h" // mBOOL 43 | #include "new_baseclass.h" 44 | #include "comp_dep.h" 45 | 46 | // Max length of line in config file. 47 | #define MAX_CONF_LEN 1024 48 | 49 | // Supported config value-types. 50 | typedef enum { 51 | CF_NONE=0, 52 | CF_INT, 53 | CF_BOOL, 54 | CF_STR, 55 | CF_PATH, 56 | #if 0 57 | CF_CVAR, 58 | CF_CMD, 59 | #endif 60 | } cf_type_t; 61 | 62 | //typedef mBOOL (*SETOPT_FN) (char *key, char *value); 63 | 64 | typedef struct option_s { 65 | char *name; // option name 66 | cf_type_t type; // option type 67 | void *dest; // addr of destination variable, or handler function 68 | char *init; // initial value, as a string, just as config file would 69 | } option_t; 70 | 71 | class MConfig : public class_metamod_new { 72 | private: 73 | // data 74 | option_t *list; 75 | char *filename; 76 | // functions 77 | option_t * DLLINTERNAL find(const char *lookup); 78 | mBOOL DLLINTERNAL set(option_t *setp, const char *value); 79 | // Private; to satisfy -Weffc++ "has pointer data members but does 80 | // not override" copy/assignment constructor. 81 | void operator=(const MConfig &src); 82 | MConfig(const MConfig &src); 83 | public: 84 | // contructor 85 | MConfig(void) DLLINTERNAL; 86 | // data 87 | int debuglevel; // to use for meta_debug 88 | char *gamedll; // string if specified in config.ini 89 | char *plugins_file; // ie metamod.ini, plugins.ini 90 | char *exec_cfg; // ie metaexec.cfg, exec.cfg 91 | int autodetect; // autodetection of gamedll (Metamod-All-Support patch) 92 | int clientmeta; // control 'meta' client-command 93 | // functions 94 | void DLLINTERNAL init(option_t *global_options); 95 | mBOOL DLLINTERNAL load(const char *filename); 96 | mBOOL DLLINTERNAL set(const char *key, const char *value); 97 | void DLLINTERNAL show(void); 98 | }; 99 | 100 | #endif /* CONF_META_H */ 101 | -------------------------------------------------------------------------------- /evobot/metamod/comp_dep.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2004-2006 Jussi Kivilinna 3 | * 4 | * This file is part of "Metamod All-Mod-Support"-patch for Metamod. 5 | * 6 | * Metamod is free software; you can redistribute it and/or modify it 7 | * under the terms of the GNU General Public License as published by the 8 | * Free Software Foundation; either version 2 of the License, or (at 9 | * your option) any later version. 10 | * 11 | * Metamod is distributed in the hope that it will be useful, but 12 | * WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 | * General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with Metamod; if not, write to the Free Software Foundation, 18 | * Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 19 | * 20 | * In addition, as a special exception, the author gives permission to 21 | * link the code of this program with the Half-Life Game Engine ("HL 22 | * Engine") and Modified Game Libraries ("MODs") developed by Valve, 23 | * L.L.C ("Valve"). You must obey the GNU General Public License in all 24 | * respects for all of the code used other than the HL Engine and MODs 25 | * from Valve. If you modify this file, you may extend this exception 26 | * to your version of the file, but you are not obligated to do so. If 27 | * you do not wish to do so, delete this exception statement from your 28 | * version. 29 | * 30 | */ 31 | 32 | #ifndef COMP_DEP_H 33 | #define COMP_DEP_H 34 | 35 | #define DECLSPEC(kw) 36 | #if defined (_WIN32) && defined (_MSC_VER) 37 | #define ATTRIBUTE(kw) 38 | #else 39 | #define ATTRIBUTE(kw) __attribute__((kw)) 40 | #endif 41 | #define MM_CDECL 42 | 43 | // We use these macros to hide our internal globals from being exported 44 | // on ELF .so 45 | #if defined(__GNUC__) && !defined(_WIN32) && __GNUC__ >= 3 && __GNUC_MINOR__ >= 3 46 | // Hidden data/function. 47 | #define DLLHIDDEN __attribute__((visibility("hidden"))) 48 | // Hidden internal function. 49 | #if defined(__x86_64__) || defined(__amd64__) 50 | #define DLLINTERNAL __attribute__((visibility("internal"))) 51 | #define DLLINTERNAL_NOVIS 52 | #else 53 | #ifdef __INTERNALS_USE_REGPARAMS__ 54 | #define DLLINTERNAL __attribute__((visibility("internal"), regparm(3))) 55 | #define DLLINTERNAL_NOVIS __attribute__((regparm(3))) 56 | #else 57 | #define DLLINTERNAL __attribute__((visibility("internal"))) 58 | #define DLLINTERNAL_NOVIS 59 | #endif 60 | #endif 61 | #else 62 | #define DLLHIDDEN 63 | #if defined (_WIN32) && defined (_MSC_VER) 64 | #define DLLINTERNAL_NOVIS 65 | #define DLLINTERNAL 66 | #else 67 | #ifdef __INTERNALS_USE_REGPARAMS__ 68 | #define DLLINTERNAL_NOVIS __attribute__((regparm(3))) 69 | #define DLLINTERNAL DLLINTERNAL_NOVIS 70 | #else 71 | #define DLLINTERNAL_NOVIS 72 | #define DLLINTERNAL 73 | #endif 74 | #endif //defined WIN32 75 | #endif 76 | 77 | #if defined (_WIN32) && defined (_MSC_VER) 78 | // On x86 va_list is just a pointer. 79 | //#define va_copy(dst,src) ((dst)=(src)) 80 | #else 81 | // Some systems that do not supply va_copy have __va_copy instead, since 82 | // that was the name used in the draft proposal. 83 | #if !defined(__GNUC__) || __GNUC__ < 3 84 | #define va_copy __va_copy 85 | #endif 86 | #endif 87 | 88 | // Manual branch optimization for GCC 3.0.0 and newer 89 | #if !defined(__GNUC__) || __GNUC__ < 3 90 | #define likely(x) (x) 91 | #define unlikely(x) (x) 92 | #else 93 | #define likely(x) __builtin_expect((long int)(x), true) 94 | #define unlikely(x) __builtin_expect((long int)(x), false) 95 | #endif 96 | 97 | #endif /*COMP_DEP_H*/ 98 | -------------------------------------------------------------------------------- /evobot/HLSDK/common/cl_entity.h: -------------------------------------------------------------------------------- 1 | /*** 2 | * 3 | * Copyright (c) 1996-2002, Valve LLC. All rights reserved. 4 | * 5 | * This product contains software technology licensed from Id 6 | * Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc. 7 | * All Rights Reserved. 8 | * 9 | * Use, distribution, and modification of this source code and/or resulting 10 | * object code is restricted to non-commercial enhancements to products from 11 | * Valve LLC. All other use, distribution, or modification is prohibited 12 | * without written permission from Valve LLC. 13 | * 14 | ****/ 15 | // cl_entity.h 16 | #if !defined( CL_ENTITYH ) 17 | #define CL_ENTITYH 18 | #ifdef _WIN32 19 | #ifndef __MINGW32__ 20 | #pragma once 21 | #endif /* not __MINGW32__ */ 22 | #endif 23 | 24 | typedef struct efrag_s 25 | { 26 | struct mleaf_s *leaf; 27 | struct efrag_s *leafnext; 28 | struct cl_entity_s *entity; 29 | struct efrag_s *entnext; 30 | } efrag_t; 31 | 32 | typedef struct 33 | { 34 | byte mouthopen; // 0 = mouth closed, 255 = mouth agape 35 | byte sndcount; // counter for running average 36 | int sndavg; // running average 37 | } mouth_t; 38 | 39 | typedef struct 40 | { 41 | float prevanimtime; 42 | float sequencetime; 43 | byte prevseqblending[2]; 44 | vec3_t prevorigin; 45 | vec3_t prevangles; 46 | 47 | int prevsequence; 48 | float prevframe; 49 | 50 | byte prevcontroller[4]; 51 | byte prevblending[2]; 52 | } latchedvars_t; 53 | 54 | typedef struct 55 | { 56 | // Time stamp for this movement 57 | float animtime; 58 | 59 | vec3_t origin; 60 | vec3_t angles; 61 | } position_history_t; 62 | 63 | typedef struct cl_entity_s cl_entity_t; 64 | 65 | #define HISTORY_MAX 64 // Must be power of 2 66 | #define HISTORY_MASK ( HISTORY_MAX - 1 ) 67 | 68 | 69 | #if !defined( ENTITY_STATEH ) 70 | #include "entity_state.h" 71 | #endif 72 | 73 | #if !defined( PROGS_H ) 74 | #include "progs.h" 75 | #endif 76 | 77 | struct cl_entity_s 78 | { 79 | int index; // Index into cl_entities ( should match actual slot, but not necessarily ) 80 | 81 | qboolean player; // True if this entity is a "player" 82 | 83 | entity_state_t baseline; // The original state from which to delta during an uncompressed message 84 | entity_state_t prevstate; // The state information from the penultimate message received from the server 85 | entity_state_t curstate; // The state information from the last message received from server 86 | 87 | int current_position; // Last received history update index 88 | position_history_t ph[ HISTORY_MAX ]; // History of position and angle updates for this player 89 | 90 | mouth_t mouth; // For synchronizing mouth movements. 91 | 92 | latchedvars_t latched; // Variables used by studio model rendering routines 93 | 94 | // Information based on interplocation, extrapolation, prediction, or just copied from last msg received. 95 | // 96 | float lastmove; 97 | 98 | // Actual render position and angles 99 | vec3_t origin; 100 | vec3_t angles; 101 | 102 | // Attachment points 103 | vec3_t attachment[4]; 104 | 105 | // Other entity local information 106 | int trivial_accept; 107 | 108 | struct model_s *model; // cl.model_precache[ curstate.modelindes ]; all visible entities have a model 109 | struct efrag_s *efrag; // linked list of efrags 110 | struct mnode_s *topnode; // for bmodels, first world node that splits bmodel, or NULL if not split 111 | 112 | float syncbase; // for client-side animations -- used by obsolete alias animation system, remove? 113 | int visframe; // last frame this entity was found in an active leaf 114 | colorVec cvFloorColor; 115 | }; 116 | 117 | #endif // !CL_ENTITYH 118 | -------------------------------------------------------------------------------- /evobot/HLSDK/engine/custom.h: -------------------------------------------------------------------------------- 1 | /*** 2 | * 3 | * Copyright (c) 1999, Valve LLC. All rights reserved. 4 | * 5 | * This product contains software technology licensed from Id 6 | * Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc. 7 | * All Rights Reserved. 8 | * 9 | * Use, distribution, and modification of this source code and/or resulting 10 | * object code is restricted to non-commercial enhancements to products from 11 | * Valve LLC. All other use, distribution, or modification is prohibited 12 | * without written permission from Valve LLC. 13 | * 14 | ****/ 15 | // Customization.h 16 | 17 | #ifndef CUSTOM_H 18 | #define CUSTOM_H 19 | #ifdef _WIN32 20 | #ifndef __MINGW32__ 21 | #pragma once 22 | #endif /* not __MINGW32__ */ 23 | #endif 24 | 25 | #include "const.h" 26 | 27 | #define MAX_QPATH 64 // Must match value in quakedefs.h 28 | 29 | ///////////////// 30 | // Customization 31 | // passed to pfnPlayerCustomization 32 | // For automatic downloading. 33 | typedef enum 34 | { 35 | t_sound = 0, 36 | t_skin, 37 | t_model, 38 | t_decal, 39 | t_generic, 40 | t_eventscript 41 | } resourcetype_t; 42 | 43 | // Fake type for world 44 | #define t_world 6 45 | 46 | typedef struct 47 | { 48 | int size; 49 | } _resourceinfo_t; 50 | 51 | typedef struct resourceinfo_s 52 | { 53 | _resourceinfo_t info[ 7 ]; 54 | } resourceinfo_t; 55 | 56 | #define RES_FATALIFMISSING (1<<0) // Disconnect if we can't get this file. 57 | #define RES_WASMISSING (1<<1) // Do we have the file locally, did we get it ok? 58 | #define RES_CUSTOM (1<<2) // Is this resource one that corresponds to another player's customization 59 | // or is it a server startup resource. 60 | #define RES_REQUESTED (1<<3) // Already requested a download of this one 61 | #define RES_PRECACHED (1<<4) // Already precached 62 | 63 | #include "crc.h" 64 | 65 | typedef struct resource_s 66 | { 67 | char szFileName[MAX_QPATH]; // File name to download/precache. 68 | resourcetype_t type; // t_sound, t_skin, t_model, t_decal. 69 | int nIndex; // For t_decals 70 | int nDownloadSize; // Size in Bytes if this must be downloaded. 71 | unsigned char ucFlags; 72 | 73 | // For handling client to client resource propagation 74 | unsigned char rgucMD5_hash[16]; // To determine if we already have it. 75 | unsigned char playernum; // Which player index this resource is associated with, if it's a custom resource. 76 | 77 | unsigned char rguc_reserved[ 32 ]; // For future expansion 78 | struct resource_s *pNext; // Next in chain. 79 | struct resource_s *pPrev; 80 | } resource_t; 81 | 82 | typedef struct customization_s 83 | { 84 | qboolean bInUse; // Is this customization in use; 85 | resource_t resource; // The resource_t for this customization 86 | qboolean bTranslated; // Has the raw data been translated into a useable format? 87 | // (e.g., raw decal .wad make into texture_t *) 88 | int nUserData1; // Customization specific data 89 | int nUserData2; // Customization specific data 90 | void *pInfo; // Buffer that holds the data structure that references the data (e.g., the cachewad_t) 91 | void *pBuffer; // Buffer that holds the data for the customization (the raw .wad data) 92 | struct customization_s *pNext; // Next in chain 93 | } customization_t; 94 | 95 | #define FCUST_FROMHPAK ( 1<<0 ) 96 | #define FCUST_WIPEDATA ( 1<<1 ) 97 | #define FCUST_IGNOREINIT ( 1<<2 ) 98 | 99 | void COM_ClearCustomizationList( struct customization_s *pHead, qboolean bCleanDecals); 100 | qboolean COM_CreateCustomization( struct customization_s *pListHead, struct resource_s *pResource, int playernumber, int flags, 101 | struct customization_s **pCustomization, int *nLumps ); 102 | int COM_SizeofResourceList ( struct resource_s *pList, struct resourceinfo_s *ri ); 103 | 104 | #endif // CUSTOM_H 105 | -------------------------------------------------------------------------------- /evobot/fastlz/fastlz.h: -------------------------------------------------------------------------------- 1 | /* 2 | FastLZ - lightning-fast lossless compression library 3 | 4 | Copyright (C) 2007 Ariya Hidayat (ariya@kde.org) 5 | Copyright (C) 2006 Ariya Hidayat (ariya@kde.org) 6 | Copyright (C) 2005 Ariya Hidayat (ariya@kde.org) 7 | 8 | Permission is hereby granted, free of charge, to any person obtaining a copy 9 | of this software and associated documentation files (the "Software"), to deal 10 | in the Software without restriction, including without limitation the rights 11 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 12 | copies of the Software, and to permit persons to whom the Software is 13 | furnished to do so, subject to the following conditions: 14 | 15 | The above copyright notice and this permission notice shall be included in 16 | all copies or substantial portions of the Software. 17 | 18 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 19 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 20 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 21 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 22 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 23 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 24 | THE SOFTWARE. 25 | */ 26 | 27 | #ifndef FASTLZ_H 28 | #define FASTLZ_H 29 | 30 | #define FASTLZ_VERSION 0x000100 31 | 32 | #define FASTLZ_VERSION_MAJOR 0 33 | #define FASTLZ_VERSION_MINOR 0 34 | #define FASTLZ_VERSION_REVISION 0 35 | 36 | #define FASTLZ_VERSION_STRING "0.1.0" 37 | 38 | #if defined (__cplusplus) 39 | extern "C" { 40 | #endif 41 | 42 | /** 43 | Compress a block of data in the input buffer and returns the size of 44 | compressed block. The size of input buffer is specified by length. The 45 | minimum input buffer size is 16. 46 | 47 | The output buffer must be at least 5% larger than the input buffer 48 | and can not be smaller than 66 bytes. 49 | 50 | If the input is not compressible, the return value might be larger than 51 | length (input buffer size). 52 | 53 | The input buffer and the output buffer can not overlap. 54 | */ 55 | 56 | int fastlz_compress(const void* input, int length, void* output); 57 | 58 | /** 59 | Decompress a block of compressed data and returns the size of the 60 | decompressed block. If error occurs, e.g. the compressed data is 61 | corrupted or the output buffer is not large enough, then 0 (zero) 62 | will be returned instead. 63 | 64 | The input buffer and the output buffer can not overlap. 65 | 66 | Decompression is memory safe and guaranteed not to write the output buffer 67 | more than what is specified in maxout. 68 | */ 69 | 70 | int fastlz_decompress(const void* input, int length, void* output, int maxout); 71 | 72 | /** 73 | Compress a block of data in the input buffer and returns the size of 74 | compressed block. The size of input buffer is specified by length. The 75 | minimum input buffer size is 16. 76 | 77 | The output buffer must be at least 5% larger than the input buffer 78 | and can not be smaller than 66 bytes. 79 | 80 | If the input is not compressible, the return value might be larger than 81 | length (input buffer size). 82 | 83 | The input buffer and the output buffer can not overlap. 84 | 85 | Compression level can be specified in parameter level. At the moment, 86 | only level 1 and level 2 are supported. 87 | Level 1 is the fastest compression and generally useful for short data. 88 | Level 2 is slightly slower but it gives better compression ratio. 89 | 90 | Note that the compressed data, regardless of the level, can always be 91 | decompressed using the function fastlz_decompress above. 92 | */ 93 | 94 | int fastlz_compress_level(int level, const void* input, int length, void* output); 95 | 96 | #if defined (__cplusplus) 97 | } 98 | #endif 99 | 100 | #endif /* FASTLZ_H */ 101 | -------------------------------------------------------------------------------- /evobot/src/general_util.h: -------------------------------------------------------------------------------- 1 | // 2 | // EvoBot - Neoptolemus' Natural Selection bot, based on Botman's HPB bot template 3 | // 4 | // general_util.h 5 | // 6 | // Contains all useful helper functions for general plugin usage. 7 | // 8 | 9 | #pragma once 10 | 11 | #ifndef GENERAL_UTIL_H 12 | #define GENERAL_UTIL_H 13 | 14 | #include 15 | 16 | // Returns the mod directory (e.g. half-life/ns) 17 | void GetGameDir(char* game_dir); 18 | 19 | // Takes the game dir (see GetGameDir()) and appends the args to it. Does NOT append a / at the end 20 | void UTIL_BuildFileName(char* filename, const char* arg1, const char* arg2, const char* arg3, const char* arg4); 21 | 22 | 23 | // Draws a white line between start and end for the given player (pEntity) for 0.1s 24 | void UTIL_DrawLine(edict_t* pEntity, Vector start, Vector end); 25 | // Draws a white line between start and end for the given player (pEntity) for given number of seconds 26 | void UTIL_DrawLine(edict_t* pEntity, Vector start, Vector end, float drawTimeSeconds); 27 | // Draws a coloured line using RGB input, between start and end for the given player (pEntity) for 0.1s 28 | void UTIL_DrawLine(edict_t* pEntity, Vector start, Vector end, int r, int g, int b); 29 | // Draws a coloured line using RGB input, between start and end for the given player (pEntity) for given number of seconds 30 | void UTIL_DrawLine(edict_t* pEntity, Vector start, Vector end, float drawTimeSeconds, int r, int g, int b); 31 | 32 | void UTIL_DrawBox(edict_t* pEntity, Vector bMin, Vector bMax);; 33 | 34 | void UTIL_DrawBox(edict_t* pEntity, Vector bMin, Vector bMax, float drawTimeSeconds); 35 | 36 | void UTIL_DrawBox(edict_t* pEntity, Vector bMin, Vector bMax, float drawTimeSeconds, int r, int g, int b); 37 | 38 | // Draw a text message on the HUD. X and Y range from 0.0/0.0 (top left of screen) to 1.0/1.0 (bottom right) 39 | void UTIL_DrawHUDText(edict_t* pEntity, char channel, float x, float y, unsigned char r, unsigned char g, unsigned char b, const char* string); 40 | 41 | // new UTIL.CPP functions... 42 | edict_t* UTIL_FindEntityInSphere(edict_t* pentStart, const Vector& vecCenter, float flRadius); 43 | edict_t* UTIL_FindEntityByString(edict_t* pentStart, const char* szKeyword, const char* szValue); 44 | edict_t* UTIL_FindEntityByClassname(edict_t* pentStart, const char* szName); 45 | edict_t* UTIL_FindEntityByTarget(edict_t* pentStart, const char* szName); 46 | edict_t* UTIL_FindEntityByTargetname(edict_t* pentStart, const char* szName); 47 | 48 | void UTIL_HostSay(edict_t* pEntity, int teamonly, char* message); 49 | void UTIL_SayText(const char* pText, edict_t* pEdict); 50 | void ClientPrint(edict_t* pEntity, int msg_dest, const char* msg_name); 51 | 52 | // Performs a simple line trace between start and end, ignoring monsters and glass. Returns true if the trace does NOT hit anything. 53 | bool UTIL_QuickTrace(const edict_t* pEdict, const Vector& start, const Vector& end); 54 | // Performs a simple hull trace between start and end, ignoring monsters and using the requested hull index. Returns true if the trace does NOT hit anything. 55 | bool UTIL_QuickHullTrace(const edict_t* pEdict, const Vector& start, const Vector& end, int hullNum); 56 | // Performs a simple hull trace between start and end, ignoring monsters and using the visibility hull index. Returns true if the trace does NOT hit anything. 57 | bool UTIL_QuickHullTrace(const edict_t* pEdict, const Vector& start, const Vector& end); 58 | // Same as quick trace, but allows fAllSolid (since commander can place structures through walls) 59 | bool UTIL_CommanderTrace(const edict_t* pEdict, const Vector& start, const Vector& end); 60 | 61 | edict_t* UTIL_TraceEntity(const edict_t* pEdict, const Vector& start, const Vector& end); 62 | 63 | Vector UTIL_GetTraceHitLocation(const Vector Start, const Vector End); 64 | 65 | Vector UTIL_GetGroundLocation(const Vector CheckLocation); 66 | Vector UTIL_GetEntityGroundLocation(const edict_t* pEntity); 67 | Vector UTIL_GetCentreOfEntity(const edict_t* Entity); 68 | Vector UTIL_GetFloorUnderEntity(const edict_t* Edict); 69 | 70 | bool IsEdictStructure(const edict_t* edict); 71 | 72 | #endif -------------------------------------------------------------------------------- /evobot/metamod/mlist.h: -------------------------------------------------------------------------------- 1 | // vi: set ts=4 sw=4 : 2 | // vim: set tw=75 : 3 | 4 | // mlist.h - class and constants to describe a list of plugins 5 | 6 | /* 7 | * Copyright (c) 2001-2006 Will Day 8 | * 9 | * This file is part of Metamod. 10 | * 11 | * Metamod is free software; you can redistribute it and/or modify it 12 | * under the terms of the GNU General Public License as published by the 13 | * Free Software Foundation; either version 2 of the License, or (at 14 | * your option) any later version. 15 | * 16 | * Metamod is distributed in the hope that it will be useful, but 17 | * WITHOUT ANY WARRANTY; without even the implied warranty of 18 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 19 | * General Public License for more details. 20 | * 21 | * You should have received a copy of the GNU General Public License 22 | * along with Metamod; if not, write to the Free Software Foundation, 23 | * Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 24 | * 25 | * In addition, as a special exception, the author gives permission to 26 | * link the code of this program with the Half-Life Game Engine ("HL 27 | * Engine") and Modified Game Libraries ("MODs") developed by Valve, 28 | * L.L.C ("Valve"). You must obey the GNU General Public License in all 29 | * respects for all of the code used other than the HL Engine and MODs 30 | * from Valve. If you modify this file, you may extend this exception 31 | * to your version of the file, but you are not obligated to do so. If 32 | * you do not wish to do so, delete this exception statement from your 33 | * version. 34 | * 35 | */ 36 | 37 | #ifndef MLIST_H 38 | #define MLIST_H 39 | 40 | #include "types_meta.h" // mBOOL 41 | #include "mplugin.h" // class MPlugin 42 | #include "plinfo.h" // plid_t, etc 43 | #include "new_baseclass.h" 44 | 45 | // Max number of plugins we can manage. This is an arbitrary, fixed number, 46 | // for convenience. It would probably be better to dynamically grow the 47 | // list as needed, but we do this for now. 48 | #define MAX_PLUGINS 50 49 | // Width required to printf above MAX, for show() functions. 50 | #define WIDTH_MAX_PLUGINS 2 51 | 52 | 53 | // A list of plugins. 54 | class MPluginList : public class_metamod_new { 55 | public: 56 | // data: 57 | MPlugin plist[MAX_PLUGINS]; // array of plugins 58 | int size; // size of list, ie MAX_PLUGINS 59 | int endlist; // index of last used entry 60 | char inifile[PATH_MAX]; // full pathname 61 | 62 | // constructor: 63 | MPluginList(const char *ifile) DLLINTERNAL; 64 | 65 | // functions: 66 | void DLLINTERNAL reset_plugin(MPlugin *pl_find); 67 | MPlugin * DLLINTERNAL find(int pindex); // find by index 68 | MPlugin * DLLINTERNAL find(const char *findpath); // find by pathname 69 | MPlugin * DLLINTERNAL find(plid_t id); // find by plid_t 70 | MPlugin * DLLINTERNAL find(DLHANDLE handle); // find by handle 71 | MPlugin * DLLINTERNAL find_memloc(void *memptr); // find by memory location 72 | MPlugin * DLLINTERNAL find_match(const char *prefix); // find by partial prefix match 73 | MPlugin * DLLINTERNAL find_match(MPlugin *pmatch); // find by platform_match() 74 | MPlugin * DLLINTERNAL add(MPlugin *padd); 75 | 76 | mBOOL DLLINTERNAL found_child_plugins(int source_index); 77 | void DLLINTERNAL clear_source_plugin_index(int source_index); 78 | void DLLINTERNAL trim_list(void); 79 | 80 | mBOOL DLLINTERNAL ini_startup(void); // read inifile at startup 81 | mBOOL DLLINTERNAL ini_refresh(void); // re-read inifile 82 | mBOOL DLLINTERNAL cmd_addload(const char *args); // load from console command 83 | MPlugin * DLLINTERNAL plugin_addload(plid_t plid, const char *fname, PLUG_LOADTIME now); //load from plugin 84 | 85 | mBOOL DLLINTERNAL load(void); // load the list, at startup 86 | mBOOL DLLINTERNAL refresh(PLUG_LOADTIME now); // update from re-read inifile 87 | void DLLINTERNAL unpause_all(void); // unpause any paused plugins 88 | void DLLINTERNAL retry_all(PLUG_LOADTIME now); // retry any pending plugin actions 89 | void DLLINTERNAL show(int source_index); // list plugins to console 90 | void DLLINTERNAL show(void) { show(-1); }; // list plugins to console 91 | void DLLINTERNAL show_client(edict_t *pEntity); // list plugins to player client 92 | }; 93 | 94 | #endif /* MLIST_H */ 95 | -------------------------------------------------------------------------------- /evobot/metamod/linkent.h: -------------------------------------------------------------------------------- 1 | // vi: set ts=4 sw=4 : 2 | // vim: set tw=75 : 3 | 4 | // linkent.h - export entities from mod "games" back to the HL engine 5 | 6 | /* 7 | * Copyright (c) 2001-2006 Will Day 8 | * 9 | * This file is part of Metamod. 10 | * 11 | * Metamod is free software; you can redistribute it and/or modify it 12 | * under the terms of the GNU General Public License as published by the 13 | * Free Software Foundation; either version 2 of the License, or (at 14 | * your option) any later version. 15 | * 16 | * Metamod is distributed in the hope that it will be useful, but 17 | * WITHOUT ANY WARRANTY; without even the implied warranty of 18 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 19 | * General Public License for more details. 20 | * 21 | * You should have received a copy of the GNU General Public License 22 | * along with Metamod; if not, write to the Free Software Foundation, 23 | * Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 24 | * 25 | * In addition, as a special exception, the author gives permission to 26 | * link the code of this program with the Half-Life Game Engine ("HL 27 | * Engine") and Modified Game Libraries ("MODs") developed by Valve, 28 | * L.L.C ("Valve"). You must obey the GNU General Public License in all 29 | * respects for all of the code used other than the HL Engine and MODs 30 | * from Valve. If you modify this file, you may extend this exception 31 | * to your version of the file, but you are not obligated to do so. If 32 | * you do not wish to do so, delete this exception statement from your 33 | * version. 34 | * 35 | */ 36 | 37 | #ifndef LINK_ENT_H 38 | #define LINK_ENT_H 39 | 40 | #include // always 41 | 42 | #include "osdep.h" // DLLEXPORT, etc 43 | #include "metamod.h" // GameDLL, etc 44 | #include "mlist.h" // MPluginList::find_match, etc 45 | #include "mplugin.h" // MPlugin::info, etc 46 | #include "log_meta.h" // META_DEBUG, etc 47 | 48 | 49 | //Initializes replacement code 50 | int DLLINTERNAL init_linkent_replacement(DLHANDLE moduleMetamod, DLHANDLE moduleGame); 51 | 52 | 53 | // Comments from SDK dlls/util.h: 54 | //! This is the glue that hooks .MAP entity class names to our CPP classes. 55 | //! The _declspec forces them to be exported by name so we can do a lookup with GetProcAddress(). 56 | //! The function is used to intialize / allocate the object for the entity. 57 | 58 | // Adapted from LINK_ENTITY_TO_FUNC in adminmod linkfunc.cpp. 59 | 60 | typedef void (*ENTITY_FN) (entvars_t *); 61 | 62 | 63 | // For now, we have to explicitly export functions for plugin entities, 64 | // just as for gamedll entities. Ideally, this could be generalized in 65 | // some manner, so that plugins can declare and use their own entities 66 | // without having them explicitly supported by metamod, but I don't know 67 | // yet if that is actually possible. 68 | // 69 | // LINK_ENTITY_TO_PLUGIN 70 | // - if plugin not loaded & running, return 71 | // - plugin has to be set loadable=startup only, else log error, return 72 | // - (plugin loaded) if func missing, return 73 | // - (plugin loaded) if func not found, dlsym 74 | // - (plugin loaded) if func still not found, set missing, return 75 | // - (plugin loaded, func found) call func 76 | #define LINK_ENTITY_TO_PLUGIN(entityName, pluginName) \ 77 | C_DLLEXPORT void entityName(entvars_t *pev); \ 78 | void entityName(entvars_t *pev) { \ 79 | static ENTITY_FN pfnEntity = NULL; \ 80 | static int missing=0; \ 81 | char *entStr; \ 82 | MPlugin *findp; \ 83 | entStr = STRINGIZE(entityName, 0); \ 84 | if(missing) \ 85 | return; \ 86 | if(!pfnEntity) { \ 87 | if(!(findp=Plugins->find_match(pluginName))) { \ 88 | META_WARNING("Couldn't find loaded plugin '%s' for plugin entity '%s'", pluginName, entStr); \ 89 | missing=1; \ 90 | return; \ 91 | } \ 92 | if(findp->info && findp->info->loadable != PT_STARTUP) { \ 93 | META_WARNING("Can't link entity '%s' for plugin '%s'; loadable != startup: %s", entStr, pluginName, findp->str_loadable()); \ 94 | missing=1; \ 95 | return; \ 96 | } \ 97 | META_DEBUG(9, ("Looking up plugin entity '%s'", entStr)); \ 98 | pfnEntity = (ENTITY_FN) DLSYM(findp->handle, entStr); \ 99 | } \ 100 | if(!pfnEntity) { \ 101 | META_WARNING("Couldn't find plugin entity '%s' in plugin DLL '%s'", entStr, findp->file); \ 102 | missing=1; \ 103 | return; \ 104 | } \ 105 | META_DEBUG(8, ("Linking plugin entity '%s'", entStr)); \ 106 | (*pfnEntity)(pev); \ 107 | } 108 | 109 | #endif /* LINK_ENT_H */ 110 | -------------------------------------------------------------------------------- /evobot/HLSDK/common/entity_state.h: -------------------------------------------------------------------------------- 1 | /*** 2 | * 3 | * Copyright (c) 1999, 2000, Valve LLC. All rights reserved. 4 | * 5 | * This product contains software technology licensed from Id 6 | * Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc. 7 | * All Rights Reserved. 8 | * 9 | * Use, distribution, and modification of this source code and/or resulting 10 | * object code is restricted to non-commercial enhancements to products from 11 | * Valve LLC. All other use, distribution, or modification is prohibited 12 | * without written permission from Valve LLC. 13 | * 14 | ****/ 15 | #if !defined( ENTITY_STATEH ) 16 | #define ENTITY_STATEH 17 | #ifdef _WIN32 18 | #ifndef __MINGW32__ 19 | #pragma once 20 | #endif /* not __MINGW32__ */ 21 | #endif 22 | 23 | // For entityType below 24 | #define ENTITY_NORMAL (1<<0) 25 | #define ENTITY_BEAM (1<<1) 26 | 27 | // Entity state is used for the baseline and for delta compression of a packet of 28 | // entities that is sent to a client. 29 | typedef struct entity_state_s entity_state_t; 30 | 31 | struct entity_state_s 32 | { 33 | // Fields which are filled in by routines outside of delta compression 34 | int entityType; 35 | // Index into cl_entities array for this entity. 36 | int number; 37 | float msg_time; 38 | 39 | // Message number last time the player/entity state was updated. 40 | int messagenum; 41 | 42 | // Fields which can be transitted and reconstructed over the network stream 43 | vec3_t origin; 44 | vec3_t angles; 45 | 46 | int modelindex; 47 | int sequence; 48 | float frame; 49 | int colormap; 50 | short skin; 51 | short solid; 52 | int effects; 53 | float scale; 54 | 55 | byte eflags; 56 | 57 | // Render information 58 | int rendermode; 59 | int renderamt; 60 | color24 rendercolor; 61 | int renderfx; 62 | 63 | int movetype; 64 | float animtime; 65 | float framerate; 66 | int body; 67 | byte controller[4]; 68 | byte blending[4]; 69 | vec3_t velocity; 70 | 71 | // Send bbox down to client for use during prediction. 72 | vec3_t mins; 73 | vec3_t maxs; 74 | 75 | int aiment; 76 | // If owned by a player, the index of that player ( for projectiles ). 77 | int owner; 78 | 79 | // Friction, for prediction. 80 | float friction; 81 | // Gravity multiplier 82 | float gravity; 83 | 84 | // PLAYER SPECIFIC 85 | int team; 86 | int playerclass; 87 | int health; 88 | qboolean spectator; 89 | int weaponmodel; 90 | int gaitsequence; 91 | // If standing on conveyor, e.g. 92 | vec3_t basevelocity; 93 | // Use the crouched hull, or the regular player hull. 94 | int usehull; 95 | // Latched buttons last time state updated. 96 | int oldbuttons; 97 | // -1 = in air, else pmove entity number 98 | int onground; 99 | int iStepLeft; 100 | // How fast we are falling 101 | float flFallVelocity; 102 | 103 | float fov; 104 | int weaponanim; 105 | 106 | // Parametric movement overrides 107 | vec3_t startpos; 108 | vec3_t endpos; 109 | float impacttime; 110 | float starttime; 111 | 112 | // For mods 113 | int iuser1; 114 | int iuser2; 115 | int iuser3; 116 | int iuser4; 117 | float fuser1; 118 | float fuser2; 119 | float fuser3; 120 | float fuser4; 121 | vec3_t vuser1; 122 | vec3_t vuser2; 123 | vec3_t vuser3; 124 | vec3_t vuser4; 125 | }; 126 | 127 | #include "pm_info.h" 128 | 129 | typedef struct clientdata_s 130 | { 131 | vec3_t origin; 132 | vec3_t velocity; 133 | 134 | int viewmodel; 135 | vec3_t punchangle; 136 | int flags; 137 | int waterlevel; 138 | int watertype; 139 | vec3_t view_ofs; 140 | float health; 141 | 142 | int bInDuck; 143 | 144 | int weapons; // remove? 145 | 146 | int flTimeStepSound; 147 | int flDuckTime; 148 | int flSwimTime; 149 | int waterjumptime; 150 | 151 | float maxspeed; 152 | 153 | float fov; 154 | int weaponanim; 155 | 156 | int m_iId; 157 | int ammo_shells; 158 | int ammo_nails; 159 | int ammo_cells; 160 | int ammo_rockets; 161 | float m_flNextAttack; 162 | 163 | int tfstate; 164 | 165 | int pushmsec; 166 | 167 | int deadflag; 168 | 169 | char physinfo[ MAX_PHYSINFO_STRING ]; 170 | 171 | // For mods 172 | int iuser1; 173 | int iuser2; 174 | int iuser3; 175 | int iuser4; 176 | float fuser1; 177 | float fuser2; 178 | float fuser3; 179 | float fuser4; 180 | vec3_t vuser1; 181 | vec3_t vuser2; 182 | vec3_t vuser3; 183 | vec3_t vuser4; 184 | } clientdata_t; 185 | 186 | #include "weaponinfo.h" 187 | 188 | typedef struct local_state_s 189 | { 190 | entity_state_t playerstate; 191 | clientdata_t client; 192 | weapon_data_t weapondata[ 32 ]; 193 | } local_state_t; 194 | 195 | #endif // !ENTITY_STATEH 196 | -------------------------------------------------------------------------------- /evobot/HLSDK/common/mathlib.h: -------------------------------------------------------------------------------- 1 | /*** 2 | * 3 | * Copyright (c) 1996-2002, Valve LLC. All rights reserved. 4 | * 5 | * This product contains software technology licensed from Id 6 | * Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc. 7 | * All Rights Reserved. 8 | * 9 | * Use, distribution, and modification of this source code and/or resulting 10 | * object code is restricted to non-commercial enhancements to products from 11 | * Valve LLC. All other use, distribution, or modification is prohibited 12 | * without written permission from Valve LLC. 13 | * 14 | ****/ 15 | // mathlib.h 16 | 17 | typedef float vec_t; 18 | typedef vec_t vec3_t[3]; 19 | typedef vec_t vec4_t[4]; // x,y,z,w 20 | typedef vec_t vec5_t[5]; 21 | 22 | typedef short vec_s_t; 23 | typedef vec_s_t vec3s_t[3]; 24 | typedef vec_s_t vec4s_t[4]; // x,y,z,w 25 | typedef vec_s_t vec5s_t[5]; 26 | 27 | typedef int fixed4_t; 28 | typedef int fixed8_t; 29 | typedef int fixed16_t; 30 | 31 | #ifndef M_PI 32 | #define M_PI 3.14159265358979323846 // matches value in gcc v2 math.h 33 | #endif 34 | 35 | struct mplane_s; 36 | 37 | extern vec3_t vec3_origin; 38 | extern int nanmask; 39 | 40 | #define IS_NAN(x) (((*(int *)&x)&nanmask)==nanmask) 41 | 42 | #ifndef VECTOR_H 43 | #define DotProduct(x,y) ((x)[0]*(y)[0]+(x)[1]*(y)[1]+(x)[2]*(y)[2]) 44 | #endif 45 | 46 | #define VectorSubtract(a,b,c) {(c)[0]=(a)[0]-(b)[0];(c)[1]=(a)[1]-(b)[1];(c)[2]=(a)[2]-(b)[2];} 47 | #define VectorAdd(a,b,c) {(c)[0]=(a)[0]+(b)[0];(c)[1]=(a)[1]+(b)[1];(c)[2]=(a)[2]+(b)[2];} 48 | #define VectorCopy(a,b) {(b)[0]=(a)[0];(b)[1]=(a)[1];(b)[2]=(a)[2];} 49 | #define VectorClear(a) {(a)[0]=0.0;(a)[1]=0.0;(a)[2]=0.0;} 50 | 51 | void VectorMA (const vec3_t veca, float scale, const vec3_t vecb, vec3_t vecc); 52 | 53 | vec_t _DotProduct (vec3_t v1, vec3_t v2); 54 | void _VectorSubtract (vec3_t veca, vec3_t vecb, vec3_t out); 55 | void _VectorAdd (vec3_t veca, vec3_t vecb, vec3_t out); 56 | void _VectorCopy (vec3_t in, vec3_t out); 57 | 58 | int VectorCompare (const vec3_t v1, const vec3_t v2); 59 | float Length (const vec3_t v); 60 | void CrossProduct (const vec3_t v1, const vec3_t v2, vec3_t cross); 61 | float VectorNormalize (vec3_t v); // returns vector length 62 | void VectorInverse (vec3_t v); 63 | void VectorScale (const vec3_t in, vec_t scale, vec3_t out); 64 | int Q_log2(int val); 65 | 66 | void R_ConcatRotations (float in1[3][3], float in2[3][3], float out[3][3]); 67 | void R_ConcatTransforms (float in1[3][4], float in2[3][4], float out[3][4]); 68 | 69 | // Here are some "manual" INLINE routines for doing floating point to integer conversions 70 | extern short new_cw, old_cw; 71 | 72 | typedef union DLONG { 73 | int i[2]; 74 | double d; 75 | float f; 76 | } DLONG; 77 | 78 | extern DLONG dlong; 79 | 80 | #ifdef _WIN32 81 | void __inline set_fpu_cw(void) 82 | { 83 | _asm 84 | { wait 85 | fnstcw old_cw 86 | wait 87 | mov ax, word ptr old_cw 88 | or ah, 0xc 89 | mov word ptr new_cw,ax 90 | fldcw new_cw 91 | } 92 | } 93 | 94 | int __inline quick_ftol(float f) 95 | { 96 | _asm { 97 | // Assumes that we are already in chop mode, and only need a 32-bit int 98 | fld DWORD PTR f 99 | fistp DWORD PTR dlong 100 | } 101 | return dlong.i[0]; 102 | } 103 | 104 | void __inline restore_fpu_cw(void) 105 | { 106 | _asm fldcw old_cw 107 | } 108 | #else 109 | #define set_fpu_cw() /* */ 110 | #define quick_ftol(f) ftol(f) 111 | #define restore_fpu_cw() /* */ 112 | #endif 113 | 114 | void FloorDivMod (double numer, double denom, int *quotient, 115 | int *rem); 116 | fixed16_t Invert24To16(fixed16_t val); 117 | int GreatestCommonDivisor (int i1, int i2); 118 | 119 | void AngleVectors (const vec3_t angles, vec3_t forward, vec3_t right, vec3_t up); 120 | void AngleVectorsTranspose (const vec3_t angles, vec3_t forward, vec3_t right, vec3_t up); 121 | #define AngleIVectors AngleVectorsTranspose 122 | 123 | void AngleMatrix (const vec3_t angles, float (*matrix)[4] ); 124 | void AngleIMatrix (const vec3_t angles, float (*matrix)[4] ); 125 | void VectorTransform (const vec3_t in1, float in2[3][4], vec3_t out); 126 | 127 | void NormalizeAngles( vec3_t angles ); 128 | void InterpolateAngles( vec3_t start, vec3_t end, vec3_t output, float frac ); 129 | float AngleBetweenVectors( const vec3_t v1, const vec3_t v2 ); 130 | 131 | 132 | void VectorMatrix( vec3_t forward, vec3_t right, vec3_t up); 133 | void VectorAngles( const vec3_t forward, vec3_t angles ); 134 | 135 | int InvertMatrix( const float * m, float *out ); 136 | 137 | int BoxOnPlaneSide (vec3_t emins, vec3_t emaxs, struct mplane_s *plane); 138 | float anglemod(float a); 139 | 140 | 141 | 142 | #define BOX_ON_PLANE_SIDE(emins, emaxs, p) \ 143 | (((p)->type < 3)? \ 144 | ( \ 145 | ((p)->dist <= (emins)[(p)->type])? \ 146 | 1 \ 147 | : \ 148 | ( \ 149 | ((p)->dist >= (emaxs)[(p)->type])?\ 150 | 2 \ 151 | : \ 152 | 3 \ 153 | ) \ 154 | ) \ 155 | : \ 156 | BoxOnPlaneSide( (emins), (emaxs), (p))) 157 | -------------------------------------------------------------------------------- /evobot/metamod/log_meta.h: -------------------------------------------------------------------------------- 1 | // vi: set ts=4 sw=4 : 2 | // vim: set tw=75 : 3 | 4 | // log_meta.h - functions & macros for logging 5 | 6 | /* 7 | * Copyright (c) 2001-2006 Will Day 8 | * 9 | * This file is part of Metamod. 10 | * 11 | * Metamod is free software; you can redistribute it and/or modify it 12 | * under the terms of the GNU General Public License as published by the 13 | * Free Software Foundation; either version 2 of the License, or (at 14 | * your option) any later version. 15 | * 16 | * Metamod is distributed in the hope that it will be useful, but 17 | * WITHOUT ANY WARRANTY; without even the implied warranty of 18 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 19 | * General Public License for more details. 20 | * 21 | * You should have received a copy of the GNU General Public License 22 | * along with Metamod; if not, write to the Free Software Foundation, 23 | * Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 24 | * 25 | * In addition, as a special exception, the author gives permission to 26 | * link the code of this program with the Half-Life Game Engine ("HL 27 | * Engine") and Modified Game Libraries ("MODs") developed by Valve, 28 | * L.L.C ("Valve"). You must obey the GNU General Public License in all 29 | * respects for all of the code used other than the HL Engine and MODs 30 | * from Valve. If you modify this file, you may extend this exception 31 | * to your version of the file, but you are not obligated to do so. If 32 | * you do not wish to do so, delete this exception statement from your 33 | * version. 34 | * 35 | */ 36 | 37 | #ifndef LOG_META_H 38 | #define LOG_META_H 39 | 40 | #include "comp_dep.h" 41 | #include "osdep.h" //unlikely, OPEN_ARGS 42 | 43 | // Debug logging. 44 | // 45 | // This is done as a macro, rather than a function. This way, you can add 46 | // DEBUG statements all over, without worrying about performance 47 | // implications. If the debugging level is set low, all those statements 48 | // will only generate a simple float/int compare each; if we were to use a 49 | // function instead of a macro, it would end up wasting a lot of cpu cycles 50 | // calling/returning from the function every time. With a fair number of 51 | // DEBUG statements, or if they're placed in frequently excuted code, the 52 | // overhead of the wasted function calls could significantly impact server 53 | // performance. 54 | // 55 | // For this reason, we also compare directly to the float value of the 56 | // cvar, rather than calling CVAR_GET_FLOAT() and thus generating a string 57 | // compare for each DEBUG statement. 58 | // 59 | // Called as: 60 | // META_DEBUG(3, ("return code: %d", ret)); 61 | // 62 | // Note the double parens, and the missing parens around "args" in the 63 | // macro itself. Note also the "do..while(0)" loop wrapping the 64 | // statements, so they become a single statement when expanded, necessary 65 | // for times when it might be called as a single-statement result of an 66 | // else (or other flow control). 67 | // 68 | // Yes, it's all a bit of a hack. 69 | // 70 | // Using meta_debug_value instead of meta_debug.value. 71 | // meta_debug_value is preconverted int-value of meta_debug.value. 72 | // Reason for this optimization: Integer compare is much faster than float compare. 73 | // i686 has fast float compare, but since we want to have i386 binary, we use this. 74 | 75 | #ifdef __BUILD_FAST_METAMOD__ 76 | #define META_DEBUG(level, args) do { break; } while(0) 77 | #else 78 | #define META_DEBUG(level, args) \ 79 | do { \ 80 | if(unlikely(meta_debug_value >= level)) { \ 81 | META_DEBUG_SET_LEVEL(level); \ 82 | META_DO_DEBUG args; \ 83 | } \ 84 | } while(0) 85 | #endif 86 | 87 | // max buffer size for printed messages 88 | #define MAX_LOGMSG_LEN 1024 89 | 90 | // max buffer size for client messages 91 | #define MAX_CLIENTMSG_LEN 128 92 | 93 | extern cvar_t meta_debug DLLHIDDEN; 94 | extern int meta_debug_value DLLHIDDEN; 95 | 96 | // META_DEV provides debug logging via the cvar "developer" (when set to 1) 97 | // and uses a function call rather than a macro as it's really intended to 98 | // be used only during startup, before meta_debug has been set from reading 99 | // server.cfg. 100 | // NOTE: META_DEV has now been mostly obsoleted in the code. 101 | 102 | void DLLINTERNAL META_CONS(const char *fmt, ...); 103 | void DLLINTERNAL META_DEV(const char *fmt, ...); 104 | void DLLINTERNAL META_INFO(const char *fmt, ...); 105 | void DLLINTERNAL META_WARNING(const char *fmt, ...); 106 | void DLLINTERNAL META_ERROR(const char *fmt, ...); 107 | void DLLINTERNAL META_LOG(const char *fmt, ...); 108 | void DLLINTERNAL META_CLIENT(edict_t *pEntity, const char *fmt, ...); 109 | #ifndef __BUILD_FAST_METAMOD__ 110 | void DLLINTERNAL META_DEBUG_SET_LEVEL(int level); 111 | void DLLINTERNAL META_DO_DEBUG(const char *fmt, ...); 112 | #endif 113 | 114 | void DLLINTERNAL flush_ALERT_buffer(void); 115 | 116 | #endif /* LOG_META_H */ 117 | -------------------------------------------------------------------------------- /evobot/metamod/sdk_util.h: -------------------------------------------------------------------------------- 1 | // vi: set ts=4 sw=4 : 2 | // vim: set tw=75 : 3 | 4 | // sdk_util.h - wrapper & extension of util.h from HL SDK 5 | 6 | /* 7 | * Copyright (c) 2001-2006 Will Day 8 | * 9 | * This file is part of Metamod. 10 | * 11 | * Metamod is free software; you can redistribute it and/or modify it 12 | * under the terms of the GNU General Public License as published by the 13 | * Free Software Foundation; either version 2 of the License, or (at 14 | * your option) any later version. 15 | * 16 | * Metamod is distributed in the hope that it will be useful, but 17 | * WITHOUT ANY WARRANTY; without even the implied warranty of 18 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 19 | * General Public License for more details. 20 | * 21 | * You should have received a copy of the GNU General Public License 22 | * along with Metamod; if not, write to the Free Software Foundation, 23 | * Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 24 | * 25 | * In addition, as a special exception, the author gives permission to 26 | * link the code of this program with the Half-Life Game Engine ("HL 27 | * Engine") and Modified Game Libraries ("MODs") developed by Valve, 28 | * L.L.C ("Valve"). You must obey the GNU General Public License in all 29 | * respects for all of the code used other than the HL Engine and MODs 30 | * from Valve. If you modify this file, you may extend this exception 31 | * to your version of the file, but you are not obligated to do so. If 32 | * you do not wish to do so, delete this exception statement from your 33 | * version. 34 | * 35 | */ 36 | 37 | // Wrap util.h from SDK with ifndef/endif, to avoid problems from multiple 38 | // inclusions. Dunno why Valve didn't do that in util.h themselves.. 39 | 40 | #ifndef SDK_UTIL_H 41 | #define SDK_UTIL_H 42 | 43 | // We're not including the DBG_EntOfVars and DBG_AssertFunction routines 44 | // mentioned in the SDK util.h, so we're going to unset DEBUG here so that 45 | // we don't get "unresolved symbol" errors. 46 | #ifdef DEBUG 47 | #undef DEBUG 48 | #endif /* DEBUG */ 49 | 50 | #include "enginecallbacks.h" 51 | #include "comp_dep.h" 52 | #include 53 | 54 | 55 | // Also, create some additional macros for engine callback functions, which 56 | // weren't in SDK dlls/enginecallbacks.h but probably should have been. 57 | 58 | #define GET_INFOKEYBUFFER (*g_engfuncs.pfnGetInfoKeyBuffer) 59 | #define INFOKEY_VALUE (*g_engfuncs.pfnInfoKeyValue) 60 | #define SET_CLIENT_KEYVALUE (*g_engfuncs.pfnSetClientKeyValue) 61 | #define REG_SVR_COMMAND (*g_engfuncs.pfnAddServerCommand) 62 | #define SERVER_PRINT (*g_engfuncs.pfnServerPrint) 63 | #define SET_SERVER_KEYVALUE (*g_engfuncs.pfnSetKeyValue) 64 | #define QUERY_CLIENT_CVAR_VALUE (*g_engfuncs.pfnQueryClientCvarValue) 65 | #define QUERY_CLIENT_CVAR_VALUE2 (*g_engfuncs.pfnQueryClientCvarValue2) 66 | 67 | // Add overloaded ENTINDEX() version for const edict_t pointer. 68 | // The pfnIndexOfEdict() function takes a const edict_t pointer 69 | // as parameter anyway, so there is no reason why ENTINDEX() 70 | // shouldn't. 71 | inline int ENTINDEX(const edict_t *pEdict) { 72 | return((*g_engfuncs.pfnIndexOfEdict)(pEdict)); 73 | } 74 | 75 | 76 | // Also, create some nice inlines for engine callback combos. 77 | 78 | // Get a setinfo value from a player entity. 79 | inline char * DLLINTERNAL ENTITY_KEYVALUE(edict_t *entity, char *key) { 80 | return(INFOKEY_VALUE(GET_INFOKEYBUFFER(entity), key)); 81 | } 82 | 83 | // Set a setinfo value for a player entity. 84 | inline void DLLINTERNAL ENTITY_SET_KEYVALUE(edict_t *entity, char *key, char *value) { 85 | SET_CLIENT_KEYVALUE(ENTINDEX(entity), GET_INFOKEYBUFFER(entity), key, value); 86 | } 87 | 88 | // Get a "serverinfo" value. 89 | inline char * DLLINTERNAL SERVERINFO(char *key) { 90 | return(ENTITY_KEYVALUE(INDEXENT(0), key)); 91 | } 92 | 93 | // Set a "serverinfo" value. 94 | inline void DLLINTERNAL SET_SERVERINFO(char *key, char *value) { 95 | SET_SERVER_KEYVALUE(GET_INFOKEYBUFFER(INDEXENT(0)), key, value); 96 | } 97 | 98 | // Get a "localinfo" value. 99 | inline char * DLLINTERNAL LOCALINFO(char *key) { 100 | return(ENTITY_KEYVALUE(NULL, key)); 101 | } 102 | 103 | // Set a "localinfo" value. 104 | inline void DLLINTERNAL SET_LOCALINFO(char *key, char *value) { 105 | SET_SERVER_KEYVALUE(GET_INFOKEYBUFFER(NULL), key, value); 106 | } 107 | 108 | inline int DLLINTERNAL fast_FNullEnt(const edict_t* pent) { 109 | return(!pent || !(*g_engfuncs.pfnEntOffsetOfPEntity)(pent)); 110 | } 111 | 112 | // Our slightly modified version, using an edict_t pointer instead of a 113 | // CBaseEntity pointer. (was in 1.17p1, included in 1.17.1) 114 | void DLLINTERNAL META_UTIL_HudMessage(edict_t *pEntity, const hudtextparms_t &textparms, const char *pMessage); 115 | 116 | const char * DLLINTERNAL META_UTIL_VarArgs(const char *format, ...); 117 | 118 | short DLLINTERNAL FixedSigned16(float value, float scale); 119 | unsigned short DLLINTERNAL FixedUnsigned16(float value, float scale); 120 | 121 | #endif /* SDK_UTIL_H */ 122 | -------------------------------------------------------------------------------- /evobot/src/bot_config.h: -------------------------------------------------------------------------------- 1 | // 2 | // EvoBot - Neoptolemus' Natural Selection bot, based on Botman's HPB bot template 3 | // 4 | // bot_config.h 5 | // 6 | // Handles parsing of evobot.cfg and managing bot settings 7 | // 8 | 9 | #pragma once 10 | 11 | #ifndef BOT_CONFIG_H 12 | #define BOT_CONFIG_H 13 | 14 | #include "bot_structs.h" 15 | 16 | // Bot fill mode determines how bots should be automatically added/removed from teams 17 | typedef enum _BOTFILLMODE 18 | { 19 | BOTFILL_MANUAL = 0, // Manual, no automatic adding or removal of bots 20 | BOTFILL_BALANCEONLY, // Bots are automatically added/removed to ensure teams remain balanced 21 | BOTFILL_FILLTEAMS // Bots are automatically added/removed to ensure teams maintain a certain number of players (see TeamSizeDefinitions) 22 | 23 | } BotFillMode; 24 | 25 | // Bot commander mode, should the bot go commander and when 26 | typedef enum _COMMANDERMODE 27 | { 28 | COMMANDERMODE_NEVER = 0, // Bot never tries to command 29 | COMMANDERMODE_IFNOHUMAN, // Bot only commands if no human is on the marine team 30 | COMMANDERMODE_ALWAYS // Bot will always take command if no human does after CommanderWaitTime expires 31 | 32 | } CommanderMode; 33 | 34 | // Each map can have a desired marine and alien team size 35 | typedef struct _TEAMSIZEDEFINITIONS 36 | { 37 | int MarineSize = 6; 38 | int AlienSize = 6; 39 | } TeamSizeDefinitions; 40 | 41 | // Reads evobot.cfg in addons/evobot and populates all the settings from it 42 | void ParseConfigFile(bool bOverride); 43 | 44 | // Returns the current bot fill mode 45 | BotFillMode CONFIG_GetBotFillMode(); 46 | // Returns the current commander wait time is COMMANDERMODE_ALWAYS (see CONFIG_GetCommanderMode()) 47 | float CONFIG_GetCommanderWaitTime(); 48 | // Returns the current commander mode (see CommanderMode enum) 49 | CommanderMode CONFIG_GetCommanderMode(); 50 | // Returns the current lerk cooldown (how long aliens wait before evolving another lerk after the last one died) 51 | float CONFIG_GetLerkCooldown(); 52 | 53 | bool CONFIG_IsLerkAllowed(); 54 | bool CONFIG_IsFadeAllowed(); 55 | bool CONFIG_IsOnosAllowed(); 56 | 57 | // Returns the max time a bot is allowed to be stuck before suiciding (0 means forever) 58 | float CONFIG_GetMaxStuckTime(); 59 | 60 | // Returns the desired marine team size for the given map, indexes into TeamSizeMap 61 | int CONFIG_GetMarineTeamSizeForMap(const char* MapName); 62 | // Returns the desired alien team size for the given map, indexes into TeamSizeMap 63 | int CONFIG_GetAlienTeamSizeForMap(const char* MapName); 64 | 65 | // Will regenerate the existing evobot.cfg file in addons/evobot, overwrite any existing file. Useful if you've broken your current copy somehow 66 | void CONFIG_RegenerateConfigFile(); 67 | 68 | // If set to true, will ignore the configured settings in evobot.cfg and keep whatever settings are already in place. Useful if you want to temporarily disable bots or change settings for a match 69 | void CONFIG_SetConfigOverride(bool bNewValue); 70 | 71 | // Manually overrides the configured bot fill mode. Make sure config override is on. 72 | void CONFIG_SetBotFillMode(BotFillMode NewMode); 73 | 74 | // Manually overrides the configured commander mode. Make sure config override is on. 75 | void CONFIG_SetCommanderMode(CommanderMode NewMode); 76 | 77 | // Returns the configured NS version (32 or 33). Used in bot_client.cpp to determine how to process certain network messages. Will cause crashes if incorrectly set. 78 | int CONFIG_GetNSVersion(); 79 | 80 | // Populates the BotName input with a randomly-chosen name from the list (see evobot_names.txt) 81 | void CONFIG_GetBotName(char* BotName); 82 | 83 | // Reads evobot_names.txt and populates the bot_names array with all the names it finds. If file is missing, will populate it with just "Bot" 84 | void CONFIG_PopulateBotNames(); 85 | 86 | // Some official NS maps use a lookup system to resolve location names held in the BSP file to descriptive names held in titles.txt. This performs that lookup 87 | void UTIL_LookUpLocationName(const char* InputName, char* Result); 88 | 89 | // Returns the configured hive tech at that index (chamber build sequence) 90 | int CONFIG_GetHiveTechAtIndex(const int Index); 91 | 92 | // Manually set the marine team size. Used by the "evobot fillteams" console command. Make sure config override is on. 93 | void CONFIG_SetManualMarineTeamSize(const int NewValue); 94 | // Manually set the alien team size. Used by the "evobot fillteams" console command. Make sure config override is on. 95 | void CONFIG_SetManualAlienTeamSize(const int NewValue); 96 | 97 | // Returns the manually-set marine team size when using "evobot fillteams" 98 | int CONFIG_GetManualMarineTeamSize(); 99 | // Returns the manually-set alien team size when using "evobot fillteams" 100 | int CONFIG_GetManualAlienTeamSize(); 101 | 102 | bot_skill CONFIG_GetBotSkillLevel(const char* SkillName); 103 | 104 | bool CONFIG_BotSkillLevelExists(const char* SkillName); 105 | 106 | bot_skill CONFIG_GetGlobalBotSkillLevel(); 107 | void CONFIG_SetGlobalBotSkillLevel(const char* NewSkillLevel); 108 | 109 | void CONFIG_PrintHelpFile(); 110 | 111 | #endif -------------------------------------------------------------------------------- /evobot/metamod/mutil.h: -------------------------------------------------------------------------------- 1 | // vi: set ts=4 sw=4 : 2 | // vim: set tw=75 : 3 | 4 | // mutil.h - prototypes for utility functions to provide to plugins 5 | 6 | /* 7 | * Copyright (c) 2001-2006 Will Day 8 | * 9 | * This file is part of Metamod. 10 | * 11 | * Metamod is free software; you can redistribute it and/or modify it 12 | * under the terms of the GNU General Public License as published by the 13 | * Free Software Foundation; either version 2 of the License, or (at 14 | * your option) any later version. 15 | * 16 | * Metamod is distributed in the hope that it will be useful, but 17 | * WITHOUT ANY WARRANTY; without even the implied warranty of 18 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 19 | * General Public License for more details. 20 | * 21 | * You should have received a copy of the GNU General Public License 22 | * along with Metamod; if not, write to the Free Software Foundation, 23 | * Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 24 | * 25 | * In addition, as a special exception, the author gives permission to 26 | * link the code of this program with the Half-Life Game Engine ("HL 27 | * Engine") and Modified Game Libraries ("MODs") developed by Valve, 28 | * L.L.C ("Valve"). You must obey the GNU General Public License in all 29 | * respects for all of the code used other than the HL Engine and MODs 30 | * from Valve. If you modify this file, you may extend this exception 31 | * to your version of the file, but you are not obligated to do so. If 32 | * you do not wish to do so, delete this exception statement from your 33 | * version. 34 | * 35 | */ 36 | 37 | #ifndef MUTIL_H 38 | #define MUTIL_H 39 | 40 | #include "comp_dep.h" 41 | #include "plinfo.h" // plugin_info_t, etc 42 | #include "mhook.h" // game_event_t, etc 43 | #include "sdk_util.h" // hudtextparms_t, etc 44 | 45 | // max buffer size for printed messages 46 | #define MAX_LOGMSG_LEN 1024 47 | 48 | // For GetGameInfo: 49 | typedef enum { 50 | GINFO_NAME = 0, 51 | GINFO_DESC, 52 | GINFO_GAMEDIR, 53 | GINFO_DLL_FULLPATH, 54 | GINFO_DLL_FILENAME, 55 | GINFO_REALDLL_FULLPATH, 56 | } ginfo_t; 57 | 58 | // Meta Utility Function table type. 59 | typedef struct meta_util_funcs_s { 60 | void (*pfnLogConsole) (plid_t plid, const char *fmt, ...); 61 | void (*pfnLogMessage) (plid_t plid, const char *fmt, ...); 62 | void (*pfnLogError) (plid_t plid, const char *fmt, ...); 63 | void (*pfnLogDeveloper) (plid_t plid, const char *fmt, ...); 64 | void (*pfnCenterSay) (plid_t plid, const char *fmt, ...); 65 | void (*pfnCenterSayParms) (plid_t plid, hudtextparms_t tparms, 66 | const char *fmt, ...); 67 | void (*pfnCenterSayVarargs) (plid_t plid, hudtextparms_t tparms, 68 | const char *fmt, va_list ap); 69 | qboolean (*pfnCallGameEntity) (plid_t plid, const char *entStr, 70 | entvars_t *pev); 71 | int (*pfnGetUserMsgID) (plid_t plid, const char *msgname, int *size); 72 | const char *(*pfnGetUserMsgName) (plid_t plid, int msgid, int *size); 73 | const char *(*pfnGetPluginPath) (plid_t plid); 74 | const char *(*pfnGetGameInfo) (plid_t plid, ginfo_t tag); 75 | 76 | int (*pfnLoadPlugin)(plid_t plid, const char *cmdline, PLUG_LOADTIME now, void **plugin_handle); 77 | int (*pfnUnloadPlugin)(plid_t plid, const char *cmdline, PLUG_LOADTIME now, PL_UNLOAD_REASON reason); 78 | int (*pfnUnloadPluginByHandle)(plid_t plid, void *plugin_handle, PLUG_LOADTIME now, PL_UNLOAD_REASON reason); 79 | 80 | const char *(*pfnIsQueryingClientCvar) (plid_t plid, const edict_t *player); 81 | 82 | int (*pfnMakeRequestID) (plid_t plid); 83 | 84 | void (*pfnGetHookTables) (plid_t plid, enginefuncs_t **peng, DLL_FUNCTIONS **pdll, NEW_DLL_FUNCTIONS **pnewdll); 85 | } mutil_funcs_t; 86 | extern mutil_funcs_t MetaUtilFunctions DLLHIDDEN; 87 | 88 | // Convenience macros for MetaUtil functions 89 | #define LOG_CONSOLE (*gpMetaUtilFuncs->pfnLogConsole) 90 | #define LOG_MESSAGE (*gpMetaUtilFuncs->pfnLogMessage) 91 | #define LOG_ERROR (*gpMetaUtilFuncs->pfnLogError) 92 | #define LOG_DEVELOPER (*gpMetaUtilFuncs->pfnLogDeveloper) 93 | #define CENTER_SAY (*gpMetaUtilFuncs->pfnCenterSay) 94 | #define CENTER_SAY_PARMS (*gpMetaUtilFuncs->pfnCenterSayParms) 95 | #define CENTER_SAY_VARARGS (*gpMetaUtilFuncs->pfnCenterSayVarargs) 96 | #define CALL_GAME_ENTITY (*gpMetaUtilFuncs->pfnCallGameEntity) 97 | #define GET_USER_MSG_ID (*gpMetaUtilFuncs->pfnGetUserMsgID) 98 | #define GET_USER_MSG_NAME (*gpMetaUtilFuncs->pfnGetUserMsgName) 99 | #define GET_PLUGIN_PATH (*gpMetaUtilFuncs->pfnGetPluginPath) 100 | #define GET_GAME_INFO (*gpMetaUtilFuncs->pfnGetGameInfo) 101 | #define LOAD_PLUGIN (*gpMetaUtilFuncs->pfnLoadPlugin) 102 | #define UNLOAD_PLUGIN (*gpMetaUtilFuncs->pfnUnloadPlugin) 103 | #define UNLOAD_PLUGIN_BY_HANDLE (*gpMetaUtilFuncs->pfnUnloadPluginByHandle) 104 | #define IS_QUERYING_CLIENT_CVAR (*gpMetaUtilFuncs->pfnIsQueryingClientCvar) 105 | #define MAKE_REQUESTID (*gpMetaUtilFuncs->pfnMakeRequestID) 106 | #define GET_HOOK_TABLES (*gpMetaUtilFuncs->pfnGetHookTables) 107 | 108 | #endif /* MUTIL_H */ 109 | -------------------------------------------------------------------------------- /evobot/metamod/mm_pextensions.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2004-2006 Jussi Kivilinna 3 | * 4 | * This file is part of "Metamod All-Mod-Support"-patch for Metamod. 5 | * 6 | * Metamod is free software; you can redistribute it and/or modify it 7 | * under the terms of the GNU General Public License as published by the 8 | * Free Software Foundation; either version 2 of the License, or (at 9 | * your option) any later version. 10 | * 11 | * Metamod is distributed in the hope that it will be useful, but 12 | * WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 | * General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with Metamod; if not, write to the Free Software Foundation, 18 | * Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 19 | * 20 | * In addition, as a special exception, the author gives permission to 21 | * link the code of this program with the Half-Life Game Engine ("HL 22 | * Engine") and Modified Game Libraries ("MODs") developed by Valve, 23 | * L.L.C ("Valve"). You must obey the GNU General Public License in all 24 | * respects for all of the code used other than the HL Engine and MODs 25 | * from Valve. If you modify this file, you may extend this exception 26 | * to your version of the file, but you are not obligated to do so. If 27 | * you do not wish to do so, delete this exception statement from your 28 | * version. 29 | * 30 | */ 31 | 32 | #ifndef MM_PEXTENSIONS_H 33 | #define MM_PEXTENSIONS_H 34 | 35 | #include "plinfo.h" // plid_t 36 | #include "meta_api.h" // PLUG_LOADTIME 37 | /* 38 | 39 | How to use: 40 | 1. Add new export function 'Meta_PExtGiveFnptrs' to your plugin file. 41 | 'Meta_PExtGiveFnptrs' will be called right after 'Meta_Query' call. 42 | 2. Meta_PExtGiveFnptrs is called with interface version 'META_PEXT_VERSION' 43 | and pointer to extension function table. 44 | 3. Meta_PExtGiveFnptrs should return plugin's interface version. 45 | 4. !NOTE! Metamod will not stop loading plugin even if plugin returns 46 | interface version greater than current. Plugin should disable itself in 47 | this kind of situation. 48 | 49 | Example: 50 | #include "mm_pextensions.h" 51 | 52 | pextension_funcs_t *gpMetaPExtFuncs; 53 | 54 | int Meta_PExtGiveFnptrs(int interfaceVersion, pextension_funcs_t *pMetaPExtFuncs) { 55 | if(interfaceVersion < META_PEXT_VERSION) { 56 | LOG_DEVELOPER(PLID, "Error! Metamod is too old, please update!"); 57 | gpMetaPExtFuncs = NULL; 58 | 59 | return(META_PEXT_VERSION); 60 | } 61 | 62 | gpMetaPExtFuncs = pMetaPExtFuncs; 63 | 64 | return(META_PEXT_VERSION); 65 | } 66 | 67 | Callback functions: 68 | - int PEXT_LOAD_PLUGIN_BY_NAME(PLID, const char *cmdline, PLUG_LOADTIME now, void **plugin_handle); 69 | Parses 'cmdline' as metamod would parse 'meta load ' and loads found 70 | plugin. If 'plugin_handle' is set, metamod writes module handle of loaded 71 | plugin at it. 72 | Returns zero on success. 73 | For error codes see 'META_ERRNO' in 'types_meta.h'. 74 | 75 | - int PEXT_UNLOAD_PLUGIN_BY_NAME(PLID, const char *cmdline, PLUG_LOADTIME now, PL_UNLOAD_REASON reason); 76 | Parses 'cmdline' as metamod would parse 'meta unload ' and 77 | unloads found plugin. 78 | Returns zero on success. 79 | For error codes see 'META_ERRNO' in 'types_meta.h'. 80 | 81 | - int PEXT_UNLOAD_PLUGIN_BY_HANDLE(PLID, void *plugin_handle, PLUG_LOADTIME now, PL_UNLOAD_REASON reason); 82 | Unloads plugin with 'plugin_handle'. 83 | Returns zero on success. 84 | For error codes see 'META_ERRNO' in 'types_meta.h'. 85 | 86 | !NOTE! Plugin cannot unload itself! 87 | */ 88 | 89 | // Interface version 90 | // 1: first version. Used in p13 91 | // 2: Complete remake (p14): 92 | // pfnLoadMetaPluginByName 93 | // pfnUnloadMetaPluginByName 94 | // pfnUnloadMetaPluginByHandle 95 | // v2 is locked now. Don't modify old functions. If you add new functions, increase META_PEXT_VERSION. 96 | #define META_PEXT_VERSION 2 97 | 98 | // Meta PExtension Function table type. 99 | typedef struct pextension_funcs_s { 100 | int (*pfnLoadMetaPluginByName)(plid_t plid, const char *cmdline, PLUG_LOADTIME now, void **plugin_handle); 101 | int (*pfnUnloadMetaPluginByName)(plid_t plid, const char *cmdline, PLUG_LOADTIME now, PL_UNLOAD_REASON reason); 102 | int (*pfnUnloadMetaPluginByHandle)(plid_t plid, void *plugin_handle, PLUG_LOADTIME now, PL_UNLOAD_REASON reason); 103 | } pextension_funcs_t; 104 | 105 | // Convenience macros for MetaPExtension functions. 106 | #define PEXT_LOAD_PLUGIN_BY_NAME (*gpMetaPExtFuncs->pfnLoadMetaPluginByName) 107 | #define PEXT_UNLOAD_PLUGIN_BY_NAME (*gpMetaPExtFuncs->pfnUnloadMetaPluginByName) 108 | #define PEXT_UNLOAD_PLUGIN_BY_HANDLE (*gpMetaPExtFuncs->pfnUnloadMetaPluginByHandle) 109 | 110 | // Give plugin extension function table. 111 | C_DLLEXPORT int Meta_PExtGiveFnptrs(int interfaceVersion, 112 | pextension_funcs_t *pMetaPExtFuncs); 113 | typedef int (*META_GIVE_PEXT_FUNCTIONS_FN) (int interfaceVersion, 114 | pextension_funcs_t *pMetaPExtFuncs); 115 | 116 | #endif /* MM_PEXTENSIONS_H */ 117 | -------------------------------------------------------------------------------- /evobot/src/meta_api.cpp: -------------------------------------------------------------------------------- 1 | // vi: set ts=4 sw=4 : 2 | // vim: set tw=75 : 3 | 4 | // meta_api.cpp - minimal implementation of metamod's plugin interface 5 | 6 | // This is intended to illustrate the (more or less) bare minimum code 7 | // required for a valid metamod plugin, and is targeted at those who want 8 | // to port existing HL/SDK DLL code to run as a metamod plugin. 9 | 10 | /* 11 | * Copyright (c) 2001-2006 Will Day 12 | * 13 | * This file is part of Metamod. 14 | * 15 | * Metamod is free software; you can redistribute it and/or modify it 16 | * under the terms of the GNU General Public License as published by the 17 | * Free Software Foundation; either version 2 of the License, or (at 18 | * your option) any later version. 19 | * 20 | * Metamod is distributed in the hope that it will be useful, but 21 | * WITHOUT ANY WARRANTY; without even the implied warranty of 22 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 23 | * General Public License for more details. 24 | * 25 | * You should have received a copy of the GNU General Public License 26 | * along with Metamod; if not, write to the Free Software Foundation, 27 | * Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 28 | * 29 | * In addition, as a special exception, the author gives permission to 30 | * link the code of this program with the Half-Life Game Engine ("HL 31 | * Engine") and Modified Game Libraries ("MODs") developed by Valve, 32 | * L.L.C ("Valve"). You must obey the GNU General Public License in all 33 | * respects for all of the code used other than the HL Engine and MODs 34 | * from Valve. If you modify this file, you may extend this exception 35 | * to your version of the file, but you are not obligated to do so. If 36 | * you do not wish to do so, delete this exception statement from your 37 | * version. 38 | * 39 | */ 40 | 41 | #include // always 42 | 43 | #include // of course 44 | 45 | #include "sdk_util.h" // UTIL_LogPrintf, etc 46 | #include "general_util.h" 47 | #include "game_state.h" 48 | 49 | // Must provide at least one of these.. 50 | static META_FUNCTIONS gMetaFunctionTable = { 51 | NULL, // pfnGetEntityAPI HL SDK; called before game DLL 52 | NULL, // pfnGetEntityAPI_Post META; called after game DLL 53 | GetEntityAPI2, // pfnGetEntityAPI2 HL SDK2; called before game DLL 54 | NULL, // pfnGetEntityAPI2_Post META; called after game DLL 55 | NULL, // pfnGetNewDLLFunctions HL SDK2; called before game DLL 56 | NULL, // pfnGetNewDLLFunctions_Post META; called after game DLL 57 | GetEngineFunctions, // pfnGetEngineFunctions META; called before HL engine 58 | NULL, // pfnGetEngineFunctions_Post META; called after HL engine 59 | }; 60 | 61 | // Description of plugin 62 | plugin_info_t Plugin_info = { 63 | META_INTERFACE_VERSION, // ifvers 64 | "Evobot", // name 65 | "1.1.1", // version 66 | __DATE__, // date 67 | "Richard Greenlees", // author 68 | "https://github.com/RGreenlees/evobot_mm", // url 69 | "EVOBOT", // logtag, all caps please 70 | PT_STARTUP, // (when) loadable 71 | PT_ANYTIME, // (when) unloadable 72 | }; 73 | 74 | // Global vars from metamod: 75 | meta_globals_t *gpMetaGlobals; // metamod globals 76 | gamedll_funcs_t *gpGamedllFuncs; // gameDLL function tables 77 | mutil_funcs_t *gpMetaUtilFuncs; // metamod utility functions 78 | 79 | // Metamod requesting info about this plugin: 80 | // ifvers (given) interface_version metamod is using 81 | // pPlugInfo (requested) struct with info about plugin 82 | // pMetaUtilFuncs (given) table of utility functions provided by metamod 83 | C_DLLEXPORT int Meta_Query(char * /*ifvers */, plugin_info_t **pPlugInfo, 84 | mutil_funcs_t *pMetaUtilFuncs) 85 | { 86 | // Give metamod our plugin_info struct 87 | *pPlugInfo=&Plugin_info; 88 | // Get metamod utility function table. 89 | gpMetaUtilFuncs=pMetaUtilFuncs; 90 | return(TRUE); 91 | } 92 | 93 | 94 | 95 | // Metamod attaching plugin to the server. 96 | // now (given) current phase, ie during map, during changelevel, or at startup 97 | // pFunctionTable (requested) table of function tables this plugin catches 98 | // pMGlobals (given) global vars from metamod 99 | // pGamedllFuncs (given) copy of function tables from game dll 100 | C_DLLEXPORT int Meta_Attach(PLUG_LOADTIME /* now */, 101 | META_FUNCTIONS *pFunctionTable, meta_globals_t *pMGlobals, 102 | gamedll_funcs_t *pGamedllFuncs) 103 | { 104 | if(!pMGlobals) { 105 | LOG_ERROR(PLID, "Meta_Attach called with null pMGlobals"); 106 | return(FALSE); 107 | } 108 | gpMetaGlobals=pMGlobals; 109 | if(!pFunctionTable) { 110 | LOG_ERROR(PLID, "Meta_Attach called with null pFunctionTable"); 111 | return(FALSE); 112 | } 113 | memcpy(pFunctionTable, &gMetaFunctionTable, sizeof(META_FUNCTIONS)); 114 | gpGamedllFuncs=pGamedllFuncs; 115 | 116 | // ask the engine to register the server commands this plugin uses 117 | REG_SVR_COMMAND("evobot", EvoBot_ServerCommand); 118 | 119 | return(TRUE); 120 | } 121 | 122 | // Metamod detaching plugin from the server. 123 | // now (given) current phase, ie during map, etc 124 | // reason (given) why detaching (refresh, console unload, forced unload, etc) 125 | C_DLLEXPORT int Meta_Detach(PLUG_LOADTIME /* now */, 126 | PL_UNLOAD_REASON /* reason */) 127 | { 128 | return(TRUE); 129 | } 130 | --------------------------------------------------------------------------------