diff --git a/polymer/eduke32/build/include/build.h b/polymer/eduke32/build/include/build.h index 3040be145..3be73436b 100644 --- a/polymer/eduke32/build/include/build.h +++ b/polymer/eduke32/build/include/build.h @@ -82,7 +82,8 @@ void yax_updategrays(int32_t posze); #ifdef YAX_ENABLE // more user tag hijacking: lotag/extra :/ -# define YAX_NEXTWALL(Wall, Cf) (*(&wall[Wall].lotag + 2*Cf)) +# define YAX_PTRNEXTWALL(Ptr, Wall, Cf) (*(&Ptr[Wall].lotag + 2*Cf)) +# define YAX_NEXTWALL(Wall, Cf) YAX_PTRNEXTWALL(wall, Wall, Cf) # define YAX_ITER_WALLS(Wal, Itervar, Cfvar) Cfvar=0, Itervar=(Wal); Itervar!=-1; \ Itervar=yax_getnextwall(Itervar, Cfvar), (void)(Itervar==-1 && Cfvar==0 && (Cfvar=1) && (Itervar=yax_getnextwall((Wal), Cfvar))) diff --git a/polymer/eduke32/build/src/engine.c b/polymer/eduke32/build/src/engine.c index 9119db73b..b25f9d12a 100644 --- a/polymer/eduke32/build/src/engine.c +++ b/polymer/eduke32/build/src/engine.c @@ -306,7 +306,8 @@ static int32_t yax_islockededge(int32_t line, int32_t cf) return !!(wall[line].cstat&(YAX_NEXTWALLBIT(cf))); } -#define YAX_BUNCHNUM(Sect, Cf) (*(§or[Sect].ceilingxpanning + 8*Cf)) +#define YAX_PTRBUNCHNUM(Ptr, Sect, Cf) (*(&Ptr[Sect].ceilingxpanning + 8*Cf)) +#define YAX_BUNCHNUM(Sect, Cf) YAX_PTRBUNCHNUM(sector, Sect, Cf) //// bunch getters/setters int16_t yax_getbunch(int16_t i, int16_t cf) @@ -446,7 +447,10 @@ void yax_update(int32_t resetstat) return; // constuct singly linked list of sectors-of-bunch - editstatus = (resetstat==0); // read bunchnums directly from the sector struct! + + // read bunchnums directly from the sector struct in yax_[gs]etbunch{es}! + editstatus = (resetstat==0); + // use oeditstatus to check for in-gamedness from here on! if (resetstat==0) { @@ -503,7 +507,11 @@ void yax_update(int32_t resetstat) for (j=sector[i].wallptr; j 1 // - // 4 (our pos) + // 4 (our pos, z wrt the nextsector!) getzsofslope((int16_t)sectnum,wal->x,wal->y,&cz[0],&fz[0]); getzsofslope((int16_t)sectnum,wall[wal->point2].x,wall[wal->point2].y,&cz[1],&fz[1]); @@ -9974,6 +9989,17 @@ int32_t saveboard(const char *filename, int32_t *daposx, int32_t *daposy, int32_ sec->lotag = B_LITTLE16(sec->lotag); sec->hitag = B_LITTLE16(sec->hitag); sec->extra = B_LITTLE16(sec->extra); +#ifdef YAX_ENABLE + if (editstatus == 0) + { + // if in-game, pack game-time bunchnum data back into structs + int32_t cf, bn; + + for (cf=0; cf<2; cf++) + if ((bn=yax_getbunch(i, cf)) >= 0) + YAX_PTRBUNCHNUM(tsect, i, cf) = bn; + } +#endif } Bwrite(fil,&tsect[0],sizeof(sectortype) * numsectors); @@ -10000,6 +10026,17 @@ int32_t saveboard(const char *filename, int32_t *daposx, int32_t *daposy, int32_ wal->cstat = B_LITTLE16(wal->cstat); wal->picnum = B_LITTLE16(wal->picnum); wal->overpicnum = B_LITTLE16(wal->overpicnum); +#ifdef YAX_ENABLE + if (editstatus == 0) + { + // if in-game, pack game-time yax-nextwall data back into structs + int16_t ynw; + if ((ynw=yax_getnextwall(i, YAX_CEILING))>=0) + YAX_PTRNEXTWALL(twall,i,YAX_CEILING) = ynw; + if ((ynw=yax_getnextwall(i, YAX_FLOOR))>=0) + YAX_PTRNEXTWALL(twall,i,YAX_FLOOR) = ynw; + } +#endif wal->lotag = B_LITTLE16(wal->lotag); wal->hitag = B_LITTLE16(wal->hitag); wal->extra = B_LITTLE16(wal->extra);