-
Notifications
You must be signed in to change notification settings - Fork 0
/
TR15SaveGame.h
378 lines (297 loc) · 12.5 KB
/
TR15SaveGame.h
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
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
#if !defined(AFX_TUBSAVEGAME_H__F8F73C01_A0DB_11D2_8146_444553540000__INCLUDED_)
#define AFX_TUBSAVEGAME_H__F8F73C01_A0DB_11D2_8146_444553540000__INCLUDED_
#include "TR123SaveGame.h"
#include "TRXTools.h"
#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
//
/////////////////////////////////////////////////////////////////////////////
// TR15SaveGame.h : header file
//
/////////////////////////////////////////////////////////////////////////////
// CTUBSaveGame document
//
/////////////////////////////////////////////////////////////////////////////
/*
* ------------------------------------------------
* Definition.
* ------------------------------------------------
*/
#define TUBMAXLEVEL 4
#define TUBBUFFEREND 0x270F
#define TUBLEVELMINSIZE 10434
#define TUBLEVELMAXSIZE 10435
/*
* ------------------------------------------------
* Structures.
* ------------------------------------------------
*/
#pragma pack(push, pack1, 1)
struct TUBAmmos
{
WORD iAir;
BYTE cFiller1 [ 31 ];
BYTE cFiller2;
char cFiller3 [ 100 ];
WORD m_iGunAmmos;
char cFiller01 [ 0x0A ];
WORD m_iDesertEagle;
char cFiller02 [ 0x0A ];
WORD m_iUzis;
char cFiller03 [ 0x0A ];
WORD m_iRiotGun;
};
typedef struct TUBAmmos TUBAMMOS;
struct TUBStruct
{
WORD m_iGunAmmos;
WORD m_iDesertEagle;
WORD m_iUzis;
WORD m_iRiotGun;
BYTE cSmallPack;
BYTE cLargePack;
BYTE cNbObject1;
BYTE cFiller20 [ 2 ];
BYTE cGunBitmap;
BYTE cFiller30;
};
typedef struct TUBStruct TUBSTRUCT;
struct TUBSave
{
union
{
struct
{
char szSavename [ 0x18 ];
char cFiller01 [ 0x33 ];
WORD iSaveNumber;
char cFiller02 [ 0x11 ];
TUBSTRUCT trTable [ TUBMAXLEVEL ];
TUBSTRUCT trSingle;
char cFiller30 [ 0x0A ];
BYTE cLevel;
BYTE cSub;
char cFiller31 [ 1 ];
BYTE cUnlimited;
BYTE cObject_P1;
BYTE cObject_P2;
BYTE cObjectP1;
BYTE cObjectP2;
BYTE cObjectP3;
BYTE cObjectP4;
BYTE cObjectK1;
BYTE cObjectK2;
BYTE cObjectK3;
BYTE cObjectK4;
char cFiller40 [ 243 ];
BYTE szRemain [ TUBBUFFEREND ];
};
struct
{
char cFullBuffer [ TUBLEVELMAXSIZE ];
};
};
};
typedef struct TUBSave TUBSAVE;
#pragma pack(pop, pack1)
class CTUBSaveGame : public CTR123SaveGame
{
DECLARE_DYNAMIC(CTUBSaveGame)
friend class CTRSaveGame;
protected:
CTUBSaveGame();
public :
virtual ~CTUBSaveGame();
// Attributes
protected :
TUBSAVE *m_pBuffer;
TUBSAVE *m_pBufferBackup;
protected :
TUBAMMOS *m_pGun;
// Mask
BYTE iMaskCompass;
BYTE iMaskPistol;
BYTE iMaskMagnum;
BYTE iMaskUzi;
BYTE iMaskShotGun;
BYTE iMaskHarpoon;
BYTE iMaskMP5;
BYTE iMaskGrenade;
// Operations
public:
// Overrides
// ClassWizard generated virtual function overrides
//{{AFX_VIRTUAL(CTUBSaveGame)
public:
//}}AFX_VIRTUAL
// Implementation
public:
char *getBufferAddress ();
char *getBufferBackupAddress ();
size_t getBufferLength();
BOOL BufferModified();
void discard();
int GetMap1 ();
int GetMap2 ();
int GetItem1 ();
int GetItem2 ();
int GetItem3 ();
int GetItem4 ();
int GetKey1 ();
int GetKey2 ();
int GetKey3 ();
int GetKey4 ();
int GetTreasure1 ( int iX );
int GetTreasure2 ( int iX );
int GetTreasure3 ( int iX );
int GetTreasure4 ( int iX );
void SetMap1 ( char *szString );
void SetMap2 ( char *szString );
void SetItem1 ( char *szString );
void SetItem2 ( char *szString );
void SetItem3 ( char *szString );
void SetItem4 ( char *szString );
void SetKey1 ( char *szString );
void SetKey2 ( char *szString );
void SetKey3 ( char *szString );
void SetKey4 ( char *szString );
void SetTreasure1 ( char *szString, int iX );
void SetTreasure2 ( char *szString, int iX );
void SetTreasure3 ( char *szString, int iX );
void SetTreasure4 ( char *szString, int iX );
void SetAllObjects ();
int IsLaraBurning ();
void SetLaraBurning (int state = -1);
void SetLaraNoBurning (int state = -1);
char *GetSaveName ();
int GetSaveNumber ();
int GetCurrentSecrets ( );
void SetCurrentSecrets ( char *szString, int iX = -1 );
void SetAllSecrets ( );
int GetMaximumSecrets ( int iX );
int GetUnlimitedAmmos();
void SetUnlimitedAmmos ( int iMask );
int GetGunAmmos ( );
int GetSmallMedipak ( int iX );
int GetLargeMedipak ( int iX );
int GetFlares ( int iX );
int GetAir ( );
void SetGunAmmos ( const char *szGunAmmos );
void SetSmallMedipak ( const char *szString, int iX );
void SetLargeMedipak ( const char *szString, int iX );
void SetFlares ( const char *szString, int iX );
void SetAir ( const char *szString );
int CheckWeapon1 ( int iX );
int CheckWeapon2 ( int iX );
int CheckWeapon3 ( int iX );
int CheckWeapon4 ( int iX );
int CheckWeapon5 ( int iX );
int CheckWeapon6 ( int iX );
int CheckWeapon7 ( int iX );
int CheckWeapon8 ( int iX );
// Compass
BYTE GrabWeapon0 ( int iX, bool bAdd = true, bool bChange = true );
virtual BOOL HasWeapon0 () { return TRUE; };
virtual BOOL HasAmmos0 () { return FALSE; };
virtual const char *GetLabel0() { return "Compass"; };
// Pistols
BYTE GrabWeapon1 ( int iX, bool bAdd = true, bool bChange = true );
virtual BOOL HasWeapon1 () { return CTRXTools::IsEnablePistol(getFullVersion(), getLevel() ); };
virtual BOOL HasAmmos1 () { return FALSE; };
// Pistols
virtual const char *GetLabel1() { return "Guns / Pistols"; };
virtual UINT GetBitmap1 ( ) { return IDB_GUNS; };
// Magnum
BYTE GrabWeapon2 ( int iX, bool bAdd = true, bool bChange = true );
virtual BOOL HasWeapon2 () { return CTRXTools::IsEnableMagnum(getFullVersion(), getLevel() ); };
virtual BOOL HasAmmos2 () { return CTRXTools::IsAmmosMagnum(getFullVersion(), getLevel() ); };
// Magnum
virtual const char *GetLabel2() { return "Magnum"; };
virtual UINT GetBitmap2 ( ) { return IDB_DESERT_EAGLE; };
// Uzi
BYTE GrabWeapon3 ( int iX, bool bAdd = true, bool bChange = true );
virtual BOOL HasWeapon3 () { return CTRXTools::IsEnableMagnum(getFullVersion(), getLevel() ); };
virtual BOOL HasAmmos3 () { return CTRXTools::IsAmmosMagnum(getFullVersion(), getLevel() ); };
// Uzi
virtual const char *GetLabel3() { return "Uzi"; };
virtual UINT GetBitmap3 ( ) { return IDB_UZIS; };
// Shotgun
BYTE GrabWeapon4 ( int iX, bool bAdd = true, bool bChange = true );
virtual BOOL HasWeapon4 () { return CTRXTools::IsEnableMagnum(getFullVersion(), getLevel() ); };
virtual BOOL HasAmmos4 () { return CTRXTools::IsAmmosMagnum(getFullVersion(), getLevel() ); };
// Shotgun
virtual const char *GetLabel4() { return "Shotgun"; };
virtual UINT GetBitmap4 ( ) { return IDB_RIOT_GUN; };
// MP5
BYTE GrabWeapon5 ( int iX, bool bAdd = true, bool bChange = true );
virtual BOOL HasWeapon5 () { return CTRXTools::IsEnableM16(getFullVersion(), getLevel() ); };
virtual BOOL HaAmmos5 () { return CTRXTools::IsAmmosM16(getFullVersion(), getLevel() ); };
// MP5
virtual const char *GetLabel5() { return "MP5"; };
virtual UINT GetBitmap5 ( ) { return IDB_MP5; };
// Grenade Launcher
BYTE GrabWeapon6 ( int iX, bool bAdd = true, bool bChange = true );
virtual BOOL HasWeapon6 () { return CTRXTools::IsEnableGrenade(getFullVersion(), getLevel() ); };
virtual BOOL HasAmmos6 () { return CTRXTools::IsAmmosGrenade(getFullVersion(), getLevel() ); };
// Grenade Launcher
virtual const char *GetLabel6() { return "Rocket Launcher"; };
virtual UINT GetBitmap6 ( ) { return IDB_ROCKET_LAUNCHER; };
// Grenade Launcher : Not in TR1
BYTE GrabWeapon7 ( int iX, bool bAdd = true, bool bChange = true );
virtual BOOL HasWeapon7 () { return CTRXTools::IsEnableRocket(getFullVersion(), getLevel() ); };
virtual BOOL HasAmmos7 () { return CTRXTools::IsAmmosRocket(getFullVersion(), getLevel() ); };
// Grenade Launcher : Not in TR1
virtual const char *GetLabel7() { return "Grenade Launcher"; };
virtual UINT GetBitmap7 ( ) { return IDB_GRENADE_LAUNCHER; };
// Harpoon : Not in TR1
BYTE GrabWeapon8 ( int iX, bool bAdd = true, bool bChange = true );
virtual BOOL HasWeapon8 () { return CTRXTools::IsEnableHarpoon(getFullVersion(), getLevel() ); };
virtual BOOL HasAmmos8 () { return CTRXTools::IsAmmosHarpoon(getFullVersion(), getLevel() ); };
// Harpoon : Not in TR1
virtual const char *GetLabel8() { return "Harpoon"; };
virtual UINT GetBitmap8( ) { return IDB_HARPOON; };
virtual BOOL HasWeapon9 () { return FALSE; };
virtual BOOL HasAmmos9 () { return FALSE; };
//
int GetAmmos1( int iX );
//
int GetAmmos2( int iX );
void SetAmmos2 ( const char *szString, int iX );
int GetAmmos3( int iX );
void SetAmmos3 ( const char *szString, int iX );
int GetAmmos4a ( int iX );
void SetAmmos4a ( const char *szString, int iX );
int GetAmmos5 ( int iX );
void SetAmmos5 ( const char *szString, int iX );
int GetAmmos6( int iX );
void SetAmmos6 ( const char *szString, int iX );
int GetAmmos7a( int iX );
void SetAmmos7a ( const char *szString, int iX );
int GetAmmos8a( int iX );
void SetAmmos8a ( const char *szString, int iX );
// For TRUB and below check pointer
int Valid ();
void SetInvalid ();
virtual int getLevelIndex();
virtual int getLevel();
const char *GetStatus ();
void GetDetailedInfo ( char *szGame, size_t iSize, int *iGame, int *iLevel,
char *szTitle, size_t iSizeTile );
void writeSaveGame();
int ReadSavegame( const char *pFilename );
void RetrieveInformation( const char *pFilename );
TUBAMMOS *SearchGunStructure ( WORD m_iHealth, WORD gunBitmap, int *iPos );
int CheckIfAmmosMatch ( TUBAMMOS *pGun, WORD gunBitmap );
void RetrieveHeader();
void GetAmmosValues ( );
int ConvertSecretBack ( int iSecret );
int ConvertSecret ( int iSecret );
const TR_POSITION *GetPosition ( );
BOOL SetPosition ( DWORD dwWestToEast, DWORD dwVertical, DWORD dwSouthToNorth, WORD wDirection, WORD wRoom );
// Generated message map functions
};
//{{AFX_INSERT_LOCATION}}
// Microsoft Visual C++ will insert additional declarations immediately before the previous line.
// The savegame object.
#endif // !defined(AFX_TUBSAVEGAME_H__F8F73C01_A0DB_11D2_8146_444553540000__INCLUDED_)