2001-05-11 22:47:15 +00:00
|
|
|
/*
|
|
|
|
skin.c
|
|
|
|
|
|
|
|
(description)
|
|
|
|
|
|
|
|
Copyright (C) 1996-1997 Id Software, Inc.
|
|
|
|
|
|
|
|
This program is free software; you can redistribute it and/or
|
|
|
|
modify it under the terms of the GNU General Public License
|
|
|
|
as published by the Free Software Foundation; either version 2
|
|
|
|
of the License, or (at your option) any later version.
|
|
|
|
|
|
|
|
This program is distributed in the hope that it will be useful,
|
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
|
|
|
|
|
|
|
See the GNU General Public License for more details.
|
|
|
|
|
|
|
|
You should have received a copy of the GNU General Public License
|
|
|
|
along with this program; if not, write to:
|
|
|
|
|
|
|
|
Free Software Foundation, Inc.
|
|
|
|
59 Temple Place - Suite 330
|
|
|
|
Boston, MA 02111-1307, USA
|
|
|
|
|
|
|
|
*/
|
|
|
|
#ifdef HAVE_CONFIG_H
|
|
|
|
# include "config.h"
|
|
|
|
#endif
|
2003-01-15 15:31:36 +00:00
|
|
|
|
2001-05-11 22:47:15 +00:00
|
|
|
#ifdef HAVE_STRING_H
|
|
|
|
# include <string.h>
|
|
|
|
#endif
|
|
|
|
#ifdef HAVE_STRINGS_H
|
|
|
|
# include <strings.h>
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#include "QF/cmd.h"
|
2001-05-31 03:41:35 +00:00
|
|
|
#include "QF/cvar.h"
|
2001-05-11 22:47:15 +00:00
|
|
|
#include "QF/msg.h"
|
|
|
|
#include "QF/screen.h"
|
2012-01-23 10:24:12 +00:00
|
|
|
#include "QF/skin.h"
|
2007-11-06 10:17:14 +00:00
|
|
|
#include "QF/sys.h"
|
2001-05-11 22:47:15 +00:00
|
|
|
#include "QF/va.h"
|
|
|
|
|
2001-08-28 23:05:45 +00:00
|
|
|
#include "compat.h"
|
2020-06-21 14:15:17 +00:00
|
|
|
|
|
|
|
#include "qw/include/cl_parse.h"
|
|
|
|
#include "qw/include/cl_skin.h"
|
|
|
|
#include "qw/include/client.h"
|
|
|
|
#include "qw/include/host.h"
|
2001-05-11 22:47:15 +00:00
|
|
|
|
|
|
|
cvar_t *noskins; //XXX FIXME
|
|
|
|
cvar_t *skin;
|
|
|
|
cvar_t *topcolor;
|
|
|
|
cvar_t *bottomcolor;
|
|
|
|
|
|
|
|
|
|
|
|
void
|
|
|
|
Skin_NextDownload (void)
|
|
|
|
{
|
|
|
|
int i;
|
2001-08-28 23:05:45 +00:00
|
|
|
player_info_t *sc;
|
2001-05-11 22:47:15 +00:00
|
|
|
|
2002-06-25 17:07:52 +00:00
|
|
|
if (cls.state == ca_disconnected)
|
|
|
|
return;
|
|
|
|
|
2001-05-11 22:47:15 +00:00
|
|
|
if (cls.downloadnumber == 0) {
|
2007-11-06 10:17:14 +00:00
|
|
|
Sys_Printf ("Checking skins...\n");
|
2001-05-23 06:33:23 +00:00
|
|
|
CL_UpdateScreen (realtime);
|
2001-05-11 22:47:15 +00:00
|
|
|
}
|
|
|
|
cls.downloadtype = dl_skin;
|
|
|
|
|
|
|
|
for (; cls.downloadnumber != MAX_CLIENTS; cls.downloadnumber++) {
|
|
|
|
sc = &cl.players[cls.downloadnumber];
|
2012-05-21 14:04:47 +00:00
|
|
|
if (!sc->name || !sc->name->value[0])
|
2001-05-11 22:47:15 +00:00
|
|
|
continue;
|
2012-01-23 07:16:30 +00:00
|
|
|
//XXX Skin_Find (sc);
|
2001-05-11 22:47:15 +00:00
|
|
|
if (noskins->int_val) //XXX FIXME
|
|
|
|
continue;
|
2021-01-31 07:01:20 +00:00
|
|
|
//XXX if (!CL_CheckOrDownloadFile (va (0, "skins/%s.pcx",
|
|
|
|
// sc->skin->name)))
|
2012-01-23 07:16:30 +00:00
|
|
|
//XXX return; // started a download
|
2001-05-11 22:47:15 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
cls.downloadtype = dl_none;
|
|
|
|
|
|
|
|
// now load them in for real
|
|
|
|
for (i = 0; i < MAX_CLIENTS; i++) {
|
|
|
|
sc = &cl.players[i];
|
2012-05-21 14:04:47 +00:00
|
|
|
if (!sc->name || !sc->name->value[0])
|
2001-05-11 22:47:15 +00:00
|
|
|
continue;
|
2012-01-23 07:16:30 +00:00
|
|
|
//XXX Skin_Find (sc);
|
|
|
|
//XXX Skin_Cache (sc->skin);
|
|
|
|
//XXX sc->skin = NULL;
|
2001-05-11 22:47:15 +00:00
|
|
|
}
|
|
|
|
|
2007-03-23 14:52:10 +00:00
|
|
|
if (cls.state != ca_active) {
|
|
|
|
if (!cls.demoplayback) {
|
|
|
|
// get next signon phase
|
|
|
|
MSG_WriteByte (&cls.netchan.message, clc_stringcmd);
|
2012-11-14 11:54:35 +00:00
|
|
|
MSG_WriteString (&cls.netchan.message,
|
2021-01-31 07:01:20 +00:00
|
|
|
va (0, "begin %i", cl.servercount));
|
2007-03-23 14:52:10 +00:00
|
|
|
Cache_Report (); // print remaining memory
|
|
|
|
}
|
2007-03-18 21:56:14 +00:00
|
|
|
CL_SetState (ca_active);
|
2001-05-11 22:47:15 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
CL_Skins_f
|
|
|
|
|
|
|
|
Refind all skins, downloading if needed.
|
|
|
|
*/
|
2012-01-23 07:16:30 +00:00
|
|
|
static void
|
2001-05-11 22:47:15 +00:00
|
|
|
CL_Skins_f (void)
|
|
|
|
{
|
2012-01-23 07:16:30 +00:00
|
|
|
//XXX Skin_Flush ();
|
2002-06-25 17:07:52 +00:00
|
|
|
|
|
|
|
if (cls.state == ca_disconnected)
|
|
|
|
return;
|
|
|
|
|
2001-05-11 22:47:15 +00:00
|
|
|
cls.downloadnumber = 0;
|
|
|
|
cls.downloadtype = dl_skin;
|
|
|
|
Skin_NextDownload ();
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
CL_AllSkins_f
|
|
|
|
|
|
|
|
Sets all skins to one specific one
|
|
|
|
*/
|
2012-01-23 07:16:30 +00:00
|
|
|
static void
|
2001-05-11 22:47:15 +00:00
|
|
|
CL_AllSkins_f (void)
|
|
|
|
{
|
2002-06-25 17:07:52 +00:00
|
|
|
if (Cmd_Argc () == 2) {
|
2012-01-23 07:16:30 +00:00
|
|
|
//XXX strcpy (allskins, Cmd_Argv (1));
|
2002-06-25 17:07:52 +00:00
|
|
|
} else if (Cmd_Argc () == 1) {
|
2007-11-06 10:17:14 +00:00
|
|
|
Sys_Printf ("clearing allskins\n");
|
2012-01-23 07:16:30 +00:00
|
|
|
//XXX allskins[0] = 0;
|
2002-06-25 17:07:52 +00:00
|
|
|
} else {
|
2007-11-06 10:17:14 +00:00
|
|
|
Sys_Printf ("Usage: allskins [name]\n");
|
2002-06-25 17:07:52 +00:00
|
|
|
return;
|
|
|
|
}
|
2001-05-11 22:47:15 +00:00
|
|
|
CL_Skins_f ();
|
|
|
|
}
|
|
|
|
|
2003-01-06 18:28:13 +00:00
|
|
|
static void
|
2001-05-11 22:47:15 +00:00
|
|
|
CL_Color_f (void)
|
|
|
|
{
|
|
|
|
// just for quake compatability...
|
|
|
|
char num[16];
|
2001-08-28 23:05:45 +00:00
|
|
|
int top, bottom;
|
2001-05-11 22:47:15 +00:00
|
|
|
|
|
|
|
if (Cmd_Argc () == 1) {
|
2007-11-06 10:17:14 +00:00
|
|
|
Sys_Printf ("\"color\" is \"%s %s\"\n",
|
2001-05-11 22:47:15 +00:00
|
|
|
Info_ValueForKey (cls.userinfo, "topcolor"),
|
|
|
|
Info_ValueForKey (cls.userinfo, "bottomcolor"));
|
2007-11-06 10:17:14 +00:00
|
|
|
Sys_Printf ("color <0-13> [0-13]\n");
|
2001-05-11 22:47:15 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (Cmd_Argc () == 2)
|
|
|
|
top = bottom = atoi (Cmd_Argv (1));
|
|
|
|
else {
|
|
|
|
top = atoi (Cmd_Argv (1));
|
|
|
|
bottom = atoi (Cmd_Argv (2));
|
|
|
|
}
|
|
|
|
|
|
|
|
top &= 15;
|
|
|
|
if (top > 13)
|
|
|
|
top = 13;
|
|
|
|
bottom &= 15;
|
|
|
|
if (bottom > 13)
|
|
|
|
bottom = 13;
|
|
|
|
|
|
|
|
snprintf (num, sizeof (num), "%i", top);
|
|
|
|
Cvar_Set (topcolor, num);
|
|
|
|
snprintf (num, sizeof (num), "%i", bottom);
|
|
|
|
Cvar_Set (bottomcolor, num);
|
|
|
|
}
|
|
|
|
|
2001-11-04 19:06:50 +00:00
|
|
|
static void
|
|
|
|
skin_f (cvar_t *var)
|
|
|
|
{
|
|
|
|
char *s = Hunk_TempAlloc (strlen (var->string) + 1);
|
2003-02-14 19:46:07 +00:00
|
|
|
QFS_StripExtension (var->string, s);
|
2001-11-04 19:06:50 +00:00
|
|
|
Cvar_Set (var, s);
|
|
|
|
Cvar_Info (var);
|
|
|
|
}
|
|
|
|
|
2001-05-11 22:47:15 +00:00
|
|
|
void
|
2012-01-23 07:16:30 +00:00
|
|
|
CL_Skin_Init (void)
|
2001-05-11 22:47:15 +00:00
|
|
|
{
|
2012-01-23 07:16:30 +00:00
|
|
|
Cmd_AddCommand ("skins", CL_Skins_f, "Download all skins that are "
|
|
|
|
"currently in use");
|
|
|
|
Cmd_AddCommand ("allskins", CL_AllSkins_f, "Force all player skins to "
|
|
|
|
"one skin");
|
|
|
|
Cmd_AddCommand ("color", CL_Color_f, "The pant and shirt color (color "
|
|
|
|
"shirt pants) Note that if only shirt color is given, "
|
|
|
|
"pants will match");
|
|
|
|
|
2002-03-20 16:13:32 +00:00
|
|
|
noskins = Cvar_Get ("noskins", "0", CVAR_ARCHIVE, NULL, //XXX FIXME
|
2001-05-11 22:47:15 +00:00
|
|
|
"set to 1 to not download new skins");
|
2001-11-04 19:06:50 +00:00
|
|
|
skin = Cvar_Get ("skin", "", CVAR_ARCHIVE | CVAR_USERINFO, skin_f,
|
2001-05-14 03:08:24 +00:00
|
|
|
"Players skin");
|
2001-05-11 22:47:15 +00:00
|
|
|
topcolor = Cvar_Get ("topcolor", "0", CVAR_ARCHIVE | CVAR_USERINFO,
|
2001-05-14 03:08:24 +00:00
|
|
|
Cvar_Info, "Players color on top");
|
2001-05-11 22:47:15 +00:00
|
|
|
bottomcolor = Cvar_Get ("bottomcolor", "0", CVAR_ARCHIVE | CVAR_USERINFO,
|
2001-05-14 03:08:24 +00:00
|
|
|
Cvar_Info, "Players color on bottom");
|
2001-05-11 22:47:15 +00:00
|
|
|
}
|