27 Dec 2008

This commit is contained in:
g-cont 2008-12-27 00:00:00 +03:00 committed by Alibek Omarov
parent 093d8f5cb6
commit aa3d4df98c
81 changed files with 1498 additions and 1444 deletions

View File

@ -1,16 +0,0 @@
<html>
<body>
<pre>
<h1>Build Log</h1>
<h3>
--------------------Configuration: client - Win32 Debug--------------------
</h3>
<h3>Command Lines</h3>
<h3>Results</h3>
client.dll - 0 error(s), 0 warning(s)
</pre>
</body>
</html>

View File

@ -62,11 +62,22 @@ void HUD_Init( void )
gHUD.Init();
}
int HUD_Redraw( float flTime, int intermission )
int HUD_Redraw( float flTime, int state )
{
gHUD.Redraw( flTime, intermission );
DrawCrosshair();
switch( state )
{
case CL_DISCONNECTED:
V_RenderSplash();
break;
case CL_LOADING:
V_RenderPlaque();
break;
case CL_ACTIVE:
gHUD.Redraw( flTime );
DrawCrosshair();
DrawPause();
break;
}
return 1;
}

View File

@ -61,6 +61,7 @@ inline void CL_PlaySound( int iSound, float flVolume, Vector &pos )
#define GetClientTime (*g_engfuncs.pfnGetClientTime)
#define GetMaxClients (*g_engfuncs.pfnGetMaxClients)
#define GetViewModel (*g_engfuncs.pfnGetViewModel)
#define MAKE_LEVELSHOT (*g_engfuncs.pfnMakeLevelShot)
#define POINT_CONTENTS (*g_engfuncs.pfnPointContents)
#define TRACE_LINE (*g_engfuncs.pfnTraceLine)
#define RANDOM_LONG (*g_engfuncs.pfnRandomLong)

View File

