-ID DEBUG_ITEM
- NAME "Debug"
++
+ID DEBUG_ITEM
+ NAME "Debug\0"
TYPE TOOL
WIDTH 1
HEIGHT 1
float height;
int maxStackSize;
char* textureLoc;
+ Texturec *tex;
int count;
Item(ITEM_ID i, char* n, ITEM_TYPE t, float w, float h, int m, char* tl):
- id(i), name(n), type(t), width(w), height(h), maxStackSize(m), textureLoc(tl){
+ id(i), type(t), width(w), height(h), maxStackSize(m){
count = 0;
+
+ name = (char*)calloc(strlen(n ),sizeof(char));
+ textureLoc = (char*)calloc(strlen(tl),sizeof(char));
+
+ strcpy(name,n);
+ strcpy(textureLoc,tl);
+
+ tex= new Texturec(1,textureLoc);
}
- void addCount(int c){
- count += c;
+ GLuint rtex(){
+ return tex->image[0];
}
-
};
- static Item item[5]= {
- #include "../config/items.h"
- };
-
struct item_t{
int count;
- ITEM_ID itmid;
+ ITEM_ID id;
} __attribute__((packed));
height = HLINE * 8;
maxHealth = health = 1;
- tex = new Texturec(1, item[id].textureLoc);
- tex = new Texturec(1, "assets/items/ITEM_SWORD.png");
++ //tex = new Texturec(1, item[id].textureLoc);
questObject = false;
pickupDialog="\0";
height = HLINE * 8;
maxHealth = health = 1;
- tex = new Texturec(1, item[id].textureLoc);
- tex = new Texturec(1, "assets/items/ITEM_SWORD.png");
++ //tex = new Texturec(1, item[id].textureLoc);
}
extern Player *player;
extern GLuint invUI;
-GLuint *ITEM_TEX;
-
+ static Item item[5]= {
+ #include "../config/items.h"
+ };
+
void itemDraw(Player *p,ITEM_ID id);
-unsigned int initInventorySprites(void){
- unsigned int i,loadCount=0;
- ITEM_TEX=(GLuint *)calloc(ITEM_COUNT,sizeof(GLuint));
- for(i=0;i<ITEM_COUNT;i++){
- if((ITEM_TEX[i]=Texture::loadTexture(item[i].textureLoc)))loadCount++;
- }
-#ifdef DEBUG
- DEBUG_printf("Loaded %u/%u item texture(s).\n",loadCount,ITEM_COUNT);
-#endif // DEBUG
- return loadCount;
-}
-
Inventory::Inventory(unsigned int s){
sel=0;
size=s;