forked from LeHulk1/RandoBlazer
-
Notifications
You must be signed in to change notification settings - Fork 3
/
TextUpdate.cpp
1739 lines (1604 loc) · 67.4 KB
/
TextUpdate.cpp
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
#include "Item.h"
#include "Map.h"
#include "Random.h"
#include "ROMData.h"
#include "TextUpdate.h"
#include <iostream>
#include <fstream>
#include <string.h>
#include <vector>
#define NB_NPC_TO_DISABLE_ADDRESSES 27
#define NB_MASTER_INTRO_TEXTS 26
#define NB_MASTER_DEATH_TEXTS 13
#define NB_DEATHTOLL_1_TEXTS 10
#define NB_DEATHTOLL_2_TEXTS 10
#define NB_VICTORY_TEXTS 18
#define TEXT_ENDTYPE_52FA 0
#define TEXT_ENDTYPE_88B9 1
#define TEXT_ENDTYPE_46EC 2
#define TEXT_ENDTYPE_1EA5 3
#define TEXT_ENDTYPE_A3BF 4
#define TEXT_ENDTYPE_DFF0 5
#define TEXT_ENDTYPE_44AA 6
#define TEXT_ENDTYPE_C5EE 7
#define TEXT_ENDTYPE_12 8
/***** Macros to write into ROM *****/
#define TEXT_WriteByte(_Byte_) \
{ \
Byte = _Byte_; \
ROMFile.write((char*)(&Byte), 1); \
}
#define TEXT_WriteString(_String_) {ROMFile.write(_String_, strlen(_String_));}
#define TEXT_WriteItemString(_ItemID_) { \
if (RandomizedItemList[_ItemID_].Contents == ItemID::GEMS_EXP) {TEXT_WriteString("EXP");} \
else {TEXT_WriteString(ItemNameList[(size_t)RandomizedItemList[_ItemID_].Contents]);} \
}
#define TEXT_WriteItemByte(_ItemID_) { \
ItemID Byte = RandomizedItemList[_ItemID_].Contents; \
if (Byte != ItemID::GEMS_EXP && Byte != ItemID::NOTHING) {ROMFile.write((char*)(&Byte), 1);} \
}
/* Handle the different types of text ending (yeah, apparently it's a thing) */
#define TEXT_EndText(_Type_) \
{ \
TEXT_WriteByte(0x13); \
switch (_Type_) { \
case TEXT_ENDTYPE_52FA: \
TEXT_WriteByte(0x52); \
TEXT_WriteByte(0xFA); \
break; \
case TEXT_ENDTYPE_88B9: \
TEXT_WriteByte(0x88); \
TEXT_WriteByte(0xB9); \
break; \
case TEXT_ENDTYPE_46EC: \
TEXT_WriteByte(0x46); \
TEXT_WriteByte(0xEC); \
break; \
case TEXT_ENDTYPE_1EA5: \
TEXT_WriteByte(0x1E); \
TEXT_WriteByte(0xA5); \
break; \
case TEXT_ENDTYPE_A3BF: \
TEXT_WriteByte(0xA3); \
TEXT_WriteByte(0xBF); \
break; \
case TEXT_ENDTYPE_DFF0: \
TEXT_WriteByte(0xDF); \
TEXT_WriteByte(0xF0); \
break; \
case TEXT_ENDTYPE_44AA: \
TEXT_WriteByte(0x44); \
TEXT_WriteByte(0xAA); \
break; \
case TEXT_ENDTYPE_C5EE: \
TEXT_WriteByte(0xC5); \
TEXT_WriteByte(0xEE); \
break; \
} \
}
#define TEXT_EndText12 \
{ \
TEXT_WriteByte(0x12); \
TEXT_WriteByte(0x08); \
TEXT_WriteByte(0x08); \
TEXT_WriteByte(0x04); \
TEXT_WriteByte(0x0C); \
}
#define TEXT_HeroFound \
{ \
TEXT_WriteByte(0x02); \
TEXT_WriteByte(0x02); \
TEXT_WriteByte(0xAF); \
TEXT_WriteByte(0x0D); \
} \
#define TEXT_HeroReceived \
{ \
TEXT_WriteByte(0x02); \
TEXT_WriteByte(0x02); \
TEXT_WriteByte(0x20); \
TEXT_WriteByte(0xD4); \
TEXT_WriteByte(0x0D); \
} \
#define TEXT_YellowStyle \
{ \
TEXT_WriteByte(0x03); \
TEXT_WriteByte(0x24); \
} \
#define TEXT_EndStyle \
{ \
TEXT_WriteByte(0x03); \
TEXT_WriteByte(0x20); \
} \
namespace ROMUpdate {
static int NPCToDisableAddressList[NB_NPC_TO_DISABLE_ADDRESSES] = {
0x1815A, /* Old Woman */
0x184BA, /* Tulip next to Village Chief's house */
0x18775, /* Water mill keeper */
0x18BC4, /* Lisa */
0x19506, /* Old man in Leo's Paintings house */
0x1A13A, /* Village Chief */
0x1AA56, /* Tulip next to Underground Castle */
0x1CA7F, /* Sleeping bird */
0x1D532, /* Greenwood's Guardian */
0x1D869, /* Mole (helping soul) */
0x22E7F, /* Great Door (helping soul) */
0x22FF4, /* Leo's cat */
0x23559, /* Marie */
0x23FCA, /* Soldier next to basement entrance */
0x24616, /* Singer */
0x249D2, /* Queen Magridd */
0x2521B, /* Soldier (helping soul) */
0x255E5, /* King Magridd */
0x25BAF, /* Soldier with Leo */
0x25FE0, /* Dr. Leo (when the two soldiers are not present) */
0x26033, /* Dr. Leo (when the two soldiers are present) */
0xF8109, /* Angelfish (helping soul) */
0xF87FA, /* Mermaid statue (Blester) */
0xF8ACF, /* Mermaid statue (Rockbird) */
0xF8EEA, /* Mermaid statue (Durean) */
0xF966D, /* Mermaid statue (Ghost Ship) */
0xF9BF4 /* Lue */
};
static int NPCItemTextAddressList[60] = {
0x183AE, /* Tool shop owner */
0x188FD, /* Emblem A tile */
0x18A2C, /* Goat pen corner */
0x192DA, /* Tool shop owner's son Teddy */
0x19870, /* A Pass */
0x199DD, /* Tile at end of child's secret cave */
0x1A192, /* Village Chief */
0x1A7FA, /* Magician (start of the game) */
0x1AB84, /* Recovery Sword crystal */
0x1ABBA, /* Grass Valley secret room crystal */
0x1ACBB, /* Underground Castle 1st part crystal */ // D3 AB
0x1BE57, /* Red-Hot Mirror bird */ // 46 EC
0x1C1D9, /* Magic Bell crystal */ // 46 EC
0x1D292, /* Woodstin Trio */ // 46 EC
0x1D53B, /* Greenwood's Guardian */ // 46 EC
0x1D827, /* Greenwood Leaves */ // 46 EC
0x1DC1A, /* Shield Bracelet mole */ // 46 EC
0x1E0DE, /* Psycho Sword squirrel */ // 46 EC
0x1E1EF, /* Emblem C squirrel */ // 46 EC
0x1E49F, /* Water Shrine Strange Bottle */ // 46 EC
0x1E572, /* Light Arrow crystal */ // 46 EC
0x1E360, /* Lost Marsh crystal */ // 46 EC
0x1E6C0, /* Water Shrine crystal */ // 46 EC
0x1EBC3, /* Fire Shrine crystal */ // 46 EC
0x209D5, /* Mountain King */ // 1E A5
0x20DDD, /* Mushroom Shoes boy */ // 1E A5
0x210CD, /* Nome */ // 1E A5
0x21A7A, /* Emblem E snail */ // 1E A5
0x21EB0, /* Emblem F tile */ // 1E A5
0x2249B, /* Mountain of Souls crystal */ // 1E A5
0x21100, /* Lune crystal */ // 1E A5
0x22ADD, /* Emblem G under chest of drawers */ // A3 BF
0x22A7C, /* Chest of drawers (Mystic Armor) */ // A3 BF
0x22BE3, /* Herb Plant in Leo's Lab */ // A3 BF
0x2306D, /* Leo's Cat (door key) */ // A3 BF
0x231AE, /* Actinidia plant */ // A3 BF
0x23404, /* Chest of drawers (Herb) */ // A3 BF
0x235AD, /* Marie */ // A3 BF
0x23922, /* Spark Bomb mouse */ // A3 BF
0x23F34, /* Leo's Lab Basement crystal */ // A3 BF
0x23BC0, /* Model Town 1 crystal */ // A3 BF
0x23C00, /* Power Plant crystal */ // A3 BF
0x24317, /* Elemental Mail soldier */ // DF F0
0x24AB7, /* Super Bracelet tile */ // DF F0
0x24A47, /* Queen Magridd (VIP card) */ // DF F0
0x24C80, /* Platinum Card soldier */ // DF F0
0x24EBA, /* Maid (Herb) */ // DF F0
0x253C4, /* Emblem H tile */ // DF F0
0x2563A, /* Magridd King */ // DF F0
0x264C4, /* Leo on the Airship deck (Mobile key) */ // DF F0
0x26A17, /* Harp String tile */ // DF F0
0, /* North-eastern Mermaid (Herb) */ // 44 AA
0xF8BF8, /* Bubble Armor Mermaid */ // 44 AA
0xF909A, /* Magic Flair Mermaid */ // 44 AA
0xF9280, /* Mermaid Queen */ // 44 AA
0xF9874, /* Red-Hot Stick Mermaid */ // 44 AA
0xF9C13, /* Lue */ // 44 AA
0xFA9C6, /* Rockbird crystal */ // 44 AA
0xF9C40, /* Seabed crystal near Blester */ // 44 AA
0xFA060 /* Seabed crystal near Durean */ // 44 AA
};
static int NPCAlreadyHaveItemTextAddressList[60] = {
0x18429, /* Tool shop owner */
0, /* Emblem A tile */
0, /* Goat pen corner */
0x19320, /* Tool shop owner's son Teddy */
0, /* A Pass */
0, /* Tile at end of child's secret cave */
0, /* Village Chief */
0, /* Magician (start of the game) */
0, /* Recovery Sword crystal */
0, /* Grass Valley secret room crystal */
0, /* Underground Castle 1st part crystal */
0x1BED3, /* Red-Hot Mirror bird */
0x1C225, /* Magic Bell crystal */
0, /* Woodstin Trio */
0, /* Greenwood's Guardian */
0, /* Greenwood Leaves */
0x1DD73, /* Shield Bracelet mole */
0x1E11C, /* Psycho Sword squirrel */
0x1E22C, /* Emblem C squirrel */
0, /* Water Shrine Strange Bottle */
0, /* Light Arrow crystal */
0, /* Lost Marsh crystal */
0, /* Water Shrine crystal */
0, /* Fire Shrine crystal */
0, /* Mountain King */
0x20E73, /* Mushroom Shoes boy */
0, /* Nome */
0x21AB9, /* Emblem E snail */
0, /* Emblem F tile */
0, /* Mountain of Souls crystal */
0, /* Lune crystal */
0, /* Emblem G under chest of drawers */
0x22AB9, /* Chest of drawers (Mystic Armor) */
0x22C22, /* Herb Plant in Leo's Lab */
0, /* Leo's Cat (door key) */
0x23201, /* Actinidia plant */
0x2342F, /* Chest of drawers (Herb) */
0, /* Marie */
0x23977, /* Spark Bomb mouse */
0, /* Leo's Lab Basement crystal */
0, /* Model Town 1 crystal */
0, /* Power Plant crystal */
0, /* Elemental Mail soldier */
0, /* Super Bracelet tile */
0x24A77, /* Queen Magridd (VIP card) */
0, /* Platinum Card soldier */
0x24F0F, /* Maid (Herb) */
0, /* Emblem H tile */
0, /* Magridd King */
0, /* Leo on the Airship deck (Mobile key) */
0, /* Harp String tile */
0xF836D, /* North-eastern Mermaid (Herb) */
0, /* Bubble Armor Mermaid */
0xF90B6, /* Magic Flair Mermaid */
0, /* Mermaid Queen */
0xF98C7, /* Red-Hot Stick Mermaid */
0xF9D87, /* Lue */
0, /* Rockbird crystal */
0, /* Seabed crystal near Blester */
0 /* Seabed crystal near Durean */
};
static int NPCItemAddressList[60] = {
0x183AB, /* Tool shop owner */
0x1875E, /* Emblem A tile */
0x18960, /* Goat pen corner */
0x19253, /* Tool shop owner's son Teddy */
0x1983B, /* A Pass */
0x19914, /* Tile in child's secret cave */
0x1A12D, /* Village Chief - address modified */
0x1A7E4, /* Magician (start of the game) */
0x1AB78, /* Recovery Sword crystal */
0x1AC26, /* Grass Valley secret room crystal */
0x1AD15, /* Underground Castle 1st part crystal */
0x1BE54, /* Red-Hot Mirror bird */
0x1C116, /* Magic Bell crystal */
0x1D120, /* Woodstin Trio */
0x1D525, /* Greenwood's Guardian */
0x1D81E, /* Greenwood Leaves */
0x1DC17, /* Shield Bracelet mole */
0x1E039, /* Psycho Sword squirrel */
0x1E1E3, /* Emblem C squirrel */
0x1E496, /* Water Shrine Strange Bottle */
0x1E569, /* Light Arrow crystal */
0x1E4E3, /* Lost Marsh crystal */
0x1E537, /* Water Shrine crystal */
0x1E5B5, /* Fire Shrine crystal */
0x205A5, /* Mountain King */
0x20D63, /* Mushroom Shoes boy */
0x210C1, /* Nome */
0x21A6E, /* Emblem E snail */
0x21EA7, /* Emblem F tile */
0x21EF5, /* Mountain of Souls crystal */
0x21F49, /* Lune crystal */
0x22A40, /* Emblem G under chest of drawers */
0x22A5B, /* Chest of drawers (Mystic Armor) */
0x22BC1, /* Herb Plant in Leo's Lab */
0x22FB3, /* Leo's Cat (door key) */
0x231AB, /* Actinidia plant */
0x23311, /* Chest of drawers (Herb) */
0x2354D, /* Marie */
0x238F6, /* Spark Bomb mouse */
0x23DFA, /* Leo's Lab Basement crystal */
0x23E4E, /* Model Town 1 crystal */
0x23E7E, /* Power Plant crystal */
0x242A3, /* Elemental Mail soldier */
0x2499B, /* Super Bracelet tile */
0x249C2, /* Queen Magridd (VIP card) */
0x24C3B, /* Platinum Card soldier - address modified */
0x24E94, /* Maid (Herb) */
0x25345, /* Emblem H tile */
0x255D9, /* Magridd King */
0x25F51, /* Leo on the Airship deck (Mobile key) */
0x26A0E, /* Harp String tile */
0xF8315, /* North-eastern Mermaid (Herb) */
0xF8B9F, /* Bubble Armor Mermaid */
0xF9097, /* Magic Flair Mermaid */
0xF9223, /* Mermaid Queen */
0xF9871, /* Red-Hot Stick Mermaid */
0xF9BEB, /* Lue */
0xFA467, /* Rockbird crystal */
0xFA4BB, /* Seabed crystal near Blester */
0xFA4EB, /* Seabed crystal near Durean */
};
static const char* ItemNameList[65] = {
"Nothing",
"Sword of Life",
"Psycho Sword",
"Critical Sword",
"Lucky Blade",
"Zantetsu Sword",
"Spirit Sword",
"Recovery Sword",
"Soul Blade",
"Iron Armor",
"Ice Armor",
"Bubble Armor",
"Magic Armor",
"Mystic Armor",
"Light Armor",
"Elemental Mail",
"Soul Armor",
"Flame Ball",
"Light Arrow",
"Magic Flare",
"Rotator",
"Spark Bomb",
"Flame Pillar",
"Tornado",
"Phoenix",
"Goat`s Food",
"Harp String",
"Pass",
"Dream Rod",
"Leo`s Brush",
"Greenwood Leaf",
"Mole`s Ribbon",
"Big Pearl",
"Mermaid`s Tears",
"Mushroom Shoes",
"Mobile Key",
"Thunder Ring",
"Delicious Seeds",
"Actinidia Leaf",
"Door Key",
"Platinum Card",
"VIP Card",
"Emblem A",
"Emblem B",
"Emblem C",
"Emblem D",
"Emblem E",
"Emblem F",
"Emblem G",
"Emblem H",
"Red-Hot Mirror",
"Red-Hot Ball",
"Red-Hot Stick",
"Power Bracelet",
"Shield Bracelet",
"Super Bracelet",
"Medical Herb",
"Strange Bottle",
"Brown Stone",
"Green Stone",
"Blue Stone",
"Silver Stone",
"Purple Stone",
"Black Stone",
"Magic Bell"
};
static const char* MasterIntroTextList[NB_MASTER_INTRO_TEXTS] = {
"420 Soul blaze it!",
"I`m calling\rSoul Blade in its\rvanilla location.",
"Good luck!\rYou`ll need it!",
"Are we on\rSpeedGaming yet?",
"This run is\rZantetsu-less until\rZantetsu.",
"It`s show time!",
"Dancing grandmas\r HYPE!!!! ",
"Thank you so much\rfor playing my game!",
"Extra credit if\ryou get sub-2h!",
"I`m calling pedestal\rseed on this one.",
"Fun fact: there are\rexactly 400 monster\rlairs in this game.",
"GLHF!",
"Look mom,\rI`m on stream!!!",
"Go and bring back\rthe peace!\r.....Or whatever this\rgame is about.",
"This is totally\rnot a trolly seed.",
"This seed is\rarmor-less until\rWorld of Evil.",
"I can`t wait to\rsee the forced\rmagic-less Laynole.",
"Break a leg!",
"Initializing\rvideogame.....\r .....complete!",
"Super Nintendo is\rthe best console.\rFite me.",
"So you think you\rhave what it takes?",
"Let`s go!\rYou can do it!",
"My PB on this\rseed is 35:37.\rBlindfolded.",
"Help me,\rObi-Wan Kenobi.\rYou`re my only hope.",
"Phoenix in hype cave.\rI`m calling it.",
"Any resemblance with\rActRaiser is purely\rcoincidental."
};
static const char* MasterDeathTextList[NB_MASTER_DEATH_TEXTS] = {
"Ouch! Tough luck :/",
"Better luck next time!",
"Don`t be patient.\rThis is a speedrun\rafter all.",
"Cheer up!\rYou can do it!",
"Trolly seed, huh?",
"Git gud n00b\rLOL",
"Don`t push yourself\rtoo hard.",
"That death was\rRNG manipulation.",
"I`m sorry for\rmaking this seed...",
"Be more careful\rnext time!",
"I`m sure this\rwas a deathwarp!\r .....Right?",
"Come on! Let`s go!",
"Don`t give up.\rYou got this!"
};
static const char* Deathtoll1TextList[NB_DEATHTOLL_1_TEXTS] = {
"Peekaboo!",
"Guess who!",
"Your adventure\rends here.",
"Time for an\repic battle!",
"In case you haven`t\rguessed, I`m the\rfinal boss.",
"How did you make it\rhere? This seed was\rsupposed to be\rsuper trolly!",
"Surpriiiiise!",
"Incoming the game`s\rhardest fight.",
"So we meet again,\rMr. Bond.",
"I`ll put an end\rto your misery."
};
static const char* Deathtoll2TextList[NB_DEATHTOLL_2_TEXTS] = {
"This is not even\rmy final form!",
"All right.\rNow this is\rserious business.",
"I hope you didn`t\rforget Phoenix!",
"Okay, time for an\ractually challenging\rbattle.",
"Time to die!",
"You didn`t think\rit was that easy,\rdid you?",
"Loading Deathtoll.exe\r .......Complete!",
"Don`t tell me\ryou also got the\rSuper Bracelet!?",
"And now behold...\rmy true power!",
"Dang, I hope my next\rphase is better..."
};
static const char* VictoryTextList[NB_VICTORY_TEXTS] = {
"\r G G",
"Thank you Mario.\rBut our princess\ris in another castle!",
"Congratulations!",
"Woohoo!!\rYou made it!!!",
"Thanks a lot for\rplaying this\rrandomizer.",
"Hope you enjoyed\rthis seed!",
"A winner is you!",
"Dang, I really\rthought this seed was\rtoo trolly for you.",
" ...and this is\rthe end of our story.",
"The last Metroid\ris in captivity.\rThe galaxy is\rat peace.",
"Well done!\rNow try Hard mode.\r\r ...just kidding!",
"I`m sorry for\rthis seed...",
"Hi YouTube!",
"This is the end.\rMy only friend,\rthe end.",
"You are a true hero!",
"Hyrule is saved!\r\r ...Wait, wrong game.",
"That`s all folks!",
"Well done!\rBut the next seed\rwon`t be that easy!"
};
static const char* ItemLocations[NUMBER_OF_ITEMS] =
{"Trial Room",
"Grass Valley\rsecret cave",
"Grass Valley\rsecret cave",
"Underground Castle",
"Underground Castle",
"Underground Castle",
"Underground Castle",
"Leo`s Paintings",
"Leo`s Paintings",
"Greenwood",
"Greenwood tunnels",
"Water Shrine",
"Water Shrine",
"Water Shrine",
"Water Shrine",
"Water Shrine",
"Fire Shrine",
"Fire Shrine",
"Fire Shrine",
"Fire Shrine",
"Fire Shrine",
"Light Shrine",
"St. Elles",
"St. Elles",
"Seabed secret cave",
"Seabed secret cave",
"Seabed secret cave",
"Seabed secret cave",
"Southerta",
"Rockbird",
"Rockbird",
"Durean",
"Durean",
"Ghost Ship",
"Northern Seabed",
"Mountain of Souls",
"Mountain of Souls",
"Mountain of Souls",
"Mountain of Souls",
"Mountain of Souls",
"Laynole",
"Laynole",
"Laynole",
"Leo`s Lab",
"Leo`s Lab\rPower Plant",
"Model Town 1",
"Model Town 1",
"Model Town 1",
"Model Town 2",
"Model Town 2",
"Magridd Castle\rBasement",
"Magridd Castle\rBasement",
"Magridd Castle\rBasement",
"Magridd Castle\rBasement",
"Magridd Castle\rBasement",
"Magridd Castle\rBasement",
"Magridd Castle\rRight Tower",
"Magridd Castle\rRight Tower",
"Magridd Castle\rRight Tower",
"Magridd Castle\rRight Tower",
"World of Evil",
"World of Evil",
"World of Evil",
"World of Evil",
"Dazzling Space",
"Dazzling Space",
"Tool Shop Owner",
"Emblem A tile",
"Goat Pen tile",
"Teddy",
"Sleeping Tulip",
"Grass Valley\rSecret hideout",
"Village Chief",
"Magician",
"Recovery Sword\rcrystal fairy",
"Grass Valley\rcrystal fairy",
"Underground Castle\rcrystal fairy",
"Red-Hot Mirror bird",
"Master`s Emblems\rcrystal fairy",
"Woodstin Trio",
"Greenwood`s Guardian",
"Turbo`s bones",
"Shield Bracelet mole",
"Psycho Sword\rsquirrel",
"Emblem C squirrel",
"Water Shrine\rsecret tile",
"Light Arrow\rcrystal fairy",
"Lost Marsh\rcrystal fairy",
"Water Shrine\rcrystal fairy",
"Fire Shrine\rcrystal fairy",
"Mountain King",
"Mushroom Shoes boy",
"Nome",
"Emblem E snail",
"Emblem F tile\rin Lune",
"Mountain of Souls\rcrystal fairy",
"Lune\rcrystal fairy",
"Locked room\rChest of Drawers",
"Locked room\rChest of Drawers",
"Leo`s Lab\rMedical Herb plant",
"Leo`s Cat",
"Actinidia Leaf\rplant",
"Leo`s Attic\rChest of Drawers",
"Marie",
"Spark Bomb Mouse",
"Leo`s Lab basement\rcrystal fairy",
"Model Town 1\rcrystal fairy",
"Power Plant\rcrystal fairy",
"Sleeping Soldier",
"Tile under\rQueen Magridd",
"Queen Magridd",
"Platinum Card\rSoldier",
"Magridd Castle\rMedical Herb Maid",
"Magridd Castle\rEmblem H tile",
"King Magridd",
"Dr.Leo",
"Magridd Castle\rHarp String tile",
"St. Elles\rMedical Herb Mermaid",
"Bubble Armor Mermaid",
"Magic Flare Mermaid",
"Mermaid Queen",
"Red-Hot Stick\rMermaid",
"Lue",
"Rockbird\rcrystal fairy",
"Northern Seabed\rcrystal fairy",
"Southern Seabed\rcrystal fairy"
};
static const char* GetRegionName(const Lair &Lair) {
switch (Lair.PositionData[0]) {
case 0x05:
case 0x06:
return "Underground Castle";
case 0x07:
case 0x08:
case 0x09:
case 0x0B:
case 0x0C:
return "Leo's Paintings";
case 0x0D:
return "Trial Room";
case 0x19:
return "Lost Marshes";
case 0x1A:
case 0x1B:
case 0x1C:
return "Water Shrine";
case 0x1D:
case 0x1E:
case 0x1F:
return "Fire Shrine";
case 0x20:
case 0x21:
case 0x22:
return "Light Shrine";
case 0x2A:
return "Southern Seabed";
case 0x2E:
return "Southerta";
case 0x2F:
return "Rockbird";
case 0x30:
return "Durean";
case 0x31:
return "Blester";
case 0x32:
return "Ghost Ship";
case 0x34:
return "Northern Seabed";
case 0x3E:
case 0x3F:
case 0x45:
return "Mountain of Souls";
case 0x41:
case 0x42:
case 0x44:
return "Lune";
case 0x46:
case 0x47:
return "Laynole";
case 0x56:
case 0x57:
return "Leo`s Lab Basement";
case 0x58:
case 0x59:
return "Leo`s Lab Power Plant";
case 0x5B:
return "Model Town 1";
case 0x5C:
return "Model Town 2";
case 0x66:
case 0x67:
case 0x68:
return "Magridd Castle\rBasement";
case 0x6A:
case 0x6B:
case 0x6C:
return "Magridd Castle\rLeft Tower";
case 0x6D:
case 0x6E:
case 0x6F:
case 0x72:
return "Magridd Castle\rRight Tower";
default:
/* Should not happen */
return "";
}
};
static int PickEndTextCode(int NPCItemID) {
int EndTextCode = TEXT_ENDTYPE_44AA;
if (NPCItemID <= 10) {
EndTextCode = TEXT_ENDTYPE_88B9;
}
else if (NPCItemID <= 23) {
EndTextCode = TEXT_ENDTYPE_46EC;
}
else if (NPCItemID <= 30) {
EndTextCode = TEXT_ENDTYPE_1EA5;
}
else if (NPCItemID <= 41) {
EndTextCode = TEXT_ENDTYPE_A3BF;
}
else if (NPCItemID <= 50) {
EndTextCode = TEXT_ENDTYPE_DFF0;
}
return EndTextCode;
}
int ConvertToHex(int Dec) {
/* Converts a decimal integer into its hex "equivalent"
This is useful where the ROM stores the data as decimal values (like gems in chests). */
return (((Dec / 10) << 4) + (Dec % 10)) & 0xFF;
}
void GeneralTextUpdate(const std::vector<Lair>& RandomizedLairList,
const std::vector<Item>& RandomizedItemList,
std::fstream &ROMFile,
const std::string& Seed) {
unsigned char Byte;
const char* Text;
/*** NPC actions to disable (mostly to remove NPC revival text) */
for (int i=0; i<NB_NPC_TO_DISABLE_ADDRESSES; ++i) {
ROMFile.seekp(NPCToDisableAddressList[i], std::ios::beg);
/* For leader NPCs, keep the 02 37 code to heal the hero */
if (i == 5 || /* Village Chief */
i == 8 || /* Greenwood's Guardian */
i == 12 || /* Marie */
i == 17) { /* King Magridd */
TEXT_WriteByte(0x37); /* Heal the hero completely */
TEXT_WriteByte(0x02);
}
TEXT_WriteByte(0x86);
TEXT_WriteByte(0x6B); /* End code byte */
}
/*** Deathtoll's text */
/* First text */
ROMFile.seekp(0x4EF9, std::ios::beg);
Text = Deathtoll1TextList[Random::RandomInteger(NB_DEATHTOLL_1_TEXTS)];
TEXT_WriteString(Text);
TEXT_EndText12;
/* Text after first phase */
ROMFile.seekp(0x4FB7, std::ios::beg);
Text = Deathtoll2TextList[Random::RandomInteger(NB_DEATHTOLL_2_TEXTS)];
TEXT_WriteString(Text);
TEXT_EndText12;
/* Victory text */
ROMFile.seekp(0x5388, std::ios::beg);
TEXT_WriteByte(0x0B); /* Change text address */
/* Note: there seems to be slightly different text here... diff between Any% and 100%??? */
ROMFile.seekp(0x53C7, std::ios::beg);
TEXT_EndText12;
ROMFile.seekp(0x540C, std::ios::beg);
Text = VictoryTextList[Random::RandomInteger(NB_VICTORY_TEXTS)];
TEXT_WriteString(Text);
TEXT_EndText12;
/* DEBUG!!! Put Deathtoll's HP to 1 */
// ROMFile.seekp(0x997E, std::ios::beg);TEXT_WriteByte(0x01);
/*** Master's text when hero dies */
ROMFile.seekp(0x786B, std::ios::beg);
Text = MasterDeathTextList[Random::RandomInteger(NB_MASTER_DEATH_TEXTS)];
TEXT_WriteString(Text);
TEXT_EndText(TEXT_ENDTYPE_52FA);
/*** Master's text after Brown Stone */
ROMFile.seekp(0x78BC, std::ios::beg);
TEXT_WriteString("One down,\rfive to go!");
TEXT_EndText(TEXT_ENDTYPE_52FA);
/*** Master's first text */
ROMFile.seekp(0x7999, std::ios::beg);
Text = MasterIntroTextList[Random::RandomInteger(NB_MASTER_INTRO_TEXTS)];
TEXT_WriteString(Text);
TEXT_EndText(TEXT_ENDTYPE_52FA);
ROMFile.seekp(0x7A07, std::ios::beg);
TEXT_EndText(TEXT_ENDTYPE_52FA);
/*** Title + file selection screens */
ROMFile.seekp(0x13B2B, std::ios::beg);
TEXT_WriteString("RANDO HYPE");
ROMFile.seekp(0x13B3C, std::ios::beg);
TEXT_WriteString("RandoBlazer v0.5c ");
ROMFile.seekp(0x143B9, std::ios::beg);
TEXT_WriteString("Seed ");
ROMFile.write(Seed.c_str(), 10);
//TEXT_WriteString(Seed.c_str());
/*** Correct Magic Flare typo + Greenwood/Actinidia leaves + "received" typo */
ROMFile.seekp(0x150EC, std::ios::beg);
TEXT_WriteString("re");
ROMFile.seekp(0x1514C, std::ios::beg);
TEXT_WriteString("G.Leaf");
ROMFile.seekp(0x151B2, std::ios::beg);
TEXT_WriteString("A.Leaf");
ROMFile.seekp(0x1621E, std::ios::beg);
TEXT_WriteString("ei");
/*** Old Woman */
ROMFile.seekp(0x18121, std::ios::beg);
TEXT_WriteByte(0x3C); /* Move her to a different location around Lisa's bed */
TEXT_WriteByte(0x20);
/*** Tool shop owner - change text condition */
ROMFile.seekp(0x1839B, std::ios::beg);
TEXT_WriteItemByte(ITEM_TOOL_SHOP_OWNER);
/*** Bridge guard */
ROMFile.seekp(0x18644, std::ios::beg);
TEXT_WriteString("Please pass.");
TEXT_EndText(TEXT_ENDTYPE_88B9);
/*** Water mill keeper */
ROMFile.seekp(0x1877C, std::ios::beg);
TEXT_WriteString("Could you please\rturn this wheel?");
TEXT_EndText(TEXT_ENDTYPE_88B9);
ROMFile.seekp(0x188B9, std::ios::beg);
TEXT_EndText(TEXT_ENDTYPE_88B9);
/*** Lisa - Hack so her dream is always accessible */
ROMFile.seekp(0x18A6F, std::ios::beg);
TEXT_WriteByte(0x00); /* Require to not have a non-existing item */
ROMFile.seekp(0x18A7D, std::ios::beg);
TEXT_WriteByte(0x7F); /* Change pointer when Village Chief is revived */
TEXT_WriteByte(0x8A);
/*** Tool shop owner's son Teddy */
ROMFile.seekp(0x1922E, std::ios::beg);
TEXT_WriteItemByte(ITEM_TEDDY); /* change text condition */
ROMFile.seekp(0x19256, std::ios::beg);
TEXT_WriteString("Fancy ");
TEXT_WriteByte(0x97); /* "a " */
TEXT_WriteByte(0x0D); /* Carriage return */
TEXT_YellowStyle;
TEXT_WriteItemString(ITEM_TEDDY);
TEXT_EndStyle;
TEXT_WriteString("\rfor a billion dollars?");
TEXT_WriteByte(0x0C); /* Question prompt */
/*** Sleeping tulip (move this text to make room for the Pass tile text) */
ROMFile.seekp(0x1984E, std::ios::beg);
TEXT_WriteByte(0x9A); /* Change text pointer */
ROMFile.seekp(0x1989A, std::ios::beg);
TEXT_WriteByte(0x10);
TEXT_WriteString("Hello...");
/*** Gourmet Goat's clue */
/* First, decide which item the clue will be about */
int RandomInt = Random::RandomInteger(3);
ItemID ClueItem;
int ItemIndex;
switch (RandomInt) {
case 0:
ClueItem = ItemID::SOUL_BLADE;
break;
case 1:
ClueItem = ItemID::SOUL_ARMOR;
break;
default:
ClueItem = ItemID::PHOENIX;
break;
}
/* Now find where this item is */
for (ItemIndex=0; ItemIndex<NUMBER_OF_ITEMS; ItemIndex++) {
if (RandomizedItemList[ItemIndex].Contents == ClueItem) break;
}
/* Update text */
ROMFile.seekp(0x19D74, std::ios::beg);
TEXT_WriteString("If you give me food,\rI will tell you\rwhere ");
TEXT_YellowStyle;
TEXT_WriteString(ItemNameList[(size_t)ClueItem]);
TEXT_EndStyle;
TEXT_WriteString(" is!");
TEXT_EndText(TEXT_ENDTYPE_88B9);
ROMFile.seekp(0x19DCB, std::ios::beg);
TEXT_WriteString("You`ve got food!\rwill you give it\rto me?");
TEXT_WriteByte(0x0C); /* Question prompt */
ROMFile.seekp(0x19E0E, std::ios::beg);
TEXT_WriteByte(0x10); /* Start new textbox */
TEXT_YellowStyle;
TEXT_WriteString(ItemNameList[(size_t)ClueItem]);
TEXT_EndStyle;
TEXT_WriteString(" is\r");
if (ItemIndex < NUMBER_OF_CHESTS) {
TEXT_WriteString("in a chest in\r");
}
else {
TEXT_WriteString("held by\r");
}
TEXT_YellowStyle;
TEXT_WriteString(ItemLocations[ItemIndex]);
TEXT_EndStyle;
TEXT_WriteString("!");
TEXT_EndText(TEXT_ENDTYPE_88B9);
/*** Village Chief */
ROMFile.seekp(0x1A0C0, std::ios::beg);
TEXT_WriteByte(0x00); /* "Impossible" Item ID to make sure this condition is never fulfilled */
/* Hack to open up Act2 regardless of what item Village Chief gives */
ROMFile.seekp(0x1A123, std::ios::beg);
TEXT_WriteByte(0x33); /* Change pointer */
ROMFile.seekp(0x1A125, std::ios::beg);
Byte = (unsigned char)RandomizedItemList[ITEM_VILLAGE_CHIEF].Contents; /* Get the item */
unsigned char VillageChiefBuffer[19] = {
0x02, 0x01, 0x91, 0xA1, /* Text "Gives item" */
0x00, 0x5E,
0x02, 0x0A, Byte, /* Actually give the item */
0x02, 0x09, 0x00, 0x9B, 0x6B, /* Set flag: item has been given */
0x02, 0x01, 0x72, 0xA2, 0x6B}; /* Text when item is already given */
ROMFile.write((char*)(&VillageChiefBuffer), 19);
/*** Lisa's dream */
ROMFile.seekp(0x1A522, std::ios::beg);
TEXT_WriteByte(0x3C); /* Opening quotation marks */
TEXT_WriteString("Lisa, you must\rhelp this man.");
TEXT_WriteByte(0x3E); /* Closing quotation marks */
TEXT_EndText(TEXT_ENDTYPE_88B9);
ROMFile.seekp(0x1A5AF, std::ios::beg);
TEXT_EndText(TEXT_ENDTYPE_88B9);
/*** Magician text 2 */
ROMFile.seekp(0x1A914, std::ios::beg);
TEXT_WriteString("Good luck and/or\rblame Everhate.");
TEXT_EndText(TEXT_ENDTYPE_88B9);
/*** Revival of first Underground Castle Crystal Fairy */
ROMFile.seekp(0x1AC5B, std::ios::beg);
TEXT_WriteByte(0x00);
/*** Underground Castle east part Crystal fairy */
ROMFile.seekp(0x1AE14, std::ios::beg);
TEXT_WriteString("I`ve got nothing\rfor you.");
TEXT_WriteByte(0x11);
TEXT_WriteByte(0x0C);
/*** Red-Hot Mirror bird - change text condition */
ROMFile.seekp(0x1BE3D, std::ios::beg);
TEXT_WriteItemByte(ITEM_BIRD_RED_HOT_MIRROR);
ROMFile.seekp(0x1BE44, std::ios::beg);
TEXT_WriteItemByte(ITEM_BIRD_RED_HOT_MIRROR);
/*** Magic Bell crystal fairy's text */
ROMFile.seekp(0x1C0C6, std::ios::beg);
TEXT_WriteItemByte(ITEM_CRYSTAL_MAGIC_BELL); /* change text condition */
ROMFile.seekp(0x1C11E, std::ios::beg);
TEXT_WriteString("If you bring me all 8\rMaster`s Emblems,\rI will give you a\r");
TEXT_YellowStyle;
TEXT_WriteItemString(ITEM_CRYSTAL_MAGIC_BELL);
TEXT_EndStyle;
TEXT_WriteString(".");
TEXT_EndText(TEXT_ENDTYPE_46EC);
/*** Woodstin Trio */
ROMFile.seekp(0x1D135, std::ios::beg);
TEXT_WriteString("Let`s start the show!\rThe prize is a\r");
TEXT_YellowStyle;
TEXT_WriteItemString(ITEM_WOODSTIN_TRIO);