diff options
| author | briaguya <70942617+briaguya-ai@users.noreply.github.com> | 2022-12-21 03:46:12 -0500 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2022-12-21 03:46:12 -0500 |
| commit | 5ce4e75bd2e3ec6a7003c6b33a07487aafcdc78e (patch) | |
| tree | a9beb83e8985eb0624b6b865f163bea4b0007d53 /soh/src/code | |
| parent | 4d8c70fb1f9bd1cfba0b65fb3e38e2aac39a65a2 (diff) | |
| parent | 0e7a89d1174a9080d1d88e9556e6b11e4ab8726e (diff) | |
Merge pull request #2227 from HarbourMasters/develop-bradley
bradley -> dev
Diffstat (limited to 'soh/src/code')
| -rw-r--r-- | soh/src/code/code_800F9280.c | 14 | ||||
| -rw-r--r-- | soh/src/code/z_actor.c | 4 | ||||
| -rw-r--r-- | soh/src/code/z_draw.c | 13 | ||||
| -rw-r--r-- | soh/src/code/z_player_lib.c | 50 |
4 files changed, 68 insertions, 13 deletions
diff --git a/soh/src/code/code_800F9280.c b/soh/src/code/code_800F9280.c index 49ca751f1..2a051beca 100644 --- a/soh/src/code/code_800F9280.c +++ b/soh/src/code/code_800F9280.c @@ -8,6 +8,8 @@ typedef struct { u8 unk_1; // importance? } Struct_8016E320; +#define GET_PLAYER_IDX(cmd) (cmd & 0xF000000) >> 24 + Struct_8016E320 D_8016E320[4][5]; u8 D_8016E348[4]; u32 sAudioSeqCmds[0x100]; @@ -122,7 +124,7 @@ void Audio_ProcessSeqCmd(u32 cmd) { } op = cmd >> 28; - playerIdx = (cmd & 0xF000000) >> 24; + playerIdx = GET_PLAYER_IDX(cmd); switch (op) { case 0x0: @@ -371,12 +373,12 @@ void Audio_QueueSeqCmd(u32 cmd) u8 op = cmd >> 28; if (op == 0 || op == 2 || op == 12) { u8 seqId = cmd & 0xFF; - u8 playerIdx = (cmd >> 24) & 0xFF; + u8 playerIdx = GET_PLAYER_IDX(cmd); u16 newSeqId = SfxEditor_GetReplacementSeq(seqId); - gAudioContext.seqReplaced[playerIdx] = (seqId != newSeqId); - gAudioContext.seqToPlay[playerIdx] = newSeqId; - cmd |= (seqId & 0xFF); - } + gAudioContext.seqReplaced[playerIdx] = (seqId != newSeqId); + gAudioContext.seqToPlay[playerIdx] = newSeqId; + cmd |= (seqId & 0xFF); + } sAudioSeqCmds[sSeqCmdWrPos++] = cmd; } diff --git a/soh/src/code/z_actor.c b/soh/src/code/z_actor.c index 74dd031b2..c4e89adf7 100644 --- a/soh/src/code/z_actor.c +++ b/soh/src/code/z_actor.c @@ -78,6 +78,9 @@ static CollisionPoly* sCurCeilingPoly; static s32 sCurCeilingBgId; +// Used for animating the ice trap on the "Get Item" model. +f32 iceTrapScale; + void ActorShape_Init(ActorShape* shape, f32 yOffset, ActorShadowFunc shadowDraw, f32 shadowScale) { shape->yOffset = yOffset; shape->shadowDraw = shadowDraw; @@ -2030,6 +2033,7 @@ s32 GiveItemEntryFromActor(Actor* actor, PlayState* play, GetItemEntry getItemEn s32 absYawDiff = ABS(yawDiff); if ((getItemEntry.getItemId != GI_NONE) || (player->getItemDirection < absYawDiff)) { + iceTrapScale = 0.0f; player->getItemEntry = getItemEntry; player->getItemId = getItemEntry.getItemId; player->interactRangeActor = actor; diff --git a/soh/src/code/z_draw.c b/soh/src/code/z_draw.c index 9a2de4b46..140ee399a 100644 --- a/soh/src/code/z_draw.c +++ b/soh/src/code/z_draw.c @@ -400,9 +400,7 @@ void GetItem_Draw(PlayState* play, s16 drawId) { * Uses the Custom Draw Function if it exists, or just calls `GetItem_Draw` */ void GetItemEntry_Draw(PlayState* play, GetItemEntry getItemEntry) { - // RANDOTODO: Make this more flexible for easier toggling of individual item recolors in the future. - if (getItemEntry.drawFunc != NULL && - (CVar_GetS32("gRandoMatchKeyColors", 0) || getItemEntry.getItemId == RG_DOUBLE_DEFENSE)) { + if (getItemEntry.drawFunc != NULL) { getItemEntry.drawFunc(play, &getItemEntry); } else { GetItem_Draw(play, getItemEntry.gid); @@ -759,8 +757,15 @@ void GetItem_DrawRecoveryHeart(PlayState* play, s16 drawId) { 1 * -(play->state.frames * 2), 32, 32)); gSPMatrix(POLY_XLU_DISP++, MATRIX_NEWMTX(play->state.gfxCtx), G_MTX_MODELVIEW | G_MTX_LOAD); + if (CVar_GetS32("gCosmetics.Consumable_Hearts.Changed", 0)) { + Color_RGB8 color = CVar_GetRGB("gCosmetics.Consumable_Hearts.Value", (Color_RGB8) { 255, 70, 50 }); + gDPSetGrayscaleColor(POLY_XLU_DISP++, color.r, color.g, color.b, 255); + gSPGrayscale(POLY_XLU_DISP++, true); + } gSPDisplayList(POLY_XLU_DISP++, sDrawItemTable[drawId].dlists[0]); - + if (CVar_GetS32("gCosmetics.Consumable_Hearts.Changed", 0)) { + gSPGrayscale(POLY_XLU_DISP++, false); + } CLOSE_DISPS(play->state.gfxCtx); } diff --git a/soh/src/code/z_player_lib.c b/soh/src/code/z_player_lib.c index 625a53bee..617cf274e 100644 --- a/soh/src/code/z_player_lib.c +++ b/soh/src/code/z_player_lib.c @@ -1,5 +1,6 @@ #include "global.h" #include "objects/gameplay_keep/gameplay_keep.h" +#include "objects/gameplay_field_keep/gameplay_field_keep.h" #include "objects/object_link_boy/object_link_boy.h" #include "objects/object_link_child/object_link_child.h" #include "objects/object_triforce_spot/object_triforce_spot.h" @@ -1172,6 +1173,49 @@ void func_800906D4(PlayState* play, Player* this, Vec3f* newTipPos) { } } +void Player_DrawGetItemIceTrap(PlayState* play, Player* this, Vec3f* refPos, s32 drawIdPlusOne, f32 height) { + OPEN_DISPS(play->state.gfxCtx); + + if (CVar_GetS32("gLetItSnow", 0)) { + Gfx_SetupDL_25Opa(play->state.gfxCtx); + + Matrix_Scale(0.2f, 0.2f, 0.2f, MTXMODE_APPLY); + gSPMatrix(POLY_OPA_DISP++, MATRIX_NEWMTX(play->state.gfxCtx), G_MTX_MODELVIEW | G_MTX_LOAD); + + gDPSetGrayscaleColor(POLY_OPA_DISP++, 75, 75, 75, 255); + gSPGrayscale(POLY_OPA_DISP++, true); + + gSPDisplayList(POLY_OPA_DISP++, (Gfx*)gSilverRockDL); + + gSPGrayscale(POLY_OPA_DISP++, false); + } else { + if (iceTrapScale < 0.01) { + iceTrapScale += 0.001f; + } else if (iceTrapScale < 0.8f) { + iceTrapScale += 0.2f; + } + gSPSegment(POLY_XLU_DISP++, 0x08, + Gfx_TwoTexScroll(play->state.gfxCtx, 0, 0, (0 - play->gameplayFrames) % 128, 32, 32, 1, 0, + (play->gameplayFrames * -2) % 128, 32, 32)); + + Matrix_Translate(0.0f, -40.0f, 0.0f, MTXMODE_APPLY); + Matrix_Scale(iceTrapScale, iceTrapScale, iceTrapScale, MTXMODE_APPLY); + gSPMatrix(POLY_XLU_DISP++, MATRIX_NEWMTX(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); + gDPSetEnvColor(POLY_XLU_DISP++, 0, 50, 100, 255); + gSPDisplayList(POLY_XLU_DISP++, gEffIceFragment3DL); + + // Reset matrix for the fake item model because we're animating the size of the ice block around it before this. + Matrix_Translate(refPos->x + (3.3f * Math_SinS(this->actor.shape.rot.y)), refPos->y + height, + refPos->z + ((3.3f + (IREG(90) / 10.0f)) * Math_CosS(this->actor.shape.rot.y)), MTXMODE_NEW); + Matrix_RotateZYX(0, play->gameplayFrames * 1000, 0, MTXMODE_APPLY); + Matrix_Scale(0.2f, 0.2f, 0.2f, MTXMODE_APPLY); + // Draw fake item model. + GetItem_Draw(play, drawIdPlusOne - 1); + } + + CLOSE_DISPS(play->state.gfxCtx); +} + void Player_DrawGetItemImpl(PlayState* play, Player* this, Vec3f* refPos, s32 drawIdPlusOne) { f32 height = (this->exchangeItemId != EXCH_ITEM_NONE) ? 6.0f : 14.0f; @@ -1187,9 +1231,9 @@ void Player_DrawGetItemImpl(PlayState* play, Player* this, Vec3f* refPos, s32 dr Matrix_RotateZYX(0, play->gameplayFrames * 1000, 0, MTXMODE_APPLY); Matrix_Scale(0.2f, 0.2f, 0.2f, MTXMODE_APPLY); - // RANDOTODO: Make this more flexible for easier toggling of individual item recolors in the future. - if (this->getItemEntry.drawFunc != NULL && - (CVar_GetS32("gRandoMatchKeyColors", 0) || this->getItemEntry.getItemId == RG_DOUBLE_DEFENSE || this->getItemEntry.getItemId == RG_ICE_TRAP)) { + if (this->getItemEntry.modIndex == MOD_RANDOMIZER && this->getItemEntry.getItemId == RG_ICE_TRAP) { + Player_DrawGetItemIceTrap(play, this, refPos, drawIdPlusOne, height); + } else if (this->getItemEntry.drawFunc != NULL) { this->getItemEntry.drawFunc(play, &this->getItemEntry); } else { GetItem_Draw(play, drawIdPlusOne - 1); |
