Skip to content

Commit 9901def

Browse files
author
cppAndre
committed
V1.0.1
Various changes
1 parent d7fa455 commit 9901def

15 files changed

Lines changed: 593 additions & 461 deletions

.~lock.EULA.Development Kit.rtf#

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
,PC-Andre/Andre,PC-Andre,25.08.2016 13:16,file:///C:/Users/Andre/AppData/Roaming/LibreOffice/4;

LICENSE

Lines changed: 58 additions & 2 deletions
Large diffs are not rendered by default.

src/PREY.sln

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,15 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "idLib", "2005idlib.vcxproj"
88
EndProject
99
Global
1010
GlobalSection(SolutionConfigurationPlatforms) = preSolution
11+
Debug PreyRun|Win32 = Debug PreyRun|Win32
1112
Debug with inlines and memory log|Win32 = Debug with inlines and memory log|Win32
1213
Debug with inlines|Win32 = Debug with inlines|Win32
1314
Debug|Win32 = Debug|Win32
1415
Release|Win32 = Release|Win32
1516
EndGlobalSection
1617
GlobalSection(ProjectConfigurationPlatforms) = postSolution
18+
{49BEC5C6-B964-417A-851E-808886B57430}.Debug PreyRun|Win32.ActiveCfg = Debug Release|Win32
19+
{49BEC5C6-B964-417A-851E-808886B57430}.Debug PreyRun|Win32.Build.0 = Debug Release|Win32
1720
{49BEC5C6-B964-417A-851E-808886B57430}.Debug with inlines and memory log|Win32.ActiveCfg = Debug|Win32
1821
{49BEC5C6-B964-417A-851E-808886B57430}.Debug with inlines and memory log|Win32.Build.0 = Debug|Win32
1922
{49BEC5C6-B964-417A-851E-808886B57430}.Debug with inlines|Win32.ActiveCfg = Debug with inlines|Win32
@@ -22,6 +25,8 @@ Global
2225
{49BEC5C6-B964-417A-851E-808886B57430}.Debug|Win32.Build.0 = Debug|Win32
2326
{49BEC5C6-B964-417A-851E-808886B57430}.Release|Win32.ActiveCfg = Release|Win32
2427
{49BEC5C6-B964-417A-851E-808886B57430}.Release|Win32.Build.0 = Release|Win32
28+
{49BEC5C6-B964-417A-851E-808886B57400}.Debug PreyRun|Win32.ActiveCfg = Debug Release|Win32
29+
{49BEC5C6-B964-417A-851E-808886B57400}.Debug PreyRun|Win32.Build.0 = Debug Release|Win32
2530
{49BEC5C6-B964-417A-851E-808886B57400}.Debug with inlines and memory log|Win32.ActiveCfg = Debug|Win32
2631
{49BEC5C6-B964-417A-851E-808886B57400}.Debug with inlines and memory log|Win32.Build.0 = Debug|Win32
2732
{49BEC5C6-B964-417A-851E-808886B57400}.Debug with inlines|Win32.ActiveCfg = Debug with inlines|Win32

