Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Parse info #1

Merged
merged 11 commits into from
Jun 28, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .github/FUNDING.YML
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
open_collective: quakeworld
21 changes: 21 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
name: Test

on:
push:
branches: [ "main" ]
pull_request:
branches: [ "main" ]

env:
CARGO_TERM_COLOR: always

jobs:
build:
name: "Build and test"
runs-on: ubuntu-latest
timeout-minutes: 5

steps:
- uses: actions/checkout@v4
- run: cargo build
- run: cargo test
7 changes: 7 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
.idea/

# Generated by Cargo
# will have compiled files and executables
debug/
Expand All @@ -12,3 +14,8 @@ Cargo.lock

# MSVC Windows builds of rustc generate these, which store debugging information
*.pdb


# Added by cargo

/target
22 changes: 22 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
[package]
name = "quake_bspinfo"
description = "Extract Quake related information from .bsp files."
categories = ["parsing"]
keywords = ["bsp", "parser", "quake", "quakeworld"]
repository = "https://github.com/vikpe/bspparser"
authors = ["Viktor Persson"]
version = "0.1.0"
edition = "2021"
license = "MIT"
include = [
"/Cargo.toml",
"/README.md",
"/src/**",
]

[dependencies]
anyhow = "1.0.86"
bspparser = "0.2.0"

[dev-dependencies]
pretty_assertions = "1.4.0"
121 changes: 120 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,121 @@
# quake_bspinfo
Extract Quake related information from .bsp files.

> Extract Quake related information from .bsp files

```rust
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,
}
```
Loading