mirror of
https://github.com/GTAmodding/re3.git
synced 2024-11-15 20:09:00 +00:00
Fix sin & cos calls
This commit is contained in:
parent
f2c8522daa
commit
6e4a2947ea
4 changed files with 17 additions and 17 deletions
|
@ -1581,8 +1581,8 @@ void CCarCtrl::WeaveForOtherCar(CEntity* pOtherEntity, CVehicle* pVehicle, float
|
||||||
forward.Normalise();
|
forward.Normalise();
|
||||||
float forwardAngle = CGeneral::GetATanOfXY(forward.x, forward.y);
|
float forwardAngle = CGeneral::GetATanOfXY(forward.x, forward.y);
|
||||||
float angleDiff = angleBetweenVehicles - forwardAngle;
|
float angleDiff = angleBetweenVehicles - forwardAngle;
|
||||||
float lenProjection = ABS(pOtherCar->GetColModel()->boundingBox.max.y * sin(angleDiff));
|
float lenProjection = ABS(pOtherCar->GetColModel()->boundingBox.max.y * Sin(angleDiff));
|
||||||
float widthProjection = ABS(pOtherCar->GetColModel()->boundingBox.max.x * cos(angleDiff));
|
float widthProjection = ABS(pOtherCar->GetColModel()->boundingBox.max.x * Cos(angleDiff));
|
||||||
float lengthToEvade = (2 * (lenProjection + widthProjection) + WIDTH_COEF_TO_WEAVE_SAFELY * 2 * pVehicle->GetColModel()->boundingBox.max.x) / distance;
|
float lengthToEvade = (2 * (lenProjection + widthProjection) + WIDTH_COEF_TO_WEAVE_SAFELY * 2 * pVehicle->GetColModel()->boundingBox.max.x) / distance;
|
||||||
float diffToLeftAngle = LimitRadianAngle(angleBetweenVehicles - *pAngleToWeaveLeft);
|
float diffToLeftAngle = LimitRadianAngle(angleBetweenVehicles - *pAngleToWeaveLeft);
|
||||||
diffToLeftAngle = ABS(diffToLeftAngle);
|
diffToLeftAngle = ABS(diffToLeftAngle);
|
||||||
|
|
|
@ -431,8 +431,8 @@ int8 CRunningScript::ProcessCommands300To399(int32 command)
|
||||||
float length = *(float*)&ScriptParams[5];
|
float length = *(float*)&ScriptParams[5];
|
||||||
float x, y;
|
float x, y;
|
||||||
if (angle != 0.0f){
|
if (angle != 0.0f){
|
||||||
y = cos(angle) * length;
|
y = Cos(angle) * length;
|
||||||
x = sin(angle) * length;
|
x = Sin(angle) * length;
|
||||||
}else{
|
}else{
|
||||||
y = length;
|
y = length;
|
||||||
x = 0.0f;
|
x = 0.0f;
|
||||||
|
|
|
@ -1006,10 +1006,10 @@ void CRunningScript::PlayerInAngledAreaCheckCommand(int32 command, uint32* pIp)
|
||||||
initAngle -= TWOPI;
|
initAngle -= TWOPI;
|
||||||
// it looks like the idea is to use a rectangle using the diagonal of the rectangle as
|
// it looks like the idea is to use a rectangle using the diagonal of the rectangle as
|
||||||
// the side of new rectangle, with "length" being the length of second side
|
// the side of new rectangle, with "length" being the length of second side
|
||||||
float rotatedSupX = supX + side2length * sin(initAngle);
|
float rotatedSupX = supX + side2length * Sin(initAngle);
|
||||||
float rotatedSupY = supY - side2length * cos(initAngle);
|
float rotatedSupY = supY - side2length * Cos(initAngle);
|
||||||
float rotatedInfX = infX + side2length * sin(initAngle);
|
float rotatedInfX = infX + side2length * Sin(initAngle);
|
||||||
float rotatedInfY = infY - side2length * cos(initAngle);
|
float rotatedInfY = infY - side2length * Cos(initAngle);
|
||||||
float side1X = supX - infX;
|
float side1X = supX - infX;
|
||||||
float side1Y = supY - infY;
|
float side1Y = supY - infY;
|
||||||
float side1Length = CVector2D(side1X, side1Y).Magnitude();
|
float side1Length = CVector2D(side1X, side1Y).Magnitude();
|
||||||
|
|
|
@ -4952,9 +4952,9 @@ CCam::Process_FollowCar_SA(const CVector& CameraTarget, float TargetOrientation,
|
||||||
AlphaSpeed = 0.0;
|
AlphaSpeed = 0.0;
|
||||||
Distance = 1000.0;
|
Distance = 1000.0;
|
||||||
|
|
||||||
Front.x = -(cos(Beta) * cos(Alpha));
|
Front.x = -(Cos(Beta) * Cos(Alpha));
|
||||||
Front.y = -(sin(Beta) * cos(Alpha));
|
Front.y = -(Sin(Beta) * Cos(Alpha));
|
||||||
Front.z = sin(Alpha);
|
Front.z = Sin(Alpha);
|
||||||
|
|
||||||
m_aTargetHistoryPosOne = TargetCoors - nextDistance * Front;
|
m_aTargetHistoryPosOne = TargetCoors - nextDistance * Front;
|
||||||
|
|
||||||
|
@ -5228,9 +5228,9 @@ CCam::Process_FollowCar_SA(const CVector& CameraTarget, float TargetOrientation,
|
||||||
|
|
||||||
lastBeta = Beta;
|
lastBeta = Beta;
|
||||||
|
|
||||||
Front.x = -(cos(Beta) * cos(Alpha));
|
Front.x = -(Cos(Beta) * Cos(Alpha));
|
||||||
Front.y = -(sin(Beta) * cos(Alpha));
|
Front.y = -(Sin(Beta) * Cos(Alpha));
|
||||||
Front.z = sin(Alpha);
|
Front.z = Sin(Alpha);
|
||||||
GetVectorsReadyForRW();
|
GetVectorsReadyForRW();
|
||||||
TheCamera.m_bCamDirectlyBehind = false;
|
TheCamera.m_bCamDirectlyBehind = false;
|
||||||
TheCamera.m_bCamDirectlyInFront = false;
|
TheCamera.m_bCamDirectlyInFront = false;
|
||||||
|
@ -5240,9 +5240,9 @@ CCam::Process_FollowCar_SA(const CVector& CameraTarget, float TargetOrientation,
|
||||||
m_cvecTargetCoorsForFudgeInter = TargetCoors;
|
m_cvecTargetCoorsForFudgeInter = TargetCoors;
|
||||||
m_aTargetHistoryPosThree = m_aTargetHistoryPosOne;
|
m_aTargetHistoryPosThree = m_aTargetHistoryPosOne;
|
||||||
float nextAlpha = alphaWithSpeedAccounted + zoomModeAlphaOffset;
|
float nextAlpha = alphaWithSpeedAccounted + zoomModeAlphaOffset;
|
||||||
float nextFrontX = -(cos(Beta) * cos(nextAlpha));
|
float nextFrontX = -(Cos(Beta) * Cos(nextAlpha));
|
||||||
float nextFrontY = -(sin(Beta) * cos(nextAlpha));
|
float nextFrontY = -(Sin(Beta) * Cos(nextAlpha));
|
||||||
float nextFrontZ = sin(nextAlpha);
|
float nextFrontZ = Sin(nextAlpha);
|
||||||
|
|
||||||
m_aTargetHistoryPosOne.x = TargetCoors.x - nextFrontX * nextDistance;
|
m_aTargetHistoryPosOne.x = TargetCoors.x - nextFrontX * nextDistance;
|
||||||
m_aTargetHistoryPosOne.y = TargetCoors.y - nextFrontY * nextDistance;
|
m_aTargetHistoryPosOne.y = TargetCoors.y - nextFrontY * nextDistance;
|
||||||
|
|
Loading…
Reference in a new issue