Skip to content

Commit d7f0051

Browse files
committed
fix clearing a skybox model when it isn't the mission default
The previous way to clear a skybox was to set it to "default", and if the mission had no skybox then it would be cleared. The skybox code can correctly handle the lack of a skybox, but if you pass an empty string to the skybox preloader it fails with a file not found error. This fixes the preloader, and also adds "none" as an explicit no-skybox parameter.
1 parent b326980 commit d7f0051

File tree

2 files changed

+9
-10
lines changed

2 files changed

+9
-10
lines changed

code/parse/sexp.cpp

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -3508,7 +3508,7 @@ int check_sexp_syntax(int node, int return_type, int recursive, int *bad_node, i
35083508
if ( type2 != SEXP_ATOM_STRING )
35093509
return SEXP_CHECK_TYPE_MISMATCH;
35103510

3511-
if ( stricmp(CTEXT(node), NOX("default")) != 0 && !strstr(CTEXT(node), NOX(".pof")) )
3511+
if ( stricmp(CTEXT(node), NOX("default")) != 0 && stricmp(CTEXT(node), NOX("none")) != 0 && !strstr(CTEXT(node), NOX(".pof")) )
35123512
return SEXP_CHECK_INVALID_SKYBOX_NAME;
35133513

35143514
break;
@@ -19141,13 +19141,12 @@ void sexp_set_skybox_model_preload(const char *name)
1914119141
{
1914219142
int i;
1914319143

19144-
if ( !stricmp("default", name) ) {
19145-
// if there isn't a mission skybox model then don't load one
19146-
if ( strlen(The_mission.skybox_model) ) {
19147-
i = model_load( The_mission.skybox_model, 0, nullptr );
19148-
model_page_in_textures( i );
19149-
}
19150-
} else {
19144+
if (!stricmp("default", name)) {
19145+
name = The_mission.skybox_model;
19146+
}
19147+
19148+
// if there isn't a skybox model then don't load one
19149+
if ( strlen(name) && stricmp(name, "none") != 0 ) {
1915119150
i = model_load( name, 0, nullptr );
1915219151
model_page_in_textures( i );
1915319152
}
@@ -36735,7 +36734,7 @@ SCP_vector<sexp_help_struct> Sexp_help = {
3673536734
"\t3-8:\tSet or unset the following skyboxes flags (optional)\r\n"
3673636735
"\t\t\tadd-lighting, no-transparency, add-zbuffer\r\n"
3673736736
"\t\t\tadd-culling, no-glowmaps, force-clamp\r\n\r\n"
36738-
"Note: If the model filename is set to \"default\" with no extension then it will switch to the mission supplied default skybox."
36737+
"Note: If the model filename is set to \"default\" with no extension then it will switch to the mission supplied default skybox. If it is an empty string or \"none\" then it will remove any current skybox."
3673936738
},
3674036739

3674136740
// Goober5000

code/starfield/starfield.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2221,7 +2221,7 @@ void stars_set_background_model(const char *model_name, const char *texture_name
22212221
return;
22222222
}
22232223

2224-
if (model_name != nullptr && *model_name != '\0') {
2224+
if (model_name != nullptr && *model_name != '\0' && stricmp(model_name, "none") != 0) {
22252225
new_model = model_load(model_name, 0, nullptr, -1);
22262226

22272227
if (texture_name != nullptr && *texture_name != '\0') {

0 commit comments

Comments
 (0)