spidey-decomp/PCTex.cpp

82 lines
1.2 KiB
C++
Raw Normal View History

2024-05-25 16:41:17 +00:00
#include "PCTex.h"
#include "validate.h"
static WeirdTextureHolder gGlobalTextures[2];
// @NotOk
// globals
void PCTex_SetTextureUserData(int index, Bitmap256* texture)
{
gGlobalTextures[index].texture = texture;
}
// @NotOk
// globals
float PCTex_GetTextureWScale(int index)
{
return gGlobalTextures[index].wScale;
}
// @NotOk
// globals
float PCTex_GetTextureHScale(int index)
{
return gGlobalTextures[index].hScale;
}
2024-05-25 17:07:37 +00:00
// @NotOk
// globals
int PCTex_GetTextureFlags(int index)
{
return gGlobalTextures[index].flags;
}
// @Ok
int __inline countBits(unsigned int value)
{
int bits = 0;
while (value)
{
bits += value & 1;
value >>= 1;
}
return bits;
}
2024-05-25 17:10:49 +00:00
// @Ok
int __inline countLeadingBits(unsigned int value)
{
int bits = 0;
if (!value)
return 0;
while(!(value & 1))
{
value >>= 1;
bits++;
}
return bits;
}
// @NotOk
// Globals
int PCTex_GetTextureSplitID(int index, int id)
{
return gGlobalTextures[index].split[id];
}
2024-05-25 16:41:17 +00:00
void validate_WeirdTextureHolder(void)
{
VALIDATE_SIZE(WeirdTextureHolder, 0x68);
VALIDATE(WeirdTextureHolder, texture, 0x0);
VALIDATE(WeirdTextureHolder, wScale, 0x4);
2024-05-25 17:07:37 +00:00
VALIDATE(WeirdTextureHolder, hScale, 0x8);
VALIDATE(WeirdTextureHolder, flags, 0xC);
VALIDATE(WeirdTextureHolder, split, 0x10);
2024-05-25 16:41:17 +00:00
}