Skip to content

Commit

Permalink
Merge pull request #89 from theo-walton/crashfix
Browse files Browse the repository at this point in the history
crashfix
  • Loading branch information
theo-walton authored Jun 24, 2018
2 parents b34a985 + d96092c commit 7ab0aac
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 9 deletions.
5 changes: 2 additions & 3 deletions src/GameState.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -106,9 +106,7 @@ void GameState::Update(double dt)
_lorePannel.Render();
return;
}

_cells(_registry);


systems::RenderModels(_registry, _modelCache, _window, _camera, dt);
systems::TimedEffect(_registry, dt);
systems::Buttons(_registry, _window);
Expand All @@ -123,4 +121,5 @@ void GameState::Update(double dt)
systems::Images(_registry, _imageCache, _window);
systems::Texts(_registry, _window);
systems::Sound(_registry, dt);
_cells(_registry);
}
2 changes: 1 addition & 1 deletion src/LevelSelectState.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ static void create_locked_icon(entt::DefaultRegistry& r, size_t i)

auto locked = r.create();
r.assign<c::Image>(locked,
"assets/textures/locked.png",
"assets/textures/dark_blue_button.png",
botlefts[i],
toprights[i],
1);
Expand Down
3 changes: 3 additions & 0 deletions src/Texture.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,10 @@ Texture::Texture(std::string filepath)
unsigned error = lodepng::decode(_imageData, _width, _height, filepath.c_str());

if (error)
{
std::cout << filepath << std::endl;
std::cout << "error: " << lodepng_error_text(error) << std::endl;
}

std::vector<unsigned char> temp(_width * 4);

Expand Down
1 change: 1 addition & 0 deletions src/bomberman.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

#define GLFW_INCLUDE_GLCOREARB
#define GLM_ENABLE_EXPERIMENTAL
#define NDEBUG

#include <GLFW/glfw3.h>
#include <string>
Expand Down
9 changes: 4 additions & 5 deletions src/scripts.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ script explode(int power)
return [power](entt::DefaultRegistry& r, uint32_t e)
{
auto ex = r.create();
glm::vec3 &pos = r.get<c::Position>(e).pos;
glm::vec3& pos = r.get<c::Position>(e).pos;
auto &sound = r.get<c::EngineTag>().ref.sound;

r.assign<c::Explosion>(ex, power);
Expand Down Expand Up @@ -72,17 +72,16 @@ script death(std::string level)
{
return [level](entt::DefaultRegistry& r, uint32_t e)
{
explode(1)(r, e);
auto ex = r.create();
auto &sound = r.get<c::EngineTag>().ref.sound;
auto game_over = [level](entt::DefaultRegistry& r, uint32_t)
{
auto& engine = r.get<c::EngineTag>().ref;
engine.ChangeState(new DeathState(engine, level));
};
sound.play2D(ASSET_PATH "sounds/player_death.wav");
r.assign<c::TimedEffect>(e, 1.5f, game_over);
r.remove<c::Model>(e);
r.remove<c::Vulnerable>(e);
r.assign<c::TimedEffect>(ex, 1.5f, game_over);
r.destroy(e);
};
}

Expand Down

0 comments on commit 7ab0aac

Please sign in to comment.