Skip to content

Commit

Permalink
fix infohud memory leak
Browse files Browse the repository at this point in the history
  • Loading branch information
zweek committed Jan 29, 2023
1 parent 63ee271 commit 12c3992
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
7 changes: 5 additions & 2 deletions src/scripts/vscripts/client/srmm_infohud.nut
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ array<SRMM_ConVarInfo> SRMM_ConVarInfos = []
array<SRMM_SettingInfo> SRMM_SettingInfos = []
array<InfoDisplay> InfoDisplays = []
array<InfoDisplay> CKF_infoDisplay = []
float[2]& screenSize

void function SRMM_InfoHUD_Init()
{
Expand All @@ -42,6 +43,8 @@ void function SRMM_InfoHUD_Init()
RegisterSetting("Practice mode", SRMM_settings.practiceMode, SRMM_settingDisplayPriority.practiceMode)
// RegisterSetting("speedmod", SRMM_settings.enableSpeedmod, SRMM_settingDisplayPriority.speedmod)

screenSize = GetScreenSize()

for (int i = 0; i < displayLines; i++)
{
InfoDisplays.append(CreateInfoDisplay())
Expand Down Expand Up @@ -174,7 +177,7 @@ void function SetInfoName(InfoDisplay display, string name)
void function SetHudPos(InfoDisplay display, int line) {
float showposOffset = 0.0
bool isShowposOffsetActive = false
float aspectRatio = GetScreenSize()[0] / GetScreenSize()[1]
float aspectRatio = screenSize[0] / screenSize[1]

if (GetConVarInt("cl_showpos") > 0) {
isShowposOffsetActive = true
Expand All @@ -187,7 +190,7 @@ void function SetHudPos(InfoDisplay display, int line) {
if (isShowposOffsetActive) showposOffset += 0.03

// scale vertical position with screen size since cl_showpos scales badly
showposOffset *= 3 - GetScreenSize()[1] / 540
showposOffset *= 3 - screenSize[1] / 540
RuiSetFloat2( display.infoTitle, "msgPos", <0.01, 0.04*line - 0.04 + aspectRatio/90 + showposOffset, 0.0> )
// actual scaling of the position seems to be <1.0, 0.9>
}
Expand Down
2 changes: 1 addition & 1 deletion src/scripts/vscripts/srmm_h.nut
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ global enum SRMM_settings {
CKfix,
}

global string srmmVersion = "SRMM v2.4.1"
global string srmmVersion = "SRMM v2.4.2"

bool function SRMM_getSetting( int i ) {
if ( (GetConVarInt( "voice_forcemicrecord" ) & (1 << i)) > 0 ) {
Expand Down

0 comments on commit 12c3992

Please sign in to comment.