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
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
|
#define GFXTAG_MENU_TEXT 200 // Used as a base tag in CB2_CreateTradeMenu and CB2_ReturnToTradeMenu
#define GFXTAG_CURSOR 300
#define GFXTAG_LINK_MON_GLOW 5550
#define GFXTAG_LINK_MON_SHADOW 5552
#define GFXTAG_CABLE_END 5554
#define GFXTAG_GBA_SCREEN 5556
#define GFXTAG_POKEBALL 5557
#define PALTAG_CURSOR 2345
#define PALTAG_MENU_TEXT 4925
#define PALTAG_LINK_MON 5551
#define PALTAG_GBA 5555
#define PALTAG_POKEBALL 5558
// Exists unused in RS as well
static const u32 sUnusedStructSizes[] =
{
sizeof(struct SaveBlock2),
sizeof(struct SaveBlock1),
sizeof(struct MapHeader),
// 0x00000530, in RS
sizeof(struct Mail), //or ObjectEvent / ObjectEventGraphicsInfo
sizeof(struct Pokemon), //or TrainerCard
0x00000528 // 0x000004D8, in RS
};
static const u16 sTradeMovesBoxTilemap[] = INCBIN_U16("graphics/trade/moves_box_map.bin");
static const u16 sTradePartyBoxTilemap[] = INCBIN_U16("graphics/trade/party_box_map.bin");
static const u8 sTradeStripesBG2Tilemap[] = INCBIN_U8("graphics/trade/stripes_bg2_map.bin");
static const u8 sTradeStripesBG3Tilemap[] = INCBIN_U8("graphics/trade/stripes_bg3_map.bin");
static const u8 sText_EmptyString[] = _("");
static const u8 sText_UnusedTextFormat[] = _("{COLOR WHITE}{HIGHLIGHT TRANSPARENT}{SHADOW DARK_GRAY}");
const u8 gText_MaleSymbol4[] = _("♂");
const u8 gText_FemaleSymbol4[] = _("♀");
const u8 gText_GenderlessSymbol[] = _("");
static const u8 sText_SpaceMove[] = _(" MOVE"); // unused
static const u8 sText_NewLine[] = _("\n");
static const u8 sText_Slash[] = _("/");
static const u8 sText_Lv[] = _("Lv. ");
static const u8 sText_ThreeDashes[] = _("---");
static const u8 sText_FourQuestionMarks[] = _("????");
static const u8 sText_UnusedEmpty[] = _("");
static const u8 sText_IsThisTradeOkay[] = _("Is this trade okay?");
static const u8 sText_Cancel[] = _("CANCEL");
static const u8 sText_ChooseAPkmn[] = _("Choose a POKéMON.");
static const u8 sText_Summary[] = _("SUMMARY");
static const u8 sText_Trade[] = _("TRADE");
static const u8 sText_CancelTrade[] = _("Cancel trade?");
static const u8 sJPText_PressBButtonToQuit[] = _("Bボタン で もどります");
static const u8 sText_Summary2[] = _("SUMMARY");
static const u8 sText_Trade2[] = _("TRADE");
static const u8 sText_CommunicationStandby[] = _("{COLOR DARK_GRAY}{HIGHLIGHT WHITE}{SHADOW LIGHT_GRAY}Communication standby…\nPlease wait.");
static const u8 sText_TheTradeHasBeenCanceled[] = _("{COLOR DARK_GRAY}{HIGHLIGHT WHITE}{SHADOW LIGHT_GRAY}The trade has\nbeen canceled.");
static const u8 sText_OnlyPkmnForBattle[] = _("That's your only\nPOKéMON for battle.");
static const u8 sText_WaitingForYourFriend[] = _("{COLOR DARK_GRAY}{HIGHLIGHT WHITE}{SHADOW LIGHT_GRAY}Waiting for your friend\nto finish…");
static const u8 sText_YourFriendWantsToTrade[] = _("Your friend wants\nto trade POKéMON.");
static const struct OamData sTradeOamData_32x16 =
{
.shape = SPRITE_SHAPE(32x16),
.size = SPRITE_SIZE(32x16),
.priority = 1
};
static const struct OamData sOamData_Cursor =
{
.shape = SPRITE_SHAPE(64x32),
.size = SPRITE_SIZE(64x32),
.priority = 1
};
static const union AnimCmd sAnim_Cursor_Normal[] =
{
ANIMCMD_FRAME(0, 5),
ANIMCMD_END
};
static const union AnimCmd sAnim_Cursor_OnCancel[] =
{
ANIMCMD_FRAME(32, 5),
ANIMCMD_END
};
enum {
CURSOR_ANIM_NORMAL,
CURSOR_ANIM_ON_CANCEL,
};
static const union AnimCmd *const sAnims_Cursor[] =
{
[CURSOR_ANIM_NORMAL] = sAnim_Cursor_Normal,
[CURSOR_ANIM_ON_CANCEL] = sAnim_Cursor_OnCancel
};
static const struct SpriteSheet sCursor_SpriteSheet =
{
.data = gTradeCursor_Gfx,
.size = 0x800,
.tag = GFXTAG_CURSOR
};
static const struct SpritePalette sCursor_SpritePalette =
{
.data = gTradeCursor_Pal,
.tag = PALTAG_CURSOR
};
static const union AnimCmd sAnim_MenuText_0[] =
{
ANIMCMD_FRAME(0, 5),
ANIMCMD_END
};
static const union AnimCmd sAnim_MenuText_1[] =
{
ANIMCMD_FRAME(8, 5),
ANIMCMD_END
};
static const union AnimCmd sAnim_MenuText_2[] =
{
ANIMCMD_FRAME(16, 5),
ANIMCMD_END
};
static const union AnimCmd sAnim_MenuText_3[] =
{
ANIMCMD_FRAME(24, 5),
ANIMCMD_END
};
static const union AnimCmd sAnim_MenuText_4[] =
{
ANIMCMD_FRAME(32, 5),
ANIMCMD_END
};
static const union AnimCmd sAnim_MenuText_5[] =
{
ANIMCMD_FRAME(40, 5),
ANIMCMD_END
};
// These anims are not used
static const union AnimCmd *const sAnims_MenuText[] =
{
sAnim_MenuText_0,
sAnim_MenuText_1,
sAnim_MenuText_2,
sAnim_MenuText_3,
sAnim_MenuText_4,
sAnim_MenuText_5
};
static const struct SpriteTemplate sSpriteTemplate_Cursor =
{
.tileTag = GFXTAG_CURSOR,
.paletteTag = PALTAG_CURSOR,
.oam = &sOamData_Cursor,
.anims = sAnims_Cursor,
.images = NULL,
.affineAnims = gDummySpriteAffineAnimTable,
.callback = SpriteCallbackDummy,
};
static const struct SpriteTemplate sSpriteTemplate_MenuText =
{
.tileTag = GFXTAG_MENU_TEXT,
.paletteTag = PALTAG_MENU_TEXT,
.oam = &sTradeOamData_32x16,
.anims = sAnims_MenuText,
.images = NULL,
.affineAnims = gDummySpriteAffineAnimTable,
.callback = SpriteCallbackDummy,
};
static const u16 TradeScreenTextPalette[] = INCBIN_U16("graphics/trade/text.gbapal");
static const struct SpritePalette gSpritePalette_TradeScreenText =
{
.data = TradeScreenTextPalette,
.tag = PALTAG_MENU_TEXT
};
// This is used to determine the next mon to select when the D-Pad is
// pressed in a given direction.
// Note that the mons are laid out like this.
// 0-5 are the player's party and 6-11 are the trading partner's party.
// 12 is the cancel button.
// 0 1 6 7
// 2 3 8 9
// 4 5 10 11
// 12
// 1st array is the current positions
// 2nd array is directions of input
// 3rd array is the next positions to go to (unoccupied spaces are skipped over)
static const u8 sTradeNextSelectedMonTable[(PARTY_SIZE * 2) + 1][4][PARTY_SIZE] =
{
{
{4, 2, 12, 12, 0, 0}, // UP
{2, 4, 12, 12, 0, 0}, // DOWN
{7, 6, 1, 0, 0, 0}, // LEFT
{1, 6, 7, 0, 0, 0} // RIGHT
},
{
{5, 3, 12, 12, 0, 0},
{3, 5, 12, 12, 0, 0},
{0, 7, 6, 1, 0, 0},
{6, 7, 0, 1, 0, 0}
},
{
{0, 0, 0, 0, 0, 0},
{4, 0, 0, 0, 0, 0},
{9, 8, 7, 6, 0, 0},
{3, 1, 0, 0, 0, 0}
},
{
{1, 1, 1, 1, 0, 0},
{5, 1, 1, 1, 0, 0},
{2, 9, 8, 7, 0, 0},
{8, 9, 6, 6, 0, 0}
},
{
{2, 2, 2, 2, 0, 0},
{0, 0, 0, 0, 0, 0},
{11, 10, 9, 8, 7, 6},
{5, 3, 1, 0, 0, 0}
},
{
{3, 3, 3, 3, 0, 0},
{1, 1, 1, 1, 0, 0},
{4, 4, 4, 4, 0, 0},
{10, 8, 6, 0, 0, 0}
},
{
{10, 8, 12, 0, 0, 0},
{8, 10, 12, 0, 0, 0},
{1, 0, 0, 0, 0, 0},
{7, 0, 1, 0, 0, 0}
},
{
{12, 0, 0, 0, 0, 0},
{9, 12, 0, 0, 0, 0},
{6, 0, 0, 0, 0, 0},
{0, 0, 0, 0, 0, 0}
},
{
{6, 0, 0, 0, 0, 0},
{10, 6, 0, 0, 0, 0},
{3, 2, 1, 0, 0, 0},
{9, 7, 0, 0, 0, 0}
},
{
{7, 0, 0, 0, 0, 0},
{11, 12, 0, 0, 0, 0},
{8, 0, 0, 0, 0, 0},
{2, 1, 0, 0, 0, 0}
},
{
{8, 0, 0, 0, 0, 0},
{6, 0, 0, 0, 0, 0},
{5, 4, 3, 2, 1, 0},
{11, 9, 7, 0, 0, 0}
},
{
{9, 0, 0, 0, 0, 0},
{12, 0, 0, 0, 0, 0},
{10, 0, 0, 0, 0, 0},
{4, 2, 0, 0, 0, 0}
},
{
{11, 9, 7, 6, 0, 0},
{7, 6, 0, 0, 0, 0},
{12, 0, 0, 0, 0, 0},
{12, 0, 0, 0, 0, 0}
}
};
static const u8 sTradeMonSpriteCoords[(PARTY_SIZE * 2) + 1][2] =
{
// Your party
{1, 5 },
{8, 5 },
{1, 10},
{8, 10},
{1, 15},
{8, 15},
// Friend's party
{16, 5 },
{23, 5 },
{16, 10},
{23, 10},
{16, 15},
{23, 15},
{23, 18} // CANCEL
};
static const u8 sTradeMonLevelCoords[][2][2] =
{
// Your party
{
{5, 4},
{12, 4},
},
{
{5, 9},
{12, 9},
},
{
{5, 14},
{12, 14},
},
// Friend's party
{
{20, 4},
{27, 4},
},
{
{20, 9},
{27, 9},
},
{
{20, 14},
{27, 14},
},
};
static const u8 sTradeMonBoxCoords[][2][2] =
{
// Your party
{
{1, 3},
{8, 3},
},
{
{1, 8},
{8, 8},
},
{
{1, 13},
{8, 13},
},
// Friend's party
{
{16, 3},
{23, 3},
},
{
{16, 8},
{23, 8},
},
{
{16, 13},
{23, 13},
},
};
static const u8 sUnusedCoords[][2] =
{
{ 0, 14},
{15, 29},
{ 3, 5},
{ 3, 7},
{18, 5},
{18, 7},
{ 8, 7},
{22, 12},
{ 8, 7},
{22, 12},
{ 6, 7},
{24, 12},
{ 6, 7},
{24, 12},
{ 8, 7},
{22, 12},
{ 7, 7},
{23, 12}
};
static const u8 *const sTradeActionTexts[] =
{
[TRADE_TEXT_CANCEL] = sText_Cancel,
[TRADE_TEXT_CHOOSE_MON] = sText_ChooseAPkmn,
[TRADE_TEXT_SUMMARY] = sText_Summary,
[TRADE_TEXT_TRADE] = sText_Trade,
[TRADE_TEXT_CANCEL_TRADE] = sText_CancelTrade,
[TRADE_TEXT_JP_QUIT] = sJPText_PressBButtonToQuit
};
static const struct MenuAction sSelectTradeMonActions[] =
{
{sText_Summary2, Task_DrawSelectionSummary},
{sText_Trade2, Task_DrawSelectionTrade}
};
static const u8 *const sTradeMessages[] =
{
[TRADE_MSG_STANDBY] = sText_CommunicationStandby,
[TRADE_MSG_CANCELED] = sText_TheTradeHasBeenCanceled,
[TRADE_MSG_ONLY_MON1] = sText_OnlyPkmnForBattle,
[TRADE_MSG_ONLY_MON2] = gText_OnlyPkmnForBattle, //identical text to above
[TRADE_MSG_WAITING_FOR_FRIEND] = sText_WaitingForYourFriend,
[TRADE_MSG_FRIEND_WANTS_TO_TRADE] = sText_YourFriendWantsToTrade,
[TRADE_MSG_MON_CANT_BE_TRADED] = gText_PkmnCantBeTradedNow,
[TRADE_MSG_EGG_CANT_BE_TRADED] = gText_EggCantBeTradedNow,
[TRADE_MSG_FRIENDS_MON_CANT_BE_TRADED] = gText_OtherTrainersPkmnCantBeTraded
};
static const u8 sTradeTextColors[] =
{
TEXT_COLOR_TRANSPARENT, //bg color
TEXT_COLOR_WHITE, //fg color
TEXT_COLOR_DARK_GRAY //shadow color
};
static const struct BgTemplate sTradeMenuBgTemplates[] =
{
{
.bg = 0,
.charBaseIndex = 2,
.mapBaseIndex = 31,
.screenSize = 0,
.paletteMode = 0,
.priority = 0,
.baseTile = 0
},
{
.bg = 1,
.charBaseIndex = 0,
.mapBaseIndex = 5,
.screenSize = 0,
.paletteMode = 0,
.priority = 1,
.baseTile = 0
},
{
.bg = 2,
.charBaseIndex = 0,
.mapBaseIndex = 6,
.screenSize = 0,
.paletteMode = 0,
.priority = 2,
.baseTile = 0
},
{
.bg = 3,
.charBaseIndex = 0,
.mapBaseIndex = 7,
.screenSize = 0,
.paletteMode = 0,
.priority = 3,
.baseTile = 0
},
};
static const struct WindowTemplate sTradeMenuWindowTemplates[] =
{
{
.bg = 0,
.tilemapLeft = 4,
.tilemapTop = 7,
.width = 22,
.height = 4,
.paletteNum = 15,
.baseBlock = 30
},
{
.bg = 0,
.tilemapLeft = 19,
.tilemapTop = 15,
.width = 10,
.height = 4,
.paletteNum = 15,
.baseBlock = 118
},
{
.bg = 0,
.tilemapLeft = 0,
.tilemapTop = 5,
.width = 8,
.height = 2,
.paletteNum = 13,
.baseBlock = 158
},
{
.bg = 0,
.tilemapLeft = 7,
.tilemapTop = 5,
.width = 8,
.height = 2,
.paletteNum = 13,
.baseBlock = 174
},
{
.bg = 0,
.tilemapLeft = 0,
.tilemapTop = 10,
.width = 8,
.height = 2,
.paletteNum = 13,
.baseBlock = 190
},
{
.bg = 0,
.tilemapLeft = 7,
.tilemapTop = 10,
.width = 8,
.height = 2,
.paletteNum = 13,
.baseBlock = 206
},
{
.bg = 0,
.tilemapLeft = 0,
.tilemapTop = 15,
.width = 8,
.height = 2,
.paletteNum = 13,
.baseBlock = 222
},
{
.bg = 0,
.tilemapLeft = 7,
.tilemapTop = 15,
.width = 8,
.height = 2,
.paletteNum = 13,
.baseBlock = 238
},
{
.bg = 0,
.tilemapLeft = 15,
.tilemapTop = 5,
.width = 8,
.height = 2,
.paletteNum = 13,
.baseBlock = 254
},
{
.bg = 0,
.tilemapLeft = 22,
.tilemapTop = 5,
.width = 8,
.height = 2,
.paletteNum = 13,
.baseBlock = 270
},
{
.bg = 0,
.tilemapLeft = 15,
.tilemapTop = 10,
.width = 8,
.height = 2,
.paletteNum = 13,
.baseBlock = 286
},
{
.bg = 0,
.tilemapLeft = 22,
.tilemapTop = 10,
.width = 8,
.height = 2,
.paletteNum = 13,
.baseBlock = 302
},
{
.bg = 0,
.tilemapLeft = 15,
.tilemapTop = 15,
.width = 8,
.height = 2,
.paletteNum = 13,
.baseBlock = 318
},
{
.bg = 0,
.tilemapLeft = 22,
.tilemapTop = 15,
.width = 8,
.height = 2,
.paletteNum = 13,
.baseBlock = 334
},
{
.bg = 0,
.tilemapLeft = 2,
.tilemapTop = 5,
.width = 14,
.height = 2,
.paletteNum = 13,
.baseBlock = 350
},
{
.bg = 0,
.tilemapLeft = 3,
.tilemapTop = 8,
.width = 11,
.height = 8,
.paletteNum = 15,
.baseBlock = 378
},
{
.bg = 0,
.tilemapLeft = 17,
.tilemapTop = 5,
.width = 14,
.height = 2,
.paletteNum = 15,
.baseBlock = 466
},
{
.bg = 0,
.tilemapLeft = 18,
.tilemapTop = 8,
.width = 11,
.height = 8,
.paletteNum = 15,
.baseBlock = 494
},
DUMMY_WIN_TEMPLATE,
};
static const struct WindowTemplate sTradeYesNoWindowTemplate =
{
.bg = 0,
.tilemapLeft = 23,
.tilemapTop = 13,
.width = 5,
.height = 4,
.paletteNum = 15,
.baseBlock = 582
};
static const u8 sJPText_Shedinja[] = _("ヌケニン");
static const u8 sTradeMenuPartyMonBoxDimensions[3][2] =
{
[TRADE_PLAYER] = {4, 3},
[TRADE_PARTNER] = {19, 3}
};
static const u16 sPokeball_Pal[] = INCBIN_U16("graphics/trade/pokeball.gbapal");
static const u8 sPokeball_Gfx[] = INCBIN_U8("graphics/trade/pokeball.4bpp");
static const u8 sPokeballSymbol_Gfx[] = INCBIN_U8("graphics/trade/pokeball_symbol.8bpp"); // unused
static const u16 sCrossingHighlightCable_Tilemap[] = INCBIN_U16("graphics/trade/crossing_highlight_cable.bin");
static const u16 sTradeTilemap_PokeBallSymbol[] = INCBIN_U16("graphics/trade/pokeball_symbol_map.bin"); // unused?
static const u16 sUnusedPal1[] = INCBIN_U16("graphics/trade/unused1.gbapal");
static const u16 sGba_Pal[] = INCBIN_U16("graphics/trade/gba.gbapal");
static const u16 sUnusedPal2[] = INCBIN_U16("graphics/trade/unused2.gbapal");
static const u16 sWirelessSignalNone_Pal_Unused[] = INCBIN_U16("graphics/trade/wireless_signal_none.gbapal");
static const u16 sLinkMon_Pal[] = INCBIN_U16("graphics/trade/link_mon.gbapal");
static const u8 sLinkMonGlow_Gfx[] = INCBIN_U8("graphics/trade/link_mon_glow.4bpp");
static const u8 sLinkMonShadow_Gfx[] = INCBIN_U8("graphics/trade/link_mon_shadow.4bpp");
static const u8 sCableEnd_Gfx[] = INCBIN_U8("graphics/trade/cable_end.4bpp");
static const u8 sGbaScreen_Gfx[] = INCBIN_U8("graphics/trade/gba_screen.4bpp");
const u16 gTradePlatform_Tilemap[] = INCBIN_U16("graphics/trade/platform.bin");
static const u8 sGbaAffine_Gfx[] = INCBIN_U8("graphics/trade/gba_affine.8bpp"); // Only the gfx for when the GBA is zooming in/out
static const u8 sEmptyGfx[64] = {};
static const u8 sGbaCable_AffineTilemap[] = INCBIN_U8("graphics/trade/gba_affine_map_cable.bin");
static const u8 sGbaWireless_AffineTilemap[] = INCBIN_U8("graphics/trade/gba_affine_map_wireless.bin");
static const u16 sGbaWireless_Tilemap[] = INCBIN_U16("graphics/trade/gba_map_wireless.bin");
static const u16 sGbaCable_Tilemap[] = INCBIN_U16("graphics/trade/gba_map_cable.bin");
static const u32 sCrossingHighlightWireless_Tilemap[] = INCBIN_U32("graphics/trade/crossing_highlight_wireless.bin.lz");
static const u16 sWirelessSignalSend_Pal[] = INCBIN_U16("graphics/trade/wireless_signal_send.gbapal");
static const u16 sWirelessSignalRecv_Pal[] = INCBIN_U16("graphics/trade/wireless_signal_receive.gbapal");
static const u16 sWirelessSignalNone_Pal[] = INCBIN_U16("graphics/trade/wireless_signal_none.gbapal");
static const u32 sWirelessSignal_Gfx[] = INCBIN_U32("graphics/trade/wireless_signal.4bpp.lz");
static const u32 sWirelessSignal_Tilemap[] = INCBIN_U32("graphics/trade/wireless_signal.bin.lz");
static const struct OamData sOamData_Pokeball =
{
.affineMode = ST_OAM_AFFINE_NORMAL,
.shape = SPRITE_SHAPE(16x16),
.size = SPRITE_SIZE(16x16)
};
static const union AnimCmd sAnim_Pokeball_SpinOnce[] =
{
ANIMCMD_FRAME( 0, 3),
ANIMCMD_FRAME( 4, 3),
ANIMCMD_FRAME( 8, 3),
ANIMCMD_FRAME(12, 3),
ANIMCMD_FRAME(16, 3),
ANIMCMD_FRAME(20, 3),
ANIMCMD_FRAME(24, 3),
ANIMCMD_FRAME(28, 3),
ANIMCMD_FRAME(32, 3),
ANIMCMD_FRAME(36, 3),
ANIMCMD_FRAME(40, 3),
ANIMCMD_FRAME(44, 3),
ANIMCMD_LOOP(1),
ANIMCMD_FRAME( 0, 3),
ANIMCMD_END
};
static const union AnimCmd sAnim_Pokeball_SpinTwice[] =
{
ANIMCMD_FRAME( 0, 3),
ANIMCMD_FRAME( 4, 3),
ANIMCMD_FRAME( 8, 3),
ANIMCMD_FRAME(12, 3),
ANIMCMD_FRAME(16, 3),
ANIMCMD_FRAME(20, 3),
ANIMCMD_FRAME(24, 3),
ANIMCMD_FRAME(28, 3),
ANIMCMD_FRAME(32, 3),
ANIMCMD_FRAME(36, 3),
ANIMCMD_FRAME(40, 3),
ANIMCMD_FRAME(44, 3),
ANIMCMD_LOOP(2),
ANIMCMD_FRAME( 0, 3),
ANIMCMD_END
};
static const union AnimCmd *const sAnims_Pokeball[] =
{
sAnim_Pokeball_SpinOnce,
sAnim_Pokeball_SpinTwice
};
static const union AffineAnimCmd sAffineAnim_Pokeball_Normal[] =
{
AFFINEANIMCMD_FRAME(0, 0, 0, 1),
AFFINEANIMCMD_END
};
static const union AffineAnimCmd sAffineAnim_Pokeball_Squish[] =
{
AFFINEANIMCMD_FRAME(-8, 0, 0, 20),
AFFINEANIMCMD_END
};
static const union AffineAnimCmd sAffineAnim_Pokeball_Unsquish[] =
{
AFFINEANIMCMD_FRAME(0x60, 0x100, 0, 0),
AFFINEANIMCMD_FRAME( 0, 0, 0, 5),
AFFINEANIMCMD_FRAME( 8, 0, 0, 20),
AFFINEANIMCMD_END
};
static const union AffineAnimCmd *const sAffineAnims_Pokeball[] =
{
sAffineAnim_Pokeball_Normal,
sAffineAnim_Pokeball_Squish,
sAffineAnim_Pokeball_Unsquish
};
static const struct SpriteSheet sPokeBallSpriteSheet =
{
.data = sPokeball_Gfx,
.size = 0x600,
.tag = GFXTAG_POKEBALL
};
static const struct SpritePalette sPokeBallSpritePalette =
{
.data = sPokeball_Pal,
.tag = PALTAG_POKEBALL
};
static const struct SpriteTemplate sSpriteTemplate_Pokeball =
{
.tileTag = GFXTAG_POKEBALL,
.paletteTag = PALTAG_POKEBALL,
.oam = &sOamData_Pokeball,
.anims = sAnims_Pokeball,
.images = NULL,
.affineAnims = sAffineAnims_Pokeball,
.callback = SpriteCB_BouncingPokeball
};
static const struct OamData sOamData_LinkMonGlow =
{
.affineMode = ST_OAM_AFFINE_NORMAL,
.objMode = ST_OAM_OBJ_BLEND,
.shape = SPRITE_SHAPE(32x32),
.size = SPRITE_SIZE(32x32),
.priority = 1
};
static const union AnimCmd sAnim_LinkMonGlow[] =
{
ANIMCMD_FRAME(0, 5, .hFlip = TRUE, .vFlip = TRUE), // ? The graphic is a perfect circle, no need to flip
ANIMCMD_END
};
static const union AnimCmd *const sAnims_LinkMonGlow[] =
{
sAnim_LinkMonGlow
};
static const union AffineAnimCmd sAffineAnim_LinkMonGlow[] =
{
AFFINEANIMCMD_FRAME(-10, -10, 0, 5),
AFFINEANIMCMD_FRAME(10, 10, 0, 5),
AFFINEANIMCMD_JUMP(0)
};
static const union AffineAnimCmd *const sAffineAnims_LinkMonGlow[] =
{
sAffineAnim_LinkMonGlow
};
static const struct SpriteSheet sSpriteSheet_LinkMonGlow =
{
.data = sLinkMonGlow_Gfx,
.size = 0x200,
.tag = GFXTAG_LINK_MON_GLOW
};
static const struct SpritePalette sSpritePalette_LinkMon =
{
.data = sLinkMon_Pal,
.tag = PALTAG_LINK_MON
};
static const struct SpritePalette sSpritePalette_Gba =
{
.data = sGba_Pal,
.tag = PALTAG_GBA
};
static const struct SpriteTemplate sSpriteTemplate_LinkMonGlow =
{
.tileTag = GFXTAG_LINK_MON_GLOW,
.paletteTag = PALTAG_LINK_MON,
.oam = &sOamData_LinkMonGlow,
.anims = sAnims_LinkMonGlow,
.images = NULL,
.affineAnims = sAffineAnims_LinkMonGlow,
.callback = SpriteCB_LinkMonGlow
};
static const struct OamData sOamData_LinkMonShadow =
{
.shape = SPRITE_SHAPE(16x32),
.size = SPRITE_SIZE(16x32),
.priority = 1
};
static const union AnimCmd sAnim_LinkMonShadow_Big[] =
{
ANIMCMD_FRAME(0, 5, .vFlip = TRUE, .hFlip = TRUE),
ANIMCMD_END
};
static const union AnimCmd sAnim_LinkMonShadow_Small[] =
{
ANIMCMD_FRAME(8, 5, .vFlip = TRUE, .hFlip = TRUE),
ANIMCMD_END
};
enum {
ANIM_LINKMON_BIG,
ANIM_LINKMON_SMALL,
};
static const union AnimCmd *const sAnims_LinkMonShadow[] =
{
[ANIM_LINKMON_BIG] = sAnim_LinkMonShadow_Big,
[ANIM_LINKMON_SMALL] = sAnim_LinkMonShadow_Small
};
static const struct SpriteSheet sSpriteSheet_LinkMonShadow =
{
.data = sLinkMonShadow_Gfx,
.size = 0x300,
.tag = GFXTAG_LINK_MON_SHADOW
};
static const struct SpriteTemplate sSpriteTemplate_LinkMonShadow =
{
.tileTag = GFXTAG_LINK_MON_SHADOW,
.paletteTag = PALTAG_LINK_MON,
.oam = &sOamData_LinkMonShadow,
.anims = sAnims_LinkMonShadow,
.images = NULL,
.affineAnims = gDummySpriteAffineAnimTable,
.callback = SpriteCB_LinkMonShadow
};
static const struct OamData sOamData_CableEnd =
{
.shape = SPRITE_SHAPE(16x32),
.size = SPRITE_SIZE(16x32),
.priority = 1
};
static const union AnimCmd sAnim_CableEnd[] =
{
ANIMCMD_FRAME(0, 10),
ANIMCMD_END
};
static const union AnimCmd *const sAnims_CableEnd[] =
{
sAnim_CableEnd
};
static const struct SpriteSheet sSpriteSheet_CableEnd =
{
.data = sCableEnd_Gfx,
.size = 0x100,
.tag = GFXTAG_CABLE_END
};
static const struct SpriteTemplate sSpriteTemplate_CableEnd =
{
.tileTag = GFXTAG_CABLE_END,
.paletteTag = PALTAG_GBA,
.oam = &sOamData_CableEnd,
.anims = sAnims_CableEnd,
.images = NULL,
.affineAnims = gDummySpriteAffineAnimTable,
.callback = SpriteCB_CableEndSending
};
static const struct OamData sOamData_GbaScreen =
{
.shape = SPRITE_SHAPE(64x32),
.size = SPRITE_SIZE(64x32),
.priority = 1
};
static const union AnimCmd sAnim_GbaScreen_Long[] =
{
ANIMCMD_FRAME( 0, 2, .vFlip = TRUE, .hFlip = TRUE),
ANIMCMD_FRAME(32, 2, .vFlip = TRUE, .hFlip = TRUE),
ANIMCMD_FRAME(64, 2, .vFlip = TRUE, .hFlip = TRUE),
ANIMCMD_FRAME(96, 2, .vFlip = TRUE, .hFlip = TRUE),
ANIMCMD_FRAME(64, 2, .vFlip = TRUE, .hFlip = TRUE),
ANIMCMD_FRAME(32, 2, .vFlip = TRUE, .hFlip = TRUE),
ANIMCMD_FRAME( 0, 2, .vFlip = TRUE, .hFlip = TRUE),
ANIMCMD_LOOP(8),
ANIMCMD_END
};
static const union AnimCmd sAnim_GbaScreen_Short[] =
{
ANIMCMD_FRAME( 0, 2, .vFlip = TRUE, .hFlip = TRUE),
ANIMCMD_FRAME(32, 2, .vFlip = TRUE, .hFlip = TRUE),
ANIMCMD_FRAME(64, 2, .vFlip = TRUE, .hFlip = TRUE),
ANIMCMD_FRAME(96, 2, .vFlip = TRUE, .hFlip = TRUE),
ANIMCMD_FRAME(64, 2, .vFlip = TRUE, .hFlip = TRUE),
ANIMCMD_FRAME(32, 2, .vFlip = TRUE, .hFlip = TRUE),
ANIMCMD_FRAME( 0, 2, .vFlip = TRUE, .hFlip = TRUE),
ANIMCMD_LOOP(2),
ANIMCMD_END
};
static const union AnimCmd *const sAnims_GbaScreen_Long[] =
{
sAnim_GbaScreen_Long
};
static const union AnimCmd *const sAnims_GbaScreen_Short[] =
{
sAnim_GbaScreen_Short
};
static const struct SpriteSheet sSpriteSheet_GbaScreen =
{
.data = sGbaScreen_Gfx,
.size = 0x1000,
.tag = GFXTAG_GBA_SCREEN
};
static const struct SpriteTemplate sSpriteTemplate_GbaScreenFlash_Long =
{
.tileTag = GFXTAG_GBA_SCREEN,
.paletteTag = PALTAG_GBA,
.oam = &sOamData_GbaScreen,
.anims = sAnims_GbaScreen_Long,
.images = NULL,
.affineAnims = gDummySpriteAffineAnimTable,
.callback = SpriteCB_GbaScreen
};
static const struct SpriteTemplate sSpriteTemplate_GbaScreenFlash_Short =
{
.tileTag = GFXTAG_GBA_SCREEN,
.paletteTag = PALTAG_GBA,
.oam = &sOamData_GbaScreen,
.anims = sAnims_GbaScreen_Short,
.images = NULL,
.affineAnims = gDummySpriteAffineAnimTable,
.callback = SpriteCB_GbaScreen
};
static const u16 sLinkMonShadow_Pal[] = INCBIN_U16("graphics/trade/link_mon_shadow.gbapal");
static const union AffineAnimCmd sAffineAnim_CrossingMonPic[] =
{
AFFINEANIMCMD_FRAME(-0x100, 0x100, 0, 0),
AFFINEANIMCMD_JUMP(0)
};
static const union AffineAnimCmd *const sAffineAnims_CrossingMonPics[] =
{
sAffineAnim_CrossingMonPic
};
static const struct InGameTrade sIngameTrades[] =
{
[INGAME_TRADE_SEEDOT] =
{
.nickname = _("DOTS"),
.species = SPECIES_SEEDOT,
.ivs = {5, 4, 5, 4, 4, 4},
.abilityNum = 1,
.otId = 38726,
.conditions = {30, 5, 5, 5, 5},
.personality = 0x84,
.heldItem = ITEM_CHESTO_BERRY,
.mailNum = -1,
.otName = _("KOBE"),
.otGender = MALE,
.sheen = 10,
.requestedSpecies = SPECIES_RALTS
},
[INGAME_TRADE_PLUSLE] =
{
.nickname = _("PLUSES"),
.species = SPECIES_PLUSLE,
.ivs = {4, 4, 4, 5, 5, 4},
.abilityNum = 0,
.otId = 73996,
.conditions = {5, 5, 30, 5, 5},
.personality = 0x6F,
.heldItem = ITEM_WOOD_MAIL,
.mailNum = 0,
.otName = _("ROMAN"),
.otGender = MALE,
.sheen = 10,
.requestedSpecies = SPECIES_VOLBEAT
},
[INGAME_TRADE_HORSEA] =
{
.nickname = _("SEASOR"),
.species = SPECIES_HORSEA,
.ivs = {5, 4, 4, 4, 5, 4},
.abilityNum = 0,
.otId = 46285,
.conditions = {5, 5, 5, 5, 30},
.personality = 0x7F,
.heldItem = ITEM_WAVE_MAIL,
.mailNum = 1,
.otName = _("SKYLAR"),
.otGender = MALE,
.sheen = 10,
.requestedSpecies = SPECIES_BAGON
},
[INGAME_TRADE_MEOWTH] =
{
.nickname = _("MEOWOW"),
.species = SPECIES_MEOWTH,
.ivs = {4, 5, 4, 5, 4, 4},
.abilityNum = 0,
.otId = 91481,
.conditions = {5, 5, 5, 30, 5},
.personality = 0x8B,
.heldItem = ITEM_RETRO_MAIL,
.mailNum = 2,
.otName = _("ISIS"),
.otGender = FEMALE,
.sheen = 10,
.requestedSpecies = SPECIES_SKITTY
}
};
static const u16 sIngameTradeMail[][MAIL_WORDS_COUNT + 1] =
{
{
EC_WORD_BE,
EC_WORD_NICE,
EC_WORD_TO,
EC_POKEMON(PLUSLE),
EC_WORD_EXCL,
EC_POKEMON(VOLBEAT),
EC_WORD_WILL,
EC_WORD_BE,
EC_WORD_FANTASTIC
}, {
EC_WORD_I,
EC_WORD_WILL,
EC_WORD_MAKE,
EC_POKEMON(BAGON),
EC_WORD_TOUGH,
EC_WORD_PLEASE,
EC_WORD_TRAIN,
EC_POKEMON(HORSEA),
EC_WORD_WELL
}, {
EC_WORD_THANK_YOU,
EC_WORD_FOR,
EC_POKEMON(SKITTY),
EC_POKEMON_NATIONAL(MEOWTH),
EC_WORD_CRIES,
EC_WORD_IN,
EC_WORD_A,
EC_WORD_CUTE,
EC_WORD_WAY
}
};
static const struct WindowTemplate sTradeSequenceWindowTemplates[] =
{
{
.bg = 0,
.tilemapLeft = 2,
.tilemapTop = 15,
.width = 26,
.height = 4,
.paletteNum = 0,
.baseBlock = 64
},
DUMMY_WIN_TEMPLATE
};
const struct WindowTemplate gTradeEvolutionSceneYesNoWindowTemplate =
{
.bg = 0,
.tilemapLeft = 21,
.tilemapTop = 9,
.width = 5,
.height = 4,
.paletteNum = 15,
.baseBlock = 188
};
static const struct BgTemplate sTradeSequenceBgTemplates[] =
{
{
.bg = 0,
.charBaseIndex = 3,
.mapBaseIndex = 31,
.screenSize = 0,
.paletteMode = 0,
.priority = 0,
.baseTile = 0
},
{
.bg = 1,
.charBaseIndex = 0,
.mapBaseIndex = 5,
.screenSize = 0,
.paletteMode = 0,
.priority = 2,
.baseTile = 0
},
{
.bg = 2,
.charBaseIndex = 1,
.mapBaseIndex = 18,
.screenSize = 1,
.paletteMode = 0,
.priority = 2,
.baseTile = 0
},
{
.bg = 3,
.charBaseIndex = 0,
.mapBaseIndex = 6,
.screenSize = 0,
.paletteMode = 0,
.priority = 3,
.baseTile = 0
},
};
static const s8 sTradeBallVerticalVelocityTable[] =
{
0, 0, 1, 0, 1, 0, 1, 1, 1,
1, 2, 2, 2, 2, 3, 3, 3, 3,
4, 4, 4, 4, -4, -4, -4, -3, -3,
-3, -3, -2, -2, -2, -2, -1, -1, -1,
-1, 0, -1, 0, -1, 0, 0, 0, 0,
0, 1, 0, 1, 0, 1, 1, 1, 1,
2, 2, 2, 2, 3, 3, 3, 3, 4,
4, 4, 4, -4, -3, -3, -2, -2, -1,
-1, -1, 0, -1, 0, 0, 0, 0, 0,
0, 1, 0, 1, 1, 1, 2, 2, 3,
3, 4, -4, -3, -2, -1, -1, -1, 0,
0, 0, 0, 1, 0, 1, 1, 2, 3
};
static const u8 sWirelessSignalTiming[][2] =
{
{ 0, 1},
{ 1, 1},
{ 2, 1},
{ 3, 1},
{ 4, 1},
{ 5, 2},
{ 6, 2},
{ 7, 2},
{ 8, 2},
{ 9, 2},
{10, 3},
{11, 3},
{12, 3},
{13, 4},
{14, 5},
{15, 2},
{ 0, 1},
{ 1, 1},
{ 2, 1},
{ 3, 1},
{ 4, 1},
{ 5, 2},
{ 6, 2},
{ 7, 2},
{ 8, 2},
{ 9, 2},
{10, 3},
{11, 3},
{12, 3},
{13, 4},
{14, 5},
{16, 1},
{16, -1},
{}
};
|