]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blob - qcsrc/menu/xonotic/dialog_settings_effects.qc
Merge branch 'bones_was_here/lightsettings' into 'master'
[xonotic/xonotic-data.pk3dir.git] / qcsrc / menu / xonotic / dialog_settings_effects.qc
1 #include "dialog_settings_effects.qh"
2
3 #include "slider_picmip.qh"
4 #include "slider_sbfadetime.qh"
5 #include "weaponslist.qh"
6 #include "keybinder.qh"
7 #include "commandbutton.qh"
8 #include "textlabel.qh"
9 #include "checkbox.qh"
10 #include "textslider.qh"
11 #include "slider.qh"
12 #include "radiobutton.qh"
13 #include "checkbox_slider_invalid.qh"
14
15 entity makeXonoticEffectsSettingsTab()
16 {
17         entity me;
18         me = NEW(XonoticEffectsSettingsTab);
19         me.configureDialog(me);
20         return me;
21 }
22
23 float someShadowCvarIsEnabled(entity box)
24 {
25         if(cvar("r_shadow_realtime_dlight"))
26                 if(cvar("r_shadow_realtime_dlight_shadows"))
27                         return true;
28         if(cvar("r_shadow_realtime_world"))
29                 if(cvar("r_shadow_realtime_world_shadows"))
30                         return true;
31         return false;
32 }
33
34 void XonoticEffectsSettingsTab_fill(entity me)
35 {
36         entity e, s;
37         entity effectsApplyButton = makeXonoticCommandButton(_("Apply immediately"), '0 0 0', "vid_restart", COMMANDBUTTON_APPLY);
38         effectsApplyButton.disableOnClick = true;
39         float n;
40         me.TR(me);
41                 me.TD(me, 1, 1, e = makeXonoticTextLabel(0, _("Quality preset:")));
42                 n = 5 + 2 * boolean(cvar("developer") > 0);
43                 if(cvar("developer") > 0)
44                 {
45                         me.TD(me, 1, 5 / n, e = makeXonoticCommandButton(ZCTX(_("PRE^OMG!")), '1 0 1', "exec effects-omg.cfg", 0));
46                                 e.applyButton = effectsApplyButton;
47                 }
48                 me.TD(me, 1, 5 / n, e = makeXonoticCommandButton(ZCTX(_("PRE^Low")), '0 0 0', "exec effects-low.cfg", 0));
49                         e.applyButton = effectsApplyButton;
50                 me.TD(me, 1, 5 / n, e = makeXonoticCommandButton(ZCTX(_("PRE^Medium")), '0 0 0', "exec effects-med.cfg", 0));
51                         e.applyButton = effectsApplyButton;
52                 me.TD(me, 1, 5 / n, e = makeXonoticCommandButton(ZCTX(_("PRE^Normal")), '0 0 0', "exec effects-normal.cfg", 0));
53                         e.applyButton = effectsApplyButton;
54                 me.TD(me, 1, 5 / n, e = makeXonoticCommandButton(ZCTX(_("PRE^High")), '0 0 0', "exec effects-high.cfg", 0));
55                         e.applyButton = effectsApplyButton;
56                 me.TD(me, 1, 5 / n, e = makeXonoticCommandButton(ZCTX(_("PRE^Ultra")), '0 0 0', "exec effects-ultra.cfg", 0));
57                         e.applyButton = effectsApplyButton;
58                 if(cvar("developer") > 0)
59                 {
60                         me.TD(me, 1, 5 / n, e = makeXonoticCommandButton(ZCTX(_("PRE^Ultimate")), '0.5 0 0', "exec effects-ultimate.cfg", 0));
61                                 e.applyButton = effectsApplyButton;
62                 }
63
64         me.gotoRC(me, 1.25, 0);
65                 me.TD(me, 1, 1, e = makeXonoticTextLabel(0, _("Geometry detail:")));
66                 me.TD(me, 1, 2, e = makeXonoticTextSlider_T("r_subdivisions_tolerance",
67                         _("Change the smoothness of the curves on the map")));
68                         e.addValue(e, ZCTX(_("DET^Lowest")), "16");
69                         e.addValue(e, ZCTX(_("DET^Low")), "8");
70                         e.addValue(e, ZCTX(_("DET^Normal")), "4");
71                         e.addValue(e, ZCTX(_("DET^Good")), "3");
72                         e.addValue(e, ZCTX(_("DET^Best")), "2");
73                         e.addValue(e, ZCTX(_("DET^Insane")), "1");
74                         e.configureXonoticTextSliderValues(e);
75                         e.applyButton = effectsApplyButton;
76         me.TR(me);
77                 me.TD(me, 1, 1, e = makeXonoticTextLabel(0, _("Player detail:")));
78                 me.TD(me, 1, 2, e = makeXonoticTextSlider("cl_playerdetailreduction"));
79                         e.addValue(e, ZCTX(_("PDET^Low")), "4");
80                         e.addValue(e, ZCTX(_("PDET^Medium")), "3");
81                         e.addValue(e, ZCTX(_("PDET^Normal")), "2");
82                         e.addValue(e, ZCTX(_("PDET^Good")), "1");
83                         e.addValue(e, ZCTX(_("PDET^Best")), "0");
84                         e.configureXonoticTextSliderValues(e);
85                         e.applyButton = effectsApplyButton;
86         me.TR(me);
87                 me.TD(me, 1, 1, e = makeXonoticTextLabel(0, _("Texture resolution:")));
88                         setDependent(e, "r_showsurfaces", 0, 0);
89                 me.TD(me, 1, 2, e = makeXonoticPicmipSlider());
90                         if(cvar("developer") > 0)
91                                 e.addValue(e, ZCTX(_("RES^Leet")), "1337");
92                         e.addValue(e, ZCTX(_("RES^Lowest")), "3");
93                         e.addValue(e, ZCTX(_("RES^Very low")), "2");
94                         e.addValue(e, ZCTX(_("RES^Low")), "1");
95                         e.addValue(e, ZCTX(_("RES^Normal")), "0");
96                         e.addValue(e, ZCTX(_("RES^Good")), "-1");
97                         e.addValue(e, ZCTX(_("RES^Best")), "-2");
98                         e.configureXonoticTextSliderValues(e);
99                         setDependent(e, "r_showsurfaces", 0, 0);
100                         e.applyButton = effectsApplyButton;
101         me.TR(me);
102                 me.TDempty(me, 0.2);
103                 {
104                         // detect texture compression method
105                         float f;
106                         f = updateCompression();
107                         switch(f)
108                         {
109                                 case 0:
110                                         me.TD(me, 1, 2.8, e = makeXonoticCheckBox(1, "r_texture_dds_load", _("Avoid lossy texture compression")));
111                                                 e.disabled = 1; // just show the checkbox anyway, but with no ability to control it
112                                                 e.applyButton = effectsApplyButton;
113                                         break;
114                                 case 1:
115                                         me.TD(me, 1, 2.8, e = makeXonoticCheckBox(1, "r_texture_dds_load", _("Avoid lossy texture compression")));
116                                                 setDependent(e, "r_showsurfaces", 0, 0);
117                                                 e.applyButton = effectsApplyButton;
118                                         break;
119                                 case 2:
120                                         me.TD(me, 1, 2.8, e = makeXonoticCheckBox(1, "r_texture_dds_load", _("Avoid lossy texture compression")));
121                                                 setDependent(e, "r_showsurfaces", 0, 0);
122                                                 makeMulti(e, "gl_texturecompression");
123                                                 e.applyButton = effectsApplyButton;
124                                         break;
125                         }
126                 }
127         me.TR(me);
128                 me.TDempty(me, 0.2);
129                 me.TD(me, 1, 1, e = makeXonoticCheckBoxEx_T(1, 0, "r_sky", _("Show sky"), _("Disable sky for performance and visibility")));
130                 if(cvar("developer") > 0)
131                 {
132                         me.TD(me, 1, 1, e = makeXonoticCheckBoxEx_T(3, 0, "r_showsurfaces", _("Show surfaces"),
133                                 _("Disable textures completely for very slow hardware. This gives a huge performance boost, but looks very ugly.")));
134                 }
135         me.TR(me);
136                 me.TD(me, 1, 1, e = makeXonoticCheckBox_T(1, "mod_q3bsp_nolightmaps", _("Use lightmaps"),
137                         _("Use high resolution lightmaps, which will look pretty but use up some extra video memory")));
138                         e.applyButton = effectsApplyButton;
139                 me.TD(me, 1, 1, e = makeXonoticCheckBox_T(0, "r_glsl_deluxemapping", _("Deluxe mapping"),
140                         _("Use per-pixel lighting effects")));
141                         setDependentAND(e, "vid_gl20", 1, 1, "mod_q3bsp_nolightmaps", 0, 0);
142                 me.TD(me, 1, 1, e = makeXonoticCheckBox_T(0, "r_shadow_gloss", _("Gloss"),
143                         _("Enable the use of glossmaps on textures supporting it")));
144                         setDependentAND3(e, "vid_gl20", 1, 1, "mod_q3bsp_nolightmaps", 0, 0, "r_glsl_deluxemapping", 1, 1);
145         me.TR(me);
146                 me.TD(me, 1, 1, e = makeXonoticCheckBox_T(0, "r_glsl_offsetmapping", _("Offset mapping"),
147                         _("Offset mapping effect that will make textures with bumpmaps appear like they \"pop out\" of the flat 2D surface")));
148                         setDependent(e, "vid_gl20", 1, 1);
149                 me.TD(me, 1, 1, e = makeXonoticCheckBox_T(0, "r_glsl_offsetmapping_reliefmapping", _("Relief mapping"),
150                         _("Higher quality offset mapping, which also has a huge impact on performance")));
151                         setDependentAND(e, "vid_gl20", 1, 1, "r_glsl_offsetmapping", 1, 1);
152         me.TR(me);
153                 me.TD(me, 1, 1, e = makeXonoticCheckBox_T(0, "r_water", _("Reflections:"),
154                         _("Reflection and refraction quality, has a huge impact on performance on maps with reflecting surfaces")));
155                         setDependent(e, "vid_gl20", 1, 1);
156                 me.TD(me, 1, 2, e = makeXonoticTextSlider_T("r_water_resolutionmultiplier",
157                         _("Resolution of reflections/refractions")));
158                         e.addValue(e, _("Blurred"), "0.25");
159                         e.addValue(e, ZCTX(_("REFL^Good")), "0.5");
160                         e.addValue(e, _("Sharp"), "1");
161                         e.configureXonoticTextSliderValues(e);
162                         setDependentAND(e, "vid_gl20", 1, 1, "r_water", 1, 1);
163         me.TR(me);
164                 me.TD(me, 1, 1, e = makeXonoticCheckBox_T(0, "cl_decals", _("Decals"),
165                         _("Enable decals (bullet holes and blood)")));
166                 me.TD(me, 1, 2, e = makeXonoticCheckBox(0, "cl_decals_models", _("Decals on models")));
167                         setDependent(e, "cl_decals", 1, 1);
168         me.TR(me);
169                 me.TDempty(me, 0.2);
170                 me.TD(me, 1, 0.8, e = makeXonoticTextLabel(0, _("Distance:")));
171                         setDependent(e, "cl_decals", 1, 1);
172                 me.TD(me, 1, 2, e = makeXonoticSlider_T(200, 500, 20, "r_drawdecals_drawdistance",
173                         _("Decals further away than this will not be drawn")));
174                         setDependent(e, "cl_decals", 1, 1);
175         me.TR(me);
176                 me.TDempty(me, 0.2);
177                 me.TD(me, 1, 0.8, e = makeXonoticTextLabel(0, _("Time:")));
178                         setDependent(e, "cl_decals", 1, 1);
179                 me.TD(me, 1, 2, e = makeXonoticSlider_T(1, 20, 1, "cl_decals_fadetime",
180                         _("Time in seconds before decals fade away")));
181                         setDependent(e, "cl_decals", 1, 1);
182         me.TR(me);
183                 me.TDempty(me, 0.2);
184                 me.TD(me, 1, 0.8, e = makeXonoticTextLabel(0, _("Damage effects:")));
185                 me.TD(me, 1, 2, e = makeXonoticTextSlider("cl_damageeffect"));
186                         e.addValue(e, ZCTX(_("DMGFX^Disabled")), "0");
187                         e.addValue(e, _("Skeletal"), "1");
188                         e.addValue(e, ZCTX(_("DMGFX^All")), "2");
189                         e.configureXonoticTextSliderValues(e);
190
191         me.gotoRC(me, 1.25, 3.2); me.setFirstColumn(me, me.currentColumn);
192                 me.TD(me, 1, 2, e = makeXonoticCheckBox_T(0, "r_shadow_realtime_dlight", _("Realtime dynamic lights"),
193                         _("Temporary realtime light sources such as explosions, rockets and powerups")));
194                                 makeMulti(e, "!gl_flashblend");
195                 me.TD(me, 1, 1, e = makeXonoticCheckBox_T(0, "r_shadow_realtime_dlight_shadows", _("Shadows"),
196                         _("Shadows cast by realtime dynamic lights")));
197                         setDependent(e, "r_shadow_realtime_dlight", 1, 1);
198         me.TR(me);
199                 me.TD(me, 1, 2, e = makeXonoticCheckBox_T(0, "r_shadow_realtime_world", _("Realtime world lights"),
200                         _("Realtime light sources included in certain maps. May have a big impact on performance.")));
201                 me.TD(me, 1, 1, e = makeXonoticCheckBox_T(0, "r_shadow_realtime_world_shadows", _("Shadows"),
202                         _("Shadows cast by realtime world lights")));
203                         setDependent(e, "r_shadow_realtime_world", 1, 1);
204         me.TR(me);
205                 me.TDempty(me, 0.2);
206                 me.TD(me, 1, 1.8, e = makeXonoticCheckBox_T(0, "r_shadow_usenormalmap", _("Use normal maps"),
207                         _("Directional shading of certain textures to simulate interaction of realtime light with a bumpy surface")));
208                         setDependentOR(e, "r_shadow_realtime_dlight", 1, 1, "r_shadow_realtime_world", 1, 1);
209                 me.TD(me, 1, 1, e = makeXonoticCheckBox(0, "r_shadow_shadowmapping", _("Soft shadows")));
210                         setDependentWeird(e, someShadowCvarIsEnabled);
211         me.TR(me);
212                 me.TD(me, 1, 1, e = makeXonoticTextLabel(0, _("Corona brightness:")));
213                 me.TD(me, 1, 2, e = makeXonoticSlider_T(0, 1.5, 0.1, "r_coronas",
214                         _("Flare effects around certain lights, default 1")));
215         me.TR(me);
216                 me.TDempty(me, 0.2);
217                 me.TD(me, 1, 2.8, e = makeXonoticCheckBox_T(0, "r_coronas_occlusionquery", _("Fade coronas according to visibility"),
218                         _("Corona fading using occlusion queries")));
219                         setDependent(e, "r_coronas", 0.1, 2);
220         me.TR(me);
221         me.TR(me);
222                 me.TD(me, 1, 1, e = makeXonoticCheckBox_T(0, "r_bloom", _("Bloom"),
223                         _("Enable bloom effect, which brightens the neighboring pixels of very bright pixels. Has a big impact on performance.")));
224                 me.TD(me, 1, 2, e = makeXonoticCheckBoxEx_T(0.5, 0, "hud_postprocessing_maxbluralpha", _("Extra postprocessing effects"),
225                         _("Enables special postprocessing effects for when damaged or under water or using a powerup")));
226                         makeMulti(e, "hud_powerup");
227                         setDependent(e, "vid_gl20", 1, 1);
228         me.TR(me);
229                 s = makeXonoticSlider_T(0.1, 1, 0.1, "r_motionblur",
230                         _("Motion blur strength - 0.4 recommended"));
231                 me.TD(me, 1, 1, e = makeXonoticSliderCheckBox(0, 1, s, _("Motion blur:")));
232                 if(s.value != e.savedValue)
233                         e.savedValue = 0.4; // default
234                 me.TD(me, 1, 2, s);
235         me.TR(me);
236         me.TR(me);
237                 me.TD(me, 1, 1, e = makeXonoticCheckBox(0, "cl_particles", _("Particles")));
238                 me.TD(me, 1, 2, e = makeXonoticCheckBox_T(0, "cl_spawn_point_particles", _("Spawnpoint effects"),
239                         _("Particles effects at all spawn points and whenever a player spawns")));
240                         makeMulti(e, "cl_spawn_event_particles");
241                         setDependent(e, "cl_particles", 1, 1);
242         me.TR(me);
243                 me.TDempty(me, 0.2);
244                 me.TD(me, 1, 0.8, e = makeXonoticTextLabel(0, _("Quality:")));
245                         setDependent(e, "cl_particles", 1, 1);
246                 me.TD(me, 1, 2, e = makeXonoticSlider_T(0, 3.0, 0.25, "cl_particles_quality",
247                         _("Multiplier for amount of particles. Less means less particles, which in turn gives for better performance")));
248                         setDependent(e, "cl_particles", 1, 1);
249         me.TR(me);
250                 me.TDempty(me, 0.2);
251                 me.TD(me, 1, 0.8, e = makeXonoticTextLabel(0, _("Distance:")));
252                         setDependent(e, "cl_particles", 1, 1);
253                 me.TD(me, 1, 2, e = makeXonoticSlider_T(200, 3000, 200, "r_drawparticles_drawdistance",
254                         _("Particles further away than this will not be drawn")));
255                         setDependent(e, "cl_particles", 1, 1);
256
257         me.gotoRC(me, me.rows - 1, 0);
258                 me.TD(me, 1, me.columns, effectsApplyButton);
259 }