mirror of
https://github.com/pret/pokeheartgold.git
synced 2025-02-26 08:09:06 +00:00
finish cleaning up easy_chat.c
This commit is contained in:
parent
4cb7723150
commit
229fb46d7b
@ -68,7 +68,7 @@
|
||||
.public GF_RTC_GetTimeOfDayWildParam
|
||||
.public WallpaperPasswordBank_Create
|
||||
.public WallpaperPasswordBank_Delete
|
||||
.public WallpaperPasswordBank_GetNum
|
||||
.public WallpaperPasswordBank_GetCount
|
||||
.public WallpaperPasswordBank_GetIndexOfWord
|
||||
.public CreateCameraTranslationWrapper
|
||||
.public DeleteCameraTranslationWrapper
|
||||
|
@ -34,8 +34,8 @@
|
||||
.public DestroySysTask
|
||||
.public WallpaperPasswordBank_Create
|
||||
.public WallpaperPasswordBank_Delete
|
||||
.public WallpaperPasswordBank_GetNum
|
||||
.public WallpaperPasswordBank_GetWordI
|
||||
.public WallpaperPasswordBank_GetCount
|
||||
.public WallpaperPasswordBank_GetWordAtIndex
|
||||
.public sub_02018068
|
||||
.public sub_020181B0
|
||||
.public sub_020181EC
|
||||
|
@ -14700,7 +14700,7 @@ ov02_0224CAB8: ; 0x0224CAB8
|
||||
add r6, r2, #0
|
||||
str r1, [sp]
|
||||
add r7, r3, #0
|
||||
bl WallpaperPasswordBank_GetNum
|
||||
bl WallpaperPasswordBank_GetCount
|
||||
add r4, r0, #0
|
||||
add r0, r5, #0
|
||||
add r1, r6, #0
|
||||
@ -14868,7 +14868,7 @@ ov02_0224CBF8: ; 0x0224CBF8
|
||||
add r6, r2, #0
|
||||
str r1, [sp]
|
||||
add r7, r3, #0
|
||||
bl WallpaperPasswordBank_GetNum
|
||||
bl WallpaperPasswordBank_GetCount
|
||||
add r4, r0, #0
|
||||
add r0, r5, #0
|
||||
add r1, r6, #0
|
||||
|
@ -6146,7 +6146,7 @@ ov45_0222CA10: ; 0x0222CA10
|
||||
add r4, r1, #0
|
||||
add r6, r0, #0
|
||||
add r5, r2, #0
|
||||
bl WallpaperPasswordBank_GetNum
|
||||
bl WallpaperPasswordBank_GetCount
|
||||
add r7, r0, #0
|
||||
str r4, [sp, #8]
|
||||
add r0, sp, #8
|
||||
@ -6157,7 +6157,7 @@ ov45_0222CA10: ; 0x0222CA10
|
||||
add r0, r0, r4
|
||||
bl _u32_div_f
|
||||
add r0, r6, #0
|
||||
bl WallpaperPasswordBank_GetWordI
|
||||
bl WallpaperPasswordBank_GetWordAtIndex
|
||||
strh r0, [r5]
|
||||
add r0, sp, #8
|
||||
ldrb r0, [r0, #1]
|
||||
@ -6166,7 +6166,7 @@ ov45_0222CA10: ; 0x0222CA10
|
||||
add r0, r4, r0
|
||||
bl _u32_div_f
|
||||
add r0, r6, #0
|
||||
bl WallpaperPasswordBank_GetWordI
|
||||
bl WallpaperPasswordBank_GetWordAtIndex
|
||||
strh r0, [r5, #2]
|
||||
add r0, sp, #8
|
||||
ldrb r4, [r0, #2]
|
||||
@ -6175,14 +6175,14 @@ ov45_0222CA10: ; 0x0222CA10
|
||||
add r0, r0, r4
|
||||
bl _u32_div_f
|
||||
add r0, r6, #0
|
||||
bl WallpaperPasswordBank_GetWordI
|
||||
bl WallpaperPasswordBank_GetWordAtIndex
|
||||
strh r0, [r5, #4]
|
||||
ldr r0, [sp]
|
||||
add r1, r7, #0
|
||||
add r0, r4, r0
|
||||
bl _u32_div_f
|
||||
add r0, r6, #0
|
||||
bl WallpaperPasswordBank_GetWordI
|
||||
bl WallpaperPasswordBank_GetWordAtIndex
|
||||
strh r0, [r5, #6]
|
||||
add sp, #0xc
|
||||
pop {r4, r5, r6, r7, pc}
|
||||
|
@ -15,36 +15,35 @@ typedef struct EasyChatManager {
|
||||
typedef struct SaveEasyChat {
|
||||
u32 greetings;
|
||||
u32 trendy;
|
||||
} SAVE_EASY_CHAT_T;
|
||||
} SaveEasyChat;
|
||||
|
||||
struct WallpaperPasswordBank {
|
||||
typedef struct WallpaperPasswordBank {
|
||||
u32 count;
|
||||
u32 *words;
|
||||
};
|
||||
} WallpaperPasswordBank;
|
||||
|
||||
EasyChatManager *EasyChatManager_New(HeapID heapId);
|
||||
void EasyChatManager_Delete(EasyChatManager *easyChatManager);
|
||||
|
||||
SAVE_EASY_CHAT_T *Save_EasyChat_Get(SaveData *saveData);
|
||||
u16 GetECWordIndexByPair(u32 msgBank, u32 word);
|
||||
u16 EasyChat_GetMsgBankForGroup(int category);
|
||||
void EasyChatManager_ReadWordIntoString(EasyChatManager *easyChatManager, u16 ecWord, String *dest);
|
||||
void GetECWordIntoStringByIndex(u16 ecWord, String *dest);
|
||||
void EasyChatManager_ReadWordIntoString(EasyChatManager *ecMan, u16 ecWord, String *dest);
|
||||
BOOL GetCategoryAndMsgNoByECWordIdx(u16 ecWord, u32 *category, u32 *msgno);
|
||||
u16 GetECWordIndexByPair(u32 category, u32 msgNo);
|
||||
BOOL GetCategoryAndMsgNoByECWordIdx(u16 ecWord, u32 *category, u32 *msgNo);
|
||||
u32 Save_EasyChat_sizeof(void);
|
||||
void Save_EasyChat_Init(SAVE_EASY_CHAT_T *ec);
|
||||
BOOL Save_EasyChat_GetTrendySayingFlag(SAVE_EASY_CHAT_T *ec, int flag);
|
||||
u32 Save_EasyChat_RandomTrendySayingSet(SAVE_EASY_CHAT_T *ec);
|
||||
BOOL Save_EasyChat_TrendySayingsUnlockedAllCheck(SAVE_EASY_CHAT_T *ec);
|
||||
ecword_t TrendyWordIdxToECWord(int a0);
|
||||
BOOL Save_EasyChat_GetGreetingsFlag(SAVE_EASY_CHAT_T *ec, u8 idx);
|
||||
void Save_EasyChat_SetGreetingFlag(SAVE_EASY_CHAT_T *ec, u8 idx);
|
||||
void WallpaperPasswordBank_Delete(struct WallpaperPasswordBank *pwdBank);
|
||||
u32 WallpaperPasswordBank_GetNum(struct WallpaperPasswordBank *pwdBank);
|
||||
ecword_t WallpaperPasswordBank_GetWordI(struct WallpaperPasswordBank *pwdBank, int idx);
|
||||
s16 WallpaperPasswordBank_GetIndexOfWord(struct WallpaperPasswordBank *unk, int value);
|
||||
s32 GetDuplicateWordNum(ecword_t a0);
|
||||
ecword_t RemapDuplicateWord(ecword_t a0, s32 a1);
|
||||
struct WallpaperPasswordBank *WallpaperPasswordBank_Create(HeapID heapId);
|
||||
void Save_EasyChat_Init(SaveEasyChat *saveEasyChat);
|
||||
SaveEasyChat *Save_EasyChat_Get(SaveData *saveData);
|
||||
BOOL Save_EasyChat_GetTrendySayingFlag(SaveEasyChat *saveEasyChat, u32 flag);
|
||||
u32 Save_EasyChat_SetRandomTrendySaying(SaveEasyChat *saveEasyChat);
|
||||
BOOL Save_EasyChat_TrendySayingsUnlockedAllCheck(SaveEasyChat *saveEasyChat);
|
||||
ecword_t TrendyWordIdxToECWord(u32 word);
|
||||
BOOL Save_EasyChat_GetGreetingsFlag(SaveEasyChat *saveEasyChat, u32 flag);
|
||||
void Save_EasyChat_SetGreetingFlag(SaveEasyChat *saveEasyChat, u32 flag);
|
||||
WallpaperPasswordBank *WallpaperPasswordBank_Create(HeapID heapId);
|
||||
void WallpaperPasswordBank_Delete(WallpaperPasswordBank *wallpaperPasswordBank);
|
||||
u32 WallpaperPasswordBank_GetCount(WallpaperPasswordBank *wallpaperPasswordBank);
|
||||
ecword_t WallpaperPasswordBank_GetWordAtIndex(WallpaperPasswordBank *wallpaperPasswordBank, s32 index);
|
||||
s16 WallpaperPasswordBank_GetIndexOfWord(WallpaperPasswordBank *wallpaperPasswordBank, s32 word);
|
||||
u16 EasyChat_GetMsgBankForGroup(s32 category);
|
||||
s32 GetDuplicateWordNum(ecword_t word);
|
||||
ecword_t RemapDuplicateWord(ecword_t word, s32 target);
|
||||
|
||||
#endif //POKEHEARTGOLD_EASY_CHAT_H
|
||||
|
@ -2,7 +2,7 @@
|
||||
#define POKEHEARTGOLD_HEAP_H
|
||||
|
||||
typedef enum HeapID {
|
||||
HEAP_ID_0,
|
||||
HEAP_ID_DEFAULT,
|
||||
HEAP_ID_1,
|
||||
HEAP_ID_2,
|
||||
HEAP_ID_3,
|
||||
|
@ -18,7 +18,7 @@ typedef struct {
|
||||
u8 unk6[0x2];
|
||||
u32 frame;
|
||||
Pokedex *pokedex;
|
||||
SAVE_EASY_CHAT_T *easyChat;
|
||||
SaveEasyChat *easyChat;
|
||||
MAIL_MESSAGE mailMessage;
|
||||
u16 unk1C[0x4];
|
||||
u32 *unk24;
|
||||
@ -53,7 +53,7 @@ u8 sub_02090D70(Unk02090C94 *a0);
|
||||
u8 sub_02090D74(Unk02090C94 *a0);
|
||||
u32 sub_02090D78(Unk02090C94 *a0);
|
||||
Pokedex *sub_02090D7C(Unk02090C94 *a0);
|
||||
SAVE_EASY_CHAT_T *sub_02090D80(Unk02090C94 *a0);
|
||||
SaveEasyChat *sub_02090D80(Unk02090C94 *a0);
|
||||
u8 sub_02090D84(Unk02090C94 *a0);
|
||||
u8 sub_02090D88(Unk02090C94 *a0);
|
||||
void sub_02090D8C(Unk02090C94 *a0, MAIL_MESSAGE *msg1, MAIL_MESSAGE *msg2);
|
||||
|
@ -11,7 +11,7 @@ int sub_0205A750(struct UnkStruct_02059E1C *fsys_unk80, int objId, int a2, Messa
|
||||
u32 sub_0205A894(void);
|
||||
void sub_0205A904(int command);
|
||||
int sub_0205A9A0(struct UnkStruct_02059E1C *fsys_unk80, MessageFormat *msgFmt);
|
||||
void sub_0205AA9C(MessageFormat *msgFmt, u16 a1, u16 objId, PlayerProfile *profile, SAVE_EASY_CHAT_T *easyChat);
|
||||
void sub_0205AA9C(MessageFormat *msgFmt, u16 a1, u16 objId, PlayerProfile *profile, SaveEasyChat *easyChat);
|
||||
void sub_0205ABB0(struct UnkStruct_02059E1C *fsys_unk80);
|
||||
|
||||
#endif //POKEHEARTGOLD_UNK_0205A44C_H
|
||||
|
@ -612,7 +612,7 @@ static void createOamManager(HeapID heapId) {
|
||||
3,
|
||||
0,
|
||||
0x2800,
|
||||
HEAP_ID_0
|
||||
HEAP_ID_DEFAULT
|
||||
};
|
||||
baseTrans.heapId = heapId;
|
||||
sub_020215C0(&baseTrans, 0x200010, 0x10);
|
||||
|
208
src/easy_chat.c
208
src/easy_chat.c
@ -97,10 +97,6 @@ static const ECIdenticalPhrases sIdenticalPhrases[12] = {
|
||||
{sEasyChatYou, NELEMS(sEasyChatYou)},
|
||||
};
|
||||
|
||||
void Save_EasyChat_SetGreetingFlag(SAVE_EASY_CHAT_T *ec, u8 a1);
|
||||
|
||||
BOOL GetCategoryAndMsgNoByECWordIdx(u16 ecWord, u32 *category, u32 *msgno);
|
||||
|
||||
EasyChatManager *EasyChatManager_New(HeapID heapId) {
|
||||
EasyChatManager *ret = AllocFromHeap(heapId, sizeof(EasyChatManager));
|
||||
|
||||
@ -118,49 +114,51 @@ void EasyChatManager_Delete(EasyChatManager *easyChatManager) {
|
||||
FreeToHeap(easyChatManager);
|
||||
}
|
||||
|
||||
void EasyChatManager_ReadWordIntoString(EasyChatManager *ecMan, u16 ecWord, String *dest) {
|
||||
u32 category, msgno;
|
||||
GetCategoryAndMsgNoByECWordIdx(ecWord, &category, &msgno);
|
||||
ReadMsgDataIntoString(ecMan->msgData[category], msgno, dest);
|
||||
void EasyChatManager_ReadWordIntoString(EasyChatManager *easyChatManager, u16 ecWord, String *dest) {
|
||||
u32 category;
|
||||
u32 msgNo;
|
||||
GetCategoryAndMsgNoByECWordIdx(ecWord, &category, &msgNo);
|
||||
ReadMsgDataIntoString(easyChatManager->msgData[category], msgNo, dest);
|
||||
}
|
||||
|
||||
void GetECWordIntoStringByIndex(u16 ecWord, String *dest) {
|
||||
u32 category, msgno;
|
||||
u32 category;
|
||||
u32 msgNo;
|
||||
if (ecWord != EC_WORD_NULL) {
|
||||
GetCategoryAndMsgNoByECWordIdx(ecWord, &category, &msgno);
|
||||
GetCategoryAndMsgNoByECWordIdx(ecWord, &category, &msgNo);
|
||||
category = sNarcMsgBanks[category];
|
||||
ReadMsgData_NewNarc_ExistingString(NARC_msgdata_msg, category, msgno, HEAP_ID_0, dest);
|
||||
ReadMsgData_NewNarc_ExistingString(NARC_msgdata_msg, category, msgNo, HEAP_ID_DEFAULT, dest);
|
||||
} else {
|
||||
String_SetEmpty(dest);
|
||||
}
|
||||
}
|
||||
|
||||
u16 GetECWordIndexByPair(u32 category, u32 msgno) {
|
||||
u32 i;
|
||||
u16 k;
|
||||
u16 j;
|
||||
for (i = 0; i < 11; i++) {
|
||||
if (category == sNarcMsgBanks[i]) {
|
||||
for (j = 0, k = 0; j < i; j++) {
|
||||
k += sNarcMsgCounts[j];
|
||||
u16 GetECWordIndexByPair(u32 category, u32 msgNo) {
|
||||
u32 bank;
|
||||
u16 count;
|
||||
u16 i;
|
||||
for (bank = 0; bank < EC_GROUP_MAX; bank++) {
|
||||
if (category == sNarcMsgBanks[bank]) {
|
||||
for (i = 0, count = 0; i < bank; i++) {
|
||||
count += sNarcMsgCounts[i];
|
||||
}
|
||||
return (u16)(k + msgno);
|
||||
return (u16)(count + msgNo);
|
||||
}
|
||||
}
|
||||
return EC_WORD_NULL;
|
||||
}
|
||||
|
||||
BOOL GetCategoryAndMsgNoByECWordIdx(u16 ecWord, u32 *category, u32 *msgno) {
|
||||
u32 i, j, r3;
|
||||
BOOL GetCategoryAndMsgNoByECWordIdx(u16 ecWord, u32 *category, u32 *msgNo) {
|
||||
u32 bank;
|
||||
u32 count;
|
||||
u32 wordId = ecWord & EC_WORD_MASK;
|
||||
|
||||
r3 = ecWord & EC_WORD_MASK;
|
||||
j = 0;
|
||||
|
||||
for (i = 0; i < NELEMS(sNarcMsgCounts); i++) {
|
||||
j += sNarcMsgCounts[i];
|
||||
if (r3 < j) {
|
||||
*category = i;
|
||||
*msgno = (r3 - (j - sNarcMsgCounts[i]));
|
||||
count = 0;
|
||||
for (bank = 0; bank < NELEMS(sNarcMsgCounts); bank++) {
|
||||
count += sNarcMsgCounts[bank];
|
||||
if (wordId < count) {
|
||||
*category = bank;
|
||||
*msgNo = (wordId - (count - sNarcMsgCounts[bank]));
|
||||
return TRUE;
|
||||
}
|
||||
}
|
||||
@ -169,132 +167,127 @@ BOOL GetCategoryAndMsgNoByECWordIdx(u16 ecWord, u32 *category, u32 *msgno) {
|
||||
}
|
||||
|
||||
u32 Save_EasyChat_sizeof(void) {
|
||||
return sizeof(SAVE_EASY_CHAT_T);
|
||||
return sizeof(SaveEasyChat);
|
||||
}
|
||||
|
||||
void Save_EasyChat_Init(SAVE_EASY_CHAT_T *ec) {
|
||||
int i;
|
||||
void Save_EasyChat_Init(SaveEasyChat *saveEasyChat) {
|
||||
u32 i;
|
||||
|
||||
ec->greetings = 0;
|
||||
ec->trendy = 0;
|
||||
saveEasyChat->greetings = 0;
|
||||
saveEasyChat->trendy = 0;
|
||||
for (i = 0; i < NELEMS(sLanguageToGreetingMap); i++) {
|
||||
if (sLanguageToGreetingMap[i][0] == GAME_LANGUAGE) {
|
||||
Save_EasyChat_SetGreetingFlag(ec, sLanguageToGreetingMap[i][1]);
|
||||
Save_EasyChat_SetGreetingFlag(saveEasyChat, sLanguageToGreetingMap[i][1]);
|
||||
break;
|
||||
}
|
||||
}
|
||||
SaveSubstruct_UpdateCRC(SAVE_EASY_CHAT);
|
||||
}
|
||||
|
||||
SAVE_EASY_CHAT_T *Save_EasyChat_Get(SaveData *saveData) {
|
||||
SaveEasyChat *Save_EasyChat_Get(SaveData *saveData) {
|
||||
SaveSubstruct_AssertCRC(SAVE_EASY_CHAT);
|
||||
return SaveArray_Get(saveData, SAVE_EASY_CHAT);
|
||||
}
|
||||
|
||||
BOOL Save_EasyChat_GetTrendySayingFlag(SAVE_EASY_CHAT_T *ec, int flag) {
|
||||
return (ec->trendy >> flag) & 1;
|
||||
BOOL Save_EasyChat_GetTrendySayingFlag(SaveEasyChat *saveEasyChat, u32 flag) {
|
||||
return (saveEasyChat->trendy >> flag) & 1;
|
||||
}
|
||||
|
||||
u32 Save_EasyChat_RandomTrendySayingSet(SAVE_EASY_CHAT_T *ec) {
|
||||
u32 Save_EasyChat_SetRandomTrendySaying(SaveEasyChat *saveEasyChat) {
|
||||
u32 i;
|
||||
u32 n;
|
||||
u32 k;
|
||||
u32 count;
|
||||
u32 bit;
|
||||
|
||||
for (i = 0, n = 0; i < 32; i++) {
|
||||
if (!((ec->trendy >> i) & 1)) {
|
||||
n++;
|
||||
for (i = 0, count = 0; i < EC_WORDS_TOUGH_WORDS_COUNT; i++) {
|
||||
if (!((saveEasyChat->trendy >> i) & 1)) {
|
||||
count++;
|
||||
}
|
||||
}
|
||||
|
||||
if (n != 0) {
|
||||
k = LCRandom() % n;
|
||||
for (i = 0; i < 32; i++) {
|
||||
if (!((ec->trendy >> i) & 1)) {
|
||||
if (k == 0) {
|
||||
ec->trendy |= 1 << i;
|
||||
if (count != 0) {
|
||||
bit = LCRandom() % count;
|
||||
for (i = 0; i < EC_WORDS_TOUGH_WORDS_COUNT; i++) {
|
||||
if (!((saveEasyChat->trendy >> i) & 1)) {
|
||||
if (bit == 0) {
|
||||
saveEasyChat->trendy |= (1 << i);
|
||||
SaveSubstruct_UpdateCRC(SAVE_EASY_CHAT);
|
||||
return i;
|
||||
}
|
||||
k--;
|
||||
bit--;
|
||||
}
|
||||
}
|
||||
}
|
||||
SaveSubstruct_UpdateCRC(SAVE_EASY_CHAT);
|
||||
return 32;
|
||||
return EC_WORDS_TOUGH_WORDS_COUNT;
|
||||
}
|
||||
|
||||
BOOL Save_EasyChat_TrendySayingsUnlockedAllCheck(SAVE_EASY_CHAT_T *ec) {
|
||||
u32 i;
|
||||
|
||||
for (i = 0; i < 32; i++) {
|
||||
if (!((ec->trendy >> i) & 1)) {
|
||||
BOOL Save_EasyChat_TrendySayingsUnlockedAllCheck(SaveEasyChat *saveEasyChat) {
|
||||
for (u32 i = 0; i < EC_WORDS_TOUGH_WORDS_COUNT; i++) {
|
||||
if (!((saveEasyChat->trendy >> i) & 1)) {
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
ecword_t TrendyWordIdxToECWord(int a0) {
|
||||
int i;
|
||||
ecword_t n = 0;
|
||||
ecword_t TrendyWordIdxToECWord(u32 word) {
|
||||
s32 i;
|
||||
u16 count = 0;
|
||||
for (i = 0; i < EC_GROUP_TOUGH_WORDS; i++) {
|
||||
n += sNarcMsgCounts[i];
|
||||
count += sNarcMsgCounts[i];
|
||||
}
|
||||
return n + a0;
|
||||
return (ecword_t)(count + word);
|
||||
}
|
||||
|
||||
BOOL Save_EasyChat_GetGreetingsFlag(SAVE_EASY_CHAT_T *ec, u8 idx) {
|
||||
return (ec->greetings >> idx) & 1;
|
||||
BOOL Save_EasyChat_GetGreetingsFlag(SaveEasyChat *saveEasyChat, u32 flag) {
|
||||
return (saveEasyChat->greetings >> flag) & 1;
|
||||
}
|
||||
|
||||
void Save_EasyChat_SetGreetingFlag(SAVE_EASY_CHAT_T *ec, u8 idx) {
|
||||
ec->greetings |= 1 << idx;
|
||||
void Save_EasyChat_SetGreetingFlag(SaveEasyChat *saveEasyChat, u32 flag) {
|
||||
saveEasyChat->greetings |= (1 << flag);
|
||||
SaveSubstruct_UpdateCRC(SAVE_EASY_CHAT);
|
||||
}
|
||||
|
||||
struct WallpaperPasswordBank *WallpaperPasswordBank_Create(HeapID heapId) {
|
||||
WallpaperPasswordBank *WallpaperPasswordBank_Create(HeapID heapId) {
|
||||
u32 size;
|
||||
struct WallpaperPasswordBank *ret;
|
||||
WallpaperPasswordBank *ret = AllocFromHeap(heapId, sizeof(WallpaperPasswordBank));
|
||||
|
||||
ret = AllocFromHeap(heapId, sizeof(struct WallpaperPasswordBank));
|
||||
memset(ret, 0, sizeof(struct WallpaperPasswordBank));
|
||||
memset(ret, 0, sizeof(WallpaperPasswordBank));
|
||||
ret->words = GfGfxLoader_LoadFromNarc_GetSizeOut(NARC_resource_eng_pms_aikotoba_pms_aikotoba, 0, FALSE, heapId, FALSE, &size);
|
||||
ret->count = size / 4;
|
||||
ret->count = size / sizeof(*ret->words);
|
||||
return ret;
|
||||
}
|
||||
|
||||
void WallpaperPasswordBank_Delete(struct WallpaperPasswordBank *pwdBank) {
|
||||
FreeToHeap(pwdBank->words);
|
||||
FreeToHeap(pwdBank);
|
||||
void WallpaperPasswordBank_Delete(WallpaperPasswordBank *wallpaperPasswordBank) {
|
||||
FreeToHeap(wallpaperPasswordBank->words);
|
||||
FreeToHeap(wallpaperPasswordBank);
|
||||
}
|
||||
|
||||
u32 WallpaperPasswordBank_GetNum(struct WallpaperPasswordBank *pwdBank) {
|
||||
return pwdBank->count;
|
||||
u32 WallpaperPasswordBank_GetCount(WallpaperPasswordBank *wallpaperPasswordBank) {
|
||||
return wallpaperPasswordBank->count;
|
||||
}
|
||||
|
||||
ecword_t WallpaperPasswordBank_GetWordI(struct WallpaperPasswordBank *pwdBank, int idx) {
|
||||
GF_ASSERT(pwdBank != NULL);
|
||||
if (pwdBank->count <= idx) {
|
||||
ecword_t WallpaperPasswordBank_GetWordAtIndex(WallpaperPasswordBank *wallpaperPasswordBank, s32 index) {
|
||||
GF_ASSERT(wallpaperPasswordBank != NULL);
|
||||
if (wallpaperPasswordBank->count <= index) {
|
||||
return EC_WORD_NULL;
|
||||
} else {
|
||||
return pwdBank->words[idx];
|
||||
return wallpaperPasswordBank->words[index];
|
||||
}
|
||||
}
|
||||
|
||||
s16 WallpaperPasswordBank_GetIndexOfWord(struct WallpaperPasswordBank *unk, int value) {
|
||||
int i;
|
||||
|
||||
GF_ASSERT(unk != NULL);
|
||||
for (i = 0; i < unk->count; i++) {
|
||||
if (value == unk->words[i]) {
|
||||
s16 WallpaperPasswordBank_GetIndexOfWord(WallpaperPasswordBank *wallpaperPasswordBank, s32 word) {
|
||||
GF_ASSERT(wallpaperPasswordBank != NULL);
|
||||
for (s32 i = 0; i < wallpaperPasswordBank->count; i++) {
|
||||
if (word == wallpaperPasswordBank->words[i]) {
|
||||
return i;
|
||||
}
|
||||
}
|
||||
|
||||
return -1;
|
||||
return EC_WORD_NULL;
|
||||
}
|
||||
|
||||
u16 EasyChat_GetMsgBankForGroup(int category) {
|
||||
u16 EasyChat_GetMsgBankForGroup(s32 category) {
|
||||
if (category >= EC_GROUP_MAX) {
|
||||
category = 0;
|
||||
}
|
||||
@ -305,39 +298,32 @@ u16 EasyChat_GetMsgBankForGroup(int category) {
|
||||
// However, they are unlinked in heartgold and deadstripped in linktime.
|
||||
// The only reason why there's any code in here at all is because these
|
||||
// functions can be found in Diamond and Pearl.
|
||||
s32 GetDuplicateWordNum(ecword_t a0) {
|
||||
s32 r3;
|
||||
s32 r4;
|
||||
|
||||
for (r3 = 0; r3 < NELEMS(sIdenticalPhrases); r3++) {
|
||||
for (r4 = 0; r4 < sIdenticalPhrases[r3].count; r4++) {
|
||||
if (a0 == sIdenticalPhrases[r3].data[r4]) {
|
||||
return sIdenticalPhrases[r3].count - 1;
|
||||
s32 GetDuplicateWordNum(ecword_t word) {
|
||||
for (s32 i = 0; i < NELEMS(sIdenticalPhrases); i++) {
|
||||
for (s32 j = 0; j < sIdenticalPhrases[i].count; j++) {
|
||||
if (word == sIdenticalPhrases[i].data[j]) {
|
||||
return sIdenticalPhrases[i].count - 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
ecword_t RemapDuplicateWord(ecword_t a0, s32 a1) {
|
||||
s32 r7;
|
||||
s32 r2;
|
||||
s32 r0;
|
||||
|
||||
for (r7 = 0; r7 < NELEMS(sIdenticalPhrases); r7++) {
|
||||
for (r2 = 0; r2 < sIdenticalPhrases[r7].count; r2++) {
|
||||
if (a0 == sIdenticalPhrases[r7].data[r2]) {
|
||||
ecword_t RemapDuplicateWord(ecword_t word, s32 target) {
|
||||
for (s32 phrases = 0; phrases < NELEMS(sIdenticalPhrases); phrases++) {
|
||||
for (s32 phraseCount = 0; phraseCount < sIdenticalPhrases[phrases].count; phraseCount++) {
|
||||
if (word == sIdenticalPhrases[phrases].data[phraseCount]) {
|
||||
// ERROR: Infinite loop when reached
|
||||
for (r0 = 0; /*r0 <*/ sIdenticalPhrases[r7].count; r0++) {
|
||||
if (a1 == 0) {
|
||||
return sIdenticalPhrases[r7].data[r0];
|
||||
for (s32 targetCount = 0; /*targetCount <*/ sIdenticalPhrases[phrases].count; targetCount++) {
|
||||
if (target == 0) {
|
||||
return sIdenticalPhrases[phrases].data[targetCount];
|
||||
}
|
||||
a1--;
|
||||
target--;
|
||||
}
|
||||
GF_ASSERT(0);
|
||||
GF_ASSERT(FALSE);
|
||||
return EC_WORD_NULL;
|
||||
}
|
||||
}
|
||||
}
|
||||
return a0;
|
||||
return word;
|
||||
}
|
||||
|
@ -116,18 +116,18 @@ void PrintErrorMessageAndReset(void) {
|
||||
GXS_SetVisibleWnd(0);
|
||||
GX_SetBanks(&sErrorMessageBanksConfig);
|
||||
|
||||
BgConfig* bg_config = BgConfig_Alloc(HEAP_ID_0);
|
||||
BgConfig* bg_config = BgConfig_Alloc(HEAP_ID_DEFAULT);
|
||||
SetBothScreensModesAndDisable(&sErrorMessageBgModeSet);
|
||||
InitBgFromTemplate(bg_config, 0, &sErrorMessageBgTemplate, GX_BGMODE_0);
|
||||
BgClearTilemapBufferAndCommit(bg_config, GF_BG_LYR_MAIN_0);
|
||||
LoadUserFrameGfx1(bg_config, GF_BG_LYR_MAIN_0, 0x1F7, 2, 0, HEAP_ID_0);
|
||||
LoadFontPal0(GF_BG_LYR_MAIN_0, 0x20, HEAP_ID_0);
|
||||
BG_ClearCharDataRange(GF_BG_LYR_MAIN_0, 0x20, 0, HEAP_ID_0);
|
||||
LoadUserFrameGfx1(bg_config, GF_BG_LYR_MAIN_0, 0x1F7, 2, 0, HEAP_ID_DEFAULT);
|
||||
LoadFontPal0(GF_BG_LYR_MAIN_0, 0x20, HEAP_ID_DEFAULT);
|
||||
BG_ClearCharDataRange(GF_BG_LYR_MAIN_0, 0x20, 0, HEAP_ID_DEFAULT);
|
||||
BG_SetMaskColor(GF_BG_LYR_MAIN_0, RGB(1, 1, 27));
|
||||
BG_SetMaskColor(GF_BG_LYR_SUB_0, RGB(1, 1, 27));
|
||||
|
||||
MsgData* error_msgdata = NewMsgDataFromNarc(MSGDATA_LOAD_LAZY, NARC_msgdata_msg, NARC_msg_msg_0041_bin, HEAP_ID_0);
|
||||
String* error_str = String_New(384, HEAP_ID_0);
|
||||
MsgData* error_msgdata = NewMsgDataFromNarc(MSGDATA_LOAD_LAZY, NARC_msgdata_msg, NARC_msg_msg_0041_bin, HEAP_ID_DEFAULT);
|
||||
String* error_str = String_New(384, HEAP_ID_DEFAULT);
|
||||
|
||||
ResetAllTextPrinters();
|
||||
|
||||
|
@ -65,7 +65,7 @@ void FontID_SetAccessDirect(FontID fontId, HeapID heapId) {
|
||||
void FontID_SetAccessLazy(FontID fontId) {
|
||||
GF_ASSERT((int)fontId < FONT_NUM);
|
||||
GF_ASSERT(sFontWork->fontDataMan[fontId] != NULL);
|
||||
FontData_ModeSwitch(sFontWork->fontDataMan[fontId], FONTARC_MODE_LAZY, HEAP_ID_0);
|
||||
FontData_ModeSwitch(sFontWork->fontDataMan[fontId], FONTARC_MODE_LAZY, HEAP_ID_DEFAULT);
|
||||
}
|
||||
|
||||
void FontID_Release(FontID fontId) {
|
||||
|
@ -658,7 +658,7 @@ void SetEggStats(Pokemon *mon, int species, u8 metLocation, PlayerProfile *profi
|
||||
SetMonData(mon, MON_DATA_MET_GENDER, &gender);
|
||||
String_Delete(name);
|
||||
}
|
||||
MonSetTrainerMemo(mon, profile, a4, a5, HEAP_ID_0);
|
||||
MonSetTrainerMemo(mon, profile, a4, a5, HEAP_ID_DEFAULT);
|
||||
}
|
||||
|
||||
static void SetBreedEggStats(Pokemon *mon, u16 species, Daycare *dayCare, u32 otId, u8 form) {
|
||||
@ -1102,7 +1102,7 @@ void sub_0206D328(Pokemon *mon, HeapID heapId) {
|
||||
u8 metLevel = 0;
|
||||
sub_0206D038(mon, heapId);
|
||||
SetMonData(mon, MON_DATA_IS_EGG, &isEgg);
|
||||
GetSpeciesNameIntoArray(GetMonData(mon, MON_DATA_SPECIES, NULL), HEAP_ID_0, nickname);
|
||||
GetSpeciesNameIntoArray(GetMonData(mon, MON_DATA_SPECIES, NULL), HEAP_ID_DEFAULT, nickname);
|
||||
SetMonData(mon, MON_DATA_NICKNAME, nickname);
|
||||
SetMonData(mon, MON_DATA_HAS_NICKNAME, &hasNickname);
|
||||
SetMonData(mon, MON_DATA_POKEBALL, &pokeball);
|
||||
|
@ -29,7 +29,7 @@ void Save_HOF_RecordParty(HALL_OF_FAME *hof, PARTY *party, RTCDate *date) {
|
||||
if (hof->num_total < 9999) {
|
||||
HOFTEAM *team = &hof->parties[hof->next_record];
|
||||
int npokes = GetPartyCount(party);
|
||||
String *string = String_New(POKEMON_NAME_LENGTH + 1, HEAP_ID_0);
|
||||
String *string = String_New(POKEMON_NAME_LENGTH + 1, HEAP_ID_DEFAULT);
|
||||
int i, j;
|
||||
|
||||
MI_CpuClear16(team->party, sizeof(team->party));
|
||||
|
@ -101,7 +101,7 @@ u32 MailMsg_NumFields(u16 msg_bank, u16 msg_no) {
|
||||
|
||||
GF_ASSERT(msg_bank < NELEMS(sMessageBanks));
|
||||
GF_ASSERT(msg_no < MailMsg_NumMsgsInBank(msg_bank));
|
||||
msg = ReadMsgData_NewNarc_NewString(NARC_msgdata_msg, sMessageBanks[msg_bank], msg_no, HEAP_ID_0);
|
||||
msg = ReadMsgData_NewNarc_NewString(NARC_msgdata_msg, sMessageBanks[msg_bank], msg_no, HEAP_ID_DEFAULT);
|
||||
msg_cstr = String_cstr(msg);
|
||||
ret = 0;
|
||||
while (*msg_cstr != EOS) {
|
||||
|
@ -97,7 +97,7 @@ Pokedex *sub_02090D7C(Unk02090C94 *a0) {
|
||||
return a0->pokedex;
|
||||
}
|
||||
|
||||
SAVE_EASY_CHAT_T *sub_02090D80(Unk02090C94 *a0) {
|
||||
SaveEasyChat *sub_02090D80(Unk02090C94 *a0) {
|
||||
return a0->easyChat;
|
||||
}
|
||||
|
||||
|
@ -67,7 +67,7 @@ void NitroMain(void) {
|
||||
ShowWFCUserInfoWarning(HEAP_ID_3, 0);
|
||||
}
|
||||
if (!Save_FlashChipIsDetected(_02111868.unk_10.savedata)) {
|
||||
ShowSaveDataReadError(HEAP_ID_0);
|
||||
ShowSaveDataReadError(HEAP_ID_DEFAULT);
|
||||
} else {
|
||||
switch (OS_GetResetParameter()) {
|
||||
case 0:
|
||||
@ -146,7 +146,7 @@ void Main_RunOverlayManager(void) {
|
||||
HandleLoadOverlay(_02111868.queuedMainOverlayId, OVY_LOAD_NORMAL);
|
||||
}
|
||||
_02111868.mainOverlayId = _02111868.queuedMainOverlayId;
|
||||
_02111868.overlayManager = OverlayManager_New(_02111868.queuedMainOverlayTemplate, &_02111868.unk_10, HEAP_ID_0);
|
||||
_02111868.overlayManager = OverlayManager_New(_02111868.queuedMainOverlayTemplate, &_02111868.unk_10, HEAP_ID_DEFAULT);
|
||||
_02111868.queuedMainOverlayId = FS_OVERLAY_ID_NONE;
|
||||
_02111868.queuedMainOverlayTemplate = NULL;
|
||||
}
|
||||
@ -239,7 +239,7 @@ void sub_02000FD8(u32 a0, int a1) {
|
||||
}
|
||||
}
|
||||
}
|
||||
ShowCommunicationError(HEAP_ID_0, r5, 0);
|
||||
ShowCommunicationError(HEAP_ID_DEFAULT, r5, 0);
|
||||
sub_02038D90();
|
||||
sub_02000F14();
|
||||
DoSoundUpdateFrame();
|
||||
|
@ -70,7 +70,7 @@ static void ReadMsgData_ExistingTable_ExistingString(MAT * table, u32 num, Strin
|
||||
if (num < table->count) {
|
||||
alloc = table->alloc[num];
|
||||
Decrypt1(&alloc, num, table->key);
|
||||
buf = AllocFromHeapAtEnd(HEAP_ID_0, 2 * alloc.length);
|
||||
buf = AllocFromHeapAtEnd(HEAP_ID_DEFAULT, 2 * alloc.length);
|
||||
if (buf != NULL) {
|
||||
MI_CpuCopy16((char *)table + alloc.offset, buf, 2 * alloc.length);
|
||||
Decrypt2(buf, alloc.length, num);
|
||||
@ -278,7 +278,7 @@ void GetSpeciesNameIntoArray(u16 species, HeapID heapId, u16 * dest) {
|
||||
|
||||
String * ReadMsgData_ExpandPlaceholders(MessageFormat * messageFormat, MsgData * msgData, u32 msgno, HeapID heapId) {
|
||||
String * ret = NULL;
|
||||
String * r4 = String_New(1024, HEAP_ID_0);
|
||||
String * r4 = String_New(1024, HEAP_ID_DEFAULT);
|
||||
String * r5;
|
||||
if (r4 != NULL) {
|
||||
r5 = NewString_ReadMsgData(msgData, msgno);
|
||||
|
@ -108,7 +108,7 @@ BOOL Party_SwapSlots(PARTY *party, int slotA, int slotB) {
|
||||
|
||||
PARTY_ASSERT_SLOT(party, slotA);
|
||||
PARTY_ASSERT_SLOT(party, slotB);
|
||||
tmp_POKEMON = AllocFromHeap(HEAP_ID_0, sizeof(Pokemon));
|
||||
tmp_POKEMON = AllocFromHeap(HEAP_ID_DEFAULT, sizeof(Pokemon));
|
||||
*tmp_POKEMON = party->core.mons[slotA];
|
||||
party->core.mons[slotA] = party->core.mons[slotB];
|
||||
party->core.mons[slotB] = *tmp_POKEMON;
|
||||
|
@ -173,7 +173,7 @@ void CreateMon(Pokemon *mon, int species, int level, int fixedIV, int hasFixedPe
|
||||
MonEncryptSegment((u16 *)&mon->party, sizeof(mon->party), 0);
|
||||
ENCRYPT_PTY(mon);
|
||||
SetMonData(mon, MON_DATA_LEVEL, &level);
|
||||
mail = Mail_New(HEAP_ID_0);
|
||||
mail = Mail_New(HEAP_ID_DEFAULT);
|
||||
SetMonData(mon, MON_DATA_MAIL_STRUCT, mail);
|
||||
FreeToHeap(mail);
|
||||
capsule = 0;
|
||||
@ -354,7 +354,7 @@ void CalcMonStats(Pokemon *mon) {
|
||||
form = (int)GetMonData(mon, MON_DATA_FORM, NULL);
|
||||
species = (int)GetMonData(mon, MON_DATA_SPECIES, NULL);
|
||||
|
||||
baseStats = (BASE_STATS *)AllocFromHeap(HEAP_ID_0, sizeof(BASE_STATS));
|
||||
baseStats = (BASE_STATS *)AllocFromHeap(HEAP_ID_DEFAULT, sizeof(BASE_STATS));
|
||||
LoadMonBaseStats_HandleAlternateForm(species, form, baseStats);
|
||||
|
||||
if (species == SPECIES_SHEDINJA) {
|
||||
@ -732,7 +732,7 @@ static u32 GetBoxMonDataInternal(BoxPokemon *boxMon, int attr, void * dest) {
|
||||
break;
|
||||
case MON_DATA_NICKNAME:
|
||||
if (boxMon->checksum_fail) {
|
||||
GetSpeciesNameIntoArray(SPECIES_MANAPHY_EGG, HEAP_ID_0, dest);
|
||||
GetSpeciesNameIntoArray(SPECIES_MANAPHY_EGG, HEAP_ID_DEFAULT, dest);
|
||||
} else {
|
||||
u16 * dest16 = (u16 *)dest;
|
||||
for (ret = 0; ret < POKEMON_NAME_LENGTH; ret++) {
|
||||
@ -746,7 +746,7 @@ static u32 GetBoxMonDataInternal(BoxPokemon *boxMon, int attr, void * dest) {
|
||||
// fallthrough
|
||||
case MON_DATA_NICKNAME_3:
|
||||
if (boxMon->checksum_fail) {
|
||||
String * buffer = GetSpeciesName(SPECIES_MANAPHY_EGG, HEAP_ID_0);
|
||||
String * buffer = GetSpeciesName(SPECIES_MANAPHY_EGG, HEAP_ID_DEFAULT);
|
||||
String_Copy(dest, buffer);
|
||||
String_Delete(buffer);
|
||||
} else {
|
||||
@ -865,13 +865,13 @@ static u32 GetBoxMonDataInternal(BoxPokemon *boxMon, int attr, void * dest) {
|
||||
case MON_DATA_TYPE_1:
|
||||
case MON_DATA_TYPE_2:
|
||||
if (blockA->species == SPECIES_ARCEUS && blockA->ability == ABILITY_MULTITYPE) {
|
||||
ret = (u32)GetArceusTypeByHeldItemEffect((u16) GetItemAttr(blockA->heldItem, ITEMATTR_HOLD_EFFECT, HEAP_ID_0));
|
||||
ret = (u32)GetArceusTypeByHeldItemEffect((u16) GetItemAttr(blockA->heldItem, ITEMATTR_HOLD_EFFECT, HEAP_ID_DEFAULT));
|
||||
} else {
|
||||
ret = (u32)GetMonBaseStat_HandleAlternateForm(blockA->species, blockB->alternateForm, (enum BaseStat)(attr - MON_DATA_TYPE_1 + BASE_TYPE1));
|
||||
}
|
||||
break;
|
||||
case MON_DATA_SPECIES_NAME:
|
||||
GetSpeciesNameIntoArray(blockA->species, HEAP_ID_0, dest);
|
||||
GetSpeciesNameIntoArray(blockA->species, HEAP_ID_DEFAULT, dest);
|
||||
break;
|
||||
case MON_DATA_SHINY_LEAF_A:
|
||||
case MON_DATA_SHINY_LEAF_B:
|
||||
@ -1200,7 +1200,7 @@ static void SetBoxMonDataInternal(BoxPokemon *boxMon, int attr, const void * val
|
||||
blockB->Unused = VALUE(u16);
|
||||
break;
|
||||
case MON_DATA_NICKNAME_2:
|
||||
GetSpeciesNameIntoArray(blockA->species, HEAP_ID_0, namebuf);
|
||||
GetSpeciesNameIntoArray(blockA->species, HEAP_ID_DEFAULT, namebuf);
|
||||
blockB->isNicknamed = StringNotEqual(namebuf, value);
|
||||
// fallthrough
|
||||
case MON_DATA_NICKNAME:
|
||||
@ -1209,7 +1209,7 @@ static void SetBoxMonDataInternal(BoxPokemon *boxMon, int attr, const void * val
|
||||
}
|
||||
break;
|
||||
case MON_DATA_NICKNAME_4:
|
||||
GetSpeciesNameIntoArray(blockA->species, HEAP_ID_0, namebuf2);
|
||||
GetSpeciesNameIntoArray(blockA->species, HEAP_ID_DEFAULT, namebuf2);
|
||||
CopyStringToU16Array(value, namebuf3, POKEMON_NAME_LENGTH + 1);
|
||||
blockB->isNicknamed = StringNotEqual(namebuf2, namebuf3);
|
||||
// fallthrough
|
||||
@ -1328,7 +1328,7 @@ static void SetBoxMonDataInternal(BoxPokemon *boxMon, int attr, const void * val
|
||||
blockB->spdefIV = (VALUE(u32) >> 25) & 0x1F;
|
||||
break;
|
||||
case MON_DATA_SPECIES_NAME:
|
||||
speciesName = GetSpeciesName(blockA->species, HEAP_ID_0);
|
||||
speciesName = GetSpeciesName(blockA->species, HEAP_ID_DEFAULT);
|
||||
CopyStringToU16Array(speciesName, blockC->nickname, POKEMON_NAME_LENGTH + 1);
|
||||
String_Delete(speciesName);
|
||||
break;
|
||||
@ -1843,7 +1843,7 @@ void FreeMonPersonal(BASE_STATS * personal) {
|
||||
|
||||
int GetMonBaseStat_HandleAlternateForm(int species, int form, BaseStat attr) {
|
||||
int ret;
|
||||
BASE_STATS * personal = AllocAndLoadMonPersonal(ResolveMonForm(species, form), HEAP_ID_0);
|
||||
BASE_STATS * personal = AllocAndLoadMonPersonal(ResolveMonForm(species, form), HEAP_ID_DEFAULT);
|
||||
ret = GetPersonalAttr(personal, attr);
|
||||
FreeMonPersonal(personal);
|
||||
return ret;
|
||||
@ -1851,7 +1851,7 @@ int GetMonBaseStat_HandleAlternateForm(int species, int form, BaseStat attr) {
|
||||
|
||||
int GetMonBaseStat(int species, BaseStat attr) {
|
||||
int ret;
|
||||
BASE_STATS * personal = AllocAndLoadMonPersonal(species, HEAP_ID_0);
|
||||
BASE_STATS * personal = AllocAndLoadMonPersonal(species, HEAP_ID_DEFAULT);
|
||||
ret = GetPersonalAttr(personal, attr);
|
||||
FreeMonPersonal(personal);
|
||||
return ret;
|
||||
@ -1860,7 +1860,7 @@ int GetMonBaseStat(int species, BaseStat attr) {
|
||||
int GetMonBaseStatEx_HandleAlternateForm(NARC *narc, int species, int form, BaseStat attr) {
|
||||
int resolved = ResolveMonForm(species, form);
|
||||
int ret;
|
||||
BASE_STATS *buf = AllocFromHeap(HEAP_ID_0, sizeof(BASE_STATS));
|
||||
BASE_STATS *buf = AllocFromHeap(HEAP_ID_DEFAULT, sizeof(BASE_STATS));
|
||||
NARC_ReadWholeMember(narc, resolved, buf);
|
||||
ret = GetPersonalAttr(buf, attr);
|
||||
FreeToHeap(buf);
|
||||
@ -1910,7 +1910,7 @@ u32 GetExpByGrowthRateAndLevel(int growthRate, int level) {
|
||||
u32 ret;
|
||||
GF_ASSERT(growthRate < 8);
|
||||
GF_ASSERT(level <= MAX_LEVEL + 1);
|
||||
table = (u32 *)AllocFromHeap(HEAP_ID_0, (MAX_LEVEL + 1) * sizeof(u32));
|
||||
table = (u32 *)AllocFromHeap(HEAP_ID_DEFAULT, (MAX_LEVEL + 1) * sizeof(u32));
|
||||
LoadGrowthTable(growthRate, table);
|
||||
ret = table[level];
|
||||
FreeToHeap(table);
|
||||
@ -1931,7 +1931,7 @@ int CalcBoxMonLevel(BoxPokemon *boxMon) {
|
||||
|
||||
int CalcLevelBySpeciesAndExp(u16 species, u32 exp) {
|
||||
int level;
|
||||
BASE_STATS * personal = AllocAndLoadMonPersonal(species, HEAP_ID_0);
|
||||
BASE_STATS * personal = AllocAndLoadMonPersonal(species, HEAP_ID_DEFAULT);
|
||||
level = CalcLevelBySpeciesAndExp_PreloadedPersonal(personal, species, exp);
|
||||
FreeMonPersonal(personal);
|
||||
return level;
|
||||
@ -2046,7 +2046,7 @@ void MonApplyFriendshipMod(Pokemon *mon, u8 kind, u16 location) {
|
||||
if (species == SPECIES_NONE || species == SPECIES_EGG)
|
||||
return;
|
||||
|
||||
effect = (u8)GetItemAttr((u16)GetMonData(mon, MON_DATA_HELD_ITEM, NULL), ITEMATTR_HOLD_EFFECT, HEAP_ID_0);
|
||||
effect = (u8)GetItemAttr((u16)GetMonData(mon, MON_DATA_HELD_ITEM, NULL), ITEMATTR_HOLD_EFFECT, HEAP_ID_DEFAULT);
|
||||
tier = FRIENDSHIP_TIER_LOW;
|
||||
friendship = (s16)GetMonData(mon, MON_DATA_FRIENDSHIP, NULL);
|
||||
if (friendship >= FRIENDSHIP_TIER_MID_MIN)
|
||||
@ -2081,7 +2081,7 @@ u8 GetBoxMonGender(BoxPokemon *boxMon) {
|
||||
}
|
||||
|
||||
u8 GetGenderBySpeciesAndPersonality(u16 species, u32 pid) {
|
||||
BASE_STATS *personal = AllocAndLoadMonPersonal(species, HEAP_ID_0);
|
||||
BASE_STATS *personal = AllocAndLoadMonPersonal(species, HEAP_ID_DEFAULT);
|
||||
u8 gender = GetGenderBySpeciesAndPersonality_PreloadedPersonal(personal, species, pid);
|
||||
FreeMonPersonal(personal);
|
||||
return gender;
|
||||
@ -2802,7 +2802,7 @@ u16 GetMonEvolution(PARTY *party, Pokemon *mon, u8 context, u16 usedItem, int *m
|
||||
pid = GetMonData(mon, MON_DATA_PERSONALITY, NULL);
|
||||
beauty = GetMonData(mon, MON_DATA_BEAUTY, NULL);
|
||||
pid_hi = (u16)((pid & 0xFFFF0000) >> 16);
|
||||
holdEffect = GetItemAttr(heldItem, ITEMATTR_HOLD_EFFECT, HEAP_ID_0);
|
||||
holdEffect = GetItemAttr(heldItem, ITEMATTR_HOLD_EFFECT, HEAP_ID_DEFAULT);
|
||||
// Kadabra bypasses Everstone because he's just that broken.
|
||||
if (species != SPECIES_KADABRA && holdEffect == HOLD_EFFECT_NO_EVOLVE && context != EVOCTX_ITEM_USE) {
|
||||
return SPECIES_NONE;
|
||||
@ -2814,7 +2814,7 @@ u16 GetMonEvolution(PARTY *party, Pokemon *mon, u8 context, u16 usedItem, int *m
|
||||
if (method_ret == NULL) {
|
||||
method_ret = &method_local;
|
||||
}
|
||||
evoTable = AllocFromHeap(HEAP_ID_0, MAX_EVOS_PER_POKE * sizeof(struct Evolution));
|
||||
evoTable = AllocFromHeap(HEAP_ID_DEFAULT, MAX_EVOS_PER_POKE * sizeof(struct Evolution));
|
||||
LoadMonEvolutionTable(species, evoTable);
|
||||
switch (context) {
|
||||
case EVOCTX_LEVELUP:
|
||||
@ -3044,7 +3044,7 @@ void InitBoxMonMoveset(BoxPokemon *boxMon) {
|
||||
u32 form;
|
||||
u8 level;
|
||||
u16 move;
|
||||
wotbl = AllocFromHeap(HEAP_ID_0, 22 * sizeof(u16));
|
||||
wotbl = AllocFromHeap(HEAP_ID_DEFAULT, 22 * sizeof(u16));
|
||||
decry = AcquireBoxMonLock(boxMon);
|
||||
species = (u16)GetBoxMonData(boxMon, MON_DATA_SPECIES, NULL);
|
||||
form = GetBoxMonData(boxMon, MON_DATA_FORM, NULL);
|
||||
@ -3143,7 +3143,7 @@ void BoxMonSetMoveInSlot(BoxPokemon *boxMon, u16 move, u8 slot) {
|
||||
|
||||
u32 MonTryLearnMoveOnLevelUp(Pokemon *mon, int * last_i, u16 * sp0) {
|
||||
u32 ret = 0;
|
||||
u16 * wotbl = AllocFromHeap(HEAP_ID_0, 22 * sizeof(u16));
|
||||
u16 * wotbl = AllocFromHeap(HEAP_ID_DEFAULT, 22 * sizeof(u16));
|
||||
u16 species = (u16)GetMonData(mon, MON_DATA_SPECIES, NULL);
|
||||
u32 form = GetMonData(mon, MON_DATA_FORM, NULL);
|
||||
u8 level = (u8)GetMonData(mon, MON_DATA_LEVEL, NULL);
|
||||
@ -3237,7 +3237,7 @@ void CopyBoxPokemonToPokemon(const BoxPokemon *src, Pokemon *dest) {
|
||||
SetMonData(dest, MON_DATA_STATUS, &sp0);
|
||||
SetMonData(dest, MON_DATA_HP, &sp0);
|
||||
SetMonData(dest, MON_DATA_MAXHP, &sp0);
|
||||
mail = Mail_New(HEAP_ID_0);
|
||||
mail = Mail_New(HEAP_ID_DEFAULT);
|
||||
SetMonData(dest, MON_DATA_MAIL_STRUCT, mail);
|
||||
FreeToHeap(mail);
|
||||
SetMonData(dest, MON_DATA_CAPSULE, &sp0);
|
||||
@ -3300,7 +3300,7 @@ s8 GetFlavorPreferenceFromPID(u32 personality, int flavor) {
|
||||
|
||||
int Species_LoadLearnsetTable(u16 species, u32 form, u16 * dest) {
|
||||
int i;
|
||||
u16 * wotbl = AllocFromHeap(HEAP_ID_0, 22 * sizeof(u16));
|
||||
u16 * wotbl = AllocFromHeap(HEAP_ID_DEFAULT, 22 * sizeof(u16));
|
||||
LoadWotbl_HandleAlternateForm(species, (int)form, wotbl);
|
||||
for (i = 0; wotbl[i] != WOTBL_END; i++) {
|
||||
dest[i] = WOTBL_MOVE(wotbl[i]);
|
||||
@ -3450,7 +3450,7 @@ void BoxMon_UpdateArceusForm(BoxPokemon *boxMon) {
|
||||
u32 heldItem = GetBoxMonData(boxMon, MON_DATA_HELD_ITEM, NULL);
|
||||
u32 form;
|
||||
if (species == SPECIES_ARCEUS && ability == ABILITY_MULTITYPE) {
|
||||
form = GetArceusTypeByHeldItemEffect((u16)GetItemAttr((u16)heldItem, 1, HEAP_ID_0));
|
||||
form = GetArceusTypeByHeldItemEffect((u16)GetItemAttr((u16)heldItem, 1, HEAP_ID_DEFAULT));
|
||||
SetBoxMonData(boxMon, MON_DATA_FORM, &form);
|
||||
}
|
||||
}
|
||||
@ -3836,7 +3836,7 @@ void SetMonPersonality(Pokemon *mon, u32 personality) {
|
||||
PokemonDataBlockD * sp18;
|
||||
Pokemon *tmpMon;
|
||||
|
||||
tmpMon = AllocMonZeroed(HEAP_ID_0);
|
||||
tmpMon = AllocMonZeroed(HEAP_ID_DEFAULT);
|
||||
CopyPokemonToPokemon(mon, tmpMon);
|
||||
r4 = &GetSubstruct(&tmpMon->box, mon->box.pid, 0)->blockA;
|
||||
r6 = &GetSubstruct(&tmpMon->box, mon->box.pid, 1)->blockB;
|
||||
|
@ -36,7 +36,7 @@ void PCStorage_InitializeBoxes(PC_STORAGE *storage) {
|
||||
|
||||
storage->unlockedWallpapers = 0;
|
||||
|
||||
msgData = NewMsgDataFromNarc(MSGDATA_LOAD_LAZY, NARC_msgdata_msg, NARC_msg_msg_0024_bin, HEAP_ID_0);
|
||||
msgData = NewMsgDataFromNarc(MSGDATA_LOAD_LAZY, NARC_msgdata_msg, NARC_msg_msg_0024_bin, HEAP_ID_DEFAULT);
|
||||
if (msgData != NULL) {
|
||||
for (i = 0; i < NUM_BOXES; i++) {
|
||||
ReadMsgDataIntoU16Array(msgData, i + msg_0024_00006, storage->box_names[i]);
|
||||
|
@ -2688,7 +2688,7 @@ BOOL ScrCmd_264(ScriptContext *ctx) {
|
||||
MessageFormat **p_msgFmt = FieldSysGetAttrAddr(ctx->fsys, SCRIPTENV_MESSAGE_FORMAT);
|
||||
u16 r4 = ScriptReadHalfword(ctx);
|
||||
PlayerProfile *profile = Save_PlayerData_GetProfileAddr(FieldSystem_GetSaveDataPtr(ctx->fsys));
|
||||
SAVE_EASY_CHAT_T *easyChat = Save_EasyChat_Get(FieldSystem_GetSaveDataPtr(ctx->fsys));
|
||||
SaveEasyChat *easyChat = Save_EasyChat_Get(FieldSystem_GetSaveDataPtr(ctx->fsys));
|
||||
u16 objId;
|
||||
|
||||
if (r4 == 0) {
|
||||
@ -3866,7 +3866,7 @@ BOOL ScrCmd_538(ScriptContext *ctx) {
|
||||
u16 *p_ret = ScriptGetVarPointer(ctx);
|
||||
u16 wordIdx = ScriptGetVar(ctx);
|
||||
MessageFormat **p_msgFmt = FieldSysGetAttrAddr(ctx->fsys, SCRIPTENV_MESSAGE_FORMAT);
|
||||
int trendy = Save_EasyChat_RandomTrendySayingSet(Save_EasyChat_Get(ctx->fsys->savedata));
|
||||
int trendy = Save_EasyChat_SetRandomTrendySaying(Save_EasyChat_Get(ctx->fsys->savedata));
|
||||
if (trendy == 32) {
|
||||
*p_ret = 0xFFFF;
|
||||
return FALSE;
|
||||
|
@ -144,7 +144,7 @@ void InitSystemForTheGame(void) {
|
||||
gSystem.vblankCounter = 0;
|
||||
gSystem.screensFlipped = 0;
|
||||
CARD_SetCacheFlushThreshold(0x500, 0x2400);
|
||||
GF_CRC16Init(HEAP_ID_0);
|
||||
GF_CRC16Init(HEAP_ID_DEFAULT);
|
||||
}
|
||||
|
||||
void InitGraphicMemory(void) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user