Ent movement fixed.

This commit is contained in:
2025-11-03 21:35:21 -06:00
parent d4a2e059d7
commit be79356f42
3 changed files with 16 additions and 18 deletions

View File

@@ -86,21 +86,21 @@ void entityWalk(entity_t *entity, const entitydir_t direction) {
// TODO: Map bounds in way? // TODO: Map bounds in way?
// Entity in way? // Entity in way?
// entity_t *start = GAME.overworld.map.entities; entity_t *start = ENTITIES;
// entity_t *end = start + MAP_ENTITY_COUNT; do {
// while(start < end) { if(
// if( start == entity ||
// start == entity || entity->type == ENTITY_TYPE_NULL ||
// entity->type == ENTITY_TYPE_NULL || start->position.x != newX ||
// start->position.x != newX || start->position.y != newY ||
// start->position.y != newY start->position.z != entity->position.z
// ) { ) {
// start++; start++;
// continue; continue;
// } }
// return;// Blocked return;// Blocked
// } } while(start < &ENTITIES[ENTITY_COUNT]);
// Move. // Move.
entity->position.x = newX; entity->position.x = newX;

View File

@@ -8,7 +8,7 @@
#pragma once #pragma once
#include "dusk.h" #include "dusk.h"
#define ENTITY_ANIM_TURN_DURATION 1 #define ENTITY_ANIM_TURN_DURATION 6
#define ENTITY_ANIM_WALK_DURATION 10 #define ENTITY_ANIM_WALK_DURATION 10
typedef enum { typedef enum {

View File

@@ -36,7 +36,7 @@ void playerMovement(entity_t *entity) {
// Turn // Turn
const playerinputdirmap_t *dirMap = PLAYER_INPUT_DIR_MAP; const playerinputdirmap_t *dirMap = PLAYER_INPUT_DIR_MAP;
do { do {
if(!inputPressed(dirMap->action)) continue; if(!inputIsDown(dirMap->action)) continue;
if(entity->direction == dirMap->direction) continue; if(entity->direction == dirMap->direction) continue;
return entityTurn(entity, dirMap->direction); return entityTurn(entity, dirMap->direction);
} while((++dirMap)->action != 0xFF); } while((++dirMap)->action != 0xFF);
@@ -48,8 +48,6 @@ void playerMovement(entity_t *entity) {
if(entity->direction != dirMap->direction) continue; if(entity->direction != dirMap->direction) continue;
return entityWalk(entity, dirMap->direction); return entityWalk(entity, dirMap->direction);
} while((++dirMap)->action != 0xFF); } while((++dirMap)->action != 0xFF);
// Interaction
} }
void playerInteraction(entity_t *entity) { void playerInteraction(entity_t *entity) {