mirror of
https://git.code.sf.net/p/quake/quakeforge
synced 2024-11-10 07:11:41 +00:00
A bit more diff reduction before attempting to merge client code.
This commit is contained in:
parent
514f085e88
commit
28d9c7234c
4 changed files with 96 additions and 68 deletions
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
cl_main.c
|
||||
cl_ents.c
|
||||
|
||||
entity parsing and management
|
||||
|
||||
|
@ -28,8 +28,7 @@
|
|||
# include "config.h"
|
||||
#endif
|
||||
|
||||
static __attribute__ ((used)) const char rcsid[] =
|
||||
"$Id$";
|
||||
static __attribute__ ((used)) const char rcsid[] = "$Id$";
|
||||
|
||||
#include "QF/cbuf.h"
|
||||
#include "QF/cmd.h"
|
||||
|
@ -63,7 +62,7 @@ cl_entity_state_t cl_baselines[MAX_EDICTS];
|
|||
void
|
||||
CL_ClearEnts (void)
|
||||
{
|
||||
int i;
|
||||
size_t i;
|
||||
|
||||
// clear other arrays
|
||||
memset (cl_entities, 0, sizeof (cl_entities));
|
||||
|
@ -77,56 +76,77 @@ CL_ClearEnts (void)
|
|||
}
|
||||
|
||||
static void
|
||||
CL_NewDlight (int key, vec3_t org, int effects)
|
||||
CL_NewDlight (int key, vec3_t org, int effects, byte glow_size,
|
||||
byte glow_color)
|
||||
{
|
||||
float radius;
|
||||
float time = 0.1;
|
||||
dlight_t *dl;
|
||||
static quat_t normal = {0.4, 0.2, 0.05, 0.7};
|
||||
static quat_t red = {0.5, 0.05, 0.05, 0.7};
|
||||
static quat_t blue = {0.05, 0.05, 0.5, 0.7};
|
||||
static quat_t purple = {0.5, 0.05, 0.5, 0.7};
|
||||
|
||||
if (!(effects & (EF_BLUE | EF_RED | EF_BRIGHTLIGHT | EF_DIMLIGHT)))
|
||||
return;
|
||||
effects &= EF_BLUE | EF_RED | EF_BRIGHTLIGHT | EF_DIMLIGHT;
|
||||
if (!effects) {
|
||||
if (!glow_size)
|
||||
return;
|
||||
}
|
||||
|
||||
dl = R_AllocDlight (key);
|
||||
if (!dl)
|
||||
return;
|
||||
VectorCopy (org, dl->origin);
|
||||
|
||||
radius = 200 + (rand () & 31);
|
||||
if (effects & EF_BRIGHTLIGHT) {
|
||||
radius += 200;
|
||||
dl->origin[2] += 16;
|
||||
}
|
||||
if (effects & EF_DIMLIGHT)
|
||||
if (effects & ~EF_DIMLIGHT)
|
||||
radius -= 100;
|
||||
dl->radius = radius;
|
||||
dl->die = cl.time + time;
|
||||
if (effects & (EF_BLUE | EF_RED | EF_BRIGHTLIGHT | EF_DIMLIGHT)) {
|
||||
radius = 200 + (rand () & 31);
|
||||
if (effects & EF_BRIGHTLIGHT) {
|
||||
radius += 200;
|
||||
dl->origin[2] += 16;
|
||||
}
|
||||
if (effects & EF_DIMLIGHT)
|
||||
if (effects & ~EF_DIMLIGHT)
|
||||
radius -= 100;
|
||||
dl->radius = radius;
|
||||
dl->die = cl.time + 0.1;
|
||||
|
||||
switch (effects & (EF_BLUE | EF_RED)) {
|
||||
case EF_RED | EF_BLUE:
|
||||
QuatCopy (purple, dl->color);
|
||||
break;
|
||||
case EF_RED:
|
||||
QuatCopy (red, dl->color);
|
||||
break;
|
||||
case EF_BLUE:
|
||||
QuatCopy (blue, dl->color);
|
||||
break;
|
||||
default:
|
||||
QuatCopy (normal, dl->color);
|
||||
break;
|
||||
switch (effects & (EF_RED | EF_BLUE)) {
|
||||
case EF_RED | EF_BLUE:
|
||||
QuatCopy (purple, dl->color);
|
||||
break;
|
||||
case EF_RED:
|
||||
QuatCopy (red, dl->color);
|
||||
break;
|
||||
case EF_BLUE:
|
||||
QuatCopy (blue, dl->color);
|
||||
break;
|
||||
default:
|
||||
QuatCopy (normal, dl->color);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (glow_size) {
|
||||
dl->radius += glow_size < 128 ? glow_size * 8.0 :
|
||||
(glow_size - 256) * 8.0;
|
||||
dl->die = cl.time + 0.1;
|
||||
if (glow_color) {
|
||||
if (glow_color == 255) {
|
||||
dl->color[0] = dl->color[1] = dl->color[2] = 1.0;
|
||||
} else {
|
||||
byte *tempcolor;
|
||||
|
||||
tempcolor = (byte *) &d_8to24table[glow_color];
|
||||
VectorScale (tempcolor, 1 / 255.0, dl->color);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
CL_LerpPoint
|
||||
|
||||
Determines the fraction between the last two messages that the objects
|
||||
should be put at.
|
||||
Determines the fraction between the last two messages at which the
|
||||
objects should be put.
|
||||
*/
|
||||
static float
|
||||
CL_LerpPoint (void)
|
||||
|
@ -296,7 +316,7 @@ CL_RelinkEntities (void)
|
|||
ent->lerpflags |= LERP_RESETANIM | LERP_RESETANIM2;
|
||||
#endif
|
||||
}
|
||||
CL_NewDlight (i, ent->origin, state->effects);
|
||||
CL_NewDlight (i, ent->origin, state->effects, 0, 0);
|
||||
if (VectorDistance_fast (state->msg_origins[1], ent->origin)
|
||||
> (256 * 256))
|
||||
VectorCopy (ent->origin, state->msg_origins[1]);
|
||||
|
|
|
@ -101,7 +101,7 @@ const char *svc_strings[] = {
|
|||
"svc_foundsecret",
|
||||
"svc_spawnstaticsound",
|
||||
"svc_intermission",
|
||||
"svc_finale", // [string] music [string] text
|
||||
"svc_finale", // [string] text
|
||||
"svc_cdtrack", // [byte] track [byte] looptrack
|
||||
"svc_sellscreen",
|
||||
"svc_cutscene",
|
||||
|
|
|
@ -28,8 +28,7 @@
|
|||
# include "config.h"
|
||||
#endif
|
||||
|
||||
static __attribute__ ((used)) const char rcsid[] =
|
||||
"$Id$";
|
||||
static __attribute__ ((used)) const char rcsid[] = "$Id$";
|
||||
|
||||
#ifdef HAVE_STRING_H
|
||||
# include <string.h>
|
||||
|
@ -67,9 +66,9 @@ entity_t cl_flag_ents[MAX_CLIENTS];
|
|||
entity_t cl_packet_ents[512]; // FIXME: magic number
|
||||
|
||||
void
|
||||
CL_ClearEnts ()
|
||||
CL_ClearEnts (void)
|
||||
{
|
||||
unsigned int i;
|
||||
size_t i;
|
||||
|
||||
for (i = 0; i < sizeof (cl_packet_ents) / sizeof (cl_packet_ents[0]); i++)
|
||||
CL_Init_Entity (&cl_packet_ents[i]);
|
||||
|
@ -83,7 +82,7 @@ static void
|
|||
CL_NewDlight (int key, vec3_t org, int effects, byte glow_size,
|
||||
byte glow_color)
|
||||
{
|
||||
float radius;
|
||||
float radius;
|
||||
dlight_t *dl;
|
||||
static quat_t normal = {0.4, 0.2, 0.05, 0.7};
|
||||
static quat_t red = {0.5, 0.05, 0.05, 0.7};
|
||||
|
@ -112,6 +111,7 @@ CL_NewDlight (int key, vec3_t org, int effects, byte glow_size,
|
|||
radius -= 100;
|
||||
dl->radius = radius;
|
||||
dl->die = cl.time + 0.1;
|
||||
|
||||
switch (effects & (EF_RED | EF_BLUE)) {
|
||||
case EF_RED | EF_BLUE:
|
||||
QuatCopy (purple, dl->color);
|
||||
|
@ -136,12 +136,10 @@ CL_NewDlight (int key, vec3_t org, int effects, byte glow_size,
|
|||
if (glow_color == 255) {
|
||||
dl->color[0] = dl->color[1] = dl->color[2] = 1.0;
|
||||
} else {
|
||||
unsigned char *tempcolor;
|
||||
byte *tempcolor;
|
||||
|
||||
tempcolor = (byte *) &d_8to24table[glow_color];
|
||||
dl->color[0] = tempcolor[0] / 255.0;
|
||||
dl->color[1] = tempcolor[1] / 255.0;
|
||||
dl->color[2] = tempcolor[2] / 255.0;
|
||||
VectorScale (tempcolor, 1 / 255.0, dl->color);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -117,17 +117,13 @@ const char *svc_strings[] = {
|
|||
"svc_foundsecret",
|
||||
"svc_spawnstaticsound",
|
||||
"svc_intermission",
|
||||
"svc_finale",
|
||||
|
||||
"svc_cdtrack",
|
||||
"svc_finale", // [string] text
|
||||
"svc_cdtrack", // [byte] track
|
||||
"svc_sellscreen",
|
||||
|
||||
"svc_smallkick",
|
||||
"svc_bigkick",
|
||||
|
||||
"svc_updateping",
|
||||
"svc_updateentertime",
|
||||
|
||||
"svc_updatestatlong",
|
||||
"svc_muzzleflash",
|
||||
"svc_updateuserinfo",
|
||||
|
@ -141,7 +137,6 @@ const char *svc_strings[] = {
|
|||
"svc_deltapacketentities",
|
||||
"svc_maxspeed",
|
||||
"svc_entgravity",
|
||||
|
||||
"svc_setinfo",
|
||||
"svc_serverinfo",
|
||||
"svc_updatepl",
|
||||
|
@ -160,6 +155,7 @@ const char *svc_strings[] = {
|
|||
"NEW PROTOCOL"
|
||||
};
|
||||
|
||||
dstring_t *centerprint;
|
||||
int oldparsecountmod;
|
||||
int parsecountmod;
|
||||
double parsecounttime;
|
||||
|
@ -1173,6 +1169,10 @@ CL_ServerInfo (void)
|
|||
// movevars.ktjump = atof (value);
|
||||
// FIXME: need to set to 0.5 otherwise, outside of else structure
|
||||
}
|
||||
if (!centerprint)
|
||||
centerprint = dstring_newstr ();
|
||||
else
|
||||
dstring_clearstr (centerprint);
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -1246,7 +1246,7 @@ int received_framecount;
|
|||
void
|
||||
CL_ParseServerMessage (void)
|
||||
{
|
||||
const char *s;
|
||||
const char *str;
|
||||
static dstring_t *stuffbuf;
|
||||
int cmd = 0, i, j;
|
||||
|
||||
|
@ -1304,55 +1304,60 @@ CL_ParseServerMessage (void)
|
|||
dstring_t *p = 0;
|
||||
|
||||
i = MSG_ReadByte (net_message);
|
||||
s = MSG_ReadString (net_message);
|
||||
str = MSG_ReadString (net_message);
|
||||
if (i == PRINT_CHAT) {
|
||||
if (!CL_Chat_Allow_Message (s))
|
||||
if (!CL_Chat_Allow_Message (str))
|
||||
break;
|
||||
// TODO: cl_nofake 2 -- accept fake messages from teammates
|
||||
|
||||
if (cl_nofake->int_val) {
|
||||
char *c;
|
||||
|
||||
p = dstring_strdup (s);
|
||||
p = dstring_strdup (str);
|
||||
for (c = p->str; *c; c++) {
|
||||
if (*c == '\r')
|
||||
*c = '#';
|
||||
}
|
||||
s = p->str;
|
||||
str = p->str;
|
||||
}
|
||||
Con_SetOrMask (128);
|
||||
S_LocalSound ("misc/talk.wav");
|
||||
if (cl_chat_e->func)
|
||||
GIB_Event_Callback (cl_chat_e, 1, s);
|
||||
Team_ParseChat (s);
|
||||
GIB_Event_Callback (cl_chat_e, 1, str);
|
||||
Team_ParseChat (str);
|
||||
}
|
||||
Sys_Printf ("%s", s);
|
||||
Sys_Printf ("%s", str);
|
||||
if (p)
|
||||
dstring_delete (p);
|
||||
Con_SetOrMask (0);
|
||||
break;
|
||||
}
|
||||
case svc_centerprint:
|
||||
Sbar_CenterPrint (MSG_ReadString (net_message));
|
||||
str = MSG_ReadString (net_message);
|
||||
if (strcmp (str, centerprint->str)) {
|
||||
dstring_copystr (centerprint, str);
|
||||
//FIXME logging
|
||||
}
|
||||
Sbar_CenterPrint (str);
|
||||
break;
|
||||
|
||||
case svc_stufftext:
|
||||
s = MSG_ReadString (net_message);
|
||||
if (s[strlen (s) - 1] == '\n') {
|
||||
str = MSG_ReadString (net_message);
|
||||
if (str[strlen (str) - 1] == '\n') {
|
||||
if (stuffbuf && stuffbuf->str[0]) {
|
||||
Sys_MaskPrintf (SYS_DEV, "stufftext: %s%s\n",
|
||||
stuffbuf->str, s);
|
||||
stuffbuf->str, str);
|
||||
Cbuf_AddText (cl_stbuf, stuffbuf->str);
|
||||
dstring_clearstr (stuffbuf);
|
||||
} else {
|
||||
Sys_MaskPrintf (SYS_DEV, "stufftext: %s\n", s);
|
||||
Sys_MaskPrintf (SYS_DEV, "stufftext: %s\n", str);
|
||||
}
|
||||
Cbuf_AddText (cl_stbuf, s);
|
||||
Cbuf_AddText (cl_stbuf, str);
|
||||
} else {
|
||||
Sys_MaskPrintf (SYS_DEV, "partial stufftext: %s\n", s);
|
||||
Sys_MaskPrintf (SYS_DEV, "partial stufftext: %s\n", str);
|
||||
if (!stuffbuf)
|
||||
stuffbuf = dstring_newstr ();
|
||||
dstring_appendstr (stuffbuf, s);
|
||||
dstring_appendstr (stuffbuf, str);
|
||||
}
|
||||
break;
|
||||
|
||||
|
@ -1507,7 +1512,12 @@ CL_ParseServerMessage (void)
|
|||
r_force_fullscreen = 1;
|
||||
cl.completed_time = realtime;
|
||||
vid.recalc_refdef = true; // go to full screen
|
||||
Sbar_CenterPrint (MSG_ReadString (net_message));
|
||||
str = MSG_ReadString (net_message);
|
||||
if (strcmp (str, centerprint->str)) {
|
||||
dstring_copystr (centerprint, str);
|
||||
//FIXME logging
|
||||
}
|
||||
Sbar_CenterPrint (str);
|
||||
break;
|
||||
|
||||
case svc_sellscreen:
|
||||
|
|
Loading…
Reference in a new issue