More optimising and otherwise fixing bizarre formatting in hw_trick.c

This commit is contained in:
Monster Iestyn 2017-06-26 11:12:26 +01:00
parent 2107aab666
commit 1cf2ce63c0
1 changed files with 23 additions and 33 deletions

View File

@ -397,7 +397,7 @@ static void sortStacklist(sector_t *sector)
i = 0;
finished = true;
while (NULL != *(list+i+1))
while (*(list+i+1))
{
sec1 = *(list+i);
sec2 = *(list+i+1);
@ -438,7 +438,7 @@ static double calcLineoutLength(sector_t *sector)
double length = 0.0L;
chain = sector->sectorLines;
while (NULL != chain) // sum up lengths of all lines
while (chain) // sum up lengths of all lines
{
length += lineLength(chain->line);
chain = chain->next;
@ -454,7 +454,7 @@ static void calcLineouts(sector_t *sector)
size_t secCount = 0;
sector_t *encSector = *(sector->stackList);
while (NULL != encSector)
while (encSector)
{
if (encSector->lineoutLength < 0.0L) // if length has not yet been calculated
{
@ -552,7 +552,7 @@ static boolean areBottomtexturesMissing(sector_t *thisSector)
if (frontSector == backSector) // skip damn renderer tricks here
continue;
if (frontSector == NULL || backSector == NULL)
if (!frontSector || !backSector)
continue;
sider = &sides[thisElem->line->sidenum[0]];
@ -693,9 +693,7 @@ static fixed_t estimateCeilHeight(sector_t *thisSector)
{
sector_t *adjSector;
if (!thisSector ||
!thisSector->sectorLines ||
!thisSector->sectorLines->line)
if (!thisSector || !thisSector->sectorLines || !thisSector->sectorLines->line)
return 0;
adjSector = thisSector->sectorLines->line->frontsector;
@ -715,16 +713,14 @@ static fixed_t estimateFloorHeight(sector_t *thisSector)
{
sector_t *adjSector;
if (!thisSector ||
!thisSector->sectorLines ||
!thisSector->sectorLines->line)
if (!thisSector || !thisSector->sectorLines || !thisSector->sectorLines->line)
return 0;
adjSector = thisSector->sectorLines->line->frontsector;
if (adjSector == thisSector)
adjSector = thisSector->sectorLines->line->backsector;
if (NULL == adjSector)
if (!adjSector)
return 0;
return adjSector->floorheight;
@ -831,18 +827,12 @@ void HWR_CorrectSWTricks(void)
// correct height of floating sectors
if (isCeilingFloating(floatSector))
{
fixed_t corrheight;
corrheight = estimateCeilHeight(floatSector);
floatSector->virtualCeilingheight = corrheight;
floatSector->virtualCeilingheight = estimateCeilHeight(floatSector);
floatSector->virtualCeiling = true;
}
if (isFloorFloating(floatSector))
{
fixed_t corrheight;
corrheight = estimateFloorHeight(floatSector);
floatSector->virtualFloorheight = corrheight;
floatSector->virtualFloorheight = estimateFloorHeight(floatSector);
floatSector->virtualFloor = true;
}
}