summaryrefslogtreecommitdiffstats
path: root/src/core
diff options
context:
space:
mode:
authoreray orçunus <erayorcunus@gmail.com>2019-08-10 17:15:22 +0200
committereray orçunus <erayorcunus@gmail.com>2019-08-11 19:31:36 +0200
commitbe1c7b0761c2de0362a47ecfff616a8931b54805 (patch)
tree2f0c6d7eac06333b4f04eb3002700e4c3d067f34 /src/core
parentfinished CPathFind (diff)
downloadre3-be1c7b0761c2de0362a47ecfff616a8931b54805.tar
re3-be1c7b0761c2de0362a47ecfff616a8931b54805.tar.gz
re3-be1c7b0761c2de0362a47ecfff616a8931b54805.tar.bz2
re3-be1c7b0761c2de0362a47ecfff616a8931b54805.tar.lz
re3-be1c7b0761c2de0362a47ecfff616a8931b54805.tar.xz
re3-be1c7b0761c2de0362a47ecfff616a8931b54805.tar.zst
re3-be1c7b0761c2de0362a47ecfff616a8931b54805.zip
Diffstat (limited to 'src/core')
-rw-r--r--src/core/General.h15
-rw-r--r--src/core/re3.cpp16
2 files changed, 31 insertions, 0 deletions
diff --git a/src/core/General.h b/src/core/General.h
index fe277689..12f781d4 100644
--- a/src/core/General.h
+++ b/src/core/General.h
@@ -96,6 +96,21 @@ public:
}
}
+ // should return direction in 0-8 range. fits perfectly to peds' path directions.
+ static int CGeneral::GetNodeHeadingFromVector(float x, float y)
+ {
+ float angle = CGeneral::GetRadianAngleBetweenPoints(x, y, 0.0f, 0.0f);
+ if (angle < 0.0f)
+ angle += TWOPI;
+
+ angle = DEGTORAD(22.5f) + TWOPI - angle;
+
+ if (angle >= TWOPI)
+ angle -= TWOPI;
+
+ return (int)floorf(angle / DEGTORAD(45.0f));
+ }
+
// not too sure about all these...
static uint16 GetRandomNumber(void)
{ return myrand() & MYRAND_MAX; }
diff --git a/src/core/re3.cpp b/src/core/re3.cpp
index 9fe53579..dc501075 100644
--- a/src/core/re3.cpp
+++ b/src/core/re3.cpp
@@ -140,6 +140,20 @@ SpawnCar(int id)
}
static void
+LetThemFollowYou(void) {
+ CPed* player = (CPed*) FindPlayerPed();
+ for (int i = 0; i < player->m_numNearPeds; i++) {
+
+ CPed* nearPed = player->m_nearPeds[i];
+ if (nearPed && !nearPed->IsPlayer()) {
+ nearPed->SetObjective(OBJECTIVE_FOLLOW_PED_IN_FORMATION, (void*)player);
+ nearPed->m_pedFormation = rand() & 7;
+ nearPed->bScriptObjectiveCompleted = false;
+ }
+ }
+}
+
+static void
FixCar(void)
{
CVehicle *veh = FindPlayerVehicle();
@@ -335,6 +349,8 @@ DebugMenuPopulate(void)
DebugMenuAddVarBool8("Debug", "Don't render Peds", (int8*)&gbDontRenderPeds, nil);
DebugMenuAddVarBool8("Debug", "Don't render Vehicles", (int8*)&gbDontRenderVehicles, nil);
DebugMenuAddVarBool8("Debug", "Don't render Objects", (int8*)&gbDontRenderObjects, nil);
+
+ DebugMenuAddCmd("Debug", "Make peds around you follow you", LetThemFollowYou);
#ifndef FINAL
DebugMenuAddVarBool8("Debug", "Toggle unused fight feature", (int8*)&CPed::bUnusedFightThingOnPlayer, nil);
#endif