-
Notifications
You must be signed in to change notification settings - Fork 0
/
TR3SaveGame.h
438 lines (334 loc) · 12.4 KB
/
TR3SaveGame.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
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
#if !defined(AFX_TR3SAVEGAME_H__F8F73C01_A0DB_11D2_8146_444553540000__INCLUDED_)
#define AFX_TR3SAVEGAME_H__F8F73C01_A0DB_11D2_8146_444553540000__INCLUDED_
#include "TR123SaveGame.h"
#include "TRXTools.h"
#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
//
/////////////////////////////////////////////////////////////////////////////
// TR3SaveGame.h : header file
//
/////////////////////////////////////////////////////////////////////////////
// CTR3SaveGame document
//
/////////////////////////////////////////////////////////////////////////////
/*
* ------------------------------------------------
* Definition.
* ------------------------------------------------
*/
#define TR3MAXLEVEL 23
#define TR3BUFFEREND 12102
#define TR3LEVELMINSIZE 13913
#define TR3LEVELMAXSIZE 13914
/*
* ------------------------------------------------
* Structures.
* ------------------------------------------------
*/
#pragma pack(push, pack1, 1)
struct TR3Ammos
{
WORD iAir;
BYTE cFiller1 [ 28 ];
// Burning
BYTE cState;
//
char cFiller2 [ 145 ];
// Health
WORD m_iGunAmmos;
WORD iFiller10;
// Desert Eagle
WORD m_iDesertEagle;
WORD iFiller11;
// Uzi
WORD m_iUzis;
WORD iFiller12;
// Riot Gun
WORD m_iRiotGun;
WORD iFiller13;
// Harpoon
WORD m_iHarpoon;
WORD iFiller14;
// Rocket
WORD m_iRockets;
WORD iFiller15;
// Greande
WORD m_iGrenades;
WORD iFiller16;
// MP5
WORD m_iMP5;
WORD iFiller17;
};
typedef struct TR3Ammos TR3AMMOS;
struct TR30Struct
{
WORD m_iGunAmmos;
// Desert Eagle
WORD m_iDesertEagleAmmos;
// Uzi
WORD m_iUziAmmos;
// Riot Gun
WORD m_iRiotGunAmmos;
// MP5
WORD m_iMP5Ammos;
// Rocket
WORD m_iRocketAmmos;
// Harpoo,s
WORD m_iHarpoonAmmos;
// Grenade
WORD m_iGrenadeAmmos;
// Small Pack
BYTE cSmallPack;
// Large Pack
BYTE cLargePack;
BYTE cUnknown;
// Flare
BYTE cFlare;
BYTE cFiller1;
BYTE cFiller2;
BYTE cFiller3;
WORD cGunBitmap;
WORD cFiller4;
BYTE cNbObject1;
BYTE cNbObject2;
BYTE cNbObject3;
BYTE cNbObject4;
BYTE cFillers [ 18 ];
char cSecrets;
BYTE cFiller99;
};
typedef struct TR30Struct TR30STRUCT;
struct TR3Permanent
{
TR30Struct tagSummerize;
WORD iFiller1;
char cFiller2 [ 16 ];
char cSecrets;
char cFiller4 [ 21 ];
BYTE cLevel;
BYTE cSub;
BYTE cUnlimited;
BYTE cObject_P1;
BYTE cObject_P2;
BYTE cObjectP1;
BYTE cObjectP2;
BYTE cObjectP3;
BYTE cObjectP4;
BYTE cObjectK1;
BYTE cObjectK2;
BYTE cObjectK3;
BYTE cObjectK4;
WORD cFiller6;
WORD cFiller7;
WORD cFiller8 [ 3 ];
BYTE cObjectMask;
char cFillers [ 307 ];
WORD m_iHealth;
};
typedef struct TR3Permanent TR3PERMANENT;
struct TR3Save
{
union
{
struct
{
char szSavename [ 23 ];
BYTE ind1; // 0xFA on TR1
char cFiller1 [ 51 ];
WORD iSaveNumber;
char cFiller2 [ 91 ];
char cFiller3 [ 46 ];
TR30Struct trTable [ TR3MAXLEVEL ];
TR3Permanent trSingle;
BYTE szRemain [ TR3BUFFEREND ];
};
struct
{
char cFullBuffer [ TR3LEVELMAXSIZE ];
};
};
};
typedef struct TR3Save TR3SAVE;
#pragma pack(pop, pack1)
class CTR3SaveGame : public CTR123SaveGame
{
DECLARE_DYNAMIC(CTR3SaveGame)
friend class CTRSaveGame;
protected:
CTR3SaveGame();
public:
virtual ~CTR3SaveGame();
// Attributes
protected :
TR3SAVE *m_pBuffer;
TR3SAVE *m_pBufferBackup;
protected :
TR3AMMOS *m_pGun;
// Mask
WORD iMaskCompass;
WORD iMaskPistol;
WORD iMaskShotGun;
WORD iMaskDesertEagle;
WORD iMaskUzi;
WORD iMaskMP5;
WORD iMaskHarpoon;
WORD iMaskCrossBow;
WORD iMaskGrenade;
WORD iMaskRocket;
// Operations
public:
// Overrides
// ClassWizard generated virtual function overrides
//{{AFX_VIRTUAL(CTR3SaveGame)
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; };
// 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; };
// Desert Eagle
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() ); };
// Uzi
BYTE GrabWeapon3 ( int iX, bool bAdd = true, bool bChange = true );
virtual BOOL HasWeapon3 () { return CTRXTools::IsEnableUzi(getFullVersion(), getLevel() ); };
virtual BOOL HasAmmos3 () { return CTRXTools::IsAmmosUzi(getFullVersion(), getLevel() ); };
// Shotgun
BYTE GrabWeapon4 ( int iX, bool bAdd = true, bool bChange = true );
virtual BOOL HasWeapon4 () { return CTRXTools::IsEnableRiotgun(getFullVersion(), getLevel() ); };
virtual BOOL HasAmmos4 () { return CTRXTools::IsAmmosRiotgun(getFullVersion(), getLevel() ); };
// MP5
BYTE GrabWeapon5 ( int iX, bool bAdd = true, bool bChange = true );
virtual BOOL HasWeapon5 () { return CTRXTools::IsEnableM16(getFullVersion(), getLevel() ); };
virtual BOOL HasAmmos5 () { return CTRXTools::IsAmmosM16(getFullVersion(), getLevel() ); };
// Rocket
BYTE GrabWeapon6 ( int iX, bool bAdd = true, bool bChange = true );
virtual BOOL HasWeapon6 () { return CTRXTools::IsEnableRocket(getFullVersion(), getLevel() ); };
virtual BOOL HasAmmos6 () { return CTRXTools::IsAmmosRocket(getFullVersion(), getLevel() ); };
// Grenade
BYTE GrabWeapon7 ( int iX, bool bAdd = true, bool bChange = true );
virtual BOOL HasWeapon7 () { return CTRXTools::IsEnableGrenade(getFullVersion(), getLevel() ); };
virtual BOOL HasAmmos7 () { return CTRXTools::IsAmmosGrenade(getFullVersion(), getLevel() ); };
// Harpoon
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() ); };
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 TR3 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 );
TR3AMMOS *SearchGunStructure ( WORD m_iHealth, WORD gunBitmap, int *iPos );
int CheckIfAmmosMatch ( TR3AMMOS *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_TR3SAVEGAME_H__F8F73C01_A0DB_11D2_8146_444553540000__INCLUDED_)