1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
|
//========= Copyright Valve Corporation, All rights reserved. ============//
//
// Purpose:
//
// $NoKeywords: $
//=============================================================================//
#ifndef BONUSMAPSDATABASE_H
#define BONUSMAPSDATABASE_H
#ifdef _WIN32
#pragma once
#endif
#include "utlvector.h"
struct ChallengeDescription_t
{
char szName[32];
char szComment[256];
int iType;
int iBronze;
int iSilver;
int iGold;
int iBest;
};
struct BonusMapDescription_t
{
bool bIsFolder;
char szShortName[64];
char szFileName[128];
char szMapFileName[128];
char szChapterName[128];
char szImageName[128];
char szMapName[64];
char szComment[256];
bool bLocked;
bool bComplete;
CUtlVector<ChallengeDescription_t> *m_pChallenges;
BonusMapDescription_t( void )
{
bIsFolder = false;
szShortName[ 0 ] = '\0';
szFileName[ 0 ] = '\0';
szMapFileName[ 0 ] = '\0';
szChapterName[ 0 ] = '\0';
szImageName[ 0 ] = '\0';
szMapName[ 0 ] = '\0';
szComment[ 0 ] = '\0';
bLocked = false;
bComplete = false;
m_pChallenges = NULL;
}
};
struct BonusMapChallenge_t
{
char szFileName[128];
char szMapName[32];
char szChallengeName[32];
int iBest;
};
class KeyValues;
//-----------------------------------------------------------------------------
// Purpose: Keeps track of bonus maps on disk
//-----------------------------------------------------------------------------
class CBonusMapsDatabase
{
public:
CBonusMapsDatabase( void );
~CBonusMapsDatabase();
bool ReadBonusMapSaveData( void );
bool WriteSaveData( void );
const char * GetPath( void ) { return m_szCurrentPath; }
void RootPath( void );
void AppendPath( const char *pchAppend );
void BackPath( void );
void SetPath( const char *pchPath, int iDirDepth );
void ClearBonusMapsList( void );
void ScanBonusMaps( void );
void RefreshMapData( void );
int BonusCount( void );
BonusMapDescription_t * GetBonusData( int iIndex ) { return &(m_BonusMaps[ iIndex ]); }
int InvalidIndex( void ) { return m_BonusMaps.InvalidIndex(); }
bool IsValidIndex( int iIndex ) { return m_BonusMaps.IsValidIndex( iIndex ); }
bool GetBlink( void );
void SetBlink( bool bState );
bool BonusesUnlocked( void );
void SetCurrentChallengeNames( const char *pchFileName, const char *pchMapName, const char *pchChallengeName );
void GetCurrentChallengeNames( char *pchFileName, char *pchMapName, char *pchChallengeName );
void SetCurrentChallengeObjectives( int iBronze, int iSilver, int iGold );
void GetCurrentChallengeObjectives( int &iBronze, int &iSilver, int &iGold );
bool SetBooleanStatus( const char *pchName, const char *pchFileName, const char *pchMapName, bool bValue );
bool SetBooleanStatus( const char *pchName, int iIndex, bool bValue );
bool UpdateChallengeBest( const char *pchFileName, const char *pchMapName, const char *pchChallengeName, int iBest );
float GetCompletionPercentage( void );
int NumAdvancedComplete( void );
void NumMedals( int piNumMedals[ 3 ] );
private:
void AddBonus( const char *pCurrentPath, const char *pDirFileName, bool bIsFolder );
void BuildSubdirectoryList( const char *pCurrentPath, bool bOutOfRoot );
void BuildBonusMapsList( const char *pCurrentPath, bool bOutOfRoot );
void ParseBonusMapData( char const *pszFileName, char const *pszShortName, bool bIsFolder );
private:
KeyValues *m_pBonusMapsManifest;
CUtlVector<BonusMapDescription_t> m_BonusMaps;
KeyValues *m_pBonusMapSavedData;
bool m_bSavedDataChanged;
int m_iX360BonusesUnlocked; // Only used on 360
bool m_bHasLoadedSaveData;
int m_iDirDepth;
char m_szCurrentPath[_MAX_PATH];
float m_fCurrentCompletion;
int m_iCompletableLevels;
BonusMapChallenge_t m_CurrentChallengeNames;
ChallengeDescription_t m_CurrentChallengeObjectives;
};
void GetChallengeMedals( ChallengeDescription_t *pChallengeDescription, int &iBest, int &iEarnedMedal, int &iNext, int &iNextMedal );
CBonusMapsDatabase *BonusMapsDatabase( void );
extern const char g_pszMedalNames[4][8];
#endif // BONUSMAPSDATABASE_H
|