201 lines
6.3 KiB
C#
201 lines
6.3 KiB
C#
//HiGuy: We need to wait to execute this!
|
|
if (!$TMTimer::Execute) {
|
|
$TMTimer::Execute = true;
|
|
schedule(1000, 0, exec, $Con::File);
|
|
return;
|
|
}
|
|
|
|
//Determine mod
|
|
function getMod() {
|
|
if (isFile("marble/server/scripts/speedmeter.cs.dso"))
|
|
return "Advanced";
|
|
if (isFile("marble/client/ui/Awards/AllSapphires.png"))
|
|
return "Emerald";
|
|
if (isFile("marble/quickFix.cs"))
|
|
return "Future";
|
|
if (isFile("marble/quickFix.cs.dso"))
|
|
return "Future";
|
|
if (isFile("marble/client/ui/fullVersion.png"))
|
|
return "Gold Demo";
|
|
if (isFile("marble/client/ui/STBox.gui.dso"))
|
|
return "Opal";
|
|
if (isFile("marble/client/ui/play_rc_d.png"))
|
|
return "Platinum";
|
|
if (isFile("platinum/client/ui/play_rc_d.png"))
|
|
return "Platinum";
|
|
if (isFile("marble/client/ui/BBLoadingGui.gui.dso"))
|
|
return "Reloaded";
|
|
if (isFile("marble/data/particles/debris.png"))
|
|
return "Revived";
|
|
if (isFile("marble/client/ui/loading/loadinggui_origin.png"))
|
|
return "Space";
|
|
return "Gold";
|
|
}
|
|
|
|
//HiGuy: Jeff said I had to. :(
|
|
function getGameName() {
|
|
if ($platform $= "macos")
|
|
return "MarbleBlast";
|
|
return "Marble Blast";
|
|
// return "Murble Blust";
|
|
}
|
|
|
|
echo("Initializing TimeModifier Timer scripts in" SPC getGameName() SPC getMod());
|
|
|
|
//HiGuy: Called when we init this script
|
|
function initTMTimer() {
|
|
//HiGuy: Clean up
|
|
if (isObject(PG_TMTimer))
|
|
PG_TMTimer.delete();
|
|
|
|
//HiGuy: Create the whole Gui (unnecessary portions left out)
|
|
new GuiControl(PG_TMTimer) {
|
|
profile = "GuiDefaultProfile";
|
|
horizSizing = "center";
|
|
//HiGuy: Center it!
|
|
position = mfloor((getWord(PlayGui.getExtent(), 0) - 227) / 2) SPC "52";
|
|
extent = "237 46";
|
|
visible = "0";
|
|
|
|
new GuiBitmapCtrl(TMMin_One) {
|
|
profile = "GuiDefaultProfile";
|
|
position = "74 3";
|
|
extent = "30 38";
|
|
bitmap = $Con::Root @ "/client/ui/game/numbers/0_green.png";
|
|
};
|
|
new GuiBitmapCtrl(TMMinSec_Colon) {
|
|
profile = "GuiDefaultProfile";
|
|
position = "86 3";
|
|
extent = "30 38";
|
|
bitmap = $Con::Root @ "/client/ui/game/numbers/colon_green.png";
|
|
};
|
|
new GuiBitmapCtrl(TMSec_Ten) {
|
|
profile = "GuiDefaultProfile";
|
|
position = "98 3";
|
|
extent = "30 38";
|
|
bitmap = $Con::Root @ "/client/ui/game/numbers/0_green.png";
|
|
};
|
|
new GuiBitmapCtrl(TMSec_One) {
|
|
profile = "GuiDefaultProfile";
|
|
position = "115 3";
|
|
extent = "30 38";
|
|
bitmap = $Con::Root @ "/client/ui/game/numbers/0_green.png";
|
|
};
|
|
new GuiBitmapCtrl(TMMinSec_Point) {
|
|
profile = "GuiDefaultProfile";
|
|
position = "125 3";
|
|
extent = "30 38";
|
|
bitmap = $Con::Root @ "/client/ui/game/numbers/point_green.png";
|
|
};
|
|
new GuiBitmapCtrl(TMSec_Tenth) {
|
|
profile = "GuiDefaultProfile";
|
|
position = "137 3";
|
|
extent = "30 38";
|
|
bitmap = $Con::Root @ "/client/ui/game/numbers/0_green.png";
|
|
};
|
|
new GuiBitmapCtrl(TMSec_Hundredth) {
|
|
profile = "GuiDefaultProfile";
|
|
position = "155 3";
|
|
extent = "30 38";
|
|
bitmap = $Con::Root @ "/client/ui/game/numbers/0_green.png";
|
|
};
|
|
new GuiBitmapCtrl(TMMin_Ten) {
|
|
profile = "GuiDefaultProfile";
|
|
position = "56 3";
|
|
extent = "30 38";
|
|
bitmap = $Con::Root @ "/client/ui/game/numbers/0_green.png";
|
|
};
|
|
new GuiBitmapCtrl(TMSec_Thousandth) {
|
|
profile = "GuiDefaultProfile";
|
|
position = "172 3";
|
|
extent = "30 38";
|
|
bitmap = $Con::Root @ "/client/ui/game/numbers/0_green.png";
|
|
};
|
|
};
|
|
//HiGuy: Add it to the PlayGui
|
|
PlayGui.add(PG_TMTimer);
|
|
|
|
//HiGuy: Pretty ourselves up
|
|
if (getMod() $= "Platinum") {
|
|
new GuiBitmapCtrl(TMtransparency) {
|
|
profile = "GuiDefaultProfile";
|
|
horizSizing = "center";
|
|
position = "48 -7";
|
|
extent = "141 55";
|
|
bitmap = $Con::Root @ "/client/ui/game/transparency";
|
|
};
|
|
PG_TMTimer.add(TMtransparency);
|
|
|
|
//HiGuy: Send to back (it's strange, I know)
|
|
PG_TMTimer.bringToFront(TMtransparency);
|
|
}
|
|
|
|
//HiGuy: Updating scripts
|
|
activatePackage(TMTimer);
|
|
}
|
|
|
|
//HiGuy: OVERRIDE TIME
|
|
package TMTimer {
|
|
//HiGuy: General, all-around good functions to call from
|
|
|
|
function clientCmdGameStart() {
|
|
Parent::clientCmdGameStart();
|
|
PlayGui.updateControls();
|
|
}
|
|
function setGameState(%a, %b) {
|
|
Parent::setGameState(%a, %b);
|
|
PlayGui.updateControls();
|
|
}
|
|
function GameConnection::incBonusTime(%this, %a) {
|
|
Parent::incBonusTime(%this, %a);
|
|
PlayGui.updateControls();
|
|
}
|
|
|
|
//HiGuy: Update our things!
|
|
function PlayGui::updateControls(%this) {
|
|
Parent::updateControls(%this);
|
|
|
|
//HiGuy: Copied directly from PlayGui.cs, just changed to BonusTime
|
|
%bt = %this.bonusTime;
|
|
PG_TMTimer.setVisible(%bt);
|
|
|
|
if (%bt) {
|
|
%thousandth = mFloor(%bt % 1000);
|
|
%totalSeconds = mFloor(%bt / 1000);
|
|
%seconds = mFloor(%totalSeconds % 60);
|
|
%minutes = mFloor(%totalSeconds / 60);
|
|
|
|
%secondsOne = mFloor(%seconds % 10);
|
|
%secondsTen = mFloor(%seconds / 10);
|
|
%minutesOne = mFloor(%minutes % 10);
|
|
%minutesTen = mFloor(%minutes / 10);
|
|
%thousandthOne = mFloor(%thousandth % 10);
|
|
%thousandthTen = mFloor(%thousandth / 10) % 10;
|
|
%thousandthHundred = mFloor(%thousandth / 100);
|
|
|
|
// Update the controls
|
|
TMMin_Ten.setTimeNumber(%minutesTen);
|
|
TMMin_One.setTimeNumber(%minutesOne);
|
|
TMSec_Ten.setTimeNumber(%secondsTen);
|
|
TMSec_One.setTimeNumber(%secondsOne);
|
|
TMSec_Tenth.setTimeNumber(%thousandthHundred);
|
|
TMSec_Hundredth.setTimeNumber(%thousandthTen);
|
|
TMSec_Thousandth.setTimeNumber(%thousandthOne);
|
|
|
|
TMMinSec_Colon.setTimeNumber("colon");
|
|
TMMinSec_Point.setTimeNumber("point");
|
|
}
|
|
}
|
|
};
|
|
|
|
//HiGuy: I know MBP has this, but I don't think MBG does
|
|
function GuiBitmapCtrl::setTimeNumber(%this, %number) {
|
|
if (getMod() $= "Platinum")
|
|
%this.setBitmap($Con::Root @ "/client/ui/game/numbers/" @ %number @ $PlayTimerPrefix @ ".png");
|
|
else
|
|
%this.setBitmap($Con::Root @ "/client/ui/game/numbers/" @ %number @ ".png");
|
|
}
|
|
|
|
//HiGuy: START HER UP
|
|
initTMTimer();
|