Prepping map stuff

This commit is contained in:
2025-11-11 12:25:46 -06:00
parent 26bfb912f1
commit 5adf8a0773
16 changed files with 249 additions and 175 deletions

View File

@@ -81,9 +81,11 @@ void entityWalk(entity_t *entity, const entitydir_t direction) {
// Check one level down for walkable tile (stairs down)
worldpos_t belowPos = newPos;
belowPos.z -= 1;
tile = mapGetTile(belowPos);
if(tile != TILE_NULL) newPos.z -= 1;
tile_t belowTile = mapGetTile(belowPos);
if(belowTile == TILE_STAIRS_UP) {
tile = TILE_STAIRS_DOWN;// Mark current as stairs down
}
}
// Tile walkable?
@@ -98,11 +100,19 @@ void entityWalk(entity_t *entity, const entitydir_t direction) {
return;// Blocked
} while(++other, other < &ENTITIES[ENTITY_COUNT]);
entity->lastPosition = entity->position;
entity->position = newPos;
entity->animation = ENTITY_ANIM_WALK;
entity->animTime = ENTITY_ANIM_WALK_DURATION;// TODO: Running vs walking
// We are comitting, we can run effects here.
if(tile == TILE_STAIRS_DOWN) {
// Moving down a level
entity->position.z -= 1;
} else if(tile == TILE_STAIRS_UP) {
// Moving up a level
entity->position.z += 1;
}
}
entity_t * entityGetAt(const worldpos_t position) {