1
0
mirror of https://github.com/zenorogue/hyperrogue.git synced 2025-06-07 00:44:08 +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;
@ -182,6 +183,8 @@ bool readtexture() {
if(x<0 || y<0 || x >= tx || y >= ty) return 0; if(x<0 || y<0 || x >= tx || y >= ty) return 0;
return origpixels[y*tx + x]; return origpixels[y*tx + x];
}; };
printf("texture read OK\n");
#endif #endif
@ -494,10 +497,11 @@ 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;