Skip to content

Commit

Permalink
fix SND_HashName
Browse files Browse the repository at this point in the history
  • Loading branch information
Alex committed Jan 1, 2024
1 parent 85539b2 commit c8f1c16
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 26 deletions.
2 changes: 1 addition & 1 deletion src/Common/Game/T6/CommonT6.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ namespace T6
while (str[offset])
{
const auto c = tolower(str[offset++]);
result = c + 33 * result;
result = c + 0x1003F * result;
}

if (!result)
Expand Down
10 changes: 5 additions & 5 deletions src/Common/Game/T6/T6_Assets.h
Original file line number Diff line number Diff line change
Expand Up @@ -5602,8 +5602,8 @@ namespace T6
struct SndAliasFlags
{
// flags0
SndAliasLoopType looping : 1; // 0
SndAliasPanType panType : 1; // 1
unsigned int looping : 1; // 0
unsigned int panType : 1; // 1
unsigned int distanceLpf : 1; // 2
unsigned int doppler : 1; // 3
unsigned int isBig : 1; // 4
Expand All @@ -5614,7 +5614,7 @@ namespace T6
unsigned int voiceLimit : 1; // 9
unsigned int ignoreMaxDist : 1; // 10
unsigned int busType : 4; // 11-14
SndAliasLoadType loadType : 2; // 15-16
unsigned int loadType : 2; // 15-16
unsigned int volumeGroup : 5; // 17-21
unsigned int fluxType : 3; // 22-24
unsigned int limitType : 2; // 25-26
Expand Down Expand Up @@ -5674,9 +5674,9 @@ namespace T6
char duckGroup;
};

#ifndef __zonecodegenerator
#ifndef __zonecodegenerator
static_assert(sizeof(SndAliasFlags) == 8);
#endif
#endif

struct type_align(4) pathlink_s
{
Expand Down
30 changes: 10 additions & 20 deletions src/ObjWriting/Game/T6/AssetDumpers/AssetDumperSndBank.cpp
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#include "AssetDumperSndBank.h"
#include "Game/T6/CommonT6.h"

#include "Csv/CsvStream.h"
#include "Game/T6/CommonT6.h"
#include "ObjContainer/SoundBank/SoundBank.h"
#include "Sound/WavWriter.h"
#include "nlohmann/json.hpp"
Expand Down Expand Up @@ -169,25 +169,15 @@ namespace
"",
};

const std::unordered_map<unsigned int, std::string> CURVES_MAP{
{T6::Common::SND_HashName(CURVES_ENUM[0].data()), CURVES_ENUM[0]},
{T6::Common::SND_HashName(CURVES_ENUM[1].data()), CURVES_ENUM[1]},
{T6::Common::SND_HashName(CURVES_ENUM[2].data()), CURVES_ENUM[2]},
{T6::Common::SND_HashName(CURVES_ENUM[3].data()), CURVES_ENUM[3]},
{T6::Common::SND_HashName(CURVES_ENUM[4].data()), CURVES_ENUM[4]},
{T6::Common::SND_HashName(CURVES_ENUM[5].data()), CURVES_ENUM[5]},
{T6::Common::SND_HashName(CURVES_ENUM[6].data()), CURVES_ENUM[6]},
{T6::Common::SND_HashName(CURVES_ENUM[7].data()), CURVES_ENUM[7]},
{T6::Common::SND_HashName(CURVES_ENUM[8].data()), CURVES_ENUM[8]},
{T6::Common::SND_HashName(CURVES_ENUM[9].data()), CURVES_ENUM[9]},
{T6::Common::SND_HashName(CURVES_ENUM[10].data()), CURVES_ENUM[10]},
{T6::Common::SND_HashName(CURVES_ENUM[11].data()), CURVES_ENUM[11]},
{T6::Common::SND_HashName(CURVES_ENUM[12].data()), CURVES_ENUM[12]},
{T6::Common::SND_HashName(CURVES_ENUM[13].data()), CURVES_ENUM[13]},
{T6::Common::SND_HashName(CURVES_ENUM[14].data()), CURVES_ENUM[14]},
{T6::Common::SND_HashName(CURVES_ENUM[15].data()), CURVES_ENUM[15]},
{T6::Common::SND_HashName(CURVES_ENUM[16].data()), CURVES_ENUM[16]},
};
std::unordered_map<unsigned int, std::string> CreateCurvesMap()
{
std::unordered_map<unsigned int, std::string> result;
for (auto i = 0u; i < std::extent_v<decltype(CURVES_ENUM)>; i++)
result.emplace(T6::Common::SND_HashName(CURVES_ENUM[i].data()), CURVES_ENUM[i]);
return result;
}

const std::unordered_map<unsigned int, std::string> CURVES_MAP = CreateCurvesMap();

const std::string DUCK_GROUPS_ENUM[]{
"snp_alerts_gameplay",
Expand Down

0 comments on commit c8f1c16

Please sign in to comment.