Permalink
Browse files

Added select-item for menus to replace the "custom" item

...and cleaned up related code
  • Loading branch information...
1 parent 01db991 commit 700e10308283f61656edc4123a39d694e517b46f @Medo42 committed May 27, 2012
Showing with 137 additions and 231 deletions.
  1. +26 −97 Source/gg2/Objects/Menus/HUDOptionsController.events/Create.xml
  2. +2 −6 Source/gg2/Objects/Menus/MenuController.events/Draw.xml
  3. +4 −6 Source/gg2/Objects/Menus/MenuController.events/Key enter pressed.xml
  4. +5 −11 Source/gg2/Objects/Menus/MenuController.events/Step.xml
  5. +15 −49 Source/gg2/Objects/Menus/OptionsController.events/Create.xml
  6. +0 −2 Source/gg2/Objects/Overlays/ArenaHUD.events/Create.xml
  7. +5 −2 Source/gg2/Objects/Overlays/ArenaHUD.events/Draw.xml
  8. +0 −2 Source/gg2/Objects/Overlays/ControlPointHUD.events/Create.xml
  9. +4 −1 Source/gg2/Objects/Overlays/ControlPointHUD.events/Draw.xml
  10. +0 −10 Source/gg2/Objects/Overlays/DKothHUD.events/Create.xml
  11. +15 −1 Source/gg2/Objects/Overlays/DKothHUD.events/Draw.xml
  12. +0 −2 Source/gg2/Objects/Overlays/GeneratorHUD.events/Create.xml
  13. +4 −1 Source/gg2/Objects/Overlays/GeneratorHUD.events/Draw.xml
  14. +0 −6 Source/gg2/Objects/Overlays/KillLog.events/Create.xml
  15. +6 −1 Source/gg2/Objects/Overlays/KillLog.events/Draw.xml
  16. +0 −9 Source/gg2/Objects/Overlays/KothHUD.events/Create.xml
  17. +14 −1 Source/gg2/Objects/Overlays/KothHUD.events/Draw.xml
  18. +0 −2 Source/gg2/Objects/Overlays/ScorePanel.events/Create.xml
  19. +3 −2 Source/gg2/Objects/Overlays/ScorePanel.events/Draw.xml
  20. +2 −1 Source/gg2/Scripts/Menus/_resources.list.xml
  21. +9 −0 Source/gg2/Scripts/Menus/menu_add_option.gml
  22. +4 −6 Source/gg2/Scripts/Menus/menu_addedit_boolean.gml
  23. +0 −9 Source/gg2/Scripts/Menus/menu_addedit_custom.gml
  24. +1 −1 Source/gg2/Scripts/Menus/menu_addedit_key.gml
  25. +1 −1 Source/gg2/Scripts/Menus/menu_addedit_keyormouse.gml
  26. +1 −1 Source/gg2/Scripts/Menus/menu_addedit_num.gml
  27. +13 −0 Source/gg2/Scripts/Menus/menu_addedit_select.gml
  28. +1 −1 Source/gg2/Scripts/Menus/menu_addedit_text.gml
  29. +2 −0 Source/gg2/Scripts/Menus/menu_addedit_text2.gml
