aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--assets/house1.pngbin788 -> 749 bytes
-rw-r--r--assets/items/SWORD_WOOD.pngbin0 -> 217 bytes
-rw-r--r--assets/names_en-us1
-rw-r--r--assets/player.pngbin577 -> 543 bytes
-rw-r--r--assets/player1.pngbin586 -> 552 bytes
-rw-r--r--assets/player2.pngbin586 -> 557 bytes
-rw-r--r--config/items.h6
-rw-r--r--include/inventory.h2
-rw-r--r--include/ui.h1
-rw-r--r--main.cpp5
-rw-r--r--src/entities.cpp6
-rw-r--r--src/inventory.cpp60
-rw-r--r--src/ui.cpp9
13 files changed, 65 insertions, 25 deletions
diff --git a/assets/house1.png b/assets/house1.png
index 2022992..ce97a81 100644
--- a/assets/house1.png
+++ b/assets/house1.png
Binary files differ
diff --git a/assets/items/SWORD_WOOD.png b/assets/items/SWORD_WOOD.png
new file mode 100644
index 0000000..479eba9
--- /dev/null
+++ b/assets/items/SWORD_WOOD.png
Binary files differ
diff --git a/assets/names_en-us b/assets/names_en-us
index c65808b..a841bb8 100644
--- a/assets/names_en-us
+++ b/assets/names_en-us
@@ -55,6 +55,7 @@ mPingu
mShrek
mLogan
mJohn Cena
+mDex Dogtective
fShani
fIsidra
fAja
diff --git a/assets/player.png b/assets/player.png
index 8881980..3977092 100644
--- a/assets/player.png
+++ b/assets/player.png
Binary files differ
diff --git a/assets/player1.png b/assets/player1.png
index 33e68f2..edf8bf8 100644
--- a/assets/player1.png
+++ b/assets/player1.png
Binary files differ
diff --git a/assets/player2.png b/assets/player2.png
index 20e679b..cfd955f 100644
--- a/assets/player2.png
+++ b/assets/player2.png
Binary files differ
diff --git a/config/items.h b/config/items.h
index fc0ca96..1bd9111 100644
--- a/config/items.h
+++ b/config/items.h
@@ -11,8 +11,8 @@ ID DEBUG_ITEM
ID TEST_ITEM
NAME "Dank MayMay"
TYPE TOOL
- WIDTH HLINE
- HEIGHT HLINE
+ WIDTH HLINE*1
+ HEIGHT HLINE*1
STACKSIZE 420
TEX "assets/items/ITEM_TEST.png"
ENI
@@ -41,5 +41,5 @@ ID SWORD_WOOD
WIDTH HLINE*4
HEIGHT HLINE*10
STACKSIZE 1
- TEX "assets/items/ITEM_SWORD.png"
+ TEX "assets/items/SWORD_WOOD.png"
STOP
diff --git a/include/inventory.h b/include/inventory.h
index 33a113c..5f05f3a 100644
--- a/include/inventory.h
+++ b/include/inventory.h
@@ -91,5 +91,7 @@ public:
void itemUse(void *p);
void initInventorySprites(void);
char *getItemTexturePath(ITEM_ID id);
+int getItemWidth(ITEM_ID);
+int getItemHeight(ITEM_ID);
#endif // INVENTORY_H
diff --git a/include/ui.h b/include/ui.h
index 4d30b9b..f2c0114 100644
--- a/include/ui.h
+++ b/include/ui.h
@@ -27,6 +27,7 @@ namespace ui {
extern unsigned int fontSize;
extern bool dialogBoxExists;
extern unsigned char dialogOptChosen;
+ extern bool edown;
/*
* Initializes the FreeType system.
diff --git a/main.cpp b/main.cpp
index 2203465..1fb5cb1 100644
--- a/main.cpp
+++ b/main.cpp
@@ -212,10 +212,9 @@ static unsigned int fadeIntensity = 0;
* MAIN ************************************************************************
*******************************************************************************/
-int main(int argc, char *argv[]){
- *argv = (char *)argc;
+int main(/*int argc, char *argv[]*/){
+ //*argv = (char *)argc;
gameRunning=false;
-
/*!
* (Attempt to) Initialize SDL libraries so that we can use SDL facilities and eventually
* make openGL calls. Exit if there was an error.
diff --git a/src/entities.cpp b/src/entities.cpp
index 729bcdd..f812919 100644
--- a/src/entities.cpp
+++ b/src/entities.cpp
@@ -169,8 +169,8 @@ Object::Object(ITEM_ID id, bool qo, const char *pd){
type = OBJECTT;
alive = true;
near = false;
- width = HLINE * 8;
- height = HLINE * 8;
+ width = getItemWidth(id);
+ height = getItemHeight(id);
maxHealth = health = 1;
tex = new Texturec(1,getItemTexturePath(id));
@@ -205,7 +205,7 @@ void Entity::draw(void){ //draws the entities
if(type == PLAYERT){
static int texState = 0;
static bool up = true;
- if(loops % (int)((float)5 / (float)speed) == 0){
+ if(loops % (int)((float)2 / (float)speed) == 0){
if(up){
texState+=1;
if(texState==2)up=false;
diff --git a/src/inventory.cpp b/src/inventory.cpp
index 310a6b5..7d3bc6d 100644
--- a/src/inventory.cpp
+++ b/src/inventory.cpp
@@ -26,6 +26,14 @@ char *getItemTexturePath(ITEM_ID id){
return item[id].textureLoc;
}
+int getItemWidth(ITEM_ID id){
+ return item[id].width;
+}
+
+int getItemHeight(ITEM_ID id){
+ return item[id].height;
+}
+
Item::Item(ITEM_ID i, const char *n, ITEM_TYPE t, float w, float h, int m, const char *tl){
id = i;
type = t;
@@ -140,7 +148,7 @@ void Inventory::draw(void){
curCoord[a].y += float((dfp[a]) * sin(angle*PI/180));
r.end = curCoord[a];
- glColor4f(0.0f, 0.0f, 0.0f, ((float)dfp[a]/(float)range)*0.4f);
+ glColor4f(1.0f, 1.0f, 1.0f, ((float)dfp[a]/(float)range)*0.4f);
glBegin(GL_QUADS);
glVertex2i(r.end.x-(itemWide/2), r.end.y-(itemWide/2));
glVertex2i(r.end.x-(itemWide/2)+itemWide, r.end.y-(itemWide/2));
@@ -153,16 +161,30 @@ void Inventory::draw(void){
glBindTexture(GL_TEXTURE_2D, itemtex[inv[a].id]);
glColor4f(1.0f, 1.0f, 1.0f, ((float)dfp[a]/(float)range)*0.8f);
glBegin(GL_QUADS);
- glTexCoord2i(0,1);glVertex2i(r.end.x-(itemWide/2), r.end.y-(itemWide/2));
- glTexCoord2i(1,1);glVertex2i(r.end.x-(itemWide/2)+itemWide, r.end.y-(itemWide/2));
- glTexCoord2i(1,0);glVertex2i(r.end.x-(itemWide/2)+itemWide, r.end.y-(itemWide/2)+itemWide);
- glTexCoord2i(0,0);glVertex2i(r.end.x-(itemWide/2), r.end.y-(itemWide/2)+itemWide);
- glEnd();
+ if(item[inv[a].id].height > item[inv[a].id].width){
+ glTexCoord2i(0,1);glVertex2i(r.end.x-((itemWide/2)*((float)item[inv[a].id].width/(float)item[inv[a].id].height)), r.end.y-(itemWide/2));
+ glTexCoord2i(1,1);glVertex2i(r.end.x+((itemWide/2)*((float)item[inv[a].id].width/(float)item[inv[a].id].height)), r.end.y-(itemWide/2));
+ glTexCoord2i(1,0);glVertex2i(r.end.x+((itemWide/2)*((float)item[inv[a].id].width/(float)item[inv[a].id].height)), r.end.y+(itemWide/2));
+ glTexCoord2i(0,0);glVertex2i(r.end.x-((itemWide/2)*((float)item[inv[a].id].width/(float)item[inv[a].id].height)), r.end.y+(itemWide/2));
+ }else{
+ glTexCoord2i(0,1);glVertex2i(r.end.x-(itemWide/2), r.end.y-(itemWide/2)*((float)item[inv[a].id].height/(float)item[inv[a].id].width));
+ glTexCoord2i(1,1);glVertex2i(r.end.x+(itemWide/2), r.end.y-(itemWide/2)*((float)item[inv[a].id].height/(float)item[inv[a].id].width));
+ glTexCoord2i(1,0);glVertex2i(r.end.x+(itemWide/2), r.end.y+(itemWide/2)*((float)item[inv[a].id].height/(float)item[inv[a].id].width));
+ glTexCoord2i(0,0);glVertex2i(r.end.x-(itemWide/2), r.end.y+(itemWide/2)*((float)item[inv[a].id].height/(float)item[inv[a].id].width));
+ } glEnd();
glDisable(GL_TEXTURE_2D);
ui::putText(r.end.x-(itemWide/2),r.end.y-(itemWide*.9),"%s",item[inv[a].id].name);
ui::putText(r.end.x-(itemWide/2)+(itemWide*.85),r.end.y-(itemWide/2),"%d",inv[a].count);
}
a++;
+ if(sel==a){
+ glBegin(GL_LINES);
+ glColor4f(1.0f, 0.0f, 0.0f, 0.0f);
+ glVertex2i(r.start.x,r.start.y);
+ glColor4f(1.0f, 0.0f, 0.0f, 0.8f);
+ glVertex2i(r.end.x+20, r.end.y-20);
+ glEnd();
+ }
}
}else if(invHover){
static unsigned int highlight = 0;
@@ -179,7 +201,7 @@ void Inventory::draw(void){
highlight=sel+thing;
if(highlight>numSlot-1)highlight=numSlot-1;
if(SDL_GetMouseState(NULL, NULL) & SDL_BUTTON(SDL_BUTTON_LEFT)){
- highlight>numSlot-1 ? sel=numSlot-1 : sel = highlight;
+ sel = highlight;
mouseSel=false;
invHover=false;
selected = true;
@@ -205,10 +227,10 @@ void Inventory::draw(void){
glColor4f(0.0f, 0.0f, 0.0f, a == highlight ? 0.5f : 0.1f);
glBegin(GL_QUADS);
- glVertex2i(r.end.x-(itemWide/2), r.end.y-(itemWide/2));
- glVertex2i(r.end.x-(itemWide/2)+itemWide, r.end.y-(itemWide/2));
- glVertex2i(r.end.x-(itemWide/2)+itemWide, r.end.y-(itemWide/2)+itemWide);
- glVertex2i(r.end.x-(itemWide/2), r.end.y-(itemWide/2)+itemWide);
+ glVertex2i(r.end.x-(itemWide/2), r.end.y-(itemWide/2));
+ glVertex2i(r.end.x+(itemWide/2), r.end.y-(itemWide/2));
+ glVertex2i(r.end.x+(itemWide/2), r.end.y+(itemWide/2));
+ glVertex2i(r.end.x-(itemWide/2), r.end.y+(itemWide/2));
glEnd();
if(inv[a].count > 0){
@@ -216,16 +238,24 @@ void Inventory::draw(void){
glBindTexture(GL_TEXTURE_2D, itemtex[inv[a].id]);
glColor4f(1.0f, 1.0f, 1.0f, a == highlight ? 0.8f : 0.2f);
glBegin(GL_QUADS);
- glTexCoord2i(0,1);glVertex2i(r.end.x-(itemWide/2), r.end.y-(itemWide/2));
- glTexCoord2i(1,1);glVertex2i(r.end.x-(itemWide/2)+itemWide, r.end.y-(itemWide/2));
- glTexCoord2i(1,0);glVertex2i(r.end.x-(itemWide/2)+itemWide, r.end.y-(itemWide/2)+itemWide);
- glTexCoord2i(0,0);glVertex2i(r.end.x-(itemWide/2), r.end.y-(itemWide/2)+itemWide);
+ if(item[inv[a].id].height > item[inv[a].id].width){
+ glTexCoord2i(0,1);glVertex2i(r.end.x-((itemWide/2)*((float)item[inv[a].id].width/(float)item[inv[a].id].height)), r.end.y-(itemWide/2));
+ glTexCoord2i(1,1);glVertex2i(r.end.x+((itemWide/2)*((float)item[inv[a].id].width/(float)item[inv[a].id].height)), r.end.y-(itemWide/2));
+ glTexCoord2i(1,0);glVertex2i(r.end.x+((itemWide/2)*((float)item[inv[a].id].width/(float)item[inv[a].id].height)), r.end.y+(itemWide/2));
+ glTexCoord2i(0,0);glVertex2i(r.end.x-((itemWide/2)*((float)item[inv[a].id].width/(float)item[inv[a].id].height)), r.end.y+(itemWide/2));
+ }else{
+ glTexCoord2i(0,1);glVertex2i(r.end.x-(itemWide/2), r.end.y-(itemWide/2)*((float)item[inv[a].id].height/(float)item[inv[a].id].width));
+ glTexCoord2i(1,1);glVertex2i(r.end.x+(itemWide/2), r.end.y-(itemWide/2)*((float)item[inv[a].id].height/(float)item[inv[a].id].width));
+ glTexCoord2i(1,0);glVertex2i(r.end.x+(itemWide/2), r.end.y+(itemWide/2)*((float)item[inv[a].id].height/(float)item[inv[a].id].width));
+ glTexCoord2i(0,0);glVertex2i(r.end.x-(itemWide/2), r.end.y+(itemWide/2)*((float)item[inv[a].id].height/(float)item[inv[a].id].width));
+ }
glEnd();
glDisable(GL_TEXTURE_2D);
//ui::putText(r.end.x-(itemWide/2)+(itemWide*.85),r.end.y-(itemWide/1.75),"%d",inv[a].count);
}
a++;
}
+ if(inv[highlight].count > 0)ui::putStringCentered(player->loc.x+player->width/2, player->loc.y + range*.75,item[inv[highlight].id].name);
}
if(inv[sel].count)itemDraw(player,inv[sel].id);
lop++;
diff --git a/src/ui.cpp b/src/ui.cpp
index 9e03f97..c0b5004 100644
--- a/src/ui.cpp
+++ b/src/ui.cpp
@@ -68,6 +68,11 @@ namespace ui {
*/
vec2 mouse;
+
+ /*
+ * Variety of keydown bools
+ */
+ bool edown;
/*
* Debugging flags.
@@ -512,7 +517,7 @@ namespace ui {
*/
if(player->inv->invOpen){
- hub.y = player->loc.y + fontSize * 10;
+ hub.y = player->loc.y + fontSize * 8;
hub.x = player->loc.x;
putStringCentered(hub.x,hub.y,"Current Quests:");
@@ -641,6 +646,7 @@ DONE:
if(debug)posFlag ^= true;
break;
case SDLK_e:
+ edown=true;
if(!heyOhLetsGo){
heyOhLetsGo = loops;
player->inv->mouseSel = false;
@@ -670,6 +676,7 @@ DONE:
player->speed = 1;
break;
case SDLK_e:
+ edown=false;
if(player->inv->invHover){
player->inv->invHover = false;
}else{