aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authordrumsetmonkey <abelleisle@roadrunner.com>2015-12-09 08:48:45 -0500
committerdrumsetmonkey <abelleisle@roadrunner.com>2015-12-09 08:48:45 -0500
commitce169efec21d44b6c7b3133280d9088ba1c108a5 (patch)
treef3d4567d626215bf268b4c8a7648dd8294644796 /src
parentfb1cb2e2f3af4a7bc5717e31b31175d850dd7be9 (diff)
parenta0e500dbf1a3fddebf8e057905fa299d1205a5fc (diff)
Merge branch 'master' of http://github.com/tcsullivan/gamedev
Diffstat (limited to 'src')
-rw-r--r--src/entities.cpp31
1 files changed, 25 insertions, 6 deletions
diff --git a/src/entities.cpp b/src/entities.cpp
index 08af0a9..fc2c316 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;
}
NPC::~NPC(){
while(!aiFunc.empty()){
@@ -307,26 +309,43 @@ void NPC::addAIFunc(int (*func)(NPC *),bool preload){
else aiFunc.push_back(func);
}
+const char *randomDialog[10] = {
+ "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;
-
- left = (player->loc.x < loc.x);
- right = !left;
if(!func(this)){
if(aiFunc.size())aiFunc.erase(aiFunc.begin());
}
- canMove=true;
+ }else{
+ ui::dialogBox(name,NULL,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",pickupDialog);
ui::waitForDialog();
if(ui::dialogOptChosen == 1){
player->inv->addItem((ITEM_ID)(identifier), (char)1);