aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authordrumsetmonkey <abelleisle@roadrunner.com>2016-04-06 07:38:59 -0400
committerdrumsetmonkey <abelleisle@roadrunner.com>2016-04-06 07:38:59 -0400
commit3ca4cca09ed9a2b1028928dea98f19bd26ab3b2c (patch)
treef8444f987be86181786859c2aabdd2d7eb2a5539
parentb2ea70a36ba2249383c9b5cb3c2c784c28311938 (diff)
First world and style
-rw-r--r--assets/style/farming/bg/bagels.jpgbin0 -> 259847 bytes
-rw-r--r--assets/style/farming/bg/bagels.pngbin0 -> 1252347 bytes
-rw-r--r--assets/style/farming/bg/bg.pngbin0 -> 1072758 bytes
-rw-r--r--assets/style/farming/bg/bgFarMountain.pngbin0 -> 20172 bytes
-rw-r--r--assets/style/farming/bg/bgWoodTile.pngbin0 -> 205428 bytes
-rw-r--r--assets/style/farming/bg/bgb.pngbin0 -> 2899454 bytes
-rw-r--r--assets/style/farming/bg/bgfarMountains.pngbin0 -> 30875 bytes
-rw-r--r--assets/style/farming/bg/bgn.pngbin0 -> 1438185 bytes
-rw-r--r--assets/style/farming/bg/dirt.pngbin0 -> 228 bytes
-rw-r--r--assets/style/farming/bg/forestTileBack.pngbin0 -> 9657 bytes
-rw-r--r--assets/style/farming/bg/forestTileFar.pngbin0 -> 14112 bytes
-rw-r--r--assets/style/farming/bg/forestTileFront.pngbin0 -> 26722 bytes
-rw-r--r--assets/style/farming/bg/forestTileMid.pngbin0 -> 45450 bytes
-rw-r--r--assets/style/farming/bg/grass.pngbin0 -> 128 bytes
-rw-r--r--assets/style/farming/bg/moon.pngbin0 -> 2868 bytes
-rw-r--r--assets/style/farming/farmHouse.pngbin0 -> 2194 bytes
-rw-r--r--frig.frag2
-rw-r--r--include/entities.hpp10
-rw-r--r--main.cpp5
-rw-r--r--src/world.cpp50
-rw-r--r--storyXML/0000_SpawnHill.xml6
-rw-r--r--storyXML/0000_SpawnHill.xml.dat2
-rw-r--r--xml/playerSpawnHill1_Building1.xml1
23 files changed, 54 insertions, 22 deletions
diff --git a/assets/style/farming/bg/bagels.jpg b/assets/style/farming/bg/bagels.jpg
new file mode 100644
index 0000000..fb68d2e
--- /dev/null
+++ b/assets/style/farming/bg/bagels.jpg
Binary files differ
diff --git a/assets/style/farming/bg/bagels.png b/assets/style/farming/bg/bagels.png
new file mode 100644
index 0000000..2ee843b
--- /dev/null
+++ b/assets/style/farming/bg/bagels.png
Binary files differ
diff --git a/assets/style/farming/bg/bg.png b/assets/style/farming/bg/bg.png
new file mode 100644
index 0000000..2dbc3f9
--- /dev/null
+++ b/assets/style/farming/bg/bg.png
Binary files differ
diff --git a/assets/style/farming/bg/bgFarMountain.png b/assets/style/farming/bg/bgFarMountain.png
new file mode 100644
index 0000000..eb703bb
--- /dev/null
+++ b/assets/style/farming/bg/bgFarMountain.png
Binary files differ
diff --git a/assets/style/farming/bg/bgWoodTile.png b/assets/style/farming/bg/bgWoodTile.png
new file mode 100644
index 0000000..95b0667
--- /dev/null
+++ b/assets/style/farming/bg/bgWoodTile.png
Binary files differ
diff --git a/assets/style/farming/bg/bgb.png b/assets/style/farming/bg/bgb.png
new file mode 100644
index 0000000..278e9b0
--- /dev/null
+++ b/assets/style/farming/bg/bgb.png
Binary files differ
diff --git a/assets/style/farming/bg/bgfarMountains.png b/assets/style/farming/bg/bgfarMountains.png
new file mode 100644
index 0000000..fa6b349
--- /dev/null
+++ b/assets/style/farming/bg/bgfarMountains.png
Binary files differ
diff --git a/assets/style/farming/bg/bgn.png b/assets/style/farming/bg/bgn.png
new file mode 100644
index 0000000..2aa3995
--- /dev/null
+++ b/assets/style/farming/bg/bgn.png
Binary files differ
diff --git a/assets/style/farming/bg/dirt.png b/assets/style/farming/bg/dirt.png
new file mode 100644
index 0000000..11252ac
--- /dev/null
+++ b/assets/style/farming/bg/dirt.png
Binary files differ
diff --git a/assets/style/farming/bg/forestTileBack.png b/assets/style/farming/bg/forestTileBack.png
new file mode 100644
index 0000000..0ea6022
--- /dev/null
+++ b/assets/style/farming/bg/forestTileBack.png
Binary files differ
diff --git a/assets/style/farming/bg/forestTileFar.png b/assets/style/farming/bg/forestTileFar.png
new file mode 100644
index 0000000..241e479
--- /dev/null
+++ b/assets/style/farming/bg/forestTileFar.png
Binary files differ
diff --git a/assets/style/farming/bg/forestTileFront.png b/assets/style/farming/bg/forestTileFront.png
new file mode 100644
index 0000000..e54f631
--- /dev/null
+++ b/assets/style/farming/bg/forestTileFront.png
Binary files differ
diff --git a/assets/style/farming/bg/forestTileMid.png b/assets/style/farming/bg/forestTileMid.png
new file mode 100644
index 0000000..b23afd2
--- /dev/null
+++ b/assets/style/farming/bg/forestTileMid.png
Binary files differ
diff --git a/assets/style/farming/bg/grass.png b/assets/style/farming/bg/grass.png
new file mode 100644
index 0000000..e05fb9b
--- /dev/null
+++ b/assets/style/farming/bg/grass.png
Binary files differ
diff --git a/assets/style/farming/bg/moon.png b/assets/style/farming/bg/moon.png
new file mode 100644
index 0000000..d9a5ab7
--- /dev/null
+++ b/assets/style/farming/bg/moon.png
Binary files differ
diff --git a/assets/style/farming/farmHouse.png b/assets/style/farming/farmHouse.png
new file mode 100644
index 0000000..a07d787
--- /dev/null
+++ b/assets/style/farming/farmHouse.png
Binary files differ
diff --git a/frig.frag b/frig.frag
index f750f2d..6beb7b3 100644
--- a/frig.frag
+++ b/frig.frag
@@ -1,4 +1,4 @@
-#version 120
+#version 130
uniform sampler2D sampler;
uniform int numLight;
diff --git a/include/entities.hpp b/include/entities.hpp
index e7864d0..f53f8e6 100644
--- a/include/entities.hpp
+++ b/include/entities.hpp
@@ -102,11 +102,7 @@ public:
}
void draw(){
- glActiveTexture(GL_TEXTURE0);
- glBindTexture(GL_TEXTURE_2D, colorIndex);
- glUseProgram(shaderProgram);
- glUniform1i(glGetUniformLocation(shaderProgram, "sampler"), 0);
- glEnable(GL_TEXTURE_2D);
+ //glEnable(GL_TEXTURE_2D);
glColor3ub(255,255,255);
glBegin(GL_QUADS);
glTexCoord2f(.25*index.x, .125*index.y); glVertex2i(loc.x, loc.y);
@@ -114,8 +110,8 @@ public:
glTexCoord2f(.25*index.x, .125*index.y); glVertex2i(loc.x + width, loc.y + height);
glTexCoord2f(.25*index.x, .125*index.y); glVertex2i(loc.x, loc.y + width);
glEnd();
- glDisable(GL_TEXTURE_2D);
- glUseProgram(0);
+ //glDisable(GL_TEXTURE_2D);
+ //glUseProgram(0);
}
bool kill(float delta){
duration -= delta;
diff --git a/main.cpp b/main.cpp
index 95d4e05..3b500f4 100644
--- a/main.cpp
+++ b/main.cpp
@@ -221,6 +221,9 @@ int main(int argc, char *argv[]){
return -1;
}
+ SDL_GL_SetAttribute(SDL_GL_CONTEXT_MAJOR_VERSION, 2);
+ SDL_GL_SetAttribute(SDL_GL_CONTEXT_MINOR_VERSION, 1);
+
// Run SDL_Quit when main returns
atexit(SDL_Quit);
@@ -338,6 +341,8 @@ int main(int argc, char *argv[]){
SDL_ShowCursor(SDL_DISABLE);
+ //glEnable(GL_CULL_FACE);
+
Texture::initColorIndex();
initEntity();
diff --git a/src/world.cpp b/src/world.cpp
index bcd4f7a..625a33b 100644
--- a/src/world.cpp
+++ b/src/world.cpp
@@ -434,20 +434,20 @@ void World::draw(Player *p){
safeSetColorA( 255, 255, 255, weather == WorldWeather::Snowy ? 150 : 255 - worldShade * 4);
glBegin( GL_QUADS );
- glTexCoord2i( 0, 0 ); glVertex2i( offset.x - SCREEN_WIDTH/2-5, SCREEN_HEIGHT );
- glTexCoord2i( 1, 0 ); glVertex2i( offset.x + SCREEN_WIDTH/2+5, SCREEN_HEIGHT );
- glTexCoord2i( 1, 1 ); glVertex2i( offset.x + SCREEN_WIDTH/2+5, 0 );
- glTexCoord2i( 0, 1 ); glVertex2i( offset.x - SCREEN_WIDTH/2-5, 0 );
+ glTexCoord2i( 0, 0 ); glVertex2i( offset.x - SCREEN_WIDTH/2-5, offset.y + SCREEN_HEIGHT/2 );
+ glTexCoord2i( 1, 0 ); glVertex2i( offset.x + SCREEN_WIDTH/2+5, offset.y + SCREEN_HEIGHT/2 );
+ glTexCoord2i( 1, 1 ); glVertex2i( offset.x + SCREEN_WIDTH/2+5, offset.y - SCREEN_HEIGHT/2 );
+ glTexCoord2i( 0, 1 ); glVertex2i( offset.x - SCREEN_WIDTH/2-5, offset.y - SCREEN_HEIGHT/2 );
glEnd();
bgTex->bindNext();
safeSetColorA( 255, 255, 255, worldShade * 4);
glBegin( GL_QUADS );
- glTexCoord2i( 0, 0 ); glVertex2i( worldStart, SCREEN_HEIGHT );
- glTexCoord2i( 1, 0 ); glVertex2i( -worldStart, SCREEN_HEIGHT );
- glTexCoord2i( 1, 1 ); glVertex2i( -worldStart, 0 );
- glTexCoord2i( 0, 1 ); glVertex2i( worldStart, 0 );
+ glTexCoord2i( 0, 0 ); glVertex2i( offset.x - SCREEN_WIDTH/2-5, offset.y + SCREEN_HEIGHT/2 );
+ glTexCoord2i( 1, 0 ); glVertex2i( offset.x + SCREEN_WIDTH/2+5, offset.y + SCREEN_HEIGHT/2 );
+ glTexCoord2i( 1, 1 ); glVertex2i( offset.x + SCREEN_WIDTH/2+5, offset.y - SCREEN_HEIGHT/2 );
+ glTexCoord2i( 0, 1 ); glVertex2i( offset.x - SCREEN_WIDTH/2-5, offset.y - SCREEN_HEIGHT/2 );
glEnd();
glDisable( GL_TEXTURE_2D );
@@ -524,7 +524,15 @@ void World::draw(Player *p){
// draw particles and buildings
- std::for_each( particles.begin(), particles.end(), [](Particles part) { if ( part.behind ) part.draw(); });
+ glActiveTexture(GL_TEXTURE0);
+ glBindTexture(GL_TEXTURE_2D, colorIndex);
+
+ glUniform1i(glGetUniformLocation(shaderProgram, "sampler"), 0);
+ glUseProgram(shaderProgram);
+
+ std::for_each( particles.begin(), particles.end(), [](Particles part) { if ( part.behind ) part.draw(); });
+
+ glUseProgram(0);
for ( auto &b : build )
b->draw();
@@ -671,8 +679,17 @@ void World::draw(Player *p){
* Draw remaining entities.
*/
+
+ glActiveTexture(GL_TEXTURE0);
+ glBindTexture(GL_TEXTURE_2D, colorIndex);
+
+ glUniform1i(glGetUniformLocation(shaderProgram, "sampler"), 0);
+ glUseProgram(shaderProgram);
+
std::for_each( particles.begin(), particles.end(), [](Particles part) { if ( !part.behind ) part.draw(); });
+ glUseProgram(0);
+
for ( auto &n : npc )
n->draw();
@@ -1383,9 +1400,18 @@ draw( Player *p )
/*
* Draw all entities.
*/
+ glActiveTexture(GL_TEXTURE0);
+ glBindTexture(GL_TEXTURE_2D, colorIndex);
- for ( auto &part : particles )
- part.draw();
+ glUniform1i(glGetUniformLocation(shaderProgram, "sampler"), 0);
+ glUseProgram(shaderProgram);
+
+ std::for_each( particles.begin(), particles.end(), [](Particles &part) { part.draw(); });
+
+ glUseProgram(0);
+
+ /*for ( auto &part : particles )
+ part.draw();*/
for ( auto &e : entity )
e->draw();
@@ -1542,7 +1568,7 @@ loadWorldFromXMLNoSave( std::string path ) {
loadedRight = false;
}
} else
- abort();
+ abort();
} else if ( name == "style" ) {
tmp->setStyle(wxml->StrAttribute("folder"));
tmp->setBackground((WorldBGType)wxml->UnsignedAttribute("background"));
diff --git a/storyXML/0000_SpawnHill.xml b/storyXML/0000_SpawnHill.xml
index 0a41197..7edd3b8 100644
--- a/storyXML/0000_SpawnHill.xml
+++ b/storyXML/0000_SpawnHill.xml
@@ -1,10 +1,12 @@
<?xml version="1.0"?>
<World>
- <style background="0" bgm="assets/music/embark.wav" folder="assets/style/classic/" />
+ <style background="0" bgm="assets/music/embark.wav" folder="assets/style/farming/" />
<generation type="Random" width="500" />
<time>12000</time>
- <hill peakx="0" peaky="1000" width="50" />
+ <hill peakx="0" peaky="1000" width="75" />
+
+ <structure type="0" x="-300" texture="assets/style/farming/farmHouse.png"/>
</World>
diff --git a/storyXML/0000_SpawnHill.xml.dat b/storyXML/0000_SpawnHill.xml.dat
index 45a3a9f..6d4f7b2 100644
--- a/storyXML/0000_SpawnHill.xml.dat
+++ b/storyXML/0000_SpawnHill.xml.dat
@@ -1 +1,3 @@
+-300
+60
dOnE \ No newline at end of file
diff --git a/xml/playerSpawnHill1_Building1.xml b/xml/playerSpawnHill1_Building1.xml
index 8478908..c4def6c 100644
--- a/xml/playerSpawnHill1_Building1.xml
+++ b/xml/playerSpawnHill1_Building1.xml
@@ -1,6 +1,7 @@
<?xml version="1.0"?>
<IndoorWorld>
<style background="1" bgm="assets/music/theme_jazz.wav" />
+ <link outside="playerSpawnHill1.xml"/>
<floor width="300">
<npc name="Bob" hasDialog="true" />