Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

T6 SndBank & SndDriverGlobals Asset Dumping #58

Merged
merged 5 commits into from
Jan 1, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 20 additions & 0 deletions src/Common/Game/T6/CommonT6.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,26 @@ namespace T6
static int Com_HashString(const char* str, int len);
static uint32_t R_HashString(const char* str, uint32_t hash);

static constexpr uint32_t SND_HashName(const char* str)
{
if (!str || !*str)
return 0;

auto result = 0x1505;
auto offset = 0u;

while (str[offset])
{
const auto c = tolower(str[offset++]);
result = c + 0x1003F * result;
}

if (!result)
return 1;

return result;
}

static PackedTexCoords Vec2PackTexCoords(const vec2_t* in);
static PackedUnitVec Vec3PackUnitVec(const vec3_t* in);
static GfxColor Vec4PackGfxColor(const vec4_t* in);
Expand Down
63 changes: 55 additions & 8 deletions src/Common/Game/T6/T6_Assets.h
Original file line number Diff line number Diff line change
Expand Up @@ -5578,13 +5578,57 @@ namespace T6
MaterialArgumentDef u;
};

enum SndAliasType
enum SndAliasLoopType
{
SAT_UNKNOWN = 0x0,
SAT_LOADED = 0x1,
SAT_STREAMED = 0x2,
SAT_PRIMED = 0x3,
SAT_COUNT = 0x4,
SA_NON_LOOPING = 0x0,
SA_LOOPING = 0x1,
};

enum SndAliasPanType
{
SA_PAN_2D = 0x0,
SA_PAN_3D = 0x1,
};

enum SndAliasLoadType
{
SA_UNKNOWN = 0x0,
SA_LOADED = 0x1,
SA_STREAMED = 0x2,
SA_PRIMED = 0x3,
SA_COUNT = 0x4,
skiff marked this conversation as resolved.
Show resolved Hide resolved
};

struct SndAliasFlags
{
// flags0
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
unsigned int pauseable : 1; // 5
unsigned int isMusic : 1; // 6
unsigned int stopOnDeath : 1; // 7
unsigned int timescale : 1; // 8
unsigned int voiceLimit : 1; // 9
unsigned int ignoreMaxDist : 1; // 10
unsigned int busType : 4; // 11-14
unsigned int loadType : 2; // 15-16
unsigned int volumeGroup : 5; // 17-21
unsigned int fluxType : 3; // 22-24
unsigned int limitType : 2; // 25-26
unsigned int entityLimitType : 2; // 27-28
unsigned int randomizeType : 3; // 29-31

// flags1
unsigned int neverPlayTwice : 1; // 0
unsigned int unknown1_0 : 1; // 1
unsigned int volumeFalloffCurve : 6; // 2-7
unsigned int reverbFalloffCurve : 6; // 8-13
unsigned int volumeMinFalloffCurve : 6; // 14-19
unsigned int reverbMinFalloffCurve : 6; // 20-25
unsigned int unknown1_1 : 6; // 26-31
};

struct SndAlias
Expand All @@ -5595,8 +5639,7 @@ namespace T6
const char* secondaryname;
unsigned int assetId;
const char* assetFileName;
unsigned int flags0; // Bits 15/16 are SndAliasType
unsigned int flags1;
SndAliasFlags flags;
unsigned int duck;
unsigned int contextType;
unsigned int contextValue;
Expand Down Expand Up @@ -5631,6 +5674,10 @@ namespace T6
char duckGroup;
};

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

struct type_align(4) pathlink_s
{
float fDist;
Expand Down
Loading