Do some pyramid bag

This commit is contained in:
DizzyEggg 2018-08-30 15:01:07 +02:00
parent 8e5c72766c
commit bc9fe72c6e
11 changed files with 1075 additions and 3204 deletions

File diff suppressed because it is too large Load Diff

View File

@ -27,6 +27,13 @@
#define ARRAY_COUNT(array) (size_t)(sizeof(array) / sizeof((array)[0]))
#define SWAP(a, b, temp) \
{ \
temp = a; \
a = b; \
b = temp; \
}
// useful math macros
// Converts a number to Q8.8 fixed-point format

View File

@ -1,8 +1,6 @@
#ifndef GUARD_ITEM_USE_H
#define GUARD_ITEM_USE_H
extern u16 gSpecialVar_ItemId;
void ItemUseOutOfBattle_Mail(u8);
void ItemUseOutOfBattle_Bike(u8);
void ItemUseOnFieldCB_Bike(u8);
@ -53,5 +51,6 @@ void ItemUseInBattle_EnigmaBerry(u8);
void ItemUseOutOfBattle_CannotUse(u8);
u8 CheckIfItemIsTMHMOrEvolutionStone(u16 itemId);
void sub_80FDD10(u8);
void DisplayItemMessageInBattlePyramid(u8 taskId, const u8* str, void(*callback)(u8 taskId));
#endif // GUARD_ITEM_USE_H

View File

