2000-05-14 23:04:47 +00:00
|
|
|
/*
|
2000-05-26 17:19:16 +00:00
|
|
|
cl_trans.c
|
2000-05-14 23:04:47 +00:00
|
|
|
|
2000-05-26 17:19:16 +00:00
|
|
|
(description)
|
2000-05-14 23:04:47 +00:00
|
|
|
|
|
|
|
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
|
|
|
|
|
|
|
|
$Id$
|
|
|
|
*/
|
|
|
|
|
2000-05-17 10:03:19 +00:00
|
|
|
#ifdef HAVE_CONFIG_H
|
2000-12-08 06:51:37 +00:00
|
|
|
# include "config.h"
|
2000-05-17 10:03:19 +00:00
|
|
|
#endif
|
2000-05-21 08:24:45 +00:00
|
|
|
|
|
|
|
#include <string.h>
|
2000-05-26 03:55:27 +00:00
|
|
|
#ifdef HAVE_STRINGS_H
|
|
|
|
#include <strings.h>
|
|
|
|
#endif
|
2000-05-14 23:04:47 +00:00
|
|
|
|
2000-12-05 06:33:44 +00:00
|
|
|
#include "host.h"
|
|
|
|
#include "sys.h"
|
|
|
|
#include "vid.h"
|
|
|
|
#include "client.h"
|
|
|
|
|
2000-05-14 23:04:47 +00:00
|
|
|
/*
|
|
|
|
=====================
|
|
|
|
CL_NewTranslation
|
|
|
|
=====================
|
|
|
|
*/
|
2000-12-08 06:51:37 +00:00
|
|
|
void
|
|
|
|
CL_NewTranslation (int slot)
|
2000-05-14 23:04:47 +00:00
|
|
|
{
|
2000-12-08 06:51:37 +00:00
|
|
|
int i, j;
|
|
|
|
int top, bottom;
|
|
|
|
byte *dest, *source;
|
|
|
|
player_info_t *player;
|
|
|
|
char s[512];
|
2000-05-14 23:04:47 +00:00
|
|
|
|
|
|
|
if (slot > MAX_CLIENTS)
|
2000-07-31 12:54:11 +00:00
|
|
|
Host_EndGame ("CL_NewTranslation: slot > MAX_CLIENTS");
|
2000-05-14 23:04:47 +00:00
|
|
|
|
|
|
|
player = &cl.players[slot];
|
|
|
|
|
2000-12-08 06:51:37 +00:00
|
|
|
strcpy (s, Info_ValueForKey (player->userinfo, "skin"));
|
|
|
|
COM_StripExtension (s, s);
|
|
|
|
if (player->skin && !stricmp (s, player->skin->name))
|
2000-05-14 23:04:47 +00:00
|
|
|
player->skin = NULL;
|
|
|
|
|
|
|
|
if (player->_topcolor != player->topcolor ||
|
|
|
|
player->_bottomcolor != player->bottomcolor || !player->skin) {
|
|
|
|
player->_topcolor = player->topcolor;
|
|
|
|
player->_bottomcolor = player->bottomcolor;
|
|
|
|
|
|
|
|
dest = player->translations;
|
|
|
|
source = vid.colormap;
|
2000-12-08 06:51:37 +00:00
|
|
|
memcpy (dest, vid.colormap, sizeof (player->translations));
|
2000-05-14 23:04:47 +00:00
|
|
|
top = player->topcolor;
|
|
|
|
if (top > 13 || top < 0)
|
|
|
|
top = 13;
|
|
|
|
top *= 16;
|
|
|
|
bottom = player->bottomcolor;
|
|
|
|
if (bottom > 13 || bottom < 0)
|
|
|
|
bottom = 13;
|
|
|
|
bottom *= 16;
|
|
|
|
|
2000-12-08 06:51:37 +00:00
|
|
|
for (i = 0; i < VID_GRADES; i++, dest += 256, source += 256) {
|
|
|
|
if (top < 128) // the artists made some backwards
|
|
|
|
// ranges. sigh.
|
2000-05-14 23:04:47 +00:00
|
|
|
memcpy (dest + TOP_RANGE, source + top, 16);
|
|
|
|
else
|
2000-12-08 06:51:37 +00:00
|
|
|
for (j = 0; j < 16; j++)
|
|
|
|
dest[TOP_RANGE + j] = source[top + 15 - j];
|
|
|
|
|
2000-05-14 23:04:47 +00:00
|
|
|
if (bottom < 128)
|
|
|
|
memcpy (dest + BOTTOM_RANGE, source + bottom, 16);
|
|
|
|
else
|
2000-12-08 06:51:37 +00:00
|
|
|
for (j = 0; j < 16; j++)
|
|
|
|
dest[BOTTOM_RANGE + j] = source[bottom + 15 - j];
|
2000-05-14 23:04:47 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|