]> code.bitgloo.com Git - clyne/gamedev.git/commitdiff
redid trees, fixed indoors?
authorClyne Sullivan <tullivan99@gmail.com>
Tue, 28 Jun 2016 01:06:31 +0000 (21:06 -0400)
committerClyne Sullivan <tullivan99@gmail.com>
Tue, 28 Jun 2016 01:06:31 +0000 (21:06 -0400)
21 files changed:
Changelog
assets/style/classic/bg/forestTileBack.png
assets/style/classic/bg/forestTileFar.png
assets/style/classic/bg/forestTileFront.png
assets/style/classic/bg/forestTileMid.png
include/entities.hpp
include/texture.hpp
include/world.hpp
src/entities.cpp
src/texture.cpp
src/world.cpp
xcf/goodForestTileBack.xcf [new file with mode: 0644]
xcf/goodForestTileFar.xcf [new file with mode: 0644]
xcf/goodForestTileFront.xcf [new file with mode: 0644]
xcf/goodForestTileMid.xcf [new file with mode: 0644]
xcf/goodtree1.xcf
xcf/goodtree2.xcf [new file with mode: 0644]
xcf/goodtree3.xcf [new file with mode: 0644]
xml/playerSpawnHill1.xml
xml/playerSpawnHill1_Building1.xml
xml/town.xml

index d0c136a3953d6331e63e8db6b91b329274649ab8..ee05b8539ed8dcfacc054e65c29cba2258e80b52 100644 (file)
--- a/Changelog
+++ b/Changelog
        - item rendering stuff
                "I'm also trying to make it so that other entities can use items.. if that makes sense."
                        - Andy
