27 Oct 2010

This commit is contained in:
g-cont 2010-10-27 00:00:00 +04:00 committed by Alibek Omarov
parent 404d084524
commit ee357123b1
210 changed files with 8098 additions and 2793 deletions

View File

@ -1,6 +1,7 @@
build ????
Engine: support for StartupVids.txt
Engine: get full compatibility with hl.dll
build 1338

View File

@ -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 /W3 /GX /O2 /I "./" /I "../common" /I "global" /I "hud" /I "../game_shared" /I "../dlls" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /FD /c
# ADD CPP /nologo /W3 /GX /O2 /I "./" /I "../common" /I "global" /I "hud" /I "../game_shared" /I "../dlls" /I "../engine" /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 /GX /ZI /Od /I "./" /I "../common" /I "global" /I "hud" /I "../game_shared" /I "../dlls" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /FR /FD /c
# ADD CPP /nologo /MDd /W3 /Gm /GX /ZI /Od /I "./" /I "../common" /I "global" /I "hud" /I "../game_shared" /I "../dlls" /I "../engine" /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

View File

@ -667,15 +667,15 @@ ParticleType *ParticleSystem::ParseType( char *&szFile )
}
else if ( !stricmp( szToken, "special" ) || !stricmp( szToken, "special1" ) )
{
pType->m_iDrawCond = CONTENT_SPECIAL1;
pType->m_iDrawCond = -20;
}
else if ( !stricmp( szToken, "special2" ) )
{
pType->m_iDrawCond = CONTENT_SPECIAL2;
pType->m_iDrawCond = -21;
}
else if ( !stricmp( szToken, "special3" ) )
{
pType->m_iDrawCond = CONTENT_SPECIAL3;
pType->m_iDrawCond = -22;
}
}
else if ( !stricmp( szToken, "collision" ) )
@ -741,7 +741,7 @@ bool ParticleSystem::UpdateSystem( float frametime )
if( !source ) return false;
// Don't update if the system is outside the player's PVS.
enable = (source->curstate.renderfx == kRenderFxAurora);
enable = (source->curstate.renderfx == 21);
// check for contents to remove
if( POINT_CONTENTS( source->origin ) == m_iKillCondition )
@ -847,7 +847,7 @@ bool ParticleSystem::UpdateParticle( particle *part, float frametime )
{
if( m_iEntAttachment )
{
Vector pos = source->origin + source->attachment_origin[m_iEntAttachment - 1];
Vector pos = source->origin + source->attachment[m_iEntAttachment - 1];
part->velocity = (pos - part->origin) / frametime;
part->origin = pos;

View File

@ -86,7 +86,7 @@ public:
ParticleType( char *szFilename );
bool m_bIsDefined; // is this ParticleType just a placeholder?
kRenderMode_t m_iRenderMode;
int m_iRenderMode;
int m_iDrawCond;
int m_iCollision;
RandomRange m_Bounce;

View File

@ -162,8 +162,8 @@ void TE_ParseExplosion( void )
dl = gEngfuncs.pEfxAPI->CL_AllocDLight( 0 );
dl->origin = pos2;
dl->radius = 200;
dl->color[0] = dl->color[1] = 250;
dl->color[2] = 150;
dl->color.r = dl->color.g = 250;
dl->color.b = 150;
dl->die = GetClientTime() + 0.01f;
dl->decay = 800;
@ -171,9 +171,9 @@ void TE_ParseExplosion( void )
dl = gEngfuncs.pEfxAPI->CL_AllocDLight( 0 );
dl->origin = pos2;
dl->radius = 150;
dl->color[0] = 255;
dl->color[1]= 190;
dl->color[2] = 40;
dl->color.r = 255;
dl->color.g= 190;
dl->color.b = 40;
dl->die = GetClientTime() + 1.0f;
dl->decay = 200;
}
@ -395,6 +395,7 @@ void TE_ParseExplosion2( void )
dl = gEngfuncs.pEfxAPI->CL_AllocDLight( 0 );
dl->origin = pos;
dl->radius = 350;
dl->color.r = dl->color.g = dl->color.b = 255;
dl->die = GetClientTime() + 0.5f;
dl->decay = 300;
@ -689,9 +690,9 @@ void TE_ParseDynamicLight( int type )
dl->origin = pos;
dl->radius = radius;
dl->decay = decay;
dl->color[0] = r;
dl->color[1] = g;
dl->color[2] = b;
dl->color.r = r;
dl->color.g = g;
dl->color.b = b;
dl->die = GetClientTime() + life;
}

View File

@ -6,6 +6,7 @@
#include "extdll.h"
#include "utils.h"
#include "ev_hldm.h"
#include "event_args.h"
#include "r_tempents.h"
#include "pm_defs.h"
#include "hud.h"
@ -260,9 +261,9 @@ void EV_UpadteFlashlight( cl_entity_t *pEnt )
dl->origin = vecPos;
dl->die = GetClientTime() + 0.001f; // die on next frame
dl->color[0] = 255;
dl->color[1] = 255;
dl->color[2] = 255;
dl->color.r = 255;
dl->color.g = 255;
dl->color.b = 255;
dl->radius = 96;
}

View File

@ -14,6 +14,7 @@
#include "pm_shared.h"
#include "pm_defs.h"
#include "ev_hldm.h"
#include "event_args.h"
#include "hud.h"

View File

@ -205,10 +205,10 @@ int EV_IsLocal( int idx );
int EV_IsPlayer( int idx );
void EV_MuzzleFlash( void );
void EV_UpdateBeams ( void );
void EV_GetGunPosition( event_args_t *args, float *pos, float *origin );
void EV_GetGunPosition( struct event_args_s *args, float *pos, float *origin );
void EV_CreateTracer( float *start, float *end );
void EV_EjectBrass( float *origin, float *velocity, float rotation, int model, int soundtype );
void EV_GetDefaultShellInfo( event_args_t *args, float *origin, float *velocity, float *ShellVelocity, float *ShellOrigin, float *forward, float *right, float *up, float forwardScale, float upScale, float rightScale );
void EV_GetDefaultShellInfo( struct event_args_s *args, float *origin, float *velocity, float *ShellVelocity, float *ShellOrigin, float *forward, float *right, float *up, float forwardScale, float upScale, float rightScale );
void EV_UpadteFlashlight( cl_entity_t *pEnt );
// misc pm stuff

View File

