From d4cdb48ddff1dd0bfd50fbb4f25c8f7c1a9fd944 Mon Sep 17 00:00:00 2001 From: InspirationByte Date: Thu, 3 Feb 2022 23:57:39 +0300 Subject: [PATCH] - misc changes --- src_rebuild/DebugOverlay.cpp | 9 ++------- src_rebuild/Game/C/civ_ai.c | 6 ++---- src_rebuild/Game/C/gamesnd.c | 10 +++++----- src_rebuild/Game/dr2math.h | 14 ++++++++++++++ 4 files changed, 23 insertions(+), 16 deletions(-) diff --git a/src_rebuild/DebugOverlay.cpp b/src_rebuild/DebugOverlay.cpp index 2986884e..bd4a6377 100644 --- a/src_rebuild/DebugOverlay.cpp +++ b/src_rebuild/DebugOverlay.cpp @@ -40,13 +40,8 @@ void DrawDebugOverlays() gte_SetRotMatrix(&inv_camera_matrix); SVECTOR a, b; - a.vx = ld.posA.vx - camera_position.vx; - a.vy = ld.posA.vy - camera_position.vy; - a.vz = ld.posA.vz - camera_position.vz; - - b.vx = ld.posB.vx - camera_position.vx; - b.vy = ld.posB.vy - camera_position.vy; - b.vz = ld.posB.vz - camera_position.vz; + VecSubtract(&a, &ld.posA, &camera_position); + VecSubtract(&b, &ld.posB, &camera_position); gte_ldv3(&a, &b, &b); diff --git a/src_rebuild/Game/C/civ_ai.c b/src_rebuild/Game/C/civ_ai.c index da352d0d..b5a037f9 100644 --- a/src_rebuild/Game/C/civ_ai.c +++ b/src_rebuild/Game/C/civ_ai.c @@ -2172,8 +2172,8 @@ int PingInCivCar(int minPingInDist) } else { - i = 0; - while (i < numLanes) + + for (i = 0; i < numLanes; i++) { // collect the lanes. allowedToPark = ROAD_IS_PARKING_ALLOWED_AT(&roadInfo, i); @@ -2186,8 +2186,6 @@ int PingInCivCar(int minPingInDist) // pick only non-parkable driveable lanes if parked cars not requested if (tryPingInParkedCars && allowedToPark || ROAD_IS_AI_LANE(&roadInfo, i) && !allowedToPark) possibleLanes[numPossibleLanes++] = i; - - i++; } if (numPossibleLanes == 0) diff --git a/src_rebuild/Game/C/gamesnd.c b/src_rebuild/Game/C/gamesnd.c index 2709935b..1ed5e8a0 100644 --- a/src_rebuild/Game/C/gamesnd.c +++ b/src_rebuild/Game/C/gamesnd.c @@ -2059,7 +2059,7 @@ void IdentifyZone(envsound* ep, envsoundinfo* E, int pl) int tmp[4]; float _g[4]; - __bitfield64 zones; + bitfield64 zones; int snd; // [A] does it really needed? we don't have that much sounds to be played @@ -2123,9 +2123,9 @@ void IdentifyZone(envsound* ep, envsoundinfo* E, int pl) if (dist < vol) { if (i < 32) - zones.l |= 1 << (i & 0x1f); + zones.l |= 1 << (i & 31); else - zones.h |= 1 << (i & 0x1f); + zones.h |= 1 << (i & 31); tmp[j] = i; @@ -2137,9 +2137,9 @@ void IdentifyZone(envsound* ep, envsoundinfo* E, int pl) else { if (i < 32) - zones.l |= 1 << (i & 0x1f); + zones.l |= 1 << (i & 31); else - zones.h |= 1 << (i & 0x1f); + zones.h |= 1 << (i & 31); tmp[j] = i; j++; diff --git a/src_rebuild/Game/dr2math.h b/src_rebuild/Game/dr2math.h index 00ae9ea1..1cbed399 100644 --- a/src_rebuild/Game/dr2math.h +++ b/src_rebuild/Game/dr2math.h @@ -47,6 +47,20 @@ extern short rcossin_tbl[8192]; #define RemapVal( val, A, B, C, D) \ (C + (D - C) * (val - A) / (B - A)) +#define VecCopy(_v, _xyz) \ +{ \ + (_v)->vx = (_xyz)->vx; \ + (_v)->vy = (_xyz)->vy; \ + (_v)->vz = (_xyz)->vz; \ +} + +#define VecNegate(_v) \ +{ \ + (_v)->vx = -(_v)->vx; \ + (_v)->vy = -(_v)->vy; \ + (_v)->vz = -(_v)->vz; \ +} + #define SetVec(_v, _x, _y, _z) \ { \ (_v)->vx = _x; \