Skip to content

Commit

Permalink
V1.0.1
Browse files Browse the repository at this point in the history
Various changes
  • Loading branch information
cppAndre committed Aug 25, 2016
1 parent d7fa455 commit 9901def
Show file tree
Hide file tree
Showing 15 changed files with 593 additions and 461 deletions.
1 change: 1 addition & 0 deletions .~lock.EULA.Development Kit.rtf#
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
,PC-Andre/Andre,PC-Andre,25.08.2016 13:16,file:///C:/Users/Andre/AppData/Roaming/LibreOffice/4;
60 changes: 58 additions & 2 deletions LICENSE

Large diffs are not rendered by default.

5 changes: 5 additions & 0 deletions src/PREY.sln
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,15 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "idLib", "2005idlib.vcxproj"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug PreyRun|Win32 = Debug PreyRun|Win32
Debug with inlines and memory log|Win32 = Debug with inlines and memory log|Win32
Debug with inlines|Win32 = Debug with inlines|Win32
Debug|Win32 = Debug|Win32
Release|Win32 = Release|Win32
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{49BEC5C6-B964-417A-851E-808886B57430}.Debug PreyRun|Win32.ActiveCfg = Debug Release|Win32
{49BEC5C6-B964-417A-851E-808886B57430}.Debug PreyRun|Win32.Build.0 = Debug Release|Win32
{49BEC5C6-B964-417A-851E-808886B57430}.Debug with inlines and memory log|Win32.ActiveCfg = Debug|Win32
{49BEC5C6-B964-417A-851E-808886B57430}.Debug with inlines and memory log|Win32.Build.0 = Debug|Win32
{49BEC5C6-B964-417A-851E-808886B57430}.Debug with inlines|Win32.ActiveCfg = Debug with inlines|Win32
Expand All @@ -22,6 +25,8 @@ Global
{49BEC5C6-B964-417A-851E-808886B57430}.Debug|Win32.Build.0 = Debug|Win32
{49BEC5C6-B964-417A-851E-808886B57430}.Release|Win32.ActiveCfg = Release|Win32
{49BEC5C6-B964-417A-851E-808886B57430}.Release|Win32.Build.0 = Release|Win32
{49BEC5C6-B964-417A-851E-808886B57400}.Debug PreyRun|Win32.ActiveCfg = Debug Release|Win32
{49BEC5C6-B964-417A-851E-808886B57400}.Debug PreyRun|Win32.Build.0 = Debug Release|Win32
{49BEC5C6-B964-417A-851E-808886B57400}.Debug with inlines and memory log|Win32.ActiveCfg = Debug|Win32
{49BEC5C6-B964-417A-851E-808886B57400}.Debug with inlines and memory log|Win32.Build.0 = Debug|Win32
{49BEC5C6-B964-417A-851E-808886B57400}.Debug with inlines|Win32.ActiveCfg = Debug with inlines|Win32
Expand Down
13 changes: 10 additions & 3 deletions src/Prey/ai_sphereboss.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -199,13 +199,20 @@ idProjectile *hhSphereBoss::LaunchProjectile( const char *jointname, idEntity *t

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

pr::WriteGameEnd(pr::GetTime());
if (pr_preysplit.GetBool())
{
pr::WriteGameEnd(pr::GetTime());
}

auto times = PR_ms2time(pr_Timer.Milliseconds());

gameLocal.Printf("PreyRun: Timer: End game, time: %02d:%02d:%02d.%03d\n",times.hours,times.minutes,times.seconds,times.milliseconds);

}
//PreyRun END

