diff options
-rw-r--r-- | Changelog | 10 | ||||
-rw-r--r-- | main.cpp | 18 | ||||
-rw-r--r-- | src/world.cpp | 4 |
3 files changed, 27 insertions, 5 deletions
@@ -239,3 +239,13 @@ - added y-binding to ortho (if player is high in the sky ortho and UI will match it) - added maximum to gravity's pull - worked on storyline + +11/5/2015: +=========== + + - wrote more storyline (up to 7 pages) + - fixed ortho for when player is inside a building + - began work on ray shading (flashlight) + - (out of class) began experimenting with writing game soundtracks + + ~ About 3400 lines of code + documentation written @@ -92,6 +92,12 @@ Player *player; extern std::vector<Entity * > entity; /* + * Tells if player is currently inside a structure. +*/ + +extern bool worldInside; + +/* * tickCount contains the number of ticks generated since main loop entrance. * This variable might be used anywhere. * @@ -577,10 +583,12 @@ void render(){ * see past the world render */ - if(player->loc.x - SCREEN_WIDTH/2 < currentWorld->getTheWidth() * -0.5f) - offset.x = ((currentWorld->getTheWidth() * -0.5f) + SCREEN_WIDTH / 2) + player->width / 2; - if(player->loc.x + SCREEN_WIDTH/2 > currentWorld->getTheWidth() * 0.5f) - offset.x = ((currentWorld->getTheWidth() * 0.5f) - SCREEN_WIDTH / 2) + player->width / 2; + if(!worldInside){ + if(player->loc.x - SCREEN_WIDTH/2 < currentWorld->getTheWidth() * -0.5f) + offset.x = ((currentWorld->getTheWidth() * -0.5f) + SCREEN_WIDTH / 2) + player->width / 2; + if(player->loc.x + SCREEN_WIDTH/2 > currentWorld->getTheWidth() * 0.5f) + offset.x = ((currentWorld->getTheWidth() * 0.5f) - SCREEN_WIDTH / 2) + player->width / 2; + } if(player->loc.y > 300 ) offset.y = player->loc.y + player->height; @@ -778,7 +786,7 @@ void render(){ glUseProgramObjectARB(0); #endif //SHADERS - #define rays + #define raysSHITUPMYASS #ifdef rays //LIGHT diff --git a/src/world.cpp b/src/world.cpp index 5e7fb41..77872c1 100644 --- a/src/world.cpp +++ b/src/world.cpp @@ -22,6 +22,8 @@ extern std::vector<Entity *> entity; extern std::vector<Structures *> build; +bool worldInside = false; + float worldGetYBase(World *w){ float base = 0; World *ptr = w; @@ -543,11 +545,13 @@ World *World::goInsideStructure(Player *p){ if(build[i]->inWorld==this){ if(p->loc.x > build[i]->loc.x && p->loc.x + p->width < build[i]->loc.x + build[i]->width){ + worldInside = true; return (World *)build[i]->inside; } }else if(build[i]->inside==this){ p->loc.x=build[i]->loc.x + build[i]->width / 2 - p->width / 2; p->loc.y=build[i]->loc.y + HLINE; + worldInside = false; return (World *)build[i]->inWorld; } } |