+
+Late June (6/16/2016 - 6/27/2016)
+=================================
+
+       - urging need of decent graphics
+               - waiting for player sprites
+               - redid forest trees, mountains, houses
+       - fixed major issue with entering structures
+       - exploring more ideas for soundtracks
index f43346ce9eb24206c8646ce63bc026020668433a..c3a7dafdfae997929078b147b9d05415cbad774f 100644 (file)
Binary files a/assets/style/classic/bg/forestTileBack.png and b/assets/style/classic/bg/forestTileBack.png differ
index b7cb14052a6175a5e2ea13d86093611bdf9c86e4..13021305015f31dc4364c4beb389be1271cd3f20 100644 (file)
Binary files a/assets/style/classic/bg/forestTileFar.png and b/assets/style/classic/bg/forestTileFar.png differ
index 1f5abb2746f3f62ae1a1ab943e9fd688ff99388b..5b2d250342a5f9c5671d22b965a40e91b5a844c2 100644 (file)
Binary files a/assets/style/classic/bg/forestTileFront.png and b/assets/style/classic/bg/forestTileFront.png differ
index 6c4c5972e8d04b4b5f1b373e3dccd4c188ec0df4..152af65c7b805f24ebcc2a9c4596e0b05444ada9 100644 (file)
Binary files a/assets/style/classic/bg/forestTileMid.png and b/assets/style/classic/bg/forestTileMid.png differ
index 2523364689012a9ff92ff28f268c09b27b5e4c4c..76b6fa810cb35e715378a21b26fc646886fb227e 100644 (file)
@@ -325,7 +325,7 @@ public:
 class Structures : public Entity {
 public:
        BUILD_SUB bsubtype;
-       World *inWorld;
+       World *inWorld, *insideWorld;
        std::string inside;
        std::string textureLoc;
 
index 0ee3e2c210f9163ae3049f1b9d6850e1bcd7263d..c301af1a46041350df07eb82151144b61c80d085 100644 (file)
@@ -47,9 +47,9 @@ public:
                position = std::begin(textures);
        }
        TextureIterator(const std::vector<std::string> &l) {
-               for (const auto &s : l) {
+               for (const auto &s : l)
                        textures.emplace_back(Texture::loadTexture(s), s);
-               }
+
                position = std::begin(textures);
        }
        void operator++(int) noexcept {
index 34a597d303f4d897520695166ab363e6ada5f857..6a97daa85da7d8246b03e6cde88a133059532fe6 100644 (file)
@@ -566,6 +566,7 @@ World *loadWorldFromXML(std::string path);
  * previous world if one was loaded.
  */
 World *loadWorldFromXMLNoSave(std::string path);
+World *loadWorldFromXMLNoTakeover(std::string path);
 
 /**
  * Loads a world using a pointer to the current world (used for loading adjacent
index 60f49ee06456822695d10ed1f19acb9842e42dd0..e156ee2d122c05e45a5f6ad6fb00bc37f01812ec 100644 (file)
@@ -320,6 +320,8 @@ Structures::~Structures()
 {
 }
 
+extern std::string currentXMLRaw;
+
 void Structures::createFromXML(XMLElement *e, World *w)
 {
        float spawnx;
@@ -331,6 +333,12 @@ void Structures::createFromXML(XMLElement *e, World *w)
 
        inWorld = w;
        inside = e->StrAttribute("inside");
+
+       // edge
+       if (!inside.empty()) {
+               insideWorld = loadWorldFromXMLNoTakeover(inside);
+       }
+
        textureLoc = e->StrAttribute("texture");
 
        spawn(static_cast<BUILD_SUB>(e->UnsignedAttribute("type")),
index 0f01c83c46e1abbb3644dbb55e2d115ae9718615..bdac28e07d09f3cc91142a71d03a5d0e7db73481 100644 (file)
@@ -46,7 +46,7 @@ namespace Texture{
 
        GLuint loadTexture(std::string fileName) {
                SDL_Surface *image;
-               GLuint object = 0;
+               static GLuint object = 0;
 
                // check if texture is already loaded
                for(auto &t : LoadedTexture) {
@@ -71,9 +71,8 @@ namespace Texture{
                /*
                 * Load texture through OpenGL.
                 */
-
-               glGenTextures(1,&object);                               // Turns "object" into a texture
-               glBindTexture(GL_TEXTURE_2D,object);    // Binds "object" to the top of the stack
+               //glGenTextures(1,&object);                             // Turns "object" into a texture
+               glBindTexture(GL_TEXTURE_2D,++object);  // Binds "object" to the top of the stack
                glPixelStoref(GL_UNPACK_ALIGNMENT,1);
 
                glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);      // Sets the "min" filter
index 08c788bf880096b2fc4e231073c692a042e72c83..8969fb9bbd6a1c1e8c6c413641a23724a31fa705 100644 (file)
@@ -125,7 +125,7 @@ static const float bgDraw[4][3]={
        { 255, 255, 0.1  }
 };
 
-static std::string currentXMLRaw;
+std::string currentXMLRaw;
 XMLDocument currentXMLDoc;
 
 /* ----------------------------------------------------------------------------
@@ -654,35 +654,22 @@ void World::draw(Player *p)
 
                // actually draw the grass.
         if (wd.groundHeight) {
-               //glBegin(GL_QUADS);
-                       /*glTexCoord2i(0, 0); glVertex2i(worldStart + i * HLINE            , wd.groundHeight + gh[0]);
-                       glTexCoord2i(1, 0); glVertex2i(worldStart + i * HLINE + HLINE / 2, wd.groundHeight + gh[0]);
-                       glTexCoord2i(1, 1); glVertex2i(worldStart + i * HLINE + HLINE / 2, wd.groundHeight - GRASS_HEIGHT);
-                       glTexCoord2i(0, 1); glVertex2i(worldStart + i * HLINE                , wd.groundHeight - GRASS_HEIGHT);
+            c.push_back(std::make_pair(vec2(0, 0),vec3(worldStart + HLINES(i)            , wd.groundHeight + gh[0],            -3)));
+            c.push_back(std::make_pair(vec2(1, 0),vec3(worldStart + HLINES(i) + HLINE / 2, wd.groundHeight + gh[0],            -3)));
+            c.push_back(std::make_pair(vec2(1, 1),vec3(worldStart + HLINES(i) + HLINE / 2, wd.groundHeight - GRASS_HEIGHT,     -3)));
 
-                glTexCoord2i(0, 0); glVertex2i(worldStart + i * HLINE + HLINE / 2, wd.groundHeight + gh[1]);
-                       glTexCoord2i(1, 0); glVertex2i(worldStart + i * HLINE + HLINE    , wd.groundHeight + gh[1]);
-                       glTexCoord2i(1, 1); glVertex2i(worldStart + i * HLINE + HLINE    , wd.groundHeight - GRASS_HEIGHT);
-                       glTexCoord2i(0, 1); glVertex2i(worldStart + i * HLINE + HLINE / 2, wd.groundHeight - GRASS_HEIGHT);*/
+            c.push_back(std::make_pair(vec2(1, 1),vec3(worldStart + HLINES(i) + HLINE / 2, wd.groundHeight - GRASS_HEIGHT,     -3)));
+            c.push_back(std::make_pair(vec2(0, 1),vec3(worldStart + HLINES(i)               , wd.groundHeight - GRASS_HEIGHT,  -3)));
+            c.push_back(std::make_pair(vec2(0, 0),vec3(worldStart + HLINES(i)            , wd.groundHeight + gh[0],                    -3)));
 
-                c.push_back(std::make_pair(vec2(0, 0),vec3(worldStart + HLINES(i)            , wd.groundHeight + gh[0],                -3)));
-                c.push_back(std::make_pair(vec2(1, 0),vec3(worldStart + HLINES(i) + HLINE / 2, wd.groundHeight + gh[0],                -3)));
-                c.push_back(std::make_pair(vec2(1, 1),vec3(worldStart + HLINES(i) + HLINE / 2, wd.groundHeight - GRASS_HEIGHT,         -3)));
 
-                c.push_back(std::make_pair(vec2(1, 1),vec3(worldStart + HLINES(i) + HLINE / 2, wd.groundHeight - GRASS_HEIGHT, -3)));
-                c.push_back(std::make_pair(vec2(0, 1),vec3(worldStart + HLINES(i)                   , wd.groundHeight - GRASS_HEIGHT,  -3)));
-                c.push_back(std::make_pair(vec2(0, 0),vec3(worldStart + HLINES(i)            , wd.groundHeight + gh[0],                        -3)));
+            c.push_back(std::make_pair(vec2(0, 0),vec3(worldStart + HLINES(i) + HLINE / 2, wd.groundHeight + gh[1],                    -3)));
+            c.push_back(std::make_pair(vec2(1, 0),vec3(worldStart + HLINES(i) + HLINE    , wd.groundHeight + gh[1],                    -3)));
+            c.push_back(std::make_pair(vec2(1, 1),vec3(worldStart + HLINES(i) + HLINE    , wd.groundHeight - GRASS_HEIGHT,     -3)));
 
-
-                c.push_back(std::make_pair(vec2(0, 0),vec3(worldStart + HLINES(i) + HLINE / 2, wd.groundHeight + gh[1],                        -3)));
-                c.push_back(std::make_pair(vec2(1, 0),vec3(worldStart + HLINES(i) + HLINE    , wd.groundHeight + gh[1],                        -3)));
-                c.push_back(std::make_pair(vec2(1, 1),vec3(worldStart + HLINES(i) + HLINE    , wd.groundHeight - GRASS_HEIGHT, -3)));
-
-                c.push_back(std::make_pair(vec2(1, 1),vec3(worldStart + HLINES(i) + HLINE    , wd.groundHeight - GRASS_HEIGHT, -3)));
-                c.push_back(std::make_pair(vec2(0, 1),vec3(worldStart + HLINES(i) + HLINE / 2, wd.groundHeight - GRASS_HEIGHT, -3)));
-                c.push_back(std::make_pair(vec2(0, 0),vec3(worldStart + HLINES(i) + HLINE / 2, wd.groundHeight + gh[1],                        -3)));
-
-            //glEnd();
+            c.push_back(std::make_pair(vec2(1, 1),vec3(worldStart + HLINES(i) + HLINE    , wd.groundHeight - GRASS_HEIGHT,     -3)));
+            c.push_back(std::make_pair(vec2(0, 1),vec3(worldStart + HLINES(i) + HLINE / 2, wd.groundHeight - GRASS_HEIGHT,     -3)));
+            c.push_back(std::make_pair(vec2(0, 0),vec3(worldStart + HLINES(i) + HLINE / 2, wd.groundHeight + gh[1],                    -3)));
         }
        }
 
@@ -1802,11 +1789,20 @@ World *loadWorldFromPtr(World *ptr)
  * Loads a world from the given XML file.
  */
 
+World *
+loadWorldFromXMLNoTakeover(std::string path)
+{
+       loadedLeft = true, loadedRight = true;
+       auto ret = loadWorldFromXMLNoSave(path);
+       loadedLeft = false, loadedRight = false;
+       return ret;
+}
+
 World *
 loadWorldFromXMLNoSave(std::string path) {
        XMLDocument *_currentXMLDoc;
-       std::string _currentXML,
-                   _currentXMLRaw;
+       static std::string _currentXML,
+                          _currentXMLRaw;
 
        XMLElement *wxml;
        XMLElement *vil;
@@ -2000,7 +1996,12 @@ loadWorldFromXMLNoSave(std::string path) {
                                        break;
                                }
 
+                               std::swap(currentXML, _currentXML);
+                               std::swap(currentXMLRaw, _currentXMLRaw);
                                newEntity->createFromXML(wxml, tmp);
+                               std::swap(currentXML, _currentXML);
+                               std::swap(currentXMLRaw, _currentXMLRaw);
+                               std::cout << currentXML << '\n';
                        //}
                }
 
diff --git a/xcf/goodForestTileBack.xcf b/xcf/goodForestTileBack.xcf
new file mode 100644 (file)
index 0000000..fed5120
Binary files /dev/null and b/xcf/goodForestTileBack.xcf differ
diff --git a/xcf/goodForestTileFar.xcf b/xcf/goodForestTileFar.xcf
new file mode 100644 (file)
index 0000000..9caa87b
Binary files /dev/null and b/xcf/goodForestTileFar.xcf differ
diff --git a/xcf/goodForestTileFront.xcf b/xcf/goodForestTileFront.xcf
new file mode 100644 (file)
index 0000000..b165062
Binary files /dev/null and b/xcf/goodForestTileFront.xcf differ
diff --git a/xcf/goodForestTileMid.xcf b/xcf/goodForestTileMid.xcf
new file mode 100644 (file)
index 0000000..9c1241b
Binary files /dev/null and b/xcf/goodForestTileMid.xcf differ
index 861cbf034bcdf9ec0dd7c7563f7ba9c4fac08d7d..2fe27bf0a9e251d69fd88c1986ca6cc275815c10 100644 (file)
Binary files a/xcf/goodtree1.xcf and b/xcf/goodtree1.xcf differ
diff --git a/xcf/goodtree2.xcf b/xcf/goodtree2.xcf
new file mode 100644 (file)
index 0000000..a959ccd
Binary files /dev/null and b/xcf/goodtree2.xcf differ
diff --git a/xcf/goodtree3.xcf b/xcf/goodtree3.xcf
new file mode 100644 (file)
index 0000000..c19d653
Binary files /dev/null and b/xcf/goodtree3.xcf differ
index 3f0e2ce31c22c4937493e0728f6d2b1ae29591d4..0566efb91904c1f7b99838a3ea94f9b45475f112 100644 (file)
 <Dialog name="Guy">
     <text id="0" nextid="1">
                Hello there! My name is Ralph.
