load CON files

This commit is contained in:
2016-03-10 13:11:18 -08:00
parent 79a59a1a5d
commit 120ee6741b
5 changed files with 187 additions and 82 deletions

41
src/town.rs Normal file
View File

@@ -0,0 +1,41 @@
use world::Chunk;
use world::HasMap;
use world::Map;
use tile::Tile;
#[allow(dead_code)]
#[derive(Clone, Copy, Debug)]
enum Behavior {
FIXED = 0x00,
WANDER = 0x01,
FOLLOW = 0x80,
ATTACK = 0xFF,
}
#[derive(Clone, Copy)]
pub struct Town {
map: Chunk,
npc_tile1: [Tile; 32],
npc_x1: [u8; 32],
npc_y1: [u8; 32],
npc_tile2: [Tile; 32],
npc_x2: [u8; 32],
npc_y2: [u8; 32],
npc_behavior: [Behavior; 32],
npc_talk_idx: [u8; 32],
}
impl HasMap for Town {
fn map(&self) -> &Map {
&self.map
}
}
// 0x400 32 tile for NPCs 0-31
// 0x420 32 start_x for NPCs 0-31
// 0x440 32 start_y for NPCs 0-31
// 0x460 32 repitition of 0x400-0x41F
// 0x480 32 repitition of 0x420-0x43F
// 0x4A0 32 repitition of 0x440-0x45F
// 0x4C0 32 movement_behavior for NPCs 0-31 (0x0-fixed, 0x1-wander, 0x80-follow, 0xFF-attack)
// 0x4E0 32 conversion index (tlk file) for NPCs 0-31