Randomizer feature: Triforce Hunt (#3062)
* Initial work to make triforce pieces their own rando item * Disable triforce greyscaling * Better triforce model, finish adding triforce pieces to logic * Triforce model is now a shard * Credits warp + start of item tracker * Initial item tracker stuff * Completed triangle on triforce completion * Completed triforce model on GI done * Multiple triforce piece models * Triforce pieces in save editor & fix build * Finish item tracker * Gameplaystats timestamp * Revert parts of logic * More reverting * Start of making Triforce Hunt the win condition * Bit of cleanup * Triforce pieces can show up as icetraps * Grant GBK to player after hunt is completed * Better text boxes * Disable GBK option in ImGui with Triforce Hunt on * Clean-up * Forced save on completion improvements * Update Item Tracker Settings initial size * Small ImGui adjustments * French translation and update defaults * Finish translations * Fix timer completion & 50+ triforce pieces * Remove GI_ and ITEM_ enum usage, add french ice trap names * Fix build & small fixes * Review comments * Comment clarification
This commit is contained in:
@@ -78,6 +78,8 @@
|
||||
#include "objects/object_gi_sword_1/object_gi_sword_1.h"
|
||||
#include "objects/object_st/object_st.h"
|
||||
|
||||
#include "soh_assets.h"
|
||||
|
||||
// "Get Item" Model Draw Functions
|
||||
void GetItem_DrawMaskOrBombchu(PlayState* play, s16 drawId);
|
||||
void GetItem_DrawSoldOut(PlayState* play, s16 drawId);
|
||||
@@ -110,6 +112,7 @@ void GetItem_DrawJewelKokiri(PlayState* play, s16 drawId);
|
||||
void GetItem_DrawJewelGoron(PlayState* play, s16 drawId);
|
||||
void GetItem_DrawJewelZora(PlayState* play, s16 drawId);
|
||||
void GetItem_DrawGenericMusicNote(PlayState* play, s16 drawId);
|
||||
void GetItem_DrawTriforcePiece(PlayState* play, s16 drawId);
|
||||
|
||||
typedef struct {
|
||||
/* 0x00 */ void (*drawFunc)(PlayState*, s16);
|
||||
@@ -384,7 +387,8 @@ DrawItemTableEntry sDrawItemTable[] = {
|
||||
{ GetItem_DrawGenericMusicNote, { gGiSongNoteDL } }, //Saria's song
|
||||
{ GetItem_DrawGenericMusicNote, { gGiSongNoteDL } }, //Sun's song
|
||||
{ GetItem_DrawGenericMusicNote, { gGiSongNoteDL } }, //Song of time
|
||||
{ GetItem_DrawGenericMusicNote, { gGiSongNoteDL } } //Song of storms
|
||||
{ GetItem_DrawGenericMusicNote, { gGiSongNoteDL } }, //Song of storms
|
||||
{ GetItem_DrawTriforcePiece, { gTriforcePiece0DL } } // Triforce Piece
|
||||
};
|
||||
|
||||
/**
|
||||
@@ -1031,3 +1035,33 @@ void GetItem_DrawWallet(PlayState* play, s16 drawId) {
|
||||
|
||||
CLOSE_DISPS(play->state.gfxCtx);
|
||||
}
|
||||
|
||||
void GetItem_DrawTriforcePiece(PlayState* play, s16 drawId) {
|
||||
OPEN_DISPS(play->state.gfxCtx);
|
||||
|
||||
Gfx_SetupDL_25Opa(play->state.gfxCtx);
|
||||
|
||||
Matrix_Scale(0.035f, 0.035f, 0.035f, MTXMODE_APPLY);
|
||||
|
||||
uint16_t index = gSaveContext.triforcePiecesCollected % 3;
|
||||
Gfx* triforcePieceDL;
|
||||
|
||||
switch (index) {
|
||||
case 1:
|
||||
triforcePieceDL = (Gfx*) gTriforcePiece1DL;
|
||||
break;
|
||||
case 2:
|
||||
triforcePieceDL = (Gfx*) gTriforcePiece2DL;
|
||||
break;
|
||||
default:
|
||||
triforcePieceDL = (Gfx*) gTriforcePiece0DL;
|
||||
break;
|
||||
}
|
||||
|
||||
gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(play->state.gfxCtx, (char*)__FILE__, __LINE__),
|
||||
G_MTX_MODELVIEW | G_MTX_LOAD);
|
||||
|
||||
gSPDisplayList(POLY_OPA_DISP++, triforcePieceDL);
|
||||
|
||||
CLOSE_DISPS(play->state.gfxCtx);
|
||||
}
|
||||
|
||||
@@ -2528,6 +2528,21 @@ u16 Randomizer_Item_Give(PlayState* play, GetItemEntry giEntry) {
|
||||
return Return_Item_Entry(giEntry, RG_NONE);
|
||||
}
|
||||
|
||||
if (item == RG_TRIFORCE_PIECE) {
|
||||
gSaveContext.triforcePiecesCollected++;
|
||||
GameInteractor_SetTriforceHuntPieceGiven(true);
|
||||
|
||||
// Teleport to credits when goal is reached.
|
||||
if (gSaveContext.triforcePiecesCollected == Randomizer_GetSettingValue(RSK_TRIFORCE_HUNT_PIECES_REQUIRED)) {
|
||||
gSaveContext.sohStats.itemTimestamp[TIMESTAMP_TRIFORCE_COMPLETED] = GAMEPLAYSTAT_TOTAL_TIME;
|
||||
gSaveContext.sohStats.gameComplete = 1;
|
||||
Play_PerformSave(play);
|
||||
GameInteractor_SetTriforceHuntCreditsWarpActive(true);
|
||||
}
|
||||
|
||||
return Return_Item_Entry(giEntry, RG_NONE);
|
||||
}
|
||||
|
||||
if (item == RG_PROGRESSIVE_BOMBCHUS) {
|
||||
if (INV_CONTENT(ITEM_BOMBCHU) == ITEM_NONE) {
|
||||
INV_CONTENT(ITEM_BOMBCHU) = ITEM_BOMBCHU;
|
||||
|
||||
@@ -2318,7 +2318,10 @@ void Play_PerformSave(PlayState* play) {
|
||||
} else {
|
||||
Save_SaveFile();
|
||||
}
|
||||
if (CVarGetInteger("gAutosave", AUTOSAVE_OFF) != AUTOSAVE_OFF) {
|
||||
uint8_t triforceHuntCompleted =
|
||||
gSaveContext.n64ddFlag && gSaveContext.triforcePiecesCollected == Randomizer_GetSettingValue(RSK_TRIFORCE_HUNT_PIECES_REQUIRED) &&
|
||||
Randomizer_GetSettingValue(RSK_TRIFORCE_HUNT);
|
||||
if (CVarGetInteger("gAutosave", AUTOSAVE_OFF) != AUTOSAVE_OFF || triforceHuntCompleted) {
|
||||
Overlay_DisplayText(3.0f, "Game Saved");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -7,6 +7,7 @@
|
||||
#include "overlays/actors/ovl_Demo_Effect/z_demo_effect.h"
|
||||
|
||||
#include "soh/Enhancements/game-interactor/GameInteractor.h"
|
||||
#include "soh/Enhancements/randomizer/draw.h"
|
||||
|
||||
#include <stdlib.h>
|
||||
|
||||
@@ -1292,6 +1293,8 @@ void Player_DrawGetItemImpl(PlayState* play, Player* this, Vec3f* refPos, s32 dr
|
||||
|
||||
if (this->getItemEntry.modIndex == MOD_RANDOMIZER && this->getItemEntry.getItemId == RG_ICE_TRAP) {
|
||||
Player_DrawGetItemIceTrap(play, this, refPos, drawIdPlusOne, height);
|
||||
} else if (this->getItemEntry.modIndex == MOD_RANDOMIZER && this->getItemEntry.getItemId == RG_TRIFORCE_PIECE) {
|
||||
Randomizer_DrawTriforcePieceGI(play, this->getItemEntry);
|
||||
} else if (this->getItemEntry.drawFunc != NULL) {
|
||||
this->getItemEntry.drawFunc(play, &this->getItemEntry);
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user