From 24cbd241d75bd4cb50770725efddc87ed1a320e9 Mon Sep 17 00:00:00 2001 From: helixhorned Date: Thu, 15 Sep 2011 17:02:35 +0000 Subject: [PATCH] - In the editor, make bunch-equal-making [J] stricter, because the way it was handled could lead to a bunch whose floors and ceilings covered different areas. A fix for the reduced functionality arising from this change is underway. - Rewrite a small portion of code using yax_vnextsec() in game.c. git-svn-id: https://svn.eduke32.com/eduke32@2019 1a8010ca-5511-0410-912e-c29ae57300e0 --- polymer/eduke32/build/src/build.c | 50 +++++++++++++++++++++---------- polymer/eduke32/source/game.c | 10 +++---- polymer/eduke32/source/sector.c | 2 +- 3 files changed, 40 insertions(+), 22 deletions(-) diff --git a/polymer/eduke32/build/src/build.c b/polymer/eduke32/build/src/build.c index bd41cfede..c27c89dd9 100644 --- a/polymer/eduke32/build/src/build.c +++ b/polymer/eduke32/build/src/build.c @@ -4961,7 +4961,7 @@ end_point_dragging: } else { - int32_t joink, s1to0wall; + int32_t joink, s1to0wall, s0to1wall; #ifdef YAX_ENABLE int16_t jbn[2][2]; // [join index][c/f] int32_t uneqbn; // unequal bunchnums (bitmap): 1:above, 2:below @@ -4975,6 +4975,7 @@ end_point_dragging: if (inside_editor_curpos(i) == 1) { s1to0wall = find_nextwall(i, joinsector[0]); + s0to1wall = wall[s1to0wall].nextwall; joinsector[1] = i; #ifdef YAX_ENABLE for (k=0; k<2; k++) @@ -5011,12 +5012,18 @@ end_point_dragging: if (uneqbn == 1) { - message("Can't join two sectors with different ceiling bunchnums." - " To make them equal, join their upper neighbor's floors."); + OSD_Printf("Can't join two sectors with different ceiling bunchnums." + " To make them equal, join their upper neighbor's floors."); printmessage16("Can't join two sectors with different ceiling bunchnums. See OSD"); joinsector[0] = joinsector[1] = -1; goto end_join_sectors; } + if (s0to1wall < 0) + { + printmessage16("INTERNAL ERROR: nextwalls inconsistent!"); + joinsector[0] = joinsector[1] = -1; + goto end_join_sectors; + } // both must be extended if (jbn[0][cf]<0 || jbn[1][cf]<0) @@ -5030,31 +5037,34 @@ end_point_dragging: // check whether the lower neighbors have a red-wall link to each other jsynw[1] = yax_getnextwall(s1to0wall, cf); - jsynw[0] = yax_getnextwall(wall[s1to0wall].nextwall, cf); + jsynw[0] = yax_getnextwall(s0to1wall, cf); if (jsynw[0]<0 || jsynw[1]<0) // this shouldn't happen uneqbn &= ~(1<=0 && jbn[1][cf]<0) + if (0) //(whybad==1+8 && jbn[0][cf]>=0 && jbn[1][cf]<0) { // 1st join sector extended, 2nd not... let's see // if the latter is inner to the former one - m = 1; - for (WALLS_OF_SECTOR(joinsector[1], k)) - if (wall[k].nextsector != joinsector[0]) - { - m = 0; - break; - } + int32_t lowerstartsec = yax_vnextsec(s0to1wall, cf); - if (m==1) + m = (lowerstartsec < 0)<<1; + for (WALLS_OF_SECTOR(joinsector[1], k)) + { + if (m) break; + + m |= (wall[k].nextsector>=0 && wall[k].nextsector != joinsector[0]); + m |= (wall[k].nextwall>=0 && yax_vnextsec(wall[k].nextwall, cf)!=lowerstartsec)<<1; + } + + if (m==0) { yax_setbunch(joinsector[1], YAX_FLOOR, jbn[0][cf]); yax_update(0); @@ -5066,8 +5076,16 @@ end_point_dragging: } else { - printmessage16("Can't add sector %d's floor to bunch %d: not inner to sector %d", - joinsector[1], jbn[0][cf], joinsector[0]); + if (m&1) + { + message("Can't add sector %d's floor to bunch %d: not inner to sector %d", + joinsector[1], jbn[0][cf], joinsector[0]); + } + else // if (m&2) + { + message("Can't add sector %d's floor to bunch %d: must have lower neighbor", + joinsector[1], jbn[0][cf]); + } } } else diff --git a/polymer/eduke32/source/game.c b/polymer/eduke32/source/game.c index 3cc2269e5..ca8e132e8 100644 --- a/polymer/eduke32/source/game.c +++ b/polymer/eduke32/source/game.c @@ -5596,18 +5596,18 @@ int32_t A_Spawn(int32_t j, int32_t pn) if (outerwall >= 0) { - int32_t upperwall = yax_getnextwall(outerwall, YAX_CEILING); + int32_t uppersect = yax_vnextsec(outerwall, YAX_CEILING); - if (upperwall>=0 && wall[upperwall].nextsector>=0) + if (uppersect >= 0) { - int32_t jj, uppersect=wall[upperwall].nextsector; + int32_t jj; for (jj=headspritesect[uppersect]; jj>=0; jj=nextspritesect[jj]) if (sprite[jj].picnum==SECTOREFFECTOR && sprite[jj].lotag==sp->lotag) break; if (jj < 0) { - Sect_SetInterpolation(wall[upperwall].nextsector); - actor[i].t_data[9] = wall[upperwall].nextsector; + Sect_SetInterpolation(uppersect); + actor[i].t_data[9] = uppersect; } } } diff --git a/polymer/eduke32/source/sector.c b/polymer/eduke32/source/sector.c index 2453f117e..5f9b65424 100644 --- a/polymer/eduke32/source/sector.c +++ b/polymer/eduke32/source/sector.c @@ -768,7 +768,7 @@ REDODOOR: i = headspritesect[sn]; while (i >= 0) { - if (sprite[i].statnum == 3 && SLT==9) + if (sprite[i].statnum == STAT_EFFECTOR && SLT==9) { j = SZ; break;