mirror of
https://git.do.srb2.org/STJr/SRB2.git
synced 2024-11-15 09:11:48 +00:00
Let equation slopes be read from textmaps.
This commit is contained in:
parent
36ce44e0a3
commit
aec1ab304a
1 changed files with 73 additions and 0 deletions
|
@ -1501,6 +1501,22 @@ typedef struct textmap_colormap_s {
|
||||||
|
|
||||||
textmap_colormap_t textmap_colormap = { false, 0, 25, 0, 25, 0, 31, 0 };
|
textmap_colormap_t textmap_colormap = { false, 0, 25, 0, 25, 0, 31, 0 };
|
||||||
|
|
||||||
|
typedef enum
|
||||||
|
{
|
||||||
|
PD_A = 1,
|
||||||
|
PD_B = 1<<1,
|
||||||
|
PD_C = 1<<2,
|
||||||
|
PD_D = 1<<3,
|
||||||
|
} planedef_t;
|
||||||
|
|
||||||
|
typedef struct textmap_plane_s {
|
||||||
|
UINT8 defined;
|
||||||
|
fixed_t a, b, c, d;
|
||||||
|
} textmap_plane_t;
|
||||||
|
|
||||||
|
textmap_plane_t textmap_planefloor = {0, 0, 0, 0, 0};
|
||||||
|
textmap_plane_t textmap_planeceiling = {0, 0, 0, 0, 0};
|
||||||
|
|
||||||
static void ParseTextmapSectorParameter(UINT32 i, char *param, char *val)
|
static void ParseTextmapSectorParameter(UINT32 i, char *param, char *val)
|
||||||
{
|
{
|
||||||
if (fastcmp(param, "heightfloor"))
|
if (fastcmp(param, "heightfloor"))
|
||||||
|
@ -1539,6 +1555,46 @@ static void ParseTextmapSectorParameter(UINT32 i, char *param, char *val)
|
||||||
sectors[i].floorpic_angle = FixedAngle(FLOAT_TO_FIXED(atof(val)));
|
sectors[i].floorpic_angle = FixedAngle(FLOAT_TO_FIXED(atof(val)));
|
||||||
else if (fastcmp(param, "rotationceiling"))
|
else if (fastcmp(param, "rotationceiling"))
|
||||||
sectors[i].ceilingpic_angle = FixedAngle(FLOAT_TO_FIXED(atof(val)));
|
sectors[i].ceilingpic_angle = FixedAngle(FLOAT_TO_FIXED(atof(val)));
|
||||||
|
else if (fastcmp(param, "floorplane_a"))
|
||||||
|
{
|
||||||
|
textmap_planefloor.defined |= PD_A;
|
||||||
|
textmap_planefloor.a = FLOAT_TO_FIXED(atof(val));
|
||||||
|
}
|
||||||
|
else if (fastcmp(param, "floorplane_b"))
|
||||||
|
{
|
||||||
|
textmap_planefloor.defined |= PD_B;
|
||||||
|
textmap_planefloor.a = FLOAT_TO_FIXED(atof(val));
|
||||||
|
}
|
||||||
|
else if (fastcmp(param, "floorplane_c"))
|
||||||
|
{
|
||||||
|
textmap_planefloor.defined |= PD_C;
|
||||||
|
textmap_planefloor.a = FLOAT_TO_FIXED(atof(val));
|
||||||
|
}
|
||||||
|
else if (fastcmp(param, "floorplane_d"))
|
||||||
|
{
|
||||||
|
textmap_planefloor.defined |= PD_D;
|
||||||
|
textmap_planefloor.a = FLOAT_TO_FIXED(atof(val));
|
||||||
|
}
|
||||||
|
else if (fastcmp(param, "ceilingplane_a"))
|
||||||
|
{
|
||||||
|
textmap_planeceiling.defined |= PD_A;
|
||||||
|
textmap_planeceiling.a = FLOAT_TO_FIXED(atof(val));
|
||||||
|
}
|
||||||
|
else if (fastcmp(param, "ceilingplane_b"))
|
||||||
|
{
|
||||||
|
textmap_planeceiling.defined |= PD_B;
|
||||||
|
textmap_planeceiling.a = FLOAT_TO_FIXED(atof(val));
|
||||||
|
}
|
||||||
|
else if (fastcmp(param, "ceilingplane_c"))
|
||||||
|
{
|
||||||
|
textmap_planeceiling.defined |= PD_C;
|
||||||
|
textmap_planeceiling.a = FLOAT_TO_FIXED(atof(val));
|
||||||
|
}
|
||||||
|
else if (fastcmp(param, "ceilingplane_d"))
|
||||||
|
{
|
||||||
|
textmap_planeceiling.defined |= PD_D;
|
||||||
|
textmap_planeceiling.a = FLOAT_TO_FIXED(atof(val));
|
||||||
|
}
|
||||||
else if (fastcmp(param, "lightcolor"))
|
else if (fastcmp(param, "lightcolor"))
|
||||||
{
|
{
|
||||||
textmap_colormap.used = true;
|
textmap_colormap.used = true;
|
||||||
|
@ -1868,6 +1924,10 @@ static void P_LoadTextmap(void)
|
||||||
textmap_colormap.fadestart = 0;
|
textmap_colormap.fadestart = 0;
|
||||||
textmap_colormap.fadeend = 31;
|
textmap_colormap.fadeend = 31;
|
||||||
textmap_colormap.flags = 0;
|
textmap_colormap.flags = 0;
|
||||||
|
|
||||||
|
textmap_planefloor.defined = 0;
|
||||||
|
textmap_planeceiling.defined = 0;
|
||||||
|
|
||||||
TextmapParse(sectorsPos[i], i, ParseTextmapSectorParameter);
|
TextmapParse(sectorsPos[i], i, ParseTextmapSectorParameter);
|
||||||
|
|
||||||
P_InitializeSector(sc);
|
P_InitializeSector(sc);
|
||||||
|
@ -1877,6 +1937,19 @@ static void P_LoadTextmap(void)
|
||||||
INT32 fadergba = P_ColorToRGBA(textmap_colormap.fadecolor, textmap_colormap.fadealpha);
|
INT32 fadergba = P_ColorToRGBA(textmap_colormap.fadecolor, textmap_colormap.fadealpha);
|
||||||
sc->extra_colormap = sc->spawn_extra_colormap = R_CreateColormap(rgba, fadergba, textmap_colormap.fadestart, textmap_colormap.fadeend, textmap_colormap.flags);
|
sc->extra_colormap = sc->spawn_extra_colormap = R_CreateColormap(rgba, fadergba, textmap_colormap.fadestart, textmap_colormap.fadeend, textmap_colormap.flags);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (textmap_planefloor.defined == (PD_A|PD_B|PD_C|PD_D))
|
||||||
|
{
|
||||||
|
sc->f_slope = MakeViaEquationConstants(textmap_planefloor.a, textmap_planefloor.b, textmap_planefloor.c, textmap_planefloor.d);
|
||||||
|
sc->hasslope = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (textmap_planeceiling.defined == (PD_A|PD_B|PD_C|PD_D))
|
||||||
|
{
|
||||||
|
sc->c_slope = MakeViaEquationConstants(textmap_planeceiling.a, textmap_planeceiling.b, textmap_planeceiling.c, textmap_planeceiling.d);
|
||||||
|
sc->hasslope = true;
|
||||||
|
}
|
||||||
|
|
||||||
TextmapFixFlatOffsets(sc);
|
TextmapFixFlatOffsets(sc);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue