Merge branch 'master' into intro_movie

This commit is contained in:
PikalaxALT 2024-02-17 04:43:26 -05:00
commit 93ebc9a31a
No known key found for this signature in database
GPG Key ID: C7E3D40F3BAC7AEB
24 changed files with 1438 additions and 2744 deletions

View File

@ -1,107 +0,0 @@
#include <nitro/fs/overlay.h>
#pragma once
.public TextFlags_SetCanABSpeedUpPrint
.public sub_02002B8C
.public FontID_String_GetWidth
.public LoadFontPal0
.public LoadFontPal1
.public GF_SndSetMonoFlag
.public PlaySE
.public OverlayManager_CreateAndGetData
.public OverlayManager_GetData
.public OverlayManager_FreeData
.public OverlayManager_GetArgs
.public GfGfxLoader_LoadCharData
.public GfGfxLoader_LoadScrnData
.public GfGfxLoader_GXLoadPal
.public G2dRenderer_SetSubSurfaceCoords
.public NewMsgDataFromNarc
.public DestroyMsgData
.public ReadMsgDataIntoString
.public NewString_ReadMsgData
.public SpriteRenderer_Create
.public SpriteRenderer_CreateGfxHandler
.public SpriteRenderer_GetG2dRendererPtr
.public sub_0200CF70
.public sub_0200CFF4
.public sub_0200D020
.public thunk_OamManager_ApplyAndResetBuffers
.public SpriteRenderer_RemoveGfxHandler
.public SpriteRenderer_Delete
.public sub_0200D294
.public SpriteRenderer_CreateSprite
.public thunk_Sprite_SetPriority
.public Sprite_SetPositionXY
.public Sprite_GetPositionXY
.public sub_0200E5D4
.public LoadUserFrameGfx2
.public DrawFrameAndWindow2
.public ClearFrameAndWindow2
.public BeginNormalPaletteFade
.public IsPaletteFadeFinished
.public sub_0200FBDC
.public sub_0200FBF4
.public sub_020183F0
.public sub_02018410
.public Main_SetVBlankIntrCB
.public HBlankInterruptDisable
.public CreateHeap
.public DestroyHeap
.public FreeToHeap
.public BgConfig_Alloc
.public SetBothScreensModesAndDisable
.public InitBgFromTemplate
.public FreeBgTilemapBuffer
.public ToggleBgLayer
.public BgSetPosTextAndCommit
.public BG_ClearCharDataRange
.public BgClearTilemapBufferAndCommit
.public AddWindowParameterized
.public RemoveWindow
.public CopyWindowToVram
.public ClearWindowTilemap
.public ClearWindowTilemapAndCopyToVram
.public FillWindowPixelBuffer
.public FillWindowPixelRect
.public DoScheduledBgGpuUpdates
.public TextPrinterCheckActive
.public RemoveTextPrinter
.public AddTextPrinterParameterizedWithColor
.public GF_CreateVramTransferManager
.public GF_DestroyVramTransferManager
.public GfGfx_SetBanks
.public GfGfx_DisableEngineAPlanes
.public GfGfx_EngineATogglePlanes
.public GfGfx_DisableEngineBPlanes
.public GfGfx_EngineBTogglePlanes
.public Set2dSpriteVisibleFlag
.public Set2dSpriteAnimActiveFlag
.public Set2dSpriteAnimSeqNo
.public Sprite_IsCellAnimationRunning
.public TouchscreenHitbox_FindRectAtTouchNew
.public String_New
.public String_Delete
.public String_SetEmpty
.public Options_SetButtonModeOnMain
.public Options_GetTextSpeed
.public Options_SetTextSpeed
.public Options_GetTextFrameDelay
.public Options_GetSoundMethod
.public Options_SetSoundMethod
.public Options_GetBattleScene
.public Options_SetBattleScene
.public Options_GetBattleStyle
.public Options_SetBattleStyle
.public Options_GetButtonMode
.public Options_SetButtonMode
.public Options_GetFrame
.public Options_SetFrame
.public sub_0203A964
.public NNS_GfdDoVramTransfer
.public memset
.public _s32_div_f
.public _u32_div_f
.public gSystem
.public ov54_021E5900
.public ov54_021E5A10
.public ov54_021E5B3C

View File

