PCTex_FindUnusedTextureId

This commit is contained in:
krystalgamer 2024-08-19 22:42:20 +01:00
parent 4b6630093f
commit 992e167393
3 changed files with 28 additions and 9 deletions

View File

@ -5,11 +5,11 @@
#include <cstring>
const u32 GLOBAL_TEXTURE_COUNT = 1024;
const i32 GLOBAL_TEXTURE_COUNT = 1024;
EXPORT SPCTexture gGlobalTextures[GLOBAL_TEXTURE_COUNT];
// @Ok
u8 CheckValidTexture(i32 index)
u8 CheckValidTexture(u32 index)
{
if (index < GLOBAL_TEXTURE_COUNT)
{
@ -104,10 +104,25 @@ void PCTex_CreateTexturePVRInId(i32,i32,i32,u32,void const *,u32,char const *,u3
printf("PCTex_CreateTexturePVRInId(i32,i32,i32,u32,void const *,u32,char const *,u32)");
}
// @SMALLTODO
void PCTex_FindUnusedTextureId(void)
// @Ok
i32 PCTex_FindUnusedTextureId(void)
{
printf("PCTex_FindUnusedTextureId(void)");
i32 id = 8;
for (;
id < GLOBAL_TEXTURE_COUNT;
id++)
{
if (!gGlobalTextures[id].mD3DTex && !gGlobalTextures[id].mSplit)
break;
}
if (id >= GLOBAL_TEXTURE_COUNT)
{
error("out of texture handles.");
}
print_if_false(1u, "id must fit into 10 bits!");
return id;
}
// @SMALLTODO
@ -138,7 +153,7 @@ void PCTex_GetTextureSize(
*pTwo = gGlobalTextures[index].mSizeTwo;
}
// @SMALLTODO
// @Ok
i32 PCTex_GetTextureSplitCount(i32 index)
{
return gGlobalTextures[index].mSplitCount;

View File

@ -53,7 +53,7 @@ EXPORT int countBits(unsigned int);
EXPORT int countLeadingBits(unsigned int);
EXPORT int PCTex_GetTextureSplitID(int, int);
EXPORT u8 CheckValidTexture(i32);
EXPORT u8 CheckValidTexture(u32);
EXPORT void ConvertPSXPaletteToPC(u16 const *,u16 *,u32,u32);
EXPORT void PCTEX_Init(void);
EXPORT void* PCTex_BufferPVR(const char *,char *);
@ -63,7 +63,7 @@ EXPORT void PCTex_CreateTexture16(i32,i32,void const *,u16 const *,char const *,
EXPORT void PCTex_CreateTexture256(i32,i32,void const *,u16 const *,u32,char const *,i32,i32);
EXPORT i32 PCTex_CreateTexturePVR(i32,i32,u32,void *,u32,const char *,u32);
EXPORT void PCTex_CreateTexturePVRInId(i32,i32,i32,u32,void const *,u32,char const *,u32);
EXPORT void PCTex_FindUnusedTextureId(void);
EXPORT i32 PCTex_FindUnusedTextureId(void);
EXPORT void PCTex_FreePcIcons(void);
EXPORT IDirectDrawSurface7* PCTex_GetDirect3DTexture(i32);
EXPORT void PCTex_GetInvTextureSize(i32,float *,float *);

View File

@ -15,7 +15,7 @@ static unsigned __int16 * const word_6B2478 = (unsigned __int16*)0x6B2478;
//static int * const gTimerRelated = (int*)0x006B4CA8;
static void print_if_false(unsigned char cry, char * message, ...) {
if (cry) {
if (!cry) {
printf(message);
}
}
@ -28,4 +28,8 @@ static void stubbed_printf(char *message){
puts(message);
}
static void error(const char *message, ...) {
printf("static void error(const char *message, ...)");
}
#endif