#pragma once

#include "MechPrototype.h"
#include <Stuff\Stuff.hpp>
#include <gosScript\gosScriptHeaders.hpp>
#include "ShellScriptHeaders.hpp"
#include "ScriptErrorHeader.hpp"
#include "ShellFunctionHeaders.hpp"
#include "MWOptions.hpp"

#define OPENINGCINEMA		0
#define PILOTENTRY			1
#define MAINMENU			2
#define CAMPAIGNLOBBY		3
#define INSTANT_SCREEN		4
#define MULTIPLAYER_SCREEN	5
#define OPTIONS				6
#define AUDIOOPTIONS		7
#define VIDEOOPTIONS		8
#define CONTROLOPTIONS		9
#define HUDOPTIONS			10
#define CINEMAOPTIONS		11		// replay them
#define IAWRAPUP_SCREEN		12
#define LOAD_SCREEN			13
#define BRIEFING			14
#define MECHBAY_SCREEN		15
#define TRAINING_SCREEN		16
#define MECHBAY_TUTORIAL	17
#define LOBBY_SCREEN		18
#define MODEM_SCREEN		19
#define MULTIPLAYERPARMS	20
#define STIENERCINEMA		21
#define DAVIONCINEMA		22
#define LOGSCREEN			23
#define DIRECT_SCREEN		24
#define LAUNCHGAME			25
#define PAUSEMENU			26
#define ENDMISSION			27
#define CAMPAIGNCINEMA		28
#define ENDINGCINEMA		29
#define CREDITSCINEMA		30
#define CAMPAIGN_REVIEW     31
#define IA_REVIEW			32

#define VIDEORES_600_480	0
#define VIDEORES_800_600	1
#define VIDEORES_1024_768	2

#define NET_SCRIPT_PRIORITY (-200)

#define MAX_DECALS 128

namespace NetMissionParameters {
	class MWNetMissionParameters;
}

//##########################################################################
//#################
//##########################################################################

struct NetworkScenario {

	char missionName[128];
	char longMissionName[128];
	char scenarioTag[128];
	char scenarioName[128];
	bool usermissions;
	
};


struct NetworkCycleList {

	char missionName[128];
	char longMissionName[128];
	char scenarioTag[128];
	char scenarioName[128];
	bool usermissions;
	int ruleType;

};


class MW4Shell
{
protected:


	
	Stuff::MString		pilotName;
	Stuff::MString		gameList;
	int					missionNum;

	Stuff::MString		missionInstanceFile;
	Stuff::MString		vehicleInstanceFile;
	

	static int			vehicleID;
	static int			missionID;

	Stuff::ChainOf<MechPrototype*>
		mechPrototypeList;

	static int			numMechPrototypes;
	static char**		mechPrototypeNames;
	static char**		mechPrototypeFilenames;

	static int			numMissions;
	static char**		missionNames;
	static char**		missionFilenames;
	



	static int ServerScale;
	static int ClientScale;
	static double TimeToLowerServerScale;
	static double TimeToLowerClientScale;

public:

	enum {
		NoShellCommand = -1,
		ExitToWindowsShellCommand, //0
		StartSinglePlayerGameCommand, //1
		StartNetworkShellsCommand, //2
		StartNetworkGameCommand, //3
		ExitMissionCommand, //4
		DisconnectCommand, //5
		ExitToMainMenuCommand, //6
		ResumeMissionCommand, //7
		StartCampaignGameCommand, //8
		ExitNetworkShellCommand, //9
		ReturnNetworkLobbyCommand, //10
		EndNetworkShellsCommand, //11
		StartMissionReviewCommand, //12
		DisconnectLobbyCommand, //13
		SetPauseOptionResCommand, //14
		UnsetPauseOptionResCommand //15
	};


	enum {
		NoShellRunning = -1,
		GameRunning,
		LoadingShellRunning,
		MainShellRunning,
		NetServerShellRunning,
		NetClientShellRunning,
		StatShellRunning,
		InGameShellRunning,
		NetScoreShellRunning,
		NetStartupShellRunning,
		NetMissionReviewShellRunning
	};