-                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               <gotox>300</gotox>
+                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       <gotox>300</gotox>
     </text>
     <text id="1">
                ...
-                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               <gotox>1000</gotox>
+                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       <gotox>1000</gotox>
         <set id="Slow" value="0"/>
         <set id="canSprint" value="1"/>
     </text>
@@ -33,5 +33,5 @@
     <text id="0" stop="true">
                Hey friend! It's dangerous out there, here take these!
                Wait, promise you'll stop by my stand in the local market!
-                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               <give id="Wood Sword" count="1"/>        <give id="Hunters Bow" count="1"/>        <give id="Crude Arrow" count="110"/>        <give id="Fried Chicken" count="1"/>        <give id="Mossy Torch" count="1"/></text>
+                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       <give id="Wood Sword" count="1"/>        <give id="Hunters Bow" count="1"/>        <give id="Crude Arrow" count="110"/>        <give id="Fried Chicken" count="1"/>        <give id="Mossy Torch" count="1"/></text>
 </Dialog>
index 61b8e163c8324a86a4daa887bf94289446f46f9f..78dbb54a85b7321d5152949f5ed2ffb8d94967ec 100644 (file)
 <Dialog name="Bob">
     <text id="0" nextid="1" pause="true">
        Hey. Have a Dank MayMay :)
-                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       <give id="Dank MayMay" count="1"/></text>
+                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       <give id="Dank MayMay" count="1"/></text>
     <text id="1" nextid="2">
        What? You want another Dank MayMay?
     </text>
     <text id="2" nextid="3" pause="true">
                K.
-                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   <give id="Dank MayMay" count="1"/></text>
+                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   <give id="Dank MayMay" count="1"/></text>
     <text id="3" nextid="4">
                Well... I'm out of Dank MayMays.
        </text>
     <text id="4">
                Have a sword though.
-                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               <give id="Wood Sword" count="1"/></text>
+                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               <give id="Wood Sword" count="1"/></text>
 </Dialog>
index fc5fcd558517d11262f3468745e28156e319706b..f6750373cc0cabae4ad9f216c92007e61bd273ca 100644 (file)
@@ -4,23 +4,23 @@
     <generation type="Random" width="1600"/>
     <time>6000</time>
     <spawnx>-300</spawnx>
-    <npc name="Sanc" hasDialog="true" health="1" x="-215.47046" y="59.999001" dindex="0"/>
-    <npc name="Bob" hasDialog="true" spawnx="30" health="1" x="44.280304" y="60.998985" dindex="0"/>
+    <npc name="Sanc" hasDialog="true" health="1" x="21.680096" y="63.399021" dindex="0"/>
+    <npc name="Bob" hasDialog="true" spawnx="30" health="1" x="30" y="62.99902" dindex="0"/>
     <structure type="1" spawnx="300" alive="1"/>
     <structure inside="bobshouse.xml" type="1" spawnx="10" alive="1"/>
 </World>
 
 <Dialog name="Bob">
     <text id="0" nextid="1" pause="true">
-        <content>
+        <content alive="1">
                        Hey there! The name's Bob. Good to see you've finally woken up from your nap by the cliff there... lol
                </content>
     </text>
-    <text id="1" pause="true">
-        <quest assign="Check out m&apos;swag, man!">
+    <text id="1" pause="true" alive="1">
+        <quest assign="Check out m&apos;swag, man!" health="1" x="-0.20029223" y="62.099083" dindex="0">
                        No description
                </quest>
-        <content>
+        <content health="1" x="176.35571" y="61.999001" dindex="0">
                        Looks like you've got yourself pretty empty handed... you know, I have a simple solution for that. Come on inside, I have somethin' to show you.
                </content>
     </text>