Skip to content

Commit

Permalink
switch to Color_RGBA8 solution
Browse files Browse the repository at this point in the history
  • Loading branch information
Archez committed May 30, 2024
1 parent 3ed3277 commit 0d298c3
Showing 1 changed file with 14 additions and 17 deletions.
31 changes: 14 additions & 17 deletions mm/src/code/z_kankyo.c
Original file line number Diff line number Diff line change
Expand Up @@ -3161,24 +3161,18 @@ void Environment_DrawSkyboxStarsImpl(PlayState* play, Gfx** gfxP) {
{ 0xD058, 0x4C2C, 0x3A98 }, { 0xD8F0, 0x36B0, 0x47E0 }, { 0xD954, 0x3264, 0x3E1C }, { 0xD8F0, 0x3070, 0x37DC },
{ 0xD8F0, 0x1F40, 0x5208 }, { 0xD760, 0x1838, 0x27D8 }, { 0x0000, 0x4E20, 0x4A38 }, { 0x076C, 0x2328, 0xDCD8 },
};
// 2S2H [Port] Added designator field names to preserve the order of the union in Color_RGBA8_u32 for little endian
static const Color_RGBA8_u32 D_801DD8E0[] = {
{ .r = 65, .g = 164, .b = 255, .a = 255 }, { .r = 131, .g = 164, .b = 230, .a = 255 },
{ .r = 98, .g = 205, .b = 255, .a = 255 }, { .r = 82, .g = 82, .b = 255, .a = 255 },
{ .r = 123, .g = 164, .b = 164, .a = 255 }, { .r = 98, .g = 205, .b = 255, .a = 255 },
{ .r = 98, .g = 164, .b = 230, .a = 255 }, { .r = 255, .g = 90, .b = 0, .a = 255 },
// 2S2H [Port] Switched from Color_RGBA8_u32 to Color_RGBA8 to avoid endianenes struct union ordering issues
static const Color_RGBA8 D_801DD8E0[] = {
{ 65, 164, 255, 255 }, { 131, 164, 230, 255 }, { 98, 205, 255, 255 }, { 82, 82, 255, 255 },
{ 123, 164, 164, 255 }, { 98, 205, 255, 255 }, { 98, 164, 230, 255 }, { 255, 90, 0, 255 },
};
// 2S2H [Port] This originally had `UNALIGNED` however we don't need that for PC and it was causing warnings in the
// header file
static const Color_RGBA8_u32 D_801DD900[] = {
{ .r = 64, .g = 80, .b = 112, .a = 255 }, { .r = 96, .g = 96, .b = 128, .a = 255 },
{ .r = 128, .g = 112, .b = 144, .a = 255 }, { .r = 160, .g = 128, .b = 160, .a = 255 },
{ .r = 192, .g = 144, .b = 168, .a = 255 }, { .r = 224, .g = 160, .b = 176, .a = 255 },
{ .r = 224, .g = 160, .b = 176, .a = 255 }, { .r = 104, .g = 104, .b = 136, .a = 255 },
{ .r = 136, .g = 120, .b = 152, .a = 255 }, { .r = 168, .g = 136, .b = 168, .a = 255 },
{ .r = 200, .g = 152, .b = 184, .a = 255 }, { .r = 232, .g = 168, .b = 184, .a = 255 },
{ .r = 224, .g = 176, .b = 184, .a = 255 }, { .r = 240, .g = 192, .b = 192, .a = 255 },
{ .r = 232, .g = 184, .b = 192, .a = 255 }, { .r = 248, .g = 200, .b = 192, .a = 255 },
static const Color_RGBA8 D_801DD900[] = {
{ 64, 80, 112, 255 }, { 96, 96, 128, 255 }, { 128, 112, 144, 255 }, { 160, 128, 160, 255 },
{ 192, 144, 168, 255 }, { 224, 160, 176, 255 }, { 224, 160, 176, 255 }, { 104, 104, 136, 255 },
{ 136, 120, 152, 255 }, { 168, 136, 168, 255 }, { 200, 152, 184, 255 }, { 232, 168, 184, 255 },
{ 224, 176, 184, 255 }, { 240, 192, 192, 255 }, { 232, 184, 192, 255 }, { 248, 200, 192, 255 },
};
Vec3f pos;
f32 temp;
Expand Down Expand Up @@ -3275,9 +3269,12 @@ void Environment_DrawSkyboxStarsImpl(PlayState* play, Gfx** gfxP) {
}

if ((i < 15) || ((i == 15) && ((((void)0, gSaveContext.save.day) % 7) == 0))) {
gDPSetColor(gfx++, G_SETPRIMCOLOR, D_801DD8E0[i % ARRAY_COUNTU(D_801DD8E0)].rgba);
// 2S2H [Port] Switched from gDPSetColor to gDPSetPrimColor for Color_RGBA8 individual fields
Color_RGBA8 color = D_801DD8E0[i % ARRAY_COUNTU(D_801DD8E0)];
gDPSetPrimColor(gfx++, 0, 0, color.r, color.g, color.b, color.a);
} else if (((i & 0x3F) == 0) || (i == 16)) {
gDPSetColor(gfx++, G_SETPRIMCOLOR, D_801DD900[phi_v1 % ARRAY_COUNTU(D_801DD900)].rgba);
Color_RGBA8 color = D_801DD900[phi_v1 % ARRAY_COUNTU(D_801DD900)];
gDPSetPrimColor(gfx++, 0, 0, color.r, color.g, color.b, color.a);
phi_v1++;
}

Expand Down

0 comments on commit 0d298c3

Please sign in to comment.