@ -10,92 +10,36 @@ void HUD_CreateEntities( void )
{
}
//======================
// DRAW BEAM EVENT
//======================
void EV_DrawBeam( void )
{
// special effect for displacer
cl_entity_t *view = gEngfuncs.GetViewModel();
if( view != NULL )
{
float life = 1.05;
int m_iBeam = gEngfuncs.pEventAPI->EV_FindModelIndex( "sprites/plasma.spr" );
gEngfuncs.pEfxAPI->R_BeamEnts(view->index | 0x1000, view->index | 0x2000, m_iBeam, life, 0.8, 0.5, 0.5, 0.6, 0, 10, 2, 10, 0);
gEngfuncs.pEfxAPI->R_BeamEnts(view->index | 0x1000, view->index | 0x3000, m_iBeam, life, 0.8, 0.5, 0.5, 0.6, 0, 10, 2, 10, 0);
gEngfuncs.pEfxAPI->R_BeamEnts(view->index | 0x1000, view->index | 0x4000, m_iBeam, life, 0.8, 0.5, 0.5, 0.6, 0, 10, 2, 10, 0);
}
}
//======================
// Eject Shell
//======================
void EV_EjectShell( const dstudioevent_t *event, edict_t *entity )
{
vec3_t view_ofs, ShellOrigin, ShellVelocity, forward, right, up;
vec3_t origin = entity->origin;
vec3_t angles = entity->angles;
float fR, fU;
int shell = g_engfuncs.pEventAPI->EV_FindModelIndex (event->options);
g_engfuncs.pEventAPI->EV_LocalPlayerViewheight( view_ofs );
origin.z = origin.z - view_ofs[2];
for(int j = 0; j < 3; j++ )
{
if(angles[j] < -180) angles[j] += 360;
else if(angles[j] > 180) angles[j] -= 360;
}
angles.x = -angles.x;
AngleVectors( angles, forward, right, up );
fR = gEngfuncs.pfnRandomFloat( 50, 70 );
fU = gEngfuncs.pfnRandomFloat( 100, 150 );
for (int i = 0; i < 3; i++ )
{
ShellVelocity[i] = p_velocity[i] + right[i] * fR + up[i] * fU + forward[i] * 25;
ShellOrigin[i] = origin[i] + view_ofs[i] + up[i] * -12 + forward[i] * 20 + right[i] * 4;
}
EV_EjectBrass ( ShellOrigin, ShellVelocity, angles[ YAW ], shell, TE_BOUNCE_SHELL );
}
void HUD_StudioEvent( const dstudioevent_t *event, edict_t *entity )
{
switch( event->event )
{
case 5001:
gEngfuncs.pEfxAPI->R_MuzzleFlash( (float *)&entity->attachment[0], atoi( event->options) );
// MullzeFlash at attachment 0
break;
case 5011:
gEngfuncs.pEfxAPI->R_MuzzleFlash( (float *)&entity->attachment[1], atoi( event->options) );
// MullzeFlash at attachment 1
break;
case 5021:
gEngfuncs.pEfxAPI->R_MuzzleFlash( (float *)&entity->attachment[2], atoi( event->options) );
// MullzeFlash at attachment 2
break;
case 5031:
gEngfuncs.pEfxAPI->R_MuzzleFlash( (float *)&entity->attachment[3], atoi( event->options) );
// MullzeFlash at attachment 3
break;
case 5002:
gEngfuncs.pEfxAPI->R_SparkEffect( (float *)&entity->attachment[0], atoi( event->options), -100, 100 );
// SparkEffect at attachment 0
break;
// Client side sound
case 5004:
gEngfuncs.pfnPlaySoundByNameAtLocation( (char *)event->options, 1.0, (float *)&entity->attachment[0] );
// Client side sound
break;
// Client side sound with random pitch
case 5005:
gEngfuncs.pEventAPI->EV_PlaySound( entity->index, (float *)&entity->attachment[0], CHAN_WEAPON, (char *)event->options, gEngfuncs.pfnRandomFloat(0.7, 0.9), ATTN_NORM, 0, 85 + gEngfuncs.pfnRandomLong(0,0x1f) );
// Client side sound with random pitch
break;
// Special event for displacer
case 5050:
EV_DrawBeam();
// Special event for displacer
break;
case 5060:
EV_EjectShell( event, entity );
// eject shellEV_EjectShell( event, entity );
break;
default:
break;

View File

@ -6,10 +6,6 @@
#include "hud_iface.h"
#include "hud.h"
extern float HUD_GetFOV( void );
extern float v_idlescale;
float in_fov;
void CHud :: Init( void )
{
InitMessages();
@ -131,9 +127,8 @@ int CHud :: UpdateClientData( ref_params_t *cdata, float time )
Think();
cdata->fov = m_iFOV;
cdata->fov_x = m_iFOV;
cdata->iKeyBits = m_iKeyBits;
cdata->fov = m_iFOV;
cdata->v_idlescale = m_iConcussionEffect;
if( m_flMouseSensitivity )
@ -142,7 +137,7 @@ int CHud :: UpdateClientData( ref_params_t *cdata, float time )
return 1;
}
int CHud :: Redraw( float flTime, int intermission )
int CHud :: Redraw( float flTime )
{
m_fOldTime = m_flTime; // save time of previous redraw
m_flTime = flTime;
@ -151,7 +146,8 @@ int CHud :: Redraw( float flTime, int intermission )
// clock was reset, reset delta
if( m_flTimeDelta < 0 ) m_flTimeDelta = 0;
m_iIntermission = intermission;
// make levelshot if needed
MAKE_LEVELSHOT();
// draw screen fade before hud
DrawScreenFade();
@ -180,7 +176,7 @@ int CHud :: Redraw( float flTime, int intermission )
while( pList )
{
if( !intermission )
if( !m_iIntermission )
{
if(( pList->p->m_iFlags & HUD_ACTIVE ) && !(m_iHideHUDDisplay & HIDEHUD_ALL ))
pList->p->Draw(flTime);

View File

@ -618,7 +618,7 @@ public:
void Init( void );
void VidInit( void );
void Think( void );
int Redraw( float flTime, int intermission );
int Redraw( float flTime );
int UpdateClientData( ref_params_t *pparams, float time );
CHud() : m_pHudList(NULL) { }
@ -630,6 +630,7 @@ public:
int _cdecl MsgFunc_ServerName( const char *pszName, int iSize, void *pbuf );
int _cdecl MsgFunc_ResetHUD( const char *pszName, int iSize, void *pbuf);
int _cdecl MsgFunc_InitHUD( const char *pszName, int iSize, void *pbuf );
int _cdecl MsgFunc_Intermission( const char *pszName, int iSize, void *pbuf );
int _cdecl MsgFunc_ViewMode( const char *pszName, int iSize, void *pbuf );
int _cdecl MsgFunc_SetFOV( const char *pszName, int iSize, void *pbuf );
int _cdecl MsgFunc_Concuss( const char *pszName, int iSize, void *pbuf );

View File

@ -12,7 +12,7 @@ extern cl_enginefuncs_t g_engfuncs;
extern int HUD_VidInit( void );
extern void HUD_Init( void );
extern int HUD_Redraw( float flTime, int intermission );
extern int HUD_Redraw( float flTime, int state );
extern int HUD_UpdateClientData( ref_params_t *parms, float flTime );
extern void HUD_Reset( void );
extern void HUD_Frame( double time );
@ -62,6 +62,8 @@ typedef struct dllfunction_s
gHUD.##y.UserCmd_##x( ); \
}
#define bound( min, num, max ) ((num) >= (min) ? ((num) < (max) ? (num) : (max)) : (min))
inline void UnpackRGB( int &r, int &g, int &b, dword ulRGB )
{
r = (ulRGB & 0xFF0000) >>16;\
@ -140,8 +142,17 @@ extern void SPR_DrawHoles( int frame, int x, int y, int width, int height );
extern void SPR_DrawAdditive( int frame, int x, int y, const wrect_t *prc );
extern void SetCrosshair( HSPRITE hspr, wrect_t rc, int r, int g, int b );
extern void DrawCrosshair( void );
extern void DrawPause( void );
extern void SetScreenFade( Vector fadeColor, float alpha, float duration, float holdTime, int fadeFlags );
extern void DrawScreenFade( void );
extern void DrawImageBar( float percent, HSPRITE hImage, int w, int h );
extern void DrawImageBar( float percent, HSPRITE hImage, int x, int y, int w, int h );
extern void DrawGenericBar( float percent, int w, int h );
extern void DrawGenericBar( float percent, int x, int y, int w, int h );
// from cl_view.c
extern void V_RenderSplash( void );
extern void V_RenderPlaque( void );
// stdio stuff
extern char *va( const char *format, ... );

View File

@ -39,12 +39,14 @@ DECLARE_HUDMESSAGE( AddScreen );
DECLARE_HUDMESSAGE( AddPortal );
DECLARE_HUDMESSAGE( ServerName );
DECLARE_HUDMESSAGE( ScreenShake );
DECLARE_HUDMESSAGE( Intermission );
int CHud :: InitMessages( void )
{
HOOK_MESSAGE( ResetHUD );
HOOK_MESSAGE( GameMode );
HOOK_MESSAGE( ServerName );
HOOK_MESSAGE( Intermission );
HOOK_MESSAGE( InitHUD );
HOOK_MESSAGE( ViewMode );
HOOK_MESSAGE( SetFOV );
@ -60,6 +62,7 @@ int CHud :: InitMessages( void )
HOOK_MESSAGE( AddMirror);
HOOK_MESSAGE( AddScreen );
HOOK_MESSAGE( AddPortal );
HOOK_MESSAGE( ScreenShake );
viewEntityIndex = 0; // trigger_viewset stuff
viewFlags = 0;
@ -105,6 +108,8 @@ int CHud :: MsgFunc_ResetHUD(const char *pszName, int iSize, void *pbuf )
// reset concussion effect
m_iConcussionEffect = 0;
m_iIntermission = 0;
// reset fog
m_fStartDist = 0;
m_fEndDist = 0;
@ -123,6 +128,7 @@ int CHud :: MsgFunc_InitHUD( const char *pszName, int iSize, void *pbuf )
m_fStartDist = 0;
m_fEndDist = 0;
m_iSkyMode = SKY_OFF;
m_iIntermission = 0;
// prepare all hud data
HUDLIST *pList = m_pHudList;
@ -136,7 +142,16 @@ int CHud :: MsgFunc_InitHUD( const char *pszName, int iSize, void *pbuf )
return 1;
}
int CHud::MsgFunc_SetFOV( const char *pszName, int iSize, void *pbuf )
int CHud :: MsgFunc_Intermission( const char *pszName, int iSize, void *pbuf )
{
BEGIN_READ( pszName, iSize, pbuf );
m_iIntermission = 1;
END_READ();
return 1;
}
int CHud::MsgFunc_SetFOV( const char *pszName, int iSize, void *pbuf )
{
BEGIN_READ( pszName, iSize, pbuf );

View File

@ -162,6 +162,7 @@ typedef struct
{
// temp handle
HSPRITE hSprite;
HSPRITE hPause; // pause pic
// crosshair members
HSPRITE hCrosshair;
@ -265,6 +266,113 @@ void DrawCrosshair( void )
DrawImage( ds.hCrosshair, x, y, ds.rcCrosshair.right, ds.rcCrosshair.bottom, 0 );
}
void DrawPause( void )
{
// pause image
if( !CVAR_GET_FLOAT( "paused" ) || !CVAR_GET_FLOAT( "scr_showpause" ))
return;
if( !ds.hPause ) ds.hPause = LOAD_SHADER( "gfx/shell/m_pause" );
DrawImage( ds.hPause, (SCREEN_WIDTH - 128) / 2, (SCREEN_HEIGHT - 32) / 2, 128, 32, 0 );
}
void DrawImageRectangle( HSPRITE hImage )
{
DrawImage( hImage, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0 );
}
void DrawImageBar( float percent, HSPRITE hImage, int w, int h )
{
DrawImageBar( percent, hImage, (SCREEN_WIDTH - w)/2, (SCREEN_HEIGHT - h)/2, w, h );
}
void DrawImageBar( float percent, HSPRITE hImage, int x, int y, int w, int h )
{
HSPRITE hFilled;
float progress;
int width1, width2, height;
hFilled = LOAD_SHADER( "gfx/shell/fill_rect" );
progress = bound( 0.0, percent * 0.01, 100.0 );
width2 = w * progress;
width1 = bound( 64.0, w, 512.0 );
height = bound( 16.0, h, 64.0 );
DrawImage( hImage, x, y, width1, height, 0 ); // background
SetColor( 1.0f, 1.0f, 1.0f, 0.5f );
DrawImage( hFilled, x, y, width2, height, 0 ); // progress bar
}
void DrawGenericBar( float percent, int w, int h )
{
DrawGenericBar( percent, (SCREEN_WIDTH - w)/2, (SCREEN_HEIGHT - h)/2, w, h );
}
void DrawGenericBar( float percent, int x, int y, int w, int h )
{
HSPRITE hFill, hBack;
float progress;
int width1, width2, height1, height2;
int width3, height3, pos_x, pos_y, pos2_x, pos2_y;
hFill = LOAD_SHADER( "gfx/shell/bar_load" );
hBack = LOAD_SHADER( "gfx/shell/bar_back" );
progress = bound( 0.0f, percent * 0.01f, 100.0f );
// filling area size
width1 = bound( 64.0, w, 512.0 );
height1 = bound( 16.0, h, 64.0 );
// background size
width2 = width1 - 2;
height2 = height1 - 2;
// bar size
width3 = width2 * progress;
height3 = height2;
pos_x = x;
pos_y = y;
pos2_x = x + 1;
pos2_y = y + 1;
FillRGBA( pos_x, pos_y, width1, height1, 255, 255, 255, 255 );
DrawImage( hBack, pos2_x, pos2_y, width2, height2, 0 );
SetColor( 1.0f, 1.0f, 1.0f, 0.5f );
DrawImage( hFill, pos2_x, pos2_y, width3, height3, 0 );
}
//
// 27/12/08 moved here from cl_view.c
//
void V_RenderPlaque( void )
{
const char *levelshot;
HSPRITE hDownload;
levelshot = CVAR_GET_STRING( "cl_levelshot_name" );
if( !strcmp( levelshot, "" )) levelshot = "<black>";
// logo that shows up while upload next level
DrawImageRectangle( LOAD_SHADER( levelshot ));
DrawImageBar( CVAR_GET_FLOAT( "scr_loading" ), LOAD_SHADER( "gfx/shell/m_loading" ), 128, 32 );
if( !CVAR_GET_FLOAT( "scr_download" )) return;
// FIXME: replace with picture "m_download"
hDownload = LOAD_SHADER( "gfx/shell/m_loading" );
DrawImageBar( CVAR_GET_FLOAT( "scr_download" ), hDownload, (SCREEN_WIDTH-128)/2, 420, 128, 32 );
}
void V_RenderSplash( void )
{
DrawImageRectangle( LOAD_SHADER( "gfx/shell/splash" ));
}
void SetScreenFade( Vector fadeColor, float alpha, float duration, float holdTime, int fadeFlags )
{
sf.fadeColor = fadeColor;

View File

@ -58,6 +58,7 @@ goto done
rem //delete log files
if exist baserc\baserc.plg del /f /q baserc\baserc.plg
if exist client\client.plg del /f /q client\client.plg
if exist engine\engine.plg del /f /q engine\engine.plg
if exist launch\launch.plg del /f /q launch\launch.plg
if exist common\common.plg del /f /q common\common.plg
@ -71,5 +72,5 @@ if exist vsound\vsound.plg del /f /q vsound\vsound.plg
echo Build succeeded!
echo Please wait. Xash is now loading
cd D:\Xash3D\
quake.exe -game tmpQuArK -log -debug -dev 5 +map qctest
quake.exe -game tmpQuArK -log -debug -dev 3 +map qctest
:done

View File

@ -84,10 +84,10 @@ void CL_WriteDemoHeader( const char *name )
// baselines
Mem_Set( &nullstate, 0, sizeof( nullstate ));
for( i = 0; i < game.numEntities; i++ )
for( i = 0; i < clgame.numEntities; i++ )
{
ent = EDICT_NUM( i );
state = &ent->pvEngineData->baseline;
state = &ent->pvClientData->baseline;
if( !state->model.index ) continue;
if( buf.cursize + 64 > buf.maxsize )
@ -99,7 +99,7 @@ void CL_WriteDemoHeader( const char *name )
buf.cursize = 0;
}
MSG_WriteByte( &buf, svc_spawnbaseline );
MSG_WriteDeltaEntity( &nullstate, &ent->pvEngineData->baseline, &buf, true, true );
MSG_WriteDeltaEntity( &nullstate, &ent->pvClientData->baseline, &buf, true, true );
}
MSG_WriteByte( &buf, svc_stufftext );
@ -109,6 +109,9 @@ void CL_WriteDemoHeader( const char *name )
len = LittleLong( buf.cursize );
FS_Write( cls.demofile, &len, 4 );
FS_Write( cls.demofile, buf.data, buf.cursize );
// force client.dll update
Cmd_ExecuteString( "cmd fullupdate\n" );
}
/*

View File

@ -587,8 +587,8 @@ void CL_AddParticles( void )
if( !cl_particles->integer ) return;
if( EDICT_NUM( cl.frame.ps.number )->pvEngineData->current.gravity != 0 )
gravity = EDICT_NUM( cl.frame.ps.number )->pvEngineData->current.gravity / 800.0; // FIXME: register CS_GRAVITY
if( EDICT_NUM( cl.frame.ps.number )->pvClientData->current.gravity != 0 )
gravity = EDICT_NUM( cl.frame.ps.number )->pvClientData->current.gravity / 800.0; // FIXME: register CS_GRAVITY
else gravity = 1.0f;
for( p = cl_active_particles; p; p = next )

View File

@ -16,12 +16,12 @@ FRAME PARSING
void CL_UpdateEntityFields( edict_t *ent )
{
// copy state to progs
ent->v.classname = cl.edict_classnames[ent->pvEngineData->current.classname];
ent->v.modelindex = ent->pvEngineData->current.model.index;
ent->v.ambient = ent->pvEngineData->current.soundindex;
ent->v.model = MAKE_STRING( cl.configstrings[CS_MODELS+ent->pvEngineData->current.model.index] );
VectorCopy( ent->pvEngineData->current.origin, ent->v.origin );
VectorCopy( ent->pvEngineData->current.angles, ent->v.angles );
ent->v.classname = cl.edict_classnames[ent->pvClientData->current.classname];
ent->v.modelindex = ent->pvClientData->current.model.index;
ent->v.ambient = ent->pvClientData->current.soundindex;
ent->v.model = MAKE_STRING( cl.configstrings[CS_MODELS+ent->pvClientData->current.model.index] );
VectorCopy( ent->pvClientData->current.origin, ent->v.origin );
VectorCopy( ent->pvClientData->current.angles, ent->v.angles );
}
/*
@ -49,25 +49,25 @@ void CL_DeltaEntity( sizebuf_t *msg, frame_t *frame, int newnum, entity_state_t
frame->num_entities++;
// some data changes will force no lerping
if( state->model.index != ent->pvEngineData->current.model.index || state->pmodel.index != ent->pvEngineData->current.pmodel.index || state->model.body != ent->pvEngineData->current.model.body
|| state->model.sequence != ent->pvEngineData->current.model.sequence || abs(state->origin[0] - ent->pvEngineData->current.origin[0]) > 512
|| abs(state->origin[1] - ent->pvEngineData->current.origin[1]) > 512 || abs(state->origin[2] - ent->pvEngineData->current.origin[2]) > 512 )
if( state->model.index != ent->pvClientData->current.model.index || state->pmodel.index != ent->pvClientData->current.pmodel.index || state->model.body != ent->pvClientData->current.model.body
|| state->model.sequence != ent->pvClientData->current.model.sequence || abs(state->origin[0] - ent->pvClientData->current.origin[0]) > 512
|| abs(state->origin[1] - ent->pvClientData->current.origin[1]) > 512 || abs(state->origin[2] - ent->pvClientData->current.origin[2]) > 512 )
{
ent->pvEngineData->serverframe = -99;
ent->pvClientData->serverframe = -99;
}
if( ent->pvEngineData->serverframe != cl.frame.serverframe - 1 )
if( ent->pvClientData->serverframe != cl.frame.serverframe - 1 )
{
// duplicate the current state so lerping doesn't hurt anything
ent->pvEngineData->prev = *state;
ent->pvClientData->prev = *state;
}
else
{ // shuffle the last state to previous
ent->pvEngineData->prev = ent->pvEngineData->current;
ent->pvClientData->prev = ent->pvClientData->current;
}
ent->pvEngineData->serverframe = cl.frame.serverframe;
ent->pvEngineData->current = *state;
ent->pvClientData->serverframe = cl.frame.serverframe;
ent->pvClientData->current = *state;
// update prvm fields
CL_UpdateEntityFields( ent );
@ -155,7 +155,7 @@ void CL_ParsePacketEntities( sizebuf_t *msg, frame_t *oldframe, frame_t *newfram
{
// delta from baseline
edict_t *ent = EDICT_NUM( newnum );
CL_DeltaEntity( msg, newframe, newnum, &ent->pvEngineData->baseline, false );
CL_DeltaEntity( msg, newframe, newnum, &ent->pvClientData->baseline, false );
continue;
}
@ -263,8 +263,8 @@ void CL_ParseFrame( sizebuf_t *msg )
if( sv_newprotocol->integer )
{
// now we can reading delta player state
if( old ) cl.frame.ps = MSG_ParseDeltaPlayer( &old->ps, &clent->pvEngineData->current );
else cl.frame.ps = MSG_ParseDeltaPlayer( NULL, &clent->pvEngineData->current );
if( old ) cl.frame.ps = MSG_ParseDeltaPlayer( &old->ps, &clent->pvClientData->current );
else cl.frame.ps = MSG_ParseDeltaPlayer( NULL, &clent->pvClientData->current );
}
// FIXME
@ -311,7 +311,7 @@ void CL_AddPacketEntities( frame_t *frame )
{
s1 = &cl_parse_entities[(frame->parse_entities + pnum)&(MAX_PARSE_ENTITIES-1)];
ent = EDICT_NUM( s1->number );
re->AddRefEntity( &ent->pvEngineData->current, &ent->pvEngineData->prev, cl.lerpfrac );
re->AddRefEntity( &ent->pvClientData->current, &ent->pvClientData->prev, cl.refdef.lerpfrac );
}
}
@ -331,11 +331,11 @@ void CL_AddViewWeapon( entity_state_t *ps )
if( ps->fov > 135 ) return;
view = EDICT_NUM( ps->aiment );
VectorCopy( cl.refdef.vieworg, view->pvEngineData->current.origin );
VectorCopy( cl.refdef.viewangles, view->pvEngineData->current.angles );
VectorCopy( cl.refdef.vieworg, view->pvEngineData->prev.origin );
VectorCopy( cl.refdef.viewangles, view->pvEngineData->prev.angles );
re->AddRefEntity( &view->pvEngineData->current, &view->pvEngineData->prev, cl.lerpfrac );
VectorCopy( cl.refdef.vieworg, view->pvClientData->current.origin );
VectorCopy( cl.refdef.viewangles, view->pvClientData->current.angles );
VectorCopy( cl.refdef.vieworg, view->pvClientData->prev.origin );
VectorCopy( cl.refdef.viewangles, view->pvClientData->prev.angles );
re->AddRefEntity( &view->pvClientData->current, &view->pvClientData->prev, cl.refdef.lerpfrac );
}
@ -359,16 +359,16 @@ void CL_CalcViewValues( void )
if( cl_showclamp->value )
Msg ("high clamp %i\n", cl.time - cl.frame.servertime);
cl.time = cl.frame.servertime;
cl.lerpfrac = 1.0f;
cl.refdef.lerpfrac = 1.0f;
}
else if (cl.time < cl.frame.servertime - Host_FrameTime())
{
if (cl_showclamp->value)
Msg( "low clamp %i\n", cl.frame.servertime - Host_FrameTime() - cl.time);
cl.time = cl.frame.servertime - Host_FrameTime();
cl.lerpfrac = 0.0f;
cl.refdef.lerpfrac = 0.0f;
}
else cl.lerpfrac = 1.0 - (cl.frame.servertime - cl.time) * 0.01f;
else cl.refdef.lerpfrac = 1.0 - (cl.frame.servertime - cl.time) * 0.01f;
// find the previous frame to interpolate from
ps = &cl.frame.ps;
@ -381,7 +381,7 @@ void CL_CalcViewValues( void )
// see if the player entity was teleported this frame
if( ps->pm_flags & PMF_TIME_TELEPORT )
ops = ps; // don't interpolate
lerp = cl.lerpfrac;
lerp = cl.refdef.lerpfrac;
// calculate the origin
if((cl_predict->value) && !(cl.frame.ps.pm_flags & PMF_NO_PREDICTION) && !cls.demoplayback )
@ -393,7 +393,7 @@ void CL_CalcViewValues( void )
for( i = 0; i < 3; i++ )
{
cl.refdef.vieworg[i] = cl.predicted_origin[i] + ops->viewoffset[i]
+ cl.lerpfrac * (ps->viewoffset[i] - ops->viewoffset[i]) - backlerp * cl.prediction_error[i];
+ cl.refdef.lerpfrac * (ps->viewoffset[i] - ops->viewoffset[i]) - backlerp * cl.prediction_error[i];
}
// smooth out stair climbing
@ -422,7 +422,7 @@ void CL_CalcViewValues( void )
for( i = 0; i < 3; i++ )
cl.refdef.viewangles[i] += LerpAngle( ops->punch_angles[i], ps->punch_angles[i], lerp );
AngleVectors( cl.refdef.viewangles, cl.v_forward, cl.v_right, cl.v_up );
AngleVectors( cl.refdef.viewangles, cl.refdef.forward, cl.refdef.right, cl.refdef.up );
// interpolate field of view
cl.refdef.fov_x = ops->fov + lerp * ( ps->fov - ops->fov );
@ -472,18 +472,18 @@ void CL_GetEntitySoundSpatialization( int entnum, vec3_t origin, vec3_t velocity
ent = EDICT_NUM( entnum );
// calculate origin
origin[0] = ent->pvEngineData->prev.origin[0] + (ent->pvEngineData->current.origin[0] - ent->pvEngineData->prev.origin[0]) * cl.lerpfrac;
origin[1] = ent->pvEngineData->prev.origin[1] + (ent->pvEngineData->current.origin[1] - ent->pvEngineData->prev.origin[1]) * cl.lerpfrac;
origin[2] = ent->pvEngineData->prev.origin[2] + (ent->pvEngineData->current.origin[2] - ent->pvEngineData->prev.origin[2]) * cl.lerpfrac;
origin[0] = ent->pvClientData->prev.origin[0] + (ent->pvClientData->current.origin[0] - ent->pvClientData->prev.origin[0]) * cl.refdef.lerpfrac;
origin[1] = ent->pvClientData->prev.origin[1] + (ent->pvClientData->current.origin[1] - ent->pvClientData->prev.origin[1]) * cl.refdef.lerpfrac;
origin[2] = ent->pvClientData->prev.origin[2] + (ent->pvClientData->current.origin[2] - ent->pvClientData->prev.origin[2]) * cl.refdef.lerpfrac;
// calculate velocity
VectorSubtract( ent->pvEngineData->current.origin, ent->pvEngineData->prev.origin, velocity);
VectorSubtract( ent->pvClientData->current.origin, ent->pvClientData->prev.origin, velocity);
VectorScale(velocity, 10, velocity);
// if a brush model, offset the origin
if( VectorIsNull( origin ))
{
cmodel = cl.models[ent->pvEngineData->current.model.index];
cmodel = cl.models[ent->pvClientData->current.model.index];
if( !cmodel ) return;
VectorAverage( cmodel->mins, cmodel->maxs, midPoint );
VectorAdd( origin, midPoint, origin );

View File

@ -19,7 +19,7 @@ Render callback for studio models
*/
entity_state_t *CL_GetEdictByIndex( int index )
{
return &EDICT_NUM( index )->pvEngineData->current;
return &EDICT_NUM( index )->pvClientData->current;
}
/*
@ -31,7 +31,7 @@ Render callback for studio models
*/
entity_state_t *CL_GetLocalPlayer( void )
{
return &EDICT_NUM( cl.playernum + 1 )->pvEngineData->current;
return &EDICT_NUM( cl.playernum + 1 )->pvClientData->current;
}
/*
@ -73,8 +73,9 @@ float *CL_FadeColor( float starttime, float endtime )
return color;
}
void CL_DrawHUD( void )
void CL_DrawHUD( int state )
{
cls.dllFuncs.pfnRedraw( cl.time * 0.001f, state );
}
void CL_CopyTraceResult( TraceResult *out, trace_t trace )
@ -98,84 +99,109 @@ void CL_CopyTraceResult( TraceResult *out, trace_t trace )
out->pHit = trace.ent;
}
void CL_PrepUserMessage( char *pszName, const int svc_num )
static void CL_CreateUserMessage( int lastnum, const char *szMsgName, int svc_num, int iSize, pfnUserMsgHook pfn )
{
user_message_t *msg;
if( lastnum == clgame.numMessages )
{
if( clgame.numMessages == MAX_USER_MESSAGES )
{
MsgDev( D_ERROR, "CL_CreateUserMessage: user messages limit is out\n" );
return;
}
clgame.numMessages++;
}
msg = clgame.msg[lastnum];
// clear existing or allocate new one
if( msg ) Mem_Set( msg, 0, sizeof( *msg ));
else msg = clgame.msg[lastnum] = Mem_Alloc( cls.mempool, sizeof( *msg ));
com.strncpy( msg->name, szMsgName, CS_SIZE );
msg->number = svc_num;
msg->size = iSize;
msg->func = pfn;
}
void CL_LinkUserMessage( char *pszName, const int svc_num )
{
user_message_t *msg;
char *end;
char msgName[CS_SIZE];
int i, msgSize;
if( !pszName || !*pszName ) return; // ignore blank names
if( game.numMessages == MAX_USER_MESSAGES )
{
MsgDev( D_ERROR, "CL_PrepUserMessage: user messages limit is out\n" );
return;
}
// clear existing or allocate new one
msg = game.msg[game.numMessages];
if( msg ) Mem_Set( msg, 0, sizeof( *msg ));
else msg = Mem_Alloc( cls.mempool, sizeof( *msg ));
end = com.strchr( pszName, '@' );
com.strncpy( msgName, pszName, CS_SIZE );
end = com.strchr( msgName, '@' );
if( !end )
{
MsgDev( D_ERROR, "CL_PrepUserMessage: can't register message %s\n", pszName );
MsgDev( D_ERROR, "CL_LinkUserMessage: can't register message %s\n", msgName );
return;
}
msg->size = com.atoi( end + 1 );
pszName[end-pszName] = '\0'; // remove size description from MsgName
msg->name = pszName;
msg->number = svc_num;
game.numMessages++;
msgSize = com.atoi( end + 1 );
msgName[end-msgName] = '\0'; // remove size description from MsgName
// debug
Msg("name %s [%i][svc_%i]\n", msg->name, msg->size, msg->number );
// search message by name to link with
for( i = 0; i < clgame.numMessages; i++ )
{
msg = clgame.msg[i];
if( !msg ) continue;
if( !com.strcmp( msg->name, msgName ))
{
msg->number = svc_num;
msg->size = msgSize;
return;
}
}
// create an empty message
CL_CreateUserMessage( i, msgName, svc_num, msgSize, NULL );
}
void CL_SortUserMessages( void )
{
// FIXME: implement
}
void CL_ParseUserMessage( sizebuf_t *net_buffer, int svc_num )
{
user_message_t *msg;
int iSize;
int i, iSize;
byte *pbuf;
// NOTE: any user message parse on engine, not in client.dll
if( svc_num >= game.numMessages || !game.msg[svc_num] )
if( svc_num >= clgame.numMessages )
{
// unregister message can't be parsed
Host_Error( "CL_ParseUserMessage: illegible server message %d\n", svc_num );
return;
}
if( svc_num != game.msg[svc_num]->number )
// search for svc_num
for( i = 0; i < clgame.numMessages; i++ )
{
int i;
// search for right number
for( i = 0; i < game.numMessages; i++ )
{
msg = game.msg[i];
if( !msg || msg->number == svc_num )
break;
}
// throw warn
MsgDev( D_WARN, "CL_ParseUserMessage: wrong message num %i\n", svc_num );
if( i == game.numMessages || !msg )
{
// this never happens
Host_Error( "CL_ParseUserMessage: illegible server message %d\n", svc_num );
return;
}
msg = clgame.msg[i];
if( !msg ) continue;
if( msg->number == svc_num )
break;
}
if( i == clgame.numMessages || !msg )
{
// unregistered message ?
Host_Error( "CL_ParseUserMessage: illegible server message %d\n", svc_num );
return;
}
else msg = game.msg[svc_num];
iSize = msg->size;
pbuf = NULL;
// message with variable sizes receive actual size as first byte
// FIXME: replace with short for support messages more than 255 bytes ?
// message with variable sizes receive an actual size as first byte
if( iSize == -1 ) iSize = MSG_ReadByte( net_buffer );
if( iSize > 0 ) pbuf = Mem_Alloc( cls.private, iSize );
@ -183,7 +209,7 @@ void CL_ParseUserMessage( sizebuf_t *net_buffer, int svc_num )
MSG_ReadData( net_buffer, pbuf, iSize );
if( msg->func ) msg->func( msg->name, iSize, pbuf );
else MsgDev( D_WARN, "CL_ParseUserMessage: message %s doesn't have execute function\n", msg->name );
else MsgDev( D_WARN, "CL_ParseUserMessage: %s not hooked\n", msg->name );
if( pbuf ) Mem_Free( pbuf );
}
@ -192,7 +218,7 @@ void CL_InitEdict( edict_t *pEdict )
Com_Assert( pEdict == NULL );
pEdict->v.pContainingEntity = pEdict; // make cross-links for consistency
pEdict->pvEngineData = (ed_priv_t *)Mem_Alloc( cls.mempool, sizeof( ed_priv_t ));
pEdict->pvClientData = (cl_priv_t *)Mem_Alloc( cls.mempool, sizeof( cl_priv_t ));
pEdict->serialnumber = NUM_FOR_EDICT( pEdict ); // merged on first update
pEdict->free = false;
}
@ -205,10 +231,10 @@ void CL_FreeEdict( edict_t *pEdict )
// unlink from world
// CL_UnlinkEdict( pEdict );
if( pEdict->pvEngineData ) Mem_Free( pEdict->pvEngineData );
if( pEdict->pvClientData ) Mem_Free( pEdict->pvClientData );
Mem_Set( &pEdict->v, 0, sizeof( entvars_t ));
pEdict->pvEngineData = NULL;
pEdict->pvClientData = NULL;
// mark edict as freed
pEdict->freetime = cl.time * 0.001f;
@ -221,7 +247,7 @@ edict_t *CL_AllocEdict( void )
edict_t *pEdict;
int i;
for( i = 0; i < game.numEntities; i++ )
for( i = 0; i < clgame.numEntities; i++ )
{
pEdict = EDICT_NUM( i );
// the first couple seconds of server time can involve a lot of
@ -233,10 +259,10 @@ edict_t *CL_AllocEdict( void )
}
}
if( i == game.maxEntities )
if( i == clgame.maxEntities )
Host_Error( "CL_AllocEdict: no free edicts\n" );
game.numEntities++;
clgame.numEntities++;
pEdict = EDICT_NUM( i );
CL_InitEdict( pEdict );
@ -248,12 +274,13 @@ void CL_FreeEdicts( void )
int i;
edict_t *ent;
for( i = 0; game.numEntities; i++ )
for( i = 0; i < clgame.numEntities; i++ )
{
ent = EDICT_NUM( i );
if( ent->free ) continue;
CL_FreeEdict( ent );
}
clgame.numEntities = 0;
}
/*
@ -284,6 +311,7 @@ static void pfnMemFree( void *mem, const char *filename, const int fileline )
{
com.free( mem, filename, fileline );
}
/*
=============
pfnLoadShader
@ -406,27 +434,30 @@ pfnHookUserMsg
=============
*/
void pfnHookUserMsg( char *szMsgName, pfnUserMsgHook pfn )
void pfnHookUserMsg( const char *szMsgName, pfnUserMsgHook pfn )
{
user_message_t *msg;
int i;
// ignore blank names
if( !szMsgName || !*szMsgName ) return;
for( i = 0; game.numMessages; i++ )
// duplicate call can change msgFunc
for( i = 0; i < clgame.numMessages; i++ )
{
msg = game.msg[i];
if( !msg ) break;
msg = clgame.msg[i];
if( !msg ) continue;
if( !com.strcmp( szMsgName, msg->name ))
{
// msg registration is complete
msg->func = pfn;
if( msg->func != pfn )
msg->func = pfn;
return;
}
}
MsgDev( D_ERROR, "CL_HookMessage: can't hook message %s\n", szMsgName );
// allocate a new one
CL_CreateUserMessage( i, szMsgName, 0, 0, pfn );
}
/*
@ -699,7 +730,7 @@ pfnGetEntityByIndex
*/
edict_t* pfnGetEntityByIndex( int idx )
{
if( idx < 0 || idx > game.numEntities )
if( idx < 0 || idx > clgame.numEntities )
{
MsgDev( D_ERROR, "CL_GetEntityByIndex: invalid entindex %i\n", idx );
return EDICT_NUM( 0 );
@ -764,6 +795,24 @@ edict_t* pfnGetViewModel( void )
return EDICT_NUM( cl.playernum + 1 )->v.aiment;
}
/*
=============
pfnMakeLevelShot
force to make levelshot
=============
*/
void pfnMakeLevelShot( void )
{
if( !cl.need_levelshot ) return;
Con_ClearNotify();
cl.need_levelshot = false;
// make levelshot at nextframe()
Cbuf_ExecuteText( EXEC_APPEND, "levelshot\n" );
}
/*
=============
pfnPointContents
@ -795,6 +844,28 @@ static void pfnTraceLine( const float *v1, const float *v2, int fNoMonsters, edi
CL_CopyTraceResult( ptr, trace );
}
/*
=============
CL_AllocString
=============
*/
string_t CL_AllocString( const char *szValue )
{
return StringTable_SetString( clgame.hStringTable, szValue );
}
/*
=============
CL_GetString
=============
*/
const char *CL_GetString( string_t iString )
{
return StringTable_GetString( clgame.hStringTable, iString );
}
static triapi_t gTriApi =
{
sizeof( triapi_t ),
@ -837,7 +908,8 @@ static cl_enginefuncs_t gEngfuncs =
pfnIsSpectateOnly,
pfnGetClientTime,
pfnGetMaxClients,
pfnGetViewModel,
pfnGetViewModel,
pfnMakeLevelShot,
pfnPointContents,
pfnTraceLine,
pfnRandomLong,
@ -869,7 +941,7 @@ void CL_UnloadProgs( void )
// initialize game
cls.dllFuncs.pfnShutdown();
StringTable_Delete( game.hStringTable );
StringTable_Delete( clgame.hStringTable );
Com_FreeLibrary( cls.game );
Mem_FreePool( &cls.mempool );
Mem_FreePool( &cls.private );
@ -907,14 +979,17 @@ bool CL_LoadProgs( const char *name )
}
// 65535 unique strings should be enough ...
game.hStringTable = StringTable_Create( "Client Strings", 0x10000 );
StringTable_SetString( game.hStringTable, "" ); // make NULL string
game.maxEntities = host.max_edicts; // FIXME: must come from CS_MAXENTITIES
game.maxClients = Host_MaxClients();
game.edicts = Mem_Alloc( cls.mempool, sizeof( edict_t ) * game.maxEntities );
game.numMessages = 1; // message with index 0 it's svc_bad
clgame.hStringTable = StringTable_Create( "Client Strings", 0x10000 );
StringTable_SetString( clgame.hStringTable, "" ); // make NULL string
clgame.maxEntities = host.max_edicts; // FIXME: must come from CS_MAXENTITIES
clgame.maxClients = Host_MaxClients();
cls.edicts = Mem_Alloc( cls.mempool, sizeof( edict_t ) * clgame.maxEntities );
for( i = 0, e = game.edicts; i < game.maxEntities; i++, e++ )
// register svc_bad message
pfnHookUserMsg( "bad", NULL );
CL_LinkUserMessage( "bad@0", svc_bad );
for( i = 0, e = EDICT_NUM( 0 ); i < clgame.maxEntities; i++, e++ )
e->free = true; // mark all edicts as freed
// initialize game

View File

@ -469,12 +469,12 @@ void CL_SendCmd( void )
}
// begin a client move command
MSG_Init(&buf, data, sizeof(data));
MSG_WriteByte (&buf, clc_move);
MSG_Init( &buf, data, sizeof( data ));
MSG_WriteByte( &buf, clc_move );
// save the position for a checksum byte
checksumIndex = buf.cursize;
MSG_WriteByte (&buf, 0);
MSG_WriteByte( &buf, 0 );
// let the server know what the last frame we
// got was, so the next message can be delta compressed

View File

@ -67,6 +67,7 @@ cvar_t *fov;
client_static_t cls;
client_t cl;
clgame_static_t clgame;
entity_state_t cl_parse_entities[MAX_PARSE_ENTITIES];
@ -335,6 +336,8 @@ void CL_ClearState (void)
CL_ClearEffects ();
CL_FreeEdicts();
cls.dllFuncs.pfnVidInit();
// wipe the entire cl structure
Mem_Set( &cl, 0, sizeof( cl ));
MSG_Clear( &cls.netchan.message );
@ -1037,7 +1040,7 @@ void CL_RequestNextDownload( void )
while( precache_tex < pe->NumTextures())
{
com.sprintf( fn, "textures/%s.tga", pe->GetTextureName( precache_tex++ ));
if(!CL_CheckOrDownloadFile( fn )) return; // started a download
if( !CL_CheckOrDownloadFile( fn )) return; // started a download
}
}
precache_check = TEXTURE_CNT + 999;
@ -1045,6 +1048,7 @@ void CL_RequestNextDownload( void )
CL_PrepSound();
CL_PrepVideo();
CL_SortUserMessages();
if( cls.demoplayback ) return; // not really connected
MSG_WriteByte( &cls.netchan.message, clc_stringcmd );
@ -1220,7 +1224,7 @@ void CL_Frame( dword time )
SCR_UpdateScreen();
// update audio
S_Update( cl.playernum + 1, cl.refdef.vieworg, vec3_origin, cl.v_forward, cl.v_up );
S_Update( cl.playernum + 1, cl.refdef.vieworg, vec3_origin, cl.refdef.forward, cl.refdef.up );
// advance local effects for next frame
CL_RunDLights ();

View File

@ -256,7 +256,7 @@ void CL_ParseServerData( sizebuf_t *msg )
if(!FS_FileExists( Cvar_VariableString( "cl_levelshot_name" )))
{
Cvar_Set( "cl_levelshot_name", "" );
cl.make_levelshot = true; // make levelshot
cl.need_levelshot = true; // make levelshot
}
// seperate the printfs so the server message can have a color
Msg("\35\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\36\37\n");
@ -281,10 +281,10 @@ void CL_ParseBaseline( sizebuf_t *msg )
newnum = MSG_ReadBits( msg, NET_WORD );
// increase edicts
while( newnum >= game.numEntities ) CL_AllocEdict();
while( newnum >= clgame.numEntities ) CL_AllocEdict();
ent = EDICT_NUM( newnum );
MSG_ReadDeltaEntity( msg, &nullstate, &ent->pvEngineData->baseline, newnum );
MSG_ReadDeltaEntity( msg, &nullstate, &ent->pvClientData->baseline, newnum );
}
/*
@ -325,7 +325,7 @@ void CL_ParseConfigString( sizebuf_t *msg )
}
else if( i >= CS_USER_MESSAGES && i < CS_USER_MESSAGES+MAX_USER_MESSAGES )
{
CL_PrepUserMessage( cl.configstrings[i], i - CS_USER_MESSAGES );
CL_LinkUserMessage( cl.configstrings[i], i - CS_USER_MESSAGES );
}
else if( i >= CS_CLASSNAMES && i < CS_CLASSNAMES+MAX_CLASSNAMES )
{
@ -424,6 +424,9 @@ void CL_ParseServerMessage( sizebuf_t *msg )
case svc_setangle:
CL_ParseSetAngle( msg );
break;
case svc_print:
Con_Print( va( "^6%s\n", MSG_ReadString( msg )));
break;
case svc_frame:
CL_ParseFrame( msg );
break;

View File

@ -6,102 +6,6 @@
#include "common.h"
#include "client.h"
/*
=========
PF_drawnet
void DrawNet( vector pos, string image )
=========
*/
static void PF_drawnet( void )
{
float *pos;
shader_t shader;
if(!VM_ValidateArgs( "DrawNet", 2 ))
return;
if(cls.netchan.outgoing_sequence - cls.netchan.incoming_acknowledged < CMD_BACKUP-1)
return;
VM_ValidateString(PRVM_G_STRING(OFS_PARM1));
pos = PRVM_G_VECTOR(OFS_PARM0);
shader = re->RegisterShader( PRVM_G_STRING(OFS_PARM1), SHADER_NOMIP );
SCR_DrawPic( pos[0], pos[1], -1, -1, shader );
}
/*
=========
PF_drawfps
void DrawFPS( vector pos )
=========
*/
static void PF_drawfps( void )
{
float calc;
static double nexttime = 0, lasttime = 0;
static double framerate = 0;
static long framecount = 0;
double newtime;
bool red = false; // fps too low
char fpsstring[32];
float *color, *pos;
if(cls.state != ca_active) return;
if(!cl_showfps->integer) return;
if(!VM_ValidateArgs( "drawfps", 1 ))
return;
newtime = Sys_DoubleTime();
if( newtime >= nexttime )
{
framerate = framecount / (newtime - lasttime);
lasttime = newtime;
nexttime = max(nexttime + 1, lasttime - 1);
framecount = 0;
}
framecount++;
calc = framerate;
pos = PRVM_G_VECTOR(OFS_PARM0);
if ((red = (calc < 1.0f)))
{
com.snprintf(fpsstring, sizeof(fpsstring), "%4i spf", (int)(1.0f / calc + 0.5));
color = g_color_table[1];
}
else
{
com.snprintf(fpsstring, sizeof(fpsstring), "%4i fps", (int)(calc + 0.5));
color = g_color_table[3];
}
SCR_DrawBigStringColor(pos[0], pos[1], fpsstring, color );
}
/*
=========
PF_levelshot
float HUD_MakeLevelShot( void )
=========
*/
static void PF_levelshot( void )
{
PRVM_G_FLOAT(OFS_RETURN) = 0;
if(!VM_ValidateArgs( "HUD_MakeLevelShot", 0 ))
return;
if( cl.make_levelshot )
{
Con_ClearNotify();
cl.make_levelshot = false;
// make levelshot at nextframe()
Cbuf_ExecuteText( EXEC_APPEND, "levelshot\n" );
PRVM_G_FLOAT(OFS_RETURN) = 1;
}
}
/*
=================
PF_findexplosionplane

View File

@ -6,7 +6,7 @@
#include "common.h"
#include "client.h"
vrect_t scr_vrect; // position of render window on screen
int scr_rect[4]; // position of render window on screen
cvar_t *scr_viewsize;
cvar_t *scr_centertime;
@ -20,6 +20,7 @@ cvar_t *cl_testentities;
cvar_t *cl_testlights;
cvar_t *cl_levelshot_name;
cvar_t *cl_envshot_size;
cvar_t *cl_neticon;
cvar_t *cl_font;
void SCR_TimeRefresh_f( void );
@ -292,6 +293,61 @@ void SCR_StopCinematic( void )
S_StopAllSounds();
}
/*
==============
SCR_DrawNet
==============
*/
void SCR_DrawNet( void )
{
if( cls.netchan.outgoing_sequence - cls.netchan.incoming_acknowledged < CMD_BACKUP-1 )
return;
SCR_DrawPic( scr_rect[0] + 64, scr_rect[1], 48, 48, cls.netIcon );
}
/*
==============
SCR_DrawFPS
==============
*/
void SCR_DrawFPS( void )
{
float calc;
static double nexttime = 0, lasttime = 0;
static double framerate = 0;
static int framecount = 0;
double newtime;
bool red = false; // fps too low
char fpsstring[32];
float *color;
if( cls.state != ca_active ) return;
newtime = Sys_DoubleTime();
if (newtime >= nexttime)
{
framerate = framecount / (newtime - lasttime);
lasttime = newtime;
nexttime = max(nexttime + 1, lasttime - 1);
framecount = 0;
}
framecount++;
calc = framerate;
if ((red = (calc < 1.0f)))
{
com.snprintf( fpsstring, sizeof( fpsstring ), "%4i spf", (int)(1.0f / calc + 0.5));
color = g_color_table[1];
}
else
{
com.snprintf( fpsstring, sizeof( fpsstring ), "%4i fps", (int)(calc + 0.5));
color = g_color_table[3];
}
SCR_DrawBigStringColor( SCREEN_WIDTH - 146, SCREEN_HEIGHT - 32, fpsstring, color );
}
/*
==================
SCR_UpdateScreen
@ -307,14 +363,16 @@ void SCR_UpdateScreen( void )
switch( cls.state )
{
case ca_disconnected:
CL_DrawHUD( CL_DISCONNECTED );
break;
case ca_connecting:
case ca_connected:
CL_DrawHUD();
CL_DrawHUD( CL_LOADING );
break;
case ca_active:
V_CalcRect();
V_RenderView();
CL_DrawHUD();
CL_DrawHUD( CL_ACTIVE );
CL_DrawDemoRecording();
break;
case ca_cinematic:
@ -324,7 +382,6 @@ void SCR_UpdateScreen( void )
Host_Error( "SCR_UpdateScreen: bad cls.state\n" );
break;
}
V_PostRender();
}
@ -333,7 +390,8 @@ void SCR_RegisterShaders( void )
// register console images
cls.consoleFont = re->RegisterShader( va( "gfx/fonts/%s", con_font->string ), SHADER_FONT );
cls.clientFont = re->RegisterShader( va( "gfx/fonts/%s", cl_font->string ), SHADER_FONT );
cls.consoleBack = re->RegisterShader( "gfx/shell/conback", SHADER_NOMIP ); // hardcoded ...
cls.consoleBack = re->RegisterShader( "gfx/shell/conback", SHADER_NOMIP ); // FIXME: hardcoded ...
cls.netIcon = re->RegisterShader( cl_neticon->string, SHADER_NOMIP );
}
/*
@ -352,6 +410,7 @@ void SCR_Init( void )
cl_testentities = Cvar_Get ("cl_testentities", "0", 0, "test client entities" );
cl_testlights = Cvar_Get ("cl_testlights", "0", 0, "test dynamic lights" );
cl_envshot_size = Cvar_Get( "cl_envshot_size", "256", CVAR_ARCHIVE, "envshot size of cube side" );
cl_neticon = Cvar_Get( "cl_neticon", "gfx/shell/net", CVAR_ARCHIVE, "path to icon that displayed bad network connection" );
cl_font = Cvar_Get( "cl_font", "default", CVAR_ARCHIVE, "in-game messages font" );
// register our commands

View File

@ -44,11 +44,11 @@ Sets scr_vrect, the coordinates of the rendered window
*/
void V_CalcRect( void )
{
scr_vrect.width = scr_width->integer;
scr_vrect.width &= ~7;
scr_vrect.height = scr_height->integer;
scr_vrect.height &= ~1;
scr_vrect.y = scr_vrect.x = 0;
scr_rect[2] = scr_width->integer;
scr_rect[2] &= ~7;
scr_rect[3] = scr_height->integer;
scr_rect[3] &= ~1;
scr_rect[0] = scr_rect[1] = 0;
}
/*
@ -73,7 +73,7 @@ void V_TestEntities( void )
f = 64 * (i/4) + 128;
for( j = 0; j < 3; j++ )
ent.origin[j] = cl.refdef.vieworg[j] + cl.v_forward[j] * f + cl.v_right[j] * r;
ent.origin[j] = cl.refdef.vieworg[j] + cl.refdef.forward[j] * f + cl.refdef.right[j] * r;
ent.model.controller[0] = ent.model.controller[1] = 90.0f;
ent.model.controller[2] = ent.model.controller[3] = 180.0f;
@ -104,7 +104,7 @@ void V_TestLights( void )
f = 64 * (i/4) + 128;
for( j = 0; j < 3; j++ )
dl.origin[j] = cl.refdef.vieworg[j] + cl.v_forward[j] * f + cl.v_right[j] * r;
dl.origin[j] = cl.refdef.vieworg[j] + cl.refdef.forward[j] * f + cl.refdef.right[j] * r;
dl.color[0] = ((i%6)+1) & 1;
dl.color[1] = (((i%6)+1) & 2)>>1;
@ -156,7 +156,7 @@ void V_RenderView( void )
// build a refresh entity list and calc cl.sim*
// this also calls CL_CalcViewValues which loads
// v_forward, etc.
// refdef.forward, etc.
CL_AddEntities ();
if( cl_testentities->value ) V_TestEntities();
@ -169,11 +169,11 @@ void V_RenderView( void )
cl.refdef.vieworg[1] += 1.0 / 32;
cl.refdef.vieworg[2] += 1.0 / 32;
Mem_Copy( &cl.refdef.rect, &scr_vrect, sizeof( vrect_t ));
Mem_Copy( &cl.refdef.viewport, &scr_rect, sizeof( cl.refdef.viewport ));
cl.refdef.areabits = cl.frame.areabits;
cl.refdef.rdflags = cl.frame.ps.renderfx;
cl.refdef.fov_y = V_CalcFov( cl.refdef.fov_x, cl.refdef.rect.width, cl.refdef.rect.height );
cl.refdef.fov_y = V_CalcFov( cl.refdef.fov_x, cl.refdef.viewport[2], cl.refdef.viewport[3] );
cl.refdef.time = cl.time * 0.001f; // cl.time for right lerping
cl.refdef.oldtime = (cl.time * 0.001f) - 0.005; // frametime
@ -211,6 +211,8 @@ V_PostRender
*/
void V_PostRender( void )
{
SCR_DrawNet();
SCR_DrawFPS();
UI_Draw();
Con_DrawConsole();
re->EndFrame();

View File

@ -32,8 +32,10 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#define MAX_SERVERS 64
#define ColorIndex(c) (((c) - '0') & 7)
#define NUM_FOR_EDICT(e) ((int)((edict_t *)(e) - game.edicts))
#define EDICT_NUM( num ) _EDICT_NUM( num, __FILE__, __LINE__ )
#define NUM_FOR_EDICT(e) ((int)((edict_t *)(e) - cls.edicts))
#define EDICT_NUM( num ) CL_EDICT_NUM( num, __FILE__, __LINE__ )
#define STRING( offset ) CL_GetString( offset )
#define MAKE_STRING(str) CL_AllocString( str )
//=============================================================================
typedef struct frame_s
@ -75,19 +77,19 @@ typedef struct
int parse_entities; // index (not anded off) into cl_parse_entities[]
usercmd_t cmds[CMD_BACKUP]; // each mesage will send several old cmds
int cmd_number;
int predicted_origins[CMD_BACKUP][3]; // for debug comparing against server
usercmd_t cmds[CMD_BACKUP]; // each mesage will send several old cmds
int predicted_origins[CMD_BACKUP][3];// for debug comparing against server
float predicted_step; // for stair up smoothing
float predicted_step; // for stair up smoothing
uint predicted_step_time;
vec3_t predicted_origin; // generated by CL_PredictMovement
vec3_t predicted_origin; // generated by CL_PredictMovement
vec3_t predicted_angles;
vec3_t prediction_error;
frame_t frame; // received from server
int surpressCount; // number of messages rate supressed
frame_t frame; // received from server
int surpressCount; // number of messages rate supressed
frame_t frames[UPDATE_BACKUP];
// mouse current position
@ -105,34 +107,26 @@ typedef struct
dword time; // this is the time value that the client
// is rendering at. always <= cls.realtime
float lerpfrac; // between oldframe and frame
ref_params_t refdef; // shared refdef
refdef_t refdef;
vec3_t v_forward, v_right, v_left, v_up; // set when refdef.angles is set
// centerprint stuff
// misc 2d drawing stuff
int centerPrintTime;
int centerPrintCharWidth;
int centerPrintY;
char centerPrint[1024];
int centerPrintLines;
bool make_levelshot;
bool need_levelshot;
//
// server state information
//
int servercount; // server identification for prespawns
int playernum;
int servercount; // server identification for prespawns
char configstrings[MAX_CONFIGSTRINGS][CS_SIZE];
//
// locally derived information from server state
//
cmodel_t *models[MAX_MODELS];
cmodel_t *worldmodel;
string_t edict_classnames[MAX_CLASSNAMES];
sound_t sound_precache[MAX_SOUNDS];
shader_t decal_shaders[MAX_DECALS];
@ -168,7 +162,7 @@ typedef enum
} dltype_t; // download type
// cl_private_edict_t
struct ed_priv_s
struct cl_priv_s
{
int serverframe; // if not current, this ent isn't in the frame
@ -199,7 +193,7 @@ typedef enum { key_game, key_console, key_message, key_menu } keydest_t;
typedef struct
{
const char *name;
char name[CS_SIZE];
int number; // svc_ number
int size; // if size == -1, size come from first byte after svcnum
pfnUserMsgHook func; // user-defined function
@ -212,13 +206,6 @@ typedef struct
int maxEntities;
user_message_t *msg[MAX_USER_MESSAGES];
int numMessages; // actual count of user messages
union
{
edict_t *edicts; // acess by edict number
void *vp; // acess by offset in bytes
};
int hStringTable; // stringtable handle
} clgame_static_t;
@ -234,6 +221,12 @@ typedef struct
byte *mempool; // edicts pool
byte *private; // client.dll private pool
union
{
edict_t *edicts; // acess by edict number
void *vp; // acess by offset in bytes
};
int framecount;
dword realtime; // always increasing, no clamping, etc
float frametime; // seconds since last frame
@ -249,6 +242,7 @@ typedef struct
shader_t consoleFont; // current console font
shader_t clientFont; // current client font
shader_t consoleBack; // console background
shader_t netIcon; // netIcon displayed bad network connection
file_t *download; // file transfer from server
string downloadname;
@ -273,7 +267,7 @@ typedef struct
} client_static_t;
extern client_static_t cls;
extern clgame_static_t game;
extern clgame_static_t clgame;
/*
==============================================================
@ -282,7 +276,7 @@ SCREEN CONSTS
==============================================================
*/
extern vrect_t scr_vrect; // position of render window
extern int scr_rect[4]; // position of render window
extern vec4_t g_color_table[8];
//
@ -304,6 +298,7 @@ extern cvar_t *cl_pitchspeed;
extern cvar_t *cl_envshot_size;
extern cvar_t *cl_run;
extern cvar_t *cl_font;
extern cvar_t *cl_neticon;
extern cvar_t *cl_anglespeedkey;
@ -460,7 +455,7 @@ void CL_Stop_f( void );
void CL_InitClientProgs( void );
void CL_FreeClientProgs( void );
int CL_GetMaxClients( void );
void CL_DrawHUD( void );
void CL_DrawHUD( int state );
edict_t *CL_GetEdict( int entnum );
float *CL_FadeColor( float starttime, float endtime );
void CL_FreeEdicts( void );
@ -471,22 +466,23 @@ void CL_FreeEdicts( void );
void CL_UnloadProgs( void );
bool CL_LoadProgs( const char *name );
void CL_ParseUserMessage( sizebuf_t *msg, int svc_num );
void CL_PrepUserMessage( char *pszName, const int svc_num );
void CL_LinkUserMessage( char *pszName, const int svc_num );
void CL_SortUserMessages( void );
edict_t *CL_AllocEdict( void );
void CL_FreeEdict( edict_t *pEdict );
string_t pfnAllocString( const char *szValue );
const char *pfnGetString( string_t iString );
string_t CL_AllocString( const char *szValue );
const char *CL_GetString( string_t iString );
void pfnGetGameDir( char *szGetGameDir );
long pfnRandomLong( long lLow, long lHigh );
float pfnRandomFloat( float flLow, float flHigh );
byte* pfnLoadFile( const char *filename, int *pLength );
void pfnFreeFile( void *buffer );
_inline edict_t *_EDICT_NUM( int n, const char *file, const int line )
_inline edict_t *CL_EDICT_NUM( int n, const char *file, const int line )
{
if((n >= 0) && (n < game.maxEntities))
return game.edicts + n;
Host_Error( "EDICT_NUM: bad number %i (called at %s:%i)\n", n, file, line );
if((n >= 0) && (n < clgame.maxEntities))
return cls.edicts + n;
Host_Error( "CL_EDICT_NUM: bad number %i (called at %s:%i)\n", n, file, line );
return NULL;
}

View File

@ -144,14 +144,6 @@ PRVM INTERACTIONS
==============================================================
*/
char *ED_NewString( const char *string, byte *mempool );
#define NUM_FOR_EDICT(e) ((int)((edict_t *)(e) - game.edicts))
#define EDICT_NUM( num ) _EDICT_NUM( num, __FILE__, __LINE__ )
// for constant strings
#define STRING( offset ) pfnGetString( offset )
#define MAKE_STRING(str) pfnAllocString( str )
#define prog vm->prog // global callback to vprogs.dll
#define PRVM_EDICT_NUM( num ) _PRVM_EDICT_NUM( num, __FILE__, __LINE__ )

View File

@ -9,28 +9,6 @@
#include "const.h"
#include "client.h"
/*
=============
pfnAllocString
=============
*/
string_t pfnAllocString( const char *szValue )
{
return StringTable_SetString( game.hStringTable, szValue );
}
/*
=============
pfnGetString
=============
*/
const char *pfnGetString( string_t iString )
{
return StringTable_GetString( game.hStringTable, iString );
}
/*
=============
pfnLoadFile
@ -1333,9 +1311,8 @@ void VM_drawmodel( void )
{
float *size, *pos, *origin, *angles;
const char *modname;
vrect_t rect;
static refdef_t refdef;
int sequence;
static ref_params_t refdef;
entity_state_t ent;
static float frame;
@ -1353,11 +1330,13 @@ void VM_drawmodel( void )
memset( &ent, 0, sizeof( ent ));
SCR_AdjustSize( &pos[0], &pos[1], &size[0], &size[1] );
rect.x = pos[0]; rect.y = pos[1]; rect.width = size[0]; rect.height = size[1];
Mem_Copy( &refdef.rect, &rect, sizeof(vrect_t));
refdef.viewport[0] = pos[0];
refdef.viewport[1] = pos[1];
refdef.viewport[2] = size[0];
refdef.viewport[3] = size[1];
refdef.fov_x = 50;
refdef.fov_y = V_CalcFov( refdef.fov_x, refdef.rect.width, refdef.rect.height );
refdef.fov_y = V_CalcFov( refdef.fov_x, refdef.viewport[2], refdef.viewport[3] );
refdef.time = cls.realtime * 0.001f;
refdef.oldtime = refdef.time - 0.005;
refdef.rdflags = RDF_NOWORLDMODEL;

View File

@ -43,9 +43,6 @@ enum svc_ops_e
{
// user messages
svc_bad = 0, // don't send!
svc_temp_entity, // client effects
svc_print, // [byte] id [string] null terminated string
svc_centerprint, // [string] to put in center of the screen
// engine messages
svc_nop = 201, // end of user messages
@ -62,6 +59,7 @@ enum svc_ops_e
svc_frame, // server frame
svc_sound, // <see code>
svc_setangle, // [short short short] set the view angle to this absolute value
svc_print, // [byte] id [string] null terminated string
};
// client to server

View File

@ -585,7 +585,7 @@ void Host_InitCommon( int argc, char **argv )
newcom.error = Host_Error;
// check developer mode
if(FS_GetParmFromCmdLine("-dev", dev_level ))
if(FS_GetParmFromCmdLine( "-dev", dev_level ))
host.developer = com.atoi(dev_level);
Host_InitEvents();

View File

@ -39,6 +39,11 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#define SPAWNFLAG_NOT_HARD 0x00000400
#define SPAWNFLAG_NOT_DEATHMATCH 0x00000800
#define NUM_FOR_EDICT(e) ((int)((edict_t *)(e) - svgame.edicts))
#define EDICT_NUM( num ) SV_EDICT_NUM( num, __FILE__, __LINE__ )
#define STRING( offset ) SV_GetString( offset )
#define MAKE_STRING(str) SV_AllocString( str )
typedef enum
{
ss_dead, // no map loaded
@ -112,7 +117,6 @@ typedef struct sv_client_s
edict_t *edict; // EDICT_NUM(clientnum+1)
char name[32]; // extracted from userinfo, high bits masked
int messagelevel; // for filtering printed messages
// The datagram is written to by sound calls, prints, temp ents, etc.
// It can be harmlessly overflowed.
@ -143,7 +147,7 @@ typedef struct link_s
} link_t;
// sv_private_edict_t
struct ed_priv_s
struct sv_priv_s
{
link_t area; // linked to a division node or leaf
struct sv_client_s *client; // filled for player ents
@ -157,6 +161,7 @@ struct ed_priv_s
bool forceupdate; // physic_push force update
bool suspended; // suspended in air toss object
bool linked; // passed through SV_LinkEdict
bool stuck; // entity stucked in brush
vec3_t water_origin; // step old origin
vec3_t moved_origin; // push old origin
@ -194,9 +199,16 @@ typedef struct
typedef struct
{
// user messages stuff
int msg_sizes[MAX_USER_MESSAGES]; // user messages bounds checker
int msg_leftsize; // left in bytes
int msg_size_index; // write message size at this pos in sizebuf
int msg_realsize; // left in bytes
int msg_index; // for debug messages
int msg_dest; // msg destination ( MSG_ONE, MSG_ALL etc )
edict_t *msg_ent;
vec3_t msg_org;
void *hInstance; // pointer to server.dll
union
{
@ -204,6 +216,11 @@ typedef struct
void *vp; // acess by offset in bytes
};
globalvars_t *globals; // server globals
DLL_FUNCTIONS dllFuncs; // dll exported funcs
byte *mempool; // edicts pool
byte *private; // server.dll private pool
// library exports table
word *ordinals;
dword *funcs;
@ -220,16 +237,6 @@ typedef struct
dword realtime; // always increasing, no clamping, etc
float timeleft; // frametime * game_frames
void *game; // pointer to server.dll
globalvars_t *globals; // server globals
DLL_FUNCTIONS dllFuncs; // dll exported funcs
byte *mempool; // edicts pool
byte *private; // server.dll private pool
byte *stringpool; // sv.strings pool
int msg_dest; // msg destination ( MSG_ONE, MSG_ALL etc )
edict_t *msg_ent;
vec3_t msg_org;
string mapcmd; // ie: *intro.cin+base
string comment; // map name, e.t.c.
@ -251,8 +258,8 @@ typedef struct
extern netadr_t master_adr[MAX_MASTERS]; // address of the master server
extern const char *ed_name[];
extern server_static_t svs; // persistant server info
extern svgame_static_t game; // persistant game info
extern server_t sv; // local server
extern svgame_static_t svgame; // persistant game info
extern cvar_t *sv_paused;
extern cvar_t *sv_noreload; // don't reload level state when reentering
@ -332,12 +339,11 @@ bool SV_movestep( edict_t *ent, vec3_t move, bool relink, bool noenemy, bool set
//
// sv_send.c
//
void SV_SendClientMessages (void);
void SV_SendClientMessages( void );
void SV_AmbientSound( edict_t *entity, int soundindex, float volume, float attenuation );
void SV_StartSound (vec3_t origin, edict_t *entity, int channel, int index, float vol, float attn, float timeofs);
void SV_ClientPrintf (sv_client_t *cl, int level, char *fmt, ...);
void SV_BroadcastPrintf (int level, char *fmt, ...);
void SV_BroadcastCommand (char *fmt, ...);
void SV_ClientPrintf( sv_client_t *cl, char *fmt, ... );
void SV_BroadcastPrintf( char *fmt, ... );
void SV_BroadcastCommand( char *fmt, ... );
//
// sv_client.c
@ -367,8 +373,9 @@ void SV_Error (char *error, ...);
//
// sv_game.c
//
bool SV_LoadProgs( const char *name );
void SV_LoadProgs( const char *name );
void SV_UnloadProgs( void );
void SV_FreeEdicts( void );
void SV_InitEdict( edict_t *pEdict );
void SV_ConfigString (int index, const char *val);
void SV_SetModel (edict_t *ent, const char *name);
@ -379,19 +386,19 @@ void SV_CopyTraceToGlobal( trace_t *trace );
void SV_CopyTraceResult( TraceResult *out, trace_t trace );
float SV_AngleMod( float ideal, float current, float speed );
void SV_SpawnEntities( const char *mapname, script_t *entities );
string_t pfnAllocString( const char *szValue );
const char *pfnGetString( string_t iString );
string_t SV_AllocString( const char *szValue );
const char *SV_GetString( string_t iString );
void pfnGetGameDir( char *szGetGameDir );
long pfnRandomLong( long lLow, long lHigh );
float pfnRandomFloat( float flLow, float flHigh );
byte* pfnLoadFile( const char *filename, int *pLength );
void pfnFreeFile( void *buffer );
_inline edict_t *_EDICT_NUM( int n, const char * file, const int line )
_inline edict_t *SV_EDICT_NUM( int n, const char * file, const int line )
{
if((n >= 0) && (n < svs.globals->maxEntities))
return game.edicts + n;
Host_Error( "EDICT_NUM: bad number %i (called at %s:%i)\n", n, file, line );
if((n >= 0) && (n < svgame.globals->maxEntities))
return svgame.edicts + n;
Host_Error( "SV_EDICT_NUM: bad number %i (called at %s:%i)\n", n, file, line );
return NULL;
}

View File

@ -174,7 +174,7 @@ gotnewcl:
edictnum = (newcl - svs.clients) + 1;
ent = EDICT_NUM( edictnum );
ent->pvEngineData->client = newcl;
ent->pvServerData->client = newcl;
newcl->edict = ent;
newcl->challenge = challenge; // save challenge for checksumming
@ -226,8 +226,8 @@ bool SV_ClientConnect( edict_t *ent, char *userinfo )
ent->v.flags = 0;
MsgDev(D_NOTE, "SV_ClientConnect()\n");
svs.globals->time = sv.time;
result = svs.dllFuncs.pfnClientConnect( ent, userinfo );
svgame.globals->time = sv.time;
result = svgame.dllFuncs.pfnClientConnect( ent, userinfo );
return result;
}
@ -251,8 +251,8 @@ void SV_DropClient( sv_client_t *drop )
MSG_WriteByte( &drop->netchan.message, svc_disconnect );
// let the game known about client state
svs.globals->time = sv.time;
svs.dllFuncs.pfnClientDisconnect( drop->edict );
svgame.globals->time = sv.time;
svgame.dllFuncs.pfnClientDisconnect( drop->edict );
SV_FreeEdict( drop->edict );
if( drop->download ) drop->download = NULL;
@ -302,7 +302,6 @@ void SV_FlushRedirect( netadr_t adr, int dest, char *buf )
case RD_CLIENT:
if( !sv_client ) return; // client not set
MSG_WriteByte( &sv_client->netchan.message, svc_print );
MSG_WriteByte( &sv_client->netchan.message, HUD_PRINTCONSOLE );
MSG_WriteString( &sv_client->netchan.message, buf );
break;
case RD_NONE:
@ -479,31 +478,31 @@ void SV_PutClientInServer( edict_t *ent )
sv_client_t *client;
index = NUM_FOR_EDICT( ent ) - 1;
client = ent->pvEngineData->client;
client = ent->pvServerData->client;
svs.globals->time = sv.time;
svgame.globals->time = sv.time;
ent->free = false;
ent->pvEngineData->s.ed_type = ED_CLIENT; // init edict type
ent->pvServerData->s.ed_type = ED_CLIENT; // init edict type
if( !sv.loadgame )
{
// fisrt entering
svs.dllFuncs.pfnClientPutInServer( ent );
svgame.dllFuncs.pfnClientPutInServer( ent );
ent->v.v_angle[ROLL] = 0; // cut off any camera rolling
ent->v.origin[2] += 1; // make sure off ground
}
ent->pvEngineData->s.fov = 90; // FIXME: get from qc
ent->pvEngineData->s.fov = bound(1, ent->pvEngineData->s.fov, 160);
ent->pvEngineData->s.health = ent->v.health;
ent->pvEngineData->s.classname = SV_ClassIndex( STRING( ent->v.classname ));
ent->pvEngineData->s.pmodel.index = SV_ModelIndex( STRING( ent->v.weaponmodel ));
VectorCopy( ent->v.origin, ent->pvEngineData->s.origin );
VectorCopy( ent->v.v_angle, ent->pvEngineData->s.viewangles );
for( i = 0; i < 3; i++ ) ent->pvEngineData->s.delta_angles[i] = ANGLE2SHORT(ent->v.v_angle[i]);
ent->pvServerData->s.fov = 90; // FIXME: get from qc
ent->pvServerData->s.fov = bound(1, ent->pvServerData->s.fov, 160);
ent->pvServerData->s.health = ent->v.health;
ent->pvServerData->s.classname = SV_ClassIndex( STRING( ent->v.classname ));
ent->pvServerData->s.pmodel.index = SV_ModelIndex( STRING( ent->v.weaponmodel ));
VectorCopy( ent->v.origin, ent->pvServerData->s.origin );
VectorCopy( ent->v.v_angle, ent->pvServerData->s.viewangles );
for( i = 0; i < 3; i++ ) ent->pvServerData->s.delta_angles[i] = ANGLE2SHORT(ent->v.v_angle[i]);
SV_LinkEdict( ent ); // m_pmatrix calculated here, so we need call this before pe->CreatePlayer
ent->pvEngineData->physbody = pe->CreatePlayer( ent, SV_GetModelPtr( ent ), ent->v.origin, ent->v.m_pmatrix );
ent->pvServerData->physbody = pe->CreatePlayer( ent, SV_GetModelPtr( ent ), ent->v.origin, ent->v.m_pmatrix );
}
/*
@ -783,10 +782,6 @@ void SV_UserinfoChanged( sv_client_t *cl )
else cl->rate = 3000;
}
// msg command
val = Info_ValueForKey( cl->userinfo, "msg" );
if( com.strlen( val )) cl->messagelevel = com.atoi( val );
// maintain the IP information
// this is set in SV_DirectConnect ( directly on the server, not transmitted ),
// may be lost when client updates it's userinfo the banning code relies on this being consistently present
@ -810,9 +805,9 @@ static void SV_UpdateUserinfo_f( sv_client_t *cl )
SV_UserinfoChanged( cl );
// call prog code to allow overrides
svs.globals->time = sv.time;
svs.globals->frametime = sv.frametime;
svs.dllFuncs.pfnClientUserInfoChanged( cl->edict, cl->userinfo );
svgame.globals->time = sv.time;
svgame.globals->frametime = sv.frametime;
svgame.dllFuncs.pfnClientUserInfoChanged( cl->edict, cl->userinfo );
}
ucmd_t ucmds[] =
@ -851,9 +846,9 @@ void SV_ExecuteClientCommand( sv_client_t *cl, char *s )
if( !u->name && sv.state == ss_active )
{
// custom client commands
svs.globals->time = sv.time;
svs.globals->frametime = sv.frametime;
svs.dllFuncs.pfnClientCommand( cl->edict );
svgame.globals->time = sv.time;
svgame.globals->frametime = sv.frametime;
svgame.dllFuncs.pfnClientCommand( cl->edict );
}
}
@ -1012,15 +1007,15 @@ void SV_ApplyClientMove( sv_client_t *cl, usercmd_t *cmd )
// circularly clamp the angles with deltas
for( i = 0; i < 3; i++ )
{
temp = cmd->angles[i] + ent->pvEngineData->s.delta_angles[i];
ent->pvEngineData->s.viewangles[i] = SHORT2ANGLE( temp );
temp = cmd->angles[i] + ent->pvServerData->s.delta_angles[i];
ent->pvServerData->s.viewangles[i] = SHORT2ANGLE( temp );
}
// don't let the player look up or down more than 90 degrees
if( ent->pvEngineData->s.viewangles[PITCH] > 89 && ent->pvEngineData->s.viewangles[PITCH] < 180 )
ent->pvEngineData->s.viewangles[PITCH] = 89;
else if( ent->pvEngineData->s.viewangles[PITCH] < 271 && ent->pvEngineData->s.viewangles[PITCH] >= 180 )
ent->pvEngineData->s.viewangles[PITCH] = 271;
if( ent->pvServerData->s.viewangles[PITCH] > 89 && ent->pvServerData->s.viewangles[PITCH] < 180 )
ent->pvServerData->s.viewangles[PITCH] = 89;
else if( ent->pvServerData->s.viewangles[PITCH] < 271 && ent->pvServerData->s.viewangles[PITCH] >= 180 )
ent->pvServerData->s.viewangles[PITCH] = 271;
// test
if( ent->v.flags & FL_DUCKING )
@ -1030,9 +1025,9 @@ void SV_ApplyClientMove( sv_client_t *cl, usercmd_t *cmd )
cmd->upmove *= 0.333;
}
VectorCopy( ent->pvEngineData->s.viewangles, cl->edict->v.v_angle );
VectorCopy( ent->pvEngineData->s.viewangles, cl->edict->v.angles );
VectorCopy( ent->v.view_ofs, cl->edict->pvEngineData->s.viewoffset );
VectorCopy( ent->pvServerData->s.viewangles, cl->edict->v.v_angle );
VectorCopy( ent->pvServerData->s.viewangles, cl->edict->v.angles );
VectorCopy( ent->v.view_ofs, cl->edict->pvServerData->s.viewoffset );
}
void SV_DropPunchAngle( sv_client_t *cl )
@ -1326,8 +1321,8 @@ void SV_ClientThink( sv_client_t *cl, usercmd_t *cmd )
SV_AirMove( cl, &cl->cmd );
SV_CheckVelocity( cl->edict );
VectorCopy( cl->edict->v.origin, cl->edict->pvEngineData->s.origin );
VectorCopy( cl->edict->v.velocity, cl->edict->pvEngineData->s.velocity );
VectorCopy( cl->edict->v.origin, cl->edict->pvServerData->s.origin );
VectorCopy( cl->edict->v.velocity, cl->edict->pvServerData->s.velocity );
}
/*
@ -1386,8 +1381,8 @@ static void SV_UserMove( sv_client_t *cl, sizebuf_t *msg )
if( !sv_paused->value )
{
frametime[0] = sv.frametime;
frametime[1] = svs.globals->frametime;
svs.globals->frametime = sv.frametime = newcmd.msec * 0.001f;
frametime[1] = svgame.globals->frametime;
svgame.globals->frametime = sv.frametime = newcmd.msec * 0.001f;
net_drop = cl->netchan.dropped;
if( net_drop < 20 )
@ -1403,7 +1398,7 @@ static void SV_UserMove( sv_client_t *cl, sizebuf_t *msg )
SV_Physics_ClientMove( cl, &newcmd );
}
sv.frametime = frametime[0];
svs.globals->frametime = frametime[1];
svgame.globals->frametime = frametime[1];
cl->lastcmd = newcmd;
}

View File

@ -16,20 +16,16 @@ SV_ClientPrintf
Sends text across to be displayed if the level passes
=================
*/
void SV_ClientPrintf( sv_client_t *cl, int level, char *fmt, ... )
void SV_ClientPrintf( sv_client_t *cl, char *fmt, ... )
{
va_list argptr;
char string[MAX_SYSPATH];
if( level < cl->messagelevel )
return;
va_start( argptr, fmt );
com.vsprintf( string, fmt, argptr );
va_end( argptr );
MSG_WriteByte( &cl->netchan.message, svc_print );
MSG_WriteByte( &cl->netchan.message, level );
MSG_WriteString( &cl->netchan.message, string );
}
@ -40,7 +36,7 @@ SV_BroadcastPrintf
Sends text to all active clients
=================
*/
void SV_BroadcastPrintf( int level, char *fmt, ... )
void SV_BroadcastPrintf( char *fmt, ... )
{
char string[MAX_SYSPATH];
va_list argptr;
@ -55,10 +51,8 @@ void SV_BroadcastPrintf( int level, char *fmt, ... )
if( host.type == HOST_DEDICATED ) Msg( "%s", string );
for( i = 0, cl = svs.clients; i < Host_MaxClients(); i++, cl++ )
{
if( level < cl->messagelevel) continue;
if( cl->state != cs_spawned ) continue;
MSG_WriteByte( &cl->netchan.message, svc_print );
MSG_WriteByte( &cl->netchan.message, level );
MSG_WriteString( &cl->netchan.message, string );
}
}
@ -370,8 +364,8 @@ void SV_Kick_f( void )
}
if(!SV_SetPlayer()) return;
SV_BroadcastPrintf( HUD_PRINTCONSOLE, "%s was kicked\n", sv_client->name );
SV_ClientPrintf( sv_client, HUD_PRINTCONSOLE, "You were kicked from the game\n" );
SV_BroadcastPrintf( "%s was kicked\n", sv_client->name );
SV_ClientPrintf( sv_client, "You were kicked from the game\n" );
SV_DropClient( sv_client );
sv_client->lastmessage = svs.realtime; // min case there is a funny zombie
}
@ -454,7 +448,7 @@ void SV_ConSay_f( void )
for (i = 0, client = svs.clients; i < Host_MaxClients(); i++, client++)
{
if( client->state != cs_spawned ) continue;
SV_ClientPrintf( client, HUD_PRINTTALK, "%s\n", text );
SV_ClientPrintf( client, "%s\n", text );
}
}

