From 3b0941b1904ad945e392690e4ca5c658d3d4a024 Mon Sep 17 00:00:00 2001 From: Magnus Auvinen Date: Sat, 19 Jan 2008 16:23:05 +0000 Subject: fixed so that the client can handle external images --- src/game/client/gc_map_image.cpp | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) (limited to 'src/game/client') diff --git a/src/game/client/gc_map_image.cpp b/src/game/client/gc_map_image.cpp index c2c695ba..174a412e 100644 --- a/src/game/client/gc_map_image.cpp +++ b/src/game/client/gc_map_image.cpp @@ -1,4 +1,5 @@ /* copyright (c) 2007 magnus auvinen, see licence.txt for more info */ +#include #include #include #include @@ -97,7 +98,7 @@ int img_init() if(map_textures[i]) { gfx_unload_texture(map_textures[i]); - map_textures[i] = 0; + map_textures[i] = -1; } } @@ -105,9 +106,19 @@ int img_init() for(int i = 0; i < count; i++) { MAPITEM_IMAGE *img = (MAPITEM_IMAGE *)map_get_item(start+i, 0, 0); - void *data = map_get_data(img->image_data); - map_textures[i] = gfx_load_texture_raw(img->width, img->height, IMG_RGBA, data, IMG_RGBA); - map_unload_data(img->image_data); + if(img->external) + { + char buf[256]; + char *name = (char *)map_get_data(img->image_name); + sprintf(buf, "data/mapres/%s.png", name); + map_textures[i] = gfx_load_texture(buf, IMG_AUTO); + } + else + { + void *data = map_get_data(img->image_data); + map_textures[i] = gfx_load_texture_raw(img->width, img->height, IMG_RGBA, data, IMG_RGBA); + map_unload_data(img->image_data); + } } return count; -- cgit 1.4.1