@@ -977,7 +977,7 @@ void hhPlayer::UpdateHudStats(idUserInterface *_hud) {
977977 _hud->SetStateFloat (" pr_hud_timer_g" , pr_hud_timer_g.GetFloat ());
978978 _hud->SetStateFloat (" pr_hud_timer_b" , pr_hud_timer_b.GetFloat ());
979979 // Position
980- _hud->SetStateBool (" pr_hud_position " , pr_hud_position .GetBool ());
980+ _hud->SetStateBool (" pr_hud_location " , pr_hud_location .GetBool ());
981981 // Entity info
982982 _hud->SetStateBool (" pr_hud_entityinfo" , pr_hud_entityinfo.GetBool ());
983983 // Ammo
@@ -1058,15 +1058,18 @@ hhPlayer::DrawHUD
10581058*/
10591059void hhPlayer::DrawHUD (idUserInterface *_hud) {
10601060 // PreyRun BEGIN
1061- // Might not be the optimal solution because when the game decides to not draw the hud the timer cant resume but it gives better times then hooking IniFromMap ()
1062- if (pr_timer_running && !pr_Timer.IsRunning () && pr_autosplit. GetBool () )
1061+ // Might not be the optimal solution because when the game decides to not draw the hud the timer cant resume but it gives better times then hooking InitFromMap ()
1062+ if (pr_timer_running && !pr_Timer.IsRunning ())
10631063 {
1064- gameLocal.Printf (" PreyRun: AutoSplitter : Resuming\n " );
1064+ gameLocal.Printf (" PreyRun: Timer : Resuming\n " );
10651065 pr_Timer.Start ();
10661066
1067- // pr::WriteMapChange(pr::GetTime(), (idStr)gameLocal.GetMapName());
1067+ #ifdef PR_DEBUG
1068+ auto time = PR_ms2time (pr_Timer.Milliseconds ());
1069+ gameLocal.Printf (" PreyRunDGB: Time: %02d:%02d:%02d.%03d\n " , time.hours , time.minutes , time.seconds , time.milliseconds );
10681070
1069- gameLocal.Printf (" PreyRun: Changing map to: %s\n " , gameLocal.GetMapName ());
1071+ gameLocal.Printf (" PreyRun Debug: Changed map to: %s\n " , gameLocal.GetMapName ());
1072+ #endif // PR_DEBUG
10701073 }
10711074 // PreyRun END
10721075
@@ -1147,7 +1150,7 @@ void hhPlayer::DrawHUD(idUserInterface *_hud) {
11471150
11481151 idStr strText;
11491152
1150- sprintf (strText, " %02d:%02d:%02d.%03d" , times.hour , times.minute , times.seconds , times.ms );
1153+ sprintf (strText, " %02d:%02d:%02d.%03d" , times.hours , times.minutes , times.seconds , times.milliseconds );
11511154
11521155 renderSystem->DrawSmallStringExt (pr_t_x, pr_t_y, strText.c_str (), idVec4 (PR_calcStuff (pr_t_r), PR_calcStuff (pr_t_g), PR_calcStuff (pr_t_b), 1 ), false , declManager->FindMaterial (" textures/bigchars" ));
11531156 }
@@ -1157,7 +1160,7 @@ void hhPlayer::DrawHUD(idUserInterface *_hud) {
11571160
11581161 idStr strText;
11591162
1160- sprintf (strText, " %02d:%02d:%02d.%03d" , times.hour , times.minute , times.seconds , times.ms );
1163+ sprintf (strText, " %02d:%02d:%02d.%03d" , times.hours , times.minutes , times.seconds , times.milliseconds );
11611164
11621165 renderSystem->DrawSmallStringExt (pr_t_x, pr_t_y, strText.c_str (), idVec4 (PR_calcStuff (pr_t_r), PR_calcStuff (pr_t_g), PR_calcStuff (pr_t_b), 1 ), false , declManager->FindMaterial (" textures/bigchars" ));
11631166 }
@@ -1179,7 +1182,7 @@ void hhPlayer::DrawHUD(idUserInterface *_hud) {
11791182 // Uses InVehicle now
11801183 if (physicsObj.HasGroundContacts () || InVehicle ())
11811184 {
1182- // are we standing on the ground or in a Vehicle? then add Z speed as well (when wallwalking, being on stairs or flying)
1185+ // are we standing on the ground or in a Vehicle? then add Z speed as well (when wallwalking, being on stairs/slopes or flying in Vehicle )
11831186 sprintf (strText, " %.2f" , vel.Length ());
11841187 }
11851188 else
@@ -1199,19 +1202,18 @@ void hhPlayer::DrawHUD(idUserInterface *_hud) {
11991202
12001203 idAngles angles;
12011204
1202- // ViewAngles show 0,0,0 when in vehicle
1203- /* if (InVehicle())
1205+ if (InVehicle ())
12041206 {
1205- angles= GetVehicleInterfaceLocal()->GetVehicle()
1207+ angles = GetVehicleInterfaceLocal ()->GetVehicle ()-> GetAxis (). ToAngles ();
12061208 }
12071209 else
1208- {*/
1209- angles = GetViewAngles ();
1210+ {
1211+ angles = GetViewAngles ();
1212+ }
12101213
12111214 sprintf (pitch, " Pitch : %f" , angles.pitch );
12121215 sprintf (yaw, " Yaw : %f" , angles.yaw );
12131216 sprintf (roll, " Roll : %f" , angles.roll );
1214- // }
12151217
12161218 renderSystem->DrawSmallStringExt (0 , 0 , pitch.c_str (), idVec4 (1 , 1 , 1 , 1 ), false , declManager->FindMaterial (" textures/bigchars" ));
12171219 renderSystem->DrawSmallStringExt (0 , 15 , yaw.c_str (), idVec4 (1 , 1 , 1 , 1 ), false , declManager->FindMaterial (" textures/bigchars" ));
@@ -1242,7 +1244,7 @@ void hhPlayer::DrawHUD(idUserInterface *_hud) {
12421244 }
12431245
12441246 // Position
1245- if (_hud->GetStateBool (" pr_hud_position " , " 0" ))
1247+ if (_hud->GetStateBool (" pr_hud_location " , " 0" ))
12461248 {
12471249 auto eyePos = GetEyePosition ();
12481250
@@ -1296,7 +1298,7 @@ void hhPlayer::DrawHUD(idUserInterface *_hud) {
12961298 {
12971299 idStr strHealth;
12981300 sprintf (strHealth, " Health: %d/%d" , ent->health , ent->GetMaxHealth ());
1299- // sprintf(strName, "Name: %s", ent->name);
1301+ // sprintf(strName, "Name: %s", ent->name); // crashes
13001302
13011303 renderSystem->DrawSmallStringExt (360 , 235 , strHealth, idVec4 (1 , 1 , 1 , 1 ), false , declManager->FindMaterial (" textures/bigchars" ));
13021304 }
@@ -1324,7 +1326,7 @@ void hhPlayer::DrawHUD(idUserInterface *_hud) {
13241326 idVec4 color;
13251327 idStr strAmmo;
13261328
1327- sprintf (strAmmo, " %02d | %02d" , clip, avail);
1329+ sprintf (strAmmo, " %02d | %02d" , clip, avail - clip );
13281330
13291331 // PR_FIXME
13301332 // very ugly there might be a better solution to this than if then else trees
@@ -1356,8 +1358,6 @@ void hhPlayer::DrawHUD(idUserInterface *_hud) {
13561358
13571359 sprintf (strAmmo, " %02d" , avail);
13581360
1359- // PR_FIXME
1360- // very ugly there might be a better solution to this than if then else trees
13611361 if (avail > 0 )
13621362 {
13631363 color.Set (1 , 1 , 1 , 1 );
@@ -1378,8 +1378,6 @@ void hhPlayer::DrawHUD(idUserInterface *_hud) {
13781378
13791379 sprintf (strAmmo, " %02d" , avail);
13801380
1381- // PR_FIXME
1382- // very ugly there might be a better solution to this than if then else trees
13831381 if (avail > 0 )
13841382 {
13851383 color.Set (1 , 1 , 1 , 1 );
@@ -1404,8 +1402,6 @@ void hhPlayer::DrawHUD(idUserInterface *_hud) {
14041402 sprintf (strAmmo, " %03d" , avail);
14051403 sprintf (strAmmo2, " %02d" , altAvail);
14061404
1407- // PR_FIXME
1408- // very ugly there might be a better solution to this than if then else trees
14091405 if (avail > 0 )
14101406 {
14111407 color.Set (1 , 1 , 1 , 1 );
@@ -1436,10 +1432,8 @@ void hhPlayer::DrawHUD(idUserInterface *_hud) {
14361432 idVec4 color;
14371433 idStr strAmmo;
14381434
1439- sprintf (strAmmo, " %02d | %02d" , clip, avail);
1435+ sprintf (strAmmo, " %02d | %02d" , clip, avail - clip );
14401436
1441- // PR_FIXME
1442- // very ugly there might be a better solution to this than if then else trees
14431437 if (clip > 0 )
14441438 {
14451439 color.Set (1 , 1 , 1 , 1 );
@@ -1467,8 +1461,6 @@ void hhPlayer::DrawHUD(idUserInterface *_hud) {
14671461
14681462 sprintf (strAmmo, " %02d" , avail);
14691463
1470- // PR_FIXME
1471- // very ugly there might be a better solution to this than if then else trees
14721464 if (avail > 0 )
14731465 {
14741466 color.Set (1 , 1 , 1 , 1 );
@@ -1487,22 +1479,14 @@ void hhPlayer::DrawHUD(idUserInterface *_hud) {
14871479 }
14881480 }
14891481
1490- // Health | crashes when dying
1491- /* if (_hud->GetStateBool("pr_hud_health", "0"))
1482+ // Health
1483+ if (_hud->GetStateBool (" pr_hud_health" , " 0" ))
14921484 {
14931485 idStr strHealth;
14941486 idVec4 color;
14951487
14961488 // Player is dead
1497- if (IsDeathWalking() || IsDead())
1498- {
1499- auto maxHealth = GetMaxHealth();
1500-
1501- color.Set(1, 0.1, 0.1, 1);
1502-
1503- sprintf(strHealth, "000 | %03d", maxHealth);
1504- }
1505- else
1489+ if (!IsDead ())
15061490 {
15071491 auto health = GetHealth ();
15081492 auto maxHealth = GetMaxHealth ();
@@ -1518,33 +1502,33 @@ void hhPlayer::DrawHUD(idUserInterface *_hud) {
15181502 }
15191503
15201504 sprintf (strHealth, " %03d | %03d" , health, maxHealth);
1521- }
15221505
1523- renderSystem->DrawSmallStringExt(70, 448, strHealth, color, false, declManager->FindMaterial("textures/bigchars"));
1524- }*/
1506+ renderSystem->DrawSmallStringExt (70 , 448 , strHealth, color, false , declManager->FindMaterial (" textures/bigchars" ));
1507+ }
1508+ }
15251509
15261510 // PreyRun END
15271511}
15281512
15291513// PreyRun BEGIN
1530- // converts the 0-255 format for the 0-1 format used by the DrawSmallStringExt function
1514+ // converts the 0-255 format to the 0-1 format used by the DrawSmallStringExt function
1515+ // PR_time_t PR_ms2time(unsigned x)
1516+ // {
1517+ // PR_time_t ts;
1518+ // ts.hours = x / (60 * 60 * 1000);
1519+ // x = x - ts.hours*(60 * 60 * 1000);
1520+ // ts.minutes = x / (60 * 1000);
1521+ // x = x - ts.minutes*(60 * 1000);
1522+ // ts.seconds = x / 1000;
1523+ // ts.milliseconds = x - ts.seconds * 1000;
1524+ //
1525+ // return ts;
1526+ // }
1527+
15311528inline float PR_calcStuff (float f)
15321529{
15331530 return f / 255 ;
15341531}
1535-
1536- PR_time_t PR_ms2time (int x)
1537- {
1538- PR_time_t ts;
1539- ts.hour = x / (60 * 60 * 1000 );
1540- x = x - ts.hour *(60 * 60 * 1000 );
1541- ts.minute = x / (60 * 1000 );
1542- x = x - ts.minute *(60 * 1000 );
1543- ts.seconds = x / 1000 ;
1544- ts.ms = x - ts.seconds * 1000 ;
1545-
1546- return ts;
1547- }
15481532// PreyRun END
15491533
15501534/*
0 commit comments