Prevent tiles with objects on them from falling.
This commit is contained in:
parent
ee56143d0d
commit
fd8799f36b
|
@ -293,11 +293,16 @@ move(Player *player, RoomMatrix *matrix, Vector2d direction)
|
|||
|
||||
if (!has_collided(player, matrix, direction)) {
|
||||
action_spent(player);
|
||||
RoomSpace *lastSpace = &matrix->spaces[lastPos.x][lastPos.y];
|
||||
if (lastPos.x > 1 &&
|
||||
lastPos.y > 1 &&
|
||||
lastPos.x < 14 &&
|
||||
lastPos.y < 10)
|
||||
map_trigger_tile_fall(matrix->spaces[lastPos.x][lastPos.y].tile);
|
||||
lastPos.y < 10 &&
|
||||
lastSpace->decoration == NULL &&
|
||||
lastSpace->trap == NULL &&
|
||||
lastSpace->objects == NULL
|
||||
)
|
||||
map_trigger_tile_fall(lastSpace->tile);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -47,6 +47,7 @@ roommatrix_reset(RoomMatrix *m)
|
|||
space->player = NULL;
|
||||
space->trap = NULL;
|
||||
space->tile = NULL;
|
||||
space->decoration = NULL;
|
||||
while (space->items != NULL)
|
||||
linkedlist_pop(&space->items);
|
||||
while (space->artifacts != NULL)
|
||||
|
@ -126,6 +127,7 @@ void roommatrix_populate_from_map(RoomMatrix *rm, Map *m)
|
|||
r->tiles[i][j]->lethal;
|
||||
}
|
||||
if (r->decorations[i][j]) {
|
||||
space->decoration = r->decorations[i][j];
|
||||
space->occupied |=
|
||||
r->decorations[i][j]->collider;
|
||||
space->lightsource |=
|
||||
|
|
|
@ -45,6 +45,7 @@ typedef struct RoomSpace {
|
|||
bool damaging;
|
||||
int light;
|
||||
MapTile *tile;
|
||||
MapTile *decoration;
|
||||
Monster *monster;
|
||||
Player *player;
|
||||
Trap *trap;
|
||||
|
|
Loading…
Reference in New Issue