[nq,qw] Clean up centerprint dstring
It was quite redundant and the optimization it vaguely provided belongs in sbar and not in the protocol parser.
This commit is contained in:
parent
c0cfeec5d6
commit
2a53047007
|
@ -127,8 +127,6 @@ const char *svc_strings[] = {
|
||||||
"svc_spawnstaticsound2",
|
"svc_spawnstaticsound2",
|
||||||
};
|
};
|
||||||
|
|
||||||
dstring_t *centerprint;
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
CL_EntityNum
|
CL_EntityNum
|
||||||
|
|
||||||
|
@ -371,10 +369,7 @@ CL_ParseServerInfo (void)
|
||||||
}
|
}
|
||||||
|
|
||||||
// local state
|
// local state
|
||||||
if (!centerprint)
|
Sbar_CenterPrint (0);
|
||||||
centerprint = dstring_newstr ();
|
|
||||||
else
|
|
||||||
dstring_clearstr (centerprint);
|
|
||||||
CL_NewMap (model_precache[1]);
|
CL_NewMap (model_precache[1]);
|
||||||
|
|
||||||
noclip_anglehack = false; // noclip is turned off at start
|
noclip_anglehack = false; // noclip is turned off at start
|
||||||
|
@ -966,10 +961,6 @@ CL_ParseServerMessage (void)
|
||||||
|
|
||||||
case svc_centerprint:
|
case svc_centerprint:
|
||||||
str = MSG_ReadString (net_message);
|
str = MSG_ReadString (net_message);
|
||||||
if (strcmp (str, centerprint->str)) {
|
|
||||||
dstring_copystr (centerprint, str);
|
|
||||||
//FIXME logging
|
|
||||||
}
|
|
||||||
Sbar_CenterPrint (str);
|
Sbar_CenterPrint (str);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
@ -996,10 +987,6 @@ CL_ParseServerMessage (void)
|
||||||
SCR_SetFullscreen (1);
|
SCR_SetFullscreen (1);
|
||||||
cl.completed_time = cl.time;
|
cl.completed_time = cl.time;
|
||||||
str = MSG_ReadString (net_message);
|
str = MSG_ReadString (net_message);
|
||||||
if (strcmp (str, centerprint->str)) {
|
|
||||||
dstring_copystr (centerprint, str);
|
|
||||||
//FIXME logging
|
|
||||||
}
|
|
||||||
Sbar_CenterPrint (str);
|
Sbar_CenterPrint (str);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
@ -1022,10 +1009,6 @@ CL_ParseServerMessage (void)
|
||||||
SCR_SetFullscreen (1);
|
SCR_SetFullscreen (1);
|
||||||
cl.completed_time = cl.time;
|
cl.completed_time = cl.time;
|
||||||
str = MSG_ReadString (net_message);
|
str = MSG_ReadString (net_message);
|
||||||
if (strcmp (str, centerprint->str)) {
|
|
||||||
dstring_copystr (centerprint, str);
|
|
||||||
//FIXME logging
|
|
||||||
}
|
|
||||||
Sbar_CenterPrint (str);
|
Sbar_CenterPrint (str);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
|
|
@ -1288,15 +1288,19 @@ Sbar_CenterPrint (const char *str)
|
||||||
{
|
{
|
||||||
if (!str) {
|
if (!str) {
|
||||||
centertime_off = 0;
|
centertime_off = 0;
|
||||||
dstring_clearstr (¢er_string);
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
centertime_off = scr_centertime;
|
||||||
|
centertime_start = realtime;
|
||||||
|
|
||||||
|
if (center_string.str && !strcmp (str, center_string.str)) {
|
||||||
|
// same string as last time, no need to lay out the text again
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
dstring_copystr (¢er_string, str);
|
dstring_copystr (¢er_string, str);
|
||||||
|
|
||||||
centertime_off = scr_centertime;
|
|
||||||
centertime_start = realtime;
|
|
||||||
|
|
||||||
// count the number of lines for centering
|
// count the number of lines for centering
|
||||||
center_lines = 1;
|
center_lines = 1;
|
||||||
while (*str) {
|
while (*str) {
|
||||||
|
|
|
@ -303,6 +303,4 @@ void CL_RSShot_f (void);
|
||||||
#define RSSHOT_WIDTH 320
|
#define RSSHOT_WIDTH 320
|
||||||
#define RSSHOT_HEIGHT 200
|
#define RSSHOT_HEIGHT 200
|
||||||
|
|
||||||
extern struct dstring_s *centerprint;
|
|
||||||
|
|
||||||
#endif // _CLIENT_H
|
#endif // _CLIENT_H
|
||||||
|
|
|
@ -664,8 +664,7 @@ CL_ClearState (void)
|
||||||
|
|
||||||
SZ_Clear (&cls.netchan.message);
|
SZ_Clear (&cls.netchan.message);
|
||||||
|
|
||||||
if (centerprint)
|
Sbar_CenterPrint (0);
|
||||||
dstring_clearstr (centerprint);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -1435,7 +1434,6 @@ CL_Shutdown (void *data)
|
||||||
}
|
}
|
||||||
Info_Destroy (cls.userinfo);
|
Info_Destroy (cls.userinfo);
|
||||||
Cbuf_DeleteStack (cl_stbuf);
|
Cbuf_DeleteStack (cl_stbuf);
|
||||||
dstring_delete (centerprint);
|
|
||||||
dstring_delete (cls.servername);
|
dstring_delete (cls.servername);
|
||||||
dstring_delete (cls.downloadtempname);
|
dstring_delete (cls.downloadtempname);
|
||||||
dstring_delete (cls.downloadname);
|
dstring_delete (cls.downloadname);
|
||||||
|
@ -1500,7 +1498,6 @@ CL_Init (void)
|
||||||
|
|
||||||
Info_SetValueForStarKey (cls.userinfo, "*ver", QW_VERSION, 0);
|
Info_SetValueForStarKey (cls.userinfo, "*ver", QW_VERSION, 0);
|
||||||
|
|
||||||
centerprint = dstring_newstr ();
|
|
||||||
cls.servername = dstring_newstr ();
|
cls.servername = dstring_newstr ();
|
||||||
cls.downloadtempname = dstring_newstr ();
|
cls.downloadtempname = dstring_newstr ();
|
||||||
cls.downloadname = dstring_newstr ();
|
cls.downloadname = dstring_newstr ();
|
||||||
|
|
|
@ -163,7 +163,6 @@ const char *svc_strings[] = {
|
||||||
"NEW PROTOCOL"
|
"NEW PROTOCOL"
|
||||||
};
|
};
|
||||||
|
|
||||||
dstring_t *centerprint;
|
|
||||||
int oldparsecountmod;
|
int oldparsecountmod;
|
||||||
int parsecountmod;
|
int parsecountmod;
|
||||||
double parsecounttime;
|
double parsecounttime;
|
||||||
|
@ -1437,10 +1436,6 @@ CL_ParseServerMessage (void)
|
||||||
|
|
||||||
case svc_centerprint:
|
case svc_centerprint:
|
||||||
str = MSG_ReadString (net_message);
|
str = MSG_ReadString (net_message);
|
||||||
if (strcmp (str, centerprint->str)) {
|
|
||||||
dstring_copystr (centerprint, str);
|
|
||||||
//FIXME logging
|
|
||||||
}
|
|
||||||
Sbar_CenterPrint (str);
|
Sbar_CenterPrint (str);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
@ -1486,10 +1481,6 @@ CL_ParseServerMessage (void)
|
||||||
SCR_SetFullscreen (1);
|
SCR_SetFullscreen (1);
|
||||||
cl.completed_time = realtime;
|
cl.completed_time = realtime;
|
||||||
str = MSG_ReadString (net_message);
|
str = MSG_ReadString (net_message);
|
||||||
if (strcmp (str, centerprint->str)) {
|
|
||||||
dstring_copystr (centerprint, str);
|
|
||||||
//FIXME logging
|
|
||||||
}
|
|
||||||
Sbar_CenterPrint (str);
|
Sbar_CenterPrint (str);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue