diff --git a/binaries/data/mods/public/gui/test/1_init.xml b/binaries/data/mods/public/gui/test/1_init.xml
index 09bba6721b..a3b3055ce1 100644
--- a/binaries/data/mods/public/gui/test/1_init.xml
+++ b/binaries/data/mods/public/gui/test/1_init.xml
@@ -1,75 +1,75 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/binaries/data/mods/public/gui/test/2_mainmenu.xml b/binaries/data/mods/public/gui/test/2_mainmenu.xml
index 8c8d19afdd..c896e8185f 100644
--- a/binaries/data/mods/public/gui/test/2_mainmenu.xml
+++ b/binaries/data/mods/public/gui/test/2_mainmenu.xml
@@ -1,2111 +1,2111 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- tooltipText
-
-
-
-
-
- Current Profile:
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Campaigns
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Game Setup
-
-
-
-
-
-
-
-
-
-
-
-
- K
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Your Civilization:
-
-
-
- Hellenes (i)
-
-
-
-
-
-
-
-
-
- Map:
-
-
-
- Type:
-
-
-
-
-
-
-
- Name:
-
-
-
- lowerY) return 1;
- else return 0;
- });
-
- for (mapIndex = 0; mapIndex < mapArray.length; mapIndex++)
- {
- // Remove the path and extension from each name, since we just want the filename.
- // (Is there an equivalent "basename" function for that in JS?)
- mapArray[mapIndex] = mapArray[mapIndex].substring (mapPath.length, mapArray[mapIndex].length-4)
-
- // Add map name to the end of the object's list.
- pushItem (this.name, mapArray[mapIndex]);
- }
-
- // Set default value (pick whatever's at the top of the list).
-// getGUIObjectByName(this.name).selected = 0;
- // No, on second thought, set it to the randomly generated map until we can remember the last choice.
- setCurrItemValue (this.name, "Latium");
- ]]>
-
-
-
- Fog of War:
-
-
-
-
-
-
- LOS:
-
-
-
- - Normal
- - Explored
- - All Visible
-
-
-
-
-
-
-
- Map Size:
-
-
-
-
-
-
-
-
-
- Map Info
-Developed by, well, WFG.
-A large landmass with rivers, forests and coastal fishing grounds.
-
-
-
- Get more maps
-
-
-
-
-
-
-
-
- Other Players:
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Game Mode:
-
-
-
-
-
-
-
- Starting Phase:
-
-
-
-
-
-
-
- Resources:
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- This is info text.
-
-
- tooltipText
-
-
-
-
-
-
- Screenshot Mode:
-
-
-
-
-
-
-
- Start!
-
-
-
- Cancel
-
-
-
-
-
-
- Please select whether you want to join a game or host your own game.
- Multiplayer
-
-
-
-
-
-
-
-
- Game Mode
-
-
- Join Game
-
-
-
-
-
- Host Game
-
-
-
-
-
-
-
-
- Host a game
-
-
-
-
-
-
-
-
- Setting up your server.
-
-
- Game (Server) Name:
-
-
- My Game
-
-
-
-
- Welcome Message:
-
-
- You can enter some message which is displayed to new players upon joining here.
-
-
- Uhm, welcome to my game. Have fun!
-
-
-
-
- Continue
-
-
-
- Back
-
-
-
-
-
-
-
- Join a game
-
-
-
-
-
-
-
-
- Joining an existing game.
-
-
- Server Hostname or IP:
-
-
- 127.0.0.1
-
-
-
-
- Continue
-
-
-
- Back
-
-
-
-
-
-
-
- Options
-
-
-
-
-
-
-
-
-
- Mute All
-
-
-
-
-
-
- Music Volume
-
-
-
-
-
-
-
-
-
- 0.0)
- guiModifyCaption ("pgOptionsAudioMusicGain", -.1, 1);
-
- curr_music.setGain (getGUIObjectByName ("pgOptionsAudioMusicGain").caption);
- g_ConfigDB.system["sound.mastergain"] = getGUIObjectByName ("pgOptionsAudioMusicGain").caption;
- ]]>
-
-
-
-
-
-
- Mute
-
-
-
-
-
- Sound Volume
-
-
-
-
-
-
-
-
-
- 0.0)
- guiModifyCaption ("pgOptionsAudioSoundGain", -.1, 1);
- ]]>
-
-
-
-
-
-
-
- Mute
-
-
-
-
-
-
- Ambient Volume
-
-
-
-
-
-
-
-
-
- 0.0)
- guiModifyCaption ("pgOptionsAudioAmbientGain", -.1, 1);
- ]]>
-
-
-
-
-
-
-
- Mute
-
-
-
-
-
-
- Voice Volume
-
-
-
-
-
-
-
-
-
- 0.0)
- guiModifyCaption ("pgOptionsAudioVoiceGain", -.1, 1);
- ]]>
-
-
-
-
-
-
- Mute
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Resolution
-
-
-
-
-
-
-
-
-
-
-
- Model Detail
-
-
-
-
-
-
-
-
-
- Texture Detail
-
-
-
-
-
-
-
-
-
- Animation Detail
-
-
-
-
-
-
-
-
-
- Effects Detail
-
-
-
-
-
-
-
-
-
- Weather Detail
-
-
-
-
-
-
-
-
-
- Water Detail
-
-
-
-
-
-
-
-
-
- Terrain Detail
-
-
-
-
-
-
-
-
-
- Shadow Detail
-
-
-
-
-
-
-
-
-
- Show Blood
-
-
-
-
-
-
-
-
-
- System Info
-
-
-
-
-
-
-
-
-
-
-
- Mouse Settings
-
-
-
- Reverse Buttons
-
-
-
-
-
-
-
-
- Audio
-
-
-
- Video
-
-
-
- Game
-
-
-
-
-
- OK
-
-
-
-
-
- Cancel
-
-
-
-
-
-
-
-
- History
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+ Rebuilding Archive ... Press Alt+F4 or Left-Click to Cancel
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ tooltipText
+
+
+
+
+
+ Current Profile:
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Campaigns
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Game Setup
+
+
+
+
+
+
+
+
+
+
+
+
+ K
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Your Civilization:
+
+
+
+ Hellenes (i)
+
+
+
+
+
+
+
+
+
+ Map:
+
+
+
+ Type:
+
+
+
+
+
+
+
+ Name:
+
+
+
+ lowerY) return 1;
+ else return 0;
+ });
+
+ for (mapIndex = 0; mapIndex < mapArray.length; mapIndex++)
+ {
+ // Remove the path and extension from each name, since we just want the filename.
+ // (Is there an equivalent "basename" function for that in JS?)
+ mapArray[mapIndex] = mapArray[mapIndex].substring (mapPath.length, mapArray[mapIndex].length-4)
+
+ // Add map name to the end of the object's list.
+ pushItem (this.name, mapArray[mapIndex]);
+ }
+
+ // Set default value (pick whatever's at the top of the list).
+// getGUIObjectByName(this.name).selected = 0;
+ // No, on second thought, set it to the randomly generated map until we can remember the last choice.
+ setCurrItemValue (this.name, "Latium");
+ ]]>
+
+
+
+ Fog of War:
+
+
+
+
+
+
+ LOS:
+
+
+
+ - Normal
+ - Explored
+ - All Visible
+
+
+
+
+
+
+
+ Map Size:
+
+
+
+
+
+
+
+
+
+ Map Info
+Developed by, well, WFG.
+A large landmass with rivers, forests and coastal fishing grounds.
+
+
+
+ Get more maps
+
+
+
+
+
+
+
+
+ Other Players:
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Game Mode:
+
+
+
+
+
+
+
+ Starting Phase:
+
+
+
+
+
+
+
+ Resources:
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ This is info text.
+
+
+ tooltipText
+
+
+
+
+
+
+ Screenshot Mode:
+
+
+
+
+
+
+
+ Start!
+
+
+
+ Cancel
+
+
+
+
+
+
+ Please select whether you want to join a game or host your own game.
+ Multiplayer
+
+
+
+
+
+
+
+
+ Game Mode
+
+
+ Join Game
+
+
+
+
+
+ Host Game
+
+
+
+
+
+
+
+
+ Host a game
+
+
+
+
+
+
+
+
+ Setting up your server.
+
+
+ Game (Server) Name:
+
+
+ My Game
+
+
+
+
+ Welcome Message:
+
+
+ You can enter some message which is displayed to new players upon joining here.
+
+
+ Uhm, welcome to my game. Have fun!
+
+
+
+
+ Continue
+
+
+
+ Back
+
+
+
+
+
+
+
+ Join a game
+
+
+
+
+
+
+
+
+ Joining an existing game.
+
+
+ Server Hostname or IP:
+
+
+ 127.0.0.1
+
+
+
+
+ Continue
+
+
+
+ Back
+
+
+
+
+
+
+
+ Options
+
+
+
+
+
+
+
+
+
+ Mute All
+
+
+
+
+
+
+ Music Volume
+
+
+
+
+
+
+
+
+
+ 0.0)
+ guiModifyCaption ("pgOptionsAudioMusicGain", -.1, 1);
+
+ curr_music.setGain (getGUIObjectByName ("pgOptionsAudioMusicGain").caption);
+ g_ConfigDB.system["sound.mastergain"] = getGUIObjectByName ("pgOptionsAudioMusicGain").caption;
+ ]]>
+
+
+
+
+
+
+ Mute
+
+
+
+
+
+ Sound Volume
+
+
+
+
+
+
+
+
+
+ 0.0)
+ guiModifyCaption ("pgOptionsAudioSoundGain", -.1, 1);
+ ]]>
+
+
+
+
+
+
+
+ Mute
+
+
+
+
+
+
+ Ambient Volume
+
+
+
+
+
+
+
+
+
+ 0.0)
+ guiModifyCaption ("pgOptionsAudioAmbientGain", -.1, 1);
+ ]]>
+
+
+
+
+
+
+
+ Mute
+
+
+
+
+
+
+ Voice Volume
+
+
+
+
+
+
+
+
+
+ 0.0)
+ guiModifyCaption ("pgOptionsAudioVoiceGain", -.1, 1);
+ ]]>
+
+
+
+
+
+
+ Mute
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Resolution
+
+
+
+
+
+
+
+
+
+
+
+ Model Detail
+
+
+
+
+
+
+
+
+
+ Texture Detail
+
+
+
+
+
+
+
+
+
+ Animation Detail
+
+
+
+
+
+
+
+
+
+ Effects Detail
+
+
+
+
+
+
+
+
+
+ Weather Detail
+
+
+
+
+
+
+
+
+
+ Water Detail
+
+
+
+
+
+
+
+
+
+ Terrain Detail
+
+
+
+
+
+
+
+
+
+ Shadow Detail
+
+
+
+
+
+
+
+
+
+ Show Blood
+
+
+
+
+
+
+
+
+
+ System Info
+
+
+
+
+
+
+
+
+
+
+
+ Mouse Settings
+
+
+
+ Reverse Buttons
+
+
+
+
+
+
+
+
+ Audio
+
+
+
+ Video
+
+
+
+ Game
+
+
+
+
+
+ OK
+
+
+
+
+
+ Cancel
+
+
+
+
+
+
+
+
+ History
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/binaries/data/mods/public/gui/test/3_loading.xml b/binaries/data/mods/public/gui/test/3_loading.xml
index 2864823b4d..2e25313f3f 100644
--- a/binaries/data/mods/public/gui/test/3_loading.xml
+++ b/binaries/data/mods/public/gui/test/3_loading.xml
@@ -1,104 +1,104 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/binaries/data/mods/public/gui/test/4_session.xml b/binaries/data/mods/public/gui/test/4_session.xml
index 4fbf50ab65..0e44138e29 100644
--- a/binaries/data/mods/public/gui/test/4_session.xml
+++ b/binaries/data/mods/public/gui/test/4_session.xml
@@ -1,906 +1,906 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Game is Paused
-
-
-
-
-
-
-
-
-
-
-
- //Shadow
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Game is Paused
+
+
+
+
+
+
+
+
+
+
+
+ //Shadow
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/binaries/data/mods/public/gui/test/6_1_manual.xml b/binaries/data/mods/public/gui/test/6_1_manual.xml
index e6b422c581..1cc31ac409 100644
--- a/binaries/data/mods/public/gui/test/6_1_manual.xml
+++ b/binaries/data/mods/public/gui/test/6_1_manual.xml
@@ -1,158 +1,158 @@
-
-
-
-
-
-
-
-
-
- 0)
- {
- // Ensure manual is refreshed.
- refreshManual();
-
- // Open/Close the manual.
- guiToggle ("mn");
- guiToggle ("sn");
- }
- ]]>
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+ 0)
+ {
+ // Ensure manual is refreshed.
+ refreshManual();
+
+ // Open/Close the manual.
+ guiToggle ("mn");
+ guiToggle ("sn");
+ }
+ ]]>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/binaries/data/mods/public/gui/test/6_2_jukebox.xml b/binaries/data/mods/public/gui/test/6_2_jukebox.xml
index ee078c1b20..5710c93f8d 100644
--- a/binaries/data/mods/public/gui/test/6_2_jukebox.xml
+++ b/binaries/data/mods/public/gui/test/6_2_jukebox.xml
@@ -1,17 +1,17 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/binaries/data/mods/public/gui/test/6_subwindows.xml b/binaries/data/mods/public/gui/test/6_subwindows.xml
index d0d097d267..d38878e8f8 100644
--- a/binaries/data/mods/public/gui/test/6_subwindows.xml
+++ b/binaries/data/mods/public/gui/test/6_subwindows.xml
@@ -1,13 +1,13 @@
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
diff --git a/binaries/data/mods/public/gui/test/7_atlas.xml b/binaries/data/mods/public/gui/test/7_atlas.xml
index fe129cdb46..083f8e94b6 100644
--- a/binaries/data/mods/public/gui/test/7_atlas.xml
+++ b/binaries/data/mods/public/gui/test/7_atlas.xml
@@ -1,13 +1,13 @@
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
diff --git a/binaries/data/mods/public/gui/test/9_global.xml b/binaries/data/mods/public/gui/test/9_global.xml
index 116628af72..3da796bf1a 100644
--- a/binaries/data/mods/public/gui/test/9_global.xml
+++ b/binaries/data/mods/public/gui/test/9_global.xml
@@ -1,134 +1,134 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- mbTitle
-
-
-
- mbMessage
-
-
-
- mbButton1Caption
-
-
- mbButton2Caption
-
-
- mbButton3Caption
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ mbTitle
+
+
+
+ mbMessage
+
+
+
+ mbButton1Caption
+
+
+ mbButton2Caption
+
+
+ mbButton3Caption
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/binaries/data/mods/public/gui/test/functions_global_init.js b/binaries/data/mods/public/gui/test/functions_global_init.js
index 0764756dd4..0dd7d4838a 100644
--- a/binaries/data/mods/public/gui/test/functions_global_init.js
+++ b/binaries/data/mods/public/gui/test/functions_global_init.js
@@ -1,16 +1,16 @@
-/*
- DESCRIPTION : Global initialisation functions, called when scripts first included at startup.
- NOTES : Use for any initialisation that cannot be mapped to an object.
-*/
-
-// ====================================================================
-
-function init ()
-{
- // Root point for anything that needs to be globally initialised at startup.
-
- initCoord();
- initSession();
-}
-
+/*
+ DESCRIPTION : Global initialisation functions, called when scripts first included at startup.
+ NOTES : Use for any initialisation that cannot be mapped to an object.
+*/
+
+// ====================================================================
+
+function init ()
+{
+ // Root point for anything that needs to be globally initialised at startup.
+
+ initCoord();
+ initSession();
+}
+
// ====================================================================
\ No newline at end of file
diff --git a/binaries/data/mods/public/gui/test/functions_global_object.js b/binaries/data/mods/public/gui/test/functions_global_object.js
index a20b3fee60..46c7ce108d 100644
--- a/binaries/data/mods/public/gui/test/functions_global_object.js
+++ b/binaries/data/mods/public/gui/test/functions_global_object.js
@@ -1,132 +1,132 @@
-/*
- DESCRIPTION : Contains global GUI functions, which will later be accessible from every GUI script/file.
- NOTES : So far, only the message box-related functions are implemented.
-*/
-
-/*
- ***************************************
-
- File version: 0.1
- Edited by: Malte, Nov 14 2004
-
- ***************************************
-
- Further comments:
-
- Changelog:
- v0.1: - first version.
-
- ***************************************
-*/
-
-// *******************************************
-// messageBox
-// *******************************************
-// @params: int mbWidth, int mbHeight, string mbMessage, string mbTitle, int mbMode, arr mbButtonCaptions
-// @return: void
-// @desc: Displays a new message box. So far, we can only display one message box at
-// a time, since the message box is based on one base-object which is modified
-// according to the parameters. Later, we should probably be able to create GUI
-// Objects (like the message box) at runtime.
-// *******************************************
-
-/*
-TODO: Make button code work for any number of buttons without extending the code each time! ((arrays | nested variables) & calculating sizes)
-*/
-
-// ====================================================================
-
-function messageBox (mbWidth, mbHeight, mbMessage, mbTitle, mbMode, mbButtonCaptions, mbButtonsCode)
-{
- mbMainObj = getGUIObjectByName ("mbMain");
- mbTitleObj = getGUIObjectByName ("mbTitleBar");
- mbTextObj = getGUIObjectByName ("mbText");
-
- mbButton1Obj = getGUIObjectByName ("mbButton1");
- mbButton2Obj = getGUIObjectByName ("mbButton2");
- mbButton3Obj = getGUIObjectByName ("mbButton3");
-
- // Calculate size
- mbLRDiff = mbWidth / 2; // Message box left/right difference from 50% of screen
- mbUDDiff = mbHeight / 2; // Message box up/down difference from 50% of screen
-
- mbSizeString = "50%-" + mbLRDiff + " 50%-" + mbUDDiff + " 50%+" + mbLRDiff + " 50%+" + mbUDDiff;
-
- mbMainObj.size = mbSizeString;
-
- // Texts
- mbTitleObj.caption = mbTitle;
- mbTextObj.caption = mbMessage;
-
- // Message box modes
- // There is a number of standard modes, and if none of these is used (mbMode == 0), the button captions will be
- // taken from the array mbButtonCaptions; there currently is a maximum of three buttons.
- switch (mbMode)
- {
- case 1:
- // Simple Yes/No question box
- mbButtonCaptions = new Array("Yes", "No");
- break;
- case 2:
- // Okay-only box
- mbButtonCaptions = new Array("OK");
- break;
- case 3:
- // Retry/Abort/Ignore box (will we ever need this?!)
- mbButtonCaptions = new Array("Retry", "Ignore", "Abort");
- default:
- break;
- }
-
- // Buttons
- switch (mbButtonCaptions.length)
- {
- case 1:
- // One Button only
- mbButton1Obj.caption = mbButtonCaptions[0];
- mbButton1Obj.size = "30% 100%-80 70% 100%-50";
- mbButton1Obj.hidden = false;
- mbButton2Obj.hidden = true;
- mbButton3Obj.hidden = true;
- break;
- case 2:
- // Two Buttons
- mbButton1Obj.caption = mbButtonCaptions[0];
- mbButton2Obj.caption = mbButtonCaptions[1];
- mbButton1Obj.size = "10% 100%-80 45% 100%-50";
- mbButton2Obj.size = "55% 100%-80 90% 100%-50";
- mbButton1Obj.hidden = false;
- mbButton2Obj.hidden = false;
- mbButton3Obj.hidden = true;
- break;
- case 3:
- // Three Buttons
- mbButton1Obj.caption = mbButtonCaptions[0];
- mbButton2Obj.caption = mbButtonCaptions[1];
- mbButton3Obj.caption = mbButtonCaptions[2];
- mbButton1Obj.size = "10% 100%-80 30% 100%-50";
- mbButton2Obj.size = "40% 100%-80 60% 100%-50";
- mbButton3Obj.size = "70% 100%-80 90% 100%-50";
- mbButton1Obj.hidden = false;
- mbButton2Obj.hidden = false;
- mbButton3Obj.hidden = false;
- break;
- }
-
- // Show the message box
- guiUnHide (mbMainObj.name);
-
- // Testing
- getGUIGlobal().mbButton1Code = mbButtonsCode[0];
- getGUIGlobal().mbButton2Code = mbButtonsCode[1];
- getGUIGlobal().mbButton3Code = mbButtonsCode[2];
-}
-
-// ====================================================================
-
-function updateFPS()
-{
- getGUIObjectByName("fpsCounter").caption = "FPS: " + getFPS();
-}
-
+/*
+ DESCRIPTION : Contains global GUI functions, which will later be accessible from every GUI script/file.
+ NOTES : So far, only the message box-related functions are implemented.
+*/
+
+/*
+ ***************************************
+
+ File version: 0.1
+ Edited by: Malte, Nov 14 2004
+
+ ***************************************
+
+ Further comments:
+
+ Changelog:
+ v0.1: - first version.
+
+ ***************************************
+*/
+
+// *******************************************
+// messageBox
+// *******************************************
+// @params: int mbWidth, int mbHeight, string mbMessage, string mbTitle, int mbMode, arr mbButtonCaptions
+// @return: void
+// @desc: Displays a new message box. So far, we can only display one message box at
+// a time, since the message box is based on one base-object which is modified
+// according to the parameters. Later, we should probably be able to create GUI
+// Objects (like the message box) at runtime.
+// *******************************************
+
+/*
+TODO: Make button code work for any number of buttons without extending the code each time! ((arrays | nested variables) & calculating sizes)
+*/
+
+// ====================================================================
+
+function messageBox (mbWidth, mbHeight, mbMessage, mbTitle, mbMode, mbButtonCaptions, mbButtonsCode)
+{
+ mbMainObj = getGUIObjectByName ("mbMain");
+ mbTitleObj = getGUIObjectByName ("mbTitleBar");
+ mbTextObj = getGUIObjectByName ("mbText");
+
+ mbButton1Obj = getGUIObjectByName ("mbButton1");
+ mbButton2Obj = getGUIObjectByName ("mbButton2");
+ mbButton3Obj = getGUIObjectByName ("mbButton3");
+
+ // Calculate size
+ mbLRDiff = mbWidth / 2; // Message box left/right difference from 50% of screen
+ mbUDDiff = mbHeight / 2; // Message box up/down difference from 50% of screen
+
+ mbSizeString = "50%-" + mbLRDiff + " 50%-" + mbUDDiff + " 50%+" + mbLRDiff + " 50%+" + mbUDDiff;
+
+ mbMainObj.size = mbSizeString;
+
+ // Texts
+ mbTitleObj.caption = mbTitle;
+ mbTextObj.caption = mbMessage;
+
+ // Message box modes
+ // There is a number of standard modes, and if none of these is used (mbMode == 0), the button captions will be
+ // taken from the array mbButtonCaptions; there currently is a maximum of three buttons.
+ switch (mbMode)
+ {
+ case 1:
+ // Simple Yes/No question box
+ mbButtonCaptions = new Array("Yes", "No");
+ break;
+ case 2:
+ // Okay-only box
+ mbButtonCaptions = new Array("OK");
+ break;
+ case 3:
+ // Retry/Abort/Ignore box (will we ever need this?!)
+ mbButtonCaptions = new Array("Retry", "Ignore", "Abort");
+ default:
+ break;
+ }
+
+ // Buttons
+ switch (mbButtonCaptions.length)
+ {
+ case 1:
+ // One Button only
+ mbButton1Obj.caption = mbButtonCaptions[0];
+ mbButton1Obj.size = "30% 100%-80 70% 100%-50";
+ mbButton1Obj.hidden = false;
+ mbButton2Obj.hidden = true;
+ mbButton3Obj.hidden = true;
+ break;
+ case 2:
+ // Two Buttons
+ mbButton1Obj.caption = mbButtonCaptions[0];
+ mbButton2Obj.caption = mbButtonCaptions[1];
+ mbButton1Obj.size = "10% 100%-80 45% 100%-50";
+ mbButton2Obj.size = "55% 100%-80 90% 100%-50";
+ mbButton1Obj.hidden = false;
+ mbButton2Obj.hidden = false;
+ mbButton3Obj.hidden = true;
+ break;
+ case 3:
+ // Three Buttons
+ mbButton1Obj.caption = mbButtonCaptions[0];
+ mbButton2Obj.caption = mbButtonCaptions[1];
+ mbButton3Obj.caption = mbButtonCaptions[2];
+ mbButton1Obj.size = "10% 100%-80 30% 100%-50";
+ mbButton2Obj.size = "40% 100%-80 60% 100%-50";
+ mbButton3Obj.size = "70% 100%-80 90% 100%-50";
+ mbButton1Obj.hidden = false;
+ mbButton2Obj.hidden = false;
+ mbButton3Obj.hidden = false;
+ break;
+ }
+
+ // Show the message box
+ guiUnHide (mbMainObj.name);
+
+ // Testing
+ getGUIGlobal().mbButton1Code = mbButtonsCode[0];
+ getGUIGlobal().mbButton2Code = mbButtonsCode[1];
+ getGUIGlobal().mbButton3Code = mbButtonsCode[2];
+}
+
+// ====================================================================
+
+function updateFPS()
+{
+ getGUIObjectByName("fpsCounter").caption = "FPS: " + getFPS();
+}
+
// ====================================================================
\ No newline at end of file
diff --git a/binaries/data/mods/public/gui/test/functions_page_pregame.js b/binaries/data/mods/public/gui/test/functions_page_pregame.js
index a094db0706..492ad27c6c 100644
--- a/binaries/data/mods/public/gui/test/functions_page_pregame.js
+++ b/binaries/data/mods/public/gui/test/functions_page_pregame.js
@@ -1,99 +1,99 @@
-/*
- DESCRIPTION : Main Pregame JS Script file.
- NOTES : Contains functions and code for Main Menu.
-*/
-
-// ====================================================================
-
-// Switch from the archive builder to the main menu.
-function startMainMenu()
-{
- // Reveal the main menu now that the archive has been loaded.
- guiHide ("ab");
- guiUnHide ("pg");
-
- // Play main 0 A.D. theme when the main menu starts.
- curr_music = newRandomSound("music", "menu");
- curr_music.loop();
-
- // Set starting volume (I'm using a value of zero here for no sound; feel free to comment out these two lines to use defaults).
-// curr_music.setGain (0.0);
-// g_ConfigDB.system["sound.mastergain"] = 0.0;
-}
-
-// ====================================================================
-
-// Helper function that enables the dark background mask, then reveals a given subwindow object.
-function openMainMenuSubWindow (windowName)
-{
- guiUnHide ("pgSubWindow");
- guiUnHide (windowName);
-}
-
-// ====================================================================
-
-// Helper function that disables the dark background mask, then hides a given subwindow object.
-function closeMainMenuSubWindow (windowName)
-{
- guiHide ("pgSubWindow");
- guiHide (windowName);
-}
-
-// ====================================================================
-
-// Switch to a given options tab window.
-function openOptionsTab(tabName)
-{
- // Hide the other tabs.
- for (i = 1; i <= 3; i++)
- {
- switch (i)
- {
- case 1:
- var tmpName = "pgOptionsAudio";
- break;
- case 2:
- var tmpName = "pgOptionsVideo";
- break;
- case 3:
- var tmpName = "pgOptionsGame";
- break;
- default:
- break;
- }
-
- if (tmpName != tabName)
- {
- getGUIObjectByName (tmpName + "Window").hidden = true;
- getGUIObjectByName (tmpName + "Button").enabled = true;
- }
- }
-
- // Make given tab visible.
- getGUIObjectByName (tabName + "Window").hidden = false;
- getGUIObjectByName (tabName + "Button").enabled = false;
-}
-
-// ====================================================================
-
-// Move the credits up the screen.
-function updateCredits()
-{
- // If there are still credit lines to remove, remove them.
- if (getNumItems("pgCredits") > 0)
- removeItem ("pgCredits", 0);
- else
- {
- // When we've run out of credit,
-
- // Stop the increment timer if it's still active.
- cancelInterval();
-
- // Close the credits screen and return.
- closeMainMenuSubWindow ("pgCredits");
- guiUnHide ("pg");
- }
-}
-
-// ====================================================================
-
+/*
+ DESCRIPTION : Main Pregame JS Script file.
+ NOTES : Contains functions and code for Main Menu.
+*/
+
+// ====================================================================
+
+// Switch from the archive builder to the main menu.
+function startMainMenu()
+{
+ // Reveal the main menu now that the archive has been loaded.
+ guiHide ("ab");
+ guiUnHide ("pg");
+
+ // Play main 0 A.D. theme when the main menu starts.
+ curr_music = newRandomSound("music", "menu");
+ curr_music.loop();
+
+ // Set starting volume (I'm using a value of zero here for no sound; feel free to comment out these two lines to use defaults).
+// curr_music.setGain (0.0);
+// g_ConfigDB.system["sound.mastergain"] = 0.0;
+}
+
+// ====================================================================
+
+// Helper function that enables the dark background mask, then reveals a given subwindow object.
+function openMainMenuSubWindow (windowName)
+{
+ guiUnHide ("pgSubWindow");
+ guiUnHide (windowName);
+}
+
+// ====================================================================
+
+// Helper function that disables the dark background mask, then hides a given subwindow object.
+function closeMainMenuSubWindow (windowName)
+{
+ guiHide ("pgSubWindow");
+ guiHide (windowName);
+}
+
+// ====================================================================
+
+// Switch to a given options tab window.
+function openOptionsTab(tabName)
+{
+ // Hide the other tabs.
+ for (i = 1; i <= 3; i++)
+ {
+ switch (i)
+ {
+ case 1:
+ var tmpName = "pgOptionsAudio";
+ break;
+ case 2:
+ var tmpName = "pgOptionsVideo";
+ break;
+ case 3:
+ var tmpName = "pgOptionsGame";
+ break;
+ default:
+ break;
+ }
+
+ if (tmpName != tabName)
+ {
+ getGUIObjectByName (tmpName + "Window").hidden = true;
+ getGUIObjectByName (tmpName + "Button").enabled = true;
+ }
+ }
+
+ // Make given tab visible.
+ getGUIObjectByName (tabName + "Window").hidden = false;
+ getGUIObjectByName (tabName + "Button").enabled = false;
+}
+
+// ====================================================================
+
+// Move the credits up the screen.
+function updateCredits()
+{
+ // If there are still credit lines to remove, remove them.
+ if (getNumItems("pgCredits") > 0)
+ removeItem ("pgCredits", 0);
+ else
+ {
+ // When we've run out of credit,
+
+ // Stop the increment timer if it's still active.
+ cancelInterval();
+
+ // Close the credits screen and return.
+ closeMainMenuSubWindow ("pgCredits");
+ guiUnHide ("pg");
+ }
+}
+
+// ====================================================================
+
diff --git a/binaries/data/mods/public/gui/test/functions_page_pregame_load.js b/binaries/data/mods/public/gui/test/functions_page_pregame_load.js
index d6e855261d..cdf5ca1e96 100644
--- a/binaries/data/mods/public/gui/test/functions_page_pregame_load.js
+++ b/binaries/data/mods/public/gui/test/functions_page_pregame_load.js
@@ -1,190 +1,190 @@
-/*
- DESCRIPTION : Functions used load/end the game session and manipulate the loading screen.
- NOTES :
-*/
-
-// ====================================================================
-
-function launchGame ()
-{
- // Starts the map, closing the session setup window.
-
- var mapName = getCurrItemValue("pgSessionSetupMapName");
- var gameMode = getCurrItemValue("pgSessionSetupGameMode");
- var screenshotMode = getGUIObjectByName("pgSessionSetupScreenshotMode").checked;
- var losSetting = getGUIObjectByName("pgSessionSetupLosSetting").selected;
- var fogOfWar = getGUIObjectByName("pgSessionSetupFoW").checked;
- if(screenshotMode)
- {
- losSetting = 2;
- fogOfWar = false;
- }
-
- // Check whether we have a correct file extension, to avoid crashes
- var extension = mapName.substring (mapName.length, mapName.length-4);
- if (extension != ".pmp")
- {
- // Add .pmp to the file name.
- var mapName = mapName + ".pmp";
- }
-
- // Set up game
- g_GameAttributes.mapFile = mapName;
- g_GameAttributes.losSetting = losSetting;
- g_GameAttributes.fogOfWar = fogOfWar;
- g_GameAttributes.gameMode = gameMode
- g_GameAttributes.screenshotMode = screenshotMode;
-
- // Close setup window
- closeMainMenuSubWindow ("pgSessionSetup");
-
- // Display loading screen.
- startLoadingScreen();
-
- console.write( "running startGame()" );
-
- // Begin game session.
- if (! startGame())
- {
- // Failed to start the game; go back to the main menu.
- guiSwitch ("ld", "pg");
- // Restore default cursor.
- setCursor ("arrow-default");
- // 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);
- }
-
- console.write( "done running startGame()" );
-
- // Set starting UI layout.
- GUIType=rb;
-
- // Set session UI sprites to match the skin for the player's civilisation.
- // (We don't have skins for all civs yet, so we're using the standard menu skin. But it should be settable from here later.)
- setSkin ("wheat");
-
- // Set GUI coordinates to starting orientation.
- flipGUI (GUIType);
-}
-
-// ====================================================================
-
-function startLoadingScreen()
-{
- // Switch screens from main menu to loading screen.
- guiSwitch ("pg", "ld");
- // Set to "hourglass" cursor.
- setCursor("cursor-wait");
- console.write ("Loading " + g_GameAttributes.mapFile + " (" + g_GameAttributes.numPlayers + " players) ...");
-
- // Choose random concept art for loading screen background (should depend on the selected civ later when this is specified).
- var sprite = "";
- var loadingBkgArray = buildDirEntList("art/textures/ui/loading/", "*.dds", false);
- if (loadingBkgArray.length == 0)
- console.write ("ERROR: Failed to find any matching textures for the loading screen background.");
- else
- {
- // Get a random index from the list of loading screen backgrounds.
- sprite = "stretched:" + loadingBkgArray[getRandom (0, loadingBkgArray.length-1)];
- sprite = sprite.replace ("art/textures/ui/", "");
- }
- getGUIObjectByName ("ldConcept").sprite = sprite;
-
- // janwas: main loop now sets progress / description, but that won't
- // happen until the first timeslice completes, so set initial values.
- getGUIObjectByName ("ldTitleBar").caption = "Loading Scenario ...";
- getGUIObjectByName ("ldProgressBarText").caption = "";
- getGUIObjectByName ("ldProgressBar").caption = 0;
- getGUIObjectByName ("ldText").caption = "LOADING " + g_GameAttributes.mapFile + " ...\nPlease wait ...";
-
- // Pick a random tip of the day (each line is a separate tip).
- var tipArray = readFileLines("gui/text/tips.txt");
- // Set tip string.
- getGUIObjectByName ("ldTip").caption = tipArray[getRandom(0, tipArray.length-1)];
-}
-
-// ====================================================================
-
-function reallyStartGame()
-{
- // This is a reserved function name that is executed by the engine when it is ready
- // 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.
- guiSwitch ("ld", "sn");
-
- // Restore default cursor.
- setCursor ("arrow-default");
-}
-
-// ====================================================================
-
-function setupSession ()
-{
- // Do essentials that can only be done when the session has been loaded ...
- // For example, create the resource types, scores, etc, for each player.
-
-/*
- if (sessionType == "Skirmish")
- {
- // 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 (var i=0; i<7; i++)
- {
- g_GameAttributes.slots[i+1].assignLocal();
- console.write ("Slot "+(i+1)+" is assigned: " + g_GameAttributes.slots[i+1].assignment);
- }
- }
-*/
-
- // Select session peace track.
- curr_session_playlist_1 = newRandomSound("music", "peace");
- // Fade out main theme and fade in session theme.
- crossFade(curr_music, curr_session_playlist_1, 1)
-
- // Create the resouce counters
- createResourceCounters();
-
- // Start refreshing the session controls.
- setInterval( snRefresh, 1, 100 );
-}
-
-// ====================================================================
-
-function endSession (closeType)
-{
- // Occurs when the player chooses to close the current game.
-
- switch (closeType)
- {
- case ("return"):
- // If the player has chosen to quit game and return to main menu,
-
- // End the session.
- endGame();
-
- // Fade out current music and return to playing menu theme.
- //curr_music = newRandomSound("music", "menu");
- //crossFade(curr_session_playlist_1, curr_music, 1);
-
- // Stop refreshing the session controls.
- cancelInterval();
-
- // Swap GUIs to display main menu.
- guiSwitch ("sn", "pg");
- break;
- case ("exit"):
- // If the player has chosen to shutdown and immediately return to operating system,
- exit();
- break;
- }
-}
-
-// ====================================================================
+/*
+ DESCRIPTION : Functions used load/end the game session and manipulate the loading screen.
+ NOTES :
+*/
+
+// ====================================================================
+
+function launchGame ()
+{
+ // Starts the map, closing the session setup window.
+
+ var mapName = getCurrItemValue("pgSessionSetupMapName");
+ var gameMode = getCurrItemValue("pgSessionSetupGameMode");
+ var screenshotMode = getGUIObjectByName("pgSessionSetupScreenshotMode").checked;
+ var losSetting = getGUIObjectByName("pgSessionSetupLosSetting").selected;
+ var fogOfWar = getGUIObjectByName("pgSessionSetupFoW").checked;
+ if(screenshotMode)
+ {
+ losSetting = 2;
+ fogOfWar = false;
+ }
+
+ // Check whether we have a correct file extension, to avoid crashes
+ var extension = mapName.substring (mapName.length, mapName.length-4);
+ if (extension != ".pmp")
+ {
+ // Add .pmp to the file name.
+ var mapName = mapName + ".pmp";
+ }
+
+ // Set up game
+ g_GameAttributes.mapFile = mapName;
+ g_GameAttributes.losSetting = losSetting;
+ g_GameAttributes.fogOfWar = fogOfWar;
+ g_GameAttributes.gameMode = gameMode
+ g_GameAttributes.screenshotMode = screenshotMode;
+
+ // Close setup window
+ closeMainMenuSubWindow ("pgSessionSetup");
+
+ // Display loading screen.
+ startLoadingScreen();
+
+ console.write( "running startGame()" );
+
+ // Begin game session.
+ if (! startGame())
+ {
+ // Failed to start the game; go back to the main menu.
+ guiSwitch ("ld", "pg");
+ // Restore default cursor.
+ setCursor ("arrow-default");
+ // 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);
+ }
+
+ console.write( "done running startGame()" );
+
+ // Set starting UI layout.
+ GUIType=rb;
+
+ // Set session UI sprites to match the skin for the player's civilisation.
+ // (We don't have skins for all civs yet, so we're using the standard menu skin. But it should be settable from here later.)
+ setSkin ("wheat");
+
+ // Set GUI coordinates to starting orientation.
+ flipGUI (GUIType);
+}
+
+// ====================================================================
+
+function startLoadingScreen()
+{
+ // Switch screens from main menu to loading screen.
+ guiSwitch ("pg", "ld");
+ // Set to "hourglass" cursor.
+ setCursor("cursor-wait");
+ console.write ("Loading " + g_GameAttributes.mapFile + " (" + g_GameAttributes.numPlayers + " players) ...");
+
+ // Choose random concept art for loading screen background (should depend on the selected civ later when this is specified).
+ var sprite = "";
+ var loadingBkgArray = buildDirEntList("art/textures/ui/loading/", "*.dds", false);
+ if (loadingBkgArray.length == 0)
+ console.write ("ERROR: Failed to find any matching textures for the loading screen background.");
+ else
+ {
+ // Get a random index from the list of loading screen backgrounds.
+ sprite = "stretched:" + loadingBkgArray[getRandom (0, loadingBkgArray.length-1)];
+ sprite = sprite.replace ("art/textures/ui/", "");
+ }
+ getGUIObjectByName ("ldConcept").sprite = sprite;
+
+ // janwas: main loop now sets progress / description, but that won't
+ // happen until the first timeslice completes, so set initial values.
+ getGUIObjectByName ("ldTitleBar").caption = "Loading Scenario ...";
+ getGUIObjectByName ("ldProgressBarText").caption = "";
+ getGUIObjectByName ("ldProgressBar").caption = 0;
+ getGUIObjectByName ("ldText").caption = "LOADING " + g_GameAttributes.mapFile + " ...\nPlease wait ...";
+
+ // Pick a random tip of the day (each line is a separate tip).
+ var tipArray = readFileLines("gui/text/tips.txt");
+ // Set tip string.
+ getGUIObjectByName ("ldTip").caption = tipArray[getRandom(0, tipArray.length-1)];
+}
+
+// ====================================================================
+
+function reallyStartGame()
+{
+ // This is a reserved function name that is executed by the engine when it is ready
+ // 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.
+ guiSwitch ("ld", "sn");
+
+ // Restore default cursor.
+ setCursor ("arrow-default");
+}
+
+// ====================================================================
+
+function setupSession ()
+{
+ // Do essentials that can only be done when the session has been loaded ...
+ // For example, create the resource types, scores, etc, for each player.
+
+/*
+ if (sessionType == "Skirmish")
+ {
+ // 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 (var i=0; i<7; i++)
+ {
+ g_GameAttributes.slots[i+1].assignLocal();
+ console.write ("Slot "+(i+1)+" is assigned: " + g_GameAttributes.slots[i+1].assignment);
+ }
+ }
+*/
+
+ // Select session peace track.
+ curr_session_playlist_1 = newRandomSound("music", "peace");
+ // Fade out main theme and fade in session theme.
+ crossFade(curr_music, curr_session_playlist_1, 1)
+
+ // Create the resouce counters
+ createResourceCounters();
+
+ // Start refreshing the session controls.
+ setInterval( snRefresh, 1, 100 );
+}
+
+// ====================================================================
+
+function endSession (closeType)
+{
+ // Occurs when the player chooses to close the current game.
+
+ switch (closeType)
+ {
+ case ("return"):
+ // If the player has chosen to quit game and return to main menu,
+
+ // End the session.
+ endGame();
+
+ // Fade out current music and return to playing menu theme.
+ //curr_music = newRandomSound("music", "menu");
+ //crossFade(curr_session_playlist_1, curr_music, 1);
+
+ // Stop refreshing the session controls.
+ cancelInterval();
+
+ // Swap GUIs to display main menu.
+ guiSwitch ("sn", "pg");
+ break;
+ case ("exit"):
+ // If the player has chosen to shutdown and immediately return to operating system,
+ exit();
+ break;
+ }
+}
+
+// ====================================================================
diff --git a/binaries/data/mods/public/gui/test/functions_page_pregame_multiplayer.js b/binaries/data/mods/public/gui/test/functions_page_pregame_multiplayer.js
index d1d6119dcb..81f354264d 100644
--- a/binaries/data/mods/public/gui/test/functions_page_pregame_multiplayer.js
+++ b/binaries/data/mods/public/gui/test/functions_page_pregame_multiplayer.js
@@ -1,147 +1,147 @@
-/*
- DESCRIPTION : Functions for the hosting and joining multiplayer games.
- NOTES :
-*/
-
-// ====================================================================
-
-function initMPHost (parentWindow, gameName, welcomeMessage, profileName)
-{
- // Set up the server
- var server = createServer();
- // Welcome message
- server.welcomeMessage = welcomeMessage;
- // Server Name
- server.serverName = gameName;
- // Host Name
- server.serverPlayerName = profileName;
-
- // start listening
- var success = server.open();
- if (!success)
- {
- messageBox(400, 200, "Failed to start server. Please review the logfile for more information on the problem.", "Problem", 2, new Array(), new Array());
- return 1;
- }
- else
- {
- console.write ("Host has started listening for client connections.");
-
- // Switch to Session Setup screen.
- sessionType = "Host";
- openSessionSetup (parentWindow);
- }
-
- // -------------------------
- // INCOMING CONNECTIONS
- // -------------------------
- server.onClientConnect = function (event)
- {
- console.write ("Client connected.");
- console.write("A new client has successfully connected! ID: " + event.id + ", Name: " + event.name + ", Session: " + event.session);
-
- // Assign newly connected client to next available slot.
- var playerSlot = g_GameAttributes.getOpenSlot();
- playerSlot.assignToSession (event.session);
- // Set player slot to new player's name
-
- var slotID = g_GameAttributes.getUsedSlotsAmount;
- pushItem ("pgSessionSetupP" + slotID, g_GameAttributes.slots[slotID-1].player.name);
- }
-
- server.onClientDisconnect = function (event)
- {
- // Client has disconnected; free their slot.
- var slotID = g_GameAttributes.getUsedSlotsAmount-1;
- g_GameAttributes.slots[slotID].assignOpen();
- var result = setCurrItemValue ("pgSessionSetupP" + slotID, "Open");
-
- messageBox(400, 200, "Client " + event.name + "(" + event.id + ") disconnected from " + event.session + ".", "Client Disconnected", 2, new Array(), new Array());
- }
-
- server.onChat = function (event)
- {
- messageBox(400, 200, "(" + event.sender + ")" + event.message, "Host Chat Message", 2, new Array(), new Array());
- }
-
- // Need "waiting for more players to join and start game" code here
-}
-
-// ====================================================================
-
-function initMPClient (mpParentWindow, ipAddress, profileName)
-{
- // Create the client instance
- var client = createClient();
- // Player Name
- client.playerName = profileName;
-
- client.onClientConnect = function (event)
- {
- // Set player slot to new player's name.
- console.write("onClientConnect: name is " + event.name + ", event id is " + event.id);
-
- var slotID = g_GameAttributes.getUsedSlotsAmount;
- console.write("slotID="+slotID);
- pushItem ("pgSessionSetupP" + eval(slotID+1), g_GameAttributes.slots[slotID].player.name);
- }
-
- client.onConnectComplete = function (event)
- {
- console.write("onConnectComplete: " + event.message);
- if (event.success)
- {
- // Switch to Session Setup screen.
- sessionType = "Client";
- openSessionSetup ("pgMPJoin");
-
- messageBox (400, 200, "Client connected " + event.message + ".",
- "Connect Complete", 2, new Array(), new Array());
- }
- else
- {
- messageBox (400, 200, "Client failed to complete connection: " + event.message + ".",
- "Connect Failure", 2, new Array(), new Array());
- }
- }
-
- client.onChat = function (event)
- {
- messageBox (400, 200, "(" + event.sender + ")" + event.message,
- "Client Chat Message", 2, new Array(), new Array());
- }
-
- client.onDisconnect = function (event)
- {
- console.write("onDisconnect: " + event.message);
- messageBox (400, 200, event.message,
- "Host Disconnected", 2, new Array(), new Array());
- }
-
- client.onClientDisconnect = function (event)
- {
- console.write("onClientDisconnect: " + event.message);
- messageBox (400, 200, event.session,
- "Client " + event.name + "(" + event.id + ") Disconnected", 2, new Array(), new Array());
- }
-
- client.onStartGame = function (event)
- {
- // The server has called Start Game!, so we better switch to the session GUI and stuff like that.
- launchGame();
- }
-
- var success = client.beginConnect (ipAddress);
- if (!success)
- {
- messageBox(400, 200, "Failed to connect to server. Please check the network connection.",
- "Client Failure", 2, new Array(), new Array());
- return 1;
- }
- else
- {
- console.write ("Client successfully started to connect to " + ipAddress + ".");
- }
-}
-
-// ====================================================================
+/*
+ DESCRIPTION : Functions for the hosting and joining multiplayer games.
+ NOTES :
+*/
+
+// ====================================================================
+
+function initMPHost (parentWindow, gameName, welcomeMessage, profileName)
+{
+ // Set up the server
+ var server = createServer();
+ // Welcome message
+ server.welcomeMessage = welcomeMessage;
+ // Server Name
+ server.serverName = gameName;
+ // Host Name
+ server.serverPlayerName = profileName;
+
+ // start listening
+ var success = server.open();
+ if (!success)
+ {
+ messageBox(400, 200, "Failed to start server. Please review the logfile for more information on the problem.", "Problem", 2, new Array(), new Array());
+ return 1;
+ }
+ else
+ {
+ console.write ("Host has started listening for client connections.");
+
+ // Switch to Session Setup screen.
+ sessionType = "Host";
+ openSessionSetup (parentWindow);
+ }
+
+ // -------------------------
+ // INCOMING CONNECTIONS
+ // -------------------------
+ server.onClientConnect = function (event)
+ {
+ console.write ("Client connected.");
+ console.write("A new client has successfully connected! ID: " + event.id + ", Name: " + event.name + ", Session: " + event.session);
+
+ // Assign newly connected client to next available slot.
+ var playerSlot = g_GameAttributes.getOpenSlot();
+ playerSlot.assignToSession (event.session);
+ // Set player slot to new player's name
+
+ var slotID = g_GameAttributes.getUsedSlotsAmount;
+ pushItem ("pgSessionSetupP" + slotID, g_GameAttributes.slots[slotID-1].player.name);
+ }
+
+ server.onClientDisconnect = function (event)
+ {
+ // Client has disconnected; free their slot.
+ var slotID = g_GameAttributes.getUsedSlotsAmount-1;
+ g_GameAttributes.slots[slotID].assignOpen();
+ var result = setCurrItemValue ("pgSessionSetupP" + slotID, "Open");
+
+ messageBox(400, 200, "Client " + event.name + "(" + event.id + ") disconnected from " + event.session + ".", "Client Disconnected", 2, new Array(), new Array());
+ }
+
+ server.onChat = function (event)
+ {
+ messageBox(400, 200, "(" + event.sender + ")" + event.message, "Host Chat Message", 2, new Array(), new Array());
+ }
+
+ // Need "waiting for more players to join and start game" code here
+}
+
+// ====================================================================
+
+function initMPClient (mpParentWindow, ipAddress, profileName)
+{
+ // Create the client instance
+ var client = createClient();
+ // Player Name
+ client.playerName = profileName;
+
+ client.onClientConnect = function (event)
+ {
+ // Set player slot to new player's name.
+ console.write("onClientConnect: name is " + event.name + ", event id is " + event.id);
+
+ var slotID = g_GameAttributes.getUsedSlotsAmount;
+ console.write("slotID="+slotID);
+ pushItem ("pgSessionSetupP" + eval(slotID+1), g_GameAttributes.slots[slotID].player.name);
+ }
+
+ client.onConnectComplete = function (event)
+ {
+ console.write("onConnectComplete: " + event.message);
+ if (event.success)
+ {
+ // Switch to Session Setup screen.
+ sessionType = "Client";
+ openSessionSetup ("pgMPJoin");
+
+ messageBox (400, 200, "Client connected " + event.message + ".",
+ "Connect Complete", 2, new Array(), new Array());
+ }
+ else
+ {
+ messageBox (400, 200, "Client failed to complete connection: " + event.message + ".",
+ "Connect Failure", 2, new Array(), new Array());
+ }
+ }
+
+ client.onChat = function (event)
+ {
+ messageBox (400, 200, "(" + event.sender + ")" + event.message,
+ "Client Chat Message", 2, new Array(), new Array());
+ }
+
+ client.onDisconnect = function (event)
+ {
+ console.write("onDisconnect: " + event.message);
+ messageBox (400, 200, event.message,
+ "Host Disconnected", 2, new Array(), new Array());
+ }
+
+ client.onClientDisconnect = function (event)
+ {
+ console.write("onClientDisconnect: " + event.message);
+ messageBox (400, 200, event.session,
+ "Client " + event.name + "(" + event.id + ") Disconnected", 2, new Array(), new Array());
+ }
+
+ client.onStartGame = function (event)
+ {
+ // The server has called Start Game!, so we better switch to the session GUI and stuff like that.
+ launchGame();
+ }
+
+ var success = client.beginConnect (ipAddress);
+ if (!success)
+ {
+ messageBox(400, 200, "Failed to connect to server. Please check the network connection.",
+ "Client Failure", 2, new Array(), new Array());
+ return 1;
+ }
+ else
+ {
+ console.write ("Client successfully started to connect to " + ipAddress + ".");
+ }
+}
+
+// ====================================================================
diff --git a/binaries/data/mods/public/gui/test/functions_page_pregame_setup.js b/binaries/data/mods/public/gui/test/functions_page_pregame_setup.js
index f307beac52..9618137809 100644
--- a/binaries/data/mods/public/gui/test/functions_page_pregame_setup.js
+++ b/binaries/data/mods/public/gui/test/functions_page_pregame_setup.js
@@ -1,152 +1,152 @@
-/*
- DESCRIPTION : Functions for configuring a game prior to the loading screen (hosting, joining, or skirmish).
- NOTES :
-*/
-
-// ====================================================================
-
-// Open the Session Setup screen.
-function openSessionSetup (sessionReturnWindow)
-{
- var profileName = getCurrItemValue ("pgProfileName");
- var titleBar = getGUIObjectByName ("pgSessionSetupTitleBar");
-
- // Setup remaining slots.
- for (var i = 1; i <= g_GameAttributes.numSlots; i++)
- {
- if (i == 1)
- {
- // Set the host player's name on the setup screen.
- getGUIObjectByName ("pgSessionSetupP" + i).caption = "(Host)";
- }
- else
+/*
+ DESCRIPTION : Functions for configuring a game prior to the loading screen (hosting, joining, or skirmish).
+ NOTES :
+*/
+
+// ====================================================================
+
+// Open the Session Setup screen.
+function openSessionSetup (sessionReturnWindow)
+{
+ var profileName = getCurrItemValue ("pgProfileName");
+ var titleBar = getGUIObjectByName ("pgSessionSetupTitleBar");
+
+ // Setup remaining slots.
+ for (var i = 1; i <= g_GameAttributes.numSlots; i++)
+ {
+ if (i == 1)
+ {
+ // Set the host player's name on the setup screen.
+ getGUIObjectByName ("pgSessionSetupP" + i).caption = "(Host)";
+ }
+ else
{
if (getNumItems("pgSessionSetupP" + i) == 0)
- {
- //pushItem ("pgSessionSetupP" + i, "session");
- pushItem ("pgSessionSetupP" + i, "Open");
- pushItem ("pgSessionSetupP" + i, "Closed");
- //pushItem ("pgSessionSetupP" + i, "local");
- //pushItem ("pgSessionSetupP" + i, "AI");
-
- // Set other slots to Open.
- var result = setCurrItemValue ("pgSessionSetupP" + i, "Open");
-
- // Setup onchange event (closing and opening affects host slots).
- getGUIObjectByName ("pgSessionSetupP" + i).onSelectionChange = function (event)
- {
- var slotNumber = this.name.substring (this.name.length-1, this.name.length);
- switch (getCurrItemValue (this.name))
- {
- case "Open":
- // If "Open" selected,
-
- // Open the slot.
- g_GameAttributes.slots[slotNumber-1].assignOpen();
-
- //console.write ("Opened slot " + this.name);
- break;
- case "Closed":
- // If "Closed" selected,
-
- // And slot is occupied,
- if (g_GameAttributes.slots[slotNumber-1].assignment == "session")
- {
- // Remove player name from slot list.
- removeItem (this.name, g_GameAttributes.slots[slotNumber-1].player);
-
- // Prompt that player was kicked.
- // (Change this to a chat message when functionality available.)
- console.write (g_GameAttributes.slots[slotNumber-1].player + " was kicked by the host.");
- }
-
- // Close the slot.
- g_GameAttributes.slots[slotNumber-1].assignClosed();
-
- //console.write ("Closed slot " + this.name);
- break;
- default:
- break;
- }
- }
- }
- }
-
- // Make objects non-interactive to client.
- if (sessionType == "Client") guiDisable ("pgSessionSetupP" + i);
- }
-
- // Set the title for the setup screen
- switch (sessionType)
- {
- case "Host":
- titleBar.caption = "Hosting: " + g_NetServer.serverName;
- // Reveal type-specific Session Setup objects.
- guiUnHide ("pgSessionSetupMP");
- guiUnHide ("pgSessionSetupMPHost");
- guiUnHide ("pgSessionSetupMaster");
- break;
- case "Client":
- titleBar.caption = "Joining: " // g_NetServer.serverName;
- // Reveal type-specific Session Setup objects.
- guiUnHide ("pgSessionSetupMP");
- guiUnHide ("pgSessionSetupMPClient");
-
- // Disable objects that clients shouldn't be able to modify.
- guiDisable ("pgSessionSetupMapName");
- guiDisable ("pgSessionSetupStartButton");
- break;
- case "Skirmish":
- titleBar.caption = "Skirmish";
- // Reveal type-specific Session Setup objects.
- guiUnHide ("pgSessionSetupSkirmish");
- guiUnHide ("pgSessionSetupMaster");
- break;
- default:
- break;
- }
-
- // Reveal GUI.
- guiHide ("pgVersionNumber");
- if (sessionReturnWindow != "")
- guiSwitch (sessionReturnWindow, "pgSessionSetup");
- else
- openMainMenuSubWindow ("pgSessionSetup");
-}
-
-// ====================================================================
-
-// Close/cancel the Session Setup screen.
-function closeSessionSetup ()
-{
- // Hide type-specific objects.
- guiHide ("pgSessionSetupMP");
- guiHide ("pgSessionSetupMPHost");
- guiHide ("pgSessionSetupMPClient");
- guiHide ("pgSessionSetupSkirmish");
- guiHide ("pgSessionSetupMaster");
-
- // Return to previous screen.
- switch (sessionType)
- {
- case "Host":
- case "Client":
- // terminate the multiplayer server session
- endGame();
-
- // Go back to multiplayer mode selection screen.
- guiSwitch ("pgSessionSetup", "pgMPModeSel");
- break;
- case "Skirmish":
- // Go back to main menu.
- closeMainMenuSubWindow ("pgSessionSetup");
- break;
- default:
- break;
- }
-
- guiUnHide ("pgVersionNumber");
-}
-
-// ====================================================================
-
+ {
+ //pushItem ("pgSessionSetupP" + i, "session");
+ pushItem ("pgSessionSetupP" + i, "Open");
+ pushItem ("pgSessionSetupP" + i, "Closed");
+ //pushItem ("pgSessionSetupP" + i, "local");
+ //pushItem ("pgSessionSetupP" + i, "AI");
+
+ // Set other slots to Open.
+ var result = setCurrItemValue ("pgSessionSetupP" + i, "Open");
+
+ // Setup onchange event (closing and opening affects host slots).
+ getGUIObjectByName ("pgSessionSetupP" + i).onSelectionChange = function (event)
+ {
+ var slotNumber = this.name.substring (this.name.length-1, this.name.length);
+ switch (getCurrItemValue (this.name))
+ {
+ case "Open":
+ // If "Open" selected,
+
+ // Open the slot.
+ g_GameAttributes.slots[slotNumber-1].assignOpen();
+
+ //console.write ("Opened slot " + this.name);
+ break;
+ case "Closed":
+ // If "Closed" selected,
+
+ // And slot is occupied,
+ if (g_GameAttributes.slots[slotNumber-1].assignment == "session")
+ {
+ // Remove player name from slot list.
+ removeItem (this.name, g_GameAttributes.slots[slotNumber-1].player);
+
+ // Prompt that player was kicked.
+ // (Change this to a chat message when functionality available.)
+ console.write (g_GameAttributes.slots[slotNumber-1].player + " was kicked by the host.");
+ }
+
+ // Close the slot.
+ g_GameAttributes.slots[slotNumber-1].assignClosed();
+
+ //console.write ("Closed slot " + this.name);
+ break;
+ default:
+ break;
+ }
+ }
+ }
+ }
+
+ // Make objects non-interactive to client.
+ if (sessionType == "Client") guiDisable ("pgSessionSetupP" + i);
+ }
+
+ // Set the title for the setup screen
+ switch (sessionType)
+ {
+ case "Host":
+ titleBar.caption = "Hosting: " + g_NetServer.serverName;
+ // Reveal type-specific Session Setup objects.
+ guiUnHide ("pgSessionSetupMP");
+ guiUnHide ("pgSessionSetupMPHost");
+ guiUnHide ("pgSessionSetupMaster");
+ break;
+ case "Client":
+ titleBar.caption = "Joining: " // g_NetServer.serverName;
+ // Reveal type-specific Session Setup objects.
+ guiUnHide ("pgSessionSetupMP");
+ guiUnHide ("pgSessionSetupMPClient");
+
+ // Disable objects that clients shouldn't be able to modify.
+ guiDisable ("pgSessionSetupMapName");
+ guiDisable ("pgSessionSetupStartButton");
+ break;
+ case "Skirmish":
+ titleBar.caption = "Skirmish";
+ // Reveal type-specific Session Setup objects.
+ guiUnHide ("pgSessionSetupSkirmish");
+ guiUnHide ("pgSessionSetupMaster");
+ break;
+ default:
+ break;
+ }
+
+ // Reveal GUI.
+ guiHide ("pgVersionNumber");
+ if (sessionReturnWindow != "")
+ guiSwitch (sessionReturnWindow, "pgSessionSetup");
+ else
+ openMainMenuSubWindow ("pgSessionSetup");
+}
+
+// ====================================================================
+
+// Close/cancel the Session Setup screen.
+function closeSessionSetup ()
+{
+ // Hide type-specific objects.
+ guiHide ("pgSessionSetupMP");
+ guiHide ("pgSessionSetupMPHost");
+ guiHide ("pgSessionSetupMPClient");
+ guiHide ("pgSessionSetupSkirmish");
+ guiHide ("pgSessionSetupMaster");
+
+ // Return to previous screen.
+ switch (sessionType)
+ {
+ case "Host":
+ case "Client":
+ // terminate the multiplayer server session
+ endGame();
+
+ // Go back to multiplayer mode selection screen.
+ guiSwitch ("pgSessionSetup", "pgMPModeSel");
+ break;
+ case "Skirmish":
+ // Go back to main menu.
+ closeMainMenuSubWindow ("pgSessionSetup");
+ break;
+ default:
+ break;
+ }
+
+ guiUnHide ("pgVersionNumber");
+}
+
+// ====================================================================
+
diff --git a/binaries/data/mods/public/gui/test/functions_page_session.js b/binaries/data/mods/public/gui/test/functions_page_session.js
index 9935b856da..8461380890 100644
--- a/binaries/data/mods/public/gui/test/functions_page_session.js
+++ b/binaries/data/mods/public/gui/test/functions_page_session.js
@@ -1,418 +1,418 @@
-/*
- DESCRIPTION : Functions for "main game" session GUI.
- NOTES :
-*/
-
-// ====================================================================
-
-function initSession()
-{
- // ============================================= CONSTANTS =================================================
-
- snConst = new Object();
-
- // Portraits (large and small).
- snConst.Portrait = new Object();
- snConst.Portrait.Sml = new Object();
- snConst.Portrait.Sml.Width = 45;
- snConst.Portrait.Sml.Height = snConst.Portrait.Sml.Width;
- snConst.Portrait.Lrg = new Object();
- snConst.Portrait.Lrg.Width = 64;
- snConst.Portrait.Lrg.Height = snConst.Portrait.Lrg.Width;
-
- // Small icons (eg Movement Rate, Food).
- snConst.MiniIcon = new Object();
- snConst.MiniIcon.Width = 30;
- snConst.MiniIcon.Height = snConst.MiniIcon.Width;
-
- // ============================================= GLOBALS =================================================
-
- // Define cell reference constants for icon sheets.
- initCellReference();
-}
-
-// ====================================================================
-
-function initCellReference()
-{
- cellGroup = new Array();
-
- // Define categories of cell groups by checking their reference files in the same locations as the icon sheets.
- addCellGroupCategory ("art/textures/ui/session/icons/sheets/");
- // (Note that we don't use this and we probably shouldn't, since the entities state which icon cell they should use; it makes it easier to remember which icon is used
- // for which unit if we have this reference sheet, though.)
- addCellGroupCategory ("art/textures/ui/session/portraits/sheets/");
-}
-
-// ====================================================================
-
-function addCellGroupCategory(iconSheetPath)
-{
- // Get array list of all icon sheet reference files.
- var iconSheets = buildDirEntList (iconSheetPath, "*.txt", true);
- // Alphabetically sort the array.
- iconSheets.sort();
-
- // Seek through all icon sheets.
- for (var sheet = 0; sheet < iconSheets.length; sheet++)
- {
- // Get the current icon sheet name.
- var groupName = iconSheets[sheet];
- // Remove path and extension information so we just have the group name.
- groupName = groupName.replace (iconSheetPath, "");
- groupName = groupName.replace (".txt", "");
- groupName = toTitleCase(groupName);
-
- // Get the elements from the current icon sheet.
- var iconArray = readFileLines (iconSheets[sheet]);
-
- // For each row in the icon sheet file,
- for (var row = 0; row < iconArray.length; row++)
- {
- // Get the individual fields in the array as another array.
- var iconElements = iconArray[row].split (",");
- // Add this cell to the current group.
- addCell (groupName, iconElements[0], iconElements[1]);
- }
- }
-}
-
-// ====================================================================
-
-function addCell (group, cellID, cellName)
-{
- // Add a cell ID to a cell container group.
-
- // If this array does not exist,
- if (!cellGroup[group])
- {
- // Create the container.
- cellGroup[group] = new Array();
- cellGroup[group].length = new Object(0);
- }
-
- cellGroup[group][cellID] = new Array();
- cellGroup[group][cellID].id = new Object (cellGroup[group].length);
- cellGroup[group][cellID].name = new Object (cellName);
-
- cellGroup[group].length++;
-}
-
-// ====================================================================
-
-function setPortrait(objectName, portraitString, portraitSuffix, portraitCell)
-{
- // Use this function as a shortcut to change a portrait object to a different portrait image.
-
- // Accepts an object and specifies its default, rollover (lit) and disabled (gray) sprites.
- // Sprite Format: "sn""portraitString""portraitSuffix"
- // Sprite Format: "sn""portraitString""portraitSuffix""Over"
- // Sprite Format: "sn""portraitString""portraitSuffix""Disabled"
- // Note: Make sure the file follows this naming convention or bad things could happen.
-
- // Get GUI object
- setPortraitGUIObject = getGUIObjectByName(objectName);
-
- // Report error if object not found.
- if (!setPortraitGUIObject)
- {
- console.write ("setPortrait(): Failed to find object " + objectName + ".");
- return 1;
- }
-
- // Set the three portraits.
- if (portraitSuffix && portraitSuffix != "")
- setPortraitGUIObject.sprite = "sn" + portraitString + portraitSuffix;
- else
- setPortraitGUIObject.sprite = "sn" + portraitString;
-
- setPortraitGUIObject.sprite_over = setPortraitGUIObject.sprite + "Over";
- setPortraitGUIObject.sprite_disabled = setPortraitGUIObject.sprite + "Disabled";
-
- // If the source texture is a multi-frame image (icon sheet), specify correct cell.
- if (portraitCell && portraitCell != "")
- setPortraitGUIObject.cell_id = portraitCell;
- else
- setPortraitGUIObject.cell_id = "";
-
- return 0;
-}
-
-// ====================================================================
-
-function flipGUI (NewGUIType)
-{
- // Changes GUI to a different layout.
-
- switch (NewGUIType)
- {
- // Set which GUI to use.
- case rb:
- case lb:
- case lt:
- case rt:
- GUIType = NewGUIType;
- break;
- default:
- // If no type specified, toggle.
- if (GUIType == rb)
- GUIType = lb;
- else
- if (GUIType == lb)
- GUIType = lt;
- else
- if (GUIType == lt)
- GUIType = rt;
- else
- GUIType = rb;
- break;
- }
- // Seek through all sizes created.
- for (var i = 0; i <= Crd.last; i++)
- {
- // Set their sizes to the stored value.
- getGUIObjectByName (Crd[i].name).size = Crd[i].size[GUIType];
- }
-
- writeConsole("GUI flipped to size " + GUIType + ".");
-}
-
-// ====================================================================
-
-// Update-on-alteration trickery...
-
-// We don't really want to update every single time we get a
-// selection-changed or property-changed event; that could happen
-// a lot. Instead, use this bunch of globals to cache any changes
-// that happened between GUI updates.
-
-// This boolean determines whether the selection has been changed.
-var selectionChanged = false;
-
-// This boolean determines what the template of the selected object
-// was when last we looked
-var selectionTemplate = null;
-
-// This array holds the name of all properties that need to be updated
-var selectionPropertiesChanged = new Array();
-
-// This array holds a list of all the objects we hold property-change
-// watches on
-var propertyWatches = new Array();
-
-// ====================================================================
-
-// This function resets all the update variables, above
-
-function resetUpdateVars()
-{
- if( selectionChanged )
- {
- for( watchedObject in propertyWatches )
- propertyWatches[watchedObject].unwatchAll( selectionWatchHandler ); // Remove the handler
-
- propertyWatches = new Array();
- if( selection.length > 0 && selection[0] )
- {
- // Watch the object itself
- selection[0].watchAll( selectionWatchHandler );
- propertyWatches.push( selection[0] );
- // And every parent back up the tree (changes there will affect
- // displayed properties via inheritance)
- var parent = selection[0].template
- while( parent )
- {
- parent.watchAll( selectionWatchHandler );
- propertyWatches.push( selection[0] );
- parent = parent.parent;
- }
- }
- }
- selectionChanged = false;
- if( selection.length > 0 && selection[0] )
- {
- selectionTemplate = selection[0].template;
- }
- else
- selectionTemplate = null;
-
- selectionPropertiesChanged = new Array();
-}
-
-// ====================================================================
-
-// This function returns whether we should update a particular statistic
-// in the GUI (e.g. "actions.attack") - this should happen if: the selection
-// changed, the selection had its template altered (changing lots of stuff)
-// or an assignment has been made to that stat or any property within that
-// stat.
-
-function shouldUpdateStat( statname )
-{
- if( selectionChanged || ( selectionTemplate != selection[0].template ) )
- {
- return( true );
- }
- for( var property in selectionPropertiesChanged )
- {
- // If property starts with statname
- if( selectionPropertiesChanged[property].substring( 0, statname.length ) == statname )
- {
- return( true );
- }
- }
- return( false );
-}
-
-// ====================================================================
-
-// This function is a handler for the 'selectionChanged' event,
-// it updates the selectionChanged flag
-
-function selectionChangedHandler()
-{
- selectionChanged = true;
-}
-
-// ====================================================================
-
-// Register it.
-addGlobalHandler( "selectionChanged", selectionChangedHandler );
-
-// ====================================================================
-
-// This function is a handler for a watch event; it updates the
-// selectionPropertiesChanged array.
-
-function selectionWatchHandler( propname, oldvalue, newvalue )
-{
- selectionPropertiesChanged.push( propname );
- // This bit's important (watches allow the handler to change the value
- // before it gets written; we don't want to affect things, so make sure
- // the value we send back is the one that was going to be written)
- return( newvalue );
-}
-
-// ====================================================================
-
-function snRefresh()
-{
- // Updated each tick to refresh session controls if necessary.
-
- // Don't process GUI when we're full-screen.
- if (getGUIObjectByName ("sn").hidden == false)
- {
- if (!selection.length) // If no entity selected,
- {
- // Hide Status Orb
- guiHide ("snStatusPane");
-
- // Hide Group Pane.
-// guiHide ("snGroupPane");
-
- getGlobal().MultipleEntitiesSelected = 0;
- }
- else // If at least one entity selected,
- {
- // Reveal Status Orb
- guiUnHide ("snStatusPane");
-
-// (later, we need to base this on the selected unit's stats changing)
- refreshStatusPane();
-
- // Check if a group of entities selected
- if (selection.length > 1)
- {
- // If a group pane isn't already open, and we don't have the same set as last time,
- if (selection.length != getGlobal().MultipleEntitiesSelected)
- {
-// (later, we need to base this on the selection changing)
-// refreshGroupPane();
- getGlobal().MultipleEntitiesSelected = selection.length;
- }
- }
- else
- {
- getGlobal().MultipleEntitiesSelected = 0;
-
- // Hide Group Pane.
-// guiHide ("snGroupPane");
- }
- }
-
- // Modify any resources given/taken
-// (later, we need to base this on a resource-changing event).
-// refreshResourcePool();
-
- // Update Team Tray
-// (later, we need to base this on the player creating a group).
-// refreshTeamTray();
-
- // Refresh handler that monitors whether property/selection has been updated.
- resetUpdateVars();
-
- // Refresh resources
- refreshResources();
- }
-
- if ( selectionChanged && getGUIObjectByName( "mn" ).hidden == false)
- {
- // Update manual if it's open.
- refreshManual();
- }
-}
-
-// ====================================================================
-
-
-function confirmLeave()
-{
- if (isGameRunning())
- {
- endSession("return");
- }
- else
- {
- exit();
- }
-}
-
-// ====================================================================
-
-playersList_init = false;
-
-function togglePlayersList()
-{
- //Initialization of names and colors.
- if (!playersList_init)
- {
- playersList_init = true;
- var trueLength = 0;
-
- for (var i=1; i<=players.length-1; i++)
- {
- if (players[i].active)
- trueLength++;
- }
-
- for (var i=1; i<=trueLength; i++)
- {
- if (players[i].active)
- {
- getGUIObjectByName("Player_" + (i+8-trueLength)).caption = players[i].name;
- getGUIObjectByName("PlayerShadow_" + (i+8-trueLength)).caption = players[i].name;
-
- var col_r = parseInt(players[i].getColour().r * 255);
- var col_g = parseInt(players[i].getColour().g * 255);
- var col_b = parseInt(players[i].getColour().b * 255);
-
- getGUIObjectByName("Player_" + (i+8-trueLength)).textcolor = col_r + " " + col_g + " " + col_b;
- }
- }
- }
-
- var pl = getGUIObjectByName("PlayersList");
- pl.hidden = ! pl.hidden;
- var pls = getGUIObjectByName("PlayersListShadow");
- pls.hidden = ! pls.hidden;
+/*
+ DESCRIPTION : Functions for "main game" session GUI.
+ NOTES :
+*/
+
+// ====================================================================
+
+function initSession()
+{
+ // ============================================= CONSTANTS =================================================
+
+ snConst = new Object();
+
+ // Portraits (large and small).
+ snConst.Portrait = new Object();
+ snConst.Portrait.Sml = new Object();
+ snConst.Portrait.Sml.Width = 45;
+ snConst.Portrait.Sml.Height = snConst.Portrait.Sml.Width;
+ snConst.Portrait.Lrg = new Object();
+ snConst.Portrait.Lrg.Width = 64;
+ snConst.Portrait.Lrg.Height = snConst.Portrait.Lrg.Width;
+
+ // Small icons (eg Movement Rate, Food).
+ snConst.MiniIcon = new Object();
+ snConst.MiniIcon.Width = 30;
+ snConst.MiniIcon.Height = snConst.MiniIcon.Width;
+
+ // ============================================= GLOBALS =================================================
+
+ // Define cell reference constants for icon sheets.
+ initCellReference();
+}
+
+// ====================================================================
+
+function initCellReference()
+{
+ cellGroup = new Array();
+
+ // Define categories of cell groups by checking their reference files in the same locations as the icon sheets.
+ addCellGroupCategory ("art/textures/ui/session/icons/sheets/");
+ // (Note that we don't use this and we probably shouldn't, since the entities state which icon cell they should use; it makes it easier to remember which icon is used
+ // for which unit if we have this reference sheet, though.)
+ addCellGroupCategory ("art/textures/ui/session/portraits/sheets/");
+}
+
+// ====================================================================
+
+function addCellGroupCategory(iconSheetPath)
+{
+ // Get array list of all icon sheet reference files.
+ var iconSheets = buildDirEntList (iconSheetPath, "*.txt", true);
+ // Alphabetically sort the array.
+ iconSheets.sort();
+
+ // Seek through all icon sheets.
+ for (var sheet = 0; sheet < iconSheets.length; sheet++)
+ {
+ // Get the current icon sheet name.
+ var groupName = iconSheets[sheet];
+ // Remove path and extension information so we just have the group name.
+ groupName = groupName.replace (iconSheetPath, "");
+ groupName = groupName.replace (".txt", "");
+ groupName = toTitleCase(groupName);
+
+ // Get the elements from the current icon sheet.
+ var iconArray = readFileLines (iconSheets[sheet]);
+
+ // For each row in the icon sheet file,
+ for (var row = 0; row < iconArray.length; row++)
+ {
+ // Get the individual fields in the array as another array.
+ var iconElements = iconArray[row].split (",");
+ // Add this cell to the current group.
+ addCell (groupName, iconElements[0], iconElements[1]);
+ }
+ }
+}
+
+// ====================================================================
+
+function addCell (group, cellID, cellName)
+{
+ // Add a cell ID to a cell container group.
+
+ // If this array does not exist,
+ if (!cellGroup[group])
+ {
+ // Create the container.
+ cellGroup[group] = new Array();
+ cellGroup[group].length = new Object(0);
+ }
+
+ cellGroup[group][cellID] = new Array();
+ cellGroup[group][cellID].id = new Object (cellGroup[group].length);
+ cellGroup[group][cellID].name = new Object (cellName);
+
+ cellGroup[group].length++;
+}
+
+// ====================================================================
+
+function setPortrait(objectName, portraitString, portraitSuffix, portraitCell)
+{
+ // Use this function as a shortcut to change a portrait object to a different portrait image.
+
+ // Accepts an object and specifies its default, rollover (lit) and disabled (gray) sprites.
+ // Sprite Format: "sn""portraitString""portraitSuffix"
+ // Sprite Format: "sn""portraitString""portraitSuffix""Over"
+ // Sprite Format: "sn""portraitString""portraitSuffix""Disabled"
+ // Note: Make sure the file follows this naming convention or bad things could happen.
+
+ // Get GUI object
+ setPortraitGUIObject = getGUIObjectByName(objectName);
+
+ // Report error if object not found.
+ if (!setPortraitGUIObject)
+ {
+ console.write ("setPortrait(): Failed to find object " + objectName + ".");
+ return 1;
+ }
+
+ // Set the three portraits.
+ if (portraitSuffix && portraitSuffix != "")
+ setPortraitGUIObject.sprite = "sn" + portraitString + portraitSuffix;
+ else
+ setPortraitGUIObject.sprite = "sn" + portraitString;
+
+ setPortraitGUIObject.sprite_over = setPortraitGUIObject.sprite + "Over";
+ setPortraitGUIObject.sprite_disabled = setPortraitGUIObject.sprite + "Disabled";
+
+ // If the source texture is a multi-frame image (icon sheet), specify correct cell.
+ if (portraitCell && portraitCell != "")
+ setPortraitGUIObject.cell_id = portraitCell;
+ else
+ setPortraitGUIObject.cell_id = "";
+
+ return 0;
+}
+
+// ====================================================================
+
+function flipGUI (NewGUIType)
+{
+ // Changes GUI to a different layout.
+
+ switch (NewGUIType)
+ {
+ // Set which GUI to use.
+ case rb:
+ case lb:
+ case lt:
+ case rt:
+ GUIType = NewGUIType;
+ break;
+ default:
+ // If no type specified, toggle.
+ if (GUIType == rb)
+ GUIType = lb;
+ else
+ if (GUIType == lb)
+ GUIType = lt;
+ else
+ if (GUIType == lt)
+ GUIType = rt;
+ else
+ GUIType = rb;
+ break;
+ }
+ // Seek through all sizes created.
+ for (var i = 0; i <= Crd.last; i++)
+ {
+ // Set their sizes to the stored value.
+ getGUIObjectByName (Crd[i].name).size = Crd[i].size[GUIType];
+ }
+
+ writeConsole("GUI flipped to size " + GUIType + ".");
+}
+
+// ====================================================================
+
+// Update-on-alteration trickery...
+
+// We don't really want to update every single time we get a
+// selection-changed or property-changed event; that could happen
+// a lot. Instead, use this bunch of globals to cache any changes
+// that happened between GUI updates.
+
+// This boolean determines whether the selection has been changed.
+var selectionChanged = false;
+
+// This boolean determines what the template of the selected object
+// was when last we looked
+var selectionTemplate = null;
+
+// This array holds the name of all properties that need to be updated
+var selectionPropertiesChanged = new Array();
+
+// This array holds a list of all the objects we hold property-change
+// watches on
+var propertyWatches = new Array();
+
+// ====================================================================
+
+// This function resets all the update variables, above
+
+function resetUpdateVars()
+{
+ if( selectionChanged )
+ {
+ for( watchedObject in propertyWatches )
+ propertyWatches[watchedObject].unwatchAll( selectionWatchHandler ); // Remove the handler
+
+ propertyWatches = new Array();
+ if( selection.length > 0 && selection[0] )
+ {
+ // Watch the object itself
+ selection[0].watchAll( selectionWatchHandler );
+ propertyWatches.push( selection[0] );
+ // And every parent back up the tree (changes there will affect
+ // displayed properties via inheritance)
+ var parent = selection[0].template
+ while( parent )
+ {
+ parent.watchAll( selectionWatchHandler );
+ propertyWatches.push( selection[0] );
+ parent = parent.parent;
+ }
+ }
+ }
+ selectionChanged = false;
+ if( selection.length > 0 && selection[0] )
+ {
+ selectionTemplate = selection[0].template;
+ }
+ else
+ selectionTemplate = null;
+
+ selectionPropertiesChanged = new Array();
+}
+
+// ====================================================================
+
+// This function returns whether we should update a particular statistic
+// in the GUI (e.g. "actions.attack") - this should happen if: the selection
+// changed, the selection had its template altered (changing lots of stuff)
+// or an assignment has been made to that stat or any property within that
+// stat.
+
+function shouldUpdateStat( statname )
+{
+ if( selectionChanged || ( selectionTemplate != selection[0].template ) )
+ {
+ return( true );
+ }
+ for( var property in selectionPropertiesChanged )
+ {
+ // If property starts with statname
+ if( selectionPropertiesChanged[property].substring( 0, statname.length ) == statname )
+ {
+ return( true );
+ }
+ }
+ return( false );
+}
+
+// ====================================================================
+
+// This function is a handler for the 'selectionChanged' event,
+// it updates the selectionChanged flag
+
+function selectionChangedHandler()
+{
+ selectionChanged = true;
+}
+
+// ====================================================================
+
+// Register it.
+addGlobalHandler( "selectionChanged", selectionChangedHandler );
+
+// ====================================================================
+
+// This function is a handler for a watch event; it updates the
+// selectionPropertiesChanged array.
+
+function selectionWatchHandler( propname, oldvalue, newvalue )
+{
+ selectionPropertiesChanged.push( propname );
+ // This bit's important (watches allow the handler to change the value
+ // before it gets written; we don't want to affect things, so make sure
+ // the value we send back is the one that was going to be written)
+ return( newvalue );
+}
+
+// ====================================================================
+
+function snRefresh()
+{
+ // Updated each tick to refresh session controls if necessary.
+
+ // Don't process GUI when we're full-screen.
+ if (getGUIObjectByName ("sn").hidden == false)
+ {
+ if (!selection.length) // If no entity selected,
+ {
+ // Hide Status Orb
+ guiHide ("snStatusPane");
+
+ // Hide Group Pane.
+// guiHide ("snGroupPane");
+
+ getGlobal().MultipleEntitiesSelected = 0;
+ }
+ else // If at least one entity selected,
+ {
+ // Reveal Status Orb
+ guiUnHide ("snStatusPane");
+
+// (later, we need to base this on the selected unit's stats changing)
+ refreshStatusPane();
+
+ // Check if a group of entities selected
+ if (selection.length > 1)
+ {
+ // If a group pane isn't already open, and we don't have the same set as last time,
+ if (selection.length != getGlobal().MultipleEntitiesSelected)
+ {
+// (later, we need to base this on the selection changing)
+// refreshGroupPane();
+ getGlobal().MultipleEntitiesSelected = selection.length;
+ }
+ }
+ else
+ {
+ getGlobal().MultipleEntitiesSelected = 0;
+
+ // Hide Group Pane.
+// guiHide ("snGroupPane");
+ }
+ }
+
+ // Modify any resources given/taken
+// (later, we need to base this on a resource-changing event).
+// refreshResourcePool();
+
+ // Update Team Tray
+// (later, we need to base this on the player creating a group).
+// refreshTeamTray();
+
+ // Refresh handler that monitors whether property/selection has been updated.
+ resetUpdateVars();
+
+ // Refresh resources
+ refreshResources();
+ }
+
+ if ( selectionChanged && getGUIObjectByName( "mn" ).hidden == false)
+ {
+ // Update manual if it's open.
+ refreshManual();
+ }
+}
+
+// ====================================================================
+
+
+function confirmLeave()
+{
+ if (isGameRunning())
+ {
+ endSession("return");
+ }
+ else
+ {
+ exit();
+ }
+}
+
+// ====================================================================
+
+playersList_init = false;
+
+function togglePlayersList()
+{
+ //Initialization of names and colors.
+ if (!playersList_init)
+ {
+ playersList_init = true;
+ var trueLength = 0;
+
+ for (var i=1; i<=players.length-1; i++)
+ {
+ if (players[i].active)
+ trueLength++;
+ }
+
+ for (var i=1; i<=trueLength; i++)
+ {
+ if (players[i].active)
+ {
+ getGUIObjectByName("Player_" + (i+8-trueLength)).caption = players[i].name;
+ getGUIObjectByName("PlayerShadow_" + (i+8-trueLength)).caption = players[i].name;
+
+ var col_r = parseInt(players[i].getColour().r * 255);
+ var col_g = parseInt(players[i].getColour().g * 255);
+ var col_b = parseInt(players[i].getColour().b * 255);
+
+ getGUIObjectByName("Player_" + (i+8-trueLength)).textcolor = col_r + " " + col_g + " " + col_b;
+ }
+ }
+ }
+
+ var pl = getGUIObjectByName("PlayersList");
+ pl.hidden = ! pl.hidden;
+ var pls = getGUIObjectByName("PlayersListShadow");
+ pls.hidden = ! pls.hidden;
}
diff --git a/binaries/data/mods/public/gui/test/functions_page_session_manual.js b/binaries/data/mods/public/gui/test/functions_page_session_manual.js
index eb60a4a105..4879ec195d 100644
--- a/binaries/data/mods/public/gui/test/functions_page_session_manual.js
+++ b/binaries/data/mods/public/gui/test/functions_page_session_manual.js
@@ -1,88 +1,88 @@
-/*
- DESCRIPTION : Functions for the "online manual" part of the Session GUI.
- NOTES :
-*/
-
-// ====================================================================
-
-function addItemsRecursively (container, indent, fontName)
-{
- // List the tree of items in a container and store it in the string *recursiveString* by recursively calling the function. (Thanks, Philip.)
-
- // Reset recursive string if this is the first call.
- if (indent == "")
- recursiveString = "";
-
- for (var item in container)
- {
- // Skip null strings and function references.
- if (item != null && container[item] != null
- && container[item].toString().substring (0, 1) != "\n" && item != "template")
- {
- // Root-level items are in bold.
- recursiveString += "[font=" + fontName;
- if (indent == "")
- recursiveString += "b]";
- else
- recursiveString += "]";
-
- // Display the property name, and the value, if any.
- if (container[item] == true && container[item].toString() != true)
- recursiveString += indent + " " + item + "\n";
- else
- recursiveString += indent + " " + item + ": " + container[item] + "\n";
-
- // Retrieve sub-items.
- if (typeof container[item] == 'object')
- addItemsRecursively (container[item], indent + "--", fontName);
- }
- }
-}
-
-// ====================================================================
-
-function refreshManual()
-{
- if (selection.length != 0)
- {
- // Display portrait.
- if (selection[0].traits.id.icon)
- {
- setPortrait ("mnPortrait", selection[0].traits.id.icon,
- "Button" + toTitleCase(selection[0].traits.id.civ_code), selection[0].traits.id.icon_cell);
- }
-
- // Display rollover text.
- if (selection[0].traits.id.rollover)
- {
- var manualRollover = getGUIObjectByName("mnRollover");
- manualRollover.caption = selection[0].traits.id.rollover;
- }
-
- // Display history text.
- if (selection[0].traits.id.rollover)
- {
- var manualHistory = getGUIObjectByName("mnHistory");
- manualHistory.caption = selection[0].traits.id.history;
- }
-
- // Build manual text.
- var manualText = "";
- addItemsRecursively ( selection[0], "", "trebuchet14" );
- manualText += recursiveString;
-
- // Close the manual string.
- manualText += "[/font]";
-
- // Assign manual text to control.
- getGUIObjectByName("mnText").caption = manualText;
- }
- else
- {
- // If the player has removed the selection while the manual is open, close the manual.
- guiHide("mn");
- guiUnHide("sn");
- }
-}
-
+/*
+ DESCRIPTION : Functions for the "online manual" part of the Session GUI.
+ NOTES :
+*/
+
+// ====================================================================
+
+function addItemsRecursively (container, indent, fontName)
+{
+ // List the tree of items in a container and store it in the string *recursiveString* by recursively calling the function. (Thanks, Philip.)
+
+ // Reset recursive string if this is the first call.
+ if (indent == "")
+ recursiveString = "";
+
+ for (var item in container)
+ {
+ // Skip null strings and function references.
+ if (item != null && container[item] != null
+ && container[item].toString().substring (0, 1) != "\n" && item != "template")
+ {
+ // Root-level items are in bold.
+ recursiveString += "[font=" + fontName;
+ if (indent == "")
+ recursiveString += "b]";
+ else
+ recursiveString += "]";
+
+ // Display the property name, and the value, if any.
+ if (container[item] == true && container[item].toString() != true)
+ recursiveString += indent + " " + item + "\n";
+ else
+ recursiveString += indent + " " + item + ": " + container[item] + "\n";
+
+ // Retrieve sub-items.
+ if (typeof container[item] == 'object')
+ addItemsRecursively (container[item], indent + "--", fontName);
+ }
+ }
+}
+
+// ====================================================================
+
+function refreshManual()
+{
+ if (selection.length != 0)
+ {
+ // Display portrait.
+ if (selection[0].traits.id.icon)
+ {
+ setPortrait ("mnPortrait", selection[0].traits.id.icon,
+ "Button" + toTitleCase(selection[0].traits.id.civ_code), selection[0].traits.id.icon_cell);
+ }
+
+ // Display rollover text.
+ if (selection[0].traits.id.rollover)
+ {
+ var manualRollover = getGUIObjectByName("mnRollover");
+ manualRollover.caption = selection[0].traits.id.rollover;
+ }
+
+ // Display history text.
+ if (selection[0].traits.id.rollover)
+ {
+ var manualHistory = getGUIObjectByName("mnHistory");
+ manualHistory.caption = selection[0].traits.id.history;
+ }
+
+ // Build manual text.
+ var manualText = "";
+ addItemsRecursively ( selection[0], "", "trebuchet14" );
+ manualText += recursiveString;
+
+ // Close the manual string.
+ manualText += "[/font]";
+
+ // Assign manual text to control.
+ getGUIObjectByName("mnText").caption = manualText;
+ }
+ else
+ {
+ // If the player has removed the selection while the manual is open, close the manual.
+ guiHide("mn");
+ guiUnHide("sn");
+ }
+}
+
// ====================================================================
\ No newline at end of file
diff --git a/binaries/data/mods/public/gui/test/functions_page_session_status_commands.js b/binaries/data/mods/public/gui/test/functions_page_session_status_commands.js
index 8f1b5f9f63..ae5951b876 100644
--- a/binaries/data/mods/public/gui/test/functions_page_session_status_commands.js
+++ b/binaries/data/mods/public/gui/test/functions_page_session_status_commands.js
@@ -1,510 +1,510 @@
-/*
- DESCRIPTION : Functions for the Command Buttons orbitting the Status Pane.
- NOTES :
-*/
-
-// ====================================================================
-
-function defineCommandButtons(command)
-{
- snStatusPaneCommand = new Array();
- snStatusPaneCommand.tab = new Object();
- snStatusPaneCommand.list = new Object();
+/*
+ DESCRIPTION : Functions for the Command Buttons orbitting the Status Pane.
+ NOTES :
+*/
+
+// ====================================================================
+
+function defineCommandButtons(command)
+{
+ snStatusPaneCommand = new Array();
+ snStatusPaneCommand.tab = new Object();
+ snStatusPaneCommand.list = new Object();
snStatusPaneCommand.button = new Object();
- empty = false;
-
- // Maximum number of buttons (either single or lists).
- snStatusPaneCommand.tab.max = command.substring (command.lastIndexOf ("d")+1, command.lastIndexOf ("_")); // 8
- // Maximum number of entries in a list.
- snStatusPaneCommand.list.max = command.substring (command.lastIndexOf ("_")+1, command.length); // 12
-
- // When we reach this button, split the rows (remainder are vertical, not horizontal).
- snStatusPaneCommand.split = 5;
- // Spacing between lists.
- snStatusPaneCommand.span = 1;
-
- // Get the coordinates of the Status Pane background (referenced to determine command button locations).
- var currCrd = getCrd ("snStatusPaneBkg");
-
- // Update each tab.
- for (var tabLoop = 1; tabLoop <= snStatusPaneCommand.tab.max; tabLoop++)
- {
- var tempGroupObject = getGUIObjectByName("snStatusPaneCommand" +
- "Group" + tabLoop);
-
- // Update each list under each tab.
- for (var listLoop = 1; listLoop <= snStatusPaneCommand.list.max; listLoop++)
- {
- var tempListObject = getGUIObjectByName("snStatusPaneCommand" +
- tabLoop + "_" + listLoop);
-
- // Set default portrait.
- setPortrait (tempListObject.name, "IconPortrait");
-
- // Width and height of buttons is always the same.
- var buttonWidth = snConst.Portrait.Sml.Width;
- var buttonHeight = snConst.Portrait.Sml.Height;
-
- // If we're doing the arc of commands.
- if (tabLoop >= snStatusPaneCommand.split)
- {
- if (listLoop == 1)
- {
- if (tabLoop > snStatusPaneCommand.split)
- {
- // Get the first tab.
- var firstTab = getCrd ("snStatusPaneCommand" + (snStatusPaneCommand.split) + "_" + listLoop);
- // Get the previous tab.
- var lastTab = getCrd ("snStatusPaneCommand" + (tabLoop-1) + "_" + listLoop);
- }
-
- // Set position of tab (it curves, so we need to specifically set each button position).
- switch (tabLoop)
- {
- case (snStatusPaneCommand.split):
- var buttonX = currCrd.coord[rb].x + currCrd.coord[rb].width - buttonWidth + 2;
- var buttonY = currCrd.coord[rb].y + currCrd.coord[rb].height - buttonHeight - 3.3;
- break;
- case (snStatusPaneCommand.split+1):
- var buttonX = lastTab.coord[rb].x + (lastTab.coord[rb].width/1.7);
- var buttonY = lastTab.coord[rb].y - (lastTab.coord[rb].height/1.3);
- break;
- case (snStatusPaneCommand.split+2):
- var buttonX = firstTab.coord[rb].x - (buttonWidth / 1.5);
- var buttonY = firstTab.coord[rb].y + (buttonHeight / 1.5);
- break;
- default:
- var buttonX = getCrd ("snStatusPaneCommand" + (snStatusPaneCommand.split+1) + "_" + listLoop).coord[rb].x;
- var buttonY = currCrd.coord[rb].y + 3;
- break;
- }
-
- // Set default portrait.
- setPortrait (tempListObject.name, "IconCommand");
- }
- else
- {
- var parentTab = getCrd ("snStatusPaneCommand" + (tabLoop) + "_" + (listLoop - 1));
- // Set position of buttons under tab (parallel row to the right of it).
- var buttonX = parentTab.coord[rb].x+parentTab.coord[rb].width
- +snStatusPaneCommand.span;
- var buttonY = parentTab.coord[rb].y;
- }
- var barX = buttonX;
- var barY = 0;
- }
- else // If we're doing the row of tabs,
- {
- // Set position of tab.
- if (listLoop == 1)
- {
- if (tabLoop == 1 && listLoop == 1)
- var buttonX = currCrd.coord[rb].x;
- else
- var buttonX = Crd[Crd.last].coord[rb].x+Crd[Crd.last].coord[rb].width
- +snStatusPaneCommand.span;
-
- var buttonY = currCrd.coord[rb].y+currCrd.coord[rb].height-7;
- }
- else // Set position of buttons under tab.
- {
- var buttonX = Crd[Crd.last].coord[rb].x;
- var buttonY = Crd[Crd.last].coord[rb].y+Crd[Crd.last].coord[rb].height
- +snStatusPaneCommand.span;
- }
- }
-
- // Define dimensions of list buttons.
- addCrds ("snStatusPaneCommand" + tabLoop + "_" + listLoop, 0, 100, buttonX, buttonY,
- buttonWidth, buttonHeight);
-
- // If we're defining the last button in the list, and it's not a tab,
- if (tabLoop == snStatusPaneCommand.tab.max && listLoop != 1)
- {
- // It has health bars (for the current selection). Set them up too.
- addCrds ("snStatusPaneCommand" + tabLoop + "_" + listLoop + "Bar", 0, 100, barX, barY,
- buttonWidth, 4);
- getGUIObjectByName ("snStatusPaneCommand" + tabLoop + "_" + listLoop + "Bar").hidden = false;
- getGUIObjectByName ("snStatusPaneCommand" + tabLoop + "_" + listLoop + "Bar").caption = 100;
- }
-/*
- // Store indexes to the button for easy future reference.
- Crd[getCrd ("snStatusPaneCommand" + tabLoop + "_" + listLoop, true)].tab = tabLoop;
- Crd[getCrd ("snStatusPaneCommand" + tabLoop + "_" + listLoop, true)].list = listLoop;
- // Create quantity and entity for create lists for future use.
- Crd[getCrd ("snStatusPaneCommand" + tabLoop + "_" + listLoop, true)].entity = "";
- Crd[getCrd ("snStatusPaneCommand" + tabLoop + "_" + listLoop, true)].quantity = 0;
-*/
- }
- }
-}
-
-// ====================================================================
-
-function updateTab (tab, type, cellSheet, attribute, attribute2, arrayCells)
-{
- // Refresh the next tab (and any buttons in its list, if appropriate), according to tabCounter.
- // tab: The name of the tab (eg research).
- // type: The type of button:
- // * production (Tab button, persistent list of buttons, click them to do things.)
- // * pick (Tab button holds current selection, click a button from the list to select a new option and close the tab.)
- // * command (Click "tab" button to do something; no list.)
- // cellSheet: * The cell sheet (icon group) containing this item's tab icon.
- // * production: Tends to be "Tab" (since they need a special tab icon), so defaults to this.
- // * pick: Usually a group that's the same as the tab name, so use this.
- // * command: Tends to be "Command" (though not always), so defaults to this.
- // * If no value is specified, it will use the above default for the type.
+ empty = false;
+
+ // Maximum number of buttons (either single or lists).
+ snStatusPaneCommand.tab.max = command.substring (command.lastIndexOf ("d")+1, command.lastIndexOf ("_")); // 8
+ // Maximum number of entries in a list.
+ snStatusPaneCommand.list.max = command.substring (command.lastIndexOf ("_")+1, command.length); // 12
+
+ // When we reach this button, split the rows (remainder are vertical, not horizontal).
+ snStatusPaneCommand.split = 5;
+ // Spacing between lists.
+ snStatusPaneCommand.span = 1;
+
+ // Get the coordinates of the Status Pane background (referenced to determine command button locations).
+ var currCrd = getCrd ("snStatusPaneBkg");
+
+ // Update each tab.
+ for (var tabLoop = 1; tabLoop <= snStatusPaneCommand.tab.max; tabLoop++)
+ {
+ var tempGroupObject = getGUIObjectByName("snStatusPaneCommand" +
+ "Group" + tabLoop);
+
+ // Update each list under each tab.
+ for (var listLoop = 1; listLoop <= snStatusPaneCommand.list.max; listLoop++)
+ {
+ var tempListObject = getGUIObjectByName("snStatusPaneCommand" +
+ tabLoop + "_" + listLoop);
+
+ // Set default portrait.
+ setPortrait (tempListObject.name, "IconPortrait");
+
+ // Width and height of buttons is always the same.
+ var buttonWidth = snConst.Portrait.Sml.Width;
+ var buttonHeight = snConst.Portrait.Sml.Height;
+
+ // If we're doing the arc of commands.
+ if (tabLoop >= snStatusPaneCommand.split)
+ {
+ if (listLoop == 1)
+ {
+ if (tabLoop > snStatusPaneCommand.split)
+ {
+ // Get the first tab.
+ var firstTab = getCrd ("snStatusPaneCommand" + (snStatusPaneCommand.split) + "_" + listLoop);
+ // Get the previous tab.
+ var lastTab = getCrd ("snStatusPaneCommand" + (tabLoop-1) + "_" + listLoop);
+ }
+
+ // Set position of tab (it curves, so we need to specifically set each button position).
+ switch (tabLoop)
+ {
+ case (snStatusPaneCommand.split):
+ var buttonX = currCrd.coord[rb].x + currCrd.coord[rb].width - buttonWidth + 2;
+ var buttonY = currCrd.coord[rb].y + currCrd.coord[rb].height - buttonHeight - 3.3;
+ break;
+ case (snStatusPaneCommand.split+1):
+ var buttonX = lastTab.coord[rb].x + (lastTab.coord[rb].width/1.7);
+ var buttonY = lastTab.coord[rb].y - (lastTab.coord[rb].height/1.3);
+ break;
+ case (snStatusPaneCommand.split+2):
+ var buttonX = firstTab.coord[rb].x - (buttonWidth / 1.5);
+ var buttonY = firstTab.coord[rb].y + (buttonHeight / 1.5);
+ break;
+ default:
+ var buttonX = getCrd ("snStatusPaneCommand" + (snStatusPaneCommand.split+1) + "_" + listLoop).coord[rb].x;
+ var buttonY = currCrd.coord[rb].y + 3;
+ break;
+ }
+
+ // Set default portrait.
+ setPortrait (tempListObject.name, "IconCommand");
+ }
+ else
+ {
+ var parentTab = getCrd ("snStatusPaneCommand" + (tabLoop) + "_" + (listLoop - 1));
+ // Set position of buttons under tab (parallel row to the right of it).
+ var buttonX = parentTab.coord[rb].x+parentTab.coord[rb].width
+ +snStatusPaneCommand.span;
+ var buttonY = parentTab.coord[rb].y;
+ }
+ var barX = buttonX;
+ var barY = 0;
+ }
+ else // If we're doing the row of tabs,
+ {
+ // Set position of tab.
+ if (listLoop == 1)
+ {
+ if (tabLoop == 1 && listLoop == 1)
+ var buttonX = currCrd.coord[rb].x;
+ else
+ var buttonX = Crd[Crd.last].coord[rb].x+Crd[Crd.last].coord[rb].width
+ +snStatusPaneCommand.span;
+
+ var buttonY = currCrd.coord[rb].y+currCrd.coord[rb].height-7;
+ }
+ else // Set position of buttons under tab.
+ {
+ var buttonX = Crd[Crd.last].coord[rb].x;
+ var buttonY = Crd[Crd.last].coord[rb].y+Crd[Crd.last].coord[rb].height
+ +snStatusPaneCommand.span;
+ }
+ }
+
+ // Define dimensions of list buttons.
+ addCrds ("snStatusPaneCommand" + tabLoop + "_" + listLoop, 0, 100, buttonX, buttonY,
+ buttonWidth, buttonHeight);
+
+ // If we're defining the last button in the list, and it's not a tab,
+ if (tabLoop == snStatusPaneCommand.tab.max && listLoop != 1)
+ {
+ // It has health bars (for the current selection). Set them up too.
+ addCrds ("snStatusPaneCommand" + tabLoop + "_" + listLoop + "Bar", 0, 100, barX, barY,
+ buttonWidth, 4);
+ getGUIObjectByName ("snStatusPaneCommand" + tabLoop + "_" + listLoop + "Bar").hidden = false;
+ getGUIObjectByName ("snStatusPaneCommand" + tabLoop + "_" + listLoop + "Bar").caption = 100;
+ }
+/*
+ // Store indexes to the button for easy future reference.
+ Crd[getCrd ("snStatusPaneCommand" + tabLoop + "_" + listLoop, true)].tab = tabLoop;
+ Crd[getCrd ("snStatusPaneCommand" + tabLoop + "_" + listLoop, true)].list = listLoop;
+ // Create quantity and entity for create lists for future use.
+ Crd[getCrd ("snStatusPaneCommand" + tabLoop + "_" + listLoop, true)].entity = "";
+ Crd[getCrd ("snStatusPaneCommand" + tabLoop + "_" + listLoop, true)].quantity = 0;
+*/
+ }
+ }
+}
+
+// ====================================================================
+
+function updateTab (tab, type, cellSheet, attribute, attribute2, arrayCells)
+{
+ // Refresh the next tab (and any buttons in its list, if appropriate), according to tabCounter.
+ // tab: The name of the tab (eg research).
+ // type: The type of button:
+ // * production (Tab button, persistent list of buttons, click them to do things.)
+ // * pick (Tab button holds current selection, click a button from the list to select a new option and close the tab.)
+ // * command (Click "tab" button to do something; no list.)
+ // cellSheet: * The cell sheet (icon group) containing this item's tab icon.
+ // * production: Tends to be "Tab" (since they need a special tab icon), so defaults to this.
+ // * pick: Usually a group that's the same as the tab name, so use this.
+ // * command: Tends to be "Command" (though not always), so defaults to this.
+ // * If no value is specified, it will use the above default for the type.
// attribute: * For production & pick: the attribute containing the list of items to display
- // (eg selection[0].actions.create.list.research), which this entity must
- // have in order to update the tab with this list.
- // * For command: the attribute that the entity must have in order to have this command.
- // * If no value is specified, all entities have this attribute.
+ // (eg selection[0].actions.create.list.research), which this entity must
+ // have in order to update the tab with this list.
+ // * For command: the attribute that the entity must have in order to have this command.
+ // * If no value is specified, all entities have this attribute.
// attribute2: * For pick: The variable used to store the current item in the pick that has been selected -- placed in the tab
- // (eg selection[0].actions.formation.curr)
+ // (eg selection[0].actions.formation.curr)
// arrayCells: * Optional attribute. If true, assume that items cannot all be found in the same cellSheet; check in attribute.sheet
- // for cell sheet name for each item.
-
- // Store string form of attribute for future reference.
- attributeString = attribute;
- attribute2String = attribute2;
-
+ // for cell sheet name for each item.
+
+ // Store string form of attribute for future reference.
+ attributeString = attribute;
+ attribute2String = attribute2;
+
// If either attribute is not a valid property, return false.
if (! ((validProperty (attributeString)) && (validProperty (attribute2String))) )
{
return false;
}
-
- // Use the value of the attribute from this point forwards.
- attribute = eval (attribute);
- attribute2 = eval (attribute2);
- // String properties taken from entities can be a little confused about their variable type, so make sure they're considered strings.
+
+ // Use the value of the attribute from this point forwards.
+ attribute = eval (attribute);
+ attribute2 = eval (attribute2);
+ // String properties taken from entities can be a little confused about their variable type, so make sure they're considered strings.
attribute2 = String (attribute2);
-
- // Set default values.
- if (cellSheet == "")
- {
- switch (type)
- {
- case "command":
- cellSheet = "Command";
- break;
- case "pick":
- cellSheet = toTitleCase(tab);
- tab = attribute2.toLowerCase();
- // avoid, pick, Stance, .traits.ai.stance.list
- break;
- default:
- cellSheet = "Tab";
- break;
- }
- }
-
-
- // Get tab.
- var tabObject = getGUIObjectByName ("snStatusPaneCommand" + tabCounter + "_1");
- guiUnHide (tabObject.name);
+
+ // Set default values.
+ if (cellSheet == "")
+ {
+ switch (type)
+ {
+ case "command":
+ cellSheet = "Command";
+ break;
+ case "pick":
+ cellSheet = toTitleCase(tab);
+ tab = attribute2.toLowerCase();
+ // avoid, pick, Stance, .traits.ai.stance.list
+ break;
+ default:
+ cellSheet = "Tab";
+ break;
+ }
+ }
- setTabPortrait(type, tab, cellSheet, cellGroup, tabCounter);
-
- setTooltip(type, tab, cellSheet, cellGroup, tabObject);
-
- setEvents(type, tab, tabObject);
-
- // Get group.
- var groupObject = getGUIObjectByName ("snStatusPaneCommand" + "Group" + tabCounter);
-
- // If the list hasn't been hidden (tab is open), and it should have list items (it's not merely a command),
- if ( type != "command" && attribute != undefined )
- {
- if (tab == "queue")
- {
- var newAttribute = groupProductionItems(attribute);
- //ok, now split newAttribute into 2 arrays: 1 containing items, and another one containing nums.
-
- var nums = new Array();
- attribute = new Array();
-
- for (i=0; i 0)
- {
- updateTab ("garrison", "production", "Tab", "selection", "");
- }
- else
- {
- // If more than one entity is selected, list them.
- if (selection.length > 1)
- {
- tempArray = new Array();
- for ( var i = 0; i < selection.length; i++ )
- tempArray.push(selection[i].tag);
- updateTab ("selection", "production", "Tab", "tempArray", "");
- }
- }
+
+ tabCounter++;
+
+ return true;
+}
+
+
+
+// ====================================================================
+
+function tryConstruction( name )
+{
+ // Start the building placement cursor for the given template, if we have enough resources
+
+ var result = checkEntityReqs( localPlayer, getEntityTemplate( name ) );
+
+ if (result == true) // If the entry meets requirements to be built (i.e. resources)
+ {
+ // Show the building placement cursor
+ startPlacing( name );
}
-
- if (selection.length == 1)
+ else
+ {
+ // If not, output the error message.
+ showMessage(result);
+ }
+}
+
+// ====================================================================
+
+function refreshCommandButtons()
+{
+ // Reset button counter.
+ tabCounter = 1;
+
+ if ( selectionChanged )
+ {
+ // Update production lists (both types of Construction, Train). (Tab button, persistent buttons, click them to do things.)
+ if (validProperty ("selection[0].actions.create.list"))
+ {
+ listRoot = selection[0].actions.create.list;
+ for (listTab in listRoot)
+ {
+ if (listTab != "research") // Do research later.
+ updateTab (listTab, "production", "Tab", "listRoot[listTab]", "");
+ }
+ }
+
+ // Update Barter. (Tab button, persistent buttons, click them to do things.)
+ updateTab ("barter", "production", "Tab", "selection[0].actions.barter.list");
+
+ // Update pick lists (formation, stance, trade). (Tab button holds current selection, click a button to select a new option and close the tab.)
+ updateTab ("stance", "pick", "", "selection[0].traits.ai.stance.list", "selection[0].traits.ai.stance.curr");
+
+
+ // Update research. (Tab button, persistent buttons, click them to do things.)
+ //updateTab ("research", "production", "", "selection[0].actions.create.list.research", "");
+
+ // End of production and pick lists. Store end position.
+ var listCounter = tabCounter;
+
+ // Commands begin from this point.
+ tabCounter = snStatusPaneCommand.split;
+ // Update commands. (Click "tab" button to do something; no list.)
+ //updateTab ("patrol", "command", "", "selection[0].actions.patrol", "");
+ //updateTab ("townbell", "command", "", "selection[0].actions.townBell", "");
+ updateTab ("rally", "command", "", "selection[0].actions.create.rally", "");
+ //updateTab ("explore", "command", "", "selection[0].actions.explore", "");
+ updateTab ("retreat", "command", "", "selection[0].actions.retreat", "");
+ updateTab ("stop", "command", "", "selection[0].actions.stop", "");
+
+ // End of commands. Store end position.
+ var commandCounter = tabCounter;
+ }
+ else
+ {
+ // Ensure tabs should be cleanable.
+ listCounter = 1;
+ commandCounter = snStatusPaneCommand.split-1;
+ }
+
+ if ( selectionChanged )
+ {
+ // Clear remaining buttons between the lists and commands.
+ for (var commandClearLoop = listCounter; commandClearLoop <= snStatusPaneCommand.split-1; commandClearLoop++)
+ {
+ guiHide ("snStatusPaneCommand" + commandClearLoop + "_1");
+ // If this slot could possibly contain a list, hide that too.
+ guiHide ("snStatusPaneCommand" + "Group" + commandClearLoop);
+ }
+ for (var commandClearLoop = commandCounter; commandClearLoop <= snStatusPaneCommand.tab.max; commandClearLoop++)
+ {
+ guiHide ("snStatusPaneCommand" + commandClearLoop + "_1");
+ // If this slot could possibly contain a list, hide that too.
+ guiHide ("snStatusPaneCommand" + "Group" + commandClearLoop);
+ }
+ }
+
+ if ( selectionChanged )
+ {
+ // Do the selection/garrison list.
+ tabCounter = snStatusPaneCommand.tab.max;
+
+ // If there are entities garrisoned in the current entity,
+ if (selection[0].traits.garrison && selection[0].traits.garrison.curr > 0)
+ {
+ updateTab ("garrison", "production", "Tab", "selection", "");
+ }
+ else
+ {
+ // If more than one entity is selected, list them.
+ if (selection.length > 1)
+ {
+ tempArray = new Array();
+ for ( var i = 0; i < selection.length; i++ )
+ tempArray.push(selection[i].tag);
+ updateTab ("selection", "production", "Tab", "tempArray", "");
+ }
+ }
+ }
+
+ if (selection.length == 1)
{
if (selection[0].productionQueue && selection[0].productionQueue.length > 0)
{
- tabCounter = snStatusPaneCommand.tab.max;
- tempArray = new Array();
- var queue = selection[0].productionQueue;
-
- for(var i=0; i < queue.length; i++)
- {
- tempArray.push(queue.get(i));
+ tabCounter = snStatusPaneCommand.tab.max;
+ tempArray = new Array();
+ var queue = selection[0].productionQueue;
+
+ for(var i=0; i < queue.length; i++)
+ {
+ tempArray.push(queue.get(i));
}
updateTab("queue", "production", "Tab", "tempArray", "");
@@ -513,119 +513,119 @@ function refreshCommandButtons()
{
//hide the production queue if it is empty.
tabCounter = snStatusPaneCommand.tab.max;
- var tabObject = getGUIObjectByName ("snStatusPaneCommand" + tabCounter + "_1");
+ var tabObject = getGUIObjectByName ("snStatusPaneCommand" + tabCounter + "_1");
guiHide(tabObject.name);
var groupObject = getGUIObjectByName ("snStatusPaneCommand" + "Group" + tabCounter);
guiHide(groupObject.name);
- }
- }
-}
-
-
-// ====================================================================
-
-
-function getProductionTooltip(template)
-{
- var tooltip = "[font=trebuchet14b]" + template.traits.id.specific + " (" + template.traits.id.generic + ")[/font]";
-
- //Show required resources list
- if (template.traits.creation)
- {
- var first = true;
- if (template.traits.creation.resource.food > 0)
- {
- tooltip += (first ? "\n" : ", ");
- first = false;
- tooltip += "[font=tahoma10b]Food:[/font] " + template.traits.creation.resource.food
- }
- if (template.traits.creation.resource.wood > 0)
- {
- tooltip += (first ? "\n" : ", ");
- first = false;
- tooltip += "[font=tahoma10b]Wood:[/font] " + template.traits.creation.resource.wood;
- }
- if (template.traits.creation.resource.metal > 0)
- {
- tooltip += (first ? "\n" : ", ");
- first = false;
- tooltip += "[font=tahoma10b]Metal:[/font] " + template.traits.creation.resource.metal
- }
- if (template.traits.creation.resource.stone > 0)
- {
- tooltip += (first ? "\n" : ", ");
- first = false;
- tooltip += "[font=tahoma10b]Stone:[/font] " + template.traits.creation.resource.stone
- }
- }
-
- if (template.traits.id.tooltip)
- {
- tooltip += "\n[font=tahoma10]" + template.traits.id.tooltip + "[/font]";
- }
-
- return tooltip;
-}
-
-
-// ===================================================================================
-//entity is the name.
-function removeFromProductionQueue(selection, entity)
-{
- var queue = selection[0].productionQueue;
-
- for(var i=0;i 0)
+ {
+ tooltip += (first ? "\n" : ", ");
+ first = false;
+ tooltip += "[font=tahoma10b]Food:[/font] " + template.traits.creation.resource.food
+ }
+ if (template.traits.creation.resource.wood > 0)
+ {
+ tooltip += (first ? "\n" : ", ");
+ first = false;
+ tooltip += "[font=tahoma10b]Wood:[/font] " + template.traits.creation.resource.wood;
+ }
+ if (template.traits.creation.resource.metal > 0)
+ {
+ tooltip += (first ? "\n" : ", ");
+ first = false;
+ tooltip += "[font=tahoma10b]Metal:[/font] " + template.traits.creation.resource.metal
+ }
+ if (template.traits.creation.resource.stone > 0)
+ {
+ tooltip += (first ? "\n" : ", ");
+ first = false;
+ tooltip += "[font=tahoma10b]Stone:[/font] " + template.traits.creation.resource.stone
+ }
+ }
+
+ if (template.traits.id.tooltip)
+ {
+ tooltip += "\n[font=tahoma10]" + template.traits.id.tooltip + "[/font]";
+ }
+
+ return tooltip;
+}
+
+
+// ===================================================================================
+//entity is the name.
+function removeFromProductionQueue(selection, entity)
+{
+ var queue = selection[0].productionQueue;
+
+ for(var i=0;i 1)
- {
- rankObject.cell_id = selection[0].traits.promotion.rank-2;
- rankObject.tooltip = "Next Promotion: " + selection[0].traits.promotion.curr + "/" + selection[0].traits.promotion.req;
- rankObject.hidden = false;
- }
- else
- rankObject.hidden = true;
- }
-
- // Update garrison capacity.
- if( shouldUpdateStat( "traits.garrison" ) )
- {
- var guiObject = getGUIObjectByName("snStatusPaneGarrison");
- guiObject.caption = '';
-
- if (selection[0].traits.garrison)
- {
- // Set garrison icon.
- getGUIObjectByName ("snStatusPaneGarrisonIcon").cell_id = cellGroup["Garrison"]["garrison"].id;
- if (selection[0].traits.garrison.curr && selection[0].traits.garrison.max)
- {
- guiObject.caption += '[color="blue"]' + selection[0].traits.garrison.curr + '/' + selection[0].traits.garrison.max + '[/color] ';
- }
- guiObject.hidden = false;
- getGUIObjectByName ("snStatusPaneGarrisonIcon").hidden = false;
- }
- else
- {
- guiObject.hidden = true;
- getGUIObjectByName ("snStatusPaneGarrisonIcon").hidden = true;
- }
- }
-
- if( shouldUpdateStat( "traits.supply" ) )
- {
- guiObject = getGUIObjectByName("snStatusPaneSupply");
- guiObject.caption = '';
-
- if (selection[0].traits.supply)
- {
- if (selection[0].traits.supply.curr && selection[0].traits.supply.max && selection[0].traits.supply.type)
- {
- // Set resource icon.
- getGUIObjectByName ("snStatusPaneSupplyIcon").cell_id = cellGroup["Resource"][selection[0].traits.supply.type].id;
- // Special case for infinity.
- if (selection[0].traits.supply.curr == "0" && selection[0].traits.supply.max == "0")
- guiObject.caption += '[color="brown"] [icon="iconInfinity"] [/color] ';
- else
- guiObject.caption += '[color="brown"]' + selection[0].traits.supply.curr + '/' + selection[0].traits.supply.max + '[/color] ';
- }
- guiObject.hidden = false;
- getGUIObjectByName ("snStatusPaneSupplyIcon").hidden = false;
- }
- else
- {
- guiObject.hidden = true;
- getGUIObjectByName ("snStatusPaneSupplyIcon").hidden = true;
- }
- }
-
- // Update statistic icons.
- statCurr = 1;
- if (validProperty ("selection[0].actions.attack.melee.damage"))
- updateStat ("snStatusPaneStat_", "Attack", "rating", selection[0].actions.attack.melee.damage);
- if (validProperty ("selection[0].actions.attack.melee.range"))
- updateStat ("snStatusPaneStat_", "Statistic", "range", selection[0].actions.attack.melee.range);
- if (validProperty ("selection[0].actions.attack.ranged.damage"))
- updateStat ("snStatusPaneStat_", "Attack", "rating", selection[0].actions.attack.ranged.damage);
- if (validProperty ("selection[0].actions.attack.ranged.range"))
- updateStat ("snStatusPaneStat_", "Statistic", "range", selection[0].actions.attack.ranged.range);
- if (validProperty ("selection[0].traits.armour.value"))
- updateStat ("snStatusPaneStat_", "Armour", "rating", selection[0].traits.armour.value);
- if (validProperty ("selection[0].traits.vision.los"))
- updateStat ("snStatusPaneStat_", "Statistic", "vision", selection[0].traits.vision.los);
-
- // Refresh command buttons.
- refreshCommandButtons();
-}
-
-// ====================================================================
-
-function updateStat (baseName, cellSheet, cell, statistic)
-{
- var textStat = getGUIObjectByName (baseName + statCurr);
- if( !textStat )
- {
- //console.write("No textStat for " + baseName + " " + statCurr);
- return;
- }
- textStat.sprite = "snIconSheet" + cellSheet;
- textStat.cell_id = cellGroup[cellSheet][cell].id;
- textStat.tooltip = cellGroup[cellSheet][cell].name;
- var iconStat = getGUIObjectByName (baseName + (statCurr + 1));
-
- if (!isNaN(statistic)) {
- statistic = Math.ceil(statistic);
- }
-
- iconStat.caption = statistic;
- iconStat.tooltip = cellGroup[cellSheet][cell].name + ": " + statistic + ".";
- statCurr = (statCurr + 2);
-}
-
-// ====================================================================
+/*
+ DESCRIPTION : Functions for the "Status Pane" section of the session GUI.
+ NOTES :
+*/
+
+// ====================================================================
+
+function refreshStatusPane()
+{
+ // Update civilisation emblem.
+ if ( selectionChanged )
+ {
+ var emblemObject = getGUIObjectByName ("snStatusPaneEmblem");
+ if (selection[0].traits.id.civ_code != "gaia")
+ emblemObject.sprite = "snStatusPaneEmblem" + toTitleCase (selection[0].traits.id.civ_code);
+ else
+ emblemObject.sprite = "";
+ }
+
+ if ( shouldUpdateStat ( "traits.id.icon" ) )
+ {
+ // Update portrait
+ if (validProperty("selection[0].traits.id.icon"))
+ setPortrait ("snStatusPanePortrait", selection[0].traits.id.icon,
+ toTitleCase(selection[0].traits.id.civ_code), selection[0].traits.id.icon_cell);
+ }
+
+ // Update portrait tooltip.
+ if ( shouldUpdateStat ( "traits.id.generic" ) )
+ {
+ getGUIObjectByName ("snStatusPanePortrait").tooltip = selection[0].traits.id.generic;
+ }
+
+ // Update hitpoint bar.
+ if ( selectionChanged || shouldUpdateStat ( "traits.health.max" ) || shouldUpdateStat ( "traits.health.curr" ) )
+ {
+ var barObject = getGUIObjectByName ("snStatusPaneHealthBar");
+ var textObject = getGUIObjectByName ("snStatusPaneHealthBarText");
+ if (selection[0].traits.health.max && selection[0].traits.health.max != 0)
+ {
+ barObject.caption = (selection[0].traits.health.curr * 100) / selection[0].traits.health.max;
+ barObject.hidden = false;
+ textObject.caption = "[font=verdana8][color=white]" + selection[0].traits.health.curr + "[/color][/font]";
+ }
+ else
+ {
+ barObject.hidden = true;
+ textObject.caption = "";
+ }
+ }
+
+ // Update stamina bar.
+ if ( selectionChanged || shouldUpdateStat ( "traits.stamina.max" ) || shouldUpdateStat ( "traits.stamina.curr" ) )
+ {
+ var barObject = getGUIObjectByName ("snStatusPaneStaminaBar");
+ var textObject = getGUIObjectByName ("snStatusPaneStaminaBarText");
+ if (selection[0].traits.stamina.max && selection[0].traits.stamina.max != 0)
+ {
+ barObject.caption = (selection[0].traits.stamina.curr * 100) / selection[0].traits.stamina.max;
+ barObject.hidden = false;
+ textObject.caption = "[font=verdana8][color=white]" + selection[0].traits.stamina.curr + "[/color][/font]";
+ }
+ else
+ {
+ barObject.hidden = true;
+ textObject.caption = "";
+ }
+ }
+
+ // Update unit text panel.
+ if ( shouldUpdateStat ("player") || shouldUpdateStat ( "traits.id.civ" ) || shouldUpdateStat ( "traits.id.generic" ) || shouldUpdateStat ( "traits.id.specific" ) )
+ {
+ var textCaption = "";
+textCaption += '[font=verdana10][color="' + Math.round(selection[0].player.getColour().r*255) + ' ' + Math.round(selection[0].player.getColour().g*255) + ' ' + Math.round(selection[0].player.getColour().b*255) + '"]' + selection[0].player.name + '[/color][/font]\n';
+ textCaption += "[font=verdana10][color=white]" + selection[0].traits.id.civ + "[/color][/font]\n";
+ textCaption += "[font=verdana10][color=white]" + selection[0].traits.id.specific + "[/color][/font]\n";
+ textCaption += "[font=optimus14b][color=gold]" + selection[0].traits.id.generic + "[/color][/font]";
+ getGUIObjectByName ("snStatusPaneText").caption = textCaption;
+ }
+
+ // Update rank icon.
+ if ( shouldUpdateStat ( "traits.promotion" ) )
+ {
+ var rankObject = getGUIObjectByName ("snStatusPaneRank");
+
+ // Don't show a rank icon for Basic or unranked units.
+ if (selection[0].traits.promotion && selection[0].traits.promotion.rank > 1)
+ {
+ rankObject.cell_id = selection[0].traits.promotion.rank-2;
+ rankObject.tooltip = "Next Promotion: " + selection[0].traits.promotion.curr + "/" + selection[0].traits.promotion.req;
+ rankObject.hidden = false;
+ }
+ else
+ rankObject.hidden = true;
+ }
+
+ // Update garrison capacity.
+ if( shouldUpdateStat( "traits.garrison" ) )
+ {
+ var guiObject = getGUIObjectByName("snStatusPaneGarrison");
+ guiObject.caption = '';
+
+ if (selection[0].traits.garrison)
+ {
+ // Set garrison icon.
+ getGUIObjectByName ("snStatusPaneGarrisonIcon").cell_id = cellGroup["Garrison"]["garrison"].id;
+ if (selection[0].traits.garrison.curr && selection[0].traits.garrison.max)
+ {
+ guiObject.caption += '[color="blue"]' + selection[0].traits.garrison.curr + '/' + selection[0].traits.garrison.max + '[/color] ';
+ }
+ guiObject.hidden = false;
+ getGUIObjectByName ("snStatusPaneGarrisonIcon").hidden = false;
+ }
+ else
+ {
+ guiObject.hidden = true;
+ getGUIObjectByName ("snStatusPaneGarrisonIcon").hidden = true;
+ }
+ }
+
+ if( shouldUpdateStat( "traits.supply" ) )
+ {
+ guiObject = getGUIObjectByName("snStatusPaneSupply");
+ guiObject.caption = '';
+
+ if (selection[0].traits.supply)
+ {
+ if (selection[0].traits.supply.curr && selection[0].traits.supply.max && selection[0].traits.supply.type)
+ {
+ // Set resource icon.
+ getGUIObjectByName ("snStatusPaneSupplyIcon").cell_id = cellGroup["Resource"][selection[0].traits.supply.type].id;
+ // Special case for infinity.
+ if (selection[0].traits.supply.curr == "0" && selection[0].traits.supply.max == "0")
+ guiObject.caption += '[color="brown"] [icon="iconInfinity"] [/color] ';
+ else
+ guiObject.caption += '[color="brown"]' + selection[0].traits.supply.curr + '/' + selection[0].traits.supply.max + '[/color] ';
+ }
+ guiObject.hidden = false;
+ getGUIObjectByName ("snStatusPaneSupplyIcon").hidden = false;
+ }
+ else
+ {
+ guiObject.hidden = true;
+ getGUIObjectByName ("snStatusPaneSupplyIcon").hidden = true;
+ }
+ }
+
+ // Update statistic icons.
+ statCurr = 1;
+ if (validProperty ("selection[0].actions.attack.melee.damage"))
+ updateStat ("snStatusPaneStat_", "Attack", "rating", selection[0].actions.attack.melee.damage);
+ if (validProperty ("selection[0].actions.attack.melee.range"))
+ updateStat ("snStatusPaneStat_", "Statistic", "range", selection[0].actions.attack.melee.range);
+ if (validProperty ("selection[0].actions.attack.ranged.damage"))
+ updateStat ("snStatusPaneStat_", "Attack", "rating", selection[0].actions.attack.ranged.damage);
+ if (validProperty ("selection[0].actions.attack.ranged.range"))
+ updateStat ("snStatusPaneStat_", "Statistic", "range", selection[0].actions.attack.ranged.range);
+ if (validProperty ("selection[0].traits.armour.value"))
+ updateStat ("snStatusPaneStat_", "Armour", "rating", selection[0].traits.armour.value);
+ if (validProperty ("selection[0].traits.vision.los"))
+ updateStat ("snStatusPaneStat_", "Statistic", "vision", selection[0].traits.vision.los);
+
+ // Refresh command buttons.
+ refreshCommandButtons();
+}
+
+// ====================================================================
+
+function updateStat (baseName, cellSheet, cell, statistic)
+{
+ var textStat = getGUIObjectByName (baseName + statCurr);
+ if( !textStat )
+ {
+ //console.write("No textStat for " + baseName + " " + statCurr);
+ return;
+ }
+ textStat.sprite = "snIconSheet" + cellSheet;
+ textStat.cell_id = cellGroup[cellSheet][cell].id;
+ textStat.tooltip = cellGroup[cellSheet][cell].name;
+ var iconStat = getGUIObjectByName (baseName + (statCurr + 1));
+
+ if (!isNaN(statistic)) {
+ statistic = Math.ceil(statistic);
+ }
+
+ iconStat.caption = statistic;
+ iconStat.tooltip = cellGroup[cellSheet][cell].name + ": " + statistic + ".";
+ statCurr = (statCurr + 2);
+}
+
+// ====================================================================
diff --git a/binaries/data/mods/public/gui/test/functions_sim_entity.js b/binaries/data/mods/public/gui/test/functions_sim_entity.js
index 6f745a34b3..82d76cd9d6 100644
--- a/binaries/data/mods/public/gui/test/functions_sim_entity.js
+++ b/binaries/data/mods/public/gui/test/functions_sim_entity.js
@@ -1,258 +1,258 @@
-/*
- DESCRIPTION : Functions for the world click handler and manipulating entities.
- NOTES :
-*/
-// ====================================================================
-
-addGlobalHandler ("worldClick", worldClickHandler);
-
-// ====================================================================
-
-// The world-click handler - called whenever the user clicks the terrain
-function worldClickHandler(event)
-{
- args=new Array(null, null);
-
- //console.write("worldClickHandler: button "+event.button+", clicks "+event.clicks);
-
- if (isSelecting())
- {
- getGlobal().selectionWorldClickHandler(event);
- return;
- }
-
-
- // Right button single- or double-clicks
- if (event.button == SDL_BUTTON_RIGHT && event.clicks <= 2)
- {
- var controlling = true;
- for (var i = 0; i < selection.length; i++) {
- if (! (selection[i].player.name == localPlayer.name)) {
- controlling = false;
- break;
- }
- }
-
- if (!controlling) {
- return;
- }
-
- if (event.clicks == 1) {
- cmd = event.order;
- }
- else if (event.clicks == 2)
- {
- // Use the secondary order, or, if the entites didn't vote for any order
- // (i.e. we are using the default of NMT_GOTO), use the NMT_RUN
- if (event.order == NMT_GOTO )
- cmd = NMT_RUN;
- else
- cmd = event.secondaryOrder;
- }
- }
- else
- {
- return;
- }
-
- //setting rally point
- if ( getCursorName() == "cursor-rally" )
- {
- for ( var i=0; i 1);
- else
- issueCommand (selection, isOrderQueued(), cmd, args[0], args[1]);
-}
-
-// ====================================================================
-
-function selectEntity(handler)
-{
- endSelection();
- startSelection(function (event) {
- // Selection is performed when single-clicking the right mouse
- // button.
- if (event.button == SDL_BUTTON_RIGHT && event.clicks == 1)
- {
- handler(event.entity);
- }
- // End selection on first mouse-click
- endSelection();
- });
-}
-
-// ====================================================================
-
-function selectLocation(handler)
-{
- endSelection();
- startSelection(function (event) {
- // Selection is performed when single-clicking the right mouse
- // button.
- if (event.button == SDL_BUTTON_RIGHT && event.clicks == 1)
- {
- handler(event.x, event.y);
- }
- // End selection on first mouse-click
- endSelection();
- });
-}
-
-// ====================================================================
-
-function startSelection(handler)
-{
- gameView.startCustomSelection();
- getGlobal().selectionWorldClickHandler=handler;
- console.write("isSelecting(): "+isSelecting());
-}
-
-// ====================================================================
-
-function endSelection()
-{
- if (!isSelecting())
- return;
-
- gameView.endCustomSelection();
- getGlobal().selectionWorldClickHandler = null;
-}
-
-// ====================================================================
-
-function isSelecting()
-{
- return getGlobal().selectionWorldClickHandler != null;
-}
-
-// ====================================================================
-
-function makeUnit (x, y, z, MakeUnitName)
-{
- // Spawn an entity at the given coordinates.
-
- var dudeSpawnPoint = new Vector3D(x, y, z);
- new Entity(getEntityTemplate(MakeUnitName), dudeSpawnPoint, 1.0);
- // writeConsole(MakeUnitName + " created at " + DudeSpawnPoint);
-}
-
-// ====================================================================
-
-function validProperty (propertyName)
-{
- // Accepts a string representing an entity property (eg "selection[0].traits.id.generic")
- // and checks if all the elements (selection[0].traits, selection[0].traits.id, etc) are valid properties.
- // Returns false if any invalids are found. Returns true if the whole property is valid.
-
- // An empty string is always successful.
- if (propertyName == "") return true;
-
- // An undefined string is always unsuccessful.
- if (propertyName == undefined) return false;
-
- // Store elements of the property as an array of strings.
- var splitArray = propertyName.toString().split (".");
-
- // Seek through elements in array.
- var arrayString = "";
- for (var i = 0; i < splitArray.length; i++)
- {
- // Test each element combination of the string to ensure they are all valid.
- if (i > 0) arrayString += ".";
- arrayString += splitArray[i];
-
- // If the property name is not valid, return false.
- if (!(eval (arrayString)))
- return false;
- }
- // If we managed to check them all, every element in the property is valid. Return true.
- return true;
-}
-
-
-function killSelectedEntities()
-{
- var allOwned = true;
- for (var i=0; i 1);
+ else
+ issueCommand (selection, isOrderQueued(), cmd, args[0], args[1]);
+}
+
+// ====================================================================
+
+function selectEntity(handler)
+{
+ endSelection();
+ startSelection(function (event) {
+ // Selection is performed when single-clicking the right mouse
+ // button.
+ if (event.button == SDL_BUTTON_RIGHT && event.clicks == 1)
+ {
+ handler(event.entity);
+ }
+ // End selection on first mouse-click
+ endSelection();
+ });
+}
+
+// ====================================================================
+
+function selectLocation(handler)
+{
+ endSelection();
+ startSelection(function (event) {
+ // Selection is performed when single-clicking the right mouse
+ // button.
+ if (event.button == SDL_BUTTON_RIGHT && event.clicks == 1)
+ {
+ handler(event.x, event.y);
+ }
+ // End selection on first mouse-click
+ endSelection();
+ });
+}
+
+// ====================================================================
+
+function startSelection(handler)
+{
+ gameView.startCustomSelection();
+ getGlobal().selectionWorldClickHandler=handler;
+ console.write("isSelecting(): "+isSelecting());
+}
+
+// ====================================================================
+
+function endSelection()
+{
+ if (!isSelecting())
+ return;
+
+ gameView.endCustomSelection();
+ getGlobal().selectionWorldClickHandler = null;
+}
+
+// ====================================================================
+
+function isSelecting()
+{
+ return getGlobal().selectionWorldClickHandler != null;
+}
+
+// ====================================================================
+
+function makeUnit (x, y, z, MakeUnitName)
+{
+ // Spawn an entity at the given coordinates.
+
+ var dudeSpawnPoint = new Vector3D(x, y, z);
+ new Entity(getEntityTemplate(MakeUnitName), dudeSpawnPoint, 1.0);
+ // writeConsole(MakeUnitName + " created at " + DudeSpawnPoint);
+}
+
+// ====================================================================
+
+function validProperty (propertyName)
+{
+ // Accepts a string representing an entity property (eg "selection[0].traits.id.generic")
+ // and checks if all the elements (selection[0].traits, selection[0].traits.id, etc) are valid properties.
+ // Returns false if any invalids are found. Returns true if the whole property is valid.
+
+ // An empty string is always successful.
+ if (propertyName == "") return true;
+
+ // An undefined string is always unsuccessful.
+ if (propertyName == undefined) return false;
+
+ // Store elements of the property as an array of strings.
+ var splitArray = propertyName.toString().split (".");
+
+ // Seek through elements in array.
+ var arrayString = "";
+ for (var i = 0; i < splitArray.length; i++)
+ {
+ // Test each element combination of the string to ensure they are all valid.
+ if (i > 0) arrayString += ".";
+ arrayString += splitArray[i];
+
+ // If the property name is not valid, return false.
+ if (!(eval (arrayString)))
+ return false;
+ }
+ // If we managed to check them all, every element in the property is valid. Return true.
+ return true;
+}
+
+
+function killSelectedEntities()
+{
+ var allOwned = true;
+ for (var i=0; i*SpriteName) to the specified skin name.
- // Obviously such sprite names must exist, or it all will go horribly wrong.
-
- // Seek through all registered coordinates.
- for (var i = 0; i <= Crd.last; i++)
- {
- var objectName = getGUIObjectByName (Crd[i].name);
-
- // We need to deliberately ignore the minimap object as it has no sprite (and checking for the existence of the property or type doesn't work).
- if (objectName.name != "snMiniMapDisplay")
- {
- // Get first asterisk position.
- var startIndex = objectName.style.indexOf ("*", 1);
- console.write (startIndex);
- // If the coordinate begins with a "skin*" (and therefore qualifies for replacement),
- if (startIndex != -1)
- {
- // Look for and return the ending asterisk.
- var endIndex = objectName.style.indexOf ("*", 5);
- console.write (endIndex);
- if (endIndex != -1)
- {
- // Set new skin name for sprite.
- objectName.style = "skin*" + skinName + "*" + objectName.style.substring (endIndex);
- }
- }
-
- }
- }
-*/
-}
-
+/*
+ DESCRIPTION : Functions that support the coordinate system (ability to maintain and swap between multiple
+ sizes for an object).
+ NOTES :
+*/
+
+// ====================================================================
+
+function initCoord()
+{
+ // Initialise coordinate set for this page.
+ Crd = new Array();
+ Crd.last = new Object(-1);
+
+ // Set corner constants.
+ rb = 0;
+ lb = 1;
+ lt = 2;
+ rt = 3;
+}
+
+// ====================================================================
+
+// Add a new size coordinate to the array.
+function addCrd (name, group, rx, ry, x, y, width, height, rx2, ry2)
+{
+ // If no group is specified, default to the first one.
+ if (!group)
+ group = rb;
+
+ // Create new coordinate if necessary (it doesn't exist, or we have a new name).
+ if (group == rb || !Crd[Crd.last])
+ {
+ Crd.last++;
+ Crd[Crd.last] = new Object();
+ Crd[Crd.last].name = new Object(name);
+ Crd[Crd.last].size = new Object();
+ Crd[Crd.last].coord = new Object();
+ }
+
+ // Get coordinates from first element if not defined.
+ if (x == undefined)
+ x = Crd[Crd.last].coord[rb].x;
+ if (y == undefined)
+ y = Crd[Crd.last].coord[rb].y;
+ if (width == undefined)
+ width = Crd[Crd.last].coord[rb].width;
+ if (height == undefined)
+ height = Crd[Crd.last].coord[rb].height;
+
+ // Generate and save coordinates.
+ Crd[Crd.last].size[group] = calcCrdArray (rx, ry, x, y, width, height, rx2, ry2);
+ Crd[Crd.last].coord[group] = new Array();
+ Crd[Crd.last].coord[group].rx = rx;
+ Crd[Crd.last].coord[group].ry = ry;
+ Crd[Crd.last].coord[group].x = x;
+ Crd[Crd.last].coord[group].y = y;
+ Crd[Crd.last].coord[group].width = width;
+ Crd[Crd.last].coord[group].height = height;
+}
+
+// ====================================================================
+
+function addCrds (name, rx, ry, x, y, width, height, rx2, ry2)
+{
+ // This is a shortcut function that saves you having to call addCrd() for each coordinate group. Just do this once for the whole set.
+ // It creates the first, then assumes all the remaining coordinates are flipped to the opposite screen edge.
+ // (True in 90% of cases.)
+
+ addCrd (name, rb, rx, ry, x, y, width, height, rx2, ry2);
+
+ // Determine flip relatives.
+ switch (rx)
+ {
+ case 0:
+ var rx1 = 100;
+ var rx2 = 100;
+ var rx3 = 0;
+ break;
+ case 50:
+ var rx1 = 50;
+ var rx2 = 50;
+ var rx3 = 50;
+ break;
+ case 100:
+ var rx1 = 0;
+ var rx2 = 0;
+ var rx3 = 100;
+ break;
+ }
+ switch (ry)
+ {
+ case 0:
+ var ry1 = 0;
+ var ry2 = 100;
+ var ry3 = 100;
+ break;
+ case 50:
+ var ry1 = 50;
+ var ry2 = 50;
+ var ry3 = 50;
+ break;
+ case 100:
+ var ry1 = 100;
+ var ry2 = 0;
+ var ry3 = 0;
+ break;
+ }
+
+ // Define the rest of the coordinate set.
+ addCrd (name, lb, rx1, ry1);
+ addCrd (name, lt, rx2, ry2);
+ addCrd (name, rt, rx3, ry3);
+}
+
+// ====================================================================
+
+// Return coordinate object with a given name.
+// Optionally can choose to return the index to the coordinate, rather than the coordinate itself.
+function getCrd (name, byIndex)
+{
+ for (var getCrdLoop = 0; getCrdLoop <= Crd.last; getCrdLoop++)
+ {
+ if (Crd[getCrdLoop].name == name)
+ {
+ // If only index requested, just return index.
+ if (byIndex)
+ return getCrdLoop;
+ else
+ // Otherwise return the whole coordinate array for this object.
+ return Crd[getCrdLoop];
+ }
+ }
+
+ console.write ("Coordinate " + name + " not found in call to getCrd().");
+ // Return -1 to indicate failure.
+ return -1;
+}
+
+// ====================================================================
+
+// Calculates and returns "size" string from a given x/y/width/height and relative x and y.
+function calcCrdArray (rx, ry, x, y, width, height, rx2, ry2)
+{
+ if (!rx2 && !ry2)
+ {
+ // If two sets of relatives are not specified at the end of the parameter list, use the "shortcut" format:
+ // "Left Corner" (Relative X)
+ // "Top Corner" (Relative Y)
+ // X Position
+ // Y Position
+ // Width from X
+ // Height from Y
+
+ var setSizeContainer = new Object();
+
+ setSizeContainer.rleft = rx;
+ setSizeContainer.rtop = ry;
+ setSizeContainer.rright = rx;
+ setSizeContainer.rbottom = ry;
+
+ // Define size dimensions.
+ switch (setSizeContainer.rleft)
+ {
+ case 0:
+ case 50:
+ setSizeContainer.x1 = x;
+ break;
+ case 100:
+ setSizeContainer.x1 = -x-width;
+ break;
+ }
+ switch (setSizeContainer.rtop)
+ {
+ case 0:
+ case 50:
+ setSizeContainer.y1 = y;
+ break;
+ case 100:
+ setSizeContainer.y1 = -y-height;
+ break;
+ }
+ switch (setSizeContainer.rright)
+ {
+ case 0:
+ case 50:
+ setSizeContainer.x2 = x+width;
+ break;
+ case 100:
+ setSizeContainer.x2 = -x;
+ break;
+ }
+ switch (setSizeContainer.rbottom)
+ {
+ case 0:
+ case 50:
+ setSizeContainer.y2 = y+height;
+ break;
+ case 100:
+ setSizeContainer.y2 = -y;
+ break;
+ }
+
+ return new GUISize (setSizeContainer.x1, setSizeContainer.y1, setSizeContainer.x2, setSizeContainer.y2,
+ setSizeContainer.rleft, setSizeContainer.rtop, setSizeContainer.rright, setSizeContainer.rbottom);
+ }
+ else
+ {
+ // Use the standard "size" structure:
+ // RX
+ // RY
+ // X1
+ // X2
+ // Y1
+ // Y2
+ // RX2
+ // RY2
+
+ return new GUISize (x, y, width, height, rx, ry, rx2, ry2);
+
+ }
+
+
+
+}
+
+// ====================================================================
+
+// Set an existing coord of a given name to a new value.
+function setCrd (name, newCrd)
+{
+ // Get the index to the given coordinate.
+ var crdResult = getCrd (name, true);
+ if (crdResult != -1)
+ {
+ // Set new value of this coordinate.
+ Crd[crdResult] = newCrd;
+ }
+ else
+ {
+ console.write ("Failed to setCrd() + " + name);
+ return -1;
+ }
+}
+
+// ====================================================================
+
+function setSkin (skinName)
+{
+// (Unfortunately, this idea just isn't going to work until the GUI Engine allows us to set the value of a control's style (and therefore refresh its properties
+// with those of the new style. As it stands, the style property is empty at runtime because styles are all set when the stuff is loaded. And since we're wrapping
+// sprite info for skins in the styles, it won't be adequate to simply change the sprite properties. So commenting this out for now so we can adapt it later.)
+
+/*
+ // Sets the sprites of all registered controls with a skin (eg **SpriteName) to the specified skin name.
+ // Obviously such sprite names must exist, or it all will go horribly wrong.
+
+ // Seek through all registered coordinates.
+ for (var i = 0; i <= Crd.last; i++)
+ {
+ var objectName = getGUIObjectByName (Crd[i].name);
+
+ // We need to deliberately ignore the minimap object as it has no sprite (and checking for the existence of the property or type doesn't work).
+ if (objectName.name != "snMiniMapDisplay")
+ {
+ // Get first asterisk position.
+ var startIndex = objectName.style.indexOf ("*", 1);
+ console.write (startIndex);
+ // If the coordinate begins with a "skin*" (and therefore qualifies for replacement),
+ if (startIndex != -1)
+ {
+ // Look for and return the ending asterisk.
+ var endIndex = objectName.style.indexOf ("*", 5);
+ console.write (endIndex);
+ if (endIndex != -1)
+ {
+ // Set new skin name for sprite.
+ objectName.style = "skin*" + skinName + "*" + objectName.style.substring (endIndex);
+ }
+ }
+
+ }
+ }
+*/
+}
+
// ====================================================================
\ No newline at end of file
diff --git a/binaries/data/mods/public/gui/test/functions_utility_list.js b/binaries/data/mods/public/gui/test/functions_utility_list.js
index 4f11e0d51d..5eed662685 100644
--- a/binaries/data/mods/public/gui/test/functions_utility_list.js
+++ b/binaries/data/mods/public/gui/test/functions_utility_list.js
@@ -1,164 +1,164 @@
-/*
- DESCRIPTION : Functions to manipulate objects with a 'list' property
- (used to handle the items in list, dropdown, etc.)
- NOTES : To ensure the selection is properly updated, it is important to
- use these functions and not manually access the list.
-*/
-
-// ====================================================================
-
-// Remove the item at the given index (pos) from the given list object (objectName).
-function removeItem (objectName, pos)
-{
- if (getGUIObjectByName (objectName) == null)
- console.write ("removeItem(): " + objectName + " not found.");
-
- var list = getGUIObjectByName (objectName).list;
- var selected = getGUIObjectByName (objectName).selected;
-
- list.splice(pos, 1);
-
- getGUIObjectByName (objectName).list = list;
-
- // It's important that we update the selection *after*
- // we've committed the changes to the list.
-
- // Update the selected so the same element remains selected.
- if (selected == pos)
- {
- getGUIObjectByName (objectName).selected = -1;
- }
- else
- if (selected > pos)
- {
- getGUIObjectByName (objectName).selected = selected - 1;
- }
-}
-
-// ====================================================================
-
-// Add the item at the given index (pos) to the given list object (objectName) with the given value (value).
-function addItem (objectName, pos, value)
-{
- if (getGUIObjectByName (objectName) == null)
- console.write ("addItem(): " + objectName + " not found.");
-
- var list = getGUIObjectByName (objectName).list;
- var selected = getGUIObjectByName (objectName).selected;
-
- list.splice (pos, 0, value);
-
- getGUIObjectByName (objectName).list = list;
-
- // It's important that we update the selection *after*
- // we've committed the changes to the list.
-
- // Update the selected so the same element remains selected.
- if (selected >= pos)
- {
- getGUIObjectByName (objectName).selected = selected + 1;
- }
-}
-
-// ====================================================================
-
-// Adds an element to the end of the list
-function pushItem (objectName, value)
-{
- if (getGUIObjectByName (objectName) == null)
- console.write ("pushItem(): " + objectName + " not found.");
-
- var list = getGUIObjectByName (objectName).list;
- list.push (value);
- getGUIObjectByName (objectName).list = list;
- // Point to the new item.
- getGUIObjectByName(objectName).selected = getNumItems(objectName)-1;
-}
-
-// ====================================================================
-
-// Removes the last element
-function popItem (objectName)
-{
- if (getGUIObjectByName (objectName) == null)
- console.write ("popItem(): " + objectName + " not found.");
-
- var selected = getGUIObjectByName (objectName).selected;
- removeItem(objectName, getNumItems(objectName)-1);
-
- if (selected == getNumItems(objectName)-1)
- {
- getGUIObjectByName(objectName).selected = -1;
- }
-}
-
-// ====================================================================
-
-// Retrieves the number of elements in the list
-function getNumItems (objectName)
-{
- if (getGUIObjectByName (objectName) == null)
- console.write ("getNumItems(): " + objectName + " not found.");
-
- var list = getGUIObjectByName(objectName).list;
- return list.length;
-}
-
-// ====================================================================
-
-// Retrieves the value of the item at 'pos'
-function getItemValue (objectName, pos)
-{
- if (getGUIObjectByName (objectName) == null)
- console.write ("getItemValue(): " + objectName + " not found.");
-
- var list = getGUIObjectByName(objectName).list;
- return list[pos];
-}
-
-// ====================================================================
-
-// Retrieves the value of the currently selected item
-function getCurrItemValue (objectName)
-{
- if (getGUIObjectByName (objectName) == null)
- console.write ("getCurrItemValue(): " + objectName + " not found.");
-
- if (getGUIObjectByName(objectName).selected == -1)
- return "";
- var list = getGUIObjectByName(objectName).list;
- return list[getGUIObjectByName(objectName).selected];
-}
-
-// ====================================================================
-
-// Sets current item to a given string (which must be one of those
-// already in the list).
-function setCurrItemValue (objectName, string)
-{
- if (getGUIObjectByName(objectName) == null) {
- console.write ("setCurrItemValue(): " + objectName + " not found.");
- return -1;
- }
-
- if (getGUIObjectByName(objectName).selected == -1)
- return -1; // Return -1 if nothing selected.
- var list = getGUIObjectByName(objectName).list;
- // Seek through list.
- for (ctr = 0; ctr < list.length; ctr++)
- {
- // If we have found the string in the list,
- if (list[ctr] == string)
- {
- // Point selected to this item.
- getGUIObjectByName(objectName).selected = ctr;
- return ctr; // Return position of item.
- }
- }
-
- // Return -2 if failed to find value in list.
- console.write ("Requested string '" + string + "' not found in " + objectName + "'s list.");
- return -2;
-}
-
+/*
+ DESCRIPTION : Functions to manipulate objects with a 'list' property
+ (used to handle the items in list, dropdown, etc.)
+ NOTES : To ensure the selection is properly updated, it is important to
+ use these functions and not manually access the list.
+*/
+
+// ====================================================================
+
+// Remove the item at the given index (pos) from the given list object (objectName).
+function removeItem (objectName, pos)
+{
+ if (getGUIObjectByName (objectName) == null)
+ console.write ("removeItem(): " + objectName + " not found.");
+
+ var list = getGUIObjectByName (objectName).list;
+ var selected = getGUIObjectByName (objectName).selected;
+
+ list.splice(pos, 1);
+
+ getGUIObjectByName (objectName).list = list;
+
+ // It's important that we update the selection *after*
+ // we've committed the changes to the list.
+
+ // Update the selected so the same element remains selected.
+ if (selected == pos)
+ {
+ getGUIObjectByName (objectName).selected = -1;
+ }
+ else
+ if (selected > pos)
+ {
+ getGUIObjectByName (objectName).selected = selected - 1;
+ }
+}
+
+// ====================================================================
+
+// Add the item at the given index (pos) to the given list object (objectName) with the given value (value).
+function addItem (objectName, pos, value)
+{
+ if (getGUIObjectByName (objectName) == null)
+ console.write ("addItem(): " + objectName + " not found.");
+
+ var list = getGUIObjectByName (objectName).list;
+ var selected = getGUIObjectByName (objectName).selected;
+
+ list.splice (pos, 0, value);
+
+ getGUIObjectByName (objectName).list = list;
+
+ // It's important that we update the selection *after*
+ // we've committed the changes to the list.
+
+ // Update the selected so the same element remains selected.
+ if (selected >= pos)
+ {
+ getGUIObjectByName (objectName).selected = selected + 1;
+ }
+}
+
+// ====================================================================
+
+// Adds an element to the end of the list
+function pushItem (objectName, value)
+{
+ if (getGUIObjectByName (objectName) == null)
+ console.write ("pushItem(): " + objectName + " not found.");
+
+ var list = getGUIObjectByName (objectName).list;
+ list.push (value);
+ getGUIObjectByName (objectName).list = list;
+ // Point to the new item.
+ getGUIObjectByName(objectName).selected = getNumItems(objectName)-1;
+}
+
+// ====================================================================
+
+// Removes the last element
+function popItem (objectName)
+{
+ if (getGUIObjectByName (objectName) == null)
+ console.write ("popItem(): " + objectName + " not found.");
+
+ var selected = getGUIObjectByName (objectName).selected;
+ removeItem(objectName, getNumItems(objectName)-1);
+
+ if (selected == getNumItems(objectName)-1)
+ {
+ getGUIObjectByName(objectName).selected = -1;
+ }
+}
+
+// ====================================================================
+
+// Retrieves the number of elements in the list
+function getNumItems (objectName)
+{
+ if (getGUIObjectByName (objectName) == null)
+ console.write ("getNumItems(): " + objectName + " not found.");
+
+ var list = getGUIObjectByName(objectName).list;
+ return list.length;
+}
+
+// ====================================================================
+
+// Retrieves the value of the item at 'pos'
+function getItemValue (objectName, pos)
+{
+ if (getGUIObjectByName (objectName) == null)
+ console.write ("getItemValue(): " + objectName + " not found.");
+
+ var list = getGUIObjectByName(objectName).list;
+ return list[pos];
+}
+
+// ====================================================================
+
+// Retrieves the value of the currently selected item
+function getCurrItemValue (objectName)
+{
+ if (getGUIObjectByName (objectName) == null)
+ console.write ("getCurrItemValue(): " + objectName + " not found.");
+
+ if (getGUIObjectByName(objectName).selected == -1)
+ return "";
+ var list = getGUIObjectByName(objectName).list;
+ return list[getGUIObjectByName(objectName).selected];
+}
+
+// ====================================================================
+
+// Sets current item to a given string (which must be one of those
+// already in the list).
+function setCurrItemValue (objectName, string)
+{
+ if (getGUIObjectByName(objectName) == null) {
+ console.write ("setCurrItemValue(): " + objectName + " not found.");
+ return -1;
+ }
+
+ if (getGUIObjectByName(objectName).selected == -1)
+ return -1; // Return -1 if nothing selected.
+ var list = getGUIObjectByName(objectName).list;
+ // Seek through list.
+ for (ctr = 0; ctr < list.length; ctr++)
+ {
+ // If we have found the string in the list,
+ if (list[ctr] == string)
+ {
+ // Point selected to this item.
+ getGUIObjectByName(objectName).selected = ctr;
+ return ctr; // Return position of item.
+ }
+ }
+
+ // Return -2 if failed to find value in list.
+ console.write ("Requested string '" + string + "' not found in " + objectName + "'s list.");
+ return -2;
+}
+
// ====================================================================
\ No newline at end of file
diff --git a/binaries/data/mods/public/gui/test/functions_utility_music.js b/binaries/data/mods/public/gui/test/functions_utility_music.js
index b545634cfa..fe4128303d 100644
--- a/binaries/data/mods/public/gui/test/functions_utility_music.js
+++ b/binaries/data/mods/public/gui/test/functions_utility_music.js
@@ -1,106 +1,106 @@
-/*
- DESCRIPTION : Audio functions (eg "pick a random sound from a list", "build a playlist") go here.
- NOTES :
-*/
-
-// ====================================================================
-
-// Quick run-down of the basic audio commands:
-
-// Save the specified audio file to handle "s".
-// s = new Sound( "audio/music/menu_track.ogg" );
-
-// Play the sound stored at handle "s" one time (it'll be automatically freed when the playback ends):
-// s.play();
-
-// Play the sound stored at handle "s" continuously:
-// s.loop();
-
-// Close "s" and free it from memory (use in conjunction with loop()):
-// s.free();
-
-// Adjust the gain (volume) of a sound (floating point range between 0 (silent) and 1 (max volume)).
-// s.setGain(value);
-
-// ====================================================================
-
-function newRandomSound(soundType, soundSubType, soundPrePath)
-{
- // Return a random audio file by category, to be assigned to a handle.
-
- switch (soundType)
- {
- case "music":
- var randomSoundPath = "audio/music/"
- break;
- case "voice":
- randomSoundPath = soundPrePath + "/";
- break;
- default:
- break;
- }
-
- // Get names of sounds (attack, command, select, hit, pain).
- // or
- // Get names of "peace", "menu" (theme) and "battle" tracks.
- var soundArray = buildDirEntList(randomSoundPath, "*" + soundSubType + "*", false);
- if (soundArray.length == 0)
- {
- console.write ("Failed to find sounds matching '*"+soundSubType+"*'");
- return;
- }
- // Get a random number within the sound's range.
- var randomSound = getRandom (0, soundArray.length-1);
- // Set name of track.
- var randomFileName = soundArray[randomSound];
-
- // Build path to random audio file.
- randomSoundPath = randomFileName;
-
- //console.write("Playing " + randomSoundPath + " ...");
-
- return new Sound(randomSoundPath);
-}
-
-// ====================================================================
-
-function fadeOut (soundHandle, fadeDuration)
-{
- // Adjust the gain of a sound until it is zero.
- // The sound is automatically freed when finished fading.
- soundHandle.fade(-1, 0, fadeDuration)
-
- return true;
-}
-
-// ====================================================================
-
-function fadeIn (soundHandle, finalGain, fadeDuration)
-{
- // Adjust the gain of a sound from zero up to the given value.
- soundHandle.fade(0, finalGain, fadeDuration)
-
- return true;
-}
-
-// ====================================================================
-
-function crossFade (outHandle, inHandle, fadeDuration)
-{
- // Accepts two sound handles. Over the given duration,
- // fades out the first while fading in the second.
- // Note that it plays the in and frees the out while it's at it.
-
- if (outHandle)
- fadeOut(outHandle, fadeDuration);
-
- if (inHandle)
- {
- inHandle.play();
- fadeIn(inHandle, g_ConfigDB.system["sound.mastergain"], fadeDuration);
- }
-
- return true;
-}
-
+/*
+ DESCRIPTION : Audio functions (eg "pick a random sound from a list", "build a playlist") go here.
+ NOTES :
+*/
+
+// ====================================================================
+
+// Quick run-down of the basic audio commands:
+
+// Save the specified audio file to handle "s".
+// s = new Sound( "audio/music/menu_track.ogg" );
+
+// Play the sound stored at handle "s" one time (it'll be automatically freed when the playback ends):
+// s.play();
+
+// Play the sound stored at handle "s" continuously:
+// s.loop();
+
+// Close "s" and free it from memory (use in conjunction with loop()):
+// s.free();
+
+// Adjust the gain (volume) of a sound (floating point range between 0 (silent) and 1 (max volume)).
+// s.setGain(value);
+
+// ====================================================================
+
+function newRandomSound(soundType, soundSubType, soundPrePath)
+{
+ // Return a random audio file by category, to be assigned to a handle.
+
+ switch (soundType)
+ {
+ case "music":
+ var randomSoundPath = "audio/music/"
+ break;
+ case "voice":
+ randomSoundPath = soundPrePath + "/";
+ break;
+ default:
+ break;
+ }
+
+ // Get names of sounds (attack, command, select, hit, pain).
+ // or
+ // Get names of "peace", "menu" (theme) and "battle" tracks.
+ var soundArray = buildDirEntList(randomSoundPath, "*" + soundSubType + "*", false);
+ if (soundArray.length == 0)
+ {
+ console.write ("Failed to find sounds matching '*"+soundSubType+"*'");
+ return;
+ }
+ // Get a random number within the sound's range.
+ var randomSound = getRandom (0, soundArray.length-1);
+ // Set name of track.
+ var randomFileName = soundArray[randomSound];
+
+ // Build path to random audio file.
+ randomSoundPath = randomFileName;
+
+ //console.write("Playing " + randomSoundPath + " ...");
+
+ return new Sound(randomSoundPath);
+}
+
+// ====================================================================
+
+function fadeOut (soundHandle, fadeDuration)
+{
+ // Adjust the gain of a sound until it is zero.
+ // The sound is automatically freed when finished fading.
+ soundHandle.fade(-1, 0, fadeDuration)
+
+ return true;
+}
+
+// ====================================================================
+
+function fadeIn (soundHandle, finalGain, fadeDuration)
+{
+ // Adjust the gain of a sound from zero up to the given value.
+ soundHandle.fade(0, finalGain, fadeDuration)
+
+ return true;
+}
+
+// ====================================================================
+
+function crossFade (outHandle, inHandle, fadeDuration)
+{
+ // Accepts two sound handles. Over the given duration,
+ // fades out the first while fading in the second.
+ // Note that it plays the in and frees the out while it's at it.
+
+ if (outHandle)
+ fadeOut(outHandle, fadeDuration);
+
+ if (inHandle)
+ {
+ inHandle.play();
+ fadeIn(inHandle, g_ConfigDB.system["sound.mastergain"], fadeDuration);
+ }
+
+ return true;
+}
+
// ====================================================================
\ No newline at end of file
diff --git a/binaries/data/mods/public/gui/test/functions_utility_object.js b/binaries/data/mods/public/gui/test/functions_utility_object.js
index 854b19a729..a58cc1b9db 100644
--- a/binaries/data/mods/public/gui/test/functions_utility_object.js
+++ b/binaries/data/mods/public/gui/test/functions_utility_object.js
@@ -1,134 +1,134 @@
-/*
- DESCRIPTION : Utility functions that manipulate GUI objects.
- NOTES :
-*/
-
-// ====================================================================
-
-// Hide GUI object.
-function guiHide (objectName)
-{
- var guiObject = getGUIObjectByName (objectName);
- if( guiObject == "" || guiObject == null || guiObject == undefined || guiObject == "undefined" )
- console.write ("guiHide(): GUI Object not found: " + objectName);
- if( !guiObject.hidden )
- guiObject.hidden = true;
-}
-
-// ====================================================================
-
-// Reveal GUI object.
-function guiUnHide (objectName)
-{
- var guiObject = getGUIObjectByName (objectName);
- if (guiObject == "" || guiObject == null || guiObject == undefined || guiObject == "undefined")
- console.write ("guiUnHide(): GUI Object not found: " + objectName);
- if( guiObject.hidden )
- guiObject.hidden = false;
-}
-
-// ====================================================================
-
-// Toggle visibility of GUI object.
-function guiToggle (objectName)
-{
- // Get our GUI object
- var guiObject = getGUIObjectByName (objectName);
-
- if (guiObject == "" || guiObject == null || guiObject == undefined || guiObject == "undefined")
- console.write ("guiToggle(): GUI Object not found: " + objectName);
-
- // Toggle it
- guiObject.hidden = !guiObject.hidden;
-}
-
-// ====================================================================
-
-// Enable GUI object.
-function guiEnable (objectName)
-{
- var guiObject = getGUIObjectByName (objectName);
- if (guiObject == "" || guiObject == null || guiObject == undefined || guiObject == "undefined")
- console.write ("guiEnable(): GUI Object not found: " + objectName);
- guiObject.enabled = true;
-}
-
-// ====================================================================
-
-// Disable GUI object.
-function guiDisable (objectName)
-{
- var guiObject = getGUIObjectByName (objectName);
- if (guiObject == "" || guiObject == null || guiObject == undefined || guiObject == "undefined")
- console.write ("guiDisable(): GUI Object not found: " + objectName);
- guiObject.enabled = false;
-}
-
-// ====================================================================
-
-// Change caption of GUI object and then make it visible.
-function guiRenameAndReveal (objectName, objectCaption)
-{
- // Get our GUI object
- var guiObject = getGUIObjectByName (objectName);
-
- if (guiObject == "" || guiObject == null || guiObject == undefined || guiObject == "undefined")
- console.write ("guiRenameAndReveal(): GUI Object not found: " + objectName);
-
- // Rename it
- guiObject.caption = objectCaption;
-
- // Toggle it
- guiObject.hidden = false;
-}
-
-// ====================================================================
-
-// Increment/decrement the numeric caption of a GUI object.
-function guiModifyCaption (objectName, objectModifier, objectPlaces)
-{
- // Adds a modifier to a GUI object's caption (eg increase a number by 1).
- // Obviously don't use this unless you're sure the caption contains a number.
- // objectPlaces specifies the number of decimal places to use for a floating point number.
- // If not specified, it defaults to zero (whole number).
-
- // Get our GUI object
- var guiObject = getGUIObjectByName (objectName);
-
- if (guiObject == "" || guiObject == null || guiObject == undefined || guiObject == "undefined")
- console.write ("guiModifyCaption(): GUI Object not found: " + objectName);
-
- if (!objectPlaces)
- objectPlaces = 0;
- objectPlaces = Math.pow (10, objectPlaces);
-
- guiObject.caption = (Math.round (objectPlaces * guiObject.caption)
- + Math.round (objectPlaces * objectModifier) ) / objectPlaces;
-}
-
-// ====================================================================
-
-// Set caption of a GUI object.
-function guiSetCaption (objectName, objectCaption)
-{
- // Sets an object's caption to the specified value.
-
- // Get our GUI object
- var guiObject = getGUIObjectByName (objectName);
-
- if (guiObject == "" || guiObject == null || guiObject == undefined || guiObject == "undefined")
- console.write ("guiSetCaption(): GUI Object not found: " + objectName);
-
- guiObject.caption = objectCaption;
-}
-
-// ====================================================================
-
-// Helper function that closes a given window (usually the current parent) and opens another one.
-function guiSwitch (closeWindowName, openWindowName)
-{
- guiHide (closeWindowName);
- guiUnHide (openWindowName);
-}
-
+/*
+ DESCRIPTION : Utility functions that manipulate GUI objects.
+ NOTES :
+*/
+
+// ====================================================================
+
+// Hide GUI object.
+function guiHide (objectName)
+{
+ var guiObject = getGUIObjectByName (objectName);
+ if( guiObject == "" || guiObject == null || guiObject == undefined || guiObject == "undefined" )
+ console.write ("guiHide(): GUI Object not found: " + objectName);
+ if( !guiObject.hidden )
+ guiObject.hidden = true;
+}
+
+// ====================================================================
+
+// Reveal GUI object.
+function guiUnHide (objectName)
+{
+ var guiObject = getGUIObjectByName (objectName);
+ if (guiObject == "" || guiObject == null || guiObject == undefined || guiObject == "undefined")
+ console.write ("guiUnHide(): GUI Object not found: " + objectName);
+ if( guiObject.hidden )
+ guiObject.hidden = false;
+}
+
+// ====================================================================
+
+// Toggle visibility of GUI object.
+function guiToggle (objectName)
+{
+ // Get our GUI object
+ var guiObject = getGUIObjectByName (objectName);
+
+ if (guiObject == "" || guiObject == null || guiObject == undefined || guiObject == "undefined")
+ console.write ("guiToggle(): GUI Object not found: " + objectName);
+
+ // Toggle it
+ guiObject.hidden = !guiObject.hidden;
+}
+
+// ====================================================================
+
+// Enable GUI object.
+function guiEnable (objectName)
+{
+ var guiObject = getGUIObjectByName (objectName);
+ if (guiObject == "" || guiObject == null || guiObject == undefined || guiObject == "undefined")
+ console.write ("guiEnable(): GUI Object not found: " + objectName);
+ guiObject.enabled = true;
+}
+
+// ====================================================================
+
+// Disable GUI object.
+function guiDisable (objectName)
+{
+ var guiObject = getGUIObjectByName (objectName);
+ if (guiObject == "" || guiObject == null || guiObject == undefined || guiObject == "undefined")
+ console.write ("guiDisable(): GUI Object not found: " + objectName);
+ guiObject.enabled = false;
+}
+
+// ====================================================================
+
+// Change caption of GUI object and then make it visible.
+function guiRenameAndReveal (objectName, objectCaption)
+{
+ // Get our GUI object
+ var guiObject = getGUIObjectByName (objectName);
+
+ if (guiObject == "" || guiObject == null || guiObject == undefined || guiObject == "undefined")
+ console.write ("guiRenameAndReveal(): GUI Object not found: " + objectName);
+
+ // Rename it
+ guiObject.caption = objectCaption;
+
+ // Toggle it
+ guiObject.hidden = false;
+}
+
+// ====================================================================
+
+// Increment/decrement the numeric caption of a GUI object.
+function guiModifyCaption (objectName, objectModifier, objectPlaces)
+{
+ // Adds a modifier to a GUI object's caption (eg increase a number by 1).
+ // Obviously don't use this unless you're sure the caption contains a number.
+ // objectPlaces specifies the number of decimal places to use for a floating point number.
+ // If not specified, it defaults to zero (whole number).
+
+ // Get our GUI object
+ var guiObject = getGUIObjectByName (objectName);
+
+ if (guiObject == "" || guiObject == null || guiObject == undefined || guiObject == "undefined")
+ console.write ("guiModifyCaption(): GUI Object not found: " + objectName);
+
+ if (!objectPlaces)
+ objectPlaces = 0;
+ objectPlaces = Math.pow (10, objectPlaces);
+
+ guiObject.caption = (Math.round (objectPlaces * guiObject.caption)
+ + Math.round (objectPlaces * objectModifier) ) / objectPlaces;
+}
+
+// ====================================================================
+
+// Set caption of a GUI object.
+function guiSetCaption (objectName, objectCaption)
+{
+ // Sets an object's caption to the specified value.
+
+ // Get our GUI object
+ var guiObject = getGUIObjectByName (objectName);
+
+ if (guiObject == "" || guiObject == null || guiObject == undefined || guiObject == "undefined")
+ console.write ("guiSetCaption(): GUI Object not found: " + objectName);
+
+ guiObject.caption = objectCaption;
+}
+
+// ====================================================================
+
+// Helper function that closes a given window (usually the current parent) and opens another one.
+function guiSwitch (closeWindowName, openWindowName)
+{
+ guiHide (closeWindowName);
+ guiUnHide (openWindowName);
+}
+
// ====================================================================
diff --git a/binaries/data/mods/public/gui/test/functions_utility_test.js b/binaries/data/mods/public/gui/test/functions_utility_test.js
index 37b1e0a229..ca4a34847c 100644
--- a/binaries/data/mods/public/gui/test/functions_utility_test.js
+++ b/binaries/data/mods/public/gui/test/functions_utility_test.js
@@ -1,44 +1,44 @@
-function updateOrbital()
-{
- if( !getGUIObjectByName( 'arena' ).hidden )
- {
- g_ballx += g_balldx;
- g_bally += g_balldy;
- if (g_ballx > 600)
- {
- g_balldx *= -0.9;
- g_ballx = 600-(g_ballx-600);
- }
- else if (g_ballx < 0)
- {
- g_balldx *= -0.9;
- g_ballx = -g_ballx;
- }
- if (g_bally > 400)
- {
- g_balldy *= -0.9;
- g_bally = 400-(g_bally-400);
- }
- else if (g_bally < 0)
- {
- g_balldy *= -0.9;
- g_bally = -g_bally;
- }
-
- // Gravitate towards the mouse
- var vect_x = g_ballx-g_mousex;
- var vect_y = g_bally-g_mousey;
- var dsquared = vect_x*vect_x + vect_y*vect_y;
- if (dsquared < 1000) dsquared = 1000;
- var force = 10000.0 / dsquared;
- var mag = Math.sqrt(dsquared);
- vect_x /= mag; vect_y /= mag;
- g_balldx -= force * vect_x;
- g_balldy -= force * vect_y;
-
- var ball = getGUIObjectByName('ball');
- var r=5;
- ball.size = new GUISize(g_ballx-r, g_bally-r, g_ballx+r, g_bally+r);
- }
-}
-
+function updateOrbital()
+{
+ if( !getGUIObjectByName( 'arena' ).hidden )
+ {
+ g_ballx += g_balldx;
+ g_bally += g_balldy;
+ if (g_ballx > 600)
+ {
+ g_balldx *= -0.9;
+ g_ballx = 600-(g_ballx-600);
+ }
+ else if (g_ballx < 0)
+ {
+ g_balldx *= -0.9;
+ g_ballx = -g_ballx;
+ }
+ if (g_bally > 400)
+ {
+ g_balldy *= -0.9;
+ g_bally = 400-(g_bally-400);
+ }
+ else if (g_bally < 0)
+ {
+ g_balldy *= -0.9;
+ g_bally = -g_bally;
+ }
+
+ // Gravitate towards the mouse
+ var vect_x = g_ballx-g_mousex;
+ var vect_y = g_bally-g_mousey;
+ var dsquared = vect_x*vect_x + vect_y*vect_y;
+ if (dsquared < 1000) dsquared = 1000;
+ var force = 10000.0 / dsquared;
+ var mag = Math.sqrt(dsquared);
+ vect_x /= mag; vect_y /= mag;
+ g_balldx -= force * vect_x;
+ g_balldy -= force * vect_y;
+
+ var ball = getGUIObjectByName('ball');
+ var r=5;
+ ball.size = new GUISize(g_ballx-r, g_bally-r, g_ballx+r, g_bally+r);
+ }
+}
+
diff --git a/binaries/data/mods/public/gui/test/hello.xml b/binaries/data/mods/public/gui/test/hello.xml
index c569fc510f..0a1b2a5d26 100644
--- a/binaries/data/mods/public/gui/test/hello.xml
+++ b/binaries/data/mods/public/gui/test/hello.xml
@@ -1,13 +1,13 @@
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
diff --git a/binaries/data/mods/public/gui/test/setup.xml b/binaries/data/mods/public/gui/test/setup.xml
index 9b1b4a7168..58b4af5b89 100644
--- a/binaries/data/mods/public/gui/test/setup.xml
+++ b/binaries/data/mods/public/gui/test/setup.xml
@@ -1,351 +1,351 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- 0 0 0
-
-
- 237 227 167
-
-
- 255 255 255
-
-
- 243 242 240
-
-
- 43 42 40
-
-
- 0 0 255
-
-
- 0 200 0
-
-
- 191 191 2
-
-
- 159 98 24
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 0 0 0
+
+
+ 237 227 167
+
+
+ 255 255 255
+
+
+ 243 242 240
+
+
+ 43 42 40
+
+
+ 0 0 255
+
+
+ 0 200 0
+
+
+ 191 191 2
+
+
+ 159 98 24
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/binaries/data/mods/public/gui/test/sprite1.xml b/binaries/data/mods/public/gui/test/sprite1.xml
index 7903cbe805..08e2db3bc8 100644
--- a/binaries/data/mods/public/gui/test/sprite1.xml
+++ b/binaries/data/mods/public/gui/test/sprite1.xml
@@ -1,3071 +1,3071 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/binaries/data/mods/public/gui/test/styles.xml b/binaries/data/mods/public/gui/test/styles.xml
index 09e611bfc9..178ca2ccb6 100644
--- a/binaries/data/mods/public/gui/test/styles.xml
+++ b/binaries/data/mods/public/gui/test/styles.xml
@@ -1,830 +1,830 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+