From 8def930980fa7dee230b1c4de8a2a27ff16abcd2 Mon Sep 17 00:00:00 2001 From: terminx Date: Thu, 12 Mar 2020 00:57:52 +0000 Subject: [PATCH] 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 --- source/build/src/polymost.cpp | 34 +++++++++++++++------------------- 1 file changed, 15 insertions(+), 19 deletions(-) diff --git a/source/build/src/polymost.cpp b/source/build/src/polymost.cpp index 02839b805..0d27cbb64 100644 --- a/source/build/src/polymost.cpp +++ b/source/build/src/polymost.cpp @@ -611,16 +611,7 @@ static inline void yax_vsp_finalize_init(int32_t const yaxbunch, int32_t const v #define COMBINE_STRIPS #ifdef COMBINE_STRIPS - -#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) +static inline void vsdel(int const i) { //Delete i 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[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 -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 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 -static inline int32_t vsinsaft(int32_t const i) +static inline int32_t vsinsaft(int const i) { //i = next element from empty list int32_t const r = vsp[VSPMAX-1].n; @@ -671,9 +670,7 @@ static inline int32_t vsinsaft(int32_t const i) } #ifdef YAX_ENABLE - - -static inline int32_t yax_vsinsaft(int32_t const yaxbunch, int32_t const i) +static inline int32_t yax_vsinsaft(int const yaxbunch, int const i) { //i = next element from empty list 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)) { - MERGE_NODES(i, ni); + vsmerge(i, ni); continue; } if (vsp[ni].x - vsp[i].x < DOMOST_OFFSET) @@ -1156,7 +1153,7 @@ skip: ; vsp[i].fy[0] = vsp[ni].fy[0]; vsp[i].ctag = vsp[ni].ctag; vsp[i].ftag = vsp[ni].ftag; - MERGE_NODES(i, ni); + vsmerge(i, ni); 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) { - MERGE_NODES(i, ni); + vsmerge(i, ni); continue; } } @@ -3341,7 +3338,6 @@ void polymost_drawrooms() i = ni; } while (i); -#undef MERGE_NODES #endif } //else if (!g_nodraw) { videoEndDrawing(); return; }