forked from pret/pokefirered
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy patheasy_chat.c
730 lines (635 loc) · 18.4 KB
/
easy_chat.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
#include "global.h"
#include "gflib.h"
#include "data.h"
#include "easy_chat.h"
#include "event_data.h"
#include "field_message_box.h"
#include "mystery_gift.h"
#include "menu.h"
#include "mail.h"
#include "pokedex.h"
#include "random.h"
#include "strings.h"
#include "constants/easy_chat.h"
struct Unk203A120
{
u16 numGroups;
u16 groups[EC_NUM_GROUPS];
u16 alphabeticalGroups[27];
u16 alphabeticalWordsByGroup[27][270];
u8 filler3958[0x2C];
u16 allWords[270];
u16 totalWords;
}; /*size = 0x3BA4*/
static EWRAM_DATA struct Unk203A120 * sEasyChatSelectionData = NULL;
static bool8 EC_IsNationalPokedexEnabled(void);
static u16 GetRandomECPokemon(void);
static void PopulateECGroups(void);
static void PopulateAlphabeticalGroups(void);
static u16 GetUnlockedWordsInECGroup(u16);
static u16 GetUnlockedWordsInAlphabeticalGroup(u16);
static bool8 UnlockedECMonOrMove(u16, u8);
static bool32 EC_IsDeoxys(u16 species);
static bool8 IsWordUnlocked(u16 word);
#include "data/easy_chat/easy_chat_groups.h"
#include "data/easy_chat/easy_chat_words_by_letter.h"
static const u8 *const sEasyChatGroupNamePointers[] = {
[EC_GROUP_POKEMON] = gEasyChatGroupName_Pokemon,
[EC_GROUP_TRAINER] = gEasyChatGroupName_Trainer,
[EC_GROUP_STATUS] = gEasyChatGroupName_Status,
[EC_GROUP_BATTLE] = gEasyChatGroupName_Battle,
[EC_GROUP_GREETINGS] = gEasyChatGroupName_Greetings,
[EC_GROUP_PEOPLE] = gEasyChatGroupName_People,
[EC_GROUP_VOICES] = gEasyChatGroupName_Voices,
[EC_GROUP_SPEECH] = gEasyChatGroupName_Speech,
[EC_GROUP_ENDINGS] = gEasyChatGroupName_Endings,
[EC_GROUP_FEELINGS] = gEasyChatGroupName_Feelings,
[EC_GROUP_CONDITIONS] = gEasyChatGroupName_Conditions,
[EC_GROUP_ACTIONS] = gEasyChatGroupName_Actions,
[EC_GROUP_LIFESTYLE] = gEasyChatGroupName_Lifestyle,
[EC_GROUP_HOBBIES] = gEasyChatGroupName_Hobbies,
[EC_GROUP_TIME] = gEasyChatGroupName_Time,
[EC_GROUP_MISC] = gEasyChatGroupName_Misc,
[EC_GROUP_ADJECTIVES] = gEasyChatGroupName_Adjectives,
[EC_GROUP_EVENTS] = gEasyChatGroupName_Events,
[EC_GROUP_MOVE_1] = gEasyChatGroupName_Move1,
[EC_GROUP_MOVE_2] = gEasyChatGroupName_Move2,
[EC_GROUP_TRENDY_SAYING] = gEasyChatGroupName_TrendySaying,
[EC_GROUP_POKEMON_2] = gEasyChatGroupName_Pokemon2,
};
static const u16 sDefaultProfileWords[] = {
EC_WORD_I_AM,
EC_WORD_A,
EC_WORD_POKEMON,
EC_WORD_FRIEND,
};
static const u16 sDefaultBattleStartWords[] = {
EC_WORD_ARE,
EC_WORD_YOU,
EC_WORD_READY,
EC_WORD_QUES,
EC_WORD_HERE_I_COME,
EC_WORD_EXCL,
};
static const u16 sDeoxysValue[] = {
SPECIES_DEOXYS,
};
static bool8 IsECGroupUnlocked(u8 groupId)
{
switch (groupId)
{
case EC_GROUP_TRENDY_SAYING:
return FALSE;
case EC_GROUP_EVENTS:
case EC_GROUP_MOVE_1:
case EC_GROUP_MOVE_2:
return FlagGet(FLAG_SYS_GAME_CLEAR);
case EC_GROUP_POKEMON:
return EC_IsNationalPokedexEnabled();
default:
return TRUE;
}
}
static u16 EasyChat_GetNumWordsInGroup(u8 groupId)
{
if (groupId == EC_GROUP_POKEMON)
return GetNationalPokedexCount(FLAG_GET_SEEN);
if (IsECGroupUnlocked(groupId))
return sEasyChatGroups[groupId].numEnabledWords;
return 0;
}
static bool8 IsECWordInvalid(u16 easyChatWord)
{
u16 i;
u8 groupId;
u32 index;
u16 numWords;
const u16 *list;
if (easyChatWord == EC_WORD_UNDEFINED)
return FALSE;
groupId = EC_GROUP(easyChatWord);
index = EC_INDEX(easyChatWord);
if (groupId >= EC_NUM_GROUPS)
return TRUE;
numWords = sEasyChatGroups[groupId].numWords;
switch (groupId)
{
case EC_GROUP_POKEMON:
case EC_GROUP_POKEMON_2:
case EC_GROUP_MOVE_1:
case EC_GROUP_MOVE_2:
list = sEasyChatGroups[groupId].wordData.valueList;
for (i = 0; i < numWords; i++)
{
if (index == list[i])
return FALSE;
}
return TRUE;
default:
if (index >= numWords)
return TRUE;
else
return FALSE;
}
}
static const u8 *GetEasyChatWord(u8 groupId, u16 index)
{
switch (groupId)
{
case EC_GROUP_POKEMON:
case EC_GROUP_POKEMON_2:
return gSpeciesNames[index];
case EC_GROUP_MOVE_1:
case EC_GROUP_MOVE_2:
return gMoveNames[index];
default:
return sEasyChatGroups[groupId].wordData.words[index].text;
}
}
u8 *CopyEasyChatWord(u8 *dest, u16 easyChatWord)
{
u8 *resultStr;
if (IsECWordInvalid(easyChatWord))
{
resultStr = StringCopy(dest, gText_ThreeQuestionMarks);
}
else if (easyChatWord != EC_WORD_UNDEFINED)
{
u16 index = EC_INDEX(easyChatWord);
u8 groupId = EC_GROUP(easyChatWord);
resultStr = StringCopy(dest, GetEasyChatWord(groupId, index));
}
else
{
*dest = EOS;
resultStr = dest;
}
return resultStr;
}
u8 *ConvertEasyChatWordsToString(u8 *dest, const u16 *src, u16 columns, u16 rows)
{
u16 i, j;
u16 numColumns = columns - 1;
for (i = 0; i < rows; i++)
{
for (j = 0; j < numColumns; j++)
{
dest = CopyEasyChatWord(dest, *src);
if (*src != EC_WORD_UNDEFINED)
{
*dest = CHAR_SPACE;
dest++;
}
src++;
}
dest = CopyEasyChatWord(dest, *(src++));
*dest = CHAR_NEWLINE;
dest++;
}
dest--;
*dest = EOS;
return dest;
}
static u16 GetEasyChatWordStringLength(u16 easyChatWord)
{
if (easyChatWord == EC_WORD_UNDEFINED)
return 0;
if (IsECWordInvalid(easyChatWord))
{
return StringLength(gText_ThreeQuestionMarks);
}
else
{
u16 index = EC_INDEX(easyChatWord);
u8 groupId = EC_GROUP(easyChatWord);
return StringLength(GetEasyChatWord(groupId, index));
}
}
bool8 EC_DoesEasyChatStringFitOnLine(const u16 *easyChatWords, u8 columns, u8 rows, u16 maxLength)
{
u8 i, j;
for (i = 0; i < rows; i++)
{
u16 totalLength = columns - 1;
for (j = 0; j < columns; j++)
totalLength += GetEasyChatWordStringLength(*(easyChatWords++));
if (totalLength > maxLength)
return TRUE;
}
return FALSE;
}
static u16 GetRandomWordFromGroup(u16 groupId)
{
u16 index = Random() % sEasyChatGroups[groupId].numWords;
if (groupId == EC_GROUP_POKEMON_2
|| groupId == EC_GROUP_POKEMON
|| groupId == EC_GROUP_MOVE_1
|| groupId == EC_GROUP_MOVE_2)
{
index = sEasyChatGroups[groupId].wordData.valueList[index];
}
return EC_WORD(groupId, index);
}
static u16 GetRandomWordFromAnyGroup(u16 groupId)
{
if (!IsECGroupUnlocked(groupId))
return EC_WORD_UNDEFINED;
if (groupId == EC_GROUP_POKEMON)
return GetRandomECPokemon();
return GetRandomWordFromGroup(groupId);
}
void ShowEasyChatMessage(void)
{
u16 *easyChatWords;
int columns, rows;
switch (gSpecialVar_0x8004)
{
case 0:
easyChatWords = gSaveBlock1Ptr->easyChatProfile;
columns = 2;
rows = 2;
break;
case 1:
easyChatWords = gSaveBlock1Ptr->easyChatBattleStart;
if (EC_DoesEasyChatStringFitOnLine(gSaveBlock1Ptr->easyChatBattleStart, 3, 2, 18))
{
columns = 2;
rows = 3;
}
else
{
columns = 3;
rows = 2;
}
break;
case 2:
easyChatWords = gSaveBlock1Ptr->easyChatBattleWon;
columns = 3;
rows = 2;
break;
case 3:
easyChatWords = gSaveBlock1Ptr->easyChatBattleLost;
columns = 3;
rows = 2;
break;
default:
return;
}
ConvertEasyChatWordsToString(gStringVar4, easyChatWords, columns, rows);
ShowFieldAutoScrollMessage(gStringVar4);
}
void BufferRandomHobbyOrLifestyleString(void)
{
int groupId = Random() & 1 ? EC_GROUP_HOBBIES : EC_GROUP_LIFESTYLE;
u16 easyChatWord = GetRandomWordFromAnyGroup(groupId);
CopyEasyChatWord(gStringVar2, easyChatWord);
}
static bool8 IsTrendySayingUnlocked(u8 additionalPhraseId)
{
int byteOffset = additionalPhraseId / 8;
int shift = additionalPhraseId % 8;
return (gSaveBlock1Ptr->additionalPhrases[byteOffset] >> shift) & 1;
}
void EnableRareWord(u8 additionalPhraseId)
{
if (additionalPhraseId < 33)
{
int byteOffset = additionalPhraseId / 8;
int shift = additionalPhraseId % 8;
gSaveBlock1Ptr->additionalPhrases[byteOffset] |= 1 << shift;
}
}
static u8 GetNumUnlockedTrendySayings(void)
{
u8 i;
u8 numAdditionalPhrasesUnlocked;
for (i = 0, numAdditionalPhrasesUnlocked = 0; i < 33; i++)
{
if (IsTrendySayingUnlocked(i))
numAdditionalPhrasesUnlocked++;
}
return numAdditionalPhrasesUnlocked;
}
static u16 UnlockRandomTrendySaying(void)
{
u16 i;
u16 additionalPhraseId;
u8 numAdditionalPhrasesUnlocked = GetNumUnlockedTrendySayings();
if (numAdditionalPhrasesUnlocked == 33)
return EC_WORD_UNDEFINED;
additionalPhraseId = Random() % (33 - numAdditionalPhrasesUnlocked);
for (i = 0; i < 33; i++)
{
if (!IsTrendySayingUnlocked(i))
{
if (additionalPhraseId)
{
additionalPhraseId--;
}
else
{
EnableRareWord(i);
return EC_WORD(EC_GROUP_TRENDY_SAYING, i);
}
}
}
return EC_WORD_UNDEFINED;
}
static u16 GetRandomUnlockedTrendySaying(void)
{
u16 i;
u16 additionalPhraseId = GetNumUnlockedTrendySayings();
if (additionalPhraseId == 0)
return EC_WORD_UNDEFINED;
additionalPhraseId = Random() % additionalPhraseId;
for (i = 0; i < 33; i++)
{
if (IsTrendySayingUnlocked(i))
{
if (additionalPhraseId)
additionalPhraseId--;
else
return EC_WORD(EC_GROUP_TRENDY_SAYING, i);
}
}
return EC_WORD_UNDEFINED;
}
static bool8 EC_IsNationalPokedexEnabled(void)
{
return IsNationalPokedexEnabled();
}
static u16 GetRandomECPokemon(void)
{
u16 i;
u16 numWords;
const u16 *species;
u16 index = EasyChat_GetNumWordsInGroup(EC_GROUP_POKEMON_2);
if (index == 0)
return EC_WORD_UNDEFINED;
index = Random() % index;
species = sEasyChatGroups[EC_GROUP_POKEMON_2].wordData.valueList;
numWords = sEasyChatGroups[EC_GROUP_POKEMON_2].numWords;
for (i = 0; i < numWords; i++)
{
u16 dexNum = SpeciesToNationalPokedexNum(*species);
if (GetSetPokedexFlag(dexNum, FLAG_GET_SEEN))
{
if (index)
index--;
else
return EC_WORD(EC_GROUP_POKEMON_2, *species);
}
species++;
}
return EC_WORD_UNDEFINED;
}
void InitEasyChatPhrases(void)
{
u16 i, j;
for (i = 0; i < 4; i++)
gSaveBlock1Ptr->easyChatProfile[i] = sDefaultProfileWords[i];
for (i = 0; i < 6; i++)
gSaveBlock1Ptr->easyChatBattleStart[i] = sDefaultBattleStartWords[i];
for (i = 0; i < 6; i++)
{
gSaveBlock1Ptr->easyChatBattleWon[i] = EC_WORD_UNDEFINED;
gSaveBlock1Ptr->easyChatBattleLost[i] = EC_WORD_UNDEFINED;
}
for (i = 0; i < MAIL_COUNT; i++)
{
for (j = 0; j < MAIL_WORDS_COUNT; j++)
gSaveBlock1Ptr->mail[i].words[j] = EC_WORD_UNDEFINED;
}
#ifndef UBFIX
// BUG: This is supposed to clear 64 bits, but this loop is clearing 64 bytes.
// However, this bug has no resulting effect on gameplay because only the
// Mauville old man data is corrupted, which is initialized directly after
// this function is called when starting a new game.
for (i = 0; i < 64; i++)
gSaveBlock1Ptr->additionalPhrases[i] = 0;
#else
for (i = 0; i < NELEMS(gSaveBlock1Ptr->additionalPhrases); i++)
gSaveBlock1Ptr->additionalPhrases[i] = 0;
#endif
}
void InitQuestionnaireWords(void)
{
s32 i;
u16 *ptr = GetQuestionnaireWordsPtr();
for (i = 0; i < NUM_QUESTIONNAIRE_WORDS; i++)
ptr[i] = EC_WORD_UNDEFINED;
}
bool8 InitEasyChatSelection(void)
{
sEasyChatSelectionData = Alloc(sizeof(*sEasyChatSelectionData));
if (sEasyChatSelectionData == NULL)
return FALSE;
PopulateECGroups();
PopulateAlphabeticalGroups();
return TRUE;
}
void DestroyEasyChatSelectionData(void)
{
if (sEasyChatSelectionData != NULL)
Free(sEasyChatSelectionData);
}
static void PopulateECGroups(void)
{
int i;
sEasyChatSelectionData->numGroups = 0;
if (GetNationalPokedexCount(FLAG_GET_SEEN))
sEasyChatSelectionData->groups[sEasyChatSelectionData->numGroups++] = EC_GROUP_POKEMON;
for (i = EC_GROUP_TRAINER; i <= EC_GROUP_ADJECTIVES; i++)
sEasyChatSelectionData->groups[sEasyChatSelectionData->numGroups++] = i;
if (FlagGet(FLAG_SYS_GAME_CLEAR))
{
sEasyChatSelectionData->groups[sEasyChatSelectionData->numGroups++] = EC_GROUP_EVENTS;
sEasyChatSelectionData->groups[sEasyChatSelectionData->numGroups++] = EC_GROUP_MOVE_1;
sEasyChatSelectionData->groups[sEasyChatSelectionData->numGroups++] = EC_GROUP_MOVE_2;
}
if (IsNationalPokedexEnabled())
sEasyChatSelectionData->groups[sEasyChatSelectionData->numGroups++] = EC_GROUP_POKEMON_2;
}
u8 GetNumDisplayableGroups(void)
{
return sEasyChatSelectionData->numGroups;
}
u8 GetSelectedGroupByIndex(u8 index)
{
if (index >= sEasyChatSelectionData->numGroups)
return EC_NUM_GROUPS;
else
return sEasyChatSelectionData->groups[index];
}
// Unused
static u8 *BufferEasyChatWordGroupName(u8 *dest, u8 groupId, u16 totalChars)
{
u16 i;
u8 *str = StringCopy(dest, sEasyChatGroupNamePointers[groupId]);
for (i = str - dest; i < totalChars; i++)
{
*str = CHAR_SPACE;
str++;
}
*str = EOS;
return str;
}
const u8 *GetEasyChatWordGroupName(u8 groupId)
{
return sEasyChatGroupNamePointers[groupId];
}
u8 *CopyEasyChatWordPadded(u8 *dest, u16 easyChatWord, u16 totalChars)
{
u16 i;
u8 *str = CopyEasyChatWord(dest, easyChatWord);
for (i = str - dest; i < totalChars; i++)
{
*str = CHAR_SPACE;
str++;
}
*str = EOS;
return str;
}
static void PopulateAlphabeticalGroups(void)
{
static int i;
static int j;
static int k;
static int index;
static int numWords;
static int numToProcess;
static const u16 *words;
for (i = 0; i < 27; i++)
{
numWords = sEasyChatWordsByLetterPointers[i].numWords;
words = sEasyChatWordsByLetterPointers[i].words;
sEasyChatSelectionData->alphabeticalGroups[i] = 0;
index = 0;
for (j = 0; j < numWords; )
{
if (*words == EC_WORD_UNDEFINED)
{
words++;
numToProcess = *words++;
j += 2;
}
else
{
numToProcess = 1;
}
for (k = 0; k < numToProcess; k++)
{
if (IsWordUnlocked(words[k]))
{
sEasyChatSelectionData->alphabeticalWordsByGroup[i][index++] = words[k];
sEasyChatSelectionData->alphabeticalGroups[i]++;
break;
}
}
words += numToProcess;
j += numToProcess;
}
}
}
void GetUnlockedECWords(bool32 isAlphabetical, u16 groupId)
{
if (!isAlphabetical)
sEasyChatSelectionData->totalWords = GetUnlockedWordsInECGroup(groupId);
else
sEasyChatSelectionData->totalWords = GetUnlockedWordsInAlphabeticalGroup(groupId);
}
u16 GetDisplayedWordByIndex(u16 index)
{
if (index >= sEasyChatSelectionData->totalWords)
return EC_WORD_UNDEFINED;
else
return sEasyChatSelectionData->allWords[index];
}
u16 GetNumDisplayedWords(void)
{
return sEasyChatSelectionData->totalWords;
}
static u16 GetUnlockedWordsInECGroup(u16 groupId)
{
u16 i;
u16 totalWords;
const u16 *list;
const struct EasyChatWordInfo * wordInfo;
u16 numWords = sEasyChatGroups[groupId].numWords;
if (groupId == EC_GROUP_POKEMON_2 || groupId == EC_GROUP_POKEMON
|| groupId == EC_GROUP_MOVE_1 || groupId == EC_GROUP_MOVE_2)
{
list = sEasyChatGroups[groupId].wordData.valueList;
for (i = 0, totalWords = 0; i < numWords; i++)
{
if (UnlockedECMonOrMove(list[i], groupId))
sEasyChatSelectionData->allWords[totalWords++] = EC_WORD(groupId, list[i]);
}
return totalWords;
}
else
{
wordInfo = sEasyChatGroups[groupId].wordData.words;
for (i = 0, totalWords = 0; i < numWords; i++)
{
u16 alphabeticalOrder = wordInfo[i].alphabeticalOrder;
if (UnlockedECMonOrMove(alphabeticalOrder, groupId))
sEasyChatSelectionData->allWords[totalWords++] = EC_WORD(groupId, alphabeticalOrder);
}
return totalWords;
}
}
static u16 GetUnlockedWordsInAlphabeticalGroup(u16 alphabeticalGroup)
{
u16 i;
u16 totalWords;
for (i = 0, totalWords = 0; i < sEasyChatSelectionData->alphabeticalGroups[alphabeticalGroup]; i++)
sEasyChatSelectionData->allWords[totalWords++] = sEasyChatSelectionData->alphabeticalWordsByGroup[alphabeticalGroup][i];
return totalWords;
}
static bool8 IsGroupSelectable(u8 groupIdx)
{
int i;
for (i = 0; i < sEasyChatSelectionData->numGroups; i++)
{
if (sEasyChatSelectionData->groups[i] == groupIdx)
return TRUE;
}
return FALSE;
}
static bool8 UnlockedECMonOrMove(u16 wordIndex, u8 groupId)
{
switch (groupId)
{
case EC_GROUP_POKEMON:
return GetSetPokedexFlag(SpeciesToNationalPokedexNum(wordIndex), FLAG_GET_SEEN);
case EC_GROUP_POKEMON_2:
if (EC_IsDeoxys(wordIndex))
return GetSetPokedexFlag(SpeciesToNationalPokedexNum(wordIndex), FLAG_GET_SEEN);
return TRUE;
case EC_GROUP_MOVE_1:
case EC_GROUP_MOVE_2:
return TRUE;
default:
return sEasyChatGroups[groupId].wordData.words[wordIndex].enabled;
}
}
static bool32 EC_IsDeoxys(u16 species)
{
u32 i;
for (i = 0; i < NELEMS(sDeoxysValue); i++)
{
if (sDeoxysValue[i] == species)
return TRUE;
}
return FALSE;
}
static bool8 IsWordUnlocked(u16 easyChatWord)
{
u8 groupId = EC_GROUP(easyChatWord);
u32 index = EC_INDEX(easyChatWord);
if (!IsGroupSelectable(groupId))
return FALSE;
else
return UnlockedECMonOrMove(index, groupId);
}