You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
402 lines
12 KiB
402 lines
12 KiB
<!--This Document is generated by GameMaker, if you edit it by hand then you do so at your own risk!-->
|
|
<object>
|
|
<spriteName><undefined></spriteName>
|
|
<solid>0</solid>
|
|
<visible>0</visible>
|
|
<depth>0</depth>
|
|
<persistent>-1</persistent>
|
|
<parentName><undefined></parentName>
|
|
<maskName><undefined></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>network_set_config(network_config_connect_timeout, 5000);
|
|
strict_init("dictionary.json");
|
|
canSend = false;
|
|
connected = false;
|
|
alarm[1] = 300;
|
|
var type;
|
|
type = network_socket_tcp;
|
|
var file = file_text_open_read(working_directory + "\ipaddress.txt");
|
|
ipaddress = file_text_read_string(file);
|
|
file_text_close(file);
|
|
port = 64198;
|
|
socket = network_create_socket(type);
|
|
isConnected = network_connect(socket, ipaddress, port);
|
|
|
|
var size, type, alignment;
|
|
size = 1024;
|
|
type = buffer_grow;
|
|
alignment = 1;
|
|
buffer = buffer_create(size, type, alignment);
|
|
|
|
global.itemlist[0] = 0;
|
|
for(i=0; i<350; i++){
|
|
global.itemlist[i] = i;
|
|
}
|
|
|
|
global.clientID = 0;
|
|
global.packetID = 0;
|
|
global.receivedPacketID = 0;
|
|
global.onlineList = ds_grid_create(3, 34);
|
|
global.onlineSend = ds_grid_create(3, 34);
|
|
global.onlineResend = ds_grid_create(3, 34);
|
|
global.storedBuffers = ds_grid_create(2, 1);
|
|
global.receivedPacketIDs = ds_list_create();
|
|
ds_grid_clear(global.onlineSend, -1);
|
|
ds_grid_clear(global.onlineResend, -1);
|
|
for(var i=0; i<ds_grid_height(global.onlineList); i++){
|
|
ds_grid_set(global.onlineList, 2, i, i);
|
|
}
|
|
|
|
update_variables("initprev");
|
|
|
|
update_variables("onlinevars");
|
|
|
|
alarm[0] = 5;
|
|
</string>
|
|
</argument>
|
|
</arguments>
|
|
</action>
|
|
</event>
|
|
<event eventtype="1" 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>network_destroy(socket);
|
|
buffer_delete(buffer);
|
|
ds_grid_destroy(global.onlineList);
|
|
ds_grid_destroy(global.onlineSend);
|
|
ds_grid_destroy(global.onlineResend);
|
|
ds_grid_destroy(global.storedBuffers);
|
|
ds_list_destroy(global.receivedPacketIDs);
|
|
if(connected){
|
|
popup_text("Disconnected");
|
|
}
|
|
</string>
|
|
</argument>
|
|
</arguments>
|
|
</action>
|
|
</event>
|
|
<event eventtype="2" enumb="1">
|
|
<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(isConnected < 0){
|
|
isConnected = network_connect(socket, ipaddress, port);
|
|
}
|
|
alarm[1] = 300;
|
|
*/
|
|
</string>
|
|
</argument>
|
|
</arguments>
|
|
</action>
|
|
</event>
|
|
<event eventtype="2" 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>
|
|
update_variables("onlinevars");
|
|
|
|
for(var i=0; i<ds_grid_height(global.onlineList); i++){
|
|
if(global.onlineList[# 0, i] != global.onlineList[# 1, i] && i != 0 && i != 1 && i != 3){
|
|
global.onlineSend[# 0, i] = global.onlineList[# 0, i];
|
|
global.onlineSend[# 1, i] = global.onlineList[# 1, i];
|
|
global.onlineSend[# 2, i] = global.onlineList[# 2, i];
|
|
canSend = true;
|
|
alarm[0] = 600;
|
|
}
|
|
|
|
if(i == 0){
|
|
var v = 0;
|
|
var itemPrev = global.onlineList[# 0, 0]
|
|
var item = global.onlineList[# 1, 0]
|
|
for(var f=0; f<array_length_1d(item); f++){
|
|
if(itemPrev[f] != item[f]){
|
|
global.itemChanges[v, 0] = global.item[f];
|
|
global.itemChanges[v, 1] = f;
|
|
global.onlineSend[# 1, 0] = global.itemChanges;
|
|
global.onlineSend[# 2, 0] = global.onlineList[# 2, 0];
|
|
show_debug_message(string(global.itemPrev[f]) + " " + string(global.item[f]));
|
|
show_debug_message("item changed");
|
|
canSend = true;
|
|
v++;
|
|
|
|
}
|
|
}
|
|
}
|
|
|
|
if(i == 1){
|
|
var v = 0;
|
|
var metdeadPrev = global.onlineList[# 0, 1]
|
|
var metdead = global.onlineList[# 1, 1]
|
|
for(var f=0; f<array_length_1d(metdead); f++){
|
|
if(metdeadPrev[f] != metdead[f]){
|
|
global.metdeadChanges[v, 0] = global.metdead[f];
|
|
global.metdeadChanges[v, 1] = f;
|
|
global.onlineSend[# 1, 1] = global.metdeadChanges;
|
|
global.onlineSend[# 2, 1] = global.onlineList[# 2, 1];
|
|
show_debug_message(string(global.metdeadPrev[f]) + " " + string(global.metdead[f]));
|
|
show_debug_message("metdead changed");
|
|
canSend = true;
|
|
v++;
|
|
|
|
}
|
|
}
|
|
}
|
|
|
|
if(i == 3){
|
|
var v = 0;
|
|
var eventPrev = global.onlineList[# 0, 3]
|
|
var event = global.onlineList[# 1, 3]
|
|
for(var f=0; f<array_length_1d(event); f++){
|
|
if(eventPrev[f] != event[f]){
|
|
global.eventChanges[v, 0] = global.event[f];
|
|
global.eventChanges[v, 1] = f;
|
|
global.onlineSend[# 1, 3] = global.eventChanges;
|
|
global.onlineSend[# 2, 3] = global.onlineList[# 2, 3];
|
|
show_debug_message(string(global.eventPrev[f]) + " " + string(global.event[f]));
|
|
show_debug_message("event changed");
|
|
canSend = true;
|
|
v++;
|
|
|
|
}
|
|
}
|
|
}
|
|
|
|
}
|
|
|
|
if(canSend){
|
|
show_debug_message("missiles");
|
|
show_debug_message(string(global.missilesPrev) + " " + string(global.missiles));
|
|
buffer_delete(buffer);
|
|
var size, type, alignment;
|
|
size = 1024;
|
|
type = buffer_grow;
|
|
alignment = 1;
|
|
buffer = buffer_create(size, type, alignment);
|
|
buffer_seek(buffer, buffer_seek_start, 0);
|
|
buffer_write(buffer, buffer_u8, 0);
|
|
buffer_write(buffer, buffer_string, strict_compress(ds_grid_write(global.onlineSend)));
|
|
buffer_write(buffer, buffer_u8, global.clientID);
|
|
buffer_write(buffer, buffer_u32, global.packetID);
|
|
global.storedBuffers[# 0, global.packetID] = global.onlineSend;
|
|
global.storedBuffers[# 1, global.packetID] = global.clientID;
|
|
show_debug_message("packetID = " + string(global.packetID));
|
|
var result = network_send_packet(socket, buffer, buffer_tell(buffer));
|
|
canSend = false;
|
|
global.packetID++;
|
|
ds_grid_resize(global.storedBuffers, 2, global.packetID + 1);
|
|
}
|
|
|
|
if(!canSend){
|
|
alarm[0] = 30;
|
|
}
|
|
|
|
check_areaclear();
|
|
</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(!connected){
|
|
if(isConnected >= 0){
|
|
connected = true;
|
|
popup_text("Connected");
|
|
} else {
|
|
instance_destroy();
|
|
popup_text("Failed to connect");
|
|
}
|
|
}
|
|
|
|
if(keyboard_check_pressed(vk_f2)){
|
|
instance_destroy();
|
|
}
|
|
|
|
/*
|
|
if(keyboard_check_pressed(vk_f3)){
|
|
var f = 0;
|
|
repeat(41){
|
|
global.metdead[f] = 1;
|
|
f++;
|
|
}
|
|
}
|
|
*/
|
|
</string>
|
|
</argument>
|
|
</arguments>
|
|
</action>
|
|
</event>
|
|
<event eventtype="7" enumb="68">
|
|
<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>
|
|
var type_event = ds_map_find_value(async_load, "type");
|
|
|
|
switch(type_event){
|
|
case network_type_data:
|
|
var _buffer = ds_map_find_value(async_load, "buffer");
|
|
show_debug_message(buffer_get_size(_buffer));
|
|
buffer_seek(_buffer, buffer_seek_start, 0);
|
|
msgid = buffer_read(_buffer, buffer_u8);
|
|
switch(msgid){
|
|
case 0:
|
|
global.clientID = buffer_read(_buffer, buffer_u8);
|
|
break;
|
|
case 1:
|
|
ds_grid_read(global.onlineSend, strict_decompress(buffer_read(_buffer, buffer_string)));
|
|
global.receivedClientID = buffer_read(_buffer, buffer_u8);
|
|
if(global.receivedClientID == global.clientID){
|
|
global.receivedPacketIDs[| ds_list_size(global.receivedPacketIDs)] = buffer_read(_buffer, buffer_u32);
|
|
}
|
|
update_variables("disablesame");
|
|
update_variables("replaceglobalvars");
|
|
update_variables("updateprev");
|
|
update_variables("resendpacket");
|
|
global.itemChanges = 0;
|
|
global.metdeadChanges = 0;
|
|
global.eventChanges = 0;
|
|
alarm[0] = 30;
|
|
ds_grid_clear(global.onlineSend, -1);
|
|
show_debug_message(string(global.receivedClientID));
|
|
break;
|
|
}
|
|
}
|
|
|
|
|
|
</string>
|
|
</argument>
|
|
</arguments>
|
|
</action>
|
|
</event>
|
|
<event eventtype="7" enumb="3">
|
|
<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>network_destroy(socket);
|
|
buffer_delete(buffer);
|
|
ds_grid_destroy(global.onlineList);
|
|
ds_grid_destroy(global.onlineSend);
|
|
ds_grid_destroy(global.onlineResend);
|
|
ds_grid_destroy(global.storedBuffers);
|
|
ds_list_destroy(global.receivedPacketIDs);
|
|
</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>
|