Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
7c41288
Initial version of Cosmetic Editor
Kiloku Jan 2, 2025
dfd1b54
Assign custom colors to Star Fox and Star Wolf
Kiloku Jan 2, 2025
997b869
Make Star Wolf colors Derived from Wolf.
Kiloku Jan 2, 2025
5b3ba26
Add Derive All
Kiloku Jan 2, 2025
4cff2e8
Remove multiplayer only colors
Kiloku Jan 2, 2025
fd2d566
Allow setting alpha
Kiloku Jan 2, 2025
8b7fcff
Trying to fix compile issues
Kiloku Jan 2, 2025
6742e5e
Specify enum type?
Kiloku Jan 2, 2025
b464f47
Hopefully the actual fix.
Kiloku Jan 2, 2025
e95cf9f
Remove ImGUI text entry accidentally left in
Kiloku Jan 2, 2025
b6a584f
Merge branch 'main' into cosmetic-editor
Kiloku Jan 3, 2025
556cc90
Merge branch 'main' of github.com:Kiloku/Starship into cosmetic-editor
Kiloku Jan 23, 2025
41568a2
Consider gamma boost before applying custom color
Kiloku Jan 24, 2025
d0ca929
Fix bugs with customizing Alpha
Kiloku Jan 24, 2025
2ee271c
Merge branch 'main' into cosmetic-editor
Kiloku Feb 1, 2025
cdcac27
Add Arwing Engine Glow custom colors
Kiloku Feb 1, 2025
52fc10a
Merge branch 'HarbourMasters:main' into cosmetic-editor
Kiloku Feb 3, 2025
b48c880
Merge branch 'cosmetic-editor' of github.com:Kiloku/Starship into cos…
Kiloku Feb 3, 2025
aaa3611
Add Wolfen Engine Glow custom colors
Kiloku Feb 3, 2025
15d3acc
Add SubEntry support
Kiloku Feb 4, 2025
1985d2f
Added secondary color to engine glows
Kiloku Feb 4, 2025
6211280
Fix CI
Kiloku Feb 4, 2025
fbd7b1b
Fix CI again
Kiloku Feb 4, 2025
1a03869
Fix CI again again
Kiloku Feb 4, 2025
8ccf4a4
CI
Kiloku Feb 4, 2025
57fe2f0
Const array length
Kiloku Feb 4, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions include/functions.h
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,7 @@ void Cutscene_DrawGreatFox(void);
// fox_display
void Display_ArwingWings(ArwingInfo*);
void Display_DrawEngineGlow(EngineGlowColor);
void Display_DrawEngineGlowCustom(Color_RGBA8 primary, Color_RGBA8 secondary); //u8 r, u8 g, u8 b, u8 a);
void Display_SetupPlayerSfxPos(Player*);
void Display_Update(void);

Expand All @@ -114,6 +115,8 @@ void CoBuilding10_Draw(Scenery*);
void ActorDebris_Draw(Actor*);
void Actor_DrawEngineAndContrails(Actor*);
void Actor_DrawEngineGlow(Actor*, EngineGlowColor);
void Actor_DrawEngineAndContrailsCustom(Actor*, Color_RGBA8 primary, Color_RGBA8 secondary);
void Actor_DrawEngineGlowCustom(Actor*,Color_RGBA8 primary, Color_RGBA8 secondary);
void ActorTeamArwing_Draw(Actor*);
void MeMolarRock_Draw(Actor*);
void MeMeteor2_Draw(MeMeteor2*);
Expand Down
15 changes: 11 additions & 4 deletions src/engine/fox_360.c
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@
#include "assets/ast_versus.h"
#include "assets/ast_enmy_planet.h"
#include "assets/ast_sector_z.h"
#include "port/ui/CosmeticEditor.h"


