mirror of
https://git.code.sf.net/p/quake/quakeforge-old
synced 2024-11-25 13:21:04 +00:00
Merged R_TranslatePlayerSkin() in gl_rmisc.c -- rest, misc. fixes, mostly
whitespace and spelling.
This commit is contained in:
parent
db60e81cee
commit
da0a5cd041
8 changed files with 167 additions and 304 deletions
|
@ -55,12 +55,14 @@
|
||||||
#include <vid.h>
|
#include <vid.h>
|
||||||
#include <sys.h>
|
#include <sys.h>
|
||||||
|
|
||||||
static void (*event_handlers[LASTEvent])(XEvent *);
|
static void (*event_handlers[LASTEvent]) (XEvent *);
|
||||||
qboolean oktodraw = false;
|
qboolean oktodraw = false;
|
||||||
int x_shmeventtype;
|
int x_shmeventtype;
|
||||||
Display *x_disp = NULL;
|
|
||||||
static int x_disp_ref_count = 0;
|
static int x_disp_ref_count = 0;
|
||||||
|
|
||||||
|
Display *x_disp = NULL;
|
||||||
|
|
||||||
qboolean
|
qboolean
|
||||||
x11_add_event(int event, void (*event_handler)(XEvent *))
|
x11_add_event(int event, void (*event_handler)(XEvent *))
|
||||||
{
|
{
|
||||||
|
@ -88,12 +90,12 @@ x11_del_event(int event, void (*event_handler)(XEvent *))
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
x11_process_event(void)
|
x11_process_event( void )
|
||||||
{
|
{
|
||||||
XEvent x_event;
|
XEvent x_event;
|
||||||
|
|
||||||
XNextEvent(x_disp, &x_event);
|
XNextEvent(x_disp, &x_event);
|
||||||
if (x_event.type >= LASTEvent) {
|
if ( x_event.type >= LASTEvent ) {
|
||||||
// FIXME: KLUGE!!!!!!
|
// FIXME: KLUGE!!!!!!
|
||||||
if (x_event.type == x_shmeventtype)
|
if (x_event.type == x_shmeventtype)
|
||||||
oktodraw = 1;
|
oktodraw = 1;
|
||||||
|
@ -107,7 +109,7 @@ void
|
||||||
x11_process_events(void)
|
x11_process_events(void)
|
||||||
{
|
{
|
||||||
/* Get events from X server. */
|
/* Get events from X server. */
|
||||||
while (XPending(x_disp)) {
|
while ( XPending( x_disp )) {
|
||||||
x11_process_event();
|
x11_process_event();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -116,7 +118,8 @@ x11_process_events(void)
|
||||||
// Tragic death handler
|
// Tragic death handler
|
||||||
// ========================================================================
|
// ========================================================================
|
||||||
|
|
||||||
static void TragicDeath(int signal_num)
|
static void
|
||||||
|
TragicDeath(int signal_num)
|
||||||
{
|
{
|
||||||
//XCloseDisplay(x_disp);
|
//XCloseDisplay(x_disp);
|
||||||
VID_Shutdown();
|
VID_Shutdown();
|
||||||
|
@ -124,34 +127,35 @@ static void TragicDeath(int signal_num)
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
x11_open_display(void)
|
x11_open_display( void )
|
||||||
{
|
{
|
||||||
struct sigaction sa;
|
struct sigaction sa;
|
||||||
|
|
||||||
if (!x_disp) {
|
if ( !x_disp ) {
|
||||||
x_disp = XOpenDisplay(0);
|
x_disp = XOpenDisplay( NULL );
|
||||||
if (!x_disp) {
|
if ( !x_disp ) {
|
||||||
Sys_Error("VID: Could not open display [%s]\n", XDisplayName(0));
|
Sys_Error("x11_open_display: Could not open display [%s]\n", XDisplayName( NULL ));
|
||||||
}
|
}
|
||||||
|
|
||||||
// catch signals
|
// catch signals
|
||||||
sigaction(SIGINT, 0, &sa);
|
sigaction(SIGINT, 0, &sa);
|
||||||
|
sigaction(SIGTERM, 0, &sa);
|
||||||
sa.sa_handler = TragicDeath;
|
sa.sa_handler = TragicDeath;
|
||||||
sigaction(SIGINT, &sa, 0);
|
sigaction(SIGINT, &sa, 0);
|
||||||
sigaction(SIGTERM, &sa, 0);
|
sigaction(SIGTERM, &sa, 0);
|
||||||
|
|
||||||
// for debugging only
|
// for debugging only
|
||||||
XSynchronize(x_disp, True);
|
XSynchronize( x_disp, True );
|
||||||
} else {
|
} else {
|
||||||
x_disp_ref_count++;
|
x_disp_ref_count++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
x11_close_display(void)
|
x11_close_display( void )
|
||||||
{
|
{
|
||||||
if (!--x_disp_ref_count) {
|
if (!--x_disp_ref_count) {
|
||||||
XCloseDisplay(x_disp);
|
XCloseDisplay( x_disp );
|
||||||
x_disp = NULL;
|
x_disp = NULL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -34,7 +34,7 @@
|
||||||
#include <qtypes.h>
|
#include <qtypes.h>
|
||||||
#include <X11/Xlib.h>
|
#include <X11/Xlib.h>
|
||||||
|
|
||||||
void GetEvent();
|
void GetEvent( void );
|
||||||
|
|
||||||
extern Display *x_disp;
|
extern Display *x_disp;
|
||||||
extern Window x_win;
|
extern Window x_win;
|
||||||
|
@ -42,11 +42,11 @@ extern qboolean doShm;
|
||||||
extern int x_shmeventtype;
|
extern int x_shmeventtype;
|
||||||
extern qboolean oktodraw;
|
extern qboolean oktodraw;
|
||||||
|
|
||||||
qboolean x11_add_event(int event, void (*event_handler)(XEvent *));
|
qboolean x11_add_event( int event, void (*event_handler)(XEvent *));
|
||||||
qboolean x11_del_event(int event, void (*event_handler)(XEvent *));
|
qboolean x11_del_event( int event, void (*event_handler)(XEvent *));
|
||||||
void x11_process_event(void);
|
void x11_process_event( void );
|
||||||
void x11_process_events(void);
|
void x11_process_events( void );
|
||||||
void x11_open_display(void);
|
void x11_open_display( void );
|
||||||
void x11_close_display(void);
|
void x11_close_display( void );
|
||||||
|
|
||||||
#endif // __CONTEXT_X11_H__
|
#endif // __CONTEXT_X11_H__
|
||||||
|
|
|
@ -1187,7 +1187,7 @@ void Mod_LoadBrushModel (model_t *mod, void *buffer)
|
||||||
|
|
||||||
i = LittleLong (header->version);
|
i = LittleLong (header->version);
|
||||||
if (!(i == BSPVERSION || i == CBSPVERSION))
|
if (!(i == BSPVERSION || i == CBSPVERSION))
|
||||||
Sys_Error ("Mod_LoadBrushModel: %s has unkonwn version %i",
|
Sys_Error ("Mod_LoadBrushModel: %s has unknown version %i",
|
||||||
mod->name, i);
|
mod->name, i);
|
||||||
|
|
||||||
bspver = i; // save BSP version for later use
|
bspver = i; // save BSP version for later use
|
||||||
|
@ -1556,6 +1556,7 @@ void Mod_LoadAliasModel (model_t *mod, void *buffer)
|
||||||
daliasframetype_t *pframetype;
|
daliasframetype_t *pframetype;
|
||||||
daliasskintype_t *pskintype;
|
daliasskintype_t *pskintype;
|
||||||
int start, end, total;
|
int start, end, total;
|
||||||
|
|
||||||
#ifdef QUAKEWORLD
|
#ifdef QUAKEWORLD
|
||||||
if (!strcmp(loadmodel->name, "progs/player.mdl") ||
|
if (!strcmp(loadmodel->name, "progs/player.mdl") ||
|
||||||
!strcmp(loadmodel->name, "progs/eyes.mdl")) {
|
!strcmp(loadmodel->name, "progs/eyes.mdl")) {
|
||||||
|
|
|
@ -576,9 +576,7 @@ R_DrawAliasModel (entity_t *e) {
|
||||||
#else
|
#else
|
||||||
if (currententity->colormap != vid.colormap && !gl_nocolors->value) {
|
if (currententity->colormap != vid.colormap && !gl_nocolors->value) {
|
||||||
i = currententity - cl_entities;
|
i = currententity - cl_entities;
|
||||||
if (i >= 1 && i<=cl.maxclients
|
if (i >= 1 && i <= cl.maxclients )
|
||||||
/*&& !strcmp (currententity->model->name,
|
|
||||||
"progs/player.mdl")*/ )
|
|
||||||
GL_Bind(playertextures - 1 + i);
|
GL_Bind(playertextures - 1 + i);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -262,15 +262,12 @@ void R_Init (void)
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
===============
|
R_TranslatePlayerSkin
|
||||||
R_TranslatePlayerSkin
|
|
||||||
|
|
||||||
Translates a skin texture by the per-player color lookup
|
Translate a skin texture by the per-player color lookup
|
||||||
===============
|
|
||||||
*/
|
*/
|
||||||
void R_TranslatePlayerSkin (int playernum)
|
void R_TranslatePlayerSkin (int playernum)
|
||||||
{
|
{
|
||||||
#ifdef QUAKEWORLD
|
|
||||||
int top, bottom;
|
int top, bottom;
|
||||||
byte translate[256];
|
byte translate[256];
|
||||||
unsigned translate32[256];
|
unsigned translate32[256];
|
||||||
|
@ -282,18 +279,26 @@ void R_TranslatePlayerSkin (int playernum)
|
||||||
int tinwidth, tinheight;
|
int tinwidth, tinheight;
|
||||||
byte *inrow;
|
byte *inrow;
|
||||||
unsigned frac, fracstep;
|
unsigned frac, fracstep;
|
||||||
|
#ifdef QUAKEWORLD
|
||||||
player_info_t *player;
|
player_info_t *player;
|
||||||
extern byte player_8bit_texels[320*200];
|
extern byte player_8bit_texels[320*200];
|
||||||
char s[512];
|
char s[512];
|
||||||
|
#else
|
||||||
|
aliashdr_t *paliashdr;
|
||||||
|
model_t *model;
|
||||||
|
int s;
|
||||||
|
#endif
|
||||||
|
|
||||||
GL_DisableMultitexture();
|
GL_DisableMultitexture();
|
||||||
|
|
||||||
|
#ifdef QUAKEWORLD
|
||||||
player = &cl.players[playernum];
|
player = &cl.players[playernum];
|
||||||
if (!player->name[0])
|
if (!player->name[0])
|
||||||
return;
|
return;
|
||||||
|
|
||||||
strcpy(s, Info_ValueForKey(player->userinfo, "skin"));
|
strcpy(s, Info_ValueForKey(player->userinfo, "skin"));
|
||||||
COM_StripExtension(s, s);
|
COM_StripExtension(s, s);
|
||||||
|
|
||||||
if (player->skin && !stricmp(s, player->skin->name))
|
if (player->skin && !stricmp(s, player->skin->name))
|
||||||
player->skin = NULL;
|
player->skin = NULL;
|
||||||
|
|
||||||
|
@ -302,18 +307,21 @@ void R_TranslatePlayerSkin (int playernum)
|
||||||
player->_topcolor = player->topcolor;
|
player->_topcolor = player->topcolor;
|
||||||
player->_bottomcolor = player->bottomcolor;
|
player->_bottomcolor = player->bottomcolor;
|
||||||
|
|
||||||
top = player->topcolor;
|
top = bound (0, player->topcolor, 13);
|
||||||
bottom = player->bottomcolor;
|
bottom = bound (0, player->bottomcolor, 13);
|
||||||
top = (top < 0) ? 0 : ((top > 13) ? 13 : top);
|
|
||||||
bottom = (bottom < 0) ? 0 : ((bottom > 13) ? 13 : bottom);
|
|
||||||
top *= 16;
|
top *= 16;
|
||||||
bottom *= 16;
|
bottom *= 16;
|
||||||
|
|
||||||
|
#elif UQUAKE
|
||||||
|
{
|
||||||
|
top = cl.scores[playernum].colors & 0xf0;
|
||||||
|
bottom = (cl.scores[playernum].colors &15)<<4;
|
||||||
|
#endif
|
||||||
|
|
||||||
for (i=0 ; i<256 ; i++)
|
for (i=0 ; i<256 ; i++)
|
||||||
translate[i] = i;
|
translate[i] = i;
|
||||||
|
|
||||||
for (i=0 ; i<16 ; i++)
|
for (i=0 ; i<16 ; i++) {
|
||||||
{
|
|
||||||
if (top < 128) // the artists made some backwards ranges. sigh.
|
if (top < 128) // the artists made some backwards ranges. sigh.
|
||||||
translate[TOP_RANGE+i] = top+i;
|
translate[TOP_RANGE+i] = top+i;
|
||||||
else
|
else
|
||||||
|
@ -328,63 +336,69 @@ void R_TranslatePlayerSkin (int playernum)
|
||||||
//
|
//
|
||||||
// locate the original skin pixels
|
// locate the original skin pixels
|
||||||
//
|
//
|
||||||
|
|
||||||
|
#ifdef QUAKEWORLD
|
||||||
// real model width
|
// real model width
|
||||||
tinwidth = 296;
|
tinwidth = 296;
|
||||||
tinheight = 194;
|
tinheight = 194;
|
||||||
|
|
||||||
if (!player->skin)
|
if (!player->skin)
|
||||||
Skin_Find(player);
|
Skin_Find(player);
|
||||||
if ((original = Skin_Cache(player->skin)) != NULL) {
|
|
||||||
//skin data width
|
original = Skin_Cache(player->skin);
|
||||||
|
if (original) { // skin data width
|
||||||
inwidth = 320;
|
inwidth = 320;
|
||||||
inheight = 200;
|
inheight = 200;
|
||||||
} else {
|
} else {
|
||||||
original = player_8bit_texels;
|
original = player_8bit_texels;
|
||||||
inwidth = 296;
|
inwidth = tinwidth;
|
||||||
inheight = 194;
|
inheight = tinheight;
|
||||||
}
|
}
|
||||||
|
#else // UQUAKE
|
||||||
|
currententity = &cl_entities[1+playernum];
|
||||||
|
model = currententity->model;
|
||||||
|
|
||||||
|
if ( !model )
|
||||||
|
return; // player doesn't have a model yet
|
||||||
|
if ( model->type != mod_alias )
|
||||||
|
return; // only translate skins on alias models
|
||||||
|
|
||||||
|
paliashdr = (aliashdr_t *)Mod_Extradata (model);
|
||||||
|
s = paliashdr->skinwidth * paliashdr->skinheight;
|
||||||
|
if (currententity->skinnum < 0 || currententity->skinnum >= paliashdr->numskins) {
|
||||||
|
Con_Printf("(%d): Invalid player skin #%d\n", playernum, currententity->skinnum);
|
||||||
|
original = (byte *)paliashdr + paliashdr->texels[0];
|
||||||
|
} else
|
||||||
|
original = (byte *)paliashdr + paliashdr->texels[currententity->skinnum];
|
||||||
|
if (s & 3)
|
||||||
|
Sys_Error ("R_TranslateSkin: s&3");
|
||||||
|
|
||||||
|
tinwidth = inwidth = paliashdr->skinwidth;
|
||||||
|
tinheight = inheight = paliashdr->skinheight;
|
||||||
|
#endif
|
||||||
|
|
||||||
// because this happens during gameplay, do it fast
|
// because this happens during gameplay, do it fast
|
||||||
// instead of sending it through gl_upload 8
|
// instead of sending it through gl_upload 8
|
||||||
GL_Bind(playertextures + playernum);
|
GL_Bind(playertextures + playernum);
|
||||||
|
|
||||||
#if 0
|
scaled_width = min (gl_max_size->value, 512);
|
||||||
s = 320*200;
|
scaled_height = min (gl_max_size->value, 256);
|
||||||
byte translated[320*200];
|
|
||||||
|
|
||||||
for (i=0 ; i<s ; i+=4)
|
|
||||||
{
|
|
||||||
translated[i] = translate[original[i]];
|
|
||||||
translated[i+1] = translate[original[i+1]];
|
|
||||||
translated[i+2] = translate[original[i+2]];
|
|
||||||
translated[i+3] = translate[original[i+3]];
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// don't mipmap these, because it takes too long
|
|
||||||
GL_Upload8 (translated, paliashdr->skinwidth, paliashdr->skinheight,
|
|
||||||
false, false, true);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
scaled_width = gl_max_size->value < 512 ? gl_max_size->value : 512;
|
|
||||||
scaled_height = gl_max_size->value < 256 ? gl_max_size->value : 256;
|
|
||||||
// allow users to crunch sizes down even more if they want
|
// allow users to crunch sizes down even more if they want
|
||||||
scaled_width >>= (int)gl_playermip->value;
|
scaled_width >>= (int)gl_playermip->value;
|
||||||
scaled_height >>= (int)gl_playermip->value;
|
scaled_height >>= (int)gl_playermip->value;
|
||||||
|
|
||||||
if (VID_Is8bit()) { // 8bit texture upload
|
if ( VID_Is8bit() ) { // 8bit texture upload
|
||||||
byte *out2;
|
byte *out2;
|
||||||
|
|
||||||
out2 = (byte *)pixels;
|
out2 = (byte *)pixels;
|
||||||
memset(pixels, 0, sizeof(pixels));
|
memset(pixels, 0, sizeof(pixels));
|
||||||
fracstep = tinwidth*0x10000/scaled_width;
|
fracstep = tinwidth*0x10000/scaled_width;
|
||||||
for (i=0 ; i<scaled_height ; i++, out2 += scaled_width)
|
|
||||||
{
|
for (i=0 ; i < scaled_height ; i++, out2 += scaled_width) {
|
||||||
inrow = original + inwidth*(i*tinheight/scaled_height);
|
inrow = original + inwidth*(i*tinheight/scaled_height);
|
||||||
frac = fracstep >> 1;
|
frac = fracstep >> 1;
|
||||||
for (j=0 ; j<scaled_width ; j+=4)
|
for (j=0 ; j < scaled_width ; j += 4) {
|
||||||
{
|
|
||||||
out2[j] = translate[inrow[frac>>16]];
|
out2[j] = translate[inrow[frac>>16]];
|
||||||
frac += fracstep;
|
frac += fracstep;
|
||||||
out2[j+1] = translate[inrow[frac>>16]];
|
out2[j+1] = translate[inrow[frac>>16]];
|
||||||
|
@ -397,21 +411,17 @@ void R_TranslatePlayerSkin (int playernum)
|
||||||
}
|
}
|
||||||
|
|
||||||
GL_Upload8_EXT ((byte *)pixels, scaled_width, scaled_height, false, false);
|
GL_Upload8_EXT ((byte *)pixels, scaled_width, scaled_height, false, false);
|
||||||
return;
|
} else {
|
||||||
}
|
for (i=0 ; i < 256 ; i++)
|
||||||
|
|
||||||
for (i=0 ; i<256 ; i++)
|
|
||||||
translate32[i] = d_8to24table[translate[i]];
|
translate32[i] = d_8to24table[translate[i]];
|
||||||
|
|
||||||
out = pixels;
|
out = pixels;
|
||||||
memset(pixels, 0, sizeof(pixels));
|
memset(pixels, 0, sizeof(pixels));
|
||||||
|
|
||||||
fracstep = tinwidth*0x10000/scaled_width;
|
fracstep = tinwidth*0x10000/scaled_width;
|
||||||
for (i=0 ; i<scaled_height ; i++, out += scaled_width)
|
for ( i=0 ; i < scaled_height ; i++, out += scaled_width ) {
|
||||||
{
|
|
||||||
inrow = original + inwidth*(i*tinheight/scaled_height);
|
inrow = original + inwidth*(i*tinheight/scaled_height);
|
||||||
frac = fracstep >> 1;
|
frac = fracstep >> 1;
|
||||||
for (j=0 ; j<scaled_width ; j+=4)
|
for ( j=0 ; j < scaled_width ; j += 4) {
|
||||||
{
|
|
||||||
out[j] = translate32[inrow[frac>>16]];
|
out[j] = translate32[inrow[frac>>16]];
|
||||||
frac += fracstep;
|
frac += fracstep;
|
||||||
out[j+1] = translate32[inrow[frac>>16]];
|
out[j+1] = translate32[inrow[frac>>16]];
|
||||||
|
@ -431,147 +441,8 @@ void R_TranslatePlayerSkin (int playernum)
|
||||||
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
|
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
|
||||||
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
|
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
|
||||||
}
|
}
|
||||||
#else /* not QUAKEWORLD */
|
|
||||||
int top, bottom;
|
|
||||||
byte translate[256];
|
|
||||||
unsigned translate32[256];
|
|
||||||
int i, j, s;
|
|
||||||
model_t *model;
|
|
||||||
aliashdr_t *paliashdr;
|
|
||||||
byte *original;
|
|
||||||
unsigned pixels[512*256], *out;
|
|
||||||
unsigned scaled_width, scaled_height;
|
|
||||||
int inwidth, inheight;
|
|
||||||
byte *inrow;
|
|
||||||
unsigned frac, fracstep;
|
|
||||||
|
|
||||||
GL_DisableMultitexture();
|
|
||||||
|
|
||||||
top = cl.scores[playernum].colors & 0xf0;
|
|
||||||
bottom = (cl.scores[playernum].colors &15)<<4;
|
|
||||||
|
|
||||||
for (i=0 ; i<256 ; i++)
|
|
||||||
translate[i] = i;
|
|
||||||
|
|
||||||
for (i=0 ; i<16 ; i++)
|
|
||||||
{
|
|
||||||
if (top < 128) // the artists made some backwards ranges. sigh.
|
|
||||||
translate[TOP_RANGE+i] = top+i;
|
|
||||||
else
|
|
||||||
translate[TOP_RANGE+i] = top+15-i;
|
|
||||||
|
|
||||||
if (bottom < 128)
|
|
||||||
translate[BOTTOM_RANGE+i] = bottom+i;
|
|
||||||
else
|
|
||||||
translate[BOTTOM_RANGE+i] = bottom+15-i;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
|
||||||
// locate the original skin pixels
|
|
||||||
//
|
|
||||||
currententity = &cl_entities[1+playernum];
|
|
||||||
model = currententity->model;
|
|
||||||
if (!model)
|
|
||||||
return; // player doesn't have a model yet
|
|
||||||
if (model->type != mod_alias)
|
|
||||||
return; // only translate skins on alias models
|
|
||||||
|
|
||||||
paliashdr = (aliashdr_t *)Mod_Extradata (model);
|
|
||||||
s = paliashdr->skinwidth * paliashdr->skinheight;
|
|
||||||
if (currententity->skinnum < 0 || currententity->skinnum >= paliashdr->numskins) {
|
|
||||||
Con_Printf("(%d): Invalid player skin #%d\n", playernum, currententity->skinnum);
|
|
||||||
original = (byte *)paliashdr + paliashdr->texels[0];
|
|
||||||
} else
|
|
||||||
original = (byte *)paliashdr + paliashdr->texels[currententity->skinnum];
|
|
||||||
if (s & 3)
|
|
||||||
Sys_Error ("R_TranslateSkin: s&3");
|
|
||||||
|
|
||||||
inwidth = paliashdr->skinwidth;
|
|
||||||
inheight = paliashdr->skinheight;
|
|
||||||
|
|
||||||
// because this happens during gameplay, do it fast
|
|
||||||
// instead of sending it through gl_upload 8
|
|
||||||
GL_Bind(playertextures + playernum);
|
|
||||||
|
|
||||||
#if 0
|
|
||||||
byte translated[320*200];
|
|
||||||
|
|
||||||
for (i=0 ; i<s ; i+=4)
|
|
||||||
{
|
|
||||||
translated[i] = translate[original[i]];
|
|
||||||
translated[i+1] = translate[original[i+1]];
|
|
||||||
translated[i+2] = translate[original[i+2]];
|
|
||||||
translated[i+3] = translate[original[i+3]];
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// don't mipmap these, because it takes too long
|
|
||||||
GL_Upload8 (translated, paliashdr->skinwidth, paliashdr->skinheight, false, false, true);
|
|
||||||
#else
|
|
||||||
scaled_width = gl_max_size->value < 512 ? gl_max_size->value : 512;
|
|
||||||
scaled_height = gl_max_size->value < 256 ? gl_max_size->value : 256;
|
|
||||||
|
|
||||||
// allow users to crunch sizes down even more if they want
|
|
||||||
scaled_width >>= (int)gl_playermip->value;
|
|
||||||
scaled_height >>= (int)gl_playermip->value;
|
|
||||||
|
|
||||||
if (VID_Is8bit()) { // 8bit texture upload
|
|
||||||
byte *out2;
|
|
||||||
|
|
||||||
out2 = (byte *)pixels;
|
|
||||||
memset(pixels, 0, sizeof(pixels));
|
|
||||||
fracstep = inwidth*0x10000/scaled_width;
|
|
||||||
for (i=0 ; i<scaled_height ; i++, out2 += scaled_width)
|
|
||||||
{
|
|
||||||
inrow = original + inwidth*(i*inheight/scaled_height);
|
|
||||||
frac = fracstep >> 1;
|
|
||||||
for (j=0 ; j<scaled_width ; j+=4)
|
|
||||||
{
|
|
||||||
out2[j] = translate[inrow[frac>>16]];
|
|
||||||
frac += fracstep;
|
|
||||||
out2[j+1] = translate[inrow[frac>>16]];
|
|
||||||
frac += fracstep;
|
|
||||||
out2[j+2] = translate[inrow[frac>>16]];
|
|
||||||
frac += fracstep;
|
|
||||||
out2[j+3] = translate[inrow[frac>>16]];
|
|
||||||
frac += fracstep;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
GL_Upload8_EXT ((byte *)pixels, scaled_width, scaled_height, false, false);
|
|
||||||
return;
|
return;
|
||||||
} else { // This is for 24/32 bit GL displays...
|
|
||||||
|
|
||||||
for (i=0 ; i<256 ; i++)
|
|
||||||
translate32[i] = d_8to24table[translate[i]];
|
|
||||||
|
|
||||||
out = pixels;
|
|
||||||
fracstep = inwidth*0x10000/scaled_width;
|
|
||||||
for (i=0 ; i<scaled_height ; i++, out += scaled_width)
|
|
||||||
{
|
|
||||||
inrow = original + inwidth*(i*inheight/scaled_height);
|
|
||||||
frac = fracstep >> 1;
|
|
||||||
for (j=0 ; j<scaled_width ; j+=4)
|
|
||||||
{
|
|
||||||
out[j] = translate32[inrow[frac>>16]];
|
|
||||||
frac += fracstep;
|
|
||||||
out[j+1] = translate32[inrow[frac>>16]];
|
|
||||||
frac += fracstep;
|
|
||||||
out[j+2] = translate32[inrow[frac>>16]];
|
|
||||||
frac += fracstep;
|
|
||||||
out[j+3] = translate32[inrow[frac>>16]];
|
|
||||||
frac += fracstep;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
glTexImage2D (GL_TEXTURE_2D, 0, gl_solid_format, scaled_width, scaled_height, 0, GL_RGBA, GL_UNSIGNED_BYTE, pixels);
|
|
||||||
|
|
||||||
glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE);
|
|
||||||
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
|
|
||||||
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#endif /* QUAKEWORLD */
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
|
@ -582,19 +582,18 @@ R_RocketTrail (vec3_t start, vec3_t end, int type)
|
||||||
int j;
|
int j;
|
||||||
particle_t *p;
|
particle_t *p;
|
||||||
int dec;
|
int dec;
|
||||||
|
static int tracercount;
|
||||||
|
|
||||||
VectorSubtract (end, start, vec);
|
VectorSubtract (end, start, vec);
|
||||||
len = VectorNormalize (vec);
|
len = VectorNormalize (vec);
|
||||||
if (type < 128)
|
if (type < 128) {
|
||||||
dec = 3;
|
dec = 3;
|
||||||
else
|
} else {
|
||||||
{
|
|
||||||
dec = 1;
|
dec = 1;
|
||||||
type -= 128;
|
type -= 128;
|
||||||
}
|
}
|
||||||
|
|
||||||
while (len > 0)
|
while (len > 0) {
|
||||||
{
|
|
||||||
len -= dec;
|
len -= dec;
|
||||||
|
|
||||||
if (!free_particles)
|
if (!free_particles)
|
||||||
|
@ -608,24 +607,21 @@ R_RocketTrail (vec3_t start, vec3_t end, int type)
|
||||||
p->die = cl.time + 2;
|
p->die = cl.time + 2;
|
||||||
|
|
||||||
switch (type) {
|
switch (type) {
|
||||||
case 0:
|
case 0: // rocket trail
|
||||||
// rocket trail
|
|
||||||
p->ramp = (rand()&3);
|
p->ramp = (rand()&3);
|
||||||
p->color = ramp3[(int)p->ramp];
|
p->color = ramp3[(int)p->ramp];
|
||||||
p->type = pt_fire;
|
p->type = pt_fire;
|
||||||
for (j=0 ; j<3 ; j++)
|
for (j=0 ; j<3 ; j++)
|
||||||
p->org[j] = start[j] + ((rand()%6)-3);
|
p->org[j] = start[j] + ((rand()%6)-3);
|
||||||
break;
|
break;
|
||||||
case 1:
|
case 1: // smoke smoke
|
||||||
// smoke smoke
|
|
||||||
p->ramp = (rand()&3) + 2;
|
p->ramp = (rand()&3) + 2;
|
||||||
p->color = ramp3[(int)p->ramp];
|
p->color = ramp3[(int)p->ramp];
|
||||||
p->type = pt_fire;
|
p->type = pt_fire;
|
||||||
for (j=0 ; j<3 ; j++)
|
for (j=0 ; j<3 ; j++)
|
||||||
p->org[j] = start[j] + ((rand()%6)-3);
|
p->org[j] = start[j] + ((rand()%6)-3);
|
||||||
break;
|
break;
|
||||||
case 2:
|
case 2: // blood
|
||||||
// blood
|
|
||||||
#ifdef QUAKEWORLD
|
#ifdef QUAKEWORLD
|
||||||
p->type = pt_slowgrav;
|
p->type = pt_slowgrav;
|
||||||
#else
|
#else
|
||||||
|
@ -636,13 +632,10 @@ R_RocketTrail (vec3_t start, vec3_t end, int type)
|
||||||
p->org[j] = start[j] + ((rand()%6)-3);
|
p->org[j] = start[j] + ((rand()%6)-3);
|
||||||
break;
|
break;
|
||||||
case 3:
|
case 3:
|
||||||
case 5:
|
case 5: // tracer
|
||||||
{
|
|
||||||
// tracer
|
|
||||||
static int tracercount;
|
|
||||||
|
|
||||||
p->die = cl.time + 0.5;
|
p->die = cl.time + 0.5;
|
||||||
p->type = pt_static;
|
p->type = pt_static;
|
||||||
|
|
||||||
if (type == 3)
|
if (type == 3)
|
||||||
p->color = 52 + ((tracercount&4)<<1);
|
p->color = 52 + ((tracercount&4)<<1);
|
||||||
else
|
else
|
||||||
|
@ -658,10 +651,8 @@ R_RocketTrail (vec3_t start, vec3_t end, int type)
|
||||||
p->vel[0] = 30*-vec[1];
|
p->vel[0] = 30*-vec[1];
|
||||||
p->vel[1] = 30*vec[0];
|
p->vel[1] = 30*vec[0];
|
||||||
}
|
}
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
case 4:
|
case 4: // slight blood
|
||||||
// slight blood
|
|
||||||
#ifdef QUAKEWORLD
|
#ifdef QUAKEWORLD
|
||||||
p->type = pt_slowgrav;
|
p->type = pt_slowgrav;
|
||||||
#else
|
#else
|
||||||
|
@ -672,8 +663,7 @@ R_RocketTrail (vec3_t start, vec3_t end, int type)
|
||||||
p->org[j] = start[j] + ((rand()%6)-3);
|
p->org[j] = start[j] + ((rand()%6)-3);
|
||||||
len -= 3;
|
len -= 3;
|
||||||
break;
|
break;
|
||||||
case 6:
|
case 6: // voor trail
|
||||||
// voor trail
|
|
||||||
p->color = 9*16 + 8 + (rand()&3);
|
p->color = 9*16 + 8 + (rand()&3);
|
||||||
p->type = pt_static;
|
p->type = pt_static;
|
||||||
p->die = cl.time + 0.3;
|
p->die = cl.time + 0.3;
|
||||||
|
|
|
@ -79,7 +79,6 @@ static Visual *x_vis;
|
||||||
static XVisualInfo *x_visinfo;
|
static XVisualInfo *x_visinfo;
|
||||||
static Atom aWMDelete = 0;
|
static Atom aWMDelete = 0;
|
||||||
|
|
||||||
|
|
||||||
int XShmQueryExtension(Display *);
|
int XShmQueryExtension(Display *);
|
||||||
int XShmGetEventBase(Display *);
|
int XShmGetEventBase(Display *);
|
||||||
|
|
||||||
|
@ -110,7 +109,7 @@ static long X11_highhunkmark;
|
||||||
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
shiftmask_init()
|
shiftmask_init( void )
|
||||||
{
|
{
|
||||||
unsigned int x;
|
unsigned int x;
|
||||||
|
|
||||||
|
@ -779,7 +778,7 @@ VID_Update(vrect_t *rects)
|
||||||
static int dither;
|
static int dither;
|
||||||
|
|
||||||
void
|
void
|
||||||
VID_DitherOn(void)
|
VID_DitherOn( void )
|
||||||
{
|
{
|
||||||
if (dither == 0) {
|
if (dither == 0) {
|
||||||
vid.recalc_refdef = 1;
|
vid.recalc_refdef = 1;
|
||||||
|
@ -789,7 +788,7 @@ VID_DitherOn(void)
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
VID_DitherOff(void)
|
VID_DitherOff( void )
|
||||||
{
|
{
|
||||||
if (dither) {
|
if (dither) {
|
||||||
vid.recalc_refdef = 1;
|
vid.recalc_refdef = 1;
|
||||||
|
|
Loading…
Reference in a new issue