Felicity bank data

This commit is contained in:
Kermalis 2023-09-10 23:00:41 -04:00
parent 016b518c7d
commit 0f7fd64f82
6 changed files with 328 additions and 340 deletions

View File

@ -394,51 +394,4 @@ gUnknown_80DB6A4: @ 80DB6A4
gUnknown_80DB6BC: @ 80DB6BC
.string "Please enter a name.\0"
.align 2,0
@ END code_8012A18_1
@ START felicity_bank
.string "pksdir0\0"
.align 2,0
.global gUnknown_80DB6DC
gUnknown_80DB6DC: @ 80DB6DC
.byte 0x00, 0x00, 0x00, 0x00
.byte 0x03, 0x00, 0x00, 0x00
.byte 0x00, 0x00, 0x00, 0x00
.byte 0x00, 0x00, 0x00, 0x00
.byte 0x00, 0x00, 0x00, 0x00
.byte 0x00, 0x00, 0x00, 0x00
.global gUnknown_80DB6F4
gUnknown_80DB6F4: @ 80DB6F4
.byte 0x00, 0x00, 0x00, 0x00
.byte 0x03, 0x00, 0x00, 0x00
.byte 0x02, 0x00, 0x03, 0x00
.byte 0x1a, 0x00, 0x02, 0x00
.byte 0x02, 0x00, 0x00, 0x00
.byte 0x00, 0x00, 0x00, 0x00
.global gUnknown_80DB70C
gUnknown_80DB70C: @ 80DB70C
.byte 0x00, 0x00, 0x00, 0x00
.byte 0x03, 0x00, 0x00, 0x00
.byte 0x11, 0x00, 0x08, 0x00
.byte 0x0b, 0x00, 0x04, 0x00
.byte 0x04, 0x00, 0x00, 0x00
.byte 0x00, 0x00, 0x00, 0x00
.global gFelicityMoney
gFelicityMoney: @ 80DB724
.string "Money: \0"
.align 2,0
.global gFelicitySavings
gFelicitySavings: @ 80DB72C
.string "Savings: \0"
.align 2,0
.global gUnknown_80DB738
gUnknown_80DB738: @ 80DB738
.string "Money\0"
@ END FELICITY BANK
@ END code_8012A18_1

View File

@ -2,11 +2,14 @@
#define GUARD_FELICITY_BANK_H
#include "file_system.h"
#include "text.h"
#include "menu.h"
#include "text.h"
#define FELICITY_BANK_ACTION_WITHDRAW 0
#define FELICITY_BANK_ACTION_DEPOSIT 1
// size: 0x108
struct FelicityBankWork
typedef struct FelicityBankWork
{
/* 0x0 */ u32 isAsleep;
/* 0x4 */ s32 currState;
@ -35,13 +38,11 @@ struct FelicityBankWork
u8 unkA3;
OpenedFile **unkA4;
UnkTextStruct2 unkA8[4];
};
} FelicityBankWork;
extern struct FelicityBankWork *gFelicityBankWork;
bool8 CreateFelicityBank(s32 mode);
void DestroyFelicityBank(void);
void DrawTeamMoneyBox(u32);
u32 FelicityBankCallback(void);
#define FELICITY_BANK_ACTION_WITHDRAW 0
#define FELICITY_BANK_ACTION_DEPOSIT 1
void DrawTeamMoneyBox(u32 param_1);
#endif
#endif // GUARD_FELICITY_BANK_H

View File

