1
0
mirror of https://github.com/zenorogue/hyperrogue.git synced 2025-01-26 00:47:00 +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 #elif CAP_PNG
FILE *f = fopen(texturename.c_str(), "rb"); 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); 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))) { if(setjmp(png_jmpbuf(png))) {
printf("failed to read\n"); printf("failed to read\n");
return false; return false;
@ -183,6 +184,8 @@ bool readtexture() {
return origpixels[y*tx + x]; return origpixels[y*tx + x];
}; };
printf("texture read OK\n");
#endif #endif
if(tx == twidth && ty == twidth) { if(tx == twidth && ty == twidth) {
@ -494,11 +497,12 @@ void saveFullTexture() {
texture::saving = false; texture::saving = false;
drawscreen(); drawscreen();
itt = xyscale(Id, vid.scrsize * 1. / vid.radius); if(readtexture() && loadTextureGL()) {
readtexture(); itt = Id; // xyscale(Id, vid.scrsize * 1. / vid.radius);
perform_mapping(); perform_mapping();
finish_mapping(); finish_mapping();
} }
}
bool newmove = false; bool newmove = false;