mirror of
https://github.com/Ragora/T2-BoL.git
synced 2026-02-20 07:03:38 +00:00
Initial commit.
This commit is contained in:
commit
9a05e8d86c
652 changed files with 154587 additions and 0 deletions
99
scripts/modScripts/client/clientFunctions.cs
Normal file
99
scripts/modScripts/client/clientFunctions.cs
Normal file
|
|
@ -0,0 +1,99 @@
|
|||
//------------------------------------------------------------------------------
|
||||
// Scripts/DO_NOT_DELETE/clientFunctions.cs (OPEN SOURCE)
|
||||
// If you see this text, you have obtained the official copy of this file from
|
||||
// one of the developers. Otherwise, your decompiler is so advanced that it can
|
||||
// somehow get commented lines in a script. If this is not the case, someone has
|
||||
// betrayed my trust.
|
||||
// -- Dark Dragon DX
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
//Different from modVersionText, is used to compare our mod to the update server
|
||||
//Since TribesNext will soon allow binary transfers, this is stored here.
|
||||
$ModVersion = 1.0; //Looks better as whole numbuhs
|
||||
|
||||
//All clientCmds are secured here (so certain funcs can't simply just be disabled)
|
||||
//Although, hooks can be attached for custom actions.
|
||||
function clientCmdHandleScriptedCommand(%num,%arg1,%arg2,%arg3,%arg4)
|
||||
{
|
||||
switch(%num)
|
||||
{
|
||||
case 0: //Pop Dialog
|
||||
Canvas.popDialog(%arg1);
|
||||
case 1: //BoxYesNo
|
||||
messageBoxYesNo(%arg1,%arg2,%arg3,%arg4);
|
||||
case 2: //FadeIn
|
||||
ServerConnection.setBlackOut(true, %arg1);
|
||||
case 3: //Fadeout
|
||||
ServerConnection.setBlackOut(false, %arg1);
|
||||
case 4: //Show Cursor
|
||||
$cursorControlled = %arg1;
|
||||
lockMouse(%arg1);
|
||||
|
||||
if (%arg1)
|
||||
{
|
||||
Canvas.cursorOn();
|
||||
GlobalActionMap.bind(mouse, button0, RTS_LeftButton);
|
||||
GlobalActionMap.bind(mouse, button1, RTS_RightButton);
|
||||
RTS_Command.push();
|
||||
$RTS::ButtonPress = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
Canvas.cursorOff();
|
||||
GlobalActionMap.unbind(mouse, button0);
|
||||
GlobalActionMap.unbind(mouse, button1);
|
||||
Canvas.setCursor(DefaultCursor);
|
||||
RTS_Command.pop();
|
||||
$RTS::ButtonPress = true;
|
||||
}
|
||||
case 5: //Verify Client
|
||||
if (%arg1)
|
||||
ScoreParent.settext("PDA - PERSONAL DATA ASSISTANT");
|
||||
|
||||
$Pref::LANAccount::GUID = stripNonNumericCharacters($Pref::LANAccount::GUID); //Make sure the GUID is pure before sending. Monkee, you won't be breaking anything here. The server does the same on its side. :)
|
||||
//Let the server know we're an actual client.. and if we're offline, send my GUID
|
||||
if (!$PlayingOnline)
|
||||
commandToServer('VerifyClient',$Pref::LANAccount::GUID,$ModVersion);
|
||||
else
|
||||
commandToServer('VerifyClient',0,$ModVersion);
|
||||
|
||||
//Turn off the 'continue' button if it's T2Bol.
|
||||
if (%arg2)
|
||||
DB_ContinueBTN.setActive(0);
|
||||
case 6: //Is RTS Game
|
||||
hudClusterBack.opacity = 0; //Make it invisible
|
||||
clientCmdHandleScriptedCommand(4,true); //Show our cursor
|
||||
case 7: //Music fadeout
|
||||
alxMusicFadeout($Pref::Audio::MusicVolume);
|
||||
case 8: //Music Fadein
|
||||
alxMusicFadein(0);
|
||||
case 9: //Set client Time
|
||||
clockHud.setVisible(0);
|
||||
%pos = ClockHud.getPosition();
|
||||
%x = getWord(%pos,0);
|
||||
%y = getWord(%pos,1);
|
||||
%x = %x - -14;
|
||||
%y = %y - -4;
|
||||
if (!IsObject(timeHud))
|
||||
{
|
||||
new GuiTextCtrl(timeHud)
|
||||
{
|
||||
profile ="ClockProfile";
|
||||
position = %x SPC %y;
|
||||
extent = "41 12";
|
||||
text = %arg1 SPC "Hrs";
|
||||
horizSizing = "left";
|
||||
vertSizing = "bottom";
|
||||
};
|
||||
playGui.add(timeHud);
|
||||
}
|
||||
|
||||
timeHud.setValue(%arg1);
|
||||
timeHud.setVisible(1);
|
||||
default: //If for some reason we got an invalid command ID, report it to console
|
||||
if ($Pref::DeveloperMode) //If dev mode is on (just a value set on the clientside to tell scripts to echo shit to the console)
|
||||
error("Scripted Command Handler: Received unknown command request ("@%num@") from server.");
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
5
scripts/modScripts/client/initialize.cs
Normal file
5
scripts/modScripts/client/initialize.cs
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
//------------------------------------------------------------------------------
|
||||
// Client Scripts Init
|
||||
//==============================================================================
|
||||
exec("scripts/modScripts/client/clientFunctions.cs");
|
||||
exec("scripts/modScripts/client/serverRequestHandler.cs");
|
||||
216
scripts/modScripts/client/serverRequestHandler.cs
Normal file
216
scripts/modScripts/client/serverRequestHandler.cs
Normal file
|
|
@ -0,0 +1,216 @@
|
|||
//------------------------------------------------------------------------------
|
||||
// Server Request Handler
|
||||
//==============================================================================
|
||||
|
||||
function InteractWithObject(%val)
|
||||
{
|
||||
}
|
||||
|
||||
function IcreaseRadioFrequency(%val)
|
||||
{
|
||||
}
|
||||
|
||||
function DecreaseRadioFrequency(%val)
|
||||
{
|
||||
}
|
||||
|
||||
//These are just here.. just in case.
|
||||
function OnLANPasswordInput()
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
function OnLANNameInput()
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
function clientCmdSetScoreText(%text)
|
||||
{
|
||||
ScoreParent.settext(%text);
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
function alxMusicFadeout(%startvol)
|
||||
{
|
||||
%startvol = %startvol - 0.1;
|
||||
|
||||
if (%startvol <= 0)
|
||||
{
|
||||
alxstopmusic();
|
||||
alxsetmusicvolume($pref::audio::musicvolume);
|
||||
return;
|
||||
}
|
||||
alxsetmusicvolume(%startvol);
|
||||
schedule(500,0,"alxmusicfadeout",%startvol);
|
||||
return 1;
|
||||
}
|
||||
|
||||
function alxMusicFadein(%startvol)
|
||||
{
|
||||
%startvol = %startvol + 0.1;
|
||||
|
||||
if (%startvol > 1)
|
||||
{
|
||||
alxsetmusicvolume($pref::audio::musicvolume);
|
||||
return;
|
||||
}
|
||||
alxsetmusicvolume(%startvol);
|
||||
schedule(500,0,"alxmusicfadein",%startvol);
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
function clientCmdAlxMusicFadeout()
|
||||
{
|
||||
alxmusicfadeout($pref::audio::musicvolume);
|
||||
return 1;
|
||||
}
|
||||
|
||||
function alxSetMusicVolume(%vol)
|
||||
{
|
||||
OP_MusicVolumeSlider.setvalue(%vol);
|
||||
return %vol;
|
||||
}
|
||||
|
||||
|
||||
|
||||
function reLightMission() {
|
||||
if ($SceneLighting::lightingProgress == 0 || $SceneLighting::lightingProgress == 1)
|
||||
lightScene("",forceAlways);
|
||||
}
|
||||
|
||||
function clientCmdReLightMission() {
|
||||
if (!$pref::disallowRelight)
|
||||
reLightMission();
|
||||
}
|
||||
|
||||
// -----------------------------------------------------
|
||||
// Client Hook
|
||||
// -----------------------------------------------------
|
||||
package clientMod{
|
||||
function DispatchLaunchMode()
|
||||
{
|
||||
parent::DispatchLaunchMode();
|
||||
|
||||
// check T2 command line arguments
|
||||
for(%i = 1; %i < $Game::argc ; %i++)
|
||||
{
|
||||
%arg = $Game::argv[%i];
|
||||
%nextArg = $Game::argv[%i+1];
|
||||
%hasNextArg = $Game::argc - %i > 1;
|
||||
|
||||
if( !stricmp(%arg, "-CleanDSO")) //Remove DSO's on shutdown
|
||||
{
|
||||
$CleanDSO = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function Disconnect()
|
||||
{
|
||||
parent::Disconnect();
|
||||
|
||||
//Play the menu audio
|
||||
alxplaymusic("T2BOL/Music/Menu.mp3");
|
||||
alxMusicFadein(0);
|
||||
//Fix the score menu
|
||||
ScoreParent.settext("SCORE");
|
||||
//Enable continue
|
||||
DB_ContinueBTN.setActive(1);
|
||||
//Show other elements
|
||||
clockHud.setVisible(1);
|
||||
timeHud.setVisible(0);
|
||||
return 1;
|
||||
}
|
||||
|
||||
function OptionsDLG::OnSleep(%this)
|
||||
{
|
||||
parent::OnSleep(%this);
|
||||
|
||||
if ($pref::Audio::musicEnabled && !IsObject(ServerConnection))
|
||||
{
|
||||
alxplaymusic("T2BOL/Music/Menu.mp3");
|
||||
alxMusicFadein(0);
|
||||
}
|
||||
}
|
||||
|
||||
function GuiMLTextCtrl::onURL(%this, %url)
|
||||
{
|
||||
%url = strReplace(%url,"-","\t"); //Reading from files causes some funny issues..
|
||||
|
||||
switch$( getField(%url, 0) )
|
||||
{
|
||||
case "select":
|
||||
%cb = getField(%url, 1);
|
||||
|
||||
if(%cb $= "")
|
||||
return;
|
||||
|
||||
%i = 0;
|
||||
while((%p[%i] = getField(%url, %i + 2)) !$= "")
|
||||
%i++;
|
||||
|
||||
RPG_Category.setText(%cb); //Set the dropdown Text
|
||||
RPG_BrowserPane.refresh(); //Force a refresh
|
||||
|
||||
for (%i = 0; %i < RPG_ItemList.rowCount(); %i++)
|
||||
{
|
||||
%text = RPG_ItemList.getRowText(%i);
|
||||
|
||||
if (%text $= %p0)
|
||||
{
|
||||
RPG_ItemList.setSelectedRow(%i);
|
||||
break; //Tell the for loop to stop and continue executing
|
||||
}
|
||||
}
|
||||
//Now make our category select the correct row
|
||||
for (%i = 0; %i < RPG_Category.count; %i++)
|
||||
{
|
||||
%text = RPG_Category.getTextByID(%i);
|
||||
if (%text $= %cb)
|
||||
{
|
||||
RPG_Category.setSelected(%i);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
case "call": //Dunno if anybody will use this..
|
||||
%cb = getField(%url, 1);
|
||||
|
||||
if(%cb $= "")
|
||||
return;
|
||||
|
||||
%i = 0;
|
||||
while((%p[%i] = getField(%url, %i + 2)) !$= "")
|
||||
%i++;
|
||||
|
||||
call(%cb, %p0, %p1, %p2, %p3, %p4);
|
||||
|
||||
case "input": //Should only be used on the PDA.
|
||||
%cb = getField(%url, 1);
|
||||
|
||||
if(%cb $= "")
|
||||
return;
|
||||
|
||||
%i = 0;
|
||||
while((%p[%i] = getField(%url, %i + 2)) !$= "")
|
||||
%i++;
|
||||
|
||||
//%cb is our data type
|
||||
//%p0 is the text that shows up above the input box
|
||||
//%p1 is the text for the box itself
|
||||
InputText.setText(%p0);
|
||||
InputTransFrame.setText(%p1);
|
||||
Input.setValue("");
|
||||
canvas.pushDialog(InputDLG);
|
||||
$InputType = %cb;
|
||||
|
||||
default:
|
||||
Parent::onURL(%this, %url);
|
||||
}
|
||||
return;
|
||||
}
|
||||
};
|
||||
activatePackage(clientMod);
|
||||
Loading…
Add table
Add a link
Reference in a new issue