code: fixes for macos

isolation_bkp/dynres
Vladyslav Hrytsenko 2021-05-10 09:28:56 +03:00
parent 68f274580a
commit 5254455872
14 changed files with 45 additions and 20 deletions

View File

@ -11,3 +11,14 @@ endfunction()
macro(populate_pkt_srcs) macro(populate_pkt_srcs)
file(GLOB PKT_SRCS ../../common/packets/*.h ../../common/packets/*.c) file(GLOB PKT_SRCS ../../common/packets/*.h ../../common/packets/*.c)
endmacro() endmacro()
macro(use_cxx11)
if (CMAKE_VERSION VERSION_LESS "3.1")
if (CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=gnu++11")
endif ()
else ()
set(CMAKE_CXX_STANDARD 11)
endif ()
endmacro(use_cxx11)

View File

@ -2,7 +2,9 @@
#include "zpl.h" #include "zpl.h"
#include "system.h" #include "system.h"
#include "game.h" #include "game.h"
#include "entity.h"
#include "utils/options.h" #include "utils/options.h"
#include "signal_handling.h"
#include "flecs/flecs.h" #include "flecs/flecs.h"
#include "flecs/flecs_dash.h" #include "flecs/flecs_dash.h"

View File

@ -10,6 +10,7 @@
#include "network.h" #include "network.h"
#include "packet.h" #include "packet.h"
#include "world/world.h"
#define NETWORK_UPDATE_DELAY 0.100 #define NETWORK_UPDATE_DELAY 0.100

View File

@ -233,18 +233,17 @@ void DEBUG_draw_entities(uint64_t key, entity_view * data) {
} }
} }
void lerp_entity_positions(uint64_t key, entity_view data) { void lerp_entity_positions(uint64_t key, entity_view *data) {
world_view *view = game_world_view_get_active(); world_view *view = game_world_view_get_active();
if (data.flag == EFLAG_INTERP) { if (data->flag == EFLAG_INTERP) {
entity_view *e = entity_view_get(&view->entities, key);
#if 1 #if 1
e->x = smooth_val(e->x, e->tx, view->delta_time[e->layer_id]); data->x = smooth_val(data->x, data->tx, view->delta_time[data->layer_id]);
e->y = smooth_val(e->y, e->ty, view->delta_time[e->layer_id]); data->y = smooth_val(data->y, data->ty, view->delta_time[data->layer_id]);
#else #else
e->x = e->tx; data->x = data->tx;
e->y = e->ty; data->y = data->ty;
#endif #endif
} }
} }

View File

@ -1,5 +1,4 @@
#include "platform.h" #include "platform.h"
#include "zpl.h"
#include <stdio.h> #include <stdio.h>
uint8_t is_running; uint8_t is_running;

View File

@ -5,7 +5,7 @@
#include "utils/options.h" #include "utils/options.h"
void generate_minimap(int32_t seed, uint16_t block_size, uint16_t chunk_size, uint16_t world_size) { void generate_minimap(int32_t seed, uint16_t block_size, uint16_t chunk_size, uint16_t world_size) {
world_init(seed, block_size, chunk_size, world_size, NULL, NULL); world_init(seed, block_size, chunk_size, world_size);
uint8_t const *world; uint8_t const *world;
uint32_t world_length = chunk_size * world_size; uint32_t world_length = chunk_size * world_size;

View File

@ -114,6 +114,7 @@ typedef struct pkt_desc {
} pkt_desc; } pkt_desc;
int32_t pkt_unpack_struct(cw_unpack_context *uc, pkt_desc *desc, void *raw_blob, uint32_t blob_size); int32_t pkt_unpack_struct(cw_unpack_context *uc, pkt_desc *desc, void *raw_blob, uint32_t blob_size);
int32_t pkt_pack_struct(cw_pack_context *pc, pkt_desc *desc, void *raw_blob, uint32_t blob_size);
static inline int32_t pkt_msg_decode(pkt_header *header, pkt_desc* desc, uint32_t args, void *raw_blob, uint32_t blob_size) { static inline int32_t pkt_msg_decode(pkt_header *header, pkt_desc* desc, uint32_t args, void *raw_blob, uint32_t blob_size) {
cw_unpack_context uc = {0}; cw_unpack_context uc = {0};

View File

@ -5,6 +5,7 @@
#include "game.h" #include "game.h"
#include "entity_view.h" #include "entity_view.h"
#include "camera.h" #include "camera.h"
#include "player.h"
#include "modules/net.h" #include "modules/net.h"

View File

@ -2,7 +2,7 @@
#include "system.h" #include "system.h"
#include "packet_utils.h" #include "packet_utils.h"
size_t pkt_send_librg_update_encode(void *data, int32_t data_length); size_t pkt_send_librg_update_encode(void *data, int32_t data_length, uint8_t layer_id);
PKT_HANDLER_PROC(pkt_send_librg_update_handler); PKT_HANDLER_PROC(pkt_send_librg_update_handler);

View File

@ -1,4 +1,8 @@
#pragma once #pragma once
#include <stdint.h> #include <stdint.h>
#include <stddef.h>
#include <inttypes.h> #include <inttypes.h>
#define ZPL_NANO
#include "zpl.h"

View File

@ -1,8 +1,8 @@
#include "zpl.h"
#include "modules/controllers.h" #include "modules/controllers.h"
#include "modules/general.h" #include "modules/general.h"
#include "modules/physics.h" #include "modules/physics.h"
#include "zpl.h"
#define PLR_MOVE_SPEED 50.0 #define PLR_MOVE_SPEED 50.0
#define PLR_MOVE_SPEED_MULT 4.0 #define PLR_MOVE_SPEED_MULT 4.0

View File

@ -1,6 +1,6 @@
#include "zpl.h"
#include "modules/physics.h" #include "modules/physics.h"
#include "world/world.h" #include "world/world.h"
#include "zpl.h"
#define PHY_WALK_DRAG 0.12 #define PHY_WALK_DRAG 0.12

View File

@ -1,3 +1,5 @@
use_cxx11()
file(GLOB SRCS *.h file(GLOB SRCS *.h
flecs.c flecs.c
flecs_json.c flecs_json.c
@ -11,4 +13,5 @@ file(GLOB SRCS *.h
flecs-os_api-stdcpp.cpp flecs-os_api-stdcpp.cpp
flecs_components_http.c flecs_components_http.c
) )
add_library(flecs-bundle STATIC ${SRCS}) add_library(flecs-bundle STATIC ${SRCS})

16
code/vendors/zpl.h vendored
View File

@ -361,7 +361,7 @@ License:
#define ZPL_VERSION_MAJOR 14 #define ZPL_VERSION_MAJOR 14
#define ZPL_VERSION_MINOR 1 #define ZPL_VERSION_MINOR 1
#define ZPL_VERSION_PATCH 0 #define ZPL_VERSION_PATCH 2
#define ZPL_VERSION_PRE "" #define ZPL_VERSION_PRE ""
// file: zpl_hedley.h // file: zpl_hedley.h
@ -2316,8 +2316,8 @@ License:
# define ZPL_DEF_INLINE # define ZPL_DEF_INLINE
# define ZPL_IMPL_INLINE # define ZPL_IMPL_INLINE
# else # else
# define ZPL_DEF_INLINE ZPL_ALWAYS_INLINE # define ZPL_DEF_INLINE static
# define ZPL_IMPL_INLINE ZPL_INLINE # define ZPL_IMPL_INLINE static inline
# endif # endif
#endif #endif
@ -9961,13 +9961,16 @@ License:
#define ZPL__FILE_STREAM_FD_MAGIC 37 #define ZPL__FILE_STREAM_FD_MAGIC 37
ZPL_ALWAYS_INLINE zpl_file_descriptor zpl__file_stream_fd_make(zpl__memory_fd* d) { ZPL_DEF_INLINE zpl_file_descriptor zpl__file_stream_fd_make(zpl__memory_fd* d);
ZPL_DEF_INLINE zpl__memory_fd *zpl__file_stream_from_fd(zpl_file_descriptor fd);
ZPL_IMPL_INLINE zpl_file_descriptor zpl__file_stream_fd_make(zpl__memory_fd* d) {
zpl_file_descriptor fd = {0}; zpl_file_descriptor fd = {0};
fd.p = (void*)d; fd.p = (void*)d;
return fd; return fd;
} }
ZPL_ALWAYS_INLINE zpl__memory_fd *zpl__file_stream_from_fd(zpl_file_descriptor fd) { ZPL_IMPL_INLINE zpl__memory_fd *zpl__file_stream_from_fd(zpl_file_descriptor fd) {
zpl__memory_fd *d = (zpl__memory_fd*)fd.p; zpl__memory_fd *d = (zpl__memory_fd*)fd.p;
ZPL_ASSERT(d->magic == ZPL__FILE_STREAM_FD_MAGIC); ZPL_ASSERT(d->magic == ZPL__FILE_STREAM_FD_MAGIC);
return d; return d;
@ -17437,9 +17440,10 @@ License:
static ZPL_ALWAYS_INLINE zpl_b32 zpl__json_is_assign_char(char c) { return !!zpl_strchr(":=|", c); } static ZPL_ALWAYS_INLINE zpl_b32 zpl__json_is_assign_char(char c) { return !!zpl_strchr(":=|", c); }
static ZPL_ALWAYS_INLINE zpl_b32 zpl__json_is_delim_char(char c) { return !!zpl_strchr(",|\n", c); } static ZPL_ALWAYS_INLINE zpl_b32 zpl__json_is_delim_char(char c) { return !!zpl_strchr(",|\n", c); }
ZPL_DEF_INLINE zpl_b32 zpl__json_validate_name(char const *str, char *err);
#define jx(x) !zpl_char_is_hex_digit(str[x]) #define jx(x) !zpl_char_is_hex_digit(str[x])
ZPL_ALWAYS_INLINE zpl_b32 zpl__json_validate_name(char const *str, char *err) { ZPL_IMPL_INLINE zpl_b32 zpl__json_validate_name(char const *str, char *err) {
while (*str) { while (*str) {
/* todo: refactor name validation. */ /* todo: refactor name validation. */
if ((str[0] == '\\' && !zpl_char_is_control(str[1])) && if ((str[0] == '\\' && !zpl_char_is_control(str[1])) &&