	enum {
		MainShellStart = -1,
		CampaignShellStart,
		CampaignLoadShellStart,
		InstantActionShellStart,
		MultiplayerShellStart
	};

	int currentShellRunning;
	int	shellCommand;
	int shellStart;

	bool firstRun;

	HGOSSCRIPT loadingScript;
	HGOSSCRIPT pauseScript;
	HGOSSCRIPT pauseOptionsScript;
	HGOSSCRIPT statScript;
	
	HGOSSCRIPT netServerScript;
	HGOSSCRIPT netClientScript;
	HGOSSCRIPT netScoreScript;
	HGOSSCRIPT netMissionReviewScript;



	MW4Shell();
	~MW4Shell();

	void EndAllScripts();

	void StartUp();
	void ShutDown();

	void StartMainShell();
	void StartLoadingShell(bool multiplayer);
	void StopLoadingShell();
	void StartNetworkServerExecute();
	void StartNetworkClientExecute();
	void StartNetworkScoreExecute();
	void StartNetworkStartupScreen();
	void StartNetworkMissionReviewExecute();

	void StopNetworkShellsExecute();

	void StartPauseOptionsShellExecute();
	void StopPauseOptionsShellExecute();
	void StartPauseShellExecute();
	void StopPauseShellExecute();
	void StartPauseShellExecuteModal();
	void StartNetworkErrorExecuteModal();
	void StartStatShell();
	void StopStatShell();
	
	//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
	//  Registered things with the scripts...

	void SetPilotName();
	int GetShellCommand() {return shellCommand;}

	void SetGameList(const Stuff::MString& list){gameList = list;}
	const char* GetGameList() {return gameList;}

	void SetMissionNumber(int i) {missionNum = i;}
	int GetMissionNumber() {return missionNum;}

	const char* GetGameName();
	Stuff::MString GetMissionInstanceFilename();	
	const char* GetVehicleInstanceFilename() {return vehicleInstanceFile;}

	void LoadMechPrototypes();
	void LoadMissions();

	
	static int _stdcall	MW4Shell::SetNetworkMissionParamater(void * instance, int numParams, void* data[]);
	static int _stdcall	MW4Shell::GetLocalNetworkMissionParamater(void * instance, int numParams, void* data[]);
	static int _stdcall	MW4Shell::GetServerNetworkMissionParamater(void * instance, int numParams, void* data[]);
	static int _stdcall	MW4Shell::GetNetworkMissionParamater(NetMissionParameters::MWNetMissionParameters *params, int numParms, void *data[]);

    static int _stdcall MW4Shell::GetClientReady(void * instance, int, void *[]);
	static int _stdcall MW4Shell::SetClientReady(void * instance, int, void *[]);
	static int _stdcall MW4Shell::SetClientUnready(void * instance, int, void *[]);
	static int _stdcall MW4Shell::SendVehicleRequest(void * instance, int, void *[]);
	static int _stdcall MW4Shell::NetConnectedToServer(void * instance, int, void *[]);
	static int _stdcall MW4Shell::NetClientVehicleAccepted(void * instance, int, void *[]);


	static int _stdcall MW4Shell::GetVehicleRejectionReasonCount(void * instance, int, void *[]);
	static int _stdcall MW4Shell::GetVehicleRejectionReason(void * instance, int, void *[]);

	static int _stdcall MW4Shell::GetBotVehicleRejectionReasonCount(void * instance, int, void *[]);
	static int _stdcall MW4Shell::GetBotVehicleRejectionReason(void * instance, int, void *[]);

	static int _stdcall MW4Shell::ClearLocalRestrictions(void * instance, int, void *[]);
	static int _stdcall MW4Shell::CheckForLocalRestrictions(void * instance, int, void *[]);


	static int _stdcall MW4Shell::RequestTeam(void * instance, int, void *[]);
	static int _stdcall MW4Shell::CheckGUNAdvertise(void * instance, int, void *[]);

	static int _stdcall MW4Shell::NetHaveMap(void * instance, int, void *[]);
	static int _stdcall MW4Shell::NetLaunchBrowserMapLink(void * instance, int, void *[]);
	

	static int _stdcall MW4Shell::GetStartScreen(void * instance, int, void *[]);
	static int _stdcall MW4Shell::GetMechName(void * instance,int numParms,void* data[]);
	static int _stdcall MW4Shell::SelectMech(void * instance,int numParms,void*data[]);

	static int _stdcall MW4Shell::SelectSkin(void * instance,int numParms,void*data[]);

	static int _stdcall MW4Shell::GetSavedGameCount(void * instance, int, void *[]);
	static int _stdcall MW4Shell::GetSavedGameName(void * instance,int numParms,void* data[]);
	static int _stdcall MW4Shell::LoadSavedGame(void * instance,int numParms,void* data[]);
	static int _stdcall MW4Shell::SetShellCommand(void * instance,int numParms,void* data[]);

	static int _stdcall MW4Shell::LoadQuickSave(void * instance, int, void *[]);
	static int _stdcall MW4Shell::SaveQuickSave(void * instance, int, void *[]);

	static int _stdcall MW4Shell::SetVideoRes(void * instance,int numParms,void* data[]);

	static int _stdcall MW4Shell::GetDecalCount(void *instance,int numParms,void* data[]);
	static int _stdcall MW4Shell::GetDecalNames(void *instance,int numParms,void* data[]);



	static int _stdcall MW4Shell::SetTeamDecal(void *instance,int numParms,void* data[]);
	static int _stdcall MW4Shell::SetPilotDecal(void *instance,int numParms,void* data[]);

	static int _stdcall MW4Shell::gosGetWeaponStats(void *instance,int numParms,void* data[]);

    static const char * _stdcall MW4Shell::GetRuleName( int ruleType );

	static void MW4Shell::CalculateCustomPNGCRC(char *file_name);
	static void MW4Shell::GetShortFileName(MString &string);


	// mission review callbacks
	static int _stdcall MW4Shell::IsMissionReviewAvailable(void *instance,int numParms,void* data[]);
	
	// ngLog addition
	static int _stdcall MW4Shell::IsRegisteredForStats(void *instance,int numParms,void* data[]);
	static int _stdcall MW4Shell::ViewStatsInBrowser(void *instance,int numParms,void* data[]);

	int networkScenarioCount;
	int maxNetworkScenarioCount;
	int selectedScenario;
	int lastRuleType;
	int currentCycleNumber;
	NetworkScenario scenarios[256];

	int totalCycleEntries;
	NetworkCycleList cycleList[256];

	void LoadMapCycle();

	static int _stdcall MW4Shell::InitNetworkScenarios(void *instance, int, void *[]);
	static int _stdcall MW4Shell::GetNetworkScenarios(void *instance, int, void *[]);
	static int _stdcall MW4Shell::SelectNetworkScenario(void *instance, int, void *[]);
	static int _stdcall MW4Shell::SelectNetworkScenarioDirect(int number);
	static int _stdcall MW4Shell::GetScenarioCount(void *instance, int, void *[]);


	// these are for 0-255 shells
	
	static int _stdcall MyPlayerId(void * instance, int numParms, void*data[]);
	static int _stdcall IsPlayerConnectionValid(void * instance,int numParms,void* data[]);
	static int _stdcall GetPlayerConnectionName(void * instance,int numParms,void* data[]);
	static int _stdcall GetPlayerConnectionClan(void * instance,int numParms,void* data[]);
	static int _stdcall GetPlayerConnectionReady(void * instance,int numParms,void* data[]);
	static int _stdcall GetPlayerConnectionLaunched(void * instance,int numParms,void* data[]);
	static int _stdcall GetPlayerConnectionChasis(void * instance,int numParms,void* data[]);
	static int _stdcall GetPlayerConnectionTeam(void * instance,int numParms,void* data[]);
	static int _stdcall GetPlayerConnectionSkin(void * instance,int numParms,void* data[]);

	static int _stdcall MW4Shell::BanPlayer(void *instance,int numParms,void* data[]);
	static int _stdcall MW4Shell::BanPlayersISP(void *instance,int numParms,void* data[]);
	static int _stdcall MW4Shell::KickPlayer(void *instance,int numParms,void* data[]);
	static int _stdcall MW4Shell::SquelchPlayer(void *instance,int numParms,void* data[]);
	static int _stdcall MW4Shell::IsPlayerSquelched(void *instance,int numParms,void* data[]);

	
	static int _stdcall MW4Shell::AddBot(void *instance, int numParams, void* data[]);
	static int _stdcall MW4Shell::RemoveBot(void *instance, int numParams, void* data[]);
	static int _stdcall MW4Shell::RemoveAllBots(void *instance, int numParams, void* data[]);
	static int _stdcall MW4Shell::SetTeamBot(void *instance, int numParams, void* data[]);
	static int _stdcall MW4Shell::SetMechBot(void *instance, int numParams, void* data[]);
	static int _stdcall MW4Shell::GetBotValid(void *instance, int numParams, void* data[]);
	static int _stdcall MW4Shell::GetBotName(void *instance, int numParams, void* data[]);
	static int _stdcall MW4Shell::GetBotClan(void *instance, int numParams, void* data[]);
	static int _stdcall MW4Shell::GetBotChasis(void *instance, int numParams, void* data[]);
	static int _stdcall MW4Shell::GetBotTeam(void *instance, int numParams, void* data[]);
	static int _stdcall MW4Shell::GetBotVehicleAccepted(void *instance, int numParams, void* data[]);
	static int _stdcall MW4Shell::FillTeams(void *instance, int numParams, void* data[]);
	
	
	static int _stdcall MW4Shell::GetTimeToLaunch(void *instance, int numParams, void* data[]);
	static int _stdcall MW4Shell::GetTimeToLaunchLock(void *instance, int numParams, void* data[]);
	static int _stdcall MW4Shell::GetTimeToGameEnd(void *instance, int numParams, void* data[]);
	
	static int _stdcall MW4Shell::GetNetworkError(void *instance, int numParams, void* data[]);
	
	

	//Real Callbacks and variables that are not complete and total shit
	static MW4Shell
		*Instance;

	char *m_iaMissionName;
	char *m_serverCPU;
	Stuff::MString m_mechShortResFile; // jcem
	Stuff::MString m_mechResourceFile;
	Adept::ResourceID m_mechID;


	// for multiplayer scripts, so they can remember settings of mechs.
	char *m_LastMechName;
	int   m_lastMechIndex;

	char *m_endMovieName;

	MString m_teamDecal;
	MString m_pilotDecal;
	char m_skinPrefix;

	int
		m_listBoxSize;

	int m_iaMissionCount;
	int m_mechCount;
	Adept::ResourceID
		*m_mechIDs;
	Adept::ResourceID
		*m_stockMechIDs;

	int m_currentChatCount;
	int m_maxChatCount;
	char **m_chatFrom;
	char **m_chatArray;
	char *m_outgoingChat;
	int m_outgoingChatToPlayerCount;
	int m_outgiongChatToPlayer[32];

	char *m_serverName;
	char *m_serverIP;

	char **m_scoreNames;
	int  m_scoreCount;
    int  m_scorePlyrIndex; // jcem
	int  m_scoreScores[32];
	int  m_scoreKills[32];
	int  m_scoreDeaths[32];
    int  m_scorePlyrs[32]; // jcem
	int  m_scoreTeamAllowed;
	int  m_scoreTeamCounts[8];
	int  m_scoreTeamScores[8];
	int  m_scoreTeamKills[8];
	int  m_scoreTeamDeaths[8];
	int  m_scoreRuleType;
	char* m_scoreMapName;

    static char * m_gameTypeStr;

    static char s_gameTypeStr[128]; // mdm - for game type string is gosscript

	void AddChat(BYTE from, BYTE type, BYTE players_sent_to, char *message);
	void RemoveChat();
	void ClearChat();


	static int _stdcall MW4Shell::RemoveOneChat(void * instance,int numParms,void* data[]);
	static int _stdcall MW4Shell::SendChat(void * instance,int numParms,void* data[]);
	static int _stdcall MW4Shell::SendBroadcastChat(void * instance,int numParms,void* data[]);


