aboutsummaryrefslogtreecommitdiffstats
path: root/src/items.cpp
diff options
context:
space:
mode:
authordrumsetmonkey <abelleisle@roadrunner.com>2016-04-28 10:31:16 -0400
committerdrumsetmonkey <abelleisle@roadrunner.com>2016-04-28 10:31:16 -0400
commit2e026aff928b30267a39ef6fdeec3e43e9f106e6 (patch)
treeb787550264cb3f1a88401f0240968c99b5138237 /src/items.cpp
parent53800e07513f4a625ba70ff7d805d158a6b42121 (diff)
New inventory system
Diffstat (limited to 'src/items.cpp')
-rw-r--r--src/items.cpp117
1 files changed, 117 insertions, 0 deletions
diff --git a/src/items.cpp b/src/items.cpp
new file mode 100644
index 0000000..b25b482
--- /dev/null
+++ b/src/items.cpp
@@ -0,0 +1,117 @@
+#include <inventory.hpp>
+
+/************************************************************************************
+* GLOBAL *
+************************************************************************************/
+
+/**************************************************
+* USE ITEM *
+**************************************************/
+
+int BaseItem::useItem()
+{
+ return 0;
+}
+
+int Sword::useItem()
+{
+ std::cout << "Swing!" << std::endl;
+ return 0;
+}
+
+int Bow::useItem()
+{
+ return 0;
+}
+
+// TODO chance to hurt
+int RawFood::useItem()
+{
+ return 0;
+}
+
+int Food::useItem()
+{
+ std::cout << "Yum!" << std::endl;
+ return 0;
+}
+
+
+/**************************************************
+* CLONE *
+**************************************************/
+
+BaseItem* BaseItem::clone()
+{
+ return new BaseItem(*this);
+}
+
+Sword* Sword::clone()
+{
+ return new Sword(*this);
+}
+
+Bow* Bow::clone()
+{
+ return new Bow(*this);
+}
+
+Food* Food::clone()
+{
+ return new Food(*this);
+}
+
+RawFood* RawFood::clone()
+{
+ return new RawFood(*this);
+}
+
+/************************************************************************************
+* ITEM SPECIFIC *
+************************************************************************************/
+
+/**************************************************
+* ITEM *
+**************************************************/
+
+Item::~Item()
+{
+ delete tex;
+}
+
+GLuint Item::rtex()
+{
+ return tex->image[0];
+}
+
+GLuint Item::rtex(int n)
+{
+ return tex->image[n];
+}
+
+/**************************************************
+* SWORD *
+**************************************************/
+
+float Sword::getDamage()
+{
+ return damage;
+}
+
+/**************************************************
+* BOW *
+**************************************************/
+
+float Bow::getDamage()
+{
+ return damage;
+}
+
+/**************************************************
+* FOODS *
+**************************************************/
+
+float RawFood::getHealth()
+{
+ return health;
+}