From 9ab6025a0cc3ab31c476f0b478ac69bfadd7f670 Mon Sep 17 00:00:00 2001 From: Clyne Sullivan Date: Thu, 29 Oct 2015 15:51:07 -0400 Subject: inventory visuals / item drop (Q) --- src/inventory.cpp | 71 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ src/ui.cpp | 5 ++++ src/world.cpp | 8 ++++++- 3 files changed, 83 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/inventory.cpp b/src/inventory.cpp index 2eb0087..3043e80 100644 --- a/src/inventory.cpp +++ b/src/inventory.cpp @@ -20,6 +20,8 @@ const char *ITEM_SPRITE[]={ GLuint *ITEM_TEX; +void itemDraw(Player *p,ITEM_ID id); + unsigned int initInventorySprites(void){ unsigned int i,loadCount=0; ITEM_TEX=(GLuint *)calloc(ITEM_COUNT,sizeof(GLuint)); @@ -36,6 +38,7 @@ Inventory::Inventory(unsigned int s){ sel=0; size=s; item=(struct item_t *)calloc(size,sizeof(struct item_t)); + tossd=false; } Inventory::~Inventory(void){ @@ -74,6 +77,9 @@ int Inventory::takeItem(ITEM_ID id,unsigned char count){ unsigned int i; for(i=0;iloc.x+p->width/2, + p->loc.y+p->width/2+HLINE*3}; + p2 = {(float)(p1.x+p->width*(p->left?-.5:.5)), + p->loc.y+HLINE*3}; + } + if(p->inv->tossd) yes=true; + std::cout<ground=false; } } + if(SDL_KEY==SDLK_q){ + player->inv->itemToss(); + } if(SDL_KEY==SDLK_c){ dialogBox("","You pressed `c`, but nothing happened."); } @@ -287,6 +290,8 @@ namespace ui { } } + if(player->inv->tossd)player->inv->itemToss(); + unsigned int i; if(!dialogBoxExists&&AIpreaddr.size()){ // Flush preloaded AI functions if necessary for(i=0;iinfront){ + hey=hey->infront; + goto LOOP; + } + return -hey->x_start*2; } IndoorWorld::IndoorWorld(void){ -- cgit v1.2.3