Skip to content

Commit 7daf79f

Browse files
committed
QC: add some cvar on launcher
1 parent 3f38481 commit 7daf79f

File tree

8 files changed

+180
-1
lines changed

8 files changed

+180
-1
lines changed
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
fix cs16 view motion if vgui visible 3
1+
qc's cvars

idTech4Amm/src/main/java/com/karin/idTech4Amm/lib/KCVarSystem.java

Lines changed: 88 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -387,6 +387,91 @@ public static Map<String, KCVar.Group> CVars()
387387
)
388388
);
389389

390+
391+
KCVar.Group QC_CVARS = new KCVar.Group("QC", true)
392+
.AddCVar(
393+
KCVar.CreateCVar("harm_r_clearVertexBuffer", "integer", "2", "Clear vertex buffer on every frame", KCVar.FLAG_LAUNCHER,
394+
"0", "Not clear(original)",
395+
"1", "Only free memory",
396+
"2", "Free memory and delete VBO handle"
397+
),
398+
KCVar.CreateCVar("harm_r_maxAllocStackMemory", "integer", "262144", "Control allocate temporary memory when load model data. 0 = Always heap; Negative = Always stack; Positive = Max stack memory limit(If less than this `byte` value, call `alloca` in stack memory, else call `malloc`/`calloc` in heap memory)", 0),
399+
KCVar.CreateCVar("harm_r_shaderProgramDir", "string", "glslprogs", "Special external OpenGLES2.0 GLSL shader program directory path", 0),
400+
KCVar.CreateCVar("harm_r_shaderProgramES3Dir", "string", "glsl3progs", "Special external OpenGLES3.0 GLSL shader program directory path", 0),
401+
402+
KCVar.CreateCVar("harm_r_shadowCarmackInverse", "bool", "0", "Stencil shadow using Carmack-Inverse", 0),
403+
KCVar.CreateCVar("harm_r_lightingModel", "string", "1", "Lighting model when draw interactions", KCVar.FLAG_LAUNCHER,
404+
"1", "Phong",
405+
"2", "Blinn-Phong",
406+
"3", "PBR",
407+
"4", "Ambient",
408+
"0", "No lighting"
409+
),
410+
KCVar.CreateCVar("harm_r_specularExponent", "float", "3.0", "Specular exponent in Phong interaction lighting model", KCVar.FLAG_POSITIVE | KCVar.FLAG_LAUNCHER),
411+
KCVar.CreateCVar("harm_r_specularExponentBlinnPhong", "float", "12.0", "Specular exponent in Blinn-Phong interaction lighting model", KCVar.FLAG_POSITIVE | KCVar.FLAG_LAUNCHER),
412+
KCVar.CreateCVar("harm_r_specularExponentPBR", "float", "5.0", "Specular exponent in PBR interaction lighting model", KCVar.FLAG_POSITIVE | KCVar.FLAG_LAUNCHER),
413+
KCVar.CreateCVar("harm_r_PBRNormalCorrection", "float", "0.25", "Vertex normal correction(surface smoothness) in PBR interaction lighting model(1 = pure using bump texture(lower smoothness); 0 = pure using vertex normal(high smoothness); 0.0 - 1.0 = bump texture * harm_r_PBRNormalCorrection + vertex normal * (1 - harm_r_PBRNormalCorrection))", KCVar.FLAG_POSITIVE | KCVar.FLAG_LAUNCHER),
414+
KCVar.CreateCVar("harm_r_PBRRoughnessCorrection", "float", "0.55", "max roughness for old specular texture. 0 = disable; else = roughness = harm_r_PBRRoughnessCorrection - texture(specularTexture, st).r", 0),
415+
KCVar.CreateCVar("harm_r_PBRMetallicCorrection", "float", "0", "min metallic for old specular texture. 0 = disable; else = metallic = texture(specularTexture, st).r + harm_r_PBRMetallicCorrection", 0),
416+
KCVar.CreateCVar("harm_r_PBRRMAOSpecularMap", "bool", "0", "Specular map is standard PBR RAMO texture or old non-PBR texture", 0),
417+
KCVar.CreateCVar("harm_r_ambientLightingBrightness", "float", "1.0", "Lighting brightness in ambient lighting", KCVar.FLAG_POSITIVE | KCVar.FLAG_LAUNCHER),
418+
KCVar.CreateCVar("r_maxFps", "integer", "0", "Limit maximum FPS. 0 = unlimited", KCVar.FLAG_POSITIVE | KCVar.FLAG_LAUNCHER),
419+
420+
KCVar.CreateCVar("r_screenshotFormat", "integer", "0", "Screenshot format", 0,
421+
"0", "TGA (default)",
422+
"1", "BMP",
423+
"2", "PNG",
424+
"3", "JPG",
425+
"4", "DDS",
426+
"5", "EXR",
427+
"6", "HDR"
428+
),
429+
KCVar.CreateCVar("r_screenshotJpgQuality", "integer", "75", "Screenshot quality for JPG images (0-100)", KCVar.FLAG_POSITIVE),
430+
KCVar.CreateCVar("r_screenshotPngCompression", "integer", "3", "Compression level when using PNG screenshots (0-9)", KCVar.FLAG_POSITIVE),
431+
432+
KCVar.CreateCVar("r_useShadowMapping", "bool", "0", "use shadow mapping instead of stencil shadows", KCVar.FLAG_LAUNCHER),
433+
KCVar.CreateCVar("r_forceShadowMapsOnAlphaTestedSurfaces", "bool", "0", "render perforated surface to shadow map(DOOM 3 default is 1)", KCVar.FLAG_LAUNCHER),
434+
KCVar.CreateCVar("harm_r_shadowMapAlpha", "float", "1.0", "Shadow's alpha in shadow mapping", KCVar.FLAG_POSITIVE | KCVar.FLAG_LAUNCHER),
435+
KCVar.CreateCVar("r_shadowMapJitterScale", "float", "2.5", "scale factor for jitter offset", KCVar.FLAG_POSITIVE),
436+
KCVar.CreateCVar("r_shadowMapSplits", "integer", "3", "number of splits for cascaded shadow mapping with parallel lights(0: disable, max is 4)", 0),
437+
KCVar.CreateCVar("harm_r_shadowMapCombine", "bool", "1", "combine local and global shadow mapping", KCVar.FLAG_LAUNCHER),
438+
439+
KCVar.CreateCVar("harm_r_stencilShadowTranslucent", "bool", "0", "enable translucent shadow in stencil shadow", KCVar.FLAG_LAUNCHER),
440+
KCVar.CreateCVar("harm_r_stencilShadowAlpha", "float", "1.0", "translucent shadow's alpha in stencil shadow", KCVar.FLAG_POSITIVE | KCVar.FLAG_LAUNCHER),
441+
KCVar.CreateCVar("harm_r_stencilShadowCombine", "bool", "0", "combine local and global stencil shadow", KCVar.FLAG_LAUNCHER),
442+
KCVar.CreateCVar("harm_r_stencilShadowSoft", "bool", "0", "enable soft stencil shadow(Only OpenGLES3.1+)", KCVar.FLAG_LAUNCHER),
443+
KCVar.CreateCVar("harm_r_stencilShadowSoftBias", "float", "-1", "soft stencil shadow sampler BIAS(-1 = automatic; 0 = disable; positive = value)", 0),
444+
KCVar.CreateCVar("harm_r_stencilShadowSoftCopyStencilBuffer", "bool", "0", "copy stencil buffer directly for soft stencil shadow. 0: copy depth buffer and bind and renderer stencil buffer to texture directly; 1: copy stencil buffer to texture directly", 0),
445+
KCVar.CreateCVar("harm_r_useHighPrecision", "integer", "0", "Use high precision float on GLSL shader", KCVar.FLAG_LAUNCHER | KCVar.FLAG_INIT,
446+
"0", "use default precision(interaction/depth shaders use high precision, otherwise use medium precision)",
447+
"1", "all shaders use high precision as default precision exclude special variables",
448+
"2", "all shaders use high precision as default precision and special variables also use high precision"
449+
),
450+
KCVar.CreateCVar("harm_r_globalIllumination", "bool", "0", "render global illumination before draw lighting interactions", KCVar.FLAG_LAUNCHER),
451+
KCVar.CreateCVar("harm_r_globalIlluminationBrightness", "float", "0.3", "global illumination brightness", KCVar.FLAG_POSITIVE | KCVar.FLAG_LAUNCHER),
452+
KCVar.CreateCVar("r_renderMode", "integer", "0", "Enable retro postprocess rendering", KCVar.FLAG_LAUNCHER,
453+
"0", "None",
454+
"1", "CGA",
455+
"2", "CGA Highres",
456+
"3", "Commodore 64",
457+
"4", "Commodore 64 Highres",
458+
"5", "Amstrad CPC 6128",
459+
"6", "Amstrad CPC 6128 Highres",
460+
"7", "Sega Genesis",
461+
"8", "Sega Genesis Highres",
462+
"9", "Sony PSX"
463+
),
464+
KCVar.CreateCVar("harm_r_useGLSLShaderBinaryCache", "integer", "0", "Use/cache GLSL shader compiled binary(OpenGL ES2.0 not support)", KCVar.FLAG_LAUNCHER,
465+
"1", "Disable",
466+
"2", "Enable(check source)",
467+
"3", "Enable(not check source)"
468+
),
469+
KCVar.CreateCVar("harm_r_openglVersion", "string", "GLES3.0", "OpenGL version", KCVar.FLAG_INIT | KCVar.FLAG_LAUNCHER,
470+
"GLES2", "OpenGL ES2.0",
471+
"GLES3.0", "OpenGL 3.0+"
472+
)
473+
);
474+
390475
_cvars.put("RENDERER", RENDERER_CVARS);
391476
_cvars.put("FRAMEWORK", FRAMEWORK_CVARS);
392477
_cvars.put("base", GAME_CVARS);
@@ -402,6 +487,7 @@ public static Map<String, KCVar.Group> CVars()
402487
_cvars.put("Xash3D", XASH3D_CVARS);
403488
_cvars.put("Source", SOURCE_CVARS);
404489
_cvars.put("SkinDeep", SKINDEEP_CVARS);
490+
_cvars.put("QC", QC_CVARS);
405491

