From e4c16fd03c4a010d0b0e78b329a848c38353e7b8 Mon Sep 17 00:00:00 2001 From: Robin Avery Date: Wed, 21 Feb 2024 22:41:08 -0500 Subject: [PATCH] Clean up struct definition --- src/melee/it/itCommonItems.h | 12 ++++++------ src/melee/it/items/itegg.c | 18 ++++++------------ 2 files changed, 12 insertions(+), 18 deletions(-) diff --git a/src/melee/it/itCommonItems.h b/src/melee/it/itCommonItems.h index ee87573c94..9732bf3e22 100644 --- a/src/melee/it/itCommonItems.h +++ b/src/melee/it/itCommonItems.h @@ -75,12 +75,12 @@ typedef struct { u32 x0; } ItLGunVars; -typedef struct EggVars // Eggs spawned on Yoshi stages / by Chansey -{ - bool x0; - int rand_max; - u8 filler[0x58]; - s32 xE34_heal; +/// Eggs spawned on Yoshi stages / by Chansey +typedef struct EggVars { + /* +0 */ bool x0; + /* +4 */ int rand_max; + /* +8 */ u8 _8[0x60 - 0x8]; + /* +60 */ int heal_amount; } EggVars; typedef struct WhispyAppleVars { diff --git a/src/melee/it/items/itegg.c b/src/melee/it/items/itegg.c index dfcfb7f1e6..c8fc771b62 100644 --- a/src/melee/it/items/itegg.c +++ b/src/melee/it/items/itegg.c @@ -89,8 +89,8 @@ void it_80288D98(Item_GObj* gobj) bool it_80288DC4(Item_GObj* gobj) { Item* ip = GET_ITEM(gobj); - struct EggVars* vars = ip->xC4_article_data->x4_specialAttributes; - if (HSD_Randi(vars->rand_max) == 0) { + EggVars* attrs = ip->xC4_article_data->x4_specialAttributes; + if (HSD_Randi(attrs->rand_max) == 0) { return true; } @@ -102,7 +102,7 @@ bool it_80288DC4(Item_GObj* gobj) } } - it_8026F3D4(gobj, 0, vars->x0, 0); + it_8026F3D4(gobj, 0, attrs->x0, 0); return false; } @@ -236,15 +236,9 @@ void it_80289158(Item_GObj* gobj) bool it_802891E0(Item_GObj* gobj) { - Item* item = GET_ITEM(gobj); - - item->xDD4_itemVar.Egg.rand_max -= 1; - - if (item->xDD4_itemVar.Egg.rand_max > 0) { - return false; - } else { - return true; - } + Item* ip = GET_ITEM(gobj); + --ip->xDD4_itemVar.egg.rand_max; + return ip->xDD4_itemVar.egg.rand_max > 0 ? false : true; } void it_8028920C(Item_GObj* gobj) {}