Fix CP bug
This commit is contained in:
parent
7fb04804e7
commit
4cc592b0f5
4 changed files with 36 additions and 36 deletions
66
racing.h
66
racing.h
|
@ -1043,39 +1043,6 @@ uint32_t LCR_racingStep(unsigned int input)
|
|||
LCR_racing.fanForce = 0;
|
||||
}
|
||||
|
||||
int carBlock[3];
|
||||
|
||||
LCR_racingGetCarBlockCoords(carBlock);
|
||||
|
||||
carBlock[0] = LCR_mapGetBlockAt(carBlock[0],carBlock[1],carBlock[2]);
|
||||
|
||||
if (carBlock[0] >= 0)
|
||||
{
|
||||
if (LCR_currentMap.blocks[carBlock[0] * LCR_BLOCK_SIZE] ==
|
||||
LCR_BLOCK_CHECKPOINT_0)
|
||||
{
|
||||
LCR_currentMap.blocks[carBlock[0] * LCR_BLOCK_SIZE] =
|
||||
LCR_BLOCK_CHECKPOINT_1;
|
||||
|
||||
result |= LCR_RACING_EVENT_CP_TAKEN;
|
||||
}
|
||||
else if (LCR_currentMap.blocks[carBlock[0] * LCR_BLOCK_SIZE] ==
|
||||
LCR_BLOCK_FINISH)
|
||||
{
|
||||
int valid = 1;
|
||||
|
||||
for (int i = 0; i < LCR_currentMap.blockCount; ++i)
|
||||
if (LCR_currentMap.blocks[i * LCR_BLOCK_SIZE] == LCR_BLOCK_CHECKPOINT_0)
|
||||
{
|
||||
valid = 0;
|
||||
break;
|
||||
}
|
||||
|
||||
if (valid)
|
||||
result |= LCR_RACING_EVENT_FINISHED;
|
||||
}
|
||||
}
|
||||
|
||||
LCR_LOG2("gonna step physics engine");
|
||||
TPE_worldStep(&(LCR_racing.physicsWorld));
|
||||
LCR_LOG2("stepping physics engine done");
|
||||
|
@ -1202,6 +1169,39 @@ uint32_t LCR_racingStep(unsigned int input)
|
|||
LCR_racing.carOKPositions[i] = LCR_racing.carBody.joints[i].position;
|
||||
}
|
||||
|
||||
int carBlock[3];
|
||||
|
||||
LCR_racingGetCarBlockCoords(carBlock);
|
||||
|
||||
carBlock[0] = LCR_mapGetBlockAt(carBlock[0],carBlock[1],carBlock[2]);
|
||||
|
||||
if (carBlock[0] >= 0)
|
||||
{
|
||||
if (LCR_currentMap.blocks[carBlock[0] * LCR_BLOCK_SIZE] ==
|
||||
LCR_BLOCK_CHECKPOINT_0)
|
||||
{
|
||||
LCR_currentMap.blocks[carBlock[0] * LCR_BLOCK_SIZE] =
|
||||
LCR_BLOCK_CHECKPOINT_1;
|
||||
|
||||
result |= LCR_RACING_EVENT_CP_TAKEN;
|
||||
}
|
||||
else if (LCR_currentMap.blocks[carBlock[0] * LCR_BLOCK_SIZE] ==
|
||||
LCR_BLOCK_FINISH)
|
||||
{
|
||||
int valid = 1;
|
||||
|
||||
for (int i = 0; i < LCR_currentMap.blockCount; ++i)
|
||||
if (LCR_currentMap.blocks[i * LCR_BLOCK_SIZE] == LCR_BLOCK_CHECKPOINT_0)
|
||||
{
|
||||
valid = 0;
|
||||
break;
|
||||
}
|
||||
|
||||
if (valid)
|
||||
result |= LCR_RACING_EVENT_FINISHED;
|
||||
}
|
||||
}
|
||||
|
||||
LCR_racing.tick++;
|
||||
|
||||
LCR_LOG2("racing step end");
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue