2007-05-22 15:03:32 +00:00
|
|
|
#include <baselib/system.h>
|
2007-05-24 20:54:08 +00:00
|
|
|
#include "../../engine/interface.h"
|
2007-05-22 15:03:32 +00:00
|
|
|
#include "mapres_image.h"
|
2007-05-24 20:54:08 +00:00
|
|
|
#include "../mapres.h"
|
2007-05-22 15:03:32 +00:00
|
|
|
|
|
|
|
static int map_textures[64] = {0};
|
|
|
|
static int count = 0;
|
|
|
|
|
|
|
|
int img_init()
|
|
|
|
{
|
|
|
|
int start, count;
|
|
|
|
map_get_type(MAPRES_IMAGE, &start, &count);
|
|
|
|
dbg_msg("mapres_image", "start=%d count=%d", start, count);
|
|
|
|
for(int i = 0; i < 64; i++)
|
|
|
|
{
|
|
|
|
if(map_textures[i])
|
|
|
|
{
|
|
|
|
gfx_unload_texture(map_textures[i]);
|
|
|
|
map_textures[i] = 0;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
for(int i = 0; i < count; i++)
|
|
|
|
{
|
|
|
|
mapres_image *img = (mapres_image *)map_get_item(start+i, 0, 0);
|
|
|
|
void *data = map_get_data(img->image_data);
|
2007-05-27 00:47:07 +00:00
|
|
|
map_textures[i] = gfx_load_texture_raw(img->width, img->height, IMG_BGRA, data);
|
2007-05-22 15:03:32 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
return count;
|
|
|
|
}
|
|
|
|
|
|
|
|
int img_num()
|
|
|
|
{
|
|
|
|
return count;
|
|
|
|
}
|
|
|
|
|
|
|
|
int img_get(int index)
|
|
|
|
{
|
|
|
|
return map_textures[index];
|
|
|
|
}
|