Sint32 SetTextureManageNum(Uint32 globalIndex,Uint32 bank,NJS_PVRHEADERDATA *pvrh)
{
Sint32 no;
Sint32 ret;
NJS_TEXMANAGE *texmanage;
NJS_TEXSYSTEM *texsystem;
/* _nj_texsystemから空いているところを探す */
no = njGetTexManageNum(&texmanage,&texsystem);
if(no < 0){
return -1;
}
texmanage->texsys = texsystem;
/* pvrhからサーフェス情報を取得する */
if(njCheckTextureFormatManageNum(no,pvrh) < 0){
return -1;
}
/* ここでtexfixedareaから空いている領域を取得して設定する */
//texsystem->texsurface.TextureSize ->njCheckTextureFormat関数実行で値は設定されている
//texsystem->texsurface.pSurface ->この領域にtexfixedareaから取得した領域を設定する
if((texsystem->texsurface.pSurface = TexMalloc(texsystem->texsurface.TextureSize)) == NULL){
texmanage->texsys = NULL;
return -1;
}
/******************************************************/
/* グローバルインデックスの設定 */
if(globalIndex != NJD_GLOBAXINDEX_FIRST_VAL)
texmanage->texsys->globalIndex = globalIndex;
/* パレットの設定 */
if(njCheckPaletteType(pvrh->nTextureType)){
texmanage->bank = bank;
}
else{
texmanage->bank = NJD_BANK_FIRST_VAL;
}
/* パラメータの設定 */
njSetTextureParamEx(texmanage);
texmanage->count = 1;
texmanage->texsys->count = 1;
_nj_tex_count++;
return no;
}