Add car/ghost render dist
This commit is contained in:
parent
dedd5505ec
commit
9b31556979
4 changed files with 46 additions and 14 deletions
14
game.h
14
game.h
|
@ -390,7 +390,7 @@ void LCR_gameGetNthGhostSample(unsigned int n,
|
|||
void LCR_gameGhostGetTransform(uint32_t frame,
|
||||
LCR_GameUnit position[3], LCR_GameUnit rotation[3])
|
||||
{
|
||||
unsigned int n = ((frame >> LCR_game.ghost.stretch) / LCR_SETTING_GHOST_STEP);
|
||||
int n = ((frame >> LCR_game.ghost.stretch) / LCR_SETTING_GHOST_STEP);
|
||||
|
||||
LCR_gameGetNthGhostSample(n,position,rotation);
|
||||
|
||||
|
@ -423,14 +423,10 @@ void LCR_gameGhostGetTransform(uint32_t frame,
|
|||
}
|
||||
}
|
||||
|
||||
/* Small hack: at the beginning the ghost can be seen misaligned with the
|
||||
real car due to its quantized position, here we gradually snap it to the
|
||||
nearest 1/8th of a block (which should hit the start position) during the
|
||||
first 16 frames. */
|
||||
if (LCR_racing.tick < 16)
|
||||
for (int i = 0; i < 3; ++i)
|
||||
position[i] = position[i] + (LCR_racing.tick * (position[i] -
|
||||
((position[i] + LCR_GAME_UNIT / 8) / (LCR_GAME_UNIT / 4)))) / 16;
|
||||
// offset (correct rounding down):
|
||||
position[0] += LCR_GAME_UNIT / 16;
|
||||
position[1] += LCR_GAME_UNIT / 16;
|
||||
position[2] += LCR_GAME_UNIT / 16;
|
||||
}
|
||||
|
||||
void _LCR_gamePrepareGhost(void)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue