aboutsummaryrefslogtreecommitdiffstats
path: root/src/entities.cpp
diff options
context:
space:
mode:
authordrumsetmonkey <abelleisle@roadrunner.com>2015-12-14 21:45:25 -0500
committerdrumsetmonkey <abelleisle@roadrunner.com>2015-12-14 21:45:25 -0500
commit426809972df04eebb4702432c352b8e7d88f792d (patch)
tree35d5e4903cb18448a91cd8f298effc1db45ebf33 /src/entities.cpp
parenta2c6134f2527efbbf46954bdd6056e43d1e00848 (diff)
parent43bbcf02fd5e4e69a9aa521fa4cd572cc8675cf3 (diff)
Shit
Diffstat (limited to 'src/entities.cpp')
-rw-r--r--src/entities.cpp33
1 files changed, 27 insertions, 6 deletions
diff --git a/src/entities.cpp b/src/entities.cpp
index f2d7270..5c00cc7 100644
--- a/src/entities.cpp
+++ b/src/entities.cpp
@@ -102,6 +102,8 @@ NPC::NPC(){ //sets all of the NPC specific traits on object creation
tex = new Texturec(1,"assets/NPC.png");
inv = new Inventory(NPC_INV_SIZE);
+
+ randDialog = rand() % 10 - 1;
}
NPC::~NPC(){
while(!aiFunc.empty()){
@@ -146,7 +148,7 @@ Mob::Mob(int sub){
height = HLINE * 8;
tex = new Texturec(1, "assets/robin.png");
case MS_TRIGGER:
- width = HLINE * 8;
+ width = HLINE * 20;
height = 2000;
tex = new Texturec(0);
break;
@@ -307,22 +309,43 @@ void NPC::addAIFunc(int (*func)(NPC *),bool preload){
else aiFunc.push_back(func);
}
+const char *randomDialog[] = {
+ "What a beautiful day it is.",
+ "Have you ever went fast? I have.",
+ "I heard if you complete a quest, you'll get a special reward.",
+ "How much wood could a woodchuck chuck if a woodchuck could chuck wood?",
+ "I don\'t think anyone has ever been able to climb up that hill.",
+ "If you ever see a hole in the ground, watch out; it could mean the end for you.",
+ "Did you know this game has over 4000 lines of code? I didn\'t. I didn't even know I was in a game until now...",
+ "HELP MY CAPS LOCK IS STUCK",
+ "You know, if anyone ever asked me who I wanted to be when I grow up, I would say Abby Ross.",
+ "I want to have the wallpaper in our house changed. It doesn\'t really fit the environment."
+};
+
void NPC::interact(){ //have the npc's interact back to the player
int (*func)(NPC *);
loc.y += 5;
+
+ canMove=false;
+ left = (player->loc.x < loc.x);
+ right = !left;
+
if(aiFunc.size()){
func=aiFunc.front();
- canMove=false;
+
if(!func(this)){
if(aiFunc.size())aiFunc.erase(aiFunc.begin());
}
- canMove=true;
+ }else{
+ ui::dialogBox(name,NULL,false,randomDialog[randDialog]);
}
+ ui::waitForDialog();
+ canMove=true;
}
void Object::interact(void){
if(questObject && alive){
- ui::dialogBox("You",":Yes:No",pickupDialog);
+ ui::dialogBox(player->name,":Yes:No",false,pickupDialog);
ui::waitForDialog();
if(ui::dialogOptChosen == 1){
player->inv->addItem((ITEM_ID)(identifier), (char)1);
@@ -411,8 +434,6 @@ void Mob::wander(int timeRun){
case MS_TRIGGER:
if(player->loc.x + player->width / 2 > loc.x &&
player->loc.x + player->width / 2 < loc.x + width ){
- if(player->left)player->loc.x = loc.x + width;
- else if(player->right) player->loc.x = loc.x - player->width;
hey(this);
}
break;