forked from speed-dreams/speed-dreams-code
revert r7024 and fix the real problem
git-svn-id: https://svn.code.sf.net/p/speed-dreams/code/trunk@7030 30fe4595-0a0c-4342-8851-515496e4dcbd Former-commit-id: c6780824370621040fa9e104a355bf9854326fc8 Former-commit-id: 03811562590685357dc96072c3383f8bb5f51d79
This commit is contained in:
parent
55ba28ea3d
commit
fccb3f00f1
5 changed files with 15 additions and 32 deletions
|
@ -190,6 +190,7 @@ typedef struct
|
||||||
tdble distRaced;
|
tdble distRaced;
|
||||||
tdble distFromStartLine;
|
tdble distFromStartLine;
|
||||||
int currentSector;
|
int currentSector;
|
||||||
|
int nbSectors;
|
||||||
double scheduledEventTime;
|
double scheduledEventTime;
|
||||||
tTrackOwnPit *pit;
|
tTrackOwnPit *pit;
|
||||||
int event;
|
int event;
|
||||||
|
@ -221,6 +222,7 @@ typedef struct
|
||||||
#define _distRaced race.distRaced
|
#define _distRaced race.distRaced
|
||||||
#define _distFromStartLine race.distFromStartLine
|
#define _distFromStartLine race.distFromStartLine
|
||||||
#define _currentSector race.currentSector
|
#define _currentSector race.currentSector
|
||||||
|
#define _nbSectors race.nbSectors
|
||||||
#define _pit race.pit
|
#define _pit race.pit
|
||||||
#define _scheduledEventTime race.scheduledEventTime
|
#define _scheduledEventTime race.scheduledEventTime
|
||||||
#define _event race.event
|
#define _event race.event
|
||||||
|
|
|
@ -676,10 +676,6 @@ SDHUD::SDHUD()
|
||||||
this->timeDiffFreezeCountdown = 8.0f; //keep display for x seconds
|
this->timeDiffFreezeCountdown = 8.0f; //keep display for x seconds
|
||||||
this->timeDiffFreezeTime = 0.0f;
|
this->timeDiffFreezeTime = 0.0f;
|
||||||
this->oldSector = 0;
|
this->oldSector = 0;
|
||||||
this->oldBestLapTime = 0.0f;
|
|
||||||
this->oldBestSplitTime = 0.0f;
|
|
||||||
this->oldLapTime = 0.0f;
|
|
||||||
this->numberOfSectors = 0;
|
|
||||||
this->oldLapNumber = 0;
|
this->oldLapNumber = 0;
|
||||||
|
|
||||||
this->hudScale = 1.0f;
|
this->hudScale = 1.0f;
|
||||||
|
@ -914,17 +910,6 @@ void SDHUD::Refresh(tSituation *s, const SDFrameInfo* frameInfo,
|
||||||
|
|
||||||
//laptime
|
//laptime
|
||||||
|
|
||||||
//float currentPrevSectorSplitTime = currCar->_curSplitTime[currCar->_currentSector - 1]; // our time in the sector we have "just" run over
|
|
||||||
//float bestPrevSectorSplitTime = currCar->_bestSplitTime[currCar->_currentSector-1]; // the best split time of the sector we are in this moment
|
|
||||||
float bestSplitTime = currCar->_bestSplitTime[currCar->_currentSector]; // the best split time of the sector we are in this moment
|
|
||||||
// float splitTimeDiff = 0;
|
|
||||||
|
|
||||||
//in the first lap we count how many sector this track have
|
|
||||||
//ReInfo->track->numberOfSectors is a better source for this but we have no access to it in this file
|
|
||||||
if( this->numberOfSectors < currCar->_currentSector+1){
|
|
||||||
this->numberOfSectors = currCar->_currentSector+1;
|
|
||||||
}
|
|
||||||
|
|
||||||
if( this->oldSector != currCar->_currentSector)
|
if( this->oldSector != currCar->_currentSector)
|
||||||
{
|
{
|
||||||
this->laptimeFreezeTime = GfTimeClock();
|
this->laptimeFreezeTime = GfTimeClock();
|
||||||
|
@ -984,8 +969,6 @@ void SDHUD::Refresh(tSituation *s, const SDFrameInfo* frameInfo,
|
||||||
temp << "S" << (this->oldSector+1);
|
temp << "S" << (this->oldSector+1);
|
||||||
hudTextElements["laptime-sector-description"]->setText(temp.str());
|
hudTextElements["laptime-sector-description"]->setText(temp.str());
|
||||||
|
|
||||||
hudTextElements["laptime-last-time"]->setText(formatLaptime(currCar->_curLapTime,0));
|
|
||||||
|
|
||||||
this->hudImgElements["laptime-last-background-normal"]->setNodeMask(NODE_MASK_ALL);
|
this->hudImgElements["laptime-last-background-normal"]->setNodeMask(NODE_MASK_ALL);
|
||||||
this->hudImgElements["laptime-last-background-grey"]->setNodeMask(NODE_MASK_NONE);
|
this->hudImgElements["laptime-last-background-grey"]->setNodeMask(NODE_MASK_NONE);
|
||||||
this->hudImgElements["laptime-last-background-violet"]->setNodeMask(NODE_MASK_NONE);
|
this->hudImgElements["laptime-last-background-violet"]->setNodeMask(NODE_MASK_NONE);
|
||||||
|
@ -993,16 +976,16 @@ void SDHUD::Refresh(tSituation *s, const SDFrameInfo* frameInfo,
|
||||||
this->hudImgElements["laptime-last-background-red"]->setNodeMask(NODE_MASK_NONE);
|
this->hudImgElements["laptime-last-background-red"]->setNodeMask(NODE_MASK_NONE);
|
||||||
|
|
||||||
//show laptime
|
//show laptime
|
||||||
hudTextElements["laptime-best-time"]->setText(formatLaptime(bestSplitTime,0));
|
|
||||||
hudTextElements["laptime-last-time"]->setText(formatLaptime(currCar->_curLapTime,0));
|
hudTextElements["laptime-last-time"]->setText(formatLaptime(currCar->_curLapTime,0));
|
||||||
this->oldBestSplitTime = bestSplitTime;
|
|
||||||
this->oldBestLapTime = currCar->_bestLapTime;
|
|
||||||
this->oldLapTime = currCar->_curLapTime;
|
|
||||||
|
|
||||||
//on the last sector show the total lap time
|
//on the last sector show the total lap time
|
||||||
if(currCar->_currentSector == this->numberOfSectors-1){
|
if(currCar->_currentSector == currCar->_nbSectors-1){
|
||||||
hudTextElements["laptime-best-time"]->setText(formatLaptime(currCar->_bestLapTime,0));
|
hudTextElements["laptime-best-time"]->setText(formatLaptime(currCar->_bestLapTime,0));
|
||||||
}
|
}
|
||||||
|
else {
|
||||||
|
tdble bestSplitTime = currCar->_bestSplitTime[currCar->_currentSector]; // the best split time of the sector we are in this moment
|
||||||
|
hudTextElements["laptime-best-time"]->setText(formatLaptime(bestSplitTime,0));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -117,10 +117,6 @@ class SDHUD
|
||||||
float timeDiffFreezeCountdown;//keep display for x seconds
|
float timeDiffFreezeCountdown;//keep display for x seconds
|
||||||
float timeDiffFreezeTime;
|
float timeDiffFreezeTime;
|
||||||
int oldSector;
|
int oldSector;
|
||||||
float oldBestLapTime;
|
|
||||||
float oldBestSplitTime;
|
|
||||||
float oldLapTime;
|
|
||||||
int numberOfSectors;
|
|
||||||
int oldLapNumber;
|
int oldLapNumber;
|
||||||
|
|
||||||
float hudScale;
|
float hudScale;
|
||||||
|
|
|
@ -743,9 +743,10 @@ static tCarElt* reLoadSingleCar( int carindex, int listindex, int modindex, int
|
||||||
|
|
||||||
/* Initialize sectors */
|
/* Initialize sectors */
|
||||||
elt->_currentSector = 0;
|
elt->_currentSector = 0;
|
||||||
elt->_curSplitTime = (double*)malloc( sizeof(double) * ( ReInfo->track->numberOfSectors - 1 ) );
|
elt->_nbSectors = ReInfo->track->numberOfSectors;
|
||||||
elt->_bestSplitTime = (double*)malloc( sizeof(double) * ( ReInfo->track->numberOfSectors - 1 ) );
|
elt->_curSplitTime = (double*)malloc( sizeof(double) * ( elt->_nbSectors - 1 ) );
|
||||||
for (xx = 0; xx < ReInfo->track->numberOfSectors - 1; ++xx)
|
elt->_bestSplitTime = (double*)malloc( sizeof(double) * ( elt->_nbSectors - 1 ) );
|
||||||
|
for (xx = 0; xx < elt->_nbSectors - 1; ++xx)
|
||||||
{
|
{
|
||||||
elt->_curSplitTime[xx] = -1.0f;
|
elt->_curSplitTime[xx] = -1.0f;
|
||||||
elt->_bestSplitTime[xx] = -1.0f;
|
elt->_bestSplitTime[xx] = -1.0f;
|
||||||
|
|
|
@ -724,8 +724,9 @@ tRmInfo* ReSituationUpdater::initSituation(const tRmInfo* pSource)
|
||||||
tCarElt* pTgtCar = &pTarget->carList[nCarInd];
|
tCarElt* pTgtCar = &pTarget->carList[nCarInd];
|
||||||
tCarElt* pSrcCar = &pSource->carList[nCarInd];
|
tCarElt* pSrcCar = &pSource->carList[nCarInd];
|
||||||
|
|
||||||
pTgtCar->_curSplitTime = (double*)malloc(sizeof(double) * (pSource->track->numberOfSectors));
|
pTgtCar->_nbSectors = pSource->track->numberOfSectors;
|
||||||
pTgtCar->_bestSplitTime = (double*)malloc(sizeof(double) * (pSource->track->numberOfSectors));
|
pTgtCar->_curSplitTime = (double*)malloc(sizeof(double) * (pTgtCar->_nbSectors - 1));
|
||||||
|
pTgtCar->_bestSplitTime = (double*)malloc(sizeof(double) * (pTgtCar->_nbSectors - 1));
|
||||||
|
|
||||||
GF_TAILQ_INIT(&(pTgtCar->_penaltyList)); // Not used by the graphics engine.
|
GF_TAILQ_INIT(&(pTgtCar->_penaltyList)); // Not used by the graphics engine.
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue