From: drumsetmonkey Date: Tue, 23 Feb 2016 12:31:22 +0000 (-0500) Subject: Villages! X-Git-Url: https://code.bitgloo.com/?a=commitdiff_plain;h=0396f428411eb015f796643f9e7e38ca97f8fd42;p=clyne%2Fgamedev.git Villages! --- 0396f428411eb015f796643f9e7e38ca97f8fd42 diff --cc include/ui.h index a3084eb,671a92c..6a81ff8 --- a/include/ui.h +++ b/include/ui.h @@@ -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 src/world.cpp index 6e72328,811ae5a..2df0712 --- a/src/world.cpp +++ b/src/world.cpp @@@ -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. */ +//LOOOOP: - static int what = 0; 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; @@@ -969,52 -984,8 +970,51 @@@ }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;