diff options
author | Clyne Sullivan <tullivan99@gmail.com> | 2015-10-01 08:24:30 -0400 |
---|---|---|
committer | Clyne Sullivan <tullivan99@gmail.com> | 2015-10-01 08:24:30 -0400 |
commit | 9757c1c7e8704080c4e20cde442baf06960e98e7 (patch) | |
tree | e63438c079b9a934d4158375525f146b1b2904b3 /src/gameplay.cpp | |
parent | b06afc53ce5fa36544218b524f963725bf180fc1 (diff) |
world stuff in sep. file
Diffstat (limited to 'src/gameplay.cpp')
-rw-r--r-- | src/gameplay.cpp | 67 |
1 files changed, 67 insertions, 0 deletions
diff --git a/src/gameplay.cpp b/src/gameplay.cpp new file mode 100644 index 0000000..b32c75a --- /dev/null +++ b/src/gameplay.cpp @@ -0,0 +1,67 @@ +#include <common.h> +#include <world.h> +#include <ui.h> +#include <entities.h> + +extern World *currentWorld; +extern std::vector<Entity*>entity; +extern std::vector<NPC>npc; +extern std::vector<Structures *>build; +extern Player *player; + +int giveTestQuest(NPC *speaker){ + ui::dialogBox("Here, have a quest!"); + player->qh.assign("Test"); + return 0; +} + +int compTestQuest(NPC *speaker){ + if(player->qh.hasQuest("Test")){ + ui::dialogBox("Ooo, that's a nice quest you got there. Lemme finish that for you ;)."); + player->qh.finish("test"); + return 0; + }else{ + ui::dialogBox("You need to get a quest from entity[1] first."); + return 1; + } +} + +void initEverything(void){ + unsigned int i; + + World *test=new World(); + test->generate(SCREEN_WIDTH/2); + test->addLayer(400); + test->addLayer(100); + test->addPlatform(150,100,100,10); + test->addHole(100,150); + currentWorld=test; + + // Make the player + player=new Player(); + player->spawn(0,100); + + // Make structures + entity.push_back(new Entity()); + build.push_back(new Structures()); + entity[0]=build[0]; + + build[0]->spawn(STRUCTURET,0,10); + IndoorWorld *iw=new IndoorWorld(); + iw->generate(200); + build[0]->inside=iw; + + for(i=0;i<entity.size()+1;i++){ + entity[i]->inWorld=test; + switch(i){ + case 1: + NPCp(entity[i])->addAIFunc(giveTestQuest); + break; + case 2: + NPCp(entity[i])->addAIFunc(compTestQuest); + break; + default: + break; + } + } +} |