From 9bea4a32a350a629532b33ae7e4856dff789f42f Mon Sep 17 00:00:00 2001 From: g-cont Date: Mon, 12 Jan 2009 00:00:00 +0300 Subject: [PATCH] 12 Jan 2009 --- backup.lst | 25 +- baserc/baserc.dsp | 4 +- client/client.dsp | 4 +- client/global/dll_int.cpp | 4 +- client/global/enginecallback.h | 1 + client/global/extdll.h | 9 +- client/global/tempents.cpp | 1 + client/global/view.cpp | 1 + client/hud/hud_zoom.cpp | 1 + common/basetypes.h | 33 ++ {public => common}/clgame_api.h | 188 +++-------- {public => common}/const.h | 165 +++------- common/effects_api.h | 13 + {public => common}/entity_def.h | 6 +- common/entity_state.h | 99 ++++++ common/event_api.h | 51 +++ common/game_shared.h | 36 +++ common/ref_params.h | 57 ++++ common/studio_event.h | 16 + common/studio_ref.h | 337 +++++++++++++++++++ {public => common}/svgame_api.h | 52 +-- common/trace_def.h | 75 +++++ common/triangle_api.h | 49 +++ debug.bat | 8 +- engine/client/cl_game.c | 178 +++++++++- engine/client/cl_parse.c | 13 + engine/client/cl_phys.c | 35 ++ engine/client/cl_view.c | 3 +- engine/client/client.h | 8 +- engine/common.h | 5 + engine/common/engfuncs.c | 13 +- engine/common/net_msg.c | 6 +- engine/common/net_msg.h | 62 +--- engine/engine.dsp | 4 +- engine/host.c | 6 +- engine/server/sv_game.c | 88 +++-- engine/server/sv_main.c | 5 +- engine/server/sv_phys.c | 14 +- launch/launch.dsp | 4 +- launch/launch.h | 2 +- launch/system.c | 16 +- physic/cm_local.h | 1 + physic/physic.dsp | 4 +- public/launch_api.h | 25 +- public/qfiles_ref.h | 374 +--------------------- public/render_api.h | 4 +- public/vsound_api.h | 2 + release.bat | 8 +- render/r_backend2.c | 4 +- render/r_image.c | 2 +- render/r_light.c | 4 +- render/r_local.h | 1 + render/r_main.c | 12 +- render/r_shader.h | 2 +- render/r_studio.c | 2 +- render/r_surface.c | 2 +- render/render.dsp | 4 +- server/cbase.h | 2 +- server/ents/baseentity.h | 3 +- server/ents/basefunc.cpp | 2 +- server/ents/basemover.cpp | 10 +- server/ents/basepath.cpp | 8 +- server/game/game.cpp | 7 +- server/game/game.h | 1 + server/game/gamerules.cpp | 2 +- server/game/multiplay_gamerules.cpp | 4 +- server/game/sound.cpp | 16 +- server/global/client.cpp | 8 + server/global/defaults.h | 4 +- server/global/dll_int.cpp | 27 +- server/global/enginecallback.h | 7 +- server/global/extdll.h | 53 ++- server/global/globals.h | 2 + server/global/saverestore.cpp | 4 +- server/global/utils.cpp | 27 +- server/global/utils.h | 8 + server/monsters/ai_sound.cpp | 16 +- server/monsters/animation.cpp | 4 +- server/monsters/barney.cpp | 4 +- server/monsters/basemonster.cpp | 16 +- server/monsters/defaultai.cpp | 6 +- server/monsters/generic.cpp | 8 +- server/monsters/hgrunt.cpp | 8 +- server/monsters/nodes.cpp | 31 +- server/monsters/osprey.cpp | 6 +- server/monsters/player.cpp | 20 +- server/monsters/roach.cpp | 6 +- server/monsters/scientist.cpp | 12 +- server/monsters/scripted.cpp | 27 +- server/monsters/squadmonster.cpp | 2 +- server/server.def | 2 +- server/server.dsp | 4 +- todo.log | 32 +- vprogs/vprogs.dsp | 4 +- vsound/s_main.c | 1 + vsound/vsound.dsp | 4 +- xash.dsw | 2 +- {common => xtools}/bsplib/ambient.c | 0 {common => xtools}/bsplib/anorms.h | 0 {common => xtools}/bsplib/brushbsp.c | 0 {common => xtools}/bsplib/bspfile.c | 0 {common => xtools}/bsplib/bsplib.c | 0 {common => xtools}/bsplib/bsplib.h | 3 +- {common => xtools}/bsplib/csg.c | 0 {common => xtools}/bsplib/faces.c | 0 {common => xtools}/bsplib/flow.c | 0 {common => xtools}/bsplib/leakfile.c | 0 {common => xtools}/bsplib/lightmap.c | 0 {common => xtools}/bsplib/map.c | 0 {common => xtools}/bsplib/patches.c | 0 {common => xtools}/bsplib/portals.c | 0 {common => xtools}/bsplib/prtfile.c | 0 {common => xtools}/bsplib/qbsp3.c | 0 {common => xtools}/bsplib/qrad3.c | 0 {common => xtools}/bsplib/qvis3.c | 0 {common => xtools}/bsplib/shaders.c | 0 {common => xtools}/bsplib/textures.c | 0 {common => xtools}/bsplib/trace.c | 0 {common => xtools}/bsplib/tree.c | 0 {common => xtools}/bsplib/winding.c | 0 {common => xtools}/bsplib/writebsp.c | 0 {common => xtools}/dpvencoder.c | 2 +- {common => xtools}/mdllib.h | 2 +- {common => xtools}/ripper/conv_bsplumps.c | 0 {common => xtools}/ripper/conv_doom.c | 0 {common => xtools}/ripper/conv_image.c | 0 {common => xtools}/ripper/conv_main.c | 0 {common => xtools}/ripper/conv_shader.c | 0 {common => xtools}/ripper/conv_sprite.c | 0 {common => xtools}/ripper/ripper.h | 2 +- {common => xtools}/spritegen.c | 2 +- {common => xtools}/studio.c | 0 {common => xtools}/studio_utils.c | 0 {common => xtools}/utils.c | 2 +- {common => xtools}/utils.h | 0 {common => xtools}/wadlib.c | 2 +- common/platform.c => xtools/xtools.c | 2 +- common/common.dsp => xtools/xtools.dsp | 64 ++-- common/platform.h => xtools/xtools.h | 8 +- 139 files changed, 1526 insertions(+), 1121 deletions(-) create mode 100644 common/basetypes.h rename {public => common}/clgame_api.h (51%) rename {public => common}/const.h (62%) create mode 100644 common/effects_api.h rename {public => common}/entity_def.h (92%) create mode 100644 common/entity_state.h create mode 100644 common/event_api.h create mode 100644 common/game_shared.h create mode 100644 common/ref_params.h create mode 100644 common/studio_event.h create mode 100644 common/studio_ref.h rename {public => common}/svgame_api.h (89%) create mode 100644 common/trace_def.h create mode 100644 common/triangle_api.h rename {common => xtools}/bsplib/ambient.c (100%) rename {common => xtools}/bsplib/anorms.h (100%) rename {common => xtools}/bsplib/brushbsp.c (100%) rename {common => xtools}/bsplib/bspfile.c (100%) rename {common => xtools}/bsplib/bsplib.c (100%) rename {common => xtools}/bsplib/bsplib.h (95%) rename {common => xtools}/bsplib/csg.c (100%) rename {common => xtools}/bsplib/faces.c (100%) rename {common => xtools}/bsplib/flow.c (100%) rename {common => xtools}/bsplib/leakfile.c (100%) rename {common => xtools}/bsplib/lightmap.c (100%) rename {common => xtools}/bsplib/map.c (100%) rename {common => xtools}/bsplib/patches.c (100%) rename {common => xtools}/bsplib/portals.c (100%) rename {common => xtools}/bsplib/prtfile.c (100%) rename {common => xtools}/bsplib/qbsp3.c (100%) rename {common => xtools}/bsplib/qrad3.c (100%) rename {common => xtools}/bsplib/qvis3.c (100%) rename {common => xtools}/bsplib/shaders.c (100%) rename {common => xtools}/bsplib/textures.c (100%) rename {common => xtools}/bsplib/trace.c (100%) rename {common => xtools}/bsplib/tree.c (100%) rename {common => xtools}/bsplib/winding.c (100%) rename {common => xtools}/bsplib/writebsp.c (100%) rename {common => xtools}/dpvencoder.c (91%) rename {common => xtools}/mdllib.h (94%) rename {common => xtools}/ripper/conv_bsplumps.c (100%) rename {common => xtools}/ripper/conv_doom.c (100%) rename {common => xtools}/ripper/conv_image.c (100%) rename {common => xtools}/ripper/conv_main.c (100%) rename {common => xtools}/ripper/conv_shader.c (100%) rename {common => xtools}/ripper/conv_sprite.c (100%) rename {common => xtools}/ripper/ripper.h (96%) rename {common => xtools}/spritegen.c (95%) rename {common => xtools}/studio.c (100%) rename {common => xtools}/studio_utils.c (100%) rename {common => xtools}/utils.c (95%) rename {common => xtools}/utils.h (100%) rename {common => xtools}/wadlib.c (95%) rename common/platform.c => xtools/xtools.c (95%) rename common/common.dsp => xtools/xtools.dsp (77%) rename common/platform.h => xtools/xtools.h (86%) diff --git a/backup.lst b/backup.lst index 07c9d72b..70f7eb76 100644 --- a/backup.lst +++ b/backup.lst @@ -16,19 +16,7 @@ baserc\ client\ client\hud\ client\global\ -public\ -physic\ -server\ -server\ents\ -server\game\ -server\global\ -server\monsters\ -render\ -vprogs\ -vsound\ common\ -common\bsplib -common\ripper engine\ engine\client\ engine\server\ @@ -43,3 +31,16 @@ launch\sprite\ launch\studio\ launch\imagelib\ launch\extragen\ +physic\ +public\ +render\ +server\ +server\ents\ +server\game\ +server\global\ +server\monsters\ +vprogs\ +vsound\ +xtools\ +xtools\bsplib +xtools\ripper \ No newline at end of file diff --git a/baserc/baserc.dsp b/baserc/baserc.dsp index 97fd4daf..2b76ef16 100644 --- a/baserc/baserc.dsp +++ b/baserc/baserc.dsp @@ -43,7 +43,7 @@ RSC=rc.exe # PROP Ignore_Export_Lib 1 # PROP Target_Dir "" # ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "PLATFORM_EXPORTS" /YX /FD /c -# ADD CPP /nologo /MD /W3 /GX /O2 /I "./" /I "../public" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /FD /c +# ADD CPP /nologo /MD /W3 /GX /O2 /I "./" /I "../public" /I "../common" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /FD /c # SUBTRACT CPP /YX # ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32 # ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32 @@ -80,7 +80,7 @@ SOURCE="$(InputPath)" # PROP Ignore_Export_Lib 1 # PROP Target_Dir "" # ADD BASE CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "PLATFORM_EXPORTS" /YX /FD /GZ /c -# ADD CPP /nologo /MDd /W3 /Gm /Gi /GX /ZI /Od /I "./" /I "../public" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /FR /FD /GZ /c +# ADD CPP /nologo /MDd /W3 /Gm /Gi /GX /ZI /Od /I "./" /I "../public" /I "../common" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /FR /FD /GZ /c # SUBTRACT CPP /YX # ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32 # ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32 diff --git a/client/client.dsp b/client/client.dsp index 93fa4a24..5699817b 100644 --- a/client/client.dsp +++ b/client/client.dsp @@ -43,7 +43,7 @@ RSC=rc.exe # PROP Ignore_Export_Lib 1 # PROP Target_Dir "" # ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /YX /c -# ADD CPP /nologo /MD /W3 /GX /O2 /I "./" /I "../public" /I "./global" /I "./hud" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /FD /c +# ADD CPP /nologo /MD /W3 /GX /O2 /I "./" /I "../common" /I "global" /I "hud" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /FD /c # SUBTRACT CPP /Fr /YX # ADD BASE MTL /nologo /D "NDEBUG" /win32 # ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32 @@ -82,7 +82,7 @@ SOURCE="$(InputPath)" # PROP Target_Dir "" # ADD BASE CPP /nologo /MT /W3 /GX /Zi /O2 /I "..\common\vgui" /I "..\client" /I "..\client\render" /I ".\hud" /I "..\common\engine" /I "..\common" /I "..\server" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "CLIENT_DLL" /YX /FD /c # SUBTRACT BASE CPP /Fr -# ADD CPP /nologo /MDd /W3 /Gm /Gi /GX /ZI /Od /I "./" /I "../public" /I "./global" /I "./hud" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /FR /FD /c +# ADD CPP /nologo /MDd /W3 /Gm /Gi /GX /ZI /Od /I "./" /I "../common" /I "global" /I "hud" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /FR /FD /c # SUBTRACT CPP /YX # ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32 # ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32 diff --git a/client/global/dll_int.cpp b/client/global/dll_int.cpp index 0a8bf468..308a2f86 100644 --- a/client/global/dll_int.cpp +++ b/client/global/dll_int.cpp @@ -36,9 +36,9 @@ static HUD_FUNCTIONS gFunctionTable = //======================================================================= // GetApi //======================================================================= -int CreateAPI( HUD_FUNCTIONS *pFunctionTable, cl_enginefuncs_t* pEngfuncsFromEngine, int interfaceVersion ) +int CreateAPI( HUD_FUNCTIONS *pFunctionTable, cl_enginefuncs_t* pEngfuncsFromEngine ) { - if( !pFunctionTable || !pEngfuncsFromEngine || interfaceVersion != INTERFACE_VERSION ) + if( !pFunctionTable || !pEngfuncsFromEngine ) { return FALSE; } diff --git a/client/global/enginecallback.h b/client/global/enginecallback.h index 69ad904c..95e788ac 100644 --- a/client/global/enginecallback.h +++ b/client/global/enginecallback.h @@ -9,6 +9,7 @@ // built-in memory manager #define MALLOC( x ) (*g_engfuncs.pfnMemAlloc)( x, __FILE__, __LINE__ ) #define CALLOC( x, y ) (*g_engfuncs.pfnMemAlloc)((x) * (y), __FILE__, __LINE__ ) +#define MEMCPY( x, y, z ) (*g_engfuncs.pfnMemCopy)( x, y, z, __FILE__, __LINE__ ) #define FREE( x ) (*g_engfuncs.pfnMemFree)( x, __FILE__, __LINE__ ) // screen handlers diff --git a/client/global/extdll.h b/client/global/extdll.h index c57b55ae..e4bd7b7a 100644 --- a/client/global/extdll.h +++ b/client/global/extdll.h @@ -13,12 +13,7 @@ #pragma warning(disable : 4100) // unreferenced formal parameter #include "windows.h" - -#ifndef BIT -#define BIT( n ) (1<<( n )) -#endif - -#define DLLEXPORT _declspec( dllexport ) +#include "basetypes.h" // Misc C-runtime library headers #include @@ -35,7 +30,7 @@ // Shared header describing protocol between engine and DLLs #include "entity_def.h" -#include "qfiles_ref.h" #include "clgame_api.h" +#include "game_shared.h" #endif//EXTDLL_H \ No newline at end of file diff --git a/client/global/tempents.cpp b/client/global/tempents.cpp index 92225ed5..1d5c37d7 100644 --- a/client/global/tempents.cpp +++ b/client/global/tempents.cpp @@ -5,6 +5,7 @@ #include "extdll.h" #include "hud_iface.h" +#include "studio_event.h" void HUD_CreateEntities( void ) { diff --git a/client/global/view.cpp b/client/global/view.cpp index 79ba24bf..989ba13d 100644 --- a/client/global/view.cpp +++ b/client/global/view.cpp @@ -5,6 +5,7 @@ #include "extdll.h" #include "hud_iface.h" +#include "ref_params.h" #include "hud.h" void V_CalcShake( void ) diff --git a/client/hud/hud_zoom.cpp b/client/hud/hud_zoom.cpp index d425737f..b578f92c 100644 --- a/client/hud/hud_zoom.cpp +++ b/client/hud/hud_zoom.cpp @@ -4,6 +4,7 @@ //======================================================================= #include "extdll.h" +#include "triangle_api.h" #include "hud_iface.h" #include "hud.h" diff --git a/common/basetypes.h b/common/basetypes.h new file mode 100644 index 00000000..e427ce32 --- /dev/null +++ b/common/basetypes.h @@ -0,0 +1,33 @@ +//======================================================================= +// Copyright XashXT Group 2006 © +// basetypes.h - general typedefs +//======================================================================= +#ifndef BASETYPES_H +#define BASETYPES_H + +typedef unsigned char byte; +typedef unsigned short word; +typedef unsigned long dword; +typedef unsigned __int64 qword; +typedef unsigned int uint; +typedef signed __int64 int64; +typedef int func_t; +typedef int sound_t; +typedef int model_t; +typedef int string_t; +typedef int shader_t; +typedef struct edict_s edict_t; +typedef struct cl_priv_s cl_priv_t; +typedef struct sv_priv_s sv_priv_t; + +#define DLLEXPORT __declspec( dllexport ) + +#ifndef NULL +#define NULL ((void *)0) +#endif + +#ifndef BIT +#define BIT( n ) (1<<( n )) +#endif + +#endif//BASETYPES_H \ No newline at end of file diff --git a/public/clgame_api.h b/common/clgame_api.h similarity index 51% rename from public/clgame_api.h rename to common/clgame_api.h index 16e191d7..2f9db425 100644 --- a/public/clgame_api.h +++ b/common/clgame_api.h @@ -5,157 +5,50 @@ #ifndef CLGAME_API_H #define CLGAME_API_H -typedef int HSPRITE; // handle to a graphic +typedef int HSPRITE; // handle to a graphic +typedef struct ref_params_s ref_params_t; +typedef struct dstudioevent_s dstudioevent_t; typedef int (*pfnUserMsgHook)( const char *pszName, int iSize, void *pbuf ); // user message handle +typedef void (*pfnEventHook)( struct event_args_s *args ); -typedef enum -{ - TRI_FRONT = 0, - TRI_BACK, - TRI_NONE, -} TRI_CULL; +#include "trace_def.h" +#include "event_api.h" -typedef enum -{ - TRI_TRIANGLES = 0, - TRI_TRIANGLE_FAN, - TRI_TRIANGLE_STRIP, - TRI_POLYGON, - TRI_QUADS, - TRI_LINES, -} TRI_DRAW; - -typedef struct triapi_s -{ - size_t api_size; // must match with sizeof( triapi_t ); - - void (*Bind)( HSPRITE shader ); // use handle that return pfnLoadShader - void (*Begin)( TRI_DRAW mode ); - void (*End)( void ); - - void (*Vertex2f)( float x, float y ); - void (*Vertex3f)( float x, float y, float z ); - void (*Vertex2fv)( const float *v ); - void (*Vertex3fv)( const float *v ); - void (*Color3f)( float r, float g, float b ); - void (*Color4f)( float r, float g, float b, float a ); - void (*Color4ub)( byte r, byte g, byte b, byte a ); - void (*TexCoord2f)( float u, float v ); - void (*TexCoord2fv)( const float *v ); - void (*CullFace)( TRI_CULL mode ); -} triapi_t; - -// FIXME: get rid of this typedef struct { - char *name; - short ping; - byte thisplayer; // TRUE if this is the calling player - - // stuff that's unused at the moment, but should be done - byte spectator; - byte packetloss; - - char *model; - short topcolor; - short bottomcolor; - + char *name; + short ping; + byte thisplayer; // TRUE if this is the calling player + byte packetloss; // TRUE if current packet is loose } hud_player_info_t; -// FIXME: get rid of this typedef struct client_textmessage_s { - int effect; - byte r1, g1, b1, a1; // 2 colors for effects - byte r2, g2, b2, a2; - float x; - float y; - float fadein; - float fadeout; - float holdtime; - float fxtime; - const char *pName; - const char *pMessage; + int effect; + byte r1, g1, b1, a1; // 2 colors for effects + byte r2, g2, b2, a2; + float x; + float y; + float fadein; + float fadeout; + float holdtime; + float fxtime; + const char *pName; + const char *pMessage; } client_textmessage_t; typedef struct client_data_s { - vec3_t origin; - vec3_t angles; + vec3_t origin; // cl.origin + vec3_t angles; // cl.viewangles - int iKeyBits; // Keyboard bits - int64 iWeaponBits; // came from pev->weapons - float fov; // field of view - float v_idlescale; // view shake/rotate - float mouse_sensitivity; // used for menus + int iKeyBits; // Keyboard bits + int64 iWeaponBits; // came from pev->weapons + float v_idlescale; // view shake/rotate + float mouse_sensitivity; // used for menus + float fov; // field of view } client_data_t; -// NOTE: engine trace struct not matched with clgame trace -typedef struct -{ - BOOL fAllSolid; // if true, plane is not valid - BOOL fStartSolid; // if true, the initial point was in a solid area - BOOL fStartStuck; // if true, trace started from solid entity - float flFraction; // time completed, 1.0 = didn't hit anything - vec3_t vecEndPos; // final position - int iStartContents; // start pos conetnts - int iContents; // final pos contents - int iHitgroup; // 0 == generic, non zero is specific body part - float flPlaneDist; // planes distance - vec3_t vecPlaneNormal; // surface normal at impact - const char *pTexName; // texture name that we hitting (brushes and studiomodels) - edict_t *pHit; // entity the surface is on -} TraceResult; - -typedef struct ref_params_s -{ - // output - int viewport[4]; // x, y, width, height - vec3_t vieworg; - vec3_t viewangles; - float fov_x; - float fov_y; // fov_y = V_CalcFov( fov_x, viewport[2], viewport[3] ); - - vec3_t forward; - vec3_t right; - vec3_t up; - - float frametime; // client frametime - float lerpfrac; // between oldframe and frame - float time; // client time - float oldtime; // studio lerping - - // misc - BOOL intermission; - BOOL demoplayback; - BOOL demorecord; - BOOL spectator; - BOOL paused; - uint rdflags; // client view effects: RDF_UNDERWATER, RDF_MOTIONBLUR, etc - edict_t *onground; // pointer to onground entity - byte *areabits; // come from server, contains visible areas list - int waterlevel; - - // input - vec3_t velocity; - vec3_t angles; // input viewangles - vec3_t origin; // origin + viewheight = vieworg - vec3_t old_angles; // prev.state values to interpolate from - vec3_t old_origin; - - vec3_t viewheight; - float idealpitch; - - int health; - vec3_t crosshairangle; // pfnCrosshairAngle values from server - vec3_t punchangle; // recivied from server - edict_t *viewentity; - int clientnum; - int num_entities; - int max_entities; - int max_clients; -} ref_params_t; - typedef struct cl_enginefuncs_s { // interface validator @@ -163,6 +56,7 @@ typedef struct cl_enginefuncs_s // engine memory manager void* (*pfnMemAlloc)( size_t cb, const char *filename, const int fileline ); + void (*pfnMemCopy)( void *dest, const void *src, size_t cb, const char *filename, const int fileline ); void (*pfnMemFree)( void *mem, const char *filename, const int fileline ); // screen handlers @@ -173,7 +67,8 @@ typedef struct cl_enginefuncs_s // cvar handlers void (*pfnRegisterVariable)( const char *szName, const char *szValue, int flags, const char *szDesc ); - void (*pfnCvarSetValue)( const char *cvar, float value ); + void (*pfnCvarSetString)( const char *szName, const char *szValue ); + void (*pfnCvarSetValue)( const char *szName, float flValue ); float (*pfnGetCvarFloat)( const char *szName ); char* (*pfnGetCvarString)( const char *szName ); @@ -188,7 +83,7 @@ typedef struct cl_enginefuncs_s client_textmessage_t *(*pfnTextMessageGet)( const char *pName ); int (*pfnCmdArgc)( void ); - char *(*pfnCmdArgv)( int argc ); + char* (*pfnCmdArgv)( int argc ); void (*pfnAlertMessage)( ALERT_TYPE, char *szFmt, ... ); // sound handlers (NULL origin == play at current client origin) @@ -216,6 +111,18 @@ typedef struct cl_enginefuncs_s int (*pfnPointContents)( const float *rgflVector ); void (*pfnTraceLine)( const float *v1, const float *v2, int fNoMonsters, edict_t *pentToSkip, TraceResult *ptr ); + void (*pfnTraceToss)( edict_t* pent, edict_t* pentToIgnore, TraceResult *ptr ); + void (*pfnTraceHull)( const float *v1, const float *mins, const float *maxs, const float *v2, int fNoMonsters, edict_t *pentToSkip, TraceResult *ptr ); + void (*pfnTraceModel)( const float *v1, const float *v2, edict_t *pent, TraceResult *ptr ); + const char *(*pfnTraceTexture)( edict_t *pTextureEntity, const float *v1, const float *v2 ); + + word (*pfnPrecacheEvent)( int type, const char* psz ); + void (*pfnHookEvent)( const char *name, pfnEventHook pfn ); + void (*pfnPlaybackEvent)( int flags, const edict_t *pInvoker, word eventindex, float delay, event_args_t *args ); + void (*pfnKillEvent)( word eventindex ); + + string_t (*pfnAllocString)( const char *szValue ); + const char *(*pfnGetString)( string_t iString ); long (*pfnRandomLong)( long lLow, long lHigh ); float (*pfnRandomFloat)( float flLow, float flHigh ); @@ -224,7 +131,8 @@ typedef struct cl_enginefuncs_s void (*pfnGetGameDir)( char *szGetGameDir ); void (*pfnHostError)( const char *szFmt, ... ); // invoke host error - triapi_t *pTriAPI; + struct triapi_s *pTriAPI; + struct efxapi_s *pEfxAPI; } cl_enginefuncs_t; @@ -244,10 +152,10 @@ typedef struct void (*pfnDrawTransparentTriangles)( void ); void (*pfnCreateEntities)( void ); void (*pfnStudioEvent)( const dstudioevent_t *event, edict_t *entity ); - void (*pfnCalcRefdef)( ref_params_t *parms ); + void (*pfnCalcRefdef)( struct ref_params_s *parms ); } HUD_FUNCTIONS; -typedef int (*CLIENTAPI)( HUD_FUNCTIONS *pFunctionTable, cl_enginefuncs_t* pEngfuncsFromEngine, int interfaceVersion ); +typedef int (*CLIENTAPI)( HUD_FUNCTIONS *pFunctionTable, cl_enginefuncs_t* pEngfuncsFromEngine ); #endif//CLGAME_API_H \ No newline at end of file diff --git a/public/const.h b/common/const.h similarity index 62% rename from public/const.h rename to common/const.h index 2be00742..b295be5f 100644 --- a/public/const.h +++ b/common/const.h @@ -1,24 +1,16 @@ //======================================================================= // Copyright XashXT Group 2007 © -// const.h - shared engine constants +// const.h - engine constants //======================================================================= #ifndef CONST_H #define CONST_H -// shared typedefs -typedef signed __int64 int64; -typedef unsigned __int64 qword; -typedef unsigned long dword; -typedef unsigned int uint; -typedef unsigned short word; -typedef unsigned char byte; -typedef int shader_t; - // euler angle order #define PITCH 0 #define YAW 1 #define ROLL 2 +// sound specific #define VOL_NORM 1.0 // volume values // pitch values @@ -32,44 +24,25 @@ typedef int shader_t; #define ATTN_IDLE 2.0f #define ATTN_STATIC 1.25f -// channels +// 7 channels available #define CHAN_AUTO 0 #define CHAN_WEAPON 1 #define CHAN_VOICE 2 #define CHAN_ITEM 3 #define CHAN_BODY 4 #define CHAN_STREAM 5 // allocate stream channel from the static or dynamic area -#define CHAN_STATIC 6 // allocate channel from the static area +#define CHAN_STATIC 6 // allocate channel from the static area -// in buttons -#define IN_ATTACK (1<<0) -#define IN_JUMP (1<<1) -#define IN_DUCK (1<<2) -#define IN_FORWARD (1<<3) -#define IN_BACK (1<<4) -#define IN_USE (1<<5) -#define IN_CANCEL (1<<6) -#define IN_LEFT (1<<7) -#define IN_RIGHT (1<<8) -#define IN_MOVELEFT (1<<9) -#define IN_MOVERIGHT (1<<10) -#define IN_ATTACK2 (1<<11) -#define IN_RUN (1<<12) -#define IN_RELOAD (1<<13) -#define IN_ALT1 (1<<14) -#define IN_SCORE (1<<15) // Used by client.dll for when scoreboard is held down - -// pev->spawnflags -#define SF_START_ON 0x1 +// common EDICT flags // pev->flags #define FL_FLY (1<<0) // changes the SV_Movestep() behavior to not need to be on ground #define FL_SWIM (1<<1) // same as AI_FLY but stay in water -#define FL_CLIENT (1<<2) -#define FL_INWATER (1<<3) +#define FL_CLIENT (1<<2) // this a client entity +#define FL_INWATER (1<<3) // npc in water #define FL_MONSTER (1<<4) // monster bit #define FL_GODMODE (1<<5) // invulnerability npc or client -#define FL_NOTARGET (1<<6) // mark any npc as neytral +#define FL_NOTARGET (1<<6) // mark all npc's as neytral #define FL_ONGROUND (1<<7) // at rest / on the ground #define FL_PARTIALONGROUND (1<<8) // not corners are valid #define FL_WATERJUMP (1<<8) // water jumping @@ -88,6 +61,9 @@ typedef int shader_t; #define FL_DORMANT (1<<21) // Entity is dormant, no updates to client #define FL_POINTENTITY (1<<22) // this is point entity +// pev->spawnflags +#define SF_START_ON (1<<0) + // pev->effects #define EF_BRIGHTFIELD (1<<0) // swirling cloud of particles #define EF_MUZZLEFLASH (1<<1) // single frame ELIGHT on entity attachment 0 @@ -101,17 +77,19 @@ typedef int shader_t; #define EF_LIGHT (1<<9) // dynamic light (rockets use) #define EF_ANIMATE (1<<10) // do client animate (ignore v.frame) -// edict->deadflag values -#define DEAD_NO 0 // alive -#define DEAD_DYING 1 // playing death animation or still falling off of a ledge waiting to hit ground -#define DEAD_DEAD 2 // dead. lying still. -#define DEAD_RESPAWNABLE 3 // wait for respawn -#define DEAD_DISCARDBODY 4 +// pev->takedamage +#define DAMAGE_NO 0 // can't be damaged +#define DAMAGE_YES 1 // attempt to damage +#define DAMAGE_AIM 2 // special case for aiming damage -#define DAMAGE_NO 0 -#define DAMAGE_YES 1 -#define DAMAGE_AIM 2 +// pev->deadflag +#define DEAD_NO 0 // alive +#define DEAD_DYING 1 // playing death animation or still falling off of a ledge waiting to hit ground +#define DEAD_DEAD 2 // dead. lying still. +#define DEAD_RESPAWNABLE 3 // wait for respawn +#define DEAD_DISCARDBODY 4 +// filter console messages typedef enum { at_console = 1, // format: [msg] @@ -119,35 +97,9 @@ typedef enum at_error, // format: Error: [msg] at_loading, // print messages during loading at_aiconsole, // same as at_console, but only shown if developer level is 5! - at_logged // server print to console ( only in multiplayer games ). + at_logged // server print to console ( only in multiplayer games ). (NOT IMPLEMENTED) } ALERT_TYPE; -// engine edict types -typedef enum -{ - ED_SPAWNED = 0, // this entity requris to set own type with SV_ClassifyEdict - ED_WORLDSPAWN, // this is a worldspawn - ED_STATIC, // this is a logic without model or entity with static model - ED_AMBIENT, // this is entity emitted ambient sounds only - ED_NORMAL, // normal entity with model (and\or) sound - ED_BSPBRUSH, // brush entity (a part of level) - ED_CLIENT, // this is a client entity - ED_MONSTER, // monster or bot (generic npc with AI) - ED_TEMPENTITY, // this edict will be removed on server when "lifetime" exceeds - ED_BEAM, // laser beam (needs to recalculate pvs and frustum) - ED_MOVER, // func_train, func_door and another bsp or mdl movers - ED_VIEWMODEL, // client or bot viewmodel (for spectating) - ED_ITEM, // holdable items - ED_RAGDOLL, // dead body with simulated ragdolls - ED_RIGIDBODY, // simulated physic - ED_TRIGGER, // just for sorting on a server - ED_PORTAL, // realtime display, portal or mirror brush or model - ED_MISSILE, // greande, rocket e.t.c - ED_DECAL, // render will be merge real coords and normal - ED_VEHICLE, // controllable vehicle - ED_MAXTYPES, -} edtype_t; - // edict movetype typedef enum { @@ -165,7 +117,7 @@ typedef enum MOVETYPE_PHYSIC, // phys simulation } movetype_t; -// edict collision modes +// edict collision filter typedef enum { SOLID_NOT = 0, // no interaction with other objects @@ -179,13 +131,23 @@ typedef enum SOLID_MESH, // custom convex hull } solid_t; -typedef enum -{ - point_hull = 0, - human_hull = 1, - large_hull = 2, - head_hull = 3 -}; +// pev->buttons (client only) +#define IN_ATTACK (1<<0) +#define IN_JUMP (1<<1) +#define IN_DUCK (1<<2) +#define IN_FORWARD (1<<3) +#define IN_BACK (1<<4) +#define IN_USE (1<<5) +#define IN_CANCEL (1<<6) +#define IN_LEFT (1<<7) +#define IN_RIGHT (1<<8) +#define IN_MOVELEFT (1<<9) +#define IN_MOVERIGHT (1<<10) +#define IN_ATTACK2 (1<<11) +#define IN_RUN (1<<12) +#define IN_RELOAD (1<<13) +#define IN_ALT1 (1<<14) +#define IN_SCORE (1<<15) // Used by client.dll for when scoreboard is held down // beam types, encoded as a byte typedef enum @@ -216,6 +178,7 @@ typedef enum typedef enum { kRenderFxNone = 0, + kRenderFxUnderwater, // client only, applied on engine-side // legacy stuff are not supported @@ -230,16 +193,12 @@ typedef enum kRenderFxNoReflect, // don't reflecting in mirrors } kRenderFx_t; +// studio models event range #define EVENT_SPECIFIC 0 #define EVENT_SCRIPTED 1000 -#define EVENT_SHARED 2000 +#define EVENT_SHARED 2000 // both client and server valid for playing #define EVENT_CLIENT 5000 // less than this value it's a server-side studio events -// FIXME: get rid of this -#define RDF_UNDERWATER (1<<0) // warp the screen as apropriate -#define RDF_NOWORLDMODEL (1<<1) // used for player configuration screen -#define RDF_BLOOM (1<<2) // light blooms - // client screen state #define CL_DISCONNECTED 1 // #define CL_LOADING 2 // draw loading progress-bar @@ -249,6 +208,7 @@ typedef enum #define KEY_GAME 1 #define KEY_HUDMENU 2 +// basic console charwidths #define TINYCHAR_WIDTH (SMALLCHAR_WIDTH) #define TINYCHAR_HEIGHT (SMALLCHAR_HEIGHT/2) #define SMALLCHAR_WIDTH 8 @@ -258,39 +218,4 @@ typedef enum #define GIANTCHAR_WIDTH 32 #define GIANTCHAR_HEIGHT 48 -#define HUD_PRINTNOTIFY 1 -#define HUD_PRINTCONSOLE 2 -#define HUD_PRINTTALK 3 -#define HUD_PRINTCENTER 4 - -#define INTERFACE_VERSION 1 // both the client and server iface version - -//======================================================================= -// -// server.dll - client.dll definitions only -// -//======================================================================= -#define MAX_WEAPONS 64 // special for Ghoul[BB] mod support -#define MAX_AMMO_SLOTS 32 - -#define HIDEHUD_WEAPONS BIT( 0 ) -#define HIDEHUD_FLASHLIGHT BIT( 1 ) -#define HIDEHUD_ALL BIT( 2 ) -#define HIDEHUD_HEALTH BIT( 3 ) -#define ITEM_SUIT BIT( 4 ) - -enum ShakeCommand_t -{ - SHAKE_START = 0, // Starts the screen shake for all players within the radius. - SHAKE_STOP, // Stops the screen shake for all players within the radius. - SHAKE_AMPLITUDE, // Modifies the amplitude of an active screen shake for all players within the radius. - SHAKE_FREQUENCY, // Modifies the frequency of an active screen shake for all players within the radius. -}; - -#define FFADE_IN 0x0000 // Just here so we don't pass 0 into the function -#define FFADE_OUT 0x0001 // Fade out (not in) -#define FFADE_MODULATE 0x0002 // Modulate (don't blend) -#define FFADE_STAYOUT 0x0004 // ignores the duration, stays faded out until new ScreenFade message received -#define FFADE_CUSTOMVIEW 0x0008 // fading only at custom viewing (don't sending this to engine ) - #endif//CONST_H \ No newline at end of file diff --git a/common/effects_api.h b/common/effects_api.h new file mode 100644 index 00000000..5d9d0b0d --- /dev/null +++ b/common/effects_api.h @@ -0,0 +1,13 @@ +//======================================================================= +// Copyright XashXT Group 2009 © +// effects_api.h - client temp entities +//======================================================================= +#ifndef EFFECTS_API_H +#define EFFECTS_API_H + +typedef struct efxapi_s +{ + size_t api_size; // must match with sizeof( efxapi_t ); +} efxapi_t; + +#endif//EFFECTS_API_H \ No newline at end of file diff --git a/public/entity_def.h b/common/entity_def.h similarity index 92% rename from public/entity_def.h rename to common/entity_def.h index b147325a..39e13b7e 100644 --- a/public/entity_def.h +++ b/common/entity_def.h @@ -5,10 +5,6 @@ #ifndef ENTITY_DEF_H #define ENTITY_DEF_H -typedef struct cl_priv_s cl_priv_t; // cl.engine private data -typedef struct sv_priv_s sv_priv_t; // sv.engine private data -typedef struct edict_s edict_t; // generic entity - // Legend: // ENG - engine can modify this variable for some reasons [only // NET - field that shared on client across network @@ -142,7 +138,7 @@ typedef struct entvars_s float dmg; float dmgtime; - edict_t *pContainingEntity; // for upcasting. Filled by engine, don't save, don't modifiy + edict_t *pContainingEntity; // filled by engine, don't save, don't modifiy } entvars_t; struct edict_s diff --git a/common/entity_state.h b/common/entity_state.h new file mode 100644 index 00000000..4d8f7b2d --- /dev/null +++ b/common/entity_state.h @@ -0,0 +1,99 @@ +//======================================================================= +// Copyright XashXT Group 2009 © +// entity_state.h - a part of network protocol +//======================================================================= +#ifndef ENTITY_STATE_H +#define ENTITY_STATE_H + +// engine edict types that shared across network +typedef enum +{ + ED_SPAWNED = 0, // this entity requris to set own type with SV_ClassifyEdict + ED_WORLDSPAWN, // this is a worldspawn + ED_STATIC, // this is a logic without model or entity with static model + ED_AMBIENT, // this is entity emitted ambient sounds only + ED_NORMAL, // normal entity with model (and\or) sound + ED_BSPBRUSH, // brush entity (a part of level) + ED_CLIENT, // this is a client entity + ED_MONSTER, // monster or bot (generic npc with AI) + ED_TEMPENTITY, // this edict will be removed on server when "lifetime" exceeds + ED_BEAM, // laser beam (needs to recalculate pvs and frustum) + ED_MOVER, // func_train, func_door and another bsp or mdl movers + ED_VIEWMODEL, // client or bot viewmodel (for spectating) + ED_ITEM, // holdable items + ED_RAGDOLL, // dead body with simulated ragdolls + ED_RIGIDBODY, // simulated physic + ED_TRIGGER, // just for sorting on a server + ED_PORTAL, // realtime display, portal or mirror brush or model + ED_MISSILE, // greande, rocket e.t.c + ED_DECAL, // render will be merge real coords and normal + ED_VEHICLE, // controllable vehicle + ED_MAXTYPES, +} edtype_t; + +// entity_state_t->ed_flags +#define ESF_LINKEDICT BIT( 0 ) // needs to relink edict on client + +typedef struct entity_state_s +{ + // engine specific + uint number; // edict index + edtype_t ed_type; // edict type + string_t classname; // edict classname + int soundindex; // looped ambient sound + int ed_flags; // edict internal flags + + // physics information + vec3_t origin; + vec3_t angles; // entity angles, not viewangles + solid_t solid; // entity solid + movetype_t movetype; // entity movetype + int gravity; // gravity multiplier + int aiment; // attached entity + int owner; // projectiles owner + int groundent; // onground edict num, valid only if FL_ONGROUND is set, else -1 + vec3_t mins; // not symmetric entity bbox + vec3_t maxs; + vec3_t velocity; // for predicting & tracing + vec3_t avelocity; // for predicting & tracing + float teleport_time; // time when no prediction + + // model state + int modelindex; // general modelindex + int colormap; // change base color for some textures or sprite frames + float scale; // model or sprite scale, affects to physics too + float frame; // % playback position in animation sequences (0..255) + int skin; // skin for studiomodels + int body; // sub-model selection for studiomodels + float animtime; // auto-animating time + float framerate; // custom framerate, specified by QC + int sequence; // animation sequence (0 - 255) + float blending[16]; // studio animation blending + float controller[16]; // studio bone controllers + + // flags + int64 flags; // v.flags + uint effects; // effect flags like q1 and hl1 + int renderfx; // render effects same as hl1 + float renderamt; // alpha value or like somewhat + vec3_t rendercolor; // hl1 legacy stuff, working, but not needed + int rendermode; // hl1 legacy stuff, working, but not needed + + // client specific + vec3_t delta_angles; // add to command angles to get view direction + vec3_t punch_angles; // add to view direction to get render angles + vec3_t viewangles; // already calculated view angles on server-side + vec3_t viewoffset; // viewoffset over ground + int gaitsequence; // client\nps\bot gaitsequence + int viewmodel; // contains viewmodel index + int weaponmodel; // contains weaponmodel index + int weaponanim; // weaponmodel sequence + int weaponbody; // weaponmodel body + int weaponskin; // weaponmodel skin + float maxspeed; // min( pev->maxspeed, sv_maxspeed->value ) + float health; // client health (other parms can be send by custom messages) + int64 weapons; // weapon flags + float fov; // horizontal field of view +} entity_state_t; + +#endif//ENTITY_STATE_H \ No newline at end of file diff --git a/common/event_api.h b/common/event_api.h new file mode 100644 index 00000000..184ad51f --- /dev/null +++ b/common/event_api.h @@ -0,0 +1,51 @@ +//======================================================================= +// Copyright XashXT Group 2009 © +// event_api.h - network event definition +//======================================================================= +#ifndef EVENT_API_H +#define EVENT_API_H + + +#define FEV_NOTHOST (1<<0) // skip local host for event send. + +// Send the event reliably. You must specify the origin and angles and use +// PLAYBACK_EVENT_FULL for this to work correctly on the server for anything +// that depends on the event origin/angles. I.e., the origin/angles are not +// taken from the invoking edict for reliable events. +#define FEV_RELIABLE (1<<1) + +// Don't restrict to PAS/PVS, send this event to _everybody_ on the server +// ( useful for stopping CHAN_STATIC sounds started by client event when client +// is not in PVS anymore ( hwguy in TFC e.g. ). +#define FEV_GLOBAL (1<<2) + +// If this client already has one of these events in its queue, +// just update the event instead of sending it as a duplicate +#define FEV_UPDATE (1<<3) +#define FEV_HOSTONLY (1<<4) // only send to entity specified as the invoker +#define FEV_SERVER (1<<5) // only send if the event was created on the server. +#define FEV_CLIENT (1<<6) // only issue event client side ( from shared code ) + +#define FEVENT_ORIGIN (1<<0) // event was invoked with stated origin +#define FEVENT_ANGLES (1<<1) // event was invoked with stated angles + +typedef struct event_args_s +{ + int flags; + int entindex; // transmitted always + + float origin[3]; + float angles[3]; + float velocity[3]; + + int ducking; + float fparam1; + float fparam2; + + int iparam1; + int iparam2; + int bparam1; + int bparam2; +} event_args_t; + +#endif//EVENT_API_H \ No newline at end of file diff --git a/common/game_shared.h b/common/game_shared.h new file mode 100644 index 00000000..d06d79af --- /dev/null +++ b/common/game_shared.h @@ -0,0 +1,36 @@ +//======================================================================= +// Copyright XashXT Group 2009 © +// game_shared.h - user constants +//======================================================================= +#ifndef GAME_SHARED_H +#define GAME_SHARED_H + +#define HUD_PRINTNOTIFY 1 +#define HUD_PRINTCONSOLE 2 +#define HUD_PRINTTALK 3 +#define HUD_PRINTCENTER 4 + +#define MAX_WEAPONS 64 // special for Ghoul[BB] mod support +#define MAX_AMMO_SLOTS 32 + +#define HIDEHUD_WEAPONS BIT( 0 ) +#define HIDEHUD_FLASHLIGHT BIT( 1 ) +#define HIDEHUD_ALL BIT( 2 ) +#define HIDEHUD_HEALTH BIT( 3 ) +#define ITEM_SUIT BIT( 4 ) + +enum ShakeCommand_t +{ + SHAKE_START = 0, // Starts the screen shake for all players within the radius. + SHAKE_STOP, // Stops the screen shake for all players within the radius. + SHAKE_AMPLITUDE, // Modifies the amplitude of an active screen shake for all players within the radius. + SHAKE_FREQUENCY, // Modifies the frequency of an active screen shake for all players within the radius. +}; + +#define FFADE_IN 0x0000 // Just here so we don't pass 0 into the function +#define FFADE_OUT 0x0001 // Fade out (not in) +#define FFADE_MODULATE 0x0002 // Modulate (don't blend) +#define FFADE_STAYOUT 0x0004 // ignores the duration, stays faded out until new ScreenFade message received +#define FFADE_CUSTOMVIEW 0x0008 // fading only at custom viewing (don't sending this to engine ) + +#endif//GAME_SHARED_H \ No newline at end of file diff --git a/common/ref_params.h b/common/ref_params.h new file mode 100644 index 00000000..41d4d671 --- /dev/null +++ b/common/ref_params.h @@ -0,0 +1,57 @@ +//======================================================================= +// Copyright XashXT Group 2009 © +// ref_params.h - client rendering state +//======================================================================= +#ifndef REF_PARAMS_H +#define REF_PARAMS_H + +typedef struct ref_params_s +{ + // output + int viewport[4]; // x, y, width, height + vec3_t vieworg; + vec3_t viewangles; + float fov_x; + float fov_y; // fov_y = V_CalcFov( fov_x, viewport[2], viewport[3] ); + + vec3_t forward; + vec3_t right; + vec3_t up; + + float frametime; // client frametime + float lerpfrac; // between oldframe and frame + float time; // client time + float oldtime; // studio lerping + + // misc + BOOL intermission; + BOOL demoplayback; + BOOL demorecord; + BOOL spectator; + BOOL paused; + int onlyClientDraw; // 1 - don't draw worldmodel + edict_t *onground; // pointer to onground entity + byte *areabits; // come from server, contains visible areas list + int waterlevel; + + // input + vec3_t velocity; + vec3_t angles; // input viewangles + vec3_t origin; // origin + viewheight = vieworg + vec3_t old_angles; // prev.state values to interpolate from + vec3_t old_origin; + + vec3_t viewheight; + float idealpitch; + + int health; + vec3_t crosshairangle; // pfnCrosshairAngle values from server + vec3_t punchangle; // recivied from server + edict_t *viewentity; + int clientnum; + int num_entities; + int max_entities; + int max_clients; +} ref_params_t; + +#endif//REF_PARAMS_H \ No newline at end of file diff --git a/common/studio_event.h b/common/studio_event.h new file mode 100644 index 00000000..8a5acef8 --- /dev/null +++ b/common/studio_event.h @@ -0,0 +1,16 @@ +//======================================================================= +// Copyright XashXT Group 2009 © +// studio_event.h - model event definition +//======================================================================= +#ifndef STUDIO_EVENT_H +#define STUDIO_EVENT_H + +typedef struct dstudioevent_s +{ + int frame; + int event; + int type; + char options[64]; +} dstudioevent_t; + +#endif//STUDIO_EVENT_H \ No newline at end of file diff --git a/common/studio_ref.h b/common/studio_ref.h new file mode 100644 index 00000000..231df040 --- /dev/null +++ b/common/studio_ref.h @@ -0,0 +1,337 @@ +//======================================================================= +// Copyright XashXT Group 2008 © +// studio_ref.h - studio model reference +//======================================================================= +#ifndef STUDIO_REF_H +#define STUDIO_REF_H + +/* +============================================================================== + +STUDIO MODELS + +Studio models are position independent, so the cache manager can move them. +============================================================================== +*/ + +// header +#define STUDIO_VERSION 10 +#define IDSTUDIOHEADER (('T'<<24)+('S'<<16)+('D'<<8)+'I') // little-endian "IDST" +#define IDSEQGRPHEADER (('Q'<<24)+('S'<<16)+('D'<<8)+'I') // little-endian "IDSQ" + +// studio limits +#define MAXSTUDIOTRIANGLES 32768 // max triangles per model +#define MAXSTUDIOVERTS 4096 // max vertices per submodel +#define MAXSTUDIOSEQUENCES 256 // total animation sequences +#define MAXSTUDIOSKINS 128 // total textures +#define MAXSTUDIOSRCBONES 512 // bones allowed at source movement +#define MAXSTUDIOBONES 128 // total bones actually used +#define MAXSTUDIOMODELS 32 // sub-models per model +#define MAXSTUDIOBODYPARTS 32 // body parts per submodel +#define MAXSTUDIOGROUPS 16 // sequence groups (e.g. barney01.mdl, barney02.mdl, e.t.c) +#define MAXSTUDIOANIMATIONS 512 // max frames per sequence +#define MAXSTUDIOMESHES 256 // max textures per model +#define MAXSTUDIOEVENTS 1024 // events per model +#define MAXSTUDIOPIVOTS 256 // pivot points +#define MAXSTUDIOBLENDS 16 // max anim blends +#define MAXSTUDIOCONTROLLERS 16 // max controllers per model +#define MAXSTUDIOATTACHMENTS 16 // max attachments per model + +// model global flags +#define STUDIO_STATIC 0x0001 // model without anims +#define STUDIO_RAGDOLL 0x0002 // ragdoll animation pose + +// lighting & rendermode options +#define STUDIO_NF_FLATSHADE 0x0001 +#define STUDIO_NF_CHROME 0x0002 +#define STUDIO_NF_FULLBRIGHT 0x0004 +#define STUDIO_NF_COLORMAP 0x0008 // can changed by colormap command +#define STUDIO_NF_BLENDED 0x0010 // rendering as semiblended +#define STUDIO_NF_ADDITIVE 0x0020 // rendering with additive mode +#define STUDIO_NF_TRANSPARENT 0x0040 // use texture with alpha channel + +// motion flags +#define STUDIO_X 0x0001 +#define STUDIO_Y 0x0002 +#define STUDIO_Z 0x0004 +#define STUDIO_XR 0x0008 +#define STUDIO_YR 0x0010 +#define STUDIO_ZR 0x0020 +#define STUDIO_LX 0x0040 +#define STUDIO_LY 0x0080 +#define STUDIO_LZ 0x0100 +#define STUDIO_AX 0x0200 +#define STUDIO_AY 0x0400 +#define STUDIO_AZ 0x0800 +#define STUDIO_AXR 0x1000 +#define STUDIO_AYR 0x2000 +#define STUDIO_AZR 0x4000 +#define STUDIO_TYPES 0x7FFF +#define STUDIO_RLOOP 0x8000 // controller that wraps shortest distance + +// bonecontroller types +#define STUDIO_MOUTH 4 + +// sequence flags +#define STUDIO_LOOPING 0x0001 + +// render flags +#define STUDIO_RENDER 0x0001 +#define STUDIO_EVENTS 0x0002 +#define STUDIO_MIRROR 0x0004 // a local player in mirror + +// bone flags +#define STUDIO_HAS_NORMALS 0x0001 +#define STUDIO_HAS_VERTICES 0x0002 +#define STUDIO_HAS_BBOX 0x0004 +#define STUDIO_HAS_CHROME 0x0008 // if any of the textures have chrome on them + +typedef struct +{ + int ident; + int version; + + char name[64]; + int length; + + vec3_t eyeposition; // ideal eye position + vec3_t min; // ideal movement hull size + vec3_t max; + + vec3_t bbmin; // clipping bounding box + vec3_t bbmax; + + int flags; + + int numbones; // bones + int boneindex; + + int numbonecontrollers; // bone controllers + int bonecontrollerindex; + + int numhitboxes; // complex bounding boxes + int hitboxindex; + + int numseq; // animation sequences + int seqindex; + + int numseqgroups; // demand loaded sequences + int seqgroupindex; + + int numtextures; // raw textures + int textureindex; + int texturedataindex; + + int numskinref; // replaceable textures + int numskinfamilies; + int skinindex; + + int numbodyparts; + int bodypartindex; + + int numattachments; // queryable attachable points + int attachmentindex; + + int soundtable; + int soundindex; + int soundgroups; + int soundgroupindex; + + int numtransitions; // animation node to animation node transition graph + int transitionindex; +} dstudiohdr_t; + +// header for demand loaded sequence group data +typedef struct +{ + int id; + int version; + + char name[64]; + int length; +} dstudioseqhdr_t; + +// bones +typedef struct +{ + char name[32]; // bone name for symbolic links + int parent; // parent bone + int flags; // ?? + int bonecontroller[6]; // bone controller index, -1 == none + float value[6]; // default DoF values + float scale[6]; // scale for delta DoF values +} dstudiobone_t; + +// bone controllers +typedef struct +{ + int bone; // -1 == 0 + int type; // X, Y, Z, XR, YR, ZR, M + float start; + float end; + int rest; // byte index value at rest + int index; // 0-3 user set controller, 4 mouth +} dstudiobonecontroller_t; + +// intersection boxes +typedef struct +{ + int bone; + int group; // intersection group + vec3_t bbmin; // bounding box + vec3_t bbmax; +} dstudiobbox_t; + +// demand loaded sequence groups +typedef struct +{ + char label[32]; // textual name + char name[64]; // file name + void *cache; // cache index pointer (only in memory) + int data; // hack for group 0 +} dstudioseqgroup_t; + +// sequence descriptions +typedef struct +{ + char label[32]; // sequence label (name) + + float fps; // frames per second + int flags; // looping/non-looping flags + + int activity; + int actweight; + + int numevents; + int eventindex; + + int numframes; // number of frames per sequence + + int numpivots; // number of foot pivots + int pivotindex; + + int motiontype; + int motionbone; + vec3_t linearmovement; + int automoveposindex; + int automoveangleindex; + + vec3_t bbmin; // per sequence bounding box + vec3_t bbmax; + + int numblends; + int animindex; // mstudioanim_t pointer relative to start of sequence group data + // [blend][bone][X, Y, Z, XR, YR, ZR] + + int blendtype[2]; // X, Y, Z, XR, YR, ZR + float blendstart[2]; // starting value + float blendend[2]; // ending value + int blendparent; + + int seqgroup; // sequence group for demand loading + + int entrynode; // transition node at entry + int exitnode; // transition node at exit + int nodeflags; // transition rules + + int nextseq; // auto advancing sequences +} dstudioseqdesc_t; + +// events +#include "studio_event.h" + +// pivots +typedef struct +{ + vec3_t org; // pivot point + int start; + int end; +} dstudiopivot_t; + +// attachment +typedef struct +{ + char name[32]; + int type; + int bone; + vec3_t org; // attachment point + vec3_t vectors[3]; +} dstudioattachment_t; + +typedef struct +{ + unsigned short offset[6]; +} dstudioanim_t; + +// animation frames +typedef union +{ + struct + { + byte valid; + byte total; + } num; + short value; +} dstudioanimvalue_t; + + +// body part index +typedef struct +{ + char name[64]; + int nummodels; + int base; + int modelindex; // index into models array +} dstudiobodyparts_t; + +// skin info +typedef struct +{ + char name[64]; + int flags; + int width; + int height; + + union + { + int index; // disk: offset at start of buffer + shader_t shader; // ref: shader number + }; +} dstudiotexture_t; + +// skin families +// short index[skinfamilies][skinref] // skingroup info + +// studio models +typedef struct +{ + char name[64]; + + int type; + float boundingradius; // software stuff + + int nummesh; + int meshindex; + + int numverts; // number of unique vertices + int vertinfoindex; // vertex bone info + int vertindex; // vertex vec3_t + int numnorms; // number of unique surface normals + int norminfoindex; // normal bone info + int normindex; // normal vec3_t + + int numgroups; // deformation groups + int groupindex; +} dstudiomodel_t; + +// meshes +typedef struct +{ + int numtris; + int triindex; + int skinref; + int numnorms; // per mesh normals + int normindex; // normal vec3_t +} dstudiomesh_t; + +#endif//STUDIO_REF_H \ No newline at end of file diff --git a/public/svgame_api.h b/common/svgame_api.h similarity index 89% rename from public/svgame_api.h rename to common/svgame_api.h index 7ec1adb4..455b1f33 100644 --- a/public/svgame_api.h +++ b/common/svgame_api.h @@ -5,34 +5,8 @@ #ifndef SVGAME_API_H #define SVGAME_API_H -enum -{ - WALKMOVE_NORMAL = 0, - WALKMOVE_NOMONSTERS, - WALKMOVE_MISSILE, - WALKMOVE_WORLDONLY, - WALKMOVE_HITMODEL, - WALKMOVE_CHECKONLY, -}; - -#define at_debug at_console // FIXME: stupid Laurie stuff - -// NOTE: engine trace struct not matched with svgame trace -typedef struct -{ - BOOL fAllSolid; // if true, plane is not valid - BOOL fStartSolid; // if true, the initial point was in a solid area - BOOL fStartStuck; // if true, trace started from solid entity - float flFraction; // time completed, 1.0 = didn't hit anything - vec3_t vecEndPos; // final position - int iStartContents; // start pos conetnts - int iContents; // final pos contents - int iHitgroup; // 0 == generic, non zero is specific body part - float flPlaneDist; // planes distance - vec3_t vecPlaneNormal; // surface normal at impact - const char *pTexName; // texture name that we hitting (brushes and studiomodels) - edict_t *pHit; // entity the surface is on -} TraceResult; +#include "trace_def.h" +#include "event_api.h" typedef struct globalvars_s { @@ -84,6 +58,7 @@ typedef struct enginefuncs_s int api_size; // must matched with sizeof( enginefuncs_t ) void* (*pfnMemAlloc)( size_t cb, const char *filename, const int fileline ); + void (*pfnMemCopy)( void *dest, const void *src, size_t cb, const char *filename, const int fileline ); void (*pfnMemFree)( void *mem, const char *filename, const int fileline ); int (*pfnPrecacheModel)( const char* s ); int (*pfnPrecacheSound)( const char* s ); @@ -110,7 +85,7 @@ typedef struct enginefuncs_s void (*pfnRemoveEntity)( edict_t* e ); edict_t* (*pfnCreateNamedEntity)( string_t className ); void (*pfnMakeStatic)( edict_t *ent ); - int (*pfnEntIsOnFloor)( edict_t *e ); + void (*pfnLinkEdict)( edict_t *e ); int (*pfnDropToFloor)( edict_t* e ); int (*pfnWalkMove)( edict_t *ent, float yaw, float dist, int iMode ); void (*pfnSetOrigin)( edict_t *e, const float *rgflOrigin ); @@ -193,6 +168,10 @@ typedef struct enginefuncs_s char* (*pfnGetInfoKeyBuffer)( edict_t *e ); // passing in NULL gets the serverinfo void (*pfnSetClientKeyValue)( int clientIndex, char *infobuffer, char *key, char *value ); + word (*pfnPrecacheEvent)( int type, const char *psz ); + void (*pfnPlaybackEvent)( int flags, const edict_t *pInvoker, word eventindex, float delay, event_args_t *args ); + BOOL (*pfnCanSkipPlayer)( const edict_t *player ); + void (*pfnSetSkybox)( const char *name ); void (*pfnPlayMusic)( const char *trackname, int flags ); // background track void (*pfnDropClient)( int clientIndex ); // used for kick cheaters from server @@ -311,14 +290,14 @@ typedef struct // initialize/shutdown the game (one-time call after loading of game .dll ) void (*pfnGameInit)( void ); + void (*pfnGameShutdown)( void ); int (*pfnSpawn)( edict_t *pent ); - int (*pfnCreate)( edict_t *pent, const char *szName ); + int (*pfnCreate)( edict_t *pent, const char *szName ); // create custom entities void (*pfnThink)( edict_t *pent ); void (*pfnUse)( edict_t *pentUsed, edict_t *pentOther ); void (*pfnTouch)( edict_t *pentTouched, edict_t *pentOther ); void (*pfnBlocked)( edict_t *pentBlocked, edict_t *pentOther ); void (*pfnKeyValue)( edict_t *pentKeyvalue, KeyValueData *pkvd ); - void (*pfnFrame)( edict_t *pent ); void (*pfnSave)( edict_t *pent, SAVERESTOREDATA *pSaveData ); int (*pfnRestore)( edict_t *pent, SAVERESTOREDATA *pSaveData, int globalEntity ); void (*pfnSetAbsBox)( edict_t *pent ); @@ -342,19 +321,18 @@ typedef struct void (*pfnPlayerPostThink)( edict_t *pEntity ); void (*pfnStartFrame)( void ); + void (*pfnFrame)( edict_t *pent ); void (*pfnEndFrame)( void ); void (*pfnBuildLevelList)( void ); + void (*pfnClassifyEdict)( edict_t *pentToClassify ); + void (*pfnUpdateEntityState)( struct entity_state_s *to, edict_t *from, int baseline ); + // returns string describing current .dll. E.g., TeamFotrress 2, Half-Life const char *(*pfnGetGameDescription)( void ); } DLL_FUNCTIONS; -// TODO: create single func -// typedef DLL_FUNCTIONS *(*GetEntityAPI)( enginefuncs_t* engfuncs, globalvars_t *pGlobals ); -// set pointer to globals, returns export of dll_functions and use CreateAPI as base offset - -typedef void (*GIVEFNPTRSTODLL)( enginefuncs_t* engfuncs, globalvars_t *pGlobals ); -typedef int (*APIFUNCTION)( DLL_FUNCTIONS *pFunctionTable, int interfaceVersion ); +typedef int (*SERVERAPI)( DLL_FUNCTIONS *pFunctionTable, enginefuncs_t* engfuncs, globalvars_t *pGlobals ); typedef void (*LINK_ENTITY_FUNC)( entvars_t *pev ); #endif//SVGAME_API_H \ No newline at end of file diff --git a/common/trace_def.h b/common/trace_def.h new file mode 100644 index 00000000..9984edfb --- /dev/null +++ b/common/trace_def.h @@ -0,0 +1,75 @@ +//======================================================================= +// Copyright XashXT Group 2009 © +// trace_def.h - model event definition +//======================================================================= +#ifndef TRACE_DEF_H +#define TRACE_DEF_H + +// monster's walkmove modes +enum +{ + WALKMOVE_NORMAL = 0, + WALKMOVE_NOMONSTERS, + WALKMOVE_MISSILE, + WALKMOVE_WORLDONLY, + WALKMOVE_HITMODEL, + WALKMOVE_CHECKONLY, +}; + +// bsp contents +typedef enum +{ + CONTENTS_NONE = 0, // just a mask for source tabulation + CONTENTS_SOLID = BIT(0), // an eye is never valid in a solid + CONTENTS_WINDOW = BIT(1), // translucent, but not watery + CONTENTS_AUX = BIT(2), + CONTENTS_LAVA = BIT(3), + CONTENTS_SLIME = BIT(4), + CONTENTS_WATER = BIT(5), + CONTENTS_SKY = BIT(6), + + // space for new user contents + + CONTENTS_MIST = BIT(12),// g-cont. what difference between fog and mist ? + LAST_VISIBLE_CONTENTS = BIT(12),// mask (LAST_VISIBLE_CONTENTS-1) + CONTENTS_FOG = BIT(13),// future expansion + CONTENTS_AREAPORTAL = BIT(14),// func_areaportal volume + CONTENTS_PLAYERCLIP = BIT(15),// clip affect only by player or bot + CONTENTS_MONSTERCLIP = BIT(16),// clip affect only by monster or npc + CONTENTS_CLIP = (CONTENTS_PLAYERCLIP|CONTENTS_MONSTERCLIP), // both type clip + CONTENTS_ORIGIN = BIT(17),// removed before bsping an entity + CONTENTS_BODY = BIT(18),// should never be on a brush, only in game + CONTENTS_CORPSE = BIT(19),// deadbody + CONTENTS_DETAIL = BIT(20),// brushes to be added after vis leafs + CONTENTS_TRANSLUCENT = BIT(21),// auto set if any surface has trans + CONTENTS_LADDER = BIT(22),// like water but ladder : ) + CONTENTS_TRIGGER = BIT(23),// trigger volume + + // content masks + MASK_SOLID = (CONTENTS_SOLID|CONTENTS_WINDOW), + MASK_PLAYERSOLID = (CONTENTS_SOLID|CONTENTS_PLAYERCLIP|CONTENTS_WINDOW|CONTENTS_BODY), + MASK_MONSTERSOLID = (CONTENTS_SOLID|CONTENTS_MONSTERCLIP|CONTENTS_WINDOW|CONTENTS_BODY), + MASK_DEADSOLID = (CONTENTS_SOLID|CONTENTS_PLAYERCLIP|CONTENTS_WINDOW|CONTENTS_WINDOW), + MASK_WATER = (CONTENTS_WATER|CONTENTS_LAVA|CONTENTS_SLIME), + MASK_OPAQUE = (CONTENTS_SOLID|CONTENTS_SLIME|CONTENTS_LAVA), + MASK_SHOT = (CONTENTS_SOLID|CONTENTS_BODY|CONTENTS_WINDOW|CONTENTS_CORPSE) +} contentType_t; + +// NOTE: engine trace struct not matched with game trace +typedef struct +{ + BOOL fAllSolid; // if true, plane is not valid + BOOL fStartSolid; // if true, the initial point was in a solid area + BOOL fStartStuck; // if true, trace started from solid entity + float flFraction; // time completed, 1.0 = didn't hit anything + vec3_t vecEndPos; // final position + int iStartContents; // start pos conetnts + int iContents; // final pos contents + int iHitgroup; // 0 == generic, non zero is specific body part + float flPlaneDist; // planes distance + vec3_t vecPlaneNormal; // surface normal at impact + const char *pTexName; // texture name that we hitting (brushes and studiomodels) + edict_t *pHit; // entity the surface is on +} TraceResult; + +#endif//TRACE_DEF_H \ No newline at end of file diff --git a/common/triangle_api.h b/common/triangle_api.h new file mode 100644 index 00000000..1d73b0ad --- /dev/null +++ b/common/triangle_api.h @@ -0,0 +1,49 @@ +//======================================================================= +// Copyright XashXT Group 2008 © +// triangle_api.h - custom triangles rendering +//======================================================================= +#ifndef TRIANGLE_API_H +#define TRIANGLE_API_H + +typedef enum +{ + TRI_FRONT = 0, + TRI_BACK, + TRI_NONE, +} TRI_CULL; + +typedef enum +{ + TRI_TRIANGLES = 0, + TRI_TRIANGLE_FAN, + TRI_TRIANGLE_STRIP, + TRI_POLYGON, + TRI_QUADS, + TRI_LINES, +} TRI_DRAW; + +typedef struct triapi_s +{ + size_t api_size; // must match with sizeof( triapi_t ); + + void (*RenderMode)( kRenderMode_t mode ); + void (*Bind)( HSPRITE shader ); // use handle that return pfnLoadShader + void (*Begin)( TRI_DRAW mode ); + void (*End)( void ); + + void (*Vertex2f)( float x, float y ); + void (*Vertex3f)( float x, float y, float z ); + void (*Vertex2fv)( const float *v ); + void (*Vertex3fv)( const float *v ); + void (*Color3f)( float r, float g, float b ); + void (*Color4f)( float r, float g, float b, float a ); + void (*Color4ub)( byte r, byte g, byte b, byte a ); + void (*TexCoord2f)( float u, float v ); + void (*TexCoord2fv)( const float *v ); + void (*CullFace)( TRI_CULL mode ); + void (*ScreenToWorld)( float *screen, float *world ); + int (*WorldToScreen)( float *world, float *screen ); // returns 1 if it's z clipped + void (*Fog)( float flFogColor[3], float flStart, float flEnd, int bOn ); +} triapi_t; + +#endif//TRIANGLE_API_H \ No newline at end of file diff --git a/debug.bat b/debug.bat index bb29ac58..da1f8b98 100644 --- a/debug.bat +++ b/debug.bat @@ -20,9 +20,6 @@ if errorlevel 1 set BUILD_ERROR=1 %MSDEV% launch/launch.dsp %CONFIG%"launch - Win32 Debug" %build_target% if errorlevel 1 set BUILD_ERROR=1 -%MSDEV% common/common.dsp %CONFIG%"common - Win32 Debug" %build_target% -if errorlevel 1 set BUILD_ERROR=1 - %MSDEV% physic/physic.dsp %CONFIG%"physic - Win32 Debug" %build_target% if errorlevel 1 set BUILD_ERROR=1 @@ -38,6 +35,9 @@ if errorlevel 1 set BUILD_ERROR=1 %MSDEV% vsound/vsound.dsp %CONFIG%"vsound - Win32 Debug" %build_target% if errorlevel 1 set BUILD_ERROR=1 +%MSDEV% xtools/xtools.dsp %CONFIG%"xtools - Win32 Debug" %build_target% +if errorlevel 1 set BUILD_ERROR=1 + if "%BUILD_ERROR%"=="" goto build_ok echo ********************* @@ -61,13 +61,13 @@ if exist baserc\baserc.plg del /f /q baserc\baserc.plg if exist client\client.plg del /f /q client\client.plg if exist engine\engine.plg del /f /q engine\engine.plg if exist launch\launch.plg del /f /q launch\launch.plg -if exist common\common.plg del /f /q common\common.plg if exist physic\physic.plg del /f /q physic\physic.plg if exist server\server.plg del /f /q server\server.plg if exist render\render.plg del /f /q render\render.plg if exist viewer\viewer.plg del /f /q viewer\viewer.plg if exist vprogs\vprogs.plg del /f /q vprogs\vprogs.plg if exist vsound\vsound.plg del /f /q vsound\vsound.plg +if exist xtools\xtools.plg del /f /q xtools\xtools.plg echo Build succeeded! echo Please wait. Xash is now loading diff --git a/engine/client/cl_game.c b/engine/client/cl_game.c index 4a2de3ab..65100813 100644 --- a/engine/client/cl_game.c +++ b/engine/client/cl_game.c @@ -9,6 +9,8 @@ #include "matrix_lib.h" #include "com_library.h" #include "const.h" +#include "triangle_api.h" +#include "effects_api.h" /* ==================== @@ -28,6 +30,43 @@ edict_t *CL_GetEdictByIndex( int index ) return EDICT_NUM( index ); } +static trace_t CL_TraceToss( edict_t *tossent, edict_t *ignore) +{ + int i; + float gravity; + vec3_t move, end; + vec3_t original_origin; + vec3_t original_velocity; + vec3_t original_angles; + vec3_t original_avelocity; + trace_t trace; + + VectorCopy( tossent->v.origin, original_origin ); + VectorCopy( tossent->v.velocity, original_velocity ); + VectorCopy( tossent->v.angles, original_angles ); + VectorCopy( tossent->v.avelocity, original_avelocity ); + gravity = tossent->v.gravity * clgame.gravity * 0.05; + + for( i = 0; i < 200; i++ ) + { + // LordHavoc: sanity check; never trace more than 10 seconds + CL_CheckVelocity( tossent ); + tossent->v.velocity[2] -= gravity; + VectorMA( tossent->v.angles, 0.05, tossent->v.avelocity, tossent->v.angles ); + VectorScale( tossent->v.velocity, 0.05, move ); + VectorAdd( tossent->v.origin, move, end ); + trace = CL_Trace( tossent->v.origin, tossent->v.mins, tossent->v.maxs, end, MOVE_NORMAL, tossent, CL_ContentsMask( tossent )); + VectorCopy( trace.endpos, tossent->v.origin ); + if( trace.fraction < 1 ) break; + } + VectorCopy( original_origin, tossent->v.origin ); + VectorCopy( original_velocity, tossent->v.velocity ); + VectorCopy( original_angles, tossent->v.angles ); + VectorCopy( original_avelocity, tossent->v.avelocity ); + + return trace; +} + /* ==================== CL_GetLocalPlayer @@ -392,15 +431,26 @@ void pfnRegisterVariable( const char *szName, const char *szValue, int flags, co Cvar_Get( szName, szValue, flags, szDesc ); } +/* +============= +pfnCvarSetString + +============= +*/ +void pfnCvarSetString( const char *szName, const char *szValue ) +{ + Cvar_Set( szName, szValue ); +} + /* ============= pfnCvarSetValue ============= */ -void pfnCvarSetValue( const char *cvar, float value ) +void pfnCvarSetValue( const char *szName, float flValue ) { - Cvar_SetValue( cvar, value ); + Cvar_SetValue( szName, flValue ); } /* @@ -833,6 +883,105 @@ static void pfnTraceLine( const float *v1, const float *v2, int fNoMonsters, edi CL_CopyTraceResult( ptr, trace ); } +/* +================= +pfnTraceToss + +================= +*/ +static void pfnTraceToss( edict_t* pent, edict_t* pentToIgnore, TraceResult *ptr ) +{ + trace_t trace; + + if( pent == EDICT_NUM( 0 )) return; + trace = CL_TraceToss( pent, pentToIgnore ); + CL_CopyTraceResult( ptr, trace ); +} + +/* +================= +pfnTraceHull + +================= +*/ +static void pfnTraceHull( const float *v1, const float *mins, const float *maxs, const float *v2, int fNoMonsters, edict_t *pentToSkip, TraceResult *ptr ) +{ + trace_t trace; + int move; + + move = (fNoMonsters) ? MOVE_NOMONSTERS : MOVE_NORMAL; + + if( IS_NAN(v1[0]) || IS_NAN(v1[1]) || IS_NAN(v1[2]) || IS_NAN(v2[0]) || IS_NAN(v1[2]) || IS_NAN(v2[2] )) + Host_Error( "CL_TraceHull: NAN errors detected ('%f %f %f', '%f %f %f'\n", v1[0], v1[1], v1[2], v2[0], v2[1], v2[2] ); + + trace = CL_Trace( v1, mins, mins, v2, move, pentToSkip, CL_ContentsMask( pentToSkip )); + CL_CopyTraceResult( ptr, trace ); +} + +static void pfnTraceModel( const float *v1, const float *v2, edict_t *pent, TraceResult *ptr ) +{ + // FIXME: implement +} + +static const char *pfnTraceTexture( edict_t *pTextureEntity, const float *v1, const float *v2 ) +{ + trace_t trace; + + if( IS_NAN(v1[0]) || IS_NAN(v1[1]) || IS_NAN(v1[2]) || IS_NAN(v2[0]) || IS_NAN(v1[2]) || IS_NAN(v2[2] )) + Host_Error( "CL_TraceTexture: NAN errors detected ('%f %f %f', '%f %f %f'\n", v1[0], v1[1], v1[2], v2[0], v2[1], v2[2] ); + + trace = CL_Trace( v1, vec3_origin, vec3_origin, v2, MOVE_NOMONSTERS, NULL, CL_ContentsMask( pTextureEntity )); + + if( trace.surface ) + return trace.surface->name; + return NULL; +} + +/* +============= +pfnPrecacheEvent + +============= +*/ +static word pfnPrecacheEvent( int type, const char* psz ) +{ + // FIXME: implement + return 0; +} + +/* +============= +pfnHookEvent + +============= +*/ +static void pfnHookEvent( const char *name, pfnEventHook pfn ) +{ + // FIXME: implement +} + +/* +============= +pfnPlaybackEvent + +============= +*/ +static void pfnPlaybackEvent( int flags, const edict_t *pInvoker, word eventindex, float delay, event_args_t *args ) +{ + // FIXME: implement +} + +/* +============= +pfnKillEvent + +============= +*/ +static void pfnKillEvent( word eventindex ) +{ + // FIXME: implement +} + /* ============= CL_AllocString @@ -859,18 +1008,25 @@ static triapi_t gTriApi = { sizeof( triapi_t ), }; + +static efxapi_t gEfxApi = +{ + sizeof( efxapi_t ), +}; // engine callbacks static cl_enginefuncs_t gEngfuncs = { sizeof( cl_enginefuncs_t ), pfnMemAlloc, + pfnMemCopy, pfnMemFree, pfnLoadShader, pfnFillRGBA, pfnDrawImageExt, pfnSetColor, pfnRegisterVariable, + pfnCvarSetString, pfnCvarSetValue, pfnGetCvarFloat, pfnGetCvarString, @@ -902,13 +1058,24 @@ static cl_enginefuncs_t gEngfuncs = pfnMakeLevelShot, pfnPointContents, pfnTraceLine, + pfnTraceToss, + pfnTraceHull, + pfnTraceModel, + pfnTraceTexture, + pfnPrecacheEvent, + pfnHookEvent, + pfnPlaybackEvent, + pfnKillEvent, + CL_AllocString, + CL_GetString, pfnRandomLong, pfnRandomFloat, pfnLoadFile, pfnFileExists, pfnGetGameDir, Host_Error, - &gTriApi + &gTriApi, + &gEfxApi }; /* @@ -959,7 +1126,7 @@ bool CL_LoadProgs( const char *name ) return false; } - if( !GetClientAPI( &cls.dllFuncs, &gEngfuncs, INTERFACE_VERSION )) + if( !GetClientAPI( &cls.dllFuncs, &gEngfuncs )) { MsgDev( D_ERROR, "CL_LoadProgs: can't init client API\n" ); return false; @@ -975,6 +1142,9 @@ bool CL_LoadProgs( const char *name ) pfnHookUserMsg( "bad", NULL ); CL_LinkUserMessage( "bad@0", svc_bad ); + clgame.gravity = com.atof( DEFAULT_GRAVITY ); + clgame.maxVelocity = com.atof( DEFAULT_MAXVELOCITY ); + for( i = 0, e = EDICT_NUM( 0 ); i < clgame.maxEntities; i++, e++ ) e->free = true; // mark all edicts as freed diff --git a/engine/client/cl_parse.c b/engine/client/cl_parse.c index 00fa2931..5e628621 100644 --- a/engine/client/cl_parse.c +++ b/engine/client/cl_parse.c @@ -296,6 +296,7 @@ CL_ParseConfigString void CL_ParseConfigString( sizebuf_t *msg ) { int i; + float value; i = MSG_ReadShort( msg ); if( i < 0 || i >= MAX_CONFIGSTRINGS ) @@ -307,6 +308,18 @@ void CL_ParseConfigString( sizebuf_t *msg ) { re->RegisterShader( cl.configstrings[CS_SKYNAME], SHADER_SKY ); } + else if( i == CS_MAXVELOCITY ) + { + value = com.atof( cl.configstrings[CS_MAXVELOCITY] ); + if( value > 0 ) clgame.maxVelocity = value; + else clgame.maxVelocity = com.atof( DEFAULT_MAXVELOCITY ); + } + else if( i == CS_GRAVITY ) + { + value = com.atof( cl.configstrings[CS_GRAVITY] ); + if( value > 0 ) clgame.gravity = value; + else clgame.gravity = com.atof( DEFAULT_GRAVITY ); + } else if( i == CS_BACKGROUND_TRACK && cl.audio_prepped ) { CL_RunBackgroundTrack(); diff --git a/engine/client/cl_phys.c b/engine/client/cl_phys.c index 14d40bbf..f3e11996 100644 --- a/engine/client/cl_phys.c +++ b/engine/client/cl_phys.c @@ -185,6 +185,41 @@ trace_t CL_Trace( const vec3_t start, const vec3_t mins, const vec3_t maxs, cons return cliptrace; } +/* +================ +CL_CheckVelocity +================ +*/ +void CL_CheckVelocity( edict_t *ent ) +{ + int i; + float wishspeed; + + // bound velocity + for( i = 0; i < 3; i++ ) + { + if(IS_NAN(ent->v.velocity[i])) + { + MsgDev( D_INFO, "Got a NaN velocity on entity #%i (%s)\n", NUM_FOR_EDICT( ent ), STRING( ent->v.classname )); + ent->v.velocity[i] = 0; + } + if (IS_NAN(ent->v.origin[i])) + { + MsgDev( D_INFO, "Got a NaN origin on entity #%i (%s)\n", NUM_FOR_EDICT( ent ), STRING( ent->v.classname )); + ent->v.origin[i] = 0; + } + } + + // LordHavoc: max velocity fix, inspired by Maddes's source fixes, but this is faster + wishspeed = DotProduct( ent->v.velocity, ent->v.velocity ); + if( wishspeed > ( clgame.maxVelocity * clgame.maxVelocity )) + { + wishspeed = clgame.maxVelocity / com.sqrt( wishspeed ); + ent->v.velocity[0] *= wishspeed; + ent->v.velocity[1] *= wishspeed; + ent->v.velocity[2] *= wishspeed; + } +} /* ==================== diff --git a/engine/client/cl_view.c b/engine/client/cl_view.c index ab9265af..34084ec6 100644 --- a/engine/client/cl_view.c +++ b/engine/client/cl_view.c @@ -174,13 +174,12 @@ void V_RenderView( void ) Mem_Copy( &cl.refdef.viewport, &scr_rect, sizeof( cl.refdef.viewport )); cl.refdef.areabits = cl.frame.areabits; - cl.refdef.rdflags = cl.frame.ps.renderfx; cl.refdef.fov_y = V_CalcFov( cl.refdef.fov_x, cl.refdef.viewport[2], cl.refdef.viewport[3] ); cl.refdef.oldtime = (cl.oldtime * 0.001f); cl.refdef.time = (cl.time * 0.001f); // cl.time for right lerping cl.refdef.frametime = cls.frametime; - if( cl.refdef.rdflags & RDF_UNDERWATER ) + if( cl.frame.ps.renderfx == kRenderFxUnderwater ) { float f = com.sin( cl.time * 0.001 * 0.4 * (M_PI * 2.7)); cl.refdef.fov_x += f; diff --git a/engine/client/client.h b/engine/client/client.h index 559658e0..ac2e3e33 100644 --- a/engine/client/client.h +++ b/engine/client/client.h @@ -210,6 +210,11 @@ typedef struct user_message_t *msg[MAX_USER_MESSAGES]; int numMessages; // actual count of user messages int hStringTable; // stringtable handle + + // sae values from server cvars + float maxVelocity; + float gravity; + } clgame_static_t; typedef struct @@ -561,7 +566,8 @@ float V_CalcFov( float fov_x, float width, float height ); // void CL_InitPrediction (void); void CL_PredictMove (void); -void CL_CheckPredictionError (void); +void CL_CheckPredictionError( void ); +void CL_CheckVelocity( edict_t *ent ); int CL_PointContents( const vec3_t point ); int CL_ContentsMask( const edict_t *passedict ); bool CL_AmbientLevel( const vec3_t point, float *volumes ); diff --git a/engine/common.h b/engine/common.h index 0ae6f550..8f6aff6c 100644 --- a/engine/common.h +++ b/engine/common.h @@ -29,6 +29,10 @@ extern vsound_exp_t *se; #define MAX_HEARTBEAT -99999 // connection time #define MAX_EVENTS 1024 // system events +// some engine shared constants +#define DEFAULT_MAXVELOCITY "2000" +#define DEFAULT_GRAVITY "800" + // all drawing is done to a 640*480 virtual screen size // and will be automatically scaled to the real resolution #define SCREEN_WIDTH 640 @@ -148,6 +152,7 @@ PRVM INTERACTIONS ============================================================== */ +void pfnMemCopy( void *dest, const void *src, size_t cb, const char *filename, const int fileline ); byte* pfnLoadFile( const char *filename, int *pLength ); int pfnFileExists( const char *filename ); long pfnRandomLong( long lLow, long lHigh ); diff --git a/engine/common/engfuncs.c b/engine/common/engfuncs.c index f0318cd1..482deea7 100644 --- a/engine/common/engfuncs.c +++ b/engine/common/engfuncs.c @@ -92,6 +92,17 @@ void pfnAlertMessage( ALERT_TYPE level, char *szFmt, ... ) } } +/* +============= +pfnMemCopy + +============= +*/ +void pfnMemCopy( void *dest, const void *src, size_t cb, const char *filename, const int fileline ) +{ + com.memcpy( dest, src, cb, filename, fileline ); +} + /* ============= pfnGetGameDir @@ -1378,7 +1389,7 @@ void VM_drawmodel( void ) refdef.fov_y = V_CalcFov( refdef.fov_x, refdef.viewport[2], refdef.viewport[3] ); refdef.time = cls.realtime * 0.001f; refdef.oldtime = refdef.time - 0.005; - refdef.rdflags = RDF_NOWORLDMODEL; + refdef.onlyClientDraw = true; re->ClearScene(); re->RegisterModel( modname, MAX_MODELS - 1 ); diff --git a/engine/common/net_msg.c b/engine/common/net_msg.c index bab8229d..0872c21d 100644 --- a/engine/common/net_msg.c +++ b/engine/common/net_msg.c @@ -10,6 +10,7 @@ static net_field_t ent_fields[] = { { ES_FIELD(ed_type), NET_BYTE, false }, // stateflags_t #0 (4 bytes) +{ ES_FIELD(ed_flags), NET_BYTE, true }, // stateflags_t #0 (4 bytes) { ES_FIELD(classname), NET_WORD, false }, { ES_FIELD(soundindex), NET_WORD, false }, // 512 sounds ( OpenAL software limit is 255 ) { ES_FIELD(origin[0]), NET_FLOAT, false }, @@ -21,6 +22,9 @@ static net_field_t ent_fields[] = { ES_FIELD(velocity[0]), NET_FLOAT, false }, { ES_FIELD(velocity[1]), NET_FLOAT, false }, { ES_FIELD(velocity[2]), NET_FLOAT, false }, +{ ES_FIELD(avelocity[0]), NET_FLOAT, false }, +{ ES_FIELD(avelocity[1]), NET_FLOAT, false }, +{ ES_FIELD(avelocity[2]), NET_FLOAT, false }, { ES_FIELD(modelindex), NET_WORD, false }, // 4096 models { ES_FIELD(colormap), NET_WORD, false }, // encoded as two shorts for top and bottom color { ES_FIELD(scale), NET_COLOR, false }, // 0-255 values @@ -94,7 +98,7 @@ static net_field_t ent_fields[] = { ES_FIELD(fov), NET_FLOAT, false }, // client horizontal field of view { ES_FIELD(weapons), NET_INT64, false }, // client weapon 0-64 { ES_FIELD(health), NET_FLOAT, false }, // client health -// revision 4. reserve for 12 fields without enlarge null_msg_size +// revision 5. reserve for 6 fields without enlarge null_msg_size { NULL }, // terminator }; diff --git a/engine/common/net_msg.h b/engine/common/net_msg.h index d1b9e143..ba08608e 100644 --- a/engine/common/net_msg.h +++ b/engine/common/net_msg.h @@ -112,66 +112,8 @@ static const net_desc_t NWDesc[] = ========================================================== */ -// entity_state_t communication (a part of network protocol) -typedef struct entity_state_s -{ - // engine specific - uint number; // edict index - edtype_t ed_type; // edict type - string_t classname; // edict classname - int soundindex; // looped ambient sound - // physics information - vec3_t origin; - vec3_t angles; // entity angles, not viewangles - solid_t solid; // entity solid - movetype_t movetype; // entity movetype - int gravity; // gravity multiplier - int aiment; // attached entity - int owner; // projectiles owner - int groundent; // onground edict num, valid only if FL_ONGROUND is set, else -1 - vec3_t mins; // not symmetric entity bbox - vec3_t maxs; - float teleport_time; // time when no prediction - - // model state - int modelindex; // general modelindex - int colormap; // change base color for some textures or sprite frames - float scale; // model or sprite scale, affects to physics too - float frame; // % playback position in animation sequences (0..255) - int skin; // skin for studiomodels - int body; // sub-model selection for studiomodels - float animtime; // auto-animating time - float framerate; // custom framerate, specified by QC - int sequence; // animation sequence (0 - 255) - float blending[16]; // studio animation blending - float controller[16]; // studio bone controllers - - // flags - int64 flags; // v.flags - uint effects; // effect flags like q1 and hl1 - int renderfx; // render effects same as hl1 - float renderamt; // alpha value or like somewhat - vec3_t rendercolor; // hl1 legacy stuff, working, but not needed - int rendermode; // hl1 legacy stuff, working, but not needed - - // client specific - vec3_t velocity; // player velocity - vec3_t delta_angles; // add to command angles to get view direction - vec3_t punch_angles; // add to view direction to get render angles - vec3_t viewangles; // already calculated view angles on server-side - vec3_t viewoffset; // viewoffset over ground - int gaitsequence; // client\nps\bot gaitsequence - int viewmodel; // contains viewmodel index - int weaponmodel; // contains weaponmodel index - int weaponanim; // weaponmodel sequence - int weaponbody; // weaponmodel body - int weaponskin; // weaponmodel skin - float maxspeed; // min( pev->maxspeed, sv_maxspeed->value ) - float health; // client health (other parms can be send by custom messages) - int64 weapons; // weapon flags - float fov; // horizontal field of view -} entity_state_t; +#include "entity_state.h" #define ES_FIELD( x ) #x,(int)&((entity_state_t*)0)->x #define CM_FIELD( x ) #x,(int)&((usercmd_t*)0)->x @@ -185,6 +127,8 @@ typedef struct entity_state_s #define CS_SKYNAME 2 // skybox shader name #define CS_MAXCLIENTS 3 // server maxclients value (0-255) #define CS_BACKGROUND_TRACK 4 // basename of background track +#define CS_GRAVITY 5 // sv_gravity +#define CS_MAXVELOCITY 6 // sv_maxvelocity // reserved config strings diff --git a/engine/engine.dsp b/engine/engine.dsp index 6ef4f7ef..953b130e 100644 --- a/engine/engine.dsp +++ b/engine/engine.dsp @@ -43,7 +43,7 @@ RSC=rc.exe # PROP Ignore_Export_Lib 1 # PROP Target_Dir "" # ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /YX /c -# ADD CPP /nologo /MD /W3 /GX /O2 /I "./" /I "common" /I "server" /I "client" /I "../public" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /FD /c +# ADD CPP /nologo /MD /W3 /GX /O2 /I "./" /I "common" /I "server" /I "client" /I "../public" /I "../common" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /FD /c # SUBTRACT CPP /YX # ADD BASE MTL /nologo /D "NDEBUG" /win32 # ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32 @@ -80,7 +80,7 @@ SOURCE="$(InputPath)" # PROP Ignore_Export_Lib 1 # PROP Target_Dir "" # ADD BASE CPP /nologo /W3 /Gm /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /YX /c -# ADD CPP /nologo /MDd /W3 /Gm /Gi /GX /ZI /Od /I "./" /I "common" /I "server" /I "client" /I "../public" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /FR /FD /c +# ADD CPP /nologo /MDd /W3 /Gm /Gi /GX /ZI /Od /I "./" /I "common" /I "server" /I "client" /I "../public" /I "../common" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /FR /FD /c # SUBTRACT CPP /YX # ADD BASE MTL /nologo /D "_DEBUG" /win32 # ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32 diff --git a/engine/host.c b/engine/host.c index 00ddcb15..265f3db1 100644 --- a/engine/host.c +++ b/engine/host.c @@ -615,12 +615,12 @@ void Host_Init( int argc, char **argv) host.state = HOST_INIT; // initialzation started host.type = g_Instance; - Host_InitCommon( argc, argv ); // loading common.dll + Host_InitCommon( argc, argv ); Key_Init(); // get default configuration - Cbuf_AddText("exec keys.rc\n"); - Cbuf_AddText("exec vars.rc\n"); + Cbuf_AddText( "exec keys.rc\n" ); + Cbuf_AddText( "exec vars.rc\n" ); Cbuf_Execute(); // init commands and vars diff --git a/engine/server/sv_game.c b/engine/server/sv_game.c index 20174c15..d0459cab 100644 --- a/engine/server/sv_game.c +++ b/engine/server/sv_game.c @@ -283,12 +283,12 @@ bool Sys_LoadSymbols( const char *filename ) for( i = 0; i < svgame.num_ordinals; i++ ) { - if( !com.strcmp( "GiveFnptrsToDll", svgame.names[i] )) + if( !com.strcmp( "CreateAPI", svgame.names[i] )) { void *fn_offset; index = svgame.ordinals[i]; - fn_offset = (void *)Com_GetProcAddress( svgame.hInstance, "GiveFnptrsToDll" ); + fn_offset = (void *)Com_GetProcAddress( svgame.hInstance, "CreateAPI" ); svgame.funcBase = (dword)(fn_offset) - svgame.funcs[index]; break; } @@ -1318,14 +1318,14 @@ void pfnMakeStatic( edict_t *ent ) /* ============= -pfnEntIsOnFloor +pfnLinkEntity -stupid unused bulletin +Xash3D extension ============= */ -int pfnEntIsOnFloor( edict_t *e ) +void pfnLinkEntity( edict_t *e ) { - return (e->v.flags & FL_ONGROUND) ? true : false; + SV_LinkEdict( e ); } /* @@ -1613,7 +1613,7 @@ pfnTraceToss ================= */ -void pfnTraceToss( edict_t* pent, edict_t* pentToIgnore, TraceResult *ptr ) +static void pfnTraceToss( edict_t* pent, edict_t* pentToIgnore, TraceResult *ptr ) { trace_t trace; @@ -1626,10 +1626,9 @@ void pfnTraceToss( edict_t* pent, edict_t* pentToIgnore, TraceResult *ptr ) ================= pfnTraceHull -FIXME: replace constant hulls with mins/maxs ================= */ -void pfnTraceHull( const float *v1, const float *mins, const float *maxs, const float *v2, int fNoMonsters, edict_t *pentToSkip, TraceResult *ptr ) +static void pfnTraceHull( const float *v1, const float *mins, const float *maxs, const float *v2, int fNoMonsters, edict_t *pentToSkip, TraceResult *ptr ) { trace_t trace; int move; @@ -1643,12 +1642,12 @@ void pfnTraceHull( const float *v1, const float *mins, const float *maxs, const SV_CopyTraceResult( ptr, trace ); } -void pfnTraceModel( const float *v1, const float *v2, edict_t *pent, TraceResult *ptr ) +static void pfnTraceModel( const float *v1, const float *v2, edict_t *pent, TraceResult *ptr ) { // FIXME: implement } -const char *pfnTraceTexture( edict_t *pTextureEntity, const float *v1, const float *v2 ) +static const char *pfnTraceTexture( edict_t *pTextureEntity, const float *v1, const float *v2 ) { trace_t trace; @@ -2656,6 +2655,42 @@ void pfnSetClientKeyValue( int clientIndex, char *infobuffer, char *key, char *v } } +/* +============= +pfnPrecacheEvent + +returns unique hash-value +============= +*/ +word pfnPrecacheEvent( int type, const char *psz ) +{ + // FIXME: implement + return 0; +} + +/* +============= +pfnPlaybackEvent + +============= +*/ +static void pfnPlaybackEvent( int flags, const edict_t *pInvoker, word eventindex, float delay, event_args_t *args ) +{ + // FIXME: implement +} + +/* +============= +pfnCanSkipPlayer + +============= +*/ +int pfnCanSkipPlayer( const edict_t *player ) +{ + // FIXME: implement + return false; +} + /* ============= pfnSetSkybox @@ -2704,6 +2739,7 @@ static enginefuncs_t gEngfuncs = { sizeof( enginefuncs_t ), pfnMemAlloc, + pfnMemCopy, pfnMemFree, pfnPrecacheModel, pfnPrecacheSound, @@ -2730,7 +2766,7 @@ static enginefuncs_t gEngfuncs = pfnRemoveEntity, pfnCreateNamedEntity, pfnMakeStatic, - pfnEntIsOnFloor, + pfnLinkEntity, pfnDropToFloor, pfnWalkMove, pfnSetOrigin, @@ -2811,6 +2847,9 @@ static enginefuncs_t gEngfuncs = pfnSetKeyValue, pfnGetInfoKeyBuffer, pfnSetClientKeyValue, + pfnPrecacheEvent, + pfnPlaybackEvent, + pfnCanSkipPlayer, pfnSetSkybox, pfnPlayMusic, pfnDropClient, @@ -2949,8 +2988,10 @@ void SV_SpawnEntities( const char *mapname, script_t *entities ) ent->v.solid = SOLID_BSP; ent->v.movetype = MOVETYPE_PUSH; ent->free = false; - - SV_ConfigString( CS_MAXCLIENTS, va("%i", Host_MaxClients())); + + SV_ConfigString( CS_GRAVITY, sv_gravity->string ); + SV_ConfigString( CS_MAXVELOCITY, sv_maxvelocity->string ); + SV_ConfigString( CS_MAXCLIENTS, va( "%i", Host_MaxClients( ))); svgame.globals->mapname = MAKE_STRING( sv.name ); svgame.globals->time = sv.time; @@ -2988,8 +3029,7 @@ void SV_UnloadProgs( void ) void SV_LoadProgs( const char *name ) { - static APIFUNCTION GetEntityAPI; - static GIVEFNPTRSTODLL GiveFnptrsToDll; + static SERVERAPI GetEntityAPI; static globalvars_t gpGlobals; string libname; edict_t *e; @@ -3009,20 +3049,11 @@ void SV_LoadProgs( const char *name ) Host_Error( "SV_LoadProgs: can't initialize server.dll\n" ); return; } - GetEntityAPI = (APIFUNCTION)Com_GetProcAddress( svgame.hInstance, "GetEntityAPI" ); + GetEntityAPI = (SERVERAPI)Com_GetProcAddress( svgame.hInstance, "CreateAPI" ); if( !GetEntityAPI ) { - Host_Error( "SV_LoadProgs: failed to get address of GetEntityAPI proc\n" ); - return; - } - - GiveFnptrsToDll = (GIVEFNPTRSTODLL)Com_GetProcAddress( svgame.hInstance, "GiveFnptrsToDll" ); - - if( !GiveFnptrsToDll ) - { - // can't find GiveFnptrsToDll! - Host_Error( "SV_LoadProgs: failed to get address of GiveFnptrsToDll proc\n" ); + Host_Error( "SV_LoadProgs: failed to get address of CreateAPI proc\n" ); return; } @@ -3031,9 +3062,8 @@ void SV_LoadProgs( const char *name ) Host_Error( "SV_LoadProgs: can't loading export symbols\n" ); return; } - GiveFnptrsToDll( &gEngfuncs, svgame.globals ); - if( !GetEntityAPI( &svgame.dllFuncs, INTERFACE_VERSION )) + if( !GetEntityAPI( &svgame.dllFuncs, &gEngfuncs, svgame.globals )) { Host_Error( "SV_LoadProgs: couldn't get entity API\n" ); return; diff --git a/engine/server/sv_main.c b/engine/server/sv_main.c index 30567c65..bf66a356 100644 --- a/engine/server/sv_main.c +++ b/engine/server/sv_main.c @@ -364,8 +364,8 @@ void SV_Init( void ) sv_rollangle = Cvar_Get("sv_rollangle", "2", 0, "how much to tilt the view when strafing" ); sv_rollspeed = Cvar_Get("sv_rollspeed", "200", 0, "how much strafing is necessary to tilt the view" ); sv_airaccelerate = Cvar_Get("sv_airaccelerate", "0", CVAR_LATCH, "player accellerate in air" ); - sv_maxvelocity = Cvar_Get("sv_maxvelocity", "2000", 0, "max world velocity" ); - sv_gravity = Cvar_Get("sv_gravity", "800", 0, "world gravity" ); + sv_maxvelocity = Cvar_Get("sv_maxvelocity", DEFAULT_MAXVELOCITY, CVAR_LATCH, "max world velocity" ); + sv_gravity = Cvar_Get("sv_gravity", DEFAULT_GRAVITY, CVAR_LATCH, "world gravity" ); sv_maxspeed = Cvar_Get("sv_maxspeed", "320", 0, "maximum speed a player can accelerate to when on ground (can be exceeded by tricks)"); sv_accelerate = Cvar_Get( "sv_accelerate", "10", 0, "rate at which a player accelerates to sv_maxspeed" ); sv_friction = Cvar_Get( "sv_friction", "4", 0, "how fast you slow down" ); @@ -398,7 +398,6 @@ void SV_FinalMessage( char *message, bool reconnect ) MSG_Init( &msg, msg_buf, sizeof( msg_buf )); MSG_WriteByte( &msg, svc_print ); - MSG_WriteByte( &msg, HUD_PRINTCONSOLE ); MSG_WriteString( &msg, message ); if( reconnect ) diff --git a/engine/server/sv_phys.c b/engine/server/sv_phys.c index 35fa2a77..be909919 100644 --- a/engine/server/sv_phys.c +++ b/engine/server/sv_phys.c @@ -1038,11 +1038,15 @@ bool SV_CheckWater( edict_t *ent ) ent->v.watertype = CONTENTS_NONE; cont = SV_PointContents( point ); + // predict state + if( ent->pvServerData->s.ed_type == ED_CLIENT ) + ent->v.renderfx = kRenderFxNone; + if( cont & (MASK_WATER)) { ent->v.watertype = cont; ent->v.waterlevel = 1; - point[2] = ent->v.origin[2] + (ent->v.mins[2] + ent->v.maxs[2])*0.5; + point[2] = ent->v.origin[2] + (ent->v.mins[2] + ent->v.maxs[2]) * 0.5; if( SV_PointContents( point ) & MASK_WATER ) { ent->v.waterlevel = 2; @@ -1051,15 +1055,11 @@ bool SV_CheckWater( edict_t *ent ) { ent->v.waterlevel = 3; if( ent->pvServerData->s.ed_type == ED_CLIENT ) - ent->v.renderfx |= RDF_UNDERWATER; - } - else - { - if( ent->pvServerData->s.ed_type == ED_CLIENT ) - ent->v.renderfx &= ~RDF_UNDERWATER; + ent->v.renderfx = kRenderFxUnderwater; } } } + return ent->v.waterlevel > 1; } diff --git a/launch/launch.dsp b/launch/launch.dsp index 766cc49d..24a2b4d6 100644 --- a/launch/launch.dsp +++ b/launch/launch.dsp @@ -43,7 +43,7 @@ RSC=rc.exe # PROP Ignore_Export_Lib 1 # PROP Target_Dir "" # ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "LAUNCH_EXPORTS" /YX /FD /c -# ADD CPP /nologo /MD /W3 /GX /O2 /I "./" /I "./imagelib" /I "../public" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /FD /c +# ADD CPP /nologo /MD /W3 /GX /O2 /I "./" /I "imagelib" /I "../public" /I "../common" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /FD /c # SUBTRACT CPP /YX # ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32 # ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32 @@ -79,7 +79,7 @@ SOURCE="$(InputPath)" # PROP Ignore_Export_Lib 1 # PROP Target_Dir "" # ADD BASE CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "LAUNCH_EXPORTS" /YX /FD /GZ /c -# ADD CPP /nologo /MDd /W3 /Gm /Gi /GX /ZI /Od /I "./" /I "./imagelib" /I "../public" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /FR /FD /GZ /c +# ADD CPP /nologo /MDd /W3 /Gm /Gi /GX /ZI /Od /I "./" /I "imagelib" /I "../public" /I "../common" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /FR /FD /GZ /c # SUBTRACT CPP /YX # ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32 # ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32 diff --git a/launch/launch.h b/launch/launch.h index d80d5aa6..2ff507c5 100644 --- a/launch/launch.h +++ b/launch/launch.h @@ -19,7 +19,7 @@ #define LAUNCH_DLL // ignore alias names #include "launch_api.h" -#define XASH_VERSION 0.51f // current version will be shared across gameinfo struct +#define XASH_VERSION 0.56f // current version will be shared across gameinfo struct #define MAX_NUM_ARGVS 128 #define MAX_STRING_TOKENS 80 diff --git a/launch/system.c b/launch/system.c index f50d16a8..66d5ecd0 100644 --- a/launch/system.c +++ b/launch/system.c @@ -20,7 +20,7 @@ launch_exp_t *Host; // callback to mainframe sys_event_t event_que[MAX_QUED_EVENTS]; int event_head, event_tail; -dll_info_t common_dll = { "common.dll", NULL, "CreateAPI", NULL, NULL, true, sizeof(launch_exp_t) }; +dll_info_t xtools_dll = { "xtools.dll", NULL, "CreateAPI", NULL, NULL, true, sizeof(launch_exp_t) }; dll_info_t engine_dll = { "engine.dll", NULL, "CreateAPI", NULL, NULL, true, sizeof(launch_exp_t) }; dll_info_t baserc_dll = { "baserc.dll", NULL, "CreateAPI", NULL, NULL, false, sizeof(baserc_exp_t)}; @@ -330,35 +330,35 @@ void Sys_LookupInstance( void ) else if(!com_strcmp(Sys.progname, "bsplib")) { Sys.app_name = HOST_BSPLIB; - Sys.linked_dll = &common_dll; // pointer to common.dll info + Sys.linked_dll = &xtools_dll; // pointer to common.dll info com_strcpy(Sys.log_path, "bsplib.log" ); // xash3d root directory com_strcpy(Sys.caption, "Xash3D BSP Compiler"); } else if(!com_strcmp(Sys.progname, "qcclib")) { Sys.app_name = HOST_QCCLIB; - Sys.linked_dll = &common_dll; // pointer to common.dll info + Sys.linked_dll = &xtools_dll; // pointer to common.dll info com_sprintf(Sys.log_path, "%s/compile.log", sys_rootdir ); // same as .exe file com_strcpy(Sys.caption, "Xash3D QuakeC Compiler"); } else if(!com_strcmp(Sys.progname, "sprite")) { Sys.app_name = HOST_SPRITE; - Sys.linked_dll = &common_dll; // pointer to common.dll info + Sys.linked_dll = &xtools_dll; // pointer to common.dll info com_sprintf(Sys.log_path, "%s/spritegen.log", sys_rootdir ); // same as .exe file com_strcpy(Sys.caption, "Xash3D Sprite Compiler"); } else if(!com_strcmp(Sys.progname, "studio")) { Sys.app_name = HOST_STUDIO; - Sys.linked_dll = &common_dll; // pointer to common.dll info + Sys.linked_dll = &xtools_dll; // pointer to common.dll info com_sprintf(Sys.log_path, "%s/studiomdl.log", sys_rootdir ); // same as .exe file com_strcpy(Sys.caption, "Xash3D Studio Models Compiler"); } else if(!com_strcmp(Sys.progname, "wadlib")) { Sys.app_name = HOST_WADLIB; - Sys.linked_dll = &common_dll; // pointer to common.dll info + Sys.linked_dll = &xtools_dll; // pointer to common.dll info com_sprintf(Sys.log_path, "%s/wadlib.log", sys_rootdir ); // same as .exe file com_strcpy(Sys.caption, "Xash3D Wad2\\Wad3 maker"); } @@ -367,7 +367,7 @@ void Sys_LookupInstance( void ) Sys.app_name = HOST_RIPPER; Sys.con_readonly = true; Sys.log_active = true; // always create log - Sys.linked_dll = &common_dll; // pointer to wdclib.dll info + Sys.linked_dll = &xtools_dll; // pointer to wdclib.dll info com_sprintf(Sys.log_path, "%s/decompile.log", sys_rootdir ); // default com_strcpy(Sys.caption, va("Quake Recource Extractor ver.%g", XASH_VERSION )); } @@ -377,7 +377,7 @@ void Sys_LookupInstance( void ) Sys.con_readonly = true; // don't show console as default if( Sys.developer < D_NOTE ) Sys.con_showalways = false; - Sys.linked_dll = &common_dll; // pointer to dpvenc.dll info + Sys.linked_dll = &xtools_dll; // pointer to dpvenc.dll info com_sprintf(Sys.log_path, "%s/movie.log", sys_rootdir ); // logs folder com_strcpy(Sys.caption, "DarkPlaces Video Encoder" ); } diff --git a/physic/cm_local.h b/physic/cm_local.h index 0d2bf21c..09376a42 100644 --- a/physic/cm_local.h +++ b/physic/cm_local.h @@ -8,6 +8,7 @@ #include "physic.h" #include "mathlib.h" #include "cm_utils.h" +#include "trace_def.h" #define MAX_MATERIALS 64 #define MAX_MAT_SOUNDS 8 diff --git a/physic/physic.dsp b/physic/physic.dsp index d3a3683d..dd85a03d 100644 --- a/physic/physic.dsp +++ b/physic/physic.dsp @@ -43,7 +43,7 @@ RSC=rc.exe # PROP Ignore_Export_Lib 1 # PROP Target_Dir "" # ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "PHYSIC_EXPORTS" /YX /FD /c -# ADD CPP /nologo /MD /W3 /GX /O2 /I "../public" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /FD /c +# ADD CPP /nologo /MD /W3 /GX /O2 /I "../public" /I "../common" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /FD /c # SUBTRACT CPP /YX # ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32 # ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32 @@ -79,7 +79,7 @@ SOURCE="$(InputPath)" # PROP Ignore_Export_Lib 1 # PROP Target_Dir "" # ADD BASE CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "PHYSIC_EXPORTS" /YX /FD /GZ /c -# ADD CPP /nologo /MDd /W3 /Gm /Gi /GX /ZI /Od /I "../public" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /FR /FD /GZ /c +# ADD CPP /nologo /MDd /W3 /Gm /Gi /GX /ZI /Od /I "../public" /I "../common" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /FR /FD /GZ /c # SUBTRACT CPP /YX # ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32 # ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32 diff --git a/public/launch_api.h b/public/launch_api.h index 5482b3a4..e8468524 100644 --- a/public/launch_api.h +++ b/public/launch_api.h @@ -16,25 +16,15 @@ #define MAX_STRING 256 // generic string #define MAX_SYSPATH 1024 // system filepath #define MAX_MSGLEN 32768 // max length of network message -#define IsColorString(p) ( p && *(p) == STRING_COLOR_TAG && *((p)+1) && *((p)+1) != STRING_COLOR_TAG ) +#define IsColorString( p ) ( p && *(p) == STRING_COLOR_TAG && *((p)+1) && *((p)+1) != STRING_COLOR_TAG ) #define bound(min, num, max) ((num) >= (min) ? ((num) < (max) ? (num) : (max)) : (min)) -#define DLLEXPORT __declspec( dllexport ) #define MAX_STRING_TABLES 8 // seperately stringsystems #ifndef __cplusplus #define bool BOOL // sizeof( int ) #endif -// generic engine types -typedef unsigned char byte; -typedef unsigned short word; -typedef unsigned long dword; -typedef unsigned int uint; -typedef int func_t; -typedef int sound_t; -typedef int model_t; -typedef int video_t; -typedef int string_t; -typedef int shader_t; +#include "basetypes.h" + typedef float vec_t; typedef vec_t vec2_t[2]; typedef vec_t vec3_t[3]; @@ -42,7 +32,6 @@ typedef vec_t vec4_t[4]; typedef vec_t matrix3x3[3][3]; typedef vec_t matrix4x4[4][4]; typedef char string[MAX_STRING]; -typedef struct edict_s edict_t; typedef struct pr_edict_s pr_edict_t; typedef struct cl_edict_s cl_edict_t; typedef struct ui_edict_s ui_edict_t; @@ -55,14 +44,6 @@ typedef struct physbody_s physbody_t; // FIXME: get rid of this typedef vec_t gl_matrix[16]; -#ifndef NULL -#define NULL ((void *)0) -#endif - -#ifndef BIT -#define BIT( n ) (1<<( n )) -#endif - // platform instances typedef enum { diff --git a/public/qfiles_ref.h b/public/qfiles_ref.h index a55c89ec..db7c4247 100644 --- a/public/qfiles_ref.h +++ b/public/qfiles_ref.h @@ -273,45 +273,6 @@ typedef enum SURF_GLOW = BIT(14), // sprites glow } surfaceType_t; -// bsp contents -typedef enum -{ - CONTENTS_NONE = 0, // just a mask for source tabulation - CONTENTS_SOLID = BIT(0), // an eye is never valid in a solid - CONTENTS_WINDOW = BIT(1), // translucent, but not watery - CONTENTS_AUX = BIT(2), - CONTENTS_LAVA = BIT(3), - CONTENTS_SLIME = BIT(4), - CONTENTS_WATER = BIT(5), - CONTENTS_SKY = BIT(6), - - // space for new user contents - - CONTENTS_MIST = BIT(12),// g-cont. what difference between fog and mist ? - LAST_VISIBLE_CONTENTS = BIT(12),// mask (LAST_VISIBLE_CONTENTS-1) - CONTENTS_FOG = BIT(13),// future expansion - CONTENTS_AREAPORTAL = BIT(14),// func_areaportal volume - CONTENTS_PLAYERCLIP = BIT(15),// clip affect only by player or bot - CONTENTS_MONSTERCLIP = BIT(16),// clip affect only by monster or npc - CONTENTS_CLIP = (CONTENTS_PLAYERCLIP|CONTENTS_MONSTERCLIP), // both type clip - CONTENTS_ORIGIN = BIT(17),// removed before bsping an entity - CONTENTS_BODY = BIT(18),// should never be on a brush, only in game - CONTENTS_CORPSE = BIT(19),// deadbody - CONTENTS_DETAIL = BIT(20),// brushes to be added after vis leafs - CONTENTS_TRANSLUCENT = BIT(21),// auto set if any surface has trans - CONTENTS_LADDER = BIT(22),// like water but ladder : ) - CONTENTS_TRIGGER = BIT(23),// trigger volume - - // content masks - MASK_SOLID = (CONTENTS_SOLID|CONTENTS_WINDOW), - MASK_PLAYERSOLID = (CONTENTS_SOLID|CONTENTS_PLAYERCLIP|CONTENTS_WINDOW|CONTENTS_BODY), - MASK_MONSTERSOLID = (CONTENTS_SOLID|CONTENTS_MONSTERCLIP|CONTENTS_WINDOW|CONTENTS_BODY), - MASK_DEADSOLID = (CONTENTS_SOLID|CONTENTS_PLAYERCLIP|CONTENTS_WINDOW|CONTENTS_WINDOW), - MASK_WATER = (CONTENTS_WATER|CONTENTS_LAVA|CONTENTS_SLIME), - MASK_OPAQUE = (CONTENTS_SOLID|CONTENTS_SLIME|CONTENTS_LAVA), - MASK_SHOT = (CONTENTS_SOLID|CONTENTS_BODY|CONTENTS_WINDOW|CONTENTS_CORPSE) -} contentType_t; - typedef struct { int ident; @@ -559,340 +520,7 @@ typedef struct uint numtypes; } dprograms_t; -/* -============================================================================== - -STUDIO MODELS - -Studio models are position independent, so the cache manager can move them. -============================================================================== -*/ - -// header -#define STUDIO_VERSION 10 -#define IDSTUDIOHEADER (('T'<<24)+('S'<<16)+('D'<<8)+'I') // little-endian "IDST" -#define IDSEQGRPHEADER (('Q'<<24)+('S'<<16)+('D'<<8)+'I') // little-endian "IDSQ" - -// studio limits -#define MAXSTUDIOTRIANGLES 32768 // max triangles per model -#define MAXSTUDIOVERTS 4096 // max vertices per submodel -#define MAXSTUDIOSEQUENCES 256 // total animation sequences -#define MAXSTUDIOSKINS 128 // total textures -#define MAXSTUDIOSRCBONES 512 // bones allowed at source movement -#define MAXSTUDIOBONES 128 // total bones actually used -#define MAXSTUDIOMODELS 32 // sub-models per model -#define MAXSTUDIOBODYPARTS 32 // body parts per submodel -#define MAXSTUDIOGROUPS 16 // sequence groups (e.g. barney01.mdl, barney02.mdl, e.t.c) -#define MAXSTUDIOANIMATIONS 512 // max frames per sequence -#define MAXSTUDIOMESHES 256 // max textures per model -#define MAXSTUDIOEVENTS 1024 // events per model -#define MAXSTUDIOPIVOTS 256 // pivot points -#define MAXSTUDIOBLENDS 16 // max anim blends -#define MAXSTUDIOCONTROLLERS 16 // max controllers per model -#define MAXSTUDIOATTACHMENTS 16 // max attachments per model - -// model global flags -#define STUDIO_STATIC 0x0001 // model without anims -#define STUDIO_RAGDOLL 0x0002 // ragdoll animation pose - -// lighting & rendermode options -#define STUDIO_NF_FLATSHADE 0x0001 -#define STUDIO_NF_CHROME 0x0002 -#define STUDIO_NF_FULLBRIGHT 0x0004 -#define STUDIO_NF_COLORMAP 0x0008 // can changed by colormap command -#define STUDIO_NF_BLENDED 0x0010 // rendering as semiblended -#define STUDIO_NF_ADDITIVE 0x0020 // rendering with additive mode -#define STUDIO_NF_TRANSPARENT 0x0040 // use texture with alpha channel - -// motion flags -#define STUDIO_X 0x0001 -#define STUDIO_Y 0x0002 -#define STUDIO_Z 0x0004 -#define STUDIO_XR 0x0008 -#define STUDIO_YR 0x0010 -#define STUDIO_ZR 0x0020 -#define STUDIO_LX 0x0040 -#define STUDIO_LY 0x0080 -#define STUDIO_LZ 0x0100 -#define STUDIO_AX 0x0200 -#define STUDIO_AY 0x0400 -#define STUDIO_AZ 0x0800 -#define STUDIO_AXR 0x1000 -#define STUDIO_AYR 0x2000 -#define STUDIO_AZR 0x4000 -#define STUDIO_TYPES 0x7FFF -#define STUDIO_RLOOP 0x8000 // controller that wraps shortest distance - -// bonecontroller types -#define STUDIO_MOUTH 4 - -// sequence flags -#define STUDIO_LOOPING 0x0001 - -// render flags -#define STUDIO_RENDER 0x0001 -#define STUDIO_EVENTS 0x0002 -#define STUDIO_MIRROR 0x0004 // a local player in mirror - -// bone flags -#define STUDIO_HAS_NORMALS 0x0001 -#define STUDIO_HAS_VERTICES 0x0002 -#define STUDIO_HAS_BBOX 0x0004 -#define STUDIO_HAS_CHROME 0x0008 // if any of the textures have chrome on them - -typedef struct -{ - int ident; - int version; - - char name[64]; - int length; - - vec3_t eyeposition; // ideal eye position - vec3_t min; // ideal movement hull size - vec3_t max; - - vec3_t bbmin; // clipping bounding box - vec3_t bbmax; - - int flags; - - int numbones; // bones - int boneindex; - - int numbonecontrollers; // bone controllers - int bonecontrollerindex; - - int numhitboxes; // complex bounding boxes - int hitboxindex; - - int numseq; // animation sequences - int seqindex; - - int numseqgroups; // demand loaded sequences - int seqgroupindex; - - int numtextures; // raw textures - int textureindex; - int texturedataindex; - - int numskinref; // replaceable textures - int numskinfamilies; - int skinindex; - - int numbodyparts; - int bodypartindex; - - int numattachments; // queryable attachable points - int attachmentindex; - - int soundtable; - int soundindex; - int soundgroups; - int soundgroupindex; - - int numtransitions; // animation node to animation node transition graph - int transitionindex; -} dstudiohdr_t; - -// header for demand loaded sequence group data -typedef struct -{ - int id; - int version; - - char name[64]; - int length; -} dstudioseqhdr_t; - -// bones -typedef struct -{ - char name[32]; // bone name for symbolic links - int parent; // parent bone - int flags; // ?? - int bonecontroller[6]; // bone controller index, -1 == none - float value[6]; // default DoF values - float scale[6]; // scale for delta DoF values -} dstudiobone_t; - -// bone controllers -typedef struct -{ - int bone; // -1 == 0 - int type; // X, Y, Z, XR, YR, ZR, M - float start; - float end; - int rest; // byte index value at rest - int index; // 0-3 user set controller, 4 mouth -} dstudiobonecontroller_t; - -// intersection boxes -typedef struct -{ - int bone; - int group; // intersection group - vec3_t bbmin; // bounding box - vec3_t bbmax; -} dstudiobbox_t; - -// demand loaded sequence groups -typedef struct -{ - char label[32]; // textual name - char name[64]; // file name - void *cache; // cache index pointer (only in memory) - int data; // hack for group 0 -} dstudioseqgroup_t; - -// sequence descriptions -typedef struct -{ - char label[32]; // sequence label (name) - - float fps; // frames per second - int flags; // looping/non-looping flags - - int activity; - int actweight; - - int numevents; - int eventindex; - - int numframes; // number of frames per sequence - - int numpivots; // number of foot pivots - int pivotindex; - - int motiontype; - int motionbone; - vec3_t linearmovement; - int automoveposindex; - int automoveangleindex; - - vec3_t bbmin; // per sequence bounding box - vec3_t bbmax; - - int numblends; - int animindex; // mstudioanim_t pointer relative to start of sequence group data - // [blend][bone][X, Y, Z, XR, YR, ZR] - - int blendtype[2]; // X, Y, Z, XR, YR, ZR - float blendstart[2]; // starting value - float blendend[2]; // ending value - int blendparent; - - int seqgroup; // sequence group for demand loading - - int entrynode; // transition node at entry - int exitnode; // transition node at exit - int nodeflags; // transition rules - - int nextseq; // auto advancing sequences -} dstudioseqdesc_t; - -// events -typedef struct -{ - int frame; - int event; - int type; - char options[64]; -} dstudioevent_t; - -// pivots -typedef struct -{ - vec3_t org; // pivot point - int start; - int end; -} dstudiopivot_t; - -// attachment -typedef struct -{ - char name[32]; - int type; - int bone; - vec3_t org; // attachment point - vec3_t vectors[3]; -} dstudioattachment_t; - -typedef struct -{ - unsigned short offset[6]; -} dstudioanim_t; - -// animation frames -typedef union -{ - struct - { - byte valid; - byte total; - } num; - short value; -} dstudioanimvalue_t; - - -// body part index -typedef struct -{ - char name[64]; - int nummodels; - int base; - int modelindex; // index into models array -} dstudiobodyparts_t; - -// skin info -typedef struct -{ - char name[64]; - int flags; - int width; - int height; - - union - { - int index; // disk: offset at start of buffer - shader_t shader; // ref: shader number - }; -} dstudiotexture_t; - -// skin families -// short index[skinfamilies][skinref] // skingroup info - -// studio models -typedef struct -{ - char name[64]; - - int type; - float boundingradius; // software stuff - - int nummesh; - int meshindex; - - int numverts; // number of unique vertices - int vertinfoindex; // vertex bone info - int vertindex; // vertex vec3_t - int numnorms; // number of unique surface normals - int norminfoindex; // normal bone info - int normindex; // normal vec3_t - - int numgroups; // deformation groups - int groupindex; -} dstudiomodel_t; - -// meshes -typedef struct -{ - int numtris; - int triindex; - int skinref; - int numnorms; // per mesh normals - int normindex; // normal vec3_t -} dstudiomesh_t; +#include "studio_ref.h" /* ============================================================================== diff --git a/public/render_api.h b/public/render_api.h index 24bd1d2e..cd20dbd6 100644 --- a/public/render_api.h +++ b/public/render_api.h @@ -1,10 +1,12 @@ - //======================================================================= +//======================================================================= // Copyright XashXT Group 2008 © // render_api.h - xash renderer api //======================================================================= #ifndef RENDER_API_H #define RENDER_API_H +#include "ref_params.h" + // shader types used for shader loading #define SHADER_SKY 0 // sky box shader #define SHADER_FONT 1 // speical case for displayed fonts diff --git a/public/vsound_api.h b/public/vsound_api.h index f0ff9a93..0543d3f0 100644 --- a/public/vsound_api.h +++ b/public/vsound_api.h @@ -5,6 +5,8 @@ #ifndef VSOUND_API_H #define VSOUND_API_H +typedef int sound_t; + // snd internal flags (lower bits are used for snd channels) #define CHAN_NO_PHS_ADD (1<<3) // send to all clients, not just ones in PHS (ATTN 0 will also do this) #define CHAN_RELIABLE (1<<4) // send by reliable message, not datagram diff --git a/release.bat b/release.bat index a0ec5f31..18c694d4 100644 --- a/release.bat +++ b/release.bat @@ -20,9 +20,6 @@ if errorlevel 1 set BUILD_ERROR=1 %MSDEV% launch/launch.dsp %CONFIG%"launch - Win32 Release" %build_target% if errorlevel 1 set BUILD_ERROR=1 -%MSDEV% common/common.dsp %CONFIG%"common - Win32 Release" %build_target% -if errorlevel 1 set BUILD_ERROR=1 - %MSDEV% physic/physic.dsp %CONFIG%"physic - Win32 Release" %build_target% if errorlevel 1 set BUILD_ERROR=1 @@ -38,6 +35,9 @@ if errorlevel 1 set BUILD_ERROR=1 %MSDEV% vsound/vsound.dsp %CONFIG%"vsound - Win32 Release" %build_target% if errorlevel 1 set BUILD_ERROR=1 +%MSDEV% xtools/xtools.dsp %CONFIG%"xtools - Win32 Release" %build_target% +if errorlevel 1 set BUILD_ERROR=1 + if "%BUILD_ERROR%"=="" goto build_ok echo ********************* @@ -61,12 +61,12 @@ if exist baserc\baserc.plg del /f /q baserc\baserc.plg if exist client\client.plg del /f /q client\client.plg if exist engine\engine.plg del /f /q engine\engine.plg if exist launch\launch.plg del /f /q launch\launch.plg -if exist common\common.plg del /f /q common\common.plg if exist physic\physic.plg del /f /q physic\physic.plg if exist render\render.plg del /f /q render\render.plg if exist server\server.plg del /f /q server\server.plg if exist vprogs\vprogs.plg del /f /q vprogs\vprogs.plg if exist vsound\vsound.plg del /f /q vsound\vsound.plg +if exist xtools\xtools.plg del /f /q xtools\xtools.plg echo Build succeeded! echo Please wait. Xash is now loading diff --git a/render/r_backend2.c b/render/r_backend2.c index 35cf8342..e8bb6ce3 100644 --- a/render/r_backend2.c +++ b/render/r_backend2.c @@ -1570,7 +1570,7 @@ static void RB_DrawLine( int color, int numpoints, const float *points, const in void RB_DebugGraphics( void ) { - if( r_refdef.rdflags & RDF_NOWORLDMODEL ) + if( r_refdef.onlyClientDraw ) return; if( r_physbdebug->integer ) @@ -1594,7 +1594,7 @@ RB_DrawDebugTools */ static void RB_DrawDebugTools( void ) { - if( gl_state.orthogonal || r_refdef.rdflags & RDF_NOWORLDMODEL ) + if( gl_state.orthogonal || r_refdef.onlyClientDraw ) return; GL_Disable( GL_VERTEX_PROGRAM_ARB ); diff --git a/render/r_image.c b/render/r_image.c index a29ff671..657e95fe 100644 --- a/render/r_image.c +++ b/render/r_image.c @@ -3213,7 +3213,7 @@ bool VID_CubemapShot( const char *base, uint size, bool skyshot ) string basename; int i = 1, result; - if(( r_refdef.rdflags & RDF_NOWORLDMODEL) || !r_worldModel) + if( r_refdef.onlyClientDraw || !r_worldModel ) return false; // shared framebuffer not init diff --git a/render/r_light.c b/render/r_light.c index 8179cda1..fc551378 100644 --- a/render/r_light.c +++ b/render/r_light.c @@ -379,7 +379,7 @@ void R_LightingAmbient( void ) vec4_t ambientLight; // Set to full bright if no light data - if(( r_refdef.rdflags & RDF_NOWORLDMODEL) || !r_worldModel->lightData || !m_pCurrentEntity ) + if( r_refdef.onlyClientDraw || !r_worldModel->lightData || !m_pCurrentEntity ) { for( i = 0; i < ref.numVertex; i++ ) { @@ -454,7 +454,7 @@ void R_LightingDiffuse( void ) vec3_t ambientLight, directedLight, lightDir; // Set to full bright if no light data - if((r_refdef.rdflags & RDF_NOWORLDMODEL) || !r_worldModel->lightData ) + if( r_refdef.onlyClientDraw || !r_worldModel->lightData ) { for( i = 0; i < ref.numVertex; i++ ) { diff --git a/render/r_local.h b/render/r_local.h index f6cc33f6..e09fd422 100644 --- a/render/r_local.h +++ b/render/r_local.h @@ -13,6 +13,7 @@ #include "entity_def.h" #include "clgame_api.h" #include "render_api.h" +#include "entity_state.h" #include "r_opengl.h" extern stdlib_api_t com; // engine toolbox diff --git a/render/r_main.c b/render/r_main.c index ce2d8f85..93c93dc6 100644 --- a/render/r_main.c +++ b/render/r_main.c @@ -777,8 +777,7 @@ static float R_SetFarClip( void ) float farDist, dirDist, worldDist = 0; int i; - if( r_refdef.rdflags & RDF_NOWORLDMODEL) - return 4096.0; + if( r_refdef.onlyClientDraw ) return 4096.0f; dirDist = DotProduct( r_refdef.vieworg, r_forward ); farDist = dirDist + 256.0; @@ -915,8 +914,7 @@ void R_RenderView( const ref_params_t *fd ) void R_DrawPauseScreen( void ) { // don't apply post effects for custom window - if( r_refdef.rdflags & RDF_NOWORLDMODEL ) - return; + if( r_refdef.onlyClientDraw ) return; if( !r_pause_bw->integer ) return; @@ -989,11 +987,9 @@ void R_SetLightLevel( void ) { vec3_t shadelight; - if( r_refdef.rdflags & RDF_NOWORLDMODEL ) - return; + if( r_refdef.onlyClientDraw ) return; // save off light value for server to look at (BIG HACK!) - R_LightForPoint( r_refdef.vieworg, shadelight ); // pick the greatest component, which should be the same @@ -1301,7 +1297,7 @@ void R_RenderFrame( ref_params_t *rd ) r_refdef = *rd; - if(!(r_refdef.rdflags & RDF_NOWORLDMODEL )) + if( !r_refdef.onlyClientDraw ) { if( !r_worldModel ) Host_Error( "R_RenderScene: NULL worldmodel\n" ); } diff --git a/render/r_shader.h b/render/r_shader.h index 9c999c3f..b09e73b8 100644 --- a/render/r_shader.h +++ b/render/r_shader.h @@ -375,7 +375,7 @@ typedef struct stageBundle_s int currentFrame; float animFrequency; - video_t cinematicHandle; + int cinematicHandle; GLint texEnv; texEnvCombine_t texEnvCombine; diff --git a/render/r_studio.c b/render/r_studio.c index e36ed9c7..a53d3c6a 100644 --- a/render/r_studio.c +++ b/render/r_studio.c @@ -1707,7 +1707,7 @@ void R_StudioRenderModel( void ) R_StudioDrawPoints(); } - if(!( r_refdef.rdflags & RDF_NOWORLDMODEL )) + if( !r_refdef.onlyClientDraw ) { if( r_drawentities->integer < 2 ) return; diff --git a/render/r_surface.c b/render/r_surface.c index 501862c9..9861f8f4 100644 --- a/render/r_surface.c +++ b/render/r_surface.c @@ -491,7 +491,7 @@ R_AddWorldToList */ void R_AddWorldToList( void ) { - if( r_refdef.rdflags & RDF_NOWORLDMODEL ) + if( r_refdef.onlyClientDraw ) return; if( !r_drawworld->integer ) diff --git a/render/render.dsp b/render/render.dsp index 55f3b459..4f509a68 100644 --- a/render/render.dsp +++ b/render/render.dsp @@ -43,7 +43,7 @@ RSC=rc.exe # PROP Ignore_Export_Lib 1 # PROP Target_Dir "." # ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /YX /c -# ADD CPP /nologo /MD /W3 /GX /O2 /I "../public" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /FD /c +# ADD CPP /nologo /MD /W3 /GX /O2 /I "../public" /I "../common" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /FD /c # SUBTRACT CPP /YX # ADD BASE MTL /nologo /D "NDEBUG" /win32 # ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32 @@ -80,7 +80,7 @@ SOURCE="$(InputPath)" # PROP Ignore_Export_Lib 1 # PROP Target_Dir "." # ADD BASE CPP /nologo /MTd /W3 /Gm /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /YX /c -# ADD CPP /nologo /MDd /W3 /Gm /Gi /GX /ZI /Od /I "../public" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /FR /FD /c +# ADD CPP /nologo /MDd /W3 /Gm /Gi /GX /ZI /Od /I "../public" /I "../common" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /FR /FD /c # SUBTRACT CPP /YX # ADD BASE MTL /nologo /D "_DEBUG" /win32 # ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32 diff --git a/server/cbase.h b/server/cbase.h index 69b9129f..f9d1a9dc 100644 --- a/server/cbase.h +++ b/server/cbase.h @@ -22,7 +22,7 @@ class CSound; #include "utils.h" #include "saverestore.h" #include "schedule.h" -#include "qfiles_ref.h" +#include "studio_ref.h" #include "defaults.h" #include "monsterevent.h" #include "baseentity.h" diff --git a/server/ents/baseentity.h b/server/ents/baseentity.h index fca6e519..96fa1dd7 100644 --- a/server/ents/baseentity.h +++ b/server/ents/baseentity.h @@ -2,10 +2,11 @@ // Copyright (C) XashXT Group 2006 //======================================================================= - #ifndef BASEENTITY_H #define BASEENTITY_H +#include "entity_state.h" + class CBaseEntity { public: diff --git a/server/ents/basefunc.cpp b/server/ents/basefunc.cpp index 9e440069..916300df 100644 --- a/server/ents/basefunc.cpp +++ b/server/ents/basefunc.cpp @@ -2342,7 +2342,7 @@ void CFuncTrainControls :: PostSpawn( void ) if ( !pTarget ) { - ALERT( at_debug, "TrackTrainControls: No train %s\n", STRING(pev->target) ); + ALERT( at_console, "TrackTrainControls: No train %s\n", STRING(pev->target) ); return; } diff --git a/server/ents/basemover.cpp b/server/ents/basemover.cpp index 908be493..757c2c96 100644 --- a/server/ents/basemover.cpp +++ b/server/ents/basemover.cpp @@ -1433,7 +1433,7 @@ void CFuncTrackTrain :: KeyValue( KeyValueData *pkvd ) void CFuncTrackTrain :: Use( CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value ) { -// ALERT(at_debug, "TRAIN: use\n"); +// ALERT( at_console, "TRAIN: use\n" ); m_hActivator = pActivator; //AJH @@ -1664,7 +1664,7 @@ void CFuncTrackTrain :: DesiredAction( void ) // Next( void ) break; case PATHSPEED_TIME: float distance = (pev->origin - pDest->pev->origin).Length(); - //ALERT(at_debug, "pFire=%s, distance=%.2f, ospeed=%.2f, nspeed=%.2f\n", STRING(pFire->pev->targetname), distance, pev->speed, distance / pFire->pev->speed); + // ALERT( at_console, "pFire=%s, distance=%.2f, ospeed=%.2f, nspeed=%.2f\n", STRING(pFire->pev->targetname), distance, pev->speed, distance / pFire->pev->speed); m_speed = distance / pFire->pev->speed; pev->impulse = m_speed; pev->speed = setting * m_speed; @@ -1807,10 +1807,10 @@ void CFuncTrackTrain :: NearestPath( void ) } } - if ( !pNearest ) + if( !pNearest ) { - ALERT( at_debug, "Can't find a nearby track !!!\n" ); - SetThink(NULL); + ALERT( at_console, "Can't find a nearby track !!!\n" ); + SetThink( NULL ); return; } diff --git a/server/ents/basepath.cpp b/server/ents/basepath.cpp index 174a5719..28bfa396 100644 --- a/server/ents/basepath.cpp +++ b/server/ents/basepath.cpp @@ -185,16 +185,16 @@ void CPathTrack :: Link( void ) { CBaseEntity *pTarget; - if ( !FStringNull(pev->target) ) + if( !FStringNull( pev->target )) { pTarget = UTIL_FindEntityByTargetname( NULL, STRING(pev->target) ); - if ( pTarget ) + + if( pTarget ) { m_pnext = (CPathTrack*)pTarget; m_pnext->SetPrevious( this ); } - else - ALERT( at_debug, "Dead end link %s\n", STRING(pev->target) ); + else ALERT( at_console, "Dead end link %s\n", STRING(pev->target) ); } // Find "alternate" path diff --git a/server/game/game.cpp b/server/game/game.cpp index 52d0e336..0c9afb8a 100644 --- a/server/game/game.cpp +++ b/server/game/game.cpp @@ -17,7 +17,7 @@ #include "game.h" // Register your console variables here -// This gets called one time when the game is initialied +// This gets called one time when the game is initialized void GameDLLInit( void ) { ALERT( at_aiconsole, "GameDLLInit();\n" ); @@ -43,4 +43,9 @@ void GameDLLInit( void ) CVAR_REGISTER( "mp_teamoverride", "1", 0, "can ovveride teams from map settings ?" ); CVAR_REGISTER( "mp_defaultteam", "0", 0, "use default team instead ?" ); CVAR_REGISTER( "mp_chattime", "10", CVAR_SERVERINFO, "time beetween messages" ); +} + +// perform any shutdown operations +void GameDLLShutdown( void ) +{ } \ No newline at end of file diff --git a/server/game/game.h b/server/game/game.h index b6a8e8b2..4841d94e 100644 --- a/server/game/game.h +++ b/server/game/game.h @@ -22,5 +22,6 @@ #define CVAR_SERVERINFO BIT(2) // added to serverinfo when changed extern void GameDLLInit( void ); +extern void GameDLLShutdown( void ); #endif // GAME_H diff --git a/server/game/gamerules.cpp b/server/game/gamerules.cpp index e8c0fcf6..4701cee9 100644 --- a/server/game/gamerules.cpp +++ b/server/game/gamerules.cpp @@ -122,7 +122,7 @@ void CGameRules::RefreshSkillData ( void ) CGameRules *InstallGameRules( void ) { SERVER_COMMAND( "exec game.rc\n" ); - SERVER_EXECUTE( ); + g_engfuncs.pfnServerExecute(); ALERT( at_aiconsole, "InstallGameRules\n" ); diff --git a/server/game/multiplay_gamerules.cpp b/server/game/multiplay_gamerules.cpp index 6b3e7328..f700f167 100644 --- a/server/game/multiplay_gamerules.cpp +++ b/server/game/multiplay_gamerules.cpp @@ -66,7 +66,7 @@ CHalfLifeMultiplay :: CHalfLifeMultiplay() { char szCommand[256]; - ALERT( at_debug, "Executing dedicated server config file\n" ); + ALERT( at_console, "Executing dedicated server config file\n" ); sprintf( szCommand, "exec %s\n", servercfgfile ); SERVER_COMMAND( szCommand ); } @@ -80,7 +80,7 @@ CHalfLifeMultiplay :: CHalfLifeMultiplay() { char szCommand[256]; - ALERT( at_debug, "Executing listen server config file\n" ); + ALERT( at_console, "Executing listen server config file\n" ); sprintf( szCommand, "exec %s\n", lservercfgfile ); SERVER_COMMAND( szCommand ); } diff --git a/server/game/sound.cpp b/server/game/sound.cpp index 4979627e..2816949d 100644 --- a/server/game/sound.cpp +++ b/server/game/sound.cpp @@ -249,16 +249,16 @@ void CAmbientGeneric :: Precache( void ) m_fActive = TRUE; } - if (pev->target) + if( pev->target ) { CBaseEntity *pTarget = UTIL_FindEntityByTargetname( NULL, STRING(pev->target)); - if (!pTarget) + + if( !pTarget ) { - ALERT(at_debug, "WARNING: ambient_generic \"%s\" can't find \"%s\", its entity to play from.\n", + ALERT( at_warning, "ambient_generic \"%s\" can't find \"%s\", its entity to play from.\n", STRING(pev->targetname), STRING(pev->target)); } - else - m_pPlayFrom = ENT(pTarget->pev); + else m_pPlayFrom = ENT( pTarget->pev ); } if ( m_fActive ) @@ -1112,7 +1112,7 @@ int SENTENCEG_PlayRndSz(edict_t *entity, const char *szgroupname, isentenceg = SENTENCEG_GetIndex(szgroupname); if (isentenceg < 0) { - ALERT( at_debug, "No such sentence group %s\n", szgroupname ); + ALERT( at_console, "No such sentence group %s\n", szgroupname ); return -1; } @@ -1808,8 +1808,8 @@ void CSpeaker :: SpeakerThink( void ) { // make random announcement from sentence group - if (SENTENCEG_PlayRndSz(ENT(pev), szSoundFile, flvolume, flattenuation, flags, pitch) < 0) - ALERT(at_debug, "Level Design Error!\nSPEAKER has bad sentence group name: %s\n",szSoundFile); + if( SENTENCEG_PlayRndSz( ENT( pev ), szSoundFile, flvolume, flattenuation, flags, pitch ) < 0 ) + ALERT( at_console, "Level Design Error!\nSPEAKER has bad sentence group name: %s\n",szSoundFile); // set next announcement time for random 5 to 10 minute delay SetNextThink( RANDOM_FLOAT(ANNOUNCE_MINUTES_MIN * 60.0, ANNOUNCE_MINUTES_MAX * 60.0) ); diff --git a/server/global/client.cpp b/server/global/client.cpp index 7b0692c9..f0fdaa84 100644 --- a/server/global/client.cpp +++ b/server/global/client.cpp @@ -897,6 +897,14 @@ void EndFrame( void ) { } +void ServerClassifyEdict( edict_t *pentToClassify ) +{ +} + +void UpdateEntityState( entity_state_t *to, edict_t *from, int baseline ) +{ +} + void ClientPrecache( void ) { // Material System!!! move this in next versions diff --git a/server/global/defaults.h b/server/global/defaults.h index 9e4b4e0f..f70cd566 100644 --- a/server/global/defaults.h +++ b/server/global/defaults.h @@ -57,10 +57,10 @@ //========================= // Global spawnflag system //========================= -#define SF_START_ON 0x1 #define SF_NOTSOLID 0x2 #define SF_FIREONCE 0x2 -#define SF_NORESPAWN ( 1 << 30 ) +#define SF_NORESPAWN BIT( 30 ) + //========================= // FCAP DEFAULTS //========================= diff --git a/server/global/dll_int.cpp b/server/global/dll_int.cpp index b7d7c35f..b6344a5a 100644 --- a/server/global/dll_int.cpp +++ b/server/global/dll_int.cpp @@ -25,16 +25,11 @@ BOOL WINAPI DllMain( HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved) return TRUE; } -void GiveFnptrsToDll( enginefuncs_t* pengfuncsFromEngine, globalvars_t *pGlobals ) -{ - memcpy(&g_engfuncs, pengfuncsFromEngine, sizeof(enginefuncs_t)); - gpGlobals = pGlobals; -} - static DLL_FUNCTIONS gFunctionTable = { sizeof( DLL_FUNCTIONS ), GameDLLInit, // pfnGameInit + GameDLLShutdown, // pfnGameShutdown DispatchSpawn, // pfnSpawn DispatchCreate, // pfnCreate DispatchThink, // pfnThink @@ -42,7 +37,6 @@ static DLL_FUNCTIONS gFunctionTable = DispatchTouch, // pfnTouch DispatchBlocked, // pfnBlocked DispatchKeyValue, // pfnKeyValue - DispatchFrame, // pfnFrame DispatchSave, // pfnSave DispatchRestore, // pfnRestore DispatchObjectCollsionBox, // pfnAbsBox @@ -68,24 +62,31 @@ static DLL_FUNCTIONS gFunctionTable = PlayerPostThink, // pfnPlayerPostThink StartFrame, // pfnStartFrame + DispatchFrame, // pfnFrame EndFrame, // pfnEndFrame BuildLevelList, // pfnBuildLevelList - GetGameDescription, //pfnGetGameDescription Returns string describing current .dll game. + ServerClassifyEdict, // pfnClassifyEdict + UpdateEntityState, // pfnUpdateEntityState + + GetGameDescription, // pfnGetGameDescription - returns string describing current .dll game. }; //======================================================================= -// GetApi +// General API entering point //======================================================================= -int GetEntityAPI( DLL_FUNCTIONS *pFunctionTable, int interfaceVersion ) +int CreateAPI( DLL_FUNCTIONS *pFunctionTable, enginefuncs_t* pengfuncsFromEngine, globalvars_t *pGlobals ) { - if ( !pFunctionTable || interfaceVersion != INTERFACE_VERSION ) + if( !pFunctionTable || !pengfuncsFromEngine || !pGlobals ) { return FALSE; } - - memcpy( pFunctionTable, &gFunctionTable, sizeof( DLL_FUNCTIONS ) ); + + memcpy( pFunctionTable, &gFunctionTable, sizeof( DLL_FUNCTIONS )); + memcpy(&g_engfuncs, pengfuncsFromEngine, sizeof( enginefuncs_t )); + gpGlobals = pGlobals; + return TRUE; } diff --git a/server/global/enginecallback.h b/server/global/enginecallback.h index c5dd30ae..35fad345 100644 --- a/server/global/enginecallback.h +++ b/server/global/enginecallback.h @@ -22,6 +22,7 @@ extern enginefuncs_t g_engfuncs; // The actual engine callbacks #define MALLOC( x ) (*g_engfuncs.pfnMemAlloc)( x, __FILE__, __LINE__ ) #define CALLOC( x, y ) (*g_engfuncs.pfnMemAlloc)((x) * (y), __FILE__, __LINE__ ) +#define MEMCPY( x, y, z ) (*g_engfuncs.pfnMemCopy)( x, y, z, __FILE__, __LINE__ ) #define FREE( x ) (*g_engfuncs.pfnMemFree)( x, __FILE__, __LINE__ ) #define PRECACHE_MODEL (*g_engfuncs.pfnPrecacheModel) #define PRECACHE_SOUND (*g_engfuncs.pfnPrecacheSound) @@ -43,7 +44,7 @@ extern enginefuncs_t g_engfuncs; #define REMOVE_ENTITY (*g_engfuncs.pfnRemoveEntity) #define CREATE_NAMED_ENTITY (*g_engfuncs.pfnCreateNamedEntity) #define MAKE_STATIC (*g_engfuncs.pfnMakeStatic) -#define ENT_IS_ON_FLOOR (*g_engfuncs.pfnEntIsOnFloor) +#define LINK_ENTITY (*g_engfuncs.pfnLinkEntity) #define DROP_TO_FLOOR (*g_engfuncs.pfnDropToFloor) #define WALK_MOVE (*g_engfuncs.pfnWalkMove) #define SET_ORIGIN (*g_engfuncs.pfnSetOrigin) @@ -55,7 +56,6 @@ extern enginefuncs_t g_engfuncs; #define TRACE_HULL (*g_engfuncs.pfnTraceHull) #define GET_AIM_VECTOR (*g_engfuncs.pfnGetAimVector) #define SERVER_COMMAND (*g_engfuncs.pfnServerCommand) -#define SERVER_EXECUTE (*g_engfuncs.pfnServerExecute) #define CLIENT_COMMAND (*g_engfuncs.pfnClientCommand) #define PARTICLE_EFFECT (*g_engfuncs.pfnParticleEffect) #define LIGHT_STYLE (*g_engfuncs.pfnLightStyle) @@ -131,6 +131,9 @@ inline void *GET_PRIVATE( edict_t *pent ) #define FREE_FILE FREE #define COMPARE_FILE_TIME (*g_engfuncs.pfnCompareFileTime) #define GET_GAME_DIR (*g_engfuncs.pfnGetGameDir) +#define ENGINE_CANSKIP (*g_engfuncs.pfnCanSkipPlayer) +#define PRECACHE_EVENT (*g_engfuncs.pfnPrecacheEvent) +#define PLAYBACK_EVENT_FULL (*g_engfuncs.pfnPlaybackEvent) #define IS_MAP_VALID (*g_engfuncs.pfnIsMapValid) #define IS_DEDICATED_SERVER (*g_engfuncs.pfnIsDedicatedServer) #define HOST_ERROR (*g_engfuncs.pfnHostError) diff --git a/server/global/extdll.h b/server/global/extdll.h index f20c8a7b..c9807955 100644 --- a/server/global/extdll.h +++ b/server/global/extdll.h @@ -1,11 +1,11 @@ //======================================================================= // Copyright (C) Shambler Team 2005 -// basetypes.h - global defines for dll's +// extdll.h - global defines for dll's // //======================================================================= -#ifndef BASETYPES_H -#define BASETYPES_H +#ifndef EXTDLL_H +#define EXTDLL_H // Silence certain warnings #pragma warning(disable : 4305) // int or float data truncation @@ -13,49 +13,36 @@ #pragma warning(disable : 4514) // unreferenced inline function removed #pragma warning(disable : 4100) // unreferenced formal parameter -// Prevent tons of unused windows definitions -#ifdef _WIN32 -#define WIN32_LEAN_AND_MEAN -#define NOWINRES -#define NOSERVICE -#define NOMCX -#define NOIME #include "windows.h" -#else // _WIN32 -#define FALSE 0 -#define TRUE (!FALSE) +#include "basetypes.h" + +#define FALSE 0 +#define TRUE 1 + typedef unsigned long ULONG; typedef unsigned char BYTE; typedef int BOOL; -#define MAX_PATH PATH_MAX + #include #include + #ifndef min #define min(a,b) (((a) < (b)) ? (a) : (b)) #endif + #ifndef max #define max(a,b) (((a) > (b)) ? (a) : (b)) +#endif + #define _vsnprintf(a,b,c,d) vsnprintf(a,b,c,d) -#endif -#endif //_WIN32 -#ifndef BIT -#define BIT( n ) (1<<( n )) -#endif - -// Misc C-runtime library headers -#include "stdio.h" -#include "stdlib.h" -#include "math.h" +// misc C-runtime library headers +#include +#include +#include // Header file containing definition of globalvars_t and entvars_t -typedef unsigned char byte; -typedef unsigned short word; -typedef unsigned int uint; -typedef unsigned long dword; -typedef int string_t; // from engine's pr_comp.h; -typedef int shader_t; -typedef float vec_t; // needed before including progdefs.h +typedef float vec_t; // needed before including progdefs.h inline unsigned long& FloatBits( vec_t& f ) { return *reinterpret_cast(&f); } inline unsigned long const& FloatBits( vec_t const& f ) { return *reinterpret_cast(&f); } @@ -68,6 +55,8 @@ inline float FloatMakePositive( vec_t f ) { return BitsToFloat( FloatBits(f) & 0 // Shared engine/DLL constants #include "const.h" +#include "game_shared.h" + // Vector class #include "vector.h" @@ -78,4 +67,4 @@ inline float FloatMakePositive( vec_t f ) { return BitsToFloat( FloatBits(f) & 0 extern Vector vec3_origin; extern Vector vec3_angles; -#endif // BASETYPES_H \ No newline at end of file +#endif // EXTDLL_H \ No newline at end of file diff --git a/server/global/globals.h b/server/global/globals.h index adce7619..62a63b2c 100644 --- a/server/global/globals.h +++ b/server/global/globals.h @@ -38,6 +38,8 @@ extern void DispatchBlocked( edict_t *pentBlocked, edict_t *pentOther ); extern void DispatchSave( edict_t *pent, SAVERESTOREDATA *pSaveData ); extern int DispatchRestore( edict_t *pent, SAVERESTOREDATA *pSaveData, int globalEntity ); extern void DispatchObjectCollsionBox( edict_t *pent ); +extern void ServerClassifyEdict( edict_t *pentToClassify ); +extern void UpdateEntityState( struct entity_state_s *to, edict_t *from, int baseline ); extern void SaveWriteFields( SAVERESTOREDATA *pSaveData, const char *pname, void *pBaseData, TYPEDESCRIPTION *pFields, int fieldCount ); extern void SaveReadFields( SAVERESTOREDATA *pSaveData, const char *pname, void *pBaseData, TYPEDESCRIPTION *pFields, int fieldCount ); extern void SaveGlobalState( SAVERESTOREDATA *pSaveData ); diff --git a/server/global/saverestore.cpp b/server/global/saverestore.cpp index 81292cc4..2524698c 100644 --- a/server/global/saverestore.cpp +++ b/server/global/saverestore.cpp @@ -930,7 +930,7 @@ int CRestore::ReadField( void *pBaseData, TYPEDESCRIPTION *pFields, int fieldCou #if 0 else { - ALERT( at_debug, "Skipping global field %s\n", pName ); + ALERT( at_console, "Skipping global field %s\n", pName ); } #endif return fieldNumber; @@ -1152,7 +1152,7 @@ void CGlobalState :: DumpGlobals( void ) static char *estates[] = { "Off", "On", "Dead" }; globalentity_t *pTest; - ALERT( at_debug, "-- Globals --\n" ); + ALERT( at_console, "-- Globals --\n" ); pTest = m_pList; while ( pTest ) { diff --git a/server/global/utils.cpp b/server/global/utils.cpp index c86eaaac..cc9a756a 100644 --- a/server/global/utils.cpp +++ b/server/global/utils.cpp @@ -467,9 +467,9 @@ CBaseEntity *UTIL_FindGlobalEntity( string_t classname, string_t globalname ) CBaseEntity *pReturn = UTIL_FindEntityByString( NULL, "globalname", STRING(globalname) ); if ( pReturn ) { - if ( !FClassnameIs( pReturn->pev, STRING(classname) ) ) + if( !FClassnameIs( pReturn->pev, STRING( classname ))) { - ALERT( at_debug, "Global entity found %s, wrong class %s\n", STRING(globalname), STRING(pReturn->pev->classname) ); + ALERT( at_console, "Global entity found %s, wrong class %s\n", STRING(globalname), STRING(pReturn->pev->classname) ); pReturn = NULL; } } @@ -1563,12 +1563,13 @@ float UTIL_SharedRandomFloat( unsigned int seed, float low, float high ) #ifdef DEBUG edict_t *DBG_EntOfVars( const entvars_t *pev ) { - if (pev->pContainingEntity != NULL) + if( pev->pContainingEntity != NULL ) return pev->pContainingEntity; - ALERT(at_debug, "entvars_t pContainingEntity is NULL, calling into engine"); + + ALERT( at_console, "entvars_t pContainingEntity is NULL, calling into engine" ); edict_t* pent = (*g_engfuncs.pfnFindEntityByVars)((entvars_t*)pev); - if (pent == NULL) - ALERT(at_debug, "DAMN! Even the engine couldn't FindEntityByVars!"); + + if( pent == NULL ) ALERT( at_console, "DAMN! Even the engine couldn't FindEntityByVars!" ); ((entvars_t *)pev)->pContainingEntity = pent; return pent; } @@ -2431,9 +2432,10 @@ BOOL UTIL_IsMasterTriggered(string_t iszMaster, CBaseEntity *pActivator) break; } } - if (!found) // no ( found + + if( !found ) // no ( found { - ALERT(at_debug, "Master \"%s\" not found!\n",szMaster); + ALERT( at_console, "Master \"%s\" not found!\n", szMaster ); return TRUE; } @@ -2442,12 +2444,11 @@ BOOL UTIL_IsMasterTriggered(string_t iszMaster, CBaseEntity *pActivator) pMaster = UTIL_FindEntityByTargetname( NULL, szBuf ); } - if (pMaster) + if( pMaster ) { - if (reverse) - return (pMaster->GetState( pActivator ) != STATE_ON); - else - return (pMaster->GetState( pActivator ) == STATE_ON); + if( reverse ) + return (pMaster->GetState( pActivator ) != STATE_ON ); + return (pMaster->GetState( pActivator ) == STATE_ON); } } diff --git a/server/global/utils.h b/server/global/utils.h index 620af940..c2507337 100644 --- a/server/global/utils.h +++ b/server/global/utils.h @@ -216,6 +216,14 @@ inline BOOL FStringNull(Vector vString) { return vString == Vector(0,0,0); } #define cchMapNameMost 32 +typedef enum +{ + point_hull = 0, + human_hull = 1, + large_hull = 2, + head_hull = 3 +}; + // Dot products for view cone checking #define VIEW_FIELD_FULL (float)-1.0 // +-180 degrees #define VIEW_FIELD_WIDE (float)-0.7 // +-135 degrees 0.1 // +-85 degrees, used for full FOV checks diff --git a/server/monsters/ai_sound.cpp b/server/monsters/ai_sound.cpp index ef0533de..88577ff6 100644 --- a/server/monsters/ai_sound.cpp +++ b/server/monsters/ai_sound.cpp @@ -175,7 +175,7 @@ int CSoundEnt :: IAllocSound( void ) if ( m_iFreeSound == SOUNDLIST_EMPTY ) { // no free sound! - ALERT ( at_debug, "Free Sound List is full!\n" ); + ALERT ( at_console, "Free Sound List is full!\n" ); return SOUNDLIST_EMPTY; } @@ -211,7 +211,7 @@ void CSoundEnt :: InsertSound ( int iType, const Vector &vecOrigin, int iVolume, if ( iThisSound == SOUNDLIST_EMPTY ) { - ALERT ( at_debug, "Could not AllocSound() for InsertSound() (DLL)\n" ); + ALERT( at_console, "Could not AllocSound() for InsertSound() (DLL)\n" ); return; } @@ -250,7 +250,7 @@ void CSoundEnt :: Initialize ( void ) if ( iSound == SOUNDLIST_EMPTY ) { - ALERT ( at_debug, "Could not AllocSound() for Client Reserve! (DLL)\n" ); + ALERT ( at_console, "Could not AllocSound() for Client Reserve! (DLL)\n" ); return; } @@ -286,7 +286,7 @@ int CSoundEnt :: ISoundsInList ( int iListType ) } else { - ALERT ( at_debug, "Unknown Sound List Type!\n" ); + ALERT( at_console, "Unknown Sound List Type!\n" ); } if ( iThisSound == SOUNDLIST_EMPTY ) @@ -343,15 +343,15 @@ CSound* CSoundEnt :: SoundPointerForIndex( int iIndex ) return NULL; } - if ( iIndex > ( MAX_WORLD_SOUNDS - 1 ) ) + if( iIndex > ( MAX_WORLD_SOUNDS - 1 )) { - ALERT ( at_debug, "SoundPointerForIndex() - Index too large!\n" ); + ALERT( at_console, "SoundPointerForIndex() - Index too large!\n" ); return NULL; } if ( iIndex < 0 ) { - ALERT ( at_debug, "SoundPointerForIndex() - Index < 0!\n" ); + ALERT( at_console, "SoundPointerForIndex() - Index < 0!\n" ); return NULL; } @@ -371,7 +371,7 @@ int CSoundEnt :: ClientSoundIndex ( edict_t *pClient ) #ifdef _DEBUG if ( iReturn < 0 || iReturn > gpGlobals->maxClients ) { - ALERT ( at_debug, "** ClientSoundIndex returning a bogus value! **\n" ); + ALERT( at_console, "** ClientSoundIndex returning a bogus value! **\n" ); } #endif // _DEBUG diff --git a/server/monsters/animation.cpp b/server/monsters/animation.cpp index ab4499b5..a2c595a4 100644 --- a/server/monsters/animation.cpp +++ b/server/monsters/animation.cpp @@ -19,7 +19,7 @@ #include "extdll.h" #include "utils.h" #include "const.h" -#include "qfiles_ref.h" +#include "studio_ref.h" #ifndef ACTIVITY_H #include "activity.h" @@ -468,7 +468,7 @@ int FindTransition( void *pmodel, int iEndingAnim, int iGoalAnim, int *piDir ) } } - ALERT( at_debug, "error in transition graph" ); + ALERT( at_console, "error in transition graph\n" ); return iGoalAnim; } diff --git a/server/monsters/barney.cpp b/server/monsters/barney.cpp index bbf098fd..a6f03c60 100644 --- a/server/monsters/barney.cpp +++ b/server/monsters/barney.cpp @@ -916,9 +916,9 @@ void CDeadBarney :: Spawn( ) m_bloodColor = BLOOD_COLOR_RED; pev->sequence = LookupSequence( m_szPoses[m_iPose] ); - if (pev->sequence == -1) + if( pev->sequence == -1 ) { - ALERT ( at_debug, "Dead barney with bad pose\n" ); + ALERT ( at_console, "Dead barney with bad pose\n" ); } // Corpses have less health pev->health = DEAD_BARNEY_HEALTH; diff --git a/server/monsters/basemonster.cpp b/server/monsters/basemonster.cpp index 87bbc774..838284ea 100644 --- a/server/monsters/basemonster.cpp +++ b/server/monsters/basemonster.cpp @@ -2254,7 +2254,7 @@ BOOL CBaseMonster :: FindCover ( Vector vecThreat, Vector vecViewOffset, float f if ( flMinDist > 0.5 * flMaxDist) { #if _DEBUG - ALERT ( at_debug, "FindCover MinDist (%.0f) too close to MaxDist (%.0f)\n", flMinDist, flMaxDist ); + ALERT ( at_console, "FindCover MinDist (%.0f) too close to MaxDist (%.0f)\n", flMinDist, flMaxDist ); #endif flMinDist = 0.5 * flMaxDist; } @@ -2359,7 +2359,7 @@ BOOL CBaseMonster :: BuildNearestRoute ( Vector vecThreat, Vector vecViewOffset, if ( flMinDist > 0.5 * flMaxDist) { #if _DEBUG - ALERT ( at_debug, "FindCover MinDist (%.0f) too close to MaxDist (%.0f)\n", flMinDist, flMaxDist ); + ALERT ( at_console, "FindCover MinDist (%.0f) too close to MaxDist (%.0f)\n", flMinDist, flMaxDist ); #endif flMinDist = 0.5 * flMaxDist; } @@ -3130,7 +3130,7 @@ int CBaseMonster :: CanPlaySequence( int interruptFlags ) else { #ifdef DEBUG_CANTPLAY - ALERT(at_debug, "CANTPLAY: Already playing %s \"%s\"!\n", STRING(m_pCine->pev->classname), STRING(m_pCine->pev->targetname)); + ALERT(at_console, "CANTPLAY: Already playing %s \"%s\"!\n", STRING(m_pCine->pev->classname), STRING(m_pCine->pev->targetname)); #endif return false; } @@ -3138,7 +3138,7 @@ int CBaseMonster :: CanPlaySequence( int interruptFlags ) else if ( !IsAlive() || m_MonsterState == MONSTERSTATE_PRONE ) { #ifdef DEBUG_CANTPLAY - ALERT(at_debug, "CANTPLAY: Dead/Barnacled!\n"); + ALERT(at_console, "CANTPLAY: Dead/Barnacled!\n"); #endif // monster is already running a scripted sequence or dead! return FALSE; @@ -3161,7 +3161,7 @@ int CBaseMonster :: CanPlaySequence( int interruptFlags ) // unknown situation #ifdef DEBUG_CANTPLAY - ALERT(at_debug, "CANTPLAY: non-interruptable state.\n"); + ALERT(at_console, "CANTPLAY: non-interruptable state.\n"); #endif return FALSE; } @@ -3728,7 +3728,7 @@ void CBaseMonster :: ChangeSchedule ( Schedule_t *pNewSchedule ) #if _DEBUG if ( !ScheduleFromName( pNewSchedule->pName ) ) { - ALERT( at_debug, "Schedule %s not in table!!!\n", pNewSchedule->pName ); + ALERT( at_console, "Schedule %s not in table!!!\n", pNewSchedule->pName ); } #endif @@ -6178,7 +6178,7 @@ CBaseEntity* CBaseMonster :: DropItem ( char *pszItemName, const Vector &vecPos, { if ( !pszItemName ) { - ALERT ( at_debug, "DropItem() - No item name!\n" ); + ALERT ( at_console, "DropItem() - No item name!\n" ); return NULL; } @@ -6193,7 +6193,7 @@ CBaseEntity* CBaseMonster :: DropItem ( char *pszItemName, const Vector &vecPos, } else { - ALERT ( at_debug, "DropItem() - Didn't create!\n" ); + ALERT ( at_console, "DropItem() - Didn't create!\n" ); return FALSE; } diff --git a/server/monsters/defaultai.cpp b/server/monsters/defaultai.cpp index 02312149..2e17c687 100644 --- a/server/monsters/defaultai.cpp +++ b/server/monsters/defaultai.cpp @@ -1058,7 +1058,7 @@ Schedule_t *CBaseMonster :: ScheduleInList( const char *pName, Schedule_t **pLis if ( !pName ) { - ALERT( at_debug, "%s set to unnamed schedule!\n", STRING(pev->classname) ); + ALERT( at_console, "%s set to unnamed schedule!\n", STRING(pev->classname) ); return NULL; } @@ -1067,7 +1067,7 @@ Schedule_t *CBaseMonster :: ScheduleInList( const char *pName, Schedule_t **pLis { if ( !pList[i]->pName ) { - ALERT( at_debug, "Unnamed schedule!\n" ); + ALERT( at_console, "Unnamed schedule!\n" ); continue; } if ( stricmp( pName, pList[i]->pName ) == 0 ) @@ -1249,7 +1249,7 @@ Schedule_t* CBaseMonster :: GetScheduleOfType ( int Type ) } default: { - ALERT ( at_debug, "GetScheduleOfType()\nNo CASE for Schedule Type %d!\n", Type ); + ALERT ( at_console, "GetScheduleOfType()\nNo CASE for Schedule Type %d!\n", Type ); return &slIdleStand[ 0 ]; break; diff --git a/server/monsters/generic.cpp b/server/monsters/generic.cpp index cfb5bdf3..e50a63d0 100644 --- a/server/monsters/generic.cpp +++ b/server/monsters/generic.cpp @@ -359,13 +359,13 @@ void CDeadGenericMonster :: Spawn( void ) pev->yaw_speed = 8; //LRC -- what? pev->sequence = 0; - if (pev->netname) + if( pev->netname ) { - pev->sequence = LookupSequence( STRING(pev->netname) ); + pev->sequence = LookupSequence( STRING( pev->netname )); - if (pev->sequence == -1) + if( pev->sequence == -1 ) { - ALERT ( at_debug, "Invalid sequence name \"%s\" in monster_generic_dead\n", STRING(pev->netname) ); + ALERT ( at_console, "Invalid sequence name \"%s\" in monster_generic_dead\n", STRING(pev->netname) ); } } else diff --git a/server/monsters/hgrunt.cpp b/server/monsters/hgrunt.cpp index 5e9ba136..43ecf67d 100644 --- a/server/monsters/hgrunt.cpp +++ b/server/monsters/hgrunt.cpp @@ -1996,7 +1996,7 @@ void CHGrunt :: SetActivity ( Activity NewActivity ) } else { - ALERT( at_debug, "No grenades available. "); // flow into the error message we get at the end... + ALERT( at_console, "No grenades available. "); // flow into the error message we get at the end... } break; case ACT_RUN: @@ -2050,7 +2050,7 @@ void CHGrunt :: SetActivity ( Activity NewActivity ) else { // Not available try to get default anim - ALERT ( at_debug, "%s has no sequence for act:%d\n", STRING(pev->classname), NewActivity ); + ALERT ( at_console, "%s has no sequence for act:%d\n", STRING(pev->classname), NewActivity ); pev->sequence = 0; // Set to the reset anim (if it's there) } } @@ -2565,9 +2565,9 @@ void CDeadHGrunt :: Spawn( void ) pev->sequence = LookupSequence( m_szPoses[m_iPose] ); - if (pev->sequence == -1) + if( pev->sequence == -1 ) { - ALERT ( at_debug, "Dead hgrunt with bad pose\n" ); + ALERT ( at_console, "Dead hgrunt with bad pose\n" ); } // Corpses have less health diff --git a/server/monsters/nodes.cpp b/server/monsters/nodes.cpp index 6085c5f9..a1ab8cf2 100644 --- a/server/monsters/nodes.cpp +++ b/server/monsters/nodes.cpp @@ -480,11 +480,11 @@ float CGraph::PathLength( int iStart, int iDest, int iHull, int afCapMask ) int iCurrentNode = iStart; int iCap = CapIndex( afCapMask ); - while (iCurrentNode != iDest) + while( iCurrentNode != iDest ) { - if (iMaxLoop-- <= 0) + if( iMaxLoop-- <= 0 ) { - ALERT( at_debug, "Route Failure\n" ); + ALERT( at_console, "Route Failure\n" ); return 0; } @@ -496,13 +496,13 @@ float CGraph::PathLength( int iStart, int iDest, int iHull, int afCapMask ) } int iLink; - HashSearch(iCurrentNode, iNext, iLink); - if (iLink < 0) + HashSearch( iCurrentNode, iNext, iLink ); + if( iLink < 0 ) { - ALERT(at_debug, "HashLinks is broken from %d to %d.\n", iCurrentNode, iDest); + ALERT( at_console, "HashLinks is broken from %d to %d.\n", iCurrentNode, iDest ); return 0; } - CLink &link = Link(iLink); + CLink &link = Link( iLink ); distance += link.m_flWeight; iCurrentNode = iNext; @@ -2055,9 +2055,9 @@ void CTestHull :: BuildNodeGraph( void ) // WorldGraph.ComputeStaticRoutingTables(); -// save the node graph for this level - WorldGraph.FSaveGraph( (char *)STRING( gpGlobals->mapname ) ); - ALERT( at_debug, "Done.\n"); + // save the node graph for this level + WorldGraph.FSaveGraph( (char *)STRING( gpGlobals->mapname )); + ALERT( at_console, "Done.\n"); } @@ -3511,9 +3511,10 @@ LINK_ENTITY_TO_CLASS( node_viewer_large, CNodeViewer ); void CNodeViewer::Spawn( ) { - if ( !WorldGraph.m_fGraphPresent || !WorldGraph.m_fGraphPointersSet ) - {// protect us in the case that the node graph isn't available or built - ALERT ( at_debug, "Graph not ready!\n" ); + if( !WorldGraph.m_fGraphPresent || !WorldGraph.m_fGraphPointersSet ) + { + // protect us in the case that the node graph isn't available or built + ALERT ( at_console, "Graph not ready!\n" ); UTIL_Remove( this ); return; } @@ -3541,9 +3542,9 @@ void CNodeViewer::Spawn( ) m_iBaseNode = WorldGraph.FindNearestNode ( pev->origin, m_afNodeType ); - if ( m_iBaseNode < 0 ) + if( m_iBaseNode < 0 ) { - ALERT( at_debug, "No nearby node\n" ); + ALERT( at_console, "No nearby node\n" ); return; } diff --git a/server/monsters/osprey.cpp b/server/monsters/osprey.cpp index 08f5b181..a4815124 100644 --- a/server/monsters/osprey.cpp +++ b/server/monsters/osprey.cpp @@ -155,7 +155,7 @@ void COsprey :: Spawn( void ) UTIL_SetSize(pev, Vector( -400, -400, -100), Vector(400, 400, 32)); UTIL_SetOrigin( this, pev->origin ); - //ALERT(at_console, "Osprey origin %f %f %f\n", pev->origin.x, pev->origin.y, pev->origin.z); + // ALERT( at_console, "Osprey origin %f %f %f\n", pev->origin.x, pev->origin.y, pev->origin.z); pev->flags |= FL_MONSTER; pev->takedamage = DAMAGE_YES; @@ -372,7 +372,7 @@ void COsprey::UpdateGoal( ) m_startTime = m_startTime + m_dTime; m_dTime = 2.0 * (m_pos1 - m_pos2).Length() / (m_vel1.Length() + pev->speed); - //ALERT(at_console, "osprey m_dTime = %f / %f + %f\n", (m_pos1 - m_pos2).Length(), m_vel1.Length(), m_pGoalEnt->pev->speed); + // ALERT(at_console, "osprey m_dTime = %f / %f + %f\n", (m_pos1 - m_pos2).Length(), m_vel1.Length(), m_pGoalEnt->pev->speed); if (m_ang1.y - m_ang2.y < -180) { @@ -390,7 +390,7 @@ void COsprey::UpdateGoal( ) } else { - ALERT( at_debug, "osprey missing target"); + ALERT( at_console, "osprey missing target"); } } diff --git a/server/monsters/player.cpp b/server/monsters/player.cpp index b7d5c1ab..c90a1529 100644 --- a/server/monsters/player.cpp +++ b/server/monsters/player.cpp @@ -2762,10 +2762,10 @@ void CBasePlayer::SetSuitUpdate(char *name, int fgroup, int iNoRepeatTime) // get sentence or group number if (!fgroup) { - isentence = SENTENCEG_Lookup(name, NULL); - if (isentence < 0) + isentence = SENTENCEG_Lookup( name, NULL ); + if( isentence < 0 ) { - ALERT(at_debug,"HEV couldn't find sentence %s\n",name); + ALERT( at_console, "HEV couldn't find sentence %s\n", name ); return; } } @@ -2861,9 +2861,9 @@ void CBasePlayer :: UpdatePlayerSound ( void ) pSound = CSoundEnt::SoundPointerForIndex( CSoundEnt :: ClientSoundIndex( edict() ) ); - if ( !pSound ) + if( !pSound ) { - ALERT ( at_debug, "Client lost reserved sound!\n" ); + ALERT ( at_console, "Client lost reserved sound!\n" ); return; } @@ -3312,9 +3312,9 @@ void CBasePlayer::Spawn( void ) Precache(); m_HackedGunPos = Vector( 0, 32, 0 ); - if ( m_iPlayerSound == SOUNDLIST_EMPTY ) + if( m_iPlayerSound == SOUNDLIST_EMPTY ) { - ALERT ( at_debug, "Couldn't alloc player sound slot!\n" ); + ALERT ( at_console, "Couldn't alloc player sound slot!\n" ); } m_fNoPlayerSound = FALSE;// normal sound behavior. @@ -3417,7 +3417,7 @@ int CBasePlayer::Restore( CRestore &restore ) // landmark isn't present. if( !pSaveData->fUseLandmark ) { - ALERT( at_debug, "No Landmark:%s\n", pSaveData->szLandmarkName ); + ALERT( at_error, "No Landmark:%s\n", pSaveData->szLandmarkName ); // default to normal spawn edict_t* pentSpawnSpot = EntSelectSpawnPoint( this ); @@ -5145,9 +5145,9 @@ void CDeadHEV :: Spawn( void ) pev->sequence = LookupSequence( m_szPoses[m_iPose] ); - if (pev->sequence == -1) + if( pev->sequence == -1 ) { - ALERT ( at_debug, "Dead hevsuit with bad pose\n" ); + ALERT ( at_console, "Dead hevsuit with bad pose\n" ); pev->sequence = 0; pev->effects = EF_BRIGHTFIELD; } diff --git a/server/monsters/roach.cpp b/server/monsters/roach.cpp index b84e1985..97fca488 100644 --- a/server/monsters/roach.cpp +++ b/server/monsters/roach.cpp @@ -445,13 +445,13 @@ void CRoach :: Look ( int iDistance ) // we see monsters other than the Enemy. switch ( IRelationship ( pSightEnt ) ) { - case R_FR: + case R_FR: iSighted |= bits_COND_SEE_FEAR; break; - case R_NO: + case R_NO: break; default: - ALERT ( at_debug, "%s can't assess %s\n", STRING(pev->classname), STRING(pSightEnt->pev->classname ) ); + ALERT ( at_console, "%s can't assess %s\n", STRING(pev->classname), STRING(pSightEnt->pev->classname ) ); break; } } diff --git a/server/monsters/scientist.cpp b/server/monsters/scientist.cpp index 993d8ac9..15647566 100644 --- a/server/monsters/scientist.cpp +++ b/server/monsters/scientist.cpp @@ -1123,7 +1123,7 @@ class CDeadScientist : public CBaseMonster { public: void Spawn( void ); - int Classify ( void ) { return CLASS_HUMAN_PASSIVE; } + int Classify ( void ) { return CLASS_HUMAN_PASSIVE; } void KeyValue( KeyValueData *pkvd ); int m_iPose;// which sequence to display @@ -1146,10 +1146,10 @@ LINK_ENTITY_TO_CLASS( monster_scientist_dead, CDeadScientist ); // // ********** DeadScientist SPAWN ********** // -void CDeadScientist :: Spawn( ) +void CDeadScientist :: Spawn( void ) { - PRECACHE_MODEL("models/scientist.mdl"); - SET_MODEL(ENT(pev), "models/scientist.mdl"); + PRECACHE_MODEL( "models/scientist.mdl" ); + SET_MODEL( ENT( pev ), "models/scientist.mdl" ); pev->effects = 0; pev->sequence = 0; @@ -1171,10 +1171,10 @@ void CDeadScientist :: Spawn( ) pev->sequence = LookupSequence( m_szPoses[m_iPose] ); if (pev->sequence == -1) { - ALERT ( at_debug, "Dead scientist with bad pose\n" ); + ALERT ( at_console, "Dead scientist with bad pose\n" ); } - // pev->skin += 2; // use bloody skin -- UNDONE: Turn this back on when we have a bloody skin again! + // pev->skin += 2; // use bloody skin -- UNDONE: Turn this back on when we have a bloody skin again! MonsterInitDead(); } diff --git a/server/monsters/scripted.cpp b/server/monsters/scripted.cpp index 4c523466..a2198551 100644 --- a/server/monsters/scripted.cpp +++ b/server/monsters/scripted.cpp @@ -287,9 +287,9 @@ CBaseMonster* CCineMonster :: FindEntity( const char* sName, CBaseEntity *pActiv { return pMonster; } - ALERT( at_debug, "Found %s, but can't play!\n", sName ); + ALERT( at_console, "Found %s, but can't play!\n", sName ); } - pEntity = UTIL_FindEntityByTargetname(pEntity, sName, pActivator); + pEntity = UTIL_FindEntityByTargetname( pEntity, sName, pActivator ); pMonster = NULL; } @@ -344,9 +344,11 @@ void CCineMonster :: PossessEntity( void ) if (FClassnameIs( pTarget->m_hTargetEnt->pev, STRING(m_iszAttack))) break; } } - if (pTarget->m_hTargetEnt == NULL) - { // nothing. Oh well. - ALERT(at_debug,"%s %s has a missing \"turn target\": %s\n",STRING(pev->classname),STRING(pev->targetname),STRING(m_iszAttack)); + + if( pTarget->m_hTargetEnt == NULL ) + { + // nothing. Oh well. + ALERT( at_console, "%s %s has a missing \"turn target\": %s\n",STRING(pev->classname),STRING(pev->targetname),STRING(m_iszAttack)); pTarget->m_hTargetEnt = this; } } @@ -355,13 +357,14 @@ void CCineMonster :: PossessEntity( void ) pTarget->m_hTargetEnt = this; } - if (m_iszMoveTarget) + if( m_iszMoveTarget ) { // anything with that name? pTarget->m_pGoalEnt = UTIL_FindEntityByTargetname(NULL, STRING(m_iszMoveTarget), m_hActivator); - if (pTarget->m_pGoalEnt == NULL) - { // nothing. Oh well. - ALERT(at_debug,"%s %s has a missing \"move target\": %s\n",STRING(pev->classname),STRING(pev->targetname),STRING(m_iszMoveTarget)); + if( pTarget->m_pGoalEnt == NULL ) + { + // nothing. Oh well. + ALERT( at_console, "%s %s has a missing \"move target\": %s\n",STRING(pev->classname),STRING(pev->targetname),STRING(m_iszMoveTarget)); pTarget->m_pGoalEnt = this; } } @@ -483,12 +486,12 @@ BOOL CCineMonster :: StartSequence( CBaseMonster *pTarget, int iszSeq, BOOL comp #if 0 char *s; - if ( pev->spawnflags & SF_SCRIPT_NOINTERRUPT ) + if( pev->spawnflags & SF_SCRIPT_NOINTERRUPT ) s = "No"; else s = "Yes"; - ALERT( at_debug, "%s (%s): started \"%s\":INT:%s\n", STRING( pTarget->pev->targetname ), STRING( pTarget->pev->classname ), STRING( iszSeq), s ); + ALERT( at_console, "%s (%s): started \"%s\":INT:%s\n", STRING( pTarget->pev->targetname ), STRING( pTarget->pev->classname ), STRING( iszSeq), s ); #endif pTarget->pev->frame = 0; @@ -1043,7 +1046,7 @@ void CScriptedSentence :: FindThink( void ) m_active = FALSE; } else - ALERT( at_debug, "ScriptedSentence: can't find \"player\" to play HEV sentence!?\n"); + ALERT( at_console, "ScriptedSentence: can't find \"player\" to play HEV sentence!?\n" ); return; } diff --git a/server/monsters/squadmonster.cpp b/server/monsters/squadmonster.cpp index 5c9c7851..59a9aaf3 100644 --- a/server/monsters/squadmonster.cpp +++ b/server/monsters/squadmonster.cpp @@ -247,7 +247,7 @@ void CSquadMonster :: SquadMakeEnemy ( CBaseEntity *pEnemy ) if ( !pEnemy ) { - ALERT ( at_debug, "ERROR: SquadMakeEnemy() - pEnemy is NULL!\n" ); + ALERT ( at_console, "ERROR: SquadMakeEnemy() - pEnemy is NULL!\n" ); return; } diff --git a/server/server.def b/server/server.def index a2eccc63..9ff5285c 100644 --- a/server/server.def +++ b/server/server.def @@ -1,5 +1,5 @@ LIBRARY server EXPORTS - GiveFnptrsToDll @1 + CreateAPI @1 SECTIONS .data READ WRITE diff --git a/server/server.dsp b/server/server.dsp index ab9ee7e3..3451bc91 100644 --- a/server/server.dsp +++ b/server/server.dsp @@ -43,7 +43,7 @@ RSC=rc.exe # PROP Ignore_Export_Lib 1 # PROP Target_Dir "" # ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /YX /c -# ADD CPP /nologo /MD /W3 /O2 /I "./" /I "./ents" /I "./game" /I "./global" /I "./monsters" /I "../public" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /FD /c +# ADD CPP /nologo /MD /W3 /O2 /I "./" /I "ents" /I "game" /I "global" /I "monsters" /I "../common" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /FD /c # SUBTRACT CPP /Fr /YX # ADD BASE MTL /nologo /D "NDEBUG" /win32 # ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32 @@ -82,7 +82,7 @@ SOURCE="$(InputPath)" # PROP Target_Dir "" # ADD BASE CPP /nologo /G5 /MT /W3 /O2 /I "..\server" /I "..\common\engine" /I "..\common" /I "..\server\ents" /I "..\server\global" /I "..\server\weapons" /I "..\server\game" /I "..\server\monsters" /D "NDEBUG" /D "WIN32" /D "_WINDOWS" /D "_MBCS" /YX /FD /c # SUBTRACT BASE CPP /Fr -# ADD CPP /nologo /MDd /W3 /Gm /Gi /GX /ZI /Od /I "./" /I "./ents" /I "./game" /I "./global" /I "./monsters" /I "../public" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /FR /FD /c +# ADD CPP /nologo /MDd /W3 /Gm /Gi /GX /ZI /Od /I "./" /I "ents" /I "game" /I "global" /I "monsters" /I "../common" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /FR /FD /c # SUBTRACT CPP /u /YX # ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32 # ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32 diff --git a/todo.log b/todo.log index 0d28d11b..b9307a2d 100644 --- a/todo.log +++ b/todo.log @@ -46,32 +46,12 @@ Beta 13.12.08 25.wrote HUD_StudioEvents OK 16.register cmd->buttons OK 17.pfnSetKeyDest in client.dll OK -18.IMPLEMENT SAVERESTORE - -// savegame algorhytem - -1. Init gpGlobals->pSaveData (for save ) -{ - pBaseData = malloc( 512 kb ) - pCurrentData = pBaseData - size = 0 - bufferSize = 512 kb - tokenSize = 0 - tokenCount = 4096 - pTokens = (pTokens **)malloc( (pTokens*) * 4096 ) // pointers array - currentIndex = 0 - tableCount = numEnts - pTable = malloc( (ENTITYTABLE) * numEnts ) - // also set ENTITYTABLE.id and ENTITTYTABLE.pent - - fUseLandmark = 0 - szLandmarkName = 0 - vecLandmarkOffset = 0 - szCurrentMap = 0; - time = sv.time; -} - -2. Save Engine Variables +18.IMPLEMENT SAVERESTORE OK +19.crash on dm_knot +20.rename common.dll to xtools.dll OK +21.add missing builtins in enginefuncs_t OK +22.add missing builtins in cl_enginefuncs_t OK +23.first implement efxapi_t Список доступных рендереров: Что в них интересного 0. Q3Fusion (Mirrors, Portals) diff --git a/vprogs/vprogs.dsp b/vprogs/vprogs.dsp index 58c60f90..ec4cd035 100644 --- a/vprogs/vprogs.dsp +++ b/vprogs/vprogs.dsp @@ -43,7 +43,7 @@ RSC=rc.exe # PROP Ignore_Export_Lib 1 # PROP Target_Dir "" # ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "PLATFORM_EXPORTS" /YX /FD /c -# ADD CPP /nologo /MD /W3 /GX /O2 /I "./" /I "../public" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /FD /c +# ADD CPP /nologo /MD /W3 /GX /O2 /I "./" /I "../public" /I "../common" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /FD /c # SUBTRACT CPP /YX # ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32 # ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32 @@ -80,7 +80,7 @@ SOURCE="$(InputPath)" # PROP Ignore_Export_Lib 1 # PROP Target_Dir "" # ADD BASE CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "PLATFORM_EXPORTS" /YX /FD /GZ /c -# ADD CPP /nologo /MDd /W3 /Gm /Gi /GX /ZI /Od /I "./" /I "../public" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /FR /FD /GZ /c +# ADD CPP /nologo /MDd /W3 /Gm /Gi /GX /ZI /Od /I "./" /I "../public" /I "../common" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /FR /FD /GZ /c # SUBTRACT CPP /YX # ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32 # ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32 diff --git a/vsound/s_main.c b/vsound/s_main.c index da79ede9..536a062d 100644 --- a/vsound/s_main.c +++ b/vsound/s_main.c @@ -5,6 +5,7 @@ #include "sound.h" #include "const.h" +#include "trace_def.h" #define MAX_PLAYSOUNDS 256 #define MAX_CHANNELS 64 diff --git a/vsound/vsound.dsp b/vsound/vsound.dsp index e0568def..8d4e0ac8 100644 --- a/vsound/vsound.dsp +++ b/vsound/vsound.dsp @@ -43,7 +43,7 @@ RSC=rc.exe # PROP Ignore_Export_Lib 1 # PROP Target_Dir "" # ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "PLATFORM_EXPORTS" /YX /FD /c -# ADD CPP /nologo /MD /W3 /GX /O2 /I "./" /I "../public" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /FD /c +# ADD CPP /nologo /MD /W3 /GX /O2 /I "./" /I "../public" /I "../common" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /FD /c # SUBTRACT CPP /YX # ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32 # ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32 @@ -80,7 +80,7 @@ SOURCE="$(InputPath)" # PROP Ignore_Export_Lib 1 # PROP Target_Dir "" # ADD BASE CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "PLATFORM_EXPORTS" /YX /FD /GZ /c -# ADD CPP /nologo /MDd /W3 /Gm /Gi /GX /ZI /Od /I "./" /I "../public" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /FR /FD /GZ /c +# ADD CPP /nologo /MDd /W3 /Gm /Gi /GX /ZI /Od /I "./" /I "../public" /I "../common" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /FR /FD /GZ /c # SUBTRACT CPP /YX # ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32 # ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32 diff --git a/xash.dsw b/xash.dsw index 2522351f..55f0de32 100644 --- a/xash.dsw +++ b/xash.dsw @@ -27,7 +27,7 @@ Package=<4> ############################################################################### -Project: "common"=".\common\common.dsp" - Package Owner=<4> +Project: "xtools"=".\xtools\xtools.dsp" - Package Owner=<4> Package=<5> {{{ diff --git a/common/bsplib/ambient.c b/xtools/bsplib/ambient.c similarity index 100% rename from common/bsplib/ambient.c rename to xtools/bsplib/ambient.c diff --git a/common/bsplib/anorms.h b/xtools/bsplib/anorms.h similarity index 100% rename from common/bsplib/anorms.h rename to xtools/bsplib/anorms.h diff --git a/common/bsplib/brushbsp.c b/xtools/bsplib/brushbsp.c similarity index 100% rename from common/bsplib/brushbsp.c rename to xtools/bsplib/brushbsp.c diff --git a/common/bsplib/bspfile.c b/xtools/bsplib/bspfile.c similarity index 100% rename from common/bsplib/bspfile.c rename to xtools/bsplib/bspfile.c diff --git a/common/bsplib/bsplib.c b/xtools/bsplib/bsplib.c similarity index 100% rename from common/bsplib/bsplib.c rename to xtools/bsplib/bsplib.c diff --git a/common/bsplib/bsplib.h b/xtools/bsplib/bsplib.h similarity index 95% rename from common/bsplib/bsplib.h rename to xtools/bsplib/bsplib.h index 9023eafc..54dcd3fd 100644 --- a/common/bsplib/bsplib.h +++ b/xtools/bsplib/bsplib.h @@ -5,10 +5,11 @@ #ifndef BSPLIB_H #define BSPLIB_H -#include "platform.h" +#include "xtools.h" #include "engine_api.h" #include "utils.h" #include "mathlib.h" +#include "trace_def.h" // supported map formats enum diff --git a/common/bsplib/csg.c b/xtools/bsplib/csg.c similarity index 100% rename from common/bsplib/csg.c rename to xtools/bsplib/csg.c diff --git a/common/bsplib/faces.c b/xtools/bsplib/faces.c similarity index 100% rename from common/bsplib/faces.c rename to xtools/bsplib/faces.c diff --git a/common/bsplib/flow.c b/xtools/bsplib/flow.c similarity index 100% rename from common/bsplib/flow.c rename to xtools/bsplib/flow.c diff --git a/common/bsplib/leakfile.c b/xtools/bsplib/leakfile.c similarity index 100% rename from common/bsplib/leakfile.c rename to xtools/bsplib/leakfile.c diff --git a/common/bsplib/lightmap.c b/xtools/bsplib/lightmap.c similarity index 100% rename from common/bsplib/lightmap.c rename to xtools/bsplib/lightmap.c diff --git a/common/bsplib/map.c b/xtools/bsplib/map.c similarity index 100% rename from common/bsplib/map.c rename to xtools/bsplib/map.c diff --git a/common/bsplib/patches.c b/xtools/bsplib/patches.c similarity index 100% rename from common/bsplib/patches.c rename to xtools/bsplib/patches.c diff --git a/common/bsplib/portals.c b/xtools/bsplib/portals.c similarity index 100% rename from common/bsplib/portals.c rename to xtools/bsplib/portals.c diff --git a/common/bsplib/prtfile.c b/xtools/bsplib/prtfile.c similarity index 100% rename from common/bsplib/prtfile.c rename to xtools/bsplib/prtfile.c diff --git a/common/bsplib/qbsp3.c b/xtools/bsplib/qbsp3.c similarity index 100% rename from common/bsplib/qbsp3.c rename to xtools/bsplib/qbsp3.c diff --git a/common/bsplib/qrad3.c b/xtools/bsplib/qrad3.c similarity index 100% rename from common/bsplib/qrad3.c rename to xtools/bsplib/qrad3.c diff --git a/common/bsplib/qvis3.c b/xtools/bsplib/qvis3.c similarity index 100% rename from common/bsplib/qvis3.c rename to xtools/bsplib/qvis3.c diff --git a/common/bsplib/shaders.c b/xtools/bsplib/shaders.c similarity index 100% rename from common/bsplib/shaders.c rename to xtools/bsplib/shaders.c diff --git a/common/bsplib/textures.c b/xtools/bsplib/textures.c similarity index 100% rename from common/bsplib/textures.c rename to xtools/bsplib/textures.c diff --git a/common/bsplib/trace.c b/xtools/bsplib/trace.c similarity index 100% rename from common/bsplib/trace.c rename to xtools/bsplib/trace.c diff --git a/common/bsplib/tree.c b/xtools/bsplib/tree.c similarity index 100% rename from common/bsplib/tree.c rename to xtools/bsplib/tree.c diff --git a/common/bsplib/winding.c b/xtools/bsplib/winding.c similarity index 100% rename from common/bsplib/winding.c rename to xtools/bsplib/winding.c diff --git a/common/bsplib/writebsp.c b/xtools/bsplib/writebsp.c similarity index 100% rename from common/bsplib/writebsp.c rename to xtools/bsplib/writebsp.c diff --git a/common/dpvencoder.c b/xtools/dpvencoder.c similarity index 91% rename from common/dpvencoder.c rename to xtools/dpvencoder.c index 19c77be8..d16ddacc 100644 --- a/common/dpvencoder.c +++ b/xtools/dpvencoder.c @@ -3,7 +3,7 @@ // dpvencoder.c - DP video encoder //======================================================================= -#include "platform.h" +#include "xtools.h" #include "utils.h" byte *dpvpool; diff --git a/common/mdllib.h b/xtools/mdllib.h similarity index 94% rename from common/mdllib.h rename to xtools/mdllib.h index cdc4a278..b8e11b55 100644 --- a/common/mdllib.h +++ b/xtools/mdllib.h @@ -5,7 +5,7 @@ #ifndef STUDIOMDL_H #define STUDIOMDL_H -#include "platform.h" +#include "xtools.h" #include "utils.h" #include "mathlib.h" diff --git a/common/ripper/conv_bsplumps.c b/xtools/ripper/conv_bsplumps.c similarity index 100% rename from common/ripper/conv_bsplumps.c rename to xtools/ripper/conv_bsplumps.c diff --git a/common/ripper/conv_doom.c b/xtools/ripper/conv_doom.c similarity index 100% rename from common/ripper/conv_doom.c rename to xtools/ripper/conv_doom.c diff --git a/common/ripper/conv_image.c b/xtools/ripper/conv_image.c similarity index 100% rename from common/ripper/conv_image.c rename to xtools/ripper/conv_image.c diff --git a/common/ripper/conv_main.c b/xtools/ripper/conv_main.c similarity index 100% rename from common/ripper/conv_main.c rename to xtools/ripper/conv_main.c diff --git a/common/ripper/conv_shader.c b/xtools/ripper/conv_shader.c similarity index 100% rename from common/ripper/conv_shader.c rename to xtools/ripper/conv_shader.c diff --git a/common/ripper/conv_sprite.c b/xtools/ripper/conv_sprite.c similarity index 100% rename from common/ripper/conv_sprite.c rename to xtools/ripper/conv_sprite.c diff --git a/common/ripper/ripper.h b/xtools/ripper/ripper.h similarity index 96% rename from common/ripper/ripper.h rename to xtools/ripper/ripper.h index d38bece9..52b70c63 100644 --- a/common/ripper/ripper.h +++ b/xtools/ripper/ripper.h @@ -5,7 +5,7 @@ #ifndef BASECONVERTOR_H #define BASECONVERTOR_H -#include "platform.h" +#include "xtools.h" extern stdlib_api_t com; extern byte *basepool; diff --git a/common/spritegen.c b/xtools/spritegen.c similarity index 95% rename from common/spritegen.c rename to xtools/spritegen.c index 2c246812..f0864cb1 100644 --- a/common/spritegen.c +++ b/xtools/spritegen.c @@ -3,7 +3,7 @@ // sprlib.c - sprite generator //======================================================================= -#include "platform.h" +#include "xtools.h" #include "byteorder.h" #include "utils.h" #include "mathlib.h" diff --git a/common/studio.c b/xtools/studio.c similarity index 100% rename from common/studio.c rename to xtools/studio.c diff --git a/common/studio_utils.c b/xtools/studio_utils.c similarity index 100% rename from common/studio_utils.c rename to xtools/studio_utils.c diff --git a/common/utils.c b/xtools/utils.c similarity index 95% rename from common/utils.c rename to xtools/utils.c index 8b698b72..772b857d 100644 --- a/common/utils.c +++ b/xtools/utils.c @@ -3,7 +3,7 @@ // utils.c - platform utils //======================================================================= -#include "platform.h" +#include "xtools.h" #include "byteorder.h" #include "utils.h" #include "bsplib.h" diff --git a/common/utils.h b/xtools/utils.h similarity index 100% rename from common/utils.h rename to xtools/utils.h diff --git a/common/wadlib.c b/xtools/wadlib.c similarity index 95% rename from common/wadlib.c rename to xtools/wadlib.c index d43ec2fe..0100af2b 100644 --- a/common/wadlib.c +++ b/xtools/wadlib.c @@ -3,7 +3,7 @@ // wadlib.c.c - wad archive compiler //======================================================================= -#include "platform.h" +#include "xtools.h" #include "byteorder.h" #include "const.h" #include "utils.h" diff --git a/common/platform.c b/xtools/xtools.c similarity index 95% rename from common/platform.c rename to xtools/xtools.c index 791ae83d..3529ce74 100644 --- a/common/platform.c +++ b/xtools/xtools.c @@ -3,7 +3,7 @@ // platform.c - tools common dll //======================================================================= -#include "platform.h" +#include "xtools.h" #include "utils.h" #include "bsplib.h" #include "mdllib.h" diff --git a/common/common.dsp b/xtools/xtools.dsp similarity index 77% rename from common/common.dsp rename to xtools/xtools.dsp index f1f38253..5950ff43 100644 --- a/common/common.dsp +++ b/xtools/xtools.dsp @@ -1,24 +1,24 @@ -# Microsoft Developer Studio Project File - Name="common" - Package Owner=<4> +# Microsoft Developer Studio Project File - Name="xtools" - Package Owner=<4> # Microsoft Developer Studio Generated Build File, Format Version 6.00 # ** DO NOT EDIT ** # TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102 -CFG=common - Win32 Debug +CFG=xtools - Win32 Debug !MESSAGE This is not a valid makefile. To build this project using NMAKE, !MESSAGE use the Export Makefile command and run !MESSAGE -!MESSAGE NMAKE /f "common.mak". +!MESSAGE NMAKE /f "xtools.mak". !MESSAGE !MESSAGE You can specify a configuration when running NMAKE !MESSAGE by defining the macro CFG on the command line. For example: !MESSAGE -!MESSAGE NMAKE /f "common.mak" CFG="common - Win32 Debug" +!MESSAGE NMAKE /f "xtools.mak" CFG="xtools - Win32 Debug" !MESSAGE !MESSAGE Possible choices for configuration are: !MESSAGE -!MESSAGE "common - Win32 Release" (based on "Win32 (x86) Dynamic-Link Library") -!MESSAGE "common - Win32 Debug" (based on "Win32 (x86) Dynamic-Link Library") +!MESSAGE "xtools - Win32 Release" (based on "Win32 (x86) Dynamic-Link Library") +!MESSAGE "xtools - Win32 Debug" (based on "Win32 (x86) Dynamic-Link Library") !MESSAGE # Begin Project @@ -29,7 +29,7 @@ CPP=cl.exe MTL=midl.exe RSC=rc.exe -!IF "$(CFG)" == "common - Win32 Release" +!IF "$(CFG)" == "xtools - Win32 Release" # PROP BASE Use_MFC 0 # PROP BASE Use_Debug_Libraries 0 @@ -38,12 +38,12 @@ RSC=rc.exe # PROP BASE Target_Dir "" # PROP Use_MFC 0 # PROP Use_Debug_Libraries 0 -# PROP Output_Dir "..\temp\common\!release" -# PROP Intermediate_Dir "..\temp\common\!release" +# PROP Output_Dir "..\temp\xtools\!release" +# PROP Intermediate_Dir "..\temp\xtools\!release" # PROP Ignore_Export_Lib 1 # PROP Target_Dir "" # ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "PLATFORM_EXPORTS" /YX /FD /c -# ADD CPP /nologo /MD /W3 /GX /O2 /I "./" /I "../public" /I "./bsplib/" /I "./ripper" /I "./common" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /FD /c +# ADD CPP /nologo /MD /W3 /GX /O2 /I "./" /I "../public" /I "bsplib" /I "ripper" /I "../common" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /FD /c # SUBTRACT CPP /YX # ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32 # ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32 @@ -57,16 +57,16 @@ LINK32=link.exe # ADD LINK32 msvcrt.lib /nologo /dll /pdb:none /machine:I386 /nodefaultlib:"libc.lib" /opt:nowin98 # SUBTRACT LINK32 /profile # Begin Custom Build -TargetDir=\Xash3D\src_main\temp\common\!release -InputPath=\Xash3D\src_main\temp\common\!release\common.dll +TargetDir=\Xash3D\src_main\temp\xtools\!release +InputPath=\Xash3D\src_main\temp\xtools\!release\xtools.dll SOURCE="$(InputPath)" -"D:\Xash3D\bin\common.dll" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)" - copy $(TargetDir)\common.dll "D:\Xash3D\bin\common.dll" +"D:\Xash3D\bin\xtools.dll" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)" + copy $(TargetDir)\xtools.dll "D:\Xash3D\bin\xtools.dll" # End Custom Build -!ELSEIF "$(CFG)" == "common - Win32 Debug" +!ELSEIF "$(CFG)" == "xtools - Win32 Debug" # PROP BASE Use_MFC 0 # PROP BASE Use_Debug_Libraries 1 @@ -75,12 +75,12 @@ SOURCE="$(InputPath)" # PROP BASE Target_Dir "" # PROP Use_MFC 0 # PROP Use_Debug_Libraries 1 -# PROP Output_Dir "..\temp\common\!debug" -# PROP Intermediate_Dir "..\temp\common\!debug" +# PROP Output_Dir "..\temp\xtools\!debug" +# PROP Intermediate_Dir "..\temp\xtools\!debug" # PROP Ignore_Export_Lib 1 # PROP Target_Dir "" # ADD BASE CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "PLATFORM_EXPORTS" /YX /FD /GZ /c -# ADD CPP /nologo /MDd /W3 /Gm /Gi /GX /ZI /Od /I "./" /I "../public" /I "./bsplib/" /I "./ripper" /I "./common" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /FR /FD /GZ /c +# ADD CPP /nologo /MDd /W3 /Gm /Gi /GX /ZI /Od /I "./" /I "../public" /I "bsplib" /I "ripper" /I "../common" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /FR /FD /GZ /c # SUBTRACT CPP /YX # ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32 # ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32 @@ -94,12 +94,12 @@ LINK32=link.exe # ADD LINK32 msvcrtd.lib user32.lib /nologo /dll /debug /machine:I386 /nodefaultlib:"libc.lib" /pdbtype:sept # SUBTRACT LINK32 /incremental:no /nodefaultlib # Begin Custom Build -TargetDir=\Xash3D\src_main\temp\common\!debug -InputPath=\Xash3D\src_main\temp\common\!debug\common.dll +TargetDir=\Xash3D\src_main\temp\xtools\!debug +InputPath=\Xash3D\src_main\temp\xtools\!debug\xtools.dll SOURCE="$(InputPath)" -"D:\Xash3D\bin\common.dll" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)" - copy $(TargetDir)\common.dll "D:\Xash3D\bin\common.dll" +"D:\Xash3D\bin\xtools.dll" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)" + copy $(TargetDir)\xtools.dll "D:\Xash3D\bin\xtools.dll" # End Custom Build @@ -107,8 +107,8 @@ SOURCE="$(InputPath)" # Begin Target -# Name "common - Win32 Release" -# Name "common - Win32 Debug" +# Name "xtools - Win32 Release" +# Name "xtools - Win32 Debug" # Begin Group "Source Files" # PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat" @@ -186,10 +186,6 @@ SOURCE=.\bsplib\patches.c # End Source File # Begin Source File -SOURCE=.\platform.c -# End Source File -# Begin Source File - SOURCE=.\bsplib\portals.c # End Source File # Begin Source File @@ -252,6 +248,10 @@ SOURCE=.\bsplib\winding.c SOURCE=.\bsplib\writebsp.c # End Source File +# Begin Source File + +SOURCE=.\xtools.c +# End Source File # End Group # Begin Group "Header Files" @@ -266,16 +266,16 @@ SOURCE=.\mdllib.h # End Source File # Begin Source File -SOURCE=.\platform.h -# End Source File -# Begin Source File - SOURCE=.\ripper\ripper.h # End Source File # Begin Source File SOURCE=.\utils.h # End Source File +# Begin Source File + +SOURCE=.\xtools.h +# End Source File # End Group # End Target # End Project diff --git a/common/platform.h b/xtools/xtools.h similarity index 86% rename from common/platform.h rename to xtools/xtools.h index a59db6cc..0bbd7494 100644 --- a/common/platform.h +++ b/xtools/xtools.h @@ -1,9 +1,9 @@ //======================================================================= // Copyright XashXT Group 2007 © -// platform.h - game platform dll +// xtools.h - Xash Game Tools //======================================================================= -#ifndef BASEPLATFORM_H -#define BASEPLATFORM_H +#ifndef XTOOLS_H +#define XTOOLS_H #include #include "launch_api.h" @@ -30,4 +30,4 @@ void AddMask( const char *mask ); extern string searchmask[]; extern int num_searchmask; -#endif//BASEPLATFORM_H \ No newline at end of file +#endif//XTOOLS_H \ No newline at end of file