406492
return _cvars;
407493
}
@@ -439,6 +525,8 @@ else if(Q3E.q3ei.isSource)
439525
res.add(_cvars.get("Source"));
440526
else if(Q3E.q3ei.isSkinDeep)
441527
res.add(_cvars.get("SkinDeep"));
528+
else if(Q3E.q3ei.isQC)
529+
res.add(_cvars.get("QC"));
442530
else if(Q3E.q3ei.isD3)
443531
{
444532
res.add(_cvars.get("RENDERER"));

idTech4Amm/src/main/java/com/n0n3m4/DIII4A/GameLauncher.java

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -571,6 +571,18 @@ else if (id == R.id.tdm_useMediumPrecision)
571571
if(Q3E.q3ei.isTDM)
572572
setProp("harm_r_useMediumPrecision", isChecked);
573573
}
574+
575+
// QC
576+
else if (id == R.id.qc_r_shadowMapping)
577+
{
578+
if(Q3E.q3ei.isQC)
579+
setProp("r_useShadowMapping", isChecked);
580+
}
581+
else if (id == R.id.qc_r_globalIllumination)
582+
{
583+
if(Q3E.q3ei.isQC)
584+
setProp("harm_r_globalillumination", isChecked);
585+
}
574586
}
575587
};
576588
private final RadioGroup.OnCheckedChangeListener m_groupCheckChangeListener = new RadioGroup.OnCheckedChangeListener() {
@@ -1393,6 +1405,10 @@ else if(Q3E.q3ei.isUrT)
13931405
{
13941406
Updatehacktings_UrT();
13951407
}
1408+
else if(Q3E.q3ei.isQC)
1409+
{
1410+
Updatehacktings_QC();
1411+
}
13961412

13971413
// game mods for every games
13981414
str = GetGameModFromCommand();
@@ -1524,6 +1540,12 @@ private void Updatehacktings_UrT()
15241540
SyncCmdEditText(V.urt_bot_level, "harm_bot_level", "0");
15251541
}
15261542

