void FreeTexManage(NJS_TEXMANAGE *texmanage);
Sint32 ReleaseTextureLN(NJS_TEXMANAGE *pmng);
Sint32 ReleaseTexture(NJS_TEXLIST *texlist,Uint32 n)
{
NJS_TEXMANAGE *pmng;
pmng = (NJS_TEXMANAGE*)texlist->textures[n].texaddr;
return ReleaseTextureLN(pmng);
}
Sint32 ReleaseTextureLN(NJS_TEXMANAGE *pmng)
{
Sint32 ret;
if(pmng->texsys == NULL){
return -1;
}
if(pmng->count > 0){
pmng->count--;
}
if(pmng->texsys->count > 0){
pmng->texsys->count--;
if(pmng->texsys->count == 0){
ret = njReleaseTextureLowEx(pmng);
}
}
FreeTexManage(pmng);
return ret;
}
void FreeTexManage(NJS_TEXMANAGE *texmanage)
{
NJS_TEXSYSTEM *texsys;
texsys = texmanage->texsys;
if(texsys != NULL){
texsys->globalIndex = NJD_GLOBAXINDEX_FIRST_VAL;
texsys->texsurface.Type = 0;
texsys->texsurface.BitDepth = 0;
texsys->texsurface.PixelFormat = 0;
texsys->texsurface.nWidth = 0;
texsys->texsurface.nHeight = 0;
texsys->texsurface.TextureSize = 0;
texsys->texsurface.fSurfaceFlags = 0;
texsys->texsurface.pSurface = 0;
texsys->count = 0;
}
texmanage->bank = NJD_BANK_FIRST_VAL;
texmanage->tspparam = 0;
texmanage->texparam = 0;
texmanage->texsys = NULL;
texmanage->texflag = 0;
texmanage->count = 0;
}