- Joined
- Feb 18, 2013
- Messages
- 1,123
- Reaction score
- 176
Just 1-2 functions of an older project, helpful with modifiying handling more will follow.
Code:
SetVehicleHandlingValue<float>(560, fMass, 3500.0); // will make the sultan heavy as opcode.
Code:
enum _eHandlingOffsets {
fIndex = 0x0,//[dword] Index/Identifier
fMass = 0x4,//fMass
fMassDivide = 0x8,//1.0 / fMass
fTurnMass = 0xC,//fTurnMass
fDragMultiplier = 0x10,//fDragMult
fCenterOfMassX = 0x14,//CentreOfMass.x
fCenterOfMassY = 0x18,//CentreOfMass.y
fCenterOfMassZ = 0x1C,//CentreOfMass.z
fTractionMultiplier = 0x28,//fTractionMultiplier
nDriveType = 0x74,//[byte] TransmissionData.nDriveType
nEngineType = 0x75,//[byte] TransmissionData.nEngineType
nNumberOfGears = 0x76,//[byte] TransmissionData.nNumberOfGears
fEngineAcceleration = 0x7C,//TransmissionData.fEngineAcceleration (Multiplied by 3.9999999e-4)
fEngineInertia = 0x80,//TransmissionData.fEngineInertia
fMaxVelocity = 0x84,//TransmissionData.fMaxVelocity (Multiplied by 5.5555599e-3)
fBrakeDeceleration = 0x94,//fBrakeDeceleration (Multiplied by 3.9999999e-4)
fBrakeBias = 0x98,//fBrakeBias
bABS = 0x9C,//[byte] bABS
fSteeringLock = 0xA0,//fSteeringLock
fTractionLoss = 0xA4,//fTractionLoss
fTractionBias = 0xA8,//fTractionBias
fSuspensionForceLevel = 0xAC,//fSuspensionForceLevel
fSuspensionDampingLevel = 0xB0,//fSuspensionDampingLevel
fSuspensionHighSpdComDamp = 0xB4,//fSuspensionHighSpdComDamp
fSuspensionUpperLimit = 0xB8,//Suspension upper limit
fSuspensionLowerLimit = 0xBC,// Suspension lower limit
fSuspensionbetfar = 0xC0,//Suspension bias between front and rear
fSuspensionAntiDriveMul = 0xC4,//Suspension anti-dive multiplier
fCollisionDamageMultiplier = 0xC8,//fCollisionDamageMultiplier (multiplier not yet found)
modelFlags = 0xCC,//[hex] modelFlags
handlingFlags = 0xD0,//[hex] handlingFlags
fSeatOffsetDistance = 0xD4,//fSeatOffsetDistance
nMonetaryValue = 0xD8,//[dword] nMonetaryValue
fFrontLights = 0xDC,//[byte] Front lights
fRearLights = 0xDD,//[byte] Rear lights
fAnimGroup = 0xDE//[byte] Vehicle anim group
};
template <class T>
void SetVehicleHandlingValue(short iVehID, DWORD dwOffset, T value) {
DWORD dwAddr = iVehID - 400;
dwAddr *= 0x308;
dwAddr += 0xB1F650;
dwAddr += 0x4E;
dwAddr = *(short*)dwAddr;
dwAddr *= 0xE0;
dwAddr += 0xC2B9DC;
*(T*)(dwAddr + dwOffset) = value;
}
template <class T>
T GetVehicleHandlingValue(short iVehID, DWORD dwOffset) {
DWORD dwAddr = iVehID - 400;
dwAddr *= 0x308;
dwAddr += 0xB1F650;
dwAddr += 0x4E;
dwAddr = *(short*)dwAddr;
dwAddr *= 0xE0;
dwAddr += 0xC2B9DC;
return *(T*)(dwAddr + dwOffset);
}