]> code.bitgloo.com Git - clyne/gamedev.git/commitdiff
indoor ortho fix
authorClyne Sullivan <tullivan99@gmail.com>
Thu, 5 Nov 2015 14:20:33 +0000 (09:20 -0500)
committerClyne Sullivan <tullivan99@gmail.com>
Thu, 5 Nov 2015 14:20:33 +0000 (09:20 -0500)
Changelog
main.cpp
src/world.cpp

index d11bfe510a537715cfefcad6318c9bcd4b857360..1dd169dfea249977852aa1ae021585aeb6ded8d6 100644 (file)
--- a/Changelog
+++ b/Changelog
        - 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
index 07e2fb00be803aa8dbb16cbab7f412147b021df9..cc42acf24079a880e0855f2a963f09ded9bcca4a 100644 (file)
--- a/main.cpp
+++ b/main.cpp
@@ -91,6 +91,12 @@ World                                                        *currentWorld=NULL;
 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
index 5e7fb41faf143012fee718d6444c4f6e834261ff..77872c1b52ec11f061aed8ee25d08a0c25f45df2 100644 (file)
@@ -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;
                }
        }