Back to the Vavoom Forum Archives
Firebrand
Index: progs/common/uibase/MenuScreenAdvancedVideoOptions.vc =================================================================== --- progs/common/uibase/MenuScreenAdvancedVideoOptions.vc (revision 4115) +++ progs/common/uibase/MenuScreenAdvancedVideoOptions.vc (working copy) @@ -53,8 +53,24 @@ Enum.ValueChanging = ChangeDarken; currentY += Enum.Height; + Slider = NewChild(MenuChoiceSlider); + Slider.SetOrigin(ChoicesStartX, currentY); + Slider.Text = "Light Fade Factor"; + Slider.ValueDelta = 0.1; + Slider.MaxValue = 2.0; + Slider.SetInitialValue(GetCvarF('r_fade_factor')); + Slider.ValueChanging = ChangeFactor; + currentY += Slider.Height; + Enum = MenuChoiceEnum(NewChild(MenuChoice_OnOff)); Enum.SetOrigin(ChoicesStartX, currentY); + Enum.Text = "Simulate Faded lights"; + Enum.SetInitialValue(GetCvar('r_fade_light')); + Enum.ValueChanging = ChangeFade; + currentY += Enum.Height; + + Enum = MenuChoiceEnum(NewChild(MenuChoice_OnOff)); + Enum.SetOrigin(ChoicesStartX, currentY); Enum.Text = "Extra samples"; Enum.SetInitialValue(GetCvar('r_extrasamples')); Enum.ValueChanging = ChangeExtraSamples; @@ -212,6 +228,30 @@ //========================================================================== // +// ChangeFade +// +//========================================================================== + +bool ChangeFade(Object Sender, int newValue) +{ + SetCvar('r_fade_light', newValue); + return true; +} + +//========================================================================== +// +// ChangeFactor +// +//========================================================================== + +bool ChangeFactor(Object Sender, float newValue) +{ + SetCvarF('r_fade_factor', newValue); + return true; +} + +//========================================================================== +// // ChangeExtraSamples // //========================================================================== Index: source/r_main.cpp =================================================================== --- source/r_main.cpp (revision 4115) +++ source/r_main.cpp (working copy) @@ -73,6 +73,8 @@ VCvarI old_aspect("r_old_aspect_ratio", "1", CVAR_Archive); VCvarI r_interpolate_frames("r_interpolate_frames", "1", CVAR_Archive); VCvarI r_vsync("r_vsync", "1", CVAR_Archive); +VCvarI r_fade_light("r_fade_light", "0", CVAR_Archive); +VCvarF r_fade_factor("r_fade_factor", "0.5", CVAR_Archive); VDrawer *Drawer; @@ -811,7 +813,17 @@ { return 0xff7f7f7f; } - return 0; + // Simulate light fading using dark fog + if (r_fade_light) + { + return (int(255 * r_fade_factor) << 24) | (int(255 * 0.1) << 16) | + (int(255 * 0.1) << 8) | int(255 * 0.1); + + } + else + { + return 0; + } unguard; } Index: source/r_shared.h =================================================================== --- source/r_shared.h (revision 4115) +++ source/r_shared.h (working copy) @@ -166,6 +166,7 @@ extern VCvarF r_fog_end; extern VCvarF r_fog_density; extern VCvarI r_vsync; +extern VCvarI r_fade_light; extern "C" { extern TClipPlane view_clipplanes[5];Let me know if there are any problems (I don't think so).
Janis Legzdinsh
Firebrand
Index: progs/common/uibase/MenuChoiceSlider.vc =================================================================== --- progs/common/uibase/MenuChoiceSlider.vc (revision 4115) +++ progs/common/uibase/MenuChoiceSlider.vc (working copy) @@ -98,13 +98,15 @@ void OnDraw() { int i; - int xx; + int xx, xt; SetTextAlign(hright, vtop); - DrawText(CursorXOffs, 0, Text, IsFocus() ? CR_YELLOW : CR_WHITE); + DrawText(CursorXOffs, 2, Text, IsFocus() ? CR_YELLOW : CR_WHITE); if (pic_M_SLDLT != -1) { + // Increase width because of font size + Width = 382; xx = CursorXOffs; DrawPic(xx, 0, pic_M_SLDLT); xx += 32; @@ -114,8 +116,10 @@ xx += 8; } DrawPic(xx, 0, pic_M_SLDRT); + xt = xx + 8; xx = CursorXOffs + 30 + ftoi((Value - MinValue) * 100.0 / (MaxValue - MinValue)); DrawPic(xx, 7, pic_M_SLDKB); + DrawText(CursorXOffs + 218, 2, va("%f", Value), IsFocus() ? CR_YELLOW : CR_BROWN); } else { @@ -130,6 +134,7 @@ DrawPic(xx, 0, pic_M_THERMR); xx = CursorXOffs + 8 + 6 + ftoi((Value - MinValue) * 100.0 / (MaxValue - MinValue)); DrawPic(xx, 0, pic_M_THERMO); + DrawText(CursorXOffs + 191, 2, va("%f", Value), IsFocus() ? CR_YELLOW : CR_BROWN); } } Index: progs/common/uibase/MenuScreen.vc =================================================================== --- progs/common/uibase/MenuScreen.vc (revision 4115) +++ progs/common/uibase/MenuScreen.vc (working copy) @@ -245,7 +245,7 @@ // OnDraw // // Fade all the screen buffer, so that the menu is more readable, -// especially now that we use the small hufont in the menus... +// especially now that we use the small hudfont in the menus... // //========================================================================== @@ -256,11 +256,11 @@ defaultproperties { - X = 160; + X = 180; Y = 140; - Width = 320; + Width = 360; Height = 200; - TitleX = 160; + TitleX = 180; TitleY = 24; Focusable = true; } Index: progs/common/uibase/MenuScreenAdvancedVideoOptions.vc =================================================================== --- progs/common/uibase/MenuScreenAdvancedVideoOptions.vc (revision 4115) +++ progs/common/uibase/MenuScreenAdvancedVideoOptions.vc (working copy) @@ -1,4 +1,4 @@ -//************************************************************************** +?//************************************************************************** //** //** ## ## ## ## ## #### #### ### ### //** ## ## ## ## ## ## ## ## ## ## #### #### @@ -55,6 +55,23 @@ Enum = MenuChoiceEnum(NewChild(MenuChoice_OnOff)); Enum.SetOrigin(ChoicesStartX, currentY); + Enum.Text = "Simulate Faded lights"; + Enum.SetInitialValue(GetCvar('r_fade_light')); + Enum.ValueChanging = ChangeFade; + currentY += Enum.Height; + + Slider = NewChild(MenuChoiceSlider); + Slider.SetOrigin(ChoicesStartX, currentY); + Slider.Text = "Light Fade Factor"; + Slider.ValueDelta = 1.0; + Slider.MaxValue = 10.0; + Slider.MinValue = 1.0; + Slider.SetInitialValue(GetCvarF('r_fade_factor')); + Slider.ValueChanging = ChangeFactor; + currentY += Slider.Height; + + Enum = MenuChoiceEnum(NewChild(MenuChoice_OnOff)); + Enum.SetOrigin(ChoicesStartX, currentY); Enum.Text = "Extra samples"; Enum.SetInitialValue(GetCvar('r_extrasamples')); Enum.ValueChanging = ChangeExtraSamples; @@ -212,6 +229,30 @@ //========================================================================== // +// ChangeFade +// +//========================================================================== + +bool ChangeFade(Object Sender, int newValue) +{ + SetCvar('r_fade_light', newValue); + return true; +} + +//========================================================================== +// +// ChangeFactor +// +//========================================================================== + +bool ChangeFactor(Object Sender, float newValue) +{ + SetCvarF('r_fade_factor', newValue); + return true; +} + +//========================================================================== +// // ChangeExtraSamples // //========================================================================== @@ -416,7 +457,7 @@ defaultproperties { - Width = 360; + Width = 385; ChoicesStartX = 200; ChoicesStartY = 26; TitleX = 180; Index: progs/common/uibase/MenuScreenVideoOptions.vc =================================================================== --- progs/common/uibase/MenuScreenVideoOptions.vc (revision 4115) +++ progs/common/uibase/MenuScreenVideoOptions.vc (working copy) @@ -280,7 +280,7 @@ defaultproperties { - Width = 360; + Width = 385; ChoicesStartX = 200; ChoicesStartY = 26; SelectorType = MenuSelector_SmallRight; Index: progs/doom/game/Player.vc =================================================================== --- progs/doom/game/Player.vc (revision 4115) +++ progs/doom/game/Player.vc (working copy) @@ -331,7 +331,7 @@ // Powers if (i1 & GIMME_INVULNERABILITY) - EntityEx(MO).GiveInventoryType(PowerInvulnerable); + EntityEx(MO).GiveInventoryType(InvulnerabilitySphere); if (i1 & GIMME_STRENGTH) EntityEx(MO).GiveInventoryType(PowerStrength); if (i1 & GIMME_INVISIBILITY) Index: progs/heretic/cgame/MenuScreenGameplayOptions.vc =================================================================== --- progs/heretic/cgame/MenuScreenGameplayOptions.vc (revision 4115) +++ progs/heretic/cgame/MenuScreenGameplayOptions.vc (working copy) @@ -201,7 +201,6 @@ { ChoicesStartX = 180; ChoicesStartY = 26; - Width = 340; SelectorType = MenuSelector_SmallRight; Title = "GAMEPLAY OPTIONS"; } Index: progs/hexen/cgame/MenuScreenGameplayOptions.vc =================================================================== --- progs/hexen/cgame/MenuScreenGameplayOptions.vc (revision 4115) +++ progs/hexen/cgame/MenuScreenGameplayOptions.vc (working copy) @@ -201,7 +201,6 @@ { ChoicesStartX = 180; ChoicesStartY = 26; - Width = 340; SelectorType = MenuSelector_SmallRight; Title = "GAMEPLAY OPTIONS"; } Index: source/d3d_main.cpp =================================================================== --- source/d3d_main.cpp (revision 4115) +++ source/d3d_main.cpp (working copy) @@ -837,9 +837,18 @@ RenderDevice->SetRenderState(D3DRS_FOGVERTEXMODE, fog_mode[r_fog & 3]); RenderDevice->SetRenderState(D3DRS_FOGCOLOR, NewFade); - RenderDevice->SetRenderState(D3DRS_FOGDENSITY, PassFloat(r_fog_density)); - RenderDevice->SetRenderState(D3DRS_FOGSTART, PassFloat(r_fog_start)); - RenderDevice->SetRenderState(D3DRS_FOGEND, PassFloat(r_fog_end)); + if (NewFade == fade_light) + { + RenderDevice->SetRenderState(D3DRS_FOGDENSITY, PassFloat(0.3)); + RenderDevice->SetRenderState(D3DRS_FOGSTART, PassFloat(1.0)); + RenderDevice->SetRenderState(D3DRS_FOGEND, PassFloat(1024.0 * r_fade_factor)); + } + else + { + RenderDevice->SetRenderState(D3DRS_FOGDENSITY, PassFloat(r_fog_density)); + RenderDevice->SetRenderState(D3DRS_FOGSTART, PassFloat(r_fog_start)); + RenderDevice->SetRenderState(D3DRS_FOGEND, PassFloat(r_fog_end)); + } RenderDevice->SetRenderState(D3DRS_FOGENABLE, TRUE); } else Index: source/gl_main.cpp =================================================================== --- source/gl_main.cpp (revision 4115) +++ source/gl_main.cpp (working copy) @@ -540,10 +540,19 @@ fogColour[3] = float((NewFade >> 24) & 0xff) / 255.0; glFogi(GL_FOG_MODE, fogMode[r_fog & 3]); glFogfv(GL_FOG_COLOR, fogColour); - glFogf(GL_FOG_DENSITY, r_fog_density); + if (NewFade == fade_light) + { + glFogf(GL_FOG_DENSITY, 0.3); + glFogf(GL_FOG_START, 1.0); + glFogf(GL_FOG_END, 1024.0 * r_fade_factor); + } + else + { + glFogf(GL_FOG_DENSITY, r_fog_density); + glFogf(GL_FOG_START, r_fog_start); + glFogf(GL_FOG_END, r_fog_end); + } glHint(GL_FOG_HINT, r_fog < 4 ? GL_DONT_CARE : GL_NICEST); - glFogf(GL_FOG_START, r_fog_start); - glFogf(GL_FOG_END, r_fog_end); glEnable(GL_FOG); } else Index: source/r_local.h =================================================================== --- source/r_local.h (revision 4115) +++ source/r_local.h (working copy) @@ -487,7 +487,6 @@ extern subsector_t* r_viewleaf; extern byte light_remap[256]; -extern VCvarI r_darken; extern refdef_t refdef; Index: source/r_main.cpp =================================================================== --- source/r_main.cpp (revision 4115) +++ source/r_main.cpp (working copy) @@ -73,6 +73,8 @@ VCvarI old_aspect("r_old_aspect_ratio", "1", CVAR_Archive); VCvarI r_interpolate_frames("r_interpolate_frames", "1", CVAR_Archive); VCvarI r_vsync("r_vsync", "1", CVAR_Archive); +VCvarI r_fade_light("r_fade_light", "0", CVAR_Archive); +VCvarF r_fade_factor("r_fade_factor", "3.0", CVAR_Archive); VDrawer *Drawer; @@ -811,7 +813,15 @@ { return 0xff7f7f7f; } - return 0; + if (r_fade_light) + { + // Simulate light fading using dark fog + return fade_light; + } + else + { + return 0; + } unguard; } Index: source/r_shared.h =================================================================== --- source/r_shared.h (revision 4115) +++ source/r_shared.h (working copy) @@ -48,6 +48,9 @@ CM_Max }; +// Simulate light fading using dark fog +const vuint32 fade_light = 0xff010101; + // TYPES ------------------------------------------------------------------- class TClipPlane : public TPlane @@ -165,7 +168,10 @@ extern VCvarF r_fog_start; extern VCvarF r_fog_end; extern VCvarF r_fog_density; +extern VCvarI r_darken; extern VCvarI r_vsync; +extern VCvarI r_fade_light; +extern VCvarF r_fade_factor; extern "C" { extern TClipPlane view_clipplanes[5];
Janis Legzdinsh
and a few other changes to the menu interface, mainly the sliders will now show the value they representDon't do that.
Better change it to enum and make it in capitals.+// Simulate light fading using dark fog +const vuint32 fade_light = 0xff010101;
I don't see any reason why it was moved to r_shared.h+extern VCvarI r_darken;
And there's no reason for these to be here too.+extern VCvarI r_fade_light; +extern VCvarF r_fade_factor;
Firebrand
And there's no reason for these to be here too. They should be there or the code won't compile correctly <!-- s:) --><img src="{SMILIES_PATH}/icon_smile.gif" alt=":)" title="Smile" /><!-- s:) -->. Fixed the remaining ones.+extern VCvarI r_fade_light; +extern VCvarF r_fade_factor;
Index: progs/common/uibase/MenuChoiceSlider.vc =================================================================== --- progs/common/uibase/MenuChoiceSlider.vc (revision 4116) +++ progs/common/uibase/MenuChoiceSlider.vc (working copy) @@ -1,4 +1,4 @@ -//************************************************************************** +?//************************************************************************** //** //** ## ## ## ## ## #### #### ### ### //** ## ## ## ## ## ## ## ## ## ## #### #### @@ -105,8 +105,6 @@ if (pic_M_SLDLT != -1) { - // Increase width because of font size - Width = 382; xx = CursorXOffs; DrawPic(xx, 0, pic_M_SLDLT); xx += 32; @@ -119,7 +117,6 @@ xt = xx + 8; xx = CursorXOffs + 30 + ftoi((Value - MinValue) * 100.0 / (MaxValue - MinValue)); DrawPic(xx, 7, pic_M_SLDKB); - DrawText(CursorXOffs + 218, 2, va("%f", Value), IsFocus() ? CR_YELLOW : CR_BROWN); } else { @@ -134,7 +131,6 @@ DrawPic(xx, 0, pic_M_THERMR); xx = CursorXOffs + 8 + 6 + ftoi((Value - MinValue) * 100.0 / (MaxValue - MinValue)); DrawPic(xx, 0, pic_M_THERMO); - DrawText(CursorXOffs + 191, 2, va("%f", Value), IsFocus() ? CR_YELLOW : CR_BROWN); } } Index: progs/common/uibase/MenuScreen.vc =================================================================== --- progs/common/uibase/MenuScreen.vc (revision 4116) +++ progs/common/uibase/MenuScreen.vc (working copy) @@ -1,4 +1,4 @@ -//************************************************************************** +?//************************************************************************** //** //** ## ## ## ## ## #### #### ### ### //** ## ## ## ## ## ## ## ## ## ## #### #### @@ -256,11 +256,11 @@ defaultproperties { - X = 180; + X = 160; Y = 140; - Width = 360; + Width = 320; Height = 200; - TitleX = 180; + TitleX = 160; TitleY = 24; Focusable = true; } Index: progs/common/uibase/MenuScreenAdvancedVideoOptions.vc =================================================================== --- progs/common/uibase/MenuScreenAdvancedVideoOptions.vc (revision 4116) +++ progs/common/uibase/MenuScreenAdvancedVideoOptions.vc (working copy) @@ -457,7 +457,7 @@ defaultproperties { - Width = 385; + Width = 360; ChoicesStartX = 200; ChoicesStartY = 26; TitleX = 180; Index: progs/common/uibase/MenuScreenVideoOptions.vc =================================================================== --- progs/common/uibase/MenuScreenVideoOptions.vc (revision 4116) +++ progs/common/uibase/MenuScreenVideoOptions.vc (working copy) @@ -1,4 +1,4 @@ -//************************************************************************** +?//************************************************************************** //** //** ## ## ## ## ## #### #### ### ### //** ## ## ## ## ## ## ## ## ## ## #### #### @@ -280,7 +280,7 @@ defaultproperties { - Width = 385; + Width = 360; ChoicesStartX = 200; ChoicesStartY = 26; SelectorType = MenuSelector_SmallRight; Index: progs/heretic/cgame/MenuScreenGameplayOptions.vc =================================================================== --- progs/heretic/cgame/MenuScreenGameplayOptions.vc (revision 4116) +++ progs/heretic/cgame/MenuScreenGameplayOptions.vc (working copy) @@ -1,4 +1,4 @@ -//************************************************************************** +?//************************************************************************** //** //** ## ## ## ## ## #### #### ### ### //** ## ## ## ## ## ## ## ## ## ## #### #### @@ -201,6 +201,7 @@ { ChoicesStartX = 180; ChoicesStartY = 26; + Width = 340; SelectorType = MenuSelector_SmallRight; Title = "GAMEPLAY OPTIONS"; } Index: progs/hexen/cgame/MenuScreenGameplayOptions.vc =================================================================== --- progs/hexen/cgame/MenuScreenGameplayOptions.vc (revision 4116) +++ progs/hexen/cgame/MenuScreenGameplayOptions.vc (working copy) @@ -1,4 +1,4 @@ -//************************************************************************** +?//************************************************************************** //** //** ## ## ## ## ## #### #### ### ### //** ## ## ## ## ## ## ## ## ## ## #### #### @@ -201,6 +201,7 @@ { ChoicesStartX = 180; ChoicesStartY = 26; + Width = 340; SelectorType = MenuSelector_SmallRight; Title = "GAMEPLAY OPTIONS"; } Index: source/d3d_main.cpp =================================================================== --- source/d3d_main.cpp (revision 4116) +++ source/d3d_main.cpp (working copy) @@ -837,7 +837,7 @@ RenderDevice->SetRenderState(D3DRS_FOGVERTEXMODE, fog_mode[r_fog & 3]); RenderDevice->SetRenderState(D3DRS_FOGCOLOR, NewFade); - if (NewFade == fade_light) + if (NewFade == FADE_LIGHT) { RenderDevice->SetRenderState(D3DRS_FOGDENSITY, PassFloat(0.3)); RenderDevice->SetRenderState(D3DRS_FOGSTART, PassFloat(1.0)); Index: source/gl_main.cpp =================================================================== --- source/gl_main.cpp (revision 4116) +++ source/gl_main.cpp (working copy) @@ -540,7 +540,7 @@ fogColour[3] = float((NewFade >> 24) & 0xff) / 255.0; glFogi(GL_FOG_MODE, fogMode[r_fog & 3]); glFogfv(GL_FOG_COLOR, fogColour); - if (NewFade == fade_light) + if (NewFade == FADE_LIGHT) { glFogf(GL_FOG_DENSITY, 0.3); glFogf(GL_FOG_START, 1.0); Index: source/r_local.h =================================================================== --- source/r_local.h (revision 4116) +++ source/r_local.h (working copy) @@ -1,4 +1,4 @@ -//************************************************************************** +?//************************************************************************** //** //** ## ## ## ## ## #### #### ### ### //** ## ## ## ## ## ## ## ## ## ## #### #### @@ -487,6 +487,7 @@ extern subsector_t* r_viewleaf; extern byte light_remap[256]; +extern VCvarI r_darken; extern refdef_t refdef; Index: source/r_main.cpp =================================================================== --- source/r_main.cpp (revision 4116) +++ source/r_main.cpp (working copy) @@ -1,4 +1,4 @@ -//************************************************************************** +?//************************************************************************** //** //** ## ## ## ## ## #### #### ### ### //** ## ## ## ## ## ## ## ## ## ## #### #### @@ -816,7 +816,7 @@ if (r_fade_light) { // Simulate light fading using dark fog - return fade_light; + return FADE_LIGHT; } else { Index: source/r_shared.h =================================================================== --- source/r_shared.h (revision 4116) +++ source/r_shared.h (working copy) @@ -1,4 +1,4 @@ -//************************************************************************** +?//************************************************************************** //** //** ## ## ## ## ## #### #### ### ### //** ## ## ## ## ## ## ## ## ## ## #### #### @@ -49,7 +49,10 @@ }; // Simulate light fading using dark fog -const vuint32 fade_light = 0xff010101; +enum +{ + FADE_LIGHT = 0xff010101 +}; // TYPES ------------------------------------------------------------------- @@ -168,8 +171,9 @@ extern VCvarF r_fog_start; extern VCvarF r_fog_end; extern VCvarF r_fog_density; -extern VCvarI r_darken; + extern VCvarI r_vsync; + extern VCvarI r_fade_light; extern VCvarF r_fade_factor;
Janis Legzdinsh