@@ -13,104 +13,33 @@
<not>false</not>
<appliesTo>.self</appliesTo>
<arguments>
- <argument kind="STRING">{
- menu_create(40, 170, 300, 300, 30);
-
- if room != Options {
- menu_setdimmed();
- }
-
- var timepos;
- if(global.timerPos) {
- timepos = "Left";
- } else {
- timepos = "Center";
- }
- menu_addedit_custom("Timer Position", timepos, '
- global.timerPos = not global.timerPos
- gg2_write_ini("Settings","Timer Position", global.timerPos);
- if instance_exists(HUD) {
- with(HUD) {
- if (object_index != KothHUD) {
- xshift=-320*global.timerPos
- yshift=5
- }else if (global.kothHudPos){
- xshift=-323*global.timerPos
- yshift=35*global.kothHudPos
- }
- else{
- xshift=-290*global.timerPos
- yshift=35*global.kothHudPos
- }
- }
-
- }
- if(global.timerPos) {
- return "Left";
- } else {
- return "Center";
- }
- ');
-
- var killlog;
- if(global.killLogPos) {
- killlog = "Just Below Timers";
- } else {
- killlog = "Default";
- }
- menu_addedit_custom("Kill Log Position", killlog, '
- global.killLogPos = not global.killLogPos
- gg2_write_ini("Settings","Kill Log Position", global.killLogPos)
- if instance_exists(KillLog) {
- with(KillLog) {
- if (global.kothHudPos) {
- yoffset=65*global.killLogPos
- }else if (global.kothHudPos) = false{
- yoffset=45*global.killLogPos
- }
-
- }
- }
- if(global.killLogPos) {
- return "Just Below Timers";
- } else {
- return "Default";
- }
- ');
-
- var kothhud;
- if(global.kothHudPos) {
- kothhud = "Stacked";
- } else {
- kothhud = "Default";
- }
- menu_addedit_custom("KOTH Timer Orientation", kothhud, '
- global.kothHudPos = not global.kothHudPos
- gg2_write_ini("Settings","KoTH HUD Position", global.kothHudPos)
- if instance_exists(KothHUD) {
- with(KothHUD) {
- if (global.kothHudPos) {
- coffset=0
- xshift=-323*global.timerPos
- yshift=35*global.kothHudPos
- }else {
- coffset=43*1.15
- xshift=-290*global.timerPos
- yshift=35*global.kothHudPos
- }
- }
- }
- if(global.kothHudPos) {
- return "Stacked";
- } else {
- return "Default";
- }
- ');
- menu_addback("Back", '
- instance_create(x,y,OptionsController);
- instance_destroy();
- ');
+ <argument kind="STRING">menu_create(40, 170, 300, 300, 30);
+if(room != Options) {
+ menu_setdimmed();
}
+
+menu_addedit_select("Timer Position", "global.timerPos", '
+ gg2_write_ini("Settings", "Timer Position", argument0);
+');
+menu_add_option(0, "Center");
+menu_add_option(1, "Left");
+
+menu_addedit_select("Kill Log Position", "global.killLogPos", '
+ gg2_write_ini("Settings", "Kill Log Position", argument0);
+');
+menu_add_option(0, "Default");
+menu_add_option(1, "Just Below Timers");
+
+menu_addedit_select("KOTH Timer Orientation", "global.kothHudPos", '
+ gg2_write_ini("Settings","KoTH HUD Position", argument0);
+');
+menu_add_option(0, "Default");
+menu_add_option(1, "Stacked");
+
+menu_addback("Back", '
+ instance_create(x,y,OptionsController);
+ instance_destroy();
+');
</argument>
</arguments>
</action>
@@ -43,17 +43,13 @@
case "script":
val = "";
break;
- case "editcustom":
case "edittext2":
case "edittext":
case "editnum":
val = item_value[i];
break;
- case "editboolean":
- if(menu_get_var(i))
- val = "Yes";
- else
- val = "No";
+ case "editselect":
+ val = item_option_label[i, item_value[i]];
break;
case "editkey":
if editing == i {
@@ -16,19 +16,17 @@
<argument kind="STRING">if(editing != -1) {
switch (item_type[editing]) {
case "edittext":
- execute_string(item_script[editing], menu_get_var(editing));
menu_set_var(editing, item_value[editing]);
+ execute_string(item_script[editing], item_value[editing]);
break;
case "edittext2":
item_value[editing] = execute_string(item_script[editing], item_value[editing]);
menu_set_var(editing, item_value[editing]);
break;
case "editnum":
- var numval;
- numval = real(string_digits(item_value[editing]));
- execute_string(item_script[editing], numval);
- menu_set_var(editing, numval);
- item_value[editing] = string(numval);
+ menu_set_var(editing, real(string_digits(item_value[editing])));
+ execute_string(item_script[editing], menu_get_var(editing));
+ item_value[editing] = menu_get_var(editing);
break;
}
editing = -1;
@@ -21,15 +21,6 @@ if(editing != -1) {
case "editnum":
item_value[editing] = keyboard_string;
break;
- case "editcustom":
- item_value[editing] = execute_string(item_script[editing], item_value[editing]);
- editing = -1;
- break;
- case "editboolean":
- menu_set_var(editing, !menu_get_var(editing));
- execute_string(item_script[editing], menu_get_var(editing));
- editing = -1;
- break;
case "editkeyormouse":
if mouse_check_button(mb_left) {
menu_set_var(editing, MOUSE_LEFT);
@@ -70,10 +61,13 @@ if(editing != -1) {
case "edittext2":
case "editnum":
keyboard_string = "";
- case "editboolean":
- case "editcustom":
editing = virtualitem;
break;
+ case "editselect":
+ item_value[virtualitem] = (item_value[virtualitem]+1) mod item_options[virtualitem];
+ menu_set_var(virtualitem, item_option_value[virtualitem, item_value[virtualitem]]);
+ execute_string(item_script[virtualitem], menu_get_var(virtualitem));
+ break;
}
}
}
@@ -20,6 +20,7 @@
menu_setdimmed();
}
+ oldPlayerName = global.playerName;
menu_addedit_text2("Player name:", "global.playerName", '
var newName;
newName = string_copy(argument0, 0, min(string_length(argument0), MAX_PLAYERNAME_LENGTH));
@@ -28,13 +29,14 @@
newName = "Player";
}
gg2_write_ini("Settings", "PlayerName", newName);
- if(room != Options and newName != global.playerName)
+ if(room != Options and newName != oldPlayerName)
{
write_ubyte(global.serverSocket, PLAYER_CHANGENAME);
write_ubyte(global.serverSocket, string_length(newName));
write_string(global.serverSocket, newName);
socket_send(global.serverSocket);
}
+ oldPlayerName = newName;
return newName;
');
menu_addedit_boolean("Fullscreen:", "global.fullscreen", '
@@ -52,57 +54,21 @@
}
');
- var particles;
-
- if(global.particles == PARTICLES_NORMAL) {
- particles = "Normal";
- } else if(global.particles == PARTICLES_ALTERNATIVE) {
- particles = "Alternative (faster)";
- } else {
- particles = "Disabled";
- }
-
- menu_addedit_custom("Particles:", particles, '
- global.particles = (global.particles+2) mod 3;
- gg2_write_ini("Settings", "Particles", global.particles);
- if(global.particles == PARTICLES_NORMAL) {
- return "Normal";
- } else if(global.particles == PARTICLES_ALTERNATIVE) {
- return "Alternative (faster)";
- } else {
- return "Disabled";
- }
+ menu_addedit_select("Particles:", "global.particles", '
+ gg2_write_ini("Settings", "Particles", argument0);
');
+ menu_add_option(PARTICLES_NORMAL, "Normal");
+ menu_add_option(PARTICLES_OFF, "Disabled");
+ menu_add_option(PARTICLES_ALTERNATIVE, "Alternative (faster)");
- var gibs;
- switch (global.gibLevel){
- case(0): gibs = "0, Disabled"; break;
- case(1): gibs = "1, Blood only"; break;
- case(2): gibs = "2, Blood and medium gibs"; break;
- default: gibs = string(global.gibLevel) + ", Full blood and gibs"; break;
- }
-
- menu_addedit_custom("Gibs:", gibs, '
- switch (global.gibLevel){
- case(0):
- global.gibLevel = 1;
- return "1, Blood only";
- break;
- case(1):
- global.gibLevel = 2;
- return "2, Blood and medium gibs";
- break;
- case(2):
- global.gibLevel = 3;
- return string(global.gibLevel) + ", Full blood and gibs";
- break;
- default:
- global.gibLevel = 0;
- return "0, No blood or gibs";
- break;
- }
- gg2_write_ini("Settings", "Gib Level", global.gibLevel);
+ menu_addedit_select("Gibs:", "global.gibLevel", '
+ gg2_write_ini("Settings", "Gib Level", argument0);
');
+ menu_add_option(0, "Disabled");
+ menu_add_option(1, "Blood only");
+ menu_add_option(2, "Blood and medium gibs");
+ menu_add_option(3, "Full blood and gibs");
+
menu_addedit_boolean("Healer Radar:", "global.medicRadar", '
gg2_write_ini("Settings", "Healer Radar", argument0);
');
@@ -26,8 +26,6 @@ cpUnlock = 1800;
overtime = 0;
redteamCharacters = 0;
blueteamCharacters = 0;
-xshift=-320*global.timerPos
-yshift=5*global.timerPos
</argument>
</arguments>
</action>
@@ -13,11 +13,14 @@
<not>false</not>
<appliesTo>.self</appliesTo>
<arguments>
- <argument kind="STRING">xoffset = view_xview[0];
+ <argument kind="STRING">var xoffset, yoffset, xsize, ysize, xshift, yshift;
+xoffset = view_xview[0];
yoffset = view_yview[0];
xsize = view_wview[0];
ysize = view_hview[0];
-
+xshift = -320*global.timerPos;
+yshift = 5*global.timerPos;
+
if instance_exists(WinBanner) with WinBanner instance_destroy();
draw_set_color(c_white);
@@ -17,8 +17,6 @@
timer=timeLimit;
teamoffset=0;
overtime = 0;
-xshift=-320*global.timerPos
-yshift=5*global.timerPos
global.totalControlPoints = instance_number(ControlPoint);
middlePoint = global.totalControlPoints/2;
@@ -13,10 +13,13 @@
<not>false</not>
<appliesTo>.self</appliesTo>
<arguments>
- <argument kind="STRING">xoffset = view_xview[0];
+ <argument kind="STRING">var xoffset, yoffset, xsize, ysize, xshift, yshift;
+xoffset = view_xview[0];
yoffset = view_yview[0];
xsize = view_wview[0];
ysize = view_hview[0];
+xshift = -320*global.timerPos;
+yshift = 5*global.timerPos;
if global.totalControlPoints == 1 drawx = xoffset+xsize/2;
else drawx = xoffset+xsize/2 - floor(global.totalControlPoints)/2*48;
@@ -19,16 +19,6 @@ cpUnlock = 900;
hostTimer = global.timeLimitMins*30*60;
global.totalControlPoints = 2;
-if (global.kothHudPos) {
- coffset=0
- xshift=-323*global.timerPos
- yshift=35*global.kothHudPos
-}else {
- coffset=43*1.15
- xshift=-290*global.timerPos
- yshift=35*global.kothHudPos
-}
-
KothRedControlPoint.team = TEAM_RED;
KothBlueControlPoint.team = TEAM_BLUE;
</argument>
@@ -13,11 +13,25 @@
<not>false</not>
<appliesTo>.self</appliesTo>
<arguments>
- <argument kind="STRING">xoffset = view_xview[0];
+ <argument kind="STRING">var xoffset, yoffset, xsize, ysize, xshift, yshift, coffset;
+xoffset = view_xview[0];
yoffset = view_yview[0];
xsize = view_wview[0];
ysize = view_hview[0];
+if (global.kothHudPos)
+{
+ coffset = 0;
+ xshift = -323*global.timerPos;
+ yshift = 35;
+}
+else
+{
+ coffset = 43*1.15;
+ xshift = -290*global.timerPos;
+ yshift = 0;
+}
+
drawx = xoffset+xsize/2 - 48;
draw_set_alpha(1);
Oops, something went wrong.

0 comments on commit 700e103

Please sign in to comment.