aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--.gitattributes7
-rw-r--r--assets/items/FOOD_CHICKEN_FRIED.pngbin228 -> 232 bytes
-rw-r--r--assets/items/SWORD_WOOD.pngbin217 -> 272 bytes
-rw-r--r--assets/items/arrow_crude.pngbin294 -> 222 bytes
-rw-r--r--assets/items/bow.pngbin327 -> 278 bytes
-rw-r--r--assets/items/bow1.pngbin345 -> 316 bytes
-rw-r--r--assets/items/bow2.pngbin381 -> 318 bytes
-rw-r--r--assets/items/bow3.pngbin368 -> 325 bytes
-rw-r--r--assets/player/playerk.pngbin421 -> 482 bytes
-rw-r--r--assets/player/playerk1.pngbin482 -> 496 bytes
-rw-r--r--assets/player/playerk2.pngbin478 -> 502 bytes
-rw-r--r--assets/player/playerk3.pngbin490 -> 487 bytes
-rw-r--r--assets/player/playerk4.pngbin478 -> 491 bytes
-rw-r--r--assets/player/playerk5.pngbin472 -> 483 bytes
-rw-r--r--assets/player/playerk6.pngbin475 -> 494 bytes
-rw-r--r--assets/player/playerk7.pngbin485 -> 491 bytes
-rw-r--r--assets/player/playerk8.pngbin489 -> 496 bytes
-rw-r--r--brice.dat4
-rw-r--r--shaders/world.frag2
-rw-r--r--src/entities.cpp9
-rw-r--r--src/inventory.cpp4
-rw-r--r--src/items.cpp29
-rw-r--r--src/world.cpp73
23 files changed, 117 insertions, 11 deletions
diff --git a/.gitattributes b/.gitattributes
index 7bb2418..d10ef48 100644
--- a/.gitattributes
+++ b/.gitattributes
@@ -1,6 +1,11 @@
include/tinyxml2.h linguist-vendored
src/tinyxml2.cpp linguist-vendored
-src/threadpool.cpp linguist-vendored
+
include/threadpool.h linguist-vendored
+src/threadpool.cpp linguist-vendored
+
include/SDL2/* linguist-vendored
+
include/freetype/* linguist-vendored
+
+include/glm/* linguist-vendored
diff --git a/assets/items/FOOD_CHICKEN_FRIED.png b/assets/items/FOOD_CHICKEN_FRIED.png
index d086400..5dd27e9 100644
--- a/assets/items/FOOD_CHICKEN_FRIED.png
+++ b/assets/items/FOOD_CHICKEN_FRIED.png
Binary files differ
diff --git a/assets/items/SWORD_WOOD.png b/assets/items/SWORD_WOOD.png
index 479eba9..90e8ee3 100644
--- a/assets/items/SWORD_WOOD.png
+++ b/assets/items/SWORD_WOOD.png
Binary files differ
diff --git a/assets/items/arrow_crude.png b/assets/items/arrow_crude.png
index 3d82074..5fba709 100644
--- a/assets/items/arrow_crude.png
+++ b/assets/items/arrow_crude.png
Binary files differ
diff --git a/assets/items/bow.png b/assets/items/bow.png
index 62be2dc..7affffb 100644
--- a/assets/items/bow.png
+++ b/assets/items/bow.png
Binary files differ
diff --git a/assets/items/bow1.png b/assets/items/bow1.png
index a37ca71..1f35626 100644
--- a/assets/items/bow1.png
+++ b/assets/items/bow1.png
Binary files differ
diff --git a/assets/items/bow2.png b/assets/items/bow2.png
index 29ba192..9bab2df 100644
--- a/assets/items/bow2.png
+++ b/assets/items/bow2.png
Binary files differ
diff --git a/assets/items/bow3.png b/assets/items/bow3.png
index 3c8ed6c..a5f550f 100644
--- a/assets/items/bow3.png
+++ b/assets/items/bow3.png
Binary files differ
diff --git a/assets/player/playerk.png b/assets/player/playerk.png
index ea0a7ab..570bc8e 100644
--- a/assets/player/playerk.png
+++ b/assets/player/playerk.png
Binary files differ
diff --git a/assets/player/playerk1.png b/assets/player/playerk1.png
index 1c4fb49..6e549cf 100644
--- a/assets/player/playerk1.png
+++ b/assets/player/playerk1.png
Binary files differ
diff --git a/assets/player/playerk2.png b/assets/player/playerk2.png
index 97f769b..f6966ee 100644
--- a/assets/player/playerk2.png
+++ b/assets/player/playerk2.png
Binary files differ
diff --git a/assets/player/playerk3.png b/assets/player/playerk3.png
index 19b97c4..44ca2b8 100644
--- a/assets/player/playerk3.png
+++ b/assets/player/playerk3.png
Binary files differ
diff --git a/assets/player/playerk4.png b/assets/player/playerk4.png
index c32a9b3..767a6fc 100644
--- a/assets/player/playerk4.png
+++ b/assets/player/playerk4.png
Binary files differ
diff --git a/assets/player/playerk5.png b/assets/player/playerk5.png
index fabfa60..8c91fa1 100644
--- a/assets/player/playerk5.png
+++ b/assets/player/playerk5.png
Binary files differ
diff --git a/assets/player/playerk6.png b/assets/player/playerk6.png
index 269fccb..e10d3cf 100644
--- a/assets/player/playerk6.png
+++ b/assets/player/playerk6.png
Binary files differ
diff --git a/assets/player/playerk7.png b/assets/player/playerk7.png
index aeac120..777af2b 100644
--- a/assets/player/playerk7.png
+++ b/assets/player/playerk7.png
Binary files differ
diff --git a/assets/player/playerk8.png b/assets/player/playerk8.png
index ff03a02..50175e8 100644
--- a/assets/player/playerk8.png
+++ b/assets/player/playerk8.png
Binary files differ
diff --git a/brice.dat b/brice.dat
index 61d57c2..ea71945 100644
--- a/brice.dat
+++ b/brice.dat
@@ -1,5 +1,5 @@
2
-canJump
-0
canSprint
0
+canJump
+0
diff --git a/shaders/world.frag b/shaders/world.frag
index 80af175..c103433 100644
--- a/shaders/world.frag
+++ b/shaders/world.frag
@@ -5,7 +5,7 @@ varying vec4 color;
void main(){
vec4 pixTex = texture2D(sampler, vec2(texCoord.x, 1-texCoord.y));
- if(pixTex.a <= .1)
+ if(pixTex.a == 0.0)
discard;
gl_FragColor = pixTex * color;
}
diff --git a/src/entities.cpp b/src/entities.cpp
index 8dc32e2..ff8dd5d 100644
--- a/src/entities.cpp
+++ b/src/entities.cpp
@@ -349,14 +349,23 @@ void NPC::drawThingy(void) const
c[2], c[3], z, c[0], c[3], z, c[0], c[1], z
};
+ // TODO use texture made for this
+ static GLuint thingyColor = Texture::genColor(Color(236, 238, 15));
+
glUseProgram(worldShader);
+
glEnableVertexAttribArray(worldShader_attribute_coord);
glEnableVertexAttribArray(worldShader_attribute_tex);
+
+ glBindTexture(GL_TEXTURE_2D, thingyColor);
+
glVertexAttribPointer(worldShader_attribute_coord, 3, GL_FLOAT, GL_FALSE, 0, coords);
glVertexAttribPointer(worldShader_attribute_tex, 2, GL_FLOAT, GL_FALSE, 0, tex_coord);
glDrawArrays(GL_TRIANGLES, 0, 6);
+
glDisableVertexAttribArray(worldShader_attribute_coord);
glDisableVertexAttribArray(worldShader_attribute_tex);
+
glUseProgram(0);
}
}
diff --git a/src/inventory.cpp b/src/inventory.cpp
index 29e2dc9..8c662c4 100644
--- a/src/inventory.cpp
+++ b/src/inventory.cpp
@@ -104,7 +104,9 @@ void items(void)
ItemMap.back()->tex = new Texturec(1, exml->Attribute("sprite"));
// get the width and height of the object based off of its sprite
- ItemMap.back()->dim = Texture::imageDim(exml->Attribute("sprite"));
+ dim2 tmpDim = Texture::imageDim(exml->Attribute("sprite"));
+ ItemMap.back()->dim.x = HLINES(tmpDim.x/2);
+ ItemMap.back()->dim.y = HLINES(tmpDim.y/2);
ItemMap.back()->name = exml->Attribute("name");
diff --git a/src/items.cpp b/src/items.cpp
index 21484b4..99c143b 100644
--- a/src/items.cpp
+++ b/src/items.cpp
@@ -60,20 +60,45 @@ int Sword::useItem()
float dist = 0.0f;
while (dist < dim.y) {
hitbox.end = hitbox.start;
- hitbox.end.x += dist * cos(rotation*PI/180);
+ if (player->left)
+ hitbox.end.x -= dist * cos(rotation*PI/180);
+ else
+ hitbox.end.x += dist * cos(rotation*PI/180);
+
hitbox.end.y += dist * sin(rotation*PI/180);
if (hitbox.end.x > e->loc.x && hitbox.end.x < e->loc.x + e->width) {
if (hitbox.end.y > e->loc.y && hitbox.end.y < e->loc.y + e->height) {
e->takeHit(damage, 600);
+ static GLuint sColor = Texture::genColor(Color(255,0,0));
+
+ GLfloat t[] = {0.0, 0.0,
+ 1.0, 1.0};
+
+ GLfloat v[] = {hitbox.start.x, hitbox.start.y, 1.0,
+ hitbox.end.x, hitbox.end.y, 1.0};
+
+
+ glBindTexture(GL_TEXTURE_2D, sColor);
+ glUseProgram(worldShader);
+ glEnableVertexAttribArray(worldShader_attribute_coord);
+ glEnableVertexAttribArray(worldShader_attribute_tex);
+
+ glVertexAttribPointer(worldShader_attribute_coord, 3, GL_FLOAT, GL_FALSE, 0, v);
+ glVertexAttribPointer(worldShader_attribute_tex, 2, GL_FLOAT, GL_FALSE, 0, t);
+ glDrawArrays(GL_LINES, 0, 2);
+
+ glDisableVertexAttribArray(worldShader_attribute_coord);
+ glDisableVertexAttribArray(worldShader_attribute_tex);
+ glUseProgram(0);
// add some blood
// for(int r = 0; r < (rand()%5);r++)
// currentWorld->addParticle(rand()%game::HLINE*3 + e->loc.x - .05f,e->loc.y + e->height*.5, game::HLINE,game::HLINE, -(rand()%10)*.01,((rand()%4)*.001-.002), {(rand()%75+10)/100.0f,0,0}, 10000);
}
}
- dist += HLINES(1);
+ dist += HLINES(0.5f);
}
}
}
diff --git a/src/world.cpp b/src/world.cpp
index 0c5007d..70ba967 100644
--- a/src/world.cpp
+++ b/src/world.cpp
@@ -254,7 +254,6 @@ void World::drawBackgrounds(void)
alpha = 255 - worldShade * 4;
break;
}
- (void)alpha;
glActiveTexture(GL_TEXTURE0);
glUniform1i(worldShader_uniform_texture, 0);
@@ -276,7 +275,6 @@ void World::drawBackgrounds(void)
vec2(0.0f, 1.0f),
vec2(0.0f, 0.0f)};
- bgTex(0);
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,
@@ -290,18 +288,85 @@ void World::drawBackgrounds(void)
glEnableVertexAttribArray(worldShader_attribute_coord);
glEnableVertexAttribArray(worldShader_attribute_tex);
+ bgTex(0);
+ glUniform4f(worldShader_uniform_color, 1.0, 1.0, 1.0, 1.0);
glVertexAttribPointer(worldShader_attribute_coord, 3, GL_FLOAT, GL_FALSE, 0, back_tex_coord);
glVertexAttribPointer(worldShader_attribute_tex, 2, GL_FLOAT, GL_FALSE, 0, tex_coord);
glDrawArrays(GL_TRIANGLES, 0 , 6);
+ bgTex++;
+ glUniform4f(worldShader_uniform_color, .8, .8, .8, 1.3 - static_cast<float>(alpha)/255.0f);
+ glVertexAttribPointer(worldShader_attribute_coord, 3, GL_FLOAT, GL_FALSE, 0, back_tex_coord);
+ glVertexAttribPointer(worldShader_attribute_tex, 2, GL_FLOAT, GL_FALSE, 0, tex_coord);
+ glDrawArrays(GL_TRIANGLES, 0 , 6);
+
+
+ static GLuint starTex = Texture::genColor(Color(255, 255, 255));
+ const static float stardim = 2;
+ GLfloat star_coord[star.size() * 5 * 6 + 1];
+ GLfloat *si = &star_coord[0];
+
+ if (worldShade > 0) {
+
+ auto xcoord = offset.x * 0.9f;
+
+ for (auto &s : star) {
+ *(si++) = s.x + xcoord;
+ *(si++) = s.y,
+ *(si++) = 9.8;
+
+ *(si++) = 0.0;
+ *(si++) = 0.0;
+
+ *(si++) = s.x + xcoord + stardim;
+ *(si++) = s.y,
+ *(si++) = 9.8;
+
+ *(si++) = 1.0;
+ *(si++) = 0.0;
+
+ *(si++) = s.x + xcoord + stardim;
+ *(si++) = s.y + stardim,
+ *(si++) = 9.8;
+
+ *(si++) = 1.0;
+ *(si++) = 1.0;
+
+ *(si++) = s.x + xcoord + stardim;
+ *(si++) = s.y + stardim,
+ *(si++) = 9.8;
+
+ *(si++) = 1.0;
+ *(si++) = 1.0;
+
+ *(si++) = s.x + xcoord;
+ *(si++) = s.y + stardim,
+ *(si++) = 9.8;
+
+ *(si++) = 0.0;
+ *(si++) = 1.0;
+
+ *(si++) = s.x + xcoord;
+ *(si++) = s.y,
+ *(si++) = 9.8;
+
+ *(si++) = 0.0;
+ *(si++) = 0.0;
+ }
+ glBindTexture(GL_TEXTURE_2D, starTex);
+ glUniform4f(worldShader_uniform_color, 1.0, 1.0, 1.0, (255.0f - (randGet() % 200 - 100)) / 255.0f);
+
+ glVertexAttribPointer(worldShader_attribute_coord, 3, GL_FLOAT, GL_FALSE, 5 * sizeof(GLfloat), &star_coord[0]);
+ glVertexAttribPointer(worldShader_attribute_tex, 2, GL_FLOAT, GL_FALSE, 5 * sizeof(GLfloat), &star_coord[3]);
+ glDrawArrays(GL_TRIANGLES, 0, star.size() * 6);
+ }
glDisableVertexAttribArray(worldShader_attribute_coord);
glDisableVertexAttribArray(worldShader_attribute_tex);
+ glUniform4f(worldShader_uniform_color, 1.0, 1.0, 1.0, 1.0);
glUseProgram(0);
- bgTex++;
-
std::vector<vec3> bg_items;
bgTex++;