Skip to content

Commit

Permalink
redo infohud rewrite from other branch
Browse files Browse the repository at this point in the history
  • Loading branch information
zweek committed Apr 30, 2022
1 parent 7bb5de7 commit 68f2c4a
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 12 deletions.
3 changes: 2 additions & 1 deletion build.bat
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ if "%1"=="" (
if "%1"=="test" (
cd ..
xcopy vpk "C:\Program Files (x86)\Steam\steamapps\common\Titanfall2\vpk" /y
copy midimap.dll "C:\Program Files (x86)\Steam\steamapps\common\Titanfall2" /y
popd
echo Test build inserted!
)
Expand All @@ -30,5 +31,5 @@ if "%1"=="release" (
popd
move *.dat src\resource
move *.txt src\resource
echo Release builds done!
echo Release build v%2 packed!
)
27 changes: 17 additions & 10 deletions src/scripts/vscripts/client/srmm_infohud.nut
Original file line number Diff line number Diff line change
Expand Up @@ -172,25 +172,32 @@ void function SetInfoName(InfoDisplay display, string name)
}

void function SetHudPos(InfoDisplay display, int line) {
float ypos = 0.0
float xpos = 0.0
float showposOffset = 0.0
bool isShowposOffsetActive = false
float aspectRatio = GetScreenSize()[0] / GetScreenSize()[1]

if (GetConVarInt("cl_showpos") > 0) ypos += 0.07
if (GetConVarInt("cl_showfps") > 1) ypos += 0.02
if (GetConVarInt("cl_showpos") > 0) {
isShowposOffsetActive = true
showposOffset += 0.05
}
if (GetConVarInt("cl_showfps") > 1) {
isShowposOffsetActive = true
showposOffset += 0.01
}
if (isShowposOffsetActive) showposOffset += 0.03

// scale vertical position with screen size since cl_showpos scales badly
ypos *= 3 - GetScreenSize()[1] / 540
// scale horizontal position wth aspect ratio
xpos = -0.2 * (aspectRatio - 1.777)
RuiSetFloat2( display.infoTitle, "msgPos", <xpos, 0.05 * line + ypos, 0.0> )
showposOffset *= 3 - GetScreenSize()[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>
}

InfoDisplay function CreateInfoDisplay()
{
InfoDisplay display

var rui
rui = RuiCreate( $"ui/cockpit_console_text_top_left.rpak", clGlobal.topoCockpitHudPermanent, RUI_DRAW_COCKPIT, 0 )
rui = CreateFullscreenRui( $"ui/cockpit_console_text_top_left.rpak" )
RuiSetInt( rui, "maxLines", 1 )
RuiSetInt( rui, "lineNum", 1 )
RuiSetFloat( rui, "msgFontSize", 40.0 )
Expand All @@ -205,7 +212,7 @@ InfoDisplay function CreateCKFInfoDisplay()
{
InfoDisplay display
var rui
rui = RuiCreate( $"ui/cockpit_console_text_top_left.rpak", clGlobal.topoCockpitHudPermanent, RUI_DRAW_COCKPIT, 0 )
rui = CreateCockpitRui( $"ui/cockpit_console_text_top_left.rpak" )
RuiSetFloat2( rui, "msgPos", <0.15, 0.86, 0.0> )
RuiSetString( rui, "msgText", "CKF" )
RuiSetFloat( rui, "msgFontSize", 35.0 )
Expand Down
1 change: 0 additions & 1 deletion src/scripts/vscripts/sp/cl_pilot_speedometer.gnut
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ void function ClPilotSpeedometer_Init()
} else return
}

// TODO: find a way to access these through the UI VM
void function CreatePilotSpeedometer( entity cockpit, entity player )
{
//file.rui = CreateTitanCockpitRui( $"ui/pilot_speedometer.rpak" )
Expand Down

0 comments on commit 68f2c4a

Please sign in to comment.