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.
735 lines
22 KiB
C++
735 lines
22 KiB
C++
#include "MW4Headers.hpp"
|
|
|
|
#define GAMEINFOEXTERN // to define variables in gameinfo
|
|
#include "gameinfo.hpp"
|
|
#undef GAMEINFOEXTERN // to protect from other headers defining variables.
|
|
|
|
|
|
|
|
#include "MWMission.hpp"
|
|
#include "MWApplication.hpp"
|
|
#include <adept\player.hpp>
|
|
#include <adept\mission.hpp>
|
|
#include <adept\application.hpp>
|
|
#include <stuff\memorystream.hpp>
|
|
#include "gametypes.h"
|
|
#include <GameOS\Network.hpp>
|
|
#include <windows.h>
|
|
|
|
#include <mbstring.h>
|
|
#define __mbsrchr(s,c) (char*)_mbsrchr((const unsigned char*)(s),(c))
|
|
|
|
const int MAX_MESSAGE_SIZE=65536;
|
|
|
|
using namespace MWGameInfo;
|
|
|
|
extern int Connected;
|
|
|
|
#ifdef LAB_ONLY
|
|
namespace MWGameInfo
|
|
{
|
|
|
|
|
|
char *MessageNames[Adept::Network::GosMessageStopID];
|
|
|
|
#define MESSAGE_NAME(name)\
|
|
MessageNames[name] = ""#name"";
|
|
|
|
char MWGameInfo::g_MachineName[MAX_GAME_INFO_STR_LEN] = "";
|
|
char MWGameInfo::g_UserName[MAX_GAME_INFO_STR_LEN] = "";
|
|
|
|
char MWGameInfo::g_MissionName[MAX_GAME_INFO_STR_LEN] = "";
|
|
char MWGameInfo::g_MissionScript[128] = "";
|
|
char MWGameInfo::g_PlayerMech[MAX_GAME_INFO_STR_LEN] = "";
|
|
char g_LastMWObject[MAX_GAME_INFO_STR_LEN] = "";
|
|
char g_LastVehicle[MAX_GAME_INFO_STR_LEN] = "";
|
|
char g_MechModel[MAX_GAME_INFO_STR_LEN] = "";
|
|
char g_ResourceFile[MAX_GAME_INFO_STR_LEN] = "";
|
|
char g_ResourceEntry[MAX_GAME_INFO_STR_LEN] = "";
|
|
Point3D g_LastMWObjectPos = Point3D::Identity;
|
|
Point3D g_LastVehiclePos = Point3D::Identity;
|
|
|
|
|
|
Time g_currentTime = 0;
|
|
|
|
int g_totalNumberOfPlayedGames = 0;
|
|
|
|
|
|
int g_lastGameType = NoGame;
|
|
int g_currentGameType = NoGame;
|
|
|
|
char *g_gameTypes[MaxGameTypes] =
|
|
{
|
|
"NoGame",
|
|
"Campaign",
|
|
"Instant",
|
|
"MultiServer",
|
|
"MultiClient",
|
|
};
|
|
|
|
bool g_dedicatedServer = false;
|
|
|
|
int g_totalNetworkConnects = 0;
|
|
int g_totalNetworkDisconnects = 0;
|
|
|
|
int g_totalNetworkJoins = 0;
|
|
int g_totalNetworkLeaves = 0;
|
|
|
|
int g_currentlyConnected = 0;
|
|
int g_currentlyJoined = 0;
|
|
|
|
int g_lastConnectID = -1;
|
|
int g_lastDisconnectID = -1;
|
|
|
|
int g_lastJoinID = -1;
|
|
int g_lastLeaveID = -1;
|
|
|
|
|
|
|
|
|
|
Stuff::Scalar g_GameStart = 0;
|
|
Stuff::Scalar g_GameEnd = 0;
|
|
|
|
MString* g_missionParamsString = 0;
|
|
MString* g_serverMissionParamsString = 0;
|
|
|
|
bool m_GameInfoReady = false;
|
|
|
|
|
|
GUID g_playerIds[Maximum_Connection_Numbers];
|
|
char g_playerNames[Maximum_Connection_Numbers][MAX_GAME_INFO_STR_LEN];
|
|
char g_playerVehicleNames[Maximum_Connection_Numbers][MAX_GAME_INFO_STR_LEN];
|
|
|
|
int g_playerTeams[Maximum_Connection_Numbers];
|
|
int g_playerScores[Maximum_Connection_Numbers];
|
|
int g_playerKills[Maximum_Connection_Numbers];
|
|
int g_playerDeaths[Maximum_Connection_Numbers];
|
|
|
|
double g_playerConnectTime[Maximum_Connection_Numbers];
|
|
double g_playerDisconnectTime[Maximum_Connection_Numbers];
|
|
|
|
double g_playerJoinTime[Maximum_Connection_Numbers];
|
|
double g_playerLeaveTime[Maximum_Connection_Numbers];
|
|
|
|
int g_playerJoins[Maximum_Connection_Numbers];
|
|
int g_playerLeaves[Maximum_Connection_Numbers];
|
|
|
|
int g_networkDebugLevel[Maximum_Connection_Numbers];
|
|
int g_connectRate[Maximum_Connection_Numbers];
|
|
|
|
}
|
|
extern char g_LastEntity[255];
|
|
|
|
char* __stdcall GameInfo(void)
|
|
{
|
|
|
|
if (!m_GameInfoReady)
|
|
return NULL;
|
|
|
|
if (!Stuff::g_StuffInitizlized)
|
|
return NULL;
|
|
|
|
|
|
static char Buffer[MAX_MESSAGE_SIZE];
|
|
|
|
char temp_buffer[MAX_MESSAGE_SIZE];
|
|
|
|
MemoryStream stream(&Buffer[0], MAX_MESSAGE_SIZE);
|
|
|
|
stream << "Machine Name = " << g_MachineName << "\n";
|
|
stream << "User Name = " << g_UserName << "\n";
|
|
|
|
stream << "Connection = ";
|
|
switch (Connected)
|
|
{
|
|
case NP_NOT:
|
|
{
|
|
stream << "None\n";
|
|
break;
|
|
}
|
|
case NP_TCP:
|
|
{
|
|
stream << "TCP\n";
|
|
break;
|
|
}
|
|
case NP_IPX:
|
|
{
|
|
stream << "IPX\n";
|
|
break;
|
|
}
|
|
case NP_MODEM:
|
|
{
|
|
stream << "Modem\n";
|
|
break;
|
|
}
|
|
case NP_SERIAL:
|
|
{
|
|
stream << "Serial\n";
|
|
break;
|
|
}
|
|
case NP_ZONEMATCH:
|
|
{
|
|
stream << "Zone Match\n";
|
|
break;
|
|
}
|
|
default:
|
|
{
|
|
stream << "?Unknown.\n";
|
|
}
|
|
}
|
|
|
|
stream << "Mission = " << g_MissionName << "\n";
|
|
stream << "Mission Script = " << g_MissionScript << "\n";
|
|
|
|
stream << "Mech = " << g_PlayerMech << "\n";
|
|
stream << "MechModel = " << g_MechModel << "\n";
|
|
|
|
stream << "ResourceFile = " << g_ResourceFile << "\n";
|
|
stream << "ResourceEntry = " << g_ResourceEntry << "\n";
|
|
stream << "LastFileRequest = " << g_LastFileOpenRequest << "\n";
|
|
|
|
sprintf(temp_buffer, "<%f:%f:%f>", g_LastLocalPlayerPos.x, g_LastLocalPlayerPos.y, g_LastLocalPlayerPos.z);
|
|
stream << "Last Player Mech Pos = " << temp_buffer << "\n";
|
|
|
|
sprintf(temp_buffer, "<%f:%f:%f>", g_LastCameraPos.x, g_LastCameraPos.y, g_LastCameraPos.z);
|
|
stream << "Last Camera Pos = " << temp_buffer << "\n";
|
|
|
|
|
|
|
|
stream << "Last Entity = " << g_LastEntity << "\n";
|
|
stream << "Last Object = " << g_LastMWObject << "\n";
|
|
sprintf(temp_buffer, "<%f:%f:%f>", g_LastMWObjectPos.x, g_LastMWObjectPos.y, g_LastMWObjectPos.z);
|
|
stream << "Last Object Pos = " << temp_buffer << "\n";
|
|
stream << "Last Vehicle = " << g_LastVehicle << "\n";
|
|
sprintf(temp_buffer, "<%f:%f:%f>", g_LastVehiclePos.x, g_LastVehiclePos.y, g_LastVehiclePos.z);
|
|
stream << "Last Vehicle Pos = " << temp_buffer << "\n";
|
|
|
|
stream << "\n Application \n ";
|
|
stream << "---------------------\n";
|
|
stream << "Last Game Type : " << g_gameTypes[g_lastGameType] << "\n";
|
|
stream << "Current Game Type : " << g_gameTypes[g_currentGameType] << "\n";
|
|
sprintf(temp_buffer, "%d", g_totalNumberOfPlayedGames);
|
|
stream << "Number of Games : " << temp_buffer << "\n";
|
|
sprintf(temp_buffer, "%10.4f", g_currentTime);
|
|
stream << "CurrentGameTime : " << temp_buffer << "\n";
|
|
|
|
stream << "ApplicationState : " << g_applicationStates[g_currentApplicationState] << "\n";
|
|
stream << "ApplicationPhase : " << g_applicationPhases[g_currentApplicationPhase] << "\n";
|
|
|
|
|
|
if (g_currentGameType == MultiServer || g_currentGameType == MultiClient)
|
|
{
|
|
|
|
stream << "\n Network \n ";
|
|
stream << "---------------------\n";
|
|
if (g_dedicatedServer)
|
|
{
|
|
stream << "Dedicated Game Server\n";
|
|
}
|
|
else
|
|
{
|
|
stream << "Playing Game Server\n";
|
|
}
|
|
|
|
stream << "Teams Present : ";
|
|
|
|
bool any_teams_present = false;
|
|
bool teams_present[8];
|
|
{for (int i = 0; i < 8; ++i)
|
|
{
|
|
teams_present[i] = false;
|
|
}}
|
|
|
|
{for (int i = 0;
|
|
i < Maximum_Connection_Numbers;
|
|
++i)
|
|
{
|
|
if (g_playerTeams[i] != MWApplication::No_Team)
|
|
{
|
|
teams_present[i] = true;
|
|
any_teams_present = true;
|
|
}
|
|
}}
|
|
|
|
if (any_teams_present == false)
|
|
{
|
|
stream << "None";
|
|
}
|
|
else
|
|
{
|
|
{for (int i = 0; i < 8; ++i)
|
|
{
|
|
if (teams_present[i] == true)
|
|
{
|
|
sprintf(temp_buffer,"%d",i+1);
|
|
stream << temp_buffer << " ";
|
|
}
|
|
}}
|
|
}
|
|
|
|
stream << "\n";
|
|
|
|
if (g_GameEnd == 0)
|
|
{
|
|
g_GameEnd = (Stuff::Scalar)gos_GetElapsedTime();
|
|
}
|
|
|
|
sprintf(temp_buffer, "%10.4f", g_GameEnd - g_GameStart);
|
|
stream << "Game Duration : " << temp_buffer;
|
|
sprintf(temp_buffer, "%10.4f", g_GameStart);
|
|
stream << "\nStart : " << temp_buffer;
|
|
sprintf(temp_buffer, "%10.4f", g_GameEnd);
|
|
stream << "\nEnd : " << temp_buffer << "\n";
|
|
|
|
sprintf(temp_buffer, "%d", g_totalNetworkConnects);
|
|
stream << "Total Connects : " << temp_buffer << "\n";
|
|
sprintf(temp_buffer, "%d", g_totalNetworkDisconnects);
|
|
stream << "Total Disconnects : " << temp_buffer << "\n";
|
|
|
|
sprintf(temp_buffer, "%d", g_totalNetworkJoins);
|
|
stream << "Total Joins : " << temp_buffer << "\n";
|
|
sprintf(temp_buffer, "%d", g_totalNetworkLeaves);
|
|
stream << "Total Leaves : " << temp_buffer << "\n";
|
|
|
|
|
|
sprintf(temp_buffer, "%d", g_currentlyConnected);
|
|
stream << "Current Connections : " << temp_buffer << "\n";
|
|
sprintf(temp_buffer, "%d", g_currentlyJoined);
|
|
stream << "Current Playing : " << temp_buffer << "\n";
|
|
|
|
|
|
sprintf(temp_buffer, "%d", g_lastConnectID);
|
|
stream << "Last Player Connected : " << temp_buffer << "\n";
|
|
sprintf(temp_buffer, "%d", g_lastDisconnectID);
|
|
stream << "Last Player Disconnected : " << temp_buffer << "\n";
|
|
|
|
sprintf(temp_buffer, "%d", g_lastJoinID);
|
|
stream << "Last Player Join : " << temp_buffer << "\n";
|
|
sprintf(temp_buffer, "%d", g_lastLeaveID);
|
|
stream << "Last Player Leave : " << temp_buffer << "\n";
|
|
|
|
for (int i = 0; i < Maximum_Connection_Numbers; ++i)
|
|
{
|
|
if (g_playerNames[i][0] != '\0')
|
|
{
|
|
double time_since_last_packet_to = g_currentTime - g_lastPacketToPlayer[i];
|
|
double time_since_last_packet_from = g_currentTime - g_lastPacketFromPlayer[i];
|
|
|
|
stream << "\n";
|
|
sprintf(temp_buffer, "%d: name: %s, mech: %s", i, g_playerNames[i], g_playerVehicleNames[i]);
|
|
stream << temp_buffer << "\n";
|
|
if (g_playerTeams[i] == MWApplication::No_Team)
|
|
{
|
|
stream << "Team = None\n";
|
|
}
|
|
else
|
|
{
|
|
sprintf(temp_buffer, "%d", g_playerTeams[i] + 1);
|
|
stream << "Team = " << temp_buffer << "\n";
|
|
}
|
|
sprintf(temp_buffer,"%d",g_playerKills[i]);
|
|
stream << "Kills = " << temp_buffer;
|
|
sprintf(temp_buffer,"%d",g_playerDeaths[i]);
|
|
stream << "\nDeaths = " << temp_buffer;
|
|
sprintf(temp_buffer,"%d",g_playerScores[i]);
|
|
stream << "\nScore = " << temp_buffer;
|
|
stream << "\n---------------------\n";
|
|
sprintf(temp_buffer, "net_debug_level %d : ConnectBandwidth %d ", g_networkDebugLevel[i], g_connectRate[i]);
|
|
stream << temp_buffer << "\n";
|
|
sprintf(temp_buffer, "connect: %10.4f", g_playerConnectTime[i]);
|
|
stream << temp_buffer << "\n";
|
|
sprintf(temp_buffer, "dissconnect: %10.4f", g_playerDisconnectTime[i]);
|
|
stream << temp_buffer << "\n";
|
|
sprintf(temp_buffer, "joins %d : last %10.4f", g_playerJoins[i], g_playerJoinTime[i]);
|
|
stream << temp_buffer << "\n";
|
|
sprintf(temp_buffer, "leave %d : last %10.4f", g_playerLeaves[i], g_playerLeaveTime[i]);
|
|
stream << temp_buffer << "\n";
|
|
sprintf(temp_buffer, "last packet to: %10.4f", time_since_last_packet_to);
|
|
stream << temp_buffer << "\n";
|
|
sprintf(temp_buffer, "last packet from : %10.4f", time_since_last_packet_from);
|
|
stream << temp_buffer << "\n";
|
|
}
|
|
}
|
|
|
|
|
|
stream << "\n PacketHistory \n";
|
|
stream << "------------------------- \n";
|
|
|
|
// print them out, last to first...
|
|
for (i = nextPacketHistoryIndex; i < Packet_History_Count; ++i)
|
|
{
|
|
if (g_lastPacketType[i] != -1)
|
|
{
|
|
sprintf(temp_buffer,"%10.4f : player %d : i %d : Type : %d : %s : Size : %d \n", g_lastPacketTime[i], g_lastPacketAddress[i], g_lastPacketInbound[i], g_lastPacketType[i], MessageNames[g_lastPacketType[i]], g_lastPacketSize[i]);
|
|
stream << temp_buffer;
|
|
}
|
|
|
|
}
|
|
|
|
for (i = 0; i < nextPacketHistoryIndex; ++i)
|
|
{
|
|
if (g_lastPacketType[i] != -1)
|
|
{
|
|
sprintf(temp_buffer,"%10.4f : player %d : i %d : Type : %d : %s: Size : %d \n",g_lastPacketTime[i], g_lastPacketAddress[i], g_lastPacketInbound[i], g_lastPacketType[i], MessageNames[g_lastPacketType[i]], g_lastPacketSize[i]);
|
|
stream << temp_buffer;
|
|
}
|
|
}
|
|
|
|
|
|
if (g_missionParamsString != 0)
|
|
{
|
|
stream << "\n Mission Params \n ";
|
|
stream << "---------------------\n";
|
|
stream.WriteBytes(*g_missionParamsString,g_missionParamsString->GetLength());
|
|
stream << "\n";
|
|
}
|
|
|
|
if (g_serverMissionParamsString != 0)
|
|
{
|
|
stream << "\n Server Mission Params \n ";
|
|
stream << "---------------------\n";
|
|
stream.WriteBytes(*g_serverMissionParamsString,g_serverMissionParamsString->GetLength());
|
|
stream << "\n";
|
|
}
|
|
|
|
}
|
|
|
|
return Buffer;
|
|
}
|
|
|
|
|
|
void MWGameInfo::InitGameInfo (void)
|
|
{
|
|
|
|
|
|
for (int i = 0; i < Maximum_Connection_Numbers; ++i)
|
|
{
|
|
g_playerNames[i][0] = '\0';
|
|
g_playerVehicleNames[i][0] = '\0';
|
|
|
|
g_playerTeams[i] = MWApplication::No_Team;
|
|
g_playerScores[i] = 0;
|
|
g_playerKills[i] = 0;
|
|
g_playerDeaths[i] = 0;
|
|
|
|
g_playerConnectTime[i] = -1.0;
|
|
g_playerDisconnectTime[i] = -1.0;
|
|
|
|
g_playerJoinTime[i] = -1.0;
|
|
g_playerLeaveTime[i] = -1.0;
|
|
|
|
g_lastPacketFromPlayer[i] = -1.0;
|
|
g_lastPacketToPlayer[i] = -1.0;
|
|
|
|
g_playerJoins[i] = 0;
|
|
g_playerLeaves[i] = 0;
|
|
|
|
g_networkDebugLevel[i] = -1;
|
|
g_connectRate[i] = -1;
|
|
|
|
}
|
|
|
|
|
|
for (i = 0; i < Packet_History_Count; ++i)
|
|
{
|
|
g_lastPacketAddress[i] = -1;
|
|
g_lastPacketType[i] = -1;
|
|
g_lastPacketSize[i] = -1;
|
|
g_lastPacketTime[i] = -1;
|
|
g_lastPacketInbound[i] = false;
|
|
}
|
|
|
|
for (i = 0; i < Adept::Network::GosMessageStopID; ++i)
|
|
{
|
|
MessageNames[i] = "Unknown";
|
|
}
|
|
|
|
|
|
|
|
MESSAGE_NAME(Adept::Network::NetworkBoxID);
|
|
MESSAGE_NAME(Adept::Network::ConnectionBoxID);
|
|
MESSAGE_NAME(Adept::Network::ApplicationBoxID);
|
|
MESSAGE_NAME(Adept::Network::BigPacketStartBufferBoxID);
|
|
MESSAGE_NAME(Adept::Network::BigPacketPartBufferBoxID);
|
|
MESSAGE_NAME(Adept::Network::BigPacketEndBufferBoxID);
|
|
MESSAGE_NAME(Adept::Network::FullConnectionListMessageID);
|
|
MESSAGE_NAME(MechWarrior4::MWApplication::RequestConnectionMessageID);
|
|
MESSAGE_NAME(MechWarrior4::MWApplication::DenyRequestConnectionMessageID);
|
|
MESSAGE_NAME(MechWarrior4::MWApplication::AcceptConnectionMessageID);
|
|
MESSAGE_NAME(MechWarrior4::MWApplication::LoadGameMessageID);
|
|
MESSAGE_NAME(MechWarrior4::MWApplication::LoadPersitantHermitObjectsID);
|
|
MESSAGE_NAME(MechWarrior4::MWApplication::AddPlayerMessageID);
|
|
MESSAGE_NAME(MechWarrior4::MWApplication::RemovePlayerMessageID);
|
|
MESSAGE_NAME(MechWarrior4::MWApplication::RequestPlayerVehicleMessageID);
|
|
MESSAGE_NAME(MechWarrior4::MWApplication::AcceptPlayerVehicleMessageID);
|
|
MESSAGE_NAME(MechWarrior4::MWApplication::DenyPlayerVehicleMessageID);
|
|
MESSAGE_NAME(MechWarrior4::MWApplication::AddLancemateMessageID);
|
|
MESSAGE_NAME(MechWarrior4::MWApplication::ReadyToLaunchMessageID);
|
|
MESSAGE_NAME(MechWarrior4::MWApplication::ClientLoadedMessageID);
|
|
MESSAGE_NAME(MechWarrior4::MWApplication::RunGameMessageID);
|
|
MESSAGE_NAME(MechWarrior4::MWApplication::ScoreMessageID);
|
|
MESSAGE_NAME(MechWarrior4::MWApplication::RequestRespawnMessageID);
|
|
MESSAGE_NAME(MechWarrior4::MWApplication::RespawnMessageID);
|
|
MESSAGE_NAME(MechWarrior4::MWApplication::ChatMessageID);
|
|
MESSAGE_NAME(MechWarrior4::MWApplication::StopMissionMessageID);
|
|
MESSAGE_NAME(MechWarrior4::MWApplication::PlayerLeavingMessageID);
|
|
MESSAGE_NAME(MechWarrior4::MWApplication::RequestMissionParameterMessageID);
|
|
MESSAGE_NAME(MechWarrior4::MWApplication::MissionParameterMessageID);
|
|
MESSAGE_NAME(MechWarrior4::MWApplication::ScoreFormatMessageID);
|
|
MESSAGE_NAME(MechWarrior4::MWApplication::RequestMapInfoMessageID);
|
|
MESSAGE_NAME(MechWarrior4::MWApplication::MapInfoMessageID);
|
|
MESSAGE_NAME(MechWarrior4::MWApplication::SwitchToCameraMessageID);
|
|
MESSAGE_NAME(MechWarrior4::MWApplication::DecalLayoutMessageID);
|
|
MESSAGE_NAME(MechWarrior4::MWApplication::RequestDecalsMessageID);
|
|
MESSAGE_NAME(MechWarrior4::MWApplication::DecalPayLoadMessageID);
|
|
MESSAGE_NAME(MechWarrior4::MWApplication::AddTeamMessageID);
|
|
MESSAGE_NAME(MechWarrior4::MWApplication::LobbyStatusMessageID);
|
|
MESSAGE_NAME(MechWarrior4::MWApplication::RequestTeamMessageID);
|
|
MESSAGE_NAME(MechWarrior4::MWApplication::RequestPreRenderMessageID);
|
|
MESSAGE_NAME(MechWarrior4::MWApplication::PreRenderMessageID);
|
|
MESSAGE_NAME(MechWarrior4::MWApplication::MissionReviewAvailableMessageID);
|
|
MESSAGE_NAME(MechWarrior4::MWApplication::RequestMissionReviewMessageID);
|
|
MESSAGE_NAME(MechWarrior4::MWApplication::CancelMissionReviewMessageID);
|
|
MESSAGE_NAME(MechWarrior4::MWApplication::MissionReviewPartMessageID);
|
|
MESSAGE_NAME(MechWarrior4::MWApplication::RespawnFlagsMessageID);
|
|
MESSAGE_NAME(MechWarrior4::MWApplication::PlayerClanMessageID);
|
|
MESSAGE_NAME(MechWarrior4::MWApplication::RespawnLancemateMessageID);
|
|
MESSAGE_NAME(MechWarrior4::MWApplication::UnreadyLaunchMessageID);
|
|
MESSAGE_NAME(MechWarrior4::MWApplication::StopMissionConfirmationMessageID);
|
|
// team order
|
|
MESSAGE_NAME(MechWarrior4::MWApplication::TeamOrderMessageID);
|
|
MESSAGE_NAME(MechWarrior4::MWApplication::svrTeamOrderMessageID);
|
|
MESSAGE_NAME(MechWarrior4::MWApplication::RepTeamOrderMessageID);
|
|
MESSAGE_NAME(MechWarrior4::MWApplication::svrRepTeamOrderMessageID);
|
|
// team order
|
|
MESSAGE_NAME(MechWarrior4::MWEntityManager::DictionaryIndexMessageID);
|
|
MESSAGE_NAME(MechWarrior4::MWEntityManager::FirstPersonControlMessageID);
|
|
MESSAGE_NAME(MechWarrior4::MWEntityManager::FirstPersonObserverControlMessageID);
|
|
MESSAGE_NAME(MechWarrior4::MWEntityManager::FirstPersonSmallConfirmationMessageID);
|
|
MESSAGE_NAME(MechWarrior4::MWEntityManager::FirstPersonFullConfirmationMessageID);
|
|
MESSAGE_NAME(MechWarrior4::MWEntityManager::FirstPersonWeaponToMechCommandMessageID);
|
|
MESSAGE_NAME(MechWarrior4::MWEntityManager::FirstPersonWeaponToGroundCommandMessageID);
|
|
MESSAGE_NAME(MechWarrior4::MWEntityManager::FirstPersonWeaponToServerObjectCommandMessageID);
|
|
MESSAGE_NAME(MechWarrior4::MWEntityManager::FirstPersonWeaponNoTargetCommandMessageID);
|
|
MESSAGE_NAME(MechWarrior4::MWEntityManager::ThirdPersonWeaponToMechCommandMessageID);
|
|
MESSAGE_NAME(MechWarrior4::MWEntityManager::ThirdPersonWeaponToGroundCommandMessageID);
|
|
MESSAGE_NAME(MechWarrior4::MWEntityManager::ThirdPersonWeaponToServerObjectCommandMessageID);
|
|
MESSAGE_NAME(MechWarrior4::MWEntityManager::ThirdPersonWeaponNoTargetCommandMessageID);
|
|
MESSAGE_NAME(MechWarrior4::MWEntityManager::AIWeaponCommandToMechtMessageID);
|
|
MESSAGE_NAME(MechWarrior4::MWEntityManager::AIWeaponCommandToGroundtMessageID);
|
|
MESSAGE_NAME(MechWarrior4::MWEntityManager::AIWeaponCommandToServerObjectMessageID);
|
|
MESSAGE_NAME(MechWarrior4::MWEntityManager::AIWeaponCommandToNoTargetMessageID);
|
|
MESSAGE_NAME(MechWarrior4::MWEntityManager::WeaponBundleMessageID);
|
|
|
|
for (i = 0; i < MechWarrior4::MaximumPages; ++i)
|
|
{
|
|
MessageNames[MechWarrior4::MWEntityManager::DictionaryPage0MessageID+i] = "MechWarrior4::MWEntityManager::DictionaryPage";
|
|
}
|
|
m_GameInfoReady = true;
|
|
}
|
|
|
|
|
|
void MWGameInfo::InitMissionInfo (void)
|
|
{
|
|
Adept::Mission *miss;
|
|
|
|
g_MissionName[0] = 0;
|
|
g_MissionScript[0] = 0;
|
|
g_PlayerMech[0] = 0;
|
|
g_LastMWObject[0] = 0;
|
|
g_LastVehicle[0] = 0;
|
|
g_MechModel[0] = 0;
|
|
g_ResourceEntry[0] = 0;
|
|
g_ResourceFile[0] = 0;
|
|
g_LastFileOpenRequest[0] = 0;
|
|
|
|
g_LastMWObjectPos = Point3D::Identity;
|
|
g_LastVehiclePos = Point3D::Identity;
|
|
g_LastCameraPos = Point3D::Identity;
|
|
g_LastLocalPlayerPos = Point3D::Identity;
|
|
|
|
|
|
if (!Application::GetInstance()->m_localMissionParameters->m_runDedicated)
|
|
{
|
|
Adept::Player *play;
|
|
|
|
play = Player::GetInstance();
|
|
Entity *veh;
|
|
Check_Object (play);
|
|
veh = play->vehicle;
|
|
strncpy (g_PlayerMech,veh->instanceName,MAX_GAME_INFO_STR_LEN-1);
|
|
g_PlayerMech[MAX_GAME_INFO_STR_LEN-1] = 0;
|
|
|
|
const char *name;
|
|
name = veh->GetModelName ();
|
|
|
|
strncpy (g_MechModel,name,MAX_GAME_INFO_STR_LEN-1);
|
|
g_MechModel[MAX_GAME_INFO_STR_LEN-1] = 0;
|
|
}
|
|
|
|
miss = Mission::GetInstance();
|
|
Check_Object(miss);
|
|
char *loc,*loc2;
|
|
const char *name;
|
|
name = miss->GetModelName ();
|
|
Verify (name);
|
|
loc = __mbsrchr (name,'\\');
|
|
if (loc)
|
|
{
|
|
loc2 = strchr (loc,'.');
|
|
if (loc2)
|
|
{
|
|
Verify ((loc2 - loc) < MAX_GAME_INFO_STR_LEN);
|
|
strncpy (g_MissionName,loc+1,loc2 - loc-1);
|
|
g_MissionName[MAX_GAME_INFO_STR_LEN-1] = 0;
|
|
}
|
|
else
|
|
{
|
|
strncpy (g_MissionName,loc,MAX_GAME_INFO_STR_LEN);
|
|
g_MissionName[MAX_GAME_INFO_STR_LEN-1] = 0;
|
|
}
|
|
}
|
|
else
|
|
{
|
|
strncpy (g_MissionName,name,MAX_GAME_INFO_STR_LEN);
|
|
g_MissionName[MAX_GAME_INFO_STR_LEN-1] = 0;
|
|
}
|
|
|
|
if (miss->IsDerivedFrom(MWMission::DefaultData) == true)
|
|
{
|
|
MWMission* mwmission = Cast_Object(MWMission*,miss);
|
|
strncpy(g_MissionScript,mwmission->scriptName,128);
|
|
g_MissionName[127] = 0;
|
|
}
|
|
|
|
DWORD machine_name_size = MAX_GAME_INFO_STR_LEN - 1;
|
|
GetComputerName(g_MachineName,&machine_name_size);
|
|
|
|
DWORD user_name_size = MAX_GAME_INFO_STR_LEN - 1;
|
|
GetUserName((char*)&g_UserName,&user_name_size);
|
|
|
|
if (g_missionParamsString != 0)
|
|
{
|
|
delete g_missionParamsString;
|
|
g_missionParamsString = 0;
|
|
}
|
|
|
|
if (g_serverMissionParamsString != 0)
|
|
{
|
|
delete g_serverMissionParamsString;
|
|
g_serverMissionParamsString = 0;
|
|
}
|
|
|
|
if (MWApplication::GetInstance() != 0)
|
|
{
|
|
NetMissionParameters::MWNetMissionParameters* net_params = MWApplication::GetInstance()->GetLocalNetParams();
|
|
|
|
if (net_params != 0)
|
|
{
|
|
g_missionParamsString = new MString;
|
|
*g_missionParamsString = "";
|
|
|
|
NotationFile notefile;
|
|
net_params->SaveParameters(¬efile);
|
|
|
|
NotationFile::PageIterator* page_iter = notefile.MakePageIterator();
|
|
|
|
while (page_iter->GetCurrent() != 0)
|
|
{
|
|
Page* page = page_iter->GetCurrent();
|
|
|
|
Page::NoteIterator* note_iter = page->MakeNoteIterator();
|
|
|
|
while (note_iter->GetCurrent() != 0)
|
|
{
|
|
Note* note = note_iter->GetCurrent();
|
|
|
|
*g_missionParamsString += note->GetName();
|
|
*g_missionParamsString += " = ";
|
|
|
|
const char* char_ptr;
|
|
note->GetEntry(&char_ptr);
|
|
|
|
*g_missionParamsString += char_ptr;
|
|
|
|
*g_missionParamsString += "\n";
|
|
|
|
note_iter->ReadAndNext();
|
|
}
|
|
|
|
delete note_iter;
|
|
page_iter->ReadAndNext();
|
|
}
|
|
|
|
delete page_iter;
|
|
notefile.IgnoreChanges();
|
|
}
|
|
|
|
|
|
net_params = MWApplication::GetInstance()->GetServerNetParams();
|
|
|
|
if (net_params != 0)
|
|
{
|
|
g_serverMissionParamsString = new MString;
|
|
*g_serverMissionParamsString = "";
|
|
|
|
NotationFile notefile;
|
|
net_params->SaveParameters(¬efile);
|
|
|
|
NotationFile::PageIterator* page_iter = notefile.MakePageIterator();
|
|
|
|
while (page_iter->GetCurrent() != 0)
|
|
{
|
|
Page* page = page_iter->GetCurrent();
|
|
|
|
Page::NoteIterator* note_iter = page->MakeNoteIterator();
|
|
|
|
while (note_iter->GetCurrent() != 0)
|
|
{
|
|
Note* note = note_iter->GetCurrent();
|
|
|
|
*g_serverMissionParamsString += note->GetName();
|
|
*g_serverMissionParamsString += " = ";
|
|
|
|
const char* char_ptr;
|
|
note->GetEntry(&char_ptr);
|
|
|
|
*g_serverMissionParamsString += char_ptr;
|
|
|
|
*g_serverMissionParamsString += "\n";
|
|
|
|
note_iter->ReadAndNext();
|
|
}
|
|
|
|
delete note_iter;
|
|
page_iter->ReadAndNext();
|
|
}
|
|
|
|
delete page_iter;
|
|
notefile.IgnoreChanges();
|
|
}
|
|
|
|
}
|
|
|
|
g_GameStart = (Stuff::Scalar)gos_GetElapsedTime();
|
|
}
|
|
|
|
void MWGameInfo::QuitGameInfo()
|
|
{
|
|
g_GameEnd = (Stuff::Scalar)gos_GetElapsedTime();
|
|
|
|
if (g_missionParamsString != 0)
|
|
{
|
|
delete g_missionParamsString;
|
|
g_missionParamsString = 0;
|
|
}
|
|
|
|
if (g_serverMissionParamsString != 0)
|
|
{
|
|
delete g_serverMissionParamsString;
|
|
g_serverMissionParamsString = 0;
|
|
}
|
|
}
|
|
|
|
#endif
|