From 307bb794a8a65f31b2b470f287b6daca1d02faa2 Mon Sep 17 00:00:00 2001 From: Gregory Nutt Date: Fri, 11 Nov 2016 16:54:51 -0600 Subject: [PATCH] tcledit/libwld: Fix a couple of bugs. --- graphics/traveler/tools/libwld/wld_createworld.c | 11 ++++++----- graphics/traveler/tools/libwld/wld_lum2pixel.c | 2 +- graphics/traveler/tools/libwld/wld_rgblookup.c | 5 ++++- 3 files changed, 11 insertions(+), 7 deletions(-) diff --git a/graphics/traveler/tools/libwld/wld_createworld.c b/graphics/traveler/tools/libwld/wld_createworld.c index d6609789d..e4f3832ac 100644 --- a/graphics/traveler/tools/libwld/wld_createworld.c +++ b/graphics/traveler/tools/libwld/wld_createworld.c @@ -219,8 +219,13 @@ static uint8_t wld_manage_worldfile(INIHANDLE handle) inifile_free_string(filename); + /* Create the RGB lookup table */ + + wld_rgblookup_allocate(); + /* Get the name of the file containing the palette table which is used to - * adjust the lighting with distance. */ + * adjust the lighting with distance. + */ result = wld_read_filename(handle, &filename, g_world_section_name, g_world_palette_name); @@ -258,10 +263,6 @@ static uint8_t wld_manage_worldfile(INIHANDLE handle) return WORLD_BITMAP_FILE_NAME_ERROR; } - /* Create the RGB lookup table */ - - wld_rgblookup_allocate(); - /* Then load the bitmaps */ result = wld_initialize_bitmaps(); diff --git a/graphics/traveler/tools/libwld/wld_lum2pixel.c b/graphics/traveler/tools/libwld/wld_lum2pixel.c index 44ad9ac98..623552d54 100644 --- a/graphics/traveler/tools/libwld/wld_lum2pixel.c +++ b/graphics/traveler/tools/libwld/wld_lum2pixel.c @@ -191,7 +191,7 @@ static enum unit_vector_index_e wld_lum2colorform(color_lum_t * lum) * Description: Convert an RGB-Luminance value into a pixel ****************************************************************************/ -wld_pixel_t wld_color_lum2pixel(color_lum_t * lum) +wld_pixel_t wld_lum2pixel(color_lum_t * lum) { #if RGB_CUBE_SIZE < MIN_LUM_LEVELS enum unit_vector_index_e uvndx; diff --git a/graphics/traveler/tools/libwld/wld_rgblookup.c b/graphics/traveler/tools/libwld/wld_rgblookup.c index 3fe6b052e..9eea07cae 100644 --- a/graphics/traveler/tools/libwld/wld_rgblookup.c +++ b/graphics/traveler/tools/libwld/wld_rgblookup.c @@ -58,7 +58,7 @@ ****************************************************************************/ #if RGB_CUBE_SIZE >= MIN_LUM_LEVELS -static color_rgb_t *g_rgb_lut = NULL; +static color_rgb_t *g_rgb_lut; static float g_wld_cube2pixel; #endif @@ -67,6 +67,9 @@ static float g_wld_cube2pixel; ****************************************************************************/ #if RGB_CUBE_SIZE < MIN_LUM_LEVELS +/* Lookup tables */ + +color_rgb_t *g_rgb_lut; color_lum_t *g_lum_lut; /* The following defines the "form" of each color in the g_unit_vector array */