Minor changes

This commit is contained in:
Lactozilla 2024-01-29 23:55:12 -03:00
parent 6180ddde32
commit 8847cf77b4
6 changed files with 21 additions and 18 deletions

View file

@ -2609,9 +2609,11 @@ static int slope_set(lua_State *L)
slope->o.z = luaL_checkfixed(L, -1);
else
slope->o.z = 0;
slope->dorigin.x = FixedToDouble(slope->o.x);
slope->dorigin.y = FixedToDouble(slope->o.y);
slope->dorigin.z = FixedToDouble(slope->o.z);
DVector3_Load(&slope->dorigin,
FixedToDouble(slope->o.x),
FixedToDouble(slope->o.y),
FixedToDouble(slope->o.z)
);
lua_pop(L, 1);
break;
}

View file

@ -1,6 +1,6 @@
// SONIC ROBO BLAST 2
//-----------------------------------------------------------------------------
// Copyright (C) 1999-2024 by Sonic Team Junior.
// Copyright (C) 2024 by Sonic Team Junior.
// Copyright (C) 2009 by Stephen McGranahan.
//
// This program is free software distributed under the

View file

@ -1,6 +1,6 @@
// SONIC ROBO BLAST 2
//-----------------------------------------------------------------------------
// Copyright (C) 1999-2024 by Sonic Team Junior.
// Copyright (C) 2024 by Sonic Team Junior.
// Copyright (C) 2009 by Stephen McGranahan.
//
// This program is free software distributed under the

View file

@ -1,6 +1,6 @@
// SONIC ROBO BLAST 2
//-----------------------------------------------------------------------------
// Copyright (C) 2004 by Stephen McGranahan
// Copyright (C) 2009 by Stephen McGranahan.
// Copyright (C) 2015-2023 by Sonic Team Junior.
//
// This program is free software distributed under the
@ -38,17 +38,17 @@ void P_CalculateSlopeNormal(pslope_t *slope) {
static void CalculateVectors(pslope_t *slope, dvector3_t *dnormal)
{
double hyp = hypot(dnormal->x, dnormal->y);
if (fpclassify(hyp) == FP_ZERO)
if (fpclassify(hyp) == FP_NORMAL)
{
slope->dnormdir.x = slope->dnormdir.y = 0.0;
slope->dzdelta = 0.0;
slope->dnormdir.x = -dnormal->x / hyp;
slope->dnormdir.y = -dnormal->y / hyp;
slope->dzdelta = hyp / dnormal->z;
}
else
{
slope->dnormdir.x = -(dnormal->x / hyp);
slope->dnormdir.y = -(dnormal->y / hyp);
slope->dzdelta = hyp / dnormal->z;
slope->dnormdir.x = slope->dnormdir.y = 0.0;
slope->dzdelta = 0.0;
}
}

View file

@ -1,6 +1,6 @@
// SONIC ROBO BLAST 2
//-----------------------------------------------------------------------------
// Copyright (C) 2004 by Stephen McGranahan
// Copyright (C) 2009 by Stephen McGranahan.
// Copyright (C) 2015-2023 by Sonic Team Junior.
//
// This program is free software distributed under the

View file

@ -663,6 +663,7 @@ static void R_DrawSkyPlane(visplane_t *pl)
// Returns the height of the sloped plane at (x, y) as a double
static double R_GetSlopeZAt(const pslope_t *slope, fixed_t x, fixed_t y)
{
// If you want to reimplement this using just the equation constants, use this instead:
// (d + a*x + b*y) * -(1.0 / c)
double px = FixedToDouble(x) - slope->dorigin.x;
@ -712,11 +713,11 @@ void R_SetSlopePlane(pslope_t *slope, fixed_t xpos, fixed_t ypos, fixed_t zpos,
return;
}
// slope_v is the v direction vector in view space
// the v direction vector in view space
slope_v.x = cos(ang);
slope_v.z = sin(ang);
// slope_u is the u direction vector in view space
// the u direction vector in view space
slope_u.x = sin(ang);
slope_u.z = -cos(ang);
@ -754,11 +755,11 @@ void R_SetScaledSlopePlane(pslope_t *slope, fixed_t xpos, fixed_t ypos, fixed_t
float xscale = FixedToFloat(xs);
float yscale = FixedToFloat(ys);
// m is the v direction vector in view space
// the v direction vector in view space
slope_v.x = yscale * cos(ang);
slope_v.z = yscale * sin(ang);
// n is the u direction vector in view space
// the u direction vector in view space
slope_u.x = xscale * sin(ang);
slope_u.z = -xscale * cos(ang);