first first steps towards isolated game code
parent
ba1e9bbaa7
commit
b3589bac81
|
@ -0,0 +1,50 @@
|
|||
file(GLOB PKT_SRCS src/packets/*.h src/packets/*.c)
|
||||
|
||||
add_library(eco2d-foundation STATIC
|
||||
src/core/game.c
|
||||
src/core/camera.c
|
||||
|
||||
src/platform/platform_raylib.c
|
||||
src/platform/signal_handling.c
|
||||
src/platform/profiler.c
|
||||
|
||||
src/ents/items.c
|
||||
src/ents/entity.c
|
||||
src/ents/player.c
|
||||
src/ents/vehicle.c
|
||||
src/ents/storage.c
|
||||
src/ents/device.c
|
||||
|
||||
src/pkt/packet.c
|
||||
|
||||
src/debug/debug_ui.c
|
||||
src/debug/debug_draw.c
|
||||
|
||||
src/utils/options.c
|
||||
src/utils/compress.c
|
||||
|
||||
src/net/network_enet.c
|
||||
|
||||
src/world/blocks.c
|
||||
src/world/perlin.c
|
||||
src/world/world.c
|
||||
src/world/world_view.c
|
||||
src/world/entity_view.c
|
||||
src/world/prediction.c
|
||||
src/world/worldgen/worldgen_test.c
|
||||
|
||||
src/gen/assets.c
|
||||
src/gen/texgen.c
|
||||
|
||||
src/ecs/systems.c
|
||||
src/ecs/components.c
|
||||
|
||||
${PKT_SRCS}
|
||||
)
|
||||
|
||||
target_compile_definitions(eco2d-foundation PRIVATE CLIENT)
|
||||
include_directories(src ../modules ../../art/gen)
|
||||
target_link_libraries(eco2d-foundation raylib cwpack flecs-bundle vendors-bundle)
|
||||
target_compile_options(eco2d-foundation PRIVATE -Werror -Wall -Wextra -Wno-unused-function -Wno-unknown-pragmas -Wno-unused-variable -Wno-unused-parameter)
|
||||
|
||||
link_system_libs(eco2d-foundation)
|
|
@ -1,8 +1,8 @@
|
|||
#include "zpl.h"
|
||||
#include "camera.h"
|
||||
#include "platform.h"
|
||||
#include "entity_view.h"
|
||||
#include "game.h"
|
||||
#include "core/camera.h"
|
||||
#include "platform/platform.h"
|
||||
#include "world/entity_view.h"
|
||||
#include "core/game.h"
|
||||
|
||||
#define CAMERA_LERP_FACTOR 11.2f
|
||||
|
|
@ -1,5 +1,5 @@
|
|||
#pragma once
|
||||
#include "system.h"
|
||||
#include "platform/system.h"
|
||||
|
||||
typedef enum {
|
||||
CAMERA_MODE_STATIONARY,
|
|
@ -1,21 +1,21 @@
|
|||
#include "game.h"
|
||||
#include "core/game.h"
|
||||
#include "zpl.h"
|
||||
#include "platform.h"
|
||||
#include "platform/platform.h"
|
||||
#include "world/world.h"
|
||||
#include "packet.h"
|
||||
#include "signal_handling.h"
|
||||
#include "network.h"
|
||||
#include "entity.h"
|
||||
#include "world_view.h"
|
||||
#include "entity_view.h"
|
||||
#include "camera.h"
|
||||
#include "profiler.h"
|
||||
#include "pkt/packet.h"
|
||||
#include "platform/signal_handling.h"
|
||||
#include "net/network.h"
|
||||
#include "ents/entity.h"
|
||||
#include "world/world_view.h"
|
||||
#include "world/entity_view.h"
|
||||
#include "core/camera.h"
|
||||
#include "platform/profiler.h"
|
||||
|
||||
#include "flecs/flecs_os_api_stdcpp.h"
|
||||
#include "flecs/flecs.h"
|
||||
|
||||
#include "modules/components.h"
|
||||
#include "modules/systems.h"
|
||||
#include "ecs/components.h"
|
||||
#include "ecs/systems.h"
|
||||
|
||||
#include "packets/pkt_00_init.h"
|
||||
#include "packets/pkt_01_welcome.h"
|
|
@ -1,6 +1,6 @@
|
|||
#pragma once
|
||||
#include "system.h"
|
||||
#include "world_view.h"
|
||||
#include "platform/system.h"
|
||||
#include "world/world_view.h"
|
||||
#include "packets/pkt_send_keystate.h"
|
||||
|
||||
typedef enum {
|
|
@ -1,5 +1,5 @@
|
|||
#include "debug_draw.h"
|
||||
#include "game.h"
|
||||
#include "debug/debug_draw.h"
|
||||
#include "core/game.h"
|
||||
|
||||
static debug_draw_queue draw_queue = {0};
|
||||
|
|
@ -1,5 +1,5 @@
|
|||
#pragma once
|
||||
#include "system.h"
|
||||
#include "platform/system.h"
|
||||
|
||||
// NOTE(zaklaus): Debug drawing queue
|
||||
|
|
@ -1,6 +1,6 @@
|
|||
#include "debug_replay.h"
|
||||
#include "camera.h"
|
||||
#include "entity.h"
|
||||
#include "debug/debug_replay.h"
|
||||
#include "core/camera.h"
|
||||
#include "ents/entity.h"
|
||||
|
||||
#include "cwpack/cwpack.h"
|
||||
|
|
@ -1,6 +1,6 @@
|
|||
#pragma once
|
||||
#include "system.h"
|
||||
#include "platform/system.h"
|
||||
#include "packets/pkt_send_keystate.h"
|
||||
|
||||
void debug_replay_record_keystate(pkt_send_keystate state);
|
||||
void debug_replay_update(void);
|
||||
void debug_replay_update(void);
|
|
@ -1,13 +1,13 @@
|
|||
#include "debug_ui.h"
|
||||
#include "debug_draw.h"
|
||||
#include "debug/debug_ui.h"
|
||||
#include "debug/debug_draw.h"
|
||||
#include "raylib.h"
|
||||
#include "vehicle.h"
|
||||
#include "camera.h"
|
||||
#include "ents/vehicle.h"
|
||||
#include "core/camera.h"
|
||||
#include "world/world.h"
|
||||
#include "game.h"
|
||||
#include "core/game.h"
|
||||
#include "sfd.h"
|
||||
|
||||
#include "modules/components.h"
|
||||
#include "ecs/components.h"
|
||||
|
||||
typedef enum {
|
||||
DITEM_RAW,
|
||||
|
@ -82,10 +82,10 @@ typedef struct debug_item {
|
|||
static void UIDrawText(const char *text, float posX, float posY, int fontSize, Color color);
|
||||
static int UIMeasureText(const char *text, int fontSize);
|
||||
|
||||
#include "debug_replay.c"
|
||||
#include "debug/debug_replay.c"
|
||||
|
||||
#include "debug_ui_actions.c"
|
||||
#include "debug_ui_widgets.c"
|
||||
#include "debug/debug_ui_actions.c"
|
||||
#include "debug/debug_ui_widgets.c"
|
||||
|
||||
static debug_item items[] = {
|
||||
{
|
|
@ -1,5 +1,5 @@
|
|||
#pragma once
|
||||
#include "system.h"
|
||||
#include "platform/system.h"
|
||||
#include "raylib.h"
|
||||
|
||||
void debug_draw(void);
|
|
@ -1,7 +1,7 @@
|
|||
#include "debug_ui.h"
|
||||
#include "debug/debug_ui.h"
|
||||
#include "world/blocks.h"
|
||||
#include "items.h"
|
||||
#include "network.h"
|
||||
#include "ents/items.h"
|
||||
#include "net/network.h"
|
||||
|
||||
void
|
||||
ActExitGame(void) {
|
|
@ -1,8 +1,8 @@
|
|||
#include "debug_ui.h"
|
||||
#include "debug/debug_ui.h"
|
||||
#include "raylib.h"
|
||||
#include "platform.h"
|
||||
#include "network.h"
|
||||
#include "profiler.h"
|
||||
#include "platform/platform.h"
|
||||
#include "net/network.h"
|
||||
#include "platform/profiler.h"
|
||||
|
||||
//~ NOTE(zaklaus): helpers
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
#include "modules/components.h"
|
||||
#include "ecs/components.h"
|
||||
|
||||
ECS_COMPONENT_DECLARE(Vector2D);
|
||||
ECS_COMPONENT_DECLARE(Position);
|
|
@ -1,4 +1,4 @@
|
|||
#include "items.h"
|
||||
#include "ents/items.h"
|
||||
|
||||
#define ITEM_PICK_RADIUS 25.0f
|
||||
#define ITEM_MERGER_RADIUS 75.0f
|
|
@ -1,4 +1,4 @@
|
|||
#include "entity.h"
|
||||
#include "ents/entity.h"
|
||||
|
||||
#define PLR_MOVE_SPEED 800.0f
|
||||
#define PLR_MOVE_SPEED_MULT 1.5f
|
|
@ -1,5 +1,5 @@
|
|||
#include "debug_draw.h"
|
||||
#include "entity.h"
|
||||
#include "debug/debug_draw.h"
|
||||
#include "ents/entity.h"
|
||||
|
||||
#define VEH_ENTER_RADIUS 45.0f
|
||||
|
|
@ -1,20 +1,20 @@
|
|||
#include "zpl.h"
|
||||
#include "modules/systems.h"
|
||||
#include "modules/components.h"
|
||||
#include "ecs/systems.h"
|
||||
#include "ecs/components.h"
|
||||
#include "world/world.h"
|
||||
#include "world/blocks.h"
|
||||
#include "profiler.h"
|
||||
#include "debug_draw.h"
|
||||
#include "game.h"
|
||||
#include "platform/profiler.h"
|
||||
#include "debug/debug_draw.h"
|
||||
#include "core/game.h"
|
||||
|
||||
#define PHY_BLOCK_COLLISION 1
|
||||
#define PHY_WALK_DRAG 4.23f
|
||||
#define PHY_LOOKAHEAD(x) (zpl_sign(x)*16.0f)
|
||||
|
||||
#include "source/system_onfoot.c"
|
||||
#include "source/system_demo.c"
|
||||
#include "source/system_vehicle.c"
|
||||
#include "source/system_items.c"
|
||||
#include "modules/system_onfoot.c"
|
||||
#include "modules/system_demo.c"
|
||||
#include "modules/system_vehicle.c"
|
||||
#include "modules/system_items.c"
|
||||
|
||||
static inline float physics_correction(float x, float vx, float bounce) {
|
||||
float r = (((zpl_max(0.0f, (WORLD_BLOCK_SIZE/2.0f) - zpl_abs(x))*zpl_sign(x)))*(WORLD_BLOCK_SIZE/2.0f));
|
|
@ -1,9 +1,9 @@
|
|||
#include "device.h"
|
||||
#include "entity.h"
|
||||
#include "entity_view.h"
|
||||
#include "ents/device.h"
|
||||
#include "ents/entity.h"
|
||||
#include "world/entity_view.h"
|
||||
#include "world/world.h"
|
||||
|
||||
#include "modules/components.h"
|
||||
#include "ecs/components.h"
|
||||
|
||||
uint64_t device_spawn(asset_id id) {
|
||||
ecs_entity_t e = entity_spawn(EKIND_DEVICE);
|
|
@ -1,6 +1,6 @@
|
|||
#pragma once
|
||||
#include "system.h"
|
||||
#include "assets.h"
|
||||
#include "platform/system.h"
|
||||
#include "gen/assets.h"
|
||||
|
||||
uint64_t device_spawn(asset_id id);
|
||||
void device_despawn(uint64_t ent_id);
|
|
@ -1,11 +1,11 @@
|
|||
#include "entity.h"
|
||||
#include "entity_view.h"
|
||||
#include "ents/entity.h"
|
||||
#include "world/entity_view.h"
|
||||
#include "flecs/flecs.h"
|
||||
#include "librg.h"
|
||||
#include "world/world.h"
|
||||
|
||||
#include "modules/components.h"
|
||||
#include "modules/systems.h"
|
||||
#include "ecs/components.h"
|
||||
#include "ecs/systems.h"
|
||||
#include "zpl.h"
|
||||
|
||||
// NOTE(zaklaus): bring in entity spawnlist
|
|
@ -1,5 +1,5 @@
|
|||
#pragma once
|
||||
#include "system.h"
|
||||
#include "platform/system.h"
|
||||
|
||||
#define ENTITY_ACTION_VELOCITY_THRESHOLD 0.05f
|
||||
|
|
@ -1,5 +1,5 @@
|
|||
// NOTE(zaklaus): access to spawners
|
||||
#include "storage.h"
|
||||
#include "ents/storage.h"
|
||||
|
||||
static struct {
|
||||
asset_id id;
|
|
@ -1,10 +1,10 @@
|
|||
#include "items.h"
|
||||
#include "entity.h"
|
||||
#include "entity_view.h"
|
||||
#include "ents/items.h"
|
||||
#include "ents/entity.h"
|
||||
#include "world/entity_view.h"
|
||||
#include "world/world.h"
|
||||
#include "world/blocks.h"
|
||||
|
||||
#include "modules/components.h"
|
||||
#include "ecs/components.h"
|
||||
|
||||
#include "zpl.h"
|
||||
|
|
@ -1,9 +1,9 @@
|
|||
#pragma once
|
||||
#include "system.h"
|
||||
#include "assets.h"
|
||||
#include "platform/system.h"
|
||||
#include "gen/assets.h"
|
||||
#include "world/blocks.h"
|
||||
|
||||
#include "modules/components.h"
|
||||
#include "ecs/components.h"
|
||||
|
||||
typedef enum {
|
||||
// NOTE(zaklaus): hardcoded fields for placement ops
|
|
@ -1,5 +1,5 @@
|
|||
#include "items.h"
|
||||
#include "entity_view.h"
|
||||
#include "ents/items.h"
|
||||
#include "world/entity_view.h"
|
||||
#include "items_list_helpers.h"
|
||||
|
||||
static item_desc items[] = {
|
|
@ -1,12 +1,12 @@
|
|||
#include "player.h"
|
||||
#include "entity.h"
|
||||
#include "entity_view.h"
|
||||
#include "ents/player.h"
|
||||
#include "ents/entity.h"
|
||||
#include "world/entity_view.h"
|
||||
#include "flecs/flecs.h"
|
||||
#include "librg.h"
|
||||
#include "world/world.h"
|
||||
|
||||
#include "modules/components.h"
|
||||
#include "modules/systems.h"
|
||||
#include "ecs/components.h"
|
||||
#include "ecs/systems.h"
|
||||
#include "zpl.h"
|
||||
|
||||
#define PLAYER_MAX_HP 100.0f
|
|
@ -1,5 +1,5 @@
|
|||
#pragma once
|
||||
#include "system.h"
|
||||
#include "platform/system.h"
|
||||
|
||||
uint64_t player_spawn(char *name);
|
||||
void player_despawn(uint64_t ent_id);
|
|
@ -1,10 +1,10 @@
|
|||
#include "storage.h"
|
||||
#include "device.h"
|
||||
#include "entity.h"
|
||||
#include "entity_view.h"
|
||||
#include "ents/storage.h"
|
||||
#include "ents/device.h"
|
||||
#include "ents/entity.h"
|
||||
#include "world/entity_view.h"
|
||||
#include "world/world.h"
|
||||
|
||||
#include "modules/components.h"
|
||||
#include "ecs/components.h"
|
||||
|
||||
uint64_t storage_spawn(void) {
|
||||
ecs_entity_t e = device_spawn(ASSET_CHEST);
|
|
@ -1,6 +1,6 @@
|
|||
#pragma once
|
||||
|
||||
#include "system.h"
|
||||
#include "platform/system.h"
|
||||
|
||||
uint64_t storage_spawn(void);
|
||||
void storage_despawn(uint64_t id);
|
|
@ -1,9 +1,9 @@
|
|||
#include "vehicle.h"
|
||||
#include "entity.h"
|
||||
#include "entity_view.h"
|
||||
#include "ents/vehicle.h"
|
||||
#include "ents/entity.h"
|
||||
#include "world/entity_view.h"
|
||||
#include "world/world.h"
|
||||
|
||||
#include "modules/components.h"
|
||||
#include "ecs/components.h"
|
||||
|
||||
uint64_t vehicle_spawn(void) {
|
||||
ecs_entity_t e = entity_spawn(EKIND_VEHICLE);
|
|
@ -1,5 +1,5 @@
|
|||
#pragma once
|
||||
#include "system.h"
|
||||
#include "platform/system.h"
|
||||
|
||||
uint64_t vehicle_spawn(void);
|
||||
void vehicle_despawn(uint64_t id);
|
|
@ -4,7 +4,7 @@
|
|||
// use your favorite editor to quickly navigate between various files.
|
||||
|
||||
// 1) Register a new Asset ID
|
||||
#include "assets.h"
|
||||
#include "gen/assets.h"
|
||||
|
||||
// 2) Add the asset to the asset list
|
||||
#include "assets_list.c"
|
|
@ -1,4 +1,4 @@
|
|||
#include "assets.h"
|
||||
#include "gen/assets.h"
|
||||
#include "raylib.h"
|
||||
#include "gen/texgen.h"
|
||||
|
|
@ -1,5 +1,5 @@
|
|||
#pragma once
|
||||
#include "system.h"
|
||||
#include "platform/system.h"
|
||||
|
||||
#define ASSET_INVALID 0xFF
|
||||
|
||||
|
@ -37,8 +37,7 @@ typedef enum {
|
|||
ASSET_BELT_UP,
|
||||
ASSET_BELT_DOWN,
|
||||
|
||||
MAX_ASSETS,
|
||||
FORCE_ASSET_UINT16 = UINT16_MAX
|
||||
MAX_ASSETS = 1024,
|
||||
} asset_id;
|
||||
|
||||
typedef enum {
|
|
@ -1,4 +1,4 @@
|
|||
#include "assets.h"
|
||||
#include "gen/assets.h"
|
||||
|
||||
#define ASSET_ENTRY(asset, asset_kind)\
|
||||
{\
|
|
@ -1,8 +1,8 @@
|
|||
#pragma once
|
||||
#include "system.h"
|
||||
#include "platform/system.h"
|
||||
#include "raylib.h"
|
||||
#include "world/blocks.h"
|
||||
#include "assets.h"
|
||||
#include "gen/assets.h"
|
||||
|
||||
Texture2D texgen_build_anim(asset_id id, int64_t counter);
|
||||
Texture2D texgen_build_sprite(asset_id id);
|
|
@ -1,5 +1,5 @@
|
|||
#include "camera.h"
|
||||
#include "item_placement.h"
|
||||
#include "core/camera.h"
|
||||
#include "ents/item_placement.h"
|
||||
|
||||
static bool build_submit_placements = false;
|
||||
static bool build_is_in_draw_mode = false;
|
|
@ -1,5 +1,5 @@
|
|||
#pragma once
|
||||
#include "system.h"
|
||||
#include "platform/system.h"
|
||||
|
||||
int32_t network_init(void);
|
||||
int32_t network_destroy(void);
|
|
@ -11,14 +11,14 @@
|
|||
#include "librg.h"
|
||||
#pragma warning(pop)
|
||||
|
||||
#include "network.h"
|
||||
#include "packet.h"
|
||||
#include "net/network.h"
|
||||
#include "pkt/packet.h"
|
||||
#include "packets/pkt_00_init.h"
|
||||
#include "world/world.h"
|
||||
#include "game.h"
|
||||
#include "player.h"
|
||||
#include "core/game.h"
|
||||
#include "ents/player.h"
|
||||
|
||||
#include "modules/components.h"
|
||||
#include "ecs/components.h"
|
||||
|
||||
#define NETWORK_UPDATE_DELAY 0.100
|
||||
|
|
@ -1,16 +1,16 @@
|
|||
#include "packets/pkt_00_init.h"
|
||||
#include "packets/pkt_01_welcome.h"
|
||||
#include "packet.h"
|
||||
#include "pkt/packet.h"
|
||||
#include "world/world.h"
|
||||
#include "game.h"
|
||||
#include "network.h"
|
||||
#include "entity_view.h"
|
||||
#include "camera.h"
|
||||
#include "player.h"
|
||||
#include "entity.h"
|
||||
#include "core/game.h"
|
||||
#include "net/network.h"
|
||||
#include "world/entity_view.h"
|
||||
#include "core/camera.h"
|
||||
#include "ents/player.h"
|
||||
#include "ents/entity.h"
|
||||
|
||||
#include "modules/components.h"
|
||||
#include "modules/systems.h"
|
||||
#include "ecs/components.h"
|
||||
#include "ecs/systems.h"
|
||||
|
||||
pkt_desc pkt_00_init_desc[] = {
|
||||
{ PKT_FIELD(CWP_ITEM_POSITIVE_INTEGER, pkt_00_init, view_id) },
|
|
@ -1,6 +1,6 @@
|
|||
#pragma once
|
||||
#include "system.h"
|
||||
#include "packet_utils.h"
|
||||
#include "platform/system.h"
|
||||
#include "pkt/packet_utils.h"
|
||||
|
||||
typedef struct {
|
||||
uint16_t view_id;
|
|
@ -1,9 +1,9 @@
|
|||
#include "packets/pkt_01_welcome.h"
|
||||
#include "packet.h"
|
||||
#include "pkt/packet.h"
|
||||
#include "world/world.h"
|
||||
#include "game.h"
|
||||
#include "entity_view.h"
|
||||
#include "camera.h"
|
||||
#include "core/game.h"
|
||||
#include "world/entity_view.h"
|
||||
#include "core/camera.h"
|
||||
|
||||
pkt_desc pkt_01_welcome_desc[] = {
|
||||
{ PKT_FIELD(CWP_ITEM_POSITIVE_INTEGER, pkt_01_welcome, seed) },
|
|
@ -1,6 +1,6 @@
|
|||
#pragma once
|
||||
#include "system.h"
|
||||
#include "packet_utils.h"
|
||||
#include "platform/system.h"
|
||||
#include "pkt/packet_utils.h"
|
||||
|
||||
typedef struct {
|
||||
uint32_t seed;
|
|
@ -1,12 +1,12 @@
|
|||
#include "packet_utils.h"
|
||||
#include "network.h"
|
||||
#include "pkt/packet_utils.h"
|
||||
#include "net/network.h"
|
||||
#include "packets/pkt_send_keystate.h"
|
||||
#include "modules/components.h"
|
||||
#include "modules/systems.h"
|
||||
#include "ecs/components.h"
|
||||
#include "ecs/systems.h"
|
||||
#include "world/world.h"
|
||||
#include "entity.h"
|
||||
#include "ents/entity.h"
|
||||
|
||||
#include "debug_replay.h"
|
||||
#include "debug/debug_replay.h"
|
||||
|
||||
pkt_desc pkt_send_keystate_desc[] = {
|
||||
{ PKT_REAL(pkt_send_keystate, x) },
|
|
@ -1,7 +1,7 @@
|
|||
#pragma once
|
||||
#include "system.h"
|
||||
#include "packet_utils.h"
|
||||
#include "item_placement.h"
|
||||
#include "platform/system.h"
|
||||
#include "pkt/packet_utils.h"
|
||||
#include "ents/item_placement.h"
|
||||
|
||||
typedef struct {
|
||||
float x;
|
|
@ -1,8 +1,8 @@
|
|||
#include "zpl.h"
|
||||
#include "packet_utils.h"
|
||||
#include "pkt/packet_utils.h"
|
||||
#include "packets/pkt_send_librg_update.h"
|
||||
#include "world/world.h"
|
||||
#include "game.h"
|
||||
#include "core/game.h"
|
||||
|
||||
size_t pkt_send_librg_update(uint64_t peer_id,
|
||||
uint16_t view_id,
|
|
@ -1,6 +1,6 @@
|
|||
#pragma once
|
||||
#include "system.h"
|
||||
#include "packet_utils.h"
|
||||
#include "platform/system.h"
|
||||
#include "pkt/packet_utils.h"
|
||||
|
||||
size_t pkt_send_librg_update(uint64_t peer_id,
|
||||
uint16_t view_id,
|
|
@ -1,14 +1,14 @@
|
|||
#include "packets/pkt_switch_viewer.h"
|
||||
#include "packet.h"
|
||||
#include "pkt/packet.h"
|
||||
#include "world/world.h"
|
||||
#include "game.h"
|
||||
#include "network.h"
|
||||
#include "entity_view.h"
|
||||
#include "camera.h"
|
||||
#include "player.h"
|
||||
#include "core/game.h"
|
||||
#include "net/network.h"
|
||||
#include "world/entity_view.h"
|
||||
#include "core/camera.h"
|
||||
#include "ents/player.h"
|
||||
|
||||
#include "modules/components.h"
|
||||
#include "modules/systems.h"
|
||||
#include "ecs/components.h"
|
||||
#include "ecs/systems.h"
|
||||
|
||||
pkt_desc pkt_switch_viewer_desc[] = {
|
||||
{ PKT_FIELD(CWP_ITEM_POSITIVE_INTEGER, pkt_switch_viewer, view_id) },
|
|
@ -1,6 +1,6 @@
|
|||
#pragma once
|
||||
#include "system.h"
|
||||
#include "packet_utils.h"
|
||||
#include "platform/system.h"
|
||||
#include "pkt/packet_utils.h"
|
||||
|
||||
typedef struct {
|
||||
uint16_t view_id;
|
|
@ -1,5 +1,5 @@
|
|||
#include "packet_utils.h"
|
||||
#include "compress.h"
|
||||
#include "pkt/packet_utils.h"
|
||||
#include "utils/compress.h"
|
||||
#include "cwpack/cwpack.h"
|
||||
|
||||
//NOTE(zaklaus): packets
|
|
@ -1,5 +1,5 @@
|
|||
#pragma once
|
||||
#include "system.h"
|
||||
#include "platform/system.h"
|
||||
|
||||
#define PKT_BUFSIZ 4000000
|
||||
|
||||
|
@ -10,7 +10,8 @@ typedef enum {
|
|||
MSG_ID_SEND_KEYSTATE,
|
||||
MSG_ID_SEND_BLOCKPOS,
|
||||
MSG_ID_SWITCH_VIEWER,
|
||||
MSG_ID_FORCE_UINT16 = UINT16_MAX,
|
||||
MSG_NEXT_FREE_ID,
|
||||
MAX_PACKETS = 256,
|
||||
} pkt_messages;
|
||||
|
||||
typedef struct pkt_header {
|
|
@ -1,6 +1,6 @@
|
|||
#pragma once
|
||||
#include "zpl.h"
|
||||
#include "packet.h"
|
||||
#include "pkt/packet.h"
|
||||
#include "cwpack/cwpack.h"
|
||||
|
||||
#ifndef PKT_IF
|
|
@ -1,5 +1,5 @@
|
|||
#pragma once
|
||||
#include "system.h"
|
||||
#include "platform/system.h"
|
||||
|
||||
void platform_init(void);
|
||||
void platform_shutdown(void);
|
|
@ -1,16 +1,16 @@
|
|||
#include "platform.h"
|
||||
#include "platform/platform.h"
|
||||
#include "raylib.h"
|
||||
#include "raymath.h"
|
||||
#include "network.h"
|
||||
#include "game.h"
|
||||
#include "entity_view.h"
|
||||
#include "prediction.h"
|
||||
#include "camera.h"
|
||||
#include "net/network.h"
|
||||
#include "core/game.h"
|
||||
#include "world/entity_view.h"
|
||||
#include "world/prediction.h"
|
||||
#include "core/camera.h"
|
||||
#include "math.h"
|
||||
#include "world/blocks.h"
|
||||
#include "assets.h"
|
||||
#include "profiler.h"
|
||||
#include "debug_ui.h"
|
||||
#include "gen/assets.h"
|
||||
#include "platform/profiler.h"
|
||||
#include "debug/debug_ui.h"
|
||||
#include "utils/raylib_helpers.h"
|
||||
|
||||
#if defined(PLATFORM_WEB)
|
||||
|
@ -30,7 +30,7 @@ static float target_zoom = 0.6f;
|
|||
static bool request_shutdown;
|
||||
|
||||
#define GFX_KIND 2
|
||||
#include "renderer_bridge.c"
|
||||
#include "renderers/renderer_bridge.c"
|
||||
|
||||
// NOTE(zaklaus): add-ins
|
||||
#include "gui/build_mode.c"
|
|
@ -1,4 +1,4 @@
|
|||
#include "profiler.h"
|
||||
#include "platform/profiler.h"
|
||||
#include "raylib.h"
|
||||
#include <assert.h>
|
||||
|
|
@ -1,5 +1,5 @@
|
|||
#pragma once
|
||||
#include "system.h"
|
||||
#include "platform/system.h"
|
||||
|
||||
typedef enum {
|
||||
PROF_TOTAL_TIME,
|
|
@ -1,6 +1,6 @@
|
|||
#include <signal.h>
|
||||
#include "zpl.h"
|
||||
#include "game.h"
|
||||
#include "core/game.h"
|
||||
#ifdef ZPL_SYSTEM_WINDOWS
|
||||
#include <Windows.h>
|
||||
|
|
@ -1,8 +1,8 @@
|
|||
#include "debug_draw.h"
|
||||
#include "debug/debug_draw.h"
|
||||
|
||||
#if GFX_KIND == 0 || !defined(GFX_KIND)
|
||||
// NOTE(zaklaus): renderer_v0
|
||||
#include "renderer_v0.c"
|
||||
#include "renderers/renderer_v0.c"
|
||||
#define renderer_init renderer_init_v0
|
||||
#define renderer_shutdown renderer_shutdown_v0
|
||||
#define renderer_draw renderer_draw_v0
|
||||
|
@ -12,7 +12,7 @@
|
|||
void renderer_switch(int kind) {}
|
||||
#elif GFX_KIND == 1
|
||||
// NOTE(zaklaus): renderer_3d
|
||||
#include "renderer_3d.c"
|
||||
#include "renderers/renderer_3d.c"
|
||||
#define renderer_init renderer_init_3d
|
||||
#define renderer_shutdown renderer_shutdown_3d
|
||||
#define renderer_draw renderer_draw_3d
|
||||
|
@ -21,8 +21,8 @@ void renderer_switch(int kind) {}
|
|||
#define renderer_zoom_get renderer_zoom_get_3d
|
||||
void renderer_switch(int kind) {}
|
||||
#elif GFX_KIND == 2
|
||||
#include "renderer_3d.c"
|
||||
#include "renderer_v0.c"
|
||||
#include "renderers/renderer_3d.c"
|
||||
#include "renderers/renderer_v0.c"
|
||||
// NOTE(zaklaus): hybrid mode
|
||||
static int gfx_kind = 0; // 2d -- 0, 3d -- 1
|
||||
|
||||
|
@ -106,4 +106,4 @@ void renderer_switch(int kind) {
|
|||
|
||||
game_world_view_active_entity_map(renderer_bake_chunk);
|
||||
}
|
||||
#endif
|
||||
#endif
|
|
@ -1,4 +1,4 @@
|
|||
#pragma once
|
||||
#include "system.h"
|
||||
#include "platform/system.h"
|
||||
|
||||
void generate_minimap(int32_t seed, uint16_t block_size, uint16_t chunk_size, uint16_t world_size);
|
|
@ -1,8 +1,8 @@
|
|||
#pragma once
|
||||
#include "system.h"
|
||||
#include "platform/system.h"
|
||||
#include "raylib.h"
|
||||
#include "world/blocks.h"
|
||||
#include "assets.h"
|
||||
#include "gen/assets.h"
|
||||
|
||||
#define RAYLIB_NEW_RLGL
|
||||
#include "rlgl.h"
|
|
@ -4,7 +4,7 @@
|
|||
#include "world/blocks.h"
|
||||
#include "raylib.h"
|
||||
#include "gen/texgen.h"
|
||||
#include "world_view.h"
|
||||
#include "world/world_view.h"
|
||||
#include "perlin.h"
|
||||
|
||||
#define BLOCKS_COUNT (sizeof(blocks)/sizeof(block))
|
||||
|
@ -124,4 +124,4 @@ void blocks_remove_chunk_tex(uint64_t id) {
|
|||
if (!tex) return;
|
||||
UnloadRenderTexture(*tex);
|
||||
blocks__chunk_tbl_remove(&baked_chunks, id);
|
||||
}
|
||||
}
|
|
@ -1,6 +1,6 @@
|
|||
#pragma once
|
||||
#include "system.h"
|
||||
#include "assets.h"
|
||||
#include "platform/system.h"
|
||||
#include "gen/assets.h"
|
||||
|
||||
typedef enum {
|
||||
BLOCK_FLAG_COLLISION = (1 << 1),
|
|
@ -1,5 +1,5 @@
|
|||
#include "entity_view.h"
|
||||
#include "packet_utils.h"
|
||||
#include "world/entity_view.h"
|
||||
#include "pkt/packet_utils.h"
|
||||
#include "world/blocks.h"
|
||||
|
||||
ZPL_TABLE_DEFINE(entity_view_tbl, entity_view_tbl_, entity_view);
|
|
@ -1,7 +1,7 @@
|
|||
#pragma once
|
||||
#include "system.h"
|
||||
#include "assets.h"
|
||||
#include "items.h"
|
||||
#include "platform/system.h"
|
||||
#include "gen/assets.h"
|
||||
#include "ents/items.h"
|
||||
|
||||
#define ZPL_PICO
|
||||
#include "zpl.h"
|
|
@ -1,6 +1,6 @@
|
|||
#pragma once
|
||||
|
||||
#include "system.h"
|
||||
#include "platform/system.h"
|
||||
|
||||
double perlin_noise2d(int32_t seed, double x, double y);
|
||||
double perlin_fbm(int32_t seed, double x, double y, double freq, uint32_t octaves);
|
|
@ -1,8 +1,8 @@
|
|||
#include "zpl.h"
|
||||
#include "prediction.h"
|
||||
#include "platform.h"
|
||||
#include "world/prediction.h"
|
||||
#include "platform/platform.h"
|
||||
#include "world/world.h"
|
||||
#include "game.h"
|
||||
#include "core/game.h"
|
||||
|
||||
#define PREDICT_SMOOTH_FACTOR_LO 7.5f
|
||||
#define PREDICT_SMOOTH_FACTOR_HI 12.5f
|
|
@ -1,5 +1,5 @@
|
|||
#pragma once
|
||||
#include "entity_view.h"
|
||||
#include "world/entity_view.h"
|
||||
|
||||
float smooth_val(float cur, float tgt, float dt);
|
||||
float smooth_val_spherical(float cur, float tgt, float dt);
|
|
@ -1,16 +1,16 @@
|
|||
#include "zpl.h"
|
||||
#include "librg.h"
|
||||
#include "modules/components.h"
|
||||
#include "modules/systems.h"
|
||||
#include "ecs/components.h"
|
||||
#include "ecs/systems.h"
|
||||
#include "world/world.h"
|
||||
#include "entity_view.h"
|
||||
#include "debug_replay.h"
|
||||
#include "items.h"
|
||||
#include "world/entity_view.h"
|
||||
#include "debug/debug_replay.h"
|
||||
#include "ents/items.h"
|
||||
#include "world/worldgen/worldgen.h"
|
||||
#include "platform.h"
|
||||
#include "profiler.h"
|
||||
#include "game.h"
|
||||
#include "entity.h"
|
||||
#include "platform/platform.h"
|
||||
#include "platform/profiler.h"
|
||||
#include "core/game.h"
|
||||
#include "ents/entity.h"
|
||||
|
||||
#include "packets/pkt_send_librg_update.h"
|
||||
|
|
@ -1,7 +1,7 @@
|
|||
#pragma once
|
||||
#include "system.h"
|
||||
#include "platform/system.h"
|
||||
#include "librg.h"
|
||||
#include "packet.h"
|
||||
#include "pkt/packet.h"
|
||||
#include "flecs/flecs.h"
|
||||
#include "world/blocks.h"
|
||||
|
|
@ -1,10 +1,10 @@
|
|||
#include "zpl.h"
|
||||
#include "world_view.h"
|
||||
#include "entity_view.h"
|
||||
#include "prediction.h"
|
||||
#include "world/world_view.h"
|
||||
#include "world/entity_view.h"
|
||||
#include "world/prediction.h"
|
||||
#include "librg.h"
|
||||
#include "world/world.h"
|
||||
#include "game.h"
|
||||
#include "core/game.h"
|
||||
|
||||
#include <math.h>
|
||||
|
|
@ -1,6 +1,6 @@
|
|||
#pragma once
|
||||
#include "system.h"
|
||||
#include "entity_view.h"
|
||||
#include "platform/system.h"
|
||||
#include "world/entity_view.h"
|
||||
#include "world/world.h"
|
||||
|
||||
typedef struct {
|
|
@ -1,4 +1,4 @@
|
|||
#pragma once
|
||||
#include "system.h"
|
||||
#include "platform/system.h"
|
||||
|
||||
int32_t worldgen_test(void *world);
|
|
@ -7,10 +7,10 @@
|
|||
#include "world/blocks.h"
|
||||
#include "world/perlin.h"
|
||||
|
||||
#include "modules/components.h"
|
||||
#include "entity.h"
|
||||
#include "vehicle.h"
|
||||
#include "items.h"
|
||||
#include "ecs/components.h"
|
||||
#include "ents/entity.h"
|
||||
#include "ents/vehicle.h"
|
||||
#include "ents/items.h"
|
||||
#include "world/blocks_info.h"
|
||||
|
||||
#define WORLD_BLOCK_OBSERVER(name) block_id name(block_id *data, block_id id, uint32_t block_idx)
|
|
@ -1,48 +0,0 @@
|
|||
file(GLOB PKT_SRCS ../game/src/packets/*.h ../game/src/packets/*.c)
|
||||
|
||||
add_executable(eco2d
|
||||
src/platform_raylib.c
|
||||
src/main.c
|
||||
|
||||
src/network.c
|
||||
src/game.c
|
||||
src/camera.c
|
||||
src/world_view.c
|
||||
src/prediction.c
|
||||
|
||||
src/assets.c
|
||||
src/items.c
|
||||
src/compress.c
|
||||
src/entity.c
|
||||
src/entity_view.c
|
||||
src/packet.c
|
||||
src/player.c
|
||||
src/vehicle.c
|
||||
src/storage.c
|
||||
src/device.c
|
||||
src/signal_handling.c
|
||||
src/profiler.c
|
||||
src/debug_ui.c
|
||||
src/debug_draw.c
|
||||
|
||||
src/utils/options.c
|
||||
|
||||
src/network.h
|
||||
|
||||
src/world/blocks.c
|
||||
src/world/perlin.c
|
||||
src/world/world.c
|
||||
|
||||
src/gen/texgen.c
|
||||
|
||||
src/world/worldgen/worldgen_test.c
|
||||
|
||||
${PKT_SRCS}
|
||||
)
|
||||
|
||||
target_compile_definitions(eco2d PRIVATE CLIENT)
|
||||
include_directories(src ../modules ../../art/gen)
|
||||
target_link_libraries(eco2d raylib cwpack eco2d-modules flecs-bundle vendors-bundle)
|
||||
target_compile_options(eco2d PRIVATE -Werror -Wall -Wextra -Wno-unused-function -Wno-unknown-pragmas -Wno-unused-variable -Wno-unused-parameter)
|
||||
|
||||
link_system_libs(eco2d)
|
|
@ -0,0 +1 @@
|
|||
add_subdirectory(sandbox)
|
|
@ -0,0 +1,10 @@
|
|||
add_executable(eco2d
|
||||
src/main.c
|
||||
)
|
||||
|
||||
target_compile_definitions(eco2d PRIVATE CLIENT)
|
||||
include_directories(src ../../foundation/src ../../../art/gen)
|
||||
target_link_libraries(eco2d eco2d-foundation)
|
||||
target_compile_options(eco2d PRIVATE -Werror -Wall -Wextra -Wno-unused-function -Wno-unknown-pragmas -Wno-unused-variable -Wno-unused-parameter)
|
||||
|
||||
link_system_libs(eco2d)
|
|
@ -1,18 +1,18 @@
|
|||
#define ZPL_IMPL
|
||||
#include "zpl.h"
|
||||
#include "system.h"
|
||||
#include "game.h"
|
||||
#include "entity.h"
|
||||
#include "entity_view.h"
|
||||
#include "platform/system.h"
|
||||
#include "core/game.h"
|
||||
#include "ents/entity.h"
|
||||
#include "world/entity_view.h"
|
||||
#include "utils/options.h"
|
||||
#include "signal_handling.h"
|
||||
#include "profiler.h"
|
||||
#include "platform/signal_handling.h"
|
||||
#include "platform/profiler.h"
|
||||
|
||||
#include "flecs/flecs.h"
|
||||
#include "flecs/flecs_os_api_stdcpp.h"
|
||||
|
||||
#include "modules/components.h"
|
||||
#include "modules/systems.h"
|
||||
#include "ecs/components.h"
|
||||
#include "ecs/systems.h"
|
||||
|
||||
#if defined(PLATFORM_WEB)
|
||||
#include <emscripten/emscripten.h>
|
|
@ -1,5 +0,0 @@
|
|||
add_library(eco2d-modules STATIC
|
||||
modules/systems.c
|
||||
modules/components.c
|
||||
)
|
||||
include_directories(. ../game/src)
|
Loading…
Reference in New Issue