through mevent_message
This commit is contained in:
+1
-1
@@ -59,7 +59,7 @@ u16 sub_8146CE8(void)
|
||||
struct MysteryEventStruct *r4 = sub_8143D94();
|
||||
u16 r5;
|
||||
|
||||
if (!sub_806E2BC() || !ValidateReceivedWonderCard())
|
||||
if (!sub_806E2BC() || !ValidateReceivedWonderNews())
|
||||
return 0;
|
||||
|
||||
r5 = sub_8146E0C(r4);
|
||||
|
||||
+10
-10
@@ -515,7 +515,7 @@ u16 * sub_8143DA8(void)
|
||||
return gSaveBlock1Ptr->unk_3120.unk_338;
|
||||
}
|
||||
|
||||
void sub_8143DBC(void)
|
||||
void DestroyWonderNews(void)
|
||||
{
|
||||
sub_8143E9C();
|
||||
}
|
||||
@@ -530,7 +530,7 @@ bool32 sub_8143DC8(const struct MEventBuffer_3120_Sub * src)
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
bool32 ValidateReceivedWonderCard(void)
|
||||
bool32 ValidateReceivedWonderNews(void)
|
||||
{
|
||||
if (CalcCRC16WithTable((void *)&gSaveBlock1Ptr->unk_3120.buffer_000.data, sizeof(struct MEventBuffer_3120_Sub)) != gSaveBlock1Ptr->unk_3120.buffer_000.crc)
|
||||
return FALSE;
|
||||
@@ -570,7 +570,7 @@ bool32 sub_8143EF4(const u8 * src)
|
||||
{
|
||||
const u8 * r5 = (const u8 *)&gSaveBlock1Ptr->unk_3120.buffer_000.data;
|
||||
u32 i;
|
||||
if (!ValidateReceivedWonderCard())
|
||||
if (!ValidateReceivedWonderNews())
|
||||
return FALSE;
|
||||
for (i = 0; i < sizeof(struct MEventBuffer_3120_Sub); i++)
|
||||
{
|
||||
@@ -580,7 +580,7 @@ bool32 sub_8143EF4(const u8 * src)
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
void sub_8143F38(void)
|
||||
void DestroyWonderCard(void)
|
||||
{
|
||||
sub_814407C();
|
||||
sub_81440B4();
|
||||
@@ -597,7 +597,7 @@ bool32 sub_8143F68(const struct MEventBuffer_32E0_Sub * data)
|
||||
struct MEventBuffer_32E0_Sub * r1;
|
||||
if (!sub_8144018(data))
|
||||
return FALSE;
|
||||
sub_8143F38();
|
||||
DestroyWonderCard();
|
||||
memcpy(&gSaveBlock1Ptr->unk_3120.buffer_1c0.data, data, sizeof(struct MEventBuffer_32E0_Sub));
|
||||
gSaveBlock1Ptr->unk_3120.buffer_1c0.crc = CalcCRC16WithTable((void *)&gSaveBlock1Ptr->unk_3120.buffer_1c0.data, sizeof(struct MEventBuffer_32E0_Sub));
|
||||
r2 = &gSaveBlock1Ptr->unk_3120.buffer_310.data;
|
||||
@@ -606,7 +606,7 @@ bool32 sub_8143F68(const struct MEventBuffer_32E0_Sub * data)
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
bool32 ValidateReceivedWonderNews(void)
|
||||
bool32 ValidateReceivedWonderCard(void)
|
||||
{
|
||||
if (gSaveBlock1Ptr->unk_3120.buffer_1c0.crc != CalcCRC16WithTable((void *)&gSaveBlock1Ptr->unk_3120.buffer_1c0.data, sizeof(struct MEventBuffer_32E0_Sub)))
|
||||
return FALSE;
|
||||
@@ -654,7 +654,7 @@ void sub_81440B4(void)
|
||||
|
||||
u16 sub_81440E8(void)
|
||||
{
|
||||
if (ValidateReceivedWonderNews())
|
||||
if (ValidateReceivedWonderCard())
|
||||
return gSaveBlock1Ptr->unk_3120.buffer_1c0.data.unk_00;
|
||||
return 0;
|
||||
}
|
||||
@@ -721,7 +721,7 @@ bool32 sub_81441F0(const u16 * data)
|
||||
s32 sub_8144218(void)
|
||||
{
|
||||
struct MEventBuffer_32E0_Sub * data;
|
||||
if (!ValidateReceivedWonderNews())
|
||||
if (!ValidateReceivedWonderCard())
|
||||
return 0;
|
||||
data = &gSaveBlock1Ptr->unk_3120.buffer_1c0.data;
|
||||
if (data->unk_08_0 != 1)
|
||||
@@ -759,7 +759,7 @@ void sub_81442CC(struct MEventStruct_Unk1442CC * data)
|
||||
data->unk_08 = 1;
|
||||
data->unk_0C = 1;
|
||||
data->unk_10 = 1;
|
||||
if (ValidateReceivedWonderNews())
|
||||
if (ValidateReceivedWonderCard())
|
||||
{
|
||||
data->unk_14 = GetSavedWonderCard()->unk_00;
|
||||
data->unk_20 = *sav1_get_mevent_buffer_2();
|
||||
@@ -945,7 +945,7 @@ bool32 sub_81446D0(u16 a0)
|
||||
gUnknown_203F3BC = FALSE;
|
||||
if (a0 == 0)
|
||||
return FALSE;
|
||||
if (!ValidateReceivedWonderNews())
|
||||
if (!ValidateReceivedWonderCard())
|
||||
return FALSE;
|
||||
if (gSaveBlock1Ptr->unk_3120.buffer_1c0.data.unk_00 != a0)
|
||||
return FALSE;
|
||||
|
||||
@@ -145,7 +145,7 @@ bool32 InitWonderCardResources(struct MEventBuffer_32E0_Sub * r5, struct MEventB
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
void sub_81456F0(void)
|
||||
void DestroyWonderCardResources(void)
|
||||
{
|
||||
if (gUnknown_203F3C8 != NULL)
|
||||
{
|
||||
@@ -219,7 +219,7 @@ s32 FadeToWonderCardMenu(void)
|
||||
return 0;
|
||||
}
|
||||
|
||||
s32 sub_814593C(bool32 flag)
|
||||
s32 FadeOutFromWonderCard(bool32 flag)
|
||||
{
|
||||
if (gUnknown_203F3C8 == NULL)
|
||||
return -1;
|
||||
@@ -523,7 +523,7 @@ bool32 InitWonderNewsResources(const struct MEventBuffer_3120_Sub * a0)
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
void sub_81462EC(void)
|
||||
void DestroyWonderNewsResources(void)
|
||||
{
|
||||
if (gUnknown_203F3CC != NULL)
|
||||
{
|
||||
@@ -608,7 +608,7 @@ s32 FadeToWonderNewsMenu(void)
|
||||
return 0;
|
||||
}
|
||||
|
||||
s32 sub_8146604(bool32 flag)
|
||||
s32 FadeOutFromWonderNews(bool32 flag)
|
||||
{
|
||||
if (gUnknown_203F3CC == NULL)
|
||||
return -1;
|
||||
|
||||
+189
-3
@@ -18,6 +18,7 @@
|
||||
#include "link_rfu.h"
|
||||
#include "string_util.h"
|
||||
#include "mevent.h"
|
||||
#include "save.h"
|
||||
#include "constants/songs.h"
|
||||
|
||||
EWRAM_DATA u8 sDownArrowCounterAndYCoordIdx[8] = {};
|
||||
@@ -33,7 +34,12 @@ extern const u8 gJPText_MysteryGift[];
|
||||
extern const u8 gJPText_DecideStop[];
|
||||
extern const u8 gText_WhatToDoWithCards[];
|
||||
extern const u8 gText_WhatToDoWithNews[];
|
||||
|
||||
extern const u8 gText_OkayToDiscardNews[];
|
||||
extern const u8 gText_IfThrowAwayCardEventWontHappen[];
|
||||
extern const u8 gText_WonderCardThrownAway[];
|
||||
extern const u8 gText_WonderNewsThrownAway[];
|
||||
extern const u8 gText_DataWillBeSaved[];
|
||||
extern const u8 gText_SaveCompletedPressA[];
|
||||
extern const u8 gText_WonderCards[];
|
||||
extern const u8 gText_WonderNews[];
|
||||
extern const u8 gText_Exit3[];
|
||||
@@ -47,6 +53,22 @@ extern const u8 gText_VarietyOfEventsImportedWireless[];
|
||||
extern const u8 gText_WonderCardsInPossession[];
|
||||
extern const u8 gText_ReadNewsThatArrived[];
|
||||
extern const u8 gText_ReturnToTitle[];
|
||||
extern const u8 gText_NothingSentOver[];
|
||||
extern const u8 gText_RecordUploadedViaWireless[];
|
||||
extern const u8 gText_WonderCardReceived[];
|
||||
extern const u8 gText_WonderCardReceivedFrom[];
|
||||
extern const u8 gText_WonderNewsReceived[];
|
||||
extern const u8 gText_WonderNewsReceivedFrom[];
|
||||
extern const u8 gText_NewStampReceived[];
|
||||
extern const u8 gText_AlreadyHadCard[];
|
||||
extern const u8 gText_AlreadyHadStamp[];
|
||||
extern const u8 gText_AlreadyHadNews[];
|
||||
extern const u8 gText_NoMoreRoomForStamps[];
|
||||
extern const u8 gText_CommunicationCanceled[];
|
||||
extern const u8 gText_CantAcceptCardFromTrainer[];
|
||||
extern const u8 gText_CantAcceptNewsFromTrainer[];
|
||||
extern const u8 gText_CommunicationError[];
|
||||
extern const u8 gText_NewTrainerReceived[];
|
||||
|
||||
const u16 gUnkTextboxBorderPal[] = INCBIN_U16("graphics/interface/unk_textbox_border.gbapal");
|
||||
const u32 gUnkTextboxBorderGfx[] = INCBIN_U32("graphics/interface/unk_textbox_border.4bpp.lz");
|
||||
@@ -806,11 +828,11 @@ bool32 ValidateCardOrNews(bool32 cardOrNews)
|
||||
{
|
||||
if (cardOrNews == 0)
|
||||
{
|
||||
return ValidateReceivedWonderNews();
|
||||
return ValidateReceivedWonderCard();
|
||||
}
|
||||
else
|
||||
{
|
||||
return ValidateReceivedWonderCard();
|
||||
return ValidateReceivedWonderNews();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -855,4 +877,168 @@ bool32 HandleLoadWonderCardOrNews(u8 * state, bool32 cardOrNews)
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
bool32 DestroyNewsOrCard(bool32 cardOrNews)
|
||||
{
|
||||
if (cardOrNews == 0)
|
||||
{
|
||||
DestroyWonderCard();
|
||||
}
|
||||
else
|
||||
{
|
||||
DestroyWonderNews();
|
||||
}
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
bool32 TearDownCardOrNews_ReturnToTopMenu(bool32 cardOrNews, bool32 arg1)
|
||||
{
|
||||
if (cardOrNews == 0)
|
||||
{
|
||||
if (FadeOutFromWonderCard(arg1) != 0)
|
||||
{
|
||||
DestroyWonderCardResources();
|
||||
return TRUE;
|
||||
}
|
||||
else
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (FadeOutFromWonderNews(arg1) != 0)
|
||||
{
|
||||
DestroyWonderNewsResources();
|
||||
return TRUE;
|
||||
}
|
||||
else
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
s32 mevent_message_prompt_discard(u8 * textState, u16 * windowId, bool32 cardOrNews)
|
||||
{
|
||||
if (cardOrNews == 0)
|
||||
{
|
||||
return mevent_message_print_and_prompt_yes_no(textState, windowId, TRUE, gText_IfThrowAwayCardEventWontHappen);
|
||||
}
|
||||
else
|
||||
{
|
||||
return mevent_message_print_and_prompt_yes_no(textState, windowId, TRUE, gText_OkayToDiscardNews);
|
||||
}
|
||||
}
|
||||
|
||||
bool32 mevent_message_was_thrown_away(u8 * textState, bool32 cardOrNews)
|
||||
{
|
||||
if (cardOrNews == 0)
|
||||
{
|
||||
return MG_PrintTextOnWindow1AndWaitButton(textState, gText_WonderCardThrownAway);
|
||||
}
|
||||
else
|
||||
{
|
||||
return MG_PrintTextOnWindow1AndWaitButton(textState, gText_WonderNewsThrownAway);
|
||||
}
|
||||
}
|
||||
|
||||
bool32 mevent_save_game(u8 * state)
|
||||
{
|
||||
switch (*state)
|
||||
{
|
||||
case 0:
|
||||
AddTextPrinterToWindow1(gText_DataWillBeSaved);
|
||||
(*state)++;
|
||||
break;
|
||||
case 1:
|
||||
TrySavingData(0);
|
||||
(*state)++;
|
||||
break;
|
||||
case 2:
|
||||
AddTextPrinterToWindow1(gText_SaveCompletedPressA);
|
||||
(*state)++;
|
||||
break;
|
||||
case 3:
|
||||
if (JOY_NEW(A_BUTTON | B_BUTTON))
|
||||
{
|
||||
(*state)++;
|
||||
}
|
||||
break;
|
||||
case 4:
|
||||
*state = 0;
|
||||
ClearTextWindow();
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
const u8 * mevent_message(u32 * flag_p, u8 cardOrNews, u8 cardOrNewsSource, u32 msgId)
|
||||
{
|
||||
const u8 * msg = NULL;
|
||||
*flag_p = 0;
|
||||
|
||||
switch (msgId)
|
||||
{
|
||||
case 0:
|
||||
*flag_p = 0;
|
||||
msg = gText_NothingSentOver;
|
||||
break;
|
||||
case 1:
|
||||
*flag_p = 0;
|
||||
msg = gText_RecordUploadedViaWireless;
|
||||
break;
|
||||
case 2:
|
||||
*flag_p = 1;
|
||||
msg = cardOrNewsSource == 0 ? gText_WonderCardReceived : gText_WonderCardReceivedFrom;
|
||||
break;
|
||||
case 3:
|
||||
*flag_p = 1;
|
||||
msg = cardOrNewsSource == 0 ? gText_WonderNewsReceived : gText_WonderNewsReceivedFrom;
|
||||
break;
|
||||
case 4:
|
||||
*flag_p = 1;
|
||||
msg = gText_NewStampReceived;
|
||||
break;
|
||||
case 5:
|
||||
*flag_p = 0;
|
||||
msg = gText_AlreadyHadCard;
|
||||
break;
|
||||
case 6:
|
||||
*flag_p = 0;
|
||||
msg = gText_AlreadyHadStamp;
|
||||
break;
|
||||
case 7:
|
||||
*flag_p = 0;
|
||||
msg = gText_AlreadyHadNews;
|
||||
break;
|
||||
case 8:
|
||||
*flag_p = 0;
|
||||
msg = gText_NoMoreRoomForStamps;
|
||||
break;
|
||||
case 9:
|
||||
*flag_p = 0;
|
||||
msg = gText_CommunicationCanceled;
|
||||
break;
|
||||
case 10:
|
||||
*flag_p = 0;
|
||||
msg = cardOrNews == 0 ? gText_CantAcceptCardFromTrainer : gText_CantAcceptNewsFromTrainer;
|
||||
break;
|
||||
case 11:
|
||||
*flag_p = 0;
|
||||
msg = gText_CommunicationError;
|
||||
break;
|
||||
case 12:
|
||||
*flag_p = 1;
|
||||
msg = gText_NewTrainerReceived;
|
||||
break;
|
||||
case 13:
|
||||
*flag_p = 1;
|
||||
break;
|
||||
case 14:
|
||||
*flag_p = 0;
|
||||
break;
|
||||
}
|
||||
|
||||
return msg;
|
||||
}
|
||||
|
||||
+2
-2
@@ -9,7 +9,7 @@ extern u8 gUnknown_203ADFA;
|
||||
|
||||
extern void sub_80CBDE8(void); // field_specials
|
||||
extern u16 CalcCRC16WithTable(u8 *data, int length); // util
|
||||
extern bool32 ValidateReceivedWonderNews(void); // mevent
|
||||
extern bool32 ValidateReceivedWonderCard(void); // mevent
|
||||
|
||||
enum
|
||||
{
|
||||
@@ -525,7 +525,7 @@ bool32 sub_8069DFC(void)
|
||||
u8 *sub_8069E48(void)
|
||||
{
|
||||
struct RamScriptData *scriptData = &gSaveBlock1Ptr->ramScript.data;
|
||||
if (!ValidateReceivedWonderNews())
|
||||
if (!ValidateReceivedWonderCard())
|
||||
return NULL;
|
||||
if (scriptData->magic != RAM_SCRIPT_MAGIC)
|
||||
return NULL;
|
||||
|
||||
Reference in New Issue
Block a user