mirror of
https://git.code.sf.net/p/quake/newtree
synced 2024-11-25 05:21:58 +00:00
clean up the parse code so that only NewTranslation is duplicated, not the whole module.
This commit is contained in:
parent
1e384f48eb
commit
b6127df548
5 changed files with 136 additions and 1396 deletions
|
@ -76,7 +76,7 @@ SV_objects = $(patsubst %.d,%.o,$(SV_dependencies))
|
|||
|
||||
CL_SW_sources=\
|
||||
cl_model.c \
|
||||
cl_parse.c \
|
||||
cl_trans.c \
|
||||
d_edge.c \
|
||||
d_fill.c \
|
||||
d_init.c \
|
||||
|
@ -134,6 +134,7 @@ CL_sources=\
|
|||
cl_main.c \
|
||||
cl_math.S \
|
||||
cl_misc.c \
|
||||
cl_parse.c \
|
||||
cl_pred.c \
|
||||
cl_tent.c \
|
||||
cl_cam.c \
|
||||
|
@ -182,6 +183,7 @@ CL_GLX_sources=\
|
|||
gl_rmisc.c \
|
||||
gl_rsurf.c \
|
||||
gl_screen.c \
|
||||
gl_trans.c \
|
||||
gl_view.c \
|
||||
gl_warp.c \
|
||||
vid_glx.c
|
||||
|
|
|
@ -873,63 +873,6 @@ void CL_ParseClientdata (void)
|
|||
}
|
||||
}
|
||||
|
||||
/*
|
||||
=====================
|
||||
CL_NewTranslation
|
||||
=====================
|
||||
*/
|
||||
void CL_NewTranslation (int slot)
|
||||
{
|
||||
int i, j;
|
||||
int top, bottom;
|
||||
byte *dest, *source;
|
||||
player_info_t *player;
|
||||
char s[512];
|
||||
|
||||
if (slot > MAX_CLIENTS)
|
||||
Sys_Error ("CL_NewTranslation: slot > MAX_CLIENTS");
|
||||
|
||||
player = &cl.players[slot];
|
||||
|
||||
strcpy(s, Info_ValueForKey(player->userinfo, "skin"));
|
||||
COM_StripExtension(s, s);
|
||||
if (player->skin && !stricmp(s, player->skin->name))
|
||||
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;
|
||||
memcpy (dest, vid.colormap, sizeof(player->translations));
|
||||
top = player->topcolor;
|
||||
if (top > 13 || top < 0)
|
||||
top = 13;
|
||||
top *= 16;
|
||||
bottom = player->bottomcolor;
|
||||
if (bottom > 13 || bottom < 0)
|
||||
bottom = 13;
|
||||
bottom *= 16;
|
||||
|
||||
for (i=0 ; i<VID_GRADES ; i++, dest += 256, source+=256)
|
||||
{
|
||||
if (top < 128) // the artists made some backwards ranges. sigh.
|
||||
memcpy (dest + TOP_RANGE, source + top, 16);
|
||||
else
|
||||
for (j=0 ; j<16 ; j++)
|
||||
dest[TOP_RANGE+j] = source[top+15-j];
|
||||
|
||||
if (bottom < 128)
|
||||
memcpy (dest + BOTTOM_RANGE, source + bottom, 16);
|
||||
else
|
||||
for (j=0 ; j<16 ; j++)
|
||||
dest[BOTTOM_RANGE+j] = source[bottom+15-j];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
==============
|
||||
CL_UpdateUserinfo
|
||||
|
|
88
source/cl_trans.c
Normal file
88
source/cl_trans.c
Normal file
|
@ -0,0 +1,88 @@
|
|||
/*
|
||||
cl_parse.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
|
||||
|
||||
$Id$
|
||||
*/
|
||||
// cl_parse.c -- parse a message received from the server
|
||||
|
||||
#include "sys.h"
|
||||
#include "quakedef.h"
|
||||
|
||||
/*
|
||||
=====================
|
||||
CL_NewTranslation
|
||||
=====================
|
||||
*/
|
||||
void CL_NewTranslation (int slot)
|
||||
{
|
||||
int i, j;
|
||||
int top, bottom;
|
||||
byte *dest, *source;
|
||||
player_info_t *player;
|
||||
char s[512];
|
||||
|
||||
if (slot > MAX_CLIENTS)
|
||||
Sys_Error ("CL_NewTranslation: slot > MAX_CLIENTS");
|
||||
|
||||
player = &cl.players[slot];
|
||||
|
||||
strcpy(s, Info_ValueForKey(player->userinfo, "skin"));
|
||||
COM_StripExtension(s, s);
|
||||
if (player->skin && !stricmp(s, player->skin->name))
|
||||
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;
|
||||
memcpy (dest, vid.colormap, sizeof(player->translations));
|
||||
top = player->topcolor;
|
||||
if (top > 13 || top < 0)
|
||||
top = 13;
|
||||
top *= 16;
|
||||
bottom = player->bottomcolor;
|
||||
if (bottom > 13 || bottom < 0)
|
||||
bottom = 13;
|
||||
bottom *= 16;
|
||||
|
||||
for (i=0 ; i<VID_GRADES ; i++, dest += 256, source+=256)
|
||||
{
|
||||
if (top < 128) // the artists made some backwards ranges. sigh.
|
||||
memcpy (dest + TOP_RANGE, source + top, 16);
|
||||
else
|
||||
for (j=0 ; j<16 ; j++)
|
||||
dest[TOP_RANGE+j] = source[top+15-j];
|
||||
|
||||
if (bottom < 128)
|
||||
memcpy (dest + BOTTOM_RANGE, source + bottom, 16);
|
||||
else
|
||||
for (j=0 ; j<16 ; j++)
|
||||
dest[BOTTOM_RANGE+j] = source[bottom+15-j];
|
||||
}
|
||||
}
|
||||
}
|
1338
source/gl_parse.c
1338
source/gl_parse.c
File diff suppressed because it is too large
Load diff
45
source/gl_trans.c
Normal file
45
source/gl_trans.c
Normal file
|
@ -0,0 +1,45 @@
|
|||
/*
|
||||
cl_parse.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
|
||||
|
||||
$Id$
|
||||
*/
|
||||
// cl_parse.c -- parse a message received from the server
|
||||
|
||||
#include "sys.h"
|
||||
#include "quakedef.h"
|
||||
#include "glquake.h"
|
||||
|
||||
/*
|
||||
=====================
|
||||
CL_NewTranslation
|
||||
=====================
|
||||
*/
|
||||
void CL_NewTranslation (int slot)
|
||||
{
|
||||
if (slot > MAX_CLIENTS)
|
||||
Sys_Error ("CL_NewTranslation: slot > MAX_CLIENTS");
|
||||
|
||||
R_TranslatePlayerSkin(slot);
|
||||
}
|
Loading…
Reference in a new issue