]> code.bitgloo.com Git - clyne/gamedev.git/commitdiff
RENDERING
authordrumsetmonkey <abelleisle@roadrunner.com>
Thu, 12 May 2016 12:05:34 +0000 (08:05 -0400)
committerdrumsetmonkey <abelleisle@roadrunner.com>
Thu, 12 May 2016 12:05:34 +0000 (08:05 -0400)
1  2 
brice.dat
include/common.hpp
include/entities.hpp
main.cpp
src/common.cpp
src/entities.cpp
src/inventory.cpp
src/ui.cpp
src/world.cpp

diff --cc brice.dat
index 573541ac9702dd3969c9bc859d2b91ec1f7e6e56,ea71945339f7a7cd6d35324a11df49578bb93bfc..61d57c2785952fa6cb22f35f6db947ff5ddf91d2
+++ b/brice.dat
@@@ -1,1 -1,5 +1,5 @@@
 -canSprint
 -0
+ 2
+ canJump
+ 0
++canSprint
 +0
Simple merge
Simple merge
diff --cc main.cpp
Simple merge
diff --cc src/common.cpp
Simple merge
index efe9d13edc1747cc9cbaccd1b9c1def627c3c249,64feaa5afa04b8a6464275333ef35afabaa45c9d..5084fd6a38d7a23666d710726d9200f15a25fca0
@@@ -72,24 -72,28 +72,29 @@@ void randGetomName(Entity *e
        delete[] bufs;
  }
  
