Add equation slopes to writetextmap

This commit is contained in:
Sally Coolatta 2023-08-27 15:49:05 -04:00
parent e7c3a8ac46
commit a4911b0821
3 changed files with 34 additions and 0 deletions

View file

@ -2127,6 +2127,29 @@ static INT32 P_RGBAToColor(INT32 rgba)
return (r << 16) | (g << 8) | b;
}
static void TextmapWriteSlopeConstants(FILE *f, sector_t *sec)
{
if (sec->f_slope != NULL)
{
const pslope_t *slope = sec->f_slope;
fprintf(f, "floorplane_a = %f;\n", FIXED_TO_FLOAT(slope->constants[0]));
fprintf(f, "floorplane_b = %f;\n", FIXED_TO_FLOAT(slope->constants[1]));
fprintf(f, "floorplane_c = %f;\n", FIXED_TO_FLOAT(slope->constants[2]));
fprintf(f, "floorplane_d = %f;\n", FIXED_TO_FLOAT(slope->constants[3]));
}
if (sec->c_slope != NULL)
{
const pslope_t *slope = sec->c_slope;
fprintf(f, "ceilingplane_a = %f;\n", FIXED_TO_FLOAT(slope->constants[0]));
fprintf(f, "ceilingplane_b = %f;\n", FIXED_TO_FLOAT(slope->constants[1]));
fprintf(f, "ceilingplane_c = %f;\n", FIXED_TO_FLOAT(slope->constants[2]));
fprintf(f, "ceilingplane_d = %f;\n", FIXED_TO_FLOAT(slope->constants[3]));
}
}
typedef struct
{
mapthing_t *teleport;
@ -2899,6 +2922,7 @@ static void P_WriteTextmap(void)
break;
}
}
TextmapWriteSlopeConstants(f, &wsectors[i]);
if (wsectors[i].action != 0)
fprintf(f, "action = %d;\n", wsectors[i].action);
for (j = 0; j < NUM_SCRIPT_ARGS; j++)

View file

@ -143,6 +143,8 @@ void P_ReconfigureViaVertexes (pslope_t *slope, const vector3_t v1, const vector
{
vector3_t vec1, vec2;
memset(slope->constants, 0, sizeof(slope->constants));
// Set origin.
FV3_Copy(&slope->o, &v1);
@ -204,6 +206,11 @@ static void ReconfigureViaConstants (pslope_t *slope, const fixed_t a, const fix
fixed_t o = 0;
vector3_t *normal = &slope->normal;
slope->constants[0] = a;
slope->constants[1] = b;
slope->constants[2] = c;
slope->constants[3] = d;
if (c)
o = abs(c) <= FRACUNIT ? -FixedMul(d, FixedDiv(FRACUNIT, c)) : -FixedDiv(d, c);

View file

@ -321,6 +321,9 @@ struct pslope_t
fixed_t lowz;
fixed_t highz;
// The ABCD constants used to define this slope
fixed_t constants[4];
// Light offsets (see seg_t)
SINT8 lightOffset;
#ifdef HWRENDER