diff options
| author | aMannus <mannusmenting@gmail.com> | 2023-09-26 15:45:37 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2023-09-26 08:45:37 -0500 |
| commit | bae6cf420374a2ab15059e359e57f5de43c9776c (patch) | |
| tree | 0d9e100f9e8d85a044f926ac01221f90a94e9059 /soh/src/code | |
| parent | ccd05d8e58e9af92fa05d6e882e2ff6fde7bbcdd (diff) | |
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
Diffstat (limited to 'soh/src/code')
| -rw-r--r-- | soh/src/code/z_draw.c | 36 | ||||
| -rw-r--r-- | soh/src/code/z_parameter.c | 15 | ||||
| -rw-r--r-- | soh/src/code/z_play.c | 5 | ||||
| -rw-r--r-- | soh/src/code/z_player_lib.c | 3 |
4 files changed, 57 insertions, 2 deletions
diff --git a/soh/src/code/z_draw.c b/soh/src/code/z_draw.c index 7c6b71c6c..cb28a498e 100644 --- a/soh/src/code/z_draw.c +++ b/soh/src/code/z_draw.c @@ -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); +} diff --git a/soh/src/code/z_parameter.c b/soh/src/code/z_parameter.c index 82cb8a6b6..93bf8fbfd 100644 --- a/soh/src/code/z_parameter.c +++ b/soh/src/code/z_parameter.c @@ -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; diff --git a/soh/src/code/z_play.c b/soh/src/code/z_play.c index 4232bf5ea..7e480ad27 100644 --- a/soh/src/code/z_play.c +++ b/soh/src/code/z_play.c @@ -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"); } } diff --git a/soh/src/code/z_player_lib.c b/soh/src/code/z_player_lib.c index 934df5f1b..98dacc982 100644 --- a/soh/src/code/z_player_lib.c +++ b/soh/src/code/z_player_lib.c @@ -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 { |