- // spawns the entity you pass to it based off of coords and global entity settings
- void Entity::spawn(float x, float y)
+ Entity::Entity(void)
  {
-       loc.x = x;
-       loc.y = y;
-       vel.x = 0;
-       vel.y = 0;
+       vel = 0;
+       width = 0;
+       height = 0;
+       health = 0;
+       maxHealth = 0;
+       z = 1.0f;
        targetx = 0.9112001f;
  
-       alive   = true;
-       right   = true;
-       left    = false;
-       near    = false;
-       //canMove       = true;
-       ground  = false;
+       type = UNKNOWNT;
+       // set flags
+       alive      = true;
+       right      = true;
+       left       = false;
+       near       = false;
+       canMove    = true;
+       ground     = false;
        forcedMove = false;
 +      z = -1.0f;
  
+       // clear counters
        ticksToUse = 0;
        hitCooldown = 0;
  
Simple merge
diff --cc src/ui.cpp
Simple merge
diff --cc src/world.cpp
index fb408648fdc1813f1086bc0e03f8e98da178f6e5,4fe27432d21bc922efd507e6273ccc8777a6eac3..88ef57a523aca040ccafd8db814fbce4aeb9b814
@@@ -285,22 -276,14 +276,14 @@@ void World::drawBackgrounds(void
                              vec2(0.0f, 1.0f),
                              vec2(0.0f, 0.0f)};
  
-       /*safeSetColorA(255, 255, 255, alpha);
-       glBegin(GL_QUADS);
-               glTexCoord2i(0, 0); glVertex2i(offset.x - backgroundOffset.x - 5, offset.y + backgroundOffset.y);
-               glTexCoord2i(1, 0); glVertex2i(offset.x + backgroundOffset.x + 5, offset.y + backgroundOffset.y);
-               glTexCoord2i(1, 1); glVertex2i(offset.x + backgroundOffset.x + 5, offset.y - backgroundOffset.y);
-               glTexCoord2i(0, 1); glVertex2i(offset.x - backgroundOffset.x - 5, offset.y - backgroundOffset.y);
-       glEnd();*/
      bgTex(0);
 -    GLfloat back_tex_coord[] = {offset.x - backgroundOffset.x - 5, offset.y + backgroundOffset.y, 1.0f,
 -                                offset.x + backgroundOffset.x + 5, offset.y + backgroundOffset.y, 1.0f,
 -                                offset.x + backgroundOffset.x + 5, offset.y - backgroundOffset.y, 1.0f,
 +    GLfloat back_tex_coord[] = {offset.x - backgroundOffset.x - 5, offset.y + backgroundOffset.y, 10.0f,
 +                                offset.x + backgroundOffset.x + 5, offset.y + backgroundOffset.y, 10.0f,
 +                                offset.x + backgroundOffset.x + 5, offset.y - backgroundOffset.y, 10.0f,
  
 -                                offset.x + backgroundOffset.x + 5, offset.y - backgroundOffset.y, 1.0f,
 -                                offset.x - backgroundOffset.x - 5, offset.y - backgroundOffset.y, 1.0f,
 -                                offset.x - backgroundOffset.x - 5, offset.y + backgroundOffset.y, 1.0f};
 +                                offset.x + backgroundOffset.x + 5, offset.y - backgroundOffset.y, 10.0f,
 +                                offset.x - backgroundOffset.x - 5, offset.y - backgroundOffset.y, 10.0f,
 +                                offset.x - backgroundOffset.x - 5, offset.y + backgroundOffset.y, 10.0f};
  
      glUseProgram(worldShader);
  
      std::vector<vec3> bg_items;
  
        bgTex++;
-       //safeSetColorA(150 + shadeBackground * 2, 150 + shadeBackground * 2, 150 + shadeBackground * 2, 255);
      auto xcoord = width / 2 * -1 + offset.x * 0.85f;
        for (unsigned int i = 0; i <= worldData.size() * HLINE / 1920; i++) {
 -        bg_items.push_back(vec3(1920 * i       + xcoord, GROUND_HEIGHT_MINIMUM, 1.0f));
 -        bg_items.push_back(vec3(1920 * (i + 1) + xcoord, GROUND_HEIGHT_MINIMUM, 1.0f));
 -        bg_items.push_back(vec3(1920 * (i + 1) + xcoord, GROUND_HEIGHT_MINIMUM + 1080, 1.0f));
 +        bg_items.push_back(vec3(1920 * i       + xcoord, GROUND_HEIGHT_MINIMUM, 8.0f));
 +        bg_items.push_back(vec3(1920 * (i + 1) + xcoord, GROUND_HEIGHT_MINIMUM, 8.0f));
 +        bg_items.push_back(vec3(1920 * (i + 1) + xcoord, GROUND_HEIGHT_MINIMUM + 1080, 8.0f));
  
 -        bg_items.push_back(vec3(1920 * (i + 1) + xcoord, GROUND_HEIGHT_MINIMUM + 1080, 1.0f));
 -        bg_items.push_back(vec3(1920 * i       + xcoord, GROUND_HEIGHT_MINIMUM + 1080, 1.0f));
 -        bg_items.push_back(vec3(1920 * i       + xcoord, GROUND_HEIGHT_MINIMUM, 1.0f));
 +        bg_items.push_back(vec3(1920 * (i + 1) + xcoord, GROUND_HEIGHT_MINIMUM + 1080, 8.0f));
 +        bg_items.push_back(vec3(1920 * i       + xcoord, GROUND_HEIGHT_MINIMUM + 1080, 8.0f));
 +        bg_items.push_back(vec3(1920 * i       + xcoord, GROUND_HEIGHT_MINIMUM, 8.0f));
        }
  
      std::vector<GLfloat> bg_i;
        for (unsigned int i = 0; i < 4; i++) {
          std::vector<vec3>c;
                bgTex++;
-               /*safeSetColorA(bgDraw[i][0] + shadeBackground * 2,
-                       bgDraw[i][0] + shadeBackground * 2,
-                       bgDraw[i][0] + shadeBackground * 2,
-                       bgDraw[i][1]
-                   );*/
          auto xcoord = offset.x * bgDraw[i][2];
                for (int j = worldStart; j <= -worldStart; j += 600) {
 -            c.push_back(vec3(j       + xcoord, GROUND_HEIGHT_MINIMUM, 1));
 -            c.push_back(vec3(j + 600 + xcoord, GROUND_HEIGHT_MINIMUM, 1));
 -            c.push_back(vec3(j + 600 + xcoord, GROUND_HEIGHT_MINIMUM + 400, 1));
 +            c.push_back(vec3(j       + xcoord, GROUND_HEIGHT_MINIMUM, 7-(i*.1)));
 +            c.push_back(vec3(j + 600 + xcoord, GROUND_HEIGHT_MINIMUM, 7-(i*.1)));
 +            c.push_back(vec3(j + 600 + xcoord, GROUND_HEIGHT_MINIMUM + 400, 7-(i*.1)));
  
 -            c.push_back(vec3(j + 600 + xcoord, GROUND_HEIGHT_MINIMUM + 400, 1));
 -            c.push_back(vec3(j       + xcoord, GROUND_HEIGHT_MINIMUM + 400, 1));
 -            c.push_back(vec3(j       + xcoord, GROUND_HEIGHT_MINIMUM, 1));
 +            c.push_back(vec3(j + 600 + xcoord, GROUND_HEIGHT_MINIMUM + 400, 7-(i*.1)));
 +            c.push_back(vec3(j       + xcoord, GROUND_HEIGHT_MINIMUM + 400, 7-(i*.1)));
 +            c.push_back(vec3(j       + xcoord, GROUND_HEIGHT_MINIMUM, 7-(i*.1)));
                }
  
          bg_i.clear();