small asset ids changes
parent
9e368527a3
commit
3a008427f6
|
@ -20,6 +20,7 @@ add_library(eco2d-foundation STATIC
|
|||
src/models/prefabs/storage.c
|
||||
src/models/prefabs/furnace.c
|
||||
src/models/prefabs/blueprint.c
|
||||
src/models/prefabs/craftbench.c
|
||||
|
||||
src/pkt/packet.c
|
||||
|
||||
|
|
|
@ -9,7 +9,7 @@ Texture2D texgen_build_anim_fallback(asset_id id, int64_t counter) {
|
|||
case ASSET_WATER: {
|
||||
return LoadTexEco(zpl_bprintf("%s%d", "water", counter%3));
|
||||
}break;
|
||||
|
||||
|
||||
default: return GenColorEco(PINK); break;
|
||||
}
|
||||
}
|
||||
|
@ -19,10 +19,10 @@ Texture2D texgen_build_sprite_fallback(asset_id id) {
|
|||
case ASSET_BLANK: return GenColorEco(WHITE); break;
|
||||
case ASSET_BUILDMODE_HIGHLIGHT: return GenColorEco(WHITE); break;
|
||||
case ASSET_BLOCK_FRAME: return GenFrameRect(); break;
|
||||
|
||||
|
||||
// NOTE(zaklaus): items
|
||||
case ASSET_COAL: return LoadTexEco("coal");
|
||||
|
||||
|
||||
// NOTE(zaklaus): blocks
|
||||
case ASSET_FENCE: return LoadTexEco("fence");
|
||||
case ASSET_GROUND: return LoadTexEco("grass");
|
||||
|
@ -35,23 +35,24 @@ Texture2D texgen_build_sprite_fallback(asset_id id) {
|
|||
case ASSET_TREE: return LoadTexEco("bigtree");
|
||||
case ASSET_TEST_TALL: return LoadTexEco("test-tall");
|
||||
// case ASSET_WATER: return LoadTexEco("water");
|
||||
|
||||
|
||||
case ASSET_BELT:
|
||||
case ASSET_BELT_RIGHT: return LoadTexEco("belt_right");
|
||||
case ASSET_BELT_LEFT: return LoadTexEco("belt_left");
|
||||
case ASSET_BELT_UP: return LoadTexEco("belt_up");
|
||||
case ASSET_BELT_DOWN: return LoadTexEco("belt_down");
|
||||
|
||||
|
||||
// NOTE(zaklaus): devices
|
||||
case ASSET_CHEST: return LoadTexEco("chest");
|
||||
case ASSET_FURNACE: return LoadTexEco("furnace-export");
|
||||
|
||||
case ASSET_CRAFTBENCH: return LoadTexEco("craftbench");
|
||||
|
||||
default: break;
|
||||
}
|
||||
|
||||
|
||||
if (id > ASSET_BLUEPRINT_BEGIN && id < ASSET_BLUEPRINT_END) {
|
||||
return LoadTexEco("blueprint");
|
||||
}
|
||||
|
||||
|
||||
return GenColorEco(PINK);
|
||||
}
|
||||
|
|
|
@ -2,46 +2,14 @@
|
|||
|
||||
#define ASSET_INVALID 0xFF
|
||||
|
||||
#define _ASSETS\
|
||||
X(ASSET_EMPTY)\
|
||||
X(ASSET_BLANK)\
|
||||
X(ASSET_BLOCK_FRAME)\
|
||||
X(ASSET_BUILDMODE_HIGHLIGHT)\
|
||||
X(ASSET_PLAYER)\
|
||||
X(ASSET_THING)\
|
||||
X(ASSET_CHEST)\
|
||||
X(ASSET_FURNACE)\
|
||||
X(ASSET_BLUEPRINT_BEGIN)\
|
||||
X(ASSET_BLUEPRINT)\
|
||||
X(ASSET_BLUEPRINT_DEMO_HOUSE)\
|
||||
X(ASSET_BLUEPRINT_END)\
|
||||
X(ASSET_FENCE)\
|
||||
X(ASSET_DEV)\
|
||||
X(ASSET_GROUND)\
|
||||
X(ASSET_DIRT)\
|
||||
X(ASSET_WATER)\
|
||||
X(ASSET_LAVA)\
|
||||
X(ASSET_WALL)\
|
||||
X(ASSET_HILL)\
|
||||
X(ASSET_HILL_SNOW)\
|
||||
X(ASSET_HOLE)\
|
||||
X(ASSET_WOOD)\
|
||||
X(ASSET_TREE)\
|
||||
X(ASSET_COAL)\
|
||||
X(ASSET_IRON_ORE)\
|
||||
X(ASSET_IRON_INGOT)\
|
||||
X(ASSET_TEST_TALL)\
|
||||
X(ASSET_BELT)\
|
||||
X(ASSET_BELT_LEFT)\
|
||||
X(ASSET_BELT_RIGHT)\
|
||||
X(ASSET_BELT_UP)\
|
||||
X(ASSET_BELT_DOWN)\
|
||||
#include "assets_ids.lst"
|
||||
|
||||
typedef enum {
|
||||
#define X(id) id,
|
||||
#define X(idx) idx,
|
||||
_ASSETS
|
||||
#undef X
|
||||
MAX_ASSETS,
|
||||
#undef X
|
||||
|
||||
MAX_ASSETS
|
||||
} asset_id;
|
||||
|
||||
extern const char *asset_names[];
|
||||
|
|
|
@ -0,0 +1,36 @@
|
|||
#define _ASSETS\
|
||||
X(ASSET_EMPTY)\
|
||||
X(ASSET_BLANK)\
|
||||
X(ASSET_BLOCK_FRAME)\
|
||||
X(ASSET_BUILDMODE_HIGHLIGHT)\
|
||||
X(ASSET_PLAYER)\
|
||||
X(ASSET_THING)\
|
||||
X(ASSET_CHEST)\
|
||||
X(ASSET_FURNACE)\
|
||||
X(ASSET_CRAFTBENCH)\
|
||||
X(ASSET_BLUEPRINT_BEGIN)\
|
||||
X(ASSET_BLUEPRINT)\
|
||||
X(ASSET_BLUEPRINT_DEMO_HOUSE)\
|
||||
X(ASSET_BLUEPRINT_END)\
|
||||
X(ASSET_FENCE)\
|
||||
X(ASSET_DEV)\
|
||||
X(ASSET_GROUND)\
|
||||
X(ASSET_DIRT)\
|
||||
X(ASSET_WATER)\
|
||||
X(ASSET_LAVA)\
|
||||
X(ASSET_WALL)\
|
||||
X(ASSET_HILL)\
|
||||
X(ASSET_HILL_SNOW)\
|
||||
X(ASSET_HOLE)\
|
||||
X(ASSET_WOOD)\
|
||||
X(ASSET_TREE)\
|
||||
X(ASSET_COAL)\
|
||||
X(ASSET_IRON_ORE)\
|
||||
X(ASSET_IRON_INGOT)\
|
||||
X(ASSET_TEST_TALL)\
|
||||
X(ASSET_BELT)\
|
||||
X(ASSET_BELT_LEFT)\
|
||||
X(ASSET_BELT_RIGHT)\
|
||||
X(ASSET_BELT_UP)\
|
||||
X(ASSET_BELT_DOWN)
|
||||
|
|
@ -18,9 +18,10 @@ static asset assets[] = {
|
|||
ASSET_TEX(ASSET_COAL),
|
||||
ASSET_TEX(ASSET_CHEST),
|
||||
ASSET_TEX(ASSET_FURNACE),
|
||||
ASSET_TEX(ASSET_CRAFTBENCH),
|
||||
ASSET_TEX(ASSET_BLUEPRINT),
|
||||
ASSET_TEX(ASSET_BLUEPRINT_DEMO_HOUSE),
|
||||
|
||||
|
||||
// NOTE(zaklaus): blocks
|
||||
ASSET_TEX(ASSET_FENCE),
|
||||
ASSET_TEX(ASSET_DEV),
|
||||
|
@ -35,7 +36,7 @@ static asset assets[] = {
|
|||
ASSET_TEX(ASSET_WOOD),
|
||||
ASSET_TEX(ASSET_TEST_TALL),
|
||||
ASSET_TEX(ASSET_TREE),
|
||||
|
||||
|
||||
ASSET_TEX(ASSET_BELT),
|
||||
ASSET_TEX(ASSET_BELT_LEFT),
|
||||
ASSET_TEX(ASSET_BELT_RIGHT),
|
||||
|
|
|
@ -2,6 +2,7 @@
|
|||
#include "models/prefabs/storage.h"
|
||||
#include "models/prefabs/furnace.h"
|
||||
#include "models/prefabs/blueprint.h"
|
||||
#include "models/prefabs/craftbench.h"
|
||||
|
||||
static struct {
|
||||
asset_id id;
|
||||
|
@ -10,6 +11,7 @@ static struct {
|
|||
} entity_spawnlist[] = {
|
||||
{ .id = ASSET_CHEST, .proc = storage_spawn },
|
||||
{ .id = ASSET_FURNACE, .proc = furnace_spawn },
|
||||
{ .id = ASSET_CRAFTBENCH, .proc = craftbench_spawn },
|
||||
{ .id = ASSET_BLUEPRINT, .proc_udata = blueprint_spawn_udata },
|
||||
};
|
||||
|
||||
|
|
|
@ -23,5 +23,6 @@ static item_desc items[] = {
|
|||
ITEM_PROXY(ASSET_BELT_DOWN, ASSET_BELT),
|
||||
|
||||
ITEM_ENT(ASSET_CHEST, 32, ASSET_CHEST),
|
||||
ITEM_ENT(ASSET_CRAFTBENCH, 32, ASSET_CRAFTBENCH),
|
||||
ITEM_ENT(ASSET_FURNACE, 32, ASSET_FURNACE),
|
||||
};
|
||||
|
|
|
@ -0,0 +1,24 @@
|
|||
#include "craftbench.h"
|
||||
#include "models/device.h"
|
||||
#include "world/world.h"
|
||||
|
||||
#include "models/entity.h"
|
||||
#include "models/components.h"
|
||||
|
||||
uint64_t craftbench_spawn(void) {
|
||||
ecs_entity_t e = device_spawn(ASSET_CRAFTBENCH);
|
||||
|
||||
ItemContainer *storage = ecs_get_mut(world_ecs(), e, ItemContainer);
|
||||
*storage = (ItemContainer){0};
|
||||
|
||||
Producer *producer = ecs_get_mut(world_ecs(), e, Producer);
|
||||
*producer = (Producer){0};
|
||||
producer->energy_level = 69.0f;
|
||||
|
||||
ecs_set(world_ecs(), e, ItemRouter, {1});
|
||||
return (uint64_t)e;
|
||||
}
|
||||
|
||||
void craftbench_despawn(uint64_t ent_id) {
|
||||
entity_despawn(ent_id);
|
||||
}
|
|
@ -0,0 +1,7 @@
|
|||
#pragma once
|
||||
|
||||
#include "platform/system.h"
|
||||
|
||||
uint64_t craftbench_spawn(void);
|
||||
void craftbench_despawn(uint64_t id);
|
||||
|
|
@ -17,6 +17,7 @@ patterns =
|
|||
"*.txt",
|
||||
"*.cmake",
|
||||
"*.md",
|
||||
"*.lst",
|
||||
};
|
||||
|
||||
blacklist_patterns =
|
||||
|
|
Loading…
Reference in New Issue