Forum Discussion
10 years ago
Hey @brujah236 ,
Actually a little bit of magic here, first see http://forums.thesims.com/en_US/discussion/878085 which describes the cutout resource format.
In the format, there is a baseFileNameHash. The texture key is derived from this key. Generally the string “_0_0_f” is added to the hash, and is the texture key.
However, if the widthAndMappingFlags indicates multiple textures (i.e. bit 6 is 0) then then it’s slightly different. In this case we add “_x_y_f” where x=level and y=tile. Although it looks to me that this feature is not actually used so you may not run into this case.
To add to the baseFileNameHash, do something like the following (where baseFileNameHash is the initial hash):
An example:
-SGMS
Actually a little bit of magic here, first see http://forums.thesims.com/en_US/discussion/878085 which describes the cutout resource format.
In the format, there is a baseFileNameHash. The texture key is derived from this key. Generally the string “_0_0_f” is added to the hash, and is the texture key.
However, if the widthAndMappingFlags indicates multiple textures (i.e. bit 6 is 0) then then it’s slightly different. In this case we add “_x_y_f” where x=level and y=tile. Although it looks to me that this feature is not actually used so you may not run into this case.
To add to the baseFileNameHash, do something like the following (where baseFileNameHash is the initial hash):
const uint64 HASH_MULTIPLICAND = 1099511628211;
uint64 HashString64(const char8 *s, size_t len, uint64 initialHash)
{
uint64_t hash = initialHash;
while(len--)
hash = (hash * HASH_MULTIPLICAND) ^ Tolower(*s++);
return hash;
}
An example:
baseFileNameHash = 0xd0777af4228641d0
Texture key = 0x865cc5bd8daac443 (type is 0x00b2d882)
-SGMS