Skip to content

Commit 919682a

Browse files
author
CppAndre
authored
Merge pull request #24 from CppAndre/Develop
V1.0.4.1
2 parents c550abe + e52cb55 commit 919682a

31 files changed

Lines changed: 1391 additions & 1054 deletions

.gitignore

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@
1212
*.user
1313
*.vcproj
1414
*.vcxproj
15-
Added.txt
1615
examples/
1716
ReadMe.rtf
1817
src/.vs/

Configs/MapScript/salvage.cfg

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,4 @@
33

44

55
pr_hud_custom 1
6-
pr_hud_custom_text 1623/2724
6+
pr_hud_custom_text 1623 / 2724

Configs/PreyRun.cfg

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// PreyRun V.1.0.4 Standard Config
1+
// PreyRun V.1.0.5 Standard Config
22
//
33

44
// RTA - Real Time Attack settings

src/Prey/ai_sphereboss.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,10 @@ class hhSphereBoss : public hhMonsterAI {
3737
void Event_DirectMoveToPosition(const idVec3 &pos);
3838
void Event_SpinClouds( float shouldSpin );
3939
void Event_SetSeekScale( float new_scale );
40+
41+
// PreyRun BEGIN
42+
bool IsShielded() const { return AI_CAN_DAMAGE == 0; };
43+
// PreyRun END
4044
protected:
4145
idScriptBool AI_FACE_ENEMY;
4246
idScriptBool AI_CAN_DAMAGE;

src/Prey/game_player.cpp

Lines changed: 334 additions & 235 deletions
Large diffs are not rendered by default.

src/Prey/game_player.h

Lines changed: 68 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -41,26 +41,81 @@ class hhPossessedTommy;
4141
#include "../PreyRun/Constants.hpp"
4242
#include "../PreyRun/Hooking.hpp"
4343
#include "../PreyRun/GameTimer.hpp"
44+
#include "../game/Game_local.h"
4445

45-
constexpr int PR_AMMOPOS_X{ 550 };
46-
constexpr int PR_AMMOPOS_Y{ 448 };
47-
constexpr int PR_AMMOPOS2_Y{ PR_AMMOPOS_Y + 15 };
46+
constexpr int PR_hud_std_y_offset{ 15 };
4847

49-
constexpr int PR_keys_x{300};
50-
constexpr int PR_keys_y{250};
51-
constexpr int PR_keys_y2{PR_keys_y + 15};
48+
constexpr int PR_ammopos_x{ 550 };
49+
constexpr int PR_ammopos_y{ 448 };
50+
constexpr int PR_ammopos2_y{ PR_ammopos_y + PR_hud_std_y_offset };
5251

53-
idVec4 const PR_COLOUR_WHITE{ 1.0F, 1.0F, 1.0F, 1.0F };
54-
idVec4 const PR_COLOUR_YELLOW{ 1.0F, 1.0F, 0.25F, 1.0F };
55-
idVec4 const PR_COLOUR_RED{ 1.0F, 0.0F, 0.0F, 1.0F };
56-
idVec4 const PR_COLOUR_GREY{ 0.65F, 0.65F, 0.65F, 0.65F };
52+
constexpr int PR_ammo_vehicle_shot_cost{ 3500 };
53+
54+
constexpr double PR_jumpspeed_fade_factor{ 0.02f };
55+
56+
constexpr int PR_location_x{ 0 };
57+
constexpr int PR_location_y{ 45 };
58+
59+
constexpr int PR_velocity_x{ 500 };
60+
constexpr int PR_velocity_y{ 20 };
61+
62+
constexpr int PR_viewangles_x{ 0 };
63+
constexpr int PR_viewangles_y{ 0 };
64+
65+
constexpr int PR_entinfo_offset{ -15 };
66+
constexpr int PR_entinfo_x{ 360 };
67+
constexpr int PR_entinfo_y{ 235 };
68+
69+
constexpr int PR_distance_y{ 220 };
70+
71+
constexpr int PR_health_x{ 70 };
72+
constexpr int PR_health_y{ 448 };
73+
74+
constexpr int PR_spiritpower_x{ 70 };
75+
constexpr int PR_spiritpower_y{ PR_health_y - PR_hud_std_y_offset };
76+
77+
constexpr int PR_keys_x{ 300 };
78+
constexpr int PR_keys_y{ 250 };
79+
constexpr int PR_keys_y2{ PR_keys_y + PR_hud_std_y_offset };
80+
81+
// Reflex
82+
constexpr int PR_keys_reflex_x{ PR_keys_x + 5 };
83+
constexpr int PR_keys_reflex_f_y{ 220 };
84+
constexpr int PR_keys_reflex_lr_y{ PR_keys_reflex_f_y + 10 };
85+
constexpr int PR_keys_reflex_bdj_y{ PR_keys_reflex_f_y + 25 };
86+
87+
// Momentum
88+
constexpr int PR_keys_momentum_fb_x{ 600 };
89+
constexpr int PR_keys_momentum_lrjd_x{ PR_keys_momentum_fb_x + 5 };
90+
91+
constexpr int PR_keys_momentum_y_offset{ 15 };
92+
93+
constexpr int PR_keys_momentum_f_y{ 245 };
94+
constexpr int PR_keys_momentum_lr_y{ PR_keys_momentum_f_y + 1 * PR_keys_momentum_y_offset };
95+
constexpr int PR_keys_momentum_b_y{ PR_keys_momentum_f_y + 2 * PR_keys_momentum_y_offset };
96+
constexpr int PR_keys_momentum_j_y{ PR_keys_momentum_f_y + 3 * PR_keys_momentum_y_offset };
97+
constexpr int PR_keys_momentum_d_y{ PR_keys_momentum_f_y + 4 * PR_keys_momentum_y_offset };
98+
99+
constexpr float PR_traceline_distance{ 2048.00f };
100+
101+
const idVec4 PR_colour_white{ 1.00f, 1.00f, 1.00f, 1.00f };
102+
const idVec4 PR_colour_yellow{ 1.00f, 1.00f, 0.25f, 1.00f };
103+
const idVec4 PR_colour_red{ 1.00f, 0.00f, 0.00f, 1.00f };
104+
const idVec4 PR_colour_blue{ 0.00f, 0.00f, 1.00f, 1.00f };
105+
const idVec4 PR_colour_grey{ 0.65f, 0.65f, 0.65f, 0.65f };
57106

58107
#ifdef PR_DEBUG
59-
constexpr double PR_DBG_HUDDRAWTIME_YELLOW{ 0.3 };
60-
constexpr double PR_DBG_HUDDRAWTIME_RED{ 0.4 };
108+
constexpr int PR_dbg_huddrawtime_x{ 460 };
109+
constexpr int PR_dbg_huddrawtime_y{ 0 };
110+
111+
constexpr double PR_dbg_huddrawtime_yellow{ 0.30f };
112+
constexpr double PR_dbg_huddrawtime_red{ 0.40f };
113+
114+
constexpr double PR_dbg_frametime_yellow{ 1.50f };
115+
constexpr double PR_dbg_frametime_red{ 2.00f };
61116
#endif // PR_DEBUG
62117

63-
// The draw function from Prey takes floats in the range from 0.0 to 1.0 but usualy colours are represented from 0 to 255
118+
// The draw function from Prey takes floats in the range from 0.0 to 1.0 but usualy colours are represented from 0 to 255 (hex)
64119
ID_INLINE float PR_toPreyColour(float f);
65120
// PreyRun END
66121

src/Prey/game_vehicle.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1628,7 +1628,7 @@ void hhVehicle::DrawHUD(idUserInterface* _hud) {
16281628
}
16291629
}
16301630
_hud->SetStateBool("dying", health <= 0);
1631-
_hud->SetStateFloat("healthfraction", ((float)health) / (float)spawnHealth);
1631+
_hud->SetStateFloat("healthfraction", static_cast<float>(health) / static_cast<float>(spawnHealth));
16321632
_hud->SetStateFloat("powerfraction", (currentPower) / spawnArgs.GetFloat("maxPower"));
16331633
idAngles angles = GetAxis().ToAngles();
16341634
_hud->SetStateFloat("pitch", angles.pitch);

