mirror of
https://github.com/blendogames/thirtyflightsofloving.git
synced 2025-01-18 06:22:30 +00:00
Added implementation of TE_RAILTRAIL_COLORED.
Refactored railgun trail effect and decal code to handle color as red, green, blue parameters. Moved CL_TextColor() from cl_string.c to cl_utils.c. AddedCL_EffectColor() to cl_utils.c.
This commit is contained in:
parent
c137bb8926
commit
6f4f02f5bf
5 changed files with 209 additions and 108 deletions
|
@ -986,7 +986,7 @@ CL_ParticleRailDecal
|
|||
===============
|
||||
*/
|
||||
#define RAIL_DECAL_OFFSET 2.0f
|
||||
void CL_ParticleRailDecal (vec3_t org, vec3_t dir, float size, qboolean isRed)
|
||||
void CL_ParticleRailDecal (vec3_t org, vec3_t dir, float size, int red, int green, int blue)
|
||||
{
|
||||
vec3_t ang, angle, end, origin;
|
||||
trace_t tr;
|
||||
|
@ -1026,7 +1026,7 @@ void CL_ParticleRailDecal (vec3_t org, vec3_t dir, float size, qboolean isRed)
|
|||
origin[0], origin[1], origin[2],
|
||||
0, 0, 0,
|
||||
0, 0, 0,
|
||||
(isRed)?255:cl_railred->value, (isRed)?20:cl_railgreen->value, (isRed)?20:cl_railblue->value,
|
||||
red, green, blue,
|
||||
0, 0, 0,
|
||||
1, -0.25,
|
||||
GL_SRC_ALPHA, GL_ONE,
|
||||
|
@ -1950,7 +1950,7 @@ CL_RailSprial
|
|||
//this is the length of each piece...
|
||||
#define RAILTRAILSPACE 15
|
||||
|
||||
void CL_RailSprial (vec3_t start, vec3_t end, qboolean isRed)
|
||||
void CL_RailSprial (vec3_t start, vec3_t end, int red, int green, int blue)
|
||||
{
|
||||
vec3_t move;
|
||||
vec3_t vec;
|
||||
|
@ -1989,7 +1989,7 @@ void CL_RailSprial (vec3_t start, vec3_t end, qboolean isRed)
|
|||
move[0] + dir[0]*3, move[1] + dir[1]*3, move[2] + dir[2]*3,
|
||||
dir[0]*6, dir[1]*6, dir[2]*6,
|
||||
0, 0, 0,
|
||||
(isRed)?255:cl_railred->value, (isRed)?20:cl_railgreen->value, (isRed)?20:cl_railblue->value,
|
||||
red, green, blue,
|
||||
0, 0, 0,
|
||||
1, -1.0,
|
||||
GL_SRC_ALPHA, GL_ONE,
|
||||
|
@ -2037,7 +2037,7 @@ void CL_ParticleDevRailThink (cparticle_t *p, vec3_t org, vec3_t angle, float *a
|
|||
CL_DevRailTrail
|
||||
===============
|
||||
*/
|
||||
void CL_DevRailTrail (vec3_t start, vec3_t end, qboolean isRed)
|
||||
void CL_DevRailTrail (vec3_t start, vec3_t end, int red, int green, int blue)
|
||||
{
|
||||
vec3_t move;
|
||||
vec3_t vec, point;
|
||||
|
@ -2074,7 +2074,7 @@ void CL_DevRailTrail (vec3_t start, vec3_t end, qboolean isRed)
|
|||
move[0], move[1], move[2],
|
||||
0, 0, 0,
|
||||
0, 0, 0,
|
||||
(isRed)?255:cl_railred->value, (isRed)?20:cl_railgreen->value, (isRed)?20:cl_railblue->value,
|
||||
red, green, blue,
|
||||
0, -90, -30,
|
||||
0.75, -.75,
|
||||
GL_SRC_ALPHA, GL_ONE,
|
||||
|
@ -2089,7 +2089,7 @@ void CL_DevRailTrail (vec3_t start, vec3_t end, qboolean isRed)
|
|||
move[0], move[1], move[2],
|
||||
crand()*10, crand()*10, crand()*10+20,
|
||||
0, 0, 0,
|
||||
(isRed)?255:cl_railred->value, (isRed)?20:cl_railgreen->value, (isRed)?20:cl_railblue->value,
|
||||
red, green, blue,
|
||||
0, 0, 0,
|
||||
1, -0.75 / (0.5 + frand()*0.3),
|
||||
GL_SRC_ALPHA, GL_ONE,
|
||||
|
@ -2121,23 +2121,23 @@ void CL_DevRailTrail (vec3_t start, vec3_t end, qboolean isRed)
|
|||
CL_RailTrail
|
||||
===============
|
||||
*/
|
||||
void CL_RailTrail (vec3_t start, vec3_t end, qboolean isRed)
|
||||
void CL_RailTrail (vec3_t start, vec3_t end, int red, int green, int blue)
|
||||
{
|
||||
vec3_t move, last;
|
||||
vec3_t vec, point;
|
||||
//vec3_t right, up;
|
||||
// vec3_t right, up;
|
||||
int i;
|
||||
int beamred, beamgreen, beamblue;
|
||||
float len;//, dec;
|
||||
qboolean colored = (cl_railtype->integer != 0);
|
||||
float len; // dec
|
||||
qboolean colored = ( (cl_railtype->integer == 1) || (cl_railtype->integer == 2) );
|
||||
|
||||
VectorSubtract (end, start, vec);
|
||||
VectorNormalize(vec);
|
||||
CL_ParticleRailDecal (end, vec, 7, isRed);
|
||||
CL_ParticleRailDecal (end, vec, 7, red, green, blue);
|
||||
|
||||
if (cl_railtype->integer == 2)
|
||||
{
|
||||
CL_DevRailTrail (start, end, isRed);
|
||||
CL_DevRailTrail (start, end, red, green, blue);
|
||||
return;
|
||||
}
|
||||
// Draw from closest point
|
||||
|
@ -2154,18 +2154,12 @@ void CL_RailTrail (vec3_t start, vec3_t end, qboolean isRed)
|
|||
len = min (len, cl_rail_length->value); // cap length
|
||||
VectorCopy (vec, point);
|
||||
VectorScale (vec, RAILTRAILSPACE, vec);
|
||||
//MakeNormalVectors (vec, right, up);
|
||||
// MakeNormalVectors (vec, right, up);
|
||||
|
||||
if (colored) {
|
||||
if (isRed) {
|
||||
beamred = 255;
|
||||
beamgreen = beamblue = 20;
|
||||
}
|
||||
else {
|
||||
beamred = cl_railred->value;
|
||||
beamgreen = cl_railgreen->value;
|
||||
beamblue = cl_railblue->value;
|
||||
}
|
||||
beamred = red;
|
||||
beamgreen = green;
|
||||
beamblue = blue;
|
||||
}
|
||||
else
|
||||
beamred = beamgreen = beamblue = 255;
|
||||
|
@ -2192,8 +2186,9 @@ void CL_RailTrail (vec3_t start, vec3_t end, qboolean isRed)
|
|||
PART_BEAM,
|
||||
NULL,0);
|
||||
}
|
||||
if (cl_railtype->integer == 0)
|
||||
CL_RailSprial (start, end, isRed);
|
||||
if ( !colored ) {
|
||||
CL_RailSprial (start, end, red, green, blue);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -26,78 +26,6 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
|||
#include "client.h"
|
||||
|
||||
|
||||
/*
|
||||
================
|
||||
CL_TextColor
|
||||
This sets the actual text color, can be called from anywhere
|
||||
================
|
||||
*/
|
||||
void CL_TextColor (int colornum, int *red, int *green, int *blue)
|
||||
{
|
||||
if (!red || !green || !blue) // paranoia
|
||||
return;
|
||||
|
||||
switch (colornum)
|
||||
{
|
||||
case 1: // red
|
||||
*red = 255;
|
||||
*green= 0;
|
||||
*blue = 0;
|
||||
break;
|
||||
case 2: // green
|
||||
*red = 0;
|
||||
*green= 255;
|
||||
*blue = 0;
|
||||
break;
|
||||
case 3: // yellow
|
||||
*red = 255;
|
||||
*green= 255;
|
||||
*blue = 0;
|
||||
break;
|
||||
case 4: // blue
|
||||
*red = 0;
|
||||
*green= 0;
|
||||
*blue = 255;
|
||||
break;
|
||||
case 5: // cyan
|
||||
*red = 0;
|
||||
*green= 255;
|
||||
*blue = 255;
|
||||
break;
|
||||
case 6: //magenta
|
||||
*red = 255;
|
||||
*green= 0;
|
||||
*blue = 255;
|
||||
break;
|
||||
case 7: // white
|
||||
*red = 255;
|
||||
*green= 255;
|
||||
*blue = 255;
|
||||
break;
|
||||
case 8: // black
|
||||
*red = 0;
|
||||
*green= 0;
|
||||
*blue = 0;
|
||||
break;
|
||||
case 9: // orange
|
||||
*red = 255;
|
||||
*green= 135;
|
||||
*blue = 0;
|
||||
break;
|
||||
case 0: // gray
|
||||
*red = 155;
|
||||
*green= 155;
|
||||
*blue = 155;
|
||||
break;
|
||||
default: // white
|
||||
*red = 255;
|
||||
*green= 255;
|
||||
*blue = 255;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
================
|
||||
CL_StringSetParams
|
||||
|
|
|
@ -889,16 +889,24 @@ void CL_ParseTEnt (void)
|
|||
break;
|
||||
|
||||
case TE_RAILTRAIL: // railgun effect
|
||||
case TE_RAILTRAIL2: // 12/23/2001 - red railgun trail
|
||||
case TE_RAILTRAIL_COLORED: // changeable color railgun trail
|
||||
MSG_ReadPos (&net_message, pos);
|
||||
MSG_ReadPos (&net_message, pos2);
|
||||
CL_RailTrail (pos, pos2, false);
|
||||
S_StartSound (pos2, 0, 0, clMedia.sfx_railg, 1, ATTN_NORM, 0);
|
||||
break;
|
||||
// 12/23/2001 - red railgun trail
|
||||
case TE_RAILTRAIL2: // red railgun effect
|
||||
MSG_ReadPos (&net_message, pos);
|
||||
MSG_ReadPos (&net_message, pos2);
|
||||
CL_RailTrail (pos, pos2, true);
|
||||
if (type == TE_RAILTRAIL_COLORED)
|
||||
{
|
||||
int red, green, blue;
|
||||
color = MSG_ReadByte (&net_message);
|
||||
CL_EffectColor (color, &red, &green, &blue);
|
||||
CL_RailTrail (pos, pos2, red, green, blue);
|
||||
// CL_RailTrail (pos, pos2, color8red(color), color8green(color), color8blue(color));
|
||||
}
|
||||
else if (type == TE_RAILTRAIL2) {
|
||||
CL_RailTrail (pos, pos2, 255, 20, 20);
|
||||
}
|
||||
else {
|
||||
CL_RailTrail (pos, pos2, cl_railred->integer, cl_railgreen->integer, cl_railblue->integer);
|
||||
}
|
||||
S_StartSound (pos2, 0, 0, clMedia.sfx_railg, 1, ATTN_NORM, 0);
|
||||
break;
|
||||
|
||||
|
|
|
@ -51,6 +51,176 @@ int color8blue (int color8)
|
|||
|
||||
//=================================================
|
||||
|
||||
/*
|
||||
================
|
||||
CL_TextColor
|
||||
This sets the actual text color, can be called from anywhere
|
||||
================
|
||||
*/
|
||||
void CL_TextColor (int colornum, int *red, int *green, int *blue)
|
||||
{
|
||||
if (!red || !green || !blue) // paranoia
|
||||
return;
|
||||
|
||||
switch (colornum)
|
||||
{
|
||||
case 1: // red
|
||||
*red = 255;
|
||||
*green= 0;
|
||||
*blue = 0;
|
||||
break;
|
||||
case 2: // green
|
||||
*red = 0;
|
||||
*green= 255;
|
||||
*blue = 0;
|
||||
break;
|
||||
case 3: // yellow
|
||||
*red = 255;
|
||||
*green= 255;
|
||||
*blue = 0;
|
||||
break;
|
||||
case 4: // blue
|
||||
*red = 0;
|
||||
*green= 0;
|
||||
*blue = 255;
|
||||
break;
|
||||
case 5: // cyan
|
||||
*red = 0;
|
||||
*green= 255;
|
||||
*blue = 255;
|
||||
break;
|
||||
case 6: //magenta
|
||||
*red = 255;
|
||||
*green= 0;
|
||||
*blue = 255;
|
||||
break;
|
||||
case 7: // white
|
||||
*red = 255;
|
||||
*green= 255;
|
||||
*blue = 255;
|
||||
break;
|
||||
case 8: // black
|
||||
*red = 0;
|
||||
*green= 0;
|
||||
*blue = 0;
|
||||
break;
|
||||
case 9: // orange
|
||||
*red = 255;
|
||||
*green= 135;
|
||||
*blue = 0;
|
||||
break;
|
||||
case 0: // gray
|
||||
*red = 155;
|
||||
*green= 155;
|
||||
*blue = 155;
|
||||
break;
|
||||
default: // white
|
||||
*red = 255;
|
||||
*green= 255;
|
||||
*blue = 255;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
================
|
||||
CL_EffectColor
|
||||
This sets railtrail color
|
||||
================
|
||||
*/
|
||||
void CL_EffectColor (int colornum, int *red, int *green, int *blue)
|
||||
{
|
||||
if (!red || !green || !blue) // paranoia
|
||||
return;
|
||||
|
||||
switch (colornum)
|
||||
{
|
||||
case 1: // blue
|
||||
*red = 20;
|
||||
*green= 50;
|
||||
*blue = 175;
|
||||
break;
|
||||
case 2: // green
|
||||
*red = 20;
|
||||
*green= 255;
|
||||
*blue = 20;
|
||||
break;
|
||||
case 3: // yellow
|
||||
*red = 255;
|
||||
*green= 255;
|
||||
*blue = 20;
|
||||
break;
|
||||
case 4: // orange
|
||||
*red = 255;
|
||||
*green= 135;
|
||||
*blue = 20;
|
||||
break;
|
||||
case 5: // red
|
||||
*red = 255;
|
||||
*green= 20;
|
||||
*blue = 20;
|
||||
break;
|
||||
case 6: // cyan
|
||||
*red = 20;
|
||||
*green= 255;
|
||||
*blue = 255;
|
||||
break;
|
||||
case 7: // indigo
|
||||
*red = 80;
|
||||
*green= 20;
|
||||
*blue = 255;
|
||||
break;
|
||||
case 8: // viridian
|
||||
*red = 80;
|
||||
*green= 255;
|
||||
*blue = 180;
|
||||
break;
|
||||
case 9: // violet
|
||||
*red = 160;
|
||||
*green= 20;
|
||||
*blue = 255;
|
||||
break;
|
||||
case 10: // magenta
|
||||
*red = 255;
|
||||
*green= 20;
|
||||
*blue = 255;
|
||||
break;
|
||||
case 11: // pink
|
||||
*red = 255;
|
||||
*green= 125;
|
||||
*blue = 175;
|
||||
break;
|
||||
case 12: // white
|
||||
*red = 255;
|
||||
*green= 255;
|
||||
*blue = 255;
|
||||
break;
|
||||
case 13: // silver
|
||||
*red = 195;
|
||||
*green= 195;
|
||||
*blue = 195;
|
||||
break;
|
||||
case 14: // gray
|
||||
*red = 155;
|
||||
*green= 155;
|
||||
*blue = 155;
|
||||
break;
|
||||
case 15: // black
|
||||
*red = 0;
|
||||
*green= 0;
|
||||
*blue = 0;
|
||||
break;
|
||||
case 0:
|
||||
default: // blue
|
||||
*red = 20;
|
||||
*green= 50;
|
||||
*blue = 255;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
==========================
|
||||
ClampCvar
|
||||
|
|
|
@ -558,8 +558,6 @@ extern entity_state_t cl_parse_entities[MAX_PARSE_ENTITIES];
|
|||
extern netadr_t net_from;
|
||||
extern sizebuf_t net_message;
|
||||
|
||||
// for use with the alt_text_color cvar
|
||||
void CL_TextColor (int colornum, int *red, int *green, int *blue);
|
||||
qboolean CL_StringSetParams (char modifier, int *red, int *green, int *blue, int *bold, int *shadow, int *italic, int *reset);
|
||||
void Con_DrawString (int x, int y, char *s, int alpha);
|
||||
void CL_DrawStringGeneric (int x, int y, const char *string, int alpha, int fontSize, textscaletype_t scaleType, qboolean altBit);
|
||||
|
@ -1070,7 +1068,7 @@ void CL_BlasterParticles (vec3_t org, vec3_t dir, int count, float size,
|
|||
int red, int green, int blue, int reddelta, int greendelta, int bluedelta);
|
||||
|
||||
void CL_QuadTrail (vec3_t start, vec3_t end);
|
||||
void CL_RailTrail (vec3_t start, vec3_t end, qboolean isRed);
|
||||
void CL_RailTrail (vec3_t start, vec3_t end, int red, int green, int blue);
|
||||
void CL_BubbleTrail (vec3_t start, vec3_t end);
|
||||
void CL_FlagTrail (vec3_t start, vec3_t end, qboolean isred, qboolean isgreen);
|
||||
void CL_IonripperTrail (vec3_t start, vec3_t end); // RAFAEL
|
||||
|
@ -1104,6 +1102,8 @@ void CL_WidowSplash (vec3_t org);
|
|||
int color8red (int color8);
|
||||
int color8green (int color8);
|
||||
int color8blue (int color8);
|
||||
void CL_TextColor (int colornum, int *red, int *green, int *blue); // for use with the alt_text_color cvar
|
||||
void CL_EffectColor (int colornum, int *red, int *green, int *blue);
|
||||
float ClampCvar (float min, float max, float value);
|
||||
int stringLen (const char *string);
|
||||
int stringLengthExtra (const char *string);
|
||||
|
|
Loading…
Reference in a new issue