Rename itemOnA and itemOnA, fix jp demo

This commit is contained in:
Tal Hayon 2022-01-12 06:23:06 +02:00
parent 6b0f125be0
commit 5476829893
7 changed files with 20 additions and 21 deletions

View File

@ -259,8 +259,8 @@ typedef struct {
/*0x22*/ u8 filler4[4];
} Stats;
#define itemOnA itemButtons[0]
#define itemOnB itemButtons[1]
#define SLOT_A 0
#define SLOT_B 1
typedef struct {
/*0x0*/ u8 field_0x0;

View File

@ -37,9 +37,9 @@ extern u8 gUnk_080FE1DD[];
u32 IsItemEquipped(u32 itemID) {
u32 itemSlot;
if (itemID == gSave.stats.itemOnA)
if (itemID == gSave.stats.itemButtons[SLOT_A])
itemSlot = 0;
else if (itemID == gSave.stats.itemOnB)
else if (itemID == gSave.stats.itemButtons[SLOT_B])
itemSlot = 1;
else
itemSlot = 2;
@ -54,17 +54,17 @@ void PutItemOnSlot(u32 itemID) {
}
if (itemID2 - 1 < 0x1f) {
itemSlot = 2;
if (gSave.stats.itemOnA == 0) {
if (gSave.stats.itemButtons[SLOT_A] == 0) {
itemSlot = 0;
} else if (gSave.stats.itemOnB == 0) {
} else if (gSave.stats.itemButtons[SLOT_B] == 0) {
itemSlot = 1;
}
if (itemSlot == 2) {
u8 temp = gUnk_080FD5B4[itemID2].unk;
if (temp == gUnk_080FD5B4[gSave.stats.itemOnA].unk) {
if (temp == gUnk_080FD5B4[gSave.stats.itemButtons[SLOT_A]].unk) {
itemSlot = 0;
} else {
if (temp == gUnk_080FD5B4[gSave.stats.itemOnB].unk) {
if (temp == gUnk_080FD5B4[gSave.stats.itemButtons[SLOT_B]].unk) {
itemSlot = 1;
}
}

View File

@ -247,12 +247,12 @@ void sub_080281A0(Entity* this) {
bool32 sub_080281E0(u32 param_1) {
bool32 ret = FALSE;
if (GetInventoryValue(param_1) == 1) {
if (ItemIsShield(gSave.stats.itemOnA)) {
gSave.stats.itemOnA = 0;
if (ItemIsShield(gSave.stats.itemButtons[SLOT_A])) {
gSave.stats.itemButtons[SLOT_A] = 0;
}
if (ItemIsShield(gSave.stats.itemOnB)) {
gSave.stats.itemOnB = 0;
if (ItemIsShield(gSave.stats.itemButtons[SLOT_B])) {
gSave.stats.itemButtons[SLOT_B] = 0;
}
sub_0807CAA0(param_1, 0);

View File

@ -149,10 +149,10 @@ void sub_08068B84(Entity* this) {
}
void sub_08068BB4(Entity* this) {
u32 item = gSave.stats.itemOnA;
u32 item = gSave.stats.itemButtons[SLOT_A];
this->field_0x68.HALF.HI = item;
item = gSave.stats.itemOnB;
item = gSave.stats.itemButtons[SLOT_B];
*(&this->field_0x68.HALF.HI + 1) = item;
}

View File

@ -176,8 +176,8 @@ u32 sub_0806DBF4(u32 param_1) {
}
void sub_0806DC3C(Entity* this) {
this->field_0x68.HALF.LO = gSave.stats.itemOnA;
this->field_0x68.HALF.HI = gSave.stats.itemOnB;
this->field_0x68.HALF.LO = gSave.stats.itemButtons[SLOT_A];
this->field_0x68.HALF.HI = gSave.stats.itemButtons[SLOT_B];
}
void sub_0806DC58(Entity* this) {

View File

@ -3424,10 +3424,10 @@ void SurfaceAction_14(Entity* this) {
void SurfaceAction_CloneTile(Entity* this) {
if (gPlayerState.field_0xa0[0] == 4) {
u32 item, n, i;
if (ItemIsSword(gSave.stats.itemOnA)) {
item = gSave.stats.itemOnA;
if (ItemIsSword(gSave.stats.itemButtons[SLOT_A])) {
item = gSave.stats.itemButtons[SLOT_A];
} else {
item = gSave.stats.itemOnB;
item = gSave.stats.itemButtons[SLOT_B];
}
switch (item) {
case 1:

View File

@ -88,8 +88,7 @@ static const SaveFile gDemoSave = {
.stats = {
.health = 40,
.maxHealth = 40,
.itemOnA = ITEM_SHIELD,
.itemOnB = ITEM_SMITH_SWORD,
.itemButtons = { ITEM_SHIELD, ITEM_SMITH_SWORD },
.rupees = 5,
},
.fillerD0 = {