typedef enum ActorAllRangeState {
STATE360_0,
Expand Down Expand Up @@ -2383,28 +2385,33 @@ void ActorAllRange_Draw(ActorAllRange* this) {
case AI360_LEON:
case AI360_PIGMA:
case AI360_ANDREW:
{ //For some reason this won't compile on MacOS unless I add these braces.
bool cosmeticGlowChanged = gCosmeticEngineGlowChanged(gLevelType, COSMETIC_GLOW_WOLFEN);
Color_RGBA8 customColorPrimary = gCosmeticEngineGlowColor(gLevelType, COSMETIC_GLOW_WOLFEN, false);
Color_RGBA8 customColorSecondary = gCosmeticEngineGlowColor(gLevelType, COSMETIC_GLOW_WOLFEN, true);
if (gCurrentLevel == LEVEL_VENOM_2) {
gSPDisplayList(gMasterDisp++, aStarWolfUpgradedShipDL);
Matrix_Push(&gGfxMatrix);
Matrix_Translate(gGfxMatrix, 30.0f, 0.0f, -60.0f, MTXF_APPLY);
Actor_DrawEngineGlow(this, EG_GREEN);
cosmeticGlowChanged ? Actor_DrawEngineGlowCustom(this, customColorPrimary, customColorSecondary) : Actor_DrawEngineGlow(this, EG_GREEN);
Matrix_Pop(&gGfxMatrix);
Matrix_Push(&gGfxMatrix);
Matrix_Translate(gGfxMatrix, -30.0f, 0.0f, -60.0f, MTXF_APPLY);
Actor_DrawEngineGlow(this, EG_GREEN);
cosmeticGlowChanged ? Actor_DrawEngineGlowCustom(this, customColorPrimary, customColorSecondary) : Actor_DrawEngineGlow(this, EG_GREEN);
Matrix_Pop(&gGfxMatrix);
ActorAllRange_DrawBarrelRoll(this);
ActorAllRange_DrawShield(this);
} else {
gSPDisplayList(gMasterDisp++, aStarWolfStandardShipDL);
Matrix_Translate(gGfxMatrix, 0.0f, 0.0f, -60.0f, MTXF_APPLY);
if (gCurrentLevel == LEVEL_BOLSE) {
Actor_DrawEngineGlow(this, EG_ORANGE);
cosmeticGlowChanged ? Actor_DrawEngineGlowCustom(this, customColorPrimary, customColorSecondary) : Actor_DrawEngineGlow(this, EG_ORANGE);
} else {
Actor_DrawEngineGlow(this, EG_GREEN);
cosmeticGlowChanged ? Actor_DrawEngineGlowCustom(this, customColorPrimary, customColorSecondary) : Actor_DrawEngineGlow(this, EG_GREEN);
}
}
break;
}

case AI360_KATT:
gSPDisplayList(gMasterDisp++, aKattShipDL);
Expand Down
18 changes: 17 additions & 1 deletion src/engine/fox_display.c
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
#include "assets/ast_sector_z.h"
#include "port/interpolation/FrameInterpolation.h"
#include "port/hooks/list/EngineEvent.h"
#include "port/ui/CosmeticEditor.h"

// f32 path1 = 0.0f;
// f32 path2 = 0.0f;
Expand Down Expand Up @@ -898,6 +899,13 @@ void Display_DrawEngineGlow(EngineGlowColor color) {
}
gSPDisplayList(gMasterDisp++, aOrbDL);
}
void Display_DrawEngineGlowCustom(Color_RGBA8 primary, Color_RGBA8 secondary){
RCP_SetupDL(&gMasterDisp, SETUPDL_67);
//Despite the names primary/secondary not matching, that's their behavior in game. Maybe rename them to inner and outer glows would work better
gDPSetPrimColor(gMasterDisp++, 0x00, 0x00, secondary.r, secondary.g, secondary.b, secondary.a);
gDPSetEnvColor(gMasterDisp++, primary.r, primary.g, primary.b, primary.a);
gSPDisplayList(gMasterDisp++, aOrbDL);
}

void Display_LandmasterEngineGlow_Draw(Player* player) {
RCP_SetupDL_64();
Expand All @@ -920,7 +928,15 @@ void Display_LandmasterEngineGlow_Draw(Player* player) {
Matrix_Scale(gGfxMatrix, 0.9f * 0.9f, 0.9f * 0.63f, 1.0f, MTXF_APPLY);
}
Matrix_SetGfxMtx(&gMasterDisp);
Display_DrawEngineGlow(gLevelType);
if (gCosmeticEngineGlowChanged(gLevelType, COSMETIC_GLOW_ARWING)){
Color_RGBA8 customColorPrimary = gCosmeticEngineGlowColor(gLevelType, COSMETIC_GLOW_ARWING, false);
Color_RGBA8 customColorSecondary = gCosmeticEngineGlowColor(gLevelType, COSMETIC_GLOW_ARWING, true);

Display_DrawEngineGlowCustom(customColorPrimary,customColorSecondary);
}
else{
Display_DrawEngineGlow(gLevelType);
}
Matrix_Pop(&gGfxMatrix);
}

Expand Down
90 changes: 89 additions & 1 deletion src/engine/fox_edisplay.c
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
#include "assets/ast_zoness.h"
#include "port/interpolation/FrameInterpolation.h"
#include "port/hooks/Events.h"
#include "port/ui/CosmeticEditor.h"

Vec3f D_edisplay_801615D0;
Vec3f sViewPos;
Expand Down Expand Up @@ -529,7 +530,65 @@ void Actor_DrawEngineAndContrails(Actor* this) {
Matrix_Pop(&gGfxMatrix);
}
}
void Actor_DrawEngineAndContrailsCustom(Actor* this, Color_RGBA8 primary, Color_RGBA8 secondary) {
f32 sp5C;
f32 temp1;
f32 sp54;
s32 pad[5];

if ((this->iwork[11] != 0) && (this->obj.status == OBJ_ACTIVE)) {
temp1 = 652.5f * 0.001f; // 0.65250003f;
if (this->iwork[11] >= 2) {
temp1 = 1.3050001f;
}

Math_SmoothStepToF(&this->fwork[29], temp1, 0.3f, 5.0f, 0.0f);

sp5C = this->fwork[29];
if ((gGameFrameCount % 2) != 0) {
sp5C *= 1.111f;
}
Matrix_Push(&gGfxMatrix);
Matrix_Translate(gGfxMatrix, 0.0f, 0.0f, -60.0f, MTXF_APPLY);
Matrix_Scale(gGfxMatrix, sp5C, sp5C * 0.7f, sp5C, MTXF_APPLY);
Matrix_RotateZ(gGfxMatrix, -this->obj.rot.z * M_DTOR, MTXF_APPLY);
Matrix_RotateX(gGfxMatrix, -this->obj.rot.x * M_DTOR, MTXF_APPLY);
Matrix_RotateY(gGfxMatrix, -this->obj.rot.y * M_DTOR, MTXF_APPLY);
Matrix_RotateY(gGfxMatrix, -gPlayer[gPlayerNum].camYaw, MTXF_APPLY);
Matrix_RotateX(gGfxMatrix, gPlayer[gPlayerNum].camPitch, MTXF_APPLY);
Matrix_SetGfxMtx(&gMasterDisp);
Display_DrawEngineGlowCustom(primary, secondary);
Matrix_Pop(&gGfxMatrix);
}

sp5C = this->fwork[21];
if ((sp5C != 0.0f) && (gLevelType == LEVELTYPE_PLANET)) {
sp54 = 0.0f;
if ((gGameFrameCount % 2) != 0) {
sp54 = 180.0f;
}
RCP_SetupDL_64_2();
gDPSetPrimColor(gMasterDisp++, 0x00, 0x00, 255, 255, 255, 100);
Matrix_Push(&gGfxMatrix);
Matrix_Translate(gGfxMatrix, 70.0f, -10.0f, -100.0f, MTXF_APPLY);
Matrix_Scale(gGfxMatrix, sp5C, 1.0f, 50.0f, MTXF_APPLY);
Matrix_Translate(gGfxMatrix, 0.0f, 0.0f, -17.5f, MTXF_APPLY);
Matrix_RotateX(gGfxMatrix, M_PI / 2, MTXF_APPLY);
Matrix_RotateY(gGfxMatrix, M_DTOR * sp54, MTXF_APPLY);
Matrix_SetGfxMtx(&gMasterDisp);
gSPDisplayList(gMasterDisp++, aBallDL);
Matrix_Pop(&gGfxMatrix);
Matrix_Push(&gGfxMatrix);
Matrix_Translate(gGfxMatrix, -70.0f, -10.0f, -100.0f, MTXF_APPLY);
Matrix_Scale(gGfxMatrix, sp5C, 1.0f, 50.0f, MTXF_APPLY);
Matrix_Translate(gGfxMatrix, 0.0f, 0.0f, -17.5f, MTXF_APPLY);
Matrix_RotateX(gGfxMatrix, M_PI / 2, MTXF_APPLY);
Matrix_RotateY(gGfxMatrix, M_DTOR * sp54, MTXF_APPLY);
Matrix_SetGfxMtx(&gMasterDisp);
gSPDisplayList(gMasterDisp++, aBallDL);
Matrix_Pop(&gGfxMatrix);
}
}
f32 D_edisplay_800CFCA0[] = {
1.7f, 1.8f, 2.0f, 3.0f, 3.0f, 3.0f, 3.0f, 3.0f,
};
Expand All @@ -556,7 +615,28 @@ void Actor_DrawEngineGlow(Actor* actor, EngineGlowColor color) {
Matrix_Pop(&gGfxMatrix);
}
}
void Actor_DrawEngineGlowCustom(Actor* actor, Color_RGBA8 primary, Color_RGBA8 secondary){
f32 scale;

if ((actor->iwork[11] != 0) && (actor->obj.status == OBJ_ACTIVE)) {
scale = 0.63f;
if (actor->iwork[11] >= 2) {
scale = D_edisplay_800CFCA0[actor->iwork[11] - 2] * 0.45f;
}
if ((gGameFrameCount % 2) != 0) {
scale *= 1.2f;
}
Matrix_Push(&gGfxMatrix);
Matrix_Scale(gGfxMatrix, scale, scale, scale, MTXF_APPLY);
Matrix_RotateZ(gGfxMatrix, -actor->obj.rot.z * M_DTOR, MTXF_APPLY);
Matrix_RotateX(gGfxMatrix, -actor->obj.rot.x * M_DTOR, MTXF_APPLY);
Matrix_RotateY(gGfxMatrix, -actor->obj.rot.y * M_DTOR, MTXF_APPLY);
Matrix_RotateY(gGfxMatrix, -gPlayer[gPlayerNum].camYaw, MTXF_APPLY);
Matrix_SetGfxMtx(&gMasterDisp);
Display_DrawEngineGlowCustom(primary, secondary);
Matrix_Pop(&gGfxMatrix);
}
}
void ActorTeamArwing_Draw(ActorTeamArwing* this) {
Vec3f src = { 0.0f, 0.0f, 0.0f };
Vec3f dest;
Expand Down Expand Up @@ -606,7 +686,15 @@ void ActorTeamArwing_Draw(ActorTeamArwing* this) {
} else {
gSPDisplayList(gMasterDisp++, D_ENMY_SPACE_4007870);
}
Actor_DrawEngineAndContrails(this);
if (gCosmeticEngineGlowChanged(gLevelType, COSMETIC_GLOW_ARWING)){
Color_RGBA8 customColorPrimary = gCosmeticEngineGlowColor(gLevelType, COSMETIC_GLOW_ARWING, false);
Color_RGBA8 customColorSecondary = gCosmeticEngineGlowColor(gLevelType, COSMETIC_GLOW_ARWING, true);

Actor_DrawEngineAndContrailsCustom(this, customColorPrimary, customColorSecondary);
}
else{
Actor_DrawEngineAndContrails(this);
}
}

