#quake #bsp #quakeworld #parser

quake_bspinfo

从 .bsp 文件中提取 Quake 相关信息

10 个版本 (4 个重大更新)

0.5.4 2024年7月10日
0.5.3 2024年7月10日
0.5.0 2024年6月29日
0.4.1 2024年6月28日
0.1.1 2024年6月28日

#1017解析器实现

Download history 106/week @ 2024-06-22 252/week @ 2024-06-29 390/week @ 2024-07-06 42/week @ 2024-07-13 52/week @ 2024-07-27

每月下载量 488

MIT 许可证

27KB
549

quake_bspinfo

从 .bsp 文件中提取 Quake 相关信息

let data = fs::read("dm3.mvd")?;
let info: BspInfo = quake_bspinfo::parse(&data)?;

// result
struct BspInfo {
    message: String,
    size: u32,
    entity_count: EntityCount,
    intermissions: Vec<Intermission>,
    race_routes: Vec<RaceRoute>,
}

struct EntityCount {
    ammo: Ammo,
    armors: Armors,
    healthpacks: Healthpacks,
    items: Items,
    monsters: Monsters,
    powerups: Powerups,
    spawns: Spawns,
    triggers: Triggers,
    weapons: Weapons,
}

struct Ammo {
    shells_small: u32,
    shells_large: u32,
    nails_small: u32,
    nails_large: u32,
    rockets_small: u32,
    rockets_large: u32,
    cells_small: u32,
    cells_large: u32,
}

struct Armors {
    green_armor: u32,
    yellow_armor: u32,
    red_armor: u32,
}

struct Healthpacks {
    health_small: u32,
    health_large: u32,
    megahealth: u32,
}

struct Items {
    silver_key: u32,
    gold_key: u32,
    red_flag: u32,
    blue_flag: u32,
    tf_goal: u32,
}

struct Monsters {
    chton: u32,
    death_knight: u32,
    enforcer: u32,
    fiend: u32,
    grunt: u32,
    knight: u32,
    ogre: u32,
    rotfish: u32,
    rottweiler: u32,
    scrag: u32,
    shambler: u32,
    shub_niggurath: u32,
    spawn: u32,
    vore: u32,
    zombie: u32,
}

struct Powerups {
    biosuit: u32,
    quad: u32,
    pent: u32,
    ring: u32,
}

struct Spawns {
    coop: u32,
    deathmatch: u32,
    start: u32,
    team1: u32,
    team1_deathmatch: u32,
    team2: u32,
    team2_deathmatch: u32,
    teamspawn: u32,
}

struct Triggers {
    changelevel: u32,
    secret: u32,
    teleport: u32,
}

struct Weapons {
    super_shotgun: u32,
    nailgun: u32,
    super_nailgun: u32,
    grenade_launcher: u32,
    rocket_launcher: u32,
    ligthning_gun: u32,
}

struct Intermission {
    origin: String,
    mangle: String,
}

struct RaceRoute {
    name: String,
    description: String,
}

依赖项

~1.2–2.1MB
~42K SLoC