1
0
forked from 0ad/0ad

Made objects relative by default, cutting down on some redundant properties. Cleaned up loading screen script.

This was SVN commit r2500.
This commit is contained in:
Acumen 2005-07-20 23:00:48 +00:00
parent c3cf031a52
commit eed104e139
13 changed files with 577 additions and 390 deletions

View File

@ -6,14 +6,15 @@
<!-- <!--
========================================== ==========================================
- MAIN MENU - SHELL - MAIN MENU - "COMMANDER'S TENT" BACKDROP
========================================== ==========================================
--> -->
<object <object name="pregame_gui"
name="pregame_gui" style="default"
style="empty" type="image"
type="empty" absolute="true"
sprite="pregame_mainmenu_background"
> >
<action on="Load"><![CDATA[ <action on="Load"><![CDATA[
// Play main 0 A.D. theme when the main menu starts. // Play main 0 A.D. theme when the main menu starts.
@ -21,18 +22,6 @@
curr_music.loop(); curr_music.loop();
]]></action> ]]></action>
<!--
==========================================
- MAIN MENU - "COMMANDER'S TENT" BACKDROP
==========================================
-->
<object name="pregame_mainmenu_bkg"
style="backdrop"
type="image"
sprite="pregame_mainmenu_background"
/>
<!-- <!--
========================================== ==========================================
- MAIN MENU - PARCHMENT BUTTONS - MAIN MENU - PARCHMENT BUTTONS
@ -146,8 +135,7 @@
========================================== ==========================================
--> -->
<object <object name="exit_button"
name="exit_button"
style="pregame_mainmenu_checkbox" style="pregame_mainmenu_checkbox"
type="button" type="button"
size="100%-18 2 100%-2 18" size="100%-18 2 100%-2 18"
@ -161,11 +149,6 @@
</object> </object>
</object> </object>
<object name="pregame_subwindows"
style="empty"
type="empty"
>
<!-- <!--
========================================== ==========================================
- MAIN MENU - BACKGROUND MASK - MAIN MENU - BACKGROUND MASK
@ -173,13 +156,12 @@
--> -->
<object name="pregame_subwindow_bkg" <object name="pregame_subwindow_bkg"
style="backdrop"
type="image" type="image"
ghost="false" z="90"
absolute="true"
hidden="true" hidden="true"
sprite="translucent_background" sprite="translucent_background"
/> >
<!-- <!--
=============================================== ===============================================
- MULTIPLAYER MODE SELECTION SCREEN - - MULTIPLAYER MODE SELECTION SCREEN -
@ -215,14 +197,12 @@
<object name="pregame_mp_modesel_txt1" <object name="pregame_mp_modesel_txt1"
type="text" type="text"
absolute="false"
size="0 0 400 30" size="0 0 400 30"
>Please enter the Player name you would like to use during the game. >Please enter the Player name you would like to use during the game.
</object> </object>
<object name="pregame_mp_modesel_playername_txt" <object name="pregame_mp_modesel_playername_txt"
type="text" type="text"
absolute="false"
size="0 40 200 60" size="0 40 200 60"
>Player Name (temporary): >Player Name (temporary):
</object> </object>
@ -230,7 +210,6 @@
<object name="pregame_mp_modesel_playername" <object name="pregame_mp_modesel_playername"
style="border_box_black" style="border_box_black"
type="input" type="input"
absolute="false"
size="220 40 350 60" size="220 40 350 60"
>Player >Player
</object> </object>
@ -238,7 +217,6 @@
<object name="pregame_mp_modesel_divider1" <object name="pregame_mp_modesel_divider1"
style="border_box_black" style="border_box_black"
type="image" type="image"
absolute="false"
size="10 80 100%-10 80" size="10 80 100%-10 80"
/> />
@ -250,7 +228,6 @@
<object name="pregame_mp_modesel_txt" <object name="pregame_mp_modesel_txt"
type="text" type="text"
absolute="false"
size="0 100 400 120" size="0 100 400 120"
>Please select whether you want to join a game or host your own game. >Please select whether you want to join a game or host your own game.
</object> </object>
@ -258,7 +235,6 @@
<object name="pregame_mp_modesel_hostjoin_txt" <object name="pregame_mp_modesel_hostjoin_txt"
style="text_tahoma16_black" style="text_tahoma16_black"
type="text" type="text"
absolute="false"
size="0 140 200 170" size="0 140 200 170"
text_valign="center" text_valign="center"
>Game Mode >Game Mode
@ -271,7 +247,7 @@
>Join Game >Join Game
<action on="Press"><![CDATA[ <action on="Press"><![CDATA[
// rudimentary client connection code; finally working now :) // rudimentary client connection code; finally working now :)
SwitchMainMenuSubWindow ("pregame_mp_modesel", "pregame_mp_join"); SwitchWindow ("pregame_mp_modesel", "pregame_mp_join");
]]></action> ]]></action>
</object> </object>
@ -283,7 +259,7 @@
size="250 140 350 170" size="250 140 350 170"
>Host Game >Host Game
<action on="Press"><![CDATA[ <action on="Press"><![CDATA[
SwitchMainMenuSubWindow ("pregame_mp_modesel", "pregame_mp_host"); SwitchWindow ("pregame_mp_modesel", "pregame_mp_host");
]]></action> ]]></action>
</object> </object>
@ -324,7 +300,6 @@
<object name="pregame_mp_host_txt1" <object name="pregame_mp_host_txt1"
type="text" type="text"
absolute="false"
size="0 0 400 30" size="0 0 400 30"
>Setting up your server. >Setting up your server.
</object> </object>
@ -332,7 +307,6 @@
<object name="pregame_mp_host_gamename_txt" <object name="pregame_mp_host_gamename_txt"
style="text_tahoma16_black" style="text_tahoma16_black"
type="text" type="text"
absolute="false"
size="0 40 200 60" size="0 40 200 60"
>Game (Server) Name: >Game (Server) Name:
</object> </object>
@ -340,7 +314,6 @@
<object name="pregame_mp_host_gamename" <object name="pregame_mp_host_gamename"
style="border_box_black" style="border_box_black"
type="input" type="input"
absolute="false"
size="220 40 370 60" size="220 40 370 60"
>My Game >My Game
</object> </object>
@ -354,14 +327,12 @@
<object name="pregame_mp_host_welcomemsg_txt" <object name="pregame_mp_host_welcomemsg_txt"
style="text_tahoma16_black" style="text_tahoma16_black"
type="text" type="text"
absolute="false"
size="0 70 200 90" size="0 70 200 90"
>Welcome Message: >Welcome Message:
</object> </object>
<object name="pregame_mp_host_txt2" <object name="pregame_mp_host_txt2"
type="text" type="text"
absolute="false"
size="0 100 200 180" size="0 100 200 180"
>You can enter some message which is displayed to new players upon joining here. >You can enter some message which is displayed to new players upon joining here.
</object> </object>
@ -369,7 +340,6 @@
<object name="pregame_mp_host_welcomemsg" <object name="pregame_mp_host_welcomemsg"
style="border_box_black_verdana9" style="border_box_black_verdana9"
type="input" type="input"
absolute="false"
size="220 70 370 180" size="220 70 370 180"
>Uhm, welcome to my game. Have fun! >Uhm, welcome to my game. Have fun!
</object> </object>
@ -387,7 +357,7 @@
>Continue >Continue
<action on="Press"><![CDATA[ <action on="Press"><![CDATA[
gameName = getGUIObjectByName("pregame_mp_host_gamename").caption; gameName = getGUIObjectByName("pregame_mp_host_gamename").caption;
SwitchMainMenuSubWindow ("pregame_mp_host", "pregame_mp_setup_host"); SwitchWindow ("pregame_mp_host", "pregame_mp_setup_host");
GUIObjectHide("pregame_mainmenu_versionnumber"); GUIObjectHide("pregame_mainmenu_versionnumber");
// Set up the server // Set up the server
@ -422,7 +392,7 @@
size="50%+25 200 50%+125 230" size="50%+25 200 50%+125 230"
>Back >Back
<action on="Press"><![CDATA[ <action on="Press"><![CDATA[
SwitchMainMenuSubWindow ("pregame_mp_host", "pregame_mp_modesel"); SwitchWindow ("pregame_mp_host", "pregame_mp_modesel");
]]></action> ]]></action>
</object> </object>
</object> </object>
@ -462,7 +432,6 @@
<object name="pregame_mp_join_txt1" <object name="pregame_mp_join_txt1"
type="text" type="text"
absolute="false"
size="0 0 400 30" size="0 0 400 30"
>Joining an existing game. >Joining an existing game.
</object> </object>
@ -470,7 +439,6 @@
<object name="pregame_mp_join_serverip_txt" <object name="pregame_mp_join_serverip_txt"
style="text_tahoma16_black" style="text_tahoma16_black"
type="text" type="text"
absolute="false"
size="0 40 200 60" size="0 40 200 60"
>Server Hostname or IP: >Server Hostname or IP:
</object> </object>
@ -478,7 +446,6 @@
<object name="pregame_mp_join_serverip" <object name="pregame_mp_join_serverip"
style="border_box_black" style="border_box_black"
type="input" type="input"
absolute="false"
size="220 40 370 60" size="220 40 370 60"
>127.0.0.1 >127.0.0.1
</object> </object>
@ -520,7 +487,7 @@
size="50%+25 200 50%+125 230" size="50%+25 200 50%+125 230"
>Back >Back
<action on="Press"><![CDATA[ <action on="Press"><![CDATA[
SwitchMainMenuSubWindow ("pregame_mp_join", "pregame_mp_modesel"); SwitchWindow ("pregame_mp_join", "pregame_mp_modesel");
]]></action> ]]></action>
</object> </object>
</object> </object>
@ -566,7 +533,6 @@
<object name="pregame_mp_setup_host_playerhead" <object name="pregame_mp_setup_host_playerhead"
style="text_giovanni22bold_black" style="text_giovanni22bold_black"
type="text" type="text"
absolute="false"
size="30 10 320 40" size="30 10 320 40"
>Player Slots >Player Slots
</object> </object>
@ -574,7 +540,6 @@
<object name="pregame_mp_setup_host_p1_txt" <object name="pregame_mp_setup_host_p1_txt"
style="text_tahoma16_black" style="text_tahoma16_black"
type="text" type="text"
absolute="false"
size="30 50 320 80" size="30 50 320 80"
> >
<action on="Load"><![CDATA[ <action on="Load"><![CDATA[
@ -585,7 +550,6 @@
<object name="pregame_mp_setup_host_p2_txt" <object name="pregame_mp_setup_host_p2_txt"
style="text_tahoma16_black" style="text_tahoma16_black"
type="text" type="text"
absolute="false"
size="30 90 320 120" size="30 90 320 120"
> >
<action on="Load"><![CDATA[ <action on="Load"><![CDATA[
@ -596,7 +560,6 @@
<object name="pregame_mp_setup_host_p3_txt" <object name="pregame_mp_setup_host_p3_txt"
style="text_tahoma16_black" style="text_tahoma16_black"
type="text" type="text"
absolute="false"
size="30 130 320 160" size="30 130 320 160"
> >
<action on="Load"><![CDATA[ <action on="Load"><![CDATA[
@ -607,7 +570,6 @@
<object name="pregame_mp_setup_host_p4_txt" <object name="pregame_mp_setup_host_p4_txt"
style="text_tahoma16_black" style="text_tahoma16_black"
type="text" type="text"
absolute="false"
size="30 170 320 200" size="30 170 320 200"
> >
<action on="Load"><![CDATA[ <action on="Load"><![CDATA[
@ -618,7 +580,6 @@
<object name="pregame_mp_setup_host_p5_txt" <object name="pregame_mp_setup_host_p5_txt"
style="text_tahoma16_black" style="text_tahoma16_black"
type="text" type="text"
absolute="false"
size="30 210 320 240" size="30 210 320 240"
> >
<action on="Load"><![CDATA[ <action on="Load"><![CDATA[
@ -629,7 +590,6 @@
<object name="pregame_mp_setup_host_p6_txt" <object name="pregame_mp_setup_host_p6_txt"
style="text_tahoma16_black" style="text_tahoma16_black"
type="text" type="text"
absolute="false"
size="30 250 320 280" size="30 250 320 280"
> >
<action on="Load"><![CDATA[ <action on="Load"><![CDATA[
@ -640,7 +600,6 @@
<object name="pregame_mp_setup_host_p7_txt" <object name="pregame_mp_setup_host_p7_txt"
style="text_tahoma16_black" style="text_tahoma16_black"
type="text" type="text"
absolute="false"
size="30 290 320 320" size="30 290 320 320"
> >
<action on="Load"><![CDATA[ <action on="Load"><![CDATA[
@ -651,7 +610,6 @@
<object name="pregame_mp_setup_host_p8_txt" <object name="pregame_mp_setup_host_p8_txt"
style="text_tahoma16_black" style="text_tahoma16_black"
type="text" type="text"
absolute="false"
size="30 330 320 360" size="30 330 320 360"
> >
<action on="Load"><![CDATA[ <action on="Load"><![CDATA[
@ -667,7 +625,6 @@
<object name="pregame_mp_setup_host_mapname_txt" <object name="pregame_mp_setup_host_mapname_txt"
type="text" type="text"
absolute="false"
size="400 32 590 52" size="400 32 590 52"
>Map name: >Map name:
</object> </object>
@ -675,7 +632,6 @@
<object name="pregame_mp_setup_host_mapname" <object name="pregame_mp_setup_host_mapname"
style="border_box_black" style="border_box_black"
type="input" type="input"
absolute="false"
size="600 32 750 52" size="600 32 750 52"
>gathertest >gathertest
</object> </object>
@ -703,7 +659,7 @@
size="50%+25 540 50%+125 570" size="50%+25 540 50%+125 570"
>Cancel >Cancel
<action on="Press"><![CDATA[ <action on="Press"><![CDATA[
SwitchMainMenuSubWindow ("pregame_mp_setup_host", "pregame_mp_modesel"); SwitchWindow ("pregame_mp_setup_host", "pregame_mp_modesel");
]]></action> ]]></action>
</object> </object>
</object> </object>
@ -746,14 +702,12 @@
<object name="pregame_sp_infotext" <object name="pregame_sp_infotext"
type="text" type="text"
absolute="false"
size="10 10 290 60" size="10 10 290 60"
>Type the name of the map you want to start into the box. The name is relative to /data/mods/official/maps/scenarios/. >Type the name of the map you want to start into the box. The name is relative to /data/mods/official/maps/scenarios/.
</object> </object>
<object name="pregame_sp_mapname_txt" <object name="pregame_sp_mapname_txt"
type="text" type="text"
absolute="false"
size="10 90 120 110" size="10 90 120 110"
>Map Name: >Map Name:
</object> </object>
@ -761,7 +715,6 @@
<object name="pregame_sp_mapname" <object name="pregame_sp_mapname"
style="border_box_black" style="border_box_black"
type="input" type="input"
absolute="false"
size="130 90 290 110" size="130 90 290 110"
>gathertest2 >gathertest2
</object> </object>
@ -793,7 +746,6 @@
]]></action> ]]></action>
</object> </object>
</object> </object>
</object> </object>
</objects> </objects>

View File

@ -4,56 +4,113 @@
<!-- <!--
========================================== ==========================================
- LOADING SCREEN DEFINITION - - LOADING SCREEN -
========================================== ==========================================
--> -->
<objects> <objects>
<object type="empty" name="loading_screen" size="0 0 100% 100%" z="1" ghost="true" hidden="true"> <object name="loading_screen"
<!-- background --> absolute="true"
<object type="image" name="loading_screen_background_black" sprite="black_bkg" size="0 0 100% 10" z="99" hidden="false" /> hidden="true"
<object type="image" name="loading_screen_background_image" sprite="message_box_gen_background" size="0 10 100% 100%" z="100" hidden="false" /> >
<!-- top --> <!--
<object type="image" name="loading_screen_border_corner_lt" size="0 10 15 25" sprite="message_box_corner" absolute="false" z="161" hidden="false"/> ==========================================
<object type="image" name="loading_screen_border_top" size="15 10 100%-15 42" sprite="message_box_border_top" absolute="false" z="161" hidden="false"/> - BLACK BACKGROUND AT LOWEST Z LEVEL
<object type="image" name="loading_screen_border_corner_rt" size="100%-15 10 100% 25" sprite="message_box_corner" absolute="false" z="161" hidden="false"/> ==========================================
-->
<!-- left/right --> <object name="backdrop_mask"
<object type="image" name="loading_screen_border_left" size="0 25 20 100%-15" sprite="message_box_border_left" absolute="false" z="162" hidden="false"/> absolute="true"
<object type="image" name="loading_screen_border_right" size="100%-32 25 100% 100%-15" sprite="message_box_border_right" absolute="false" z="161" hidden="false"/> type="image"
sprite="black"
/>
<!-- bottom --> <!--
<object type="image" name="loading_screen_border_corner_lb" size="0 100%-15 15 100%" sprite="message_box_corner" absolute="false" z="161" hidden="false"/> ==========================================
<object type="image" name="loading_screen_border_bottom" size="15 100%-32 100%-15 100%" sprite="message_box_border_bottom" absolute="false" z="162" hidden="false"/> - LOADING SCREEN - WINDOW
<object type="image" name="loading_screen_border_corner_rb" size="100%-15 100%-15 100% 100%" sprite="message_box_corner" absolute="false" z="161" hidden="false"/> ==========================================
-->
<!-- titlebar --> <object name="loading_screen_window"
<object type="image" name="loading_screen_titlebar_left" size="15% 0 15%+64 32" sprite="message_box_titlebar_left" absolute="false" z="164" hidden="false"/> style="0ad_window"
<object type="image" name="loading_screen_titlebar_middle" size="15%+64 0 85%-64 32" sprite="message_box_titlebar_middle" absolute="false" z="164" hidden="false"/> type="image"
<object type="image" name="loading_screen_titlebar_right" size="85%-64 0 85% 32" sprite="message_box_titlebar_right" absolute="false" z="164" hidden="false"/> size="30 35 100%-30 100%-30"
<object type="button" name="loading_screen_titlebar_text" size="15%+54 4 85%-54 32" absolute="false" font="prospero18" z="165" text_align="center" text_valign="center" hidden="false"/> >
<object name="loading_screen_titlebar"
style="0ad_window_titlebar"
type="button"
/>
<!-- progress bar --> <!--
<object type="button" name="loading_screen_progress_bar_text" size="0%+32 100%-205 100%-32 100%-185" font="tahoma14" textcolor="0 0 0" text_align="center" text_valign="center" z="165" hidden="false"> ==========================================
<action on="Progress"> - LOADING SCREEN - TEXT
==========================================
-->
<object name="loading_screen_text"
type="text"
size="23.571428% 40 100%-32 100%-100"
font="prospero18"
/>
<!--
==========================================
- LOADING SCREEN - CONCEPT ART
==========================================
-->
<object name="loading_screen_background_concept"
type="image"
size="32 32 33.3008%+32 88.9323%+32"
sprite="black_bkg"
/>
<!--
==========================================
- LOADING SCREEN - PROGRESSBAR
==========================================
-->
<object name="loading_screen_progress_bar_text"
type="text"
size="0%+32 100%-205 100%-32 100%-185"
font="tahoma14"
textcolor="0 0 0"
text_align="center"
text_valign="center"
>
<action on="Progress"><![CDATA[
this.caption = g_LoadDescription; this.caption = g_LoadDescription;
</action> ]]></action>
</object> </object>
<object type="progressbar" name="loading_screen_progress_bar" style="blue_bar_outlined" size="0%+32 100%-185 100%-32 100%-160" z="165" hidden="false">
<action on="Progress"> <object name="loading_screen_progress_bar"
style="blue_bar_outlined"
type="progressbar"
size="0%+32 100%-185 100%-32 100%-160"
>
<action on="Progress"><![CDATA[
this.caption = g_Progress; this.caption = g_Progress;
</action> ]]></action>
</object> </object>
<!-- concept image --> <!--
<object type="image" name="loading_screen_background_concept" sprite="black_bkg" size="32 32 33.3008%+32 88.9323%+32" z="110" hidden="false" /> ==========================================
- LOADING SCREEN - TIP
<!-- text --> ==========================================
<object type="text" name="loading_screen_text" size="23.571428% 40 100%-32 100%-100" absolute="false" font="prospero18" z="165" hidden="false"/> -->
<object name="loading_screen_tip"
<object type="text" name="loading_screen_tip" sprite="0ad_indent_lite" size="32 100%-150 100%-32 100%-32" font="trebuchet16" text_align="left" text_valign="center" textcolor="0 0 0" z="165" hidden="false"/> type="text"
size="32 100%-150 100%-32 100%-32"
textcolor="0 0 0"
font="trebuchet16"
text_align="left"
text_valign="center"
sprite="0ad_indent_lite"
/>
</object>
</object> </object>
</objects> </objects>

View File

@ -10,7 +10,7 @@
<objects> <objects>
<object type="empty" name="SESSION_GUI" hotkey="flipgui.toggle" size="0 0 100% 100%" z="1" hidden="true"> <object type="empty" absolute="true" name="session_gui" hotkey="flipgui.toggle" size="0 0 100% 100%" z="1" hidden="true">
<action on="Press"><![CDATA[ <action on="Press"><![CDATA[
FlipGUI(); FlipGUI();
]]></action> ]]></action>

View File

@ -10,7 +10,7 @@
<objects> <objects>
<object type="empty" name="MANUAL_GUI" size="0 0 100% 100%" z="1" hotkey="onlinehelp" hidden="true"> <object absolute="true" type="empty" name="MANUAL_GUI" size="0 0 100% 100%" z="1" hotkey="onlinehelp" hidden="true">
<action on="Press"><![CDATA[ <action on="Press"><![CDATA[
// Toggle manual if something selected. // Toggle manual if something selected.
if (selection.length) if (selection.length)

View File

@ -10,7 +10,7 @@
<objects> <objects>
<object type="empty" name="JUKEBOX_GUI" size="0 0 100% 100%" z="1" hidden="true"> <object absolute="true" type="empty" name="JUKEBOX_GUI" size="0 0 100% 100%" z="1" hidden="true">
<object type="text" name="JUKEBOX_BKG" sprite="0ad_window" font="prospero16" textcolor="0 0 0" hidden="false" ghost="true"><action on="Load"><![CDATA[ setSizeArray(this.name, Crd[JUKEBOX_BKG]); ]]></action> <object type="text" name="JUKEBOX_BKG" sprite="0ad_window" font="prospero16" textcolor="0 0 0" hidden="false" ghost="true"><action on="Load"><![CDATA[ setSizeArray(this.name, Crd[JUKEBOX_BKG]); ]]></action>
<action on="Tick"><![CDATA[ <action on="Tick"><![CDATA[

View File

@ -10,7 +10,7 @@
<objects> <objects>
<object type="empty" name="atlas_gui" size="0 0 100% 100%" z="1" hidden="true"> <object absolute="true" type="empty" name="atlas_gui" size="0 0 100% 100%" z="1" hidden="true">
<!-- Simply black out the lowest level of the GUI, until such time as we're capable of starting an editor session of a scenario. --> <!-- Simply black out the lowest level of the GUI, until such time as we're capable of starting an editor session of a scenario. -->
<object type="text" name="ATLAS_GUI_BKG" sprite="black" size="0 0 100% 100%" z="1" ghost="true" /> <object type="text" name="ATLAS_GUI_BKG" sprite="black" size="0 0 100% 100%" z="1" ghost="true" />

View File

@ -10,7 +10,7 @@
========================================== ==========================================
--> -->
<object type="empty" name="always_on" hotkey="alwayson.toggle" size="0 0 100% 100%" z="1" hidden="false"> <object absolute="true" type="empty" name="always_on" hotkey="alwayson.toggle" size="0 0 100% 100%" z="1" hidden="false">
<action on="Press"><![CDATA[ <action on="Press"><![CDATA[
GUIObjectToggle("always_on"); GUIObjectToggle("always_on");
]]></action> ]]></action>

View File

@ -23,16 +23,6 @@ function CloseMainMenuSubWindow(WindowName)
// ==================================================================== // ====================================================================
function SwitchMainMenuSubWindow(CloseWindowName, OpenWindowName)
{
// Helper function that closes a given window (usually the current parent) and opens another one.
GUIObjectHide (CloseWindowName);
GUIObjectUnhide (OpenWindowName);
}
// ====================================================================
function initPreGame() function initPreGame()
{ {
} }

View File

@ -17,56 +17,42 @@ function StartMap (MapName, OpenWindow, GameMode)
MapName = MapName + ".pmp"; MapName = MapName + ".pmp";
console.write ("Trying to fix the map name (probably missing extension)."); console.write ("Trying to fix the map name (probably missing extension).");
} }
else
console.write ("Map Name Input Correctly");
// Close setup window
CloseMainMenuSubWindow (OpenWindow);
console.write ("Closed Setup Window");
// Set up game // Set up game
g_GameAttributes.mapFile = MapName; g_GameAttributes.mapFile = MapName;
if (GameMode == "0") // Close setup window
{ CloseMainMenuSubWindow (OpenWindow);
// Set up a bunch of players so we can see them pretty colours. :P
console.write ("Setting Up Temporary Single Players");
setupSPPlayers();
}
startLoadingScreen(); // Display loading screen.
} StartLoadingScreen();
// ==================================================================== // Begin game session.
if (! startGame())
// HACK: This replaces the old numPlayers hack to set up a bunch of sample
// players in SP games to show off some player colours and fights
function setupSPPlayers()
{ {
// The first player is by default allocated to the local player in SP, so // Failed to start the game; go back to the main menu.
// adding 7 players means that we'll have 8 players in total GUIObjectHide ("loading_screen");
for (i=0;i<7;i++) GUIObjectUnhide ("pregame_gui");
{ // Show an error message
g_GameAttributes.slots[i+1].assignLocal(); btCaptions = new Array("OK");
console.write("Slot "+(i+1)+" is assigned: "+g_GameAttributes.slots[i+1].assignment); btCode = new Array("");
messageBox(400, 200, "The game could not be started with the given parameters. You probably have entered an invalid map name.", "Error", 0, btCaptions, btCode);
} }
} }
// ==================================================================== // ====================================================================
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)
randvar = getRandom(1, 6); RandVar = getRandom(1, 6);
switch (randvar) { switch (RandVar) {
case 1: case 1:
sprite = "load_concept_he"; sprite = "load_concept_he";
break; break;
@ -92,7 +78,7 @@ function startLoadingScreen()
// janwas: main loop now sets progress / description, but that won't // janwas: main loop now sets progress / description, but that won't
// happen until the first timeslice completes, so set initial values. // happen until the first timeslice completes, so set initial values.
getGUIObjectByName("loading_screen_titlebar_text").caption = "Loading Scenario ..."; getGUIObjectByName ("loading_screen_titlebar").caption = "Loading Scenario ...";
getGUIObjectByName ("loading_screen_progress_bar_text").caption = ""; getGUIObjectByName ("loading_screen_progress_bar_text").caption = "";
getGUIObjectByName ("loading_screen_progress_bar").caption = 0; getGUIObjectByName ("loading_screen_progress_bar").caption = 0;
getGUIObjectByName ("loading_screen_text").caption = "LOADING " + g_GameAttributes.mapFile + " ...\nPlease wait ..."; getGUIObjectByName ("loading_screen_text").caption = "LOADING " + g_GameAttributes.mapFile + " ...\nPlease wait ...";
@ -101,27 +87,50 @@ function startLoadingScreen()
tipArray = readFileLines("gui/text/tips.txt"); tipArray = readFileLines("gui/text/tips.txt");
// Set tip string. // Set tip string.
getGUIObjectByName ("loading_screen_tip").caption = tipArray[getRandom(0, tipArray.length-1)]; getGUIObjectByName ("loading_screen_tip").caption = tipArray[getRandom(0, tipArray.length-1)];
// Begin game session.
if (! startGame())
{
// Failed to start the game; go back to the main menu.
GUIObjectHide("loading_screen");
GUIObjectUnhide("PREGAME_GUI");
// Show an error message
btCaptions = new Array("OK");
btCode = new Array("");
messageBox(400, 200, "The game could not be started with the given parameters. You probably have entered an invalid map name.", "Error", 0, btCaptions, btCode);
}
} }
// ==================================================================== // ====================================================================
function reallyStartGame() function reallyStartGame()
{ {
// Create resource pools for each player, etc. // This is a reserved function name that is executed by the engine when it is ready
setupSession(); // to start the game (ie loading progress has reached 100%).
// Create resource pools for each player, etc.
SetupSession();
// Switch GUI from loading screen to game session.
SwitchWindow ("loading_screen", "session_gui");
}
// ====================================================================
function SetupSession (GameMode)
{
// GameMode: 0: SP
// 1: MP
// Do essentials that can only be done when the session has been loaded ...
// For example, create the resource types, scores, etc, for each player.
// Initialise Resource Pools by attaching them to the Player object.
// (CPlayer code takes care of giving a copy to each player.)
CreateResources();
/*
if (GameMode == "0")
{
// Set up a bunch of players so we can see them pretty colours. :P
console.write ("Setting Up Temporary Single Players");
// The first player is by default allocated to the local player in SP, so
// adding 7 players means that we'll have 8 players in total
for (i=0; i<7; i++)
{
g_GameAttributes.slots[i+1].assignLocal();
console.write ("Slot "+(i+1)+" is assigned: " + g_GameAttributes.slots[i+1].assignment);
}
}
*/
// Set starting UI layout.
FlipGUI(GUIType); FlipGUI(GUIType);
// Select session peace track. // Select session peace track.
@ -131,32 +140,17 @@ function reallyStartGame()
// janwas: greatly accelerate this timesink; // janwas: greatly accelerate this timesink;
// will be replaced soon by native version that doesn't block. // will be replaced soon by native version that doesn't block.
// Switch GUI from main menu to game session.
GUIObjectHide("loading_screen");
GUIObjectUnhide("SESSION_GUI");
}
// ====================================================================
function setupSession()
{
// Do essentials that can only be done when the session has been loaded ...
// For example, create the resource types.
// Initialise Resource Pools by attaching them to the Player object.
// (CPlayer code takes care of giving a copy to each player.)
CreateResources();
// Start refreshing the session controls. // Start refreshing the session controls.
setInterval( getObjectInfo, 1, 100 ); setInterval( getObjectInfo, 1, 100 );
} }
// ==================================================================== // ====================================================================
function endSession(closeType) function EndSession (CloseType)
{ {
// Occurs when the player chooses to close the current game. // Occurs when the player chooses to close the current game.
switch (closeType) switch (CloseType)
{ {
case ("return"): case ("return"):
// If the player has chosen to quit game and return to main menu, // If the player has chosen to quit game and return to main menu,
@ -171,8 +165,8 @@ function endSession(closeType)
// will be replaced soon by native version that doesn't block. // will be replaced soon by native version that doesn't block.
// Swap GUIs to display main menu. // Swap GUIs to display main menu.
GUIObjectHide('SESSION_GUI'); GUIObjectHide ("session_gui");
GUIObjectUnhide('PREGAME_GUI'); GUIObjectUnhide ("pregame_gui");
break; break;
case ("exit"): case ("exit"):
// If the player has chosen to shutdown and immediately return to operating system, // If the player has chosen to shutdown and immediately return to operating system,

View File

@ -239,7 +239,7 @@ function FlipGUI(NewGUIType)
if (GUIType != "none") if (GUIType != "none")
{ {
GUIObjectUnhide("SESSION_GUI"); GUIObjectUnhide("session_gui");
GUIObjectUnhide("always_on"); GUIObjectUnhide("always_on");
// Seek through all sizes created. // Seek through all sizes created.
@ -307,7 +307,7 @@ function FlipGUI(NewGUIType)
} }
else else
{ {
GUIObjectHide("SESSION_GUI"); GUIObjectHide("session_gui");
GUIObjectHide("always_on"); GUIObjectHide("always_on");
} }

View File

@ -71,3 +71,15 @@ function GUIObjectSetCaption(objectName, objectCaption)
GUIObject.caption = objectCaption; GUIObject.caption = objectCaption;
} }
// ====================================================================
function SwitchWindow(CloseWindowName, OpenWindowName)
{
// Helper function that closes a given window (usually the current parent) and opens another one.
GUIObjectHide (CloseWindowName);
GUIObjectUnhide (OpenWindowName);
}
// ====================================================================

View File

@ -3,7 +3,15 @@
<!DOCTYPE setup SYSTEM "..\gui.dtd"> <!DOCTYPE setup SYSTEM "..\gui.dtd">
<setup> <setup>
<scrollbar name="sb" width="18" minimum_bar_size="5" <!--
==========================================
- SETUP - SCROLLBARS
==========================================
-->
<scrollbar name="sb"
width="18"
minimum_bar_size="5"
sprite_button_top="sprite2" sprite_button_top="sprite2"
sprite_button_top_over="null" sprite_button_top_over="null"
sprite_button_bottom="sprite2" sprite_button_bottom="sprite2"
@ -16,7 +24,9 @@
sprite_button_top_pressed="sprite2_pressed" sprite_button_top_pressed="sprite2_pressed"
/> />
<scrollbar name="sb2" width="37" minimum_bar_size="5" <scrollbar name="sb2"
width="37"
minimum_bar_size="5"
sprite_button_top="scroll" sprite_button_top="scroll"
sprite_button_top_over="null" sprite_button_top_over="null"
sprite_button_bottom="scroll" sprite_button_bottom="scroll"
@ -29,7 +39,10 @@
sprite_button_top_pressed="scroll" sprite_button_top_pressed="scroll"
/> />
<scrollbar name="manual_scrollbar" width="12" minimum_bar_size="4" alwaysshown="false" <scrollbar name="manual_scrollbar"
width="12"
minimum_bar_size="4"
alwaysshown="false"
sprite_button_top="sprite2" sprite_button_top="sprite2"
sprite_button_top_over="scroll" sprite_button_top_over="scroll"
sprite_button_bottom="sprite2" sprite_button_bottom="sprite2"
@ -42,7 +55,10 @@
sprite_button_top_pressed="sprite2_pressed" sprite_button_top_pressed="sprite2_pressed"
/> />
<scrollbar name="atlas_scrollbar" width="12" minimum_bar_size="4" alwaysshown="true" <scrollbar name="atlas_scrollbar"
width="12"
minimum_bar_size="4"
alwaysshown="true"
sprite_button_top="atlas_global_button_up" sprite_button_top="atlas_global_button_up"
sprite_button_top_over="atlas_global_button_up_lit" sprite_button_top_over="atlas_global_button_up_lit"
sprite_button_top_pressed="atlas_global_button_up_lit" sprite_button_top_pressed="atlas_global_button_up_lit"
@ -55,54 +71,185 @@
sprite_bar_vertical_pressed="atlas_button_lit" sprite_bar_vertical_pressed="atlas_button_lit"
/> />
<!-- Resource Icons --> <!--
<icon name="icon_resource_food" texture="ui_icon_sheet_statistic" cell_id="16" size="20 20" /> ==========================================
<icon name="icon_resource_wood" texture="ui_icon_sheet_statistic" cell_id="17" size="20 20" /> - SETUP - ICONS
<icon name="icon_resource_stone" texture="ui_icon_sheet_statistic" cell_id="18" size="20 20" /> ==========================================
<icon name="icon_resource_ore" texture="ui_icon_sheet_statistic" cell_id="19" size="20 20" /> -->
<icon name="icon_resource_population" texture="ui_icon_sheet_statistic" cell_id="20" size="20 20" />
<!-- Statistic Icons --> <!--
<icon name="icon_statistic_garrison" texture="ui_icon_sheet_statistic" cell_id="12" size="20 20" /> ==========================================
<icon name="icon_statistic_rank1" texture="ui_icon_sheet_statistic" cell_id="9" size="20 20" /> - SETUP - ICONS - GENERIC
<icon name="icon_statistic_rank2" texture="ui_icon_sheet_statistic" cell_id="10" size="20 20" /> ==========================================
<icon name="icon_statistic_rank3" texture="ui_icon_sheet_statistic" cell_id="11" size="20 20" /> -->
<icon name="icon_statistic_hp" texture="ui_icon_sheet_statistic" cell_id="13" size="20 20" />
<icon name="icon_statistic_accuracy" texture="ui_icon_sheet_statistic" cell_id="0" size="20 20" />
<icon name="icon_statistic_armour" texture="ui_icon_sheet_statistic" cell_id="2" size="20 20" />
<icon name="icon_statistic_attack" texture="ui_icon_sheet_statistic" cell_id="1" size="20 20" />
<icon name="icon_statistic_crush" texture="ui_icon_sheet_statistic" cell_id="8" size="20 20" />
<icon name="icon_statistic_hack" texture="ui_icon_sheet_statistic" cell_id="6" size="20 20" />
<icon name="icon_statistic_los" texture="ui_icon_sheet_statistic" cell_id="3" size="20 20" />
<icon name="icon_statistic_pierce" texture="ui_icon_sheet_statistic" cell_id="7" size="20 20" />
<icon name="icon_statistic_range" texture="ui_icon_sheet_statistic" cell_id="5" size="20 20" />
<icon name="icon_statistic_speed" texture="ui_icon_sheet_statistic" cell_id="4" size="20 20" />
<!-- Generic Icons / malte, 15th nov --> <icon name="0ad_icon"
<icon name="0ad_icon" texture="0ad_icon" size="16 16" /> texture="0ad_icon"
<icon name="bullet_icon" texture="bullet_icon" size="8 8" /> size="16 16"
<icon name="infinity_icon" texture="infinity_icon" size="16 16" /> />
<icon name="bullet_icon"
texture="bullet_icon"
size="8 8"
/>
<icon name="infinity_icon"
texture="infinity_icon"
size="16 16"
/>
<!--
==========================================
- SETUP - ICONS - RESOURCE
==========================================
-->
<icon name="icon_resource_food"
texture="ui_icon_sheet_statistic"
cell_id="16"
size="20 20"
/>
<icon name="icon_resource_wood"
texture="ui_icon_sheet_statistic"
cell_id="17"
size="20 20"
/>
<icon name="icon_resource_stone"
texture="ui_icon_sheet_statistic"
cell_id="18"
size="20 20"
/>
<icon name="icon_resource_ore"
texture="ui_icon_sheet_statistic"
cell_id="19"
size="20 20"
/>
<icon name="icon_resource_population"
texture="ui_icon_sheet_statistic"
cell_id="20"
size="20 20"
/>
<!--
==========================================
- SETUP - ICONS - STATISTIC
==========================================
-->
<icon name="icon_statistic_garrison"
texture="ui_icon_sheet_statistic"
cell_id="12"
size="20 20"
/>
<icon name="icon_statistic_rank1"
texture="ui_icon_sheet_statistic"
cell_id="9"
size="20 20"
/>
<icon name="icon_statistic_rank2"
texture="ui_icon_sheet_statistic"
cell_id="10"
size="20 20"
/>
<icon name="icon_statistic_rank3"
texture="ui_icon_sheet_statistic"
cell_id="11"
size="20 20"
/>
<icon name="icon_statistic_hp"
texture="ui_icon_sheet_statistic"
cell_id="13"
size="20 20"
/>
<icon name="icon_statistic_accuracy"
texture="ui_icon_sheet_statistic"
cell_id="0"
size="20 20"
/>
<icon name="icon_statistic_armour"
texture="ui_icon_sheet_statistic"
cell_id="2"
size="20 20"
/>
<icon name="icon_statistic_attack"
texture="ui_icon_sheet_statistic"
cell_id="1"
size="20 20"
/>
<icon name="icon_statistic_crush"
texture="ui_icon_sheet_statistic"
cell_id="8"
size="20 20"
/>
<icon name="icon_statistic_hack"
texture="ui_icon_sheet_statistic"
cell_id="6"
size="20 20"
/>
<icon name="icon_statistic_los"
texture="ui_icon_sheet_statistic"
cell_id="3"
size="20 20"
/>
<icon name="icon_statistic_pierce"
texture="ui_icon_sheet_statistic"
cell_id="7"
size="20 20"
/>
<icon name="icon_statistic_range"
texture="ui_icon_sheet_statistic"
cell_id="5"
size="20 20"
/>
<icon name="icon_statistic_speed"
texture="ui_icon_sheet_statistic"
cell_id="4"
size="20 20"
/>
<!--
==========================================
- SETUP - TOOLTIPS
==========================================
-->
<tooltip name="pregame_mainmenu_tooltip" <tooltip name="pregame_mainmenu_tooltip"
use_object="pregame_mainmenu_tooltip" use_object="pregame_mainmenu_tooltip"
hide_object="true"
delay="0" delay="0"
hide_object="true"
/> />
<tooltip name="atlas_tooltip" <tooltip name="atlas_tooltip"
use_object="ATLAS_TOOLTIP" use_object="ATLAS_TOOLTIP"
hide_object="true"
delay="0" delay="0"
hide_object="true"
/> />
<tooltip name="session_tooltip" <tooltip name="session_tooltip"
anchor="top"
buffer_zone="4"
delay="500"
font="tahoma12"
maxwidth="300" maxwidth="300"
offset="16 32" offset="16 32"
anchor="top"
delay="500"
sprite="session_tooltip_background" sprite="session_tooltip_background"
font="tahoma12"
buffer_zone="4"
textcolor="0 0 0" textcolor="0 0 0"
/> />

View File

@ -4,41 +4,70 @@
<styles> <styles>
<!-- <!--
The default values ==========================================
The style with the name 'default' is special, it will - DEFAULT STYLE: The style with the name 'default' is special, it will
be called by every object before any other style is - be called by every object before any other style is loaded.
loaded. ==========================================
--> -->
<style name="default" <style name="default"
hidden="false" absolute="false"
enabled="true" enabled="true"
ghost="false"
hidden="false"
size="0 0 100% 100%"
z="0" z="0"
absolute="true"
scrollbar_style="sb2" font="verdana12"
buffer_zone="5" buffer_zone="5"
multiline="false" multiline="false"
font="verdana12"
/> />
<style name="button" <!--
sprite="sprite1" ==========================================
sprite_pressed="sprite1_pressed" - STYLE - GLOBAL - BEIGE MENU SKIN - PANES
sprite_disabled="sprite1_disabled" ==========================================
sprite_over="sprite1_over" -->
sprite2="sprite1_ch"
sprite2_pressed="sprite2_pressed" <style name="0ad_window"
sprite2_disabled="sprite2_disabled" sprite="0ad_window"
/> />
<style name="empty" <style name="0ad_window_titlebar"
size="0 0 100% 100%" size="50%-150 0%-25 50%+150 0%-9"
font="prospero18"
sprite="0ad_window_title"
text_align="center"
text_valign="center"
/> />
<style name="backdrop" <!--
size="0 0 100% 100%" ==========================================
ghost="true" - STYLE - GLOBAL - BEIGE MENU SKIN - CONTROLS
==========================================
-->
<style name="0ad_window_button"
sprite="message_box_button_normal"
sprite_over="message_box_button_over"
text_align="center"
text_valign="center"
/> />
<style name="0ad_window_checkbox"
size="100%+9 0%-25 100%+25 0%-9"
sprite="exit_sprite"
sprite_over="exit_sprite_over"
tooltip="Close this window and return to the previous screen."
tooltip_style="pregame_mainmenu_tooltip"
/>
<!--
==========================================
- STYLE - GLOBAL - BEIGE MENU SKIN - TEXT
==========================================
-->
<style name="text_prospero16_gold" <style name="text_prospero16_gold"
ghost="true" ghost="true"
font="prospero16" font="prospero16"
@ -71,6 +100,12 @@
textcolor="0 0 0" textcolor="0 0 0"
/> />
<!--
==========================================
- STYLE - GLOBAL - BEIGE MENU SKIN - BORDERS
==========================================
-->
<style name="border_box_black" <style name="border_box_black"
sprite="only_black_border" sprite="only_black_border"
sprite_selectarea="GeeTemp_selected" sprite_selectarea="GeeTemp_selected"
@ -93,6 +128,12 @@
textcolor_selected="255 255 255" textcolor_selected="255 255 255"
/> />
<!--
==========================================
- STYLE - PREGAME - MAIN MENU
==========================================
-->
<style name="pregame_mainmenu_button" <style name="pregame_mainmenu_button"
tooltip_style="pregame_mainmenu_tooltip" tooltip_style="pregame_mainmenu_tooltip"
/> />
@ -104,35 +145,11 @@
tooltip_style="pregame_mainmenu_tooltip" tooltip_style="pregame_mainmenu_tooltip"
/> />
<style name="0ad_window" <!--
sprite="0ad_window" ==========================================
/> - STYLE - PREGAME - SESSION
==========================================
<style name="0ad_window_titlebar" -->
absolute="false"
size="50%-150 0%-25 50%+150 0%-9"
font="prospero18"
sprite="0ad_window_title"
text_align="center"
text_valign="center"
/>
<style name="0ad_window_button"
absolute="false"
sprite="message_box_button_normal"
sprite_over="message_box_button_over"
text_align="center"
text_valign="center"
/>
<style name="0ad_window_checkbox"
absolute="false"
size="100%+9 0%-25 100%+25 0%-9"
sprite="exit_sprite"
sprite_over="exit_sprite_over"
tooltip="Close this window and return to the previous screen."
tooltip_style="pregame_mainmenu_tooltip"
/>
<style name="resource_counter" <style name="resource_counter"
text_valign="bottom" text_valign="bottom"
@ -145,7 +162,6 @@
<style name="control_group" <style name="control_group"
size="0 0 100% 100%" size="0 0 100% 100%"
z="1"
/> />
<style name="session_object" <style name="session_object"
@ -345,6 +361,24 @@
tooltip="(TBA)" tooltip="(TBA)"
/> />
<!--
==========================================
- STYLE - BACKUP
- These are not in use, and are kept mainly
- for reference.
==========================================
-->
<style name="button"
sprite="sprite1"
sprite_pressed="sprite1_pressed"
sprite_disabled="sprite1_disabled"
sprite_over="sprite1_over"
sprite2="sprite1_ch"
sprite2_pressed="sprite2_pressed"
sprite2_disabled="sprite2_disabled"
/>
<!-- Atlas Editor --> <!-- Atlas Editor -->
<style name="atlas_object" <style name="atlas_object"
tooltip_style="atlas_tooltip" tooltip_style="atlas_tooltip"
@ -463,4 +497,5 @@
text_align="center" text_align="center"
text_valign="center" text_valign="center"
/> />
</styles> </styles>