summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPikalaxALT <pikalaxalt@gmail.com>2019-10-22 10:44:00 -0400
committerPikalaxALT <pikalaxalt@gmail.com>2019-10-22 10:44:00 -0400
commitaabb95139d236b57b52f17dac962cce2a694f162 (patch)
tree1a73a0a9693e5ebc38aed289273c1e0f505f1991
parentd51915bb0d658772c57178e28ab702ffcff018da (diff)
stab in the dark at documenting menews_jisan
-rw-r--r--asm/field_control_avatar.s2
-rw-r--r--data/maps/CeruleanCity_House4/scripts.inc40
-rw-r--r--data/specials.inc2
-rw-r--r--include/constants/vars.h2
-rw-r--r--include/global.h6
-rw-r--r--include/menews_jisan.h9
-rw-r--r--include/mevent.h2
-rw-r--r--src/menews_jisan.c73
-rw-r--r--src/mevent.c6
-rw-r--r--src/mystery_gift_menu.c6
10 files changed, 76 insertions, 72 deletions
diff --git a/asm/field_control_avatar.s b/asm/field_control_avatar.s
index aa66c7d5e..9c0677c09 100644
--- a/asm/field_control_avatar.s
+++ b/asm/field_control_avatar.s
@@ -364,7 +364,7 @@ sub_806CAC8: @ 806CAC8
beq _0806CB74
movs r0, 0x5
bl IncrementGameStat
- bl sub_8146CA4
+ bl MENewsJisanStepCounter
bl IncrementRenewableHiddenItemStepCounter
bl sub_80CC918
bl sub_80CB054
diff --git a/data/maps/CeruleanCity_House4/scripts.inc b/data/maps/CeruleanCity_House4/scripts.inc
index 9e4fc2749..afbb35c5f 100644
--- a/data/maps/CeruleanCity_House4/scripts.inc
+++ b/data/maps/CeruleanCity_House4/scripts.inc
@@ -7,31 +7,31 @@ CeruleanCity_House4_EventScript_16ACEF:: @ 816ACEF
goto_if eq, EventScript_1A7AE0
special sub_8112364
lock
- specialvar VAR_0x8004, sub_8146CE8
+ specialvar VAR_0x8004, Special_GetMENewsJisanItemAndState
copyvar VAR_0x8008, VAR_RESULT
compare_var_to_value VAR_0x8004, 0
- goto_if eq, EventScript_16AD59
+ goto_if eq, EventScript_CeruleanCity_House4_NoNews
compare_var_to_value VAR_0x8004, 1
- goto_if eq, EventScript_16AD63
+ goto_if eq, EventScript_CeruleanCity_House4_News1
compare_var_to_value VAR_0x8004, 2
- goto_if eq, EventScript_16AD89
+ goto_if eq, EventScript_CeruleanCity_House4_News2
compare_var_to_value VAR_0x8004, 3
- goto_if eq, EventScript_16ADAF
+ goto_if eq, EventScript_CeruleanCity_House4_NewsNotSpread
compare_var_to_value VAR_0x8004, 4
- goto_if eq, EventScript_16ADC3
+ goto_if eq, EventScript_CeruleanCity_House4_NewsSpread1
compare_var_to_value VAR_0x8004, 5
- goto_if eq, EventScript_16ADE9
+ goto_if eq, EventScript_CeruleanCity_House4_NewsSpread2
compare_var_to_value VAR_0x8004, 6
- goto_if eq, EventScript_16AE0F
+ goto_if eq, EventScript_CeruleanCity_House4_NewsDone
end
-EventScript_16AD59:: @ 816AD59
+EventScript_CeruleanCity_House4_NoNews:: @ 816AD59
msgbox gUnknown_8192AF0
release
end
-EventScript_16AD63:: @ 816AD63
- call EventScript_16AE23
+EventScript_CeruleanCity_House4_News1:: @ 816AD63
+ call EventScript_CeruleanCity_House4_MovementReactionToNews
msgbox gUnknown_8192B43
giveitem VAR_0x8008
compare_var_to_value VAR_RESULT, 0
@@ -39,8 +39,8 @@ EventScript_16AD63:: @ 816AD63
release
end
-EventScript_16AD89:: @ 816AD89
- call EventScript_16AE23
+EventScript_CeruleanCity_House4_News2:: @ 816AD89
+ call EventScript_CeruleanCity_House4_MovementReactionToNews
msgbox gUnknown_8192C07
giveitem VAR_0x8008, 4
compare_var_to_value VAR_RESULT, 0
@@ -48,15 +48,15 @@ EventScript_16AD89:: @ 816AD89
release
end
-EventScript_16ADAF:: @ 816ADAF
+EventScript_CeruleanCity_House4_NewsNotSpread:: @ 816ADAF
applymovement 1, Movement_1A75E1
waitmovement 0
msgbox gUnknown_8192CD5
release
end
-EventScript_16ADC3:: @ 816ADC3
- call EventScript_16AE23
+EventScript_CeruleanCity_House4_NewsSpread1:: @ 816ADC3
+ call EventScript_CeruleanCity_House4_MovementReactionToNews
msgbox gUnknown_8192D4B
giveitem VAR_0x8008
compare_var_to_value VAR_RESULT, 0
@@ -64,8 +64,8 @@ EventScript_16ADC3:: @ 816ADC3
release
end
-EventScript_16ADE9:: @ 816ADE9
- call EventScript_16AE23
+EventScript_CeruleanCity_House4_NewsSpread2:: @ 816ADE9
+ call EventScript_CeruleanCity_House4_MovementReactionToNews
msgbox gUnknown_8192DE3
giveitem VAR_0x8008, 4
compare_var_to_value VAR_RESULT, 0
@@ -73,14 +73,14 @@ EventScript_16ADE9:: @ 816ADE9
release
end
-EventScript_16AE0F:: @ 816AE0F
+EventScript_CeruleanCity_House4_NewsDone:: @ 816AE0F
applymovement 1, Movement_1A75E1
waitmovement 0
msgbox gUnknown_8192EC5
release
end
-EventScript_16AE23:: @ 816AE23
+EventScript_CeruleanCity_House4_MovementReactionToNews:: @ 816AE23
playse SE_PIN
applymovement 1, Movement_1A75DB
waitmovement 0
diff --git a/data/specials.inc b/data/specials.inc
index 9932ef2bd..3eeac52a0 100644
--- a/data/specials.inc
+++ b/data/specials.inc
@@ -402,7 +402,7 @@ gSpecials:: @ 815FD60
def_special Special_BattleCardAction
def_special sub_8110AB4
def_special sub_8112364
- def_special sub_8146CE8
+ def_special Special_GetMENewsJisanItemAndState
def_special get_unknown_box_id
def_special sub_809D504
def_special sub_809D620
diff --git a/include/constants/vars.h b/include/constants/vars.h
index 6c38e5ea5..327dbabc0 100644
--- a/include/constants/vars.h
+++ b/include/constants/vars.h
@@ -79,7 +79,7 @@
// Bits 12-15 are the same for the player's party.
// Used by Quest Log.
#define VAR_QUEST_LOG_MON_COUNTS 0x4027
-#define VAR_0x4028 0x4028
+#define VAR_MENEWS_JISAN_STEP_COUNTER 0x4028
#define VAR_0x4029 0x4029
#define VAR_HAPPINESS_STEP_COUNTER 0x402A
#define VAR_POISON_STEP_COUNTER 0x402B
diff --git a/include/global.h b/include/global.h
index 596f6b1d9..57035ce30 100644
--- a/include/global.h
+++ b/include/global.h
@@ -493,12 +493,12 @@ struct RecordMixingDayCareMail
bool16 holdsItem[DAYCARE_MON_COUNT];
};
-struct MysteryEventStruct
+struct MENewsJisanStruct
{
u8 unk_0_0:2;
u8 unk_0_2:3;
u8 unk_0_5:3;
- u8 unk_1;
+ u8 berry;
};
struct QuestLogNPCData
@@ -674,7 +674,7 @@ struct MEventBuffers
/*0x1c0 0x32e0*/ struct MEventBuffer_32E0 buffer_1c0;
/*0x310 0x3430*/ struct MEventBuffer_3430 buffer_310;
/*0x338 0x3458*/ u16 unk_338[4];
- /*0x340 0x3460*/ struct MysteryEventStruct unk_340;
+ /*0x340 0x3460*/ struct MENewsJisanStruct unk_340;
/*0x344 0x3464*/ u32 unk_344[2][5];
}; // 0x36C 0x348C
diff --git a/include/menews_jisan.h b/include/menews_jisan.h
index ca09d4347..277c8162b 100644
--- a/include/menews_jisan.h
+++ b/include/menews_jisan.h
@@ -3,8 +3,11 @@
#include "global.h"
-void GenerateRandomNews(u32 a0);
-void sub_8146C88(void);
-void sub_8146CA4(void);
+#define MENEWS_JISAN_NO_NEWS 0
+#define MENEWS_JISAN_
+
+void MENewsJisan_SetRandomReward(u32 a0);
+void MENewsJisanReset(void);
+void MENewsJisanStepCounter(void);
#endif //GUARD_MENEWS_JISAN_H
diff --git a/include/mevent.h b/include/mevent.h
index cee88e403..08ee8c038 100644
--- a/include/mevent.h
+++ b/include/mevent.h
@@ -36,7 +36,7 @@ struct MEvent_Str_2
struct MEventBuffer_3120_Sub * GetSavedWonderNews(void);
struct MEventBuffer_32E0_Sub * GetSavedWonderCard(void);
struct MEventBuffer_3430_Sub * sav1_get_mevent_buffer_2(void);
-struct MysteryEventStruct * sub_8143D94(void);
+struct MENewsJisanStruct * GetMENewsJisanStructPtr(void);
bool32 sub_8143DC8(const struct MEventBuffer_3120_Sub * src);
bool32 ValidateReceivedWonderNews(void);
bool32 ValidateReceivedWonderCard(void);
diff --git a/src/menews_jisan.c b/src/menews_jisan.c
index 4605b162b..f38de9cfd 100644
--- a/src/menews_jisan.c
+++ b/src/menews_jisan.c
@@ -3,16 +3,17 @@
#include "random.h"
#include "event_data.h"
#include "menews_jisan.h"
+#include "constants/items.h"
-static u32 sub_8146D74(struct MysteryEventStruct *);
-static void sub_8146DD8(struct MysteryEventStruct *);
-static u32 sub_8146E0C(struct MysteryEventStruct *);
-static void sub_8146DA0(struct MysteryEventStruct *);
-static void sub_8146D94(struct MysteryEventStruct *);
+static u32 GetMENewsJisanRewardItem(struct MENewsJisanStruct *);
+static void MENewsJisanIncrementCounterUnk0_5(struct MENewsJisanStruct *);
+static u32 GetMENewsJisanState(struct MENewsJisanStruct *);
+static void MENewsJisanIncrementCounterUnk0_2(struct MENewsJisanStruct *);
+static void MENewsJisanResetCounterUnk0_2(struct MENewsJisanStruct *);
-void GenerateRandomNews(u32 a0)
+void MENewsJisan_SetRandomReward(u32 a0)
{
- struct MysteryEventStruct *r5 = sub_8143D94();
+ struct MENewsJisanStruct *r5 = GetMENewsJisanStructPtr();
r5->unk_0_0 = a0;
switch (a0)
@@ -21,68 +22,68 @@ void GenerateRandomNews(u32 a0)
break;
case 1:
case 2:
- r5->unk_1 = (Random() % 15) + 16;
+ r5->berry = (Random() % 15) + ITEM_TO_BERRY(ITEM_RAZZ_BERRY);
break;
case 3:
- r5->unk_1 = (Random() % 15) + 1;
+ r5->berry = (Random() % 15) + ITEM_TO_BERRY(ITEM_CHERI_BERRY);
break;
}
}
-void sub_8146C88(void)
+void MENewsJisanReset(void)
{
- struct MysteryEventStruct *r5 = sub_8143D94();
+ struct MENewsJisanStruct *r5 = GetMENewsJisanStructPtr();
r5->unk_0_0 = 0;
r5->unk_0_2 = 0;
r5->unk_0_5 = 0;
- r5->unk_1 = 0;
- VarSet(VAR_0x4028, 0);
+ r5->berry = 0;
+ VarSet(VAR_MENEWS_JISAN_STEP_COUNTER, 0);
}
-void sub_8146CA4(void)
+void MENewsJisanStepCounter(void)
{
- u16 *r4 = GetVarPointer(VAR_0x4028);
- struct MysteryEventStruct *r2 = sub_8143D94();
- struct MysteryEventStruct r0 = *r2;
+ u16 *r4 = GetVarPointer(VAR_MENEWS_JISAN_STEP_COUNTER);
+ struct MENewsJisanStruct *r2 = GetMENewsJisanStructPtr();
+ struct MENewsJisanStruct r0 = *r2;
- if ((u8)r0.unk_0_5 > 4 && ++(*r4) > 0x1f3)
+ if ((u8)r0.unk_0_5 > 4 && ++(*r4) >= 500)
{
r2->unk_0_5 = 0;
*r4 = 0;
}
}
-u16 sub_8146CE8(void)
+u16 Special_GetMENewsJisanItemAndState(void)
{
u16 *r6 = &gSpecialVar_Result;
- struct MysteryEventStruct *r4 = sub_8143D94();
+ struct MENewsJisanStruct *r4 = GetMENewsJisanStructPtr();
u16 r5;
if (!IsMysteryGiftEnabled() || !ValidateReceivedWonderNews())
return 0;
- r5 = sub_8146E0C(r4);
+ r5 = GetMENewsJisanState(r4);
switch (r5)
{
case 0:
break;
case 1:
- *r6 = sub_8146D74(r4);
+ *r6 = GetMENewsJisanRewardItem(r4);
break;
case 2:
- *r6 = sub_8146D74(r4);
+ *r6 = GetMENewsJisanRewardItem(r4);
break;
case 3:
break;
case 4:
- *r6 = sub_8146D74(r4);
- sub_8146DA0(r4);
+ *r6 = GetMENewsJisanRewardItem(r4);
+ MENewsJisanIncrementCounterUnk0_2(r4);
break;
case 5:
- *r6 = sub_8146D74(r4);
- sub_8146D94(r4);
+ *r6 = GetMENewsJisanRewardItem(r4);
+ MENewsJisanResetCounterUnk0_2(r4);
break;
case 6:
break;
@@ -91,39 +92,39 @@ u16 sub_8146CE8(void)
return r5;
}
-static u32 sub_8146D74(struct MysteryEventStruct *a0)
+static u32 GetMENewsJisanRewardItem(struct MENewsJisanStruct *a0)
{
u32 r4;
a0->unk_0_0 = 0;
- r4 = a0->unk_1 + 0x84;
- a0->unk_1 = 0;
- sub_8146DD8(a0);
+ r4 = a0->berry + FIRST_BERRY_INDEX - 1;
+ a0->berry = 0;
+ MENewsJisanIncrementCounterUnk0_5(a0);
return r4;
}
-static void sub_8146D94(struct MysteryEventStruct *a0)
+static void MENewsJisanResetCounterUnk0_2(struct MENewsJisanStruct *a0)
{
a0->unk_0_2 = 0;
}
-static void sub_8146DA0(struct MysteryEventStruct *a0)
+static void MENewsJisanIncrementCounterUnk0_2(struct MENewsJisanStruct *a0)
{
a0->unk_0_2++;
if ((u8)a0->unk_0_2 > 4)
a0->unk_0_2 = 4;
}
-static void sub_8146DD8(struct MysteryEventStruct *a0)
+static void MENewsJisanIncrementCounterUnk0_5(struct MENewsJisanStruct *a0)
{
a0->unk_0_5++;
if ((u8)a0->unk_0_5 > 5)
a0->unk_0_5 = 5;
}
-static u32 sub_8146E0C(struct MysteryEventStruct *a0)
+static u32 GetMENewsJisanState(struct MENewsJisanStruct *a0)
{
- struct MysteryEventStruct r0;
+ struct MENewsJisanStruct r0;
if ((u8)a0->unk_0_5 == 5)
return 6;
diff --git a/src/mevent.c b/src/mevent.c
index f1c9d8a4c..c01ea8b41 100644
--- a/src/mevent.c
+++ b/src/mevent.c
@@ -505,7 +505,7 @@ struct MEventBuffer_3430_Sub * sav1_get_mevent_buffer_2(void)
return &gSaveBlock1Ptr->unk_3120.buffer_310.data;
}
-struct MysteryEventStruct * sub_8143D94(void)
+struct MENewsJisanStruct * GetMENewsJisanStructPtr(void)
{
return &gSaveBlock1Ptr->unk_3120.unk_340;
}
@@ -562,8 +562,8 @@ void sub_8143E9C(void)
void sub_8143ED0(void)
{
- CpuFill32(0, sub_8143D94(), sizeof(struct MysteryEventStruct));
- sub_8146C88();
+ CpuFill32(0, GetMENewsJisanStructPtr(), sizeof(struct MENewsJisanStruct));
+ MENewsJisanReset();
}
bool32 sub_8143EF4(const u8 * src)
diff --git a/src/mystery_gift_menu.c b/src/mystery_gift_menu.c
index 395c4e374..f76d70c04 100644
--- a/src/mystery_gift_menu.c
+++ b/src/mystery_gift_menu.c
@@ -1412,11 +1412,11 @@ void task00_mystery_gift(u8 taskId)
{
if (data->source == 1)
{
- GenerateRandomNews(1);
+ MENewsJisan_SetRandomReward(1);
}
else
{
- GenerateRandomNews(2);
+ MENewsJisan_SetRandomReward(2);
}
}
if (sp0 == 0)
@@ -1661,7 +1661,7 @@ void task00_mystery_gift(u8 taskId)
{
if (data->source == 1 && data->prevPromptWindowId == 3)
{
- GenerateRandomNews(3);
+ MENewsJisan_SetRandomReward(3);
data->state = 17;
}
else