From e34da95c4c2bbfa8e706e52fc764859405eb49ad Mon Sep 17 00:00:00 2001 From: Monster Iestyn Date: Thu, 31 Mar 2016 16:32:25 +0100 Subject: [PATCH] DEVMODE's automap now supports slopes --- src/am_map.c | 45 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 45 insertions(+) diff --git a/src/am_map.c b/src/am_map.c index 97b7c516..847e517f 100644 --- a/src/am_map.c +++ b/src/am_map.c @@ -15,6 +15,7 @@ #include "am_map.h" #include "g_input.h" #include "p_local.h" +#include "p_slopes.h" #include "v_video.h" #include "i_video.h" #include "r_state.h" @@ -996,6 +997,10 @@ static inline void AM_drawWalls(void) { size_t i; static mline_t l; +#ifdef ESLOPE + fixed_t frontf1,frontf2, frontc1, frontc2; // front floor/ceiling ends + fixed_t backf1, backf2, backc1, backc2; // back floor ceiling ends +#endif for (i = 0; i < numlines; i++) { @@ -1003,6 +1008,22 @@ static inline void AM_drawWalls(void) l.a.y = lines[i].v1->y; l.b.x = lines[i].v2->x; l.b.y = lines[i].v2->y; +#ifdef ESLOPE +#define SLOPEPARAMS(slope, end1, end2, normalheight) \ + if (slope) { \ + end1 = P_GetZAt(slope, l.a.x, l.a.y); \ + end2 = P_GetZAt(slope, l.b.x, l.b.y); \ + } else \ + end1 = end2 = normalheight; + + SLOPEPARAMS(lines[i].frontsector->f_slope, frontf1, frontf2, lines[i].frontsector->floorheight) + SLOPEPARAMS(lines[i].frontsector->c_slope, frontc1, frontc2, lines[i].frontsector->ceilingheight) + if (lines[i].backsector) { + SLOPEPARAMS(lines[i].backsector->f_slope, backf1, backf2, lines[i].backsector->floorheight) + SLOPEPARAMS(lines[i].backsector->c_slope, backc1, backc2, lines[i].backsector->ceilingheight) + } +#undef SLOPEPARAMS +#endif // AM_drawMline(&l, GRAYS + 3); // Old, everything-is-gray automap if (!lines[i].backsector) // 1-sided @@ -1016,11 +1037,19 @@ static inline void AM_drawWalls(void) AM_drawMline(&l, WALLCOLORS+lightlev); } } +#ifdef ESLOPE + else if ((backf1 == backc1 && backf2 == backc2) // Back is thok barrier + || (frontf1 == frontc1 && frontf2 == frontc2)) // Front is thok barrier + { + if (backf1 == backc1 && backf2 == backc2 + && frontf1 == frontc1 && frontf2 == frontc2) // BOTH are thok barriers +#else else if (lines[i].backsector->floorheight == lines[i].backsector->ceilingheight // Back is thok barrier || lines[i].frontsector->floorheight == lines[i].frontsector->ceilingheight) // Front is thok barrier { if (lines[i].backsector->floorheight == lines[i].backsector->ceilingheight && lines[i].frontsector->floorheight == lines[i].frontsector->ceilingheight) // BOTH are thok barriers +#endif { if (lines[i].flags & ML_NOCLIMB) { @@ -1046,12 +1075,20 @@ static inline void AM_drawWalls(void) else { if (lines[i].flags & ML_NOCLIMB) { +#ifdef ESLOPE + if (backf1 != frontf1 || backf2 != frontf2) { +#else if (lines[i].backsector->floorheight != lines[i].frontsector->floorheight) { +#endif AM_drawMline(&l, NOCLIMBFDWALLCOLORS + lightlev); // floor level change } +#ifdef ESLOPE + else if (backc1 != frontc1 || backc2 != frontc2) { +#else else if (lines[i].backsector->ceilingheight != lines[i].frontsector->ceilingheight) { +#endif AM_drawMline(&l, NOCLIMBCDWALLCOLORS+lightlev); // ceiling level change } else { @@ -1060,12 +1097,20 @@ static inline void AM_drawWalls(void) } else { +#ifdef ESLOPE + if (backf1 != frontf1 || backf2 != frontf2) { +#else if (lines[i].backsector->floorheight != lines[i].frontsector->floorheight) { +#endif AM_drawMline(&l, FDWALLCOLORS + lightlev); // floor level change } +#ifdef ESLOPE + else if (backc1 != frontc1 || backc2 != frontc2) { +#else else if (lines[i].backsector->ceilingheight != lines[i].frontsector->ceilingheight) { +#endif AM_drawMline(&l, CDWALLCOLORS+lightlev); // ceiling level change } else {