Open wookieejedi opened 4 years ago
Looks like envmap_name
is set with a file extension, but then used in bm_load(The_mission.envmap_name);
in fredrender.cpp, which throws the error that the string has a file extension. So I'm thinking a fix would be to just filter out any extensions right before the load.
Should envmap_name ever have an extension at all? I thought map names were usually extension-agnostic so the system could know to load different types of maps, dds, bmp, ani, etc.
You are correct, they should not have an extension. The trouble is that when you select the file in the file select window it forces the extension to be added, then it immediately tries to load it using bm_load()
which causes the crash since that function won't use a string name with an extension attached.
As a follow up it looks like manually setting an environment map works, but causes crashes at mission start, so I guess it's good that FRED doesn't allow it to be set.
We are having trouble reproducing this, so we're not sure that it's still an issue.
I'm switching this to low priority, because even though it was reported to cause a crash, it seems to at least be rare, and is for a rarely used feature.
This is caused by the engine assuming that the specified texture is a cubemap without actually checking, and trying to access faces that aren't actually there without checking, causing a segfault. We just need to add checks for this, probably as part of the envmap overhaul in progress.
Steps to reproduce: 1) Open FRED then open up to the Background editor. 2) Clicking on Environment Map, then selecting a small 512x512 black texture in the maps folder (or anything really), then clicking OK. 3) FRED will crash.
If an environment map is manually specified in the text file and the mission is loaded the mission will also crash.