02 Jul 2008

This commit is contained in:
g-cont 2008-07-02 00:00:00 +04:00 committed by Alibek Omarov
parent 95aa92c67d
commit 388c9c67fb
14 changed files with 198 additions and 155 deletions

View File

@ -31,9 +31,10 @@ void CL_WriteDemoMessage( void )
void CL_WriteDemoHeader( const char *name )
{
char buf_data[MAX_MSGLEN];
entity_state_t *ent, nullstate;
int i, len;
entity_state_t *state, nullstate;
edict_t *ent;
sizebuf_t buf;
int i, len;
MsgDev(D_INFO, "recording to %s.\n", name );
cls.demofile = FS_Open( name, "wb" );
@ -78,13 +79,16 @@ void CL_WriteDemoHeader( const char *name )
}
CL_VM_Begin();
// baselines
memset(&nullstate, 0, sizeof(nullstate));
for( i = 0; i < MAX_EDICTS; i++ )
for( i = 0; i < prog->num_edicts; i++ )
{
ent = &cl_entities[i].baseline;
if(!ent->modelindex) continue;
ent = PRVM_EDICT_NUM( i );
state = &ent->priv.cl->baseline;
if(!state->modelindex) continue;
if( buf.cursize + 64 > buf.maxsize )
{
@ -94,8 +98,8 @@ void CL_WriteDemoHeader( const char *name )
FS_Write( cls.demofile, buf.data, buf.cursize );
buf.cursize = 0;
}
MSG_WriteByte (&buf, svc_spawnbaseline);
MSG_WriteDeltaEntity (&nullstate, &cl_entities[i].baseline, &buf, true, true);
MSG_WriteByte( &buf, svc_spawnbaseline );
MSG_WriteDeltaEntity (&nullstate, &ent->priv.cl->baseline, &buf, true, true);
}
MSG_WriteByte( &buf, svc_stufftext );
@ -105,6 +109,8 @@ void CL_WriteDemoHeader( const char *name )
len = LittleLong( buf.cursize );
FS_Write( cls.demofile, &len, 4 );
FS_Write( cls.demofile, buf.data, buf.cursize );
CL_VM_End();
}
/*

View File

@ -11,6 +11,7 @@ struct cl_edict_s
bool free;
float freetime; // cl.time when the object was freed
int serverframe; // if not current, this ent isn't in the frame
int serialnumber; // client serialnumber
// cl_private_edict_t
entity_state_t baseline; // delta from this if not from a previous frame
@ -24,38 +25,38 @@ struct cl_globalvars_s
int pev;
int world;
string_t mapname;
float realtime;
float frametime;
vec3_t vieworg;
vec3_t viewangles;
vec3_t v_forward;
vec3_t v_right;
vec3_t v_up;
float realtime;
float frametime;
float onground;
float waterlevel;
float clientflags;
float intermission;
float paused;
float playernum;
vec3_t simvel;
vec3_t simorg;
vec3_t cl_viewangles;
float idealpitch;
vec3_t viewheight;
vec3_t cl_viewangles;
float intermission;
float max_entities;
float maxclients;
float paused;
float health;
vec3_t punchangle;
vec3_t crosshairangle;
float smoothing;
float maxclients;
int viewentity;
float playernum;
float smoothing;
float demoplayback;
vec3_t blend_color;
float blend_alpha;
float screen_x;
float screen_y;
float screen_w;
float screen_h;
vec3_t blend_color;
float blend_alpha;
float max_entities;
func_t HUD_Init;
func_t HUD_StudioEvent;
func_t HUD_ParseMessage;
@ -70,6 +71,15 @@ struct cl_entvars_s
string_t classname;
int chain;
string_t model;
float modelindex;
float soundindex;
vec3_t origin;
vec3_t angles;
float sequence;
float effects;
float frame;
float body;
float skin;
};
@ -77,7 +87,7 @@ struct cl_entvars_s
static fields_t cl_reqfields[] =
{
{3, 2, "flags"}
{16, 2, "flags"}
};
#endif//CL_EDICT_H

View File

@ -93,10 +93,10 @@ to the current frame
*/
void CL_DeltaEntity( sizebuf_t *msg, frame_t *frame, int newnum, entity_state_t *old, int bits )
{
centity_t *ent;
edict_t *ent;
entity_state_t *state;
ent = &cl_entities[newnum];
ent = PRVM_EDICT_NUM( newnum );
state = &cl_parse_entities[cl.parse_entities & (MAX_PARSE_ENTITIES-1)];
cl.parse_entities++;
@ -105,26 +105,26 @@ void CL_DeltaEntity( sizebuf_t *msg, frame_t *frame, int newnum, entity_state_t
MSG_ReadDeltaEntity( msg, old, state, newnum, bits );
// some data changes will force no lerping
if (state->modelindex != ent->current.modelindex || state->weaponmodel != ent->current.weaponmodel || state->body != ent->current.body
|| state->sequence != ent->current.sequence || abs(state->origin[0] - ent->current.origin[0]) > 512
|| abs(state->origin[1] - ent->current.origin[1]) > 512 || abs(state->origin[2] - ent->current.origin[2]) > 512 )
if( state->modelindex != ent->priv.cl->current.modelindex || state->weaponmodel != ent->priv.cl->current.weaponmodel || state->body != ent->priv.cl->current.body
|| state->sequence != ent->priv.cl->current.sequence || abs(state->origin[0] - ent->priv.cl->current.origin[0]) > 512
|| abs(state->origin[1] - ent->priv.cl->current.origin[1]) > 512 || abs(state->origin[2] - ent->priv.cl->current.origin[2]) > 512 )
{
ent->serverframe = -99;
ent->priv.cl->serverframe = -99;
}
if( ent->serverframe != cl.frame.serverframe - 1 )
if( ent->priv.cl->serverframe != cl.frame.serverframe - 1 )
{
// duplicate the current state so lerping doesn't hurt anything
ent->prev = *state;
VectorCopy (state->old_origin, ent->prev.origin);
ent->priv.cl->prev = *state;
VectorCopy (state->old_origin, ent->priv.cl->prev.origin);
}
else
{ // shuffle the last state to previous
ent->prev = ent->current;
ent->priv.cl->prev = ent->priv.cl->current;
}
ent->serverframe = cl.frame.serverframe;
ent->current = *state;
ent->priv.cl->serverframe = cl.frame.serverframe;
ent->priv.cl->current = *state;
}
/*
@ -230,7 +230,8 @@ void CL_ParsePacketEntities( sizebuf_t *msg, frame_t *oldframe, frame_t *newfram
if( oldnum > newnum )
{
// delta from baseline
CL_DeltaEntity( msg, newframe, newnum, &cl_entities[newnum].baseline, bits );
edict_t *ent = PRVM_EDICT_NUM( newnum );
CL_DeltaEntity( msg, newframe, newnum, &ent->priv.cl->baseline, bits );
continue;
}
@ -470,11 +471,11 @@ CL_AddPacketEntities
*/
void CL_AddPacketEntities( frame_t *frame )
{
entity_t ent;
entity_t refent;
entity_state_t *s1;
float autorotate;
int i, pnum;
centity_t *cent;
edict_t *ent;
int autoanim;
uint effects, renderfx;
@ -484,58 +485,63 @@ void CL_AddPacketEntities( frame_t *frame )
// brush models can auto animate their frames
autoanim = 2 * cl.time/1000;
memset( &ent, 0, sizeof(ent));
memset( &refent, 0, sizeof(refent));
for( pnum = 0; pnum < frame->num_entities; pnum++ )
{
s1 = &cl_parse_entities[(frame->parse_entities+pnum)&(MAX_PARSE_ENTITIES-1)];
cent = &cl_entities[s1->number];
ent = PRVM_EDICT_NUM( s1->number );
effects = s1->effects;
renderfx = s1->renderfx;
ent.frame = s1->frame;
refent.frame = s1->frame;
// copy state to progs
ent->progs.cl->modelindex = ent->priv.cl->current.modelindex;
ent->progs.cl->soundindex = ent->priv.cl->current.soundindex;
//ent->progs.cl->model = PRVM_SetEngineString( cl.configstrings[CS_MODELS+ent->priv.cl->current.modelindex] );
// copy state to render
ent.prev.frame = cent->prev.frame;
ent.backlerp = 1.0 - cl.lerpfrac;
ent.alpha = s1->alpha;
ent.body = s1->body;
ent.sequence = s1->sequence;
ent.animtime = s1->animtime;
refent.prev.frame = ent->priv.cl->prev.frame;
refent.backlerp = 1.0 - cl.lerpfrac;
refent.alpha = s1->alpha;
refent.body = s1->body;
refent.sequence = s1->sequence;
refent.animtime = s1->animtime;
// interpolate origin
for( i = 0; i < 3; i++ )
{
ent.origin[i] = LerpPoint( cent->prev.origin[i], cent->current.origin[i], cl.lerpfrac );
ent.oldorigin[i] = ent.origin[i];
refent.origin[i] = LerpPoint( ent->priv.cl->prev.origin[i], ent->priv.cl->current.origin[i], cl.lerpfrac );
refent.oldorigin[i] = refent.origin[i];
}
// set skin
ent.skin = s1->skin;
ent.model = cl.model_draw[s1->modelindex];
ent.flags = renderfx;
refent.skin = s1->skin;
refent.model = cl.model_draw[s1->modelindex];
refent.flags = renderfx;
// calculate angles
if( effects & EF_ROTATE )
{
// some bonus items auto-rotate
ent.angles[0] = 0;
ent.angles[1] = autorotate;
ent.angles[2] = 0;
refent.angles[0] = 0;
refent.angles[1] = autorotate;
refent.angles[2] = 0;
}
else
{
// interpolate angles
for( i = 0; i < 3; i++ )
{
ent.angles[i] = LerpAngle( cent->prev.angles[i], cent->current.angles[i], cl.lerpfrac );
refent.angles[i] = LerpAngle( ent->priv.cl->prev.angles[i], ent->priv.cl->current.angles[i], cl.lerpfrac );
}
}
if( s1->number == cl.playernum + 1 )
{
ent.flags |= RF_PLAYERMODEL; // only draw from mirrors
refent.flags |= RF_PLAYERMODEL; // only draw from mirrors
continue;
}
@ -543,19 +549,19 @@ void CL_AddPacketEntities( frame_t *frame )
if( !s1->modelindex ) continue;
// add to refresh list
V_AddEntity( &ent );
V_AddEntity( &refent );
ent.skin = 0;
ent.flags = 0;
ent.alpha = 0;
refent.skin = 0;
refent.flags = 0;
refent.alpha = 0;
// duplicate for linked models
if( s1->weaponmodel )
{
ent.model = cl.model_draw[s1->weaponmodel];
V_AddEntity (&ent);
ent.flags = 0;
ent.alpha = 0;
refent.model = cl.model_draw[s1->weaponmodel];
V_AddEntity (&refent);
refent.flags = 0;
refent.alpha = 0;
}
}
}
@ -617,7 +623,6 @@ void CL_CalcViewValues( void )
{
int i;
float lerp, backlerp;
centity_t *ent;
frame_t *oldframe;
player_state_t *ps, *ops;
@ -633,7 +638,6 @@ void CL_CalcViewValues( void )
if( fabs(ops->origin[0] - ps->origin[0]) > 2048 || fabs(ops->origin[1] - ps->origin[1]) > 2048 || fabs(ops->origin[2] - ps->origin[2]) > 2048)
ops = ps; // don't interpolate
ent = &cl_entities[cl.playernum + 1];
lerp = cl.lerpfrac;
// calculate the origin
@ -727,35 +731,35 @@ void CL_AddEntities( void )
// sound engine implementation
//
void CL_GetEntitySoundSpatialization( int ent, vec3_t origin, vec3_t velocity )
void CL_GetEntitySoundSpatialization( int entnum, vec3_t origin, vec3_t velocity )
{
centity_t *cent;
edict_t *ent;
cmodel_t *cmodel;
vec3_t midPoint;
if( ent < 0 || ent >= MAX_EDICTS )
if( entnum < 0 || entnum >= MAX_EDICTS )
{
MsgDev( D_ERROR, "CL_GetEntitySoundSpatialization: invalid entnum", ent );
MsgDev( D_ERROR, "CL_GetEntitySoundSpatialization: invalid entnum %d\n", entnum );
VectorCopy( vec3_origin, origin );
VectorCopy( vec3_origin, velocity );
return;
}
cent = &cl_entities[ent];
ent = PRVM_EDICT_NUM( entnum );
// calculate origin
origin[0] = cent->prev.origin[0] + (cent->current.origin[0] - cent->prev.origin[0]) * cl.lerpfrac;
origin[1] = cent->prev.origin[1] + (cent->current.origin[1] - cent->prev.origin[1]) * cl.lerpfrac;
origin[2] = cent->prev.origin[2] + (cent->current.origin[2] - cent->prev.origin[2]) * cl.lerpfrac;
origin[0] = ent->priv.cl->prev.origin[0] + (ent->priv.cl->current.origin[0] - ent->priv.cl->prev.origin[0]) * cl.lerpfrac;
origin[1] = ent->priv.cl->prev.origin[1] + (ent->priv.cl->current.origin[1] - ent->priv.cl->prev.origin[1]) * cl.lerpfrac;
origin[2] = ent->priv.cl->prev.origin[2] + (ent->priv.cl->current.origin[2] - ent->priv.cl->prev.origin[2]) * cl.lerpfrac;
// calculate velocity
VectorSubtract(cent->current.origin, cent->prev.origin, velocity);
VectorSubtract( ent->priv.cl->current.origin, ent->priv.cl->prev.origin, velocity);
VectorScale(velocity, 10, velocity);
// if a brush model, offset the origin
if( VectorIsNull( origin ))
{
cmodel = cl.model_clip[cent->current.modelindex];
cmodel = cl.model_clip[ent->priv.cl->current.modelindex];
if(!cmodel) return;
VectorAverage(cmodel->mins, cmodel->maxs, midPoint);
VectorAdd(origin, midPoint, origin);

View File

@ -70,8 +70,6 @@ cvar_t *cl_vwep;
client_static_t cls;
client_t cl;
centity_t cl_entities[MAX_EDICTS];
entity_state_t cl_parse_entities[MAX_PARSE_ENTITIES];
extern cvar_t *allow_download;
@ -355,10 +353,10 @@ void CL_ClearState (void)
{
S_StopAllSounds ();
CL_ClearEffects ();
CL_FreeEdicts();
// wipe the entire cl structure
memset (&cl, 0, sizeof(cl));
memset (&cl_entities, 0, sizeof(cl_entities));
SZ_Clear (&cls.netchan.message);
}
@ -1430,6 +1428,9 @@ void CL_Frame( float time )
// if in the debugger last frame, don't timeout
if (time > 5.0f) cls.netchan.last_received = host.realtime;
// setup the VM frame
CL_VM_Begin();
// fetch results from server
CL_ReadPackets();
@ -1456,6 +1457,9 @@ void CL_Frame( float time )
SCR_RunCinematic();
Con_RunConsole();
// end the client VM frame
CL_VM_End();
cls.framecount++;
}
@ -1504,6 +1508,7 @@ void CL_Shutdown(void)
CL_WriteConfiguration();
CL_FreeClientProgs();
UI_Shutdown();
S_Shutdown();
CL_ShutdownInput();
}

View File

@ -21,21 +21,26 @@ static char *creditsBuffer;
static uint credit_numlines;
static bool credits_active;
void UI_VM_Begin( void )
{
PRVM_Begin;
PRVM_SetProg(PRVM_MENUPROG);
// set time
if( prog ) *prog->time = cls.realtime;
}
void UI_KeyEvent( int key )
{
const char *ascii = Key_KeynumToString(key);
PRVM_Begin;
PRVM_SetProg( PRVM_MENUPROG );
// set time
*prog->time = cls.realtime;
UI_VM_Begin();
// setup args
PRVM_G_FLOAT(OFS_PARM0) = key;
PRVM_G_INT(OFS_PARM1) = PRVM_SetEngineString(ascii);
PRVM_ExecuteProgram (prog->globals.ui->m_keydown, "QC function m_keydown is missing");
PRVM_End;
CL_VM_Begin(); // restore clvm state
}
void UI_Draw( void )
@ -43,15 +48,12 @@ void UI_Draw( void )
if( !ui_active || cls.key_dest != key_menu )
return;
PRVM_Begin;
PRVM_SetProg(PRVM_MENUPROG);
// set time
*prog->time = cls.realtime;
UI_VM_Begin();
PRVM_ExecuteProgram (prog->globals.ui->m_draw, "QC function m_draw is missing");
UI_DrawCredits(); // display game credits
PRVM_End;
CL_VM_Begin(); // restore clvm state
}
void UI_DrawCredits( void )
@ -90,14 +92,11 @@ void UI_DrawCredits( void )
void UI_ShowMenu( void )
{
PRVM_Begin;
PRVM_SetProg(PRVM_MENUPROG);
UI_VM_Begin();
// set time
*prog->time = cls.realtime;
ui_active = true;
PRVM_ExecuteProgram (prog->globals.ui->m_show, "QC function m_toggle is missing");
PRVM_End;
CL_VM_Begin(); // restore clvm state
}
void UI_HideMenu( void )
@ -105,28 +104,18 @@ void UI_HideMenu( void )
cls.key_dest = key_game;
Key_ClearStates();
PRVM_Begin;
PRVM_SetProg(PRVM_MENUPROG);
// set time
*prog->time = cls.realtime;
UI_VM_Begin();
ui_active = false;
prog->globals.ui->time = cls.realtime;
PRVM_ExecuteProgram (prog->globals.ui->m_hide, "QC function m_toggle is missing");
PRVM_End;
CL_VM_Begin(); // restore clvm state
}
void UI_Shutdown( void )
{
PRVM_Begin;
PRVM_SetProg(PRVM_MENUPROG);
// set time
//*prog->time = cls.realtime;
UI_VM_Begin();
PRVM_ExecuteProgram (prog->globals.ui->m_shutdown, "QC function m_shutdown is missing");
// reset key_dest
cls.key_dest = key_game;
// AK not using this cause Im not sure whether this is useful at all instead :

View File

@ -309,16 +309,19 @@ CL_ParseBaseline
*/
void CL_ParseBaseline( sizebuf_t *msg )
{
entity_state_t *es;
int bits;
int newnum;
entity_state_t nullstate;
edict_t *ent;
memset (&nullstate, 0, sizeof(nullstate));
newnum = CL_ParseEntityBits( msg, &bits );
es = &cl_entities[newnum].baseline;
MSG_ReadDeltaEntity( msg, &nullstate, es, newnum, bits);
// allocate edicts
while( newnum >= prog->num_edicts ) PRVM_ED_Alloc();
ent = PRVM_EDICT_NUM( newnum );
MSG_ReadDeltaEntity( msg, &nullstate, &ent->priv.cl->baseline, newnum, bits );
}

View File

@ -52,11 +52,7 @@ float *CL_FadeColor( float starttime, float endtime )
void CL_DrawHUD( void )
{
PRVM_Begin;
PRVM_SetProg( PRVM_CLIENTPROG );
// set time
*prog->time = cls.realtime;
if(!prog) return; // too early (just skip one frame)
// setup pparms
prog->globals.cl->health = cl.frame.playerstate.stats[STAT_HEALTH];
@ -67,20 +63,12 @@ void CL_DrawHUD( void )
// setup args
PRVM_G_FLOAT(OFS_PARM0) = (float)cls.state;
PRVM_ExecuteProgram (prog->globals.cl->HUD_Render, "QC function HUD_Render is missing");
PRVM_End;
}
bool CL_ParseUserMessage( int svc_number )
{
bool msg_parsed = false;
PRVM_Begin;
PRVM_SetProg( PRVM_CLIENTPROG );
// set time
*prog->time = cls.realtime;
// setup pparms
prog->globals.cl->health = cl.frame.playerstate.stats[STAT_HEALTH];
prog->globals.cl->maxclients = com.atoi(cl.configstrings[CS_MAXCLIENTS]);
@ -91,7 +79,6 @@ bool CL_ParseUserMessage( int svc_number )
PRVM_G_FLOAT(OFS_PARM0) = (float)svc_number;
PRVM_ExecuteProgram (prog->globals.cl->HUD_ParseMessage, "QC function HUD_ParseMessage is missing");
msg_parsed = PRVM_G_FLOAT(OFS_RETURN);
PRVM_End;
return msg_parsed;
}
@ -105,19 +92,12 @@ Event callback for studio models
*/
void CL_StudioEvent ( mstudioevent_t *event, entity_t *ent )
{
PRVM_Begin;
PRVM_SetProg( PRVM_CLIENTPROG );
// set time
*prog->time = cls.realtime;
// setup args
PRVM_G_FLOAT(OFS_PARM0) = (float)event->event;
PRVM_G_INT(OFS_PARM1) = PRVM_SetEngineString( event->options );
VectorCopy( ent->origin, PRVM_G_VECTOR(OFS_PARM2));
VectorCopy( ent->angles, PRVM_G_VECTOR(OFS_PARM3));
PRVM_ExecuteProgram( prog->globals.cl->HUD_StudioEvent, "QC function HUD_StudioEvent is missing");
PRVM_End;
}
/*
@ -127,36 +107,72 @@ Client Builtin Functions
mathlib, debugger, and various misc helpers
===============================================================================
*/
void CL_BeginIncreaseEdicts( void )
{
int i;
edict_t *ent;
// links don't survive the transition, so unlink everything
for (i = 0, ent = prog->edicts; i < prog->max_edicts; i++, ent++)
{
}
}
void CL_EndIncreaseEdicts( void )
{
int i;
edict_t *ent;
for (i = 0, ent = prog->edicts; i < prog->max_edicts; i++, ent++)
{
}
}
void CL_InitEdict( edict_t *e )
{
e->priv.cl->serialnumber = PRVM_NUM_FOR_EDICT(e);
e->priv.cl->free = false;
}
void CL_FreeEdict( edict_t *ed )
{
ed->priv.cl->freetime = cl.time;
ed->priv.cl->free = true;
ed->progs.cl->model = 0;
ed->progs.cl->modelindex = 0;
ed->progs.cl->soundindex = 0;
ed->progs.cl->skin = 0;
ed->progs.cl->frame = 0;
VectorClear(ed->progs.cl->origin);
VectorClear(ed->progs.cl->angles);
}
void CL_FreeEdicts( void )
{
int i;
edict_t *ent;
CL_VM_Begin();
for( i = 1; prog && i < prog->num_edicts; i++ )
{
ent = PRVM_EDICT_NUM(i);
CL_FreeEdict( ent );
}
CL_VM_End();
}
void CL_CountEdicts( void )
{
int i;
edict_t *ent;
int active = 0, models = 0;
int i, active = 0, models = 0;
for (i = 0; i < prog->num_edicts; i++ )
for (i = 0; i < prog->num_edicts; i++)
{
ent = PRVM_EDICT_NUM(i);
if( ent->priv.cl->free ) continue;
if (ent->priv.cl->free) continue;
active++;
if (ent->progs.cl->model) models++;
}
Msg("num_edicts:%3i\n", prog->num_edicts);
@ -585,8 +601,7 @@ void CL_InitClientProgs( void )
prog->builtins = vm_cl_builtins;
prog->numbuiltins = vm_cl_numbuiltins;
prog->edictprivate_size = sizeof(cl_edict_t);
prog->num_edicts = 1;
prog->max_edicts = 512;
prog->max_edicts = MAX_EDICTS<<2;
prog->limit_edicts = MAX_EDICTS;
prog->begin_increase_edicts = CL_BeginIncreaseEdicts;
prog->end_increase_edicts = CL_EndIncreaseEdicts;

View File

@ -280,6 +280,7 @@ void SCR_UpdateScreen( void )
Host_Error("SCR_UpdateScreen: bad cls.state" );
break;
}
V_PostRender();
}

