From 253b1aa9cfce1e8b1fc12b74d96a7808f615d783 Mon Sep 17 00:00:00 2001 From: =?utf8?q?C=C3=B4me=20BERNIGAUD?= Date: Fri, 19 Aug 2011 22:55:00 +0200 Subject: [PATCH] Some debug about textures. blackfur.png file from empire campaign is malformed, made me think there was a bug in png loading. --- Source/GameInitDispose.cpp | 3 ++- Source/GameTick.cpp | 3 ++- Source/Menu.cpp | 2 +- Source/OpenGL_Windows.cpp | 9 +++++++-- 4 files changed, 12 insertions(+), 5 deletions(-) diff --git a/Source/GameInitDispose.cpp b/Source/GameInitDispose.cpp index 24edee3..5d6f579 100644 --- a/Source/GameInitDispose.cpp +++ b/Source/GameInitDispose.cpp @@ -496,6 +496,8 @@ void FadeLoadingScreen(float howmuch) } +extern bool cmdline(const char *cmd); + void Game::InitGame() { #if PLATFORM_MACOSX @@ -635,7 +637,6 @@ void Game::InitGame() #if PLATFORM_LINUX int output = -1; - extern bool cmdline(const char *cmd); unsigned char rc = 0; output = OPENAL_OUTPUT_ALSA; // Try alsa first... if (cmdline("forceoss")) // ...but let user override that. diff --git a/Source/GameTick.cpp b/Source/GameTick.cpp index baac306..03c0efd 100644 --- a/Source/GameTick.cpp +++ b/Source/GameTick.cpp @@ -5771,6 +5771,8 @@ void Game::LoadMenu(){ } } +extern SDL_Rect **resolutions; + void MenuTick(){ //menu buttons selected=Menu::getSelected(mousecoordh*640/screenwidth,480-mousecoordv*480/screenheight); @@ -5837,7 +5839,6 @@ void MenuTick(){ bool isCustomResolution,found; switch(selected){ case 0: - extern SDL_Rect **resolutions; isCustomResolution = true; found = false; for(int i = 0; (!found) && (resolutions[i]); i++) { diff --git a/Source/Menu.cpp b/Source/Menu.cpp index 1d8718d..5414049 100644 --- a/Source/Menu.cpp +++ b/Source/Menu.cpp @@ -103,7 +103,7 @@ void Menu::setText(int id,const string& text,int x,int y,int w,int h){ int Menu::getSelected(int mousex, int mousey){ for(vector::iterator it=items.begin();it!=items.end();it++) - if(it->type==MenuItem::BUTTON || it->type==MenuItem::IMAGEBUTTON || it->type==MenuItem::MAPMARKER){ + if(it->type==MenuItem::BUTTON || it->type==MenuItem::IMAGEBUTTON || it->type==MenuItem::MAPMARKER) { int mx=mousex; int my=mousey; if(it->type==MenuItem::MAPMARKER){ diff --git a/Source/OpenGL_Windows.cpp b/Source/OpenGL_Windows.cpp index 1abe2f1..5a5b0f1 100644 --- a/Source/OpenGL_Windows.cpp +++ b/Source/OpenGL_Windows.cpp @@ -896,8 +896,10 @@ static bool load_png(const char *file_name, TGAImageRec &tex) png_byte **row_pointers = NULL; FILE *fp = fopen(file_name, "rb"); - if (fp == NULL) + if (fp == NULL) { + cerr << file_name << " not found" << endl; return(NULL); + } png_ptr = png_create_read_struct(PNG_LIBPNG_VER_STRING, NULL, NULL, NULL); if (png_ptr == NULL) @@ -961,8 +963,11 @@ static bool load_png(const char *file_name, TGAImageRec &tex) tex.sizeY = height; tex.bpp = 32; retval = true; - + png_done: + if(!retval) { + cerr << "There was a problem loading " << file_name << endl; + } png_destroy_read_struct(&png_ptr, &info_ptr, NULL); if (fp) fclose(fp); -- 2.39.5