	char* m_mapInfo;
	char* m_mapAuthor;
	char* m_mapLink;
	int m_mapLinkAvailable;

	void SetMapInfo(const char *info, const char *author, const char *link);


	static int _stdcall Shell_CallbackHandler(void* instance, int count, void* data[]);

	int GetDummyData(int count, void *data[]);
	int GetMissionNames(int count, void* data[]);
	int GetNumberOfMissionsInMissionPlay();
	int GetMechs(void* data[], int count);
	int GetCampaignMechs(void *data[], int count);
	int GetMechCount();
	int GetCampaignMechCount();
	int SetMech(void* data[], int count);
	int SetCampaignMech(void* data[], int count);
	int SetTime(void* data[], int count);
	int InitIAScreen();
	int InitCampaignScreen();
	int InitMechLabScreen();
	int InitCampaignMechLab();
	int ClearMechLab(int nMode = 0);
	int InitMPScreen();
	int StartCampaignMission();
	int GetLancemates(void* data[], int count);
	int SetLancemate(void* data[], int count);
	int SelectCurrentPilot(void *data[], int count);
	int VerifyLaunchData();
	int GetPilotMechData(void *data[], int count);
	int SetCampaignMissionName(void *data[], int count);
	int GetOptionsToggleValue(void *data[], int count);
	int SetOptionsToggleValue(void *data[], int count);
	int GetOptionsSliderValue(void *data[], int count);
	int SetOptionsSliderValue(void *data[], int count);
	int SetOptionsValue(void *data[], int count);
	int GetOptionsValue(void *data[], int count);
	int SaveOptions();
	int LoadDefaultOptions();
	int DoesHavePilotLoaded(void *data[], int count);
	int GetLoadMissionName(void *data[], int count);
	int IAGetResults(void *data[], int count);
	int GetIAMissionRegionData(void *data[], int count);
	int GetClosingCinema(void *data[], int count);
	int GetLastPlayerMech(void *data[], int count);
	bool m_didSetMPMech;

	int GetSupportedRes(void *data[], int count);

	int GetIsResourceEnglish(void *data[], int count);

	Stuff::SortedChainOf<Stuff::PlugOf<MString>*, Stuff::MString> 
		alphaMechNames;
	MString* alphaMechNamesWithMCSorted;

		// callback support by dan
	char*	m_movieList[MAX_MOVIES_IN_MISSION];
	int		m_currentMovieIndex;
	int		m_movieCount;
	int		m_moviePlaying;
	int		m_moviesStopped;

	int		GetMovieFilename(void* data[], int count);
	void	InitMovieList();
	void	ResetMovieList();
	void	AddNewMovie(const char* szFileName);
	int		TriggerMovie();
	int		AdvanceMovie(void* data[], int count);
	int GetDifficultyLevel(void *data[], int count);
	int SetDifficultyLevel(void *data[], int count);
	int SetMasterTrialDifficutly(void *data[], int count);

	void SelectLastUsedPilot();
	int SelectPilot(void *data[], int count);
	int SelectPilot(const char *pilot_name);
	int DeletePilot(void *data[], int count);
	int RenamePilot(void *data[], int count);
	int ClonePilot(void *data[], int count);
	int CreateNewPilot(void *data[], int count);
	int CreateNewPilot(const char *pilot_name, int difficulty = 1);
	int GetPilotList(void *data[], int count);
	int GetCurrentPilotName(void *data[], int count);
	int GetLanceStats(void *data[], int count);
	int GetMechStats(void *data[], int count);
	int CampaignGetMechBars(void *data[], int count);
	int IAGetMechBars(void *data[], int count);

	//Op region info
	int GetMissionRegionCount(void *data[], int count);
	int GetMissionRegionIDs(void *data[], int count);
	int GetMissionRegionData(void *data[], int count);
	int GetMissionData(void *data[], int count);