src/Prey/prey_baseweapons.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -286,7 +286,7 @@ void hhWeapon::Restore( idRestoreGame *savefile ) {
286286
if (!weaponDef) {
287287
gameLocal.Error( "Unknown weaponDef: %s\n", objectname );
288288
}
289-
dict = &(weaponDef->dict);
289+
dict = &(weaponDef->dict);
290290

291291
savefile->ReadString( icon );
292292

src/Prey/prey_game.cpp

Lines changed: 19 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ void hhGameLocal::MapShutdown(void) {
9797
pr_gametimer.Stop();
9898
Printf("PreyRun: Timer: Paused, Map Shutdown\n");
9999

100-
if (pr_preysplit.GetBool() && pr_preysplit_mapchanged && static_cast<PR_TIMER_METHODE>(pr_timer_methode.GetInteger()) == PR_TIMER_METHODE::REALTIMEATTACK)
100+
if (pr_preysplit.GetBool() && pr_preysplit_mapchanged && static_cast<PR_timer_methode>(pr_timer_methode.GetInteger()) == PR_timer_methode::REALTIMEATTACK)
101101
{
102102
pr_preysplit_mapchanged = false;
103103
pr::WriteMapChange(pr::GetTime(), static_cast<idStr>(GetMapName()));
@@ -152,12 +152,15 @@ void hhGameLocal::InitFromNewMap(const char *mapName, idRenderWorld *renderWorld
152152
Printf("PreyRunDBG: Starting Map: %s\n", mapName);
153153
#endif // PR_DEBUG
154154

155-
pr_timer_mapchanged = true;
155+
if (static_cast<PR_timer_methode> (pr_timer_methode.GetInteger()) == PR_timer_methode::INDIVIDUALLEVEL && static_cast<idStr>(gameLocal.GetMapName()) != idStr("maps/game/roadhouse.map"))
156+
{
157+
pr_gametimer_running = true;
158+
}
156159

157160
// Timer recovery
158161
pr::LoadBackupTimer(mapName);
159162

160-
// Clear all Autocmdzones when chaning level
163+
// Clear all Autocmdzones when changing level
161164
pr::AutocmdzoneHandler::getInstance().Clear();
162165

163166
// Execute map config file
@@ -757,6 +760,10 @@ gameReturn_t hhGameLocal::RunFrame(const usercmd_t *clientCmds) {
757760
// HUMANHEAD END
758761

759762
// PreyRun BEGIN
763+
#ifdef PR_DEBUG
764+
pr_dbg_frametimer.Start();
765+
#endif // PR_DEBUG
766+
760767
if (pr_freeze.GetBool())
761768
{
762769
if (pr_gametimer.IsRunning()) { pr_gametimer.Stop(); }
@@ -1014,7 +1021,7 @@ gameReturn_t hhGameLocal::RunFrame(const usercmd_t *clientCmds) {
10141021
// The command to execute is map
10151022
pr_preysplit_mapchanged = true;
10161023

1017-
if (static_cast<PR_TIMER_METHODE>(pr_timer_methode.GetInteger()) == PR_TIMER_METHODE::INDIVIDUALLEVEL && pr_gametimer_running && pr_gametimer.IsRunning() && pr_timer_autostop.GetBool())
1024+
if (static_cast<PR_timer_methode>(pr_timer_methode.GetInteger()) == PR_timer_methode::INDIVIDUALLEVEL && pr_gametimer_running && pr_gametimer.IsRunning() && pr_timer_autostop.GetBool())
10181025
{
10191026
pr_gametimer_running = false;
10201027
pr_gametimer.Stop();
@@ -1063,6 +1070,14 @@ gameReturn_t hhGameLocal::RunFrame(const usercmd_t *clientCmds) {
10631070
}
10641071
//HUMANHEAD END
10651072

1073+
// PreyRun BEGIN
1074+
#ifdef PR_DEBUG
1075+
pr_dbg_frametimer.Stop();
1076+
pr_dbg_frametimer_value = pr_dbg_frametimer.Milliseconds();
1077+
pr_dbg_frametimer.Clear();
1078+
#endif // PR_DEBUG
1079+
// PreyRun END
1080+
10661081
return ret;
10671082
}
10681083

src/PreyRun/AutoCmd.cpp

Lines changed: 24 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
#include "../idLib/precompiled.h"
22
#pragma hdrstop
33

4+
#include "PreyRun.hpp"
45
#include "AutoCmd.hpp"
56

67
namespace pr
@@ -56,14 +57,21 @@ namespace pr
5657
{
5758
static std::string const delims{ ";" };
5859

59-
auto f = [](auto &&e) {
60+
auto f = [](auto &&e)
61+
{
6062
return split(std::forward<decltype(e)>(e), delims);
6163
};
6264

6365
std::vector<std::vector<std::string>> v{};
6466
v.push_back(f(std::string(cmds.c_str())));
65-
for (auto const &vec : v) {
66-
for (auto const &str : vec) {
67+
68+
for (auto const &vec : v)
69+
{
70+
for (auto const &str : vec)
71+
{
72+
#ifdef PR_DBG_AUTOCMD
73+
gameLocal.Printf("Autocmdzone::Run(): executing '%s'\n",str.c_str());
74+
#endif // PR_DBG_AUTOCMD
6775
cmdSystem->BufferCommandText(CMD_EXEC_NOW, str.c_str());
6876
}
6977
}
@@ -79,18 +87,11 @@ namespace pr
7987
auto axis{ gameLocal.GetLocalPlayer()->viewAngles.ToMat3() };
8088

8189
idBounds bounds(pos1, pos2);
82-
83-
if (activated)
84-
{
85-
gameRenderWorld->DebugBounds(colorRed, bounds);
86-
}
87-
else
88-
{
89-
gameRenderWorld->DebugBounds(colorBlue, bounds);
90-
}
91-
9290
idStr string;
9391

92+
if (activated) { gameRenderWorld->DebugBounds(colorRed, bounds); }
93+
else { gameRenderWorld->DebugBounds(colorBlue, bounds); }
94+
9495
sprintf(string, "Autocmdzone:\n%s", cmds.c_str());
9596

9697
gameRenderWorld->DrawText(string.c_str(), bounds.GetCenter(), 0.1f, colorWhite, axis, 1);
@@ -113,12 +114,14 @@ namespace pr
113114
{
114115
if (gameLocal.GetLocalPlayer())
115116
{
117+
auto playerbounds = gameLocal.GetLocalPlayer()->GetPhysics()->GetAbsBounds();
118+
116119
for (auto it = acz.begin(); it != acz.end(); ++it)
117120
{
118121
idBounds bounds{ it->GetPos1(),it->GetPos2() };
119122

120123
// Do we intersect with the Player?
121-
if (bounds.IntersectsBounds(gameLocal.GetLocalPlayer()->GetPhysics()->GetAbsBounds()))
124+
if (bounds.IntersectsBounds(playerbounds))
122125
{
123126
it->Run();
124127
}
@@ -140,14 +143,17 @@ namespace pr
140143

141144
void AutocmdzoneHandler::Add(idVec3 pos1_, idVec3 pos2_, cmdType cmds_)
142145
{
143-
#ifdef PR_DEBUG
144-
gameLocal.Printf("AutocmdzoneHandler.Add() Adding autocmdzone: %f %f %f %f %f %f %s\n", pos1_.x, pos1_.y, pos1_.z, pos2_.x, pos2_.y, pos2_.z, cmds_.c_str());
145-
#endif // PR_DEBUG
146-
this->acz.push_back(AutocmdzoneHandler::Autocmdzone(pos1_, pos2_, cmds_));
146+
#ifdef PR_DBG_AUTOCMD
147+
gameLocal.Printf("AutocmdzoneHandler::Add() Adding autocmdzone: %f %f %f %f %f %f %s\n", pos1_.x, pos1_.y, pos1_.z, pos2_.x, pos2_.y, pos2_.z, cmds_.c_str());
148+
#endif // PR_DBG_AUTOCMD
149+
this->acz.push_back(Autocmdzone(pos1_, pos2_, cmds_));
147150
}
148151

149152
void AutocmdzoneHandler::Edit(int num, idVec3 pos1_, idVec3 pos2_, cmdType cmds_)
150153
{
154+
#ifdef PR_DBG_AUTOCMD
155+
gameLocal.Printf("AutocmdzoneHandler::Edit() editing number: %d\n",num);
156+
#endif // PR_DBG_AUTOCMD
151157
acz.at(num).SetPos1(pos1_);
152158
acz.at(num).SetPos2(pos2_);
153159
acz.at(num).SetCmds(cmds_);

0 commit comments

Comments
 (0)