diff options
author | drumsetmonkey <abelleisle@roadrunner.com> | 2016-02-04 09:25:25 -0500 |
---|---|---|
committer | drumsetmonkey <abelleisle@roadrunner.com> | 2016-02-04 09:25:25 -0500 |
commit | 164de60e121552d92712179d480ef1859f42127a (patch) | |
tree | ab91e0422c6fe159051149cc1e77cb7689d1f3e6 /src/world.cpp | |
parent | 814dab606cfeeabd4aeecba852507c3c3f1a005f (diff) | |
parent | 2cb30b167401f1785ebfa744e8612639a150deb2 (diff) |
Volume Mixer
Diffstat (limited to 'src/world.cpp')
-rw-r--r-- | src/world.cpp | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/src/world.cpp b/src/world.cpp index 7126095..6118851 100644 --- a/src/world.cpp +++ b/src/world.cpp @@ -895,10 +895,10 @@ void World::singleDetect(Entity *e){ * Insure that the entity doesn't fall off either edge of the world. */ - if(e->loc.x<x_start){ // Left bound + if(e->loc.x < x_start){ // Left bound e->vel.x=0; - e->loc.x=x_start + HLINE / 2; + e->loc.x=(float)x_start + HLINE / 2; }else if(e->loc.x + e->width + HLINE > x_start + getWidth(this)){ // Right bound @@ -1071,6 +1071,7 @@ char *World::setToRight(const char *file){ World *World::goWorldLeft(Player *p){ World *tmp; + if(toLeft && p->loc.x < x_start + HLINE * 15){ tmp = loadWorldFromXML(toLeft); @@ -1200,7 +1201,8 @@ void World::save(void){ #include <sstream> -extern int commonAIFunc(NPC *); +extern int commonAIFunc(NPC *); +extern void commonTriggerFunc(Mob *); void World::load(void){ std::string save,data,line; @@ -1449,8 +1451,6 @@ World *loadWorldFromXML(const char *path){ strcpy(currentXML,"xml/"); strcat(currentXML,path); - //std::cout<<currentXML<<std::endl; - xml.LoadFile(currentXML); wxml = xml.FirstChildElement("World"); @@ -1523,7 +1523,11 @@ World *loadWorldFromXML(const char *path){ tmp->addStructure((BUILD_SUB)wxml->UnsignedAttribute("type"),getRand() % tmp->getTheWidth() / 2.0f,100,ptr); else tmp->addStructure((BUILD_SUB)wxml->UnsignedAttribute("type"),spawnx,wxml->FloatAttribute("y"),ptr); + }else if(!strcmp(name,"trigger")){ + tmp->addMob(MS_TRIGGER,wxml->FloatAttribute("x"),0,commonTriggerFunc); + tmp->mob.back()->heyid = wxml->Attribute("id"); } + wxml = wxml->NextSiblingElement(); } |