Use Chebyshew instead Euclid
This commit is contained in:
parent
73c340a9b6
commit
5fe7c1a926
1 changed files with 6 additions and 1 deletions
|
@ -7,6 +7,7 @@
|
|||
license: CC0 1.0
|
||||
*/
|
||||
|
||||
// redefine player's height
|
||||
#define CAMERA_COLL_HEIGHT_BELOW ((3 * UNITS_PER_SQUARE) / 2)
|
||||
|
||||
#include "general.hpp"
|
||||
|
@ -665,7 +666,11 @@ void draw()
|
|||
|
||||
for (uint8_t i = 0; i < SPRITES; ++i)
|
||||
{
|
||||
if (dist(sprites[i].mPosition,player.mCamera.position) > SPRITE_MAX_DISTANCE)
|
||||
// use Chebyshew distance instead Euclidean, it's faster
|
||||
if (absVal(sprites[i].mPosition.x - player.mCamera.position.x) > SPRITE_MAX_DISTANCE)
|
||||
continue;
|
||||
|
||||
if (absVal(sprites[i].mPosition.y - player.mCamera.position.y) > SPRITE_MAX_DISTANCE)
|
||||
continue;
|
||||
|
||||
PixelInfo pos = mapToScreen(sprites[i].mPosition,sprites[i].mHeight,player.mCamera);
|
||||
|
|
Loading…
Reference in a new issue