better names and clean things up

This commit is contained in:
Seth Barberee 2022-07-31 15:40:44 -07:00
parent c2b4b21ec4
commit 107bef8fcd
18 changed files with 106 additions and 96 deletions

View File

@ -10,7 +10,7 @@ struct unkStruct_203B204
// size: 0x108
u32 unk0;
s32 currState;
u32 unk8;
u32 fallbackState;
u32 chosenAmount;
u32 unk10;
struct MenuItem unk14[8];

View File

@ -20,6 +20,8 @@ void PlayFanfareSE(u16 songIndex, u16 volume);
void StopFanfareSE(u16 songIndex);
void FadeOutFanfareSE(u16 songIndex, u16 speed);
bool8 IsFanfareSEPlaying(u16 songIndex);
void SoundBiasReset(void);
void SoundBiasSet(void);
void nullsub_19(void);
void nullsub_20(u16 songIndex);

15
include/text_util.h Normal file
View File

@ -0,0 +1,15 @@
#ifndef GUARD_TEXT_UTIL_H
#define GUARD_TEXT_UTIL_H
void sub_80922B4(u8 *buffer, u8 *string, s32 size);
u32 sub_80922E4(u32 r0);
void CopyStringtoBuffer(u8 *buffer, u8 *string);
void BoundedCopyStringtoBuffer(u8 *buffer, u8 *string, s32 size);
const char *GetUnformattedTypeString(u8 type);
const char * GetFormattedTypeString(u8 type);
u8 sub_8092354(u8 index);
u8 sub_8092364(u8 index);
void CopyAbilityNametoBuffer(char *buffer, u8 index);
u8 *GetAbilityDescription(u8 index);
#endif

View File

@ -3,9 +3,7 @@
#include "gba/gba.h"
#include "config.h"
#include "global.h"
extern void SoundBiasReset(void);
extern void SoundBiasSet(void);
#include "music.h"
extern u32 gUnknown_202DB60[2];
extern u16 gUnknown_202DB30[2][8];

View File

@ -11,6 +11,7 @@
#include "pokemon.h"
#include "weather.h"
#include "gUnknown_203B46C.h"
#include "text_util.h"
extern struct UnkSaveStruct1 *gUnknown_203B46C;
@ -30,7 +31,6 @@ extern u8 *gUnknown_80FCC7C[];
extern u8 *gUnknown_80FCCAC[];
extern u8 *gUnknown_80FDCC8[];
extern u8* GetUnformattedTypeString(s16);
extern void SetMessageArgument(char[], struct DungeonEntity*, u32);
void sub_80522F4(struct DungeonEntity *r0, struct DungeonEntity *r1, const char r2[]);
extern void sub_8042900(struct DungeonEntity *r0);

View File

@ -100,7 +100,7 @@ void sub_8016B00(void)
s32 auStack8;
if (sub_80144A4(&auStack8) == 0) {
UpdateFelicityBankState(gUnknown_203B204->unk8);
UpdateFelicityBankState(gUnknown_203B204->fallbackState);
}
}
@ -109,7 +109,7 @@ void sub_8016B24(void)
s32 auStack8;
if (sub_80144A4(&auStack8) == 4) {
UpdateFelicityBankState(gUnknown_203B204->unk8);
UpdateFelicityBankState(gUnknown_203B204->fallbackState);
}
}

View File

@ -9,6 +9,7 @@
#include "subStruct_203B240.h"
#include "team_inventory.h"
#include "code_800D090.h"
#include "text_util.h"
#include <stddef.h>
@ -42,9 +43,8 @@ extern s32 sub_8090FEC(s32 a1, u8* a2, u8 a3);
extern void sub_80073B8(u32);
extern u32 sub_8097DF0(char *, struct subStruct_203B240 **);
extern void sub_80078A4(u32, u32, u32, u32, u32);
extern u8* GetUnformattedTypeString(s16);
extern void sub_80073E0(u32);
extern void xxx_format_and_draw(u32, u32, u8 *, u32, u32);
extern void xxx_format_and_draw(u32, u32, const u8 *, u32, u32);
extern s32 sub_8091E94(s32 a1, s32 a2, s32 a3);
extern void xxx_sort_inv_unk230_80918EC();
bool8 xxx_insert_unk250_8091C1C(u8);
@ -701,7 +701,7 @@ u32 sub_80913E0(struct ItemSlot* slot, u32 a2, struct subStruct_203B240 ** a3)
struct PokemonMove *buffer8 = (struct PokemonMove*) (buffer88 + 0x50); // field in struct
u16 move = GetItemMove(slot->itemIndex);
u8 moves_data;
u8* typestring;
const u8* typestring;
u32 result;
InitPokemonMove(buffer8, move);

