Saving progress, mostly done with client part of overhaul

Still need to finish up items and fix some bugs
pull/28/head
milesthenerd 6 years ago
parent 5b905970d9
commit 252b12ba87

@ -1030,23 +1030,6 @@
</ConfigOptions>
<filename>readme.txt</filename>
</datafile>
<datafile>
<name>mod settings.ini</name>
<exists>-1</exists>
<size>67</size>
<exportAction>2</exportAction>
<exportDir></exportDir>
<overwrite>0</overwrite>
<freeData>-1</freeData>
<removeEnd>0</removeEnd>
<store>0</store>
<ConfigOptions>
<Config name="Default">
<CopyToMask>9223372036854775807</CopyToMask>
</Config>
</ConfigOptions>
<filename>mod settings.ini</filename>
</datafile>
<datafile>
<name>dictionary.json</name>
<exists>-1</exists>
@ -6138,8 +6121,8 @@
<object>objects\oA3_Missiles_Glow</object>
</objects>
<objects name="Miles">
<object>objects\oNametag</object>
<object>objects\oClient</object>
<object>objects\oNametag</object>
<object>objects\oOptionsMod</object>
</objects>
</objects>

@ -220,7 +220,7 @@
<option_changeresolution>false</option_changeresolution>
<option_closeesc>true</option_closeesc>
<option_colordepth>0</option_colordepth>
<option_display_name>AM2R</option_display_name>
<option_display_name>AM2R Multitroid 1.2</option_display_name>
<option_displayerrors>True</option_displayerrors>
<option_ecma>0</option_ecma>
<option_facebook_app_display_name></option_facebook_app_display_name>
@ -362,7 +362,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</option_linux_display_name>
<option_linux_display_name>AM2R Multitroid 1.2</option_linux_display_name>
<option_linux_enable_steam>0</option_linux_enable_steam>
<option_linux_fullscreen>0</option_linux_fullscreen>
<option_linux_homepage>https://www.reddit.com/r/AM2R/</option_linux_homepage>

