diff --git a/README.md b/README.md index b3338cbb2..a22f52008 100644 --- a/README.md +++ b/README.md @@ -186,9 +186,10 @@ Goals: * [x] Support flow/scale flags for Q64 maps, * [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, +* [x] RGB particles support instead palette based one, +* [x] Get rid of VID_PaletteColor client internal api use, * [x] Broken maps groups from base2 to next, -* [ ] Single player support, +* [ ] Single player ReRelease support, * [ ] Support effects and additional flags for ReRelease when possible. * [ ] Use shared model cache in client code insted reimplemnet in each render, * [ ] Check load soft colormap as 24bit color, diff --git a/doc/040_cvarlist.md b/doc/040_cvarlist.md index 89eb24b9c..ee60685f6 100644 --- a/doc/040_cvarlist.md +++ b/doc/040_cvarlist.md @@ -302,6 +302,15 @@ it's `+set busywait 0` (setting the `busywait` cvar) and `-portable` 0. Setting this cvar to `1` disables this behavior, the music keeps playing. +* **ogg_shuffle**: Ogg/Vorbis playback mode. Supported modes are: + `0`: Loop the current track (the default). + `1`: Play the current track once, then stop. + `2`: Play all available tracks in a linear sequence. + `3`: Shuffle through the available tracks, never play the same track + twice in a row. + `4`: Shuffle through the available tracks, may play the same track + multiple times in a row. + * **s_doppler**: If set to `1` doppler effects are enabled. This is only supported by the OpenAL sound backend. diff --git a/src/client/cl_effects.c b/src/client/cl_effects.c index f59471ef4..e9f2f8c81 100644 --- a/src/client/cl_effects.c +++ b/src/client/cl_effects.c @@ -384,7 +384,7 @@ CL_AddMuzzleFlash2(void) dl->color[0] = 1; dl->color[1] = 1; dl->color[2] = 0; - CL_ParticleEffect(origin, vec3_origin, 0, 40); + CL_ParticleEffect(origin, vec3_origin, 0xff000000, 0xff6b6b6b, 40); CL_SmokeAndFlash(origin); S_StartSound(NULL, ent, CHAN_WEAPON, S_RegisterSound("infantry/infatck1.wav"), 1, ATTN_NORM, 0); @@ -401,7 +401,7 @@ CL_AddMuzzleFlash2(void) dl->color[0] = 1; dl->color[1] = 1; dl->color[2] = 0; - CL_ParticleEffect(origin, vec3_origin, 0, 40); + CL_ParticleEffect(origin, vec3_origin, 0xff000000, 0xff6b6b6b, 40); CL_SmokeAndFlash(origin); S_StartSound(NULL, ent, CHAN_WEAPON, S_RegisterSound("soldier/solatck3.wav"), 1, ATTN_NORM, 0); @@ -418,7 +418,7 @@ CL_AddMuzzleFlash2(void) dl->color[0] = 1; dl->color[1] = 1; dl->color[2] = 0; - CL_ParticleEffect(origin, vec3_origin, 0, 40); + CL_ParticleEffect(origin, vec3_origin, 0xff000000, 0xff6b6b6b, 40); CL_SmokeAndFlash(origin); S_StartSound(NULL, ent, CHAN_WEAPON, S_RegisterSound("gunner/gunatck2.wav"), 1, ATTN_NORM, 0); @@ -436,7 +436,7 @@ CL_AddMuzzleFlash2(void) dl->color[1] = 1; dl->color[2] = 0; - CL_ParticleEffect(origin, vec3_origin, 0, 40); + CL_ParticleEffect(origin, vec3_origin, 0xff000000, 0xff6b6b6b, 40); CL_SmokeAndFlash(origin); S_StartSound(NULL, ent, CHAN_WEAPON, S_RegisterSound("infantry/infatck1.wav"), 1, ATTN_NORM, 0); @@ -453,7 +453,7 @@ CL_AddMuzzleFlash2(void) dl->color[1] = 1; dl->color[2] = 0; - CL_ParticleEffect(origin, vec3_origin, 0, 40); + CL_ParticleEffect(origin, vec3_origin, 0xff000000, 0xff6b6b6b, 40); CL_SmokeAndFlash(origin); S_StartSound(NULL, ent, CHAN_WEAPON, S_RegisterSound("infantry/infatck1.wav"), 1, ATTN_NONE, 0); @@ -556,7 +556,7 @@ CL_AddMuzzleFlash2(void) dl->color[0] = 1; dl->color[1] = 1; dl->color[2] = 0; - CL_ParticleEffect(origin, vec3_origin, 0, 40); + CL_ParticleEffect(origin, vec3_origin, 0xff000000, 0xff6b6b6b, 40); CL_SmokeAndFlash(origin); Com_sprintf(soundname, sizeof(soundname), "tank/tnkatk2%c.wav", 'a' + (char)(randk() % 5)); @@ -656,7 +656,7 @@ CL_AddMuzzleFlash2(void) dl->color[0] = 1; dl->color[1] = 1; dl->color[2] = 0; - CL_ParticleEffect(origin, vec3_origin, 0, 40); + CL_ParticleEffect(origin, vec3_origin, 0xff000000, 0xff6b6b6b, 40); CL_SmokeAndFlash(origin); S_StartSound(NULL, ent, CHAN_WEAPON, S_RegisterSound("boss3/xfire.wav"), 1, ATTN_NORM, 0); @@ -671,7 +671,7 @@ CL_AddMuzzleFlash2(void) dl->color[0] = 1; dl->color[1] = 1; dl->color[2] = 0; - CL_ParticleEffect(origin, vec3_origin, 0, 40); + CL_ParticleEffect(origin, vec3_origin, 0xff000000, 0xff6b6b6b, 40); CL_SmokeAndFlash(origin); break; @@ -693,7 +693,7 @@ CL_AddMuzzleFlash2(void) dl->color[1] = 1; dl->color[2] = 0; - CL_ParticleEffect(origin, vec3_origin, 0, 40); + CL_ParticleEffect(origin, vec3_origin, 0xff000000, 0xff6b6b6b, 40); CL_SmokeAndFlash(origin); break; @@ -818,6 +818,35 @@ CL_TeleporterParticles(entity_state_t *ent) } } +unsigned int +CL_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,20 @@ CL_LogoutEffect(vec3_t org, int type) if (type == MZ_LOGIN) { - p->color = VID_PaletteColor(0xd0 + (randk() & 7)); + p->color = CL_CombineColors(0xff00ff00, 0xffffffff, + (float)(randk() & 15) / 15.0); } else if (type == MZ_LOGOUT) { - p->color = VID_PaletteColor(0x40 + (randk() & 7)); + p->color = CL_CombineColors(0xff2b3ba7, 0xff001357, + (float)(randk() & 15) / 15.0); } else { - p->color = VID_PaletteColor(0xe0 + (randk() & 7)); + p->color = CL_CombineColors(0xff07abff, 0xff002bab, + (float)(randk() & 15) / 15.0); } p->org[0] = org[0] - 16 + frandk() * 32; @@ -895,7 +927,8 @@ CL_ItemRespawnParticles(vec3_t org) active_particles = p; p->time = time; - p->color = VID_PaletteColor(0xd4 + (randk() & 3)); + p->color = CL_CombineColors(0xff2fa75f, 0xffffffff, + (float)(randk() & 15) / 15.0); p->org[0] = org[0] + crandk() * 8; p->org[1] = org[1] + crandk() * 8; p->org[2] = org[2] + crandk() * 8; @@ -935,7 +968,8 @@ CL_ExplosionParticles(vec3_t org) active_particles = p; p->time = time; - p->color = VID_PaletteColor(0xe0 + (randk() & 7)); + p->color = CL_CombineColors(0xff07abff, 0xff002bab, + (float)(randk() & 15) / 15.0); for (j = 0; j < 3; j++) { @@ -951,6 +985,20 @@ CL_ExplosionParticles(vec3_t org) } } +static int default_colortable[] = { + 0xff234b63, /* 0x10 */ + 0xff4f5bb3, /* 0x68 */ + 0xff0f1b4f, /* 0xa8 */ + 0xff7b9f97, /* 0x90 */ +}; + +static int nuke_colortable[] = { + 0xffc3b79f, /* 0x10 */ + 0xffa79773, /* 0x68 */ + 0xff8b7747, /* 0xa8 */ + 0xff6f5317, /* 0x90 */ +}; + void CL_BigTeleportParticles(vec3_t org) { @@ -960,7 +1008,6 @@ CL_BigTeleportParticles(vec3_t org) time = (float)cl.time; float angle, dist; - static int colortable[4] = {2 * 8, 13 * 8, 21 * 8, 18 * 8}; for (i = 0; i < 4096; i++) { @@ -975,7 +1022,7 @@ CL_BigTeleportParticles(vec3_t org) active_particles = p; p->time = time; - p->color = VID_PaletteColor(colortable[randk() & 3]); + p->color = default_colortable[randk() & 3]; angle = M_PI * 2 * (randk() & 1023) / 1023.0f; dist = (float)(randk() & 31); @@ -1025,7 +1072,8 @@ CL_BlasterParticles(vec3_t org, vec3_t dir) active_particles = p; p->time = time; - p->color = VID_PaletteColor(0xe0 + (randk() & 7)); + p->color = CL_CombineColors(0xff07abff, 0xff002bab, + (float)(randk() & 15) / 15.0); d = randk() & 15; for (j = 0; j < 3; j++) @@ -1185,7 +1233,7 @@ CL_FlagTrail(vec3_t start, vec3_t end, int color) p->alpha = 1.0; p->alphavel = -1.0f / (0.8f + frandk() * 0.2f); - p->color = VID_PaletteColor(color); + p->color = color; for (j = 0; j < 3; j++) { @@ -1260,7 +1308,8 @@ 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 = CL_CombineColors(0xff001f9b, 0xff00001b, + (float)(randk() & 15) / 15.0); for (j = 0; j < 3; j++) { @@ -1275,7 +1324,8 @@ 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 = CL_CombineColors(0xff53ffff, 0xff007fef, + (float)(randk() & 15) / 15.0); for (j = 0; j < 3; j++) { @@ -1290,7 +1340,8 @@ 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 = CL_CombineColors(0xff3f3f3f, 0xffababab, + (float)(randk() & 15) / 15.0); for (j = 0; j < 3; j++) { @@ -1375,7 +1426,8 @@ 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 = CL_CombineColors(0xff27ffff, 0xff0fbfff, + (float)(randk() & 15) / 15.0); for (j = 0; j < 3; j++) { @@ -1403,7 +1455,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; @@ -1438,7 +1489,8 @@ 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 = CL_CombineColors(0xff6f5317, 0xff2b1f00, + (float)(randk() & 15) / 15.0); for (j = 0; j < 3; j++) { @@ -1472,7 +1524,8 @@ 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 = CL_CombineColors(0xff000000, 0xffebebeb, + (float)(randk() & 15) / 15.0); for (j = 0; j < 3; j++) { @@ -1524,7 +1577,8 @@ 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 = CL_CombineColors(0xff0057d3, 0xff002bab, + (float)(randk() & 15) / 15.0); for (j = 0; j < 3; j++) { @@ -1587,7 +1641,8 @@ 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 = CL_CombineColors(0xff3f3f3f, 0xffababab, + (float)(randk() & 15) / 15.0); for (j = 0; j < 3; j++) { @@ -1775,7 +1830,7 @@ CL_BfgParticles(entity_t *ent) VectorSubtract(p->org, ent->origin, v); dist = VectorLength(v) / 90.0f; - p->color = VID_PaletteColor((int)floor(0xd0 + dist * 7)); + p->color = CL_CombineColors(0xff00ff00, 0xffffffff, dist); p->alpha = 1.0f - dist; p->alphavel = -100; } @@ -1867,7 +1922,8 @@ CL_TrapParticles(entity_t *ent) active_particles = p; p->time = time; - p->color = VID_PaletteColor(0xe0 + (randk() & 3)); + p->color = CL_CombineColors(0xff07abff, 0xff006be3, + (float)(randk() & 15) / 15.0); p->alpha = 1.0; p->alphavel = -1.0f / (0.3f + (randk() & 7) * 0.02f); @@ -1913,7 +1969,8 @@ CL_BFGExplosionParticles(vec3_t org) active_particles = p; p->time = time; - p->color = VID_PaletteColor(0xd0 + (randk() & 7)); + p->color = CL_CombineColors(0xff00ff00, 0xffffffff, + (float)(randk() & 15) / 15.0); for (j = 0; j < 3; j++) { @@ -1957,7 +2014,8 @@ CL_TeleportParticles(vec3_t org) active_particles = p; p->time = time; - p->color = VID_PaletteColor(0x07 + (randk() & 7)); + p->color = CL_CombineColors(0xff6b6b6b, 0xffdbdbdb, + (float)(randk() & 15) / 15.0); p->alpha = 1.0; p->alphavel = -1.0f / (0.3f + (randk() & 7) * 0.02f); @@ -2103,15 +2161,16 @@ 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 = CL_CombineColors(0xff6f5317, 0xff2b1f00, + (float)(randk() & 15) / 15.0); VectorCopy(move, p->org); VectorAdd(move, vec, move); } } void -CL_SmokeTrail(vec3_t start, vec3_t end, int colorStart, - int colorRun, int spacing) +CL_SmokeTrail(vec3_t start, vec3_t end, unsigned int basecolor, unsigned int finalcolor, + int spacing) { vec3_t move; vec3_t vec; @@ -2146,7 +2205,9 @@ CL_SmokeTrail(vec3_t start, vec3_t end, int colorStart, p->alpha = 1.0; p->alphavel = -1.0f / (1 + frandk() * 0.5f); - p->color = VID_PaletteColor(colorStart + (float)(randk() % colorRun)); + p->color = CL_CombineColors(basecolor, finalcolor, + (float)(randk() & 15) / 15.0); + for (j = 0; j < 3; j++) { @@ -2161,7 +2222,7 @@ CL_SmokeTrail(vec3_t start, vec3_t end, int colorStart, } void -CL_ForceWall(vec3_t start, vec3_t end, int color8) +CL_ForceWall(vec3_t start, vec3_t end, int color) { vec3_t move; vec3_t vec; @@ -2199,7 +2260,7 @@ CL_ForceWall(vec3_t start, vec3_t end, int color8) p->alpha = 1.0; p->alphavel = -1.0f / (3.0 + frandk() * 0.5f); - p->color = VID_PaletteColor(color8); + p->color = color; for (j = 0; j < 3; j++) { @@ -2255,7 +2316,8 @@ 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 = CL_CombineColors(0xff3f3f3f, 0xffababab, + (float)(randk() & 15) / 15.0); for (j = 0; j < 3; j++) { @@ -2350,7 +2412,8 @@ 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 = CL_CombineColors(0xff0fbfff, 0xff003bb7, + (float)(randk() & 15) / 15.0); for (j = 0; j < 3; j++) { @@ -2367,7 +2430,7 @@ CL_Heatbeam(vec3_t start, vec3_t forward) *Puffs with velocity along direction, with some randomness thrown in */ void -CL_ParticleSteamEffect(vec3_t org, vec3_t dir, int color, +CL_ParticleSteamEffect(vec3_t org, vec3_t dir, unsigned int basecolor, unsigned int finalcolor, int count, int magnitude) { int i, j; @@ -2391,7 +2454,8 @@ CL_ParticleSteamEffect(vec3_t org, vec3_t dir, int color, active_particles = p; p->time = time; - p->color = VID_PaletteColor(color + (randk() & 7)); + p->color = CL_CombineColors(basecolor, finalcolor, + (float)(randk() & 15) / 15.0); for (j = 0; j < 3; j++) { @@ -2437,7 +2501,8 @@ CL_ParticleSteamEffect2(cl_sustain_t *self) active_particles = p; p->time = cl.time; - p->color = VID_PaletteColor(self->color + (randk() & 7)); + p->color = CL_CombineColors(self->basecolor, self->finalcolor, + (float)(randk() & 15) / 15.0); for (j = 0; j < 3; j++) { @@ -2461,7 +2526,7 @@ CL_ParticleSteamEffect2(cl_sustain_t *self) } void -CL_TrackerTrail(vec3_t start, vec3_t end, int particleColor) +CL_TrackerTrail(vec3_t start, vec3_t end, unsigned int color) { vec3_t move; vec3_t vec; @@ -2504,7 +2569,7 @@ CL_TrackerTrail(vec3_t start, vec3_t end, int particleColor) p->alpha = 1.0; p->alphavel = -2.0; - p->color = VID_PaletteColor(particleColor); + p->color = color; dist = DotProduct(move, forward); VectorMA(move, 8 * cos(dist), up, p->org); @@ -2600,7 +2665,6 @@ CL_Widowbeamout(cl_sustain_t *self) vec3_t dir; int i; cparticle_t *p; - static int colortable[4] = {2 * 8, 13 * 8, 21 * 8, 18 * 8}; float ratio; float time; @@ -2624,7 +2688,7 @@ CL_Widowbeamout(cl_sustain_t *self) p->alpha = 1.0; p->alphavel = INSTANT_PARTICLE; - p->color = VID_PaletteColor(colortable[randk() & 3]); + p->color = default_colortable[randk() & 3]; dir[0] = crandk(); dir[1] = crandk(); dir[2] = crandk(); @@ -2640,7 +2704,6 @@ CL_Nukeblast(cl_sustain_t *self) vec3_t dir; int i; cparticle_t *p; - static int colortable[4] = {110, 112, 114, 116}; float ratio; float time; @@ -2664,7 +2727,7 @@ CL_Nukeblast(cl_sustain_t *self) p->alpha = 1.0; p->alphavel = INSTANT_PARTICLE; - p->color = VID_PaletteColor(colortable[randk() & 3]); + p->color = nuke_colortable[randk() & 3]; dir[0] = crandk(); dir[1] = crandk(); dir[2] = crandk(); @@ -2677,7 +2740,6 @@ CL_Nukeblast(cl_sustain_t *self) void CL_WidowSplash(vec3_t org) { - static int colortable[4] = {2 * 8, 13 * 8, 21 * 8, 18 * 8}; int i; cparticle_t *p; vec3_t dir; @@ -2698,7 +2760,7 @@ CL_WidowSplash(vec3_t org) active_particles = p; p->time = time; - p->color = VID_PaletteColor(colortable[randk() & 3]); + p->color = default_colortable[randk() & 3]; dir[0] = crandk(); dir[1] = crandk(); dir[2] = crandk(); @@ -2791,7 +2853,7 @@ CL_TagTrail(vec3_t start, vec3_t end, int color) p->alpha = 1.0; p->alphavel = -1.0f / (0.8f + frandk() * 0.2f); - p->color = VID_PaletteColor(color); + p->color = color; for (j = 0; j < 3; j++) { @@ -2805,7 +2867,7 @@ CL_TagTrail(vec3_t start, vec3_t end, int color) } void -CL_ColorExplosionParticles(vec3_t org, int color, int run) +CL_ColorExplosionParticles(vec3_t org, unsigned int basecolor, unsigned int finalcolor) { int i; int j; @@ -2827,7 +2889,8 @@ CL_ColorExplosionParticles(vec3_t org, int color, int run) active_particles = p; p->time = time; - p->color = VID_PaletteColor(color + (randk() % run)); + p->color = CL_CombineColors(basecolor, finalcolor, + (float)(randk() & 15) / 15.0); for (j = 0; j < 3; j++) { @@ -2847,7 +2910,7 @@ CL_ColorExplosionParticles(vec3_t org, int color, int run) * Like the steam effect, but unaffected by gravity */ void -CL_ParticleSmokeEffect(vec3_t org, vec3_t dir, int color, +CL_ParticleSmokeEffect(vec3_t org, vec3_t dir, unsigned int basecolor, unsigned int finalcolor, int count, int magnitude) { int i, j; @@ -2873,7 +2936,8 @@ CL_ParticleSmokeEffect(vec3_t org, vec3_t dir, int color, active_particles = p; p->time = time; - p->color = VID_PaletteColor(color + (randk() & 7)); + p->color = CL_CombineColors(basecolor, finalcolor, + (float)(randk() & 15) / 15.0); for (j = 0; j < 3; j++) { @@ -2897,7 +2961,7 @@ CL_ParticleSmokeEffect(vec3_t org, vec3_t dir, int color, * Wall impact puffs (Green) */ void -CL_BlasterParticles2(vec3_t org, vec3_t dir, unsigned int color) +CL_BlasterParticles2(vec3_t org, vec3_t dir, unsigned int basecolor, unsigned int finalcolor) { int i, j; cparticle_t *p; @@ -2922,8 +2986,9 @@ CL_BlasterParticles2(vec3_t org, vec3_t dir, unsigned int color) active_particles = p; p->time = time; - p->color = VID_PaletteColor(color + (randk() & 7)); d = (float)(randk() & 15); + p->color = CL_CombineColors(basecolor, finalcolor, + (float)(randk() & 15) / 15.0); for (j = 0; j < 3; j++) { diff --git a/src/client/cl_entities.c b/src/client/cl_entities.c index fd34b15b1..6d7ad4f86 100644 --- a/src/client/cl_entities.c +++ b/src/client/cl_entities.c @@ -538,17 +538,17 @@ CL_AddPacketEntities(frame_t *frame) } else if (effects & EF_FLAG1) { - CL_FlagTrail(cent->lerp_origin, ent.origin, 242); + CL_FlagTrail(cent->lerp_origin, ent.origin, 0xff0000ff); V_AddLight(ent.origin, 225, 1, 0.1f, 0.1f); } else if (effects & EF_FLAG2) { - CL_FlagTrail(cent->lerp_origin, ent.origin, 115); + CL_FlagTrail(cent->lerp_origin, ent.origin, 0xff7f672f); V_AddLight(ent.origin, 225, 0.1f, 0.1f, 1); } else if (effects & EF_TAGTRAIL) { - CL_TagTrail(cent->lerp_origin, ent.origin, 220); + CL_TagTrail(cent->lerp_origin, ent.origin, 0xff27ffff); V_AddLight(ent.origin, 225, 1.0, 1.0, 0.0); } else if (effects & EF_TRACKERTRAIL) @@ -568,7 +568,7 @@ CL_AddPacketEntities(frame_t *frame) } else if (effects & EF_TRACKER) { - CL_TrackerTrail(cent->lerp_origin, ent.origin, 0); + CL_TrackerTrail(cent->lerp_origin, ent.origin, 0xff000000); V_AddLight(ent.origin, 200, -1, -1, -1); } else if (effects & EF_IONRIPPER) diff --git a/src/client/cl_particles.c b/src/client/cl_particles.c index 5adf8022c..173112055 100644 --- a/src/client/cl_particles.c +++ b/src/client/cl_particles.c @@ -50,7 +50,7 @@ CL_ClearParticles(void) } void -CL_ParticleEffect(vec3_t org, vec3_t dir, int color, int count) +CL_ParticleEffect(vec3_t org, vec3_t dir, unsigned int basecolor, unsigned int finalcolor, int count) { int i, j; cparticle_t *p; @@ -69,7 +69,8 @@ CL_ParticleEffect(vec3_t org, vec3_t dir, int color, int count) active_particles = p; p->time = cl.time; - p->color = VID_PaletteColor(color + (randk() & 7)); + p->color = CL_CombineColors(basecolor, finalcolor, + (float)(randk() & 15) / 15.0); d = randk() & 31; for (j = 0; j < 3; j++) @@ -87,7 +88,7 @@ CL_ParticleEffect(vec3_t org, vec3_t dir, int color, int count) } void -CL_ParticleEffect2(vec3_t org, vec3_t dir, int color, int count) +CL_ParticleEffect2(vec3_t org, vec3_t dir, unsigned int basecolor, unsigned int finalcolor, int count) { int i, j; cparticle_t *p; @@ -109,7 +110,8 @@ CL_ParticleEffect2(vec3_t org, vec3_t dir, int color, int count) active_particles = p; p->time = time; - p->color = VID_PaletteColor(color + (randk() & 7)); + p->color = CL_CombineColors(basecolor, finalcolor, + (float)(randk() & 15) / 15.0); d = randk() & 7; @@ -128,7 +130,7 @@ CL_ParticleEffect2(vec3_t org, vec3_t dir, int color, int count) } void -CL_ParticleEffect3(vec3_t org, vec3_t dir, int color, int count) +CL_ParticleEffect3(vec3_t org, vec3_t dir, unsigned int color, int count) { int i, j; cparticle_t *p; @@ -150,7 +152,7 @@ CL_ParticleEffect3(vec3_t org, vec3_t dir, int color, int count) active_particles = p; p->time = time; - p->color = VID_PaletteColor(color); + p->color = color; d = randk() & 7; @@ -243,7 +245,7 @@ CL_AddParticles(void) } void -CL_GenericParticleEffect(vec3_t org, vec3_t dir, int color, +CL_GenericParticleEffect(vec3_t org, vec3_t dir, unsigned int basecolor, unsigned int finalcolor, int count, int numcolors, int dirspread, float alphavel) { int i, j; @@ -267,15 +269,8 @@ CL_GenericParticleEffect(vec3_t org, vec3_t dir, int color, p->time = time; - if (numcolors > 1) - { - p->color = VID_PaletteColor(color + (randk() & numcolors)); - } - - else - { - p->color = VID_PaletteColor(color); - } + p->color = CL_CombineColors(basecolor, finalcolor, + (float)(randk() & 15) / 15.0); d = (float)(randk() & dirspread); diff --git a/src/client/cl_tempentities.c b/src/client/cl_tempentities.c index e5ef4bbdf..fc10c1407 100644 --- a/src/client/cl_tempentities.c +++ b/src/client/cl_tempentities.c @@ -259,7 +259,8 @@ CL_ParseParticles(void) count = MSG_ReadByte(&net_message); - CL_ParticleEffect(pos, dir, color, count); + CL_ParticleEffect(pos, dir, + VID_PaletteColor(color), VID_PaletteColor(color + 7), count); } void @@ -548,7 +549,8 @@ CL_ParseSteam(void) MSG_ReadPos(&net_message, s->org); MSG_ReadDir(&net_message, s->dir); r = MSG_ReadByte(&net_message); - s->color = r & 0xff; + s->basecolor = VID_PaletteColor(r & 0xff); + s->finalcolor = VID_PaletteColor((r + 7) & 0xff); s->magnitude = MSG_ReadShort(&net_message); s->endtime = cl.time + MSG_ReadLong(&net_message); s->think = CL_ParticleSteamEffect2; @@ -574,7 +576,8 @@ CL_ParseSteam(void) r = MSG_ReadByte(&net_message); magnitude = MSG_ReadShort(&net_message); color = r & 0xff; - CL_ParticleSteamEffect(pos, dir, color, cnt, magnitude); + CL_ParticleSteamEffect(pos, dir, + VID_PaletteColor(color), VID_PaletteColor(color + 7), cnt, magnitude); } } @@ -648,7 +651,15 @@ CL_ParseNuke(void) } } -static byte splash_color[] = {0x00, 0xe0, 0xb0, 0x50, 0xd0, 0xe0, 0xe8}; +static unsigned int splash_color[] = { + 0xff000000, 0xff6b6b6b, + 0xff07abff, 0xff002bab, + 0xffcf7b77, 0xff734747, + 0xff4b5f7b, 0xff2b374b, + 0xff00ff00, 0xffffffff, + 0xff07abff, 0xff002bab, + 0xff001f9b, 0xff00001b, +}; void CL_ParseTEnt(void) @@ -669,7 +680,7 @@ CL_ParseTEnt(void) case TE_BLOOD: /* bullet hitting flesh */ MSG_ReadPos(&net_message, pos); MSG_ReadDir(&net_message, dir); - CL_ParticleEffect(pos, dir, 0xe8, 60); + CL_ParticleEffect(pos, dir, 0xff001f9b, 0xff00001b, 60); break; case TE_GUNSHOT: /* bullet hitting wall */ @@ -680,11 +691,11 @@ CL_ParseTEnt(void) if (type == TE_GUNSHOT) { - CL_ParticleEffect(pos, dir, 0, 40); + CL_ParticleEffect(pos, dir, 0xff000000, 0xff6b6b6b, 40); } else { - CL_ParticleEffect(pos, dir, 0xe0, 6); + CL_ParticleEffect(pos, dir, 0xff07abff, 0xff002bab, 6); } if (type != TE_SPARKS) @@ -716,12 +727,12 @@ CL_ParseTEnt(void) if (type == TE_SCREEN_SPARKS) { - CL_ParticleEffect(pos, dir, 0xd0, 40); + CL_ParticleEffect(pos, dir, 0xff00ff00, 0xffffffff, 40); } else { - CL_ParticleEffect(pos, dir, 0xb0, 40); + CL_ParticleEffect(pos, dir, 0xffcf7b77, 0xff734747, 40); } if (cl_limitsparksounds->value) @@ -761,7 +772,7 @@ CL_ParseTEnt(void) case TE_SHOTGUN: /* bullet hitting wall */ MSG_ReadPos(&net_message, pos); MSG_ReadDir(&net_message, dir); - CL_ParticleEffect(pos, dir, 0, 20); + CL_ParticleEffect(pos, dir, 0xff000000, 0xff6b6b6b, 20); CL_SmokeAndFlash(pos); break; @@ -773,14 +784,11 @@ CL_ParseTEnt(void) if (r > 6) { - color = 0x00; - } - else - { - color = splash_color[r]; + r = 0; } - CL_ParticleEffect(pos, dir, color, cnt); + CL_ParticleEffect(pos, dir, + splash_color[r * 2], splash_color[r * 2 + 1], cnt); if (r == SPLASH_SPARKS) { @@ -807,7 +815,8 @@ CL_ParseTEnt(void) MSG_ReadPos(&net_message, pos); MSG_ReadDir(&net_message, dir); color = MSG_ReadByte(&net_message); - CL_ParticleEffect2(pos, dir, color, cnt); + CL_ParticleEffect2(pos, dir, + VID_PaletteColor(color), VID_PaletteColor(color + 7), cnt); break; case TE_BLUEHYPERBLASTER: @@ -1017,7 +1026,8 @@ CL_ParseTEnt(void) MSG_ReadPos(&net_message, pos); MSG_ReadDir(&net_message, dir); color = MSG_ReadByte(&net_message); - CL_ParticleEffect2(pos, dir, color, cnt); + CL_ParticleEffect2(pos, dir, + VID_PaletteColor(color), VID_PaletteColor(color + 7), cnt); ex = CL_AllocExplosion(); VectorCopy(pos, ex->ent.origin); @@ -1035,7 +1045,7 @@ CL_ParseTEnt(void) case TE_GREENBLOOD: MSG_ReadPos(&net_message, pos); MSG_ReadDir(&net_message, dir); - CL_ParticleEffect2(pos, dir, 0xdf, 30); + CL_ParticleEffect2(pos, dir, 0xff0fbfff, 0xff003bb7, 30); break; case TE_TUNNEL_SPARKS: @@ -1043,7 +1053,7 @@ CL_ParseTEnt(void) MSG_ReadPos(&net_message, pos); MSG_ReadDir(&net_message, dir); color = MSG_ReadByte(&net_message); - CL_ParticleEffect3(pos, dir, color, cnt); + CL_ParticleEffect3(pos, dir, VID_PaletteColor(color), cnt); break; case TE_BLASTER2: @@ -1053,11 +1063,11 @@ CL_ParseTEnt(void) if (type == TE_BLASTER2) { - CL_BlasterParticles2(pos, dir, 0xd0); + CL_BlasterParticles2(pos, dir, 0xff00ff00, 0xffffffff); } else { - CL_BlasterParticles2(pos, dir, 0x6f); + CL_BlasterParticles2(pos, dir, 0xffb7a787, 0xff5b430f); } ex = CL_AllocExplosion(); @@ -1162,7 +1172,7 @@ CL_ParseTEnt(void) MSG_ReadPos(&net_message, pos); MSG_ReadPos(&net_message, pos2); color = MSG_ReadByte(&net_message); - CL_ForceWall(pos, pos2, color); + CL_ForceWall(pos, pos2, VID_PaletteColor(color)); break; case TE_HEATBEAM: @@ -1179,8 +1189,7 @@ CL_ParseTEnt(void) MSG_ReadDir(&net_message, dir); r = 8; magnitude = 60; - color = r & 0xff; - CL_ParticleSteamEffect(pos, dir, color, cnt, magnitude); + CL_ParticleSteamEffect(pos, dir, 0xff7b7b7b, 0xffebebeb, cnt, magnitude); S_StartSound(pos, 0, 0, cl_sfx_lashit, 1, ATTN_NORM, 0); break; @@ -1188,9 +1197,8 @@ CL_ParseTEnt(void) cnt = 20; MSG_ReadPos(&net_message, pos); MSG_ReadDir(&net_message, dir); - color = 0xe0; magnitude = 60; - CL_ParticleSteamEffect(pos, dir, color, cnt, magnitude); + CL_ParticleSteamEffect(pos, dir, 0xff07abff, 0xff002bab, cnt, magnitude); S_StartSound(pos, 0, 0, cl_sfx_lashit, 1, ATTN_NORM, 0); break; @@ -1208,7 +1216,7 @@ CL_ParseTEnt(void) case TE_MOREBLOOD: MSG_ReadPos(&net_message, pos); MSG_ReadDir(&net_message, dir); - CL_ParticleEffect(pos, dir, 0xe8, 250); + CL_ParticleEffect(pos, dir, 0xff001f9b, 0xff00001b, 250); break; case TE_CHAINFIST_SMOKE: @@ -1216,20 +1224,20 @@ CL_ParseTEnt(void) dir[1] = 0; dir[2] = 1; MSG_ReadPos(&net_message, pos); - CL_ParticleSmokeEffect(pos, dir, 0, 20, 20); + CL_ParticleSmokeEffect(pos, dir, 0xff000000, 0xff6b6b6b, 20, 20); break; case TE_ELECTRIC_SPARKS: MSG_ReadPos(&net_message, pos); MSG_ReadDir(&net_message, dir); - CL_ParticleEffect(pos, dir, 0x75, 40); + CL_ParticleEffect(pos, dir, 0xff5b430f, 0xff1f1700, 40); S_StartSound(pos, 0, 0, cl_sfx_lashit, 1, ATTN_NORM, 0); break; case TE_TRACKER_EXPLOSION: MSG_ReadPos(&net_message, pos); CL_ColorFlash(pos, 0, 150, -1, -1, -1); - CL_ColorExplosionParticles(pos, 0, 1); + CL_ColorExplosionParticles(pos, 0xff000000, 0xff0f0f0f); S_StartSound(pos, 0, 0, cl_sfx_disrexp, 1, ATTN_NORM, 0); break; diff --git a/src/client/header/client.h b/src/client/header/client.h index 643997697..f50598f01 100644 --- a/src/client/header/client.h +++ b/src/client/header/client.h @@ -373,7 +373,8 @@ typedef struct cl_sustain int thinkinterval; vec3_t org; vec3_t dir; - int color; + unsigned int basecolor; + unsigned int finalcolor; int count; int magnitude; void (*think)(struct cl_sustain *self); @@ -382,10 +383,12 @@ typedef struct cl_sustain void CL_ParticleSteamEffect2(cl_sustain_t *self); void CL_TeleporterParticles (entity_state_t *ent); -void CL_ParticleEffect (vec3_t org, vec3_t dir, int color, int count); -void CL_ParticleEffect2 (vec3_t org, vec3_t dir, int color, int count); +void CL_ParticleEffect (vec3_t org, vec3_t dir, unsigned int basecolor, unsigned int finalcolor, + int count); +void CL_ParticleEffect2 (vec3_t org, vec3_t dir, unsigned int basecolor, unsigned int finalcolor, + int count); -void CL_ParticleEffect3 (vec3_t org, vec3_t dir, int color, int count); +void CL_ParticleEffect3 (vec3_t org, vec3_t dir, unsigned int color, int count); typedef struct particle_s @@ -413,25 +416,30 @@ void CL_FlagTrail (vec3_t start, vec3_t end, int color); void CL_IonripperTrail (vec3_t start, vec3_t end); -void CL_BlasterParticles2 (vec3_t org, vec3_t dir, unsigned int color); +void CL_BlasterParticles2 (vec3_t org, vec3_t dir, unsigned int basecolor, unsigned int finalcolor); void CL_BlasterTrail2 (vec3_t start, vec3_t end); void CL_DebugTrail (vec3_t start, vec3_t end); -void CL_SmokeTrail (vec3_t start, vec3_t end, int colorStart, int colorRun, int spacing); +void CL_SmokeTrail (vec3_t start, vec3_t end, unsigned int basecolor, unsigned int finalcolor, + int spacing); void CL_Flashlight (int ent, vec3_t pos); void CL_ForceWall (vec3_t start, vec3_t end, int color); void CL_FlameEffects (centity_t *ent, vec3_t origin); -void CL_GenericParticleEffect (vec3_t org, vec3_t dir, int color, int count, int numcolors, int dirspread, float alphavel); +void CL_GenericParticleEffect (vec3_t org, vec3_t dir, unsigned int basecolor, unsigned int finalcolor, + int count, int numcolors, int dirspread, float alphavel); void CL_BubbleTrail2 (vec3_t start, vec3_t end, int dist); void CL_Heatbeam (vec3_t start, vec3_t end); -void CL_ParticleSteamEffect (vec3_t org, vec3_t dir, int color, int count, int magnitude); -void CL_TrackerTrail (vec3_t start, vec3_t end, int particleColor); +void CL_ParticleSteamEffect (vec3_t org, vec3_t dir, unsigned int basecolor, unsigned int finalcolor, + int count, int magnitude); +void CL_TrackerTrail (vec3_t start, vec3_t end, unsigned int particleColor); void CL_Tracker_Explode(vec3_t origin); void CL_TagTrail (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); -void CL_ColorExplosionParticles (vec3_t org, int color, int run); -void CL_ParticleSmokeEffect (vec3_t org, vec3_t dir, int color, int count, int magnitude); +void CL_ColorExplosionParticles (vec3_t org, unsigned int basecolor, unsigned int finalcolor); +void CL_ParticleSmokeEffect (vec3_t org, vec3_t dir, unsigned int basecolor, unsigned int finalcolor, + int count, int magnitude); +unsigned int CL_CombineColors(unsigned int basecolor, unsigned int finalcolor, float scale); void CL_Widowbeamout (cl_sustain_t *self); void CL_Nukeblast (cl_sustain_t *self); void CL_WidowSplash (vec3_t org); diff --git a/src/client/input/sdl2.c b/src/client/input/sdl2.c index dc9666b30..decb80017 100644 --- a/src/client/input/sdl2.c +++ b/src/client/input/sdl2.c @@ -236,10 +236,17 @@ IN_TranslateSDLtoQ2Key(unsigned int keysym) case SDLK_BACKSPACE: key = K_BACKSPACE; break; +#ifdef __APPLE__ + case SDLK_RGUI: case SDLK_LGUI: + key = K_COMMAND; + break; +#else case SDLK_RGUI: - key = K_COMMAND; // Win key + case SDLK_LGUI: + key = K_SUPER; break; +#endif case SDLK_CAPSLOCK: key = K_CAPSLOCK; break; @@ -395,8 +402,6 @@ IN_TranslateSDLtoQ2Key(unsigned int keysym) key = K_KP_EQUALS; break; - // TODO: K_SUPER ? Win Key is already K_COMMAND - case SDLK_APPLICATION: key = K_COMPOSE; break; diff --git a/src/client/input/sdl3.c b/src/client/input/sdl3.c index e719b975b..a4dc39ae8 100644 --- a/src/client/input/sdl3.c +++ b/src/client/input/sdl3.c @@ -226,10 +226,17 @@ IN_TranslateSDLtoQ2Key(unsigned int keysym) case SDLK_BACKSPACE: key = K_BACKSPACE; break; +#ifdef __APPLE__ + case SDLK_RGUI: case SDLK_LGUI: + key = K_COMMAND; + break; +#else case SDLK_RGUI: - key = K_COMMAND; // Win key + case SDLK_LGUI: + key = K_SUPER; break; +#endif case SDLK_CAPSLOCK: key = K_CAPSLOCK; break; @@ -385,8 +392,6 @@ IN_TranslateSDLtoQ2Key(unsigned int keysym) key = K_KP_EQUALS; break; - // TODO: K_SUPER ? Win Key is already K_COMMAND - case SDLK_APPLICATION: key = K_COMPOSE; break; diff --git a/src/client/menu/menu.c b/src/client/menu/menu.c index e30d4514a..4e456937b 100644 --- a/src/client/menu/menu.c +++ b/src/client/menu/menu.c @@ -2376,6 +2376,7 @@ Options_MenuInit(void) "play once", "sequential", "random", + "truly random", 0 }; diff --git a/src/client/sound/ogg.c b/src/client/sound/ogg.c index 9d65cc529..782c27317 100644 --- a/src/client/sound/ogg.c +++ b/src/client/sound/ogg.c @@ -530,6 +530,7 @@ OGG_PlayTrack(const char *track, qboolean cdtrack, qboolean immediate) newtrack = (curtrack + 1) % (ogg_maxfileindex + 1) != 0 ? (curtrack + 1) : 2; } break; case 3: // random + case 4: // random with true randomness { int retries = 100; newtrack = 0; @@ -537,6 +538,14 @@ OGG_PlayTrack(const char *track, qboolean cdtrack, qboolean immediate) while (retries-- > 0 && newtrack < 2) { newtrack = randk() % (ogg_maxfileindex + 1); + + if (playback == 3) + { + if (newtrack == curtrack) + { + newtrack = 0; + } + } } } break; } @@ -774,10 +783,9 @@ OGG_Cmd(void) void OGG_SaveState(void) { - if (ogg_status != PLAY) + if (ogg_enabled->value != 1 || ogg_status != PLAY) { ogg_saved_state.saved = false; - return; } @@ -792,7 +800,7 @@ OGG_SaveState(void) void OGG_RecoverState(void) { - if (!ogg_saved_state.saved) + if (ogg_enabled->value != 1 || ogg_saved_state.saved != true) { return; }