src/Prey/ai_sphereboss.cpp

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -199,13 +199,20 @@ idProjectile *hhSphereBoss::LaunchProjectile( const char *jointname, idEntity *t
199199

200200
void hhSphereBoss::Killed( idEntity *inflictor, idEntity *attacker, int damage, const idVec3 &dir, int location ) {
201201
//PreyRun BEGIN
202-
if (pr_timer_running && pr_autosplit.GetBool())
202+
if (pr_timer_running && pr_autostop.GetBool())
203203
{
204204
pr_Timer.Stop();
205205
pr_timer_running = false;
206-
gameLocal.Printf("PreyRun: AutoSplitter: End game\n");
207206

208-
pr::WriteGameEnd(pr::GetTime());
207+
if (pr_preysplit.GetBool())
208+
{
209+
pr::WriteGameEnd(pr::GetTime());
210+
}
211+
212+
auto times = PR_ms2time(pr_Timer.Milliseconds());
213+
214+
gameLocal.Printf("PreyRun: Timer: End game, time: %02d:%02d:%02d.%03d\n",times.hours,times.minutes,times.seconds,times.milliseconds);
215+
209216
}
210217
//PreyRun END
211218

src/Prey/game_player.cpp

Lines changed: 41 additions & 57 deletions
Original file line numberDiff line numberDiff line change
@@ -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
*/
10591059
void 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+
15311528
inline 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
/*

src/Prey/game_player.h

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -37,20 +37,22 @@ class hhTalon;
3737
class hhPossessedTommy;
3838

3939
// PreyRun BEGIN
40+
#include <cstdint>
41+
42+
//struct PR_time_t
43+
//{
44+
// uint32_t hours;
45+
// uint8_t minutes;
46+
// uint8_t seconds;
47+
// uint16_t milliseconds;
48+
//};
49+
4050
int const PR_AMMOPOS_X = 550;
4151
int const PR_AMMOPOS_Y = 448;
4252
int const PR_AMMOPOS2_Y = PR_AMMOPOS_Y + 15;
4353

44-
struct PR_time_t
45-
{
46-
int hour;
47-
int minute;
48-
int seconds;
49-
int ms;
50-
};
51-
52-
inline float PR_calcStuff(float f);
53-
PR_time_t PR_ms2time(int x);
54+
//PR_time_t PR_ms2time(unsigned);
55+
inline float PR_calcStuff(float);
5456
// PreyRun END
5557

5658
#define MAX_HEALTH_NORMAL_MP 100 //rww - a probably temporary hack for trying out the pipe-as-armor concept

src/Prey/prey_game.cpp

Lines changed: 18 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -87,13 +87,17 @@ void hhGameLocal::UnregisterEntity( idEntity *ent ) {
8787
//---------------------------------------------------
8888
void hhGameLocal::MapShutdown( void ) {
8989
// PreyRun BEGIN
90-
if (pr_autosplit.GetBool() && pr_timer_running)
90+
if (pr_timer_running)
9191
{
92-
gameLocal.Printf("PreyRun: Autosplitter: Paused Map Shutdown\n");
92+
gameLocal.Printf("PreyRun: Timer: Paused, Map Shutdown\n");
9393
pr_Timer.Stop();
94+
#ifdef PR_DEBUG
95+
auto time = PR_ms2time(pr_Timer.Milliseconds());
96+
gameLocal.Printf("PreyRunDGB: Time: %02d:%02d:%02d.%03d\n", time.hours, time.minutes, time.seconds, time.milliseconds);
97+
#endif // PR_DEBUG
9498

95-
pr::WriteMapChange(pr::GetTime(), (idStr)gameLocal.GetMapName());
96-
gameLocal.Printf("PreyRun: leaving map: %s\n", gameLocal.GetMapName());
99+
// now done in idGameLocal::InitFromNewMap
100+
/*pr::WriteMapChange(pr::GetTime(),(idStr) GetMapName());*/
97101
}
98102
// PreyRun END
99103

@@ -119,6 +123,16 @@ void hhGameLocal::MapShutdown( void ) {
119123
//---------------------------------------------------
120124
void hhGameLocal::InitFromNewMap( const char *mapName, idRenderWorld *renderWorld, idSoundWorld *soundWorld, bool isServer, bool isClient, int randseed ) {
121125

126+
// PreyRun BEGIN
127+
if (pr_timer_running)
128+
{
129+
/*pr::WriteMapChange(pr::GetTime(), (idStr)mapName);*/
130+
#ifdef PR_DEBUG
131+
gameLocal.Printf("PreyRun Debug: Starting Map: %s\n", mapName);
132+
#endif // PR_DEBUG
133+
}
134+
// PreyRun END
135+
122136
//HUMANHEAD rww - throw up the prey logo if using the logitech lcd screen
123137
if (logitechLCDEnabled) {
124138
sys->LGLCD_UploadImage(NULL, -1, -1, false, true);
@@ -141,12 +155,6 @@ void hhGameLocal::InitFromNewMap( const char *mapName, idRenderWorld *renderWorl
141155
bIsLOTA = true;
142156
}
143157

144-
// PreyRun BEGIN
145-
/*if (pr_autosplit.GetBool() && pr_timer_running)
146-
{
147-
gameLocal.Printf("PreyRun: Autosplitter: Resume map init\n");
148-
pr_Timer.Start();
149-
}*/
150158
if (pr_autopause.GetBool())
151159
{
152160
gameLocal.Printf("PreyRun: Autopause: paused map load\n");

0 commit comments

Comments
 (0)