Skip to content

Commit

Permalink
Added version checking and an experimental settings toggle
Browse files Browse the repository at this point in the history
  • Loading branch information
milesthenerd committed Nov 22, 2021
1 parent 94c2b0a commit cedb84e
Show file tree
Hide file tree
Showing 7 changed files with 176 additions and 13 deletions.
1 change: 1 addition & 0 deletions AM2R Server.project.gmx
Original file line number Diff line number Diff line change
Expand Up @@ -204,6 +204,7 @@
<object>objects\oEventSync</object>
<object>objects\oMapSync</object>
<object>objects\oMapPlayerIconSync</object>
<object>objects\oExperimentalToggle</object>
<object>objects\oResetToggles</object>
<object>objects\oDifficulty</object>
<object>objects\oELM</object>
Expand Down
14 changes: 7 additions & 7 deletions Configs/Default.config.gmx
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,10 @@
<option_android_arch_mipsr2sf>false</option_android_arch_mipsr2sf>
<option_android_arch_x86>True</option_android_arch_x86>
<option_android_build_tools_version>28.0.3</option_android_build_tools_version>
<option_android_build_version>1</option_android_build_version>
<option_android_build_version>2</option_android_build_version>
<option_android_color_depth>0</option_android_color_depth>
<option_android_compile_sdk_version>28</option_android_compile_sdk_version>
<option_android_display_name>AM2R Server 1.4.1</option_android_display_name>
<option_android_display_name>AM2R Server 1.4.2</option_android_display_name>
<option_android_facebook_app_display_name></option_android_facebook_app_display_name>
<option_android_facebook_appid></option_android_facebook_appid>
<option_android_facebook_enable>0</option_android_facebook_enable>
Expand Down Expand Up @@ -211,7 +211,7 @@
<option_changeresolution>false</option_changeresolution>
<option_closeesc>true</option_closeesc>
<option_colordepth>0</option_colordepth>
<option_display_name>AM2R Server 1.4.1</option_display_name>
<option_display_name>AM2R Server 1.4.2</option_display_name>
<option_displayerrors>True</option_displayerrors>
<option_ecma>0</option_ecma>
<option_facebook_app_display_name></option_facebook_app_display_name>
Expand Down Expand Up @@ -351,7 +351,7 @@
<option_ios_texture_page>1024</option_ios_texture_page>
<option_ios_use_test_ads>false</option_ios_use_test_ads>
<option_lastchanged></option_lastchanged>
<option_linux_display_name>AM2R Server 1.4.1</option_linux_display_name>
<option_linux_display_name>AM2R Server 1.4.2</option_linux_display_name>
<option_linux_enable_steam>0</option_linux_enable_steam>
<option_linux_fullscreen>0</option_linux_fullscreen>
<option_linux_homepage></option_linux_homepage>
Expand All @@ -367,7 +367,7 @@
<option_linux_steam_app_id>0</option_linux_steam_app_id>
<option_linux_sync>0</option_linux_sync>
<option_linux_texture_page>2048</option_linux_texture_page>
<option_linux_version_build>1</option_linux_version_build>
<option_linux_version_build>2</option_linux_version_build>
<option_linux_version_major>1</option_linux_version_major>
<option_linux_version_minor>4</option_linux_version_minor>
<option_loadalpha>255</option_loadalpha>
Expand Down Expand Up @@ -505,7 +505,7 @@
<option_version_major>1</option_version_major>
<option_version_minor>4</option_version_minor>
<option_version_product></option_version_product>
<option_version_release>1</option_version_release>
<option_version_release>2</option_version_release>
<option_win8_advertising_appid></option_win8_advertising_appid>
<option_win8_advertising_enable>0</option_win8_advertising_enable>
<option_win8_advertising_key></option_win8_advertising_key>
Expand Down Expand Up @@ -590,7 +590,7 @@
<option_windows_major_version>1</option_windows_major_version>
<option_windows_nsis_file>Configs\Default\windows\RunnerInstaller.nsi</option_windows_nsis_file>
<option_windows_product_info></option_windows_product_info>
<option_windows_release_version>1</option_windows_release_version>
<option_windows_release_version>2</option_windows_release_version>
<option_windows_runner_finished>Configs\Default\windows\Runner_finish.bmp</option_windows_runner_finished>
<option_windows_runner_header>Configs\Default\windows\Runner_header.bmp</option_windows_runner_header>
<option_windows_save_location>0</option_windows_save_location>
Expand Down
123 changes: 123 additions & 0 deletions objects/oExperimentalToggle.object.gmx
Original file line number Diff line number Diff line change
@@ -0,0 +1,123 @@
<!--This Document is generated by GameMaker, if you edit it by hand then you do so at your own risk!-->
<object>
<spriteName>sOption</spriteName>
<solid>0</solid>
<visible>-1</visible>
<depth>0</depth>
<persistent>0</persistent>
<parentName>&lt;undefined&gt;</parentName>
<maskName>&lt;undefined&gt;</maskName>
<events>
<event eventtype="0" enumb="0">
<action>
<libid>1</libid>
<id>603</id>
<kind>7</kind>
<userelative>0</userelative>
<isquestion>0</isquestion>
<useapplyto>-1</useapplyto>
<exetype>2</exetype>
<functionname></functionname>
<codestring></codestring>
<whoName>self</whoName>
<relative>0</relative>
<isnot>0</isnot>
<arguments>
<argument>
<kind>1</kind>
<string>global.experimental = false;
image_speed = 0;
</string>
</argument>
</arguments>
</action>
</event>
<event eventtype="3" enumb="0">
<action>
<libid>1</libid>
<id>603</id>
<kind>7</kind>
<userelative>0</userelative>
<isquestion>0</isquestion>
<useapplyto>-1</useapplyto>
<exetype>2</exetype>
<functionname></functionname>
<codestring></codestring>
<whoName>self</whoName>
<relative>0</relative>
<isnot>0</isnot>
<arguments>
<argument>
<kind>1</kind>
<string>if(global.experimental){
image_index = 0;
} else image_index = 1;
</string>
</argument>
</arguments>
</action>
</event>
<event eventtype="6" enumb="4">
<action>
<libid>1</libid>
<id>603</id>
<kind>7</kind>
<userelative>0</userelative>
<isquestion>0</isquestion>
<useapplyto>-1</useapplyto>
<exetype>2</exetype>
<functionname></functionname>
<codestring></codestring>
<whoName>self</whoName>
<relative>0</relative>
<isnot>0</isnot>
<arguments>
<argument>
<kind>1</kind>
<string>global.experimental = !global.experimental;
</string>
</argument>
</arguments>
</action>
</event>
<event eventtype="8" enumb="0">
<action>
<libid>1</libid>
<id>603</id>
<kind>7</kind>
<userelative>0</userelative>
<isquestion>0</isquestion>
<useapplyto>-1</useapplyto>
<exetype>2</exetype>
<functionname></functionname>
<codestring></codestring>
<whoName>self</whoName>
<relative>0</relative>
<isnot>0</isnot>
<arguments>
<argument>
<kind>1</kind>
<string>draw_self();