void MeMolarRock_Draw(MeMolarRock* this) {
Expand Down
11 changes: 10 additions & 1 deletion src/engine/fox_enmy2.c
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
#include "assets/ast_ve1_boss.h"
#include "assets/ast_zoness.h"
#include "port/hooks/Events.h"
#include "port/ui/CosmeticEditor.h"

s32 gTeamEventActorIndex[4] = { 0, 0, 0, 0 };
s32 gCallVoiceParam = 0;
Expand Down Expand Up @@ -3981,7 +3982,15 @@ void ActorEvent_Draw(ActorEvent* this) {
} else {
gSPDisplayList(gMasterDisp++, D_ENMY_SPACE_4007870);
}
Actor_DrawEngineAndContrails(this);
if (gCosmeticEngineGlowChanged(gLevelType, COSMETIC_GLOW_ARWING)){
Color_RGBA8 customColorPrimary = gCosmeticEngineGlowColor(gLevelType, COSMETIC_GLOW_ARWING, false);
Color_RGBA8 customColorSecondary = gCosmeticEngineGlowColor(gLevelType, COSMETIC_GLOW_ARWING, true);

Actor_DrawEngineAndContrailsCustom(this, customColorPrimary, customColorSecondary);
}
else{
Actor_DrawEngineAndContrails(this);
}
break;

case EVID_GRANGA_FIGHTER_2:
Expand Down
22 changes: 17 additions & 5 deletions src/engine/fox_hud.c
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
#include "fox_hud.h"
#include "prevent_bss_reordering.h"
#include "port/interpolation/FrameInterpolation.h"
#include "port/ui/CosmeticEditor.h"
#include "port/hooks/Events.h"

Vec3f D_801616A0;
Expand Down Expand Up @@ -1777,6 +1778,11 @@ void HUD_RadarMark_Arwing_Draw(s32 colorIdx) {
{ 177, 242, 12, 255 }, { 89, 121, 6, 128 }, { 90, 90, 255, 255 }, { 45, 45, 128, 128 },
{ 0, 179, 67, 255 }, { 0, 90, 34, 128 }, { 255, 30, 0, 255 }, { 128, 15, 0, 128 },
};
char* arwingMarkColorOverrides[] = { "Radar.Fox", "Radar.Fox_Dark",
"Radar.Falco", "Radar.Falco_Dark",
"Radar.Slippy", "Radar.Slippy_Dark",
"Radar.Peppy", "Radar.Peppy_Dark"
};
f32 var_fv1;
f32 var_fv2;

Expand All @@ -1789,16 +1795,16 @@ void HUD_RadarMark_Arwing_Draw(s32 colorIdx) {
}

RCP_SetupDL(&gMasterDisp, SETUPDL_62);
gDPSetPrimColor(gMasterDisp++, 0, 0, arwingMarkColor[colorIdx][0], arwingMarkColor[colorIdx][1],
arwingMarkColor[colorIdx][2], arwingMarkColor[colorIdx][3]);
gDPSetPrimColorWithOverride(gMasterDisp++, 0, 0, arwingMarkColor[colorIdx][0], arwingMarkColor[colorIdx][1],
arwingMarkColor[colorIdx][2], arwingMarkColor[colorIdx][3], arwingMarkColorOverrides[colorIdx]);
Matrix_Scale(gGfxMatrix, var_fv1, var_fv2, 1.0f, MTXF_APPLY);
Matrix_SetGfxMtx(&gMasterDisp);
gSPDisplayList(gMasterDisp++, aRadarMarkArwingDL);
}

