diff --git a/common/dlight.h b/common/dlight.h deleted file mode 100644 index 4fbdb4df..00000000 --- a/common/dlight.h +++ /dev/null @@ -1,33 +0,0 @@ -/*** -* -* Copyright (c) 1996-2002, Valve LLC. All rights reserved. -* -* This product contains software technology licensed from Id -* Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc. -* All Rights Reserved. -* -* Use, distribution, and modification of this source code and/or resulting -* object code is restricted to non-commercial enhancements to products from -* Valve LLC. All other use, distribution, or modification is prohibited -* without written permission from Valve LLC. -* -****/ - -#ifndef DLIGHT_H -#define DLIGHT_H - -#include "const.h" - -typedef struct dlight_s -{ - vec3_t origin; - float radius; - color24 color; - float die; // stop lighting after this time - float decay; // drop this each second - float minlight; // don't add when contributing less - int key; - qboolean dark; // subtracts light instead of adding -} dlight_t; - -#endif//DLIGHT_H diff --git a/common/kbutton.h b/common/kbutton.h deleted file mode 100644 index 55015c3d..00000000 --- a/common/kbutton.h +++ /dev/null @@ -1,35 +0,0 @@ -/* -Copyright (C) 1996-1997 Id Software, Inc. - -This program is free software; you can redistribute it and/or -modify it under the terms of the GNU General Public License -as published by the Free Software Foundation; either version 2 -of the License, or (at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - -See the GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program; if not, write to the Free Software -Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - -*/ -#ifndef KBUTTON_H -#define KBUTTON_H - -// a1ba: copied from WinQuake/client.h -// -// cl_input -// -typedef struct -{ - int down[2]; // key nums holding it down - int state; // low bit is down state -} kbutton_t; - -STATIC_CHECK_SIZEOF( kbutton_t, 12, 12 ); - -#endif // KBUTTON_H diff --git a/common/q_client.h b/common/q_client.h new file mode 100644 index 00000000..678b09af --- /dev/null +++ b/common/q_client.h @@ -0,0 +1,82 @@ +/* +Copyright (C) 1997-2001 Id Software, Inc. + +This program is free software; you can redistribute it and/or +modify it under the terms of the GNU General Public License +as published by the Free Software Foundation; either version 2 +of the License, or (at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + +See the GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program; if not, write to the Free Software +Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + +*/ +// client.h -- primary header for client + +#ifndef QUAKE_CLIENT_H +#define QUAKE_CLIENT_H + +// Definitions originally taken from Quake, modified for binary compatibility + +typedef struct usercmd_s +{ + int16_t lerp_msec; // added in HL + int8_t msec; // added in QW + uint8_t pad1; + vec3_t viewangles; + + // intended velocities + float forwardmove; + float sidemove; + float upmove; + uint8_t lightlevel; + uint8_t pad2; + uint16_t buttons; // added in QW + uint8_t impulse; + + // added in HL + uint8_t weaponselect; + uint8_t pad3[2]; + + // unused HL impact stuff, left for modders + // TODO: document how to use them in delta encoding + int32_t reserved[4]; +} usercmd_t; + +STATIC_CHECK_SIZEOF( usercmd_t, 52, 52 ); + +typedef struct dlight_s +{ + vec3_t origin; + float radius; + struct + { + uint8_t r, g, b; + } color; + float die; // stop lighting after this time + float decay; // drop this each second + float minlight; // don't add when contributing less + int key; // so entities can reuse same entry + qboolean dark; // subtracts light instead of adding +} dlight_t; + +STATIC_CHECK_SIZEOF( dlight_t, 40, 40 ); + +// +// cl_input +// +typedef struct +{ + int down[2]; // key nums holding it down + int state; // low bit is down state +} kbutton_t; + +STATIC_CHECK_SIZEOF( kbutton_t, 12, 12 ); + +#endif // QUAKE_CLIENT_H diff --git a/common/r_efx.h b/common/r_efx.h index 2e37a201..798bccc2 100644 --- a/common/r_efx.h +++ b/common/r_efx.h @@ -26,11 +26,6 @@ #include "beamdef.h" #endif -// dlight_t -#if !defined ( DLIGHT_H ) -#include "dlight.h" -#endif - // cl_entity_t #if !defined( CL_ENTITY_H ) #include "cl_entity.h" @@ -115,6 +110,7 @@ typedef struct tempent_s } TEMPENTITY; typedef struct efx_api_s efx_api_t; +struct dlight_s; struct efx_api_s { @@ -182,8 +178,8 @@ struct efx_api_s BEAM *(*R_BeamLightning)( float *start, float *end, int modelIndex, float life, float width, float amplitude, float brightness, float speed ); BEAM *(*R_BeamPoints)( float *start, float *end, int modelIndex, float life, float width, float amplitude, float brightness, float speed, int startFrame, float framerate, float r, float g, float b ); BEAM *(*R_BeamRing)( int startEnt, int endEnt, int modelIndex, float life, float width, float amplitude, float brightness, float speed, int startFrame, float framerate, float r, float g, float b ); - dlight_t *(*CL_AllocDlight)( int key ); - dlight_t *(*CL_AllocElight)( int key ); + struct dlight_s *(*CL_AllocDlight)( int key ); + struct dlight_s *(*CL_AllocElight)( int key ); TEMPENTITY *(*CL_TempEntAlloc)( const float *org, struct model_s *model ); TEMPENTITY *(*CL_TempEntAllocNoModel)( const float *org ); TEMPENTITY *(*CL_TempEntAllocHigh)( const float *org, struct model_s *model ); diff --git a/common/render_api.h b/common/render_api.h index 13d93d64..9236bbde 100644 --- a/common/render_api.h +++ b/common/render_api.h @@ -18,7 +18,6 @@ GNU General Public License for more details. #include #include "lightstyle.h" -#include "dlight.h" #define CL_RENDER_INTERFACE_VERSION 37 // Xash3D 1.0 #define MAX_STUDIO_DECALS 4096 // + unused space of BSP decals @@ -176,6 +175,7 @@ enum movie_parms_e struct movie_state_s; struct ref_viewpass_s; +struct dlight_s; typedef struct render_api_s { @@ -184,8 +184,8 @@ typedef struct render_api_s void (*GetDetailScaleForTexture)( int texture, float *xScale, float *yScale ); void (*GetExtraParmsForTexture)( int texture, byte *red, byte *green, byte *blue, byte *alpha ); lightstyle_t* (*GetLightStyle)( int number ); - dlight_t* (*GetDynamicLight)( int number ); - dlight_t* (*GetEntityLight)( int number ); + struct dlight_s* (*GetDynamicLight)( int number ); + struct dlight_s* (*GetEntityLight)( int number ); byte (*LightToTexGamma)( byte color ); // software gamma support float (*GetFrameTime)( void ); diff --git a/common/usercmd.h b/common/usercmd.h deleted file mode 100644 index 0034576b..00000000 --- a/common/usercmd.h +++ /dev/null @@ -1,39 +0,0 @@ -/*** -* -* Copyright (c) 1996-2002, Valve LLC. All rights reserved. -* -* This product contains software technology licensed from Id -* Software, Inc. ("Id Technology"). Id Technology (c) 1996 Id Software, Inc. -* All Rights Reserved. -* -* Use, distribution, and modification of this source code and/or resulting -* object code is restricted to non-commercial enhancements to products from -* Valve LLC. All other use, distribution, or modification is prohibited -* without written permission from Valve LLC. -* -****/ - -#ifndef USERCMD_H -#define USERCMD_H - -typedef struct usercmd_s -{ - short lerp_msec; // Interpolation time on client - byte msec; // Duration in ms of command - vec3_t viewangles; // Command view angles - - // intended velocities - float forwardmove; // Forward velocity - float sidemove; // Sideways velocity - float upmove; // Upward velocity - byte lightlevel; // Light level at spot where we are standing. - unsigned short buttons; // Attack and move buttons - byte impulse; // Impulse command issued - byte weaponselect; // Current weapon id - - // Experimental player impact stuff. - int impact_index; - vec3_t impact_position; -} usercmd_t; - -#endif//USERCMD_H diff --git a/engine/client/cl_frame.c b/engine/client/cl_frame.c index b0b66ad1..68a4d9cd 100644 --- a/engine/client/cl_frame.c +++ b/engine/client/cl_frame.c @@ -20,7 +20,6 @@ GNU General Public License for more details. #include "pm_local.h" #include "cl_tent.h" #include "studio.h" -#include "dlight.h" #include "sound.h" #include "input.h" diff --git a/engine/client/cl_main.c b/engine/client/cl_main.c index d2c36895..4a332261 100644 --- a/engine/client/cl_main.c +++ b/engine/client/cl_main.c @@ -18,7 +18,6 @@ GNU General Public License for more details. #include "net_encode.h" #include "cl_tent.h" #include "input.h" -#include "kbutton.h" #include "vgui_draw.h" #include "library.h" #include "vid_common.h" diff --git a/engine/client/cl_netgraph.c b/engine/client/cl_netgraph.c index 74c6ce58..b71db468 100644 --- a/engine/client/cl_netgraph.c +++ b/engine/client/cl_netgraph.c @@ -15,7 +15,6 @@ GNU General Public License for more details. #include "common.h" #include "client.h" -#include "kbutton.h" #if XASH_LOW_MEMORY == 0 #define NET_TIMINGS 1024 diff --git a/engine/client/cl_tent.h b/engine/client/cl_tent.h index 53a7e2b1..17a46b95 100644 --- a/engine/client/cl_tent.h +++ b/engine/client/cl_tent.h @@ -78,8 +78,8 @@ void R_FireField( float *org, int radius, int modelIndex, int count, int flags, void R_PlayerSprites( int client, int modelIndex, int count, int size ); void R_Sprite_WallPuff( struct tempent_s *pTemp, float scale ); void R_RicochetSound( const vec3_t pos ); -struct dlight_s *CL_AllocDlight( int key ); -struct dlight_s *CL_AllocElight( int key ); +dlight_t *CL_AllocDlight( int key ); +dlight_t *CL_AllocElight( int key ); void CL_AddEntityEffects( cl_entity_t *ent ); void CL_AddModelEffects( cl_entity_t *ent ); void CL_DecalShoot( int textureIndex, int entityIndex, int modelIndex, float *pos, int flags ); diff --git a/engine/client/client.h b/engine/client/client.h index 58d235b0..94e80c66 100644 --- a/engine/client/client.h +++ b/engine/client/client.h @@ -34,6 +34,7 @@ GNU General Public License for more details. #include "world.h" #include "ref_common.h" #include "voice.h" +#include "q_client.h" // client sprite types #define SPR_CLIENT 0 // client sprite for temp-entities or user-textures diff --git a/engine/client/input.h b/engine/client/input.h index 1668fdfc..4cf83b4c 100644 --- a/engine/client/input.h +++ b/engine/client/input.h @@ -25,7 +25,6 @@ INPUT */ #include "keydefs.h" -#include "usercmd.h" // // input.c diff --git a/engine/common/con_utils.c b/engine/common/con_utils.c index d9bf23b9..db9c56e9 100644 --- a/engine/common/con_utils.c +++ b/engine/common/con_utils.c @@ -16,7 +16,6 @@ GNU General Public License for more details. #include "common.h" #include "client.h" #include "const.h" -#include "kbutton.h" #define CON_MAXCMDS 4096 // auto-complete intermediate list diff --git a/engine/common/net_encode.c b/engine/common/net_encode.c index 08524238..3df08961 100644 --- a/engine/common/net_encode.c +++ b/engine/common/net_encode.c @@ -18,7 +18,6 @@ GNU General Public License for more details. #include "xash3d_mathlib.h" #include "net_encode.h" #include "event_api.h" -#include "usercmd.h" #include "pm_movevars.h" #include "entity_state.h" #include "weaponinfo.h" @@ -40,8 +39,10 @@ GNU General Public License for more details. #define DT_SIGNED_GS BIT( 31 ) // GoldSrc-specific sign modificator // helper macroses +#define UCMD_DEF_( name, x ) #name, offsetof( usercmd_t, x ), sizeof( ((usercmd_t *)0)->x ) + #define ENTS_DEF( x ) #x, offsetof( entity_state_t, x ), sizeof( ((entity_state_t *)0)->x ) -#define UCMD_DEF( x ) #x, offsetof( usercmd_t, x ), sizeof( ((usercmd_t *)0)->x ) +#define UCMD_DEF( x ) UCMD_DEF_( x, x ) #define EVNT_DEF( x ) #x, offsetof( event_args_t, x ), sizeof( ((event_args_t *)0)->x ) #define PHYS_DEF( x ) #x, offsetof( movevars_t, x ), sizeof( ((movevars_t *)0)->x ) #define CLDT_DEF( x ) #x, offsetof( clientdata_t, x ), sizeof( ((clientdata_t *)0)->x ) @@ -53,22 +54,22 @@ static qboolean delta_init = false; // list of all the struct names static const delta_field_t cmd_fields[] = { -{ UCMD_DEF( lerp_msec ) }, -{ UCMD_DEF( msec ) }, -{ UCMD_DEF( viewangles[0] ) }, -{ UCMD_DEF( viewangles[1] ) }, -{ UCMD_DEF( viewangles[2] ) }, -{ UCMD_DEF( forwardmove ) }, -{ UCMD_DEF( sidemove ) }, -{ UCMD_DEF( upmove ) }, -{ UCMD_DEF( lightlevel ) }, -{ UCMD_DEF( buttons ) }, -{ UCMD_DEF( impulse ) }, -{ UCMD_DEF( weaponselect ) }, -{ UCMD_DEF( impact_index ) }, -{ UCMD_DEF( impact_position[0] ) }, -{ UCMD_DEF( impact_position[1] ) }, -{ UCMD_DEF( impact_position[2] ) }, +{ UCMD_DEF( lerp_msec ) }, +{ UCMD_DEF( msec ) }, +{ UCMD_DEF( viewangles[0] ) }, +{ UCMD_DEF( viewangles[1] ) }, +{ UCMD_DEF( viewangles[2] ) }, +{ UCMD_DEF( forwardmove ) }, +{ UCMD_DEF( sidemove ) }, +{ UCMD_DEF( upmove ) }, +{ UCMD_DEF( lightlevel ) }, +{ UCMD_DEF( buttons ) }, +{ UCMD_DEF( impulse ) }, +{ UCMD_DEF( weaponselect ) }, +{ UCMD_DEF_( impact_index, reserved[0] ) }, +{ UCMD_DEF_( impact_position[0], reserved[1] ) }, +{ UCMD_DEF_( impact_position[1], reserved[2] ) }, +{ UCMD_DEF_( impact_position[2], reserved[3] ) }, }; static const delta_field_t pm_fields[] = diff --git a/engine/ref_api.h b/engine/ref_api.h index 9ecbdbb8..da901761 100644 --- a/engine/ref_api.h +++ b/engine/ref_api.h @@ -29,6 +29,7 @@ GNU General Public License for more details. #include "filesystem.h" #include "common/protocol.h" #include "cvardef.h" +#include "q_client.h" // RefAPI changelog: // 1. Initial release @@ -399,7 +400,7 @@ typedef struct ref_api_s void (*CL_ThinkParticle)( double frametime, particle_t *p ); void (*R_FreeDeadParticles)( particle_t **ppparticles ); particle_t *(*CL_AllocParticleFast)( void ); // unconditionally give new particle pointer from cl_free_particles - struct dlight_s *(*CL_AllocElight)( int key ); + dlight_t *(*CL_AllocElight)( int key ); struct model_s *(*GetDefaultSprite)( enum ref_defaultsprite_e spr ); void (*R_StoreEfrags)( struct efrag_s **ppefrag, int framecount );// store efrags for static entities diff --git a/pm_shared/pm_defs.h b/pm_shared/pm_defs.h index 6d17ca00..8c89e044 100644 --- a/pm_shared/pm_defs.h +++ b/pm_shared/pm_defs.h @@ -36,9 +36,6 @@ // PM_PlayerTrace results. #include "pmtrace.h" - -#include "usercmd.h" - // physent_t typedef struct physent_s {