1
0
Fork 0
forked from fte/fteqw

Protocol compat with the Rerelease Update 4, at the expense of earlier versions.

git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@6306 fc73d0e0-1445-4013-8a0c-d673dee63da5
This commit is contained in:
Spoike 2022-08-19 13:30:16 +00:00
parent 279474a019
commit 16c8e521ef
8 changed files with 113 additions and 36 deletions

View file

@ -4092,13 +4092,13 @@ static void CLQEX_ParseServerVars(void)
unsigned int bits = MSG_ReadULEB128();
if (bits & QEX_GV_DEATHMATCH)
cl.deathmatch = MSG_ReadByte ();
InfoBuf_SetStarKey(&cl.serverinfo, "deathmatch", va("%i", MSG_ReadByte ()));
if (bits & QEX_GV_IDEALPITCHSCALE)
MSG_ReadFloat ();
if (bits & QEX_GV_FRICTION)
movevars.friction = MSG_ReadFloat ();
if (bits & QEX_GV_EDGEFRICTION)
movevars.edgefriction = MSG_ReadFloat ();
InfoBuf_SetStarKey(&cl.serverinfo, "pm_edgefriction", va("%g", MSG_ReadFloat ()));
if (bits & QEX_GV_STOPSPEED)
movevars.stopspeed = MSG_ReadFloat ();
if (bits & QEX_GV_MAXVELOCITY)
@ -4112,11 +4112,51 @@ static void CLQEX_ParseServerVars(void)
if (bits & QEX_GV_ACCELERATE)
movevars.accelerate = MSG_ReadFloat ();
if (bits & QEX_GV_CONTROLLERONLY)
/*cl.blockmouse =*/ MSG_ReadByte ();
InfoBuf_SetStarKey(&cl.serverinfo, "nomouse", va("%i", MSG_ReadByte ()));
if (bits & QEX_GV_TIMELIMIT)
InfoBuf_SetStarKey(&cl.serverinfo, "timelimit", va("%g", MSG_ReadFloat ()));
if (bits & QEX_GV_FRAGLIMIT)
InfoBuf_SetStarKey(&cl.serverinfo, "fraglimit", va("%g", MSG_ReadFloat ()));
if (bits & QEX_GV_TEAMPLAY)
InfoBuf_SetStarKey(&cl.serverinfo, "teamplay", va("%i", MSG_ReadByte ()));
if (bits & ~QEX_GV_ALL)
Con_Printf("CLQEX_ParseServerVars: Unknown bits %#x\n", bits & ~QEX_GV_ALL);
CL_CheckServerInfo();
}
static void CLQEX_ParsePrompt(void)
{
int a, count = MSG_ReadByte(), imp;
const char *s;
char message[65536];
size_t ofs = 0;
if (count == 0)
{
SCR_CenterPrint(0, NULL, true);
return;
}
s = MSG_ReadString();
Q_strncatz(message+ofs, "/S/C/.", sizeof(message)-ofs);
ofs += strlen(message+ofs);
TL_Reformat(message+ofs, sizeof(message)-ofs, 1, &s);
ofs += strlen(message+ofs);
Q_strncatz(message+ofs, "\n", sizeof(message)-ofs);
ofs += strlen(message+ofs);
for (a = 0; a < count; a++)
{
s = MSG_ReadString();
imp = MSG_ReadByte();
Q_strncatz(message+ofs, "^[[", sizeof(message)-ofs);
ofs += strlen(message+ofs);
TL_Reformat(message+ofs, sizeof(message)-ofs, 1, &s);
ofs += strlen(message+ofs);
Q_strncatz(message+ofs, va("]\\impulse\\%i^]\n", imp), sizeof(message)-ofs);
ofs += strlen(message+ofs);
}
SCR_CenterPrint(0, message, true);
}
static char *CLQEX_ReadStrings(void)
{
@ -4127,7 +4167,7 @@ static char *CLQEX_ReadStrings(void)
size_t ofs = 0;
for (a = 0; a < count && a < countof(arg); )
{
arg[a++] = MSG_ReadStringBuffer(inputs+ofs, sizeof(inputs)-1);
arg[a++] = MSG_ReadStringBuffer(inputs+ofs, sizeof(inputs)-ofs-1);
ofs += strlen(inputs+ofs)+1;
if (ofs >= sizeof(inputs))
break;
@ -8243,14 +8283,9 @@ void CLNQ_ParseServerMessage (void)
break;
case svc_print:
if(cls.qex && cls.protocol_nq != CPNQ_ID)
s = CLQEX_ReadStrings();
else
{
svcprint:
s = MSG_ReadString ();
}
//fallthrough...
svcprint:
if (*s == 1 || *s == 2)
{
//FIXME: should be using the first char of the line, not the first char of the last segment.
@ -8267,11 +8302,8 @@ void CLNQ_ParseServerMessage (void)
return;
case svc_centerprint:
if (cls.qex && cls.protocol_nq != CPNQ_ID)
s = CLQEX_ReadStrings();
else
s = MSG_ReadString ();
svccentreprint:
#ifdef PLUGINS
if (Plug_CenterPrintMessage(s, destsplit))
#endif
@ -8762,6 +8794,11 @@ void CLNQ_ParseServerMessage (void)
break;
case svcdp_entities:
if (cls.qex)
{ //svcqex_prompt
CLQEX_ParsePrompt();
break;
}
if (cls.signon == 4 - 1)
{ // first update is the final signon stage
cls.signon = 4;
@ -8786,6 +8823,11 @@ void CLNQ_ParseServerMessage (void)
#ifdef CSQC_DAT
case svcdp_csqcentities:
if (cls.qex)
{
s = CLQEX_ReadStrings();
goto svccentreprint;
}
CSQC_ParseEntities(false);
break;
case svcfte_csqcentities_sized:
@ -8847,9 +8889,10 @@ void CLNQ_ParseServerMessage (void)
break;
}
goto badsvc;
case svcqex_print:
case svcqex_locprint:
if (cls.qex)
{ //svcqex_'raw'print
s = CLQEX_ReadStrings();
goto svcprint;
}
goto badsvc;

View file

@ -803,6 +803,15 @@ void Sbar_ShowScores (void)
sb_updates = 0;
}
#ifdef NQPROT
static void Sbar_CTFScores_f(void)
{ //issued via stuffcmds.
// int red = atoi(Cmd_Argv(1));
// int blue = atoi(Cmd_Argv(2));
// int flags = atoi(Cmd_Argv(3)); //base|carried|dropped | base|carried|dropped
}
#endif
#ifdef HEXEN2
static void Sbar_Hexen2InvLeft_f(void)
{
@ -1160,6 +1169,10 @@ void Sbar_Init (void)
Cmd_AddCommand ("+showteamscores", Sbar_ShowTeamScores);
Cmd_AddCommand ("-showteamscores", Sbar_DontShowTeamScores);
#ifdef NQPROT
Cmd_AddCommand ("ctfscores", Sbar_CTFScores_f); //server->client score updates.
#endif
#ifdef HEXEN2
//stuff to get hexen2 working out-of-the-box
Cmd_AddCommand ("invleft", Sbar_Hexen2InvLeft_f);

View file

@ -7994,6 +7994,9 @@ qc_extension_t QSG_Extensions[] = {
{"EXT_DIMENSION_VISIBILITY"},
{"EXT_DIMENSION_PHYSICS"},
{"EXT_DIMENSION_GHOST"},
// {"EX_EXTENDED_EF", NULL, 0,{NULL}, "Provides EF_CANDLELIGHT..."},
// {"EX_MOVETYPE_GIB", NULL, 0,{NULL}, "Adds MOVETYPE_GIB - basically MOVETYPE_BOUNCE with gravity controlled by a cvar instead of just setting the .gravity field..."},
// {"EX_PROMPT", NULL, 3,{"ex_prompt", "ex_promptchoice", "ex_clearprompt"}, "Engine-driven alternative to centerprint menus."},
{"FRIK_FILE", check_notrerelease, 11,{"stof", "fopen","fclose","fgets","fputs","strlen","strcat","substring","stov","strzone","strunzone"}},
{"FTE_CALLTIMEOFDAY", NULL, 1,{"calltimeofday"}, "Replication of mvdsv functionality (call calltimeofday to cause 'timeofday' to be called, with arguments that can be saved off to a global). Generally strftime is simpler to use."},
{"FTE_CSQC_ALTCONSOLES", NULL, 4,{"con_getset", "con_printf", "con_draw", "con_input"}, "The engine tracks multiple consoles. These may or may not be directly visible to the user."},

View file

@ -355,10 +355,16 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#define svcqex_updateping 46 // [byte] slot, [signed_qe] ping
#define svcqex_updatesocial 47 // [byte] slot, 8 bytes of unknown
#define svcqex_updateplinfo 48 // [byte] slot, [leb128] health, [leb128] armour
#define svcqex_print 49 // identical to svc_print, except not broken by qex.
#define svcqex_locprint 49 // uses qe's localised string formatting, otherwise treat as svc_print.
#define svcqex_servervars 50 // [leb128] changedvalues, [???] value...
#define svcqex_seq 51 // [leb128] input sequence ack
#define svcqex_achievement 52 // [string] codename
#define svcqex_chat 53
#define svcqex_levelcompleted 54
#define svcqex_backtolobby 55
#define svcqex_localsound 56
#define svcqex_prompt 57
#define svcqex_loccenterprint 58 // [string] codename
//DP extended svcs
#define svcdp_downloaddata 50
@ -941,7 +947,8 @@ enum {
#define QEX_GV_CONTROLLERONLY (1<<10)
#define QEX_GV_TIMELIMIT (1<<11)
#define QEX_GV_FRAGLIMIT (1<<12)
#define QEX_GV_ALL ((1<<13)-1)
#define QEX_GV_TEAMPLAY (1<<13)
#define QEX_GV_ALL ((1<<14)-1)
//==============================================
//obsolete demo players info

View file

@ -11215,6 +11215,9 @@ static BuiltinList_t BuiltinList[] = { //nq qw h2 ebfs
{"ex_bot_followentity",PF_Fixme, 0, 0, 0,0, D("float(entity bot, entity goal)", "Behaviour is undocumented.")},
{"ex_CheckPlayerEXFlags",PF_CheckPlayerEXFlags_qex,0,0, 0,0, D("float(entity playerEnt)", "Behaviour is undocumented.")},
{"ex_walkpathtogoal",PF_walkpathtogoal_qex,0, 0, 0,0, D("float(float movedist, vector goal)", "Behaviour is undocumented.")},
// {"ex_prompt", PF_prompt_qex, 0, 0, 0,0, D("void(entity player, string text, float numchoices)", "Behaviour is undocumented.")},
// {"ex_promptchoice", PF_promptchoice_qex,0, 0, 0,0, D("void(entity player, string text, float impulse)", "Behaviour is undocumented.")},
// {"ex_clearprompt", PF_clearprompt_qex, 0, 0, 0,0, D("void(entity player)", "Behaviour is undocumented.")},
//End QuakeEx, for now. :(
// Tomaz - QuakeC String Manipulation Begin

View file

@ -465,9 +465,6 @@ void SV_FinalMessage (char *message)
else if (ISNQCLIENT(cl))
{
SZ_Clear (&buf);
if (cl->qex && cl->protocol != SCP_NETQUAKE)
MSG_WriteByte (&buf, svcqex_print); //urgh, ffs.
else
MSG_WriteByte (&buf, svc_print);
MSG_WriteString (&buf, message);
MSG_WriteByte (&buf, svc_disconnect);

View file

@ -184,9 +184,6 @@ void SV_PrintToClient(client_t *cl, int level, const char *string)
case SCP_BJP3:
case SCP_FITZ666:
#ifdef NQPROT
if (cl->qex && cl->protocol != SCP_NETQUAKE)
ClientReliableWrite_Begin (cl, svcqex_print, strlen(string)+3); //urgh!
else
ClientReliableWrite_Begin (cl, svc_print, strlen(string)+3);
if (level == PRINT_CHAT)
ClientReliableWrite_Byte (cl, 1);
@ -1598,16 +1595,8 @@ void SV_WriteCenterPrint(client_t *cl, char *s)
ClientReliableWrite_Byte (cl, pnum);
ClientReliableWrite_Byte (cl, svc_centerprint);
}
else
{
if (cl->qex && cl->protocol != SCP_NETQUAKE)
{
ClientReliableWrite_Begin (cl, svc_centerprint, 4 + strlen(s));
ClientReliableWrite_Short (cl, 1);
}
else
ClientReliableWrite_Begin (cl, svc_centerprint, 2 + strlen(s));
}
ClientReliableWrite_String (cl, s);
#ifdef MVD_RECORDING

View file

@ -856,6 +856,8 @@ void SVNQ_New_f (void)
MSG_WriteFloat (&host_client->netchan.message, timelimit.value);
if (bits & QEX_GV_FRAGLIMIT)
MSG_WriteFloat (&host_client->netchan.message, fraglimit.value);
if (bits & QEX_GV_TEAMPLAY)
MSG_WriteByte (&host_client->netchan.message, teamplay.ival&0xff);
}
// set view
@ -6208,6 +6210,24 @@ static void SVNQ_Protocols_f(void)
}
}
}
static void SV_PlayerExFlags_f(void)
{
int i = atoi(Cmd_Argv(1));
const char *v = "";
switch(i&3)
{
case 0:
v = "";
break;
case 1:
v = "0";
break;
case 2:
v = "1";
break;
}
InfoBuf_SetKey(&host_client->userinfo, "w_switch", v);
}
/*
void SVNQ_ExecuteUserCommand (char *s)
@ -6505,6 +6525,8 @@ ucmd_t nqucmds[] =
{"unmuteall", SV_Voice_UnmuteAll_f}, /*reenables*/
#endif
{"playerexflags", SV_PlayerExFlags_f},
{NULL, NULL}
};
#endif