40 lines
691 B
C
40 lines
691 B
C
#ifndef INV_H
|
|
#define INV_H
|
|
|
|
typedef struct item {
|
|
const char* name;
|
|
int id;
|
|
int maxCount;
|
|
int texID;
|
|
int durability; // 1 if its a stackable item
|
|
int maxDur;
|
|
|
|
void (*onCollect)(float dtime);
|
|
void (*onUse)(float dtime);
|
|
} item;
|
|
|
|
typedef struct stack_t {
|
|
item* itm;
|
|
int count;
|
|
} stack_t;
|
|
typedef stack_t* stack; // can be NULL
|
|
|
|
typedef struct inventory {
|
|
stack** data;
|
|
int lines;
|
|
int cols;
|
|
} inventory;
|
|
|
|
inventory* playerInventory;
|
|
const int Lines;
|
|
const int Cols;
|
|
// -------------- //
|
|
void inv_init();
|
|
void build_itemList();
|
|
|
|
bool inv_addItem(int id, float dtime);
|
|
void useItem(int line, int col, float dtime);
|
|
|
|
void inv_destroy();
|
|
|
|
#endif |