Expand Down
98 changes: 41 additions & 57 deletions src/Prey/game_player.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -977,7 +977,7 @@ void hhPlayer::UpdateHudStats(idUserInterface *_hud) {
_hud->SetStateFloat("pr_hud_timer_g", pr_hud_timer_g.GetFloat());
_hud->SetStateFloat("pr_hud_timer_b", pr_hud_timer_b.GetFloat());
// Position
_hud->SetStateBool("pr_hud_position", pr_hud_position.GetBool());
_hud->SetStateBool("pr_hud_location", pr_hud_location.GetBool());
// Entity info
_hud->SetStateBool("pr_hud_entityinfo", pr_hud_entityinfo.GetBool());
// Ammo
Expand Down Expand Up @@ -1058,15 +1058,18 @@ hhPlayer::DrawHUD
*/
void hhPlayer::DrawHUD(idUserInterface *_hud) {
// PreyRun BEGIN
// 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()
if (pr_timer_running && !pr_Timer.IsRunning() && pr_autosplit.GetBool())
// 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()
if (pr_timer_running && !pr_Timer.IsRunning())
{
gameLocal.Printf("PreyRun: AutoSplitter: Resuming\n");
gameLocal.Printf("PreyRun: Timer: Resuming\n");
pr_Timer.Start();

//pr::WriteMapChange(pr::GetTime(), (idStr)gameLocal.GetMapName());
#ifdef PR_DEBUG
auto time = PR_ms2time(pr_Timer.Milliseconds());
gameLocal.Printf("PreyRunDGB: Time: %02d:%02d:%02d.%03d\n", time.hours, time.minutes, time.seconds, time.milliseconds);

gameLocal.Printf("PreyRun: Changing map to: %s\n", gameLocal.GetMapName());
gameLocal.Printf("PreyRun Debug: Changed map to: %s\n", gameLocal.GetMapName());
#endif // PR_DEBUG
}
// PreyRun END

Expand Down Expand Up @@ -1147,7 +1150,7 @@ void hhPlayer::DrawHUD(idUserInterface *_hud) {

idStr strText;

sprintf(strText, "%02d:%02d:%02d.%03d", times.hour, times.minute, times.seconds, times.ms);
sprintf(strText, "%02d:%02d:%02d.%03d", times.hours, times.minutes, times.seconds, times.milliseconds);

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"));
}
Expand All @@ -1157,7 +1160,7 @@ void hhPlayer::DrawHUD(idUserInterface *_hud) {

idStr strText;

sprintf(strText, "%02d:%02d:%02d.%03d", times.hour, times.minute, times.seconds, times.ms);
sprintf(strText, "%02d:%02d:%02d.%03d", times.hours, times.minutes, times.seconds, times.milliseconds);

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"));
}
Expand All @@ -1179,7 +1182,7 @@ void hhPlayer::DrawHUD(idUserInterface *_hud) {
// Uses InVehicle now
if (physicsObj.HasGroundContacts() || InVehicle())
{
// are we standing on the ground or in a Vehicle? then add Z speed as well (when wallwalking, being on stairs or flying)
// 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)
sprintf(strText, "%.2f", vel.Length());
}
else
Expand All @@ -1199,19 +1202,18 @@ void hhPlayer::DrawHUD(idUserInterface *_hud) {

idAngles angles;

// ViewAngles show 0,0,0 when in vehicle
/*if (InVehicle())
if (InVehicle())
{
angles=GetVehicleInterfaceLocal()->GetVehicle()
angles = GetVehicleInterfaceLocal()->GetVehicle()->GetAxis().ToAngles();
}
else
{*/
angles = GetViewAngles();
{
angles = GetViewAngles();
}

sprintf(pitch, "Pitch : %f", angles.pitch);
sprintf(yaw, "Yaw : %f", angles.yaw);
sprintf(roll, "Roll : %f", angles.roll);
//}

renderSystem->DrawSmallStringExt(0, 0, pitch.c_str(), idVec4(1, 1, 1, 1), false, declManager->FindMaterial("textures/bigchars"));
renderSystem->DrawSmallStringExt(0, 15, yaw.c_str(), idVec4(1, 1, 1, 1), false, declManager->FindMaterial("textures/bigchars"));
Expand Down Expand Up @@ -1242,7 +1244,7 @@ void hhPlayer::DrawHUD(idUserInterface *_hud) {
}

// Position
if (_hud->GetStateBool("pr_hud_position", "0"))
if (_hud->GetStateBool("pr_hud_location", "0"))
{
auto eyePos = GetEyePosition();

Expand Down Expand Up @@ -1296,7 +1298,7 @@ void hhPlayer::DrawHUD(idUserInterface *_hud) {
{
idStr strHealth;
sprintf(strHealth, "Health: %d/%d", ent->health, ent->GetMaxHealth());
//sprintf(strName, "Name: %s", ent->name);
//sprintf(strName, "Name: %s", ent->name); // crashes

renderSystem->DrawSmallStringExt(360, 235, strHealth, idVec4(1, 1, 1, 1), false, declManager->FindMaterial("textures/bigchars"));
}
Expand Down Expand Up @@ -1324,7 +1326,7 @@ void hhPlayer::DrawHUD(idUserInterface *_hud) {
idVec4 color;
idStr strAmmo;

sprintf(strAmmo, "%02d | %02d", clip, avail);
sprintf(strAmmo, "%02d | %02d", clip, avail - clip);

// PR_FIXME
// very ugly there might be a better solution to this than if then else trees
Expand Down Expand Up @@ -1356,8 +1358,6 @@ void hhPlayer::DrawHUD(idUserInterface *_hud) {

sprintf(strAmmo, " %02d", avail);

// PR_FIXME
// very ugly there might be a better solution to this than if then else trees
if (avail > 0)
{
color.Set(1, 1, 1, 1);
Expand All @@ -1378,8 +1378,6 @@ void hhPlayer::DrawHUD(idUserInterface *_hud) {

sprintf(strAmmo, " %02d", avail);

// PR_FIXME
// very ugly there might be a better solution to this than if then else trees
if (avail > 0)
{
color.Set(1, 1, 1, 1);
Expand All @@ -1404,8 +1402,6 @@ void hhPlayer::DrawHUD(idUserInterface *_hud) {
sprintf(strAmmo, " %03d", avail);
sprintf(strAmmo2, " %02d", altAvail);

// PR_FIXME
// very ugly there might be a better solution to this than if then else trees
if (avail > 0)
{
color.Set(1, 1, 1, 1);
Expand Down Expand Up @@ -1436,10 +1432,8 @@ void hhPlayer::DrawHUD(idUserInterface *_hud) {
idVec4 color;
idStr strAmmo;

sprintf(strAmmo, "%02d | %02d", clip, avail);
sprintf(strAmmo, "%02d | %02d", clip, avail - clip);

// PR_FIXME
// very ugly there might be a better solution to this than if then else trees
if (clip > 0)
{
color.Set(1, 1, 1, 1);
Expand Down Expand Up @@ -1467,8 +1461,6 @@ void hhPlayer::DrawHUD(idUserInterface *_hud) {

sprintf(strAmmo, " %02d", avail);

// PR_FIXME
// very ugly there might be a better solution to this than if then else trees
if (avail > 0)
{
color.Set(1, 1, 1, 1);
Expand All @@ -1487,22 +1479,14 @@ void hhPlayer::DrawHUD(idUserInterface *_hud) {
}
}

// Health | crashes when dying
/*if (_hud->GetStateBool("pr_hud_health", "0"))
// Health
if (_hud->GetStateBool("pr_hud_health", "0"))
{
idStr strHealth;
idVec4 color;

// Player is dead
if (IsDeathWalking() || IsDead())
{
auto maxHealth = GetMaxHealth();
color.Set(1, 0.1, 0.1, 1);
sprintf(strHealth, "000 | %03d", maxHealth);
}
else
if (!IsDead())
{
auto health = GetHealth();
auto maxHealth = GetMaxHealth();
Expand All @@ -1518,33 +1502,33 @@ void hhPlayer::DrawHUD(idUserInterface *_hud) {
}

sprintf(strHealth, "%03d | %03d", health, maxHealth);
}

renderSystem->DrawSmallStringExt(70, 448, strHealth, color, false, declManager->FindMaterial("textures/bigchars"));
}*/
renderSystem->DrawSmallStringExt(70, 448, strHealth, color, false, declManager->FindMaterial("textures/bigchars"));
}
}

// PreyRun END
}

// PreyRun BEGIN
// converts the 0-255 format for the 0-1 format used by the DrawSmallStringExt function
// converts the 0-255 format to the 0-1 format used by the DrawSmallStringExt function
//PR_time_t PR_ms2time(unsigned x)
//{
// PR_time_t ts;
// ts.hours = x / (60 * 60 * 1000);
// x = x - ts.hours*(60 * 60 * 1000);
// ts.minutes = x / (60 * 1000);
// x = x - ts.minutes*(60 * 1000);
// ts.seconds = x / 1000;
// ts.milliseconds = x - ts.seconds * 1000;
//
// return ts;
//}

inline float PR_calcStuff(float f)
{
return f / 255;
}

PR_time_t PR_ms2time(int x)
{
PR_time_t ts;
ts.hour = x / (60 * 60 * 1000);
x = x - ts.hour*(60 * 60 * 1000);
ts.minute = x / (60 * 1000);
x = x - ts.minute*(60 * 1000);
ts.seconds = x / 1000;
ts.ms = x - ts.seconds * 1000;

return ts;
}
// PreyRun END

/*
Expand Down
22 changes: 12 additions & 10 deletions src/Prey/game_player.h
Original file line number Diff line number Diff line change
Expand Up @@ -37,20 +37,22 @@ class hhTalon;
class hhPossessedTommy;

// PreyRun BEGIN
#include <cstdint>

//struct PR_time_t
//{
// uint32_t hours;
// uint8_t minutes;
// uint8_t seconds;
// uint16_t milliseconds;
//};

int const PR_AMMOPOS_X = 550;
int const PR_AMMOPOS_Y = 448;
int const PR_AMMOPOS2_Y = PR_AMMOPOS_Y + 15;

struct PR_time_t
{
int hour;
int minute;
int seconds;
int ms;
};

inline float PR_calcStuff(float f);
PR_time_t PR_ms2time(int x);
//PR_time_t PR_ms2time(unsigned);
inline float PR_calcStuff(float);
// PreyRun END

#define MAX_HEALTH_NORMAL_MP 100 //rww - a probably temporary hack for trying out the pipe-as-armor concept
Expand Down
28 changes: 18 additions & 10 deletions src/Prey/prey_game.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -87,13 +87,17 @@ void hhGameLocal::UnregisterEntity( idEntity *ent ) {
//---------------------------------------------------
void hhGameLocal::MapShutdown( void ) {
// PreyRun BEGIN
if (pr_autosplit.GetBool() && pr_timer_running)
if (pr_timer_running)
{
gameLocal.Printf("PreyRun: Autosplitter: Paused Map Shutdown\n");
gameLocal.Printf("PreyRun: Timer: Paused, Map Shutdown\n");
pr_Timer.Stop();
#ifdef PR_DEBUG
auto time = PR_ms2time(pr_Timer.Milliseconds());
gameLocal.Printf("PreyRunDGB: Time: %02d:%02d:%02d.%03d\n", time.hours, time.minutes, time.seconds, time.milliseconds);
#endif // PR_DEBUG

pr::WriteMapChange(pr::GetTime(), (idStr)gameLocal.GetMapName());
gameLocal.Printf("PreyRun: leaving map: %s\n", gameLocal.GetMapName());
// now done in idGameLocal::InitFromNewMap
/*pr::WriteMapChange(pr::GetTime(),(idStr) GetMapName());*/
}
// PreyRun END

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

// PreyRun BEGIN
if (pr_timer_running)
{
/*pr::WriteMapChange(pr::GetTime(), (idStr)mapName);*/
#ifdef PR_DEBUG
gameLocal.Printf("PreyRun Debug: Starting Map: %s\n", mapName);
#endif // PR_DEBUG
}
// PreyRun END

//HUMANHEAD rww - throw up the prey logo if using the logitech lcd screen
if (logitechLCDEnabled) {
sys->LGLCD_UploadImage(NULL, -1, -1, false, true);
Expand All @@ -141,12 +155,6 @@ void hhGameLocal::InitFromNewMap( const char *mapName, idRenderWorld *renderWorl
bIsLOTA = true;
}

// PreyRun BEGIN
/*if (pr_autosplit.GetBool() && pr_timer_running)
{
gameLocal.Printf("PreyRun: Autosplitter: Resume map init\n");
pr_Timer.Start();
}*/
if (pr_autopause.GetBool())
{
gameLocal.Printf("PreyRun: Autopause: paused map load\n");
Expand Down

0 comments on commit 9901def

Please sign in to comment.