mirror of
https://github.com/FWGS/xash3d-fwgs.git
synced 2026-08-05 03:24:56 +08:00
common: use Quake derived definitions for usercmd_t and dlight_t
This commit is contained in:
@@ -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
|
||||
@@ -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
|
||||
82
common/q_client.h
Normal file
82
common/q_client.h
Normal file
@@ -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
|
||||
@@ -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 );
|
||||
|
||||
@@ -18,7 +18,6 @@ GNU General Public License for more details.
|
||||
|
||||
#include <stdint.h>
|
||||
#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 );
|
||||
|
||||
|
||||
@@ -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
|
||||
@@ -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"
|
||||
|
||||
|
||||
@@ -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"
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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 );
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -25,7 +25,6 @@ INPUT
|
||||
*/
|
||||
|
||||
#include "keydefs.h"
|
||||
#include "usercmd.h"
|
||||
|
||||
//
|
||||
// input.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
|
||||
|
||||
|
||||
@@ -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[] =
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
@@ -36,9 +36,6 @@
|
||||
// PM_PlayerTrace results.
|
||||
#include "pmtrace.h"
|
||||
|
||||
|
||||
#include "usercmd.h"
|
||||
|
||||
// physent_t
|
||||
typedef struct physent_s
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user