forked from pret/pokeemerald
-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathtv.c
6826 lines (6366 loc) · 252 KB
/
tv.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 "rtc.h"
#include "overworld.h"
#include "random.h"
#include "event_data.h"
#include "fieldmap.h"
#include "field_camera.h"
#include "field_specials.h"
#include "fldeff.h"
#include "strings.h"
#include "string_util.h"
#include "international_string_util.h"
#include "pokemon_storage_system.h"
#include "field_message_box.h"
#include "easy_chat.h"
#include "battle.h"
#include "battle_tower.h"
#include "contest.h"
#include "item.h"
#include "link.h"
#include "main.h"
#include "event_scripts.h"
#include "shop.h"
#include "lilycove_lady.h"
#include "pokedex.h"
#include "event_object_movement.h"
#include "text.h"
#include "script_menu.h"
#include "naming_screen.h"
#include "malloc.h"
#include "region_map.h"
#include "decoration.h"
#include "secret_base.h"
#include "tv.h"
#include "pokeball.h"
#include "data.h"
#include "constants/battle_frontier.h"
#include "constants/contest.h"
#include "constants/decorations.h"
#include "constants/event_objects.h"
#include "constants/items.h"
#include "constants/layouts.h"
#include "constants/lilycove_lady.h"
#include "constants/metatile_behaviors.h"
#include "constants/metatile_labels.h"
#include "constants/moves.h"
#include "constants/region_map_sections.h"
#define LAST_TVSHOW_IDX (TV_SHOWS_COUNT - 1)
#define rbernoulli(num, den) BernoulliTrial(0xFFFF * (num) / (den))
enum {
TVGROUP_NONE,
TVGROUP_UNUSED,
TVGROUP_NORMAL,
TVGROUP_RECORD_MIX,
TVGROUP_OUTBREAK,
};
enum {
SLOT_MACHINE,
ROULETTE,
};
COMMON_DATA s8 sCurTVShowSlot = 0;
COMMON_DATA u16 sTV_SecretBaseVisitMovesTemp[8] = {0};
COMMON_DATA u8 sTV_DecorationsBuffer[DECOR_MAX_SECRET_BASE] = {0};
COMMON_DATA struct {
u8 level;
u16 species;
u16 move;
} sTV_SecretBaseVisitMonsTemp[10] = {0};
static u8 sTVShowMixingNumPlayers;
static u8 sTVShowNewsMixingNumPlayers;
static s8 sTVShowMixingCurSlot;
static EWRAM_DATA u16 sPokemonAnglerSpecies = 0;
static EWRAM_DATA u16 sPokemonAnglerAttemptCounters = 0;
static EWRAM_DATA u16 sFindThatGamerCoinsSpent = 0;
static EWRAM_DATA u8 sFindThatGamerWhichGame = SLOT_MACHINE;
static EWRAM_DATA ALIGNED(4) u8 sRecordMixingPartnersWithoutShowsToShare = 0;
static EWRAM_DATA ALIGNED(4) u8 sTVShowState = 0;
static EWRAM_DATA u8 sTVSecretBaseSecretsRandomValues[3] = {};
static void ClearPokeNews(void);
static u8 GetTVGroupByShowId(u8);
static u8 FindFirstActiveTVShowThatIsNotAMassOutbreak(void);
static void SetTVMetatilesOnMap(int, int, u16);
static u8 FindAnyPokeNewsOnTheAir(void);
static void TakeGabbyAndTyOffTheAir(void);
static bool8 BernoulliTrial(u16 ratio);
static s8 FindFirstEmptyRecordMixTVShowSlot(TVShow *);
static bool8 IsRecordMixShowAlreadySpawned(u8, bool8);
static void StorePlayerIdInRecordMixShow(TVShow *);
static void DeleteTVShowInArrayByIdx(TVShow *, u8);
static s8 FindFirstEmptyNormalTVShowSlot(TVShow *);
static void TryReplaceOldTVShowOfKind(u8);
static void InterviewBefore_BravoTrainerPkmnProfile(void);
static void InterviewBefore_NameRater(void);
static u16 GetRandomDifferentSpeciesSeenByPlayer(u16);
static void Script_FindFirstEmptyNormalTVShowSlot(void);
static void CompactTVShowArray(TVShow *);
static s8 GetFirstEmptyPokeNewsSlot(PokeNews *);
static bool8 IsAddingPokeNewsDisallowed(u8);
static void ClearPokeNewsBySlot(u8);
static void TranslateRubyShows(TVShow *);
static void TranslateJapaneseEmeraldShows(TVShow *);
static void SetMixedTVShows(TVShow *, TVShow *, TVShow *, TVShow *);
static void DeleteExcessMixedShows(void);
static void DeactivateShowsWithUnseenSpecies(void);
static void DeactivateGameCompleteShowsIfNotUnlocked(void);
static s8 FindInactiveShowInArray(TVShow *);
static bool8 TryMixTVShow(TVShow *[], TVShow *[], u8);
static bool8 TryMixNormalTVShow(TVShow *, TVShow *, u8);
static bool8 TryMixRecordMixTVShow(TVShow *, TVShow *, u8);
static bool8 TryMixOutbreakTVShow(TVShow *, TVShow *, u8);
static void DeactivateShow(u8 showIdx);
static void DeactivateShowIfNotSeenSpecies(u16, u8);
static void SetMixedPokeNews(PokeNews *, PokeNews *, PokeNews *, PokeNews *);
static void ClearInvalidPokeNews(void);
static void ClearPokeNewsIfGameNotComplete(void);
static s8 GetPokeNewsSlotIfActive(PokeNews *, u8);
static void InitTryMixPokeNewsShow(PokeNews *[], PokeNews *[]);
static bool8 TryMixPokeNewsShow(PokeNews *, PokeNews *, s8);
static void TVShowDone(void);
static void InterviewAfter_FanClubLetter(void);
static void InterviewAfter_RecentHappenings(void);
static void InterviewAfter_PkmnFanClubOpinions(void);
static void InterviewAfter_Dummy(void);
static void InterviewAfter_BravoTrainerPokemonProfile(void);
static void InterviewAfter_BravoTrainerBattleTowerProfile(void);
static void InterviewAfter_ContestLiveUpdates(void);
static void InitWorldOfMastersShowAttempt(void);
static void TryPutPokemonTodayFailedOnTheAir(void);
static void TryStartRandomMassOutbreak(void);
static void TryPutRandomPokeNewsOnAir(void);
static void SortPurchasesByQuantity(void);
static void UpdateMassOutbreakTimeLeft(u16);
static void TryEndMassOutbreak(u16);
static void UpdatePokeNewsCountdown(u16);
static void ResolveWorldOfMastersShow(u16);
static void ResolveNumberOneShow(u16);
static void TryPutFishingAdviceOnAir(void);
static u8 MonDataIdxToRibbon(u8);
static void TryPutNumberOneOnAir(u8);
static bool8 ShouldApplyPokeNewsEffect(u8);
static void TryPutWorldOfMastersOnAir(void);
static void InterviewBefore_FanClubLetter(void);
static void InterviewBefore_RecentHappenings(void);
static void InterviewBefore_PkmnFanClubOpinions(void);
static void InterviewBefore_Dummy(void);
static void InterviewBefore_BravoTrainerBTProfile(void);
static void InterviewBefore_ContestLiveUpdates(void);
static void InterviewBefore_3CheersForPokeblocks(void);
static void InterviewBefore_FanClubSpecial(void);
static void ChangeBoxPokemonNickname_CB(void);
static void DoTVShowPokemonFanClubLetter(void);
static void DoTVShowRecentHappenings(void);
static void DoTVShowPokemonFanClubOpinions(void);
static void DoTVShowDummiedOut(void);
static void DoTVShowPokemonNewsMassOutbreak(void);
static void DoTVShowBravoTrainerPokemonProfile(void);
static void DoTVShowBravoTrainerBattleTower(void);
static void DoTVShowPokemonTodaySuccessfulCapture(void);
static void DoTVShowTodaysSmartShopper(void);
static void DoTVShowTheNameRaterShow(void);
static void DoTVShowPokemonContestLiveUpdates(void);
static void DoTVShowPokemonBattleUpdate(void);
static void DoTVShow3CheersForPokeblocks(void);
static void DoTVShowPokemonTodayFailedCapture(void);
static void DoTVShowPokemonAngler(void);
static void DoTVShowTheWorldOfMasters(void);
static void DoTVShowTodaysRivalTrainer(void);
static void DoTVShowDewfordTrendWatcherNetwork(void);
static void DoTVShowHoennTreasureInvestigators(void);
static void DoTVShowFindThatGamer(void);
static void DoTVShowBreakingNewsTV(void);
static void DoTVShowSecretBaseVisit(void);
static void DoTVShowPokemonLotteryWinnerFlashReport(void);
static void DoTVShowThePokemonBattleSeminar(void);
static void DoTVShowTrainerFanClubSpecial(void);
static void DoTVShowTrainerFanClub(void);
static void DoTVShowSpotTheCuties(void);
static void DoTVShowPokemonNewsBattleFrontier(void);
static void DoTVShowWhatsNo1InHoennToday(void);
static void DoTVShowSecretBaseSecrets(void);
static void DoTVShowSafariFanClub(void);
static void DoTVShowLilycoveContestLady(void);
static const struct {
u16 species;
u16 moves[MAX_MON_MOVES];
u8 level;
u8 location;
} sPokeOutbreakSpeciesList[] = {
{
.species = SPECIES_SEEDOT,
.moves = {MOVE_BIDE, MOVE_HARDEN, MOVE_LEECH_SEED},
.level = 3,
.location = MAP_NUM(ROUTE102)
},
{
.species = SPECIES_NUZLEAF,
.moves = {MOVE_HARDEN, MOVE_GROWTH, MOVE_NATURE_POWER, MOVE_LEECH_SEED},
.level = 15,
.location = MAP_NUM(ROUTE114),
},
{
.species = SPECIES_SEEDOT,
.moves = {MOVE_HARDEN, MOVE_GROWTH, MOVE_NATURE_POWER, MOVE_LEECH_SEED},
.level = 13,
.location = MAP_NUM(ROUTE117),
},
{
.species = SPECIES_SEEDOT,
.moves = {MOVE_GIGA_DRAIN, MOVE_FRUSTRATION, MOVE_SOLAR_BEAM, MOVE_LEECH_SEED},
.level = 25,
.location = MAP_NUM(ROUTE120),
},
{
.species = SPECIES_SKITTY,
.moves = {MOVE_GROWL, MOVE_TACKLE, MOVE_TAIL_WHIP, MOVE_ATTRACT},
.level = 8,
.location = MAP_NUM(ROUTE116),
}
};
static const u16 sGoldSymbolFlags[NUM_FRONTIER_FACILITIES] = {
[FRONTIER_FACILITY_TOWER] = FLAG_SYS_TOWER_GOLD,
[FRONTIER_FACILITY_DOME] = FLAG_SYS_DOME_GOLD,
[FRONTIER_FACILITY_PALACE] = FLAG_SYS_PALACE_GOLD,
[FRONTIER_FACILITY_ARENA] = FLAG_SYS_ARENA_GOLD,
[FRONTIER_FACILITY_FACTORY] = FLAG_SYS_FACTORY_GOLD,
[FRONTIER_FACILITY_PIKE] = FLAG_SYS_PIKE_GOLD,
[FRONTIER_FACILITY_PYRAMID] = FLAG_SYS_PYRAMID_GOLD
};
static const u16 sSilverSymbolFlags[NUM_FRONTIER_FACILITIES] = {
[FRONTIER_FACILITY_TOWER] = FLAG_SYS_TOWER_SILVER,
[FRONTIER_FACILITY_DOME] = FLAG_SYS_DOME_SILVER,
[FRONTIER_FACILITY_PALACE] = FLAG_SYS_PALACE_SILVER,
[FRONTIER_FACILITY_ARENA] = FLAG_SYS_ARENA_SILVER,
[FRONTIER_FACILITY_FACTORY] = FLAG_SYS_FACTORY_SILVER,
[FRONTIER_FACILITY_PIKE] = FLAG_SYS_PIKE_SILVER,
[FRONTIER_FACILITY_PYRAMID] = FLAG_SYS_PYRAMID_SILVER
};
static const u16 sNumberOneVarsAndThresholds[][2] = {
{VAR_DAILY_SLOTS, 100},
{VAR_DAILY_ROULETTE, 50},
{VAR_DAILY_WILDS, 100},
{VAR_DAILY_BLENDER, 20},
{VAR_DAILY_PLANTED_BERRIES, 20},
{VAR_DAILY_PICKED_BERRIES, 20},
{VAR_DAILY_BP, 30}
};
static const u8 *const sPokeNewsTextGroup_Upcoming[NUM_POKENEWS_TYPES + 1] = {
[POKENEWS_NONE] = NULL,
[POKENEWS_SLATEPORT] = gPokeNewsTextSlateport_Upcoming,
[POKENEWS_GAME_CORNER] = gPokeNewsTextGameCorner_Upcoming,
[POKENEWS_LILYCOVE] = gPokeNewsTextLilycove_Upcoming,
[POKENEWS_BLENDMASTER] = gPokeNewsTextBlendMaster_Upcoming
};
static const u8 *const sPokeNewsTextGroup_Ongoing[NUM_POKENEWS_TYPES + 1] = {
[POKENEWS_NONE] = NULL,
[POKENEWS_SLATEPORT] = gPokeNewsTextSlateport_Ongoing,
[POKENEWS_GAME_CORNER] = gPokeNewsTextGameCorner_Ongoing,
[POKENEWS_LILYCOVE] = gPokeNewsTextLilycove_Ongoing,
[POKENEWS_BLENDMASTER] = gPokeNewsTextBlendMaster_Ongoing
};
static const u8 *const sPokeNewsTextGroup_Ending[NUM_POKENEWS_TYPES + 1] = {
[POKENEWS_NONE] = NULL,
[POKENEWS_SLATEPORT] = gPokeNewsTextSlateport_Ending,
[POKENEWS_GAME_CORNER] = gPokeNewsTextGameCorner_Ending,
[POKENEWS_LILYCOVE] = gPokeNewsTextLilycove_Ending,
[POKENEWS_BLENDMASTER] = gPokeNewsTextBlendMaster_Ending
};
u8 *const gTVStringVarPtrs[] = {
gStringVar1,
gStringVar2,
gStringVar3
};
static const u8 *const sTVFanClubTextGroup[] = {
gTVFanClubText00,
gTVFanClubText01,
gTVFanClubText02,
gTVFanClubText03,
gTVFanClubText04,
gTVFanClubText05,
gTVFanClubText06,
gTVFanClubText07
};
static const u8 *const sTVRecentHappeninssTextGroup[] = {
gTVRecentHappeningsText00,
gTVRecentHappeningsText01,
gTVRecentHappeningsText02,
gTVRecentHappeningsText03,
gTVRecentHappeningsText04,
gTVRecentHappeningsText05
};
static const u8 *const sTVFanClubOpinionsTextGroup[] = {
gTVFanClubOpinionsText00,
gTVFanClubOpinionsText01,
gTVFanClubOpinionsText02,
gTVFanClubOpinionsText03,
gTVFanClubOpinionsText04
};
static const u8 *const sTVMassOutbreakTextGroup[] = {
gTVMassOutbreakText00
};
static const u8 *const sTVPokemonTodaySuccessfulTextGroup[] = {
gTVPokemonTodaySuccessfulText00,
gTVPokemonTodaySuccessfulText01,
gTVPokemonTodaySuccessfulText02,
gTVPokemonTodaySuccessfulText03,
gTVPokemonTodaySuccessfulText04,
gTVPokemonTodaySuccessfulText05,
gTVPokemonTodaySuccessfulText06,
gTVPokemonTodaySuccessfulText07,
gTVPokemonTodaySuccessfulText08,
gTVPokemonTodaySuccessfulText09,
gTVPokemonTodaySuccessfulText10,
gTVPokemonTodaySuccessfulText11
};
static const u8 *const sTVTodaysSmartShopperTextGroup[] = {
[SMARTSHOPPER_STATE_INTRO] = SmartShopper_Text_Intro,
[SMARTSHOPPER_STATE_CLERK_NORMAL] = SmartShopper_Text_ClerkNormal,
[SMARTSHOPPER_STATE_RAND_COMMENT_1] = SmartShopper_Text_RandomComment1,
[SMARTSHOPPER_STATE_RAND_COMMENT_2] = SmartShopper_Text_RandomComment2,
[SMARTSHOPPER_STATE_RAND_COMMENT_3] = SmartShopper_Text_RandomComment3,
[SMARTSHOPPER_STATE_RAND_COMMENT_4] = SmartShopper_Text_RandomComment4,
[SMARTSHOPPER_STATE_SECOND_ITEM] = SmartShopper_Text_SecondItem,
[SMARTSHOPPER_STATE_THIRD_ITEM] = SmartShopper_Text_ThirdItem,
[SMARTSHOPPER_STATE_DURING_SALE] = SmartShopper_Text_DuringSale,
[SMARTSHOPPER_STATE_OUTRO_NORMAL] = SmartShopper_Text_OutroNormal,
[SMARTSHOPPER_STATE_IS_VIP] = SmartShopper_Text_IsVIP,
[SMARTSHOPPER_STATE_CLERK_MAX] = SmartShopper_Text_ClerkMax,
[SMARTSHOPPER_STATE_OUTRO_MAX] = SmartShopper_Text_OutroMax
};
static const u8 *const sTVBravoTrainerTextGroup[] = {
gTVBravoTrainerText00,
gTVBravoTrainerText01,
gTVBravoTrainerText02,
gTVBravoTrainerText03,
gTVBravoTrainerText04,
gTVBravoTrainerText05,
gTVBravoTrainerText06,
gTVBravoTrainerText07,
gTVBravoTrainerText08
};
static const u8 *const sTV3CheersForPokeblocksTextGroup[] = {
gTV3CheersForPokeblocksText00,
gTV3CheersForPokeblocksText01,
gTV3CheersForPokeblocksText02,
gTV3CheersForPokeblocksText03,
gTV3CheersForPokeblocksText04,
gTV3CheersForPokeblocksText05
};
static const u8 *const sTVBravoTrainerBattleTowerTextGroup[] = {
[BRAVOTOWER_STATE_INTRO] = BravoTrainerBattleTower_Text_Intro,
[BRAVOTOWER_STATE_NEW_RECORD] = BravoTrainerBattleTower_Text_NewRecord,
[BRAVOTOWER_STATE_LOST] = BravoTrainerBattleTower_Text_Lost,
[BRAVOTOWER_STATE_WON] = BravoTrainerBattleTower_Text_Won,
[BRAVOTOWER_STATE_LOST_FINAL] = BravoTrainerBattleTower_Text_LostFinal,
[BRAVOTOWER_STATE_SATISFIED] = BravoTrainerBattleTower_Text_Satisfied,
[BRAVOTOWER_STATE_UNSATISFIED] = BravoTrainerBattleTower_Text_Unsatisfied,
[BRAVOTOWER_STATE_UNUSED_1] = BravoTrainerBattleTower_Text_None1,
[BRAVOTOWER_STATE_UNUSED_2] = BravoTrainerBattleTower_Text_None2,
[BRAVOTOWER_STATE_UNUSED_3] = BravoTrainerBattleTower_Text_None3,
[BRAVOTOWER_STATE_UNUSED_4] = BravoTrainerBattleTower_Text_None4,
[BRAVOTOWER_STATE_RESPONSE] = BravoTrainerBattleTower_Text_Response,
[BRAVOTOWER_STATE_RESPONSE_SATISFIED] = BravoTrainerBattleTower_Text_ResponseSatisfied,
[BRAVOTOWER_STATE_RESPONSE_UNSATISFIED] = BravoTrainerBattleTower_Text_ResponseUnsatisfied,
[BRAVOTOWER_STATE_OUTRO] = BravoTrainerBattleTower_Text_Outro
};
static const u8 *const sTVContestLiveUpdatesTextGroup[] = {
[CONTESTLIVE_STATE_INTRO] = ContestLiveUpdates_Text_Intro,
[CONTESTLIVE_STATE_WON_BOTH_ROUNDS] = ContestLiveUpdates_Text_WonBothRounds,
[CONTESTLIVE_STATE_BETTER_ROUND2] = ContestLiveUpdates_Text_BetterRound2,
[CONTESTLIVE_STATE_EQUAL_ROUNDS] = ContestLiveUpdates_Text_EqualRounds,
[CONTESTLIVE_STATE_BETTER_ROUND1] = ContestLiveUpdates_Text_BetterRound1,
[CONTESTLIVE_STATE_GOT_NERVOUS] = ContestLiveUpdates_Text_GotNervous,
[CONTESTLIVE_STATE_STARTLED_OTHER] = ContestLiveUpdates_Text_StartledFoes,
[CONTESTLIVE_STATE_USED_COMBO] = ContestLiveUpdates_Text_UsedCombo,
[CONTESTLIVE_STATE_EXCITING_APPEAL] = ContestLiveUpdates_Text_ExcitingAppeal,
[CONTESTLIVE_STATE_COOL] = ContestLiveUpdates_Text_WasCool,
[CONTESTLIVE_STATE_BEAUTIFUL] = ContestLiveUpdates_Text_WasBeautiful,
[CONTESTLIVE_STATE_CUTE] = ContestLiveUpdates_Text_WasCute,
[CONTESTLIVE_STATE_SMART] = ContestLiveUpdates_Text_WasSmart,
[CONTESTLIVE_STATE_TOUGH] = ContestLiveUpdates_Text_WasTough,
[CONTESTLIVE_STATE_VERY_EXCITING_APPEAL] = ContestLiveUpdates_Text_VeryExcitingAppeal,
[CONTESTLIVE_STATE_VERY_COOL] = ContestLiveUpdates_Text_VeryCool,
[CONTESTLIVE_STATE_VERY_BEAUTIFUL] = ContestLiveUpdates_Text_VeryBeautiful,
[CONTESTLIVE_STATE_VERY_CUTE] = ContestLiveUpdates_Text_VeryCute,
[CONTESTLIVE_STATE_VERY_SMART] = ContestLiveUpdates_Text_VerySmart,
[CONTESTLIVE_STATE_VERY_TOUGH] = ContestLiveUpdates_Text_VeryTough,
[CONTESTLIVE_STATE_TOOK_BREAK] = ContestLiveUpdates_Text_TookBreak,
[CONTESTLIVE_STATE_GOT_STARTLED] = ContestLiveUpdates_Text_GotStartled,
[CONTESTLIVE_STATE_USED_MOVE] = ContestLiveUpdates_Text_MoveWonderful,
[CONTESTLIVE_STATE_TALK_ABOUT_LOSER] = ContestLiveUpdates_Text_TalkAboutAnotherMon,
[CONTESTLIVE_STATE_NO_APPEALS] = ContestLiveUpdates_Text_FailedToAppeal,
[CONTESTLIVE_STATE_LAST_BOTH] = ContestLiveUpdates_Text_LastInBothRounds,
[CONTESTLIVE_STATE_NOT_EXCITING_ENOUGH] = ContestLiveUpdates_Text_NotExcitingEnough,
[CONTESTLIVE_STATE_LOST_AFTER_ROUND1_WIN] = ContestLiveUpdates_Text_LostAfterWinningRound1,
[CONTESTLIVE_STATE_NO_EXCITING_APPEALS] = ContestLiveUpdates_Text_NeverExciting,
[CONTESTLIVE_STATE_LOST_SMALL_MARGIN] = ContestLiveUpdates_Text_LostBySmallMargin,
[CONTESTLIVE_STATE_REPEATED_APPEALS] = ContestLiveUpdates_Text_RepeatedAppeals,
[CONTESTLIVE_STATE_LOST] = ContestLiveUpdates_Text_ValiantEffortButLost,
[CONTESTLIVE_STATE_OUTRO] = ContestLiveUpdates_Text_Outro
};
static const u8 *const sTVPokemonBattleUpdateTextGroup[] = {
gTVPokemonBattleUpdateText00,
gTVPokemonBattleUpdateText01,
gTVPokemonBattleUpdateText02,
gTVPokemonBattleUpdateText03,
gTVPokemonBattleUpdateText04,
gTVPokemonBattleUpdateText05,
gTVPokemonBattleUpdateText06,
gTVPokemonBattleUpdateText07
};
static const u8 *const sTVTrainerFanClubSpecialTextGroup[] = {
gTVTrainerFanClubSpecialText00,
gTVTrainerFanClubSpecialText01,
gTVTrainerFanClubSpecialText02,
gTVTrainerFanClubSpecialText03,
gTVTrainerFanClubSpecialText04,
gTVTrainerFanClubSpecialText05
};
static const u8 *const sTVNameRaterTextGroup[] = {
gTVNameRaterText00,
gTVNameRaterText01,
gTVNameRaterText02,
gTVNameRaterText03,
gTVNameRaterText04,
gTVNameRaterText05,
gTVNameRaterText06,
gTVNameRaterText07,
gTVNameRaterText08,
gTVNameRaterText09,
gTVNameRaterText10,
gTVNameRaterText11,
gTVNameRaterText12,
gTVNameRaterText13,
gTVNameRaterText14,
gTVNameRaterText15,
gTVNameRaterText16,
gTVNameRaterText17,
gTVNameRaterText18
};
static const u8 *const sTVLilycoveContestLadyTextGroup[] = {
[CONTESTLADYLIVE_STATE_INTRO] = ContestLadyShow_Text_Intro,
[CONTESTLADYLIVE_STATE_WON] = ContestLadyShow_Text_Won,
[CONTESTLADYLIVE_STATE_LOST] = ContestLadyShow_Text_Lost,
[CONTESTLADYLIVE_STATE_LOST_BADLY] = ContestLadyShow_Text_LostBadly
};
static const u8 *const sTVPokemonTodayFailedTextGroup[] = {
gTVPokemonTodayFailedText00,
gTVPokemonTodayFailedText01,
gTVPokemonTodayFailedText02,
gTVPokemonTodayFailedText03,
gTVPokemonTodayFailedText04,
gTVPokemonTodayFailedText05,
gTVPokemonTodayFailedText06
};
static const u8 *const sTVPokemonAnglerTextGroup[] = {
gTVPokemonAnglerText00,
gTVPokemonAnglerText01
};
static const u8 *const sTVWorldOfMastersTextGroup[] = {
gTVWorldOfMastersText00,
gTVWorldOfMastersText01,
gTVWorldOfMastersText02
};
static const u8 *const sTVTodaysRivalTrainerTextGroup[] = {
gTVTodaysRivalTrainerText00,
gTVTodaysRivalTrainerText01,
gTVTodaysRivalTrainerText02,
gTVTodaysRivalTrainerText03,
gTVTodaysRivalTrainerText04,
gTVTodaysRivalTrainerText05,
gTVTodaysRivalTrainerText06,
gTVTodaysRivalTrainerText07,
gTVTodaysRivalTrainerText08,
gTVTodaysRivalTrainerText09,
gTVTodaysRivalTrainerText10
};
static const u8 *const sTVDewfordTrendWatcherNetworkTextGroup[] = {
[TRENDWATCHER_STATE_INTRO] = TrendWatcher_Text_Intro,
[TRENDWATCHER_STATE_TAUGHT_MALE] = TrendWatcher_Text_MaleTaughtMePhrase,
[TRENDWATCHER_STATE_TAUGHT_FEMALE] = TrendWatcher_Text_FemaleTaughtMePhrase,
[TRENDWATCHER_STATE_PHRASE_HOPELESS] = TrendWatcher_Text_PhraseWasHopeless,
[TRENDWATCHER_STATE_BIGGER_MALE] = TrendWatcher_Text_MaleTellMeBigger,
[TRENDWATCHER_STATE_BIGGER_FEMALE] = TrendWatcher_Text_FemaleTellMeBigger,
[TRENDWATCHER_STATE_OUTRO] = TrendWatcher_Text_Outro
};
static const u8 *const sTVHoennTreasureInvestisatorsTextGroup[] = {
gTVHoennTreasureInvestigatorsText00,
gTVHoennTreasureInvestigatorsText01,
gTVHoennTreasureInvestigatorsText02
};
static const u8 *const sTVFindThatGamerTextGroup[] = {
gTVFindThatGamerText00,
gTVFindThatGamerText01,
gTVFindThatGamerText02,
gTVFindThatGamerText03
};
static const u8 *const sTVBreakingNewsTextGroup[] = {
gTVBreakingNewsText00,
gTVBreakingNewsText01,
gTVBreakingNewsText02,
gTVBreakingNewsText03,
gTVBreakingNewsText04,
gTVBreakingNewsText05,
gTVBreakingNewsText06,
gTVBreakingNewsText07,
gTVBreakingNewsText08,
gTVBreakingNewsText09,
gTVBreakingNewsText10,
gTVBreakingNewsText11,
gTVBreakingNewsText12
};
static const u8 *const sTVSecretBaseVisitTextGroup[] = {
gTVSecretBaseVisitText00,
gTVSecretBaseVisitText01,
gTVSecretBaseVisitText02,
gTVSecretBaseVisitText03,
gTVSecretBaseVisitText04,
gTVSecretBaseVisitText05,
gTVSecretBaseVisitText06,
gTVSecretBaseVisitText07,
gTVSecretBaseVisitText08,
gTVSecretBaseVisitText09,
gTVSecretBaseVisitText10,
gTVSecretBaseVisitText11,
gTVSecretBaseVisitText12,
gTVSecretBaseVisitText13
};
static const u8 *const sTVPokemonLotteryWinnerFlashReportTextGroup[] = {
gTVPokemonLotteryWinnerFlashReportText00
};
static const u8 *const sTVThePokemonBattleSeminarTextGroup[] = {
gTVThePokemonBattleSeminarText00,
gTVThePokemonBattleSeminarText01,
gTVThePokemonBattleSeminarText02,
gTVThePokemonBattleSeminarText03,
gTVThePokemonBattleSeminarText04,
gTVThePokemonBattleSeminarText05,
gTVThePokemonBattleSeminarText06
};
static const u8 *const sTVTrainerFanClubTextGroup[] = {
gTVTrainerFanClubText00,
gTVTrainerFanClubText01,
gTVTrainerFanClubText02,
gTVTrainerFanClubText03,
gTVTrainerFanClubText04,
gTVTrainerFanClubText05,
gTVTrainerFanClubText06,
gTVTrainerFanClubText07,
gTVTrainerFanClubText08,
gTVTrainerFanClubText09,
gTVTrainerFanClubText10,
gTVTrainerFanClubText11
};
static const u8 *const sTVCutiesTextGroup[] = {
[SPOTCUTIES_STATE_INTRO] = TVSpotTheCuties_Text_Intro,
[SPOTCUTIES_STATE_RIBBONS_LOW] = TVSpotTheCuties_Text_RibbonsLow,
[SPOTCUTIES_STATE_RIBBONS_MID] = TVSpotTheCuties_Text_RibbonsMid,
[SPOTCUTIES_STATE_RIBBONS_HIGH] = TVSpotTheCuties_Text_RibbonsHigh,
[SPOTCUTIES_STATE_RIBBON_INTRO] = TVSpotTheCuties_Text_RibbonIntro,
[SPOTCUTIES_STATE_RIBBON_CHAMPION] = TVSpotTheCuties_Text_RibbonChampion,
[SPOTCUTIES_STATE_RIBBON_COOL] = TVSpotTheCuties_Text_RibbonCool,
[SPOTCUTIES_STATE_RIBBON_BEAUTY] = TVSpotTheCuties_Text_RibbonBeauty,
[SPOTCUTIES_STATE_RIBBON_CUTE] = TVSpotTheCuties_Text_RibbonCute,
[SPOTCUTIES_STATE_RIBBON_SMART] = TVSpotTheCuties_Text_RibbonSmart,
[SPOTCUTIES_STATE_RIBBON_TOUGH] = TVSpotTheCuties_Text_RibbonTough,
[SPOTCUTIES_STATE_RIBBON_WINNING] = TVSpotTheCuties_Text_RibbonWinning,
[SPOTCUTIES_STATE_RIBBON_VICTORY] = TVSpotTheCuties_Text_RibbonVictory,
[SPOTCUTIES_STATE_RIBBON_ARTIST] = TVSpotTheCuties_Text_RibbonArtist,
[SPOTCUTIES_STATE_RIBBON_EFFORT] = TVSpotTheCuties_Text_RibbonEffort,
[SPOTCUTIES_STATE_OUTRO] = TVSpotTheCuties_Text_Outro
};
static const u8 *const sTVPokemonNewsBattleFrontierTextGroup[] = {
gTVPokemonNewsBattleFrontierText00,
gTVPokemonNewsBattleFrontierText01,
gTVPokemonNewsBattleFrontierText02,
gTVPokemonNewsBattleFrontierText03,
gTVPokemonNewsBattleFrontierText04,
gTVPokemonNewsBattleFrontierText05,
gTVPokemonNewsBattleFrontierText06,
gTVPokemonNewsBattleFrontierText07,
gTVPokemonNewsBattleFrontierText08,
gTVPokemonNewsBattleFrontierText09,
gTVPokemonNewsBattleFrontierText10,
gTVPokemonNewsBattleFrontierText11,
gTVPokemonNewsBattleFrontierText12,
gTVPokemonNewsBattleFrontierText13,
gTVPokemonNewsBattleFrontierText14,
gTVPokemonNewsBattleFrontierText15,
gTVPokemonNewsBattleFrontierText16,
gTVPokemonNewsBattleFrontierText17,
gTVPokemonNewsBattleFrontierText18
};
static const u8 *const sTVWhatsNo1InHoennTodayTextGroup[] = {
gTVWhatsNo1InHoennTodayText00,
gTVWhatsNo1InHoennTodayText01,
gTVWhatsNo1InHoennTodayText02,
gTVWhatsNo1InHoennTodayText03,
gTVWhatsNo1InHoennTodayText04,
gTVWhatsNo1InHoennTodayText05,
gTVWhatsNo1InHoennTodayText06,
gTVWhatsNo1InHoennTodayText07,
gTVWhatsNo1InHoennTodayText08
};
static const u8 *const sTVSecretBaseSecretsTextGroup[SBSECRETS_NUM_STATES] =
{
[SBSECRETS_STATE_INTRO] = TVSecretBaseSecrets_Text_Intro,
[SBSECRETS_STATE_DO_NEXT1] = TVSecretBaseSecrets_Text_WhatWillPlayerDoNext1,
[SBSECRETS_STATE_DO_NEXT2] = TVSecretBaseSecrets_Text_WhatWillPlayerDoNext2,
[SBSECRETS_STATE_TOOK_X_STEPS] = TVSecretBaseSecrets_Text_TookXStepsBeforeLeaving,
[SBSECRETS_STATE_BASE_INTEREST_LOW] = TVSecretBaseSecrets_Text_BaseFailedToInterestPlayer,
[SBSECRETS_STATE_BASE_INTEREST_MED] = TVSecretBaseSecrets_Text_PlayerEnjoyedBase,
[SBSECRETS_STATE_BASE_INTEREST_HIGH] = TVSecretBaseSecrets_Text_PlayerHugeFanOfBase,
[SBSECRETS_STATE_OUTRO] = TVSecretBaseSecrets_Text_Outro,
[SBSECRETS_STATE_NOTHING_USED1] = TVSecretBaseSecrets_Text_StoppedMoving1,
[SBSECRETS_STATE_NOTHING_USED2] = TVSecretBaseSecrets_Text_StoppedMoving2,
[SBSECRETS_STATE_USED_CHAIR] = TVSecretBaseSecrets_Text_UsedChair,
[SBSECRETS_STATE_USED_BALLOON] = TVSecretBaseSecrets_Text_UsedBalloon,
[SBSECRETS_STATE_USED_TENT] = TVSecretBaseSecrets_Text_UsedTent,
[SBSECRETS_STATE_USED_PLANT] = TVSecretBaseSecrets_Text_UsedPlant,
[SBSECRETS_STATE_USED_GOLD_SHIELD] = TVSecretBaseSecrets_Text_UsedGoldShield,
[SBSECRETS_STATE_USED_SILVER_SHIELD] = TVSecretBaseSecrets_Text_UsedSilverShield,
[SBSECRETS_STATE_USED_GLASS_ORNAMENT] = TVSecretBaseSecrets_Text_UsedGlassOrnament,
[SBSECRETS_STATE_USED_TV] = TVSecretBaseSecrets_Text_UsedTV,
[SBSECRETS_STATE_USED_MUD_BALL] = TVSecretBaseSecrets_Text_UsedMudBall,
[SBSECRETS_STATE_USED_BAG] = TVSecretBaseSecrets_Text_UsedBag,
[SBSECRETS_STATE_USED_CUSHION] = TVSecretBaseSecrets_Text_UsedCushion,
[SBSECRETS_STATE_HIT_CUSHION] = TVSecretBaseSecrets_Text_HitCushion,
[SBSECRETS_STATE_HUGGED_CUSHION] = TVSecretBaseSecrets_Text_HuggedCushion,
[SBSECRETS_STATE_BATTLED_WON] = TVSecretBaseSecrets_Text_BattledWon,
[SBSECRETS_STATE_BATTLED_LOST] = TVSecretBaseSecrets_Text_BattledLost,
[SBSECRETS_STATE_DECLINED_BATTLE] = TVSecretBaseSecrets_Text_DeclinedBattle,
[SBSECRETS_STATE_USED_POSTER] = TVSecretBaseSecrets_Text_UsedPoster,
[SBSECRETS_STATE_USED_NOTE_MAT] = TVSecretBaseSecrets_Text_UsedNoteMat,
[SBSECRETS_STATE_BATTLED_DRAW] = TVSecretBaseSecrets_Text_BattledDraw,
[SBSECRETS_STATE_USED_SPIN_MAT] = TVSecretBaseSecrets_Text_UsedSpinMat,
[SBSECRETS_STATE_USED_SAND_ORNAMENT] = TVSecretBaseSecrets_Text_UsedSandOrnament,
[SBSECRETS_STATE_USED_DESK] = TVSecretBaseSecrets_Text_UsedDesk,
[SBSECRETS_STATE_USED_BRICK] = TVSecretBaseSecrets_Text_UsedBrick,
[SBSECRETS_STATE_USED_SOLID_BOARD] = TVSecretBaseSecrets_Text_UsedSolidBoard,
[SBSECRETS_STATE_USED_FENCE] = TVSecretBaseSecrets_Text_UsedFence,
[SBSECRETS_STATE_USED_GLITTER_MAT] = TVSecretBaseSecrets_Text_UsedGlitterMat,
[SBSECRETS_STATE_USED_TIRE] = TVSecretBaseSecrets_Text_UsedTire,
[SBSECRETS_STATE_USED_STAND] = TVSecretBaseSecrets_Text_UsedStand,
[SBSECRETS_STATE_USED_BREAKABLE_DOOR] = TVSecretBaseSecrets_Text_BrokeDoor,
[SBSECRETS_STATE_USED_DOLL] = TVSecretBaseSecrets_Text_UsedDoll,
[SBSECRETS_STATE_USED_SLIDE] = TVSecretBaseSecrets_Text_UsedSlide,
[SBSECRETS_STATE_DECLINED_SLIDE] = TVSecretBaseSecrets_Text_UsedSlideButDidntGoDown,
[SBSECRETS_STATE_USED_JUMP_MAT] = TVSecretBaseSecrets_Text_UsedJumpMat
};
static const u8 *const sTVSafariFanClubTextGroup[] = {
gTVSafariFanClubText00,
gTVSafariFanClubText01,
gTVSafariFanClubText02,
gTVSafariFanClubText03,
gTVSafariFanClubText04,
gTVSafariFanClubText05,
gTVSafariFanClubText06,
gTVSafariFanClubText07,
gTVSafariFanClubText08,
gTVSafariFanClubText09,
gTVSafariFanClubText10
};
static const u8 *const sTVInSearchOfTrainersTextGroup[] = {
gTVInSearchOfTrainersText00,
gTVInSearchOfTrainersText01,
gTVInSearchOfTrainersText02,
gTVInSearchOfTrainersText03,
gTVInSearchOfTrainersText04,
gTVInSearchOfTrainersText05,
gTVInSearchOfTrainersText06,
gTVInSearchOfTrainersText07,
gTVInSearchOfTrainersText08
};
// Secret Base Secrets TV Show states for actions that can be taken in a secret base
// The flags that determine whether or not the action was taken are commented
static const u8 sTVSecretBaseSecretsActions[NUM_SECRET_BASE_FLAGS] =
{
SBSECRETS_STATE_USED_CHAIR, // SECRET_BASE_USED_CHAIR
SBSECRETS_STATE_USED_BALLOON, // SECRET_BASE_USED_BALLOON
SBSECRETS_STATE_USED_TENT, // SECRET_BASE_USED_TENT
SBSECRETS_STATE_USED_PLANT, // SECRET_BASE_USED_PLANT
SBSECRETS_STATE_USED_GOLD_SHIELD, // SECRET_BASE_USED_GOLD_SHIELD
SBSECRETS_STATE_USED_SILVER_SHIELD, // SECRET_BASE_USED_SILVER_SHIELD
SBSECRETS_STATE_USED_GLASS_ORNAMENT, // SECRET_BASE_USED_GLASS_ORNAMENT
SBSECRETS_STATE_USED_TV, // SECRET_BASE_USED_TV
SBSECRETS_STATE_USED_MUD_BALL, // SECRET_BASE_USED_MUD_BALL
SBSECRETS_STATE_USED_BAG, // SECRET_BASE_USED_BAG
SBSECRETS_STATE_USED_CUSHION, // SECRET_BASE_USED_CUSHION
SBSECRETS_STATE_BATTLED_WON, // SECRET_BASE_BATTLED_WON
SBSECRETS_STATE_BATTLED_LOST, // SECRET_BASE_BATTLED_LOST
SBSECRETS_STATE_DECLINED_BATTLE, // SECRET_BASE_DECLINED_BATTLE
SBSECRETS_STATE_USED_POSTER, // SECRET_BASE_USED_POSTER
SBSECRETS_STATE_USED_NOTE_MAT, // SECRET_BASE_USED_NOTE_MAT
SBSECRETS_STATE_BATTLED_DRAW, // SECRET_BASE_BATTLED_DRAW
SBSECRETS_STATE_USED_SPIN_MAT, // SECRET_BASE_USED_SPIN_MAT
SBSECRETS_STATE_USED_SAND_ORNAMENT, // SECRET_BASE_USED_SAND_ORNAMENT
SBSECRETS_STATE_USED_DESK, // SECRET_BASE_USED_DESK
SBSECRETS_STATE_USED_BRICK, // SECRET_BASE_USED_BRICK
SBSECRETS_STATE_USED_SOLID_BOARD, // SECRET_BASE_USED_SOLID_BOARD
SBSECRETS_STATE_USED_FENCE, // SECRET_BASE_USED_FENCE
SBSECRETS_STATE_USED_GLITTER_MAT, // SECRET_BASE_USED_GLITTER_MAT
SBSECRETS_STATE_USED_TIRE, // SECRET_BASE_USED_TIRE
SBSECRETS_STATE_USED_STAND, // SECRET_BASE_USED_STAND
SBSECRETS_STATE_USED_BREAKABLE_DOOR, // SECRET_BASE_USED_BREAKABLE_DOOR
SBSECRETS_STATE_USED_DOLL, // SECRET_BASE_USED_DOLL
SBSECRETS_STATE_USED_SLIDE, // SECRET_BASE_USED_SLIDE
SBSECRETS_STATE_DECLINED_SLIDE, // SECRET_BASE_DECLINED_SLIDE
SBSECRETS_STATE_USED_JUMP_MAT, // SECRET_BASE_USED_JUMP_MAT
SBSECRETS_NUM_STATES // SECRET_BASE_UNUSED_FLAG. Odd that this is included, if it were used it would overflow sTVSecretBaseSecretsTextGroup
};
void ClearTVShowData(void)
{
u8 i, j;
for (i = 0; i < ARRAY_COUNT(gSaveBlock1Ptr->tvShows); i++)
{
gSaveBlock1Ptr->tvShows[i].commonInit.kind = 0;
gSaveBlock1Ptr->tvShows[i].commonInit.active = 0;
for (j = 0; j < ARRAY_COUNT(gSaveBlock1Ptr->tvShows[i].commonInit.data); j++)
gSaveBlock1Ptr->tvShows[i].commonInit.data[j] = 0;
}
ClearPokeNews();
}
u8 GetRandomActiveShowIdx(void)
{
u8 i;
u8 j;
u8 selIdx;
TVShow *show;
// Include all normal TV shows, and up through any present Record Mix shows
for (i = NUM_NORMAL_TVSHOW_SLOTS; i < LAST_TVSHOW_IDX; i++)
{
if (gSaveBlock1Ptr->tvShows[i].common.kind == TVSHOW_OFF_AIR)
break;
}
j = Random() % i;
selIdx = j;
do
{
if (GetTVGroupByShowId(gSaveBlock1Ptr->tvShows[j].common.kind) != TVGROUP_OUTBREAK)
{
if (gSaveBlock1Ptr->tvShows[j].common.active == TRUE)
return j;
}
else
{
show = &gSaveBlock1Ptr->tvShows[j];
if (show->massOutbreak.daysLeft == 0 && show->massOutbreak.active == TRUE)
return j;
}
if (j == 0)
j = ARRAY_COUNT(gSaveBlock1Ptr->tvShows) - 2;
else
j--;
} while (j != selIdx);
return 0xFF;
}
u8 FindAnyTVShowOnTheAir(void)
{
u8 slot = GetRandomActiveShowIdx();
if (slot == 0xFF)
return 0xFF;
if (gSaveBlock1Ptr->outbreakPokemonSpecies != SPECIES_NONE
&& gSaveBlock1Ptr->tvShows[slot].common.kind == TVSHOW_MASS_OUTBREAK)
return FindFirstActiveTVShowThatIsNotAMassOutbreak();
return slot;
}
void UpdateTVScreensOnMap(int width, int height)
{
FlagSet(FLAG_SYS_TV_WATCH);
switch (CheckForPlayersHouseNews())
{
case PLAYERS_HOUSE_TV_LATI:
SetTVMetatilesOnMap(width, height, METATILE_Building_TV_On);
break;
case PLAYERS_HOUSE_TV_MOVIE:
// Don't flash TV for movie text in player's house
break;
// case PLAYERS_HOUSE_TV_NONE:
default:
if (gSaveBlock1Ptr->location.mapGroup == MAP_GROUP(LILYCOVE_CITY_COVE_LILY_MOTEL_1F)
&& gSaveBlock1Ptr->location.mapNum == MAP_NUM(LILYCOVE_CITY_COVE_LILY_MOTEL_1F))
{
// NPC in Lilycove Hotel is always watching TV
SetTVMetatilesOnMap(width, height, METATILE_Building_TV_On);
}
else if (FlagGet(FLAG_SYS_TV_START) && (FindAnyTVShowOnTheAir() != 0xFF || FindAnyPokeNewsOnTheAir() != 0xFF || IsGabbyAndTyShowOnTheAir()))
{
FlagClear(FLAG_SYS_TV_WATCH);
SetTVMetatilesOnMap(width, height, METATILE_Building_TV_On);
}
break;
}
}
static void SetTVMetatilesOnMap(int width, int height, u16 metatileId)
{
int x;
int y;
for (y = 0; y < height; y++)
{
for (x = 0; x < width; x++)
{
if (MapGridGetMetatileBehaviorAt(x, y) == MB_TELEVISION)
MapGridSetMetatileIdAt(x, y, metatileId | MAPGRID_COLLISION_MASK);
}
}
}
void TurnOffTVScreen(void)
{
SetTVMetatilesOnMap(gBackupMapLayout.width, gBackupMapLayout.height, METATILE_Building_TV_Off);
DrawWholeMapView();
}
void TurnOnTVScreen(void)
{
SetTVMetatilesOnMap(gBackupMapLayout.width, gBackupMapLayout.height, METATILE_Building_TV_On);
DrawWholeMapView();
}
// gSpecialVar_0x8004 here is set from GetRandomActiveShowIdx in EventScript_TryDoTVShow
u8 GetSelectedTVShow(void)
{
return gSaveBlock1Ptr->tvShows[gSpecialVar_0x8004].common.kind;
}
static u8 FindFirstActiveTVShowThatIsNotAMassOutbreak(void)
{
u8 i;
for (i = 0; i < ARRAY_COUNT(gSaveBlock1Ptr->tvShows) - 1; i++)
{
if (gSaveBlock1Ptr->tvShows[i].common.kind != TVSHOW_OFF_AIR
&& gSaveBlock1Ptr->tvShows[i].common.kind != TVSHOW_MASS_OUTBREAK
&& gSaveBlock1Ptr->tvShows[i].common.active == TRUE)
return i;
}
return 0xFF;
}
u8 GetNextActiveShowIfMassOutbreak(void)
{
TVShow *tvShow;
tvShow = &gSaveBlock1Ptr->tvShows[gSpecialVar_0x8004];
if (tvShow->common.kind == TVSHOW_MASS_OUTBREAK && gSaveBlock1Ptr->outbreakPokemonSpecies != SPECIES_NONE)
return FindFirstActiveTVShowThatIsNotAMassOutbreak();
return gSpecialVar_0x8004;
}
// IN SEARCH OF TRAINERS
void ResetGabbyAndTy(void)
{
gSaveBlock1Ptr->gabbyAndTyData.mon1 = SPECIES_NONE;
gSaveBlock1Ptr->gabbyAndTyData.mon2 = SPECIES_NONE;
gSaveBlock1Ptr->gabbyAndTyData.lastMove = MOVE_NONE;
gSaveBlock1Ptr->gabbyAndTyData.quote[0] = -1;
gSaveBlock1Ptr->gabbyAndTyData.battleTookMoreThanOneTurn = FALSE;
gSaveBlock1Ptr->gabbyAndTyData.playerLostAMon = FALSE;
gSaveBlock1Ptr->gabbyAndTyData.playerUsedHealingItem = FALSE;
gSaveBlock1Ptr->gabbyAndTyData.playerThrewABall = FALSE;
gSaveBlock1Ptr->gabbyAndTyData.onAir = FALSE;
gSaveBlock1Ptr->gabbyAndTyData.valA_5 = 0;
gSaveBlock1Ptr->gabbyAndTyData.battleTookMoreThanOneTurn2 = FALSE;
gSaveBlock1Ptr->gabbyAndTyData.playerLostAMon2 = FALSE;
gSaveBlock1Ptr->gabbyAndTyData.playerUsedHealingItem2 = FALSE;
gSaveBlock1Ptr->gabbyAndTyData.playerThrewABall2 = FALSE;
gSaveBlock1Ptr->gabbyAndTyData.valB_4 = 0;
gSaveBlock1Ptr->gabbyAndTyData.mapnum = 0;
gSaveBlock1Ptr->gabbyAndTyData.battleNum = 0;
}
void GabbyAndTyBeforeInterview(void)
{
u8 i;
gSaveBlock1Ptr->gabbyAndTyData.mon1 = gBattleResults.playerMon1Species;
gSaveBlock1Ptr->gabbyAndTyData.mon2 = gBattleResults.playerMon2Species;
gSaveBlock1Ptr->gabbyAndTyData.lastMove = gBattleResults.lastUsedMovePlayer;
if (gSaveBlock1Ptr->gabbyAndTyData.battleNum != 0xFF)
gSaveBlock1Ptr->gabbyAndTyData.battleNum++;
gSaveBlock1Ptr->gabbyAndTyData.battleTookMoreThanOneTurn = gBattleResults.playerMonWasDamaged;
if (gBattleResults.playerFaintCounter != 0)
gSaveBlock1Ptr->gabbyAndTyData.playerLostAMon = TRUE;
else
gSaveBlock1Ptr->gabbyAndTyData.playerLostAMon = FALSE;
if (gBattleResults.numHealingItemsUsed != 0)
gSaveBlock1Ptr->gabbyAndTyData.playerUsedHealingItem = TRUE;
else
gSaveBlock1Ptr->gabbyAndTyData.playerUsedHealingItem = FALSE;
if (!gBattleResults.usedMasterBall)
{
for (i = 0; i < POKEBALL_COUNT - 1; i++)
{
if (gBattleResults.catchAttempts[i])
{
gSaveBlock1Ptr->gabbyAndTyData.playerThrewABall = TRUE;
break;
}
}
}
else
{
// Player threw a Master Ball at Gabby and Ty
gSaveBlock1Ptr->gabbyAndTyData.playerThrewABall = TRUE;
}
TakeGabbyAndTyOffTheAir();
if (gSaveBlock1Ptr->gabbyAndTyData.lastMove == MOVE_NONE)
FlagSet(FLAG_TEMP_SKIP_GABBY_INTERVIEW);
}
void GabbyAndTyAfterInterview(void)
{
gSaveBlock1Ptr->gabbyAndTyData.battleTookMoreThanOneTurn2 = gSaveBlock1Ptr->gabbyAndTyData.battleTookMoreThanOneTurn;
gSaveBlock1Ptr->gabbyAndTyData.playerLostAMon2 = gSaveBlock1Ptr->gabbyAndTyData.playerLostAMon;
gSaveBlock1Ptr->gabbyAndTyData.playerUsedHealingItem2 = gSaveBlock1Ptr->gabbyAndTyData.playerUsedHealingItem;
gSaveBlock1Ptr->gabbyAndTyData.playerThrewABall2 = gSaveBlock1Ptr->gabbyAndTyData.playerThrewABall;
gSaveBlock1Ptr->gabbyAndTyData.onAir = TRUE;
gSaveBlock1Ptr->gabbyAndTyData.mapnum = gMapHeader.regionMapSectionId;
IncrementGameStat(GAME_STAT_GOT_INTERVIEWED);
}
static void TakeGabbyAndTyOffTheAir(void)
{
gSaveBlock1Ptr->gabbyAndTyData.onAir = FALSE;
}
u8 GabbyAndTyGetBattleNum(void)
{
if (gSaveBlock1Ptr->gabbyAndTyData.battleNum > 5)
return (gSaveBlock1Ptr->gabbyAndTyData.battleNum % 3) + 6;
return gSaveBlock1Ptr->gabbyAndTyData.battleNum;