View File

@ -407,6 +407,7 @@ void V_RenderView( void )
// build a refresh entity list and calc cl.sim*
// this also calls CL_CalcViewValues which loads
// v_forward, etc.
CL_VM_Begin();
CL_AddEntities ();
if (cl_testparticles->value)

View File

@ -53,15 +53,6 @@ typedef struct field_s
int maxchars; // menu stuff
} field_t;
typedef struct
{
entity_state_t baseline; // delta from this if not from a previous frame
entity_state_t current;
entity_state_t prev; // will always be valid, but might just be a copy of current
int serverframe; // if not current, this ent isn't in the frame
} centity_t;
#define MAX_CLIENTWEAPONMODELS 20 // PGM -- upped from 16 to fit the chainfist vwep
typedef struct
@ -318,7 +309,6 @@ typedef struct
float minlight; // don't add when contributing less
} cdlight_t;
extern centity_t cl_entities[MAX_EDICTS];
extern cdlight_t cl_dlights[MAX_DLIGHTS];
// the cl_parse_entities must be large enough to hold UPDATE_BACKUP frames of
@ -477,8 +467,24 @@ void CL_Stop_f( void );
void CL_InitClientProgs( void );
void CL_FreeClientProgs( void );
void CL_DrawHUD( void );
edict_t *CL_GetEdict( int entnum );
float *CL_FadeColor( float starttime, float endtime );
bool CL_ParseUserMessage( int svc_number );
void CL_FreeEdicts( void );
void CL_VM_Begin( void );
void CL_VM_End( void );
_inline edict_t *CLVM_EDICT_NUM( int entnum )
{
edict_t *ent;
while( entnum >= prog->max_edicts ) PRVM_MEM_IncreaseEdicts();
ent = PRVM_EDICT_NUM( entnum );
memset(ent->progs.cl, 0, prog->progs->entityfields * 4);
ent->priv.cl->free = false;
return ent;
}
//
// cl_sound.c