	//Mission Specific Mission
	int GetMissionNavPoints(void *data[], int count);
	int GetMissionNavPointCount(void *data[], int count);
	int GetMissionInfoPoints(void *data[], int count);
	int GetMissionInfoPointCount(void *data[], int count);
	int GetMissionDropPoints(void *data[], int count);
	int GetMissionDropPointCount(void *data[], int count);
	int GetGeneralInfoPointCount(void *data[], int count);
	int GetMissionGeneralInfoPoints(void *data[], int count);
	int GetCampaignOpData(void *data[], int count);

	//Results Support
	int CampaignGetPlayerStatus(void *data[], int count);
	int CampaignGetLanceStatus(void *data[], int count);
	int CampaignGetMechSalvage(void *data[], int count);
	int CampaignGetWeaponSalvage(void *data[], int count);
	int CampaignGetResults(void *data[], int count);
	int CampaignPlayIntro(void *data[], int count);
	int CampaignPlayEnd(void *data[], int count);

	//Save Game Support
	int CampaignGetSavedGames(void *data[], int count);
	int CampaignLoadGame(void *data[], int count);

	bool m_doesHaveLoadGame;

	//Instant Action Support
	int SetIAMissionType(void *data[], int count);
	int SetIALancemate(void *data[], int count);
	int SetIALancemateMech(void *data[], int count);
	int GetTimeOfDay(void *data[], int count);
	int SetIAMissionName(void *data[], int count);
	int ShellIAGetMapInfo(void *data[], int count);
	int SetTrainingPlayerMech();
	int GetTrainingMechBars(void *data[], int count);

	//Wave Support
	int GetWaveMissions(void *data[], int count);
	int SetWaveMission(void *data[], int count);
	int AddEnemyAIToWave(void *data[], int count);
	int AddMechToEnemyAI(void *data[], int count);
	int GetEnemyMechChassis(void *data[], int count);
	int RemoveEnemyAIFromWave(void *data[], int count);
	int GetWaveAITypes(void *data[], int count);
	int SetEnemyWaveCount(void *data[], int count);
	int SetEnemyCount(void *data[], int count);
	int SetWavePlayerRespawns(void *data[], int count);
	int IAGetDifficulty(void *data[], int count);
	int IASetDifficulty(void *data[], int count);
	int IAGetWavePlayerRespawns(void *data[], int count);
	int IAGetEnemyWaveCount(void *data[], int count);
	int IAGetStockMechs(void *data[], int count);
	int IAGetMechsWithSpace(void *data[], int count);

	//Master Trials support
	void SetUpMasterMech(int bot_index, int mech_index);
	int IAGetMasterTrialMissions(void *data[], int count);
	int IASetupMasterTrials(void *data[], int count);
	int SetMasterTrialPlayerMech(void *data[], int count);
	int GetMasterMechBars(void *data[], int count);

	//Dedicated Server support
	int ExitDedicatedServer(void *data[], int count);
	int DisconnectDedicatedServer(void *data[], int count);

	int m_waves;
	int m_botsPerWave;
	int m_lancePerWave;
	int m_playerLives;

	//Training Support
	int GetTrainingMissions(void *data[], int count);
	int SetTrainingMission(void *data[], int count);
	int LaunchTrainingMission();

	//Control key remapping support
	int ControlSetDefault(void* data[], int count);
	int ControlAssignValue(void* data[], int count);
	int ControlAcceptChanges(void* data[], int count);
	int ControlCancelChanges(void* data[], int count);
	int ControlGetMapping(void* data[], int count);
	int	ControlGetValue(void* data[], int count);
	int	ControlScanKeyboard(void* data[], int count);