1543+
private void Updatehacktings_QC()
1544+
{
1545+
SyncCmdCheckbox(V.qc_r_shadowMapping, "r_useShadowMapping", false);
1546+
SyncCmdCheckbox(V.qc_r_globalIllumination, "harm_r_globalillumination", false);
1547+
}
1548+
15271549
private void ThrowException()
15281550
{
15291551
((String) null).toString();
@@ -1908,6 +1930,9 @@ public void run() {
19081930
// UrT
19091931
SetupUI_UrT();
19101932

1933+
// QC
1934+
SetupUI_QC();
1935+
19111936
//DIII4A-specific
19121937
SetupCommandTextWatcher(true);
19131938
V.edt_harm_r_specularExponent.addTextChangedListener(new SaveFloatPreferenceTextWatcher("harm_r_specularExponent", Q3EPreference.pref_harm_r_specularExponent, 3.0f));
@@ -2342,6 +2367,14 @@ public void afterTextChanged(Editable s)
23422367
});
23432368
}
23442369

2370+
private void SetupUI_QC()
2371+
{
2372+
V.qc_r_shadowMapping.setChecked(getProp("r_useShadowMapping", false));
2373+
V.qc_r_shadowMapping.setOnCheckedChangeListener(m_checkboxChangeListener);
2374+
V.qc_r_globalIllumination.setChecked(getProp("harm_r_globalillumination", false));
2375+
V.qc_r_globalIllumination.setOnCheckedChangeListener(m_checkboxChangeListener);
2376+
}
2377+
23452378
private void LoadAds()
23462379
{
23472380
//Q3EAd.LoadAds(this);
@@ -3672,6 +3705,7 @@ private void SetGame(String game)
36723705
V.xash3d_section.setVisibility(Q3E.q3ei.isXash3D ? View.VISIBLE : View.GONE);
36733706
V.source_section.setVisibility(Q3E.q3ei.isSource ? View.VISIBLE : View.GONE);
36743707
V.urt_section.setVisibility(Q3E.q3ei.isUrT ? View.VISIBLE : View.GONE);
3708+
V.qc_section.setVisibility(Q3E.q3ei.isQC ? View.VISIBLE : View.GONE);
36753709
V.sdl_section.setVisibility(Q3E.q3ei.IsUsingSDL() ? View.VISIBLE : View.GONE);
36763710
V.openal_section.setVisibility(Q3E.q3ei.IsUsingOpenAL() ? View.VISIBLE : View.GONE);
36773711

@@ -4979,6 +5013,9 @@ private class ViewHolder
49795013
public EditText ratio_y;
49805014
public LinearLayout res_ratiolayout;
49815015
public CheckBox use_custom_resolution;
5016+
public LinearLayout qc_section;
5017+
public CheckBox qc_r_shadowMapping;
5018+
public CheckBox qc_r_globalIllumination;
49825019

49835020
private RadioGroup CreateGameRadioGroup(int[] id)
49845021
{
@@ -5186,6 +5223,9 @@ public void Setup()
51865223
ratio_y = findViewById(R.id.ratio_y);
51875224
res_ratiolayout = findViewById(R.id.res_ratiolayout);
51885225
use_custom_resolution = findViewById(R.id.use_custom_resolution);
5226+
qc_section = findViewById(R.id.qc_section);
5227+
qc_r_shadowMapping = findViewById(R.id.qc_r_shadowMapping);
5228+
qc_r_globalIllumination = findViewById(R.id.qc_r_globalIllumination);
51895229
}
51905230
}
51915231
}
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
3+
xmlns:myapp="http://schemas.android.com/apk/res/com.karin.idTech4Amm"
4+
android:layout_width="match_parent"
5+
android:layout_height="wrap_content"
6+
android:orientation="vertical"
7+
android:background="@drawable/layout_border"
8+
android:layout_marginHorizontal="4dp" android:layout_marginVertical="2dp"
9+
>
10+
11+
<com.karin.idTech4Amm.widget.Divider
12+
android:layout_width="match_parent"
13+
android:layout_height="wrap_content"
14+
myapp:label="@string/qc"
15+
myapp:lineColor="@color/launcher_divider_color" />
16+
17+
<CheckBox
18+
android:id="@+id/qc_r_shadowMapping"
19+
android:layout_width="wrap_content"
20+
android:layout_height="wrap_content"
21+
android:checked="false"
22+
android:text="@string/soft_shadow_r_useShadowMapping" />
23+
24+
<CheckBox
25+
android:id="@+id/qc_r_globalIllumination"
26+
android:layout_width="wrap_content"
27+
android:layout_height="wrap_content"
28+
android:text="@string/render_global_illumination_harm_r_globalillumination" />
29+
30+
<TextView
31+
android:layout_width="wrap_content"
32+
android:layout_height="wrap_content"
33+
android:layout_marginLeft="32dp"
34+
android:layout_marginTop="0dp"
35+
android:layout_marginBottom="0dp"
36+
android:text="@string/lighting_and_shadow_cvars_are_same_as_doom_3_quake_4_prey_2006"
37+
android:textAppearance="?android:attr/textAppearanceSmall"
38+
/>
39+
40+
</LinearLayout>