@ -403,6 +403,7 @@ SECTIONS {
data/data_80D47B8.o(.rodata);
data/common_strings.o(.rodata);
data/data_80DAF70.o(.rodata);
src/felicity_bank.o(.rodata);
src/kangaskhan_storage1.o(.rodata);
src/kangaskhan_storage2.o(.rodata);
src/kecleon_bros1.o(.rodata);

32
src/data/felicity_bank.h Normal file
View File

@ -0,0 +1,32 @@
ALIGNED(4) static const u8 sFill[] = _("pksdir0");
static const UnkTextStruct2 sUnknown_80DB6DC = {
0, 0, 0, 0,
3,
0, 0,
0, 0,
0, 0,
NULL
};
static const UnkTextStruct2 sUnknown_80DB6F4 = {
0, 0, 0, 0,
3,
2, 3,
26, 2,
2, 0,
NULL
};
static const UnkTextStruct2 sUnknown_80DB70C = {
0, 0, 0, 0,
3,
17, 8,
11, 4,
4, 0,
NULL
};
ALIGNED(4) static const u8 sDisplayMoney[] = _("Money: ");
ALIGNED(4) static const u8 sDisplaySavings[] = _("Savings: ");
ALIGNED(4) static const u8 sMoney[] = _("Money");

View File

@ -5,413 +5,415 @@
#include "memory.h"
#include "menu_input.h"
#include "pokemon.h"
#include "text1.h"
#include "text2.h"
EWRAM_DATA_2 struct FelicityBankWork *gFelicityBankWork = {0};
static EWRAM_DATA_2 FelicityBankWork *sFelicityBankWork = {0};
extern u32 gUnknown_202DE30;
extern u8 gUnknown_202E1C8[];
extern u8 gUnknown_202E5D8[];
extern u8 *gCommonCancel[];
extern u8 *gCommonStore[];
extern u8 *gCommonTake[];
extern u8 *gCommonInfo[];
extern u8 *gCommonDepositPrompt;
extern u8 *gCommonWithdrawPrompt;
extern u8 *gCommonFelicity[2][15];
extern UnkTextStruct2 gUnknown_80DB6DC;
extern UnkTextStruct2 gUnknown_80DB6F4;
extern UnkTextStruct2 gUnknown_80DB70C;
extern u8 gFelicitySavings[];
extern u8 gFelicityMoney[];
extern u8 gUnknown_80DB738;
extern const u8 *gCommonCancel[];
extern const u8 *gCommonStore[];
extern const u8 *gCommonTake[];
extern const u8 *gCommonInfo[];
extern const u8 *gCommonDepositPrompt;
extern const u8 *gCommonWithdrawPrompt;
extern const u8 *gCommonFelicity[2][15];
extern void sub_801645C();
extern void sub_80169BC();
extern void sub_8016B00();
extern void sub_8016B24();
#include "data/felicity_bank.h"
void CreateFelicityBankShopMenu(void);
void CreateFelicityMoneySavingsHeader(u32);
void Felicity_DepositMoney();
void Felicity_WithdrawMoney();
void sub_8016B48(u8 action);
void UpdateFelicityBankDialogue();
void UpdateFelicityBankState(u32);
static void CreateFelicityBankShopMenu(void);
static void CreateFelicityMoneySavingsHeader(u32);
static void Felicity_DepositMoney(void);
static void Felicity_WithdrawMoney(void);
static void UpdateFelicityBankDialogue(void);
static void UpdateFelicityBankState(u32 newState);
u32 CreateFelicityBank(s32 isAsleep)
static void sub_801645C(void);
static void sub_80169BC(void);
static void sub_8016B00(void);
static void sub_8016B24(void);
static void sub_8016B48(u8 action);
bool8 CreateFelicityBank(s32 mode)
{
char *monName;
OpenedFile * faceFile;
ResetUnusedInputStruct();
sub_800641C(NULL, TRUE, TRUE);
gFelicityBankWork = MemoryAlloc(sizeof(struct FelicityBankWork), 8);
gFelicityBankWork->menuAction = 0;
gFelicityBankWork->isAsleep = isAsleep;
CopyYellowMonsterNametoBuffer(gUnknown_202E5D8, MONSTER_PERSIAN);
CopyYellowMonsterNametoBuffer(gUnknown_202E1C8, MONSTER_PERSIAN);
monName = GetMonSpecies(MONSTER_PERSIAN);
strcpy(gUnknown_202E1C8 - 80, monName);
u8 *monName;
OpenedFile *faceFile;
if (gFelicityBankWork->isAsleep == 1)
gFelicityBankWork->unkA4 = NULL;
else
gFelicityBankWork->unkA4 = &gFelicityBankWork->faceFile;
ResetUnusedInputStruct();
sub_800641C(NULL, TRUE, TRUE);
sFelicityBankWork = MemoryAlloc(sizeof(FelicityBankWork), 8);
sFelicityBankWork->menuAction = 0;
sFelicityBankWork->isAsleep = mode;
CopyYellowMonsterNametoBuffer(gUnknown_202E5D8, MONSTER_PERSIAN);
CopyYellowMonsterNametoBuffer(gUnknown_202E1C8, MONSTER_PERSIAN);
monName = GetMonSpecies(MONSTER_PERSIAN);
strcpy(gUnknown_202E1C8 - 80, monName);
faceFile = GetDialogueSpriteDataPtr(MONSTER_PERSIAN);
gFelicityBankWork->faceFile = faceFile;
gFelicityBankWork->faceData = faceFile->data;
gFelicityBankWork->unkA0 = 0;
gFelicityBankWork->unkA1 = 0;
gFelicityBankWork->unkA2 = 0;
gFelicityBankWork->unk9C = 2;
gFelicityBankWork->unk9E = 8;
UpdateFelicityBankState(0);
return 1;
if (sFelicityBankWork->isAsleep == 1)
sFelicityBankWork->unkA4 = NULL;
else
sFelicityBankWork->unkA4 = &sFelicityBankWork->faceFile;
faceFile = GetDialogueSpriteDataPtr(MONSTER_PERSIAN);
sFelicityBankWork->faceFile = faceFile;
sFelicityBankWork->faceData = faceFile->data;
sFelicityBankWork->unkA0 = 0;
sFelicityBankWork->unkA1 = 0;
sFelicityBankWork->unkA2 = 0;
sFelicityBankWork->unk9C = 2;
sFelicityBankWork->unk9E = 8;
UpdateFelicityBankState(0);
return TRUE;
}
u32 FelicityBankCallback(void)
{
switch (gFelicityBankWork->currState) {
case 1:
sub_8016B24();
break;
case 2:
sub_80169BC();
break;
case 8:
Felicity_DepositMoney();
break;
case 11:
Felicity_WithdrawMoney();
break;
case 6:
return 3;
case 0:
case 3:
case 4:
case 5:
case 7:
case 9:
case 10:
case 12:
default:
sub_8016B00();
break;
}
return 0;
{
switch (sFelicityBankWork->currState) {
case 1:
sub_8016B24();
break;
case 2:
sub_80169BC();
break;
case 8:
Felicity_DepositMoney();
break;
case 11:
Felicity_WithdrawMoney();
break;
case 6:
return 3;
case 0:
case 3:
case 4:
case 5:
case 7:
case 9:
case 10:
case 12:
default:
sub_8016B00();
break;
}
return 0;
}
void DestroyFelicityBank(void)
{
if (gFelicityBankWork != NULL) {
CloseFile(gFelicityBankWork->faceFile);
MemoryFree(gFelicityBankWork);
gFelicityBankWork = NULL;
if (sFelicityBankWork != NULL) {
CloseFile(sFelicityBankWork->faceFile);
MemoryFree(sFelicityBankWork);
sFelicityBankWork = NULL;
}
}
void UpdateFelicityBankState(u32 newState)
static void UpdateFelicityBankState(u32 newState)
{
gFelicityBankWork->currState = newState;
sFelicityBankWork->currState = newState;
sub_801645C();
UpdateFelicityBankDialogue();
}
void sub_801645C(void)
static void sub_801645C(void)
{
s32 index;
s32 i;
sub_8006518(gFelicityBankWork->unkA8);
switch (gFelicityBankWork->currState)
{
sub_8006518(sFelicityBankWork->unkA8);
switch (sFelicityBankWork->currState) {
case 2:
gFelicityBankWork->unkA8[0].unk0 = 0x80;
gFelicityBankWork->unkA8[1].unk0 = 0x80;
gFelicityBankWork->unkA8[2].unk0 = 0x80;
gFelicityBankWork->unkA8[3] = gUnknown_80DB6F4;
sFelicityBankWork->unkA8[0].unk0 = 0x80;
sFelicityBankWork->unkA8[1].unk0 = 0x80;
sFelicityBankWork->unkA8[2].unk0 = 0x80;
sFelicityBankWork->unkA8[3] = sUnknown_80DB6F4;
ResetUnusedInputStruct();
sub_800641C(gFelicityBankWork->unkA8, TRUE, FALSE);
sub_800641C(sFelicityBankWork->unkA8, TRUE, FALSE);
break;
case 8:
case 11:
gFelicityBankWork->unkA8[0].unk0 = 0x80;
gFelicityBankWork->unkA8[1].unk0 = 0x80;
gFelicityBankWork->unkA8[3] = gUnknown_80DB6F4;
gFelicityBankWork->unkA8[2] = gUnknown_80DB70C;
sFelicityBankWork->unkA8[0].unk0 = 0x80;
sFelicityBankWork->unkA8[1].unk0 = 0x80;
sFelicityBankWork->unkA8[3] = sUnknown_80DB6F4;
sFelicityBankWork->unkA8[2] = sUnknown_80DB70C;
ResetUnusedInputStruct();
sub_800641C(gFelicityBankWork->unkA8, TRUE, FALSE);
sub_800641C(sFelicityBankWork->unkA8, TRUE, FALSE);
break;
default:
for (index = 0; index < 4; index++) {
gFelicityBankWork->unkA8[index] = gUnknown_80DB6DC;
}
for (i = 0; i < 4; i++)
sFelicityBankWork->unkA8[i] = sUnknown_80DB6DC;
ResetUnusedInputStruct();
sub_800641C(gFelicityBankWork->unkA8, TRUE, TRUE);
sub_800641C(sFelicityBankWork->unkA8, TRUE, TRUE);
break;
}
}
void UpdateFelicityBankDialogue(void)
static void UpdateFelicityBankDialogue(void)
{
switch (gFelicityBankWork->currState) {
case 0x0:
gFelicityBankWork->fallbackState = 1;
sub_80141B4(gCommonFelicity[gFelicityBankWork->isAsleep][0], 0, gFelicityBankWork->unkA4, 0x10D);
switch (sFelicityBankWork->currState) {
case 0:
sFelicityBankWork->fallbackState = 1;
sub_80141B4(gCommonFelicity[sFelicityBankWork->isAsleep][0], 0, sFelicityBankWork->unkA4, 0x10D);
break;
case 0x1:
case 1:
CreateFelicityBankShopMenu();
gFelicityBankWork->fallbackState = 2;
sFelicityBankWork->fallbackState = 2;
if (gTeamInventoryRef->teamSavings == 0)
sub_8014248(gCommonFelicity[gFelicityBankWork->isAsleep][1], 0, gFelicityBankWork->menuAction,
gFelicityBankWork->unk14, gFelicityBankWork->unk54, 4, 0, gFelicityBankWork->unkA4, 0xC);
sub_8014248(gCommonFelicity[sFelicityBankWork->isAsleep][1], 0, sFelicityBankWork->menuAction,
sFelicityBankWork->unk14, sFelicityBankWork->unk54, 4, 0, sFelicityBankWork->unkA4, 0xC);
else {
gUnknown_202DE30 = gTeamInventoryRef->teamSavings;
sub_8014248(gCommonFelicity[gFelicityBankWork->isAsleep][2], 0, gFelicityBankWork->menuAction,
gFelicityBankWork->unk14, gFelicityBankWork->unk54, 4, 0, gFelicityBankWork->unkA4, 0xC);
sub_8014248(gCommonFelicity[sFelicityBankWork->isAsleep][2], 0, sFelicityBankWork->menuAction,
sFelicityBankWork->unk14, sFelicityBankWork->unk54, 4, 0, sFelicityBankWork->unkA4, 0xC);
}
break;
case 0x3:
gFelicityBankWork->fallbackState = 1;
sub_80141B4(gCommonFelicity[gFelicityBankWork->isAsleep][14], 0, gFelicityBankWork->unkA4, 0x10D);
case 3:
sFelicityBankWork->fallbackState = 1;
sub_80141B4(gCommonFelicity[sFelicityBankWork->isAsleep][14], 0, sFelicityBankWork->unkA4, 0x10D);
break;
case 0x4:
gFelicityBankWork->fallbackState = 6;
case 4:
sFelicityBankWork->fallbackState = 6;
if (gTeamInventoryRef->teamSavings == 0)
sub_80141B4(gCommonFelicity[gFelicityBankWork->isAsleep][4], 0, gFelicityBankWork->unkA4, 0x10D);
sub_80141B4(gCommonFelicity[sFelicityBankWork->isAsleep][4], 0, sFelicityBankWork->unkA4, 0x10D);
else {
gUnknown_202DE30 = gTeamInventoryRef->teamSavings;
sub_80141B4(gCommonFelicity[gFelicityBankWork->isAsleep][5], 0, gFelicityBankWork->unkA4, 0x10D);
sub_80141B4(gCommonFelicity[sFelicityBankWork->isAsleep][5], 0, sFelicityBankWork->unkA4, 0x10D);
}
break;
case 0x5:
gFelicityBankWork->fallbackState = 1;
sub_80141B4(gCommonFelicity[gFelicityBankWork->isAsleep][3], 0, gFelicityBankWork->unkA4, 0x10D);
case 5:
sFelicityBankWork->fallbackState = 1;
sub_80141B4(gCommonFelicity[sFelicityBankWork->isAsleep][3], 0, sFelicityBankWork->unkA4, 0x10D);
break;
case 0x7:
case 7:
if (gTeamInventoryRef->teamMoney == 0) {
gFelicityBankWork->fallbackState = 1;
sub_80141B4(gCommonFelicity[gFelicityBankWork->isAsleep][7], 0, gFelicityBankWork->unkA4, 0x10D);
sFelicityBankWork->fallbackState = 1;
sub_80141B4(gCommonFelicity[sFelicityBankWork->isAsleep][7], 0, sFelicityBankWork->unkA4, 0x10D);
}
else if (gTeamInventoryRef->teamSavings >= MAX_TEAM_SAVINGS) {
gFelicityBankWork->fallbackState = 1;
sub_80141B4(gCommonFelicity[gFelicityBankWork->isAsleep][8], 0, gFelicityBankWork->unkA4, 0x10D);
sFelicityBankWork->fallbackState = 1;
sub_80141B4(gCommonFelicity[sFelicityBankWork->isAsleep][8], 0, sFelicityBankWork->unkA4, 0x10D);
}
else {
gFelicityBankWork->fallbackState = 8;
sub_80141B4(gCommonFelicity[gFelicityBankWork->isAsleep][6], 0, gFelicityBankWork->unkA4, 0x10D);
sFelicityBankWork->fallbackState = 8;
sub_80141B4(gCommonFelicity[sFelicityBankWork->isAsleep][6], 0, sFelicityBankWork->unkA4, 0x10D);
}
break;
case 0x8:
gFelicityBankWork->maximumDepositWithdraw = MAX_TEAM_SAVINGS - gTeamInventoryRef->teamSavings;
if (gFelicityBankWork->maximumDepositWithdraw > gTeamInventoryRef->teamMoney)
gFelicityBankWork->maximumDepositWithdraw = gTeamInventoryRef->teamMoney;
gFelicityBankWork->unk68 = gFelicityBankWork->maximumDepositWithdraw;
gFelicityBankWork->unk6C = 1;
gFelicityBankWork->unk74 = 5;
gFelicityBankWork->unk78 = 2;
gFelicityBankWork->unk7C = &gFelicityBankWork->unkA8[2];
gFelicityBankWork->unk80 = 0x50;
gFelicityBankWork->unk84 = 0x12;
sub_8013AA0(&gFelicityBankWork->unk64);
sub_8016B48(1);
case 8:
sFelicityBankWork->maximumDepositWithdraw = MAX_TEAM_SAVINGS - gTeamInventoryRef->teamSavings;
if (sFelicityBankWork->maximumDepositWithdraw > gTeamInventoryRef->teamMoney)
sFelicityBankWork->maximumDepositWithdraw = gTeamInventoryRef->teamMoney;
sFelicityBankWork->unk68 = sFelicityBankWork->maximumDepositWithdraw;
sFelicityBankWork->unk6C = 1;
sFelicityBankWork->unk74 = 5;
sFelicityBankWork->unk78 = 2;
sFelicityBankWork->unk7C = &sFelicityBankWork->unkA8[2];
sFelicityBankWork->unk80 = 0x50;
sFelicityBankWork->unk84 = 0x12;
sub_8013AA0(&sFelicityBankWork->unk64);
sub_8016B48(FELICITY_BANK_ACTION_DEPOSIT);
CreateFelicityMoneySavingsHeader(3);
break;
case 0x9:
gFelicityBankWork->fallbackState = 1;
gUnknown_202DE30 = gFelicityBankWork->chosenAmount;
sub_80141B4(gCommonFelicity[gFelicityBankWork->isAsleep][9], 0, gFelicityBankWork->unkA4, 0x10D);
case 9:
sFelicityBankWork->fallbackState = 1;
gUnknown_202DE30 = sFelicityBankWork->chosenAmount;
sub_80141B4(gCommonFelicity[sFelicityBankWork->isAsleep][9], 0, sFelicityBankWork->unkA4, 0x10D);
break;
case 0xA:
case 10:
if (gTeamInventoryRef->teamMoney >= MAX_TEAM_MONEY) {
gFelicityBankWork->fallbackState = 1;
sub_80141B4(gCommonFelicity[gFelicityBankWork->isAsleep][12], 0, gFelicityBankWork->unkA4, 0x10D);
sFelicityBankWork->fallbackState = 1;
sub_80141B4(gCommonFelicity[sFelicityBankWork->isAsleep][12], 0, sFelicityBankWork->unkA4, 0x10D);
}
else if (gTeamInventoryRef->teamSavings == 0) {
gFelicityBankWork->fallbackState = 1;
sub_80141B4(gCommonFelicity[gFelicityBankWork->isAsleep][11], 0, gFelicityBankWork->unkA4, 0x10D);
sFelicityBankWork->fallbackState = 1;
sub_80141B4(gCommonFelicity[sFelicityBankWork->isAsleep][11], 0, sFelicityBankWork->unkA4, 0x10D);
}
else {
gFelicityBankWork->fallbackState = 11;
sFelicityBankWork->fallbackState = 11;
gUnknown_202DE30 = gTeamInventoryRef->teamSavings;
sub_80141B4(gCommonFelicity[gFelicityBankWork->isAsleep][10], 0, gFelicityBankWork->unkA4, 0x10D);
sub_80141B4(gCommonFelicity[sFelicityBankWork->isAsleep][10], 0, sFelicityBankWork->unkA4, 0x10D);
}
break;
case 0xB:
gFelicityBankWork->maximumDepositWithdraw = MAX_TEAM_MONEY - gTeamInventoryRef->teamMoney;
if (gFelicityBankWork->maximumDepositWithdraw > gTeamInventoryRef->teamSavings)
gFelicityBankWork->maximumDepositWithdraw = gTeamInventoryRef->teamSavings;
gFelicityBankWork->unk68 = gFelicityBankWork->maximumDepositWithdraw;
gFelicityBankWork->unk6C = 1;
gFelicityBankWork->unk74 = 5;
gFelicityBankWork->unk78 = 2;
gFelicityBankWork->unk7C = &gFelicityBankWork->unkA8[2];
gFelicityBankWork->unk80 = 0x50;
gFelicityBankWork->unk84 = 0x12;
sub_8013AA0(&gFelicityBankWork->unk64);
sub_8016B48(0);
case 11:
sFelicityBankWork->maximumDepositWithdraw = MAX_TEAM_MONEY - gTeamInventoryRef->teamMoney;
if (sFelicityBankWork->maximumDepositWithdraw > gTeamInventoryRef->teamSavings)
sFelicityBankWork->maximumDepositWithdraw = gTeamInventoryRef->teamSavings;
sFelicityBankWork->unk68 = sFelicityBankWork->maximumDepositWithdraw;
sFelicityBankWork->unk6C = 1;
sFelicityBankWork->unk74 = 5;
sFelicityBankWork->unk78 = 2;
sFelicityBankWork->unk7C = &sFelicityBankWork->unkA8[2];
sFelicityBankWork->unk80 = 0x50;
sFelicityBankWork->unk84 = 0x12;
sub_8013AA0(&sFelicityBankWork->unk64);
sub_8016B48(FELICITY_BANK_ACTION_WITHDRAW);
CreateFelicityMoneySavingsHeader(3);
break;
case 0x2:
case 2:
CreateFelicityMoneySavingsHeader(3);
break;
case 0xC:
gFelicityBankWork->fallbackState = 1;
gUnknown_202DE30 = gFelicityBankWork->chosenAmount;
sub_80141B4(gCommonFelicity[gFelicityBankWork->isAsleep][13], 0, gFelicityBankWork->unkA4, 0x10D);
case 12:
sFelicityBankWork->fallbackState = 1;
gUnknown_202DE30 = sFelicityBankWork->chosenAmount;
sub_80141B4(gCommonFelicity[sFelicityBankWork->isAsleep][13], 0, sFelicityBankWork->unkA4, 0x10D);
break;
}
}
void CreateFelicityBankShopMenu(void)
static void CreateFelicityBankShopMenu(void)
{
s32 loopMax;
s32 i;
loopMax = 0;
MemoryFill16(gFelicityBankWork->unk54, 0, sizeof(gFelicityBankWork->unk54));
gFelicityBankWork->unk14[loopMax].text = *gCommonStore;
gFelicityBankWork->unk14[loopMax].menuAction = 2;
loopMax = 0;
MemoryFill16(sFelicityBankWork->unk54, 0, sizeof(sFelicityBankWork->unk54));
sFelicityBankWork->unk14[loopMax].text = *gCommonStore;
sFelicityBankWork->unk14[loopMax].menuAction = 2;
loopMax++;
gFelicityBankWork->unk14[loopMax].text = *gCommonTake;
gFelicityBankWork->unk14[loopMax].menuAction = 3;
sFelicityBankWork->unk14[loopMax].text = *gCommonTake;
sFelicityBankWork->unk14[loopMax].menuAction = 3;
loopMax++;
gFelicityBankWork->unk14[loopMax].text = *gCommonInfo;
gFelicityBankWork->unk14[loopMax].menuAction = 4;
sFelicityBankWork->unk14[loopMax].text = *gCommonInfo;
sFelicityBankWork->unk14[loopMax].menuAction = 4;
loopMax++;
gFelicityBankWork->unk14[loopMax].text = *gCommonCancel;
gFelicityBankWork->unk14[loopMax].menuAction = 1;
sFelicityBankWork->unk14[loopMax].text = *gCommonCancel;
sFelicityBankWork->unk14[loopMax].menuAction = 1;
loopMax++;
gFelicityBankWork->unk14[loopMax].text = NULL;
gFelicityBankWork->unk14[loopMax].menuAction = 1;
sFelicityBankWork->unk14[loopMax].text = NULL;
sFelicityBankWork->unk14[loopMax].menuAction = 1;
for (i = 0; i < loopMax; i++) {
if (gFelicityBankWork->unk54[i] == 0 && gFelicityBankWork->unk14[i].menuAction == gFelicityBankWork->menuAction)
if (sFelicityBankWork->unk54[i] == 0 && sFelicityBankWork->unk14[i].menuAction == sFelicityBankWork->menuAction)
return;
}
for (i = 0; i < loopMax; i++) {
if (gFelicityBankWork->unk54[i] == 0) {
gFelicityBankWork->menuAction = gFelicityBankWork->unk14[i].menuAction;
if (sFelicityBankWork->unk54[i] == 0) {
sFelicityBankWork->menuAction = sFelicityBankWork->unk14[i].menuAction;
break;
}
}
}
void sub_80169BC(void)
static void sub_80169BC(void)
{
s32 menuAction;
if (sub_80144A4(&menuAction) == 0) {
gFelicityBankWork->menuAction = menuAction;
switch (menuAction)
{
case 2:
UpdateFelicityBankState(7);
break;
case 3:
UpdateFelicityBankState(10);
break;
case 4:
UpdateFelicityBankState(3);
break;
case 1:
UpdateFelicityBankState(4);
break;
}
if (sub_80144A4(&menuAction))
return;
sFelicityBankWork->menuAction = menuAction;
switch (menuAction) {
case 2:
UpdateFelicityBankState(7);
break;
case 3:
UpdateFelicityBankState(10);
break;
case 4:
UpdateFelicityBankState(3);
break;
case 1:
UpdateFelicityBankState(4);
break;
}
}
void Felicity_DepositMoney(void)
static void Felicity_DepositMoney(void)
{
switch (sub_8013BBC(&gFelicityBankWork->unk64)) {
case 1:
sub_8016B48(FELICITY_BANK_ACTION_DEPOSIT);
break;
case 3:
gFelicityBankWork->chosenAmount = gFelicityBankWork->unk64;
gTeamInventoryRef->teamSavings += gFelicityBankWork->chosenAmount;
gTeamInventoryRef->teamMoney -= gFelicityBankWork->chosenAmount;
PlaySound(0x14c);
UpdateFelicityBankState(9);
break;
case 2:
UpdateFelicityBankState(5);
break;
case 0:
break;
}
switch (sub_8013BBC(&sFelicityBankWork->unk64)) {
case 1:
sub_8016B48(FELICITY_BANK_ACTION_DEPOSIT);
break;
case 3:
sFelicityBankWork->chosenAmount = sFelicityBankWork->unk64;
gTeamInventoryRef->teamSavings += sFelicityBankWork->chosenAmount;
gTeamInventoryRef->teamMoney -= sFelicityBankWork->chosenAmount;
PlaySound(332);
UpdateFelicityBankState(9);
break;
case 2:
UpdateFelicityBankState(5);
break;
case 0:
break;
}
}
void Felicity_WithdrawMoney(void)
static void Felicity_WithdrawMoney(void)
{
switch (sub_8013BBC(&gFelicityBankWork->unk64)) {
case 1:
sub_8016B48(FELICITY_BANK_ACTION_WITHDRAW);
break;
case 3:
gFelicityBankWork->chosenAmount = gFelicityBankWork->unk64;
gTeamInventoryRef->teamMoney += gFelicityBankWork->chosenAmount;
gTeamInventoryRef->teamSavings -= gFelicityBankWork->chosenAmount;
PlaySound(0x14c);
UpdateFelicityBankState(0xc);
break;
case 2:
UpdateFelicityBankState(5);
break;
case 0:
break;
}
switch (sub_8013BBC(&sFelicityBankWork->unk64)) {
case 1:
sub_8016B48(FELICITY_BANK_ACTION_WITHDRAW);
break;
case 3:
sFelicityBankWork->chosenAmount = sFelicityBankWork->unk64;
gTeamInventoryRef->teamMoney += sFelicityBankWork->chosenAmount;
gTeamInventoryRef->teamSavings -= sFelicityBankWork->chosenAmount;
PlaySound(332);
UpdateFelicityBankState(12);
break;
case 2:
UpdateFelicityBankState(5);
break;
case 0:
break;
}
}
void sub_8016B00(void)
static void sub_8016B00(void)
{
s32 auStack8;
if (sub_80144A4(&auStack8) == 0)
UpdateFelicityBankState(gFelicityBankWork->fallbackState);
s32 auStack8;
if (sub_80144A4(&auStack8) == 0)
UpdateFelicityBankState(sFelicityBankWork->fallbackState);
}
void sub_8016B24(void)
static void sub_8016B24(void)
{
s32 auStack8;
if (sub_80144A4(&auStack8) == 4)
UpdateFelicityBankState(gFelicityBankWork->fallbackState);
s32 auStack8;
if (sub_80144A4(&auStack8) == 4)
UpdateFelicityBankState(sFelicityBankWork->fallbackState);
}
void sub_8016B48(u8 action)
static void sub_8016B48(u8 action)
{
sub_8008C54(gFelicityBankWork->unk78);
sub_80073B8(gFelicityBankWork->unk78);
if (action != FELICITY_BANK_ACTION_WITHDRAW)
xxx_call_draw_string(12, 0, gCommonDepositPrompt, gFelicityBankWork->unk78, 0);
else
xxx_call_draw_string(12, 0, gCommonWithdrawPrompt, gFelicityBankWork->unk78, 0);
sub_8013C68(&gFelicityBankWork->unk64);
sub_80073E0(gFelicityBankWork->unk78);
sub_8008C54(sFelicityBankWork->unk78);
sub_80073B8(sFelicityBankWork->unk78);
if (action != FELICITY_BANK_ACTION_WITHDRAW)
xxx_call_draw_string(12, 0, gCommonDepositPrompt, sFelicityBankWork->unk78, 0);
else
xxx_call_draw_string(12, 0, gCommonWithdrawPrompt, sFelicityBankWork->unk78, 0);
sub_8013C68(&sFelicityBankWork->unk64);
sub_80073E0(sFelicityBankWork->unk78);
}
void CreateFelicityMoneySavingsHeader(u32 param_1)
static void CreateFelicityMoneySavingsHeader(u32 param_1)
{
sub_8008C54(param_1);
sub_80073B8(param_1);
xxx_call_draw_string(16, 4, gFelicityMoney, param_1, 0);
sub_8012BC4(96, 4, gTeamInventoryRef->teamMoney, 5, 5, param_1);
xxx_call_draw_string(112, 4, gFelicitySavings, param_1, 0);
sub_8012BC4(200, 4, gTeamInventoryRef->teamSavings, 7, 5, param_1);
sub_80073E0(param_1);
sub_8008C54(param_1);
sub_80073B8(param_1);
xxx_call_draw_string(16, 4, sDisplayMoney, param_1, 0);
sub_8012BC4(96, 4, gTeamInventoryRef->teamMoney, 5, 5, param_1);
xxx_call_draw_string(112, 4, sDisplaySavings, param_1, 0);
sub_8012BC4(200, 4, gTeamInventoryRef->teamSavings, 7, 5, param_1);
sub_80073E0(param_1);
}
void DrawTeamMoneyBox(u32 param_1)
{
sub_8008C54(param_1);
sub_80073B8(param_1);
xxx_call_draw_string(6, 0, &gUnknown_80DB738, param_1, 0); // Money
sub_8012BC4(42, 12, gTeamInventoryRef->teamMoney, 5, 5, param_1);
sub_80073E0(param_1);
}
sub_8008C54(param_1);
sub_80073B8(param_1);
xxx_call_draw_string(6, 0, sMoney, param_1, 0);
sub_8012BC4(42, 12, gTeamInventoryRef->teamMoney, 5, 5, param_1);
sub_80073E0(param_1);
}

View File

@ -101,7 +101,6 @@ extern const UnkTextStruct2 gUnknown_80DC564;
u8 sub_8021700(u32);
void sub_8092578(u8 *buffer, u8 index, u8 r2);
extern void DrawTeamMoneyBox(u32);
extern void sub_803AA34();
extern u8 sub_803ABC8(void);
extern u8 sub_802132C(void);