X-Git-Url: http://git.localhorst.tv/?a=blobdiff_plain;f=src%2Fapp%2Fapp.cpp;h=1e82cab998b789e6a9be2fc62723defc2e012128;hb=957b1df87d9a692c517a269221da81227100240e;hp=6e7201a6f9b2239405255d2413aa0f06dca35007;hpb=be3a81656b8493010d2329fa00da617e24293438;p=blank.git diff --git a/src/app/app.cpp b/src/app/app.cpp index 6e7201a..1e82cab 100644 --- a/src/app/app.cpp +++ b/src/app/app.cpp @@ -98,6 +98,8 @@ void HeadlessApplication::Run() { void HeadlessApplication::Loop(int dt) { env.counter.EnterFrame(); + HandleEvents(); + if (!HasState()) return; Update(dt); CommitStates(); if (!HasState()) return; @@ -335,8 +337,10 @@ void AssetLoader::LoadBlockTypes(const std::string &set_name, BlockTypeRegistry } else if (name == "texture") { in.ReadString(tex_name); type.texture = tex_index.GetID(tex_name); - } else if (name == "color") { - in.ReadVec(type.color); + } else if (name == "rgb_mod") { + in.ReadVec(type.rgb_mod); + } else if (name == "hsl_mod") { + in.ReadVec(type.hsl_mod); } else if (name == "outline") { in.ReadVec(type.outline_color); } else if (name == "label") { @@ -349,6 +353,34 @@ void AssetLoader::LoadBlockTypes(const std::string &set_name, BlockTypeRegistry type.collision = in.GetBool(); } else if (name == "collide_block") { type.collide_block = in.GetBool(); + } else if (name == "generate") { + type.generate = in.GetBool(); + } else if (name == "min_solidity") { + type.min_solidity = in.GetFloat(); + } else if (name == "mid_solidity") { + type.mid_solidity = in.GetFloat(); + } else if (name == "max_solidity") { + type.max_solidity = in.GetFloat(); + } else if (name == "min_humidity") { + type.min_humidity = in.GetFloat(); + } else if (name == "mid_humidity") { + type.mid_humidity = in.GetFloat(); + } else if (name == "max_humidity") { + type.max_humidity = in.GetFloat(); + } else if (name == "min_temperature") { + type.min_temperature = in.GetFloat(); + } else if (name == "mid_temperature") { + type.mid_temperature = in.GetFloat(); + } else if (name == "max_temperature") { + type.max_temperature = in.GetFloat(); + } else if (name == "min_richness") { + type.min_richness = in.GetFloat(); + } else if (name == "mid_richness") { + type.mid_richness = in.GetFloat(); + } else if (name == "max_richness") { + type.max_richness = in.GetFloat(); + } else if (name == "commonness") { + type.commonness = in.GetFloat(); } else if (name == "shape") { in.ReadIdentifier(shape_name); if (shape_name == "block") { @@ -385,32 +417,66 @@ CubeMap AssetLoader::LoadCubeMap(const string &name) const { string front = full + "-front.png"; CubeMap cm; + cm.Bind(); SDL_Surface *srf; if (!(srf = IMG_Load(right.c_str()))) throw SDLError("IMG_Load"); - cm.Data(CubeMap::RIGHT, *srf); + try { + cm.Data(CubeMap::RIGHT, *srf); + } catch (...) { + SDL_FreeSurface(srf); + throw; + } SDL_FreeSurface(srf); if (!(srf = IMG_Load(left.c_str()))) throw SDLError("IMG_Load"); - cm.Data(CubeMap::LEFT, *srf); + try { + cm.Data(CubeMap::LEFT, *srf); + } catch (...) { + SDL_FreeSurface(srf); + throw; + } SDL_FreeSurface(srf); if (!(srf = IMG_Load(top.c_str()))) throw SDLError("IMG_Load"); - cm.Data(CubeMap::TOP, *srf); + try { + cm.Data(CubeMap::TOP, *srf); + } catch (...) { + SDL_FreeSurface(srf); + throw; + } SDL_FreeSurface(srf); if (!(srf = IMG_Load(bottom.c_str()))) throw SDLError("IMG_Load"); - cm.Data(CubeMap::BOTTOM, *srf); + try { + cm.Data(CubeMap::BOTTOM, *srf); + } catch (...) { + SDL_FreeSurface(srf); + throw; + } SDL_FreeSurface(srf); if (!(srf = IMG_Load(back.c_str()))) throw SDLError("IMG_Load"); - cm.Data(CubeMap::BACK, *srf); + try { + cm.Data(CubeMap::BACK, *srf); + } catch (...) { + SDL_FreeSurface(srf); + throw; + } SDL_FreeSurface(srf); if (!(srf = IMG_Load(front.c_str()))) throw SDLError("IMG_Load"); - cm.Data(CubeMap::FRONT, *srf); + try { + cm.Data(CubeMap::FRONT, *srf); + } catch (...) { + SDL_FreeSurface(srf); + throw; + } SDL_FreeSurface(srf); + cm.FilterNearest(); + cm.WrapEdge(); + return cm; }