graphics: finish to change code to store some images as Texture, ...

This commit is contained in:
Laurent alonso
2020-10-17 21:11:24 +02:00
committed by Celtic Minstrel
parent a407d61f4c
commit 92eee35b66
15 changed files with 42 additions and 114 deletions

View File

@@ -398,7 +398,7 @@ bool load_party_v2(fs::path file_to_load, cUniverse& real_univ){
sf::Texture sheet; sf::Texture sheet;
sheet.create(party_sheet.getSize().x, party_sheet.getSize().y); sheet.create(party_sheet.getSize().x, party_sheet.getSize().y);
sheet.update(party_sheet); sheet.update(party_sheet);
spec_scen_g.party_sheet.reset(new sf::Texture(sheet)); spec_scen_g.party_sheet=Texture(sheet);
} else showWarning("There was an error loading the party custom graphics."); } else showWarning("There was an error loading the party custom graphics.");
} }

View File

@@ -2462,7 +2462,7 @@ void load_spec_graphics_v1(fs::path scen_file) {
spec_scen_g.numSheets = 1; spec_scen_g.numSheets = 1;
sf::Texture sheet; sf::Texture sheet;
if(sheet.loadFromImage(graphics_store)) { if(sheet.loadFromImage(graphics_store)) {
spec_scen_g.sheets[0].reset(new sf::Texture(sheet)); spec_scen_g.sheets[0]=Texture(sheet);
} else { } else {
showWarning("An error occurred while converting old-style graphics into the new format.",noGraphics); showWarning("An error occurred while converting old-style graphics into the new format.",noGraphics);
spec_scen_g.is_old = false; spec_scen_g.is_old = false;
@@ -2481,7 +2481,7 @@ void load_spec_graphics_v2(int num_sheets) {
} }
while(num_sheets-- > 0) { while(num_sheets-- > 0) {
std::string name = "sheet" + std::to_string(num_sheets); std::string name = "sheet" + std::to_string(num_sheets);
ResMgr::graphics.free(name); ResMgr::textures.free(name);
spec_scen_g.sheets[num_sheets] = &ResMgr::graphics.get(name); spec_scen_g.sheets[num_sheets] = *ResMgr::textures.get(name);
} }
} }

View File

