-
Notifications
You must be signed in to change notification settings - Fork 57
/
stringizer.cpp
1586 lines (1450 loc) · 52.9 KB
/
stringizer.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
/*
* This file is part of EasyRPG Editor.
*
* EasyRPG Editor is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* EasyRPG Editor is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with EasyRPG Editor. If not, see <http://www.gnu.org/licenses/>.
*/
#include <QObject>
#include "stringizer.h"
#include "common/dbstring.h"
#include <lcf/rpg/eventcommand.h>
#include "core.h"
/*
* FIXME: This uses some very verbose way to satisfy lupdate not swallowing
* strings from anonymous namespace by invoking the translation function directly.
*/
namespace
{
// Helper functions
QString variable(int id, bool show_name = false)
{
if (show_name)
return QString("V[%1:%2]").arg(id, 4, 10, QChar('0')).arg(Stringizer::varName(id));
else
return QString("V[%1]").arg(id, 4, 10, QChar('0'));
}
QString valueOrVariable(bool is_variable, int value)
{
return is_variable ? variable(value)
: QString::number(value);
}
QString heroes(int mode, int id)
{
switch (mode)
{
case 0:
return Stringizer::tr("Entire Party");
case 1:
return Stringizer::heroName(id);
case 2:
return Stringizer::tr("Hero") + " " + variable(id);
default:
return Stringizer::tr("Unknown");
}
}
QString map(int id)
{
return QString("%1").arg(id, 4, 10, QChar('0')) + ":" + Stringizer::mapName(id);
}
QString tenthSeconds(int t)
{
return QString::number(t / 10.0, 'f', 1) + "s";
}
QString characterName(int id)
{
switch (id)
{
case 10001:
return Stringizer::tr("Hero");
case 10002:
return Stringizer::tr("Boat");
case 10003:
return Stringizer::tr("Ship");
case 10004:
return Stringizer::tr("Airship");
case 10005:
return Stringizer::tr("This Event");
default:
return Stringizer::eventName(id);
}
}
QString formatTime(int seconds)
{
return QString("%1M %2S").arg(seconds / 60).arg(seconds % 60, 2, 10, QChar('0'));
}
// Stringizers
QString stringizeCallCommonEvent(const lcf::rpg::EventCommand& com)
{
return Stringizer::tr("Call Common Event") + ": " + Stringizer::commonEventName(com.parameters[0]);
}
QString stringizeForceFlee(const lcf::rpg::EventCommand& com)
{
Q_UNUSED(com)
// TODO
return Stringizer::tr("Force Flee");
}
QString stringizeEnableCombo(const lcf::rpg::EventCommand& com)
{
return Stringizer::tr("Enable Combo") + ": "
+ Stringizer::heroName(com.parameters[0]) + ", "
+ QString::number(com.parameters[2]) + "x"
+ Stringizer::battleCommandName(com.parameters[1]);
}
QString stringizeChangeClass(const lcf::rpg::EventCommand& com)
{
return Stringizer::tr("Change Class") + ": "
+ Stringizer::heroName(com.parameters[1]) + ", "
+ Stringizer::className(com.parameters[2]);
}
QString stringizeChangeBattleCommands(const lcf::rpg::EventCommand& com)
{
return Stringizer::tr("Change Battle Commands") + ": "
+ Stringizer::heroName(com.parameters[1]) + ", "
+ (com.parameters[3] ? Stringizer::tr("Add") : Stringizer::tr("Remove")) + " "
+ Stringizer::battleCommandName(com.parameters[4]);
}
QString stringizeShowMessage(const lcf::rpg::EventCommand& com)
{
return Stringizer::tr("Show Message") + ":\n " + ToQString(com.string);
}
QString stringizeMessageOptions(const lcf::rpg::EventCommand& com)
{
QString position;
switch (com.parameters[1])
{
case 0:
position = Stringizer::tr("Top"); break;
case 1:
position = Stringizer::tr("Center"); break;
case 2:
position = Stringizer::tr("Bottom"); break;
default:
position = Stringizer::tr("Unknown");
}
return Stringizer::tr("Message Options") + ": "
+ (com.parameters[0] ? Stringizer::tr("Transp") : Stringizer::tr("Normal")) + ", "
+ position + ", "
+ (com.parameters[2] ? Stringizer::tr("Auto") : Stringizer::tr("Fixed")) + ", "
+ (com.parameters[3] ? Stringizer::tr("Continue Processes") : Stringizer::tr("Halt Processes"));
}
QString stringizeChangeFaceGraphic(const lcf::rpg::EventCommand& com)
{
return Stringizer::tr("Change Face Graphic") + ": "
+ ToQString(com.string) + ", "
+ QString::number(com.parameters[0]) + ", "
+ (com.parameters[1] ? Stringizer::tr("Left") : Stringizer::tr("Right"))
+ (com.parameters[2] ? ", " + Stringizer::tr("Flipped") : "");
}
QString stringizeShowChoice(const lcf::rpg::EventCommand& com)
{
return Stringizer::tr("Show Choice") + ": " + ToQString(com.string);
}
QString stringizeInputNumber(const lcf::rpg::EventCommand& com)
{
return Stringizer::tr("Input Number") + ": "
+ Stringizer::tr("%1 Digits").arg(QString::number(com.parameters[0])) + ", "
+ variable(com.parameters[1]);
}
QString stringizeControlSwitches(const lcf::rpg::EventCommand& com)
{
QString switches, operation;
switch (com.parameters[0])
{
case 0:
switches = QString("S[%1:%2]").arg(com.parameters[1], 4, 10, QChar('0'))
.arg(Stringizer::switchName(com.parameters[1]));
break;
case 1:
switches = QString("S[%1-%2]").arg(com.parameters[1], 4, 10, QChar('0'))
.arg(com.parameters[2], 4, 10, QChar('0'));
break;
case 2:
switches = QString("S[V%1]").arg(com.parameters[1], 4, 10, QChar('0'));
break;
default:
switches = "S[????]";
}
switch (com.parameters[3])
{
case 0:
operation = Stringizer::tr("ON"); break;
case 1:
operation = Stringizer::tr("OFF"); break;
case 2:
operation = Stringizer::tr("Toggle"); break;
default:
operation = Stringizer::tr("Unknown"); break;
}
return Stringizer::tr("Control Switches") + ": " + switches + " " + operation;
}
QString stringizeControlVars(const lcf::rpg::EventCommand& com)
{
QString variables, operation, operand;
switch (com.parameters[0])
{
case 0:
variables = variable(com.parameters[1], true);
break;
case 1:
variables = QString("V[%1-%2]").arg(com.parameters[1], 4, 10, QChar('0'))
.arg(com.parameters[2], 4, 10, QChar('0'));
break;
case 2:
variables = QString("V[%1]").arg(variable(com.parameters[1]));
break;
default:
variables = "[????]";
}
switch (com.parameters[3])
{
case 0:
operation = "="; break;
case 1:
operation = "+"; break;
case 2:
operation = "-"; break;
case 3:
operation = "*"; break;
case 4:
operation = "/"; break;
case 5:
operation = "%"; break;
default:
operation = "?";
}
switch (com.parameters[4])
{
case 0: // Constant
operand = QString::number(com.parameters[5]);
break;
case 1: // Value of Variable
operand = variable(com.parameters[5]);
break;
case 2: // Value of Variable referenced by another Variable
operand = QString("V[%1]").arg(variable(com.parameters[5]));
break;
case 3: // Random Value
operand = Stringizer::tr("Random %1-%2").arg(com.parameters[5], com.parameters[6]);
break;
case 4: // Items
operand = com.parameters[6] ? Stringizer::tr("Number Equipped") : Stringizer::tr("Number Possessed") + " "
+ Stringizer::itemName(com.parameters[5]);
break;
case 5: // Hero
operand = Stringizer::heroName(com.parameters[5]) + " ";
switch (com.parameters[6])
{
case 0:
operand += Stringizer::tr("Level"); break;
case 1:
operand += Stringizer::tr("Experience"); break;
case 2:
operand += Stringizer::tr("HP"); break;
case 3:
operand += Stringizer::tr("MP"); break;
case 4:
operand += Stringizer::tr("Max HP"); break;
case 5:
operand += Stringizer::tr("Max MP"); break;
case 6:
operand += Stringizer::tr("Attack"); break;
case 7:
operand += Stringizer::tr("Defense"); break;
case 8:
operand += Stringizer::tr("Intelligence"); break;
case 9:
operand += Stringizer::tr("Agility"); break;
case 10:
operand += Stringizer::tr("Weapon ID"); break;
case 11:
operand += Stringizer::tr("Shield ID"); break;
case 12:
operand += Stringizer::tr("Armor ID"); break;
case 13:
operand += Stringizer::tr("Helmet ID"); break;
case 14:
operand += Stringizer::tr("Accesory ID"); break;
default:
operand += Stringizer::tr("Unknown");
}
break;
case 6: // Characters
operand = characterName(com.parameters[5]) + " ";
switch (com.parameters[6])
{
case 0:
operand += Stringizer::tr("Map ID"); break;
case 1:
operand += Stringizer::tr("X Coordinate"); break;
case 2:
operand += Stringizer::tr("Y Coordinate"); break;
case 3:
operand += Stringizer::tr("Orientation"); break;
case 4:
operand += Stringizer::tr("Screen X"); break;
case 5:
operand += Stringizer::tr("Screen Y"); break;
default:
operand += Stringizer::tr("Unknown");
}
break;
case 7: // More
switch (com.parameters[5]) {
case 0:
operand = Stringizer::tr("Gold"); break;
case 1:
operand = Stringizer::tr("Timer 1"); break;
case 2:
operand = Stringizer::tr("Size of Party"); break;
case 3:
operand = Stringizer::tr("Number of Saves"); break;
case 4:
operand = Stringizer::tr("Number of Battles"); break;
case 5:
operand = Stringizer::tr("Number of Won Battles"); break;
case 6:
operand = Stringizer::tr("Number of Lost Battles"); break;
case 7:
operand = Stringizer::tr("Number of Escapes"); break;
case 8:
operand = Stringizer::tr("MIDI Play Position"); break;
case 9:
operand = Stringizer::tr("Timer 2"); break;
default:
operand = Stringizer::tr("Unknown");
}
break;
default:
operand = Stringizer::tr("Unknown");
}
return Stringizer::tr("Control Vars") + ": "
+ variables + " " + operation + " " + operand;
}
QString stringizeTimerOperation(const lcf::rpg::EventCommand& com)
{
QString command = Stringizer::tr("Timer %1 Operation").arg(com.parameters.size() <= 5 ? 1 : com.parameters[5]+1);
switch (com.parameters[0])
{
case 0:
return command + ": " + Stringizer::tr("Set") + " "
+ (com.parameters[1] ? variable(com.parameters[2])
: formatTime(com.parameters[2]));
case 1:
return command + ": " + Stringizer::tr("Start");
case 2:
return command + ": " + Stringizer::tr("Stop");
default:
return command + ": " + Stringizer::tr("Unknown");
}
}
QString stringizeChangeGold(const lcf::rpg::EventCommand& com)
{
return Stringizer::tr("Change Gold") + ": "
+ (com.parameters[0] ? "-" : "+")
+ valueOrVariable(com.parameters[1], com.parameters[2]);
}
QString stringizeChangeItems(const lcf::rpg::EventCommand& com)
{
return Stringizer::tr("Change Items") + ": "
+ (com.parameters[0] ? "-" : "+") + " "
+ valueOrVariable(com.parameters[3], com.parameters[4])
+ (com.parameters[1] ? Stringizer::tr("Item") + " " + variable(com.parameters[2])
: Stringizer::itemName(com.parameters[2]));
}
QString stringizeChangePartyMembers(const lcf::rpg::EventCommand& com)
{
return Stringizer::tr("Change Party Members") + ": "
+ (com.parameters[0] ? Stringizer::tr("Remove") : Stringizer::tr("Add")) + " "
+ (com.parameters[1] ? Stringizer::tr("Hero") + " " + variable(com.parameters[2])
: Stringizer::heroName(com.parameters[2]));
}
QString stringizeChangeExp(const lcf::rpg::EventCommand& com)
{
return Stringizer::tr("Change Exp") + ": "
+ heroes(com.parameters[0], com.parameters[1]) + ", "
+ (com.parameters[2] ? "-" : "+")
+ valueOrVariable(com.parameters[3], com.parameters[4]);
}
QString stringizeChangeLevel(const lcf::rpg::EventCommand& com)
{
return Stringizer::tr("Change Level") + ": "
+ heroes(com.parameters[0], com.parameters[1])+ ", "
+ (com.parameters[2] ? "-" : "+")
+ valueOrVariable(com.parameters[3], com.parameters[4]);
}
QString stringizeChangeParameters(const lcf::rpg::EventCommand& com)
{
QString parameter;
switch (com.parameters[3])
{
case 0:
parameter = Stringizer::tr("Max HP"); break;
case 1:
parameter = Stringizer::tr("Max MP"); break;
case 2:
parameter = Stringizer::tr("Attack"); break;
case 3:
parameter = Stringizer::tr("Defense"); break;
case 4:
parameter = Stringizer::tr("Spirit"); break;
case 5:
parameter = Stringizer::tr("Agility"); break;
default:
parameter = Stringizer::tr("Unknown");
}
return Stringizer::tr("Change Parameters") + ": "
+ heroes(com.parameters[0], com.parameters[1])+ ", "
+ parameter + " "
+ (com.parameters[2] ? "-" : "+")
+ valueOrVariable(com.parameters[4], com.parameters[5]);
}
QString stringizeChangeSkills(const lcf::rpg::EventCommand& com)
{
return Stringizer::tr("Change Skills") + ": "
+ heroes(com.parameters[0], com.parameters[1])+ ", "
+ (com.parameters[2] ? Stringizer::tr("Remove") : Stringizer::tr("Add"))
+ (com.parameters[3] ? variable(com.parameters[4])
: Stringizer::skillName(com.parameters[4]));
}
QString stringizeChangeEquipment(const lcf::rpg::EventCommand& com)
{
QString item, action;
if (com.parameters[2])
{
action = Stringizer::tr("Equip");
switch (com.parameters[4])
{
case 0:
item = Stringizer::tr("Weapon"); break;
case 1:
item = Stringizer::tr("Shield"); break;
case 2:
item = Stringizer::tr("Armor"); break;
case 3:
item = Stringizer::tr("Helmet"); break;
case 4:
item = Stringizer::tr("Accesory"); break;
case 5:
item = Stringizer::tr("All"); break;
default:
item = Stringizer::tr("Unknown");
}
}
else
{
Stringizer::tr("Unequip");
item = com.parameters[3] ? variable(com.parameters[4])
: Stringizer::itemName(com.parameters[4]);
}
return Stringizer::tr("Change Equipment") + ": "
+ heroes(com.parameters[0], com.parameters[1]) + ", "
+ action + " " + item;
}
QString stringizeChangeHP(const lcf::rpg::EventCommand& com)
{
return Stringizer::tr("Change HP") + ": "
+ heroes(com.parameters[0], com.parameters[1])+ ", "
+ (com.parameters[2] ? "-" : "+")
+ valueOrVariable(com.parameters[3], com.parameters[4]);
}
QString stringizeChangeSP(const lcf::rpg::EventCommand& com)
{
return Stringizer::tr("Change SP") + ": "
+ heroes(com.parameters[0], com.parameters[1])+ ", "
+ (com.parameters[2] ? "-" : "+")
+ valueOrVariable(com.parameters[3], com.parameters[4]);
}
QString stringizeChangeCondition(const lcf::rpg::EventCommand& com)
{
return Stringizer::tr("Change Condition") + ": "
+ heroes(com.parameters[0], com.parameters[1])+ ", "
+ (com.parameters[2] ? Stringizer::tr("Add") : Stringizer::tr("Remove")) + " "
+ Stringizer::stateName(com.parameters[3]);
}
QString stringizeFullHeal(const lcf::rpg::EventCommand& com)
{
return Stringizer::tr("Full Heal") + ": "
+ heroes(com.parameters[0], com.parameters[1]);
}
QString stringizeSimulatedAttack(const lcf::rpg::EventCommand& com)
{
return Stringizer::tr("Simulated Attack") + ": "
+ heroes(com.parameters[0], com.parameters[1]);
}
QString stringizeChangeHeroName(const lcf::rpg::EventCommand& com)
{
return Stringizer::tr("Change Hero Name") + ": "
+ Stringizer::heroName(com.parameters[0]) + " -> "
+ ToQString(com.string);
}
QString stringizeChangeHeroTitle(const lcf::rpg::EventCommand& com)
{
return Stringizer::tr("Change Hero Title") + ": "
+ Stringizer::heroName(com.parameters[0]) + ", "
+ ToQString(com.string);
}
QString stringizeChangeSpriteAssociation(const lcf::rpg::EventCommand& com)
{
return Stringizer::tr("Change Sprite Association") + ": "
+ Stringizer::heroName(com.parameters[0]) + ", "
+ ToQString(com.string) + "-"
+ QString::number(com.parameters[1]);
}
QString stringizeChangeActorFace(const lcf::rpg::EventCommand& com)
{
return Stringizer::tr("Change Actor Face") + ": "
+ Stringizer::heroName(com.parameters[0]) + ", "
+ ToQString(com.string) + "-"
+ QString::number(com.parameters[1]);
}
QString stringizeChangeVehicleGraphic(const lcf::rpg::EventCommand& com)
{
QString vehicle =
com.parameters[0] == 0 ? Stringizer::tr("Boat") :
com.parameters[0] == 1 ? Stringizer::tr("Ship") :
com.parameters[0] == 2 ? Stringizer::tr("Airship") : Stringizer::tr("Unknown");
return Stringizer::tr("Change Vehicle Graphic") + ": "
+ vehicle + ", "
+ ToQString(com.string) + "-"
+ QString::number(com.parameters[1]);
}
QString stringizeChangeSystemBGM(const lcf::rpg::EventCommand& com)
{
static const std::vector<const char*> bgm_contexts =
{
QT_TRANSLATE_NOOP("Stringizer", "Battle"),
QT_TRANSLATE_NOOP("Stringizer", "Victory"),
QT_TRANSLATE_NOOP("Stringizer", "Inn"),
QT_TRANSLATE_NOOP("Stringizer", "Boat"),
QT_TRANSLATE_NOOP("Stringizer", "Ship"),
QT_TRANSLATE_NOOP("Stringizer", "Airship"),
QT_TRANSLATE_NOOP("Stringizer", "Game Over")
};
QString context;
if (com.parameters[0] < 0 || com.parameters[0] >= static_cast<int>(bgm_contexts.size()))
context = Stringizer::tr("Unknown");
else
context = Stringizer::tr(bgm_contexts[static_cast<size_t>(com.parameters[0])]);
return Stringizer::tr("Change System BGM") + ": " + context + ", "
+ ToQString(com.string);
}
QString stringizeChangeSystemSFX(const lcf::rpg::EventCommand& com)
{
static const std::vector<const char*> system_sfx =
{
QT_TRANSLATE_NOOP("Stringizer", "Cursor"),
QT_TRANSLATE_NOOP("Stringizer", "Decision"),
QT_TRANSLATE_NOOP("Stringizer", "Cancel"),
QT_TRANSLATE_NOOP("Stringizer", "Buzzer"),
QT_TRANSLATE_NOOP("Stringizer", "Begin Battle"),
QT_TRANSLATE_NOOP("Stringizer", "Escape"),
QT_TRANSLATE_NOOP("Stringizer", "Enemy Attacks"),
QT_TRANSLATE_NOOP("Stringizer", "Enemy Damage"),
QT_TRANSLATE_NOOP("Stringizer", "Ally Damage"),
QT_TRANSLATE_NOOP("Stringizer", "Evasion"),
QT_TRANSLATE_NOOP("Stringizer", "Enemy Defeated"),
QT_TRANSLATE_NOOP("Stringizer", "Use Item")
};
QString sfx;
if (com.parameters[0] < 0 || com.parameters[0] >= static_cast<int>(system_sfx.size()))
sfx = Stringizer::tr("Unknown");
else
sfx = Stringizer::tr(system_sfx[static_cast<size_t>(com.parameters[0])]);
return Stringizer::tr("Change System SFX") + ": " + sfx + ", "
+ ToQString(com.string);
}
QString stringizeChangeSystemGraphics(const lcf::rpg::EventCommand& com)
{
return Stringizer::tr("Change System Graphics") + ": " + ToQString(com.string);
}
QString stringizeChangeScreenTransitions(const lcf::rpg::EventCommand& com)
{
return Stringizer::tr("Change Screen Transitions") + ": "
+ (com.parameters[0] ? Stringizer::showTransitionName(com.parameters[1])
: Stringizer::eraseTransitionName(com.parameters[1]));
}
QString stringizeEnemyEncounter(const lcf::rpg::EventCommand& com)
{
return Stringizer::tr("Enemy Encounter") + ": "
+ (com.parameters[0] ? Stringizer::tr("Troop") + " " + variable(com.parameters[1])
: Stringizer::troopName(com.parameters[1]));
}
QString stringizeOpenShop(const lcf::rpg::EventCommand& com)
{
QString buysell;
switch (com.parameters[0])
{
case 0:
buysell = Stringizer::tr("Buy") + "/" + Stringizer::tr("Sell");
break;
case 1:
buysell = Stringizer::tr("Buy");
break;
case 2:
buysell = Stringizer::tr("Sell");
}
return Stringizer::tr("Open Shop") + ": " + buysell;
}
QString stringizeShowInn(const lcf::rpg::EventCommand& com)
{
return Stringizer::tr("Show Inn") + ": " + Stringizer::tr("Price") + " " + QString::number(com.parameters[1]);
}
QString stringizeEnterHeroName(const lcf::rpg::EventCommand& com)
{
return Stringizer::tr("Enter Hero Name") + ": " + Stringizer::heroName(com.parameters[0]);
}
QString stringizeTeleport(const lcf::rpg::EventCommand& com)
{
QString direction;
if (com.parameters.size() >= 4) {
if (com.parameters[3] < 0 || com.parameters[3] > 3)
direction = Stringizer::tr("Retain Facing");
else
direction = Stringizer::direction(com.parameters[3]);
}
return Stringizer::tr("Teleport") + ": "
+ map(com.parameters[0]) + " ("
+ QString::number(com.parameters[1]) + ","
+ QString::number(com.parameters[2]) + "), "
+ direction;
}
QString stringizeMemorizeLocation(const lcf::rpg::EventCommand& com)
{
return Stringizer::tr("Memorize Location") + ": "
+ variable(com.parameters[0]) + ", "
+ variable(com.parameters[1]) + ", "
+ variable(com.parameters[2]);
}
QString stringizeRecallToLocation(const lcf::rpg::EventCommand& com)
{
return Stringizer::tr("Recall To Location") + ": "
+ variable(com.parameters[0]) + ", ("
+ variable(com.parameters[1]) + ","
+ variable(com.parameters[2]) + ")";
}
QString stringizeSetVehicleLocation(const lcf::rpg::EventCommand& com)
{
QString vehicle =
com.parameters[0] == 0 ? Stringizer::tr("Boat") :
com.parameters[0] == 1 ? Stringizer::tr("Ship") :
com.parameters[0] == 2 ? Stringizer::tr("Airship") : Stringizer::tr("Unknown");
if (com.parameters[1])
return Stringizer::tr("Set Vehicle Location") + ": " + vehicle + ", "
+ variable(com.parameters[0]) + ", ("
+ variable(com.parameters[1]) + ","
+ variable(com.parameters[2]) + ")";
else
return Stringizer::tr("Set Vehicle Location") + ": " + vehicle + ", "
+ map(com.parameters[0]) + " ("
+ QString::number(com.parameters[1]) + ","
+ QString::number(com.parameters[2]) + ")";
}
QString stringizeChangeEventLocation(const lcf::rpg::EventCommand& com)
{
return Stringizer::tr("Change Event Location") + ": "
+ characterName(com.parameters[0]) + ", "
+ "(" + valueOrVariable(com.parameters[1], com.parameters[2]) + ","
+ valueOrVariable(com.parameters[1], com.parameters[3]) + ")";
}
QString stringizeTradeEventLocations(const lcf::rpg::EventCommand& com)
{
return Stringizer::tr("Trade Event Locations") + ": "
+ characterName(com.parameters[0]) + ", "
+ characterName(com.parameters[1]);
}
QString stringizeStoreTerrainID(const lcf::rpg::EventCommand& com)
{
return Stringizer::tr("Store Terrain ID") + ": "
+ "(" + valueOrVariable(com.parameters[0], com.parameters[1]) + ","
+ valueOrVariable(com.parameters[0], com.parameters[2]) + "), "
+ variable(com.parameters[3]);
}
QString stringizeStoreEventID(const lcf::rpg::EventCommand& com)
{
return Stringizer::tr("Store Event ID") + ": "
+ "(" + valueOrVariable(com.parameters[0], com.parameters[1]) + ","
+ valueOrVariable(com.parameters[0], com.parameters[2]) + "), "
+ variable(com.parameters[3]);
}
QString stringizeEraseScreen(const lcf::rpg::EventCommand& com)
{
return Stringizer::tr("Erase Screen") + ": " + Stringizer::eraseTransitionName(com.parameters[0]);
}
QString stringizeShowScreen(const lcf::rpg::EventCommand& com)
{
return Stringizer::tr("Show Screen") + ": " + Stringizer::showTransitionName(com.parameters[0]);
}
QString stringizeTintScreen(const lcf::rpg::EventCommand& com)
{
return Stringizer::tr("Tint Screen") + ": ("
+ "R" + QString::number(com.parameters[0]) + ","
+ "G" + QString::number(com.parameters[1]) + ","
+ "B" + QString::number(com.parameters[2]) + ","
+ "S" + QString::number(com.parameters[3]) + "), "
+ tenthSeconds(com.parameters[4]) + " "
+ (com.parameters[5] ? Stringizer::tr("(Wait)") : "");
}
QString stringizeFlashScreen(const lcf::rpg::EventCommand& com)
{
if (com.parameters.size() > 6)
{
if (com.parameters[6] == 1)
return Stringizer::tr("Flash Screen") + ": " + Stringizer::tr("Start");
else if (com.parameters[6] == 2)
return Stringizer::tr("Flash Screen") + ": " + Stringizer::tr("Stop");
}
return Stringizer::tr("Flash Screen") + ": ("
+ "R" + QString::number(com.parameters[0]) + ","
+ "G" + QString::number(com.parameters[1]) + ","
+ "B" + QString::number(com.parameters[2]) + ","
+ "S" + QString::number(com.parameters[3]) + "), "
+ tenthSeconds(com.parameters[4]) + " "
+ (com.parameters[5] ? Stringizer::tr("(Wait)") : "");
}
QString stringizeShakeScreen(const lcf::rpg::EventCommand& com)
{
if (com.parameters.size() > 4)
{
if (com.parameters[4] == 1)
return Stringizer::tr("Shake Screen") + ": " + Stringizer::tr("Start");
else if (com.parameters[4] == 2)
return Stringizer::tr("Shake Screen") + ": " + Stringizer::tr("Stop");
}
return Stringizer::tr("Shake Screen") + ": "
+ Stringizer::tr("Strength") + QString::number(com.parameters[0]) + ", "
+ Stringizer::tr("Speed") + QString::number(com.parameters[1]) + ", "
+ tenthSeconds(com.parameters[2]) + " "
+ (com.parameters[3] ? Stringizer::tr("(Wait)") : "");
}
QString stringizePanScreen(const lcf::rpg::EventCommand& com)
{
switch (com.parameters[0])
{
case 0:
return Stringizer::tr("Pan Screen") + ": " + Stringizer::tr("Lock Position");
case 1:
return Stringizer::tr("Pan Screen") + ": " + Stringizer::tr("Unlock Position");
case 2:
return Stringizer::tr("Pan Screen") + ": "
+ Stringizer::direction(com.parameters[1]) + " "
+ QString::number(com.parameters[2]) + " " + Stringizer::tr("Tiles") + ", "
+ Stringizer::tr("Speed") + " " + QString::number(com.parameters[3]) + " "
+ (com.parameters[4] ? Stringizer::tr("(Wait)") : "");
default:
return Stringizer::tr("Pan Screen") + ": " + Stringizer::tr("Reset Position")
+ Stringizer::tr("Speed") + " " + QString::number(com.parameters[3]) + " "
+ (com.parameters[4] ? Stringizer::tr("(Wait)") : "");
}
}
QString stringizeWeatherEffects(const lcf::rpg::EventCommand& com)
{
QString type, strength;
switch (com.parameters[0])
{
case 0:
type = Stringizer::tr("None"); break;
case 1:
type = Stringizer::tr("Rain"); break;
case 2:
type = Stringizer::tr("Snow"); break;
case 3:
type = Stringizer::tr("Fog"); break;
case 4:
type = Stringizer::tr("Sandstorm"); break;
default:
type = Stringizer::tr("Unknown"); break;
}
switch (com.parameters[1])
{
case 0:
strength = Stringizer::tr("Weak"); break;
case 1:
strength = Stringizer::tr("Medium"); break;
case 2:
strength = Stringizer::tr("Strong"); break;
default:
strength = Stringizer::tr("Unknown"); break;
}
return Stringizer::tr("Weather Effects") + ": " + type + ", " + strength;
}
QString stringizeShowPicture(const lcf::rpg::EventCommand& com)
{
return Stringizer::tr("Show Picture") + ": "
+ QString::number(com.parameters[0]) + ", "
+ ToQString(com.string);
}
QString stringizeMovePicture(const lcf::rpg::EventCommand& com)
{
return Stringizer::tr("Move Picture") + ": "
+ QString::number(com.parameters[0]) + ", ("
+ valueOrVariable(com.parameters[1], com.parameters[2]) + ","
+ valueOrVariable(com.parameters[1], com.parameters[3]) + "), "
+ tenthSeconds(com.parameters[14]) + " "
+ (com.parameters[15] ? Stringizer::tr("(Wait)") : "");
}
QString stringizeErasePicture(const lcf::rpg::EventCommand& com)
{
return Stringizer::tr("Erase Picture") + ": " + QString::number(com.parameters[0]);
}
QString stringizeShowBattleAnimation(const lcf::rpg::EventCommand& com)
{
return Stringizer::tr("Show Battle Animation") + ": "
+ Stringizer::animationName(com.parameters[0]) + ", "
+ characterName(com.parameters[1]) + " "
+ (com.parameters[2] ? Stringizer::tr("(Wait)") : "");
}
QString stringizeSpriteTransparency(const lcf::rpg::EventCommand& com)
{
return Stringizer::tr("Sprite Transparency") + ": "
+ (com.parameters[0] ? Stringizer::tr("Opaque") : Stringizer::tr("Transparent"));
}
QString stringizeFlashSprite(const lcf::rpg::EventCommand& com)
{
return Stringizer::tr("Flash Sprite") + ": "
+ characterName(com.parameters[0]) + ", "
+ tenthSeconds(com.parameters[5]) + " "
+ (com.parameters[6] ? Stringizer::tr("(Wait)") : "");
}
QString stringizeMoveEvent(const lcf::rpg::EventCommand& com)
{
QString movements;
for (size_t i = 4; i < 8 && i < com.parameters.size(); ++i)
movements.append(", ").append(Stringizer::moveCommand(com.parameters[i]));
if (com.parameters.size() >= 8)
movements.append("...");
return Stringizer::tr("Move Event") + ": " + characterName(com.parameters[0]) + movements;
}
QString stringizeWait(const lcf::rpg::EventCommand& com)
{
if (com.parameters.size() <= 1 ||
(com.parameters.size() > 1 && com.parameters[1] == 0)) {
return Stringizer::tr("Wait") + ": " + tenthSeconds(com.parameters[0]) + " ";
} else {
return Stringizer::tr("Wait") + ": " + Stringizer::tr("Until Key Pressed");
}
}
QString stringizePlayBGM(const lcf::rpg::EventCommand& com)
{
return Stringizer::tr("Play BGM") + ": " + ToQString(com.string);
}
QString stringizeFadeOutBGM(const lcf::rpg::EventCommand& com)
{
return Stringizer::tr("Fade Out BGM") + ": " + QString::number(com.parameters[0] / 1000) + "s";
}
QString stringizePlaySound(const lcf::rpg::EventCommand& com)
{
return Stringizer::tr("Play Sound") + ": " + ToQString(com.string);
}
QString stringizePlayMovie(const lcf::rpg::EventCommand& com)
{
return Stringizer::tr("Play Movie") + ": " + ToQString(com.string);
}
QString stringizeKeyInputProc(const lcf::rpg::EventCommand& com)
{
return Stringizer::tr("Key Input Proc") + ": " + variable(com.parameters[0]);
}
QString stringizeChangeMapTileset(const lcf::rpg::EventCommand& com)
{
return Stringizer::tr("Change Map Tileset") + ": " + ToQString(com.string);
}
QString stringizeChangePBG(const lcf::rpg::EventCommand& com)
{
return Stringizer::tr("Change PBG") + ": " + ToQString(com.string)
+ (com.parameters[0] ? ", " + Stringizer::tr("Horz Scroll") : "")
+ (com.parameters[1] ? ", " + Stringizer::tr("Vert Scroll") : "");
}
QString stringizeChangeEncounterRate(const lcf::rpg::EventCommand& com)
{
return Stringizer::tr("Change Encounter Rate") + ": " + QString::number(com.parameters[0]);
}
QString stringizeTileSubstitution(const lcf::rpg::EventCommand& com)
{
return Stringizer::tr("Tile Substitution") + ": "
+ (com.parameters[0] ? Stringizer::tr("Upper Layer") : Stringizer::tr("Lower Layer")) + ", "
+ QString::number(com.parameters[1]) + " -> "
+ QString::number(com.parameters[2]);
}
QString stringizeTeleportTargets(const lcf::rpg::EventCommand& com)
{
if (com.parameters[1])
return Stringizer::tr("Teleport Targets") + ": "
+ Stringizer::tr("Remove") + " " + map(com.parameters[1]);
else
return Stringizer::tr("Teleport Targets") + ": "
+ Stringizer::tr("Add") + " " + map(com.parameters[1]) + " ("
+ QString::number(com.parameters[2]) + ","
+ QString::number(com.parameters[3]) + ")";
}
QString stringizeChangeTeleportAccess(const lcf::rpg::EventCommand& com)
{
return Stringizer::tr("Change Teleport Access") + ": "
+ (com.parameters[0] ? Stringizer::tr("Allow") : Stringizer::tr("Forbid"));
}
QString stringizeEscapeTarget(const lcf::rpg::EventCommand& com)
{
return Stringizer::tr("Escape Target") + ": "
+ map(com.parameters[0]) + " ("
+ QString::number(com.parameters[1]) + ","
+ QString::number(com.parameters[2]) + ")";
}
QString stringizeChangeEscapeAccess(const lcf::rpg::EventCommand& com)
{
return Stringizer::tr("Change Escape Access") + ": "