Collision and sensor fixes

This commit is contained in:
Lucas S. Vieira 2024-12-04 00:04:24 -03:00 committed by Lucas Vieira
parent 2c178e26b0
commit 0967ece5bd
3 changed files with 6 additions and 6 deletions

View file

@ -34,11 +34,11 @@
#define X_HURT_FORCE 0x02000
// Constants for adjusting hitbox and sensors
#define WIDTH_RADIUS_NORMAL 8
#define WIDTH_RADIUS_NORMAL 9
#define HEIGHT_RADIUS_NORMAL 19
#define WIDTH_RADIUS_ROLLING 7
#define HEIGHT_RADIUS_ROLLING 14
#define PUSH_RADIUS 14
#define PUSH_RADIUS 10
#define PLAYER_HURT_IFRAMES 120

View file

@ -183,7 +183,7 @@ linecast(LevelData *lvl, TileMap128 *map128, TileMap16 *map16,
if((piece > 0) &&
(piece_props != MAP128_PROP_NONE) &&
!(piece_props & MAP128_PROP_FRONT) &&
!((direction != CDIR_FLOOR) && (piece_props & MAP128_PROP_ONEWAY))) {
!((direction != floor_direction) && (piece_props & MAP128_PROP_ONEWAY))) {
uint8_t hpos;
uint8_t h;
int32_t angle;

View file

@ -227,14 +227,14 @@ _player_update_collision_lr(Player *player)
/* Collider linecasts */
uint16_t
anchorx = (player->pos.vx >> 12),
anchory = (player->pos.vy >> 12);
anchory = (player->pos.vy >> 12) - 8;
// Adjust y anchor to y + 8 when on totally flat ground
int32_t push_anchory = anchory
- ((player->grnd && player->angle == 0) ? 8 : 0) - 8;
+ ((player->grnd && player->angle == 0) ? 8 : 0);
uint16_t left_mag = PUSH_RADIUS;
uint16_t right_mag = PUSH_RADIUS - 1;
uint16_t right_mag = PUSH_RADIUS;
// Adjust modes
LinecastDirection ldir = CDIR_LWALL;