Skip to content

Commit

Permalink
Send level name over network instead of relying on level numbering be…
Browse files Browse the repository at this point in the history
…ing the same for everyone
  • Loading branch information
HumanGamer committed Mar 26, 2024
1 parent 24fb302 commit a79465e
Show file tree
Hide file tree
Showing 6 changed files with 22 additions and 1 deletion.
2 changes: 2 additions & 0 deletions game/common/server/clientConnection.cs
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,8 @@ function updateServerParams()
%message = %message @ serverGetPrivateSlotsFree() @ "\n"; // private slots avail
%message = %message @ serverGetPrivateSlotsUsed() @ "\n"; // private slots used
%message = %message @ (!isPCBuild() && XBLiveIsRanked()) @ "\n"; // ranked?
%message = %message @ $Server::MissionGuid @ "\n"; // mission guid
%message = %message @ $Server::MissionName @ "\n"; // mission name

// update the server parameters on all clients
messageAll('MsgClientSetServerParams', "", %message);
Expand Down
2 changes: 2 additions & 0 deletions game/common/server/missionLoad.cs
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,8 @@ function loadMissionStage2()
// populate id variables for the mission we loaded
$Server::MissionId = MissionInfo.level;
$Server::GameModeId = GameMissionInfo.getGameModeIdFromString(MissionInfo.gameMode);
$Server::MissionGuid = MissionInfo.guid;
$Server::MissionName = GameMissionInfo.getMissionDisplayNameByGuid(MissionInfo.guid);

// Mission cleanup group
new SimGroup( MissionCleanup );
Expand Down
2 changes: 2 additions & 0 deletions game/marble/client/scripts/playerList.cs
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,8 @@ function handleClientSetServerParams(%msgType, %msgString, %message)
ServerConnection.priSlotsFree = getRecord(%message, 7);
ServerConnection.priSlotsUsed = getRecord(%message, 8);
ServerConnection.isRanked = getRecord(%message, 9);
ServerConnection.guid = getRecord(%message, 10);
ServerConnection.missionName = getRecord(%message, 11);

// set flag indicating that server params are present
ServerConnection.hasParams = true;
Expand Down
2 changes: 2 additions & 0 deletions game/marble/client/ui/createGameGui.gui
Original file line number Diff line number Diff line change
Expand Up @@ -359,6 +359,8 @@ function CreateGameGui::createGame(%this)
$Server::MissionId = GameMissionInfo.getCurrentMission().level;
$Server::GameModeId = GameMissionInfo.getGameModeIdFromString(GameMissionInfo.getCurrentMission().gameMode);
$Server::MissionFile = GameMissionInfo.getCurrentMission().file;
$Server::MissionGuid = GameMissionInfo.getCurrentMission().guid;
$Server::MissionName = GameMissionInfo.getMissionDisplayNameByGuid(GameMissionInfo.getCurrentMission().guid);

$pref::Server::missionId = $Server::MissionId;
onMissionLoaded();
Expand Down
6 changes: 5 additions & 1 deletion game/marble/client/ui/lobbyGui.gui
Original file line number Diff line number Diff line change
Expand Up @@ -704,7 +704,7 @@ function LobbyGui::updateHostInfo(%this)

// set host info
%gameMode = GameMissionInfo.getGameModeDisplayName(ServerConnection.gameModeId);
%missionName = GameMissionInfo.getMissionDisplayName(ServerConnection.missionId);
%missionName = ServerConnection.missionName; //GameMissionInfo.getMissionDisplayName(ServerConnection.missionId);

%sanitizedText = ServerConnection.hostName;
if ($pref::Lobby::StreamerMode)
Expand Down Expand Up @@ -918,6 +918,8 @@ function LobbyGui::onLeft(%this)
$Server::MissionId = GameMissionInfo.getCurrentMission().level;
$Server::GameModeId = GameMissionInfo.getGameModeIdFromString(GameMissionInfo.getCurrentMission().gameMode);
$Server::MissionFile = GameMissionInfo.getCurrentMission().file;
$Server::MissionGuid = GameMissionInfo.getCurrentMission().guid;
$Server::MissionName = GameMissionInfo.getMissionDisplayNameByGuid(GameMissionInfo.getCurrentMission().guid);

onMissionLoaded();

Expand Down Expand Up @@ -946,6 +948,8 @@ function LobbyGui::onRight(%this)
$Server::MissionId = GameMissionInfo.getCurrentMission().level;
$Server::GameModeId = GameMissionInfo.getGameModeIdFromString(GameMissionInfo.getCurrentMission().gameMode);
$Server::MissionFile = GameMissionInfo.getCurrentMission().file;
$Server::MissionGuid = GameMissionInfo.getCurrentMission().guid;
$Server::MissionName = GameMissionInfo.getMissionDisplayNameByGuid(GameMissionInfo.getCurrentMission().guid);

onMissionLoaded();

Expand Down
9 changes: 9 additions & 0 deletions game/marble/data/gameMissionInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -671,6 +671,15 @@ function initLBText()
return getMissionNameFromNameVar(%mission);
}

function GameMissionInfo::getMissionDisplayNameByGuid(%this, %guid)
{
%mission = %this.findMissionByGuid(%guid);
if (!isObject(%mission))
return "";
else
return getMissionNameFromNameVar(%mission);
}

function getMissionNameFromNameVar(%mission)
{
%name = %mission.name;
Expand Down

0 comments on commit a79465e

Please sign in to comment.