mirror of
https://github.com/ZDoom/qzdoom.git
synced 2024-11-28 06:53:58 +00:00
- create a separate translation table for Heretic's rain pillar.
These objects are supposed to be bright, but the standard translations for player do not take this into account, creating dark and/or invisible projectiles depending on the color being used. The new translation uses hue and saturation from the player color, but combines brightness from the original color with the one for the player in an 8:2 ratio, so that no matter for the player color, these always remain bright and visible.
This commit is contained in:
parent
58196f77ff
commit
e0608f50d1
3 changed files with 32 additions and 4 deletions
|
@ -1033,7 +1033,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_SkullRodStorm)
|
||||||
if (moceiling >= 0)
|
if (moceiling >= 0)
|
||||||
mo->SetZ(newz - mo->height, false);
|
mo->SetZ(newz - mo->height, false);
|
||||||
mo->Translation = multiplayer ?
|
mo->Translation = multiplayer ?
|
||||||
TRANSLATION(TRANSLATION_PlayersExtra,self->special2) : 0;
|
TRANSLATION(TRANSLATION_RainPillar,self->special2) : 0;
|
||||||
mo->target = self->target;
|
mo->target = self->target;
|
||||||
mo->velx = 1; // Force collision detection
|
mo->velx = 1; // Force collision detection
|
||||||
mo->velz = -mo->Speed;
|
mo->velz = -mo->Speed;
|
||||||
|
|
|
@ -700,6 +700,7 @@ void R_InitTranslationTables ()
|
||||||
{
|
{
|
||||||
PushIdentityTable(TRANSLATION_Players);
|
PushIdentityTable(TRANSLATION_Players);
|
||||||
PushIdentityTable(TRANSLATION_PlayersExtra);
|
PushIdentityTable(TRANSLATION_PlayersExtra);
|
||||||
|
PushIdentityTable(TRANSLATION_RainPillar);
|
||||||
}
|
}
|
||||||
// The menu player also gets a separate translation table
|
// The menu player also gets a separate translation table
|
||||||
PushIdentityTable(TRANSLATION_Players);
|
PushIdentityTable(TRANSLATION_Players);
|
||||||
|
@ -865,6 +866,29 @@ static void SetRemap(FRemapTable *table, int i, float r, float g, float b)
|
||||||
table->Palette[i] = PalEntry(255, ir, ig, ib);
|
table->Palette[i] = PalEntry(255, ir, ig, ib);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------------
|
||||||
|
//
|
||||||
|
// Sets the translation Heretic's the rain pillar
|
||||||
|
// This tries to create a translation that preserves the brightness of
|
||||||
|
// the rain projectiles so that their effect isn't ruined.
|
||||||
|
//
|
||||||
|
//----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
static void SetPillarRemap(FRemapTable *table, int i, float h, float s, float v)
|
||||||
|
{
|
||||||
|
float ph, ps, pv;
|
||||||
|
float fr = GPalette.BaseColors[i].r / 255.f;
|
||||||
|
float fg = GPalette.BaseColors[i].g / 255.f;
|
||||||
|
float fb = GPalette.BaseColors[i].b / 255.f;
|
||||||
|
RGBtoHSV(fr, fg, fb, &ph, &ps, &pv);
|
||||||
|
HSVtoRGB(&fr, &fg, &fb, h, s, (v*0.2f + pv*0.8f));
|
||||||
|
int ir = clamp (int(fr * 255.f), 0, 255);
|
||||||
|
int ig = clamp (int(fg * 255.f), 0, 255);
|
||||||
|
int ib = clamp (int(fb * 255.f), 0, 255);
|
||||||
|
table->Remap[i] = ColorMatcher.Pick (ir, ig, ib);
|
||||||
|
table->Palette[i] = PalEntry(255, ir, ig, ib);
|
||||||
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
|
|
||||||
static bool SetRange(FRemapTable *table, int start, int end, int first, int last)
|
static bool SetRange(FRemapTable *table, int start, int end, int first, int last)
|
||||||
|
@ -900,7 +924,7 @@ static bool SetRange(FRemapTable *table, int start, int end, int first, int last
|
||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
|
|
||||||
static void R_CreatePlayerTranslation (float h, float s, float v, const FPlayerColorSet *colorset,
|
static void R_CreatePlayerTranslation (float h, float s, float v, const FPlayerColorSet *colorset,
|
||||||
FPlayerSkin *skin, FRemapTable *table, FRemapTable *alttable)
|
FPlayerSkin *skin, FRemapTable *table, FRemapTable *alttable, FRemapTable *pillartable)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
BYTE start = skin->range0start;
|
BYTE start = skin->range0start;
|
||||||
|
@ -1023,6 +1047,7 @@ static void R_CreatePlayerTranslation (float h, float s, float v, const FPlayerC
|
||||||
v = MIN (1.f, (0.2102f + 0.0489f*(float)(i - 144)) * basev);
|
v = MIN (1.f, (0.2102f + 0.0489f*(float)(i - 144)) * basev);
|
||||||
HSVtoRGB (&r, &g, &b, h, s, v);
|
HSVtoRGB (&r, &g, &b, h, s, v);
|
||||||
SetRemap(alttable, i, r, g, b);
|
SetRemap(alttable, i, r, g, b);
|
||||||
|
SetPillarRemap(pillartable, i, h, s, v);
|
||||||
}
|
}
|
||||||
alttable->UpdateNative();
|
alttable->UpdateNative();
|
||||||
}
|
}
|
||||||
|
@ -1103,7 +1128,9 @@ void R_BuildPlayerTranslation (int player)
|
||||||
R_CreatePlayerTranslation (h, s, v, colorset,
|
R_CreatePlayerTranslation (h, s, v, colorset,
|
||||||
&skins[players[player].userinfo.GetSkin()],
|
&skins[players[player].userinfo.GetSkin()],
|
||||||
translationtables[TRANSLATION_Players][player],
|
translationtables[TRANSLATION_Players][player],
|
||||||
translationtables[TRANSLATION_PlayersExtra][player]);
|
translationtables[TRANSLATION_PlayersExtra][player],
|
||||||
|
translationtables[TRANSLATION_RainPillar][player]
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
|
@ -1123,5 +1150,5 @@ void R_GetPlayerTranslation (int color, const FPlayerColorSet *colorset, FPlayer
|
||||||
RGBtoHSV (RPART(color)/255.f, GPART(color)/255.f, BPART(color)/255.f,
|
RGBtoHSV (RPART(color)/255.f, GPART(color)/255.f, BPART(color)/255.f,
|
||||||
&h, &s, &v);
|
&h, &s, &v);
|
||||||
|
|
||||||
R_CreatePlayerTranslation (h, s, v, colorset, skin, table, NULL);
|
R_CreatePlayerTranslation (h, s, v, colorset, skin, table, NULL, NULL);
|
||||||
}
|
}
|
||||||
|
|
|
@ -18,6 +18,7 @@ enum
|
||||||
TRANSLATION_PlayerCorpses,
|
TRANSLATION_PlayerCorpses,
|
||||||
TRANSLATION_Decorate,
|
TRANSLATION_Decorate,
|
||||||
TRANSLATION_Blood,
|
TRANSLATION_Blood,
|
||||||
|
TRANSLATION_RainPillar,
|
||||||
|
|
||||||
NUM_TRANSLATION_TABLES
|
NUM_TRANSLATION_TABLES
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in a new issue