Files
firestorm/Gameleap/code/mw4/Code/mw4dedicatedui/DedicatedUI.hpp
T
Cyd 2b8ca921cb Initial full mirror of c:\VWE (source + assets + toolchain + outputs) via Git LFS
Complete disaster-recovery snapshot: engine/game source, game data assets,
VC6 toolchain + DX SDKs, build outputs, deployed game, and _UNUSED archive.
Large binaries in Git LFS; text preserved byte-for-byte (core.autocrlf=false,
no eol attributes). See RECOVERY.md for the one-clone rebuild procedure.
2026-06-24 21:28:16 -05:00

314 lines
11 KiB
C++

#if !defined(_____DEDICATEDUI_H_____)
#define _____DEDICATEDUI_H_____
#include <MW4Application\MW4AppHeaders.hpp>
#include <Adept\GameSpy\GameSpy.h>
#include <GameOS\Network.hpp>
#include <GosScript\gosScriptHeaders.hpp>
#include <GosFX\GosFX.hpp>
#include <Compost\Compost.hpp>
#include <string.h>
#include <stdlib.h>
#include <GameOS\GUNGameList.h>
#include <GameOS\ToolOS.hpp>
#include <mw4\mwapplication.hpp>
#include <mw4\mw4shell.hpp>
#include <mw4\netparams.h>
#include <Adept\rasfuncs.h>
#include <missionlang\resource.h>
#include <mw4\GameInfo.hpp>
extern bool __stdcall gos_NetDoneStartGame();
//========================================================================
// definitions for callbacks
//========================================================================
#define SCRIPTCALLBACK(func) int __stdcall func( void * instance, int args, void * arg[])
#define SCRIPTVAR_INT(var) int var
#define SCRIPTVAR_STR(var) char * var
#define SCRIPTVAR_ARR(var) char ** var
#define SCRIPTVAR_IRR(var) int * var
#define RESET_NULL_TO_EMPTY(ptr) if ((ptr)==NULL) ptr=EMPTY_STRING
#define FREE_PTR(ptr) if ((void *)ptr) { gos_Free((void *)ptr); (ptr)=NULL; }
#define STRING_SIZE 256
#define NUM_ELEMENTS 20
#define MAX_FILTER_STRING 100
#define MAX_SORT_STRING 100
#define MAX_SORT_TYPE_STRING 20
#define MAX_SORT_COLUMNS 10
#define CONNECTION_FILE_VERSION 0x00010005
#define DEFAULT_SORT_COLUMN 1
#define ARRAY_SIZE(arr) (sizeof(arr)/sizeof(arr[0]))
#define FixSZString(a) ((a)[sizeof(a)-1]) = 0
//#define USE_GAMESPY
//========================================================================
// prototypes for the callback functions
//========================================================================
extern SCRIPTCALLBACK(GetReferenceVersion);
extern SCRIPTCALLBACK(GetListSize);
extern SCRIPTCALLBACK(SortGameList);
extern SCRIPTCALLBACK(Select);
extern SCRIPTCALLBACK(GetSelection);
extern SCRIPTCALLBACK(GetGameData);
extern SCRIPTCALLBACK(StartPingServer);
extern SCRIPTCALLBACK(StartPingClient);
extern SCRIPTCALLBACK(ShutdownPing);
extern SCRIPTCALLBACK(GetPing);
extern SCRIPTCALLBACK(GetPlayerList);
extern SCRIPTCALLBACK(UpdateGUNGameList);
extern SCRIPTCALLBACK(GetTotalGameCount);
extern SCRIPTCALLBACK(UpdateGameList);
extern SCRIPTCALLBACK(CancelActivity);
extern SCRIPTCALLBACK(IsGameListUpdating);
extern SCRIPTCALLBACK(SetGameNameDefault);
extern SCRIPTCALLBACK(SetPlayerNameDefault);
extern SCRIPTCALLBACK(CreateSession);
extern SCRIPTCALLBACK(JoinSelected);
extern SCRIPTCALLBACK(Disconnect);
extern SCRIPTCALLBACK(CheckZoneMatch);
extern SCRIPTCALLBACK(CreateBrowsers);
extern SCRIPTCALLBACK(LoadMPConnectionSettings);
extern SCRIPTCALLBACK(SaveMPConnectionSettings);
extern SCRIPTCALLBACK(InitMainMPScreen);
extern SCRIPTCALLBACK(InitNewConnectionScreen);
extern SCRIPTCALLBACK(InitBrowseChoiceScreen);
extern SCRIPTCALLBACK(InitServerListScreen);
extern SCRIPTCALLBACK(AddServer);
extern SCRIPTCALLBACK(UpdateServerList);
extern SCRIPTCALLBACK(RefreshServerInfo);
extern SCRIPTCALLBACK(SelectServer);
extern SCRIPTCALLBACK(JoinGame);
extern SCRIPTCALLBACK(HostGame);
extern SCRIPTCALLBACK(InitConnectionWizard);
extern SCRIPTCALLBACK(TermConnectionWizard);
extern SCRIPTCALLBACK(LaunchDUNWizard);
extern SCRIPTCALLBACK(RemoveConnection);
extern SCRIPTCALLBACK(QuickJoin);
extern SCRIPTCALLBACK(GetHostOptions);
extern SCRIPTCALLBACK(GetFilterOptions);
extern SCRIPTCALLBACK(RefreshGameList);
extern SCRIPTCALLBACK(ChatSend);
extern SCRIPTCALLBACK(FillPlayerRosterMechType);
extern SCRIPTCALLBACK(FillMechTypes);
extern SCRIPTCALLBACK(FillGameSettings);
extern SCRIPTCALLBACK(GetRASEntryUserNameAndPassword);
extern SCRIPTCALLBACK(kldc12);
extern SCRIPTCALLBACK(kldc13);
extern SCRIPTCALLBACK(kldc14);
extern SCRIPTCALLBACK(kldc15);
extern SCRIPTCALLBACK(kldc16);
extern SCRIPTCALLBACK(kldc17);
extern SCRIPTCALLBACK(kldc18);
extern SCRIPTCALLBACK(kldc19);
extern SCRIPTCALLBACK(kldc20);
extern SCRIPTCALLBACK(kldc21);
extern SCRIPTCALLBACK(kldc22);
extern SCRIPTCALLBACK(kldc23);
extern SCRIPTCALLBACK(kldc24);
extern SCRIPTCALLBACK(kldc25);
extern SCRIPTCALLBACK(GetDialupConnectionStatus);
extern SCRIPTCALLBACK(CancelDialup);
extern SCRIPTCALLBACK(PreConnect);
extern SCRIPTCALLBACK(CreateNewPhonebookEntry);
extern SCRIPTCALLBACK(BrowseIPAddress);
extern SCRIPTCALLBACK(GetServerInfo);
extern SCRIPTCALLBACK(GetServerInfoStatus);
extern SCRIPTCALLBACK(ApplyFilters);
extern SCRIPTCALLBACK(SaveFilters);
extern SCRIPTCALLBACK(ClearFIlters);
extern SCRIPTCALLBACK(RevertFilters);
extern SCRIPTCALLBACK(SetFilterParam);
extern SCRIPTCALLBACK(GetFilterParam);
extern SCRIPTCALLBACK(SaveSortInfo);
extern SCRIPTCALLBACK(GetSortInfo);
//========================================================================
// prototypes for callback variables
//========================================================================
extern SCRIPTVAR_INT(gConnectionType);
extern SCRIPTVAR_INT(NumberOfGames);
extern SCRIPTVAR_INT(NumberOfPlayers);
extern SCRIPTVAR_INT(Available);
extern SCRIPTVAR_STR(GameName);
extern SCRIPTVAR_STR(PlayerName);
extern SCRIPTVAR_STR(ServerIPAddress);
extern SCRIPTVAR_STR(NGPassword);
extern SCRIPTVAR_ARR(ListOfPlayers);
extern SCRIPTVAR_ARR(ListOfClans);
extern SCRIPTVAR_ARR(ListOfModems);
extern SCRIPTVAR_ARR(ListOfSerialPorts);
extern SCRIPTVAR_INT(ConnectionIndex);
extern SCRIPTVAR_INT(SortColumnID);
extern SCRIPTVAR_INT(SortDescending);
extern SCRIPTVAR_INT(NumConnections);
extern SCRIPTVAR_INT(AmIOnDialUpDefault);
extern SCRIPTVAR_INT(BrowseGameSpy);
extern SCRIPTVAR_INT(BrowseGUN);
extern SCRIPTVAR_INT(BrowseLAN);
extern SCRIPTVAR_INT(BrowseIPAddresses);
extern SCRIPTVAR_INT(NumIPAddresses);
extern SCRIPTVAR_INT(NumServers);
extern SCRIPTVAR_ARR(ListOfConnections);
extern SCRIPTVAR_ARR(ListOfIPAddresses);
extern SCRIPTVAR_ARR(ListOfServers);
extern SCRIPTVAR_ARR(ServerInfo);
extern SCRIPTVAR_INT(UseDUN);
extern SCRIPTVAR_INT(NumDUN);
extern SCRIPTVAR_ARR(ListOfDUN);
extern SCRIPTVAR_INT(DUNIndex);
extern SCRIPTVAR_STR(DUNUserName);
extern SCRIPTVAR_STR(DUNPassword);
extern SCRIPTVAR_STR(DialupConnectionStatus);
extern SCRIPTVAR_INT(AdvertiseThisGame);
extern SCRIPTVAR_STR(LocalIPAddress);
extern SCRIPTVAR_STR(ReferenceVersion);
extern SCRIPTVAR_INT(iDedicated);
extern SCRIPTVAR_INT(bPasswordProtected);
extern SCRIPTVAR_INT(kldi30);
extern SCRIPTVAR_INT(kldi61);
extern SCRIPTVAR_STR(GameDataID);
extern SCRIPTVAR_STR(SortColumnName);
extern SCRIPTVAR_STR(SortType);
extern SCRIPTVAR_STR(FilterParamVal);
extern SCRIPTVAR_STR(PingTimeStr);
extern SCRIPTVAR_STR(GamePassword);
extern SCRIPTVAR_STR(ErrorMsg);
extern SCRIPTVAR_STR(klds07);
extern SCRIPTVAR_STR(GameSpyAddress);
extern SCRIPTVAR_ARR(ListOfTCPIPAddresses);
class CDedicatedServerUI
{
public:
static void _stdcall InitializeGameEngine();
static void _stdcall TerminateGameEngine();
static void _stdcall Run(HINSTANCE hInst, HINSTANCE hPrevInst, LPSTR lpCmdLine, int nCmdShow);
static void _stdcall Quit();
static INT CALLBACK DedicatedServerProc(
HWND hwndDlg, // handle to dialog box
UINT uMsg, // message
WPARAM wParam, // first message parameter
LPARAM lParam // second message parameter
);
static INT CALLBACK HostSetupProc(
HWND hwndDlg, // handle to dialog box
UINT uMsg, // message
WPARAM wParam, // first message parameter
LPARAM lParam // second message parameter
);
static INT CALLBACK GameLobbyProc(
HWND hwndDlg, // handle to dialog box
UINT uMsg, // message
WPARAM wParam, // first message parameter
LPARAM lParam // second message parameter
);
static INT CALLBACK RestrictionProc(
HWND hwndDlg, // handle to dialog box
UINT uMsg, // message
WPARAM wParam, // first message parameter
LPARAM lParam // second message parameter
);
static void InitHostSetup(HWND hWnd);
static void InitGameLobby(HWND hWnd);
static void GameLobbyOnLaunch(HWND hWnd);
static void OnConnectionSelectionChange(HWND hWnd);
static void OnGameTypeChange(HWND hWnd);
static void OnMapChange(HWND hWnd);
static void OnWeatherChange(HWND hWnd);
static void OnVisibilityChange(HWND hWnd);
static void OnTimeOfDayChange(HWND hWnd);
static void OnTimeLimitChange(HWND hWnd);
static void OnFragLimitChange(HWND hWnd);
static void OnLifeLimitChange(HWND hWnd);
static void OnStockMechChange(HWND hWnd);
static void OnReviewChange(HWND hWnd);
static void OnRadarChange(HWND hWnd);
static void OnMaxTonnageChange(HWND hWnd);
static void OnCheckNumLives(HWND hWnd);
static void OnCheckFragLimit(HWND hWnd);
static void OnCheckServerRecycle(HWND hWnd);
static void OnCheckJoinInProgress(HWND hWnd);
static void OnCheckPassword(HWND hWnd);
static bool HostSetupOnStart(HWND hWnd);
static void GameLobbyOnChat(HWND hWnd);
static void GameLobbyUpdateChat(HWND hWnd);
static void GameLobbyUpdatePlayers(HWND hWnd);
static void GameLobbyDisplayPlayers(HWND hWnd);
static void GameLobbyUpdateTeamUI(HWND hWnd, BOOL team_val);
static int SetMechBot(int botNumber, int mech_index);
static void OnTeamSelChange(HWND hWndDlg);
static void OnTeamMaxTonChange(HWND hWndDlg);
static void OnTeamMaxTotalTonChange(HWND hWndDlg);
static void OnTeamMinTonChange(HWND hWndDlg);
static void EnterRunningGameState();
static void EnterLoadingGameState();
static void EnterStoppingGameState();
static void EnterRecyclingGameState();
static void OnLockServer(HWND hWnd);
static void OnBotError();
static int AddBot(char* name, int level, char* clan, int mechId, int teamId);
static void EnableMissionEdit(BOOL bEnable);
static BOOL AutoLaunchInitialize();
static void OnMechSelChange(HWND hWnd);
static void GetMechBaseName(char *full_name, char* base_name);
static void SetNextGame(HWND hWnd);
static void ShowKickBanMenu(HWND hwndDlg, bool kick);
static void OnMaxPlayerChange(HWND hWnd);
static int valid_count;
static char teamstring[9][8];
// MSL ADD MECH
static char mechlist[64][256];
static char denied_error[13][256];
static int mech_ids[17];
static int skin_ids[17];
static int team_ids[17];
static int status[17];
static int accepted[17];
static int i_am_a_bot[17];
static int player_number[17];
static int bot_number[17];
static char* print_names[17];
static char* faction_name[17];
static Stuff::Scalar tonnages[17];
static char base_names[17][256];
static int player_ping[17];
static int host_last_num;
static int host_last_val;
static int host_last_status;
static int host_last_ready;
static int host_last_team;
static int host_last_skin;
static int host_last_teams_num;
static int host_bot_last_val[256];
static int host_bot_last_skin[256];
static int host_bot_last_player_num[256];
static int host_bot_from_file[256];
static char** mechs;
static int* bStock;
static int* stock_array;
static int* variant_array;
static int current_mech;
static int min_ton_allteams;
static int max_ton_allteams;
static int total_max_ton_allteams;
static int team_roster_count[9];
static int team_legal_to_join[9];
static int max_players;
static int max_bots;
static int num_of_players;
static int game_state;
static int bots_exist;
static int fill_game;
};
int __stdcall Mech4CreateGame(char *szGameName, char *szPlayerName, char *szPassword);
bool __stdcall PrepareDefaultServerAdvertisers(void);
#endif // !defined(_____DEDICATEDUI_H_____)