Permalink
Browse files

Fixing some things for classlimits and adding a menu

  • Loading branch information...
Medo42 committed Jun 1, 2012
1 parent 2d2628f commit 3c17886d5c135a3b58ede8ea325fbd48c950b0b9
Binary file not shown.
@@ -0,0 +1,58 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<event category="CREATE" id="0">
+ <actions>
+ <action id="603" library="1">
+ <!--action name: Code-->
+ <kind>CODE</kind>
+ <allowRelative>false</allowRelative>
+ <question>false</question>
+ <canApplyTo>true</canApplyTo>
+ <actionType>CODE</actionType>
+ <functionName/>
+ <relative>false</relative>
+ <not>false</not>
+ <appliesTo>.self</appliesTo>
+ <arguments>
+ <argument kind="STRING">menu_create(40, 200, 300, 200, 30);
+
+menu_addedit_num("Scout:", "global.classlimits[CLASS_SCOUT]", '
+ argument0 = min(256, argument0);
+ gg2_write_ini("Classlimits", "Scout", argument0);
+', 256);
+menu_addedit_num("Pyro:", "global.classlimits[CLASS_PYRO]", '
+ gg2_write_ini("Classlimits", "Pyro", argument0);
+', 256);
+menu_addedit_num("Soldier:", "global.classlimits[CLASS_SOLDIER]", '
+ gg2_write_ini("Classlimits", "Soldier", argument0);
+', 256);
+menu_addedit_num("Heavy:", "global.classlimits[CLASS_HEAVY]", '
+ gg2_write_ini("Classlimits", "Heavy", argument0);
+', 256);
+menu_addedit_num("Demoman:", "global.classlimits[CLASS_DEMOMAN]", '
+ gg2_write_ini("Classlimits", "Demoman", argument0);
+', 256);
+menu_addedit_num("Medic:", "global.classlimits[CLASS_MEDIC]", '
+ gg2_write_ini("Classlimits", "Medic", argument0);
+', 256);
+menu_addedit_num("Engineer:", "global.classlimits[CLASS_ENGINEER]", '
+ gg2_write_ini("Classlimits", "Engineer", argument0);
+', 256);
+menu_addedit_num("Spy:", "global.classlimits[CLASS_SPY]", '
+ gg2_write_ini("Classlimits", "Spy", argument0);
+', 256);
+menu_addedit_num("Sniper:", "global.classlimits[CLASS_SNIPER]", '
+ gg2_write_ini("Classlimits", "Sniper", argument0);
+', 256);
+menu_addedit_num("Quote:", "global.classlimits[CLASS_QUOTE]", '
+ gg2_write_ini("Classlimits", "Quote", argument0);
+', 256);
+
+menu_addback("Back", '
+ instance_create(x,y,HostOptionsController);
+ instance_destroy();
+');
+</argument>
+ </arguments>
+ </action>
+ </actions>
+</event>
@@ -0,0 +1,10 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<object id="805">
+ <sprite/>
+ <solid>false</solid>
+ <visible>true</visible>
+ <depth>0</depth>
+ <persistent>false</persistent>
+ <parent>MenuController</parent>
+ <mask/>
+</object>
@@ -25,7 +25,7 @@ if (global.Server_RespawntimeSec == 0)
else
global.Server_Respawntime = global.Server_RespawntimeSec * 30;
-menu_create(40, 200, 300, 200, 30);
+menu_create(40, 160, 500, 200, 30);
menu_addedit_text2("Server Name:", "global.serverName", '
var newName;
newName = string_copy(argument0, 0, 25);
@@ -41,10 +41,10 @@ menu_addedit_text("Password:", "global.serverPassword", '
');
menu_addedit_num("Hosting Port:", "global.hostingPort", '
gg2_write_ini("Settings", "HostingPort", argument0);
-');
+', 65535);
menu_addedit_num("Player Limit:", "global.playerLimit", '
gg2_write_ini("Settings", "PlayerLimit", argument0);
-');
+', 255);
menu_addedit_num("Time Limit (mins):", "global.timeLimitMins", '
gg2_write_ini("Server", "Time Limit", argument0);
');
@@ -60,6 +60,10 @@ menu_addedit_boolean("Auto Balance:", "global.autobalance", '
menu_addedit_boolean("Announce to Lobby:", "global.useLobbyServer", '
gg2_write_ini("Settings", "UseLobby", argument0);
');
+menu_addlink("Classlimits", '
+ instance_create(x,y,ClasslimitsMenuController);
+ instance_destroy();
+');
menu_addlink("Start Game", '
//Server respawn time calculator. Converts each second to a frame. (read: multiply by 30 :hehe:)
if (global.Server_RespawntimeSec == 0)
@@ -24,7 +24,11 @@
menu_set_var(editing, item_value[editing]);
break;
case "editnum":
- menu_set_var(editing, real(string_digits(item_value[editing])));
+ var newval;
+ newval = real(string_digits(item_value[editing]));
+ if(item_limit[editing]&gt;0)
+ newval = min(newval, item_limit[editing]);
+ menu_set_var(editing, newval);
execute_string(item_script[editing], menu_get_var(editing));
item_value[editing] = menu_get_var(editing);
break;
@@ -12,4 +12,5 @@
<resource name="CreditsController" type="RESOURCE"/>
<resource name="DevMessageChecker" type="RESOURCE"/>
<resource name="MenuController" type="RESOURCE"/>
+ <resource name="ClasslimitsMenuController" type="RESOURCE"/>
</resources>
@@ -44,8 +44,6 @@ if newclass != -1 &amp;&amp; y==120 {
}
draw_sprite_ext(ClassSelectSpritesS,newclass+indexoffset,xoffset+drawx[newclass],yoffset,1,1,0,c_white, alpha);
- //draw_sprite_ext(ClassSelectPortraitS,newclass+indexoffset,xoffset+230,yoffset+128,4,4,0,c_white,alpha);
-
draw_text(xoffset+495,yoffset+80,text[0]);
draw_text(xoffset+495,yoffset+100,text[1]);
draw_text(xoffset+495,yoffset+120,text[2]);
@@ -92,6 +90,7 @@ for(i=0; i&lt;9; i+=1)
}
else if number != 0
{
+ draw_set_color(c_white);
draw_text(xoffset+drawx[i]+3, yoffset+43+(y-120), string(number));
}
}
@@ -1,10 +1,11 @@
// argument0 - name
// argument1 - name of the variable this setting is bound to
// argument2 - GML code to run upon change (argument0 is new value)
-
+// argument3 - limit. If this is not 0, the value will be limited to this.
item_name[items] = argument0;
item_type[items] = "editnum";
item_var[items] = argument1;
item_value[items] = string(menu_get_var(items));
item_script[items] = argument2;
+item_limit[items] = argument3;
items += 1;
@@ -68,16 +68,16 @@
global.updaterBetaChannel = ini_read_real("General", "UpdaterBetaChannel", isBetaVersion());
- global.classlimits[CLASS_SCOUT] = ini_read_real("Classlimits", "Scout", 9999)
- global.classlimits[CLASS_PYRO] = ini_read_real("Classlimits", "Pyro", 9999)
- global.classlimits[CLASS_SOLDIER] = ini_read_real("Classlimits", "Soldier", 9999)
- global.classlimits[CLASS_HEAVY] = ini_read_real("Classlimits", "Heavy", 9999)
- global.classlimits[CLASS_DEMOMAN] = ini_read_real("Classlimits", "Demoman", 9999)
- global.classlimits[CLASS_MEDIC] = ini_read_real("Classlimits", "Medic", 9999)
- global.classlimits[CLASS_ENGINEER] = ini_read_real("Classlimits", "Engineer", 9999)
- global.classlimits[CLASS_SPY] = ini_read_real("Classlimits", "Spy", 9999)
- global.classlimits[CLASS_SNIPER] = ini_read_real("Classlimits", "Sniper", 9999)
- global.classlimits[CLASS_QUOTE] = ini_read_real("Classlimits", "Quote", 9999)
+ global.classlimits[CLASS_SCOUT] = ini_read_real("Classlimits", "Scout", 256)
+ global.classlimits[CLASS_PYRO] = ini_read_real("Classlimits", "Pyro", 256)
+ global.classlimits[CLASS_SOLDIER] = ini_read_real("Classlimits", "Soldier", 256)
+ global.classlimits[CLASS_HEAVY] = ini_read_real("Classlimits", "Heavy", 256)
+ global.classlimits[CLASS_DEMOMAN] = ini_read_real("Classlimits", "Demoman", 256)
+ global.classlimits[CLASS_MEDIC] = ini_read_real("Classlimits", "Medic", 256)
+ global.classlimits[CLASS_ENGINEER] = ini_read_real("Classlimits", "Engineer", 256)
+ global.classlimits[CLASS_SPY] = ini_read_real("Classlimits", "Spy", 256)
+ global.classlimits[CLASS_SNIPER] = ini_read_real("Classlimits", "Sniper", 256)
+ global.classlimits[CLASS_QUOTE] = ini_read_real("Classlimits", "Quote", 256)
global.currentMapArea=1;
global.totalMapAreas=1;

0 comments on commit 3c17886

Please sign in to comment.