Merge branch 'master' into scripting

Conflicts:
	src/p_effect.cpp
	src/p_effect.h
	src/p_local.h
	src/p_map.cpp
	src/thingdef/thingdef_codeptr.cpp
This commit is contained in:
Christoph Oelckers 2015-07-16 20:37:17 +02:00
commit d8ea128f38
27 changed files with 220 additions and 85 deletions

View file

@ -586,12 +586,12 @@ void P_DrawSplash2 (int count, fixed_t x, fixed_t y, fixed_t z, angle_t angle, i
}
}
void P_DrawRailTrail (AActor *source, const FVector3 &start, const FVector3 &end, int color1, int color2, double maxdiff_d, int flags, PClassActor *spawnclass, angle_t angle, int duration, double sparsity, double drift, int SpiralOffset)
void P_DrawRailTrail(AActor *source, const TVector3<double> &start, const TVector3<double> &end, int color1, int color2, double maxdiff, int flags, const PClassActor *spawnclass, angle_t angle, int duration, double sparsity, double drift, int SpiralOffset)
{
double length, lengthsquared;
int steps, i;
FAngle deg;
FVector3 step, dir, pos, extend;
TAngle<double> deg;
TVector3<double> step, dir, pos, extend;
bool fullbright;
float maxdiff = (float)maxdiff_d;
@ -616,9 +616,9 @@ void P_DrawRailTrail (AActor *source, const FVector3 &start, const FVector3 &end
// The railgun's sound is special. It gets played from the
// point on the slug's trail that is closest to the hearing player.
AActor *mo = players[consoleplayer].camera;
FVector3 point;
TVector3<double> point;
double r;
float dirz;
double dirz;
if (abs(mo->x - FLOAT2FIXED(start.X)) < 20 * FRACUNIT
&& (mo->y - FLOAT2FIXED(start.Y)) < 20 * FRACUNIT)
@ -631,7 +631,7 @@ void P_DrawRailTrail (AActor *source, const FVector3 &start, const FVector3 &end
// Only consider sound in 2D (for now, anyway)
// [BB] You have to divide by lengthsquared here, not multiply with it.
r = ((start.Y - FIXED2FLOAT(mo->y)) * (-dir.Y) - (start.X - FIXED2FLOAT(mo->x)) * (dir.X)) / lengthsquared;
r = ((start.Y - FIXED2DBL(mo->y)) * (-dir.Y) - (start.X - FIXED2DBL(mo->x)) * (dir.X)) / lengthsquared;
r = clamp<double>(r, 0., 1.);
dirz = dir.Z;
@ -663,7 +663,7 @@ void P_DrawRailTrail (AActor *source, const FVector3 &start, const FVector3 &end
minelem = fabs(dir[i]);
}
}
FVector3 tempvec(0,0,0);
TVector3<double> tempvec(0, 0, 0);
tempvec[epos] = 1;
extend = tempvec - (dir | tempvec) * dir;
//
@ -674,16 +674,16 @@ void P_DrawRailTrail (AActor *source, const FVector3 &start, const FVector3 &end
// Create the outer spiral.
if (color1 != -1 && (!r_rail_smartspiral || color2 == -1) && r_rail_spiralsparsity > 0 && (spawnclass == NULL))
{
FVector3 spiral_step = step * r_rail_spiralsparsity * sparsity;
TVector3<double> spiral_step = step * r_rail_spiralsparsity * sparsity;
int spiral_steps = (int)(steps * r_rail_spiralsparsity / sparsity);
color1 = color1 == 0 ? -1 : ParticleColor(color1);
pos = start;
deg = FAngle(SpiralOffset);
deg = TAngle<double>(SpiralOffset);
for (i = spiral_steps; i; i--)
{
particle_t *p = NewParticle ();
FVector3 tempvec;
TVector3<double> tempvec;
if (!p)
return;
@ -696,7 +696,7 @@ void P_DrawRailTrail (AActor *source, const FVector3 &start, const FVector3 &end
p->size = 3;
p->bright = fullbright;
tempvec = FMatrix3x3(dir, deg) * extend;
tempvec = TMatrix3x3<double>(dir, deg) * extend;
p->velx = FLOAT2FIXED(tempvec.X * drift)>>4;
p->vely = FLOAT2FIXED(tempvec.Y * drift)>>4;
p->velz = FLOAT2FIXED(tempvec.Z * drift)>>4;
@ -705,7 +705,7 @@ void P_DrawRailTrail (AActor *source, const FVector3 &start, const FVector3 &end
p->y = FLOAT2FIXED(tempvec.Y);
p->z = FLOAT2FIXED(tempvec.Z);
pos += spiral_step;
deg += FAngle(r_rail_spiralsparsity * 14);
deg += TAngle<double>(r_rail_spiralsparsity * 14);
if (color1 == -1)
{
@ -730,18 +730,18 @@ 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 * sparsity;
TVector3<double> trail_step = step * r_rail_trailsparsity * sparsity;
int trail_steps = xs_FloorToInt(steps * r_rail_trailsparsity / sparsity);
color2 = color2 == 0 ? -1 : ParticleColor(color2);
FVector3 diff(0, 0, 0);
TVector3<double> diff(0, 0, 0);
pos = start;
for (i = trail_steps; i; i--)
{
// [XA] inner trail uses a different default duration (33).
int innerduration = (duration == 0) ? 33 : duration;
particle_t *p = JitterParticle (innerduration, drift);
particle_t *p = JitterParticle (innerduration, (float)drift);
if (!p)
return;
@ -750,14 +750,14 @@ void P_DrawRailTrail (AActor *source, const FVector3 &start, const FVector3 &end
{
int rnd = M_Random ();
if (rnd & 1)
diff.X = clamp<float> (diff.X + ((rnd & 8) ? 1 : -1), -maxdiff, maxdiff);
diff.X = clamp<double>(diff.X + ((rnd & 8) ? 1 : -1), -maxdiff, maxdiff);
if (rnd & 2)
diff.Y = clamp<float> (diff.Y + ((rnd & 16) ? 1 : -1), -maxdiff, maxdiff);
diff.Y = clamp<double>(diff.Y + ((rnd & 16) ? 1 : -1), -maxdiff, maxdiff);
if (rnd & 4)
diff.Z = clamp<float> (diff.Z + ((rnd & 32) ? 1 : -1), -maxdiff, maxdiff);
diff.Z = clamp<double>(diff.Z + ((rnd & 32) ? 1 : -1), -maxdiff, maxdiff);
}
FVector3 postmp = pos + diff;
TVector3<double> postmp = pos + diff;
p->size = 2;
p->x = FLOAT2FIXED(postmp.X);
@ -792,9 +792,9 @@ void P_DrawRailTrail (AActor *source, const FVector3 &start, const FVector3 &end
if (sparsity < 1)
sparsity = 32;
FVector3 trail_step = (step / 3) * sparsity;
TVector3<double> trail_step = (step / 3) * sparsity;
int trail_steps = (int)((steps * 3) / sparsity);
FVector3 diff(0, 0, 0);
TVector3<double> diff(0, 0, 0);
pos = start;
for (i = trail_steps; i; i--)
@ -803,13 +803,13 @@ void P_DrawRailTrail (AActor *source, const FVector3 &start, const FVector3 &end
{
int rnd = pr_railtrail();
if (rnd & 1)
diff.X = clamp<float> (diff.X + ((rnd & 8) ? 1 : -1), -maxdiff, maxdiff);
diff.X = clamp<double>(diff.X + ((rnd & 8) ? 1 : -1), -maxdiff, maxdiff);
if (rnd & 2)
diff.Y = clamp<float> (diff.Y + ((rnd & 16) ? 1 : -1), -maxdiff, maxdiff);
diff.Y = clamp<double>(diff.Y + ((rnd & 16) ? 1 : -1), -maxdiff, maxdiff);
if (rnd & 4)
diff.Z = clamp<float> (diff.Z + ((rnd & 32) ? 1 : -1), -maxdiff, maxdiff);
diff.Z = clamp<double>(diff.Z + ((rnd & 32) ? 1 : -1), -maxdiff, maxdiff);
}
FVector3 postmp = pos + diff;
TVector3<double> postmp = pos + diff;
AActor *thing = Spawn (spawnclass, FLOAT2FIXED(postmp.X), FLOAT2FIXED(postmp.Y), FLOAT2FIXED(postmp.Z), ALLOW_REPLACE);
if (thing)