1 #ifndef __TACTICAL_SAVE_H_
2 #define __TACTICAL_SAVE_H_
3 
4 #include "Campaign_Types.h"
5 #include "Handle_Items.h"
6 #include "World_Items.h"
7 #include "WorldDef.h"
8 #include "Rotting_Corpses.h"
9 #include "Soldier_Profile_Type.h"
10 #include <string_theory/string>
11 #include <vector>
12 
13 
14 //Load the Map modifications from the saved game file
15 void LoadMapTempFilesFromSavedGameFile(HWFILE, UINT32 savegame_version);
16 
17 //Save the Map Temp files to the saved game file
18 void SaveMapTempFilesToSavedGameFile(HWFILE);
19 
20 
21 //Saves the Current Sectors, ( world Items, rotting corpses, ... )  to the temporary file used to store the sectors items
22 void SaveCurrentSectorsInformationToTempItemFile(void);
23 
24 //Loads the Currents Sectors information ( world Items, rotting corpses, ... ) from the temporary file used to store the sectores items
25 void LoadCurrentSectorsInformationFromTempItemsFile();
26 
27 // Loads a World Item array from that sectors temp item file
28 std::vector<WORLDITEM> LoadWorldItemsFromTempItemFile(INT16 sMapX, INT16 sMapY, INT8 bMapZ);
29 
30 //  Adds an array of Item Objects to the specified location on a unloaded map.
31 //  If you want to overwrite all the items in the array set fReplaceEntireFile to TRUE.
32 void AddItemsToUnLoadedSector(INT16 sMapX, INT16 sMapY, INT8 bMapZ, INT16 sGridNo, UINT32 uiNumberOfItems, OBJECTTYPE const* pObject, UINT8 ubLevel, UINT16 usFlags, INT8 bRenderZHeightAboveLevel, Visibility);
33 
34 
35 void AddWorldItemsToUnLoadedSector(INT16 sMapX, INT16 sMapY, INT8 bMapZ, const std::vector<WORLDITEM>& wis);
36 
37 // Delete all the files in the temp directory.
38 void InitTacticalSave();
39 
40 
41 //Call this function to set the new sector a NPC will travel to
42 void ChangeNpcToDifferentSector(MERCPROFILESTRUCT&, INT16 sSectorX, INT16 sSectorY, INT8 bSectorZ);
43 
44 
45 // Adds a rotting corpse definition to the end of a sectors rotting corpse temp file
46 void AddRottingCorpseToUnloadedSectorsRottingCorpseFile(INT16 sMapX, INT16 sMapY, INT8 bMapZ, ROTTING_CORPSE_DEFINITION const*);
47 
48 
49 
50 //Flags used for the AddDeadSoldierToUnLoadedSector() function
51 #define ADD_DEAD_SOLDIER_USE_GRIDNO			0x00000001 // just place the items and corpse on the gridno location
52 #define ADD_DEAD_SOLDIER_TO_SWEETSPOT			0x00000002 // Finds the closet free gridno
53 
54 #define ADD_DEAD_SOLDIER__USE_JFK_HEADSHOT_CORPSE	0x00000040 // Will ue the JFK headshot
55 
56 
57 
58 //Pass in the sector to add the dead soldier to.
59 //The gridno if you are passing in either of the flags ADD_DEAD_SOLDIER_USE_GRIDNO, or the ADD_DEAD_SOLDIER_TO_SWEETSPOT
60 //
61 // This function DOES NOT remove the soldier from the soldier struct.  YOU must do it.
62 void AddDeadSoldierToUnLoadedSector(INT16 sMapX, INT16 sMapY, UINT8 bMapZ, SOLDIERTYPE* pSoldier, INT16 sGridNo, UINT32 uiFlags);
63 
64 
65 BOOLEAN GetSectorFlagStatus(INT16 sMapX, INT16 sMapY, UINT8 bMapZ, SectorFlags);
66 void    SetSectorFlag(INT16 sMapX, INT16 sMapY, UINT8 bMapZ, SectorFlags);
67 void    ReSetSectorFlag(INT16 sMapX, INT16 sMapY, UINT8 bMapZ, SectorFlags);
68 
69 
70 //Saves the NPC temp Quote file to the saved game file
71 void LoadTempNpcQuoteArrayToSaveGameFile(HWFILE);
72 
73 //Loads the NPC temp Quote file from the saved game file
74 void SaveTempNpcQuoteArrayToSaveGameFile(HWFILE);
75 
76 void JA2EncryptedFileRead( HWFILE, BYTE*       data, UINT32 uiBytesToRead);
77 void JA2EncryptedFileWrite(HWFILE, BYTE const* data, UINT32 uiBytesToWrite);
78 
79 void NewJA2EncryptedFileRead( HWFILE, BYTE*       data, UINT32 uiBytesToRead);
80 void NewJA2EncryptedFileWrite(HWFILE, BYTE const* data, UINT32 uiBytesToWrite);
81 
82 
83 //If hacker's mess with our save/temp files, this is our final line of defence.
84 void InitExitGameDialogBecauseFileHackDetected(void);
85 
86 void HandleAllReachAbleItemsInTheSector(INT16 x, INT16 y, INT8 z);
87 
88 ST::string GetMapTempFileName(SectorFlags uiType, INT16 sMapX, INT16 sMapY, INT8 bMapZ);
89 
90 
91 UINT32	GetNumberOfVisibleWorldItemsFromSectorStructureForSector( INT16 sMapX, INT16 sMapY, INT8 bMapZ );
92 void		SetNumberOfVisibleWorldItemsInSectorStructureForSector( INT16 sMapX, INT16 sMapY, INT8 bMapZ, UINT32 uiNumberOfItems );
93 
94 #define NEW_ROTATION_ARRAY_SIZE			49
95 #define BASE_NUMBER_OF_ROTATION_ARRAYS			19
96 
97 
98 void SaveWorldItemsToTempItemFile(INT16 sMapX, INT16 sMapY, INT8 bMapZ, const std::vector<WORLDITEM>& items);
99 
100 #endif
101