countBits

This commit is contained in:
krystalgamer 2024-05-25 19:07:37 +02:00
parent 8baca6dae0
commit 02352d288c
2 changed files with 27 additions and 1 deletions

View File

@ -24,10 +24,33 @@ float PCTex_GetTextureHScale(int index)
return gGlobalTextures[index].hScale;
}
// @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;
}
void validate_WeirdTextureHolder(void)
{
VALIDATE_SIZE(WeirdTextureHolder, 0x68);
VALIDATE(WeirdTextureHolder, texture, 0x0);
VALIDATE(WeirdTextureHolder, wScale, 0x4);
VALIDATE(WeirdTextureHolder, hScale, 0x8);
VALIDATE(WeirdTextureHolder, flags, 0xC);
}

View File

@ -11,12 +11,15 @@ struct WeirdTextureHolder
Bitmap256* texture;
float wScale;
float hScale;
unsigned char pad[0x68-6-4];
int flags;
unsigned char pad[0x68-6-0xC];
};
EXPORT void PCTex_SetTextureUserData(int, Bitmap256*);
EXPORT float PCTex_GetTextureWScale(int);
EXPORT float PCTex_GetTextureHScale(int);
EXPORT int PCTex_GetTextureFlags(int);
EXPORT int countBits(unsigned int);
void validate_WeirdTextureHolder(void);