diff --git a/polymer/eduke32/build/src/build.c b/polymer/eduke32/build/src/build.c index c57426947..e7cb10930 100644 --- a/polymer/eduke32/build/src/build.c +++ b/polymer/eduke32/build/src/build.c @@ -5801,9 +5801,9 @@ check_next_sector: ; sector[numsectors].extra = -1; sector[numsectors].lotag = sector[numsectors].hitag = 0; - sector[numsectors].ceilingstat &= ~2; - sector[numsectors].floorstat &= ~2; - sector[numsectors].ceilingheinum = sector[numsectors].floorheinum = 0; + setslope(numsectors, YAX_CEILING, 0); + setslope(numsectors, YAX_FLOOR, 0); + sector[numsectors].ceilingpal = sector[numsectors].floorpal = 0; #ifdef YAX_ENABLE yax_setbunches(numsectors, -1, -1); diff --git a/polymer/eduke32/samples/a.m32 b/polymer/eduke32/samples/a.m32 index 71ef7d9ea..f45dc9841 100644 --- a/polymer/eduke32/samples/a.m32 +++ b/polymer/eduke32/samples/a.m32 @@ -1195,52 +1195,6 @@ defstate chselshade } ends -defstate correctslopes - "Correct cstat&2/heinum" - for i allsectors - { - set j sector[i].ceilingstat, and j 2 - ife j 2 - { - ife sector[i].ceilingheinum 0 - { - sub sector[i].ceilingstat 2 - qsprintf TQUOTE "sec %d ceilingstat cleared bit 2" i - quote TQUOTE - } - } - else - { - ifn sector[i].ceilingheinum 0 - { - set sector[i].ceilingheinum 0 - qsprintf TQUOTE "sec %d ceilingheinum set to 0" i - quote TQUOTE - } - } - - set j sector[i].floorstat, and j 2 - ife j 2 - { - ife sector[i].floorheinum 0 - { - sub sector[i].floorstat 2 - qsprintf TQUOTE "sec %d floorstat cleared bit 2" i - quote TQUOTE - } - } - else - { - ifn sector[i].floorheinum 0 - { - set sector[i].floorheinum 0 - qsprintf TQUOTE "sec %d floorheinum set to 0" i - quote TQUOTE - } - } - } -ends - ////////// USER AREA ////////// // key settings diff --git a/polymer/eduke32/source/astub.c b/polymer/eduke32/source/astub.c index 5d610a317..3db5381f3 100644 --- a/polymer/eduke32/source/astub.c +++ b/polymer/eduke32/source/astub.c @@ -5337,15 +5337,8 @@ static void Keys3d(void) break; } - if (sector[searchsector].ceilingheinum == 0) - sector[searchsector].ceilingstat &= ~2; - else - sector[searchsector].ceilingstat |= 2; - - if (sector[searchsector].floorheinum == 0) - sector[searchsector].floorstat &= ~2; - else - sector[searchsector].floorstat |= 2; + setslope(searchsector, YAX_CEILING, sector[searchsector].ceilingheinum); + setslope(searchsector, YAX_FLOOR, sector[searchsector].floorheinum); asksave = 1; noclip = i; @@ -6538,7 +6531,8 @@ static void Keys3d(void) (bunchnum < 0 || YAXSLOPECHK(searchsector, othersidesect))) #endif { - int32_t newslope = clamp(AIMED_CEILINGFLOOR(heinum) + tsign*i, -BHEINUM_MAX, BHEINUM_MAX); + int32_t oldslope = (AIMED_CEILINGFLOOR(stat)&2) ? AIMED_CEILINGFLOOR(heinum) : 0; + int32_t newslope = clamp(oldslope + tsign*i, -BHEINUM_MAX, BHEINUM_MAX); setslope(searchsector, AIMING_AT_FLOOR, newslope); #ifdef YAX_ENABLE @@ -6549,17 +6543,7 @@ static void Keys3d(void) typestr[searchstat], AIMED_CEILINGFLOOR(heinum)); } } -/* - if (sector[searchsector].ceilingheinum == 0) - sector[searchsector].ceilingstat &= ~2; - else - sector[searchsector].ceilingstat |= 2; - if (sector[searchsector].floorheinum == 0) - sector[searchsector].floorstat &= ~2; - else - sector[searchsector].floorstat |= 2; -*/ asksave = 1; } @@ -10258,7 +10242,12 @@ int32_t ExtInit(void) while (CommandPaths) { s = CommandPaths->next; - addsearchpath(CommandPaths->str); + i = addsearchpath(CommandPaths->str); + if (i < 0) + { + initprintf("Failed adding %s for game data: %s\n", CommandPaths->str, + i==-1 ? "not a directory" : "no such directory"); + } Bfree(CommandPaths->str); Bfree(CommandPaths); @@ -11443,6 +11432,33 @@ int32_t CheckMapCorruption(int32_t printfromlev, uint64_t tryfixing) if (endwall > numwalls) CORRUPTCHK_PRINT(4, CORRUPT_SECTOR|i, "SECTOR[%d]: wallptr+wallnum=%d out of range: numwalls=%d", i, endwall, numwalls); + // inconsistent cstat&2 and heinum checker + { + int32_t cs, hn; + const char *cflabel[2] = {"ceiling", "floor"}; + + for (j=0; j<2; j++) + { + cs = !!(SECTORFLD(i,stat, j)&2); + hn = (SECTORFLD(i,heinum, j)!=0); + + if (cs != hn) + { + if (numcorruptthings < MAXCORRUPTTHINGS && (tryfixing & (1ull<next; - addsearchpath(CommandPaths->str); + i = addsearchpath(CommandPaths->str); + if (i < 0) + { + initprintf("Failed adding %s for game data: %s\n", CommandPaths->str, + i==-1 ? "not a directory" : "no such directory"); + } Bfree(CommandPaths->str); Bfree(CommandPaths);