mirror of
https://git.do.srb2.org/KartKrew/Kart-Public.git
synced 2025-01-15 22:21:26 +00:00
More optimising and otherwise fixing bizarre formatting in hw_trick.c
This commit is contained in:
parent
2107aab666
commit
1cf2ce63c0
1 changed files with 23 additions and 33 deletions
|
@ -107,17 +107,17 @@ static void releaseLineChains(void)
|
||||||
|
|
||||||
for (i = 0; i < numsectors; i++)
|
for (i = 0; i < numsectors; i++)
|
||||||
{
|
{
|
||||||
sector = §ors[i];
|
sector = §ors[i];
|
||||||
nextElem = sector->sectorLines;
|
nextElem = sector->sectorLines;
|
||||||
|
|
||||||
while (nextElem)
|
while (nextElem)
|
||||||
{
|
{
|
||||||
thisElem = nextElem;
|
thisElem = nextElem;
|
||||||
nextElem = thisElem->next;
|
nextElem = thisElem->next;
|
||||||
free(thisElem);
|
free(thisElem);
|
||||||
}
|
}
|
||||||
|
|
||||||
sector->sectorLines = NULL;
|
sector->sectorLines = NULL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -397,7 +397,7 @@ static void sortStacklist(sector_t *sector)
|
||||||
i = 0;
|
i = 0;
|
||||||
finished = true;
|
finished = true;
|
||||||
|
|
||||||
while (NULL != *(list+i+1))
|
while (*(list+i+1))
|
||||||
{
|
{
|
||||||
sec1 = *(list+i);
|
sec1 = *(list+i);
|
||||||
sec2 = *(list+i+1);
|
sec2 = *(list+i+1);
|
||||||
|
@ -438,7 +438,7 @@ static double calcLineoutLength(sector_t *sector)
|
||||||
double length = 0.0L;
|
double length = 0.0L;
|
||||||
chain = sector->sectorLines;
|
chain = sector->sectorLines;
|
||||||
|
|
||||||
while (NULL != chain) // sum up lengths of all lines
|
while (chain) // sum up lengths of all lines
|
||||||
{
|
{
|
||||||
length += lineLength(chain->line);
|
length += lineLength(chain->line);
|
||||||
chain = chain->next;
|
chain = chain->next;
|
||||||
|
@ -454,7 +454,7 @@ static void calcLineouts(sector_t *sector)
|
||||||
size_t secCount = 0;
|
size_t secCount = 0;
|
||||||
sector_t *encSector = *(sector->stackList);
|
sector_t *encSector = *(sector->stackList);
|
||||||
|
|
||||||
while (NULL != encSector)
|
while (encSector)
|
||||||
{
|
{
|
||||||
if (encSector->lineoutLength < 0.0L) // if length has not yet been calculated
|
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
|
if (frontSector == backSector) // skip damn renderer tricks here
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if (frontSector == NULL || backSector == NULL)
|
if (!frontSector || !backSector)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
sider = &sides[thisElem->line->sidenum[0]];
|
sider = &sides[thisElem->line->sidenum[0]];
|
||||||
|
@ -645,7 +645,7 @@ static boolean isFloorFloating(sector_t *thisSector)
|
||||||
if (!thisSector)
|
if (!thisSector)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
nextElem = thisSector->sectorLines;
|
nextElem = thisSector->sectorLines;
|
||||||
|
|
||||||
while (nextElem) // walk through chain
|
while (nextElem) // walk through chain
|
||||||
{
|
{
|
||||||
|
@ -693,14 +693,12 @@ static fixed_t estimateCeilHeight(sector_t *thisSector)
|
||||||
{
|
{
|
||||||
sector_t *adjSector;
|
sector_t *adjSector;
|
||||||
|
|
||||||
if (!thisSector ||
|
if (!thisSector || !thisSector->sectorLines || !thisSector->sectorLines->line)
|
||||||
!thisSector->sectorLines ||
|
|
||||||
!thisSector->sectorLines->line)
|
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
adjSector = thisSector->sectorLines->line->frontsector;
|
adjSector = thisSector->sectorLines->line->frontsector;
|
||||||
if (adjSector == thisSector)
|
if (adjSector == thisSector)
|
||||||
adjSector = thisSector->sectorLines->line->backsector;
|
adjSector = thisSector->sectorLines->line->backsector;
|
||||||
|
|
||||||
if (!adjSector)
|
if (!adjSector)
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -715,17 +713,15 @@ static fixed_t estimateFloorHeight(sector_t *thisSector)
|
||||||
{
|
{
|
||||||
sector_t *adjSector;
|
sector_t *adjSector;
|
||||||
|
|
||||||
if (!thisSector ||
|
if (!thisSector || !thisSector->sectorLines || !thisSector->sectorLines->line)
|
||||||
!thisSector->sectorLines ||
|
return 0;
|
||||||
!thisSector->sectorLines->line)
|
|
||||||
return 0;
|
|
||||||
|
|
||||||
adjSector = thisSector->sectorLines->line->frontsector;
|
adjSector = thisSector->sectorLines->line->frontsector;
|
||||||
if (adjSector == thisSector)
|
if (adjSector == thisSector)
|
||||||
adjSector = thisSector->sectorLines->line->backsector;
|
adjSector = thisSector->sectorLines->line->backsector;
|
||||||
|
|
||||||
if (NULL == adjSector)
|
if (!adjSector)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
return adjSector->floorheight;
|
return adjSector->floorheight;
|
||||||
}
|
}
|
||||||
|
@ -831,18 +827,12 @@ void HWR_CorrectSWTricks(void)
|
||||||
// correct height of floating sectors
|
// correct height of floating sectors
|
||||||
if (isCeilingFloating(floatSector))
|
if (isCeilingFloating(floatSector))
|
||||||
{
|
{
|
||||||
fixed_t corrheight;
|
floatSector->virtualCeilingheight = estimateCeilHeight(floatSector);
|
||||||
|
|
||||||
corrheight = estimateCeilHeight(floatSector);
|
|
||||||
floatSector->virtualCeilingheight = corrheight;
|
|
||||||
floatSector->virtualCeiling = true;
|
floatSector->virtualCeiling = true;
|
||||||
}
|
}
|
||||||
if (isFloorFloating(floatSector))
|
if (isFloorFloating(floatSector))
|
||||||
{
|
{
|
||||||
fixed_t corrheight;
|
floatSector->virtualFloorheight = estimateFloorHeight(floatSector);
|
||||||
|
|
||||||
corrheight = estimateFloorHeight(floatSector);
|
|
||||||
floatSector->virtualFloorheight = corrheight;
|
|
||||||
floatSector->virtualFloor = true;
|
floatSector->virtualFloor = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue