OpenArena Message Boards

id Tech 3 => cgame/game/ui => Topic started by: fromhell on March 03, 2014, 12:41:07 PM



Title: [cgame] Restoring railDisc / Rail Rings
Post by: fromhell on March 03, 2014, 12:41:07 PM
Around 1.30 Quake3 removed raildisc (while implementing a buggier rail spiral effect).  This is absent in the GPL source.


Fortunately it was dead simple to re-implement it from scratch.


In cg_weapons.c, add the following after the line "re->oldorigin[2] -= 8;" and before the return statement in the function CG_RailTrail

Code:
	// lei-lei - reimplementing the rail discs that were removed in 1.30
if (cg_oldRail.integer > 1){

le = CG_AllocLocalEntity();
re = &le->refEntity;

VectorCopy(start, re->origin);
VectorCopy(end, re->oldorigin);
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_RINGS;
re->customShader = cgs.media.railRingsShader;
re->shaderRGBA[0] = ci->color1[0] * 255;
re->shaderRGBA[1] = ci->color1[1] * 255;
re->shaderRGBA[2] = ci->color1[2] * 255;
re->shaderRGBA[3] = 255;

le->color[0] = ci->color1[0] * 0.75;
le->color[1] = ci->color1[1] * 0.75;
le->color[2] = ci->color1[2] * 0.75;
le->color[3] = 1.0f;

re->origin[2] -= 8;
re->oldorigin[2] -= 8;

if (cg_oldRail.integer > 2){ // use the secondary color instead
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;
}

}

This should allow the following settings:


cg_oldRail 0 = the 1.30 spiral
cg_oldRail 1 = Core only, as butchered in 1.30
cg_oldRail 2 = pre-1.30 rail discs
cg_oldRail 3 = pre-1.30 rail discs that use 1.30's color2


Also, note that there's a few cvars in the renderer that adjust the size of the rail:

r_railWidth = adjusts the disc size.  Default 16; though q3test 1.05 had this set as 128
r_railCoreWidth = adjust the size of the beam. Default 6, q3test 1.05 had this set to 16
r_railSegmentLength = adjusts the length of each disc's gap. Default 32, q3test 1.05 had this set to 64

DISCLAIMER: I did not use any of the old Q3A SDK code as reference for this.  This is all clean room.


Title: Re: [cgame] Restoring railDisc / Rail Rings
Post by: Gig on March 04, 2014, 01:56:35 AM
The old original Q3 rail! Nice!  ;D

Waiting for updated OAX/Binaries to try it....

r_railWidth = adjusts the disc size.  Default 16; though q3test 1.05 had this set as 128
Different scale?
Quote
r_railSegmentLength = adjusts the length of each disc's gap. Default 32, q3test 1.05 had this set to 64
Are you sure about changing this default? I can guess lenght 32 instead of 64 doubles the number of polygons to render...


Title: Re: [cgame] Restoring railDisc / Rail Rings
Post by: Gig on August 02, 2016, 01:15:37 AM
If someone wants to test the feature, it's available in DO NOT LINK[/b]) h t t p s : / / openarena . wikia . com/wiki/OAX]OAX mod (http://([b) since 2016-07-01 nightly build.

Good work, FromHell!

(And thanks to Sago who set-up nightly builds, of course)