diff --git a/README.md b/README.md index f0e2c5106896bc7f647761e45e888e7a25f16440..802e5672be43024a3abaf64c07e36500a4e49368 100644 --- a/README.md +++ b/README.md @@ -8,3 +8,6 @@ - Check that `path` in `GameEngineProfiles.cfg` points to game executable. - Open Trenchbroom and go to `View>Preferences` and check that `Game Path` points to project root. +## Trenchbroom entities + +- https://developer.valvesoftware.com/wiki/FGD diff --git a/all.h b/all.h index ac97717219e0817c952212a2689bf9e1b7b3e129..048750a73a9f7a8a26af5f9cf658c914c4ac6a2d 100644 --- a/all.h +++ b/all.h @@ -124,7 +124,7 @@ Vector2 GetUV(Vector3 p, MapPlane *mp, Plane plane); // Game Texture2D GetTexture(const char *name); -void InitGame(void); +void InitGame(const char *map_path); void UpdateGame(void); void DrawGame(void); bool LoadMap(const char *filename); diff --git a/game.c b/game.c index 168cae47b3e97e175c0a5ef3026a3a6b4e74d49b..87fea13f1f9b3c53b09efd610f210807d250521c 100644 --- a/game.c +++ b/game.c @@ -223,7 +223,7 @@ TraceLog(LOG_INFO, "Processed %d brushes into %d models", total_brushes, game.world_model_count); return true; } -void InitGame(void) { +void InitGame(const char* map_path) { array_init(texture_cache); game.world_models = NULL; game.world_model_count = 0; @@ -238,7 +238,7 @@ } else { game.font_ui = GetFontDefault(); } - LoadMap("maps/demo1.map"); + LoadMap(map_path); game.cursor_captured = false; EnableCursor(); diff --git a/main.c b/main.c index 481f5f394067828d838fb8fdd5f8a910ecc056f5..e89aa1af953c45726fed0092d76765da2f631016 100644 --- a/main.c +++ b/main.c @@ -14,7 +14,7 @@ SetTargetFPS(GetMonitorRefreshRate(monitor)); vfs_init("data.pak"); - InitGame(); + InitGame("maps/demo3.map"); game.vsync = true; while (!WindowShouldClose()) { diff --git a/maps/demo3.map b/maps/demo3.map index ab0e59defe37886a2a99600a08a943dfdb9d2ea7..bdd84f591ca9553dc9fda211033ae0b6c371e6d9 100644 --- a/maps/demo3.map +++ b/maps/demo3.map @@ -5,11 +5,32 @@ { "classname" "worldspawn" // brush 0 { -( -176 -64 -32 ) ( -176 -63 -32 ) ( -176 -64 -31 ) brushes/bricks_076c 0 -16 0 1 1 -( -64 -432 -32 ) ( -64 -432 -31 ) ( -63 -432 -32 ) brushes/bricks_076c 0 -16 0 1 1 -( -64 -64 -16 ) ( -63 -64 -16 ) ( -64 -63 -16 ) brushes/bricks_076c 0 0 0 1 1 -( 64 64 0 ) ( 64 65 0 ) ( 65 64 0 ) brushes/bricks_076c 0 0 0 1 1 -( 64 64 0 ) ( 65 64 0 ) ( 64 64 1 ) brushes/bricks_076c 0 -16 0 1 1 -( 64 64 0 ) ( 64 64 1 ) ( 64 65 0 ) brushes/bricks_076c 0 -16 0 1 1 +( -592 -16 -32 ) ( -592 -15 -32 ) ( -592 -16 -31 ) brushes/bricks_076c -48 -16 0 1 1 +( -64 -384 -32 ) ( -64 -384 -31 ) ( -63 -384 -32 ) brushes/bricks_076c 0 -16 0 1 1 +( -64 -16 -16 ) ( -63 -16 -16 ) ( -64 -15 -16 ) brushes/bricks_076c 0 48 0 1 1 +( 64 112 0 ) ( 64 113 0 ) ( 65 112 0 ) brushes/bricks_076c 0 48 0 1 1 +( 64 336 0 ) ( 65 336 0 ) ( 64 336 1 ) brushes/bricks_076c 0 -16 0 1 1 +( 560 112 0 ) ( 560 112 1 ) ( 560 113 0 ) brushes/bricks_076c -48 -16 0 1 1 +} +} +// entity 1 +{ +"classname" "light" +"origin" "136 -280 184" +} +// entity 2 +{ +"classname" "light" +"origin" "-200 24 184" } +// entity 3 +{ +"classname" "info_player_start" +"origin" "-128 -112 16" +} +// entity 4 +{ +"classname" "my_entity" +"origin" "8 -72 8" +"speed" "100" } diff --git a/trenchbroom/stalag/Entities.fgd b/trenchbroom/stalag/Entities.fgd index b6496a5b13a2ddb0490fb48efd3f3c0e5f9e39c1..abf5256d7e2ffae146230be4bf3a4dcc8673d81a 100644 --- a/trenchbroom/stalag/Entities.fgd +++ b/trenchbroom/stalag/Entities.fgd @@ -21,4 +21,9 @@ @PointClass base(Targetname, Origin) size(-8 -8 -8, 8 8 8) = light : "Light" [ light(integer) : "Brightness" : 300 -] \ No newline at end of file +] + +@PointClass base(Targetname) = my_entity : "My Entity" +[ + speed(integer) : "Speed" : 100 +]