

// Include Guard
#ifndef TethysGame_H
#define TethysGame_H


#include "GameOpt.h"
#include "GameStartInfo.h"
#include "Player.h"


namespace OP2ForcedExport
{

	class GameNetLayer;
	enum GameTermReasons;
	class TFileDialog;


	class TethysGame
	{
	public:
		// Static Constructor/Destructor
		// [Static]Constructor()	// 0x4890C0
		// [Static]Destructor()		// 0x489100

		// Constructor/Destructor
		TethysGame();				// 0x489130

		// Member functions
		bool LoadDebugMap();												// 0x489170
		bool StartGame(GameStartInfo* gameStartInfo);						// 0x4893B0 bSuccess
		void LoadPlayerGameStartInfo(GameStartInfo* gameStartInfo);			// 0x4899C0
		int F1(MissionResults* missionResults);								// 0x489AB0 **
		MissionResults* GetMissionResults();								// 0x489B00
		void InitPlayers(int numPlayers);									// 0x489E50
		void ProcessGameCycle();											// 0x489EA0
		void Deinitialize();												// 0x48A080
		bool Save(StreamIO* savedGame);										// 0x48A150 ** [Dead code?]
		bool Load(StreamIO* savedGame);										// 0x48A170 ** [Dead code?]
		bool VerifySavedGameTileTag(StreamIO* savedGame);					// 0x48A190 bSuccess
		bool SaveGame(StreamIO* savedGame, TFileDialog* savedGameDialog);	// 0x48A1F0 bSuccess
		bool LoadGame(StreamIO* savedGame);									// 0x48A3E0 bSuccess
		void LocalPlayerQuit(char a1, char a2);								// 0x48A6A0 **
		void PostQuitMessage(int quitMessageIndex, int quitDelay);			// 0x48A720
		// ----

		// Static member functions
		static void __fastcall AddMessage(int pixelX, int pixelY, const char* message, int toPlayerNum, int soundIndex);	// 0x478710

	public:
		// Member variables
		GameOpt gameOpt;				// 0x0
		int numPlayers;					// 0x68 Initialized from level DescBlock
		int numHumanPlayers;			// 0x6C 
		int cpProcessingInterval;		// 0x70 Note: Must be a power of 2
		int lgCpProcessingInterval;		// 0x74 Cached base 2 log, so a bit shift can be used to multiply
		int networkCpArraySpace;		// 0x78 Space available for Command Packet data in network packets
		int b1;							// 0x7C **
		int b2;							// 0x80 **
		int tick;						// 0x84 Note: 100 ticks per mark, most input processing done every 4 ticks
		int tickOfLastSetGameOptCp;		// 0x88 Not set by FreeMoraleLevel, SetGameSpeed, SetDaylightEverywhere
		int b3;							// 0x8C **
		int localPlayerNum;				// 0x90 
		int b4;							// 0x94 **
		int startFadeOutTick;			// 0x98 
		GameTermReasons termReason;		// 0x9C 
		int b5;							// 0xA0 **
		GameStartInfo gameStartInfo;	// 0xA4  Game starting parameters, used to restart a level, and return MissionResults
		char padding[3];				// 0x481 Padding, due to unaligned size of GameStartInfo
		Player player[7];				// 0x484
		GameNetLayer* gameNetLayer;		// 0x5980
	};


	// Globals
	extern TethysGame tethysGame;		// 0x56EA98

}	// End namespace


#endif	// End Include Guard
