Removed need to do multiple checks on tile hits
This commit is contained in:
@ -62,13 +62,6 @@ void entityUpdate(entity_t *entity) {
|
||||
fixed248_t selfCircR = halfTileWH;
|
||||
|
||||
// Check for collisions with tiles
|
||||
uint8_t tileChecks = ENTITY_TILE_COLISSION_RESOLUTION_COUNT;
|
||||
do {
|
||||
// loop to resolve tile collisions multiple times to handle sliding
|
||||
// correctly
|
||||
bool tileResolved = false;
|
||||
|
||||
// Compute affected tile range
|
||||
fixed248_t tileStartX = fx248Floor(fx248Divfx248(
|
||||
(newX - halfTileWH), FIXED248(TILE_WIDTH_HEIGHT, 0)
|
||||
));
|
||||
@ -108,12 +101,9 @@ void entityUpdate(entity_t *entity) {
|
||||
);
|
||||
newX -= slideX;
|
||||
newY -= slideY;
|
||||
tileResolved = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
if(!tileResolved) break; // no more overlaps
|
||||
} while(--tileChecks > 0);
|
||||
|
||||
// Check for collisions with other entities
|
||||
entity_t *otherEntity = ENTITIES;
|
||||
|
@ -11,7 +11,6 @@
|
||||
#include "util/fixed.h"
|
||||
|
||||
#define ENTITY_COUNT_MAX 32
|
||||
#define ENTITY_TILE_COLISSION_RESOLUTION_COUNT 4
|
||||
|
||||
typedef enum {
|
||||
ENTITY_DIR_SOUTH = 0,
|
||||
|
Reference in New Issue
Block a user