mirror of
https://github.com/yquake2/yquake2remaster.git
synced 2024-11-10 07:12:07 +00:00
client: use combined color insted VID_PaletteColor
This commit is contained in:
parent
74e9708204
commit
db0328a251
4 changed files with 55 additions and 40 deletions
|
@ -122,6 +122,7 @@ Goals:
|
|||
* [x] Add debug progress loading code for maps,
|
||||
* [x] MDR model format in Star Trek: Voyager – Elite Force,
|
||||
* [ ] RGB particles support instead palette based one,
|
||||
* [ ] Get rid of VID_PaletteColor client internally,
|
||||
* [x] Broken maps groups from base2 to next,
|
||||
* [ ] Single player support,
|
||||
* [ ] Support effects and additional flags for ReRelease when possible.
|
||||
|
|
|
@ -818,6 +818,35 @@ CL_TeleporterParticles(entity_state_t *ent)
|
|||
}
|
||||
}
|
||||
|
||||
static int
|
||||
CombineColors(unsigned int basecolor, unsigned int finalcolor, float scale)
|
||||
{
|
||||
int a_beg, b_beg, c_beg, d_beg;
|
||||
int a_end, b_end, c_end, d_end;
|
||||
int a_step, b_step, c_step, d_step;
|
||||
|
||||
// get colors
|
||||
a_beg = (basecolor >> 0 ) & 0xff;
|
||||
b_beg = (basecolor >> 8 ) & 0xff;
|
||||
c_beg = (basecolor >> 16) & 0xff;
|
||||
d_beg = (basecolor >> 24) & 0xff;
|
||||
|
||||
a_end = (finalcolor >> 0 ) & 0xff;
|
||||
b_end = (finalcolor >> 8 ) & 0xff;
|
||||
c_end = (finalcolor >> 16) & 0xff;
|
||||
d_end = (finalcolor >> 24) & 0xff;
|
||||
|
||||
a_step = (a_end - a_beg) * scale;
|
||||
b_step = (b_end - b_beg) * scale;
|
||||
c_step = (c_end - c_beg) * scale;
|
||||
d_step = (d_end - d_beg) * scale;
|
||||
|
||||
return (((a_beg + a_step) << 0) & 0x000000ff) |
|
||||
(((b_beg + b_step) << 8) & 0x0000ff00) |
|
||||
(((c_beg + c_step) << 16) & 0x00ff0000) |
|
||||
(((d_beg + d_step) << 24) & 0xff000000);
|
||||
}
|
||||
|
||||
void
|
||||
CL_LogoutEffect(vec3_t org, int type)
|
||||
{
|
||||
|
@ -843,17 +872,17 @@ CL_LogoutEffect(vec3_t org, int type)
|
|||
|
||||
if (type == MZ_LOGIN)
|
||||
{
|
||||
p->color = VID_PaletteColor(0xd0 + (randk() & 7));
|
||||
p->color = CombineColors(0xff00ff00, 0xffffffff, (float)(randk() & 7) / 7.0);
|
||||
}
|
||||
|
||||
else if (type == MZ_LOGOUT)
|
||||
{
|
||||
p->color = VID_PaletteColor(0x40 + (randk() & 7));
|
||||
p->color = CombineColors(0xff2b3ba7, 0xff001357, (float)(randk() & 7) / 7.0);
|
||||
}
|
||||
|
||||
else
|
||||
{
|
||||
p->color = VID_PaletteColor(0xe0 + (randk() & 7));
|
||||
p->color = CombineColors(0xff07abff, 0xff002bab, (float)(randk() & 7) / 7.0);
|
||||
}
|
||||
|
||||
p->org[0] = org[0] - 16 + frandk() * 32;
|
||||
|
@ -895,7 +924,7 @@ CL_ItemRespawnParticles(vec3_t org)
|
|||
active_particles = p;
|
||||
|
||||
p->time = time;
|
||||
p->color = VID_PaletteColor(0xd4 + (randk() & 3));
|
||||
p->color = CombineColors(0xff2fa75f, 0xffffffff, (float)(randk() & 3) / 3.0);
|
||||
p->org[0] = org[0] + crandk() * 8;
|
||||
p->org[1] = org[1] + crandk() * 8;
|
||||
p->org[2] = org[2] + crandk() * 8;
|
||||
|
@ -935,7 +964,7 @@ CL_ExplosionParticles(vec3_t org)
|
|||
active_particles = p;
|
||||
|
||||
p->time = time;
|
||||
p->color = VID_PaletteColor(0xe0 + (randk() & 7));
|
||||
p->color = CombineColors(0xff07abff, 0xff002bab, (float)(randk() & 7) / 7.0);
|
||||
|
||||
for (j = 0; j < 3; j++)
|
||||
{
|
||||
|
@ -1025,7 +1054,7 @@ CL_BlasterParticles(vec3_t org, vec3_t dir)
|
|||
active_particles = p;
|
||||
|
||||
p->time = time;
|
||||
p->color = VID_PaletteColor(0xe0 + (randk() & 7));
|
||||
p->color = CombineColors(0xff07abff, 0xff002bab, (float)(randk() & 7) / 7.0);
|
||||
d = randk() & 15;
|
||||
|
||||
for (j = 0; j < 3; j++)
|
||||
|
@ -1147,7 +1176,7 @@ CL_QuadTrail(vec3_t start, vec3_t end)
|
|||
}
|
||||
|
||||
void
|
||||
CL_FlagTrailRGB(vec3_t start, vec3_t end, int color)
|
||||
CL_FlagTrail(vec3_t start, vec3_t end, int color)
|
||||
{
|
||||
vec3_t move;
|
||||
vec3_t vec;
|
||||
|
@ -1198,12 +1227,6 @@ CL_FlagTrailRGB(vec3_t start, vec3_t end, int color)
|
|||
}
|
||||
}
|
||||
|
||||
void
|
||||
CL_FlagTrail(vec3_t start, vec3_t end, int color)
|
||||
{
|
||||
CL_FlagTrailRGB(start, end, VID_PaletteColor(color));
|
||||
}
|
||||
|
||||
void
|
||||
CL_DiminishingTrail(vec3_t start, vec3_t end, centity_t *old, int flags)
|
||||
{
|
||||
|
@ -1266,7 +1289,7 @@ CL_DiminishingTrail(vec3_t start, vec3_t end, centity_t *old, int flags)
|
|||
{
|
||||
p->alpha = 1.0;
|
||||
p->alphavel = -1.0f / (1 + frandk() * 0.4f);
|
||||
p->color = VID_PaletteColor(0xe8 + (randk() & 7));
|
||||
p->color = CombineColors(0xff001f9b, 0xff00001b, (float)(randk() & 7) / 7.0);
|
||||
|
||||
for (j = 0; j < 3; j++)
|
||||
{
|
||||
|
@ -1281,7 +1304,7 @@ CL_DiminishingTrail(vec3_t start, vec3_t end, centity_t *old, int flags)
|
|||
{
|
||||
p->alpha = 1.0;
|
||||
p->alphavel = -1.0f / (1 + frandk() * 0.4f);
|
||||
p->color = VID_PaletteColor(0xdb + (randk() & 7));
|
||||
p->color = CombineColors(0xff53ffff, 0xff007fef, (float)(randk() & 7) / 7.0);
|
||||
|
||||
for (j = 0; j < 3; j++)
|
||||
{
|
||||
|
@ -1296,7 +1319,7 @@ CL_DiminishingTrail(vec3_t start, vec3_t end, centity_t *old, int flags)
|
|||
{
|
||||
p->alpha = 1.0;
|
||||
p->alphavel = -1.0f / (1 + frandk() * 0.2f);
|
||||
p->color = VID_PaletteColor(0x04 + (randk() & 7));
|
||||
p->color = CombineColors(0xff3f3f3f, 0xffababab, (float)(randk() & 7) / 7.0);
|
||||
|
||||
for (j = 0; j < 3; j++)
|
||||
{
|
||||
|
@ -1381,7 +1404,7 @@ CL_RocketTrail(vec3_t start, vec3_t end, centity_t *old)
|
|||
|
||||
p->alpha = 1.0;
|
||||
p->alphavel = -1.0f / (1 + frandk() * 0.2f);
|
||||
p->color = VID_PaletteColor(0xdc + (randk() & 3));
|
||||
p->color = CombineColors(0xff27ffff, 0xff0fbfff, (float)(randk() & 3) / 3.0);
|
||||
|
||||
for (j = 0; j < 3; j++)
|
||||
{
|
||||
|
@ -1409,7 +1432,6 @@ CL_RailTrail(vec3_t start, vec3_t end)
|
|||
int i;
|
||||
float d, c, s;
|
||||
vec3_t dir;
|
||||
byte clr = 0x74;
|
||||
float time;
|
||||
|
||||
time = (float)cl.time;
|
||||
|
@ -1444,7 +1466,7 @@ CL_RailTrail(vec3_t start, vec3_t end)
|
|||
|
||||
p->alpha = 1.0;
|
||||
p->alphavel = -1.0f / (1 + frandk() * 0.2f);
|
||||
p->color = VID_PaletteColor(clr + (randk() & 7));
|
||||
p->color = CombineColors(0xff6f5317, 0xff2b1f00, (float)(randk() & 7) / 7.0);
|
||||
|
||||
for (j = 0; j < 3; j++)
|
||||
{
|
||||
|
@ -1478,7 +1500,7 @@ CL_RailTrail(vec3_t start, vec3_t end)
|
|||
|
||||
p->alpha = 1.0;
|
||||
p->alphavel = -1.0f / (0.6f + frandk() * 0.2f);
|
||||
p->color = VID_PaletteColor(0x0 + (randk() & 15));
|
||||
p->color = CombineColors(0xff000000, 0xffebebeb, (float)(randk() & 15) / 15.0);
|
||||
|
||||
for (j = 0; j < 3; j++)
|
||||
{
|
||||
|
@ -1530,7 +1552,7 @@ CL_IonripperTrail(vec3_t start, vec3_t ent)
|
|||
p->time = time;
|
||||
p->alpha = 0.5;
|
||||
p->alphavel = -1.0f / (0.3f + frandk() * 0.2f);
|
||||
p->color = VID_PaletteColor(0xe4 + (randk() & 3));
|
||||
p->color = CombineColors(0xff0057d3, 0xff002bab, (float)(randk() & 3) / 3.0);
|
||||
|
||||
for (j = 0; j < 3; j++)
|
||||
{
|
||||
|
@ -1593,7 +1615,7 @@ CL_BubbleTrail(vec3_t start, vec3_t end)
|
|||
|
||||
p->alpha = 1.0;
|
||||
p->alphavel = -1.0f / (1 + frandk() * 0.2f);
|
||||
p->color = VID_PaletteColor(0x04 + (randk() & 7));
|
||||
p->color = CombineColors(0xff3f3f3f, 0xffababab, (float)(randk() & 7) / 7.0);
|
||||
|
||||
for (j = 0; j < 3; j++)
|
||||
{
|
||||
|
@ -1873,7 +1895,7 @@ CL_TrapParticles(entity_t *ent)
|
|||
active_particles = p;
|
||||
|
||||
p->time = time;
|
||||
p->color = VID_PaletteColor(0xe0 + (randk() & 3));
|
||||
p->color = CombineColors(0xff07abff, 0xff006be3, (float)(randk() & 3) / 3.0);
|
||||
p->alpha = 1.0;
|
||||
p->alphavel = -1.0f / (0.3f + (randk() & 7) * 0.02f);
|
||||
|
||||
|
@ -1919,7 +1941,7 @@ CL_BFGExplosionParticles(vec3_t org)
|
|||
active_particles = p;
|
||||
|
||||
p->time = time;
|
||||
p->color = VID_PaletteColor(0xd0 + (randk() & 7));
|
||||
p->color = CombineColors(0xff00ff00, 0xffffffff, (float)(randk() & 7) / 7.0);
|
||||
|
||||
for (j = 0; j < 3; j++)
|
||||
{
|
||||
|
@ -1963,7 +1985,7 @@ CL_TeleportParticles(vec3_t org)
|
|||
active_particles = p;
|
||||
|
||||
p->time = time;
|
||||
p->color = VID_PaletteColor(0x07 + (randk() & 7));
|
||||
p->color = CombineColors(0xff6b6b6b, 0xffdbdbdb, (float)(randk() & 7) / 7.0);
|
||||
p->alpha = 1.0;
|
||||
p->alphavel = -1.0f / (0.3f + (randk() & 7) * 0.02f);
|
||||
|
||||
|
@ -2109,7 +2131,7 @@ CL_DebugTrail(vec3_t start, vec3_t end)
|
|||
VectorClear(p->vel);
|
||||
p->alpha = 1.0;
|
||||
p->alphavel = -0.1f;
|
||||
p->color = VID_PaletteColor(0x74 + (randk() & 7));
|
||||
p->color = CombineColors(0xff6f5317, 0xff2b1f00, (float)(randk() & 7) / 7.0);
|
||||
VectorCopy(move, p->org);
|
||||
VectorAdd(move, vec, move);
|
||||
}
|
||||
|
@ -2261,7 +2283,7 @@ CL_BubbleTrail2(vec3_t start, vec3_t end, int dist)
|
|||
|
||||
p->alpha = 1.0;
|
||||
p->alphavel = -1.0f / (1 + frandk() * 0.1f);
|
||||
p->color = VID_PaletteColor(0x04 + (randk() & 7));
|
||||
p->color = CombineColors(0xff3f3f3f, 0xffababab, (float)(randk() & 7) / 7.0);
|
||||
|
||||
for (j = 0; j < 3; j++)
|
||||
{
|
||||
|
@ -2356,7 +2378,7 @@ CL_Heatbeam(vec3_t start, vec3_t forward)
|
|||
|
||||
p->alpha = 0.5;
|
||||
p->alphavel = -1000.0;
|
||||
p->color = VID_PaletteColor(0xdf - (randk() & 7));
|
||||
p->color = CombineColors(0xff0fbfff, 0xff003bb7, (float)(randk() & 7) / 7.0);
|
||||
|
||||
for (j = 0; j < 3; j++)
|
||||
{
|
||||
|
@ -2759,7 +2781,7 @@ CL_Tracker_Explode(vec3_t origin)
|
|||
}
|
||||
|
||||
void
|
||||
CL_TagTrailRGB(vec3_t start, vec3_t end, int color)
|
||||
CL_TagTrail(vec3_t start, vec3_t end, int color)
|
||||
{
|
||||
vec3_t move;
|
||||
vec3_t vec;
|
||||
|
@ -2810,12 +2832,6 @@ CL_TagTrailRGB(vec3_t start, vec3_t end, int color)
|
|||
}
|
||||
}
|
||||
|
||||
void
|
||||
CL_TagTrail(vec3_t start, vec3_t end, int color)
|
||||
{
|
||||
CL_TagTrailRGB(start, end, VID_PaletteColor(color));
|
||||
}
|
||||
|
||||
void
|
||||
CL_ColorExplosionParticles(vec3_t org, int color, int run)
|
||||
{
|
||||
|
|
|
@ -531,17 +531,17 @@ CL_AddPacketEntities(frame_t *frame)
|
|||
}
|
||||
else if (effects & EF_FLAG1)
|
||||
{
|
||||
CL_FlagTrailRGB(cent->lerp_origin, ent.origin, 0xff0000ff);
|
||||
CL_FlagTrail(cent->lerp_origin, ent.origin, 0xff0000ff);
|
||||
V_AddLight(ent.origin, 225, 1, 0.1f, 0.1f);
|
||||
}
|
||||
else if (effects & EF_FLAG2)
|
||||
{
|
||||
CL_FlagTrailRGB(cent->lerp_origin, ent.origin, 0xff7f672f);
|
||||
CL_FlagTrail(cent->lerp_origin, ent.origin, 0xff7f672f);
|
||||
V_AddLight(ent.origin, 225, 0.1f, 0.1f, 1);
|
||||
}
|
||||
else if (effects & EF_TAGTRAIL)
|
||||
{
|
||||
CL_TagTrailRGB(cent->lerp_origin, ent.origin, 0xff27ffff);
|
||||
CL_TagTrail(cent->lerp_origin, ent.origin, 0xff27ffff);
|
||||
V_AddLight(ent.origin, 225, 1.0, 1.0, 0.0);
|
||||
}
|
||||
else if (effects & EF_TRACKERTRAIL)
|
||||
|
|
|
@ -392,7 +392,6 @@ void CL_QuadTrail (vec3_t start, vec3_t end);
|
|||
void CL_RailTrail (vec3_t start, vec3_t end);
|
||||
void CL_BubbleTrail (vec3_t start, vec3_t end);
|
||||
void CL_FlagTrail (vec3_t start, vec3_t end, int color);
|
||||
void CL_FlagTrailRGB (vec3_t start, vec3_t end, int color);
|
||||
|
||||
void CL_IonripperTrail (vec3_t start, vec3_t end);
|
||||
|
||||
|
@ -410,7 +409,6 @@ void CL_ParticleSteamEffect (vec3_t org, vec3_t dir, int color, int count, int m
|
|||
void CL_TrackerTrail (vec3_t start, vec3_t end, int particleColor);
|
||||
void CL_Tracker_Explode(vec3_t origin);
|
||||
void CL_TagTrail (vec3_t start, vec3_t end, int color);
|
||||
void CL_TagTrailRGB (vec3_t start, vec3_t end, int color);
|
||||
void CL_ColorFlash (vec3_t pos, int ent, float intensity, float r, float g, float b);
|
||||
void CL_Tracker_Shell(vec3_t origin);
|
||||
void CL_MonsterPlasma_Shell(vec3_t origin);
|
||||
|
|
Loading…
Reference in a new issue