Editor partially started.
All checks were successful
Build Dusk / build-linux (push) Successful in 44s
Build Dusk / build-psp (push) Successful in 55s

This commit is contained in:
2025-11-19 13:00:35 -06:00
parent 1668c4b0d2
commit 903dab49e3
13 changed files with 115 additions and 88 deletions

View File

@@ -81,30 +81,30 @@ void entityWalk(entity_t *entity, const entitydir_t direction) {
bool_t fall = false;
bool_t raise = false;
// Are we walking up stairs?
// Are we walking up a ramp?
if(
tileIsStairs(tileCurrent) &&
(direction+TILE_STAIRS_SOUTH) == tileCurrent &&
tileIsRamp(tileCurrent) &&
(direction+TILE_SHAPE_RAMP_SOUTH) == tileCurrent &&
newPos.z < (MAP_CHUNK_DEPTH - 1)
) {
tileNew = TILE_NULL;// Force check for stairs above.
tileNew = TILE_SHAPE_NULL;// Force check for ramp above.
worldpos_t abovePos = newPos;
abovePos.z += 1;
tile_t tileAbove = mapGetTile(abovePos);
if(tileAbove != TILE_NULL && tileIsWalkable(tileAbove)) {
// We can go up the stairs.
if(tileAbove != TILE_SHAPE_NULL && tileIsWalkable(tileAbove)) {
// We can go up the ramp.
raise = true;
}
} else if(tileNew == TILE_NULL && newPos.z > 0) {
} else if(tileNew == TILE_SHAPE_NULL && newPos.z > 0) {
// Falling down?
worldpos_t belowPos = newPos;
belowPos.z -= 1;
tile_t tileBelow = mapGetTile(belowPos);
if(
tileBelow != TILE_NULL &&
tileIsStairs(tileBelow) &&
(entityDirGetOpposite(direction)+TILE_STAIRS_SOUTH) == tileBelow
tileBelow != TILE_SHAPE_NULL &&
tileIsRamp(tileBelow) &&
(entityDirGetOpposite(direction)+TILE_SHAPE_RAMP_SOUTH) == tileBelow
) {
// We will fall to this tile.
fall = true;

View File

@@ -179,7 +179,7 @@ tile_t mapGetTile(const worldpos_t position) {
chunkpos_t chunkPos;
worldPosToChunkPos(&position, &chunkPos);
chunkindex_t chunkIndex = mapGetChunkIndexAt(chunkPos);
if(chunkIndex == -1) return TILE_NULL;
if(chunkIndex == -1) return TILE_SHAPE_NULL;
chunk_t *chunk = mapGetChunk(chunkIndex);
assertNotNull(chunk, "Chunk pointer cannot be NULL");

View File

@@ -9,11 +9,11 @@
bool_t tileIsWalkable(const tile_t tile) {
switch(tile) {
case TILE_WALKABLE:
case TILE_STAIRS_NORTH:
case TILE_STAIRS_SOUTH:
case TILE_STAIRS_EAST:
case TILE_STAIRS_WEST:
case TILE_SHAPE_FLOOR:
case TILE_SHAPE_RAMP_NORTH:
case TILE_SHAPE_RAMP_SOUTH:
case TILE_SHAPE_RAMP_EAST:
case TILE_SHAPE_RAMP_WEST:
return true;
default:
@@ -21,12 +21,12 @@ bool_t tileIsWalkable(const tile_t tile) {
}
}
bool_t tileIsStairs(const tile_t tile) {
bool_t tileIsRamp(const tile_t tile) {
switch(tile) {
case TILE_STAIRS_NORTH:
case TILE_STAIRS_SOUTH:
case TILE_STAIRS_EAST:
case TILE_STAIRS_WEST:
case TILE_SHAPE_RAMP_NORTH:
case TILE_SHAPE_RAMP_SOUTH:
case TILE_SHAPE_RAMP_EAST:
case TILE_SHAPE_RAMP_WEST:
return true;
default:

View File

@@ -10,15 +10,6 @@
typedef uint8_t tile_t;
#define TILE_NULL 0
#define TILE_WALKABLE 1
#define TILE_STAIRS_SOUTH (2 + ENTITY_DIR_SOUTH)
#define TILE_STAIRS_EAST (2 + ENTITY_DIR_EAST)
#define TILE_STAIRS_WEST (2 + ENTITY_DIR_WEST)
#define TILE_STAIRS_NORTH (2 + ENTITY_DIR_NORTH)
#define TILE_TEST 6
/**
* Returns whether or not the given tile is walkable.
*
@@ -28,9 +19,9 @@ typedef uint8_t tile_t;
bool_t tileIsWalkable(const tile_t tile);
/**
* Returns whether or not the given tile is a stairs tile.
* Returns whether or not the given tile is a ramp tile.
*
* @param tile The tile to check.
* @return bool_t True if stairs, false if not.
* @return bool_t True if ramp, false if not.
*/
bool_t tileIsStairs(const tile_t tile);
bool_t tileIsRamp(const tile_t tile);