Skip to content

Commit

Permalink
update and use EggVars
Browse files Browse the repository at this point in the history
  • Loading branch information
wyatt-avilla committed Feb 22, 2024
1 parent d030f29 commit f4cac4c
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 12 deletions.
4 changes: 3 additions & 1 deletion src/melee/it/itCommonItems.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down
16 changes: 5 additions & 11 deletions src/melee/it/items/itegg.c
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,6 @@
#include <baselib/gobj.h>
#include <baselib/random.h>

/// @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);
Expand Down Expand Up @@ -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;
}

Expand All @@ -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;
}

Expand Down Expand Up @@ -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;
Expand Down

0 comments on commit f4cac4c

Please sign in to comment.