extern float handAngle;
- /*
- * Loads an image from the given file path and attempts to make a texture out of it. The
- * resulting GLuint is returned (used to recall the texture in glBindTexture).
- *
- */
-
- extern unsigned int loops;
-
- //GLuint loadTexture(const char *fileName);
++extern unsigned int loops;
+
/*
* Prints a formatted debug message to the console, along with the callee's file and line
* number.
int maxStackSize;
char* textureLoc;
Texturec *tex;
+ GLuint text;
int count;
- Item(ITEM_ID i, char* n, ITEM_TYPE t, float w, float h, int m, char* tl):
- id(i), type(t), width(w), height(h), maxStackSize(m){
- count = 0;
+
- name = (char*)calloc(strlen(n )+1,sizeof(char));
- textureLoc = (char*)calloc(strlen(tl)+1,sizeof(char));
-
- strcpy(name,n);
- strcpy(textureLoc,tl);
-
- tex= new Texturec(1,textureLoc);
- text = Texture::loadTexture(textureLoc);
- }
+ Item(ITEM_ID i, const char *n, ITEM_TYPE t, float w, float h, int m, const char *tl);
GLuint rtex(){
return tex->image[0];
}
inv = new Inventory(NPC_INV_SIZE);
}
- Object::Object(int id):identifier(id){
- type = OBJECTT;
- alive = true;
- near = false;
- width = HLINE * 8;
- height = HLINE * 8;
-
- maxHealth = health = 1;
- tex = new Texturec(1, item[id].textureLoc);
-
- questObject = false;
- pickupDialog="\0";
- }
+ Object::Object(ITEM_ID id, bool qo, const char *pd){
+ identifier = id;
+ questObject = qo;
+
+ pickupDialog = new char[strlen(pd)+1];
+ strcpy(pickupDialog,pd);
+
+
- Object::Object(int id, bool qo, char *pd):identifier(id),questObject(qo),pickupDialog(pd){
type = OBJECTT;
alive = true;
near = false;
height = HLINE * 8;
maxHealth = health = 1;
- tex = new Texturec(1, item[id].textureLoc);
+ tex = new Texturec(1,getItemTexturePath(id));
++
}
extern Player *player;
extern GLuint invUI;
-static Item item[5]= {
- #include "../config/items.h"
-};
-
void itemDraw(Player *p,ITEM_ID id);
+ char *getItemTexturePath(ITEM_ID id){
+ return item[id].textureLoc;
+ }
+
+ Item::Item(ITEM_ID i, const char *n, ITEM_TYPE t, float w, float h, int m, const char *tl){
+ id = i;
+ type = t;
+ width = w;
+ height = h;
+ maxStackSize = m;
+ count = 0;
+
+ name = new char[strlen(n)+1]; //(char*)calloc(strlen(n ),sizeof(char));
+ textureLoc = new char[strlen(tl)+1]; //(char*)calloc(strlen(tl),sizeof(char));
+
+ strcpy(name,n);
+ strcpy(textureLoc,tl);
+
+ tex= new Texturec(1,textureLoc);
+ }
+
Inventory::Inventory(unsigned int s){
sel=0;
size=s;
void Inventory::draw(void){
ui::putText(offset.x-SCREEN_WIDTH/2,480,"%d",sel);
unsigned int i=0;
+ static unsigned int lop = 0;
float y,xoff;
-
-
static int numSlot = 7;
static std::vector<int>dfp(numSlot);
static std::vector<Ray>iray(numSlot);
i++;
}
}*/
+
if(inv[sel].count)itemDraw(player,inv[sel].id);
+ lop++;
}
static vec2 item_coord = {0,0};