More small functions

This commit is contained in:
engineer124
2021-12-28 18:22:47 +11:00
parent 89c2af41de
commit 6fc234492f
9 changed files with 114 additions and 23 deletions
+2 -2
View File
@@ -2075,9 +2075,9 @@ void Interface_SetDoAction(GlobalContext* globalCtx, u16 arg1);
// void func_80115764(void);
void func_80115844(GlobalContext* globalCtx, s16 param_2);
s32 func_80115908(GlobalContext* globalCtx, u8 param_2);
void func_801159c0(s16 param_1);
void Health_GiveHearts(s16 hearts);
void Rupees_ChangeBy(s16 arg0);
void func_80115A14(s32 arg0, s16 arg1);
void Inventory_ChangeAmmo(s16 arg0, s16 arg1);
void Interface_AddMagic(GlobalContext* globalCtx, s16 arg1);
void func_80115D5C(GameState* gamestate);
// void func_80115DB4(void);
+1 -1
View File
@@ -113,7 +113,7 @@ typedef enum {
/* 0x07 */ ITEM_BOMBCHU,
/* 0x08 */ ITEM_STICK,
/* 0x09 */ ITEM_NUT,
/* 0x0A */ ITEM_MAGIC_BEANS,
/* 0x0A */ ITEM_BEAN,
/* 0x0B */ ITEM_SLINGSHOT,
/* 0x0C */ ITEM_POWDER_KEG,
/* 0x0D */ ITEM_PICTO_BOX,
+3 -3
View File
@@ -45,7 +45,7 @@ void* gItemIcons[] = {
0x08007000, // ITEM_BOMBCHU
0x08008000, // ITEM_STICK
0x08009000, // ITEM_NUT
0x0800A000, // ITEM_MAGIC_BEANS
0x0800A000, // ITEM_BEAN
0x0800B000, // ITEM_SLINGSHOT
0x0800C000, // ITEM_POWDER_KEG
0x0800D000, // ITEM_PICTO_BOX
@@ -180,7 +180,7 @@ u8 gItemSlots[] = {
SLOT_BOMBCHU, // ITEM_BOMBCHU
SLOT_STICK, // ITEM_STICK
SLOT_NUT, // ITEM_NUT
SLOT_MAGIC_BEANS, // ITEM_MAGIC_BEANS
SLOT_MAGIC_BEANS, // ITEM_BEAN
SLOT_TRADE_KEY_MAMA, // ITEM_SLINGSHOT
SLOT_POWDER_KEG, // ITEM_POWDER_KEG
SLOT_PICTO_BOX, // ITEM_PICTO_BOX
@@ -260,7 +260,7 @@ s16 gItemPrices[] = {
0, // ITEM_BOMBCHU
0, // ITEM_STICK
0, // ITEM_NUT
0, // ITEM_MAGIC_BEANS
0, // ITEM_BEAN
0, // ITEM_SLINGSHOT
0, // ITEM_POWDER_KEG
0, // ITEM_PICTO_BOX
+100 -9
View File
@@ -529,7 +529,39 @@ void func_8010EBA0(s16 arg0, s16 arg1) {
D_801BF8F0 = 0;
}
// Crazy u64 math
#ifdef NON_EQUIVALENT
s32 func_8010EC54(s32 timerId) {
u64 time;
s16 sp22;
s16 sp20;
s16 sp1E;
s16 sp1C;
s16 temp_a0;
s16 final;
time = gSaveContext.unk_3DE0[timerId];
sp1C = time / 36000;
time -= sp1C * 36000;
sp1E = time / 6000;
time -= sp1E * 6000;
sp20 = time / 1000;
time -= sp20 * 1000;
sp22 = time / 100;
time -= sp22 * 100;
temp_a0 = time / 10;
time -= sp22 * 10;
return (s16)time | (sp1C << 0x14) | (sp1E << 0x10) | (sp20 << 0xC) | (sp22 << 8) | (temp_a0 << 4);
}
#else
#pragma GLOBAL_ASM("asm/non_matchings/code/z_parameter/func_8010EC54.s")
#endif
void func_8010EE74(GlobalContext* globalCtx, s32 arg1) {
s32 pad;
@@ -1661,19 +1693,19 @@ u8 Item_Give(GlobalContext* globalCtx, u8 item) {
INV_CONTENT(ITEM_OCARINA) = 0;
return ITEM_NONE;
} else if (item == ITEM_MAGIC_BEANS) {
if (INV_CONTENT(ITEM_MAGIC_BEANS) == ITEM_NONE) {
INV_CONTENT(ITEM_MAGIC_BEANS) = item;
AMMO(ITEM_MAGIC_BEANS) = 1;
} else if (item == ITEM_BEAN) {
if (INV_CONTENT(ITEM_BEAN) == ITEM_NONE) {
INV_CONTENT(ITEM_BEAN) = item;
AMMO(ITEM_BEAN) = 1;
return ITEM_NONE;
}
if (AMMO(ITEM_MAGIC_BEANS) < 20) {
AMMO(ITEM_MAGIC_BEANS)++;
if (AMMO(ITEM_BEAN) < 20) {
AMMO(ITEM_BEAN)++;
return ITEM_NONE;
}
AMMO(ITEM_MAGIC_BEANS) = 20;
AMMO(ITEM_BEAN) = 20;
return ITEM_NONE;
} else if ((item >= ITEM_REMAINS_ODOLWA) && (item <= ITEM_REMAINS_TWINMOLD)) {
@@ -2058,13 +2090,72 @@ void Interface_SetDoAction(GlobalContext* globalCtx, u16 action) {
#pragma GLOBAL_ASM("asm/non_matchings/code/z_parameter/func_80115908.s")
#pragma GLOBAL_ASM("asm/non_matchings/code/z_parameter/func_801159c0.s")
void Health_GiveHearts(s16 hearts) {
gSaveContext.save.playerData.healthCapacity += hearts * 0x10;
}
void Rupees_ChangeBy(s16 rupeeChange) {
gSaveContext.rupeeAccumulator += rupeeChange;
}
#pragma GLOBAL_ASM("asm/non_matchings/code/z_parameter/func_80115A14.s")
void Inventory_ChangeAmmo(s16 item, s16 ammoChange) {
if (item == ITEM_STICK) {
AMMO(ITEM_STICK) += ammoChange;
if (AMMO(ITEM_STICK) >= CUR_CAPACITY(UPG_STICKS)) {
AMMO(ITEM_STICK) = CUR_CAPACITY(UPG_STICKS);
} else if (AMMO(ITEM_STICK) < 0) {
AMMO(ITEM_STICK) = 0;
}
} else if (item == ITEM_NUT) {
AMMO(ITEM_NUT) += ammoChange;
if (AMMO(ITEM_NUT) >= CUR_CAPACITY(UPG_NUTS)) {
AMMO(ITEM_NUT) = CUR_CAPACITY(UPG_NUTS);
} else if (AMMO(ITEM_NUT) < 0) {
AMMO(ITEM_NUT) = 0;
}
} else if (item == ITEM_BOMBCHU) {
AMMO(ITEM_BOMBCHU) += ammoChange;
if (AMMO(ITEM_BOMBCHU) >= CUR_CAPACITY(UPG_BOMB_BAG)) {
AMMO(ITEM_BOMBCHU) = CUR_CAPACITY(UPG_BOMB_BAG);
} else if (AMMO(ITEM_BOMBCHU) < 0) {
AMMO(ITEM_BOMBCHU) = 0;
}
} else if (item == ITEM_BOW) {
AMMO(ITEM_BOW) += ammoChange;
if (AMMO(ITEM_BOW) >= CUR_CAPACITY(UPG_QUIVER)) {
AMMO(ITEM_BOW) = CUR_CAPACITY(UPG_QUIVER);
} else if (AMMO(ITEM_BOW) < 0) {
AMMO(ITEM_BOW) = 0;
}
} else if (item == ITEM_BOMB) {
AMMO(ITEM_BOMB) += ammoChange;
if (AMMO(ITEM_BOMB) >= CUR_CAPACITY(UPG_BOMB_BAG)) {
AMMO(ITEM_BOMB) = CUR_CAPACITY(UPG_BOMB_BAG);
} else if (AMMO(ITEM_BOMB) < 0) {
AMMO(ITEM_BOMB) = 0;
}
} else if (item == ITEM_BEAN) {
AMMO(ITEM_BEAN) += ammoChange;
} else if (item == ITEM_POWDER_KEG) {
AMMO(ITEM_POWDER_KEG) += ammoChange;
if (AMMO(ITEM_POWDER_KEG) >= 1) {
AMMO(ITEM_POWDER_KEG) = 1;
} else if (AMMO(ITEM_POWDER_KEG) < 0) {
AMMO(ITEM_POWDER_KEG) = 0;
}
}
}
void Interface_AddMagic(GlobalContext* globalCtx, s16 arg1) {
if (gSaveContext.save.playerData.magic) {}
@@ -285,7 +285,7 @@ s32 func_80BED140(GlobalContext* globalCtx) {
}
s32 func_80BED208(EnAkindonuts* this) {
if (INV_CONTENT(ITEM_MAGIC_BEANS) != 10U) {
if (INV_CONTENT(ITEM_BEAN) != 10U) {
return 0;
}
@@ -293,7 +293,7 @@ s32 func_80BED208(EnAkindonuts* this) {
return 1;
}
if (AMMO(ITEM_MAGIC_BEANS) >= 20) {
if (AMMO(ITEM_BEAN) >= 20) {
return 2;
}
@@ -402,7 +402,7 @@ void EnGirlA_BuyBottleItem(GlobalContext* globalCtx, EnGirlA* this) {
}
void EnGirlA_BuyArrows(GlobalContext* globalCtx, EnGirlA* this) {
func_80115A14(ITEM_BOW, this->itemParams);
Inventory_ChangeAmmo(ITEM_BOW, this->itemParams);
Rupees_ChangeBy(-globalCtx->msgCtx.unk1206C);
}
+1 -1
View File
@@ -122,7 +122,7 @@ void EnMs_Talk(EnMs* this, GlobalContext* globalCtx) {
if (gSaveContext.save.playerData.rupees < 10) {
play_sound(NA_SE_SY_ERROR);
func_80151938(globalCtx, 0x935); // "[...] You don't have enough Rupees."
} else if (AMMO(ITEM_MAGIC_BEANS) >= 20) {
} else if (AMMO(ITEM_BEAN) >= 20) {
play_sound(NA_SE_SY_ERROR);
func_80151938(globalCtx, 0x937); // "[...] You can't carry anymore."
} else {
+2 -2
View File
@@ -2131,9 +2131,9 @@
0x80115764:("func_80115764",),
0x80115844:("func_80115844",),
0x80115908:("func_80115908",),
0x801159C0:("func_801159c0",),
0x801159C0:("Health_GiveHearts",),
0x801159EC:("Rupees_ChangeBy",),
0x80115A14:("func_80115A14",),
0x80115A14:("Inventory_ChangeAmmo",),
0x80115D14:("Interface_AddMagic",),
0x80115D5C:("func_80115D5C",),
0x80115DB4:("func_80115DB4",),
+2 -2
View File
@@ -1645,9 +1645,9 @@ asm/non_matchings/code/z_parameter/func_801155B4.s,func_801155B4,0x801155B4,0x6C
asm/non_matchings/code/z_parameter/func_80115764.s,func_80115764,0x80115764,0x38
asm/non_matchings/code/z_parameter/func_80115844.s,func_80115844,0x80115844,0x31
asm/non_matchings/code/z_parameter/func_80115908.s,func_80115908,0x80115908,0x2E
asm/non_matchings/code/z_parameter/func_801159c0.s,func_801159c0,0x801159C0,0xB
asm/non_matchings/code/z_parameter/Health_GiveHearts.s,Health_GiveHearts,0x801159C0,0xB
asm/non_matchings/code/z_parameter/Rupees_ChangeBy.s,Rupees_ChangeBy,0x801159EC,0xA
asm/non_matchings/code/z_parameter/func_80115A14.s,func_80115A14,0x80115A14,0xC0
asm/non_matchings/code/z_parameter/Inventory_ChangeAmmo.s,Inventory_ChangeAmmo,0x80115A14,0xC0
asm/non_matchings/code/z_parameter/Interface_AddMagic.s,Interface_AddMagic,0x80115D14,0x12
asm/non_matchings/code/z_parameter/func_80115D5C.s,func_80115D5C,0x80115D5C,0x16
asm/non_matchings/code/z_parameter/func_80115DB4.s,func_80115DB4,0x80115DB4,0xB5
1 asm/non_matchings/code/z_en_a_keep/EnAObj_Init.s EnAObj_Init 0x800A5AC0 0x2B
1645 asm/non_matchings/code/z_parameter/func_80115764.s func_80115764 0x80115764 0x38
1646 asm/non_matchings/code/z_parameter/func_80115844.s func_80115844 0x80115844 0x31
1647 asm/non_matchings/code/z_parameter/func_80115908.s func_80115908 0x80115908 0x2E
1648 asm/non_matchings/code/z_parameter/func_801159c0.s asm/non_matchings/code/z_parameter/Health_GiveHearts.s func_801159c0 Health_GiveHearts 0x801159C0 0xB
1649 asm/non_matchings/code/z_parameter/Rupees_ChangeBy.s Rupees_ChangeBy 0x801159EC 0xA
1650 asm/non_matchings/code/z_parameter/func_80115A14.s asm/non_matchings/code/z_parameter/Inventory_ChangeAmmo.s func_80115A14 Inventory_ChangeAmmo 0x80115A14 0xC0
1651 asm/non_matchings/code/z_parameter/Interface_AddMagic.s Interface_AddMagic 0x80115D14 0x12
1652 asm/non_matchings/code/z_parameter/func_80115D5C.s func_80115D5C 0x80115D5C 0x16
1653 asm/non_matchings/code/z_parameter/func_80115DB4.s func_80115DB4 0x80115DB4 0xB5