Cg_oldrail for 1.16n
ok well the old rail efx for 1.16 n is done a little defront from the one i 1.25 and later.
First do you cvar's cg_main.c
vmCvar_t cg_oldRail;
{ &cg_oldRail, "cg_oldRail", "1",
0},
then go to cg_local.h
look for this line vec3_t color; just under
that add this line vec3_t color2;
Now work your way down to the cvar's and add your.
extern vmCvar_t cg_oldRail;
Ok now open up cg_weapon.c and
find CG_RailTrail now remove all
of cg_railtrail.
now add this new cg_railtrail.
/*
==========================
CG_RailTrail
==========================
*/
void CG_RailTrail (clientInfo_t *ci, vec3_t start, vec3_t end) {
vec3_t axis[36], move, move2, next_move, vec, temp;
float len;
int i, j, skip;
localEntity_t *le;
refEntity_t *re;
#define RADIUS 4
#define ROTATION 1
#define SPACING 5
start[2] -= 4;
VectorCopy (start, move);
VectorSubtract (end, start, vec);
len = VectorNormalize (vec);
PerpendicularVector(temp, vec);
for (i = 0 ; i < 36; i++) {
RotatePointAroundVector(axis[i], vec, temp, i * 10);//banshee 2.4 was 10
}
le = CG_AllocLocalEntity();
re = &le->refEntity;
le->leType = LE_FADE_RGB;
le->startTime = cg.time;
le->endTime = cg.time + cg_railTrailTime.value;
le->lifeRate = 1.0 / (le->endTime - le->startTime);
re->shaderTime = cg.time / 1000.0f;
re->reType = RT_RAIL_CORE;
re->customShader = cgs.media.railCoreShader;
VectorCopy(start, re->origin);
VectorCopy(end, re->oldorigin);
re->shaderRGBA[0] = ci->color[0] * 255;
re->shaderRGBA[1] = ci->color[1] * 255;
re->shaderRGBA[2] = ci->color[2] * 255;
re->shaderRGBA[3] = 255;
le->color[0] = ci->color[0] * 0.75;
le->color[1] = ci->color[1] * 0.75;
le->color[2] = ci->color[2] * 0.75;
le->color[3] = 1.0f;
AxisClear( re->axis );
VectorMA(move, 20, vec, move);
VectorCopy(move, next_move);
VectorScale (vec, SPACING, vec);
if (cg_oldRail.integer != 0) {
// nudge down a bit so it isn't exactly in center
re->origin[2] -= 8;
re->oldorigin[2] -= 8;
return;
}
skip = -1;
j = 18;
for (i = 0; i < len; i += SPACING) {
if (i != skip) {
skip = i + SPACING;
le = CG_AllocLocalEntity();
re = &le->refEntity;
le->leFlags = LEF_PUFF_DONT_SCALE;
le->leType = LE_MOVE_SCALE_FADE;
le->startTime = cg.time;
le->endTime = cg.time + (i>>1) + 600;
le->lifeRate = 1.0 / (le->endTime - le->startTime);
re->shaderTime = cg.time / 1000.0f;
re->reType = RT_SPRITE;
re->radius = 1.1f;
re->customShader = cgs.media.railRingsShader;
re->shaderRGBA[0] = ci->color2[0] * 255;
re->shaderRGBA[1] = ci->color2[1] * 255;
re->shaderRGBA[2] = ci->color2[2] * 255;
re->shaderRGBA[3] = 255;
le->color[0] = ci->color2[0] * 0.75;
le->color[1] = ci->color2[1] * 0.75;
le->color[2] = ci->color2[2] * 0.75;
le->color[3] = 1.0f;
le->pos.trType = TR_LINEAR;
le->pos.trTime = cg.time;
VectorCopy( move, move2);
VectorMA(move2, RADIUS , axis[j], move2);
VectorCopy(move2, le->pos.trBase);
le->pos.trDelta[0] = axis[j][0]*6;
le->pos.trDelta[1] = axis[j][1]*6;
le->pos.trDelta[2] = axis[j][2]*6;
}
VectorAdd (move, vec, move);
j = j + ROTATION < 36 ? j + ROTATION : (j + ROTATION) % 36;
}
}
Ok now you need to open up cg_players.c and look for CG_ColorFromString . And del or rem it out.and are the below.
/*
====================
CG_ColorFromString
====================
*/
static void CG_ColorFromString( const char *v, vec3_t color, vec3_t color2) {
int val, val2;
VectorClear( color );
val = atoi( v );
if (val < 10) val2 = val;
else
{
val2 = val % 10;
val /= 10;
}
//core
if ( val < 1 || val > 7 )
VectorSet( color, 1, 1, 1 );
else;
{
if ( val & 1 )
color[2] = 1.0f;
if ( val & 2 )
color[1] = 1.0f;
if ( val & 4 )
color[0] = 1.0f;
}
// rail
if ( val2 < 1 || val2 > 7 )
VectorSet( color2, 1, 1, 1 );
else
{
if ( val2 & 1 )
color2[2] = 1.0f;
if ( val2 & 2 )
color2[1] = 1.0f;
if ( val2 & 4 )
color2[0] = 1.0f;
}
}
now work your way down to CG_NewClientInfoand look for the below line
// colors v = Info_ValueForKey( configstring, "c1" ); CG_ColorFromString( v, newInfo.color );
And change it to look like this
// colors v = Info_ValueForKey( configstring, "c1" ); CG_ColorFromString( v, newInfo.color, newInfo.color2);
Ok if all you wont is cg_oldrail your done.
this is what is going on here in 1.25 and later there are 2 CG_NewClientInfo colors configstrings c1,c2 in 1.16n there is only c1 so it needs to carry the string for 2 colors ware c1,c2 only need to carry 1 each.
ok now well do a UI add in for it to make it ezer to ajust rail colors.
Ok now open up ui_playersettings.c , find the #define at the top. In the same group as ID_EFFECTS and.
#define ID_EFFECTS2 And give it the next number in the group 15,16, what ever.
now just below that you should see the playersettings_t . look for menulist_s effects; under that add menulist_s effects2; .
Now look for PlayerSettings_DrawEffects /* -- */ out and replase it with this below
/*
=================
PlayerSettings_DrawEffects
=================
*/
static void PlayerSettings_DrawEffects( void *self ) {
menulist_s *item;
qboolean focus;
int style;
float *color;
float scale;
int textlen;
item = (menulist_s *)self;
focus = (item->generic.parent->cursor == item->generic.menuPosition);
style = UI_LEFT|UI_SMALLFONT;
color = text_color_normal;
if( focus ) {
style |= UI_PULSE;
color = text_color_highlight;
}
// UI_DrawProportionalString( item->generic.x, item->generic.y, "Effects", style, color );
scale = TEXT_RESCALE;
if (item->generic.id == ID_EFFECTS) {
UI_DrawScaledProportionalString( item->generic.x, item->generic.y, "Rail core:", style, scale, color );
} else {
UI_DrawScaledProportionalString( item->generic.x, item->generic.y, "Rail ring:", style, scale, color );
}
textlen = UI_ProportionalStringWidth("Rail core:") * UI_ProportionalSizeScale(style) * scale + 14;
UI_DrawHandlePic( item->generic.x + textlen, item->generic.y + 4, 128, 8, s_playersettings.fxBasePic );
UI_DrawHandlePic( item->generic.x + textlen + item->curvalue * 16 + 8, item->generic.y + 2, 16, 12, s_playersettings.fxPic[item->curvalue] );
}
next go down to PlayerSettings_SaveChanges And look for // effects color.
// out trap_Cvar_SetValue( "color", uitogamecode[s_playersettings.effects.curvalue] ); repace it with
trap_Cvar_SetValue( "color", (uitogamecode[s_playersettings.effects.curvalue] * 10) + uitogamecode[s_playersettings.effects2.curvalue] );
scroll on down to PlayerSettings_SetMenuItems and look for this
// effects color
c = trap_Cvar_VariableValue( "color" ) - 1;
if( c < 0 || c > 6 ) {
c = 6;
}
s_playersettings.effects.curvalue = gamecodetoui[c];
Rem it out and replace it with this.
// effects color
c = trap_Cvar_VariableValue( "color" );
if (c < 10) // assume special colors aren't used
{
c--;
if( c < 0 || c > 6 )
c = 6;
s_playersettings.effects.curvalue = gamecodetoui[c];
s_playersettings.effects2.curvalue = gamecodetoui[c];
}
else
{
h = (c / 10) - 1;
if( h < 0 || h > 6 )
h = 6;
c = (c % 10) - 1;
if( c < 0 || c > 6 )
c = 6;
s_playersettings.effects.curvalue = gamecodetoui[h];
s_playersettings.effects2.curvalue = gamecodetoui[c];
}
Now look for PlayerSettings_MenuInit and below that you should find this.
y += 3 * PROP_HEIGHT; s_playersettings.effects.generic.type = MTYPE_SPINCONTROL; s_playersettings.effects.generic.flags = QMF_NODEFAULTINIT; s_playersettings.effects.generic.id = ID_EFFECTS; s_playersettings.effects.generic.ownerdraw = PlayerSettings_DrawEffects; s_playersettings.effects.generic.x = 192; s_playersettings.effects.generic.y = y; s_playersettings.effects.generic.left = 192 - 8; s_playersettings.effects.generic.top = y - 8; s_playersettings.effects.generic.right = 192 + 200; s_playersettings.effects.generic.bottom = y + 2* PROP_HEIGHT; s_playersettings.effects.numitems = 7;just below that add this
y += 3 * PROP_HEIGHT; s_playersettings.effects2.generic.type = MTYPE_SPINCONTROL; s_playersettings.effects2.generic.flags = QMF_NODEFAULTINIT; s_playersettings.effects2.generic.id = ID_EFFECTS2; s_playersettings.effects2.generic.ownerdraw = PlayerSettings_DrawEffects; s_playersettings.effects2.generic.x = 192; s_playersettings.effects2.generic.y = y; s_playersettings.effects2.generic.left = 192 - 8; s_playersettings.effects2.generic.top = y - 8; s_playersettings.effects2.generic.right = 192 + 200; s_playersettings.effects2.generic.bottom = y + 2* PROP_HEIGHT; s_playersettings.effects2.numitems = 7;Now go down some and find this line.
Menu_AddItem( &s_playersettings.menu, &s_playersettings.effects );and below it add this one.
Menu_AddItem( &s_playersettings.menu, &s_playersettings.effects2 );well that should be it I dont remamber ware all i font this or if it was just