components/prboom/gl_texture.c
//e6y: "force" flag for loading texture with zero index
"force" flag for loading texture with zero index
" force " flag for loading texture with zero index
GLTexture *gld_RegisterTexture(int texture_num, boolean mipmap, boolean force)
{
  GLTexture *gltexture;
  if (texture_num==NO_TEXTURE && !force)
    return NULL;
  gltexture=gld_AddNewGLTexture(texture_num);
  if (!gltexture)
    return NULL;
  if (gltexture->textype==GLDT_UNREGISTERED)
  {
    texture_t *texture=NULL;
    if ((texture_num>=0) || (texture_num<numtextures))
      texture=textures[texture_num];
    if (!texture)
      return NULL;
    gltexture->textype=GLDT_BROKEN;
    gltexture->index=texture_num;
    gltexture->mipmap=mipmap;
    gltexture->realtexwidth=texture->width;
    gltexture->realtexheight=texture->height;
    gltexture->leftoffset=0;
    gltexture->topoffset=0;
    gltexture->tex_width=gld_GetTexDimension(gltexture->realtexwidth);
    gltexture->tex_height=gld_GetTexDimension(gltexture->realtexheight);
    gltexture->width=MIN(gltexture->realtexwidth, gltexture->tex_width);
    gltexture->height=MIN(gltexture->realtexheight, gltexture->tex_height);
    gltexture->buffer_width=gltexture->tex_width;
    gltexture->buffer_height=gltexture->tex_height;
#ifdef USE_GLU_IMAGESCALE
    gltexture->width=gltexture->tex_width;
    gltexture->height=gltexture->tex_height;
    gltexture->buffer_width=gltexture->realtexwidth;
    gltexture->buffer_height=gltexture->realtexheight;
#endif
    if (gltexture->mipmap & use_mipmapping)
    {
      gltexture->width=gltexture->tex_width;
      gltexture->height=gltexture->tex_height;
      gltexture->buffer_width=gltexture->realtexwidth;
      gltexture->buffer_height=gltexture->realtexheight;
    }
    gltexture->buffer_size=gltexture->buffer_width*gltexture->buffer_height*4;
    if (gltexture->realtexwidth>gltexture->buffer_width)
      return gltexture;
    if (gltexture->realtexheight>gltexture->buffer_height)
      return gltexture;
    gltexture->textype=GLDT_TEXTURE;
  }
  return gltexture;
}
GLTexture * gld_RegisterTexture ( int texture_num , boolean mipmap , boolean force ) { GLTexture * gltexture ; if ( texture_num == NO_TEXTURE && ! force ) return NULL ; gltexture = gld_AddNewGLTexture ( texture_num ) ; if ( ! gltexture ) return NULL ; if ( gltexture -> textype == GLDT_UNREGISTERED ) { texture_t * texture = NULL ; if ( ( texture_num >= 0 ) || ( texture_num < numtextures ) ) texture = textures [ texture_num ] ; if ( ! texture ) return NULL ; gltexture -> textype = GLDT_BROKEN ; gltexture -> index = texture_num ; gltexture -> mipmap = mipmap ; gltexture -> realtexwidth = texture -> width ; gltexture -> realtexheight = texture -> height ; gltexture -> leftoffset = 0 ; gltexture -> topoffset = 0 ; gltexture -> tex_width = gld_GetTexDimension ( gltexture -> realtexwidth ) ; gltexture -> tex_height = gld_GetTexDimension ( gltexture -> realtexheight ) ; gltexture -> width = MIN ( gltexture -> realtexwidth , gltexture -> tex_width ) ; gltexture -> height = MIN ( gltexture -> realtexheight , gltexture -> tex_height ) ; gltexture -> buffer_width = gltexture -> tex_width ; gltexture -> buffer_height = gltexture -> tex_height ; #ifdef USE_GLU_IMAGESCALE gltexture -> width = gltexture -> tex_width ; gltexture -> height = gltexture -> tex_height ; gltexture -> buffer_width = gltexture -> realtexwidth ; gltexture -> buffer_height = gltexture -> realtexheight ; #endif if ( gltexture -> mipmap & use_mipmapping ) { gltexture -> width = gltexture -> tex_width ; gltexture -> height = gltexture -> tex_height ; gltexture -> buffer_width = gltexture -> realtexwidth ; gltexture -> buffer_height = gltexture -> realtexheight ; } gltexture -> buffer_size = gltexture -> buffer_width * gltexture -> buffer_height * 4 ; if ( gltexture -> realtexwidth > gltexture -> buffer_width ) return gltexture ; if ( gltexture -> realtexheight > gltexture -> buffer_height ) return gltexture ; gltexture -> textype = GLDT_TEXTURE ; } return gltexture ; }
e6y: "force" flag for loading texture with zero index
e6y : " force " flag for loading texture with zero index
//e6y: textures with zero index should be loaded sometimes