Pages: [1]
  Print  
Author Topic: [cgame] Restoring railDisc / Rail Rings  (Read 25046 times)
fromhell
Administrator
GET A LIFE!
**********

Cakes 35
Posts: 14520



WWW
« 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.
« Last Edit: March 03, 2014, 02:55:57 PM by fromhell » Logged

asking when OA3 will be done won't get OA3 done.
Progress of OA3 currently occurs behind closed doors alone

I do not provide technical support either.

new code development on github
Gig
In the year 3000
***

Cakes 45
Posts: 4394


WWW
« Reply #1 on: March 04, 2014, 01:56:35 AM »

The old original Q3 rail! Nice!  Grin

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...
« Last Edit: March 04, 2014, 02:00:07 AM by Gig » Logged

I never want to be aggressive, offensive or ironic with my posts. If you find something offending in my posts, read them again searching for a different mood there. If you still see something bad with them, please ask me infos. I can be wrong at times, but I never want to upset anyone.
Gig
In the year 3000
***

Cakes 45
Posts: 4394


WWW
« Reply #2 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 since 2016-07-01 nightly build.

Good work, FromHell!

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

I never want to be aggressive, offensive or ironic with my posts. If you find something offending in my posts, read them again searching for a different mood there. If you still see something bad with them, please ask me infos. I can be wrong at times, but I never want to upset anyone.
Pages: [1]
  Print  
 
Jump to: