alias autoswitch "qc_cmd_cmd autoswitch ${* ?}" // Whether or not to switch automatically when getting a better weapon
alias checkfail "qc_cmd_cmd checkfail ${* ?}" // Report if a client-side check failed
alias clientversion "qc_cmd_cmd clientversion ${* ?}" // Release version of the game
+//alias getserverpic "qc_cmd_cmd getserverpic ${* ?}" // Retrieve server banner from the server
//alias mv_getpicture "qc_cmd_cmd mv_getpicture ${* ?}" // Retrieve mapshot picture from the server
alias join "qc_cmd_cmd join ${* ?}" // Become a player in the game
alias ready "qc_cmd_cmd ready ${* ?}" // Qualify as ready to end warmup stage (or restart server if allowed)
if(welcomedialog_args)
strunzone(welcomedialog_args);
welcomedialog_args = strcat("name \"", ReadString(), "\"");
- welcomedialog_args = strcat(welcomedialog_args, "ip \"", ReadString(), "\"");
- welcomedialog_args = strcat(welcomedialog_args, "motd \"", MakeConsoleSafe(strreplace("\n", "\\n", ReadString())), "\"");
+ welcomedialog_args = strcat(welcomedialog_args, " ip \"", ReadString(), "\"");
+ welcomedialog_args = strcat(welcomedialog_args, " motd \"", MakeConsoleSafe(strreplace("\n", "\\n", ReadString())), "\"");
string pic = ReadString();
- if(pic != "")
- welcomedialog_args = strcat(welcomedialog_args, "pic \"", pic, "\"");
- localcmd("\nmenu_cmd directmenu Welcome ", welcomedialog_args, "\n");
- welcomedialog_args = string_null;
- return;
+ if(pic == "" || PreviewExists(pic) )
+ {
+ if(pic != "")
+ welcomedialog_args = strcat(welcomedialog_args, " pic \"", pic, "\"");
+ localcmd("\nmenu_cmd directmenu Welcome ", welcomedialog_args, "\n");
+ welcomedialog_args = string_null;
+ return;
+ } else {
+ welcomedialog_args = strzone(welcomedialog_args);
+ print(_("Requesting server banner...\n"));
+ localcmd("\ncmd getserverpic\n");
+ }
+}
+
+void Net_ReadServerInfo_Pic()
+{
+ if(welcomedialog_args)
+ {
+ localcmd("\nmenu_cmd directmenu Welcome ", strcat(welcomedialog_args, " pic \"", ReadPicture(), "\""), "\n");
+ strunzone(welcomedialog_args);
+ welcomedialog_args = string_null;
+ }
+ else // just get the image, we don't want to display the welcome dialog
+ ReadPicture();
}
// CSQC_Parse_TempEntity : Handles all temporary entity network data in the CSQC layer.
Net_ReadServerInfo();
bHandled = true;
break;
+ case TE_CSQC_SERVERINFO_PIC:
+ Net_ReadServerInfo_Pic();
+ bHandled = true;
+ break;
default:
// No special logic for this temporary entity; return 0 so the engine can handle it
bHandled = false;
const float TE_CSQC_VEHICLESETUP = 112;
const float TE_CSQC_SVNOTICE = 113;
const float TE_CSQC_SERVERINFO = 114;
+const float TE_CSQC_SERVERINFO_PIC = 115;
const float RACE_NET_CHECKPOINT_HIT_QUALIFYING = 0; // byte checkpoint, short time, short recordtime, string recordholder
const float RACE_NET_CHECKPOINT_CLEAR = 1;
self.parm_idlesince = max(self.parm_idlesince, time - sv_maxidle + 60);
}
-void MOTD_send()
+void serverinfo_welcomemessage_send()
{
msg_entity = self;
WriteByte(MSG_ONE, SVC_TEMPENTITY);
WriteString(MSG_ONE, "128.03.192.999"); // FIXME: send the real server ip
WriteString(MSG_ONE, autocvar_hostname);
WriteString(MSG_ONE, getwelcomemessage());
+ WriteString(MSG_ONE, strcat("128.03.192.999", "/banner"));
+}
+
+void serverinfo_pic_send()
+{
+ msg_entity = self;
+ WriteByte(MSG_ONE, SVC_TEMPENTITY);
+ WriteByte(MSG_ONE, TE_CSQC_SERVERINFO_PIC);
+ WritePicture(MSG_ONE, strcat("128.03.192.999", "/banner"), 3072);
}
/*
if(IS_REAL_CLIENT(self))
{
- MOTD_send();
+ serverinfo_welcomemessage_send();
sv_notice_join();
}
}
}
+void ClientCommand_getserverpic(float request) // internal command, used only by code
+{
+ switch(request)
+ {
+ case CMD_REQUEST_COMMAND:
+ {
+ serverinfo_pic_send();
+ return;
+ }
+
+ default:
+ case CMD_REQUEST_USAGE:
+ {
+ sprint(self, "\nUsage:^3 cmd getserverpic\n");
+ sprint(self, " No arguments required.\n");
+ return;
+ }
+ }
+}
+
void ClientCommand_mv_getpicture(float request, float argc) // internal command, used only by code
{
switch(request)
CLIENT_COMMAND("checkfail", ClientCommand_checkfail(request, command), "Report if a client-side check failed") \
CLIENT_COMMAND("clientversion", ClientCommand_clientversion(request, arguments), "Release version of the game") \
CLIENT_COMMAND("mv_getpicture", ClientCommand_mv_getpicture(request, arguments), "Retrieve mapshot picture from the server") \
+ CLIENT_COMMAND("getserverpic", ClientCommand_getserverpic(request), "Retrieve server banner from the server") \
CLIENT_COMMAND("join", ClientCommand_join(request), "Become a player in the game") \
CLIENT_COMMAND("ready", ClientCommand_ready(request), "Qualify as ready to end warmup stage (or restart server if allowed)") \
CLIENT_COMMAND("say", ClientCommand_say(request, arguments, command), "Print a message to chat to all players") \
// exempt commands which are not subject to floodcheck
case "begin": break; // handled by engine in host_cmd.c
case "download": break; // handled by engine in cl_parse.c
+ case "getserverpic": break; // handled by server in this file
case "mv_getpicture": break; // handled by server in this file
case "pause": break; // handled by engine in host_cmd.c
case "prespawn": break; // handled by engine in host_cmd.c