Skip to content

Commit

Permalink
add proper locals to mw
Browse files Browse the repository at this point in the history
  • Loading branch information
Miepee committed Jun 10, 2024
1 parent 8844b91 commit 72eb34e
Showing 1 changed file with 1 addition and 19 deletions.
20 changes: 1 addition & 19 deletions YAMS-LIB/patches/Multiworld.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ namespace YAMS_LIB.patches;

public class Multiworld
{
// TODO: add locals here correctly.
public static void Apply(UndertaleData gmData, GlobalDecompileContext decompileContext, SeedObject seedObject)
{
var characterVarsCode = gmData.Code.ByName("gml_Script_load_character_vars");
Expand Down Expand Up @@ -219,16 +218,7 @@ public static void Apply(UndertaleData gmData, GlobalDecompileContext decompileC
""");

// Received network packet event.
var oControlNetworkReceived = new UndertaleCode() { Name = gmData.Strings.MakeString("gml_Object_oControl_Other_68") };
UndertaleCodeLocals locals = new UndertaleCodeLocals();
locals.Name = oControlNetworkReceived.Name;
UndertaleCodeLocals.LocalVar argsLocal = new UndertaleCodeLocals.LocalVar();
argsLocal.Name = gmData.Strings.MakeString("arguments");
argsLocal.Index = 0;
locals.Locals.Add(argsLocal);
oControlNetworkReceived.LocalsCount = 1;
gmData.CodeLocals.Add(locals);
oControlNetworkReceived.SubstituteGMLCode($$"""
gmData.Code.AddCodeEntry("gml_Object_oControl_Other_68",$$"""
mw_debug("Async Networking event entered")
var type_event, _buffer, bufferSize, msgid, handshake, socket, malformed, protocolVer, length, currentPos, i, upperLimit;
type_event = ds_map_find_value(async_load, "type")
Expand Down Expand Up @@ -513,13 +503,5 @@ public static void Apply(UndertaleData gmData, GlobalDecompileContext decompileC
}
mw_debug("Leaving async networking event")
""");
gmData.Code.Add(oControlNetworkReceived);
var oControlCollisionList = gmData.GameObjects.ByName("oControl").Events[7];
var oControlAction = new UndertaleGameObject.EventAction();
oControlAction.CodeId = oControlNetworkReceived;
var oControlEvent = new UndertaleGameObject.Event();
oControlEvent.EventSubtype = 68;
oControlEvent.Actions.Add(oControlAction);
oControlCollisionList.Add(oControlEvent);
}
}

0 comments on commit 72eb34e

Please sign in to comment.