mirror of
https://github.com/yquake2/yquake2remaster.git
synced 2024-11-13 00:24:44 +00:00
gl1: cppcheck fixes
This commit is contained in:
parent
aea0a9085f
commit
03c39f34ae
21 changed files with 308 additions and 210 deletions
|
@ -119,7 +119,7 @@ RDraw_FindPic(const char *name)
|
||||||
void
|
void
|
||||||
RDraw_GetPicSize(int *w, int *h, const char *pic)
|
RDraw_GetPicSize(int *w, int *h, const char *pic)
|
||||||
{
|
{
|
||||||
image_t *gl;
|
const image_t *gl;
|
||||||
|
|
||||||
gl = R_FindPic(pic, (findimage_t)R_FindImage);
|
gl = R_FindPic(pic, (findimage_t)R_FindImage);
|
||||||
|
|
||||||
|
@ -231,7 +231,7 @@ RDraw_PicScaled(int x, int y, const char *pic, float factor)
|
||||||
void
|
void
|
||||||
RDraw_TileClear(int x, int y, int w, int h, const char *pic)
|
RDraw_TileClear(int x, int y, int w, int h, const char *pic)
|
||||||
{
|
{
|
||||||
image_t *image;
|
const image_t *image;
|
||||||
|
|
||||||
image = R_FindPic(pic, (findimage_t)R_FindImage);
|
image = R_FindPic(pic, (findimage_t)R_FindImage);
|
||||||
|
|
||||||
|
@ -396,8 +396,6 @@ RDraw_StretchRaw(int x, int y, int w, int h, int cols, int rows, const byte *dat
|
||||||
|
|
||||||
if (!gl_config.palettedtexture || bits == 32)
|
if (!gl_config.palettedtexture || bits == 32)
|
||||||
{
|
{
|
||||||
unsigned image32[320*240]; /* was 256 * 256, but we want a bit more space */
|
|
||||||
|
|
||||||
/* .. because now if non-power-of-2 textures are supported, we just load
|
/* .. because now if non-power-of-2 textures are supported, we just load
|
||||||
* the data into a texture in the original format, without skipping any
|
* the data into a texture in the original format, without skipping any
|
||||||
* pixels to fit into a 256x256 texture.
|
* pixels to fit into a 256x256 texture.
|
||||||
|
@ -411,6 +409,7 @@ RDraw_StretchRaw(int x, int y, int w, int h, int cols, int rows, const byte *dat
|
||||||
}
|
}
|
||||||
else if(gl_config.npottextures || rows <= 256)
|
else if(gl_config.npottextures || rows <= 256)
|
||||||
{
|
{
|
||||||
|
unsigned image32[320*240]; /* was 256 * 256, but we want a bit more space */
|
||||||
unsigned* img = image32;
|
unsigned* img = image32;
|
||||||
|
|
||||||
if(cols*rows > 320*240)
|
if(cols*rows > 320*240)
|
||||||
|
@ -442,11 +441,11 @@ RDraw_StretchRaw(int x, int y, int w, int h, int cols, int rows, const byte *dat
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
unsigned int image32[320*240];
|
unsigned int image32[320*240];
|
||||||
unsigned *dest;
|
|
||||||
|
|
||||||
for (i = 0; i < trows; i++)
|
for (i = 0; i < trows; i++)
|
||||||
{
|
{
|
||||||
const byte *source;
|
const byte *source;
|
||||||
|
unsigned *dest;
|
||||||
|
|
||||||
row = (int)(i * hscale);
|
row = (int)(i * hscale);
|
||||||
|
|
||||||
|
@ -475,10 +474,10 @@ RDraw_StretchRaw(int x, int y, int w, int h, int cols, int rows, const byte *dat
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
unsigned char image8[256 * 256];
|
unsigned char image8[256 * 256];
|
||||||
unsigned char *dest;
|
|
||||||
|
|
||||||
for (i = 0; i < trows; i++)
|
for (i = 0; i < trows; i++)
|
||||||
{
|
{
|
||||||
|
unsigned char *dest;
|
||||||
const byte *source;
|
const byte *source;
|
||||||
|
|
||||||
row = (int)(i * hscale);
|
row = (int)(i * hscale);
|
||||||
|
|
|
@ -125,13 +125,13 @@ int upload_width, upload_height;
|
||||||
qboolean uploaded_paletted;
|
qboolean uploaded_paletted;
|
||||||
|
|
||||||
void
|
void
|
||||||
R_SetTexturePalette(unsigned palette[256])
|
R_SetTexturePalette(const unsigned palette[256])
|
||||||
{
|
{
|
||||||
int i;
|
|
||||||
unsigned char temptable[768];
|
|
||||||
|
|
||||||
if (gl_config.palettedtexture)
|
if (gl_config.palettedtexture)
|
||||||
{
|
{
|
||||||
|
unsigned char temptable[768];
|
||||||
|
int i;
|
||||||
|
|
||||||
for (i = 0; i < 256; i++)
|
for (i = 0; i < 256; i++)
|
||||||
{
|
{
|
||||||
temptable[i * 3 + 0] = (palette[i] >> 0) & 0xff;
|
temptable[i * 3 + 0] = (palette[i] >> 0) & 0xff;
|
||||||
|
@ -176,7 +176,7 @@ R_Bind(int texnum)
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
R_TextureMode(char *string)
|
R_TextureMode(const char *string)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
image_t *glt;
|
image_t *glt;
|
||||||
|
@ -263,7 +263,7 @@ R_TextureMode(char *string)
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
R_TextureAlphaMode(char *string)
|
R_TextureAlphaMode(const char *string)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
|
@ -285,7 +285,7 @@ R_TextureAlphaMode(char *string)
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
R_TextureSolidMode(char *string)
|
R_TextureSolidMode(const char *string)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
|
@ -859,7 +859,6 @@ R_LoadPic(const char *name, byte *pic, int width, int realwidth,
|
||||||
int height, int realheight, size_t data_size, imagetype_t type, int bits)
|
int height, int realheight, size_t data_size, imagetype_t type, int bits)
|
||||||
{
|
{
|
||||||
image_t *image;
|
image_t *image;
|
||||||
int i;
|
|
||||||
|
|
||||||
qboolean nolerp = false;
|
qboolean nolerp = false;
|
||||||
if (r_2D_unfiltered->value && type == it_pic)
|
if (r_2D_unfiltered->value && type == it_pic)
|
||||||
|
@ -875,35 +874,39 @@ R_LoadPic(const char *name, byte *pic, int width, int realwidth,
|
||||||
nolerp = strstr(r_nolerp_list->string, name) != NULL;
|
nolerp = strstr(r_nolerp_list->string, name) != NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* find a free image_t */
|
|
||||||
for (i = 0, image = gltextures; i < numgltextures; i++, image++)
|
|
||||||
{
|
{
|
||||||
if (!image->texnum)
|
int i;
|
||||||
|
|
||||||
|
/* find a free image_t */
|
||||||
|
for (i = 0, image = gltextures; i < numgltextures; i++, image++)
|
||||||
{
|
{
|
||||||
break;
|
if (!image->texnum)
|
||||||
|
{
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!strcmp(image->name, name))
|
||||||
|
{
|
||||||
|
/* we already have such image */
|
||||||
|
image->registration_sequence = registration_sequence;
|
||||||
|
return image;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!strcmp(image->name, name))
|
if (i == numgltextures)
|
||||||
{
|
{
|
||||||
/* we already have such image */
|
if (numgltextures == MAX_TEXTURES)
|
||||||
image->registration_sequence = registration_sequence;
|
{
|
||||||
return image;
|
Com_Error(ERR_DROP, "%s: load %s is failed MAX_TEXTURES",
|
||||||
|
__func__, name);
|
||||||
|
}
|
||||||
|
|
||||||
|
numgltextures++;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
image = &gltextures[i];
|
||||||
}
|
}
|
||||||
|
|
||||||
if (i == numgltextures)
|
|
||||||
{
|
|
||||||
if (numgltextures == MAX_TEXTURES)
|
|
||||||
{
|
|
||||||
Com_Error(ERR_DROP, "%s: load %s is failed MAX_TEXTURES",
|
|
||||||
__func__, name);
|
|
||||||
}
|
|
||||||
|
|
||||||
numgltextures++;
|
|
||||||
}
|
|
||||||
|
|
||||||
image = &gltextures[i];
|
|
||||||
|
|
||||||
if (strlen(name) >= sizeof(image->name))
|
if (strlen(name) >= sizeof(image->name))
|
||||||
{
|
{
|
||||||
Com_Error(ERR_DROP, "%s: \"%s\" is too long", __func__, name);
|
Com_Error(ERR_DROP, "%s: \"%s\" is too long", __func__, name);
|
||||||
|
@ -926,7 +929,7 @@ R_LoadPic(const char *name, byte *pic, int width, int realwidth,
|
||||||
(image->width < 64) && (image->height < 64))
|
(image->width < 64) && (image->height < 64))
|
||||||
{
|
{
|
||||||
int x, y;
|
int x, y;
|
||||||
int i, j, k;
|
int i, k;
|
||||||
int texnum;
|
int texnum;
|
||||||
|
|
||||||
texnum = Scrap_AllocBlock(image->width, image->height, &x, &y);
|
texnum = Scrap_AllocBlock(image->width, image->height, &x, &y);
|
||||||
|
@ -943,6 +946,8 @@ R_LoadPic(const char *name, byte *pic, int width, int realwidth,
|
||||||
|
|
||||||
for (i = 0; i < image->height; i++)
|
for (i = 0; i < image->height; i++)
|
||||||
{
|
{
|
||||||
|
int j;
|
||||||
|
|
||||||
for (j = 0; j < image->width; j++, k++)
|
for (j = 0; j < image->width; j++, k++)
|
||||||
{
|
{
|
||||||
scrap_texels[texnum][(y + i) * BLOCK_WIDTH + x + j] = pic[k];
|
scrap_texels[texnum][(y + i) * BLOCK_WIDTH + x + j] = pic[k];
|
||||||
|
@ -1104,7 +1109,7 @@ R_FindImage(const char *name, imagetype_t type)
|
||||||
}
|
}
|
||||||
|
|
||||||
struct image_s *
|
struct image_s *
|
||||||
RI_RegisterSkin(char *name)
|
RI_RegisterSkin(const char *name)
|
||||||
{
|
{
|
||||||
return R_FindImage(name, it_skin);
|
return R_FindImage(name, it_skin);
|
||||||
}
|
}
|
||||||
|
@ -1177,7 +1182,7 @@ R_ImageHasFreeSpace(void)
|
||||||
void
|
void
|
||||||
R_InitImages(void)
|
R_InitImages(void)
|
||||||
{
|
{
|
||||||
int i, j;
|
int i;
|
||||||
|
|
||||||
registration_sequence = 1;
|
registration_sequence = 1;
|
||||||
image_max = 0;
|
image_max = 0;
|
||||||
|
@ -1199,6 +1204,8 @@ R_InitImages(void)
|
||||||
|
|
||||||
for (i = 0; i < 256; i++)
|
for (i = 0; i < 256; i++)
|
||||||
{
|
{
|
||||||
|
int j;
|
||||||
|
|
||||||
j = i * intensity->value;
|
j = i * intensity->value;
|
||||||
|
|
||||||
if (j > 255)
|
if (j > 255)
|
||||||
|
|
|
@ -33,7 +33,6 @@ static void
|
||||||
R_RenderDlight(dlight_t *light)
|
R_RenderDlight(dlight_t *light)
|
||||||
{
|
{
|
||||||
int i, j;
|
int i, j;
|
||||||
float a;
|
|
||||||
float rad;
|
float rad;
|
||||||
|
|
||||||
rad = light->intensity * 0.35;
|
rad = light->intensity * 0.35;
|
||||||
|
@ -59,6 +58,8 @@ R_RenderDlight(dlight_t *light)
|
||||||
|
|
||||||
for ( i = 16; i >= 0; i-- )
|
for ( i = 16; i >= 0; i-- )
|
||||||
{
|
{
|
||||||
|
float a;
|
||||||
|
|
||||||
clr[index_clr++] = 0;
|
clr[index_clr++] = 0;
|
||||||
clr[index_clr++] = 0;
|
clr[index_clr++] = 0;
|
||||||
clr[index_clr++] = 0;
|
clr[index_clr++] = 0;
|
||||||
|
|
|
@ -136,9 +136,9 @@ LM_AllocBlock(int w, int h, int *x, int *y)
|
||||||
void
|
void
|
||||||
LM_BuildPolygonFromSurface(model_t *currentmodel, msurface_t *fa)
|
LM_BuildPolygonFromSurface(model_t *currentmodel, msurface_t *fa)
|
||||||
{
|
{
|
||||||
int i, lnumverts;
|
|
||||||
medge_t *pedges, *r_pedge;
|
medge_t *pedges, *r_pedge;
|
||||||
float *vec;
|
int i, lnumverts;
|
||||||
|
const float *vec;
|
||||||
mpoly_t *poly;
|
mpoly_t *poly;
|
||||||
vec3_t total;
|
vec3_t total;
|
||||||
vec3_t normal;
|
vec3_t normal;
|
||||||
|
|
|
@ -156,12 +156,12 @@ R_RotateForEntity(entity_t *e)
|
||||||
static void
|
static void
|
||||||
R_DrawSpriteModel(entity_t *currententity, const model_t *currentmodel)
|
R_DrawSpriteModel(entity_t *currententity, const model_t *currentmodel)
|
||||||
{
|
{
|
||||||
|
const dsprframe_t *frame;
|
||||||
|
const image_t *skin;
|
||||||
|
dsprite_t *psprite;
|
||||||
float alpha = 1.0F;
|
float alpha = 1.0F;
|
||||||
vec3_t point[4];
|
vec3_t point[4];
|
||||||
dsprframe_t *frame;
|
|
||||||
float *up, *right;
|
float *up, *right;
|
||||||
dsprite_t *psprite;
|
|
||||||
image_t *skin;
|
|
||||||
|
|
||||||
/* don't even bother culling, because it's just
|
/* don't even bother culling, because it's just
|
||||||
a single polygon without a surface cache */
|
a single polygon without a surface cache */
|
||||||
|
@ -414,7 +414,6 @@ R_DrawParticles2(int num_particles, const particle_t particles[],
|
||||||
const particle_t *p;
|
const particle_t *p;
|
||||||
int i;
|
int i;
|
||||||
vec3_t up, right;
|
vec3_t up, right;
|
||||||
float scale;
|
|
||||||
YQ2_ALIGNAS_TYPE(unsigned) byte color[4];
|
YQ2_ALIGNAS_TYPE(unsigned) byte color[4];
|
||||||
|
|
||||||
YQ2_VLA(GLfloat, vtx, 3 * num_particles * 3);
|
YQ2_VLA(GLfloat, vtx, 3 * num_particles * 3);
|
||||||
|
@ -436,6 +435,8 @@ R_DrawParticles2(int num_particles, const particle_t particles[],
|
||||||
|
|
||||||
for ( p = particles, i = 0; i < num_particles; i++, p++ )
|
for ( p = particles, i = 0; i < num_particles; i++, p++ )
|
||||||
{
|
{
|
||||||
|
float scale;
|
||||||
|
|
||||||
/* hack a scale up to keep particles from disapearing */
|
/* hack a scale up to keep particles from disapearing */
|
||||||
scale = ( p->origin [ 0 ] - r_origin [ 0 ] ) * vpn [ 0 ] +
|
scale = ( p->origin [ 0 ] - r_origin [ 0 ] ) * vpn [ 0 ] +
|
||||||
( p->origin [ 1 ] - r_origin [ 1 ] ) * vpn [ 1 ] +
|
( p->origin [ 1 ] - r_origin [ 1 ] ) * vpn [ 1 ] +
|
||||||
|
@ -625,8 +626,8 @@ R_PolyBlend(void)
|
||||||
static void
|
static void
|
||||||
R_SetupFrame(void)
|
R_SetupFrame(void)
|
||||||
{
|
{
|
||||||
|
const mleaf_t *leaf;
|
||||||
int i;
|
int i;
|
||||||
mleaf_t *leaf;
|
|
||||||
|
|
||||||
r_framecount++;
|
r_framecount++;
|
||||||
|
|
||||||
|
@ -917,7 +918,7 @@ R_SetGL2D(void)
|
||||||
* r_newrefdef must be set before the first call
|
* r_newrefdef must be set before the first call
|
||||||
*/
|
*/
|
||||||
static void
|
static void
|
||||||
R_RenderView(refdef_t *fd)
|
R_RenderView(const refdef_t *fd)
|
||||||
{
|
{
|
||||||
if ((gl_state.stereo_mode != STEREO_MODE_NONE) && gl_state.camera_separation) {
|
if ((gl_state.stereo_mode != STEREO_MODE_NONE) && gl_state.camera_separation) {
|
||||||
|
|
||||||
|
@ -930,10 +931,10 @@ R_RenderView(refdef_t *fd)
|
||||||
int anaglyph_colours[] = { 0x4, 0x3 }; // Left = red, right = cyan.
|
int anaglyph_colours[] = { 0x4, 0x3 }; // Left = red, right = cyan.
|
||||||
|
|
||||||
if (strlen(gl1_stereo_anaglyph_colors->string) == 2) {
|
if (strlen(gl1_stereo_anaglyph_colors->string) == 2) {
|
||||||
int eye, colour, missing_bits;
|
int eye, missing_bits;
|
||||||
// Decode the colour name from its character.
|
// Decode the colour name from its character.
|
||||||
for (eye = 0; eye < 2; ++eye) {
|
for (eye = 0; eye < 2; ++eye) {
|
||||||
colour = 0;
|
int colour = 0;
|
||||||
switch (toupper((unsigned char)gl1_stereo_anaglyph_colors->string[eye])) {
|
switch (toupper((unsigned char)gl1_stereo_anaglyph_colors->string[eye])) {
|
||||||
case 'B': ++colour; // 001 Blue
|
case 'B': ++colour; // 001 Blue
|
||||||
case 'G': ++colour; // 010 Green
|
case 'G': ++colour; // 010 Green
|
||||||
|
@ -1118,7 +1119,7 @@ GL_GetSpecialBufferModeForStereoMode(enum stereo_modes stereo_mode) {
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
R_SetLightLevel(entity_t *currententity)
|
R_SetLightLevel(const entity_t *currententity)
|
||||||
{
|
{
|
||||||
vec3_t shadelight = {0};
|
vec3_t shadelight = {0};
|
||||||
|
|
||||||
|
@ -1162,7 +1163,7 @@ static void
|
||||||
RI_RenderFrame(refdef_t *fd)
|
RI_RenderFrame(refdef_t *fd)
|
||||||
{
|
{
|
||||||
R_RenderView(fd);
|
R_RenderView(fd);
|
||||||
R_SetLightLevel (NULL);
|
R_SetLightLevel(NULL);
|
||||||
R_SetGL2D();
|
R_SetGL2D();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1373,7 +1374,7 @@ R_SetMode(void)
|
||||||
ri.Cvar_SetValue("r_msaa_samples", 0.0f);
|
ri.Cvar_SetValue("r_msaa_samples", 0.0f);
|
||||||
gl_msaa_samples->modified = false;
|
gl_msaa_samples->modified = false;
|
||||||
|
|
||||||
if ((err = SetMode_impl(&vid.width, &vid.height, r_mode->value, 0)) == rserr_ok)
|
if (SetMode_impl(&vid.width, &vid.height, r_mode->value, 0) == rserr_ok)
|
||||||
{
|
{
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -1389,7 +1390,7 @@ R_SetMode(void)
|
||||||
}
|
}
|
||||||
|
|
||||||
/* try setting it back to something safe */
|
/* try setting it back to something safe */
|
||||||
if ((err = SetMode_impl(&vid.width, &vid.height, gl_state.prev_mode, 0)) != rserr_ok)
|
if (SetMode_impl(&vid.width, &vid.height, gl_state.prev_mode, 0) != rserr_ok)
|
||||||
{
|
{
|
||||||
R_Printf(PRINT_ALL, "ref_gl::R_SetMode() - could not revert to safe mode\n");
|
R_Printf(PRINT_ALL, "ref_gl::R_SetMode() - could not revert to safe mode\n");
|
||||||
return false;
|
return false;
|
||||||
|
@ -1821,7 +1822,6 @@ R_DrawBeam(entity_t *e)
|
||||||
|
|
||||||
GLfloat vtx[3*NUM_BEAM_SEGS*4];
|
GLfloat vtx[3*NUM_BEAM_SEGS*4];
|
||||||
unsigned int index_vtx = 0;
|
unsigned int index_vtx = 0;
|
||||||
unsigned int pointb;
|
|
||||||
|
|
||||||
oldorigin[0] = e->oldorigin[0];
|
oldorigin[0] = e->oldorigin[0];
|
||||||
oldorigin[1] = e->oldorigin[1];
|
oldorigin[1] = e->oldorigin[1];
|
||||||
|
@ -1867,6 +1867,8 @@ R_DrawBeam(entity_t *e)
|
||||||
|
|
||||||
for ( i = 0; i < NUM_BEAM_SEGS; i++ )
|
for ( i = 0; i < NUM_BEAM_SEGS; i++ )
|
||||||
{
|
{
|
||||||
|
unsigned int pointb;
|
||||||
|
|
||||||
vtx[index_vtx++] = start_points [ i ][ 0 ];
|
vtx[index_vtx++] = start_points [ i ][ 0 ];
|
||||||
vtx[index_vtx++] = start_points [ i ][ 1 ];
|
vtx[index_vtx++] = start_points [ i ][ 1 ];
|
||||||
vtx[index_vtx++] = start_points [ i ][ 2 ];
|
vtx[index_vtx++] = start_points [ i ][ 2 ];
|
||||||
|
@ -1897,22 +1899,6 @@ R_DrawBeam(entity_t *e)
|
||||||
glDepthMask(GL_TRUE);
|
glDepthMask(GL_TRUE);
|
||||||
}
|
}
|
||||||
|
|
||||||
extern int RI_PrepareForWindow(void);
|
|
||||||
extern int RI_InitContext(void* win);
|
|
||||||
|
|
||||||
extern void RI_BeginRegistration(const char *model);
|
|
||||||
extern struct model_s * RI_RegisterModel(const char *name);
|
|
||||||
extern struct image_s * RI_RegisterSkin(const char *name);
|
|
||||||
|
|
||||||
extern void RI_SetSky(const char *name, float rotate, int autorotate, const vec3_t axis);
|
|
||||||
extern void RI_EndRegistration(void);
|
|
||||||
|
|
||||||
extern void RI_RenderFrame(refdef_t *fd);
|
|
||||||
|
|
||||||
extern void RI_SetPalette(const unsigned char *palette);
|
|
||||||
extern qboolean RI_IsVSyncActive(void);
|
|
||||||
extern void RI_EndFrame(void);
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
=====================
|
=====================
|
||||||
RI_EndWorldRenderpass
|
RI_EndWorldRenderpass
|
||||||
|
@ -1927,52 +1913,50 @@ RI_EndWorldRenderpass( void )
|
||||||
Q2_DLL_EXPORTED refexport_t
|
Q2_DLL_EXPORTED refexport_t
|
||||||
GetRefAPI(refimport_t imp)
|
GetRefAPI(refimport_t imp)
|
||||||
{
|
{
|
||||||
refexport_t re = {0};
|
refexport_t refexport = {0};
|
||||||
|
|
||||||
ri = imp;
|
ri = imp;
|
||||||
|
|
||||||
re.api_version = API_VERSION;
|
refexport.api_version = API_VERSION;
|
||||||
|
|
||||||
re.Init = RI_Init;
|
refexport.Init = RI_Init;
|
||||||
re.Shutdown = RI_Shutdown;
|
refexport.Shutdown = RI_Shutdown;
|
||||||
re.PrepareForWindow = RI_PrepareForWindow;
|
refexport.PrepareForWindow = RI_PrepareForWindow;
|
||||||
re.InitContext = RI_InitContext;
|
refexport.InitContext = RI_InitContext;
|
||||||
re.GetDrawableSize = RI_GetDrawableSize;
|
refexport.GetDrawableSize = RI_GetDrawableSize;
|
||||||
re.ShutdownContext = RI_ShutdownContext;
|
refexport.ShutdownContext = RI_ShutdownContext;
|
||||||
re.IsVSyncActive = RI_IsVSyncActive;
|
refexport.IsVSyncActive = RI_IsVSyncActive;
|
||||||
re.BeginRegistration = RI_BeginRegistration;
|
refexport.BeginRegistration = RI_BeginRegistration;
|
||||||
re.RegisterModel = RI_RegisterModel;
|
refexport.RegisterModel = RI_RegisterModel;
|
||||||
re.RegisterSkin = RI_RegisterSkin;
|
refexport.RegisterSkin = RI_RegisterSkin;
|
||||||
|
|
||||||
re.SetSky = RI_SetSky;
|
refexport.SetSky = RI_SetSky;
|
||||||
re.EndRegistration = RI_EndRegistration;
|
refexport.EndRegistration = RI_EndRegistration;
|
||||||
|
|
||||||
re.RenderFrame = RI_RenderFrame;
|
refexport.RenderFrame = RI_RenderFrame;
|
||||||
|
|
||||||
re.DrawFindPic = RDraw_FindPic;
|
refexport.DrawFindPic = RDraw_FindPic;
|
||||||
|
|
||||||
re.DrawGetPicSize = RDraw_GetPicSize;
|
refexport.DrawGetPicSize = RDraw_GetPicSize;
|
||||||
//re.DrawPic = Draw_Pic;
|
refexport.DrawPicScaled = RDraw_PicScaled;
|
||||||
re.DrawPicScaled = RDraw_PicScaled;
|
refexport.DrawStretchPic = RDraw_StretchPic;
|
||||||
re.DrawStretchPic = RDraw_StretchPic;
|
refexport.DrawCharScaled = RDraw_CharScaled;
|
||||||
//re.DrawChar = Draw_Char;
|
refexport.DrawTileClear = RDraw_TileClear;
|
||||||
re.DrawCharScaled = RDraw_CharScaled;
|
refexport.DrawFill = RDraw_Fill;
|
||||||
re.DrawTileClear = RDraw_TileClear;
|
refexport.DrawFadeScreen = RDraw_FadeScreen;
|
||||||
re.DrawFill = RDraw_Fill;
|
|
||||||
re.DrawFadeScreen = RDraw_FadeScreen;
|
|
||||||
|
|
||||||
re.DrawStretchRaw = RDraw_StretchRaw;
|
refexport.DrawStretchRaw = RDraw_StretchRaw;
|
||||||
|
|
||||||
re.SetPalette = RI_SetPalette;
|
refexport.SetPalette = RI_SetPalette;
|
||||||
re.BeginFrame = RI_BeginFrame;
|
refexport.BeginFrame = RI_BeginFrame;
|
||||||
re.EndWorldRenderpass = RI_EndWorldRenderpass;
|
refexport.EndWorldRenderpass = RI_EndWorldRenderpass;
|
||||||
re.EndFrame = RI_EndFrame;
|
refexport.EndFrame = RI_EndFrame;
|
||||||
|
|
||||||
// Tell the client that we're unsing the
|
// Tell the client that we're unsing the
|
||||||
// new renderer restart API.
|
// new renderer restart API.
|
||||||
ri.Vid_RequestRestart(RESTART_NO);
|
ri.Vid_RequestRestart(RESTART_NO);
|
||||||
|
|
||||||
return re;
|
return refexport;
|
||||||
}
|
}
|
||||||
|
|
||||||
void R_Printf(int level, const char* msg, ...)
|
void R_Printf(int level, const char* msg, ...)
|
||||||
|
|
|
@ -39,7 +39,7 @@ float shadelight[3];
|
||||||
float *shadedots = r_avertexnormal_dots[0];
|
float *shadedots = r_avertexnormal_dots[0];
|
||||||
|
|
||||||
static void
|
static void
|
||||||
R_DrawAliasDrawCommands(entity_t *currententity, int *order, int *order_end,
|
R_DrawAliasDrawCommands(const entity_t *currententity, int *order, const int *order_end,
|
||||||
float alpha, dxtrivertx_t *verts, vec4_t *s_lerped)
|
float alpha, dxtrivertx_t *verts, vec4_t *s_lerped)
|
||||||
{
|
{
|
||||||
#ifdef _MSC_VER // workaround for lack of VLAs (=> our workaround uses alloca() which is bad in loops)
|
#ifdef _MSC_VER // workaround for lack of VLAs (=> our workaround uses alloca() which is bad in loops)
|
||||||
|
@ -96,13 +96,12 @@ R_DrawAliasDrawCommands(entity_t *currententity, int *order, int *order_end,
|
||||||
YQ2_VLA(GLfloat, clr, 4*total);
|
YQ2_VLA(GLfloat, clr, 4*total);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
unsigned int index_vtx = 0;
|
|
||||||
unsigned int index_tex = 0;
|
|
||||||
unsigned int index_clr = 0;
|
|
||||||
|
|
||||||
if (currententity->flags &
|
if (currententity->flags &
|
||||||
(RF_SHELL_RED | RF_SHELL_GREEN | RF_SHELL_BLUE))
|
(RF_SHELL_RED | RF_SHELL_GREEN | RF_SHELL_BLUE))
|
||||||
{
|
{
|
||||||
|
unsigned int index_vtx = 0;
|
||||||
|
unsigned int index_clr = 0;
|
||||||
|
|
||||||
do
|
do
|
||||||
{
|
{
|
||||||
int index_xyz;
|
int index_xyz;
|
||||||
|
@ -123,6 +122,10 @@ R_DrawAliasDrawCommands(entity_t *currententity, int *order, int *order_end,
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
unsigned int index_vtx = 0;
|
||||||
|
unsigned int index_tex = 0;
|
||||||
|
unsigned int index_clr = 0;
|
||||||
|
|
||||||
do
|
do
|
||||||
{
|
{
|
||||||
int index_xyz;
|
int index_xyz;
|
||||||
|
@ -177,7 +180,8 @@ R_DrawAliasFrameLerp(entity_t *currententity, dmdx_t *paliashdr, float backlerp,
|
||||||
vec4_t *s_lerped)
|
vec4_t *s_lerped)
|
||||||
{
|
{
|
||||||
daliasxframe_t *frame, *oldframe;
|
daliasxframe_t *frame, *oldframe;
|
||||||
dxtrivertx_t *ov, *verts;
|
const dxtrivertx_t *ov;
|
||||||
|
dxtrivertx_t *verts;
|
||||||
int *order;
|
int *order;
|
||||||
float frontlerp;
|
float frontlerp;
|
||||||
float alpha;
|
float alpha;
|
||||||
|
@ -258,7 +262,7 @@ R_DrawAliasFrameLerp(entity_t *currententity, dmdx_t *paliashdr, float backlerp,
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
R_DrawAliasShadowCommand(entity_t *currententity, int *order, int *order_end,
|
R_DrawAliasShadowCommand(const entity_t *currententity, int *order, const int *order_end,
|
||||||
float height, float lheight, vec4_t *s_lerped)
|
float height, float lheight, vec4_t *s_lerped)
|
||||||
{
|
{
|
||||||
unsigned short total;
|
unsigned short total;
|
||||||
|
@ -417,7 +421,7 @@ R_DrawAliasModel(entity_t *currententity, const model_t *currentmodel)
|
||||||
dmdx_t *paliashdr;
|
dmdx_t *paliashdr;
|
||||||
float an;
|
float an;
|
||||||
vec3_t bbox[8];
|
vec3_t bbox[8];
|
||||||
image_t *skin = NULL;
|
const image_t *skin = NULL;
|
||||||
vec4_t *s_lerped;
|
vec4_t *s_lerped;
|
||||||
|
|
||||||
if (!(currententity->flags & RF_WEAPONMODEL))
|
if (!(currententity->flags & RF_WEAPONMODEL))
|
||||||
|
|
|
@ -28,11 +28,10 @@
|
||||||
|
|
||||||
static YQ2_ALIGNAS_TYPE(int) byte mod_novis[MAX_MAP_LEAFS / 8];
|
static YQ2_ALIGNAS_TYPE(int) byte mod_novis[MAX_MAP_LEAFS / 8];
|
||||||
|
|
||||||
static model_t mod_known[MAX_MOD_KNOWN];
|
static model_t mod_known[MAX_MOD_KNOWN];
|
||||||
static int mod_numknown = 0;
|
static int mod_numknown = 0;
|
||||||
static int mod_max = 0;
|
static int mod_max = 0;
|
||||||
|
int registration_sequence;
|
||||||
int registration_sequence;
|
|
||||||
|
|
||||||
//===============================================================================
|
//===============================================================================
|
||||||
|
|
||||||
|
@ -184,7 +183,7 @@ static int
|
||||||
calcTexinfoAndFacesSize(const byte *mod_base, const lump_t *fl, const lump_t *tl)
|
calcTexinfoAndFacesSize(const byte *mod_base, const lump_t *fl, const lump_t *tl)
|
||||||
{
|
{
|
||||||
dface_t* face_in = (void *)(mod_base + fl->fileofs);
|
dface_t* face_in = (void *)(mod_base + fl->fileofs);
|
||||||
texinfo_t* texinfo_in = (void *)(mod_base + tl->fileofs);
|
const texinfo_t* texinfo_in = (void *)(mod_base + tl->fileofs);
|
||||||
|
|
||||||
if (fl->filelen % sizeof(*face_in) || tl->filelen % sizeof(*texinfo_in))
|
if (fl->filelen % sizeof(*face_in) || tl->filelen % sizeof(*texinfo_in))
|
||||||
{
|
{
|
||||||
|
@ -260,7 +259,7 @@ static int
|
||||||
calcTexinfoAndQFacesSize(const byte *mod_base, const lump_t *fl, const lump_t *tl)
|
calcTexinfoAndQFacesSize(const byte *mod_base, const lump_t *fl, const lump_t *tl)
|
||||||
{
|
{
|
||||||
dqface_t* face_in = (void *)(mod_base + fl->fileofs);
|
dqface_t* face_in = (void *)(mod_base + fl->fileofs);
|
||||||
texinfo_t* texinfo_in = (void *)(mod_base + tl->fileofs);
|
const texinfo_t* texinfo_in = (void *)(mod_base + tl->fileofs);
|
||||||
|
|
||||||
if (fl->filelen % sizeof(*face_in) || tl->filelen % sizeof(*texinfo_in))
|
if (fl->filelen % sizeof(*face_in) || tl->filelen % sizeof(*texinfo_in))
|
||||||
{
|
{
|
||||||
|
@ -336,7 +335,7 @@ static void
|
||||||
Mod_LoadFaces(model_t *loadmodel, const byte *mod_base, const lump_t *l,
|
Mod_LoadFaces(model_t *loadmodel, const byte *mod_base, const lump_t *l,
|
||||||
const bspx_header_t *bspx_header)
|
const bspx_header_t *bspx_header)
|
||||||
{
|
{
|
||||||
int i, count, surfnum, lminfosize, lightofs;
|
int i, count, surfnum, lminfosize;
|
||||||
const dlminfo_t *lminfos;
|
const dlminfo_t *lminfos;
|
||||||
msurface_t *out;
|
msurface_t *out;
|
||||||
dface_t *in;
|
dface_t *in;
|
||||||
|
@ -366,7 +365,7 @@ Mod_LoadFaces(model_t *loadmodel, const byte *mod_base, const lump_t *l,
|
||||||
|
|
||||||
for (surfnum = 0; surfnum < count; surfnum++, in++, out++)
|
for (surfnum = 0; surfnum < count; surfnum++, in++, out++)
|
||||||
{
|
{
|
||||||
int side, ti, planenum;
|
int side, ti, planenum, lightofs;
|
||||||
|
|
||||||
out->firstedge = LittleLong(in->firstedge);
|
out->firstedge = LittleLong(in->firstedge);
|
||||||
out->numedges = LittleShort(in->numedges);
|
out->numedges = LittleShort(in->numedges);
|
||||||
|
@ -462,7 +461,7 @@ static void
|
||||||
Mod_LoadQFaces(model_t *loadmodel, const byte *mod_base, const lump_t *l,
|
Mod_LoadQFaces(model_t *loadmodel, const byte *mod_base, const lump_t *l,
|
||||||
const bspx_header_t *bspx_header)
|
const bspx_header_t *bspx_header)
|
||||||
{
|
{
|
||||||
int i, count, surfnum, lminfosize, lightofs;
|
int i, count, surfnum, lminfosize;
|
||||||
const dlminfo_t *lminfos;
|
const dlminfo_t *lminfos;
|
||||||
msurface_t *out;
|
msurface_t *out;
|
||||||
dqface_t *in;
|
dqface_t *in;
|
||||||
|
@ -492,7 +491,7 @@ Mod_LoadQFaces(model_t *loadmodel, const byte *mod_base, const lump_t *l,
|
||||||
|
|
||||||
for (surfnum = 0; surfnum < count; surfnum++, in++, out++)
|
for (surfnum = 0; surfnum < count; surfnum++, in++, out++)
|
||||||
{
|
{
|
||||||
int side, ti, planenum;
|
int side, ti, planenum, lightofs;
|
||||||
|
|
||||||
out->firstedge = LittleLong(in->firstedge);
|
out->firstedge = LittleLong(in->firstedge);
|
||||||
out->numedges = LittleLong(in->numedges);
|
out->numedges = LittleLong(in->numedges);
|
||||||
|
@ -809,6 +808,11 @@ Mod_ForName(const char *name, model_t *parent_model, qboolean crash)
|
||||||
__func__, mod->name);
|
__func__, mod->name);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (r_validation->value > 0)
|
||||||
|
{
|
||||||
|
R_Printf(PRINT_ALL, "%s: Can't load %s\n", __func__, mod->name);
|
||||||
|
}
|
||||||
|
|
||||||
memset(mod->name, 0, sizeof(mod->name));
|
memset(mod->name, 0, sizeof(mod->name));
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
@ -856,7 +860,14 @@ Mod_ForName(const char *name, model_t *parent_model, qboolean crash)
|
||||||
}
|
}
|
||||||
|
|
||||||
mod->radius = Mod_RadiusFromBounds(mod->mins, mod->maxs);
|
mod->radius = Mod_RadiusFromBounds(mod->mins, mod->maxs);
|
||||||
mod->extradatasize = Hunk_End();
|
if (mod->extradata)
|
||||||
|
{
|
||||||
|
mod->extradatasize = Hunk_End();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
mod->extradatasize = 0;
|
||||||
|
}
|
||||||
|
|
||||||
ri.FS_FreeFile(buf);
|
ri.FS_FreeFile(buf);
|
||||||
|
|
||||||
|
@ -866,6 +877,18 @@ Mod_ForName(const char *name, model_t *parent_model, qboolean crash)
|
||||||
static void
|
static void
|
||||||
Mod_Free(model_t *mod)
|
Mod_Free(model_t *mod)
|
||||||
{
|
{
|
||||||
|
if (!mod->extradata)
|
||||||
|
{
|
||||||
|
/* looks as empty model */
|
||||||
|
memset (mod, 0, sizeof(*mod));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (r_validation->value > 0)
|
||||||
|
{
|
||||||
|
R_Printf(PRINT_ALL, "%s: Unload %s\n", __func__, mod->name);
|
||||||
|
}
|
||||||
|
|
||||||
Hunk_Free(mod->extradata);
|
Hunk_Free(mod->extradata);
|
||||||
memset(mod, 0, sizeof(*mod));
|
memset(mod, 0, sizeof(*mod));
|
||||||
}
|
}
|
||||||
|
@ -891,7 +914,7 @@ void
|
||||||
RI_BeginRegistration(const char *model)
|
RI_BeginRegistration(const char *model)
|
||||||
{
|
{
|
||||||
char fullname[MAX_QPATH];
|
char fullname[MAX_QPATH];
|
||||||
cvar_t *flushmap;
|
const cvar_t *flushmap;
|
||||||
|
|
||||||
registration_sequence++;
|
registration_sequence++;
|
||||||
r_oldviewcluster = -1; /* force markleafs */
|
r_oldviewcluster = -1; /* force markleafs */
|
||||||
|
|
|
@ -42,16 +42,18 @@ qboolean R_Upload8(byte *data,
|
||||||
int
|
int
|
||||||
Scrap_AllocBlock(int w, int h, int *x, int *y)
|
Scrap_AllocBlock(int w, int h, int *x, int *y)
|
||||||
{
|
{
|
||||||
int i, j;
|
|
||||||
int best, best2;
|
|
||||||
int texnum;
|
int texnum;
|
||||||
|
|
||||||
for (texnum = 0; texnum < MAX_SCRAPS; texnum++)
|
for (texnum = 0; texnum < MAX_SCRAPS; texnum++)
|
||||||
{
|
{
|
||||||
|
int best, i;
|
||||||
|
|
||||||
best = BLOCK_HEIGHT;
|
best = BLOCK_HEIGHT;
|
||||||
|
|
||||||
for (i = 0; i < BLOCK_WIDTH - w; i++)
|
for (i = 0; i < BLOCK_WIDTH - w; i++)
|
||||||
{
|
{
|
||||||
|
int best2, j;
|
||||||
|
|
||||||
best2 = 0;
|
best2 = 0;
|
||||||
|
|
||||||
for (j = 0; j < w; j++)
|
for (j = 0; j < w; j++)
|
||||||
|
|
|
@ -91,11 +91,11 @@ int RI_PrepareForWindow(void)
|
||||||
gl_state.stencil = false;
|
gl_state.stencil = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Let's see if the driver supports MSAA.
|
|
||||||
int msaa_samples = 0;
|
|
||||||
|
|
||||||
if (gl_msaa_samples->value)
|
if (gl_msaa_samples->value)
|
||||||
{
|
{
|
||||||
|
/* Let's see if the driver supports MSAA. */
|
||||||
|
int msaa_samples;
|
||||||
|
|
||||||
msaa_samples = gl_msaa_samples->value;
|
msaa_samples = gl_msaa_samples->value;
|
||||||
|
|
||||||
if (SDL_GL_SetAttribute(SDL_GL_MULTISAMPLEBUFFERS, 1) < 0)
|
if (SDL_GL_SetAttribute(SDL_GL_MULTISAMPLEBUFFERS, 1) < 0)
|
||||||
|
|
|
@ -228,7 +228,7 @@ static void
|
||||||
R_BlendLightmaps(const model_t *currentmodel)
|
R_BlendLightmaps(const model_t *currentmodel)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
msurface_t *surf, *newdrawsurf = 0;
|
msurface_t *surf;
|
||||||
|
|
||||||
/* don't bother if we're set to fullbright */
|
/* don't bother if we're set to fullbright */
|
||||||
if (r_fullbright->value)
|
if (r_fullbright->value)
|
||||||
|
@ -299,6 +299,8 @@ R_BlendLightmaps(const model_t *currentmodel)
|
||||||
/* render dynamic lightmaps */
|
/* render dynamic lightmaps */
|
||||||
if (r_dynamic->value)
|
if (r_dynamic->value)
|
||||||
{
|
{
|
||||||
|
msurface_t *newdrawsurf;
|
||||||
|
|
||||||
LM_InitBlock();
|
LM_InitBlock();
|
||||||
|
|
||||||
R_Bind(gl_state.lightmap_textures + 0);
|
R_Bind(gl_state.lightmap_textures + 0);
|
||||||
|
@ -411,11 +413,11 @@ R_BlendLightmaps(const model_t *currentmodel)
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
R_RenderBrushPoly(entity_t *currententity, msurface_t *fa)
|
R_RenderBrushPoly(const entity_t *currententity, msurface_t *fa)
|
||||||
{
|
{
|
||||||
int maps;
|
|
||||||
image_t *image;
|
|
||||||
qboolean is_dynamic = false;
|
qboolean is_dynamic = false;
|
||||||
|
const image_t *image;
|
||||||
|
int maps;
|
||||||
|
|
||||||
c_brush_polys++;
|
c_brush_polys++;
|
||||||
|
|
||||||
|
@ -599,7 +601,7 @@ R_DrawAlphaSurfaces(void)
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
R_DrawTextureChains(entity_t *currententity)
|
R_DrawTextureChains(const entity_t *currententity)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
msurface_t *s;
|
msurface_t *s;
|
||||||
|
@ -635,7 +637,7 @@ R_DrawTextureChains(entity_t *currententity)
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
R_DrawInlineBModel(entity_t *currententity, const model_t *currentmodel)
|
R_DrawInlineBModel(const entity_t *currententity, const model_t *currentmodel)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
msurface_t *psurf;
|
msurface_t *psurf;
|
||||||
|
|
|
@ -38,8 +38,6 @@ static const int skytexorder[6] = {0, 2, 1, 3, 4, 5};
|
||||||
|
|
||||||
GLfloat vtx_sky[12];
|
GLfloat vtx_sky[12];
|
||||||
GLfloat tex_sky[8];
|
GLfloat tex_sky[8];
|
||||||
unsigned int index_vtx = 0;
|
|
||||||
unsigned int index_tex = 0;
|
|
||||||
|
|
||||||
/* 3dstudio environment map names */
|
/* 3dstudio environment map names */
|
||||||
static const char *suf[6] = {"rt", "bk", "lf", "ft", "up", "dn"};
|
static const char *suf[6] = {"rt", "bk", "lf", "ft", "up", "dn"};
|
||||||
|
@ -146,7 +144,7 @@ RE_ClearSkyBox(void)
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
RE_MakeSkyVec(float s, float t, int axis)
|
RE_MakeSkyVec(float s, float t, int axis, unsigned int *index_tex, unsigned int *index_vtx)
|
||||||
{
|
{
|
||||||
vec3_t v, b;
|
vec3_t v, b;
|
||||||
int j;
|
int j;
|
||||||
|
@ -197,12 +195,12 @@ RE_MakeSkyVec(float s, float t, int axis)
|
||||||
|
|
||||||
t = 1.0 - t;
|
t = 1.0 - t;
|
||||||
|
|
||||||
tex_sky[index_tex++] = s;
|
tex_sky[(*index_tex)++] = s;
|
||||||
tex_sky[index_tex++] = t;
|
tex_sky[(*index_tex)++] = t;
|
||||||
|
|
||||||
vtx_sky[index_vtx++] = v[ 0 ];
|
vtx_sky[(*index_vtx)++] = v[ 0 ];
|
||||||
vtx_sky[index_vtx++] = v[ 1 ];
|
vtx_sky[(*index_vtx)++] = v[ 1 ];
|
||||||
vtx_sky[index_vtx++] = v[ 2 ];
|
vtx_sky[(*index_vtx)++] = v[ 2 ];
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
@ -234,6 +232,8 @@ R_DrawSkyBox(void)
|
||||||
|
|
||||||
for (i = 0; i < 6; i++)
|
for (i = 0; i < 6; i++)
|
||||||
{
|
{
|
||||||
|
unsigned int index_vtx = 0, index_tex = 0;
|
||||||
|
|
||||||
if (skyrotate)
|
if (skyrotate)
|
||||||
{
|
{
|
||||||
skymins[0][i] = -1;
|
skymins[0][i] = -1;
|
||||||
|
@ -253,20 +253,17 @@ R_DrawSkyBox(void)
|
||||||
glEnableClientState( GL_VERTEX_ARRAY );
|
glEnableClientState( GL_VERTEX_ARRAY );
|
||||||
glEnableClientState( GL_TEXTURE_COORD_ARRAY );
|
glEnableClientState( GL_TEXTURE_COORD_ARRAY );
|
||||||
|
|
||||||
index_vtx = 0;
|
RE_MakeSkyVec(skymins[ 0 ][ i ], skymins[ 1 ] [ i ], i, &index_tex, &index_vtx);
|
||||||
index_tex = 0;
|
RE_MakeSkyVec(skymins[ 0 ][ i ], skymaxs[ 1 ] [ i ], i, &index_tex, &index_vtx);
|
||||||
|
RE_MakeSkyVec(skymaxs[ 0 ][ i ], skymaxs[ 1 ] [ i ], i, &index_tex, &index_vtx);
|
||||||
RE_MakeSkyVec( skymins [ 0 ] [ i ], skymins [ 1 ] [ i ], i );
|
RE_MakeSkyVec(skymaxs[ 0 ][ i ], skymins[ 1 ] [ i ], i, &index_tex, &index_vtx);
|
||||||
RE_MakeSkyVec( skymins [ 0 ] [ i ], skymaxs [ 1 ] [ i ], i );
|
|
||||||
RE_MakeSkyVec( skymaxs [ 0 ] [ i ], skymaxs [ 1 ] [ i ], i );
|
|
||||||
RE_MakeSkyVec( skymaxs [ 0 ] [ i ], skymins [ 1 ] [ i ], i );
|
|
||||||
|
|
||||||
glVertexPointer( 3, GL_FLOAT, 0, vtx_sky );
|
glVertexPointer( 3, GL_FLOAT, 0, vtx_sky );
|
||||||
glTexCoordPointer( 2, GL_FLOAT, 0, tex_sky );
|
glTexCoordPointer( 2, GL_FLOAT, 0, tex_sky );
|
||||||
glDrawArrays( GL_TRIANGLE_FAN, 0, 4 );
|
glDrawArrays( GL_TRIANGLE_FAN, 0, 4 );
|
||||||
|
|
||||||
glDisableClientState( GL_VERTEX_ARRAY );
|
glDisableClientState( GL_VERTEX_ARRAY );
|
||||||
glDisableClientState( GL_TEXTURE_COORD_ARRAY );
|
glDisableClientState( GL_TEXTURE_COORD_ARRAY );
|
||||||
}
|
}
|
||||||
|
|
||||||
glPopMatrix();
|
glPopMatrix();
|
||||||
|
|
|
@ -262,10 +262,10 @@ void R_SwapBuffers(int);
|
||||||
image_t *R_LoadPic(const char *name, byte *pic, int width, int realwidth,
|
image_t *R_LoadPic(const char *name, byte *pic, int width, int realwidth,
|
||||||
int height, int realheight, size_t data_size, imagetype_t type, int bits);
|
int height, int realheight, size_t data_size, imagetype_t type, int bits);
|
||||||
image_t *R_FindImage(const char *name, imagetype_t type);
|
image_t *R_FindImage(const char *name, imagetype_t type);
|
||||||
void R_TextureMode(char *string);
|
void R_TextureMode(const char *string);
|
||||||
void R_ImageList_f(void);
|
void R_ImageList_f(void);
|
||||||
|
|
||||||
void R_SetTexturePalette(unsigned palette[256]);
|
void R_SetTexturePalette(const unsigned palette[256]);
|
||||||
|
|
||||||
void R_InitImages(void);
|
void R_InitImages(void);
|
||||||
void R_ShutdownImages(void);
|
void R_ShutdownImages(void);
|
||||||
|
@ -273,8 +273,8 @@ void R_ShutdownImages(void);
|
||||||
void R_FreeUnusedImages(void);
|
void R_FreeUnusedImages(void);
|
||||||
qboolean R_ImageHasFreeSpace(void);
|
qboolean R_ImageHasFreeSpace(void);
|
||||||
|
|
||||||
void R_TextureAlphaMode(char *string);
|
void R_TextureAlphaMode(const char *string);
|
||||||
void R_TextureSolidMode(char *string);
|
void R_TextureSolidMode(const char *string);
|
||||||
int Scrap_AllocBlock(int w, int h, int *x, int *y);
|
int Scrap_AllocBlock(int w, int h, int *x, int *y);
|
||||||
|
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
|
@ -436,4 +436,15 @@ extern void RDraw_Fill(int x, int y, int w, int h, int c);
|
||||||
extern void RDraw_FadeScreen(void);
|
extern void RDraw_FadeScreen(void);
|
||||||
extern void RDraw_StretchRaw(int x, int y, int w, int h, int cols, int rows, const byte *data, int bits);
|
extern void RDraw_StretchRaw(int x, int y, int w, int h, int cols, int rows, const byte *data, int bits);
|
||||||
|
|
||||||
|
/* public interface funtions */
|
||||||
|
extern int RI_PrepareForWindow(void);
|
||||||
|
extern int RI_InitContext(void* win);
|
||||||
|
extern void RI_BeginRegistration(const char *model);
|
||||||
|
extern struct model_s * RI_RegisterModel(const char *name);
|
||||||
|
extern struct image_s * RI_RegisterSkin(const char *name);
|
||||||
|
extern void RI_SetSky(const char *name, float rotate, int autorotate, const vec3_t axis);
|
||||||
|
extern void RI_EndRegistration(void);
|
||||||
|
extern qboolean RI_IsVSyncActive(void);
|
||||||
|
extern void RI_EndFrame(void);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -29,11 +29,10 @@
|
||||||
|
|
||||||
static YQ2_ALIGNAS_TYPE(int) byte mod_novis[MAX_MAP_LEAFS / 8];
|
static YQ2_ALIGNAS_TYPE(int) byte mod_novis[MAX_MAP_LEAFS / 8];
|
||||||
|
|
||||||
static gl3model_t mod_known[MAX_MOD_KNOWN];
|
static gl3model_t mod_known[MAX_MOD_KNOWN];
|
||||||
static int mod_numknown;
|
static int mod_numknown = 0;
|
||||||
static int mod_max = 0;
|
static int mod_max = 0;
|
||||||
|
int registration_sequence;
|
||||||
int registration_sequence;
|
|
||||||
|
|
||||||
//===============================================================================
|
//===============================================================================
|
||||||
|
|
||||||
|
@ -64,7 +63,7 @@ Mod_HasFreeSpace(void)
|
||||||
return (mod_numknown + mod_max) < MAX_MOD_KNOWN;
|
return (mod_numknown + mod_max) < MAX_MOD_KNOWN;
|
||||||
}
|
}
|
||||||
|
|
||||||
const byte*
|
const byte *
|
||||||
GL3_Mod_ClusterPVS(int cluster, const gl3model_t *model)
|
GL3_Mod_ClusterPVS(int cluster, const gl3model_t *model)
|
||||||
{
|
{
|
||||||
if ((cluster == -1) || !model->vis)
|
if ((cluster == -1) || !model->vis)
|
||||||
|
@ -185,7 +184,7 @@ static int
|
||||||
calcTexinfoAndFacesSize(const byte *mod_base, const lump_t *fl, const lump_t *tl)
|
calcTexinfoAndFacesSize(const byte *mod_base, const lump_t *fl, const lump_t *tl)
|
||||||
{
|
{
|
||||||
dface_t* face_in = (void *)(mod_base + fl->fileofs);
|
dface_t* face_in = (void *)(mod_base + fl->fileofs);
|
||||||
texinfo_t* texinfo_in = (void *)(mod_base + tl->fileofs);
|
const texinfo_t* texinfo_in = (void *)(mod_base + tl->fileofs);
|
||||||
|
|
||||||
if (fl->filelen % sizeof(*face_in) || tl->filelen % sizeof(*texinfo_in))
|
if (fl->filelen % sizeof(*face_in) || tl->filelen % sizeof(*texinfo_in))
|
||||||
{
|
{
|
||||||
|
@ -261,7 +260,7 @@ static int
|
||||||
calcTexinfoAndQFacesSize(const byte *mod_base, const lump_t *fl, const lump_t *tl)
|
calcTexinfoAndQFacesSize(const byte *mod_base, const lump_t *fl, const lump_t *tl)
|
||||||
{
|
{
|
||||||
dqface_t* face_in = (void *)(mod_base + fl->fileofs);
|
dqface_t* face_in = (void *)(mod_base + fl->fileofs);
|
||||||
texinfo_t* texinfo_in = (void *)(mod_base + tl->fileofs);
|
const texinfo_t* texinfo_in = (void *)(mod_base + tl->fileofs);
|
||||||
|
|
||||||
if (fl->filelen % sizeof(*face_in) || tl->filelen % sizeof(*texinfo_in))
|
if (fl->filelen % sizeof(*face_in) || tl->filelen % sizeof(*texinfo_in))
|
||||||
{
|
{
|
||||||
|
@ -337,7 +336,7 @@ static void
|
||||||
Mod_LoadFaces(gl3model_t *loadmodel, const byte *mod_base, const lump_t *l,
|
Mod_LoadFaces(gl3model_t *loadmodel, const byte *mod_base, const lump_t *l,
|
||||||
const bspx_header_t *bspx_header)
|
const bspx_header_t *bspx_header)
|
||||||
{
|
{
|
||||||
int i, count, surfnum, lminfosize, lightofs;
|
int i, count, surfnum, lminfosize;
|
||||||
const dlminfo_t *lminfos;
|
const dlminfo_t *lminfos;
|
||||||
msurface_t *out;
|
msurface_t *out;
|
||||||
dface_t *in;
|
dface_t *in;
|
||||||
|
@ -367,7 +366,7 @@ Mod_LoadFaces(gl3model_t *loadmodel, const byte *mod_base, const lump_t *l,
|
||||||
|
|
||||||
for (surfnum = 0; surfnum < count; surfnum++, in++, out++)
|
for (surfnum = 0; surfnum < count; surfnum++, in++, out++)
|
||||||
{
|
{
|
||||||
int side, ti, planenum;
|
int side, ti, planenum, lightofs;
|
||||||
|
|
||||||
out->firstedge = LittleLong(in->firstedge);
|
out->firstedge = LittleLong(in->firstedge);
|
||||||
out->numedges = LittleShort(in->numedges);
|
out->numedges = LittleShort(in->numedges);
|
||||||
|
@ -463,7 +462,7 @@ static void
|
||||||
Mod_LoadQFaces(gl3model_t *loadmodel, const byte *mod_base, const lump_t *l,
|
Mod_LoadQFaces(gl3model_t *loadmodel, const byte *mod_base, const lump_t *l,
|
||||||
const bspx_header_t *bspx_header)
|
const bspx_header_t *bspx_header)
|
||||||
{
|
{
|
||||||
int i, count, surfnum, lminfosize, lightofs;
|
int i, count, surfnum, lminfosize;
|
||||||
const dlminfo_t *lminfos;
|
const dlminfo_t *lminfos;
|
||||||
msurface_t *out;
|
msurface_t *out;
|
||||||
dqface_t *in;
|
dqface_t *in;
|
||||||
|
@ -493,7 +492,7 @@ Mod_LoadQFaces(gl3model_t *loadmodel, const byte *mod_base, const lump_t *l,
|
||||||
|
|
||||||
for (surfnum = 0; surfnum < count; surfnum++, in++, out++)
|
for (surfnum = 0; surfnum < count; surfnum++, in++, out++)
|
||||||
{
|
{
|
||||||
int side, ti, planenum;
|
int side, ti, planenum, lightofs;
|
||||||
|
|
||||||
out->firstedge = LittleLong(in->firstedge);
|
out->firstedge = LittleLong(in->firstedge);
|
||||||
out->numedges = LittleLong(in->numedges);
|
out->numedges = LittleLong(in->numedges);
|
||||||
|
@ -810,6 +809,11 @@ Mod_ForName(const char *name, gl3model_t *parent_model, qboolean crash)
|
||||||
__func__, mod->name);
|
__func__, mod->name);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (r_validation->value > 0)
|
||||||
|
{
|
||||||
|
R_Printf(PRINT_ALL, "%s: Can't load %s\n", __func__, mod->name);
|
||||||
|
}
|
||||||
|
|
||||||
memset(mod->name, 0, sizeof(mod->name));
|
memset(mod->name, 0, sizeof(mod->name));
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
@ -857,7 +861,14 @@ Mod_ForName(const char *name, gl3model_t *parent_model, qboolean crash)
|
||||||
}
|
}
|
||||||
|
|
||||||
mod->radius = Mod_RadiusFromBounds(mod->mins, mod->maxs);
|
mod->radius = Mod_RadiusFromBounds(mod->mins, mod->maxs);
|
||||||
mod->extradatasize = Hunk_End();
|
if (mod->extradata)
|
||||||
|
{
|
||||||
|
mod->extradatasize = Hunk_End();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
mod->extradatasize = 0;
|
||||||
|
}
|
||||||
|
|
||||||
ri.FS_FreeFile(buf);
|
ri.FS_FreeFile(buf);
|
||||||
|
|
||||||
|
@ -867,6 +878,18 @@ Mod_ForName(const char *name, gl3model_t *parent_model, qboolean crash)
|
||||||
static void
|
static void
|
||||||
Mod_Free(gl3model_t *mod)
|
Mod_Free(gl3model_t *mod)
|
||||||
{
|
{
|
||||||
|
if (!mod->extradata)
|
||||||
|
{
|
||||||
|
/* looks as empty model */
|
||||||
|
memset (mod, 0, sizeof(*mod));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (r_validation->value > 0)
|
||||||
|
{
|
||||||
|
R_Printf(PRINT_ALL, "%s: Unload %s\n", __func__, mod->name);
|
||||||
|
}
|
||||||
|
|
||||||
Hunk_Free(mod->extradata);
|
Hunk_Free(mod->extradata);
|
||||||
memset(mod, 0, sizeof(*mod));
|
memset(mod, 0, sizeof(*mod));
|
||||||
}
|
}
|
||||||
|
@ -892,7 +915,7 @@ void
|
||||||
GL3_BeginRegistration(const char *model)
|
GL3_BeginRegistration(const char *model)
|
||||||
{
|
{
|
||||||
char fullname[MAX_QPATH];
|
char fullname[MAX_QPATH];
|
||||||
cvar_t *flushmap;
|
const cvar_t *flushmap;
|
||||||
|
|
||||||
registration_sequence++;
|
registration_sequence++;
|
||||||
gl3_oldviewcluster = -1; /* force markleafs */
|
gl3_oldviewcluster = -1; /* force markleafs */
|
||||||
|
|
|
@ -28,8 +28,9 @@
|
||||||
#include "header/local.h"
|
#include "header/local.h"
|
||||||
|
|
||||||
YQ2_ALIGNAS_TYPE(int) static byte mod_novis[MAX_MAP_LEAFS / 8];
|
YQ2_ALIGNAS_TYPE(int) static byte mod_novis[MAX_MAP_LEAFS / 8];
|
||||||
|
|
||||||
static gl4model_t mod_known[MAX_MOD_KNOWN];
|
static gl4model_t mod_known[MAX_MOD_KNOWN];
|
||||||
static int mod_numknown;
|
static int mod_numknown = 0;
|
||||||
static int mod_max = 0;
|
static int mod_max = 0;
|
||||||
int registration_sequence;
|
int registration_sequence;
|
||||||
|
|
||||||
|
@ -62,7 +63,7 @@ Mod_HasFreeSpace(void)
|
||||||
return (mod_numknown + mod_max) < MAX_MOD_KNOWN;
|
return (mod_numknown + mod_max) < MAX_MOD_KNOWN;
|
||||||
}
|
}
|
||||||
|
|
||||||
const byte*
|
const byte *
|
||||||
GL4_Mod_ClusterPVS(int cluster, const gl4model_t *model)
|
GL4_Mod_ClusterPVS(int cluster, const gl4model_t *model)
|
||||||
{
|
{
|
||||||
if ((cluster == -1) || !model->vis)
|
if ((cluster == -1) || !model->vis)
|
||||||
|
@ -183,7 +184,7 @@ static int
|
||||||
calcTexinfoAndFacesSize(const byte *mod_base, const lump_t *fl, const lump_t *tl)
|
calcTexinfoAndFacesSize(const byte *mod_base, const lump_t *fl, const lump_t *tl)
|
||||||
{
|
{
|
||||||
dface_t* face_in = (void *)(mod_base + fl->fileofs);
|
dface_t* face_in = (void *)(mod_base + fl->fileofs);
|
||||||
texinfo_t* texinfo_in = (void *)(mod_base + tl->fileofs);
|
const texinfo_t* texinfo_in = (void *)(mod_base + tl->fileofs);
|
||||||
|
|
||||||
if (fl->filelen % sizeof(*face_in) || tl->filelen % sizeof(*texinfo_in))
|
if (fl->filelen % sizeof(*face_in) || tl->filelen % sizeof(*texinfo_in))
|
||||||
{
|
{
|
||||||
|
@ -259,7 +260,7 @@ static int
|
||||||
calcTexinfoAndQFacesSize(const byte *mod_base, const lump_t *fl, const lump_t *tl)
|
calcTexinfoAndQFacesSize(const byte *mod_base, const lump_t *fl, const lump_t *tl)
|
||||||
{
|
{
|
||||||
dqface_t* face_in = (void *)(mod_base + fl->fileofs);
|
dqface_t* face_in = (void *)(mod_base + fl->fileofs);
|
||||||
texinfo_t* texinfo_in = (void *)(mod_base + tl->fileofs);
|
const texinfo_t* texinfo_in = (void *)(mod_base + tl->fileofs);
|
||||||
|
|
||||||
if (fl->filelen % sizeof(*face_in) || tl->filelen % sizeof(*texinfo_in))
|
if (fl->filelen % sizeof(*face_in) || tl->filelen % sizeof(*texinfo_in))
|
||||||
{
|
{
|
||||||
|
@ -335,7 +336,7 @@ static void
|
||||||
Mod_LoadFaces(gl4model_t *loadmodel, const byte *mod_base, const lump_t *l,
|
Mod_LoadFaces(gl4model_t *loadmodel, const byte *mod_base, const lump_t *l,
|
||||||
const bspx_header_t *bspx_header)
|
const bspx_header_t *bspx_header)
|
||||||
{
|
{
|
||||||
int i, count, surfnum, lminfosize, lightofs;
|
int i, count, surfnum, lminfosize;
|
||||||
const dlminfo_t *lminfos;
|
const dlminfo_t *lminfos;
|
||||||
msurface_t *out;
|
msurface_t *out;
|
||||||
dface_t *in;
|
dface_t *in;
|
||||||
|
@ -365,7 +366,7 @@ Mod_LoadFaces(gl4model_t *loadmodel, const byte *mod_base, const lump_t *l,
|
||||||
|
|
||||||
for (surfnum = 0; surfnum < count; surfnum++, in++, out++)
|
for (surfnum = 0; surfnum < count; surfnum++, in++, out++)
|
||||||
{
|
{
|
||||||
int side, ti, planenum;
|
int side, ti, planenum, lightofs;
|
||||||
|
|
||||||
out->firstedge = LittleLong(in->firstedge);
|
out->firstedge = LittleLong(in->firstedge);
|
||||||
out->numedges = LittleShort(in->numedges);
|
out->numedges = LittleShort(in->numedges);
|
||||||
|
@ -461,7 +462,7 @@ static void
|
||||||
Mod_LoadQFaces(gl4model_t *loadmodel, const byte *mod_base, const lump_t *l,
|
Mod_LoadQFaces(gl4model_t *loadmodel, const byte *mod_base, const lump_t *l,
|
||||||
const bspx_header_t *bspx_header)
|
const bspx_header_t *bspx_header)
|
||||||
{
|
{
|
||||||
int i, count, surfnum, lminfosize, lightofs;
|
int i, count, surfnum, lminfosize;
|
||||||
const dlminfo_t *lminfos;
|
const dlminfo_t *lminfos;
|
||||||
msurface_t *out;
|
msurface_t *out;
|
||||||
dqface_t *in;
|
dqface_t *in;
|
||||||
|
@ -491,7 +492,7 @@ Mod_LoadQFaces(gl4model_t *loadmodel, const byte *mod_base, const lump_t *l,
|
||||||
|
|
||||||
for (surfnum = 0; surfnum < count; surfnum++, in++, out++)
|
for (surfnum = 0; surfnum < count; surfnum++, in++, out++)
|
||||||
{
|
{
|
||||||
int side, ti, planenum;
|
int side, ti, planenum, lightofs;
|
||||||
|
|
||||||
out->firstedge = LittleLong(in->firstedge);
|
out->firstedge = LittleLong(in->firstedge);
|
||||||
out->numedges = LittleLong(in->numedges);
|
out->numedges = LittleLong(in->numedges);
|
||||||
|
@ -808,6 +809,11 @@ Mod_ForName(const char *name, gl4model_t *parent_model, qboolean crash)
|
||||||
__func__, mod->name);
|
__func__, mod->name);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (r_validation->value > 0)
|
||||||
|
{
|
||||||
|
R_Printf(PRINT_ALL, "%s: Can't load %s\n", __func__, mod->name);
|
||||||
|
}
|
||||||
|
|
||||||
memset(mod->name, 0, sizeof(mod->name));
|
memset(mod->name, 0, sizeof(mod->name));
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
@ -855,7 +861,14 @@ Mod_ForName(const char *name, gl4model_t *parent_model, qboolean crash)
|
||||||
}
|
}
|
||||||
|
|
||||||
mod->radius = Mod_RadiusFromBounds(mod->mins, mod->maxs);
|
mod->radius = Mod_RadiusFromBounds(mod->mins, mod->maxs);
|
||||||
mod->extradatasize = Hunk_End();
|
if (mod->extradata)
|
||||||
|
{
|
||||||
|
mod->extradatasize = Hunk_End();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
mod->extradatasize = 0;
|
||||||
|
}
|
||||||
|
|
||||||
ri.FS_FreeFile(buf);
|
ri.FS_FreeFile(buf);
|
||||||
|
|
||||||
|
@ -865,6 +878,18 @@ Mod_ForName(const char *name, gl4model_t *parent_model, qboolean crash)
|
||||||
static void
|
static void
|
||||||
Mod_Free(gl4model_t *mod)
|
Mod_Free(gl4model_t *mod)
|
||||||
{
|
{
|
||||||
|
if (!mod->extradata)
|
||||||
|
{
|
||||||
|
/* looks as empty model */
|
||||||
|
memset (mod, 0, sizeof(*mod));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (r_validation->value > 0)
|
||||||
|
{
|
||||||
|
R_Printf(PRINT_ALL, "%s: Unload %s\n", __func__, mod->name);
|
||||||
|
}
|
||||||
|
|
||||||
Hunk_Free(mod->extradata);
|
Hunk_Free(mod->extradata);
|
||||||
memset(mod, 0, sizeof(*mod));
|
memset(mod, 0, sizeof(*mod));
|
||||||
}
|
}
|
||||||
|
@ -890,7 +915,7 @@ void
|
||||||
GL4_BeginRegistration(const char *model)
|
GL4_BeginRegistration(const char *model)
|
||||||
{
|
{
|
||||||
char fullname[MAX_QPATH];
|
char fullname[MAX_QPATH];
|
||||||
cvar_t *flushmap;
|
const cvar_t *flushmap;
|
||||||
|
|
||||||
registration_sequence++;
|
registration_sequence++;
|
||||||
gl4_oldviewcluster = -1; /* force markleafs */
|
gl4_oldviewcluster = -1; /* force markleafs */
|
||||||
|
|
|
@ -135,7 +135,6 @@ const byte *Mod_ClusterPVS(int cluster, const model_t *model);
|
||||||
|
|
||||||
void Mod_Modellist_f(void);
|
void Mod_Modellist_f(void);
|
||||||
void Mod_FreeAll(void);
|
void Mod_FreeAll(void);
|
||||||
void Mod_Free(model_t *mod);
|
|
||||||
|
|
||||||
extern int registration_sequence;
|
extern int registration_sequence;
|
||||||
|
|
||||||
|
|
|
@ -33,7 +33,7 @@
|
||||||
static YQ2_ALIGNAS_TYPE(int) byte mod_novis[MAX_MAP_LEAFS / 8];
|
static YQ2_ALIGNAS_TYPE(int) byte mod_novis[MAX_MAP_LEAFS / 8];
|
||||||
|
|
||||||
static model_t mod_known[MAX_MOD_KNOWN];
|
static model_t mod_known[MAX_MOD_KNOWN];
|
||||||
static int mod_numknown;
|
static int mod_numknown = 0;
|
||||||
static int mod_max = 0;
|
static int mod_max = 0;
|
||||||
|
|
||||||
int registration_sequence;
|
int registration_sequence;
|
||||||
|
@ -129,7 +129,7 @@ static void
|
||||||
Mod_LoadSubmodels(model_t *loadmodel, const byte *mod_base, const lump_t *l)
|
Mod_LoadSubmodels(model_t *loadmodel, const byte *mod_base, const lump_t *l)
|
||||||
{
|
{
|
||||||
dmodel_t *in;
|
dmodel_t *in;
|
||||||
model_t *out;
|
model_t *out;
|
||||||
int i, j, count;
|
int i, j, count;
|
||||||
|
|
||||||
in = (void *)(mod_base + l->fileofs);
|
in = (void *)(mod_base + l->fileofs);
|
||||||
|
@ -633,6 +633,11 @@ Mod_ForName(const char *name, model_t *parent_model, qboolean crash)
|
||||||
__func__, mod->name);
|
__func__, mod->name);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (r_validation->value > 0)
|
||||||
|
{
|
||||||
|
R_Printf(PRINT_ALL, "%s: Can't load %s\n", __func__, mod->name);
|
||||||
|
}
|
||||||
|
|
||||||
memset(mod->name, 0, sizeof(mod->name));
|
memset(mod->name, 0, sizeof(mod->name));
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
@ -680,16 +685,35 @@ Mod_ForName(const char *name, model_t *parent_model, qboolean crash)
|
||||||
}
|
}
|
||||||
|
|
||||||
mod->radius = Mod_RadiusFromBounds(mod->mins, mod->maxs);
|
mod->radius = Mod_RadiusFromBounds(mod->mins, mod->maxs);
|
||||||
mod->extradatasize = Hunk_End();
|
if (mod->extradata)
|
||||||
|
{
|
||||||
|
mod->extradatasize = Hunk_End();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
mod->extradatasize = 0;
|
||||||
|
}
|
||||||
|
|
||||||
ri.FS_FreeFile(buf);
|
ri.FS_FreeFile(buf);
|
||||||
|
|
||||||
return mod;
|
return mod;
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
static void
|
||||||
Mod_Free(model_t *mod)
|
Mod_Free(model_t *mod)
|
||||||
{
|
{
|
||||||
|
if (!mod->extradata)
|
||||||
|
{
|
||||||
|
/* looks as empty model */
|
||||||
|
memset (mod, 0, sizeof(*mod));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (r_validation->value > 0)
|
||||||
|
{
|
||||||
|
R_Printf(PRINT_ALL, "%s: Unload %s\n", __func__, mod->name);
|
||||||
|
}
|
||||||
|
|
||||||
Hunk_Free(mod->extradata);
|
Hunk_Free(mod->extradata);
|
||||||
memset(mod, 0, sizeof(*mod));
|
memset(mod, 0, sizeof(*mod));
|
||||||
}
|
}
|
||||||
|
@ -715,7 +739,7 @@ void
|
||||||
RE_BeginRegistration(const char *model)
|
RE_BeginRegistration(const char *model)
|
||||||
{
|
{
|
||||||
char fullname[MAX_QPATH];
|
char fullname[MAX_QPATH];
|
||||||
cvar_t *flushmap;
|
const cvar_t *flushmap;
|
||||||
|
|
||||||
registration_sequence++;
|
registration_sequence++;
|
||||||
r_oldviewcluster = -1; /* force markleafs */
|
r_oldviewcluster = -1; /* force markleafs */
|
||||||
|
|
|
@ -192,7 +192,7 @@ void R_RotateForEntity(entity_t *e, float *mvMatrix);
|
||||||
void R_MarkLeaves(void);
|
void R_MarkLeaves(void);
|
||||||
|
|
||||||
void EmitWaterPolys(msurface_t *fa, image_t *texture,
|
void EmitWaterPolys(msurface_t *fa, image_t *texture,
|
||||||
float *modelMatrix, const float *color,
|
const float *modelMatrix, const float *color,
|
||||||
qboolean solid_surface);
|
qboolean solid_surface);
|
||||||
void RE_AddSkySurface(msurface_t *fa);
|
void RE_AddSkySurface(msurface_t *fa);
|
||||||
void RE_ClearSkyBox(void);
|
void RE_ClearSkyBox(void);
|
||||||
|
|
|
@ -56,8 +56,8 @@ VkResult buffer_create(BufferResource_t *buf,
|
||||||
VkResult buffer_destroy(BufferResource_t *buf);
|
VkResult buffer_destroy(BufferResource_t *buf);
|
||||||
void buffer_unmap(BufferResource_t *buf);
|
void buffer_unmap(BufferResource_t *buf);
|
||||||
void *buffer_map(BufferResource_t *buf);
|
void *buffer_map(BufferResource_t *buf);
|
||||||
VkResult buffer_flush(BufferResource_t *buf);
|
VkResult buffer_flush(const BufferResource_t *buf);
|
||||||
VkResult buffer_invalidate(BufferResource_t *buf);
|
VkResult buffer_invalidate(const BufferResource_t *buf);
|
||||||
|
|
||||||
VkResult image_create(ImageResource_t *img,
|
VkResult image_create(ImageResource_t *img,
|
||||||
VkImageCreateInfo img_create_info,
|
VkImageCreateInfo img_create_info,
|
||||||
|
|
|
@ -30,12 +30,11 @@
|
||||||
static YQ2_ALIGNAS_TYPE(int) byte mod_novis[MAX_MAP_LEAFS / 8];
|
static YQ2_ALIGNAS_TYPE(int) byte mod_novis[MAX_MAP_LEAFS / 8];
|
||||||
|
|
||||||
static model_t *models_known;
|
static model_t *models_known;
|
||||||
static int mod_numknown = 0;
|
static int mod_numknown = 0;
|
||||||
static int mod_max = 0;
|
static int mod_max = 0;
|
||||||
static int mod_loaded = 0;
|
static int mod_loaded = 0;
|
||||||
static int models_known_max = 0;
|
static int models_known_max = 0;
|
||||||
|
int registration_sequence;
|
||||||
int registration_sequence;
|
|
||||||
|
|
||||||
const byte *
|
const byte *
|
||||||
Mod_ClusterPVS(int cluster, const model_t *model)
|
Mod_ClusterPVS(int cluster, const model_t *model)
|
||||||
|
@ -100,7 +99,7 @@ static void
|
||||||
Mod_LoadSubmodels(model_t *loadmodel, const byte *mod_base, const lump_t *l)
|
Mod_LoadSubmodels(model_t *loadmodel, const byte *mod_base, const lump_t *l)
|
||||||
{
|
{
|
||||||
dmodel_t *in;
|
dmodel_t *in;
|
||||||
model_t *out;
|
model_t *out;
|
||||||
int i, j, count;
|
int i, j, count;
|
||||||
|
|
||||||
in = (void *)(mod_base + l->fileofs);
|
in = (void *)(mod_base + l->fileofs);
|
||||||
|
@ -159,7 +158,7 @@ static int
|
||||||
calcTexinfoAndFacesSize(const byte *mod_base, const lump_t *fl, const lump_t *tl)
|
calcTexinfoAndFacesSize(const byte *mod_base, const lump_t *fl, const lump_t *tl)
|
||||||
{
|
{
|
||||||
dface_t* face_in = (void *)(mod_base + fl->fileofs);
|
dface_t* face_in = (void *)(mod_base + fl->fileofs);
|
||||||
texinfo_t* texinfo_in = (void *)(mod_base + tl->fileofs);
|
const texinfo_t* texinfo_in = (void *)(mod_base + tl->fileofs);
|
||||||
|
|
||||||
if (fl->filelen % sizeof(*face_in) || tl->filelen % sizeof(*texinfo_in))
|
if (fl->filelen % sizeof(*face_in) || tl->filelen % sizeof(*texinfo_in))
|
||||||
{
|
{
|
||||||
|
@ -235,7 +234,7 @@ static int
|
||||||
calcTexinfoAndQFacesSize(const byte *mod_base, const lump_t *fl, const lump_t *tl)
|
calcTexinfoAndQFacesSize(const byte *mod_base, const lump_t *fl, const lump_t *tl)
|
||||||
{
|
{
|
||||||
dqface_t* face_in = (void *)(mod_base + fl->fileofs);
|
dqface_t* face_in = (void *)(mod_base + fl->fileofs);
|
||||||
texinfo_t* texinfo_in = (void *)(mod_base + tl->fileofs);
|
const texinfo_t* texinfo_in = (void *)(mod_base + tl->fileofs);
|
||||||
|
|
||||||
if (fl->filelen % sizeof(*face_in) || tl->filelen % sizeof(*texinfo_in))
|
if (fl->filelen % sizeof(*face_in) || tl->filelen % sizeof(*texinfo_in))
|
||||||
{
|
{
|
||||||
|
@ -311,7 +310,7 @@ static void
|
||||||
Mod_LoadFaces(model_t *loadmodel, const byte *mod_base, const lump_t *l,
|
Mod_LoadFaces(model_t *loadmodel, const byte *mod_base, const lump_t *l,
|
||||||
const bspx_header_t *bspx_header)
|
const bspx_header_t *bspx_header)
|
||||||
{
|
{
|
||||||
int i, count, surfnum, lminfosize, lightofs;
|
int i, count, surfnum, lminfosize;
|
||||||
const dlminfo_t *lminfos;
|
const dlminfo_t *lminfos;
|
||||||
msurface_t *out;
|
msurface_t *out;
|
||||||
dface_t *in;
|
dface_t *in;
|
||||||
|
@ -341,7 +340,7 @@ Mod_LoadFaces(model_t *loadmodel, const byte *mod_base, const lump_t *l,
|
||||||
|
|
||||||
for (surfnum = 0; surfnum < count; surfnum++, in++, out++)
|
for (surfnum = 0; surfnum < count; surfnum++, in++, out++)
|
||||||
{
|
{
|
||||||
int side, ti, planenum;
|
int side, ti, planenum, lightofs;
|
||||||
|
|
||||||
out->firstedge = LittleLong(in->firstedge);
|
out->firstedge = LittleLong(in->firstedge);
|
||||||
out->numedges = LittleShort(in->numedges);
|
out->numedges = LittleShort(in->numedges);
|
||||||
|
@ -407,7 +406,7 @@ Mod_LoadFaces(model_t *loadmodel, const byte *mod_base, const lump_t *l,
|
||||||
}
|
}
|
||||||
|
|
||||||
R_SubdivideSurface(loadmodel->surfedges, loadmodel->vertexes,
|
R_SubdivideSurface(loadmodel->surfedges, loadmodel->vertexes,
|
||||||
loadmodel->edges, out); // cut up polygon for warps
|
loadmodel->edges, out); /* cut up polygon for warps */
|
||||||
}
|
}
|
||||||
|
|
||||||
if (r_fixsurfsky->value)
|
if (r_fixsurfsky->value)
|
||||||
|
@ -437,7 +436,7 @@ static void
|
||||||
Mod_LoadQFaces(model_t *loadmodel, const byte *mod_base, const lump_t *l,
|
Mod_LoadQFaces(model_t *loadmodel, const byte *mod_base, const lump_t *l,
|
||||||
const bspx_header_t *bspx_header)
|
const bspx_header_t *bspx_header)
|
||||||
{
|
{
|
||||||
int i, count, surfnum, lminfosize, lightofs;
|
int i, count, surfnum, lminfosize;
|
||||||
const dlminfo_t *lminfos;
|
const dlminfo_t *lminfos;
|
||||||
msurface_t *out;
|
msurface_t *out;
|
||||||
dqface_t *in;
|
dqface_t *in;
|
||||||
|
@ -467,7 +466,7 @@ Mod_LoadQFaces(model_t *loadmodel, const byte *mod_base, const lump_t *l,
|
||||||
|
|
||||||
for (surfnum = 0; surfnum < count; surfnum++, in++, out++)
|
for (surfnum = 0; surfnum < count; surfnum++, in++, out++)
|
||||||
{
|
{
|
||||||
int side, ti, planenum;
|
int side, ti, planenum, lightofs;
|
||||||
|
|
||||||
out->firstedge = LittleLong(in->firstedge);
|
out->firstedge = LittleLong(in->firstedge);
|
||||||
out->numedges = LittleLong(in->numedges);
|
out->numedges = LittleLong(in->numedges);
|
||||||
|
@ -774,7 +773,7 @@ Mod_ForName(const char *name, model_t *parent_model, qboolean crash)
|
||||||
strcpy(mod->name, name);
|
strcpy(mod->name, name);
|
||||||
|
|
||||||
/* load the file */
|
/* load the file */
|
||||||
modfilelen = Mod_LoadFile (mod->name, &buf);
|
modfilelen = Mod_LoadFile(mod->name, &buf);
|
||||||
|
|
||||||
if (!buf)
|
if (!buf)
|
||||||
{
|
{
|
||||||
|
@ -793,16 +792,14 @@ Mod_ForName(const char *name, model_t *parent_model, qboolean crash)
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
// update count of loaded models
|
/* update count of loaded models */
|
||||||
mod_loaded ++;
|
mod_loaded ++;
|
||||||
if (r_validation->value > 0)
|
if (r_validation->value > 0)
|
||||||
{
|
{
|
||||||
R_Printf(PRINT_ALL, "%s: Load %s[%d]\n", __func__, mod->name, mod_loaded);
|
R_Printf(PRINT_ALL, "%s: Load %s[%d]\n", __func__, mod->name, mod_loaded);
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
/* fill it in */
|
||||||
// fill it in
|
|
||||||
//
|
|
||||||
|
|
||||||
/* call the apropriate loader */
|
/* call the apropriate loader */
|
||||||
switch (LittleLong(*(unsigned *)buf))
|
switch (LittleLong(*(unsigned *)buf))
|
||||||
|
@ -866,7 +863,7 @@ Mod_Free(model_t *mod)
|
||||||
{
|
{
|
||||||
if (!mod->extradata)
|
if (!mod->extradata)
|
||||||
{
|
{
|
||||||
// looks as empty model
|
/* looks as empty model */
|
||||||
memset (mod, 0, sizeof(*mod));
|
memset (mod, 0, sizeof(*mod));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -913,7 +910,7 @@ void
|
||||||
RE_BeginRegistration(const char *model)
|
RE_BeginRegistration(const char *model)
|
||||||
{
|
{
|
||||||
char fullname[MAX_QPATH];
|
char fullname[MAX_QPATH];
|
||||||
cvar_t *flushmap;
|
const cvar_t *flushmap;
|
||||||
|
|
||||||
Mod_Reallocate();
|
Mod_Reallocate();
|
||||||
|
|
||||||
|
@ -999,7 +996,7 @@ Mod_HasFreeSpace(void)
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
Mod_Modellist_f (void)
|
Mod_Modellist_f(void)
|
||||||
{
|
{
|
||||||
int i, total, used;
|
int i, total, used;
|
||||||
model_t *mod;
|
model_t *mod;
|
||||||
|
|
|
@ -665,7 +665,7 @@ image_destroy(ImageResource_t *img)
|
||||||
}
|
}
|
||||||
|
|
||||||
VkResult
|
VkResult
|
||||||
buffer_flush(BufferResource_t *buf)
|
buffer_flush(const BufferResource_t *buf)
|
||||||
{
|
{
|
||||||
VkResult result = VK_SUCCESS;
|
VkResult result = VK_SUCCESS;
|
||||||
|
|
||||||
|
@ -680,7 +680,7 @@ buffer_flush(BufferResource_t *buf)
|
||||||
}
|
}
|
||||||
|
|
||||||
VkResult
|
VkResult
|
||||||
buffer_invalidate(BufferResource_t *buf)
|
buffer_invalidate(const BufferResource_t *buf)
|
||||||
{
|
{
|
||||||
VkResult result = VK_SUCCESS;
|
VkResult result = VK_SUCCESS;
|
||||||
|
|
||||||
|
|
|
@ -46,7 +46,7 @@ static float sky_min, sky_max;
|
||||||
* Does a water warp on the pre-fragmented mpoly_t chain
|
* Does a water warp on the pre-fragmented mpoly_t chain
|
||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
EmitWaterPolys(msurface_t *fa, image_t *texture, float *modelMatrix,
|
EmitWaterPolys(msurface_t *fa, image_t *texture, const float *modelMatrix,
|
||||||
const float *color, qboolean solid_surface)
|
const float *color, qboolean solid_surface)
|
||||||
{
|
{
|
||||||
mpoly_t *p, *bp;
|
mpoly_t *p, *bp;
|
||||||
|
|
Loading…
Reference in a new issue