Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Restructure event flags in z64save.h (3/?): Cursed Family Rewards #2392

Merged
merged 2 commits into from
Dec 29, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions include/z64save.h
Original file line number Diff line number Diff line change
Expand Up @@ -638,12 +638,12 @@ typedef enum LinkAge {
#define EVENTCHKINF_SONGS_FOR_FROGS_STORMS 0xD6

// EVENTCHKINF 0xDA-0xDE
#define EVENTCHKINF_INDEX_DA_DB_DC_DD_DE EVENTCHKINF_INDEX(EVENTCHKINF_DA)
#define EVENTCHKINF_DA 0xDA
#define EVENTCHKINF_DB 0xDB
#define EVENTCHKINF_DC 0xDC
#define EVENTCHKINF_DD 0xDD
#define EVENTCHKINF_DE 0xDE
#define EVENTCHKINF_INDEX_SKULLTULA_REWARD 0xD
#define EVENTCHKINF_SKULLTULA_REWARD_10 0xDA
#define EVENTCHKINF_SKULLTULA_REWARD_20 0xDB
#define EVENTCHKINF_SKULLTULA_REWARD_30 0xDC
#define EVENTCHKINF_SKULLTULA_REWARD_40 0xDD
#define EVENTCHKINF_SKULLTULA_REWARD_50 0xDE


/*
Expand Down
32 changes: 15 additions & 17 deletions src/overlays/actors/ovl_En_Sth/z_en_sth.c
Original file line number Diff line number Diff line change
Expand Up @@ -75,23 +75,17 @@ static EnSthActionFunc sRewardObtainedWaitActions[6] = {

static u16 sEventFlags[6] = {
0,
EVENTCHKINF_MASK(EVENTCHKINF_DA),
EVENTCHKINF_MASK(EVENTCHKINF_DB),
EVENTCHKINF_MASK(EVENTCHKINF_DC),
EVENTCHKINF_MASK(EVENTCHKINF_DD),
EVENTCHKINF_MASK(EVENTCHKINF_DE),
EVENTCHKINF_MASK(EVENTCHKINF_SKULLTULA_REWARD_10),
EVENTCHKINF_MASK(EVENTCHKINF_SKULLTULA_REWARD_20),
EVENTCHKINF_MASK(EVENTCHKINF_SKULLTULA_REWARD_30),
EVENTCHKINF_MASK(EVENTCHKINF_SKULLTULA_REWARD_40),
EVENTCHKINF_MASK(EVENTCHKINF_SKULLTULA_REWARD_50),
};

static s16 sGetItemIds[6] = {
GI_RUPEE_GOLD, GI_WALLET_ADULT, GI_STONE_OF_AGONY, GI_WALLET_GIANT, GI_BOMBCHUS_10, GI_HEART_PIECE,
};

static Vec3f D_80B0B49C = { 700.0f, 400.0f, 0.0f };

static Color_RGB8 sTunicColors[6] = {
{ 190, 110, 0 }, { 0, 180, 110 }, { 0, 255, 80 }, { 255, 160, 60 }, { 190, 230, 250 }, { 240, 230, 120 },
};

void EnSth_SetupAction(EnSth* this, EnSthActionFunc actionFunc) {
this->actionFunc = actionFunc;
}
Expand Down Expand Up @@ -119,7 +113,7 @@ void EnSth_Init(Actor* thisx, PlayState* play) {
}

objectId = sObjectIds[params];
if (objectId != 1) {
if (objectId != OBJECT_GAMEPLAY_KEEP) {
objectSlot = Object_GetSlot(&play->objectCtx, objectId);
} else {
objectSlot = 0;
Expand Down Expand Up @@ -159,9 +153,9 @@ void EnSth_SetupAfterObjectLoaded(EnSth* this, PlayState* play) {
16);
Animation_PlayLoop(&this->skelAnime, sAnimations[this->actor.params]);

this->eventFlag = sEventFlags[this->actor.params];
params = &this->actor.params;
if (gSaveContext.save.info.eventChkInf[EVENTCHKINF_INDEX_DA_DB_DC_DD_DE] & this->eventFlag) {
this->eventFlag = sEventFlags[*params];
if (gSaveContext.save.info.eventChkInf[EVENTCHKINF_INDEX_SKULLTULA_REWARD] & this->eventFlag) {
EnSth_SetupAction(this, sRewardObtainedWaitActions[*params]);
} else {
EnSth_SetupAction(this, EnSth_RewardUnobtainedWait);
Expand Down Expand Up @@ -261,7 +255,7 @@ void EnSth_GiveReward(EnSth* this, PlayState* play) {
if (Actor_HasParent(&this->actor, play)) {
this->actor.parent = NULL;
EnSth_SetupAction(this, EnSth_RewardObtainedTalk);
gSaveContext.save.info.eventChkInf[EVENTCHKINF_INDEX_DA_DB_DC_DD_DE] |= this->eventFlag;
gSaveContext.save.info.eventChkInf[EVENTCHKINF_INDEX_SKULLTULA_REWARD] |= this->eventFlag;
} else {
EnSth_GivePlayerItem(this, play);
}
Expand Down Expand Up @@ -363,6 +357,7 @@ s32 EnSth_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* p
}

void EnSth_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot, void* thisx) {
static Vec3f D_80B0B49C = { 700.0f, 400.0f, 0.0f };
EnSth* this = (EnSth*)thisx;

if (limbIndex == 15) {
Expand All @@ -388,6 +383,9 @@ Gfx* EnSth_AllocColorDList(GraphicsContext* play, u8 envR, u8 envG, u8 envB, u8
}

void EnSth_Draw(Actor* thisx, PlayState* play) {
static Color_RGB8 sShirtColors[6] = {
{ 190, 110, 0 }, { 0, 180, 110 }, { 0, 255, 80 }, { 255, 160, 60 }, { 190, 230, 250 }, { 240, 230, 120 },
};
EnSth* this = (EnSth*)thisx;
Color_RGB8* envColor1;

Expand All @@ -397,8 +395,8 @@ void EnSth_Draw(Actor* thisx, PlayState* play) {
Gfx_SetupDL_37Opa(play->state.gfxCtx);

gSPSegment(POLY_OPA_DISP++, 0x08,
EnSth_AllocColorDList(play->state.gfxCtx, sTunicColors[this->actor.params].r,
sTunicColors[this->actor.params].g, sTunicColors[this->actor.params].b, 255));
EnSth_AllocColorDList(play->state.gfxCtx, sShirtColors[this->actor.params].r,
sShirtColors[this->actor.params].g, sShirtColors[this->actor.params].b, 255));

if (this->actor.params == 0) {
gSPSegment(POLY_OPA_DISP++, 0x09, EnSth_AllocColorDList(play->state.gfxCtx, 190, 110, 0, 255));
Expand Down