summaryrefslogtreecommitdiff
path: root/src/peds/PedRoutes.cpp
diff options
context:
space:
mode:
authorclaude-bot <[email protected]>2026-07-13 12:27:07 +0000
committerclaude-bot <[email protected]>2026-07-13 12:27:07 +0000
commit9f61c9e6ac6b1ac5692cf6352d2ebbd47a31a686 (patch)
treea84756b82513739a2672db3a1f0ec579db6d18ff /src/peds/PedRoutes.cpp
downloadre3-miami.tar.gz
re3-miami.zip
Import Cai1Hsu/re3 @ miami (reVC / GTA:VC decompilation)HEADmiami
Snapshot import (no upstream history) into git.ancap.in.ua/claude, per @lzcnt. Source: https://github.com/Cai1Hsu/re3 branch miami.
Diffstat (limited to 'src/peds/PedRoutes.cpp')
-rw-r--r--src/peds/PedRoutes.cpp79
1 files changed, 79 insertions, 0 deletions
diff --git a/src/peds/PedRoutes.cpp b/src/peds/PedRoutes.cpp
new file mode 100644
index 0000000..3ff080e
--- /dev/null
+++ b/src/peds/PedRoutes.cpp
@@ -0,0 +1,79 @@
+#include "common.h"
+
+#include "main.h"
+#include "PedRoutes.h"
+
+CRouteNode gaRoutes[NUMPEDROUTES];
+
+void
+CRouteNode::Initialise()
+{
+ for (int i = 0; i < NUMPEDROUTES; i++) {
+ gaRoutes[i].m_route = -1;
+ gaRoutes[i].m_pos = CVector(0.0f, 0.0f, 0.0f);
+ }
+}
+
+int16
+CRouteNode::GetRouteThisPointIsOn(int16 point)
+{
+ return gaRoutes[point].m_route;
+}
+
+// Actually GetFirstPointOfRoute
+int16
+CRouteNode::GetRouteStart(int16 route)
+{
+ for (int i = 0; i < NUMPEDROUTES; i++) {
+ if (route == gaRoutes[i].m_route)
+ return i;
+ }
+ return -1;
+}
+
+CVector
+CRouteNode::GetPointPosition(int16 point)
+{
+ return gaRoutes[point].m_pos;
+}
+
+void
+CRouteNode::AddRoutePoint(int16 route, CVector pos)
+{
+ uint16 point;
+ for (point = 0; point < NUMPEDROUTES; point++) {
+ if (gaRoutes[point].m_route == -1)
+ break;
+ }
+#ifdef FIX_BUGS
+ if (point == NUMPEDROUTES)
+ return;
+#endif
+ gaRoutes[point].m_route = route;
+ gaRoutes[point].m_pos = pos;
+}
+
+void
+CRouteNode::RemoveRoute(int16 route)
+{
+ uint16 first_point, last_point, i;
+ for (first_point = 0; first_point < NUMPEDROUTES; first_point++) {
+ if (gaRoutes[first_point].m_route == route)
+ break;
+ }
+ if (first_point == NUMPEDROUTES)
+ return;
+ for (last_point = first_point; last_point < NUMPEDROUTES; last_point++)
+ if (gaRoutes[last_point].m_route != route)
+ break;
+ uint16 diff = last_point - first_point;
+#ifdef FIX_BUGS
+ for (i = first_point; i < NUMPEDROUTES - diff; i++)
+ gaRoutes[i] = gaRoutes[i + diff];
+#else
+ for (i = 0; i < diff; i++)
+ gaRoutes[first_point + i] = gaRoutes[last_point + i];
+#endif
+ for (i = NUMPEDROUTES - diff; i < NUMPEDROUTES; i++)
+ gaRoutes[i].m_route = -1;
+}