@ -11,7 +11,8 @@
#define LIST_MULTIPLE_SCROLL_DPAD 1
#define LIST_MULTIPLE_SCROLL_L_R 2
enum {
enum
{
SCROLL_ARROW_LEFT,
SCROLL_ARROW_RIGHT,
SCROLL_ARROW_UP,

View File

@ -66,9 +66,9 @@ u16 sub_8198AA4(u8, u8, u8, u8, u8, u8, u16);
void *malloc_and_decompress(const void *src, int *sizeOut);
u16 copy_decompressed_tile_data_to_vram(u8 bgId, const void *src, u16 size, u16 offset, u8 mode);
void AddTextPrinterForMessage(bool8 allowSkippingDelayWithButtonPress);
void AddItemMenuActionTextPrinters (u8, u8, u8, u8, u8, u8, u8, const struct MenuAction*, const u8*);
void sub_8198DBC(u8, u8, u8, u8, u8, u8, u8, const struct MenuAction*, const u8*);
u8 sub_8199944(u8, u8, u8, u8, u8);
void AddItemMenuActionTextPrinters(u8 windowId, u8 fontId, u8 left, u8 top, u8 letterSpacing, u8 lineHeight, u8 itemCount, const struct MenuAction *strs, const u8 *a8);
void sub_8198DBC(u8 windowId, u8 fontId, u8 left, u8 top, u8 a4, u8 itemCount, u8 itemCount2, const struct MenuAction *strs, const u8 *a8);
u8 sub_8199944(u8 windowId, u8 optionWidth, u8 horizontalCount, u8 verticalCount, u8 initialCursorPos);
u8 sub_8199134(s8, s8);
u8 GetStartMenuWindowId(void);
void sub_819A2BC(u8, u8);

View File

@ -776,6 +776,23 @@ extern const u8 gText_TeachWhichMoveToPkmn[];
extern const u8 gText_GiveUpTeachingNewMove[];
extern const u8 gText_TeachX[];
extern const u8 gText_DadsAdvice[];
extern const u8 gText_CantDismountBike[];
extern const u8 gText_ItemFinderNothing[];
extern const u8 gText_ItemFinderNearby[];
extern const u8 gText_ItemFinderOnTop[];
extern const u8 gText_CoinCase[];
extern const u8 gText_PowderQty[];
extern const u8 gText_BootedUpHM[];
extern const u8 gText_BootedUpTM[];
extern const u8 gText_TMHMContainedVar1[];
extern const u8 gText_PlayerUsedVar2[];
extern const u8 gText_RepelEffectsLingered[];
extern const u8 gText_UsedVar2WildLured[];
extern const u8 gText_UsedVar2WildRepelled[];
extern const u8 gText_BoxFull[];
extern const u8 gText_WontHaveEffect[];
extern const u8 gText_LevelSymbol[];
extern const u8 gText_PkmnInfo[];
extern const u8 gText_PkmnSkills[];
@ -824,4 +841,6 @@ extern const u8 gText_RibbonsVar1[];
extern const u8 gText_OneDash[];
extern const u8 gText_TwoDashes[];
extern const u8 *const gReturnToXStringsTable2[];
#endif //GUARD_STRINGS_H

View File

@ -2810,23 +2810,16 @@ static void CalcDomeMonStats(u16 species, s32 level, s32 ivs, u8 evBits, u8 natu
CALC_STAT(baseSpDefense, STAT_SPDEF);
}
#define SWAP_16(x, y) \
{ \
temp = x; \
x = y; \
y = temp; \
}
static void SwapDomeTrainers(s32 id1, s32 id2, u16 *statsArray)
{
s32 i;
u16 temp;
SWAP_16(statsArray[id1], statsArray[id2]);
SWAP_16(gSaveBlock2Ptr->frontier.domeTrainers[id1].trainerId, gSaveBlock2Ptr->frontier.domeTrainers[id2].trainerId);
SWAP(statsArray[id1], statsArray[id2], temp);
SWAP(gSaveBlock2Ptr->frontier.domeTrainers[id1].trainerId, gSaveBlock2Ptr->frontier.domeTrainers[id2].trainerId, temp);
for (i = 0; i < 3; i++)
SWAP_16(gSaveBlock2Ptr->frontier.domeMonId[id1][i], gSaveBlock2Ptr->frontier.domeMonId[id2][i]);
SWAP(gSaveBlock2Ptr->frontier.domeMonId[id1][i], gSaveBlock2Ptr->frontier.domeMonId[id2][i], temp);
}
static void sub_818F9B0(void)

View File

@ -4596,13 +4596,10 @@ static void sub_803CDF8(void)
void SwapTurnOrder(u8 id1, u8 id2)
{
u32 temp = gActionsByTurnOrder[id1];
gActionsByTurnOrder[id1] = gActionsByTurnOrder[id2];
gActionsByTurnOrder[id2] = temp;
u32 temp;
temp = gBattlerByTurnOrder[id1];
gBattlerByTurnOrder[id1] = gBattlerByTurnOrder[id2];
gBattlerByTurnOrder[id2] = temp;
SWAP(gActionsByTurnOrder[id1], gActionsByTurnOrder[id2], temp);
SWAP(gBattlerByTurnOrder[id1], gBattlerByTurnOrder[id2], temp);
}
u8 GetWhoStrikesFirst(u8 battler1, u8 battler2, bool8 ignoreChosenMoves)

File diff suppressed because it is too large Load Diff

View File

@ -752,9 +752,8 @@ u16 BagGetQuantityByPocketPosition(u8 pocketId, u16 pocketPos)
static void SwapItemSlots(struct ItemSlot *a, struct ItemSlot *b)
{
struct ItemSlot temp = *a;
*a = *b;
*b = temp;
struct ItemSlot temp;
SWAP(*a, *b, temp);
}
void CompactItemsInBagPocket(struct BagPocket *bagPocket)

View File

@ -29,44 +29,26 @@
#include "string_util.h"
#include "task.h"
#include "text.h"
#include "strings.h"
#include "pokeblock.h"
#include "menu.h"
#include "item_menu.h"
extern void(**gUnknown_0203CE54)(void);
extern void(**gUnknown_0203CF2C)(void);
extern void(*gUnknown_0203A0F4)(u8 taskId);
extern void(*gUnknown_085920D8[])(void);
extern void (*gUnknown_03006328)(u8, u16, TaskFunc);
extern void unknown_ItemMenu_Confirm(u8 taskId);
extern void sub_81C5B14(u8 taskId);
extern u8 gText_DadsAdvice[];
extern u8 gText_CantDismountBike[];
extern void sub_8197434(u8 a, u8 b);
extern void ScriptUnfreezeEventObjects(void);
extern void ItemUseOutOfBattle_TMHM(u8 a);
extern void ItemUseOutOfBattle_EvolutionStone(u8 b);
extern void bag_menu_mail_related(void);
extern void OpenPokeblockCase(u8 a, void(*b)(void));
extern void overworld_free_bg_tilemaps(void);
extern bool32 Overworld_IsBikingAllowed(void);
extern bool8 IsPlayerFacingSurfableFishableWater(void);
extern bool8 sub_81221AC(void);
extern u8 gText_ItemFinderNothing[];
extern u8 gText_ItemFinderNearby[];
extern u8 gText_ItemFinderOnTop[];
extern u8 gText_CoinCase[];
extern u8 gText_PowderQty[];
extern u8 gUnknown_085920E4[];
extern u8 Route102_EventScript_274482[];
extern u8 Route102_EventScript_2744C0[];
extern u8 BattleFrontier_OutsideEast_EventScript_242CFC[];
extern u8 gText_BootedUpHM[];
extern u8 gText_BootedUpTM[];
extern u8 gText_TMHMContainedVar1[];
extern u8 gText_PlayerUsedVar2[];
extern u8 gText_RepelEffectsLingered[];
extern u8 gText_UsedVar2WildLured[];
extern u8 gText_UsedVar2WildRepelled[];
extern u8 gText_BoxFull[];
extern u8 gText_WontHaveEffect[];
extern int sub_80247BC(void);
extern struct MapHeader* mapconnection_get_mapheader(struct MapConnection *connection);
extern void SetUpItemUseCallback(u8 taskId);
@ -86,7 +68,6 @@ extern void sub_81C59BC(void);
extern void sub_81AB9A8(u8);
extern void sub_81ABA88(u8);
extern void sub_80B7CC8(void);
extern void Overworld_ResetStateAfterDigEscRope(void);
extern u8* sub_806CF78(u16);
extern void sub_81B89F0(void);
extern u8 GetItemEffectType(u16);
@ -115,8 +96,7 @@ void sub_80FE124(u8 taskId);
void sub_80FE164(u8 taskId);
void DisplayItemMessage(u8 taskId, u8 a, const u8* str, void(*callback)(u8 taskId));
void DisplayItemMessageInBattlePyramid(u8 taskId, u8* str, void(*callback)(u8 taskId));
void DisplayItemMessageOnField(u8 taskId, u8* str, void(*callback)(u8 taskId));
void DisplayItemMessageOnField(u8 taskId, const u8* str, void(*callback)(u8 taskId));
void sub_81C6714(u8 taskId);
void CleanUpAfterFailingToUseRegisteredKeyItemOnField(u8 taskId);
void StartFishing(u8 a);
@ -137,7 +117,7 @@ void SetUpItemUseCallback(u8 taskId)
type = ItemId_GetType(gSpecialVar_ItemId) - 1;
if (!InBattlePyramid())
{
*gUnknown_0203CE54 = gUnknown_085920D8[type];
gUnknown_0203CE54->unk0 = gUnknown_085920D8[type];
unknown_ItemMenu_Confirm(taskId);
}
else
@ -221,7 +201,7 @@ void sub_80FD254()
void ItemUseOutOfBattle_Mail(u8 taskId)
{
*gUnknown_0203CE54 = sub_80FD254;
gUnknown_0203CE54->unk0 = sub_80FD254;
unknown_ItemMenu_Confirm(taskId);
}
@ -617,7 +597,7 @@ void ItemUseOutOfBattle_PokeblockCase(u8 taskId)
}
else if (gTasks[taskId].data[3] != TRUE)
{
*gUnknown_0203CE54 = sub_80FDBEC;
gUnknown_0203CE54->unk0 = sub_80FDBEC;
unknown_ItemMenu_Confirm(taskId);
}
else
@ -679,7 +659,7 @@ void sub_80FDD10(u8 taskId)
{
gUnknown_0203A0F4 = sub_80FDD74;
gFieldCallback = MapPostLoadHook_UseItem;
*gUnknown_0203CE54 = CB2_ReturnToField;
gUnknown_0203CE54->unk0 = CB2_ReturnToField;
unknown_ItemMenu_Confirm(taskId);
}
else
@ -1002,7 +982,7 @@ void sub_80FE54C(u8 taskId)
{
if (!InBattlePyramid())
{
*gUnknown_0203CE54 = sub_81B89F0;
gUnknown_0203CE54->unk0 = sub_81B89F0;
unknown_ItemMenu_Confirm(taskId);
}
else