diff --git a/.github/workflows/snapshot.yml b/.github/workflows/snapshot.yml
index c12d675..232947f 100644
--- a/.github/workflows/snapshot.yml
+++ b/.github/workflows/snapshot.yml
@@ -11,11 +11,14 @@ jobs:
- name: Install deps
run: |
sudo apt-get update
- sudo apt-get install -y build-essential cmake libgl1-mesa-dev libglfw3-dev libglew-dev libsqlite3-dev zlib1g-dev curl zip lua5.3
- - name: Build
+ sudo apt-get install -y build-essential cmake lua5.3 curl zip
+ - name: Build ubuntu snapshot
run: |
./snapshot.sh
- - name: Upload snapshot
+ - name: Build windows snapshot
+ run: |
+ ./snapshot.sh mingw
+ - name: Upload snapshots
env:
SECRET: ${{ secrets.ELIDRAGON_UPLOAD_TOKEN }}
run: |
diff --git a/.gitignore b/.gitignore
index 576b8e6..53912a6 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,30 +1,4 @@
-# CMake
-CMakeLists.txt.user
-CMakeCache.txt
-CMakeFiles
-CMakeScripts
-Testing
-Makefile
-cmake_install.cmake
-install_manifest.txt
-compile_commands.json
-CTestTestfile.cmake
-_deps
-
-# Binaries
-dragonblocks
-dragonblocks_server
-dragonblocks_alpha-*.zip
-dragonblocks_alpha
-
-# Data
-client.conf
-server.conf
-*.sqlite
-*.sqlite-journal
-screenshot-*.png
-
-# Generated code
-version.h
-types.c
-types.h
+build*/*
+!build/debug.sh
+!build/debug_loop.sh
+dragonblocks_alpha*
diff --git a/.gitmodules b/.gitmodules
index 49df65f..bf29ca1 100644
--- a/.gitmodules
+++ b/.gitmodules
@@ -3,7 +3,7 @@
url = https://github.com/datenwolf/linmath.h
[submodule "deps/perlin"]
path = deps/perlin
- url = https://github.com/czinn/perlin
+ url = https://github.com/dragonblocks/perlin
[submodule "deps/stb"]
path = deps/stb
url = https://github.com/nothings/stb
@@ -21,10 +21,28 @@
url = https://github.com/dragonblocks/dragonnet
[submodule "deps/linenoise"]
path = deps/linenoise
- url = https://github.com/msteveb/linenoise
+ url = https://github.com/dragonblocks/linenoise
[submodule "deps/protogen"]
path = deps/protogen
url = https://github.com/dragonblocks/protogen
[submodule "deps/getline"]
path = deps/getline
url = https://github.com/dragonblocks/getline
+[submodule "deps/glfw"]
+ path = deps/glfw
+ url = https://github.com/glfw/glfw
+[submodule "deps/glew-cmake"]
+ path = deps/glew-cmake
+ url = https://github.com/Perlmint/glew-cmake
+[submodule "deps/freetype"]
+ path = deps/freetype
+ url = https://gitlab.freedesktop.org/freetype/freetype
+[submodule "deps/sqlite3-cmake"]
+ path = deps/sqlite3-cmake
+ url = https://github.com/dragonblocks/sqlite3-cmake
+[submodule "deps/stpcpy"]
+ path = deps/stpcpy
+ url = https://github.com/dragonblocks/stpcpy
+[submodule "deps/zlib"]
+ path = deps/zlib
+ url = https://github.com/dragonblocks/zlib
diff --git a/BUILDING.md b/BUILDING.md
index 2decc4b..723d2b7 100644
--- a/BUILDING.md
+++ b/BUILDING.md
@@ -1,50 +1,34 @@
# Building instructions
-CMake is used for compiling. Make sure to clone the repository recursively:
+## Dependencies
+To build anything you need Git, CMake, Lua, Bash and GCC. Make sure these dependencies are installed on your system.
+All other dependencies are included as submodules, compiled automatically and statically linked.
+Make sure to clone the repository recursively:
```bash
git clone --recurse-submodules https://github.com/dragonblocks/dragonblocks_alpha.git
```
-## Dependencies
-To build anything you need CMake and Lua. The ZLib development library is needed as well.
-The development versions of OpenGL, GLFW3, GLEW and Freetype are required to build the client.
-For building the server the SQLite3 development library is required.
-
-
-Ubuntu / Debian:
-
-```bash
-sudo apt install build-essential cmake zlib1g-dev libgl1-mesa-dev libglfw3-dev libglew-dev libfreetype-dev libsqlite3-dev lua5.3
-```
-
-FreeBSD:
-
-```csh
-sudo pkg install cmake gcc lzlib mesa-devel glfw glew freetype sqlite3 lua
-```
-
-OpenBSD:
-
-```sh
-sudo pkg_add cmake lzlib glfw glew freetype sqlite3 lua
-```
-
## Building a debug build
-By default CMake will make a Debug build if nothing else is specified. Simply use
+By default CMake will make a debug build if nothing else is specified. Simply use
```bash
-cd src
-cmake .
+cmake -B build -S src
+cd build
make -j$(nproc)
```
to build the dragonblocks client and server.
-If you use a debug build, the singleplayer script should be invoked from the src/ directory, because that's where the binaries are located.
+If you use a debug build, the singleplayer script should be invoked from the build/ directory, because that's where the binaries are located.
-## Building a snapshot
+## Building a release snapshot
```bash
+# Native snapshot
./snapshot.sh
+
+# Crosscompiling for windows (requires i686-w64-mingw32-gcc-posix)
+./snapshot.sh mingw
```
-This script will create a snapshot zipfile.
+
+Creates snapshot zipfiles.
diff --git a/README.md b/README.md
index baa5eec..581cf19 100644
--- a/README.md
+++ b/README.md
@@ -1,20 +1,30 @@
# Dragonblocks Alpha
A multiplayer voxelgame for POSIX systems.
+It has been ported to Linux, Windows, FreeBSD and OpenBSD, but may work on other systems.
-Head to for ubuntu snapshot and release builds.
+Head to for snapshot and release builds (CURRENTLY DOWN).
## Invocation
-```bash
-./DragonblocksServer
-./Dragonblocks
+```sh
+# on posix
+./dragonblocks_server "[]:"
+./dragonblocks_client "[]:"
+
+# on windows
+dragonblocks_server.exe "[]:"
+dragonblocks_client.exe "[]:"
```
or alternatively:
-```bash
+```sh
+# on posix
./singleplayer.sh
+
+# on windows
+singleplayer.bat
```
## Controls
@@ -35,35 +45,10 @@ or alternatively:
| F11 | Toggle fullscreen |
| ESC | Pause / unpause game |
-## Dependencies
-
-Both the client and the server depend on ZLib.
-The client depends on GLFW3, OpenGL, GLEW and Freetype.
-The server depends on SQLite3.
-
-Ubuntu / Debian:
-
-```bash
-sudo apt install zlib1g libgl1-mesa-dri libglfw3 libglew2.1 libfreetype6 libsqlite3-0
-
-```
-
-FreeBSD:
-
-```csh
-sudo pkg install lzlib mesa-dri glfw glew freetype sqlite3
-```
-
-OpenBSD:
-
-```sh
-sudo pkg_add lzlib glfw glew freetype sqlite3
-```
-
-## Setup Requirements
+## System Requirements
Dragonblocks Alpha targets PCs only. Non x86-64 platforms may work, however there is no guarantee whatsoever.
You need a POSIX system conforming to the ISO C and POSIX 2008 standards. However, so far only GNU/Linux systems, in particular Ubuntu and Debian, have been tested.
-The minimum OpenGL version is 4.6.0. Dragonblocks has been tested on Intel Integrated and NVIDIA GPUs, however other graphics cards should work as well.
+The minimum OpenGL version is 4.2.0. Dragonblocks has been tested on Intel Integrated and NVIDIA GPUs, however other graphics cards should work as well.
A PC with at least 4 CPU cores is recommended, but not necessarily required.
## Current Features
diff --git a/fonts/Minecraftia.ttf b/assets/fonts/Minecraftia.ttf
similarity index 100%
rename from fonts/Minecraftia.ttf
rename to assets/fonts/Minecraftia.ttf
diff --git a/meshes/axe.gox b/assets/meshes/axe.gox
similarity index 100%
rename from meshes/axe.gox
rename to assets/meshes/axe.gox
diff --git a/meshes/axe.txt b/assets/meshes/axe.txt
similarity index 100%
rename from meshes/axe.txt
rename to assets/meshes/axe.txt
diff --git a/meshes/pickaxe.gox b/assets/meshes/pickaxe.gox
similarity index 100%
rename from meshes/pickaxe.gox
rename to assets/meshes/pickaxe.gox
diff --git a/meshes/pickaxe.txt b/assets/meshes/pickaxe.txt
similarity index 100%
rename from meshes/pickaxe.txt
rename to assets/meshes/pickaxe.txt
diff --git a/meshes/shovel.gox b/assets/meshes/shovel.gox
similarity index 100%
rename from meshes/shovel.gox
rename to assets/meshes/shovel.gox
diff --git a/meshes/shovel.txt b/assets/meshes/shovel.txt
similarity index 100%
rename from meshes/shovel.txt
rename to assets/meshes/shovel.txt
diff --git a/meshes/unknown.gox b/assets/meshes/unknown.gox
similarity index 100%
rename from meshes/unknown.gox
rename to assets/meshes/unknown.gox
diff --git a/meshes/unknown.txt b/assets/meshes/unknown.txt
similarity index 100%
rename from meshes/unknown.txt
rename to assets/meshes/unknown.txt
diff --git a/models/player.txt b/assets/models/player.txt
similarity index 100%
rename from models/player.txt
rename to assets/models/player.txt
diff --git a/schematics/spawn_hut.gox b/assets/schematics/spawn_hut.gox
similarity index 100%
rename from schematics/spawn_hut.gox
rename to assets/schematics/spawn_hut.gox
diff --git a/schematics/spawn_hut.txt b/assets/schematics/spawn_hut.txt
similarity index 100%
rename from schematics/spawn_hut.txt
rename to assets/schematics/spawn_hut.txt
diff --git a/shaders/3d/entity/fragment.glsl b/assets/shaders/3d/entity/fragment.glsl
similarity index 100%
rename from shaders/3d/entity/fragment.glsl
rename to assets/shaders/3d/entity/fragment.glsl
diff --git a/shaders/3d/entity/vertex.glsl b/assets/shaders/3d/entity/vertex.glsl
similarity index 100%
rename from shaders/3d/entity/vertex.glsl
rename to assets/shaders/3d/entity/vertex.glsl
diff --git a/shaders/3d/item/fragment.glsl b/assets/shaders/3d/item/fragment.glsl
similarity index 100%
rename from shaders/3d/item/fragment.glsl
rename to assets/shaders/3d/item/fragment.glsl
diff --git a/shaders/3d/item/vertex.glsl b/assets/shaders/3d/item/vertex.glsl
similarity index 100%
rename from shaders/3d/item/vertex.glsl
rename to assets/shaders/3d/item/vertex.glsl
diff --git a/shaders/3d/selection/fragment.glsl b/assets/shaders/3d/selection/fragment.glsl
similarity index 100%
rename from shaders/3d/selection/fragment.glsl
rename to assets/shaders/3d/selection/fragment.glsl
diff --git a/shaders/3d/selection/vertex.glsl b/assets/shaders/3d/selection/vertex.glsl
similarity index 100%
rename from shaders/3d/selection/vertex.glsl
rename to assets/shaders/3d/selection/vertex.glsl
diff --git a/shaders/3d/terrain/fragment.glsl b/assets/shaders/3d/terrain/fragment.glsl
similarity index 100%
rename from shaders/3d/terrain/fragment.glsl
rename to assets/shaders/3d/terrain/fragment.glsl
diff --git a/shaders/3d/terrain/vertex.glsl b/assets/shaders/3d/terrain/vertex.glsl
similarity index 100%
rename from shaders/3d/terrain/vertex.glsl
rename to assets/shaders/3d/terrain/vertex.glsl
diff --git a/shaders/gui/background/fragment.glsl b/assets/shaders/gui/background/fragment.glsl
similarity index 100%
rename from shaders/gui/background/fragment.glsl
rename to assets/shaders/gui/background/fragment.glsl
diff --git a/shaders/gui/background/vertex.glsl b/assets/shaders/gui/background/vertex.glsl
similarity index 100%
rename from shaders/gui/background/vertex.glsl
rename to assets/shaders/gui/background/vertex.glsl
diff --git a/shaders/gui/font/fragment.glsl b/assets/shaders/gui/font/fragment.glsl
similarity index 100%
rename from shaders/gui/font/fragment.glsl
rename to assets/shaders/gui/font/fragment.glsl
diff --git a/shaders/gui/font/vertex.glsl b/assets/shaders/gui/font/vertex.glsl
similarity index 100%
rename from shaders/gui/font/vertex.glsl
rename to assets/shaders/gui/font/vertex.glsl
diff --git a/shaders/gui/image/fragment.glsl b/assets/shaders/gui/image/fragment.glsl
similarity index 100%
rename from shaders/gui/image/fragment.glsl
rename to assets/shaders/gui/image/fragment.glsl
diff --git a/shaders/gui/image/vertex.glsl b/assets/shaders/gui/image/vertex.glsl
similarity index 100%
rename from shaders/gui/image/vertex.glsl
rename to assets/shaders/gui/image/vertex.glsl
diff --git a/shaders/sky/clouds/fragment.glsl b/assets/shaders/sky/clouds/fragment.glsl
similarity index 100%
rename from shaders/sky/clouds/fragment.glsl
rename to assets/shaders/sky/clouds/fragment.glsl
diff --git a/shaders/sky/clouds/vertex.glsl b/assets/shaders/sky/clouds/vertex.glsl
similarity index 100%
rename from shaders/sky/clouds/vertex.glsl
rename to assets/shaders/sky/clouds/vertex.glsl
diff --git a/shaders/sky/skybox/fragment.glsl b/assets/shaders/sky/skybox/fragment.glsl
similarity index 100%
rename from shaders/sky/skybox/fragment.glsl
rename to assets/shaders/sky/skybox/fragment.glsl
diff --git a/shaders/sky/skybox/vertex.glsl b/assets/shaders/sky/skybox/vertex.glsl
similarity index 100%
rename from shaders/sky/skybox/vertex.glsl
rename to assets/shaders/sky/skybox/vertex.glsl
diff --git a/shaders/sky/sun/fragment.glsl b/assets/shaders/sky/sun/fragment.glsl
similarity index 100%
rename from shaders/sky/sun/fragment.glsl
rename to assets/shaders/sky/sun/fragment.glsl
diff --git a/shaders/sky/sun/vertex.glsl b/assets/shaders/sky/sun/vertex.glsl
similarity index 100%
rename from shaders/sky/sun/vertex.glsl
rename to assets/shaders/sky/sun/vertex.glsl
diff --git a/textures/crosshair.png b/assets/textures/crosshair.png
similarity index 100%
rename from textures/crosshair.png
rename to assets/textures/crosshair.png
diff --git a/textures/dirt.png b/assets/textures/dirt.png
similarity index 100%
rename from textures/dirt.png
rename to assets/textures/dirt.png
diff --git a/textures/grass.png b/assets/textures/grass.png
similarity index 100%
rename from textures/grass.png
rename to assets/textures/grass.png
diff --git a/textures/lava.png b/assets/textures/lava.png
similarity index 100%
rename from textures/lava.png
rename to assets/textures/lava.png
diff --git a/textures/lava_nt.png b/assets/textures/lava_nt.png
similarity index 100%
rename from textures/lava_nt.png
rename to assets/textures/lava_nt.png
diff --git a/textures/models/player/arm/back.png b/assets/textures/models/player/arm/back.png
similarity index 100%
rename from textures/models/player/arm/back.png
rename to assets/textures/models/player/arm/back.png
diff --git a/textures/models/player/arm/bottom.png b/assets/textures/models/player/arm/bottom.png
similarity index 100%
rename from textures/models/player/arm/bottom.png
rename to assets/textures/models/player/arm/bottom.png
diff --git a/textures/models/player/arm/front.png b/assets/textures/models/player/arm/front.png
similarity index 100%
rename from textures/models/player/arm/front.png
rename to assets/textures/models/player/arm/front.png
diff --git a/textures/models/player/arm/left.png b/assets/textures/models/player/arm/left.png
similarity index 100%
rename from textures/models/player/arm/left.png
rename to assets/textures/models/player/arm/left.png
diff --git a/textures/models/player/arm/right.png b/assets/textures/models/player/arm/right.png
similarity index 100%
rename from textures/models/player/arm/right.png
rename to assets/textures/models/player/arm/right.png
diff --git a/textures/models/player/arm/top.png b/assets/textures/models/player/arm/top.png
similarity index 100%
rename from textures/models/player/arm/top.png
rename to assets/textures/models/player/arm/top.png
diff --git a/textures/models/player/chest/back.png b/assets/textures/models/player/chest/back.png
similarity index 100%
rename from textures/models/player/chest/back.png
rename to assets/textures/models/player/chest/back.png
diff --git a/textures/models/player/chest/bottom.png b/assets/textures/models/player/chest/bottom.png
similarity index 100%
rename from textures/models/player/chest/bottom.png
rename to assets/textures/models/player/chest/bottom.png
diff --git a/textures/models/player/chest/front.png b/assets/textures/models/player/chest/front.png
similarity index 100%
rename from textures/models/player/chest/front.png
rename to assets/textures/models/player/chest/front.png
diff --git a/textures/models/player/chest/left.png b/assets/textures/models/player/chest/left.png
similarity index 100%
rename from textures/models/player/chest/left.png
rename to assets/textures/models/player/chest/left.png
diff --git a/textures/models/player/chest/right.png b/assets/textures/models/player/chest/right.png
similarity index 100%
rename from textures/models/player/chest/right.png
rename to assets/textures/models/player/chest/right.png
diff --git a/textures/models/player/chest/top.png b/assets/textures/models/player/chest/top.png
similarity index 100%
rename from textures/models/player/chest/top.png
rename to assets/textures/models/player/chest/top.png
diff --git a/textures/models/player/head/back.png b/assets/textures/models/player/head/back.png
similarity index 100%
rename from textures/models/player/head/back.png
rename to assets/textures/models/player/head/back.png
diff --git a/textures/models/player/head/bottom.png b/assets/textures/models/player/head/bottom.png
similarity index 100%
rename from textures/models/player/head/bottom.png
rename to assets/textures/models/player/head/bottom.png
diff --git a/textures/models/player/head/front.png b/assets/textures/models/player/head/front.png
similarity index 100%
rename from textures/models/player/head/front.png
rename to assets/textures/models/player/head/front.png
diff --git a/textures/models/player/head/left.png b/assets/textures/models/player/head/left.png
similarity index 100%
rename from textures/models/player/head/left.png
rename to assets/textures/models/player/head/left.png
diff --git a/textures/models/player/head/right.png b/assets/textures/models/player/head/right.png
similarity index 100%
rename from textures/models/player/head/right.png
rename to assets/textures/models/player/head/right.png
diff --git a/textures/models/player/head/top.png b/assets/textures/models/player/head/top.png
similarity index 100%
rename from textures/models/player/head/top.png
rename to assets/textures/models/player/head/top.png
diff --git a/textures/models/player/leg/back.png b/assets/textures/models/player/leg/back.png
similarity index 100%
rename from textures/models/player/leg/back.png
rename to assets/textures/models/player/leg/back.png
diff --git a/textures/models/player/leg/bottom.png b/assets/textures/models/player/leg/bottom.png
similarity index 100%
rename from textures/models/player/leg/bottom.png
rename to assets/textures/models/player/leg/bottom.png
diff --git a/textures/models/player/leg/front.png b/assets/textures/models/player/leg/front.png
similarity index 100%
rename from textures/models/player/leg/front.png
rename to assets/textures/models/player/leg/front.png
diff --git a/textures/models/player/leg/left.png b/assets/textures/models/player/leg/left.png
similarity index 100%
rename from textures/models/player/leg/left.png
rename to assets/textures/models/player/leg/left.png
diff --git a/textures/models/player/leg/right.png b/assets/textures/models/player/leg/right.png
similarity index 100%
rename from textures/models/player/leg/right.png
rename to assets/textures/models/player/leg/right.png
diff --git a/textures/models/player/leg/top.png b/assets/textures/models/player/leg/top.png
similarity index 100%
rename from textures/models/player/leg/top.png
rename to assets/textures/models/player/leg/top.png
diff --git a/textures/needles.png b/assets/textures/needles.png
similarity index 100%
rename from textures/needles.png
rename to assets/textures/needles.png
diff --git a/textures/oak_leaves.png b/assets/textures/oak_leaves.png
similarity index 100%
rename from textures/oak_leaves.png
rename to assets/textures/oak_leaves.png
diff --git a/textures/oak_wood.png b/assets/textures/oak_wood.png
similarity index 100%
rename from textures/oak_wood.png
rename to assets/textures/oak_wood.png
diff --git a/textures/oak_wood_top.png b/assets/textures/oak_wood_top.png
similarity index 100%
rename from textures/oak_wood_top.png
rename to assets/textures/oak_wood_top.png
diff --git a/textures/palm_leaves.png b/assets/textures/palm_leaves.png
similarity index 100%
rename from textures/palm_leaves.png
rename to assets/textures/palm_leaves.png
diff --git a/textures/palm_wood.png b/assets/textures/palm_wood.png
similarity index 100%
rename from textures/palm_wood.png
rename to assets/textures/palm_wood.png
diff --git a/textures/palm_wood_top.png b/assets/textures/palm_wood_top.png
similarity index 100%
rename from textures/palm_wood_top.png
rename to assets/textures/palm_wood_top.png
diff --git a/textures/pine_leaves.png b/assets/textures/pine_leaves.png
similarity index 100%
rename from textures/pine_leaves.png
rename to assets/textures/pine_leaves.png
diff --git a/textures/pine_wood.png b/assets/textures/pine_wood.png
similarity index 100%
rename from textures/pine_wood.png
rename to assets/textures/pine_wood.png
diff --git a/textures/pine_wood_top.png b/assets/textures/pine_wood_top.png
similarity index 100%
rename from textures/pine_wood_top.png
rename to assets/textures/pine_wood_top.png
diff --git a/textures/player.png b/assets/textures/player.png
similarity index 100%
rename from textures/player.png
rename to assets/textures/player.png
diff --git a/textures/sand.png b/assets/textures/sand.png
similarity index 100%
rename from textures/sand.png
rename to assets/textures/sand.png
diff --git a/textures/skybox/day/back.png b/assets/textures/skybox/day/back.png
similarity index 100%
rename from textures/skybox/day/back.png
rename to assets/textures/skybox/day/back.png
diff --git a/textures/skybox/day/bottom.png b/assets/textures/skybox/day/bottom.png
similarity index 100%
rename from textures/skybox/day/bottom.png
rename to assets/textures/skybox/day/bottom.png
diff --git a/textures/skybox/day/front.png b/assets/textures/skybox/day/front.png
similarity index 100%
rename from textures/skybox/day/front.png
rename to assets/textures/skybox/day/front.png
diff --git a/textures/skybox/day/left.png b/assets/textures/skybox/day/left.png
similarity index 100%
rename from textures/skybox/day/left.png
rename to assets/textures/skybox/day/left.png
diff --git a/textures/skybox/day/right.png b/assets/textures/skybox/day/right.png
similarity index 100%
rename from textures/skybox/day/right.png
rename to assets/textures/skybox/day/right.png
diff --git a/textures/skybox/day/top.png b/assets/textures/skybox/day/top.png
similarity index 100%
rename from textures/skybox/day/top.png
rename to assets/textures/skybox/day/top.png
diff --git a/textures/skybox/night/back.png b/assets/textures/skybox/night/back.png
similarity index 100%
rename from textures/skybox/night/back.png
rename to assets/textures/skybox/night/back.png
diff --git a/textures/skybox/night/bottom.png b/assets/textures/skybox/night/bottom.png
similarity index 100%
rename from textures/skybox/night/bottom.png
rename to assets/textures/skybox/night/bottom.png
diff --git a/textures/skybox/night/front.png b/assets/textures/skybox/night/front.png
similarity index 100%
rename from textures/skybox/night/front.png
rename to assets/textures/skybox/night/front.png
diff --git a/textures/skybox/night/left.png b/assets/textures/skybox/night/left.png
similarity index 100%
rename from textures/skybox/night/left.png
rename to assets/textures/skybox/night/left.png
diff --git a/textures/skybox/night/right.png b/assets/textures/skybox/night/right.png
similarity index 100%
rename from textures/skybox/night/right.png
rename to assets/textures/skybox/night/right.png
diff --git a/textures/skybox/night/top.png b/assets/textures/skybox/night/top.png
similarity index 100%
rename from textures/skybox/night/top.png
rename to assets/textures/skybox/night/top.png
diff --git a/textures/snow.png b/assets/textures/snow.png
similarity index 100%
rename from textures/snow.png
rename to assets/textures/snow.png
diff --git a/textures/stone.png b/assets/textures/stone.png
similarity index 100%
rename from textures/stone.png
rename to assets/textures/stone.png
diff --git a/textures/sun.png b/assets/textures/sun.png
similarity index 100%
rename from textures/sun.png
rename to assets/textures/sun.png
diff --git a/textures/unknown.png b/assets/textures/unknown.png
similarity index 100%
rename from textures/unknown.png
rename to assets/textures/unknown.png
diff --git a/textures/vulcano_stone.png b/assets/textures/vulcano_stone.png
similarity index 100%
rename from textures/vulcano_stone.png
rename to assets/textures/vulcano_stone.png
diff --git a/textures/water.png b/assets/textures/water.png
similarity index 100%
rename from textures/water.png
rename to assets/textures/water.png
diff --git a/textures/water_nt.png b/assets/textures/water_nt.png
similarity index 100%
rename from textures/water_nt.png
rename to assets/textures/water_nt.png
diff --git a/src/debug.sh b/build/debug.sh
similarity index 92%
rename from src/debug.sh
rename to build/debug.sh
index cc4cd54..4323a99 100755
--- a/src/debug.sh
+++ b/build/debug.sh
@@ -37,7 +37,7 @@ alacritty -e bash -c "
" &
sleep 0.5
-gdb --command $DEBUG_DIR/client_script ./dragonblocks
+gdb --command $DEBUG_DIR/client_script ./dragonblocks_client
kill `cat $DEBUG_DIR/server_pid`
diff --git a/src/debug_loop.sh b/build/debug_loop.sh
similarity index 100%
rename from src/debug_loop.sh
rename to build/debug_loop.sh
diff --git a/deps/asprintf b/deps/asprintf
index 84c7e7c..305d3f9 160000
--- a/deps/asprintf
+++ b/deps/asprintf
@@ -1 +1 @@
-Subproject commit 84c7e7cb1e0a6ea4102ca785cca31a3e66f34a48
+Subproject commit 305d3f995280196f4c88146b03f09b94191e8cca
diff --git a/deps/dragonnet b/deps/dragonnet
index 9ab2148..72fd472 160000
--- a/deps/dragonnet
+++ b/deps/dragonnet
@@ -1 +1 @@
-Subproject commit 9ab2148e1b8d03dab816bbba6209794663b31576
+Subproject commit 72fd472f45d9589269d7786877dff8d45586c006
diff --git a/deps/dragonstd b/deps/dragonstd
index 7d8cdee..ae5dd6c 160000
--- a/deps/dragonstd
+++ b/deps/dragonstd
@@ -1 +1 @@
-Subproject commit 7d8cdeeb49fc6fa0b4b7ac9c3bb3e1fb27f4f0bf
+Subproject commit ae5dd6c930ccef19ad313aa903f0528aa803ee80
diff --git a/deps/endian.h b/deps/endian.h
index 6c7eccf..f24960e 160000
--- a/deps/endian.h
+++ b/deps/endian.h
@@ -1 +1 @@
-Subproject commit 6c7eccf05405eacbb76281550cd69895089f9773
+Subproject commit f24960eca3bb806fa72d8de2b9a761a889fdeee3
diff --git a/deps/freetype b/deps/freetype
new file mode 160000
index 0000000..d59c7ce
--- /dev/null
+++ b/deps/freetype
@@ -0,0 +1 @@
+Subproject commit d59c7ce1b970bfe38b3df161e9dd711b75392709
diff --git a/deps/getline b/deps/getline
index 9d102be..305c38b 160000
--- a/deps/getline
+++ b/deps/getline
@@ -1 +1 @@
-Subproject commit 9d102be3fb622bcd3fab9f7feaafe2b1abf3980a
+Subproject commit 305c38b4595254706f103e0043ac2fd6e491d8ed
diff --git a/deps/glew-cmake b/deps/glew-cmake
new file mode 160000
index 0000000..7c2b751
--- /dev/null
+++ b/deps/glew-cmake
@@ -0,0 +1 @@
+Subproject commit 7c2b7514f64234756f7df051b9316f1e46f5a6e7
diff --git a/deps/glfw b/deps/glfw
new file mode 160000
index 0000000..4cb3687
--- /dev/null
+++ b/deps/glfw
@@ -0,0 +1 @@
+Subproject commit 4cb36872a5fe448c205d0b46f0e8c8b57530cfe0
diff --git a/deps/linenoise b/deps/linenoise
index 9430e6e..2da54ed 160000
--- a/deps/linenoise
+++ b/deps/linenoise
@@ -1 +1 @@
-Subproject commit 9430e6e4e7fc09e8ca6a2fd5e3fcafa07818542e
+Subproject commit 2da54ed285c5da913c9fb11e0b0410becccb8a39
diff --git a/deps/perlin b/deps/perlin
index 78efd36..2b58452 160000
--- a/deps/perlin
+++ b/deps/perlin
@@ -1 +1 @@
-Subproject commit 78efd369ac89a1db0dee71e277bf5e74309ef9fe
+Subproject commit 2b584521c2657c8c8e8cb4a49ca80c2ffa0c3f96
diff --git a/deps/protogen b/deps/protogen
index 2200835..f506262 160000
--- a/deps/protogen
+++ b/deps/protogen
@@ -1 +1 @@
-Subproject commit 2200835ac31adfa47f2baaa93f0a79a7c9a9007c
+Subproject commit f506262076d602340500786703ac384d92683e26
diff --git a/deps/sqlite3-cmake b/deps/sqlite3-cmake
new file mode 160000
index 0000000..a8200e0
--- /dev/null
+++ b/deps/sqlite3-cmake
@@ -0,0 +1 @@
+Subproject commit a8200e0816fb742617347d3e1a43c35b5b2f424e
diff --git a/deps/stpcpy b/deps/stpcpy
new file mode 160000
index 0000000..c85c304
--- /dev/null
+++ b/deps/stpcpy
@@ -0,0 +1 @@
+Subproject commit c85c304ae7cb6867a732c4183c1d260f746bd73d
diff --git a/deps/zlib b/deps/zlib
new file mode 160000
index 0000000..4b4fbf4
--- /dev/null
+++ b/deps/zlib
@@ -0,0 +1 @@
+Subproject commit 4b4fbf4ee10310760f763bcb674775f0325b842a
diff --git a/singleplayer.bat b/singleplayer.bat
new file mode 100755
index 0000000..0328b33
--- /dev/null
+++ b/singleplayer.bat
@@ -0,0 +1,5 @@
+@echo off
+start "Internal Server" dragonblocks_server.exe "[::1]:4000"
+echo "singleplayer" | dragonblocks_client.exe "[::1]:4000"
+taskkill /FI "Internal Server" /T /F
+
diff --git a/singleplayer.sh b/singleplayer.sh
index 0daa513..5f084ad 100755
--- a/singleplayer.sh
+++ b/singleplayer.sh
@@ -1,4 +1,4 @@
#!/bin/bash
./dragonblocks_server "[::1]:4000" &
-echo "singleplayer" | ./dragonblocks "[::1]:4000"
-pkill -P $$ -9
+echo "singleplayer" | ./dragonblocks_client "[::1]:4000"
+pkill -P $$
diff --git a/snapshot.sh b/snapshot.sh
index 9c1098f..e99ab63 100755
--- a/snapshot.sh
+++ b/snapshot.sh
@@ -1,23 +1,44 @@
#!/bin/bash
+set -e
+
VERSION=`git tag --points-at HEAD`
if [[ $VERSION = "" ]]; then
VERSION=`git rev-parse --short HEAD`
fi
-DIR=dragonblocks_alpha-$VERSION
-mkdir .build
-cp -r * .build/
-cd .build/
-mkdir build
-cd build
-if ! (cmake -B . -S ../src -DCMAKE_BUILD_TYPE=Release -DRESSOURCE_PATH="\"\"" -DCMAKE_C_FLAGS="-Ofast" && make clean && make -j$(nproc)); then
- cd ../..
- rm -rf .build
- exit 1
+
+BUILD=build-release
+SNAPSHOT=dragonblocks_alpha-$VERSION
+TOOLCHAIN=
+DOTEXE=
+DOTSH=".sh"
+if [[ "$1" == "mingw" ]]; then
+ BUILD=build-mingw
+ SNAPSHOT=dragonblocks_alpha-win64-$VERSION
+ TOOLCHAIN=mingw.cmake
+ DOTEXE=".exe"
+ DOTSH=".bat"
fi
-cp dragonblocks dragonblocks_server ..
-cd ..
-rm -rf .git* deps src build BUILDING.md snapshot.sh upload.sh dragonblocks_alpha-* screenshot-*.png
-cd ..
-mv .build $DIR
-zip -r $DIR.zip $DIR/*
-rm -rf $DIR
+
+mkdir -p $BUILD
+
+cmake -B $BUILD -S src \
+ -DCMAKE_BUILD_TYPE="Release" \
+ -DASSET_PATH="assets/" \
+ -DCMAKE_C_FLAGS="-Ofast" \
+ -DCMAKE_TOOLCHAIN_FILE="$TOOLCHAIN"
+
+make --no-print-directory -C $BUILD -j$(nproc)
+
+rm -rf $SNAPSHOT
+mkdir $SNAPSHOT
+
+cp -r \
+ assets \
+ $BUILD/dragonblocks_client$DOTEXE \
+ $BUILD/dragonblocks_server$DOTEXE \
+ singleplayer$DOTSH \
+ LICENSE \
+ README.md \
+ $SNAPSHOT
+
+zip -r $SNAPSHOT.zip $SNAPSHOT/*
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index 896d845..6c9838a 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -1,41 +1,44 @@
-cmake_minimum_required(VERSION 3.12)
+cmake_minimum_required(VERSION 3.14)
project(Dragonblocks)
# Variables
-set(DEPS_DIR "${CMAKE_CURRENT_SOURCE_DIR}/../deps/")
+set(DEPS_DIR "${CMAKE_CURRENT_SOURCE_DIR}/../deps")
if(NOT CMAKE_BUILD_TYPE)
set(CMAKE_BUILD_TYPE Debug)
endif()
-if(NOT RESSOURCE_PATH)
- set(RESSOURCE_PATH "../")
+if(NOT ASSET_PATH)
+ set(ASSET_PATH "../assets/")
endif()
# Dependencies
-find_package(OpenGL REQUIRED)
+cmake_policy(SET CMP0077 NEW)
-if(NOT GLEW_LIBRARIES OR NOT GLEW_INCLUDE_DIRS)
- find_package(GLEW REQUIRED)
-endif()
+set(SKIP_INSTALL_ALL ON)
+set(BUILD_SHARED_LIBS OFF)
+set(ZLIB_LIBRARY zlibstatic)
-if(NOT GLFW_LIBRARIES OR NOT GLFW_INCLUDE_DIRS)
- find_package(glfw3 3.3 REQUIRED)
- set(GLFW_LIBRARIES glfw)
- set(GLFW_INCLUDE_DIRS)
-endif()
+set(FT_DISABLE_ZLIB OFF)
+set(FT_DISABLE_BZIP2 ON)
+set(FT_DISABLE_PNG ON)
+set(FT_DISABLE_HARFBUZZ ON)
+set(FT_DISABLE_BROTLI ON)
-if(NOT FREETYPE_LIBRARIES OR NOT FREETYPE_INCLUDE_DIRS)
- find_package(Freetype REQUIRED)
-endif()
-
-if(NOT ZLIB_LIBRARIES OR NOT ZLIB_INCLUDE_DIRS)
- find_package(ZLIB REQUIRED)
- set(ZLIB_LIBRARIES ZLIB::ZLIB)
- set(ZLIB_INCLUDE_DIRS)
-endif()
+add_subdirectory("${DEPS_DIR}/glfw" EXCLUDE_FROM_ALL "${CMAKE_CURRENT_BINARY_DIR}/glfw")
+add_subdirectory("${DEPS_DIR}/glew-cmake" EXCLUDE_FROM_ALL "${CMAKE_CURRENT_BINARY_DIR}/glew")
+add_subdirectory("${DEPS_DIR}/sqlite3-cmake" EXCLUDE_FROM_ALL "${CMAKE_CURRENT_BINARY_DIR}/sqlite3")
+add_subdirectory("${DEPS_DIR}/perlin" EXCLUDE_FROM_ALL "${CMAKE_CURRENT_BINARY_DIR}/perlin")
+add_subdirectory("${DEPS_DIR}/asprintf" EXCLUDE_FROM_ALL "${CMAKE_CURRENT_BINARY_DIR}/asprintf")
+add_subdirectory("${DEPS_DIR}/dragonnet" EXCLUDE_FROM_ALL "${CMAKE_CURRENT_BINARY_DIR}/dragonnet")
+add_subdirectory("${DEPS_DIR}/dragonstd" EXCLUDE_FROM_ALL "${CMAKE_CURRENT_BINARY_DIR}/dragonstd")
+add_subdirectory("${DEPS_DIR}/getline" EXCLUDE_FROM_ALL "${CMAKE_CURRENT_BINARY_DIR}/getline")
+add_subdirectory("${DEPS_DIR}/stpcpy" EXCLUDE_FROM_ALL "${CMAKE_CURRENT_BINARY_DIR}/stpcpy")
+add_subdirectory("${DEPS_DIR}/linenoise" EXCLUDE_FROM_ALL "${CMAKE_CURRENT_BINARY_DIR}/linenoise")
+add_subdirectory("${DEPS_DIR}/zlib" EXCLUDE_FROM_ALL "${CMAKE_CURRENT_BINARY_DIR}/zlib")
+add_subdirectory("${DEPS_DIR}/freetype" EXCLUDE_FROM_ALL "${CMAKE_CURRENT_BINARY_DIR}/freetype")
# Options
@@ -44,21 +47,17 @@ if("${CMAKE_BUILD_TYPE}" STREQUAL "Debug")
endif()
add_compile_definitions("USE_DRAGONNET")
-add_compile_definitions("RESSOURCE_PATH=\"${RESSOURCE_PATH}\"")
+add_compile_definitions("GLEW_STATIC")
+add_compile_definitions("ASSET_PATH=\"${ASSET_PATH}\"")
-add_compile_options(-Wall -Wextra -Werror -Wno-address-of-packed-member -Wno-implicit-fallthrough -Wno-unused-parameter -Wno-maybe-uninitialized -fmax-errors=4)
-
-link_libraries(
- pthread
- m
- ${ZLIB_LIBRARIES}
+add_compile_options(
+ -Wall
+ -Wextra
+ -Werror
+ -Wno-address-of-packed-member
+ -fmax-errors=4
)
-include_directories(SYSTEM ${DEPS_DIR})
-include_directories(BEFORE ${CMAKE_CURRENT_SOURCE_DIR})
-include_directories(BEFORE ${CMAKE_CURRENT_BINARY_DIR})
-include_directories(${ZLIB_INCLUDE_DIRS})
-
# System specific options
if("${CMAKE_SYSTEM_NAME}" STREQUAL "FreeBSD" OR "${CMAKE_SYSTEM_NAME}" STREQUAL "OpenBSD")
@@ -73,45 +72,43 @@ endif()
# Common sources
-set(COMMON_SOURCES
+add_library(dragonblocks
"${CMAKE_CURRENT_BINARY_DIR}/types.c"
- "${DEPS_DIR}/asprintf/asprintf.c"
- "${DEPS_DIR}/dragonnet/addr.c"
- "${DEPS_DIR}/dragonnet/listen.c"
- "${DEPS_DIR}/dragonnet/peer.c"
- "${DEPS_DIR}/dragonnet/recv.c"
- "${DEPS_DIR}/dragonnet/recv_thread.c"
- "${DEPS_DIR}/dragonnet/send.c"
- "${DEPS_DIR}/dragonstd/array.c"
- "${DEPS_DIR}/dragonstd/flag.c"
- "${DEPS_DIR}/dragonstd/list.c"
- "${DEPS_DIR}/dragonstd/map.c"
- "${DEPS_DIR}/dragonstd/queue.c"
- "${DEPS_DIR}/dragonstd/refcount.c"
- "${DEPS_DIR}/dragonstd/tree.c"
- "${DEPS_DIR}/dragonstd/bits/compare.c"
- "${DEPS_DIR}/getline/getline.c"
- "${DEPS_DIR}/linenoise/linenoise.c"
- "${DEPS_DIR}/linenoise/stringbuf.c"
- "${DEPS_DIR}/linenoise/utf8.c"
- "${DEPS_DIR}/perlin/perlin.c"
- color.c
- config.c
- day.c
- environment.c
- facedir.c
- interrupt.c
- item.c
- node.c
- perlin.c
- physics.c
- terrain.c
+ common/color.c
+ common/config.c
+ common/day.c
+ common/environment.c
+ common/facedir.c
+ common/interrupt.c
+ common/item.c
+ common/node.c
+ common/perlin.c
+ common/physics.c
+ common/terrain.c
+)
+
+target_include_directories(dragonblocks
+ PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}
+ PUBLIC ${CMAKE_CURRENT_BINARY_DIR}
+ PUBLIC "${DEPS_DIR}/linmath.h"
+ PUBLIC "${DEPS_DIR}/endian.h"
+ PUBLIC "${DEPS_DIR}/stb"
+)
+
+target_link_libraries(dragonblocks
+ PUBLIC pthread
+ PUBLIC m
+ PUBLIC perlin
+ PUBLIC dragonnet
+ PUBLIC dragonstd
+ PUBLIC getline
+ PUBLIC zlibstatic
+ PUBLIC stpcpy
)
# Client
-add_executable(dragonblocks
- ${COMMON_SOURCES}
+add_executable(dragonblocks_client
client/camera.c
client/client.c
client/client_auth.c
@@ -144,23 +141,18 @@ add_executable(dragonblocks
client/window.c
)
-target_link_libraries(dragonblocks
- ${OPENGL_LIBRARIES}
- ${GLEW_LIBRARIES}
- ${GLFW_LIBRARIES}
- ${FREETYPE_LIBRARIES}
-)
-
-target_include_directories(dragonblocks PUBLIC
- ${GLEW_INCLUDE_DIRS}
- ${GLFW_INCLUDE_DIRS}
- ${FREETYPE_INCLUDE_DIRS}
+target_link_libraries(dragonblocks_client
+ PUBLIC dragonblocks
+ PUBLIC libglew_static
+ PUBLIC glfw
+ PUBLIC asprintf
+ PUBLIC linenoise
+ PUBLIC freetype
)
# Server
add_executable(dragonblocks_server
- ${COMMON_SOURCES}
server/biomes.c
server/database.c
server/schematic.c
@@ -178,7 +170,8 @@ add_executable(dragonblocks_server
)
target_link_libraries(dragonblocks_server
- sqlite3
+ PUBLIC dragonblocks
+ PUBLIC sqlite3
)
# Version
@@ -189,7 +182,6 @@ add_custom_target(version
)
add_dependencies(dragonblocks version)
-add_dependencies(dragonblocks_server version)
# Types
@@ -206,4 +198,3 @@ add_custom_target(types
)
add_dependencies(dragonblocks types)
-add_dependencies(dragonblocks_server types)
diff --git a/src/client/camera.h b/src/client/camera.h
index 3e3d517..740ece2 100644
--- a/src/client/camera.h
+++ b/src/client/camera.h
@@ -1,7 +1,7 @@
#ifndef _CAMERA_H_
#define _CAMERA_H_
-#include
+#include
#include "types.h"
extern struct Camera {
diff --git a/src/client/client.c b/src/client/client.c
index 55bfc45..2adb649 100644
--- a/src/client/client.c
+++ b/src/client/client.c
@@ -14,9 +14,9 @@
#include "client/debug_menu.h"
#include "client/game.h"
#include "client/input.h"
-#include "day.h"
-#include "interrupt.h"
-#include "perlin.h"
+#include "common/day.h"
+#include "common/interrupt.h"
+#include "common/perlin.h"
#include "types.h"
DragonnetPeer *client;
diff --git a/src/client/client_auth.c b/src/client/client_auth.c
index b955cd5..a338aa1 100644
--- a/src/client/client_auth.c
+++ b/src/client/client_auth.c
@@ -1,10 +1,10 @@
#include
#include
#include
-#include
+#include
#include "client.h"
#include "client_auth.h"
-#include "interrupt.h"
+#include "common/interrupt.h"
#include "types.h"
struct ClientAuth client_auth;
diff --git a/src/client/client_config.c b/src/client/client_config.c
index cc49c97..a1c34ab 100644
--- a/src/client/client_config.c
+++ b/src/client/client_config.c
@@ -1,5 +1,5 @@
-#include "config.h"
#include "client/client_config.h"
+#include "common/config.h"
struct ClientConfig client_config = {
.antialiasing = 4,
diff --git a/src/client/client_entity.c b/src/client/client_entity.c
index 2174e1b..49f8d61 100644
--- a/src/client/client_entity.c
+++ b/src/client/client_entity.c
@@ -1,4 +1,4 @@
-#include
+#include
#include
#include
#include
@@ -170,7 +170,7 @@ void client_entity_gfx_init()
{
char *shader_def;
asprintf(&shader_def, "#define VIEW_DISTANCE %lf\n", client_config.view_distance);
- shader_prog = shader_program_create(RESSOURCE_PATH "shaders/3d/entity", shader_def);
+ shader_prog = shader_program_create(ASSET_PATH "shaders/3d/entity", shader_def);
free(shader_def);
loc_VP = glGetUniformLocation(shader_prog, "VP"); GL_DEBUG
diff --git a/src/client/client_entity.h b/src/client/client_entity.h
index a0e43df..7d009a9 100644
--- a/src/client/client_entity.h
+++ b/src/client/client_entity.h
@@ -5,8 +5,8 @@
#include
#include "client/gui.h"
#include "client/model.h"
-#include "entity.h"
-#include "item.h"
+#include "common/entity.h"
+#include "common/item.h"
#include "types.h"
typedef struct {
diff --git a/src/client/client_inventory.c b/src/client/client_inventory.c
index 4bc4124..c0f780b 100644
--- a/src/client/client_inventory.c
+++ b/src/client/client_inventory.c
@@ -1,4 +1,4 @@
-#include
+#include
#include
#include
#include "client/client_config.h"
@@ -19,7 +19,7 @@ void client_inventory_init()
{
char *_3d_shader_def;
asprintf(&_3d_shader_def, "#define VIEW_DISTANCE %lf\n", client_config.view_distance);
- _3d_shader_prog = shader_program_create(RESSOURCE_PATH "shaders/3d/item", _3d_shader_def);
+ _3d_shader_prog = shader_program_create(ASSET_PATH "shaders/3d/item", _3d_shader_def);
free(_3d_shader_def);
_3d_loc_VP = glGetUniformLocation(_3d_shader_prog, "VP");
diff --git a/src/client/client_item.c b/src/client/client_item.c
index 5685cbf..0d16ee7 100644
--- a/src/client/client_item.c
+++ b/src/client/client_item.c
@@ -1,6 +1,6 @@
#include "client/client_item.h"
#include "client/interact.h"
-#include "node.h"
+#include "common/node.h"
static bool use_dig(__attribute__((unused)) ItemStack *stack)
{
@@ -11,7 +11,7 @@ static bool use_dig(__attribute__((unused)) ItemStack *stack)
ClientItemDef client_item_def[COUNT_ITEM] = {
// unknown
{
- .mesh_path = RESSOURCE_PATH "meshes/unknown.txt",
+ .mesh_path = ASSET_PATH "meshes/unknown.txt",
.mesh = {0},
.use = NULL,
},
@@ -23,19 +23,19 @@ ClientItemDef client_item_def[COUNT_ITEM] = {
},
// pickaxe
{
- .mesh_path = RESSOURCE_PATH "meshes/pickaxe.txt",
+ .mesh_path = ASSET_PATH "meshes/pickaxe.txt",
.mesh = {0},
.use = &use_dig,
},
// axe
{
- .mesh_path = RESSOURCE_PATH "meshes/axe.txt",
+ .mesh_path = ASSET_PATH "meshes/axe.txt",
.mesh = {0},
.use = &use_dig,
},
// shovel
{
- .mesh_path = RESSOURCE_PATH "meshes/shovel.txt",
+ .mesh_path = ASSET_PATH "meshes/shovel.txt",
.mesh = {0},
.use = &use_dig,
},
diff --git a/src/client/client_item.h b/src/client/client_item.h
index cbd6334..16552b0 100644
--- a/src/client/client_item.h
+++ b/src/client/client_item.h
@@ -3,8 +3,8 @@
#include
#include "client/mesh.h"
-#include "item.h"
-#include "node.h"
+#include "common/item.h"
+#include "common/node.h"
typedef struct {
const char *mesh_path;
diff --git a/src/client/client_node.c b/src/client/client_node.c
index 1142a85..76eb738 100644
--- a/src/client/client_node.c
+++ b/src/client/client_node.c
@@ -1,10 +1,10 @@
#include
#include "client/client.h"
#include "client/client_node.h"
-#include "color.h"
-#include "environment.h"
-#include "node.h"
-#include "perlin.h"
+#include "common/color.h"
+#include "common/environment.h"
+#include "common/node.h"
+#include "common/perlin.h"
#define TILES_SIMPLE(path) {.paths = {path, NULL, NULL, NULL, NULL, NULL}, .indices = {0, 0, 0, 0, 0, 0}, .textures = {NULL}}
#define TILES_NONE {.paths = {NULL}, .indices = {0}, .textures = {NULL}}
@@ -42,7 +42,7 @@ static void render_color(NodeArgsRender *args)
ClientNodeDef client_node_def[COUNT_NODE] = {
// unknown
{
- .tiles = TILES_SIMPLE(RESSOURCE_PATH "textures/unknown.png"),
+ .tiles = TILES_SIMPLE(ASSET_PATH "textures/unknown.png"),
.visibility = VISIBILITY_SOLID,
.mipmap = true,
.render = NULL,
@@ -62,7 +62,7 @@ ClientNodeDef client_node_def[COUNT_NODE] = {
},
// grass
{
- .tiles = TILES_SIMPLE(RESSOURCE_PATH "textures/grass.png"),
+ .tiles = TILES_SIMPLE(ASSET_PATH "textures/grass.png"),
.visibility = VISIBILITY_SOLID,
.mipmap = true,
.render = &render_grass,
@@ -72,7 +72,7 @@ ClientNodeDef client_node_def[COUNT_NODE] = {
},
// dirt
{
- .tiles = TILES_SIMPLE(RESSOURCE_PATH "textures/dirt.png"),
+ .tiles = TILES_SIMPLE(ASSET_PATH "textures/dirt.png"),
.visibility = VISIBILITY_SOLID,
.mipmap = true,
.render = NULL,
@@ -82,7 +82,7 @@ ClientNodeDef client_node_def[COUNT_NODE] = {
},
// stone
{
- .tiles = TILES_SIMPLE(RESSOURCE_PATH "textures/stone.png"),
+ .tiles = TILES_SIMPLE(ASSET_PATH "textures/stone.png"),
.visibility = VISIBILITY_SOLID,
.mipmap = true,
.render = &render_stone,
@@ -92,7 +92,7 @@ ClientNodeDef client_node_def[COUNT_NODE] = {
},
// snow
{
- .tiles = TILES_SIMPLE(RESSOURCE_PATH "textures/snow.png"),
+ .tiles = TILES_SIMPLE(ASSET_PATH "textures/snow.png"),
.visibility = VISIBILITY_SOLID,
.mipmap = true,
.render = NULL,
@@ -103,7 +103,7 @@ ClientNodeDef client_node_def[COUNT_NODE] = {
// oak wood
{
.tiles = {
- .paths = {RESSOURCE_PATH "textures/oak_wood.png", RESSOURCE_PATH "textures/oak_wood_top.png", NULL, NULL, NULL, NULL},
+ .paths = {ASSET_PATH "textures/oak_wood.png", ASSET_PATH "textures/oak_wood_top.png", NULL, NULL, NULL, NULL},
.indices = {0, 0, 0, 0, 1, 1},
.textures = {NULL},
},
@@ -116,7 +116,7 @@ ClientNodeDef client_node_def[COUNT_NODE] = {
},
// oak leaves
{
- .tiles = TILES_SIMPLE(RESSOURCE_PATH "textures/oak_leaves.png"),
+ .tiles = TILES_SIMPLE(ASSET_PATH "textures/oak_leaves.png"),
.visibility = VISIBILITY_SOLID,
.mipmap = true,
.render = &render_color,
@@ -127,7 +127,7 @@ ClientNodeDef client_node_def[COUNT_NODE] = {
// pine wood
{
.tiles = {
- .paths = {RESSOURCE_PATH "textures/pine_wood.png", RESSOURCE_PATH "textures/pine_wood_top.png", NULL, NULL, NULL, NULL},
+ .paths = {ASSET_PATH "textures/pine_wood.png", ASSET_PATH "textures/pine_wood_top.png", NULL, NULL, NULL, NULL},
.indices = {0, 0, 0, 0, 1, 1},
.textures = {NULL},
},
@@ -140,7 +140,7 @@ ClientNodeDef client_node_def[COUNT_NODE] = {
},
// pine leaves
{
- .tiles = TILES_SIMPLE(RESSOURCE_PATH "textures/pine_leaves.png"),
+ .tiles = TILES_SIMPLE(ASSET_PATH "textures/pine_leaves.png"),
.visibility = VISIBILITY_CLIP,
.mipmap = true,
.render = &render_color,
@@ -151,7 +151,7 @@ ClientNodeDef client_node_def[COUNT_NODE] = {
// palm wood
{
.tiles = {
- .paths = {RESSOURCE_PATH "textures/palm_wood.png", RESSOURCE_PATH "textures/palm_wood_top.png", NULL, NULL, NULL, NULL},
+ .paths = {ASSET_PATH "textures/palm_wood.png", ASSET_PATH "textures/palm_wood_top.png", NULL, NULL, NULL, NULL},
.indices = {0, 0, 0, 0, 1, 1},
.textures = {NULL},
},
@@ -164,7 +164,7 @@ ClientNodeDef client_node_def[COUNT_NODE] = {
},
// palm leaves
{
- .tiles = TILES_SIMPLE(RESSOURCE_PATH "textures/palm_leaves.png"),
+ .tiles = TILES_SIMPLE(ASSET_PATH "textures/palm_leaves.png"),
.visibility = VISIBILITY_SOLID,
.mipmap = true,
.render = &render_color,
@@ -174,7 +174,7 @@ ClientNodeDef client_node_def[COUNT_NODE] = {
},
// sand
{
- .tiles = TILES_SIMPLE(RESSOURCE_PATH "textures/sand.png"),
+ .tiles = TILES_SIMPLE(ASSET_PATH "textures/sand.png"),
.visibility = VISIBILITY_SOLID,
.mipmap = true,
.render = NULL,
@@ -184,7 +184,7 @@ ClientNodeDef client_node_def[COUNT_NODE] = {
},
// water
{
- .tiles = TILES_SIMPLE(RESSOURCE_PATH "textures/water.png"),
+ .tiles = TILES_SIMPLE(ASSET_PATH "textures/water.png"),
.visibility = VISIBILITY_BLEND,
.mipmap = true,
.render = NULL,
@@ -194,7 +194,7 @@ ClientNodeDef client_node_def[COUNT_NODE] = {
},
// lava
{
- .tiles = TILES_SIMPLE(RESSOURCE_PATH "textures/lava.png"),
+ .tiles = TILES_SIMPLE(ASSET_PATH "textures/lava.png"),
.visibility = VISIBILITY_BLEND,
.mipmap = true,
.render = NULL,
@@ -204,7 +204,7 @@ ClientNodeDef client_node_def[COUNT_NODE] = {
},
// vulcano_stone
{
- .tiles = TILES_SIMPLE(RESSOURCE_PATH "textures/vulcano_stone.png"),
+ .tiles = TILES_SIMPLE(ASSET_PATH "textures/vulcano_stone.png"),
.visibility = VISIBILITY_SOLID,
.mipmap = true,
.render = NULL,
diff --git a/src/client/client_node.h b/src/client/client_node.h
index 8068eca..a2f88ee 100644
--- a/src/client/client_node.h
+++ b/src/client/client_node.h
@@ -3,7 +3,7 @@
#include "client/terrain_gfx.h"
#include "client/texture.h"
-#include "terrain.h"
+#include "common/terrain.h"
typedef enum {
VISIBILITY_NONE,
diff --git a/src/client/client_player.c b/src/client/client_player.c
index ffdc6b2..d6c9cc0 100644
--- a/src/client/client_player.c
+++ b/src/client/client_player.c
@@ -8,8 +8,8 @@
#include "client/cube.h"
#include "client/debug_menu.h"
#include "client/texture.h"
-#include "environment.h"
-#include "physics.h"
+#include "common/environment.h"
+#include "common/physics.h"
struct ClientPlayer client_player;
@@ -233,7 +233,7 @@ void client_player_deinit()
void client_player_gfx_init()
{
player_model = model_load(
- RESSOURCE_PATH "models/player.txt", RESSOURCE_PATH "textures/models/player",
+ ASSET_PATH "models/player.txt", ASSET_PATH "textures/models/player",
&client_entity_cube, &client_entity_shader);
player_model->callbacks.delete = &on_model_delete;
diff --git a/src/client/client_terrain.c b/src/client/client_terrain.c
index e8eae36..86f3f21 100644
--- a/src/client/client_terrain.c
+++ b/src/client/client_terrain.c
@@ -14,7 +14,7 @@
#include "client/client_terrain.h"
#include "client/debug_menu.h"
#include "client/terrain_gfx.h"
-#include "facedir.h"
+#include "common/facedir.h"
#define MAX_REQUESTS 4
diff --git a/src/client/client_terrain.h b/src/client/client_terrain.h
index 262a3d5..a337325 100644
--- a/src/client/client_terrain.h
+++ b/src/client/client_terrain.h
@@ -4,7 +4,7 @@
#include
#include
#include "client/model.h"
-#include "terrain.h"
+#include "common/terrain.h"
#include "types.h"
#define CHUNK_MODE_NOCREATE 2
diff --git a/src/client/debug_menu.c b/src/client/debug_menu.c
index ddf36c4..ef1c457 100644
--- a/src/client/debug_menu.c
+++ b/src/client/debug_menu.c
@@ -1,4 +1,4 @@
-#include
+#include
#include
#include
#include
@@ -15,9 +15,9 @@
#include "client/gui.h"
#include "client/interact.h"
#include "client/window.h"
-#include "day.h"
-#include "environment.h"
-#include "perlin.h"
+#include "common/day.h"
+#include "common/environment.h"
+#include "common/perlin.h"
#include "version.h"
static GUIElement *gui_elements[COUNT_ENTRY] = {NULL};
diff --git a/src/client/font.c b/src/client/font.c
index 8014d97..56c6e07 100644
--- a/src/client/font.c
+++ b/src/client/font.c
@@ -39,7 +39,7 @@ void font_init()
abort();
}
- if (FT_New_Face(font_library, RESSOURCE_PATH "fonts/Minecraftia.ttf", 0, &font_face)) {
+ if (FT_New_Face(font_library, ASSET_PATH "fonts/Minecraftia.ttf", 0, &font_face)) {
fprintf(stderr, "[error] failed to load Minecraftia.ttf\n");
abort();
}
diff --git a/src/client/frustum.h b/src/client/frustum.h
index a747265..59304aa 100644
--- a/src/client/frustum.h
+++ b/src/client/frustum.h
@@ -2,7 +2,7 @@
#define _FRUSTUM_H_
#include
-#include
+#include
#include "types.h"
extern mat4x4 frustum;
diff --git a/src/client/game.c b/src/client/game.c
index b45499a..859d9cf 100644
--- a/src/client/game.c
+++ b/src/client/game.c
@@ -21,8 +21,8 @@
#include "client/interact.h"
#include "client/sky.h"
#include "client/window.h"
-#include "day.h"
-#include "interrupt.h"
+#include "common/day.h"
+#include "common/interrupt.h"
#ifdef _WIN32
#include
diff --git a/src/client/gui.c b/src/client/gui.c
index 9cda646..8e5e1f3 100644
--- a/src/client/gui.c
+++ b/src/client/gui.c
@@ -253,18 +253,18 @@ static void transform_element(GUIElement *element)
void gui_init()
{
// initialize background pipeline
- background_prog = shader_program_create(RESSOURCE_PATH "shaders/gui/background", NULL);
+ background_prog = shader_program_create(ASSET_PATH "shaders/gui/background", NULL);
background_loc_model = glGetUniformLocation(background_prog, "model"); GL_DEBUG
background_loc_projection = glGetUniformLocation(background_prog, "projection"); GL_DEBUG
background_loc_color = glGetUniformLocation(background_prog, "color"); GL_DEBUG
// initialize image pipeline
- image_prog = shader_program_create(RESSOURCE_PATH "shaders/gui/image", NULL);
+ image_prog = shader_program_create(ASSET_PATH "shaders/gui/image", NULL);
image_loc_model = glGetUniformLocation(image_prog, "model"); GL_DEBUG
image_loc_projection = glGetUniformLocation(image_prog, "projection"); GL_DEBUG
// initialize font pipeline
- font_prog = shader_program_create(RESSOURCE_PATH "shaders/gui/font", NULL);
+ font_prog = shader_program_create(ASSET_PATH "shaders/gui/font", NULL);
font_loc_model = glGetUniformLocation(font_prog, "model"); GL_DEBUG
font_loc_projection = glGetUniformLocation(font_prog, "projection"); GL_DEBUG
font_loc_color = glGetUniformLocation(font_prog, "color"); GL_DEBUG
diff --git a/src/client/gui.h b/src/client/gui.h
index b7c3087..a3776ea 100644
--- a/src/client/gui.h
+++ b/src/client/gui.h
@@ -2,7 +2,7 @@
#define _GUI_H_
#include
-#include
+#include
#include
#include "client/font.h"
#include "client/texture.h"
diff --git a/src/client/input.c b/src/client/input.c
index 32c181b..a5927ff 100644
--- a/src/client/input.c
+++ b/src/client/input.c
@@ -1,4 +1,4 @@
-#include
+#include
#include
#include
#include
@@ -13,7 +13,7 @@
#include "client/input.h"
#include "client/screenshot.h"
#include "client/window.h"
-#include "day.h"
+#include "common/day.h"
#define SET_STATUS_MESSAGE(args...) { \
char *msg; asprintf(&msg, args); \
diff --git a/src/client/interact.c b/src/client/interact.c
index 25401d7..1e2fb6e 100644
--- a/src/client/interact.c
+++ b/src/client/interact.c
@@ -1,4 +1,4 @@
-#include
+#include
#include
#include "client/camera.h"
#include "client/client.h"
@@ -42,7 +42,7 @@ static Mesh selection_mesh = {
void interact_init()
{
- shader_prog = shader_program_create(RESSOURCE_PATH "shaders/3d/selection", NULL);
+ shader_prog = shader_program_create(ASSET_PATH "shaders/3d/selection", NULL);
loc_MVP = glGetUniformLocation(shader_prog, "MVP"); GL_DEBUG
loc_color = glGetUniformLocation(shader_prog, "color"); GL_DEBUG
@@ -64,7 +64,7 @@ void interact_init()
.scale_type = SCALE_IMAGE,
.affect_parent_scale = false,
.text = NULL,
- .image = texture_load(RESSOURCE_PATH "textures/crosshair.png", false),
+ .image = texture_load(ASSET_PATH "textures/crosshair.png", false),
.text_color = {0.0f, 0.0f, 0.0f, 0.0f},
.bg_color = {0.0f, 0.0f, 0.0f, 0.0f},
});
diff --git a/src/client/interact.h b/src/client/interact.h
index 3c9a96d..a80b905 100644
--- a/src/client/interact.h
+++ b/src/client/interact.h
@@ -2,7 +2,7 @@
#define _INTERACT_H_
#include
-#include "node.h"
+#include "common/node.h"
#include "types.h"
extern struct InteractPointed {
diff --git a/src/client/light.c b/src/client/light.c
index 9ba99d0..a17c2d0 100644
--- a/src/client/light.c
+++ b/src/client/light.c
@@ -1,8 +1,8 @@
-#include
+#include
#include "client/camera.h"
#include "client/gl_debug.h"
#include "client/light.h"
-#include "day.h"
+#include "common/day.h"
void light_shader_locate(LightShader *shader)
{
diff --git a/src/client/mesh.c b/src/client/mesh.c
index 1674da0..75b0b10 100644
--- a/src/client/mesh.c
+++ b/src/client/mesh.c
@@ -1,5 +1,5 @@
#include
-#include
+#include
#include
#include
#include
diff --git a/src/client/model.c b/src/client/model.c
index 1755bd9..93bc773 100644
--- a/src/client/model.c
+++ b/src/client/model.c
@@ -1,5 +1,5 @@
#include
-#include
+#include
#include
#include
#include
diff --git a/src/client/model.h b/src/client/model.h
index 7254d0d..0d4d3fb 100644
--- a/src/client/model.h
+++ b/src/client/model.h
@@ -5,7 +5,7 @@
#include
#include
#include
-#include
+#include
#include
#include
#include "client/mesh.h"
diff --git a/src/client/raycast.h b/src/client/raycast.h
index eac7e17..6ba8ed9 100644
--- a/src/client/raycast.h
+++ b/src/client/raycast.h
@@ -2,7 +2,7 @@
#define _RAYCAST_H_
#include
-#include "node.h"
+#include "common/node.h"
#include "types.h"
bool raycast(v3f64 pos, v3f64 dir, f64 len, v3s32 *node_pos, NodeType *node);
diff --git a/src/client/screenshot.c b/src/client/screenshot.c
index 0a388f2..1569d14 100644
--- a/src/client/screenshot.c
+++ b/src/client/screenshot.c
@@ -1,7 +1,7 @@
#define STB_IMAGE_WRITE_IMPLEMENTATION
#include
#include
-#include
+#include
#include
#include
#include "client/game.h"
diff --git a/src/client/sky.c b/src/client/sky.c
index 101782d..d20b149 100644
--- a/src/client/sky.c
+++ b/src/client/sky.c
@@ -10,7 +10,7 @@
#include "client/sky.h"
#include "client/texture.h"
#include "client/window.h"
-#include "day.h"
+#include "common/day.h"
static GLuint sun_prog;
static GLint sun_loc_MVP;
@@ -86,24 +86,24 @@ void sky_init()
// skybox
- skybox_prog = shader_program_create(RESSOURCE_PATH "shaders/sky/skybox", NULL);
+ skybox_prog = shader_program_create(ASSET_PATH "shaders/sky/skybox", NULL);
glProgramUniform1iv(skybox_prog, glGetUniformLocation(skybox_prog, "textures"), 2, (GLint[]) {0, 1}); GL_DEBUG
skybox_loc_VP = glGetUniformLocation(skybox_prog, "VP"); GL_DEBUG
skybox_loc_daylight = glGetUniformLocation(skybox_prog, "daylight"); GL_DEBUG
- skybox_texture_day = texture_load_cubemap(RESSOURCE_PATH "textures/skybox/day", true)->txo;
- skybox_texture_night = texture_load_cubemap(RESSOURCE_PATH "textures/skybox/night", true)->txo;
+ skybox_texture_day = texture_load_cubemap(ASSET_PATH "textures/skybox/day", true)->txo;
+ skybox_texture_night = texture_load_cubemap(ASSET_PATH "textures/skybox/night", true)->txo;
skybox_mesh.data = skybox_vertices;
mesh_upload(&skybox_mesh);
// sun
- sun_prog = shader_program_create(RESSOURCE_PATH "shaders/sky/sun", NULL);
+ sun_prog = shader_program_create(ASSET_PATH "shaders/sky/sun", NULL);
sun_loc_MVP = glGetUniformLocation(sun_prog, "MVP"); GL_DEBUG
- sun_texture = texture_load(RESSOURCE_PATH "textures/sun.png", false)->txo;
+ sun_texture = texture_load(ASSET_PATH "textures/sun.png", false)->txo;
// clouds
- clouds_prog = shader_program_create(RESSOURCE_PATH "shaders/sky/clouds", NULL);
+ clouds_prog = shader_program_create(ASSET_PATH "shaders/sky/clouds", NULL);
clouds_loc_VP = glGetUniformLocation(clouds_prog, "VP"); GL_DEBUG
clouds_loc_daylight = glGetUniformLocation(clouds_prog, "daylight"); GL_DEBUG
clouds_mesh.data = clouds_vertices;
diff --git a/src/client/terrain_gfx.c b/src/client/terrain_gfx.c
index 401b42e..d8ce09f 100644
--- a/src/client/terrain_gfx.c
+++ b/src/client/terrain_gfx.c
@@ -1,6 +1,6 @@
#include
-#include
-#include
+#include
+#include
#include
#include
#include "client/client_config.h"
@@ -12,7 +12,7 @@
#include "client/light.h"
#include "client/shader.h"
#include "client/terrain_gfx.h"
-#include "facedir.h"
+#include "common/facedir.h"
typedef struct {
TerrainChunk *chunk; // input: chunk pointer
@@ -225,7 +225,7 @@ void terrain_gfx_init()
texture_units,
client_config.view_distance
);
- shader_prog = shader_program_create(RESSOURCE_PATH "shaders/3d/terrain", shader_def);
+ shader_prog = shader_program_create(ASSET_PATH "shaders/3d/terrain", shader_def);
free(shader_def);
loc_VP = glGetUniformLocation(shader_prog, "VP"); GL_DEBUG
diff --git a/src/client/terrain_gfx.h b/src/client/terrain_gfx.h
index d2a0cc9..f967505 100644
--- a/src/client/terrain_gfx.h
+++ b/src/client/terrain_gfx.h
@@ -2,7 +2,7 @@
#define _TERRAIN_GFX_H_
#include "client/cube.h"
-#include "terrain.h"
+#include "common/terrain.h"
typedef struct {
CubeVertex cube;
diff --git a/src/client/texture.c b/src/client/texture.c
index 54063fe..fb489ca 100644
--- a/src/client/texture.c
+++ b/src/client/texture.c
@@ -1,7 +1,7 @@
#define STB_IMAGE_IMPLEMENTATION
#define STB_IMAGE_RESIZE_IMPLEMENTATION
-#include
-#include
+#include
+#include
#include
#include
#include "client/client_config.h"
diff --git a/src/client/window.h b/src/client/window.h
index aae5ed6..e33fa3e 100644
--- a/src/client/window.h
+++ b/src/client/window.h
@@ -2,7 +2,7 @@
#define _WINDOW_H_
#include
-#include
+#include
#include
#include "types.h"
diff --git a/src/color.c b/src/common/color.c
similarity index 96%
rename from src/color.c
rename to src/common/color.c
index 66c5d84..e1689c7 100644
--- a/src/color.c
+++ b/src/common/color.c
@@ -1,4 +1,4 @@
-#include "color.h"
+#include "common/color.h"
static f32 hue_to_rgb(f32 p, f32 q, f32 t)
{
diff --git a/src/color.h b/src/common/color.h
similarity index 100%
rename from src/color.h
rename to src/common/color.h
diff --git a/src/config.c b/src/common/config.c
similarity index 98%
rename from src/config.c
rename to src/common/config.c
index 8f200c8..da9959e 100644
--- a/src/config.c
+++ b/src/common/config.c
@@ -2,7 +2,7 @@
#include
#include
#include
-#include "config.h"
+#include "common/config.h"
void config_read(char *path, ConfigEntry *entries, size_t num_entries)
{
diff --git a/src/config.h b/src/common/config.h
similarity index 100%
rename from src/config.h
rename to src/common/config.h
diff --git a/src/day.c b/src/common/day.c
similarity index 97%
rename from src/day.c
rename to src/common/day.c
index e28e21b..cbb9623 100644
--- a/src/day.c
+++ b/src/common/day.c
@@ -1,6 +1,6 @@
#include
#include
-#include "day.h"
+#include "common/day.h"
bool timelapse = false;
static f64 time_of_day_offset;
diff --git a/src/day.h b/src/common/day.h
similarity index 100%
rename from src/day.h
rename to src/common/day.h
diff --git a/src/dig.h b/src/common/dig.h
similarity index 100%
rename from src/dig.h
rename to src/common/dig.h
diff --git a/src/entity.h b/src/common/entity.h
similarity index 100%
rename from src/entity.h
rename to src/common/entity.h
diff --git a/src/environment.c b/src/common/environment.c
similarity index 83%
rename from src/environment.c
rename to src/common/environment.c
index 200eee7..862fdef 100644
--- a/src/environment.c
+++ b/src/common/environment.c
@@ -1,5 +1,5 @@
-#include "environment.h"
-#include "perlin.h"
+#include "common/environment.h"
+#include "common/perlin.h"
f64 get_humidity(v3s32 pos)
{
diff --git a/src/environment.h b/src/common/environment.h
similarity index 100%
rename from src/environment.h
rename to src/common/environment.h
diff --git a/src/facedir.c b/src/common/facedir.c
similarity index 80%
rename from src/facedir.c
rename to src/common/facedir.c
index e1125a9..94c14c7 100644
--- a/src/facedir.c
+++ b/src/common/facedir.c
@@ -1,4 +1,4 @@
-#include "facedir.h"
+#include "common/facedir.h"
v3s32 facedir[6] = {
{+0, +0, -1},
diff --git a/src/facedir.h b/src/common/facedir.h
similarity index 100%
rename from src/facedir.h
rename to src/common/facedir.h
diff --git a/src/interrupt.c b/src/common/interrupt.c
similarity index 96%
rename from src/interrupt.c
rename to src/common/interrupt.c
index 2b9052c..590b16f 100644
--- a/src/interrupt.c
+++ b/src/common/interrupt.c
@@ -1,7 +1,7 @@
#include
#include
#include
-#include "interrupt.h"
+#include "common/interrupt.h"
Flag interrupt;
diff --git a/src/interrupt.h b/src/common/interrupt.h
similarity index 100%
rename from src/interrupt.h
rename to src/common/interrupt.h
diff --git a/src/item.c b/src/common/item.c
similarity index 98%
rename from src/item.c
rename to src/common/item.c
index b492aa9..f589ce0 100644
--- a/src/item.c
+++ b/src/common/item.c
@@ -1,5 +1,5 @@
#include
-#include "item.h"
+#include "common/item.h"
void item_stack_initialize(ItemStack *stack)
{
diff --git a/src/item.h b/src/common/item.h
similarity index 97%
rename from src/item.h
rename to src/common/item.h
index c794006..ffefd61 100644
--- a/src/item.h
+++ b/src/common/item.h
@@ -3,7 +3,7 @@
#include
#include
-#include "dig.h"
+#include "common/dig.h"
#include "types.h"
typedef enum {
diff --git a/src/node.c b/src/common/node.c
similarity index 93%
rename from src/node.c
rename to src/common/node.c
index e79352b..b2422b8 100644
--- a/src/node.c
+++ b/src/common/node.c
@@ -1,6 +1,6 @@
-#include "dig.h"
-#include "node.h"
-#include "terrain.h"
+#include "common/dig.h"
+#include "common/node.h"
+#include "common/terrain.h"
#include "types.h"
NodeDef node_def[COUNT_NODE] = {
diff --git a/src/node.h b/src/common/node.h
similarity index 100%
rename from src/node.h
rename to src/common/node.h
diff --git a/src/common/perlin.c b/src/common/perlin.c
new file mode 100644
index 0000000..687e778
--- /dev/null
+++ b/src/common/perlin.c
@@ -0,0 +1,3 @@
+#include "common/perlin.h"
+
+s32 seed = 0;
diff --git a/src/perlin.h b/src/common/perlin.h
similarity index 96%
rename from src/perlin.h
rename to src/common/perlin.h
index 2aab5e1..4bc27a7 100644
--- a/src/perlin.h
+++ b/src/common/perlin.h
@@ -1,7 +1,7 @@
#ifndef _PERLIN_H_
#define _PERLIN_H_
-#include
+#include_next
#include "types.h"
#define U32(x) (((u32) 1 << 31) + (x))
diff --git a/src/physics.c b/src/common/physics.c
similarity index 98%
rename from src/physics.c
rename to src/common/physics.c
index 5fab114..9209790 100644
--- a/src/physics.c
+++ b/src/common/physics.c
@@ -1,5 +1,5 @@
#include
-#include "physics.h"
+#include "common/physics.h"
static aabb3f64 move_box(aabb3f32 box, v3f64 pos)
{
diff --git a/src/physics.h b/src/common/physics.h
similarity index 91%
rename from src/physics.h
rename to src/common/physics.h
index 083cc09..66d00dd 100644
--- a/src/physics.h
+++ b/src/common/physics.h
@@ -2,7 +2,7 @@
#define _PHYSICS_H_
#include
-#include "terrain.h"
+#include "common/terrain.h"
#include "types.h"
bool physics_ground(Terrain *terrain, bool collide, aabb3f32 box, v3f64 *pos, v3f64 *vel);
diff --git a/src/terrain.c b/src/common/terrain.c
similarity index 99%
rename from src/terrain.c
rename to src/common/terrain.c
index 5f7b928..907cc5a 100644
--- a/src/terrain.c
+++ b/src/common/terrain.c
@@ -5,7 +5,7 @@
#include
#include
#include
-#include "terrain.h"
+#include "common/terrain.h"
typedef struct {
v2s32 pos;
diff --git a/src/terrain.h b/src/common/terrain.h
similarity index 98%
rename from src/terrain.h
rename to src/common/terrain.h
index c6aea4e..46da156 100644
--- a/src/terrain.h
+++ b/src/common/terrain.h
@@ -5,7 +5,7 @@
#include
#include
#include
-#include "node.h"
+#include "common/node.h"
#include "types.h"
#define CHUNK_ITERATE \
diff --git a/src/debug_terrain.sh b/src/debug_terrain.sh
deleted file mode 100755
index 7da1b80..0000000
--- a/src/debug_terrain.sh
+++ /dev/null
@@ -1,3 +0,0 @@
-#!/bin/bash
-rm -f *.sqlite
-./debug.sh
diff --git a/src/mingw.cmake b/src/mingw.cmake
new file mode 100644
index 0000000..2a51e36
--- /dev/null
+++ b/src/mingw.cmake
@@ -0,0 +1,4 @@
+set(CMAKE_SYSTEM_NAME Windows)
+
+set(CMAKE_C_COMPILER i686-w64-mingw32-gcc-posix)
+set(CMAKE_CXX_COMPILER i686-w64-mingw32-g++-posix)
diff --git a/src/perlin.c b/src/perlin.c
deleted file mode 100644
index d204e48..0000000
--- a/src/perlin.c
+++ /dev/null
@@ -1,3 +0,0 @@
-#include "perlin.h"
-
-s32 seed = 0;
diff --git a/src/server/biomes.h b/src/server/biomes.h
index dce835d..ffdfb31 100644
--- a/src/server/biomes.h
+++ b/src/server/biomes.h
@@ -1,8 +1,8 @@
#ifndef _BIOMES_H_
#define _BIOMES_H_
-#include "perlin.h"
-#include "terrain.h"
+#include "common/perlin.h"
+#include "common/terrain.h"
#include "types.h"
typedef enum {
diff --git a/src/server/database.c b/src/server/database.c
index 79d1e59..d6cdbca 100644
--- a/src/server/database.c
+++ b/src/server/database.c
@@ -1,14 +1,14 @@
-#include
+#include
#include
#include
#include
#include
#include
-#include "day.h"
+#include "common/day.h"
+#include "common/perlin.h"
#include "server/database.h"
#include "server/server_node.h"
#include "server/server_terrain.h"
-#include "perlin.h"
static sqlite3 *terrain_database;
static sqlite3 *meta_database;
diff --git a/src/server/database.h b/src/server/database.h
index 754b6b9..98c5c0e 100644
--- a/src/server/database.h
+++ b/src/server/database.h
@@ -2,7 +2,7 @@
#define _DATABASE_H_
#include
-#include "terrain.h"
+#include "common/terrain.h"
#include "types.h"
bool database_init(); // open and initialize SQLite3 databases
diff --git a/src/server/schematic.c b/src/server/schematic.c
index af92cfa..8e105d2 100644
--- a/src/server/schematic.c
+++ b/src/server/schematic.c
@@ -1,9 +1,9 @@
-#include
+#include
#include
#include
+#include "common/terrain.h"
#include "server/schematic.h"
#include "server/server_node.h"
-#include "terrain.h"
void schematic_load(List *schematic, const char *path, SchematicMapping *mappings, size_t num_mappings)
{
diff --git a/src/server/schematic.h b/src/server/schematic.h
index 213645e..06631bf 100644
--- a/src/server/schematic.h
+++ b/src/server/schematic.h
@@ -4,7 +4,7 @@
#include
#include
#include
-#include "node.h"
+#include "common/node.h"
#include "server/server_terrain.h"
#include "types.h"
diff --git a/src/server/server.c b/src/server/server.c
index d856512..be3605e 100644
--- a/src/server/server.c
+++ b/src/server/server.c
@@ -4,7 +4,7 @@
#include
#include
#include
-#include "interrupt.h"
+#include "common/interrupt.h"
#include "server/database.h"
#include "server/server.h"
#include "server/server_item.h"
diff --git a/src/server/server_config.c b/src/server/server_config.c
index 242a100..2911f7a 100644
--- a/src/server/server_config.c
+++ b/src/server/server_config.c
@@ -1,4 +1,4 @@
-#include "config.h"
+#include "common/config.h"
#include "server/server_config.h"
struct ServerConfig server_config = {
diff --git a/src/server/server_item.c b/src/server/server_item.c
index 70c4c67..18fb36c 100644
--- a/src/server/server_item.c
+++ b/src/server/server_item.c
@@ -1,5 +1,5 @@
#include
-#include "node.h"
+#include "common/node.h"
#include "server/server_item.h"
#include "server/server_node.h"
#include "server/server_terrain.h"
diff --git a/src/server/server_item.h b/src/server/server_item.h
index 9fe5f2d..4163078 100644
--- a/src/server/server_item.h
+++ b/src/server/server_item.h
@@ -2,7 +2,7 @@
#define _SERVER_ITEM_H_
#include
-#include "item.h"
+#include "common/item.h"
#include "server/server_player.h"
#include "types.h"
diff --git a/src/server/server_node.h b/src/server/server_node.h
index 045ffcc..fadb8ee 100644
--- a/src/server/server_node.h
+++ b/src/server/server_node.h
@@ -1,7 +1,7 @@
#ifndef _SERVER_NODE_H_
#define _SERVER_NODE_H_
-#include "terrain.h"
+#include "common/terrain.h"
#include "types.h"
TerrainNode server_node_create(NodeType type);
diff --git a/src/server/server_player.c b/src/server/server_player.c
index c024915..5d0eb10 100644
--- a/src/server/server_player.c
+++ b/src/server/server_player.c
@@ -3,9 +3,9 @@
#include
#include
#include
-#include "day.h"
-#include "entity.h"
-#include "perlin.h"
+#include "common/day.h"
+#include "common/entity.h"
+#include "common/perlin.h"
#include "server/database.h"
#include "server/server_config.h"
#include "server/server_player.h"
diff --git a/src/server/server_player.h b/src/server/server_player.h
index afd7119..956258b 100644
--- a/src/server/server_player.h
+++ b/src/server/server_player.h
@@ -5,7 +5,7 @@
#include
#include
#include
-#include "item.h"
+#include "common/item.h"
#include "types.h"
typedef struct {
diff --git a/src/server/server_terrain.c b/src/server/server_terrain.c
index 6078216..4f2ede3 100644
--- a/src/server/server_terrain.c
+++ b/src/server/server_terrain.c
@@ -8,14 +8,14 @@
#include
#include
#include
-#include "interrupt.h"
+#include "common/interrupt.h"
+#include "common/terrain.h"
#include "server/database.h"
#include "server/schematic.h"
#include "server/server_config.h"
#include "server/server_node.h"
#include "server/server_terrain.h"
#include "server/terrain_gen.h"
-#include "terrain.h"
// this file is too long
Terrain *server_terrain;
@@ -168,7 +168,7 @@ static void generate_spawn_hut()
list_ini(&changed_chunks);
List spawn_hut;
- schematic_load(&spawn_hut, RESSOURCE_PATH "schematics/spawn_hut.txt", (SchematicMapping[]) {
+ schematic_load(&spawn_hut, ASSET_PATH "schematics/spawn_hut.txt", (SchematicMapping[]) {
{
.color = {0x7d, 0x54, 0x35},
.type = NODE_OAK_WOOD,
diff --git a/src/server/server_terrain.h b/src/server/server_terrain.h
index 4cd2ce3..8c0104e 100644
--- a/src/server/server_terrain.h
+++ b/src/server/server_terrain.h
@@ -3,8 +3,8 @@
#include
#include
+#include "common/terrain.h"
#include "server/server_player.h"
-#include "terrain.h"
#include "types.h"
typedef enum {
diff --git a/src/server/terrain_gen.c b/src/server/terrain_gen.c
index b913167..74d1403 100644
--- a/src/server/terrain_gen.c
+++ b/src/server/terrain_gen.c
@@ -1,8 +1,8 @@
#include
#include
#include
-#include "environment.h"
-#include "perlin.h"
+#include "common/environment.h"
+#include "common/perlin.h"
#include "server/biomes.h"
#include "server/server_node.h"
#include "server/server_terrain.h"
diff --git a/src/server/terrain_gen.h b/src/server/terrain_gen.h
index ce07148..ca7d8ce 100644
--- a/src/server/terrain_gen.h
+++ b/src/server/terrain_gen.h
@@ -1,8 +1,8 @@
#ifndef _TERRAIN_GEN_H_
#define _TERRAIN_GEN_H_
+#include "common/terrain.h"
#include "server/server_terrain.h"
-#include "terrain.h"
s32 terrain_gen_get_base_height(v2s32 pos);
void terrain_gen_chunk(TerrainChunk *chunk, List *changed_chunks); // generate a chunk (does not manage chunk state or threading)
diff --git a/src/server/tree.h b/src/server/tree.h
index 2eb08aa..fbce233 100644
--- a/src/server/tree.h
+++ b/src/server/tree.h
@@ -3,8 +3,8 @@
#include
#include
-#include "perlin.h"
-#include "terrain.h"
+#include "common/perlin.h"
+#include "common/terrain.h"
#include "types.h"
#define NUM_TREES 3
diff --git a/src/server/tree_physics.c b/src/server/tree_physics.c
index 7db6a10..b1da431 100644
--- a/src/server/tree_physics.c
+++ b/src/server/tree_physics.c
@@ -7,7 +7,7 @@
#include
#include
#include
-#include "facedir.h"
+#include "common/facedir.h"
#include "server/server_node.h"
#include "server/server_terrain.h"
#include "server/tree_physics.h"
diff --git a/src/server/voxel_depth_search.c b/src/server/voxel_depth_search.c
index edf9fb5..b775025 100644
--- a/src/server/voxel_depth_search.c
+++ b/src/server/voxel_depth_search.c
@@ -1,5 +1,5 @@
#include
-#include "voxel_depth_search.h"
+#include "server/voxel_depth_search.h"
v3s32 dirs[6] = {
{+0, -1, +0}, // this is commonly used to find ground, search downwards first
diff --git a/src/server/voxel_procedural.c b/src/server/voxel_procedural.c
index 2eb9bf8..4adce68 100644
--- a/src/server/voxel_procedural.c
+++ b/src/server/voxel_procedural.c
@@ -1,7 +1,7 @@
#include
#include
-#include "color.h"
-#include "perlin.h"
+#include "common/color.h"
+#include "common/perlin.h"
#include "server/terrain_gen.h"
#include "server/voxel_procedural.h"
diff --git a/src/server/voxel_procedural.h b/src/server/voxel_procedural.h
index 6de0f1e..6d753f0 100644
--- a/src/server/voxel_procedural.h
+++ b/src/server/voxel_procedural.h
@@ -2,7 +2,7 @@
#define _VOXEL_PROCEDURAL_H_
#include
-#include
+#include
#include "server/server_terrain.h"
#include "types.h"
diff --git a/upload.sh b/upload.sh
index fa554b9..214981b 100755
--- a/upload.sh
+++ b/upload.sh
@@ -1,13 +1,18 @@
#!/bin/bash
+echo "Snapshot uploading temporarily disabled"
+exit
+
VERSION=`git tag --points-at HEAD`
IS_RELEASE="1"
if [[ $VERSION = "" ]]; then
VERSION=`git rev-parse --short HEAD`
IS_RELEASE="0"
fi
+
curl -f -i -X POST -H "Content-Type: multipart/form-data" \
-F "secret=$SECRET" \
-F "name=$VERSION" \
-F "is_release=$IS_RELEASE" \
- -F "build=@dragonblocks_alpha-$VERSION.zip" \
+ -F "ubuntu=@dragonblocks_alpha-$VERSION.zip" \
+ -F "windows=@dragonblocks_alpha-win64-$VERSION.zip" \
https://elidragon.tk/dragonblocks_alpha/upload.php