mirror of
https://github.com/Ragora/TribesReplay.git
synced 2026-01-20 01:54:47 +00:00
- (optimization) Damage Decal toggle applies to ALL damage decals now. This improves performance on video cards with lower VRAM. Those cards should turn this feature OFF for best gameplay. - (optimization) Dynamic lighting now fades with distance so that systems do less calculations on lights that make little or no difference anyway. - (optimization) The following missions were edited/revised in order to achieve much higher framerates in-game. They are: Death Birds Fly Dust to Dust Recalascence Reversion Riverdance - (optimization) There is now a PARTICLE DENSITY slider on the GRAPHICS menu that allows you to turn down the number of particles used in explosions and weapon effects. Systems with low VRAM should turn this down as low as possible. The effects will still look good, but will use many less polygons and alpha translucencies. - (optimization) The force shield effect on players and objects has been greatly simplified. The old effect was hammering the frame rates on older video cards when played. This new effect greatly speeds gameplay on all cards, and particularly on Voodoo cards. - (memory leak) Memory leaks were located and eradicated. This most likely was the cause of the "degradation over time" that folks were experiencing on their servers. - (bug fix) "Vote Spamming" has been prevented in-game. - (bug fix) Moved some of the CD check from script into code, where it should be. - (bug fix) The "sticking" mouse button problem is now fixed. - (bug fix) Deployables are now easier to place on walls and other surfaces. There were some inconsistencies on which surfaces could be placed upon and those are now resolved. - (bug fix) There was a bug that prevented users from deleting some Server Filters. That is resolved now. - (bug fix) There was a Siege bug where a base item (like a turret) could be destroyed, and then repaired, but it would no longer receive power after being repaired. That is now fixed. The items will receive power correctly after being repaired. - (bug fix) Resolved the Team Damage OFF situation where friendly troops could destroy permanent "base" objects. - (bug fix) Removed a packet overrun in the net code that *could* have allowed hackers to bring down servers. This had not occurred to date and is now prevented. - (bug fix) Deployable inventory stations can no longer be deployed directly next to each other. They must be at least 20 meters apart in order to be deployed properly. - (bug fix) Ejection speed increased slightly to more easily accomodate jumping out of moving vehicles. - (bug fix) Many team damage fixes occurred. When Team Damage is OFF the following are now true: Friendly teammates are no longer prevented from destroying deployables. The ELF will no longer drain energy from friendly players. If a friendly player blinds another friendly player with Whiteout grenades, then a message is displayed in the Chat HUD so that the blinded person knows who did it. (There are more Team Damage changes coming in the next patch.) - (bug fix) Medium now has a standard loadout of 12 grenades in the grenade launcher instead of 10. Light: 10; Medium: 12; Heavy: 15. - (bug fix) Deployable pulse sensors now have a range of 150m instead of 120m to make them a more attractive option to deploy. - (bug fix) Fixed an indoor turret proximity bug introduced in the last patch. - (improvement) Flag captures are now worth 100 points (for the team), instead of 1 point. Additionally, each time someone grabs the flag *from the enemy flag stand* they will gain 1 point (for the team), regardless of whether they actually capture it or not. You will ONLY get this single point if the flag was actually on the flagstand. You will NOT get the point by touching the flag anywhere else on the field. This change will help prevent tie situations and will reward aggressive offensive play. NOTE: The "touch" point can only be gained once every 20 seconds...so a "scrum" around the flag base will not result in a large group of points being gained. - (improvement) Siege: Alcatraz. The generators have been moved around a bit. There are two entrances to that base. One is the "front door" and the other is the "back door". (The back door is the one that has a team-pass-only force field blocking enemies from the switch room.) There is now an upper generator down the chute from the "front door" that powers the "back door" force field. Additionally, there is a solar panel outside that powers the base turrets and sentry turrets. None of these generators have to be destroyed to get to the switch, but their destruction makes it MUCH easier to do so. There are four generators total on this map (all are waypointed now), and the destruction of all four is necessary before the base power will go down. - (improvement) Siege: Caldera. The generator has been moved out of the switch room and into the very big main room that has the inventory stations in it. It is no longer necessary to destroy the generators in a particular sequence. Destroying the two main generators (Primary and Secondary) will drop the force field that protects the switch. Both gens must be down in order for the switch force field to drop. - (improvement) Added "quickbuy" keyboard shortcuts to use at vehicle station. (Default keys are the 1-6 number keys. 1 is the top vehicle on the list, 6 is the bottom vehicle on the list). NOTE: These key bindings are not currently editable. However, since you are on the vehicle purchase pad when they are in effect, they cannot interfere with any custom keys you've created, so you should have no problems. - (improvement) Team Damage ON/OFF can be changed by Admins/SuperAdmins as well as being voted on by players. If you are an Admin or SuperAdmin, then just go to Lobby and look up where the "Vote" options are listed. There are options there to toggle the Team Damage flag. Regular players can also Vote to Enable/Disable Team Damage in the same spot. - (improvement) Default server prefs have been changed so that the default time limit is now 30 minutes (instead of 20) and Team Damage is OFF. - (improvement) Fixed buddy filter. You can now use the Filter option on the JOIN screen to find games that have players in them that are listed on your buddy list. (Use the Email or Warrior Browser functions to add/remove people from your buddy list.) NOTE: We feel that there is an issue that may be related to NAT (Network Address Translation). Sierra QA uses public IP addresses on it's internal network that are not routable on the Internet. They experience a problem that occurs when anyone inside their firewall uses the Internet for anything, their internal address is "changed" to a legal external address. In their case, they use "many to one" NAT, so everyone appears to be the same address outside our walls. This issue prevents Sierra QA from seeing "buddies" that are on systems *inside* their firewall (they can see "buddies" on external servers just fine). We are hypothesizing that it is NAT that is causing the buddy list lookup to fail internally. We are continuing to work on this. ALSO NOTE: This feature works correctly for everyone else. - (improvement) You can now add a player to your server admin lists (so that server admins can auto-admin players when they join a server, if desired). How this is done: If you are a SuperAdmin (owner of the server), you can go into the lobby and right-click on a player's name. You will then have the ability to add them to your Admin or SuperAdmin lists. - (improvement) Master Server list no longer insists on keeping your current game highlighted while refreshing a query. This allows you to page up and down more easily on the list while it is refreshing. - (improvement) Added "Team Damage ON/OFF" and "Windows/Linux" as options for creating new Server Filters. - (improvement) Missile reticle is improved aesthetically. This is part 1 of 2 of the missile reticle changes. The second part will be in the next patch. - (community) Made changes to Tribe Forums to make posting new topics work better with the current cache architecture. - (community) Fixed buttons on Tribe/Warrior Browser to reflect visitors membership in tribe - (community) Changed NEWS button on Tribe page to OPTIONS, added links to Tribe Forum, Tribe Public Chat and Tribe Private Chat. - (community) Added "EMail" and "Add To Buddylist" options into the right click menu in the Chat Channel member list. - (community) Changed layout of right click menu's in the Community for easier understandability. - (community) Added Moderator functions to the T2 Community - allows post removal, ability to send warnings and execute ban's to the perp. - (community) Added confirmation box to the News page on Submit News - explains purpose and requires yes/no. - (community) Upgraded Forum Cache version - (community) Added ability to Lock Topic for Moderators - (community) Added locking for posts where Topic is already in cache. - (community) Implemented a ban structure on the Database - (community) Fixed DBProxy thread disconnections - removed blank error boxes. - (community) Fixed bug in Blocking Email Senders
1611 lines
51 KiB
C#
1611 lines
51 KiB
C#
//------------------------------------------------------------------------------
|
|
//
|
|
// GameGui.cs
|
|
//
|
|
//------------------------------------------------------------------------------
|
|
|
|
//------------------------------------------------------------------------------
|
|
function LaunchGame( %pane )
|
|
{
|
|
if ( %pane !$= "" )
|
|
GameGui.pane = %pane;
|
|
|
|
LaunchTabView.viewTab( "GAME", GameGui, 0 );
|
|
}
|
|
|
|
//------------------------------------------------------------------------------
|
|
function GameGui::onWake( %this )
|
|
{
|
|
Canvas.pushDialog( LaunchToolbarDlg );
|
|
|
|
GM_Frame.setTitle( $PlayingOnline ? "GAME" : "LAN GAME" );
|
|
|
|
// This is essentially an "isInitialized" flag...
|
|
if ( GM_TabView.tabCount() == 0 )
|
|
{
|
|
GM_TabView.addTab( 1, "JOIN" );
|
|
GM_TabView.addTab( 2, "HOST" );
|
|
GM_TabView.addTab( 3, "WARRIOR SETUP", 1 );
|
|
|
|
queryMasterGameTypes();
|
|
}
|
|
|
|
switch$ ( %this.pane )
|
|
{
|
|
case "Join":
|
|
GM_TabView.setSelected( 1 );
|
|
case "Host":
|
|
GM_TabView.setSelected( 2 );
|
|
default: // "Warrior"
|
|
GM_TabView.setSelected( 3 );
|
|
}
|
|
}
|
|
|
|
//------------------------------------------------------------------------------
|
|
function GameGui::onSleep( %this )
|
|
{
|
|
%ctrl = "GM_" @ %this.pane @ "Pane";
|
|
if ( isObject( %ctrl ) )
|
|
%ctrl.onDeactivate();
|
|
|
|
// if( isObject( $dummySeq ) )
|
|
// {
|
|
// $dummySeq.delete();
|
|
// }
|
|
|
|
Canvas.popDialog(LaunchToolbarDlg);
|
|
}
|
|
|
|
//------------------------------------------------------------------------------
|
|
function GameGui::setKey( %this, %key )
|
|
{
|
|
// To avoid console error
|
|
}
|
|
|
|
//------------------------------------------------------------------------------
|
|
function GameGui::onClose( %this, %key )
|
|
{
|
|
// To avoid console error
|
|
}
|
|
|
|
//------------------------------------------------------------------------------
|
|
function GM_TabView::onAdd( %this )
|
|
{
|
|
%this.addSet( 1, "gui/shll_horztabbuttonB", "5 5 5", "50 50 0", "5 5 5" );
|
|
}
|
|
|
|
//------------------------------------------------------------------------------
|
|
function GM_TabView::onSelect( %this, %id, %text )
|
|
{
|
|
GM_JoinPane.setVisible( %id == 1 );
|
|
GM_HostPane.setVisible( %id == 2 );
|
|
GM_WarriorPane.setVisible( %id == 3 );
|
|
GM_TabFrame.setAltColor( %this.getTabSet( %id ) != 0 );
|
|
|
|
%ctrl = "GM_" @ GameGui.pane @ "Pane";
|
|
if ( isObject( %ctrl ) )
|
|
%ctrl.onDeactivate();
|
|
|
|
switch ( %id )
|
|
{
|
|
case 1: // Join
|
|
GM_JoinPane.onActivate();
|
|
case 2: // Host
|
|
GM_HostPane.onActivate();
|
|
case 3: // Warrior Setup
|
|
GM_WarriorPane.onActivate();
|
|
}
|
|
}
|
|
|
|
//------------------------------------------------------------------------------
|
|
// Join Game pane:
|
|
//------------------------------------------------------------------------------
|
|
function GM_JoinPane::onActivate( %this )
|
|
{
|
|
GameGui.pane = "Join";
|
|
|
|
if ( %this.onceOnly $= "" )
|
|
{
|
|
GM_VersionText.setText( "Version" SPC getT2VersionNumber() );
|
|
GMJ_StopBtn.setActive( false );
|
|
|
|
%this.onceOnly = 1;
|
|
GMJ_Browser.lastQuery = $PlayingOnline ? "Master" : "LanServers";
|
|
GMJ_Browser.runQuery();
|
|
}
|
|
|
|
GM_VersionText.setVisible( true );
|
|
|
|
// Use Server Info prefs:
|
|
SI_Window.resize( firstWord( $pref::ServerBrowser::InfoWindowPos ),
|
|
getWord( $pref::ServerBrowser::InfoWindowPos, 1 ),
|
|
firstWord( $pref::ServerBrowser::InfoWindowExtent ),
|
|
getWord( $pref::ServerBrowser::InfoWindowExtent, 1 ) );
|
|
|
|
if ( $pref::ServerBrowser::InfoWindowOpen )
|
|
Canvas.pushDialog( ServerInfoDlg );
|
|
}
|
|
|
|
//------------------------------------------------------------------------------
|
|
function GM_JoinPane::onDeactivate( %this )
|
|
{
|
|
GM_VersionText.setVisible( false );
|
|
|
|
// Save off the Server Info Window prefs:
|
|
$pref::ServerBrowser::InfoWindowOpen = GMJ_Browser.infoWindowOpen;
|
|
$pref::ServerBrowser::InfoWindowPos = SI_Window.getPosition();
|
|
$pref::ServerBrowser::InfoWindowExtent = SI_Window.getExtent();
|
|
$pref::ServerBrowser::InfoWindowBarPos = getWord( SI_InfoScroll.getExtent(), 1 );
|
|
|
|
if ( GMJ_Browser.infoWindowOpen )
|
|
Canvas.popDialog( ServerInfoDlg );
|
|
}
|
|
|
|
//------------------------------------------------------------------------------
|
|
$BrowserColumnCount = 0;
|
|
$BrowserColumnName[0] = "Server Name";
|
|
$BrowserColumnRange[0] = "25 300";
|
|
$BrowserColumnCount++;
|
|
$BrowserColumnName[1] = "Status";
|
|
$BrowserColumnRange[1] = "25 75";
|
|
$BrowserColumnCount++;
|
|
$BrowserColumnName[2] = "Favorite";
|
|
$BrowserColumnRange[2] = "25 75";
|
|
$BrowserColumnCount++;
|
|
$BrowserColumnName[3] = "Ping";
|
|
$BrowserColumnRange[3] = "25 120";
|
|
$BrowserColumnCount++;
|
|
$BrowserColumnName[4] = "Game Type";
|
|
$BrowserColumnRange[4] = "25 200";
|
|
$BrowserColumnCount++;
|
|
$BrowserColumnName[5] = "Mission Name";
|
|
$BrowserColumnRange[5] = "25 300";
|
|
$BrowserColumnCount++;
|
|
$BrowserColumnName[6] = "Rules Set";
|
|
$BrowserColumnRange[6] = "25 300";
|
|
$BrowserColumnCount++;
|
|
$BrowserColumnName[7] = "# Players (Bots)";
|
|
$BrowserColumnRange[7] = "25 150";
|
|
$BrowserColumnCount++;
|
|
$BrowserColumnName[8] = "CPU";
|
|
$BrowserColumnRange[8] = "25 120";
|
|
$BrowserColumnCount++;
|
|
$BrowserColumnName[9] = "IP Address";
|
|
$BrowserColumnRange[9] = "25 200";
|
|
$BrowserColumnCount++;
|
|
$BrowserColumnName[10] = "Version";
|
|
$BrowserColumnRange[10] = "25 200";
|
|
$BrowserColumnCount++;
|
|
|
|
//------------------------------------------------------------------------------
|
|
function GMJ_Browser::onAdd( %this )
|
|
{
|
|
// Add the Server Browser columns based on the prefs:
|
|
for ( %i = 0; %i < $BrowserColumnCount; %i++ )
|
|
{
|
|
%key = firstWord( $pref::ServerBrowser::Column[%i] );
|
|
%width = getWord( $pref::ServerBrowser::Column[%i], 1 );
|
|
%this.addColumn( %key, $BrowserColumnName[%key], %width, firstWord( $BrowserColumnRange[%key] ), getWord( $BrowserColumnRange[%key], 1 ) );
|
|
}
|
|
%this.setSortColumn( $pref::ServerBrowser::SortColumnKey );
|
|
%this.setSortIncreasing( $pref::ServerBrowser::SortInc );
|
|
}
|
|
|
|
//------------------------------------------------------------------------------
|
|
function updateServerBrowser()
|
|
{
|
|
GMJ_Browser.sort();
|
|
if ( GMJ_Browser.infoWindowOpen )
|
|
ServerInfoDlg.update();
|
|
}
|
|
|
|
//------------------------------------------------------------------------------
|
|
function updateServerBrowserStatus( %text, %percentage )
|
|
{
|
|
GMJ_StatusText.setValue( %text );
|
|
if ( %percentage >= 0 && %percentage <= 1 )
|
|
{
|
|
GMJ_ProgressBar.setValue( %percentage );
|
|
if ( %percentage == 0 ) // Query is over.
|
|
GMJ_StopBtn.setActive( false );
|
|
}
|
|
}
|
|
|
|
//------------------------------------------------------------------------------
|
|
function GMJ_Browser::runQuery( %this )
|
|
{
|
|
GMJ_ProgressBar.setValue( 0 );
|
|
$JoinGameAddress = "";
|
|
GMJ_JoinBtn.setActive( false );
|
|
GMJ_RefreshServerBtn.setActive( false );
|
|
%this.clearList();
|
|
|
|
// Clear the Server Info dialog:
|
|
SI_InfoWindow.setText( "No server selected." );
|
|
SI_ContentWindow.setText( "" );
|
|
|
|
if ( %this.lastQuery $= "LanServers" )
|
|
{
|
|
GMJ_StatusText.setValue( "Querying LAN servers..." );
|
|
GMJ_FilterBtn.setActive( false );
|
|
GMJ_FilterBtn.setVisible( false );
|
|
GMJ_FilterText.setText( "LAN Servers" );
|
|
queryLanServers( $JoinGamePort );
|
|
GMJ_StopBtn.setActive( true );
|
|
}
|
|
else
|
|
{
|
|
GMJ_FilterBtn.setActive( true );
|
|
GMJ_FilterBtn.setVisible( true );
|
|
|
|
if ( $pref::ServerBrowser::activeFilter == 0 )
|
|
{
|
|
GMJ_StatusText.setValue( "Querying the master server..." );
|
|
GMJ_FilterText.setText( "All servers" );
|
|
queryMasterServer( $JoinGamePort );
|
|
GMJ_StopBtn.setActive( true );
|
|
}
|
|
else if ( $pref::ServerBrowser::activeFilter == 1 )
|
|
{
|
|
// Buddy list query:
|
|
GMJ_StatusText.setValue( "Fetching buddy list..." );
|
|
GMJ_FilterText.setText( "Buddies" );
|
|
%this.key = LaunchGui.key++;
|
|
DatabaseQueryArray( 5, 0, "", %this, %this.key );
|
|
}
|
|
else if ( $pref::ServerBrowser::activeFilter == 2 )
|
|
{
|
|
// Favorites only:
|
|
GMJ_FilterText.setText( "Favorites" );
|
|
if ( $pref::ServerBrowser::FavoriteCount <= 0 || $pref::ServerBrowser::Favorite[0] $= "" )
|
|
{
|
|
GMJ_StatusText.setValue( "No favorites found." );
|
|
MessageBoxOK( "INVALID FILTER", "You haven't marked any servers as favorites. Click the Favorites column to mark a server as a favorite." );
|
|
}
|
|
else
|
|
{
|
|
GMJ_StatusText.setValue( "Querying favorites..." );
|
|
queryFavoriteServers();
|
|
GMJ_StopBtn.setActive( true );
|
|
}
|
|
}
|
|
else
|
|
{
|
|
GMJ_StatusText.setValue( "Querying the master server..." );
|
|
%filterIndex = $pref::ServerBrowser::activeFilter - 3;
|
|
if ( $pref::ServerBrowser::Filter[%filterIndex] !$= "" )
|
|
{
|
|
%filter = $pref::ServerBrowser::Filter[%filterIndex];
|
|
GMJ_FilterText.setText( getField( %filter, 0 ) );
|
|
%rulesSet = getField( %filter, 1 );
|
|
if ( %rulesSet $= "" )
|
|
%rulesSet = "any";
|
|
%missionType = getField( %filter, 2 );
|
|
if ( %missionType $= "" )
|
|
%missionType = "any";
|
|
%maxPlayers = getField( %filter, 4 );
|
|
if ( %maxPlayers $= "" )
|
|
%maxPlayers = 255;
|
|
%maxBots = getField( %filter, 7 );
|
|
if ( %maxBots $= "" )
|
|
%maxBots = 16;
|
|
%regionMask = getField( %filter, 5 );
|
|
if ( %regionMask $= "" )
|
|
%regionMask = 4294967295;
|
|
|
|
queryMasterServer(
|
|
$JoinGamePort,
|
|
0, // Flags
|
|
%rulesSet, // Rules Set
|
|
%missionType, // Mission Type
|
|
getField( %filter, 3 ), // Min Players
|
|
%maxPlayers, // Max Players
|
|
%maxBots, // Max Bots
|
|
%regionMask, // Region Mask
|
|
getField( %filter, 6 ), // Max Ping
|
|
getField( %filter, 8 ), // Min CPU Speed
|
|
getField( %filter, 9 ) ); // Filter flags
|
|
GMJ_StopBtn.setActive( true );
|
|
}
|
|
else
|
|
{
|
|
// Filter is invalid, so fall back to the default:
|
|
$pref::ServerBrowser::activeFilter = 0;
|
|
GMJ_FilterText.setText( "All servers" );
|
|
queryMasterServer( $JoinGamePort );
|
|
GMJ_StopBtn.setActive( true );
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
//------------------------------------------------------------------------------
|
|
function GMJ_Browser::onDatabaseQueryResult( %this, %status, %resultString, %key )
|
|
{
|
|
if ( %this.key != %key )
|
|
return;
|
|
|
|
if ( getField( %resultString, 0 ) <= 0 )
|
|
{
|
|
GMJ_StatusText.setValue( "No buddies found." );
|
|
MessageBoxOK( "INVALID FILTER", "You have no buddies in your buddy list!" );
|
|
}
|
|
else // Prepare for the incoming buddy list:
|
|
%this.buddyList = "";
|
|
}
|
|
|
|
//------------------------------------------------------------------------------
|
|
function GMJ_Browser::onDatabaseRow( %this, %row, %isLastRow, %key )
|
|
{
|
|
if ( %this.key != %key )
|
|
return;
|
|
|
|
%buddyName = getField( %row, 0 );
|
|
%buddyGuid = getField( %row, 3 );
|
|
echo( "Got buddy: \c9\"" @ %buddyName @ "\": " @ %buddyGuid );
|
|
%this.buddyList = %this.buddyList $= "" ? %buddyGuid : %this.buddyList TAB %buddyGuid;
|
|
|
|
if ( %isLastRow )
|
|
{
|
|
GMJ_StatusText.setValue( "Querying the master server..." );
|
|
queryMasterServer(
|
|
$JoinGamePort, // Port
|
|
0, // Flags
|
|
"Any", // Rules Set
|
|
"Any", // Mission Type
|
|
0, // Min Players
|
|
255, // Max Players
|
|
16, // Max Bots
|
|
0xFFFFFFFF, // Region Mask
|
|
0, // Max Ping
|
|
0, // Min CPU Speed
|
|
0, // Filter flags
|
|
%this.buddyList );
|
|
GMJ_StopBtn.setActive( true );
|
|
%this.buddyList = "";
|
|
}
|
|
}
|
|
|
|
//------------------------------------------------------------------------------
|
|
function GMJ_Browser::onSelect( %this, %address )
|
|
{
|
|
GMJ_JoinBtn.setActive( true );
|
|
if ( !isServerQueryActive() )
|
|
GMJ_RefreshServerBtn.setActive( true );
|
|
$JoinGamePassword = "";
|
|
$JoinGameAddress = %address;
|
|
|
|
if ( %this.infoWindowOpen )
|
|
ServerInfoDlg.update();
|
|
}
|
|
|
|
//------------------------------------------------------------------------------
|
|
function GMJ_Browser::refreshSelectedServer( %this )
|
|
{
|
|
querySingleServer( $JoinGameAddress );
|
|
if ( %this.infoWindowOpen )
|
|
ServerInfoDlg.update();
|
|
}
|
|
|
|
//------------------------------------------------------------------------------
|
|
function GMJ_Browser::onSetSortKey( %this, %sortKey, %isIncreasing )
|
|
{
|
|
$pref::ServerBrowser::SortColumnKey = %sortKey;
|
|
$pref::ServerBrowser::SortInc = %isIncreasing;
|
|
}
|
|
|
|
//------------------------------------------------------------------------------
|
|
function GMJ_Browser::onColumnResize( %this, %column, %newSize, %key )
|
|
{
|
|
$pref::ServerBrowser::Column[%column] = %key SPC %newSize;
|
|
}
|
|
|
|
//------------------------------------------------------------------------------
|
|
function GMJ_Browser::onColumnRepositioned( %this, %oldColumn, %newColumn )
|
|
{
|
|
// Puke em all...
|
|
%count = %this.getNumColumns();
|
|
for ( %col = 0; %col < %count; %col++ )
|
|
$pref::ServerBrowser::Column[%col] = %this.getColumnKey( %col ) SPC %this.getColumnWidth( %col );
|
|
}
|
|
|
|
//------------------------------------------------------------------------------
|
|
function GMJ_Browser::addFavorite( %this, %name, %address )
|
|
{
|
|
//error( "** addFavorite( \"" @ %name @ "\", " @ %address @ " ) **" );
|
|
$pref::ServerBrowser::Favorite[$pref::ServerBrowser::FavoriteCount] = %name TAB %address;
|
|
$pref::ServerBrowser::FavoriteCount++;
|
|
}
|
|
|
|
//------------------------------------------------------------------------------
|
|
function GMJ_Browser::removeFavorite( %this, %address )
|
|
{
|
|
//error( "** removeFavorite( " @ %address @ " ) **" );
|
|
%foundIt = false;
|
|
for ( %i = 0; %i < $pref::ServerBrowser::FavoriteCount; %i++ )
|
|
{
|
|
if ( !%foundIt )
|
|
{
|
|
if ( getField( $pref::ServerBrowser::Favorite[%i], 1 ) $= %address )
|
|
%foundIt = true;
|
|
}
|
|
|
|
if ( %foundIt )
|
|
$pref::ServerBrowser::Favorite[%i] = $pref::ServerBrowser::Favorite[%i + 1];
|
|
}
|
|
|
|
if ( %foundIt )
|
|
$pref::ServerBrowser::FavoriteCount--;
|
|
}
|
|
|
|
//------------------------------------------------------------------------------
|
|
function ServerInfoDlg::onAdd( %this )
|
|
{
|
|
%this.headerStyle = "<font:" @ $ShellLabelFont @ ":" @ $ShellFontSize @ "><color:00DC00>";
|
|
}
|
|
|
|
//------------------------------------------------------------------------------
|
|
function ServerInfoDlg::onWake( %this )
|
|
{
|
|
GMJ_Browser.infoWindowOpen = true;
|
|
GMJ_InfoBtn.setActive( false );
|
|
SI_RefreshBtn.setActive( false );
|
|
%this.update();
|
|
}
|
|
|
|
//------------------------------------------------------------------------------
|
|
function ServerInfoDlg::update( %this )
|
|
{
|
|
%status = GMJ_Browser.getServerStatus();
|
|
if ( %status $= "invalid" )
|
|
{
|
|
SI_InfoWindow.setText( "No server selected." );
|
|
return;
|
|
}
|
|
|
|
%info = GMJ_Browser.getServerInfoString();
|
|
%infoText = "<tab:70><spush>" @ %this.headerStyle @ "NAME:<spop><lmargin:70>" TAB getRecord( %info, 0 )
|
|
NL "<lmargin:0><spush>" @ %this.headerStyle @ "ADDRESS:<spop><lmargin:70>" TAB getRecord( %info, 1 ) @ "<lmargin:0>";
|
|
|
|
%refreshable = false;
|
|
if ( %status $= "responded" )
|
|
{
|
|
%temp = getRecord( %info, 2 );
|
|
if ( %temp !$= "" )
|
|
%infoText = %infoText NL "<spush>" @ %this.headerStyle @ "RULES SET:<spop><lmargin:70>" TAB %temp @ "<lmargin:0>";
|
|
%temp = getRecord( %info, 3 );
|
|
if ( %temp $= "" )
|
|
%temp = "None";
|
|
%infoText = %infoText NL "<spush>" @ %this.headerStyle @ "FLAGS:<spop><lmargin:70>" TAB %temp @ "<lmargin:0>";
|
|
%temp = getRecord( %info, 4 );
|
|
if ( %temp !$= "" )
|
|
%infoText = %infoText NL "<spush>" @ %this.headerStyle @ "GAME TYPE:<spop><lmargin:70>" TAB %temp @ "<lmargin:0>";
|
|
%temp = getRecord( %info, 5 );
|
|
if ( %temp !$= "" )
|
|
%infoText = %infoText NL "<spush>" @ %this.headerStyle @ "MAP NAME:<spop><lmargin:70>" TAB %temp @ "<lmargin:0>";
|
|
%temp = getRecord( %info, 6 );
|
|
if ( %temp !$= "" )
|
|
%infoText = %infoText NL "<spush>" @ %this.headerStyle @ "SERVER INFO:<spop><lmargin:10>" TAB %temp @ "<lmargin:0>";
|
|
|
|
// Fill in the content window:
|
|
%content = GMJ_Browser.getServerContentString();
|
|
SI_ContentWindow.fill( %content );
|
|
%refreshable = !isServerQueryActive();
|
|
}
|
|
else
|
|
{
|
|
switch$ ( %status )
|
|
{
|
|
case "new":
|
|
%temp = "<spush><color:DCDC00>Not queried yet.<spop>";
|
|
SI_ContentWindow.setText( "Not available." );
|
|
case "querying":
|
|
%temp = "<spush><color:00DC00>Querying...<spop>";
|
|
SI_ContentWindow.setText( "Not available." );
|
|
case "updating":
|
|
%temp = "<spush><color:00DC00>Updating...<spop>";
|
|
case "timedOut":
|
|
%temp = "<spush><color:DC1A1A>Timed out.<spop>";
|
|
SI_ContentWindow.setText( "Not available." );
|
|
%refreshable = !isServerQueryActive();
|
|
}
|
|
%infoText = %infoText NL "<lmargin:0><spush>" @ %this.headerStyle @ "STATUS: <spop><lmargin:70>" TAB %temp;
|
|
}
|
|
|
|
SI_InfoWindow.setText( %infoText );
|
|
SI_InfoScroll.scrollToTop();
|
|
SI_ContentScroll.scrollToTop();
|
|
SI_RefreshBtn.setActive( %refreshable );
|
|
}
|
|
|
|
//------------------------------------------------------------------------------
|
|
function SI_ContentWindow::fill( %this, %content )
|
|
{
|
|
if ( getRecordCount( %content ) == 1 )
|
|
{
|
|
%this.setText( "" );
|
|
return;
|
|
}
|
|
|
|
%record = 0;
|
|
%teamCount = getRecord( %content, %record );
|
|
%record++;
|
|
if ( %teamCount > 1 )
|
|
{
|
|
%string = "<tab:110,220><spush>" @ ServerInfoDlg.headerStyle @ "TEAMS" TAB "SCORE<spop><tab:5,115,225>";
|
|
for ( %i = 0; %i < %teamCount; %i++ )
|
|
{
|
|
%teamEntry = getRecord( %content, %record );
|
|
%string = %string NL "<clip:110>\t" @ getField( %teamEntry, 0 ) @ "</clip>" TAB getField( %teamEntry, 1 );
|
|
%record++;
|
|
}
|
|
|
|
%playerCount = getRecord( %content, %record );
|
|
%record++;
|
|
%string = %string NL "\n<tab:110,220><spush>" @ ServerInfoDlg.headerStyle @ "PLAYERS" TAB "TEAM" TAB "SCORE<spop><tab:5,115,225>";
|
|
for ( %i = 0; %i < %playerCount; %i++ )
|
|
{
|
|
%playerEntry = getRecord( %content, %record );
|
|
%string = %string NL "<clip:110>\t" @ getField( %playerEntry, 0 ) @ "</clip>"
|
|
TAB "<clip:105>" @ getField( %playerEntry, 1 ) @ "</clip>" TAB getField( %playerEntry, 2 );
|
|
%record++;
|
|
}
|
|
}
|
|
else
|
|
{
|
|
%record++;
|
|
%playerCount = getRecord( %content, %record );
|
|
%record++;
|
|
%string = "<tab:150><spush>" @ ServerInfoDlg.headerStyle @ "PLAYERS" TAB "SCORE<spop><tab:5,155>";
|
|
for ( %i = 0; %i < %playerCount; %i++ )
|
|
{
|
|
%playerEntry = getRecord( %content, %record );
|
|
%string = %string NL "<clip:150>\t" @ getField( %playerEntry, 0 ) @ "</clip>" TAB getField( %playerEntry, 2 );
|
|
%record++;
|
|
}
|
|
}
|
|
|
|
%this.setText( %string );
|
|
}
|
|
|
|
//------------------------------------------------------------------------------
|
|
function ServerInfoDlg::onSleep( %this )
|
|
{
|
|
GMJ_Browser.infoWindowOpen = false;
|
|
GMJ_InfoBtn.setActive( true );
|
|
}
|
|
|
|
//------------------------------------------------------------------------------
|
|
function PasswordDlg::onWake( %this )
|
|
{
|
|
$JoinGamePassword = "";
|
|
}
|
|
|
|
//------------------------------------------------------------------------------
|
|
function PasswordDlg::accept( %this )
|
|
{
|
|
Canvas.popDialog( PasswordDlg );
|
|
JoinSelectedGame();
|
|
}
|
|
|
|
//------------------------------------------------------------------------------
|
|
function JoinSelectedGame()
|
|
{
|
|
$ServerInfo = GMJ_Browser.getServerInfoString();
|
|
|
|
JoinGame($JoinGameAddress);
|
|
}
|
|
|
|
//------------------------------------------------------------------------------
|
|
function JoinGame(%address)
|
|
{
|
|
MessagePopup( "JOINING SERVER", "CONNECTING" );
|
|
cancelServerQuery();
|
|
echo("Joining Server " @ %address);
|
|
%playerPref = $pref::Player[$pref::Player::Current];
|
|
%playerName = getField( %playerPref, 0 );
|
|
%playerRaceGender = getField( %playerPref, 1 );
|
|
%playerSkin = getField( %playerPref, 2 );
|
|
%playerVoice = getField( %playerPref, 3 );
|
|
%playerVoicePitch = getField( %playerPref, 4 );
|
|
connect( %address, $JoinGamePassword, %playerName, %playerRaceGender, %playerSkin, %playerVoice, %playerVoicePitch );
|
|
}
|
|
|
|
//------------------------------------------------------------------------------
|
|
// Host Game pane:
|
|
//------------------------------------------------------------------------------
|
|
function GM_HostPane::onActivate( %this )
|
|
{
|
|
GameGui.pane = "Host";
|
|
|
|
$HostGameType = $PlayingOnline ? "Online" : "LAN";
|
|
|
|
buildMissionTypePopup( GMH_MissionType );
|
|
GMH_BotMinSlider.setValue( $Host::MinBotDifficulty );
|
|
GMH_BotMaxSlider.setValue( $Host::MaxBotDifficulty );
|
|
GMH_BotsEnabledTgl.setValue( $Host::BotsEnabled );
|
|
GMH_BotsEnabledTgl.onAction();
|
|
|
|
//clamp and set the bot count slider
|
|
setBotCountSlider();
|
|
|
|
// Select the saved-off prefs:
|
|
if ( $Host::MissionType !$= "" )
|
|
{
|
|
// Find the last selected type:
|
|
for ( %type = 0; %type < $HostTypeCount; %type++ )
|
|
{
|
|
if ( $HostTypeName[%type] $= $Host::MissionType )
|
|
break;
|
|
}
|
|
|
|
if ( %type != $HostTypeCount )
|
|
{
|
|
GMH_MissionType.setSelected( %type );
|
|
GMH_MissionType.onSelect( %type, "" );
|
|
if ( $Host::Map !$= "" )
|
|
{
|
|
// Find the last selected mission:
|
|
for ( %index = 0; %index < $HostMissionCount[%type]; %index++ )
|
|
{
|
|
if ( $HostMissionFile[$HostMission[%type, %index]] $= $Host::Map )
|
|
break;
|
|
}
|
|
|
|
if ( %index != $HostMissionCount[%type] )
|
|
GMH_MissionList.setSelectedById( $HostMission[%type, %index] );
|
|
}
|
|
}
|
|
}
|
|
else
|
|
{
|
|
GMH_MissionType.setSelected( 0 );
|
|
GMH_MissionType.onSelect( 0, "" );
|
|
}
|
|
|
|
GMH_StartGameBtn.makeFirstResponder( 1 );
|
|
}
|
|
|
|
//------------------------------------------------------------------------------
|
|
function GM_HostPane::onDeactivate( %this )
|
|
{
|
|
}
|
|
|
|
//------------------------------------------------------------------------------
|
|
function buildMissionTypePopup( %popup )
|
|
{
|
|
%popup.clear();
|
|
for( %type = 0; %type < $HostTypeCount; %type++ )
|
|
%popup.add( $HostTypeDisplayName[%type], %type );
|
|
}
|
|
|
|
//------------------------------------------------------------------------------
|
|
function getMissionTypeDisplayNames()
|
|
{
|
|
%file = new FileObject();
|
|
for ( %type = 0; %type < $HostTypeCount; %type++ )
|
|
{
|
|
$HostTypeDisplayName[%type] = $HostTypeName[%type];
|
|
if ( %file.openForRead( "scripts/" @ $HostTypeName[%type] @ "Game.cs" ) )
|
|
{
|
|
while ( !%file.isEOF() )
|
|
{
|
|
%line = %file.readLine();
|
|
if ( getSubStr( %line, 0, 17 ) $= "// DisplayName = " )
|
|
{
|
|
$HostTypeDisplayName[%type] = getSubStr( %line, 17, 1000 );
|
|
break;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
%file.delete();
|
|
}
|
|
|
|
//------------------------------------------------------------------------------
|
|
function buildMissionList()
|
|
{
|
|
%search = "missions/*.mis";
|
|
%ct = 0;
|
|
|
|
$HostTypeCount = 0;
|
|
$HostMissionCount = 0;
|
|
|
|
%fobject = new FileObject();
|
|
|
|
for( %file = findFirstFile( %search ); %file !$= ""; %file = findNextFile( %search ) )
|
|
{
|
|
%name = fileBase( %file ); // get the name
|
|
|
|
%idx = $HostMissionCount;
|
|
$HostMissionCount++;
|
|
|
|
$HostMissionFile[%idx] = %name;
|
|
$HostMissionName[%idx] = %name;
|
|
|
|
if ( !%fobject.openForRead( %file ) )
|
|
continue;
|
|
|
|
%typeList = "None";
|
|
|
|
while ( !%fobject.isEOF() )
|
|
{
|
|
%line = %fobject.readLine();
|
|
if ( getSubStr( %line, 0, 17 ) $= "// DisplayName = " )
|
|
{
|
|
// Override the mission name:
|
|
$HostMissionName[%idx] = getSubStr( %line, 17, 1000 );
|
|
}
|
|
else if ( getSubStr( %line, 0, 18 ) $= "// MissionTypes = " )
|
|
{
|
|
%typeList = getSubStr( %line, 18, 1000 );
|
|
break;
|
|
}
|
|
}
|
|
%fobject.close();
|
|
|
|
// Don't include single player missions:
|
|
if ( strstr( %typeList, "SinglePlayer" ) != -1 )
|
|
continue;
|
|
|
|
// Test to see if the mission is bot-enabled:
|
|
%navFile = "terrains/" @ %name @ ".nav";
|
|
$BotEnabled[%idx] = isFile( %navFile );
|
|
|
|
for( %word = 0; ( %misType = getWord( %typeList, %word ) ) !$= ""; %word++ )
|
|
{
|
|
for ( %i = 0; %i < $HostTypeCount; %i++ )
|
|
if ( $HostTypeName[%i] $= %misType )
|
|
break;
|
|
if ( %i == $HostTypeCount )
|
|
{
|
|
$HostTypeCount++;
|
|
$HostTypeName[%i] = %misType;
|
|
$HostMissionCount[%i] = 0;
|
|
}
|
|
// add the mission to the type
|
|
%ct = $HostMissionCount[%i];
|
|
$HostMission[%i, $HostMissionCount[%i]] = %idx;
|
|
$HostMissionCount[%i]++;
|
|
}
|
|
}
|
|
|
|
getMissionTypeDisplayNames();
|
|
|
|
%fobject.delete();
|
|
}
|
|
|
|
// One time only function call:
|
|
buildMissionList();
|
|
|
|
//------------------------------------------------------------------------------
|
|
function validateMissionAndType(%misName, %misType)
|
|
{
|
|
for ( %mis = 0; %mis < $HostMissionCount; %mis++ )
|
|
if( $HostMissionFile[%mis] $= %misName )
|
|
break;
|
|
if ( %mis == $HostMissionCount )
|
|
return false;
|
|
for ( %type = 0; %type < $HostTypeCount; %type++ )
|
|
if ( $HostTypeName[%type] $= %misType )
|
|
break;
|
|
if(%type == $hostTypeCount)
|
|
return false;
|
|
$Host::Map = $HostMissionFile[%mis];
|
|
$Host::MissionType = $HostTypeName[%type];
|
|
|
|
return true;
|
|
}
|
|
|
|
//------------------------------------------------------------------------------
|
|
// This function returns the index of the next mission in the mission list.
|
|
//------------------------------------------------------------------------------
|
|
function getNextMission( %misName, %misType )
|
|
{
|
|
// First find the index of the mission in the master list:
|
|
for ( %mis = 0; %mis < $HostMissionCount; %mis++ )
|
|
if( $HostMissionFile[%mis] $= %misName )
|
|
break;
|
|
if ( %mis == $HostMissionCount )
|
|
return "";
|
|
|
|
// Now find the index of the mission type:
|
|
for ( %type = 0; %type < $HostTypeCount; %type++ )
|
|
if ( $HostTypeName[%type] $= %misType )
|
|
break;
|
|
if ( %type == $hostTypeCount )
|
|
return "";
|
|
|
|
// Now find the mission's index in the mission-type specific sub-list:
|
|
for ( %i = 0; %i < $HostMissionCount[%type]; %i++ )
|
|
if ( $HostMission[%type, %i] == %mis )
|
|
break;
|
|
|
|
// Go BACKWARDS, because the missions are in reverse alphabetical order:
|
|
if ( %i == 0 )
|
|
%i = $HostMissionCount[%type] - 1;
|
|
else
|
|
%i--;
|
|
|
|
// If there are bots in the game, don't switch to any maps without
|
|
// a NAV file:
|
|
if ( $HostGameBotCount > 0 )
|
|
{
|
|
for ( %j = 0; %j < $HostMissionCount[%type] - 1; %j++ )
|
|
{
|
|
if ( $BotEnabled[$HostMission[%type, %i]] )
|
|
break;
|
|
|
|
if ( %i == 0 )
|
|
%i = $HostMissionCount[%type] - 1;
|
|
else
|
|
%i--;
|
|
}
|
|
}
|
|
|
|
return $HostMission[%type, %i];
|
|
}
|
|
|
|
//------------------------------------------------------------------------------
|
|
function GMH_MissionType::onSelect( %this, %id, %text )
|
|
{
|
|
// Fill the mission list:
|
|
GMH_MissionList.clear();
|
|
%lastAdded = 0;
|
|
for ( %i = 0; %i < $HostMissionCount[%id];%i++ )
|
|
{
|
|
%misId = $HostMission[%id,%i];
|
|
GMH_MissionList.addRow( %misId, $HostMissionName[%misId] );
|
|
%lastAdded = %misId;
|
|
}
|
|
GMH_MissionList.sort( 0 );
|
|
|
|
// Select the last mission added:
|
|
GMH_MissionList.setSelectedById( %lastAdded );
|
|
$Host::MissionType = $HostTypeName[%id];
|
|
|
|
// Disable all non bot-enabled maps if bots are enabled:
|
|
if ( GMH_BotsEnabledTgl.getValue() )
|
|
GMH_BotsEnabledTgl.onAction();
|
|
}
|
|
|
|
//------------------------------------------------------------------------------
|
|
function GMH_MissionList::onSelect( %this, %id, %text )
|
|
{
|
|
if ( GMH_BotsEnabledTgl.getValue() )
|
|
GMH_StartGameBtn.setActive( $BotEnabled[%id] );
|
|
}
|
|
|
|
//------------------------------------------------------------------------------
|
|
function tryToStartHostedGame()
|
|
{
|
|
if ( GMH_BotsEnabledTgl.getValue() )
|
|
{
|
|
%selId = GMH_MissionList.getSelectedId();
|
|
if ( !$BotEnabled[%selId] )
|
|
return;
|
|
}
|
|
|
|
StartHostedGame();
|
|
}
|
|
|
|
//------------------------------------------------------------------------------
|
|
function StartHostedGame()
|
|
{
|
|
%selId = GMH_MissionList.getSelectedId();
|
|
%misFile = $HostMissionFile[%selId];
|
|
|
|
if ( $Host::BotsEnabled )
|
|
{
|
|
validateMaxPlayers();
|
|
$HostGameBotCount = $Host::BotCount;
|
|
}
|
|
else
|
|
$HostGameBotCount = 0;
|
|
|
|
$ServerName = $Host::GameName;
|
|
$Host::Map = %misFile;
|
|
|
|
echo( "exporting server prefs..." );
|
|
export( "$Host::*", "prefs/ServerPrefs.cs", false );
|
|
|
|
if ( $Host::Dedicated )
|
|
{
|
|
MessageBoxYesNo( "WARNING",
|
|
"You are about to launch a dedicated server and leave Tribes 2. Do you want to continue?",
|
|
"tryToLaunchDedicatedServer();" );
|
|
return;
|
|
}
|
|
|
|
//IRCClient::onJoinGame("", "");
|
|
|
|
MessagePopup( "STARTING SERVER", "Initializing..." );
|
|
Canvas.repaint();
|
|
|
|
cancelServerQuery();
|
|
setNetPort( $Host::Port );
|
|
CreateServer( $Host::Map, $Host::MissionType );
|
|
%playerPref = $pref::Player[$pref::Player::Current];
|
|
%playerName = getField( %playerPref, 0 );
|
|
%playerRaceGender = getField( %playerPref, 1 );
|
|
%playerSkin = getField( %playerPref, 2 );
|
|
%playerVoice = getField( %playerPref, 3 );
|
|
%playerVoicePitch = getField( %playerPref, 4 );
|
|
localConnect( %playerName, %playerRaceGender, %playerSkin, %playerVoice, %playerVoicePitch );
|
|
if(!$RecordDemo)
|
|
{
|
|
// demos are incompatible with local simulated net params
|
|
ServerConnection.setSimulatedNetParams($pref::Net::simPacketLoss, $pref::net::simPing * 0.5);
|
|
LocalClientConnection.setSimulatedNetParams($pref::Net::simPacketLoss, $pref::net::simPing * 0.5);
|
|
}
|
|
}
|
|
|
|
//------------------------------------------------------------------------------
|
|
function tryToLaunchDedicatedServer()
|
|
{
|
|
%numBots = $Host::BotsEnabled ? $Host::BotCount : 0;
|
|
if ( launchDedicatedServer( $Host::MissionType, $Host::Map, %numBots ) )
|
|
quit();
|
|
else
|
|
{
|
|
error( "Failed to launch the dedicated server." );
|
|
schedule( 0, 0, MessageBoxOK, "FAILED", "Tribes 2 failed to launch the dedicated server." );
|
|
}
|
|
}
|
|
|
|
//------------------------------------------------------------------------------
|
|
function GMH_BotsEnabledTgl::onAction( %this )
|
|
{
|
|
%count = GMH_MissionList.rowCount();
|
|
if ( %this.getValue() )
|
|
{
|
|
for ( %i = 0; %i < %count; %i++ )
|
|
{
|
|
%id = GMH_MissionList.getRowId( %i );
|
|
GMH_MissionList.setRowActive( %id, $BotEnabled[%id] );
|
|
}
|
|
|
|
GMH_EnableBotsGroup.setVisible(true);
|
|
%misId = GMH_MissionList.getSelectedId();
|
|
GMH_StartGameBtn.setActive( $BotEnabled[%misId] );
|
|
}
|
|
else
|
|
{
|
|
for ( %i = 0; %i < %count; %i++ )
|
|
{
|
|
%id = GMH_MissionList.getRowId( %i );
|
|
GMH_MissionList.setRowActive( %id, true );
|
|
}
|
|
|
|
GMH_EnableBotsGroup.setVisible( false );
|
|
GMH_StartGameBtn.setActive( true );
|
|
}
|
|
}
|
|
|
|
//------------------------------------------------------------------------------
|
|
function updateMinBotDifficulty()
|
|
{
|
|
%min = GMH_BotMinSlider.getValue();
|
|
$Host::MinBotDifficulty = %min;
|
|
if ( GMH_BotMaxSlider.getValue() < %min )
|
|
GMH_BotMaxSlider.setValue( %min );
|
|
}
|
|
|
|
//------------------------------------------------------------------------------
|
|
function updateMaxBotDifficulty()
|
|
{
|
|
%max = GMH_BotMaxSlider.getValue();
|
|
$Host::MaxBotDifficulty = %max;
|
|
if ( GMH_BotMinSlider.getValue() > %max )
|
|
GMH_BotMinSlider.setValue( %max );
|
|
}
|
|
|
|
//------------------------------------------------------------------------------
|
|
function GMH_BotsEnabledTgl::onAction( %this )
|
|
{
|
|
%count = GMH_MissionList.rowCount();
|
|
if ( %this.getValue() )
|
|
{
|
|
for ( %i = 0; %i < %count; %i++ )
|
|
{
|
|
%id = GMH_MissionList.getRowId( %i );
|
|
GMH_MissionList.setRowActive( %id, $BotEnabled[%id] );
|
|
}
|
|
|
|
GMH_EnableBotsGroup.setVisible(true);
|
|
%misId = GMH_MissionList.getSelectedId();
|
|
GMH_StartGameBtn.setActive( $BotEnabled[%misId] );
|
|
}
|
|
else
|
|
{
|
|
for ( %i = 0; %i < %count; %i++ )
|
|
{
|
|
%id = GMH_MissionList.getRowId( %i );
|
|
GMH_MissionList.setRowActive( %id, true );
|
|
}
|
|
|
|
GMH_EnableBotsGroup.setVisible(false);
|
|
GMH_StartGameBtn.setActive( true );
|
|
}
|
|
}
|
|
|
|
//------------------------------------------------------------------------------
|
|
function validateMaxPlayers()
|
|
{
|
|
%maxPlayers = GMH_MaxPlayersTE.getValue();
|
|
if (%maxPlayers < 1)
|
|
%maxPlayers = 1;
|
|
|
|
if (%maxPlayers > 64)
|
|
%maxPlayers = 64;
|
|
|
|
//reset the value back into the TE
|
|
GMH_MaxPlayersTE.setValue(%maxPlayers);
|
|
|
|
//and make sure the bot sliders reflect the changes..
|
|
setBotCountSlider();
|
|
}
|
|
|
|
function setBotCountSlider()
|
|
{
|
|
%maxBots = 15;
|
|
if (%maxBots > $Host::MaxPlayers - 2)
|
|
%maxBots = $Host::MaxPlayers - 2;
|
|
if ($Host::BotCount > %maxBots + 1)
|
|
$Host::BotCount = %maxBots + 1;
|
|
|
|
if (%maxBots <= 1)
|
|
%sliderValue = 0.0;
|
|
else
|
|
%sliderValue = ($Host::BotCount - 0.95) / %maxBots;
|
|
|
|
GMH_MinCombatantSlider.setValue(%sliderValue);
|
|
}
|
|
|
|
function setMinCombatants()
|
|
{
|
|
%maxBots = 16;
|
|
if (%maxBots > $Host::MaxPlayers - 1)
|
|
%maxBots = $Host::MaxPlayers - 1;
|
|
if (%maxBots <= 0)
|
|
$Host::BotCount = 0;
|
|
else
|
|
$Host::BotCount = mFloor( GMH_MinCombatantSlider.getValue() * (%maxBots - 1)) + 1;
|
|
GMH_BotCountText.setValue( "(" @ $Host::BotCount @ ")" );
|
|
}
|
|
|
|
//------------------------------------------------------------------------------
|
|
function AdvancedHostDlg::onWake( %this )
|
|
{
|
|
// Set all of the controls to the current pref states:
|
|
AH_HostPort.setText( $Host::Port );
|
|
AH_DedicatedTgl.setValue( $Host::Dedicated );
|
|
AH_TournamentTgl.setValue( $Host::TournamentMode );
|
|
AH_AdminVoteTgl.setValue( $Host::allowAdminPlayerVotes );
|
|
AH_AllowSmurfTgl.setValue( !$Host::NoSmurfs );
|
|
AH_TimeLimit.setText( $Host::TimeLimit );
|
|
AH_AdminPassword.setText( $Host::AdminPassword );
|
|
AH_ServerInfo.setText( $Host::Info );
|
|
AH_VotePassSlider.setValue( $Host::VotePassPercent );
|
|
AH_VoteTimeSlider.setValue( $Host::VoteTime );
|
|
AH_RespawnSlider.setValue( $Host::PlayerRespawnTimeout );
|
|
AH_WarmupSlider.setValue( $Host::WarmupTime );
|
|
}
|
|
|
|
//------------------------------------------------------------------------------
|
|
function AdvancedHostDlg::accept( %this )
|
|
{
|
|
// Apply all of the changes:
|
|
$Host::Port = AH_HostPort.getValue();
|
|
$Host::Dedicated = AH_DedicatedTgl.getValue();
|
|
$Host::TournamentMode = AH_TournamentTgl.getValue();
|
|
$Host::allowAdminPlayerVotes = AH_AdminVoteTgl.getValue();
|
|
$Host::NoSmurfs = !AH_AllowSmurfTgl.getValue();
|
|
$Host::TimeLimit = AH_TimeLimit.getValue();
|
|
$Host::AdminPassword = AH_AdminPassword.getValue();
|
|
$Host::Info = AH_ServerInfo.getText();
|
|
$Host::VotePassPercent = mFloor( AH_VotePassSlider.getValue() );
|
|
$Host::VoteTime = mFloor( AH_VoteTimeSlider.getValue() );
|
|
$Host::PlayerRespawnTimeout = mFloor( AH_RespawnSlider.getValue() );
|
|
$Host::WarmupTime = mFloor( AH_WarmupSlider.getValue() );
|
|
|
|
// Save off the new prefs:
|
|
export( "$Host::*", "prefs/ServerPrefs.cs", false );
|
|
|
|
Canvas.popDialog( AdvancedHostDlg );
|
|
}
|
|
|
|
//------------------------------------------------------------------------------
|
|
function AH_VotePassText::update( %this )
|
|
{
|
|
%this.setText( mFloor( AH_VotePassSlider.getValue() ) @ "%" );
|
|
}
|
|
|
|
//------------------------------------------------------------------------------
|
|
function AH_VoteTimeText::update( %this )
|
|
{
|
|
%this.setText( mFloor( AH_VoteTimeSlider.getValue() ) SPC "seconds" );
|
|
}
|
|
|
|
//------------------------------------------------------------------------------
|
|
function AH_RespawnText::update( %this )
|
|
{
|
|
%this.setText( mFloor( AH_RespawnSlider.getValue() ) SPC "seconds" );
|
|
}
|
|
|
|
//------------------------------------------------------------------------------
|
|
function AH_WarmupText::update( %this )
|
|
{
|
|
%this.setText( mFloor( AH_WarmupSlider.getValue() ) SPC "seconds" );
|
|
}
|
|
|
|
//------------------------------------------------------------------------------
|
|
// Warrior Setup pane:
|
|
//------------------------------------------------------------------------------
|
|
function GM_WarriorPane::onActivate( %this )
|
|
{
|
|
GameGui.pane = "Warrior";
|
|
if ( $pref::Player::Count == 0 )
|
|
%this.createNewAlias();
|
|
else
|
|
{
|
|
// Fill the warrior list:
|
|
GMW_WarriorPopup.clear();
|
|
GMW_LightRdo.setValue( true );
|
|
|
|
// First add the warrior corresponding to the player nickname:
|
|
%this.warriorIndex = -1;
|
|
if ( $PlayingOnline )
|
|
{
|
|
%warrior = getField( WONGetAuthInfo(), 0 );
|
|
for ( %i = 0; %i < $pref::Player::Count; %i++ )
|
|
{
|
|
%name = getField( $pref::Player[%i], 0 );
|
|
if ( %name $= %warrior )
|
|
{
|
|
%this.warriorIndex = %i;
|
|
GMW_WarriorPopup.add( %name, %i, 1 );
|
|
break;
|
|
}
|
|
}
|
|
}
|
|
|
|
// Add the rest of the aliases:
|
|
for ( %count = 0; %count < $pref::Player::Count; %count++ )
|
|
{
|
|
if ( $pref::Player[%count] !$= "" && %count != %this.warriorIndex )
|
|
{
|
|
%name = stripTrailingSpaces( strToPlayerName( getField( $pref::Player[%count], 0 ) ) );
|
|
GMW_WarriorPopup.add( %name, %count );
|
|
}
|
|
}
|
|
|
|
// Fill the race/gender list:
|
|
GMW_RaceGenderPopup.fillList();
|
|
|
|
// Select the current player:
|
|
GMW_WarriorPopup.setSelected( $pref::Player::Current );
|
|
GMW_WarriorPopup.onSelect( $pref::Player::Current, "" );
|
|
|
|
if ( $pref::Player::Count > 1 && $pref::Player::Current != %this.warriorIndex )
|
|
GMW_DeleteWarriorBtn.setActive( true );
|
|
else
|
|
GMW_DeleteWarriorBtn.setActive( false );
|
|
|
|
GMW_PlayerPageBtn.setVisible( $PlayingOnline );
|
|
}
|
|
}
|
|
|
|
//------------------------------------------------------------------------------
|
|
function GM_WarriorPane::onDeactivate( %this )
|
|
{
|
|
}
|
|
|
|
//------------------------------------------------------------------------------
|
|
function GM_WarriorPane::createNewAlias( %this )
|
|
{
|
|
NW_NameEdit.setValue( "" );
|
|
NW_DoneBtn.setActive( false );
|
|
NW_CancelBtn.setVisible( $pref::Player::Count > 0 );
|
|
Canvas.pushDialog( NewWarriorDlg );
|
|
}
|
|
|
|
//------------------------------------------------------------------------------
|
|
function GM_WarriorPane::deleteWarrior( %this )
|
|
{
|
|
MessageBoxYesNo( "CONFIRM", "Are you sure you want to delete this alias?", "doDeleteWarrior();", "" );
|
|
}
|
|
|
|
//------------------------------------------------------------------------------
|
|
function doDeleteWarrior()
|
|
{
|
|
// Make sure we aren't trying to delete the default warrior (should never get this):
|
|
if ( $pref::Player::Current == GM_WarriorPane.warriorIndex )
|
|
return;
|
|
|
|
for ( %i = $pref::Player::Current; %i < $pref::Player::Count - 1; %i++ )
|
|
$pref::Player[%i] = $pref::Player[%i + 1];
|
|
$pref::Player[%i] = "";
|
|
|
|
if ( GM_WarriorPane.warriorIndex > $pref::Player::Current )
|
|
GM_WarriorPane.warriorIndex--;
|
|
|
|
$pref::Player::Count--;
|
|
if ( GM_WarriorPane.warriorIndex != -1 )
|
|
$pref::Player::Current = GM_WarriorPane.warriorIndex;
|
|
else
|
|
$pref::Player::Current = 0;
|
|
|
|
// Update the interface:
|
|
GM_WarriorPane::onActivate();
|
|
}
|
|
|
|
//------------------------------------------------------------------------------
|
|
function GM_WarriorPane::gotoPlayerPage( %this )
|
|
{
|
|
%warrior = getField( WONGetAuthInfo(), 0 );
|
|
LaunchBrowser( %warrior, "Warrior" );
|
|
}
|
|
|
|
//------------------------------------------------------------------------------
|
|
function GMW_PlayerModel::update( %this )
|
|
{
|
|
// Get the shape names:
|
|
if ( GMW_HeavyRdo.getValue() )
|
|
%armor = "heavy";
|
|
else if ( GMW_MediumRdo.getValue() )
|
|
%armor = "medium";
|
|
else
|
|
%armor = "light";
|
|
|
|
switch ( GMW_RaceGenderPopup.getSelected() )
|
|
{
|
|
case 1:
|
|
if ( %armor $= "heavy" )
|
|
%shape = %armor @ "_male";
|
|
else
|
|
%shape = %armor @ "_female";
|
|
case 2: %shape = "bioderm_" @ %armor;
|
|
default: %shape = %armor @ "_male";
|
|
}
|
|
|
|
%skin = getField( $pref::Player[$pref::Player::Current], 2 );
|
|
|
|
// if( isObject( $dummySeq ) )
|
|
// {
|
|
// $dummySeq.delete();
|
|
// }
|
|
//
|
|
// $dummySeq = new TSShapeConstructor()
|
|
// {
|
|
// baseShape = %shape @ ".dts";
|
|
// sequence0 = %shape @ "_forward.dsq dummyRun";
|
|
// };
|
|
|
|
%this.setModel( %shape, %skin );
|
|
}
|
|
|
|
//------------------------------------------------------------------------------
|
|
function GMW_WarriorPopup::onAdd( %this )
|
|
{
|
|
%this.addScheme( 1, "255 255 0", "255 255 128", "128 128 0" );
|
|
}
|
|
|
|
//------------------------------------------------------------------------------
|
|
function GMW_WarriorPopup::onSelect( %this, %id, %text )
|
|
{
|
|
// Set this as the currently selected player:
|
|
$pref::Player::Current = %id;
|
|
|
|
// Select the race/gender:
|
|
%raceGender = getField( $pref::Player[%id], 1 );
|
|
%selId = GMW_RaceGenderPopup.findText( %raceGender );
|
|
if ( %selId == -1 )
|
|
%selId = 0;
|
|
|
|
GMW_RaceGenderPopup.setSelected( %selId );
|
|
GMW_SkinPopup.fillList( %selId );
|
|
GMW_VoicePopup.fillList( %selId );
|
|
|
|
// Select the skin:
|
|
%skin = getField( $pref::Player[%id], 2 );
|
|
%selId = -1;
|
|
for ( %i = 0; %i < GMW_SkinPopup.size(); %i++ )
|
|
{
|
|
if ( GMW_SkinPopup.realSkin[%i] !$= "" )
|
|
{
|
|
if ( %skin $= GMW_SkinPopup.realSkin[%i] )
|
|
{
|
|
%selId = %i;
|
|
break;
|
|
}
|
|
}
|
|
else if ( %skin $= GMW_SkinPopup.getTextById( %i ) )
|
|
{
|
|
%selId = %i;
|
|
break;
|
|
}
|
|
}
|
|
if ( %selId == -1 )
|
|
%selId = 0;
|
|
GMW_SkinPopup.setSelected( %selId );
|
|
GMW_SkinPopup.onSelect( %selId, GMW_SkinPopup.getTextById( %selId ) );
|
|
|
|
// Select the voice:
|
|
%voice = getField( $pref::Player[%id], 3 );
|
|
%voiceId = getSubStr( %voice, strlen( %voice ) -1, 1000 ) - 1;
|
|
GMW_VoicePopup.setSelected( %voiceId );
|
|
GMW_VoicePopup.voiceIndex = 0;
|
|
|
|
GMW_DeleteWarriorBtn.setActive( $pref::Player::Count > 1 && %id != GM_WarriorPane.warriorIndex );
|
|
}
|
|
|
|
//------------------------------------------------------------------------------
|
|
function GMW_RaceGenderPopup::fillList( %this )
|
|
{
|
|
%this.clear();
|
|
%this.add( "Human Male", 0 );
|
|
%this.add( "Human Female", 1 );
|
|
%this.add( "Bioderm", 2 );
|
|
}
|
|
|
|
//------------------------------------------------------------------------------
|
|
function GMW_RaceGenderPopup::onSelect( %this, %id, %text )
|
|
{
|
|
// Update the player pref:
|
|
$pref::Player[$pref::Player::Current] = setField( $pref::Player[$pref::Player::Current], 1, %this.getText() );
|
|
|
|
// Fill the skin list:
|
|
%prevSkin = GMW_SkinPopup.getText();
|
|
GMW_SkinPopup.fillList( %id );
|
|
%selId = GMW_SkinPopup.findText( %prevSkin );
|
|
if ( %selId == -1 )
|
|
%selId = 0;
|
|
GMW_SkinPopup.setSelected( %selId );
|
|
GMW_SkinPopup.onSelect( %selId, GMW_SkinPopup.getTextById( %selId ) );
|
|
|
|
// Fill the voice list:
|
|
%prevVoice = GMW_VoicePopup.getText();
|
|
GMW_VoicePopup.fillList( %id );
|
|
%selId = GMW_VoicePopup.findText( %prevVoice );
|
|
if ( %selId == -1 )
|
|
%selId = 0;
|
|
|
|
GMW_VoicePopup.setSelected( %selId );
|
|
GMW_VoicePopup.onSelect( %selId, "" );
|
|
}
|
|
|
|
//------------------------------------------------------------------------------
|
|
$SkinCount = 0;
|
|
$Skin[$SkinCount, name] = "Blood Eagle";
|
|
$Skin[$SkinCount, code] = "beagle";
|
|
$SkinCount++;
|
|
$Skin[$SkinCount, name] = "Diamond Sword";
|
|
$Skin[$SkinCount, code] = "dsword";
|
|
$SkinCount++;
|
|
$Skin[$SkinCount, name] = "Starwolf";
|
|
$Skin[$SkinCount, code] = "swolf";
|
|
$SkinCount++;
|
|
$Skin[$SkinCount, name] = "Phoenix";
|
|
$Skin[$SkinCount, code] = "cotp";
|
|
$SkinCount++;
|
|
$Skin[$SkinCount, name] = "Storm";
|
|
$Skin[$SkinCount, code] = "base";
|
|
$SkinCount++;
|
|
$Skin[$SkinCount, name] = "Inferno";
|
|
$Skin[$SkinCount, code] = "baseb";
|
|
$SkinCount++;
|
|
$Skin[$SkinCount, name] = "Horde";
|
|
$Skin[$SkinCount, code] = "horde";
|
|
$SkinCount++;
|
|
|
|
//------------------------------------------------------------------------------
|
|
function GMW_SkinPopup::fillList( %this, %raceGender )
|
|
{
|
|
for ( %i = 0; %i < %this.size(); %i++ )
|
|
%this.realSkin[%i] = "";
|
|
|
|
%this.clear();
|
|
%path = "textures/skins/";
|
|
switch ( %raceGender )
|
|
{
|
|
case 0: // Human Male
|
|
%pattern = ".lmale.png";
|
|
case 1: // Human Female
|
|
%pattern = ".lfemale.png";
|
|
case 2: // Bioderm
|
|
%pattern = ".lbioderm.png";
|
|
}
|
|
|
|
%count = 0;
|
|
for ( %file = findFirstFile( %path @ "*" @ %pattern ); %file !$= ""; %file = findNextFile( %path @ "*" @ %pattern ) )
|
|
{
|
|
%skin = getSubStr( %file, strlen( %path ), strlen( %file ) - strlen( %path ) - strlen( %pattern ) ); // strip off the path and postfix
|
|
|
|
// Make sure this is not a bot skin:
|
|
if ( %skin !$= "basebot" && %skin !$= "basebbot" )
|
|
{
|
|
// See if this skin has an alias:
|
|
for ( %i = 0; %i < $SkinCount; %i++ )
|
|
{
|
|
if ( %skin $= $Skin[%i, code] )
|
|
{
|
|
%skin = $Skin[%i, name];
|
|
%this.realSkin[%count] = $Skin[%i, code];
|
|
break;
|
|
}
|
|
}
|
|
|
|
%this.add( %skin, %count );
|
|
%count++;
|
|
}
|
|
}
|
|
}
|
|
|
|
//------------------------------------------------------------------------------
|
|
function GMW_SkinPopup::onSelect( %this, %id, %text )
|
|
{
|
|
// Update the player pref:
|
|
if ( %this.realSkin[%id] !$= "" )
|
|
$pref::Player[$pref::Player::Current] = setField( $pref::Player[$pref::Player::Current], 2, %this.realSkin[%id] );
|
|
else
|
|
$pref::Player[$pref::Player::Current] = setField( $pref::Player[$pref::Player::Current], 2, %text );
|
|
|
|
// Update the player model:
|
|
GMW_PlayerModel.update();
|
|
}
|
|
|
|
//------------------------------------------------------------------------------
|
|
// TRANSLATE these voice set display names:
|
|
$MaleVoiceCount = 0;
|
|
$MaleVoiceName[$MaleVoiceCount] = "Hero";
|
|
$MaleVoiceCount++;
|
|
$MaleVoiceName[$MaleVoiceCount] = "Iceman";
|
|
$MaleVoiceCount++;
|
|
$MaleVoiceName[$MaleVoiceCount] = "Rogue";
|
|
$MaleVoiceCount++;
|
|
$MaleVoiceName[$MaleVoiceCount] = "Hardcase";
|
|
$MaleVoiceCount++;
|
|
$MaleVoiceName[$MaleVoiceCount] = "Psycho";
|
|
$MaleVoiceCount++;
|
|
|
|
$FemaleVoiceCount = 0;
|
|
$FemaleVoiceName[$FemaleVoiceCount] = "Heroine";
|
|
$FemaleVoiceCount++;
|
|
$FemaleVoiceName[$FemaleVoiceCount] = "Professional";
|
|
$FemaleVoiceCount++;
|
|
$FemaleVoiceName[$FemaleVoiceCount] = "Cadet";
|
|
$FemaleVoiceCount++;
|
|
$FemaleVoiceName[$FemaleVoiceCount] = "Veteran";
|
|
$FemaleVoiceCount++;
|
|
$FemaleVoiceName[$FemaleVoiceCount] = "Amazon";
|
|
$FemaleVoiceCount++;
|
|
|
|
$DermVoiceCount = 0;
|
|
$DermVoiceName[$DermVoiceCount] = "Warrior";
|
|
$DermVoiceCount++;
|
|
$DermVoiceName[$DermVoiceCount] = "Monster";
|
|
$DermVoiceCount++;
|
|
$DermVoiceName[$DermVoiceCount] = "Predator";
|
|
$DermVoiceCount++;
|
|
|
|
//------------------------------------------------------------------------------
|
|
function GMW_VoicePopup::fillList( %this, %raceGender )
|
|
{
|
|
%this.clear();
|
|
|
|
switch ( %raceGender )
|
|
{
|
|
case 0: // Human Male
|
|
for ( %i = 0; %i < $MaleVoiceCount; %i++ )
|
|
%this.add( $MaleVoiceName[%i], %i );
|
|
|
|
case 1: // Human Female
|
|
for ( %i = 0; %i < $FemaleVoiceCount; %i++ )
|
|
%this.add( $FemaleVoiceName[%i], %i );
|
|
|
|
case 2: // Bioderm
|
|
for ( %i = 0; %i < $DermVoiceCount; %i++ )
|
|
%this.add( $DermVoiceName[%i], %i );
|
|
}
|
|
}
|
|
|
|
//------------------------------------------------------------------------------
|
|
function GMW_VoicePopup::onSelect( %this, %id, %text )
|
|
{
|
|
// Update the player pref:
|
|
switch ( GMW_RaceGenderPopup.getSelected() )
|
|
{
|
|
case 0: %base = "Male";
|
|
case 1: %base = "Fem";
|
|
case 2: %base = "Derm";
|
|
}
|
|
|
|
$pref::Player[$pref::Player::Current] = setField( $pref::Player[$pref::Player::Current], 3, %base @ ( %id + 1 ) );
|
|
|
|
%this.voiceIndex = 0;
|
|
}
|
|
|
|
//------------------------------------------------------------------------------
|
|
function GMW_VoicePitchSlider::setPitch(%this)
|
|
{
|
|
}
|
|
|
|
function GMW_VoicePopup::test( %this )
|
|
{
|
|
switch ( %this.voiceIndex )
|
|
{
|
|
case 0: %file = "gbl.hi";
|
|
case 1: %file = "gbl.brag";
|
|
case 2: %file = "gbl.woohoo";
|
|
case 3: %file = "gbl.rock";
|
|
case 4: %file = "gbl.obnoxious";
|
|
case 5: %file = "gbl.shazbot";
|
|
}
|
|
|
|
switch ( GMW_RaceGenderPopup.getSelected() )
|
|
{
|
|
case 0: %base = "Male";
|
|
case 1: %base = "Fem";
|
|
case 2: %base = "Derm";
|
|
}
|
|
|
|
GMW_VoiceTestBtn.setActive( false );
|
|
%voiceId = %this.getSelected() + 1;
|
|
%wav = "voice/" @ %base @ %voiceId @ "/" @ %file @ ".wav";
|
|
%handle = alxCreateSource( AudioGui, %wav );
|
|
|
|
//pitch the voice
|
|
//%pitchSliderVal = GMW_VoicePitchSlider.getValue();
|
|
//%pitch = getValidVoicePitch(%voiceId, %pitchSliderVal);
|
|
//if (%pitch != 1.0)
|
|
// alxSourcef(%handle, "AL_PITCH", %pitch);
|
|
|
|
alxPlay( %handle );
|
|
|
|
%delay = alxGetWaveLen( %wav );
|
|
schedule( %delay, 0, "restoreVoiceTestButton" );
|
|
|
|
if ( %this.voiceIndex == 5 )
|
|
%this.voiceIndex = 0;
|
|
else
|
|
%this.voiceIndex++;
|
|
}
|
|
|
|
//------------------------------------------------------------------------------
|
|
function restoreVoiceTestButton()
|
|
{
|
|
GMW_VoiceTestBtn.setActive( true );
|
|
}
|
|
|
|
//------------------------------------------------------------------------------
|
|
function NewWarriorDlg::createPlayer( %this )
|
|
{
|
|
%name = stripTrailingSpaces( NW_NameEdit.getValue() );
|
|
$pref::Player[$pref::Player::Count] = %name @ "\tHuman Male\tbeagle\tMale1";
|
|
$pref::Player::Current = $pref::Player::Count;
|
|
$pref::Player::Count++;
|
|
Canvas.popDialog( NewWarriorDlg );
|
|
GM_WarriorPane.onActivate(); // Refresh the warrior gui
|
|
}
|
|
|
|
//------------------------------------------------------------------------------
|
|
function NW_NameEdit::checkValidPlayerName( %this )
|
|
{
|
|
%name = %this.getValue();
|
|
%test = strToPlayerName( %name );
|
|
if ( %name !$= %test )
|
|
%this.setValue( %test );
|
|
|
|
NW_DoneBtn.setActive( strlen( stripTrailingSpaces( %test ) ) > 2 );
|
|
}
|
|
|
|
//------------------------------------------------------------------------------
|
|
function NW_NameEdit::processEnter( %this )
|
|
{
|
|
%this.checkValidPlayerName();
|
|
if ( NW_DoneBtn.isActive() )
|
|
NewWarriorDlg.createPlayer();
|
|
}
|