Cosmetics Changes (#4275)

* Clean CosmeticsEditor.h

* Add CosmeticsEditor_GetDefaultValue

* Add message text cosmetics

* Format cleanup

* Remove dependency on 3drando random functions

* Fix rainbow for every cosmetic

* Add "Rainbow All" & "Un-Rainbow All"

* Add HookshotChain cosmetic

* Add Nayru's cosmetics

* Add Farore's cosmetics

* Add Din's cosmetics

* Add Title card cosmetics

* Update CosmeticsEditor.cpp

* Add Copyright text cosmetic
This commit is contained in:
Pepe20129 2024-11-26 23:48:58 +01:00 committed by GitHub
parent d0f7d30c16
commit 7ccb3ac7c3
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
10 changed files with 739 additions and 466 deletions

File diff suppressed because it is too large Load Diff

View File

@ -1,13 +1,6 @@
#pragma once
#include <libultraship/libultraship.h>
#define PATCH_GFX(path, name, cvar, index, instruction) \
if (CVarGetInteger(cvar, 0)) { \
ResourceMgr_PatchGfxByName(path, name, index, instruction); \
} else { \
ResourceMgr_UnpatchGfxByName(path, name); \
}
// Not to be confused with tabs, groups are 1:1 with the boxes shown in the UI, grouping them allows us to reset/randomize
// every item in a group at once. If you are looking for tabs they are rendered manually in ImGui in `DrawCosmeticsEditor`
typedef enum {
@ -28,9 +21,19 @@ typedef enum {
COSMETICS_GROUP_TRAILS,
COSMETICS_GROUP_NAVI,
COSMETICS_GROUP_IVAN,
COSMETICS_GROUP_MESSAGE,
COSMETICS_GROUP_MAX
} CosmeticGroup;
#ifdef __cplusplus
extern "C" {
#endif //__cplusplus
Color_RGBA8 CosmeticsEditor_GetDefaultValue(const char* id);
#ifdef __cplusplus
}
typedef struct {
const std::string Name;
const std::string ToolTip;
@ -46,8 +49,7 @@ static float TablesCellsWidth = 300.0f;
static ImGuiTableColumnFlags FlagsTable = ImGuiTableFlags_BordersH | ImGuiTableFlags_BordersV;
static ImGuiTableColumnFlags FlagsCell = ImGuiTableColumnFlags_WidthStretch | ImGuiTableColumnFlags_IndentEnable | ImGuiTableColumnFlags_NoSort;
void InitCosmeticsEditor();//Init the menu itself
ImVec4 GetRandomValue(int MaximumPossible);
ImVec4 GetRandomValue();
void CosmeticsEditor_RandomizeAll();
void CosmeticsEditor_RandomizeGroup(CosmeticGroup group);
void CosmeticsEditor_ResetAll();
@ -62,3 +64,4 @@ class CosmeticsEditorWindow : public Ship::GuiWindow {
void DrawElement() override;
void UpdateElement() override {};
};
#endif //__cplusplus

View File

@ -1312,6 +1312,7 @@ static constexpr std::array<std::pair<const char*, CosmeticGroup>, COSMETICS_GRO
{"trials", COSMETICS_GROUP_TRAILS},
{"navi", COSMETICS_GROUP_NAVI},
{"ivan", COSMETICS_GROUP_IVAN},
{"message", COSMETICS_GROUP_MESSAGE},
}};
static bool CosmeticsHandler(std::shared_ptr<Ship::Console> Console, const std::vector<std::string>& args, std::string* output) {

View File

@ -593,7 +593,7 @@ namespace UIWidgets {
#if defined(__SWITCH__) || defined(__WIIU__)
srand(time(NULL));
#endif
ImVec4 color = GetRandomValue(255);
ImVec4 color = GetRandomValue();
colors->x = color.x;
colors->y = color.y;
colors->z = color.z;

View File

@ -1081,14 +1081,11 @@ void TitleCard_InitPlaceName(PlayState* play, TitleCardContext* titleCtx, void*
}
void TitleCard_Update(PlayState* play, TitleCardContext* titleCtx) {
const Color_RGB8 TitleCard_Colors_ori = {255,255,255};
Color_RGB8 TitleCard_Colors = {255,255,255};
if (titleCtx->isBossCard && CVarGetInteger(CVAR_COSMETIC("HUD.TitleCard.Boss.Changed"), 1) == 2) {
TitleCard_Colors = CVarGetColor24(CVAR_COSMETIC("HUD.TitleCard.Boss.Value"), TitleCard_Colors_ori);
} else if (!titleCtx->isBossCard && CVarGetInteger(CVAR_COSMETIC("HUD.TitleCard.Map.Changed"), 1) == 2) {
TitleCard_Colors = CVarGetColor24(CVAR_COSMETIC("HUD.TitleCard.Map.Value"), TitleCard_Colors_ori);
} else {
TitleCard_Colors = TitleCard_Colors_ori;
Color_RGB8 TitleCard_Colors = { 255, 255, 255 };
if (titleCtx->isBossCard && CVarGetInteger(CVAR_COSMETIC("HUD.TitleCard.Boss.Changed"), 0) == 1) {
TitleCard_Colors = CVarGetColor24(CVAR_COSMETIC("HUD.TitleCard.Boss.Value"), TitleCard_Colors);
} else if (!titleCtx->isBossCard && CVarGetInteger(CVAR_COSMETIC("HUD.TitleCard.Map.Changed"), 0) == 1) {
TitleCard_Colors = CVarGetColor24(CVAR_COSMETIC("HUD.TitleCard.Map.Value"), TitleCard_Colors);
}
if (DECR(titleCtx->delayTimer) == 0) {
@ -2345,8 +2342,14 @@ void Actor_DrawFaroresWindPointer(PlayState* play) {
} else if (D_8015BC18 > 0.0f) {
static Vec3f effectVel = { 0.0f, -0.05f, 0.0f };
static Vec3f effectAccel = { 0.0f, -0.025f, 0.0f };
static Color_RGBA8 effectPrimCol = { 255, 255, 255, 0 };
static Color_RGBA8 effectEnvCol = { 100, 200, 0, 0 };
Color_RGBA8 effectPrimCol = { 255, 255, 255, 0 };
Color_RGBA8 effectEnvCol = { 100, 200, 0, 0 };
if (CVarGetInteger(CVAR_COSMETIC("Magic.FaroresSecondary.Changed"), 0)) {
effectEnvCol = CVarGetColor(CVAR_COSMETIC("Magic.FaroresSecondary.Value"), effectEnvCol);
}
if (CVarGetInteger(CVAR_COSMETIC("Magic.FaroresPrimary.Changed"), 0)) {
effectPrimCol = CVarGetColor(CVAR_COSMETIC("Magic.FaroresPrimary.Value"), effectPrimCol);
}
Vec3f* curPos = &gSaveContext.respawn[RESPAWN_MODE_TOP].pos;
Vec3f* nextPos = &gSaveContext.respawn[RESPAWN_MODE_DOWN].pos;
f32 prevNum = D_8015BC18;
@ -2441,8 +2444,16 @@ void Actor_DrawFaroresWindPointer(PlayState* play) {
Matrix_Push();
gDPPipeSync(POLY_XLU_DISP++);
gDPSetPrimColor(POLY_XLU_DISP++, 128, 128, 255, 255, 200, alpha);
gDPSetEnvColor(POLY_XLU_DISP++, 100, 200, 0, 255);
Color_RGB8 Spell_env = { 100, 200, 0 };
Color_RGB8 Spell_col = { 255, 255, 200 };
if (CVarGetInteger(CVAR_COSMETIC("Magic.FaroresSecondary.Changed"), 0)) {
Spell_env = CVarGetColor24(CVAR_COSMETIC("Magic.FaroresSecondary.Value"), Spell_env);
}
if (CVarGetInteger(CVAR_COSMETIC("Magic.FaroresPrimary.Changed"), 0)) {
Spell_col = CVarGetColor24(CVAR_COSMETIC("Magic.FaroresPrimary.Value"), Spell_col);
}
gDPSetPrimColor(POLY_XLU_DISP++, 128, 128, Spell_col.r, Spell_col.g, Spell_col.b, alpha);
gDPSetEnvColor(POLY_XLU_DISP++, Spell_env.r, Spell_env.g, Spell_env.b, 255);
Matrix_RotateZ(((play->gameplayFrames * 1500) & 0xFFFF) * M_PI / 32768.0f, MTXMODE_APPLY);
gSPMatrix(POLY_XLU_DISP++, MATRIX_NEWMTX(play->state.gfxCtx),

View File

@ -7,6 +7,7 @@
#include "textures/parameter_static/parameter_static.h"
#include "textures/message_static/message_static.h"
#include "textures/message_texture_static/message_texture_static.h"
#include "soh/Enhancements/cosmetics/CosmeticsEditor.h"
#include "soh/Enhancements/cosmetics/cosmeticsTypes.h"
#include "soh/Enhancements/game-interactor/GameInteractor.h"
#include "soh/Enhancements/game-interactor/GameInteractor_Hooks.h"
@ -367,6 +368,80 @@ void Message_FindCreditsMessage(PlayState* play, u16 textId) {
}
}
#pragma region [SoH] Cosmetics
#define MESSAGE_COSMETICS_HANDLE_COLOR(id) \
if (CVarGetInteger(CVAR_COSMETIC("Message." id ".Changed"), 0)) { \
Color_RGBA8 color = CVarGetColor(CVAR_COSMETIC("Message." id ".Value"), CosmeticsEditor_GetDefaultValue("Message." id)); \
msgCtx->textColorR = color.r; \
msgCtx->textColorG = color.g; \
msgCtx->textColorB = color.b; \
}
void Cosmetics_MaybeSetTextColor(MessageContext* msgCtx, u16 colorParameter) {
switch (colorParameter) {
case MSGCOL_RED:
if (msgCtx->textBoxType == TEXTBOX_TYPE_WOODEN) {
MESSAGE_COSMETICS_HANDLE_COLOR("Red.Wooden")
} else {
MESSAGE_COSMETICS_HANDLE_COLOR("Red.Normal")
}
break;
case MSGCOL_ADJUSTABLE:
if (msgCtx->textBoxType == TEXTBOX_TYPE_WOODEN) {
MESSAGE_COSMETICS_HANDLE_COLOR("Adjustable.Wooden")
} else {
MESSAGE_COSMETICS_HANDLE_COLOR("Adjustable.Normal")
}
break;
case MSGCOL_BLUE:
if (msgCtx->textBoxType == TEXTBOX_TYPE_WOODEN) {
MESSAGE_COSMETICS_HANDLE_COLOR("Blue.Wooden")
} else {
MESSAGE_COSMETICS_HANDLE_COLOR("Blue.Normal")
}
break;
case MSGCOL_LIGHTBLUE:
if (msgCtx->textBoxType == TEXTBOX_TYPE_WOODEN) {
MESSAGE_COSMETICS_HANDLE_COLOR("LightBlue.Wooden")
} else if (msgCtx->textBoxType == TEXTBOX_TYPE_NONE_NO_SHADOW) {
MESSAGE_COSMETICS_HANDLE_COLOR("LightBlue.NoneNoShadow")
} else {
MESSAGE_COSMETICS_HANDLE_COLOR("LightBlue.Normal")
}
break;
case MSGCOL_PURPLE:
if (msgCtx->textBoxType == TEXTBOX_TYPE_WOODEN) {
MESSAGE_COSMETICS_HANDLE_COLOR("Purple.Wooden")
} else {
MESSAGE_COSMETICS_HANDLE_COLOR("Purple.Normal")
}
break;
case MSGCOL_YELLOW:
if (msgCtx->textBoxType == TEXTBOX_TYPE_WOODEN) {
MESSAGE_COSMETICS_HANDLE_COLOR("Yellow.Wooden")
} else {
MESSAGE_COSMETICS_HANDLE_COLOR("Yellow.Normal")
}
break;
case MSGCOL_BLACK:
MESSAGE_COSMETICS_HANDLE_COLOR("Black")
break;
case MSGCOL_DEFAULT:
default:
if (msgCtx->textBoxType == TEXTBOX_TYPE_NONE_NO_SHADOW) {
MESSAGE_COSMETICS_HANDLE_COLOR("Default.NoneNoShadow")
} else {
MESSAGE_COSMETICS_HANDLE_COLOR("Default.Normal")
}
break;
}
}
#undef MESSAGE_COSMETICS_HANDLE_COLOR
#pragma endregion
void Message_SetTextColor(MessageContext* msgCtx, u16 colorParameter) {
switch (colorParameter) {
case MSGCOL_RED:
@ -451,6 +526,7 @@ void Message_SetTextColor(MessageContext* msgCtx, u16 colorParameter) {
}
break;
}
Cosmetics_MaybeSetTextColor(msgCtx, colorParameter);
}
void Message_DrawTextboxIcon(PlayState* play, Gfx** p, s16 x, s16 y) {
@ -853,6 +929,8 @@ void Message_DrawText(PlayState* play, Gfx** gfxP) {
msgCtx->textColorR = msgCtx->textColorG = msgCtx->textColorB = 255;
}
Cosmetics_MaybeSetTextColor(msgCtx, MSGCOL_DEFAULT);
msgCtx->unk_E3D0 = 0;
charTexIdx = 0;

View File

@ -3388,6 +3388,9 @@ void Interface_UpdateMagicBar(PlayState* play) {
default:
gSaveContext.magicState = MAGIC_STATE_IDLE;
if (CVarGetInteger(CVAR_COSMETIC("Consumable.MagicBorder.Changed"), 0)) {
sMagicBorder = CVarGetColor24(CVAR_COSMETIC("Consumable.MagicBorder.Value"), sMagicBorder_ori);
}
break;
}
}
@ -3617,8 +3620,8 @@ void Interface_DrawEnemyHealthBar(TargetContext* targetCtx, PlayState* play) {
s32 healthbar_offsetY = CVarGetInteger(CVAR_COSMETIC("HUD.EnemyHealthBar.PosY"), 0);
s8 anchorType = CVarGetInteger(CVAR_COSMETIC("HUD.EnemyHealthBar.PosType"), ENEMYHEALTH_ANCHOR_ACTOR);
if (CVarGetInteger(CVAR_COSMETIC("HUD.EnemyHealthBar..Changed"), 0)) {
healthbar_red = CVarGetColor(CVAR_COSMETIC("HUD.EnemyHealthBar..Value"), healthbar_red);
if (CVarGetInteger(CVAR_COSMETIC("HUD.EnemyHealthBar.Changed"), 0)) {
healthbar_red = CVarGetColor(CVAR_COSMETIC("HUD.EnemyHealthBar.Value"), healthbar_red);
}
if (CVarGetInteger(CVAR_COSMETIC("HUD.EnemyHealthBorder.Changed"), 0)) {
healthbar_border = CVarGetColor(CVAR_COSMETIC("HUD.EnemyHealthBorder.Value"), healthbar_border);

View File

@ -931,8 +931,21 @@ void EnMag_DrawInnerVanilla(Actor* thisx, PlayState* play, Gfx** gfxp) {
gDPSetAlphaCompare(gfx++, G_AC_NONE);
gDPSetCombineMode(gfx++, G_CC_MODULATEIA_PRIM, G_CC_MODULATEIA_PRIM);
gDPSetPrimColor(gfx++, 0, 0, (s16)this->copyrightAlpha, (s16)this->copyrightAlpha, (s16)this->copyrightAlpha,
(s16)this->copyrightAlpha);
if (CVarGetInteger(CVAR_COSMETIC("Title.Copyright.Changed"), 0)) {
Color_RGBA8 copyrightColor = CVarGetColor(CVAR_COSMETIC("Title.Copyright.Value"), (Color_RGBA8){ 255, 255, 255, 255 });
gDPSetPrimColor(
gfx++,
0,
0,
(s16)(((f32)copyrightColor.r / 255.0f) * this->copyrightAlpha),
(s16)(((f32)copyrightColor.g / 255.0f) * this->copyrightAlpha),
(s16)(((f32)copyrightColor.b / 255.0f) * this->copyrightAlpha),
(s16)(((f32)copyrightColor.a / 255.0f) * this->copyrightAlpha)
);
} else {
gDPSetPrimColor(gfx++, 0, 0, (s16)this->copyrightAlpha, (s16)this->copyrightAlpha, (s16)this->copyrightAlpha,
(s16)this->copyrightAlpha);
}
if ((s16)this->copyrightAlpha != 0) {
gDPLoadTextureBlock(gfx++, copy_tex, G_IM_FMT_IA, G_IM_SIZ_8b, copy_width, 16, 0, G_TX_NOMIRROR | G_TX_CLAMP,

View File

@ -198,10 +198,14 @@ void MagicDark_DiamondDraw(Actor* thisx, PlayState* play) {
MagicDark* this = (MagicDark*)thisx;
s32 pad;
u16 gameplayFrames = play->gameplayFrames;
Color_RGB8 Spell_env_ori = {0, 100, 255};
Color_RGB8 Spell_col_ori = {170, 255, 255};
Color_RGB8 Spell_env = CVarGetColor24(CVAR_COSMETIC("Magic.NayrusSecondary.Value"), Spell_env_ori);
Color_RGB8 Spell_col = CVarGetColor24(CVAR_COSMETIC("Magic.NayrusPrimary.Value"), Spell_col_ori);
Color_RGB8 Spell_env = { 0, 100, 255 };
Color_RGB8 Spell_col = { 170, 255, 255 };
if (CVarGetInteger(CVAR_COSMETIC("Magic.NayrusSecondary.Changed"), 0)) {
Spell_env = CVarGetColor24(CVAR_COSMETIC("Magic.NayrusSecondary.Value"), Spell_env);
}
if (CVarGetInteger(CVAR_COSMETIC("Magic.NayrusPrimary.Changed"), 0)) {
Spell_col = CVarGetColor24(CVAR_COSMETIC("Magic.NayrusPrimary.Value"), Spell_col);
}
OPEN_DISPS(play->state.gfxCtx);
@ -224,13 +228,8 @@ void MagicDark_DiamondDraw(Actor* thisx, PlayState* play) {
Matrix_RotateY(this->actor.shape.rot.y * (M_PI / 0x8000), MTXMODE_APPLY);
gSPMatrix(POLY_XLU_DISP++, MATRIX_NEWMTX(play->state.gfxCtx),
G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
if (CVarGetInteger(CVAR_COSMETIC("UseSpellsColors"),0)) {
gDPSetPrimColor(POLY_XLU_DISP++, 0, 0x80, Spell_col.r, Spell_col.g, Spell_col.b, (s32)(this->primAlpha * 0.6f) & 0xFF);
gDPSetEnvColor(POLY_XLU_DISP++, Spell_env.r, Spell_env.g, Spell_env.b, 128);
} else {
gDPSetPrimColor(POLY_XLU_DISP++, 0, 0, 170, 255, 255, (s32)(this->primAlpha * 0.6f) & 0xFF);
gDPSetEnvColor(POLY_XLU_DISP++, 0, 100, 255, 128);
}
gDPSetPrimColor(POLY_XLU_DISP++, 0, 0, Spell_col.r, Spell_col.g, Spell_col.b, (s32)(this->primAlpha * 0.6f) & 0xFF);
gDPSetEnvColor(POLY_XLU_DISP++, Spell_env.r, Spell_env.g, Spell_env.b, 128);
gSPDisplayList(POLY_XLU_DISP++, sDiamondMaterialDL);
gSPDisplayList(POLY_XLU_DISP++,
Gfx_TwoTexScroll(play->state.gfxCtx, 0, gameplayFrames * 2, gameplayFrames * -4, 32, 32, 1,
@ -271,8 +270,18 @@ void MagicDark_OrbDraw(Actor* thisx, PlayState* play) {
OPEN_DISPS(play->state.gfxCtx);
Gfx_SetupDL_25Xlu(play->state.gfxCtx);
gDPSetPrimColor(POLY_XLU_DISP++, 0, 0x80, 170, 255, 255, 255);
gDPSetEnvColor(POLY_XLU_DISP++, 0, 150, 255, 255);
Color_RGB8 Spell_env = { 0, 150, 255 };
Color_RGB8 Spell_col = { 170, 255, 255 };
if (CVarGetInteger(CVAR_COSMETIC("Magic.NayrusSecondary.Changed"), 0)) {
Spell_env = CVarGetColor24(CVAR_COSMETIC("Magic.NayrusSecondary.Value"), Spell_env);
}
if (CVarGetInteger(CVAR_COSMETIC("Magic.NayrusPrimary.Changed"), 0)) {
Spell_col = CVarGetColor24(CVAR_COSMETIC("Magic.NayrusPrimary.Value"), Spell_col);
}
gDPSetPrimColor(POLY_XLU_DISP++, 0, 0x80, Spell_col.r, Spell_col.g, Spell_col.b, 255);
gDPSetEnvColor(POLY_XLU_DISP++, Spell_env.r, Spell_env.g, Spell_env.b, 255);
Matrix_Translate(pos.x, pos.y, pos.z, MTXMODE_NEW);
Matrix_Scale(this->actor.scale.x, this->actor.scale.y, this->actor.scale.z, MTXMODE_APPLY);
Matrix_Mult(&play->billboardMtxF, MTXMODE_APPLY);

View File

@ -217,10 +217,14 @@ void MagicFire_Draw(Actor* thisx, PlayState* play) {
s32 pad2;
s32 i;
u8 alpha;
Color_RGB8 Spell_env_ori = {255, 0, 0};
Color_RGB8 Spell_col_ori = {255, 200, 0};
Color_RGB8 Spell_env = CVarGetColor24(CVAR_COSMETIC("Magic.DinsSecondary.Value"), Spell_env_ori);
Color_RGB8 Spell_col = CVarGetColor24(CVAR_COSMETIC("Magic.DinsPrimaryary.Value"), Spell_col_ori);
Color_RGB8 Spell_env = { 255, 0, 0 };
Color_RGB8 Spell_col = { 255, 200, 0 };
if (CVarGetInteger(CVAR_COSMETIC("Magic.DinsSecondary.Changed"), 0)) {
Spell_env = CVarGetColor24(CVAR_COSMETIC("Magic.DinsSecondary.Value"), Spell_env);
}
if (CVarGetInteger(CVAR_COSMETIC("Magic.DinsPrimaryary.Changed"), 0)) {
Spell_col = CVarGetColor24(CVAR_COSMETIC("Magic.DinsPrimary.Value"), Spell_col);
}
if (this->action > 0) {
OPEN_DISPS(play->state.gfxCtx);
@ -232,13 +236,8 @@ void MagicFire_Draw(Actor* thisx, PlayState* play) {
gDPSetColorDither(POLY_XLU_DISP++, G_CD_DISABLE);
gDPFillRectangle(POLY_XLU_DISP++, 0, 0, 319, 239);
Gfx_SetupDL_25Xlu(play->state.gfxCtx);
if (CVarGetInteger(CVAR_COSMETIC("UseSpellsColors"),0)) {
gDPSetPrimColor(POLY_XLU_DISP++, 0, 0x80, Spell_col.r, Spell_col.g, Spell_col.b, (u8)(this->alphaMultiplier * 255));
gDPSetEnvColor(POLY_XLU_DISP++, Spell_env.r, Spell_env.g, Spell_env.b, (u8)(this->alphaMultiplier * 255));
} else {
gDPSetPrimColor(POLY_XLU_DISP++, 0, 0x80, Spell_col_ori.r, Spell_col_ori.g, Spell_col_ori.b, (u8)(this->alphaMultiplier * 255));
gDPSetEnvColor(POLY_XLU_DISP++, Spell_env_ori.r, Spell_env_ori.g, Spell_env_ori.b, (u8)(this->alphaMultiplier * 255));
}
gDPSetPrimColor(POLY_XLU_DISP++, 0, 0x80, Spell_col.r, Spell_col.g, Spell_col.b, (u8)(this->alphaMultiplier * 255));
gDPSetEnvColor(POLY_XLU_DISP++, Spell_env.r, Spell_env.g, Spell_env.b, (u8)(this->alphaMultiplier * 255));
Matrix_Scale(0.15f, 0.15f, 0.15f, MTXMODE_APPLY);
gSPMatrix(POLY_XLU_DISP++, MATRIX_NEWMTX(play->state.gfxCtx),
G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);