diff options
author | Andrey Nazarov <skuller@skuller.net> | 2008-04-23 15:02:41 +0000 |
---|---|---|
committer | Andrey Nazarov <skuller@skuller.net> | 2008-04-23 15:02:41 +0000 |
commit | 49e6170b49fbb933eddec6d0e3f946320c68832f (patch) | |
tree | 88d228d6f89103710074fdba041ce80584d5caa6 /source/cl_fx.c | |
parent | 8c795585fb0c6c9178d9981f6943da04b7279205 (diff) |
Added `dumpents' server command.
Added support for `cl_noskins' value of 2 (default all female
skins to `female/athena', all male skins to `male/grunt').
Renamed `scoreshot' command to `aashot', added `aadump' command.
Fixed several alignment issues on ARM architecture.
Server browser menu now indicates full and password protected
servers with color codes.
Implemented history search in console with Ctrl+R, Ctrl+S.
Removed `cl_railtrail_alpha' variable, all `cl_rail*_color' variables now
accept colors in #RRGGBBAA format.
Added `map_override' cvar (enables loading map entity lump from
external maps/*.ent file).
Made `quit' command accept extra arguments.
Made `draw' command accept arbitrary colors in #RRGGBBAA format.
Fixed debian packages.
Diffstat (limited to 'source/cl_fx.c')
-rw-r--r-- | source/cl_fx.c | 168 |
1 files changed, 101 insertions, 67 deletions
diff --git a/source/cl_fx.c b/source/cl_fx.c index f959ff9..5336ba2 100644 --- a/source/cl_fx.c +++ b/source/cl_fx.c @@ -1682,27 +1682,35 @@ void CL_OldRailTrail (vec3_t start, vec3_t end) } } +static color_t railcore_color; +static color_t railspiral_color; -void CL_RailTrail( vec3_t start, vec3_t end ) { - vec3_t move; - vec3_t vec; - float len; - int j; - cparticle_t *p; -// float dec; - vec3_t right, up; - int i; - float d, c, s; - vec3_t dir; - laser_t *l; - color_t color; +static cvar_t *cl_railtrail_type; +static cvar_t *cl_railtrail_time; +static cvar_t *cl_railcore_color; +static cvar_t *cl_railcore_width; +static cvar_t *cl_railspiral_color; +static cvar_t *cl_railspiral_radius; - if( !cl_railtrail_type->integer || scr_glconfig.renderer == GL_RENDERER_SOFTWARE ) { - CL_OldRailTrail( start, end ); - return; - } - if( !( l = CL_AllocLaser() ) ) { +static void cl_railcore_color_changed( cvar_t *self ) { + if( !COM_ParseColor( self->string, railcore_color ) ) { + Com_WPrintf( "Invalid value '%s' for '%s'\n", self->string, self->name ); + *( uint32_t *)railcore_color = *( uint32_t * )colorRed; + } +} + +static void cl_railspiral_color_changed( cvar_t *self ) { + if( !COM_ParseColor( self->string, railspiral_color ) ) { + Com_WPrintf( "Invalid value '%s' for '%s'\n", self->string, self->name ); + *( uint32_t *)railspiral_color = *( uint32_t * )colorBlue; + } +} + +static void CL_NewRailCore( vec3_t start, vec3_t end ) { + laser_t *l = CL_AllocLaser(); + + if( !l ) { return; } @@ -1712,58 +1720,68 @@ void CL_RailTrail( vec3_t start, vec3_t end ) { l->lifeTime = 1000 * cl_railtrail_time->value; l->indexed = qfalse; l->width = cl_railcore_width->value; + *( uint32_t * )l->color = *( uint32_t * )railcore_color; +} - l->color[0] = ( cl_railcore_color->integer >> 16 ) & 0xff; - l->color[1] = ( cl_railcore_color->integer >> 8 ) & 0xff; - l->color[2] = ( cl_railcore_color->integer ) & 0xff; - l->color[3] = 255 * cl_railtrail_alpha->value; - - color[0] = ( cl_railspiral_color->integer >> 16 ) & 0xff; - color[1] = ( cl_railspiral_color->integer >> 8 ) & 0xff; - color[2] = ( cl_railspiral_color->integer ) & 0xff; - color[3] = 255; - - VectorCopy( start, move ); - VectorSubtract( end, start, vec ); - len = VectorNormalize( vec ); - - MakeNormalVectors( vec, right, up ); - - if( cl_railtrail_type->integer > 1 ) { - for( i=0 ; i<len ; i++ ) { - if( !free_particles ) - return; - - p = free_particles; - free_particles = p->next; - p->next = active_particles; - active_particles = p; - - p->time = cl.time; - VectorClear( p->accel ); - - d = i * 0.1; - c = cos( d ); - s = sin( d ); - - VectorScale( right, c, dir ); - VectorMA( dir, s, up, dir ); - - p->alpha = cl_railtrail_alpha->value; - p->alphavel = -1.0 / ( cl_railtrail_time->value + frand() * 0.2 ); - p->color = 0xff; - *( uint32_t * )p->rgb = *( uint32_t * )color; - for( j=0 ; j<3 ; j++ ) { - p->org[j] = move[j] + dir[j] * cl_railspiral_radius->value; - p->vel[j] = dir[j] * 6; - } +static void CL_NewRailSpiral( vec3_t start, vec3_t end ) { + vec3_t move; + vec3_t vec; + float len; + int j; + cparticle_t *p; +// float dec; + vec3_t right, up; + int i; + float d, c, s; + vec3_t dir; - VectorAdd( move, vec, move ); - } - } - + VectorCopy( start, move ); + VectorSubtract( end, start, vec ); + len = VectorNormalize( vec ); + + MakeNormalVectors( vec, right, up ); + + for( i=0 ; i<len ; i++ ) { + if( !free_particles ) + return; + + p = free_particles; + free_particles = p->next; + p->next = active_particles; + active_particles = p; + + p->time = cl.time; + VectorClear( p->accel ); + + d = i * 0.1; + c = cos( d ); + s = sin( d ); + + VectorScale( right, c, dir ); + VectorMA( dir, s, up, dir ); + + p->alpha = railspiral_color[3] / 255.0f; + p->alphavel = -1.0 / ( cl_railtrail_time->value + frand() * 0.2 ); + p->color = 0xff; + *( uint32_t * )p->rgb = *( uint32_t * )railspiral_color; + for( j=0 ; j<3 ; j++ ) { + p->org[j] = move[j] + dir[j] * cl_railspiral_radius->value; + p->vel[j] = dir[j] * 6; + } + + VectorAdd( move, vec, move ); + } +} - +void CL_RailTrail( vec3_t start, vec3_t end ) { + if( !cl_railtrail_type->integer || scr_glconfig.renderer == GL_RENDERER_SOFTWARE ) { + CL_OldRailTrail( start, end ); + } else { + CL_NewRailCore( start, end ); + if( cl_railtrail_type->integer > 1 ) { + CL_NewRailSpiral( start, end ); + } + } } @@ -2385,3 +2403,19 @@ void CL_ClearEffects (void) CL_ClearDlights (); CL_ClearLightStyles (); } + +void CL_InitEffects( void ) { + cl_railtrail_type = Cvar_Get( "cl_railtrail_type", "0", 0 ); + cl_railtrail_time = Cvar_Get( "cl_railtrail_time", "1.0", 0 ); + cl_railcore_color = Cvar_Get( "cl_railcore_color", "red", 0 ); + cl_railcore_color->changed = cl_railcore_color_changed; + cl_railcore_color->generator = Com_Color_g; + cl_railcore_color_changed( cl_railcore_color ); + cl_railcore_width = Cvar_Get( "cl_railcore_width", "2", 0 ); + cl_railspiral_color = Cvar_Get( "cl_railspiral_color", "blue", 0 ); + cl_railspiral_color->changed = cl_railspiral_color_changed; + cl_railspiral_color->generator = Com_Color_g; + cl_railspiral_color_changed( cl_railspiral_color ); + cl_railspiral_radius = Cvar_Get( "cl_railspiral_radius", "3", 0 ); +} + |