]> git.lizzy.rs Git - dragonblocks_alpha.git/commitdiff
Merge branch 'master' of github.com:dragonblocks/dragonblocks_alpha
authorElias Fleckenstein <eliasfleckenstein@web.de>
Mon, 17 Jan 2022 11:57:11 +0000 (12:57 +0100)
committerElias Fleckenstein <eliasfleckenstein@web.de>
Mon, 17 Jan 2022 11:57:11 +0000 (12:57 +0100)
.gitmodules
BUILDING.md
README.md
src/CMakeLists.txt
src/client/shader.c
src/client/window.c
src/server/server_map.c
src/util.c
src/util.h

index 9722994ba134973f3d7670ac4550853364ed6ae9..bb962ba6335e5f4fddb7f06b2bec99adc9a4ca5e 100644 (file)
@@ -12,7 +12,7 @@
        url = https://github.com/dragonblocks/dragontype
 [submodule "deps/endian.h"]
        path = deps/endian.h
-       url = https://github.com/mikepb/endian.h
+       url = https://github.com/dragonblocks/endian.h
 [submodule "deps/dragonport"]
        path = deps/dragonport
        url = https://github.com/dragonblocks/dragonport
index 8ef0c3e77390cd696a820ab94c470483e2359209..0b110cb9f64bd9a7cfa6f2bc349d8ef8c4462476 100644 (file)
@@ -8,21 +8,26 @@ git clone --recurse-submodules https://github.com/dragonblocks/dragonblocks_alph
 
 ## Dependencies
 To build anything you need CMake. 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
+sudo apt install build-essential cmake zlib1g-dev libgl1-mesa-dev libglfw3-dev libglew-dev libfreetype-dev libsqlite3-dev
 ```
 
-The development versions of OpenGL, GLFW3, GLEW and Freetype are required to build the client.
+FreeBSD:
 
-```bash
-sudo apt install libgl1-mesa-dev libglfw3-dev libglew-dev libfreetype-dev
+```csh
+sudo pkg install cmake gcc lzlib mesa-devel glfw glew freetype sqlite3
 ```
 
-For building the server the SQLite3 development library is required.
+OpenBSD:
 
-```bash
-sudo apt install libsqlite3-dev
+```sh
+sudo pkg_add cmake lzlib glfw glew freetype sqlite3
 ```
 
 ## Building a debug build
index e9effe3be2ebdf864fe45ad17ec87e65feaae436..e3ff937a8864ecc7f73b171f908166a301e1851a 100644 (file)
--- a/README.md
+++ b/README.md
@@ -37,22 +37,27 @@ or alternatively:
 
 ## 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 libgl1-mesa-dri libglfw3 libglew2.1 libfreetype6
+sudo apt install zlib1g libgl1-mesa-dri libglfw3 libglew2.1 libfreetype6 libsqlite3-0
+
 ```
 
-The server depends on SQLite3.
+FreeBSD:
 
-```bash
-sudo apt install libsqlite3-0
+```csh
+sudo pkg install lzlib mesa-dri glfw glew freetype sqlite3
 ```
 
-both the client and the server depend on ZLib.
+OpenBSD:
 
-```bash
-sudo apt install zlib1g
+```sh
+sudo pkg_add lzlib glfw glew freetype sqlite3
 ```
 
 ## Setup Requirements
index 71daf3eb69f22f66d412a78f3313a3d2483142c4..0adb599d915c118d2c7d9ad405172cd39b7a8c32 100644 (file)
@@ -27,7 +27,17 @@ include_directories(BEFORE
        ${CMAKE_SOURCE_DIR}
 )
 
-add_compile_options(-Wall -Wextra -Wpedantic -Werror -fmax-errors=4)
+if ("${CMAKE_SYSTEM_NAME}" STREQUAL "FreeBSD" OR "${CMAKE_SYSTEM_NAME}" STREQUAL "OpenBSD")
+       link_directories("/usr/local/lib")
+       include_directories("/usr/local/include")
+endif()
+
+if ("${CMAKE_SYSTEM_NAME}" STREQUAL "OpenBSD")
+       link_directories("/usr/X11R6/lib")
+       include_directories("/usr/X11R6/include")
+endif()
+
+add_compile_options(-Wall -Wextra -Wpedantic -Werror)
 
 set(DEPS_SOURCES
        "${DEPS_DIR}/dragontype/array.c"
index 0f5b98696c88222ebd12915636b912d0aa3041a8..533ecc8a35f641b819edd908c4ce8f08aff240b5 100644 (file)
@@ -47,7 +47,7 @@ static GLuint compile_and_attach_shader(GLenum type, const char *path, const cha
 
        GLuint id = glCreateShader(type);
 
-       const char *version = "#version 460 core\n";
+       const char *version = "#version 420 core\n";
 
        const char *code_list[3] = {
                version,
index 29cab14f62d951b6504183e2bcbb6496fac9e224..c20a0a6c18f3b94dd3c81f6adc0d09181a6b20fb 100644 (file)
@@ -65,7 +65,7 @@ bool window_init(int width, int height)
 
        glfwWindowHint(GLFW_SAMPLES, 8);
        glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 4);
-       glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 6);
+       glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 2);
        glfwWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE);
 
        window.handle = glfwCreateWindow(width, height, "Dragonblocks", NULL, NULL);
index f7cb57d16d136d0e76621361ca2aa1400eb0a265..a6eb81f4d0b7f5c11486024565af14a08902de82 100644 (file)
@@ -374,7 +374,7 @@ void server_map_prepare_spawn()
        } else {
                s32 spawn_height = -1;
 
-               while (map_get_node(server_map.map, (v3s32) {0, ++spawn_height, 0}).type != NODE_AIR);
+               while (map_get_node(server_map.map, (v3s32) {0, ++spawn_height, 0}).type != NODE_AIR)
                        ;
 
                server_map.spawn_height = spawn_height + 5;
index 56640171f958c2cac5c934c75c4c704ae8e208fa..3836e02bfeb485456b6b275424b2a76749bb3234 100644 (file)
@@ -98,14 +98,14 @@ bool my_decompress(const char *compressed, size_t compressed_size, void *decompr
        inflate(&stream, Z_NO_FLUSH);
        inflateEnd(&stream);
 
-       return stream.total_out == expected_decompressed_size;
+       return (size_t) stream.total_out == expected_decompressed_size;
 }
 
 // return true if a player is close enough to a block to access it
 bool within_simulation_distance(v3f64 player_pos, v3s32 block_pos, u32 simulation_distance)
 {
        v3s32 player_block_pos = map_node_to_block_pos((v3s32) {player_pos.x, player_pos.y, player_pos.z}, NULL);
-       return abs(player_block_pos.x - block_pos.x) <= simulation_distance && abs(player_block_pos.y - block_pos.y) <= simulation_distance && abs(player_block_pos.z - block_pos.z) <= simulation_distance;
+       return abs(player_block_pos.x - block_pos.x) <= (s32) simulation_distance && abs(player_block_pos.y - block_pos.y) <= (s32) simulation_distance && abs(player_block_pos.z - block_pos.z) <= (s32) simulation_distance;
 }
 
 f64 clamp(f64 v, f64 min, f64 max)
index cdb99657afe8c8eea12fd80f95fa28c847a61bc1..e9ff1218df6efe397ffd8a24c827b154102b4b90 100644 (file)
@@ -6,7 +6,10 @@
 #include <winsock2.h>
 #include <ws2tcpip.h>
 #else
+#include <sys/types.h>
+#include <sys/socket.h>
 #include <arpa/inet.h>
+#include <netinet/in.h>
 #endif
 #include <dragontype/number.h>