@ -29,7 +29,6 @@
strict_init("dictionary.json");
queenHealthResetQueued = false;
canSend = false;
showName = true;
metroidCountChanged = false;
itemChanged = false;
metdeadChanged = false;
@ -71,8 +70,17 @@ name = ini_read_string("ModSettings", "displayname", "name");
port = ini_read_real("ModSettings", "port", 64198);
reactorsequence = string_lower(ini_read_string("ModSettings", "reactorsequence", "synced"));
preferredcolor = string_lower(ini_read_string("ModSettings", "preferredcolor", "random"));
showName = string_lower(ini_read_string("ModSettings", "showname", "enabled"));
ini_close();
var nameLength = string_length(name);
if(nameLength &gt; 15){
name = string_copy(name, 1, 15);
ini_open(working_directory + "\mod settings.ini");
ini_write_string("ModSettings", "displayname", name);
ini_close();
}
socket = network_create_socket(type);
isConnected = network_connect(socket, ipaddress, port);
@ -106,6 +114,15 @@ switch(preferredcolor){
break;
}
switch(showName){
case "disabled":
showName = false;
break;
case "enabled":
showName = true;
break;
}
var size, type, alignment;
size = 1024;
type = buffer_grow;
@ -1162,6 +1179,16 @@ if(instance_exists(oCharacter) &amp;&amp; (oCharacter.state == oCharacter.SAVING
refill_heath_ammo();
}
//Sends event 309 to make sure all players can fight guardian
if(global.log[21] &gt; 0 &amp;&amp; global.event[309] == 0){
global.event[309] = 1;
}
if(global.event[309] == 1 &amp;&amp; global.log[21] &lt; 1){
global.log[21] = 2;
}
//End of guardian event check
if(time == 0 &amp;&amp; connected &amp;&amp; instance_exists(self)){ //why do i need an instance_exists(self) here to not crash???
if(ds_list_size(global.idList) &gt; 0){
checkListID = ds_list_create();
@ -2100,6 +2127,13 @@ switch(type_event){
if(receivedItem == 1 &amp;&amp; global.item[i] == 0){
global.item[i] = receivedItem;
global.itemPrev[i] = global.item[i];
//ADD POWERUP ACTIVATIONS HERE FOR WHEN ITEMS ARE JUST RECEIVED
if(i == 0){
global.bomb = 1;
global.bombPrev = global.bomb;
popup_text("Bombs enabled");
}
} else if(receivedItem == 0 &amp;&amp; global.item[i] == 1){
resend = true;
}
@ -2179,6 +2213,216 @@ switch(type_event){
buffer_delete(itemBuffer);
}
break;
case 51:
var resend = false;
for(var i=0; i&lt;array_length_1d(global.event); i++){
var receivedEvent = buffer_read(_buffer, buffer_u8);
if(receivedEvent &gt; global.event[i]){
global.event[i] = receivedEvent;
global.eventPrev[i] = global.event[i];
} else if(receivedEvent &lt; global.event[i]){
resend = true;
}
}
if(resend){
var size, type, alignment;
size = 1024;
type = buffer_grow;
alignment = 1;
eventBuffer = buffer_create(size, type, alignment);
buffer_seek(eventBuffer, buffer_seek_start, 0);
buffer_write(eventBuffer, buffer_u8, 51);
for(var i=0; i&lt;array_length_1d(global.event); i++){
buffer_write(eventBuffer, buffer_u8, global.event[i]);
}
network_send_packet(socket, eventBuffer, buffer_tell(eventBuffer));
buffer_delete(eventBuffer);
}
break;
case 52:
var resend = false;
for(var i=0; i&lt;array_length_1d(global.metdead); i++){
var receivedMetdead = buffer_read(_buffer, buffer_u8);
if(receivedMetdead == 1 &amp;&amp; global.metdead[i] == 0){
global.metdead[i] = receivedMetdead;
global.metdeadPrev[i] = global.metdead[i];
} else if(receivedMetdead == 0 &amp;&amp; global.metdead[i] == 1){
resend = true;
}
}
if(global.gamemode == 1){
var countArea = 0;
var countLeft = 0;
for(var i=0; i&lt;array_length_1d(global.metdead); i++){
if(i &lt;= 45){
if(global.metdead[i] == 0){
countLeft++;
}
if(global.lavastate &gt;= 0 &amp;&amp; global.metdead[i] == 0 &amp;&amp; i == 0){
countArea++;
}
if(global.lavastate &gt;= 1 &amp;&amp; global.metdead[i] == 0 &amp;&amp; (i == 1 || i == 2 || i == 3 || i == 4)){
countArea++;
}
if(global.lavastate &gt;= 2 &amp;&amp; global.metdead[i] == 0 &amp;&amp; (i == 5 || i == 6 || i == 7 || i == 8 || i == 9 || i == 10 || i == 11 || i == 12)){
countArea++;
}
if(global.lavastate &gt;= 3 &amp;&amp; global.metdead[i] == 0 &amp;&amp; (i == 13 || i == 14 || i == 15 || i == 16 || i == 17 || i == 18 || i == 19 || i == 20 || i == 21 || i == 22)){
countArea++;
}
if(global.lavastate &gt;= 4 &amp;&amp; global.metdead[i] == 0 &amp;&amp; (i == 23 || i == 24)){
countArea++;
}
if(global.lavastate &gt;= 5 &amp;&amp; global.metdead[i] == 0 &amp;&amp; (i == 25 || i == 26)){
countArea++;
}
if(global.lavastate &gt;= 6 &amp;&amp; global.metdead[i] == 0 &amp;&amp; (i == 27 || i == 28 || i == 29 || i == 30 || i == 31 || i == 32)){
countArea++;
}
if(global.lavastate &gt;= 7 &amp;&amp; global.metdead[i] == 0 &amp;&amp; (i == 33 || i == 34 || i == 35 || i == 36 || i == 37 || i == 38 || i == 39 || i == 40)){
countArea++;
}
if(global.lavastate &gt;= 8 &amp;&amp; global.metdead[i] == 0 &amp;&amp; i == 41){
countArea++;
}
if(global.lavastate &gt;= 9 &amp;&amp; global.metdead[i] == 0 &amp;&amp; i == 42){
countArea++;
}
if(global.lavastate &gt;= 10 &amp;&amp; global.metdead[i] == 0 &amp;&amp; (i == 43 || i == 44 || i == 45)){
countArea++;
}
}
}
if(global.lavastate &lt; 11){
if(global.event[303] == 0){
countLeft++;
}
if(global.monstersleft != countLeft){
global.monstersleft = countLeft;
}
if(global.monstersarea != countArea){
global.monstersarea = countArea;
}
}
} else if(global.gamemode &gt; 1){
var countArea = 0;
var countLeft = 0;
for(var i=0; i&lt;array_length_1d(global.metdead); i++){
if(i &lt;= 45){
if(global.metdead[i] == 0){
countLeft++;
}
if(global.metdead[i] == 0 &amp;&amp; i != 11 &amp;&amp; i != 23 &amp;&amp; i != 24 &amp;&amp; i != 41 &amp;&amp; i != 42 &amp;&amp; i != 43 &amp;&amp; i != 44 &amp;&amp; i != 45){
countArea++;
}
if(global.metdead[i] == 0 &amp;&amp; global.event[109] == 1 &amp;&amp; i == 11){
countArea++;
}
if(global.metdead[i] == 0 &amp;&amp; global.event[171] == 1 &amp;&amp; (i == 23 || i == 24)){
countArea++;
}
if(global.lavastate &gt;= 8 &amp;&amp; global.metdead[i] == 0 &amp;&amp; i == 41){
countArea++;
}
if(global.lavastate &gt;= 9 &amp;&amp; global.metdead[i] == 0 &amp;&amp; i == 42){
countArea++;
}
if(global.lavastate &gt;= 10 &amp;&amp; global.metdead[i] == 0 &amp;&amp; (i == 43 || i == 44 || i == 45)){
countArea++;
}
}
}
if(global.lavastate &lt; 11){
if(global.event[303] == 0){
countLeft++;
}
if(global.monstersleft != countLeft){
global.monstersleft = countLeft;
}
if(global.monstersarea != countArea){
global.monstersarea = countArea;
}
}
}
if(resend){
var size, type, alignment;
size = 1024;
type = buffer_grow;
alignment = 1;
metdeadBuffer = buffer_create(size, type, alignment);
buffer_seek(metdeadBuffer, buffer_seek_start, 0);
buffer_write(metdeadBuffer, buffer_u8, 52);
for(var i=0; i&lt;array_length_1d(global.metdead); i++){
buffer_write(metdeadBuffer, buffer_u8, global.metdead[i]);
}
network_send_packet(socket, metdeadBuffer, buffer_tell(metdeadBuffer));
buffer_delete(metdeadBuffer);
}
break;
case 53:
var part = buffer_read(_buffer, buffer_u8);
var resend = false;
for(var i=0; i&lt;array_height_2d(global.dmap); i++){
for(var j=0; j&lt;array_length_2d(global.dmap, i); j++){
if((part == 1 &amp;&amp; i &lt; 20) || (part == 2 &amp;&amp; i &gt;= 20 &amp;&amp; i &lt; 40) || (part == 3 &amp;&amp; i &gt;= 40 &amp;&amp; i &lt; 60) || (part == 4 &amp;&amp; i &gt;= 60 &amp;&amp; i &lt; 80)){
var receiveddmap = buffer_read(_buffer, buffer_u8);
if(receiveddmap &gt; global.dmap[i, j]){
global.dmap[i, j] = receiveddmap;
global.dmapPrev[i, j] = global.dmap[i, j];
} else if(receiveddmap &lt; global.dmap[i, j]){
resend = true;
}
}
}
}
if(resend){
var size, type, alignment;
size = 1024;
type = buffer_grow;
alignment = 1;
dmapBuffer = buffer_create(size, type, alignment);
buffer_seek(dmapBuffer, buffer_seek_start, 0);
buffer_write(dmapBuffer, buffer_u8, 53);
for(var i=0; i&lt;array_height_2d(global.dmap); i++){
for(var j=0; j&lt;array_length_2d(global.dmap, i); j++){
buffer_write(dmapBuffer, buffer_u8, global.dmap[i, j]);
}
}
network_send_packet(socket, dmapBuffer, buffer_tell(dmapBuffer));
buffer_delete(dmapBuffer);
}
if(global.ingame){
with (oControl) event_user(2);
}
break;
}
}
</string>

File diff suppressed because one or more lines are too long

@ -37,13 +37,17 @@ num_port = tempnumcounter++;
num_name = tempnumcounter++;
num_sequence = tempnumcounter++;
num_color = tempnumcounter++;
num_showname = tempnumcounter++;
num_connection = tempnumcounter++;
lastitem = tempnumcounter; // This value will be one number higher than the last number in the list above.
ip = oControl.ipaddress;
name = oControl.name;
port = string(oControl.port);
showname = 1;
sequence = 1;
connectiontxt = "Connect";
if(instance_exists(oClient)){
@ -61,6 +65,15 @@ switch(oControl.reactorsequence){
break;
}
switch(oControl.showname){
case "enabled":
showname = 1;
break;
case "disabled":
showname = 0;
break;
}
vTargetY = 18 * lastitem + 30;
editing = 0;
@ -87,6 +100,7 @@ tip[num_port] = "Set the port of the server";
tip[num_name] = "Set your display name";
tip[num_sequence] = "Toggle whether the reactor sequence is synced";
tip[num_color] = "Pick your preferred player color";
tip[num_showname] = "Enable/disable showing player names";
tip[num_connection] = "Connect/disconnect to the server";
@ -245,6 +259,7 @@ if (active) {
if (oControl.kLeft &gt; 0 &amp;&amp; oControl.kLeftPushedSteps == 0 || oControl.kRight &gt; 0 &amp;&amp; oControl.kRightPushedSteps == 0 &amp;&amp; global.curropt &lt; lastitem &amp;&amp; oControl.kDown == 0 &amp;&amp; oControl.kUp == 0) {
if (global.curropt == num_sequence) sequence = !sequence;
if (global.curropt == num_showname) showname = !showname;
//if (global.shaders_compiled) {
//if (global.curropt == num_MSRfusion) oControl.msr_fusionsuit = !oControl.msr_fusionsuit;
//}
@ -307,6 +322,17 @@ if (active) {
event_user(2);
} // if (oControl.kMenu1 &amp;&amp; oControl.kMenu1PushedSteps == 0)
/*
if (oControl.kMenu2 &amp;&amp; oControl.kMenu1PushedSteps == 0) {
if(instance_exists(oSS_Control)){
if(editing){
editing = !editing;
}
instance_destroy();
}
}
*/
if(editing &amp;&amp; global.curropt == num_ip){
ip = keyboard_string;
op[num_ip].optext = ip;
@ -318,6 +344,10 @@ if (active) {
}
if(editing &amp;&amp; global.curropt == num_name){
var keyboardLength = string_length(keyboard_string);
if(keyboardLength &gt; 15){
keyboard_string = string_copy(keyboard_string, 1, 15);
}
name = keyboard_string;
op[num_name].optext = name;
}
@ -326,6 +356,14 @@ if (active) {
if (targety != y) y += (targety - y) / 10;
timer -= 1;
if (timer &lt; 0) timer = 8;
if(instance_exists(oClient)){
connectiontxt = "Disconnect";
op[num_connection].label = connectiontxt;
} else {
connectiontxt = "Connect";
op[num_connection].label = connectiontxt;
}
</string>
</argument>
</arguments>
@ -350,6 +388,7 @@ if (timer &lt; 0) timer = 8;
<kind>1</kind>
<string>var color = "random";
var _sequence = "synced";
var _showname = "enabled";
op[num_ip].optext = ip;
op[num_port].optext = port;
@ -388,9 +427,22 @@ switch(oControl.preferredcolor){
switch(sequence){
case 0:
op[num_sequence].optext = "disabled";
oControl.reactorsequence = "disabled";
break;
case 1:
op[num_sequence].optext = "synced";
oControl.reactorsequence = "synced";
break;
}
switch(showname){
case 0:
op[num_showname].optext = "disabled";
oControl.showname = "disabled";
break;
case 1:
op[num_showname].optext = "enabled";
oControl.showname = "enabled";
break;
}
@ -462,13 +514,27 @@ switch(sequence){
break;
}
switch(showname){
case 0:
_showname = "disabled";
break;
case 1:
_showname = "enabled";
break;
}
ini_open(working_directory + "\mod settings.ini");
ini_write_string("ModSettings", "ipaddress", ip);
ini_write_real("ModSettings", "port", real(port));
ini_write_string("ModSettings", "displayname", name);
ini_write_string("ModSettings", "reactorsequence", _sequence);
ini_write_string("ModSettings", "preferredcolor", color);
ini_write_string("ModSettings", "showname", _showname);
ini_close();
oControl.ipaddress = ip;
oControl.name = name;
oControl.port = real(port);
</string>
</argument>
</arguments>
@ -555,6 +621,10 @@ op[num_color] = instance_create(x, y + sep * tempcount++, oOptionLR);
op[num_color].label = "Preferred color";
op[num_color].optionid = num_color;
op[num_showname] = instance_create(x, y + sep * tempcount++, oOptionLR);
op[num_showname].label = "Show names";
op[num_showname].optionid = num_showname;
op[num_connection] = instance_create(x, y + sep * tempcount++, oPauseOption);
op[num_connection].optionid = num_connection;
op[num_connection].label = connectiontxt;

@ -128,6 +128,7 @@ widescreen_space = oControl.widescreen_space;
with (oOptionsQuit) active = 0;
with (oOptionsReload) active = 0;
with (oOptionsExtras) active = 0; // 1.5.1 fix NOT QUITE
with (oOptionsMod) active = 0;
}
if (global.ssmode == 2) with (oLogScreenControl) active = 0;
if (global.ssmode == 1) with (oSubscreenMenu) active = 0;
@ -219,6 +220,7 @@ with (oOptionsJoypad) instance_destroy();
with (oOptionsQuit) instance_destroy();
with (oOptionsReload) instance_destroy();
with (oOptionsExtras) instance_destroy();
with (oOptionsMod) instance_destroy();
</string>
</argument>
</arguments>

@ -174,6 +174,7 @@ if (global.ssmode == 3) {
with (oOptionsQuit) active = 0;
with (oOptionsReload) active = 0;
with (oOptionsExtras) active = 0; // 1.5.1 fix
with (oOptionsMod) active = 0;
}
if (global.ssmode == 2) with (oLogScreenControl) active = 0;
if (global.ssmode == 1) with (oSubscreenMenu) active = 0;

Loading…
Cancel
Save