mirror of
https://git.code.sf.net/p/quake/newtree
synced 2024-11-21 19:51:18 +00:00
Newtree compiles again, no promices that it will work though..
I'm tempted to pull Endy's CVS write abilitys until he promices to make sure major changes at least COMPILE before he commits them. (=:]
This commit is contained in:
parent
ac8d74e741
commit
b8a92f28dc
9 changed files with 120 additions and 90 deletions
|
@ -265,6 +265,8 @@ void R_DrawSkyChain (msurface_t *s);
|
|||
void R_LoadSkys (char *);
|
||||
void R_ClearSkyBox (void);
|
||||
void R_DrawSkyBox (void);
|
||||
byte *LoadTGA (FILE *fin);
|
||||
byte *LoadPCX (FILE *f);
|
||||
|
||||
//
|
||||
// gl_draw.c
|
||||
|
|
|
@ -29,7 +29,7 @@
|
|||
#ifndef _INFO_H
|
||||
#define _INFO_H
|
||||
|
||||
#define MAX_INFO_STRING 196
|
||||
#define MAX_INFO_STRING 512
|
||||
#define MAX_SERVERINFO_STRING 512
|
||||
#define MAX_LOCALINFO_STRING 32768
|
||||
|
||||
|
|
|
@ -128,6 +128,7 @@ void R_RenderView (void); // must set r_refdef first
|
|||
void R_ViewChanged (vrect_t *pvrect, int lineadj, float aspect);
|
||||
// called whenever r_refdef or vid change
|
||||
void R_InitSky (struct texture_s *mt); // called at level load
|
||||
void R_InitSky_32 (byte *src); // called at level load
|
||||
|
||||
void R_AddEfrags (entity_t *ent);
|
||||
void R_RemoveEfrags (entity_t *ent);
|
||||
|
|
|
@ -60,6 +60,7 @@
|
|||
#include "glquake.h"
|
||||
#include "quakefs.h"
|
||||
#include "checksum.h"
|
||||
#include "hl.h"
|
||||
|
||||
void SV_Error (char *error, ...);
|
||||
|
||||
|
|
|
@ -690,10 +690,6 @@ void R_BlendLightmaps (void)
|
|||
void R_RenderBrushPolyTransparent (msurface_t *fa)
|
||||
{
|
||||
texture_t *t;
|
||||
byte *base;
|
||||
int maps;
|
||||
glRect_t *theRect;
|
||||
int smax, tmax;
|
||||
|
||||
glEnable(GL_ALPHA_TEST);
|
||||
glAlphaFunc(GL_GEQUAL, 0.05f);
|
||||
|
|
158
source/gl_warp.c
158
source/gl_warp.c
|
@ -332,18 +332,18 @@ void EmitBothSkyLayers (msurface_t *fa)
|
|||
=================================================================
|
||||
*/
|
||||
|
||||
byte *pcx_rgb;
|
||||
//byte *pcx_rgb;
|
||||
|
||||
/*
|
||||
============
|
||||
LoadPCX
|
||||
============
|
||||
*/
|
||||
void LoadPCX (FILE *f)
|
||||
byte *LoadPCX (FILE *f)
|
||||
{
|
||||
pcx_t *pcx, pcxbuf;
|
||||
byte palette[768];
|
||||
byte *pix;
|
||||
byte *pix, *pcx_rgb;
|
||||
int x, y;
|
||||
int dataByte, runLength;
|
||||
int count;
|
||||
|
@ -363,7 +363,7 @@ void LoadPCX (FILE *f)
|
|||
|| pcx->ymax >= 256)
|
||||
{
|
||||
Con_Printf ("Bad pcx file\n");
|
||||
return;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
// seek to palette
|
||||
|
@ -401,6 +401,8 @@ void LoadPCX (FILE *f)
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
return pcx_rgb;
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -421,7 +423,7 @@ typedef struct _TargaHeader {
|
|||
|
||||
|
||||
TargaHeader targa_header;
|
||||
byte *targa_rgba;
|
||||
//byte *targa_rgba;
|
||||
|
||||
int fgetLittleShort (FILE *f)
|
||||
{
|
||||
|
@ -451,12 +453,13 @@ int fgetLittleLong (FILE *f)
|
|||
LoadTGA
|
||||
=============
|
||||
*/
|
||||
void LoadTGA (FILE *fin)
|
||||
byte *LoadTGA (FILE *fin)
|
||||
{
|
||||
int columns, rows, numPixels;
|
||||
byte *pixbuf;
|
||||
int row, column;
|
||||
unsigned char red = 0, green = 0, blue = 0, alphabyte = 0;
|
||||
byte *targa_rgba;
|
||||
|
||||
targa_header.id_length = fgetc(fin);
|
||||
targa_header.colormap_type = fgetc(fin);
|
||||
|
@ -597,6 +600,7 @@ void LoadTGA (FILE *fin)
|
|||
}
|
||||
|
||||
fclose(fin);
|
||||
return targa_rgba;
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -610,6 +614,7 @@ void R_LoadSkys (char * skyname)
|
|||
int i;
|
||||
FILE *f;
|
||||
char name[64];
|
||||
byte *data;
|
||||
|
||||
if (stricmp (skyname, "none") == 0)
|
||||
{
|
||||
|
@ -629,13 +634,13 @@ void R_LoadSkys (char * skyname)
|
|||
skyloaded = false;
|
||||
continue;
|
||||
}
|
||||
LoadTGA (f);
|
||||
data = LoadTGA (f);
|
||||
// LoadPCX (f);
|
||||
|
||||
glTexImage2D (GL_TEXTURE_2D, 0, gl_solid_format, 256, 256, 0, GL_RGBA, GL_UNSIGNED_BYTE, targa_rgba);
|
||||
glTexImage2D (GL_TEXTURE_2D, 0, gl_solid_format, 256, 256, 0, GL_RGBA, GL_UNSIGNED_BYTE, data);
|
||||
// glTexImage2D (GL_TEXTURE_2D, 0, gl_solid_format, 256, 256, 0, GL_RGBA, GL_UNSIGNED_BYTE, pcx_rgb);
|
||||
|
||||
free (targa_rgba);
|
||||
free (data);
|
||||
// free (pcx_rgb);
|
||||
|
||||
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
|
||||
|
@ -996,82 +1001,101 @@ void R_DrawSkyBox (void)
|
|||
//===============================================================
|
||||
|
||||
/*
|
||||
=============
|
||||
R_InitSky
|
||||
R_InitSky
|
||||
|
||||
A sky texture is 256*128, with the right side being a masked overlay
|
||||
==============
|
||||
A sky texture is 256*128, with the right side being a masked overlay
|
||||
*/
|
||||
void R_InitSky (byte *src, int bytesperpixel) //texture_t *mt)
|
||||
void
|
||||
R_InitSky (texture_t *mt)
|
||||
{
|
||||
|
||||
int i, j, p;
|
||||
byte *src;
|
||||
unsigned trans[128*128];
|
||||
unsigned transpix;
|
||||
int r, g, b;
|
||||
unsigned *rgba;
|
||||
extern int skytexturenum;
|
||||
|
||||
if (bytesperpixel == 4)
|
||||
{
|
||||
for (i = 0;i < 128;i++)
|
||||
for (j = 0;j < 128;j++)
|
||||
trans[(i*128) + j] = src[i*256+j+128];
|
||||
}
|
||||
else
|
||||
{
|
||||
// make an average value for the back to avoid
|
||||
// a fringe on the top level
|
||||
r = g = b = 0;
|
||||
for (i=0 ; i<128 ; i++)
|
||||
for (j=0 ; j<128 ; j++)
|
||||
{
|
||||
p = src[i*256 + j + 128];
|
||||
rgba = &d_8to24table[p];
|
||||
trans[(i*128) + j] = *rgba;
|
||||
r += ((byte *)rgba)[0];
|
||||
g += ((byte *)rgba)[1];
|
||||
b += ((byte *)rgba)[2];
|
||||
}
|
||||
src = (byte *)mt + mt->offsets[0];
|
||||
|
||||
((byte *)&transpix)[0] = r/(128*128);
|
||||
((byte *)&transpix)[1] = g/(128*128);
|
||||
((byte *)&transpix)[2] = b/(128*128);
|
||||
((byte *)&transpix)[3] = 0;
|
||||
// make an average value for the back to avoid
|
||||
// a fringe on the top level
|
||||
|
||||
r = g = b = 0;
|
||||
for (i=0 ; i<128 ; i++) {
|
||||
for (j=0 ; j<128 ; j++) {
|
||||
p = src[i*256 + j + 128];
|
||||
rgba = &d_8to24table[p];
|
||||
trans[(i*128) + j] = *rgba;
|
||||
r += ((byte *)rgba)[0];
|
||||
g += ((byte *)rgba)[1];
|
||||
b += ((byte *)rgba)[2];
|
||||
}
|
||||
}
|
||||
|
||||
((byte *)&transpix)[0] = r/(128*128);
|
||||
((byte *)&transpix)[1] = g/(128*128);
|
||||
((byte *)&transpix)[2] = b/(128*128);
|
||||
((byte *)&transpix)[3] = 0;
|
||||
|
||||
if (!solidskytexture)
|
||||
solidskytexture = texture_extension_number++;
|
||||
GL_Bind (solidskytexture);
|
||||
glTexImage2D (GL_TEXTURE_2D, 0, gl_solid_format, 128, 128, 0, GL_RGBA, GL_UNSIGNED_BYTE, trans);
|
||||
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
|
||||
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
|
||||
|
||||
for (i=0 ; i<128 ; i++) {
|
||||
for (j=0 ; j<128 ; j++) {
|
||||
p = src[i*256 + j];
|
||||
if (p == 0)
|
||||
trans[(i*128) + j] = transpix;
|
||||
else
|
||||
trans[(i*128) + j] = d_8to24table[p];
|
||||
}
|
||||
}
|
||||
|
||||
if ( !alphaskytexture )
|
||||
alphaskytexture = texture_extension_number++;
|
||||
GL_Bind(alphaskytexture);
|
||||
glTexImage2D (GL_TEXTURE_2D, 0, gl_alpha_format, 128, 128, 0, GL_RGBA, GL_UNSIGNED_BYTE, trans);
|
||||
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
|
||||
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
|
||||
}
|
||||
|
||||
/*
|
||||
=============
|
||||
R_InitSky_32
|
||||
|
||||
A sky texture is 256*128, with the right side being a masked overlay
|
||||
==============
|
||||
*/
|
||||
void R_InitSky_32 (byte *src)
|
||||
{
|
||||
int i, j;
|
||||
unsigned trans[128*128];
|
||||
|
||||
for (i = 0;i < 128;i++)
|
||||
for (j = 0;j < 128;j++)
|
||||
trans[(i*128) + j] = src[i*256+j+128];
|
||||
|
||||
if (!solidskytexture)
|
||||
solidskytexture = texture_extension_number++;
|
||||
|
||||
GL_Bind (solidskytexture );
|
||||
glTexImage2D (GL_TEXTURE_2D, 0, gl_solid_format, 128, 128, 0, GL_RGBA, GL_UNSIGNED_BYTE, trans);
|
||||
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
|
||||
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
|
||||
GL_Bind (solidskytexture );
|
||||
glTexImage2D (GL_TEXTURE_2D, 0, gl_solid_format, 128, 128, 0, GL_RGBA, GL_UNSIGNED_BYTE, trans);
|
||||
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
|
||||
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
|
||||
|
||||
|
||||
if (bytesperpixel == 4)
|
||||
{
|
||||
for (i = 0;i < 128;i++)
|
||||
for (j = 0;j < 128;j++)
|
||||
trans[(i*128) + j] = src[i*256+j];
|
||||
}
|
||||
else
|
||||
{
|
||||
for (i=0 ; i<128 ; i++)
|
||||
for (j=0 ; j<128 ; j++)
|
||||
{
|
||||
p = src[i*256 + j];
|
||||
if (p == 0)
|
||||
trans[(i*128) + j] = transpix;
|
||||
else
|
||||
trans[(i*128) + j] = d_8to24table[p];
|
||||
}
|
||||
}
|
||||
for (i = 0;i < 128;i++)
|
||||
for (j = 0;j < 128;j++)
|
||||
trans[(i*128) + j] = src[i*256+j];
|
||||
|
||||
if (!alphaskytexture)
|
||||
alphaskytexture = texture_extension_number++;
|
||||
|
||||
GL_Bind(alphaskytexture);
|
||||
glTexImage2D (GL_TEXTURE_2D, 0, gl_alpha_format, 128, 128, 0, GL_RGBA, GL_UNSIGNED_BYTE, trans);
|
||||
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
|
||||
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
|
||||
GL_Bind(alphaskytexture);
|
||||
glTexImage2D (GL_TEXTURE_2D, 0, gl_alpha_format, 128, 128, 0, GL_RGBA, GL_UNSIGNED_BYTE, trans);
|
||||
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
|
||||
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
|
||||
}
|
||||
|
|
|
@ -38,6 +38,7 @@
|
|||
#include <math.h>
|
||||
#include <string.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#include "bothdefs.h" // needed by: common.h, net.h, client.h
|
||||
#include "qendian.h"
|
||||
|
@ -63,6 +64,7 @@
|
|||
#include "glquake.h"
|
||||
#include "quakefs.h"
|
||||
#include "checksum.h"
|
||||
#include "hl.h"
|
||||
|
||||
|
||||
int image_width;
|
||||
|
@ -131,12 +133,14 @@ byte* loadimagepixels (char* filename, qboolean complain, int matchwidth, int ma
|
|||
sprintf (name, "%s.tga", basename);
|
||||
COM_FOpenFile (name, &f);
|
||||
if (f)
|
||||
return LoadTGA (f, matchwidth, matchheight);
|
||||
return LoadTGA (f);
|
||||
//return LoadTGA (f, matchwidth, matchheight);
|
||||
sprintf (name, "%s.pcx", basename);
|
||||
COM_FOpenFile (name, &f);
|
||||
if (f)
|
||||
return LoadPCX (f, matchwidth, matchheight);
|
||||
if (image_rgba = W_GetTexture(basename, matchwidth, matchheight))
|
||||
return LoadPCX (f);
|
||||
//return LoadPCX (f, matchwidth, matchheight);
|
||||
if ((image_rgba = W_GetTexture(basename, matchwidth, matchheight)))
|
||||
return image_rgba;
|
||||
if (complain)
|
||||
Con_Printf ("Couldn't load %s.tga or .pcx\n", filename);
|
||||
|
@ -145,7 +149,7 @@ byte* loadimagepixels (char* filename, qboolean complain, int matchwidth, int ma
|
|||
|
||||
void HL_Mod_LoadTextures (lump_t *l)
|
||||
{
|
||||
int i, j, pixels, num, max, altmax, freeimage, transparent, bytesperpixel;
|
||||
int i, j, num, max, altmax, freeimage, transparent, bytesperpixel;
|
||||
miptex_t *mt;
|
||||
texture_t *tx, *tx2;
|
||||
texture_t *anims[10];
|
||||
|
@ -192,17 +196,17 @@ void HL_Mod_LoadTextures (lump_t *l)
|
|||
strcpy(imagename, "textures/");
|
||||
strcat(imagename, mt->name);
|
||||
|
||||
freeimage = TRUE;
|
||||
transparent = FALSE;
|
||||
freeimage = true;
|
||||
transparent = false;
|
||||
bytesperpixel = 4;
|
||||
data = loadimagepixels(imagename, FALSE, tx->width, tx->height);
|
||||
data = loadimagepixels(imagename, false, tx->width, tx->height);
|
||||
if (!data) // no external texture found
|
||||
{
|
||||
strcpy(imagename, mt->name);
|
||||
data = loadimagepixels(imagename, FALSE, tx->width, tx->height);
|
||||
data = loadimagepixels(imagename, false, tx->width, tx->height);
|
||||
if (!data) // no external texture found
|
||||
{
|
||||
freeimage = FALSE;
|
||||
freeimage = false;
|
||||
bytesperpixel = 1;
|
||||
if (mt->offsets[0]) // texture included
|
||||
data = (byte *)((int) mt + mt->offsets[0]);
|
||||
|
@ -217,7 +221,7 @@ void HL_Mod_LoadTextures (lump_t *l)
|
|||
for (j = 0;j < image_width*image_height;j++)
|
||||
if (data[j*4+3] < 255)
|
||||
{
|
||||
transparent = TRUE;
|
||||
transparent = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -227,14 +231,14 @@ void HL_Mod_LoadTextures (lump_t *l)
|
|||
for (j = 0;j < image_width*image_height;j++)
|
||||
if (data[j*4+3] < 255)
|
||||
{
|
||||
transparent = TRUE;
|
||||
transparent = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (!strncmp(mt->name,"sky",3))
|
||||
{
|
||||
tx->transparent = FALSE;
|
||||
R_InitSky (data, bytesperpixel);
|
||||
tx->transparent = false;
|
||||
R_InitSky_32 (data);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -407,7 +411,7 @@ void CL_ParseEntityLump(char *entdata)
|
|||
strcpy(wadname, "textures/");
|
||||
Con_DPrintf("Wad: %s\n", &value[j]);
|
||||
strcat(wadname, &value[j]);
|
||||
W_LoadTextureWadFile (wadname, FALSE);
|
||||
W_LoadTextureWadFile (wadname, false);
|
||||
j = i+1;
|
||||
if (!k)
|
||||
break;
|
||||
|
@ -426,8 +430,7 @@ GL_LoadTexture
|
|||
int lhcsumtable2[256];
|
||||
int HL_LoadTexture (char *identifier, int width, int height, byte *data, qboolean mipmap, qboolean alpha)
|
||||
{
|
||||
qboolean noalpha;
|
||||
int i, p, s, lhcsum;
|
||||
int i, s, lhcsum;
|
||||
gltexture_t *glt;
|
||||
|
||||
// LordHavoc: do a checksum to confirm the data really is the same as previous
|
||||
|
@ -470,7 +473,7 @@ HL_LoadTexture_setup:
|
|||
glt->mipmap = mipmap;
|
||||
|
||||
GL_Bind(glt->texnum);
|
||||
GL_Upload32 (data, width, height, mipmap, true);
|
||||
GL_Upload32 ((unsigned *) data, width, height, mipmap, true);
|
||||
glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE);
|
||||
|
||||
return glt->texnum;
|
||||
|
|
|
@ -30,10 +30,13 @@
|
|||
#ifdef HAVE_CONFIG_H
|
||||
# include <config.h>
|
||||
#endif
|
||||
#include <stdlib.h>
|
||||
|
||||
#include "sys.h"
|
||||
#include "wad.h"
|
||||
#include "quakefs.h"
|
||||
#include "qendian.h"
|
||||
#include "console.h"
|
||||
|
||||
|
||||
#define TEXWAD_MAXIMAGES 8192
|
||||
|
@ -59,7 +62,6 @@ void W_LoadTextureWadFile (char *filename, int complain)
|
|||
int infotableofs;
|
||||
FILE *file;
|
||||
int numlumps;
|
||||
int temp;
|
||||
|
||||
|
||||
COM_FOpenFile (filename, &file);
|
||||
|
|
|
@ -36,6 +36,7 @@
|
|||
#include "quakefs.h"
|
||||
#include "qendian.h"
|
||||
#include "checksum.h"
|
||||
#include "sys.h"
|
||||
|
||||
#include <math.h>
|
||||
#include <string.h>
|
||||
|
|
Loading…
Reference in a new issue