View File

@ -111,13 +111,13 @@ void sub_80177F8(void)
void sub_8017828(void)
{
s32 local_8;
s32 menuAction;
if (sub_80144A4(&local_8) == 0) {
if (local_8 != 1) {
gUnknown_203B208->unk18 = local_8;
if (sub_80144A4(&menuAction) == 0) {
if (menuAction != 1) {
gUnknown_203B208->unk18 = menuAction;
}
switch(local_8)
switch(menuAction)
{
case 2:
if (GetNumberOfFilledInventorySlots() == 0) {
@ -158,10 +158,10 @@ void sub_8017828(void)
void sub_80178D0(void)
{
s32 local_18;
s32 menuAction;
if (sub_80144A4(&local_18) == 0) {
switch(local_18)
if (sub_80144A4(&menuAction) == 0) {
switch(menuAction)
{
case 4:
MoveToStorage(&gUnknown_203B208->unkC);
@ -179,25 +179,25 @@ void sub_80178D0(void)
void sub_8017928(void)
{
int local_c;
int menuAction;
u32 itemindex;
u32 numItems;
struct HeldItem_Alt local_8;
struct HeldItem_Alt item;
if (sub_80144A4(&local_c) == 0) {
switch(local_c)
if (sub_80144A4(&menuAction) == 0) {
switch(menuAction)
{
case 4:
gTeamInventory_203B460->teamStorage[gUnknown_203B208->unkC.itemIndex] -= gUnknown_203B208->unkC.numItems;
itemindex = gUnknown_203B208->unkC.itemIndex;
local_8.temp.full_bits = (local_8.temp.full_bits & 0xffffff00) | itemindex;
item.temp.full_bits = (item.temp.full_bits & 0xffffff00) | itemindex;
numItems = gUnknown_203B208->unkC.numItems << 8;
local_8.temp.full_bits = (local_8.temp.full_bits & 0xffff00ff) | numItems;
item.temp.full_bits = (item.temp.full_bits & 0xffff00ff) | numItems;
AddHeldItemToInventory((struct HeldItem *)&local_8);
AddHeldItemToInventory((struct HeldItem *)&item);
UpdateKangaskhanStorageState(0x1d);
break;
case 1:
@ -211,10 +211,10 @@ void sub_8017928(void)
void sub_80179A8(void)
{
s32 iVar1;
s32 local_18;
s32 menuAction;
if (sub_80144A4(&local_18) == 0) {
switch(local_18)
if (sub_80144A4(&menuAction) == 0) {
switch(menuAction)
{
case 4:
for(iVar1 = 0; iVar1 < INVENTORY_SIZE; iVar1++)
@ -240,38 +240,38 @@ void sub_80179A8(void)
void sub_8017A1C(void)
{
u8 iVar2_u8;
u32 uVar4;
u8 itemID_u8;
u32 numItems_cast;
s32 itemID;
int local_18;
int menuAction;
u16 cast;
struct HeldItem_Alt local_14;
struct HeldItem_Alt item;
if (sub_80144A4(&local_18) == 0) {
if (sub_80144A4(&menuAction) == 0) {
switch(local_18)
switch(menuAction)
{
case 4:
for(itemID = 0; itemID < NUMBER_OF_ITEM_IDS; itemID++)
{
iVar2_u8 = itemID;
itemID_u8 = itemID;
if (sub_801CFE0(itemID) != 0) {
local_14.temp.full_bits = (local_14.temp.full_bits & 0xffffff00) | iVar2_u8;
if (IsThrowableItem(local_14.temp.norm.itemIndex)) {
uVar4 = gTeamInventory_203B460->teamStorage[local_14.temp.norm.itemIndex];
if (uVar4 > 99) {
local_14.temp.full_bits = (local_14.temp.full_bits & 0xffff00ff) | 0x6300;
item.temp.full_bits = (item.temp.full_bits & 0xffffff00) | itemID_u8;
if (IsThrowableItem(item.temp.norm.itemIndex)) {
numItems_cast = gTeamInventory_203B460->teamStorage[item.temp.norm.itemIndex];
if (numItems_cast > 99) {
item.temp.full_bits = (item.temp.full_bits & 0xffff00ff) | 0x6300;
}
else {
cast = uVar4 << 8;
local_14.temp.full_bits = (local_14.temp.full_bits & 0xffff00ff) | cast;
cast = numItems_cast << 8;
item.temp.full_bits = (item.temp.full_bits & 0xffff00ff) | cast;
}
}
else {
local_14.temp.full_bits = (local_14.temp.full_bits & 0xffff00ff) | 0x100;
item.temp.full_bits = (item.temp.full_bits & 0xffff00ff) | 0x100;
}
gTeamInventory_203B460->teamStorage[local_14.temp.norm.itemIndex] -= local_14.temp.norm.numItems;
AddHeldItemToInventory((struct HeldItem *)&local_14);
gTeamInventory_203B460->teamStorage[item.temp.norm.itemIndex] -= item.temp.norm.numItems;
AddHeldItemToInventory((struct HeldItem *)&item);
}
}
FillInventoryGaps();

View File

@ -130,20 +130,20 @@ void sub_80186F8(void)
{
struct HeldItem_Alt item;
u16 cast;
s32 iVar6;
u8 iVar6_32;
s32 itemID;
u8 itemID_u8;
switch(sub_801CA08(1))
{
case 3:
if(sub_801CFB8() != 0)
{
for(iVar6 = 0; iVar6 < NUMBER_OF_ITEM_IDS; iVar6++)
for(itemID = 0; itemID < NUMBER_OF_ITEM_IDS; itemID++)
{
iVar6_32 = iVar6; // dumb cast needed to match
if(sub_801CFE0(iVar6) != 0)
itemID_u8 = itemID; // dumb cast needed to match
if(sub_801CFE0(itemID) != 0)
{
item.temp.full_bits = (item.temp.full_bits & 0xffffff00) | iVar6_32;
item.temp.full_bits = (item.temp.full_bits & 0xffffff00) | itemID_u8;
if(IsThrowableItem(item.temp.norm.itemIndex))
if(gTeamInventory_203B460->teamStorage[item.temp.norm.itemIndex] > 0x63)
{
@ -244,17 +244,17 @@ void sub_8018854(void)
void sub_8018904(void)
{
s32 temp;
s32 menuAction;
temp = 0;
menuAction = 0;
sub_801A6E8(0);
if(sub_8012FD8(&gUnknown_203B20C->unk70) == 0)
{
sub_8013114(&gUnknown_203B20C->unk70, &temp);
if(temp != 1) gUnknown_203B20C->unk18 = temp;
sub_8013114(&gUnknown_203B20C->unk70, &menuAction);
if(menuAction != 1) gUnknown_203B20C->unk18 = menuAction;
}
switch(temp)
switch(menuAction)
{
case 2:
if(IsNotMoneyOrUsedTMItem(gUnknown_203B20C->unk8.itemIndex))
@ -290,19 +290,19 @@ void sub_8018904(void)
void sub_80189C8(void)
{
struct HeldItem_Alt item;
s32 temp;
s32 menuAction;
u32 itemsCast;
u32 indexCast;
temp = 0;
menuAction = 0;
sub_801CA08(0);
if(sub_8012FD8(&gUnknown_203B20C->unk70) == 0)
{
sub_8013114(&gUnknown_203B20C->unk70, &temp);
if(temp != 1) gUnknown_203B20C->unk1C = temp;
sub_8013114(&gUnknown_203B20C->unk70, &menuAction);
if(menuAction != 1) gUnknown_203B20C->unk1C = menuAction;
}
switch(temp)
switch(menuAction)
{
case 3:
if(GetNumberOfFilledInventorySlots() >= INVENTORY_SIZE)

View File

@ -5,21 +5,20 @@
#include "music.h"
#include "input.h"
#include "constants/bg_music.h"
#include "random.h"
extern bool8 EnableInterrupts(void);
extern bool8 DisableInterrupts(void);
extern void SoundBiasReset();
extern void SoundBiasSet();
extern void AckInterrupt(u16);
extern void nullsub_25(void);
void nullsub_18(void);
void UpdateSound(void);
void nullsub_21(u16);
extern void Random();
extern void sub_800BA5C();
void sub_800BA5C();
void xxx_update_bg_sound_input();
void SoundVSync();
void BlinkSavingIcon();
typedef void (*IntrCallback)(void);
extern IntrCallback gIntrCallbacks[];
@ -84,9 +83,6 @@ enum
NUM_BGS
};
void SoundVSync();
extern void BlinkSavingIcon();
void UnusedIntrFunc(void)
{
}

View File

@ -9,6 +9,7 @@
#include "memory.h"
#include "gUnknown_203B46C.h"
#include "text.h"
#include "text_util.h"
#include "menu.h"
enum
@ -46,7 +47,6 @@ extern void sub_8014248(const char *text, u32, u32, const struct MenuItem *r0, u
extern u32 sub_80144A4(s32 *);
extern void CopyStringtoBuffer(char *r0, char *r1);
extern void sub_801602C(u32, char *r0);
extern u32 sub_8016080(void);

View File

@ -3,6 +3,7 @@
#include "pokemon.h"
#include "file_system.h"
#include "item.h"
#include "input.h"
#include "sub_8095228.h"
#include "wonder_mail.h"
#include "memory.h"
@ -33,7 +34,6 @@ extern u32 sub_8095324(u32);
extern void sub_80141B4(const char *r0, u32, struct OpenedFile **r1, u32);
extern void nullsub_130(void);
extern void sub_8028348(void);
extern void ResetUnusedInputStruct();
extern void sub_803084C();
extern u32 sub_8030768(u32);
extern s8 sub_80307EC();
@ -69,7 +69,6 @@ extern s32 sub_8001658(u32, u32);
extern u8 sub_8099B94();
extern void sub_8099A5C(u32, u32, u32*);
extern void sub_8099AFC(u32, u32, u32*);
extern void ResetUnusedInputStruct();
extern void sub_8099690(u32);
extern void sub_8031E10(void);
extern void sub_803084C(void);

View File

@ -212,10 +212,10 @@ bool8 sub_802C4A4(void)
return TRUE;
}
u32 sub_802C4C8(int param_1,struct UnkTextStruct2_sub *param_2,u32 param_3)
bool8 sub_802C4C8(int param_1,struct UnkTextStruct2_sub *param_2,u32 param_3)
{
if (HasNoAcceptedJobs()) {
return 0;
return FALSE;
}
else
{
@ -238,7 +238,7 @@ u32 sub_802C4C8(int param_1,struct UnkTextStruct2_sub *param_2,u32 param_3)
sub_8013984(&gUnknown_203B2E8->unk8);
sub_802C6DC();
sub_802C750();
return 1;
return TRUE;
}
}
@ -418,16 +418,16 @@ bool8 HasNoAcceptedJobs(void)
for(index = 0; index < MAX_ACCEPTED_JOBS; index++)
{
if(!IsJobSlotEmpty(index))
return 0;
return FALSE;
}
return 1;
return TRUE;
}
u32 sub_802C860(u32 r0)
bool8 sub_802C860(u32 r0)
{
if(HasNoAcceptedJobs())
{
return 0;
return FALSE;
}
else
{
@ -435,7 +435,7 @@ u32 sub_802C860(u32 r0)
gUnknown_203B2F0->unk68 = 0;
gUnknown_203B2F0->unk0 = r0;
sub_802C910(0);
return 1;
return TRUE;
}
}

View File

@ -445,7 +445,7 @@ void HandleMissionReward(void)
const char *rankString;
u8 uVar7;
struct unkStruct_8090F58 local_20;
struct ItemSlot_Alt local_14;
struct ItemSlot_Alt item;
u32 numItems;
u32 index_cast;
u32 index_cast2;
@ -526,22 +526,22 @@ void HandleMissionReward(void)
// Cast ItemIndex
index_cast = uVar7 << 16;
local_14.temp.full_bits = (local_14.temp.full_bits & 0xff00ffff) | index_cast;
item.temp.full_bits = (item.temp.full_bits & 0xff00ffff) | index_cast;
index_cast2 = local_14.temp.full_bits >> 16;
index_cast2 = item.temp.full_bits >> 16;
if (IsThrowableItem(index_cast2)) {
// Cast number items
numItems = (gUnknown_203B310->unk10->numItems << 8);
local_14.temp.full_bits = (local_14.temp.full_bits & 0xffff00ff) | numItems;
item.temp.full_bits = (item.temp.full_bits & 0xffff00ff) | numItems;
}
else {
local_14.temp.full_bits = (local_14.temp.full_bits & 0xffff00ff) | 0;
item.temp.full_bits = (item.temp.full_bits & 0xffff00ff) | 0;
}
local_14.temp.full_bits = (local_14.temp.full_bits & 0xffffff00) | ITEM_FLAG_EXISTS;
item.temp.full_bits = (item.temp.full_bits & 0xffffff00) | ITEM_FLAG_EXISTS;
local_20.unk0 = 0;
local_20.unk4 = 0;
local_20.unk8 = 1;
sub_8090E14(gUnknown_202DEA8,(struct ItemSlot *)&local_14,&local_20);
sub_8090E14(gUnknown_202DEA8,(struct ItemSlot *)&item,&local_20);
if (gUnknown_203B310->displayClientDialogueSprite) {
sub_80141B4(gUnknown_80E0640,0,&gUnknown_203B310->faceFile,0x10d);
gUnknown_203B310->nextState = 5;

View File

@ -35,7 +35,7 @@ bool8 sub_8030D40(u8 param_1, s32 param_2)
sub_8006518(gUnknown_203B324->unk18);
gUnknown_203B324->unk18[gUnknown_203B324->unk10] = gUnknown_80E091C;
sub_8030DD4();
return 1;
return TRUE;
}
u8 sub_8030DA0(void)

View File

@ -75,7 +75,7 @@ bool8 sub_8030F58(u32 wonderMailMode)
MemoryFill8((u8 *)gUnknown_203B328,0,sizeof(struct unkStruct_203B328));
}
gUnknown_203B328->wonderMailMode = wonderMailMode;
iVar3 = GetDialogueSpriteDataPtr(0x130);
iVar3 = GetDialogueSpriteDataPtr(SPECIES_PELIPPER);
gUnknown_203B328->faceFile = iVar3;
gUnknown_203B328->faceData = iVar3->data;
gUnknown_203B328->unk114 = 0;
@ -102,7 +102,7 @@ bool8 sub_8030F58(u32 wonderMailMode)
gUnknown_203B328->state = 0;
sub_80306A8(wonderMailMode,0,0,8);
}
return 1;
return TRUE;
}
s32 sub_8031050(void)

View File

@ -127,13 +127,13 @@ void sub_802DF88(void);
void sub_802DF14(void);
void sub_801317C(void);
u32 sub_802DB28(u8 jobSlot, u8 param_2)
bool8 sub_802DB28(u8 jobSlot, u8 param_2)
{
char local_18 [8];
sub_8096AF8(local_18,jobSlot,param_2);
if (local_18[0] == '\0') {
return 0;
return FALSE;
}
else {
ResetUnusedInputStruct();
@ -154,7 +154,7 @@ u32 sub_802DB28(u8 jobSlot, u8 param_2)
gUnknown_203B2FC->faceData = gUnknown_203B2FC->faceFile->data;
}
sub_802DC28(0);
return 1;
return TRUE;
}
}

View File

@ -271,12 +271,12 @@ void HandleWonderMailMainScreen(void)
if (sub_80144A4(&menuAction) == 0) {
gUnknown_203B3E8->unk24C = 10;
switch(menuAction) {
case 3:
case WONDER_MAIL_GAME_LINK:
case 4:
gUnknown_203B3E8->wonderMailMethod = WONDER_MAIL_GAME_LINK;
SetWonderMailMainMenuState(GAME_LINK_CABLE_MENU);
break;
case 5:
case WONDER_MAIL_PASSWORD:
gUnknown_203B3E8->wonderMailMethod = WONDER_MAIL_PASSWORD;
SetWonderMailMainMenuState(PROMPT_PASSWORD_ENTRY);
break;