30 Oct 2007

This commit is contained in:
g-cont 2007-10-30 00:00:00 +03:00 committed by Alibek Omarov
parent 09ec4b16ca
commit ebad9fb8ac
24 changed files with 511 additions and 898 deletions

View File

@ -1,11 +1,12 @@
Наблюдения:
Винда неадекватно реагирует на исполняемые файлы с именем setup.exe (какой-то набор умолчаний - см BC)
Ньютон - это просто пипец какой-то. С версии 1.3 до 1.53 левостороняя система координат сменилась на правую.
Коллижен менеджер (который фейсы добавляет) на версии 1.53 вылетает при парсинге base1.bsp почему-то.
Разработать концепцию языка VirtualC\VirtualC++ (базируется на QuakeC)
представить func_t как структуру(возвращаемые значения и аргументы)
1. Переработать сетевой протокол для больших пространств
2. Переписать игровой таймер
1. Перенести сетевой протокол из ку3
Quake1 Quake2

View File

@ -231,60 +231,6 @@ int CL_ParseEntityBits (uint *bits)
return number;
}
/*
==================
CL_ParseDelta
Can go from either a baseline or a previous packet_entity
==================
*/
void CL_ParseDelta (entity_state_t *from, entity_state_t *to, int number, int bits)
{
// set everything to the state we are delta'ing from
*to = *from;
VectorCopy (from->origin, to->old_origin);
to->number = number;
if (bits & U_MODEL) to->modelindex = MSG_ReadByte (&net_message);
if (bits & U_WEAPONMODEL) to->weaponmodel = MSG_ReadByte (&net_message);
if (bits & U_FRAME8 ) to->frame = MSG_ReadByte (&net_message);
if (bits & U_FRAME16) to->frame = MSG_ReadShort (&net_message);
if (bits & U_SKIN8 ) to->skin = MSG_ReadByte(&net_message);
if (bits & U_SKIN16) to->skin = MSG_ReadShort(&net_message);
if ( (bits & (U_EFFECTS8|U_EFFECTS16)) == (U_EFFECTS8|U_EFFECTS16) )
to->effects = MSG_ReadLong(&net_message);
else if (bits & U_EFFECTS8 ) to->effects = MSG_ReadByte(&net_message);
else if (bits & U_EFFECTS16) to->effects = MSG_ReadShort(&net_message);
if ( (bits & (U_RENDERFX8|U_RENDERFX16)) == (U_RENDERFX8|U_RENDERFX16) )
to->renderfx = MSG_ReadLong(&net_message);
else if (bits & U_RENDERFX8 ) to->renderfx = MSG_ReadByte(&net_message);
else if (bits & U_RENDERFX16) to->renderfx = MSG_ReadShort(&net_message);
if (bits & U_ORIGIN1) to->origin[0] = MSG_ReadCoord (&net_message);
if (bits & U_ORIGIN2) to->origin[1] = MSG_ReadCoord (&net_message);
if (bits & U_ORIGIN3) to->origin[2] = MSG_ReadCoord (&net_message);
if (bits & U_ANGLE1) to->angles[0] = MSG_ReadAngle(&net_message);
if (bits & U_ANGLE2) to->angles[1] = MSG_ReadAngle(&net_message);
if (bits & U_ANGLE3) to->angles[2] = MSG_ReadAngle(&net_message);
if (bits & U_OLDORIGIN) MSG_ReadPos (&net_message, to->old_origin);
if (bits & U_SEQUENCE) to->sequence = MSG_ReadByte (&net_message);
if (bits & U_SOLID) to->solid = MSG_ReadShort (&net_message);
if (bits & U_ALPHA) to->alpha = MSG_ReadFloat (&net_message);
if (bits & U_EVENT) to->event = MSG_ReadByte (&net_message);
if (bits & U_SOUNDIDX) to->soundindex = MSG_ReadByte (&net_message);
else to->event = 0;
if (bits & U_BODY) to->body = MSG_ReadByte (&net_message);
}
/*
==================
CL_DeltaEntity
@ -304,7 +250,7 @@ void CL_DeltaEntity (frame_t *frame, int newnum, entity_state_t *old, int bits)
cl.parse_entities++;
frame->num_entities++;
CL_ParseDelta (old, state, newnum, bits);
MSG_ReadDeltaEntity(old, state, newnum, bits);
// some data changes will force no lerping
if (state->modelindex != ent->current.modelindex
@ -495,48 +441,18 @@ void CL_ParsePlayerstate (frame_t *oldframe, frame_t *newframe)
flags = MSG_ReadLong(&net_message);//four bytes
//
// parse the pmove_state_t
//
if (flags & PS_M_TYPE)
state->pmove.pm_type = MSG_ReadByte (&net_message);
if (flags & PS_M_TYPE) state->pmove.pm_type = MSG_ReadByte (&net_message);
if (flags & PS_M_ORIGIN) MSG_ReadPos32(&net_message, state->pmove.origin );
if (flags & PS_M_VELOCITY) MSG_ReadPos32(&net_message, state->pmove.velocity );
if (flags & PS_M_TIME) state->pmove.pm_time = MSG_ReadByte (&net_message);
if (flags & PS_M_FLAGS) state->pmove.pm_flags = MSG_ReadByte (&net_message);
if (flags & PS_M_GRAVITY) state->pmove.gravity = MSG_ReadShort (&net_message);
if (flags & PS_M_DELTA_ANGLES) MSG_ReadPos32(&net_message, state->pmove.delta_angles );
if (flags & PS_M_ORIGIN)
{
state->pmove.origin[0] = MSG_ReadShort (&net_message);
state->pmove.origin[1] = MSG_ReadShort (&net_message);
state->pmove.origin[2] = MSG_ReadShort (&net_message);
}
if (cl.attractloop) state->pmove.pm_type = PM_FREEZE; // demo playback
if (flags & PS_M_VELOCITY)
{
state->pmove.velocity[0] = MSG_ReadShort (&net_message);
state->pmove.velocity[1] = MSG_ReadShort (&net_message);
state->pmove.velocity[2] = MSG_ReadShort (&net_message);
}
if (flags & PS_M_TIME)
state->pmove.pm_time = MSG_ReadByte (&net_message);
if (flags & PS_M_FLAGS)
state->pmove.pm_flags = MSG_ReadByte (&net_message);
if (flags & PS_M_GRAVITY)
state->pmove.gravity = MSG_ReadShort (&net_message);
if (flags & PS_M_DELTA_ANGLES)
{
state->pmove.delta_angles[0] = MSG_ReadShort (&net_message);
state->pmove.delta_angles[1] = MSG_ReadShort (&net_message);
state->pmove.delta_angles[2] = MSG_ReadShort (&net_message);
}
if (cl.attractloop)
state->pmove.pm_type = PM_FREEZE; // demo playback
//
// parse the rest of the player_state_t
//
if (flags & PS_VIEWOFFSET)
{
state->viewoffset[0] = MSG_ReadChar (&net_message) * 0.25;
@ -654,15 +570,11 @@ void CL_ParseFrame (void)
cl.frame.serverframe = MSG_ReadLong (&net_message);
cl.frame.deltaframe = MSG_ReadLong (&net_message);
cl.frame.servertime = cl.frame.serverframe*100;
cl.frame.servertime = cl.frame.serverframe * host_frametime->value;
// BIG HACK to let old demos continue to work
if (cls.serverProtocol != 26)
cl.surpressCount = MSG_ReadByte (&net_message);
if (cl_shownet->value == 3)
Msg (" frame:%i delta:%i\n", cl.frame.serverframe,
cl.frame.deltaframe);
if (cls.serverProtocol != 26) cl.surpressCount = MSG_ReadByte (&net_message);
if (cl_shownet->value == 3) Msg (" frame:%i delta:%i\n", cl.frame.serverframe, cl.frame.deltaframe);
// If the frame is delta compressed from data that we
// no longer have available, we must suck up the rest of
@ -678,7 +590,8 @@ void CL_ParseFrame (void)
{
old = &cl.frames[cl.frame.deltaframe & UPDATE_MASK];
if (!old->valid)
{ // should never happen
{
// should never happen
Msg ("Delta from invalid frame (not supposed to happen!).\n");
}
if (old->serverframe != cl.frame.deltaframe)
@ -695,10 +608,8 @@ void CL_ParseFrame (void)
}
// clamp time
if (cl.time > cl.frame.servertime)
cl.time = cl.frame.servertime;
else if (cl.time < cl.frame.servertime - 100)
cl.time = cl.frame.servertime - 100;
if (cl.time > cl.frame.servertime) cl.time = cl.frame.servertime;
else if (cl.time < cl.frame.servertime - host_frametime->value) cl.time = cl.frame.servertime - host_frametime->value;
// read areabits
len = MSG_ReadByte (&net_message);
@ -836,16 +747,11 @@ void CL_AddPacketEntities (frame_t *frame)
renderfx = s1->renderfx;
// set frame
if (effects & EF_ANIM01)
ent.frame = autoanim & 1;
else if (effects & EF_ANIM23)
ent.frame = 2 + (autoanim & 1);
else if (effects & EF_ANIM_ALL)
ent.frame = autoanim;
else if (effects & EF_ANIM_ALLFAST)
ent.frame = cl.time / 100;
else
ent.frame = s1->frame;
if (effects & EF_ANIM01) ent.frame = autoanim & 1;
else if (effects & EF_ANIM23) ent.frame = 2 + (autoanim & 1);
else if (effects & EF_ANIM_ALL) ent.frame = autoanim;
else if (effects & EF_ANIM_ALLFAST) ent.frame = cl.time / host_frametime->value;
else ent.frame = s1->frame;
// quad and pent can do different things on client
if (effects & EF_PENT)
@ -1238,31 +1144,20 @@ void CL_AddEntities (void)
cl.time = cl.frame.servertime;
cl.lerpfrac = 1.0;
}
else if (cl.time < cl.frame.servertime - 100)
else if (cl.time < cl.frame.servertime - host_frametime->value)
{
if (cl_showclamp->value)
Msg ("low clamp %i\n", cl.frame.servertime-100 - cl.time);
cl.time = cl.frame.servertime - 100;
Msg ("low clamp %i\n", cl.frame.servertime - host_frametime->value - cl.time);
cl.time = cl.frame.servertime - host_frametime->value;
cl.lerpfrac = 0;
}
else
cl.lerpfrac = 1.0 - (cl.frame.servertime - cl.time) * 0.01;
else cl.lerpfrac = 1.0 - (cl.frame.servertime - cl.time) * host_frametime->value;
if (cl_timedemo->value)
cl.lerpfrac = 1.0;
// CL_AddPacketEntities (&cl.frame);
// CL_AddTEnts ();
// CL_AddParticles ();
// CL_AddDLights ();
// CL_AddLightStyles ();
if (cl_timedemo->value) cl.lerpfrac = 1.0;
CL_CalcViewValues ();
// PMM - moved this here so the heat beam has the right values for the vieworg, and can lock the beam to the gun
CL_AddPacketEntities (&cl.frame);
#if 0
CL_AddProjectiles ();
#endif
CL_AddTEnts ();
CL_AddParticles ();
CL_AddDLights ();

View File

@ -1413,7 +1413,7 @@ void CL_InitLocal (void)
cl_autoskins = Cvar_Get ("cl_autoskins", "0", 0);
cl_predict = Cvar_Get ("cl_predict", "1", 0);
// cl_minfps = Cvar_Get ("cl_minfps", "5", 0);
cl_maxfps = Cvar_Get ("cl_maxfps", "90", 0);
cl_maxfps = Cvar_Get ("cl_maxfps", "1000", 0);
cl_upspeed = Cvar_Get ("cl_upspeed", "200", 0);
cl_forwardspeed = Cvar_Get ("cl_forwardspeed", "200", 0);
@ -1654,15 +1654,14 @@ void CL_Frame (float time)
static float extratime;
static float lasttimecalled;
if (dedicated->value)
return;
if (dedicated->value) return;
extratime += time;
if (!cl_timedemo->value)
{
if (cls.state == ca_connected && extratime < 0.1f)
return; // don't flood packets out while connecting
if (cls.state == ca_connected && extratime < 0.01f)
return; // don't flood packets out while connecting
if (extratime < 1.0f / cl_maxfps->value)
return; // framerate is too high
}
@ -1760,17 +1759,10 @@ to run quit through here before the final handoff to the sys code.
*/
void CL_Shutdown(void)
{
static bool recursive = false;
if (recursive)
{
MsgDev(D_WARN, "CL_Shutdown: recursive shutdown\n");
return;
}
recursive = true;
// already freed
if(host.state == HOST_ERROR) return;
CL_WriteConfiguration ();
S_Shutdown();
IN_Shutdown ();
VID_FreeRender();

View File

@ -346,15 +346,15 @@ CL_ParseBaseline
void CL_ParseBaseline (void)
{
entity_state_t *es;
int bits;
int newnum;
int bits;
int newnum;
entity_state_t nullstate;
memset (&nullstate, 0, sizeof(nullstate));
newnum = CL_ParseEntityBits (&bits);
es = &cl_entities[newnum].baseline;
CL_ParseDelta (&nullstate, es, newnum, bits);
MSG_ReadDeltaEntity(&nullstate, es, newnum, bits);
}
@ -544,32 +544,26 @@ CL_ParseStartSoundPacket
*/
void CL_ParseStartSoundPacket(void)
{
vec3_t pos_v;
vec3_t pos_v;
float *pos;
int channel, ent;
int sound_num;
float volume;
float attenuation;
int flags;
int channel, ent;
int sound_num;
float volume;
float attenuation;
int flags;
float ofs;
flags = MSG_ReadByte (&net_message);
sound_num = MSG_ReadByte (&net_message);
if (flags & SND_VOLUME)
volume = MSG_ReadByte (&net_message) / 255.0;
else
volume = DEFAULT_SOUND_PACKET_VOLUME;
if (flags & SND_VOLUME) volume = MSG_ReadByte (&net_message) / 255.0;
else volume = DEFAULT_SOUND_PACKET_VOLUME;
if (flags & SND_ATTENUATION)
attenuation = MSG_ReadByte (&net_message) / 64.0;
else
attenuation = DEFAULT_SOUND_PACKET_ATTENUATION;
if (flags & SND_ATTENUATION) attenuation = MSG_ReadByte (&net_message) / 64.0;
else attenuation = DEFAULT_SOUND_PACKET_ATTENUATION;
if (flags & SND_OFFSET)
ofs = MSG_ReadByte (&net_message) / 1000.0;
else
ofs = 0;
if (flags & SND_OFFSET) ofs = MSG_ReadByte (&net_message) / 1000.0;
else ofs = 0;
if (flags & SND_ENT)
{
@ -577,7 +571,6 @@ void CL_ParseStartSoundPacket(void)
channel = MSG_ReadShort(&net_message);
ent = channel>>3;
if (ent > MAX_EDICTS) Host_Error("CL_ParseStartSoundPacket: ent out of range\n" );
channel &= 7;
}
else
@ -587,25 +580,21 @@ void CL_ParseStartSoundPacket(void)
}
if (flags & SND_POS)
{ // positioned in space
MSG_ReadPos (&net_message, pos_v);
{
// positioned in space
MSG_ReadPos32(&net_message, pos_v);
pos = pos_v;
}
else // use entity number
pos = NULL;
if (!cl.sound_precache[sound_num])
return;
else pos = NULL; // use entity number
if (!cl.sound_precache[sound_num]) return;
S_StartSound (pos, ent, channel, cl.sound_precache[sound_num], volume, attenuation, ofs);
}
void SHOWNET(char *s)
{
if (cl_shownet->value>=2)
Msg ("%3i:%s\n", net_message.readcount-1, s);
if (cl_shownet->value >= 2) Msg ("%3i:%s\n", net_message.readcount-1, s);
}
/*

View File

@ -570,18 +570,14 @@ SCR_BeginLoadingPlaque
void SCR_BeginLoadingPlaque (void)
{
S_StopAllSounds ();
cl.sound_prepped = false; // don't play ambients
cl.sound_prepped = false; // don't play ambients
if (cls.disable_screen) return;
if (developer->value)
return;
if (cls.state == ca_disconnected)
return; // if at console, don't bring up the plaque
if (cls.key_dest == key_console)
return;
if (cl.cinematictime > 0)
scr_draw_loading = 2; // clear to black first
else
scr_draw_loading = 1;
if (host.developer) return;
if (cls.state == ca_disconnected) return; // if at console, don't bring up the plaque
if (cls.key_dest == key_console) return;
if (cl.cinematictime > 0) scr_draw_loading = 2; // clear to black first
else scr_draw_loading = 1;
SCR_UpdateScreen ();
cls.disable_screen = Sys_DoubleTime();
cls.disable_servercount = cl.servercount;

View File

@ -236,13 +236,13 @@ void CL_ParseParticles (void)
int color, count;
vec3_t pos, dir;
MSG_ReadPos (&net_message, pos);
MSG_ReadPos (&net_message, dir);
MSG_ReadPos32(&net_message, pos);
MSG_ReadPos32(&net_message, dir);
color = MSG_ReadByte (&net_message);
count = MSG_ReadByte (&net_message);
color = MSG_ReadByte(&net_message);
count = MSG_ReadByte(&net_message);
CL_ParticleEffect (pos, dir, color, count);
CL_ParticleEffect(pos, dir, color, count);
}
/*
@ -259,10 +259,10 @@ int CL_ParseBeam (model_t *model)
ent = MSG_ReadShort (&net_message);
MSG_ReadPos (&net_message, start);
MSG_ReadPos (&net_message, end);
MSG_ReadPos32(&net_message, start);
MSG_ReadPos32(&net_message, end);
// override any beam with the same entity
// override any beam with the same entity
for (i=0, b=cl_beams ; i< MAX_BEAMS ; i++, b++)
if (b->entity == ent)
{
@ -307,9 +307,9 @@ int CL_ParseBeam2 (model_t *model)
ent = MSG_ReadShort (&net_message);
MSG_ReadPos (&net_message, start);
MSG_ReadPos (&net_message, end);
MSG_ReadPos (&net_message, offset);
MSG_ReadPos32(&net_message, start);
MSG_ReadPos32(&net_message, end);
MSG_ReadPos32(&net_message, offset);
// Msg ("end- %f %f %f\n", end[0], end[1], end[2]);
@ -360,10 +360,10 @@ int CL_ParseLightning (model_t *model)
srcEnt = MSG_ReadShort (&net_message);
destEnt = MSG_ReadShort (&net_message);
MSG_ReadPos (&net_message, start);
MSG_ReadPos (&net_message, end);
MSG_ReadPos32(&net_message, start);
MSG_ReadPos32(&net_message, end);
// override any beam with the same source AND destination entities
// override any beam with the same source AND destination entities
for (i=0, b=cl_beams ; i< MAX_BEAMS ; i++, b++)
if (b->entity == srcEnt && b->dest_entity == destEnt)
{
@ -410,8 +410,8 @@ void CL_ParseLaser (int colors)
laser_t *l;
int i;
MSG_ReadPos (&net_message, start);
MSG_ReadPos (&net_message, end);
MSG_ReadPos32(&net_message, start);
MSG_ReadPos32(&net_message, end);
for (i=0, l=cl_lasers ; i< MAX_LASERS ; i++, l++)
{
@ -452,16 +452,16 @@ void CL_ParseTEnt (void)
switch (type)
{
case TE_BLOOD: // bullet hitting flesh
MSG_ReadPos (&net_message, pos);
MSG_ReadPos (&net_message, dir);
MSG_ReadPos32(&net_message, pos);
MSG_ReadPos32(&net_message, dir);
CL_ParticleEffect (pos, dir, 0xe8, 60);
break;
case TE_GUNSHOT: // bullet hitting wall
case TE_SPARKS:
case TE_BULLET_SPARKS:
MSG_ReadPos (&net_message, pos);
MSG_ReadPos (&net_message, dir);
MSG_ReadPos32(&net_message, pos);
MSG_ReadPos32(&net_message, dir);
if (type == TE_GUNSHOT)
CL_ParticleEffect (pos, dir, 0, 40);
else
@ -485,8 +485,8 @@ void CL_ParseTEnt (void)
case TE_SCREEN_SPARKS:
case TE_SHIELD_SPARKS:
MSG_ReadPos (&net_message, pos);
MSG_ReadPos (&net_message, dir);
MSG_ReadPos32(&net_message, pos);
MSG_ReadPos32(&net_message, dir);
if (type == TE_SCREEN_SPARKS)
CL_ParticleEffect (pos, dir, 0xd0, 40);
else
@ -496,16 +496,16 @@ void CL_ParseTEnt (void)
break;
case TE_SHOTGUN: // bullet hitting wall
MSG_ReadPos (&net_message, pos);
MSG_ReadPos (&net_message, dir);
MSG_ReadPos32 (&net_message, pos);
MSG_ReadPos32 (&net_message, dir);
CL_ParticleEffect (pos, dir, 0, 20);
CL_SmokeAndFlash(pos);
break;
case TE_SPLASH: // bullet hitting water
cnt = MSG_ReadByte (&net_message);
MSG_ReadPos (&net_message, pos);
MSG_ReadPos (&net_message, dir);
MSG_ReadPos32 (&net_message, pos);
MSG_ReadPos32 (&net_message, dir);
r = MSG_ReadByte (&net_message);
if (r > 6)
color = 0x00;
@ -527,22 +527,22 @@ void CL_ParseTEnt (void)
case TE_LASER_SPARKS:
cnt = MSG_ReadByte (&net_message);
MSG_ReadPos (&net_message, pos);
MSG_ReadPos (&net_message, dir);
MSG_ReadPos32 (&net_message, pos);
MSG_ReadPos32 (&net_message, dir);
color = MSG_ReadByte (&net_message);
CL_ParticleEffect2 (pos, dir, color, cnt);
break;
// RAFAEL
case TE_BLUEHYPERBLASTER:
MSG_ReadPos (&net_message, pos);
MSG_ReadPos (&net_message, dir);
MSG_ReadPos32 (&net_message, pos);
MSG_ReadPos32 (&net_message, dir);
CL_BlasterParticles (pos, dir);
break;
case TE_BLASTER: // blaster hitting wall
MSG_ReadPos (&net_message, pos);
MSG_ReadPos (&net_message, dir);
MSG_ReadPos32 (&net_message, pos);
MSG_ReadPos32 (&net_message, dir);
CL_BlasterParticles (pos, dir);
ex = CL_AllocExplosion ();
@ -570,8 +570,8 @@ void CL_ParseTEnt (void)
break;
case TE_RAILTRAIL: // railgun effect
MSG_ReadPos (&net_message, pos);
MSG_ReadPos (&net_message, pos2);
MSG_ReadPos32 (&net_message, pos);
MSG_ReadPos32 (&net_message, pos2);
CL_RailTrail (pos, pos2);
S_StartSound (pos2, 0, 0, cl_sfx_railg, 1, ATTN_NORM, 0);
break;
@ -579,7 +579,7 @@ void CL_ParseTEnt (void)
case TE_EXPLOSION2:
case TE_GRENADE_EXPLOSION:
case TE_GRENADE_EXPLOSION_WATER:
MSG_ReadPos (&net_message, pos);
MSG_ReadPos32 (&net_message, pos);
ex = CL_AllocExplosion ();
VectorCopy (pos, ex->ent.origin);
@ -603,7 +603,7 @@ void CL_ParseTEnt (void)
// RAFAEL
case TE_PLASMA_EXPLOSION:
MSG_ReadPos (&net_message, pos);
MSG_ReadPos32 (&net_message, pos);
ex = CL_AllocExplosion ();
VectorCopy (pos, ex->ent.origin);
ex->type = ex_poly;
@ -624,7 +624,7 @@ void CL_ParseTEnt (void)
case TE_EXPLOSION1:
case TE_ROCKET_EXPLOSION:
case TE_ROCKET_EXPLOSION_WATER:
MSG_ReadPos (&net_message, pos);
MSG_ReadPos32 (&net_message, pos);
ex = CL_AllocExplosion ();
VectorCopy (pos, ex->ent.origin);
@ -647,7 +647,7 @@ void CL_ParseTEnt (void)
break;
case TE_BFG_EXPLOSION:
MSG_ReadPos (&net_message, pos);
MSG_ReadPos32 (&net_message, pos);
ex = CL_AllocExplosion ();
VectorCopy (pos, ex->ent.origin);
ex->type = ex_poly;
@ -664,7 +664,7 @@ void CL_ParseTEnt (void)
break;
case TE_BFG_BIGEXPLOSION:
MSG_ReadPos (&net_message, pos);
MSG_ReadPos32 (&net_message, pos);
CL_BFGExplosionParticles (pos);
break;
@ -673,8 +673,8 @@ void CL_ParseTEnt (void)
break;
case TE_BUBBLETRAIL:
MSG_ReadPos (&net_message, pos);
MSG_ReadPos (&net_message, pos2);
MSG_ReadPos32 (&net_message, pos);
MSG_ReadPos32 (&net_message, pos2);
CL_BubbleTrail (pos, pos2);
break;
@ -684,7 +684,7 @@ void CL_ParseTEnt (void)
break;
case TE_BOSSTPORT: // boss teleporting to station
MSG_ReadPos (&net_message, pos);
MSG_ReadPos32 (&net_message, pos);
CL_BigTeleportParticles (pos);
S_StartSound (pos, 0, 0, S_RegisterSound ("misc/bigtele.wav"), 1, ATTN_NONE, 0);
break;
@ -695,8 +695,8 @@ void CL_ParseTEnt (void)
// RAFAEL
case TE_WELDING_SPARKS:
cnt = MSG_ReadByte (&net_message);
MSG_ReadPos (&net_message, pos);
MSG_ReadPos (&net_message, dir);
MSG_ReadPos32 (&net_message, pos);
MSG_ReadPos32 (&net_message, dir);
color = MSG_ReadByte (&net_message);
CL_ParticleEffect2 (pos, dir, color, cnt);
@ -716,28 +716,28 @@ void CL_ParseTEnt (void)
break;
case TE_GREENBLOOD:
MSG_ReadPos (&net_message, pos);
MSG_ReadPos (&net_message, dir);
MSG_ReadPos32 (&net_message, pos);
MSG_ReadPos32 (&net_message, dir);
CL_ParticleEffect2 (pos, dir, 0xdf, 30);
break;
case TE_FLASHLIGHT:
MSG_ReadPos(&net_message, pos);
MSG_ReadPos32(&net_message, pos);
ent = MSG_ReadShort(&net_message);
CL_Flashlight(ent, pos);
break;
case TE_DEBUGTRAIL:
MSG_ReadPos (&net_message, pos);
MSG_ReadPos (&net_message, pos2);
MSG_ReadPos32 (&net_message, pos);
MSG_ReadPos32 (&net_message, pos2);
CL_DebugTrail (pos, pos2);
break;
// RAFAEL
case TE_TUNNEL_SPARKS:
cnt = MSG_ReadByte (&net_message);
MSG_ReadPos (&net_message, pos);
MSG_ReadPos (&net_message, dir);
MSG_ReadPos32 (&net_message, pos);
MSG_ReadPos32 (&net_message, dir);
color = MSG_ReadByte (&net_message);
CL_ParticleEffect3 (pos, dir, color, cnt);
break;

View File

@ -386,7 +386,6 @@ void CL_WidowSplash (vec3_t org);
// ========
int CL_ParseEntityBits (unsigned *bits);
void CL_ParseDelta (entity_state_t *from, entity_state_t *to, int number, int bits);
void CL_ParseFrame (void);
void CL_ParseTEnt (void);

View File

@ -77,14 +77,15 @@ void _MSG_WriteWord (sizebuf_t *sb, int c, const char *filename, int fileline);
void _MSG_WriteLong (sizebuf_t *sb, int c, const char *filename, int fileline);
void _MSG_WriteFloat (sizebuf_t *sb, float f, const char *filename, int fileline);
void _MSG_WriteString (sizebuf_t *sb, const char *s, const char *filename, int fileline);
void _MSG_WriteCoord (sizebuf_t *sb, float f, const char *filename, int fileline);
void _MSG_WritePos (sizebuf_t *sb, vec3_t pos, const char *filename, int fileline);
void _MSG_WriteAngle (sizebuf_t *sb, float f, const char *filename, int fileline);
void _MSG_WriteAngle16 (sizebuf_t *sb, float f, const char *filename, int fileline);
void _MSG_WriteCoord16(sizebuf_t *sb, float f, const char *filename, int fileline);
void _MSG_WriteCoord32(sizebuf_t *sb, float f, const char *filename, int fileline);
void _MSG_WriteAngle16(sizebuf_t *sb, float f, const char *filename, int fileline);
void _MSG_WriteAngle32(sizebuf_t *sb, float f, const char *filename, int fileline);
void _MSG_WritePos16(sizebuf_t *sb, vec3_t pos, const char *filename, int fileline);
void _MSG_WritePos32(sizebuf_t *sb, vec3_t pos, const char *filename, int fileline);
void _MSG_WriteUnterminatedString (sizebuf_t *sb, const char *s, const char *filename, int fileline);
void _MSG_WriteDeltaUsercmd (sizebuf_t *sb, struct usercmd_s *from, struct usercmd_s *cmd, const char *filename, int fileline);
void _MSG_WriteDeltaEntity (struct entity_state_s *from, struct entity_state_s *to, sizebuf_t *msg, bool force, bool newentity, const char *filename, int fileline);
void _MSG_WriteVector (sizebuf_t *sb, float *v, const char *filename, int fileline);
void _MSG_Send (msgtype_t to, vec3_t origin, edict_t *ent, const char *filename, int fileline);
#define MSG_Begin( x ) _MSG_Begin( x, __FILE__, __LINE__);
@ -95,37 +96,40 @@ void _MSG_Send (msgtype_t to, vec3_t origin, edict_t *ent, const char *filename,
#define MSG_WriteLong(x,y) _MSG_WriteLong (x, y, __FILE__, __LINE__);
#define MSG_WriteFloat(x, y) _MSG_WriteFloat (x, y, __FILE__, __LINE__);
#define MSG_WriteString(x,y) _MSG_WriteString (x, y, __FILE__, __LINE__);
#define MSG_WriteCoord(x, y) _MSG_WriteCoord (x, y, __FILE__, __LINE__);
#define MSG_WritePos(x, y) _MSG_WritePos (x, y, __FILE__, __LINE__);
#define MSG_WriteAngle(x, y) _MSG_WriteAngle (x, y, __FILE__, __LINE__);
#define MSG_WriteAngle16(x, y) _MSG_WriteAngle16 (x, y, __FILE__, __LINE__);
#define MSG_WriteCoord16(x, y) _MSG_WriteCoord16(x, y, __FILE__, __LINE__);
#define MSG_WriteCoord32(x, y) _MSG_WriteCoord32(x, y, __FILE__, __LINE__);
#define MSG_WriteAngle16(x, y) _MSG_WriteAngle16(x, y, __FILE__, __LINE__);
#define MSG_WriteAngle32(x, y) _MSG_WriteAngle32(x, y, __FILE__, __LINE__);
#define MSG_WritePos16(x, y) _MSG_WritePos16(x, y, __FILE__, __LINE__);
#define MSG_WritePos32(x, y) _MSG_WritePos32(x, y, __FILE__, __LINE__);
#define MSG_WriteUnterminatedString(x, y) _MSG_WriteUnterminatedString (x, y, __FILE__, __LINE__);
#define MSG_WriteDeltaUsercmd(x, y, z) _MSG_WriteDeltaUsercmd (x, y, z, __FILE__, __LINE__);
#define MSG_WriteDeltaEntity(x, y, z, t, m) _MSG_WriteDeltaEntity (x, y, z, t, m, __FILE__, __LINE__);
#define MSG_WriteVector(x, y) _MSG_WriteVector (x, y, __FILE__, __LINE__);
#define MSG_Send(x, y, z) _MSG_Send(x, y, z, __FILE__, __LINE__);
void MSG_BeginReading (sizebuf_t *sb);
int MSG_ReadChar (sizebuf_t *sb);
int MSG_ReadByte (sizebuf_t *sb);
int MSG_ReadShort (sizebuf_t *sb);
int MSG_ReadLong (sizebuf_t *sb);
float MSG_ReadFloat (sizebuf_t *sb);
char *MSG_ReadString (sizebuf_t *sb);
char *MSG_ReadStringLine (sizebuf_t *sb);
float MSG_ReadCoord (sizebuf_t *sb);
void MSG_ReadPos (sizebuf_t *sb, vec3_t pos);
float MSG_ReadAngle (sizebuf_t *sb);
float MSG_ReadAngle16 (sizebuf_t *sb);
void MSG_ReadDeltaUsercmd (sizebuf_t *sb, struct usercmd_s *from, struct usercmd_s *cmd);
void MSG_ReadData (sizebuf_t *sb, void *buffer, int size);
int MSG_ReadChar (sizebuf_t *sb);
int MSG_ReadByte (sizebuf_t *sb);
int MSG_ReadShort (sizebuf_t *sb);
int MSG_ReadLong (sizebuf_t *sb);
float MSG_ReadFloat (sizebuf_t *sb);
char *MSG_ReadString (sizebuf_t *sb);
char *MSG_ReadStringLine (sizebuf_t *sb);
float MSG_ReadCoord16(sizebuf_t *sb);
float MSG_ReadCoord32(sizebuf_t *sb);
float MSG_ReadAngle16(sizebuf_t *sb);
float MSG_ReadAngle32(sizebuf_t *sb);
void MSG_ReadPos16(sizebuf_t *sb, vec3_t pos);
void MSG_ReadPos32(sizebuf_t *sb, vec3_t pos);
void MSG_ReadDeltaUsercmd (sizebuf_t *sb, struct usercmd_s *from, struct usercmd_s *cmd);
void MSG_ReadDeltaEntity(entity_state_t *from, entity_state_t *to, int number, int bits);
void MSG_ReadData (sizebuf_t *sb, void *buffer, int size);
//============================================================================
int COM_Argc (void);
int COM_Argc (void);
char *COM_Argv (int arg); // range and null checked
void COM_ClearArgv (int arg);
int COM_CheckParm (char *parm);
@ -576,6 +580,52 @@ Common between server and client so prediction matches
==============================================================
*/
// button bits
#define BUTTON_ATTACK 1
#define BUTTON_USE 2
#define BUTTON_ATTACK2 4
#define BUTTONS_ATTACK (BUTTON_ATTACK | BUTTON_ATTACK2)
#define BUTTON_ANY 128 // any key whatsoever
#define MAXTOUCH 32
// usercmd_t is sent to the server each client frame
typedef struct usercmd_s
{
byte msec;
byte buttons;
short angles[3];
short forwardmove, sidemove, upmove;
byte impulse; // remove?
byte lightlevel; // light level the player is standing on
} usercmd_t;
typedef struct
{
// state (in / out)
pmove_state_t s;
// command (in)
usercmd_t cmd;
bool snapinitial; // if s has been changed outside pmove
// results (out)
int numtouch;
edict_t *touchents[MAXTOUCH];
vec3_t viewangles; // clamped
float viewheight;
vec3_t mins, maxs; // bounding box size
edict_t *groundentity;
int watertype;
int waterlevel;
// callbacks to test the world
trace_t (*trace) (vec3_t start, vec3_t mins, vec3_t maxs, vec3_t end);
int (*pointcontents) (vec3_t point);
} pmove_t;
extern float pm_airaccelerate;
@ -601,9 +651,9 @@ byte COM_BlockSequenceCRCByte (byte *base, int length, int sequence);
float frand(void); // 0 to 1
float crand(void); // -1 to 1
extern cvar_t *developer;
extern cvar_t *dedicated;
extern cvar_t *host_speeds;
extern cvar_t *host_frametime;
// host_speeds times
extern float time_before_game;

View File

@ -28,7 +28,7 @@ int com_argc;
char *com_argv[MAX_NUM_ARGVS+1];
cvar_t *host_speeds;
cvar_t *developer;
cvar_t *host_frametime;
cvar_t *dedicated;
int server_state;

View File

@ -23,7 +23,7 @@ void _MSG_WriteChar (sizebuf_t *sb, int c, const char *filename, int fileline)
byte *buf;
if (c < -128 || c > 127)
Msg("MSG_WriteChar: range error %d (called at %s:%i)\n", c, filename, fileline);
MsgWarn("MSG_WriteChar: range error %d (called at %s:%i)\n", c, filename, fileline);
buf = _SZ_GetSpace (sb, 1, filename, fileline );
buf[0] = c;
@ -34,7 +34,7 @@ void _MSG_WriteByte (sizebuf_t *sb, int c, const char *filename, int fileline)
byte *buf;
if (c < 0 || c > 255)
Msg("MSG_WriteByte: range error %d (called at %s:%i)\n", c, filename, fileline);
MsgWarn("MSG_WriteByte: range error %d (called at %s:%i)\n", c, filename, fileline);
buf = _SZ_GetSpace (sb, 1, filename, fileline);
buf[0] = c;
@ -45,7 +45,7 @@ void _MSG_WriteShort (sizebuf_t *sb, int c, const char *filename, int fileline)
byte *buf;
if (c < -32767 || c > 32767)
Msg("MSG_WriteShort: range error %d (called at %s:%i)\n", c, filename, fileline);
MsgWarn("MSG_WriteShort: range error %d (called at %s:%i)\n", c, filename, fileline);
buf = _SZ_GetSpace (sb, 2, filename, fileline);
buf[0] = c&0xff;
@ -57,7 +57,7 @@ void _MSG_WriteWord (sizebuf_t *sb, int c, const char *filename, int fileline)
byte *buf;
if (c < 0 || c > 65535)
Msg("MSG_WriteWord: range error %d (called at %s:%i)\n", c, filename, fileline);
MsgWarn("MSG_WriteWord: range error %d (called at %s:%i)\n", c, filename, fileline);
buf = _SZ_GetSpace (sb, 2, filename, fileline);
buf[0] = c&0xff;
@ -99,33 +99,38 @@ void _MSG_WriteUnterminatedString (sizebuf_t *sb, const char *s, const char *fil
if (s && *s) _SZ_Write (sb, (byte *)s, (int)strlen(s), filename, fileline);
}
void _MSG_WriteCoord (sizebuf_t *sb, float f, const char *filename, int fileline)
void _MSG_WriteCoord16(sizebuf_t *sb, float f, const char *filename, int fileline)
{
_MSG_WriteShort (sb, (int)(f * 8), filename, fileline );
}
void _MSG_WriteVector (sizebuf_t *sb, float *v, const char *filename, int fileline )
{
_MSG_WriteCoord (sb, v[0], filename, fileline );
_MSG_WriteCoord (sb, v[1], filename, fileline );
_MSG_WriteCoord (sb, v[2], filename, fileline );
}
void _MSG_WritePos (sizebuf_t *sb, vec3_t pos, const char *filename, int fileline)
{
_MSG_WriteShort (sb, (int)(pos[0] * 8), filename, fileline );
_MSG_WriteShort (sb, (int)(pos[1] * 8), filename, fileline );
_MSG_WriteShort (sb, (int)(pos[2] * 8), filename, fileline );
}
void _MSG_WriteAngle (sizebuf_t *sb, float f, const char *filename, int fileline)
{
_MSG_WriteByte (sb, (int)(f * 256/360) & 255, filename, fileline );
_MSG_WriteShort(sb, (int)(f * SV_COORD_FRAC), filename, fileline );
}
void _MSG_WriteAngle16 (sizebuf_t *sb, float f, const char *filename, int fileline)
{
_MSG_WriteWord (sb, ANGLE2SHORT(f), filename, fileline );
_MSG_WriteWord(sb, ANGLE2SHORT(f), filename, fileline );
}
void _MSG_WriteCoord32(sizebuf_t *sb, float f, const char *filename, int fileline)
{
_MSG_WriteFloat(sb, f, filename, fileline );
}
void _MSG_WriteAngle32(sizebuf_t *sb, float f, const char *filename, int fileline)
{
_MSG_WriteFloat(sb, f, filename, fileline );
}
void _MSG_WritePos16(sizebuf_t *sb, vec3_t pos, const char *filename, int fileline)
{
_MSG_WriteCoord32(sb, pos[0] * SV_COORD_FRAC, filename, fileline );
_MSG_WriteCoord32(sb, pos[1] * SV_COORD_FRAC, filename, fileline );
_MSG_WriteCoord32(sb, pos[2] * SV_COORD_FRAC, filename, fileline );
}
void _MSG_WritePos32(sizebuf_t *sb, vec3_t pos, const char *filename, int fileline)
{
_MSG_WriteCoord32(sb, pos[0], filename, fileline );
_MSG_WriteCoord32(sb, pos[1], filename, fileline );
_MSG_WriteCoord32(sb, pos[2], filename, fileline );
}
void _MSG_WriteDeltaUsercmd (sizebuf_t *buf, usercmd_t *from, usercmd_t *cmd, const char *filename, int fileline)
@ -224,8 +229,6 @@ void _MSG_WriteDeltaEntity (entity_state_t *from, entity_state_t *to, sizebuf_t
// write the message
if (!bits && !force) return; // nothing to send!
//----------
if (bits & 0xff000000) bits |= U_MOREBITS3 | U_MOREBITS2 | U_MOREBITS1;
else if (bits & 0x00ff0000) bits |= U_MOREBITS2 | U_MOREBITS1;
else if (bits & 0x0000ff00) bits |= U_MOREBITS1;
@ -272,21 +275,15 @@ void _MSG_WriteDeltaEntity (entity_state_t *from, entity_state_t *to, sizebuf_t
else if (bits & U_RENDERFX8) _MSG_WriteByte (msg, to->renderfx, filename, fileline);
else if (bits & U_RENDERFX16) _MSG_WriteShort (msg, to->renderfx, filename, fileline);
if (bits & U_ORIGIN1) _MSG_WriteCoord (msg, to->origin[0], filename, fileline);
if (bits & U_ORIGIN2) _MSG_WriteCoord (msg, to->origin[1], filename, fileline);
if (bits & U_ORIGIN3) _MSG_WriteCoord (msg, to->origin[2], filename, fileline);
if (bits & U_ORIGIN1) _MSG_WriteCoord32(msg, to->origin[0], filename, fileline);
if (bits & U_ORIGIN2) _MSG_WriteCoord32(msg, to->origin[1], filename, fileline);
if (bits & U_ORIGIN3) _MSG_WriteCoord32(msg, to->origin[2], filename, fileline);
if (bits & U_ANGLE1) _MSG_WriteAngle(msg, to->angles[0], filename, fileline);
if (bits & U_ANGLE2) _MSG_WriteAngle(msg, to->angles[1], filename, fileline);
if (bits & U_ANGLE3) _MSG_WriteAngle(msg, to->angles[2], filename, fileline);
if (bits & U_OLDORIGIN)
{
_MSG_WriteCoord (msg, to->old_origin[0], filename, fileline);
_MSG_WriteCoord (msg, to->old_origin[1], filename, fileline);
_MSG_WriteCoord (msg, to->old_origin[2], filename, fileline);
}
if (bits & U_ANGLE1) _MSG_WriteAngle32(msg, to->angles[0], filename, fileline);
if (bits & U_ANGLE2) _MSG_WriteAngle32(msg, to->angles[1], filename, fileline);
if (bits & U_ANGLE3) _MSG_WriteAngle32(msg, to->angles[2], filename, fileline);
if (bits & U_OLDORIGIN) _MSG_WritePos32(msg, to->old_origin, filename, fileline);
if (bits & U_SEQUENCE) _MSG_WriteByte (msg, to->sequence, filename, fileline);
if (bits & U_SOLID) _MSG_WriteShort (msg, to->solid, filename, fileline);
if (bits & U_ALPHA) _MSG_WriteFloat (msg, to->alpha, filename, fileline);
@ -434,28 +431,40 @@ char *MSG_ReadStringLine (sizebuf_t *msg_read)
return string;
}
float MSG_ReadCoord (sizebuf_t *msg_read)
float MSG_ReadCoord16(sizebuf_t *msg_read)
{
return MSG_ReadShort(msg_read) * (1.0/8);
return MSG_ReadShort(msg_read) * CL_COORD_FRAC;
}
void MSG_ReadPos (sizebuf_t *msg_read, vec3_t pos)
float MSG_ReadCoord32(sizebuf_t *msg_read)
{
pos[0] = MSG_ReadShort(msg_read) * (1.0/8);
pos[1] = MSG_ReadShort(msg_read) * (1.0/8);
pos[2] = MSG_ReadShort(msg_read) * (1.0/8);
return MSG_ReadFloat(msg_read);
}
float MSG_ReadAngle (sizebuf_t *msg_read)
void MSG_ReadPos32(sizebuf_t *msg_read, vec3_t pos)
{
return MSG_ReadChar(msg_read) * (360.0/256);
pos[0] = MSG_ReadFloat(msg_read);
pos[1] = MSG_ReadFloat(msg_read);
pos[2] = MSG_ReadFloat(msg_read);
}
float MSG_ReadAngle16 (sizebuf_t *msg_read)
void MSG_ReadPos16(sizebuf_t *msg_read, vec3_t pos)
{
pos[0] = MSG_ReadShort(msg_read) * CL_COORD_FRAC;
pos[1] = MSG_ReadShort(msg_read) * CL_COORD_FRAC;
pos[2] = MSG_ReadShort(msg_read) * CL_COORD_FRAC;
}
float MSG_ReadAngle16(sizebuf_t *msg_read)
{
return SHORT2ANGLE(MSG_ReadShort(msg_read));
}
float MSG_ReadAngle32(sizebuf_t *msg_read)
{
return MSG_ReadFloat(msg_read);
}
void MSG_ReadDeltaUsercmd (sizebuf_t *msg_read, usercmd_t *from, usercmd_t *move)
{
int bits = MSG_ReadByte (msg_read);
@ -479,12 +488,60 @@ void MSG_ReadDeltaUsercmd (sizebuf_t *msg_read, usercmd_t *from, usercmd_t *move
move->lightlevel = MSG_ReadByte (msg_read); // read the light level
}
void MSG_ReadDeltaEntity(entity_state_t *from, entity_state_t *to, int number, int bits)
{
// set everything to the state we are delta'ing from
*to = *from;
VectorCopy (from->origin, to->old_origin);
to->number = number;
if (bits & U_MODEL) to->modelindex = MSG_ReadByte (&net_message);
if (bits & U_WEAPONMODEL) to->weaponmodel = MSG_ReadByte (&net_message);
if (bits & U_FRAME8 ) to->frame = MSG_ReadByte (&net_message);
if (bits & U_FRAME16) to->frame = MSG_ReadShort (&net_message);
if (bits & U_SKIN8 ) to->skin = MSG_ReadByte(&net_message);
if (bits & U_SKIN16) to->skin = MSG_ReadShort(&net_message);
if ( (bits & (U_EFFECTS8|U_EFFECTS16)) == (U_EFFECTS8|U_EFFECTS16) )
to->effects = MSG_ReadLong(&net_message);
else if (bits & U_EFFECTS8 ) to->effects = MSG_ReadByte(&net_message);
else if (bits & U_EFFECTS16) to->effects = MSG_ReadShort(&net_message);
if ( (bits & (U_RENDERFX8|U_RENDERFX16)) == (U_RENDERFX8|U_RENDERFX16) )
to->renderfx = MSG_ReadLong(&net_message);
else if (bits & U_RENDERFX8 ) to->renderfx = MSG_ReadByte(&net_message);
else if (bits & U_RENDERFX16) to->renderfx = MSG_ReadShort(&net_message);
if (bits & U_ORIGIN1) to->origin[0] = MSG_ReadCoord32(&net_message);
if (bits & U_ORIGIN2) to->origin[1] = MSG_ReadCoord32(&net_message);
if (bits & U_ORIGIN3) to->origin[2] = MSG_ReadCoord32(&net_message);
if (bits & U_ANGLE1) to->angles[0] = MSG_ReadAngle32(&net_message);
if (bits & U_ANGLE2) to->angles[1] = MSG_ReadAngle32(&net_message);
if (bits & U_ANGLE3) to->angles[2] = MSG_ReadAngle32(&net_message);
if (bits & U_OLDORIGIN) MSG_ReadPos32(&net_message, to->old_origin);
if (bits & U_SEQUENCE) to->sequence = MSG_ReadByte(&net_message);
if (bits & U_SOLID) to->solid = MSG_ReadShort(&net_message);
if (bits & U_ALPHA) to->alpha = MSG_ReadFloat(&net_message);
if (bits & U_EVENT) to->event = MSG_ReadByte (&net_message);
if (bits & U_SOUNDIDX) to->soundindex = MSG_ReadByte (&net_message);
else to->event = 0;
if (bits & U_BODY) to->body = MSG_ReadByte (&net_message);
}
void MSG_ReadData (sizebuf_t *msg_read, void *data, int len)
{
int i;
for (i = 0; i < len; i++)
{
((byte *)data)[i] = MSG_ReadByte (msg_read);
}
}

View File

@ -85,40 +85,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#define SPAWNFLAG_NOT_HARD 0x00000400
#define SPAWNFLAG_NOT_DEATHMATCH 0x00000800
// entity_state_t->renderfx flags
#define RF_MINLIGHT 1 // allways have some light (viewmodel)
#define RF_VIEWERMODEL 2 // don't draw through eyes, only mirrors
#define RF_WEAPONMODEL 4 // only draw through eyes
#define RF_FULLBRIGHT 8 // allways draw full intensity
#define RF_DEPTHHACK 16 // for view weapon Z crunching
#define RF_TRANSLUCENT 32
#define RF_FRAMELERP 64
#define RF_BEAM 128
#define RF_CUSTOMSKIN 256 // skin is an index in image_precache
#define RF_GLOW 512 // pulse lighting for bonus items
#define RF_SHELL_RED 1024
#define RF_SHELL_GREEN 2048
#define RF_SHELL_BLUE 4096
#define RF_IR_VISIBLE 0x00008000 // 32768
#define RF_SHELL_DOUBLE 0x00010000 // 65536
#define RF_SHELL_HALF_DAM 0x00020000
#define RF_USE_DISGUISE 0x00040000
//lazarus
#define RF_VAMPIRE 0x00080000 // 524288
// player_state_t->refdef flags
#define RDF_UNDERWATER 1 // warp the screen as apropriate
#define RDF_NOWORLDMODEL 2 // used for player configuration screen
#define RDF_IRGOGGLES 4
#define RDF_UVGOGGLES 8
#define RDF_BLOOM 32
#define RDF_PAIN 64
#define RDF_WATER 128
#define RDF_LAVA 256
#define RDF_SLIME 512
// edict->movetype values
// edict->flags
@ -147,18 +113,6 @@ typedef enum
WEAPON_FIRING
} weaponstate_t;
#define MOVETYPE_NONE 0 // never moves
#define MOVETYPE_NOCLIP 1 // origin and angles change with no interaction
#define MOVETYPE_PUSH 2 // no clip to world, push on box contact
#define MOVETYPE_WALK 3 // gravity
#define MOVETYPE_STEP 4 // gravity, special edge handling
#define MOVETYPE_FLY 5
#define MOVETYPE_TOSS 6 // gravity
#define MOVETYPE_BOUNCE 7
#define MOVETYPE_FOLLOW 8 // attached models
#define MOVETYPE_CONVEYOR 9
#define MOVETYPE_PUSHABLE 10
/*
==============================================================
@ -254,21 +208,6 @@ typedef struct
edict_t *ent; // not set by CM_*() functions
} trace_t;
// pmove_state_t is the information necessary for client side movement
// prediction
typedef enum
{
// can accelerate and turn
PM_NORMAL,
PM_SPECTATOR,
// no acceleration or turning
PM_DEAD,
PM_GIB, // different bounding box
PM_FREEZE
} pmtype_t;
// pmove->pm_flags
#define PMF_DUCKED 1
#define PMF_JUMP_HELD 2
@ -278,77 +217,6 @@ typedef enum
#define PMF_TIME_TELEPORT 32 // pm_time is non-moving time
#define PMF_NO_PREDICTION 64 // temporarily disables prediction (used for grappling hook)
// this structure needs to be communicated bit-accurate
// from the server to the client to guarantee that
// prediction stays in sync, so no floats are used.
// if any part of the game code modifies this struct, it
// will result in a prediction error of some degree.
typedef struct
{
pmtype_t pm_type;
short origin[3]; // 12.3
short velocity[3]; // 12.3
byte pm_flags; // ducked, jump_held, etc
byte pm_time; // each unit = 8 ms
short gravity;
short delta_angles[3]; // add to command angles to get view direction
// changed by spawns, rotating objects, and teleporters
} pmove_state_t;
//
// button bits
//
//
// button bits
//
#define BUTTON_ATTACK 1
#define BUTTON_USE 2
#define BUTTON_ATTACK2 4
#define BUTTONS_ATTACK (BUTTON_ATTACK | BUTTON_ATTACK2)
#define BUTTON_ANY 128 // any key whatsoever
// usercmd_t is sent to the server each client frame
typedef struct usercmd_s
{
byte msec;
byte buttons;
short angles[3];
short forwardmove, sidemove, upmove;
byte impulse; // remove?
byte lightlevel; // light level the player is standing on
} usercmd_t;
#define MAXTOUCH 32
typedef struct
{
// state (in / out)
pmove_state_t s;
// command (in)
usercmd_t cmd;
bool snapinitial; // if s has been changed outside pmove
// results (out)
int numtouch;
edict_t *touchents[MAXTOUCH];
vec3_t viewangles; // clamped
float viewheight;
vec3_t mins, maxs; // bounding box size
edict_t *groundentity;
int watertype;
int waterlevel;
// callbacks to test the world
trace_t (*trace) (vec3_t start, vec3_t mins, vec3_t maxs, vec3_t end);
int (*pointcontents) (vec3_t point);
} pmove_t;
// entity_state_t->effects
@ -670,16 +538,16 @@ typedef enum
#define DF_NO_FALLING 0x00000008 // 8
#define DF_INSTANT_ITEMS 0x00000010 // 16
#define DF_SAME_LEVEL 0x00000020 // 32
#define DF_SKINTEAMS 0x00000040 // 64
#define DF_MODELTEAMS 0x00000080 // 128
#define DF_NO_FRIENDLY_FIRE 0x00000100 // 256
#define DF_SKINTEAMS 0x00000040 // 64
#define DF_MODELTEAMS 0x00000080 // 128
#define DF_NO_FRIENDLY_FIRE 0x00000100 // 256
#define DF_SPAWN_FARTHEST 0x00000200 // 512
#define DF_FORCE_RESPAWN 0x00000400 // 1024
#define DF_NO_ARMOR 0x00000800 // 2048
#define DF_ALLOW_EXIT 0x00001000 // 4096
#define DF_INFINITE_AMMO 0x00002000 // 8192
#define DF_QUAD_DROP 0x00004000 // 16384
#define DF_FIXED_FOV 0x00008000 // 32768
#define DF_FORCE_RESPAWN 0x00000400 // 1024
#define DF_NO_ARMOR 0x00000800 // 2048
#define DF_ALLOW_EXIT 0x00001000 // 4096
#define DF_INFINITE_AMMO 0x00002000 // 8192
#define DF_QUAD_DROP 0x00004000 // 16384
#define DF_FIXED_FOV 0x00008000 // 32768
// RAFAEL
#define DF_QUADFIRE_DROP 0x00010000 // 65536
@ -692,10 +560,6 @@ typedef enum
==========================================================
*/
#define ANGLE2SHORT(x) ((int)((x)*65536/360) & 65535)
#define SHORT2ANGLE(x) ((x)*(360.0/65536))
//
// config strings are a general means of communication from
// the server to all connected clients.
@ -704,13 +568,13 @@ typedef enum
#define CS_NAME 0
#define CS_CDTRACK 1
#define CS_SKY 2
#define CS_SKYAXIS 3 // %f %f %f format
#define CS_SKYAXIS 3 // %f %f %f format
#define CS_SKYROTATE 4
#define CS_STATUSBAR 5 // display program string
#define CS_AIRACCEL 29 // air acceleration control
#define CS_STATUSBAR 5 // display program string (1536 chars)
#define CS_STATUSBAR_SIZE (CS_AIRACCEL - CS_STATUSBAR) * MAX_QPATH
#define CS_AIRACCEL 29 // air acceleration control
#define CS_MAXCLIENTS 30
#define CS_MAPCHECKSUM 31 // for catching cheater maps
#define CS_MAPCHECKSUM 31 // for catching cheater maps
#define CS_MODELS 32
#define CS_SOUNDS (CS_MODELS+MAX_MODELS)
@ -742,301 +606,4 @@ typedef enum
EV_OTHER_TELEPORT
} entity_event_t;
// entity_state_t is the information conveyed from the server
// in an update message about entities that the client will
// need to render in some way
typedef struct entity_state_s
{
int number; // edict index
vec3_t origin;
vec3_t angles;
vec3_t old_origin; // for lerping animation
int modelindex;
int soundindex;
int weaponmodel;
short skin; // skin for studiomodels
short frame; // % playback position in animation sequences (0..512)
byte body; // sub-model selection for studiomodels
byte sequence; // animation sequence (0 - 255)
uint effects; // PGM - we're filling it, so it needs to be unsigned
int renderfx;
int solid; // for client side prediction, 8*(bits 0-4) is x/y radius
// 8*(bits 5-9) is z down distance, 8(bits10-15) is z up
// gi.linkentity sets this properly
int event; // impulse events -- muzzle flashes, footsteps, etc
// events only go out for a single frame, they
// are automatically cleared each frame
float alpha; // alpha value
} entity_state_t;
//==============================================
// player_state_t is the information needed in addition to pmove_state_t
// to rendered a view. There will only be 10 player_state_t sent each second,
// but the number of pmove_state_t changes will be reletive to client
// frame rates
typedef struct
{
pmove_state_t pmove; // for prediction
// these fields do not need to be communicated bit-precise
vec3_t viewangles; // for fixed views
vec3_t viewoffset; // add to pmovestate->origin
vec3_t kick_angles; // add to view direction to get render angles
// set by weapon kicks, pain effects, etc
vec3_t gunangles;
vec3_t gunoffset;
int gunindex;
int gunframe; // studio frame
int sequence; // stuido animation sequence
int gunbody;
int gunskin;
float blend[4]; // rgba full screen effect
float fov; // horizontal field of view
int rdflags; // refdef flags
short stats[MAX_STATS]; // fast status bar updates
} player_state_t;
typedef enum
{
FOOTSTEP_METAL1,
FOOTSTEP_METAL2,
FOOTSTEP_METAL3,
FOOTSTEP_METAL4,
FOOTSTEP_DIRT1,
FOOTSTEP_DIRT2,
FOOTSTEP_DIRT3,
FOOTSTEP_DIRT4,
FOOTSTEP_VENT1,
FOOTSTEP_VENT2,
FOOTSTEP_VENT3,
FOOTSTEP_VENT4,
FOOTSTEP_GRATE1,
FOOTSTEP_GRATE2,
FOOTSTEP_GRATE3,
FOOTSTEP_GRATE4,
FOOTSTEP_TILE1,
FOOTSTEP_TILE2,
FOOTSTEP_TILE3,
FOOTSTEP_TILE4,
FOOTSTEP_GRASS1,
FOOTSTEP_GRASS2,
FOOTSTEP_GRASS3,
FOOTSTEP_GRASS4,
FOOTSTEP_SNOW1,
FOOTSTEP_SNOW2,
FOOTSTEP_SNOW3,
FOOTSTEP_SNOW4,
FOOTSTEP_CARPET1,
FOOTSTEP_CARPET2,
FOOTSTEP_CARPET3,
FOOTSTEP_CARPET4,
FOOTSTEP_FORCE1,
FOOTSTEP_FORCE2,
FOOTSTEP_FORCE3,
FOOTSTEP_FORCE4,
FOOTSTEP_SLOSH1,
FOOTSTEP_SLOSH2,
FOOTSTEP_SLOSH3,
FOOTSTEP_SLOSH4,
FOOTSTEP_LADDER1,
FOOTSTEP_LADDER2,
FOOTSTEP_LADDER3,
FOOTSTEP_LADDER4
} footstep_t;
typedef enum
{
ENTITY_DONT_USE_THIS_ONE,
ENTITY_ITEM_HEALTH,
ENTITY_ITEM_HEALTH_SMALL,
ENTITY_ITEM_HEALTH_LARGE,
ENTITY_ITEM_HEALTH_MEGA,
ENTITY_INFO_PLAYER_START,
ENTITY_INFO_PLAYER_DEATHMATCH,
ENTITY_INFO_PLAYER_COOP,
ENTITY_INFO_PLAYER_INTERMISSION,
ENTITY_FUNC_PLAT,
ENTITY_FUNC_BUTTON,
ENTITY_FUNC_DOOR,
ENTITY_FUNC_DOOR_SECRET,
ENTITY_FUNC_DOOR_ROTATING,
ENTITY_FUNC_ROTATING,
ENTITY_FUNC_TRAIN,
ENTITY_FUNC_WATER,
ENTITY_FUNC_CONVEYOR,
ENTITY_FUNC_AREAPORTAL,
ENTITY_FUNC_CLOCK,
ENTITY_FUNC_WALL,
ENTITY_FUNC_OBJECT,
ENTITY_FUNC_TIMER,
ENTITY_FUNC_EXPLOSIVE,
ENTITY_FUNC_KILLBOX,
ENTITY_TARGET_ACTOR,
ENTITY_TARGET_ANIMATION,
ENTITY_TARGET_BLASTER,
ENTITY_TARGET_CHANGELEVEL,
ENTITY_TARGET_CHARACTER,
ENTITY_TARGET_CROSSLEVEL_TARGET,
ENTITY_TARGET_CROSSLEVEL_TRIGGER,
ENTITY_TARGET_EARTHQUAKE,
ENTITY_TARGET_EXPLOSION,
ENTITY_TARGET_GOAL,
ENTITY_TARGET_HELP,
ENTITY_TARGET_LASER,
ENTITY_TARGET_LIGHTRAMP,
ENTITY_TARGET_SECRET,
ENTITY_TARGET_SPAWNER,
ENTITY_TARGET_SPEAKER,
ENTITY_TARGET_SPLASH,
ENTITY_TARGET_STRING,
ENTITY_TARGET_TEMP_ENTITY,
ENTITY_TRIGGER_ALWAYS,
ENTITY_TRIGGER_COUNTER,
ENTITY_TRIGGER_ELEVATOR,
ENTITY_TRIGGER_GRAVITY,
ENTITY_TRIGGER_HURT,
ENTITY_TRIGGER_KEY,
ENTITY_TRIGGER_ONCE,
ENTITY_TRIGGER_MONSTERJUMP,
ENTITY_TRIGGER_MULTIPLE,
ENTITY_TRIGGER_PUSH,
ENTITY_TRIGGER_RELAY,
ENTITY_VIEWTHING,
ENTITY_WORLDSPAWN,
ENTITY_LIGHT,
ENTITY_LIGHT_MINE1,
ENTITY_LIGHT_MINE2,
ENTITY_INFO_NOTNULL,
ENTITY_PATH_CORNER,
ENTITY_POINT_COMBAT,
ENTITY_MISC_EXPLOBOX,
ENTITY_MISC_BANNER,
ENTITY_MISC_SATELLITE_DISH,
ENTITY_MISC_ACTOR,
ENTITY_MISC_GIB_ARM,
ENTITY_MISC_GIB_LEG,
ENTITY_MISC_GIB_HEAD,
ENTITY_MISC_INSANE,
ENTITY_MISC_DEADSOLDIER,
ENTITY_MISC_VIPER,
ENTITY_MISC_VIPER_BOMB,
ENTITY_MISC_BIGVIPER,
ENTITY_MISC_STROGG_SHIP,
ENTITY_MISC_TELEPORTER,
ENTITY_MISC_TELEPORTER_DEST,
ENTITY_MISC_BLACKHOLE,
ENTITY_MISC_EASTERTANK,
ENTITY_MISC_EASTERCHICK,
ENTITY_MISC_EASTERCHICK2,
ENTITY_MONSTER_BERSERK,
ENTITY_MONSTER_GLADIATOR,
ENTITY_MONSTER_GUNNER,
ENTITY_MONSTER_INFANTRY,
ENTITY_MONSTER_SOLDIER_LIGHT,
ENTITY_MONSTER_SOLDIER,
ENTITY_MONSTER_SOLDIER_SS,
ENTITY_MONSTER_TANK,
ENTITY_MONSTER_MEDIC,
ENTITY_MONSTER_FLIPPER,
ENTITY_MONSTER_CHICK,
ENTITY_MONSTER_PARASITE,
ENTITY_MONSTER_FLYER,
ENTITY_MONSTER_BRAIN,
ENTITY_MONSTER_FLOATER,
ENTITY_MONSTER_HOVER,
ENTITY_MONSTER_MUTANT,
ENTITY_MONSTER_SUPERTANK,
ENTITY_MONSTER_BOSS2,
ENTITY_MONSTER_BOSS3_STAND,
ENTITY_MONSTER_JORG,
ENTITY_MONSTER_COMMANDER_BODY,
ENTITY_TURRET_BREACH,
ENTITY_TURRET_BASE,
ENTITY_TURRET_DRIVER,
ENTITY_CRANE_BEAM,
ENTITY_CRANE_HOIST,
ENTITY_CRANE_HOOK,
ENTITY_CRANE_CONTROL,
ENTITY_CRANE_RESET,
ENTITY_FUNC_BOBBINGWATER,
ENTITY_FUNC_DOOR_SWINGING,
ENTITY_FUNC_FORCE_WALL,
ENTITY_FUNC_MONITOR,
ENTITY_FUNC_PENDULUM,
ENTITY_FUNC_PIVOT,
ENTITY_FUNC_PUSHABLE,
ENTITY_FUNC_REFLECT,
ENTITY_FUNC_TRACKCHANGE,
ENTITY_FUNC_TRACKTRAIN,
ENTITY_FUNC_TRAINBUTTON,
ENTITY_FUNC_VEHICLE,
ENTITY_HINT_PATH,
ENTITY_INFO_TRAIN_START,
ENTITY_MISC_LIGHT,
ENTITY_MODEL_SPAWN,
ENTITY_MODEL_TRAIN,
ENTITY_MODEL_TURRET,
ENTITY_MONSTER_MAKRON,
ENTITY_PATH_TRACK,
ENTITY_TARGET_ANGER,
ENTITY_TARGET_ATTRACTOR,
ENTITY_TARGET_CD,
ENTITY_TARGET_CHANGE,
ENTITY_TARGET_CLONE,
ENTITY_TARGET_EFFECT,
ENTITY_TARGET_FADE,
ENTITY_TARGET_FAILURE,
ENTITY_TARGET_FOG,
ENTITY_TARGET_FOUNTAIN,
ENTITY_TARGET_LIGHTSWITCH,
ENTITY_TARGET_LOCATOR,
ENTITY_TARGET_LOCK,
ENTITY_TARGET_LOCK_CLUE,
ENTITY_TARGET_LOCK_CODE,
ENTITY_TARGET_LOCK_DIGIT,
ENTITY_TARGET_MONITOR,
ENTITY_TARGET_MONSTERBATTLE,
ENTITY_TARGET_MOVEWITH,
ENTITY_TARGET_PRECIPITATION,
ENTITY_TARGET_ROCKS,
ENTITY_TARGET_ROTATION,
ENTITY_TARGET_SET_EFFECT,
ENTITY_TARGET_SKILL,
ENTITY_TARGET_SKY,
ENTITY_TARGET_PLAYBACK,
ENTITY_TARGET_TEXT,
ENTITY_THING,
ENTITY_TREMOR_TRIGGER_MULTIPLE,
ENTITY_TRIGGER_BBOX,
ENTITY_TRIGGER_DISGUISE,
ENTITY_TRIGGER_FOG,
ENTITY_TRIGGER_INSIDE,
ENTITY_TRIGGER_LOOK,
ENTITY_TRIGGER_MASS,
ENTITY_TRIGGER_SCALES,
ENTITY_TRIGGER_SPEAKER,
ENTITY_TRIGGER_SWITCH,
ENTITY_TRIGGER_TELEPORTER,
ENTITY_TRIGGER_TRANSITION,
ENTITY_BOLT,
ENTITY_DEBRIS,
ENTITY_GIB,
ENTITY_GIBHEAD,
ENTITY_GRENADE,
ENTITY_HANDGRENADE,
ENTITY_ROCKET,
ENTITY_CHASECAM,
ENTITY_CAMPLAYER,
ENTITY_PLAYER_NOISE
} entity_id;
#endif//CONST_H

View File

@ -165,7 +165,7 @@ void Host_Init (char *funcname, int argc, char **argv)
Cmd_AddCommand ("error", Host_Error_f);
host_speeds = Cvar_Get ("host_speeds", "0", 0);
developer = Cvar_Get ("developer", "0", 0);
host_frametime = Cvar_Get ("host_frametime", "0.01", 0);
timescale = Cvar_Get ("timescale", "1", 0);
fixedtime = Cvar_Get ("fixedtime", "0", 0);
if(host.type == HOST_DEDICATED) dedicated = Cvar_Get ("dedicated", "1", CVAR_NOSET);
@ -213,6 +213,9 @@ void Host_Frame (double time)
rand(); // keep the random time dependent
// get new key events
Sys_SendKeyEvents();
do
{
s = Sys_ConsoleInput ();
@ -220,6 +223,12 @@ void Host_Frame (double time)
} while (s);
Cbuf_Execute ();
// if at a full screen console, don't update unless needed
if (Minimized || host.type == HOST_DEDICATED )
{
Sys_Sleep (1);
}
if (host_speeds->value) time_before = Sys_DoubleTime();
SV_Frame (time);
@ -252,7 +261,6 @@ Host_Main
*/
void Host_Main( void )
{
MSG msg;
static double time, oldtime, newtime;
oldtime = host.realtime;
@ -260,30 +268,11 @@ void Host_Main( void )
// main window message loop
while (host.type != HOST_OFFLINE)
{
// if at a full screen console, don't update unless needed
if (Minimized || host.type == HOST_DEDICATED )
{
Sys_Sleep (1);
}
while (PeekMessage (&msg, NULL, 0, 0, PM_NOREMOVE))
{
if(!GetMessage (&msg, NULL, 0, 0))
host.type = HOST_OFFLINE;
host.sv_timer = msg.time;
TranslateMessage (&msg);
DispatchMessage (&msg);
}
do
{
newtime = Sys_DoubleTime();
time = newtime - oldtime;
} while (time < 0.001);
oldtime = newtime;
newtime = Sys_DoubleTime();
time = newtime - oldtime;
Host_Frame (time); // engine frame
oldtime = newtime;
}
host.state = HOST_SHUTDOWN;
}
@ -296,12 +285,8 @@ Host_Shutdown
*/
void Host_Free (void)
{
if(host.state != HOST_ERROR)
{
host.state = HOST_SHUTDOWN;
SV_Shutdown ("Server shutdown\n", false);
CL_Shutdown ();
}
SV_Shutdown ("Server shutdown\n", false);
CL_Shutdown ();
NET_Shutdown();
Host_FreePhysic();
Host_FreeCommon();

View File

@ -167,35 +167,18 @@ void SV_WritePlayerstateToClient (client_frame_t *from, client_frame_t *to, size
else ops = &from->ps;
// determine what needs to be sent
if (ps->pmove.pm_type != ops->pmove.pm_type)
pflags |= PS_M_TYPE;
if(!VectorICompare(ps->pmove.origin, ops->pmove.origin)) pflags |= PS_M_ORIGIN;
if(!VectorICompare(ps->pmove.velocity, ops->pmove.velocity)) pflags |= PS_M_VELOCITY;
if (ps->pmove.pm_type != ops->pmove.pm_type) pflags |= PS_M_TYPE;
if(!VectorCompare(ps->pmove.origin, ops->pmove.origin)) pflags |= PS_M_ORIGIN;
if(!VectorCompare(ps->pmove.velocity, ops->pmove.velocity)) pflags |= PS_M_VELOCITY;
if (ps->pmove.pm_time != ops->pmove.pm_time) pflags |= PS_M_TIME;
if (ps->pmove.pm_flags != ops->pmove.pm_flags) pflags |= PS_M_FLAGS;
if (ps->pmove.gravity != ops->pmove.gravity) pflags |= PS_M_GRAVITY;
if(!VectorICompare(ps->pmove.delta_angles, ops->pmove.delta_angles))
{
Msg("update delta angles\n");
pflags |= PS_M_DELTA_ANGLES;
}
if(!VectorCompare(ps->viewoffset, ops->viewoffset))
pflags |= PS_VIEWOFFSET;
if(!VectorCompare(ps->pmove.delta_angles, ops->pmove.delta_angles)) pflags |= PS_M_DELTA_ANGLES;
if(!VectorCompare(ps->viewoffset, ops->viewoffset)) pflags |= PS_VIEWOFFSET;
if(!VectorCompare(ps->viewangles, ops->viewangles)) pflags |= PS_VIEWANGLES;
if (ps->kick_angles[0] != ops->kick_angles[0]
|| ps->kick_angles[1] != ops->kick_angles[1]
|| ps->kick_angles[2] != ops->kick_angles[2] )
pflags |= PS_KICKANGLES;
if (ps->blend[0] != ops->blend[0]
|| ps->blend[1] != ops->blend[1]
|| ps->blend[2] != ops->blend[2]
|| ps->blend[3] != ops->blend[3] )
if(!VectorCompare(ps->kick_angles, ops->kick_angles)) pflags |= PS_KICKANGLES;
if (ps->blend[0] != ops->blend[0] || ps->blend[1] != ops->blend[1] || ps->blend[2] != ops->blend[2] || ps->blend[3] != ops->blend[3] )
pflags |= PS_BLEND;
if (ps->fov != ops->fov) pflags |= PS_FOV;
@ -211,41 +194,15 @@ void SV_WritePlayerstateToClient (client_frame_t *from, client_frame_t *to, size
MSG_WriteByte (msg, svc_playerinfo);
MSG_WriteLong (msg, pflags);
//
// write the pmove_state_t
//
if (pflags & PS_M_TYPE)
MSG_WriteByte (msg, ps->pmove.pm_type);
if (pflags & PS_M_TYPE) MSG_WriteByte (msg, ps->pmove.pm_type);
if (pflags & PS_M_ORIGIN)
{
MSG_WriteShort (msg, ps->pmove.origin[0]);
MSG_WriteShort (msg, ps->pmove.origin[1]);
MSG_WriteShort (msg, ps->pmove.origin[2]);
}
if (pflags & PS_M_VELOCITY)
{
MSG_WriteShort (msg, ps->pmove.velocity[0]);
MSG_WriteShort (msg, ps->pmove.velocity[1]);
MSG_WriteShort (msg, ps->pmove.velocity[2]);
}
if (pflags & PS_M_TIME)
MSG_WriteByte (msg, ps->pmove.pm_time);
if (pflags & PS_M_FLAGS)
MSG_WriteByte (msg, ps->pmove.pm_flags);
if (pflags & PS_M_GRAVITY)
MSG_WriteShort (msg, ps->pmove.gravity);
if (pflags & PS_M_DELTA_ANGLES)
{
MSG_WriteShort (msg, ps->pmove.delta_angles[0]);
MSG_WriteShort (msg, ps->pmove.delta_angles[1]);
MSG_WriteShort (msg, ps->pmove.delta_angles[2]);
}
if (pflags & PS_M_ORIGIN) MSG_WritePos32(msg, ps->pmove.origin);
if (pflags & PS_M_VELOCITY) MSG_WritePos32(msg, ps->pmove.velocity);
if (pflags & PS_M_TIME) MSG_WriteByte (msg, ps->pmove.pm_time);
if (pflags & PS_M_FLAGS) MSG_WriteByte (msg, ps->pmove.pm_flags);
if (pflags & PS_M_GRAVITY) MSG_WriteShort (msg, ps->pmove.gravity);
if (pflags & PS_M_DELTA_ANGLES) MSG_WritePos32(msg, ps->pmove.delta_angles);
//
// write the rest of the player_state_t

View File

@ -722,13 +722,13 @@ void SV_RunGameFrame (void)
// compression can get confused when a client
// has the "current" frame
sv.framenum++;
sv.frametime = 0.1f;//1000 fps
sv.frametime = host_frametime->value;//100 fps as default
sv.time = sv.framenum * sv.frametime;
// don't run if paused
if (!sv_paused->value || maxclients->value > 1)
{
Phys->Frame( sv.frametime );
Phys->Frame( sv.time );
SV_RunFrame ();
// never get more than one tic behind
@ -756,8 +756,7 @@ void SV_Frame (float time)
time_before_game = time_after_game = 0;
// if server is not active, do nothing
if (!svs.initialized)
return;
if (!svs.initialized) return;
svs.realtime += time;
@ -1042,6 +1041,9 @@ before Sys_Quit or Sys_Error
*/
void SV_Shutdown (char *finalmsg, bool reconnect)
{
// already freed
if(host.state == HOST_ERROR) return;
Msg("SV_Shutdown: %s\n", finalmsg );
if (svs.clients) SV_FinalMessage (finalmsg, reconnect);

View File

@ -343,11 +343,11 @@ void SV_StartSound (vec3_t origin, edict_t *entity, int channel, int soundindex,
MSG_WriteByte (&sv.multicast, flags);
MSG_WriteByte (&sv.multicast, soundindex);
if (flags & SND_VOLUME) MSG_WriteByte (&sv.multicast, volume*255);
if (flags & SND_ATTENUATION) MSG_WriteByte (&sv.multicast, attenuation*64);
if (flags & SND_OFFSET) MSG_WriteByte (&sv.multicast, timeofs*1000);
if (flags & SND_ENT) MSG_WriteShort (&sv.multicast, sendchan);
if (flags & SND_POS) MSG_WritePos (&sv.multicast, origin);
if (flags & SND_VOLUME) MSG_WriteByte(&sv.multicast, volume*255);
if (flags & SND_ATTENUATION) MSG_WriteByte(&sv.multicast, attenuation*64);
if (flags & SND_OFFSET) MSG_WriteByte(&sv.multicast, timeofs*1000);
if (flags & SND_ENT) MSG_WriteShort(&sv.multicast, sendchan);
if (flags & SND_POS) MSG_WritePos32(&sv.multicast, origin);
// if the sound doesn't attenuate,send it to everyone
// (global radio chatter, voiceovers, etc)

View File

@ -150,6 +150,7 @@ void SV_FreeEdict (edict_t *ed)
VectorClear(ed->progs.sv->origin);
VectorClear(ed->progs.sv->angles);
ed->progs.sv->nextthink = -1;
ed->priv.sv->physbody = NULL;
}
/*

View File

@ -177,15 +177,15 @@ void PF_BeginMessage(void)
MSG_Begin( svc_dest );
}
void PF_WriteByte (void){ MSG_WriteByte (&sv.multicast, (int)PRVM_G_FLOAT(OFS_PARM0)); }
void PF_WriteChar (void){ MSG_WriteChar (&sv.multicast, (int)PRVM_G_FLOAT(OFS_PARM0)); }
void PF_WriteShort (void){ MSG_WriteShort (&sv.multicast, (int)PRVM_G_FLOAT(OFS_PARM0)); }
void PF_WriteByte (void){ MSG_WriteByte(&sv.multicast, (int)PRVM_G_FLOAT(OFS_PARM0)); }
void PF_WriteChar (void){ MSG_WriteChar(&sv.multicast, (int)PRVM_G_FLOAT(OFS_PARM0)); }
void PF_WriteShort (void){ MSG_WriteShort(&sv.multicast, (int)PRVM_G_FLOAT(OFS_PARM0)); }
void PF_WriteLong (void){ MSG_WriteLong(&sv.multicast, (int)PRVM_G_FLOAT(OFS_PARM0)); }
void PF_WriteFloat (void){ MSG_WriteFloat(&sv.multicast, PRVM_G_FLOAT(OFS_PARM0)); }
void PF_WriteAngle (void){ MSG_WriteAngle (&sv.multicast, PRVM_G_FLOAT(OFS_PARM0)); }
void PF_WriteCoord (void){ MSG_WriteCoord (&sv.multicast, PRVM_G_FLOAT(OFS_PARM0)); }
void PF_WriteString (void){ MSG_WriteString (&sv.multicast, PRVM_G_STRING(OFS_PARM0)); }
void PF_WriteEntity (void){ MSG_WriteShort (&sv.multicast, PRVM_G_EDICTNUM(OFS_PARM1)); } // entindex
void PF_WriteAngle (void){ MSG_WriteAngle32(&sv.multicast, PRVM_G_FLOAT(OFS_PARM0)); }
void PF_WriteCoord (void){ MSG_WriteCoord32(&sv.multicast, PRVM_G_FLOAT(OFS_PARM0)); }
void PF_WriteString (void){ MSG_WriteString(&sv.multicast, PRVM_G_STRING(OFS_PARM0)); }
void PF_WriteEntity (void){ MSG_WriteShort(&sv.multicast, PRVM_G_EDICTNUM(OFS_PARM1)); } // entindex
void PF_EndMessage (void)
{

View File

@ -38,10 +38,9 @@ void Sys_Error( const char *error, ... )
vsprintf( syserror1, error, argptr );
va_end( argptr );
host.state = HOST_ERROR;
SV_Shutdown(va("Server fatal crashed: %s\n", syserror1), false);
CL_Shutdown();
host.state = HOST_ERROR; // lock shutdown state
std.error("%s", syserror1);
}
@ -71,9 +70,8 @@ void Sys_SendKeyEvents (void)
TranslateMessage (&msg);
DispatchMessage (&msg);
}
// grab frame time
host.cl_timer = host.realtime * 1000; // FIXME: should this be at start?
host.cl_timer = host.realtime * 1000;
}
/*

View File

@ -103,13 +103,13 @@ GL_BuildPolygonFromSurface
void Phys_BuildPolygonFromSurface(csurface_t *fa)
{
int i, j, lindex;
int i, lindex;
dedge_t *cur_edge;
float *vec;
vec3_t face[256];// max 256 edges on a face
// reconstruct the polygon
for(i = 0, j = fa->numedges - 1; i < fa->numedges; i++, j-- )
for(i = 0; i < fa->numedges; i++ )
{
lindex = map_surfedges[fa->firstedge + i];
@ -246,7 +246,10 @@ void Phys_LoadBSP( uint *buffer )
NewtonSetWorldSize( gWorld, &boxP0[0], &boxP1[0] );
Msg("physic map generated\n");
Mem_Free( map_surfedges );
Mem_Free( map_edges );
Mem_Free( map_surfaces );
Mem_Free( map_vertices );
}
void Phys_FreeBSP( void )
@ -255,6 +258,7 @@ void Phys_FreeBSP( void )
{
Msg("physic map released\n");
NewtonDestroyBody( gWorld, m_level );
m_level = NULL;
}
}

View File

@ -26,6 +26,10 @@
#define EQUAL_EPSILON 0.001f
#define STOP_EPSILON 0.1f
#define ANGLE2CHAR(x) ((int)((x)*256/360) & 255)
#define CHAR2ANGLE(x) ((x)*(360.0/256))
#define ANGLE2SHORT(x) ((int)((x)*65536/360) & 65535)
#define SHORT2ANGLE(x) ((x)*(360.0/65536))
#define RAD2DEG( x ) ((float)(x) * (float)(180.f / M_PI))
#define DEG2RAD( x ) ((float)(x) * (float)(M_PI / 180.f))
#define METER2INCH(x) (float)(x * (1.0f/METERS_PER_INCH))

View File

@ -50,13 +50,15 @@ _inline double DoubleSwap( double swap )
dswap(2,5);
dswap(3,4);
#undef dswap
return swap;
}
//============================================================================
// Endianess handling
//============================================================================
// We use BSD-style defines: BYTE_ORDER is defined to either BIG_ENDIAN or LITTLE_ENDIAN
// using BSD-style defines: BYTE_ORDER is defined to either BIG_ENDIAN or LITTLE_ENDIAN
// Initializations
#if !defined(BYTE_ORDER) || !defined(LITTLE_ENDIAN) || !defined(BIG_ENDIAN) || (BYTE_ORDER != LITTLE_ENDIAN && BYTE_ORDER != BIG_ENDIAN)

View File

@ -45,6 +45,49 @@
#define SHELL_BG_COLOR 0x78
#define SHELL_WHITE_COLOR 0xD7
// shared client/renderer flags
#define RF_MINLIGHT 1 // allways have some light (viewmodel)
#define RF_VIEWERMODEL 2 // don't draw through eyes, only mirrors
#define RF_WEAPONMODEL 4 // only draw through eyes
#define RF_FULLBRIGHT 8 // allways draw full intensity
#define RF_DEPTHHACK 16 // for view weapon Z crunching
#define RF_TRANSLUCENT 32
#define RF_FRAMELERP 64
#define RF_BEAM 128
#define RF_CUSTOMSKIN 256 // skin is an index in image_precache
#define RF_GLOW 512 // pulse lighting for bonus items
#define RF_SHELL_RED 1024
#define RF_SHELL_GREEN 2048
#define RF_SHELL_BLUE 4096
#define RF_IR_VISIBLE 0x00008000 // 32768
#define RF_SHELL_DOUBLE 0x00010000 // 65536
#define RF_SHELL_HALF_DAM 0x00020000
#define RF_USE_DISGUISE 0x00040000
// render private flags
#define RDF_UNDERWATER 1 // warp the screen as apropriate
#define RDF_NOWORLDMODEL 2 // used for player configuration screen
#define RDF_IRGOGGLES 4
#define RDF_UVGOGGLES 8
#define RDF_BLOOM 32
#define RDF_PAIN 64
#define RDF_WATER 128
#define RDF_LAVA 256
#define RDF_SLIME 512
// phys movetype
#define MOVETYPE_NONE 0 // never moves
#define MOVETYPE_NOCLIP 1 // origin and angles change with no interaction
#define MOVETYPE_PUSH 2 // no clip to world, push on box contact
#define MOVETYPE_WALK 3 // gravity
#define MOVETYPE_STEP 4 // gravity, special edge handling
#define MOVETYPE_FLY 5
#define MOVETYPE_TOSS 6 // gravity
#define MOVETYPE_BOUNCE 7
#define MOVETYPE_FOLLOW 8 // attached models
#define MOVETYPE_CONVEYOR 9
#define MOVETYPE_PUSHABLE 10
// opengl mask
#define GL_COLOR_INDEX 0x1900
#define GL_STENCIL_INDEX 0x1901
@ -401,6 +444,19 @@ typedef struct rgbdata_s
uint size; // for bounds checking
} rgbdata_t;
typedef struct physdata_s
{
vec3_t origin;
vec3_t angles;
vec3_t velocity;
vec3_t avelocity; // "omega" in newton
vec3_t mins; // for calculate size
vec3_t maxs; // and setup offset matrix
NewtonCollision *collision;
NewtonBody *physbody; // ptr to physic body
} physdata_t;
typedef struct gameinfo_s
{
//filesystem info
@ -463,7 +519,6 @@ typedef struct cvar_s
struct cvar_s *next;
struct cvar_s *hash;
//FIXME: remove these old variables
char *latched_string; // for CVAR_LATCH vars
bool modified; // set each time the cvar is changed
} cvar_t;
@ -507,6 +562,83 @@ typedef struct latchedvars_s
} latchedvars_t;
// pmove_state_t is the information necessary for client side movement
#define PM_NORMAL 0 // can accelerate and turn
#define PM_SPECTATOR 1
#define PM_DEAD 2 // no acceleration or turning
#define PM_GIB 3 // different bounding box
#define PM_FREEZE 4
// this structure needs to be communicated bit-accurate
// from the server to the client to guarantee that
// prediction stays in sync, so no floats are used.
// if any part of the game code modifies this struct, it
// will result in a prediction error of some degree.
typedef struct
{
byte pm_type;
vec3_t origin; // 12.3
vec3_t velocity; // 12.3
byte pm_flags; // ducked, jump_held, etc
byte pm_time; // each unit = 8 ms
short gravity;
vec3_t delta_angles; // add to command angles to get view direction
// changed by spawns, rotating objects, and teleporters
} pmove_state_t;
typedef struct
{
pmove_state_t pmove; // for prediction
// these fields do not need to be communicated bit-precise
vec3_t viewangles; // for fixed views
vec3_t viewoffset; // add to pmovestate->origin
vec3_t kick_angles; // add to view direction to get render angles
// set by weapon kicks, pain effects, etc
vec3_t gunangles;
vec3_t gunoffset;
int gunindex;
int gunframe; // studio frame
int sequence; // stuido animation sequence
int gunbody;
int gunskin;
float blend[4]; // rgba full screen effect
float fov; // horizontal field of view
int rdflags; // refdef flags
short stats[32]; // fast status bar updates
} player_state_t;
// network protocol
typedef struct entity_state_s
{
uint number; // edict index
vec3_t origin;
vec3_t angles;
vec3_t old_origin; // for lerping animation
int modelindex;
int soundindex;
int weaponmodel;
short skin; // skin for studiomodels
short frame; // % playback position in animation sequences (0..512)
byte body; // sub-model selection for studiomodels
byte sequence; // animation sequence (0 - 255)
uint effects; // PGM - we're filling it, so it needs to be unsigned
int renderfx;
int solid; // for client side prediction, 8*(bits 0-4) is x/y radius
// 8*(bits 5-9) is z down distance, 8(bits10-15) is z up
// gi.linkentity sets this properly
int event; // impulse events -- muzzle flashes, footsteps, etc
// events only go out for a single frame, they
// are automatically cleared each frame
float alpha; // alpha value
} entity_state_t;
// client entity
typedef struct entity_s
{
model_t *model; // opaque type outside refresh

View File

@ -18,25 +18,12 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#ifdef _WIN32
# include <windows.h>
#endif
#include <windows.h>
#include <stdio.h>
#include <GL/gl.h>
#include <GL/glu.h>
#include <math.h>
#include "basetypes.h"
#include <basemath.h>
#include "ref_system.h"
#include "materials.h"
#include "const.h"
#ifndef GL_COLOR_INDEX8_EXT
#define GL_COLOR_INDEX8_EXT GL_COLOR_INDEX
#endif
#define RENDERPASS_SOLID 1
#define RENDERPASS_ALPHA 2
@ -46,13 +33,10 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#define SOLID_FORMAT 3
#define ALPHA_FORMAT 4
#define DLLEXPORT __declspec(dllexport)
#define WINDOW_STYLE (WS_OVERLAPPED|WS_BORDER|WS_CAPTION|WS_VISIBLE)
#include "r_opengl.h"
#define REF_VERSION "GL 0.01"
/*
===========================================
memory manager

View File

@ -549,7 +549,6 @@ void R_StudioSetUpTransform ( void )
// NOTE: Because we need to interpolate multiplayer characters, the interpolation time limit
// was increased to 1.0 s., which is 2x the max lag we are accounting for.
if ( ( r_newrefdef.time < m_pCurrentEntity->animtime + 1.0f ) && ( m_pCurrentEntity->animtime != m_pCurrentEntity->prev.animtime ) )
{
f = (r_newrefdef.time - m_pCurrentEntity->animtime) / (m_pCurrentEntity->animtime - m_pCurrentEntity->prev.animtime);
@ -590,7 +589,6 @@ void R_StudioSetUpTransform ( void )
//Msg("%.0f %0.f %0.f\n", modelpos[0], modelpos[1], modelpos[2] );
//Msg("%.0f %0.f %0.f\n", angles[0], angles[1], angles[2] );
AngleMatrix (angles, m_protationmatrix);
m_protationmatrix[0][3] = modelpos[0];