mirror of
https://github.com/pret/pokeheartgold.git
synced 2025-02-25 07:41:12 +00:00
Clean up game srcs for GNU compat
This commit is contained in:
parent
e4ce99c7e8
commit
561fb3d0df
@ -16,11 +16,11 @@ SET(GAME_ASM_DIR ${CMAKE_SOURCE_DIR}/asm/)
|
||||
SET(LIBS_SRC_DIR ${CMAKE_SOURCE_DIR}/lib/)
|
||||
SET(LIBS_ASM_DIR ${CMAKE_SOURCE_DIR}/lib/)
|
||||
file(GLOB_RECURSE C_SOURCES_GAME "${GAME_SRC_DIR}/*.c")
|
||||
file(GLOB_RECURSE C_SOURCES_LIBS "${LIBS_SRC_DIR}/*.c")
|
||||
file(GLOB_RECURSE CXX_SOURCES_LIBS "${LIBS_SRC_DIR}/*.cpp")
|
||||
# file(GLOB_RECURSE C_SOURCES_LIBS "${LIBS_SRC_DIR}/*.c")
|
||||
# file(GLOB_RECURSE CXX_SOURCES_LIBS "${LIBS_SRC_DIR}/*.cpp")
|
||||
file(GLOB_RECURSE ASM_SOURCES_GAME "${GAME_ASM_DIR}/*.s")
|
||||
file(GLOB_RECURSE ASM_SOURCES_LIBS "${LIBS_ASM_DIR}/*.s")
|
||||
set(SOURCES ${C_SOURCES_GAME} ${C_SOURCES_LIBS} ${CXX_SOURCES_LIBS} ${ASM_SOURCES_GAME} ${ASM_SOURCES_GAME})
|
||||
# file(GLOB_RECURSE ASM_SOURCES_LIBS "${LIBS_ASM_DIR}/*.s")
|
||||
set(SOURCES ${C_SOURCES_GAME} ${ASM_SOURCES_GAME})
|
||||
|
||||
list(JOIN SOURCES "\n" sources_join)
|
||||
|
||||
@ -30,8 +30,8 @@ endforeach()
|
||||
|
||||
add_executable(PokeHeartGold ${SOURCES})
|
||||
target_include_directories(PokeHeartGold PRIVATE include files lib/include lib/include/cw lib/include/nitro lib/include/nnsys lib/include/nitro/os include/library)
|
||||
target_compile_definitions(PokeHeartGold PUBLIC __CLION_IDE__ SDK_ARM9)
|
||||
target_compile_options(PokeHeartGold PRIVATE -Wimplicit -Werror -fms-extensions)
|
||||
target_compile_definitions(PokeHeartGold PUBLIC PUBLIC __CLION_IDE__ SDK_ARM9 SDK_CW SDK_CODE_ARM _NITRO __arm PLATFORM_INTRINSIC_FUNCTION_BIT_CLZ32=__builtin_clz wchar_t=__WCHAR_TYPE__)
|
||||
target_compile_options(PokeHeartGold PRIVATE -Wimplicit -Wno-endif-labels -fms-extensions -nostdinc -Wno-builtin-declaration-mismatch -Wno-implicit-int -Wno-multichar -Wno-address-of-packed-member -mcpu=arm946e-s)
|
||||
target_compile_features(PokeHeartGold PRIVATE c_std_99 cxx_std_98)
|
||||
|
||||
add_subdirectory(tools)
|
||||
|
@ -131,6 +131,5 @@ int ov12_02253DA0(BattleSystem *bsys, BattleContext *ctx, int battlerId);
|
||||
u32 CalcMoneyLoss(Party *party, PlayerProfile *profile);
|
||||
int ov12_02251D28(BattleSystem *bsys, BattleContext *ctx, int moveNo, int moveType, int battlerIdAttacker, int battlerIdTarget, int dmg, u32 *statusFlag);
|
||||
void ov12_02252D14(BattleSystem *bsys, BattleContext *ctx);
|
||||
void ov12_0225859C(BattleContext *ctx, u8 battlerId);
|
||||
|
||||
#endif
|
||||
|
@ -21,4 +21,8 @@ typedef struct {
|
||||
int z;
|
||||
} Vec32;
|
||||
|
||||
#ifndef __MWERKS__
|
||||
#define NONMATCHING
|
||||
#endif //__MWERKS__
|
||||
|
||||
#endif //POKEHEARTGOLD_GLOBAL_H
|
||||
|
@ -50,7 +50,7 @@ void CalcMonStats(Pokemon *mon);
|
||||
u32 GetMonData(Pokemon *mon, int attr, void * ptr);
|
||||
u32 GetBoxMonData(BoxPokemon *boxMon, int attr, void * ptr);
|
||||
void SetMonData(Pokemon *mon, int attr, const void * ptr);
|
||||
void SetBoxMonData(BoxPokemon *boxMon, int attr, void * ptr);
|
||||
void SetBoxMonData(BoxPokemon *boxMon, int attr, const void * ptr);
|
||||
void AddMonData(Pokemon *mon, int attr, int amount);
|
||||
//void AddBoxMonData(BoxPokemon *boxMon, int attr, int amount);
|
||||
BASE_STATS * AllocAndLoadMonPersonal_HandleAlternateForm(int species, int form, HeapID heapId);
|
||||
|
@ -6,6 +6,6 @@
|
||||
void *sub_0201442C(NarcId narcId, s32 fileId, HeapID heapId);
|
||||
void *sub_02014450(NarcId narcId, s32 fileId, HeapID heapId);
|
||||
// FIXME: Types are probably wrong.
|
||||
void sub_020145B4(void *a0, u32 a1, u32 a2, u32 a3, u32 a4, u32 a5, void *a6);
|
||||
void sub_020145B4(const void *a0, u32 a1, u32 a2, u32 a3, u32 a4, u32 a5, void *a6);
|
||||
|
||||
#endif //POKEHEARTGOLD_UNK_02013FDC_H
|
||||
|
@ -25,8 +25,8 @@ typedef struct BgTemplates {
|
||||
BgTemplate unk0[6];
|
||||
} BgTemplates;
|
||||
|
||||
const u8 sMainMenuMsgNos[];
|
||||
const u8 sGameInfoMsgNos[];
|
||||
const u8 ov122_021E9270[];
|
||||
extern const u8 sMainMenuMsgNos[];
|
||||
extern const u8 sGameInfoMsgNos[];
|
||||
extern const u8 ov122_021E9270[];
|
||||
|
||||
#endif //POKEHEARTGOLD_VOLTORB_FLIP_DATA_H
|
||||
|
@ -24,4 +24,12 @@ static inline NNSG3dResMdl* NNS_G3dGetMdlByIdx(const NNSG3dResMdlSet* mdlSet, u3
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static inline const void* NNS_G3dGetTexData(const NNSG3dResTex* tex) {
|
||||
return (u8*)tex + tex->texInfo.ofsTex;
|
||||
}
|
||||
|
||||
static inline const void* NNS_G3dGetPlttData(const NNSG3dResTex* tex) {
|
||||
return (u8*)tex + tex->plttInfo.ofsPlttData;
|
||||
}
|
||||
|
||||
#endif //NNSYS_G3D_BINRES_RES_STRUCT_ACCESSOR_INLINE_H_
|
||||
|
@ -850,12 +850,14 @@ static int AlphPuzzleMainSeq_RotateTile_impl(AlphPuzzleData *data) {
|
||||
data->subState++;
|
||||
break;
|
||||
case 1:
|
||||
{
|
||||
u16 temp = data->sceneTImer++;
|
||||
sub_02024818(data->selectedTile->sprite, (u16)((u16)(temp << 0xb) + (data->selectedTile->rotation << 0xe)));
|
||||
if (data->sceneTImer >= 8) {
|
||||
data->subState++;
|
||||
}
|
||||
break;
|
||||
}
|
||||
case 2:
|
||||
data->selectedTile->rotation = (data->selectedTile->rotation + 1) % 4;
|
||||
|
||||
@ -887,6 +889,7 @@ static int AlphPuzzleMainSeq_Quit_impl(AlphPuzzleData *data) {
|
||||
}
|
||||
break;
|
||||
case 2:
|
||||
{
|
||||
AlphPuzzleStates ret = AlphPuzzle_Quit_HandleYesNoPrompt(data);
|
||||
if (ret != ALPH_PUZZLE_STATE_QUIT) {
|
||||
data->subState = 0;
|
||||
@ -894,6 +897,7 @@ static int AlphPuzzleMainSeq_Quit_impl(AlphPuzzleData *data) {
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
return ALPH_PUZZLE_STATE_QUIT;
|
||||
}
|
||||
|
||||
|
@ -41,18 +41,18 @@ typedef enum BattleState {
|
||||
|
||||
BOOL Battle_Main(OVY_MANAGER *man, int *state) {
|
||||
BattleSetup *setup = OverlayManager_GetArgs(man);
|
||||
|
||||
|
||||
switch (*state) {
|
||||
case BSTATE_INIT:
|
||||
CreateHeap(HEAP_ID_3, HEAP_ID_BATTLE, 0xB0000);
|
||||
|
||||
|
||||
if ((setup->battleType & BATTLE_TYPE_LINK) && !(setup->battleSpecial & BATTLE_SPECIAL_RECORDED)) {
|
||||
*state = BSTATE_LINK_INIT;
|
||||
} else {
|
||||
*state = BSTATE_UNK_A_INIT;
|
||||
}
|
||||
break;
|
||||
case BSTATE_LINK_INIT:
|
||||
case BSTATE_LINK_INIT:
|
||||
ov12_022399D4(man, setup);
|
||||
sub_02039F68(setup->unk_12C);
|
||||
if (!sub_02039998()) {
|
||||
@ -134,26 +134,29 @@ BOOL Battle_Main(OVY_MANAGER *man, int *state) {
|
||||
*state = BSTATE_EXIT;
|
||||
break;
|
||||
case BSTATE_EVOLUTION_INIT:
|
||||
{
|
||||
int selectedMonIndex;
|
||||
int evolutionSpecies;
|
||||
int evolutionCondition;
|
||||
Pokemon *mon;
|
||||
|
||||
|
||||
evolutionSpecies = BattleSystem_CheckEvolution(setup, &selectedMonIndex, &evolutionCondition);
|
||||
|
||||
|
||||
if (evolutionSpecies) {
|
||||
CreateHeap(HEAP_ID_3, HEAP_ID_EVOLUTION, 0x30000);
|
||||
mon = Party_GetMonByIndex(setup->party[BATTLER_PLAYER], selectedMonIndex);
|
||||
setup->unk198 = sub_02075A7C(setup->party[BATTLER_PLAYER], mon, evolutionSpecies,
|
||||
setup->options, setup->unk_164, setup->pokedex,
|
||||
setup->bag, setup->gameStats, evolutionCondition,
|
||||
setup->unk198 = sub_02075A7C(setup->party[BATTLER_PLAYER], mon, evolutionSpecies,
|
||||
setup->options, setup->unk_164, setup->pokedex,
|
||||
setup->bag, setup->gameStats, evolutionCondition,
|
||||
3, HEAP_ID_EVOLUTION);
|
||||
*state = BSTATE_EVOLUTION_MAIN;
|
||||
} else {
|
||||
*state = BSTATE_EXIT;
|
||||
}
|
||||
break;
|
||||
}
|
||||
case BSTATE_EVOLUTION_MAIN:
|
||||
{
|
||||
void *data = setup->unk198;
|
||||
if (sub_02075D3C(data) == TRUE) {
|
||||
sub_02075D4C(data);
|
||||
@ -161,6 +164,7 @@ BOOL Battle_Main(OVY_MANAGER *man, int *state) {
|
||||
*state = BSTATE_EVOLUTION_INIT;
|
||||
}
|
||||
break;
|
||||
}
|
||||
case BSTATE_EXIT:
|
||||
return TRUE;
|
||||
}
|
||||
@ -173,7 +177,7 @@ void ov12_02237B0C(BattleSystem *bsys) {
|
||||
bsys->unk240E_F = 1;
|
||||
FontID_Release(4);
|
||||
ov12_0223BBF0(bsys, 3);
|
||||
|
||||
|
||||
if (bsys->unk2445 == 0) {
|
||||
UnloadOverlayByID(FS_OVERLAY_ID(OVY_7));
|
||||
} else {
|
||||
@ -196,46 +200,46 @@ void ov12_02237B6C(BattleSystem *bsys) {
|
||||
|
||||
void ov12_02237BB8(BattleSystem *bsys) {
|
||||
UnloadOverlayByID(FS_OVERLAY_ID(OVY_8));
|
||||
|
||||
|
||||
if (bsys->unk2445 == 0) {
|
||||
HandleLoadOverlay(FS_OVERLAY_ID(OVY_7), OVY_LOAD_ASYNC);
|
||||
} else {
|
||||
HandleLoadOverlay(FS_OVERLAY_ID(OVY_10), OVY_LOAD_ASYNC);
|
||||
}
|
||||
|
||||
|
||||
ov12_0223BBF0(bsys, 0);
|
||||
|
||||
int size = sub_02026E9C();
|
||||
void *data = sub_02026E94();
|
||||
MIi_CpuClear16(0, data, size);
|
||||
|
||||
|
||||
NARC *unkNarcA = NARC_New(NARC_a_0_0_7, HEAP_ID_BATTLE);
|
||||
NARC *unkNarcB = NARC_New(NARC_a_0_0_8, HEAP_ID_BATTLE);
|
||||
|
||||
|
||||
bsys->unk19C = ov12_022660D0(unkNarcA, unkNarcB, bsys, BattleSystem_GetTrainerGender(bsys, ov12_0223BFC0(bsys)), bsys->unk1C0);
|
||||
|
||||
|
||||
FontID_Alloc(4, HEAP_ID_BATTLE);
|
||||
|
||||
|
||||
bsys->unk240F_1 = 1;
|
||||
|
||||
|
||||
ov12_0226604C(bsys->bgConfig);
|
||||
GfGfx_EngineBTogglePlanes(GX_PLANEMASK_OBJ, GF_PLANE_TOGGLE_ON);
|
||||
ov12_02266390(bsys->unk19C);
|
||||
ov12_02266508(unkNarcA, unkNarcB, bsys->unk19C, 0, TRUE, NULL);
|
||||
ov12_02266644(unkNarcB, bsys->unk19C);
|
||||
|
||||
|
||||
NARC_Delete(unkNarcA);
|
||||
NARC_Delete(unkNarcB);
|
||||
|
||||
|
||||
sub_020027F0(1);
|
||||
ov12_0223A620(bsys);
|
||||
|
||||
|
||||
G2dRenderer_SetSubSurfaceCoords(SpriteRenderer_GetG2dRendererPtr(bsys->unk90), 0, FX32_CONST(272));
|
||||
}
|
||||
|
||||
void ov12_02237CC4(BattleSystem *bsys) {
|
||||
RemoveWindow(bsys->window);
|
||||
|
||||
|
||||
GfGfx_EngineATogglePlanes(GX_PLANEMASK_BG0, GF_PLANE_TOGGLE_OFF);
|
||||
GfGfx_EngineATogglePlanes(GX_PLANEMASK_BG1, GF_PLANE_TOGGLE_OFF);
|
||||
FreeBgTilemapBuffer(bsys->bgConfig, GF_BG_LYR_MAIN_1);
|
||||
|
@ -71,6 +71,7 @@ BOOL BtlCmd_PokemonEncounter(BattleSystem *bsys, BattleContext *ctx) {
|
||||
case B_SIDE_PLAYER:
|
||||
break;
|
||||
case B_SIDE_OPPONENT:
|
||||
{
|
||||
OpponentData *opponentData;
|
||||
for (battlerId = 0; battlerId < battlersMax; battlerId++) {
|
||||
opponentData = BattleSystem_GetOpponentData(bsys, battlerId);
|
||||
@ -81,6 +82,7 @@ BOOL BtlCmd_PokemonEncounter(BattleSystem *bsys, BattleContext *ctx) {
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
@ -1240,7 +1242,7 @@ BOOL BtlCmd_ShouldGetExp(BattleSystem *bsys, BattleContext *ctx) {
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
void Task_GetExp(SysTask *task, void *data);
|
||||
static void Task_GetExp(SysTask *task, void *data);
|
||||
|
||||
BOOL BtlCmd_InitGetExp(BattleSystem *bsys, BattleContext *ctx) {
|
||||
BattleScriptIncrementPointer(ctx, 1);
|
||||
@ -1493,9 +1495,11 @@ BOOL BtlCmd_ChangeVar(BattleSystem *bsys, BattleContext *ctx) {
|
||||
*var <<= val;
|
||||
break;
|
||||
case 15:
|
||||
{
|
||||
u32 uvar = *var;
|
||||
*var = uvar >> val;
|
||||
break;
|
||||
}
|
||||
case 16:
|
||||
*var = MaskOfFlagNo(val);
|
||||
break;
|
||||
@ -1736,9 +1740,11 @@ BOOL BtlCmd_ChangeMonDataVar(BattleSystem *bsys, BattleContext *ctx) {
|
||||
var <<= val;
|
||||
break;
|
||||
case 15:
|
||||
{
|
||||
u32 uvar = var;
|
||||
var = uvar >> val;
|
||||
break;
|
||||
}
|
||||
case 16:
|
||||
var = MaskOfFlagNo(val);
|
||||
break;
|
||||
@ -1887,9 +1893,11 @@ BOOL BtlCmd_ChangeVar2(BattleSystem *bsys, BattleContext *ctx) {
|
||||
*var <<= *val;
|
||||
break;
|
||||
case 15:
|
||||
{
|
||||
u32 uvar = *var;
|
||||
*var = uvar >> *val;
|
||||
break;
|
||||
}
|
||||
case 16:
|
||||
*var = MaskOfFlagNo(*val);
|
||||
break;
|
||||
@ -1955,9 +1963,11 @@ BOOL BtlCmd_ChangeMonDataByVar(BattleSystem *bsys, BattleContext *ctx) {
|
||||
var <<= *val;
|
||||
break;
|
||||
case 15:
|
||||
{
|
||||
u32 uvar = var;
|
||||
var = uvar >> *val;
|
||||
break;
|
||||
}
|
||||
case 16:
|
||||
var = MaskOfFlagNo(*val);
|
||||
break;
|
||||
@ -2122,22 +2132,30 @@ u32 CalcPrizeMoney(BattleSystem *bsys, BattleContext *ctx, int trainerIndex) {
|
||||
switch (trainer.data.trainerType) {
|
||||
default:
|
||||
case 0:
|
||||
{
|
||||
TRPOKE_NOITEM_DFLTMOVES *pokeDef = (TRPOKE_NOITEM_DFLTMOVES *)trPoke;
|
||||
level = pokeDef[trainer.data.npoke-1].level;
|
||||
break;
|
||||
}
|
||||
case 1:
|
||||
{
|
||||
TRPOKE_NOITEM_CUSTMOVES *pokeCust = (TRPOKE_NOITEM_CUSTMOVES *)trPoke;
|
||||
level = pokeCust[trainer.data.npoke-1].level;
|
||||
break;
|
||||
}
|
||||
case 2:
|
||||
{
|
||||
TRPOKE_ITEM_DFLTMOVES *pokeItem = (TRPOKE_ITEM_DFLTMOVES *)trPoke;
|
||||
level = pokeItem[trainer.data.npoke-1].level;
|
||||
break;
|
||||
}
|
||||
case 3:
|
||||
{
|
||||
TRPOKE_ITEM_CUSTMOVES *pokeCustItem = (TRPOKE_ITEM_CUSTMOVES *)trPoke;
|
||||
level = pokeCustItem[trainer.data.npoke-1].level;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
i = 0;
|
||||
trainerClass = trainer.data.trainerClass;
|
||||
@ -6011,7 +6029,7 @@ static void Task_GetExp(SysTask *task, void *inData)
|
||||
}
|
||||
|
||||
switch (data->state) {
|
||||
case STATE_GET_EXP_START:
|
||||
case STATE_GET_EXP_START:
|
||||
item = GetMonData(mon, MON_DATA_HELD_ITEM, NULL);
|
||||
itemEffect = GetItemAttr(item, ITEM_VAR_HOLD_EFFECT, HEAP_ID_BATTLE);
|
||||
|
||||
@ -6083,7 +6101,7 @@ static void Task_GetExp(SysTask *task, void *inData)
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
|
||||
case STATE_GET_EXP_WAIT_MESSAGE_PRINT:
|
||||
if (!TextPrinterCheckActive(data->unk30[0])) {
|
||||
data->state++;
|
||||
@ -6179,11 +6197,11 @@ static void Task_GetExp(SysTask *task, void *inData)
|
||||
Window *window = BattleSystem_GetWindow(data->bsys, 1);
|
||||
PaletteData *palette = BattleSystem_GetPaletteData(data->bsys);
|
||||
|
||||
G2_SetBG0Priority(2);
|
||||
G2_SetBG0Priority(2);
|
||||
SetBgPriority(GF_BG_LYR_MAIN_1, 1);
|
||||
SetBgPriority(GF_BG_LYR_MAIN_2, 0);
|
||||
|
||||
ov12_0223C224(data->bsys, 1);
|
||||
ov12_0223C224(data->bsys, 1);
|
||||
|
||||
sub_0200E398(bgConfig, 2, 1, 0, HEAP_ID_BATTLE);
|
||||
PaletteData_LoadNarc(palette, NARC_a_0_3_8, sub_0200E3D8(), HEAP_ID_BATTLE, 0, 0x20, 8 * 0x10);
|
||||
@ -6197,7 +6215,7 @@ static void Task_GetExp(SysTask *task, void *inData)
|
||||
case STATE_GET_EXP_LEVEL_UP_SUMMARY_PRINT_DIFF: {
|
||||
TempStatsStruct stats = ov12_0226C36C;
|
||||
TempStatsStruct monData = ov12_0226C384;
|
||||
|
||||
|
||||
Window *window = BattleSystem_GetWindow(data->bsys, 1);
|
||||
PokemonStats *oldStats = data->ctx->prevLevelStats;
|
||||
|
||||
@ -6245,7 +6263,8 @@ static void Task_GetExp(SysTask *task, void *inData)
|
||||
}
|
||||
break;
|
||||
|
||||
case STATE_GET_EXP_LEVEL_UP_CLEAR:
|
||||
case STATE_GET_EXP_LEVEL_UP_CLEAR:
|
||||
{
|
||||
Window *window = BattleSystem_GetWindow(data->bsys, 1);
|
||||
|
||||
sub_0200E5D4(window, 0);
|
||||
@ -6264,8 +6283,10 @@ static void Task_GetExp(SysTask *task, void *inData)
|
||||
FreeToHeap(data->ctx->prevLevelStats);
|
||||
data->state = STATE_GET_EXP_CHECK_LEARN_MOVE;
|
||||
break;
|
||||
}
|
||||
|
||||
case STATE_GET_EXP_CHECK_LEARN_MOVE:
|
||||
case STATE_GET_EXP_CHECK_LEARN_MOVE:
|
||||
{
|
||||
u16 move;
|
||||
BgConfig *bgConfig = BattleSystem_GetBgConfig(data->bsys); // unused, but must be kept to match
|
||||
|
||||
@ -6293,7 +6314,7 @@ static void Task_GetExp(SysTask *task, void *inData)
|
||||
break;
|
||||
}
|
||||
break;
|
||||
|
||||
}
|
||||
|
||||
case STATE_GET_EXP_WANTS_TO_LEARN_MOVE_PRINT:
|
||||
msg.id = msg_0197_01178; // "{0} wants to learn the move {1}."
|
||||
@ -6399,7 +6420,7 @@ static void Task_GetExp(SysTask *task, void *inData)
|
||||
data->unk30[0] = BattleSystem_PrintBattleMessage(data->bsys, msgLoader, &msg, BattleSystem_GetTextFrameDelay(data->bsys));
|
||||
data->state++;
|
||||
break;
|
||||
|
||||
|
||||
case STATE_GET_EXP_FORGOT_HOW_TO_USE:
|
||||
msg.id = msg_0197_01190; // "{0} forgot how to use {1}."
|
||||
msg.tag = TAG_NICKNAME_MOVE;
|
||||
@ -6415,14 +6436,14 @@ static void Task_GetExp(SysTask *task, void *inData)
|
||||
data->unk30[0] = BattleSystem_PrintBattleMessage(data->bsys, msgLoader, &msg, BattleSystem_GetTextFrameDelay(data->bsys));
|
||||
data->state++;
|
||||
break;
|
||||
|
||||
|
||||
case STATE_GET_EXP_LEARNED_MOVE:
|
||||
msg.id = msg_0197_01192; // "{0} learned {1}!"
|
||||
msg.tag = TAG_NICKNAME_MOVE;
|
||||
msg.param[0] = expBattler | (slot << 8);
|
||||
msg.param[1] = data->unk30[4];
|
||||
data->unk30[0] = BattleSystem_PrintBattleMessage(data->bsys, msgLoader, &msg, BattleSystem_GetTextFrameDelay(data->bsys));
|
||||
|
||||
|
||||
i = 0;
|
||||
SetMonData(mon, MON_DATA_MOVE1PPUP + data->unk30[5], &i);
|
||||
MonSetMoveInSlot(mon, data->unk30[4], data->unk30[5]);
|
||||
|
@ -16,13 +16,13 @@ extern ControllerFunction sPlayerBattleCommands[];
|
||||
BattleContext *BattleContext_New(BattleSystem *bsys) {
|
||||
BattleContext *ctx = (BattleContext *) AllocFromHeap(HEAP_ID_BATTLE, sizeof(BattleContext));
|
||||
MIi_CpuClearFast(0, (u32 *)ctx, sizeof(BattleContext));
|
||||
|
||||
|
||||
BattleContext_Init(ctx);
|
||||
ov12_02251038(bsys, ctx);
|
||||
ov12_0224E384(bsys, ctx);
|
||||
LoadMoveTbl(ctx->trainerAIData.moveData);
|
||||
ctx->trainerAIData.itemData = LoadAllItemData(HEAP_ID_BATTLE);
|
||||
|
||||
|
||||
return ctx;
|
||||
}
|
||||
|
||||
@ -32,7 +32,7 @@ BOOL BattleContext_Main(BattleSystem *bsys, BattleContext *ctx) {
|
||||
ctx->command = CONTROLLER_COMMAND_42;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
sPlayerBattleCommands[ctx->command](bsys, ctx);
|
||||
if (ctx->command == CONTROLLER_COMMAND_45) {
|
||||
return TRUE;
|
||||
@ -54,11 +54,11 @@ void BattleSystem_CheckMoveHitEffect(BattleSystem *bsys, BattleContext *ctx, int
|
||||
void BattleControllerPlayer_GetBattleMon(BattleSystem *bsys, BattleContext *ctx) {
|
||||
int battlerId;
|
||||
int maxBattlers = BattleSystem_GetMaxBattlers(bsys);
|
||||
|
||||
|
||||
for (battlerId = 0; battlerId < maxBattlers; battlerId++) {
|
||||
BattleSystem_GetBattleMon(bsys, ctx, battlerId, ctx->selectedMonIndex[battlerId]);
|
||||
}
|
||||
|
||||
|
||||
ctx->hpTemp = ctx->battleMons[1].hp;
|
||||
ctx->command = CONTROLLER_COMMAND_START_ENCOUNTER;
|
||||
}
|
||||
@ -79,14 +79,14 @@ void BattleControllerPlayer_TrainerMessage(BattleSystem *bsys, BattleContext *ct
|
||||
} else {
|
||||
ctx->command = CONTROLLER_COMMAND_SEND_OUT;
|
||||
}
|
||||
|
||||
|
||||
SortMonsBySpeed(bsys, ctx);
|
||||
}
|
||||
|
||||
//static
|
||||
void BattleControllerPlayer_PokemonAppear(BattleSystem *bsys, BattleContext *ctx) {
|
||||
int script = TryAbilityOnEntry(bsys, ctx);
|
||||
|
||||
|
||||
if (script) {
|
||||
ReadBattleScriptFromNarc(ctx, NARC_a_0_0_1, script);
|
||||
ctx->commandNext = ctx->command;
|
||||
@ -102,16 +102,16 @@ void BattleControllerPlayer_PokemonAppear(BattleSystem *bsys, BattleContext *ctx
|
||||
void BattleControllerPlayer_SelectionScreenInit(BattleSystem *bsys, BattleContext *ctx) {
|
||||
int battlerId;
|
||||
int maxBattlers = BattleSystem_GetMaxBattlers(bsys);
|
||||
|
||||
|
||||
for (battlerId = 0; battlerId < maxBattlers; battlerId++) {
|
||||
ctx->unk_0[battlerId] = 0;
|
||||
ctx->battleMons[battlerId].moveEffectFlagsTemp = ctx->battleMons[battlerId].moveEffectFlags;
|
||||
ctx->unk_314C[battlerId] = 0;
|
||||
}
|
||||
|
||||
|
||||
ov12_0223BB64(bsys, 0);
|
||||
ov12_02237ED0(bsys, 1);
|
||||
|
||||
|
||||
ctx->command = CONTROLLER_COMMAND_SELECTION_SCREEN_INPUT;
|
||||
}
|
||||
|
||||
@ -139,16 +139,16 @@ typedef enum BattleSelectState {
|
||||
//static
|
||||
void BattleControllerPlayer_SelectionScreenInput(BattleSystem *bsys, BattleContext *ctx) {
|
||||
int battlerId;
|
||||
int battlersMax;
|
||||
int battlersMax;
|
||||
int var;
|
||||
s32 battleType;
|
||||
BattleMessage msg;
|
||||
|
||||
battlersMax = BattleSystem_GetMaxBattlers(bsys);
|
||||
battleType = BattleSystem_GetBattleType(bsys);
|
||||
|
||||
|
||||
var = 0;
|
||||
|
||||
|
||||
for (battlerId = 0; battlerId < battlersMax; battlerId++) {
|
||||
switch (ctx->unk_0[battlerId]) {
|
||||
case SSI_STATE_0:
|
||||
@ -174,6 +174,7 @@ void BattleControllerPlayer_SelectionScreenInput(BattleSystem *bsys, BattleConte
|
||||
}
|
||||
break;
|
||||
case SSI_STATE_2:
|
||||
{
|
||||
int battlerIdCheck;
|
||||
|
||||
for (battlerIdCheck = 0; battlerIdCheck < battlersMax; battlerIdCheck++) {
|
||||
@ -196,6 +197,7 @@ void BattleControllerPlayer_SelectionScreenInput(BattleSystem *bsys, BattleConte
|
||||
} else {
|
||||
break;
|
||||
}
|
||||
}
|
||||
//fallthrough
|
||||
case SSI_STATE_1:
|
||||
if (ov12_0225682C(ctx, battlerId)) {
|
||||
@ -345,6 +347,7 @@ void BattleControllerPlayer_SelectionScreenInput(BattleSystem *bsys, BattleConte
|
||||
}
|
||||
break;
|
||||
case SSI_STATE_5:
|
||||
{
|
||||
int out;
|
||||
|
||||
if (ov12_0224DB64(bsys, ctx, battlerId, battleType, &out, ctx->movePos[battlerId], &ctx->unk_21A8[battlerId][1])) {
|
||||
@ -354,6 +357,7 @@ void BattleControllerPlayer_SelectionScreenInput(BattleSystem *bsys, BattleConte
|
||||
ctx->unk_0[battlerId] = SSI_STATE_13;
|
||||
}
|
||||
break;
|
||||
}
|
||||
case SSI_STATE_6:
|
||||
if (ov12_0225682C(ctx, battlerId) == 0xff) {
|
||||
ctx->unk_0[battlerId] = SSI_STATE_3;
|
||||
@ -379,6 +383,7 @@ void BattleControllerPlayer_SelectionScreenInput(BattleSystem *bsys, BattleConte
|
||||
}
|
||||
break;
|
||||
case SSI_STATE_9: //switching..?
|
||||
{
|
||||
int v8;
|
||||
int v9 = 6;
|
||||
int partnerId;
|
||||
@ -395,6 +400,7 @@ void BattleControllerPlayer_SelectionScreenInput(BattleSystem *bsys, BattleConte
|
||||
|
||||
BattleController_EmitShowMonList(bsys, ctx, battlerId, 0, v8, v9);
|
||||
ctx->unk_0[battlerId] = SSI_STATE_10;
|
||||
}
|
||||
//fallthrough
|
||||
case SSI_STATE_10:
|
||||
if (ov12_0225682C(ctx, battlerId) == 0xff) {
|
||||
@ -512,12 +518,12 @@ void ov12_02249190(BattleSystem *bsys, BattleContext *ctx) {
|
||||
int i, j;
|
||||
int turn;
|
||||
u32 flag;
|
||||
|
||||
|
||||
maxBattlers = BattleSystem_GetMaxBattlers(bsys);
|
||||
battleType = BattleSystem_GetBattleType(bsys);
|
||||
|
||||
|
||||
turn = 0;
|
||||
|
||||
|
||||
if (battleType & (BATTLE_TYPE_SAFARI | BATTLE_TYPE_PAL_PARK)) {
|
||||
for (battlerId = 0; battlerId < maxBattlers; battlerId++) {
|
||||
ctx->unk_21E8[battlerId] = battlerId;
|
||||
@ -556,19 +562,19 @@ void ov12_02249190(BattleSystem *bsys, BattleContext *ctx) {
|
||||
turn++;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
for (battlerId = 0; battlerId < maxBattlers; battlerId++) {
|
||||
if (ctx->unk_21A8[battlerId][3] != 2 && ctx->unk_21A8[battlerId][3] != 3) {
|
||||
ctx->unk_21E8[turn] = battlerId;
|
||||
turn++;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
for (i = 0; i < maxBattlers - 1; i++) {
|
||||
for (j = i + 1; j < maxBattlers; j++) {
|
||||
int battlerId1 = ctx->unk_21E8[i];
|
||||
int battlerId2 = ctx->unk_21E8[j];
|
||||
|
||||
|
||||
if (ctx->unk_21A8[battlerId1][3] == ctx->unk_21A8[battlerId2][3]) {
|
||||
if (ctx->unk_21A8[battlerId1][3] == 1) {
|
||||
flag = 0;
|
||||
@ -582,10 +588,10 @@ void ov12_02249190(BattleSystem *bsys, BattleContext *ctx) {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
ctx->command = CONTROLLER_COMMAND_7;
|
||||
}
|
||||
|
||||
@ -594,7 +600,7 @@ void ov12_0224930C(BattleSystem *bsys, BattleContext *ctx) {
|
||||
int flag = 0;
|
||||
int battlerId;
|
||||
int maxBattlers = BattleSystem_GetMaxBattlers(bsys);
|
||||
|
||||
|
||||
do {
|
||||
switch (ctx->unk_28) {
|
||||
case 0: //Focus Punch
|
||||
@ -637,7 +643,7 @@ void ov12_0224930C(BattleSystem *bsys, BattleContext *ctx) {
|
||||
ctx->unk_28 = 0;
|
||||
flag = 2;
|
||||
break;
|
||||
}
|
||||
}
|
||||
} while (flag == 0);
|
||||
if (flag == 2) {
|
||||
ctx->command = CONTROLLER_COMMAND_8;
|
||||
@ -648,22 +654,22 @@ void ov12_0224930C(BattleSystem *bsys, BattleContext *ctx) {
|
||||
void ov12_02249460(BattleSystem *bsys, BattleContext *ctx) {
|
||||
int maxBattlers;
|
||||
int battlerId;
|
||||
|
||||
|
||||
maxBattlers = BattleSystem_GetMaxBattlers(bsys);
|
||||
|
||||
|
||||
if (ov12_022581BC(bsys, ctx)) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
ctx->battlersOnField = 0;
|
||||
for (battlerId = 0; battlerId < maxBattlers; battlerId++) {
|
||||
if (ctx->unk_21A8[battlerId][0] != 40) {
|
||||
ctx->battlersOnField++;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
SortMonsBySpeed(bsys, ctx);
|
||||
|
||||
|
||||
if (ctx->unk_EC == maxBattlers) {
|
||||
ctx->unk_EC = 0;
|
||||
ctx->command = CONTROLLER_COMMAND_UPDATE_FIELD_CONDITION;
|
||||
@ -689,12 +695,12 @@ typedef enum UpdateFieldConditionState {
|
||||
UFC_STATE_END
|
||||
} UpdateFieldConditionState;
|
||||
|
||||
//static
|
||||
//static
|
||||
void BattleControllerPlayer_UpdateFieldCondition(BattleSystem *bsys, BattleContext *ctx) {
|
||||
int flag = 0;
|
||||
int side;
|
||||
int maxBattlers = BattleSystem_GetMaxBattlers(bsys);
|
||||
|
||||
|
||||
do {
|
||||
if (ov12_0224DC74(ctx, ctx->command, ctx->command, 1) == TRUE) {
|
||||
return;
|
||||
@ -705,7 +711,7 @@ void BattleControllerPlayer_UpdateFieldCondition(BattleSystem *bsys, BattleConte
|
||||
if (ov12_0224D7EC(bsys, ctx) == TRUE) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
switch (ctx->stateFieldConditionUpdate) {
|
||||
case UFC_STATE_REFLECT:
|
||||
while (ctx->fieldConditionUpdateData < 2) {
|
||||
@ -1000,11 +1006,11 @@ void BattleControllerPlayer_UpdateFieldCondition(BattleSystem *bsys, BattleConte
|
||||
break;
|
||||
}
|
||||
} while (!flag);
|
||||
|
||||
|
||||
if (flag == 1) {
|
||||
ov12_022642F0(bsys);
|
||||
}
|
||||
|
||||
|
||||
if (flag == 2) {
|
||||
ctx->stateFieldConditionUpdate = 0;
|
||||
ctx->command = CONTROLLER_COMMAND_10;
|
||||
@ -1047,21 +1053,21 @@ void BattleControllerPlayer_UpdateMonCondition(BattleSystem *bsys, BattleContext
|
||||
u8 flag = 0;
|
||||
int maxBattlers;
|
||||
int battlerId;
|
||||
|
||||
|
||||
maxBattlers = BattleSystem_GetMaxBattlers(bsys);
|
||||
|
||||
|
||||
if (ov12_0224DC74(ctx, ctx->command, ctx->command, 1) == TRUE) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
if (ov12_0224DD18(ctx, ctx->command, ctx->command) == TRUE) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
if (ov12_0224D7EC(bsys, ctx) == TRUE) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
while (ctx->updateMonConditionData < maxBattlers) {
|
||||
battlerId = ctx->turnOrder[ctx->updateMonConditionData];
|
||||
if (ctx->unk_3108 & MaskOfFlagNo(battlerId)) {
|
||||
@ -1120,7 +1126,7 @@ void BattleControllerPlayer_UpdateMonCondition(BattleSystem *bsys, BattleContext
|
||||
ctx->stateUpdateMonCondition++;
|
||||
break;
|
||||
case UMC_STATE_LEECH_SEED:
|
||||
if ((ctx->battleMons[battlerId].moveEffectFlags & MOVE_EFFECT_FLAG_LEECH_SEED) && ctx->battleMons[ctx->battleMons[battlerId].moveEffectFlags & MOVE_EFFECT_FLAG_LEECH_SEED_BATTLER].hp &&
|
||||
if ((ctx->battleMons[battlerId].moveEffectFlags & MOVE_EFFECT_FLAG_LEECH_SEED) && ctx->battleMons[ctx->battleMons[battlerId].moveEffectFlags & MOVE_EFFECT_FLAG_LEECH_SEED_BATTLER].hp &&
|
||||
GetBattlerAbility(ctx, battlerId) != ABILITY_MAGIC_GUARD && ctx->battleMons[battlerId].hp) {
|
||||
ctx->unk_11C = ctx->battleMons[battlerId].moveEffectFlags & MOVE_EFFECT_FLAG_LEECH_SEED_BATTLER;
|
||||
ctx->unk_120 = battlerId;
|
||||
@ -1175,7 +1181,7 @@ void BattleControllerPlayer_UpdateMonCondition(BattleSystem *bsys, BattleContext
|
||||
ReadBattleScriptFromNarc(ctx, NARC_a_0_0_1, 94);
|
||||
ctx->commandNext = ctx->command;
|
||||
ctx->command = CONTROLLER_COMMAND_RUN_SCRIPT;
|
||||
flag = 1;
|
||||
flag = 1;
|
||||
} else {
|
||||
ctx->battleMons[battlerId].status2 &= ~STATUS2_NIGHTMARE;
|
||||
}
|
||||
@ -1398,11 +1404,12 @@ void BattleControllerPlayer_UpdateMonCondition(BattleSystem *bsys, BattleContext
|
||||
}
|
||||
}
|
||||
ctx->stateUpdateMonCondition++;
|
||||
break;
|
||||
break;
|
||||
case UMC_STATE_HELD_ITEM_STATUS:
|
||||
{
|
||||
int script;
|
||||
|
||||
if (CheckUseHeldItem(bsys, ctx, battlerId, &script) == TRUE) {
|
||||
|
||||
if (CheckUseHeldItem(bsys, ctx, battlerId, (u32 *)&script) == TRUE) {
|
||||
ctx->battlerIdTemp = battlerId;
|
||||
ReadBattleScriptFromNarc(ctx, NARC_a_0_0_1, script);
|
||||
ctx->commandNext = ctx->command;
|
||||
@ -1411,6 +1418,7 @@ void BattleControllerPlayer_UpdateMonCondition(BattleSystem *bsys, BattleContext
|
||||
}
|
||||
ctx->stateUpdateMonCondition++;
|
||||
break;
|
||||
}
|
||||
case UMC_STATE_HELD_ITEM_DAMAGE:
|
||||
if (TryHeldItemNegativeEffect(bsys, ctx, battlerId) == TRUE) {
|
||||
flag = 1;
|
||||
@ -1445,13 +1453,13 @@ typedef enum UpdateFieldConditionExtraState {
|
||||
void BattleControllerPlayer_UpdateFieldConditionExtra(BattleSystem *bsys, BattleContext *ctx) {
|
||||
int maxBattlers = BattleSystem_GetMaxBattlers(bsys);
|
||||
int battlerId;
|
||||
|
||||
|
||||
if (ov12_0224DC74(ctx, ctx->command, ctx->command, 1) == TRUE) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
ov12_022642F0(bsys);
|
||||
|
||||
|
||||
switch (ctx->stateUpdateFieldConditionExtra) {
|
||||
case UFCE_STATE_FUTURE_SIGHT:
|
||||
while (ctx->updateFieldConditionExtraData < maxBattlers) {
|
||||
@ -1534,18 +1542,18 @@ void BattleControllerPlayer_TurnEnd(BattleSystem *bsys, BattleContext *ctx) {
|
||||
if (ov12_0224DD18(ctx, ctx->command, ctx->command) == TRUE) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
if (ov12_0224D7EC(bsys, ctx) == TRUE) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
if (ov12_0224D540(bsys, ctx) == TRUE) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
ctx->totalTurns++;
|
||||
ctx->meFirstTotal++;
|
||||
|
||||
|
||||
BattleContext_Init(ctx);
|
||||
ov12_02251710(bsys, ctx);
|
||||
ctx->command = CONTROLLER_COMMAND_TRAINER_MESSAGE;
|
||||
@ -1554,9 +1562,9 @@ void BattleControllerPlayer_TurnEnd(BattleSystem *bsys, BattleContext *ctx) {
|
||||
//static
|
||||
void BattleControllerPlayer_FightInput(BattleSystem *bsys, BattleContext *ctx) {
|
||||
int flag = 0;
|
||||
|
||||
|
||||
ctx->battlerIdAttacker = ctx->unk_21E8[ctx->unk_EC];
|
||||
|
||||
|
||||
if (ctx->turnData[ctx->battlerIdAttacker].struggleFlag) {
|
||||
ctx->moveNoTemp = MOVE_STRUGGLE;
|
||||
flag = 1;
|
||||
@ -1589,11 +1597,11 @@ void BattleControllerPlayer_FightInput(BattleSystem *bsys, BattleContext *ctx) {
|
||||
void BattleControllerPlayer_ItemInput(BattleSystem *bsys, BattleContext *ctx) {
|
||||
BattleItem *item;
|
||||
int script;
|
||||
|
||||
|
||||
ctx->battlerIdAttacker = ctx->unk_21E8[ctx->unk_EC];
|
||||
ctx->battlerIdTarget = ov12_02253DA0(bsys, ctx, ctx->battlerIdAttacker);
|
||||
item = (BattleItem *)&ctx->unk_21A8[ctx->battlerIdAttacker][2];
|
||||
|
||||
|
||||
if (BattleSystem_GetFieldSide(bsys, ctx->battlerIdAttacker)) {
|
||||
switch (ctx->trainerAIData.unk9D[ctx->battlerIdAttacker >> 1]) {
|
||||
case 0:
|
||||
@ -1640,7 +1648,7 @@ void BattleControllerPlayer_ItemInput(BattleSystem *bsys, BattleContext *ctx) {
|
||||
}
|
||||
ctx->itemTemp = item->id;
|
||||
}
|
||||
|
||||
|
||||
ReadBattleScriptFromNarc(ctx, NARC_a_0_0_1, script);
|
||||
ctx->command = CONTROLLER_COMMAND_RUN_SCRIPT;
|
||||
ctx->commandNext = CONTROLLER_COMMAND_40;
|
||||
@ -1661,7 +1669,7 @@ void BattleControllerPlayer_PokemonInput(BattleSystem *bsys, BattleContext *ctx)
|
||||
//static
|
||||
void BattleControllerPlayer_RunInput(BattleSystem *bsys, BattleContext *ctx) {
|
||||
ctx->battlerIdAttacker = ctx->unk_21E8[ctx->unk_EC];
|
||||
|
||||
|
||||
if (BattleSystem_GetFieldSide(bsys, ctx->battlerIdAttacker) && !(BattleSystem_GetBattleType(bsys) & BATTLE_TYPE_LINK)) {
|
||||
if (ctx->battleMons[ctx->battlerIdAttacker].status2 & (STATUS2_BINDING_TURNS | STATUS2_MEAN_LOOK)) {
|
||||
ReadBattleScriptFromNarc(ctx, NARC_a_0_0_1, 286);
|
||||
@ -1692,7 +1700,7 @@ void BattleControllerPlayer_RunInput(BattleSystem *bsys, BattleContext *ctx) {
|
||||
//static
|
||||
void BattleControllerPlayer_SafariThrowBall(BattleSystem *bsys, BattleContext *ctx) {
|
||||
int cnt;
|
||||
|
||||
|
||||
ReadBattleScriptFromNarc(ctx, NARC_a_0_0_1, 275);
|
||||
ctx->battlerIdAttacker = BATTLER_PLAYER;
|
||||
ctx->battlerIdTarget = BATTLER_ENEMY;
|
||||
@ -1751,7 +1759,7 @@ void BattleControllerPlayer_SafariWatching(BattleSystem *bsys, BattleContext *ct
|
||||
//static
|
||||
void BattleControllerPlayer_CatchingContestThrowBall(BattleSystem *bsys, BattleContext *ctx) {
|
||||
int cnt;
|
||||
|
||||
|
||||
ReadBattleScriptFromNarc(ctx, NARC_a_0_0_1, 11);
|
||||
ctx->battlerIdAttacker = BATTLER_PLAYER;
|
||||
ctx->battlerIdTarget = BATTLER_ENEMY;
|
||||
@ -1769,7 +1777,7 @@ u32 TryDisobedience(BattleSystem *bsys, BattleContext *ctx, int *script) {
|
||||
u32 battleType;
|
||||
u8 level;
|
||||
PlayerProfile *profile;
|
||||
|
||||
|
||||
battleType = BattleSystem_GetBattleType(bsys);
|
||||
profile = BattleSystem_GetPlayerProfile(bsys, 0);
|
||||
|
||||
@ -1796,13 +1804,13 @@ u32 TryDisobedience(BattleSystem *bsys, BattleContext *ctx, int *script) {
|
||||
if (ctx->moveNoCur == MOVE_BIDE && (ctx->battleStatus & BATTLE_STATUS_CHARGE_MOVE_HIT)) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
if (PlayerProfile_CountBadges(profile) >= 8) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
level = 10;
|
||||
|
||||
|
||||
if (PlayerProfile_CountBadges(profile) >= 1) {
|
||||
level = 20;
|
||||
}
|
||||
@ -1818,7 +1826,7 @@ u32 TryDisobedience(BattleSystem *bsys, BattleContext *ctx, int *script) {
|
||||
if (PlayerProfile_TestBadgeFlag(profile, 5)) {
|
||||
level = 70;
|
||||
}
|
||||
|
||||
|
||||
if (ctx->battleMons[ctx->battlerIdAttacker].level <= level) {
|
||||
return 0;
|
||||
}
|
||||
@ -1837,13 +1845,13 @@ u32 TryDisobedience(BattleSystem *bsys, BattleContext *ctx, int *script) {
|
||||
*script = 254;
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
rnd = ((BattleSystem_Random(bsys) & 0xff) * (ctx->battleMons[ctx->battlerIdAttacker].level + level)) >> 8;
|
||||
|
||||
//use a random (useable) move
|
||||
if (rnd < level) {
|
||||
rnd = StruggleCheck(bsys, ctx, ctx->battlerIdAttacker, MaskOfFlagNo(ctx->movePos[ctx->battlerIdAttacker]), -1);
|
||||
|
||||
|
||||
if (rnd == 0xF) {
|
||||
*script = 255;
|
||||
return 1;
|
||||
@ -1851,7 +1859,7 @@ u32 TryDisobedience(BattleSystem *bsys, BattleContext *ctx, int *script) {
|
||||
do {
|
||||
struggleRnd = BattleSystem_Random(bsys) & 3;
|
||||
} while (MaskOfFlagNo(struggleRnd) & rnd);
|
||||
|
||||
|
||||
ctx->movePos[ctx->battlerIdAttacker] = struggleRnd;
|
||||
ctx->moveNoTemp = ctx->battleMons[ctx->battlerIdAttacker].moves[ctx->movePos[ctx->battlerIdAttacker]];
|
||||
ctx->moveNoCur = ctx->moveNoTemp;
|
||||
@ -1865,7 +1873,7 @@ u32 TryDisobedience(BattleSystem *bsys, BattleContext *ctx, int *script) {
|
||||
|
||||
*script = 256;
|
||||
ctx->unk_2184 |= 1;
|
||||
|
||||
|
||||
return 2;
|
||||
}
|
||||
|
||||
@ -1896,6 +1904,6 @@ u32 TryDisobedience(BattleSystem *bsys, BattleContext *ctx, int *script) {
|
||||
}
|
||||
|
||||
*script = 255;
|
||||
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -419,6 +419,7 @@ static u32 ov17_02201F18(BerryPotsAppData *data) {
|
||||
data->state70++;
|
||||
break;
|
||||
case 1:
|
||||
{
|
||||
int unk = ov17_02202A50(data);
|
||||
if (unk == -1) {
|
||||
break;
|
||||
@ -450,6 +451,7 @@ static u32 ov17_02201F18(BerryPotsAppData *data) {
|
||||
}
|
||||
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
return 3;
|
||||
@ -464,6 +466,7 @@ static u32 ov17_02201FE8(BerryPotsAppData *data) {
|
||||
data->state70++;
|
||||
break;
|
||||
case 1:
|
||||
{
|
||||
int unk = ov17_02202A50(data);
|
||||
if (unk == -1) {
|
||||
break;
|
||||
@ -486,6 +489,7 @@ static u32 ov17_02201FE8(BerryPotsAppData *data) {
|
||||
data->args->unk14 = 2;
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return 4;
|
||||
@ -500,6 +504,7 @@ static u32 ov17_02202094(BerryPotsAppData *data) {
|
||||
data->state70++;
|
||||
break;
|
||||
case 1:
|
||||
{
|
||||
int unk = ov17_02202A50(data);
|
||||
if (unk == -1) {
|
||||
break;
|
||||
@ -515,6 +520,7 @@ static u32 ov17_02202094(BerryPotsAppData *data) {
|
||||
ov17_02202944(data, BERRY_POTS_APP_022036FC_ACTION_3, 4, FALSE);
|
||||
data->state70++;
|
||||
break;
|
||||
}
|
||||
case 2:
|
||||
if (!ov17_022025B8(data)) {
|
||||
break;
|
||||
@ -551,6 +557,7 @@ static u32 ov17_02202184(BerryPotsAppData* data) {
|
||||
break;
|
||||
|
||||
case 1:
|
||||
{
|
||||
int unk = ov17_02202A50(data);
|
||||
if (unk == -1) {
|
||||
break;
|
||||
@ -573,7 +580,7 @@ static u32 ov17_02202184(BerryPotsAppData* data) {
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
}
|
||||
case 2:
|
||||
if (ov17_02202460(data)) {
|
||||
data->state70 = 0;
|
||||
@ -1400,10 +1407,12 @@ static void ov17_022036FC(BerryPotsAppData *data, enum BerryPotsApp_022036FC_Act
|
||||
case BERRY_POTS_APP_022036FC_ACTION_12:
|
||||
case BERRY_POTS_APP_022036FC_ACTION_15:
|
||||
case BERRY_POTS_APP_022036FC_ACTION_16:
|
||||
{
|
||||
String *berryName = GetNutName(unk->berryId, data->heapId);
|
||||
BufferString(data->msgFmt, 0, berryName, 0, 0, 2);
|
||||
String_Delete(berryName);
|
||||
break;
|
||||
}
|
||||
default:
|
||||
String_Copy(data->currentStatusString, data->statusStrings[action]);
|
||||
return;
|
||||
|
@ -285,6 +285,7 @@ void SetBgControlParam(BgConfig *config, u8 bgId, enum GFBgCntSet attr, u8 value
|
||||
|
||||
switch (bgId) {
|
||||
case GF_BG_LYR_MAIN_0:
|
||||
{
|
||||
GXBg01Control bg0cnt = G2_GetBG0Control();
|
||||
if (attr == GF_BG_CNT_SET_SCREEN_BASE) {
|
||||
bg0cnt.screenBase = value;
|
||||
@ -296,7 +297,9 @@ void SetBgControlParam(BgConfig *config, u8 bgId, enum GFBgCntSet attr, u8 value
|
||||
|
||||
G2_SetBG0Control((GXBGScrSizeText)bg0cnt.screenSize, (GXBGColorMode)config->bgs[bgId].colorMode, (GXBGScrBase)bg0cnt.screenBase, (GXBGCharBase)bg0cnt.charBase, (GXBGExtPltt)bg0cnt.bgExtPltt);
|
||||
break;
|
||||
}
|
||||
case GF_BG_LYR_MAIN_1:
|
||||
{
|
||||
GXBg01Control bg1cnt = G2_GetBG1Control();
|
||||
if (attr == GF_BG_CNT_SET_SCREEN_BASE) {
|
||||
bg1cnt.screenBase = value;
|
||||
@ -308,10 +311,12 @@ void SetBgControlParam(BgConfig *config, u8 bgId, enum GFBgCntSet attr, u8 value
|
||||
|
||||
G2_SetBG1Control((GXBGScrSizeText)bg1cnt.screenSize, (GXBGColorMode)config->bgs[bgId].colorMode, (GXBGScrBase)bg1cnt.screenBase, (GXBGCharBase)bg1cnt.charBase, (GXBGExtPltt)bg1cnt.bgExtPltt);
|
||||
break;
|
||||
}
|
||||
case GF_BG_LYR_MAIN_2:
|
||||
switch (config->bgs[bgId].mode) {
|
||||
default:
|
||||
case GF_BG_TYPE_TEXT:
|
||||
{
|
||||
GXBg23ControlText bg2cnt_tx = G2_GetBG2ControlText();
|
||||
if (attr == GF_BG_CNT_SET_SCREEN_BASE) {
|
||||
bg2cnt_tx.screenBase = value;
|
||||
@ -323,7 +328,9 @@ void SetBgControlParam(BgConfig *config, u8 bgId, enum GFBgCntSet attr, u8 value
|
||||
|
||||
G2_SetBG2ControlText((GXBGScrSizeText)bg2cnt_tx.screenSize, (GXBGColorMode)config->bgs[bgId].colorMode, (GXBGScrBase)bg2cnt_tx.screenBase, (GXBGCharBase)bg2cnt_tx.charBase);
|
||||
break;
|
||||
}
|
||||
case GF_BG_TYPE_AFFINE:
|
||||
{
|
||||
GXBg23ControlAffine bg2cnt_aff = G2_GetBG2ControlAffine();
|
||||
if (attr == GF_BG_CNT_SET_SCREEN_BASE) {
|
||||
bg2cnt_aff.screenBase = value;
|
||||
@ -335,7 +342,9 @@ void SetBgControlParam(BgConfig *config, u8 bgId, enum GFBgCntSet attr, u8 value
|
||||
|
||||
G2_SetBG2ControlAffine((GXBGScrSizeAffine)bg2cnt_aff.screenSize, (GXBGAreaOver)bg2cnt_aff.areaOver, (GXBGScrBase)bg2cnt_aff.screenBase, (GXBGCharBase)bg2cnt_aff.charBase);
|
||||
break;
|
||||
}
|
||||
case GF_BG_TYPE_256x16PLTT:
|
||||
{
|
||||
GXBg23Control256x16Pltt bg2cnt_256x16pltt = G2_GetBG2Control256x16Pltt();
|
||||
if (attr == GF_BG_CNT_SET_SCREEN_BASE) {
|
||||
bg2cnt_256x16pltt.screenBase = value;
|
||||
@ -347,12 +356,14 @@ void SetBgControlParam(BgConfig *config, u8 bgId, enum GFBgCntSet attr, u8 value
|
||||
|
||||
G2_SetBG2Control256x16Pltt((GXBGScrSize256x16Pltt)bg2cnt_256x16pltt.screenSize, (GXBGAreaOver)bg2cnt_256x16pltt.areaOver, (GXBGScrBase)bg2cnt_256x16pltt.screenBase, (GXBGCharBase)bg2cnt_256x16pltt.charBase);
|
||||
break;
|
||||
}
|
||||
}
|
||||
break;
|
||||
case GF_BG_LYR_MAIN_3:
|
||||
switch (config->bgs[bgId].mode) {
|
||||
default:
|
||||
case GF_BG_TYPE_TEXT:
|
||||
{
|
||||
GXBg23ControlText bg3cnt_tx = G2_GetBG3ControlText();
|
||||
if (attr == GF_BG_CNT_SET_SCREEN_BASE) {
|
||||
bg3cnt_tx.screenBase = value;
|
||||
@ -364,7 +375,9 @@ void SetBgControlParam(BgConfig *config, u8 bgId, enum GFBgCntSet attr, u8 value
|
||||
|
||||
G2_SetBG3ControlText((GXBGScrSizeText)bg3cnt_tx.screenSize, (GXBGColorMode)config->bgs[bgId].colorMode, (GXBGScrBase)bg3cnt_tx.screenBase, (GXBGCharBase)bg3cnt_tx.charBase);
|
||||
break;
|
||||
}
|
||||
case GF_BG_TYPE_AFFINE:
|
||||
{
|
||||
GXBg23ControlAffine bg3cnt_aff = G2_GetBG3ControlAffine();
|
||||
if (attr == GF_BG_CNT_SET_SCREEN_BASE) {
|
||||
bg3cnt_aff.screenBase = value;
|
||||
@ -376,7 +389,9 @@ void SetBgControlParam(BgConfig *config, u8 bgId, enum GFBgCntSet attr, u8 value
|
||||
|
||||
G2_SetBG3ControlAffine((GXBGScrSizeAffine)bg3cnt_aff.screenSize, (GXBGAreaOver)bg3cnt_aff.areaOver, (GXBGScrBase)bg3cnt_aff.screenBase, (GXBGCharBase)bg3cnt_aff.charBase);
|
||||
break;
|
||||
}
|
||||
case GF_BG_TYPE_256x16PLTT:
|
||||
{
|
||||
GXBg23Control256x16Pltt bg3cnt_256x16pltt = G2_GetBG3Control256x16Pltt();
|
||||
if (attr == GF_BG_CNT_SET_SCREEN_BASE) {
|
||||
bg3cnt_256x16pltt.screenBase = value;
|
||||
@ -388,9 +403,11 @@ void SetBgControlParam(BgConfig *config, u8 bgId, enum GFBgCntSet attr, u8 value
|
||||
|
||||
G2_SetBG3Control256x16Pltt((GXBGScrSize256x16Pltt)bg3cnt_256x16pltt.screenSize, (GXBGAreaOver)bg3cnt_256x16pltt.areaOver, (GXBGScrBase)bg3cnt_256x16pltt.screenBase, (GXBGCharBase)bg3cnt_256x16pltt.charBase);
|
||||
break;
|
||||
}
|
||||
}
|
||||
break;
|
||||
case GF_BG_LYR_SUB_0:
|
||||
{
|
||||
GXBg01Control bg0cntsub = G2S_GetBG0Control();
|
||||
if (attr == GF_BG_CNT_SET_SCREEN_BASE) {
|
||||
bg0cntsub.screenBase = value;
|
||||
@ -402,7 +419,9 @@ void SetBgControlParam(BgConfig *config, u8 bgId, enum GFBgCntSet attr, u8 value
|
||||
|
||||
G2S_SetBG0Control((GXBGScrSizeText)bg0cntsub.screenSize, (GXBGColorMode)config->bgs[bgId].colorMode, (GXBGScrBase)bg0cntsub.screenBase, (GXBGCharBase)bg0cntsub.charBase, (GXBGExtPltt)bg0cntsub.bgExtPltt);
|
||||
break;
|
||||
}
|
||||
case GF_BG_LYR_SUB_1:
|
||||
{
|
||||
GXBg01Control bg1cntsub = G2S_GetBG1Control();
|
||||
if (attr == GF_BG_CNT_SET_SCREEN_BASE) {
|
||||
bg1cntsub.screenBase = value;
|
||||
@ -414,10 +433,12 @@ void SetBgControlParam(BgConfig *config, u8 bgId, enum GFBgCntSet attr, u8 value
|
||||
|
||||
G2S_SetBG1Control((GXBGScrSizeText)bg1cntsub.screenSize, (GXBGColorMode)config->bgs[bgId].colorMode, (GXBGScrBase)bg1cntsub.screenBase, (GXBGCharBase)bg1cntsub.charBase, (GXBGExtPltt)bg1cntsub.bgExtPltt);
|
||||
break;
|
||||
}
|
||||
case GF_BG_LYR_SUB_2:
|
||||
switch (config->bgs[bgId].mode) {
|
||||
default:
|
||||
case GF_BG_TYPE_TEXT:
|
||||
{
|
||||
GXBg23ControlText bg2cntsub_tx = G2S_GetBG2ControlText();
|
||||
if (attr == GF_BG_CNT_SET_SCREEN_BASE) {
|
||||
bg2cntsub_tx.screenBase = value;
|
||||
@ -429,7 +450,9 @@ void SetBgControlParam(BgConfig *config, u8 bgId, enum GFBgCntSet attr, u8 value
|
||||
|
||||
G2S_SetBG2ControlText((GXBGScrSizeText)bg2cntsub_tx.screenSize, (GXBGColorMode)config->bgs[bgId].colorMode, (GXBGScrBase)bg2cntsub_tx.screenBase, (GXBGCharBase)bg2cntsub_tx.charBase);
|
||||
break;
|
||||
}
|
||||
case GF_BG_TYPE_AFFINE:
|
||||
{
|
||||
GXBg23ControlAffine bg2cntsub_aff = G2S_GetBG2ControlAffine();
|
||||
if (attr == GF_BG_CNT_SET_SCREEN_BASE) {
|
||||
bg2cntsub_aff.screenBase = value;
|
||||
@ -441,7 +464,9 @@ void SetBgControlParam(BgConfig *config, u8 bgId, enum GFBgCntSet attr, u8 value
|
||||
|
||||
G2S_SetBG2ControlAffine((GXBGScrSizeAffine)bg2cntsub_aff.screenSize, (GXBGAreaOver)bg2cntsub_aff.areaOver, (GXBGScrBase)bg2cntsub_aff.screenBase, (GXBGCharBase)bg2cntsub_aff.charBase);
|
||||
break;
|
||||
}
|
||||
case GF_BG_TYPE_256x16PLTT:
|
||||
{
|
||||
GXBg23Control256x16Pltt bg2cntsub_256x16pltt = G2S_GetBG2Control256x16Pltt();
|
||||
if (attr == GF_BG_CNT_SET_SCREEN_BASE) {
|
||||
bg2cntsub_256x16pltt.screenBase = value;
|
||||
@ -453,12 +478,14 @@ void SetBgControlParam(BgConfig *config, u8 bgId, enum GFBgCntSet attr, u8 value
|
||||
|
||||
G2S_SetBG2Control256x16Pltt((GXBGScrSize256x16Pltt)bg2cntsub_256x16pltt.screenSize, (GXBGAreaOver)bg2cntsub_256x16pltt.areaOver, (GXBGScrBase)bg2cntsub_256x16pltt.screenBase, (GXBGCharBase)bg2cntsub_256x16pltt.charBase);
|
||||
break;
|
||||
}
|
||||
}
|
||||
break;
|
||||
case GF_BG_LYR_SUB_3:
|
||||
switch (config->bgs[bgId].mode) {
|
||||
default:
|
||||
case GF_BG_TYPE_TEXT:
|
||||
{
|
||||
GXBg23ControlText bg3cntsub_tx = G2S_GetBG3ControlText();
|
||||
if (attr == GF_BG_CNT_SET_SCREEN_BASE) {
|
||||
bg3cntsub_tx.screenBase = value;
|
||||
@ -470,7 +497,9 @@ void SetBgControlParam(BgConfig *config, u8 bgId, enum GFBgCntSet attr, u8 value
|
||||
|
||||
G2S_SetBG3ControlText((GXBGScrSizeText)bg3cntsub_tx.screenSize, (GXBGColorMode)config->bgs[bgId].colorMode, (GXBGScrBase)bg3cntsub_tx.screenBase, (GXBGCharBase)bg3cntsub_tx.charBase);
|
||||
break;
|
||||
}
|
||||
case GF_BG_TYPE_AFFINE:
|
||||
{
|
||||
GXBg23ControlAffine bg3cntsub_aff = G2S_GetBG3ControlAffine();
|
||||
if (attr == GF_BG_CNT_SET_SCREEN_BASE) {
|
||||
bg3cntsub_aff.screenBase = value;
|
||||
@ -482,7 +511,9 @@ void SetBgControlParam(BgConfig *config, u8 bgId, enum GFBgCntSet attr, u8 value
|
||||
|
||||
G2S_SetBG3ControlAffine((GXBGScrSizeAffine)bg3cntsub_aff.screenSize, (GXBGAreaOver)bg3cntsub_aff.areaOver, (GXBGScrBase)bg3cntsub_aff.screenBase, (GXBGCharBase)bg3cntsub_aff.charBase);
|
||||
break;
|
||||
}
|
||||
case GF_BG_TYPE_256x16PLTT:
|
||||
{
|
||||
GXBg23Control256x16Pltt bg3cntsub_256x16pltt = G2S_GetBG3Control256x16Pltt();
|
||||
if (attr == GF_BG_CNT_SET_SCREEN_BASE) {
|
||||
bg3cntsub_256x16pltt.screenBase = value;
|
||||
@ -494,6 +525,7 @@ void SetBgControlParam(BgConfig *config, u8 bgId, enum GFBgCntSet attr, u8 value
|
||||
|
||||
G2S_SetBG3Control256x16Pltt((GXBGScrSize256x16Pltt)bg3cntsub_256x16pltt.screenSize, (GXBGAreaOver)bg3cntsub_256x16pltt.areaOver, (GXBGScrBase)bg3cntsub_256x16pltt.screenBase, (GXBGCharBase)bg3cntsub_256x16pltt.charBase);
|
||||
break;
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
@ -778,7 +810,7 @@ void BgCopyOrUncompressTilemapBufferRangeToVram(BgConfig *bgConfig, u8 bgId, con
|
||||
LoadBgVramScr(bgId, tilemapBuffer, bgConfig->bgs[bgId].baseTile * 2, bgConfig->bgs[bgId].bufferSize);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
u32 uncompSize = MI_GetUncompressedSize(buffer);
|
||||
void *ptr = AllocFromHeapAtEnd(bgConfig->heapId, uncompSize);
|
||||
CopyOrUncompressTilemapData(buffer, ptr, bufferSize);
|
||||
@ -1041,7 +1073,7 @@ void CopyRectToBgTilemapRect(BgConfig *bgConfig, u8 bgId, u8 destX, u8 destY, u8
|
||||
|
||||
static void CopyToBgTilemapRectText(Background *bg, u8 destX, u8 destY, u8 destWidth, u8 destHeight, const u16 *buffer, u8 srcX, u8 srcY, u8 srcWidth, u8 srcHeight, u8 mode) {
|
||||
u16 *tilemapBuffer = bg->tilemapBuffer;
|
||||
|
||||
|
||||
if (tilemapBuffer == NULL) {
|
||||
return;
|
||||
}
|
||||
@ -1535,7 +1567,7 @@ BOOL WindowIsInUse(const Window *window) {
|
||||
if (window->bgConfig == NULL || window->bgId == 0xFF || window->pixelBuffer == NULL) {
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
@ -1663,7 +1695,7 @@ static void PutWindowTilemap_AffineMode(Window *window) {
|
||||
if (window->bgConfig->bgs[window->bgId].tilemapBuffer == NULL) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
tilemapWidth = sTilemapWidthByBufferSize[window->bgConfig->bgs[window->bgId].size];
|
||||
|
||||
tilemap = window->bgConfig->bgs[window->bgId].tilemapBuffer + window->tilemapTop * tilemapWidth + window->tilemapLeft;
|
||||
|
@ -174,7 +174,7 @@ static void CertificatesApp_FreeSpriteRenderer(CertificatesApp_Data *data);
|
||||
static void ov78_021E636C(CertificatesApp_Data *data);
|
||||
static void ov78_021E652C(CertificatesApp_Data *data);
|
||||
static void ov78_021E656C(Sprite *sprite, void *unkBuffer, u32 unkBufferSize, u32 srcOffset);
|
||||
static void ov78_021E65BC(Sprite *sprite, u32 narcMemberNum, u32 a2, HeapID heapId);
|
||||
static void ov78_021E65BC(Sprite *sprite, s32 narcMemberNum, u8 a2, HeapID heapId);
|
||||
static void ov78_021E6664(Sprite *sprite, PlayerProfile *profile, HeapID heapId);
|
||||
static u32 ov78_021E6688(int species, int form, int gender);
|
||||
static void ov78_021E66D4(Sprite *sprite, Pokemon *pokemon, HeapID heapId, u32 a3);
|
||||
@ -679,23 +679,21 @@ static void ov78_021E656C(Sprite *sprite, void *unkBuffer, u32 unkBufferSize, u3
|
||||
GXS_LoadOBJ(unkBuffer, (u32)((void*)NNS_G2dGetImageLocation(proxy, NNS_G2D_VRAM_TYPE_2DSUB) + srcOffset), unkBufferSize);
|
||||
}
|
||||
|
||||
// https://decomp.me/scratch/DGOQR
|
||||
#ifdef NONMATCHING
|
||||
static void ov78_021E65BC(Sprite *sprite, u32 narcMemberNum, u32 a2, HeapID heapId) {
|
||||
void ov78_021E65BC(Sprite *sprite, s32 narcMemberNum, u8 a2, HeapID heapId) {
|
||||
thunk_Set2dSpriteVisibleFlag(sprite, FALSE);
|
||||
|
||||
NARC *narc = NARC_New(NARC_data_mmodel_mmodel, heapId);
|
||||
NNSG3dResFileHeader *header = NARC_AllocAndReadWholeMember(narc, narcMemberNum, heapId);
|
||||
NNSG3dResTex *tex = NNS_G3dGetTex(header);
|
||||
|
||||
void *address = (void*)tex + tex->texInfo.ofsTex;
|
||||
const void *address = NNS_G3dGetTexData(tex);
|
||||
void *buffer = AllocFromHeapAtEnd(heapId, 0x200);
|
||||
sub_020145B4(address + (a2 * 0x200), 4, 0, 0, 4, 4, buffer);
|
||||
ov78_021E656C(sprite, buffer, 0x200, 0);
|
||||
FreeToHeap(buffer);
|
||||
|
||||
Sprite_GetVramType(sprite);
|
||||
address = (void*)tex + tex->plttInfo.ofsPlttData;
|
||||
address = NNS_G3dGetPlttData(tex);
|
||||
DC_FlushRange(address, 0x20);
|
||||
sub_02024B34(sprite);
|
||||
GX_LoadOBJPltt(address, 0x40, 0x20);
|
||||
@ -706,78 +704,6 @@ static void ov78_021E65BC(Sprite *sprite, u32 narcMemberNum, u32 a2, HeapID heap
|
||||
|
||||
thunk_Set2dSpriteVisibleFlag(sprite, TRUE);
|
||||
}
|
||||
#else
|
||||
static asm void ov78_021E65BC(Sprite *sprite, u32 narcMemberNum, u32 a2, HeapID heapId) {
|
||||
push {r3, r4, r5, r6, r7, lr}
|
||||
sub sp, #0x18
|
||||
add r5, r1, #0
|
||||
add r4, r3, #0
|
||||
mov r1, #0
|
||||
add r6, r0, #0
|
||||
str r2, [sp, #0xc]
|
||||
bl thunk_Set2dSpriteVisibleFlag
|
||||
mov r0, #0x51
|
||||
add r1, r4, #0
|
||||
bl NARC_New
|
||||
add r1, r5, #0
|
||||
add r2, r4, #0
|
||||
str r0, [sp, #0x10]
|
||||
bl NARC_AllocAndReadWholeMember
|
||||
str r0, [sp, #0x14]
|
||||
bl NNS_G3dGetTex
|
||||
add r5, r0, #0
|
||||
ldr r0, [r5, #0x14]
|
||||
mov r1, #2
|
||||
add r7, r5, r0
|
||||
add r0, r4, #0
|
||||
lsl r1, r1, #8
|
||||
bl AllocFromHeapAtEnd
|
||||
mov r1, #4
|
||||
str r1, [sp]
|
||||
mov r2, #0
|
||||
add r4, r0, #0
|
||||
str r1, [sp, #4]
|
||||
str r4, [sp, #8]
|
||||
ldr r0, [sp, #0xc]
|
||||
add r3, r2, #0
|
||||
lsl r0, r0, #9
|
||||
add r0, r7, r0
|
||||
bl sub_020145B4
|
||||
mov r2, #2
|
||||
add r0, r6, #0
|
||||
add r1, r4, #0
|
||||
lsl r2, r2, #8
|
||||
mov r3, #0
|
||||
bl ov78_021E656C
|
||||
add r0, r4, #0
|
||||
bl FreeToHeap
|
||||
add r0, r6, #0
|
||||
bl Sprite_GetVramType
|
||||
ldr r4, [r5, #0x38]
|
||||
mov r1, #0x20
|
||||
add r0, r5, r4
|
||||
bl DC_FlushRange
|
||||
add r0, r6, #0
|
||||
bl sub_02024B34
|
||||
add r0, r5, r4
|
||||
mov r1, #0x40
|
||||
mov r2, #0x20
|
||||
bl GX_LoadOBJPltt
|
||||
add r0, r5, r4
|
||||
mov r1, #0x40
|
||||
mov r2, #0x20
|
||||
bl GXS_LoadOBJPltt
|
||||
ldr r0, [sp, #0x14]
|
||||
bl FreeToHeap
|
||||
ldr r0, [sp, #0x10]
|
||||
bl NARC_Delete
|
||||
add r0, r6, #0
|
||||
mov r1, #1
|
||||
bl thunk_Set2dSpriteVisibleFlag
|
||||
add sp, #0x18
|
||||
pop {r3, r4, r5, r6, r7, pc}
|
||||
}
|
||||
#endif
|
||||
|
||||
static void ov78_021E6664(Sprite *sprite, PlayerProfile *profile, HeapID heapId) {
|
||||
u32 narcMemberNum = (PlayerProfile_GetTrainerGender(profile) == PLAYER_GENDER_MALE) ? MMODEL_HERO : MMODEL_HEROINE;
|
||||
|
@ -274,6 +274,7 @@ BOOL CreditsApp_OvyExit(OVY_MANAGER *man, int *state) {
|
||||
*state += 1;
|
||||
break;
|
||||
case 1:
|
||||
{
|
||||
PageWork *ptr = &work->pageWork;
|
||||
RemoveWindow(&ptr->window);
|
||||
DestroyMsgData(ptr->msgData);
|
||||
@ -286,6 +287,7 @@ BOOL CreditsApp_OvyExit(OVY_MANAGER *man, int *state) {
|
||||
FreePageSysTasks(work);
|
||||
*state += 1;
|
||||
break;
|
||||
}
|
||||
case 2:
|
||||
NARC_Delete(work->cutsceneWork.narc);
|
||||
ov76_021E62B4(work);
|
||||
|
@ -46,7 +46,7 @@ static const s8 sApricornJumpDy[APRICORN_JUMP_FRAMES] = {
|
||||
static BOOL Task_AnimApricornTree(TaskManager *taskman);
|
||||
static BOOL Task_AnimPlayerShakeTree(TaskManager *taskman);
|
||||
static LocalMapObject *CreateJumpingApricornObj(MapObjectManager *taskman, u32 sprite, u32 x, u32 z);
|
||||
BOOL DoApricornJump(AnimApricornTreeWork *env);
|
||||
static BOOL DoApricornJump(AnimApricornTreeWork *env);
|
||||
|
||||
void FieldSystem_AnimApricornTree(FieldSystem *fieldSystem, LocalMapObject *tree, u16 *a2) {
|
||||
AnimApricornTreeWork *env = AllocFromHeap(HEAP_ID_32, sizeof(AnimApricornTreeWork));
|
||||
@ -213,13 +213,13 @@ static BOOL DoApricornJump(AnimApricornTreeWork *env) {
|
||||
static BOOL Task_AnimPlayerShakeTree(TaskManager *taskman) {
|
||||
FieldSystem *fieldSystem = TaskManager_GetFieldSystem(taskman);
|
||||
LocalMapObject *playerObj = PlayerAvatar_GetMapObject(fieldSystem->playerAvatar);
|
||||
int *state_p = TaskManager_GetStatePtr(taskman);
|
||||
u32 *state_p = TaskManager_GetStatePtr(taskman);
|
||||
AnimPlayerShakeTreeWork *env = TaskManager_GetEnvironment(taskman);
|
||||
|
||||
switch (*state_p) {
|
||||
case 0:
|
||||
MapObject_UnpauseMovement(playerObj);
|
||||
*state_p += 1;
|
||||
++(*state_p);
|
||||
break;
|
||||
case 1:
|
||||
if (MapObject_AreBitsSetForMovementScriptInit(playerObj) == TRUE) {
|
||||
@ -228,7 +228,7 @@ static BOOL Task_AnimPlayerShakeTree(TaskManager *taskman) {
|
||||
Field_PlayerAvatar_ApplyTransitionFlags(fieldSystem->playerAvatar);
|
||||
sub_0205F328(playerObj, 0);
|
||||
env->timer = 0;
|
||||
*state_p += 1;
|
||||
++(*state_p);
|
||||
}
|
||||
break;
|
||||
case 2:
|
||||
@ -238,7 +238,7 @@ static BOOL Task_AnimPlayerShakeTree(TaskManager *taskman) {
|
||||
int flags = PlayerAvatar_GetTransitionBits(PlayerAvatar_GetState(fieldSystem->playerAvatar));
|
||||
Field_PlayerAvatar_OrrTransitionFlags(fieldSystem->playerAvatar, flags);
|
||||
Field_PlayerAvatar_ApplyTransitionFlags(fieldSystem->playerAvatar);
|
||||
*state_p += 1;
|
||||
++(*state_p);
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
@ -174,7 +174,7 @@ static BOOL CheckRockSmashItemDrop(FieldSystem *fieldSystem, RockSmashItemCheckW
|
||||
static BOOL Task_GetRockSmashItem(TaskManager *taskman) {
|
||||
LocalMapObject *obj;
|
||||
|
||||
int *state_p = TaskManager_GetStatePtr(taskman);
|
||||
u32 *state_p = TaskManager_GetStatePtr(taskman);
|
||||
RockSmashItemCheckWork *env = TaskManager_GetEnvironment(taskman);
|
||||
FieldSystem *fieldSystem = TaskManager_GetFieldSystem(taskman);
|
||||
|
||||
@ -186,15 +186,16 @@ static BOOL Task_GetRockSmashItem(TaskManager *taskman) {
|
||||
obj = PlayerAvatar_GetMapObject(fieldSystem->playerAvatar);
|
||||
}
|
||||
env->unk14 = ov01_02200540(obj, 0, 1);
|
||||
*state_p += 1;
|
||||
++(*state_p);
|
||||
break;
|
||||
case 1:
|
||||
if (ov01_022003F4(env->unk14)) {
|
||||
sub_02068B48(env->unk14);
|
||||
*state_p += 1;
|
||||
++(*state_p);
|
||||
}
|
||||
break;
|
||||
case 2:
|
||||
{
|
||||
u32 idx = DrawRockSmashIdx(fieldSystem);
|
||||
if ((env->ability == ABILITY_SERENE_GRACE || env->ability == ABILITY_SUPER_LUCK) && idx < 7) {
|
||||
idx = (u8)(idx + 1);
|
||||
@ -224,6 +225,7 @@ static BOOL Task_GetRockSmashItem(TaskManager *taskman) {
|
||||
FreeToHeap(env);
|
||||
return TRUE;
|
||||
}
|
||||
}
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
@ -156,11 +156,12 @@ BOOL ScrCmd_MysteryGift(ScriptContext* ctx) {
|
||||
*ptr = pFunc->check(ctx->fieldSystem, FieldSystem_GetDataOfNextMG(ctx->fieldSystem));
|
||||
break;
|
||||
}
|
||||
case SCR_MG_RECEIVE:
|
||||
case SCR_MG_RECEIVE: {
|
||||
const struct ScriptMysteryGiftFuncs* pFunc = &sScriptMysteryGiftActionTable[FieldSystem_GetTagOfNextMG(ctx->fieldSystem) - 1];
|
||||
pFunc->give(ctx->fieldSystem, FieldSystem_GetDataOfNextMG(ctx->fieldSystem));
|
||||
FieldSystem_SetQueuedMGReceived(ctx->fieldSystem);
|
||||
break;
|
||||
}
|
||||
case SCR_MG_MESSAGE_RECEIVED: {
|
||||
struct GetMysteryGiftGmmState gmmState;
|
||||
const struct ScriptMysteryGiftFuncs* pFunc = &sScriptMysteryGiftActionTable[FieldSystem_GetTagOfNextMG(ctx->fieldSystem) - 1];
|
||||
|
@ -82,7 +82,7 @@ static const BgTemplate sGameClearSaveBgTemplate = {
|
||||
.mosaic = FALSE,
|
||||
};
|
||||
|
||||
BOOL Task_GameClear(TaskManager *taskman);
|
||||
static BOOL Task_GameClear(TaskManager *taskman);
|
||||
static void GameClearSave_InitGraphics(FieldSystem *fieldSystem, GameClearWork *env);
|
||||
static void GameClearSave_PrintSaving(FieldSystem *fieldSystem, GameClearWork *env);
|
||||
static BOOL GameClearSave_IsPrintFinished(GameClearWork *env);
|
||||
@ -92,34 +92,34 @@ static void GameClearSave_Free(FieldSystem *fieldSystem, GameClearWork *env);
|
||||
|
||||
BOOL sub_0205298C(TaskManager *taskman) {
|
||||
FieldSystem *fieldSystem = TaskManager_GetFieldSystem(taskman);
|
||||
int *state = TaskManager_GetStatePtr(taskman);
|
||||
u32 *state = TaskManager_GetStatePtr(taskman);
|
||||
|
||||
switch (*state) {
|
||||
case 0:
|
||||
BugContest_WarpToJudging(taskman, fieldSystem);
|
||||
FieldSystem_ClearFollowingTrainer(fieldSystem);
|
||||
HealParty(SaveArray_Party_Get(fieldSystem->saveData));
|
||||
*state += 1;
|
||||
++(*state);
|
||||
break;
|
||||
case 1:
|
||||
GF_SndStartFadeOutBGM(0, 20);
|
||||
*state += 1;
|
||||
++(*state);
|
||||
break;
|
||||
case 2:
|
||||
if (!GF_SndGetFadeTimer()) {
|
||||
sub_02054F14();
|
||||
*state += 1;
|
||||
++(*state);
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case 3:
|
||||
CallTask_RestoreOverworld(taskman);
|
||||
*state += 1;
|
||||
++(*state);
|
||||
break;
|
||||
case 4:
|
||||
BeginNormalPaletteFade(0, 1, 1, RGB_WHITE, 8, 1, HEAP_ID_32);
|
||||
reg_G2_BLDCNT = 0;
|
||||
*state += 1;
|
||||
++(*state);
|
||||
break;
|
||||
case 5:
|
||||
if (IsPaletteFadeFinished()) {
|
||||
@ -151,13 +151,13 @@ static void AddHallOfFameEntry(FieldSystem *fieldSystem, BOOL gameCleared) {
|
||||
static BOOL Task_GameClear(TaskManager *taskman) {
|
||||
FieldSystem *fieldSystem = TaskManager_GetFieldSystem(taskman);
|
||||
GameClearWork *env = TaskManager_GetEnvironment(taskman);
|
||||
int *state = TaskManager_GetStatePtr(taskman);
|
||||
u32 *state = TaskManager_GetStatePtr(taskman);
|
||||
|
||||
switch (*state) {
|
||||
case 0:
|
||||
if (!env->vsTrainerRed) {
|
||||
LaunchHOFCongratsApp(fieldSystem, &env->hofCongratsArgs);
|
||||
*state += 1;
|
||||
++(*state);
|
||||
break;
|
||||
}
|
||||
GameClearSave_InitGraphics(fieldSystem, env);
|
||||
@ -169,14 +169,14 @@ static BOOL Task_GameClear(TaskManager *taskman) {
|
||||
CreateHeap(HEAP_ID_3, HEAP_ID_4, 0x20000);
|
||||
GameClearSave_InitGraphics(fieldSystem, env);
|
||||
BeginNormalPaletteFade(3, 1, 1, RGB_BLACK, 8, 1, HEAP_ID_32);
|
||||
*state += 1;
|
||||
++(*state);
|
||||
}
|
||||
break;
|
||||
case 2:
|
||||
if (IsPaletteFadeFinished()) {
|
||||
if (!Save_FileDoesNotBelongToPlayer(fieldSystem->saveData)) {
|
||||
GameClearSave_PrintSaving(fieldSystem, env);
|
||||
*state += 1;
|
||||
++(*state);
|
||||
break;
|
||||
}
|
||||
*state = 7;
|
||||
@ -184,7 +184,7 @@ static BOOL Task_GameClear(TaskManager *taskman) {
|
||||
break;
|
||||
case 3:
|
||||
if (GameClearSave_IsPrintFinished(env)) {
|
||||
*state += 1;
|
||||
++(*state);
|
||||
}
|
||||
break;
|
||||
case 4:
|
||||
@ -195,13 +195,13 @@ static BOOL Task_GameClear(TaskManager *taskman) {
|
||||
}
|
||||
sub_02052E70(env);
|
||||
GameClearSave_PrintSaveStatus(fieldSystem, env, writeStatus);
|
||||
*state += 1;
|
||||
++(*state);
|
||||
break;
|
||||
case 5:
|
||||
if (GameClearSave_IsPrintFinished(env)) {
|
||||
PlaySE(SEQ_SE_DP_SAVE);
|
||||
env->timer = WAIT_SE_SAVE_FRAMES;
|
||||
*state += 1;
|
||||
++(*state);
|
||||
}
|
||||
break;
|
||||
case 6:
|
||||
@ -209,12 +209,12 @@ static BOOL Task_GameClear(TaskManager *taskman) {
|
||||
env->timer--;
|
||||
break;
|
||||
}
|
||||
*state += 1;
|
||||
++(*state);
|
||||
break;
|
||||
case 7:
|
||||
BeginNormalPaletteFade(3, 0, 0, RGB_BLACK, 8, 1, HEAP_ID_32);
|
||||
env->bgmVolume = 127;
|
||||
*state += 1;
|
||||
++(*state);
|
||||
break;
|
||||
case 8:
|
||||
env->bgmVolume--;
|
||||
@ -223,7 +223,7 @@ static BOOL Task_GameClear(TaskManager *taskman) {
|
||||
StopBGM(GF_GetCurrentPlayingBGM(), 0);
|
||||
sub_0200616C(0);
|
||||
env->timer = SCREEN_FADEOUT_FRAMES;
|
||||
*state += 1;
|
||||
++(*state);
|
||||
}
|
||||
break;
|
||||
case 9:
|
||||
@ -231,14 +231,14 @@ static BOOL Task_GameClear(TaskManager *taskman) {
|
||||
env->timer--;
|
||||
break;
|
||||
}
|
||||
*state += 1;
|
||||
++(*state);
|
||||
break;
|
||||
case 10:
|
||||
if (IsPaletteFadeFinished()) {
|
||||
GameClearSave_Free(fieldSystem, env);
|
||||
Sound_SetMasterVolume(127);
|
||||
LaunchCreditsApp(fieldSystem, &env->creditsArgs);
|
||||
*state += 1;
|
||||
++(*state);
|
||||
}
|
||||
break;
|
||||
case 11:
|
||||
|
@ -224,6 +224,7 @@ static void ListMenuDrawCursor(struct ListMenu *list) {
|
||||
static void ListMenuErasePrintedCursor(struct ListMenu *list, u16 itemsAbove) {
|
||||
switch (list->template.cursorKind) {
|
||||
case 0:
|
||||
{
|
||||
u8 yMultiplier = (u8)(GetFontAttribute(list->template.fontId, 1) + list->template.itemVerticalPadding);
|
||||
u8 width = 7;
|
||||
u8 height = 16;
|
||||
@ -234,6 +235,7 @@ static void ListMenuErasePrintedCursor(struct ListMenu *list, u16 itemsAbove) {
|
||||
width,
|
||||
height);
|
||||
break;
|
||||
}
|
||||
case 1:
|
||||
case 2: // leftover
|
||||
case 3: // leftover
|
||||
|
@ -136,7 +136,7 @@ static BOOL ov01_02204EFC(TaskManager *taskManager) {
|
||||
}
|
||||
FreeToHeap(unk4);
|
||||
FreeToHeap(didHeadbuttStartBattle);
|
||||
return TRUE;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static s8 ov01_02204FE0(u16 a0, u16 a1, u32 trainerId, u32 x, u32 y, s16 a5[][2]) {
|
||||
@ -178,7 +178,7 @@ static s8 ov01_02205074(u8 a0, u8 a1, u32 trainerId) {
|
||||
}
|
||||
|
||||
static void ov01_022050F8(FieldSystem *fieldSystem, u32 *x, u32 *y) {
|
||||
u32 inFrontX, inFrontY;
|
||||
int inFrontX, inFrontY;
|
||||
PlayerAvatar_GetCoordsInFront(fieldSystem->playerAvatar, &inFrontX, &inFrontY);
|
||||
if (FollowingPokemon_IsActive(fieldSystem)) {
|
||||
LocalMapObject *object = FollowingPokemon_GetMapObject(fieldSystem);
|
||||
|
@ -61,12 +61,14 @@ static LocalMapObject* ov26_02259A24(FieldSystem* fieldSystem, LocalMapObject* a
|
||||
case 7:
|
||||
case 8:
|
||||
case 1:
|
||||
{
|
||||
u32 script2 = MapObject_GetScript(object);
|
||||
u32 trainer2 = ScriptNumToTrainerNum((u16)script2);
|
||||
if (script != script2 && (u32)trainer == trainer2) {
|
||||
return object;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return NULL;
|
||||
|
@ -107,6 +107,7 @@ BOOL PartyMenu_AnimateIconFormChange(PartyMenuStruct* unkPtr) {
|
||||
}
|
||||
break;
|
||||
case 9:
|
||||
{
|
||||
String* str = NewString_ReadMsgData(unkPtr->msgData, msg_0300_00188); //" changed Form!"
|
||||
BufferBoxMonNickname(unkPtr->unk7c4, 0, Mon_GetBoxMon(mon));
|
||||
StringExpandPlaceholders(unkPtr->unk7c4, unkPtr->unk7c8, str);
|
||||
@ -114,6 +115,7 @@ BOOL PartyMenu_AnimateIconFormChange(PartyMenuStruct* unkPtr) {
|
||||
sub_0207DAEC(unkPtr, -1, 1);
|
||||
work->state++;
|
||||
break;
|
||||
}
|
||||
case 10:
|
||||
if (TextPrinterCheckActive(unkPtr->unkc64) == 0) {
|
||||
_DestroyLocalWork(unkPtr);
|
||||
|
@ -8,7 +8,7 @@
|
||||
#define POKEDEX_MAGIC (0xBEEFCAFE)
|
||||
#define ASSERT_POKEDEX(pokedex) do { GF_ASSERT((pokedex)->magic == POKEDEX_MAGIC);} while (0)
|
||||
|
||||
void Pokedex_InitDeoxysFormOrder(Pokedex *pokedex);
|
||||
static void Pokedex_InitDeoxysFormOrder(Pokedex *pokedex);
|
||||
u16 *LoadSpeciesToJohtoDexNoLUT(void);
|
||||
void Pokedex_SetInternationalViewFlag(Pokedex *pokedex);
|
||||
|
||||
|
@ -956,7 +956,7 @@ static void SetMonDataInternal(Pokemon *mon, int attr, const void * value) {
|
||||
#undef VALUE
|
||||
}
|
||||
|
||||
void SetBoxMonData(BoxPokemon *boxMon, int attr, void * value) {
|
||||
void SetBoxMonData(BoxPokemon *boxMon, int attr, const void * value) {
|
||||
u32 checksum;
|
||||
if (!boxMon->box_lock) {
|
||||
DECRYPT_BOX(boxMon);
|
||||
|
@ -168,6 +168,7 @@ BOOL ScrCmd_633(ScriptContext *ctx) {
|
||||
sub_0204F878(ctx->fieldSystem->saveData, sp04, r5);
|
||||
break;
|
||||
case 4:
|
||||
{
|
||||
BattleHallChallengeType challengeType;
|
||||
if (r5 == 0) {
|
||||
challengeType = BATTLE_HALL_CHALLENGE_TYPE_SINGLE;
|
||||
@ -178,6 +179,7 @@ BOOL ScrCmd_633(ScriptContext *ctx) {
|
||||
}
|
||||
sub_0204F284(ctx->taskman, r1, challengeType);
|
||||
return TRUE;
|
||||
}
|
||||
default:
|
||||
GF_ASSERT(FALSE);
|
||||
*resultPtr = 0;
|
||||
|
@ -78,6 +78,7 @@ BOOL ScrCmd_643(ScriptContext *ctx) {
|
||||
sub_0204FFB0(ctx->fieldSystem->saveData, unk0, arg1);
|
||||
break;
|
||||
case 4:
|
||||
{
|
||||
BattleArcadeChallengeType challengeType;
|
||||
if (arg1 == 0) {
|
||||
challengeType = BATTLE_ARCADE_CHALLENGE_TYPE_SINGLE;
|
||||
@ -88,6 +89,7 @@ BOOL ScrCmd_643(ScriptContext *ctx) {
|
||||
}
|
||||
sub_0205011C(ctx->taskman, unk1, challengeType);
|
||||
return TRUE;
|
||||
}
|
||||
default:
|
||||
GF_ASSERT(FALSE);
|
||||
*result = 0;
|
||||
|
@ -77,7 +77,7 @@ BOOL ScrCmd_637(ScriptContext *ctx) {
|
||||
case 3: // Unused
|
||||
sub_0204FA14(ctx->fieldSystem->saveData, unk0, arg1);
|
||||
break;
|
||||
case 4:
|
||||
case 4: {
|
||||
BattleCastleChallengeType challengeType;
|
||||
if (arg1 == 0) {
|
||||
challengeType = BATTLE_CASTLE_CHALLENGE_TYPE_SINGLE;
|
||||
@ -88,6 +88,7 @@ BOOL ScrCmd_637(ScriptContext *ctx) {
|
||||
}
|
||||
sub_0204FBDC(ctx->taskman, unk1, challengeType);
|
||||
return TRUE;
|
||||
}
|
||||
default:
|
||||
GF_ASSERT(FALSE);
|
||||
*result = 0;
|
||||
@ -109,9 +110,9 @@ static void sub_0204FA14(SaveData *saveData, u32 a1, u8 a2) {
|
||||
if (a2 == 3) {
|
||||
sub_02031108(sub_0203107C(saveData), 108, sub_0205C268(108), 0);
|
||||
}
|
||||
sub_02031108(sub_0203107C(saveData), sub_0205C1A0(a2), sub_0205C268(sub_0205C1A0(a2)), 0);
|
||||
sub_02031108(sub_0203107C(saveData), sub_0205C1A0(a2), sub_0205C268(sub_0205C1A0(a2)), 0);
|
||||
sub_02031108(sub_0203107C(saveData), sub_0205C1F0(a2), sub_0205C268(sub_0205C1F0(a2)), 0);
|
||||
for (s32 i = 0; i < 3; i++) {
|
||||
for (s32 i = 0; i < 3; i++) {
|
||||
sub_02031108(sub_0203107C(saveData), sub_0205C174(a2, i), sub_0205C268(sub_0205C174(a2, i)), 1);
|
||||
}
|
||||
}
|
||||
|
@ -589,7 +589,7 @@ u32 sub_0204B120(UnkStruct_Fsys_A0 *a0, SaveData *saveData, u32 a2) {
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
case 2:
|
||||
case 2: {
|
||||
u32 unk4 = sub_0202D450(frontierData, 3);
|
||||
s32 unk0 = sub_0202D488(frontierData, 0);
|
||||
if (unk0 == 1) {
|
||||
@ -603,6 +603,7 @@ u32 sub_0204B120(UnkStruct_Fsys_A0 *a0, SaveData *saveData, u32 a2) {
|
||||
return 1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
@ -280,12 +280,14 @@ BOOL sub_020560C4(TaskManager *man) {
|
||||
fenv->transitionState++;
|
||||
break;
|
||||
case 1:
|
||||
{
|
||||
FieldEnvSubUnk18 *info = fenv->unk18;
|
||||
if (ov01_021E98F0(fieldSystem, info, PlayerAvatar_GetFacingDirection(fieldSystem->playerAvatar))) {
|
||||
ov01_021E90D4(fenv->unk18);
|
||||
fenv->transitionState++;
|
||||
}
|
||||
break;
|
||||
}
|
||||
case 2:
|
||||
return TRUE;
|
||||
}
|
||||
@ -308,6 +310,7 @@ BOOL sub_0205613C(TaskManager *man) {
|
||||
}
|
||||
break;
|
||||
case 1:
|
||||
{
|
||||
int dir = PlayerAvatar_GetFacingDirection(fieldSystem->playerAvatar);
|
||||
obj = PlayerAvatar_GetMapObject(fieldSystem->playerAvatar);
|
||||
if (dir == DIR_WEST) {
|
||||
@ -319,13 +322,16 @@ BOOL sub_0205613C(TaskManager *man) {
|
||||
}
|
||||
fenv->transitionState++;
|
||||
break;
|
||||
}
|
||||
case 2:
|
||||
{
|
||||
obj = PlayerAvatar_GetMapObject(fieldSystem->playerAvatar);
|
||||
if (MapObject_IsMovementPaused(obj) == TRUE) {
|
||||
MapObject_ClearHeldMovementIfActive(obj);
|
||||
fenv->transitionState++;
|
||||
}
|
||||
break;
|
||||
}
|
||||
case 3:
|
||||
PlaySE(SEQ_SE_DP_KAIDAN2);
|
||||
ov01_021E636C(FALSE);
|
||||
@ -521,6 +527,7 @@ BOOL sub_02056530(TaskManager *man) {
|
||||
fenv->transitionState++;
|
||||
break;
|
||||
case 2:
|
||||
{
|
||||
FieldEnvSubUnk18 *unk = fenv->unk18;
|
||||
if (ov01_021E9374(fieldSystem, unk)) {
|
||||
ov01_021E90D4(unk);
|
||||
@ -528,6 +535,7 @@ BOOL sub_02056530(TaskManager *man) {
|
||||
return TRUE;
|
||||
}
|
||||
break;
|
||||
}
|
||||
case 3:
|
||||
return TRUE;
|
||||
}
|
||||
@ -539,6 +547,7 @@ BOOL sub_020565FC(TaskManager *man) {
|
||||
FieldTransitionEnvironment *fenv = TaskManager_GetEnvironment(man);
|
||||
switch (fenv->transitionState) {
|
||||
case 0:
|
||||
{
|
||||
LocalMapObject *mapObj = PlayerAvatar_GetMapObject(fieldSystem->playerAvatar);
|
||||
if (sub_0205B70C(GetMetatileBehaviorAt(fieldSystem, GetPlayerXCoord(fieldSystem->playerAvatar), GetPlayerYCoord(fieldSystem->playerAvatar)))) {
|
||||
MapObject_SetVisible(mapObj, TRUE);
|
||||
@ -550,6 +559,7 @@ BOOL sub_020565FC(TaskManager *man) {
|
||||
fenv->transitionState++;
|
||||
break;
|
||||
}
|
||||
}
|
||||
case 1:
|
||||
return TRUE;
|
||||
}
|
||||
|
@ -286,7 +286,7 @@ BOOL MonIsFromTogepiEgg(Pokemon *mon, SaveData *saveData) {
|
||||
// to explicit variables before being compared for the function to match,
|
||||
// even though the values are never used again afterwards. Also, the same
|
||||
// variables are used for different calls to GetMonData.
|
||||
u32 word = GetMonData(mon, MON_DATA_OTID, NULL);
|
||||
int word = GetMonData(mon, MON_DATA_OTID, NULL);
|
||||
if (word != PlayerProfile_GetTrainerID(profile)) {
|
||||
return FALSE;
|
||||
}
|
||||
@ -412,10 +412,12 @@ static BOOL Task_BugContest_PromptSwapPokemon(TaskManager *taskManager) {
|
||||
u32 *state = TaskManager_GetStatePtr(taskManager);
|
||||
switch (*state) {
|
||||
case 0:
|
||||
{
|
||||
u32 noPokemonCaught = contest->caught_poke == SPECIES_NONE;
|
||||
unkStruct->unk08 = sub_0203EDDC(fieldSystem, unkStruct->unk04, contest->mon, noPokemonCaught);
|
||||
(*state)++;
|
||||
break;
|
||||
}
|
||||
case 1:
|
||||
if (FieldSystem_ApplicationIsRunning(fieldSystem) == FALSE) {
|
||||
if (unkStruct->unk08->unk10 != contest->mon) {
|
||||
|
@ -325,6 +325,7 @@ BOOL PrintYouCanEarnEvenMoreCoins(WorkflowEngine *workflow, VoltorbFlipAppWork *
|
||||
|
||||
switch (state) {
|
||||
case 0:
|
||||
{
|
||||
BOOL printerFinished = IsPrinterFinished(work);
|
||||
if (printerFinished) {
|
||||
if (LevelsGained(work->game) > 0) {
|
||||
@ -340,6 +341,7 @@ BOOL PrintYouCanEarnEvenMoreCoins(WorkflowEngine *workflow, VoltorbFlipAppWork *
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
case 1:
|
||||
if (IsPrinterFinished(work)) {
|
||||
return TRUE;
|
||||
@ -498,6 +500,7 @@ BOOL AwaitBoardInteraction(WorkflowEngine *workflow, VoltorbFlipAppWork *work) {
|
||||
case 0:
|
||||
break;
|
||||
case 1:
|
||||
{
|
||||
int cardId = ov122_021E8DF0(work->unk240);
|
||||
if (IsCardFlipped(work->game, cardId)) {
|
||||
PlaySE(SEQ_SE_DP_BOX03);
|
||||
@ -506,6 +509,7 @@ BOOL AwaitBoardInteraction(WorkflowEngine *workflow, VoltorbFlipAppWork *work) {
|
||||
return TRUE;
|
||||
}
|
||||
break;
|
||||
}
|
||||
case 4:
|
||||
PlaySE(SEQ_SE_DP_SELECT);
|
||||
UnkImageStruct_SetSpriteAnimSeqNo(work->unk14C[2], 6);
|
||||
@ -541,6 +545,7 @@ BOOL PlaySuspensefulFanfare(WorkflowEngine *workflow, VoltorbFlipAppWork *work)
|
||||
int state = CurrentTaskState(workflow);
|
||||
switch (state) {
|
||||
case 0:
|
||||
{
|
||||
int var2 = ov122_021E8DF0(work->unk240);
|
||||
s16 col = var2 % 5;
|
||||
s16 row = var2 / 5;
|
||||
@ -570,6 +575,7 @@ BOOL PlaySuspensefulFanfare(WorkflowEngine *workflow, VoltorbFlipAppWork *work)
|
||||
}
|
||||
IncrementTaskState(workflow);
|
||||
break;
|
||||
}
|
||||
case 1:
|
||||
if (!IsSEPlaying(SEQ_SE_GS_PANERU_MEKURUMAE) && !IsFanfarePlaying()) {
|
||||
return TRUE;
|
||||
@ -595,6 +601,7 @@ BOOL AwaitCardFlipAndResult(WorkflowEngine *workflow, VoltorbFlipAppWork *work)
|
||||
}
|
||||
break;
|
||||
case 1:
|
||||
{
|
||||
int cardId = ov122_021E8DF0(work->unk240);
|
||||
CardType type = GetCardType(work->game, cardId);
|
||||
|
||||
@ -633,6 +640,7 @@ BOOL AwaitCardFlipAndResult(WorkflowEngine *workflow, VoltorbFlipAppWork *work)
|
||||
}
|
||||
IncrementTaskState(workflow);
|
||||
break;
|
||||
}
|
||||
case 2:
|
||||
if (GF_IsAnySEPlaying() == 0) {
|
||||
IncrementTaskState(workflow);
|
||||
@ -703,6 +711,7 @@ BOOL AwardCoins(WorkflowEngine *workflow, VoltorbFlipAppWork *work) {
|
||||
int state = CurrentTaskState(workflow);
|
||||
switch (state) {
|
||||
case 0:
|
||||
{
|
||||
int var2 = GamePayout(work->game);
|
||||
BufferIntegerAsString(work->msgFmt, 0, var2, 5, PRINTING_MODE_LEFT_ALIGN, 1);
|
||||
BufferPlayersName(work->msgFmt, 1, work->profile);
|
||||
@ -712,6 +721,7 @@ BOOL AwardCoins(WorkflowEngine *workflow, VoltorbFlipAppWork *work) {
|
||||
sub_02004EC4(64, 0, 0);
|
||||
PlaySE(SEQ_SE_GS_COIN_PAYOUT_ONE);
|
||||
IncrementTaskState(workflow);
|
||||
}
|
||||
// fallthrough
|
||||
case 1:
|
||||
if (AwardPayoutToPlayer(work)) {
|
||||
@ -811,11 +821,13 @@ BOOL ov122_021E65FC(WorkflowEngine *workflow, VoltorbFlipAppWork *work) {
|
||||
case 6:
|
||||
case 7:
|
||||
case 8:
|
||||
{
|
||||
int cardId = ov122_021E8DF0(work->unk240);
|
||||
|
||||
u8 var3 = var1 - 5;
|
||||
TryToggleCardMemo(work, cardId, var3);
|
||||
break;
|
||||
}
|
||||
case 0:
|
||||
ov122_021E72D0(work);
|
||||
break;
|
||||
@ -842,6 +854,7 @@ BOOL ov122_021E6700(WorkflowEngine *workflow, VoltorbFlipAppWork *work) {
|
||||
int var1 = ov122_021E8D74(work->unk240);
|
||||
switch (var1) {
|
||||
case 1:
|
||||
{
|
||||
int cardId = ov122_021E8DF0(work->unk240);
|
||||
int var3 = ov122_021E8E0C(work->unk240);
|
||||
if (TryToggleCardMemo(work, cardId, var3)) {
|
||||
@ -849,6 +862,7 @@ BOOL ov122_021E6700(WorkflowEngine *workflow, VoltorbFlipAppWork *work) {
|
||||
return TRUE;
|
||||
}
|
||||
break;
|
||||
}
|
||||
case 4:
|
||||
PlaySE(SEQ_SE_DP_SELECT);
|
||||
work->unk238 = 0;
|
||||
@ -922,6 +936,7 @@ BOOL PrintAreYouSureYouWantToQuit(WorkflowEngine *workflow, VoltorbFlipAppWork *
|
||||
int state = CurrentTaskState(workflow);
|
||||
switch (state) {
|
||||
case 0:
|
||||
{
|
||||
int payout = GamePayout(work->game);
|
||||
if (payout == 0) {
|
||||
// "You haven’t found any Coins! Are you sure you..."
|
||||
@ -935,6 +950,7 @@ BOOL PrintAreYouSureYouWantToQuit(WorkflowEngine *workflow, VoltorbFlipAppWork *
|
||||
PrintTextWindow(work, msgNo, 1);
|
||||
IncrementTaskState(workflow);
|
||||
break;
|
||||
}
|
||||
case 1:
|
||||
if (IsPrinterFinished(work)) {
|
||||
return TRUE;
|
||||
@ -964,7 +980,8 @@ BOOL ov122_021E6900(WorkflowEngine *workflow, VoltorbFlipAppWork *work) {
|
||||
BOOL AwaitQuitYesNoSelection(WorkflowEngine *workflow, VoltorbFlipAppWork *work) {
|
||||
int var1 = YesNoPrompt_HandleInput(work->unk13C);
|
||||
switch (var1) {
|
||||
case 1: // YES
|
||||
case YESNORESPONSE_YES: // YES
|
||||
{
|
||||
int payout = GamePayout(work->game);
|
||||
|
||||
SetRoundOutcome(work->game, ROUND_OUTCOME_QUIT);
|
||||
@ -976,7 +993,8 @@ BOOL AwaitQuitYesNoSelection(WorkflowEngine *workflow, VoltorbFlipAppWork *work)
|
||||
EnqueueWorkflow(workflow, WORKFLOW_AWARD_COINS);
|
||||
}
|
||||
return TRUE;
|
||||
case 2: // NO
|
||||
}
|
||||
case YESNORESPONSE_NO: // NO
|
||||
BgClearTilemapBufferAndCommit(work->bgConfig, 3);
|
||||
ov122_021E78B4(&work->unk25C);
|
||||
if (work->unk238 != 0) {
|
||||
@ -1317,12 +1335,14 @@ static void ov122_021E70B8(Ov122_021E70B8 *a0, int a1, int a2, VoltorbFlipAppWor
|
||||
|
||||
switch (a2) {
|
||||
case 0:
|
||||
{
|
||||
int var1 = (a0->unk11 % 5) * 4 + 1;
|
||||
int var2 = (a0->unk11 / 5) * 4 + 1;
|
||||
|
||||
FillBgTilemapRect(work->bgConfig, 2, 0, var1, var2, 3, 3, 0);
|
||||
BgCommitTilemapBufferToVram(work->bgConfig, 2);
|
||||
return;
|
||||
}
|
||||
case 1:
|
||||
FillBgTilemapRect(work->bgConfig, 2, 0, 1, 1, 20, 20, 0);
|
||||
BgCommitTilemapBufferToVram(work->bgConfig, 2);
|
||||
@ -2018,10 +2038,12 @@ BOOL VoltorbFlipApp_OvyInit(OVY_MANAGER *man, int *state) {
|
||||
*state += 1;
|
||||
break;
|
||||
case 1:
|
||||
{
|
||||
VoltorbFlipAppWork *work = OverlayManager_GetData(man);
|
||||
BeginNormalPaletteFade(0, 0x15, 0x15, 0, 6, 1, work->heapId);
|
||||
*state += 1;
|
||||
break;
|
||||
}
|
||||
case 2:
|
||||
if (IsPaletteFadeFinished() != 0) {
|
||||
return TRUE;
|
||||
|
Loading…
x
Reference in New Issue
Block a user