	// Callbacks for input remapping support
	int	ControlGetJoyStickNames(void* data[], int count);
	int ControlGetJoyStickInvert(void* data[], int count);
	int ControlGetMouseInvert(void* data[], int count);
	int	ControlGetJoyStick(void* data[], int count);
	int ControlGetMouse(void* data[], int count);
	int ControlGetJoyStickShift(void* data[], int count);
	int ControlGetJoyListSelected(void* data[], int count);
	int ControlSetJoyListSelected(void* data[], int count);
	int	ControlGetForce(void* data[], int count);
	int ControlSetJoyStickInvert(void* data[], int count);
	int ControlSetMouseInvert(void* data[], int count);
	int	ControlSetForce(void* data[], int count);
	int ControlSetJoyStickShift(void* data[], int count);
	int ControlSetJoyStick(void* data[], int count);
	int ControlSetMouse(void* data[], int count);
	int ControlSetJoyShiftValue(void* data[], int count);
	int ControlGetJoyShiftValue(void* data[], int count);
	int ControlGetMouseSensitivity(void* data[], int count);
	int ControlSetMouseSensitivity(void* data[], int count);
	int ControlGetJoyXAxis(void* data[], int count);
	int ControlGetJoyRudderAxis(void* data[], int count);
	int ControlGetMouseXAxis(void* data[], int count);
	int ControlSetJoyXAxis(void* data[], int count);
	int ControlSetJoyRudderAxis(void* data[], int count);
	int ControlSetMouseXAxis(void* data[], int count);
	int ControlSaveSettings(void* data[], int count);
	int ControlRestoreSettings(void* data[], int count);
	int ControlSetJoyStickThrottle(void* data[], int count);
	int ControlGetJoyStickThrottle(void* data[], int count);

	DynamicMemoryStream m_memoryStream;

	int
		ia_gameType;
	Adept::ResourceFile
		*m_optionsFile;
	MWOptions
		*m_optionsObject;

	// server statistics section...
	// these all work on 0-32 quick lists...
	// these will change to work up to 255
	static int _stdcall ServerStatsScale(void * instance,int numParms,void* data[]);
	static int _stdcall ClientStatsScale(void * instance,int numParms,void* data[]);
	static int _stdcall ServerStatsDirty(void * instance,int numParms,void* data[]);
	static int _stdcall ServerCleanDirtyFlag(void * instance,int numParms,void* data[]);
	static int _stdcall GetCurrentGameName(void * instance,int numParms,void* data[]);
	static int _stdcall GetCurrentMissionName(void * instance,int numParms,void* data[]);
	static int _stdcall GetPlayerCount(void * instance,int numParms,void* data[]);
	static int _stdcall IsPlayerValid(void * instance,int numParms,void* data[]);
	static int _stdcall GetPlayerName(void * instance,int numParms,void* data[]);
	static int _stdcall GetConnectionPlayerName(void * instance,int numParms,void* data[]);
	static int _stdcall GetStatisticsCount(void * instance,int numParms,void* data[]);
	static int _stdcall GetStatisticName(void * instance,int numParms,void* data[]);
	static int _stdcall GetStatisticbps(void * instance,int numParms,void* data[]);
	static int _stdcall GetStatisticLifeTimeTotal(void * instance,int numParms,void* data[]);
	static int _stdcall GetPlayersbps(void * instance,int numParms,void* data[]);
	static int _stdcall GetPlayerPing(void * instance,int numParms,void* data[]);
	static int _stdcall GetPlayersIncommingPacketsPerSecond(void * instance,int numParms,void* data[]);
	static int _stdcall GetPlayersOutgoingPacketsPerSecond(void * instance,int numParms,void* data[]);
	static int _stdcall GetGameTime(void * instance,int numParms,void* data[]);
	static int _stdcall GetRealTime(void * instance,int numParms,void* data[]);
	static int _stdcall GetRealDate(void * instance,int numParms,void* data[]);
    static int _stdcall GetGameTypeString(void * instance, int numParms, void* data[]);
    static int _stdcall GetGameTypeFromString(void * instance, int numParms, void* data[]);

	// Helper function to add bots from nfo file
	static int AddBots(Stuff::Page* botPage, int* botIds, int* mechIds);
	static int AddBots(int number, int* botIds, int* mechIds);
	static int FillBotsForAllTeams(int* botIds, int* mechIds);
	static int AddOneBot(int* botId, int* mechId, int teamId, int minTon, int maxTon, int minLev, int maxLev);
	static int FindTeamWithLeastTonnage();
public: // jcem
	DWORD m_dwShellResources;
public: // jcem
	char* GetShellString(int index);
};