@@ -10,29 +10,6 @@
#include "texture.hpp" #include "texture.hpp"
class ImageLoader : public ResMgr::cLoader<sf::Texture> {
/// Load an image from a PNG file.
sf::Texture* operator() (const fs::path& fpath) const override {
sf::Texture* img = new sf::Texture();
if(img->loadFromFile(fpath.string())) return img;
delete img;
throw ResMgr::xError(ResMgr::ERR_LOAD, "Failed to load PNG image: " + fpath.string());
}
ResourceList expand(const std::string& name) const override {
return {name + ".png", name + ".bmp"};
}
std::string typeName() const override {
return "image";
}
};
// TODO: What's a good max texture count?
static ImageLoader loader;
ResMgr::cPool<sf::Texture> ResMgr::graphics(loader, 50);
class TextureLoader : public ResMgr::cLoader<Texture> { class TextureLoader : public ResMgr::cLoader<Texture> {
/// Load an image from a PNG file. /// Load an image from a PNG file.
Texture* operator() (const fs::path& fpath) const override { Texture* operator() (const fs::path& fpath) const override {
@@ -40,7 +17,7 @@ class TextureLoader : public ResMgr::cLoader<Texture> {
if(img->loadFromFile(fpath.string())) { if(img->loadFromFile(fpath.string())) {
Texture *texture=new Texture; Texture *texture=new Texture;
texture->texture=img; texture->texture=img;
texture->dimension=Texture::getApplicationDimension(fpath.filename().string()); texture->dimension=Texture::getApplicationDimension(fpath.filename().string());
if (texture->dimension.x==0 || texture->dimension.y==0) if (texture->dimension.x==0 || texture->dimension.y==0)
texture->dimension=sf::Vector2u(img->getSize()); texture->dimension=sf::Vector2u(img->getSize());
return texture; return texture;
@@ -58,6 +35,6 @@ class TextureLoader : public ResMgr::cLoader<Texture> {
}; };
// TODO: What's a good max texture count? // TODO: What's a good max texture count?
static TextureLoader textLoader; static TextureLoader texturesLoader;
ResMgr::cPoolTexture ResMgr::textures(textLoader, 50); ResMgr::cPool<Texture> ResMgr::textures(texturesLoader, 50);

View File

@@ -13,28 +13,10 @@
#include "resmgr.hpp" #include "resmgr.hpp"
#include "texture.hpp" #include "texture.hpp"
using ImageRsrc = ResMgr::cPointer<sf::Texture>;
using TextureRsrc = ResMgr::cPointer<Texture>; using TextureRsrc = ResMgr::cPointer<Texture>;
namespace ResMgr { namespace ResMgr {
extern cPool<sf::Texture> graphics; extern cPool<Texture> textures;
// temporary while graphics is not suppressed
class cPoolTexture : public cPool<Texture> {
public:
cPoolTexture(cLoader<Texture>& loader, size_t max, std::string dir = "")
: cPool<Texture>(loader, max, dir)
{}
fs::path popPath() {
graphics.popPath();
return cPool<Texture>::popPath();
}
void pushPath(const fs::path& path) {
cPool<Texture>::pushPath(path);
graphics.pushPath(path);
}
};
extern ResMgr::cPoolTexture textures;
} }
#endif #endif

View File

@@ -2525,7 +2525,7 @@ void handle_hunting() {
for(cPlayer& pc : univ.party) for(cPlayer& pc : univ.party)
if(pc.is_alive() && pc.traits[trait] && get_ran(1,0,12) == 5) { if(pc.is_alive() && pc.traits[trait] && get_ran(1,0,12) == 5) {
univ.party.food += get_ran(univ.scenario.ter_types[ter].flag1,1,6); univ.party.food += get_ran(univ.scenario.ter_types[ter].flag1,1,6);
add_string_to_buf(pc.name + "hunts."); add_string_to_buf(pc.name + " hunts.");
put_pc_screen(); put_pc_screen();
} }
} }
@@ -2626,7 +2626,7 @@ void start_new_game(bool force) {
// Destroy party graphics // Destroy party graphics
extern cCustomGraphics spec_scen_g; extern cCustomGraphics spec_scen_g;
spec_scen_g.party_sheet.reset(); spec_scen_g.party_sheet=Texture();
// The original code called build_outdoors here, but they're not even in a scenario, so I removed it. // The original code called build_outdoors here, but they're not even in a scenario, so I removed it.
// It was probably a relic of Exile III. // It was probably a relic of Exile III.

View File

@@ -272,7 +272,7 @@ void draw_startup_anim(bool advance) {
anim_from.offset(-1,-4 + startup_anim_pos); anim_from.offset(-1,-4 + startup_anim_pos);
if(advance) startup_anim_pos = (startup_anim_pos + 1) % 542; if(advance) startup_anim_pos = (startup_anim_pos + 1) % 542;
auto const &startbut=*ResMgr::textures.get("startbut",true); auto const &startbut=*ResMgr::textures.get("startbut",true);
rect_draw_some_item(startbut,startbut.dimension,mainPtr,startup_button[STARTBTN_SCROLL]); rect_draw_some_item(startbut,rectangle(startbut),mainPtr,startup_button[STARTBTN_SCROLL]);
anim_to.offset(startup_button[STARTBTN_SCROLL].left, startup_button[STARTBTN_SCROLL].top); anim_to.offset(startup_button[STARTBTN_SCROLL].left, startup_button[STARTBTN_SCROLL].top);
auto const &startanim=*ResMgr::textures.get("startanim",true); auto const &startanim=*ResMgr::textures.get("startanim",true);
rect_draw_some_item(startanim,anim_from,mainPtr,anim_to,sf::BlendAlpha); rect_draw_some_item(startanim,anim_from,mainPtr,anim_to,sf::BlendAlpha);

View File

@@ -1451,10 +1451,10 @@ void draw_map(bool need_refresh) {
rect_draw_some_item(*ResMgr::textures.get("teranim"), custom_from, map_gworld, draw_rect); rect_draw_some_item(*ResMgr::textures.get("teranim"), custom_from, map_gworld, draw_rect);
} else { } else {
int which_sheet = pic / 50; int which_sheet = pic / 50;
auto src_gw = &ResMgr::textures.get("ter" + std::to_string(1 + which_sheet)); auto const &src_gw = *ResMgr::textures.get("ter" + std::to_string(1 + which_sheet));
pic %= 50; pic %= 50;
custom_from = calc_rect(pic % 10, pic / 10); custom_from = calc_rect(pic % 10, pic / 10);
rect_draw_some_item(*src_gw, custom_from, map_gworld, draw_rect); rect_draw_some_item(src_gw, custom_from, map_gworld, draw_rect);
} }
} else { } else {
if(univ.scenario.ter_types[what_ter].picture < 960) if(univ.scenario.ter_types[what_ter].picture < 960)

View File

@@ -29,8 +29,8 @@ Texture_pos cCustomGraphics::find_graphic(pic_num_t which_rect, bool party) {
else if(numSheets == 0) valid = false; else if(numSheets == 0) valid = false;
if(!valid) { if(!valid) {
INVALID: INVALID:
auto blank = &ResMgr::textures.get("blank", true); auto const &blank = *ResMgr::textures.get("blank", true);
return std::make_pair(*blank, rectangle(0,0,36,28)); return std::make_pair(blank, rectangle(0,0,36,28));
} }
short sheet = which_rect / 100; short sheet = which_rect / 100;
if(is_old || party) sheet = 0; if(is_old || party) sheet = 0;
@@ -38,22 +38,22 @@ Texture_pos cCustomGraphics::find_graphic(pic_num_t which_rect, bool party) {
rectangle store_rect = {0,0,36,28}; rectangle store_rect = {0,0,36,28};
store_rect.offset(28 * (which_rect % 10),36 * (which_rect / 10)); store_rect.offset(28 * (which_rect % 10),36 * (which_rect / 10));
std::shared_ptr<const sf::Texture> the_sheet = party ? party_sheet : sheets[sheet]; Texture const &the_sheet = party ? party_sheet : sheets[sheet];
rectangle test(*the_sheet); rectangle test(the_sheet);
if((store_rect & test) != store_rect) goto INVALID; // FIXME: HACK if((store_rect & test) != store_rect) goto INVALID; // FIXME: HACK
return std::make_pair(the_sheet,store_rect); return std::make_pair(the_sheet,store_rect);
} }
size_t cCustomGraphics::count(bool party) { size_t cCustomGraphics::count(bool party) {
if(!party && sheets.empty()) return 0; if(!party && sheets.empty()) return 0;
else if(party && party_sheet == nullptr) return 0; else if(party && !party_sheet) return 0;
else if(is_old || party) { else if(is_old || party) {
rectangle bounds(party ? *party_sheet : *sheets[0]); rectangle bounds(party ? party_sheet : sheets[0]);
if(bounds.width() < 280) return bounds.width() / 28; if(bounds.width() < 280) return bounds.width() / 28;
return 10 * bounds.height() / 36; return 10 * bounds.height() / 36;
} else { } else {
size_t count = 100 * (numSheets - 1); size_t count = 100 * (numSheets - 1);
rectangle bounds(*sheets[numSheets - 1]); rectangle bounds(sheets[numSheets - 1]);
if(bounds.width() < 280) count += bounds.width() / 28; if(bounds.width() < 280) count += bounds.width() / 28;
else count += 10 * bounds.height() / 36; else count += 10 * bounds.height() / 36;
return count; return count;
@@ -68,7 +68,7 @@ void cCustomGraphics::copy_graphic(pic_num_t dest, pic_num_t src, size_t numSlot
sf::Texture sheet; sf::Texture sheet;
sheet.create(280, 180); sheet.create(280, 180);
sheet.update(empty); sheet.update(empty);
party_sheet.reset(new sf::Texture(sheet)); party_sheet=Texture(sheet);
numSheets = 1; numSheets = 1;
} }
size_t havePics = count(); size_t havePics = count();
@@ -79,8 +79,8 @@ void cCustomGraphics::copy_graphic(pic_num_t dest, pic_num_t src, size_t numSlot
sf::RenderTexture temp; sf::RenderTexture temp;
temp.create(280, party_sheet->getSize().y + 36 * addRows); temp.create(280, party_sheet->getSize().y + 36 * addRows);
temp.clear(sf::Color::Transparent); temp.clear(sf::Color::Transparent);
rect_draw_some_item(*party_sheet, rectangle(*party_sheet), temp, rectangle(*party_sheet)); rect_draw_some_item(party_sheet, rectangle(party_sheet), temp, rectangle(*party_sheet));
party_sheet.reset(new sf::Texture(temp.getTexture())); party_sheet=Texture(temp.getTexture());
} }
Texture from_sheet; Texture from_sheet;
Texture to_sheet; Texture to_sheet;
@@ -127,7 +127,7 @@ void cCustomGraphics::convert_sheets() {
sf::Texture sheet_tex; sf::Texture sheet_tex;
sheet_tex.create(280, 360); sheet_tex.create(280, 360);
sheet_tex.update(sheet); sheet_tex.update(sheet);
sheets[i].reset(new sf::Texture(sheet_tex)); sheets[i]=Texture(sheet_tex);
fs::path sheetPath = pic_dir/("sheet" + std::to_string(i) + ".png"); fs::path sheetPath = pic_dir/("sheet" + std::to_string(i) + ".png");
sheets[i]->copyToImage().saveToFile(sheetPath.string().c_str()); sheets[i]->copyToImage().saveToFile(sheetPath.string().c_str());
@@ -139,7 +139,7 @@ void cCustomGraphics::replace_sheet(size_t num, sf::Image& newSheet) {
if(num >= numSheets) return; // TODO: Fail silently? Is that a good idea? if(num >= numSheets) return; // TODO: Fail silently? Is that a good idea?
sf::Texture replacement; sf::Texture replacement;
replacement.loadFromImage(newSheet); replacement.loadFromImage(newSheet);
sheets[num].reset(new sf::Texture(replacement)); sheets[num]=Texture(replacement);
// Then we need to do some extra stuff to ensure the dialog engine also sees the change // Then we need to do some extra stuff to ensure the dialog engine also sees the change
extern fs::path tempDir; extern fs::path tempDir;
std::string sheetname = "sheet" + std::to_string(num); std::string sheetname = "sheet" + std::to_string(num);
@@ -163,7 +163,7 @@ void cCustomGraphics::init_sheet(size_t num) {
} }
} }
} }
sheets[num].reset(new sf::Texture(placeholder)); sheets[num]=Texture(placeholder);
} }
extern const std::vector<m_pic_index_t> m_pic_index = { extern const std::vector<m_pic_index_t> m_pic_index = {

View File

@@ -24,12 +24,12 @@ struct m_pic_index_t {
struct cCustomGraphics { struct cCustomGraphics {
size_t numSheets; size_t numSheets;
std::vector<std::shared_ptr<const sf::Texture>> sheets; std::vector<Texture> sheets;
std::shared_ptr<const sf::Texture> party_sheet; Texture party_sheet;
bool is_old = false; bool is_old = false;
void clear() { void clear() {
sheets.clear(); sheets.clear();
party_sheet.reset(); party_sheet=Texture();
} }
explicit operator bool() { explicit operator bool() {
return !sheets.empty() && bool(sheets[0]); return !sheets.empty() && bool(sheets[0]);

View File

@@ -63,7 +63,7 @@ void init_shaders() {
void draw_splash(const Texture& splash, sf::RenderWindow& targ, rectangle dest_rect) { void draw_splash(const Texture& splash, sf::RenderWindow& targ, rectangle dest_rect) {
targ.clear(sf::Color::Black); targ.clear(sf::Color::Black);
rect_draw_some_item(splash, splash.dimension, targ, dest_rect); rect_draw_some_item(splash, rectangle(splash), targ, dest_rect);
targ.display(); targ.display();
} }
@@ -92,34 +92,19 @@ void rect_draw_some_item(const Texture& src_gworld,rectangle src_rect,const sf::
static sf::RenderTexture src; static sf::RenderTexture src;
static bool inited = false; static bool inited = false;
if(!inited || real_src_rect.width() != src.getSize().x || real_src_rect.height() != src.getSize().y) { if(!inited || real_src_rect.width() != src.getSize().x || real_src_rect.height() != src.getSize().y) {
src.create(real_src_rect.width(), real_src_rect.height()); src.create(real_src_rect.width(), real_src_rect.height());
inited = true; inited = true;
} }
rectangle dest_rect = real_src_rect; rectangle dest_rect = real_src_rect;
dest_rect.offset(-dest_rect.left,-dest_rect.top); dest_rect.offset(-dest_rect.left,-dest_rect.top);
rect_draw_some_item(src_gworld, real_src_rect, src, dest_rect); rect_draw_some_item(src_gworld, src_rect, src, dest_rect);
src.display(); src.display();
maskShader.setParameter("texture", sf::Shader::CurrentTexture); maskShader.setParameter("texture", sf::Shader::CurrentTexture);
maskShader.setParameter("mask", mask_gworld); maskShader.setParameter("mask", mask_gworld);
rect_draw_some_item(src.getTexture(), dest_rect, targ_gworld, targ_rect, &maskShader); rect_draw_some_item(src.getTexture(), dest_rect, targ_gworld, targ_rect, &maskShader);
} }
void draw_splash(const sf::Texture& splash, sf::RenderWindow& targ, rectangle dest_rect) {
rectangle from_rect = rectangle(splash);
targ.clear(sf::Color::Black);
rect_draw_some_item(splash, from_rect, targ, dest_rect);
targ.display();
}
void rect_draw_some_item(sf::RenderTarget& targ_gworld,rectangle targ_rect) {
fill_rect(targ_gworld, targ_rect, sf::Color::Black);
}
void rect_draw_some_item(const sf::Texture& src_gworld,rectangle src_rect,sf::RenderTarget& targ_gworld,rectangle targ_rect,sf::BlendMode mode){
rect_draw_some_item(src_gworld, src_rect, targ_gworld, targ_rect, sf::RenderStates(mode));
}
void rect_draw_some_item(const sf::Texture& src_gworld,rectangle src_rect,sf::RenderTarget& targ_gworld,rectangle targ_rect,sf::RenderStates mode) { void rect_draw_some_item(const sf::Texture& src_gworld,rectangle src_rect,sf::RenderTarget& targ_gworld,rectangle targ_rect,sf::RenderStates mode) {
setActiveRenderTarget(targ_gworld); setActiveRenderTarget(targ_gworld);
sf::Sprite tile(src_gworld, src_rect); sf::Sprite tile(src_gworld, src_rect);
@@ -128,24 +113,11 @@ void rect_draw_some_item(const sf::Texture& src_gworld,rectangle src_rect,sf::Re
xScale /= src_rect.width(); xScale /= src_rect.width();
yScale /= src_rect.height(); yScale /= src_rect.height();
tile.setScale(xScale, yScale); tile.setScale(xScale, yScale);
targ_gworld.draw(tile, mode); targ_gworld.draw(tile, sf::RenderStates(mode));
} }
void rect_draw_some_item(const sf::Texture& src_gworld,rectangle src_rect,const sf::Texture& mask_gworld,sf::RenderTarget& targ_gworld,rectangle targ_rect) { void rect_draw_some_item(const sf::Texture& src_gworld,rectangle src_rect,sf::RenderTarget& targ_gworld,rectangle targ_rect,sf::BlendMode mode){
static sf::RenderTexture src; rect_draw_some_item(src_gworld, src_rect, targ_gworld, targ_rect, sf::RenderStates(mode));
static bool inited = false;
if(!inited || src_rect.width() != src.getSize().x || src_rect.height() != src.getSize().y) {
src.create(src_rect.width(), src_rect.height());
inited = true;
}
rectangle dest_rect = src_rect;
dest_rect.offset(-dest_rect.left,-dest_rect.top);
rect_draw_some_item(src_gworld, src_rect, src, dest_rect);
src.display();
maskShader.setParameter("texture", sf::Shader::CurrentTexture);
maskShader.setParameter("mask", mask_gworld);
rect_draw_some_item(src.getTexture(), dest_rect, targ_gworld, targ_rect, &maskShader);
} }
void setActiveRenderTarget(sf::RenderTarget& where) { void setActiveRenderTarget(sf::RenderTarget& where) {

View File

@@ -19,10 +19,7 @@
#include "pictypes.hpp" #include "pictypes.hpp"
void init_shaders(); void init_shaders();
void rect_draw_some_item(sf::RenderTarget& targ_gworld,rectangle targ_rect);
void rect_draw_some_item(const sf::Texture& src_gworld,rectangle src_rect,sf::RenderTarget& targ_gworld,rectangle targ_rect,sf::BlendMode mode = sf::BlendNone); void rect_draw_some_item(const sf::Texture& src_gworld,rectangle src_rect,sf::RenderTarget& targ_gworld,rectangle targ_rect,sf::BlendMode mode = sf::BlendNone);
void rect_draw_some_item(const sf::Texture& src_gworld,rectangle src_rect,const sf::Texture& mask_gworld,sf::RenderTarget& targ_gworld,rectangle targ_rect);
void draw_splash(const sf::Texture& splash, sf::RenderWindow& targ, rectangle dest_rect);
struct Texture; struct Texture;
void rect_draw_some_item(const Texture & src_gworld,rectangle src_rect,sf::RenderTarget& targ_gworld,rectangle targ_rect,sf::BlendMode mode = sf::BlendNone); void rect_draw_some_item(const Texture & src_gworld,rectangle src_rect,sf::RenderTarget& targ_gworld,rectangle targ_rect,sf::BlendMode mode = sf::BlendNone);

View File

@@ -23,7 +23,7 @@ struct Texture {
{ {
} }
Texture(Texture const &)=default; Texture(Texture const &)=default;
Texture(sf::Texture const &tex) explicit Texture(sf::Texture const &tex)
: texture(std::make_shared<sf::Texture>(tex)) : texture(std::make_shared<sf::Texture>(tex))
, dimension(0,0) , dimension(0,0)
{ {

View File

@@ -21,7 +21,6 @@ tessel_ref_t bw_pats[6];
struct tessel_t { struct tessel_t {
sf::RenderTexture* tessel; sf::RenderTexture* tessel;
sf::Texture* img;
rectangle srcRect; rectangle srcRect;
}; };
@@ -42,7 +41,6 @@ static int tessel_index = 0;
tessel_ref_t prepareForTiling(Texture const & srcImg, rectangle srcRect) { tessel_ref_t prepareForTiling(Texture const & srcImg, rectangle srcRect) {
tessel_ref_t ref = {tessel_index++}; tessel_ref_t ref = {tessel_index++};
tiling_reservoir[ref].img = &const_cast<sf::Texture &>(*srcImg);
tiling_reservoir[ref].srcRect = srcRect; tiling_reservoir[ref].srcRect = srcRect;
tiling_reservoir[ref].tessel = new sf::RenderTexture; tiling_reservoir[ref].tessel = new sf::RenderTexture;
tiling_reservoir[ref].tessel->create(srcRect.width(), srcRect.height()); tiling_reservoir[ref].tessel->create(srcRect.width(), srcRect.height());

View File

@@ -19,8 +19,10 @@ struct tessel_ref_t {
bool operator==(const tessel_ref_t& a, const tessel_ref_t& b); bool operator==(const tessel_ref_t& a, const tessel_ref_t& b);
struct Texture;
void init_tiling(); void init_tiling();
tessel_ref_t prepareForTiling(sf::Texture& srcImg, rectangle srcRect); tessel_ref_t prepareForTiling(Texture const &srcImg, rectangle srcRect);
void tileImage(sf::RenderTarget& target, rectangle area, tessel_ref_t tessel, sf::BlendMode mode = sf::BlendNone); void tileImage(sf::RenderTarget& target, rectangle area, tessel_ref_t tessel, sf::BlendMode mode = sf::BlendNone);
void tileImage(sf::RenderWindow& target, class Region& rgn, tessel_ref_t tessel, sf::BlendMode mode = sf::BlendNone); void tileImage(sf::RenderWindow& target, class Region& rgn, tessel_ref_t tessel, sf::BlendMode mode = sf::BlendNone);

View File

@@ -1182,7 +1182,7 @@ void draw_one_tiny_terrain_spot (short i,short j,ter_num_t terrain_to_draw,short
from_rect.bottom = from_rect.top + 12; from_rect.bottom = from_rect.top + 12;
picture_wanted /= 1000; picture_wanted--; picture_wanted /= 1000; picture_wanted--;
from_rect.offset((picture_wanted / 3) * 12, (picture_wanted % 3) * 12); from_rect.offset((picture_wanted / 3) * 12, (picture_wanted % 3) * 12);
rect_draw_some_item(*from_gw, from_rect, mainPtr, dest_rect); rect_draw_some_item(from_gw, from_rect, mainPtr, dest_rect);
} else { } else {
auto const & small_ter_gworld = *ResMgr::textures.get("termap"); auto const & small_ter_gworld = *ResMgr::textures.get("termap");
if(picture_wanted >= 960) { if(picture_wanted >= 960) {