- Fixed: When spawning actors for the rail trail, a RNG that is synchronized

across all machines must be used.
- Add Xaser's railgun fix for "P_RailAttack's 'sparsity' was being ignored for particle core trails, and 'maxdiff' was ignored when spawning actors."
  For reals this time.



SVN r3554 (trunk)
This commit is contained in:
Randy Heit 2012-04-11 22:30:27 +00:00
parent 7bfd551f27
commit 8f5eff419d
1 changed files with 24 additions and 6 deletions

View File

@ -58,6 +58,8 @@ CVAR (Int, r_rail_spiralsparsity, 1, CVAR_ARCHIVE);
CVAR (Int, r_rail_trailsparsity, 1, CVAR_ARCHIVE);
CVAR (Bool, r_particles, true, 0);
FRandom pr_railtrail("RailTrail");
#define FADEFROMTTL(a) (255/(a))
// [RH] particle globals
@ -723,8 +725,8 @@ void P_DrawRailTrail (AActor *source, const FVector3 &start, const FVector3 &end
// Create the inner trail.
if (color2 != -1 && r_rail_trailsparsity > 0 && spawnclass == NULL)
{
FVector3 trail_step = step * r_rail_trailsparsity;
int trail_steps = steps * r_rail_trailsparsity;
FVector3 trail_step = step * r_rail_trailsparsity * sparsity;
int trail_steps = steps * r_rail_trailsparsity / sparsity;
color2 = color2 == 0 ? -1 : ParticleColor(color2);
FVector3 diff(0, 0, 0);
@ -778,17 +780,33 @@ void P_DrawRailTrail (AActor *source, const FVector3 &start, const FVector3 &end
}
}
// create actors
if(spawnclass != NULL) {
if(sparsity < 1) sparsity = 32;
if (spawnclass != NULL)
{
if (sparsity < 1)
sparsity = 32;
FVector3 trail_step = (step / 3) * sparsity;
int trail_steps = (int)((steps * 3) / sparsity);
FVector3 diff(0, 0, 0);
pos = start;
for (i = trail_steps; i; i--)
{
AActor *thing = Spawn (spawnclass, FLOAT2FIXED(pos.X), FLOAT2FIXED(pos.Y), FLOAT2FIXED(pos.Z), ALLOW_REPLACE);
if(thing) thing->angle = angle;
if (maxdiff > 0)
{
int rnd = pr_railtrail();
if (rnd & 1)
diff.X = clamp<float> (diff.X + ((rnd & 8) ? 1 : -1), -maxdiff, maxdiff);
if (rnd & 2)
diff.Y = clamp<float> (diff.Y + ((rnd & 16) ? 1 : -1), -maxdiff, maxdiff);
if (rnd & 4)
diff.Z = clamp<float> (diff.Z + ((rnd & 32) ? 1 : -1), -maxdiff, maxdiff);
}
FVector3 postmp = pos + diff;
AActor *thing = Spawn (spawnclass, FLOAT2FIXED(postmp.X), FLOAT2FIXED(postmp.Y), FLOAT2FIXED(postmp.Z), ALLOW_REPLACE);
if (thing)
thing->angle = angle;
pos += trail_step;
}
}