@ -247,9 +247,9 @@
.public SignBackOfTrainerCardApp_OvyInit
.public SignBackOfTrainerCardApp_OvyExec
.public SignBackOfTrainerCardApp_OvyExit
.public ov54_021E5900
.public ov54_021E5A10
.public ov54_021E5B3C
.public OptionsApp_Init
.public OptionsApp_Main
.public OptionsApp_Exit
.public ov55_UnkApp_Init
.public ov55_UnkApp_Main
.public ov55_UnkApp_Exit

File diff suppressed because it is too large Load Diff

View File

@ -73,7 +73,7 @@ _020FA334:
_020FA344:
.word ov99_021E5900, ov99_021E5A38, ov99_021E5A04, FS_OVERLAY_ID(OVY_99)
_020FA354:
.word ov54_021E5900, ov54_021E5B3C, ov54_021E5A10, FS_OVERLAY_ID(OVY_54)
.word OptionsApp_Init, OptionsApp_Exit, OptionsApp_Main, FS_OVERLAY_ID(options_app)
_020FA364:
.word ov111_021E5900, ov111_021E59B8, ov111_021E5960, FS_OVERLAY_ID(OVY_111)
_020FA374:

View File

@ -71,7 +71,7 @@ FS_EXTERN_OVERLAY(OVY_48)
FS_EXTERN_OVERLAY(OVY_49)
FS_EXTERN_OVERLAY(OVY_5)
FS_EXTERN_OVERLAY(OVY_53)
FS_EXTERN_OVERLAY(OVY_54)
FS_EXTERN_OVERLAY(options_app)
FS_EXTERN_OVERLAY(OVY_55)
FS_EXTERN_OVERLAY(OVY_56)
FS_EXTERN_OVERLAY(OVY_57)

View File

@ -82,7 +82,7 @@ f9744c1f8791d3d11f83ee8e71096f224e910ff5 *build/heartgold.us/OVY_49.sbin
1745104f347e987d72f6eee807bc594d70d0b79a *build/heartgold.us/trainer_card_main.sbin
ec5322fc86adb5e49b1718fa213c1e4955720aed *build/heartgold.us/trainer_card_signature.sbin
4ae0c56965636eb6e5ef168602ddf5f695dc2c83 *build/heartgold.us/OVY_53.sbin
582e5070cb3ea5c7ba004576ee988ffd9d5d273e *build/heartgold.us/OVY_54.sbin
582e5070cb3ea5c7ba004576ee988ffd9d5d273e *build/heartgold.us/options_app.sbin
93428cd143fa3d5cfe728076b4c2b5ea142f3284 *build/heartgold.us/OVY_55.sbin
15550ce45939eee4043bb7e41894385ae935c089 *build/heartgold.us/OVY_56.sbin
e7db2d70f8beecd403f10a090f7223751cecbaa5 *build/heartgold.us/OVY_57.sbin

View File

@ -71,9 +71,9 @@ int BattleSystem_GetSafariBallCount(BattleSystem *bsys);
void BattleSystem_SetSafariBallCount(BattleSystem *bsys, int item);
Options *BattleSystem_GetOptions(BattleSystem *bsys);
BOOL BattleSystem_AreBattleAnimationsOn(BattleSystem *bsys);
u16 BattleSystem_GetFrame(BattleSystem *bsys);
u32 BattleSystem_GetFrame(BattleSystem *bsys);
u8 BattleSystem_GetTextFrameDelay(BattleSystem *bsys);
u16 BattleSystem_GetBattleStyle(BattleSystem *bsys);
u32 BattleSystem_GetBattleStyle(BattleSystem *bsys);
void *ov12_0223B750(BattleSystem *bsys);
SOUND_CHATOT *BattleSystem_GetChatotVoice(BattleSystem *bsys, int battlerId);
void BattleSystem_TryChangeForm(BattleSystem *bsys);

View File

@ -2,14 +2,15 @@
#define POKEHEARTGOLD_CONSTANTS_POKEMON_H
// Value and data limits
#define MAX_LEVEL 100
#define MAX_MON_MOVES 4
#define MAX_EV 100
#define MAX_EV_SUM 510
#define MAX_LEVEL 100
#define MAX_MON_MOVES 4
#define MAX_EV 100
#define MAX_EV_SUM 510
#define MAX_LEARNED_MOVES 22
#define NUM_BOXES 18
#define MONS_PER_BOX 30
#define BOX_NAME_LENGTH 20
#define BOX_NAME_LENGTH 20
// Pokemon types
#define TYPE_NONE 255

