Skip to content

Commit 3b6b736

Browse files
committed
Create CDirectorySA Class
1 parent 38a520d commit 3b6b736

File tree

2 files changed

+63
-0
lines changed

2 files changed

+63
-0
lines changed

Client/game_sa/CDirectorySA.cpp

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
#include "StdInc.h"
2+
#include "CDirectorySA.h"
3+
4+
DirectoryInfo* CDirectorySA::GetModelEntry(ushort modelId)
5+
{
6+
if (m_nNumEntries <= 0)
7+
return nullptr;
8+
9+
DirectoryInfo* entry = m_pEntries + modelId;
10+
11+
if (!entry)
12+
return nullptr;
13+
14+
return entry;
15+
}
16+
17+
bool CDirectorySA::SetModelStreamingSize(ushort modelId, uint16 size)
18+
{
19+
DirectoryInfo* entry = GetModelEntry(modelId);
20+
21+
if (!entry)
22+
return false;
23+
24+
if (entry->m_nStreamingSize == size)
25+
return false;
26+
27+
entry->m_nStreamingSize = size;
28+
return true;
29+
}
30+
31+
32+
uint16 CDirectorySA::GetModelStreamingSize(ushort modelId)
33+
{
34+
DirectoryInfo* entry = GetModelEntry(modelId);
35+
36+
if (!entry)
37+
return false;
38+
39+
return entry->m_nStreamingSize;
40+
}

Client/game_sa/CDirectorySA.h

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
#include <SharedUtil.IntTypes.h>
2+
3+
struct DirectoryInfo
4+
{
5+
uint32 m_nOffset;
6+
uint16 m_nStreamingSize;
7+
uint16 m_nSizeInArchive;
8+
char m_szName[24];
9+
};
10+
11+
class CDirectorySA
12+
{
13+
public:
14+
DirectoryInfo* GetModelEntry(ushort modelId);
15+
bool SetModelStreamingSize(ushort modelId, uint16 size);
16+
uint16 GetModelStreamingSize(ushort modelId);
17+
18+
private:
19+
DirectoryInfo* m_pEntries{};
20+
uint32 m_nCapacity{};
21+
uint32 m_nNumEntries{};
22+
bool m_bOwnsEntries{};
23+
};

0 commit comments

Comments
 (0)