Skip to content

Commit 27e4b5a

Browse files
committed
Fixed bugs, added features (8 JAN 22)
Fixed LightX changing light width Added ability to change light width Enabled Patriot to be used as a variation on cop cars
1 parent 2379f5a commit 27e4b5a

4 files changed

Lines changed: 23 additions & 17 deletions

File tree

ModelVariations/LogUtil.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
#include <string>
55
#include <iostream>
66

7-
#define MOD_VERSION "5.0"
7+
#define MOD_VERSION "5.1"
88
#ifdef _DEBUG
99
#define MOD_NAME "ModelVariations_d.asi"
1010
#else

ModelVariations/ModelVariations.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ std::map<short, std::vector<short>> vehPassengerGroups[9];
4848
std::map<short, BYTE> modelNumGroups;
4949
std::map<short, BYTE> pedWepVariationTypes;
5050
std::map<unsigned int, std::pair<void*, void*>> hookedCalls;
51-
std::map<int, CVector> LightPositions;
51+
std::map<short, std::pair<CVector, float>> LightPositions;
5252

5353
std::vector<short> vehCurrentVariations[212];
5454
std::vector<short> pedCurrentVariations[300];
@@ -93,7 +93,7 @@ bool isGameModelPolice(int model)
9393
case 430: //Predator
9494
case 432: //Rhino
9595
case 433: //Barracks
96-
case 470: //Patriot
96+
//case 470: //Patriot
9797
case 490: //FBI Rancher
9898
case 496: //Police Maverick
9999
case 523: //HPV1000

ModelVariations/Vehicles.cpp

Lines changed: 18 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -218,12 +218,13 @@ void readVehicleIni()
218218
{
219219
if (enableLights)
220220
{
221+
float lightWidth = iniVeh.ReadFloat(std::to_string(i), "LightWidth", -999.0);
221222
float lightX = iniVeh.ReadFloat(std::to_string(i), "LightX", -999.0);
222223
float lightY = iniVeh.ReadFloat(std::to_string(i), "LightY", -999.0);
223224
float lightZ = iniVeh.ReadFloat(std::to_string(i), "LightZ", -999.0);
224225

225226
if (lightX > -900.0 || lightY > -900.0 || lightZ > -900.0)
226-
LightPositions.insert({ i, { lightX, lightY, lightZ } });
227+
LightPositions.insert({ (short)i, {{ lightX, lightY, lightZ }, lightWidth} });
227228
}
228229
int numGroups = 0;
229230
for (int j = 0; j < 9; j++)
@@ -720,12 +721,14 @@ void __cdecl RegisterCoronaHooked(CCoronas* _this, unsigned int a2, CEntity* a3,
720721
auto it = LightPositions.find(lightsModel);
721722
if (it != LightPositions.end())
722723
{
723-
if (it->second.x > -900.0)
724-
a7->x *= it->second.x;
725-
if (it->second.y > -900.0)
726-
a7->y *= it->second.y;
727-
if (it->second.z > -900.0)
728-
a7->z *= it->second.z;
724+
if (it->second.second > -900.0)
725+
a7->x *= it->second.second;
726+
if (it->second.first.x > -900.0)
727+
a7->x += it->second.first.x;
728+
if (it->second.first.y > -900.0)
729+
a7->y *= it->second.first.y;
730+
if (it->second.first.z > -900.0)
731+
a7->z *= it->second.first.z;
729732
}
730733
}
731734
callOriginal<address>(_this, a2, a3, a4, a5, a6, a7, a8, a9, texture, a11, a12, a13, a14, a15, a16, a17, a18, a19, a20, a21);
@@ -740,12 +743,14 @@ void __cdecl AddLightHooked(char type, float x, float y, float z, float dir_x, f
740743
auto it = LightPositions.find(lightsModel);
741744
if (it != LightPositions.end())
742745
{
743-
if (it->second.x > -900.0)
744-
x *= it->second.x;
745-
if (it->second.y > -900.0)
746-
y *= it->second.y;
747-
if (it->second.z > -900.0)
748-
z *= it->second.z;
746+
if (it->second.second > -900.0)
747+
x *= it->second.second;
748+
if (it->second.first.x > -900.0)
749+
x += it->second.first.x;
750+
if (it->second.first.y > -900.0)
751+
y *= it->second.first.y;
752+
if (it->second.first.z > -900.0)
753+
z *= it->second.first.z;
749754
}
750755
}
751756

ModelVariations/Vehicles.hpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
#include "CPed.h"
66
#include "CVector.h"
77

8+
#include <set>
89
#include <vector>
910
#include <unordered_set>
1011

@@ -20,7 +21,7 @@ extern std::map<short, std::vector<short>> vehPassengers;
2021
extern std::map<short, std::vector<short>> vehDriverGroups[9];
2122
extern std::map<short, std::vector<short>> vehPassengerGroups[9];
2223
extern std::map<short, BYTE> modelNumGroups;
23-
extern std::map<int, CVector> LightPositions;
24+
extern std::map<short, std::pair<CVector, float>> LightPositions;
2425

2526
extern std::vector<short> vehCurrentVariations[212];
2627
extern std::map<short, short> vehOriginalModels;

0 commit comments

Comments
 (0)