use constants better
This commit is contained in:
@@ -17,7 +17,7 @@ use bevy::prelude::*;
|
||||
|
||||
use crate::constants::ITILE_SIZE;
|
||||
use crate::world::chunks::{CHUNK_SIZE, Z_ABOVE, Z_BELOW};
|
||||
use crate::world::tiles::magic_numbers::ASTAR_DEFAULT_WEIGHT;
|
||||
use crate::world::tiles::constants::ASTAR_DEFAULT_WEIGHT;
|
||||
|
||||
/// Number of z-levels in a chunk (Z_BELOW + Z_ABOVE + 1 for inclusive range).
|
||||
/// Terrain generation uses -Z_BELOW..=Z_ABOVE (inclusive at both ends).
|
||||
@@ -274,7 +274,7 @@ impl ChunkData {
|
||||
self.stand_in_fixture.fill(0);
|
||||
self.stand_on_fixture.fill(0);
|
||||
self.tile_ids.fill(0);
|
||||
// MAGIC ASTAR_DEFAULT_WEIGHT matches normal grass/traversable tile weight — cleared
|
||||
// ASTAR_DEFAULT_WEIGHT matches normal grass/traversable tile weight — cleared
|
||||
// chunks present as passable rather than impassable walls to pathfinding.
|
||||
self.astar_weights.fill(ASTAR_DEFAULT_WEIGHT);
|
||||
}
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
// Tiles
|
||||
/// Default A* weight returned for out-of-bounds or unloaded positions.
|
||||
/// Matches normal traversable tile weight so pathfinding degrades gracefully.
|
||||
pub const ASTAR_DEFAULT_WEIGHT: u8 = 100;
|
||||
@@ -1,6 +1,6 @@
|
||||
pub mod benchmark;
|
||||
pub mod chunk_data;
|
||||
pub mod magic_numbers;
|
||||
pub mod constants;
|
||||
pub mod rendering;
|
||||
pub mod tile_changed;
|
||||
pub mod tilemap;
|
||||
|
||||
@@ -35,7 +35,7 @@ use super::chunk_data::ChunkData;
|
||||
use crate::constants::ITILE_SIZE;
|
||||
use crate::entities::item::drop_table::DropTable;
|
||||
use crate::world::chunks::{world_to_chunk, CHUNK_SIZE, Z_ABOVE, Z_BELOW};
|
||||
use crate::world::tiles::magic_numbers::ASTAR_DEFAULT_WEIGHT;
|
||||
use crate::world::tiles::constants::ASTAR_DEFAULT_WEIGHT;
|
||||
|
||||
/// Packed floor tile data for efficient storage. ~35 bytes vs 76 bytes tuple.
|
||||
#[derive(Clone, Debug)]
|
||||
|
||||
@@ -9,7 +9,7 @@ use crate::constants::{ITILE_SIZE, TILE_PIXELS, TILE_SIZE};
|
||||
use crate::game::ZIndex;
|
||||
use crate::world::chunks::{CHUNK_SIZE, CHUNK_SIZE_TILE, Z_BELOW, Z_TOTAL};
|
||||
use crate::world::textures::TilemapTileset;
|
||||
use crate::world::tiles::magic_numbers::{BYTES_PER_MB, Z_CHANGE_HISTORY_LEN};
|
||||
use crate::world::tiles::constants::{BYTES_PER_MB, Z_CHANGE_HISTORY_LEN};
|
||||
use crate::world::tiles::{FloorTileData, TileMap};
|
||||
|
||||
pub const LAYER_FLOOR: u8 = 0;
|
||||
@@ -140,7 +140,7 @@ fn tile_for_depth(real_index: u16, z_diff: i32) -> TileData {
|
||||
}
|
||||
|
||||
fn is_tile_visible_at_z(tile_data: &FloorTileData, z_index: usize) -> bool {
|
||||
// MAGIC u8::MAX + 1; z_index stored as u8 in layer key so this is out-of-range
|
||||
// u8::MAX + 1; z_index stored as u8 in layer key so this is out-of-range
|
||||
if z_index >= 256 {
|
||||
return false;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user