diff --git a/neo/tools/radiant/EditorEntity.cpp b/neo/tools/radiant/EditorEntity.cpp index be88b4c0..366429b0 100644 --- a/neo/tools/radiant/EditorEntity.cpp +++ b/neo/tools/radiant/EditorEntity.cpp @@ -613,6 +613,11 @@ entity_t *Entity_PostParse(entity_t *ent, brush_t *pList) { } if (e->nShowFlags & ECLASS_WORLDSPAWN) { + // DG: this makes sure that tr.allowNoSpecular is set appropriately when loading a map + const char* noSpecVal = ValueForKey(ent, "allow_nospecular"); + tr.allowNoSpecular = noSpecVal && *noSpecVal && atoi(noSpecVal) != 0; + common->Printf("This map does%s support 'nospecular' lights\n", tr.allowNoSpecular ? "" : " not"); + ent->origin.Zero(); needsOrigin = false; ent->epairs.Delete( "model" ); diff --git a/neo/tools/radiant/EditorMap.cpp b/neo/tools/radiant/EditorMap.cpp index 63946f6e..1f4ff10d 100644 --- a/neo/tools/radiant/EditorMap.cpp +++ b/neo/tools/radiant/EditorMap.cpp @@ -435,6 +435,11 @@ void Map_LoadFile(const char *filename) { common->Printf( "Map_LoadFile: %s\n", fileStr.c_str() ); + // DG: make sure that this is set to the default value. + // it's changed when Entity_PostParse() is called with the worldspawn + // and the worldspawn has "allow_nospecular" "1" set + tr.allowNoSpecular = false; + Map_Free(); g_qeglobals.d_parsed_brushes = 0; @@ -811,6 +816,9 @@ void Map_New(void) { SetKeyValue(world_entity, "classname", "worldspawn"); world_entity->eclass = Eclass_ForName("worldspawn", true); + // DG: make sure this is (re) set to the default value when creating a new map + tr.allowNoSpecular = false; + g_pParentWnd->GetCamera()->Camera().angles[YAW] = 0; g_pParentWnd->GetCamera()->Camera().angles[PITCH] = 0; VectorCopy(vec3_origin, g_pParentWnd->GetCamera()->Camera().origin); diff --git a/neo/tools/radiant/EntityDlg.cpp b/neo/tools/radiant/EntityDlg.cpp index 44949b65..ea08cd11 100644 --- a/neo/tools/radiant/EntityDlg.cpp +++ b/neo/tools/radiant/EntityDlg.cpp @@ -485,6 +485,11 @@ void CEntityDlg::DelProp() { Entity_UpdateCurveData( b->owner ); } } else { + // DG: update tr_allowNoSpecular if the user has removed the worldspawn's allow_nospecular value + if ( (editEntity->eclass->nShowFlags & ECLASS_WORLDSPAWN) && stricmp(key, "allow_nospecular") == 0 ) { + tr.allowNoSpecular = false; + } + DeleteKey(editEntity, key); Entity_UpdateCurveData( editEntity ); } @@ -635,6 +640,10 @@ void CEntityDlg::AddProp() { if ( ! ( ( isModel || isOrigin ) && ( editEntity->eclass->nShowFlags & ECLASS_WORLDSPAWN ) ) ) { SetKeyValue(editEntity, Key, Value); } + // DG: update tr_allowNoSpecular if the user has changed the worldspawn's allow_nospecular value + if ( (editEntity->eclass->nShowFlags & ECLASS_WORLDSPAWN) && stricmp(Key, "allow_nospecular") == 0 ) { + tr.allowNoSpecular = !Value.IsEmpty() && atoi(Value) != 0; + } } if ( isModel && !( editEntity->eclass->nShowFlags & ECLASS_WORLDSPAWN ) ) {