From 948a716229159dd5f28d86617000b98bad869857 Mon Sep 17 00:00:00 2001 From: helixhorned Date: Sun, 26 Aug 2012 22:10:40 +0000 Subject: [PATCH] Mapster32: for c&p-ing map portions w/o TROR, fix wrongly resetting wall lotag/extra git-svn-id: https://svn.eduke32.com/eduke32@2965 1a8010ca-5511-0410-912e-c29ae57300e0 --- polymer/eduke32/build/include/build.h | 1 + polymer/eduke32/build/src/build.c | 15 +++++++++++---- polymer/eduke32/build/src/engine.c | 2 +- 3 files changed, 13 insertions(+), 5 deletions(-) diff --git a/polymer/eduke32/build/include/build.h b/polymer/eduke32/build/include/build.h index 9459e5ffd..ee765229b 100644 --- a/polymer/eduke32/build/include/build.h +++ b/polymer/eduke32/build/include/build.h @@ -103,6 +103,7 @@ void yax_updategrays(int32_t posze); // more user tag hijacking: lotag/extra :/ # define YAX_PTRNEXTWALL(Ptr, Wall, Cf) (*(&Ptr[Wall].lotag + 2*Cf)) # define YAX_NEXTWALL(Wall, Cf) YAX_PTRNEXTWALL(wall, Wall, Cf) +# define YAX_NEXTWALLDEFAULT(Cf) (((Cf)==YAX_CEILING) ? 0 : -1) # define YAX_ITER_WALLS(Wal, Itervar, Cfvar) Cfvar=0, Itervar=(Wal); Itervar!=-1; \ Itervar=yax_getnextwall(Itervar, Cfvar), \ diff --git a/polymer/eduke32/build/src/build.c b/polymer/eduke32/build/src/build.c index d23038f08..00f3c751c 100644 --- a/polymer/eduke32/build/src/build.c +++ b/polymer/eduke32/build/src/build.c @@ -1659,12 +1659,18 @@ static int32_t backup_highlighted_map(mapinfofull_t *mapinfo) #ifdef YAX_ENABLE if (mapinfo->numyaxbunches > 0) { - int32_t ynw, cf; + int32_t cf; for (cf=0; cf<2; cf++) { - ynw = yax_getnextwall(m+j, cf); - mapinfo->ynextwall[2*(tmpnumwalls+j) + cf] = (ynw >= 0) ? otonwall[ynw] : -1; + const int32_t ynw = yax_getnextwall(m+j, cf); + const int32_t nynw = (ynw >= 0) ? otonwall[ynw] : -1; + + if (mapinfo->numyaxbunches > 0) + mapinfo->ynextwall[2*(tmpnumwalls+j) + cf] = nynw; + + if (ynw >= 0 && nynw < 0) // CLEAR_YNEXTWALLS + YAX_PTRNEXTWALL(mapinfo->wall, tmpnumwalls+j, cf) = YAX_NEXTWALLDEFAULT(cf); } } #endif @@ -1763,7 +1769,8 @@ static int32_t restore_highlighted_map(mapinfofull_t *mapinfo, int32_t forreal) yax_setnextwall(i, j, mapinfo->ynextwall[2*(i-numwalls) + j]>=0 ? numwalls+mapinfo->ynextwall[2*(i-numwalls) + j] : -1); else - yax_setnextwall(i, j, -1); + wall[i].cstat &= ~YAX_NEXTWALLBIT(j); // CLEAR_YNEXTWALLS +// yax_setnextwall(i, j, -1); } #endif } diff --git a/polymer/eduke32/build/src/engine.c b/polymer/eduke32/build/src/engine.c index 40c7d6018..1877237e9 100644 --- a/polymer/eduke32/build/src/engine.c +++ b/polymer/eduke32/build/src/engine.c @@ -412,7 +412,7 @@ void yax_setnextwall(int16_t wal, int16_t cf, int16_t thenextwall) else { wall[wal].cstat &= ~YAX_NEXTWALLBIT(cf); - YAX_NEXTWALL(wal, cf) = cf?-1:0; + YAX_NEXTWALL(wal, cf) = YAX_NEXTWALLDEFAULT(cf); } }