View File

@ -50,46 +50,46 @@ void SV_UpdateEntityState( edict_t *ent )
int i;
// copy progs values to state
ent->pvEngineData->s.number = ent->serialnumber;
ent->pvEngineData->s.solid = ent->pvEngineData->solid;
ent->pvServerData->s.number = ent->serialnumber;
ent->pvServerData->s.solid = ent->pvServerData->solid;
VectorCopy (ent->v.origin, ent->pvEngineData->s.origin);
VectorCopy (ent->v.angles, ent->pvEngineData->s.angles);
ent->pvEngineData->s.model.index = ent->v.modelindex;
ent->pvEngineData->s.health = ent->v.health;
ent->pvEngineData->s.model.skin = ent->v.skin; // studio model skin
ent->pvEngineData->s.model.body = ent->v.body; // studio model submodel
ent->pvEngineData->s.model.frame = ent->v.frame; // any model current frame
ent->pvEngineData->s.model.gaitsequence = ent->v.gaitsequence;// player sequence, that will be playing on client
ent->pvEngineData->s.effects = ent->v.effects; // shared client and render flags
ent->pvEngineData->s.renderfx = ent->v.renderfx; // renderer flags
ent->pvEngineData->s.rendermode = ent->v.rendermode; // rendering mode
ent->pvEngineData->s.renderamt = ent->v.renderamt; // alpha value
ent->pvEngineData->s.model.framerate = ent->v.framerate;
ent->pvEngineData->s.model.animtime = (int)(1000.0 * ent->v.animtime) * 0.001; // sequence time
ent->pvEngineData->s.model.scale = ent->v.scale; // shared client and render flags
VectorCopy( ent->v.rendercolor, ent->pvEngineData->s.rendercolor );
VectorCopy (ent->v.origin, ent->pvServerData->s.origin);
VectorCopy (ent->v.angles, ent->pvServerData->s.angles);
ent->pvServerData->s.model.index = ent->v.modelindex;
ent->pvServerData->s.health = ent->v.health;
ent->pvServerData->s.model.skin = ent->v.skin; // studio model skin
ent->pvServerData->s.model.body = ent->v.body; // studio model submodel
ent->pvServerData->s.model.frame = ent->v.frame; // any model current frame
ent->pvServerData->s.model.gaitsequence = ent->v.gaitsequence;// player sequence, that will be playing on client
ent->pvServerData->s.effects = ent->v.effects; // shared client and render flags
ent->pvServerData->s.renderfx = ent->v.renderfx; // renderer flags
ent->pvServerData->s.rendermode = ent->v.rendermode; // rendering mode
ent->pvServerData->s.renderamt = ent->v.renderamt; // alpha value
ent->pvServerData->s.model.framerate = ent->v.framerate;
ent->pvServerData->s.model.animtime = (int)(1000.0 * ent->v.animtime) * 0.001; // sequence time
ent->pvServerData->s.model.scale = ent->v.scale; // shared client and render flags
VectorCopy( ent->v.rendercolor, ent->pvServerData->s.rendercolor );
// studio model sequence
if( ent->v.sequence != -1 ) ent->pvEngineData->s.model.sequence = ent->v.sequence;
if( ent->v.sequence != -1 ) ent->pvServerData->s.model.sequence = ent->v.sequence;
for( i = 0; i < 16; i++ )
{
// copy blendings and bone ctrls
ent->pvEngineData->s.model.blending[i] = ent->v.blending[i];
ent->pvEngineData->s.model.controller[i] = ent->v.controller[i];
ent->pvServerData->s.model.blending[i] = ent->v.blending[i];
ent->pvServerData->s.model.controller[i] = ent->v.controller[i];
}
if( ent->pvEngineData->s.ed_type != ED_VIEWMODEL )
ent->pvEngineData->s.movetype = ent->v.movetype;
if( ent->pvServerData->s.ed_type != ED_VIEWMODEL )
ent->pvServerData->s.movetype = ent->v.movetype;
if( ent->pvEngineData->s.ed_type == ED_MOVER || ent->pvEngineData->s.ed_type == ED_BSPBRUSH )
if( ent->pvServerData->s.ed_type == ED_MOVER || ent->pvServerData->s.ed_type == ED_BSPBRUSH )
{
// these needs to right calculate direction of scroll texture
VectorCopy( ent->v.movedir, ent->pvEngineData->s.velocity );
VectorCopy( ent->v.movedir, ent->pvServerData->s.velocity );
}
if( ent->pvEngineData->s.ed_type == ED_VIEWMODEL )
if( ent->pvServerData->s.ed_type == ED_VIEWMODEL )
{
if( !ent->v.aiment ) return; // no aiment
@ -98,32 +98,32 @@ void SV_UpdateEntityState( edict_t *ent )
// update both arrays, because viewmodel are hidden for qc-coders
ent->v.modelindex = SV_ModelIndex( STRING( client->v.viewmodel ));
ent->pvEngineData->s.aiment = NUM_FOR_EDICT( client ); // viewmodel parent
ent->pvEngineData->s.model.index = ent->v.modelindex;
ent->pvEngineData->s.model.frame = ent->v.frame = client->v.weaponframe;
ent->pvEngineData->s.model.body = ent->v.body = client->v.weaponbody;
ent->pvEngineData->s.model.skin = ent->v.skin = client->v.weaponskin;
ent->pvServerData->s.aiment = NUM_FOR_EDICT( client ); // viewmodel parent
ent->pvServerData->s.model.index = ent->v.modelindex;
ent->pvServerData->s.model.frame = ent->v.frame = client->v.weaponframe;
ent->pvServerData->s.model.body = ent->v.body = client->v.weaponbody;
ent->pvServerData->s.model.skin = ent->v.skin = client->v.weaponskin;
ent->v.sequence = client->v.weaponsequence;
if( ent->v.sequence != -1 ) ent->pvEngineData->s.model.sequence = ent->v.sequence;
ent->pvEngineData->s.model.colormap = ent->v.colormap = client->v.colormap;
ent->pvEngineData->s.effects |= EF_MINLIGHT; // always have some light
if( ent->v.sequence != -1 ) ent->pvServerData->s.model.sequence = ent->v.sequence;
ent->pvServerData->s.model.colormap = ent->v.colormap = client->v.colormap;
ent->pvServerData->s.effects |= EF_MINLIGHT; // always have some light
}
else if( ent->pvEngineData->s.ed_type == ED_CLIENT )
else if( ent->pvServerData->s.ed_type == ED_CLIENT )
{
if( ent->v.fixangle )
{
// FIXME: set angles correctly
for( i = 0; i < 2; i++ )
ent->pvEngineData->s.delta_angles[i] = ANGLE2SHORT( ent->pvEngineData->s.angles[i] );
VectorClear( ent->pvEngineData->s.angles );
VectorClear( ent->pvEngineData->s.viewangles );
ent->pvServerData->s.delta_angles[i] = ANGLE2SHORT( ent->pvServerData->s.angles[i] );
VectorClear( ent->pvServerData->s.angles );
VectorClear( ent->pvServerData->s.viewangles );
VectorClear( ent->v.v_angle );
// and clear fixangle for the next frame
ent->v.fixangle = 0;
}
}
else if( ent->pvEngineData->s.ed_type == ED_AMBIENT )
else if( ent->pvServerData->s.ed_type == ED_AMBIENT )
{
if( ent->v.solid == SOLID_TRIGGER )
{
@ -131,10 +131,10 @@ void SV_UpdateEntityState( edict_t *ent )
// NOTE: no reason to compute this shit on the client - save bandwidth
VectorAverage( ent->v.mins, ent->v.maxs, midPoint );
VectorAdd( ent->pvEngineData->s.origin, midPoint, ent->pvEngineData->s.origin );
VectorAdd( ent->pvServerData->s.origin, midPoint, ent->pvServerData->s.origin );
}
}
else if( ent->pvEngineData->s.ed_type == ED_MOVER )
else if( ent->pvServerData->s.ed_type == ED_MOVER )
{
// FIXME: send mins\maxs for sound spatialization and entity prediction ?
}
@ -145,7 +145,7 @@ void SV_UpdateEntityState( edict_t *ent )
SV_AddEntToSnapshot
===============
*/
static void SV_AddEntToSnapshot( ed_priv_t *svent, edict_t *ent, sv_ents_t *ents )
static void SV_AddEntToSnapshot( sv_priv_t *svent, edict_t *ent, sv_ents_t *ents )
{
// if we have already added this entity to this snapshot, don't add again
if( svent->framenum == sv.net_framenum ) return;
@ -240,7 +240,7 @@ static void SV_AddEntitiesToPacket( vec3_t origin, client_frame_t *frame, sv_ent
{
int l, e, i;
edict_t *ent;
ed_priv_t *svent;
sv_priv_t *svent;
int leafnum;
byte *clientphs;
byte *bitvector;
@ -263,7 +263,7 @@ static void SV_AddEntitiesToPacket( vec3_t origin, client_frame_t *frame, sv_ent
frame->areabits_size = pe->WriteAreaBits( frame->areabits, clientarea, portal );
clientphs = pe->ClusterPHS( clientcluster );
for( e = 1; e < svs.globals->numEntities; e++ )
for( e = 1; e < svgame.globals->numEntities; e++ )
{
ent = EDICT_NUM( e );
if( ent->free ) continue;
@ -276,23 +276,23 @@ static void SV_AddEntitiesToPacket( vec3_t origin, client_frame_t *frame, sv_ent
// send viewmodel entity always
// NOTE: never apply LinkEdict to viewmodel entity, because
// we wan't see it in list of entities returned with SV_AreaEdicts
if( ent->pvEngineData->s.ed_type == ED_VIEWMODEL )
if( ent->pvServerData->s.ed_type == ED_VIEWMODEL )
force = true;
// NOTE: client index on client expected that entity will be valid
if( sv_newprotocol->integer && ent->pvEngineData->s.ed_type == ED_CLIENT )
if( sv_newprotocol->integer && ent->pvServerData->s.ed_type == ED_CLIENT )
force = true;
// never send entities that aren't linked in
if( !ent->pvEngineData->linked && !force ) continue;
if( !ent->pvServerData->linked && !force ) continue;
if( ent->serialnumber != e )
{
MsgDev( D_WARN, "fixing ent->pvEngineData->serialnumber\n");
MsgDev( D_WARN, "fixing ent->pvServerData->serialnumber\n");
ent->serialnumber = e;
}
svent = ent->pvEngineData;
svent = ent->pvServerData;
// quick reject by type
switch( svent->s.ed_type )
@ -311,11 +311,11 @@ static void SV_AddEntitiesToPacket( vec3_t origin, client_frame_t *frame, sv_ent
if( !force )
{
// ignore if not touching a PV leaf check area
if( !pe->AreasConnected( clientarea, ent->pvEngineData->areanum ))
if( !pe->AreasConnected( clientarea, ent->pvServerData->areanum ))
{
// doors can legally straddle two areas, so
// we may need to check another one
if( !pe->AreasConnected( clientarea, ent->pvEngineData->areanum2 ))
if( !pe->AreasConnected( clientarea, ent->pvServerData->areanum2 ))
continue; // blocked by a door
}
}
@ -344,12 +344,12 @@ static void SV_AddEntitiesToPacket( vec3_t origin, client_frame_t *frame, sv_ent
if( bitvector[l>>3] & (1<<(l & 7)))
break;
}
if( i == ent->pvEngineData->num_clusters )
if( i == ent->pvServerData->num_clusters )
continue; // not visible
}
}
if( ent->pvEngineData->s.ed_type == ED_AMBIENT )
if( ent->pvServerData->s.ed_type == ED_AMBIENT )
{
vec3_t delta, entorigin;
float len;
@ -476,11 +476,11 @@ void SV_BuildClientFrame( sv_client_t *cl )
// clear everything in this snapshot
frame_ents.num_entities = c_fullsend = 0;
Mem_Set( frame->areabits, 0, sizeof( frame->areabits ));
if( !clent->pvEngineData->client ) return; // not in game yet
if( !clent->pvServerData->client ) return; // not in game yet
// find the client's PVS
VectorCopy( clent->pvEngineData->s.origin, org );
VectorAdd( org, clent->pvEngineData->s.viewoffset, org );
VectorCopy( clent->pvServerData->s.origin, org );
VectorAdd( org, clent->pvServerData->s.viewoffset, org );
if( sv_newprotocol->integer )
{
@ -490,8 +490,8 @@ void SV_BuildClientFrame( sv_client_t *cl )
else
{
// grab the current player state
cl->edict->pvEngineData->framenum = sv.net_framenum;
frame->ps = clent->pvEngineData->s;
cl->edict->pvServerData->framenum = sv.net_framenum;
frame->ps = clent->pvServerData->s;
}
// add all the entities directly visible to the eye, which
@ -514,7 +514,7 @@ void SV_BuildClientFrame( sv_client_t *cl )
// add it to the circular client_entities array
state = &svs.client_entities[svs.next_client_entities % svs.num_client_entities];
*state = ent->pvEngineData->s;
*state = ent->pvServerData->s;
svs.next_client_entities++;
// this should never hit, map should always be restarted first in SV_Frame
@ -626,7 +626,7 @@ void SV_SendClientMessages( void )
{
MSG_Clear( &cl->netchan.message );
MSG_Clear( &cl->datagram );
SV_BroadcastPrintf( HUD_PRINTCONSOLE, "%s overflowed\n", cl->name );
SV_BroadcastPrintf( "%s overflowed\n", cl->name );
SV_DropClient( cl );
}

File diff suppressed because it is too large Load Diff

View File

@ -22,7 +22,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#include "server.h"
server_static_t svs; // persistant server info
svgame_static_t game; // persistant game info
svgame_static_t svgame; // persistant game info
server_t sv; // local server
/*
@ -101,18 +101,18 @@ void SV_CreateBaseline( void )
edict_t *svent;
int entnum;
for( entnum = 1; entnum < svs.globals->numEntities; entnum++ )
for( entnum = 1; entnum < svgame.globals->numEntities; entnum++ )
{
svent = EDICT_NUM( entnum );
if( svent->free ) continue;
if( !svent->v.modelindex && !svent->pvEngineData->s.soundindex && !svent->v.effects )
if( !svent->v.modelindex && !svent->pvServerData->s.soundindex && !svent->v.effects )
continue;
svent->serialnumber = entnum;
// take current state as baseline
SV_UpdateEntityState( svent );
svs.baselines[entnum] = svent->pvEngineData->s;
svs.baselines[entnum] = svent->pvServerData->s;
}
}
@ -209,7 +209,7 @@ void SV_SpawnServer( const char *server, const char *savename )
if( sv.loadgame ) SV_ReadLevelFile( savename );
else SV_SpawnEntities( sv.name, pe->GetEntityScript());
svs.dllFuncs.pfnServerActivate( game.edicts, svs.globals->numEntities, svs.globals->maxClients );
svgame.dllFuncs.pfnServerActivate( EDICT_NUM( 0 ), svgame.globals->numEntities, svgame.globals->maxClients );
// run two frames to allow everything to settle
for( i = 0; i < 2; i++ )
@ -226,7 +226,7 @@ void SV_SpawnServer( const char *server, const char *savename )
SV_CreateBaseline();
// classify edicts for quick network sorting
for( i = 0; i < svs.globals->numEntities; i++ )
for( i = 0; i < svgame.globals->numEntities; i++ )
{
edict_t *ent = EDICT_NUM( i );
SV_ClassifyEdict( ent );
@ -257,6 +257,9 @@ void SV_InitGame( void )
}
else
{
// init game after host error
if( !svgame.hInstance )
SV_LoadProgs( "server" );
// make sure the client is down
CL_Drop();
}
@ -308,12 +311,6 @@ void SV_InitGame( void )
com.sprintf( idmaster, "192.246.40.37:%i", PORT_MASTER );
NET_StringToAdr( idmaster, &master_adr[0] );
// init game
if(!SV_LoadProgs( "server" ))
{
Host_Error( "SV_InitGame: can't initialize server.dll\n" );
}
for( i = 0; i < Host_MaxClients(); i++ )
{
ent = EDICT_NUM( i + 1 );

View File

@ -71,7 +71,7 @@ void SV_CalcPings( void )
else cl->ping = total / count;
// let the game dll know about the ping
cl->edict->pvEngineData->client->ping = cl->ping;
cl->edict->pvServerData->client->ping = cl->ping;
}
}
@ -164,7 +164,7 @@ void SV_CheckTimeouts( void )
}
if(( cl->state == cs_connected || cl->state == cs_spawned) && cl->lastmessage < droppoint )
{
SV_BroadcastPrintf( HUD_PRINTCONSOLE, "%s timed out\n", cl->name );
SV_BroadcastPrintf( "%s timed out\n", cl->name );
SV_DropClient( cl );
cl->state = cs_free; // don't bother with zombie state
}
@ -375,6 +375,9 @@ void SV_Init( void )
public_server = Cvar_Get ("public", "0", 0, "change server type from private to public" );
sv_reconnect_limit = Cvar_Get ("sv_reconnect_limit", "3", CVAR_ARCHIVE, "max reconnect attempts" );
// init game
SV_LoadProgs( "server" );
}
/*
@ -439,7 +442,13 @@ void SV_Shutdown( bool reconnect )
if( svs.clients ) SV_FinalMessage( host.finalmsg, reconnect );
Master_Shutdown();
SV_UnloadProgs();
if( reconnect )
{
if( svgame.hInstance )
svgame.dllFuncs.pfnServerDeactivate();
SV_FreeEdicts();
}
else SV_UnloadProgs();
// free current level
Mem_Set( &sv, 0, sizeof( sv ));

View File

@ -417,8 +417,8 @@ void SV_Transform( edict_t *edict, const vec3_t origin, const matrix3x3 matrix )
edict->v.angles[2] = angles[2];
// refresh force and torque
pe->GetForce( edict->pvEngineData->physbody, edict->v.velocity, edict->v.avelocity, edict->v.force, edict->v.torque );
pe->GetMassCentre( edict->pvEngineData->physbody, edict->v.m_pcentre );
pe->GetForce( edict->pvServerData->physbody, edict->v.velocity, edict->v.avelocity, edict->v.force, edict->v.torque );
pe->GetMassCentre( edict->pvServerData->physbody, edict->v.m_pcentre );
}
/*
@ -434,21 +434,21 @@ void SV_PlayerMove( edict_t *player )
pmove_t pm;
sv_client_t *client;
client = player->pvEngineData->client;
client = player->pvServerData->client;
memset( &pm, 0, sizeof(pm) );
if( player->v.movetype == MOVETYPE_NOCLIP )
player->pvEngineData->s.pm_type = PM_SPECTATOR;
else player->pvEngineData->s.pm_type = PM_NORMAL;
player->pvEngineData->s.gravity = sv_gravity->value;
player->pvServerData->s.pm_type = PM_SPECTATOR;
else player->pvServerData->s.pm_type = PM_NORMAL;
player->pvServerData->s.gravity = sv_gravity->value;
if( player->v.teleport_time )
player->pvEngineData->s.pm_flags |= PMF_TIME_TELEPORT;
else player->pvEngineData->s.pm_flags &= ~PMF_TIME_TELEPORT;
player->pvServerData->s.pm_flags |= PMF_TIME_TELEPORT;
else player->pvServerData->s.pm_flags &= ~PMF_TIME_TELEPORT;
pm.ps = player->pvEngineData->s;
pm.ps = player->pvServerData->s;
pm.cmd = client->lastcmd;
pm.body = player->pvEngineData->physbody; // member body ptr
pm.body = player->pvServerData->physbody; // member body ptr
VectorCopy( player->v.origin, pm.ps.origin );
VectorCopy( player->v.velocity, pm.ps.velocity );
@ -456,13 +456,13 @@ void SV_PlayerMove( edict_t *player )
pe->PlayerMove( &pm, false ); // server move
// save results of pmove
player->pvEngineData->s = pm.ps;
player->pvServerData->s = pm.ps;
VectorCopy(pm.ps.origin, player->v.origin);
VectorCopy(pm.ps.velocity, player->v.velocity);
VectorCopy(pm.mins, player->v.mins);
VectorCopy(pm.maxs, player->v.maxs);
VectorCopy(pm.ps.viewangles, player->pvEngineData->s.viewangles );
VectorCopy(pm.ps.viewangles, player->pvServerData->s.viewangles );
}
void SV_PlaySound( edict_t *ed, float volume, float pitch, const char *sample )

View File

@ -4,7 +4,6 @@
//=======================================================================
#include "common.h"
#include "render_api.h"
#include "server.h"
#include "matrix_lib.h"
#include "const.h"
@ -254,7 +253,7 @@ void SV_CheckAllEnts( void )
// see if any solid entities are inside the final position
check = EDICT_NUM( 1 );
for( e = 1; e < svs.globals->numEntities; e++, check++ )
for( e = 1; e < svgame.globals->numEntities; e++, check++ )
{
if( check->free ) continue;
switch( check->v.movetype )
@ -324,18 +323,18 @@ bool SV_RunThink( edict_t *ent )
// don't let things stay in the past.
// it is possible to start that way by a trigger with a local time.
if( ent->v.nextthink <= 0 || ent->v.nextthink > sv.time + svs.globals->frametime )
if( ent->v.nextthink <= 0 || ent->v.nextthink > sv.time + svgame.globals->frametime )
return true;
for( iterations = 0; iterations < 128 && !ent->free; iterations++ )
{
svs.globals->time = max( sv.time, ent->v.nextthink );
svgame.globals->time = max( sv.time, ent->v.nextthink );
ent->v.nextthink = 0;
svs.dllFuncs.pfnThink( ent );
svgame.dllFuncs.pfnThink( ent );
// mods often set nextthink to time to cause a think every frame,
// we don't want to loop in that case, so exit if the new nextthink is
// <= the time the qc was told, also exit if it is past the end of the frame
if( ent->v.nextthink <= svs.globals->time || ent->v.nextthink > sv.time + svs.globals->frametime )
if( ent->v.nextthink <= svgame.globals->time || ent->v.nextthink > sv.time + svgame.globals->frametime )
break;
}
return !ent->free;
@ -354,19 +353,19 @@ void SV_Impact( edict_t *e1, trace_t *trace )
SV_CopyTraceToGlobal( trace );
svs.globals->time = sv.time;
svgame.globals->time = sv.time;
if( !e1->free && !e2->free && e1->v.solid != SOLID_NOT )
{
svs.dllFuncs.pfnTouch( e1, e2 );
svgame.dllFuncs.pfnTouch( e1, e2 );
}
if( !e1->free && !e2->free && e2->v.solid != SOLID_NOT )
{
VectorCopy( e2->v.origin, svs.globals->trace_endpos );
VectorNegate( trace->plane.normal, svs.globals->trace_plane_normal );
svs.globals->trace_plane_dist = -trace->plane.dist;
svs.globals->trace_ent = e1;
svs.dllFuncs.pfnTouch( e2, e1 );
VectorCopy( e2->v.origin, svgame.globals->trace_endpos );
VectorNegate( trace->plane.normal, svgame.globals->trace_plane_normal );
svgame.globals->trace_plane_dist = -trace->plane.dist;
svgame.globals->trace_ent = e1;
svgame.dllFuncs.pfnTouch( e2, e1 );
}
}
@ -393,8 +392,8 @@ void SV_TouchTriggers( edict_t *ent )
for( i = 0; i < num; i++ )
{
if( touch[i]->free ) continue;
svs.globals->time = sv.time;
svs.dllFuncs.pfnTouch( touch[i], ent );
svgame.globals->time = sv.time;
svgame.dllFuncs.pfnTouch( touch[i], ent );
}
}
@ -593,9 +592,14 @@ SV_AddGravity
*/
void SV_AddGravity( edict_t *ent )
{
if( ent->pvServerData->stuck )
{
VectorClear( ent->v.velocity );
return;
}
if( ent->v.gravity ) // gravity modifier
ent->v.velocity[2] -= sv_gravity->value * ent->v.gravity * svs.globals->frametime;
else ent->v.velocity[2] -= sv_gravity->value * svs.globals->frametime;
ent->v.velocity[2] -= sv_gravity->value * ent->v.gravity * svgame.globals->frametime;
else ent->v.velocity[2] -= sv_gravity->value * svgame.globals->frametime;
}
/*
@ -782,7 +786,7 @@ void SV_PushMove( edict_t *pusher, float movetime )
}
// tell any MOVETYPE_STEP entity that it may need to check for water transitions
check->pvEngineData->forceupdate = true;
check->pvServerData->forceupdate = true;
checkcontents = SV_ContentsMask( check );
// if the entity is standing on the pusher, it will definitely be moved
@ -810,8 +814,8 @@ void SV_PushMove( edict_t *pusher, float movetime )
}
//Msg("- pushing %f %f %f\n", move[0], move[1], move[2]);
VectorCopy (check->v.origin, check->pvEngineData->moved_origin );
VectorCopy (check->v.angles, check->pvEngineData->moved_angles );
VectorCopy (check->v.origin, check->pvServerData->moved_origin );
VectorCopy (check->v.angles, check->pvServerData->moved_angles );
moved_edicts[num_moved++] = NUM_FOR_EDICT( check );
// try moving the contacted entity
@ -835,8 +839,8 @@ void SV_PushMove( edict_t *pusher, float movetime )
vec3_t move2;
pusher->v.solid = SOLID_NOT;
VectorScale( move, 1.1f, move2 );
VectorCopy( check->pvEngineData->moved_origin, check->v.origin );
VectorCopy( check->pvEngineData->moved_angles, check->v.angles );
VectorCopy( check->pvServerData->moved_origin, check->v.origin );
VectorCopy( check->pvServerData->moved_angles, check->v.angles );
SV_PushEntity( check, move2, true );
pusher->v.solid = savesolid;
pe->ClipToGenericEntity( &trace, pushermodel, pusher->v.mins, pusher->v.maxs, CONTENTS_BODY, pusherfinalmatrix, pusherfinalimatrix, check->v.origin, check->v.mins, check->v.maxs, check->v.origin, checkcontents );
@ -845,8 +849,8 @@ void SV_PushMove( edict_t *pusher, float movetime )
// try moving the contacted entity a tiny bit less to account for precision errors
pusher->v.solid = SOLID_NOT;
VectorScale( move, 0.9, move2 );
VectorCopy( check->pvEngineData->moved_origin, check->v.origin );
VectorCopy( check->pvEngineData->moved_angles, check->v.angles );
VectorCopy( check->pvServerData->moved_origin, check->v.origin );
VectorCopy( check->pvServerData->moved_angles, check->v.angles );
SV_PushEntity( check, move2, true );
pusher->v.solid = savesolid;
pe->ClipToGenericEntity( &trace, pushermodel, pusher->v.mins, pusher->v.maxs, CONTENTS_BODY, pusherfinalmatrix, pusherfinalimatrix, check->v.origin, check->v.mins, check->v.maxs, check->v.origin, checkcontents );
@ -873,13 +877,13 @@ void SV_PushMove( edict_t *pusher, float movetime )
for( i = 0; i < num_moved; i++ )
{
edict_t *ed = EDICT_NUM( moved_edicts[i] );
VectorCopy( ed->pvEngineData->moved_origin, ed->v.origin );
VectorCopy( ed->pvEngineData->moved_angles, ed->v.angles );
VectorCopy( ed->pvServerData->moved_origin, ed->v.origin );
VectorCopy( ed->pvServerData->moved_angles, ed->v.angles );
SV_LinkEdict( ed );
}
// if the pusher has a "blocked" function, call it, otherwise just stay in place until the obstacle is gone
svs.dllFuncs.pfnBlocked( pusher, check );
svgame.dllFuncs.pfnBlocked( pusher, check );
break;
}
}
@ -901,20 +905,20 @@ void SV_Physics_Pusher( edict_t *ent )
oldltime = ent->v.ltime;
thinktime = ent->v.nextthink;
if( thinktime < ent->v.ltime + svs.globals->frametime )
if( thinktime < ent->v.ltime + svgame.globals->frametime )
{
movetime = thinktime - ent->v.ltime;
if( movetime < 0 ) movetime = 0;
}
else movetime = svs.globals->frametime;
else movetime = svgame.globals->frametime;
// advances ent->v.ltime if not blocked
if( movetime ) SV_PushMove( ent, movetime );
if( thinktime > oldltime && thinktime <= ent->v.ltime )
{
ent->v.nextthink = 0;
svs.globals->time = sv.time;
svs.dllFuncs.pfnThink( ent );
svgame.globals->time = sv.time;
svgame.dllFuncs.pfnThink( ent );
}
}
@ -956,9 +960,10 @@ void SV_CheckStuck( edict_t *ent )
offset[1] += 1;
offset[2] += 1;
}
if(!SV_TestEntityPosition( ent, offset ))
if( !SV_TestEntityPosition( ent, offset ))
{
VectorCopy( ent->v.origin, ent->v.oldorigin );
ent->pvServerData->stuck = false;
return;
}
@ -967,6 +972,7 @@ void SV_CheckStuck( edict_t *ent )
if(!SV_TestEntityPosition( ent, unstickoffsets + i))
{
MsgDev( D_NOTE, "Unstuck player with offset %g %g %g.\n", unstickoffsets[i+0], unstickoffsets[i+1], unstickoffsets[i+2]);
ent->pvServerData->stuck = false;
SV_LinkEdict( ent );
return;
}
@ -976,10 +982,14 @@ void SV_CheckStuck( edict_t *ent )
if(!SV_TestEntityPosition( ent, offset ))
{
MsgDev( D_NOTE, "Unstuck player by restoring oldorigin.\n" );
ent->pvServerData->stuck = false;
SV_LinkEdict( ent );
return;
}
MsgDev( D_ERROR, "Stuck player\n" );
if( !ent->pvServerData->stuck )
MsgDev( D_ERROR, "Stuck player\n" ); // fire once
ent->pvServerData->stuck = true;
}
bool SV_UnstickEntity( edict_t *ent )
@ -987,20 +997,26 @@ bool SV_UnstickEntity( edict_t *ent )
int i;
// if not stuck in a bmodel, just return
if(!SV_TestEntityPosition( ent, vec3_origin ))
if( !SV_TestEntityPosition( ent, vec3_origin ))
{
ent->pvServerData->stuck = false;
return true;
}
for( i = 0; i < (int)(sizeof(unstickoffsets) / sizeof(unstickoffsets[0])); i += 3 )
{
if(!SV_TestEntityPosition( ent, unstickoffsets + i ))
{
MsgDev( D_INFO, "Unstuck entity \"%s\" with offset %g %g %g.\n", STRING( ent->v.classname ), unstickoffsets[i+0], unstickoffsets[i+1], unstickoffsets[i+2] );
MsgDev( D_NOTE, "Unstuck entity \"%s\" with offset %g %g %g.\n", STRING( ent->v.classname ), unstickoffsets[i+0], unstickoffsets[i+1], unstickoffsets[i+2] );
ent->pvServerData->stuck = false;
SV_LinkEdict( ent );
return true;
}
}
MsgDev( D_INFO, "Stuck entity \"%s\".\n", STRING( ent->v.classname ));
if( !ent->pvServerData->stuck )
MsgDev( D_ERROR, "Stuck entity \"%s\".\n", STRING( ent->v.classname ));
ent->pvServerData->stuck = true;
return false;
}
@ -1034,12 +1050,12 @@ bool SV_CheckWater( edict_t *ent )
if( SV_PointContents( point ) & MASK_WATER )
{
ent->v.waterlevel = 3;
if( ent->pvEngineData->s.ed_type == ED_CLIENT )
if( ent->pvServerData->s.ed_type == ED_CLIENT )
ent->v.renderfx |= RDF_UNDERWATER;
}
else
{
if( ent->pvEngineData->s.ed_type == ED_CLIENT )
if( ent->pvServerData->s.ed_type == ED_CLIENT )
ent->v.renderfx &= ~RDF_UNDERWATER;
}
}
@ -1087,7 +1103,7 @@ void SV_WalkMove( edict_t *ent )
trace_t downtrace;
// if frametime is 0 (due to client sending the same timestamp twice), don't move
if( svs.globals->frametime <= 0 ) return;
if( svgame.globals->frametime <= 0 ) return;
contentsmask = SV_ContentsMask( ent );
SV_CheckVelocity( ent );
@ -1097,7 +1113,7 @@ void SV_WalkMove( edict_t *ent )
VectorCopy( ent->v.origin, start_origin );
VectorCopy( ent->v.velocity, start_velocity );
clip = SV_FlyMove( ent, svs.globals->frametime, NULL, contentsmask );
clip = SV_FlyMove( ent, svgame.globals->frametime, NULL, contentsmask );
// if the move did not hit the ground at any point, we're not on ground
if(!(clip & 1)) ent->v.flags &= ~FL_ONGROUND;
@ -1144,7 +1160,7 @@ void SV_WalkMove( edict_t *ent )
// move forward
ent->v.velocity[2] = 0;
clip = SV_FlyMove( ent, svs.globals->frametime, stepnormal, contentsmask );
clip = SV_FlyMove( ent, svgame.globals->frametime, stepnormal, contentsmask );
ent->v.velocity[2] += start_velocity[2];
SV_CheckVelocity( ent );
@ -1170,7 +1186,7 @@ void SV_WalkMove( edict_t *ent )
// move down
VectorClear( downmove );
downmove[2] = -sv_stepheight->value + start_velocity[2] * svs.globals->frametime;
downmove[2] = -sv_stepheight->value + start_velocity[2] * svgame.globals->frametime;
downtrace = SV_PushEntity( ent, downmove, false ); // FIXME: don't link?
if( downtrace.fraction < 1 && downtrace.plane.normal[2] > 0.7 )
@ -1314,7 +1330,7 @@ void SV_Physics_Toss( edict_t *ent )
// we can trust FL_ONGROUND if groundentity is world because it never moves
return;
}
else if( ent->pvEngineData->suspended && ent->v.groundentity->free )
else if( ent->pvServerData->suspended && ent->v.groundentity->free )
{
// if ent was supported by a brush model on previous frame,
// and groundentity is now freed, set groundentity to 0 (world)
@ -1323,7 +1339,7 @@ void SV_Physics_Toss( edict_t *ent )
return;
}
}
ent->pvEngineData->suspended = false;
ent->pvServerData->suspended = false;
SV_CheckVelocity( ent );
@ -1332,10 +1348,10 @@ void SV_Physics_Toss( edict_t *ent )
SV_AddGravity( ent );
// move angles
VectorMA( ent->v.angles, svs.globals->frametime, ent->v.avelocity, ent->v.angles );
VectorMA( ent->v.angles, svgame.globals->frametime, ent->v.avelocity, ent->v.angles );
// move origin
VectorScale( ent->v.velocity, svs.globals->frametime, move );
VectorScale( ent->v.velocity, svgame.globals->frametime, move );
trace = SV_PushEntity( ent, move, true );
if( ent->free ) return;
@ -1372,7 +1388,7 @@ void SV_Physics_Toss( edict_t *ent )
ent->v.flags |= FL_ONGROUND;
ent->v.groundentity = trace.ent;
if( trace.ent && trace.ent->v.solid == SOLID_BSP )
ent->pvEngineData->suspended = true;
ent->pvServerData->suspended = true;
VectorClear( ent->v.velocity );
VectorClear( ent->v.avelocity );
}
@ -1417,9 +1433,9 @@ void SV_Physics_Step( edict_t *ent )
ent->v.flags &= ~FL_ONGROUND;
SV_AddGravity( ent );
SV_CheckVelocity( ent );
SV_FlyMove( ent, svs.globals->frametime, NULL, SV_ContentsMask( ent ));
SV_FlyMove( ent, svgame.globals->frametime, NULL, SV_ContentsMask( ent ));
SV_LinkEdict( ent );
ent->pvEngineData->forceupdate = true;
ent->pvServerData->forceupdate = true;
}
}
else
@ -1429,7 +1445,7 @@ void SV_Physics_Step( edict_t *ent )
SV_AddGravity( ent );
SV_CheckVelocity( ent );
SV_FlyMove( ent, svs.globals->frametime, NULL, SV_ContentsMask( ent ));
SV_FlyMove( ent, svgame.globals->frametime, NULL, SV_ContentsMask( ent ));
SV_LinkEdict( ent );
// just hit ground
@ -1438,17 +1454,17 @@ void SV_Physics_Step( edict_t *ent )
Msg("Landing crash\n");
//SV_StartSound(ent, 0, sv_sound_land.string, 255, 1);
}
ent->pvEngineData->forceupdate = true;
ent->pvServerData->forceupdate = true;
}
}
// regular thinking
if(!SV_RunThink( ent )) return;
if( ent->pvEngineData->forceupdate || !VectorCompare( ent->v.origin, ent->pvEngineData->water_origin))
if( ent->pvServerData->forceupdate || !VectorCompare( ent->v.origin, ent->pvServerData->water_origin))
{
ent->pvEngineData->forceupdate = false;
VectorCopy( ent->v.origin, ent->pvEngineData->water_origin );
ent->pvServerData->forceupdate = false;
VectorCopy( ent->v.origin, ent->pvServerData->water_origin );
SV_CheckWaterTransition( ent );
}
}
@ -1500,7 +1516,7 @@ void SV_Physics_Conveyor( edict_t *ent )
move[2] = v[2] * 0.1f;
}
VectorAdd( player->v.origin, move, end );
tr = SV_Trace( player->v.origin, player->v.mins, player->v.maxs, end, MOVE_NORMAL, player, player->pvEngineData->clipmask );
tr = SV_Trace( player->v.origin, player->v.mins, player->v.maxs, end, MOVE_NORMAL, player, player->pvServerData->clipmask );
VectorCopy( tr.endpos, player->v.origin );
SV_LinkEdict( player );
}
@ -1520,8 +1536,8 @@ void SV_Physics_Noclip( edict_t *ent )
if(SV_RunThink( ent ))
{
SV_CheckWater( ent );
VectorMA( ent->v.angles, svs.globals->frametime, ent->v.avelocity, ent->v.angles );
VectorMA( ent->v.origin, svs.globals->frametime, ent->v.velocity, ent->v.origin );
VectorMA( ent->v.angles, svgame.globals->frametime, ent->v.avelocity, ent->v.angles );
VectorMA( ent->v.origin, svgame.globals->frametime, ent->v.velocity, ent->v.origin );
}
SV_LinkEdict( ent );
}
@ -1536,7 +1552,7 @@ Non moving objects can only think
*/
void SV_Physics_None( edict_t *ent )
{
if (ent->v.nextthink > 0 && ent->v.nextthink <= sv.time + svs.globals->frametime)
if (ent->v.nextthink > 0 && ent->v.nextthink <= sv.time + svgame.globals->frametime)
SV_RunThink (ent);
}
@ -1582,14 +1598,14 @@ static void SV_Physics_Entity( edict_t *ent )
SV_Physics_Conveyor( ent );
break;
default:
svs.dllFuncs.pfnFrame( ent );
svgame.dllFuncs.pfnFrame( ent );
break;
}
}
void SV_Physics_ClientEntity( edict_t *ent )
{
sv_client_t *client = ent->pvEngineData->client;
sv_client_t *client = ent->pvServerData->client;
if( !client ) return;//Host_Error( "SV_Physics_ClientEntity: tired to apply physic to a non-client entity\n" );
@ -1609,8 +1625,8 @@ void SV_Physics_ClientEntity( edict_t *ent )
VectorClear( ent->v.velocity );
// call standard client pre-think
svs.globals->time = sv.time;
svs.dllFuncs.pfnPlayerPreThink( ent );
svgame.globals->time = sv.time;
svgame.dllFuncs.pfnPlayerPreThink( ent );
SV_CheckVelocity( ent );
switch((int)ent->v.movetype )
@ -1628,8 +1644,8 @@ void SV_Physics_ClientEntity( edict_t *ent )
case MOVETYPE_NOCLIP:
SV_RunThink( ent );
SV_CheckWater( ent );
VectorMA( ent->v.origin, svs.globals->frametime, ent->v.velocity, ent->v.origin );
VectorMA( ent->v.angles, svs.globals->frametime, ent->v.avelocity, ent->v.angles );
VectorMA( ent->v.origin, svgame.globals->frametime, ent->v.velocity, ent->v.origin );
VectorMA( ent->v.angles, svgame.globals->frametime, ent->v.avelocity, ent->v.angles );
break;
case MOVETYPE_STEP:
SV_Physics_Step( ent );
@ -1672,8 +1688,8 @@ void SV_Physics_ClientEntity( edict_t *ent )
SV_TouchTriggers( ent );
// call standard player post-think
svs.globals->time = sv.time;
svs.dllFuncs.pfnPlayerPostThink( ent );
svgame.globals->time = sv.time;
svgame.dllFuncs.pfnPlayerPostThink( ent );
}
void SV_Physics_ClientMove( sv_client_t *client, usercmd_t *cmd )
@ -1681,14 +1697,14 @@ void SV_Physics_ClientMove( sv_client_t *client, usercmd_t *cmd )
edict_t *ent = client->edict;
// call player physics, this needs the proper frametime
svs.globals->frametime = sv.frametime;
svgame.globals->frametime = sv.frametime;
SV_ClientThink( client, cmd );
// call standard client pre-think, with frametime = 0
svs.globals->time = sv.time;
svs.globals->frametime = 0;
svs.dllFuncs.pfnPlayerPreThink( ent );
svs.globals->frametime = sv.frametime;
svgame.globals->time = sv.time;
svgame.globals->frametime = 0;
svgame.dllFuncs.pfnPlayerPreThink( ent );
svgame.globals->frametime = sv.frametime;
if( !sv_physics->integer )
{
@ -1708,8 +1724,8 @@ void SV_Physics_ClientMove( sv_client_t *client, usercmd_t *cmd )
break;
case MOVETYPE_NOCLIP:
SV_CheckWater( ent );
VectorMA( ent->v.origin, svs.globals->frametime, ent->v.velocity, ent->v.origin );
VectorMA( ent->v.angles, svs.globals->frametime, ent->v.avelocity, ent->v.angles );
VectorMA( ent->v.origin, svgame.globals->frametime, ent->v.velocity, ent->v.origin );
VectorMA( ent->v.angles, svgame.globals->frametime, ent->v.avelocity, ent->v.angles );
break;
}
SV_CheckVelocity( ent );
@ -1722,10 +1738,10 @@ void SV_Physics_ClientMove( sv_client_t *client, usercmd_t *cmd )
SV_TouchTriggers( ent );
// call standard player post-think, with frametime = 0
svs.globals->time = sv.time;
svs.globals->frametime = 0;
svs.dllFuncs.pfnPlayerPostThink( ent );
svs.globals->frametime = sv.frametime;
svgame.globals->time = sv.time;
svgame.globals->frametime = 0;
svgame.dllFuncs.pfnPlayerPostThink( ent );
svgame.globals->frametime = sv.frametime;
}
/*
@ -1740,12 +1756,12 @@ void SV_Physics( void )
edict_t *ent;
// let the progs know that a new frame has started
svs.globals->time = sv.time;
svs.globals->frametime = sv.frametime;
svs.dllFuncs.pfnStartFrame();
svgame.globals->time = sv.time;
svgame.globals->frametime = sv.frametime;
svgame.dllFuncs.pfnStartFrame();
// treat each object in turn
for( i = 1; i < svs.globals->numEntities; i++ )
for( i = 1; i < svgame.globals->numEntities; i++ )
{
ent = EDICT_NUM( i );
if( ent->free ) continue;
@ -1756,12 +1772,12 @@ void SV_Physics( void )
}
// let everything in the world think and move
pe->Frame( svs.globals->frametime * 0.001f );
pe->Frame( svgame.globals->frametime * 0.001f );
svs.globals->time = sv.time;
svgame.globals->time = sv.time;
// at end of frame kill all entities which supposed to it
for( i = svs.globals->maxClients + 1; i < svs.globals->numEntities; i++ )
for( i = svgame.globals->maxClients + 1; i < svgame.globals->numEntities; i++ )
{
ent = EDICT_NUM( i );
if( ent->free ) continue;
@ -1770,10 +1786,10 @@ void SV_Physics( void )
SV_FreeEdict( EDICT_NUM( i ));
}
svs.dllFuncs.pfnEndFrame();
svgame.dllFuncs.pfnEndFrame();
// decrement svs.globals->numEntities if the highest number entities died
for( ; EDICT_NUM( svs.globals->numEntities - 1)->free; svs.globals->numEntities-- );
// decrement svgame.globals->numEntities if the highest number entities died
for( ; EDICT_NUM( svgame.globals->numEntities - 1)->free; svgame.globals->numEntities-- );
if( !sv_playersonly->integer ) sv.time += sv.frametime;
}

View File

@ -9,32 +9,6 @@
#include "matrix_lib.h"
#include "const.h"
void SV_BeginIncreaseEdicts( void )
{
int i;
edict_t *ent;
// links don't survive the transition, so unlink everything
for( i = 0, ent = EDICT_NUM( 0 ); i < svs.globals->maxEntities; i++, ent++ )
{
if( !ent->free ) SV_UnlinkEdict( EDICT_NUM( i )); // free old entity
Mem_Set( &ent->pvEngineData->clusternums, 0, sizeof( ent->pvEngineData->clusternums ));
}
SV_ClearWorld();
}
void SV_EndIncreaseEdicts(void)
{
int i;
edict_t *ent;
for( i = 0, ent = EDICT_NUM( 0 ); i < svs.globals->maxEntities; i++, ent++ )
{
// link every entity except world
if( !ent->free ) SV_LinkEdict(ent);
}
}
void SV_RestoreEdict( edict_t *ent )
{
// link it into the bsp tree
@ -44,5 +18,5 @@ void SV_RestoreEdict( edict_t *ent )
SV_SetMassCentre( ent ); // and mass force
if( ent->v.ambient ) // restore loopsound
ent->pvEngineData->s.soundindex = SV_SoundIndex( STRING( ent->v.ambient ));
ent->pvServerData->s.soundindex = SV_SoundIndex( STRING( ent->v.ambient ));
}

View File

@ -176,10 +176,10 @@ sorting edict by type
*/
void SV_ClassifyEdict( edict_t *ent )
{
ed_priv_t *sv_ent;
sv_priv_t *sv_ent;
const char *classname;
sv_ent = ent->pvEngineData;
sv_ent = ent->pvServerData;
if( !sv_ent || sv_ent->s.ed_type != ED_SPAWNED )
return;
@ -243,10 +243,10 @@ SV_UnlinkEdict
void SV_UnlinkEdict( edict_t *ent )
{
// not linked in anywhere
if( !ent->pvEngineData->area.prev ) return;
if( !ent->pvServerData->area.prev ) return;
SV_RemoveLink( &ent->pvEngineData->area );
ent->pvEngineData->area.prev = ent->pvEngineData->area.next = NULL;
SV_RemoveLink( &ent->pvServerData->area );
ent->pvServerData->area.prev = ent->pvServerData->area.next = NULL;
}
/*
@ -263,9 +263,9 @@ void SV_LinkEdict( edict_t *ent )
int i, j, k;
int area;
int topnode;
ed_priv_t *sv_ent;
sv_priv_t *sv_ent;
sv_ent = ent->pvEngineData;
sv_ent = ent->pvServerData;
if( sv_ent->area.prev ) SV_UnlinkEdict( ent ); // unlink from old position
if( ent == EDICT_NUM( 0 )) return; // don't add the world
@ -394,12 +394,12 @@ void SV_LinkEdict( edict_t *ent )
}
}
ent->pvEngineData->linkcount++;
ent->pvServerData->linkcount++;
// update ambient sound here
if( ent->v.ambient )
{
ent->pvEngineData->s.soundindex = SV_SoundIndex( STRING( ent->v.ambient ));
ent->pvServerData->s.soundindex = SV_SoundIndex( STRING( ent->v.ambient ));
}
// don't link not solid or rigid bodies

View File

@ -98,17 +98,20 @@ typedef struct
typedef struct ref_params_s
{
// output
int viewport[4]; // x, y, width, height
vec3_t vieworg;
vec3_t viewangles;
float fov;
float fov_x;
float fov_y; // fov_y = V_CalcFov( fov_x, viewport[2], viewport[3] );
vec3_t forward;
vec3_t right;
vec3_t up;
float frametime; // client frametime
float lerpfrac; // interp value
float lerpfrac; // between oldframe and frame
float time; // client time
float oldtime; // studio lerping
// misc
BOOL intermission;
@ -116,15 +119,19 @@ typedef struct ref_params_s
BOOL demorecord;
BOOL spectator;
BOOL paused;
uint rdflags; // client view effects: RDF_UNDERWATER, RDF_MOTIONBLUR, etc
qword iWeaponBits; // pev->weapon
dword iKeyBits; // pev->button
edict_t *onground; // pointer to onground entity
byte *areabits; // come from server, contains visible areas list
int waterlevel;
// input
vec3_t velocity;
vec3_t angles; // input viewangles
vec3_t origin; // origin + viewheight = vieworg
vec3_t old_angles; // prev.state values to interpolate from
vec3_t old_origin;
vec3_t viewheight;
float idealpitch;
@ -164,7 +171,7 @@ typedef struct cl_enginefuncs_s
// command handlers
void (*pfnAddCommand)( const char *cmd_name, void (*function)(void), const char *cmd_desc );
void (*pfnHookUserMsg)( char *szMsgName, pfnUserMsgHook pfn );
void (*pfnHookUserMsg)( const char *szMsgName, pfnUserMsgHook pfn );
void (*pfnServerCmd)( const char *szCmdString );
void (*pfnClientCmd)( const char *szCmdString );
void (*pfnGetPlayerInfo)( int player_num, hud_player_info_t *pinfo );
@ -195,6 +202,7 @@ typedef struct cl_enginefuncs_s
float (*pfnGetClientTime)( void );
int (*pfnGetMaxClients)( void );
edict_t* (*pfnGetViewModel)( void );
void (*pfnMakeLevelShot)( void ); // level shot will be created at next frame
int (*pfnPointContents)( const float *rgflVector );
void (*pfnTraceLine)( const float *v1, const float *v2, int fNoMonsters, edict_t *pentToSkip, TraceResult *ptr );
@ -217,7 +225,7 @@ typedef struct
int (*pfnVidInit)( void );
void (*pfnInit)( void );
int (*pfnRedraw)( float flTime, int intermission );
int (*pfnRedraw)( float flTime, int state );
int (*pfnUpdateClientData)( ref_params_t *parms, float flTime );
void (*pfnReset)( void );
void (*pfnFrame)( double time );

View File

@ -195,10 +195,10 @@ typedef enum
} kBeamType_t;
// lower bits encoded as kBeamType_t (max 8 types)
#define BEAM_FSINE (1<<3)
#define BEAM_FSOLID (1<<4)
#define BEAM_FSHADEIN (1<<5)
#define BEAM_FSHADEOUT (1<<6)
#define BEAM_FSINE (1<<3)
#define BEAM_FSOLID (1<<4)
#define BEAM_FSHADEIN (1<<5)
#define BEAM_FSHADEOUT (1<<6)
// rendering constants
typedef enum
@ -228,19 +228,29 @@ typedef enum
kRenderFxNoReflect, // don't reflecting in mirrors
} kRenderFx_t;
// player_state_t->renderfx
#define RDF_UNDERWATER (1<<0) // warp the screen as apropriate
#define RDF_NOWORLDMODEL (1<<1) // used for player configuration screen
#define RDF_BLOOM (1<<2) // light blooms
// all drawing is done to a 640*480 virtual screen size
// and will be automatically scaled to the real resolution
#define SCREEN_WIDTH 640
#define SCREEN_HEIGHT 480
#define TINYCHAR_WIDTH (SMALLCHAR_WIDTH)
#define TINYCHAR_HEIGHT (SMALLCHAR_HEIGHT/2)
#define SMALLCHAR_WIDTH 8
#define SMALLCHAR_HEIGHT 16
#define BIGCHAR_WIDTH 16
#define BIGCHAR_HEIGHT 24
#define GIANTCHAR_WIDTH 32
#define GIANTCHAR_HEIGHT 48
// client screen state
#define CL_DISCONNECTED 1 //
#define CL_LOADING 2 // draw loading progress-bar
#define CL_ACTIVE 3 // draw normal hud
#define TINYCHAR_WIDTH (SMALLCHAR_WIDTH)
#define TINYCHAR_HEIGHT (SMALLCHAR_HEIGHT/2)
#define SMALLCHAR_WIDTH 8
#define SMALLCHAR_HEIGHT 16
#define BIGCHAR_WIDTH 16
#define BIGCHAR_HEIGHT 24
#define GIANTCHAR_WIDTH 32
#define GIANTCHAR_HEIGHT 48
#define HUD_PRINTNOTIFY 1
#define HUD_PRINTCONSOLE 2

View File

@ -5,8 +5,9 @@
#ifndef ENTITY_DEF_H
#define ENTITY_DEF_H
typedef struct ed_priv_s ed_priv_t; // engine private data
typedef struct edict_s edict_t;
typedef struct cl_priv_s cl_priv_t; // cl.engine private data
typedef struct sv_priv_s sv_priv_t; // sv.engine private data
typedef struct edict_s edict_t; // generic entity
// TODO: move to CBaseEntity all fields which doesn't existing on client side
// TODO: generic edict must have all fields as valid on client side too
@ -140,19 +141,20 @@ typedef struct entvars_s
edict_t *pContainingEntity; // ptr to class for consistency
} entvars_t;
// FIXME: make pvEngineData as generic ptr for both types (client and server are valid, entvars are shared)
struct edict_s
{
BOOL free;
BOOL free; // shared parms
float freetime; // sv.time when the object was freed
int serialnumber;
int serialnumber; // must match with entity num
ed_priv_t *pvEngineData; // alloced, freed and used by engine only
void *pvServerData; // alloced and freed by engine, used by DLLs
union
{
sv_priv_t *pvServerData; // alloced, freed and used by engine only
cl_priv_t *pvClientData; // alloced, freed and used by engine only
};
void *pvPrivateData; // alloced and freed by engine, used by DLLs
entvars_t v; // C exported fields from progs (network relative)
// other fields from progs come immediately after
};
#endif//ENTITY_DEF_H

View File

@ -11,18 +11,6 @@
#define SHADER_NOMIP 2 // 2d images
#define SHADER_GENERIC 3 // generic shader
// player_state_t->renderfx
#define RDF_UNDERWATER (1<<0) // warp the screen as apropriate
#define RDF_NOWORLDMODEL (1<<1) // used for player configuration screen
#define RDF_BLOOM (1<<2) // light blooms
typedef struct vrect_s
{
int x, y;
int width;
int height;
} vrect_t;
typedef struct
{
vec3_t point;
@ -36,19 +24,6 @@ typedef struct
int numVerts;
} decalFragment_t;
typedef struct
{
vrect_t rect; // screen rectangle
float fov_x; // field of view by vertical
float fov_y; // field of view by horizontal
vec3_t vieworg; // client origin + viewoffset
vec3_t viewangles; // client angles
float time; // time is used to shaders auto animate
float oldtime; // oldtime using for lerping studio models
uint rdflags; // client view effects: RDF_UNDERWATER, RDF_MOTIONBLUR, etc
byte *areabits; // if not NULL, only areas with set bits will be drawn
} refdef_t;
/*
==============================================================================
@ -78,7 +53,7 @@ typedef struct render_exp_s
void (*ClearScene)( void );
void (*BeginFrame)( void );
void (*RenderFrame)( refdef_t *fd );
void (*RenderFrame)( ref_params_t *fd );
void (*EndFrame)( void );
// misc utilities

View File

@ -162,7 +162,6 @@ typedef struct enginefuncs_s
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, int ptype, const char *szMsg );
void (*pfnServerPrint)( const char *szMsg );
void (*pfnAreaPortal)( edict_t *pEdict, BOOL enable );
const char *(*pfnCmd_Args)( void );

View File

@ -58,6 +58,7 @@ goto done
rem //delete log files
if exist baserc\baserc.plg del /f /q baserc\baserc.plg
if exist client\client.plg del /f /q client\client.plg
if exist engine\engine.plg del /f /q engine\engine.plg
if exist launch\launch.plg del /f /q launch\launch.plg
if exist common\common.plg del /f /q common\common.plg

View File

@ -1041,9 +1041,9 @@ void GL_Setup3D( void )
int bits;
if( gl_finish->integer ) pglFinish();
x = r_refdef.rect.x;
y = r_height->integer - r_refdef.rect.height - r_refdef.rect.y;
w = r_refdef.rect.width;
x = r_refdef.viewport[0];
y = r_height->integer - r_refdef.viewport[3] - r_refdef.viewport[1];
w = r_refdef.viewport[2];
h = r_height->integer;
// Set up viewport

View File

@ -151,7 +151,7 @@ typedef struct
int width;
int height;
vrect_t viewport;
int viewport[4];
viewParms_t viewParms;
ref_entity_t *CurrentEntity;

View File

@ -399,7 +399,7 @@ void R_Bloom_DownsampleView( void )
R_BloomBlend
=================
*/
void R_BloomBlend( const refdef_t *fd )
void R_BloomBlend( const ref_params_t *fd )
{
if( !r_bloom->value ) return;
if( screen_texture_width < BLOOM_SIZE || screen_texture_height < BLOOM_SIZE )
@ -421,21 +421,21 @@ void R_BloomBlend( const refdef_t *fd )
pglColor4f( 1, 1, 1, 1 );
// set up current sizes
curView_x = fd->rect.x;
curView_y = fd->rect.y;
curView_width = fd->rect.width;
curView_height = fd->rect.height;
screenText_tcw = ((float)fd->rect.width / (float)screen_texture_width);
screenText_tch = ((float)fd->rect.height / (float)screen_texture_height);
if( fd->rect.height > fd->rect.width )
curView_x = fd->viewport[0];
curView_y = fd->viewport[1];
curView_width = fd->viewport[2];
curView_height = fd->viewport[3];
screenText_tcw = ((float)fd->viewport[2] / (float)screen_texture_width);
screenText_tch = ((float)fd->viewport[3] / (float)screen_texture_height);
if( fd->viewport[3] > fd->viewport[2] )
{
sampleText_tcw = ((float)fd->rect.width / (float)fd->rect.height);
sampleText_tcw = ((float)fd->viewport[2] / (float)fd->viewport[3]);
sampleText_tch = 1.0f;
}
else
{
sampleText_tcw = 1.0f;
sampleText_tch = ((float)fd->rect.height / (float)fd->rect.width);
sampleText_tch = ((float)fd->viewport[3] / (float)fd->viewport[2]);
}
sample_width = BLOOM_SIZE * sampleText_tcw;
sample_height = BLOOM_SIZE * sampleText_tch;

View File

@ -15,13 +15,19 @@ this is needed by some client drawing functions
void R_GetPicSize( int *w, int *h, shader_t handle )
{
ref_shader_t *shader;
if( handle >= 0 && handle < MAX_SHADERS && (shader = &r_shaders[handle]))
if( !w && !h ) return;
if( 0 ) //handle >= 0 && handle < MAX_SHADERS && (shader = &r_shaders[handle]))
{
*w = (int)shader->stages[0]->bundles[0]->textures[0]->width;
*h = (int)shader->stages[0]->bundles[0]->textures[0]->height;
if( w ) *w = (int)shader->stages[0]->bundles[0]->textures[0]->width;
if( h ) *h = (int)shader->stages[0]->bundles[0]->textures[0]->height;
}
else
{
if( w ) *w = -1;
if( h ) *h = -1;
}
else *w = *h = -1;
}

View File

@ -3227,10 +3227,10 @@ bool VID_CubemapShot( const char *base, uint size, bool skyshot )
return false;
// setup refdef
r_refdef.rect.x = 0;
r_refdef.rect.y = 0;
r_refdef.rect.width = size;
r_refdef.rect.height = size;
r_refdef.viewport[0] = 0;
r_refdef.viewport[1] = 0;
r_refdef.viewport[2] = size;
r_refdef.viewport[3] = size;
r_refdef.fov_x = 90;
r_refdef.fov_y = 90;

View File

@ -10,6 +10,8 @@
#include "launch_api.h"
#include "qfiles_ref.h"
#include "engine_api.h"
#include "entity_def.h"
#include "clgame_api.h"
#include "render_api.h"
#include "r_opengl.h"
@ -762,7 +764,7 @@ extern ref_entity_t *r_nullModels[MAX_ENTITIES];
extern int r_numNullModels;
extern lightstyle_t r_lightStyles[MAX_LIGHTSTYLES];
extern refdef_t r_refdef;
extern ref_params_t r_refdef;
extern refstats_t r_stats;
void R_DrawStudioModel( void );
@ -793,10 +795,10 @@ void R_DrawSprite( void );
void R_DrawBeam( void );
void R_DrawParticle( void );
void R_DrawPoly( void );
void R_RenderView( const refdef_t *fd );
void R_RenderView( const ref_params_t *fd );
void R_AddShadowToList( ref_entity_t *entity );
void R_RenderShadows( void );
void R_BloomBlend ( const refdef_t *fd );
void R_BloomBlend ( const ref_params_t *fd );
void R_DrawSky( void );
void R_ClearSky( void );
void R_ClipSkySurface( surface_t *surf );

View File

@ -38,7 +38,7 @@ int r_numPolys;
polyVert_t r_polyVerts[MAX_POLY_VERTS];
int r_numPolyVerts;
int r_numNullModels;
refdef_t r_refdef;
ref_params_t r_refdef;
refstats_t r_stats;
byte *r_framebuffer; // pause frame buffer
float r_pause_alpha;
@ -869,7 +869,7 @@ static void R_SetMatrices( void )
R_RenderView
=================
*/
void R_RenderView( const refdef_t *fd )
void R_RenderView( const ref_params_t *fd )
{
if( r_skipfrontend->integer )
return;
@ -1233,7 +1233,7 @@ bool R_AddPolyToScene( shader_t shader, int numVerts, const polyVert_t *verts )
R_RenderFrame
=================
*/
void R_RenderFrame( refdef_t *rd )
void R_RenderFrame( ref_params_t *rd )
{
if( r_norefresh->integer )
return;

View File

@ -413,7 +413,7 @@ void CBaseEntity::FireBullets(ULONG cShots, Vector vecSrc, Vector vecDirShooting
case BULLET_762:
case BULLET_BUCKSHOT:
default:
MESSAGE_BEGIN( MSG_PAS, SVC_TEMPENTITY, vecTracerSrc );
MESSAGE_BEGIN( MSG_PAS, gmsg.TempEntity, vecTracerSrc );
WRITE_BYTE( TE_TRACER );
WRITE_COORD( vecTracerSrc.x );
WRITE_COORD( vecTracerSrc.y );

View File

@ -475,7 +475,7 @@ void CFuncMirror :: Spawn( void )
void CFuncMirror :: StartMessage( CBasePlayer *pPlayer )
{
MESSAGE_BEGIN( MSG_ONE, gmsgAddMirror, NULL, pPlayer->pev );
MESSAGE_BEGIN( MSG_ONE, gmsg.AddMirror, NULL, pPlayer->pev );
WRITE_SHORT( entindex() );
MESSAGE_END();
}
@ -570,7 +570,7 @@ int CFuncMonitor :: ObjectCaps( void )
void CFuncMonitor::StartMessage( CBasePlayer *pPlayer )
{
//send monitor index
MESSAGE_BEGIN( MSG_ONE, gmsgAddScreen, NULL, pPlayer->pev );
MESSAGE_BEGIN( MSG_ONE, gmsg.AddScreen, NULL, pPlayer->pev );
WRITE_BYTE( entindex() );
MESSAGE_END();
ChangeCamera( pev->target );
@ -668,7 +668,7 @@ void CFuncTeleport :: Spawn( void )
void CFuncTeleport::StartMessage( CBasePlayer *pPlayer )
{
//send portal index
MESSAGE_BEGIN( MSG_ONE, gmsgAddPortal, NULL, pPlayer->pev );
MESSAGE_BEGIN( MSG_ONE, gmsg.AddPortal, NULL, pPlayer->pev );
WRITE_BYTE( entindex() );
MESSAGE_END();
ChangeCamera( pev->target );

View File

@ -117,7 +117,7 @@ void CEnvSky :: PostSpawn( void )
void CEnvSky :: StartMessage( CBasePlayer *pPlayer )
{
pev->effects |= EF_NODRAW;
MESSAGE_BEGIN( MSG_ONE, gmsgSetSky, NULL, pPlayer->pev );
MESSAGE_BEGIN( MSG_ONE, gmsg.SetSky, NULL, pPlayer->pev );
WRITE_BYTE( 1 ); // mode
WRITE_COORD( pev->origin.x ); // view position
WRITE_COORD( pev->origin.y );

View File

@ -8,6 +8,7 @@
#include "utils.h"
#include "cbase.h"
#include "player.h"
#include "client.h"
//=======================================================================
// info_target (target entity)
@ -73,7 +74,7 @@ public:
if(FStringNull(pev->targetname)) g_engfuncs.pfnStaticDecal( pev->origin, (int)pev->skin, entityIndex, modelIndex );
else
{
MESSAGE_BEGIN( MSG_BROADCAST, SVC_TEMPENTITY);
MESSAGE_BEGIN( MSG_BROADCAST, gmsg.TempEntity );
WRITE_BYTE( TE_BSPDECAL );
WRITE_COORD( pev->origin.x );
WRITE_COORD( pev->origin.y );

View File

@ -9,12 +9,12 @@
#include "cbase.h"
#include "saverestore.h"
#include "baseweapon.h"
#include "client.h"
#include "player.h"
#include "gamerules.h"
#include "defaults.h"
extern int gEvilImpulse101;
extern int gmsgItemPickup;
//***********************************************************
// main functions ()
@ -56,10 +56,10 @@ void CItem::ItemTouch( CBaseEntity *pOther )
UTIL_FireTargets( pev->target, pOther, this, USE_TOGGLE );
SetTouch( NULL );
if (IsItem() && gmsgItemPickup)
if (IsItem() && gmsg.ItemPickup)
{
//show icon for item
MESSAGE_BEGIN( MSG_ONE, gmsgItemPickup, NULL, pPlayer->pev );
MESSAGE_BEGIN( MSG_ONE, gmsg.ItemPickup, NULL, pPlayer->pev );
WRITE_STRING( STRING(pev->classname) );
MESSAGE_END();
}
@ -178,7 +178,7 @@ class CGenericItem : public CItem
EMIT_SOUND(ENT(pev), CHAN_ITEM, "weapons/glock/clip_in.wav", 1, ATTN_NORM);
return TRUE;
}
MESSAGE_BEGIN( MSG_ONE, gmsgItemPickup, NULL, pPlayer->pev );
MESSAGE_BEGIN( MSG_ONE, gmsg.ItemPickup, NULL, pPlayer->pev );
WRITE_STRING( STRING(pev->classname) );
MESSAGE_END();
return FALSE;

View File

@ -7,6 +7,7 @@
#include "utils.h"
#include "cbase.h"
#include "player.h"
#include "client.h"
//=======================================================================
// sparkleent - explode post sparks
@ -146,7 +147,7 @@ void CSmokeEnt::Think( void )
Vector VecSrc = UTIL_RandomVector( pev->absmin, pev->absmax );
MESSAGE_BEGIN( MSG_PVS, SVC_TEMPENTITY, VecSrc );
MESSAGE_BEGIN( MSG_PVS, gmsg.TempEntity, VecSrc );
WRITE_BYTE( TE_SMOKE );
WRITE_COORD( VecSrc.x );
WRITE_COORD( VecSrc.y );

View File

@ -9,6 +9,7 @@
#include "monsters.h"
#include "baseweapon.h"
#include "nodes.h"
#include "client.h"
#include "soundent.h"
#include "decals.h"
#include "defaults.h"
@ -533,7 +534,7 @@ void CApacheHVR :: IgniteThink( void )
EMIT_SOUND( ENT(pev), CHAN_VOICE, "weapons/rocket1.wav", 1, 0.5 );
// rocket trail
MESSAGE_BEGIN( MSG_BROADCAST, SVC_TEMPENTITY );
MESSAGE_BEGIN( MSG_BROADCAST, gmsg.TempEntity );
WRITE_BYTE( TE_BEAMFOLLOW );
WRITE_SHORT(entindex()); // entity
WRITE_SHORT(m_iTrail ); // model

View File

@ -6,6 +6,7 @@
#include "extdll.h"
#include "utils.h"
#include "cbase.h"
#include "client.h"
#include "player.h"
#include "monsters.h"
#include "baseweapon.h"
@ -18,8 +19,6 @@
extern int gEvilImpulse101;
ItemInfo CBasePlayerWeapon::ItemInfoArray[MAX_WEAPONS];
AmmoInfo CBasePlayerWeapon::AmmoInfoArray[MAX_AMMO_SLOTS];
extern int gmsgCurWeapon;
extern int gmsgWeapPickup;
char NameItems[MAX_WEAPONS][29];
int ID[MAX_WEAPONS];
int GlobalID = 0;
@ -1587,7 +1586,7 @@ void CBasePlayerWeapon::ZoomUpdate( void )
}
else if(m_iZoom > 1) m_iZoom = 3;
MESSAGE_BEGIN( MSG_ONE, gmsgZoomHUD, NULL, m_pPlayer->pev );
MESSAGE_BEGIN( MSG_ONE, gmsg.ZoomHUD, NULL, m_pPlayer->pev );
WRITE_BYTE( m_iZoom );
MESSAGE_END();
}
@ -1601,7 +1600,7 @@ void CBasePlayerWeapon::ZoomReset( void )
m_flHoldTime = UTIL_WeaponTimeBase() + 0.5;
m_pPlayer->m_iFOV = 90;
m_iZoom = 0;//clear zoom
MESSAGE_BEGIN( MSG_ONE, gmsgZoomHUD, NULL, m_pPlayer->pev );
MESSAGE_BEGIN( MSG_ONE, gmsg.ZoomHUD, NULL, m_pPlayer->pev );
WRITE_BYTE( m_iZoom );
MESSAGE_END();
m_pPlayer->UpdateClientData();//update client data manually
@ -1800,7 +1799,7 @@ int CBasePlayerWeapon::UpdateClientData( CBasePlayer *pPlayer )
if( m_iClientBody != m_iBody)
{
pev->body = (pev->body % NUM_HANDS) + NUM_HANDS * m_iBody; //calculate body
MESSAGE_BEGIN( MSG_ONE, gmsgSetBody, NULL, m_pPlayer->pev );
MESSAGE_BEGIN( MSG_ONE, gmsg.SetBody, NULL, m_pPlayer->pev );
WRITE_BYTE( pev->body ); //weaponmodel body
MESSAGE_END();
m_iClientBody = m_iBody;//synched
@ -1810,7 +1809,7 @@ int CBasePlayerWeapon::UpdateClientData( CBasePlayer *pPlayer )
if( m_iClientSkin != m_iSkin)
{
pev->skin = m_iSkin; //calculate skin
MESSAGE_BEGIN( MSG_ONE, gmsgSetSkin, NULL, m_pPlayer->pev );
MESSAGE_BEGIN( MSG_ONE, gmsg.SetSkin, NULL, m_pPlayer->pev );
WRITE_BYTE( pev->skin ); //weaponmodel skin.
MESSAGE_END();
m_iClientSkin = m_iSkin;//synched
@ -1839,7 +1838,7 @@ int CBasePlayerWeapon::UpdateClientData( CBasePlayer *pPlayer )
if ( bSend )
{
MESSAGE_BEGIN( MSG_ONE, gmsgCurWeapon, NULL, pPlayer->pev );
MESSAGE_BEGIN( MSG_ONE, gmsg.CurWeapon, NULL, pPlayer->pev );
WRITE_BYTE( state );
WRITE_BYTE( m_iId );
WRITE_BYTE( m_iClip );
@ -1912,7 +1911,7 @@ int CBasePlayerWeapon::AddToPlayer( CBasePlayer *pPlayer )
m_iSecondaryAmmoType = pPlayer->GetAmmoIndex( pszAmmo2() );
}
MESSAGE_BEGIN(MSG_ONE, gmsgWeapPickup, NULL, pPlayer->pev);
MESSAGE_BEGIN(MSG_ONE, gmsg.WeapPickup, NULL, pPlayer->pev);
WRITE_BYTE(m_iId);
MESSAGE_END();

View File

@ -20,6 +20,8 @@
// This gets called one time when the game is initialied
void GameDLLInit( void )
{
ALERT( at_console, "GameDLLInit();\n" );
// register cvars here:
CVAR_REGISTER( "sv_soundlist", "0", 0, "show server sound list" );

View File

@ -29,8 +29,6 @@ extern edict_t *EntSelectSpawnPoint( CBaseEntity *pPlayer );
DLL_GLOBAL CGameRules* g_pGameRules = NULL;
extern DLL_GLOBAL BOOL g_fGameOver;
extern int gmsgDeathMsg; // client dll messages
extern int gmsgMOTD;
int g_teamplay = 0;

View File

@ -20,6 +20,7 @@
#include "extdll.h"
#include "utils.h"
#include "cbase.h"
#include "client.h"
#include "player.h"
#include "baseweapon.h"
#include "gamerules.h"
@ -29,11 +30,6 @@
extern DLL_GLOBAL CGameRules *g_pGameRules;
extern DLL_GLOBAL BOOL g_fGameOver;
extern int gmsgDeathMsg; // client dll messages
extern int gmsgScoreInfo;
extern int gmsgMOTD;
extern int gmsgServerName;
extern int g_teamplay;
#define ITEM_RESPAWN_TIME 30
@ -321,12 +317,9 @@ BOOL CHalfLifeMultiplay :: ClientConnected( edict_t *pEntity, const char *userin
return TRUE;
}
extern int gmsgSayText;
extern int gmsgGameMode;
void CHalfLifeMultiplay :: UpdateGameMode( CBasePlayer *pPlayer )
{
MESSAGE_BEGIN( MSG_ONE, gmsgGameMode, NULL, pPlayer->edict() );
MESSAGE_BEGIN( MSG_ONE, gmsg.GameMode, NULL, pPlayer->edict() );
WRITE_BYTE( 0 ); // game mode none
MESSAGE_END();
}
@ -341,7 +334,7 @@ void CHalfLifeMultiplay :: InitHUD( CBasePlayer *pl )
// sending just one score makes the hud scoreboard active; otherwise
// it is just disabled for single play
MESSAGE_BEGIN( MSG_ONE, gmsgScoreInfo, NULL, pl->edict() );
MESSAGE_BEGIN( MSG_ONE, gmsg.ScoreInfo, NULL, pl->edict() );
WRITE_BYTE( ENTINDEX(pl->edict()) );
WRITE_SHORT( 0 );
WRITE_SHORT( 0 );
@ -359,7 +352,7 @@ void CHalfLifeMultiplay :: InitHUD( CBasePlayer *pl )
if ( plr )
{
MESSAGE_BEGIN( MSG_ONE, gmsgScoreInfo, NULL, pl->edict() );
MESSAGE_BEGIN( MSG_ONE, gmsg.ScoreInfo, NULL, pl->edict() );
WRITE_BYTE( i ); // client number
WRITE_SHORT( plr->pev->frags );
WRITE_SHORT( plr->m_iDeaths );
@ -371,7 +364,7 @@ void CHalfLifeMultiplay :: InitHUD( CBasePlayer *pl )
if ( g_fGameOver )
{
MESSAGE_BEGIN( MSG_ONE, SVC_INTERMISSION, NULL, pl->edict() );
MESSAGE_BEGIN( MSG_ONE, gmsg.Intermission, NULL, pl->edict() );
MESSAGE_END();
}
}
@ -525,7 +518,7 @@ void CHalfLifeMultiplay :: PlayerKilled( CBasePlayer *pVictim, entvars_t *pKille
// update the scores
// killed scores
MESSAGE_BEGIN( MSG_ALL, gmsgScoreInfo );
MESSAGE_BEGIN( MSG_ALL, gmsg.ScoreInfo );
WRITE_BYTE( ENTINDEX(pVictim->edict()) );
WRITE_SHORT( pVictim->pev->frags );
WRITE_SHORT( pVictim->m_iDeaths );
@ -539,7 +532,7 @@ void CHalfLifeMultiplay :: PlayerKilled( CBasePlayer *pVictim, entvars_t *pKille
{
CBasePlayer *PK = (CBasePlayer*)ep;
MESSAGE_BEGIN( MSG_ALL, gmsgScoreInfo );
MESSAGE_BEGIN( MSG_ALL, gmsg.ScoreInfo );
WRITE_BYTE( ENTINDEX(PK->edict()) );
WRITE_SHORT( PK->pev->frags );
WRITE_SHORT( PK->m_iDeaths );
@ -602,7 +595,7 @@ void CHalfLifeMultiplay::DeathNotice( CBasePlayer *pVictim, entvars_t *pKiller,
else if ( strncmp( killer_weapon_name, "func_", 5 ) == 0 )
killer_weapon_name += 5;
MESSAGE_BEGIN( MSG_ALL, gmsgDeathMsg );
MESSAGE_BEGIN( MSG_ALL, gmsg.DeathMsg );
WRITE_BYTE( killer_index ); // the killer
WRITE_BYTE( ENTINDEX(pVictim->edict()) ); // the victim
WRITE_STRING( killer_weapon_name ); // what they were killed by (should this be a string?)
@ -866,7 +859,7 @@ void CHalfLifeMultiplay :: GoToIntermission( void )
if ( g_fGameOver )
return; // intermission has already been triggered, so ignore.
MESSAGE_BEGIN(MSG_ALL, SVC_INTERMISSION);
MESSAGE_BEGIN( MSG_ALL, gmsg.Intermission );
MESSAGE_END();
// bounds check
@ -1306,7 +1299,7 @@ void CHalfLifeMultiplay :: SendMOTDToClient( edict_t *client )
char *aFileList = pFileList = (char*)LOAD_FILE ((char *)CVAR_GET_STRING( "motdfile" ), &length );
// send the server name
MESSAGE_BEGIN( MSG_ONE, gmsgServerName, NULL, client );
MESSAGE_BEGIN( MSG_ONE, gmsg.ServerName, NULL, client );
WRITE_STRING( CVAR_GET_STRING("hostname") );
MESSAGE_END();
@ -1333,7 +1326,7 @@ void CHalfLifeMultiplay :: SendMOTDToClient( edict_t *client )
else
*pFileList = 0;
MESSAGE_BEGIN( MSG_ONE, gmsgMOTD, NULL, client );
MESSAGE_BEGIN( MSG_ONE, gmsg.MOTD, NULL, client );
WRITE_BYTE( *pFileList ? FALSE : TRUE ); // FALSE means there is still more message to come
WRITE_STRING( chunk );
MESSAGE_END();

View File

@ -24,9 +24,6 @@
extern DLL_GLOBAL CGameRules *g_pGameRules;
extern DLL_GLOBAL BOOL g_fGameOver;
extern int gmsgDeathMsg; // client dll messages
extern int gmsgScoreInfo;
extern int gmsgMOTD;
//=========================================================
//=========================================================

View File

@ -1907,7 +1907,7 @@ void CFMODAudio::Spawn( void )
void CFMODAudio::StartMessage( CBasePlayer *pPlayer )
{
MESSAGE_BEGIN( MSG_ONE, gmsgFsound, NULL, pPlayer->pev );
MESSAGE_BEGIN( MSG_ONE, gmsg.Fsound, NULL, pPlayer->pev );
WRITE_STRING( STRING(pev->message));
WRITE_SHORT( pev->button );//position
WRITE_SHORT( pev->impulse );//flags

View File

@ -18,6 +18,7 @@
#include "extdll.h"
#include "utils.h"
#include "cbase.h"
#include "client.h"
#include "player.h"
#include "baseweapon.h"
#include "gamerules.h"
@ -153,15 +154,9 @@ BOOL CHalfLifeTeamplay :: ClientCommand( CBasePlayer *pPlayer, const char *pcmd
return FALSE;
}
extern int gmsgGameMode;
extern int gmsgSayText;
extern int gmsgTeamInfo;
extern int gmsgTeamNames;
extern int gmsgScoreInfo;
void CHalfLifeTeamplay :: UpdateGameMode( CBasePlayer *pPlayer )
{
MESSAGE_BEGIN( MSG_ONE, gmsgGameMode, NULL, pPlayer->edict() );
MESSAGE_BEGIN( MSG_ONE, gmsg.GameMode, NULL, pPlayer->edict() );
WRITE_BYTE( 1 ); // game mode teamplay
MESSAGE_END();
}
@ -206,7 +201,7 @@ void CHalfLifeTeamplay::InitHUD( CBasePlayer *pPlayer )
CHalfLifeMultiplay::InitHUD( pPlayer );
// Send down the team names
MESSAGE_BEGIN( MSG_ONE, gmsgTeamNames, NULL, pPlayer->edict() );
MESSAGE_BEGIN( MSG_ONE, gmsg.TeamNames, NULL, pPlayer->edict() );
WRITE_BYTE( num_teams );
for ( i = 0; i < num_teams; i++ )
{
@ -239,7 +234,7 @@ void CHalfLifeTeamplay::InitHUD( CBasePlayer *pPlayer )
CBaseEntity *plr = UTIL_PlayerByIndex( i );
if ( plr && IsValidTeam( plr->TeamID() ) )
{
MESSAGE_BEGIN( MSG_ONE, gmsgTeamInfo, NULL, pPlayer->edict() );
MESSAGE_BEGIN( MSG_ONE, gmsg.TeamInfo, NULL, pPlayer->edict() );
WRITE_BYTE( plr->entindex() );
WRITE_STRING( plr->TeamID() );
MESSAGE_END();
@ -282,12 +277,12 @@ void CHalfLifeTeamplay::ChangePlayerTeam( CBasePlayer *pPlayer, const char *pTea
g_engfuncs.pfnSetClientKeyValue( clientIndex, g_engfuncs.pfnGetInfoKeyBuffer( pPlayer->edict() ), "team", pPlayer->m_szTeamName );
// notify everyone's HUD of the team change
MESSAGE_BEGIN( MSG_ALL, gmsgTeamInfo );
MESSAGE_BEGIN( MSG_ALL, gmsg.TeamInfo );
WRITE_BYTE( clientIndex );
WRITE_STRING( pPlayer->m_szTeamName );
MESSAGE_END();
MESSAGE_BEGIN( MSG_ALL, gmsgScoreInfo );
MESSAGE_BEGIN( MSG_ALL, gmsg.ScoreInfo );
WRITE_BYTE( clientIndex );
WRITE_SHORT( pPlayer->pev->frags );
WRITE_SHORT( pPlayer->m_iDeaths );
@ -342,8 +337,6 @@ void CHalfLifeTeamplay::ClientUserInfoChanged( CBasePlayer *pPlayer, char *infob
RecountTeams( TRUE );
}
extern int gmsgDeathMsg;
//=========================================================
// Deathnotice.
//=========================================================
@ -360,7 +353,7 @@ void CHalfLifeTeamplay::DeathNotice( CBasePlayer *pVictim, entvars_t *pKiller, e
{
if ( (pk != pVictim) && (PlayerRelationship( pVictim, pk ) == GR_TEAMMATE) )
{
MESSAGE_BEGIN( MSG_ALL, gmsgDeathMsg );
MESSAGE_BEGIN( MSG_ALL, gmsg.DeathMsg );
WRITE_BYTE( ENTINDEX(ENT(pKiller)) ); // the killer
WRITE_BYTE( ENTINDEX(pVictim->edict()) ); // the victim
WRITE_STRING( "teammate" ); // flag this as a teammate kill
@ -603,7 +596,7 @@ void CHalfLifeTeamplay::RecountTeams( bool bResendInfo )
{
if ( plr && IsValidTeam( plr->TeamID() ) )
{
MESSAGE_BEGIN( MSG_ALL, gmsgTeamInfo, NULL );
MESSAGE_BEGIN( MSG_ALL, gmsg.TeamInfo, NULL );
WRITE_BYTE( plr->entindex() );
WRITE_STRING( plr->TeamID() );
MESSAGE_END();

View File

@ -51,11 +51,9 @@ DLL_GLOBAL int g_serveractive = 0;
BOOL MSGSended;
BOOL NewLevel = FALSE;
float MsgDelay;
user_messages_t gmsg;
void LinkUserMessages( void );
char text[128];
extern int gmsgSayText;
extern int gmsgHUDColor;
extern int gmsgCamData; // for trigger_viewset
extern int g_teamplay;
//messages affect only player
@ -66,60 +64,6 @@ typedef struct _SelAmmo
BYTE Ammo2Type;
BYTE Ammo2;
} SelAmmo;
int gmsgShake = 0;
int gmsgFade = 0;
int gmsgSelAmmo = 0;
int gmsgFlashlight = 0;
int gmsgFlashBattery = 0;
int gmsgResetHUD = 0;
int gmsgInitHUD = 0;
int gmsgHUDColor = 0;
int gmsgCurWeapon = 0;
int gmsgHealth = 0;
int gmsgDamage = 0;
int gmsgBattery = 0;
int gmsgTrain = 0;
int gmsgWeaponList = 0;
int gmsgAmmoX = 0;
int gmsgDeathMsg = 0;
int gmsgScoreInfo = 0;
int gmsgTeamInfo = 0;
int gmsgTeamScore = 0;
int gmsgGameMode = 0;
int gmsgMOTD = 0;
int gmsgServerName = 0;
int gmsgAmmoPickup = 0;
int gmsgWeapPickup = 0;
int gmsgItemPickup = 0;
int gmsgHideWeapon = 0;
int gmsgSetCurWeap = 0;
int gmsgSayText = 0;
int gmsgTextMsg = 0;
int gmsgSetFOV = 0;
int gmsgShowMenu = 0;
int gmsgGeigerRange = 0;
int gmsgTeamNames = 0;
int gmsgStatusText = 0;
int gmsgStatusValue = 0;
int gmsgSetBody = 0;
int gmsgSetSkin = 0;
int gmsgZoomHUD = 0;
int gmsgWarHUD = 0;
//entity messages
int gmsgHudText = 0;
int gmsgStatusIcon = 0;
int gmsgSetFog = 0;
int gmsgSetSky = 0;
int gmsgParticle = 0;
int gmsgBeams = 0;
int gmsgFsound = 0;
int gmsgShowGameTitle = 0;
int gmsgCamData;
int gmsgRainData = 0;
int gmsgAddMirror = 0;
int gmsgAddScreen = 0;
int gmsgAddPortal = 0;
/*
* used by kill command and disconnect command
@ -226,7 +170,7 @@ void ClientDisconnect( edict_t *pEntity )
char text[256];
sprintf( text, "- %s has left the game\n", STRING(pEntity->v.netname) );
MESSAGE_BEGIN( MSG_ALL, gmsgSayText, NULL );
MESSAGE_BEGIN( MSG_ALL, gmsg.SayText, NULL );
WRITE_BYTE( ENTINDEX(pEntity) );
WRITE_STRING( text );
MESSAGE_END();
@ -432,7 +376,7 @@ void Host_Say( edict_t *pEntity, int teamonly )
if ( teamonly && g_pGameRules->PlayerRelationship(client, CBaseEntity::Instance(pEntity)) != GR_TEAMMATE )
continue;
MESSAGE_BEGIN( MSG_ONE, gmsgSayText, NULL, client->pev );
MESSAGE_BEGIN( MSG_ONE, gmsg.SayText, NULL, client->pev );
WRITE_BYTE( ENTINDEX(pEntity) );
WRITE_STRING( text );
MESSAGE_END();
@ -440,7 +384,7 @@ void Host_Say( edict_t *pEntity, int teamonly )
}
// print to the sending client
MESSAGE_BEGIN( MSG_ONE, gmsgSayText, NULL, &pEntity->v );
MESSAGE_BEGIN( MSG_ONE, gmsg.SayText, NULL, &pEntity->v );
WRITE_BYTE( ENTINDEX(pEntity) );
WRITE_STRING( text );
MESSAGE_END();
@ -471,7 +415,7 @@ void ClientCommand( edict_t *pEntity )
const char *pstr;
// Is the client spawned yet?
if( !pEntity->pvServerData )
if( !pEntity->pvPrivateData )
return;
entvars_t *pev = &pEntity->v;
@ -496,7 +440,7 @@ void ClientCommand( edict_t *pEntity )
int col = (atoi(CMD_ARGV(1)) & 255) << 16;
col += (atoi(CMD_ARGV(2)) & 255) << 8;
col += (atoi(CMD_ARGV(3)) & 255);
MESSAGE_BEGIN( MSG_ONE, gmsgHUDColor, NULL, &pEntity->v );
MESSAGE_BEGIN( MSG_ONE, gmsg.HUDColor, NULL, &pEntity->v );
WRITE_LONG(col);
MESSAGE_END();
}
@ -577,18 +521,18 @@ void ClientCommand( edict_t *pEntity )
if(IsMultiplayer()) g_pGameRules->EndMultiplayerGame(); //loading next map
// FIXME: return to main menu here
}
else if ( FStrEq(pcmd, "gametitle" ) )
else if( FStrEq( pcmd, "gametitle" ))
{
MESSAGE_BEGIN( MSG_ONE, gmsgShowGameTitle, NULL, ENT(pev) );
MESSAGE_BEGIN( MSG_ONE, gmsg.ShowGameTitle, NULL, ENT( pev ));
WRITE_BYTE( 0 );
MESSAGE_END();
}
else if ( FStrEq(pcmd, "intermission" ) )
else if( FStrEq( pcmd, "intermission" ))
{
MESSAGE_BEGIN(MSG_ONE, SVC_INTERMISSION, NULL, ENT(pev));
MESSAGE_BEGIN( MSG_ONE, gmsg.Intermission, NULL, ENT( pev ));
MESSAGE_END();
}
else if ( FStrEq(pcmd, "fullupdate" ) )
else if( FStrEq( pcmd, "fullupdate" ))
{
GetClassPtr((CBasePlayer *)pev)->ForceClientDllUpdate();
}
@ -608,13 +552,13 @@ void ClientCommand( edict_t *pEntity )
}
else if ( FStrEq(pcmd, "fov" ) )
{
if ( g_flWeaponCheat && CMD_ARGC() > 1)
if( g_flWeaponCheat && CMD_ARGC() > 1)
{
GetClassPtr((CBasePlayer *)pev)->m_iFOV = atoi( CMD_ARGV(1) );
}
else
{
CLIENT_PRINTF( pEntity, HUD_PRINTCONSOLE, UTIL_VarArgs( "\"fov\" is \"%d\"\n", (int)GetClassPtr((CBasePlayer *)pev)->m_iFOV ) );
ClientPrint( &pEntity->v, HUD_PRINTCONSOLE, UTIL_VarArgs( "\"fov\" is \"%d\"\n", (int)GetClassPtr((CBasePlayer *)pev)->m_iFOV ) );
}
}
else if ( FStrEq(pcmd, "use" ) )
@ -668,7 +612,7 @@ it gets sent into the rest of the engine.
void ClientUserInfoChanged( edict_t *pEntity, char *infobuffer )
{
// Is the client spawned yet?
if ( !pEntity->pvServerData )
if ( !pEntity->pvPrivateData )
return;
// msg everyone if someone changes their name, and it isn't the first time (changing no name to current name)
@ -692,7 +636,7 @@ void ClientUserInfoChanged( edict_t *pEntity, char *infobuffer )
char text[256];
sprintf( text, "* %s changed name to %s\n", STRING(pEntity->v.netname), g_engfuncs.pfnInfoKeyValue( infobuffer, "name" ) );
MESSAGE_BEGIN( MSG_ALL, gmsgSayText, NULL );
MESSAGE_BEGIN( MSG_ALL, gmsg.SayText, NULL );
WRITE_BYTE( ENTINDEX(pEntity) );
WRITE_STRING( text );
MESSAGE_END();
@ -732,7 +676,7 @@ void ServerActivate( edict_t *pEdictList, int edictCount, int clientMax )
continue;
// Clients aren't necessarily initialized until ClientPutInServer()
if ( i < clientMax || !pEdictList[i].pvServerData )
if ( i < clientMax || !pEdictList[i].pvPrivateData )
continue;
pClass = CBaseEntity::Instance( &pEdictList[i] );
@ -1065,63 +1009,67 @@ const char *GetGameDescription()
//=======================================================================
void LinkUserMessages( void )
{
// Already taken care of?
if ( gmsgSelAmmo )return;
// already taken care of?
if( gmsg.SelAmmo ) return;
memset( &gmsg, 0, sizeof( gmsg ));
//messages affect only player
gmsgSelAmmo = REG_USER_MSG("SelAmmo", sizeof(SelAmmo));
gmsgCurWeapon = REG_USER_MSG("CurWeapon", 3);
gmsgGeigerRange = REG_USER_MSG("Geiger", 1);
gmsgFlashlight = REG_USER_MSG("Flashlight", 2);
gmsgFlashBattery = REG_USER_MSG("FlashBat", 1);
gmsgHealth = REG_USER_MSG( "Health", 1 );
gmsgDamage = REG_USER_MSG( "Damage", 12 );
gmsgBattery = REG_USER_MSG( "Battery", 2);
gmsgTrain = REG_USER_MSG( "Train", 1);
gmsgSayText = REG_USER_MSG( "SayText", -1 );
gmsgTextMsg = REG_USER_MSG( "TextMsg", -1 );
gmsgWeaponList = REG_USER_MSG("WeaponList", -1);
gmsgResetHUD = REG_USER_MSG("ResetHUD", 1);
gmsgInitHUD = REG_USER_MSG("InitHUD", 0 );
gmsgHUDColor = REG_USER_MSG( "HUDColor", 4 );
gmsgDeathMsg = REG_USER_MSG( "DeathMsg", -1 );
gmsgScoreInfo = REG_USER_MSG( "ScoreInfo", 9 );
gmsgTeamInfo = REG_USER_MSG( "TeamInfo", -1 );
gmsgTeamScore = REG_USER_MSG( "TeamScore", -1 );
gmsgGameMode = REG_USER_MSG( "GameMode", 1 );
gmsgMOTD = REG_USER_MSG( "MOTD", -1 );
gmsgServerName = REG_USER_MSG( "ServerName", -1 );
gmsgAmmoPickup = REG_USER_MSG( "AmmoPickup", 2 );
gmsgWeapPickup = REG_USER_MSG( "WeapPickup", 1 );
gmsgItemPickup = REG_USER_MSG( "ItemPickup", -1 );
gmsgHideWeapon = REG_USER_MSG( "HideWeapon", 1 );
gmsgSetFOV = REG_USER_MSG( "SetFOV", 1 );
gmsgShowMenu = REG_USER_MSG( "ShowMenu", -1 );
gmsgShake = REG_USER_MSG("ScreenShake", 13 );
gmsgFade = REG_USER_MSG("ScreenFade", sizeof(ScreenFade));
gmsgAmmoX = REG_USER_MSG("AmmoX", 2);
gmsgTeamNames = REG_USER_MSG( "TeamNames", -1 );
gmsgStatusText = REG_USER_MSG("StatusText", -1);
gmsgStatusValue = REG_USER_MSG("StatusValue", 3);
gmsgSetBody = REG_USER_MSG("SetBody", 1);
gmsgSetSkin = REG_USER_MSG("SetSkin", 1);
gmsgZoomHUD = REG_USER_MSG("ZoomHUD", 1);
gmsgWarHUD = REG_USER_MSG("WarHUD", 1);
gmsg.SelAmmo = REG_USER_MSG("SelAmmo", sizeof(SelAmmo));
gmsg.Intermission = REG_USER_MSG( "Intermission", 0 );
gmsg.CurWeapon = REG_USER_MSG("CurWeapon", 3);
gmsg.GeigerRange = REG_USER_MSG("Geiger", 1);
gmsg.Flashlight = REG_USER_MSG("Flashlight", 2);
gmsg.FlashBattery = REG_USER_MSG("FlashBat", 1);
gmsg.Health = REG_USER_MSG( "Health", 1 );
gmsg.Damage = REG_USER_MSG( "Damage", 18 );
gmsg.Battery = REG_USER_MSG( "Battery", 2);
gmsg.Train = REG_USER_MSG( "Train", 1);
gmsg.SayText = REG_USER_MSG( "SayText", -1 );
gmsg.TextMsg = REG_USER_MSG( "TextMsg", -1 );
gmsg.WeaponList = REG_USER_MSG("WeaponList", -1);
gmsg.ResetHUD = REG_USER_MSG("ResetHUD", 1);
gmsg.InitHUD = REG_USER_MSG("InitHUD", 0 );
gmsg.HUDColor = REG_USER_MSG( "HUDColor", 4 );
gmsg.DeathMsg = REG_USER_MSG( "DeathMsg", -1 );
gmsg.ScoreInfo = REG_USER_MSG( "ScoreInfo", 9 );
gmsg.TeamInfo = REG_USER_MSG( "TeamInfo", -1 );
gmsg.TeamScore = REG_USER_MSG( "TeamScore", -1 );
gmsg.GameMode = REG_USER_MSG( "GameMode", 1 );
gmsg.MOTD = REG_USER_MSG( "MOTD", -1 );
gmsg.ServerName = REG_USER_MSG( "ServerName", -1 );
gmsg.AmmoPickup = REG_USER_MSG( "AmmoPickup", 2 );
gmsg.WeapPickup = REG_USER_MSG( "WeapPickup", 1 );
gmsg.ItemPickup = REG_USER_MSG( "ItemPickup", -1 );
gmsg.RoomType = REG_USER_MSG( "RoomType", 2 );
gmsg.HideWeapon = REG_USER_MSG( "HideWeapon", 1 );
gmsg.SetFOV = REG_USER_MSG( "SetFOV", 1 );
gmsg.ShowMenu = REG_USER_MSG( "ShowMenu", -1 );
gmsg.Shake = REG_USER_MSG("ScreenShake", 13 );
gmsg.Fade = REG_USER_MSG("ScreenFade", sizeof(ScreenFade));
gmsg.AmmoX = REG_USER_MSG("AmmoX", 2);
gmsg.TeamNames = REG_USER_MSG( "TeamNames", -1 );
gmsg.StatusText = REG_USER_MSG("StatusText", -1);
gmsg.StatusValue = REG_USER_MSG("StatusValue", 3);
gmsg.SetBody = REG_USER_MSG("SetBody", 1);
gmsg.SetSkin = REG_USER_MSG("SetSkin", 1);
gmsg.ZoomHUD = REG_USER_MSG("ZoomHUD", 1);
gmsg.WarHUD = REG_USER_MSG("WarHUD", 1);
//entity messages
gmsgStatusIcon = REG_USER_MSG("StatusIcon", -1);
gmsgCamData = REG_USER_MSG("CamData", -1);
gmsgFsound = REG_USER_MSG("Fsound", -1);
gmsgRainData = REG_USER_MSG("RainData", 16);
gmsgAddScreen = REG_USER_MSG( "AddScreen", 1);
gmsgAddPortal = REG_USER_MSG( "AddPortal", 1);
gmsgHudText = REG_USER_MSG( "HudText", -1 );
gmsgShowGameTitle = REG_USER_MSG("GameTitle", 1);
gmsgSetFog = REG_USER_MSG("SetFog", 7 );
gmsgSetSky = REG_USER_MSG( "SetSky", 7 );
gmsgParticle = REG_USER_MSG( "Particle", -1);
gmsgBeams = REG_USER_MSG( "Beams", -1 );
gmsgAddMirror = REG_USER_MSG( "AddMirror", 2);
gmsg.StatusIcon = REG_USER_MSG("StatusIcon", -1);
gmsg.CamData = REG_USER_MSG("CamData", -1);
gmsg.Fsound = REG_USER_MSG("Fsound", -1);
gmsg.RainData = REG_USER_MSG("RainData", 16);
gmsg.AddScreen = REG_USER_MSG( "AddScreen", 1);
gmsg.AddPortal = REG_USER_MSG( "AddPortal", 1);
gmsg.HudText = REG_USER_MSG( "HudText", -1 );
gmsg.ShowGameTitle = REG_USER_MSG("GameTitle", 1);
gmsg.SetFog = REG_USER_MSG("SetFog", 7 );
gmsg.SetSky = REG_USER_MSG( "SetSky", 7 );
gmsg.Particle = REG_USER_MSG( "Particle", -1);
gmsg.Beams = REG_USER_MSG( "Beams", -1 );
gmsg.AddMirror = REG_USER_MSG( "AddMirror", 2);
}
/*

View File

@ -59,62 +59,68 @@ extern int InconsistentFile( const edict_t *player, const char *filename, char
extern int AllowLagCompensation( void );
extern int g_serveractive;
//messages affect only player
extern int gmsgShake;
extern int gmsgFade;
extern int gmsgSelAmmo;
extern int gmsgFlashlight;
extern int gmsgFlashBattery;
extern int gmsgResetHUD;
extern int gmsgInitHUD;
extern int gmsgHUDColor;
extern int gmsgCurWeapon;
extern int gmsgHealth;
extern int gmsgDamage;
extern int gmsgBattery;
extern int gmsgTrain;
extern int gmsgWeaponList;
extern int gmsgAmmoX;
extern int gmsgDeathMsg;
extern int gmsgScoreInfo;
extern int gmsgTeamInfo;
extern int gmsgTeamScore;
extern int gmsgGameMode;
extern int gmsgMOTD;
extern int gmsgServerName;
extern int gmsgAmmoPickup;
extern int gmsgWeapPickup;
extern int gmsgItemPickup;
extern int gmsgHideWeapon;
extern int gmsgSetCurWeap;
extern int gmsgSayText;
extern int gmsgSetFOV;
extern int gmsgShowMenu;
extern int gmsgGeigerRange;
extern int gmsgTeamNames;
extern int gmsgTextMsg;
extern int gmsgStatusText;
extern int gmsgStatusValue;
extern int gmsgSetBody;
extern int gmsgSetSkin;
extern int gmsgZoomHUD;
extern int gmsgWarHUD;
// messages affect only player
typedef struct user_messages_s
{
int Shake;
int Fade;
int SelAmmo;
int Intermission;
int Flashlight;
int FlashBattery;
int ResetHUD;
int InitHUD;
int HUDColor;
int CurWeapon;
int Health;
int Damage;
int Battery;
int Train;
int WeaponList;
int AmmoX;
int DeathMsg;
int ScoreInfo;
int TeamInfo;
int TeamScore;
int GameMode;
int MOTD;
int ServerName;
int AmmoPickup;
int WeapPickup;
int ItemPickup;
int HideWeapon;
int RoomType;
int SayText;
int SetFOV;
int ShowMenu;
int GeigerRange;
int TeamNames;
int TextMsg;
int StatusText;
int StatusValue;
int SetBody;
int SetSkin;
int ZoomHUD;
int WarHUD;
//entity messages
extern int gmsgSetFog;
extern int gmsgStatusIcon;
extern int gmsgSetSky;
extern int gmsgParticle;
extern int gmsgFsound;
extern int gmsgCamData;
extern int gmsgRainData;
extern int gmsgHudText;
extern int gmsgShowGameTitle;
extern int gmsgAddScreen;
extern int gmsgAddMirror;
extern int gmsgAddPortal;
extern int gmsgBeams;
// entity messages
int TempEntity; // completely moved from engine to user dlls
int SetFog;
int StatusIcon;
int SetSky;
int Particle;
int Fsound;
int CamData;
int RainData;
int HudText;
int ShowGameTitle;
int AddScreen;
int AddMirror;
int AddPortal;
int Beams;
} user_messages_t;
extern user_messages_t gmsg;
extern BOOL MSGSended;
#endif // CLIENT_H

View File

@ -93,7 +93,7 @@ inline void MESSAGE_BEGIN( int msg_dest, int msg_type, const float *pOrigin = NU
inline void *GET_PRIVATE( edict_t *pent )
{
if ( pent )
return pent->pvServerData;
return pent->pvPrivateData;
return NULL;
}
@ -116,7 +116,6 @@ inline void *GET_PRIVATE( edict_t *pent )
#define FUNCTION_FROM_NAME (*g_engfuncs.pfnFunctionFromName)
#define NAME_FOR_FUNCTION (*g_engfuncs.pfnNameForFunction)
#define TRACE_TEXTURE (*g_engfuncs.pfnTraceTexture)
#define CLIENT_PRINTF (*g_engfuncs.pfnClientPrintf)
#define CMD_ARGS (*g_engfuncs.pfnCmd_Args)
#define CMD_ARGC (*g_engfuncs.pfnCmd_Argc)
#define CMD_ARGV (*g_engfuncs.pfnCmd_Argv)

View File

@ -5,10 +5,11 @@
//=======================================================================
#include "sfx.h"
#include "client.h"
void SFX_Explode( short model, Vector origin, float scale, int flags )
{
MESSAGE_BEGIN( MSG_PAS, SVC_TEMPENTITY, origin );
MESSAGE_BEGIN( MSG_PAS, gmsg.TempEntity, origin );
WRITE_BYTE( TE_EXPLOSION ); // This makes a dynamic light and the explosion sprites/sound
WRITE_COORD( origin.x ); // Send to PAS because of the sound
WRITE_COORD( origin.y );
@ -22,7 +23,7 @@ void SFX_Explode( short model, Vector origin, float scale, int flags )
void SFX_Trail( int entindex, short model, Vector color, float life )
{
MESSAGE_BEGIN( MSG_BROADCAST, SVC_TEMPENTITY );
MESSAGE_BEGIN( MSG_BROADCAST, gmsg.TempEntity );
WRITE_BYTE( TE_BEAMFOLLOW );
WRITE_SHORT( entindex ); // entity
WRITE_SHORT( model ); // model
@ -38,7 +39,7 @@ void SFX_Trail( int entindex, short model, Vector color, float life )
void SFX_MakeGibs( int shards, Vector pos, Vector size, Vector velocity, float time, int flags)
{
MESSAGE_BEGIN( MSG_PVS, SVC_TEMPENTITY, pos );
MESSAGE_BEGIN( MSG_PVS, gmsg.TempEntity, pos );
WRITE_BYTE( TE_BREAKMODEL);
WRITE_COORD( pos.x ); // position
WRITE_COORD( pos.y );
@ -59,7 +60,7 @@ void SFX_MakeGibs( int shards, Vector pos, Vector size, Vector velocity, float t
void SFX_EjectBrass ( const Vector &vecOrigin, const Vector &vecVelocity, float rotation, int model, int soundtype )
{
MESSAGE_BEGIN( MSG_PVS, SVC_TEMPENTITY, vecOrigin );
MESSAGE_BEGIN( MSG_PVS, gmsg.TempEntity, vecOrigin );
WRITE_BYTE( TE_MODEL);
WRITE_COORD( vecOrigin.x);
WRITE_COORD( vecOrigin.y);
@ -76,7 +77,7 @@ void SFX_EjectBrass ( const Vector &vecOrigin, const Vector &vecVelocity, float
void SFX_Decal( const Vector &vecOrigin, int decalIndex, int entityIndex, int modelIndex )
{
MESSAGE_BEGIN( MSG_BROADCAST, SVC_TEMPENTITY);
MESSAGE_BEGIN( MSG_BROADCAST, gmsg.TempEntity);
WRITE_BYTE( TE_BSPDECAL );
WRITE_COORD( vecOrigin.x );
WRITE_COORD( vecOrigin.y );
@ -89,7 +90,7 @@ void SFX_Decal( const Vector &vecOrigin, int decalIndex, int entityIndex, int mo
void SFX_Light ( entvars_t *pev, float iTime, float decay, int attachment )
{
MESSAGE_BEGIN( MSG_PVS, SVC_TEMPENTITY, pev->origin );
MESSAGE_BEGIN( MSG_PVS, gmsg.TempEntity, pev->origin );
WRITE_BYTE( TE_ELIGHT );
WRITE_SHORT( ENTINDEX( ENT(pev) ) + 0x1000 * attachment );// entity, attachment
WRITE_COORD( pev->origin.x ); // X
@ -106,7 +107,7 @@ void SFX_Light ( entvars_t *pev, float iTime, float decay, int attachment )
void SFX_Zap ( entvars_t *pev, const Vector &vecSrc, const Vector &vecDest )
{
MESSAGE_BEGIN( MSG_BROADCAST, SVC_TEMPENTITY );
MESSAGE_BEGIN( MSG_BROADCAST, gmsg.TempEntity );
WRITE_BYTE( TE_BEAMPOINTS);
WRITE_COORD(vecSrc.x);
WRITE_COORD(vecSrc.y);
@ -130,7 +131,7 @@ void SFX_Zap ( entvars_t *pev, const Vector &vecSrc, const Vector &vecDest )
void SFX_Ring ( entvars_t *pev, entvars_t *pev2 )
{
MESSAGE_BEGIN( MSG_BROADCAST, SVC_TEMPENTITY );
MESSAGE_BEGIN( MSG_BROADCAST, gmsg.TempEntity );
WRITE_BYTE( TE_BEAMRING );
WRITE_SHORT( ENTINDEX(ENT(pev)) );
WRITE_SHORT( ENTINDEX(ENT(pev2)) );

View File

@ -17,17 +17,12 @@
// Screen / View effects
// screen shake
extern int gmsgShake;
//
// Commands for the screen shake effect.
//
// Fade in/out
extern int gmsgFade;
// This structure is sent over the net to describe a screen fade event
typedef struct
{

View File

@ -1180,7 +1180,7 @@ int UTIL_PrecacheAurora( const char *s )
void UTIL_SetAurora( CBaseEntity *pAttach, int aur, int attachment )
{
MESSAGE_BEGIN( MSG_ALL, gmsgParticle );
MESSAGE_BEGIN( MSG_ALL, gmsg.Particle );
WRITE_BYTE( pAttach->entindex() );
WRITE_STRING( STRING(aur) );
MESSAGE_END();
@ -1190,7 +1190,7 @@ void UTIL_SetAurora( CBaseEntity *pAttach, int aur, int attachment )
//========================================================================
void UTIL_SetBeams( char *szFile, CBaseEntity *pStart, CBaseEntity *pEnd )
{
MESSAGE_BEGIN( MSG_ALL, gmsgBeams );
MESSAGE_BEGIN( MSG_ALL, gmsg.Beams );
WRITE_STRING( szFile );
WRITE_BYTE( pStart->entindex());//beam start entity
WRITE_BYTE( pEnd->entindex() );//beam end entity
@ -2028,7 +2028,7 @@ void UTIL_ScreenShake( const Vector &center, float amplitude, float frequency, f
{
if ( eCommand == SHAKE_STOP ) localAmplitude = 0;
MESSAGE_BEGIN( MSG_ONE, gmsgShake, NULL, pPlayer->edict() );
MESSAGE_BEGIN( MSG_ONE, gmsg.Shake, NULL, pPlayer->edict() );
WRITE_BYTE( eCommand ); // shake command (SHAKE_START, STOP, FREQUENCY, AMPLITUDE)
WRITE_FLOAT( localAmplitude );// shake magnitude/amplitude
WRITE_FLOAT( frequency ); // shake noise frequency
@ -2087,7 +2087,7 @@ void UTIL_HudMessage( CBaseEntity *pEntity, const hudtextparms_t &textparms, con
if ( !pEntity || !pEntity->IsNetClient() )
return;
MESSAGE_BEGIN( MSG_ONE, SVC_TEMPENTITY, NULL, pEntity->edict() );
MESSAGE_BEGIN( MSG_ONE, gmsg.TempEntity, NULL, pEntity->edict() );
WRITE_BYTE( TE_TEXTMESSAGE );
WRITE_BYTE( textparms.channel & 0xFF );
@ -2137,12 +2137,10 @@ void UTIL_HudMessageAll( const hudtextparms_t &textparms, const char *pMessage )
UTIL_HudMessage( pPlayer, textparms, pMessage );
}
}
extern int gmsgTextMsg, gmsgSayText;
void UTIL_ClientPrintAll( int msg_dest, const char *msg_name, const char *param1, const char *param2, const char *param3, const char *param4 )
{
MESSAGE_BEGIN( MSG_ALL, gmsgTextMsg );
MESSAGE_BEGIN( MSG_ALL, gmsg.TextMsg );
WRITE_BYTE( msg_dest );
WRITE_STRING( msg_name );
@ -2160,7 +2158,7 @@ void UTIL_ClientPrintAll( int msg_dest, const char *msg_name, const char *param1
void ClientPrint( entvars_t *client, int msg_dest, const char *msg_name, const char *param1, const char *param2, const char *param3, const char *param4 )
{
MESSAGE_BEGIN( MSG_ONE, gmsgTextMsg, NULL, client );
MESSAGE_BEGIN( MSG_ONE, gmsg.TextMsg, NULL, client );
WRITE_BYTE( msg_dest );
WRITE_STRING( msg_name );
@ -2181,7 +2179,7 @@ void UTIL_SayText( const char *pText, CBaseEntity *pEntity )
if ( !pEntity->IsNetClient() )
return;
MESSAGE_BEGIN( MSG_ONE, gmsgSayText, NULL, pEntity->edict() );
MESSAGE_BEGIN( MSG_ONE, gmsg.SayText, NULL, pEntity->edict() );
WRITE_BYTE( pEntity->entindex() );
WRITE_STRING( pText );
MESSAGE_END();
@ -2189,7 +2187,7 @@ void UTIL_SayText( const char *pText, CBaseEntity *pEntity )
void UTIL_SayTextAll( const char *pText, CBaseEntity *pEntity )
{
MESSAGE_BEGIN( MSG_ALL, gmsgSayText, NULL );
MESSAGE_BEGIN( MSG_ALL, gmsg.SayText, NULL );
WRITE_BYTE( pEntity->entindex() );
WRITE_STRING( pText );
MESSAGE_END();
@ -2229,7 +2227,7 @@ void UTIL_ShowMessage( const char *pString, CBaseEntity *pEntity )
if ( !pEntity || !pEntity->IsNetClient() )
return;
MESSAGE_BEGIN( MSG_ONE, gmsgHudText, NULL, pEntity->edict() );
MESSAGE_BEGIN( MSG_ONE, gmsg.HudText, NULL, pEntity->edict() );
WRITE_STRING( pString );
MESSAGE_END();
}
@ -2479,7 +2477,7 @@ void UTIL_BloodStream( const Vector &origin, const Vector &direction, int color,
return;
MESSAGE_BEGIN( MSG_PVS, SVC_TEMPENTITY, origin );
MESSAGE_BEGIN( MSG_PVS, gmsg.TempEntity, origin );
WRITE_BYTE( TE_BLOODSTREAM );
WRITE_COORD( origin.x );
WRITE_COORD( origin.y );
@ -2512,7 +2510,7 @@ void UTIL_BloodDrips( const Vector &origin, const Vector &direction, int color,
if ( amount > 255 )
amount = 255;
MESSAGE_BEGIN( MSG_PVS, SVC_TEMPENTITY, origin );
MESSAGE_BEGIN( MSG_PVS, gmsg.TempEntity, origin );
WRITE_BYTE( TE_BLOODSPRITE );
WRITE_COORD( origin.x); // pos
WRITE_COORD( origin.y);
@ -2595,7 +2593,7 @@ void UTIL_DecalTrace( TraceResult *pTrace, int decalNumber )
}
}
MESSAGE_BEGIN( MSG_BROADCAST, SVC_TEMPENTITY );
MESSAGE_BEGIN( MSG_BROADCAST, gmsg.TempEntity );
WRITE_BYTE( message );
WRITE_COORD( pTrace->vecEndPos.x );
WRITE_COORD( pTrace->vecEndPos.y );
@ -2634,7 +2632,7 @@ void UTIL_PlayerDecalTrace( TraceResult *pTrace, int playernum, int decalNumber,
if (pTrace->flFraction == 1.0)
return;
MESSAGE_BEGIN( MSG_BROADCAST, SVC_TEMPENTITY );
MESSAGE_BEGIN( MSG_BROADCAST, gmsg.TempEntity );
WRITE_BYTE( TE_PLAYERDECAL );
WRITE_BYTE ( playernum );
WRITE_COORD( pTrace->vecEndPos.x );
@ -2657,7 +2655,7 @@ void UTIL_GunshotDecalTrace( TraceResult *pTrace, int decalNumber )
if (pTrace->flFraction == 1.0)
return;
MESSAGE_BEGIN( MSG_PAS, SVC_TEMPENTITY, pTrace->vecEndPos );
MESSAGE_BEGIN( MSG_PAS, gmsg.TempEntity, pTrace->vecEndPos );
WRITE_BYTE( TE_GUNSHOTDECAL );
WRITE_COORD( pTrace->vecEndPos.x );
WRITE_COORD( pTrace->vecEndPos.y );
@ -2670,7 +2668,7 @@ void UTIL_GunshotDecalTrace( TraceResult *pTrace, int decalNumber )
void UTIL_Sparks( const Vector &position )
{
MESSAGE_BEGIN( MSG_PVS, SVC_TEMPENTITY, position );
MESSAGE_BEGIN( MSG_PVS, gmsg.TempEntity, position );
WRITE_BYTE( TE_SPARKS );
WRITE_COORD( position.x );
WRITE_COORD( position.y );
@ -2693,7 +2691,7 @@ void UTIL_Explode( const Vector &center, edict_t *pOwner, int radius, int name )
void UTIL_Ricochet( const Vector &position, float scale )
{
MESSAGE_BEGIN( MSG_PVS, SVC_TEMPENTITY, position );
MESSAGE_BEGIN( MSG_PVS, gmsg.TempEntity, position );
WRITE_BYTE( TE_ARMOR_RICOCHET );
WRITE_COORD( position.x );
WRITE_COORD( position.y );
@ -2903,7 +2901,7 @@ void UTIL_Bubbles( Vector mins, Vector maxs, int count )
float flHeight = UTIL_WaterLevel( mid, mid.z, mid.z + 1024 );
flHeight = flHeight - mins.z;
MESSAGE_BEGIN( MSG_PAS, SVC_TEMPENTITY, mid );
MESSAGE_BEGIN( MSG_PAS, gmsg.TempEntity, mid );
WRITE_BYTE( TE_BUBBLES );
WRITE_COORD( mins.x ); // mins
WRITE_COORD( mins.y );
@ -2937,7 +2935,7 @@ void UTIL_BubbleTrail( Vector from, Vector to, int count )
if (count > 255)
count = 255;
MESSAGE_BEGIN( MSG_BROADCAST, SVC_TEMPENTITY );
MESSAGE_BEGIN( MSG_BROADCAST, gmsg.TempEntity );
WRITE_BYTE( TE_BUBBLETRAIL );
WRITE_COORD( from.x ); // mins
WRITE_COORD( from.y );

View File

@ -490,12 +490,7 @@ extern DLL_GLOBAL int g_Language;
#define VEC_DUCK_HULL_MAX Vector( 16, 16, 18)
#define VEC_DUCK_VIEW Vector( 0, 0, 12 )
#define SVC_TEMPENTITY 23
#define SVC_INTERMISSION 30
#define SVC_CDTRACK 32
#define SVC_WEAPONANIM 35
#define SVC_ROOMTYPE 37
#define SVC_DIRECTOR 51
#define SVC_WEAPONANIM 35 // FIMXE: get rid of this
// camera flags
#define CAMERA_ON 1

View File

@ -17,6 +17,7 @@
#include "extdll.h"
#include "utils.h"
#include "cbase.h"
#include "client.h"
#include "monsters.h"
#include "baseweapon.h"
#include "nodes.h"
@ -233,7 +234,7 @@ void CApache :: DyingThink( void )
if (m_flNextRocket > gpGlobals->time )
{
// random explosions
MESSAGE_BEGIN( MSG_PVS, SVC_TEMPENTITY, pev->origin );
MESSAGE_BEGIN( MSG_PVS, gmsg.TempEntity, pev->origin );
WRITE_BYTE( TE_EXPLOSION); // This just makes a dynamic light now
WRITE_COORD( pev->origin.x + RANDOM_FLOAT( -150, 150 ));
WRITE_COORD( pev->origin.y + RANDOM_FLOAT( -150, 150 ));
@ -245,7 +246,7 @@ void CApache :: DyingThink( void )
MESSAGE_END();
// lots of smoke
MESSAGE_BEGIN( MSG_PVS, SVC_TEMPENTITY, pev->origin );
MESSAGE_BEGIN( MSG_PVS, gmsg.TempEntity, pev->origin );
WRITE_BYTE( TE_SMOKE );
WRITE_COORD( pev->origin.x + RANDOM_FLOAT( -150, 150 ));
WRITE_COORD( pev->origin.y + RANDOM_FLOAT( -150, 150 ));
@ -256,7 +257,7 @@ void CApache :: DyingThink( void )
MESSAGE_END();
Vector vecSpot = pev->origin + (pev->mins + pev->maxs) * 0.5;
MESSAGE_BEGIN( MSG_PVS, SVC_TEMPENTITY, vecSpot );
MESSAGE_BEGIN( MSG_PVS, gmsg.TempEntity, vecSpot );
WRITE_BYTE( TE_BREAKMODEL);
// position
@ -301,7 +302,7 @@ void CApache :: DyingThink( void )
Vector vecSpot = pev->origin + (pev->mins + pev->maxs) * 0.5;
/*
MESSAGE_BEGIN( MSG_BROADCAST, SVC_TEMPENTITY );
MESSAGE_BEGIN( MSG_BROADCAST, gmsg.TempEntity );
WRITE_BYTE( TE_EXPLOSION); // This just makes a dynamic light now
WRITE_COORD( vecSpot.x );
WRITE_COORD( vecSpot.y );
@ -313,7 +314,7 @@ void CApache :: DyingThink( void )
*/
// fireball
MESSAGE_BEGIN( MSG_PVS, SVC_TEMPENTITY, vecSpot );
MESSAGE_BEGIN( MSG_PVS, gmsg.TempEntity, vecSpot );
WRITE_BYTE( TE_SPRITE );
WRITE_COORD( vecSpot.x );
WRITE_COORD( vecSpot.y );
@ -324,7 +325,7 @@ void CApache :: DyingThink( void )
MESSAGE_END();
// big smoke
MESSAGE_BEGIN( MSG_PVS, SVC_TEMPENTITY, vecSpot );
MESSAGE_BEGIN( MSG_PVS, gmsg.TempEntity, vecSpot );
WRITE_BYTE( TE_SMOKE );
WRITE_COORD( vecSpot.x );
WRITE_COORD( vecSpot.y );
@ -335,7 +336,7 @@ void CApache :: DyingThink( void )
MESSAGE_END();
// blast circle
MESSAGE_BEGIN( MSG_PVS, SVC_TEMPENTITY, pev->origin );
MESSAGE_BEGIN( MSG_PVS, gmsg.TempEntity, pev->origin );
WRITE_BYTE( TE_BEAMCYLINDER );
WRITE_COORD( pev->origin.x);
WRITE_COORD( pev->origin.y);
@ -375,7 +376,7 @@ void CApache :: DyingThink( void )
// gibs
vecSpot = pev->origin + (pev->mins + pev->maxs) * 0.5;
MESSAGE_BEGIN( MSG_PVS, SVC_TEMPENTITY, vecSpot );
MESSAGE_BEGIN( MSG_PVS, gmsg.TempEntity, vecSpot );
WRITE_BYTE( TE_BREAKMODEL);
// position
@ -768,7 +769,7 @@ void CApache :: FireRocket( void )
case 4: break;
}
MESSAGE_BEGIN( MSG_PVS, SVC_TEMPENTITY, vecSrc );
MESSAGE_BEGIN( MSG_PVS, gmsg.TempEntity, vecSrc );
WRITE_BYTE( TE_SMOKE );
WRITE_COORD( vecSrc.x );
WRITE_COORD( vecSrc.y );
@ -876,7 +877,7 @@ void CApache :: ShowDamage( void )
{
if (m_iDoSmokePuff > 0 || RANDOM_LONG(0,99) > pev->health)
{
MESSAGE_BEGIN( MSG_PVS, SVC_TEMPENTITY, pev->origin );
MESSAGE_BEGIN( MSG_PVS, gmsg.TempEntity, pev->origin );
WRITE_BYTE( TE_SMOKE );
WRITE_COORD( pev->origin.x );
WRITE_COORD( pev->origin.y );

View File

@ -20,6 +20,7 @@
#include "extdll.h"
#include "utils.h"
#include "cbase.h"
#include "client.h"
#include "monsters.h"
#include "talkmonster.h"
#include "schedule.h"
@ -394,20 +395,19 @@ void CBarney :: BarneyFirePistol ( void )
m_cAmmoLoaded--;// take away a bullet!
// Teh_Freak: World Lighting!
MESSAGE_BEGIN( MSG_BROADCAST, SVC_TEMPENTITY );
WRITE_BYTE( TE_DLIGHT );
WRITE_COORD( vecShootOrigin.x ); // origin
WRITE_COORD( vecShootOrigin.y );
WRITE_COORD( vecShootOrigin.z );
WRITE_BYTE( 16 ); // radius
WRITE_BYTE( 255 ); // R
WRITE_BYTE( 255 ); // G
WRITE_BYTE( 128 ); // B
WRITE_BYTE( 0 ); // life * 10
WRITE_BYTE( 0 ); // decay
MESSAGE_END();
MESSAGE_BEGIN( MSG_BROADCAST, gmsg.TempEntity );
WRITE_BYTE( TE_DLIGHT );
WRITE_COORD( vecShootOrigin.x ); // origin
WRITE_COORD( vecShootOrigin.y );
WRITE_COORD( vecShootOrigin.z );
WRITE_BYTE( 16 ); // radius
WRITE_BYTE( 255 ); // R
WRITE_BYTE( 255 ); // G
WRITE_BYTE( 128 ); // B
WRITE_BYTE( 0 ); // life * 10
WRITE_BYTE( 0 ); // decay
MESSAGE_END();
// Teh_Freak: World Lighting!
}
//=========================================================

View File

@ -24,6 +24,7 @@
#include "utils.h"
#include "cbase.h"
#include "nodes.h"
#include "client.h"
#include "monsters.h"
#include "animation.h"
#include "saverestore.h"
@ -748,7 +749,7 @@ void DrawRoute( entvars_t *pev, WayPoint_t *m_Route, int m_iRouteIndex, int r, i
// UTIL_ParticleEffect ( m_Route[ m_iRouteIndex ].vecLocation, g_vecZero, 255, 25 );
MESSAGE_BEGIN( MSG_BROADCAST, SVC_TEMPENTITY );
MESSAGE_BEGIN( MSG_BROADCAST, gmsg.TempEntity );
WRITE_BYTE( TE_BEAMPOINTS);
WRITE_COORD( pev->origin.x );
WRITE_COORD( pev->origin.y );
@ -776,7 +777,7 @@ void DrawRoute( entvars_t *pev, WayPoint_t *m_Route, int m_iRouteIndex, int r, i
break;
MESSAGE_BEGIN( MSG_BROADCAST, SVC_TEMPENTITY );
MESSAGE_BEGIN( MSG_BROADCAST, gmsg.TempEntity );
WRITE_BYTE( TE_BEAMPOINTS );
WRITE_COORD( m_Route[ i ].vecLocation.x );
WRITE_COORD( m_Route[ i ].vecLocation.y );
@ -1378,7 +1379,7 @@ int CBaseMonster :: CheckLocalMove ( const Vector &vecStart, const Vector &vecEn
}
/*
// uncommenting this block will draw a line representing the nearest legal move.
WRITE_BYTE(MSG_BROADCAST, SVC_TEMPENTITY);
WRITE_BYTE(MSG_BROADCAST, gmsg.TempEntity);
WRITE_BYTE(MSG_BROADCAST, TE_SHOWLINE);
WRITE_COORD(MSG_BROADCAST, pev->origin.x);
WRITE_COORD(MSG_BROADCAST, pev->origin.y);
@ -1556,7 +1557,7 @@ BOOL CBaseMonster :: BuildRoute ( const Vector &vecGoal, int iMoveFlag, CBaseEnt
m_Route[ 1 ].iType = iMoveFlag | bits_MF_IS_GOAL;
/*
WRITE_BYTE(MSG_BROADCAST, SVC_TEMPENTITY);
WRITE_BYTE(MSG_BROADCAST, gmsg.TempEntity);
WRITE_BYTE(MSG_BROADCAST, TE_SHOWLINE);
WRITE_COORD(MSG_BROADCAST, vecApex.x );
WRITE_COORD(MSG_BROADCAST, vecApex.y );
@ -1667,7 +1668,7 @@ BOOL CBaseMonster :: FTriangulate ( const Vector &vecStart , const Vector &vecEn
{
// Debug, Draw the triangulation
#if 0
MESSAGE_BEGIN( MSG_BROADCAST, SVC_TEMPENTITY );
MESSAGE_BEGIN( MSG_BROADCAST, gmsg.TempEntity );
WRITE_BYTE( TE_SHOWLINE);
WRITE_COORD( pev->origin.x );
WRITE_COORD( pev->origin.y );
@ -1677,7 +1678,7 @@ BOOL CBaseMonster :: FTriangulate ( const Vector &vecStart , const Vector &vecEn
WRITE_COORD( vecRight.z );
MESSAGE_END();
MESSAGE_BEGIN( MSG_BROADCAST, SVC_TEMPENTITY );
MESSAGE_BEGIN( MSG_BROADCAST, gmsg.TempEntity );
WRITE_BYTE( TE_SHOWLINE );
WRITE_COORD( pev->origin.x );
WRITE_COORD( pev->origin.y );
@ -1691,7 +1692,7 @@ BOOL CBaseMonster :: FTriangulate ( const Vector &vecStart , const Vector &vecEn
#if 0
if (pev->movetype == MOVETYPE_FLY)
{
MESSAGE_BEGIN( MSG_BROADCAST, SVC_TEMPENTITY );
MESSAGE_BEGIN( MSG_BROADCAST, gmsg.TempEntity );
WRITE_BYTE( TE_SHOWLINE );
WRITE_COORD( pev->origin.x );
WRITE_COORD( pev->origin.y );
@ -1701,7 +1702,7 @@ BOOL CBaseMonster :: FTriangulate ( const Vector &vecStart , const Vector &vecEn
WRITE_COORD( vecTop.z );
MESSAGE_END();
MESSAGE_BEGIN( MSG_BROADCAST, SVC_TEMPENTITY );
MESSAGE_BEGIN( MSG_BROADCAST, gmsg.TempEntity );
WRITE_BYTE( TE_SHOWLINE );
WRITE_COORD( pev->origin.x );
WRITE_COORD( pev->origin.y );
@ -2308,7 +2309,7 @@ BOOL CBaseMonster :: FindCover ( Vector vecThreat, Vector vecViewOffset, float f
if ( FValidateCover ( node.m_vecOrigin ) && MoveToLocation( ACT_RUN, 0, node.m_vecOrigin ) )
{
/*
MESSAGE_BEGIN( MSG_BROADCAST, SVC_TEMPENTITY );
MESSAGE_BEGIN( MSG_BROADCAST, gmsg.TempEntity );
WRITE_BYTE( TE_SHOWLINE);
WRITE_COORD( node.m_vecOrigin.x );
@ -5264,7 +5265,7 @@ void CBaseMonster :: MakeDamageBloodDecal ( int cCount, float flNoise, TraceResu
UTIL_TraceLine( ptr->vecEndPos, ptr->vecEndPos + vecTraceDir * 172, ignore_monsters, ENT(pev), &Bloodtr);
/*
MESSAGE_BEGIN( MSG_BROADCAST, SVC_TEMPENTITY );
MESSAGE_BEGIN( MSG_BROADCAST, gmsg.TempEntity );
WRITE_BYTE( TE_SHOWLINE);
WRITE_COORD( ptr->vecEndPos.x );
WRITE_COORD( ptr->vecEndPos.y );

View File

@ -23,6 +23,7 @@
#include "extdll.h"
#include "utils.h"
#include "cbase.h"
#include "client.h"
#include "monsters.h"
#include "soundent.h"
#include "decals.h"
@ -140,7 +141,7 @@ void EjectBrass ( const Vector &vecOrigin, const Vector &vecVelocity, float rota
{
// FIX: when the player shoots, their gun isn't in the same position as it is on the model other players see.
MESSAGE_BEGIN( MSG_PVS, SVC_TEMPENTITY, vecOrigin );
MESSAGE_BEGIN( MSG_PVS, gmsg.TempEntity, vecOrigin );
WRITE_BYTE( TE_MODEL);
WRITE_COORD( vecOrigin.x);
WRITE_COORD( vecOrigin.y);

View File

@ -32,6 +32,7 @@
#include "plane.h"
#include "utils.h"
#include "cbase.h"
#include "client.h"
#include "monsters.h"
#include "schedule.h"
#include "animation.h"
@ -811,18 +812,18 @@ void CHGrunt :: Shoot ( void )
SetBlending( 0, angDir.x );
// Teh_Freak: World Lighting!
MESSAGE_BEGIN( MSG_BROADCAST, SVC_TEMPENTITY );
WRITE_BYTE( TE_DLIGHT );
WRITE_COORD( vecShootOrigin.x ); // origin
WRITE_COORD( vecShootOrigin.y );
WRITE_COORD( vecShootOrigin.z );
WRITE_BYTE( 16 ); // radius
WRITE_BYTE( 255 ); // R
WRITE_BYTE( 255 ); // G
WRITE_BYTE( 128 ); // B
WRITE_BYTE( 0 ); // life * 10
WRITE_BYTE( 0 ); // decay
MESSAGE_END();
MESSAGE_BEGIN( MSG_BROADCAST, gmsg.TempEntity );
WRITE_BYTE( TE_DLIGHT );
WRITE_COORD( vecShootOrigin.x ); // origin
WRITE_COORD( vecShootOrigin.y );
WRITE_COORD( vecShootOrigin.z );
WRITE_BYTE( 16 ); // radius
WRITE_BYTE( 255 ); // R
WRITE_BYTE( 255 ); // G
WRITE_BYTE( 128 ); // B
WRITE_BYTE( 0 ); // life * 10
WRITE_BYTE( 0 ); // decay
MESSAGE_END();
// Teh_Freak: World Lighting!
}
@ -854,18 +855,18 @@ void CHGrunt :: Shotgun ( void )
SetBlending( 0, angDir.x );
// Teh_Freak: World Lighting!
MESSAGE_BEGIN( MSG_BROADCAST, SVC_TEMPENTITY );
WRITE_BYTE( TE_DLIGHT );
WRITE_COORD( vecShootOrigin.x ); // origin
WRITE_COORD( vecShootOrigin.y );
WRITE_COORD( vecShootOrigin.z );
WRITE_BYTE( 16 ); // radius
WRITE_BYTE( 255 ); // R
WRITE_BYTE( 255 ); // G
WRITE_BYTE( 128 ); // B
WRITE_BYTE( 0 ); // life * 10
WRITE_BYTE( 0 ); // decay
MESSAGE_END();
MESSAGE_BEGIN( MSG_BROADCAST, gmsg.TempEntity );
WRITE_BYTE( TE_DLIGHT );
WRITE_COORD( vecShootOrigin.x ); // origin
WRITE_COORD( vecShootOrigin.y );
WRITE_COORD( vecShootOrigin.z );
WRITE_BYTE( 16 ); // radius
WRITE_BYTE( 255 ); // R
WRITE_BYTE( 255 ); // G
WRITE_BYTE( 128 ); // B
WRITE_BYTE( 0 ); // life * 10
WRITE_BYTE( 0 ); // decay
MESSAGE_END();
// Teh_Freak: World Lighting!
}

View File

@ -22,6 +22,7 @@
#include "extdll.h"
#include "utils.h"
#include "cbase.h"
#include "client.h"
#include "monsters.h"
#include "nodes.h"
#include "animation.h"
@ -415,7 +416,7 @@ int CGraph :: FindNearestLink ( const Vector &vecTestPoint, int *piNearestLink,
/*
if ( fSuccess )
{
WRITE_BYTE(MSG_BROADCAST, SVC_TEMPENTITY);
WRITE_BYTE(MSG_BROADCAST, gmsg.TempEntity);
WRITE_BYTE(MSG_BROADCAST, TE_SHOWLINE);
WRITE_COORD(MSG_BROADCAST, m_pNodes[ m_pLinkPool[ iNearestLink ].m_iSrcNode ].m_vecOrigin.x );
@ -742,7 +743,7 @@ int CGraph :: FindShortestPath ( int *piPath, int iStart, int iDest, int iHull,
for ( int i = 0 ; i < iNumPathNodes - 1 ; i++ )
{
MESSAGE_BEGIN( MSG_BROADCAST, SVC_TEMPENTITY );
MESSAGE_BEGIN( MSG_BROADCAST, gmsg.TempEntity );
WRITE_BYTE( TE_SHOWLINE);
WRITE_COORD( m_pNodes[ piPath[ i ] ].m_vecOrigin.x );
@ -758,7 +759,7 @@ int CGraph :: FindShortestPath ( int *piPath, int iStart, int iDest, int iHull,
#endif
#if 0 // MAZE map
MESSAGE_BEGIN( MSG_BROADCAST, SVC_TEMPENTITY );
MESSAGE_BEGIN( MSG_BROADCAST, gmsg.TempEntity );
WRITE_BYTE( TE_SHOWLINE);
WRITE_COORD( m_pNodes[ 4 ].m_vecOrigin.x );
@ -1111,7 +1112,7 @@ void CGraph :: ShowNodeConnections ( int iNode )
pLinkNode = &Node( NodeLink( iNode, i).m_iDestNode );
vecSpot = pLinkNode->m_vecOrigin;
MESSAGE_BEGIN( MSG_BROADCAST, SVC_TEMPENTITY );
MESSAGE_BEGIN( MSG_BROADCAST, gmsg.TempEntity );
WRITE_BYTE( TE_SHOWLINE);
WRITE_COORD( m_pNodes[ iNode ].m_vecOrigin.x );
@ -2093,7 +2094,7 @@ void CTestHull :: PathFind ( void )
pNextNode = &WorldGraph.m_pNodes[ iPath [ i + 1 ] ];
MESSAGE_BEGIN( MSG_BROADCAST, SVC_TEMPENTITY );
MESSAGE_BEGIN( MSG_BROADCAST, gmsg.TempEntity );
WRITE_BYTE( TE_SHOWLINE);
WRITE_COORD( pNode->m_vecOrigin.x );
@ -3631,7 +3632,7 @@ void CNodeViewer :: DrawThink( void )
}
extern short g_sModelIndexLaser;
MESSAGE_BEGIN( MSG_BROADCAST, SVC_TEMPENTITY );
MESSAGE_BEGIN( MSG_BROADCAST, gmsg.TempEntity );
WRITE_BYTE( TE_BEAMPOINTS );
WRITE_COORD( WorldGraph.m_pNodes[ m_aFrom[m_iDraw] ].m_vecOrigin.x );
WRITE_COORD( WorldGraph.m_pNodes[ m_aFrom[m_iDraw] ].m_vecOrigin.y );

View File

@ -15,6 +15,7 @@
#include "extdll.h"
#include "utils.h"
#include "cbase.h"
#include "client.h"
#include "monsters.h"
#include "baseweapon.h"
#include "nodes.h"
@ -573,7 +574,7 @@ void COsprey :: DyingThink( void )
Vector vecSpot = pev->origin + pev->velocity * 0.2;
// random explosions
MESSAGE_BEGIN( MSG_PVS, SVC_TEMPENTITY, vecSpot );
MESSAGE_BEGIN( MSG_PVS, gmsg.TempEntity, vecSpot );
WRITE_BYTE( TE_EXPLOSION); // This just makes a dynamic light now
WRITE_COORD( vecSpot.x + RANDOM_FLOAT( -150, 150 ));
WRITE_COORD( vecSpot.y + RANDOM_FLOAT( -150, 150 ));
@ -585,7 +586,7 @@ void COsprey :: DyingThink( void )
MESSAGE_END();
// lots of smoke
MESSAGE_BEGIN( MSG_PVS, SVC_TEMPENTITY, vecSpot );
MESSAGE_BEGIN( MSG_PVS, gmsg.TempEntity, vecSpot );
WRITE_BYTE( TE_SMOKE );
WRITE_COORD( vecSpot.x + RANDOM_FLOAT( -150, 150 ));
WRITE_COORD( vecSpot.y + RANDOM_FLOAT( -150, 150 ));
@ -597,7 +598,7 @@ void COsprey :: DyingThink( void )
vecSpot = pev->origin + (pev->mins + pev->maxs) * 0.5;
MESSAGE_BEGIN( MSG_PVS, SVC_TEMPENTITY, vecSpot );
MESSAGE_BEGIN( MSG_PVS, gmsg.TempEntity, vecSpot );
WRITE_BYTE( TE_BREAKMODEL);
// position
@ -644,7 +645,7 @@ void COsprey :: DyingThink( void )
Vector vecSpot = pev->origin + (pev->mins + pev->maxs) * 0.5;
/*
MESSAGE_BEGIN( MSG_BROADCAST, SVC_TEMPENTITY );
MESSAGE_BEGIN( MSG_BROADCAST, gmsg.TempEntity );
WRITE_BYTE( TE_EXPLOSION); // This just makes a dynamic light now
WRITE_COORD( vecSpot.x );
WRITE_COORD( vecSpot.y );
@ -656,7 +657,7 @@ void COsprey :: DyingThink( void )
*/
// gibs
MESSAGE_BEGIN( MSG_PVS, SVC_TEMPENTITY, vecSpot );
MESSAGE_BEGIN( MSG_PVS, gmsg.TempEntity, vecSpot );
WRITE_BYTE( TE_SPRITE );
WRITE_COORD( vecSpot.x );
WRITE_COORD( vecSpot.y );
@ -667,7 +668,7 @@ void COsprey :: DyingThink( void )
MESSAGE_END();
/*
MESSAGE_BEGIN( MSG_BROADCAST, SVC_TEMPENTITY );
MESSAGE_BEGIN( MSG_BROADCAST, gmsg.TempEntity );
WRITE_BYTE( TE_SMOKE );
WRITE_COORD( vecSpot.x );
WRITE_COORD( vecSpot.y );
@ -679,7 +680,7 @@ void COsprey :: DyingThink( void )
*/
// blast circle
MESSAGE_BEGIN( MSG_PAS, SVC_TEMPENTITY, pev->origin );
MESSAGE_BEGIN( MSG_PAS, gmsg.TempEntity, pev->origin );
WRITE_BYTE( TE_BEAMCYLINDER );
WRITE_COORD( pev->origin.x);
WRITE_COORD( pev->origin.y);
@ -706,7 +707,7 @@ void COsprey :: DyingThink( void )
// gibs
vecSpot = pev->origin + (pev->mins + pev->maxs) * 0.5;
MESSAGE_BEGIN( MSG_PAS, SVC_TEMPENTITY, vecSpot );
MESSAGE_BEGIN( MSG_PAS, gmsg.TempEntity, vecSpot );
WRITE_BYTE( TE_BREAKMODEL);
// position
@ -751,7 +752,7 @@ void COsprey :: ShowDamage( void )
if (m_iDoLeftSmokePuff > 0 || RANDOM_LONG(0,99) > m_flLeftHealth)
{
Vector vecSrc = pev->origin + gpGlobals->v_right * -340;
MESSAGE_BEGIN( MSG_PVS, SVC_TEMPENTITY, vecSrc );
MESSAGE_BEGIN( MSG_PVS, gmsg.TempEntity, vecSrc );
WRITE_BYTE( TE_SMOKE );
WRITE_COORD( vecSrc.x );
WRITE_COORD( vecSrc.y );
@ -766,7 +767,7 @@ void COsprey :: ShowDamage( void )
if (m_iDoRightSmokePuff > 0 || RANDOM_LONG(0,99) > m_flRightHealth)
{
Vector vecSrc = pev->origin + gpGlobals->v_right * 340;
MESSAGE_BEGIN( MSG_PVS, SVC_TEMPENTITY, vecSrc );
MESSAGE_BEGIN( MSG_PVS, gmsg.TempEntity, vecSrc );
WRITE_BYTE( TE_SMOKE );
WRITE_COORD( vecSrc.x );
WRITE_COORD( vecSrc.y );

View File

@ -821,7 +821,7 @@ void CBasePlayer::RemoveAllItems( BOOL removeSuit )
UpdateClientData();
// send Selected Weapon Message to our client
MESSAGE_BEGIN( MSG_ONE, gmsgCurWeapon, NULL, pev );
MESSAGE_BEGIN( MSG_ONE, gmsg.CurWeapon, NULL, pev );
WRITE_BYTE(0);
WRITE_BYTE(0);
WRITE_BYTE(0);
@ -885,12 +885,12 @@ void CBasePlayer::Killed( entvars_t *pevAttacker, int iGib )
// send "health" update message to zero
m_iClientHealth = 0;
MESSAGE_BEGIN( MSG_ONE, gmsgHealth, NULL, pev );
MESSAGE_BEGIN( MSG_ONE, gmsg.Health, NULL, pev );
WRITE_BYTE( m_iClientHealth );
MESSAGE_END();
// Tell Ammo Hud that the player is dead
MESSAGE_BEGIN( MSG_ONE, gmsgCurWeapon, NULL, pev );
MESSAGE_BEGIN( MSG_ONE, gmsg.CurWeapon, NULL, pev );
WRITE_BYTE(0);
WRITE_BYTE(0XFF);
WRITE_BYTE(0xFF);
@ -903,7 +903,7 @@ void CBasePlayer::Killed( entvars_t *pevAttacker, int iGib )
viewFlags = 0;
viewNeedsUpdate = 1;
MESSAGE_BEGIN( MSG_ONE, gmsgSetFOV, NULL, pev );
MESSAGE_BEGIN( MSG_ONE, gmsg.SetFOV, NULL, pev );
WRITE_BYTE(0);
MESSAGE_END();
@ -1313,7 +1313,7 @@ void CBasePlayer::PlayerDeathThink(void)
}
//disable redeemer HUD
MESSAGE_BEGIN( MSG_ONE, gmsgWarHUD, NULL, pev );
MESSAGE_BEGIN( MSG_ONE, gmsg.WarHUD, NULL, pev );
WRITE_BYTE( 0 );
MESSAGE_END();
@ -1790,7 +1790,7 @@ void CBasePlayer::AddPoints( int score, BOOL bAllowNegativeScore )
pev->frags += score;
MESSAGE_BEGIN( MSG_ALL, gmsgScoreInfo );
MESSAGE_BEGIN( MSG_ALL, gmsg.ScoreInfo );
WRITE_BYTE( ENTINDEX(edict()) );
WRITE_SHORT( pev->frags );
WRITE_SHORT( m_iDeaths );
@ -1875,7 +1875,7 @@ void CBasePlayer::UpdateStatusBar()
if ( strcmp( sbuf0, m_SbarString0 ) )
{
MESSAGE_BEGIN( MSG_ONE, gmsgStatusText, NULL, pev );
MESSAGE_BEGIN( MSG_ONE, gmsg.StatusText, NULL, pev );
WRITE_BYTE( 0 );
WRITE_STRING( sbuf0 );
MESSAGE_END();
@ -1888,7 +1888,7 @@ void CBasePlayer::UpdateStatusBar()
if ( strcmp( sbuf1, m_SbarString1 ) )
{
MESSAGE_BEGIN( MSG_ONE, gmsgStatusText, NULL, pev );
MESSAGE_BEGIN( MSG_ONE, gmsg.StatusText, NULL, pev );
WRITE_BYTE( 1 );
WRITE_STRING( sbuf1 );
MESSAGE_END();
@ -1904,7 +1904,7 @@ void CBasePlayer::UpdateStatusBar()
{
if ( newSBarState[i] != m_izSBarState[i] || bForceResend )
{
MESSAGE_BEGIN( MSG_ONE, gmsgStatusValue, NULL, pev );
MESSAGE_BEGIN( MSG_ONE, gmsg.StatusValue, NULL, pev );
WRITE_BYTE( i );
WRITE_SHORT( newSBarState[i] );
MESSAGE_END();
@ -2653,7 +2653,7 @@ void CBasePlayer :: UpdateGeigerCounter( void )
{
m_igeigerRangePrev = range;
MESSAGE_BEGIN( MSG_ONE, gmsgGeigerRange, NULL, pev );
MESSAGE_BEGIN( MSG_ONE, gmsg.GeigerRange, NULL, pev );
WRITE_BYTE( range );
MESSAGE_END();
}
@ -3760,7 +3760,7 @@ void CBasePlayer :: FlashlightTurnOn( void )
{
EMIT_SOUND_DYN( ENT(pev), CHAN_WEAPON, SOUND_FLASHLIGHT_ON, 1.0, ATTN_NORM, 0, PITCH_NORM );
SetBits(pev->effects, EF_DIMLIGHT);
MESSAGE_BEGIN( MSG_ONE, gmsgFlashlight, NULL, pev );
MESSAGE_BEGIN( MSG_ONE, gmsg.Flashlight, NULL, pev );
WRITE_BYTE(1);
WRITE_BYTE(m_iFlashBattery);
MESSAGE_END();
@ -3775,7 +3775,7 @@ void CBasePlayer :: FlashlightTurnOff( void )
EMIT_SOUND_DYN( ENT(pev), CHAN_WEAPON, SOUND_FLASHLIGHT_OFF, 1.0, ATTN_NORM, 0, PITCH_NORM );
ClearBits(pev->effects, EF_DIMLIGHT);
MESSAGE_BEGIN( MSG_ONE, gmsgFlashlight, NULL, pev );
MESSAGE_BEGIN( MSG_ONE, gmsg.Flashlight, NULL, pev );
WRITE_BYTE(0);
WRITE_BYTE(m_iFlashBattery);
MESSAGE_END();
@ -3800,7 +3800,7 @@ void CBasePlayer :: ForceClientDllUpdate( void )
m_iTrain |= TRAIN_NEW; // Force new train message.
m_fWeapon = FALSE; // Force weapon send
m_fKnownItem = FALSE; // Force weaponinit messages.
m_fInitHUD = TRUE; // Force HUD gmsgResetHUD message
m_fInitHUD = TRUE; // Force HUD gmsg.ResetHUD message
// Now force all the necessary messages
// to be sent.
@ -4073,10 +4073,10 @@ int CBasePlayer :: GiveAmmo( int iCount, char *szName, int iMax )
m_rgAmmo[ i ] += iAdd;
if ( gmsgAmmoPickup )// make sure the ammo messages have been linked first
if ( gmsg.AmmoPickup )// make sure the ammo messages have been linked first
{
// Send the message that ammo has been picked up
MESSAGE_BEGIN( MSG_ONE, gmsgAmmoPickup, NULL, pev );
MESSAGE_BEGIN( MSG_ONE, gmsg.AmmoPickup, NULL, pev );
WRITE_BYTE( GetAmmoIndex(szName) );
WRITE_BYTE( iAdd );
MESSAGE_END();
@ -4190,7 +4190,7 @@ void CBasePlayer::SendAmmoUpdate(void)
ASSERT( m_rgAmmo[i] < 255 );
// send "Ammo" update message
MESSAGE_BEGIN( MSG_ONE, gmsgAmmoX, NULL, pev );
MESSAGE_BEGIN( MSG_ONE, gmsg.AmmoX, NULL, pev );
WRITE_BYTE( i );
WRITE_BYTE( max( min( m_rgAmmo[i], 254 ), 0 ) ); // clamp the value to one byte
MESSAGE_END();
@ -4220,13 +4220,13 @@ void CBasePlayer :: UpdateClientData( void )
m_fInitHUD = FALSE;
gInitHUD = FALSE;
MESSAGE_BEGIN( MSG_ONE, gmsgResetHUD, NULL, pev );
MESSAGE_BEGIN( MSG_ONE, gmsg.ResetHUD, NULL, pev );
WRITE_BYTE( 0 );
MESSAGE_END();
if ( !m_fGameHUDInitialized )
{
MESSAGE_BEGIN( MSG_ONE, gmsgInitHUD, NULL, pev );
MESSAGE_BEGIN( MSG_ONE, gmsg.InitHUD, NULL, pev );
MESSAGE_END();
g_pGameRules->InitHUD( this );
@ -4244,7 +4244,7 @@ void CBasePlayer :: UpdateClientData( void )
if ( m_iHideHUD != m_iClientHideHUD )
{
MESSAGE_BEGIN( MSG_ONE, gmsgHideWeapon, NULL, pev );
MESSAGE_BEGIN( MSG_ONE, gmsg.HideWeapon, NULL, pev );
WRITE_BYTE( m_iHideHUD );
MESSAGE_END();
@ -4253,7 +4253,7 @@ void CBasePlayer :: UpdateClientData( void )
if ( m_iFOV != m_iClientFOV )
{
MESSAGE_BEGIN( MSG_ONE, gmsgSetFOV, NULL, pev );
MESSAGE_BEGIN( MSG_ONE, gmsg.SetFOV, NULL, pev );
WRITE_BYTE( m_iFOV );
MESSAGE_END();
@ -4272,7 +4272,7 @@ void CBasePlayer :: UpdateClientData( void )
viewFlags = 0; //clear possibly ACTIVE flag
}
MESSAGE_BEGIN(MSG_ONE, gmsgCamData, NULL, pev);
MESSAGE_BEGIN(MSG_ONE, gmsg.CamData, NULL, pev);
WRITE_SHORT( indexToSend );
WRITE_SHORT( viewFlags );
MESSAGE_END();
@ -4280,19 +4280,19 @@ void CBasePlayer :: UpdateClientData( void )
viewNeedsUpdate = 0;
}
if( hearNeedsUpdate != 0)
if( hearNeedsUpdate != 0 )
{
//update dsp sound
MESSAGE_BEGIN( MSG_ONE, SVC_ROOMTYPE, NULL, pev );
// update dsp sound
MESSAGE_BEGIN( MSG_ONE, gmsg.RoomType, NULL, pev );
WRITE_SHORT( m_iSndRoomtype );
MESSAGE_END();
hearNeedsUpdate = 0;
}
if(fadeNeedsUpdate != 0)
if( fadeNeedsUpdate != 0 )
{
//update screenfade
MESSAGE_BEGIN( MSG_ONE, gmsgFade, NULL, pev );
// update screenfade
MESSAGE_BEGIN( MSG_ONE, gmsg.Fade, NULL, pev );
WRITE_SHORT( FixedUnsigned16( m_iFadeTime, 1<<12 ));
WRITE_SHORT( FixedUnsigned16( m_iFadeHold, 1<<12 ));
WRITE_SHORT( m_iFadeFlags ); // fade flags
@ -4332,7 +4332,7 @@ void CBasePlayer :: UpdateClientData( void )
if(fogNeedsUpdate != 0)
{
//update fog
MESSAGE_BEGIN( MSG_ONE, gmsgSetFog, NULL, pev );
MESSAGE_BEGIN( MSG_ONE, gmsg.SetFog, NULL, pev );
WRITE_BYTE ( m_FogColor.x );
WRITE_BYTE ( m_FogColor.y );
WRITE_BYTE ( m_FogColor.z );
@ -4344,7 +4344,7 @@ void CBasePlayer :: UpdateClientData( void )
if( m_iWarHUD != m_iClientWarHUD )
{
MESSAGE_BEGIN( MSG_ONE, gmsgWarHUD, NULL, pev );
MESSAGE_BEGIN( MSG_ONE, gmsg.WarHUD, NULL, pev );
WRITE_BYTE( m_iWarHUD );//make static screen
MESSAGE_END();
m_iClientWarHUD = m_iWarHUD;
@ -4355,7 +4355,7 @@ void CBasePlayer :: UpdateClientData( void )
int iHealth = max( pev->health, 0 ); // make sure that no negative health values are sent
// send "health" update message
MESSAGE_BEGIN( MSG_ONE, gmsgHealth, NULL, pev );
MESSAGE_BEGIN( MSG_ONE, gmsg.Health, NULL, pev );
WRITE_BYTE( iHealth );
MESSAGE_END();
@ -4367,9 +4367,9 @@ void CBasePlayer :: UpdateClientData( void )
{
m_iClientBattery = pev->armorvalue;
ASSERT( gmsgBattery > 0 );
ASSERT( gmsg.Battery > 0 );
// send "health" update message
MESSAGE_BEGIN( MSG_ONE, gmsgBattery, NULL, pev );
MESSAGE_BEGIN( MSG_ONE, gmsg.Battery, NULL, pev );
WRITE_SHORT( (int)pev->armorvalue);
MESSAGE_END();
}
@ -4391,7 +4391,7 @@ void CBasePlayer :: UpdateClientData( void )
// only send down damage type that have hud art
int visibleDamageBits = m_bitsDamageType & DMG_SHOWNHUD;
MESSAGE_BEGIN( MSG_ONE, gmsgDamage, NULL, pev );
MESSAGE_BEGIN( MSG_ONE, gmsg.Damage, NULL, pev );
WRITE_BYTE( pev->dmg_save );
WRITE_BYTE( pev->dmg_take );
WRITE_LONG( visibleDamageBits );
@ -4431,7 +4431,7 @@ void CBasePlayer :: UpdateClientData( void )
else m_flFlashLightTime = 0;
}
MESSAGE_BEGIN( MSG_ONE, gmsgFlashBattery, NULL, pev );
MESSAGE_BEGIN( MSG_ONE, gmsg.FlashBattery, NULL, pev );
WRITE_BYTE(m_iFlashBattery);
MESSAGE_END();
}
@ -4510,7 +4510,7 @@ void CBasePlayer :: UpdateClientData( void )
pFind = UTIL_FindEntityByClassname( pFind, "util_rainmodify" );
}
MESSAGE_BEGIN(MSG_ONE, gmsgRainData, NULL, pev);
MESSAGE_BEGIN(MSG_ONE, gmsg.RainData, NULL, pev);
WRITE_SHORT(Rain_dripsPerSecond);
WRITE_COORD(raindistance);
WRITE_COORD(Rain_windX);
@ -4527,7 +4527,8 @@ void CBasePlayer :: UpdateClientData( void )
ALERT(at_aiconsole, "Sending disabling rain message\n");
}
else
{ // no rain on this map
{
// no rain on this map
Rain_dripsPerSecond = 0;
Rain_windX = 0;
Rain_windY = 0;
@ -4540,10 +4541,7 @@ void CBasePlayer :: UpdateClientData( void )
Rain_ideal_randY = 0;
Rain_endFade = 0;
Rain_nextFadeUpdate = 0;
ALERT(at_aiconsole, "Clearing rain data\n");
}
rainNeedsUpdate = 0;
}
@ -4563,16 +4561,16 @@ void CBasePlayer :: UpdateClientData( void )
}
else m_flFlashLightTime = 0;
MESSAGE_BEGIN( MSG_ONE, gmsgFlashBattery, NULL, pev );
MESSAGE_BEGIN( MSG_ONE, gmsg.FlashBattery, NULL, pev );
WRITE_BYTE(m_iFlashBattery);
MESSAGE_END();
}
if (m_iTrain & TRAIN_NEW)
{
ASSERT( gmsgTrain > 0 );
ASSERT( gmsg.Train > 0 );
// send "health" update message
MESSAGE_BEGIN( MSG_ONE, gmsgTrain, NULL, pev );
MESSAGE_BEGIN( MSG_ONE, gmsg.Train, NULL, pev );
WRITE_BYTE(m_iTrain & 0xF);
MESSAGE_END();
@ -4613,7 +4611,7 @@ void CBasePlayer :: UpdateClientData( void )
if (!II.pszName) pszName = "Empty";
else pszName = II.pszName;
MESSAGE_BEGIN( MSG_ONE, gmsgWeaponList, NULL, pev );
MESSAGE_BEGIN( MSG_ONE, gmsg.WeaponList, NULL, pev );
WRITE_STRING(pszName); // string weapon name
WRITE_BYTE(GetAmmoIndex(II.pszAmmo1)); // byte Ammo Type
WRITE_BYTE(II.iMaxAmmo1); // byte Max Ammo 1

View File

@ -55,7 +55,7 @@
#define CSUITPLAYLIST 4 // max of 4 suit sentences queued up at any time
#define SUIT_GROUP TRUE
#define SUIT_SENTENCE FALSE
#define SUIT_SENTENCE FALSE
#define SUIT_REPEAT_OK 0
#define SUIT_NEXT_IN_30SEC 30
@ -371,12 +371,6 @@ public:
#define AUTOAIM_8DEGREES 0.1391731009601
#define AUTOAIM_10DEGREES 0.1736481776669
extern int gmsgHudText;
extern int gmsgSetBody;
extern int gmsgSetSkin;
extern int gmsgZoomHUD;
extern int gmsgWarHUD;
extern BOOL gInitHUD;
#endif // PLAYER_H

View File

@ -27,6 +27,7 @@
#include "extdll.h"
#include "utils.h"
#include "cbase.h"
#include "client.h"
#include "monsters.h"
#include "baseweapon.h"
#include "basebeams.h"
@ -974,7 +975,7 @@ void CBaseTurret :: TurretDeath( void )
if (pev->dmgtime + RANDOM_FLOAT( 0, 2 ) > gpGlobals->time)
{
// lots of smoke
MESSAGE_BEGIN( MSG_BROADCAST, SVC_TEMPENTITY );
MESSAGE_BEGIN( MSG_BROADCAST, gmsg.TempEntity );
WRITE_BYTE( TE_SMOKE );
WRITE_COORD( RANDOM_FLOAT( pev->absmin.x, pev->absmax.x ) );
WRITE_COORD( RANDOM_FLOAT( pev->absmin.y, pev->absmax.y ) );
@ -1310,7 +1311,7 @@ void CSentry :: SentryDeath( void )
if (pev->dmgtime + RANDOM_FLOAT( 0, 2 ) > gpGlobals->time)
{
// lots of smoke
MESSAGE_BEGIN( MSG_BROADCAST, SVC_TEMPENTITY );
MESSAGE_BEGIN( MSG_BROADCAST, gmsg.TempEntity );
WRITE_BYTE( TE_SMOKE );
WRITE_COORD( vecSrc.x + RANDOM_FLOAT( -16, 16 ) );
WRITE_COORD( vecSrc.y + RANDOM_FLOAT( -16, 16 ) );

View File

@ -25,13 +25,15 @@ Beta 13.12.08
4. release crash OK
5. timers set OK
6. AI_ -> FL_ OK
7. SVC_SOUND
7. SVC_SOUND OK
8. client.dll implementation OK
9. HookUserMessages OK
10.remove SVC_* in utils.h OK
11.Load server.dll and client.dll only once OK
12.v_refdef interactions
entity_state_t невидима для пользователя
edict_t - существует только на сервере
Список доступных рендереров: Что в них интересного
0. Q3Fusion (Mirrors, Portals)