drop lists dir
parent
6e09c09037
commit
29d9b9306d
|
@ -51,8 +51,9 @@ typedef enum {
|
|||
#define X(idx) idx,
|
||||
_ASSETS
|
||||
#undef X
|
||||
|
||||
MAX_ASSETS
|
||||
MAX_INTERNAL_ASSETS,
|
||||
NEXT_FREE_ASSET = MAX_INTERNAL_ASSETS,
|
||||
MAX_ASSETS = 255
|
||||
} asset_id;
|
||||
|
||||
extern const char *asset_names[];
|
|
@ -1,18 +0,0 @@
|
|||
// NOTE(zaklaus): access to spawners
|
||||
#include "models/prefabs/prefabs_list.c"
|
||||
static struct {
|
||||
asset_id id;
|
||||
uint64_t (*proc)();
|
||||
uint64_t (*proc_udata)(void*);
|
||||
} entity_spawnlist[] = {
|
||||
{ .id = ASSET_CHEST, .proc = storage_spawn },
|
||||
{ .id = ASSET_FURNACE, .proc = furnace_spawn },
|
||||
{ .id = ASSET_CRAFTBENCH, .proc = craftbench_spawn },
|
||||
{ .id = ASSET_SPLITTER, .proc = splitter_spawn },
|
||||
{ .id = ASSET_ASSEMBLER, .proc = assembler_spawn },
|
||||
{ .id = ASSET_BLUEPRINT, .proc_udata = blueprint_spawn_udata },
|
||||
{ .id = ASSET_CREATURE, .proc = creature_spawn },
|
||||
{ .id = ASSET_MOB, .proc = mob_spawn },
|
||||
};
|
||||
|
||||
#define MAX_ENTITY_SPAWNDEFS ((sizeof(entity_spawnlist))/(sizeof(entity_spawnlist[0])))
|
|
@ -1,8 +1,8 @@
|
|||
#include "models/assets.h"
|
||||
#include "lists/assets_ids.h"
|
||||
#include "raylib.h"
|
||||
#include "gen/texgen.h"
|
||||
#include "models/database.h"
|
||||
#include <stdint.h>
|
||||
|
||||
//#define ASSETS_COUNT (sizeof(assets)/sizeof(asset))
|
||||
|
||||
|
@ -30,10 +30,19 @@ static double assets_frame_next_draw = 0.0;
|
|||
|
||||
#include <time.h>
|
||||
|
||||
static uint16_t asset_counter;
|
||||
|
||||
void assets_new(const char *name) {
|
||||
assert(asset_counter < MAX_ASSETS);
|
||||
db_exec(zpl_bprintf("INSERT INTO assets (id, name) VALUES (%d, '%s');", asset_counter++, name));
|
||||
}
|
||||
|
||||
void assets_db_init(void) {
|
||||
for (uint16_t i=0; i<MAX_ASSETS; i++) {
|
||||
db_exec(zpl_bprintf("INSERT INTO assets (id, name) VALUES (%d, '%s');", i, asset_names[i]+6));
|
||||
for (uint16_t i=0; i<MAX_INTERNAL_ASSETS; i++) {
|
||||
assets_new(asset_names[i]+6);
|
||||
}
|
||||
|
||||
asset_counter = NEXT_FREE_ASSET;
|
||||
}
|
||||
|
||||
void assets_db(void) {
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
#pragma once
|
||||
#include "platform/system.h"
|
||||
|
||||
#include "lists/assets_ids.h"
|
||||
#include "assets_ids.h"
|
||||
|
||||
typedef enum {
|
||||
AKIND_TEXTURE,
|
||||
|
@ -13,6 +13,7 @@ typedef enum {
|
|||
|
||||
void assets_db_init(void);
|
||||
void assets_db(void);
|
||||
void assets_new(const char *name);
|
||||
int32_t assets_setup(void);
|
||||
int32_t assets_frame(void);
|
||||
void assets_destroy(void);
|
||||
|
|
Loading…
Reference in New Issue