mirror of
https://git.do.srb2.org/STJr/SRB2.git
synced 2024-11-17 10:11:02 +00:00
Moved my added slope checks in hw_trick.c to isCeilingFloating/isFloorFloating
I also optimised those two functions while I was there (why keep a "floating" variable when setting it to false guarantees the functions return false?)
This commit is contained in:
parent
e5bf3dfa67
commit
6a85121b79
1 changed files with 28 additions and 58 deletions
|
@ -507,14 +507,6 @@ static boolean areToptexturesMissing(sector_t *thisSector)
|
||||||
if (!frontSector || !backSector)
|
if (!frontSector || !backSector)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
#ifdef ESLOPE
|
|
||||||
if (frontSector->c_slope || backSector->c_slope) // the slope's height can be completely different from original ceiling height
|
|
||||||
{
|
|
||||||
nomiss++;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
sider = &sides[thisElem->line->sidenum[0]];
|
sider = &sides[thisElem->line->sidenum[0]];
|
||||||
sidel = &sides[thisElem->line->sidenum[1]];
|
sidel = &sides[thisElem->line->sidenum[1]];
|
||||||
|
|
||||||
|
@ -563,14 +555,6 @@ static boolean areBottomtexturesMissing(sector_t *thisSector)
|
||||||
if (frontSector == NULL || backSector == NULL)
|
if (frontSector == NULL || backSector == NULL)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
#ifdef ESLOPE
|
|
||||||
if (frontSector->f_slope || backSector->f_slope) // the slope's height can be completely different from original floor height
|
|
||||||
{
|
|
||||||
nomiss++;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
sider = &sides[thisElem->line->sidenum[0]];
|
sider = &sides[thisElem->line->sidenum[0]];
|
||||||
sidel = &sides[thisElem->line->sidenum[1]];
|
sidel = &sides[thisElem->line->sidenum[1]];
|
||||||
|
|
||||||
|
@ -603,67 +587,6 @@ static boolean areBottomtexturesMissing(sector_t *thisSector)
|
||||||
static boolean isCeilingFloating(sector_t *thisSector)
|
static boolean isCeilingFloating(sector_t *thisSector)
|
||||||
{
|
{
|
||||||
sector_t *adjSector, *refSector = NULL, *frontSector, *backSector;
|
sector_t *adjSector, *refSector = NULL, *frontSector, *backSector;
|
||||||
boolean floating = true;
|
|
||||||
linechain_t *thisElem, *nextElem;
|
|
||||||
|
|
||||||
if (!thisSector)
|
|
||||||
return false;
|
|
||||||
|
|
||||||
nextElem = thisSector->sectorLines;
|
|
||||||
|
|
||||||
while (NULL != nextElem) // walk through chain
|
|
||||||
{
|
|
||||||
thisElem = nextElem;
|
|
||||||
nextElem = thisElem->next;
|
|
||||||
|
|
||||||
frontSector = thisElem->line->frontsector;
|
|
||||||
backSector = thisElem->line->backsector;
|
|
||||||
|
|
||||||
if (frontSector == thisSector)
|
|
||||||
adjSector = backSector;
|
|
||||||
else
|
|
||||||
adjSector = frontSector;
|
|
||||||
|
|
||||||
if (!adjSector) // assume floating sectors have surrounding sectors
|
|
||||||
{
|
|
||||||
floating = false;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!refSector)
|
|
||||||
{
|
|
||||||
refSector = adjSector;
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
// if adjacent sector has same height or more than one adjacent sector exists -> stop
|
|
||||||
if (thisSector->ceilingheight == adjSector->ceilingheight ||
|
|
||||||
refSector != adjSector)
|
|
||||||
{
|
|
||||||
floating = false;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// now check for walltextures
|
|
||||||
if (floating)
|
|
||||||
{
|
|
||||||
if (!areToptexturesMissing(thisSector))
|
|
||||||
{
|
|
||||||
floating = false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return floating;
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
|
||||||
// check if no adjacent sector has same ceiling height
|
|
||||||
// FIXME: throw that together with isCeilingFloating??
|
|
||||||
//
|
|
||||||
static boolean isFloorFloating(sector_t *thisSector)
|
|
||||||
{
|
|
||||||
sector_t *adjSector, *refSector = NULL, *frontSector, *backSector;
|
|
||||||
boolean floating = true;
|
|
||||||
linechain_t *thisElem, *nextElem;
|
linechain_t *thisElem, *nextElem;
|
||||||
|
|
||||||
if (!thisSector)
|
if (!thisSector)
|
||||||
|
@ -684,36 +607,83 @@ static boolean isFloorFloating(sector_t *thisSector)
|
||||||
else
|
else
|
||||||
adjSector = frontSector;
|
adjSector = frontSector;
|
||||||
|
|
||||||
if (NULL == adjSector) // assume floating sectors have surrounding sectors
|
if (!adjSector) // assume floating sectors have surrounding sectors
|
||||||
{
|
return false;
|
||||||
floating = false;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (NULL == refSector)
|
#ifdef ESLOPE
|
||||||
|
if (adjSector->c_slope) // Don't bother with slopes
|
||||||
|
return false;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
if (!refSector)
|
||||||
{
|
{
|
||||||
refSector = adjSector;
|
refSector = adjSector;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
// if adjacent sector has same height or more than one adjacent sector exists -> stop
|
// if adjacent sector has same height or more than one adjacent sector exists -> stop
|
||||||
if (thisSector->floorheight == adjSector->floorheight ||
|
if (thisSector->ceilingheight == adjSector->ceilingheight || refSector != adjSector)
|
||||||
refSector != adjSector)
|
return false;
|
||||||
{
|
|
||||||
floating = false;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// now check for walltextures
|
// now check for walltextures
|
||||||
if (floating)
|
if (!areToptexturesMissing(thisSector))
|
||||||
|
return false;
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// check if no adjacent sector has same ceiling height
|
||||||
|
// FIXME: throw that together with isCeilingFloating??
|
||||||
|
//
|
||||||
|
static boolean isFloorFloating(sector_t *thisSector)
|
||||||
|
{
|
||||||
|
sector_t *adjSector, *refSector = NULL, *frontSector, *backSector;
|
||||||
|
linechain_t *thisElem, *nextElem;
|
||||||
|
|
||||||
|
if (!thisSector)
|
||||||
|
return false;
|
||||||
|
|
||||||
|
nextElem = thisSector->sectorLines;
|
||||||
|
|
||||||
|
while (nextElem) // walk through chain
|
||||||
{
|
{
|
||||||
|
thisElem = nextElem;
|
||||||
|
nextElem = thisElem->next;
|
||||||
|
|
||||||
|
frontSector = thisElem->line->frontsector;
|
||||||
|
backSector = thisElem->line->backsector;
|
||||||
|
|
||||||
|
if (frontSector == thisSector)
|
||||||
|
adjSector = backSector;
|
||||||
|
else
|
||||||
|
adjSector = frontSector;
|
||||||
|
|
||||||
|
if (!adjSector) // assume floating sectors have surrounding sectors
|
||||||
|
return false;
|
||||||
|
|
||||||
|
#ifdef ESLOPE
|
||||||
|
if (adjSector->f_slope) // Don't bother with slopes
|
||||||
|
return false;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
if (!refSector)
|
||||||
|
{
|
||||||
|
refSector = adjSector;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
// if adjacent sector has same height or more than one adjacent sector exists -> stop
|
||||||
|
if (thisSector->floorheight == adjSector->floorheight || refSector != adjSector)
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
// now check for walltextures
|
||||||
if (!areBottomtexturesMissing(thisSector))
|
if (!areBottomtexturesMissing(thisSector))
|
||||||
{
|
return false;
|
||||||
floating = false;
|
|
||||||
}
|
return true;
|
||||||
}
|
|
||||||
return floating;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
|
|
Loading…
Reference in a new issue