aboutsummaryrefslogtreecommitdiffstats
path: root/src/entities.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/entities.cpp')
-rw-r--r--src/entities.cpp34
1 files changed, 29 insertions, 5 deletions
diff --git a/src/entities.cpp b/src/entities.cpp
index a8e9bfb..e979e33 100644
--- a/src/entities.cpp
+++ b/src/entities.cpp
@@ -8,6 +8,8 @@ extern World *currentWorld;
extern Player *player;
+extern const char *itemName;
+
void Entity::spawn(float x, float y){ //spawns the entity you pass to it based off of coords and global entity settings
loc.x = x;
loc.y = y;
@@ -91,7 +93,21 @@ Mob::Mob(int sub){
inv = new Inventory(NPC_INV_SIZE);
}
-Object::Object(int id):ID(id){
+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, "assets/items/ITEM_SWORD.png");
+
+ questObject = false;
+ pickupDialog="\0";
+}
+
+Object::Object(int id, bool qo, char *pd):identifier(id),questObject(qo),pickupDialog(pd){
type = OBJECTT;
alive = true;
near = false;
@@ -175,8 +191,6 @@ void Entity::draw(void){ //draws the entities
default:
break;
}
- }else if(type == OBJECTT){
- tex->bind(0);
}else{
tex->bind(0);
}
@@ -294,9 +308,19 @@ void NPC::interact(){ //have the npc's interact back to the player
}
}
+extern void waitForDialog(void);
void Object::interact(){
- this->alive = false;
- player->inv->addItem((ITEM_ID)(ID), (char)1);
+ if(questObject){
+ char opt[]=":No:Yes";
+ ui::dialogBox("You",opt,pickupDialog);
+ if(ui::dialogOptChosen == 1){
+ this->alive = false;
+ player->inv->addItem((ITEM_ID)(identifier), (char)1);
+ }
+ }else{
+ this->alive = false;
+ player->inv->addItem((ITEM_ID)(identifier), (char)1);
+ }
}
/*