Removed need to do multiple checks on tile hits

This commit is contained in:
2025-06-20 13:27:04 -05:00
parent 025bc2cff6
commit 44ebf3a66d
2 changed files with 36 additions and 47 deletions

View File

@ -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;

View File

@ -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,