forked from pret/pokeemerald
-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathintro.c
3432 lines (3231 loc) · 99.1 KB
/
intro.c
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 "global.h"
#include "main.h"
#include "palette.h"
#include "scanline_effect.h"
#include "task.h"
#include "title_screen.h"
#include "libgcnmultiboot.h"
#include "malloc.h"
#include "gpu_regs.h"
#include "link.h"
#include "multiboot_pokemon_colosseum.h"
#include "load_save.h"
#include "save.h"
#include "new_game.h"
#include "m4a.h"
#include "random.h"
#include "decompress.h"
#include "constants/songs.h"
#include "intro_credits_graphics.h"
#include "trig.h"
#include "intro.h"
#include "graphics.h"
#include "sound.h"
#include "util.h"
#include "title_screen.h"
#include "constants/rgb.h"
#include "constants/battle_anim.h"
/*
The intro is grouped into the following scenes
Scene 0. Copyright screen
Scene 1. GF Logo, pan up over plants, Flygon silhouette goes by
Scene 2. Player biking on path, joined by Pokémon
Scene 3. A fight between Groudon/Kyogre ends with Rayquaza
After this it progresses to the title screen
*/
// Scene 1 main tasks
static void Task_Scene1_Load(u8);
static void Task_Scene1_FadeIn(u8);
static void Task_Scene1_WaterDrops(u8);
static void Task_Scene1_PanUp(u8);
static void Task_Scene1_End(u8);
// Scene 1 supplemental functions
static void IntroResetGpuRegs(void);
static u8 CreateGameFreakLogoSprites(s16, s16, s16);
static void Task_BlendLogoIn(u8);
static void Task_BlendLogoOut(u8);
static void Task_CreateSparkles(u8);
static u8 CreateWaterDrop(s16, s16, u16, u16, u16, u8);
static void SpriteCB_WaterDrop(struct Sprite *sprite);
static void SpriteCB_WaterDrop_Slide(struct Sprite *);
static void SpriteCB_WaterDrop_ReachLeafEnd(struct Sprite *);
static void SpriteCB_WaterDrop_DangleFromLeaf(struct Sprite *);
static void SpriteCB_WaterDrop_Fall(struct Sprite *);
static void SpriteCB_WaterDrop_Ripple(struct Sprite *);
static void SpriteCB_Sparkle(struct Sprite *sprite);
static void SpriteCB_LogoLetter(struct Sprite *sprite);
static void SpriteCB_GameFreakLogo(struct Sprite *sprite);
static void SpriteCB_FlygonSilhouette(struct Sprite *sprite);
// Scene 2 main tasks
static void Task_Scene2_Load(u8);
static void Task_Scene2_CreateSprites(u8);
static void Task_Scene2_BikeRide(u8);
static void Task_Scene2_End(u8);
// Scene 2 supplemental functions
static void SpriteCB_Torchic(struct Sprite *sprite);
static void SpriteCB_Manectric(struct Sprite *sprite);
static void SpriteCB_Volbeat(struct Sprite *sprite);
static void SpriteCB_Flygon(struct Sprite *);
static void SpriteCB_PlayerOnBicycle(struct Sprite *);
// Scene 3 main tasks
static void Task_Scene3_Load(u8);
static void Task_Scene3_SpinPokeball(u8);
static void Task_Scene3_WaitGroudon(u8);
static void Task_Scene3_LoadGroudon(u8);
static void Task_Scene3_InitGroudonBg(u8);
static void Task_Scene3_NarrowWindow(u8);
static void Task_Scene3_EndNarrowWindow(u8);
static void Task_Scene3_StartGroudon(u8);
static void Task_Scene3_Groudon(u8);
static void Task_Scene3_LoadKyogre(u8);
static void Task_Scene3_Kyogre(u8);
static void Task_Scene3_LoadClouds1(u8);
static void Task_Scene3_LoadClouds2(u8);
static void Task_Scene3_InitClouds(u8);
static void Task_Scene3_Clouds(u8);
static void Task_Scene3_LoadLightning(u8);
static void Task_Scene3_Lightning(u8);
static void Task_Scene3_LoadRayquazaAttack(u8);
static void Task_Scene3_Rayquaza(u8);
static void Task_EndIntroMovie(u8);
// Scene 3 supplemental functions
static void CreateGroudonRockSprites(u8);
static void CreateKyogreBubbleSprites_Body(u8);
static void CreateKyogreBubbleSprites_Fins(void);
static void Task_RayquazaAttack(u8);
static void SpriteCB_GroudonRocks(struct Sprite *);
static void SpriteCB_KyogreBubbles(struct Sprite *sprite);
static void SpriteCB_Lightning(struct Sprite *sprite);
static void SpriteCB_RayquazaOrb(struct Sprite *sprite);
static void MainCB2_EndIntro(void);
extern const struct CompressedSpriteSheet gBattleAnimPicTable[];
extern const struct CompressedSpritePalette gBattleAnimPaletteTable[];
extern const struct SpriteTemplate gAncientPowerRockSpriteTemplate;
enum {
COPYRIGHT_INITIALIZE,
COPYRIGHT_START_FADE = 140,
COPYRIGHT_START_INTRO,
};
#define TAG_VOLBEAT 1500
#define TAG_TORCHIC 1501
#define TAG_MANECTRIC 1502
#define TAG_LIGHTNING 1503
#define TAG_BUBBLES 1504
#define TAG_SPARKLE 1505
#define GFXTAG_DROPS_LOGO 2000
#define PALTAG_DROPS 2000
#define PALTAG_LOGO 2001
#define TAG_FLYGON_SILHOUETTE 2002
#define TAG_RAYQUAZA_ORB 2003
#define COLOSSEUM_GAME_CODE 0x65366347 // "Gc6e" in ASCII
// Used by various tasks and sprites
#define tState data[0]
#define sState data[0]
/*
gIntroFrameCounter is used as a persistent timer throughout the
intro cinematic. At various points it's used to determine when
to trigger actions or progress through the cutscene.
The values for these are defined contiguously below.
*/
#define TIMER_BIG_DROP_START 76
#define TIMER_LOGO_APPEAR 128
#define TIMER_LOGO_LETTERS_COLOR 144
#define TIMER_BIG_DROP_FALLS 251
#define TIMER_LOGO_BLEND_OUT 256
#define TIMER_LOGO_DISAPPEAR 272
#define TIMER_SMALL_DROP_1 368
#define TIMER_SMALL_DROP_2 384
#define TIMER_SPARKLES 560
#define TIMER_FLYGON_SILHOUETTE_APPEAR 832
#define TIMER_END_PAN_UP 904
#define TIMER_END_SCENE_1 1007
#define TIMER_START_SCENE_2 1026
#define TIMER_MANECTRIC_ENTER 1088
#define TIMER_PLAYER_DRIFT_BACK 1109
#define TIMER_MANECTRIC_RUN_CIRCULAR 1168
#define TIMER_PLAYER_MOVE_FORWARD 1214
#define TIMER_TORCHIC_ENTER 1224
#define TIMER_FLYGON_ENTER 1394
#define TIMER_PLAYER_MOVE_BACKWARD 1398
#define TIMER_PLAYER_HOLD_POSITION 1576
#define TIMER_PLAYER_EXIT 1727
#define TIMER_TORCHIC_SPEED_UP 1735
#define TIMER_TORCHIC_EXIT 1856
#define TIMER_END_SCENE_2 1946
#define TIMER_START_SCENE_3 2068
// timer is reset for scene 3
#define TIMER_POKEBALL_FADE 28
#define TIMER_START_LEGENDARIES 43
static EWRAM_DATA u16 sIntroCharacterGender = 0;
static EWRAM_DATA u16 UNUSED sUnusedVar = 0;
static EWRAM_DATA u16 sFlygonYOffset = 0;
COMMON_DATA u32 gIntroFrameCounter = 0;
COMMON_DATA struct GcmbStruct gMultibootProgramStruct = {0};
static const u16 sIntroDrops_Pal[] = INCBIN_U16("graphics/intro/scene_1/drops.gbapal");
static const u16 sIntroLogo_Pal[] = INCBIN_U16("graphics/intro/scene_1/logo.gbapal");
static const u32 sIntroDropsLogo_Gfx[] = INCBIN_U32("graphics/intro/scene_1/drops_logo.4bpp.lz");
static const u16 sIntro1Bg_Pal[] = INCBIN_U16("graphics/intro/scene_1/bg.gbapal"); // 16 x 16
static const u32 sIntro1Bg0_Tilemap[] = INCBIN_U32("graphics/intro/scene_1/bg0_map.bin.lz");
static const u32 sIntro1Bg1_Tilemap[] = INCBIN_U32("graphics/intro/scene_1/bg1_map.bin.lz");
static const u32 sIntro1Bg2_Tilemap[] = INCBIN_U32("graphics/intro/scene_1/bg2_map.bin.lz");
static const u32 sIntro1Bg3_Tilemap[] = INCBIN_U32("graphics/intro/scene_1/bg3_map.bin.lz");
static const u32 sIntro1Bg_Gfx[] = INCBIN_U32("graphics/intro/scene_1/bg.4bpp.lz");
static const u16 sIntroPokeball_Pal[] = INCBIN_U16("graphics/intro/scene_3/pokeball.gbapal");
static const u32 sIntroPokeball_Tilemap[] = INCBIN_U32("graphics/intro/scene_3/pokeball_map.bin.lz");
static const u32 sIntroPokeball_Gfx[] = INCBIN_U32("graphics/intro/scene_3/pokeball.8bpp.lz");
static const u16 sIntroStreaks_Pal[] = INCBIN_U16("graphics/intro/scene_3/streaks.gbapal"); // Unused
static const u32 sIntroStreaks_Gfx[] = INCBIN_U32("graphics/intro/scene_3/streaks.4bpp.lz"); // Unused
static const u32 sIntroStreaks_Tilemap[] = INCBIN_U32("graphics/intro/scene_3/streaks_map.bin.lz"); // Unused
static const u16 sIntroRayquzaOrb_Pal[] = INCBIN_U16("graphics/intro/scene_3/rayquaza_orb.gbapal");
static const u16 sIntroMisc_Pal[] = INCBIN_U16("graphics/intro/scene_3/misc.gbapal"); // Unused
static const u32 sIntroMisc_Gfx[] = INCBIN_U32("graphics/intro/scene_3/misc.4bpp.lz"); // Rayquza orb, and misc unused gfx
static const u16 sIntroFlygonSilhouette_Pal[] = INCBIN_U16("graphics/intro/scene_1/flygon.gbapal");
static const u32 sIntroLati_Gfx[] = INCBIN_U32("graphics/intro/scene_1/lati.4bpp.lz"); // Unused
static const u8 sUnusedData[] = {
0x02, 0x03, 0x04, 0x05, 0x01, 0x01, 0x01, 0x06, 0x07, 0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x02, 0x0D,
0x0E, 0x0F, 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, 0x18, 0x19, 0x02, 0x0D, 0x0E, 0x0F,
0x10, 0x11, 0x12, 0x1A, 0x1B, 0x1C, 0x1D, 0x1E, 0x1F, 0x20, 0x21, 0x02, 0x0D, 0x0E, 0x0F, 0x10,
0x11, 0x12, 0x22, 0x23, 0x24, 0x25, 0x26, 0x27, 0x28, 0x29, 0x2A, 0x00
};
static const struct CompressedSpriteSheet sSpriteSheet_Sparkle[] =
{
{gIntroSparkle_Gfx, 0x400, TAG_SPARKLE},
{},
};
static const struct SpritePalette sSpritePalette_Sparkle[] =
{
{gIntroLightning_Pal, TAG_SPARKLE}, // Lightning palette re-used
{},
};
static const struct OamData sOamData_Sparkle =
{
.y = DISPLAY_HEIGHT,
.affineMode = ST_OAM_AFFINE_OFF,
.objMode = ST_OAM_OBJ_NORMAL,
.mosaic = FALSE,
.bpp = ST_OAM_4BPP,
.shape = SPRITE_SHAPE(16x16),
.x = 0,
.matrixNum = 0,
.size = SPRITE_SIZE(16x16),
.tileNum = 0,
.priority = 1,
.paletteNum = 0,
.affineParam = 0,
};
static const union AnimCmd sAnim_Sparkle[] =
{
ANIMCMD_FRAME(0, 2),
ANIMCMD_FRAME(4, 2),
ANIMCMD_FRAME(8, 2),
ANIMCMD_FRAME(12, 2),
ANIMCMD_FRAME(16, 2),
ANIMCMD_JUMP(0),
};
static const union AnimCmd *const sAnims_Sparkle[] =
{
sAnim_Sparkle,
};
static const struct SpriteTemplate sSpriteTemplate_Sparkle =
{
.tileTag = TAG_SPARKLE,
.paletteTag = TAG_SPARKLE,
.oam = &sOamData_Sparkle,
.anims = sAnims_Sparkle,
.images = NULL,
.affineAnims = gDummySpriteAffineAnimTable,
.callback = SpriteCB_Sparkle,
};
static const u8 sSparkleCoords[][2] =
{
{124, 40},
{102, 30},
{ 77, 30},
{ 54, 15},
{148, 9},
{ 63, 28},
{ 93, 40},
{148, 32},
{173, 41},
{ 94, 20},
{208, 38},
{},
};
static const struct CompressedSpriteSheet sSpriteSheet_RunningPokemon[] =
{
{gIntroVolbeat_Gfx, 0x400, TAG_VOLBEAT},
{gIntroTorchic_Gfx, 0xC00, TAG_TORCHIC},
{gIntroManectric_Gfx, 0x2000, TAG_MANECTRIC},
{},
};
static const struct SpritePalette sSpritePalettes_RunningPokemon[] =
{
{gIntroVolbeat_Pal, TAG_VOLBEAT},
{gIntroTorchic_Pal, TAG_TORCHIC},
{gIntroManectric_Pal, TAG_MANECTRIC},
{},
};
static const struct OamData sOamData_Volbeat =
{
.y = DISPLAY_HEIGHT,
.affineMode = ST_OAM_AFFINE_OFF,
.objMode = ST_OAM_OBJ_NORMAL,
.mosaic = FALSE,
.bpp = ST_OAM_4BPP,
.shape = SPRITE_SHAPE(32x32),
.x = 0,
.matrixNum = 0,
.size = SPRITE_SIZE(32x32),
.tileNum = 0,
.priority = 1,
.paletteNum = 0,
.affineParam = 0,
};
static const union AnimCmd sAnim_Volbeat[] =
{
ANIMCMD_FRAME(0, 2),
ANIMCMD_FRAME(16, 2),
ANIMCMD_JUMP(0),
};
static const union AnimCmd *const sAnims_Volbeat[] =
{
sAnim_Volbeat,
};
static const struct SpriteTemplate sSpriteTemplate_Volbeat =
{
.tileTag = TAG_VOLBEAT,
.paletteTag = TAG_VOLBEAT,
.oam = &sOamData_Volbeat,
.anims = sAnims_Volbeat,
.images = NULL,
.affineAnims = gDummySpriteAffineAnimTable,
.callback = SpriteCB_Volbeat,
};
static const struct OamData sOamData_Torchic =
{
.y = DISPLAY_HEIGHT,
.affineMode = ST_OAM_AFFINE_OFF,
.objMode = ST_OAM_OBJ_NORMAL,
.mosaic = FALSE,
.bpp = ST_OAM_4BPP,
.shape = SPRITE_SHAPE(32x32),
.x = 0,
.matrixNum = 0,
.size = SPRITE_SIZE(32x32),
.tileNum = 0,
.priority = 1,
.paletteNum = 0,
.affineParam = 0,
};
static const union AnimCmd sAnim_Torchic_Walk[] =
{
ANIMCMD_FRAME(0, 5),
ANIMCMD_FRAME(16, 5),
ANIMCMD_FRAME(32, 5),
ANIMCMD_FRAME(16, 5),
ANIMCMD_JUMP(0),
};
static const union AnimCmd sAnim_Torchic_Run[] =
{
ANIMCMD_FRAME(0, 3),
ANIMCMD_FRAME(16, 3),
ANIMCMD_FRAME(32, 3),
ANIMCMD_FRAME(16, 3),
ANIMCMD_JUMP(0),
};
static const union AnimCmd sAnim_Torchic_Trip[] =
{
ANIMCMD_FRAME(48, 4),
ANIMCMD_FRAME(64, 6),
ANIMCMD_FRAME(80, 0),
ANIMCMD_END,
};
enum {
TORCHIC_ANIM_WALK,
TORCHIC_ANIM_RUN,
TORCHIC_ANIM_TRIP,
};
static const union AnimCmd *const sAnims_Torchic[] =
{
[TORCHIC_ANIM_WALK] = sAnim_Torchic_Walk,
[TORCHIC_ANIM_RUN] = sAnim_Torchic_Run,
[TORCHIC_ANIM_TRIP] = sAnim_Torchic_Trip,
};
static const struct SpriteTemplate sSpriteTemplate_Torchic =
{
.tileTag = TAG_TORCHIC,
.paletteTag = TAG_TORCHIC,
.oam = &sOamData_Torchic,
.anims = sAnims_Torchic,
.images = NULL,
.affineAnims = gDummySpriteAffineAnimTable,
.callback = SpriteCB_Torchic,
};
static const struct OamData sOamData_Manectric =
{
.y = DISPLAY_HEIGHT,
.affineMode = ST_OAM_AFFINE_OFF,
.objMode = ST_OAM_OBJ_NORMAL,
.mosaic = FALSE,
.bpp = ST_OAM_4BPP,
.shape = SPRITE_SHAPE(64x64),
.x = 0,
.matrixNum = 0,
.size = SPRITE_SIZE(64x64),
.tileNum = 0,
.priority = 1,
.paletteNum = 0,
.affineParam = 0,
};
static const union AnimCmd sAnim_Manectric[] =
{
ANIMCMD_FRAME(0, 4),
ANIMCMD_FRAME(64, 4),
ANIMCMD_FRAME(128, 4),
ANIMCMD_FRAME(192, 4),
ANIMCMD_JUMP(0),
};
static const union AnimCmd *const sAnims_Manectric[] =
{
sAnim_Manectric,
};
static const struct SpriteTemplate sSpriteTemplate_Manectric =
{
.tileTag = TAG_MANECTRIC,
.paletteTag = TAG_MANECTRIC,
.oam = &sOamData_Manectric,
.anims = sAnims_Manectric,
.images = NULL,
.affineAnims = gDummySpriteAffineAnimTable,
.callback = SpriteCB_Manectric,
};
static const struct CompressedSpriteSheet sSpriteSheet_Lightning[] =
{
{gIntroLightning_Gfx, 0xC00, TAG_LIGHTNING},
{},
};
static const struct SpritePalette sSpritePalette_Lightning[] =
{
{gIntroLightning_Pal, TAG_LIGHTNING},
{},
};
static const struct OamData sOamData_Lightning =
{
.y = DISPLAY_HEIGHT,
.affineMode = ST_OAM_AFFINE_OFF,
.objMode = ST_OAM_OBJ_NORMAL,
.mosaic = FALSE,
.bpp = ST_OAM_4BPP,
.shape = SPRITE_SHAPE(32x32),
.x = 0,
.matrixNum = 0,
.size = SPRITE_SIZE(32x32),
.tileNum = 0,
.priority = 0,
.paletteNum = 0,
.affineParam = 0,
};
static const union AnimCmd sAnim_Lightning_Top[] =
{
ANIMCMD_FRAME(0, 2),
ANIMCMD_FRAME(48, 2),
ANIMCMD_END,
};
static const union AnimCmd sAnim_Lightning_Middle[] =
{
ANIMCMD_FRAME(16, 2),
ANIMCMD_FRAME(64, 2),
ANIMCMD_END,
};
static const union AnimCmd sAnim_Lightning_Bottom[] =
{
ANIMCMD_FRAME(32, 2),
ANIMCMD_FRAME(80, 2),
ANIMCMD_END,
};
static const union AnimCmd *const sAnims_Lightning[] =
{
sAnim_Lightning_Top,
sAnim_Lightning_Middle,
sAnim_Lightning_Bottom,
};
static const struct SpriteTemplate sSpriteTemplate_Lightning =
{
.tileTag = TAG_LIGHTNING,
.paletteTag = TAG_LIGHTNING,
.oam = &sOamData_Lightning,
.anims = sAnims_Lightning,
.images = NULL,
.affineAnims = gDummySpriteAffineAnimTable,
.callback = SpriteCB_Lightning,
};
// x coord, anim number, speed
// Smaller anim numbers are larger rocks, and are given slower speeds
static const s16 sGroudonRockData[][3] =
{
{104, 0, 0x0C0},
{142, 3, 0x280},
{ 83, 1, 0x180},
{155, 0, 0x080},
{ 56, 2, 0x200},
{174, 1, 0x100},
};
static const struct CompressedSpriteSheet sSpriteSheet_Bubbles[] =
{
{gIntroBubbles_Gfx, 0x600, TAG_BUBBLES},
{},
};
static const struct SpritePalette sSpritePalette_Bubbles[] =
{
{gIntroBubbles_Pal, TAG_BUBBLES},
{},
};
#define NUM_BUBBLES_IN_SET 6
// x coord, y coord, delay before animation
// Can be produced in two different sets depending on the function called to create the sprites
static const s16 sKyogreBubbleData[NUM_BUBBLES_IN_SET * 2][3] =
{
// Set 1, for Kyogre's body
{ 66, 64, 1},
{ 96, 96, 8},
{128, 64, 1},
{144, 48, 8},
{160, 72, 1},
{176, 96, 8},
// Set 2, for Kyogre's fins
{ 96, 96, 4},
{112, 104, 8},
{128, 96, 4},
{ 88, 32, 4},
{104, 24, 8},
{120, 32, 4},
};
static const struct OamData sOamData_Bubbles =
{
.y = DISPLAY_HEIGHT,
.affineMode = ST_OAM_AFFINE_OFF,
.objMode = ST_OAM_OBJ_NORMAL,
.mosaic = FALSE,
.bpp = ST_OAM_4BPP,
.shape = SPRITE_SHAPE(16x32),
.x = 0,
.matrixNum = 0,
.size = SPRITE_SIZE(16x32),
.tileNum = 0,
.priority = 0,
.paletteNum = 0,
.affineParam = 0,
};
static const union AnimCmd sAnim_Bubbles[] =
{
ANIMCMD_FRAME(0, 4),
ANIMCMD_FRAME(8, 4),
ANIMCMD_FRAME(16, 4),
ANIMCMD_FRAME(24, 4),
ANIMCMD_FRAME(32, 4),
ANIMCMD_END,
};
static const union AnimCmd *const sAnims_Bubbles[] =
{
sAnim_Bubbles,
};
static const struct SpriteTemplate sSpriteTemplate_Bubbles =
{
.tileTag = TAG_BUBBLES,
.paletteTag = TAG_BUBBLES,
.oam = &sOamData_Bubbles,
.anims = sAnims_Bubbles,
.images = NULL,
.affineAnims = gDummySpriteAffineAnimTable,
.callback = SpriteCB_KyogreBubbles,
};
static const struct OamData sOamData_WaterDrop =
{
.y = DISPLAY_HEIGHT,
.affineMode = ST_OAM_AFFINE_OFF,
.objMode = ST_OAM_OBJ_NORMAL,
.mosaic = FALSE,
.bpp = ST_OAM_4BPP,
.shape = SPRITE_SHAPE(32x32),
.x = 0,
.matrixNum = 0,
.size = SPRITE_SIZE(32x32),
.tileNum = 0,
.priority = 0,
.paletteNum = 0,
.affineParam = 0,
};
enum {
DROP_ANIM_UPPER_HALF,
DROP_ANIM_LOWER_HALF,
DROP_ANIM_REFLECTION,
DROP_ANIM_RIPPLE,
};
static const union AnimCmd sAnim_WaterDrop_UpperHalf[] =
{
ANIMCMD_FRAME(16, 8),
ANIMCMD_END,
};
static const union AnimCmd sAnim_WaterDrop_LowerHalf[] =
{
ANIMCMD_FRAME(24, 8),
ANIMCMD_END,
};
static const union AnimCmd sAnim_WaterDrop_Reflection[] =
{
ANIMCMD_FRAME(0, 8),
ANIMCMD_END,
};
static const union AnimCmd sAnim_WaterDrop_Ripple[] =
{
ANIMCMD_FRAME(48, 8),
ANIMCMD_END,
};
static const union AnimCmd *const sAnims_WaterDrop[] =
{
[DROP_ANIM_UPPER_HALF] = sAnim_WaterDrop_UpperHalf,
[DROP_ANIM_LOWER_HALF] = sAnim_WaterDrop_LowerHalf,
[DROP_ANIM_REFLECTION] = sAnim_WaterDrop_Reflection,
[DROP_ANIM_RIPPLE] = sAnim_WaterDrop_Ripple,
};
static const struct SpriteTemplate sSpriteTemplate_WaterDrop =
{
.tileTag = GFXTAG_DROPS_LOGO,
.paletteTag = PALTAG_DROPS,
.oam = &sOamData_WaterDrop,
.anims = sAnims_WaterDrop,
.images = NULL,
.affineAnims = gDummySpriteAffineAnimTable,
.callback = SpriteCB_WaterDrop,
};
static const union AnimCmd sAnim_PlayerBicycle_Fast[] =
{
ANIMCMD_FRAME(0, 4),
ANIMCMD_FRAME(64, 4),
ANIMCMD_FRAME(128, 4),
ANIMCMD_FRAME(192, 4),
ANIMCMD_JUMP(0),
};
static const union AnimCmd sAnim_PlayerBicycle_Slow[] =
{
ANIMCMD_FRAME(0, 8),
ANIMCMD_FRAME(64, 8),
ANIMCMD_FRAME(128, 8),
ANIMCMD_FRAME(192, 8),
ANIMCMD_JUMP(0),
};
// The below two animations appear to be copied from the Credits version
// of the player graphic, where additional frames are present to show
// the player turning around to look at their rival.
// They go unused here, and if they were used they'd overflow beyond
// the player graphics data.
// The above sAnim_PlayerBicycle_Slow, while valid, is likewise unused
static const union AnimCmd sAnim_PlayerBicycle_LookBack[] =
{
ANIMCMD_FRAME(256, 4),
ANIMCMD_FRAME(320, 4),
ANIMCMD_FRAME(384, 4),
ANIMCMD_END,
};
static const union AnimCmd sAnim_PlayerBicycle_LookForward[] =
{
ANIMCMD_FRAME(384, 16),
ANIMCMD_FRAME(320, 16),
ANIMCMD_FRAME(256, 16),
ANIMCMD_END,
};
static const union AnimCmd *const sAnims_PlayerBicycle[] =
{
sAnim_PlayerBicycle_Fast,
sAnim_PlayerBicycle_Slow,
sAnim_PlayerBicycle_LookBack,
sAnim_PlayerBicycle_LookForward,
};
static const struct OamData sOamData_GameFreakLetter =
{
.y = DISPLAY_HEIGHT,
.affineMode = ST_OAM_AFFINE_DOUBLE,
.objMode = ST_OAM_OBJ_NORMAL,
.mosaic = FALSE,
.bpp = ST_OAM_4BPP,
.shape = SPRITE_SHAPE(16x16),
.x = 0,
.matrixNum = 0,
.size = SPRITE_SIZE(16x16),
.tileNum = 0,
.priority = 0,
.paletteNum = 0,
.affineParam = 0,
};
static const struct OamData sOamData_PresentsLetter =
{
.y = DISPLAY_HEIGHT,
.affineMode = ST_OAM_AFFINE_OFF,
.objMode = ST_OAM_OBJ_NORMAL,
.mosaic = FALSE,
.bpp = ST_OAM_4BPP,
.shape = SPRITE_SHAPE(8x8),
.x = 0,
.matrixNum = 0,
.size = SPRITE_SIZE(8x8),
.tileNum = 0,
.priority = 0,
.paletteNum = 0,
.affineParam = 0,
};
static const struct OamData sOamData_GameFreakLogo =
{
.y = DISPLAY_HEIGHT,
.affineMode = ST_OAM_AFFINE_DOUBLE,
.objMode = ST_OAM_OBJ_BLEND,
.mosaic = FALSE,
.bpp = ST_OAM_4BPP,
.shape = SPRITE_SHAPE(32x64),
.x = 0,
.matrixNum = 0,
.size = SPRITE_SIZE(32x64),
.tileNum = 0,
.priority = 0,
.paletteNum = 0,
.affineParam = 0,
};
static const union AnimCmd sAnim_GameFreakLetter_G[] =
{
ANIMCMD_FRAME(80, 8),
ANIMCMD_END,
};
static const union AnimCmd sAnim_GameFreakLetter_A[] =
{
ANIMCMD_FRAME(84, 8),
ANIMCMD_END,
};
static const union AnimCmd sAnim_GameFreakLetter_M[] =
{
ANIMCMD_FRAME(88, 8),
ANIMCMD_END,
};
static const union AnimCmd sAnim_GameFreakLetter_E[] =
{
ANIMCMD_FRAME(92, 8),
ANIMCMD_END,
};
static const union AnimCmd sAnim_GameFreakLetter_F[] =
{
ANIMCMD_FRAME(96, 8),
ANIMCMD_END,
};
static const union AnimCmd sAnim_GameFreakLetter_R[] =
{
ANIMCMD_FRAME(100, 8),
ANIMCMD_END,
};
static const union AnimCmd sAnim_GameFreakLetter_K[] =
{
ANIMCMD_FRAME(104, 8),
ANIMCMD_END,
};
static const union AnimCmd sAnim_PresentsLetter_P[] =
{
ANIMCMD_FRAME(112, 8),
ANIMCMD_END,
};
static const union AnimCmd sAnim_PresentsLetter_R[] =
{
ANIMCMD_FRAME(113, 8),
ANIMCMD_END,
};
static const union AnimCmd sAnim_PresentsLetter_E[] =
{
ANIMCMD_FRAME(114, 8),
ANIMCMD_END,
};
static const union AnimCmd sAnim_PresentsLetter_S[] =
{
ANIMCMD_FRAME(115, 8),
ANIMCMD_END,
};
static const union AnimCmd sAnim_PresentsLetter_N[] =
{
ANIMCMD_FRAME(116, 8),
ANIMCMD_END,
};
static const union AnimCmd sAnim_PresentsLetter_T[] =
{
ANIMCMD_FRAME(117, 8),
ANIMCMD_END,
};
static const union AnimCmd sAnim_GameFreakLogo[] =
{
ANIMCMD_FRAME(128, 8),
ANIMCMD_END,
};
enum {
GAMEFREAK_G,
GAMEFREAK_A,
GAMEFREAK_M,
GAMEFREAK_E,
GAMEFREAK_F,
GAMEFREAK_R,
GAMEFREAK_K,
};
enum {
PRESENTS_P,
PRESENTS_R,
PRESENTS_E,
PRESENTS_S,
PRESENTS_N,
PRESENTS_T,
};
static const union AnimCmd *const sAnims_GameFreakLetter[] =
{
[GAMEFREAK_G] = sAnim_GameFreakLetter_G,
[GAMEFREAK_A] = sAnim_GameFreakLetter_A,
[GAMEFREAK_M] = sAnim_GameFreakLetter_M,
[GAMEFREAK_E] = sAnim_GameFreakLetter_E,
[GAMEFREAK_F] = sAnim_GameFreakLetter_F,
[GAMEFREAK_R] = sAnim_GameFreakLetter_R,
[GAMEFREAK_K] = sAnim_GameFreakLetter_K,
};
static const union AnimCmd *const sAnims_PresentsLetter[] =
{
[PRESENTS_P] = sAnim_PresentsLetter_P,
[PRESENTS_R] = sAnim_PresentsLetter_R,
[PRESENTS_E] = sAnim_PresentsLetter_E,
[PRESENTS_S] = sAnim_PresentsLetter_S,
[PRESENTS_N] = sAnim_PresentsLetter_N,
[PRESENTS_T] = sAnim_PresentsLetter_T,
};
static const union AnimCmd *const sAnims_GameFreakLogo[] =
{
sAnim_GameFreakLogo,
};
#define NUM_GF_LETTERS 9 // Letters in "Game Freak"
static const s16 sGameFreakLetterData[NUM_GF_LETTERS][2] =
{
// Letter, x offset
{GAMEFREAK_G, -72},
{GAMEFREAK_A, -56},
{GAMEFREAK_M, -40},
{GAMEFREAK_E, -24},
{GAMEFREAK_F, 8},
{GAMEFREAK_R, 24},
{GAMEFREAK_E, 40},
{GAMEFREAK_A, 56},
{GAMEFREAK_K, 72},
};
static const s16 sPresentsLetterData[][2] =
{
// Letter, x offset
{PRESENTS_P, -28},
{PRESENTS_R, -20},
{PRESENTS_E, -12},
{PRESENTS_S, -4},
{PRESENTS_E, 4},
{PRESENTS_N, 12},
{PRESENTS_T, 20},
{PRESENTS_S, 28},
};
static const union AffineAnimCmd sAffineAnim_GameFreak_Small[] =
{
AFFINEANIMCMD_FRAME(128, 128, 0, 0),
AFFINEANIMCMD_END,
};
static const union AffineAnimCmd sAffineAnim_GameFreak_GrowAndShrink[] =
{
AFFINEANIMCMD_FRAME(128, 128, 0, 0),
AFFINEANIMCMD_FRAME(16, 16, 0, 16),
AFFINEANIMCMD_FRAME(-16, -16, 0, 8),
AFFINEANIMCMD_END,
};
static const union AffineAnimCmd sAffineAnim_GameFreak_GrowBig[] =
{
AFFINEANIMCMD_FRAME(256, 256, 0, 0),
AFFINEANIMCMD_FRAME(8, 8, 0, 48),
AFFINEANIMCMD_END,
};
static const union AffineAnimCmd sAffineAnim_GameFreak_GrowMedium[] =
{
AFFINEANIMCMD_FRAME(256, 256, 0, 0),
AFFINEANIMCMD_FRAME(2, 2, 0, 48),
AFFINEANIMCMD_END,
};
static const union AffineAnimCmd *const sAffineAnims_GameFreak[] =
{
sAffineAnim_GameFreak_Small, // Initialize letters while still invisible
sAffineAnim_GameFreak_GrowAndShrink, // For letters appearing. Logo does this too, but while it's invisible
sAffineAnim_GameFreak_GrowBig, // For letters disappearing
sAffineAnim_GameFreak_GrowMedium, // For logo disappearing
};
static const u16 sGameFreakLettersMoveSpeed[NUM_GF_LETTERS] =
{
256, // G
192, // A
128, // M
64, // E
0, // F
64, // R
128, // E
192, // A
256 // K
};
static const struct SpriteTemplate sSpriteTemplate_GameFreakLetter =
{
.tileTag = GFXTAG_DROPS_LOGO,
.paletteTag = PALTAG_LOGO,
.oam = &sOamData_GameFreakLetter,
.anims = sAnims_GameFreakLetter,
.images = NULL,
.affineAnims = sAffineAnims_GameFreak,
.callback = SpriteCB_LogoLetter,
};
// Unused
static const struct SpriteTemplate sSpriteTemplate_PresentsLetter =
{
.tileTag = GFXTAG_DROPS_LOGO,
.paletteTag = PALTAG_LOGO,
.oam = &sOamData_PresentsLetter,
.anims = sAnims_PresentsLetter,
.images = NULL,
.affineAnims = gDummySpriteAffineAnimTable,
.callback = SpriteCB_LogoLetter,
};
static const struct SpriteTemplate sSpriteTemplate_GameFreakLogo =
{
.tileTag = GFXTAG_DROPS_LOGO,
.paletteTag = PALTAG_LOGO,
.oam = &sOamData_GameFreakLogo,
.anims = sAnims_GameFreakLogo,
.images = NULL,
.affineAnims = sAffineAnims_GameFreak,
.callback = SpriteCB_GameFreakLogo,
};
static const u8 sGameFreakLetterStartDelays[NUM_GF_LETTERS] =
{
0, // G
23, // A
23, // M
49, // E
62, // F
36, // R
36, // E
10, // A
10 // K
};
static const struct OamData sOamData_FlygonSilhouette =
{
.y = DISPLAY_HEIGHT,
.affineMode = ST_OAM_AFFINE_OFF,
.objMode = ST_OAM_OBJ_NORMAL,
.mosaic = FALSE,
.bpp = ST_OAM_4BPP,
.shape = SPRITE_SHAPE(64x32),
.x = 0,
.matrixNum = 0,
.size = SPRITE_SIZE(64x32),
.tileNum = 0,
.priority = 0,
.paletteNum = 0,
.affineParam = 0,
};
static const union AnimCmd sAnim_FlygonSilhouette[] =
{
ANIMCMD_FRAME(0, 10),
ANIMCMD_JUMP(0),
};
static const union AnimCmd *const sAnims_FlygonSilhouette[] =
{
sAnim_FlygonSilhouette,
};
static const struct SpriteTemplate sSpriteTemplate_FlygonSilhouette =
{
.tileTag = TAG_FLYGON_SILHOUETTE,
.paletteTag = TAG_FLYGON_SILHOUETTE,
.oam = &sOamData_FlygonSilhouette,
.anims = sAnims_FlygonSilhouette,
.images = NULL,
.affineAnims = gDummySpriteAffineAnimTable,
.callback = SpriteCB_FlygonSilhouette,
};
static const struct CompressedSpriteSheet sSpriteSheet_WaterDropsAndLogo[] =
{
{sIntroDropsLogo_Gfx, 0x1400, GFXTAG_DROPS_LOGO},
{},
};
static const struct CompressedSpriteSheet sSpriteSheet_FlygonSilhouette[] =
{
{gIntroFlygonSilhouette_Gfx, 0x400, TAG_FLYGON_SILHOUETTE},
{},
};
static const struct SpritePalette sSpritePalettes_Intro1[] =
{
{sIntroDrops_Pal, PALTAG_DROPS},
{sIntroLogo_Pal, PALTAG_LOGO},
{sIntroFlygonSilhouette_Pal, TAG_FLYGON_SILHOUETTE},
{},
};
static const struct OamData sOamData_RayquazaOrb =
{
.y = DISPLAY_HEIGHT,
.affineMode = ST_OAM_AFFINE_OFF,
.objMode = ST_OAM_OBJ_NORMAL,
.mosaic = FALSE,
.bpp = ST_OAM_4BPP,
.shape = SPRITE_SHAPE(64x64),
.x = 0,
.matrixNum = 0,
.size = SPRITE_SIZE(64x64),
.tileNum = 0,
.priority = 0,
.paletteNum = 0,