Minor fixes to the sandbox menu texture creation pipeline

This commit is contained in:
ROllerozxa 2026-03-12 21:13:00 +01:00
commit fbef2313e9
2 changed files with 23 additions and 35 deletions

View file

@ -2547,7 +2547,7 @@ game::create_sandbox_menu()
entity *e = menu_objects[n].e;
char override_path[512];
snprintf(override_path, 512, "../data-src/override/%u.png", e->g_id);
snprintf(override_path, 512, "./data-src/override/%u.png", e->g_id);
if (!file_exists(override_path)) {
cam->width = 2.0f * 1.f/e->menu_scale;
@ -2612,7 +2612,7 @@ game::create_sandbox_menu()
entity *e = menu_objects[n].e;
char override_path[512];
snprintf(override_path, 512, "../data-src/override/%u.png", e->g_id);
snprintf(override_path, 512, "./data-src/override/%u.png", e->g_id);
if (file_exists(override_path)) {
struct tms_texture tex;
@ -2764,10 +2764,11 @@ game::create_sandbox_menu()
tms_assertf(glGetError() == 0, "VAFAN s 4");
tms_infof("Sandbox textures generated successfully. Running ./utils/update-sandbox-menu.sh ...");
system("../utils/update-sandbox-menu.sh");
system("./utils/update-sandbox-menu.sh");
tms_infof("OK!");
exit(0);
return;
#endif
tms_infof("Creating sandbox menu only supported on Linux in DEBUG mode");
}

View file

@ -1,40 +1,27 @@
#!/bin/bash
# This script is used to update the sandbox menu textures. It is automatically run by the game after all the objects
# have been rendered. This script will then process them into the final textures used by the game.
# To begin the process, press S in the main menu on a debug Linux build of the game. You should have gamma correction
# disabled to generate correct colours.
NUM_TEXTURES=10
for ((i = 0; i < $NUM_TEXTURES; i ++)); do
convert sandbox-menu-$i.png tmp.png
#convert tmp.png -colorspace HSB -separate mask.png
convert tmp.png mask.png
convert tmp.png -alpha Off mask.png -compose CopyOpacity -composite PNG32:tmp_alpha.png
convert tmp_alpha.png -background black -shadow 80x3+0+0 tmp_shadow.png
cp sandbox-menu-$i.png tmp.png
cp tmp.png mask.png
magick tmp.png -alpha Off mask.png -compose CopyOpacity -composite PNG32:tmp_alpha.png
magick tmp_alpha.png -background black -shadow 80x3+0+0 tmp_shadow.png
convert tmp_alpha.png tmp_shadow.png -compose DstOver +repage -gravity center +repage -composite tmp_composite.png
convert tmp_composite.png -background 'rgb(54,54,54)' -flatten -alpha Off ../data/textures/sandbox-menu-$i.png
#gimp ../data/textures/sandbox-menu-$i.jpg
magick tmp_alpha.png tmp_shadow.png -compose DstOver +repage -gravity center +repage -composite tmp_composite.png
magick tmp_composite.png -background 'rgb(54,54,54)' -flatten -alpha Off ./data/textures/sandbox-menu-$i.png
rm tmp.png mask.png tmp_alpha.png tmp_shadow.png
rm tmp_composite.png
rm sandbox-menu-$i.png
rm tmp.png mask.png tmp_alpha.png tmp_shadow.png
rm tmp_composite.png
rm sandbox-menu-$i.png
done
#convert items.bmp tmp.png
#convert tmp.png -colorspace HSB -separate mask.png
#convert tmp.png mask.png
#convert tmp.png -alpha Off mask.png -compose CopyOpacity -composite PNG32:tmp_alpha.png
#convert tmp_alpha.png -background black -shadow 80x3+0+0 tmp_shadow.png
#convert tmp_alpha.png tmp_shadow.png -compose DstOver +repage -gravity center +repage -composite tmp_composite.png
#convert tmp_composite.png -background 'rgb(54,54,54)' -flatten -alpha Off ../data/textures/items.jpg
#cp tmp_composite.png ../data/textures/items.png
convert items.png +clone -background black -shadow 100x3+0+0 -composite test.png
convert items.png test.png -compose DstOver +repage -gravity center +repage -composite ../data/textures/menu_items.png
#convert items.png \( +clone -background black -shadow 100x3+0+0 \)\
# -compose DstOver +swap -background none -layers merge -gravity center +repage ../data/textures/items.png
#rm tmp.png mask.png tmp_alpha.png tmp_shadow.png
#rm tmp_composite.png
#rm items.bmp
magick items.png +clone -background black -shadow 100x3+0+0 -composite items_shadow.png
magick items.png items_shadow.png -compose DstOver +repage -gravity center +repage -composite ./data/textures/menu_items.png
rm items.png items_shadow.png