-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathProgram.cs
More file actions
3298 lines (2946 loc) · 111 KB
/
Copy pathProgram.cs
File metadata and controls
3298 lines (2946 loc) · 111 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
//EoSD2FW v0.3 [Gabolate 2026. Apache 2.0 License]
using System.Diagnostics;
using System.Runtime.CompilerServices;
//const string Rank32 = "_S(0.015625f * _f(RANK + 1024))";
const bool Debugging = false;
const bool FIND_DEBUG = false;
const bool LINE_DEBUG = false;
const bool SUB_DEBUG = false;
const bool LASER_DEBUG = false;
const bool BOSSEND_DEBUG = false;
const bool REGISTER_DEBUG = false;
string lifeInt = "";
string timeInt = "";
string deathFunc = "";
string lifeFunc = "";
bool usesHardcoded = false; //for bullets in functions that have hardcoded instructions
bool customLife = false; //used to override enemy_life_set with the Sub-Params' life
bool customRank = false; //used to override bullet_rank_influence with the Sub-Params' version
//unused!
bool customLifeBar = false; //uses to override enemy_lifebar_color with the Sub-Params' bar
string[] eosdSTG = new string[0];
string[] SubsFile = new string[0];
string currentFunction = "";
string dialogInterrupt = ""; //beings empty and later contains the function to run after dialog
List<string> fwSTG = new List<string>();
List<string> enemyFunctions = new List<string>(); //used to store the names of the functions that require saving the registers into the enemy's variables
List<string> laserFunctions = new List<string>(); //used to know in which functions it should store the lasers' initial and current rotations
List<string> FuncsFound = new List<string>(); //used to store the stage's functions
List<string> bossEndFunctions = new List<string>(); //Used to store the functions used by bosses when they are defeated. (Mainly to tell the timeline when to resume)
List<string> noWaitFunctions = new List<string>(); //used to store functions by non-boss enemies that use death_callback_sub so any wait instructions are skipped
List<string> callbackClearFunctions = new List<string>(); //[UNUSED!] used to store the functions that are referenced by callbacks so it can clear them after jumping
Dictionary<string, List<string>> SubParams = new Dictionary<string, List<string>>(); //Used to store instructions that will be added on the start of functions
//unused:
//List<MultiCallback> callbacks = new List<MultiCallback>(); //Used to store the functions to run on timeouts and when life reaches certain value
Dictionary<string, string> insNumbers = new Dictionary<string, string>()
{
["bullet_fan_aimed"] = "0",
["bullet_fan"] = "1",
["bullet_circle_aimed"] = "2",
["bullet_circle"] = "3",
["bullet_offset_circle_aimed"] = "4",
["bullet_offset_circle"] = "5",
["bullet_random_angle"] = "6",
["bullet_random_speed"] = "7",
["bullet_random"] = "8",
["jump_lss"] = "== -1)",
["jump_leq"] = "< 1)",
["jump_equ"] = "== 0)",
["jump_gre"] = "== 1)",
["jump_geq"] = "> -1)",
["jump_neq"] = "!= 0)",
["call_lss"] = "== -1)",
["call_leq"] = "< 1)",
["call_equ"] = "== 0)",
["call_gre"] = "== 1)",
["call_geq"] = "> -1)",
["call_neq"] = "!= 0)",
};
string temp = "";
string bulletS = ""; //bullet sound
bool exitInsideLoop = false; //used to exit certain loops
int currentBoss = 0; //0 = midboss, 1 = boss
int tmpInt = 0;
int dummyInt = 0;
bool alreadySetFuncs = false; //Used to tell if the variables for the life and timeout interrupts are set
bool tempLaserMoves = false; //Tells if the laser that is going to spawn can move or if it is infinite
bool alreadySetLaser = false; //used to know if the laser index was set
bool alreadySetBackup = false; //used to know if the backup registers were set
bool alreadySetComp = false; //used to know if the comparison temp variable was set
bool alreadySetEX = false; //used to know if the bullet_effects variables (a, b, r, s) were already initialized inside the current function
bool alreadySetSound = false; //by default bullets that have the 512 flag (sound) will use the main sfx, but if it was set to custom it won't use the defaults
int timelinePos = 0; //EoSD timeline position
int fwInsert = 0; //Location to insert more code right before the timeline
bool autoShoot = true; //tells if it should automatically shoot bullets after setting their properties
bool outsideTimeline = true; //when 'true' it inserts lines instead of adding them. used to fill data between the start of the script and the timeline
int usedEx = -1; //used to tell which hardcoded instruction exists in that function
bool timelineBossDebug = false; //used by SubParams to make the timeline skip all functions except the boss-related ones.
Principal();
void Principal()
{
Console.WriteLine("Input the Sub-Params file:");
string sp = Console.ReadLine();
if (sp == null || !File.Exists(sp))
{
Console.WriteLine("The Sub-Param could NOT be found!");
Environment.Exit(-1);
}
SubsFile = File.ReadAllLines(sp);
Console.WriteLine();
Console.WriteLine("Write the number of the stage to convert (1-7):");
string st = Console.ReadLine();
if (st != null)
{
uint stg = 0;
if (uint.TryParse(st, out stg))
{
if (stg > 0 && stg <= 7)
{
Convert((int)stg, ReadSubEntries((int)stg));
}
/*
switch (stg)
{
case 1:
Stage1();
break;
case 2:
Stage2();
break;
case 3:
Stage3();
break;
case 4:
Stage4();
break;
case 5:
Stage5();
break;
case 6:
Stage6();
break;
case 7:
StageEX();
break;
}*/
}
Console.WriteLine("Invalid Stage");
Environment.Exit(-1);
}
Console.WriteLine("Invalid Stage");
Environment.Exit(-1);
}
/*void Stage1()
{
Convert(1)
}*/
//stages 1-7 (7 for extra stage)
void Convert(int stage, bool skipDialog)
{
eosdSTG = File.ReadAllLines($"ecldata{stage}.txt");
fwSTG.Clear();
enemyFunctions.Clear();
bossEndFunctions.Clear();
noWaitFunctions.Clear();
currentBoss = 0;
outsideTimeline = true;
a($"anim {{ \"enemy.anm\"; \"st0{stage}enm.anm\"; }}"); //Include ANM
a("ecli { \"default.ecl\"; }"); //Include ECL
a("global SCREEN_FIX = -192.0f;"); //Used to convert EoSD's X/Horizontal coordinates
a("void MainBossSpell();");
a("");
a("void AutoDelay(int delay)");
a("{");
a("MainLoop:");
//b(1, "ecl_time_sub((RAND_INT % delay) + (delay / 5));");
//b(1, "ecl_time_sub(delay / 5);");
b(1, "ecl_time_sub((BOSS_ALIVE ? (RAND_INT % (delay / 2)) + (delay / 2) : ((RAND_INT % delay / 5) + (delay / 5 * (5 - DIFFICULTY))) / 2));");
b(1, "shoot_now(0);");
b(1, "goto MainLoop;");
a("}");
a("");
a("void Auto(int delay)");
a("{");
a("MainLoop:");
b(1, "ecl_time_sub(delay);");
b(1, "shoot_now(0);");
b(1, "goto MainLoop;");
a("}");
a("");
a("void SpellEnd()");
a("{");
b(1, "if (SPELL_TIMEOUT)");
b(1, "{");
b(2, "bullet_clear_radius(640.0f);");
b(1, "}");
b(1, "else");
b(1, "{");
b(2, "bullet_cancel_radius(640.0f);");
b(1, "}");
b(1, "phase_timer_clear();");
b(1, "async_stop_all();");
b(1, "enemy_kill_all_stones();");
b(1, "spellcard_end();");
b(1, "GF0 = 0.0f;");
b(1, "GF1 = 0.0f;");
b(1, "GF2 = 0.2f;");
b(1, "GF3 = 0.2f;");
b(1, "GF4 = 0.2f;");
b(1, "GF5 = 0.2f;");
b(1, "ex_ins_repeat(0);");
b(1, "laser_clear_all();");
b(1, "effect_sound(27);");
b(1, "player_protect_range(0.0f);");
b(1, "move_velocity_abs(0.0f, 0.0f);");
b(1, "move_velocity_abs_interp(0, 0, 0.0f, 0.0f);");
b(1, "move_position_abs_interp(0, 0, 0.0f, 0.0f);");
b(1, "$PLAYER_DEATHS = 0;");
b(1, "$PLAYER_BOMBS_USED = 0;");
b(1, "$SPELL_CAPTURE = 1;");
a("}");
a("");
a("void BossDead()");
a("{");
b(1, "__enemy_manager_set_unknown_F(0);");
b(1, "enemy_flags_set(156);");
b(1, "effect_sound(5);");
b(1, "move_velocity_abs(%RAND_ANGLE, 0.4f);");
b(1, "enemy_create_rel(\"Ecl_EtBreak2_ni\", 0.0f, 0.0f, 9999, 0, 0);");
b(1, "enemy_kill_all();");
a("+60:");
b(1, "bullet_cancel();");
b(1, "spellcard_end();");
b(1, "effect_screen_shake(30, 12, 0);");
b(1, "anm_create_front(1, 25);");
b(1, "anm_create_front(1, 57);");
b(1, "effect_sound(5);");
b(1, "boss_set(-1);");
b(1, "enemy_delete();");
b(1, "return;");
a("}");
a("");
a("void BossCheck()");
a("{");
a("MainLoop:");
b(1, "if (BOSS_ALIVE)");
b(1, "{");
b(2, "ecl_time_sub(1);");
b(2, "goto MainLoop;");
b(1, "}");
a("}");
a("");
/*
a("void RankSimulator()");
a("{");
b(1, "enemy_flags_set(32);");
b(1, "GI2 = 16;");
b(1, "int subRank = 0;");
b(1, "EI0 = 0;"); //subrank
a("!E");
b(1, "12;");
a("!NHL");
b(1, "10;");
a("!X");
b(1, "14;");
a("!*");
b(1, "EI1 = [-1];"); //Minimum rank
b(1, "");
a("");
a("!E");
b(1, "20;");
a("!NHL");
b(1, "32;");
a("!X");
b(1, "18;");
a("!*");
b(1, "EI2 = [-1];"); //Maximum rank
b(1, "@RankDeaths() async;");
b(1, "@RankPower() async;");
b(1, "@RankBombs() async;");
b(1, "@RankPersist() async;");
b(1, "ecl_time_sub(999999);");
a("}");
a("");
a("");
a("void RankPersist()");
a("{");
a("MainLoop:");
b(1, "msg_wait();");
b(1, "ecl_time_sub(1920);");
b(1, "GI2 += 1;");
b(1, "if (GI2 > EI2)"); //EI1 = Min. EI2 = Max
b(1, "{");
b(2, "GI2 = EI2;");
b(1, "}");
b(1, "goto MainLoop;");
a("}");
a("");
a("void RankDeaths()");
a("{");
b(1, "int lastDeath = PLAYER_DEATHS;");
a("MainLoop:");
b(1, "if (PLAYER_DEATHS > lastDeath)");
b(1, "{");
b(2, "lastDeath = PLAYER_DEATHS;");
b(2, "EI0 -= 1600;");
a("MiniLoop:");
b(2, "if (EI0 < 100)");
b(2, "{");
b(3, "GI2 -= 1;");
b(3, "EI0 += 100;");
b(3, "goto MiniLoop;");
b(2, "}");
b(2, "if (GI2 < EI1)"); //EI1 = Min. EI2 = Max
b(2, "{");
b(3, "GI2 = EI1;");
b(2, "}");
b(2, "else if (PLAYER_DEATHS < lastDeath)");
b(2, "{");
b(3, "lastDeath = PLAYER_DEATHS;");
b(2, "}");
b(1, "}");
b(1, "ecl_time_sub(1);");
b(1, "goto MainLoop;");
a("}");
a("");
a("void RankPower()");
a("{");
b(1, "int lastPower = PLAYER_POWER;");
a("MainLoop:");
b(1, "if (PLAYER_POWER > lastPower)");
b(1, "{");
b(2, "lastPower = PLAYER_POWER;");
b(2, "EI0 += 1;");
a("MiniLoop:");
b(2, "if (EI0 >= 100)");
b(2, "{");
b(3, "GI2 += 1;");
b(3, "EI0 -= 100;");
b(3, "goto MiniLoop;");
b(2, "}");
b(2, "if (GI2 > EI2)"); //EI1 = Min. EI2 = Max
b(2, "{");
b(3, "GI2 = EI2;");
b(2, "}");
b(2, "else if (PLAYER_POWER < lastPower)");
b(2, "{");
b(3, "lastPower = PLAYER_POWER;");
b(2, "}");
b(1, "}");
b(1, "ecl_time_sub(1);");
b(1, "goto MainLoop;");
a("}");
a("");
a("void RankBombs()");
a("{");
b(1, "int lastBomb = PLAYER_BOMBS_USED;");
a("MainLoop:");
b(1, "if (PLAYER_BOMBS_USED > lastBomb)");
b(1, "{");
b(2, "lastBomb = PLAYER_BOMBS_USED;");
b(2, "EI0 -= 200;");
a("MiniLoop:");
b(2, "if (EI0 <= 100)");
b(2, "{");
b(3, "GI2 -= 1;");
b(3, "EI0 += 100;");
b(3, "goto MiniLoop;");
b(2, "}");
b(2, "if (GI2 < EI1)"); //EI1 = Min. EI2 = Max
b(2, "{");
b(3, "GI2 = EI1;");
b(2, "}");
b(2, "else if (PLAYER_BOMBS_USED < lastBomb)");
b(2, "{");
b(3, "lastBomb = PLAYER_BOMBS_USED;");
b(2, "}");
b(1, "}");
b(1, "ecl_time_sub(1);");
b(1, "goto MainLoop;");
a("}");
a("");
*/
fixInsVars(); //changes variables to match FW's
outsideTimeline = false;
for (int i = eosdSTG.Length - 1; i > 0; i--) //Search for the timeline
{
if (eosdSTG[i].StartsWith("timeline "))
{
timelinePos = i;
break;
}
}
a("void main()");
a("{");
a(" enemy_flags_set(32);");
a(" ecl_time_sub(1);");
a(" chapter_set(0);");
a(" ecl_time_sub(1);");
b(1, "__stone_value_set(1);");
b(1, "GF0 = 0.0f;");
b(1, "GF1 = 0.0f;");
b(1, "GF2 = 0.2f;");
b(1, "GF3 = 0.2f;");
b(1, "GF4 = 0.2f;");
b(1, "GF5 = 0.2f;");
//b(1, "enemy_create_abs(\"RankSimulator\", 0.0f, 0.0f, 999999, 0, 0);");
dummyInt = skipDialog ? 1 : 0;
//Converts EoSD's timeline into a "main" enemy for FW
for (int i = timelinePos; i < eosdSTG.Length; i++)
{
if (!timelineBossDebug)
{
//Time label
if (eosdSTG[i].Contains("+") && eosdSTG[i].Contains(": //"))
{
a(eosdSTG[i]);
}
else if (c(i, "ins_0(") && c(i, ");")) //Spawn enemy at absolute position
{
TimelineBossCheck(stage);
b(1, $"if (!BOSS_ALIVE || GI3 != 123) enemy_create_abs({ex(i, 2) /*Function*/}, {ex(i, 3) /*X*/} + SCREEN_FIX, {ex(i, 4) /*Y*/}, _S(_f({ex(i, 6) /*Life*/}) * 1.75f) + 62, {ex(i, 8) /*Score*/}, {GetItem(ex(i, 7)) /*Item*/});");
}
else if (c(i, "ins_2(") && c(i, ");")) //Spawn Mirrored enemy at absolute position
{
TimelineBossCheck(stage);
b(1, $"if (!BOSS_ALIVE || GI3 != 123) enemy_create_abs_mirror({ex(i, 2) /*Function*/}, {ex(i, 3) /*X*/} + SCREEN_FIX, {ex(i, 4) /*Y*/}, _S(_f({ex(i, 6) /*Life*/}) * 1.75f) + 62, {ex(i, 8) /*Score*/}, {GetItem(ex(i, 7)) /*Item*/});");
}
else if (c(i, "ins_4(") && c(i, ");")) //Spawn enemy at random position
{
TimelineBossCheck(stage);
b(1, $"if (!BOSS_ALIVE || GI3 != 123) enemy_create_abs({ex(i, 2) /*Function*/}, RAND_FLOAT_SIGNED * 192.0f, {ex(i, 4) /*Y*/}, _S(_f({ex(i, 6) /*Life*/}) * 1.75f) + 62, {ex(i, 8) /*Score*/}, {GetItem(ex(i, 7)) /*Item*/});");
}
else if (c(i, "ins_6(") && c(i, ");")) //Spawn Mirrored enemy at random position
{
TimelineBossCheck(stage);
b(1, $"if (!BOSS_ALIVE || GI3 != 123) enemy_create_abs_mirror({ex(i, 2) /*Function*/}, RAND_FLOAT_SIGNED * 192.0f, {ex(i, 4) /*Y*/}, _S(_f({ex(i, 6) /*Life*/}) * 1.75f) + 62, {ex(i, 8) /*Score*/}, {GetItem(ex(i, 7)) /*Item*/});");
}
else if (c(i, "ins_8(") && c(i, ");")) //Shows dialog
{
if (!skipDialog)
{
b(1, $"msg_read({ex(i, 2)});");
}
skipDialog = false;
}
else if (c(i, "ins_9(") && c(i, ");")) //Waits for a dialog pause
{
b(1, $"msg_wait();");
}
else if (c(i, "ins_12(") && c(i, ");")) //Waits until there are no bosses
{
b(1, $"boss_wait();");
}
else if (s(i, "}")) //End of timeline
{
b(1, "chapter_set(81);");
a("}");
break;
}
}
}
outsideTimeline = true;
ScanEnemyFuncs();
ScanBossEnd();
ScanLasers();
if (timelineBossDebug) //jump only to midbosses and final bosses in the timeline
{
outsideTimeline = false;
tmpInt = 0;
b(1, "goto MidBoss;");
for (int i = timelinePos; i < eosdSTG.Length; i++)
{
//Time label
if (eosdSTG[i].Contains("+") && eosdSTG[i].Contains(": //"))
{
a(eosdSTG[i]);
}
else if (c(i, "ins_0(") && c(i, ");")) //Spawn enemy at absolute position
{
if (f(ex(i, 2).Replace("\"", ""), "boss_set", ref dummyInt) || f(ex(i, 2).Replace("\"", ""), "enemy_interrupt_set", ref dummyInt))
{
if (tmpInt == 0)
{
a("MidBoss:");
}
else if (tmpInt == 1)
{
a("FinalBoss:");
}
b(1, "@BossCheck();");
b(1, "ecl_time_sub(120);");
b(1, $"enemy_create_abs({ex(i, 2) /*Function*/}, {ex(i, 3) /*X*/} + SCREEN_FIX, {ex(i, 4) /*Y*/}, _S(_f({ex(i, 6) /*Life*/}) * 1.75f) + 62, {ex(i, 8) /*Score*/}, {GetItem(ex(i, 7)) /*Item*/});");
if (tmpInt == 0)
{
b(1, "goto FinalBoss;");
}
tmpInt++;
}
}
else if (c(i, "ins_8(") && c(i, ");")) //Shows dialog
{
if (!skipDialog)
{
b(1, $"msg_read({ex(i, 2)});");
}
skipDialog = false;
}
else if (c(i, "ins_9(") && c(i, ");")) //Waits for a dialog pause
{
b(1, $"msg_wait();");
}
else if (c(i, "ins_12(") && c(i, ");")) //Waits until there are no bosses
{
b(1, $"boss_wait();");
}
else if (s(i, "}")) //End of timeline
{
b(1, "chapter_set(81);");
a("}");
break;
}
}
outsideTimeline = true;
}
a("");
//EI0:
//0 = Timeout
//1 = Life
//2 = Death
/*a("void BossCallback(int I0, int I1, int I2, int I3, int IC0, int IC1, int IC2, int IC3, float F0, float F1, float F2, float F3)");
a("{");
b(1, "EI1 = 0;"); //default 0 (none)
b(1, "if (SPELL_TIMEOUT && GF7 > 0.5f)"); //timeout
b(1, "{");
b(2, "EI1 = _S(GF7);");
b(2, "GF7 = 0.0f;"); //Timeout function
b(2, "GF6 = 0.0f;"); //Timeout amount
b(1, "}");
b(1, "else if (SELF_LIFE < 1 && GI0 >= 1)"); //death
b(1, "{");
b(2, "EI1 = GI0;");
b(2, "GI0 = 0;"); //Death function
b(1, "}");
b(1, "else if (GI2 >= 1)"); //life
b(1, "{");
b(2, "EI1 = GI2;");
b(2, "GI2 = GI0;"); //changes the life function to the death function
b(2, "GI1 = 0;"); //Life amount
b(2, "if (GI0 > 0) callback_ex(0, 0, _S(GF6), \"BossCallback\");"); //sets a new interrupt if a death function was found
b(1, "}");
a("");
a("");
b(1, "switch(EI1)");
b(1, "{");*/
/*
a("void Callbacks()"); //sets a callback_ex by converting the int-1 into a sub
a("{");
//b(1, "int temporal = (type) ? _S(GF6) : GI2;");
b(1, "switch(GI2)");
b(1, "{");
for (int i = 0; i < FuncsFound.Count; i++)
{
b(2, $"case {i + 1}:");
b(3, $"callback_ex(0, (GI0 >= 1) ? GI0 : -1, GI1, \"{FuncsFound[i]}\");");
/*if (AddBackupsAlt(FuncsFound[i]))
{
b(3, $"@{FuncsFound[i]}();");
}
else
{
b(3, $"@{FuncsFound[i]}(0, 0, 0, 0, 0, 0, 0, 0, 0.0f, 0.0f, 0.0f, 0.0f);");
}*/
/*b(3, "break;");
}
b(1, "}");
b(1, "if (GF6 > 0.25f)");
b(1, "{");
b(2, "int temporal = _S(GF6);");
b(2, "switch(temporal)");
b(2, "{");
for (int i = 0; i < FuncsFound.Count; i++)
{
b(3, $"case {i + 1}:");
b(4, $"timer_callback_sub(0, \"{FuncsFound[i]}\");");
/*if (AddBackupsAlt(FuncsFound[i]))
{
b(3, $"@{FuncsFound[i]}();");
}
else
{
b(3, $"@{FuncsFound[i]}(0, 0, 0, 0, 0, 0, 0, 0, 0.0f, 0.0f, 0.0f, 0.0f);");
}*/
//b(4, "break;");
/*}
b(2, "}");
b(1, "}");
a("}");*/
/*b(1, "}");
a("}");*/
a("");
//Converts EoSD's subs into "voids" for FW (stops once it reaches the timeline)
Console.WriteLine($"Timeline position after scans: {timelinePos}");
for (int i = 0; i < timelinePos; i++)
{
if (LINE_DEBUG) Console.WriteLine($"Reading line: {i}");
D();
if (s(i, "!") && ex(i, 1).Length <= 6 && i < timelinePos) //Difficulty parameters
{
D();
a(ex(i, 1));
a("");
eosdSTG[i] = eosdSTG[i].Replace(ex(i, 1), "");
}
D();
if (c(i, "sub Sub") && c(i, "()")) //Functions
{
D();
autoShoot = true;
alreadySetSound = false;
alreadySetEX = false;
alreadySetComp = false;
alreadySetBackup = false;
alreadySetLaser = false;
tempLaserMoves = false;
alreadySetFuncs = false;
customLife = false;
customLifeBar = false;
dialogInterrupt = "";
bulletS = "";
usedEx = -1;
currentFunction = ex(i, 2).Replace("()", "");
if (SUB_DEBUG) Console.WriteLine($"Processing Sub/Function: {currentFunction}");
a("");
if (enemyFunctions.Contains(ex(i, 2).Replace("()", ""))) //requires variables workaround
{
a(eosdSTG[i].Replace("sub ", "void "));
a("{");
VarsRetrieveWorkaround();
}
else
{
a(eosdSTG[i].Replace("sub ", "void ").Replace("()", "(int I0, int I1, int I2, int I3, int IC0, int IC1, int IC2, int IC3, float F0, float F1, float F2, float F3)"));
a("{");
}
/*CurrentSubEntry = HasSubEntry(currentFunction);
if (CurrentSubEntry != -1)
{
ApplyEntryCallback();
}*/
if (f(currentFunction, "effect_particle(3, 2, #80ff80ff);", ref dummyInt) && f(currentFunction, "enemy_life_set(0);", ref dummyInt) && f(currentFunction, "life_callback_threshold(-1);", ref dummyInt))
{
b(1, "@BossDead();");
}
//AddComparison();
//SetFuncs();
b(1, $"{((!alreadySetEX) ? "int" : "")} EXa = 0;");
b(1, $"{((!alreadySetEX) ? "int" : "")} EXb = 0;");
b(1, $"{((!alreadySetEX) ? "float" : "")} EXr = 0;");
b(1, $"{((!alreadySetEX) ? "float" : "")} EXs = 0;");
b(1, "EI0 = 0;");
b(1, "EI1 = 0;");
b(1, "EF0 = 0.0f;");
b(1, "EF1 = 0.0f;");
b(1, "EF2 = 0.0f;");
b(1, "EF3 = 0.0f;");
usesHardcoded = false;
if (f(currentFunction, "ex_ins_", ref dummyInt))
{
switch (ex(dummyInt, 2))
{
case "0": //perfect freeze
b(1, "int hardcoded1 = 0;");
b(1, "int hardcoded2 = 0;");
b(1, "int hardcoded3 = 0;");
break;
case "2": //yumekazura
b(1, "float bSpeed1 = 0.0f;");
b(1, "float bSpeed2 = 0.0f;");
b(1, "float bAng = 0.0f;");
break;
}
usedEx = int.Parse(ex(dummyInt, 2));
usesHardcoded = true;
}
lifeFunc = "";
//SetFuncs(0);
if (laserFunctions.Contains(currentFunction))
{
for (int j = 0; j < 32; j++)
{
b(1, $"float LASER{j}ANGLE = 0.0f;");
}
}
if (f(currentFunction, "boss_set(", ref dummyInt))
{
b(1, "GI0 = 0;");
b(1, "GI1 = 0;");
b(1, "GI2 = 0;");
b(1, "GF6 = 0.0f;");
b(1, "GF7 = 0.0f;");
}
if (SubParams.ContainsKey(currentFunction))
{
for (int j = 0; j < SubParams[currentFunction].Count; j++)
{
if (SubParams[currentFunction][j].Contains("!"))
{
a(SubParams[currentFunction][j]);
}
else
{
if (SubParams[currentFunction][j].Contains("enemy_life_set"))
{
customLife = true;
}
else if (SubParams[currentFunction][j].Contains("enemy_lifebar_color"))
{
customLifeBar = true;
}
else if (SubParams[currentFunction][j].Contains("bullet_rank_influence"))
{
customRank = true;
SubParams[currentFunction][j] = "";
}
b(1, SubParams[currentFunction][j]);
}
}
}
alreadySetEX = true;
if (bossEndFunctions.Contains(currentFunction)) //detects if the function is used to end the boss
{
b(1, "enemy_flags_set(128);");
b(1, "enemy_life_set(99999);");
b(1, "enemy_kill_all();");
b(1, "enemy_flags_clear(128);");
b(2, "enemy_flags_clear(4);");
b(2, "enemy_flags_clear(8);");
b(1, "GI3 = 0;");
b(1, "boss_set_life_count(0);");
if (currentBoss == 0) //daiyousei
{
switch (stage)
{
case 2:
b(1, "chapter_set(22);");
break;
}
}
if (f(currentFunction, "enemy_delete(", ref dummyInt) && !f(currentFunction, "death_callback_sub", ref dummyInt) && !f(currentFunction, "timer_callback", ref dummyInt) && !f(currentFunction, "life_callback", ref dummyInt))
{
b(1, "if (!SPELL_TIMEOUT) effect_sound(5);");
b(1, "EI0 = 999;");
b(1, "effect_screen_shake(30, 12, 0);"); //screenshake if the enemy gets deleted afterwards
}
}
BulletRankReset();
a("");
i++;
}
else if (s(i, "}")) //End of a function
{
D();
a("}");
a("");
}
else if ((c(i, "+") && c(i, ": //")) || s(i, "S") && e(i, ":")) //Time and regular labels
{
D();
if (dialogInterrupt != "" && (c(i, "1000") || c(i, "10000")))
{
b(1, "msg_wait();");
switch (stage)
{
case 1:
case 3:
b(1, "chapter_set(43);");
break;
case 2:
b(1, "chapter_set(41);");
break;
break;
}
AddBackups(i);
if (enemyFunctions.Contains(dialogInterrupt))
{
b(1, $"@{dialogInterrupt}();");
}
else
{
b(1, $"@{dialogInterrupt}(I0, I1, I2, I3, IC0, IC1, IC2, IC3, F0, F1, F2, F3);");
}
}
else
{
a(eosdSTG[i]);
}
}
else if (c(i, "enemy_delete(") && c(i, ");")) //deletes enemy if '1' and otherwise stops executing functions
{
D();
b(1, $"if ({ex(i, 2)} == 1 || SELF_LIFE < 1)");
b(1, "{");
b(2, "enemy_delete();");
b(1, "}");
b(1, "else");
b(1, "{");
b(2, "ecl_time_sub(999999);");
b(1, "}");
}
else if ((c(i, "ret();") && !c(i + 1, "}")) || c(i, "nop();")) //return and nop
{
D();
a(eosdSTG[i]);
}
else if (c(i, "jump(") && c(i, ");")) //jumps
{
D();
b(1, $"goto {ex(i, 3)} @ {ex(i, 2)};");
}
else if (c(i, "loop(") && c(i, ");")) //loops
{
D();
b(1, $"{ex(i, 4)} -= 1;");
b(1, $"if ({ex(i, 4)} != 0)");
b(1, "{");
b(2, $"goto {ex(i, 3)} @ {ex(i, 2)};");
b(1, "}");
}
else if ((c(i, "set_int(") || c(i, "set_float(")) && c(i, ");")) //set a variable
{
D();
b(1, $"{ex(i, 2)} = {ex(i, 3)};");
}
else if (c(i, "set_int_rand_bound(") && c(i, ");")) //set a random value between 0 and smth
{
D();
b(1, $"{ex(i, 2)} = RAND_INT % {ex(i, 3)};");
}
else if (c(i, "set_int_rand_bound_add(") && c(i, ");")) //set a random value between 0 and smth, then add another number (aka the minimum)
{
D();
b(1, $"{ex(i, 2)} = (RAND_INT % {ex(i, 4)}) + {ex(i, 3)};");
}
else if (c(i, "set_float_rand_bound(") && c(i, ");")) //set a random FLOAT value between 0 and smth
{
D();
b(1, $"{ex(i, 2)} = RAND_FLOAT * {ex(i, 3)};");
}
else if (c(i, "set_float_rand_bound_add(") && c(i, ");")) //set a random FLOAT value between 0 and smth, then add another number (aka the minimum)
{
D();
b(1, $"{ex(i, 2)} = (RAND_FLOAT * {ex(i, 4)}) + {ex(i, 3)};");
}
else if (c(i, "set_var_self_x(") & c(i, ");")) //get self x
{
D();
b(1, $"{ex(i, 2)} = _S(SELF_X - SCREEN_FIX);");
}
else if (c(i, "set_var_self_y(") & c(i, ");")) //get self y
{
D();
b(1, $"{ex(i, 2)} = _S(SELF_Y);");
}
else if (c(i, "set_var_self_z(") & c(i, ");")) //get self z (0 since i can't find it lol)
{
D();
b(1, $"{ex(i, 2)} = 0;");
}
else if (c(i, "math_") && c(i, "_add(") & c(i, ");")) //adds 2 values and stores the result in a variable
{
D();
b(1, $"{ex(i, 2)} = {ex(i, 3)} + {ex(i, 4)};");
}
else if (c(i, "math_") && c(i, "_sub(") & c(i, ");")) //subtracts 2 values and stores the result in a variable
{
D();
b(1, $"{ex(i, 2)} = {ex(i, 3)} - {ex(i, 4)};");
}
else if (c(i, "math_") && c(i, "_mul(") & c(i, ");")) //multiplies 2 values and stores the result in a variable
{
D();
b(1, $"{ex(i, 2)} = {ex(i, 3)} * {ex(i, 4)};");
}
else if (c(i, "math_") && c(i, "_div(") & c(i, ");")) //divides 2 values and stores the result in a variable
{
D();
b(1, $"{ex(i, 2)} = {ex(i, 3)} / {ex(i, 4)};");
}
else if (c(i, "math_") && c(i, "_mod(") & c(i, ");")) //gets the mod of 2 values and stores the result in a variable
{
D();
b(1, $"{ex(i, 2)} = {ex(i, 3)} % {ex(i, 4)};");
}
else if (c(i, "math_inc(") && c(i, ");")) //increments a variable by 1
{
D();
b(1, $"{ex(i, 2)} += {(ex(i, 2).Contains("F") || ex(i, 2).Contains("%") ? "1.0f" : "1")};");
}
else if (c(i, "math_dec(") && c(i, ");")) //decrements a variable by 1
{
D();
b(1, $"{ex(i, 2)} -= {(ex(i, 2).Contains("F") || ex(i, 2).Contains("%") ? "1.0f" : "1")};");
}