]> code.bitgloo.com Git - clyne/gamedev.git/commitdiff
Villages!
authordrumsetmonkey <abelleisle@roadrunner.com>
Tue, 23 Feb 2016 12:31:22 +0000 (07:31 -0500)
committerdrumsetmonkey <abelleisle@roadrunner.com>
Tue, 23 Feb 2016 12:31:22 +0000 (07:31 -0500)
1  2 
include/ui.h
main.cpp
src/entities.cpp
src/world.cpp

diff --cc include/ui.h
index a3084eb0f43debcf275f61115ec51b9390f104bf,671a92c77f7aea8c552c30bd46a4c4a55c022918..6a81ff8e360ca365171d5456531ae4c7ea082392
@@@ -101,14 -95,15 +101,16 @@@ namespace ui 
        /*
         *      These flags are used elsewhere.
        */
+       
+       extern unsigned int fontSize;
+       
        extern bool debug;
        extern bool posFlag;
-       extern unsigned int fontSize;
-       extern bool                      dialogBoxExists;
+       
        extern unsigned char dialogOptChosen;
+       extern bool dialogBoxExists;
        extern bool dialogImportant;
 +      extern bool dialogPassive;
  
        extern unsigned int textWrapLimit;
  
diff --cc main.cpp
Simple merge
Simple merge
diff --cc src/world.cpp
index 6e72328325c9f2ae49b120ebb728f93edce29c94,811ae5a8d197867d06a32376a806817d3ef7e26d..2df0712df9ed00ad02c30b5639d041964dd04dd9
@@@ -323,10 -336,13 +323,12 @@@ void World::update(Player *p,unsigned i
  
        for(auto &e : entity){
                e->loc.y += e->vel.y * delta;
+               
                if(e->type != STRUCTURET && e->canMove){
                        e->loc.x += e->vel.x * delta;
+                       
                        if(e->vel.x < 0)e->left = true;
 -         else if(e->vel.x > 0)e->left = false;
 -         
 +                      else if(e->vel.x > 0)e->left = false;
                }
        }
  
@@@ -949,11 -966,9 +951,10 @@@ void World::detect(Player *p)
         *      Handle all remaining entities in this world. 
        */
        
-       static int what = 0;
 +//LOOOOP:
        for(auto &e : entity)
 -              singleDetect(e);
 -              
 +              std::thread(&World::singleDetect,this,e).detach();
 +              //hey->singleDetect(e);
        for(auto &part : particles){
                int l;
                unsigned int i;
                }else{
                        if(part->gravity && part->vely > -2)part->vely-=.003 * deltaTime;
                }
-               what++;
-       }what=0;
+       }
 +      for(auto &b : build){
 +              switch(b->bsubtype){
 +                      case FOUNTAIN:
 +                              for(int r = 0; r < (rand()%25)+10;r++){
 +                                      addParticle(    rand()%HLINE*3 + b->loc.x + b->width/2,
 +                                                                                              b->loc.y + b->height, 
 +                                                                                              HLINE*1.25,
 +                                                                                              HLINE*1.25, 
 +                                                                                              rand()%2 == 0?-(rand()%7)*.01:(rand()%7)*.01,
 +                                                                                              ((4+rand()%6)*.05), 
 +                                                                                              {0,0,255}, 
 +                                                                                              2500);
 +
 +                                      particles.back()->fountain = true;
 +                              }
 +                              break;
 +                      case FIRE_PIT:
 +                              for(int r = 0; r < (rand()%20)+10;r++){
 +                                      addParticle(rand()%(int)(b->width/2) + b->loc.x+b->width/4, b->loc.y+3*HLINE, HLINE, HLINE, rand()%2 == 0?-(rand()%3)*.01:(rand()%3)*.01,((4+rand()%6)*.005), {255,0,0}, 400);
 +                                      particles.back()->gravity = false;
 +                                      particles.back()->behind = true;
 +                              }
 +                              break;
 +                      default: break;
 +              }
 +      }
 +
 +      for(auto &v : village){
 +              if(p->loc.x > v.start.x && p->loc.x < v.end.x){
 +                      if(!v.in){
 +                              ui::passiveImportantText(5000,"Welcome to %s",v.name.c_str());
 +                              v.in = true;
 +                      }
 +              }else{
 +                      v.in = false;
 +              }
 +      }
 +
 +      /*if(hey->infront){
 +              hey = hey->infront;
 +              goto LOOOOP;
 +      }*/
  }
 +
  void World::addStructure(BUILD_SUB sub, float x,float y, char *tex, const char *inside){
        build.push_back(new Structures());
        build.back()->inWorld = this;