diff --git a/src/rpg/entity/entity.c b/src/rpg/entity/entity.c index a7a8cab..44d6339 100644 --- a/src/rpg/entity/entity.c +++ b/src/rpg/entity/entity.c @@ -86,21 +86,21 @@ void entityWalk(entity_t *entity, const entitydir_t direction) { // TODO: Map bounds in way? // Entity in way? - // entity_t *start = GAME.overworld.map.entities; - // entity_t *end = start + MAP_ENTITY_COUNT; - // while(start < end) { - // if( - // start == entity || - // entity->type == ENTITY_TYPE_NULL || - // start->position.x != newX || - // start->position.y != newY - // ) { - // start++; - // continue; - // } + entity_t *start = ENTITIES; + do { + if( + start == entity || + entity->type == ENTITY_TYPE_NULL || + start->position.x != newX || + start->position.y != newY || + start->position.z != entity->position.z + ) { + start++; + continue; + } - // return;// Blocked - // } + return;// Blocked + } while(start < &ENTITIES[ENTITY_COUNT]); // Move. entity->position.x = newX; diff --git a/src/rpg/entity/entityanim.h b/src/rpg/entity/entityanim.h index 1d8dd61..58bb47d 100644 --- a/src/rpg/entity/entityanim.h +++ b/src/rpg/entity/entityanim.h @@ -8,7 +8,7 @@ #pragma once #include "dusk.h" -#define ENTITY_ANIM_TURN_DURATION 1 +#define ENTITY_ANIM_TURN_DURATION 6 #define ENTITY_ANIM_WALK_DURATION 10 typedef enum { diff --git a/src/rpg/entity/player.c b/src/rpg/entity/player.c index 6412d57..0b76552 100644 --- a/src/rpg/entity/player.c +++ b/src/rpg/entity/player.c @@ -36,7 +36,7 @@ void playerMovement(entity_t *entity) { // Turn const playerinputdirmap_t *dirMap = PLAYER_INPUT_DIR_MAP; do { - if(!inputPressed(dirMap->action)) continue; + if(!inputIsDown(dirMap->action)) continue; if(entity->direction == dirMap->direction) continue; return entityTurn(entity, dirMap->direction); } while((++dirMap)->action != 0xFF); @@ -48,8 +48,6 @@ void playerMovement(entity_t *entity) { if(entity->direction != dirMap->direction) continue; return entityWalk(entity, dirMap->direction); } while((++dirMap)->action != 0xFF); - - // Interaction } void playerInteraction(entity_t *entity) {