Ent movement
This commit is contained in:
@@ -43,8 +43,8 @@ void entityUpdate(entity_t *entity) {
|
||||
}
|
||||
|
||||
// Movement code.
|
||||
if(entity->type == ENTITY_TYPE_PLAYER) {
|
||||
playerInput(entity);
|
||||
if(ENTITY_CALLBACKS[entity->type].movement != NULL) {
|
||||
ENTITY_CALLBACKS[entity->type].movement(entity);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -100,14 +100,11 @@ void entityWalk(entity_t *entity, const entitydir_t direction) {
|
||||
entity_t * entityGetAt(const worldpos_t position) {
|
||||
entity_t *ent = ENTITIES;
|
||||
do {
|
||||
if(
|
||||
ent->type != ENTITY_TYPE_NULL &&
|
||||
ent->position.x == position.x &&
|
||||
ent->position.y == position.y &&
|
||||
ent->position.z == position.z
|
||||
) {
|
||||
return ent;
|
||||
}
|
||||
if(ent->type == ENTITY_TYPE_NULL) continue;
|
||||
if(ent->position.x != position.x) continue;
|
||||
if(ent->position.y != position.y) continue;
|
||||
if(ent->position.z != position.z) continue;
|
||||
return ent;
|
||||
} while(++ent, ent < &ENTITIES[ENTITY_COUNT]);
|
||||
|
||||
return NULL;
|
||||
|
||||
Reference in New Issue
Block a user