mirror of
https://github.com/pret/pokeruby.git
synced 2024-12-11 23:03:53 +00:00
decompile menu_helpers
This commit is contained in:
parent
a0e590b739
commit
36841bbd93
1339
asm/menu_helpers.s
1339
asm/menu_helpers.s
File diff suppressed because it is too large
Load Diff
@ -289,16 +289,6 @@ extern u8 sub_8134194(u8); // src/decoration_inventory
|
||||
extern bool8 sub_81341D4(void); // src/decoration_inventory
|
||||
extern void sub_8134104(u8); // src/decoration_inventory
|
||||
extern bool8 sub_807D770(void);
|
||||
extern void sub_80F944C(void); // src/menu_helpers
|
||||
extern void sub_80F9480(u8 *, u8); // src/menu_helpers
|
||||
extern void sub_80F94A4(u8, u8 *, u8, s16); // src/menu_helpers
|
||||
extern void sub_80F94F8(u8 *); // src/menu_helpers
|
||||
extern void sub_80F9520(u8 *, u8); // src/menu_helpers
|
||||
extern void DestroyVerticalScrollIndicator(u8); // src/menu_helpers
|
||||
extern void CreateVerticalScrollIndicators(u8, u8, u8); // src/menu_helpers
|
||||
extern void LoadScrollIndicatorPalette(void); // src/menu_helpers
|
||||
extern void DisplayItemMessageOnField(u8, const u8 *, TaskFunc, u16); // src/menu_helpers
|
||||
extern void BuyMenuFreeMemory(void); // src/menu_helpers
|
||||
extern void sub_8109DAC(u8); // src/trader
|
||||
extern void ReshowPlayerPC(u8); // src/player_pc
|
||||
|
||||
|
@ -9,22 +9,31 @@ struct YesNoFuncTable
|
||||
void (*noFunc)(u8);
|
||||
};
|
||||
|
||||
void sub_80F9020(void);
|
||||
void DisplayItemMessageOnField(u8, const u8 *, TaskFunc, u16);
|
||||
void DoYesNoFuncWithChoice(u8, const struct YesNoFuncTable *);
|
||||
void sub_80F914C(u8, const struct YesNoFuncTable *);
|
||||
void DisplayItemMessageOnField(u8, const u8 *, TaskFunc, u16);
|
||||
u8 sub_80F9284(void);
|
||||
u8 sub_80F92BC(void);
|
||||
bool8 sub_80F92F4(u16);
|
||||
bool8 sub_80F931C(u16);
|
||||
bool8 sub_80F9344(void);
|
||||
u8 sub_80F9344(void);
|
||||
void sub_80F9368(void);
|
||||
void sub_80F9438(void);
|
||||
void sub_80F944C(void);
|
||||
void CreateVerticalScrollIndicators(u8, u8, u8); // include/decoration.h
|
||||
void sub_80F979C(u32, u32); // unknown args
|
||||
void sub_80F9480(u8 *, u8);
|
||||
void sub_80F94A4(u8, u8 *, s16, s16);
|
||||
void sub_80F94F8(u8 *);
|
||||
void sub_80F9520(u8 *, u8);
|
||||
void CreateVerticalScrollIndicators(u8, u16, u16);
|
||||
void sub_80F979C(u8, bool8);
|
||||
void DestroyVerticalScrollIndicator(u8);
|
||||
void BuyMenuFreeMemory(void);
|
||||
void sub_80F98DC(int);
|
||||
void sub_80F996C(u8);
|
||||
void LoadScrollIndicatorPalette(void);
|
||||
void BuyMenuFreeMemory(void);
|
||||
void sub_80F98A4(u8);
|
||||
void StartVerticalScrollIndicators(u8);
|
||||
void sub_80F98DC(u8);
|
||||
void PauseVerticalScrollIndicator(u8);
|
||||
void sub_80F9988(u8, u8);
|
||||
|
||||
#endif // GUARD_MENU_HELPERS_H
|
||||
|
@ -172,7 +172,7 @@ SECTIONS {
|
||||
src/sound_check_menu.o(.text);
|
||||
src/secret_base.o(.text);
|
||||
asm/secret_base.o(.text_80BC1D0);
|
||||
src/tv.o(.text);
|
||||
src/tv.o(.text);
|
||||
asm/contest_link_80C2020.o(.text);
|
||||
src/script_pokemon_util_80C4BF0.o(.text);
|
||||
src/field_poison.o(.text);
|
||||
@ -195,7 +195,7 @@ SECTIONS {
|
||||
src/mauville_old_man.o(.text);
|
||||
asm/mauville_old_man.o(.text);
|
||||
src/mail.o(.text);
|
||||
asm/menu_helpers.o(.text);
|
||||
src/menu_helpers.o(.text);
|
||||
src/script_pokemon_util_80F99CC.o(.text);
|
||||
src/dewford_trend.o(.text);
|
||||
src/heal_location.o(.text);
|
||||
|
478
src/menu_helpers.c
Normal file
478
src/menu_helpers.c
Normal file
@ -0,0 +1,478 @@
|
||||
#include "global.h"
|
||||
#include "item_menu.h"
|
||||
#include "items.h"
|
||||
#include "link.h"
|
||||
#include "mail_data.h"
|
||||
#include "main.h"
|
||||
#include "map_constants.h"
|
||||
#include "menu.h"
|
||||
#include "menu_helpers.h"
|
||||
#include "rom4.h"
|
||||
#include "songs.h"
|
||||
#include "sound.h"
|
||||
#include "sprite.h"
|
||||
#include "task.h"
|
||||
#include "text.h"
|
||||
|
||||
extern u8 gUnknown_020388C0[4];
|
||||
extern struct YesNoFuncTable gUnknown_020388C4;
|
||||
|
||||
extern TaskFunc gUnknown_0300074C;
|
||||
|
||||
extern struct SpritePalette gUnknown_083E5968;
|
||||
|
||||
extern struct SpriteTemplate gSpriteTemplate_83E59D0;
|
||||
extern struct SpriteTemplate gSpriteTemplate_83E59E8;
|
||||
extern struct SpriteTemplate gSpriteTemplate_83E5A00;
|
||||
|
||||
extern const u8 gUnknown_083E5A18[];
|
||||
extern const u8 gUnknown_083E5A1C[];
|
||||
|
||||
void sub_80F9020(void)
|
||||
{
|
||||
memset(&gBGTilemapBuffers[1], 0, 0x800);
|
||||
memset(&gBGTilemapBuffers[2], 0, 0x800);
|
||||
memset(&gBGTilemapBuffers[3], 0, 0x800);
|
||||
}
|
||||
|
||||
// display message box, fill box with tile if tile is not zero, print string
|
||||
static void PrintMessage(const u8 *str, u16 tile)
|
||||
{
|
||||
MenuDisplayMessageBox();
|
||||
if (tile)
|
||||
{
|
||||
sub_80A3FA0(&gBGTilemapBuffers[1][0], 2, 15, 26, 4, tile);
|
||||
}
|
||||
sub_8072044(str);
|
||||
}
|
||||
|
||||
static void sub_80F9090(u8 taskId)
|
||||
{
|
||||
if (MenuUpdateWindowText() == TRUE)
|
||||
{
|
||||
gUnknown_0300074C(taskId);
|
||||
}
|
||||
}
|
||||
|
||||
void DisplayItemMessageOnField(u8 taskId, const u8 *str, TaskFunc callback, u16 tile)
|
||||
{
|
||||
PrintMessage(str, tile);
|
||||
gUnknown_0300074C = callback;
|
||||
gTasks[taskId].func = sub_80F9090;
|
||||
}
|
||||
|
||||
static void Task_CallYesOrNoCallback(u8 taskId)
|
||||
{
|
||||
switch (ProcessMenuInputNoWrap_())
|
||||
{
|
||||
case 0:
|
||||
PlaySE(SE_SELECT);
|
||||
gUnknown_020388C4.yesFunc(taskId);
|
||||
break;
|
||||
case 1:
|
||||
case -1:
|
||||
PlaySE(SE_SELECT);
|
||||
gUnknown_020388C4.noFunc(taskId);
|
||||
}
|
||||
}
|
||||
|
||||
void DoYesNoFuncWithChoice(u8 taskId, const struct YesNoFuncTable *funcTable)
|
||||
{
|
||||
gUnknown_020388C4 = *funcTable;
|
||||
gTasks[taskId].func = Task_CallYesOrNoCallback;
|
||||
}
|
||||
|
||||
static void PrintStringWithPalette(const u8 *str, u8 paletteNum, u8 left, u8 top)
|
||||
{
|
||||
u8 paletteStr[4];
|
||||
|
||||
memcpy(paletteStr, gUnknown_083E5A18, 4);
|
||||
|
||||
if (paletteNum != 0xFF)
|
||||
{
|
||||
paletteStr[2] = paletteNum;
|
||||
StringCopy(gStringVar4, paletteStr);
|
||||
StringAppend(gStringVar4, str);
|
||||
paletteStr[2] = gMenuWindowPtr->paletteNum;
|
||||
StringAppend(gStringVar4, paletteStr);
|
||||
}
|
||||
else
|
||||
{
|
||||
StringCopy(gStringVar4, str);
|
||||
}
|
||||
|
||||
MenuPrint(gStringVar4, left, top);
|
||||
}
|
||||
|
||||
// unused
|
||||
void PrintNumberWithPalette(s32 value, u8 paletteNum, u8 n, u8 mode, u8 left, u8 top)
|
||||
{
|
||||
ConvertIntToDecimalStringN(gStringVar1, value, mode, n);
|
||||
if (paletteNum != 0xFF)
|
||||
{
|
||||
PrintStringWithPalette(gStringVar1, paletteNum, left, top);
|
||||
}
|
||||
else
|
||||
{
|
||||
MenuPrint(gStringVar1, left, top);
|
||||
}
|
||||
}
|
||||
|
||||
// unused
|
||||
void PrintTriangleCursorWithPalette(u8 left, u8 top, u8 paletteNum)
|
||||
{
|
||||
u8 buffer[2];
|
||||
memcpy(buffer, gUnknown_083E5A1C, 2);
|
||||
PrintStringWithPalette(buffer, paletteNum, left, top);
|
||||
}
|
||||
|
||||
u8 sub_80F9284(void)
|
||||
{
|
||||
if (gSaveBlock2.optionsButtonMode == OPTIONS_BUTTON_MODE_LR)
|
||||
{
|
||||
if (gMain.newKeys & L_BUTTON)
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
if (gMain.newKeys & R_BUTTON)
|
||||
{
|
||||
return 2;
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
u8 sub_80F92BC(void)
|
||||
{
|
||||
if (gSaveBlock2.optionsButtonMode == OPTIONS_BUTTON_MODE_LR)
|
||||
{
|
||||
if (gMain.newAndRepeatedKeys & L_BUTTON)
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
if (gMain.newAndRepeatedKeys & R_BUTTON)
|
||||
{
|
||||
return 2;
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
bool8 sub_80F92F4(u16 itemId)
|
||||
{
|
||||
if (itemId != ITEM_ENIGMA_BERRY)
|
||||
{
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
if (!(gSaveBlock1.location.mapGroup == MAP_GROUP_TRADE_CENTER && gSaveBlock1.location.mapNum == MAP_ID_TRADE_CENTER))
|
||||
{
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
bool8 sub_80F931C(u16 itemId)
|
||||
{
|
||||
if (is_c1_link_related_active() != TRUE)
|
||||
{
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
if (ItemIsMail(itemId) != TRUE)
|
||||
{
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
bool8 sub_80F9344(void)
|
||||
{
|
||||
if (is_c1_link_related_active() == TRUE || gReceivedRemoteLinkPlayers == 1)
|
||||
{
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
void sub_80F9368(void)
|
||||
{
|
||||
u8 *addr;
|
||||
u32 size;
|
||||
|
||||
REG_DISPCNT = 0;
|
||||
REG_BG3CNT = 0;
|
||||
REG_BG2CNT = 0;
|
||||
REG_BG1CNT = 0;
|
||||
REG_BG0CNT = 0;
|
||||
REG_BG3HOFS = 0;
|
||||
REG_BG3VOFS = 0;
|
||||
REG_BG2HOFS = 0;
|
||||
REG_BG2VOFS = 0;
|
||||
REG_BG1HOFS = 0;
|
||||
REG_BG1VOFS = 0;
|
||||
REG_BG0HOFS = 0;
|
||||
REG_BG0VOFS = 0;
|
||||
|
||||
addr = (u8 *)VRAM;
|
||||
size = 0x18000;
|
||||
while (1)
|
||||
{
|
||||
DmaFill16(3, 0, addr, 0x1000);
|
||||
addr += 0x1000;
|
||||
size -= 0x1000;
|
||||
if (size <= 0x1000)
|
||||
{
|
||||
DmaFill16(3, 0, addr, size);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
DmaClear32(3, OAM, OAM_SIZE);
|
||||
DmaClear16(3, PLTT, PLTT_SIZE);
|
||||
}
|
||||
|
||||
void sub_80F9438(void)
|
||||
{
|
||||
SetVBlankCallback(NULL);
|
||||
SetHBlankCallback(NULL);
|
||||
}
|
||||
|
||||
void sub_80F944C(void)
|
||||
{
|
||||
u8 i;
|
||||
|
||||
for (i = 0; i < 4; i++)
|
||||
{
|
||||
gUnknown_020388C0[i] = 0xFF;
|
||||
}
|
||||
|
||||
FreeSpritePaletteByTag(6);
|
||||
LoadSpritePalette(&gUnknown_083E5968);
|
||||
}
|
||||
|
||||
void sub_80F9480(u8 *data, u8 n)
|
||||
{
|
||||
u8 i;
|
||||
|
||||
for (i = 0; i < n; i++)
|
||||
{
|
||||
data[i] = 0xFF;
|
||||
}
|
||||
}
|
||||
|
||||
void sub_80F94A4(u8 animNum, u8 *spriteId, s16 x, s16 y)
|
||||
{
|
||||
if (animNum <= 5)
|
||||
{
|
||||
if (*spriteId == 0xFF)
|
||||
{
|
||||
*spriteId = CreateSprite(&gSpriteTemplate_83E5A00, x, y, 0);
|
||||
}
|
||||
animNum -= 4;
|
||||
StartSpriteAnim(&gSprites[*spriteId], animNum);
|
||||
}
|
||||
}
|
||||
|
||||
void sub_80F94F8(u8 *spriteId)
|
||||
{
|
||||
if (*spriteId != 0xFF)
|
||||
{
|
||||
DestroySprite(&gSprites[*spriteId]);
|
||||
*spriteId = 0xFF;
|
||||
}
|
||||
}
|
||||
|
||||
void sub_80F9520(u8 *data, u8 n)
|
||||
{
|
||||
u8 i;
|
||||
|
||||
for (i = 0; i < 8; i++)
|
||||
{
|
||||
sub_80F94F8(&data[i]);
|
||||
}
|
||||
}
|
||||
|
||||
void CreateVerticalScrollIndicators(u8 id, u16 x, u16 y)
|
||||
{
|
||||
if (id >= 4)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
switch (id)
|
||||
{
|
||||
case 0:
|
||||
if (gUnknown_020388C0[0] == 0xFF)
|
||||
{
|
||||
gUnknown_020388C0[0] = CreateSprite(&gSpriteTemplate_83E59D0, x, y, 0);
|
||||
gSprites[gUnknown_020388C0[0]].data2 = -1;
|
||||
if (gUnknown_020388C0[1] != 0xFF)
|
||||
{
|
||||
gSprites[gUnknown_020388C0[0]].pos2.y = gSprites[gUnknown_020388C0[1]].pos2.y * -1;
|
||||
gSprites[gUnknown_020388C0[0]].data3 = gSprites[gUnknown_020388C0[1]].data3;
|
||||
}
|
||||
else
|
||||
{
|
||||
gSprites[gUnknown_020388C0[0]].data3 = 0;
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case 1:
|
||||
if (gUnknown_020388C0[1] == 0xFF)
|
||||
{
|
||||
gUnknown_020388C0[1] = CreateSprite(&gSpriteTemplate_83E59D0, x, y, 0);
|
||||
gSprites[gUnknown_020388C0[1]].data2 = 1;
|
||||
if (gUnknown_020388C0[0] != 0xFF)
|
||||
{
|
||||
gSprites[gUnknown_020388C0[1]].pos2.y = gSprites[gUnknown_020388C0[0]].pos2.y * -1;
|
||||
gSprites[gUnknown_020388C0[1]].data3 = gSprites[gUnknown_020388C0[0]].data3;
|
||||
}
|
||||
else
|
||||
{
|
||||
gSprites[gUnknown_020388C0[1]].data3 = 0;
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case 2:
|
||||
if (gUnknown_020388C0[2] == 0xFF)
|
||||
{
|
||||
gUnknown_020388C0[2] = CreateSprite(&gSpriteTemplate_83E59E8, x, y, 0);
|
||||
gSprites[gUnknown_020388C0[2]].data0 = -1;
|
||||
if (gUnknown_020388C0[3] != 0xFF)
|
||||
{
|
||||
gSprites[gUnknown_020388C0[2]].pos2.x = gSprites[gUnknown_020388C0[3]].pos2.x * -1;
|
||||
gSprites[gUnknown_020388C0[2]].data1 = gSprites[gUnknown_020388C0[3]].data1;
|
||||
}
|
||||
else
|
||||
{
|
||||
gSprites[gUnknown_020388C0[2]].data1 = 0;
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case 3:
|
||||
if (gUnknown_020388C0[3] == 0xFF)
|
||||
{
|
||||
gUnknown_020388C0[3] = CreateSprite(&gSpriteTemplate_83E59E8, x, y, 0);
|
||||
gSprites[gUnknown_020388C0[3]].data0 = 1;
|
||||
if (gUnknown_020388C0[2] != 0xFF)
|
||||
{
|
||||
gSprites[gUnknown_020388C0[3]].pos2.x = gSprites[gUnknown_020388C0[2]].pos2.x * -1;
|
||||
gSprites[gUnknown_020388C0[3]].data1 = gSprites[gUnknown_020388C0[2]].data1;
|
||||
}
|
||||
else
|
||||
{
|
||||
gSprites[gUnknown_020388C0[3]].data1 = 0;
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
StartSpriteAnim(&gSprites[gUnknown_020388C0[id]], id & 1);
|
||||
}
|
||||
|
||||
void sub_80F979C(u8 id, bool8 invisible)
|
||||
{
|
||||
if (id < 4 && gUnknown_020388C0[id] != 0xFF)
|
||||
{
|
||||
gSprites[gUnknown_020388C0[id]].invisible = invisible;
|
||||
}
|
||||
}
|
||||
|
||||
void DestroyVerticalScrollIndicator(u8 id)
|
||||
{
|
||||
if (id < 4 && gUnknown_020388C0[id] != 0xFF)
|
||||
{
|
||||
DestroySprite(&gSprites[gUnknown_020388C0[id]]);
|
||||
gUnknown_020388C0[id] = 0xFF;
|
||||
}
|
||||
}
|
||||
|
||||
void LoadScrollIndicatorPalette(void)
|
||||
{
|
||||
LoadSpritePalette(&gUnknown_083E5968);
|
||||
}
|
||||
|
||||
void BuyMenuFreeMemory(void)
|
||||
{
|
||||
FreeSpritePaletteByTag(6);
|
||||
}
|
||||
|
||||
void sub_80F9834(struct Sprite *sprite)
|
||||
{
|
||||
if (sprite->data1 == 0)
|
||||
{
|
||||
sprite->pos2.x += sprite->data0;
|
||||
}
|
||||
if (sprite->data3 == 0)
|
||||
{
|
||||
sprite->pos2.y += sprite->data2;
|
||||
}
|
||||
sprite->data1++;
|
||||
sprite->data3++;
|
||||
if (sprite->data1 > 2)
|
||||
{
|
||||
sprite->data1 = 0;
|
||||
}
|
||||
if (sprite->data3 > 2)
|
||||
{
|
||||
sprite->data3 = 0;
|
||||
}
|
||||
if (sprite->pos2.x == 8 || sprite->pos2.x == -8)
|
||||
{
|
||||
sprite->pos2.x = 0;
|
||||
}
|
||||
if (sprite->pos2.y == 8 || sprite->pos2.y == -8)
|
||||
{
|
||||
sprite->pos2.y = 0;
|
||||
}
|
||||
}
|
||||
|
||||
void sub_80F98A4(u8 id)
|
||||
{
|
||||
if (gUnknown_020388C0[id] != 0xFF && id < 4)
|
||||
{
|
||||
gSprites[gUnknown_020388C0[id]].callback = SpriteCallbackDummy;
|
||||
}
|
||||
}
|
||||
|
||||
void StartVerticalScrollIndicators(u8 id)
|
||||
{
|
||||
if (gUnknown_020388C0[id] != 0xFF && id < 4)
|
||||
{
|
||||
gSprites[gUnknown_020388C0[id]].callback = sub_80F9834;
|
||||
}
|
||||
}
|
||||
|
||||
static void sub_80F9914(u8 id)
|
||||
{
|
||||
if (gUnknown_020388C0[id] != 0xFF && id < 4)
|
||||
{
|
||||
gSprites[gUnknown_020388C0[id]].pos2.x = 0;
|
||||
gSprites[gUnknown_020388C0[id]].pos2.y = 0;
|
||||
gSprites[gUnknown_020388C0[id]].data1 = 0;
|
||||
gSprites[gUnknown_020388C0[id]].data3 = 0;
|
||||
}
|
||||
}
|
||||
|
||||
void PauseVerticalScrollIndicator(u8 id)
|
||||
{
|
||||
sub_80F98A4(id);
|
||||
sub_80F9914(id);
|
||||
}
|
||||
|
||||
void sub_80F9988(u8 id, u8 priority)
|
||||
{
|
||||
if (gUnknown_020388C0[id] != 0xFF && id < 4)
|
||||
{
|
||||
gSprites[gUnknown_020388C0[id]].oam.priority = priority;
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user