From abb1a676d34fae1b1f51e5c47bcb4663d1245eb3 Mon Sep 17 00:00:00 2001 From: Babit Date: Thu, 18 Jun 2026 18:32:30 +0200 Subject: [PATCH 01/13] Add bp_setzoom and make execute_pattern public --- RNSReloaded.Interfaces/IBattlePatterns.cs | 4 ++++ RNSReloaded/BattlePatterns.cs | 13 +++++++++---- RNSReloaded/ModConfig.json | 2 +- 3 files changed, 14 insertions(+), 5 deletions(-) diff --git a/RNSReloaded.Interfaces/IBattlePatterns.cs b/RNSReloaded.Interfaces/IBattlePatterns.cs index 1d047e0..d0c7946 100644 --- a/RNSReloaded.Interfaces/IBattlePatterns.cs +++ b/RNSReloaded.Interfaces/IBattlePatterns.cs @@ -109,6 +109,8 @@ public void displaynumbers( public void enrage_deco(CInstance* self, CInstance* other, int? warningDelay = null, int? spawnDelay = null); + public void execute_pattern(CInstance* self, CInstance* other, string pattern, RValue[] args); + // (x, y) refers to the center of the field. Element is which color (purple, yellow, red, blue) public void fieldlimit_rectangle( CInstance* self, CInstance* other, Position? position = null, int? width = null, int? height = null, int? color = null, int? targetMask = null @@ -243,6 +245,8 @@ public void prsline_v( public void setgamespeed(CInstance* self, CInstance* other, int? spawnDelay = null, double? timeMult = null); + public void setzoom(CInstance* self, CInstance* other, double? zoom = null); + public void showgroups( CInstance* self, CInstance* other, int? spawnDelay = null, int? eraseDelay = null, (int, int, int, int)? groupMasks = null ); diff --git a/RNSReloaded/BattlePatterns.cs b/RNSReloaded/BattlePatterns.cs index 6a35b31..1b16879 100644 --- a/RNSReloaded/BattlePatterns.cs +++ b/RNSReloaded/BattlePatterns.cs @@ -59,7 +59,7 @@ void set_pattern_position_rotations(CInstance* self, CInstance* other, PosRot[] this.rnsReloaded.ExecuteScript("bpatt_posrot", self, other, args); } - void execute_pattern(CInstance* self, CInstance* other, string pattern, RValue[] args) { + public void execute_pattern(CInstance* self, CInstance* other, string pattern, RValue[] args) { this.rnsReloaded.ExecuteScript("bpatt_var", self, other, args); args = [new RValue(this.rnsReloaded.ScriptFindId(pattern))]; this.rnsReloaded.ExecuteScript("bpatt_add", self, other, args); @@ -1080,6 +1080,13 @@ public void setgamespeed(CInstance* self, CInstance* other, int? spawnDelay = nu this.execute_pattern(self, other, "bp_setgamespeed", args); } + public void setzoom(CInstance* self, CInstance* other, double? zoom = null) { + RValue[] args = []; + args = this.add_if_not_null(args, "scale", zoom); + + this.execute_pattern(self, other, "bp_setzoom", args); + } + public void showgroups( CInstance* self, CInstance* other, int? spawnDelay = null, int? eraseDelay = null, (int, int, int, int)? groupMasks = null ) { @@ -1093,7 +1100,6 @@ public void showgroups( args = args.Concat([this.utils.CreateString("orderBin_2")!.Value, new RValue(groupMasks.Value.Item3)]).ToArray(); args = args.Concat([this.utils.CreateString("orderBin_3")!.Value, new RValue(groupMasks.Value.Item4)]).ToArray(); } - this.execute_pattern(self, other, "bp_showgroups", args); } @@ -1113,7 +1119,6 @@ public void showorder( args = args.Concat([this.utils.CreateString("orderBin_3")!.Value, new RValue(orderMasks.Value.Item4)]).ToArray(); } - this.execute_pattern(self, other, "bp_showorder", args); } @@ -1268,7 +1273,7 @@ public void water2_line( if (position != null) { args = args.Concat([this.utils.CreateString("x")!.Value, new RValue(position.Value.x)]).ToArray(); args = args.Concat([this.utils.CreateString("y")!.Value, new RValue(position.Value.y)]).ToArray(); - } + } this.execute_pattern(self, other, "bp_water2_line", args); } diff --git a/RNSReloaded/ModConfig.json b/RNSReloaded/ModConfig.json index 750d8d4..f21f901 100644 --- a/RNSReloaded/ModConfig.json +++ b/RNSReloaded/ModConfig.json @@ -2,7 +2,7 @@ "ModId": "RNSReloaded", "ModName": "RNSReloaded", "ModAuthor": "NotNite", - "ModVersion": "1.1.22", + "ModVersion": "1.1.23", "ModDescription": "Helper library for Rabbit and Steel. Can be adapted to general GameMaker.", "ModDll": "RNSReloaded.dll", "ModIcon": "", From 9a9189bfdb866a26eff04ffcd63fcdc8e8c86d64 Mon Sep 17 00:00:00 2001 From: Babit Date: Thu, 18 Jun 2026 18:50:29 +0200 Subject: [PATCH 02/13] Move add_if_not_null to utils and make public --- RNSReloaded.Interfaces/Util.cs | 6 + RNSReloaded/BattlePatterns.cs | 739 ++++++++++++++++----------------- RNSReloaded/Util.cs | 20 + 3 files changed, 385 insertions(+), 380 deletions(-) diff --git a/RNSReloaded.Interfaces/Util.cs b/RNSReloaded.Interfaces/Util.cs index 3531e84..f608bdf 100644 --- a/RNSReloaded.Interfaces/Util.cs +++ b/RNSReloaded.Interfaces/Util.cs @@ -64,4 +64,10 @@ public unsafe interface IUtil { public void setHallway(List hallway, CInstance* self, IRNSReloaded rnsReloaded); + public RValue[] add_if_not_null(RValue[] args, string fieldName, int? value); + + public RValue[] add_if_not_null(RValue[] args, string fieldName, bool? value); + + public RValue[] add_if_not_null(RValue[] args, string fieldName, double? value); + } diff --git a/RNSReloaded/BattlePatterns.cs b/RNSReloaded/BattlePatterns.cs index 1b16879..44ba90a 100644 --- a/RNSReloaded/BattlePatterns.cs +++ b/RNSReloaded/BattlePatterns.cs @@ -66,27 +66,6 @@ public void execute_pattern(CInstance* self, CInstance* other, string pattern, R this.rnsReloaded.ExecuteScript("bpatt_var_reset", self, other, []); } - private RValue[] add_if_not_null(RValue[] args, string fieldName, int? value) { - if (value != null) { - return args.Concat([this.utils.CreateString(fieldName)!.Value, new RValue(value.Value)]).ToArray(); - } - return args; - } - - private RValue[] add_if_not_null(RValue[] args, string fieldName, bool? value) { - if (value != null) { - return args.Concat([this.utils.CreateString(fieldName)!.Value, new RValue(value.Value)]).ToArray(); - } - return args; - } - - private RValue[] add_if_not_null(RValue[] args, string fieldName, double? value) { - if (value != null) { - return args.Concat([this.utils.CreateString(fieldName)!.Value, new RValue(value.Value)]).ToArray(); - } - return args; - } - public RValue? bpsw_circlespr_default(CInstance* self, CInstance* other, RValue scale) { return this.rnsReloaded.ExecuteScript("bpsw_circlespr_default", self, other, [scale]); } @@ -106,12 +85,12 @@ public void apply_hbs_synced( for (var i = 0; i < this.rnsReloaded.ArrayGetLength(hbsInfo)!.Value.Real; i++) { if (hbsInfo->Get(i)->Get(0)->ToString() == hbs) { RValue[] args = []; - args = this.add_if_not_null(args, "delay", delay); - args = this.add_if_not_null(args, "hbsHitDelay", hbsHitDelay); + args = this.utils.add_if_not_null(args, "delay", delay); + args = this.utils.add_if_not_null(args, "hbsHitDelay", hbsHitDelay); args = args.Concat([this.utils.CreateString("hbsIndex")!.Value, new RValue(i)]).ToArray(); - args = this.add_if_not_null(args, "hbsDuration", hbsDuration); - args = this.add_if_not_null(args, "hbsStrength", hbsStrength); - args = this.add_if_not_null(args, "trgBinary", targetMask); + args = this.utils.add_if_not_null(args, "hbsDuration", hbsDuration); + args = this.utils.add_if_not_null(args, "hbsStrength", hbsStrength); + args = this.utils.add_if_not_null(args, "trgBinary", targetMask); this.execute_pattern(self, other, "bp_apply_hbs_synced", args); break; @@ -123,10 +102,10 @@ public void bind_h( CInstance* self, CInstance* other, int? warningDelay = null, int? spawnDelay = null, int? eraseDelay = null, int? targetMask = null ) { RValue[] args = []; - args = this.add_if_not_null(args, "warningDelay", warningDelay); - args = this.add_if_not_null(args, "spawnDelay", spawnDelay); - args = this.add_if_not_null(args, "eraseDelay", eraseDelay); - args = this.add_if_not_null(args, "trgBinary", targetMask); + args = this.utils.add_if_not_null(args, "warningDelay", warningDelay); + args = this.utils.add_if_not_null(args, "spawnDelay", spawnDelay); + args = this.utils.add_if_not_null(args, "eraseDelay", eraseDelay); + args = this.utils.add_if_not_null(args, "trgBinary", targetMask); this.execute_pattern(self, other, "bp_bind_h", args); } @@ -135,22 +114,22 @@ public void bind_v( CInstance* self, CInstance* other, int? warningDelay = null, int? spawnDelay = null, int? eraseDelay = null, int? targetMask = null ) { RValue[] args = []; - args = this.add_if_not_null(args, "warningDelay", warningDelay); - args = this.add_if_not_null(args, "spawnDelay", spawnDelay); - args = this.add_if_not_null(args, "eraseDelay", eraseDelay); - args = this.add_if_not_null(args, "trgBinary", targetMask); + args = this.utils.add_if_not_null(args, "warningDelay", warningDelay); + args = this.utils.add_if_not_null(args, "spawnDelay", spawnDelay); + args = this.utils.add_if_not_null(args, "eraseDelay", eraseDelay); + args = this.utils.add_if_not_null(args, "trgBinary", targetMask); this.execute_pattern(self, other, "bp_bind_v", args); } public void bullet_enlarge(CInstance* self, CInstance* other, int? warningDelay = null, int? spawnDelay = null, int? timeBetween = null, double? scale = null, double? scaleInc = null, int? num = null, Position[]? positions = null) { RValue[] args = []; - args = this.add_if_not_null(args, "warningDelay", warningDelay); - args = this.add_if_not_null(args, "spawnDelay", spawnDelay); - args = this.add_if_not_null(args, "timeBetween", timeBetween); - args = this.add_if_not_null(args, "scale", scale); - args = this.add_if_not_null(args, "scaleInc", scaleInc); - args = this.add_if_not_null(args, "num", num); + args = this.utils.add_if_not_null(args, "warningDelay", warningDelay); + args = this.utils.add_if_not_null(args, "spawnDelay", spawnDelay); + args = this.utils.add_if_not_null(args, "timeBetween", timeBetween); + args = this.utils.add_if_not_null(args, "scale", scale); + args = this.utils.add_if_not_null(args, "scaleInc", scaleInc); + args = this.utils.add_if_not_null(args, "num", num); if (positions != null) { this.set_pattern_positions(self, other, positions); @@ -163,14 +142,14 @@ public void cardinal_r( CInstance* self, CInstance* other, int? warningDelay = null, int? warningDelay2 = null, int? displayNumber = null, int? spawnDelay = null, int? eraseDelay = null, Position? position = null, double? rot = null, int? speed = null, int? width = null ) { RValue[] args = []; - args = this.add_if_not_null(args, "warningDelay", warningDelay); - args = this.add_if_not_null(args, "warningDelay2", warningDelay2); - args = this.add_if_not_null(args, "spawnDelay", spawnDelay); - args = this.add_if_not_null(args, "eraseDelay", eraseDelay); - args = this.add_if_not_null(args, "displayNumber", displayNumber); - args = this.add_if_not_null(args, "rot", rot); - args = this.add_if_not_null(args, "spd", speed); - args = this.add_if_not_null(args, "width", width); + args = this.utils.add_if_not_null(args, "warningDelay", warningDelay); + args = this.utils.add_if_not_null(args, "warningDelay2", warningDelay2); + args = this.utils.add_if_not_null(args, "spawnDelay", spawnDelay); + args = this.utils.add_if_not_null(args, "eraseDelay", eraseDelay); + args = this.utils.add_if_not_null(args, "displayNumber", displayNumber); + args = this.utils.add_if_not_null(args, "rot", rot); + args = this.utils.add_if_not_null(args, "spd", speed); + args = this.utils.add_if_not_null(args, "width", width); if (position != null) { args = args.Concat([this.utils.CreateString("x")!.Value, new RValue(position.Value.x)]).ToArray(); @@ -184,9 +163,9 @@ public void circle_position( CInstance* self, CInstance* other, int? warningDelay = null, int? spawnDelay = null, int? radius = null, Position[]? positions = null ) { RValue[] args = []; - args = this.add_if_not_null(args, "warningDelay", warningDelay); - args = this.add_if_not_null(args, "spawnDelay", spawnDelay); - args = this.add_if_not_null(args, "radius", radius); + args = this.utils.add_if_not_null(args, "warningDelay", warningDelay); + args = this.utils.add_if_not_null(args, "spawnDelay", spawnDelay); + args = this.utils.add_if_not_null(args, "radius", radius); if (positions != null) { args = args.Concat([this.utils.CreateString("numPoints")!.Value, new RValue(positions.Length)]).ToArray(); @@ -206,11 +185,11 @@ public void circle_spreads( CInstance* self, CInstance* other, int? warningDelay = null, int? warnMsg = null, int? spawnDelay = null, int? radius = null, int? targetMask = null ) { RValue[] args = []; - args = this.add_if_not_null(args, "warningDelay", warningDelay); - args = this.add_if_not_null(args, "spawnDelay", spawnDelay); - args = this.add_if_not_null(args, "warnMsg", warnMsg); - args = this.add_if_not_null(args, "radius", radius); - args = this.add_if_not_null(args, "trgBinary", targetMask); + args = this.utils.add_if_not_null(args, "warningDelay", warningDelay); + args = this.utils.add_if_not_null(args, "spawnDelay", spawnDelay); + args = this.utils.add_if_not_null(args, "warnMsg", warnMsg); + args = this.utils.add_if_not_null(args, "radius", radius); + args = this.utils.add_if_not_null(args, "trgBinary", targetMask); this.execute_pattern(self, other, "bp_circle_spreads", args); } @@ -219,9 +198,9 @@ public void cleave( CInstance* self, CInstance* other, int? warningDelay = null, int? warnMsg = null, int? spawnDelay = null, (double rotation, int? targetMask)[]? cleaves = null ) { RValue[] args = []; - args = this.add_if_not_null(args, "warningDelay", warningDelay); - args = this.add_if_not_null(args, "spawnDelay", spawnDelay); - args = this.add_if_not_null(args, "warnMsg", warnMsg); + args = this.utils.add_if_not_null(args, "warningDelay", warningDelay); + args = this.utils.add_if_not_null(args, "spawnDelay", spawnDelay); + args = this.utils.add_if_not_null(args, "warnMsg", warnMsg); if (cleaves != null) { for (int i = 0; i < cleaves.Length; i++) { @@ -240,10 +219,10 @@ public void cleave_enemy( CInstance* self, CInstance* other, int? warningDelay = null, int? warnMsg = null, int? spawnDelay = null, int? angle = null ) { RValue[] args = []; - args = this.add_if_not_null(args, "warningDelay", warningDelay); - args = this.add_if_not_null(args, "spawnDelay", spawnDelay); - args = this.add_if_not_null(args, "warnMsg", warnMsg); - args = this.add_if_not_null(args, "rot", angle); + args = this.utils.add_if_not_null(args, "warningDelay", warningDelay); + args = this.utils.add_if_not_null(args, "spawnDelay", spawnDelay); + args = this.utils.add_if_not_null(args, "warnMsg", warnMsg); + args = this.utils.add_if_not_null(args, "rot", angle); this.execute_pattern(self, other, "bp_cleave_enemy", args); } @@ -252,9 +231,9 @@ public void cleave_fixed( CInstance* self, CInstance* other, int? warningDelay = null, int? warnMsg = null, int? spawnDelay = null, PosRot[]? positions = null ) { RValue[] args = []; - args = this.add_if_not_null(args, "warningDelay", warningDelay); - args = this.add_if_not_null(args, "spawnDelay", spawnDelay); - args = this.add_if_not_null(args, "warnMsg", warnMsg); + args = this.utils.add_if_not_null(args, "warningDelay", warningDelay); + args = this.utils.add_if_not_null(args, "spawnDelay", spawnDelay); + args = this.utils.add_if_not_null(args, "warnMsg", warnMsg); args = args.Concat([this.utils.CreateString("exTrgId")!.Value, new RValue(0)]).ToArray(); if (positions != null) { @@ -275,14 +254,14 @@ public void clockspot( CInstance* self, CInstance* other, int? warningDelay = null, int? warningDelay2 = null, int? warnMsg = null, int? displayNumber = null, int? spawnDelay = null, int? radius = null, int? fanAngle = null, Position? position = null, int? targetMask = null ) { RValue[] args = []; - args = this.add_if_not_null(args, "warningDelay", warningDelay); - args = this.add_if_not_null(args, "warningDelay2", warningDelay2); - args = this.add_if_not_null(args, "spawnDelay", spawnDelay); - args = this.add_if_not_null(args, "warnMsg", warnMsg); - args = this.add_if_not_null(args, "displayNumber", displayNumber); - args = this.add_if_not_null(args, "radius", radius); - args = this.add_if_not_null(args, "fanAngle", fanAngle); - args = this.add_if_not_null(args, "trgBinary", targetMask); + args = this.utils.add_if_not_null(args, "warningDelay", warningDelay); + args = this.utils.add_if_not_null(args, "warningDelay2", warningDelay2); + args = this.utils.add_if_not_null(args, "spawnDelay", spawnDelay); + args = this.utils.add_if_not_null(args, "warnMsg", warnMsg); + args = this.utils.add_if_not_null(args, "displayNumber", displayNumber); + args = this.utils.add_if_not_null(args, "radius", radius); + args = this.utils.add_if_not_null(args, "fanAngle", fanAngle); + args = this.utils.add_if_not_null(args, "trgBinary", targetMask); if (position != null) { args = args.Concat([this.utils.CreateString("x")!.Value, new RValue(position.Value.x)]).ToArray(); @@ -296,15 +275,15 @@ public void colormatch( CInstance* self, CInstance* other, int? warningDelay = null, int? warnMsg = null, int? spawnDelay = null, int? radius = null, int? targetMask = null, int? color = null, Position? position = null ) { RValue[] args = []; - args = this.add_if_not_null(args, "warningDelay", warningDelay); - args = this.add_if_not_null(args, "spawnDelay", spawnDelay); - args = this.add_if_not_null(args, "warnMsg", warnMsg); - args = this.add_if_not_null(args, "element", color); - args = this.add_if_not_null(args, "trgBinary", targetMask); - args = this.add_if_not_null(args, "radius", radius); + args = this.utils.add_if_not_null(args, "warningDelay", warningDelay); + args = this.utils.add_if_not_null(args, "spawnDelay", spawnDelay); + args = this.utils.add_if_not_null(args, "warnMsg", warnMsg); + args = this.utils.add_if_not_null(args, "element", color); + args = this.utils.add_if_not_null(args, "trgBinary", targetMask); + args = this.utils.add_if_not_null(args, "radius", radius); if (position != null) { - args = this.add_if_not_null(args, "hasFixed", true); + args = this.utils.add_if_not_null(args, "hasFixed", true); args = args.Concat([this.utils.CreateString("x")!.Value, new RValue(position.Value.x)]).ToArray(); args = args.Concat([this.utils.CreateString("y")!.Value, new RValue(position.Value.y)]).ToArray(); } @@ -316,19 +295,19 @@ public void colormatch2( CInstance* self, CInstance* other, int? warningDelay = null, int? warningDelay2 = null, int? warnMsg = null, int? spawnDelay = null, int? radius = null, int? targetMask = null, int? color = null, int? ringNum = null, int? displayNumber = null, Position? position = null ) { RValue[] args = []; - args = this.add_if_not_null(args, "warningDelay", warningDelay); - args = this.add_if_not_null(args, "warningDelay2", warningDelay2); - args = this.add_if_not_null(args, "warnMsg", warnMsg); - args = this.add_if_not_null(args, "spawnDelay", spawnDelay); + args = this.utils.add_if_not_null(args, "warningDelay", warningDelay); + args = this.utils.add_if_not_null(args, "warningDelay2", warningDelay2); + args = this.utils.add_if_not_null(args, "warnMsg", warnMsg); + args = this.utils.add_if_not_null(args, "spawnDelay", spawnDelay); - args = this.add_if_not_null(args, "element", color); + args = this.utils.add_if_not_null(args, "element", color); - args = this.add_if_not_null(args, "radius", radius); - args = this.add_if_not_null(args, "ringNum", ringNum); + args = this.utils.add_if_not_null(args, "radius", radius); + args = this.utils.add_if_not_null(args, "ringNum", ringNum); - args = this.add_if_not_null(args, "trgBinary", targetMask); + args = this.utils.add_if_not_null(args, "trgBinary", targetMask); - args = this.add_if_not_null(args, "displayNumber", displayNumber); + args = this.utils.add_if_not_null(args, "displayNumber", displayNumber); if (position != null) { args = args.Concat([this.utils.CreateString("x")!.Value, new RValue(position.Value.x)]).ToArray(); @@ -342,18 +321,18 @@ public void colormatch3( CInstance* self, CInstance* other, int? warningDelay = null, int? spawnDelay = null, int? timeBetween = null, int? timeExtra = null, int? color = null, int? radius = null, int? targetMask = null, Position[]? positions = null ) { RValue[] args = []; - args = this.add_if_not_null(args, "warningDelay", warningDelay); - args = this.add_if_not_null(args, "spawnDelay", spawnDelay); - args = this.add_if_not_null(args, "timeBetween", timeBetween); - args = this.add_if_not_null(args, "timeExtra", timeExtra); + args = this.utils.add_if_not_null(args, "warningDelay", warningDelay); + args = this.utils.add_if_not_null(args, "spawnDelay", spawnDelay); + args = this.utils.add_if_not_null(args, "timeBetween", timeBetween); + args = this.utils.add_if_not_null(args, "timeExtra", timeExtra); - args = this.add_if_not_null(args, "element", color); + args = this.utils.add_if_not_null(args, "element", color); - args = this.add_if_not_null(args, "radius", radius); - args = this.add_if_not_null(args, "trgBinary", targetMask); + args = this.utils.add_if_not_null(args, "radius", radius); + args = this.utils.add_if_not_null(args, "trgBinary", targetMask); if (positions != null) { - args = this.add_if_not_null(args, "numPoints", positions.Length); + args = this.utils.add_if_not_null(args, "numPoints", positions.Length); for (int i = 0; i < positions.Length; i++) { var position = positions[i]; args = args.Concat([this.utils.CreateString("posX_" + i)!.Value, new RValue(position.x)]).ToArray(); @@ -368,9 +347,9 @@ public void cone_direction( CInstance* self, CInstance* other, int? warningDelay = null, int? spawnDelay = null, int? fanAngle = null, Position? position = null, double[]? rots = null ) { RValue[] args = []; - args = this.add_if_not_null(args, "warningDelay", warningDelay); - args = this.add_if_not_null(args, "spawnDelay", spawnDelay); - args = this.add_if_not_null(args, "fanAngle", fanAngle); + args = this.utils.add_if_not_null(args, "warningDelay", warningDelay); + args = this.utils.add_if_not_null(args, "spawnDelay", spawnDelay); + args = this.utils.add_if_not_null(args, "fanAngle", fanAngle); if (position != null) { args = args.Concat([this.utils.CreateString("x")!.Value, new RValue(position.Value.x)]).ToArray(); @@ -394,11 +373,11 @@ public void cone_spreads( CInstance* self, CInstance* other, int? warningDelay = null, int? warnMsg = null, int? spawnDelay = null, int? fanAngle = null, Position? position = null, int? targetMask = null ) { RValue[] args = []; - args = this.add_if_not_null(args, "warningDelay", warningDelay); - args = this.add_if_not_null(args, "spawnDelay", spawnDelay); - args = this.add_if_not_null(args, "warnMsg", warnMsg); - args = this.add_if_not_null(args, "trgBinary", targetMask); - args = this.add_if_not_null(args, "fanAngle", fanAngle); + args = this.utils.add_if_not_null(args, "warningDelay", warningDelay); + args = this.utils.add_if_not_null(args, "spawnDelay", spawnDelay); + args = this.utils.add_if_not_null(args, "warnMsg", warnMsg); + args = this.utils.add_if_not_null(args, "trgBinary", targetMask); + args = this.utils.add_if_not_null(args, "fanAngle", fanAngle); if (position != null) { args = args.Concat([this.utils.CreateString("x")!.Value, new RValue(position.Value.x)]).ToArray(); @@ -412,9 +391,9 @@ public void dark2_cr_circle( CInstance* self, CInstance* other, int? spawnDelay = null, int? speed = null, int? angle = null, Position? position = null ) { RValue[] args = []; - args = this.add_if_not_null(args, "spawnDelay", spawnDelay); - args = this.add_if_not_null(args, "spd", speed); - args = this.add_if_not_null(args, "angle", angle); + args = this.utils.add_if_not_null(args, "spawnDelay", spawnDelay); + args = this.utils.add_if_not_null(args, "spd", speed); + args = this.utils.add_if_not_null(args, "angle", angle); if (position != null) { args = args.Concat([this.utils.CreateString("x")!.Value, new RValue(position.Value.x)]).ToArray(); @@ -429,10 +408,10 @@ public void dark_targeted( ) { RValue[] args = []; - args = this.add_if_not_null(args, "warningDelay", warningDelay); - args = this.add_if_not_null(args, "spawnDelay", spawnDelay); - args = this.add_if_not_null(args, "eraseDelay", eraseDelay); - args = this.add_if_not_null(args, "scale", scale); + args = this.utils.add_if_not_null(args, "warningDelay", warningDelay); + args = this.utils.add_if_not_null(args, "spawnDelay", spawnDelay); + args = this.utils.add_if_not_null(args, "eraseDelay", eraseDelay); + args = this.utils.add_if_not_null(args, "scale", scale); if (positions != null) { args = args.Concat([this.utils.CreateString("numPoints")!.Value, new RValue(positions.Length)]).ToArray(); @@ -450,8 +429,8 @@ public void dark_targeted( public void dialog(CInstance* self, CInstance* other, int? time, int? dialogIndex0) { RValue[] args = []; - args = this.add_if_not_null(args, "time", time); - args = this.add_if_not_null(args, "dialogInd0", dialogIndex0); + args = this.utils.add_if_not_null(args, "time", time); + args = this.utils.add_if_not_null(args, "dialogInd0", dialogIndex0); this.execute_pattern(self, other, "bp_dialog", args); } @@ -462,9 +441,9 @@ public void displaynumbers( ) { RValue[] args = []; - args = this.add_if_not_null(args, "warningDelay", warningDelay); - args = this.add_if_not_null(args, "spawnDelay", spawnDelay); - args = this.add_if_not_null(args, "displayNumber", displayNumber); + args = this.utils.add_if_not_null(args, "warningDelay", warningDelay); + args = this.utils.add_if_not_null(args, "spawnDelay", spawnDelay); + args = this.utils.add_if_not_null(args, "displayNumber", displayNumber); if (positions != null) { args = args.Concat([this.utils.CreateString("numPoints")!.Value, new RValue(positions.Length)]).ToArray(); @@ -481,9 +460,9 @@ public void displaynumbers( public void enrage(CInstance* self, CInstance* other, int? warningDelay = null, int? spawnDelay = null, int? timeBetween = null, bool? resetAnim = null) { RValue[] args = []; - args = this.add_if_not_null(args, "warningDelay", warningDelay); - args = this.add_if_not_null(args, "spawnDelay", spawnDelay); - args = this.add_if_not_null(args, "timeBetween", timeBetween); + args = this.utils.add_if_not_null(args, "warningDelay", warningDelay); + args = this.utils.add_if_not_null(args, "spawnDelay", spawnDelay); + args = this.utils.add_if_not_null(args, "timeBetween", timeBetween); if (resetAnim != null) { args = args.Concat([this.utils.CreateString("resetAnim")!.Value, new RValue(resetAnim == true ? 1.0 : 0.0)]).ToArray(); // Using a bool here doesnt work, no idea why @@ -494,8 +473,8 @@ public void enrage(CInstance* self, CInstance* other, int? warningDelay = null, public void enrage_deco(CInstance* self, CInstance* other, int? warningDelay = null, int? spawnDelay = null) { RValue[] args = []; - args = this.add_if_not_null(args, "warningDelay", warningDelay); - args = this.add_if_not_null(args, "spawnDelay", spawnDelay); + args = this.utils.add_if_not_null(args, "warningDelay", warningDelay); + args = this.utils.add_if_not_null(args, "spawnDelay", spawnDelay); this.execute_pattern(self, other, "bp_enrage_deco", args); } @@ -506,10 +485,10 @@ public void fieldlimit_rectangle( ) { RValue[] args = []; - args = this.add_if_not_null(args, "height", height); - args = this.add_if_not_null(args, "width", width); - args = this.add_if_not_null(args, "trgBinary", targetMask); - args = this.add_if_not_null(args, "element", color); + args = this.utils.add_if_not_null(args, "height", height); + args = this.utils.add_if_not_null(args, "width", width); + args = this.utils.add_if_not_null(args, "trgBinary", targetMask); + args = this.utils.add_if_not_null(args, "element", color); if (position != null) { args = args.Concat([this.utils.CreateString("x")!.Value, new RValue(position.Value.x)]).ToArray(); @@ -523,11 +502,11 @@ public void fieldlimit_rectangle_temporary( CInstance* self, CInstance* other, Position? position = null, int? width = null, int? height = null, int? color = null, int? targetMask = null, int? eraseDelay = null ) { RValue[] args = []; - args = this.add_if_not_null(args, "height", height); - args = this.add_if_not_null(args, "width", width); - args = this.add_if_not_null(args, "trgBinary", targetMask); - args = this.add_if_not_null(args, "element", color); - args = this.add_if_not_null(args, "eraseDelay", eraseDelay); + args = this.utils.add_if_not_null(args, "height", height); + args = this.utils.add_if_not_null(args, "width", width); + args = this.utils.add_if_not_null(args, "trgBinary", targetMask); + args = this.utils.add_if_not_null(args, "element", color); + args = this.utils.add_if_not_null(args, "eraseDelay", eraseDelay); if (position != null) { args = args.Concat([this.utils.CreateString("x")!.Value, new RValue(position.Value.x)]).ToArray(); @@ -541,10 +520,10 @@ public void fire_aoe( CInstance* self, CInstance* other, int? warningDelay = null, int? spawnDelay = null, int? eraseDelay = null, double? scale = null, Position[]? positions = null ) { RValue[] args = []; - args = this.add_if_not_null(args, "warningDelay", warningDelay); - args = this.add_if_not_null(args, "spawnDelay", spawnDelay); - args = this.add_if_not_null(args, "eraseDelay", eraseDelay); - args = this.add_if_not_null(args, "scale", scale); + args = this.utils.add_if_not_null(args, "warningDelay", warningDelay); + args = this.utils.add_if_not_null(args, "spawnDelay", spawnDelay); + args = this.utils.add_if_not_null(args, "eraseDelay", eraseDelay); + args = this.utils.add_if_not_null(args, "scale", scale); //this.utils.CreateString("type")!.Value, new RValue(type), if (positions != null) { @@ -575,14 +554,14 @@ public void fire2_line( int? lineLength = null, int? numBullets = null, int? spd = null ) { RValue[] args = []; - args = this.add_if_not_null(args, "warningDelay", warningDelay); - args = this.add_if_not_null(args, "spawnDelay", spawnDelay); - args = this.add_if_not_null(args, "showWarning", showWarning); - args = this.add_if_not_null(args, "angle", angle); - args = this.add_if_not_null(args, "lineAngle", lineAngle); - args = this.add_if_not_null(args, "num", numBullets); - args = this.add_if_not_null(args, "lineLength", lineLength); - args = this.add_if_not_null(args, "spd", spd); + args = this.utils.add_if_not_null(args, "warningDelay", warningDelay); + args = this.utils.add_if_not_null(args, "spawnDelay", spawnDelay); + args = this.utils.add_if_not_null(args, "showWarning", showWarning); + args = this.utils.add_if_not_null(args, "angle", angle); + args = this.utils.add_if_not_null(args, "lineAngle", lineAngle); + args = this.utils.add_if_not_null(args, "num", numBullets); + args = this.utils.add_if_not_null(args, "lineLength", lineLength); + args = this.utils.add_if_not_null(args, "spd", spd); if (position != null) { args = args.Concat([this.utils.CreateString("x")!.Value, new RValue(position.Value.x)]).ToArray(); @@ -596,7 +575,7 @@ public void gravity_fall( CInstance* self, CInstance* other, double? mult = null ) { RValue[] args = []; - args = this.add_if_not_null(args, "mult", mult); + args = this.utils.add_if_not_null(args, "mult", mult); this.execute_pattern(self, other, "bp_gravity_fall", args); } @@ -605,10 +584,10 @@ public void gravity_fall_temporary( CInstance* self, CInstance* other, int? spawnDelay = null, int? eraseDelay = null, double? mult = null, int? targetMask = null ) { RValue[] args = []; - args = this.add_if_not_null(args, "spawnDelay", spawnDelay); - args = this.add_if_not_null(args, "eraseDelay", eraseDelay); - args = this.add_if_not_null(args, "trgBinary", targetMask); - args = this.add_if_not_null(args, "mult", mult); + args = this.utils.add_if_not_null(args, "spawnDelay", spawnDelay); + args = this.utils.add_if_not_null(args, "eraseDelay", eraseDelay); + args = this.utils.add_if_not_null(args, "trgBinary", targetMask); + args = this.utils.add_if_not_null(args, "mult", mult); this.execute_pattern(self, other, "bp_gravity_fall_temporary", args); } @@ -617,7 +596,7 @@ public void gravity_pull( CInstance* self, CInstance* other, double? mult = null ) { RValue[] args = []; - args = this.add_if_not_null(args, "mult", mult); + args = this.utils.add_if_not_null(args, "mult", mult); this.execute_pattern(self, other, "bp_gravity_pull", args); } @@ -626,10 +605,10 @@ public void gravity_pull_temporary( CInstance* self, CInstance* other, int? spawnDelay = null, int? eraseDelay = null, double? mult = null, int? targetMask = null, Position? position = null ) { RValue[] args = []; - args = this.add_if_not_null(args, "spawnDelay", spawnDelay); - args = this.add_if_not_null(args, "eraseDelay", eraseDelay); - args = this.add_if_not_null(args, "trgBinary", targetMask); - args = this.add_if_not_null(args, "mult", mult); + args = this.utils.add_if_not_null(args, "spawnDelay", spawnDelay); + args = this.utils.add_if_not_null(args, "eraseDelay", eraseDelay); + args = this.utils.add_if_not_null(args, "trgBinary", targetMask); + args = this.utils.add_if_not_null(args, "mult", mult); if (position != null) { args = args.Concat([this.utils.CreateString("x")!.Value, new RValue(position.Value.x)]).ToArray(); @@ -643,7 +622,7 @@ public void heavy( CInstance* self, CInstance* other, int? targetMask = null ) { RValue[] args = []; - args = this.add_if_not_null(args, "trgBinary", targetMask); + args = this.utils.add_if_not_null(args, "trgBinary", targetMask); this.execute_pattern(self, other, "bp_heavy", args); } @@ -652,9 +631,9 @@ public void heavy_temporary( CInstance* self, CInstance* other, int? spawnDelay = null, int? hbsDuration = null, int? targetMask = null ) { RValue[] args = []; - args = this.add_if_not_null(args, "spawnDelay", spawnDelay); - args = this.add_if_not_null(args, "hbsDuration", hbsDuration); - args = this.add_if_not_null(args, "trgBinary", targetMask); + args = this.utils.add_if_not_null(args, "spawnDelay", spawnDelay); + args = this.utils.add_if_not_null(args, "hbsDuration", hbsDuration); + args = this.utils.add_if_not_null(args, "trgBinary", targetMask); this.execute_pattern(self, other, "bp_heavy_temporary", args); } @@ -663,7 +642,7 @@ public void heavyextra( CInstance* self, CInstance* other, int? targetMask = null ) { RValue[] args = []; - args = this.add_if_not_null(args, "trgBinary", targetMask); + args = this.utils.add_if_not_null(args, "trgBinary", targetMask); this.execute_pattern(self, other, "bp_heavyextra", args); } @@ -672,9 +651,9 @@ public void heavyextra_temporary( CInstance* self, CInstance* other, int? spawnDelay = null, int? hbsDuration = null, int? targetMask = null ) { RValue[] args = []; - args = this.add_if_not_null(args, "spawnDelay", spawnDelay); - args = this.add_if_not_null(args, "hbsDuration", hbsDuration); - args = this.add_if_not_null(args, "trgBinary", targetMask); + args = this.utils.add_if_not_null(args, "spawnDelay", spawnDelay); + args = this.utils.add_if_not_null(args, "hbsDuration", hbsDuration); + args = this.utils.add_if_not_null(args, "trgBinary", targetMask); this.execute_pattern(self, other, "bp_heavyextra_temporary", args); } @@ -683,8 +662,8 @@ public void invulncancel( CInstance* self, CInstance* other, int? delay = null, int? targetMask = null ) { RValue[] args = []; - args = this.add_if_not_null(args, "delay", delay); - args = this.add_if_not_null(args, "trgBinary", targetMask); + args = this.utils.add_if_not_null(args, "delay", delay); + args = this.utils.add_if_not_null(args, "trgBinary", targetMask); this.execute_pattern(self, other, "bp_invulncancel", args); } @@ -694,13 +673,13 @@ public void knockback_circle( Position? position = null ) { RValue[] args = []; - args = this.add_if_not_null(args, "warningDelay", warningDelay); - args = this.add_if_not_null(args, "warnMsg", warnMsg); - args = this.add_if_not_null(args, "spawnDelay", spawnDelay); - args = this.add_if_not_null(args, "trgBinary", targetMask); - args = this.add_if_not_null(args, "radius", radius); - args = this.add_if_not_null(args, "kbAmount", kbAmount); - args = this.add_if_not_null(args, "lifespan", kbDuration); + args = this.utils.add_if_not_null(args, "warningDelay", warningDelay); + args = this.utils.add_if_not_null(args, "warnMsg", warnMsg); + args = this.utils.add_if_not_null(args, "spawnDelay", spawnDelay); + args = this.utils.add_if_not_null(args, "trgBinary", targetMask); + args = this.utils.add_if_not_null(args, "radius", radius); + args = this.utils.add_if_not_null(args, "kbAmount", kbAmount); + args = this.utils.add_if_not_null(args, "lifespan", kbDuration); if (position != null) { args = args.Concat([this.utils.CreateString("x")!.Value, new RValue(position.Value.x)]).ToArray(); @@ -714,13 +693,13 @@ public void knockback_line( CInstance* self, CInstance* other, int? warningDelay = null, int? warnMsg = null, int? spawnDelay = null, int? kbAmount = null, Position? position = null, bool? horizontal = null, int? kbDuration = null, int? targetMask = null ) { RValue[] args = []; - args = this.add_if_not_null(args, "warningDelay", warningDelay); - args = this.add_if_not_null(args, "warnMsg", warnMsg); - args = this.add_if_not_null(args, "spawnDelay", spawnDelay); - args = this.add_if_not_null(args, "trgBinary", targetMask); - args = this.add_if_not_null(args, "kbAmount", kbAmount); - args = this.add_if_not_null(args, "horizontal", horizontal); - args = this.add_if_not_null(args, "lifespan", kbDuration); + args = this.utils.add_if_not_null(args, "warningDelay", warningDelay); + args = this.utils.add_if_not_null(args, "warnMsg", warnMsg); + args = this.utils.add_if_not_null(args, "spawnDelay", spawnDelay); + args = this.utils.add_if_not_null(args, "trgBinary", targetMask); + args = this.utils.add_if_not_null(args, "kbAmount", kbAmount); + args = this.utils.add_if_not_null(args, "horizontal", horizontal); + args = this.utils.add_if_not_null(args, "lifespan", kbDuration); if (position != null) { args = args.Concat([this.utils.CreateString("x")!.Value, new RValue(position.Value.x)]).ToArray(); @@ -735,9 +714,9 @@ public void light_crosswave( Position? position = null ) { RValue[] args = []; - args = this.add_if_not_null(args, "warningDelay", warningDelay); - args = this.add_if_not_null(args, "spawnDelay", spawnDelay); - args = this.add_if_not_null(args, "angle", rotation); // number + args = this.utils.add_if_not_null(args, "warningDelay", warningDelay); + args = this.utils.add_if_not_null(args, "spawnDelay", spawnDelay); + args = this.utils.add_if_not_null(args, "angle", rotation); // number if (position != null) { args = args.Concat([this.utils.CreateString("x")!.Value, new RValue(position.Value.x)]).ToArray(); @@ -751,15 +730,15 @@ public void light_line( CInstance* self, CInstance* other, int? warningDelay = null, int? spawnDelay = null, Position? position = null, int? lineAngle = 0, int? angle = null, int? spd = null, int? lineLength = null, int? numBullets = null, int? type = null, bool? showWarning = null ) { RValue[] args = []; - args = this.add_if_not_null(args, "warningDelay", warningDelay); - args = this.add_if_not_null(args, "spawnDelay", spawnDelay); - args = this.add_if_not_null(args, "angle", angle); - args = this.add_if_not_null(args, "spd", spd); - args = this.add_if_not_null(args, "lineAngle", lineAngle); - args = this.add_if_not_null(args, "lineLength", lineLength); - args = this.add_if_not_null(args, "num", numBullets); - args = this.add_if_not_null(args, "type", type); - args = this.add_if_not_null(args, "showWarning", showWarning); + args = this.utils.add_if_not_null(args, "warningDelay", warningDelay); + args = this.utils.add_if_not_null(args, "spawnDelay", spawnDelay); + args = this.utils.add_if_not_null(args, "angle", angle); + args = this.utils.add_if_not_null(args, "spd", spd); + args = this.utils.add_if_not_null(args, "lineAngle", lineAngle); + args = this.utils.add_if_not_null(args, "lineLength", lineLength); + args = this.utils.add_if_not_null(args, "num", numBullets); + args = this.utils.add_if_not_null(args, "type", type); + args = this.utils.add_if_not_null(args, "showWarning", showWarning); if (position != null) { args = args.Concat([this.utils.CreateString("x")!.Value, new RValue(position.Value.x)]).ToArray(); @@ -773,9 +752,9 @@ public void line_direction( CInstance* self, CInstance* other, int? warningDelay = null, int? spawnDelay = null, int? width = null, PosRot[]? positions = null ) { RValue[] args = []; - args = this.add_if_not_null(args, "warningDelay", warningDelay); - args = this.add_if_not_null(args, "spawnDelay", spawnDelay); - args = this.add_if_not_null(args, "width", width); + args = this.utils.add_if_not_null(args, "warningDelay", warningDelay); + args = this.utils.add_if_not_null(args, "spawnDelay", spawnDelay); + args = this.utils.add_if_not_null(args, "width", width); if (positions != null) { args = args.Concat([this.utils.CreateString("numLines")!.Value, new RValue(positions.Length)]).ToArray(); @@ -797,11 +776,11 @@ public void line_spreads_h( CInstance* self, CInstance* other, int? warningDelay = null, int? warnMsg = null, int? spawnDelay = null, int? width = null, int? targetMask = null ) { RValue[] args = []; - args = this.add_if_not_null(args, "warningDelay", warningDelay); - args = this.add_if_not_null(args, "spawnDelay", spawnDelay); - args = this.add_if_not_null(args, "width", width); - args = this.add_if_not_null(args, "warnMsg", warnMsg); - args = this.add_if_not_null(args, "trgBinary", targetMask); + args = this.utils.add_if_not_null(args, "warningDelay", warningDelay); + args = this.utils.add_if_not_null(args, "spawnDelay", spawnDelay); + args = this.utils.add_if_not_null(args, "width", width); + args = this.utils.add_if_not_null(args, "warnMsg", warnMsg); + args = this.utils.add_if_not_null(args, "trgBinary", targetMask); this.execute_pattern(self, other, "bp_line_spreads_h", args); } @@ -810,24 +789,24 @@ public void line_spreads_v( CInstance* self, CInstance* other, int? warningDelay = null, int? warnMsg = null, int? spawnDelay = null, int? width = null, int? targetMask = null ) { RValue[] args = []; - args = this.add_if_not_null(args, "warningDelay", warningDelay); - args = this.add_if_not_null(args, "spawnDelay", spawnDelay); - args = this.add_if_not_null(args, "width", width); - args = this.add_if_not_null(args, "warnMsg", warnMsg); - args = this.add_if_not_null(args, "trgBinary", targetMask); + args = this.utils.add_if_not_null(args, "warningDelay", warningDelay); + args = this.utils.add_if_not_null(args, "spawnDelay", spawnDelay); + args = this.utils.add_if_not_null(args, "width", width); + args = this.utils.add_if_not_null(args, "warnMsg", warnMsg); + args = this.utils.add_if_not_null(args, "trgBinary", targetMask); this.execute_pattern(self, other, "bp_line_spreads_v", args); } public void marching_bullet(CInstance* self, CInstance* other, int? warningDelay = null, int? spawnDelay = null, int? timeBetween = null, double? scale = null, Position[]? positions = null) { RValue[] args = []; - args = this.add_if_not_null(args, "warningDelay", warningDelay); - args = this.add_if_not_null(args, "spawnDelay", spawnDelay); - args = this.add_if_not_null(args, "timeBetween", timeBetween); - args = this.add_if_not_null(args, "scale", scale); + args = this.utils.add_if_not_null(args, "warningDelay", warningDelay); + args = this.utils.add_if_not_null(args, "spawnDelay", spawnDelay); + args = this.utils.add_if_not_null(args, "timeBetween", timeBetween); + args = this.utils.add_if_not_null(args, "scale", scale); if (positions != null) { - args = this.add_if_not_null(args, "numPoints", positions.Length); + args = this.utils.add_if_not_null(args, "numPoints", positions.Length); for (int i = 0; i < positions.Length; i++) { args = args.Concat([ this.utils.CreateString($"posX_{i}")!.Value, new RValue(positions[i].x), @@ -842,12 +821,12 @@ public void movementcheck( CInstance* self, CInstance* other, int? warningDelay = null, int? warnMsg = null, int? spawnDelay = null, bool? shouldMove = null, int? radius = null, int? targetMask = null ) { RValue[] args = []; - args = this.add_if_not_null(args, "warningDelay", warningDelay); - args = this.add_if_not_null(args, "spawnDelay", spawnDelay); - args = this.add_if_not_null(args, "warnMsg", warnMsg); - args = this.add_if_not_null(args, "trgBinary", targetMask); - args = this.add_if_not_null(args, "shouldMove", shouldMove); - args = this.add_if_not_null(args, "radius", radius); + args = this.utils.add_if_not_null(args, "warningDelay", warningDelay); + args = this.utils.add_if_not_null(args, "spawnDelay", spawnDelay); + args = this.utils.add_if_not_null(args, "warnMsg", warnMsg); + args = this.utils.add_if_not_null(args, "trgBinary", targetMask); + args = this.utils.add_if_not_null(args, "shouldMove", shouldMove); + args = this.utils.add_if_not_null(args, "radius", radius); this.execute_pattern(self, other, "bp_movementcheck", args); } @@ -856,9 +835,9 @@ public void move_position_synced( CInstance* self, CInstance* other, int? spawnDelay = null, bool? resetAnim = null, int? duration = null, Position? position = null ) { RValue[] args = []; - args = this.add_if_not_null(args, "spawnDelay", spawnDelay); - args = this.add_if_not_null(args, "resetAnim", resetAnim); - args = this.add_if_not_null(args, "duration", duration); + args = this.utils.add_if_not_null(args, "spawnDelay", spawnDelay); + args = this.utils.add_if_not_null(args, "resetAnim", resetAnim); + args = this.utils.add_if_not_null(args, "duration", duration); if (position != null) { args = args.Concat([this.utils.CreateString("x")!.Value, new RValue(position.Value.x)]).ToArray(); @@ -884,16 +863,16 @@ public void prscircle( ) { RValue[] args = []; - args = this.add_if_not_null(args, "warningDelay", warningDelay); - args = this.add_if_not_null(args, "warnMsg", warnMsg); - args = this.add_if_not_null(args, "displayNumber", displayNumber); - args = this.add_if_not_null(args, "element", bulletType); - args = this.add_if_not_null(args, "doubled", doubled); - args = this.add_if_not_null(args, "spawnDelay", spawnDelay); - args = this.add_if_not_null(args, "radius", radius); - args = this.add_if_not_null(args, "number", numBullets); - args = this.add_if_not_null(args, "spd", speed); - args = this.add_if_not_null(args, "angle", angle); + args = this.utils.add_if_not_null(args, "warningDelay", warningDelay); + args = this.utils.add_if_not_null(args, "warnMsg", warnMsg); + args = this.utils.add_if_not_null(args, "displayNumber", displayNumber); + args = this.utils.add_if_not_null(args, "element", bulletType); + args = this.utils.add_if_not_null(args, "doubled", doubled); + args = this.utils.add_if_not_null(args, "spawnDelay", spawnDelay); + args = this.utils.add_if_not_null(args, "radius", radius); + args = this.utils.add_if_not_null(args, "number", numBullets); + args = this.utils.add_if_not_null(args, "spd", speed); + args = this.utils.add_if_not_null(args, "angle", angle); if (position != null) { args = args.Concat([this.utils.CreateString("x")!.Value, new RValue(position.Value.x)]).ToArray(); @@ -907,15 +886,15 @@ public void prscircle_follow( CInstance* self, CInstance* other, int? warningDelay = null, int? warnMsg = null, int? bulletType = null, bool? doubled = null, int? spawnDelay = null, int? radius = null, int? numBullets = null, int? speed = null, int? targetId = null ) { RValue[] args = []; - args = this.add_if_not_null(args, "warningDelay", warningDelay); - args = this.add_if_not_null(args, "warnMsg", warnMsg); - args = this.add_if_not_null(args, "element", bulletType); - args = this.add_if_not_null(args, "doubled", doubled); - args = this.add_if_not_null(args, "spawnDelay", spawnDelay); - args = this.add_if_not_null(args, "radius", radius); - args = this.add_if_not_null(args, "number", numBullets); - args = this.add_if_not_null(args, "spd", speed); - args = this.add_if_not_null(args, "targetId", targetId); + args = this.utils.add_if_not_null(args, "warningDelay", warningDelay); + args = this.utils.add_if_not_null(args, "warnMsg", warnMsg); + args = this.utils.add_if_not_null(args, "element", bulletType); + args = this.utils.add_if_not_null(args, "doubled", doubled); + args = this.utils.add_if_not_null(args, "spawnDelay", spawnDelay); + args = this.utils.add_if_not_null(args, "radius", radius); + args = this.utils.add_if_not_null(args, "number", numBullets); + args = this.utils.add_if_not_null(args, "spd", speed); + args = this.utils.add_if_not_null(args, "targetId", targetId); this.execute_pattern(self, other, "bp_prscircle_follow", args); } @@ -925,15 +904,15 @@ public void prscircle_follow_bin( ) { RValue[] args = []; - args = this.add_if_not_null(args, "warningDelay", warningDelay); - args = this.add_if_not_null(args, "warnMsg", warnMsg); - args = this.add_if_not_null(args, "element", bulletType); - args = this.add_if_not_null(args, "doubled", doubled); - args = this.add_if_not_null(args, "spawnDelay", spawnDelay); - args = this.add_if_not_null(args, "radius", radius); - args = this.add_if_not_null(args, "number", numBullets); - args = this.add_if_not_null(args, "spd", speed); - args = this.add_if_not_null(args, "trgBinary", targetMask); + args = this.utils.add_if_not_null(args, "warningDelay", warningDelay); + args = this.utils.add_if_not_null(args, "warnMsg", warnMsg); + args = this.utils.add_if_not_null(args, "element", bulletType); + args = this.utils.add_if_not_null(args, "doubled", doubled); + args = this.utils.add_if_not_null(args, "spawnDelay", spawnDelay); + args = this.utils.add_if_not_null(args, "radius", radius); + args = this.utils.add_if_not_null(args, "number", numBullets); + args = this.utils.add_if_not_null(args, "spd", speed); + args = this.utils.add_if_not_null(args, "trgBinary", targetMask); this.execute_pattern(self, other, "bp_prscircle_follow_bin", args); } @@ -942,16 +921,16 @@ public void prsline_h( CInstance* self, CInstance* other, int? warningDelay = null, int? warnMsg = null, int? displayNumber = null, int? bulletType = null, bool? doubled = null, int? spawnDelay = null, int? width = null, int? offset = null, int? speed = null, double? yPosition = null ) { RValue[] args = []; - args = this.add_if_not_null(args, "warningDelay", warningDelay); - args = this.add_if_not_null(args, "warnMsg", warnMsg); - args = this.add_if_not_null(args, "displayNumber", displayNumber); - args = this.add_if_not_null(args, "element", bulletType); - args = this.add_if_not_null(args, "doubled", doubled); - args = this.add_if_not_null(args, "spawnDelay", spawnDelay); - args = this.add_if_not_null(args, "width", width); - args = this.add_if_not_null(args, "offset", offset); - args = this.add_if_not_null(args, "spd", speed); - args = this.add_if_not_null(args, "y", yPosition); + args = this.utils.add_if_not_null(args, "warningDelay", warningDelay); + args = this.utils.add_if_not_null(args, "warnMsg", warnMsg); + args = this.utils.add_if_not_null(args, "displayNumber", displayNumber); + args = this.utils.add_if_not_null(args, "element", bulletType); + args = this.utils.add_if_not_null(args, "doubled", doubled); + args = this.utils.add_if_not_null(args, "spawnDelay", spawnDelay); + args = this.utils.add_if_not_null(args, "width", width); + args = this.utils.add_if_not_null(args, "offset", offset); + args = this.utils.add_if_not_null(args, "spd", speed); + args = this.utils.add_if_not_null(args, "y", yPosition); this.execute_pattern(self, other, "bp_prsline_h", args); } @@ -960,16 +939,16 @@ public void prsline_h_follow( CInstance* self, CInstance* other, int? warningDelay = null, int? warnMsg = null, int? displayNumber = null, int? bulletType = null, bool? doubled = null, int? spawnDelay = null, int? width = null, int? offset = null, int? speed = null, int? targetId = null ) { RValue[] args = []; - args = this.add_if_not_null(args, "warningDelay", warningDelay); - args = this.add_if_not_null(args, "warnMsg", warnMsg); - args = this.add_if_not_null(args, "displayNumber", displayNumber); - args = this.add_if_not_null(args, "element", bulletType); - args = this.add_if_not_null(args, "doubled", doubled); - args = this.add_if_not_null(args, "spawnDelay", spawnDelay); - args = this.add_if_not_null(args, "width", width); - args = this.add_if_not_null(args, "offset", offset); - args = this.add_if_not_null(args, "spd", speed); - args = this.add_if_not_null(args, "targetId", targetId); + args = this.utils.add_if_not_null(args, "warningDelay", warningDelay); + args = this.utils.add_if_not_null(args, "warnMsg", warnMsg); + args = this.utils.add_if_not_null(args, "displayNumber", displayNumber); + args = this.utils.add_if_not_null(args, "element", bulletType); + args = this.utils.add_if_not_null(args, "doubled", doubled); + args = this.utils.add_if_not_null(args, "spawnDelay", spawnDelay); + args = this.utils.add_if_not_null(args, "width", width); + args = this.utils.add_if_not_null(args, "offset", offset); + args = this.utils.add_if_not_null(args, "spd", speed); + args = this.utils.add_if_not_null(args, "targetId", targetId); this.execute_pattern(self, other, "bp_prsline_h_follow", args); } @@ -978,26 +957,26 @@ public void prsline_v( CInstance* self, CInstance* other, int? warningDelay = null, int? warnMsg = null, int? displayNumber = null, int? bulletType = null, bool? doubled = null, int? spawnDelay = null, int? width = null, int? offset = null, int? speed = null, double? xPosition = null ) { RValue[] args = []; - args = this.add_if_not_null(args, "warningDelay", warningDelay); - args = this.add_if_not_null(args, "warnMsg", warnMsg); - args = this.add_if_not_null(args, "displayNumber", displayNumber); - args = this.add_if_not_null(args, "element", bulletType); - args = this.add_if_not_null(args, "doubled", doubled); - args = this.add_if_not_null(args, "spawnDelay", spawnDelay); - args = this.add_if_not_null(args, "width", width); - args = this.add_if_not_null(args, "offset", offset); - args = this.add_if_not_null(args, "spd", speed); - args = this.add_if_not_null(args, "x", xPosition); + args = this.utils.add_if_not_null(args, "warningDelay", warningDelay); + args = this.utils.add_if_not_null(args, "warnMsg", warnMsg); + args = this.utils.add_if_not_null(args, "displayNumber", displayNumber); + args = this.utils.add_if_not_null(args, "element", bulletType); + args = this.utils.add_if_not_null(args, "doubled", doubled); + args = this.utils.add_if_not_null(args, "spawnDelay", spawnDelay); + args = this.utils.add_if_not_null(args, "width", width); + args = this.utils.add_if_not_null(args, "offset", offset); + args = this.utils.add_if_not_null(args, "spd", speed); + args = this.utils.add_if_not_null(args, "x", xPosition); this.execute_pattern(self, other, "bp_prsline_v", args); } public void ray_multi_h(CInstance* self, CInstance* other, int? warningDelay = null, int? spawnDelay = null, int? eraseDelay = null, int? width = null, Position[]? positions = null) { RValue[] args = []; - args = this.add_if_not_null(args, "warningDelay", warningDelay); - args = this.add_if_not_null(args, "spawnDelay", spawnDelay); - args = this.add_if_not_null(args, "eraseDelay", eraseDelay); - args = this.add_if_not_null(args, "width", width); + args = this.utils.add_if_not_null(args, "warningDelay", warningDelay); + args = this.utils.add_if_not_null(args, "spawnDelay", spawnDelay); + args = this.utils.add_if_not_null(args, "eraseDelay", eraseDelay); + args = this.utils.add_if_not_null(args, "width", width); if (positions != null) { this.set_pattern_positions(self, other, positions); @@ -1008,11 +987,11 @@ public void ray_multi_h(CInstance* self, CInstance* other, int? warningDelay = n public void ray_multi_slice(CInstance* self, CInstance* other, int? warningDelay = null, int? spawnDelay = null, int? eraseDelay = null, int? timeBetween = null, int? width = null, PosRot[]? positions = null) { RValue[] args = []; - args = this.add_if_not_null(args, "warningDelay", warningDelay); - args = this.add_if_not_null(args, "spawnDelay", spawnDelay); - args = this.add_if_not_null(args, "eraseDelay", eraseDelay); - args = this.add_if_not_null(args, "width", width); - args = this.add_if_not_null(args, "timeBetween", timeBetween); + args = this.utils.add_if_not_null(args, "warningDelay", warningDelay); + args = this.utils.add_if_not_null(args, "spawnDelay", spawnDelay); + args = this.utils.add_if_not_null(args, "eraseDelay", eraseDelay); + args = this.utils.add_if_not_null(args, "width", width); + args = this.utils.add_if_not_null(args, "timeBetween", timeBetween); if (positions != null) { this.set_pattern_position_rotations(self, other, positions); @@ -1023,10 +1002,10 @@ public void ray_multi_slice(CInstance* self, CInstance* other, int? warningDelay public void ray_multi_v(CInstance* self, CInstance* other, int? warningDelay = null, int? spawnDelay = null, int? eraseDelay = null, int? width = null, Position[]? positions = null) { RValue[] args = []; - args = this.add_if_not_null(args, "warningDelay", warningDelay); - args = this.add_if_not_null(args, "spawnDelay", spawnDelay); - args = this.add_if_not_null(args, "eraseDelay", eraseDelay); - args = this.add_if_not_null(args, "width", width); + args = this.utils.add_if_not_null(args, "warningDelay", warningDelay); + args = this.utils.add_if_not_null(args, "spawnDelay", spawnDelay); + args = this.utils.add_if_not_null(args, "eraseDelay", eraseDelay); + args = this.utils.add_if_not_null(args, "width", width); if (positions != null) { this.set_pattern_positions(self, other, positions); @@ -1038,11 +1017,11 @@ public void ray_multi_v(CInstance* self, CInstance* other, int? warningDelay = n public void ray_single(CInstance* self, CInstance* other, int? warningDelay = null, int? spawnDelay = null, int? eraseDelay = null, int? width = null, Position? position = null, int? angle = null) { RValue[] args = []; - args = this.add_if_not_null(args, "warningDelay", warningDelay); - args = this.add_if_not_null(args, "spawnDelay", spawnDelay); - args = this.add_if_not_null(args, "eraseDelay", eraseDelay); - args = this.add_if_not_null(args, "width", width); - args = this.add_if_not_null(args, "angle", angle); + args = this.utils.add_if_not_null(args, "warningDelay", warningDelay); + args = this.utils.add_if_not_null(args, "spawnDelay", spawnDelay); + args = this.utils.add_if_not_null(args, "eraseDelay", eraseDelay); + args = this.utils.add_if_not_null(args, "width", width); + args = this.utils.add_if_not_null(args, "angle", angle); if (position != null) { args = args.Concat([this.utils.CreateString("x")!.Value, new RValue(position.Value.x)]).ToArray(); @@ -1054,15 +1033,15 @@ public void ray_single(CInstance* self, CInstance* other, int? warningDelay = nu public void ray_spinfast(CInstance* self, CInstance* other, int? warningDelay = null, int? warningRadius = null, int? displayNumber = null, int? spawnDelay = null, int? eraseDelay = null, int? width = null, double? angle = null, Position? position = null, double? rot = null, int? numLasers = null) { RValue[] args = []; - args = this.add_if_not_null(args, "warningDelay", warningDelay); - args = this.add_if_not_null(args, "spawnDelay", spawnDelay); - args = this.add_if_not_null(args, "eraseDelay", eraseDelay); - args = this.add_if_not_null(args, "width", width); - args = this.add_if_not_null(args, "radius", warningRadius); - args = this.add_if_not_null(args, "displayNumber", displayNumber); - args = this.add_if_not_null(args, "angle", angle); - args = this.add_if_not_null(args, "rot", rot); - args = this.add_if_not_null(args, "num", numLasers); + args = this.utils.add_if_not_null(args, "warningDelay", warningDelay); + args = this.utils.add_if_not_null(args, "spawnDelay", spawnDelay); + args = this.utils.add_if_not_null(args, "eraseDelay", eraseDelay); + args = this.utils.add_if_not_null(args, "width", width); + args = this.utils.add_if_not_null(args, "radius", warningRadius); + args = this.utils.add_if_not_null(args, "displayNumber", displayNumber); + args = this.utils.add_if_not_null(args, "angle", angle); + args = this.utils.add_if_not_null(args, "rot", rot); + args = this.utils.add_if_not_null(args, "num", numLasers); if (position != null) { args = args.Concat([this.utils.CreateString("x")!.Value, new RValue(position.Value.x)]).ToArray(); @@ -1074,15 +1053,15 @@ public void ray_spinfast(CInstance* self, CInstance* other, int? warningDelay = public void setgamespeed(CInstance* self, CInstance* other, int? spawnDelay = null, double? timeMult = null) { RValue[] args = []; - args = this.add_if_not_null(args, "timeMult", timeMult); - args = this.add_if_not_null(args, "spawnDelay", spawnDelay); + args = this.utils.add_if_not_null(args, "timeMult", timeMult); + args = this.utils.add_if_not_null(args, "spawnDelay", spawnDelay); this.execute_pattern(self, other, "bp_setgamespeed", args); } public void setzoom(CInstance* self, CInstance* other, double? zoom = null) { RValue[] args = []; - args = this.add_if_not_null(args, "scale", zoom); + args = this.utils.add_if_not_null(args, "scale", zoom); this.execute_pattern(self, other, "bp_setzoom", args); } @@ -1091,8 +1070,8 @@ public void showgroups( CInstance* self, CInstance* other, int? spawnDelay = null, int? eraseDelay = null, (int, int, int, int)? groupMasks = null ) { RValue[] args = []; - args = this.add_if_not_null(args, "spawnDelay", spawnDelay); - args = this.add_if_not_null(args, "eraseDelay", eraseDelay); + args = this.utils.add_if_not_null(args, "spawnDelay", spawnDelay); + args = this.utils.add_if_not_null(args, "eraseDelay", eraseDelay); if (groupMasks != null) { args = args.Concat([this.utils.CreateString("orderBin_0")!.Value, new RValue(groupMasks.Value.Item1)]).ToArray(); @@ -1108,9 +1087,9 @@ public void showorder( CInstance* self, CInstance* other, int? spawnDelay = null, int? eraseDelay = null, int? timeBetween = null, (int, int, int, int)? orderMasks = null ) { RValue[] args = []; - args = this.add_if_not_null(args, "spawnDelay", spawnDelay); - args = this.add_if_not_null(args, "eraseDelay", eraseDelay); - args = this.add_if_not_null(args, "timeBetween", timeBetween); + args = this.utils.add_if_not_null(args, "spawnDelay", spawnDelay); + args = this.utils.add_if_not_null(args, "eraseDelay", eraseDelay); + args = this.utils.add_if_not_null(args, "timeBetween", timeBetween); if (orderMasks != null) { args = args.Concat([this.utils.CreateString("orderBin_0")!.Value, new RValue(orderMasks.Value.Item1)]).ToArray(); @@ -1126,7 +1105,7 @@ public void tailwind( CInstance* self, CInstance* other, int? eraseDelay = null ) { RValue[] args = []; - args = this.add_if_not_null(args, "eraseDelay", eraseDelay); + args = this.utils.add_if_not_null(args, "eraseDelay", eraseDelay); this.execute_pattern(self, other, "bp_tailwind", args); } @@ -1141,10 +1120,10 @@ public void tether( CInstance* self, CInstance* other, int? warningDelay = null, int? spawnDelay = null, int? eraseDelay = null, double? radius = null, int? targetMask = null ) { RValue[] args = []; - args = this.add_if_not_null(args, "warningDelay", warningDelay); - args = this.add_if_not_null(args, "spawnDelay", spawnDelay); - args = this.add_if_not_null(args, "radius", radius); - args = this.add_if_not_null(args, "trgBinary", targetMask); + args = this.utils.add_if_not_null(args, "warningDelay", warningDelay); + args = this.utils.add_if_not_null(args, "spawnDelay", spawnDelay); + args = this.utils.add_if_not_null(args, "radius", radius); + args = this.utils.add_if_not_null(args, "trgBinary", targetMask); if (eraseDelay != null) { if (eraseDelay > 0) { @@ -1161,10 +1140,10 @@ public void tether_enemy( CInstance* self, CInstance* other, int? warningDelay = null, int? spawnDelay = null, int? eraseDelay = null, double? radius = null, Position? position = null, int? targetMask = null ) { RValue[] args = []; - args = this.add_if_not_null(args, "warningDelay", warningDelay); - args = this.add_if_not_null(args, "spawnDelay", spawnDelay); - args = this.add_if_not_null(args, "radius", radius); - args = this.add_if_not_null(args, "trgBinary", targetMask); + args = this.utils.add_if_not_null(args, "warningDelay", warningDelay); + args = this.utils.add_if_not_null(args, "spawnDelay", spawnDelay); + args = this.utils.add_if_not_null(args, "radius", radius); + args = this.utils.add_if_not_null(args, "trgBinary", targetMask); if (position != null) { args = args.Concat([this.utils.CreateString("x")!.Value, new RValue(position.Value.x)]).ToArray(); @@ -1185,10 +1164,10 @@ public void tether_fixed( CInstance* self, CInstance* other, int? warningDelay = null, int? spawnDelay = null, int? eraseDelay = null, double? radius = null, Position? position = null, int? targetMask = null ) { RValue[] args = []; - args = this.add_if_not_null(args, "warningDelay", warningDelay); - args = this.add_if_not_null(args, "spawnDelay", spawnDelay); - args = this.add_if_not_null(args, "radius", radius); - args = this.add_if_not_null(args, "trgBinary", targetMask); + args = this.utils.add_if_not_null(args, "warningDelay", warningDelay); + args = this.utils.add_if_not_null(args, "spawnDelay", spawnDelay); + args = this.utils.add_if_not_null(args, "radius", radius); + args = this.utils.add_if_not_null(args, "trgBinary", targetMask); if (position != null) { args = args.Concat([this.utils.CreateString("x")!.Value, new RValue(position.Value.x)]).ToArray(); @@ -1210,11 +1189,11 @@ public void thorns( CInstance* self, CInstance* other, int? warningDelay = null, int? warnMsg = null, int? spawnDelay = null, double? radius = null, int? targetMask = null ) { RValue[] args = []; - args = this.add_if_not_null(args, "warningDelay", warningDelay); - args = this.add_if_not_null(args, "spawnDelay", spawnDelay); - args = this.add_if_not_null(args, "radius", radius); - args = this.add_if_not_null(args, "trgBinary", targetMask); - args = this.add_if_not_null(args, "warnMsg", warnMsg); + args = this.utils.add_if_not_null(args, "warningDelay", warningDelay); + args = this.utils.add_if_not_null(args, "spawnDelay", spawnDelay); + args = this.utils.add_if_not_null(args, "radius", radius); + args = this.utils.add_if_not_null(args, "trgBinary", targetMask); + args = this.utils.add_if_not_null(args, "warnMsg", warnMsg); this.execute_pattern(self, other, "bp_thorns", args); } @@ -1223,10 +1202,10 @@ public void thorns_bin( CInstance* self, CInstance* other, int? warningDelay = null, int? warnMsg = null, int? spawnDelay = null, double? radius = null, (int, int, int, int)? groupMasks = null ) { RValue[] args = []; - args = this.add_if_not_null(args, "warningDelay", warningDelay); - args = this.add_if_not_null(args, "spawnDelay", spawnDelay); - args = this.add_if_not_null(args, "radius", radius); - args = this.add_if_not_null(args, "warnMsg", warnMsg); + args = this.utils.add_if_not_null(args, "warningDelay", warningDelay); + args = this.utils.add_if_not_null(args, "spawnDelay", spawnDelay); + args = this.utils.add_if_not_null(args, "radius", radius); + args = this.utils.add_if_not_null(args, "warnMsg", warnMsg); if (groupMasks != null) { args = args.Concat([this.utils.CreateString("orderBin_0")!.Value, new RValue(groupMasks.Value.Item1)]).ToArray(); @@ -1241,12 +1220,12 @@ public void thorns_fixed( CInstance* self, CInstance* other, int? warningDelay = null, int? warnMsg = null, int? displayNumber = null, int? spawnDelay = null, double? radius = null, Position? position = null, int? targetMask = null ) { RValue[] args = []; - args = this.add_if_not_null(args, "warningDelay", warningDelay); - args = this.add_if_not_null(args, "spawnDelay", spawnDelay); - args = this.add_if_not_null(args, "radius", radius); - args = this.add_if_not_null(args, "trgBinary", targetMask); - args = this.add_if_not_null(args, "warnMsg", warnMsg); - args = this.add_if_not_null(args, "displayNumber", displayNumber); + args = this.utils.add_if_not_null(args, "warningDelay", warningDelay); + args = this.utils.add_if_not_null(args, "spawnDelay", spawnDelay); + args = this.utils.add_if_not_null(args, "radius", radius); + args = this.utils.add_if_not_null(args, "trgBinary", targetMask); + args = this.utils.add_if_not_null(args, "warnMsg", warnMsg); + args = this.utils.add_if_not_null(args, "displayNumber", displayNumber); if (position != null) { args = args.Concat([this.utils.CreateString("x")!.Value, new RValue(position.Value.x)]).ToArray(); @@ -1261,14 +1240,14 @@ public void water2_line( int? lineLength = null, int? numBullets = null, int? spd = null ) { RValue[] args = []; - args = this.add_if_not_null(args, "warningDelay", warningDelay); - args = this.add_if_not_null(args, "showWarning", showWarning); - args = this.add_if_not_null(args, "spawnDelay", spawnDelay); - args = this.add_if_not_null(args, "angle", angle); - args = this.add_if_not_null(args, "lineAngle", lineAngle); - args = this.add_if_not_null(args, "num", numBullets); - args = this.add_if_not_null(args, "lineLength", lineLength); - args = this.add_if_not_null(args, "spd", spd); + args = this.utils.add_if_not_null(args, "warningDelay", warningDelay); + args = this.utils.add_if_not_null(args, "showWarning", showWarning); + args = this.utils.add_if_not_null(args, "spawnDelay", spawnDelay); + args = this.utils.add_if_not_null(args, "angle", angle); + args = this.utils.add_if_not_null(args, "lineAngle", lineAngle); + args = this.utils.add_if_not_null(args, "num", numBullets); + args = this.utils.add_if_not_null(args, "lineLength", lineLength); + args = this.utils.add_if_not_null(args, "spd", spd); if (position != null) { args = args.Concat([this.utils.CreateString("x")!.Value, new RValue(position.Value.x)]).ToArray(); @@ -1282,11 +1261,11 @@ public void water_moving_ball( CInstance* self, CInstance* other, int? warningDelay = null, int? spawnDelay = null, Position? position = null, double? speed = null, double? scale = null, double? angle = null ) { RValue[] args = []; - args = this.add_if_not_null(args, "warningDelay", warningDelay); - args = this.add_if_not_null(args, "spawnDelay", spawnDelay); - args = this.add_if_not_null(args, "spd", speed); - args = this.add_if_not_null(args, "scale", scale); - args = this.add_if_not_null(args, "angle", angle); + args = this.utils.add_if_not_null(args, "warningDelay", warningDelay); + args = this.utils.add_if_not_null(args, "spawnDelay", spawnDelay); + args = this.utils.add_if_not_null(args, "spd", speed); + args = this.utils.add_if_not_null(args, "scale", scale); + args = this.utils.add_if_not_null(args, "angle", angle); if (position != null) { args = args.Concat([this.utils.CreateString("x")!.Value, new RValue(position.Value.x)]).ToArray(); @@ -1299,12 +1278,12 @@ public void water_moving_ball( // Towers. public void angel_circle(CInstance* self, CInstance* other, int? warningDelay = null, int? spawnDelay = null, int? warnMsg = null, int? displayNumber = null, int? number = null, int? radius = null, Position? position = null) { RValue[] args = []; - args = this.add_if_not_null(args, "warningDelay", warningDelay); - args = this.add_if_not_null(args, "spawnDelay", spawnDelay); - args = this.add_if_not_null(args, "warnMsg", warnMsg); - args = this.add_if_not_null(args, "displayNumber", displayNumber); - args = this.add_if_not_null(args, "number", number); - args = this.add_if_not_null(args, "radius", radius); + args = this.utils.add_if_not_null(args, "warningDelay", warningDelay); + args = this.utils.add_if_not_null(args, "spawnDelay", spawnDelay); + args = this.utils.add_if_not_null(args, "warnMsg", warnMsg); + args = this.utils.add_if_not_null(args, "displayNumber", displayNumber); + args = this.utils.add_if_not_null(args, "number", number); + args = this.utils.add_if_not_null(args, "radius", radius); if (position != null) { args = args.Concat([this.utils.CreateString("x")!.Value, new RValue(position.Value.x)]).ToArray(); @@ -1317,12 +1296,12 @@ public void angel_circle(CInstance* self, CInstance* other, int? warningDelay = public void angel_circle_follow(CInstance* self, CInstance* other, int? warningDelay = null, int? spawnDelay = null, int? warnMsg = null, int? number = null, int? radius = null, int? targetId = null) { RValue[] args = []; - args = this.add_if_not_null(args, "warningDelay", warningDelay); - args = this.add_if_not_null(args, "spawnDelay", spawnDelay); - args = this.add_if_not_null(args, "warnMsg", warnMsg); - args = this.add_if_not_null(args, "number", number); - args = this.add_if_not_null(args, "radius", radius); - args = this.add_if_not_null(args, "targetId", targetId); + args = this.utils.add_if_not_null(args, "warningDelay", warningDelay); + args = this.utils.add_if_not_null(args, "spawnDelay", spawnDelay); + args = this.utils.add_if_not_null(args, "warnMsg", warnMsg); + args = this.utils.add_if_not_null(args, "number", number); + args = this.utils.add_if_not_null(args, "radius", radius); + args = this.utils.add_if_not_null(args, "targetId", targetId); this.execute_pattern(self, other, "bp_angel_circle_follow", args); } @@ -1330,12 +1309,12 @@ public void angel_circle_follow(CInstance* self, CInstance* other, int? warningD public void angel_circle_follow_bin(CInstance* self, CInstance* other, int? warningDelay = null, int? spawnDelay = null, int? number = null, int? trgBinary = null, int? warnMsg = null, int? radius = null) { RValue[] args = []; - args = this.add_if_not_null(args, "warningDelay", warningDelay); - args = this.add_if_not_null(args, "spawnDelay", spawnDelay); - args = this.add_if_not_null(args, "warnMsg", warnMsg); - args = this.add_if_not_null(args, "number", number); - args = this.add_if_not_null(args, "radius", radius); - args = this.add_if_not_null(args, "trgBinary", trgBinary); + args = this.utils.add_if_not_null(args, "warningDelay", warningDelay); + args = this.utils.add_if_not_null(args, "spawnDelay", spawnDelay); + args = this.utils.add_if_not_null(args, "warnMsg", warnMsg); + args = this.utils.add_if_not_null(args, "number", number); + args = this.utils.add_if_not_null(args, "radius", radius); + args = this.utils.add_if_not_null(args, "trgBinary", trgBinary); this.execute_pattern(self, other, "bp_angel_circle_follow_bin", args); } @@ -1343,11 +1322,11 @@ public void angel_circle_follow_bin(CInstance* self, CInstance* other, int? warn public void angel_circle_follow_enemy(CInstance* self, CInstance* other, int? warningDelay = null, int? spawnDelay = null, int? warnMsg = null, int? number = null, int? radius = null) { RValue[] args = []; - args = this.add_if_not_null(args, "warningDelay", warningDelay); - args = this.add_if_not_null(args, "spawnDelay", spawnDelay); - args = this.add_if_not_null(args, "warnMsg", warnMsg); - args = this.add_if_not_null(args, "number", number); - args = this.add_if_not_null(args, "radius", radius); + args = this.utils.add_if_not_null(args, "warningDelay", warningDelay); + args = this.utils.add_if_not_null(args, "spawnDelay", spawnDelay); + args = this.utils.add_if_not_null(args, "warnMsg", warnMsg); + args = this.utils.add_if_not_null(args, "number", number); + args = this.utils.add_if_not_null(args, "radius", radius); this.execute_pattern(self, other, "bp_angel_circle_follow_enemy", args); } @@ -1355,12 +1334,12 @@ public void angel_circle_follow_enemy(CInstance* self, CInstance* other, int? wa public void angel_circle_mult(CInstance* self, CInstance* other, int? warningDelay = null, int? spawnDelay = null, int? warnMsg = null, int? displayNumber = null, int? number = null, int? radius = null, Position[]? points = null) { RValue[] args = []; - args = this.add_if_not_null(args, "warningDelay", warningDelay); - args = this.add_if_not_null(args, "spawnDelay", spawnDelay); - args = this.add_if_not_null(args, "warnMsg", warnMsg); - args = this.add_if_not_null(args, "displayNumber", displayNumber); - args = this.add_if_not_null(args, "number", number); - args = this.add_if_not_null(args, "radius", radius); + args = this.utils.add_if_not_null(args, "warningDelay", warningDelay); + args = this.utils.add_if_not_null(args, "spawnDelay", spawnDelay); + args = this.utils.add_if_not_null(args, "warnMsg", warnMsg); + args = this.utils.add_if_not_null(args, "displayNumber", displayNumber); + args = this.utils.add_if_not_null(args, "number", number); + args = this.utils.add_if_not_null(args, "radius", radius); if (points != null) { args = args.Concat([this.utils.CreateString("numPoints")!.Value, new RValue(points.Length)]).ToArray(); diff --git a/RNSReloaded/Util.cs b/RNSReloaded/Util.cs index 1f91a5c..0fda3ee 100644 --- a/RNSReloaded/Util.cs +++ b/RNSReloaded/Util.cs @@ -129,4 +129,24 @@ public void setHallway(List hallway, CInstance* self, IRNSReloaded rnsRel notchNum->Type = RValueType.Real; } + public RValue[] add_if_not_null(RValue[] args, string fieldName, int? value) { + if (value != null) { + return args.Concat([this.CreateString(fieldName)!.Value, new RValue(value.Value)]).ToArray(); + } + return args; + } + + public RValue[] add_if_not_null(RValue[] args, string fieldName, bool? value) { + if (value != null) { + return args.Concat([this.CreateString(fieldName)!.Value, new RValue(value.Value)]).ToArray(); + } + return args; + } + + public RValue[] add_if_not_null(RValue[] args, string fieldName, double? value) { + if (value != null) { + return args.Concat([this.CreateString(fieldName)!.Value, new RValue(value.Value)]).ToArray(); + } + return args; + } } From 3c1f2f2f3c36606a8676b405c9b87172235fc25f Mon Sep 17 00:00:00 2001 From: Babit Date: Fri, 19 Jun 2026 21:19:41 +0200 Subject: [PATCH 03/13] Update more bps --- RNSReloaded.Interfaces/IBattlePatterns.cs | 6 +++--- RNSReloaded/BattlePatterns.cs | 19 ++++++++++++++++--- 2 files changed, 19 insertions(+), 6 deletions(-) diff --git a/RNSReloaded.Interfaces/IBattlePatterns.cs b/RNSReloaded.Interfaces/IBattlePatterns.cs index d0c7946..fcfe645 100644 --- a/RNSReloaded.Interfaces/IBattlePatterns.cs +++ b/RNSReloaded.Interfaces/IBattlePatterns.cs @@ -138,7 +138,7 @@ public void gravity_fall_temporary( ); public void gravity_pull( - CInstance* self, CInstance* other, double? mult = null + CInstance* self, CInstance* other, double? mult = null, Position? position = null ); public void gravity_pull_temporary( @@ -256,11 +256,11 @@ public void showorder( ); public void tailwind( - CInstance* self, CInstance* other, int? eraseDelay = null + CInstance* self, CInstance* other, int? eraseDelay = null, int? spawnDelay = null, int? trgBinary = null, int? mult = null ); public void tailwind_permanent( - CInstance* self, CInstance* other + CInstance* self, CInstance* other, int? spawnDelay = null, int? trgBinary = null, int? mult = null ); public void tether( diff --git a/RNSReloaded/BattlePatterns.cs b/RNSReloaded/BattlePatterns.cs index 44ba90a..293400d 100644 --- a/RNSReloaded/BattlePatterns.cs +++ b/RNSReloaded/BattlePatterns.cs @@ -593,11 +593,16 @@ public void gravity_fall_temporary( } public void gravity_pull( - CInstance* self, CInstance* other, double? mult = null + CInstance* self, CInstance* other, double? mult = null, Position? position = null ) { RValue[] args = []; args = this.utils.add_if_not_null(args, "mult", mult); + if (position != null) { + args = args.Concat([this.utils.CreateString("x")!.Value, new RValue(position.Value.x)]).ToArray(); + args = args.Concat([this.utils.CreateString("y")!.Value, new RValue(position.Value.y)]).ToArray(); + } + this.execute_pattern(self, other, "bp_gravity_pull", args); } @@ -1102,17 +1107,25 @@ public void showorder( } public void tailwind( - CInstance* self, CInstance* other, int? eraseDelay = null + CInstance* self, CInstance* other, int? eraseDelay = null, int? spawnDelay = null, int? trgBinary = null, int? mult = null ) { RValue[] args = []; args = this.utils.add_if_not_null(args, "eraseDelay", eraseDelay); + args = this.utils.add_if_not_null(args, "spawnDelay", spawnDelay); + args = this.utils.add_if_not_null(args, "trgBinary", trgBinary); + args = this.utils.add_if_not_null(args, "mult", mult); + this.execute_pattern(self, other, "bp_tailwind", args); } public void tailwind_permanent( - CInstance* self, CInstance* other + CInstance* self, CInstance* other, int? spawnDelay = null, int? trgBinary = null, int? mult = null ) { RValue[] args = []; + args = this.utils.add_if_not_null(args, "spawnDelay", spawnDelay); + args = this.utils.add_if_not_null(args, "trgBinary", trgBinary); + args = this.utils.add_if_not_null(args, "mult", mult); + this.execute_pattern(self, other, "bp_tailwind_permanent", args); } From fb55410b4e4bb10236f96dbb93688a3227e598c1 Mon Sep 17 00:00:00 2001 From: Babit Date: Fri, 19 Jun 2026 21:20:11 +0200 Subject: [PATCH 04/13] Add IEnumerable to LinkedList, a function for getting a list of instances, and more RValue conversion functions --- RNSReloaded.Interfaces/Structs.cs | 69 ++++++++++++++++++++++++++++--- 1 file changed, 64 insertions(+), 5 deletions(-) diff --git a/RNSReloaded.Interfaces/Structs.cs b/RNSReloaded.Interfaces/Structs.cs index 289d978..2d3bd27 100644 --- a/RNSReloaded.Interfaces/Structs.cs +++ b/RNSReloaded.Interfaces/Structs.cs @@ -3,6 +3,11 @@ // ReSharper disable InconsistentNaming namespace RNSReloaded.Interfaces.Structs; +public unsafe interface ILinkedListElement where T : unmanaged { + T* GetNext(); + T* GetPrev(); +} + public unsafe delegate RValue* ScriptDelegate( CInstance* self, CInstance* other, RValue* returnValue, int argc, RValue** argv ); @@ -105,12 +110,20 @@ public RValue(bool value) { } public static implicit operator RValue(CInstance* obj) => new(obj); + public static implicit operator RValue(int value) => new(value); + public static implicit operator RValue(double value) => new(value); + public static implicit operator RValue(bool value) => new(value); // TODO: creating other primitives, new objects, and new arrays } [StructLayout(LayoutKind.Sequential, Pack = 8)] -public unsafe struct CInstance; // TODO +public unsafe struct CInstance : ILinkedListElement { + // TODO + + public CInstance* GetNext() => throw new NotImplementedException(); + public CInstance* GetPrev() => throw new NotImplementedException(); +} [StructLayout(LayoutKind.Sequential, Pack = 8)] public unsafe struct CScript { @@ -134,12 +147,42 @@ public unsafe struct RFunctionStringRef { } [StructLayout(LayoutKind.Sequential, Pack = 8)] -public unsafe struct LinkedList where T : unmanaged { +public unsafe struct LinkedList where T : unmanaged, ILinkedListElement { public T* First; public T* Last; public int Count; - // TODO: enumerator + public Enumerator GetEnumerator() => new Enumerator(this); + + public struct Enumerator { + private LinkedList _list; + private T* Curr; + private bool first; + + internal Enumerator(LinkedList list) { + this._list = list; + this.Curr = list.First; + this.first = true; + } + + public T* Current => this.Curr; + + // Contract says it should be run once before it points to first element + public bool MoveNext() { + if (!this.first) { + this.Curr = this.Curr->GetNext(); + } + this.first = false; + return this.Curr != null; + } + + public void Reset() { + this.Curr = this._list.First; + this.first = true; + } + + public void Dispose() { } + } } [StructLayout(LayoutKind.Sequential, Pack = 8)] @@ -222,7 +265,7 @@ public unsafe struct CRoom { } [StructLayout(LayoutKind.Sequential, Pack = 8)] -public unsafe struct CLayer { +public unsafe struct CLayer : ILinkedListElement { public int ID; public int Depth; public float XOffset; @@ -251,6 +294,19 @@ public unsafe struct CLayer { public CLayer* Next; public CLayer* Previous; public nint GCProxy; + + public CLayer* GetNext() => this.Next; + public CLayer* GetPrev() => this.Previous; + + public List GetInstances() { + RValue[] instances = []; + foreach (var element in this.Elements) { + if (element->Type != LayerElementType.Instance) { continue; } + var instance = (CLayerInstanceElement*) element; + instances = [..instances, instance->Instance]; + } + return instances.ToList(); + } } public enum LayerElementType { @@ -258,7 +314,7 @@ public enum LayerElementType { } [StructLayout(LayoutKind.Sequential, Pack = 8)] -public unsafe struct CLayerElementBase { +public unsafe struct CLayerElementBase : ILinkedListElement { public LayerElementType Type; public int ID; public byte RuntimeDataInitialized; @@ -269,6 +325,9 @@ public unsafe struct CLayerElementBase { public CLayerElementBase* Next; public CLayerElementBase* Previous; // Random 3 bytes of data, then 5 of pack, then another pointer. Who knows what that is though. + + public CLayerElementBase* GetNext() => this.Next; + public CLayerElementBase* GetPrev() => this.Previous; } [StructLayout(LayoutKind.Sequential, Pack = 8)] From 71bc8c17b2e29149ee6b68898434c3a8cb1bc84c Mon Sep 17 00:00:00 2001 From: Babit Date: Sat, 20 Jun 2026 01:12:57 +0200 Subject: [PATCH 05/13] More RValue conversions --- RNSReloaded.Interfaces/Structs.cs | 72 +++++++++++++++++++++++++++++++ RNSReloaded/Util.cs | 2 - 2 files changed, 72 insertions(+), 2 deletions(-) diff --git a/RNSReloaded.Interfaces/Structs.cs b/RNSReloaded.Interfaces/Structs.cs index 2d3bd27..7ee76d0 100644 --- a/RNSReloaded.Interfaces/Structs.cs +++ b/RNSReloaded.Interfaces/Structs.cs @@ -84,6 +84,60 @@ public override string ToString() { } } + // Technically this should cast ints to uint and return long + public int ToInt(int defaultValue = 0) { + return this.Type switch { + RValueType.Real => (int) this.Real, + RValueType.Int32 => this.Int32, + RValueType.Int64 => this.Int32, + RValueType.Bool => (int) this.Real, + _ => defaultValue, + }; + } + + // See INT64_RValue in a YYC decompilation (might need debug symbols) + private static long RealToLong(double value) { + if (Double.IsNaN(value)) { + return 0; + } else if (Double.IsPositiveInfinity(value)) { + return long.MaxValue; + } else if (Double.IsNegativeInfinity(value)) { + return long.MinValue; + } else { + return (int)value; + } + } + + public long ToLong(long defaultValue = 0) { + return this.Type switch { + RValueType.Real => RealToLong(this.Real), + RValueType.Int32 => this.Int32, + RValueType.Int64 => this.Int64, + RValueType.Bool => RealToLong(this.Real), + _ => defaultValue, + }; + } + + public double ToDouble(double defaultValue = 0) { + return this.Type switch { + RValueType.Real => this.Real, + RValueType.Int32 => (double) this.Int32, + RValueType.Int64 => (double)(int) this.Int64, + RValueType.Bool => this.Real, + _ => defaultValue, + }; + } + + public bool ToBool(bool defaultValue = false) { + return this.Type switch { + RValueType.Real => this.Real > 0.5, + RValueType.Int32 => this.Int32 > 0, + RValueType.Int64 => this.Int64 > 0, + RValueType.Bool => this.Real > 0.5, + _ => defaultValue, + }; + } + // Constructors public RValue(CInstance* obj) { this.Type = RValueType.Object; @@ -97,6 +151,12 @@ public RValue(int value) { this.Flags = 0; } + public RValue(long value) { + this.Type = RValueType.Int64; + this.Int64 = value; + this.Flags = 0; + } + public RValue(double value) { this.Type = RValueType.Real; this.Real = value; @@ -109,11 +169,23 @@ public RValue(bool value) { this.Flags = 0; } + public RValue() { + this.Type = RValueType.Undefined; + this.Int64 = 0; + this.Flags = 0; + } + public static implicit operator RValue(CInstance* obj) => new(obj); public static implicit operator RValue(int value) => new(value); + public static implicit operator RValue(long value) => new(value); public static implicit operator RValue(double value) => new(value); public static implicit operator RValue(bool value) => new(value); + public static explicit operator int(RValue value) => value.ToInt(); + public static explicit operator long(RValue value) => value.ToLong(); + public static explicit operator double(RValue value) => value.ToDouble(); + public static explicit operator bool(RValue value) => value.ToBool(); + // TODO: creating other primitives, new objects, and new arrays } diff --git a/RNSReloaded/Util.cs b/RNSReloaded/Util.cs index 0fda3ee..c37a23d 100644 --- a/RNSReloaded/Util.cs +++ b/RNSReloaded/Util.cs @@ -1,5 +1,3 @@ -using System.Drawing; -using System.Runtime.InteropServices; using Reloaded.Mod.Interfaces.Internal; using RNSReloaded.Interfaces; using RNSReloaded.Interfaces.Structs; From 924817defa06b2ad2950cc486f09f2835141213a Mon Sep 17 00:00:00 2001 From: Babit Date: Sat, 20 Jun 2026 05:37:29 +0200 Subject: [PATCH 06/13] More additions --- RNSReloaded.Interfaces/IBattlePatterns.cs | 10 +++++-- RNSReloaded.Interfaces/IRNSReloaded.cs | 1 + RNSReloaded/BattlePatterns.cs | 36 +++++++++++++++++++++-- RNSReloaded/RNSReloaded.cs | 4 +++ 4 files changed, 47 insertions(+), 4 deletions(-) diff --git a/RNSReloaded.Interfaces/IBattlePatterns.cs b/RNSReloaded.Interfaces/IBattlePatterns.cs index fcfe645..ff13280 100644 --- a/RNSReloaded.Interfaces/IBattlePatterns.cs +++ b/RNSReloaded.Interfaces/IBattlePatterns.cs @@ -245,6 +245,8 @@ public void prsline_v( public void setgamespeed(CInstance* self, CInstance* other, int? spawnDelay = null, double? timeMult = null); + public void setgamespeed_temp(CInstance* self, CInstance* other, int? spawnDelay = null, int? eraseDelay = null, double? timeMult = null); + public void setzoom(CInstance* self, CInstance* other, double? zoom = null); public void showgroups( @@ -256,11 +258,15 @@ public void showorder( ); public void tailwind( - CInstance* self, CInstance* other, int? eraseDelay = null, int? spawnDelay = null, int? trgBinary = null, int? mult = null + CInstance* self, CInstance* other, int? eraseDelay = null, int? spawnDelay = null, int? trgBinary = null, double? mult = null ); public void tailwind_permanent( - CInstance* self, CInstance* other, int? spawnDelay = null, int? trgBinary = null, int? mult = null + CInstance* self, CInstance* other, int? spawnDelay = null, int? trgBinary = null, double? mult = null + ); + + public void teleport_dist( + CInstance* self, CInstance* other, int? spawnDelay = null, int? eraseDelay = null, int? type = null, Position[]? offsets = null ); public void tether( diff --git a/RNSReloaded.Interfaces/IRNSReloaded.cs b/RNSReloaded.Interfaces/IRNSReloaded.cs index 4929795..9b2d2d1 100644 --- a/RNSReloaded.Interfaces/IRNSReloaded.cs +++ b/RNSReloaded.Interfaces/IRNSReloaded.cs @@ -20,6 +20,7 @@ public unsafe interface IRNSReloaded { public RFunctionStringRef GetTheFunction(int id); public CInstance* GetGlobalInstance(); public RValue* FindValue(CInstance* instance, string name); + public RValue* FindGlobalValue(string name); public RValue* ArrayGetEntry(RValue* array, int index); public RValue? ArrayGetLength(RValue* array); public string GetString(RValue* value); diff --git a/RNSReloaded/BattlePatterns.cs b/RNSReloaded/BattlePatterns.cs index 293400d..1ff6c5c 100644 --- a/RNSReloaded/BattlePatterns.cs +++ b/RNSReloaded/BattlePatterns.cs @@ -1064,6 +1064,15 @@ public void setgamespeed(CInstance* self, CInstance* other, int? spawnDelay = nu this.execute_pattern(self, other, "bp_setgamespeed", args); } + public void setgamespeed_temp(CInstance* self, CInstance* other, int? spawnDelay = null, int? eraseDelay = null, double? timeMult = null) { + RValue[] args = []; + args = this.utils.add_if_not_null(args, "timeMult", timeMult); + args = this.utils.add_if_not_null(args, "spawnDelay", spawnDelay); + args = this.utils.add_if_not_null(args, "eraseDelay", eraseDelay); + + this.execute_pattern(self, other, "bp_setgamespeed_temp", args); + } + public void setzoom(CInstance* self, CInstance* other, double? zoom = null) { RValue[] args = []; args = this.utils.add_if_not_null(args, "scale", zoom); @@ -1107,7 +1116,7 @@ public void showorder( } public void tailwind( - CInstance* self, CInstance* other, int? eraseDelay = null, int? spawnDelay = null, int? trgBinary = null, int? mult = null + CInstance* self, CInstance* other, int? eraseDelay = null, int? spawnDelay = null, int? trgBinary = null, double? mult = null ) { RValue[] args = []; args = this.utils.add_if_not_null(args, "eraseDelay", eraseDelay); @@ -1119,7 +1128,7 @@ public void tailwind( } public void tailwind_permanent( - CInstance* self, CInstance* other, int? spawnDelay = null, int? trgBinary = null, int? mult = null + CInstance* self, CInstance* other, int? spawnDelay = null, int? trgBinary = null, double? mult = null ) { RValue[] args = []; args = this.utils.add_if_not_null(args, "spawnDelay", spawnDelay); @@ -1129,6 +1138,29 @@ public void tailwind_permanent( this.execute_pattern(self, other, "bp_tailwind_permanent", args); } + public void teleport_dist( + CInstance* self, CInstance* other, int? spawnDelay = null, int? eraseDelay = null, int? type = null, Position[]? offsets = null + ) { + RValue[] args = []; + args = this.utils.add_if_not_null(args, "spawnDelay", spawnDelay); + args = this.utils.add_if_not_null(args, "eraseDelay", eraseDelay); + args = this.utils.add_if_not_null(args, "type", type); + + if (offsets == null) { + this.execute_pattern(self, other, "bp_teleport_dist", args); + return; + } + + var i = 0; + foreach (var pos in offsets) { + args = this.utils.add_if_not_null(args, "offX_" + i, pos.x); + args = this.utils.add_if_not_null(args, "offY_" + i, pos.y); + i += 1; + } + + this.execute_pattern(self, other, "bp_teleport_dist", args); + } + public void tether( CInstance* self, CInstance* other, int? warningDelay = null, int? spawnDelay = null, int? eraseDelay = null, double? radius = null, int? targetMask = null ) { diff --git a/RNSReloaded/RNSReloaded.cs b/RNSReloaded/RNSReloaded.cs index 3fb0ec7..2a0395e 100644 --- a/RNSReloaded/RNSReloaded.cs +++ b/RNSReloaded/RNSReloaded.cs @@ -110,6 +110,10 @@ public RFunctionStringRef GetTheFunction(int id) { return ret; } + public RValue* FindGlobalValue(string name) { + return this.FindValue(this.GetGlobalInstance(), name); + } + public RValue* ArrayGetEntry(RValue* array, int index) { if (array == null) return null; if (array->Type != RValueType.Array) return null; From e27b5f72749f24bd4d4d3b8d1c5958dbb2ae58c9 Mon Sep 17 00:00:00 2001 From: Babit Date: Thu, 25 Jun 2026 19:42:35 +0200 Subject: [PATCH 07/13] Add RValue string constructor --- RNSReloaded.Interfaces/Structs.cs | 23 +++++++++++++++-------- 1 file changed, 15 insertions(+), 8 deletions(-) diff --git a/RNSReloaded.Interfaces/Structs.cs b/RNSReloaded.Interfaces/Structs.cs index 7ee76d0..b859015 100644 --- a/RNSReloaded.Interfaces/Structs.cs +++ b/RNSReloaded.Interfaces/Structs.cs @@ -175,6 +175,13 @@ public RValue() { this.Flags = 0; } + public RValue(string value) { + this = IRNSReloaded.Instance.utils.CreateString(value) switch { + { } strR => strR, + null => new RValue(), + }; + } + public static implicit operator RValue(CInstance* obj) => new(obj); public static implicit operator RValue(int value) => new(value); public static implicit operator RValue(long value) => new(value); @@ -227,29 +234,29 @@ public unsafe struct LinkedList where T : unmanaged, ILinkedListElement { public Enumerator GetEnumerator() => new Enumerator(this); public struct Enumerator { - private LinkedList _list; - private T* Curr; + private LinkedList list; + private T* curr; private bool first; internal Enumerator(LinkedList list) { - this._list = list; - this.Curr = list.First; + this.list = list; + this.curr = list.First; this.first = true; } - public T* Current => this.Curr; + public T* Current => this.curr; // Contract says it should be run once before it points to first element public bool MoveNext() { if (!this.first) { - this.Curr = this.Curr->GetNext(); + this.curr = this.curr->GetNext(); } this.first = false; - return this.Curr != null; + return this.curr != null; } public void Reset() { - this.Curr = this._list.First; + this.curr = this.list.First; this.first = true; } From bed72e1e68c632aea20112df2cd24a176e2affe1 Mon Sep 17 00:00:00 2001 From: Babit Date: Sat, 27 Jun 2026 22:01:05 +0200 Subject: [PATCH 08/13] Add function for creating (or finding) new CInstance variables --- RNSReloaded.Interfaces/IRNSReloaded.cs | 1 + RNSReloaded.Interfaces/Structs.cs | 12 +++++++++++- RNSReloaded/Functions.cs | 4 ++++ RNSReloaded/RNSReloaded.cs | 7 +++++++ 4 files changed, 23 insertions(+), 1 deletion(-) diff --git a/RNSReloaded.Interfaces/IRNSReloaded.cs b/RNSReloaded.Interfaces/IRNSReloaded.cs index 9b2d2d1..bb36339 100644 --- a/RNSReloaded.Interfaces/IRNSReloaded.cs +++ b/RNSReloaded.Interfaces/IRNSReloaded.cs @@ -20,6 +20,7 @@ public unsafe interface IRNSReloaded { public RFunctionStringRef GetTheFunction(int id); public CInstance* GetGlobalInstance(); public RValue* FindValue(CInstance* instance, string name); + public RValue* FindAllocValue(CInstance* instance, string name); public RValue* FindGlobalValue(string name); public RValue* ArrayGetEntry(RValue* array, int index); public RValue? ArrayGetLength(RValue* array); diff --git a/RNSReloaded.Interfaces/Structs.cs b/RNSReloaded.Interfaces/Structs.cs index b859015..8f4e6fa 100644 --- a/RNSReloaded.Interfaces/Structs.cs +++ b/RNSReloaded.Interfaces/Structs.cs @@ -74,9 +74,19 @@ public unsafe struct RValue { return IRNSReloaded.Instance.FindValue(this.Object, key); } + public RValue* Set(string key, RValue value) { + if (this.Type != RValueType.Object) return null; + var retVal = IRNSReloaded.Instance.FindAllocValue(this.Object, key); + *retVal = value; + return retVal; + } + // Thanks C# for making indexing a pointer with a number impossible lol public RValue* this[int index] => this.Get(index); - public RValue* this[string key] => this.Get(key); + public RValue* this[string key] { + get => this.Get(key); + set => this.Set(key, *value); + } public override string ToString() { fixed (RValue* ptr = &this) { diff --git a/RNSReloaded/Functions.cs b/RNSReloaded/Functions.cs index e4f68e5..17908e6 100644 --- a/RNSReloaded/Functions.cs +++ b/RNSReloaded/Functions.cs @@ -11,6 +11,7 @@ public unsafe class Functions { public delegate byte CodeFunctionFindDelegate(char* name, int* id); public delegate void GetTheFunctionDelegate(int id, char** name, void** func, int* argumentCount); public delegate RValue* FindValueDelegate(CInstance* instance, char* name); + public delegate RValue* FindAllocValueDelegate(CInstance* instance, char* name); public delegate RValue* ArrayGetEntryDelegate(nint array, int index); public delegate char* YYGetStringDelegate(RValue* value, int unk); public delegate int StructGetKeysDelegate(RValue* value, char** keys, int* count); @@ -22,6 +23,7 @@ public unsafe class Functions { public CodeFunctionFindDelegate CodeFunctionFind = null!; public GetTheFunctionDelegate GetTheFunction = null!; public FindValueDelegate FindValue = null!; + public FindAllocValueDelegate FindAllocValue = null!; public ArrayGetEntryDelegate ArrayGetEntry = null!; public YYGetStringDelegate YYGetString = null!; public StructGetKeysDelegate StructGetKeys = null!; @@ -45,6 +47,8 @@ public Functions(ScanUtils utils, WeakReference scannerRef) { addr => { this.GetTheFunction = Marshal.GetDelegateForFunctionPointer(addr); }); this.utils.Scan("E8 ?? ?? ?? ?? 48 85 C0 74 ?? 83 78 ?? ?? 75 ?? ?? ?? ?? 48 8B CE E8 ?? ?? ?? ?? 4D 8B C7", addr => { this.FindValue = Marshal.GetDelegateForFunctionPointer(addr); }); + this.utils.Scan("E8 ?? ?? ?? ?? 8B D6 4C 8B F8", + addr => { this.FindAllocValue = Marshal.GetDelegateForFunctionPointer(addr); }); this.utils.Scan("40 53 56 48 83 EC ?? 48 63 F2", addr => { this.YYGetString = Marshal.GetDelegateForFunctionPointer(addr); }); this.utils.Scan("48 83 EC 38 48 89 74 24 ??", diff --git a/RNSReloaded/RNSReloaded.cs b/RNSReloaded/RNSReloaded.cs index 2a0395e..2456a64 100644 --- a/RNSReloaded/RNSReloaded.cs +++ b/RNSReloaded/RNSReloaded.cs @@ -110,6 +110,13 @@ public RFunctionStringRef GetTheFunction(int id) { return ret; } + public RValue* FindAllocValue(CInstance* instance, string name) { + var namePtr = Marshal.StringToHGlobalAnsi(name); + var ret = this.functions.FindAllocValue(instance, (char*) namePtr); + Marshal.FreeHGlobal(namePtr); + return ret; + } + public RValue* FindGlobalValue(string name) { return this.FindValue(this.GetGlobalInstance(), name); } From a533a5d030119cccbc0c11dd7d00733ff291cc4c Mon Sep 17 00:00:00 2001 From: Babit Date: Sat, 27 Jun 2026 23:58:59 +0200 Subject: [PATCH 09/13] Revert execute_pattern and add_if_not_null becoming public --- RNSReloaded.Interfaces/IBattlePatterns.cs | 2 - RNSReloaded.Interfaces/Util.cs | 6 - RNSReloaded/BattlePatterns.cs | 769 +++++++++++----------- RNSReloaded/Util.cs | 21 - 4 files changed, 395 insertions(+), 403 deletions(-) diff --git a/RNSReloaded.Interfaces/IBattlePatterns.cs b/RNSReloaded.Interfaces/IBattlePatterns.cs index ff13280..a227ef4 100644 --- a/RNSReloaded.Interfaces/IBattlePatterns.cs +++ b/RNSReloaded.Interfaces/IBattlePatterns.cs @@ -109,8 +109,6 @@ public void displaynumbers( public void enrage_deco(CInstance* self, CInstance* other, int? warningDelay = null, int? spawnDelay = null); - public void execute_pattern(CInstance* self, CInstance* other, string pattern, RValue[] args); - // (x, y) refers to the center of the field. Element is which color (purple, yellow, red, blue) public void fieldlimit_rectangle( CInstance* self, CInstance* other, Position? position = null, int? width = null, int? height = null, int? color = null, int? targetMask = null diff --git a/RNSReloaded.Interfaces/Util.cs b/RNSReloaded.Interfaces/Util.cs index f608bdf..3531e84 100644 --- a/RNSReloaded.Interfaces/Util.cs +++ b/RNSReloaded.Interfaces/Util.cs @@ -64,10 +64,4 @@ public unsafe interface IUtil { public void setHallway(List hallway, CInstance* self, IRNSReloaded rnsReloaded); - public RValue[] add_if_not_null(RValue[] args, string fieldName, int? value); - - public RValue[] add_if_not_null(RValue[] args, string fieldName, bool? value); - - public RValue[] add_if_not_null(RValue[] args, string fieldName, double? value); - } diff --git a/RNSReloaded/BattlePatterns.cs b/RNSReloaded/BattlePatterns.cs index 1ff6c5c..0aca952 100644 --- a/RNSReloaded/BattlePatterns.cs +++ b/RNSReloaded/BattlePatterns.cs @@ -59,13 +59,34 @@ void set_pattern_position_rotations(CInstance* self, CInstance* other, PosRot[] this.rnsReloaded.ExecuteScript("bpatt_posrot", self, other, args); } - public void execute_pattern(CInstance* self, CInstance* other, string pattern, RValue[] args) { + void execute_pattern(CInstance* self, CInstance* other, string pattern, RValue[] args) { this.rnsReloaded.ExecuteScript("bpatt_var", self, other, args); args = [new RValue(this.rnsReloaded.ScriptFindId(pattern))]; this.rnsReloaded.ExecuteScript("bpatt_add", self, other, args); this.rnsReloaded.ExecuteScript("bpatt_var_reset", self, other, []); } + private RValue[] add_if_not_null(RValue[] args, string fieldName, int? value) { + if (value != null) { + return args.Concat([this.utils.CreateString(fieldName)!.Value, new RValue(value.Value)]).ToArray(); + } + return args; + } + + private RValue[] add_if_not_null(RValue[] args, string fieldName, bool? value) { + if (value != null) { + return args.Concat([this.utils.CreateString(fieldName)!.Value, new RValue(value.Value)]).ToArray(); + } + return args; + } + + public RValue[] add_if_not_null(RValue[] args, string fieldName, double? value) { + if (value != null) { + return args.Concat([this.utils.CreateString(fieldName)!.Value, new RValue(value.Value)]).ToArray(); + } + return args; + } + public RValue? bpsw_circlespr_default(CInstance* self, CInstance* other, RValue scale) { return this.rnsReloaded.ExecuteScript("bpsw_circlespr_default", self, other, [scale]); } @@ -85,12 +106,12 @@ public void apply_hbs_synced( for (var i = 0; i < this.rnsReloaded.ArrayGetLength(hbsInfo)!.Value.Real; i++) { if (hbsInfo->Get(i)->Get(0)->ToString() == hbs) { RValue[] args = []; - args = this.utils.add_if_not_null(args, "delay", delay); - args = this.utils.add_if_not_null(args, "hbsHitDelay", hbsHitDelay); + args = this.add_if_not_null(args, "delay", delay); + args = this.add_if_not_null(args, "hbsHitDelay", hbsHitDelay); args = args.Concat([this.utils.CreateString("hbsIndex")!.Value, new RValue(i)]).ToArray(); - args = this.utils.add_if_not_null(args, "hbsDuration", hbsDuration); - args = this.utils.add_if_not_null(args, "hbsStrength", hbsStrength); - args = this.utils.add_if_not_null(args, "trgBinary", targetMask); + args = this.add_if_not_null(args, "hbsDuration", hbsDuration); + args = this.add_if_not_null(args, "hbsStrength", hbsStrength); + args = this.add_if_not_null(args, "trgBinary", targetMask); this.execute_pattern(self, other, "bp_apply_hbs_synced", args); break; @@ -102,10 +123,10 @@ public void bind_h( CInstance* self, CInstance* other, int? warningDelay = null, int? spawnDelay = null, int? eraseDelay = null, int? targetMask = null ) { RValue[] args = []; - args = this.utils.add_if_not_null(args, "warningDelay", warningDelay); - args = this.utils.add_if_not_null(args, "spawnDelay", spawnDelay); - args = this.utils.add_if_not_null(args, "eraseDelay", eraseDelay); - args = this.utils.add_if_not_null(args, "trgBinary", targetMask); + args = this.add_if_not_null(args, "warningDelay", warningDelay); + args = this.add_if_not_null(args, "spawnDelay", spawnDelay); + args = this.add_if_not_null(args, "eraseDelay", eraseDelay); + args = this.add_if_not_null(args, "trgBinary", targetMask); this.execute_pattern(self, other, "bp_bind_h", args); } @@ -114,22 +135,22 @@ public void bind_v( CInstance* self, CInstance* other, int? warningDelay = null, int? spawnDelay = null, int? eraseDelay = null, int? targetMask = null ) { RValue[] args = []; - args = this.utils.add_if_not_null(args, "warningDelay", warningDelay); - args = this.utils.add_if_not_null(args, "spawnDelay", spawnDelay); - args = this.utils.add_if_not_null(args, "eraseDelay", eraseDelay); - args = this.utils.add_if_not_null(args, "trgBinary", targetMask); + args = this.add_if_not_null(args, "warningDelay", warningDelay); + args = this.add_if_not_null(args, "spawnDelay", spawnDelay); + args = this.add_if_not_null(args, "eraseDelay", eraseDelay); + args = this.add_if_not_null(args, "trgBinary", targetMask); this.execute_pattern(self, other, "bp_bind_v", args); } public void bullet_enlarge(CInstance* self, CInstance* other, int? warningDelay = null, int? spawnDelay = null, int? timeBetween = null, double? scale = null, double? scaleInc = null, int? num = null, Position[]? positions = null) { RValue[] args = []; - args = this.utils.add_if_not_null(args, "warningDelay", warningDelay); - args = this.utils.add_if_not_null(args, "spawnDelay", spawnDelay); - args = this.utils.add_if_not_null(args, "timeBetween", timeBetween); - args = this.utils.add_if_not_null(args, "scale", scale); - args = this.utils.add_if_not_null(args, "scaleInc", scaleInc); - args = this.utils.add_if_not_null(args, "num", num); + args = this.add_if_not_null(args, "warningDelay", warningDelay); + args = this.add_if_not_null(args, "spawnDelay", spawnDelay); + args = this.add_if_not_null(args, "timeBetween", timeBetween); + args = this.add_if_not_null(args, "scale", scale); + args = this.add_if_not_null(args, "scaleInc", scaleInc); + args = this.add_if_not_null(args, "num", num); if (positions != null) { this.set_pattern_positions(self, other, positions); @@ -142,14 +163,14 @@ public void cardinal_r( CInstance* self, CInstance* other, int? warningDelay = null, int? warningDelay2 = null, int? displayNumber = null, int? spawnDelay = null, int? eraseDelay = null, Position? position = null, double? rot = null, int? speed = null, int? width = null ) { RValue[] args = []; - args = this.utils.add_if_not_null(args, "warningDelay", warningDelay); - args = this.utils.add_if_not_null(args, "warningDelay2", warningDelay2); - args = this.utils.add_if_not_null(args, "spawnDelay", spawnDelay); - args = this.utils.add_if_not_null(args, "eraseDelay", eraseDelay); - args = this.utils.add_if_not_null(args, "displayNumber", displayNumber); - args = this.utils.add_if_not_null(args, "rot", rot); - args = this.utils.add_if_not_null(args, "spd", speed); - args = this.utils.add_if_not_null(args, "width", width); + args = this.add_if_not_null(args, "warningDelay", warningDelay); + args = this.add_if_not_null(args, "warningDelay2", warningDelay2); + args = this.add_if_not_null(args, "spawnDelay", spawnDelay); + args = this.add_if_not_null(args, "eraseDelay", eraseDelay); + args = this.add_if_not_null(args, "displayNumber", displayNumber); + args = this.add_if_not_null(args, "rot", rot); + args = this.add_if_not_null(args, "spd", speed); + args = this.add_if_not_null(args, "width", width); if (position != null) { args = args.Concat([this.utils.CreateString("x")!.Value, new RValue(position.Value.x)]).ToArray(); @@ -163,9 +184,9 @@ public void circle_position( CInstance* self, CInstance* other, int? warningDelay = null, int? spawnDelay = null, int? radius = null, Position[]? positions = null ) { RValue[] args = []; - args = this.utils.add_if_not_null(args, "warningDelay", warningDelay); - args = this.utils.add_if_not_null(args, "spawnDelay", spawnDelay); - args = this.utils.add_if_not_null(args, "radius", radius); + args = this.add_if_not_null(args, "warningDelay", warningDelay); + args = this.add_if_not_null(args, "spawnDelay", spawnDelay); + args = this.add_if_not_null(args, "radius", radius); if (positions != null) { args = args.Concat([this.utils.CreateString("numPoints")!.Value, new RValue(positions.Length)]).ToArray(); @@ -185,11 +206,11 @@ public void circle_spreads( CInstance* self, CInstance* other, int? warningDelay = null, int? warnMsg = null, int? spawnDelay = null, int? radius = null, int? targetMask = null ) { RValue[] args = []; - args = this.utils.add_if_not_null(args, "warningDelay", warningDelay); - args = this.utils.add_if_not_null(args, "spawnDelay", spawnDelay); - args = this.utils.add_if_not_null(args, "warnMsg", warnMsg); - args = this.utils.add_if_not_null(args, "radius", radius); - args = this.utils.add_if_not_null(args, "trgBinary", targetMask); + args = this.add_if_not_null(args, "warningDelay", warningDelay); + args = this.add_if_not_null(args, "spawnDelay", spawnDelay); + args = this.add_if_not_null(args, "warnMsg", warnMsg); + args = this.add_if_not_null(args, "radius", radius); + args = this.add_if_not_null(args, "trgBinary", targetMask); this.execute_pattern(self, other, "bp_circle_spreads", args); } @@ -198,9 +219,9 @@ public void cleave( CInstance* self, CInstance* other, int? warningDelay = null, int? warnMsg = null, int? spawnDelay = null, (double rotation, int? targetMask)[]? cleaves = null ) { RValue[] args = []; - args = this.utils.add_if_not_null(args, "warningDelay", warningDelay); - args = this.utils.add_if_not_null(args, "spawnDelay", spawnDelay); - args = this.utils.add_if_not_null(args, "warnMsg", warnMsg); + args = this.add_if_not_null(args, "warningDelay", warningDelay); + args = this.add_if_not_null(args, "spawnDelay", spawnDelay); + args = this.add_if_not_null(args, "warnMsg", warnMsg); if (cleaves != null) { for (int i = 0; i < cleaves.Length; i++) { @@ -219,10 +240,10 @@ public void cleave_enemy( CInstance* self, CInstance* other, int? warningDelay = null, int? warnMsg = null, int? spawnDelay = null, int? angle = null ) { RValue[] args = []; - args = this.utils.add_if_not_null(args, "warningDelay", warningDelay); - args = this.utils.add_if_not_null(args, "spawnDelay", spawnDelay); - args = this.utils.add_if_not_null(args, "warnMsg", warnMsg); - args = this.utils.add_if_not_null(args, "rot", angle); + args = this.add_if_not_null(args, "warningDelay", warningDelay); + args = this.add_if_not_null(args, "spawnDelay", spawnDelay); + args = this.add_if_not_null(args, "warnMsg", warnMsg); + args = this.add_if_not_null(args, "rot", angle); this.execute_pattern(self, other, "bp_cleave_enemy", args); } @@ -231,9 +252,9 @@ public void cleave_fixed( CInstance* self, CInstance* other, int? warningDelay = null, int? warnMsg = null, int? spawnDelay = null, PosRot[]? positions = null ) { RValue[] args = []; - args = this.utils.add_if_not_null(args, "warningDelay", warningDelay); - args = this.utils.add_if_not_null(args, "spawnDelay", spawnDelay); - args = this.utils.add_if_not_null(args, "warnMsg", warnMsg); + args = this.add_if_not_null(args, "warningDelay", warningDelay); + args = this.add_if_not_null(args, "spawnDelay", spawnDelay); + args = this.add_if_not_null(args, "warnMsg", warnMsg); args = args.Concat([this.utils.CreateString("exTrgId")!.Value, new RValue(0)]).ToArray(); if (positions != null) { @@ -254,14 +275,14 @@ public void clockspot( CInstance* self, CInstance* other, int? warningDelay = null, int? warningDelay2 = null, int? warnMsg = null, int? displayNumber = null, int? spawnDelay = null, int? radius = null, int? fanAngle = null, Position? position = null, int? targetMask = null ) { RValue[] args = []; - args = this.utils.add_if_not_null(args, "warningDelay", warningDelay); - args = this.utils.add_if_not_null(args, "warningDelay2", warningDelay2); - args = this.utils.add_if_not_null(args, "spawnDelay", spawnDelay); - args = this.utils.add_if_not_null(args, "warnMsg", warnMsg); - args = this.utils.add_if_not_null(args, "displayNumber", displayNumber); - args = this.utils.add_if_not_null(args, "radius", radius); - args = this.utils.add_if_not_null(args, "fanAngle", fanAngle); - args = this.utils.add_if_not_null(args, "trgBinary", targetMask); + args = this.add_if_not_null(args, "warningDelay", warningDelay); + args = this.add_if_not_null(args, "warningDelay2", warningDelay2); + args = this.add_if_not_null(args, "spawnDelay", spawnDelay); + args = this.add_if_not_null(args, "warnMsg", warnMsg); + args = this.add_if_not_null(args, "displayNumber", displayNumber); + args = this.add_if_not_null(args, "radius", radius); + args = this.add_if_not_null(args, "fanAngle", fanAngle); + args = this.add_if_not_null(args, "trgBinary", targetMask); if (position != null) { args = args.Concat([this.utils.CreateString("x")!.Value, new RValue(position.Value.x)]).ToArray(); @@ -275,15 +296,15 @@ public void colormatch( CInstance* self, CInstance* other, int? warningDelay = null, int? warnMsg = null, int? spawnDelay = null, int? radius = null, int? targetMask = null, int? color = null, Position? position = null ) { RValue[] args = []; - args = this.utils.add_if_not_null(args, "warningDelay", warningDelay); - args = this.utils.add_if_not_null(args, "spawnDelay", spawnDelay); - args = this.utils.add_if_not_null(args, "warnMsg", warnMsg); - args = this.utils.add_if_not_null(args, "element", color); - args = this.utils.add_if_not_null(args, "trgBinary", targetMask); - args = this.utils.add_if_not_null(args, "radius", radius); + args = this.add_if_not_null(args, "warningDelay", warningDelay); + args = this.add_if_not_null(args, "spawnDelay", spawnDelay); + args = this.add_if_not_null(args, "warnMsg", warnMsg); + args = this.add_if_not_null(args, "element", color); + args = this.add_if_not_null(args, "trgBinary", targetMask); + args = this.add_if_not_null(args, "radius", radius); if (position != null) { - args = this.utils.add_if_not_null(args, "hasFixed", true); + args = this.add_if_not_null(args, "hasFixed", true); args = args.Concat([this.utils.CreateString("x")!.Value, new RValue(position.Value.x)]).ToArray(); args = args.Concat([this.utils.CreateString("y")!.Value, new RValue(position.Value.y)]).ToArray(); } @@ -295,19 +316,19 @@ public void colormatch2( CInstance* self, CInstance* other, int? warningDelay = null, int? warningDelay2 = null, int? warnMsg = null, int? spawnDelay = null, int? radius = null, int? targetMask = null, int? color = null, int? ringNum = null, int? displayNumber = null, Position? position = null ) { RValue[] args = []; - args = this.utils.add_if_not_null(args, "warningDelay", warningDelay); - args = this.utils.add_if_not_null(args, "warningDelay2", warningDelay2); - args = this.utils.add_if_not_null(args, "warnMsg", warnMsg); - args = this.utils.add_if_not_null(args, "spawnDelay", spawnDelay); + args = this.add_if_not_null(args, "warningDelay", warningDelay); + args = this.add_if_not_null(args, "warningDelay2", warningDelay2); + args = this.add_if_not_null(args, "warnMsg", warnMsg); + args = this.add_if_not_null(args, "spawnDelay", spawnDelay); - args = this.utils.add_if_not_null(args, "element", color); + args = this.add_if_not_null(args, "element", color); - args = this.utils.add_if_not_null(args, "radius", radius); - args = this.utils.add_if_not_null(args, "ringNum", ringNum); + args = this.add_if_not_null(args, "radius", radius); + args = this.add_if_not_null(args, "ringNum", ringNum); - args = this.utils.add_if_not_null(args, "trgBinary", targetMask); + args = this.add_if_not_null(args, "trgBinary", targetMask); - args = this.utils.add_if_not_null(args, "displayNumber", displayNumber); + args = this.add_if_not_null(args, "displayNumber", displayNumber); if (position != null) { args = args.Concat([this.utils.CreateString("x")!.Value, new RValue(position.Value.x)]).ToArray(); @@ -321,18 +342,18 @@ public void colormatch3( CInstance* self, CInstance* other, int? warningDelay = null, int? spawnDelay = null, int? timeBetween = null, int? timeExtra = null, int? color = null, int? radius = null, int? targetMask = null, Position[]? positions = null ) { RValue[] args = []; - args = this.utils.add_if_not_null(args, "warningDelay", warningDelay); - args = this.utils.add_if_not_null(args, "spawnDelay", spawnDelay); - args = this.utils.add_if_not_null(args, "timeBetween", timeBetween); - args = this.utils.add_if_not_null(args, "timeExtra", timeExtra); + args = this.add_if_not_null(args, "warningDelay", warningDelay); + args = this.add_if_not_null(args, "spawnDelay", spawnDelay); + args = this.add_if_not_null(args, "timeBetween", timeBetween); + args = this.add_if_not_null(args, "timeExtra", timeExtra); - args = this.utils.add_if_not_null(args, "element", color); + args = this.add_if_not_null(args, "element", color); - args = this.utils.add_if_not_null(args, "radius", radius); - args = this.utils.add_if_not_null(args, "trgBinary", targetMask); + args = this.add_if_not_null(args, "radius", radius); + args = this.add_if_not_null(args, "trgBinary", targetMask); if (positions != null) { - args = this.utils.add_if_not_null(args, "numPoints", positions.Length); + args = this.add_if_not_null(args, "numPoints", positions.Length); for (int i = 0; i < positions.Length; i++) { var position = positions[i]; args = args.Concat([this.utils.CreateString("posX_" + i)!.Value, new RValue(position.x)]).ToArray(); @@ -347,9 +368,9 @@ public void cone_direction( CInstance* self, CInstance* other, int? warningDelay = null, int? spawnDelay = null, int? fanAngle = null, Position? position = null, double[]? rots = null ) { RValue[] args = []; - args = this.utils.add_if_not_null(args, "warningDelay", warningDelay); - args = this.utils.add_if_not_null(args, "spawnDelay", spawnDelay); - args = this.utils.add_if_not_null(args, "fanAngle", fanAngle); + args = this.add_if_not_null(args, "warningDelay", warningDelay); + args = this.add_if_not_null(args, "spawnDelay", spawnDelay); + args = this.add_if_not_null(args, "fanAngle", fanAngle); if (position != null) { args = args.Concat([this.utils.CreateString("x")!.Value, new RValue(position.Value.x)]).ToArray(); @@ -373,11 +394,11 @@ public void cone_spreads( CInstance* self, CInstance* other, int? warningDelay = null, int? warnMsg = null, int? spawnDelay = null, int? fanAngle = null, Position? position = null, int? targetMask = null ) { RValue[] args = []; - args = this.utils.add_if_not_null(args, "warningDelay", warningDelay); - args = this.utils.add_if_not_null(args, "spawnDelay", spawnDelay); - args = this.utils.add_if_not_null(args, "warnMsg", warnMsg); - args = this.utils.add_if_not_null(args, "trgBinary", targetMask); - args = this.utils.add_if_not_null(args, "fanAngle", fanAngle); + args = this.add_if_not_null(args, "warningDelay", warningDelay); + args = this.add_if_not_null(args, "spawnDelay", spawnDelay); + args = this.add_if_not_null(args, "warnMsg", warnMsg); + args = this.add_if_not_null(args, "trgBinary", targetMask); + args = this.add_if_not_null(args, "fanAngle", fanAngle); if (position != null) { args = args.Concat([this.utils.CreateString("x")!.Value, new RValue(position.Value.x)]).ToArray(); @@ -391,9 +412,9 @@ public void dark2_cr_circle( CInstance* self, CInstance* other, int? spawnDelay = null, int? speed = null, int? angle = null, Position? position = null ) { RValue[] args = []; - args = this.utils.add_if_not_null(args, "spawnDelay", spawnDelay); - args = this.utils.add_if_not_null(args, "spd", speed); - args = this.utils.add_if_not_null(args, "angle", angle); + args = this.add_if_not_null(args, "spawnDelay", spawnDelay); + args = this.add_if_not_null(args, "spd", speed); + args = this.add_if_not_null(args, "angle", angle); if (position != null) { args = args.Concat([this.utils.CreateString("x")!.Value, new RValue(position.Value.x)]).ToArray(); @@ -408,10 +429,10 @@ public void dark_targeted( ) { RValue[] args = []; - args = this.utils.add_if_not_null(args, "warningDelay", warningDelay); - args = this.utils.add_if_not_null(args, "spawnDelay", spawnDelay); - args = this.utils.add_if_not_null(args, "eraseDelay", eraseDelay); - args = this.utils.add_if_not_null(args, "scale", scale); + args = this.add_if_not_null(args, "warningDelay", warningDelay); + args = this.add_if_not_null(args, "spawnDelay", spawnDelay); + args = this.add_if_not_null(args, "eraseDelay", eraseDelay); + args = this.add_if_not_null(args, "scale", scale); if (positions != null) { args = args.Concat([this.utils.CreateString("numPoints")!.Value, new RValue(positions.Length)]).ToArray(); @@ -429,8 +450,8 @@ public void dark_targeted( public void dialog(CInstance* self, CInstance* other, int? time, int? dialogIndex0) { RValue[] args = []; - args = this.utils.add_if_not_null(args, "time", time); - args = this.utils.add_if_not_null(args, "dialogInd0", dialogIndex0); + args = this.add_if_not_null(args, "time", time); + args = this.add_if_not_null(args, "dialogInd0", dialogIndex0); this.execute_pattern(self, other, "bp_dialog", args); } @@ -441,9 +462,9 @@ public void displaynumbers( ) { RValue[] args = []; - args = this.utils.add_if_not_null(args, "warningDelay", warningDelay); - args = this.utils.add_if_not_null(args, "spawnDelay", spawnDelay); - args = this.utils.add_if_not_null(args, "displayNumber", displayNumber); + args = this.add_if_not_null(args, "warningDelay", warningDelay); + args = this.add_if_not_null(args, "spawnDelay", spawnDelay); + args = this.add_if_not_null(args, "displayNumber", displayNumber); if (positions != null) { args = args.Concat([this.utils.CreateString("numPoints")!.Value, new RValue(positions.Length)]).ToArray(); @@ -460,9 +481,9 @@ public void displaynumbers( public void enrage(CInstance* self, CInstance* other, int? warningDelay = null, int? spawnDelay = null, int? timeBetween = null, bool? resetAnim = null) { RValue[] args = []; - args = this.utils.add_if_not_null(args, "warningDelay", warningDelay); - args = this.utils.add_if_not_null(args, "spawnDelay", spawnDelay); - args = this.utils.add_if_not_null(args, "timeBetween", timeBetween); + args = this.add_if_not_null(args, "warningDelay", warningDelay); + args = this.add_if_not_null(args, "spawnDelay", spawnDelay); + args = this.add_if_not_null(args, "timeBetween", timeBetween); if (resetAnim != null) { args = args.Concat([this.utils.CreateString("resetAnim")!.Value, new RValue(resetAnim == true ? 1.0 : 0.0)]).ToArray(); // Using a bool here doesnt work, no idea why @@ -473,8 +494,8 @@ public void enrage(CInstance* self, CInstance* other, int? warningDelay = null, public void enrage_deco(CInstance* self, CInstance* other, int? warningDelay = null, int? spawnDelay = null) { RValue[] args = []; - args = this.utils.add_if_not_null(args, "warningDelay", warningDelay); - args = this.utils.add_if_not_null(args, "spawnDelay", spawnDelay); + args = this.add_if_not_null(args, "warningDelay", warningDelay); + args = this.add_if_not_null(args, "spawnDelay", spawnDelay); this.execute_pattern(self, other, "bp_enrage_deco", args); } @@ -485,10 +506,10 @@ public void fieldlimit_rectangle( ) { RValue[] args = []; - args = this.utils.add_if_not_null(args, "height", height); - args = this.utils.add_if_not_null(args, "width", width); - args = this.utils.add_if_not_null(args, "trgBinary", targetMask); - args = this.utils.add_if_not_null(args, "element", color); + args = this.add_if_not_null(args, "height", height); + args = this.add_if_not_null(args, "width", width); + args = this.add_if_not_null(args, "trgBinary", targetMask); + args = this.add_if_not_null(args, "element", color); if (position != null) { args = args.Concat([this.utils.CreateString("x")!.Value, new RValue(position.Value.x)]).ToArray(); @@ -502,11 +523,11 @@ public void fieldlimit_rectangle_temporary( CInstance* self, CInstance* other, Position? position = null, int? width = null, int? height = null, int? color = null, int? targetMask = null, int? eraseDelay = null ) { RValue[] args = []; - args = this.utils.add_if_not_null(args, "height", height); - args = this.utils.add_if_not_null(args, "width", width); - args = this.utils.add_if_not_null(args, "trgBinary", targetMask); - args = this.utils.add_if_not_null(args, "element", color); - args = this.utils.add_if_not_null(args, "eraseDelay", eraseDelay); + args = this.add_if_not_null(args, "height", height); + args = this.add_if_not_null(args, "width", width); + args = this.add_if_not_null(args, "trgBinary", targetMask); + args = this.add_if_not_null(args, "element", color); + args = this.add_if_not_null(args, "eraseDelay", eraseDelay); if (position != null) { args = args.Concat([this.utils.CreateString("x")!.Value, new RValue(position.Value.x)]).ToArray(); @@ -520,10 +541,10 @@ public void fire_aoe( CInstance* self, CInstance* other, int? warningDelay = null, int? spawnDelay = null, int? eraseDelay = null, double? scale = null, Position[]? positions = null ) { RValue[] args = []; - args = this.utils.add_if_not_null(args, "warningDelay", warningDelay); - args = this.utils.add_if_not_null(args, "spawnDelay", spawnDelay); - args = this.utils.add_if_not_null(args, "eraseDelay", eraseDelay); - args = this.utils.add_if_not_null(args, "scale", scale); + args = this.add_if_not_null(args, "warningDelay", warningDelay); + args = this.add_if_not_null(args, "spawnDelay", spawnDelay); + args = this.add_if_not_null(args, "eraseDelay", eraseDelay); + args = this.add_if_not_null(args, "scale", scale); //this.utils.CreateString("type")!.Value, new RValue(type), if (positions != null) { @@ -554,14 +575,14 @@ public void fire2_line( int? lineLength = null, int? numBullets = null, int? spd = null ) { RValue[] args = []; - args = this.utils.add_if_not_null(args, "warningDelay", warningDelay); - args = this.utils.add_if_not_null(args, "spawnDelay", spawnDelay); - args = this.utils.add_if_not_null(args, "showWarning", showWarning); - args = this.utils.add_if_not_null(args, "angle", angle); - args = this.utils.add_if_not_null(args, "lineAngle", lineAngle); - args = this.utils.add_if_not_null(args, "num", numBullets); - args = this.utils.add_if_not_null(args, "lineLength", lineLength); - args = this.utils.add_if_not_null(args, "spd", spd); + args = this.add_if_not_null(args, "warningDelay", warningDelay); + args = this.add_if_not_null(args, "spawnDelay", spawnDelay); + args = this.add_if_not_null(args, "showWarning", showWarning); + args = this.add_if_not_null(args, "angle", angle); + args = this.add_if_not_null(args, "lineAngle", lineAngle); + args = this.add_if_not_null(args, "num", numBullets); + args = this.add_if_not_null(args, "lineLength", lineLength); + args = this.add_if_not_null(args, "spd", spd); if (position != null) { args = args.Concat([this.utils.CreateString("x")!.Value, new RValue(position.Value.x)]).ToArray(); @@ -575,7 +596,7 @@ public void gravity_fall( CInstance* self, CInstance* other, double? mult = null ) { RValue[] args = []; - args = this.utils.add_if_not_null(args, "mult", mult); + args = this.add_if_not_null(args, "mult", mult); this.execute_pattern(self, other, "bp_gravity_fall", args); } @@ -584,10 +605,10 @@ public void gravity_fall_temporary( CInstance* self, CInstance* other, int? spawnDelay = null, int? eraseDelay = null, double? mult = null, int? targetMask = null ) { RValue[] args = []; - args = this.utils.add_if_not_null(args, "spawnDelay", spawnDelay); - args = this.utils.add_if_not_null(args, "eraseDelay", eraseDelay); - args = this.utils.add_if_not_null(args, "trgBinary", targetMask); - args = this.utils.add_if_not_null(args, "mult", mult); + args = this.add_if_not_null(args, "spawnDelay", spawnDelay); + args = this.add_if_not_null(args, "eraseDelay", eraseDelay); + args = this.add_if_not_null(args, "trgBinary", targetMask); + args = this.add_if_not_null(args, "mult", mult); this.execute_pattern(self, other, "bp_gravity_fall_temporary", args); } @@ -596,7 +617,7 @@ public void gravity_pull( CInstance* self, CInstance* other, double? mult = null, Position? position = null ) { RValue[] args = []; - args = this.utils.add_if_not_null(args, "mult", mult); + args = this.add_if_not_null(args, "mult", mult); if (position != null) { args = args.Concat([this.utils.CreateString("x")!.Value, new RValue(position.Value.x)]).ToArray(); @@ -610,10 +631,10 @@ public void gravity_pull_temporary( CInstance* self, CInstance* other, int? spawnDelay = null, int? eraseDelay = null, double? mult = null, int? targetMask = null, Position? position = null ) { RValue[] args = []; - args = this.utils.add_if_not_null(args, "spawnDelay", spawnDelay); - args = this.utils.add_if_not_null(args, "eraseDelay", eraseDelay); - args = this.utils.add_if_not_null(args, "trgBinary", targetMask); - args = this.utils.add_if_not_null(args, "mult", mult); + args = this.add_if_not_null(args, "spawnDelay", spawnDelay); + args = this.add_if_not_null(args, "eraseDelay", eraseDelay); + args = this.add_if_not_null(args, "trgBinary", targetMask); + args = this.add_if_not_null(args, "mult", mult); if (position != null) { args = args.Concat([this.utils.CreateString("x")!.Value, new RValue(position.Value.x)]).ToArray(); @@ -627,7 +648,7 @@ public void heavy( CInstance* self, CInstance* other, int? targetMask = null ) { RValue[] args = []; - args = this.utils.add_if_not_null(args, "trgBinary", targetMask); + args = this.add_if_not_null(args, "trgBinary", targetMask); this.execute_pattern(self, other, "bp_heavy", args); } @@ -636,9 +657,9 @@ public void heavy_temporary( CInstance* self, CInstance* other, int? spawnDelay = null, int? hbsDuration = null, int? targetMask = null ) { RValue[] args = []; - args = this.utils.add_if_not_null(args, "spawnDelay", spawnDelay); - args = this.utils.add_if_not_null(args, "hbsDuration", hbsDuration); - args = this.utils.add_if_not_null(args, "trgBinary", targetMask); + args = this.add_if_not_null(args, "spawnDelay", spawnDelay); + args = this.add_if_not_null(args, "hbsDuration", hbsDuration); + args = this.add_if_not_null(args, "trgBinary", targetMask); this.execute_pattern(self, other, "bp_heavy_temporary", args); } @@ -647,7 +668,7 @@ public void heavyextra( CInstance* self, CInstance* other, int? targetMask = null ) { RValue[] args = []; - args = this.utils.add_if_not_null(args, "trgBinary", targetMask); + args = this.add_if_not_null(args, "trgBinary", targetMask); this.execute_pattern(self, other, "bp_heavyextra", args); } @@ -656,9 +677,9 @@ public void heavyextra_temporary( CInstance* self, CInstance* other, int? spawnDelay = null, int? hbsDuration = null, int? targetMask = null ) { RValue[] args = []; - args = this.utils.add_if_not_null(args, "spawnDelay", spawnDelay); - args = this.utils.add_if_not_null(args, "hbsDuration", hbsDuration); - args = this.utils.add_if_not_null(args, "trgBinary", targetMask); + args = this.add_if_not_null(args, "spawnDelay", spawnDelay); + args = this.add_if_not_null(args, "hbsDuration", hbsDuration); + args = this.add_if_not_null(args, "trgBinary", targetMask); this.execute_pattern(self, other, "bp_heavyextra_temporary", args); } @@ -667,8 +688,8 @@ public void invulncancel( CInstance* self, CInstance* other, int? delay = null, int? targetMask = null ) { RValue[] args = []; - args = this.utils.add_if_not_null(args, "delay", delay); - args = this.utils.add_if_not_null(args, "trgBinary", targetMask); + args = this.add_if_not_null(args, "delay", delay); + args = this.add_if_not_null(args, "trgBinary", targetMask); this.execute_pattern(self, other, "bp_invulncancel", args); } @@ -678,13 +699,13 @@ public void knockback_circle( Position? position = null ) { RValue[] args = []; - args = this.utils.add_if_not_null(args, "warningDelay", warningDelay); - args = this.utils.add_if_not_null(args, "warnMsg", warnMsg); - args = this.utils.add_if_not_null(args, "spawnDelay", spawnDelay); - args = this.utils.add_if_not_null(args, "trgBinary", targetMask); - args = this.utils.add_if_not_null(args, "radius", radius); - args = this.utils.add_if_not_null(args, "kbAmount", kbAmount); - args = this.utils.add_if_not_null(args, "lifespan", kbDuration); + args = this.add_if_not_null(args, "warningDelay", warningDelay); + args = this.add_if_not_null(args, "warnMsg", warnMsg); + args = this.add_if_not_null(args, "spawnDelay", spawnDelay); + args = this.add_if_not_null(args, "trgBinary", targetMask); + args = this.add_if_not_null(args, "radius", radius); + args = this.add_if_not_null(args, "kbAmount", kbAmount); + args = this.add_if_not_null(args, "lifespan", kbDuration); if (position != null) { args = args.Concat([this.utils.CreateString("x")!.Value, new RValue(position.Value.x)]).ToArray(); @@ -698,13 +719,13 @@ public void knockback_line( CInstance* self, CInstance* other, int? warningDelay = null, int? warnMsg = null, int? spawnDelay = null, int? kbAmount = null, Position? position = null, bool? horizontal = null, int? kbDuration = null, int? targetMask = null ) { RValue[] args = []; - args = this.utils.add_if_not_null(args, "warningDelay", warningDelay); - args = this.utils.add_if_not_null(args, "warnMsg", warnMsg); - args = this.utils.add_if_not_null(args, "spawnDelay", spawnDelay); - args = this.utils.add_if_not_null(args, "trgBinary", targetMask); - args = this.utils.add_if_not_null(args, "kbAmount", kbAmount); - args = this.utils.add_if_not_null(args, "horizontal", horizontal); - args = this.utils.add_if_not_null(args, "lifespan", kbDuration); + args = this.add_if_not_null(args, "warningDelay", warningDelay); + args = this.add_if_not_null(args, "warnMsg", warnMsg); + args = this.add_if_not_null(args, "spawnDelay", spawnDelay); + args = this.add_if_not_null(args, "trgBinary", targetMask); + args = this.add_if_not_null(args, "kbAmount", kbAmount); + args = this.add_if_not_null(args, "horizontal", horizontal); + args = this.add_if_not_null(args, "lifespan", kbDuration); if (position != null) { args = args.Concat([this.utils.CreateString("x")!.Value, new RValue(position.Value.x)]).ToArray(); @@ -719,9 +740,9 @@ public void light_crosswave( Position? position = null ) { RValue[] args = []; - args = this.utils.add_if_not_null(args, "warningDelay", warningDelay); - args = this.utils.add_if_not_null(args, "spawnDelay", spawnDelay); - args = this.utils.add_if_not_null(args, "angle", rotation); // number + args = this.add_if_not_null(args, "warningDelay", warningDelay); + args = this.add_if_not_null(args, "spawnDelay", spawnDelay); + args = this.add_if_not_null(args, "angle", rotation); // number if (position != null) { args = args.Concat([this.utils.CreateString("x")!.Value, new RValue(position.Value.x)]).ToArray(); @@ -735,15 +756,15 @@ public void light_line( CInstance* self, CInstance* other, int? warningDelay = null, int? spawnDelay = null, Position? position = null, int? lineAngle = 0, int? angle = null, int? spd = null, int? lineLength = null, int? numBullets = null, int? type = null, bool? showWarning = null ) { RValue[] args = []; - args = this.utils.add_if_not_null(args, "warningDelay", warningDelay); - args = this.utils.add_if_not_null(args, "spawnDelay", spawnDelay); - args = this.utils.add_if_not_null(args, "angle", angle); - args = this.utils.add_if_not_null(args, "spd", spd); - args = this.utils.add_if_not_null(args, "lineAngle", lineAngle); - args = this.utils.add_if_not_null(args, "lineLength", lineLength); - args = this.utils.add_if_not_null(args, "num", numBullets); - args = this.utils.add_if_not_null(args, "type", type); - args = this.utils.add_if_not_null(args, "showWarning", showWarning); + args = this.add_if_not_null(args, "warningDelay", warningDelay); + args = this.add_if_not_null(args, "spawnDelay", spawnDelay); + args = this.add_if_not_null(args, "angle", angle); + args = this.add_if_not_null(args, "spd", spd); + args = this.add_if_not_null(args, "lineAngle", lineAngle); + args = this.add_if_not_null(args, "lineLength", lineLength); + args = this.add_if_not_null(args, "num", numBullets); + args = this.add_if_not_null(args, "type", type); + args = this.add_if_not_null(args, "showWarning", showWarning); if (position != null) { args = args.Concat([this.utils.CreateString("x")!.Value, new RValue(position.Value.x)]).ToArray(); @@ -757,9 +778,9 @@ public void line_direction( CInstance* self, CInstance* other, int? warningDelay = null, int? spawnDelay = null, int? width = null, PosRot[]? positions = null ) { RValue[] args = []; - args = this.utils.add_if_not_null(args, "warningDelay", warningDelay); - args = this.utils.add_if_not_null(args, "spawnDelay", spawnDelay); - args = this.utils.add_if_not_null(args, "width", width); + args = this.add_if_not_null(args, "warningDelay", warningDelay); + args = this.add_if_not_null(args, "spawnDelay", spawnDelay); + args = this.add_if_not_null(args, "width", width); if (positions != null) { args = args.Concat([this.utils.CreateString("numLines")!.Value, new RValue(positions.Length)]).ToArray(); @@ -781,11 +802,11 @@ public void line_spreads_h( CInstance* self, CInstance* other, int? warningDelay = null, int? warnMsg = null, int? spawnDelay = null, int? width = null, int? targetMask = null ) { RValue[] args = []; - args = this.utils.add_if_not_null(args, "warningDelay", warningDelay); - args = this.utils.add_if_not_null(args, "spawnDelay", spawnDelay); - args = this.utils.add_if_not_null(args, "width", width); - args = this.utils.add_if_not_null(args, "warnMsg", warnMsg); - args = this.utils.add_if_not_null(args, "trgBinary", targetMask); + args = this.add_if_not_null(args, "warningDelay", warningDelay); + args = this.add_if_not_null(args, "spawnDelay", spawnDelay); + args = this.add_if_not_null(args, "width", width); + args = this.add_if_not_null(args, "warnMsg", warnMsg); + args = this.add_if_not_null(args, "trgBinary", targetMask); this.execute_pattern(self, other, "bp_line_spreads_h", args); } @@ -794,24 +815,24 @@ public void line_spreads_v( CInstance* self, CInstance* other, int? warningDelay = null, int? warnMsg = null, int? spawnDelay = null, int? width = null, int? targetMask = null ) { RValue[] args = []; - args = this.utils.add_if_not_null(args, "warningDelay", warningDelay); - args = this.utils.add_if_not_null(args, "spawnDelay", spawnDelay); - args = this.utils.add_if_not_null(args, "width", width); - args = this.utils.add_if_not_null(args, "warnMsg", warnMsg); - args = this.utils.add_if_not_null(args, "trgBinary", targetMask); + args = this.add_if_not_null(args, "warningDelay", warningDelay); + args = this.add_if_not_null(args, "spawnDelay", spawnDelay); + args = this.add_if_not_null(args, "width", width); + args = this.add_if_not_null(args, "warnMsg", warnMsg); + args = this.add_if_not_null(args, "trgBinary", targetMask); this.execute_pattern(self, other, "bp_line_spreads_v", args); } public void marching_bullet(CInstance* self, CInstance* other, int? warningDelay = null, int? spawnDelay = null, int? timeBetween = null, double? scale = null, Position[]? positions = null) { RValue[] args = []; - args = this.utils.add_if_not_null(args, "warningDelay", warningDelay); - args = this.utils.add_if_not_null(args, "spawnDelay", spawnDelay); - args = this.utils.add_if_not_null(args, "timeBetween", timeBetween); - args = this.utils.add_if_not_null(args, "scale", scale); + args = this.add_if_not_null(args, "warningDelay", warningDelay); + args = this.add_if_not_null(args, "spawnDelay", spawnDelay); + args = this.add_if_not_null(args, "timeBetween", timeBetween); + args = this.add_if_not_null(args, "scale", scale); if (positions != null) { - args = this.utils.add_if_not_null(args, "numPoints", positions.Length); + args = this.add_if_not_null(args, "numPoints", positions.Length); for (int i = 0; i < positions.Length; i++) { args = args.Concat([ this.utils.CreateString($"posX_{i}")!.Value, new RValue(positions[i].x), @@ -826,12 +847,12 @@ public void movementcheck( CInstance* self, CInstance* other, int? warningDelay = null, int? warnMsg = null, int? spawnDelay = null, bool? shouldMove = null, int? radius = null, int? targetMask = null ) { RValue[] args = []; - args = this.utils.add_if_not_null(args, "warningDelay", warningDelay); - args = this.utils.add_if_not_null(args, "spawnDelay", spawnDelay); - args = this.utils.add_if_not_null(args, "warnMsg", warnMsg); - args = this.utils.add_if_not_null(args, "trgBinary", targetMask); - args = this.utils.add_if_not_null(args, "shouldMove", shouldMove); - args = this.utils.add_if_not_null(args, "radius", radius); + args = this.add_if_not_null(args, "warningDelay", warningDelay); + args = this.add_if_not_null(args, "spawnDelay", spawnDelay); + args = this.add_if_not_null(args, "warnMsg", warnMsg); + args = this.add_if_not_null(args, "trgBinary", targetMask); + args = this.add_if_not_null(args, "shouldMove", shouldMove); + args = this.add_if_not_null(args, "radius", radius); this.execute_pattern(self, other, "bp_movementcheck", args); } @@ -840,9 +861,9 @@ public void move_position_synced( CInstance* self, CInstance* other, int? spawnDelay = null, bool? resetAnim = null, int? duration = null, Position? position = null ) { RValue[] args = []; - args = this.utils.add_if_not_null(args, "spawnDelay", spawnDelay); - args = this.utils.add_if_not_null(args, "resetAnim", resetAnim); - args = this.utils.add_if_not_null(args, "duration", duration); + args = this.add_if_not_null(args, "spawnDelay", spawnDelay); + args = this.add_if_not_null(args, "resetAnim", resetAnim); + args = this.add_if_not_null(args, "duration", duration); if (position != null) { args = args.Concat([this.utils.CreateString("x")!.Value, new RValue(position.Value.x)]).ToArray(); @@ -868,16 +889,16 @@ public void prscircle( ) { RValue[] args = []; - args = this.utils.add_if_not_null(args, "warningDelay", warningDelay); - args = this.utils.add_if_not_null(args, "warnMsg", warnMsg); - args = this.utils.add_if_not_null(args, "displayNumber", displayNumber); - args = this.utils.add_if_not_null(args, "element", bulletType); - args = this.utils.add_if_not_null(args, "doubled", doubled); - args = this.utils.add_if_not_null(args, "spawnDelay", spawnDelay); - args = this.utils.add_if_not_null(args, "radius", radius); - args = this.utils.add_if_not_null(args, "number", numBullets); - args = this.utils.add_if_not_null(args, "spd", speed); - args = this.utils.add_if_not_null(args, "angle", angle); + args = this.add_if_not_null(args, "warningDelay", warningDelay); + args = this.add_if_not_null(args, "warnMsg", warnMsg); + args = this.add_if_not_null(args, "displayNumber", displayNumber); + args = this.add_if_not_null(args, "element", bulletType); + args = this.add_if_not_null(args, "doubled", doubled); + args = this.add_if_not_null(args, "spawnDelay", spawnDelay); + args = this.add_if_not_null(args, "radius", radius); + args = this.add_if_not_null(args, "number", numBullets); + args = this.add_if_not_null(args, "spd", speed); + args = this.add_if_not_null(args, "angle", angle); if (position != null) { args = args.Concat([this.utils.CreateString("x")!.Value, new RValue(position.Value.x)]).ToArray(); @@ -891,15 +912,15 @@ public void prscircle_follow( CInstance* self, CInstance* other, int? warningDelay = null, int? warnMsg = null, int? bulletType = null, bool? doubled = null, int? spawnDelay = null, int? radius = null, int? numBullets = null, int? speed = null, int? targetId = null ) { RValue[] args = []; - args = this.utils.add_if_not_null(args, "warningDelay", warningDelay); - args = this.utils.add_if_not_null(args, "warnMsg", warnMsg); - args = this.utils.add_if_not_null(args, "element", bulletType); - args = this.utils.add_if_not_null(args, "doubled", doubled); - args = this.utils.add_if_not_null(args, "spawnDelay", spawnDelay); - args = this.utils.add_if_not_null(args, "radius", radius); - args = this.utils.add_if_not_null(args, "number", numBullets); - args = this.utils.add_if_not_null(args, "spd", speed); - args = this.utils.add_if_not_null(args, "targetId", targetId); + args = this.add_if_not_null(args, "warningDelay", warningDelay); + args = this.add_if_not_null(args, "warnMsg", warnMsg); + args = this.add_if_not_null(args, "element", bulletType); + args = this.add_if_not_null(args, "doubled", doubled); + args = this.add_if_not_null(args, "spawnDelay", spawnDelay); + args = this.add_if_not_null(args, "radius", radius); + args = this.add_if_not_null(args, "number", numBullets); + args = this.add_if_not_null(args, "spd", speed); + args = this.add_if_not_null(args, "targetId", targetId); this.execute_pattern(self, other, "bp_prscircle_follow", args); } @@ -909,15 +930,15 @@ public void prscircle_follow_bin( ) { RValue[] args = []; - args = this.utils.add_if_not_null(args, "warningDelay", warningDelay); - args = this.utils.add_if_not_null(args, "warnMsg", warnMsg); - args = this.utils.add_if_not_null(args, "element", bulletType); - args = this.utils.add_if_not_null(args, "doubled", doubled); - args = this.utils.add_if_not_null(args, "spawnDelay", spawnDelay); - args = this.utils.add_if_not_null(args, "radius", radius); - args = this.utils.add_if_not_null(args, "number", numBullets); - args = this.utils.add_if_not_null(args, "spd", speed); - args = this.utils.add_if_not_null(args, "trgBinary", targetMask); + args = this.add_if_not_null(args, "warningDelay", warningDelay); + args = this.add_if_not_null(args, "warnMsg", warnMsg); + args = this.add_if_not_null(args, "element", bulletType); + args = this.add_if_not_null(args, "doubled", doubled); + args = this.add_if_not_null(args, "spawnDelay", spawnDelay); + args = this.add_if_not_null(args, "radius", radius); + args = this.add_if_not_null(args, "number", numBullets); + args = this.add_if_not_null(args, "spd", speed); + args = this.add_if_not_null(args, "trgBinary", targetMask); this.execute_pattern(self, other, "bp_prscircle_follow_bin", args); } @@ -926,16 +947,16 @@ public void prsline_h( CInstance* self, CInstance* other, int? warningDelay = null, int? warnMsg = null, int? displayNumber = null, int? bulletType = null, bool? doubled = null, int? spawnDelay = null, int? width = null, int? offset = null, int? speed = null, double? yPosition = null ) { RValue[] args = []; - args = this.utils.add_if_not_null(args, "warningDelay", warningDelay); - args = this.utils.add_if_not_null(args, "warnMsg", warnMsg); - args = this.utils.add_if_not_null(args, "displayNumber", displayNumber); - args = this.utils.add_if_not_null(args, "element", bulletType); - args = this.utils.add_if_not_null(args, "doubled", doubled); - args = this.utils.add_if_not_null(args, "spawnDelay", spawnDelay); - args = this.utils.add_if_not_null(args, "width", width); - args = this.utils.add_if_not_null(args, "offset", offset); - args = this.utils.add_if_not_null(args, "spd", speed); - args = this.utils.add_if_not_null(args, "y", yPosition); + args = this.add_if_not_null(args, "warningDelay", warningDelay); + args = this.add_if_not_null(args, "warnMsg", warnMsg); + args = this.add_if_not_null(args, "displayNumber", displayNumber); + args = this.add_if_not_null(args, "element", bulletType); + args = this.add_if_not_null(args, "doubled", doubled); + args = this.add_if_not_null(args, "spawnDelay", spawnDelay); + args = this.add_if_not_null(args, "width", width); + args = this.add_if_not_null(args, "offset", offset); + args = this.add_if_not_null(args, "spd", speed); + args = this.add_if_not_null(args, "y", yPosition); this.execute_pattern(self, other, "bp_prsline_h", args); } @@ -944,16 +965,16 @@ public void prsline_h_follow( CInstance* self, CInstance* other, int? warningDelay = null, int? warnMsg = null, int? displayNumber = null, int? bulletType = null, bool? doubled = null, int? spawnDelay = null, int? width = null, int? offset = null, int? speed = null, int? targetId = null ) { RValue[] args = []; - args = this.utils.add_if_not_null(args, "warningDelay", warningDelay); - args = this.utils.add_if_not_null(args, "warnMsg", warnMsg); - args = this.utils.add_if_not_null(args, "displayNumber", displayNumber); - args = this.utils.add_if_not_null(args, "element", bulletType); - args = this.utils.add_if_not_null(args, "doubled", doubled); - args = this.utils.add_if_not_null(args, "spawnDelay", spawnDelay); - args = this.utils.add_if_not_null(args, "width", width); - args = this.utils.add_if_not_null(args, "offset", offset); - args = this.utils.add_if_not_null(args, "spd", speed); - args = this.utils.add_if_not_null(args, "targetId", targetId); + args = this.add_if_not_null(args, "warningDelay", warningDelay); + args = this.add_if_not_null(args, "warnMsg", warnMsg); + args = this.add_if_not_null(args, "displayNumber", displayNumber); + args = this.add_if_not_null(args, "element", bulletType); + args = this.add_if_not_null(args, "doubled", doubled); + args = this.add_if_not_null(args, "spawnDelay", spawnDelay); + args = this.add_if_not_null(args, "width", width); + args = this.add_if_not_null(args, "offset", offset); + args = this.add_if_not_null(args, "spd", speed); + args = this.add_if_not_null(args, "targetId", targetId); this.execute_pattern(self, other, "bp_prsline_h_follow", args); } @@ -962,26 +983,26 @@ public void prsline_v( CInstance* self, CInstance* other, int? warningDelay = null, int? warnMsg = null, int? displayNumber = null, int? bulletType = null, bool? doubled = null, int? spawnDelay = null, int? width = null, int? offset = null, int? speed = null, double? xPosition = null ) { RValue[] args = []; - args = this.utils.add_if_not_null(args, "warningDelay", warningDelay); - args = this.utils.add_if_not_null(args, "warnMsg", warnMsg); - args = this.utils.add_if_not_null(args, "displayNumber", displayNumber); - args = this.utils.add_if_not_null(args, "element", bulletType); - args = this.utils.add_if_not_null(args, "doubled", doubled); - args = this.utils.add_if_not_null(args, "spawnDelay", spawnDelay); - args = this.utils.add_if_not_null(args, "width", width); - args = this.utils.add_if_not_null(args, "offset", offset); - args = this.utils.add_if_not_null(args, "spd", speed); - args = this.utils.add_if_not_null(args, "x", xPosition); + args = this.add_if_not_null(args, "warningDelay", warningDelay); + args = this.add_if_not_null(args, "warnMsg", warnMsg); + args = this.add_if_not_null(args, "displayNumber", displayNumber); + args = this.add_if_not_null(args, "element", bulletType); + args = this.add_if_not_null(args, "doubled", doubled); + args = this.add_if_not_null(args, "spawnDelay", spawnDelay); + args = this.add_if_not_null(args, "width", width); + args = this.add_if_not_null(args, "offset", offset); + args = this.add_if_not_null(args, "spd", speed); + args = this.add_if_not_null(args, "x", xPosition); this.execute_pattern(self, other, "bp_prsline_v", args); } public void ray_multi_h(CInstance* self, CInstance* other, int? warningDelay = null, int? spawnDelay = null, int? eraseDelay = null, int? width = null, Position[]? positions = null) { RValue[] args = []; - args = this.utils.add_if_not_null(args, "warningDelay", warningDelay); - args = this.utils.add_if_not_null(args, "spawnDelay", spawnDelay); - args = this.utils.add_if_not_null(args, "eraseDelay", eraseDelay); - args = this.utils.add_if_not_null(args, "width", width); + args = this.add_if_not_null(args, "warningDelay", warningDelay); + args = this.add_if_not_null(args, "spawnDelay", spawnDelay); + args = this.add_if_not_null(args, "eraseDelay", eraseDelay); + args = this.add_if_not_null(args, "width", width); if (positions != null) { this.set_pattern_positions(self, other, positions); @@ -992,11 +1013,11 @@ public void ray_multi_h(CInstance* self, CInstance* other, int? warningDelay = n public void ray_multi_slice(CInstance* self, CInstance* other, int? warningDelay = null, int? spawnDelay = null, int? eraseDelay = null, int? timeBetween = null, int? width = null, PosRot[]? positions = null) { RValue[] args = []; - args = this.utils.add_if_not_null(args, "warningDelay", warningDelay); - args = this.utils.add_if_not_null(args, "spawnDelay", spawnDelay); - args = this.utils.add_if_not_null(args, "eraseDelay", eraseDelay); - args = this.utils.add_if_not_null(args, "width", width); - args = this.utils.add_if_not_null(args, "timeBetween", timeBetween); + args = this.add_if_not_null(args, "warningDelay", warningDelay); + args = this.add_if_not_null(args, "spawnDelay", spawnDelay); + args = this.add_if_not_null(args, "eraseDelay", eraseDelay); + args = this.add_if_not_null(args, "width", width); + args = this.add_if_not_null(args, "timeBetween", timeBetween); if (positions != null) { this.set_pattern_position_rotations(self, other, positions); @@ -1007,10 +1028,10 @@ public void ray_multi_slice(CInstance* self, CInstance* other, int? warningDelay public void ray_multi_v(CInstance* self, CInstance* other, int? warningDelay = null, int? spawnDelay = null, int? eraseDelay = null, int? width = null, Position[]? positions = null) { RValue[] args = []; - args = this.utils.add_if_not_null(args, "warningDelay", warningDelay); - args = this.utils.add_if_not_null(args, "spawnDelay", spawnDelay); - args = this.utils.add_if_not_null(args, "eraseDelay", eraseDelay); - args = this.utils.add_if_not_null(args, "width", width); + args = this.add_if_not_null(args, "warningDelay", warningDelay); + args = this.add_if_not_null(args, "spawnDelay", spawnDelay); + args = this.add_if_not_null(args, "eraseDelay", eraseDelay); + args = this.add_if_not_null(args, "width", width); if (positions != null) { this.set_pattern_positions(self, other, positions); @@ -1022,11 +1043,11 @@ public void ray_multi_v(CInstance* self, CInstance* other, int? warningDelay = n public void ray_single(CInstance* self, CInstance* other, int? warningDelay = null, int? spawnDelay = null, int? eraseDelay = null, int? width = null, Position? position = null, int? angle = null) { RValue[] args = []; - args = this.utils.add_if_not_null(args, "warningDelay", warningDelay); - args = this.utils.add_if_not_null(args, "spawnDelay", spawnDelay); - args = this.utils.add_if_not_null(args, "eraseDelay", eraseDelay); - args = this.utils.add_if_not_null(args, "width", width); - args = this.utils.add_if_not_null(args, "angle", angle); + args = this.add_if_not_null(args, "warningDelay", warningDelay); + args = this.add_if_not_null(args, "spawnDelay", spawnDelay); + args = this.add_if_not_null(args, "eraseDelay", eraseDelay); + args = this.add_if_not_null(args, "width", width); + args = this.add_if_not_null(args, "angle", angle); if (position != null) { args = args.Concat([this.utils.CreateString("x")!.Value, new RValue(position.Value.x)]).ToArray(); @@ -1038,15 +1059,15 @@ public void ray_single(CInstance* self, CInstance* other, int? warningDelay = nu public void ray_spinfast(CInstance* self, CInstance* other, int? warningDelay = null, int? warningRadius = null, int? displayNumber = null, int? spawnDelay = null, int? eraseDelay = null, int? width = null, double? angle = null, Position? position = null, double? rot = null, int? numLasers = null) { RValue[] args = []; - args = this.utils.add_if_not_null(args, "warningDelay", warningDelay); - args = this.utils.add_if_not_null(args, "spawnDelay", spawnDelay); - args = this.utils.add_if_not_null(args, "eraseDelay", eraseDelay); - args = this.utils.add_if_not_null(args, "width", width); - args = this.utils.add_if_not_null(args, "radius", warningRadius); - args = this.utils.add_if_not_null(args, "displayNumber", displayNumber); - args = this.utils.add_if_not_null(args, "angle", angle); - args = this.utils.add_if_not_null(args, "rot", rot); - args = this.utils.add_if_not_null(args, "num", numLasers); + args = this.add_if_not_null(args, "warningDelay", warningDelay); + args = this.add_if_not_null(args, "spawnDelay", spawnDelay); + args = this.add_if_not_null(args, "eraseDelay", eraseDelay); + args = this.add_if_not_null(args, "width", width); + args = this.add_if_not_null(args, "radius", warningRadius); + args = this.add_if_not_null(args, "displayNumber", displayNumber); + args = this.add_if_not_null(args, "angle", angle); + args = this.add_if_not_null(args, "rot", rot); + args = this.add_if_not_null(args, "num", numLasers); if (position != null) { args = args.Concat([this.utils.CreateString("x")!.Value, new RValue(position.Value.x)]).ToArray(); @@ -1058,24 +1079,24 @@ public void ray_spinfast(CInstance* self, CInstance* other, int? warningDelay = public void setgamespeed(CInstance* self, CInstance* other, int? spawnDelay = null, double? timeMult = null) { RValue[] args = []; - args = this.utils.add_if_not_null(args, "timeMult", timeMult); - args = this.utils.add_if_not_null(args, "spawnDelay", spawnDelay); + args = this.add_if_not_null(args, "timeMult", timeMult); + args = this.add_if_not_null(args, "spawnDelay", spawnDelay); this.execute_pattern(self, other, "bp_setgamespeed", args); } public void setgamespeed_temp(CInstance* self, CInstance* other, int? spawnDelay = null, int? eraseDelay = null, double? timeMult = null) { RValue[] args = []; - args = this.utils.add_if_not_null(args, "timeMult", timeMult); - args = this.utils.add_if_not_null(args, "spawnDelay", spawnDelay); - args = this.utils.add_if_not_null(args, "eraseDelay", eraseDelay); + args = this.add_if_not_null(args, "timeMult", timeMult); + args = this.add_if_not_null(args, "spawnDelay", spawnDelay); + args = this.add_if_not_null(args, "eraseDelay", eraseDelay); this.execute_pattern(self, other, "bp_setgamespeed_temp", args); } public void setzoom(CInstance* self, CInstance* other, double? zoom = null) { RValue[] args = []; - args = this.utils.add_if_not_null(args, "scale", zoom); + args = this.add_if_not_null(args, "scale", zoom); this.execute_pattern(self, other, "bp_setzoom", args); } @@ -1084,8 +1105,8 @@ public void showgroups( CInstance* self, CInstance* other, int? spawnDelay = null, int? eraseDelay = null, (int, int, int, int)? groupMasks = null ) { RValue[] args = []; - args = this.utils.add_if_not_null(args, "spawnDelay", spawnDelay); - args = this.utils.add_if_not_null(args, "eraseDelay", eraseDelay); + args = this.add_if_not_null(args, "spawnDelay", spawnDelay); + args = this.add_if_not_null(args, "eraseDelay", eraseDelay); if (groupMasks != null) { args = args.Concat([this.utils.CreateString("orderBin_0")!.Value, new RValue(groupMasks.Value.Item1)]).ToArray(); @@ -1101,9 +1122,9 @@ public void showorder( CInstance* self, CInstance* other, int? spawnDelay = null, int? eraseDelay = null, int? timeBetween = null, (int, int, int, int)? orderMasks = null ) { RValue[] args = []; - args = this.utils.add_if_not_null(args, "spawnDelay", spawnDelay); - args = this.utils.add_if_not_null(args, "eraseDelay", eraseDelay); - args = this.utils.add_if_not_null(args, "timeBetween", timeBetween); + args = this.add_if_not_null(args, "spawnDelay", spawnDelay); + args = this.add_if_not_null(args, "eraseDelay", eraseDelay); + args = this.add_if_not_null(args, "timeBetween", timeBetween); if (orderMasks != null) { args = args.Concat([this.utils.CreateString("orderBin_0")!.Value, new RValue(orderMasks.Value.Item1)]).ToArray(); @@ -1119,10 +1140,10 @@ public void tailwind( CInstance* self, CInstance* other, int? eraseDelay = null, int? spawnDelay = null, int? trgBinary = null, double? mult = null ) { RValue[] args = []; - args = this.utils.add_if_not_null(args, "eraseDelay", eraseDelay); - args = this.utils.add_if_not_null(args, "spawnDelay", spawnDelay); - args = this.utils.add_if_not_null(args, "trgBinary", trgBinary); - args = this.utils.add_if_not_null(args, "mult", mult); + args = this.add_if_not_null(args, "eraseDelay", eraseDelay); + args = this.add_if_not_null(args, "spawnDelay", spawnDelay); + args = this.add_if_not_null(args, "trgBinary", trgBinary); + args = this.add_if_not_null(args, "mult", mult); this.execute_pattern(self, other, "bp_tailwind", args); } @@ -1131,9 +1152,9 @@ public void tailwind_permanent( CInstance* self, CInstance* other, int? spawnDelay = null, int? trgBinary = null, double? mult = null ) { RValue[] args = []; - args = this.utils.add_if_not_null(args, "spawnDelay", spawnDelay); - args = this.utils.add_if_not_null(args, "trgBinary", trgBinary); - args = this.utils.add_if_not_null(args, "mult", mult); + args = this.add_if_not_null(args, "spawnDelay", spawnDelay); + args = this.add_if_not_null(args, "trgBinary", trgBinary); + args = this.add_if_not_null(args, "mult", mult); this.execute_pattern(self, other, "bp_tailwind_permanent", args); } @@ -1142,9 +1163,9 @@ public void teleport_dist( CInstance* self, CInstance* other, int? spawnDelay = null, int? eraseDelay = null, int? type = null, Position[]? offsets = null ) { RValue[] args = []; - args = this.utils.add_if_not_null(args, "spawnDelay", spawnDelay); - args = this.utils.add_if_not_null(args, "eraseDelay", eraseDelay); - args = this.utils.add_if_not_null(args, "type", type); + args = this.add_if_not_null(args, "spawnDelay", spawnDelay); + args = this.add_if_not_null(args, "eraseDelay", eraseDelay); + args = this.add_if_not_null(args, "type", type); if (offsets == null) { this.execute_pattern(self, other, "bp_teleport_dist", args); @@ -1153,8 +1174,8 @@ public void teleport_dist( var i = 0; foreach (var pos in offsets) { - args = this.utils.add_if_not_null(args, "offX_" + i, pos.x); - args = this.utils.add_if_not_null(args, "offY_" + i, pos.y); + args = this.add_if_not_null(args, "offX_" + i, pos.x); + args = this.add_if_not_null(args, "offY_" + i, pos.y); i += 1; } @@ -1165,10 +1186,10 @@ public void tether( CInstance* self, CInstance* other, int? warningDelay = null, int? spawnDelay = null, int? eraseDelay = null, double? radius = null, int? targetMask = null ) { RValue[] args = []; - args = this.utils.add_if_not_null(args, "warningDelay", warningDelay); - args = this.utils.add_if_not_null(args, "spawnDelay", spawnDelay); - args = this.utils.add_if_not_null(args, "radius", radius); - args = this.utils.add_if_not_null(args, "trgBinary", targetMask); + args = this.add_if_not_null(args, "warningDelay", warningDelay); + args = this.add_if_not_null(args, "spawnDelay", spawnDelay); + args = this.add_if_not_null(args, "radius", radius); + args = this.add_if_not_null(args, "trgBinary", targetMask); if (eraseDelay != null) { if (eraseDelay > 0) { @@ -1185,10 +1206,10 @@ public void tether_enemy( CInstance* self, CInstance* other, int? warningDelay = null, int? spawnDelay = null, int? eraseDelay = null, double? radius = null, Position? position = null, int? targetMask = null ) { RValue[] args = []; - args = this.utils.add_if_not_null(args, "warningDelay", warningDelay); - args = this.utils.add_if_not_null(args, "spawnDelay", spawnDelay); - args = this.utils.add_if_not_null(args, "radius", radius); - args = this.utils.add_if_not_null(args, "trgBinary", targetMask); + args = this.add_if_not_null(args, "warningDelay", warningDelay); + args = this.add_if_not_null(args, "spawnDelay", spawnDelay); + args = this.add_if_not_null(args, "radius", radius); + args = this.add_if_not_null(args, "trgBinary", targetMask); if (position != null) { args = args.Concat([this.utils.CreateString("x")!.Value, new RValue(position.Value.x)]).ToArray(); @@ -1209,10 +1230,10 @@ public void tether_fixed( CInstance* self, CInstance* other, int? warningDelay = null, int? spawnDelay = null, int? eraseDelay = null, double? radius = null, Position? position = null, int? targetMask = null ) { RValue[] args = []; - args = this.utils.add_if_not_null(args, "warningDelay", warningDelay); - args = this.utils.add_if_not_null(args, "spawnDelay", spawnDelay); - args = this.utils.add_if_not_null(args, "radius", radius); - args = this.utils.add_if_not_null(args, "trgBinary", targetMask); + args = this.add_if_not_null(args, "warningDelay", warningDelay); + args = this.add_if_not_null(args, "spawnDelay", spawnDelay); + args = this.add_if_not_null(args, "radius", radius); + args = this.add_if_not_null(args, "trgBinary", targetMask); if (position != null) { args = args.Concat([this.utils.CreateString("x")!.Value, new RValue(position.Value.x)]).ToArray(); @@ -1234,11 +1255,11 @@ public void thorns( CInstance* self, CInstance* other, int? warningDelay = null, int? warnMsg = null, int? spawnDelay = null, double? radius = null, int? targetMask = null ) { RValue[] args = []; - args = this.utils.add_if_not_null(args, "warningDelay", warningDelay); - args = this.utils.add_if_not_null(args, "spawnDelay", spawnDelay); - args = this.utils.add_if_not_null(args, "radius", radius); - args = this.utils.add_if_not_null(args, "trgBinary", targetMask); - args = this.utils.add_if_not_null(args, "warnMsg", warnMsg); + args = this.add_if_not_null(args, "warningDelay", warningDelay); + args = this.add_if_not_null(args, "spawnDelay", spawnDelay); + args = this.add_if_not_null(args, "radius", radius); + args = this.add_if_not_null(args, "trgBinary", targetMask); + args = this.add_if_not_null(args, "warnMsg", warnMsg); this.execute_pattern(self, other, "bp_thorns", args); } @@ -1247,10 +1268,10 @@ public void thorns_bin( CInstance* self, CInstance* other, int? warningDelay = null, int? warnMsg = null, int? spawnDelay = null, double? radius = null, (int, int, int, int)? groupMasks = null ) { RValue[] args = []; - args = this.utils.add_if_not_null(args, "warningDelay", warningDelay); - args = this.utils.add_if_not_null(args, "spawnDelay", spawnDelay); - args = this.utils.add_if_not_null(args, "radius", radius); - args = this.utils.add_if_not_null(args, "warnMsg", warnMsg); + args = this.add_if_not_null(args, "warningDelay", warningDelay); + args = this.add_if_not_null(args, "spawnDelay", spawnDelay); + args = this.add_if_not_null(args, "radius", radius); + args = this.add_if_not_null(args, "warnMsg", warnMsg); if (groupMasks != null) { args = args.Concat([this.utils.CreateString("orderBin_0")!.Value, new RValue(groupMasks.Value.Item1)]).ToArray(); @@ -1265,12 +1286,12 @@ public void thorns_fixed( CInstance* self, CInstance* other, int? warningDelay = null, int? warnMsg = null, int? displayNumber = null, int? spawnDelay = null, double? radius = null, Position? position = null, int? targetMask = null ) { RValue[] args = []; - args = this.utils.add_if_not_null(args, "warningDelay", warningDelay); - args = this.utils.add_if_not_null(args, "spawnDelay", spawnDelay); - args = this.utils.add_if_not_null(args, "radius", radius); - args = this.utils.add_if_not_null(args, "trgBinary", targetMask); - args = this.utils.add_if_not_null(args, "warnMsg", warnMsg); - args = this.utils.add_if_not_null(args, "displayNumber", displayNumber); + args = this.add_if_not_null(args, "warningDelay", warningDelay); + args = this.add_if_not_null(args, "spawnDelay", spawnDelay); + args = this.add_if_not_null(args, "radius", radius); + args = this.add_if_not_null(args, "trgBinary", targetMask); + args = this.add_if_not_null(args, "warnMsg", warnMsg); + args = this.add_if_not_null(args, "displayNumber", displayNumber); if (position != null) { args = args.Concat([this.utils.CreateString("x")!.Value, new RValue(position.Value.x)]).ToArray(); @@ -1285,14 +1306,14 @@ public void water2_line( int? lineLength = null, int? numBullets = null, int? spd = null ) { RValue[] args = []; - args = this.utils.add_if_not_null(args, "warningDelay", warningDelay); - args = this.utils.add_if_not_null(args, "showWarning", showWarning); - args = this.utils.add_if_not_null(args, "spawnDelay", spawnDelay); - args = this.utils.add_if_not_null(args, "angle", angle); - args = this.utils.add_if_not_null(args, "lineAngle", lineAngle); - args = this.utils.add_if_not_null(args, "num", numBullets); - args = this.utils.add_if_not_null(args, "lineLength", lineLength); - args = this.utils.add_if_not_null(args, "spd", spd); + args = this.add_if_not_null(args, "warningDelay", warningDelay); + args = this.add_if_not_null(args, "showWarning", showWarning); + args = this.add_if_not_null(args, "spawnDelay", spawnDelay); + args = this.add_if_not_null(args, "angle", angle); + args = this.add_if_not_null(args, "lineAngle", lineAngle); + args = this.add_if_not_null(args, "num", numBullets); + args = this.add_if_not_null(args, "lineLength", lineLength); + args = this.add_if_not_null(args, "spd", spd); if (position != null) { args = args.Concat([this.utils.CreateString("x")!.Value, new RValue(position.Value.x)]).ToArray(); @@ -1306,11 +1327,11 @@ public void water_moving_ball( CInstance* self, CInstance* other, int? warningDelay = null, int? spawnDelay = null, Position? position = null, double? speed = null, double? scale = null, double? angle = null ) { RValue[] args = []; - args = this.utils.add_if_not_null(args, "warningDelay", warningDelay); - args = this.utils.add_if_not_null(args, "spawnDelay", spawnDelay); - args = this.utils.add_if_not_null(args, "spd", speed); - args = this.utils.add_if_not_null(args, "scale", scale); - args = this.utils.add_if_not_null(args, "angle", angle); + args = this.add_if_not_null(args, "warningDelay", warningDelay); + args = this.add_if_not_null(args, "spawnDelay", spawnDelay); + args = this.add_if_not_null(args, "spd", speed); + args = this.add_if_not_null(args, "scale", scale); + args = this.add_if_not_null(args, "angle", angle); if (position != null) { args = args.Concat([this.utils.CreateString("x")!.Value, new RValue(position.Value.x)]).ToArray(); @@ -1323,12 +1344,12 @@ public void water_moving_ball( // Towers. public void angel_circle(CInstance* self, CInstance* other, int? warningDelay = null, int? spawnDelay = null, int? warnMsg = null, int? displayNumber = null, int? number = null, int? radius = null, Position? position = null) { RValue[] args = []; - args = this.utils.add_if_not_null(args, "warningDelay", warningDelay); - args = this.utils.add_if_not_null(args, "spawnDelay", spawnDelay); - args = this.utils.add_if_not_null(args, "warnMsg", warnMsg); - args = this.utils.add_if_not_null(args, "displayNumber", displayNumber); - args = this.utils.add_if_not_null(args, "number", number); - args = this.utils.add_if_not_null(args, "radius", radius); + args = this.add_if_not_null(args, "warningDelay", warningDelay); + args = this.add_if_not_null(args, "spawnDelay", spawnDelay); + args = this.add_if_not_null(args, "warnMsg", warnMsg); + args = this.add_if_not_null(args, "displayNumber", displayNumber); + args = this.add_if_not_null(args, "number", number); + args = this.add_if_not_null(args, "radius", radius); if (position != null) { args = args.Concat([this.utils.CreateString("x")!.Value, new RValue(position.Value.x)]).ToArray(); @@ -1341,12 +1362,12 @@ public void angel_circle(CInstance* self, CInstance* other, int? warningDelay = public void angel_circle_follow(CInstance* self, CInstance* other, int? warningDelay = null, int? spawnDelay = null, int? warnMsg = null, int? number = null, int? radius = null, int? targetId = null) { RValue[] args = []; - args = this.utils.add_if_not_null(args, "warningDelay", warningDelay); - args = this.utils.add_if_not_null(args, "spawnDelay", spawnDelay); - args = this.utils.add_if_not_null(args, "warnMsg", warnMsg); - args = this.utils.add_if_not_null(args, "number", number); - args = this.utils.add_if_not_null(args, "radius", radius); - args = this.utils.add_if_not_null(args, "targetId", targetId); + args = this.add_if_not_null(args, "warningDelay", warningDelay); + args = this.add_if_not_null(args, "spawnDelay", spawnDelay); + args = this.add_if_not_null(args, "warnMsg", warnMsg); + args = this.add_if_not_null(args, "number", number); + args = this.add_if_not_null(args, "radius", radius); + args = this.add_if_not_null(args, "targetId", targetId); this.execute_pattern(self, other, "bp_angel_circle_follow", args); } @@ -1354,12 +1375,12 @@ public void angel_circle_follow(CInstance* self, CInstance* other, int? warningD public void angel_circle_follow_bin(CInstance* self, CInstance* other, int? warningDelay = null, int? spawnDelay = null, int? number = null, int? trgBinary = null, int? warnMsg = null, int? radius = null) { RValue[] args = []; - args = this.utils.add_if_not_null(args, "warningDelay", warningDelay); - args = this.utils.add_if_not_null(args, "spawnDelay", spawnDelay); - args = this.utils.add_if_not_null(args, "warnMsg", warnMsg); - args = this.utils.add_if_not_null(args, "number", number); - args = this.utils.add_if_not_null(args, "radius", radius); - args = this.utils.add_if_not_null(args, "trgBinary", trgBinary); + args = this.add_if_not_null(args, "warningDelay", warningDelay); + args = this.add_if_not_null(args, "spawnDelay", spawnDelay); + args = this.add_if_not_null(args, "warnMsg", warnMsg); + args = this.add_if_not_null(args, "number", number); + args = this.add_if_not_null(args, "radius", radius); + args = this.add_if_not_null(args, "trgBinary", trgBinary); this.execute_pattern(self, other, "bp_angel_circle_follow_bin", args); } @@ -1367,11 +1388,11 @@ public void angel_circle_follow_bin(CInstance* self, CInstance* other, int? warn public void angel_circle_follow_enemy(CInstance* self, CInstance* other, int? warningDelay = null, int? spawnDelay = null, int? warnMsg = null, int? number = null, int? radius = null) { RValue[] args = []; - args = this.utils.add_if_not_null(args, "warningDelay", warningDelay); - args = this.utils.add_if_not_null(args, "spawnDelay", spawnDelay); - args = this.utils.add_if_not_null(args, "warnMsg", warnMsg); - args = this.utils.add_if_not_null(args, "number", number); - args = this.utils.add_if_not_null(args, "radius", radius); + args = this.add_if_not_null(args, "warningDelay", warningDelay); + args = this.add_if_not_null(args, "spawnDelay", spawnDelay); + args = this.add_if_not_null(args, "warnMsg", warnMsg); + args = this.add_if_not_null(args, "number", number); + args = this.add_if_not_null(args, "radius", radius); this.execute_pattern(self, other, "bp_angel_circle_follow_enemy", args); } @@ -1379,12 +1400,12 @@ public void angel_circle_follow_enemy(CInstance* self, CInstance* other, int? wa public void angel_circle_mult(CInstance* self, CInstance* other, int? warningDelay = null, int? spawnDelay = null, int? warnMsg = null, int? displayNumber = null, int? number = null, int? radius = null, Position[]? points = null) { RValue[] args = []; - args = this.utils.add_if_not_null(args, "warningDelay", warningDelay); - args = this.utils.add_if_not_null(args, "spawnDelay", spawnDelay); - args = this.utils.add_if_not_null(args, "warnMsg", warnMsg); - args = this.utils.add_if_not_null(args, "displayNumber", displayNumber); - args = this.utils.add_if_not_null(args, "number", number); - args = this.utils.add_if_not_null(args, "radius", radius); + args = this.add_if_not_null(args, "warningDelay", warningDelay); + args = this.add_if_not_null(args, "spawnDelay", spawnDelay); + args = this.add_if_not_null(args, "warnMsg", warnMsg); + args = this.add_if_not_null(args, "displayNumber", displayNumber); + args = this.add_if_not_null(args, "number", number); + args = this.add_if_not_null(args, "radius", radius); if (points != null) { args = args.Concat([this.utils.CreateString("numPoints")!.Value, new RValue(points.Length)]).ToArray(); diff --git a/RNSReloaded/Util.cs b/RNSReloaded/Util.cs index c37a23d..26b0dc3 100644 --- a/RNSReloaded/Util.cs +++ b/RNSReloaded/Util.cs @@ -126,25 +126,4 @@ public void setHallway(List hallway, CInstance* self, IRNSReloaded rnsRel notchNum->Real = hallway.Count; notchNum->Type = RValueType.Real; } - - public RValue[] add_if_not_null(RValue[] args, string fieldName, int? value) { - if (value != null) { - return args.Concat([this.CreateString(fieldName)!.Value, new RValue(value.Value)]).ToArray(); - } - return args; - } - - public RValue[] add_if_not_null(RValue[] args, string fieldName, bool? value) { - if (value != null) { - return args.Concat([this.CreateString(fieldName)!.Value, new RValue(value.Value)]).ToArray(); - } - return args; - } - - public RValue[] add_if_not_null(RValue[] args, string fieldName, double? value) { - if (value != null) { - return args.Concat([this.CreateString(fieldName)!.Value, new RValue(value.Value)]).ToArray(); - } - return args; - } } From 23c799752dd10270103c3680c3ede18f2b8fbadb Mon Sep 17 00:00:00 2001 From: Babit Date: Sun, 28 Jun 2026 00:00:24 +0200 Subject: [PATCH 10/13] Forgot one add_if_not_null --- RNSReloaded/BattlePatterns.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/RNSReloaded/BattlePatterns.cs b/RNSReloaded/BattlePatterns.cs index 0aca952..1c1e50b 100644 --- a/RNSReloaded/BattlePatterns.cs +++ b/RNSReloaded/BattlePatterns.cs @@ -80,7 +80,7 @@ private RValue[] add_if_not_null(RValue[] args, string fieldName, bool? value) { return args; } - public RValue[] add_if_not_null(RValue[] args, string fieldName, double? value) { + private RValue[] add_if_not_null(RValue[] args, string fieldName, double? value) { if (value != null) { return args.Concat([this.utils.CreateString(fieldName)!.Value, new RValue(value.Value)]).ToArray(); } From e1aba5eb6bbe1577bf27f996ec22d3e359c0beee Mon Sep 17 00:00:00 2001 From: Babit Date: Sun, 28 Jun 2026 02:09:01 +0200 Subject: [PATCH 11/13] Add GetName for CLayer --- RNSReloaded.Interfaces/Structs.cs | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/RNSReloaded.Interfaces/Structs.cs b/RNSReloaded.Interfaces/Structs.cs index 8f4e6fa..2718730 100644 --- a/RNSReloaded.Interfaces/Structs.cs +++ b/RNSReloaded.Interfaces/Structs.cs @@ -396,6 +396,13 @@ public List GetInstances() { } return instances.ToList(); } + + public string GetName() { + if (this.Name == null) { + return "Unnamed"; + } + return Marshal.PtrToStringAnsi((nint) this.Name) ?? "Unnamed"; + } } public enum LayerElementType { From a81fa26b5441fb6bc1cb2dead3a79cf6f488fff2 Mon Sep 17 00:00:00 2001 From: Babit Date: Tue, 30 Jun 2026 00:13:14 +0200 Subject: [PATCH 12/13] Remove FindAllocValue and GetStructKeys, replace with gml func calls. Add RValue array constructors and some functions. Some work on CInstance layout --- RNSReloaded.Interfaces/IRNSReloaded.cs | 1 - RNSReloaded.Interfaces/Structs.cs | 210 +++++++++++++++++++++++-- RNSReloaded/Functions.cs | 8 - RNSReloaded/RNSReloaded.cs | 23 +-- 4 files changed, 204 insertions(+), 38 deletions(-) diff --git a/RNSReloaded.Interfaces/IRNSReloaded.cs b/RNSReloaded.Interfaces/IRNSReloaded.cs index bb36339..9b2d2d1 100644 --- a/RNSReloaded.Interfaces/IRNSReloaded.cs +++ b/RNSReloaded.Interfaces/IRNSReloaded.cs @@ -20,7 +20,6 @@ public unsafe interface IRNSReloaded { public RFunctionStringRef GetTheFunction(int id); public CInstance* GetGlobalInstance(); public RValue* FindValue(CInstance* instance, string name); - public RValue* FindAllocValue(CInstance* instance, string name); public RValue* FindGlobalValue(string name); public RValue* ArrayGetEntry(RValue* array, int index); public RValue? ArrayGetLength(RValue* array); diff --git a/RNSReloaded.Interfaces/Structs.cs b/RNSReloaded.Interfaces/Structs.cs index 2718730..d86e667 100644 --- a/RNSReloaded.Interfaces/Structs.cs +++ b/RNSReloaded.Interfaces/Structs.cs @@ -74,20 +74,95 @@ public unsafe struct RValue { return IRNSReloaded.Instance.FindValue(this.Object, key); } - public RValue* Set(string key, RValue value) { - if (this.Type != RValueType.Object) return null; - var retVal = IRNSReloaded.Instance.FindAllocValue(this.Object, key); - *retVal = value; - return retVal; + // TODO: what happens if index out of bounds? + public void Set(int index, RValue value) { + RValue[] args = [this, index, value]; + IRNSReloaded.Instance.ExecuteCodeFunction("array_set", null, null, args); + } + + public bool Set(string key, RValue value) { + if (this.Type != RValueType.Object) return false; + RValue[] args = [this.Object->ID, new RValue(key), value]; + IRNSReloaded.Instance.ExecuteCodeFunction("variable_instance_set", null, null, args); + return true; } // Thanks C# for making indexing a pointer with a number impossible lol - public RValue* this[int index] => this.Get(index); + public RValue* this[int index] { + get => this.Get(index); + set => this.Set(index, *value); + } public RValue* this[string key] { get => this.Get(key); set => this.Set(key, *value); } + /// Typesafe pointers I guess + // public ref RValue Get(int index) { + // if (this.Type != RValueType.Array) { + // throw new NotSupportedException("Only RValues of type Array may be accessed via ints"); + // } + // fixed (RValue* ptr = &this) { + // var value = IRNSReloaded.Instance.ArrayGetEntry(ptr, index); + // if (value == null) throw new IndexOutOfRangeException($"Failed to find RValue data at index {index}"); + // return ref *value; + // } + // } + + // public ref RValue Get(string key) { + // if (this.Type != RValueType.Object) { + // throw new NotSupportedException("Only RValues of type Object may be accessed via strings"); + // } + // var value = IRNSReloaded.Instance.FindValue(this.Object, key); + // if (value == null) { + // throw new KeyNotFoundException(); + // } + // return ref *value; + // } + + + // public ref RValue this[int index] => ref this.Get(index); + // public ref RValue this[string key] { + // get => ref this.Get(key); + // // Why no set access on refs ;-; + // // set { + // // try { + // // ref var holder = ref this.Get(key); + // // holder = value; + // // } catch (KeyNotFoundException) { + // // this.Set(key, value); + // // } + // // } + // } + + public int ArrayLength() { + var length = IRNSReloaded.Instance.ExecuteCodeFunction("array_length", null, null, [this]) ?? 0; + return (int)length; + } + + public static RValue? ArrayCreate(int size = 0, RValue? defaultVal = null) { + RValue[] args = [size]; + if (defaultVal != null) args = [..args, defaultVal.Value]; + var array = IRNSReloaded.Instance.ExecuteCodeFunction("array_create", null, null, args); + return array; + } + + public void ArrayPush(params RValue[] values) { + if (values.Count() == 0) { + return; + } + RValue[] args = [this, values[0]]; + if (values.Count() > 1) { + args = [..args, ..values[1..]]; + } + IRNSReloaded.Instance.ExecuteCodeFunction("array_push", null, null, args); + } + + public RValue ArrayPop() { + var ret = IRNSReloaded.Instance.ExecuteCodeFunction("array_push", null, null, [this]); + return ret ?? new RValue(); + } + public override string ToString() { fixed (RValue* ptr = &this) { return IRNSReloaded.Instance.GetString(ptr); @@ -148,6 +223,21 @@ public bool ToBool(bool defaultValue = false) { }; } + public Span AsSpan() { + if (this.Type != RValueType.Array) return Span.Empty; + var length = this.ArrayLength(); + unsafe { + var arrPtr = this.Pointer + 8; + var arr = (RValue*) *(nint*) arrPtr; + return new Span(arr, length); + } + } + + public RValue[] ToArray() { + if (this.Type != RValueType.Array) return []; + return this.AsSpan().ToArray(); + } + // Constructors public RValue(CInstance* obj) { this.Type = RValueType.Object; @@ -185,11 +275,13 @@ public RValue() { this.Flags = 0; } + public RValue(RValue[] array) { + this = ArrayCreate() ?? new RValue(); + this.ArrayPush(array); + } + public RValue(string value) { - this = IRNSReloaded.Instance.utils.CreateString(value) switch { - { } strR => strR, - null => new RValue(), - }; + this = IRNSReloaded.Instance.utils.CreateString(value) ?? new RValue(); } public static implicit operator RValue(CInstance* obj) => new(obj); @@ -197,18 +289,90 @@ public RValue(string value) { public static implicit operator RValue(long value) => new(value); public static implicit operator RValue(double value) => new(value); public static implicit operator RValue(bool value) => new(value); + public static implicit operator RValue(RValue[] value) => new(value); public static explicit operator int(RValue value) => value.ToInt(); public static explicit operator long(RValue value) => value.ToLong(); public static explicit operator double(RValue value) => value.ToDouble(); public static explicit operator bool(RValue value) => value.ToBool(); - // TODO: creating other primitives, new objects, and new arrays + // TODO: creating other primitives, new objects + // TODO: instance enumerator } -[StructLayout(LayoutKind.Sequential, Pack = 8)] +// CInstances from functions are laid out in 512 byte chunks at least +[StructLayout(LayoutKind.Sequential, Pack = 8, Size = 512)] public unsafe struct CInstance : ILinkedListElement { // TODO + // 3 pointers related to vtables (see pdb types) + fixed byte Padding[176]; + // Alarms probably + // Should also contain the following at some point + // CLayer* layer; + // float collision_space; + + /// CInstance "internals" likely start here + + // Overview of the flags: + // 0. ? + // 1. persistent + // 2. solid? + // 3. visible + // 4. not-solid? + // 5-7. ? + // 8. solid? + // 9-31. ? + // Should have on_ui_layer + public int instanceFlags; + public int ID; + public int objectIndex; + public int spriteIndex; + public float sequencePosition; + public float lastSequencePosition; + public float sequenceDirection; + public float imageIndex; + public float time; + public float imageSpeed; + public float scaleX; + public float scaleY; + public float rotation; + public float alpha; + public int color; // or blend + public float x; + public float y; + public float startx; + public float starty; + public float xprevious; + public float yprevious; + public float direction; + public float speed; + public float friction; + public float gravity_direction; + public float gravity; + public float hspeed; + public float vspeed; + // Bounding box + public float BoxLeft; + public float BoxTop; + public float BoxRight; + public float BoxBottom; + public fixed int timers[12]; + public Int16 rollbackFrameKilled; + // 2 padding bytes + public void* TimelinePath; + public CCode* initCode; + public CCode* precreateCode; + public CObjectGM* oldObject; + public int layerID; + public int maskIndex; + public Int16 mouseOverCount; + // 2 padding bytes + public CInstance* Flink; + public CInstance* Blink; + fixed long pointers[9]; + public float depth; + public float Padding6; + public int Padding7; public CInstance* GetNext() => throw new NotImplementedException(); public CInstance* GetPrev() => throw new NotImplementedException(); @@ -480,6 +644,28 @@ public unsafe struct YYRoomInstances; [StructLayout(LayoutKind.Sequential, Pack = 8)] public unsafe struct CLayerEffectInfo; +[StructLayout(LayoutKind.Sequential, Pack = 8)] +public unsafe struct CObjectGM { + public readonly char* name; // const in struct.h + public CObjectGM* parentObject; + public CHashMap* childrenMap; + public CHashMap* eventsMap; + public LinkedList instances; + public LinkedList instancesRecursive; + public int flags; + public int spriteIndex; + public int depth; + public int parent; + public int mask; + public int ID; +}; + +[StructLayout(LayoutKind.Sequential, Pack = 8)] +public unsafe struct CEvent { + public CCode* code; + public int ownerObjectID; +} + [StructLayout(LayoutKind.Sequential, Pack = 8)] public unsafe struct RToken { public int Kind; diff --git a/RNSReloaded/Functions.cs b/RNSReloaded/Functions.cs index 17908e6..d7e6fb6 100644 --- a/RNSReloaded/Functions.cs +++ b/RNSReloaded/Functions.cs @@ -11,10 +11,8 @@ public unsafe class Functions { public delegate byte CodeFunctionFindDelegate(char* name, int* id); public delegate void GetTheFunctionDelegate(int id, char** name, void** func, int* argumentCount); public delegate RValue* FindValueDelegate(CInstance* instance, char* name); - public delegate RValue* FindAllocValueDelegate(CInstance* instance, char* name); public delegate RValue* ArrayGetEntryDelegate(nint array, int index); public delegate char* YYGetStringDelegate(RValue* value, int unk); - public delegate int StructGetKeysDelegate(RValue* value, char** keys, int* count); public delegate int YYCreateStringDelegate(RValue* value, char* str); public delegate RValue* CallScriptFunctionDelegate(CInstance* self, CInstance* other, RValue* result, int num_args, int id, RValue** args, long _, long __); @@ -23,10 +21,8 @@ public unsafe class Functions { public CodeFunctionFindDelegate CodeFunctionFind = null!; public GetTheFunctionDelegate GetTheFunction = null!; public FindValueDelegate FindValue = null!; - public FindAllocValueDelegate FindAllocValue = null!; public ArrayGetEntryDelegate ArrayGetEntry = null!; public YYGetStringDelegate YYGetString = null!; - public StructGetKeysDelegate StructGetKeys = null!; public YYCreateStringDelegate YYCreateString = null!; public CallScriptFunctionDelegate callScriptFunction = null!; @@ -47,12 +43,8 @@ public Functions(ScanUtils utils, WeakReference scannerRef) { addr => { this.GetTheFunction = Marshal.GetDelegateForFunctionPointer(addr); }); this.utils.Scan("E8 ?? ?? ?? ?? 48 85 C0 74 ?? 83 78 ?? ?? 75 ?? ?? ?? ?? 48 8B CE E8 ?? ?? ?? ?? 4D 8B C7", addr => { this.FindValue = Marshal.GetDelegateForFunctionPointer(addr); }); - this.utils.Scan("E8 ?? ?? ?? ?? 8B D6 4C 8B F8", - addr => { this.FindAllocValue = Marshal.GetDelegateForFunctionPointer(addr); }); this.utils.Scan("40 53 56 48 83 EC ?? 48 63 F2", addr => { this.YYGetString = Marshal.GetDelegateForFunctionPointer(addr); }); - this.utils.Scan("48 83 EC 38 48 89 74 24 ??", - addr => { this.StructGetKeys = Marshal.GetDelegateForFunctionPointer(addr); }); this.utils.Scan("E8 ?? ?? ?? ?? 48 8B 5C 24 ?? 48 83 C4 ?? 5F C3 4C 3B 05", addr => { this.YYCreateString = Marshal.GetDelegateForFunctionPointer(addr); }); this.utils.Scan("40 55 41 54 41 55 41 56 41 57 48 83 EC ?? 48 8D 6C 24 ?? 48 89 5D ?? 48 89 75 ?? 48 89 7D ?? 48 8B 05 ?? ?? ?? ?? 48 33 C5 48 89 45 ?? 48 63 45", addr => { diff --git a/RNSReloaded/RNSReloaded.cs b/RNSReloaded/RNSReloaded.cs index 2456a64..12b34a4 100644 --- a/RNSReloaded/RNSReloaded.cs +++ b/RNSReloaded/RNSReloaded.cs @@ -110,13 +110,6 @@ public RFunctionStringRef GetTheFunction(int id) { return ret; } - public RValue* FindAllocValue(CInstance* instance, string name) { - var namePtr = Marshal.StringToHGlobalAnsi(name); - var ret = this.functions.FindAllocValue(instance, (char*) namePtr); - Marshal.FreeHGlobal(namePtr); - return ret; - } - public RValue* FindGlobalValue(string name) { return this.FindValue(this.GetGlobalInstance(), name); } @@ -151,17 +144,13 @@ public string GetString(RValue* value) { } public List GetStructKeys(RValue* value) { - var ret = new List(); - var count = this.functions.StructGetKeys(value, null, null); - var keys = new char*[count]; - - fixed (char** keysPtr = keys) { - this.functions.StructGetKeys(value, keysPtr, &count); - for (var i = 0; i < count; i++) { - ret.Add(Marshal.PtrToStringAnsi((nint) keys[i])!); - } + if (value->Type != RValueType.Object) return []; + RValue[] args = [value->Object->ID]; + RValue arr = IRNSReloaded.Instance.ExecuteCodeFunction("variable_instance_get_names", null, null, args) ?? new RValue([]); + List ret = []; + foreach (var key in arr.AsSpan()) { + ret.Add(key.ToString()); } - return ret; } From 31b4243307686d892b30d6a6f921b84aa8d8afc8 Mon Sep 17 00:00:00 2001 From: Babit Date: Sun, 5 Jul 2026 00:39:58 +0200 Subject: [PATCH 13/13] Fixes --- RNSReloaded.Interfaces/IBattlePatterns.cs | 2 ++ RNSReloaded.Interfaces/Structs.cs | 7 +++++++ RNSReloaded/BattlePatterns.cs | 4 ++++ RNSReloaded/RNSReloaded.cs | 2 +- 4 files changed, 14 insertions(+), 1 deletion(-) diff --git a/RNSReloaded.Interfaces/IBattlePatterns.cs b/RNSReloaded.Interfaces/IBattlePatterns.cs index a227ef4..7ae2422 100644 --- a/RNSReloaded.Interfaces/IBattlePatterns.cs +++ b/RNSReloaded.Interfaces/IBattlePatterns.cs @@ -109,6 +109,8 @@ public void displaynumbers( public void enrage_deco(CInstance* self, CInstance* other, int? warningDelay = null, int? spawnDelay = null); + public void erase_patterns_network(CInstance* self, CInstance* other); + // (x, y) refers to the center of the field. Element is which color (purple, yellow, red, blue) public void fieldlimit_rectangle( CInstance* self, CInstance* other, Position? position = null, int? width = null, int? height = null, int? color = null, int? targetMask = null diff --git a/RNSReloaded.Interfaces/Structs.cs b/RNSReloaded.Interfaces/Structs.cs index d86e667..59f3b2e 100644 --- a/RNSReloaded.Interfaces/Structs.cs +++ b/RNSReloaded.Interfaces/Structs.cs @@ -588,6 +588,13 @@ public unsafe struct CLayerElementBase : ILinkedListElement { public CLayerElementBase* GetNext() => this.Next; public CLayerElementBase* GetPrev() => this.Previous; + + public string GetName() { + if (this.Name == null) { + return "Unnamed"; + } + return Marshal.PtrToStringAnsi((nint) this.Name) ?? "Unnamed"; + } } [StructLayout(LayoutKind.Sequential, Pack = 8)] diff --git a/RNSReloaded/BattlePatterns.cs b/RNSReloaded/BattlePatterns.cs index 1c1e50b..e88682a 100644 --- a/RNSReloaded/BattlePatterns.cs +++ b/RNSReloaded/BattlePatterns.cs @@ -500,6 +500,10 @@ public void enrage_deco(CInstance* self, CInstance* other, int? warningDelay = n this.execute_pattern(self, other, "bp_enrage_deco", args); } + public void erase_patterns_network(CInstance* self, CInstance* other) { + this.execute_pattern(self, other, "bp_erase_patterns_network", []); + } + // (x, y) refers to the center of the field. Element is which color (purple, yellow, red, blue) public void fieldlimit_rectangle( CInstance* self, CInstance* other, Position? position = null, int? width = null, int? height = null, int? color = null, int? targetMask = null diff --git a/RNSReloaded/RNSReloaded.cs b/RNSReloaded/RNSReloaded.cs index 12b34a4..639c422 100644 --- a/RNSReloaded/RNSReloaded.cs +++ b/RNSReloaded/RNSReloaded.cs @@ -145,7 +145,7 @@ public string GetString(RValue* value) { public List GetStructKeys(RValue* value) { if (value->Type != RValueType.Object) return []; - RValue[] args = [value->Object->ID]; + RValue[] args = [value->Object]; RValue arr = IRNSReloaded.Instance.ExecuteCodeFunction("variable_instance_get_names", null, null, args) ?? new RValue([]); List ret = []; foreach (var key in arr.AsSpan()) {