View File

@ -1,22 +0,0 @@
#ifndef POKEHEARTGOLD_FIELD_BLACKTHORN_TUTORS_H
#define POKEHEARTGOLD_FIELD_BLACKTHORN_TUTORS_H
#include "player_data.h"
#include "pokemon_types_def.h"
typedef struct MoveRelearner { //todo: move to unk_0203E348? rename to MoveRelearnerAppData?
Pokemon *mon;
PlayerProfile *profile;
Options *options;
u8 filler_0C[4];
u16 *eligibleMoves;
u8 filler_14[5];
u8 unk_19;
u8 padding_1A[2];
} MoveRelearner;
struct MoveRelearner *MoveRelearner_New(HeapID heapId);
void MoveRelearner_Delete(struct MoveRelearner *moveRelearner);
u16 *GetEligibleLevelUpMoves(Pokemon *mon, HeapID heapId);
BOOL sub_0209186C(const u16 *ptr);
#endif //POKEHEARTGOLD_FIELD_BLACKTHORN_TUTORS_H

View File

@ -19,6 +19,7 @@ typedef enum HeapID {
HEAP_ID_PARTY_MENU,
HEAP_ID_TITLE_SCREEN = 30,
HEAP_ID_32 = 32,
HEAP_ID_OPTIONS_APP = 38,
HEAP_ID_OV55 = 40,
HEAP_ID_CHOOSE_STARTER = 46,
HEAP_ID_EVOLUTION = 71,

23
include/move_relearner.h Normal file
View File

@ -0,0 +1,23 @@
#ifndef POKEHEARTGOLD_MOVE_RELEARNER_H
#define POKEHEARTGOLD_MOVE_RELEARNER_H
#include "player_data.h"
#include "pokemon_types_def.h"
typedef struct MoveRelearner {
Pokemon *mon;
PlayerProfile *profile;
Options *options;
u8 filler_0C[4];
u16 *eligibleMoves;
u8 filler_14[5];
u8 unk_19;
u8 padding_1A[2];
} MoveRelearner;
MoveRelearner *MoveRelearner_New(HeapID heapId);
void MoveRelearner_Delete(MoveRelearner *moveRelearner);
u16 *MoveRelearner_GetEligibleLevelUpMoves(Pokemon *mon, HeapID heapId);
BOOL MoveRelearner_IsValidMove(const u16 *ptr);
#endif //POKEHEARTGOLD_MOVE_RELEARNER_H

View File

@ -18,18 +18,18 @@ Options* Options_New(HeapID heapId);
void Options_Copy(Options* src, Options* dest);
void Options_Init(Options* options);
void Options_SetButtonModeOnMain(SaveData* saveData, u32 buttonMode);
u16 Options_GetTextSpeed(Options* options);
u32 Options_GetTextSpeed(Options* options);
void Options_SetTextSpeed(Options* options, u32 textSpeed);
u8 Options_GetTextFrameDelay(Options* options);
u16 Options_GetSoundMethod(Options* options);
u32 Options_GetSoundMethod(Options* options);
void Options_SetSoundMethod(Options* options, u32 soundMethod);
u16 Options_GetBattleScene(Options* options);
u32 Options_GetBattleScene(Options* options);
void Options_SetBattleScene(Options* options, u32 battleScene);
u16 Options_GetBattleStyle(Options* options);
u32 Options_GetBattleStyle(Options* options);
void Options_SetBattleStyle(Options* options, u32 battleStyle);
u16 Options_GetButtonMode(Options* options);
u32 Options_GetButtonMode(Options* options);
void Options_SetButtonMode(Options* options, u32 buttonMode);
u16 Options_GetFrame(Options* options);
u32 Options_GetFrame(Options* options);
void Options_SetFrame(Options* options, u32 frame);
#endif //POKEHEARTGOLD_OPTIONS_H

16
include/options_app.h Normal file
View File

@ -0,0 +1,16 @@
#ifndef POKEHEARTGOLD_OPTIONS_APP_H
#define POKEHEARTGOLD_OPTIONS_APP_H
#include "overlay_manager.h"
typedef struct OptionsApp_Args {
u32 unk0;
Options *options;
u32 *unk8;
} OptionsApp_Args;
BOOL OptionsApp_Init(OVY_MANAGER *manager, int *state);
BOOL OptionsApp_Main(OVY_MANAGER *manager, int *state);
BOOL OptionsApp_Exit(OVY_MANAGER *manager, int *state);
#endif

View File

@ -13,16 +13,16 @@
#include "sound_chatot.h"
#include "filesystem.h"
#define WOTBL_END 0xFFFF
#define WOTBL_MAX 21
#define LEVEL_UP_LEARNSET_END 0xFFFF
#define LEVEL_UP_LEARNSET_MAX 21
#define WOTBL_MOVEID_MASK 0x01FF
#define WOTBL_MOVEID_SHIFT 0
#define WOTBL_LEVEL_MASK 0xFE00
#define WOTBL_LEVEL_SHIFT 9
#define LEVEL_UP_LEARNSET_MOVEID_MASK 0x01FF
#define LEVEL_UP_LEARNSET_MOVEID_SHIFT 0
#define LEVEL_UP_LEARNSET_LEVEL_MASK 0xFE00
#define LEVEL_UP_LEARNSET_LEVEL_SHIFT 9
#define WOTBL_MOVE(x) ((u16)(((x) & WOTBL_MOVEID_MASK) >> WOTBL_MOVEID_SHIFT))
#define WOTBL_LVL(x) ((u8)(((x) & WOTBL_LEVEL_MASK) >> WOTBL_LEVEL_SHIFT))
#define LEVEL_UP_LEARNSET_MOVE(x) ((u16)(((x) & LEVEL_UP_LEARNSET_MOVEID_MASK) >> LEVEL_UP_LEARNSET_MOVEID_SHIFT))
#define LEVEL_UP_LEARNSET_LVL(x) (((x) & LEVEL_UP_LEARNSET_LEVEL_MASK) >> LEVEL_UP_LEARNSET_LEVEL_SHIFT)
#define MOVE_APPEND_FULL 0xFFFFu
#define MOVE_APPEND_KNOWN 0xFFFEu
@ -89,7 +89,7 @@ u32 TryAppendBoxMonMove(BoxPokemon *boxMon, u16 move);
void BoxMonSetMoveInSlot(BoxPokemon *boxMon, u16 move, u8 slot);
void DeleteMonFirstMoveAndAppend(Pokemon *mon, u16 move);
void DeleteBoxMonFirstMoveAndAppend(BoxPokemon *boxMon, u16 move);
void LoadWotbl_HandleAlternateForm(int species, int form, u16 *wotbl);
void LoadLevelUpLearnset_HandleAlternateForm(int species, int form, u16 *levelUpLearnset);
void MonSwapMoves(Pokemon *mon, int a, int b);
void BoxMonSwapMoves(BoxPokemon *boxMon, int a, int b);
BoxPokemon *Mon_GetBoxMon(Pokemon *mon);

View File

@ -8,7 +8,7 @@
#include "bag.h"
#include "mail.h"
#include "fashion_case.h"
#include "field_blackthorn_tutors.h"
#include "move_relearner.h"
#include "credits/credits.h"
struct UseMailWork;
@ -155,7 +155,7 @@ void *sub_0203F984(FieldSystem *fieldSystem);
void *sub_0203F844(FieldSystem *fieldSystem, u16 a1);
void *sub_0203E460(FieldSystem *fieldSystem, u8 a1);
u16 sub_0203E4CC(void *a0);
void sub_0203F9C4(FieldSystem *fieldSystem, struct MoveRelearner *moveRelearner);
void sub_0203F9C4(FieldSystem *fieldSystem, MoveRelearner *moveRelearner);
static inline void InitUnkStructScrCmd408(struct UnkStruct_ScrCmd408 *data, u16 a1, u16 a2, ScriptContext *ctx) {
MI_CpuClear8(data, sizeof(struct UnkStruct_ScrCmd408));

View File

@ -299,7 +299,7 @@ Static main
Object asm/unk_02091564.o
Object asm/unk_020915B0.o
Object asm/unk_02091664.o
Object src/field_blackthorn_tutors.o
Object src/move_relearner.o
Object asm/unk_02091880.o
Object asm/unk_02091CDC.o
Object asm/unk_020921A4.o
@ -801,10 +801,10 @@ Overlay OVY_53
After main
Object asm/overlay_53.o
}
Overlay OVY_54
Overlay options_app
{
After main
Object asm/overlay_54.o
Object src/options_app.o
}
Overlay OVY_55
{

View File

@ -82,7 +82,7 @@ f9744c1f8791d3d11f83ee8e71096f224e910ff5 *build/soulsilver.us/OVY_49.sbin
1745104f347e987d72f6eee807bc594d70d0b79a *build/soulsilver.us/trainer_card_main.sbin
ec5322fc86adb5e49b1718fa213c1e4955720aed *build/soulsilver.us/trainer_card_signature.sbin
4ae0c56965636eb6e5ef168602ddf5f695dc2c83 *build/soulsilver.us/OVY_53.sbin
582e5070cb3ea5c7ba004576ee988ffd9d5d273e *build/soulsilver.us/OVY_54.sbin
582e5070cb3ea5c7ba004576ee988ffd9d5d273e *build/soulsilver.us/options_app.sbin
93428cd143fa3d5cfe728076b4c2b5ea142f3284 *build/soulsilver.us/OVY_55.sbin
15550ce45939eee4043bb7e41894385ae935c089 *build/soulsilver.us/OVY_56.sbin
e7db2d70f8beecd403f10a090f7223751cecbaa5 *build/soulsilver.us/OVY_57.sbin

View File

@ -748,7 +748,7 @@ BOOL BattleSystem_AreBattleAnimationsOn(BattleSystem *bsys) {
return (Options_GetBattleScene(bsys->options) == 0);
}
u16 BattleSystem_GetFrame(BattleSystem *bsys) {
u32 BattleSystem_GetFrame(BattleSystem *bsys) {
return Options_GetFrame(bsys->options);
}
@ -759,7 +759,7 @@ u8 BattleSystem_GetTextFrameDelay(BattleSystem *bsys) {
return Options_GetTextFrameDelay(bsys->options);
}
u16 BattleSystem_GetBattleStyle(BattleSystem *bsys) {
u32 BattleSystem_GetBattleStyle(BattleSystem *bsys) {
return Options_GetBattleStyle(bsys->options);
}

View File

@ -1,71 +0,0 @@
#include "global.h"
#include "field_blackthorn_tutors.h"
#include "pokemon.h"
struct MoveRelearner *MoveRelearner_New(HeapID heapId) {
struct MoveRelearner *ret;
ret = AllocFromHeap(heapId, sizeof(struct MoveRelearner));
memset(ret, 0, sizeof(struct MoveRelearner));
return ret;
}
void MoveRelearner_Delete(struct MoveRelearner *moveRelearner) {
FreeToHeap(moveRelearner);
}
u16 *GetEligibleLevelUpMoves(Pokemon *mon, HeapID heapId) {
u16 cur_moveset[MAX_MON_MOVES]; // sp+10
u16 species; // sp+0C
u8 form; // sp+08
u8 level; // sp+04
u16 *ret;
u16 *wotbl;
u8 i, j, ct;
species = GetMonData(mon, MON_DATA_SPECIES, NULL);
form = GetMonData(mon, MON_DATA_FORM, NULL);
level = GetMonData(mon, MON_DATA_LEVEL, NULL);
for (i = 0; i < MAX_MON_MOVES; i++) {
cur_moveset[i] = GetMonData(mon, MON_DATA_MOVE1 + i, NULL);
}
wotbl = AllocFromHeap(heapId, WOTBL_MAX * 2);
ret = AllocFromHeap(heapId, WOTBL_MAX * 2);
LoadWotbl_HandleAlternateForm(species, form, wotbl);
ct = 0;
for (i = 0; i < WOTBL_MAX; i++) {
if (wotbl[i] == WOTBL_END) {
ret[ct] = WOTBL_END;
break;
} else if (((wotbl[i] & WOTBL_LEVEL_MASK) >> WOTBL_LEVEL_SHIFT) > level) {
continue;
} else {
wotbl[i] &= WOTBL_MOVEID_MASK;
for (j = 0; j < MAX_MON_MOVES; j++) {
if (wotbl[i] == cur_moveset[j]) {
break;
}
}
if (j == MAX_MON_MOVES) {
for (j = 0; j < ct; j++) {
if (ret[j] == wotbl[i]) {
break;
}
}
if (j == ct) {
ret[ct] = wotbl[i];
ct++;
}
}
}
}
FreeToHeap(wotbl);
return ret;
}
BOOL sub_0209186C(const u16 *ptr) {
return *ptr != WOTBL_END;
}

62
src/move_relearner.c Normal file
View File

@ -0,0 +1,62 @@
#include "global.h"
#include "move_relearner.h"
#include "pokemon.h"
MoveRelearner *MoveRelearner_New(HeapID heapId) {
MoveRelearner *ret = AllocFromHeap(heapId, sizeof(MoveRelearner));
memset(ret, 0, sizeof(MoveRelearner));
return ret;
}
void MoveRelearner_Delete(MoveRelearner *moveRelearner) {
FreeToHeap(moveRelearner);
}
u16 *MoveRelearner_GetEligibleLevelUpMoves(Pokemon *mon, HeapID heapId) {
u16 species = GetMonData(mon, MON_DATA_SPECIES, NULL);
u8 form = GetMonData(mon, MON_DATA_FORM, NULL);
u8 level = GetMonData(mon, MON_DATA_LEVEL, NULL);
u16 moves[MAX_MON_MOVES];
for (u8 i = 0; i < MAX_MON_MOVES; i++) {
moves[i] = GetMonData(mon, MON_DATA_MOVE1 + i, NULL);
}
u16 *tableFromFile = AllocFromHeap(heapId, LEVEL_UP_LEARNSET_MAX * 2);
u16 *returnTable = AllocFromHeap(heapId, LEVEL_UP_LEARNSET_MAX * 2);
LoadLevelUpLearnset_HandleAlternateForm(species, form, tableFromFile);
for (u8 i = 0, j, k = 0; i < LEVEL_UP_LEARNSET_MAX; i++) {
if (tableFromFile[i] == LEVEL_UP_LEARNSET_END) {
returnTable[k] = LEVEL_UP_LEARNSET_END;
break;
} else if (LEVEL_UP_LEARNSET_LVL(tableFromFile[i]) > level) {
continue;
} else {
tableFromFile[i] = LEVEL_UP_LEARNSET_MOVE(tableFromFile[i]);
for (j = 0; j < MAX_MON_MOVES; j++) {
if (tableFromFile[i] == moves[j]) {
break;
}
}
if (j == MAX_MON_MOVES) {
for (j = 0; j < k; j++) {
if (returnTable[j] == tableFromFile[i]) {
break;
}
}
if (j == k) {
returnTable[k] = tableFromFile[i];
k++;
}
}
}
}
FreeToHeap(tableFromFile);
return returnTable;
}
BOOL MoveRelearner_IsValidMove(const u16 *ptr) {
return *ptr != LEVEL_UP_LEARNSET_END;
}

View File

@ -40,7 +40,7 @@ void Options_SetButtonModeOnMain(SaveData* saveData, u32 buttonMode) {
}
}
u16 Options_GetTextSpeed(Options* options) {
u32 Options_GetTextSpeed(Options* options) {
return options->textSpeed;
}
@ -49,7 +49,7 @@ void Options_SetTextSpeed(Options* options, u32 textSpeed) {
}
u8 Options_GetTextFrameDelay(Options* options) {
u16 textSpeed = Options_GetTextSpeed(options);
u32 textSpeed = Options_GetTextSpeed(options);
if (textSpeed == 0) {
return 8;
@ -62,7 +62,7 @@ u8 Options_GetTextFrameDelay(Options* options) {
return 1;
}
u16 Options_GetSoundMethod(Options* options) {
u32 Options_GetSoundMethod(Options* options) {
return options->soundMethod;
}
@ -70,7 +70,7 @@ void Options_SetSoundMethod(Options* options, u32 soundMethod) {
options->soundMethod = soundMethod;
}
u16 Options_GetBattleScene(Options* options) {
u32 Options_GetBattleScene(Options* options) {
return options->battleScene;
}
@ -78,7 +78,7 @@ void Options_SetBattleScene(Options* options, u32 battleScene) {
options->battleScene = battleScene;
}
u16 Options_GetBattleStyle(Options* options) {
u32 Options_GetBattleStyle(Options* options) {
return options->battleStyle;
}
@ -86,7 +86,7 @@ void Options_SetBattleStyle(Options* options, u32 battleStyle) {
options->battleStyle = battleStyle;
}
u16 Options_GetButtonMode(Options* options) {
u32 Options_GetButtonMode(Options* options) {
return options->buttonMode;
}
@ -94,7 +94,7 @@ void Options_SetButtonMode(Options* options, u32 buttonMode) {
options->buttonMode = buttonMode;
}
u16 Options_GetFrame(Options* options) {
u32 Options_GetFrame(Options* options) {
return options->frame;
}

1264
src/options_app.c Normal file

File diff suppressed because it is too large Load Diff

View File

@ -3042,26 +3042,26 @@ u16 GetEggSpecies(u16 species) {
void InitBoxMonMoveset(BoxPokemon *boxMon) {
BOOL decry;
u16 * wotbl;
u16 *levelUpLearnset;
int i;
u16 species;
u32 form;
u8 level;
u16 move;
wotbl = AllocFromHeap(HEAP_ID_DEFAULT, 22 * sizeof(u16));
levelUpLearnset = AllocFromHeap(HEAP_ID_DEFAULT, MAX_LEARNED_MOVES * sizeof(u16));
decry = AcquireBoxMonLock(boxMon);
species = (u16)GetBoxMonData(boxMon, MON_DATA_SPECIES, NULL);
form = GetBoxMonData(boxMon, MON_DATA_FORM, NULL);
level = (u8)CalcBoxMonLevel(boxMon);
LoadWotbl_HandleAlternateForm(species, (int)form, wotbl);
for (i = 0; wotbl[i] != WOTBL_END; i++) {
if ((wotbl[i] & WOTBL_LEVEL_MASK) > (level << WOTBL_LEVEL_SHIFT))
LoadLevelUpLearnset_HandleAlternateForm(species, (int)form, levelUpLearnset);
for (i = 0; levelUpLearnset[i] != LEVEL_UP_LEARNSET_END; i++) {
if ((levelUpLearnset[i] & LEVEL_UP_LEARNSET_LEVEL_MASK) > (level << LEVEL_UP_LEARNSET_LEVEL_SHIFT))
break;
move = WOTBL_MOVE(wotbl[i]);
move = LEVEL_UP_LEARNSET_MOVE(levelUpLearnset[i]);
if (TryAppendBoxMonMove(boxMon, move) == MOVE_APPEND_FULL)
DeleteBoxMonFirstMoveAndAppend(boxMon, move);
}
FreeToHeap(wotbl);
FreeToHeap(levelUpLearnset);
ReleaseBoxMonLock(boxMon, decry);
}
@ -3147,29 +3147,29 @@ void BoxMonSetMoveInSlot(BoxPokemon *boxMon, u16 move, u8 slot) {
u32 MonTryLearnMoveOnLevelUp(Pokemon *mon, int * last_i, u16 * sp0) {
u32 ret = 0;
u16 * wotbl = AllocFromHeap(HEAP_ID_DEFAULT, 22 * sizeof(u16));
u16 *levelUpLearnset = AllocFromHeap(HEAP_ID_DEFAULT, MAX_LEARNED_MOVES * sizeof(u16));
u16 species = (u16)GetMonData(mon, MON_DATA_SPECIES, NULL);
u32 form = GetMonData(mon, MON_DATA_FORM, NULL);
u8 level = (u8)GetMonData(mon, MON_DATA_LEVEL, NULL);
LoadWotbl_HandleAlternateForm(species, (int)form, wotbl);
LoadLevelUpLearnset_HandleAlternateForm(species, (int)form, levelUpLearnset);
if (wotbl[*last_i] == WOTBL_END) {
FreeToHeap(wotbl);
if (levelUpLearnset[*last_i] == LEVEL_UP_LEARNSET_END) {
FreeToHeap(levelUpLearnset);
return 0;
}
while ((wotbl[*last_i] & WOTBL_LEVEL_MASK) != (level << WOTBL_LEVEL_SHIFT)) {
while ((levelUpLearnset[*last_i] & LEVEL_UP_LEARNSET_LEVEL_MASK) != (level << LEVEL_UP_LEARNSET_LEVEL_SHIFT)) {
(*last_i)++;
if (wotbl[*last_i] == WOTBL_END) {
FreeToHeap(wotbl);
if (levelUpLearnset[*last_i] == LEVEL_UP_LEARNSET_END) {
FreeToHeap(levelUpLearnset);
return 0;
}
}
if ((wotbl[*last_i] & WOTBL_LEVEL_MASK) == (level << WOTBL_LEVEL_SHIFT)) {
*sp0 = WOTBL_MOVE(wotbl[*last_i]);
if ((levelUpLearnset[*last_i] & LEVEL_UP_LEARNSET_LEVEL_MASK) == (level << LEVEL_UP_LEARNSET_LEVEL_SHIFT)) {
*sp0 = LEVEL_UP_LEARNSET_MOVE(levelUpLearnset[*last_i]);
(*last_i)++;
ret = TryAppendMonMove(mon, *sp0);
}
FreeToHeap(wotbl);
FreeToHeap(levelUpLearnset);
return ret;
}
@ -3304,12 +3304,12 @@ s8 GetFlavorPreferenceFromPID(u32 personality, int flavor) {
int Species_LoadLearnsetTable(u32 species, u32 form, u16 * dest) {
int i;
u16 * wotbl = AllocFromHeap(HEAP_ID_DEFAULT, 22 * sizeof(u16));
LoadWotbl_HandleAlternateForm(species, (int)form, wotbl);
for (i = 0; wotbl[i] != WOTBL_END; i++) {
dest[i] = WOTBL_MOVE(wotbl[i]);
u16 *levelUpLearnset = AllocFromHeap(HEAP_ID_DEFAULT, MAX_LEARNED_MOVES * sizeof(u16));
LoadLevelUpLearnset_HandleAlternateForm(species, (int)form, levelUpLearnset);
for (i = 0; levelUpLearnset[i] != LEVEL_UP_LEARNSET_END; i++) {
dest[i] = LEVEL_UP_LEARNSET_MOVE(levelUpLearnset[i]);
}
FreeToHeap(wotbl);
FreeToHeap(levelUpLearnset);
return i;
}
@ -3670,8 +3670,8 @@ BOOL Mon_UpdateRotomForm(Pokemon *mon, int form, int defaultSlot) {
return TRUE;
}
void LoadWotbl_HandleAlternateForm(int species, int form, u16 * wotbl) {
ReadWholeNarcMemberByIdPair(wotbl, NARC_poketool_personal_wotbl, ResolveMonForm(species, form));
void LoadLevelUpLearnset_HandleAlternateForm(int species, int form, u16 *levelUpLearnset) {
ReadWholeNarcMemberByIdPair(levelUpLearnset, NARC_poketool_personal_wotbl, ResolveMonForm(species, form));
}
void sub_02071FDC(SOUND_CHATOT *r6, u32 r5, u16 r4, s32 unused, s32 sp18, u32 sp1C, u32 sp20, u32 sp24) {

View File

@ -1,6 +1,6 @@
#include "scrcmd.h"
#include "unk_0203E348.h"
#include "field_blackthorn_tutors.h"
#include "move_relearner.h"
BOOL ScrNative_WaitApplication(ScriptContext *ctx);
@ -32,8 +32,8 @@ BOOL ScrCmd_466(ScriptContext *ctx) {
u16 slot = ScriptGetVar(ctx);
Party *party = SaveArray_Party_Get(ctx->fieldSystem->saveData);
Pokemon *mon = Party_GetMonByIndex(party, slot);
u16 *eligibleMoves = GetEligibleLevelUpMoves(mon, HEAP_ID_32);
*retPtr = sub_0209186C(eligibleMoves);
u16 *eligibleMoves = MoveRelearner_GetEligibleLevelUpMoves(mon, HEAP_ID_32);
*retPtr = MoveRelearner_IsValidMove(eligibleMoves);
FreeToHeap(eligibleMoves);
return FALSE;
}
@ -57,7 +57,7 @@ static void CreateMoveRelearner(ScriptContext *ctx, int a1, Pokemon *mon, u16 *e
BOOL ScrCmd_MoveRelearnerInit(ScriptContext *ctx) {
u16 slot = ScriptGetVar(ctx);
Pokemon *mon = Party_GetMonByIndex(SaveArray_Party_Get(ctx->fieldSystem->saveData), slot);
u16 *eligibleMoves = GetEligibleLevelUpMoves(mon, HEAP_ID_32);
u16 *eligibleMoves = MoveRelearner_GetEligibleLevelUpMoves(mon, HEAP_ID_32);
CreateMoveRelearner(ctx, 1, mon, eligibleMoves);
return TRUE;
}