idTech4Amm/src/main/res/layout/launcher_tab1.xml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1076,6 +1076,11 @@
10761076
layout="@layout/launcher_urt"
10771077
android:visibility="gone"></include>
10781078

1079+
<include
1080+
android:id="@+id/qc_section"
1081+
layout="@layout/launcher_qc"
1082+
android:visibility="gone"></include>
1083+
10791084
<include
10801085
android:id="@+id/openal_section"
10811086
layout="@layout/launcher_openal"

idTech4Amm/src/main/res/values-ru/strings.xml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -580,5 +580,7 @@
580580
<string name="use_multithread_command_to_switch_single_multi_threading_in_game_if_enabled">Используйте команду `Многопоточность` для переключения между однопоточным и многопоточным режимами в игре, если они включены.</string>
581581
<string name="skin_deep">Skin Deep</string>
582582
<string name="qc">QC</string>
583+
<string name="soft_shadow_r_useShadowMapping">Soft shadow(r_useShadowMapping)</string>
584+
<string name="lighting_and_shadow_cvars_are_same_as_doom_3_quake_4_prey_2006">Lighting and shadow cvars are same as DOOM 3/Quake 4/Prey(2006)</string>
583585

584586
</resources>

idTech4Amm/src/main/res/values-zh/strings.xml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -579,4 +579,6 @@
579579
<string name="use_multithread_command_to_switch_single_multi_threading_in_game_if_enabled">如果启用了多线程, 游戏中可以使用`multithread`命令切换单线程和多线程</string>
580580
<string name="skin_deep">Skin Deep</string>
581581
<string name="qc">四方形牛仔</string>
582+
<string name="soft_shadow_r_useShadowMapping">软阴影(r_useShadowMapping)</string>
583+
<string name="lighting_and_shadow_cvars_are_same_as_doom_3_quake_4_prey_2006">光照和阴影的cvar与毁灭战士3/雷神之锤4/掠食(2006)相同</string>
582584
</resources>

idTech4Amm/src/main/res/values/strings.xml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -583,5 +583,7 @@
583583
<string name="use_multithread_command_to_switch_single_multi_threading_in_game_if_enabled">Use `multithread` command to switch single/multi threading in game if enabled</string>
584584
<string name="skin_deep">Skin Deep</string>
585585
<string name="qc">QC</string>
586+
<string name="soft_shadow_r_useShadowMapping">Soft shadow(r_useShadowMapping)</string>
587+
<string name="lighting_and_shadow_cvars_are_same_as_doom_3_quake_4_prey_2006">Lighting and shadow cvars are same as DOOM 3/Quake 4/Prey(2006)</string>
586588

587589
</resources>

0 commit comments

Comments
 (0)