Merge branch 'get-item-rework-help1' of github.com:garrettjoecox/Shipwright into pr/garrettjoecox/2

This commit is contained in:
Christopher Leggett 2022-08-15 23:10:58 -04:00
commit d06b17f871
No known key found for this signature in database
GPG Key ID: 7093AE5FF7037D79
16 changed files with 92 additions and 50 deletions

View File

@ -1643,11 +1643,11 @@ extern "C" GetItemEntry Randomizer_GetItemFromKnownCheck(RandomizerCheck randomi
extern "C" bool Randomizer_ObtainedFreestandingIceTrap(RandomizerCheck randomizerCheck, GetItemID ogId, Actor* actor) { extern "C" bool Randomizer_ObtainedFreestandingIceTrap(RandomizerCheck randomizerCheck, GetItemID ogId, Actor* actor) {
return gSaveContext.n64ddFlag && (actor->parent != NULL) && return gSaveContext.n64ddFlag && (actor->parent != NULL) &&
Randomizer_GetItemFromKnownCheck(randomizerCheck, ogId).getItemId == GI_ICE_TRAP; Randomizer_GetItemFromKnownCheck(randomizerCheck, ogId).getItemId == RG_ICE_TRAP;
} }
extern "C" bool Randomizer_ItemIsIceTrap(RandomizerCheck randomizerCheck, GetItemID ogId) { extern "C" bool Randomizer_ItemIsIceTrap(RandomizerCheck randomizerCheck, GetItemID ogId) {
return gSaveContext.n64ddFlag && Randomizer_GetItemFromKnownCheck(randomizerCheck, ogId).getItemId == GI_ICE_TRAP; return gSaveContext.n64ddFlag && Randomizer_GetItemFromKnownCheck(randomizerCheck, ogId).getItemId == RG_ICE_TRAP;
} }
extern "C" CustomMessageEntry Randomizer_GetCustomGetItemMessage(GetItemID giid, char* buffer, const int maxBufferSize) { extern "C" CustomMessageEntry Randomizer_GetCustomGetItemMessage(GetItemID giid, char* buffer, const int maxBufferSize) {

View File

@ -1980,7 +1980,8 @@ s32 GiveItemEntryFromActor(Actor* actor, GlobalContext* globalCtx, GetItemEntry
if (!(player->stateFlags1 & 0x3C7080) && Player_GetExplosiveHeld(player) < 0) { if (!(player->stateFlags1 & 0x3C7080) && Player_GetExplosiveHeld(player) < 0) {
if ((((player->heldActor != NULL) || (actor == player->targetActor)) && if ((((player->heldActor != NULL) || (actor == player->targetActor)) &&
((!gSaveContext.n64ddFlag && ((getItemEntry.getItemId > GI_NONE) && (getItemEntry.getItemId < GI_MAX))) || (gSaveContext.n64ddFlag && ((getItemEntry.getItemId > RG_NONE) && (getItemEntry.getItemId < RG_MAX))))) || ((!gSaveContext.n64ddFlag && ((getItemEntry.getItemId > GI_NONE) && (getItemEntry.getItemId < GI_MAX))) ||
(gSaveContext.n64ddFlag && ((getItemEntry.getItemId > RG_NONE) && (getItemEntry.getItemId < RG_MAX))))) ||
(!(player->stateFlags1 & 0x20000800))) { (!(player->stateFlags1 & 0x20000800))) {
if ((actor->xzDistToPlayer < xzRange) && (fabsf(actor->yDistToPlayer) < yRange)) { if ((actor->xzDistToPlayer < xzRange) && (fabsf(actor->yDistToPlayer) < yRange)) {
s16 yawDiff = actor->yawTowardsPlayer - player->actor.shape.rot.y; s16 yawDiff = actor->yawTowardsPlayer - player->actor.shape.rot.y;

View File

@ -177,6 +177,7 @@ void EnBomBowlPit_GivePrize(EnBomBowlPit* this, GlobalContext* globalCtx) {
func_8002DF54(globalCtx, NULL, 7); func_8002DF54(globalCtx, NULL, 7);
this->getItemId = sGetItemIds[this->prizeIndex]; this->getItemId = sGetItemIds[this->prizeIndex];
this->getItemEntry = (GetItemEntry)GET_ITEM_NONE;
if ((this->getItemId == GI_BOMB_BAG_30) && (CUR_CAPACITY(UPG_BOMB_BAG) == 30)) { if ((this->getItemId == GI_BOMB_BAG_30) && (CUR_CAPACITY(UPG_BOMB_BAG) == 30)) {
this->getItemId = GI_BOMB_BAG_40; this->getItemId = GI_BOMB_BAG_40;
@ -185,20 +186,27 @@ void EnBomBowlPit_GivePrize(EnBomBowlPit* this, GlobalContext* globalCtx) {
if (gSaveContext.n64ddFlag) { if (gSaveContext.n64ddFlag) {
switch (this->prizeIndex) { switch (this->prizeIndex) {
case EXITEM_BOMB_BAG_BOWLING: case EXITEM_BOMB_BAG_BOWLING:
this->getItemId = Randomizer_GetItemFromKnownCheck(RC_MARKET_BOMBCHU_BOWLING_FIRST_PRIZE, GI_BOMB_BAG_20).getItemId; this->getItemEntry = Randomizer_GetItemFromKnownCheck(RC_MARKET_BOMBCHU_BOWLING_FIRST_PRIZE, GI_BOMB_BAG_20);
this->getItemId = this->getItemEntry.getItemId;
break; break;
case EXITEM_HEART_PIECE_BOWLING: case EXITEM_HEART_PIECE_BOWLING:
this->getItemId = Randomizer_GetItemFromKnownCheck(RC_MARKET_BOMBCHU_BOWLING_SECOND_PRIZE, GI_HEART_PIECE).getItemId; this->getItemEntry = Randomizer_GetItemFromKnownCheck(RC_MARKET_BOMBCHU_BOWLING_SECOND_PRIZE, GI_HEART_PIECE);
this->getItemId = this->getItemEntry.getItemId;
break; break;
case EXITEM_BOMBCHUS_BOWLING: case EXITEM_BOMBCHUS_BOWLING:
this->getItemId = Randomizer_GetItemFromKnownCheck(RC_MARKET_BOMBCHU_BOWLING_BOMBCHUS, GI_BOMBCHUS_10).getItemId; this->getItemEntry = Randomizer_GetItemFromKnownCheck(RC_MARKET_BOMBCHU_BOWLING_BOMBCHUS, GI_BOMBCHUS_10);
this->getItemId = this->getItemEntry.getItemId;
break; break;
} }
} }
player->stateFlags1 &= ~0x20000000; player->stateFlags1 &= ~0x20000000;
this->actor.parent = NULL; this->actor.parent = NULL;
if (!gSaveContext.n64ddFlag || this->getItemEntry.getItemId == GI_NONE) {
func_8002F434(&this->actor, globalCtx, this->getItemId, 2000.0f, 1000.0f); func_8002F434(&this->actor, globalCtx, this->getItemId, 2000.0f, 1000.0f);
} else {
GiveItemEntryFromActor(&this->actor, globalCtx, this->getItemEntry, 2000.0f, 1000.0f);
}
player->stateFlags1 |= 0x20000000; player->stateFlags1 |= 0x20000000;
this->actionFunc = EnBomBowlPit_WaitTillPrizeGiven; this->actionFunc = EnBomBowlPit_WaitTillPrizeGiven;
} }
@ -207,7 +215,11 @@ void EnBomBowlPit_WaitTillPrizeGiven(EnBomBowlPit* this, GlobalContext* globalCt
if (Actor_HasParent(&this->actor, globalCtx)) { if (Actor_HasParent(&this->actor, globalCtx)) {
this->actionFunc = EnBomBowlPit_Reset; this->actionFunc = EnBomBowlPit_Reset;
} else { } else {
if (!gSaveContext.n64ddFlag || this->getItemEntry.getItemId == GI_NONE) {
func_8002F434(&this->actor, globalCtx, this->getItemId, 2000.0f, 1000.0f); func_8002F434(&this->actor, globalCtx, this->getItemId, 2000.0f, 1000.0f);
} else {
GiveItemEntryFromActor(&this->actor, globalCtx, this->getItemEntry, 2000.0f, 1000.0f);
}
} }
} }

View File

@ -33,6 +33,7 @@ typedef struct EnBomBowlPit {
/* 0x01D4 */ Vec3f unk_1D4; // camera eye (maxsteps) /* 0x01D4 */ Vec3f unk_1D4; // camera eye (maxsteps)
/* 0x01E0 */ EnExItem* exItem; /* 0x01E0 */ EnExItem* exItem;
/* 0x01E4 */ char unk_1E4[0x3520]; /* 0x01E4 */ char unk_1E4[0x3520];
/* */ GetItemEntry getItemEntry;
} EnBomBowlPit; // size = 0x3704 } EnBomBowlPit; // size = 0x3704
#endif #endif

View File

@ -399,6 +399,7 @@ void EnExItem_TargetPrizeApproach(EnExItem* this, GlobalContext* globalCtx) {
this->actor.world.pos.z += (tmpf3 / tmpf4) * 5.0f; this->actor.world.pos.z += (tmpf3 / tmpf4) * 5.0f;
} }
} else { } else {
GetItemEntry getItemEntry = (GetItemEntry)GET_ITEM_NONE;
s32 getItemId; s32 getItemId;
this->actor.draw = NULL; this->actor.draw = NULL;
@ -406,7 +407,8 @@ void EnExItem_TargetPrizeApproach(EnExItem* this, GlobalContext* globalCtx) {
this->actor.parent = NULL; this->actor.parent = NULL;
if (gSaveContext.n64ddFlag) { if (gSaveContext.n64ddFlag) {
GET_PLAYER(globalCtx)->stateFlags1 &= ~(PLAYER_STATE1_10 | PLAYER_STATE1_11); GET_PLAYER(globalCtx)->stateFlags1 &= ~(PLAYER_STATE1_10 | PLAYER_STATE1_11);
getItemId = Randomizer_GetItemFromKnownCheck(RC_LW_TARGET_IN_WOODS, GI_BULLET_BAG_50).getItemId; getItemEntry = Randomizer_GetItemFromKnownCheck(RC_LW_TARGET_IN_WOODS, GI_BULLET_BAG_50);
getItemId = getItemEntry.getItemId;
} else { } else {
if (CUR_UPG_VALUE(UPG_BULLET_BAG) == 1) { if (CUR_UPG_VALUE(UPG_BULLET_BAG) == 1) {
getItemId = GI_BULLET_BAG_40; getItemId = GI_BULLET_BAG_40;
@ -414,24 +416,28 @@ void EnExItem_TargetPrizeApproach(EnExItem* this, GlobalContext* globalCtx) {
getItemId = GI_BULLET_BAG_50; getItemId = GI_BULLET_BAG_50;
} }
} }
if (!gSaveContext.n64ddFlag || getItemEntry.getItemId == GI_NONE) {
func_8002F434(&this->actor, globalCtx, getItemId, 2000.0f, 1000.0f); func_8002F434(&this->actor, globalCtx, getItemId, 2000.0f, 1000.0f);
} else {
GiveItemEntryFromActor(&this->actor, globalCtx, getItemEntry, 2000.0f, 1000.0f);
}
this->actionFunc = EnExItem_TargetPrizeGive; this->actionFunc = EnExItem_TargetPrizeGive;
} }
} }
void EnExItem_TargetPrizeGive(EnExItem* this, GlobalContext* globalCtx) { void EnExItem_TargetPrizeGive(EnExItem* this, GlobalContext* globalCtx) {
s32 getItemId;
if (Actor_HasParent(&this->actor, globalCtx)) { if (Actor_HasParent(&this->actor, globalCtx)) {
this->actionFunc = EnExItem_TargetPrizeFinish; this->actionFunc = EnExItem_TargetPrizeFinish;
} else { } else {
if (gSaveContext.n64ddFlag) { if (!gSaveContext.n64ddFlag) {
getItemId = Randomizer_GetItemFromKnownCheck(RC_LW_TARGET_IN_WOODS, GI_BULLET_BAG_50).getItemId; s32 getItemId = (CUR_UPG_VALUE(UPG_BULLET_BAG) == 2) ? GI_BULLET_BAG_50 : GI_BULLET_BAG_40;
func_8002F434(&this->actor, globalCtx, getItemId, 2000.0f, 1000.0f);
} else { } else {
getItemId = (CUR_UPG_VALUE(UPG_BULLET_BAG) == 2) ? GI_BULLET_BAG_50 : GI_BULLET_BAG_40; GetItemEntry getItemEntry = Randomizer_GetItemFromKnownCheck(RC_LW_TARGET_IN_WOODS, GI_BULLET_BAG_50);
GiveItemEntryFromActor(&this->actor, globalCtx, getItemEntry, 2000.0f, 1000.0f);
} }
func_8002F434(&this->actor, globalCtx, getItemId, 2000.0f, 1000.0f);
} }
} }

View File

@ -601,6 +601,7 @@ void EnFr_Idle(EnFr* this, GlobalContext* globalCtx) {
player->actor.world.pos.z = this->actor.world.pos.z; // z = -1220.0f player->actor.world.pos.z = this->actor.world.pos.z; // z = -1220.0f
player->currentYaw = player->actor.world.rot.y = player->actor.shape.rot.y = this->actor.world.rot.y; player->currentYaw = player->actor.world.rot.y = player->actor.shape.rot.y = this->actor.world.rot.y;
this->reward = GI_NONE; this->reward = GI_NONE;
this->getItemEntry = (GetItemEntry)GET_ITEM_NONE;
this->actionFunc = EnFr_Activate; this->actionFunc = EnFr_Activate;
} else if (EnFr_IsAboveAndWithin30DistXZ(player, this)) { } else if (EnFr_IsAboveAndWithin30DistXZ(player, this)) {
player->unk_6A8 = &this->actor; player->unk_6A8 = &this->actor;
@ -836,6 +837,7 @@ s32 EnFr_IsFrogSongComplete(EnFr* this, GlobalContext* globalCtx) {
void EnFr_OcarinaMistake(EnFr* this, GlobalContext* globalCtx) { void EnFr_OcarinaMistake(EnFr* this, GlobalContext* globalCtx) {
Message_CloseTextbox(globalCtx); Message_CloseTextbox(globalCtx);
this->reward = GI_NONE; this->reward = GI_NONE;
this->getItemEntry = (GetItemEntry)GET_ITEM_NONE;
func_80078884(NA_SE_SY_OCARINA_ERROR); func_80078884(NA_SE_SY_OCARINA_ERROR);
Audio_OcaSetInstrument(0); Audio_OcaSetInstrument(0);
sEnFrPointers.flags = 12; sEnFrPointers.flags = 12;
@ -927,6 +929,7 @@ void EnFr_SetReward(EnFr* this, GlobalContext* globalCtx) {
songIndex = this->songIndex; songIndex = this->songIndex;
this->actionFunc = EnFr_Deactivate; this->actionFunc = EnFr_Deactivate;
this->reward = GI_NONE; this->reward = GI_NONE;
this->getItemEntry = (GetItemEntry)GET_ITEM_NONE;
if ((songIndex >= FROG_ZL) && (songIndex <= FROG_SOT)) { if ((songIndex >= FROG_ZL) && (songIndex <= FROG_SOT)) {
if (!(gSaveContext.eventChkInf[13] & sSongIndex[songIndex])) { if (!(gSaveContext.eventChkInf[13] & sSongIndex[songIndex])) {
gSaveContext.eventChkInf[13] |= sSongIndex[songIndex]; gSaveContext.eventChkInf[13] |= sSongIndex[songIndex];
@ -940,7 +943,8 @@ void EnFr_SetReward(EnFr* this, GlobalContext* globalCtx) {
if (!gSaveContext.n64ddFlag) { if (!gSaveContext.n64ddFlag) {
this->reward = GI_HEART_PIECE; this->reward = GI_HEART_PIECE;
} else { } else {
this->reward = Randomizer_GetItemFromKnownCheck(RC_ZR_FROGS_IN_THE_RAIN, GI_HEART_PIECE).getItemId; this->getItemEntry = Randomizer_GetItemFromKnownCheck(RC_ZR_FROGS_IN_THE_RAIN, GI_HEART_PIECE);
this->reward = this->getItemEntry.getItemId;
} }
} else { } else {
this->reward = GI_RUPEE_BLUE; this->reward = GI_RUPEE_BLUE;
@ -951,7 +955,8 @@ void EnFr_SetReward(EnFr* this, GlobalContext* globalCtx) {
if (!gSaveContext.n64ddFlag) { if (!gSaveContext.n64ddFlag) {
this->reward = GI_HEART_PIECE; this->reward = GI_HEART_PIECE;
} else { } else {
this->reward = Randomizer_GetItemFromKnownCheck(RC_ZR_FROGS_OCARINA_GAME, GI_HEART_PIECE).getItemId; this->getItemEntry = Randomizer_GetItemFromKnownCheck(RC_ZR_FROGS_OCARINA_GAME, GI_HEART_PIECE);
this->reward = this->getItemEntry.getItemId;
} }
} else { } else {
this->reward = GI_RUPEE_PURPLE; this->reward = GI_RUPEE_PURPLE;
@ -1002,7 +1007,11 @@ void EnFr_Deactivate(EnFr* this, GlobalContext* globalCtx) {
this->actionFunc = EnFr_Idle; this->actionFunc = EnFr_Idle;
} else { } else {
this->actionFunc = EnFr_GiveReward; this->actionFunc = EnFr_GiveReward;
if (!gSaveContext.n64ddFlag || this->getItemEntry.getItemId == GI_NONE) {
func_8002F434(&this->actor, globalCtx, this->reward, 30.0f, 100.0f); func_8002F434(&this->actor, globalCtx, this->reward, 30.0f, 100.0f);
} else {
GiveItemEntryFromActor(&this->actor, globalCtx, this->getItemEntry, 30.0f, 100.0f);
}
} }
} }
@ -1011,7 +1020,11 @@ void EnFr_GiveReward(EnFr* this, GlobalContext* globalCtx) {
this->actor.parent = NULL; this->actor.parent = NULL;
this->actionFunc = EnFr_SetIdle; this->actionFunc = EnFr_SetIdle;
} else { } else {
if (!gSaveContext.n64ddFlag || this->getItemEntry.getItemId == GI_NONE) {
func_8002F434(&this->actor, globalCtx, this->reward, 30.0f, 100.0f); func_8002F434(&this->actor, globalCtx, this->reward, 30.0f, 100.0f);
} else {
GiveItemEntryFromActor(&this->actor, globalCtx, this->getItemEntry, 30.0f, 100.0f);
}
} }
} }

View File

@ -73,6 +73,7 @@ typedef struct EnFr {
/* 0x03AA */ s16 xyAngleButterfly; // Butterfly Travels along random angles in the x-y plane /* 0x03AA */ s16 xyAngleButterfly; // Butterfly Travels along random angles in the x-y plane
/* 0x03AC */ Vec3f posButterfly; // Position/Coordinates of the Butterfly /* 0x03AC */ Vec3f posButterfly; // Position/Coordinates of the Butterfly
/* 0x03B8 */ Vec3f posButterflyLight; // Used in Lights_PointNoGlowSetInfo() /* 0x03B8 */ Vec3f posButterflyLight; // Used in Lights_PointNoGlowSetInfo()
/* */ GetItemEntry getItemEntry;
} EnFr; // size = 0x03C4 } EnFr; // size = 0x03C4
typedef struct { typedef struct {

View File

@ -502,7 +502,7 @@ void EnGe1_SetupWait_Archery(EnGe1* this, GlobalContext* globalCtx) {
} }
void EnGe1_WaitTillItemGiven_Archery(EnGe1* this, GlobalContext* globalCtx) { void EnGe1_WaitTillItemGiven_Archery(EnGe1* this, GlobalContext* globalCtx) {
GetItemEntry getItemEntry; GetItemEntry getItemEntry = (GetItemEntry)GET_ITEM_NONE;
s32 getItemId; s32 getItemId;
if (Actor_HasParent(&this->actor, globalCtx)) { if (Actor_HasParent(&this->actor, globalCtx)) {
@ -546,7 +546,7 @@ void EnGe1_WaitTillItemGiven_Archery(EnGe1* this, GlobalContext* globalCtx) {
} }
} }
if (!gSaveContext.n64ddFlag) { if (!gSaveContext.n64ddFlag || getItemEntry.getItemId != GI_NONE) {
func_8002F434(&this->actor, globalCtx, getItemId, 10000.0f, 50.0f); func_8002F434(&this->actor, globalCtx, getItemId, 10000.0f, 50.0f);
} else { } else {
GiveItemEntryFromActor(&this->actor, globalCtx, getItemEntry, 10000.0f, 50.0f); GiveItemEntryFromActor(&this->actor, globalCtx, getItemEntry, 10000.0f, 50.0f);
@ -555,7 +555,7 @@ void EnGe1_WaitTillItemGiven_Archery(EnGe1* this, GlobalContext* globalCtx) {
} }
void EnGe1_BeginGiveItem_Archery(EnGe1* this, GlobalContext* globalCtx) { void EnGe1_BeginGiveItem_Archery(EnGe1* this, GlobalContext* globalCtx) {
GetItemEntry getItemEntry; GetItemEntry getItemEntry = (GetItemEntry)GET_ITEM_NONE;
s32 getItemId; s32 getItemId;
if (Actor_TextboxIsClosing(&this->actor, globalCtx)) { if (Actor_TextboxIsClosing(&this->actor, globalCtx)) {
@ -587,7 +587,7 @@ void EnGe1_BeginGiveItem_Archery(EnGe1* this, GlobalContext* globalCtx) {
} }
} }
if (!gSaveContext.n64ddFlag) { if (!gSaveContext.n64ddFlag || getItemEntry.getItemId != GI_NONE) {
func_8002F434(&this->actor, globalCtx, getItemId, 10000.0f, 50.0f); func_8002F434(&this->actor, globalCtx, getItemId, 10000.0f, 50.0f);
} else { } else {
GiveItemEntryFromActor(&this->actor, globalCtx, getItemEntry, 10000.0f, 50.0f); GiveItemEntryFromActor(&this->actor, globalCtx, getItemEntry, 10000.0f, 50.0f);

View File

@ -946,7 +946,7 @@ void func_80A40B1C(EnGo* this, GlobalContext* globalCtx) {
void EnGo_GetItem(EnGo* this, GlobalContext* globalCtx) { void EnGo_GetItem(EnGo* this, GlobalContext* globalCtx) {
f32 xzDist; f32 xzDist;
f32 yDist; f32 yDist;
GetItemEntry getItemEntry; GetItemEntry getItemEntry = (GetItemEntry)GET_ITEM_NONE;
s32 getItemId; s32 getItemId;
if (Actor_HasParent(&this->actor, globalCtx)) { if (Actor_HasParent(&this->actor, globalCtx)) {
@ -979,7 +979,7 @@ void EnGo_GetItem(EnGo* this, GlobalContext* globalCtx) {
yDist = fabsf(this->actor.yDistToPlayer) + 1.0f; yDist = fabsf(this->actor.yDistToPlayer) + 1.0f;
xzDist = this->actor.xzDistToPlayer + 1.0f; xzDist = this->actor.xzDistToPlayer + 1.0f;
if (!gSaveContext.n64ddFlag) { if (!gSaveContext.n64ddFlag || getItemEntry.getItemId == GI_NONE) {
func_8002F434(&this->actor, globalCtx, getItemId, xzDist, yDist); func_8002F434(&this->actor, globalCtx, getItemId, xzDist, yDist);
} else { } else {
GiveItemEntryFromActor(&this->actor, globalCtx, getItemEntry, xzDist, yDist); GiveItemEntryFromActor(&this->actor, globalCtx, getItemEntry, xzDist, yDist);

View File

@ -286,6 +286,12 @@ void EnGo2_GetItem(EnGo2* this, GlobalContext* globalCtx, s32 getItemId) {
fabsf(this->actor.yDistToPlayer) + 1.0f); fabsf(this->actor.yDistToPlayer) + 1.0f);
} }
void EnGo2_GetItemEntry(EnGo2* this, GlobalContext* globalCtx, GetItemEntry getItemEntry) {
this->getItemId = getItemEntry.getItemId;
GiveItemEntryFromActor(&this->actor, globalCtx, getItemEntry, this->actor.xzDistToPlayer + 1.0f,
fabsf(this->actor.yDistToPlayer) + 1.0f);
}
s32 EnGo2_GetDialogState(EnGo2* this, GlobalContext* globalCtx) { s32 EnGo2_GetDialogState(EnGo2* this, GlobalContext* globalCtx) {
s16 dialogState = Message_GetState(&globalCtx->msgCtx); s16 dialogState = Message_GetState(&globalCtx->msgCtx);
@ -334,8 +340,6 @@ u16 EnGo2_GetTextIdGoronCityRollingBig(GlobalContext* globalCtx, EnGo2* this) {
} }
s16 EnGo2_GetStateGoronCityRollingBig(GlobalContext* globalCtx, EnGo2* this) { s16 EnGo2_GetStateGoronCityRollingBig(GlobalContext* globalCtx, EnGo2* this) {
s32 bombBagUpgrade;
switch (Message_GetState(&globalCtx->msgCtx)) { switch (Message_GetState(&globalCtx->msgCtx)) {
case TEXT_STATE_CLOSING: case TEXT_STATE_CLOSING:
return 2; return 2;
@ -344,11 +348,10 @@ s16 EnGo2_GetStateGoronCityRollingBig(GlobalContext* globalCtx, EnGo2* this) {
if (this->actor.textId == 0x3012) { if (this->actor.textId == 0x3012) {
this->actionFunc = EnGo2_SetupGetItem; this->actionFunc = EnGo2_SetupGetItem;
if(!gSaveContext.n64ddFlag) { if(!gSaveContext.n64ddFlag) {
bombBagUpgrade = CUR_CAPACITY(UPG_BOMB_BAG) == 30 ? GI_BOMB_BAG_40 : GI_BOMB_BAG_30; EnGo2_GetItem(this, globalCtx, CUR_CAPACITY(UPG_BOMB_BAG) == 30 ? GI_BOMB_BAG_40 : GI_BOMB_BAG_30);
} else { } else {
bombBagUpgrade = Randomizer_GetItemFromKnownCheck(RC_GC_ROLLING_GORON_AS_CHILD, GI_BOMB_BAG_40).getItemId; EnGo2_GetItemEntry(this, globalCtx, Randomizer_GetItemFromKnownCheck(RC_GC_ROLLING_GORON_AS_CHILD, GI_BOMB_BAG_40));
} }
EnGo2_GetItem(this, globalCtx, bombBagUpgrade);
Message_CloseTextbox(globalCtx); Message_CloseTextbox(globalCtx);
gSaveContext.infTable[17] |= 0x4000; gSaveContext.infTable[17] |= 0x4000;
return 2; return 2;
@ -542,7 +545,7 @@ s16 EnGo2_GetStateGoronCityLink(GlobalContext* globalCtx, EnGo2* this) {
} }
gSaveContext.infTable[16] |= 0x200; gSaveContext.infTable[16] |= 0x200;
EnGo2_GetItem(this, globalCtx, Randomizer_GetItemFromKnownCheck(RC_GC_ROLLING_GORON_AS_ADULT, GI_TUNIC_GORON).getItemId); EnGo2_GetItemEntry(this, globalCtx, Randomizer_GetItemFromKnownCheck(RC_GC_ROLLING_GORON_AS_ADULT, GI_TUNIC_GORON));
this->actionFunc = EnGo2_SetupGetItem; this->actionFunc = EnGo2_SetupGetItem;
Flags_SetTreasure(globalCtx, 0x1F); Flags_SetTreasure(globalCtx, 0x1F);
return 2; return 2;
@ -621,7 +624,7 @@ s16 EnGo2_GetStateGoronDmtBiggoron(GlobalContext* globalCtx, EnGo2* this) {
return 0; return 0;
} }
EnGo2_GetItem(this, globalCtx, Randomizer_GetItemFromKnownCheck(RC_DMT_TRADE_CLAIM_CHECK, GI_SWORD_BGS).getItemId); EnGo2_GetItemEntry(this, globalCtx, Randomizer_GetItemFromKnownCheck(RC_DMT_TRADE_CLAIM_CHECK, GI_SWORD_BGS));
Flags_SetTreasure(globalCtx, 0x1F); Flags_SetTreasure(globalCtx, 0x1F);
} else { } else {
EnGo2_GetItem(this, globalCtx, GI_SWORD_BGS); EnGo2_GetItem(this, globalCtx, GI_SWORD_BGS);

View File

@ -666,6 +666,7 @@ s16 func_80A70058(GlobalContext* globalCtx, Actor* thisx) {
func_80A6F7CC(this, globalCtx, GI_HEART_PIECE); func_80A6F7CC(this, globalCtx, GI_HEART_PIECE);
} else { } else {
GetItemEntry getItemEntry = Randomizer_GetItemFromKnownCheck(RC_MARKET_LOST_DOG, GI_HEART_PIECE); GetItemEntry getItemEntry = Randomizer_GetItemFromKnownCheck(RC_MARKET_LOST_DOG, GI_HEART_PIECE);
// The follownig line and last arguments of GiveItemEntryFromActor are copied from func_80A6F7CC
this->unkGetItemId = getItemEntry.getItemId; this->unkGetItemId = getItemEntry.getItemId;
GiveItemEntryFromActor(&this->actor, globalCtx, getItemEntry, this->actor.xzDistToPlayer + 1.0f, fabsf(this->actor.yDistToPlayer) + 1.0f); GiveItemEntryFromActor(&this->actor, globalCtx, getItemEntry, this->actor.xzDistToPlayer + 1.0f, fabsf(this->actor.yDistToPlayer) + 1.0f);
} }

View File

@ -453,7 +453,7 @@ void EnKz_Wait(EnKz* this, GlobalContext* globalCtx) {
} }
void EnKz_SetupGetItem(EnKz* this, GlobalContext* globalCtx) { void EnKz_SetupGetItem(EnKz* this, GlobalContext* globalCtx) {
GetItemEntry getItemEntry; GetItemEntry getItemEntry = (GetItemEntry)GET_ITEM_NONE;
s32 getItemId; s32 getItemId;
f32 xzRange; f32 xzRange;
f32 yRange; f32 yRange;
@ -477,7 +477,7 @@ void EnKz_SetupGetItem(EnKz* this, GlobalContext* globalCtx) {
} }
yRange = fabsf(this->actor.yDistToPlayer) + 1.0f; yRange = fabsf(this->actor.yDistToPlayer) + 1.0f;
xzRange = this->actor.xzDistToPlayer + 1.0f; xzRange = this->actor.xzDistToPlayer + 1.0f;
if (!gSaveContext.n64ddFlag) { if (!gSaveContext.n64ddFlag || getItemEntry.getItemId == GI_NONE) {
func_8002F434(&this->actor, globalCtx, getItemId, xzRange, yRange); func_8002F434(&this->actor, globalCtx, getItemId, xzRange, yRange);
} else { } else {
GiveItemEntryFromActor(&this->actor, globalCtx, getItemEntry, xzRange, yRange); GiveItemEntryFromActor(&this->actor, globalCtx, getItemEntry, xzRange, yRange);

View File

@ -304,12 +304,13 @@ void func_80ABA654(EnNiwLady* this, GlobalContext* globalCtx) {
if (!(gSaveContext.itemGetInf[0] & 0x1000)) { if (!(gSaveContext.itemGetInf[0] & 0x1000)) {
this->actor.parent = NULL; this->actor.parent = NULL;
if (gSaveContext.n64ddFlag) { if (!gSaveContext.n64ddFlag) {
GetItemEntry getItemEntry = Randomizer_GetItemFromKnownCheck(RC_KAK_ANJU_AS_CHILD, GI_BOTTLE);
func_8002F434(&this->actor, globalCtx, getItemEntry.getItemId, 100.0f, 50.0f);
} else {
this->getItemId = GI_BOTTLE; this->getItemId = GI_BOTTLE;
func_8002F434(&this->actor, globalCtx, GI_BOTTLE, 100.0f, 50.0f); func_8002F434(&this->actor, globalCtx, GI_BOTTLE, 100.0f, 50.0f);
} else {
GetItemEntry getItemEntry = Randomizer_GetItemFromKnownCheck(RC_KAK_ANJU_AS_CHILD, GI_BOTTLE);
this->getItemId = getItemEntry.getItemId;
GiveItemEntryFromActor(&this->actor, globalCtx, getItemEntry, 100.0f, 50.0f);
} }
this->actionFunc = func_80ABAC00; this->actionFunc = func_80ABAC00;
@ -394,11 +395,12 @@ void func_80ABA9B8(EnNiwLady* this, GlobalContext* globalCtx) {
Message_CloseTextbox(globalCtx); Message_CloseTextbox(globalCtx);
this->actor.parent = NULL; this->actor.parent = NULL;
if (gSaveContext.n64ddFlag) { if (!gSaveContext.n64ddFlag) {
GetItemEntry getItemEntry = Randomizer_GetItemFromKnownCheck(RC_KAK_ANJU_AS_ADULT, GI_POCKET_EGG);
func_8002F434(&this->actor, globalCtx, getItemEntry.getItemId, 200.0f, 100.0f);
} else {
func_8002F434(&this->actor, globalCtx, GI_POCKET_EGG, 200.0f, 100.0f); func_8002F434(&this->actor, globalCtx, GI_POCKET_EGG, 200.0f, 100.0f);
} else {
// TODO: get-item-rework Adult trade sequence
GetItemEntry getItemEntry = Randomizer_GetItemFromKnownCheck(RC_KAK_ANJU_AS_ADULT, GI_POCKET_EGG);
GiveItemEntryFromActor(&this->actor, globalCtx, getItemEntry, 200.0f, 100.0f);
} }
this->actionFunc = func_80ABAC00; this->actionFunc = func_80ABAC00;
@ -455,6 +457,7 @@ void func_80ABAC00(EnNiwLady* this, GlobalContext* globalCtx) {
getItemId = !(gSaveContext.itemGetInf[2] & 0x1000) ? GI_POCKET_EGG : GI_COJIRO; getItemId = !(gSaveContext.itemGetInf[2] & 0x1000) ? GI_POCKET_EGG : GI_COJIRO;
if (gSaveContext.n64ddFlag && getItemId == GI_POCKET_EGG) { if (gSaveContext.n64ddFlag && getItemId == GI_POCKET_EGG) {
// TODO: get-item-rework Adult trade sequence
getItemId = Randomizer_GetItemFromKnownCheck(RC_KAK_ANJU_AS_ADULT, GI_POCKET_EGG).getItemId; getItemId = Randomizer_GetItemFromKnownCheck(RC_KAK_ANJU_AS_ADULT, GI_POCKET_EGG).getItemId;
} }
} }

View File

@ -239,7 +239,7 @@ void EnSth_ParentRewardObtainedWait(EnSth* this, GlobalContext* globalCtx) {
void EnSth_GivePlayerItem(EnSth* this, GlobalContext* globalCtx) { void EnSth_GivePlayerItem(EnSth* this, GlobalContext* globalCtx) {
u16 getItemId = sGetItemIds[this->actor.params]; u16 getItemId = sGetItemIds[this->actor.params];
GetItemEntry getItemEntry; GetItemEntry getItemEntry = (GetItemEntry)GET_ITEM_NONE;
if (gSaveContext.n64ddFlag) { if (gSaveContext.n64ddFlag) {
switch (getItemId) { switch (getItemId) {
@ -279,7 +279,7 @@ void EnSth_GivePlayerItem(EnSth* this, GlobalContext* globalCtx) {
} }
} }
if (!gSaveContext.n64ddFlag) { if (!gSaveContext.n64ddFlag || getItemEntry.getItemId == GI_NONE) {
func_8002F434(&this->actor, globalCtx, getItemId, 10000.0f, 50.0f); func_8002F434(&this->actor, globalCtx, getItemId, 10000.0f, 50.0f);
} else { } else {
GiveItemEntryFromActor(&this->actor, globalCtx, getItemEntry, 10000.0f, 50.0f); GiveItemEntryFromActor(&this->actor, globalCtx, getItemEntry, 10000.0f, 50.0f);

View File

@ -169,6 +169,7 @@ void EnSyatekiMan_Init(Actor* thisx, GlobalContext* globalCtx) {
this->blinkFunc = EnSyatekiMan_BlinkWait; this->blinkFunc = EnSyatekiMan_BlinkWait;
this->actor.colChkInfo.cylRadius = 100; this->actor.colChkInfo.cylRadius = 100;
this->actionFunc = EnSyatekiMan_Start; this->actionFunc = EnSyatekiMan_Start;
this->getItemEntry = (GetItemEntry)GET_ITEM_NONE;
} }
void EnSyatekiMan_Destroy(Actor* thisx, GlobalContext* globalCtx) { void EnSyatekiMan_Destroy(Actor* thisx, GlobalContext* globalCtx) {
@ -373,7 +374,7 @@ void EnSyatekiMan_EndGame(EnSyatekiMan* this, GlobalContext* globalCtx) {
this->getItemId = GI_RUPEE_PURPLE; this->getItemId = GI_RUPEE_PURPLE;
} }
} }
if (!gSaveContext.n64ddFlag) { if (!gSaveContext.n64ddFlag || this->getItemEntry.getItemId == GI_NONE) {
func_8002F434(&this->actor, globalCtx, this->getItemId, 2000.0f, 1000.0f); func_8002F434(&this->actor, globalCtx, this->getItemId, 2000.0f, 1000.0f);
} else { } else {
GiveItemEntryFromActor(&this->actor, globalCtx, this->getItemEntry, 2000.0f, 1000.0f); GiveItemEntryFromActor(&this->actor, globalCtx, this->getItemEntry, 2000.0f, 1000.0f);
@ -406,7 +407,7 @@ void EnSyatekiMan_GivePrize(EnSyatekiMan* this, GlobalContext* globalCtx) {
if (Actor_HasParent(&this->actor, globalCtx)) { if (Actor_HasParent(&this->actor, globalCtx)) {
this->actionFunc = EnSyatekiMan_FinishPrize; this->actionFunc = EnSyatekiMan_FinishPrize;
} else { } else {
if (!gSaveContext.n64ddFlag) { if (!gSaveContext.n64ddFlag || this->getItemEntry.getItemId == GI_NONE) {
func_8002F434(&this->actor, globalCtx, this->getItemId, 2000.0f, 1000.0f); func_8002F434(&this->actor, globalCtx, this->getItemId, 2000.0f, 1000.0f);
} else { } else {
GiveItemEntryFromActor(&this->actor, globalCtx, this->getItemEntry, 2000.0f, 1000.0f); GiveItemEntryFromActor(&this->actor, globalCtx, this->getItemEntry, 2000.0f, 1000.0f);

View File

@ -5002,7 +5002,7 @@ void Fishing_HandleOwnerDialog(Fishing* this, GlobalContext* globalCtx) {
(Message_GetState(&globalCtx->msgCtx) == TEXT_STATE_NONE)) && (Message_GetState(&globalCtx->msgCtx) == TEXT_STATE_NONE)) &&
Message_ShouldAdvance(globalCtx)) { Message_ShouldAdvance(globalCtx)) {
s32 getItemId; s32 getItemId;
GetItemEntry getItemEntry; GetItemEntry getItemEntry = (GetItemEntry)GET_ITEM_NONE;
Message_CloseTextbox(globalCtx); Message_CloseTextbox(globalCtx);
@ -5085,7 +5085,7 @@ void Fishing_HandleOwnerDialog(Fishing* this, GlobalContext* globalCtx) {
} }
this->actor.parent = NULL; this->actor.parent = NULL;
if (!gSaveContext.n64ddFlag) { if (!gSaveContext.n64ddFlag || getItemEntry.getItemId == GI_NONE) {
func_8002F434(&this->actor, globalCtx, getItemId, 2000.0f, 1000.0f); func_8002F434(&this->actor, globalCtx, getItemId, 2000.0f, 1000.0f);
} else { } else {
GiveItemEntryFromActor(&this->actor, globalCtx, getItemEntry, 2000.0f, 1000.0f); GiveItemEntryFromActor(&this->actor, globalCtx, getItemEntry, 2000.0f, 1000.0f);