Trenchbroom integration
| Author | Mitja Felicijan <mitja.felicijan@gmail.com> | 2026-05-11 23:21:24 +0200 |
| Committer | Mitja Felicijan <mitja.felicijan@gmail.com> | 2026-05-11 23:21:24 +0200 |
| Commit | a7660227c0646af7387d5c094efb983f49c8015e (patch) |
|
-rw-r--r-- |
Makefile | 2 | |
-rw-r--r-- |
README.md | 14 | |
-rw-r--r-- |
extern/trenchbroom/Entities.fgd | 25 | |
-rw-r--r-- |
extern/trenchbroom/GameConfig.cfg | 26 | |
-rw-r--r-- |
extern/trenchbroom/GameEngineProfiles.cfg | 10 | |
-rw-r--r-- |
extern/trenchbroom/icon.png | bin 0 B -> 2.8 KB | |
-rw-r--r-- |
maps/sandbox.map | 20 | |
-rwxr-xr-x |
tools/tbrun.sh | 66 |
8 files changed, 161 insertions, 2 deletions
| diff --git a/Makefile b/Makefile | |||
| ... | |||
| 5 | 5 | ||
| 6 | SOURCES := main.c ppm.c keyboard.c mouse.c |
6 | SOURCES := main.c ppm.c keyboard.c mouse.c |
| 7 | 7 | ||
| 8 | GAME := bin/game |
8 | GAME := bin/pathfinder |
| 9 | HEXDUMP := bin/hexdump |
9 | HEXDUMP := bin/hexdump |
| 10 | PACKER := bin/packer |
10 | PACKER := bin/packer |
| 11 | 11 | ||
| ... | |||
| diff --git a/README.md b/README.md | |||
| ... | |||
| 7 | ## Aseprite PPM exporter |
7 | ## Aseprite PPM exporter |
| 8 | 8 | ||
| 9 | ```sh |
9 | ```sh |
| 10 | # Start from root of the project. |
||
| 10 | mkdir -p ~/.config/aseprite/scripts |
11 | mkdir -p ~/.config/aseprite/scripts |
| 11 | ln -s extern/ppm.lua ~/.config/aseprite/scripts/ |
12 | ln -s $PWD/extern/ppm.lua ~/.config/aseprite/scripts/ |
| 12 | ``` |
13 | ``` |
| 13 | 14 | ||
| 14 | This script can be keybind in Aseprite. |
15 | This script can be keybind in Aseprite. |
| 16 | |||
| 17 | ## Trenchbroom integration |
||
| 18 | |||
| 19 | ```sh |
||
| 20 | # Start from root of the project. |
||
| 21 | ln -s $PWD/extern/trenchbroom/ ~/.TrenchBroom/games/pathfinder |
||
| 22 | ``` |
||
| 23 | |||
| 24 | - Check that `path` in `GameEngineProfiles.cfg` points to game executable. |
||
| 25 | - Open Trenchbroom and go to `View>Preferences` and check that `Game Path` |
||
| 26 | points to project root. |
||
| diff --git a/extern/trenchbroom/Entities.fgd b/extern/trenchbroom/Entities.fgd | |||
| 1 | @BaseClass = Targetname |
||
| 2 | [ |
||
| 3 | targetname(string) : "Name" |
||
| 4 | ] |
||
| 5 | |||
| 6 | @BaseClass = Origin |
||
| 7 | [ |
||
| 8 | origin(string) : "Origin" |
||
| 9 | ] |
||
| 10 | |||
| 11 | @SolidClass = worldspawn : "Worldspawn" |
||
| 12 | [ |
||
| 13 | message(string) : "Map title" |
||
| 14 | ] |
||
| 15 | |||
| 16 | @PointClass base(Targetname, Origin) size(-16 -16 -16, 16 16 16) = player_start : "Player Start" |
||
| 17 | [ |
||
| 18 | angle(integer) : "Angle" : 0 |
||
| 19 | ] |
||
| 20 | |||
| 21 | @PointClass base(Targetname, Origin) size(-8 -8 -8, 8 8 8) = light : "Light" |
||
| 22 | [ |
||
| 23 | luminosity(integer) : "Luminosity" : 300 |
||
| 24 | range(integer) : "Range" : 500 |
||
| 25 | ] |
||
| diff --git a/extern/trenchbroom/GameConfig.cfg b/extern/trenchbroom/GameConfig.cfg | |||
| 1 | { |
||
| 2 | "version": 9, |
||
| 3 | "name": "Pathfinder", |
||
| 4 | "icon": "icon.png", |
||
| 5 | |||
| 6 | "fileformats": [ |
||
| 7 | { "format": "Standard" } |
||
| 8 | ], |
||
| 9 | |||
| 10 | "filesystem": { |
||
| 11 | "searchpath": ".", |
||
| 12 | "packageformat": { "extension": ".pak", "format": "idpak" } |
||
| 13 | }, |
||
| 14 | |||
| 15 | "materials": { |
||
| 16 | "root": "textures", |
||
| 17 | "extensions": [ ".png", ".jpg", ".tga", ".ppm" ] |
||
| 18 | }, |
||
| 19 | |||
| 20 | "entities": { |
||
| 21 | "definitions": [ "Entities.fgd" ], |
||
| 22 | "defaultcolor": "0.6 0.6 0.6 1.0" |
||
| 23 | }, |
||
| 24 | |||
| 25 | "softMapBounds": "-4096 -4096 -4096 4096 4096 4096" |
||
| 26 | } |
||
| diff --git a/extern/trenchbroom/GameEngineProfiles.cfg b/extern/trenchbroom/GameEngineProfiles.cfg | |||
| 1 | { |
||
| 2 | "profiles": [ |
||
| 3 | { |
||
| 4 | "name": "Pathfinder", |
||
| 5 | "parameters": "--fps 120 --width 1920 --height 1080 --map maps/${MAP_BASE_NAME}.map", |
||
| 6 | "path": "/home/m/Projects/pathfinder/tools/tbrun.sh" |
||
| 7 | } |
||
| 8 | ], |
||
| 9 | "version": 1 |
||
| 10 | } |
||
| diff --git a/extern/trenchbroom/icon.png b/extern/trenchbroom/icon.png |
| diff --git a/maps/sandbox.map b/maps/sandbox.map | |||
| 1 | // Game: Pathfinder |
||
| 2 | // Format: Standard |
||
| 3 | // entity 0 |
||
| 4 | { |
||
| 5 | "classname" "worldspawn" |
||
| 6 | // brush 0 |
||
| 7 | { |
||
| 8 | ( -64 -64 -16 ) ( -64 -63 -16 ) ( -64 -64 -15 ) __TB_empty 0 0 0 1 1 |
||
| 9 | ( -64 -64 -16 ) ( -64 -64 -15 ) ( -63 -64 -16 ) __TB_empty 0 0 0 1 1 |
||
| 10 | ( -64 -64 -16 ) ( -63 -64 -16 ) ( -64 -63 -16 ) __TB_empty 0 0 0 1 1 |
||
| 11 | ( 64 64 16 ) ( 64 65 16 ) ( 65 64 16 ) __TB_empty 0 0 0 1 1 |
||
| 12 | ( 64 64 16 ) ( 65 64 16 ) ( 64 64 17 ) __TB_empty 0 0 0 1 1 |
||
| 13 | ( 64 64 16 ) ( 64 64 17 ) ( 64 65 16 ) __TB_empty 0 0 0 1 1 |
||
| 14 | } |
||
| 15 | } |
||
| 16 | // entity 1 |
||
| 17 | { |
||
| 18 | "classname" "player_start" |
||
| 19 | "origin" "0 0 32" |
||
| 20 | } |
||
| diff --git a/tools/tbrun.sh b/tools/tbrun.sh | |||
| 1 | #!/bin/sh |
||
| 2 | |||
| 3 | SCRIPT="$0" |
||
| 4 | case "$SCRIPT" in |
||
| 5 | /*) ;; |
||
| 6 | *) SCRIPT="$(pwd)/$SCRIPT" ;; |
||
| 7 | esac |
||
| 8 | |||
| 9 | # resolve symlinks |
||
| 10 | while [ -L "$SCRIPT" ]; do |
||
| 11 | LINK="$(readlink "$SCRIPT")" |
||
| 12 | case "$LINK" in |
||
| 13 | /*) SCRIPT="$LINK" ;; |
||
| 14 | *) SCRIPT="$(dirname "$SCRIPT")/$LINK" ;; |
||
| 15 | esac |
||
| 16 | done |
||
| 17 | |||
| 18 | SCRIPT_DIR="$(cd "$(dirname "$SCRIPT")" && pwd -P)" |
||
| 19 | echo "$SCRIPT_DIR" |
||
| 20 | |||
| 21 | MAP="" |
||
| 22 | FPS="" |
||
| 23 | WIDTH="" |
||
| 24 | HEIGHT="" |
||
| 25 | while [ $# -gt 0 ]; do |
||
| 26 | case "$1" in |
||
| 27 | --map) |
||
| 28 | shift |
||
| 29 | MAP="$1" |
||
| 30 | ;; |
||
| 31 | --map=*) |
||
| 32 | MAP="${1#--map=}" |
||
| 33 | ;; |
||
| 34 | --fps) |
||
| 35 | shift |
||
| 36 | FPS="$1" |
||
| 37 | ;; |
||
| 38 | --fps=*) |
||
| 39 | FPS="${1#--fps=}" |
||
| 40 | ;; |
||
| 41 | --width) |
||
| 42 | shift |
||
| 43 | WIDTH="$1" |
||
| 44 | ;; |
||
| 45 | --width=*) |
||
| 46 | WIDTH="${1#--width=}" |
||
| 47 | ;; |
||
| 48 | --height) |
||
| 49 | shift |
||
| 50 | HEIGHT="$1" |
||
| 51 | ;; |
||
| 52 | --height=*) |
||
| 53 | HEIGHT="${1#--height=}" |
||
| 54 | ;; |
||
| 55 | --) shift; break;; |
||
| 56 | *) ;; |
||
| 57 | esac |
||
| 58 | shift |
||
| 59 | done |
||
| 60 | |||
| 61 | cd "$SCRIPT_DIR" |
||
| 62 | cd .. |
||
| 63 | DEBUG=1 ./bin/pathfinder --map "$MAP" \ |
||
| 64 | ${FPS:+--fps "$FPS"} \ |
||
| 65 | ${WIDTH:+--width "$WIDTH"} \ |
||
| 66 | ${HEIGHT:+--height "$HEIGHT"} |
||