diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/items.cpp | 28 | ||||
-rw-r--r-- | src/ui.cpp | 2 | ||||
-rw-r--r-- | src/world.cpp | 10 |
3 files changed, 12 insertions, 28 deletions
diff --git a/src/items.cpp b/src/items.cpp index eacf5a9..f0b2f84 100644 --- a/src/items.cpp +++ b/src/items.cpp @@ -74,28 +74,9 @@ int Sword::useItem() else 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); + //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); } } @@ -160,7 +141,10 @@ int Food::useItem() int ItemLight::useItem() { - std::cout << "fsdfsdf" << std::endl; + if (player->light.radius > 0) + player->light.radius = 0; + else + player->light.radius = 500; return 0; } @@ -1093,7 +1093,7 @@ namespace ui { drawNiceBox(vec2 {x, y}, vec2 {x + SCREEN_WIDTH - HLINES(16), y - SCREEN_HEIGHT / 4}, -7.0); rtext = typeOut(dialogBoxText); - putString(x + game::HLINE, y - fontSize - game::HLINE, rtext); + putString(x + (2*game::HLINE), y - fontSize - game::HLINE, rtext); for(i=0;i<dialogOptText.size();i++) { setFontColor(255,255,255); diff --git a/src/world.cpp b/src/world.cpp index 450d956..8c6a548 100644 --- a/src/world.cpp +++ b/src/world.cpp @@ -524,12 +524,12 @@ void World::draw(Player *p) uint ls = light.size(); - GLfloat *lightCoords = new GLfloat[light.size() * 4]; - GLfloat *lightColors = new GLfloat[light.size() * 4]; - + GLfloat *lightCoords = new GLfloat[ls * 4]; + GLfloat *lightColors = new GLfloat[ls * 4]; + uint lpIndex = 0; uint lcIndex = 0; - + for (uint i = 0; i < ls; i++) { auto &l = light[i]; if (l.belongsTo) { @@ -1482,7 +1482,7 @@ addParticle(float x, float y, float w, float h, float vx, float vy, Color color, void World:: addLight(vec2 loc, float radius, Color color) { - if (light.size() < 64) + if (light.size() < 128) light.emplace_back(loc, radius, color); } |