aboutsummaryrefslogtreecommitdiffstats
path: root/src/gameplay.cpp
diff options
context:
space:
mode:
authorClyne Sullivan <tullivan99@gmail.com>2016-02-05 08:29:56 -0500
committerClyne Sullivan <tullivan99@gmail.com>2016-02-05 08:29:56 -0500
commitb18d9c1b0fa305f82ddd0633e969a1a38869db6d (patch)
tree8096f4a112f633ed2d4d1ee67c475d97d7648823 /src/gameplay.cpp
parent814dab606cfeeabd4aeecba852507c3c3f1a005f (diff)
font improvements
Diffstat (limited to 'src/gameplay.cpp')
-rw-r--r--src/gameplay.cpp64
1 files changed, 52 insertions, 12 deletions
diff --git a/src/gameplay.cpp b/src/gameplay.cpp
index 1103cfa..00faf70 100644
--- a/src/gameplay.cpp
+++ b/src/gameplay.cpp
@@ -173,7 +173,7 @@ int commonAIFunc(NPC *speaker){
speaker->dialogIndex = 9999;
return 0;
}else if(exml->QueryBoolAttribute("pause",&stop) == XML_NO_ERROR && stop){
- speaker->dialogIndex = 9999;
+ //speaker->dialogIndex = 9999;
return 1;
}else return commonAIFunc(speaker);
}else{
@@ -191,6 +191,47 @@ int commonAIFunc(NPC *speaker){
return 0;
}
+void commonTriggerFunc(Mob *callee){
+ static bool lock = false;
+ XMLDocument xml;
+ XMLElement *exml;
+
+ char *text,*pch;
+
+ if(!lock){
+ lock = true;
+
+ xml.LoadFile(currentXML);
+ exml = xml.FirstChildElement("Trigger");
+
+ while(strcmp(exml->Attribute("id"),callee->heyid.c_str()))
+ exml = exml->NextSiblingElement();
+
+ player->vel.x = 0;
+
+ ui::toggleBlackFast();
+ ui::waitForCover();
+
+ text = new char[256];
+ strcpy(text,exml->GetText());
+ pch = strtok(text,"\n");
+
+ while(pch){
+ ui::importantText(pch);
+ ui::waitForDialog();
+
+ pch = strtok(NULL,"\n");
+ }
+
+ delete[] text;
+
+ ui::toggleBlackFast();
+
+ callee->alive = false;
+ lock = false;
+ }
+}
+
void destroyEverything(void);
void initEverything(void){
std::vector<std::string> xmlFiles;
@@ -227,17 +268,6 @@ void initEverything(void){
}
}
- /*
- * Spawn the player and begin the game.
- */
-
- player = new Player();
- player->spawn(200,100);
-
- currentWorld->bgmPlay(NULL);
- atexit(destroyEverything);
- std::cout << "Hey";
-
pauseMenu.items.push_back(ui::createParentButton({-256/2,0},{256,75},{0.0f,0.0f,0.0f}, "Resume"));
pauseMenu.items.push_back(ui::createChildButton({-256/2,-100},{256,75},{0.0f,0.0f,0.0f}, "Options"));
pauseMenu.items.push_back(ui::createButton({-256/2,-200},{256,75},{0.0f,0.0f,0.0f}, "Save and Quit", ui::quitGame));
@@ -252,6 +282,16 @@ void initEverything(void){
optionsMenu.child = NULL;
optionsMenu.parent = &pauseMenu;
// optionsMenu.push_back(ui::createButton({-256/2,-200},{256,75},{0.0f,0.0f,0.0f}, (const char*)("Save and Quit"), );
+
+ /*
+ * Spawn the player and begin the game.
+ */
+
+ player = new Player();
+ player->spawn(200,100);
+
+ currentWorld->bgmPlay(NULL);
+ atexit(destroyEverything);
}
extern std::vector<int (*)(NPC *)> AIpreload;