]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blob - qcsrc/menu/xonotic/dialog_settings_effects.qc
Merge branch 'master' into mirio/balance
[xonotic/xonotic-data.pk3dir.git] / qcsrc / menu / xonotic / dialog_settings_effects.qc
1 #ifndef DIALOG_SETTINGS_EFFECTS_H
2 #define DIALOG_SETTINGS_EFFECTS_H
3 #include "tab.qc"
4 CLASS(XonoticEffectsSettingsTab, XonoticTab)
5         METHOD(XonoticEffectsSettingsTab, fill, void(entity));
6         ATTRIB(XonoticEffectsSettingsTab, intendedWidth, float, 0.9)
7         ATTRIB(XonoticEffectsSettingsTab, rows, float, 15.5)
8         ATTRIB(XonoticEffectsSettingsTab, columns, float, 6.2) // added extra .2 for center space
9 ENDCLASS(XonoticEffectsSettingsTab)
10 entity makeXonoticEffectsSettingsTab();
11 #endif
12
13 #ifdef IMPLEMENTATION
14 entity makeXonoticEffectsSettingsTab()
15 {
16         entity me;
17         me = NEW(XonoticEffectsSettingsTab);
18         me.configureDialog(me);
19         return me;
20 }
21
22 float someShadowCvarIsEnabled(entity box)
23 {
24         if(cvar("r_shadow_realtime_dlight"))
25                 if(cvar("r_shadow_realtime_dlight_shadows"))
26                         return true;
27         if(cvar("r_shadow_realtime_world"))
28                 if(cvar("r_shadow_realtime_world_shadows"))
29                         return true;
30         return false;
31 }
32
33 void XonoticEffectsSettingsTab_fill(entity me)
34 {
35         entity e, s;
36         entity effectsApplyButton = makeXonoticCommandButton(_("Apply immediately"), '0 0 0', "vid_restart", COMMANDBUTTON_APPLY);
37         effectsApplyButton.disableOnClick = true;
38         float n;
39         me.TR(me);
40                 me.TD(me, 1, 1, e = makeXonoticTextLabel(0, _("Quality preset:")));
41                 n = 5 + 2 * boolean(cvar("developer"));
42                 if(cvar("developer"))
43                 {
44                         me.TD(me, 1, 5 / n, e = makeXonoticCommandButton(ZCTX(_("PRE^OMG!")), '1 0 1', "exec effects-omg.cfg", 0));
45                                 e.applyButton = effectsApplyButton;
46                 }
47                 me.TD(me, 1, 5 / n, e = makeXonoticCommandButton(ZCTX(_("PRE^Low")), '0 0 0', "exec effects-low.cfg", 0));
48                         e.applyButton = effectsApplyButton;
49                 me.TD(me, 1, 5 / n, e = makeXonoticCommandButton(ZCTX(_("PRE^Medium")), '0 0 0', "exec effects-med.cfg", 0));
50                         e.applyButton = effectsApplyButton;
51                 me.TD(me, 1, 5 / n, e = makeXonoticCommandButton(ZCTX(_("PRE^Normal")), '0 0 0', "exec effects-normal.cfg", 0));
52                         e.applyButton = effectsApplyButton;
53                 me.TD(me, 1, 5 / n, e = makeXonoticCommandButton(ZCTX(_("PRE^High")), '0 0 0', "exec effects-high.cfg", 0));
54                         e.applyButton = effectsApplyButton;
55                 me.TD(me, 1, 5 / n, e = makeXonoticCommandButton(ZCTX(_("PRE^Ultra")), '0 0 0', "exec effects-ultra.cfg", 0));
56                         e.applyButton = effectsApplyButton;
57                 if(cvar("developer"))
58                 {
59                         me.TD(me, 1, 5 / n, e = makeXonoticCommandButton(ZCTX(_("PRE^Ultimate")), '0.5 0 0', "exec effects-ultimate.cfg", 0));
60                                 e.applyButton = effectsApplyButton;
61                 }
62
63         me.gotoRC(me, 1.25, 0);
64                 me.TD(me, 1, 1, e = makeXonoticTextLabel(0, _("Geometry detail:")));
65                 me.TD(me, 1, 2, e = makeXonoticTextSlider_T("r_subdivisions_tolerance",
66                         _("Change the smoothness of the curves on the map (default: normal)")));
67                         e.addValue(e, ZCTX(_("DET^Lowest")), "16");
68                         e.addValue(e, ZCTX(_("DET^Low")), "8");
69                         e.addValue(e, ZCTX(_("DET^Normal")), "4");
70                         e.addValue(e, ZCTX(_("DET^Good")), "3");
71                         e.addValue(e, ZCTX(_("DET^Best")), "2");
72                         e.addValue(e, ZCTX(_("DET^Insane")), "1");
73                         e.configureXonoticTextSliderValues(e);
74                         e.applyButton = effectsApplyButton;
75         me.TR(me);
76                 me.TD(me, 1, 1, e = makeXonoticTextLabel(0, _("Player detail:")));
77                 me.TD(me, 1, 2, e = makeXonoticTextSlider("cl_playerdetailreduction"));
78                         e.addValue(e, ZCTX(_("PDET^Low")), "4");
79                         e.addValue(e, ZCTX(_("PDET^Medium")), "3");
80                         e.addValue(e, ZCTX(_("PDET^Normal")), "2");
81                         e.addValue(e, ZCTX(_("PDET^Good")), "1");
82                         e.addValue(e, ZCTX(_("PDET^Best")), "0");
83                         e.configureXonoticTextSliderValues(e);
84                         e.applyButton = effectsApplyButton;
85         me.TR(me);
86                 me.TD(me, 1, 1, e = makeXonoticTextLabel(0, _("Texture resolution:")));
87                         setDependent(e, "r_showsurfaces", 0, 0);
88                 me.TD(me, 1, 2, e = makeXonoticPicmipSlider());
89                         if(cvar("developer"))
90                                 e.addValue(e, ZCTX(_("RES^Leet")), "1337");
91                         e.addValue(e, ZCTX(_("RES^Lowest")), "3");
92                         e.addValue(e, ZCTX(_("RES^Very low")), "2");
93                         e.addValue(e, ZCTX(_("RES^Low")), "1");
94                         e.addValue(e, ZCTX(_("RES^Normal")), "0");
95                         e.addValue(e, ZCTX(_("RES^Good")), "-1");
96                         e.addValue(e, ZCTX(_("RES^Best")), "-2");
97                         e.configureXonoticTextSliderValues(e);
98                         setDependent(e, "r_showsurfaces", 0, 0);
99                         e.applyButton = effectsApplyButton;
100         me.TR(me);
101                 me.TDempty(me, 0.2);
102                 {
103                         // detect texture compression method
104                         float f;
105                         f = updateCompression();
106                         switch(f)
107                         {
108                                 case 0:
109                                         me.TD(me, 1, 2.8, e = makeXonoticCheckBox(1, "r_texture_dds_load", _("Avoid lossy texture compression")));
110                                                 e.disabled = 1; // just show the checkbox anyway, but with no ability to control it
111                                                 e.applyButton = effectsApplyButton;
112                                         break;
113                                 case 1:
114                                         me.TD(me, 1, 2.8, e = makeXonoticCheckBox(1, "r_texture_dds_load", _("Avoid lossy texture compression")));
115                                                 setDependent(e, "r_showsurfaces", 0, 0);
116                                                 e.applyButton = effectsApplyButton;
117                                         break;
118                                 case 2:
119                                         me.TD(me, 1, 2.8, e = makeXonoticCheckBox(1, "r_texture_dds_load", _("Avoid lossy texture compression")));
120                                                 setDependent(e, "r_showsurfaces", 0, 0);
121                                                 makeMulti(e, "gl_texturecompression");
122                                                 e.applyButton = effectsApplyButton;
123                                         break;
124                         }
125                 }
126         me.TR(me);
127                 if(cvar("developer"))
128                 {
129                         me.TDempty(me, 0.2);
130                         me.TD(me, 1, 2.8, e = makeXonoticCheckBoxEx_T(3, 0, "r_showsurfaces", _("Show surfaces"),
131                                 _("Disable textures completely for very slow hardware. This gives a huge performance boost, but looks very ugly. (default: disabled)")));
132                 }
133         me.TR(me);
134                 me.TD(me, 1, 1, e = makeXonoticCheckBox_T(1, "mod_q3bsp_nolightmaps", _("Use lightmaps"),
135                         _("Use high resolution lightmaps, which will look pretty but use up some extra video memory (default: enabled)")));
136                 me.TD(me, 1, 1, e = makeXonoticCheckBox_T(0, "r_glsl_deluxemapping", _("Deluxe mapping"),
137                         _("Use per-pixel lighting effects (default: enabled)")));
138                         setDependentAND(e, "vid_gl20", 1, 1, "mod_q3bsp_nolightmaps", 0, 0);
139                 me.TD(me, 1, 1, e = makeXonoticCheckBox_T(0, "r_shadow_gloss", _("Gloss"),
140                         _("Enable the use of glossmaps on textures supporting it (default: enabled)")));
141                         setDependentAND3(e, "vid_gl20", 1, 1, "mod_q3bsp_nolightmaps", 0, 0, "r_glsl_deluxemapping", 1, 1);
142         me.TR(me);
143                 me.TD(me, 1, 1, e = makeXonoticCheckBox_T(0, "r_glsl_offsetmapping", _("Offset mapping"),
144                         _("Offset mapping effect that will make textures with bumpmaps appear like they \"pop out\" of the flat 2D surface (default: disabled)")));
145                         setDependent(e, "vid_gl20", 1, 1);
146                 me.TD(me, 1, 1, e = makeXonoticCheckBox_T(0, "r_glsl_offsetmapping_reliefmapping", _("Relief mapping"),
147                         _("Higher quality offset mapping, which also has a huge impact on performance (default: disabled)")));
148                         setDependentAND(e, "vid_gl20", 1, 1, "r_glsl_offsetmapping", 1, 1);
149         me.TR(me);
150                 me.TD(me, 1, 1, e = makeXonoticCheckBox_T(0, "r_water", _("Reflections:"),
151                         _("Reflection and refraction quality, has a huge impact on performance on maps with reflecting surfaces (default: disabled)")));
152                         setDependent(e, "vid_gl20", 1, 1);
153                 me.TD(me, 1, 2, e = makeXonoticTextSlider_T("r_water_resolutionmultiplier",
154                         _("Resolution of reflections/refractions (default: good)")));
155                         e.addValue(e, _("Blurred"), "0.25");
156                         e.addValue(e, ZCTX(_("REFL^Good")), "0.5");
157                         e.addValue(e, _("Sharp"), "1");
158                         e.configureXonoticTextSliderValues(e);
159                         setDependentAND(e, "vid_gl20", 1, 1, "r_water", 1, 1);
160         me.TR(me);
161                 me.TD(me, 1, 1, e = makeXonoticCheckBox_T(0, "cl_decals", _("Decals"),
162                         _("Enable decals (bullet holes and blood) (default: enabled)")));
163                 me.TD(me, 1, 2, e = makeXonoticCheckBox(0, "cl_decals_models", _("Decals on models")));
164                         setDependent(e, "cl_decals", 1, 1);
165         me.TR(me);
166                 me.TDempty(me, 0.2);
167                 me.TD(me, 1, 0.8, e = makeXonoticTextLabel(0, _("Distance:")));
168                         setDependent(e, "cl_decals", 1, 1);
169                 me.TD(me, 1, 2, e = makeXonoticSlider_T(200, 500, 20, "r_drawdecals_drawdistance",
170                         _("Decals further away than this will not be drawn (default: 300)")));
171                         setDependent(e, "cl_decals", 1, 1);
172         me.TR(me);
173                 me.TDempty(me, 0.2);
174                 me.TD(me, 1, 0.8, e = makeXonoticTextLabel(0, _("Time:")));
175                         setDependent(e, "cl_decals", 1, 1);
176                 me.TD(me, 1, 2, e = makeXonoticSlider_T(1, 20, 1, "cl_decals_fadetime",
177                         _("Time in seconds before decals fade away (default: 2)")));
178                         setDependent(e, "cl_decals", 1, 1);
179         me.TR(me);
180                 me.TDempty(me, 0.2);
181                 me.TD(me, 1, 0.8, e = makeXonoticTextLabel(0, _("Damage effects:")));
182                 me.TD(me, 1, 2, e = makeXonoticTextSlider("cl_damageeffect"));
183                         e.addValue(e, ZCTX(_("DMGFX^Disabled")), "0");
184                         e.addValue(e, _("Skeletal"), "1");
185                         e.addValue(e, ZCTX(_("DMGFX^All")), "2");
186                         e.configureXonoticTextSliderValues(e);
187
188         me.gotoRC(me, 1.25, 3.2); me.setFirstColumn(me, me.currentColumn);
189                 me.TD(me, 1, 3, e = makeXonoticRadioButton_T(1, "r_coronas", "0", _("No dynamic lighting"),
190                         _("Enable corona flares around certain lights (default: enabled)")));
191         me.TR(me);
192                 me.TD(me, 1, 3, e = makeXonoticRadioButton_T(1, "gl_flashblend", string_null, _("Fake corona lighting"),
193                         _("Enable faster but uglier dynamic lights by rendering bright coronas instead of real dynamic lights (default: disabled)")));
194                 makeMulti(e, "r_coronas");
195         me.TR(me);
196                 me.TD(me, 1, 2, e = makeXonoticRadioButton_T(1, "r_shadow_realtime_dlight", string_null, _("Realtime dynamic lighting"),
197                         _("Enable rendering of dynamic lights such as explosions and rocket lights (default: enabled)")));
198                 makeMulti(e, "r_coronas");
199                 me.TD(me, 1, 1, e = makeXonoticCheckBox_T(0, "r_shadow_realtime_dlight_shadows", _("Shadows"),
200                         _("Enable rendering of shadows from dynamic lights (default: disabled)")));
201                         setDependent(e, "r_shadow_realtime_dlight", 1, 1);
202         me.TR(me);
203                 me.TD(me, 1, 2, e = makeXonoticCheckBox_T(0, "r_shadow_realtime_world", _("Realtime world lighting"),
204                         _("Enable rendering of full realtime world lighting on maps that support it. Note that this might have a big impact on performance. (default: disabled)")));
205                 me.TD(me, 1, 1, e = makeXonoticCheckBox_T(0, "r_shadow_realtime_world_shadows", _("Shadows"),
206                         _("Enable rendering of shadows from realtime world lights (default: disabled)")));
207                         setDependent(e, "r_shadow_realtime_world", 1, 1);
208         me.TR(me);
209                 me.TDempty(me, 0.2);
210                 me.TD(me, 1, 1.8, e = makeXonoticCheckBox_T(0, "r_shadow_usenormalmap", _("Use normal maps"),
211                         _("Enable use of directional shading on textures (default: enabled)")));
212                         setDependentOR(e, "r_shadow_realtime_dlight", 1, 1, "r_shadow_realtime_world", 1, 1);
213                 me.TD(me, 1, 1, e = makeXonoticCheckBox(0, "r_shadow_shadowmapping", _("Soft shadows")));
214                         setDependentWeird(e, someShadowCvarIsEnabled);
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 corona according to visibility"),
218                         _("Fade coronas according to visibility (default: enabled)")));
219                         setDependent(e, "r_coronas", 1, 1);
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. (default: disabled)")));
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 (default: disabled)")));
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 = makeXonoticParticlesSlider());
247                         setDependent(e, "cl_particles", 1, 1);
248         me.TR(me);
249                 me.TDempty(me, 0.2);
250                 me.TD(me, 1, 0.8, e = makeXonoticTextLabel(0, _("Distance:")));
251                         setDependent(e, "cl_particles", 1, 1);
252                 me.TD(me, 1, 2, e = makeXonoticSlider_T(200, 500, 20, "r_drawparticles_drawdistance",
253                         _("Particles further away than this will not be drawn (default: 1000)")));
254                         setDependent(e, "cl_particles", 1, 1);
255
256         me.gotoRC(me, me.rows - 1, 0);
257                 me.TD(me, 1, me.columns, effectsApplyButton);
258 }
259 #endif