mirror of
https://github.com/Shpoike/Quakespasm.git
synced 2024-11-10 07:21:58 +00:00
64 bit compatibility effort, 2/nn: type correctness work in common.h,
gl_draw.c, gl_model.c, gl_sky.c, gl_texmgr.c, gl_texmgr.h, r_alias.c, r_brush.c, r_part.c, r_world.c, snd_mem.c. next step will be server side (progs) work which is actually the heart of the problems. git-svn-id: svn://svn.code.sf.net/p/quakespasm/code/trunk/quakespasm@34 af15c1b1-3010-417e-b628-4374ebc0bcbd
This commit is contained in:
parent
9e861e3102
commit
f9928b24ac
11 changed files with 35 additions and 33 deletions
|
@ -64,7 +64,7 @@ void InsertLinkAfter (link_t *l, link_t *after);
|
|||
// (type *)STRUCT_FROM_LINK(link_t *link, type, member)
|
||||
// ent = STRUCT_FROM_LINK(link,entity_t,order)
|
||||
// FIXME: remove this mess!
|
||||
#define STRUCT_FROM_LINK(l,t,m) ((t *)((byte *)l - (int)&(((t *)0)->m)))
|
||||
#define STRUCT_FROM_LINK(l,t,m) ((t *)((byte *)l - (size_t)&(((t *)0)->m)))
|
||||
|
||||
//============================================================================
|
||||
|
||||
|
|
|
@ -207,7 +207,7 @@ void Scrap_Upload (void)
|
|||
{
|
||||
sprintf (name, "scrap%i", i);
|
||||
scrap_textures[i] = TexMgr_LoadImage (NULL, name, BLOCK_WIDTH, BLOCK_HEIGHT, SRC_INDEXED, scrap_texels[i],
|
||||
"", (unsigned)scrap_texels[i], TEXPREF_ALPHA | TEXPREF_OVERWRITE | TEXPREF_NOPICMIP);
|
||||
"", (src_offset_t)scrap_texels[i], TEXPREF_ALPHA | TEXPREF_OVERWRITE | TEXPREF_NOPICMIP);
|
||||
}
|
||||
|
||||
scrap_dirty = false;
|
||||
|
@ -222,7 +222,7 @@ qpic_t *Draw_PicFromWad (char *name)
|
|||
{
|
||||
qpic_t *p;
|
||||
glpic_t *gl;
|
||||
unsigned offset; //johnfitz
|
||||
src_offset_t offset; //johnfitz
|
||||
|
||||
p = W_GetLumpName (name);
|
||||
if (!p) return pic_nul; //johnfitz
|
||||
|
@ -253,7 +253,7 @@ qpic_t *Draw_PicFromWad (char *name)
|
|||
char texturename[64]; //johnfitz
|
||||
sprintf (texturename, "%s:%s", WADFILENAME, name); //johnfitz
|
||||
|
||||
offset = (unsigned)p - (unsigned)wad_base + sizeof(int)*2; //johnfitz
|
||||
offset = (src_offset_t)p - (src_offset_t)wad_base + sizeof(int)*2; //johnfitz
|
||||
|
||||
gl->gltexture = TexMgr_LoadImage (NULL, texturename, p->width, p->height, SRC_INDEXED, p->data, WADFILENAME,
|
||||
offset, TEXPREF_ALPHA | TEXPREF_PAD | TEXPREF_NOPICMIP); //johnfitz -- TexMgr
|
||||
|
@ -331,7 +331,7 @@ qpic_t *Draw_MakePic (char *name, int width, int height, byte *data)
|
|||
pic->height = height;
|
||||
|
||||
gl = (glpic_t *)pic->data;
|
||||
gl->gltexture = TexMgr_LoadImage (NULL, name, width, height, SRC_INDEXED, data, "", (unsigned)data, flags);
|
||||
gl->gltexture = TexMgr_LoadImage (NULL, name, width, height, SRC_INDEXED, data, "", (src_offset_t)data, flags);
|
||||
gl->sl = 0;
|
||||
gl->sh = (float)width/(float)TexMgr_PadConditional(width);
|
||||
gl->tl = 0;
|
||||
|
@ -354,11 +354,11 @@ Draw_LoadPics -- johnfitz
|
|||
void Draw_LoadPics (void)
|
||||
{
|
||||
byte *data;
|
||||
unsigned offset;
|
||||
src_offset_t offset;
|
||||
|
||||
data = W_GetLumpName ("conchars");
|
||||
if (!data) Sys_Error ("Draw_LoadPics: couldn't load conchars");
|
||||
offset = (unsigned)data - (unsigned)wad_base;
|
||||
offset = (src_offset_t)data - (src_offset_t)wad_base;
|
||||
char_texture = TexMgr_LoadImage (NULL, WADFILENAME":conchars", 128, 128, SRC_INDEXED, data,
|
||||
WADFILENAME, offset, TEXPREF_ALPHA | TEXPREF_NEAREST | TEXPREF_NOPICMIP | TEXPREF_CONCHARS);
|
||||
|
||||
|
|
|
@ -375,7 +375,7 @@ void Mod_LoadTextures (lump_t *l)
|
|||
//johnfitz -- more variables
|
||||
char texturename[64];
|
||||
int nummiptex;
|
||||
unsigned offset;
|
||||
src_offset_t offset;
|
||||
int mark, fwidth, fheight;
|
||||
char filename[MAX_OSPATH], filename2[MAX_OSPATH], mapname[MAX_OSPATH];
|
||||
byte *data;
|
||||
|
@ -456,7 +456,7 @@ void Mod_LoadTextures (lump_t *l)
|
|||
else //use the texture from the bsp file
|
||||
{
|
||||
sprintf (texturename, "%s:%s", loadmodel->name, tx->name);
|
||||
offset = (unsigned)(mt+1) - (unsigned)mod_base;
|
||||
offset = (src_offset_t)(mt+1) - (src_offset_t)mod_base;
|
||||
tx->gltexture = TexMgr_LoadImage (loadmodel, texturename, tx->width, tx->height,
|
||||
SRC_INDEXED, (byte *)(tx+1), loadmodel->name, offset, TEXPREF_NONE);
|
||||
}
|
||||
|
@ -466,7 +466,7 @@ void Mod_LoadTextures (lump_t *l)
|
|||
Hunk_FreeToLowMark (mark);
|
||||
sprintf (texturename, "%s_warp", texturename);
|
||||
tx->warpimage = TexMgr_LoadImage (loadmodel, texturename, gl_warpimagesize,
|
||||
gl_warpimagesize, SRC_RGBA, hunk_base, "", (unsigned)hunk_base, TEXPREF_NOPICMIP | TEXPREF_WARPIMAGE);
|
||||
gl_warpimagesize, SRC_RGBA, hunk_base, "", (src_offset_t)hunk_base, TEXPREF_NOPICMIP | TEXPREF_WARPIMAGE);
|
||||
tx->update_warp = true;
|
||||
}
|
||||
else //regular texture
|
||||
|
@ -503,7 +503,7 @@ void Mod_LoadTextures (lump_t *l)
|
|||
else //use the texture from the bsp file
|
||||
{
|
||||
sprintf (texturename, "%s:%s", loadmodel->name, tx->name);
|
||||
offset = (unsigned)(mt+1) - (unsigned)mod_base;
|
||||
offset = (src_offset_t)(mt+1) - (src_offset_t)mod_base;
|
||||
if (Mod_CheckFullbrights ((byte *)(tx+1), pixels))
|
||||
{
|
||||
tx->gltexture = TexMgr_LoadImage (loadmodel, texturename, tx->width, tx->height,
|
||||
|
@ -1809,7 +1809,7 @@ void *Mod_LoadAllSkins (int numskins, daliasskintype_t *pskintype)
|
|||
daliasskingroup_t *pinskingroup;
|
||||
daliasskininterval_t *pinskinintervals;
|
||||
char fbr_mask_name[64]; //johnfitz -- added for fullbright support
|
||||
unsigned offset; //johnfitz
|
||||
src_offset_t offset; //johnfitz
|
||||
|
||||
skin = (byte *)(pskintype + 1);
|
||||
|
||||
|
@ -1831,7 +1831,7 @@ void *Mod_LoadAllSkins (int numskins, daliasskintype_t *pskintype)
|
|||
|
||||
//johnfitz -- rewritten
|
||||
sprintf (name, "%s:frame%i", loadmodel->name, i);
|
||||
offset = (unsigned)(pskintype+1) - (unsigned)mod_base;
|
||||
offset = (src_offset_t)(pskintype+1) - (src_offset_t)mod_base;
|
||||
if (Mod_CheckFullbrights ((byte *)(pskintype+1), size))
|
||||
{
|
||||
pheader->gltextures[i][0] = TexMgr_LoadImage (loadmodel, name, pheader->skinwidth, pheader->skinheight,
|
||||
|
@ -1874,7 +1874,7 @@ void *Mod_LoadAllSkins (int numskins, daliasskintype_t *pskintype)
|
|||
|
||||
//johnfitz -- rewritten
|
||||
sprintf (name, "%s:frame%i_%i", loadmodel->name, i,j);
|
||||
offset = (unsigned)(pskintype) - (unsigned)mod_base; //johnfitz
|
||||
offset = (src_offset_t)(pskintype) - (src_offset_t)mod_base; //johnfitz
|
||||
if (Mod_CheckFullbrights ((byte *)(pskintype), size))
|
||||
{
|
||||
pheader->gltextures[i][j&3] = TexMgr_LoadImage (loadmodel, name, pheader->skinwidth, pheader->skinheight,
|
||||
|
@ -2173,7 +2173,7 @@ void * Mod_LoadSpriteFrame (void * pin, mspriteframe_t **ppframe, int framenum)
|
|||
mspriteframe_t *pspriteframe;
|
||||
int width, height, size, origin[2];
|
||||
char name[64];
|
||||
unsigned offset; //johnfitz
|
||||
src_offset_t offset; //johnfitz
|
||||
|
||||
pinframe = (dspriteframe_t *)pin;
|
||||
|
||||
|
@ -2203,7 +2203,7 @@ void * Mod_LoadSpriteFrame (void * pin, mspriteframe_t **ppframe, int framenum)
|
|||
//johnfitz
|
||||
|
||||
sprintf (name, "%s:frame%i", loadmodel->name, framenum);
|
||||
offset = (unsigned)(pinframe+1) - (unsigned)mod_base; //johnfitz
|
||||
offset = (src_offset_t)(pinframe+1) - (src_offset_t)mod_base; //johnfitz
|
||||
pspriteframe->gltexture =
|
||||
TexMgr_LoadImage (loadmodel, name, width, height, SRC_INDEXED, (byte *)(pinframe + 1),
|
||||
loadmodel->name, offset, TEXPREF_PAD | TEXPREF_ALPHA | TEXPREF_NOPICMIP); //johnfitz -- TexMgr
|
||||
|
|
|
@ -106,7 +106,7 @@ void Sky_LoadTexture (texture_t *mt)
|
|||
back_data[(i*128) + j] = src[i*256 + j + 128];
|
||||
|
||||
sprintf(texturename, "%s:%s_back", loadmodel->name, mt->name);
|
||||
solidskytexture = TexMgr_LoadImage (loadmodel, texturename, 128, 128, SRC_INDEXED, back_data, "", (unsigned)back_data, TEXPREF_NONE);
|
||||
solidskytexture = TexMgr_LoadImage (loadmodel, texturename, 128, 128, SRC_INDEXED, back_data, "", (src_offset_t)back_data, TEXPREF_NONE);
|
||||
|
||||
// extract front layer and upload
|
||||
for (i=0 ; i<128 ; i++)
|
||||
|
@ -118,7 +118,7 @@ void Sky_LoadTexture (texture_t *mt)
|
|||
}
|
||||
|
||||
sprintf(texturename, "%s:%s_front", loadmodel->name, mt->name);
|
||||
alphaskytexture = TexMgr_LoadImage (loadmodel, texturename, 128, 128, SRC_INDEXED, front_data, "", (unsigned)front_data, TEXPREF_ALPHA);
|
||||
alphaskytexture = TexMgr_LoadImage (loadmodel, texturename, 128, 128, SRC_INDEXED, front_data, "", (src_offset_t)front_data, TEXPREF_ALPHA);
|
||||
|
||||
// calculate r_fastsky color based on average of all opaque foreground colors
|
||||
r = g = b = count = 0;
|
||||
|
|
|
@ -574,8 +574,8 @@ void TexMgr_Init (void)
|
|||
glGetIntegerv (GL_MAX_TEXTURE_SIZE, &gl_hardware_maxsize);
|
||||
|
||||
// load notexture images
|
||||
notexture = TexMgr_LoadImage (NULL, "notexture", 2, 2, SRC_RGBA, notexture_data, "", (unsigned)notexture_data, TEXPREF_NEAREST | TEXPREF_PERSIST | TEXPREF_NOPICMIP);
|
||||
nulltexture = TexMgr_LoadImage (NULL, "nulltexture", 2, 2, SRC_RGBA, nulltexture_data, "", (unsigned)nulltexture_data, TEXPREF_NEAREST | TEXPREF_PERSIST | TEXPREF_NOPICMIP);
|
||||
notexture = TexMgr_LoadImage (NULL, "notexture", 2, 2, SRC_RGBA, notexture_data, "", (src_offset_t)notexture_data, TEXPREF_NEAREST | TEXPREF_PERSIST | TEXPREF_NOPICMIP);
|
||||
nulltexture = TexMgr_LoadImage (NULL, "nulltexture", 2, 2, SRC_RGBA, nulltexture_data, "", (src_offset_t)nulltexture_data, TEXPREF_NEAREST | TEXPREF_PERSIST | TEXPREF_NOPICMIP);
|
||||
|
||||
//have to assign these here becuase Mod_Init is called before TexMgr_Init
|
||||
r_notexture_mip->gltexture = r_notexture_mip2->gltexture = notexture;
|
||||
|
@ -1117,7 +1117,7 @@ TexMgr_LoadImage -- the one entry point for loading all textures
|
|||
================
|
||||
*/
|
||||
gltexture_t *TexMgr_LoadImage (model_t *owner, char *name, int width, int height, enum srcformat format,
|
||||
byte *data, char *source_file, unsigned source_offset, unsigned flags)
|
||||
byte *data, char *source_file, src_offset_t source_offset, unsigned flags)
|
||||
{
|
||||
extern int lightmap_bytes;
|
||||
unsigned short crc;
|
||||
|
|
|
@ -36,6 +36,8 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|||
|
||||
enum srcformat {SRC_INDEXED, SRC_LIGHTMAP, SRC_RGBA};
|
||||
|
||||
typedef size_t src_offset_t; // technically need uintptr_t, but size_t is OK virtually everywhere.
|
||||
|
||||
typedef struct gltexture_s {
|
||||
//managed by texture manager
|
||||
unsigned int texnum;
|
||||
|
@ -47,7 +49,7 @@ typedef struct gltexture_s {
|
|||
unsigned int height; //size of image as it exists in opengl
|
||||
unsigned int flags;
|
||||
char source_file[MAX_QPATH]; //relative filepath to data source, or "" if source is in memory
|
||||
unsigned int source_offset; //byte offset into file, or memory address
|
||||
src_offset_t source_offset; //byte offset into file, or memory address
|
||||
enum srcformat source_format; //format of pixel data (indexed, lightmap, or rgba)
|
||||
unsigned int source_width; //size of image in source data
|
||||
unsigned int source_height; //size of image in source data
|
||||
|
@ -81,7 +83,7 @@ void TexMgr_Init (void);
|
|||
|
||||
// IMAGE LOADING
|
||||
gltexture_t *TexMgr_LoadImage (model_t *owner, char *name, int width, int height, enum srcformat format,
|
||||
byte *data, char *source_file, unsigned source_offset, unsigned flags);
|
||||
byte *data, char *source_file, src_offset_t source_offset, unsigned flags);
|
||||
void TexMgr_ReloadImage (gltexture_t *glt, int shirt, int pants);
|
||||
void TexMgr_ReloadImages (void);
|
||||
void TexMgr_ReloadNobrightImages (void);
|
||||
|
|
|
@ -134,7 +134,7 @@ void GL_DrawAliasFrame (aliashdr_t *paliashdr, lerpdata_t lerpdata)
|
|||
{
|
||||
if (r_drawflat_cheatsafe)
|
||||
{
|
||||
srand(count * (unsigned int) commands);
|
||||
srand(count * (unsigned int)(src_offset_t)commands);
|
||||
glColor3f (rand()%256/255.0, rand()%256/255.0, rand()%256/255.0);
|
||||
}
|
||||
else if (lerping)
|
||||
|
|
|
@ -152,7 +152,7 @@ void R_DrawSequentialPoly (msurface_t *s)
|
|||
{
|
||||
for (p = s->polys->next; p; p = p->next)
|
||||
{
|
||||
srand((unsigned int) p);
|
||||
srand((unsigned int) (size_t) p);
|
||||
glColor3f (rand()%256/255.0, rand()%256/255.0, rand()%256/255.0);
|
||||
DrawGLPoly (p);
|
||||
rs_brushpasses++;
|
||||
|
@ -160,7 +160,7 @@ void R_DrawSequentialPoly (msurface_t *s)
|
|||
return;
|
||||
}
|
||||
|
||||
srand((unsigned int) s->polys);
|
||||
srand((unsigned int) (size_t) s->polys);
|
||||
glColor3f (rand()%256/255.0, rand()%256/255.0, rand()%256/255.0);
|
||||
DrawGLPoly (s->polys);
|
||||
rs_brushpasses++;
|
||||
|
@ -918,7 +918,7 @@ void GL_BuildLightmaps (void)
|
|||
sprintf(name, "lightmap%03i",i);
|
||||
data = lightmaps+i*BLOCK_WIDTH*BLOCK_HEIGHT*lightmap_bytes;
|
||||
lightmap_textures[i] = TexMgr_LoadImage (cl.worldmodel, name, BLOCK_WIDTH, BLOCK_HEIGHT,
|
||||
SRC_LIGHTMAP, data, "", (unsigned)data, TEXPREF_LINEAR | TEXPREF_NOPICMIP);
|
||||
SRC_LIGHTMAP, data, "", (src_offset_t)data, TEXPREF_LINEAR | TEXPREF_NOPICMIP);
|
||||
//johnfitz
|
||||
}
|
||||
|
||||
|
|
|
@ -85,7 +85,7 @@ void R_InitParticleTextures (void)
|
|||
*dst++ = 255;
|
||||
*dst++ = R_ParticleTextureLookup(x, y, 8);
|
||||
}
|
||||
particletexture1 = TexMgr_LoadImage (NULL, "particle1", 64, 64, SRC_RGBA, particle1_data, "", (unsigned)particle1_data, TEXPREF_PERSIST | TEXPREF_ALPHA | TEXPREF_LINEAR);
|
||||
particletexture1 = TexMgr_LoadImage (NULL, "particle1", 64, 64, SRC_RGBA, particle1_data, "", (src_offset_t)particle1_data, TEXPREF_PERSIST | TEXPREF_ALPHA | TEXPREF_LINEAR);
|
||||
|
||||
// particle texture 2 -- square
|
||||
dst = particle2_data;
|
||||
|
@ -97,7 +97,7 @@ void R_InitParticleTextures (void)
|
|||
*dst++ = 255;
|
||||
*dst++ = x || y ? 0 : 255;
|
||||
}
|
||||
particletexture2 = TexMgr_LoadImage (NULL, "particle2", 2, 2, SRC_RGBA, particle2_data, "", (unsigned)particle2_data, TEXPREF_PERSIST | TEXPREF_ALPHA | TEXPREF_NEAREST);
|
||||
particletexture2 = TexMgr_LoadImage (NULL, "particle2", 2, 2, SRC_RGBA, particle2_data, "", (src_offset_t)particle2_data, TEXPREF_PERSIST | TEXPREF_ALPHA | TEXPREF_NEAREST);
|
||||
|
||||
// particle texture 3 -- blob
|
||||
dst = particle3_data;
|
||||
|
@ -109,7 +109,7 @@ void R_InitParticleTextures (void)
|
|||
*dst++ = 255;
|
||||
*dst++ = R_ParticleTextureLookup(x, y, 2);
|
||||
}
|
||||
particletexture3 = TexMgr_LoadImage (NULL, "particle3", 64, 64, SRC_RGBA, particle3_data, "", (unsigned)particle3_data, TEXPREF_PERSIST | TEXPREF_ALPHA | TEXPREF_LINEAR);
|
||||
particletexture3 = TexMgr_LoadImage (NULL, "particle3", 64, 64, SRC_RGBA, particle3_data, "", (src_offset_t)particle3_data, TEXPREF_PERSIST | TEXPREF_ALPHA | TEXPREF_LINEAR);
|
||||
|
||||
|
||||
//set default
|
||||
|
|
|
@ -282,7 +282,7 @@ void R_DrawTextureChains_Drawflat (void)
|
|||
if (!s->culled)
|
||||
for (p = s->polys->next; p; p = p->next)
|
||||
{
|
||||
srand((unsigned int) p);
|
||||
srand((unsigned int) (size_t) p);
|
||||
glColor3f (rand()%256/255.0, rand()%256/255.0, rand()%256/255.0);
|
||||
DrawGLPoly (p);
|
||||
rs_brushpasses++;
|
||||
|
@ -293,7 +293,7 @@ void R_DrawTextureChains_Drawflat (void)
|
|||
for (s = t->texturechain; s; s = s->texturechain)
|
||||
if (!s->culled)
|
||||
{
|
||||
srand((unsigned int) s->polys);
|
||||
srand((unsigned int) (size_t) s->polys);
|
||||
glColor3f (rand()%256/255.0, rand()%256/255.0, rand()%256/255.0);
|
||||
DrawGLPoly (s->polys);
|
||||
rs_brushpasses++;
|
||||
|
|
|
@ -236,7 +236,7 @@ void DumpChunks(void)
|
|||
memcpy (str, data_p, 4);
|
||||
data_p += 4;
|
||||
iff_chunk_len = GetLittleLong();
|
||||
Con_Printf ("0x%x : %s (%d)\n", (int)(data_p - 4), str, iff_chunk_len);
|
||||
Con_Printf ("%p : %s (%d)\n", (data_p - 4), str, iff_chunk_len);
|
||||
data_p += (iff_chunk_len + 1) & ~1;
|
||||
} while (data_p < iff_end);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue