1
0
mirror of https://github.com/zenorogue/hyperrogue.git synced 2025-01-11 18:00:34 +00:00

fixed texture load-on-save

This commit is contained in:
Zeno Rogue 2018-02-20 22:12:54 +01:00
parent 082bd44c2a
commit 920e295c3c

View File

@ -135,8 +135,9 @@ bool readtexture() {
#elif CAP_PNG
FILE *f = fopen(texturename.c_str(), "rb");
if(!f) { printf("failed to open file\n"); return false; }
png_structp png = png_create_read_struct(PNG_LIBPNG_VER_STRING, NULL, NULL, NULL);
if(!png) return false;
if(!png) { printf("failed to create_read_struct\n"); return false; }
if(setjmp(png_jmpbuf(png))) {
printf("failed to read\n");
return false;
@ -183,6 +184,8 @@ bool readtexture() {
return origpixels[y*tx + x];
};
printf("texture read OK\n");
#endif
if(tx == twidth && ty == twidth) {
@ -494,11 +497,12 @@ void saveFullTexture() {
texture::saving = false;
drawscreen();
itt = xyscale(Id, vid.scrsize * 1. / vid.radius);
readtexture();
if(readtexture() && loadTextureGL()) {
itt = Id; // xyscale(Id, vid.scrsize * 1. / vid.radius);
perform_mapping();
finish_mapping();
}
}
bool newmove = false;