mirror of
https://github.com/dhewm/dhewm3.git
synced 2025-03-21 18:21:08 +00:00
Set tr.allowNoSpecular in DOOMEdit
depending on worldspawn's allow_nospecular
This commit is contained in:
parent
46052a9526
commit
a0d7198dd0
3 changed files with 22 additions and 0 deletions
|
@ -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" );
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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 ) ) {
|
||||
|
|
Loading…
Reference in a new issue