idf go on

This commit is contained in:
p.kosyh 2011-04-17 15:33:04 +00:00
parent 5d32ac9a87
commit 98afa4434b
3 changed files with 15 additions and 9 deletions

View file

@ -22,7 +22,8 @@
#include <string.h>
#include "SDL_anigif.h"
#include "util.h"
#include "idf.h"
extern idf_t game_idf;
/* Code from here to end of file has been adapted from XPaint: */
/* +-------------------------------------------------------------------+ */
@ -137,7 +138,7 @@ int AG_LoadGIF( const char* file, AG_Frame* frames, int size, int *loop )
{
int n = 0;
SDL_RWops* src = SDL_RWFromFile( dirpath(file), "rb" );
SDL_RWops* src = RWFromIdf(game_idf, file);
if ( src )
{

View file

@ -761,6 +761,7 @@ cache_t gfx_image_cache(void)
static img_t _gfx_load_image(char *filename, int combined)
{
SDL_RWops *rw;
SDL_Surface *img;
int nr = 0;
filename = strip(filename);
@ -782,13 +783,14 @@ static img_t _gfx_load_image(char *filename, int combined)
anigif_add(agif);
return agif->frames[0].surface;
}
img = IMG_Load(dirpath(filename));
if (!img) {
rw = RWFromIdf(game_idf, filename);
if (!rw || !(img = IMG_Load_RW(rw, 1)))
return NULL;
}
if (img->format->BitsPerPixel == 32) { /* hack for 32 bit BMP :( */
SDL_RWops *rwop;
rwop = SDL_RWFromFile(dirpath(filename), "rb");
rwop = RWFromIdf(game_idf, filename);
if (rwop) {
if (IMG_isBMP(rwop))
SDL_SetAlpha(img, 0, SDL_ALPHA_OPAQUE);

View file

@ -118,14 +118,17 @@ int snd_volume_mus(int vol)
wav_t snd_load_wav(const char *fname)
{
SDL_RWops *rw;
wav_t r;
if (!sound_on)
return NULL;
if (!fname)
if (!fname || !*fname)
return NULL;
r = (wav_t)Mix_LoadWAV(dirpath(fname));
if (!r)
rw = RWFromIdf(game_idf, fname);
if (!rw || !(r = (wav_t)Mix_LoadWAV_RW(rw, 1))) {
fprintf(stderr,"Can't load '%s'.\n", fname);
return NULL;
}
return r;
}