mirror of
https://github.com/pret/pokeplatinum.git
synced 2026-03-21 17:55:13 -05:00
Document unk_0204B830 as scrcmd_mystery_gift
This commit is contained in:
parent
359b6c6407
commit
9626f1d005
|
|
@ -12,6 +12,7 @@
|
|||
#include "generated/mart_seal_id.h"
|
||||
#include "generated/mart_specialties_id.h"
|
||||
#include "generated/moves.h"
|
||||
#include "generated/mystery_gift_delivery_stages.h"
|
||||
#include "generated/npc_trades.h"
|
||||
#include "generated/poketch_apps.h"
|
||||
#include "generated/roaming_slots.h"
|
||||
|
|
@ -3204,19 +3205,66 @@
|
|||
.short \arg4
|
||||
.endm
|
||||
|
||||
.macro ScrCmd_23E arg0, arg1=0, arg2=0
|
||||
/* See the convenience macro below for the uses of destVar1 & destVar2 */
|
||||
.macro MysteryGiftGive stage, destVar1ID=0, destVar2ID=0
|
||||
.short 574
|
||||
.short \arg0
|
||||
.if \arg0 == 1 || \arg0 == 2 || \arg0 == 3
|
||||
.short \arg1
|
||||
.short \stage
|
||||
.if \stage == MYSTERY_GIFT_CHECK_AVAILABLE_PGT || \stage == MYSTERY_GIFT_GET_PGT_TYPE || \stage == MYSTERY_GIFT_CHECK_CAN_RECEIVE
|
||||
.short \destVar1ID
|
||||
.else
|
||||
.if \arg0 == 5 || \arg0 == 6
|
||||
.short \arg1
|
||||
.short \arg2
|
||||
.if \stage == MYSTERY_GIFT_RECEIVED || \stage == MYSTERY_GIFT_CANT_RECEIVE
|
||||
.short \destVar1ID
|
||||
.short \destVar2ID
|
||||
.endif
|
||||
.endif
|
||||
.endm
|
||||
|
||||
.macro LoadMysteryGift
|
||||
MysteryGiftGive MYSTERY_GIFT_LOAD
|
||||
.endm
|
||||
|
||||
.macro CheckAvailableMysteryGift destVarID
|
||||
MysteryGiftGive MYSTERY_GIFT_CHECK_AVAILABLE_PGT, \destVarID
|
||||
.endm
|
||||
|
||||
.macro GetMysteryGiftType destVarID
|
||||
MysteryGiftGive MYSTERY_GIFT_GET_PGT_TYPE, \destVarID
|
||||
.endm
|
||||
|
||||
.macro CheckCanReceiveMysteryGift destVarID
|
||||
MysteryGiftGive MYSTERY_GIFT_CHECK_CAN_RECEIVE, \destVarID
|
||||
.endm
|
||||
|
||||
.macro GiveMysteryGift
|
||||
MysteryGiftGive MYSTERY_GIFT_GIVE
|
||||
.endm
|
||||
|
||||
/*
|
||||
* Loads necessary information about the mystery gift into the script's
|
||||
* string loader and returns the text bank and entry ID of the message
|
||||
* to be displayed after the player receives the mystery gift.
|
||||
*/
|
||||
.macro PrepareMysteryGiftReceivedMsg destTextBank, destStringID
|
||||
MysteryGiftGive MYSTERY_GIFT_RECEIVED, \destTextBank, \destStringID
|
||||
.endm
|
||||
|
||||
/*
|
||||
* Loads necessary information about the mystery gift into the script's
|
||||
* string loader and returns the text bank and entry ID of the message
|
||||
* to be displayed if the player can't receive the mystery gift.
|
||||
*/
|
||||
.macro PrepareMysterGiftCantReceiveMsg destTextBank, destStringID
|
||||
MysteryGiftGive MYSTERY_GIFT_CANT_RECEIVE, \destTextBank, \destStringID
|
||||
.endm
|
||||
|
||||
.macro UnloadMysteryGift
|
||||
MysteryGiftGive MYSTERY_GIFT_UNLOAD_RECEIVED
|
||||
.endm
|
||||
|
||||
.macro UnloadMysteryGift2
|
||||
MysteryGiftGive MYSTERY_GIFT_UNLOAD_NOT_RECEIVED
|
||||
.endm
|
||||
|
||||
.macro Dummy23F
|
||||
.short 575
|
||||
.endm
|
||||
|
|
|
|||
|
|
@ -94,6 +94,7 @@ metang_generators = {
|
|||
'mart_decor_id': {'type': 'enum', 'tag': 'MartDecorID'},
|
||||
'mart_seal_id': {'type': 'enum', 'tag': 'MartSealID'},
|
||||
'mart_frontier_id': {'type': 'enum', 'tag': 'MartFrontierId'},
|
||||
'mystery_gift_delivery_stages': {'type': 'enum', 'tag': 'MysteryGiftDeliveryStage'},
|
||||
}
|
||||
|
||||
c_consts_generators = []
|
||||
|
|
|
|||
9
generated/mystery_gift_delivery_stages.txt
Normal file
9
generated/mystery_gift_delivery_stages.txt
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
MYSTERY_GIFT_LOAD
|
||||
MYSTERY_GIFT_CHECK_AVAILABLE_PGT
|
||||
MYSTERY_GIFT_GET_PGT_TYPE
|
||||
MYSTERY_GIFT_CHECK_CAN_RECEIVE
|
||||
MYSTERY_GIFT_GIVE
|
||||
MYSTERY_GIFT_RECEIVED
|
||||
MYSTERY_GIFT_CANT_RECEIVE
|
||||
MYSTERY_GIFT_UNLOAD_RECEIVED
|
||||
MYSTERY_GIFT_UNLOAD_NOT_RECEIVED
|
||||
|
|
@ -377,7 +377,7 @@ TEXT_BANK_UNK_0375
|
|||
TEXT_BANK_UNK_0376
|
||||
TEXT_BANK_UNK_0377
|
||||
TEXT_BANK_GYM_NAMES
|
||||
TEXT_BANK_UNK_0379
|
||||
TEXT_BANK_MYSTERY_GIFT_DELIVERYMAN
|
||||
TEXT_BANK_UNK_0380
|
||||
TEXT_BANK_UNK_0381
|
||||
TEXT_BANK_WIFI_PLAZA_ENTRANCE
|
||||
|
|
|
|||
8
include/scrcmd_mystery_gift.h
Normal file
8
include/scrcmd_mystery_gift.h
Normal file
|
|
@ -0,0 +1,8 @@
|
|||
#ifndef POKEPLATINUM_SCRCMD_MYSTERY_GIFT_H
|
||||
#define POKEPLATINUM_SCRCMD_MYSTERY_GIFT_H
|
||||
|
||||
#include "field_script_context.h"
|
||||
|
||||
BOOL ScrCmd_MysteryGiftGive(ScriptContext *ctx);
|
||||
|
||||
#endif // POKEPLATINUM_SCRCMD_MYSTERY_GIFT_H
|
||||
|
|
@ -8,6 +8,8 @@
|
|||
#include "savedata.h"
|
||||
#include "trainer_info.h"
|
||||
|
||||
#define NUM_MAX_DECORATION_GOODS 200
|
||||
|
||||
int Underground_SaveSize(void);
|
||||
int sub_02028554(void);
|
||||
int sub_02028558(void);
|
||||
|
|
|
|||
|
|
@ -1,8 +0,0 @@
|
|||
#ifndef POKEPLATINUM_UNK_0204B830_H
|
||||
#define POKEPLATINUM_UNK_0204B830_H
|
||||
|
||||
#include "field_script_context.h"
|
||||
|
||||
BOOL ScrCmd_23E(ScriptContext *param0);
|
||||
|
||||
#endif // POKEPLATINUM_UNK_0204B830_H
|
||||
|
|
@ -195,7 +195,7 @@ Static main
|
|||
Object main.nef.p/src_unk_02049D08.c.o
|
||||
Object main.nef.p/src_unk_0204AEE8.c.o
|
||||
Object main.nef.p/src_unk_0204B64C.c.o
|
||||
Object main.nef.p/src_unk_0204B830.c.o
|
||||
Object main.nef.p/src_scrcmd_mystery_gift.c.o
|
||||
Object main.nef.p/src_unk_0204C500.c.o
|
||||
Object main.nef.p/src_unk_0204C6C8.c.o
|
||||
Object main.nef.p/src_unk_0204C8F0.c.o
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
#include "macros/scrcmd.inc"
|
||||
#include "res/text/bank/unk_0379.h"
|
||||
#include "res/text/bank/mystery_gift_deliveryman.h"
|
||||
|
||||
.data
|
||||
|
||||
|
|
@ -8,24 +8,24 @@
|
|||
ScriptEntryEnd
|
||||
|
||||
_000A:
|
||||
ScrCmd_23E 0
|
||||
ScrCmd_23E 1, 0x40ED
|
||||
LoadMysteryGift
|
||||
CheckAvailableMysteryGift 0x40ED
|
||||
GoToIfEq 0x40ED, 0, _002B
|
||||
ClearFlag FLAG_UNK_0x020A
|
||||
ScrCmd_23E 7
|
||||
UnloadMysteryGift
|
||||
End
|
||||
|
||||
_002B:
|
||||
SetFlag FLAG_UNK_0x020A
|
||||
ScrCmd_23E 7
|
||||
UnloadMysteryGift
|
||||
End
|
||||
|
||||
_0035:
|
||||
ScrCmd_23E 0
|
||||
LoadMysteryGift
|
||||
PlayFanfare SEQ_SE_CONFIRM
|
||||
LockAll
|
||||
FacePlayer
|
||||
ScrCmd_23E 1, 0x800C
|
||||
CheckAvailableMysteryGift 0x800C
|
||||
GoToIfEq 0x800C, 0, _00EE
|
||||
GetTimeOfDay 0x800C
|
||||
SetVar 0x8008, 0x800C
|
||||
|
|
@ -49,19 +49,19 @@ _0096:
|
|||
GoTo _00A2
|
||||
|
||||
_00A2:
|
||||
ScrCmd_23E 3, 0x800C
|
||||
CheckCanReceiveMysteryGift 0x800C
|
||||
GoToIfEq 0x800C, 0, _00D8
|
||||
PlaySound SEQ_FANFA4
|
||||
ScrCmd_23E 5, 0x8005, 0x8006
|
||||
PrepareMysteryGiftReceivedMsg 0x8005, 0x8006
|
||||
ScrCmd_1FB 0x8005, 0x8006
|
||||
WaitSound
|
||||
Message 18
|
||||
WaitABXPadPress
|
||||
ScrCmd_23E 4
|
||||
GiveMysteryGift
|
||||
GoTo _0103
|
||||
|
||||
_00D8:
|
||||
ScrCmd_23E 6, 0x8005, 0x8006
|
||||
PrepareMysterGiftCantReceiveMsg 0x8005, 0x8006
|
||||
ScrCmd_1FB 0x8005, 0x8006
|
||||
WaitABXPadPress
|
||||
GoTo _00F9
|
||||
|
|
@ -74,13 +74,13 @@ _00EE:
|
|||
_00F9:
|
||||
CloseMessage
|
||||
ReleaseAll
|
||||
ScrCmd_23E 7
|
||||
UnloadMysteryGift
|
||||
End
|
||||
|
||||
_0103:
|
||||
CloseMessage
|
||||
ReleaseAll
|
||||
ScrCmd_23E 8
|
||||
UnloadMysteryGift2
|
||||
End
|
||||
|
||||
.byte 0
|
||||
|
|
|
|||
|
|
@ -1,91 +1,91 @@
|
|||
<?xml version="1.0"?>
|
||||
<body language="English">
|
||||
<key value="45872" />
|
||||
<row id="pl_msg_00000379_00000" index="0">
|
||||
<row id="MysteryGiftDeliveryman_Text_MorningGreeting" index="0">
|
||||
<attribute name="window_context_name">used</attribute>
|
||||
<language name="English">Good morning. You must be\n{STRVAR_1 3, 0, 0}.\rI’ve received a gift for you.\nHere you go!\r</language>
|
||||
</row>
|
||||
<row id="pl_msg_00000379_00001" index="1">
|
||||
<row id="MysteryGiftDeliveryman_Text_MiddayGreeting" index="1">
|
||||
<attribute name="window_context_name">used</attribute>
|
||||
<language name="English">Good day. You must be\n{STRVAR_1 3, 0, 0}.\rI’ve received a gift for you.\nHere you go!\r</language>
|
||||
</row>
|
||||
<row id="pl_msg_00000379_00002" index="2">
|
||||
<row id="MysteryGiftDeliveryman_Text_EveningGreeting" index="2">
|
||||
<attribute name="window_context_name">used</attribute>
|
||||
<language name="English">Good evening. You must be\n{STRVAR_1 3, 0, 0}.\rI’ve received a gift for you.\nHere you go!\r</language>
|
||||
</row>
|
||||
<row id="pl_msg_00000379_00003" index="3">
|
||||
<row id="MysteryGiftDeliveryman_Text_NoMoreGifts" index="3">
|
||||
<attribute name="window_context_name">used</attribute>
|
||||
<language name="English">I haven’t received any other gifts\nfor you.\rWe look forward to your next visit.</language>
|
||||
</row>
|
||||
<row id="pl_msg_00000379_00004" index="4">
|
||||
<row id="MysteryGiftDeliveryman_Text_CannotGivePokemon_PartyFull" index="4">
|
||||
<attribute name="window_context_name">used</attribute>
|
||||
<language name="English">Your party is full, I’m afraid.\nI can’t give this to you yet.</language>
|
||||
</row>
|
||||
<row id="pl_msg_00000379_00005" index="5">
|
||||
<row id="MysteryGiftDeliveryman_Text_CannotGiveItem_HaveTooMany" index="5">
|
||||
<attribute name="window_context_name">used</attribute>
|
||||
<language name="English">Another {STRVAR_1 8, 0, 0}? You already\nhave too many to accept any more.</language>
|
||||
</row>
|
||||
<row id="pl_msg_00000379_00006" index="6">
|
||||
<row id="MysteryGiftDeliveryman_Text_MakeRoomForDecorationGoods" index="6">
|
||||
<attribute name="window_context_name">used</attribute>
|
||||
<language name="English">To accept this, you need to make\nroom for decoration goods.</language>
|
||||
</row>
|
||||
<row id="pl_msg_00000379_00007" index="7">
|
||||
<row id="MysteryGiftDeliveryman_Text_ReceivedPokemon" index="7">
|
||||
<attribute name="window_context_name">used</attribute>
|
||||
<language name="English">{STRVAR_1 3, 0, 0} received\n{COLOR 101}{STRVAR_1 0, 1, 0}{COLOR 0}!\r</language>
|
||||
</row>
|
||||
<row id="pl_msg_00000379_00008" index="8">
|
||||
<row id="MysteryGiftDeliveryman_Text_ReceivedPokemonEgg" index="8">
|
||||
<attribute name="window_context_name">used</attribute>
|
||||
<language name="English">{STRVAR_1 3, 0, 0} received\na {COLOR 1}Pokémon Egg{COLOR 0}!\r</language>
|
||||
</row>
|
||||
<row id="pl_msg_00000379_00009" index="9">
|
||||
<row id="MysteryGiftDeliveryman_Text_ReceivedItem" index="9">
|
||||
<attribute name="window_context_name">used</attribute>
|
||||
<language name="English">{STRVAR_1 3, 0, 0} received\nthe gift {COLOR 1}{STRVAR_1 8, 1, 0}{COLOR 0}!\r</language>
|
||||
</row>
|
||||
<row id="pl_msg_00000379_00010" index="10">
|
||||
<row id="MysteryGiftDeliveryman_Text_ReceivedRules" index="10">
|
||||
<attribute name="window_context_name">used</attribute>
|
||||
<language name="English">{STRVAR_1 3, 0, 0} received the\n{COLOR 1}{STRVAR_1 26, 1, 0} Rules{COLOR 0}.\r</language>
|
||||
</row>
|
||||
<row id="pl_msg_00000379_00011" index="11">
|
||||
<row id="MysteryGiftDeliveryman_Text_ReceivedDecorationGood" index="11">
|
||||
<attribute name="window_context_name">used</attribute>
|
||||
<language name="English">{STRVAR_1 3, 0, 0} received\nthe gift {COLOR 1}{STRVAR_1 10, 1, 0}{COLOR 0}!\r</language>
|
||||
</row>
|
||||
<row id="pl_msg_00000379_00012" index="12">
|
||||
<row id="MysteryGiftDeliveryman_Text_ReceivedCosmetics" index="12">
|
||||
<attribute name="window_context_name">used</attribute>
|
||||
<language name="English">{STRVAR_1 3, 0, 0} received\nthe gift {COLOR 1}{STRVAR_1 31, 1, 0}{COLOR 0}.\r</language>
|
||||
</row>
|
||||
<row id="pl_msg_00000379_00013" index="13">
|
||||
<row id="MysteryGiftDeliveryman_Text_ReceivedManaphyEgg" index="13">
|
||||
<attribute name="window_context_name">used</attribute>
|
||||
<language name="English">{STRVAR_1 3, 0, 0} received\nthe {COLOR 1}MANAPHY Egg{COLOR 0}!\r</language>
|
||||
</row>
|
||||
<row id="pl_msg_00000379_00014" index="14">
|
||||
<row id="MysteryGiftDeliveryman_Text_ReceivedMemberCard" index="14">
|
||||
<attribute name="window_context_name">used</attribute>
|
||||
<language name="English">{STRVAR_1 3, 0, 0} received\na {COLOR 1}Member’s Card{COLOR 0}.\r</language>
|
||||
</row>
|
||||
<row id="pl_msg_00000379_00015" index="15">
|
||||
<row id="MysteryGiftDeliveryman_Text_ReceivedOaksLetter" index="15">
|
||||
<attribute name="window_context_name">used</attribute>
|
||||
<language name="English">{STRVAR_1 3, 0, 0} received\n{COLOR 1}Oak’s Letter{COLOR 0}!\r</language>
|
||||
</row>
|
||||
<row id="pl_msg_00000379_00016" index="16">
|
||||
<row id="MysteryGiftDeliveryman_Text_ReceivedAzureFlute" index="16">
|
||||
<attribute name="window_context_name">used</attribute>
|
||||
<language name="English">{STRVAR_1 3, 0, 0} received\nan {COLOR 1}Azure Flute{COLOR 0}!\r</language>
|
||||
</row>
|
||||
<row id="pl_msg_00000379_00017" index="17">
|
||||
<row id="MysteryGiftDeliveryman_Text_ReceivedSecretKey" index="17">
|
||||
<attribute name="window_context_name">used</attribute>
|
||||
<language name="English">{STRVAR_1 3, 0, 0} received\na {COLOR 1}Secret Key{COLOR 0}!\r</language>
|
||||
</row>
|
||||
<row id="pl_msg_00000379_00018" index="18">
|
||||
<row id="MysteryGiftDeliveryman_Text_LookForwardNextVisit" index="18">
|
||||
<attribute name="window_context_name">used</attribute>
|
||||
<language name="English">We look forward to your next visit.</language>
|
||||
</row>
|
||||
<row id="pl_msg_00000379_00019" index="19">
|
||||
<row id="MysteryGiftDeliveryman_Text_ReceivedPoketchApp" index="19">
|
||||
<attribute name="window_context_name">used</attribute>
|
||||
<language name="English">{STRVAR_1 3, 0, 0} received the Pokétch\napp {COLOR 1}{STRVAR_1 24, 1, 0}{COLOR 0}!\r</language>
|
||||
</row>
|
||||
<row id="pl_msg_00000379_00020" index="20">
|
||||
<row id="MysteryGiftDeliveryman_Text_HaventObtainedPoketch" index="20">
|
||||
<attribute name="window_context_name">used</attribute>
|
||||
<language name="English">...Uh-oh. {STRVAR_1 3, 0, 0}, you haven’t\nobtained a Pokétch yet.\rI can’t give you this app if you don’t\nhave a Pokétch.</language>
|
||||
</row>
|
||||
<row id="pl_msg_00000379_00021" index="21">
|
||||
<row id="MysteryGiftDeliveryman_Text_WasAwardedRibbon" index="21">
|
||||
<attribute name="window_context_name">used</attribute>
|
||||
<language name="English">{STRVAR_1 3, 0, 0} was awarded\nthe {COLOR 1}{STRVAR_1 39, 1, 0}{COLOR 0}!\rThe {STRVAR_1 39, 1, 0}\nwas given to {STRVAR_1 1, 2, 0}.\r</language>
|
||||
</row>
|
||||
|
|
@ -184,7 +184,7 @@ pokeplatinum_c = files(
|
|||
'unk_02049D08.c',
|
||||
'unk_0204AEE8.c',
|
||||
'unk_0204B64C.c',
|
||||
'unk_0204B830.c',
|
||||
'scrcmd_mystery_gift.c',
|
||||
'unk_0204C500.c',
|
||||
'unk_0204C6C8.c',
|
||||
'unk_0204C8F0.c',
|
||||
|
|
|
|||
|
|
@ -138,6 +138,7 @@
|
|||
#include "scrcmd_dummy_23F_242.h"
|
||||
#include "scrcmd_game_corner_prize.h"
|
||||
#include "scrcmd_jubilife_lottery.h"
|
||||
#include "scrcmd_mystery_gift.h"
|
||||
#include "scrcmd_shop.h"
|
||||
#include "scrcmd_system_flags.h"
|
||||
#include "script_manager.h"
|
||||
|
|
@ -177,7 +178,6 @@
|
|||
#include "unk_020494DC.h"
|
||||
#include "unk_0204AEE8.h"
|
||||
#include "unk_0204B64C.h"
|
||||
#include "unk_0204B830.h"
|
||||
#include "unk_0204C500.h"
|
||||
#include "unk_0204C6C8.h"
|
||||
#include "unk_0204C8F0.h"
|
||||
|
|
@ -1339,7 +1339,7 @@ const ScrCmdFunc Unk_020EAC58[] = {
|
|||
ScrCmd_23B,
|
||||
ScrCmd_23C,
|
||||
ScrCmd_23D,
|
||||
ScrCmd_23E,
|
||||
ScrCmd_MysteryGiftGive,
|
||||
ScrCmd_Dummy23F,
|
||||
ScrCmd_Dummy240,
|
||||
ScrCmd_Dummy241,
|
||||
|
|
|
|||
750
src/scrcmd_mystery_gift.c
Normal file
750
src/scrcmd_mystery_gift.c
Normal file
|
|
@ -0,0 +1,750 @@
|
|||
#include "scrcmd_mystery_gift.h"
|
||||
|
||||
#include <nitro.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "constants/heap.h"
|
||||
#include "constants/species.h"
|
||||
#include "generated/items.h"
|
||||
#include "generated/mystery_gift_delivery_stages.h"
|
||||
|
||||
#include "struct_defs/struct_0202610C.h"
|
||||
|
||||
#include "field/field_system.h"
|
||||
|
||||
#include "bag.h"
|
||||
#include "field_script_context.h"
|
||||
#include "heap.h"
|
||||
#include "inlines.h"
|
||||
#include "math.h"
|
||||
#include "mystery_gift.h"
|
||||
#include "party.h"
|
||||
#include "pokemon.h"
|
||||
#include "poketch.h"
|
||||
#include "ribbon.h"
|
||||
#include "save_player.h"
|
||||
#include "script_manager.h"
|
||||
#include "strbuf.h"
|
||||
#include "string_template.h"
|
||||
#include "system_vars.h"
|
||||
#include "trainer_info.h"
|
||||
#include "unk_02017038.h"
|
||||
#include "unk_0202602C.h"
|
||||
#include "unk_0202854C.h"
|
||||
#include "unk_020298BC.h"
|
||||
#include "unk_0202C9F4.h"
|
||||
#include "unk_0202D778.h"
|
||||
#include "unk_0202F180.h"
|
||||
#include "unk_02054884.h"
|
||||
#include "unk_02092494.h"
|
||||
#include "vars_flags.h"
|
||||
|
||||
#include "res/text/bank/mystery_gift_deliveryman.h"
|
||||
|
||||
#define RANDOMIZE_PERSONALITY 0
|
||||
#define RANDOMIZE_PERSONALITY_NO_SHINY 1
|
||||
#define RANDOMIZE_IVS 0
|
||||
|
||||
typedef struct {
|
||||
FieldSystem *fieldSystem;
|
||||
StringTemplate *stringTemplate;
|
||||
GiftData *giftData;
|
||||
} MystGiftGiveMsgFormatter;
|
||||
|
||||
typedef BOOL (*CheckCanReceiveFuncPtr)(FieldSystem *fieldSystem, GiftData *giftData);
|
||||
typedef void (*GiveFuncPtr)(FieldSystem *fieldSystem, GiftData *giftData);
|
||||
typedef void (*PrepareReceivedGiftMsgFuncPtr)(MystGiftGiveMsgFormatter *formatter, u16 *outTextBank, u16 *outStringID);
|
||||
typedef void (*PrepareCannotReceiveMsgFuncPtr)(MystGiftGiveMsgFormatter *formatter, u16 *outTextBank, u16 *outStringID);
|
||||
|
||||
typedef struct {
|
||||
CheckCanReceiveFuncPtr checkCanReceive;
|
||||
GiveFuncPtr give;
|
||||
PrepareReceivedGiftMsgFuncPtr prepReceivedGiftMsg;
|
||||
PrepareCannotReceiveMsgFuncPtr prepCannotReceiveMsg;
|
||||
} GiftHandler;
|
||||
|
||||
static const GiftHandler giftHandlers[MYST_GIFT_TYPE_MAX - 1];
|
||||
|
||||
static void MystGiftGiveMsgFormatter_Init(MystGiftGiveMsgFormatter *formatter, FieldSystem *fieldSystem, StringTemplate *strTemplate, GiftData *giftData)
|
||||
{
|
||||
formatter->fieldSystem = fieldSystem;
|
||||
formatter->stringTemplate = strTemplate;
|
||||
formatter->giftData = giftData;
|
||||
}
|
||||
|
||||
static int GetCurrentPgtType(FieldSystem *fieldSystem)
|
||||
{
|
||||
return MysteryGift_TryGetPgtType(MysteryGift_TryGetFirstValidPgtSlot());
|
||||
}
|
||||
|
||||
static GiftData *GetCurrentPgtData(FieldSystem *fieldSystem)
|
||||
{
|
||||
return MysteryGift_TryGetPgtData(MysteryGift_TryGetFirstValidPgtSlot());
|
||||
}
|
||||
|
||||
static void FreeCurrentPgt(FieldSystem *fieldSystem)
|
||||
{
|
||||
MysteryGift_FreePgtSlot(MysteryGift_TryGetFirstValidPgtSlot());
|
||||
}
|
||||
|
||||
BOOL ScrCmd_MysteryGiftGive(ScriptContext *ctx)
|
||||
{
|
||||
switch (ScriptContext_ReadHalfWord(ctx)) {
|
||||
case MYSTERY_GIFT_LOAD:
|
||||
MysteryGift_Load(ctx->fieldSystem->saveData, 32);
|
||||
break;
|
||||
case MYSTERY_GIFT_UNLOAD_RECEIVED:
|
||||
MysteryGift_Unload(ctx->fieldSystem->saveData, 0);
|
||||
break;
|
||||
case MYSTERY_GIFT_UNLOAD_NOT_RECEIVED:
|
||||
MysteryGift_Unload(ctx->fieldSystem->saveData, 1);
|
||||
break;
|
||||
case MYSTERY_GIFT_CHECK_AVAILABLE_PGT: {
|
||||
u16 *destVarPtr = ScriptContext_GetVarPointer(ctx);
|
||||
|
||||
if (GetCurrentPgtType(ctx->fieldSystem) != MYST_GIFT_NONE) {
|
||||
*destVarPtr = TRUE;
|
||||
} else {
|
||||
*destVarPtr = FALSE;
|
||||
}
|
||||
break;
|
||||
}
|
||||
case MYSTERY_GIFT_GET_PGT_TYPE: {
|
||||
u16 *destVarPtr = ScriptContext_GetVarPointer(ctx);
|
||||
*destVarPtr = GetCurrentPgtType(ctx->fieldSystem);
|
||||
break;
|
||||
}
|
||||
case MYSTERY_GIFT_CHECK_CAN_RECEIVE: {
|
||||
u16 *destVarPtr = ScriptContext_GetVarPointer(ctx);
|
||||
const GiftHandler *giftHandler = &giftHandlers[GetCurrentPgtType(ctx->fieldSystem) - 1];
|
||||
|
||||
*destVarPtr = giftHandler->checkCanReceive(ctx->fieldSystem, GetCurrentPgtData(ctx->fieldSystem));
|
||||
break;
|
||||
}
|
||||
case MYSTERY_GIFT_GIVE: {
|
||||
const GiftHandler *giftHandler = &giftHandlers[GetCurrentPgtType(ctx->fieldSystem) - 1];
|
||||
|
||||
giftHandler->give(ctx->fieldSystem, GetCurrentPgtData(ctx->fieldSystem));
|
||||
FreeCurrentPgt(ctx->fieldSystem);
|
||||
break;
|
||||
}
|
||||
case MYSTERY_GIFT_RECEIVED: {
|
||||
MystGiftGiveMsgFormatter formatter;
|
||||
const GiftHandler *giftHandler = &giftHandlers[GetCurrentPgtType(ctx->fieldSystem) - 1];
|
||||
StringTemplate **strTemplate = FieldSystem_GetScriptMemberPtr(ctx->fieldSystem, SCRIPT_MANAGER_STR_TEMPLATE);
|
||||
u16 *bankIDDestVarPtr = ScriptContext_GetVarPointer(ctx);
|
||||
u16 *stringIDDestVarPtr = ScriptContext_GetVarPointer(ctx);
|
||||
|
||||
MystGiftGiveMsgFormatter_Init(&formatter, ctx->fieldSystem, *strTemplate, GetCurrentPgtData(ctx->fieldSystem));
|
||||
giftHandler->prepReceivedGiftMsg(&formatter, bankIDDestVarPtr, stringIDDestVarPtr);
|
||||
break;
|
||||
}
|
||||
case MYSTERY_GIFT_CANT_RECEIVE: {
|
||||
MystGiftGiveMsgFormatter formatter;
|
||||
const GiftHandler *giftHandler = &giftHandlers[GetCurrentPgtType(ctx->fieldSystem) - 1];
|
||||
StringTemplate **strTemplate = FieldSystem_GetScriptMemberPtr(ctx->fieldSystem, SCRIPT_MANAGER_STR_TEMPLATE);
|
||||
u16 *bankIDDestVarPtr = ScriptContext_GetVarPointer(ctx);
|
||||
u16 *stringIDDestVarPtr = ScriptContext_GetVarPointer(ctx);
|
||||
|
||||
MystGiftGiveMsgFormatter_Init(&formatter, ctx->fieldSystem, *strTemplate, GetCurrentPgtData(ctx->fieldSystem));
|
||||
giftHandler->prepCannotReceiveMsg(&formatter, bankIDDestVarPtr, stringIDDestVarPtr);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
static BOOL CanReceivePokemon(FieldSystem *fieldSystem, GiftData *dummy)
|
||||
{
|
||||
Party *party = SaveData_GetParty(fieldSystem->saveData);
|
||||
|
||||
return Party_GetCurrentCount(party) < MAX_PARTY_SIZE;
|
||||
}
|
||||
|
||||
static void GenerateManaphyEgg(FieldSystem *fieldSystem, GiftData *dummy)
|
||||
{
|
||||
sub_02054930(HEAP_ID_FIELD_TASK, fieldSystem->saveData, SPECIES_MANAPHY, 1, 2, 1);
|
||||
}
|
||||
|
||||
static void PrepReceivedManaphyEggMsg(MystGiftGiveMsgFormatter *formatter, u16 *outTextBank, u16 *outStringID)
|
||||
{
|
||||
*outTextBank = TEXT_BANK_MYSTERY_GIFT_DELIVERYMAN;
|
||||
*outStringID = MysteryGiftDeliveryman_Text_ReceivedManaphyEgg;
|
||||
|
||||
StringTemplate_SetPlayerName(formatter->stringTemplate, 0, SaveData_GetTrainerInfo(formatter->fieldSystem->saveData));
|
||||
}
|
||||
|
||||
static void GivePokemon(FieldSystem *fieldSystem, GiftData *dummy)
|
||||
{
|
||||
GiftData *giftData = GetCurrentPgtData(fieldSystem);
|
||||
TrainerInfo *trainerInfo = SaveData_GetTrainerInfo(fieldSystem->saveData);
|
||||
VarsFlags *varsFlags = SaveData_GetVarsFlags(fieldSystem->saveData);
|
||||
Pokemon *tmpPoke = NULL;
|
||||
|
||||
Pokemon *pokemon = &giftData->pokemonGiftData.pokemon;
|
||||
u8 *giftSpecialRibbons = giftData->pokemonGiftData.specialRibbonsDescIDs;
|
||||
int metLocation = Pokemon_GetValue(pokemon, MON_DATA_MET_LOCATION, NULL);
|
||||
u32 giftPersonality = Pokemon_GetValue(pokemon, MON_DATA_PERSONALITY, NULL);
|
||||
u32 giftOtID = Pokemon_GetValue(pokemon, MON_DATA_OT_ID, NULL);
|
||||
u32 personality = ARNG_Next(OS_GetTick());
|
||||
|
||||
if (giftPersonality == RANDOMIZE_PERSONALITY) {
|
||||
(void)0;
|
||||
} else if (giftPersonality == RANDOMIZE_PERSONALITY_NO_SHINY) {
|
||||
while (Pokemon_IsPersonalityShiny(giftOtID, personality)) {
|
||||
personality = ARNG_Next(personality);
|
||||
}
|
||||
} else {
|
||||
personality = giftPersonality;
|
||||
}
|
||||
|
||||
sub_020780C4(pokemon, personality);
|
||||
u32 tmp = Pokemon_GetGender(pokemon);
|
||||
|
||||
Pokemon_SetValue(pokemon, MON_DATA_GENDER, &tmp);
|
||||
|
||||
// couldn't get a match without reusing the variable
|
||||
tmp = Pokemon_GetValue(pokemon, MON_DATA_HP_IV, NULL) + Pokemon_GetValue(pokemon, MON_DATA_ATK_IV, NULL) + Pokemon_GetValue(pokemon, MON_DATA_DEF_IV, NULL) + Pokemon_GetValue(pokemon, MON_DATA_SPEED_IV, NULL) + Pokemon_GetValue(pokemon, MON_DATA_SPATK_IV, NULL) + Pokemon_GetValue(pokemon, MON_DATA_SPDEF_IV, NULL);
|
||||
|
||||
if (tmp == RANDOMIZE_IVS) {
|
||||
u32 rand = LCRNG_Next();
|
||||
personality = (rand & (0x1F << 0)) >> 0; // couldn't get a match without reusing the variable
|
||||
|
||||
Pokemon_SetValue(pokemon, MON_DATA_HP_IV, &personality);
|
||||
|
||||
personality = (rand & (0x1F << 5)) >> 5;
|
||||
Pokemon_SetValue(pokemon, MON_DATA_ATK_IV, &personality);
|
||||
|
||||
personality = (rand & (0x1F << 10)) >> 10;
|
||||
Pokemon_SetValue(pokemon, MON_DATA_DEF_IV, &personality);
|
||||
|
||||
rand = LCRNG_Next();
|
||||
personality = (rand & (0x1F << 0)) >> 0;
|
||||
Pokemon_SetValue(pokemon, MON_DATA_SPEED_IV, &personality);
|
||||
|
||||
personality = (rand & (0x1F << 5)) >> 5;
|
||||
Pokemon_SetValue(pokemon, MON_DATA_SPATK_IV, &personality);
|
||||
|
||||
personality = (rand & (0x1F << 10)) >> 10;
|
||||
Pokemon_SetValue(pokemon, MON_DATA_SPDEF_IV, &personality);
|
||||
}
|
||||
|
||||
u8 *specialRibbons = sub_0202D79C(fieldSystem->saveData);
|
||||
|
||||
if (Pokemon_GetValue(pokemon, MON_DATA_SINNOH_RED_RIBBON, NULL)) {
|
||||
specialRibbons[Ribbon_TryGetSpecialDescriptionID(RIBBON_RED)] = giftSpecialRibbons[0];
|
||||
}
|
||||
|
||||
if (Pokemon_GetValue(pokemon, MON_DATA_SINNOH_GREEN_RIBBON, NULL)) {
|
||||
specialRibbons[Ribbon_TryGetSpecialDescriptionID(RIBBON_GREEN)] = giftSpecialRibbons[1];
|
||||
}
|
||||
|
||||
if (Pokemon_GetValue(pokemon, MON_DATA_SINNOH_BLUE_RIBBON, NULL)) {
|
||||
specialRibbons[Ribbon_TryGetSpecialDescriptionID(RIBBON_BLUE)] = giftSpecialRibbons[2];
|
||||
}
|
||||
|
||||
if (Pokemon_GetValue(pokemon, MON_DATA_SINNOH_FESTIVAL_RIBBON, NULL)) {
|
||||
specialRibbons[Ribbon_TryGetSpecialDescriptionID(RIBBON_FESTIVAL)] = giftSpecialRibbons[3];
|
||||
}
|
||||
|
||||
if (Pokemon_GetValue(pokemon, MON_DATA_SINNOH_CARNIVAL_RIBBON, NULL)) {
|
||||
specialRibbons[Ribbon_TryGetSpecialDescriptionID(RIBBON_CARNIVAL)] = giftSpecialRibbons[4];
|
||||
}
|
||||
|
||||
if (Pokemon_GetValue(pokemon, MON_DATA_SINNOH_CLASSIC_RIBBON, NULL)) {
|
||||
specialRibbons[Ribbon_TryGetSpecialDescriptionID(RIBBON_CLASSIC)] = giftSpecialRibbons[5];
|
||||
}
|
||||
|
||||
if (Pokemon_GetValue(pokemon, MON_DATA_SINNOH_PREMIER_RIBBON, NULL)) {
|
||||
specialRibbons[Ribbon_TryGetSpecialDescriptionID(RIBBON_PREMIER)] = giftSpecialRibbons[6];
|
||||
}
|
||||
|
||||
if (Pokemon_GetValue(pokemon, MON_DATA_HOENN_MARINE_RIBBON, NULL)) {
|
||||
specialRibbons[Ribbon_TryGetSpecialDescriptionID(RIBBON_HOENN_MARINE)] = giftSpecialRibbons[7];
|
||||
}
|
||||
|
||||
if (Pokemon_GetValue(pokemon, MON_DATA_HOENN_LAND_RIBBON, NULL)) {
|
||||
specialRibbons[Ribbon_TryGetSpecialDescriptionID(RIBBON_HOENN_LAND)] = giftSpecialRibbons[8];
|
||||
}
|
||||
|
||||
if (Pokemon_GetValue(pokemon, MON_DATA_HOENN_SKY_RIBBON, NULL)) {
|
||||
specialRibbons[Ribbon_TryGetSpecialDescriptionID(RIBBON_HOENN_SKY)] = giftSpecialRibbons[9];
|
||||
}
|
||||
|
||||
if (giftData->pokemonGiftData.hasCustomOT == FALSE) {
|
||||
Strbuf *playerName = TrainerInfo_NameNewStrbuf(trainerInfo, HEAP_ID_FIELD_TASK);
|
||||
u32 playerID = TrainerInfo_ID(trainerInfo);
|
||||
u32 playerGender = TrainerInfo_Gender(trainerInfo);
|
||||
|
||||
tmpPoke = Pokemon_New(HEAP_ID_FIELD_TASK);
|
||||
|
||||
Pokemon_Copy(pokemon, tmpPoke);
|
||||
Pokemon_SetValue(tmpPoke, MON_DATA_OTNAME_STRBUF, playerName);
|
||||
Pokemon_SetValue(tmpPoke, MON_DATA_OT_ID, &playerID);
|
||||
Pokemon_SetValue(tmpPoke, MON_DATA_OT_GENDER, &playerGender);
|
||||
|
||||
pokemon = tmpPoke;
|
||||
Strbuf_Free(playerName);
|
||||
}
|
||||
|
||||
UpdateMonStatusAndTrainerInfo(pokemon, trainerInfo, 4, SpecialMetLoc_GetId(2, metLocation), HEAP_ID_FIELD_TASK);
|
||||
|
||||
if (Pokemon_GetValue(pokemon, MON_DATA_SPECIES, NULL) == SPECIES_ARCEUS) {
|
||||
if (Pokemon_GetValue(pokemon, MON_DATA_FATEFUL_ENCOUNTER, NULL) == TRUE) {
|
||||
if (SystemVars_GetArceusEventState(varsFlags) == FALSE) {
|
||||
SystemVars_SetArceusEventState(varsFlags, TRUE);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Pokemon_CalcLevelAndStats(pokemon);
|
||||
|
||||
Party *party = SaveData_GetParty(fieldSystem->saveData);
|
||||
BOOL added = Party_AddPokemon(party, pokemon);
|
||||
|
||||
if (added) {
|
||||
sub_0202F180(fieldSystem->saveData, pokemon);
|
||||
}
|
||||
|
||||
if (tmpPoke) {
|
||||
Heap_FreeToHeap(tmpPoke);
|
||||
}
|
||||
}
|
||||
|
||||
static void PrepReceivedPokemonMsg(MystGiftGiveMsgFormatter *formatter, u16 *outTextBank, u16 *outStringID)
|
||||
{
|
||||
GiftData *giftData = GetCurrentPgtData(formatter->fieldSystem);
|
||||
|
||||
*outTextBank = TEXT_BANK_MYSTERY_GIFT_DELIVERYMAN;
|
||||
*outStringID = MysteryGiftDeliveryman_Text_ReceivedPokemon;
|
||||
|
||||
Pokemon *pokemon = &giftData->pokemonGiftData.pokemon;
|
||||
|
||||
StringTemplate_SetPlayerName(formatter->stringTemplate, 0, SaveData_GetTrainerInfo(formatter->fieldSystem->saveData));
|
||||
StringTemplate_SetSpeciesNameWithArticle(formatter->stringTemplate, 1, Pokemon_GetBoxPokemon(pokemon));
|
||||
}
|
||||
|
||||
static void PrepCannotReceivePokemonMsg(MystGiftGiveMsgFormatter *formatter, u16 *outTextBank, u16 *outStringID)
|
||||
{
|
||||
*outTextBank = TEXT_BANK_MYSTERY_GIFT_DELIVERYMAN;
|
||||
*outStringID = MysteryGiftDeliveryman_Text_CannotGivePokemon_PartyFull;
|
||||
}
|
||||
|
||||
static void GiveEgg(FieldSystem *fieldSystem, GiftData *giftData)
|
||||
{
|
||||
GivePokemon(fieldSystem, giftData);
|
||||
}
|
||||
|
||||
static void PrepReceivedEggMsg(MystGiftGiveMsgFormatter *formatter, u16 *outTextBank, u16 *outStringID)
|
||||
{
|
||||
GiftData *giftData = GetCurrentPgtData(formatter->fieldSystem);
|
||||
|
||||
*outTextBank = TEXT_BANK_MYSTERY_GIFT_DELIVERYMAN;
|
||||
*outStringID = MysteryGiftDeliveryman_Text_ReceivedPokemonEgg;
|
||||
|
||||
Pokemon *pokemon = &giftData->pokemonGiftData.pokemon;
|
||||
|
||||
StringTemplate_SetPlayerName(formatter->stringTemplate, 0, SaveData_GetTrainerInfo(formatter->fieldSystem->saveData));
|
||||
StringTemplate_SetSpeciesName(formatter->stringTemplate, 1, Pokemon_GetBoxPokemon(pokemon));
|
||||
}
|
||||
|
||||
static BOOL CanReceiveItem(FieldSystem *fieldSystem, GiftData *dummy)
|
||||
{
|
||||
Bag *bag = SaveData_GetBag(fieldSystem->saveData);
|
||||
GiftData *giftData = GetCurrentPgtData(fieldSystem);
|
||||
|
||||
return Bag_CanFitItem(bag, giftData->itemGiftData.item, 1, HEAP_ID_FIELD_TASK);
|
||||
}
|
||||
|
||||
static void GiveItem(FieldSystem *fieldSystem, GiftData *dummy)
|
||||
{
|
||||
Bag *bag = SaveData_GetBag(fieldSystem->saveData);
|
||||
GiftData *giftData = GetCurrentPgtData(fieldSystem);
|
||||
u16 itemID = giftData->itemGiftData.item;
|
||||
|
||||
Bag_TryAddItem(bag, itemID, 1, HEAP_ID_FIELD_TASK);
|
||||
}
|
||||
|
||||
static void PrepReceivedItemMsg(MystGiftGiveMsgFormatter *formatter, u16 *outTextBank, u16 *outStringID)
|
||||
{
|
||||
GiftData *giftData = GetCurrentPgtData(formatter->fieldSystem);
|
||||
u16 itemID = giftData->itemGiftData.item;
|
||||
|
||||
*outTextBank = TEXT_BANK_MYSTERY_GIFT_DELIVERYMAN;
|
||||
*outStringID = MysteryGiftDeliveryman_Text_ReceivedItem;
|
||||
|
||||
StringTemplate_SetPlayerName(formatter->stringTemplate, 0, SaveData_GetTrainerInfo(formatter->fieldSystem->saveData));
|
||||
StringTemplate_SetItemName(formatter->stringTemplate, 1, itemID);
|
||||
}
|
||||
|
||||
static void PrepCannotReceiveItemMsg(MystGiftGiveMsgFormatter *formatter, u16 *outTextBank, u16 *outStringID)
|
||||
{
|
||||
Bag *bag = SaveData_GetBag(formatter->fieldSystem->saveData);
|
||||
GiftData *giftData = GetCurrentPgtData(formatter->fieldSystem);
|
||||
u16 itemID = giftData->itemGiftData.item;
|
||||
|
||||
*outTextBank = TEXT_BANK_MYSTERY_GIFT_DELIVERYMAN;
|
||||
*outStringID = MysteryGiftDeliveryman_Text_CannotGiveItem_HaveTooMany;
|
||||
|
||||
StringTemplate_SetItemName(formatter->stringTemplate, 0, itemID);
|
||||
}
|
||||
|
||||
static BOOL CanReceiveBattleReg(FieldSystem *fieldSystem, GiftData *dummy)
|
||||
{
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static void GiveBattleReg(FieldSystem *fieldSystem, GiftData *dummy)
|
||||
{
|
||||
GiftData *giftData = GetCurrentPgtData(fieldSystem);
|
||||
const BattleRegulation *battleReg = &giftData->battleReg;
|
||||
|
||||
sub_0202613C(fieldSystem->saveData, battleReg);
|
||||
}
|
||||
|
||||
static void PrepReceivedRulesMsg(MystGiftGiveMsgFormatter *formatter, u16 *outTextBank, u16 *outStringID)
|
||||
{
|
||||
GiftData *giftData = GetCurrentPgtData(formatter->fieldSystem);
|
||||
const BattleRegulation *battleReg = &giftData->battleReg;
|
||||
|
||||
*outTextBank = TEXT_BANK_MYSTERY_GIFT_DELIVERYMAN;
|
||||
*outStringID = MysteryGiftDeliveryman_Text_ReceivedRules;
|
||||
|
||||
StringTemplate_SetPlayerName(formatter->stringTemplate, 0, SaveData_GetTrainerInfo(formatter->fieldSystem->saveData));
|
||||
|
||||
Strbuf *battleRegName = sub_0202605C(battleReg, HEAP_ID_FIELD_TASK);
|
||||
StringTemplate_SetStrbuf(formatter->stringTemplate, 1, battleRegName, 0, 1, GAME_LANGUAGE);
|
||||
Strbuf_Free(battleRegName);
|
||||
}
|
||||
|
||||
static void PrepCannotReceiveRulesMsg(MystGiftGiveMsgFormatter *formatter, u16 *outTextBank, u16 *outStringID)
|
||||
{
|
||||
*outTextBank = TEXT_BANK_MYSTERY_GIFT_DELIVERYMAN;
|
||||
*outStringID = MysteryGiftDeliveryman_Text_MakeRoomForDecorationGoods;
|
||||
}
|
||||
|
||||
static BOOL CanReceiveDecorationGood(FieldSystem *fieldSystem, GiftData *dummy)
|
||||
{
|
||||
int ownedCount = sub_020289A0(SaveData_GetUndergroundData(fieldSystem->saveData));
|
||||
|
||||
return ownedCount < NUM_MAX_DECORATION_GOODS;
|
||||
}
|
||||
|
||||
static void GiveDecorationGood(FieldSystem *fieldSystem, GiftData *dummy)
|
||||
{
|
||||
GiftData *giftData = GetCurrentPgtData(fieldSystem);
|
||||
int id = giftData->decorationGoodID;
|
||||
|
||||
sub_0202895C(SaveData_GetUndergroundData(fieldSystem->saveData), id);
|
||||
}
|
||||
|
||||
static void PrepReceivedDecoGoodMsg(MystGiftGiveMsgFormatter *formatter, u16 *outTextBank, u16 *outStringID)
|
||||
{
|
||||
GiftData *giftData = GetCurrentPgtData(formatter->fieldSystem);
|
||||
int id = giftData->decorationGoodID;
|
||||
|
||||
*outTextBank = TEXT_BANK_MYSTERY_GIFT_DELIVERYMAN;
|
||||
*outStringID = MysteryGiftDeliveryman_Text_ReceivedDecorationGood;
|
||||
|
||||
StringTemplate_SetPlayerName(formatter->stringTemplate, 0, SaveData_GetTrainerInfo(formatter->fieldSystem->saveData));
|
||||
StringTemplate_SetUndergroundGoodsName(formatter->stringTemplate, 1, id);
|
||||
}
|
||||
|
||||
static void PrepCannotReceiveDecoGood(MystGiftGiveMsgFormatter *formatter, u16 *outTextBank, u16 *outStringID)
|
||||
{
|
||||
*outTextBank = TEXT_BANK_MYSTERY_GIFT_DELIVERYMAN;
|
||||
*outStringID = MysteryGiftDeliveryman_Text_MakeRoomForDecorationGoods;
|
||||
}
|
||||
|
||||
static BOOL CanReceiveCosmetic(FieldSystem *fieldSystem, GiftData *dummy)
|
||||
{
|
||||
GiftData *giftData = GetCurrentPgtData(fieldSystem);
|
||||
int type = giftData->cosmeticGiftData.type;
|
||||
int id = giftData->cosmeticGiftData.id;
|
||||
|
||||
switch (type) {
|
||||
case MG_COSMETICS_SEAL:
|
||||
return sub_0202CB70(SaveData_GetBallSeals(fieldSystem->saveData), id, 1);
|
||||
case MG_COSMETICS_ACCESSORY:
|
||||
return TRUE;
|
||||
case MG_COSMETICS_BACKDROP:
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
static void GiveCosmetic(FieldSystem *fieldSystem, GiftData *dummy)
|
||||
{
|
||||
GiftData *giftData = GetCurrentPgtData(fieldSystem);
|
||||
int type = giftData->cosmeticGiftData.type;
|
||||
int id = giftData->cosmeticGiftData.id;
|
||||
|
||||
switch (type) {
|
||||
case MG_COSMETICS_SEAL:
|
||||
sub_0202CAE0(SaveData_GetBallSeals(fieldSystem->saveData), id, 1);
|
||||
break;
|
||||
case MG_COSMETICS_ACCESSORY:
|
||||
sub_02029E2C(sub_02029D04(sub_0202A750(fieldSystem->saveData)), id, 1);
|
||||
break;
|
||||
case MG_COSMETICS_BACKDROP:
|
||||
sub_02029EFC(sub_02029D04(sub_0202A750(fieldSystem->saveData)), id);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
static void PrepReceivedCosmeticMsg(MystGiftGiveMsgFormatter *formatter, u16 *outTextBank, u16 *outStringID)
|
||||
{
|
||||
GiftData *giftData = GetCurrentPgtData(formatter->fieldSystem);
|
||||
int type = giftData->cosmeticGiftData.type;
|
||||
int id = giftData->cosmeticGiftData.id;
|
||||
|
||||
switch (type) {
|
||||
case MG_COSMETICS_SEAL:
|
||||
StringTemplate_SetBallSealName(formatter->stringTemplate, 1, id);
|
||||
break;
|
||||
case MG_COSMETICS_ACCESSORY:
|
||||
StringTemplate_SetContestAccessoryName(formatter->stringTemplate, 1, id);
|
||||
break;
|
||||
case MG_COSMETICS_BACKDROP:
|
||||
StringTemplate_SetContestBackdropName(formatter->stringTemplate, 1, id);
|
||||
break;
|
||||
}
|
||||
|
||||
*outTextBank = TEXT_BANK_MYSTERY_GIFT_DELIVERYMAN;
|
||||
*outStringID = MysteryGiftDeliveryman_Text_ReceivedCosmetics;
|
||||
|
||||
StringTemplate_SetPlayerName(formatter->stringTemplate, 0, SaveData_GetTrainerInfo(formatter->fieldSystem->saveData));
|
||||
}
|
||||
|
||||
static void PrepCannotReceiveCosmeticMsg(MystGiftGiveMsgFormatter *formatter, u16 *outTextBank, u16 *outStringID)
|
||||
{
|
||||
*outTextBank = TEXT_BANK_MYSTERY_GIFT_DELIVERYMAN;
|
||||
*outStringID = MysteryGiftDeliveryman_Text_MakeRoomForDecorationGoods;
|
||||
}
|
||||
|
||||
static BOOL CanReceiveMemberCard(FieldSystem *fieldSystem, GiftData *dummy)
|
||||
{
|
||||
Bag *bag = SaveData_GetBag(fieldSystem->saveData);
|
||||
GiftData *giftData = GetCurrentPgtData(fieldSystem);
|
||||
|
||||
return Bag_CanFitItem(bag, ITEM_MEMBER_CARD, 1, HEAP_ID_FIELD_TASK);
|
||||
}
|
||||
|
||||
static void InitDarkraiEvent(FieldSystem *fieldSystem, GiftData *dummy)
|
||||
{
|
||||
Bag *bag = SaveData_GetBag(fieldSystem->saveData);
|
||||
GiftData *giftData = GetCurrentPgtData(fieldSystem);
|
||||
VarsFlags *varsFlags = SaveData_GetVarsFlags(fieldSystem->saveData);
|
||||
|
||||
Bag_TryAddItem(bag, ITEM_MEMBER_CARD, 1, HEAP_ID_FIELD_TASK);
|
||||
SystemVars_SetDistributionEventMagic(varsFlags, DISTRIBUTION_EVENT_DARKRAI);
|
||||
}
|
||||
|
||||
static void PrepReceivedMemberCardMsg(MystGiftGiveMsgFormatter *formatter, u16 *outTextBank, u16 *outStringID)
|
||||
{
|
||||
GiftData *giftData = GetCurrentPgtData(formatter->fieldSystem);
|
||||
u16 itemID = ITEM_MEMBER_CARD;
|
||||
|
||||
*outTextBank = TEXT_BANK_MYSTERY_GIFT_DELIVERYMAN;
|
||||
*outStringID = MysteryGiftDeliveryman_Text_ReceivedMemberCard;
|
||||
|
||||
StringTemplate_SetPlayerName(formatter->stringTemplate, 0, SaveData_GetTrainerInfo(formatter->fieldSystem->saveData));
|
||||
StringTemplate_SetItemName(formatter->stringTemplate, 1, itemID);
|
||||
}
|
||||
|
||||
static void PrepCannotReceiveMemberCardMsg(MystGiftGiveMsgFormatter *formatter, u16 *outTextBank, u16 *outStringID)
|
||||
{
|
||||
Bag *bag = SaveData_GetBag(formatter->fieldSystem->saveData);
|
||||
GiftData *giftData = GetCurrentPgtData(formatter->fieldSystem);
|
||||
u16 itemID = ITEM_MEMBER_CARD;
|
||||
|
||||
*outTextBank = TEXT_BANK_MYSTERY_GIFT_DELIVERYMAN;
|
||||
*outStringID = MysteryGiftDeliveryman_Text_CannotGiveItem_HaveTooMany;
|
||||
|
||||
StringTemplate_SetItemName(formatter->stringTemplate, 0, itemID);
|
||||
}
|
||||
|
||||
static BOOL CanReceiveOaksLetter(FieldSystem *fieldSystem, GiftData *dummy)
|
||||
{
|
||||
Bag *bag = SaveData_GetBag(fieldSystem->saveData);
|
||||
GiftData *giftData = GetCurrentPgtData(fieldSystem);
|
||||
|
||||
return Bag_CanFitItem(bag, ITEM_OAKS_LETTER, 1, HEAP_ID_FIELD_TASK);
|
||||
}
|
||||
|
||||
static void InitShayminEvent(FieldSystem *fieldSystem, GiftData *dummy)
|
||||
{
|
||||
Bag *bag = SaveData_GetBag(fieldSystem->saveData);
|
||||
GiftData *giftData = GetCurrentPgtData(fieldSystem);
|
||||
VarsFlags *varsFlags = SaveData_GetVarsFlags(fieldSystem->saveData);
|
||||
|
||||
Bag_TryAddItem(bag, ITEM_OAKS_LETTER, 1, HEAP_ID_FIELD_TASK);
|
||||
SystemVars_SetDistributionEventMagic(varsFlags, DISTRIBUTION_EVENT_SHAYMIN);
|
||||
|
||||
if (SystemVars_GetShayminEventState(varsFlags) == 0) {
|
||||
SystemVars_SetShayminEventState(varsFlags, 1);
|
||||
}
|
||||
}
|
||||
|
||||
static void PrepReceivedOaksLetterMsg(MystGiftGiveMsgFormatter *formatter, u16 *outTextBank, u16 *outStringID)
|
||||
{
|
||||
GiftData *giftData = GetCurrentPgtData(formatter->fieldSystem);
|
||||
u16 itemID = ITEM_OAKS_LETTER;
|
||||
|
||||
*outTextBank = TEXT_BANK_MYSTERY_GIFT_DELIVERYMAN;
|
||||
*outStringID = MysteryGiftDeliveryman_Text_ReceivedOaksLetter;
|
||||
|
||||
StringTemplate_SetPlayerName(formatter->stringTemplate, 0, SaveData_GetTrainerInfo(formatter->fieldSystem->saveData));
|
||||
StringTemplate_SetItemName(formatter->stringTemplate, 1, itemID);
|
||||
}
|
||||
|
||||
static void PrepCannotReceivedOaksLetterMsg(MystGiftGiveMsgFormatter *formatter, u16 *outTextBank, u16 *outStringID)
|
||||
{
|
||||
Bag *bag = SaveData_GetBag(formatter->fieldSystem->saveData);
|
||||
GiftData *giftData = GetCurrentPgtData(formatter->fieldSystem);
|
||||
u16 itemID = ITEM_OAKS_LETTER;
|
||||
|
||||
*outTextBank = TEXT_BANK_MYSTERY_GIFT_DELIVERYMAN;
|
||||
*outStringID = MysteryGiftDeliveryman_Text_CannotGiveItem_HaveTooMany;
|
||||
|
||||
StringTemplate_SetItemName(formatter->stringTemplate, 0, itemID);
|
||||
}
|
||||
|
||||
static BOOL CanReceiveSecretKey(FieldSystem *fieldSystem, GiftData *dummy)
|
||||
{
|
||||
Bag *bag = SaveData_GetBag(fieldSystem->saveData);
|
||||
GiftData *giftData = GetCurrentPgtData(fieldSystem);
|
||||
|
||||
return Bag_CanFitItem(bag, ITEM_SECRET_KEY, 1, HEAP_ID_FIELD_TASK);
|
||||
}
|
||||
|
||||
static void InitRotomEvent(FieldSystem *fieldSystem, GiftData *dummy)
|
||||
{
|
||||
Bag *bag = SaveData_GetBag(fieldSystem->saveData);
|
||||
GiftData *giftData = GetCurrentPgtData(fieldSystem);
|
||||
VarsFlags *varsFlags = SaveData_GetVarsFlags(fieldSystem->saveData);
|
||||
|
||||
Bag_TryAddItem(bag, ITEM_SECRET_KEY, 1, HEAP_ID_FIELD_TASK);
|
||||
SystemVars_SetDistributionEventMagic(varsFlags, DISTRIBUTION_EVENT_ROTOM);
|
||||
}
|
||||
|
||||
static void PrepReceivedSecretKeyMsg(MystGiftGiveMsgFormatter *formatter, u16 *outTextBank, u16 *outStringID)
|
||||
{
|
||||
GiftData *giftData = GetCurrentPgtData(formatter->fieldSystem);
|
||||
u16 itemID = ITEM_SECRET_KEY;
|
||||
|
||||
*outTextBank = TEXT_BANK_MYSTERY_GIFT_DELIVERYMAN;
|
||||
*outStringID = MysteryGiftDeliveryman_Text_ReceivedSecretKey;
|
||||
|
||||
StringTemplate_SetPlayerName(formatter->stringTemplate, 0, SaveData_GetTrainerInfo(formatter->fieldSystem->saveData));
|
||||
StringTemplate_SetItemName(formatter->stringTemplate, 1, itemID);
|
||||
}
|
||||
|
||||
static void PrepCannotReceiveSecretKeyMsg(MystGiftGiveMsgFormatter *formatter, u16 *outTextBank, u16 *outStringID)
|
||||
{
|
||||
Bag *bag = SaveData_GetBag(formatter->fieldSystem->saveData);
|
||||
GiftData *giftData = GetCurrentPgtData(formatter->fieldSystem);
|
||||
u16 itemID = ITEM_SECRET_KEY;
|
||||
|
||||
*outTextBank = TEXT_BANK_MYSTERY_GIFT_DELIVERYMAN;
|
||||
*outStringID = MysteryGiftDeliveryman_Text_CannotGiveItem_HaveTooMany;
|
||||
|
||||
StringTemplate_SetItemName(formatter->stringTemplate, 0, itemID);
|
||||
}
|
||||
|
||||
static BOOL CanReceiveAzureFlute(FieldSystem *fieldSystem, GiftData *dummy)
|
||||
{
|
||||
Bag *bag = SaveData_GetBag(fieldSystem->saveData);
|
||||
GiftData *giftData = GetCurrentPgtData(fieldSystem);
|
||||
|
||||
return Bag_CanFitItem(bag, ITEM_AZURE_FLUTE, 1, HEAP_ID_FIELD_TASK);
|
||||
}
|
||||
|
||||
static void InitArceusEvent(FieldSystem *fieldSystem, GiftData *dummy)
|
||||
{
|
||||
Bag *bag = SaveData_GetBag(fieldSystem->saveData);
|
||||
GiftData *unused = GetCurrentPgtData(fieldSystem);
|
||||
VarsFlags *varsFlags = SaveData_GetVarsFlags(fieldSystem->saveData);
|
||||
|
||||
Bag_TryAddItem(bag, ITEM_AZURE_FLUTE, 1, HEAP_ID_FIELD_TASK);
|
||||
SystemVars_SetDistributionEventMagic(varsFlags, DISTRIBUTION_EVENT_ARCEUS);
|
||||
}
|
||||
|
||||
static void PrepReceivedAzureFluteMsg(MystGiftGiveMsgFormatter *formatter, u16 *outTextBank, u16 *outStringID)
|
||||
{
|
||||
GiftData *giftData = GetCurrentPgtData(formatter->fieldSystem);
|
||||
u16 itemID = ITEM_AZURE_FLUTE;
|
||||
|
||||
*outTextBank = TEXT_BANK_MYSTERY_GIFT_DELIVERYMAN;
|
||||
*outStringID = MysteryGiftDeliveryman_Text_ReceivedAzureFlute;
|
||||
|
||||
StringTemplate_SetPlayerName(formatter->stringTemplate, 0, SaveData_GetTrainerInfo(formatter->fieldSystem->saveData));
|
||||
StringTemplate_SetItemName(formatter->stringTemplate, 1, itemID);
|
||||
}
|
||||
|
||||
static void PrepCannotReceiveAzureFluteMsg(MystGiftGiveMsgFormatter *formatter, u16 *outTextBank, u16 *outStringID)
|
||||
{
|
||||
Bag *bag = SaveData_GetBag(formatter->fieldSystem->saveData);
|
||||
GiftData *giftData = GetCurrentPgtData(formatter->fieldSystem);
|
||||
u16 itemID = ITEM_AZURE_FLUTE;
|
||||
|
||||
*outTextBank = TEXT_BANK_MYSTERY_GIFT_DELIVERYMAN;
|
||||
*outStringID = MysteryGiftDeliveryman_Text_CannotGiveItem_HaveTooMany;
|
||||
|
||||
StringTemplate_SetItemName(formatter->stringTemplate, 0, itemID);
|
||||
}
|
||||
|
||||
static BOOL CanReceivePoketchApp(FieldSystem *fieldSystem, GiftData *dummy)
|
||||
{
|
||||
Poketch *poketch = SaveData_GetPoketch(fieldSystem->saveData);
|
||||
GiftData *giftData = GetCurrentPgtData(fieldSystem);
|
||||
|
||||
return Poketch_IsEnabled(poketch);
|
||||
}
|
||||
|
||||
static void GivePoketchApp(FieldSystem *fieldSystem, GiftData *dummy)
|
||||
{
|
||||
Poketch *poketch = SaveData_GetPoketch(fieldSystem->saveData);
|
||||
GiftData *giftData = GetCurrentPgtData(fieldSystem);
|
||||
|
||||
Poketch_RegisterApp(poketch, giftData->poketchAppID);
|
||||
}
|
||||
|
||||
static void PrepReceivedPoketchAppMsg(MystGiftGiveMsgFormatter *formatter, u16 *outTextBank, u16 *outStringID)
|
||||
{
|
||||
GiftData *giftData = GetCurrentPgtData(formatter->fieldSystem);
|
||||
|
||||
*outTextBank = TEXT_BANK_MYSTERY_GIFT_DELIVERYMAN;
|
||||
*outStringID = MysteryGiftDeliveryman_Text_ReceivedPoketchApp;
|
||||
|
||||
StringTemplate_SetPlayerName(formatter->stringTemplate, 0, SaveData_GetTrainerInfo(formatter->fieldSystem->saveData));
|
||||
StringTemplate_SetPoketchAppName(formatter->stringTemplate, 1, giftData->poketchAppID);
|
||||
}
|
||||
|
||||
static void PrepCannotReceivePoketchAppMsg(MystGiftGiveMsgFormatter *formatter, u16 *outTextBank, u16 *outStringID)
|
||||
{
|
||||
GiftData *giftData = GetCurrentPgtData(formatter->fieldSystem);
|
||||
|
||||
*outTextBank = TEXT_BANK_MYSTERY_GIFT_DELIVERYMAN;
|
||||
*outStringID = MysteryGiftDeliveryman_Text_HaventObtainedPoketch;
|
||||
|
||||
StringTemplate_SetPlayerName(formatter->stringTemplate, 0, SaveData_GetTrainerInfo(formatter->fieldSystem->saveData));
|
||||
}
|
||||
|
||||
static const GiftHandler giftHandlers[] = {
|
||||
{ CanReceivePokemon, GivePokemon, PrepReceivedPokemonMsg, PrepCannotReceivePokemonMsg }, // Pokemon
|
||||
{ CanReceivePokemon, GiveEgg, PrepReceivedEggMsg, PrepCannotReceivePokemonMsg }, // Egg
|
||||
{ CanReceiveItem, GiveItem, PrepReceivedItemMsg, PrepCannotReceiveItemMsg }, // Item
|
||||
{ CanReceiveBattleReg, GiveBattleReg, PrepReceivedRulesMsg, PrepCannotReceiveRulesMsg }, // Battle regulation
|
||||
{ CanReceiveDecorationGood, GiveDecorationGood, PrepReceivedDecoGoodMsg, PrepCannotReceiveDecoGood }, // Underground decoration good
|
||||
{ CanReceiveCosmetic, GiveCosmetic, PrepReceivedCosmeticMsg, PrepCannotReceiveCosmeticMsg }, // Seal/Accessory/Backdrop
|
||||
{ CanReceivePokemon, GenerateManaphyEgg, PrepReceivedManaphyEggMsg, PrepCannotReceivePokemonMsg }, // Manaphy egg
|
||||
{ CanReceiveMemberCard, InitDarkraiEvent, PrepReceivedMemberCardMsg, PrepCannotReceiveMemberCardMsg }, // Member card
|
||||
{ CanReceiveOaksLetter, InitShayminEvent, PrepReceivedOaksLetterMsg, PrepCannotReceivedOaksLetterMsg }, // Oak's letter
|
||||
{ CanReceiveAzureFlute, InitArceusEvent, PrepReceivedAzureFluteMsg, PrepCannotReceiveAzureFluteMsg }, // Azure flute
|
||||
{ CanReceivePoketchApp, GivePoketchApp, PrepReceivedPoketchAppMsg, PrepCannotReceivePoketchAppMsg }, // Poketch app
|
||||
{ CanReceiveSecretKey, InitRotomEvent, PrepReceivedSecretKeyMsg, PrepCannotReceiveSecretKeyMsg }, // Secret key
|
||||
{ CanReceivePokemon, GivePokemon, PrepReceivedPokemonMsg, PrepCannotReceivePokemonMsg } // Same as Pokemon, likely unused
|
||||
};
|
||||
|
|
@ -207,7 +207,7 @@ static u16 ScriptContext_LoadAndOffsetID(FieldSystem *fieldSystem, ScriptContext
|
|||
ScriptContext_Load(fieldSystem, ctx, scripts_unk_1051, TEXT_BANK_UNK_0552);
|
||||
retScriptID -= 10300;
|
||||
} else if (retScriptID >= 10200) {
|
||||
ScriptContext_Load(fieldSystem, ctx, scripts_unk_0407, TEXT_BANK_UNK_0379);
|
||||
ScriptContext_Load(fieldSystem, ctx, scripts_unk_0407, TEXT_BANK_MYSTERY_GIFT_DELIVERYMAN);
|
||||
retScriptID -= 10200;
|
||||
} else if (retScriptID >= 10150) {
|
||||
ScriptContext_Load(fieldSystem, ctx, scripts_unk_1116, TEXT_BANK_UNK_0621);
|
||||
|
|
|
|||
|
|
@ -1,755 +0,0 @@
|
|||
#include "unk_0204B830.h"
|
||||
|
||||
#include <nitro.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "constants/heap.h"
|
||||
#include "constants/species.h"
|
||||
#include "generated/items.h"
|
||||
|
||||
#include "struct_defs/struct_0202610C.h"
|
||||
|
||||
#include "field/field_system.h"
|
||||
|
||||
#include "bag.h"
|
||||
#include "field_script_context.h"
|
||||
#include "heap.h"
|
||||
#include "inlines.h"
|
||||
#include "math.h"
|
||||
#include "mystery_gift.h"
|
||||
#include "party.h"
|
||||
#include "pokemon.h"
|
||||
#include "poketch.h"
|
||||
#include "ribbon.h"
|
||||
#include "save_player.h"
|
||||
#include "script_manager.h"
|
||||
#include "strbuf.h"
|
||||
#include "string_template.h"
|
||||
#include "system_vars.h"
|
||||
#include "trainer_info.h"
|
||||
#include "unk_02017038.h"
|
||||
#include "unk_0202602C.h"
|
||||
#include "unk_0202854C.h"
|
||||
#include "unk_020298BC.h"
|
||||
#include "unk_0202C9F4.h"
|
||||
#include "unk_0202D778.h"
|
||||
#include "unk_0202F180.h"
|
||||
#include "unk_02054884.h"
|
||||
#include "unk_02092494.h"
|
||||
#include "vars_flags.h"
|
||||
|
||||
typedef struct {
|
||||
FieldSystem *fieldSystem;
|
||||
StringTemplate *unk_04;
|
||||
void *unk_08;
|
||||
} UnkStruct_0204B830;
|
||||
|
||||
typedef BOOL (*UnkFuncPtr_020EBE94)(FieldSystem *, void *);
|
||||
typedef void (*UnkFuncPtr_020EBE94_1)(FieldSystem *, void *);
|
||||
typedef void (*UnkFuncPtr_020EBE94_2)(UnkStruct_0204B830 *, u16 *, u16 *);
|
||||
typedef void (*UnkFuncPtr_020EBE94_3)(UnkStruct_0204B830 *, u16 *, u16 *);
|
||||
|
||||
typedef struct {
|
||||
UnkFuncPtr_020EBE94 unk_00;
|
||||
UnkFuncPtr_020EBE94_1 unk_04;
|
||||
UnkFuncPtr_020EBE94_2 unk_08;
|
||||
UnkFuncPtr_020EBE94_3 unk_0C;
|
||||
} UnkStruct_020EBE94;
|
||||
|
||||
static const UnkStruct_020EBE94 Unk_020EBE94[13];
|
||||
|
||||
static void sub_0204B830(UnkStruct_0204B830 *param0, FieldSystem *fieldSystem, StringTemplate *param2, void *param3)
|
||||
{
|
||||
param0->fieldSystem = fieldSystem;
|
||||
param0->unk_04 = param2;
|
||||
param0->unk_08 = param3;
|
||||
}
|
||||
|
||||
static int sub_0204B838(FieldSystem *fieldSystem)
|
||||
{
|
||||
return MysteryGift_TryGetPgtType(MysteryGift_TryGetFirstValidPgtSlot());
|
||||
}
|
||||
|
||||
static void *sub_0204B844(FieldSystem *fieldSystem)
|
||||
{
|
||||
return MysteryGift_TryGetPgtData(MysteryGift_TryGetFirstValidPgtSlot());
|
||||
}
|
||||
|
||||
static void sub_0204B850(FieldSystem *fieldSystem)
|
||||
{
|
||||
MysteryGift_FreePgtSlot(MysteryGift_TryGetFirstValidPgtSlot());
|
||||
}
|
||||
|
||||
BOOL ScrCmd_23E(ScriptContext *param0)
|
||||
{
|
||||
switch (ScriptContext_ReadHalfWord(param0)) {
|
||||
case 0:
|
||||
MysteryGift_Load(param0->fieldSystem->saveData, 32);
|
||||
break;
|
||||
case 7:
|
||||
MysteryGift_Unload(param0->fieldSystem->saveData, 0);
|
||||
break;
|
||||
case 8:
|
||||
MysteryGift_Unload(param0->fieldSystem->saveData, 1);
|
||||
break;
|
||||
case 1: {
|
||||
u16 *v0 = ScriptContext_GetVarPointer(param0);
|
||||
|
||||
if (sub_0204B838(param0->fieldSystem) != 0) {
|
||||
*v0 = 1;
|
||||
} else {
|
||||
*v0 = 0;
|
||||
}
|
||||
} break;
|
||||
case 2: {
|
||||
u16 *v1 = ScriptContext_GetVarPointer(param0);
|
||||
*v1 = sub_0204B838(param0->fieldSystem);
|
||||
} break;
|
||||
case 3: {
|
||||
u16 *v2 = ScriptContext_GetVarPointer(param0);
|
||||
const UnkStruct_020EBE94 *v3 = &Unk_020EBE94[sub_0204B838(param0->fieldSystem) - 1];
|
||||
|
||||
*v2 = v3->unk_00(param0->fieldSystem, sub_0204B844(param0->fieldSystem));
|
||||
} break;
|
||||
case 4: {
|
||||
const UnkStruct_020EBE94 *v4 = &Unk_020EBE94[sub_0204B838(param0->fieldSystem) - 1];
|
||||
|
||||
v4->unk_04(param0->fieldSystem, sub_0204B844(param0->fieldSystem));
|
||||
sub_0204B850(param0->fieldSystem);
|
||||
} break;
|
||||
case 5: {
|
||||
UnkStruct_0204B830 v5;
|
||||
const UnkStruct_020EBE94 *v6 = &Unk_020EBE94[sub_0204B838(param0->fieldSystem) - 1];
|
||||
StringTemplate **v7 = FieldSystem_GetScriptMemberPtr(param0->fieldSystem, SCRIPT_MANAGER_STR_TEMPLATE);
|
||||
u16 *v8 = ScriptContext_GetVarPointer(param0);
|
||||
u16 *v9 = ScriptContext_GetVarPointer(param0);
|
||||
|
||||
sub_0204B830(&v5, param0->fieldSystem, *v7, sub_0204B844(param0->fieldSystem));
|
||||
v6->unk_08(&v5, v8, v9);
|
||||
} break;
|
||||
case 6: {
|
||||
UnkStruct_0204B830 v10;
|
||||
const UnkStruct_020EBE94 *v11 = &Unk_020EBE94[sub_0204B838(param0->fieldSystem) - 1];
|
||||
StringTemplate **v12 = FieldSystem_GetScriptMemberPtr(param0->fieldSystem, SCRIPT_MANAGER_STR_TEMPLATE);
|
||||
u16 *v13 = ScriptContext_GetVarPointer(param0);
|
||||
u16 *v14 = ScriptContext_GetVarPointer(param0);
|
||||
|
||||
sub_0204B830(&v10, param0->fieldSystem, *v12, sub_0204B844(param0->fieldSystem));
|
||||
v11->unk_0C(&v10, v13, v14);
|
||||
} break;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static BOOL sub_0204BA50(FieldSystem *fieldSystem, void *param1)
|
||||
{
|
||||
Party *v0 = SaveData_GetParty(fieldSystem->saveData);
|
||||
|
||||
if (Party_GetCurrentCount(v0) < 6) {
|
||||
return 1;
|
||||
} else {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
static void sub_0204BA68(FieldSystem *fieldSystem, void *param1)
|
||||
{
|
||||
sub_02054930(HEAP_ID_FIELD_TASK, fieldSystem->saveData, SPECIES_MANAPHY, 1, 2, 1);
|
||||
}
|
||||
|
||||
static void sub_0204BA88(UnkStruct_0204B830 *param0, u16 *param1, u16 *param2)
|
||||
{
|
||||
*param1 = 379;
|
||||
*param2 = 13;
|
||||
|
||||
StringTemplate_SetPlayerName(param0->unk_04, 0, SaveData_GetTrainerInfo(param0->fieldSystem->saveData));
|
||||
}
|
||||
|
||||
static void sub_0204BAAC(FieldSystem *fieldSystem, void *param1)
|
||||
{
|
||||
GiftData *v0 = sub_0204B844(fieldSystem);
|
||||
TrainerInfo *v1 = SaveData_GetTrainerInfo(fieldSystem->saveData);
|
||||
VarsFlags *v2 = SaveData_GetVarsFlags(fieldSystem->saveData);
|
||||
Party *v3;
|
||||
Pokemon *v4;
|
||||
BOOL v5;
|
||||
Pokemon *v6 = NULL;
|
||||
u32 v7, v8, v9, v10;
|
||||
u32 v11;
|
||||
int v12;
|
||||
u8 *v13;
|
||||
u8 *v14;
|
||||
|
||||
v4 = &v0->pokemonGiftData.pokemon;
|
||||
v14 = (u8 *)&v0->pokemonGiftData.specialRibbonsDescIDs;
|
||||
v12 = Pokemon_GetValue(v4, MON_DATA_MET_LOCATION, NULL);
|
||||
v8 = Pokemon_GetValue(v4, MON_DATA_PERSONALITY, NULL);
|
||||
v7 = Pokemon_GetValue(v4, MON_DATA_OT_ID, NULL);
|
||||
v9 = ARNG_Next((u32)OS_GetTick());
|
||||
|
||||
if (v8 == 0x0) {
|
||||
(void)0;
|
||||
} else if (v8 == 0x1) {
|
||||
while (Pokemon_IsPersonalityShiny(v7, v9)) {
|
||||
v9 = ARNG_Next(v9);
|
||||
}
|
||||
} else {
|
||||
v9 = v8;
|
||||
}
|
||||
|
||||
sub_020780C4(v4, v9);
|
||||
v10 = Pokemon_GetGender(v4);
|
||||
|
||||
Pokemon_SetValue(v4, MON_DATA_GENDER, (u8 *)&v10);
|
||||
v10 = Pokemon_GetValue(v4, MON_DATA_HP_IV, 0) + Pokemon_GetValue(v4, MON_DATA_ATK_IV, 0) + Pokemon_GetValue(v4, MON_DATA_DEF_IV, 0) + Pokemon_GetValue(v4, MON_DATA_SPEED_IV, 0) + Pokemon_GetValue(v4, MON_DATA_SPATK_IV, 0) + Pokemon_GetValue(v4, MON_DATA_SPDEF_IV, 0);
|
||||
|
||||
if (v10 == 0) {
|
||||
v8 = LCRNG_Next();
|
||||
v9 = (v8 & (0x1F << 0)) >> 0;
|
||||
|
||||
Pokemon_SetValue(v4, MON_DATA_HP_IV, (u8 *)&v9);
|
||||
|
||||
v9 = (v8 & (0x1F << 5)) >> 5;
|
||||
Pokemon_SetValue(v4, MON_DATA_ATK_IV, (u8 *)&v9);
|
||||
|
||||
v9 = (v8 & (0x1F << 10)) >> 10;
|
||||
Pokemon_SetValue(v4, MON_DATA_DEF_IV, (u8 *)&v9);
|
||||
|
||||
v8 = LCRNG_Next();
|
||||
v9 = (v8 & (0x1F << 0)) >> 0;
|
||||
Pokemon_SetValue(v4, MON_DATA_SPEED_IV, (u8 *)&v9);
|
||||
|
||||
v9 = (v8 & (0x1F << 5)) >> 5;
|
||||
Pokemon_SetValue(v4, MON_DATA_SPATK_IV, (u8 *)&v9);
|
||||
|
||||
v9 = (v8 & (0x1F << 10)) >> 10;
|
||||
Pokemon_SetValue(v4, MON_DATA_SPDEF_IV, (u8 *)&v9);
|
||||
}
|
||||
|
||||
v13 = sub_0202D79C(fieldSystem->saveData);
|
||||
|
||||
if (Pokemon_GetValue(v4, MON_DATA_SINNOH_RED_RIBBON, 0)) {
|
||||
v13[Ribbon_TryGetSpecialDescriptionID(RIBBON_RED)] = v14[0];
|
||||
}
|
||||
|
||||
if (Pokemon_GetValue(v4, MON_DATA_SINNOH_GREEN_RIBBON, 0)) {
|
||||
v13[Ribbon_TryGetSpecialDescriptionID(RIBBON_GREEN)] = v14[1];
|
||||
}
|
||||
|
||||
if (Pokemon_GetValue(v4, MON_DATA_SINNOH_BLUE_RIBBON, 0)) {
|
||||
v13[Ribbon_TryGetSpecialDescriptionID(RIBBON_BLUE)] = v14[2];
|
||||
}
|
||||
|
||||
if (Pokemon_GetValue(v4, MON_DATA_SINNOH_FESTIVAL_RIBBON, 0)) {
|
||||
v13[Ribbon_TryGetSpecialDescriptionID(RIBBON_FESTIVAL)] = v14[3];
|
||||
}
|
||||
|
||||
if (Pokemon_GetValue(v4, MON_DATA_SINNOH_CARNIVAL_RIBBON, 0)) {
|
||||
v13[Ribbon_TryGetSpecialDescriptionID(RIBBON_CARNIVAL)] = v14[4];
|
||||
}
|
||||
|
||||
if (Pokemon_GetValue(v4, MON_DATA_SINNOH_CLASSIC_RIBBON, 0)) {
|
||||
v13[Ribbon_TryGetSpecialDescriptionID(RIBBON_CLASSIC)] = v14[5];
|
||||
}
|
||||
|
||||
if (Pokemon_GetValue(v4, MON_DATA_SINNOH_PREMIER_RIBBON, 0)) {
|
||||
v13[Ribbon_TryGetSpecialDescriptionID(RIBBON_PREMIER)] = v14[6];
|
||||
}
|
||||
|
||||
if (Pokemon_GetValue(v4, MON_DATA_HOENN_MARINE_RIBBON, 0)) {
|
||||
v13[Ribbon_TryGetSpecialDescriptionID(RIBBON_HOENN_MARINE)] = v14[7];
|
||||
}
|
||||
|
||||
if (Pokemon_GetValue(v4, MON_DATA_HOENN_LAND_RIBBON, 0)) {
|
||||
v13[Ribbon_TryGetSpecialDescriptionID(RIBBON_HOENN_LAND)] = v14[8];
|
||||
}
|
||||
|
||||
if (Pokemon_GetValue(v4, MON_DATA_HOENN_SKY_RIBBON, 0)) {
|
||||
v13[Ribbon_TryGetSpecialDescriptionID(RIBBON_HOENN_SKY)] = v14[9];
|
||||
}
|
||||
|
||||
if (v0->pokemonGiftData.hasCustomOT == 0) {
|
||||
Strbuf *v15 = TrainerInfo_NameNewStrbuf(v1, 32);
|
||||
u32 v16 = TrainerInfo_ID(v1);
|
||||
u32 v17 = TrainerInfo_Gender(v1);
|
||||
|
||||
v6 = Pokemon_New(HEAP_ID_FIELD_TASK);
|
||||
|
||||
Pokemon_Copy(v4, v6);
|
||||
Pokemon_SetValue(v6, MON_DATA_OTNAME_STRBUF, v15);
|
||||
Pokemon_SetValue(v6, MON_DATA_OT_ID, &v16);
|
||||
Pokemon_SetValue(v6, MON_DATA_OT_GENDER, &v17);
|
||||
|
||||
v4 = v6;
|
||||
Strbuf_Free(v15);
|
||||
}
|
||||
|
||||
UpdateMonStatusAndTrainerInfo(v4, v1, 4, SpecialMetLoc_GetId(2, v12), HEAP_ID_FIELD_TASK);
|
||||
|
||||
if (Pokemon_GetValue(v4, MON_DATA_SPECIES, NULL) == SPECIES_ARCEUS) {
|
||||
if (Pokemon_GetValue(v4, MON_DATA_FATEFUL_ENCOUNTER, NULL) == 1) {
|
||||
if (SystemVars_GetArceusEventState(v2) == 0) {
|
||||
SystemVars_SetArceusEventState(v2, 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Pokemon_CalcLevelAndStats(v4);
|
||||
|
||||
v3 = SaveData_GetParty(fieldSystem->saveData);
|
||||
v5 = Party_AddPokemon(v3, v4);
|
||||
|
||||
if (v5) {
|
||||
sub_0202F180(fieldSystem->saveData, v4);
|
||||
}
|
||||
|
||||
if (v6) {
|
||||
Heap_FreeToHeap(v6);
|
||||
}
|
||||
}
|
||||
|
||||
static void sub_0204BDEC(UnkStruct_0204B830 *param0, u16 *param1, u16 *param2)
|
||||
{
|
||||
GiftData *v0 = sub_0204B844(param0->fieldSystem);
|
||||
Pokemon *v1;
|
||||
|
||||
*param1 = 379;
|
||||
*param2 = 7;
|
||||
|
||||
v1 = &v0->pokemonGiftData.pokemon;
|
||||
|
||||
StringTemplate_SetPlayerName(param0->unk_04, 0, SaveData_GetTrainerInfo(param0->fieldSystem->saveData));
|
||||
StringTemplate_SetSpeciesNameWithArticle(param0->unk_04, 1, Pokemon_GetBoxPokemon(v1));
|
||||
}
|
||||
|
||||
static void sub_0204BE2C(UnkStruct_0204B830 *param0, u16 *param1, u16 *param2)
|
||||
{
|
||||
*param1 = 379;
|
||||
*param2 = 4;
|
||||
}
|
||||
|
||||
static void sub_0204BE3C(FieldSystem *fieldSystem, void *param1)
|
||||
{
|
||||
sub_0204BAAC(fieldSystem, param1);
|
||||
}
|
||||
|
||||
static void sub_0204BE44(UnkStruct_0204B830 *param0, u16 *param1, u16 *param2)
|
||||
{
|
||||
GiftData *v0 = sub_0204B844(param0->fieldSystem);
|
||||
Pokemon *v1;
|
||||
|
||||
*param1 = 379;
|
||||
*param2 = 8;
|
||||
|
||||
v1 = &v0->pokemonGiftData.pokemon;
|
||||
|
||||
StringTemplate_SetPlayerName(param0->unk_04, 0, SaveData_GetTrainerInfo(param0->fieldSystem->saveData));
|
||||
StringTemplate_SetSpeciesName(param0->unk_04, 1, Pokemon_GetBoxPokemon(v1));
|
||||
}
|
||||
|
||||
static BOOL sub_0204BE84(FieldSystem *fieldSystem, void *param1)
|
||||
{
|
||||
Bag *bag = SaveData_GetBag(fieldSystem->saveData);
|
||||
GiftData *v1 = sub_0204B844(fieldSystem);
|
||||
|
||||
return Bag_CanFitItem(bag, v1->itemGiftData.item, 1, HEAP_ID_FIELD_TASK);
|
||||
}
|
||||
|
||||
static void sub_0204BEAC(FieldSystem *fieldSystem, void *param1)
|
||||
{
|
||||
Bag *bag = SaveData_GetBag(fieldSystem->saveData);
|
||||
GiftData *v1 = sub_0204B844(fieldSystem);
|
||||
u16 v2;
|
||||
u16 v3 = v1->itemGiftData.item;
|
||||
|
||||
Bag_TryAddItem(bag, v3, 1, HEAP_ID_FIELD_TASK);
|
||||
}
|
||||
|
||||
static void sub_0204BED4(UnkStruct_0204B830 *param0, u16 *param1, u16 *param2)
|
||||
{
|
||||
GiftData *v0 = sub_0204B844(param0->fieldSystem);
|
||||
u16 v1 = v0->itemGiftData.item;
|
||||
|
||||
*param1 = 379;
|
||||
*param2 = 9;
|
||||
|
||||
StringTemplate_SetPlayerName(param0->unk_04, 0, SaveData_GetTrainerInfo(param0->fieldSystem->saveData));
|
||||
StringTemplate_SetItemName(param0->unk_04, 1, v1);
|
||||
}
|
||||
|
||||
static void sub_0204BF14(UnkStruct_0204B830 *param0, u16 *param1, u16 *param2)
|
||||
{
|
||||
Bag *bag = SaveData_GetBag(param0->fieldSystem->saveData);
|
||||
GiftData *v1 = sub_0204B844(param0->fieldSystem);
|
||||
u16 v2 = v1->itemGiftData.item;
|
||||
|
||||
*param1 = 379;
|
||||
*param2 = 5;
|
||||
|
||||
StringTemplate_SetItemName(param0->unk_04, 0, v2);
|
||||
}
|
||||
|
||||
static BOOL sub_0204BF48(FieldSystem *fieldSystem, void *param1)
|
||||
{
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static void sub_0204BF4C(FieldSystem *fieldSystem, void *param1)
|
||||
{
|
||||
GiftData *v0 = sub_0204B844(fieldSystem);
|
||||
const BattleRegulation *v1 = (const BattleRegulation *)v0;
|
||||
|
||||
sub_0202613C(fieldSystem->saveData, v1);
|
||||
}
|
||||
|
||||
static void sub_0204BF60(UnkStruct_0204B830 *param0, u16 *param1, u16 *param2)
|
||||
{
|
||||
GiftData *v0 = sub_0204B844(param0->fieldSystem);
|
||||
const BattleRegulation *v1 = (const BattleRegulation *)v0;
|
||||
Strbuf *v2;
|
||||
|
||||
*param1 = 379;
|
||||
*param2 = 10;
|
||||
|
||||
StringTemplate_SetPlayerName(param0->unk_04, 0, SaveData_GetTrainerInfo(param0->fieldSystem->saveData));
|
||||
|
||||
v2 = sub_0202605C(v1, 32);
|
||||
StringTemplate_SetStrbuf(param0->unk_04, 1, v2, 0, 1, GAME_LANGUAGE);
|
||||
Strbuf_Free(v2);
|
||||
}
|
||||
|
||||
static void sub_0204BFB8(UnkStruct_0204B830 *param0, u16 *param1, u16 *param2)
|
||||
{
|
||||
*param1 = 379;
|
||||
*param2 = 6;
|
||||
}
|
||||
|
||||
static BOOL sub_0204BFC8(FieldSystem *fieldSystem, void *param1)
|
||||
{
|
||||
int v0 = sub_020289A0(SaveData_GetUndergroundData(fieldSystem->saveData));
|
||||
|
||||
if (v0 < 200) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void sub_0204BFE0(FieldSystem *fieldSystem, void *param1)
|
||||
{
|
||||
GiftData *v0 = sub_0204B844(fieldSystem);
|
||||
int v1 = v0->decorationGoodID;
|
||||
|
||||
sub_0202895C(SaveData_GetUndergroundData(fieldSystem->saveData), v1);
|
||||
}
|
||||
|
||||
static void sub_0204BFF8(UnkStruct_0204B830 *param0, u16 *param1, u16 *param2)
|
||||
{
|
||||
GiftData *v0 = sub_0204B844(param0->fieldSystem);
|
||||
int v1 = v0->decorationGoodID;
|
||||
|
||||
*param1 = 379;
|
||||
*param2 = 11;
|
||||
|
||||
StringTemplate_SetPlayerName(param0->unk_04, 0, SaveData_GetTrainerInfo(param0->fieldSystem->saveData));
|
||||
StringTemplate_SetUndergroundGoodsName(param0->unk_04, 1, v1);
|
||||
}
|
||||
|
||||
static void sub_0204C034(UnkStruct_0204B830 *param0, u16 *param1, u16 *param2)
|
||||
{
|
||||
*param1 = 379;
|
||||
*param2 = 6;
|
||||
}
|
||||
|
||||
static BOOL sub_0204C044(FieldSystem *fieldSystem, void *param1)
|
||||
{
|
||||
GiftData *v0 = sub_0204B844(fieldSystem);
|
||||
int v1 = v0->cosmeticGiftData.type;
|
||||
int v2 = v0->cosmeticGiftData.id;
|
||||
|
||||
switch (v1) {
|
||||
case 1:
|
||||
return sub_0202CB70(SaveData_GetBallSeals(fieldSystem->saveData), v2, 1);
|
||||
case 2:
|
||||
return 1;
|
||||
case 3:
|
||||
return 1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void sub_0204C07C(FieldSystem *fieldSystem, void *param1)
|
||||
{
|
||||
GiftData *v0 = sub_0204B844(fieldSystem);
|
||||
int v1 = v0->cosmeticGiftData.type;
|
||||
int v2 = v0->cosmeticGiftData.id;
|
||||
|
||||
switch (v1) {
|
||||
case 1:
|
||||
sub_0202CAE0(SaveData_GetBallSeals(fieldSystem->saveData), v2, 1);
|
||||
break;
|
||||
case 2:
|
||||
sub_02029E2C(sub_02029D04(sub_0202A750(fieldSystem->saveData)), v2, 1);
|
||||
break;
|
||||
case 3:
|
||||
sub_02029EFC(sub_02029D04(sub_0202A750(fieldSystem->saveData)), v2);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
static void sub_0204C0CC(UnkStruct_0204B830 *param0, u16 *param1, u16 *param2)
|
||||
{
|
||||
GiftData *v0 = sub_0204B844(param0->fieldSystem);
|
||||
int v1 = v0->cosmeticGiftData.type;
|
||||
int v2 = v0->cosmeticGiftData.id;
|
||||
|
||||
switch (v1) {
|
||||
case 1:
|
||||
StringTemplate_SetBallSealName(param0->unk_04, 1, v2);
|
||||
break;
|
||||
case 2:
|
||||
StringTemplate_SetContestAccessoryName(param0->unk_04, 1, v2);
|
||||
break;
|
||||
case 3:
|
||||
StringTemplate_SetContestBackdropName(param0->unk_04, 1, v2);
|
||||
break;
|
||||
}
|
||||
|
||||
*param1 = 379;
|
||||
*param2 = 12;
|
||||
|
||||
StringTemplate_SetPlayerName(param0->unk_04, 0, SaveData_GetTrainerInfo(param0->fieldSystem->saveData));
|
||||
}
|
||||
|
||||
static void sub_0204C128(UnkStruct_0204B830 *param0, u16 *param1, u16 *param2)
|
||||
{
|
||||
*param1 = 379;
|
||||
*param2 = 6;
|
||||
}
|
||||
|
||||
static BOOL sub_0204C138(FieldSystem *fieldSystem, void *param1)
|
||||
{
|
||||
Bag *bag = SaveData_GetBag(fieldSystem->saveData);
|
||||
GiftData *v1 = sub_0204B844(fieldSystem);
|
||||
|
||||
return Bag_CanFitItem(bag, ITEM_MEMBER_CARD, 1, HEAP_ID_FIELD_TASK);
|
||||
}
|
||||
|
||||
static void InitDarkraiEvent(FieldSystem *fieldSystem, void *dummy)
|
||||
{
|
||||
Bag *bag = SaveData_GetBag(fieldSystem->saveData);
|
||||
GiftData *unused = sub_0204B844(fieldSystem);
|
||||
VarsFlags *varsFlags = SaveData_GetVarsFlags(fieldSystem->saveData);
|
||||
|
||||
Bag_TryAddItem(bag, ITEM_MEMBER_CARD, 1, HEAP_ID_FIELD_TASK);
|
||||
SystemVars_SetDistributionEventMagic(varsFlags, DISTRIBUTION_EVENT_DARKRAI);
|
||||
}
|
||||
|
||||
static void sub_0204C190(UnkStruct_0204B830 *param0, u16 *param1, u16 *param2)
|
||||
{
|
||||
GiftData *v0 = sub_0204B844(param0->fieldSystem);
|
||||
u16 v1 = 454;
|
||||
|
||||
*param1 = 379;
|
||||
*param2 = 14;
|
||||
|
||||
StringTemplate_SetPlayerName(param0->unk_04, 0, SaveData_GetTrainerInfo(param0->fieldSystem->saveData));
|
||||
StringTemplate_SetItemName(param0->unk_04, 1, v1);
|
||||
}
|
||||
|
||||
static void sub_0204C1CC(UnkStruct_0204B830 *param0, u16 *param1, u16 *param2)
|
||||
{
|
||||
Bag *v0 = SaveData_GetBag(param0->fieldSystem->saveData);
|
||||
GiftData *v1 = sub_0204B844(param0->fieldSystem);
|
||||
u16 v2 = 454;
|
||||
|
||||
*param1 = 379;
|
||||
*param2 = 5;
|
||||
|
||||
StringTemplate_SetItemName(param0->unk_04, 0, v2);
|
||||
}
|
||||
|
||||
static BOOL sub_0204C1FC(FieldSystem *fieldSystem, void *param1)
|
||||
{
|
||||
Bag *bag = SaveData_GetBag(fieldSystem->saveData);
|
||||
GiftData *v1 = sub_0204B844(fieldSystem);
|
||||
|
||||
return Bag_CanFitItem(bag, ITEM_OAKS_LETTER, 1, HEAP_ID_FIELD_TASK);
|
||||
}
|
||||
|
||||
static void InitShayminEvent(FieldSystem *fieldSystem, void *dummy)
|
||||
{
|
||||
Bag *bag = SaveData_GetBag(fieldSystem->saveData);
|
||||
GiftData *unused = sub_0204B844(fieldSystem);
|
||||
VarsFlags *varsFlags = SaveData_GetVarsFlags(fieldSystem->saveData);
|
||||
|
||||
Bag_TryAddItem(bag, ITEM_OAKS_LETTER, 1, HEAP_ID_FIELD_TASK);
|
||||
SystemVars_SetDistributionEventMagic(varsFlags, DISTRIBUTION_EVENT_SHAYMIN);
|
||||
|
||||
if (SystemVars_GetShayminEventState(varsFlags) == 0) {
|
||||
SystemVars_SetShayminEventState(varsFlags, 1);
|
||||
}
|
||||
}
|
||||
|
||||
static void sub_0204C264(UnkStruct_0204B830 *param0, u16 *param1, u16 *param2)
|
||||
{
|
||||
GiftData *v0 = sub_0204B844(param0->fieldSystem);
|
||||
u16 v1 = 452;
|
||||
|
||||
*param1 = 379;
|
||||
*param2 = 15;
|
||||
|
||||
StringTemplate_SetPlayerName(param0->unk_04, 0, SaveData_GetTrainerInfo(param0->fieldSystem->saveData));
|
||||
StringTemplate_SetItemName(param0->unk_04, 1, v1);
|
||||
}
|
||||
|
||||
static void sub_0204C2A0(UnkStruct_0204B830 *param0, u16 *param1, u16 *param2)
|
||||
{
|
||||
Bag *v0 = SaveData_GetBag(param0->fieldSystem->saveData);
|
||||
GiftData *v1 = sub_0204B844(param0->fieldSystem);
|
||||
u16 v2 = 452;
|
||||
|
||||
*param1 = 379;
|
||||
*param2 = 5;
|
||||
|
||||
StringTemplate_SetItemName(param0->unk_04, 0, v2);
|
||||
}
|
||||
|
||||
static BOOL sub_0204C2D0(FieldSystem *fieldSystem, void *param1)
|
||||
{
|
||||
Bag *bag = SaveData_GetBag(fieldSystem->saveData);
|
||||
GiftData *v1 = sub_0204B844(fieldSystem);
|
||||
|
||||
return Bag_CanFitItem(bag, ITEM_SECRET_KEY, 1, HEAP_ID_FIELD_TASK);
|
||||
}
|
||||
|
||||
static void InitRotomEvent(FieldSystem *fieldSystem, void *dummy)
|
||||
{
|
||||
Bag *bag = SaveData_GetBag(fieldSystem->saveData);
|
||||
GiftData *unused = sub_0204B844(fieldSystem);
|
||||
VarsFlags *varsFlags = SaveData_GetVarsFlags(fieldSystem->saveData);
|
||||
|
||||
Bag_TryAddItem(bag, ITEM_SECRET_KEY, 1, HEAP_ID_FIELD_TASK);
|
||||
SystemVars_SetDistributionEventMagic(varsFlags, DISTRIBUTION_EVENT_ROTOM);
|
||||
}
|
||||
|
||||
static void sub_0204C328(UnkStruct_0204B830 *param0, u16 *param1, u16 *param2)
|
||||
{
|
||||
GiftData *v0 = sub_0204B844(param0->fieldSystem);
|
||||
u16 v1 = 467;
|
||||
|
||||
*param1 = 379;
|
||||
*param2 = 17;
|
||||
|
||||
StringTemplate_SetPlayerName(param0->unk_04, 0, SaveData_GetTrainerInfo(param0->fieldSystem->saveData));
|
||||
StringTemplate_SetItemName(param0->unk_04, 1, v1);
|
||||
}
|
||||
|
||||
static void sub_0204C364(UnkStruct_0204B830 *param0, u16 *param1, u16 *param2)
|
||||
{
|
||||
Bag *v0 = SaveData_GetBag(param0->fieldSystem->saveData);
|
||||
GiftData *v1 = sub_0204B844(param0->fieldSystem);
|
||||
u16 v2 = 467;
|
||||
|
||||
*param1 = 379;
|
||||
*param2 = 5;
|
||||
|
||||
StringTemplate_SetItemName(param0->unk_04, 0, v2);
|
||||
}
|
||||
|
||||
static BOOL sub_0204C394(FieldSystem *fieldSystem, void *param1)
|
||||
{
|
||||
Bag *bag = SaveData_GetBag(fieldSystem->saveData);
|
||||
GiftData *v1 = sub_0204B844(fieldSystem);
|
||||
|
||||
return Bag_CanFitItem(bag, ITEM_AZURE_FLUTE, 1, HEAP_ID_FIELD_TASK);
|
||||
}
|
||||
|
||||
static void InitArceusEvent(FieldSystem *fieldSystem, void *dummy)
|
||||
{
|
||||
Bag *bag = SaveData_GetBag(fieldSystem->saveData);
|
||||
GiftData *unused = sub_0204B844(fieldSystem);
|
||||
VarsFlags *varsFlags = SaveData_GetVarsFlags(fieldSystem->saveData);
|
||||
|
||||
Bag_TryAddItem(bag, ITEM_AZURE_FLUTE, 1, HEAP_ID_FIELD_TASK);
|
||||
SystemVars_SetDistributionEventMagic(varsFlags, DISTRIBUTION_EVENT_ARCEUS);
|
||||
}
|
||||
|
||||
static void sub_0204C3EC(UnkStruct_0204B830 *param0, u16 *param1, u16 *param2)
|
||||
{
|
||||
GiftData *v0 = sub_0204B844(param0->fieldSystem);
|
||||
u16 v1 = 455;
|
||||
|
||||
*param1 = 379;
|
||||
*param2 = 16;
|
||||
|
||||
StringTemplate_SetPlayerName(param0->unk_04, 0, SaveData_GetTrainerInfo(param0->fieldSystem->saveData));
|
||||
StringTemplate_SetItemName(param0->unk_04, 1, v1);
|
||||
}
|
||||
|
||||
static void sub_0204C428(UnkStruct_0204B830 *param0, u16 *param1, u16 *param2)
|
||||
{
|
||||
Bag *v0 = SaveData_GetBag(param0->fieldSystem->saveData);
|
||||
GiftData *v1 = sub_0204B844(param0->fieldSystem);
|
||||
u16 v2 = 455;
|
||||
|
||||
*param1 = 379;
|
||||
*param2 = 5;
|
||||
|
||||
StringTemplate_SetItemName(param0->unk_04, 0, v2);
|
||||
}
|
||||
|
||||
static BOOL sub_0204C458(FieldSystem *fieldSystem, void *param1)
|
||||
{
|
||||
Poketch *poketch = SaveData_GetPoketch(fieldSystem->saveData);
|
||||
GiftData *v1 = sub_0204B844(fieldSystem);
|
||||
|
||||
return Poketch_IsEnabled(poketch);
|
||||
}
|
||||
|
||||
static void sub_0204C474(FieldSystem *fieldSystem, void *param1)
|
||||
{
|
||||
Poketch *poketch = SaveData_GetPoketch(fieldSystem->saveData);
|
||||
GiftData *v1 = sub_0204B844(fieldSystem);
|
||||
|
||||
Poketch_RegisterApp(poketch, v1->poketchAppID);
|
||||
}
|
||||
|
||||
static void sub_0204C494(UnkStruct_0204B830 *param0, u16 *param1, u16 *param2)
|
||||
{
|
||||
GiftData *v0 = sub_0204B844(param0->fieldSystem);
|
||||
|
||||
*param1 = 379;
|
||||
*param2 = 19;
|
||||
|
||||
StringTemplate_SetPlayerName(param0->unk_04, 0, SaveData_GetTrainerInfo(param0->fieldSystem->saveData));
|
||||
StringTemplate_SetPoketchAppName(param0->unk_04, 1, v0->poketchAppID);
|
||||
}
|
||||
|
||||
static void sub_0204C4D0(UnkStruct_0204B830 *param0, u16 *param1, u16 *param2)
|
||||
{
|
||||
GiftData *v0 = sub_0204B844(param0->fieldSystem);
|
||||
|
||||
*param1 = 379;
|
||||
*param2 = 20;
|
||||
|
||||
StringTemplate_SetPlayerName(param0->unk_04, 0, SaveData_GetTrainerInfo(param0->fieldSystem->saveData));
|
||||
}
|
||||
|
||||
static const UnkStruct_020EBE94 Unk_020EBE94[] = {
|
||||
{ sub_0204BA50, sub_0204BAAC, sub_0204BDEC, sub_0204BE2C },
|
||||
{ sub_0204BA50, sub_0204BE3C, sub_0204BE44, sub_0204BE2C },
|
||||
{ sub_0204BE84, sub_0204BEAC, sub_0204BED4, sub_0204BF14 },
|
||||
{ sub_0204BF48, sub_0204BF4C, sub_0204BF60, sub_0204BFB8 },
|
||||
{ sub_0204BFC8, sub_0204BFE0, sub_0204BFF8, sub_0204C034 },
|
||||
{ sub_0204C044, sub_0204C07C, sub_0204C0CC, sub_0204C128 },
|
||||
{ sub_0204BA50, sub_0204BA68, sub_0204BA88, sub_0204BE2C },
|
||||
{ sub_0204C138, InitDarkraiEvent, sub_0204C190, sub_0204C1CC },
|
||||
{ sub_0204C1FC, InitShayminEvent, sub_0204C264, sub_0204C2A0 },
|
||||
{ sub_0204C394, InitArceusEvent, sub_0204C3EC, sub_0204C428 },
|
||||
{ sub_0204C458, sub_0204C474, sub_0204C494, sub_0204C4D0 },
|
||||
{ sub_0204C2D0, InitRotomEvent, sub_0204C328, sub_0204C364 },
|
||||
{ sub_0204BA50, sub_0204BAAC, sub_0204BDEC, sub_0204BE2C }
|
||||
};
|
||||
Loading…
Reference in New Issue
Block a user