@ -60,7 +60,7 @@ static bool ComputeBeamEntPosition( cl_entity_t *pEnt, int nAttachment, Vector&
// get attachment
if( nAttachment > 0 )
pt = pEnt->origin + pEnt->attachment_origin[nAttachment - 1];
pt = pEnt->origin + pEnt->attachment[nAttachment - 1];
else pt = pEnt->origin;
return true;
@ -79,7 +79,7 @@ static void ComputeBeamPerpendicular( const Vector &vecBeamDelta, Vector *pPerp
// ------------------------------------------------------------------------------------------ //
// CBeamSegDraw implementation.
// ------------------------------------------------------------------------------------------ //
void CBeamSegDraw::Start( int nSegs, HSPRITE m_hSprite, kRenderMode_t nRenderMode, int frame )
void CBeamSegDraw::Start( int nSegs, HSPRITE m_hSprite, int nRenderMode, int frame )
{
m_nSegsDrawn = 0;
m_nTotalSegs = nSegs;
@ -1886,7 +1886,7 @@ void DrawSegs( int noise_divisions, float *prgNoise, int modelIndex, float frame
// Specify all the segments.
CBeamSegDraw segDraw;
segDraw.Start( segments, m_hSprite, (kRenderMode_t)rendermode, frame );
segDraw.Start( segments, m_hSprite, rendermode, frame );
for ( i = 0; i < segments; i++ )
{
@ -2028,7 +2028,7 @@ void DrawDisk( int noise_divisions, float *prgNoise, int modelIndex, float frame
w = freq * delta[2];
gEngfuncs.pTriAPI->Enable( TRI_SHADER );
gEngfuncs.pTriAPI->RenderMode( (kRenderMode_t)rendermode );
gEngfuncs.pTriAPI->RenderMode( rendermode );
gEngfuncs.pTriAPI->Bind( m_hSprite, 0 ); // GetSpriteTexture already set frame
gEngfuncs.pTriAPI->Begin( TRI_TRIANGLE_STRIP );
@ -2114,7 +2114,7 @@ void DrawCylinder( int noise_divisions, float *prgNoise, int modelIndex, float f
gEngfuncs.pTriAPI->Enable( TRI_SHADER );
gEngfuncs.pTriAPI->CullFace( TRI_NONE );
gEngfuncs.pTriAPI->RenderMode( (kRenderMode_t)rendermode );
gEngfuncs.pTriAPI->RenderMode( rendermode );
gEngfuncs.pTriAPI->Bind( m_hSprite, 0 ); // GetSpriteTexture already set frame
gEngfuncs.pTriAPI->Begin( TRI_TRIANGLE_STRIP );
@ -2232,7 +2232,7 @@ void DrawRing( int noise_divisions, float *prgNoise, void (*pfnNoise)( float *no
j = segments / 8;
gEngfuncs.pTriAPI->Enable( TRI_SHADER );
gEngfuncs.pTriAPI->RenderMode( (kRenderMode_t)rendermode );
gEngfuncs.pTriAPI->RenderMode( rendermode );
gEngfuncs.pTriAPI->Bind( m_hSprite, 0 ); // GetSpriteTexture already set frame
gEngfuncs.pTriAPI->Begin( TRI_TRIANGLE_STRIP );
@ -2359,7 +2359,7 @@ void DrawBeamFollow( int modelIndex, BeamTrail_t* pHead, int frame, int rendermo
nColor[2] = (byte)bound( 0, (int)(scaledColor[2] * 255.0f), 255 );
gEngfuncs.pTriAPI->Enable( TRI_SHADER );
gEngfuncs.pTriAPI->RenderMode( (kRenderMode_t)rendermode );
gEngfuncs.pTriAPI->RenderMode( rendermode );
gEngfuncs.pTriAPI->Bind( m_hSprite, 0 ); // GetSpriteTexture already set frame
gEngfuncs.pTriAPI->Begin( TRI_QUADS );

View File

@ -202,7 +202,7 @@ class CBeamSegDraw
{
public:
// pass null for pMaterial if you have already set the material you want.
void Start( int nSegs, HSPRITE m_hSprite, kRenderMode_t nRenderMode, int frame = 0 );
void Start( int nSegs, HSPRITE m_hSprite, int nRenderMode, int frame = 0 );
void NextSeg( CBeamSeg *pSeg );
void End();
private:

View File

@ -16,7 +16,7 @@
// particle velocities
static const float r_avertexnormals[NUMVERTEXNORMALS][3] =
{
#include "anorms.h"
#include "../engine/anorms.h"
};
// particle ramps

View File

@ -196,7 +196,7 @@ int CTempEnts::TE_Update( TEMPENTITY *pTemp, float frametime )
pTemp->entity.origin = pClient->origin;
if( pTemp->entity.baseline.body > 0 )
pTemp->entity.origin += pClient->attachment_origin[pTemp->entity.baseline.body - 1];
pTemp->entity.origin += pClient->attachment[pTemp->entity.baseline.body - 1];
}
}
else if( pTemp->flags & FTENT_SINEWAVE )
@ -383,9 +383,9 @@ int CTempEnts::TE_Update( TEMPENTITY *pTemp, float frametime )
dl->origin = pTemp->entity.origin;
dl->radius = 60;
dl->color[0] = 255;
dl->color[1]= 120;
dl->color[2] = 0;
dl->color.r = 255;
dl->color.g = 120;
dl->color.b = 0;
dl->die = GetClientTime() + 0.01f;
}
@ -1106,7 +1106,7 @@ void CTempEnts::MuzzleFlash( cl_entity_t *pEnt, int iAttachment, int type )
frameCount = Mod_GetFrames( modelIndex );
if( iAttachment > 0 && pEnt->attachment_origin[iAttachment - 1] == g_vecZero )
if( iAttachment > 0 && pEnt->attachment[iAttachment - 1] == g_vecZero )
{
gEngfuncs.Con_Printf( "Invalid muzzleflash entity!\n" );
return;
@ -1669,7 +1669,7 @@ void CTempEnts::WeaponFlash( cl_entity_t *pEnt, int iAttachment )
Vector pos = pEnt->origin;
if( iAttachment > 0 )
pos += pEnt->attachment_origin[iAttachment - 1];
pos += pEnt->attachment[iAttachment - 1];
if( pos == pEnt->origin ) return; // missing attachment
AllocDLight( pos, 255, 180, 64, 100, 0.05f );
@ -1709,9 +1709,9 @@ void CTempEnts::AllocDLight( Vector pos, byte r, byte g, byte b, float radius, f
dl->origin = pos;
dl->die = GetClientTime() + time;
dl->color[0] = r;
dl->color[1] = g;
dl->color[2] = b;
dl->color.r = r;
dl->color.g = g;
dl->color.b = b;
dl->radius = radius;
dl->decay = decay;
}

View File

@ -93,18 +93,18 @@ void HUD_StudioEvent( const mstudioevent_t *event, cl_entity_t *entity )
break;
case 5002:
// SparkEffect at attachment 1
pos = entity->curstate.origin + entity->attachment_origin[0];
pos = entity->curstate.origin + entity->attachment[0];
g_pTempEnts->SparkEffect( pos, 8, -200, 200 );
break;
case 5004:
// Client side sound
pos = entity->origin + entity->attachment_origin[0];
pos = entity->origin + entity->attachment[0];
gEngfuncs.pEventAPI->EV_PlaySound( 0, pos, CHAN_AUTO, event->options, VOL_NORM, ATTN_NORM, 0, PITCH_NORM );
break;
case 5005:
// Client side sound with random pitch (most useful for reload sounds)
pitch = 85 + RANDOM_LONG( 0, 0x1F );
pos = entity->origin + entity->attachment_origin[0];
pos = entity->origin + entity->attachment[0];
fvol = RANDOM_FLOAT( 0.7f, 0.9f );
gEngfuncs.pEventAPI->EV_PlaySound( 0, pos, CHAN_AUTO, event->options, fvol, ATTN_NORM, 0, pitch );
break;

View File

@ -117,7 +117,7 @@ typedef struct dllfunction_s
// ScreenWidth returns the width of the screen, in pixels
#define ScreenWidth (gHUD.m_scrinfo.iWidth)
inline void UnpackRGB( int &r, int &g, int &b, dword ulRGB )
inline void UnpackRGB( int &r, int &g, int &b, unsigned long ulRGB )
{
r = (ulRGB & 0xFF0000) >>16;\
g = (ulRGB & 0xFF00) >> 8;\

View File

@ -583,12 +583,14 @@ cl_entity_t *V_FindIntermisionSpot( ref_params_t *pparams )
for( int i = 0; i < pparams->num_entities; i++ )
{
ent = GetEntityByIndex( i );
#if 0
if( ent && !stricmp( ent->curstate.classname, "info_intermission" ))
{
if( j > 15 ) break; // spotlist is full
spotindex[j] = ent->index; // save entindex
j++;
}
#endif
}
// ok, we have list of intermission spots

View File

@ -167,7 +167,7 @@ typedef struct cl_enginefuncs_s
void (*pfnPlaySoundByNameAtLocation)( char *szSound, float volume, float *origin );
word (*pfnPrecacheEvent)( int type, const char* psz );
void (*pfnPlaybackEvent)( int flags, const struct cl_entity_s *pInvoker, word eventindex, float delay, float *origin, float *angles, float fparam1, float fparam2, int iparam1, int iparam2, int bparam1, int bparam2 );
void (*pfnPlaybackEvent)( int flags, const struct edict_s *pInvoker, word eventindex, float delay, float *origin, float *angles, float fparam1, float fparam2, int iparam1, int iparam2, int bparam1, int bparam2 );
void (*pfnWeaponAnim)( int iAnim, int body );
float (*pfnRandomFloat)( float flLow, float flHigh );
long (*pfnRandomLong)( long lLow, long lHigh );

View File

@ -1,22 +1,26 @@
//=======================================================================
// Copyright XashXT Group 2008 ©
// cl_entity.h - cient entity
//=======================================================================
/***
*
* 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 CL_ENTITY_H
#define CL_ENTITY_H
#include "entity_state.h"
#define HISTORY_MAX 64 // Must be power of 2
#define HISTORY_MASK ( HISTORY_MAX - 1 )
typedef struct cl_entity_s cl_entity_t;
typedef struct efrag_s
{
struct mleaf_s *leaf;
struct efrag_s *leafnext;
cl_entity_t *entity;
struct cl_entity_s *entity;
struct efrag_s *entnext;
} efrag_t;
@ -31,15 +35,15 @@ typedef struct
{
float prevanimtime;
float sequencetime;
byte prevseqblending[16];//MAXSTUDIOBLENDINGS
byte prevseqblending[2];
vec3_t prevorigin;
vec3_t prevangles;
int prevsequence;
float prevframe;
byte prevcontroller[16];
byte prevblending[16];
byte prevcontroller[4];
byte prevblending[2];
} latchedvars_t;
typedef struct
@ -49,10 +53,17 @@ typedef struct
vec3_t angles;
} position_history_t;
typedef struct cl_entity_s cl_entity_t;
#define HISTORY_MAX 64 // Must be power of 2
#define HISTORY_MASK ( HISTORY_MAX - 1 )
#include "entity_state.h"
struct cl_entity_s
{
int index; // Index into cl_entities ( always match actual slot )
int player; // True if this entity is a "player"
qboolean player; // True if this entity is a "player"
entity_state_t baseline; // The original state from which to delta during an uncompressed message
entity_state_t prevstate; // The state information from the penultimate message received from the server
@ -72,25 +83,27 @@ struct cl_entity_s
vec3_t origin;
vec3_t angles;
// Calculated on client-side
vec3_t absmin;
vec3_t absmax;
// Attachment points
vec3_t attachment_origin[16];
vec3_t attachment_angles[16];
vec3_t attachment[4];
// Other entity local information
int trivial_accept;
struct model_s *model; // cl.model_precache[ curstate.modelindes ]; all visible entities have a model
struct efrag_s *efrag; // linked list of efrags
struct mnode_s *topnode; // for bmodels, first world node that splits bmodel, or NULL if not split
float syncbase; // for client-side animations -- used by obsolete alias animation system, remove?
int visframe; // last frame this entity was found in an active leaf
colorVec cvFloorColor;
// INCOMPATIBLE!!!
vec3_t absmin, absmax;
// Attachment points
vec3_t attachment_angles[4];
float m_flPrevEventFrame; // previous event frame
int m_iEventSequence; // current event sequence
cl_entity_t *onground; // Entity standing on
struct model_s *model; // all visible entities have a model
struct efrag_s *efrag; // linked list of efrags
struct mnode_s *topnode; // for bmodels, first world node that splits bmodel,
// or NULL if not split
link_t area; // linked to a division node or leaf
};

View File

@ -111,7 +111,7 @@ typedef struct mnode_s
struct mnode_s *children[2];
msurface_t *firstface; // used for grab lighting info, decals etc
uint numfaces;
unsigned int numfaces;
} mnode_t;
typedef struct model_s

View File

@ -1,7 +1,17 @@
//=======================================================================
// Copyright XashXT Group 2010 ©
// con_nprint.h - print into console notify
//=======================================================================
/***
*
* 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 CON_NPRINT_H
#define CON_NPRINT_H

View File

@ -1,10 +1,19 @@
//=======================================================================
// Copyright XashXT Group 2007 ©
// const.h - engine constants
//=======================================================================
/***
*
* 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 CONST_H
#define CONST_H
//
// Constants shared by the engine and dlls
// This header file included by engine files and DLL files.
@ -41,8 +50,6 @@
#define FL_ONTRAIN (1<<24) // Player is _controlling_ a train, so movement commands should be ignored on client during prediction.
#define FL_WORLDBRUSH (1<<25) // Not moveable/removeable brush entity (really part of the world, but represented as an entity for transparency or something)
#define FL_SPECTATOR (1<<26) // This client is a spectator, don't run touch functions, etc.
#define FL_CHECK_PHS (1<<27) // This entity requested phs bitvector instead of pvsbitvector in AddToFullPack calls
#define FL_PLAYERCLIP (1<<28) // Only collide in with clients who have FL_PLAYERCLIP set
#define FL_CUSTOMENTITY (1<<29) // This is a custom entity
#define FL_KILLME (1<<30) // This entity is marked for death -- This allows the engine to kill ents at the appropriate time
#define FL_DORMANT (1<<31) // Entity is dormant, no updates to client
@ -58,7 +65,7 @@
// edict->movetype values
#define MOVETYPE_NONE 0 // never moves
#define MOVETYPE_COMPOUND 1 // Xash3D extension: glue two entities together (simple movewith)
//#define MOVETYPE_ANGLENOCLIP 1
//#define MOVETYPE_ANGLECLIP 2
#define MOVETYPE_WALK 3 // Player only - moving on the ground
#define MOVETYPE_STEP 4 // gravity, special edge handling -- monsters use this
@ -71,6 +78,7 @@
#define MOVETYPE_BOUNCEMISSILE 11 // bounce w/o gravity
#define MOVETYPE_FOLLOW 12 // track movement of aiment
#define MOVETYPE_PUSHSTEP 13 // BSP model that needs physics/world collisions (uses nearest hull for world collision)
#define MOVETYPE_COMPOUND 14 // glue two entities together (simple movewith)
// edict->solid values
// NOTE: Some movetypes will cause collisions independent of SOLID_NOT/SOLID_TRIGGER when the entity moves
@ -85,38 +93,39 @@
#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_RESPAWNABLE 3
#define DEAD_DISCARDBODY 4
#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
// entity effects
#define EF_BRIGHTFIELD (1<<0) // swirling cloud of particles
#define EF_MUZZLEFLASH (1<<1) // single frame ELIGHT on entity attachment 0
#define EF_BRIGHTLIGHT (1<<2) // DLIGHT centered at entity origin
#define EF_DIMLIGHT (1<<3) // player flashlight
#define EF_INVLIGHT (1<<4) // get lighting from ceiling
#define EF_NOINTERP (1<<5) // don't interpolate the next frame
#define EF_LIGHT (1<<6) // rocket flare glow sprite
#define EF_NODRAW (1<<7) // don't draw entity
#define EF_NOREFLECT (1<<8) // entity won't reflecting in mirrors
#define EF_REFLECTONLY (1<<9) // entity will be drawing only in mirrors
#define EF_NOWATERCSG (1<<10) // do not remove sides for func_water entity
#define EF_MINLIGHT (1<<11) // allways have some light (e.g. viewentity)
#define EF_FULLBRIGHT (1<<12) // just get fullbright
#define EF_NOSHADOW (1<<13) // ignore shadow for this entity
#define EF_MERGE_VISIBILITY (1<<14) // this entity allowed to merge vis (e.g. env_sky or portal camera)
#define EF_BRIGHTFIELD 1 // swirling cloud of particles
#define EF_MUZZLEFLASH 2 // single frame ELIGHT on entity attachment 0
#define EF_BRIGHTLIGHT 4 // DLIGHT centered at entity origin
#define EF_DIMLIGHT 8 // player flashlight
#define EF_INVLIGHT 16 // get lighting from ceiling
#define EF_NOINTERP 32 // don't interpolate the next frame
#define EF_LIGHT 64 // rocket flare glow sprite
#define EF_NODRAW 128 // don't draw entity
#define EF_NOREFLECT 256 // Entity won't reflecting in mirrors
#define EF_REFLECTONLY 512 // Entity will be drawing only in mirrors
#define EF_NOWATERCSG 1024 // Do not remove sides for func_water entity
#define EF_MINLIGHT 2048 // Allways have some light (e.g. viewentity)
#define EF_FULLBRIGHT 4096 // Just get fullbright
#define EF_NOSHADOW 8192 // ignore shadow for this entity
#define EF_MERGE_VISIBILITY 16384 // this entity allowed to merge vis (e.g. env_sky or portal camera)
#define EF_REQUEST_PHS 32768 // This entity requested phs bitvector instead of pvsbitvector in AddToFullPack calls
// user-specified entity effects
#define EF_LASERSPOT (1<<16) // tempentity laserspot at attachment #1 from player or npc
#define EF_LASERSPOT 65536 // tempentity laserspot at attachment #1 from player or npc
// entity flags
#define EFLAG_SLERP 1 // do studio interpolation of this entity
//
// temp entity events (engine ignore it)
// temp entity events
//
#define TE_BEAMPOINTS 0 // beam effect between two points
// coord coord coord (start position)
@ -339,9 +348,9 @@
#define TE_TEXTMESSAGE 29
// short 1.2.13 x (-1 = center)
// short 1.2.13 y (-1 = center)
// byte Effect 0 = fade in/fade out
// 1 = flickery credits
// 2 = write out (training room)
// byte Effect 0 = fade in/fade out
// 1 is flickery credits
// 2 is write out (training room)
// 4 bytes r,g,b,a color1 (text color)
// 4 bytes r,g,b,a color2 (effect color)
// ushort 8.8 fadein time
@ -580,6 +589,7 @@
#define CONTENTS_SLIME -4
#define CONTENTS_LAVA -5
#define CONTENTS_SKY -6
// These additional contents constants are defined in bspfile.h
#define CONTENTS_ORIGIN -7 // removed at csg time
#define CONTENTS_CLIP -8 // changed to contents_solid
#define CONTENTS_CURRENT_0 -9
@ -589,15 +599,13 @@
#define CONTENTS_CURRENT_UP -13
#define CONTENTS_CURRENT_DOWN -14
#define CONTENTS_TRANSLUCENT -15
#define CONTENTS_LADDER -16
#define CONTENT_FLYFIELD -17
#define CONTENT_GRAVITY_FLYFIELD -18
#define CONTENT_FOG -19
#define CONTENT_SPECIAL1 -20
#define CONTENT_SPECIAL2 -21
#define CONTENT_SPECIAL3 -22
// same as CONTENTS_*
#define CONTENT_EMPTY -1
#define CONTENT_SOLID -2
#define CONTENT_WATER -3
@ -613,12 +621,14 @@
#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_NETWORKVOICE_BASE 7 // voice data coming across the network
#define CHAN_NETWORKVOICE_END 500 // network voice data reserves slots (CHAN_NETWORKVOICE_BASE through CHAN_NETWORKVOICE_END).
// attenuation values
#define ATTN_NONE 0.0f
#define ATTN_NORM 0.8f
#define ATTN_IDLE 2.0f
#define ATTN_STATIC 1.25f
#define ATTN_NONE 0
#define ATTN_NORM (float)0.8
#define ATTN_IDLE (float)2
#define ATTN_STATIC (float)1.25
// pitch values
#define PITCH_NORM 100 // non-pitch shifted
@ -626,7 +636,15 @@
#define PITCH_HIGH 120
// volume values
#define VOL_NORM 1.0f
#define VOL_NORM 1.0
// plats
#define PLAT_LOW_TRIGGER 1
// Trains
#define SF_TRAIN_WAIT_RETRIGGER 1
#define SF_TRAIN_START_ON 4 // Train is initially moving
#define SF_TRAIN_PASSABLE 8 // Train is not solid -- used to make water trains
// buttons
#define IN_ATTACK (1<<0)
@ -673,7 +691,7 @@
#define TE_BOUNCE_SHOTSHELL 2
// Rendering constants
typedef enum
enum
{
kRenderNormal, // src
kRenderTransColor, // c*a+dest*(1-a)
@ -682,7 +700,7 @@ typedef enum
kRenderTransAlpha, // src*srca+dest*(1-srca)
kRenderTransAdd, // src*a+dest
kRenderTransInverse // src*(1-a)+dest*a
} kRenderMode_t;
};
enum
{
@ -707,29 +725,52 @@ enum
kRenderFxExplode, // Scale up really big!
kRenderFxGlowShell, // Glowing Shell
kRenderFxClampMinScale, // Keep this sprite from getting very small (SPRITES only!)
kRenderFxAurora, // set particle trail for this entity
};
// shared typedefs
typedef int func_t;
typedef int string_t;
typedef unsigned char byte;
typedef unsigned short word;
typedef unsigned long dword;
typedef unsigned int uint;
typedef float vec_t;
typedef int string_t;
typedef struct edict_s edict_t;
#undef true
#undef false
#ifndef __cplusplus
typedef enum { false, true } qboolean;
#else
typedef int qboolean;
#endif
typedef struct
{
byte r, g, b;
} color24;
// link_t is only used for entity area links now
typedef struct
{
unsigned r, g, b, a;
} colorVec;
#ifdef _WIN32
#pragma pack( push, 2 )
#endif
typedef struct
{
unsigned short r, g, b, a;
} PackedColorVec;
#ifdef _WIN32
#pragma pack( pop )
#endif
typedef struct link_s
{
struct link_s *prev;
struct link_s *next;
struct link_s *prev, *next;
} link_t;
typedef struct edict_s edict_t;
#endif//CONST_H

View File

@ -1,76 +0,0 @@
//=======================================================================
// Copyright XashXT Group 2010 ©
// custom.h - create custom user recources
//=======================================================================
#ifndef CUSTOM_H
#define CUSTOM_H
#include "const.h"
/////////////////
// Customization
// passed to pfnPlayerCustomization
// For automatic downloading.
typedef enum
{
t_sound = 0,
t_skin,
t_model,
t_decal,
t_generic,
t_eventscript,
t_world, // fake type for world, is really t_model
} resourcetype_t;
typedef struct
{
int size;
} _resourceinfo_t;
typedef struct resourceinfo_s
{
_resourceinfo_t info[8];
} resourceinfo_t;
#define RES_FATALIFMISSING (1<<0) // Disconnect if we can't get this file.
#define RES_WASMISSING (1<<1) // Do we have the file locally, did we get it ok?
#define RES_CUSTOM (1<<2) // Is this resource one that corresponds to another player's customization
// or is it a server startup resource.
#define RES_REQUESTED (1<<3) // Already requested a download of this one
#define RES_PRECACHED (1<<4) // Already precached
typedef struct resource_s
{
char szFileName[64]; // file name to download/precache.
resourcetype_t type; // t_sound, t_skin, t_model, t_decal.
int nIndex; // for t_decals
int nDownloadSize; // size in bytes if this must be downloaded.
byte ucFlags;
// for handling client to client resource propagation
byte rgucMD5_hash[16]; // to determine if we already have it.
byte playernum; // which player index this resource is associated with,
// if it's a custom resource.
byte rguc_reserved[32]; // for future expansion
struct resource_s *pNext; // Next in chain.
struct resource_s *pPrev;
} resource_t;
typedef struct custom_s
{
BOOL bInUse; // is this customization in use;
resource_t resource; // the resource_t for this customization
BOOL bTranslated; // has the raw data been translated into a useable format?
// (e.g., raw decal .wad make into texture_t *)
int nUserData1; // sustomization specific data
int nUserData2; // customization specific data
void *pInfo; // buffer that holds the data structure that references
// the data (e.g., the cachewad_t)
void *pBuffer; // buffer that holds the data for the customization
// (the raw .wad data)
struct customization_s *pNext; // next in chain
} customization_t;
#endif // CUSTOM_H

View File

@ -1,26 +0,0 @@
//=======================================================================
// Copyright XashXT Group 2010 ©
// customentity.h - beam encode specific
//=======================================================================
#ifndef CUSTOMENTITY_H
#define CUSTOMENTITY_H
// beam types, encoded as a byte
enum
{
BEAM_POINTS = 0,
BEAM_ENTPOINT,
BEAM_ENTS,
BEAM_HOSE,
};
#define BEAM_FSINE 0x10
#define BEAM_FSOLID 0x20
#define BEAM_FSHADEIN 0x40
#define BEAM_FSHADEOUT 0x80
// Start/End Entity is encoded as 12 bits of entity index, and 4 bits of attachment (4:12)
#define BEAMENT_ENTITY( x ) ((x) & 0xFFF)
#define BEAMENT_ATTACHMENT( x ) (((x)>>12) & 0xF)
#endif//CUSTOMENTITY_H

View File

@ -1,27 +1,30 @@
//=======================================================================
// Copyright XashXT Group 2008 ©
// cvardef.h - pointer to console variable
//=======================================================================
/***
*
* 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 CVARDEF_H
#define CVARDEF_H
// cvar flags
#define FCVAR_ARCHIVE (1<<0) // set to cause it to be saved to config.cfg
#define FCVAR_ARCHIVE (1<<0) // set to cause it to be saved to vars.rc
#define FCVAR_USERINFO (1<<1) // changes the client's info string
#define FCVAR_SERVER (1<<2) // changes the serevrinfo string, notifies players when changed
#define FCVAR_SERVER (1<<2) // notifies players when changed
#define FCVAR_EXTDLL (1<<3) // defined by external DLL
#define FCVAR_CLIENTDLL (1<<4) // defined by the client dll
#define FCVAR_PROTECTED (1<<5) // It's a server cvar, but we don't send the data since it's a password, etc.
#define FCVAR_PROTECTED (1<<5) // It's a server cvar, but we don't send the data since it's a password, etc. Sends 1 if it's not bland/zero, 0 otherwise as value
#define FCVAR_SPONLY (1<<6) // This cvar cannot be changed by clients connected to a multiplayer server.
#define FCVAR_PRINTABLEONLY (1<<7) // This cvar's string cannot contain unprintable characters ( player name )
#define FCVAR_UNLOGGED (1<<8) // If this is a FCVAR_SERVER, don't log changes to the log file / console
#define FCVAR_PRINTABLEONLY (1<<7) // This cvar's string cannot contain unprintable characters ( e.g., used for player name etc ).
#define FCVAR_UNLOGGED (1<<8) // If this is a FCVAR_SERVER, don't log changes to the log file / console if we are creating a log
/*
========================================================================
console variables
external and internal cvars struct have some differences
========================================================================
*/
typedef struct cvar_s
{
char *name;

27
common/demo_api.h Normal file
View File

@ -0,0 +1,27 @@
/***
*
* 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 DEMO_API_H
#define DEMO_API_H
typedef struct demo_api_s
{
int (*IsRecording)( void );
int (*IsPlayingback)( void );
int (*IsTimeDemo)( void );
void (*WriteBuffer)( int size, unsigned char *buffer );
} demo_api_t;
#endif//DEMO_API_H

View File

@ -1,7 +1,18 @@
//=======================================================================
// Copyright XashXT Group 2010 ©
// dlight.h - dynamic light declaration
//=======================================================================
/***
*
* 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
@ -9,13 +20,13 @@ typedef struct dlight_s
{
vec3_t origin;
float radius;
byte color[3];
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;
int dark; // subtracts light instead of adding
int elight; // true when calls with CL_AllocElight
qboolean dark; // subtracts light instead of adding
qboolean elight; // true when calls with CL_AllocElight
} dlight_t;
#endif//DLIGHT_H

View File

@ -1,31 +0,0 @@
//=======================================================================
// Copyright XashXT Group 2010 ©
// edict.h - server edicts
//=======================================================================
#ifndef EDICT_H
#define EDICT_H
#include "progdefs.h"
#define MAX_ENT_LEAFS 48
struct edict_s
{
int free; // unused entity when true
int serialnumber; // must match with entity num
link_t area; // linked to a division node or leaf
int headnode; // -1 to use normal leaf check
int num_leafs;
short leafnums[MAX_ENT_LEAFS];
float freetime; // sv.time when the object was freed
void *pvPrivateData; // alloced and freed by engine, used by DLLs
entvars_t v; // C exported fields from progs
// other fields from progs come immediately after
};
#endif//EDICT_H

View File

@ -1,396 +0,0 @@
//=======================================================================
// Copyright XashXT Group 2008 ©
// eiface.h - interface between engine and dlls
//=======================================================================
#ifndef EIFACE_H
#define EIFACE_H
#include "cvardef.h"
#include "custom.h"
#define DLLEXPORT __stdcall
#define INTERFACE_VERSION 140 // GetEntityAPI, GetEntityAPI2
#define NEW_DLL_FUNCTIONS_VERSION 2 // GetNewDLLFunctions (Xash3D uses version 2)
typedef unsigned long CRC32_t;
// filter console messages
typedef enum
{
at_notice,
at_console, // format: [msg]
at_aiconsole, // same as at_console, but only shown if developer level is 2!
at_warning, // format: Warning: [msg]
at_error, // format: Error: [msg]
at_logged // server print to console ( only in multiplayer games ). (NOT IMPLEMENTED)
} ALERT_TYPE;
// filter client messages
typedef enum
{
print_console, // dev. console messages
print_center, // at center of the screen
print_chat, // level high
} PRINT_TYPE;
// for integrity checking of content on clients
typedef enum
{
force_exactfile, // file on client must exactly match server's file
force_model_samebounds, // for model files only, the geometry must fit in the same bbox
force_model_specifybounds, // for model files only, the geometry must fit in the specified bbox
force_model_specifybounds_if_avail, // for model files only, the geometry must fit in the specified bbox (if the file is available)
} FORCE_TYPE;
typedef struct
{
int fAllSolid; // if true, plane is not valid
int fStartSolid; // if true, the initial point was in a solid area
int fInOpen; // if true trace is open
int fInWater; // if true trace is in water
float flFraction; // time completed, 1.0 = didn't hit anything
vec3_t vecEndPos; // final position
float flPlaneDist; // planes distance
vec3_t vecPlaneNormal; // surface normal at impact
edict_t *pHit; // entity the surface is on
int iHitgroup; // 0 == generic, non zero is specific body part
} TraceResult;
// engine hands this to DLLs for functionality callbacks
typedef struct enginefuncs_s
{
int (*pfnPrecacheModel)( const char* s );
int (*pfnPrecacheSound)( const char* s );
void (*pfnSetModel)( edict_t *e, const char *m );
int (*pfnModelIndex)( const char *m );
int (*pfnModelFrames)( int modelIndex );
void (*pfnSetSize)( edict_t *e, const float *rgflMin, const float *rgflMax );
void (*pfnChangeLevel)( const char* s1, const char* s2 );
edict_t* (*pfnFindClientInPHS)( edict_t *pEdict ); // was pfnGetSpawnParms
edict_t* (*pfnEntitiesInPHS)( edict_t *pplayer ); // was pfnSaveSpawnParms
float (*pfnVecToYaw)( const float *rgflVector );
void (*pfnVecToAngles)( const float *rgflVectorIn, float *rgflVectorOut );
void (*pfnMoveToOrigin)( edict_t *ent, const float *pflGoal, float dist, int iMoveType );
void (*pfnChangeYaw)( edict_t* ent );
void (*pfnChangePitch)( edict_t* ent );
edict_t* (*pfnFindEntityByString)( edict_t *pEdictStartSearchAfter, const char *pszField, const char *pszValue );
int (*pfnGetEntityIllum)( edict_t* pEnt );
edict_t* (*pfnFindEntityInSphere)( edict_t *pEdictStartSearchAfter, const float *org, float rad );
edict_t* (*pfnFindClientInPVS)( edict_t *pEdict );
edict_t* (*pfnEntitiesInPVS)( edict_t *pplayer );
void (*pfnMakeVectors)( const float *rgflVector );
void (*pfnAngleVectors)( const float *rgflVector, float *forward, float *right, float *up );
edict_t* (*pfnCreateEntity)( void );
void (*pfnRemoveEntity)( edict_t* e );
edict_t* (*pfnCreateNamedEntity)( string_t className );
void (*pfnMakeStatic)( edict_t *ent );
int (*pfnEntIsOnFloor)( 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 );
void (*pfnEmitSound)( edict_t *ent, int chan, const char *sample, float vol, float attn, int flags, int pitch );
void (*pfnEmitAmbientSound)( edict_t *ent, float *pos, const char *samp, float vol, float attn, int flags, int pitch );
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 );
int (*pfnTraceMonsterHull)( edict_t *pEdict, const float *v1, const float *v2, int fNoMonsters, edict_t *pentToSkip, TraceResult *ptr );
void (*pfnTraceHull)( const float *v1, const float *v2, int fNoMonsters, int hullNumber, edict_t *pentToSkip, TraceResult *ptr );
void (*pfnTraceModel)( const float *v1, const float *v2, int hullNumber, edict_t *pent, TraceResult *ptr );
const char *(*pfnTraceTexture)( edict_t *pTextureEntity, const float *v1, const float *v2 );
int (*pfnBoxVisible)( const float *mins, const float *maxs, const byte *pset ); // was pfnTraceSphere
void (*pfnGetAimVector)( edict_t* ent, float speed, float *rgflReturn );
void (*pfnServerCommand)( const char* str );
void (*pfnServerExecute)( void );
void (*pfnClientCommand)( edict_t* pEdict, char* szFmt, ... );
void (*pfnParticleEffect)( const float *org, const float *dir, float color, float count );
void (*pfnLightStyle)( int style, const char* val );
int (*pfnDecalIndex)( const char *name );
int (*pfnPointContents)( const float *rgflVector );
void (*pfnMessageBegin)( int msg_dest, int msg_type, const float *pOrigin, edict_t *ed );
void (*pfnMessageEnd)( void );
void (*pfnWriteByte)( int iValue );
void (*pfnWriteChar)( int iValue );
void (*pfnWriteShort)( int iValue );
void (*pfnWriteLong)( int iValue );
void (*pfnWriteAngle)( float flValue );
void (*pfnWriteCoord)( float flValue );
void (*pfnWriteString)( const char *sz );
void (*pfnWriteEntity)( int iValue );
void (*pfnCVarRegister)( cvar_t *pCvar );
float (*pfnCVarGetFloat)( const char *szVarName );
char* (*pfnCVarGetString)( const char *szVarName );
void (*pfnCVarSetFloat)( const char *szVarName, float flValue );
void (*pfnCVarSetString)( const char *szVarName, const char *szValue );
void (*pfnAlertMessage)( ALERT_TYPE level, char *szFmt, ... );
void (*pfnDropClient)( int clientIndex );
void* (*pfnPvAllocEntPrivateData)( edict_t *pEdict, long cb );
void* (*pfnPvEntPrivateData)( edict_t *pEdict );
void (*pfnFreeEntPrivateData)( edict_t *pEdict );
const char *(*pfnSzFromIndex)( string_t iString );
string_t (*pfnAllocString)( const char *szValue );
entvars_t *(*pfnGetVarsOfEnt)( edict_t *pEdict );
edict_t* (*pfnPEntityOfEntOffset)( int iEntOffset );
int (*pfnEntOffsetOfPEntity)( const edict_t *pEdict );
int (*pfnIndexOfEdict)( const edict_t *pEdict );
edict_t* (*pfnPEntityOfEntIndex)( int iEntIndex );
edict_t* (*pfnFindEntityByVars)( entvars_t* pvars );
void* (*pfnGetModelPtr)( edict_t* pEdict );
int (*pfnRegUserMsg)( const char *pszName, int iSize );
void (*pfnAnimationAutomove)( const edict_t* pEdict, float flTime );
void (*pfnGetBonePosition)( const edict_t* pEdict, int iBone, float *rgflOrigin, float *rgflAngles );
dword (*pfnFunctionFromName)( const char *pName );
const char *(*pfnNameForFunction)( dword function );
void (*pfnClientPrintf)( edict_t* pEdict, PRINT_TYPE ptype, const char *szMsg );
void (*pfnServerPrint)( const char *szMsg );
const char *(*pfnCmd_Args)( void );
const char *(*pfnCmd_Argv)( int argc );
int (*pfnCmd_Argc)( void );
void (*pfnGetAttachment)( const edict_t *pEdict, int iAttachment, float *rgflOrigin, float *rgflAngles );
void (*pfnCRC32_Init)( CRC32_t *pulCRC );
void (*pfnCRC32_ProcessBuffer)( CRC32_t *pulCRC, void *p, int len );
void (*pfnCRC32_ProcessByte)( CRC32_t *pulCRC, byte ch );
CRC32_t (*pfnCRC32_Final)( CRC32_t pulCRC );
long (*pfnRandomLong)( long lLow, long lHigh );
float (*pfnRandomFloat)( float flLow, float flHigh );
void (*pfnSetView)( const edict_t *pClient, const edict_t *pViewent );
float (*pfnTime)( void ); // host.realtime, not sv.time
void (*pfnCrosshairAngle)( const edict_t *pClient, float pitch, float yaw );
byte* (*pfnLoadFileForMe)( const char *filename, int *pLength );
void (*pfnFreeFile)( void *buffer );
void (*pfnEndSection)( const char *pszSectionName );
int (*pfnCompareFileTime)( const char *filename1, const char *filename2, int *iCompare );
void (*pfnGetGameDir)( char *szGetGameDir );
void (*pfnCvar_RegisterVariable)( cvar_t *variable );
void (*pfnFadeClientVolume)( const edict_t *pEdict, int fadePercent, int fadeOutSeconds, int holdTime, int fadeInSeconds );
void (*pfnSetClientMaxspeed)( const edict_t *pEdict, float fNewMaxspeed );
edict_t *(*pfnCreateFakeClient)( const char *netname ); // returns NULL if fake client can't be created
void (*pfnRunPlayerMove)( edict_t *fakeclient, const float *viewangles, float forwardmove, float sidemove, float upmove, word buttons, byte impulse, byte msec );
int (*pfnNumberOfEntities)( void );
char* (*pfnGetInfoKeyBuffer)( edict_t *e ); // passing in NULL gets the serverinfo
char* (*pfnInfoKeyValue)( char *infobuffer, char *key );
void (*pfnSetKeyValue)( char *infobuffer, char *key, char *value );
void (*pfnSetClientKeyValue)( int clientIndex, char *infobuffer, char *key, char *value );
int (*pfnIsMapValid)( char *filename );
void (*pfnStaticDecal)( const float *origin, int decalIndex, int entityIndex, int modelIndex );
int (*pfnPrecacheGeneric)( const char* s );
int (*pfnGetPlayerUserId)(edict_t *e ); // returns the server assigned userid for this player. useful for logging frags, etc.
void (*pfnBuildSoundMsg)( edict_t *pSource, int chan, const char *samp, float fvol, float attn, int fFlags, int pitch, int msg_dest, int msg_type, const float *pOrigin, edict_t *pSend );
int (*pfnIsDedicatedServer)( void ); // is this a dedicated server?
cvar_t *(*pfnCVarGetPointer)( const char *szVarName );
uint (*pfnGetPlayerWONId)( edict_t *e ); // returns the server assigned WONid for this player. useful for logging frags, etc. returns -1 if the edict couldn't be found in the list of clients
void (*pfnInfo_RemoveKey)( char *s, char *key );
const char *(*pfnGetPhysicsKeyValue)( const edict_t *pClient, const char *key );
void (*pfnSetPhysicsKeyValue)( const edict_t *pClient, const char *key, const char *value );
const char *(*pfnGetPhysicsInfoString)( const edict_t *pClient );
word (*pfnPrecacheEvent)( int type, const char *psz );
void (*pfnPlaybackEvent)( int flags, const edict_t *pInvoker, word eventindex, float delay, float *origin, float *angles, float fparam1, float fparam2, int iparam1, int iparam2, int bparam1, int bparam2 );
byte *(*pfnSetFatPVS)( const float *org );
byte *(*pfnSetFatPAS)( const float *org );
int (*pfnCheckVisibility)( const edict_t *entity, byte *pset );
void (*pfnDeltaSetField) ( struct delta_s *pFields, const char *fieldname );
void (*pfnDeltaUnsetField)( struct delta_s *pFields, const char *fieldname );
void (*pfnDeltaAddEncoder)( char *name, void (*conditionalencode)( struct delta_s *pFields, const byte *from, const byte *to ));
int (*pfnGetCurrentPlayer)( void );
int (*pfnCanSkipPlayer)( const edict_t *player );
int (*pfnDeltaFindField)( struct delta_s *pFields, const char *fieldname );
void (*pfnDeltaSetFieldByIndex)( struct delta_s *pFields, int fieldNumber );
void (*pfnDeltaUnsetFieldByIndex)( struct delta_s *pFields, int fieldNumber );
void (*pfnSetGroupMask)( int mask, int op );
int (*pfnCreateInstancedBaseline)( int classname, struct entity_state_s *baseline );
void (*pfnCvar_DirectSet)( cvar_t *var, char *value );
void (*pfnForceUnmodified)( FORCE_TYPE type, float *mins, float *maxs, const char *filename );
void (*pfnGetPlayerStats)( const edict_t *pClient, int *ping, int *packet_loss );
void (*pfnAddServerCommand)( const char *cmd_name, void (*function)(void));
int (*pfnVoice_GetClientListening)( int iReceiver, int iSender );
int (*pfnVoice_SetClientListening)( int iReceiver, int iSender, int bListen );
const char *(*pfnGetPlayerAuthId)( edict_t *e );
// ONLY ADD NEW FUNCTIONS TO THE END OF THIS STRUCT. INTERFACE VERSION IS FROZEN AT 138
} enginefuncs_t;
// passed to pfnKeyValue
typedef struct KeyValueData_s
{
char *szClassName; // in: entity classname
char *szKeyName; // in: name of key
char *szValue; // in: value of key
long fHandled; // out: DLL sets to true if key-value pair was understood
} KeyValueData;
typedef struct
{
char mapName[32];
char landmarkName[32];
edict_t *pentLandmark;
vec3_t vecLandmarkOrigin;
} LEVELLIST;
typedef struct
{
int id; // ordinal ID of this entity (used for entity <--> pointer conversions)
edict_t *pent; // pointer to the in-game entity
int location; // offset from the base data of this entity
int size; // byte size of this entity's data
int flags; // bit mask of transitions that this entity is in the PVS of
string_t classname; // entity class name
} ENTITYTABLE;
#define FTYPEDESC_GLOBAL 0x0001 // This field is masked for global entity save/restore
#define MAX_LEVEL_CONNECTIONS 16 // These are encoded in the lower 16bits of ENTITYTABLE->flags
#define FENTTABLE_GLOBAL 0x10000000
#define FENTTABLE_MOVEABLE 0x20000000
#define FENTTABLE_REMOVED 0x40000000
#define FENTTABLE_PLAYER 0x80000000
typedef struct saverestore_s
{
char *pBaseData; // start of all entity save data
char *pCurrentData; // current buffer pointer for sequential access
int size; // current data size
int bufferSize; // total space for data (Valve used 512 kb's)
int tokenSize; // always equal 0 (probably not used)
int tokenCount; // number of elements in the pTokens table (Valve used 4096 tokens)
char **pTokens; // hash table of entity strings (sparse)
int currentIndex; // holds a global entity table ID
int tableCount; // number of elements in the entity table (numEntities)
int connectionCount; // number of elements in the levelList[]
ENTITYTABLE *pTable; // array of ENTITYTABLE elements (1 for each entity)
LEVELLIST levelList[MAX_LEVEL_CONNECTIONS]; // list of connections from this level
// smooth transition
int fUseLandmark;
char szLandmarkName[20]; // landmark we'll spawn near in next level
vec3_t vecLandmarkOffset; // for landmark transitions
float time; // current sv.time
char szCurrentMapName[32];// To check global entities
} SAVERESTOREDATA;
typedef enum _fieldtypes
{
FIELD_FLOAT = 0, // any floating point value
FIELD_STRING, // a string ID (return from ALLOC_STRING)
FIELD_ENTITY, // an entity offset (EOFFSET)
FIELD_CLASSPTR, // CBaseEntity *
FIELD_EHANDLE, // entity handle
FIELD_EVARS, // EVARS *
FIELD_EDICT, // edict_t *, or edict_t * (same thing)
FIELD_VECTOR, // any vector
FIELD_POSITION_VECTOR, // a world coordinate (these are fixed up across level transitions automagically)
FIELD_POINTER, // arbitrary data pointer... to be removed, use an array of FIELD_CHARACTER
FIELD_INTEGER, // any integer or enum
FIELD_FUNCTION, // a class function pointer (Think, Use, etc)
FIELD_BOOLEAN, // boolean, implemented as an int, I may use this as a hint for compression
FIELD_SHORT, // 2 byte integer
FIELD_CHARACTER, // a byte
FIELD_TIME, // a floating point time (these are fixed up automatically too!)
FIELD_MODELNAME, // engine string that is a model name (needs precache)
FIELD_SOUNDNAME, // engine string that is a sound name (needs precache)
FIELD_WEAPONTIME, // custom field for predicted and normal weapons
FIELD_TYPECOUNT, // MUST BE LAST
} FIELDTYPE;
typedef struct
{
FIELDTYPE fieldType;
char *fieldName;
int fieldOffset;
short fieldSize;
short flags;
} TYPEDESCRIPTION;
#define offsetof( s, m ) (size_t)&(((s *)0)->m)
#define ARRAYSIZE( p ) (sizeof( p ) / sizeof( p[0] ))
#define _FIELD( type, name, fieldtype, count, flags ) { fieldtype, #name, offsetof( type, name ), count, flags }
#define DEFINE_FIELD( type, name, fieldtype ) _FIELD( type, name, fieldtype, 1, 0 )
#define DEFINE_ARRAY( type, name, fieldtype, count ) _FIELD( type, name, fieldtype, count, 0 )
#define DEFINE_ENTITY_FIELD( name, fieldtype ) _FIELD( entvars_t, name, fieldtype, 1, 0 )
#define DEFINE_ENTITY_FIELD_ARRAY( name, fieldtype, count ) _FIELD( entvars_t, name, fieldtype, count, 0 )
#define DEFINE_ENTITY_GLOBAL_FIELD( name, fieldtype ) _FIELD( entvars_t, name, fieldtype, 1, FTYPEDESC_GLOBAL )
#define DEFINE_GLOBAL_FIELD( type, name, fieldtype ) _FIELD( type, name, fieldtype, 1, FTYPEDESC_GLOBAL )
typedef struct
{
// initialize/shutdown the game (one-time call after loading of game .dll )
void (*pfnGameInit)( void );
int (*pfnSpawn)( edict_t *pent );
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 (*pfnSave)( edict_t *pent, SAVERESTOREDATA *pSaveData );
int (*pfnRestore)( edict_t *pent, SAVERESTOREDATA *pSaveData, int globalEntity );
void (*pfnSetAbsBox)( edict_t *pent );
void (*pfnSaveWriteFields)( SAVERESTOREDATA*, const char*, void*, TYPEDESCRIPTION*, int );
void (*pfnSaveReadFields)( SAVERESTOREDATA*, const char*, void*, TYPEDESCRIPTION*, int );
void (*pfnSaveGlobalState)( SAVERESTOREDATA * );
void (*pfnRestoreGlobalState)( SAVERESTOREDATA * );
void (*pfnResetGlobalState)( void );
int (*pfnClientConnect)( edict_t *pEntity, const char *pszName, const char *pszAddress, char szRejectReason[128] );
void (*pfnClientDisconnect)( edict_t *pEntity );
void (*pfnClientKill)( edict_t *pEntity );
void (*pfnClientPutInServer)( edict_t *pEntity );
void (*pfnClientCommand)( edict_t *pEntity );
void (*pfnClientUserInfoChanged)( edict_t *pEntity, char *infobuffer );
void (*pfnServerActivate)( edict_t *pEdictList, int edictCount, int clientMax );
void (*pfnServerDeactivate)( void );
void (*pfnPlayerPreThink)( edict_t *pEntity );
void (*pfnPlayerPostThink)( edict_t *pEntity );
void (*pfnStartFrame)( void );
void (*pfnParmsNewLevel)( void );
void (*pfnParmsChangeLevel)( void );
// returns string describing current .dll. E.g., TeamFotrress 2, Half-Life
const char *(*pfnGetGameDescription)( void );
// Notify dll about a player customization.
void (*pfnPlayerCustomization)( edict_t *pEntity, customization_t *pCustom );
// Spectator funcs
void (*pfnSpectatorConnect)( edict_t *pEntity );
void (*pfnSpectatorDisconnect)( edict_t *pEntity );
void (*pfnSpectatorThink)( edict_t *pEntity );
// Notify game .dll that engine is going to shut down. Allows mod authors to set a breakpoint.
void (*pfnSys_Error)( const char *error_string );
void (*pfnPM_Move)( struct playermove_s *ppmove, int server );
void (*pfnPM_Init)( struct playermove_s *ppmove );
char (*pfnPM_FindTextureType)( char *name );
void (*pfnSetupVisibility)( edict_t *pViewEntity, edict_t *pClient, byte **pvs, byte **pas );
void (*pfnUpdateClientData)( const edict_t *ent, int sendweapons, struct clientdata_s *cd );
int (*pfnAddToFullPack)( struct entity_state_s *state, int e, edict_t *ent, edict_t *host, int hostflags, int player, byte *pSet );
void (*pfnCreateBaseline)( int player, int eindex, struct entity_state_s *baseline, edict_t *entity, int playermodelindex, vec3_t player_mins, vec3_t player_maxs );
void (*pfnRegisterEncoders)( void );
int (*pfnGetWeaponData)( edict_t *player, struct weapon_data_s *info );
void (*pfnCmdStart)( const edict_t *player, const struct usercmd_s *cmd, unsigned int random_seed );
void (*pfnCmdEnd)( const edict_t *player );
int (*pfnConnectionlessPacket)( const struct netadr_s *net_from, const char *args, char *response_buffer, int *response_buffer_size );
int (*pfnGetHullBounds)( int hullnumber, float *mins, float *maxs );
void (*pfnCreateInstancedBaselines)( void );
int (*pfnInconsistentFile)( const edict_t *player, const char *filename, char *disconnect_message );
int (*pfnAllowLagCompensation)( void );
} DLL_FUNCTIONS;
typedef struct
{
void (*pfnOnFreeEntPrivateData)( edict_t *pEnt ); // ñalled right before the object's memory is freed.
void (*pfnGameShutdown)( void );
int (*pfnShouldCollide)( edict_t *pentTouched, edict_t *pentOther );
int (*pfnCreate)( edict_t *pent, const char *szName ); // passed through pfnCreate (0 is attempt to create, -1 is reject)
int (*pfnPhysicsEntity)( edict_t *pEntity ); // run custom physics for each entity (return 0 to use engine physic)
} NEW_DLL_FUNCTIONS;
typedef int (*APIFUNCTION)( DLL_FUNCTIONS *pFunctionTable, int interfaceVersion );
typedef int (*APIFUNCTION2)( DLL_FUNCTIONS *pFunctionTable, int *interfaceVersion );
typedef int (*NEW_DLL_FUNCTIONS_FN)( NEW_DLL_FUNCTIONS *pFunctionTable, int *interfaceVersion );
#endif//EIFACE_H

View File

@ -1,27 +1,43 @@
//=======================================================================
// Copyright XashXT Group 2009 ©
// entity_state.h - a part of network protocol
//=======================================================================
/***
*
* 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 ENTITY_STATE_H
#define ENTITY_STATE_H
// for entityType below
// For entityType below
#define ENTITY_NORMAL (1<<0)
#define ENTITY_BEAM (1<<1)
typedef struct entity_state_s
// Entity state is used for the baseline and for delta compression of a packet of
// entities that is sent to a client.
typedef struct entity_state_s entity_state_t;
struct entity_state_s
{
// Fields which are filled in by routines outside of delta compression
int entityType; // hint for engine
int number; // edict index
// Fields which are filled in by routines outside of delta compression
int entityType;
// Index into cl_entities array for this entity.
int number;
float msg_time;
// Message number last time the player/entity state was updated.
int messagenum;
// Fields which can be transitted and reconstructed over the network stream
// Fields which can be transitted and reconstructed over the network stream
vec3_t origin;
vec3_t angles; // entity angles, not viewangles
vec3_t angles;
int modelindex;
int sequence;
float frame;
@ -51,33 +67,43 @@ typedef struct entity_state_s
vec3_t maxs;
int aiment;
int owner; // If owned by a player, the index of that player ( for projectiles )
float friction; // Friction, for prediction.
float gravity; // Gravity multiplier
// If owned by a player, the index of that player ( for projectiles ).
int owner;
// client specific
// Friction, for prediction.
float friction;
// Gravity multiplier
float gravity;
// PLAYER SPECIFIC
int team;
int playerclass;
int health;
int spectator;
qboolean spectator;
int weaponmodel;
int gaitsequence;
vec3_t basevelocity; // If standing on conveyor, e.g.
int usehull; // Use the crouched hull, or the regular player hull.
int oldbuttons; // Latched buttons last time state updated.
int onground; // -1 = in air, else pmove entity number
// If standing on conveyor, e.g.
vec3_t basevelocity;
// Use the crouched hull, or the regular player hull.
int usehull;
// Latched buttons last time state updated.
int oldbuttons;
// -1 = in air, else pmove entity number
int onground;
int iStepLeft;
float flFallVelocity; // How fast we are falling
// How fast we are falling
float flFallVelocity;
float fov;
int weaponanim;
// parametric movement overrides
// Parametric movement overrides
vec3_t startpos;
vec3_t endpos;
float impacttime;
float starttime;
// for mods
// For mods
int iuser1;
int iuser2;
int iuser3;
@ -90,13 +116,7 @@ typedef struct entity_state_s
vec3_t vuser2;
vec3_t vuser3;
vec3_t vuser4;
// xash shared strings
char classname[32];
char targetname[32];
char target[32];
char netname[32];
} entity_state_t;
};
#include "pm_info.h"
@ -138,7 +158,7 @@ typedef struct clientdata_s
int deadflag;
char physinfo[MAX_PHYSINFO_STRING];
// for mods
// For mods
int iuser1;
int iuser2;
int iuser3;
@ -160,7 +180,7 @@ typedef struct local_state_s
{
entity_state_t playerstate;
clientdata_t client;
weapon_data_t weapondata[32]; // store 32 weapons
weapon_data_t weapondata[32];
} local_state_t;
#endif//ENTITY_STATE_H

View File

@ -1,7 +1,18 @@
//=======================================================================
// Copyright XashXT Group 2010 ©
// entity_types.h - shared entity types
//=======================================================================
/***
*
* 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 ENTITY_TYPES_H
#define ENTITY_TYPES_H

View File

@ -1,57 +1,47 @@
//=======================================================================
// Copyright XashXT Group 2009 ©
// event_api.h - network event definition
//=======================================================================
/***
*
* 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 EVENT_API_H
#define EVENT_API_H
#define EVENT_API_VERSION 1
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;
typedef void (*pfnEventHook)( event_args_t *args );
typedef struct event_api_s
{
int version;
void (*EV_PlaySound)( int ent, float *org, int chan, const char *samp, float vol, float attn, int flags, int pitch );
void (*EV_StopSound)( int ent, int channel, const char *sample );
int (*EV_FindModelIndex)( const char *model );
int (*EV_IsLocal)( int playernum );
int (*EV_LocalPlayerDucking)( void );
void (*EV_LocalPlayerViewheight)( float *view_ofs );
void (*EV_LocalPlayerBounds)( int hull, float *mins, float *maxs );
int (*EV_IndexFromTrace)( struct pmtrace_s *pTrace );
struct physent_s *(*EV_GetPhysent)( int idx );
void (*EV_SetUpPlayerPrediction )( int dopred, int bIncludeLocalClient );
void (*EV_PushPMStates)( void );
void (*EV_PopPMStates)( void );
void (*EV_SetSolidPlayers)( int playernum );
void (*EV_SetTraceHull)( int hull );
void (*EV_PlayerTrace)( float *start, float *end, int traceFlags, int ignore_pe, struct pmtrace_s *tr );
void (*EV_WeaponAnimation)( int sequence, int body );
word (*EV_PrecacheEvent)( int type, const char* psz );
void (*EV_PlaybackEvent)( int flags, const struct cl_entity_s *pInvoker, word eventindex, float delay, float *origin, float *angles, float fparam1, float fparam2, int iparam1, int iparam2, int bparam1, int bparam2 );
const char *(*EV_TraceTexture)( int ground, float *vstart, float *vend );
void (*EV_StopAllSounds)( int ent, int entchannel );
void (*EV_KillEvents)( int entnum, const char *eventname );
void ( *EV_PlaySound )( int ent, float *origin, int channel, const char *sample, float volume, float attenuation, int fFlags, int pitch );
void ( *EV_StopSound )( int ent, int channel, const char *sample );
int ( *EV_FindModelIndex )( const char *pmodel );
int ( *EV_IsLocal )( int playernum );
int ( *EV_LocalPlayerDucking )( void );
void ( *EV_LocalPlayerViewheight )( float * );
void ( *EV_LocalPlayerBounds )( int hull, float *mins, float *maxs );
int ( *EV_IndexFromTrace)( struct pmtrace_s *pTrace );
struct physent_s *( *EV_GetPhysent )( int idx );
void ( *EV_SetUpPlayerPrediction )( int dopred, int bIncludeLocalClient );
void ( *EV_PushPMStates )( void );
void ( *EV_PopPMStates )( void );
void ( *EV_SetSolidPlayers )( int playernum );
void ( *EV_SetTraceHull )( int hull );
void ( *EV_PlayerTrace )( float *start, float *end, int traceFlags, int ignore_pe, struct pmtrace_s *tr );
void ( *EV_WeaponAnimation )( int sequence, int body );
unsigned short ( *EV_PrecacheEvent )( int type, const char* psz );
void ( *EV_PlaybackEvent )( int flags, const struct edict_s *pInvoker, unsigned short eventindex, float delay, float *origin, float *angles, float fparam1, float fparam2, int iparam1, int iparam2, int bparam1, int bparam2 );
const char *( *EV_TraceTexture )( int ground, float *vstart, float *vend );
void ( *EV_StopAllSounds )( int entnum, int entchannel );
void ( *EV_KillEvents )( int entnum, const char *eventname );
} event_api_t;
#endif//EVENT_API_H

47
common/event_args.h Normal file
View File

@ -0,0 +1,47 @@
/***
*
* 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 EVENT_ARGS_H
#define EVENT_ARGS_H
// Event was invoked with stated origin
#define FEVENT_ORIGIN ( 1<<0 )
// Event was invoked with stated angles
#define FEVENT_ANGLES ( 1<<1 )
typedef struct event_args_s
{
int flags;
// Transmitted
int entindex;
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_ARGS_H

View File

@ -1,7 +1,18 @@
//=======================================================================
// Copyright XashXT Group 2010 ©
// event_flags.h - common event flags
//=======================================================================
/***
*
* 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 EVENT_FLAGS_H
#define EVENT_FLAGS_H
@ -18,8 +29,8 @@
// 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
// 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)
// Only send to entity specified as the invoker

View File

@ -1,7 +1,18 @@
//=======================================================================
// Copyright XashXT Group 2010 ©
// hltv.h - all shared consts between server, clients and proxy
//=======================================================================
/***
*
* 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 HLTV_H
#define HLTV_H

38
common/ivoicetweak.h Normal file
View File

@ -0,0 +1,38 @@
/***
*
* 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 IVOICETWEAK_H
#define IVOICETWEAK_H
// These provide access to the voice controls.
typedef enum
{
MicrophoneVolume = 0, // values 0-1.
OtherSpeakerScale // values 0-1. Scales how loud other players are.
} VoiceTweakControl;
typedef struct IVoiceTweak_s
{
// These turn voice tweak mode on and off. While in voice tweak mode, the user's voice is echoed back
// without sending to the server.
int (*StartVoiceTweakMode)( void ); // Returns 0 on error.
void (*EndVoiceTweakMode)( void );
// Get/set control values.
void (*SetControlFloat)( VoiceTweakControl iControl, float value );
float (*GetControlFloat)( VoiceTweakControl iControl );
} IVoiceTweak;
#endif//IVOICETWEAK_H

View File

@ -1,75 +0,0 @@
//=======================================================================
// Copyright XashXT Group 2010 ©
// keydefs.h - button keycodes
//=======================================================================
#ifndef KEYDEFS_H
#define KEYDEFS_H
//
// these are the key numbers that should be passed to Key_Event
//
#define K_TAB 9
#define K_ENTER 13
#define K_ESCAPE 27
#define K_SPACE 32
// normal keys should be passed as lowercased ascii
#define K_BACKSPACE 127
#define K_UPARROW 128
#define K_DOWNARROW 129
#define K_LEFTARROW 130
#define K_RIGHTARROW 131
#define K_ALT 132
#define K_CTRL 133
#define K_SHIFT 134
#define K_F1 135
#define K_F2 136
#define K_F3 137
#define K_F4 138
#define K_F5 139
#define K_F6 140
#define K_F7 141
#define K_F8 142
#define K_F9 143
#define K_F10 144
#define K_F11 145
#define K_F12 146
#define K_INS 147
#define K_DEL 148
#define K_PGDN 149
#define K_PGUP 150
#define K_HOME 151
#define K_END 152
#define K_KP_HOME 160
#define K_KP_UPARROW 161
#define K_KP_PGUP 162
#define K_KP_LEFTARROW 163
#define K_KP_5 164
#define K_KP_RIGHTARROW 165
#define K_KP_END 166
#define K_KP_DOWNARROW 167
#define K_KP_PGDN 168
#define K_KP_ENTER 169
#define K_KP_INS 170
#define K_KP_DEL 171
#define K_KP_SLASH 172
#define K_KP_MINUS 173
#define K_KP_PLUS 174
#define K_CAPSLOCK 175
#define K_KP_NUMLOCK 176
// mouse buttons generate virtual keys
#define K_MWHEELDOWN 239
#define K_MWHEELUP 240
#define K_MOUSE1 241
#define K_MOUSE2 242
#define K_MOUSE3 243
#define K_MOUSE4 244
#define K_MOUSE5 245
#define K_PAUSE 255
#endif//KEYDEFS_H

97
common/net_api.h Normal file
View File

@ -0,0 +1,97 @@
/***
*
* 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 NET_API_H
#define NET_API_H
#include "netadr.h"
#define NETAPI_REQUEST_SERVERLIST ( 0 ) // Doesn't need a remote address
#define NETAPI_REQUEST_PING ( 1 )
#define NETAPI_REQUEST_RULES ( 2 )
#define NETAPI_REQUEST_PLAYERS ( 3 )
#define NETAPI_REQUEST_DETAILS ( 4 )
// Set this flag for things like broadcast requests, etc. where the engine should not
// kill the request hook after receiving the first response
#define FNETAPI_MULTIPLE_RESPONSE ( 1<<0 )
typedef void (*net_api_response_func_t) ( struct net_response_s *response );
#define NET_SUCCESS ( 0 )
#define NET_ERROR_TIMEOUT ( 1<<0 )
#define NET_ERROR_PROTO_UNSUPPORTED ( 1<<1 )
#define NET_ERROR_UNDEFINED ( 1<<2 )
typedef struct net_adrlist_s
{
struct net_adrlist_s *next;
netadr_t remote_address;
} net_adrlist_t;
typedef struct net_response_s
{
// NET_SUCCESS or an error code
int error;
// Context ID
int context;
// Type
int type;
// Server that is responding to the request
netadr_t remote_address;
// Response RTT ping time
double ping;
// Key/Value pair string ( separated by backlash \ characters )
// WARNING: You must copy this buffer in the callback function, because it is freed
// by the engine right after the call!!!!
// ALSO: For NETAPI_REQUEST_SERVERLIST requests, this will be a pointer to a linked list of net_adrlist_t's
void *response;
} net_response_t;
typedef struct net_status_s
{
// Connected to remote server? 1 == yes, 0 otherwise
int connected;
// Client's IP address
netadr_t local_address;
// Address of remote server
netadr_t remote_address;
// Packet Loss ( as a percentage )
int packet_loss;
// Latency, in seconds ( multiply by 1000.0 to get milliseconds )
double latency;
// Connection time, in seconds
double connection_time;
// Rate setting ( for incoming data )
double rate;
} net_status_t;
typedef struct net_api_s
{
// APIs
void (*InitNetworking)( void );
void (*Status )( struct net_status_s *status );
void (*SendRequest)( int context, int request, int flags, double timeout, struct netadr_s *remote_address, net_api_response_func_t response );
void (*CancelRequest)( int context );
void (*CancelAllRequests)( void );
char *(*AdrToString)( struct netadr_s *a );
int ( *CompareAdr)( struct netadr_s *a, struct netadr_s *b );
int ( *StringToAdr)( char *s, struct netadr_s *a );
const char *(*ValueForKey)( const char *s, const char *key );
void (*RemoveKey)( char *s, const char *key );
void (*SetValueForKey)( char *s, const char *key, const char *value, int maxsize );
} net_api_t;
#endif//NET_APIH

View File

@ -1,7 +1,18 @@
//=======================================================================
// Copyright XashXT Group 2010 ©
// netadr.h - net address local struct
//=======================================================================
/***
*
* 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 NETADR_H
#define NETADR_H

View File

@ -1,7 +1,18 @@
//=======================================================================
// Copyright XashXT Group 2010 ©
// pmtrace.h - shared physent trace
//=======================================================================
/***
*
* 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 PM_TRACE_H
#define PM_TRACE_H
@ -13,17 +24,17 @@ typedef struct
typedef struct pmtrace_s
{
int allsolid; // if true, plane is not valid
int startsolid; // if true, the initial point was in a solid area
int inopen;
int inwater; // end point is in empty space or in water
float fraction; // time completed, 1.0 = didn't hit anything
vec3_t endpos; // final position
pmplane_t plane; // surface normal at impact
int ent; // entity at impact
vec3_t deltavelocity; // change in player's velocity caused by impact.
// only run on server.
int hitgroup;
qboolean allsolid; // if true, plane is not valid
qboolean startsolid; // if true, the initial point was in a solid area
qboolean inopen;
qboolean inwater; // End point is in empty space or in water
float fraction; // time completed, 1.0 = didn't hit anything
vec3_t endpos; // final position
pmplane_t plane; // surface normal at impact
int ent; // entity at impact
vec3_t deltavelocity; // Change in player's velocity caused by impact.
// Only run on server.
int hitgroup;
} pmtrace_t;
#endif//PM_TRACE_H

View File

@ -1,7 +1,18 @@
//=======================================================================
// Copyright XashXT Group 2010 ©
// qfont.h - Quake font width variable widths
//=======================================================================
/***
*
* 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 QFONT_H
#define QFONT_H
@ -12,15 +23,16 @@
========================================================================
*/
#define QCHAR_WIDTH 16
#define QFONT_WIDTH 16 // valve fonts used contant sizes
#define QFONT_HEIGHT ((128 - 32) / 16)
#define QCHAR_WIDTH 16
#define QFONT_WIDTH 16 // valve fonts used contant sizes
#define QFONT_HEIGHT ((128 - 32) / 16)
#define NUM_GLYPHS 256
typedef struct
{
short startoffset;
short charwidth;
} charset_t;
} charinfo;
typedef struct
{
@ -28,7 +40,7 @@ typedef struct
int height;
int rowcount;
int rowheight;
charset_t fontinfo[256];
charinfo fontinfo[NUM_GLYPHS];
byte data[4]; // variable sized
} qfont_t;

View File

@ -1,7 +1,18 @@
//=======================================================================
// Copyright XashXT Group 2009 ©
// studio_event.h - model event definition
//=======================================================================
/***
*
* 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 STUDIO_EVENT_H
#define STUDIO_EVENT_H

View File

@ -33,7 +33,7 @@ typedef struct triapi_s
int (*LoadShader)( const char *szShaderName, int fShaderNoMip );
int (*GetSpriteTexture)( int spriteIndex, int spriteFrame );
void (*RenderMode)( kRenderMode_t mode );
void (*RenderMode)( int mode );
void (*Begin)( int primitiveCode );
void (*End)( void );

View File

@ -1,27 +1,37 @@
//=======================================================================
// Copyright XashXT Group 2009 ©
// usercmd.h - usercmd communication
//=======================================================================
/***
*
* 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
// usercmd_t communication (a part of network protocol)
typedef struct usercmd_s
{
short lerp_msec; // interpolation time on client
byte msec; // duration in ms of command
vec3_t viewangles; // command view angles
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.
word buttons; // attack and move buttons
byte impulse; // impulse command issued
byte weaponselect; // current weapon id
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.
// Experimental player impact stuff.
int impact_index;
vec3_t impact_position;
} usercmd_t;

View File

@ -1,7 +1,18 @@
//=======================================================================
// Copyright XashXT Group 2010 ©
// wadfile.h - WAD3 format (texture container)
//=======================================================================
/***
*
* 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 WADFILE_H
#define WADFILE_H

View File

@ -1,11 +1,22 @@
//=======================================================================
// Copyright XashXT Group 2010 ©
// weaponinfo.h - client weapondata for predicting
//=======================================================================
/***
*
* 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 WEAPONINFO_H
#define WEAPONINFO_H
// info about weapons player might have in his/her possession
// Info about weapons player might have in his/her possession
typedef struct weapon_data_s
{
int m_iId;

View File

@ -33,7 +33,7 @@
#include "soundent.h"
#include "gamerules.h"
#include "game.h"
#include "customentity.h"
#include "../engine/customentity.h"
#include "weapons.h"
#include "weaponinfo.h"
#include "usercmd.h"

View File

@ -64,10 +64,10 @@ typedef float vec_t; // needed before including progdefs.h
// Shared engine/DLL constants
#include "const.h"
#include "progdefs.h"
#include "edict.h"
#include "../engine/edict.h"
// Shared header describing protocol between engine and DLLs
#include "eiface.h"
#include "../engine/eiface.h"
// Shared header between the client DLL and the game DLLs
#include "cdll_dll.h"

View File

@ -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 "..\dlls" /I "..\common" /I "..\game_shared" /I "..\\" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /FD /c
# ADD CPP /nologo /MD /W3 /GX /O2 /I "..\dlls" /I "..\common" /I "..\engine" /I "..\game_shared" /I "..\\" /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
@ -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 /GX /ZI /Od /I "..\dlls" /I "..\common" /I "..\game_shared" /I "..\\" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /FR /FD /c
# ADD CPP /nologo /MDd /W3 /Gm /GX /ZI /Od /I "..\dlls" /I "..\common" /I "..\engine" /I "..\game_shared" /I "..\\" /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

View File

@ -282,7 +282,7 @@ Called when a demo or cinematic finishes
If the "nextdemo" cvar is set, that command will be issued
==================
*/
bool CL_NextDemo( void )
qboolean CL_NextDemo( void )
{
string str;
@ -431,7 +431,7 @@ void CL_StopRecord( void )
CL_GetComment
==================
*/
bool CL_GetComment( const char *demoname, char *comment )
qboolean CL_GetComment( const char *demoname, char *comment )
{
file_t *demfile;
char buf_data[MAX_MSGLEN];

View File

@ -9,7 +9,7 @@
#include "entity_types.h"
#include "input.h"
bool CL_IsPlayerIndex( int idx )
qboolean CL_IsPlayerIndex( int idx )
{
if( idx > 0 && idx <= cl.maxclients )
return true;
@ -109,12 +109,12 @@ void CL_UpdateStudioVars( cl_entity_t *ent, entity_state_t *newstate )
VectorCopy( ent->curstate.angles, ent->latched.prevangles );
}
void CL_DeltaEntity( sizebuf_t *msg, frame_t *frame, int newnum, entity_state_t *old, bool unchanged )
void CL_DeltaEntity( sizebuf_t *msg, frame_t *frame, int newnum, entity_state_t *old, qboolean unchanged )
{
cl_entity_t *ent;
entity_state_t *state;
bool newent = (old) ? false : true;
bool noInterp = false;
qboolean newent = (old) ? false : true;
qboolean noInterp = false;
int result = 1;
ent = EDICT_NUM( newnum );
@ -215,7 +215,7 @@ An svc_packetentities has just been parsed, deal with the
rest of the data stream.
==================
*/
void CL_ParsePacketEntities( sizebuf_t *msg, bool delta )
void CL_ParsePacketEntities( sizebuf_t *msg, qboolean delta )
{
frame_t *newframe, *oldframe;
int oldindex, newnum, oldnum;
@ -531,10 +531,10 @@ void CL_AddEntities( void )
//
// sound engine implementation
//
bool CL_GetEntitySpatialization( int entnum, vec3_t origin, vec3_t velocity )
qboolean CL_GetEntitySpatialization( int entnum, vec3_t origin, vec3_t velocity )
{
cl_entity_t *ent;
bool from_baseline = false;
qboolean from_baseline = false;
if( entnum < 0 || entnum > clgame.numEntities )
return false;

View File

@ -33,6 +33,34 @@ cl_entity_t *CL_GetEntityByIndex( int index )
return EDICT_NUM( index );
}
int CL_DecalIndex( const char *name )
{
char shortname[CS_SIZE];
int i;
if( !name || !name[0] )
return 0;
FS_FileBase( name, shortname );
for( i = 1; i < MAX_DECALS && clgame.draw_decals[i][0]; i++ )
{
if( !com.stricmp( clgame.draw_decals[i], shortname ))
return i;
}
if( i == MAX_DECALS )
{
MsgDev( D_ERROR, "CL_DecalIndex: MAX_DECALS limit exceeded\n" );
return 0;
}
// register new decal
com.strncpy( clgame.draw_decals[i], shortname, sizeof( clgame.draw_decals[i] ));
return i;
}
/*
====================
CL_GetServerTime
@ -243,7 +271,7 @@ static void SPR_AdjustSize( float *x, float *y, float *w, float *h )
if( h ) *h *= yscale;
}
static bool SPR_Scissor( float *x, float *y, float *width, float *height, float *u0, float *v0, float *u1, float *v1 )
static qboolean SPR_Scissor( float *x, float *y, float *width, float *height, float *u0, float *v0, float *u1, float *v1 )
{
float dudx, dvdy;
@ -433,6 +461,26 @@ static void CL_InitTitles( const char *filename )
Mem_Free( pMemFile );
}
/*
====================
CL_InitDecals
build list of unique decalnames
====================
*/
static void CL_InitDecals( void )
{
search_t *t;
int i;
// lookup all decals in decals.wad
t = FS_Search( "decals.wad/*.*", true );
for( i = 0; t && i < t->numfilenames; i++ )
CL_DecalIndex( t->filenames[i] );
if( t ) Mem_Free( t );
}
/*
====================
CL_BadMessage
@ -1163,7 +1211,7 @@ static void pfnGetPlayerInfo( int ent_num, hud_player_info_t *pinfo )
{
player_info_t *player;
cl_entity_t *ent;
bool spec = false;
qboolean spec = false;
ent = CL_GetEntityByIndex( ent_num );
ent_num -= 1; // player list if offset by 1 from ents
@ -1212,7 +1260,7 @@ static void pfnPlaySoundByIndex( int iSound, float volume )
// make sure what we in-bounds
iSound = bound( 0, iSound, MAX_SOUNDS );
hSound = cl.sound_precache[iSound];
hSound = cl.sound_index[iSound];
if( !hSound )
{
@ -1676,16 +1724,24 @@ pfnFindModelIndex
=============
*/
int pfnFindModelIndex( const char *model )
int pfnFindModelIndex( const char *m )
{
int i;
if( !model || !*model ) return 0;
for( i = 1; i < MAX_MODELS; i++ )
if( !m || !m[0] )
return 0;
for( i = 1; i < MAX_MODELS && cl.model_precache[i][0]; i++ )
{
if( !com.strcmp( model, cl.configstrings[CS_MODELS+i] ))
if( !com.strcmp( cl.model_precache[i], m ))
return i;
}
if( cls.state == ca_active )
{
// tell user about problem
MsgDev( D_ERROR, "CL_ModelIndex: %s not precached\n", m );
}
return 0;
}
@ -1863,7 +1919,7 @@ pfnBoxVisible
=============
*/
static bool pfnBoxVisible( const vec3_t mins, const vec3_t maxs )
static qboolean pfnBoxVisible( const vec3_t mins, const vec3_t maxs )
{
if( !re ) return false;
return CM_BoxVisible( mins, maxs, re->GetCurrentVis());
@ -1990,11 +2046,18 @@ int pfnDecalIndexFromName( const char *szDecalName )
{
int i;
if( !szDecalName || !szDecalName[0] )
return 0;
// look through the loaded sprite name list for SpriteName
for( i = 0; i < MAX_DECALNAMES && cl.configstrings[CS_DECALS+i+1][0]; i++ )
for( i = 0; i < MAX_DECALS && clgame.draw_decals[i+1][0]; i++ )
{
if( !com.stricmp( szDecalName, cl.configstrings[CS_DECALS+i+1] ))
return cl.decal_shaders[i+1];
if( !com.stricmp( szDecalName, clgame.draw_decals[i+1] ))
{
if( !cl.decal_index[i+1] )
cl.decal_index[i+1] = re->RegisterShader( szDecalName, SHADER_DECAL );
return cl.decal_index[i+1];
}
}
return 0; // invalid decal
}
@ -2007,8 +2070,10 @@ pfnDecalIndex
*/
static int pfnDecalIndex( int id )
{
id = bound( 0, id, MAX_DECALNAMES - 1 );
return cl.decal_shaders[id];
id = bound( 0, id, MAX_DECALS - 1 );
if( !cl.decal_index[id] )
cl.decal_index[id] = re->RegisterShader( clgame.draw_decals[id], SHADER_DECAL );
return cl.decal_index[id];
}
/*
@ -2117,7 +2182,7 @@ TriRenderMode
=============
*/
void TriRenderMode( kRenderMode_t mode )
void TriRenderMode( int mode )
{
if( !re ) return;
re->RenderMode( mode );
@ -2512,7 +2577,7 @@ void CL_UnloadProgs( void )
Mem_Set( &clgame, 0, sizeof( clgame ));
}
bool CL_LoadProgs( const char *name )
qboolean CL_LoadProgs( const char *name )
{
static CLIENTAPI GetClientAPI;
static playermove_t gpMove;
@ -2553,6 +2618,8 @@ bool CL_LoadProgs( const char *name )
clgame.maxEntities = GI->max_edicts; // merge during loading
CL_InitTitles( "titles.txt" );
CL_InitDecals();
// initialize game
clgame.dllFuncs.pfnInit();

View File

@ -45,25 +45,25 @@ client_static_t cls;
clgame_static_t clgame;
//======================================================================
bool CL_Active( void )
qboolean CL_Active( void )
{
return ( cls.state == ca_active );
}
//======================================================================
bool CL_IsInGame( void )
qboolean CL_IsInGame( void )
{
if( host.type == HOST_DEDICATED ) return true; // always active for dedicated servers
if( CL_GetMaxClients() > 1 ) return true; // always active for multiplayer
return ( cls.key_dest == key_game ); // active if not menu or console
}
bool CL_IsInMenu( void )
qboolean CL_IsInMenu( void )
{
return ( cls.key_dest == key_menu );
}
bool CL_IsPlaybackDemo( void )
qboolean CL_IsPlaybackDemo( void )
{
return cls.demoplayback;
}
@ -345,7 +345,7 @@ During normal gameplay, a client packet will contain something like:
void CL_WritePacket( void )
{
sizebuf_t buf;
bool send_command = false;
qboolean send_command = false;
byte data[MAX_CMD_BUFFER];
int i, from, to, key, size;
int numbackup = 2;
@ -982,13 +982,13 @@ void CL_PrepSound( void )
int i, sndcount;
MsgDev( D_NOTE, "CL_PrepSound: %s\n", cl.configstrings[CS_NAME] );
for( i = 0, sndcount = 0; i < MAX_SOUNDS && cl.configstrings[CS_SOUNDS+i+1][0]; i++ )
for( i = 0, sndcount = 0; i < MAX_SOUNDS && cl.sound_precache[i+1][0]; i++ )
sndcount++; // total num sounds
S_BeginRegistration();
for( i = 0; i < MAX_SOUNDS && cl.configstrings[CS_SOUNDS+1+i][0]; i++ )
for( i = 0; i < MAX_SOUNDS && cl.sound_precache[i+1][0]; i++ )
{
cl.sound_precache[i+1] = S_RegisterSound( cl.configstrings[CS_SOUNDS+1+i] );
cl.sound_index[i+1] = S_RegisterSound( cl.sound_precache[i+1] );
Cvar_SetValue( "scr_loading", scr_loading->value + 5.0f / sndcount );
if( cl_allow_levelshots->integer || host.developer > 3 ) SCR_UpdateScreen();
}
@ -1031,37 +1031,35 @@ void CL_PrepVideo( void )
int i, mdlcount;
int map_checksum; // dummy
if( !cl.configstrings[CS_MODELS+1][0] )
if( !cl.model_precache[1][0] )
return; // no map loaded
Cvar_SetValue( "scr_loading", 0.0f ); // reset progress bar
MsgDev( D_NOTE, "CL_PrepVideo: %s\n", cl.configstrings[CS_NAME] );
// let the render dll load the map
com.strncpy( mapname, cl.configstrings[CS_MODELS+1], MAX_STRING );
com.strncpy( mapname, cl.model_precache[1], MAX_STRING );
CM_BeginRegistration( mapname, true, &map_checksum );
re->BeginRegistration( mapname );
cl.worldmodel = CM_ClipHandleToModel( 1 ); // get world pointer
SCR_RegisterShaders(); // update with new sequence
SCR_UpdateScreen();
for( i = 0, mdlcount = 0; i < MAX_MODELS && cl.configstrings[CS_MODELS+1+i][0]; i++ )
for( i = 0, mdlcount = 0; i < MAX_MODELS && cl.model_precache[i+1][0]; i++ )
mdlcount++; // total num models
for( i = 0; i < MAX_MODELS && cl.configstrings[CS_MODELS+1+i][0]; i++ )
for( i = 0; i < MAX_MODELS && cl.model_precache[i+1][0]; i++ )
{
com.strncpy( name, cl.configstrings[CS_MODELS+1+i], MAX_STRING );
com.strncpy( name, cl.model_precache[i+1], MAX_STRING );
re->RegisterModel( name, i+1 );
CM_RegisterModel( name, i+1 );
Cvar_SetValue( "scr_loading", scr_loading->value + 45.0f / mdlcount );
if( cl_allow_levelshots->integer || host.developer > 3 ) SCR_UpdateScreen();
}
for( i = 0; i < MAX_DECALNAMES && cl.configstrings[CS_DECALS+1+i][0]; i++ )
{
com.strncpy( name, cl.configstrings[CS_DECALS+1+i], MAX_STRING );
cl.decal_shaders[i+1] = re->RegisterShader( name, SHADER_DECAL );
}
// reload all decals
for( i = 0; i < MAX_DECALS && clgame.draw_decals[i+1][0]; i++ )
cl.decal_index[i+1] = re->RegisterShader( clgame.draw_decals[i+1], SHADER_DECAL );
// setup sky and free unneeded stuff
re->EndRegistration( cl.refdef.movevars->skyName );
@ -1349,114 +1347,9 @@ void CL_Physinfo_f( void )
Info_Print( cl.frame.clientdata.physinfo );
}
int precache_check; // for autodownload of precache items
int precache_spawncount;
// ENV_CNT is map load, ENV_CNT+1 is first cubemap
#define ENV_CNT MAX_CONFIGSTRINGS
#define TEXTURE_CNT (ENV_CNT+1)
void CL_RequestNextDownload( void )
{
string fn;
uint map_checksum; // for detecting cheater maps
if( cls.state != ca_connected )
return;
if( !allow_download->value && precache_check < ENV_CNT )
precache_check = ENV_CNT;
if( precache_check == CS_MODELS )
{
// confirm map
precache_check = CS_MODELS+2; // 0 isn't used
if(!CL_CheckOrDownloadFile( cl.configstrings[CS_MODELS+1] ))
return; // started a download map
}
if( precache_check >= CS_MODELS && precache_check < CS_MODELS+MAX_MODELS )
{
while( precache_check < CS_MODELS+MAX_MODELS && cl.configstrings[precache_check][0])
{
if( cl.configstrings[precache_check][0] == '*' || cl.configstrings[precache_check][0] == '#' )
{
precache_check++; // ignore bsp models or built-in models
continue;
}
com.sprintf( fn, "%s", cl.configstrings[precache_check++]);
if(!CL_CheckOrDownloadFile( fn )) return; // started a download
}
precache_check = CS_SOUNDS;
}
if( precache_check >= CS_SOUNDS && precache_check < CS_SOUNDS+MAX_SOUNDS )
{
if( precache_check == CS_SOUNDS ) precache_check++; // zero is blank
while( precache_check < CS_SOUNDS+MAX_SOUNDS && cl.configstrings[precache_check][0])
{
// sound pathes from model events
if( cl.configstrings[precache_check][0] == '*' || cl.configstrings[precache_check][0] == '#' )
{
precache_check++;
continue;
}
com.sprintf( fn, "sound/%s", cl.configstrings[precache_check++]);
if(!CL_CheckOrDownloadFile( fn )) return; // started a download
}
precache_check = CS_GENERICS;
}
if( precache_check >= CS_GENERICS && precache_check < CS_GENERICS+MAX_GENERICS )
{
if( precache_check == CS_GENERICS ) precache_check++; // zero is blank
while( precache_check < CS_GENERICS+MAX_GENERICS && cl.configstrings[precache_check][0] )
{
// generic recources - pakfiles, wadfiles etc
if( cl.configstrings[precache_check][0] == '#' )
{
precache_check++;
continue;
}
com.sprintf( fn, "%s", cl.configstrings[precache_check++]);
if(!CL_CheckOrDownloadFile( fn )) return; // started a download
}
precache_check = ENV_CNT;
}
if( precache_check == ENV_CNT )
{
precache_check = ENV_CNT + 1;
CM_BeginRegistration( cl.configstrings[CS_MODELS+1], true, &map_checksum );
if( map_checksum != com.atoi( cl.configstrings[CS_MAPCHECKSUM] ))
{
Host_Error( "Local map version differs from server: %i != '%s'\n", map_checksum, cl.configstrings[CS_MAPCHECKSUM] );
return;
}
}
if( precache_check > ENV_CNT && precache_check < TEXTURE_CNT )
{
if( allow_download->value )
{
com.sprintf( fn, "env/%s.dds", cl.refdef.movevars->skyName ); // cubemap pack
if( !CL_CheckOrDownloadFile( fn )) return; // started a download
}
precache_check = TEXTURE_CNT;
}
// skip textures: use generic for downloading packs
if( precache_check == TEXTURE_CNT )
precache_check = TEXTURE_CNT + 999;
CL_PrepSound();
CL_PrepVideo();
if( cls.demoplayback ) return; // not really connected
BF_WriteByte( &cls.netchan.message, clc_stringcmd );
BF_WriteString( &cls.netchan.message, va( "begin %i\n", precache_spawncount ));
Host_Error( "CL_RequestNextDownload: not implemented (yet)\n" );
}
/*
@ -1469,9 +1362,17 @@ before allowing the client into the server
*/
void CL_Precache_f( void )
{
precache_check = CS_MODELS;
precache_spawncount = com.atoi( Cmd_Argv( 1 ));
CL_RequestNextDownload();
int spawncount;
spawncount = com.atoi( Cmd_Argv( 1 ));
CL_PrepSound();
CL_PrepVideo();
if( cls.demoplayback ) return; // not really connected
BF_WriteByte( &cls.netchan.message, clc_stringcmd );
BF_WriteString( &cls.netchan.message, va( "begin %i\n", spawncount ));
}
/*

View File

@ -15,7 +15,7 @@ void UI_UpdateMenu( float realtime )
gameui.dllFuncs.pfnRedraw( realtime );
}
void UI_KeyEvent( int key, bool down )
void UI_KeyEvent( int key, qboolean down )
{
if( !gameui.hInstance ) return;
gameui.dllFuncs.pfnKeyEvent( key, down );
@ -27,7 +27,7 @@ void UI_MouseMove( int x, int y )
gameui.dllFuncs.pfnMouseMove( x, y );
}
void UI_SetActiveMenu( bool fActive )
void UI_SetActiveMenu( qboolean fActive )
{
movie_state_t *cin_state;
@ -61,13 +61,13 @@ void UI_SetCursorPos( int pos_x, int pos_y )
gameui.dllFuncs.pfnSetCursorPos( pos_x, pos_y );
}
void UI_ShowCursor( bool show )
void UI_ShowCursor( qboolean show )
{
if( !gameui.hInstance ) return;
gameui.dllFuncs.pfnShowCursor( show );
}
bool UI_CreditsActive( void )
qboolean UI_CreditsActive( void )
{
if( !gameui.hInstance ) return 0;
return gameui.dllFuncs.pfnCreditsActive();
@ -79,13 +79,13 @@ void UI_CharEvent( int key )
gameui.dllFuncs.pfnCharEvent( key );
}
bool UI_MouseInRect( void )
qboolean UI_MouseInRect( void )
{
if( !gameui.hInstance ) return 1;
return gameui.dllFuncs.pfnMouseInRect();
}
bool UI_IsVisible( void )
qboolean UI_IsVisible( void )
{
if( !gameui.hInstance ) return 0;
return gameui.dllFuncs.pfnIsVisible();
@ -99,7 +99,7 @@ static void UI_DrawLogo( const char *filename, float x, float y, float width, fl
byte *cin_data = NULL;
movie_state_t *cin_state;
int cin_frame;
bool redraw = false;
qboolean redraw = false;
if( !gameui.drawLogo ) return;
cin_state = AVI_GetState( CIN_LOGO );
@ -194,7 +194,7 @@ static void UI_ConvertGameInfo( GAMEINFO *out, gameinfo_t *in )
out->gamemode = in->gamemode;
}
static bool PIC_Scissor( float *x, float *y, float *width, float *height, float *u0, float *v0, float *u1, float *v1 )
static qboolean PIC_Scissor( float *x, float *y, float *width, float *height, float *u0, float *v0, float *u1, float *v1 )
{
float dudx, dvdy;
@ -811,7 +811,7 @@ pfnShellExecute
=========
*/
static void pfnShellExecute( const char *name, const char *args, bool closeEngine )
static void pfnShellExecute( const char *name, const char *args, qboolean closeEngine )
{
Sys_ShellExecute( name, args, closeEngine );
}
@ -980,7 +980,7 @@ void UI_UnloadProgs( void )
Mem_Set( &gameui, 0, sizeof( gameui ));
}
bool UI_LoadProgs( const char *name )
qboolean UI_LoadProgs( const char *name )
{
static GAMEUIAPI GetMenuAPI;
static ui_globalvars_t gpGlobals;

View File

@ -36,17 +36,17 @@ const char *svc_strings[256] =
"svc_particle",
"svc_frame",
"svc_spawnstatic",
"svc_unused21",
"svc_event_reliable",
"svc_spawnbaseline",
"svc_temp_entity",
"svc_setpause",
"svc_deltamovevars",
"svc_unused25",
"svc_centerprint",
"svc_event",
"svc_event_reliable",
"svc_soundindex",
"svc_ambientsound",
"svc_intermission",
"svc_unused31",
"svc_modelindex",
"svc_cdtrack",
"svc_serverinfo",
"svc_deltatable",
@ -59,7 +59,7 @@ const char *svc_strings[256] =
"svc_deltapacketentities",
"svc_chokecount",
"svc_unused43",
"svc_unused44",
"svc_deltamovevars",
"svc_unused45",
"svc_unused46",
"svc_crosshairangle",
@ -80,7 +80,7 @@ typedef struct
{
oldcmd_t oldcmd[MSG_COUNT];
int currentcmd;
bool parsing;
qboolean parsing;
} msg_debug_t;
static msg_debug_t cls_message_debug;
@ -209,7 +209,7 @@ Returns true if the file exists, otherwise it attempts
to start a download from the server.
===============
*/
bool CL_CheckOrDownloadFile( const char *filename )
qboolean CL_CheckOrDownloadFile( const char *filename )
{
string name;
file_t *f;
@ -358,7 +358,7 @@ CL_ParseSoundPacket
==================
*/
void CL_ParseSoundPacket( sizebuf_t *msg, bool is_ambient )
void CL_ParseSoundPacket( sizebuf_t *msg, qboolean is_ambient )
{
vec3_t pos_;
float *pos = NULL;
@ -400,7 +400,7 @@ void CL_ParseSoundPacket( sizebuf_t *msg, bool is_ambient )
com.snprintf( sentenceName, sizeof( sentenceName ), "!%i", sound );
handle = S_RegisterSound( sentenceName );
}
else handle = cl.sound_precache[sound]; // see precached sound
else handle = cl.sound_index[sound]; // see precached sound
if( is_ambient )
{
@ -513,7 +513,10 @@ void CL_ParseStaticDecal( sizebuf_t *msg )
else modelIndex = 0;
flags = BF_ReadByte( msg );
CL_DecalShoot( cl.decal_shaders[decalIndex], entityIndex, modelIndex, origin, flags );
if( !cl.decal_index[decalIndex] )
cl.decal_index[decalIndex] = re->RegisterShader( clgame.draw_decals[decalIndex], SHADER_DECAL );
CL_DecalShoot( cl.decal_index[decalIndex], entityIndex, modelIndex, origin, flags );
}
void CL_ParseSoundFade( sizebuf_t *msg )
@ -753,23 +756,10 @@ void CL_ParseConfigString( sizebuf_t *msg )
{
CL_RunBackgroundTrack();
}
else if( i > CS_BACKGROUND_TRACK && i < CS_MODELS )
else if( i > CS_BACKGROUND_TRACK && i < CS_EVENTS )
{
Host_Error( "CL_ParseConfigString: reserved configstring #%i are used\n", i );
}
else if( i >= CS_MODELS && i < CS_MODELS+MAX_MODELS && cl.video_prepped )
{
re->RegisterModel( cl.configstrings[i], i-CS_MODELS );
CM_RegisterModel( cl.configstrings[i], i-CS_MODELS );
}
else if( i >= CS_SOUNDS && i < CS_SOUNDS+MAX_SOUNDS && cl.audio_prepped )
{
cl.sound_precache[i-CS_SOUNDS] = S_RegisterSound( cl.configstrings[i] );
}
else if( i >= CS_DECALS && i < CS_DECALS+MAX_DECALNAMES && cl.video_prepped )
{
cl.decal_shaders[i-CS_DECALS] = re->RegisterShader( cl.configstrings[i], SHADER_DECAL );
}
else if( i >= CS_EVENTS && i < CS_EVENTS+MAX_EVENTS )
{
CL_SetEventIndex( cl.configstrings[i], i - CS_EVENTS );
@ -855,7 +845,7 @@ collect userinfo from all players
void CL_UpdateUserinfo( sizebuf_t *msg )
{
int slot;
bool active;
qboolean active;
player_info_t *player;
slot = BF_ReadUBitLong( msg, MAX_CLIENT_BITS );
@ -875,6 +865,55 @@ void CL_UpdateUserinfo( sizebuf_t *msg )
else Mem_Set( player, 0, sizeof( *player ));
}
/*
================
CL_PrecacheModel
prceache model from server
================
*/
void CL_PrecacheModel( sizebuf_t *msg )
{
int modelIndex;
modelIndex = BF_ReadUBitLong( msg, MAX_MODEL_BITS );
if( modelIndex < 0 || modelIndex >= MAX_MODELS )
Host_Error( "CL_PrecacheModel: bad modelindex %i\n", modelIndex );
com.strcpy( cl.model_precache[modelIndex], BF_ReadString( msg ));
// when we loading map all resources is precached sequentially
if( !cl.video_prepped ) return;
re->RegisterModel( cl.model_precache[modelIndex], modelIndex );
CM_RegisterModel( cl.model_precache[modelIndex], modelIndex );
}
/*
================
CL_PrecacheSound
prceache sound from server
================
*/
void CL_PrecacheSound( sizebuf_t *msg )
{
int soundIndex;
soundIndex = BF_ReadUBitLong( msg, MAX_SOUND_BITS );
if( soundIndex < 0 || soundIndex >= MAX_SOUNDS )
Host_Error( "CL_PrecacheSound: bad soundindex %i\n", soundIndex );
com.strcpy( cl.sound_precache[soundIndex], BF_ReadString( msg ));
// when we loading map all resources is precached sequentially
if( !cl.audio_prepped ) return;
cl.sound_index[soundIndex] = S_RegisterSound( cl.sound_precache[soundIndex] );
}
/*
================
CL_UpdateUserPings
@ -1158,6 +1197,12 @@ void CL_ParseServerMessage( sizebuf_t *msg )
case svc_intermission:
cl.refdef.intermission = true;
break;
case svc_modelindex:
CL_PrecacheModel( msg );
break;
case svc_soundindex:
CL_PrecacheSound( msg );
break;
case svc_soundfade:
CL_ParseSoundFade( msg );
break;

View File

@ -16,7 +16,7 @@ void CL_ClearPhysEnts( void )
clgame.pmove->numphysent = 0;
}
bool CL_CopyEntityToPhysEnt( physent_t *pe, cl_entity_t *ent )
qboolean CL_CopyEntityToPhysEnt( physent_t *pe, cl_entity_t *ent )
{
model_t *mod = CM_ClipHandleToModel( ent->curstate.modelindex );
@ -319,7 +319,7 @@ static void pfnPlaybackEventFull( int flags, int clientindex, word eventindex, f
ent = CL_GetEntityByIndex( clientindex + 1 );
if( ent == NULL ) return;
CL_PlaybackEvent( flags, ent, eventindex,
CL_PlaybackEvent( flags, (edict_t *)ent, eventindex,
delay, origin, angles,
fparam1, fparam2,
iparam1, iparam2,

View File

@ -12,7 +12,7 @@
#define MAX_FORWARD 6
bool CL_IsPredicted( void )
qboolean CL_IsPredicted( void )
{
cl_entity_t *player = CL_GetLocalPlayer();

View File

@ -20,7 +20,7 @@ convar_t *cl_allow_levelshots;
convar_t *cl_levelshot_name;
convar_t *cl_envshot_size;
static bool scr_init = false;
static qboolean scr_init = false;
/*
==============
@ -174,7 +174,7 @@ void SCR_MakeLevelShot( void )
void SCR_MakeScreenShot( void )
{
bool iRet = false;
qboolean iRet = false;
if( !re && host.type == HOST_NORMAL )
return; // don't reset action - it will be wait until render initalization is done

View File

@ -27,7 +27,7 @@ void CL_WeaponAnim( int iAnim, int body )
int i;
// save current blends to right lerping from last sequence
for( i = 0; i < MAXSTUDIOBLENDS; i++ )
for( i = 0; i < 2; i++ )
view->latched.prevseqblending[i] = view->curstate.blending[i];
view->latched.prevsequence = view->curstate.sequence; // save old sequence
@ -35,7 +35,6 @@ void CL_WeaponAnim( int iAnim, int body )
view->latched.prevanimtime = view->curstate.animtime;
}
com.strncpy( view->curstate.classname, "viewentity", sizeof( view->curstate.classname ));
view->curstate.entityType = ET_VIEWENTITY;
view->curstate.animtime = cl_time(); // start immediately
view->curstate.framerate = 1.0f;
@ -223,10 +222,10 @@ CL_AddDlight
copy dlight to renderer
===============
*/
bool CL_AddDlight( dlight_t *dl )
qboolean CL_AddDlight( dlight_t *dl )
{
int flags = 0;
bool add;
qboolean add;
if( dl->dark ) flags |= DLIGHT_DARK;
if( dl->elight ) flags |= DLIGHT_ONLYENTS;
@ -287,9 +286,9 @@ void CL_TestLights( void )
for( j = 0; j < 3; j++ )
dl.origin[j] = cl.refdef.vieworg[j] + cl.refdef.forward[j] * f + cl.refdef.right[j] * r;
dl.color[0] = ((((i % 6) + 1) & 1)>>0) * 255;
dl.color[1] = ((((i % 6) + 1) & 2)>>1) * 255;
dl.color[2] = ((((i % 6) + 1) & 4)>>2) * 255;
dl.color.r = ((((i % 6) + 1) & 1)>>0) * 255;
dl.color.g = ((((i % 6) + 1) & 2)>>1) * 255;
dl.color.b = ((((i % 6) + 1) & 4)>>2) * 255;
dl.radius = 200;
if( !CL_AddDlight( &dl ))
@ -373,7 +372,7 @@ word CL_PrecacheEvent( const char *name )
return 0;
}
bool CL_FireEvent( event_info_t *ei )
qboolean CL_FireEvent( event_info_t *ei )
{
user_event_t *ev;
const char *name;
@ -414,7 +413,7 @@ void CL_FireEvents( void )
int i;
event_state_t *es;
event_info_t *ei;
bool success;
qboolean success;
es = &cl.events;
@ -488,7 +487,7 @@ event_info_t *CL_FindUnreliableEvent( void )
void CL_QueueEvent( int flags, int index, float delay, event_args_t *args )
{
bool unreliable = (flags & FEV_RELIABLE) ? false : true;
qboolean unreliable = (flags & FEV_RELIABLE) ? false : true;
event_info_t *ei;
// find a normal slot
@ -519,7 +518,7 @@ CL_PlaybackEvent
=============
*/
void CL_PlaybackEvent( int flags, const cl_entity_t *pInvoker, word eventindex, float delay, float *origin,
void CL_PlaybackEvent( int flags, const edict_t *pInvoker, word eventindex, float delay, float *origin,
float *angles, float fparam1, float fparam2, int iparam1, int iparam2, int bparam1, int bparam2 )
{
event_args_t args;
@ -567,11 +566,11 @@ void CL_PlaybackEvent( int flags, const cl_entity_t *pInvoker, word eventindex,
{
// get up some info from invoker
if( VectorIsNull( args.origin ))
VectorCopy( pInvoker->curstate.origin, args.origin );
VectorCopy(((cl_entity_t *)&pInvoker)->curstate.origin, args.origin );
if( VectorIsNull( args.angles ))
VectorCopy( pInvoker->curstate.angles, args.angles );
VectorCopy( pInvoker->curstate.velocity, args.velocity );
args.ducking = pInvoker->curstate.usehull;
VectorCopy(((cl_entity_t *)&pInvoker)->curstate.angles, args.angles );
VectorCopy(((cl_entity_t *)&pInvoker)->curstate.velocity, args.velocity );
args.ducking = ((cl_entity_t *)&pInvoker)->curstate.usehull;
}
CL_QueueEvent( flags, eventindex, delay, &args );

View File

@ -46,7 +46,7 @@ Called when a demo or cinematic finishes
If the "nextmovie" cvar is set, that command will be issued
==================
*/
bool SCR_NextMovie( void )
qboolean SCR_NextMovie( void )
{
string str;
@ -164,10 +164,10 @@ Returns true if a cinematic is active, meaning the view rendering
should be skipped
==================
*/
bool SCR_DrawCinematic( void )
qboolean SCR_DrawCinematic( void )
{
static int last_frame = -1;
bool redraw = false;
qboolean redraw = false;
byte *frame = NULL;
if( !re || cin_time <= 0.0f )
@ -190,7 +190,7 @@ bool SCR_DrawCinematic( void )
SCR_PlayCinematic
==================
*/
bool SCR_PlayCinematic( const char *arg )
qboolean SCR_PlayCinematic( const char *arg )
{
string path;
const char *fullpath;

View File

@ -141,10 +141,10 @@ V_PreRender
==================
*/
bool V_PreRender( void )
qboolean V_PreRender( void )
{
bool clearScene = true;
static bool oldState;
qboolean clearScene = true;
static qboolean oldState;
// too early
if( !re ) return false;

View File

@ -41,7 +41,7 @@ typedef struct frame_s
int first_entity; // into the circular cl_packet_entities[]
int delta_sequence; // last valid sequence
bool valid; // cleared if delta parsing was invalid
qboolean valid; // cleared if delta parsing was invalid
} frame_t;
#define CMD_BACKUP MULTIPLAYER_BACKUP // allow a lot of command backups for very fast systems
@ -64,9 +64,9 @@ typedef struct
int parsecountmod; // modulo with network window
double parsecounttime; // timestamp of parse
bool video_prepped; // false if on new level or new ref dll
bool audio_prepped; // false if on new level or new snd dll
bool force_refdef; // vid has changed, so we can't use a paused refdef
qboolean video_prepped; // false if on new level or new ref dll
qboolean audio_prepped; // false if on new level or new snd dll
qboolean force_refdef; // vid has changed, so we can't use a paused refdef
int delta_sequence; // acknowledged sequence number
@ -75,7 +75,7 @@ typedef struct
int last_incoming_sequence;
bool force_send_usercmd;
qboolean force_send_usercmd;
frame_t frame; // received from server
int surpressCount; // number of messages rate supressed
@ -111,12 +111,13 @@ typedef struct
int movemessages;
char configstrings[MAX_CONFIGSTRINGS][CS_SIZE];
model_t *worldmodel; // pointer to world
char model_precache[MAX_MODELS][CS_SIZE];
char sound_precache[MAX_SOUNDS][CS_SIZE];
// locally derived information from server state
model_t models[MAX_MODELS];
sound_t sound_precache[MAX_SOUNDS];
shader_t decal_shaders[MAX_DECALNAMES];
sound_t sound_index[MAX_SOUNDS];
shader_t decal_index[MAX_DECALS];
model_t *worldmodel; // pointer to world
} client_t;
/*
@ -179,6 +180,8 @@ typedef struct
pfnUserMsgHook func; // user-defined function
} cl_user_message_t;
typedef void (*pfnEventHook)( event_args_t *args );
typedef struct
{
char name[CS_SIZE];
@ -190,7 +193,7 @@ typedef struct
{
HSPRITE hFontTexture; // handle to texture shader
wrect_t fontRc[256]; // rectangles
bool valid; // rectangles are valid
qboolean valid; // rectangles are valid
} cl_font_t;
typedef struct
@ -203,7 +206,7 @@ typedef struct
int scissor_y;
int scissor_width;
int scissor_height;
bool scissor_test;
qboolean scissor_test;
// holds text color
rgba_t textColor;
@ -247,6 +250,8 @@ typedef struct
int trace_hull; // used by PM_SetTraceHull
int oldcount; // used by PM_Push\Pop state
char draw_decals[MAX_DECALS][64]; // a list of unique decalindexes
vec3_t player_mins[4]; // 4 hulls allowed
vec3_t player_maxs[4]; // 4 hulls allowed
@ -278,7 +283,7 @@ typedef struct
ui_globalvars_t *globals;
bool drawLogo; // set to TRUE if logo.avi missed or corrupted
qboolean drawLogo; // set to TRUE if logo.avi missed or corrupted
long logo_xres;
long logo_yres;
} gameui_static_t;
@ -286,8 +291,8 @@ typedef struct
typedef struct
{
connstate_t state;
bool initialized;
bool changelevel; // during changelevel
qboolean initialized;
qboolean changelevel; // during changelevel
keydest_t key_dest;
@ -340,9 +345,9 @@ typedef struct
string movies[MAX_MOVIES];
// demo recording info must be here, so it isn't clearing on level change
bool demorecording;
bool demoplayback;
bool demowaiting; // don't record until a non-delta message is received
qboolean demorecording;
qboolean demoplayback;
qboolean demowaiting; // don't record until a non-delta message is received
string demoname; // for demo looping
file_t *demofile;
@ -376,7 +381,7 @@ extern convar_t *userinfo;
//=============================================================================
bool CL_CheckOrDownloadFile( const char *filename );
qboolean CL_CheckOrDownloadFile( const char *filename );
void CL_ParseConfigString( sizebuf_t *msg );
void CL_SetLightstyle( int i );
void CL_RunLightStyles( void );
@ -434,7 +439,7 @@ void CL_Stop_f( void );
// cl_game.c
//
void CL_UnloadProgs( void );
bool CL_LoadProgs( const char *name );
qboolean CL_LoadProgs( const char *name );
void CL_ParseUserMessage( sizebuf_t *msg, int svc_num );
void CL_LinkUserMessage( char *pszName, const int svc_num, int iSize );
void CL_DrawHUD( int state );
@ -483,7 +488,7 @@ void SCR_DrawFPS( void );
void V_Init (void);
void V_Shutdown( void );
void V_ClearScene( void );
bool V_PreRender( void );
qboolean V_PreRender( void );
void V_PostRender( void );
void V_RenderView( void );
@ -495,15 +500,15 @@ void CL_SetSolidPlayers( int playernum );
void CL_InitClientMove( void );
void CL_PredictMovement( void );
void CL_CheckPredictionError( void );
bool CL_IsPredicted( void );
qboolean CL_IsPredicted( void );
//
// cl_frame.c
//
void CL_ParsePacketEntities( sizebuf_t *msg, bool delta );
void CL_ParsePacketEntities( sizebuf_t *msg, qboolean delta );
void CL_UpdateStudioVars( cl_entity_t *ent, entity_state_t *newstate );
bool CL_GetEntitySpatialization( int ent, vec3_t origin, vec3_t velocity );
bool CL_IsPlayerIndex( int idx );
qboolean CL_GetEntitySpatialization( int ent, vec3_t origin, vec3_t velocity );
qboolean CL_IsPlayerIndex( int idx );
//
// cl_tent.c
@ -518,7 +523,7 @@ void CL_LightForPoint( const vec3_t point, vec3_t ambientLight );
void CL_DecalShoot( HSPRITE hDecal, int entityIndex, int modelIndex, float *pos, int flags );
void CL_PlayerDecal( HSPRITE hDecal, int entityIndex, float *pos, byte *color );
void CL_QueueEvent( int flags, int index, float delay, event_args_t *args );
void CL_PlaybackEvent( int flags, const cl_entity_t *pInvoker, word eventindex, float delay, float *origin,
void CL_PlaybackEvent( int flags, const edict_t *pInvoker, word eventindex, float delay, float *origin,
float *angles, float fparam1, float fparam2, int iparam1, int iparam2, int bparam1, int bparam2 );
word CL_PrecacheEvent( const char *name );
void CL_ResetEvent( event_info_t *ei );
@ -527,7 +532,7 @@ void CL_FireEvents( void );
//
// console.c
//
bool Con_Visible( void );
qboolean Con_Visible( void );
void Con_Init( void );
void Con_VidInit( void );
void Con_ToggleConsole_f( void );
@ -545,27 +550,27 @@ void Con_Close( void );
// cl_menu.c
//
void UI_UnloadProgs( void );
bool UI_LoadProgs( const char *name );
qboolean UI_LoadProgs( const char *name );
void UI_UpdateMenu( float realtime );
void UI_KeyEvent( int key, bool down );
void UI_KeyEvent( int key, qboolean down );
void UI_MouseMove( int x, int y );
void UI_SetActiveMenu( bool fActive );
void UI_SetActiveMenu( qboolean fActive );
void UI_AddServerToList( netadr_t adr, const char *info );
void UI_GetCursorPos( int *pos_x, int *pos_y );
void UI_SetCursorPos( int pos_x, int pos_y );
void UI_ShowCursor( bool show );
bool UI_CreditsActive( void );
void UI_ShowCursor( qboolean show );
qboolean UI_CreditsActive( void );
void UI_CharEvent( int key );
bool UI_MouseInRect( void );
bool UI_IsVisible( void );
qboolean UI_MouseInRect( void );
qboolean UI_IsVisible( void );
//
// cl_video.c
//
void SCR_InitCinematic( void );
void SCR_FreeCinematic( void );
bool SCR_PlayCinematic( const char *name );
bool SCR_DrawCinematic( void );
qboolean SCR_PlayCinematic( const char *name );
qboolean SCR_DrawCinematic( void );
void SCR_RunCinematic( void );
void SCR_StopCinematic( void );
void CL_PlayVideo_f( void );

View File

@ -10,9 +10,9 @@
typedef struct movie_state_s
{
bool active;
bool ignore_hwgamma; // ignore hw gamma-correction
bool quiet; // ignore error messages
qboolean active;
qboolean ignore_hwgamma; // ignore hw gamma-correction
qboolean quiet; // ignore error messages
PAVIFILE pfile; // avi file pointer
PAVISTREAM video_stream; // video stream pointer
@ -50,7 +50,7 @@ typedef struct movie_state_s
static movie_state_t avi[2];
// Converts a compressed audio stream into uncompressed PCM.
bool AVI_ACMConvertAudio( movie_state_t *Avi )
qboolean AVI_ACMConvertAudio( movie_state_t *Avi )
{
WAVEFORMATEX dest_header, *sh, *dh;
AVISTREAMINFO stream_info;
@ -165,7 +165,7 @@ bool AVI_ACMConvertAudio( movie_state_t *Avi )
return true;
}
bool AVI_GetVideoInfo( movie_state_t *Avi, long *xres, long *yres, float *duration )
qboolean AVI_GetVideoInfo( movie_state_t *Avi, long *xres, long *yres, float *duration )
{
ASSERT( Avi != NULL );
@ -225,7 +225,7 @@ byte *AVI_GetVideoFrame( movie_state_t *Avi, long frame )
return Avi->pframe_data;
}
bool AVI_GetAudioInfo( movie_state_t *Avi, wavdata_t *snd_info )
qboolean AVI_GetAudioInfo( movie_state_t *Avi, wavdata_t *snd_info )
{
ASSERT( Avi != NULL );
@ -248,7 +248,7 @@ bool AVI_GetAudioInfo( movie_state_t *Avi, wavdata_t *snd_info )
}
// sync the current audio read to a specific offset
bool AVI_SeekPosition( movie_state_t *Avi, dword offset )
qboolean AVI_SeekPosition( movie_state_t *Avi, dword offset )
{
int breaker;
@ -403,7 +403,7 @@ void AVI_CloseVideo( movie_state_t *Avi )
Mem_Set( Avi, 0, sizeof( movie_state_t ));
}
void AVI_OpenVideo( movie_state_t *Avi, const char *filename, bool load_audio, bool ignore_hwgamma, bool quiet )
void AVI_OpenVideo( movie_state_t *Avi, const char *filename, qboolean load_audio, qboolean ignore_hwgamma, qboolean quiet )
{
AVISTREAMINFO stream_info;
BITMAPINFOHEADER bmih;
@ -537,7 +537,7 @@ void AVI_OpenVideo( movie_state_t *Avi, const char *filename, bool load_audio, b
Avi->active = true; // done
}
bool AVI_IsActive( movie_state_t *Avi )
qboolean AVI_IsActive( movie_state_t *Avi )
{
ASSERT( Avi != NULL );

View File

@ -24,7 +24,7 @@ typedef struct leaflist_s
{
int count;
int maxcount;
bool overflowed;
qboolean overflowed;
short *list;
vec3_t mins, maxs;
int topnode; // for overflows where each leaf can't be stored individually
@ -58,7 +58,7 @@ byte *CM_LeafPHS( int leafnum );
int CM_PointLeafnum( const vec3_t p );
mleaf_t *CM_PointInLeaf( const vec3_t p, mnode_t *node );
int CM_BoxLeafnums( const vec3_t mins, const vec3_t maxs, short *list, int listsize, int *lastleaf );
bool CM_BoxVisible( const vec3_t mins, const vec3_t maxs, const byte *visbits );
qboolean CM_BoxVisible( const vec3_t mins, const vec3_t maxs, const byte *visbits );
int CM_HullPointContents( hull_t *hull, int num, const vec3_t p );
int CM_PointContents( const vec3_t p );
void CM_AmbientLevels( const vec3_t p, byte *pvolumes );
@ -67,13 +67,13 @@ void CM_AmbientLevels( const vec3_t p, byte *pvolumes );
// cm_portals.c
//
void CM_CalcPHS( void );
byte *CM_FatPVS( const vec3_t org, bool portal );
byte *CM_FatPHS( const vec3_t org, bool portal );
byte *CM_FatPVS( const vec3_t org, qboolean portal );
byte *CM_FatPHS( const vec3_t org, qboolean portal );
//
// cm_model.c
//
bool CM_InitPhysics( void );
qboolean CM_InitPhysics( void );
void CM_FreePhysics( void );
script_t *CM_GetEntityScript( void );
void CM_SetupHulls( float mins[4][3], float maxs[4][3] );
@ -81,8 +81,8 @@ void Mod_GetBounds( int handle, vec3_t mins, vec3_t maxs );
void Mod_GetFrames( int handle, int *numFrames );
modtype_t CM_GetModelType( int handle );
model_t *CM_ClipHandleToModel( int handle );
void CM_BeginRegistration ( const char *name, bool clientload, uint *checksum );
bool CM_RegisterModel( const char *name, int sv_index );
void CM_BeginRegistration ( const char *name, qboolean clientload, uint *checksum );
qboolean CM_RegisterModel( const char *name, int index );
void *Mod_Extradata( int handle );
void CM_EndRegistration( void );

View File

@ -125,7 +125,7 @@ static void CM_FreeModel( model_t *mod )
===============================================================================
*/
bool CM_InitPhysics( void )
qboolean CM_InitPhysics( void )
{
cm_novis = Cvar_Get( "cm_novis", "0", 0, "force to ignore server visibility" );
@ -918,7 +918,7 @@ static void CM_SpriteModel( model_t *mod, byte *buffer )
loadmodel->maxs[2] = phdr->bounds[1] / 2;
}
static model_t *CM_ModForName( const char *name, bool world )
static model_t *CM_ModForName( const char *name, qboolean world )
{
byte *buf;
model_t *mod;
@ -1031,7 +1031,7 @@ CM_BeginRegistration
Loads in the map and all submodels
==================
*/
void CM_BeginRegistration( const char *name, bool clientload, uint *checksum )
void CM_BeginRegistration( const char *name, qboolean clientload, uint *checksum )
{
// now replacement table is invalidate
Mem_Set( sv_models, 0, sizeof( sv_models ));
@ -1171,7 +1171,7 @@ void Mod_GetBounds( int handle, vec3_t mins, vec3_t maxs )
}
}
bool CM_RegisterModel( const char *name, int index )
qboolean CM_RegisterModel( const char *name, int index )
{
model_t *mod;
@ -1182,5 +1182,5 @@ bool CM_RegisterModel( const char *name, int index )
mod = CM_ModForName( name, false );
sv_models[index] = mod;
return (mod != NULL);
return ( mod != NULL );
}

View File

@ -259,7 +259,7 @@ The client will interpolate the view position,
so we can't use a single PVS point
===========
*/
byte *CM_FatPVS( const vec3_t org, bool portal )
byte *CM_FatPVS( const vec3_t org, qboolean portal )
{
if( !cm.pvs || cm_novis->integer )
return cm.nullrow;
@ -280,7 +280,7 @@ The client will interpolate the hear position,
so we can't use a single PHS point
===========
*/
byte *CM_FatPHS( const vec3_t org, bool portal )
byte *CM_FatPHS( const vec3_t org, qboolean portal )
{
if( !cm.pvs || cm_novis->integer )
return cm.nullrow;

View File

@ -121,7 +121,7 @@ Returns true if any leaf in boxspace
is potentially visible
=============
*/
bool CM_BoxVisible( const vec3_t mins, const vec3_t maxs, const byte *visbits )
qboolean CM_BoxVisible( const vec3_t mins, const vec3_t maxs, const byte *visbits )
{
short leafList[MAX_BOX_LEAFS];
int i, count;

View File

@ -12,7 +12,7 @@ extern stdlib_api_t com;
extern vsound_exp_t *se;
extern render_exp_t *re;
_inline int CL_CreateDecalList( decallist_t *pList, bool changelevel )
_inline int CL_CreateDecalList( decallist_t *pList, qboolean changelevel )
{
if( !re ) return 0;

View File

@ -37,7 +37,7 @@
#define CS_SIZE 64 // size of one config string
#define CS_TIME 16 // size of time string
// FIXME: eliminate this. Configstrings must be started from CS_MODELS
// FIXME: get rid of configstrings
#define CS_NAME 0 // map name
#define CS_MAPCHECKSUM 1 // level checksum (for catching cheater maps)
@ -45,16 +45,13 @@
// 8 - 32 it's a reserved strings
#define CS_MODELS 8 // configstrings starts here
#define CS_SOUNDS (CS_MODELS+MAX_MODELS) // sound names
#define CS_DECALS (CS_SOUNDS+MAX_SOUNDS) // server decal indexes
#define CS_EVENTS (CS_DECALS+MAX_DECALNAMES) // queue events
#define CS_EVENTS 8 // queue events
#define CS_GENERICS (CS_EVENTS+MAX_EVENTS) // generic resources (e.g. color decals)
#define CS_LIGHTSTYLES (CS_GENERICS+MAX_GENERICS) // lightstyle patterns
#define MAX_CONFIGSTRINGS (CS_LIGHTSTYLES+MAX_LIGHTSTYLES) // total count
#ifdef _DEBUG
void DBG_AssertFunction( bool fExpr, const char* szExpr, const char* szFile, int szLine, const char* szMessage );
void DBG_AssertFunction( qboolean fExpr, const char* szExpr, const char* szFile, int szLine, const char* szMessage );
#define Assert( f ) DBG_AssertFunction( f, #f, __FILE__, __LINE__, NULL )
#else
#define Assert( f )
@ -133,7 +130,7 @@ typedef struct host_parm_s
HWND hWnd; // main window
int developer; // show all developer's message
bool key_overstrike; // key overstrike mode
qboolean key_overstrike; // key overstrike mode
// for IN_MouseMove() easy access
int window_center_x;
@ -168,13 +165,13 @@ void Host_Free( void );
void Host_SetServerState( int state );
int Host_ServerState( void );
int Host_CompareFileTime( long ft1, long ft2 );
bool Host_NewGame( const char *mapName, bool loadGame );
qboolean Host_NewGame( const char *mapName, qboolean loadGame );
void Host_EndGame( const char *message, ... );
void Host_AbortCurrentFrame( void );
void Host_WriteServerConfig( const char *name );
void Host_WriteOpenGLConfig( void );
void Host_WriteConfig( void );
bool Host_IsLocalGame( void );
qboolean Host_IsLocalGame( void );
void Host_ShutdownServer( void );
void Host_CheckChanges( void );
void Host_Print( const char *txt );
@ -191,12 +188,12 @@ CLIENT / SERVER SYSTEMS
void CL_Init( void );
void CL_Shutdown( void );
void Host_ClientFrame( void );
bool CL_Active( void );
qboolean CL_Active( void );
void SV_Init( void );
void SV_Shutdown( bool reconnect );
void SV_Shutdown( qboolean reconnect );
void Host_ServerFrame( void );
bool SV_Active( void );
qboolean SV_Active( void );
/*
==============================================================
@ -247,9 +244,9 @@ float pfnTime( void );
//
// keys.c
//
bool Key_IsDown( int keynum );
qboolean Key_IsDown( int keynum );
const char *Key_IsBind( int keynum );
void Key_Event( int key, bool down );
void Key_Event( int key, qboolean down );
void Key_Init( void );
void Key_WriteBindings( file_t *f );
const char *Key_GetBinding( int keynum );
@ -267,26 +264,26 @@ void Key_SetKeyDest( int key_dest );
typedef struct movie_state_s movie_state_t;
long AVI_GetVideoFrameNumber( movie_state_t *Avi, float time );
byte *AVI_GetVideoFrame( movie_state_t *Avi, long frame );
bool AVI_GetVideoInfo( movie_state_t *Avi, long *xres, long *yres, float *duration );
bool AVI_GetAudioInfo( movie_state_t *Avi, wavdata_t *snd_info );
qboolean AVI_GetVideoInfo( movie_state_t *Avi, long *xres, long *yres, float *duration );
qboolean AVI_GetAudioInfo( movie_state_t *Avi, wavdata_t *snd_info );
fs_offset_t AVI_GetAudioChunk( movie_state_t *Avi, char *audiodata, long offset, long length );
void AVI_OpenVideo( movie_state_t *Avi, const char *filename, bool load_audio, bool ignore_hwgamma, bool quiet );
void AVI_OpenVideo( movie_state_t *Avi, const char *filename, qboolean load_audio, qboolean ignore_hwgamma, qboolean quiet );
void AVI_CloseVideo( movie_state_t *Avi );
bool AVI_IsActive( movie_state_t *Avi );
qboolean AVI_IsActive( movie_state_t *Avi );
movie_state_t *AVI_GetState( int num );
// shared calls
bool CL_IsInGame( void );
bool CL_IsInMenu( void );
qboolean CL_IsInGame( void );
qboolean CL_IsInMenu( void );
float CL_GetServerTime( void );
void CL_CharEvent( int key );
void Tri_DrawTriangles( int fTrans );
int CL_PointContents( const vec3_t point );
char *COM_ParseFile( char *data, char *token );
void CL_StudioFxTransform( struct cl_entity_s *ent, float transform[4][4] );
bool CL_GetEntitySpatialization( int entnum, vec3_t origin, vec3_t velocity );
qboolean CL_GetEntitySpatialization( int entnum, vec3_t origin, vec3_t velocity );
void CL_StudioEvent( struct mstudioevent_s *event, struct cl_entity_s *ent );
bool CL_GetComment( const char *demoname, char *comment );
qboolean CL_GetComment( const char *demoname, char *comment );
struct pmtrace_s *PM_TraceLine( float *start, float *end, int flags, int usehull, int ignore_pe );
void SV_StartSound( edict_t *ent, int chan, const char *sample, float vol, float attn, int flags, int pitch );
struct cl_entity_s *CL_GetEntityByIndex( int index );
@ -294,9 +291,9 @@ struct cl_entity_s *CL_GetLocalPlayer( void );
struct player_info_s *CL_GetPlayerInfo( int playerIndex );
void CL_ExtraUpdate( void );
int CL_GetMaxClients( void );
bool CL_IsPlaybackDemo( void );
bool SV_GetComment( const char *savename, char *comment );
bool SV_NewGame( const char *mapName, bool loadGame );
qboolean CL_IsPlaybackDemo( void );
qboolean SV_GetComment( const char *savename, char *comment );
qboolean SV_NewGame( const char *mapName, qboolean loadGame );
void SV_SysError( const char *error_string );
void SV_InitGameProgs( void );
void SV_ForceError( void );
@ -304,7 +301,7 @@ void CL_WriteMessageHistory( void );
void CL_MouseEvent( int mx, int my );
void CL_SendCmd( void );
void CL_Disconnect( void );
bool CL_NextDemo( void );
qboolean CL_NextDemo( void );
void CL_Drop( void );
void CL_ForceVid( void );
void CL_ForceSnd( void );
@ -319,21 +316,21 @@ void Con_NPrintf( int idx, char *fmt, ... );
void Con_NXPrintf( struct con_nprint_s *info, char *fmt, ... );
char *Info_ValueForKey( const char *s, const char *key );
void Info_RemovePrefixedKeys( char *start, char prefix );
bool Info_RemoveKey( char *s, const char *key );
bool Info_SetValueForKey( char *s, const char *key, const char *value );
bool Info_Validate( const char *s );
qboolean Info_RemoveKey( char *s, const char *key );
qboolean Info_SetValueForKey( char *s, const char *key, const char *value );
qboolean Info_Validate( const char *s );
void Info_Print( const char *s );
char *Cvar_Userinfo( void );
char *Cvar_Serverinfo( void );
void Cmd_WriteVariables( file_t *f );
bool Cmd_CheckMapsList( bool fRefresh );
qboolean Cmd_CheckMapsList( qboolean fRefresh );
void Cmd_ForwardToServer( void );
void Cmd_AutoComplete( char *complete_string );
typedef struct autocomplete_list_s
{
const char *name;
bool (*func)( const char *s, char *name, int length );
qboolean (*func)( const char *s, char *name, int length );
} autocomplete_list_t;
extern autocomplete_list_t cmd_list[];

View File

@ -10,7 +10,7 @@
#include "bspfile.h"
#ifdef _DEBUG
void DBG_AssertFunction( bool fExpr, const char* szExpr, const char* szFile, int szLine, const char* szMessage )
void DBG_AssertFunction( qboolean fExpr, const char* szExpr, const char* szFile, int szLine, const char* szMessage )
{
if( fExpr ) return;
@ -33,7 +33,7 @@ Cmd_GetMapList
Prints or complete map filename
=====================================
*/
bool Cmd_GetMapList( const char *s, char *completedname, int length )
qboolean Cmd_GetMapList( const char *s, char *completedname, int length )
{
search_t *t;
file_t *f;
@ -56,7 +56,7 @@ bool Cmd_GetMapList( const char *s, char *completedname, int length )
int ver = -1, lumpofs = 0, lumplen = 0;
const char *ext = FS_FileExtension( t->filenames[i] );
script_t *ents = NULL;
bool gearbox;
qboolean gearbox;
if( com.stricmp( ext, "bsp" )) continue;
com.strncpy( message, "^1error^7", sizeof( message ));
@ -163,7 +163,7 @@ Cmd_GetFontList
Prints or complete font filename
=====================================
*/
bool Cmd_GetFontList( const char *s, char *completedname, int length )
qboolean Cmd_GetFontList( const char *s, char *completedname, int length )
{
search_t *t;
string matchbuf;
@ -208,7 +208,7 @@ Cmd_GetDemoList
Prints or complete demo filename
=====================================
*/
bool Cmd_GetDemoList( const char *s, char *completedname, int length )
qboolean Cmd_GetDemoList( const char *s, char *completedname, int length )
{
search_t *t;
string matchbuf;
@ -252,7 +252,7 @@ Cmd_GetMovieList
Prints or complete movie filename
=====================================
*/
bool Cmd_GetMovieList( const char *s, char *completedname, int length )
qboolean Cmd_GetMovieList( const char *s, char *completedname, int length )
{
search_t *t;
string matchbuf;
@ -297,7 +297,7 @@ Cmd_GetMusicList
Prints or complete background track filename
=====================================
*/
bool Cmd_GetMusicList( const char *s, char *completedname, int length )
qboolean Cmd_GetMusicList( const char *s, char *completedname, int length )
{
search_t *t;
string matchbuf;
@ -343,7 +343,7 @@ Cmd_GetSavesList
Prints or complete savegame filename
=====================================
*/
bool Cmd_GetSavesList( const char *s, char *completedname, int length )
qboolean Cmd_GetSavesList( const char *s, char *completedname, int length )
{
search_t *t;
string matchbuf;
@ -388,7 +388,7 @@ Cmd_GetConfigList
Prints or complete .cfg filename
=====================================
*/
bool Cmd_GetConfigList( const char *s, char *completedname, int length )
qboolean Cmd_GetConfigList( const char *s, char *completedname, int length )
{
search_t *t;
string matchbuf;
@ -433,7 +433,7 @@ Cmd_GetSoundList
Prints or complete sound filename
=====================================
*/
bool Cmd_GetSoundList( const char *s, char *completedname, int length )
qboolean Cmd_GetSoundList( const char *s, char *completedname, int length )
{
search_t *t;
string matchbuf;
@ -475,7 +475,7 @@ bool Cmd_GetSoundList( const char *s, char *completedname, int length )
return true;
}
bool Cmd_GetStringTablesList( const char *s, char *completedname, int length )
qboolean Cmd_GetStringTablesList( const char *s, char *completedname, int length )
{
int i, numtables;
string tables[MAX_STRING_TABLES];
@ -521,7 +521,7 @@ Cmd_GetItemsList
Prints or complete item classname
=====================================
*/
bool Cmd_GetItemsList( const char *s, char *completedname, int length )
qboolean Cmd_GetItemsList( const char *s, char *completedname, int length )
{
search_t *t;
string matchbuf;
@ -566,7 +566,7 @@ Cmd_GetTexturemodes
Prints or complete sound filename
=====================================
*/
bool Cmd_GetTexturemodes( const char *s, char *completedname, int length )
qboolean Cmd_GetTexturemodes( const char *s, char *completedname, int length )
{
int i, numtexturemodes;
string texturemodes[6]; // keep an actual ( sizeof( gl_texturemode) / sizeof( gl_texturemode[0] ))
@ -620,7 +620,7 @@ Cmd_GetGameList
Prints or complete gamedir name
=====================================
*/
bool Cmd_GetGamesList( const char *s, char *completedname, int length )
qboolean Cmd_GetGamesList( const char *s, char *completedname, int length )
{
int i, numgamedirs;
string gamedirs[MAX_MODS];
@ -657,7 +657,7 @@ bool Cmd_GetGamesList( const char *s, char *completedname, int length )
return true;
}
bool Cmd_CheckMapsList( bool fRefresh )
qboolean Cmd_CheckMapsList( qboolean fRefresh )
{
byte buf[MAX_MSGLEN];
char *buffer;
@ -732,7 +732,7 @@ bool Cmd_CheckMapsList( bool fRefresh )
// if there are entities to parse, a missing message key just
// means there is no title, so clear the message string now
token_t token;
bool worldspawn = true;
qboolean worldspawn = true;
message[0] = 0;
com.strncpy( message, "No Title", MAX_STRING );

View File

@ -45,7 +45,7 @@ typedef struct
typedef struct
{
bool initialized;
qboolean initialized;
short text[CON_TEXTSIZE];
int current; // line where next message will be printed
@ -307,7 +307,7 @@ void Con_Bottom( void )
Con_Visible
================
*/
bool Con_Visible( void )
qboolean Con_Visible( void )
{
return (con.finalFrac != 0.0f);
}
@ -453,7 +453,7 @@ Draws a multi-colored string, optionally forcing
to a fixed color.
==================
*/
int Con_DrawGenericString( int x, int y, const char *string, rgba_t setColor, bool forceColor, int hideChar )
int Con_DrawGenericString( int x, int y, const char *string, rgba_t setColor, qboolean forceColor, int hideChar )
{
rgba_t color;
int drawLen = 0;
@ -545,7 +545,7 @@ void Con_Init( void )
Con_Linefeed
===============
*/
void Con_Linefeed( bool skipnotify )
void Con_Linefeed( qboolean skipnotify )
{
int i;
@ -575,7 +575,7 @@ If no console is visible, the text will appear at the top of the game window
void Con_Print( const char *txt )
{
int y, c, l, color;
bool skipnotify = false;
qboolean skipnotify = false;
int prev;
// client not running
@ -668,7 +668,7 @@ Cmd_CheckName
compare first argument with string
===============
*/
static bool Cmd_CheckName( const char *name )
static qboolean Cmd_CheckName( const char *name )
{
if( !com.stricmp( Cmd_Argv( 0 ), name ))
return true;
@ -790,7 +790,7 @@ void Con_CompleteCommand( field_t *field )
if( Cmd_Argc() == 2 )
{
bool result = false;
qboolean result = false;
// autocomplete second arg
for( list = cmd_list; list->name; list++ )

View File

@ -60,9 +60,9 @@ void Host_Null( void )
Host_NewGame
================
*/
bool Host_NewGame( const char *mapName, bool loadGame )
qboolean Host_NewGame( const char *mapName, qboolean loadGame )
{
bool iRet;
qboolean iRet;
iRet = SV_NewGame( mapName, loadGame );
@ -117,11 +117,11 @@ void Host_FreeRender( void )
Sys_FreeLibrary( &render_dll );
}
bool Host_InitRender( void )
qboolean Host_InitRender( void )
{
static render_imp_t ri;
launch_t CreateRender;
bool result = false;
qboolean result = false;
ri.api_size = sizeof( render_imp_t );
@ -164,11 +164,11 @@ void Host_FreeSound( void )
Sys_FreeLibrary( &vsound_dll );
}
bool Host_InitSound( void )
qboolean Host_InitSound( void )
{
static vsound_imp_t si;
launch_t CreateSound;
bool result = false;
qboolean result = false;
if( FS_CheckParm( "-nosound" ))
return result;
@ -204,7 +204,7 @@ bool Host_InitSound( void )
void Host_CheckChanges( void )
{
int num_changes;
bool audio_disabled = false;
qboolean audio_disabled = false;
if( FS_CheckParm( "-nosound" ))
{
@ -225,7 +225,7 @@ void Host_CheckChanges( void )
if( host_video->modified && CL_Active( ))
{
// we're in game and want keep decals when renderer is changed
host.decalList = (decallist_t *)Z_Malloc( sizeof( decallist_t ) * MAX_DECALS );
host.decalList = (decallist_t *)Z_Malloc( sizeof( decallist_t ) * MAX_RENDER_DECALS );
host.numdecals = CL_CreateDecalList( host.decalList, false );
}
@ -365,7 +365,7 @@ void Host_Minimize_f( void )
if( host.hWnd ) ShowWindow( host.hWnd, SW_MINIMIZE );
}
bool Host_IsLocalGame( void )
qboolean Host_IsLocalGame( void )
{
if( CL_Active() && SV_Active() && CL_GetMaxClients() == 1 )
return true;
@ -392,7 +392,7 @@ Host_PushEvent
void Host_PushEvent( sys_event_t *event )
{
sys_event_t *ev;
static bool overflow = false;
static qboolean overflow = false;
ev = &host.events[host.events_head & (MAX_SYSEVENTS-1)];
@ -502,7 +502,7 @@ Host_FilterTime
Returns false if the time is too short to run a frame
===================
*/
bool Host_FilterTime( float time )
qboolean Host_FilterTime( float time )
{
static double oldtime;
float fps;
@ -605,7 +605,7 @@ void Host_Error( const char *error, ... )
{
static char hosterror1[MAX_SYSPATH];
static char hosterror2[MAX_SYSPATH];
static bool recursive = false;
static qboolean recursive = false;
va_list argptr;
va_start( argptr, error );
@ -883,4 +883,33 @@ void Host_Free( void )
CL_Shutdown();
NET_Shutdown();
Host_FreeCommon();
}
// main DLL entry point
BOOL WINAPI DllMain( HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved )
{
return TRUE;
}
/*
=================
Engine entry point
=================
*/
launch_exp_t EXPORT *CreateAPI( stdlib_api_t *input, void *unused )
{
static launch_exp_t Host;
com = *input;
Host.api_size = sizeof( launch_exp_t );
Host.com_size = sizeof( stdlib_api_t );
Host.Init = Host_Init;
Host.Main = Host_Main;
Host.Free = Host_Free;
Host.CPrint = Host_Print;
Host.CmdForward = Cmd_ForwardToServer;
Host.CmdComplete = Cmd_AutoComplete;
return &Host;
}

View File

@ -110,7 +110,7 @@ char *Info_ValueForKey( const char *s, const char *key )
}
}
bool Info_RemoveKey( char *s, const char *key )
qboolean Info_RemoveKey( char *s, const char *key )
{
char *start;
char pkey[MAX_INFO_STRING];
@ -198,14 +198,14 @@ Some characters are illegal in info strings because they
can mess up the server's parsing
==================
*/
bool Info_Validate( const char *s )
qboolean Info_Validate( const char *s )
{
if( com.strstr( s, "\"" )) return false;
if( com.strstr( s, ";" )) return false;
return true;
}
bool Info_SetValueForKey( char *s, const char *key, const char *value )
qboolean Info_SetValueForKey( char *s, const char *key, const char *value )
{
char newi[MAX_INFO_STRING], *v;
int c, maxsize = MAX_INFO_STRING;

View File

@ -19,14 +19,14 @@
#define WND_HEADSIZE wnd_caption // some offset
#define WND_BORDER 3 // sentinel border in pixels
bool in_mouseactive; // false when not focus app
bool in_restore_spi;
bool in_mouseinitialized;
qboolean in_mouseactive; // false when not focus app
qboolean in_restore_spi;
qboolean in_mouseinitialized;
int in_originalmouseparms[3];
int in_mouse_oldbuttonstate;
int in_newmouseparms[3] = { 0, 0, 1 };
bool in_mouse_suspended;
bool in_mouseparmsvalid;
qboolean in_mouse_suspended;
qboolean in_mouseparmsvalid;
int in_mouse_buttons;
RECT window_rect, real_rect;
uint in_mouse_wheel;
@ -73,7 +73,7 @@ Map from windows to engine keynums
static int Host_MapKey( int key )
{
int result, modified;
bool is_extended = false;
qboolean is_extended = false;
modified = ( key >> 16 ) & 255;
if( modified > 127 ) return 0;
@ -129,7 +129,7 @@ void IN_StartupMouse( void )
in_mouse_wheel = RegisterWindowMessage( "MSWHEEL_ROLLMSG" );
}
static bool IN_CursorInRect( void )
static qboolean IN_CursorInRect( void )
{
POINT curpos;
@ -338,7 +338,7 @@ Called every frame, even if not generating commands
*/
void Host_InputFrame( void )
{
bool shutdownMouse = false;
qboolean shutdownMouse = false;
rand (); // keep the random time dependent

View File

@ -9,7 +9,7 @@
typedef struct key_s
{
bool down;
qboolean down;
int repeats; // if > 1, it is autorepeating
const char *binding;
} key_t;
@ -94,7 +94,7 @@ keyname_t keynames[] =
Key_IsDown
===================
*/
bool Key_IsDown( int keynum )
qboolean Key_IsDown( int keynum )
{
if ( keynum == -1 )
return false;
@ -450,7 +450,7 @@ void Key_AddKeyUpCommands( int key, const char *kb )
int i;
char button[1024], *buttonPtr;
char cmd[1024];
bool keyevent;
qboolean keyevent;
if( !kb ) return;
keyevent = false;
@ -494,7 +494,7 @@ Key_Event
Called by the system for both key up and key down events
===================
*/
void Key_Event( int key, bool down )
void Key_Event( int key, qboolean down )
{
const char *kb;
char cmd[1024];

View File

@ -75,14 +75,14 @@ void BF_Clear( sizebuf_t *bf )
bf->bOverflow = false;
}
static bool BF_Overflow( sizebuf_t *bf, int nBits )
static qboolean BF_Overflow( sizebuf_t *bf, int nBits )
{
if( bf->iCurBit + nBits > bf->nDataBits )
bf->bOverflow = true;
return bf->bOverflow;
}
bool BF_CheckOverflow( sizebuf_t *bf )
qboolean BF_CheckOverflow( sizebuf_t *bf )
{
ASSERT( bf );
@ -110,7 +110,7 @@ void BF_WriteOneBit( sizebuf_t *bf, int nValue )
}
}
void BF_WriteUBitLongExt( sizebuf_t *bf, uint curData, int numbits, bool bCheckRange )
void BF_WriteUBitLongExt( sizebuf_t *bf, uint curData, int numbits, qboolean bCheckRange )
{
#ifdef _NETDEBUG
// make sure it doesn't overflow.
@ -200,14 +200,14 @@ void BF_WriteSBitLong( sizebuf_t *bf, int data, int numbits )
}
}
void BF_WriteBitLong( sizebuf_t *bf, uint data, int numbits, bool bSigned )
void BF_WriteBitLong( sizebuf_t *bf, uint data, int numbits, qboolean bSigned )
{
if( bSigned )
BF_WriteSBitLong( bf, (int)data, numbits );
else BF_WriteUBitLong( bf, data, numbits );
}
bool BF_WriteBits( sizebuf_t *bf, const void *pData, int nBits )
qboolean BF_WriteBits( sizebuf_t *bf, const void *pData, int nBits )
{
byte *pOut = (byte *)pData;
int nBitsLeft = nBits;
@ -396,12 +396,12 @@ void BF_WriteFloat( sizebuf_t *bf, float val )
BF_WriteBits( bf, &val, sizeof( val ) << 3 );
}
bool BF_WriteBytes( sizebuf_t *bf, const void *pBuf, int nBytes )
qboolean BF_WriteBytes( sizebuf_t *bf, const void *pBuf, int nBytes )
{
return BF_WriteBits( bf, pBuf, nBytes << 3 );
}
bool BF_WriteString( sizebuf_t *bf, const char *pStr )
qboolean BF_WriteString( sizebuf_t *bf, const char *pStr )
{
if( pStr )
{
@ -501,7 +501,7 @@ float BF_ReadBitFloat( sizebuf_t *bf )
return *((float *)&val);
}
bool BF_ReadBits( sizebuf_t *bf, void *pOutData, int nBits )
qboolean BF_ReadBits( sizebuf_t *bf, void *pOutData, int nBits )
{
byte *pOut = (byte *)pOutData;
int nBitsLeft = nBits;
@ -572,7 +572,7 @@ int BF_ReadSBitLong( sizebuf_t *bf, int numbits )
return r;
}
uint BF_ReadBitLong( sizebuf_t *bf, int numbits, bool bSigned )
uint BF_ReadBitLong( sizebuf_t *bf, int numbits, qboolean bSigned )
{
if( bSigned )
return (uint)BF_ReadSBitLong( bf, numbits );
@ -711,12 +711,12 @@ float BF_ReadFloat( sizebuf_t *bf )
return ret;
}
bool BF_ReadBytes( sizebuf_t *bf, void *pOut, int nBytes )
qboolean BF_ReadBytes( sizebuf_t *bf, void *pOut, int nBytes )
{
return BF_ReadBits( bf, pOut, nBytes << 3 );
}
char *BF_ReadStringExt( sizebuf_t *bf, bool bLine )
char *BF_ReadStringExt( sizebuf_t *bf, qboolean bLine )
{
static char string[MAX_SYSPATH];
int l = 0, c;

View File

@ -24,7 +24,7 @@ _inline int BitByte( int bits )
typedef struct
{
bool bOverflow; // overflow reading or writing
qboolean bOverflow; // overflow reading or writing
const char *pDebugName; // buffer name (pointer to const name)
byte *pData;
@ -48,7 +48,7 @@ void BF_InitMasks( void ); // called once at startup engine
void BF_SeekToBit( sizebuf_t *bf, int bitPos );
void BF_SeekToByte( sizebuf_t *bf, int bytePos );
void BF_ExciseBits( sizebuf_t *bf, int startbit, int bitstoremove );
bool BF_CheckOverflow( sizebuf_t *bf );
qboolean BF_CheckOverflow( sizebuf_t *bf );
// init writing
void BF_StartWriting( sizebuf_t *bf, void *pData, int nBytes, int iStartBit, int nBits );
@ -56,10 +56,10 @@ void BF_Clear( sizebuf_t *bf );
// Bit-write functions
void BF_WriteOneBit( sizebuf_t *bf, int nValue );
void BF_WriteUBitLongExt( sizebuf_t *bf, uint curData, int numbits, bool bCheckRange );
void BF_WriteUBitLongExt( sizebuf_t *bf, uint curData, int numbits, qboolean bCheckRange );
void BF_WriteSBitLong( sizebuf_t *bf, int data, int numbits );
void BF_WriteBitLong( sizebuf_t *bf, uint data, int numbits, bool bSigned );
bool BF_WriteBits( sizebuf_t *bf, const void *pData, int nBits );
void BF_WriteBitLong( sizebuf_t *bf, uint data, int numbits, qboolean bSigned );
qboolean BF_WriteBits( sizebuf_t *bf, const void *pData, int nBits );
void BF_WriteBitAngle( sizebuf_t *bf, float fAngle, int numbits );
void BF_WriteBitCoord( sizebuf_t *bf, const float f );
void BF_WriteBitFloat( sizebuf_t *bf, float val );
@ -75,11 +75,11 @@ void BF_WriteShort( sizebuf_t *bf, int val );
void BF_WriteWord( sizebuf_t *bf, int val );
void BF_WriteLong( sizebuf_t *bf, long val );
void BF_WriteFloat( sizebuf_t *bf, float val );
bool BF_WriteBytes( sizebuf_t *bf, const void *pBuf, int nBytes ); // same as MSG_WriteData
bool BF_WriteString( sizebuf_t *bf, const char *pStr ); // returns false if it overflows the buffer.
qboolean BF_WriteBytes( sizebuf_t *bf, const void *pBuf, int nBytes ); // same as MSG_WriteData
qboolean BF_WriteString( sizebuf_t *bf, const char *pStr ); // returns false if it overflows the buffer.
// delta-write functions
bool BF_WriteDeltaMovevars( sizebuf_t *sb, struct movevars_s *from, struct movevars_s *to );
qboolean BF_WriteDeltaMovevars( sizebuf_t *sb, struct movevars_s *from, struct movevars_s *to );
// helper functions
_inline int BF_GetNumBytesWritten( sizebuf_t *bf ) { return BitByte( bf->iCurBit ); }
@ -94,11 +94,11 @@ _inline byte *BF_GetData( sizebuf_t *bf ) { return bf->pData; }
// Bit-read functions
int BF_ReadOneBit( sizebuf_t *bf );
float BF_ReadBitFloat( sizebuf_t *bf );
bool BF_ReadBits( sizebuf_t *bf, void *pOutData, int nBits );
qboolean BF_ReadBits( sizebuf_t *bf, void *pOutData, int nBits );
float BF_ReadBitAngle( sizebuf_t *bf, int numbits );
int BF_ReadSBitLong( sizebuf_t *bf, int numbits );
uint BF_ReadUBitLong( sizebuf_t *bf, int numbits );
uint BF_ReadBitLong( sizebuf_t *bf, int numbits, bool bSigned );
uint BF_ReadBitLong( sizebuf_t *bf, int numbits, qboolean bSigned );
float BF_ReadBitCoord( sizebuf_t *bf );
void BF_ReadBitVec3Coord( sizebuf_t *bf, vec3_t fa );
float BF_ReadBitNormal( sizebuf_t *bf );
@ -111,8 +111,8 @@ int BF_ReadShort( sizebuf_t *bf );
int BF_ReadWord( sizebuf_t *bf );
long BF_ReadLong( sizebuf_t *bf );
float BF_ReadFloat( sizebuf_t *bf );
bool BF_ReadBytes( sizebuf_t *bf, void *pOut, int nBytes );
char *BF_ReadStringExt( sizebuf_t *bf, bool bLine );
qboolean BF_ReadBytes( sizebuf_t *bf, void *pOut, int nBytes );
char *BF_ReadStringExt( sizebuf_t *bf, qboolean bLine );
// delta-read functions
void BF_ReadDeltaMovevars( sizebuf_t *sb, struct movevars_s *from, struct movevars_s *to );

View File

@ -164,7 +164,7 @@ Netchan_IncomingReady
==============================
*/
bool Netchan_IncomingReady( netchan_t *chan )
qboolean Netchan_IncomingReady( netchan_t *chan )
{
int i;
@ -185,7 +185,7 @@ Netchan_CanPacket
Returns true if the bandwidth choke isn't active
================
*/
bool Netchan_CanPacket( netchan_t *chan )
qboolean Netchan_CanPacket( netchan_t *chan )
{
// never choke loopback packets.
if( !net_chokeloopback->integer && NET_IsLocalAddress( chan->remote_address ))
@ -556,7 +556,7 @@ Netchan_CreateFragments_
==============================
*/
void Netchan_CreateFragments_( bool server, netchan_t *chan, sizebuf_t *msg )
void Netchan_CreateFragments_( qboolean server, netchan_t *chan, sizebuf_t *msg )
{
fragbuf_t *buf;
int chunksize;
@ -615,7 +615,7 @@ Netchan_CreateFragments
==============================
*/
void Netchan_CreateFragments( bool server, netchan_t *chan, sizebuf_t *msg )
void Netchan_CreateFragments( qboolean server, netchan_t *chan, sizebuf_t *msg )
{
// always queue any pending reliable data ahead of the fragmentation buffer
if( BF_GetNumBytesWritten( &chan->message ) > 0 )
@ -633,7 +633,7 @@ Netchan_FindBufferById
==============================
*/
fragbuf_t *Netchan_FindBufferById( fragbuf_t **pplist, int id, bool allocate )
fragbuf_t *Netchan_FindBufferById( fragbuf_t **pplist, int id, qboolean allocate )
{
fragbuf_t *list = *pplist;
fragbuf_t *pnewbuf;
@ -706,13 +706,13 @@ Netchan_CreateFileFragmentsFromBuffer
==============================
*/
void Netchan_CreateFileFragmentsFromBuffer ( bool server, netchan_t *chan, char *filename, byte *pbuf, int size )
void Netchan_CreateFileFragmentsFromBuffer ( qboolean server, netchan_t *chan, char *filename, byte *pbuf, int size )
{
int chunksize;
int send, pos;
int remaining;
int bufferid = 1;
bool firstfragment = true;
qboolean firstfragment = true;
fragbufwaiting_t *wait, *p;
fragbuf_t *buf;
@ -780,14 +780,14 @@ Netchan_CreateFileFragments
==============================
*/
int Netchan_CreateFileFragments( bool server, netchan_t *chan, const char *filename )
int Netchan_CreateFileFragments( qboolean server, netchan_t *chan, const char *filename )
{
int chunksize;
int send, pos;
int remaining;
int bufferid = 1;
int filesize = 0;
bool firstfragment = true;
qboolean firstfragment = true;
fragbufwaiting_t *wait, *p;
fragbuf_t *buf;
@ -884,7 +884,7 @@ Netchan_CopyNormalFragments
==============================
*/
bool Netchan_CopyNormalFragments( netchan_t *chan, sizebuf_t *msg )
qboolean Netchan_CopyNormalFragments( netchan_t *chan, sizebuf_t *msg )
{
fragbuf_t *p, *n;
@ -927,7 +927,7 @@ Netchan_CopyFileFragments
==============================
*/
bool Netchan_CopyFileFragments( netchan_t *chan, sizebuf_t *msg )
qboolean Netchan_CopyFileFragments( netchan_t *chan, sizebuf_t *msg )
{
fragbuf_t *p, *n;
char filename[CS_SIZE];
@ -1149,9 +1149,9 @@ void Netchan_TransmitBits( netchan_t *chan, int length, byte *data )
{
sizebuf_t send;
byte send_buf[NET_MAX_MESSAGE];
bool send_reliable_fragment;
bool send_resending = false;
bool send_reliable;
qboolean send_reliable_fragment;
qboolean send_resending = false;
qboolean send_reliable;
size_t size1, size2;
uint w1, w2;
int i, j;
@ -1182,7 +1182,7 @@ void Netchan_TransmitBits( netchan_t *chan, int length, byte *data )
// if the reliable transmit buffer is empty, copy the current message out
if( !chan->reliable_length )
{
bool send_frag = false;
qboolean send_frag = false;
fragbuf_t *pbuf;
// will be true if we are active and should let chan->message get some bandwidth
@ -1467,15 +1467,15 @@ called when the current net_message is from remote_address
modifies net_message so that it points to the packet payload
=================
*/
bool Netchan_Process( netchan_t *chan, sizebuf_t *msg )
qboolean Netchan_Process( netchan_t *chan, sizebuf_t *msg )
{
uint sequence, sequence_ack;
uint reliable_ack, reliable_message;
uint fragid[MAX_STREAMS] = { 0, 0 };
bool frag_message[MAX_STREAMS] = { false, false };
qboolean frag_message[MAX_STREAMS] = { false, false };
int frag_offset[MAX_STREAMS] = { 0, 0 };
int frag_length[MAX_STREAMS] = { 0, 0 };
bool message_contains_fragments;
qboolean message_contains_fragments;
size_t size1, size2;
int i, qport;

View File

@ -13,10 +13,11 @@
#include "pm_movevars.h"
#include "entity_state.h"
#include "weaponinfo.h"
#include "event_args.h"
#include "protocol.h"
#define DELTA_PATH "delta.lst"
static bool delta_init = false;
static qboolean delta_init = false;
// list of all the struct names
static const delta_field_t cmd_fields[] =
@ -274,10 +275,6 @@ static const delta_field_t ent_fields[] =
{ ENTS_DEF( vuser4[0] ) },
{ ENTS_DEF( vuser4[1] ) },
{ ENTS_DEF( vuser4[2] ) },
{ ENTS_DEF( classname ) },
{ ENTS_DEF( targetname ) },
{ ENTS_DEF( target ) },
{ ENTS_DEF( netname ) },
{ NULL },
};
@ -401,7 +398,7 @@ int Delta_IndexForFieldInfo( const delta_field_t *pInfo, const char *fieldName )
return -1;
}
bool Delta_AddField( const char *pStructName, const char *pName, int flags, int bits, float mul, float post_mul )
qboolean Delta_AddField( const char *pStructName, const char *pName, int flags, int bits, float mul, float post_mul )
{
delta_info_t *dt;
delta_field_t *pFieldInfo;
@ -524,7 +521,7 @@ void Delta_ParseTableField( sizebuf_t *msg )
Delta_AddField( dt->pName, pName, flags, bits, mul, post_mul );
}
bool Delta_ParseField( script_t *delta_script, const delta_field_t *pInfo, delta_t *pField, bool bPost )
qboolean Delta_ParseField( script_t *delta_script, const delta_field_t *pInfo, delta_t *pField, qboolean bPost )
{
token_t token;
delta_field_t *pFieldInfo;
@ -847,7 +844,7 @@ compare fields by offsets
assume from and to is valid
=====================
*/
bool Delta_CompareField( delta_t *pField, void *from, void *to )
qboolean Delta_CompareField( delta_t *pField, void *from, void *to )
{
int fromF, toF;
@ -926,9 +923,9 @@ write fields by offsets
assume from and to is valid
=====================
*/
bool Delta_WriteField( sizebuf_t *msg, delta_t *pField, void *from, void *to, float timebase )
qboolean Delta_WriteField( sizebuf_t *msg, delta_t *pField, void *from, void *to, float timebase )
{
bool bSigned = ( pField->flags & DT_SIGNED ) ? true : false;
qboolean bSigned = ( pField->flags & DT_SIGNED ) ? true : false;
float flValue, flAngle, flTime;
uint iValue;
const char *pStr;
@ -997,11 +994,11 @@ read fields by offsets
assume from and to is valid
=====================
*/
bool Delta_ReadField( sizebuf_t *msg, delta_t *pField, void *from, void *to, float timebase )
qboolean Delta_ReadField( sizebuf_t *msg, delta_t *pField, void *from, void *to, float timebase )
{
bool bSigned = ( pField->flags & DT_SIGNED ) ? true : false;
qboolean bSigned = ( pField->flags & DT_SIGNED ) ? true : false;
float flValue, flAngle, flTime;
bool bChanged;
qboolean bChanged;
uint iValue;
const char *pStr;
char *pOut;
@ -1233,7 +1230,7 @@ movevars_t communication
=============================================================================
*/
bool MSG_WriteDeltaMovevars( sizebuf_t *msg, movevars_t *from, movevars_t *to )
qboolean MSG_WriteDeltaMovevars( sizebuf_t *msg, movevars_t *from, movevars_t *to )
{
delta_t *pField;
delta_info_t *dt;
@ -1448,7 +1445,7 @@ If force is not set, then nothing at all will be generated if the entity is
identical, under the assumption that the in-order delta code will catch it.
==================
*/
void MSG_WriteDeltaEntity( entity_state_t *from, entity_state_t *to, sizebuf_t *msg, bool force, bool player, float timebase )
void MSG_WriteDeltaEntity( entity_state_t *from, entity_state_t *to, sizebuf_t *msg, qboolean force, qboolean player, float timebase )
{
delta_info_t *dt = NULL;
delta_t *pField;
@ -1536,7 +1533,7 @@ If the delta removes the entity, entity_state_t->number will be set to MAX_EDICT
Can go from either a baseline or a previous packet_entity
==================
*/
bool MSG_ReadDeltaEntity( sizebuf_t *msg, entity_state_t *from, entity_state_t *to, int number, bool player, float timebase )
qboolean MSG_ReadDeltaEntity( sizebuf_t *msg, entity_state_t *from, entity_state_t *to, int number, qboolean player, float timebase )
{
delta_info_t *dt = NULL;
delta_t *pField;

View File

@ -50,7 +50,7 @@ typedef struct delta_s
float multiplier;
float post_multiplier; // for DEFINE_DELTA_POST
int bits; // how many bits we send\receive
bool bInactive; // unsetted by user request
qboolean bInactive; // unsetted by user request
} delta_t;
typedef void (*pfnDeltaEncode)( delta_t *pFields, const byte *from, const byte *to );
@ -67,7 +67,7 @@ typedef struct
int customEncode;
char funcName[32];
pfnDeltaEncode userCallback;
bool bInitialized;
qboolean bInitialized;
} delta_info_t;
//
@ -96,13 +96,13 @@ void MSG_WriteDeltaUsercmd( sizebuf_t *msg, struct usercmd_s *from, struct userc
void MSG_ReadDeltaUsercmd( sizebuf_t *msg, struct usercmd_s *from, struct usercmd_s *to );
void MSG_WriteDeltaEvent( sizebuf_t *msg, struct event_args_s *from, struct event_args_s *to );
void MSG_ReadDeltaEvent( sizebuf_t *msg, struct event_args_s *from, struct event_args_s *to );
bool MSG_WriteDeltaMovevars( sizebuf_t *msg, struct movevars_s *from, struct movevars_s *to );
qboolean MSG_WriteDeltaMovevars( sizebuf_t *msg, struct movevars_s *from, struct movevars_s *to );
void MSG_ReadDeltaMovevars( sizebuf_t *msg, struct movevars_s *from, struct movevars_s *to );
void MSG_WriteClientData( sizebuf_t *msg, struct clientdata_s *from, struct clientdata_s *to, float timebase );
void MSG_ReadClientData( sizebuf_t *msg, struct clientdata_s *from, struct clientdata_s *to, float timebase );
void MSG_WriteWeaponData( sizebuf_t *msg, struct weapon_data_s *from, struct weapon_data_s *to, float timebase, int index );
void MSG_ReadWeaponData( sizebuf_t *msg, struct weapon_data_s *from, struct weapon_data_s *to, float timebase );
void MSG_WriteDeltaEntity( struct entity_state_s *from, struct entity_state_s *to, sizebuf_t *msg, bool force, bool player, float timebase );
bool MSG_ReadDeltaEntity( sizebuf_t *msg, struct entity_state_s *from, struct entity_state_s *to, int num, bool player, float timebase );
void MSG_WriteDeltaEntity( struct entity_state_s *from, struct entity_state_s *to, sizebuf_t *msg, qboolean force, qboolean player, float timebase );
qboolean MSG_ReadDeltaEntity( sizebuf_t *msg, struct entity_state_s *from, struct entity_state_s *to, int num, qboolean player, float timebase );
#endif//NET_ENCODE_H

View File

@ -62,7 +62,7 @@ static tree_t huffTree;
// received from MSG_* code
static int huffBitPos;
static bool huffInit = false;
static qboolean huffInit = false;
/*
=======================================================================================

View File

@ -97,8 +97,8 @@ typedef struct fragbuf_s
int bufferid; // id of this buffer
sizebuf_t frag_message; // message buffer where raw data is stored
byte frag_message_buf[FRAGMENT_SIZE]; // the actual data sits here
bool isfile; // is this a file buffer?
bool isbuffer; // is this file buffer from memory ( custom decal, etc. ).
qboolean isfile; // is this a file buffer?
qboolean isbuffer; // is this file buffer from memory ( custom decal, etc. ).
char filename[CS_SIZE]; // name of the file to save out on remote host
int foffset; // offset in file from which to read data
int size; // size of data to read at that offset
@ -119,7 +119,7 @@ typedef struct netchan_s
netadr_t remote_address; // address this channel is talking to.
int qport; // qport value to write when transmitting
bool compress; // enable huffman compression
qboolean compress; // enable huffman compression
double last_received; // for timeouts
double last_sent; // for retransmits
@ -162,7 +162,7 @@ typedef struct netchan_s
short frag_length[MAX_STREAMS]; // length of frag data in the buffer
fragbuf_t *incomingbufs[MAX_STREAMS]; // incoming fragments are stored here
bool incomingready[MAX_STREAMS]; // set to true when incoming data is ready
qboolean incomingready[MAX_STREAMS]; // set to true when incoming data is ready
// Only referenced by the FRAG_FILE_STREAM component
char incomingfilename[CS_SIZE]; // Name of file being downloaded
@ -187,17 +187,17 @@ extern int net_drop;
void Netchan_Init( void );
void Netchan_Shutdown( void );
void Netchan_Setup( netsrc_t sock, netchan_t *chan, netadr_t adr, int qport );
bool Netchan_CopyNormalFragments( netchan_t *chan, sizebuf_t *msg );
bool Netchan_CopyFileFragments( netchan_t *chan, sizebuf_t *msg );
void Netchan_CreateFragments( bool server, netchan_t *chan, sizebuf_t *msg );
qboolean Netchan_CopyNormalFragments( netchan_t *chan, sizebuf_t *msg );
qboolean Netchan_CopyFileFragments( netchan_t *chan, sizebuf_t *msg );
void Netchan_CreateFragments( qboolean server, netchan_t *chan, sizebuf_t *msg );
void Netchan_Transmit( netchan_t *chan, int lengthInBytes, byte *data );
void Netchan_TransmitBits( netchan_t *chan, int lengthInBits, byte *data );
void Netchan_OutOfBand( int net_socket, netadr_t adr, int length, byte *data );
void Netchan_OutOfBandPrint( int net_socket, netadr_t adr, char *format, ... );
bool Netchan_Process( netchan_t *chan, sizebuf_t *msg );
qboolean Netchan_Process( netchan_t *chan, sizebuf_t *msg );
void Netchan_UpdateProgress( netchan_t *chan );
bool Netchan_IncomingReady( netchan_t *chan );
bool Netchan_CanPacket( netchan_t *chan );
qboolean Netchan_IncomingReady( netchan_t *chan );
qboolean Netchan_CanPacket( netchan_t *chan );
void Netchan_Clear( netchan_t *chan );
// huffman compression

View File

@ -15,7 +15,7 @@ typedef int (*pfnIgnore)( physent_t *pe ); // custom trace filter
void Pmove_Init( void );
void PM_InitBoxHull( void );
hull_t *PM_HullForBsp( physent_t *pe, const vec3_t mins, const vec3_t maxs, float *offset );
bool PM_TraceModel( physent_t *pe, const vec3_t p1, vec3_t mins, vec3_t maxs, const vec3_t p2, pmtrace_t *tr, int flags );
qboolean PM_TraceModel( physent_t *pe, const vec3_t p1, vec3_t mins, vec3_t maxs, const vec3_t p2, pmtrace_t *tr, int flags );
pmtrace_t PM_PlayerTrace( playermove_t *pm, vec3_t p1, vec3_t p2, int flags, int hull, int ignore_pe, pfnIgnore pfn );
int PM_HullPointContents( hull_t *hull, int num, const vec3_t p );
@ -23,8 +23,8 @@ int PM_HullPointContents( hull_t *hull, int num, const vec3_t p );
// pm_studio.c
//
void PM_InitStudioHull( void );
bool PM_StudioExtractBbox( model_t *mod, int sequence, float *mins, float *maxs );
bool PM_StudioTrace( physent_t *pe, const vec3_t start, vec3_t mins, vec3_t maxs, const vec3_t end, pmtrace_t *ptr );
qboolean PM_StudioExtractBbox( model_t *mod, int sequence, float *mins, float *maxs );
qboolean PM_StudioTrace( physent_t *pe, const vec3_t start, vec3_t mins, vec3_t maxs, const vec3_t end, pmtrace_t *ptr );
//
// pm_surface.c

View File

@ -14,7 +14,7 @@ static studiohdr_t *pm_studiohdr;
static mplane_t pm_hitboxplanes[6]; // there a temp hitbox
static matrix4x4 pm_studiomatrix;
static matrix4x4 pm_studiobones[MAXSTUDIOBONES];
typedef bool (*pfnTrace)( pmtrace_t *trace );
typedef qboolean (*pfnTrace)( pmtrace_t *trace );
static float trace_realfraction;
static vec3_t trace_startmins, trace_endmins;
static vec3_t trace_startmaxs, trace_endmaxs;
@ -532,7 +532,7 @@ static void PM_StudioSetupBones( physent_t *pe )
pe->sequence = oldseq; // restore original value
}
static bool PM_StudioSetupModel( physent_t *pe )
static qboolean PM_StudioSetupModel( physent_t *pe )
{
model_t *mod = pe->studiomodel;
@ -545,7 +545,7 @@ static bool PM_StudioSetupModel( physent_t *pe )
return true;
}
bool PM_StudioExtractBbox( model_t *mod, int sequence, float *mins, float *maxs )
qboolean PM_StudioExtractBbox( model_t *mod, int sequence, float *mins, float *maxs )
{
mstudioseqdesc_t *pseqdesc;
studiohdr_t *phdr;
@ -576,13 +576,13 @@ PM_ClipBoxToHitbox
trace hitbox
================
*/
bool PM_ClipBoxToHitbox( pmtrace_t *trace )
qboolean PM_ClipBoxToHitbox( pmtrace_t *trace )
{
int i;
mplane_t *p, *clipplane;
float enterfrac, leavefrac, distfrac;
float d, d1, d2;
bool getout, startout;
qboolean getout, startout;
float f;
enterfrac = -1.0f;
@ -707,7 +707,7 @@ PM_TestBoxInHitbox
test point trace in hibox
================
*/
bool PM_TestBoxInHitbox( pmtrace_t *trace )
qboolean PM_TestBoxInHitbox( pmtrace_t *trace )
{
int i;
mplane_t *p;
@ -779,7 +779,7 @@ PM_StudioIntersect
testing for potentially intersection of trace and animation bboxes
================
*/
static bool PM_StudioIntersect( physent_t *pe, const vec3_t start, vec3_t mins, vec3_t maxs, const vec3_t end )
static qboolean PM_StudioIntersect( physent_t *pe, const vec3_t start, vec3_t mins, vec3_t maxs, const vec3_t end )
{
vec3_t trace_mins, trace_maxs;
vec3_t anim_mins, anim_maxs;
@ -820,7 +820,7 @@ static bool PM_StudioIntersect( physent_t *pe, const vec3_t start, vec3_t mins,
return BoundsIntersect( trace_mins, trace_maxs, anim_mins, anim_maxs );
}
bool PM_StudioTrace( physent_t *pe, const vec3_t start, vec3_t mins, vec3_t maxs, const vec3_t end, pmtrace_t *ptr )
qboolean PM_StudioTrace( physent_t *pe, const vec3_t start, vec3_t mins, vec3_t maxs, const vec3_t end, pmtrace_t *ptr )
{
vec3_t start_l, end_l;
int i, outBone = -1;

View File

@ -216,7 +216,7 @@ hull_t *PM_HullForBsp( physent_t *pe, const vec3_t mins, const vec3_t maxs, floa
PM_RecursiveHullCheck
==================
*/
bool PM_RecursiveHullCheck( hull_t *hull, int num, float p1f, float p2f, vec3_t p1, vec3_t p2, pmtrace_t *trace )
qboolean PM_RecursiveHullCheck( hull_t *hull, int num, float p1f, float p2f, vec3_t p1, vec3_t p2, pmtrace_t *trace )
{
dclipnode_t *node;
mplane_t *plane;
@ -339,7 +339,7 @@ Handles selection or creation of a clipping hull, and offseting
(and eventually rotation) of the end points
==================
*/
static bool PM_BmodelTrace( physent_t *pe, const vec3_t start, vec3_t mins, vec3_t maxs, const vec3_t end, pmtrace_t *ptr )
static qboolean PM_BmodelTrace( physent_t *pe, const vec3_t start, vec3_t mins, vec3_t maxs, const vec3_t end, pmtrace_t *ptr )
{
vec3_t offset, temp;
vec3_t start_l, end_l;
@ -414,9 +414,9 @@ static bool PM_BmodelTrace( physent_t *pe, const vec3_t start, vec3_t mins, vec3
return false;
}
bool PM_TraceModel( physent_t *pe, const vec3_t start, vec3_t mins, vec3_t maxs, const vec3_t end, pmtrace_t *ptr, int flags )
qboolean PM_TraceModel( physent_t *pe, const vec3_t start, vec3_t mins, vec3_t maxs, const vec3_t end, pmtrace_t *ptr, int flags )
{
bool hitEnt = false;
qboolean hitEnt = false;
// assume we didn't hit anything
Mem_Set( ptr, 0, sizeof( pmtrace_t ));
@ -454,7 +454,7 @@ bool PM_TraceModel( physent_t *pe, const vec3_t start, vec3_t mins, vec3_t maxs,
}
else if( pe->solid == SOLID_SLIDEBOX )
{
bool bSimpleBox;
qboolean bSimpleBox;
// NOTE: SOLID_SLIDEBOX force to tracing as simplebox like FTRACE_SIMPLEBOX for trace hull.
// otherwise it's using hitbox tracing e.g. for bullet damage
@ -467,7 +467,7 @@ bool PM_TraceModel( physent_t *pe, const vec3_t start, vec3_t mins, vec3_t maxs,
}
else if( pe->solid == SOLID_BBOX )
{
bool bSimpleBox;
qboolean bSimpleBox;
// NOTE: this is similar SOLID_SLIDEBOX but trace type switched with trace flags
// not min\max. Used for static models (furniture, vehicle etc) for more realistic collisions

View File

@ -29,17 +29,17 @@
#define svc_particle 18 // [float*3][char*3][byte][byte]
#define svc_frame 19 // <OBSOLETE>
#define svc_spawnstatic 20 // creates a static client entity
#define svc_event_reliable 21 // playback event directly from message, not queue
#define svc_spawnbaseline 22 // <see code>
#define svc_temp_entity 23 // <variable sized>
#define svc_setpause 24 // [byte] 0 = unpaused, 1 = paused
#define svc_deltamovevars 25 // [movevars_t]
#define svc_centerprint 26 // [string] to put in center of the screen
#define svc_event 27 // playback event queue
#define svc_event_reliable 28 // playback event directly from message, not queue
#define svc_soundindex 28 // [index][soundpath]
#define svc_ambientsound 29 // <see code>
#define svc_intermission 30 // empty message (event)
#define svc_modelindex 31 // [index][modelpath]
#define svc_cdtrack 32 // [byte] track [byte] looptrack
#define svc_serverinfo 33 // [string] key [string] value
#define svc_deltatable 34 // [table header][...]
@ -52,6 +52,8 @@
#define svc_deltapacketentities 41 // [short][byte][...]
#define svc_chokecount 42 // [byte]
#define svc_deltamovevars 44 // [movevars_t]
#define svc_crosshairangle 47 // [byte][byte]
#define svc_soundfade 48 // [float*4] sound fade parms

View File

@ -95,6 +95,7 @@ int RankForContents( int contents );
===============================================================================
*/
#include "event_api.h"
#include "event_args.h"
#define MAX_EVENT_QUEUE 64 // 16 simultaneous events, max

87
engine/custom.h Normal file
View File

@ -0,0 +1,87 @@
/***
*
* 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 CUSTOM_H
#define CUSTOM_H
#include "const.h"
/////////////////
// Customization
// passed to pfnPlayerCustomization
// For automatic downloading.
typedef enum
{
t_sound = 0,
t_skin,
t_model,
t_decal,
t_generic,
t_eventscript,
t_world, // Fake type for world, is really t_model
} resourcetype_t;
typedef struct
{
int size;
} _resourceinfo_t;
typedef struct resourceinfo_s
{
_resourceinfo_t info[8];
} resourceinfo_t;
#define RES_FATALIFMISSING (1<<0) // Disconnect if we can't get this file.
#define RES_WASMISSING (1<<1) // Do we have the file locally, did we get it ok?
#define RES_CUSTOM (1<<2) // Is this resource one that corresponds to another player's customization
// or is it a server startup resource.
#define RES_REQUESTED (1<<3) // Already requested a download of this one
#define RES_PRECACHED (1<<4) // Already precached
typedef struct resource_s
{
char szFileName[64]; // File name to download/precache.
resourcetype_t type; // t_sound, t_skin, t_model, t_decal.
int nIndex; // For t_decals
int nDownloadSize; // Size in Bytes if this must be downloaded.
unsigned char ucFlags;
// for handling client to client resource propagation
unsigned char rgucMD5_hash[16]; // To determine if we already have it.
unsigned char playernum; // Which player index this resource is associated with,
// if it's a custom resource.
unsigned char rguc_reserved[32]; // For future expansion
struct resource_s *pNext; // Next in chain.
struct resource_s *pPrev;
} resource_t;
typedef struct customization_s
{
qboolean bInUse; // Is this customization in use;
resource_t resource; // The resource_t for this customization
qboolean bTranslated; // Has the raw data been translated into a useable format?
// (e.g., raw decal .wad make into texture_t *)
int nUserData1; // Customization specific data
int nUserData2; // Customization specific data
void *pInfo; // Buffer that holds the data structure that references
// the data (e.g., the cachewad_t)
void *pBuffer; // Buffer that holds the data for the customization
// (the raw .wad data)
struct customization_s *pNext; // Next in chain
} customization_t;
#endif // CUSTOM_H

39
engine/customentity.h Normal file
View File

@ -0,0 +1,39 @@
/***
*
* 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 CUSTOMENTITY_H
#define CUSTOMENTITY_H
// Custom Entities
// Start/End Entity is encoded as 12 bits of entity index, and 4 bits of attachment (4:12)
#define BEAMENT_ENTITY( x ) ((x) & 0xFFF)
#define BEAMENT_ATTACHMENT( x ) (((x)>>12) & 0xF)
// Beam types, encoded as a byte
enum
{
BEAM_POINTS = 0,
BEAM_ENTPOINT,
BEAM_ENTS,
BEAM_HOSE,
};
#define BEAM_FSINE 0x10
#define BEAM_FSOLID 0x20
#define BEAM_FSHADEIN 0x40
#define BEAM_FSHADEOUT 0x80
#endif//CUSTOMENTITY_H

42
engine/edict.h Normal file
View File

@ -0,0 +1,42 @@
/***
*
* 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 EDICT_H
#define EDICT_H
#define MAX_ENT_LEAFS 48
#include "progdefs.h"
struct edict_s
{
qboolean free;
int serialnumber;
link_t area; // linked to a division node or leaf
int headnode; // -1 to use normal leaf check
int num_leafs;
short leafnums[MAX_ENT_LEAFS];
float freetime; // sv.time when the object was freed
void* pvPrivateData; // Alloced and freed by engine, used by DLLs
entvars_t v; // C exported fields from progs
// other fields from progs come immediately after
};
#endif//EDICT_H

491
engine/eiface.h Normal file
View File

@ -0,0 +1,491 @@
/***
*
* 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 EIFACE_H
#define EIFACE_H
#ifdef HLDEMO_BUILD
#define INTERFACE_VERSION 001
#else // !HLDEMO_BUILD, i.e., regular version of HL
#define INTERFACE_VERSION 140
#endif // !HLDEMO_BUILD
#include <stdio.h>
#include "custom.h"
#include "cvardef.h"
//
// Defines entity interface between engine and DLLs.
// This header file included by engine files and DLL files.
//
// Before including this header, DLLs must:
// include progdefs.h
// This is conveniently done for them in extdll.h
//
#ifdef _WIN32
#define DLLEXPORT __stdcall
#else
#define DLLEXPORT /* */
#endif
typedef enum
{
at_notice,
at_console, // same as at_notice, but forces a ConPrintf, not a message box
at_aiconsole, // same as at_console, but only shown if developer level is 2!
at_warning,
at_error,
at_logged // Server print to console ( only in multiplayer games ).
} ALERT_TYPE;
// 4-22-98 JOHN: added for use in pfnClientPrintf
typedef enum
{
print_console,
print_center,
print_chat,
} PRINT_TYPE;
// For integrity checking of content on clients
typedef enum
{
force_exactfile, // File on client must exactly match server's file
force_model_samebounds, // For model files only, the geometry must fit in the same bbox
force_model_specifybounds, // For model files only, the geometry must fit in the specified bbox
} FORCE_TYPE;
// Returned by TraceLine
typedef struct
{
int fAllSolid; // if true, plane is not valid
int fStartSolid; // if true, the initial point was in a solid area
int fInOpen;
int fInWater;
float flFraction; // time completed, 1.0 = didn't hit anything
vec3_t vecEndPos; // final position
float flPlaneDist;
vec3_t vecPlaneNormal; // surface normal at impact
edict_t *pHit; // entity the surface is on
int iHitgroup; // 0 == generic, non zero is specific body part
} TraceResult;
// CD audio status
typedef struct
{
int fPlaying;// is sound playing right now?
int fWasPlaying;// if not, CD is paused if WasPlaying is true.
int fInitialized;
int fEnabled;
int fPlayLooping;
float cdvolume;
//BYTE remap[100];
int fCDRom;
int fPlayTrack;
} CDStatus;
typedef unsigned long CRC32_t;
// Engine hands this to DLLs for functionality callbacks
typedef struct enginefuncs_s
{
int (*pfnPrecacheModel)( char* s );
int (*pfnPrecacheSound)( char* s );
void (*pfnSetModel)( edict_t *e, const char *m );
int (*pfnModelIndex)( const char *m );
int (*pfnModelFrames)( int modelIndex );
void (*pfnSetSize)( edict_t *e, const float *rgflMin, const float *rgflMax );
void (*pfnChangeLevel)( char* s1, char* s2 );
void (*pfnGetSpawnParms)( edict_t *ent );
void (*pfnSaveSpawnParms)( edict_t *ent );
float (*pfnVecToYaw)( const float *rgflVector );
void (*pfnVecToAngles)( const float *rgflVectorIn, float *rgflVectorOut );
void (*pfnMoveToOrigin)( edict_t *ent, const float *pflGoal, float dist, int iMoveType );
void (*pfnChangeYaw)( edict_t* ent );
void (*pfnChangePitch)( edict_t* ent );
edict_t* (*pfnFindEntityByString)( edict_t *pEdictStartSearchAfter, const char *pszField, const char *pszValue );
int (*pfnGetEntityIllum)( edict_t* pEnt );
edict_t* (*pfnFindEntityInSphere)( edict_t *pEdictStartSearchAfter, const float *org, float rad );
edict_t* (*pfnFindClientInPVS)( edict_t *pEdict );
edict_t* (*pfnEntitiesInPVS)( edict_t *pplayer );
void (*pfnMakeVectors)( const float *rgflVector );
void (*pfnAngleVectors)( const float *rgflVector, float *forward, float *right, float *up );
edict_t* (*pfnCreateEntity)( void );
void (*pfnRemoveEntity)( edict_t* e );
edict_t* (*pfnCreateNamedEntity)( int className );
void (*pfnMakeStatic)( edict_t *ent );
int (*pfnEntIsOnFloor)( 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 );
void (*pfnEmitSound)( edict_t *entity, int channel, const char *sample, /*int*/float volume, float attenuation, int fFlags, int pitch );
void (*pfnEmitAmbientSound)( edict_t *entity, float *pos, const char *samp, float vol, float attenuation, int fFlags, int pitch );
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 );
int (*pfnTraceMonsterHull)( edict_t *pEdict, const float *v1, const float *v2, int fNoMonsters, edict_t *pentToSkip, TraceResult *ptr );
void (*pfnTraceHull)( const float *v1, const float *v2, int fNoMonsters, int hullNumber, edict_t *pentToSkip, TraceResult *ptr );
void (*pfnTraceModel)( const float *v1, const float *v2, int hullNumber, edict_t *pent, TraceResult *ptr );
const char *(*pfnTraceTexture)( edict_t *pTextureEntity, const float *v1, const float *v2 );
void (*pfnTraceSphere)( const float *v1, const float *v2, int fNoMonsters, float radius, edict_t *pentToSkip, TraceResult *ptr );
void (*pfnGetAimVector)( edict_t* ent, float speed, float *rgflReturn );
void (*pfnServerCommand)( char* str );
void (*pfnServerExecute)( void );
void (*pfnClientCommand)( edict_t* pEdict, char* szFmt, ... );
void (*pfnParticleEffect)( const float *org, const float *dir, float color, float count );
void (*pfnLightStyle)( int style, char* val );
int (*pfnDecalIndex)( const char *name );
int (*pfnPointContents)( const float *rgflVector );
void (*pfnMessageBegin)( int msg_dest, int msg_type, const float *pOrigin, edict_t *ed );
void (*pfnMessageEnd)( void );
void (*pfnWriteByte)( int iValue );
void (*pfnWriteChar)( int iValue );
void (*pfnWriteShort)( int iValue );
void (*pfnWriteLong)( int iValue );
void (*pfnWriteAngle)( float flValue );
void (*pfnWriteCoord)( float flValue );
void (*pfnWriteString)( const char *sz );
void (*pfnWriteEntity)( int iValue );
void (*pfnCVarRegister)( cvar_t *pCvar );
float (*pfnCVarGetFloat)( const char *szVarName );
const char* (*pfnCVarGetString)( const char *szVarName );
void (*pfnCVarSetFloat)( const char *szVarName, float flValue );
void (*pfnCVarSetString)( const char *szVarName, const char *szValue );
void (*pfnAlertMessage)( ALERT_TYPE atype, char *szFmt, ... );
void (*pfnEngineFprintf)( FILE *pfile, char *szFmt, ... );
void* (*pfnPvAllocEntPrivateData)( edict_t *pEdict, long cb );
void* (*pfnPvEntPrivateData)( edict_t *pEdict );
void (*pfnFreeEntPrivateData)( edict_t *pEdict );
const char *(*pfnSzFromIndex)( int iString );
int (*pfnAllocString)( const char *szValue );
struct entvars_s *(*pfnGetVarsOfEnt)( edict_t *pEdict );
edict_t* (*pfnPEntityOfEntOffset)( int iEntOffset );
int (*pfnEntOffsetOfPEntity)( const edict_t *pEdict );
int (*pfnIndexOfEdict)( const edict_t *pEdict );
edict_t* (*pfnPEntityOfEntIndex)( int iEntIndex );
edict_t* (*pfnFindEntityByVars)( struct entvars_s* pvars );
void* (*pfnGetModelPtr)( edict_t* pEdict );
int (*pfnRegUserMsg)( const char *pszName, int iSize );
void (*pfnAnimationAutomove)( const edict_t* pEdict, float flTime );
void (*pfnGetBonePosition)( const edict_t* pEdict, int iBone, float *rgflOrigin, float *rgflAngles );
unsigned long (*pfnFunctionFromName)( const char *pName );
const char *(*pfnNameForFunction)( unsigned long function );
void (*pfnClientPrintf)( edict_t* pEdict, PRINT_TYPE ptype, const char *szMsg ); // JOHN: engine callbacks so game DLL can print messages to individual clients
void (*pfnServerPrint)( const char *szMsg );
const char *(*pfnCmd_Args)( void ); // these 3 added
const char *(*pfnCmd_Argv)( int argc ); // so game DLL can easily
int (*pfnCmd_Argc)( void ); // access client 'cmd' strings
void (*pfnGetAttachment)( const edict_t *pEdict, int iAttachment, float *rgflOrigin, float *rgflAngles );
void (*pfnCRC32_Init)( CRC32_t *pulCRC );
void (*pfnCRC32_ProcessBuffer)( CRC32_t *pulCRC, void *p, int len );
void (*pfnCRC32_ProcessByte)( CRC32_t *pulCRC, unsigned char ch );
CRC32_t (*pfnCRC32_Final)( CRC32_t pulCRC );
long (*pfnRandomLong)( long lLow, long lHigh );
float (*pfnRandomFloat)( float flLow, float flHigh );
void (*pfnSetView)( const edict_t *pClient, const edict_t *pViewent );
float (*pfnTime)( void );
void (*pfnCrosshairAngle)( const edict_t *pClient, float pitch, float yaw );
byte* (*pfnLoadFileForMe)( char *filename, int *pLength );
void (*pfnFreeFile)( void *buffer );
void (*pfnEndSection)( const char *pszSectionName ); // trigger_endsection
int (*pfnCompareFileTime)( char *filename1, char *filename2, int *iCompare );
void (*pfnGetGameDir)( char *szGetGameDir );
void (*pfnCvar_RegisterVariable)( cvar_t *variable );
void (*pfnFadeClientVolume)( const edict_t *pEdict, int fadePercent, int fadeOutSeconds, int holdTime, int fadeInSeconds );
void (*pfnSetClientMaxspeed)( const edict_t *pEdict, float fNewMaxspeed );
edict_t *(*pfnCreateFakeClient)( const char *netname ); // returns NULL if fake client can't be created
void (*pfnRunPlayerMove)( edict_t *fakeclient, const float *viewangles, float forwardmove, float sidemove, float upmove, unsigned short buttons, byte impulse, byte msec );
int (*pfnNumberOfEntities)( void );
char* (*pfnGetInfoKeyBuffer)( edict_t *e ); // passing in NULL gets the serverinfo
char* (*pfnInfoKeyValue)( char *infobuffer, char *key );
void (*pfnSetKeyValue)( char *infobuffer, char *key, char *value );
void (*pfnSetClientKeyValue)( int clientIndex, char *infobuffer, char *key, char *value );
int (*pfnIsMapValid)( char *filename );
void (*pfnStaticDecal)( const float *origin, int decalIndex, int entityIndex, int modelIndex );
int (*pfnPrecacheGeneric)( char *s );
int (*pfnGetPlayerUserId)( edict_t *e ); // returns the server assigned userid for this player. useful for logging frags, etc. returns -1 if the edict couldn't be found in the list of clients
void (*pfnBuildSoundMsg)( edict_t *entity, int channel, const char *sample, /*int*/float volume, float attenuation, int fFlags, int pitch, int msg_dest, int msg_type, const float *pOrigin, edict_t *ed );
int (*pfnIsDedicatedServer)( void ); // is this a dedicated server?
cvar_t *(*pfnCVarGetPointer)( const char *szVarName );
unsigned int (*pfnGetPlayerWONId)( edict_t *e ); // returns the server assigned WONid for this player. useful for logging frags, etc. returns -1 if the edict couldn't be found in the list of clients
// YWB 8/1/99 TFF Physics additions
void (*pfnInfo_RemoveKey)( char *s, const char *key );
const char *(*pfnGetPhysicsKeyValue)( const edict_t *pClient, const char *key );
void (*pfnSetPhysicsKeyValue)( const edict_t *pClient, const char *key, const char *value );
const char *(*pfnGetPhysicsInfoString)( const edict_t *pClient );
unsigned short (*pfnPrecacheEvent)( int type, const char*psz );
void (*pfnPlaybackEvent)( int flags, const edict_t *pInvoker, unsigned short eventindex, float delay, float *origin, float *angles, float fparam1, float fparam2, int iparam1, int iparam2, int bparam1, int bparam2 );
unsigned char *(*pfnSetFatPVS)( float *org );
unsigned char *(*pfnSetFatPAS)( float *org );
int (*pfnCheckVisibility )( const edict_t *entity, unsigned char *pset );
void (*pfnDeltaSetField) ( struct delta_s *pFields, const char *fieldname );
void (*pfnDeltaUnsetField)( struct delta_s *pFields, const char *fieldname );
void (*pfnDeltaAddEncoder)( char *name, void (*conditionalencode)( struct delta_s *pFields, const unsigned char *from, const unsigned char *to ) );
int (*pfnGetCurrentPlayer)( void );
int (*pfnCanSkipPlayer)( const edict_t *player );
int (*pfnDeltaFindField)( struct delta_s *pFields, const char *fieldname );
void (*pfnDeltaSetFieldByIndex)( struct delta_s *pFields, int fieldNumber );
void (*pfnDeltaUnsetFieldByIndex)( struct delta_s *pFields, int fieldNumber );
void (*pfnSetGroupMask)( int mask, int op );
int (*pfnCreateInstancedBaseline)( int classname, struct entity_state_s *baseline );
void (*pfnCvar_DirectSet)( struct cvar_s *var, char *value );
// Forces the client and server to be running with the same version of the specified file
// ( e.g., a player model ).
// Calling this has no effect in single player
void (*pfnForceUnmodified)( FORCE_TYPE type, float *mins, float *maxs, const char *filename );
void (*pfnGetPlayerStats)( const edict_t *pClient, int *ping, int *packet_loss );
void (*pfnAddServerCommand)( char *cmd_name, void (*function) (void) );
// For voice communications, set which clients hear eachother.
// NOTE: these functions take player entity indices (starting at 1).
qboolean (*pfnVoice_GetClientListening)(int iReceiver, int iSender);
qboolean (*pfnVoice_SetClientListening)(int iReceiver, int iSender, qboolean bListen);
const char *(*pfnGetPlayerAuthId) ( edict_t *e );
} enginefuncs_t;
// ONLY ADD NEW FUNCTIONS TO THE END OF THIS STRUCT. INTERFACE VERSION IS FROZEN AT 138
// Passed to pfnKeyValue
typedef struct KeyValueData_s
{
char *szClassName; // in: entity classname
char *szKeyName; // in: name of key
char *szValue; // in: value of key
long fHandled; // out: DLL sets to true if key-value pair was understood
} KeyValueData;
typedef struct
{
char mapName[32];
char landmarkName[32];
edict_t *pentLandmark;
vec3_t vecLandmarkOrigin;
} LEVELLIST;
#define MAX_LEVEL_CONNECTIONS 16 // These are encoded in the lower 16bits of ENTITYTABLE->flags
typedef struct
{
int id; // Ordinal ID of this entity (used for entity <--> pointer conversions)
edict_t *pent; // Pointer to the in-game entity
int location; // Offset from the base data of this entity
int size; // Byte size of this entity's data
int flags; // This could be a short -- bit mask of transitions that this entity is in the PVS of
string_t classname; // entity class name
} ENTITYTABLE;
#define FENTTABLE_PLAYER 0x80000000
#define FENTTABLE_REMOVED 0x40000000
#define FENTTABLE_MOVEABLE 0x20000000
#define FENTTABLE_GLOBAL 0x10000000
typedef struct saverestore_s SAVERESTOREDATA;
#ifdef _WIN32
typedef
#endif
struct saverestore_s
{
char *pBaseData; // Start of all entity save data
char *pCurrentData; // Current buffer pointer for sequential access
int size; // Current data size
int bufferSize; // Total space for data
int tokenSize; // Size of the linear list of tokens
int tokenCount; // Number of elements in the pTokens table
char **pTokens; // Hash table of entity strings (sparse)
int currentIndex; // Holds a global entity table ID
int tableCount; // Number of elements in the entity table
int connectionCount; // Number of elements in the levelList[]
ENTITYTABLE *pTable; // Array of ENTITYTABLE elements (1 for each entity)
LEVELLIST levelList[MAX_LEVEL_CONNECTIONS]; // List of connections from this level
// smooth transition
int fUseLandmark;
char szLandmarkName[20]; // landmark we'll spawn near in next level
vec3_t vecLandmarkOffset; // for landmark transitions
float time;
char szCurrentMapName[32]; // To check global entities
}
#ifdef _WIN32
SAVERESTOREDATA
#endif
;
typedef enum _fieldtypes
{
FIELD_FLOAT = 0, // Any floating point value
FIELD_STRING, // A string ID (return from ALLOC_STRING)
FIELD_ENTITY, // An entity offset (EOFFSET)
FIELD_CLASSPTR, // CBaseEntity *
FIELD_EHANDLE, // Entity handle
FIELD_EVARS, // EVARS *
FIELD_EDICT, // edict_t *, or edict_t * (same thing)
FIELD_VECTOR, // Any vector
FIELD_POSITION_VECTOR, // A world coordinate (these are fixed up across level transitions automagically)
FIELD_POINTER, // Arbitrary data pointer... to be removed, use an array of FIELD_CHARACTER
FIELD_INTEGER, // Any integer or enum
FIELD_FUNCTION, // A class function pointer (Think, Use, etc)
FIELD_BOOLEAN, // boolean, implemented as an int, I may use this as a hint for compression
FIELD_SHORT, // 2 byte integer
FIELD_CHARACTER, // a byte
FIELD_TIME, // a floating point time (these are fixed up automatically too!)
FIELD_MODELNAME, // Engine string that is a model name (needs precache)
FIELD_SOUNDNAME, // Engine string that is a sound name (needs precache)
FIELD_WEAPONTIME, // Custom field for predicted and normal weapons
FIELD_TYPECOUNT, // MUST BE LAST
} FIELDTYPE;
#ifndef offsetof
#define offsetof(s,m) (size_t)&(((s *)0)->m)
#endif
#define _FIELD(type,name,fieldtype,count,flags) { fieldtype, #name, offsetof(type, name), count, flags }
#define DEFINE_FIELD(type,name,fieldtype) _FIELD(type, name, fieldtype, 1, 0)
#define DEFINE_ARRAY(type,name,fieldtype,count) _FIELD(type, name, fieldtype, count, 0)
#define DEFINE_ENTITY_FIELD(name,fieldtype) _FIELD(entvars_t, name, fieldtype, 1, 0 )
#define DEFINE_ENTITY_GLOBAL_FIELD(name,fieldtype) _FIELD(entvars_t, name, fieldtype, 1, FTYPEDESC_GLOBAL )
#define DEFINE_GLOBAL_FIELD(type,name,fieldtype) _FIELD(type, name, fieldtype, 1, FTYPEDESC_GLOBAL )
#define FTYPEDESC_GLOBAL 0x0001 // This field is masked for global entity save/restore
typedef struct
{
FIELDTYPE fieldType;
char *fieldName;
int fieldOffset;
short fieldSize;
short flags;
} TYPEDESCRIPTION;
#define ARRAYSIZE(p) (sizeof(p)/sizeof(p[0]))
typedef struct
{
// Initialize/shutdown the game (one-time call after loading of game .dll )
void (*pfnGameInit)( void );
int (*pfnSpawn)( edict_t *pent );
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 (*pfnSave)( edict_t *pent, SAVERESTOREDATA *pSaveData );
int (*pfnRestore)( edict_t *pent, SAVERESTOREDATA *pSaveData, int globalEntity );
void (*pfnSetAbsBox)( edict_t *pent );
void (*pfnSaveWriteFields)( SAVERESTOREDATA*, const char*, void*, TYPEDESCRIPTION*, int );
void (*pfnSaveReadFields)( SAVERESTOREDATA*, const char*, void*, TYPEDESCRIPTION*, int );
void (*pfnSaveGlobalState)( SAVERESTOREDATA * );
void (*pfnRestoreGlobalState)( SAVERESTOREDATA * );
void (*pfnResetGlobalState)( void );
qboolean (*pfnClientConnect)( edict_t *pEntity, const char *pszName, const char *pszAddress, char szRejectReason[128] );
void (*pfnClientDisconnect)( edict_t *pEntity );
void (*pfnClientKill)( edict_t *pEntity );
void (*pfnClientPutInServer)( edict_t *pEntity );
void (*pfnClientCommand)( edict_t *pEntity );
void (*pfnClientUserInfoChanged)( edict_t *pEntity, char *infobuffer );
void (*pfnServerActivate)( edict_t *pEdictList, int edictCount, int clientMax );
void (*pfnServerDeactivate)( void );
void (*pfnPlayerPreThink)( edict_t *pEntity );
void (*pfnPlayerPostThink)( edict_t *pEntity );
void (*pfnStartFrame)( void );
void (*pfnParmsNewLevel)( void );
void (*pfnParmsChangeLevel)( void );
// Returns string describing current .dll. E.g., TeamFotrress 2, Half-Life
const char *(*pfnGetGameDescription)( void );
// Notify dll about a player customization.
void (*pfnPlayerCustomization)( edict_t *pEntity, customization_t *pCustom );
// Spectator funcs
void (*pfnSpectatorConnect)( edict_t *pEntity );
void (*pfnSpectatorDisconnect)( edict_t *pEntity );
void (*pfnSpectatorThink)( edict_t *pEntity );
// Notify game .dll that engine is going to shut down. Allows mod authors to set a breakpoint.
void (*pfnSys_Error)( const char *error_string );
void (*pfnPM_Move)( struct playermove_s *ppmove, qboolean server );
void (*pfnPM_Init)( struct playermove_s *ppmove );
char (*pfnPM_FindTextureType)( char *name );
void (*pfnSetupVisibility)( struct edict_s *pViewEntity, struct edict_s *pClient, unsigned char **pvs, unsigned char **pas );
void (*pfnUpdateClientData) ( const struct edict_s *ent, int sendweapons, struct clientdata_s *cd );
int (*pfnAddToFullPack)( struct entity_state_s *state, int e, edict_t *ent, edict_t *host, int hostflags, int player, unsigned char *pSet );
void (*pfnCreateBaseline)( int player, int eindex, struct entity_state_s *baseline, struct edict_s *entity, int playermodelindex, vec3_t player_mins, vec3_t player_maxs );
void (*pfnRegisterEncoders)( void );
int (*pfnGetWeaponData)( struct edict_s *player, struct weapon_data_s *info );
void (*pfnCmdStart)( const edict_t *player, const struct usercmd_s *cmd, unsigned int random_seed );
void (*pfnCmdEnd)( const edict_t *player );
// Return 1 if the packet is valid. Set response_buffer_size if you want to send a response packet. Incoming, it holds the max
// size of the response_buffer, so you must zero it out if you choose not to respond.
int (*pfnConnectionlessPacket )( const struct netadr_s *net_from, const char *args, char *response_buffer, int *response_buffer_size );
// Enumerates player hulls. Returns 0 if the hull number doesn't exist, 1 otherwise
int (*pfnGetHullBounds) ( int hullnumber, float *mins, float *maxs );
// Create baselines for certain "unplaced" items.
void (*pfnCreateInstancedBaselines) ( void );
// One of the pfnForceUnmodified files failed the consistency check for the specified player
// Return 0 to allow the client to continue, 1 to force immediate disconnection ( with an optional disconnect message of up to 256 characters )
int (*pfnInconsistentFile)( const struct edict_s *player, const char *filename, char *disconnect_message );
// The game .dll should return 1 if lag compensation should be allowed ( could also just set
// the sv_unlag cvar.
// Most games right now should return 0, until client-side weapon prediction code is written
// and tested for them.
int (*pfnAllowLagCompensation)( void );
} DLL_FUNCTIONS;
extern DLL_FUNCTIONS gEntityInterface;
// Current version.
#define NEW_DLL_FUNCTIONS_VERSION 1
typedef struct
{
// Called right before the object's memory is freed.
// Calls its destructor.
void (*pfnOnFreeEntPrivateData)( edict_t *pEnt );
void (*pfnGameShutdown)(void);
int (*pfnShouldCollide)( edict_t *pentTouched, edict_t *pentOther );
int (*pfnCreate)( edict_t *pent, const char *szName ); // passed through pfnCreate (0 is attempt to create, -1 is reject)
int (*pfnPhysicsEntity)( edict_t *pEntity ); // run custom physics for each entity (return 0 to use engine physic)
} NEW_DLL_FUNCTIONS;
typedef int (*NEW_DLL_FUNCTIONS_FN)( NEW_DLL_FUNCTIONS *pFunctionTable, int *interfaceVersion );
// Pointers will be null if the game DLL doesn't support this API.
extern NEW_DLL_FUNCTIONS gNewDLLFunctions;
typedef int (*APIFUNCTION)( DLL_FUNCTIONS *pFunctionTable, int interfaceVersion );
typedef int (*APIFUNCTION2)( DLL_FUNCTIONS *pFunctionTable, int *interfaceVersion );
#endif//EIFACE_H

View File

@ -118,7 +118,7 @@ SOURCE=.\common\avikit.c
# End Source File
# Begin Source File
SOURCE=.\build.c
SOURCE=.\common\build.c
# End Source File
# Begin Source File
@ -202,11 +202,7 @@ SOURCE=.\common\engfuncs.c
# End Source File
# Begin Source File
SOURCE=.\export.c
# End Source File
# Begin Source File
SOURCE=.\host.c
SOURCE=.\common\host.c
# End Source File
# Begin Source File
@ -318,7 +314,7 @@ SOURCE=.\common\cm_local.h
# End Source File
# Begin Source File
SOURCE=.\common.h
SOURCE=.\common\common.h
# End Source File
# Begin Source File

View File

@ -1,35 +0,0 @@
//=======================================================================
// Copyright XashXT Group 2007 ©
// export.c - engine entry point
//=======================================================================
#include "common.h"
// main DLL entry point
BOOL WINAPI DllMain( HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved )
{
return TRUE;
}
/*
=================
Engine entry point
=================
*/
launch_exp_t EXPORT *CreateAPI( stdlib_api_t *input, void *unused )
{
static launch_exp_t Host;
com = *input;
Host.api_size = sizeof( launch_exp_t );
Host.com_size = sizeof( stdlib_api_t );
Host.Init = Host_Init;
Host.Main = Host_Main;
Host.Free = Host_Free;
Host.CPrint = Host_Print;
Host.CmdForward = Cmd_ForwardToServer;
Host.CmdComplete = Cmd_AutoComplete;
return &Host;
}

133
engine/keydefs.h Normal file
View File

@ -0,0 +1,133 @@
/***
*
* 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 KEYDEFS_H
#define KEYDEFS_H
//
// these are the key numbers that should be passed to Key_Event
//
#define K_TAB 9
#define K_ENTER 13
#define K_ESCAPE 27
#define K_SPACE 32
// normal keys should be passed as lowercased ascii
#define K_BACKSPACE 127
#define K_UPARROW 128
#define K_DOWNARROW 129
#define K_LEFTARROW 130
#define K_RIGHTARROW 131
#define K_ALT 132
#define K_CTRL 133
#define K_SHIFT 134
#define K_F1 135
#define K_F2 136
#define K_F3 137
#define K_F4 138
#define K_F5 139
#define K_F6 140
#define K_F7 141
#define K_F8 142
#define K_F9 143
#define K_F10 144
#define K_F11 145
#define K_F12 146
#define K_INS 147
#define K_DEL 148
#define K_PGDN 149
#define K_PGUP 150
#define K_HOME 151
#define K_END 152
#define K_KP_HOME 160
#define K_KP_UPARROW 161
#define K_KP_PGUP 162
#define K_KP_LEFTARROW 163
#define K_KP_5 164
#define K_KP_RIGHTARROW 165
#define K_KP_END 166
#define K_KP_DOWNARROW 167
#define K_KP_PGDN 168
#define K_KP_ENTER 169
#define K_KP_INS 170
#define K_KP_DEL 171
#define K_KP_SLASH 172
#define K_KP_MINUS 173
#define K_KP_PLUS 174
#define K_CAPSLOCK 175
#define K_KP_NUMLOCK 176
//
// joystick buttons
//
#define K_JOY1 203
#define K_JOY2 204
#define K_JOY3 205
#define K_JOY4 206
//
// aux keys are for multi-buttoned joysticks to generate so they can use
// the normal binding process
//
#define K_AUX1 207
#define K_AUX2 208
#define K_AUX3 209
#define K_AUX4 210
#define K_AUX5 211
#define K_AUX6 212
#define K_AUX7 213
#define K_AUX8 214
#define K_AUX9 215
#define K_AUX10 216
#define K_AUX11 217
#define K_AUX12 218
#define K_AUX13 219
#define K_AUX14 220
#define K_AUX15 221
#define K_AUX16 222
#define K_AUX17 223
#define K_AUX18 224
#define K_AUX19 225
#define K_AUX20 226
#define K_AUX21 227
#define K_AUX22 228
#define K_AUX23 229
#define K_AUX24 230
#define K_AUX25 231
#define K_AUX26 232
#define K_AUX27 233
#define K_AUX28 234
#define K_AUX29 235
#define K_AUX30 236
#define K_AUX31 237
#define K_AUX32 238
#define K_MWHEELDOWN 239
#define K_MWHEELUP 240
#define K_PAUSE 255
//
// mouse buttons generate virtual keys
//
#define K_MOUSE1 241
#define K_MOUSE2 242
#define K_MOUSE3 243
#define K_MOUSE4 244
#define K_MOUSE5 245
#endif//KEYDEFS_H

View File

@ -1,41 +1,53 @@
//=======================================================================
// Copyright XashXT Group 2010 ©
// progdefs.h - global and entity variables
//=======================================================================
/***
*
* 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 PROGDEFS_H
#define PROGDEFS_H
typedef struct globalvars_s
typedef struct
{
float time;
float frametime;
int force_retouch;
float force_retouch;
string_t mapname;
string_t startspot;
float deathmatch;
float coop;
float teamplay;
int serverflags;
int found_secrets;
float serverflags;
float found_secrets;
vec3_t v_forward;
vec3_t v_up;
vec3_t v_right;
int trace_allsolid;
int trace_startsolid;
float trace_allsolid;
float trace_startsolid;
float trace_fraction;
vec3_t trace_endpos;
vec3_t trace_plane_normal;
float trace_plane_dist;
edict_t *trace_ent;
int trace_inopen;
int trace_inwater;
float trace_inopen;
float trace_inwater;
int trace_hitgroup;
int trace_flags;
int changelevel; // transition in progress when true (was msg_entity)
int cdAudioTrack;
int maxClients;
int maxEntities;
const char *pStringBase; // set to NULL during initialize if you want use StringTable system
const char *pStringBase; // set to NULL during initialize (in GameDllInit)
// if you want to use StringTable system instead
void *pSaveData; // (SAVERESTOREDATA *) pointer
vec3_t vecLandmarkOffset;
} globalvars_t;
@ -43,19 +55,18 @@ typedef struct globalvars_s
typedef struct entvars_s
{
string_t classname;
string_t globalname; // global entity name transmitted across levels
string_t globalname;
vec3_t origin;
vec3_t oldorigin;
vec3_t velocity;
vec3_t basevelocity;
vec3_t clbasevelocity; // Base velocity that was passed in to server physics so
// client can predict conveyors correctly.
// Server zeroes it, so we need to store here, too.
// client can predict conveyors correctly. Server zeroes it, so we need to store here, too.
vec3_t movedir;
vec3_t angles;
vec3_t avelocity; // angular velocity (degrees per second)
vec3_t angles; // Model angles
vec3_t avelocity; // angle velocity (degrees per second)
vec3_t punchangle; // auto-decaying view angle adjustment
vec3_t v_angle; // Viewing angle (player only)
@ -65,7 +76,7 @@ typedef struct entvars_s
float impacttime;
float starttime;
int fixangle; // 0 - nothing, 1 - force view angles, 2 - add avelocity
int fixangle; // 0:nothing, 1:force view angles, 2:add avelocity
float idealpitch;
float pitch_speed;
float ideal_yaw;
@ -73,7 +84,7 @@ typedef struct entvars_s
int modelindex;
string_t model; // model name
string_t model;
int viewmodel; // player's viewmodel
int weaponmodel; // what other players see
@ -84,7 +95,7 @@ typedef struct entvars_s
vec3_t size; // maxs - mins
float ltime;
float nextthink; // time to next call of think function
float nextthink;
int movetype;
int solid;
@ -95,7 +106,7 @@ typedef struct entvars_s
float gravity; // % of "normal" gravity
float friction; // inverse elasticity of MOVETYPE_BOUNCE
int light_level; // entity current lightlevel
int light_level;
int sequence; // animation sequence
int gaitsequence; // movement animation sequence for player (0 for none)
@ -122,27 +133,27 @@ typedef struct entvars_s
int button;
int impulse;
edict_t *chain; // linked list for EntitiesInPVS\PHS
edict_t *chain; // Entity pointer when linked into a linked list
edict_t *dmg_inflictor;
edict_t *enemy;
edict_t *aiment; // entity pointer when MOVETYPE_FOLLOW
edict_t *owner;
edict_t *groundentity; // only if FL_ONGROUND is set
edict_t *groundentity;
int spawnflags; // spwanflags are used only during level loading
int flags; // generic flags that can be send to client
short colormap; // lowbyte topcolor, highbyte bottomcolor
int team; // for teamplay
int spawnflags;
int flags;
int colormap; // lowbyte topcolor, highbyte bottomcolor
int team;
float max_health;
float teleport_time; // engine will be reset this value on next frame
int armortype;
float teleport_time;
float armortype;
float armorvalue;
int waterlevel;
int watertype;
string_t target; // various server strings
string_t target;
string_t targetname;
string_t netname;
string_t message;
@ -162,43 +173,42 @@ typedef struct entvars_s
float pain_finished;
float radsuit_finished;
edict_t *pContainingEntity; // filled by engine, don't save, don't modifiy
edict_t *pContainingEntity;
int playerclass;
float maxspeed; // uses to limit speed for current client
float maxspeed;
float fov; // client fov, used instead m_iFov
int weaponanim; // FIXME: shorten these ?
int pushmsec; // g-cont. used to store last network frame to prevent add entities
// twice through portals (in HL does nothing)
float fov;
int weaponanim;
int pushmsec;
int bInDuck;
int flTimeStepSound; // Next time we can play a step sound
int flSwimTime; // In process of ducking or ducked already?
int flDuckTime; // Time we started duck
int iStepLeft; // 0 - 4
float flFallVelocity; // falling velocity z
int flTimeStepSound;
int flSwimTime;
int flDuckTime;
int iStepLeft;
float flFallVelocity;
int gamestate;
int oldbuttons; // buttons last usercmd
int groupinfo; // entities culling (on server)
// for mods
int oldbuttons;
int groupinfo;
// For mods
int iuser1;
int iuser2;
int iuser3;
int iuser4;
float fuser1;
float fuser2;
float fuser3;
float fuser4;
vec3_t vuser1;
vec3_t vuser2;
vec3_t vuser3;
vec3_t vuser4;
edict_t *euser1;
edict_t *euser2;
edict_t *euser3;

View File

@ -91,7 +91,7 @@ typedef struct server_s
{
sv_state_t state; // precache commands are only valid during load
bool loadgame; // client begins should reuse existing entity
qboolean loadgame; // client begins should reuse existing entity
double time; // sv.time += sv.frametime
float frametime;
@ -104,6 +104,9 @@ typedef struct server_s
char configstrings[MAX_CONFIGSTRINGS][CS_SIZE];
char model_precache[MAX_MODELS][CS_SIZE];
char sound_precache[MAX_SOUNDS][CS_SIZE];
sv_consistency_t consistency_files[MAX_MODELS];
int num_consistency_files;
@ -129,8 +132,8 @@ typedef struct server_s
// run local lightstyles to let SV_LightPoint grab the actual information
sv_lightstyle_t lightstyle[MAX_LIGHTSTYLES];
bool write_bad_message; // just for debug
bool paused;
qboolean write_bad_message; // just for debug
qboolean paused;
} server_t;
typedef struct
@ -152,12 +155,12 @@ typedef struct sv_client_s
char userinfo[MAX_INFO_STRING]; // name, etc (received from client)
char physinfo[MAX_INFO_STRING]; // set on server (transmit to client)
bool send_message;
bool skip_message;
qboolean send_message;
qboolean skip_message;
bool local_weapons; // enable weapon predicting
bool lag_compensation; // enable lag compensation
bool hltv_proxy; // this is spectator proxy (hltv)
qboolean local_weapons; // enable weapon predicting
qboolean lag_compensation; // enable lag compensation
qboolean hltv_proxy; // this is spectator proxy (hltv)
netchan_t netchan;
int chokecount; // number of messages rate supressed
@ -168,10 +171,10 @@ typedef struct sv_client_s
double next_checkpingtime; // time to send all players pings to client
double timebase; // client timebase
bool sendmovevars;
bool sendinfo;
qboolean sendmovevars;
qboolean sendinfo;
bool fakeclient; // This client is a fake player controlled by the game DLL
qboolean fakeclient; // This client is a fake player controlled by the game DLL
int random_seed; // fpr predictable random values
usercmd_t lastcmd; // for filling in big drops
@ -235,7 +238,7 @@ typedef struct
netadr_t adr;
int challenge;
double time;
bool connected;
qboolean connected;
} challenge_t;
typedef struct
@ -254,10 +257,10 @@ typedef struct
typedef struct
{
bool active;
bool moving;
bool firstframe;
bool nointerp;
qboolean active;
qboolean moving;
qboolean firstframe;
qboolean nointerp;
vec3_t mins;
vec3_t maxs;
@ -277,8 +280,8 @@ typedef struct
int msg_realsize; // left in bytes
int msg_index; // for debug messages
int msg_dest; // msg destination ( MSG_ONE, MSG_ALL etc )
bool msg_started; // to avoid include messages
bool msg_system; // this is message with engine index
qboolean msg_started; // to avoid include messages
qboolean msg_system; // this is message with engine index
edict_t *msg_ent; // user message member entity
vec3_t msg_org; // user message member origin
@ -302,6 +305,8 @@ typedef struct
sv_pushed_t pushed[256]; // no reason to keep array for all edicts
// 256 it should be enough for any game situation
char draw_decals[MAX_DECALS][64]; // a list of unique decalindexes
vec3_t player_mins[4]; // 4 hulls allowed
vec3_t player_maxs[4]; // 4 hulls allowed
@ -317,7 +322,7 @@ typedef struct
typedef struct
{
bool initialized; // sv_init has completed
qboolean initialized; // sv_init has completed
double timestart; // just for profiling
int groupmask;
@ -377,7 +382,7 @@ extern sv_client_t *sv_client;
//
// sv_main.c
//
void SV_FinalMessage( char *message, bool reconnect );
void SV_FinalMessage( char *message, qboolean reconnect );
void SV_DropClient( sv_client_t *drop );
int SV_ModelIndex( const char *name );
@ -400,28 +405,28 @@ void Master_Packet( void );
void SV_InitGame( void );
void SV_ActivateServer( void );
void SV_DeactivateServer( void );
void SV_LevelInit( const char *pMapName, char const *pOldLevel, char const *pLandmarkName, bool loadGame );
bool SV_SpawnServer( const char *server, const char *startspot );
int SV_FindIndex( const char *name, int start, int end, bool create );
void SV_LevelInit( const char *pMapName, char const *pOldLevel, char const *pLandmarkName, qboolean loadGame );
qboolean SV_SpawnServer( const char *server, const char *startspot );
int SV_FindIndex( const char *name, int start, int end, qboolean create );
//
// sv_phys.c
//
void SV_Physics( void );
void SV_CheckVelocity( edict_t *ent );
bool SV_CheckWater( edict_t *ent );
bool SV_RunThink( edict_t *ent );
qboolean SV_CheckWater( edict_t *ent );
qboolean SV_RunThink( edict_t *ent );
void SV_FreeOldEntities( void );
bool SV_TestEntityPosition( edict_t *ent ); // for EntityInSolid checks
bool SV_TestPlayerPosition( edict_t *ent ); // for PlayerInSolid checks
qboolean SV_TestEntityPosition( edict_t *ent ); // for EntityInSolid checks
qboolean SV_TestPlayerPosition( edict_t *ent ); // for PlayerInSolid checks
//
// sv_move.c
//
bool SV_MoveStep( edict_t *ent, vec3_t move, bool relink );
bool SV_MoveTest( edict_t *ent, vec3_t move, bool relink );
qboolean SV_MoveStep( edict_t *ent, vec3_t move, qboolean relink );
qboolean SV_MoveTest( edict_t *ent, vec3_t move, qboolean relink );
void SV_MoveToOrigin( edict_t *ed, const vec3_t goal, float dist, int iMode );
bool SV_CheckBottom( edict_t *ent, int iMode );
qboolean SV_CheckBottom( edict_t *ent, int iMode );
float SV_VecToYaw( const vec3_t src );
//
@ -441,12 +446,12 @@ void SV_GetChallenge( netadr_t from );
void SV_DirectConnect( netadr_t from );
void SV_TogglePause( const char *msg );
void SV_PutClientInServer( edict_t *ent );
bool SV_ShouldUpdatePing( sv_client_t *cl );
qboolean SV_ShouldUpdatePing( sv_client_t *cl );
const char *SV_GetClientIDString( sv_client_t *cl );
void SV_FullClientUpdate( sv_client_t *cl, sizebuf_t *msg );
void SV_FullUpdateMovevars( sv_client_t *cl, sizebuf_t *msg );
void SV_GetPlayerStats( sv_client_t *cl, int *ping, int *packet_loss );
bool SV_ClientConnect( edict_t *ent, char *userinfo );
qboolean SV_ClientConnect( edict_t *ent, char *userinfo );
void SV_ClientThink( sv_client_t *cl, usercmd_t *cmd );
void SV_ExecuteClientMessage( sv_client_t *cl, sizebuf_t *msg );
void SV_ConnectionlessPacket( netadr_t from, sizebuf_t *msg );
@ -454,7 +459,7 @@ edict_t *SV_FakeConnect( const char *netname );
void SV_PreRunCmd( sv_client_t *cl, usercmd_t *ucmd, int random_seed );
void SV_RunCmd( sv_client_t *cl, usercmd_t *ucmd, int random_seed );
void SV_PostRunCmd( sv_client_t *cl );
bool SV_IsPlayerIndex( int idx );
qboolean SV_IsPlayerIndex( int idx );
void SV_InitClientMove( void );
void SV_UpdateServerInfo( void );
@ -477,7 +482,7 @@ void SV_SkipUpdates( void );
//
// sv_game.c
//
bool SV_LoadProgs( const char *name );
qboolean SV_LoadProgs( const char *name );
void SV_UnloadProgs( void );
void SV_FreeEdicts( void );
edict_t *SV_AllocEdict( void );
@ -499,7 +504,7 @@ float SV_AngleMod( float ideal, float current, float speed );
void SV_SpawnEntities( const char *mapname, script_t *entities );
edict_t* SV_AllocPrivateData( edict_t *ent, string_t className );
string_t SV_AllocString( const char *szValue );
sv_client_t *SV_ClientFromEdict( const edict_t *pEdict, bool spawned_only );
sv_client_t *SV_ClientFromEdict( const edict_t *pEdict, qboolean spawned_only );
const char *SV_GetString( string_t iString );
void SV_SetClientMaxspeed( sv_client_t *cl, float fNewMaxspeed );
int SV_MapIsValid( const char *filename, const char *spawn_entity, const char *landmark_name );
@ -507,6 +512,7 @@ void SV_StartSound( edict_t *ent, int chan, const char *sample, float vol, float
edict_t* pfnPEntityOfEntIndex( int iEntIndex );
int pfnIndexOfEdict( const edict_t *pEdict );
void SV_UpdateBaseVelocity( edict_t *ent );
int pfnPrecacheModel( const char *s );
_inline edict_t *SV_EDICT_NUM( int n, const char * file, const int line )
{
@ -521,17 +527,17 @@ _inline edict_t *SV_EDICT_NUM( int n, const char * file, const int line )
//
void SV_ClearSaveDir( void );
void SV_SaveGame( const char *pName );
bool SV_LoadGame( const char *pName );
void SV_ChangeLevel( bool loadfromsavedgame, const char *mapname, const char *start );
qboolean SV_LoadGame( const char *pName );
void SV_ChangeLevel( qboolean loadfromsavedgame, const char *mapname, const char *start );
const char *SV_GetLatestSave( void );
int SV_LoadGameState( char const *level, bool createPlayers );
int SV_LoadGameState( char const *level, qboolean createPlayers );
void SV_LoadAdjacentEnts( const char *pOldLevel, const char *pLandmarkName );
//
// sv_studio.c
//
void SV_InitStudioHull( void );
bool SV_StudioExtractBbox( model_t *mod, int sequence, float *mins, float *maxs );
qboolean SV_StudioExtractBbox( model_t *mod, int sequence, float *mins, float *maxs );
void SV_StudioGetAttachment( edict_t *e, int iAttachment, float *org, float *ang );
trace_t SV_TraceHitbox( edict_t *ent, const vec3_t start, vec3_t mins, vec3_t maxs, const vec3_t end );
void SV_GetBonePosition( edict_t *e, int iBone, float *org, float *ang );
@ -539,7 +545,7 @@ void SV_GetBonePosition( edict_t *e, int iBone, float *org, float *ang );
//
// sv_pmove.c
//
bool SV_CopyEdictToPhysEnt( physent_t *pe, edict_t *ed, bool player_trace );
qboolean SV_CopyEdictToPhysEnt( physent_t *pe, edict_t *ed, qboolean player_trace );
//
// sv_world.c
@ -549,14 +555,14 @@ extern areanode_t sv_areanodes[];
void SV_ClearWorld( void );
void SV_UnlinkEdict( edict_t *ent );
bool SV_HeadnodeVisible( mnode_t *node, byte *visbits );
qboolean SV_HeadnodeVisible( mnode_t *node, byte *visbits );
int SV_HullPointContents( hull_t *hull, int num, const vec3_t p );
trace_t SV_TraceHull( edict_t *ent, int hullNum, const vec3_t start, vec3_t mins, vec3_t maxs, const vec3_t end );
trace_t SV_Move( const vec3_t start, vec3_t mins, vec3_t maxs, const vec3_t end, int type, edict_t *e );
trace_t SV_MoveHull( const vec3_t start, int hullNumber, const vec3_t end, int type, edict_t *e );
const char *SV_TraceTexture( edict_t *ent, const vec3_t start, const vec3_t end );
trace_t SV_MoveToss( edict_t *tossent, edict_t *ignore );
void SV_LinkEdict( edict_t *ent, bool touch_triggers );
void SV_LinkEdict( edict_t *ent, qboolean touch_triggers );
void SV_TouchLinks( edict_t *ent, areanode_t *node );
int SV_TruePointContents( const vec3_t p );
int SV_PointContents( const vec3_t p );

View File

@ -319,9 +319,9 @@ QC code can rejected a connection for some reasons
e.g. ipban
=====================
*/
bool SV_ClientConnect( edict_t *ent, char *userinfo )
qboolean SV_ClientConnect( edict_t *ent, char *userinfo )
{
bool result = true;
qboolean result = true;
char *pszName, *pszAddress;
char szRejectReason[128];
@ -617,7 +617,7 @@ void SV_Ping( netadr_t from )
Netchan_OutOfBandPrint( NS_SERVER, from, "ack" );
}
bool Rcon_Validate( void )
qboolean Rcon_Validate( void )
{
if( !com.strlen( rcon_password->string ))
return false;
@ -800,7 +800,7 @@ this calls SV_CalcPing, and returns true
if this person needs ping data.
===================
*/
bool SV_ShouldUpdatePing( sv_client_t *cl )
qboolean SV_ShouldUpdatePing( sv_client_t *cl )
{
if( !cl->hltv_proxy )
{
@ -816,7 +816,7 @@ bool SV_ShouldUpdatePing( sv_client_t *cl )
return false;
}
bool SV_IsPlayerIndex( int idx )
qboolean SV_IsPlayerIndex( int idx )
{
if( idx > 0 && idx <= sv_maxclients->integer )
return true;
@ -987,12 +987,104 @@ void SV_New_f( sv_client_t *cl )
cl->edict = ent;
Mem_Set( &cl->lastcmd, 0, sizeof( cl->lastcmd ));
// begin fetching configstrings
// begin fetching modellist
BF_WriteByte( &cl->netchan.message, svc_stufftext );
BF_WriteString( &cl->netchan.message, va( "cmd configstrings %i %i\n", svs.spawncount, 0 ));
BF_WriteString( &cl->netchan.message, va( "cmd modellist %i %i\n", svs.spawncount, 0 ));
}
}
/*
==================
SV_WriteModels_f
==================
*/
void SV_WriteModels_f( sv_client_t *cl )
{
int start;
string cmd;
if( cl->state != cs_connected )
{
MsgDev( D_INFO, "modellist is not valid from the console\n" );
return;
}
// handle the case of a level changing while a client was connecting
if( com.atoi( Cmd_Argv( 1 )) != svs.spawncount )
{
MsgDev( D_INFO, "modellist from different level\n" );
SV_New_f( cl );
return;
}
start = com.atoi( Cmd_Argv( 2 ));
// write a packet full of data
while( BF_GetNumBytesWritten( &cl->netchan.message ) < ( MAX_MSGLEN / 2 ) && start < MAX_MODELS )
{
if( sv.model_precache[start][0] )
{
BF_WriteByte( &cl->netchan.message, svc_modelindex );
BF_WriteUBitLong( &cl->netchan.message, start, MAX_MODEL_BITS );
BF_WriteString( &cl->netchan.message, sv.model_precache[start] );
}
start++;
}
if( start == MAX_MODELS ) com.snprintf( cmd, MAX_STRING, "cmd soundlist %i %i\n", svs.spawncount, 0 );
else com.snprintf( cmd, MAX_STRING, "cmd modellist %i %i\n", svs.spawncount, start );
// send next command
BF_WriteByte( &cl->netchan.message, svc_stufftext );
BF_WriteString( &cl->netchan.message, cmd );
}
/*
==================
SV_WriteSounds_f
==================
*/
void SV_WriteSounds_f( sv_client_t *cl )
{
int start;
string cmd;
if( cl->state != cs_connected )
{
MsgDev( D_INFO, "soundlist is not valid from the console\n" );
return;
}
// handle the case of a level changing while a client was connecting
if( com.atoi( Cmd_Argv( 1 )) != svs.spawncount )
{
MsgDev( D_INFO, "soundlist from different level\n" );
SV_New_f( cl );
return;
}
start = com.atoi( Cmd_Argv( 2 ));
// write a packet full of data
while( BF_GetNumBytesWritten( &cl->netchan.message ) < ( MAX_MSGLEN / 2 ) && start < MAX_SOUNDS )
{
if( sv.sound_precache[start][0] )
{
BF_WriteByte( &cl->netchan.message, svc_soundindex );
BF_WriteUBitLong( &cl->netchan.message, start, MAX_SOUND_BITS );
BF_WriteString( &cl->netchan.message, sv.sound_precache[start] );
}
start++;
}
if( start == MAX_SOUNDS ) com.snprintf( cmd, MAX_STRING, "cmd configstrings %i %i\n", svs.spawncount, 0 );
else com.snprintf( cmd, MAX_STRING, "cmd soundlist %i %i\n", svs.spawncount, start );
// send next command
BF_WriteByte( &cl->netchan.message, svc_stufftext );
BF_WriteString( &cl->netchan.message, cmd );
}
/*
==================
SV_Configstrings_f
@ -1204,6 +1296,12 @@ SV_Begin_f
*/
void SV_Begin_f( sv_client_t *cl )
{
if( cl->state != cs_connected )
{
MsgDev( D_INFO, "begin is not valid from the console\n" );
return;
}
// handle the case of a level changing while a client was connecting
if( com.atoi( Cmd_Argv( 1 )) != svs.spawncount )
{
@ -1482,6 +1580,8 @@ ucmd_t ucmds[] =
{ "deltainfo", SV_DeltaInfo_f },
{ "info", SV_ShowServerinfo_f },
{ "nextdl", SV_NextDownload_f },
{ "modellist", SV_WriteModels_f },
{ "soundlist", SV_WriteSounds_f },
{ "disconnect", SV_Disconnect_f },
{ "usermsgs", SV_UserMessages_f },
{ "download", SV_BeginDownload_f },
@ -1759,7 +1859,7 @@ Parse a client packet
void SV_ExecuteClientMessage( sv_client_t *cl, sizebuf_t *msg )
{
int c, stringCmdCount = 0;
bool move_issued = false;
qboolean move_issued = false;
client_frame_t *frame;
char *s;

View File

@ -143,7 +143,7 @@ SV_SetPlayer
Sets sv_client and sv_player to the player with idnum Cmd_Argv(1)
==================
*/
bool SV_SetPlayer( void )
qboolean SV_SetPlayer( void )
{
char *s;
sv_client_t *cl;

View File

@ -67,7 +67,7 @@ static void SV_AddEntitiesToPacket( edict_t *pViewEnt, edict_t *pClient, client_
{
edict_t *ent;
byte *pset;
bool fullvis = false;
qboolean fullvis = false;
sv_client_t *cl, *netclient;
entity_state_t *state;
int e, player;
@ -111,7 +111,7 @@ static void SV_AddEntitiesToPacket( edict_t *pViewEnt, edict_t *pClient, client_
if( ent->v.pushmsec == sv.net_framenum )
continue;
if( ent->v.flags & FL_CHECK_PHS )
if( ent->v.effects & EF_REQUEST_PHS )
pset = clientphs;
else pset = clientpvs;
@ -258,7 +258,7 @@ void SV_EmitPacketEntities( sv_client_t *cl, client_frame_t *to, sizebuf_t *msg
if( newnum > oldnum )
{
bool force;
qboolean force;
if( EDICT_NUM( oldent->number )->free )
force = true; // entity completely removed from server

View File

@ -122,7 +122,7 @@ void SV_SetModel( edict_t *ent, const char *name )
i = SV_ModelIndex( name );
if( i == 0 ) return;
ent->v.model = MAKE_STRING( sv.configstrings[CS_MODELS+i] );
ent->v.model = MAKE_STRING( sv.model_precache[i] );
ent->v.modelindex = i;
mod_type = CM_GetModelType( ent->v.modelindex );
@ -202,14 +202,14 @@ MSG_PVS send to clients potentially visible from org
MSG_PHS send to clients potentially hearable from org
=================
*/
bool SV_Send( int dest, const vec3_t origin, const edict_t *ent )
qboolean SV_Send( int dest, const vec3_t origin, const edict_t *ent )
{
byte *mask = NULL;
int leafnum = 0, numsends = 0;
int j, numclients = sv_maxclients->integer;
sv_client_t *cl, *current = svs.clients;
bool reliable = false;
bool specproxy = false;
qboolean reliable = false;
qboolean specproxy = false;
float *viewOrg = NULL;
switch( dest )
@ -321,7 +321,7 @@ void SV_CreateDecal( const float *origin, int decalIndex, int entityIndex, int m
BF_WriteByte( &sv.signon, flags );
}
static bool SV_OriginIn( int mode, const vec3_t v1, const vec3_t v2 )
static qboolean SV_OriginIn( int mode, const vec3_t v1, const vec3_t v2 )
{
int leafnum;
byte *mask;
@ -355,7 +355,7 @@ SV_BoxInPVS
check brush boxes in fat pvs
==============
*/
static bool SV_BoxInPVS( const vec3_t org, const vec3_t absmin, const vec3_t absmax )
static qboolean SV_BoxInPVS( const vec3_t org, const vec3_t absmin, const vec3_t absmax )
{
// if( !CM_BoxVisible( absmin, absmax, CM_FatPVS( org, false )))
if( !CM_BoxVisible( absmin, absmax, CM_LeafPVS( CM_PointLeafnum( org ))))
@ -369,7 +369,7 @@ void SV_WriteEntityPatch( const char *filename )
dheader_t *header;
int ver = -1, lumpofs = 0, lumplen = 0;
byte buf[MAX_SYSPATH]; // 1 kb
bool result = false;
qboolean result = false;
f = FS_Open( va( "maps/%s.bsp", filename ), "rb" );
if( !f ) return;
@ -421,7 +421,7 @@ script_t *SV_GetEntityScript( const char *filename )
script_t *ents = NULL;
int ver = -1, lumpofs = 0, lumplen = 0;
byte buf[MAX_SYSPATH]; // 1 kb
bool result = false;
qboolean result = false;
f = FS_Open( va( "maps/%s.bsp", filename ), "rb" );
if( !f ) return NULL;
@ -483,7 +483,7 @@ int SV_MapIsValid( const char *filename, const char *spawn_entity, const char *l
// means there is no title, so clear the message string now
token_t token;
string check_name;
bool need_landmark = com.strlen( landmark_name ) > 0 ? true : false;
qboolean need_landmark = com.strlen( landmark_name ) > 0 ? true : false;
if( !need_landmark && host.developer >= 2 )
{
@ -680,7 +680,7 @@ const char *SV_ClassName( const edict_t *e )
return STRING( e->v.classname );
}
static bool SV_IsValidCmd( const char *pCmd )
static qboolean SV_IsValidCmd( const char *pCmd )
{
size_t len;
@ -692,7 +692,7 @@ static bool SV_IsValidCmd( const char *pCmd )
return false;
}
sv_client_t *SV_ClientFromEdict( const edict_t *pEdict, bool spawned_only )
sv_client_t *SV_ClientFromEdict( const edict_t *pEdict, qboolean spawned_only )
{
sv_client_t *client;
int i;
@ -843,13 +843,19 @@ pfnModelIndex
*/
int pfnModelIndex( const char *m )
{
int index;
int i;
if( !m || !m[0] ) return 0;
index = SV_FindIndex( m, CS_MODELS, MAX_MODELS, false );
if( !index ) MsgDev( D_WARN, "SV_ModelIndex: %s not precached\n", m );
if( !m || !m[0] )
return 0;
return index;
for( i = 1; i < MAX_MODELS && sv.model_precache[i][0]; i++ )
{
if( !com.strcmp( sv.model_precache[i], m ))
return i;
}
MsgDev( D_ERROR, "SV_ModelIndex: %s not precached\n", m );
return 0;
}
/*
@ -918,6 +924,30 @@ void pfnChangeLevel( const char* s1, const char* s2 )
else Cbuf_AddText( va( "changelevel %s %s\n", s1, s2 )); // Half-Life changelevel
}
/*
=================
pfnGetSpawnParms
obsolete
=================
*/
void pfnGetSpawnParms( edict_t *ent )
{
Host_Error( "SV_GetSpawnParms: %s [%i]\n", SV_ClassName( ent ), NUM_FOR_EDICT( ent ));
}
/*
=================
pfnSaveSpawnParms
obsolete
=================
*/
void pfnSaveSpawnParms( edict_t *ent )
{
Host_Error( "SV_SaveSpawnParms: %s [%i]\n", SV_ClassName( ent ), NUM_FOR_EDICT( ent ));
}
/*
=================
pfnVecToYaw
@ -1897,6 +1927,18 @@ static const char *pfnTraceTexture( edict_t *pTextureEntity, const float *v1, co
return SV_TraceTexture( pTextureEntity, v1, v2 );
}
/*
=============
pfnTraceSphere
trace sphere instead of bbox
=============
*/
void pfnTraceSphere( const float *v1, const float *v2, int fNoMonsters, float radius, edict_t *pentToSkip, TraceResult *ptr )
{
// FIXME: implement
}
/*
=============
pfnBoxVisible
@ -1920,7 +1962,7 @@ void pfnGetAimVector( edict_t* ent, float speed, float *rgflReturn )
edict_t *check, *bestent;
vec3_t start, dir, end, bestdir;
float dist, bestdist;
bool fNoFriendlyFire;
qboolean fNoFriendlyFire;
int i, j;
trace_t tr;
@ -2106,7 +2148,21 @@ register decal shader on client
*/
int pfnDecalIndex( const char *m )
{
return SV_DecalIndex( m );
int i;
if( !m || !m[0] )
return 0;
for( i = 1; i < MAX_DECALS && svgame.draw_decals[i][0]; i++ )
{
if( !com.stricmp( svgame.draw_decals[i], m ))
return i;
}
// throw warning
MsgDev( D_WARN, "Can't find decal %s\n", m );
return 0;
}
/*
@ -2468,6 +2524,25 @@ static void pfnAlertMessage( ALERT_TYPE level, char *szFmt, ... )
}
}
/*
=============
pfnEngineFprintf
legacy. probably was a part of early save\restore system
=============
*/
static void pfnEngineFprintf( FILE *pfile, char *szFmt, ... )
{
char buffer[2048]; // must support > 1k messages
va_list args;
va_start( args, szFmt );
com.vsnprintf( buffer, 2048, szFmt, args );
va_end( args );
fprintf( pfile, buffer );
}
/*
=============
pfnPvAllocEntPrivateData
@ -3197,7 +3272,7 @@ pfnInfo_RemoveKey
=============
*/
void pfnInfo_RemoveKey( char *s, char *key )
void pfnInfo_RemoveKey( char *s, const char *key )
{
Info_RemoveKey( s, key );
}
@ -3838,7 +3913,7 @@ pfnVoice_GetClientListening
=============
*/
bool pfnVoice_GetClientListening( int iReceiver, int iSender )
qboolean pfnVoice_GetClientListening( int iReceiver, int iSender )
{
int iMaxClients = sv_maxclients->integer;
@ -3859,7 +3934,7 @@ pfnVoice_SetClientListening
=============
*/
bool pfnVoice_SetClientListening( int iReceiver, int iSender, bool bListen )
qboolean pfnVoice_SetClientListening( int iReceiver, int iSender, qboolean bListen )
{
int iMaxClients = sv_maxclients->integer;
@ -3937,8 +4012,8 @@ static enginefuncs_t gEngfuncs =
pfnModelFrames,
pfnSetSize,
pfnChangeLevel,
pfnFindClientInPHS,
pfnEntitiesInPHS,
pfnGetSpawnParms,
pfnSaveSpawnParms,
pfnVecToYaw,
pfnVecToAngles,
pfnMoveToOrigin,
@ -3967,7 +4042,7 @@ static enginefuncs_t gEngfuncs =
pfnTraceHull,
pfnTraceModel,
pfnTraceTexture,
pfnBoxVisible,
pfnTraceSphere,
pfnGetAimVector,
pfnServerCommand,
pfnServerExecute,
@ -3992,7 +4067,7 @@ static enginefuncs_t gEngfuncs =
pfnCVarSetValue,
pfnCVarSetString,
pfnAlertMessage,
pfnDropClient,
pfnEngineFprintf,
pfnPvAllocEntPrivateData,
pfnPvEntPrivateData,
pfnFreeEntPrivateData,
@ -4084,12 +4159,12 @@ Parses an edict out of the given string, returning the new position
ed should be a properly initialized empty edict.
====================
*/
bool SV_ParseEdict( script_t *script, edict_t *ent )
qboolean SV_ParseEdict( script_t *script, edict_t *ent )
{
KeyValueData pkvd[256]; // per one entity
int i, numpairs = 0;
const char *classname = NULL;
bool anglehack;
qboolean anglehack;
token_t token;
// go through all the dictionary pairs
@ -4186,8 +4261,8 @@ void SV_LoadFromFile( script_t *entities )
token_t token;
int inhibited, spawned, died;
int current_skill = Cvar_VariableInteger( "skill" ); // lock skill level
bool deathmatch = Cvar_VariableInteger( "deathmatch" );
bool create_world = true;
qboolean deathmatch = Cvar_VariableInteger( "deathmatch" );
qboolean create_world = true;
edict_t *ent;
inhibited = 0;
@ -4247,7 +4322,7 @@ void SV_SpawnEntities( const char *mapname, script_t *entities )
ent = EDICT_NUM( 0 );
if( ent->free ) SV_InitEdict( ent );
ent->v.model = MAKE_STRING( sv.configstrings[CS_MODELS+1] );
ent->v.model = MAKE_STRING( sv.model_precache[1] );
ent->v.modelindex = 1; // world model
ent->v.solid = SOLID_BSP;
ent->v.movetype = MOVETYPE_PUSH;
@ -4264,6 +4339,26 @@ void SV_SpawnEntities( const char *mapname, script_t *entities )
MsgDev( D_NOTE, "Total %i entities spawned\n", svgame.numEntities );
}
/*
====================
SV_InitDecals
build list of unique decalnames
====================
*/
static void SV_InitDecals( void )
{
search_t *t;
int i;
// lookup all decals in decals.wad
t = FS_Search( "decals.wad/*.*", true );
for( i = 0; t && i < t->numfilenames; i++ )
SV_DecalIndex( t->filenames[i] );
if( t ) Mem_Free( t );
}
void SV_UnloadProgs( void )
{
SV_DeactivateServer ();
@ -4290,7 +4385,7 @@ void SV_UnloadProgs( void )
Mem_Set( &svgame, 0, sizeof( svgame ));
}
bool SV_LoadProgs( const char *name )
qboolean SV_LoadProgs( const char *name )
{
int i, version;
static APIFUNCTION GetEntityAPI;
@ -4348,7 +4443,8 @@ bool SV_LoadProgs( const char *name )
if( !GiveNewDllFuncs( &svgame.dllFuncs2, &version ))
{
MsgDev( D_WARN, "SV_LoadProgs: new interface version %i should be %i\n", NEW_DLL_FUNCTIONS_VERSION, version );
if( version != NEW_DLL_FUNCTIONS_VERSION )
MsgDev( D_WARN, "SV_LoadProgs: new interface version %i should be %i\n", NEW_DLL_FUNCTIONS_VERSION, version );
Mem_Set( &svgame.dllFuncs2, 0, sizeof( svgame.dllFuncs2 ));
}
}
@ -4387,6 +4483,8 @@ bool SV_LoadProgs( const char *name )
Cvar_FullSet( "host_gameloaded", "1", CVAR_INIT );
SV_InitDecals ();
// all done, initialize game
svgame.dllFuncs.pfnGameInit();

Some files were not shown because too many files have changed in this diff Show More