]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blob - qcsrc/menu/xonotic/dialog_settings_video.qc
Put GameLogInit() code in there instead of in spawnfunc(worldspawn)
[xonotic/xonotic-data.pk3dir.git] / qcsrc / menu / xonotic / dialog_settings_video.qc
1 #include "dialog_settings_video.qh"
2
3 #include "commandbutton.qh"
4 #include "textlabel.qh"
5 #include "textslider.qh"
6 #include "checkbox.qh"
7 #include "slider.qh"
8 #include "slider_resolution.qh"
9 #include "radiobutton.qh"
10
11 entity makeXonoticVideoSettingsTab()
12 {
13         entity me;
14         me = NEW(XonoticVideoSettingsTab);
15         me.configureDialog(me);
16         return me;
17 }
18 void XonoticVideoSettingsTab_fill(entity me)
19 {
20         entity e;
21         entity videoApplyButton = makeXonoticCommandButton(_("Apply immediately"), '0 0 0',
22                 "vid_width $_menu_vid_width;"
23                 "vid_height $_menu_vid_height;"
24                 "vid_pixelheight $_menu_vid_pixelheight;"
25                 "vid_desktopfullscreen $_menu_vid_desktopfullscreen;"
26                 "menu_cmd update_conwidths_before_vid_restart;"
27                 "vid_restart;"
28                 "menu_cmd sync;"
29                 , COMMANDBUTTON_APPLY);
30         videoApplyButton.disableOnClick = true;
31
32         me.TR(me);
33                 me.TD(me, 1, 1, e = makeXonoticTextLabel(0, _("Resolution:")));
34                 me.TD(me, 1, 2, e = makeXonoticResolutionSlider());
35                         e.applyButton = videoApplyButton;
36         me.TR(me);
37                 me.TD(me, 1, 1, e = makeXonoticTextLabel(0, _("Font/UI size:")));
38                 me.TD(me, 1, 2, e = makeXonoticTextSlider("menu_vid_scale"));
39                         e.addValue(e, ZCTX(_("SZ^Unreadable")), "-1");
40                         e.addValue(e, ZCTX(_("SZ^Tiny")), "-0.75");
41                         e.addValue(e, ZCTX(_("SZ^Little")), "-0.5");
42                         e.addValue(e, ZCTX(_("SZ^Small")), "-0.25");
43                         e.addValue(e, ZCTX(_("SZ^Medium")), "0");
44                         e.addValue(e, ZCTX(_("SZ^Large")), "0.25");
45                         e.addValue(e, ZCTX(_("SZ^Huge")), "0.5");
46                         e.addValue(e, ZCTX(_("SZ^Gigantic")), "0.75");
47                         e.addValue(e, ZCTX(_("SZ^Colossal")), "1");
48                         e.configureXonoticTextSliderValues(e);
49                         e.applyButton = videoApplyButton;
50         me.TR(me);
51                 me.TD(me, 1, 1, e = makeXonoticTextLabel(0, _("Color depth:")));
52                 me.TD(me, 1, 2, e = makeXonoticTextSlider_T("vid_bitsperpixel",
53                         _("How many bits per pixel (BPP) to render at, 32 is recommended")));
54                         e.addValue(e, _("16bit"), "16");
55                         e.addValue(e, _("32bit"), "32");
56                         e.configureXonoticTextSliderValues(e);
57                         e.applyButton = videoApplyButton;
58         me.TR(me);
59                 me.TD(me, 1, 1, e = makeXonoticCheckBox(0, "vid_fullscreen", _("Full screen")));
60                         e.applyButton = videoApplyButton;
61                 me.TD(me, 1, 2, e = makeXonoticCheckBox_T(0, "vid_vsync", _("Vertical Synchronization"),
62                         _("Vsync prevents tearing, but increases latency and caps your fps at the screen refresh rate")));
63         me.TR(me);
64                 me.TD(me, 1, 3, e = makeXonoticCheckBoxEx(2, 0, "r_viewfbo", _("High-quality frame buffer")));
65                 if(cvar_type("vid_gl20") & CVAR_TYPEFLAG_ENGINE)
66                         setDependent(e, "vid_samples", 0, 1);
67
68         me.TR(me);
69         me.TR(me);
70         if(cvar_type("vid_gl20") & CVAR_TYPEFLAG_ENGINE)
71         {
72                 me.TD(me, 1, 1, e = makeXonoticTextLabel(0, _("Antialiasing:")));
73                         setDependent(e, "r_viewfbo", 0, 0);
74                 me.TD(me, 1, 2, e = makeXonoticTextSlider_T("vid_samples",
75                         _("Enable antialiasing, which smooths the edges of 3D geometry. Note that it might decrease performance by quite a lot")));
76                         e.addValue(e, ZCTX(_("AA^Disabled")), "1");
77                         e.addValue(e, _("2x"), "2");
78                         e.addValue(e, _("4x"), "4");
79                         e.configureXonoticTextSliderValues(e);
80                         setDependent(e, "r_viewfbo", 0, 0);
81                         e.applyButton = videoApplyButton;
82         }
83         else
84         {
85                 me.TD(me, 1, 1, e = makeXonoticTextLabel(0, _("Resolution scaling:")));
86                 me.TD(me, 1, 2, e = makeXonoticSlider_T(0.5, 2, 0.25, "r_viewscale",
87                         _("Screen or window size multiplier, above 1x does antialiasing, below 1x may help slow GPUs")));
88         }
89         me.TR(me);
90                 me.TD(me, 1, 1, e = makeXonoticTextLabel(0, _("Anisotropy:")));
91                 me.TD(me, 1, 2, e = makeXonoticTextSlider_T("gl_texture_anisotropy",
92                         _("Anisotropic filtering quality")));
93                         e.addValue(e, ZCTX(_("ANISO^Disabled")), "1");
94                         e.addValue(e, _("2x"), "2");
95                         e.addValue(e, _("4x"), "4");
96                         e.addValue(e, _("8x"), "8");
97                         e.addValue(e, _("16x"), "16");
98                         e.configureXonoticTextSliderValues(e);
99
100         me.TR(me);
101         me.TR(me);
102                 me.TD(me, 1, 1, e = makeXonoticTextLabel(0, _("Depth first:")));
103                 me.TD(me, 1, 2, e = makeXonoticTextSlider_T("r_depthfirst",
104                         _("Eliminate overdraw by rendering a depth-only version of the scene before the normal rendering starts")));
105                         e.addValue(e, ZCTX(_("DF^Disabled")), "0");
106                         e.addValue(e, ZCTX(_("DF^World")), "1");
107                         e.addValue(e, ZCTX(_("DF^All")), "2");
108                         e.configureXonoticTextSliderValues(e);
109
110         me.gotoRC(me, 0, 3.2); me.setFirstColumn(me, me.currentColumn);
111                 me.TD(me, 1, 1, e = makeXonoticTextLabel(0, _("Brightness:")));
112                 me.TD(me, 1, 2, e = makeXonoticSlider_T(0.0, 0.5, 0.02, "v_brightness",
113                         _("Brightness of black")));
114         me.TR(me);
115                 me.TD(me, 1, 1, e = makeXonoticTextLabel(0, _("Contrast:")));
116                 me.TD(me, 1, 2, e = makeXonoticSlider_T(1.0, 3.0, 0.05, "v_contrast",
117                         _("Brightness of white")));
118         me.TR(me);
119                 me.TD(me, 1, 1, e = makeXonoticTextLabel(0, _("Gamma:")));
120                 if(cvar_type("vid_gl20") & CVAR_TYPEFLAG_ENGINE)
121                         setDependent(e, "vid_gl20", 1, 1);
122                 me.TD(me, 1, 2, e = makeXonoticSlider_T(0.5, 2.0, 0.05, "v_gamma",
123                         _("Inverse gamma correction value, a brightness effect that does not affect white or black")));
124                 if(cvar_type("vid_gl20") & CVAR_TYPEFLAG_ENGINE)
125                         setDependent(e, "vid_gl20", 1, 1);
126         me.TR(me);
127                 me.TD(me, 1, 1, e = makeXonoticTextLabel(0, _("Contrast boost:")));
128                 if(cvar_type("vid_gl20") & CVAR_TYPEFLAG_ENGINE)
129                         setDependent(e, "vid_gl20", 1, 1);
130                 me.TD(me, 1, 2, e = makeXonoticSlider_T(1.0, 5.0, 0.1, "v_contrastboost",
131                         _("By how much to multiply the contrast in dark areas")));
132                 if(cvar_type("vid_gl20") & CVAR_TYPEFLAG_ENGINE)
133                         setDependent(e, "vid_gl20", 1, 1);
134         me.TR(me);
135                 me.TD(me, 1, 1, e = makeXonoticTextLabel(0, _("Saturation:")));
136                 if(cvar_type("vid_gl20") & CVAR_TYPEFLAG_ENGINE)
137                         setDependent(e, "vid_gl20", 1, 1);
138                 me.TD(me, 1, 2, e = makeXonoticSlider_T(0.5, 2.0, 0.05, "r_glsl_saturation",
139                         _("Saturation adjustment (0 = grayscale, 1 = normal, 2 = oversaturated), requires GLSL color control")));
140                 if(cvar_type("vid_gl20") & CVAR_TYPEFLAG_ENGINE)
141                         setDependent(e, "vid_gl20", 1, 1);
142         me.TR(me);
143         me.TR(me);
144                 me.TD(me, 1, 1, e = makeXonoticTextLabel(0, ZCTX(_("LIT^Ambient:"))));
145                 me.TD(me, 1, 2, e = makeXonoticSlider_T(0, 20.0, 0.25, "r_ambient",
146                         _("Ambient lighting, if set too high it tends to make light on maps look dull and flat")));
147         me.TR(me);
148                 me.TD(me, 1, 1, e = makeXonoticTextLabel(0, _("Intensity:")));
149                 me.TD(me, 1, 2, e = makeXonoticSlider_T(0.5, 2.0, 0.05, "r_hdr_scenebrightness",
150                         _("Global rendering brightness")));
151         me.TR(me);
152         me.TR(me);
153                 me.TD(me, 1, 3, e = makeXonoticCheckBox_T(0, "gl_finish", _("Wait for GPU to finish each frame"),
154                         _("Make the CPU wait for the GPU to finish each frame, can help with some strange input or video lag on some machines")));
155         me.TR(me);
156         if(cvar_type("vid_gl20") & CVAR_TYPEFLAG_ENGINE)
157         {
158                 me.TD(me, 1, 3, e = makeXonoticCheckBox(0, "vid_gl20", _("Use OpenGL 2.0 shaders (GLSL)")));
159                         e.applyButton = videoApplyButton;
160         }
161         if(cvar("developer") > 0)
162         {
163                 me.TR(me);
164                         me.TD(me, 1, 3, e = makeXonoticCheckBox_T(0, "v_flipped", _("Flip view horizontally"),
165                                 _("Poor man's left handed mode")));
166                 me.TR(me);
167                         me.TD(me, 1, 3, e = makeXonoticCheckBox(0, "v_psycho", _("Psycho coloring (easter egg)")));
168                         if(cvar_type("vid_gl20") & CVAR_TYPEFLAG_ENGINE)
169                                 setDependent(e, "vid_gl20", 1, 1);
170                 me.TR(me);
171                         me.TD(me, 1, 3, e = makeXonoticCheckBox(0, "r_trippy", _("Trippy vertices (easter egg)")));
172                         if(cvar_type("vid_gl20") & CVAR_TYPEFLAG_ENGINE)
173                                 setDependent(e, "vid_gl20", 1, 1);
174         }
175
176         me.gotoRC(me, me.rows - 1, 0);
177                 me.TD(me, 1, me.columns, videoApplyButton);
178 }