draw_set_halign(fa_right);
draw_text(x - sprite_width, y - 12, "TOGGLE EXPERIMENTAL SETTINGS");
draw_set_halign(fa_left);
</string>
</argument>
</arguments>
</action>
</event>
</events>
<PhysicsObject>0</PhysicsObject>
<PhysicsObjectSensor>0</PhysicsObjectSensor>
<PhysicsObjectShape>0</PhysicsObjectShape>
<PhysicsObjectDensity>0.5</PhysicsObjectDensity>
<PhysicsObjectRestitution>0.100000001490116</PhysicsObjectRestitution>
<PhysicsObjectGroup>0</PhysicsObjectGroup>
<PhysicsObjectLinearDamping>0.100000001490116</PhysicsObjectLinearDamping>
<PhysicsObjectAngularDamping>0.100000001490116</PhysicsObjectAngularDamping>
<PhysicsObjectFriction>0.200000002980232</PhysicsObjectFriction>
<PhysicsObjectAwake>-1</PhysicsObjectAwake>
<PhysicsObjectKinematic>0</PhysicsObjectKinematic>
<PhysicsShapePoints/>
</object>
2 changes: 1 addition & 1 deletion objects/oSAXModeButton.object.gmx
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ if(instance_exists(oServer)){

var str2 = "";
var currentRoom = ds_map_find_value(global.readyMap, ID);
if(!is_undefined(currentRoom) &amp;&amp; currentRoom != 0 &amp;&amp; currentRoom != 1 &amp;&amp; currentRoom != 13 &amp;&amp; currentRoom != 14 &amp;&amp; currentRoom != 15){
if(!is_undefined(currentRoom) &amp;&amp; currentRoom != 0 &amp;&amp; currentRoom != 1 &amp;&amp; currentRoom != 4 &amp;&amp; currentRoom != 5 &amp;&amp; currentRoom != 6 &amp;&amp; currentRoom != 13 &amp;&amp; currentRoom != 14 &amp;&amp; currentRoom != 15){
str2 = "Ready";
} else str2 = "Not ready";

Expand Down
36 changes: 36 additions & 0 deletions objects/oServer.object.gmx
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,10 @@ posMapModified = false;
global.lobbyLocked = false;

global.damageMult = 0;

global.clientVersion = "V1.4.2";

global.experimental = false;
</string>
</argument>
</arguments>
Expand Down Expand Up @@ -214,6 +218,7 @@ buffer_write(buffer, buffer_u8, global.saxmode);
buffer_write(buffer, buffer_u8, global.lobbyLocked);
buffer_write(buffer, buffer_u8, samCount);
buffer_write(buffer, buffer_string, string(global.damageMult));
buffer_write(buffer, buffer_u8, global.experimental);
var bufferSize = buffer_tell(buffer);
buffer_seek(buffer, buffer_seek_start, 0);
buffer_write(buffer, buffer_s32, bufferSize);
Expand All @@ -222,6 +227,7 @@ buffer_write(buffer, buffer_u8, global.saxmode);
buffer_write(buffer, buffer_u8, global.lobbyLocked);
buffer_write(buffer, buffer_u8, samCount);
buffer_write(buffer, buffer_string, string(global.damageMult));
buffer_write(buffer, buffer_u8, global.experimental);
for(var i=0; i&lt;sockets; i++){
network_send_packet(playerList[| i], buffer, buffer_tell(buffer));
}
Expand Down Expand Up @@ -2377,6 +2383,36 @@ switch(type_event){
case 1:
var name = buffer_read(_buffer, buffer_string);
var sax = buffer_read(_buffer, buffer_u8);

var msg = name; //string to split
var splitBy = ","; //string to split the first string by
var slot = 0;
var splits; //array to hold all splits
var str2 = ""; //var to hold the current split we're working on building

for(var i=1; i&lt;(string_length(msg)+1); i++) {
var currStr = string_copy(msg, i, 1);
if (currStr == splitBy) {
splits[slot] = str2; //add this split to the array of all splits
slot++;
str2 = "";
} else {
str2 = str2 + currStr;
splits[slot] = str2;
}
}

var wrongVersion = true;

name = splits[0];

for(var i=0; i&lt;array_length_1d(splits); i++){
show_debug_message(splits[i]);
if(splits[i] == global.clientVersion) wrongVersion = false;
}

if(wrongVersion) ds_list_add(kickList, ip);

var findsocket = ds_list_find_index(playerList, socket);
if(findsocket &lt; 0){
ds_list_add(playerList, socket);
Expand Down
11 changes: 6 additions & 5 deletions rooms/room0.room.gmx
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ global.saxmode = 0;</code>
<instance objName="oMapSync" x="1248" y="608" name="inst_C0351002" locked="0" code="" scaleX="1" scaleY="1" colour="4294967295" rotation="0"/>
<instance objName="oMapPlayerIconSync" x="1248" y="640" name="inst_4E02390F" locked="0" code="" scaleX="1" scaleY="1" colour="4294967295" rotation="0"/>
<instance objName="oSlot" x="1244" y="368" name="inst_D80C554D" locked="0" code="" scaleX="1" scaleY="1" colour="4294967295" rotation="0"/>
<instance objName="oLockLobby" x="896" y="672" name="inst_581B2292" locked="0" code="" scaleX="1" scaleY="1" colour="4294967295" rotation="0"/>
<instance objName="oLockLobby" x="896" y="696" name="inst_581B2292" locked="0" code="" scaleX="1" scaleY="1" colour="4294967295" rotation="0"/>
<instance objName="oServer" x="0" y="0" name="inst_82B56698" locked="0" code="" scaleX="1" scaleY="1" colour="4294967295" rotation="0"/>
<instance objName="oPort" x="1120" y="8" name="inst_3D1F61B7" locked="0" code="" scaleX="1" scaleY="1" colour="4294967295" rotation="0"/>
<instance objName="oReset" x="1120" y="176" name="inst_5A73AE24" locked="0" code="" scaleX="1" scaleY="1" colour="4294967295" rotation="0"/>
Expand All @@ -81,16 +81,17 @@ global.saxmode = 0;</code>
<instance objName="oClients" x="1120" y="64" name="inst_F4D6DEE6" locked="0" code="" scaleX="1" scaleY="1" colour="4294967295" rotation="0"/>
<instance objName="oBan" x="32" y="0" name="inst_7FAA6488" locked="0" code="" scaleX="1" scaleY="1" colour="4294967295" rotation="0"/>
<instance objName="oKick" x="64" y="0" name="inst_ABF5C158" locked="0" code="" scaleX="1" scaleY="1" colour="4294967295" rotation="0"/>
<instance objName="oResetToggles" x="1120" y="728" name="inst_0FCAA796" locked="0" code="" scaleX="1" scaleY="1" colour="4294967295" rotation="0"/>
<instance objName="oDifficulty" x="1120" y="784" name="inst_AB28A23B" locked="0" code="" scaleX="1" scaleY="1" colour="4294967295" rotation="0"/>
<instance objName="oELM" x="1120" y="840" name="inst_66269891" locked="0" code="" scaleX="1" scaleY="1" colour="4294967295" rotation="0"/>
<instance objName="oResetToggles" x="1120" y="752" name="inst_0FCAA796" locked="0" code="" scaleX="1" scaleY="1" colour="4294967295" rotation="0"/>
<instance objName="oDifficulty" x="1120" y="808" name="inst_AB28A23B" locked="0" code="" scaleX="1" scaleY="1" colour="4294967295" rotation="0"/>
<instance objName="oELM" x="1120" y="864" name="inst_66269891" locked="0" code="" scaleX="1" scaleY="1" colour="4294967295" rotation="0"/>
<instance objName="oBlacklistReset" x="712" y="896" name="inst_FACA1F74" locked="0" code="" scaleX="1" scaleY="1" colour="4294967295" rotation="0"/>
<instance objName="oGenerateSeed" x="520" y="896" name="inst_044E107B" locked="0" code="" scaleX="1" scaleY="1" colour="4294967295" rotation="0"/>
<instance objName="oCustomSeed" x="328" y="896" name="inst_4BD1F5F9" locked="0" code="" scaleX="1" scaleY="1" colour="4294967295" rotation="0"/>
<instance objName="oCycleRando" x="904" y="896" name="inst_D0C33B1D" locked="0" code="" scaleX="1" scaleY="1" colour="4294967295" rotation="0"/>
<instance objName="oSAXMode" x="128" y="0" name="inst_1F68BD04" locked="0" code="" scaleX="1" scaleY="1" colour="4294967295" rotation="0"/>
<instance objName="oSAXModeToggle" x="1120" y="672" name="inst_644D2198" locked="0" code="" scaleX="1" scaleY="1" colour="4294967295" rotation="0"/>
<instance objName="oSAXModeToggle" x="1120" y="696" name="inst_644D2198" locked="0" code="" scaleX="1" scaleY="1" colour="4294967295" rotation="0"/>
<instance objName="oModPassword" x="1120" y="120" name="inst_4DB90A51" locked="0" code="" scaleX="1" scaleY="1" colour="4294967295" rotation="0"/>
<instance objName="oExperimentalToggle" x="1248" y="672" name="inst_B2E31D1F" locked="0" code="" scaleX="1" scaleY="1" colour="4294967295" rotation="0"/>
</instances>
<tiles/>
<PhysicsWorld>0</PhysicsWorld>
Expand Down
2 changes: 2 additions & 0 deletions scripts/check_items.gml
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,8 @@ for(var h=0; h<array_length_1d(global.itemSamus); h++){

global.damageMult = (itemCount / 88) * 3;

if(global.experimental) global.damageMult = (itemCount / 88) * 5;

//SAX

var etankCount = 0;
Expand Down

0 comments on commit cedb84e

Please sign in to comment.