Add AssetLoader for IW5 StringTable

This commit is contained in:
Jan
2023-08-22 17:20:43 +02:00
parent 3c2774614f
commit 3233186d8b
5 changed files with 115 additions and 1 deletions

View File

@ -4,6 +4,22 @@
using namespace IW5;
int Common::StringTable_HashString(const char* str)
{
if (!str)
return 0;
auto result = 0;
auto offset = 0;
while (str[offset])
{
const auto c = tolower(str[offset++]);
result = c + 31 * result;
}
return result;
}
PackedTexCoords Common::Vec2PackTexCoords(const vec2_t* in)
{
return PackedTexCoords{ Pack32::Vec2PackTexCoords(reinterpret_cast<const float*>(in)) };