]> git.lizzy.rs Git - dragonblocks_alpha.git/blob - src/client/client_item.c
Add items
[dragonblocks_alpha.git] / src / client / client_item.c
1 #include "client/client_item.h"
2
3 ClientItemDef client_item_defs[COUNT_ITEM] = {
4         // unknown
5         {
6                 .mesh_path = RESSOURCE_PATH "meshes/unknown.txt",
7                 .mesh = {0},
8         },
9         // none
10         {
11                 .mesh_path = NULL,
12                 .mesh = {0},
13         },
14         // pickaxe
15         {
16                 .mesh_path = RESSOURCE_PATH "meshes/pickaxe.txt",
17                 .mesh = {0},
18         },
19         // axe
20         {
21                 .mesh_path = RESSOURCE_PATH "meshes/axe.txt",
22                 .mesh = {0},
23         },
24 };
25
26 void client_item_init()
27 {
28         for (ItemType i = 0; i < COUNT_ITEM; i++)
29                 if (client_item_defs[i].mesh_path)
30                         mesh_load(&client_item_defs[i].mesh, client_item_defs[i].mesh_path);
31 }
32
33 void client_item_deinit()
34 {
35         for (ItemType i = 0; i < COUNT_ITEM; i++)
36                 if (client_item_defs[i].mesh_path)
37                         mesh_destroy(&client_item_defs[i].mesh);
38 }
39
40 Mesh *client_item_mesh(ItemType type)
41 {
42         return client_item_defs[type].mesh_path ? &client_item_defs[type].mesh : NULL;
43 }