View File

@ -224,12 +224,14 @@ PRVM INTERACTIONS
==============================================================
*/
#define prog vm->prog // global callback to vprogs.dll
#define PRVM_EDICT_NUM( num ) _PRVM_EDICT_NUM( num, __FILE__, __LINE__ )
_inline edict_t *PRVM_EDICT_NUM( int n )
_inline edict_t *_PRVM_EDICT_NUM( int n, const char * file, const int line )
{
if(!prog) Host_Error(" prog unset at (%s:%d)\n", file, line );
if((n >= 0) && (n < prog->max_edicts))
return prog->edicts + n;
prog->error_cmd( "PRVM_EDICT_NUM: %s: bad number %i (called at %s:%i)\n", prog->name, n, __FILE__, __LINE__ );
prog->error_cmd( "PRVM_EDICT_NUM: %s: bad number %i (called at %s:%i)\n", prog->name, n, file, line );
return NULL;
}

View File

@ -71,5 +71,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 -dev 3 -debug -log +map walk_test
quake.exe -game tmpQuArK -dev 3 -debug -log +map start
:done

View File

@ -24,8 +24,9 @@ fopen
1. Èìïîðò cg_user.c â client.dat OK
2. Ïîääåðæêà êàñòîìíûõ ìåññàã OK
3. Óïîðÿäî÷èòü svc_ ìåññàãè OK
4. Вырезать все клиентские эффекты
5. Создать cl_edict_s
4. Вырезать все клиентские эффекты OK
5. Создать cl_edict_s OK
6. Отладить новые клиентские энтити
Ôèçèêà èãðîêà:

View File

@ -24,7 +24,7 @@ extern int prvm_developer;
#define Host_Error com.error
#define PROG_CRC_SERVER 5103
#define PROG_CRC_CLIENT 1652
#define PROG_CRC_CLIENT 9488
#define PROG_CRC_UIMENU 2460
enum op_state