Replace MERGE_NODES macro with vsmerge() function

git-svn-id: https://svn.eduke32.com/eduke32@8715 1a8010ca-5511-0410-912e-c29ae57300e0

# Conflicts:
#	source/build/src/polymost.cpp
This commit is contained in:
terminx 2020-03-12 00:57:52 +00:00 committed by Christoph Oelckers
parent 05b59467f5
commit 8def930980

View file

@ -611,16 +611,7 @@ static inline void yax_vsp_finalize_init(int32_t const yaxbunch, int32_t const v
#define COMBINE_STRIPS #define COMBINE_STRIPS
#ifdef COMBINE_STRIPS #ifdef COMBINE_STRIPS
static inline void vsdel(int const i)
#define MERGE_NODES(i, ni) \
do \
{ \
vsp[i].cy[1] = vsp[ni].cy[1]; \
vsp[i].fy[1] = vsp[ni].fy[1]; \
vsdel(ni); \
} while (0);
static inline void vsdel(int32_t const i)
{ {
//Delete i //Delete i
int const pi = vsp[i].p; int const pi = vsp[i].p;
@ -635,8 +626,16 @@ static inline void vsdel(int32_t const i)
vsp[vsp[VSPMAX-1].n].p = i; vsp[vsp[VSPMAX-1].n].p = i;
vsp[VSPMAX-1].n = i; vsp[VSPMAX-1].n = i;
} }
static inline void vsmerge(int const i, int const ni)
{
vsp[i].cy[1] = vsp[ni].cy[1];
vsp[i].fy[1] = vsp[ni].fy[1];
vsdel(ni);
}
# ifdef YAX_ENABLE # ifdef YAX_ENABLE
static inline void yax_vsdel(int32_t const yaxbunch, int32_t const i) static inline void yax_vsdel(int const yaxbunch, int const i)
{ {
//Delete i //Delete i
int const pi = yax_vsp[yaxbunch][i].p; int const pi = yax_vsp[yaxbunch][i].p;
@ -654,7 +653,7 @@ static inline void yax_vsdel(int32_t const yaxbunch, int32_t const i)
# endif # endif
#endif #endif
static inline int32_t vsinsaft(int32_t const i) static inline int32_t vsinsaft(int const i)
{ {
//i = next element from empty list //i = next element from empty list
int32_t const r = vsp[VSPMAX-1].n; int32_t const r = vsp[VSPMAX-1].n;
@ -671,9 +670,7 @@ static inline int32_t vsinsaft(int32_t const i)
} }
#ifdef YAX_ENABLE #ifdef YAX_ENABLE
static inline int32_t yax_vsinsaft(int const yaxbunch, int const i)
static inline int32_t yax_vsinsaft(int32_t const yaxbunch, int32_t const i)
{ {
//i = next element from empty list //i = next element from empty list
int32_t const r = yax_vsp[yaxbunch][VSPMAX - 1].n; int32_t const r = yax_vsp[yaxbunch][VSPMAX - 1].n;
@ -1146,7 +1143,7 @@ skip: ;
{ {
if ((vsp[i].ctag == vsp[ni].ctag) && (vsp[i].ftag == vsp[ni].ftag)) if ((vsp[i].ctag == vsp[ni].ctag) && (vsp[i].ftag == vsp[ni].ftag))
{ {
MERGE_NODES(i, ni); vsmerge(i, ni);
continue; continue;
} }
if (vsp[ni].x - vsp[i].x < DOMOST_OFFSET) if (vsp[ni].x - vsp[i].x < DOMOST_OFFSET)
@ -1156,7 +1153,7 @@ skip: ;
vsp[i].fy[0] = vsp[ni].fy[0]; vsp[i].fy[0] = vsp[ni].fy[0];
vsp[i].ctag = vsp[ni].ctag; vsp[i].ctag = vsp[ni].ctag;
vsp[i].ftag = vsp[ni].ftag; vsp[i].ftag = vsp[ni].ftag;
MERGE_NODES(i, ni); vsmerge(i, ni);
continue; continue;
} }
} }
@ -3333,7 +3330,7 @@ void polymost_drawrooms()
if (Bfabsf(cslop[0]*dx-cslop[1]*dx2) < 0.001f && Bfabsf(fslop[0]*dx-fslop[1]*dx2) < 0.001f) if (Bfabsf(cslop[0]*dx-cslop[1]*dx2) < 0.001f && Bfabsf(fslop[0]*dx-fslop[1]*dx2) < 0.001f)
{ {
MERGE_NODES(i, ni); vsmerge(i, ni);
continue; continue;
} }
} }
@ -3341,7 +3338,6 @@ void polymost_drawrooms()
i = ni; i = ni;
} }
while (i); while (i);
#undef MERGE_NODES
#endif #endif
} }
//else if (!g_nodraw) { videoEndDrawing(); return; } //else if (!g_nodraw) { videoEndDrawing(); return; }