forked from jadaradix/dsgamemaker
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathDSGMlib.cs
More file actions
3261 lines (3094 loc) · 155 KB
/
DSGMlib.cs
File metadata and controls
3261 lines (3094 loc) · 155 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
using System.ComponentModel.Design;
using System.Diagnostics;
using System.Net.NetworkInformation;
namespace DS_Game_Maker
{
static class DSGMlib
{
public static string[] ResourceTypes = new string[7];
public static short IDVersion = 530;
public static string Domain = "https://ewaygames.com/dsgm/";
public static short UpdateVersion = 0;
public static Bitmap ActionBG = new Bitmap(32, 32);
public static Bitmap ActionConditionalBG = new Bitmap(32, 32);
public static string ProjectPath = string.Empty;
public static string CacheProjectName = string.Empty;
public static bool BeingUsed = false;
public static string CurrentXDS = string.Empty;
public static List<string> FontNames = new List<string>();
public static string[] BannedChars = new string[] { " ", ",", ".", ";", "/", @"\", "!", "\"", "(", ")", "£", "$", "%", "^", "&", "*", "{", "}", "[", "]", "@", "#", "'", "~", "<", ">", "?", "+", "=", "-", "|", "¬", "`" };
public static string[] Numbers = new string[] { "1", "2", "3", "4", "5", "6", "7", "8", "9", "0" };
public static string ImageFilter = "Graphics|*.png; *.gif; *.bmp|PNG Images|*.png|GIF Images|*.gif|Bitmap Images|*.bmp";
public static string LoadDefaultFolder = Environment.GetFolderPath(Environment.SpecialFolder.Desktop);
public static string SaveDefaultFolder = Environment.GetFolderPath(Environment.SpecialFolder.Desktop);
public static bool RedoAllGraphics = false;
public static bool RedoSprites = false;
public static List<string> BGsToRedo = new List<string>();
public static List<string> FontsUsedLastTime = new List<string>();
public static List<string> SoundsToRedo = new List<string>();
public static bool IsNewProject = false;
public static string[] ProActions = new string[] { "Enable Rotation", "Set Angle", "Disable Rotation" };
// Public ProActions() As String = {}
public static string LastResourceFound = string.Empty;
public static string LastScriptTermFound = string.Empty;
public static void FindResource(string ResourceName)
{
LastResourceFound = ResourceName;
if (GetXDSFilter("SPRITE " + ResourceName + ",").Length > 0)
{
OpenResource(ResourceName, (byte)ResourceIDs.Sprite, false);
return;
}
else if (DoesXDSLineExist("BACKGROUND " + ResourceName))
{
OpenResource(ResourceName, (byte)ResourceIDs.Background, false);
return;
}
else if (GetXDSFilter("SCRIPT " + ResourceName + ",").Length > 0)
{
OpenResource(ResourceName, (byte)ResourceIDs.Script, false);
return;
}
else if (DoesXDSLineExist("PATH " + ResourceName))
{
OpenResource(ResourceName, (byte)ResourceIDs.Path, false);
return;
}
else if (GetXDSFilter("ROOM " + ResourceName + ",").Length > 0)
{
OpenResource(ResourceName, (byte)ResourceIDs.Room, false);
return;
}
else if (GetXDSFilter("OBJECT " + ResourceName + ",").Length > 0)
{
OpenResource(ResourceName, (byte)ResourceIDs.DObject, false);
return;
}
else if (GetXDSFilter("SOUND " + ResourceName + ",").Length > 0)
{
OpenResource(ResourceName, (byte)ResourceIDs.Sound, false);
return;
}
MsgInfo("There is no Resource named '" + ResourceName + "'.");
}
public static bool IsObject(string ThingyName)
{
if (GetXDSFilter("OBJECT " + ThingyName + ",").Length > 0)
return true;
else
return false;
}
public static bool IsBG(string ThingyName)
{
return DoesXDSLineExist("BACKGROUND " + ThingyName);
}
public static bool IsRoom(string ThingyName)
{
if (GetXDSFilter("ROOM " + ThingyName + ",").Length > 0)
return true;
else
return false;
}
public static string ResurrectResourceName(string ResourceName)
{
string Returnable = ResourceName;
foreach (string BannedChar in BannedChars)
Returnable = Returnable.Replace(BannedChar, string.Empty);
return Returnable;
}
public static Bitmap GenerateDSSprite(string TheSpriteName)
{
string Folder = SessionsLib.SessionPath + "Sprites/";
byte ImageCount = 0;
var Images = new List<string>();
foreach (string X_ in Directory.GetFiles(Folder))
{
string X = X_;
X = X.Substring(X.LastIndexOf("/") + 1);
X = X.Substring(0, X.IndexOf(".png"));
X = X.Substring(X.IndexOf("_") + 1);
if (X == TheSpriteName)
ImageCount = (byte)(ImageCount + 1);
}
for (int X = 0, loopTo = ImageCount - 1; X <= loopTo; X++)
Images.Add(Folder + X.ToString() + "_" + TheSpriteName + ".png");
var TheSize = PathToImage(Images[0]).Size;
var Returnable = new Bitmap(TheSize.Width, TheSize.Height * Images.Count);
var TempGFX = Graphics.FromImage(Returnable);
short DOn = 0;
foreach (string X in Images)
{
TempGFX.DrawImage(PathToImage(X), new Point(0, DOn * TheSize.Height));
DOn = (short)(DOn + 1);
}
TempGFX.Dispose();
return Returnable;
}
public static object MakeSpaces(byte HowMany)
{
string Returnable = string.Empty;
if (HowMany == 0)
return Returnable;
for (byte X = 0, loopTo = (byte)(HowMany - 1); X <= loopTo; X++)
Returnable += " ";
return Returnable;
}
public static List<string> Fonts = new List<string>();
public static void RebuildFontCache()
{
Fonts.Clear();
foreach (string X in Directory.GetFiles(Constants.AppDirectory + "Fonts"))
{
if (!X.EndsWith(".png"))
continue;
string FontName = X.Substring(X.LastIndexOf("/") + 1);
FontName = FontName.Substring(0, FontName.Length - 4);
Fonts.Add(FontName);
}
}
public static void OpenResource(string ResourceName, byte ResourceType, bool SpriteDataChanged)
{
foreach (Form TheForm in Program.Forms.main_Form.MdiChildren)
{
if (TheForm.Text == ResourceName)
{
TheForm.Focus();
return;
}
}
switch (ResourceType)
{
case (byte)ResourceIDs.Sprite:
{
var SpriteForm = new Sprite();
SpriteForm.SpriteName = ResourceName;
SpriteForm.DataChanged = SpriteDataChanged;
object argInstance = (object)SpriteForm;
ShowInternalForm(ref argInstance);
SpriteForm = (Sprite)argInstance;
break;
}
case (byte)ResourceIDs.DObject:
{
var ObjectForm = new DObject();
ObjectForm.ObjectName = ResourceName;
object argInstance1 = (object)ObjectForm;
ShowInternalForm(ref argInstance1);
ObjectForm = (DObject)argInstance1;
break;
}
case (byte)ResourceIDs.Background:
{
var BGForm = new Background();
BGForm.BackgroundName = ResourceName;
object argInstance2 = (object)BGForm;
ShowInternalForm(ref argInstance2);
BGForm = (Background)argInstance2;
break;
}
case (byte)ResourceIDs.Sound:
{
var SoundForm = new Sound();
SoundForm.SoundName = ResourceName;
object argInstance3 = (object)SoundForm;
ShowInternalForm(ref argInstance3);
SoundForm = (Sound)argInstance3;
break;
}
case (byte)ResourceIDs.Room:
{
var RoomForm = new Room();
RoomForm.RoomName = ResourceName;
object argInstance4 = (object)RoomForm;
ShowInternalForm(ref argInstance4);
RoomForm = (Room)argInstance4;
break;
}
case (byte)ResourceIDs.Script:
{
var ScriptForm = new Script();
ScriptForm.ScriptName = ResourceName;
object argInstance5 = (object)ScriptForm;
ShowInternalForm(ref argInstance5);
ScriptForm = (Script)argInstance5;
break;
}
}
}
public static object CompileWrapper()
{
if (!Directory.Exists(Constants.AppDirectory + "devkitPro/devkitARM"))
{
MsgError("The development toolchain was not found." + Constants.vbCrLf + Constants.vbCrLf + "Please restart " + Application.ProductName + ".");
return false;
}
return true;
}
public static void CompileFail()
{
MsgError("Your game was not successfully compiled and could therefore not be run." + Constants.vbCrLf + Constants.vbCrLf + "Look for logic errors in your game and try again.");
}
public static object SillyFixMe(string Input)
{
if (Input.Length > 5 & Input.Substring(0, Input.Length - 5).StartsWith("this"))
{
Input = Input.Substring(0, Input.Length - 1);
}
else if (char.IsNumber(Input[Input.Length - 1]) == false & char.IsLetter(Input[Input.Length - 1]) == false)
{
Input = Input.Substring(0, Input.Length - 1);
}
return Input;
}
public static object GetTime()
{
string Returnable = DateTime.Now.Hour.ToString() + ":";
if (DateTime.Now.Minute == 0)
Returnable += "00";
if (DateTime.Now.Minute > 0 & DateTime.Now.Minute < 10)
Returnable += "0" + DateTime.Now.Minute.ToString();
if (DateTime.Now.Minute >= 10)
Returnable += DateTime.Now.Minute.ToString();
return Returnable;
}
public static bool CompileGame()
{
Program.Forms.main_Form.compileForm.CustomPerformStep("Cleaning Temporary Data");
File.Delete(SessionsLib.CompilePath + "DSGMTemp" + SessionsLib.Session + ".nds");
foreach (Process TheProcess in Process.GetProcesses())
{
if (TheProcess.ProcessName.ToLower() == "pagfx" | TheProcess.ProcessName.ToLower() == "make")
{
TheProcess.Kill();
}
}
var FontsUsedThisTime = new List<string>();
FontsUsedThisTime.Add("Default");
foreach (string X_ in GetXDSFilter("ACT "))
{
string X = X_;
if (!X.Contains(",Change Font,"))
continue;
X = X.Substring(X.IndexOf(";") + 1);
X = X.Substring(0, X.LastIndexOf(","));
if (!FontsUsedThisTime.Contains(X))
FontsUsedThisTime.Add(X);
}
if (!Directory.Exists(SessionsLib.CompilePath + "gfx/bin"))
{
Directory.CreateDirectory(SessionsLib.CompilePath + "gfx/bin");
}
// Remove fonts not used this time
foreach (string X in FontsUsedLastTime)
{
if (!FontsUsedThisTime.Contains(X))
{
File.Delete(SessionsLib.CompilePath + "gfx/bin/" + X + ".c");
File.Delete(SessionsLib.CompilePath + "gfx/bin/" + X + "_Map.bin");
File.Delete(SessionsLib.CompilePath + "gfx/bin/" + X + "_Tiles.bin");
File.Delete(SessionsLib.CompilePath + "gfx/bin/" + X + "_Pal.bin");
}
}
string FontH = string.Empty;
FontH += "#pragma once" + Constants.vbCrLf;
FontH += "#include <PA_BgStruct.h>" + Constants.vbCrLf;
// FontH += "#ifdef __cplusplus" + vbcrlf
// FontH += " extern ""C"" {" + vbcrlf
// FontH += "#endif" + vbcrlf
// MsgError("fonts used last time")
// For Each Y As String In FontsUsedLastTime
// MsgError(Y)
// Next
foreach (string X in FontsUsedThisTime)
{
// If there's a font in this time's that's not in last times...
if (!FontsUsedLastTime.Contains(X))
{
File.Copy(Constants.AppDirectory + "CompiledBINs/" + X + ".c", SessionsLib.CompilePath + "gfx/bin/" + X + ".c", true);
File.Copy(Constants.AppDirectory + "CompiledBINs/" + X + "_Map.bin", SessionsLib.CompilePath + "gfx/bin/" + X + "_Map.bin", true);
File.Copy(Constants.AppDirectory + "CompiledBINs/" + X + "_Tiles.bin", SessionsLib.CompilePath + "gfx/bin/" + X + "_Tiles.bin", true);
File.Copy(Constants.AppDirectory + "CompiledBINs/" + X + "_Pal.bin", SessionsLib.CompilePath + "gfx/bin/" + X + "_Pal.bin", true);
}
FontH += "extern const PA_BgStruct " + X + ";" + Constants.vbCrLf;
}
// FontH += "#ifdef __cplusplus" + vbcrlf
// FontH += " }" + vbcrlf
// FontH += "#endif"
File.WriteAllText(SessionsLib.CompilePath + "gfx/custom_gfx.h", FontH);
FileInfo[] MyFiles;
if (RedoAllGraphics)
{
MyFiles = new DirectoryInfo(SessionsLib.CompilePath + "gfx").GetFiles();
foreach (FileInfo dra in MyFiles)
{
if (dra.Name.ToLower() == "pagfx.exe" | dra.Name.ToLower() == "custom_gfx.h")
continue;
File.Delete(dra.FullName);
}
}
MyFiles = new DirectoryInfo(SessionsLib.CompilePath + "data").GetFiles();
foreach (FileInfo TheFile in MyFiles)
{
if (TheFile.Name.EndsWith(".raw"))
continue;
File.Delete(TheFile.FullName);
}
MyFiles = new DirectoryInfo(SessionsLib.CompilePath + "nitrofiles").GetFiles();
foreach (FileInfo TheFile in MyFiles)
{
if (TheFile.FullName.EndsWith(".mp3"))
{
bool IsMyMP3 = false;
string RName = TheFile.FullName;
RName = RName.Substring(RName.LastIndexOf("/") + 1);
RName = RName.Substring(0, RName.LastIndexOf("."));
if (IsAlreadyResource(RName).Length > 0)
IsMyMP3 = true;
if (!IsMyMP3)
File.Delete(TheFile.FullName);
}
else
{
File.Delete(TheFile.FullName);
}
}
MyFiles = new DirectoryInfo(SessionsLib.CompilePath + "include").GetFiles();
foreach (FileInfo TheFile in MyFiles)
{
// File.Delete(TheFile.FullName)
if (!(TheFile.Name == "ActionWorks.h"))
File.Delete(TheFile.FullName);
}
if (GetXDSLine("SAVE ").EndsWith("1"))
{
var ff = new byte[32769];
for (short i = 0; i <= 32767; i++)
ff[i] = 0;
File.WriteAllBytes(SessionsLib.CompilePath + "nitrofiles/SaveData.dat", ff);
}
if (GetXDSLine("PROJECTLOGO ").Length < 12)
{
if (File.Exists(SessionsLib.CompilePath + "logo.bmp"))
{
File.Delete(SessionsLib.CompilePath + "logo.bmp");
}
File.Copy(Constants.AppDirectory + "logo.bmp", SessionsLib.CompilePath + "logo.bmp");
}
else
{
if (File.Exists(SessionsLib.CompilePath + "logo.bmp"))
{
File.Delete(SessionsLib.CompilePath + "logo.bmp");
}
File.Copy(GetXDSLine("PROJECTLOGO ").Substring(12), SessionsLib.CompilePath + "logo.bmp");
}
string BootRoom = GetXDSLine("BOOTROOM ").Substring(9);
string FinalString = string.Empty;
FinalString += "#include <PA9.h>" + Constants.vbCrLf;
FinalString += "#include <dirent.h>" + Constants.vbCrLf;
FinalString += "#include <filesystem.h>" + Constants.vbCrLf;
FinalString += "#include <unistd.h>" + Constants.vbCrLf;
// FinalString += "#include ""NitroGraphics.h""" + vbCrLf
File.WriteAllBytes(SessionsLib.CompilePath + "include/NitroGraphics.h", Properties.Resources.NitroGraphics);
if (GetXDSLine("INCLUDE_WIFI_LIB ").Substring(17) == "1")
{
FinalString += "#include \"ky_geturl.h\"" + Constants.vbCrLf;
if (!File.Exists(SessionsLib.CompilePath + "source/ky_geturl.h"))
{
File.WriteAllBytes(SessionsLib.CompilePath + "source/ky_geturl.h", Properties.Resources.WifiLibH);
}
if (!File.Exists(SessionsLib.CompilePath + "source/ky_geturl.c"))
{
File.WriteAllBytes(SessionsLib.CompilePath + "source/ky_geturl.c", Properties.Resources.WifiLibC);
}
}
else
{
if (File.Exists(SessionsLib.CompilePath + "source/ky_geturl.h"))
{
File.Delete(SessionsLib.CompilePath + "source/ky_geturl.h");
}
if (File.Exists(SessionsLib.CompilePath + "source/ky_geturl.c"))
{
File.Delete(SessionsLib.CompilePath + "source/ky_geturl.c");
}
}
FinalString += "#include \"dsgm_gfx.h\"" + Constants.vbCrLf;
FinalString += "#include \"GameWorks.h\"" + Constants.vbCrLf;
Program.Forms.main_Form.compileForm.CustomPerformStep("Converting Sounds");
string RAWString = string.Empty;
string MP3String = string.Empty;
bool DoRAW = false;
bool DoMP3 = false;
foreach (string X in SoundsToRedo)
{
if (iGet(GetXDSLine("SOUND " + X + ","), 1, ",") == "1")
{
MP3String += "mp3enc -b 64 \"" + X + "_enc.mp3\" \"" + X + "\".mp3" + Constants.vbCrLf;
File.Copy(SessionsLib.SessionPath + "Sounds/" + X + ".mp3", SessionsLib.CompilePath + "nitrofiles/" + X + "_enc.mp3");
DoMP3 = true;
}
else
{
RAWString += "sox \"" + X + "\".wav -r 11025 -c 1 -e signed -b 8 \"" + X + "\".raw" + Constants.vbCrLf;
File.Copy(SessionsLib.SessionPath + "Sounds/" + X + ".wav", SessionsLib.CompilePath + "data/" + X + ".wav");
DoRAW = true;
}
}
if (DoRAW)
{
File.Copy(Constants.AppDirectory + "sox.exe", SessionsLib.CompilePath + "data/sox.exe");
File.Copy(Constants.AppDirectory + "libgomp-1.dll", SessionsLib.CompilePath + "data/libgomp-1.dll");
File.Copy(Constants.AppDirectory + "pthreadgc2.dll", SessionsLib.CompilePath + "data/pthreadgc2.dll");
File.Copy(Constants.AppDirectory + "zlib1.dll", SessionsLib.CompilePath + "data/zlib1.dll");
DSGMlib.RunBatchString(RAWString, SessionsLib.CompilePath + "data", false);
File.Delete(SessionsLib.CompilePath + "data/sox.exe");
File.Delete(SessionsLib.CompilePath + "data/libgomp-1.dll");
File.Delete(SessionsLib.CompilePath + "data/pthreadgc2.dll");
File.Delete(SessionsLib.CompilePath + "data/zlib1.dll");
foreach (string X in SoundsToRedo)
{
if (iGet(GetXDSLine("SOUND " + X + ","), 1, ",") == "1")
continue;
File.Delete(SessionsLib.CompilePath + "data/" + X + ".wav");
}
}
if (DoMP3)
{
File.Copy(Constants.AppDirectory + "mp3enc.exe", SessionsLib.CompilePath + "nitrofiles/mp3enc.exe");
DSGMlib.RunBatchString(MP3String, SessionsLib.CompilePath + "nitrofiles", false);
foreach (string X in SoundsToRedo)
{
if (iGet(GetXDSLine("SOUND " + X + ","), 1, ",") == "0")
continue;
File.Delete(SessionsLib.CompilePath + "nitrofiles/" + X + "_enc.mp3");
}
File.Delete(SessionsLib.CompilePath + "nitrofiles/mp3enc.exe");
}
FinalString += Constants.vbCrLf;
foreach (string X in GetXDSFilter("NITROFS "))
{
string FileName = X.Substring(8);
File.Copy(SessionsLib.SessionPath + "NitroFSFiles/" + FileName, SessionsLib.CompilePath + "nitrofiles/" + FileName, true);
}
// FinalString += "s16 score = " + GetXDSLine("SCORE ").ToString.Substring(6) + ";" + vbcrlf
// FinalString += "s16 health = " + GetXDSLine("HEALTH ").ToString.Substring(7) + ";" + vbcrlf
// FinalString += "s16 lives = " + GetXDSLine("LIVES ").ToString.Substring(6) + ";" + vbcrlf
// If GetXDSFilter("GLOBAL ").Length > 0 Then
// FinalString += vbcrlf
// End If
// If GetXDSFilter("GLOBAL ").Length > 0 Then
// FinalString += vbcrlf
// End If
// FinalString += "bool DSGM_CreateObject(u8 ObjectID, u8 InstanceID, bool Screen, s16 X, s16 Y);" + vbcrlf
// FinalString += "bool DSGM_SetObjectSprite(u8 InstanceID, u8 SpriteID, bool DeleteOld);" + vbcrlf
// FinalString += "bool DSGM_SwitchRoomByIndex(u8 RoomIndex);" + vbcrlf
// FinalString += vbcrlf + "int main (int argc, char ** argv) {" + vbcrlf
FinalString += Constants.vbCrLf + "int main (void) {" + Constants.vbCrLf;
FinalString += " RoomCount = " + GetXDSFilter("ROOM ").Length.ToString() + ";" + Constants.vbCrLf;
FinalString += " score = " + GetXDSLine("SCORE ").Substring(6) + ";" + Constants.vbCrLf;
FinalString += " lives = " + GetXDSLine("LIVES ").Substring(6) + ";" + Constants.vbCrLf;
FinalString += " health = " + GetXDSLine("HEALTH ").Substring(7) + ";" + Constants.vbCrLf;
foreach (string XDSLine_ in GetXDSFilter("GLOBAL "))
{
string XDSLine = XDSLine_;
XDSLine = XDSLine.Substring(7);
string VariableType = iGet(XDSLine, 1, ",");
if (!(VariableType == "String"))
continue;
string VariableName = iGet(XDSLine, 0, ",");
string VariableValue = iGet(XDSLine, 2, ",");
FinalString += " strcpy(" + VariableName + ", \"" + VariableValue + "\");" + Constants.vbCrLf;
}
FinalString += " CurrentRoom = Room_Get_Index(\"" + GetXDSLine("BOOTROOM ").Substring(9) + "\");" + Constants.vbCrLf;
FinalString += " swiWaitForVBlank();" + Constants.vbCrLf;
FinalString += " PA_InitFifo();" + Constants.vbCrLf;
FinalString += " PA_Init();" + Constants.vbCrLf;
// FinalString += " PA_Init2D();" + vbcrlf
FinalString += " DSGM_Init_PAlib();" + Constants.vbCrLf;
FinalString += " Reset_Alarms();" + Constants.vbCrLf;
if (GetXDSLine("NITROFS_CALL ").Substring(13) == "1")
{
FinalString += " nitroFSInit(NULL);" + Constants.vbCrLf;
FinalString += " chdir(\"nitro:/\");" + Constants.vbCrLf;
}
if (GetXDSLine("FAT_CALL ").Substring(9) == "1")
{
FinalString += " fatInitDefault();" + Constants.vbCrLf;
}
if (XDSCountLines("SOUND ") > 0)
{
FinalString += " DSGM_Init_Sound();" + Constants.vbCrLf;
}
FinalString += " " + BootRoom + "();" + Constants.vbCrLf;
FinalString += " return 0;" + Constants.vbCrLf;
FinalString += "}" + Constants.vbCrLf;
string PAini = "#TranspColor Magenta";
PAini += Constants.vbCrLf + "#Backgrounds : " + Constants.vbCrLf;
short DOn = 0;
if (RedoAllGraphics)
{
foreach (string XDSLine_ in GetXDSFilter("BACKGROUND "))
{
string XDSLine = XDSLine_;
XDSLine = XDSLine.Substring(11);
string BackgroundName = iGet(XDSLine, 0, ",");
var BGImage = DSGMlib.PathToImage(SessionsLib.SessionPath + "Backgrounds/" + BackgroundName + ".png");
PAini += BackgroundName + ".png ";
if (BGImage.Width > 256 & BGImage.Height > 256)
{
PAini += "LargeMap";
}
else
{
PAini += "EasyBG";
}
File.Copy(SessionsLib.SessionPath + "Backgrounds/" + BackgroundName + ".png", SessionsLib.CompilePath + "gfx/" + BackgroundName + ".png");
PAini += Constants.vbCrLf;
}
}
else
{
foreach (string X in BGsToRedo)
{
// Dim IsBG As Boolean = DoesXDSLineExist("BACKGROUND " + X)
// If Not IsBG Then Continue For
var BGImage = DSGMlib.PathToImage(SessionsLib.SessionPath + "Backgrounds/" + X + ".png");
PAini += X + ".png ";
if (BGImage.Width > 256 & BGImage.Height > 256)
{
PAini += "LargeMap";
}
else
{
PAini += "EasyBG";
}
PAini += Constants.vbCrLf;
File.Copy(SessionsLib.SessionPath + "Backgrounds/" + X + ".png", SessionsLib.CompilePath + "gfx/" + X + ".png", true);
BGImage.Dispose();
DOn = (short)(DOn + 1);
}
}
// FinalString += "u8 ObjectGetPallet(char *ObjectName) {" + vbcrlf
// For Each X As String In GetXDSFilter("OBJECT ")
// X = X.Substring(7)
// Dim ObjectName As String = iget(X, 0, ",")
// Dim SpriteName As String = iget(GetXDSLine("OBJECT " + ObjectName + ","), 1, ",")
// Dim PalletNumber As Byte = 0
// For Each PalletString As String In PalletNumbers
// If PalletString.StartsWith(SpriteName + ",") Then
// PalletNumber = Convert.ToByte(PalletString.Substring(PalletString.IndexOf(",") + 1))
// End If
// Next
// FinalString += " if (strcmp(ObjectName, """ + ObjectName + """) == 0) return " + PalletNumber.ToString + ";" + vbcrlf
// Next
// FinalString += " return 0;" + vbcrlf
// FinalString += "}" + vbcrlf
// Dim EventsHeaderString As String = String.Empty
// For Each XDSLine As String In GetXDSFilter("EVENT ")
// DOn = 0
// XDSLine = XDSLine.Substring(6)
// Dim ObjectName As String = iget(XDSLine, 0, ",")
// Dim MainClass As String = iget(XDSLine, 1, ",")
// Dim StringMainClass As String = MainClassTypeToString(MainClass).Replace(" ", String.Empty)
// Dim SubClass As String = iget(XDSLine, 2, ",")
// Dim StringSubClass As String = SubClass.Replace(" ", String.Empty)
// If StringSubClass = "NoData" Then StringSubClass = String.Empty
// EventsHeaderString += "void " + ObjectName + StringMainClass + StringSubClass + "_Event(u8 DAppliesTo);" + vbcrlf
// Next
PAini += Constants.vbCrLf + "#Sprites : " + Constants.vbCrLf;
var PalletNumbers = new Dictionary<string, string>();
var PalletNames = new Dictionary<string, string>();
var PalletNumbers_Nitro = new Dictionary<string, string>();
var PalletNames_Nitro = new Dictionary<string, string>();
short AllColors = 0;
byte PalletOn = 0;
short AllColors_Nitro = 0;
byte PalletOn_Nitro = 0;
bool FirstRun = true;
foreach (string XDSLine_ in GetXDSFilter("SPRITE "))
{
string XDSLine = XDSLine_;
XDSLine = XDSLine.Substring(7);
string SpriteName = iGet(XDSLine, 0, ",");
var TheImage = GenerateDSSprite(SpriteName);
string SpriteNameExtension = SpriteName + ".png";
short CurrentColors = ImageCountColors(TheImage);
if (iGet(GetXDSLine("SPRITE " + XDSLine), 3, ",") == "Nitro")
{
if (AllColors_Nitro + CurrentColors >= 256)
{
AllColors_Nitro = 0;
PalletOn_Nitro = (byte)(PalletOn_Nitro + 1);
}
else
{
AllColors_Nitro += CurrentColors;
}
PalletNumbers_Nitro.Add(SpriteName , PalletOn_Nitro.ToString());
}
else
{
if (AllColors + CurrentColors >= 256)
{
AllColors = 0;
PalletOn = (byte)(PalletOn + 1);
}
else
{
AllColors += CurrentColors;
}
PalletNumbers.Add(SpriteName , PalletOn.ToString());
}
if (RedoSprites)
{
TheImage.Save(SessionsLib.CompilePath + "gfx/" + SpriteNameExtension);
if (iGet(GetXDSLine("SPRITE " + XDSLine), 3, ",") == "Nitro")
{
PAini += SpriteNameExtension + " 256Colors " + "NitroPal" + PalletOn_Nitro.ToString() + Constants.vbCrLf;
}
else
{
PAini += SpriteNameExtension + " 256Colors " + "DSGMPal" + PalletOn.ToString() + Constants.vbCrLf;
}
}
if (iGet(GetXDSLine("SPRITE " + XDSLine), 3, ",") == "Nitro")
{
if (FirstRun)
{
PalletNames_Nitro.Add(SpriteName, PalletOn_Nitro.ToString());
FirstRun = false;
continue;
}
if (AllColors == 0)
PalletNames_Nitro.Add(SpriteName, PalletOn_Nitro.ToString());
}
else
{
if (FirstRun)
{
PalletNames.Add(SpriteName, PalletOn.ToString());
FirstRun = false;
continue;
}
if (AllColors == 0)
PalletNames.Add(SpriteName, PalletOn.ToString());
}
}
File.WriteAllText(SessionsLib.CompilePath + "gfx/PAGfx.ini", PAini);
string EventsString = string.Empty;
foreach (string XDSLine_ in GetXDSFilter("EVENT "))
{
string XDSLine = XDSLine_;
DOn = 0;
XDSLine = XDSLine.Substring(6);
string ObjectName = iGet(XDSLine, 0, ",");
string MainClass = iGet(XDSLine, 1, ",");
string StringMainClass = ScriptsLib.MainClassTypeToString(Convert.ToByte(MainClass)).Replace(" ", string.Empty);
string SubClass = iGet(XDSLine, 2, ",");
string StringSubClass = SubClass.Replace(" ", string.Empty);
if (StringSubClass == "NoData")
StringSubClass = string.Empty;
if (StringSubClass == "<Unknown>")
continue;
EventsString += "void " + ObjectName + StringMainClass + StringSubClass + "_Event(u8 DAppliesTo) {" + Constants.vbCrLf;
byte CurrentIndent = 1;
byte IndentOrDedent = 0;
byte Added = 0;
foreach (string Y_ in GetXDSFilter("ACT " + ObjectName + "," + MainClass + "," + SubClass + ","))
{
string Y = Y_;
Y = (string)SillyFixMe(Y);
Y = Y.Substring(("ACT " + ObjectName + "," + MainClass + "," + SubClass + ",").Length);
string ActionName = iGet(Y, 0, ",");
if (!File.Exists(Constants.AppDirectory + "Actions/" + ActionName + ".action"))
continue;
IndentOrDedent = 0;
Added = 0;
bool NeedsAppliesToVar = false;
if (!(ActionName == "Execute Code"))
{
foreach (string X in File.ReadAllLines(Constants.AppDirectory + "Actions/" + ActionName.Split('\\')[1] + ".action"))
{
if (X == "INDENT")
IndentOrDedent = 1;
if (X == "DEDENT")
IndentOrDedent = 2;
if (X.Contains("AppliesTo"))
NeedsAppliesToVar = true;
}
}
string Arguments = iGet(Y, 1, ",");
string AppliesToString = iGet(Y, 2, ",");
if (AppliesToString == "<Unknown>" | Arguments.Contains("<Unknown>"))
continue;
byte ArgumentCount = (byte)(HowManyChar(Arguments, ";") + 1);
var InputtedArgumentValues = new List<string>();
for (byte X = 0, loopTo = (byte)(ArgumentCount - 1); X <= loopTo; X++)
InputtedArgumentValues.Add(iGet(Arguments, X, ";").ToString().Replace("<com>", ","));
// For Each X As String In File.ReadAllLines(AppPath + "Actions/" + ActionName + ".action")
// If X = "NOAPPLIES" Then ActionSaysIgnoreApplies = True : Exit For
// Next
if (!(ActionName == "Execute Code"))
{
foreach (string X in ScriptsLib.ApplyFinders)
{
if (Arguments.Contains(X))
NeedsAppliesToVar = true;
}
}
// If Not IgnoreApplies Then NeedsAppliesToVar = True
string TempLine = string.Empty;
// If ApplicationUsed Then
string ToReplace = "AppliesTo";
if (ActionName == "Execute Code")
ToReplace = "DAppliesTo";
for (byte X = 0, loopTo1 = (byte)(InputtedArgumentValues.Count - 1); X <= loopTo1; X++)
{
foreach (string D in ScriptsLib.ApplyFinders)
{
string NoBrackets = D;
NoBrackets = NoBrackets.Substring(1);
NoBrackets = NoBrackets.Substring(0, NoBrackets.Length - 1);
InputtedArgumentValues[X] = InputtedArgumentValues[X].Replace(D, "Instances[" + ToReplace + "]." + NoBrackets);
}
// InputtedArgumentValues.Item(X) = InputtedArgumentValues(X).Replace("[Me]", "DAppliesTo")
}
// End If
if (NeedsAppliesToVar)
{
if (AppliesToString == "this")
{
EventsString = EventsString + MakeSpaces((byte)(CurrentIndent * 2)) + "u16 AppliesTo" + DOn.ToString() + " = DAppliesTo;" + Constants.vbCrLf;
//EventsString = Conversions.ToString(EventsString + Operators.AddObject(Operators.AddObject(Operators.AddObject(Operators.AddObject(MakeSpaces((byte)(CurrentIndent * 2)), "u16 AppliesTo"), DOn.ToString()), " = DAppliesTo;"), Constants.vbCrLf));
Added = 0;
}
else if (IsObject(AppliesToString))
{
EventsString = EventsString + MakeSpaces((byte)(CurrentIndent * 2)) + "u16 AppliesTo" + DOn.ToString() + " = 0;" + Constants.vbCrLf;
EventsString = EventsString + MakeSpaces((byte)(CurrentIndent * 2)) + "for (AppliesTo" + DOn.ToString() + " = 0; AppliesTo" + DOn.ToString() + " < 256; AppliesTo" + DOn.ToString() + "++) {" + Constants.vbCrLf;
EventsString = EventsString + MakeSpaces((byte)(CurrentIndent * 2)) + " if (Instances[AppliesTo" + DOn.ToString() + "].InUse && Instances[AppliesTo" + DOn.ToString() + "].EName == " + AppliesToString + ") {" + Constants.vbCrLf;
//EventsString = Conversions.ToString(EventsString + Operators.AddObject(Operators.AddObject(Operators.AddObject(Operators.AddObject(MakeSpaces((byte)(CurrentIndent * 2)), "u16 AppliesTo"), DOn.ToString()), " = 0;"), Constants.vbCrLf));
//EventsString = Conversions.ToString(EventsString + Operators.AddObject(Operators.AddObject(Operators.AddObject(Operators.AddObject(Operators.AddObject(Operators.AddObject(Operators.AddObject(Operators.AddObject(MakeSpaces((byte)(CurrentIndent * 2)), "for (AppliesTo"), DOn.ToString()), " = 0; AppliesTo"), DOn.ToString()), " < 256; AppliesTo"), DOn.ToString()), "++) {"), Constants.vbCrLf));
//EventsString = Conversions.ToString(EventsString + Operators.AddObject(Operators.AddObject(Operators.AddObject(Operators.AddObject(Operators.AddObject(Operators.AddObject(Operators.AddObject(Operators.AddObject(MakeSpaces((byte)(CurrentIndent * 2)), " if (Instances[AppliesTo"), DOn.ToString()), "].InUse && Instances[AppliesTo"), DOn.ToString()), "].EName == "), AppliesToString), ") {"), Constants.vbCrLf));
CurrentIndent = (byte)(CurrentIndent + 2);
Added = 2;
}
else
{
TempLine = "u8 ArrayAppliesTo" + DOn.ToString() + "[] = {";
byte LoopTo = 0;
for (byte I = 0, loopTo2 = (byte)HowManyChar(AppliesToString, " "); I <= loopTo2; I++)
{
TempLine += iGet(AppliesToString, I, " ") + ", ";
LoopTo = (byte)(LoopTo + 1);
}
TempLine = TempLine.Substring(0, TempLine.Length - 2);
TempLine += "};";
EventsString = EventsString + MakeSpaces((byte)(CurrentIndent * 2)) + TempLine + Constants.vbCrLf;
EventsString = EventsString + MakeSpaces((byte)(CurrentIndent * 2)) + "u16 AppliesTo" + DOn.ToString() + " = 0;" + Constants.vbCrLf;
TempLine = MakeSpaces((byte)(CurrentIndent * 2)) + "for (AppliesTo" + DOn.ToString() + " = 0; AppliesTo" + DOn.ToString() + " < " + LoopTo.ToString() + "; AppliesTo" + DOn.ToString() + "++) {";
//EventsString = Conversions.ToString(EventsString + Operators.AddObject(Operators.AddObject(MakeSpaces((byte)(CurrentIndent * 2)), TempLine), Constants.vbCrLf));
//EventsString = Conversions.ToString(EventsString + Operators.AddObject(Operators.AddObject(Operators.AddObject(Operators.AddObject(MakeSpaces((byte)(CurrentIndent * 2)), "u16 AppliesTo"), DOn.ToString()), " = 0;"), Constants.vbCrLf));
//TempLine = Conversions.ToString(Operators.AddObject(Operators.AddObject(Operators.AddObject(Operators.AddObject(Operators.AddObject(Operators.AddObject(Operators.AddObject(Operators.AddObject(Operators.AddObject(MakeSpaces((byte)(CurrentIndent * 2)), "for (AppliesTo"), DOn.ToString()), " = 0; AppliesTo"), DOn.ToString()), " < "), LoopTo.ToString()), "; AppliesTo"), DOn.ToString()), "++) {"));
EventsString += TempLine + Constants.vbCrLf;
CurrentIndent = (byte)(CurrentIndent + 1);
Added = 1;
}
}
// For Each X As String In File.ReadAllLines(AppPath + "Actions/" + ActionName + ".action")
// If X = "INDENT" Then
// CurrentIndent += 1
// End If
// If X = "DEDENT" Then
// If CurrentIndent > 0 Then CurrentIndent -= 1
// End If
// Next
if (IndentOrDedent == 1)
CurrentIndent = (byte)(CurrentIndent + 1);
if (IndentOrDedent == 2)
{
if (CurrentIndent > 0)
CurrentIndent = (byte)(CurrentIndent - 1);
}
if (ActionName == "Execute Code")
{
string DBASCode = Arguments;
// Dim BRCount As Int16 = HowManyChar(OriginalCode, "<br|>")
// For i As Int16 = 0 To BRCount
// Next
DBASCode = DBASCode.Replace("<br|>", Constants.vbCrLf).Replace("<com>", ",").Replace("<sem>", ";");
string CCode = ScriptsLib.ScriptParseFromContent("Temp", DBASCode, string.Empty, string.Empty, false, true, false);
foreach (string X in StringToLines(CCode))
{
EventsString = EventsString + MakeSpaces((byte)(CurrentIndent * 2)) + X + Constants.vbCrLf;
//EventsString = Conversions.ToString(EventsString + Operators.AddObject(Operators.AddObject(MakeSpaces((byte)(CurrentIndent * 2)), X), Constants.vbCrLf));
}
}
else
{
foreach (string X_ in File.ReadAllLines(Constants.AppDirectory + "Actions/" + ActionName.Split('\\')[1] + ".action"))
{
string X = X_;
if (X.Length == 0)
continue;
if (X.StartsWith("ARG "))
continue;
if (X.StartsWith("DISPLAY "))
continue;
if (X.StartsWith("TYPE "))
continue;
if (X.StartsWith("ICON "))
continue;
if (X.StartsWith("CONDITION "))
continue;
if (X == "INDENT")
continue;
if (X == "DEDENT")
continue;
if (X == "NOAPPLIES")
continue;
for (byte i = 0; i <= 200; i++)
{
if (X[0].ToString() == " ")
X = X.Substring(1);
else
break;
}
for (int FOn = 0, loopTo3 = ArgumentCount - 1; FOn <= loopTo3; FOn++)
X = X.Replace("!" + (FOn + 1).ToString() + "!", InputtedArgumentValues[FOn]);
if (NeedsAppliesToVar)
{
if (IsObject(AppliesToString) | AppliesToString == "this")
{
X = X.Replace("AppliesTo", "DX" + DOn.ToString());
}
else
{
X = X.Replace("AppliesTo", "ArrayDX" + DOn.ToString() + "[DX" + DOn.ToString() + "]");
}
X = X.Replace("DX", "AppliesTo");
}
X = X.Replace("[Me]", "DAppliesTo");
X = MakeSpaces((byte)(CurrentIndent * 2)) + X;
//X = Conversions.ToString(Operators.AddObject(MakeSpaces((byte)(CurrentIndent * 2)), X));
EventsString += X + Constants.vbCrLf;
}
}
if (IndentOrDedent == 0)
{
CurrentIndent -= Added;
if (Added == 1)
{
EventsString = EventsString + MakeSpaces((byte)(CurrentIndent * 2)) + "}" + Constants.vbCrLf;
//EventsString = Conversions.ToString(EventsString + Operators.AddObject(Operators.AddObject(MakeSpaces((byte)(CurrentIndent * 2)), "}"), Constants.vbCrLf));
}
else if (Added == 2)
{
EventsString = EventsString + MakeSpaces((byte)(CurrentIndent * 2)) + " }" + Constants.vbCrLf;
EventsString = EventsString + MakeSpaces((byte)(CurrentIndent * 2)) + "}" + Constants.vbCrLf;
//EventsString = Conversions.ToString(EventsString + Operators.AddObject(Operators.AddObject(MakeSpaces((byte)(CurrentIndent * 2)), " }"), Constants.vbCrLf));
//EventsString = Conversions.ToString(EventsString + Operators.AddObject(Operators.AddObject(MakeSpaces((byte)(CurrentIndent * 2)), "}"), Constants.vbCrLf));
}
}
DOn = (short)(DOn + 1);
}
for (int i = CurrentIndent - 1; i >= 0; i -= 1)
{
EventsString = EventsString + MakeSpaces((byte)(i * 2)) + "}" + Constants.vbCrLf;
//EventsString = Conversions.ToString(EventsString + Operators.AddObject(Operators.AddObject(MakeSpaces((byte)(i * 2)), "}"), Constants.vbCrLf));
}
}
// File.WriteAllText(CompilePath + "source\Events.c", EventsString)
DOn = 0;
// Twas here, Marvolo!
foreach (string X_ in GetXDSFilter("ROOM "))
{
string X = X_;
X = X.Substring(5);
string RoomName = iGet(X, 0, ",");
short TopWidth = Convert.ToInt16(iGet(X, 1, ","));
short TopHeight = Convert.ToInt16(iGet(X, 2, ","));
bool TopScroll = iGet(X, 3, ",") == "1" ? true : false;
string TopBG = iGet(X, 4, ",");
short BottomWidth = Convert.ToInt16(iGet(X, 5, ","));
short BottomHeight = Convert.ToInt16(iGet(X, 6, ","));
bool BottomScroll = iGet(X, 7, ",") == "1" ? true : false;
string BottomBG = iGet(X, 8, ",");
FinalString += "bool " + RoomName + "(void) {" + Constants.vbCrLf;
FinalString += " PA_ResetSpriteSys();" + Constants.vbCrLf;
FinalString += " PA_ResetBgSys();" + Constants.vbCrLf;
if (iGet(GetXDSLine("BACKGROUND " + TopBG), 1, ",") == "Nitro")
{
if (TopBG.Length > 0)
FinalString += " FAT_LoadBackground(1, 2, \"" + TopBG + "\");" + Constants.vbCrLf;
if (BottomBG.Length > 0)
FinalString += " FAT_LoadBackground(0, 2, \"" + BottomBG + "\");" + Constants.vbCrLf;
}
else
{
if (TopBG.Length > 0)
FinalString += " PA_LoadBackground(1, 2, &" + TopBG + ");" + Constants.vbCrLf;
if (BottomBG.Length > 0)
FinalString += " PA_LoadBackground(0, 2, &" + BottomBG + ");" + Constants.vbCrLf;
}
var MyPalletLines = new Dictionary<string, string>();
string MyNewLine = string.Empty;
foreach (var p in PalletNames)
{
byte PalletNo = Convert.ToByte(p.Key.Substring(p.Value.IndexOf(",") + 1));
if (File.ReadAllText(SessionsLib.CompilePath + "gfx/PAGfx.ini").Contains("DSGMPal" + PalletNo.ToString()))
{
MyNewLine = " PA_LoadSpritePal(1, " + PalletNo.ToString() + ", (void*)DSGMPal" + PalletNo.ToString() + "_Pal);";
MyNewLine += " PA_LoadSpritePal(0, " + PalletNo.ToString() + ", (void*)DSGMPal" + PalletNo.ToString() + "_Pal);";
}
bool AlreadyDone = false;
foreach (var MyLine in MyPalletLines)
{
if (MyLine.Value == MyNewLine)
{
AlreadyDone = true;
break;
}
}
if (!AlreadyDone)
{
MyPalletLines.Add("", MyNewLine);
}
}
foreach (var MyLine in MyPalletLines)