diff options
author | Clyne Sullivan <tullivan99@gmail.com> | 2015-09-28 08:48:38 -0400 |
---|---|---|
committer | Clyne Sullivan <tullivan99@gmail.com> | 2015-09-28 08:48:38 -0400 |
commit | 82727d2d50d6a71cd5e9d5a7c00fa41888a39eb7 (patch) | |
tree | 34334d941f7947e9933049e56c000a878f5371b3 /src/world.cpp | |
parent | 9630c8a49cbad7b1b71b9401ff24881ebf4c7c25 (diff) |
improvements ;)
Diffstat (limited to 'src/world.cpp')
-rw-r--r-- | src/world.cpp | 24 |
1 files changed, 21 insertions, 3 deletions
diff --git a/src/world.cpp b/src/world.cpp index a5a6f4a..9f60a4a 100644 --- a/src/world.cpp +++ b/src/world.cpp @@ -107,10 +107,10 @@ LOOP2: // Draw each world ui::putText(entity[i]->loc.x,entity[i]->loc.y,"%d",i); } } - glColor3ub(255,0,0); + safeSetColor(255+shade*2,0+shade,0+shade); for(i=0;i<current->platform.size();i++){ - glRectf(current->platform[i].p1.x,current->platform[i].p1.y, - current->platform[i].p2.x,current->platform[i].p2.y); + glRectf(current->platform[i].p1.x,current->platform[i].p1.y+yoff-DRAW_Y_OFFSET, + current->platform[i].p2.x,current->platform[i].p2.y+yoff-DRAW_Y_OFFSET); } if(current->infront){ // If there's a world in front of the one that was just drawn yoff-=DRAW_Y_OFFSET; // draw it as well. @@ -217,6 +217,24 @@ void World::addPlatform(float x,float y,float w,float h){ platform.push_back((Platform){{x,y},{x+w,y+h}}); } +World *World::goInsideStructure(Player *p){ + unsigned int i; + for(i=0;i<entity.size();i++){ + if(entity[i]->type==-1){ + if(entity[i]->inWorld==this){ + if(p->loc.x>entity[i]->loc.x&&p->loc.x+p->width<entity[i]->loc.x+entity[i]->width){ + return (World *)((Structures *)entity[i])->inside; + } + }else if(((Structures *)entity[i])->inside==this){ + p->loc.x=entity[i]->loc.x+entity[i]->width/2-p->width/2; + p->loc.y=entity[i]->loc.y+HLINE; + return (World *)entity[i]->inWorld; + } + } + } + return this; +} + IndoorWorld::IndoorWorld(void){ |