From f4cac4c1337efe838d239063610da8d80b7f759c Mon Sep 17 00:00:00 2001 From: wyatt-avilla Date: Wed, 21 Feb 2024 19:32:03 -0800 Subject: [PATCH] update and use `EggVars` --- src/melee/it/itCommonItems.h | 4 +++- src/melee/it/items/itegg.c | 16 +++++----------- 2 files changed, 8 insertions(+), 12 deletions(-) diff --git a/src/melee/it/itCommonItems.h b/src/melee/it/itCommonItems.h index 9bff08921f..ee87573c94 100644 --- a/src/melee/it/itCommonItems.h +++ b/src/melee/it/itCommonItems.h @@ -77,7 +77,9 @@ typedef struct { typedef struct EggVars // Eggs spawned on Yoshi stages / by Chansey { - u8 filler[0x60]; + bool x0; + int rand_max; + u8 filler[0x58]; s32 xE34_heal; } EggVars; diff --git a/src/melee/it/items/itegg.c b/src/melee/it/items/itegg.c index 859327b1c3..a2caf1c307 100644 --- a/src/melee/it/items/itegg.c +++ b/src/melee/it/items/itegg.c @@ -11,12 +11,6 @@ #include #include -/// @todo Might be #EggVars -struct ItEggAttrs { - /* +0 */ bool x0; - /* +4 */ int rand_max; -}; - /* 288DC4 */ static bool it_80288DC4(Item_GObj* gobj); /* 288E6C */ static void it_80288E6C(Item_GObj* gobj); /* 288EC4 */ static bool it_80288EC4(HSD_GObj* gobj); @@ -98,8 +92,8 @@ void it_80288D98(Item_GObj* gobj) bool it_80288DC4(Item_GObj* gobj) { Item* ip = GET_ITEM(gobj); - struct ItEggAttrs* attrs = ip->xC4_article_data->x4_specialAttributes; - if (HSD_Randi(attrs->rand_max) == 0) { + struct EggVars* vars = ip->xC4_article_data->x4_specialAttributes; + if (HSD_Randi(vars->rand_max) == 0) { return true; } @@ -111,7 +105,7 @@ bool it_80288DC4(Item_GObj* gobj) } } - it_8026F3D4(gobj, 0, attrs->x0, 0); + it_8026F3D4(gobj, 0, vars->x0, 0); return false; } @@ -247,9 +241,9 @@ bool it_802891E0(HSD_GObj* gobj) { Item* item = GET_ITEM(gobj); - *((s32*) &item->xDD4_itemVar.Egg.filler[4]) -= 1; + item->xDD4_itemVar.Egg.rand_max -= 1; - if (*((s32*) &item->xDD4_itemVar.Egg.filler[4]) > 0) { + if (item->xDD4_itemVar.Egg.rand_max > 0) { return false; } else { return true;