Skip to content

Commit

Permalink
Merge branch 'master' of https://github.com/MBU-Team/OpenMBU
Browse files Browse the repository at this point in the history
  • Loading branch information
RandomityGuy committed Mar 22, 2024
2 parents 242dd37 + 672cf32 commit 9d1e928
Show file tree
Hide file tree
Showing 6 changed files with 86 additions and 14 deletions.
Binary file added assets/graphics/fpsbg.pdn
Binary file not shown.
4 changes: 3 additions & 1 deletion game/marble/client/scripts/default.bind.cs
Original file line number Diff line number Diff line change
Expand Up @@ -446,8 +446,10 @@ function toggleFPSDisplay(%val)
setMvExtras();
if (%val)
$showFPS = !$showFPS;


HUD_FPSBG.update();
FPSDisplay.update();
PingDisplay.update();
}

//------------------------------------------------------------------------------
Expand Down
79 changes: 70 additions & 9 deletions game/marble/client/ui/RootGui.gui
Original file line number Diff line number Diff line change
Expand Up @@ -69,16 +69,41 @@ new GuiControl(RootGui) {
visible = "1";
};

new GuiTextCtrl(FPSDisplay) {
Profile = "TextTitleProfile";
horizSizing = "right";
vertSizing = "bottom";
position = "5 0";
extent = "1120 80";
new GuiBitmapCtrl(HUD_FPSBG) {
profile = "GuiDefaultProfile";
horizSizing = "right";
vertSizing = "bottom";
position = "0 -10";
extent = "200 128";
minExtent = "8 8";
text = "FPS: ";
Visible = "0";
visible = "0";
bitmap = "./fpsbg.png";
wrap = "0";
helpTag = "0";

new GuiTextCtrl(FPSDisplay) {
Profile = "TextHeadingSmallNoShadeProfile";
horizSizing = "relative";
vertSizing = "relative";
position = "40 -15";
extent = "1120 80";
minExtent = "8 8";
text = "FPS: ";
Visible = "0";
};
new GuiTextCtrl(PingDisplay) {
Profile = "TextHeadingSmallNoShadeProfile";
horizSizing = "relative";
vertSizing = "relative";
position = "40 25";
extent = "1120 80";
minExtent = "8 8";
text = "Ping: ";
Visible = "0";
};
};


};

new GuiControl(RootCenterCtrl) {
Expand Down Expand Up @@ -481,7 +506,9 @@ function RootGui::show(%this)
RootCenterCtrl.resize(%offsetX,%offsetY,%w,%h);
}

HUD_FPSBG.update();
FPSDisplay.update();
PingDisplay.update();
}

function RootGui::removeContent(%this)
Expand Down Expand Up @@ -768,6 +795,22 @@ function RootBackgroundBitmaps::setVisible(%this,%vis)
RootBackgroundOverlay.setVisible(%vis);
}

function HUD_FPSBG::update(%this)
{
// make sure periodic event is scheduled
if (!isEventPending(%this.periodicUpdate))
%this.periodicUpdate = %this.schedule(1000, update);

if ($showFPS)
{
%this.setVisible(true);
}
else
{
%this.setVisible(false);
}
}

function FPSDisplay::update(%this)
{
// make sure periodic event is scheduled
Expand All @@ -776,7 +819,7 @@ function FPSDisplay::update(%this)

if ($showFPS)
{
%text = "FPS: " @ $fps::virtual @ " Ping: " @ ServerConnection.getPing();
%text = $fps::virtual;
%this.setText(%text);
%this.setVisible(true);
}
Expand All @@ -785,3 +828,21 @@ function FPSDisplay::update(%this)
%this.setVisible(false);
}
}

function PingDisplay::update(%this)
{
// make sure periodic event is scheduled
if (!isEventPending(%this.periodicUpdate))
%this.periodicUpdate = %this.schedule(1000, update);

if ($showFPS)
{
%text = ServerConnection.getPing();
%this.setText(%text);
%this.setVisible(true);
}
else
{
%this.setVisible(false);
}
}
10 changes: 9 additions & 1 deletion game/marble/client/ui/difficultySelectGui.gui
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,13 @@ function DifficultySelectGui::onA(%this)
case 4:
GameMissionInfo.setMode(GameMissionInfo.SPMode);
$Game::SPGemHunt = true;
$Game::SPGemHuntSeeded = true;
$Game::SPGemHuntSeed = 100;
RootGui.setContent(LevelPreviewGui);
case 5:
GameMissionInfo.setMode(GameMissionInfo.SPMode);
$Game::SPGemHunt = true;
$Game::SPGemHuntSeeded = false;
RootGui.setContent(LevelPreviewGui);
}

Expand Down Expand Up @@ -75,7 +82,8 @@ function DifficultySelectGui::show(%this, %fromGui)
DifficultyMenu.addRow($Text::LevelsAdvanced, 2, 20, 2);
if (%hasCustom)
DifficultyMenu.addRow($Text::LevelsCustom, 3, 20, 2);
DifficultyMenu.addRow($Text::SPGemHunt, 4, 0, 2);
DifficultyMenu.addRow($Text::SPGemHunt SPC "(Seeded)", 4, 0, 2);
DifficultyMenu.addRow($Text::SPGemHunt SPC "(Random)", 5, 0, 2);

RootGui.setTitle($Text::DifficultyMenu);
if ($pref::UI::LegacyUI)
Expand Down
Binary file added game/marble/client/ui/fpsbg.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
7 changes: 4 additions & 3 deletions game/marble/server/scripts/game.cs
Original file line number Diff line number Diff line change
Expand Up @@ -174,12 +174,13 @@ function onMissionReset()

function initRandomSpawnPoints()
{
$Game::UseDetermSpawn = $Game::SPGemHunt && MissionInfo.gameMode $= "Scrum";
$Game::UseDetermSpawn = $Game::SPGemHunt && MissionInfo.gameMode $= "Scrum" && $Game::SPGemHuntSeeded;
$Game::DetermSpawnSeed = $Game::SPGemHuntSeed;

if ($Game::UseDetermSpawn)
{
$Game::SpawnRandFunction = getDetermRandom;
setDetermRandomSeed(100);
setDetermRandomSeed($Game::DetermSpawnSeed);
}
else
{
Expand All @@ -189,7 +190,7 @@ function initRandomSpawnPoints()
if ($Game::UseDetermSpawn)
{
$Game::PlayerSpawnRandFunction = getDetermRandom2;
setDetermRandom2Seed(100);
setDetermRandom2Seed($Game::DetermSpawnSeed);
}
else
{
Expand Down

0 comments on commit 9d1e928

Please sign in to comment.