Skip to content

Commit

Permalink
feat: prime sight one line
Browse files Browse the repository at this point in the history
  • Loading branch information
PeenScreeker committed Jun 30, 2023
1 parent 2ad9b2b commit 6d1473c
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
5 changes: 5 additions & 0 deletions layout/pages/settings/gameplay.xml
Original file line number Diff line number Diff line change
Expand Up @@ -633,6 +633,11 @@
</ConVarEnabler>

<!-- Trueness Mode -->

<ChaosSettingsEnum text="#Settings_Defrag_PrimeSight_OneLineEnable" convar="mom_df_hud_prime_one_line_enable" infomessage="#Settings_Defrag_PrimeSight_OneLineEnable_Info" tags="prime,sight">
<RadioButton group="primeonelineenable" text="#Common_Off" value="0" />
<RadioButton group="primeonelineenable" text="#Common_On" value="1" />
</ChaosSettingsEnum>
</ConVarEnabler>

</Panel>
Expand Down
7 changes: 5 additions & 2 deletions scripts/hud/cgaz.js
Original file line number Diff line number Diff line change
Expand Up @@ -214,6 +214,7 @@ class Cgaz {
this.primeEnable = primeConfig.enable;
this.primeTruenessMode = primeConfig.truenessMode;
this.primeShowInactive = primeConfig.inactiveEnable;
this.primeLockOneLine = primeConfig.oneLineEnable;
this.primeMinSpeed = primeConfig.minSpeed;
this.primeHeight = primeConfig.height;
this.primeOffset = primeConfig.offset;
Expand Down Expand Up @@ -1028,11 +1029,13 @@ class Cgaz {
const scale = 1 / (gainMax > 0 ? gainMax : this.primeAccel);
for (const [zone, gain] of gainZonesMap.entries()) {
const gainFactor = Math.min(Math.abs(gain * scale), 1);
const secondLine = gain < 0 && !this.primeLockOneLine;
const height = this.NaNCheck(this.primeHeight * (this.primeHeightgainEnable ? gainFactor : 1), 0);
const margin = gain < 0 ? this.primeHeight : this.primeHeight - height;
const margin = secondLine ? this.primeHeight : this.primeHeight - height;
zone.style.height = Number(height).toFixed(0) + 'px';
zone.style.marginTop = Number(margin).toFixed(0) + 'px';
zone.style.marginBottom = Number(gain < 0 ? this.primeHeight - height : this.primeHeight).toFixed(0) + 'px';
zone.style.marginBottom =
Number(secondLine ? this.primeHeight - height : this.primeHeight).toFixed(0) + 'px';

if (zone.isInactive) continue;

Expand Down

0 comments on commit 6d1473c

Please sign in to comment.