1
0
forked from 0ad/0ad

The game loading was broken, and I fixed it! Wahooo, my first venture into the world of GUI scripting.

This was SVN commit r2479.
This commit is contained in:
Wijitmaker 2005-07-11 04:52:20 +00:00
parent 0342f01580
commit a96fd84391
2 changed files with 17 additions and 3 deletions

View File

@ -777,8 +777,7 @@
size="50%-100 100%-50 50%-10 100%-20" size="50%-100 100%-50 50%-10 100%-20"
>Start Game >Start Game
<action on="Press"><![CDATA[ <action on="Press"><![CDATA[
StartMap (getGUIObjectByName("pregame_sp_mapname").caption, StartMap ("MapName","pregame_sp_mapsel", 0);
"pregame_sp_mapsel", 0);
]]></action> ]]></action>
</object> </object>

View File

@ -9,23 +9,36 @@ function StartMap (MapName, OpenWindow, GameMode)
// 1: MP // 1: MP
// Check whether we have a correct file extension, to avoid crashes // Check whether we have a correct file extension, to avoid crashes
MapName = getGUIObjectByName("pregame_sp_mapname").caption;
Extension = MapName.substring(MapName.length, MapName.length-4); Extension = MapName.substring(MapName.length, MapName.length-4);
if (Extension != ".pmp") if (Extension != ".pmp")
{ {
// Add .pmp to the file name - shouldn't help if the name is mistyped, but may be useful in some cases. // Add .pmp to the file name - shouldn't help if the name is mistyped, but may be useful in some cases.
MapName = MapName + ".pmp"; MapName = MapName + ".pmp";
console.write("Trying to fix the map name (probably missing extension).");
} }
else {console.write("Map Name Inputed Correctly");}
// Close setup window // Close setup window
CloseMainMenuSubWindow (OpenWindow); CloseMainMenuSubWindow (OpenWindow);
console.write("Closed Setup Window");
// Set up game // Set up game
g_GameAttributes.mapFile = MapName; g_GameAttributes.mapFile = MapName;
console.write("Setting Up Players");
if (GameMode == "0") if (GameMode == "0")
{ {
// Set up a bunch of players so we can see them pretty colours. :P // Set up a bunch of players so we can see them pretty colours. :P
setupSPPlayers(); setupSPPlayers();
} }
else {console.write("Players Failed Setup");}
console.write("Players are now Set Up");
startLoadingScreen(); startLoadingScreen();
} }
@ -49,8 +62,10 @@ function setupSPPlayers()
function startLoadingScreen() function startLoadingScreen()
{ {
// Switch screens from main menu to loading screen. // Switch screens from main menu to loading screen.
GUIObjectHide("PREGAME_GUI"); GUIObjectHide("pregame_gui");
console.write("Pre Game User Interface is now Hidden");
GUIObjectUnhide("loading_screen"); GUIObjectUnhide("loading_screen");
console.write("Loading Screen is now Loaded");
console.write("Loading " + g_GameAttributes.mapFile + " (" + g_GameAttributes.numPlayers + " players) ..."); console.write("Loading " + g_GameAttributes.mapFile + " (" + g_GameAttributes.numPlayers + " players) ...");
// Generate random number for random concept art (should be depending on the selected civ later) // Generate random number for random concept art (should be depending on the selected civ later)