void HUD_RadarMark_StarWolf_Draw(void) {
void HUD_RadarMark_StarWolf_Draw(char* colorOverride) {
RCP_SetupDL(&gMasterDisp, SETUPDL_62);
gDPSetPrimColor(gMasterDisp++, 0, 0, 0, 0, 0, 255);
gDPSetPrimColorWithOverride(gMasterDisp++, 0, 0, 0, 0, 0, 255, colorOverride);
Matrix_Scale(gGfxMatrix, 54.0f, 54.0f, 1.0f, MTXF_APPLY);
Matrix_SetGfxMtx(&gMasterDisp);
gSPDisplayList(gMasterDisp++, aStarWolfRadarMarkDL);
Expand Down Expand Up @@ -1890,10 +1896,16 @@ void HUD_RadarMark_Draw(s32 type) {
break;

case RADARMARK_WOLF:
HUD_RadarMark_StarWolf_Draw("Radar.Wolf");
break;
case RADARMARK_LEON:
HUD_RadarMark_StarWolf_Draw("Radar.Leon");
break;
case RADARMARK_PIGMA:
HUD_RadarMark_StarWolf_Draw("Radar.Pigma");
break;
case RADARMARK_ANDREW:
HUD_RadarMark_StarWolf_Draw();
HUD_RadarMark_StarWolf_Draw("Radar.Andrew");
break;

case RADARMARK_KATT:
Expand Down
Loading
Loading