mirror of
https://gitlab.com/GaryOderNichts/re3-wiiu.git
synced 2024-11-26 19:14:15 +01:00
Merge remote-tracking branch 'origin/master' into opus
This commit is contained in:
commit
e4f136344c
@ -6212,7 +6212,7 @@ int8 CRunningScript::ProcessCommands700To799(int32 command)
|
|||||||
}
|
}
|
||||||
CCranes::ActivateCrane(infX, supX, infY, supY,
|
CCranes::ActivateCrane(infX, supX, infY, supY,
|
||||||
*(float*)&ScriptParams[6], *(float*)&ScriptParams[7], *(float*)&ScriptParams[8],
|
*(float*)&ScriptParams[6], *(float*)&ScriptParams[7], *(float*)&ScriptParams[8],
|
||||||
DEGTORAD(*(float*)&ScriptParams[8]), true, false,
|
DEGTORAD(*(float*)&ScriptParams[9]), true, false,
|
||||||
*(float*)&ScriptParams[0], *(float*)&ScriptParams[1]);
|
*(float*)&ScriptParams[0], *(float*)&ScriptParams[1]);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -137,9 +137,13 @@ DoRWStuffStartOfFrame(int16 TopRed, int16 TopGreen, int16 TopBlue, int16 BottomR
|
|||||||
CRGBA TopColor(TopRed, TopGreen, TopBlue, Alpha);
|
CRGBA TopColor(TopRed, TopGreen, TopBlue, Alpha);
|
||||||
CRGBA BottomColor(BottomRed, BottomGreen, BottomBlue, Alpha);
|
CRGBA BottomColor(BottomRed, BottomGreen, BottomBlue, Alpha);
|
||||||
|
|
||||||
|
#ifndef ASPECT_RATIO_SCALE
|
||||||
|
CameraSize(Scene.camera, nil, SCREEN_VIEWWINDOW, (CMenuManager::m_PrefsUseWideScreen ? 16.f / 9.f : 4.f / 3.f));
|
||||||
|
#else
|
||||||
CameraSize(Scene.camera, nil, SCREEN_VIEWWINDOW, SCREEN_ASPECT_RATIO);
|
CameraSize(Scene.camera, nil, SCREEN_VIEWWINDOW, SCREEN_ASPECT_RATIO);
|
||||||
|
#endif
|
||||||
CVisibilityPlugins::SetRenderWareCamera(Scene.camera);
|
CVisibilityPlugins::SetRenderWareCamera(Scene.camera);
|
||||||
RwCameraClear(Scene.camera, &gColourTop, rwCAMERACLEARZ);
|
RwCameraClear(Scene.camera, &TopColor.rwRGBA, rwCAMERACLEARZ);
|
||||||
|
|
||||||
if(!RsCameraBeginUpdate(Scene.camera))
|
if(!RsCameraBeginUpdate(Scene.camera))
|
||||||
return false;
|
return false;
|
||||||
@ -155,7 +159,11 @@ DoRWStuffStartOfFrame(int16 TopRed, int16 TopGreen, int16 TopBlue, int16 BottomR
|
|||||||
bool
|
bool
|
||||||
DoRWStuffStartOfFrame_Horizon(int16 TopRed, int16 TopGreen, int16 TopBlue, int16 BottomRed, int16 BottomGreen, int16 BottomBlue, int16 Alpha)
|
DoRWStuffStartOfFrame_Horizon(int16 TopRed, int16 TopGreen, int16 TopBlue, int16 BottomRed, int16 BottomGreen, int16 BottomBlue, int16 Alpha)
|
||||||
{
|
{
|
||||||
|
#ifndef ASPECT_RATIO_SCALE
|
||||||
|
CameraSize(Scene.camera, nil, SCREEN_VIEWWINDOW, (CMenuManager::m_PrefsUseWideScreen ? 16.f/9.f : 4.f/3.f));
|
||||||
|
#else
|
||||||
CameraSize(Scene.camera, nil, SCREEN_VIEWWINDOW, SCREEN_ASPECT_RATIO);
|
CameraSize(Scene.camera, nil, SCREEN_VIEWWINDOW, SCREEN_ASPECT_RATIO);
|
||||||
|
#endif
|
||||||
CVisibilityPlugins::SetRenderWareCamera(Scene.camera);
|
CVisibilityPlugins::SetRenderWareCamera(Scene.camera);
|
||||||
RwCameraClear(Scene.camera, &gColourTop, rwCAMERACLEARZ);
|
RwCameraClear(Scene.camera, &gColourTop, rwCAMERACLEARZ);
|
||||||
|
|
||||||
|
@ -227,7 +227,7 @@ CPlayerPed::SetInitialState(void)
|
|||||||
{
|
{
|
||||||
m_bAdrenalineActive = false;
|
m_bAdrenalineActive = false;
|
||||||
m_nAdrenalineTime = 0;
|
m_nAdrenalineTime = 0;
|
||||||
CTimer::SetTimeStep(1.0f);
|
CTimer::SetTimeScale(1.0f);
|
||||||
m_pSeekTarget = nil;
|
m_pSeekTarget = nil;
|
||||||
m_vecSeekPos = { 0.0f, 0.0f, 0.0f };
|
m_vecSeekPos = { 0.0f, 0.0f, 0.0f };
|
||||||
m_fleeFromPosX = 0.0f;
|
m_fleeFromPosX = 0.0f;
|
||||||
|
@ -175,7 +175,7 @@ CAutomobile::CAutomobile(int32 id, uint8 CreatedBy)
|
|||||||
m_nNumPassengers = 0;
|
m_nNumPassengers = 0;
|
||||||
|
|
||||||
m_bombType = CARBOMB_NONE;
|
m_bombType = CARBOMB_NONE;
|
||||||
bHadDriver = false;
|
bDriverLastFrame = false;
|
||||||
m_pBombRigger = nil;
|
m_pBombRigger = nil;
|
||||||
|
|
||||||
if(m_nDoorLock == CARLOCK_UNLOCKED &&
|
if(m_nDoorLock == CARLOCK_UNLOCKED &&
|
||||||
@ -276,7 +276,7 @@ CAutomobile::ProcessControl(void)
|
|||||||
|
|
||||||
// Process driver
|
// Process driver
|
||||||
if(pDriver){
|
if(pDriver){
|
||||||
if(!bHadDriver && m_bombType == CARBOMB_ONIGNITIONACTIVE){
|
if(!bDriverLastFrame && m_bombType == CARBOMB_ONIGNITIONACTIVE){
|
||||||
// If someone enters the car and there is a bomb, detonate
|
// If someone enters the car and there is a bomb, detonate
|
||||||
m_nBombTimer = 1000;
|
m_nBombTimer = 1000;
|
||||||
m_pBlowUpEntity = m_pBombRigger;
|
m_pBlowUpEntity = m_pBombRigger;
|
||||||
@ -284,7 +284,7 @@ CAutomobile::ProcessControl(void)
|
|||||||
m_pBlowUpEntity->RegisterReference((CEntity**)&m_pBlowUpEntity);
|
m_pBlowUpEntity->RegisterReference((CEntity**)&m_pBlowUpEntity);
|
||||||
DMAudio.PlayOneShot(m_audioEntityId, SOUND_BOMB_TICK, 1.0f);
|
DMAudio.PlayOneShot(m_audioEntityId, SOUND_BOMB_TICK, 1.0f);
|
||||||
}
|
}
|
||||||
bHadDriver = true;
|
bDriverLastFrame = true;
|
||||||
|
|
||||||
if(IsUpsideDown() && CanPedEnterCar()){
|
if(IsUpsideDown() && CanPedEnterCar()){
|
||||||
if(!pDriver->IsPlayer() &&
|
if(!pDriver->IsPlayer() &&
|
||||||
@ -293,7 +293,7 @@ CAutomobile::ProcessControl(void)
|
|||||||
pDriver->SetObjective(OBJECTIVE_LEAVE_VEHICLE, this);
|
pDriver->SetObjective(OBJECTIVE_LEAVE_VEHICLE, this);
|
||||||
}
|
}
|
||||||
}else
|
}else
|
||||||
bHadDriver = false;
|
bDriverLastFrame = false;
|
||||||
|
|
||||||
// Process passengers
|
// Process passengers
|
||||||
if(m_nNumPassengers != 0 && IsUpsideDown() && CanPedEnterCar()){
|
if(m_nNumPassengers != 0 && IsUpsideDown() && CanPedEnterCar()){
|
||||||
@ -3928,7 +3928,7 @@ CAutomobile::SetUpWheelColModel(CColModel *colModel)
|
|||||||
|
|
||||||
if(m_aCarNodes[CAR_WHEEL_LM] != nil && m_aCarNodes[CAR_WHEEL_RM] != nil){
|
if(m_aCarNodes[CAR_WHEEL_LM] != nil && m_aCarNodes[CAR_WHEEL_RM] != nil){
|
||||||
mat.Attach(RwFrameGetMatrix(m_aCarNodes[CAR_WHEEL_LM]));
|
mat.Attach(RwFrameGetMatrix(m_aCarNodes[CAR_WHEEL_LM]));
|
||||||
colModel->spheres[4].Set(mi->m_wheelScale, mat.GetPosition(), SURFACE_TIRE, CAR_PIECE_WHEEL_RF);
|
colModel->spheres[4].Set(mi->m_wheelScale, mat.GetPosition(), SURFACE_TIRE, CAR_PIECE_WHEEL_LR);
|
||||||
mat.Attach(RwFrameGetMatrix(m_aCarNodes[CAR_WHEEL_RM]));
|
mat.Attach(RwFrameGetMatrix(m_aCarNodes[CAR_WHEEL_RM]));
|
||||||
colModel->spheres[5].Set(mi->m_wheelScale, mat.GetPosition(), SURFACE_TIRE, CAR_PIECE_WHEEL_RR);
|
colModel->spheres[5].Set(mi->m_wheelScale, mat.GetPosition(), SURFACE_TIRE, CAR_PIECE_WHEEL_RR);
|
||||||
colModel->numSpheres = 6;
|
colModel->numSpheres = 6;
|
||||||
|
@ -86,7 +86,7 @@ public:
|
|||||||
uint8 field_4D8;
|
uint8 field_4D8;
|
||||||
uint8 m_bombType : 3;
|
uint8 m_bombType : 3;
|
||||||
uint8 bTaxiLight : 1;
|
uint8 bTaxiLight : 1;
|
||||||
uint8 bHadDriver : 1; // for bombs
|
uint8 bDriverLastFrame : 1; // for bombs
|
||||||
uint8 bFixedColour : 1;
|
uint8 bFixedColour : 1;
|
||||||
uint8 bBigWheels : 1;
|
uint8 bBigWheels : 1;
|
||||||
uint8 bWaterTight : 1; // no damage for non-player peds
|
uint8 bWaterTight : 1; // no damage for non-player peds
|
||||||
|
@ -50,8 +50,8 @@ CVehicle::CVehicle(uint8 CreatedBy)
|
|||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
m_nCurrentGear = 0;
|
m_nCurrentGear = 1;
|
||||||
m_fChangeGearTime = 0;
|
m_fChangeGearTime = 0.0f;
|
||||||
m_fSteerRatio = 0.0f;
|
m_fSteerRatio = 0.0f;
|
||||||
m_type = ENTITY_TYPE_VEHICLE;
|
m_type = ENTITY_TYPE_VEHICLE;
|
||||||
VehicleCreatedBy = CreatedBy;
|
VehicleCreatedBy = CreatedBy;
|
||||||
@ -280,8 +280,8 @@ CVehicle::FlyingControl(eFlightModel flightModel)
|
|||||||
float turnSpeed = m_vecTurnSpeed.MagnitudeSqr();
|
float turnSpeed = m_vecTurnSpeed.MagnitudeSqr();
|
||||||
if(turnSpeed > SQR(0.2f))
|
if(turnSpeed > SQR(0.2f))
|
||||||
m_vecTurnSpeed *= 0.2f/Sqrt(turnSpeed);
|
m_vecTurnSpeed *= 0.2f/Sqrt(turnSpeed);
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
case FLIGHT_MODEL_RCPLANE:
|
case FLIGHT_MODEL_RCPLANE:
|
||||||
case FLIGHT_MODEL_SEAPLANE:
|
case FLIGHT_MODEL_SEAPLANE:
|
||||||
@ -294,76 +294,77 @@ CVehicle::FlyingControl(eFlightModel flightModel)
|
|||||||
fThrust += 1.0f;
|
fThrust += 1.0f;
|
||||||
else if (fForwSpeed > 0.0f && fThrust < 0.0f)
|
else if (fForwSpeed > 0.0f && fThrust < 0.0f)
|
||||||
fThrust = 0.0f;
|
fThrust = 0.0f;
|
||||||
float fThrustImpulse;
|
float fThrustAccel;
|
||||||
if (flightModel == FLIGHT_MODEL_RCPLANE)
|
if (flightModel == FLIGHT_MODEL_RCPLANE)
|
||||||
fThrustImpulse = (fThrust - fRCPropFallOff * fForwSpeed) * fRCAeroThrust;
|
fThrustAccel = (fThrust - fRCPropFallOff * fForwSpeed) * fRCAeroThrust;
|
||||||
else
|
else
|
||||||
fThrustImpulse = (fThrust - fSeaPropFallOff * fForwSpeed) * fSeaThrust;
|
fThrustAccel = (fThrust - fSeaPropFallOff * fForwSpeed) * fSeaThrust;
|
||||||
ApplyMoveForce(fThrustImpulse * GetForward() * m_fMass * CTimer::GetTimeStep());
|
ApplyMoveForce(fThrustAccel * GetForward() * m_fMass * CTimer::GetTimeStep());
|
||||||
|
|
||||||
// left/right
|
// left/right
|
||||||
float fSideSpeed = -DotProduct(GetMoveSpeed(), GetRight());
|
float fSideSpeed = -DotProduct(GetMoveSpeed(), GetRight());
|
||||||
float fSteerLR = CPad::GetPad(0)->GetSteeringLeftRight() / 128.0f;
|
float fSteerLR = CPad::GetPad(0)->GetSteeringLeftRight() / 128.0f;
|
||||||
float fSideSlipImpulse;
|
float fSideSlipAccel;
|
||||||
if (flightModel == FLIGHT_MODEL_RCPLANE)
|
if (flightModel == FLIGHT_MODEL_RCPLANE)
|
||||||
fSideSlipImpulse = Abs(fSideSpeed) * fSideSpeed * fRCSideSlipMult;
|
fSideSlipAccel = Abs(fSideSpeed) * fSideSpeed * fRCSideSlipMult;
|
||||||
else
|
else
|
||||||
fSideSlipImpulse = Abs(fSideSpeed) * fSideSpeed * fSeaSideSlipMult;
|
fSideSlipAccel = Abs(fSideSpeed) * fSideSpeed * fSeaSideSlipMult;
|
||||||
ApplyMoveForce(m_fMass * GetRight() * fSideSlipImpulse * CTimer::GetTimeStep());
|
ApplyMoveForce(m_fMass * GetRight() * fSideSlipAccel * CTimer::GetTimeStep());
|
||||||
|
|
||||||
float fYaw = -DotProduct(CrossProduct(m_vecTurnSpeed + m_vecTurnFriction, vecWidthForward) + m_vecMoveSpeed + m_vecMoveFriction, GetRight());
|
float fYaw = -DotProduct(GetSpeed(vecWidthForward), GetRight());
|
||||||
float fYawImpulse;
|
float fYawAccel;
|
||||||
if (flightModel == FLIGHT_MODEL_RCPLANE)
|
if (flightModel == FLIGHT_MODEL_RCPLANE)
|
||||||
fYawImpulse = fRCRudderMult * fYaw * Abs(fYaw) + fRCYawMult * fSteerLR * fForwSpeed;
|
fYawAccel = fRCRudderMult * fYaw * Abs(fYaw) + fRCYawMult * fSteerLR * fForwSpeed;
|
||||||
else
|
else
|
||||||
fYawImpulse = fSeaRudderMult * fYaw * Abs(fYaw) + fSeaYawMult * fSteerLR * fForwSpeed;
|
fYawAccel = fSeaRudderMult * fYaw * Abs(fYaw) + fSeaYawMult * fSteerLR * fForwSpeed;
|
||||||
ApplyTurnForce(fYawImpulse * GetRight() * m_fTurnMass * CTimer::GetTimeStep(), vecWidthForward);
|
ApplyTurnForce(fYawAccel * GetRight() * m_fTurnMass * CTimer::GetTimeStep(), vecWidthForward);
|
||||||
|
|
||||||
float fRollImpulse;
|
float fRollAccel;
|
||||||
if (flightModel == FLIGHT_MODEL_RCPLANE) {
|
if (flightModel == FLIGHT_MODEL_RCPLANE) {
|
||||||
float fDirectionMultiplier = CPad::GetPad(0)->GetLookRight();
|
float fDirectionMultiplier = CPad::GetPad(0)->GetLookRight();
|
||||||
if (CPad::GetPad(0)->GetLookLeft())
|
if (CPad::GetPad(0)->GetLookLeft())
|
||||||
fDirectionMultiplier = -1;
|
fDirectionMultiplier = -1;
|
||||||
fRollImpulse = (0.5f * fDirectionMultiplier + fSteerLR) * fRCRollMult;
|
fRollAccel = (0.5f * fDirectionMultiplier + fSteerLR) * fRCRollMult;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
fRollImpulse = fSteerLR * fSeaRollMult;
|
fRollAccel = fSteerLR * fSeaRollMult;
|
||||||
ApplyTurnForce(GetRight() * fRollImpulse * fForwSpeed * m_fTurnMass * CTimer::GetTimeStep(), GetUp());
|
ApplyTurnForce(GetRight() * fRollAccel * fForwSpeed * m_fTurnMass * CTimer::GetTimeStep(), GetUp());
|
||||||
|
|
||||||
CVector vecFRight = CrossProduct(GetForward(), CVector(0.0f, 0.0f, 1.0f));
|
CVector vecFRight = CrossProduct(GetForward(), CVector(0.0f, 0.0f, 1.0f));
|
||||||
CVector vecStabilise = (GetUp().z > 0.0f) ? vecFRight : -vecFRight;
|
CVector vecStabilise = (GetUp().z > 0.0f) ? vecFRight : -vecFRight;
|
||||||
float fStabiliseDirection = (GetRight().z > 0.0f) ? -1.0f : 1.0f;
|
float fStabiliseDirection = (GetRight().z > 0.0f) ? -1.0f : 1.0f;
|
||||||
float fStabiliseImpulse;
|
float fStabiliseSpeed;
|
||||||
if (flightModel == FLIGHT_MODEL_RCPLANE)
|
if (flightModel == FLIGHT_MODEL_RCPLANE)
|
||||||
fStabiliseImpulse = fRCRollStabilise * fStabiliseDirection * (1.0f - DotProduct(GetRight(), vecStabilise)) * (1.0f - Abs(GetForward().z));
|
fStabiliseSpeed = fRCRollStabilise * fStabiliseDirection * (1.0f - DotProduct(GetRight(), vecStabilise)) * (1.0f - Abs(GetForward().z));
|
||||||
else
|
else
|
||||||
fStabiliseImpulse = fSeaRollStabilise * fStabiliseDirection * (1.0f - DotProduct(GetRight(), vecStabilise)) * (1.0f - Abs(GetForward().z));
|
fStabiliseSpeed = fSeaRollStabilise * fStabiliseDirection * (1.0f - DotProduct(GetRight(), vecStabilise)) * (1.0f - Abs(GetForward().z));
|
||||||
ApplyTurnForce(fStabiliseImpulse * m_fTurnMass * GetRight(), GetUp()); // no CTimer::GetTimeStep(), is it right? VC doesn't have it too
|
ApplyTurnForce(fStabiliseSpeed * m_fTurnMass * GetRight(), GetUp()); // no CTimer::GetTimeStep(), is it right? VC doesn't have it too
|
||||||
|
|
||||||
// up/down
|
// up/down
|
||||||
float fTail = -DotProduct(CrossProduct(m_vecTurnSpeed + m_vecTurnFriction, vecWidthForward) + m_vecMoveSpeed + m_vecMoveFriction, GetUp());
|
float fTail = -DotProduct(GetSpeed(vecWidthForward), GetUp());
|
||||||
float fSteerUD = -CPad::GetPad(0)->GetSteeringUpDown() / 128.0f;
|
float fSteerUD = -CPad::GetPad(0)->GetSteeringUpDown() / 128.0f;
|
||||||
float fPitchImpulse;
|
float fPitchAccel;
|
||||||
if (flightModel == FLIGHT_MODEL_RCPLANE)
|
if (flightModel == FLIGHT_MODEL_RCPLANE)
|
||||||
fPitchImpulse = fRCTailMult * fTail * Abs(fTail) + fRCPitchMult * fSteerUD * fForwSpeed;
|
fPitchAccel = fRCTailMult * fTail * Abs(fTail) + fRCPitchMult * fSteerUD * fForwSpeed;
|
||||||
else
|
else
|
||||||
fPitchImpulse = fSeaTailMult * fTail * Abs(fTail) + fSeaPitchMult * fSteerUD * fForwSpeed;
|
fPitchAccel = fSeaTailMult * fTail * Abs(fTail) + fSeaPitchMult * fSteerUD * fForwSpeed;
|
||||||
ApplyTurnForce(fPitchImpulse * m_fTurnMass * GetUp() * CTimer::GetTimeStep(), vecWidthForward);
|
ApplyTurnForce(fPitchAccel * m_fTurnMass * GetUp() * CTimer::GetTimeStep(), vecWidthForward);
|
||||||
|
|
||||||
float fLift = -DotProduct(GetMoveSpeed(), GetUp()) / Max(0.01f, GetMoveSpeed().Magnitude());
|
float fLift = -DotProduct(GetMoveSpeed(), GetUp()) / Max(0.01f, GetMoveSpeed().Magnitude());
|
||||||
float fLiftImpluse;
|
float fLiftAccel;
|
||||||
if (flightModel == FLIGHT_MODEL_RCPLANE)
|
if (flightModel == FLIGHT_MODEL_RCPLANE)
|
||||||
fLiftImpluse = (fRCAttackLiftMult * fLift + fRCFormLiftMult) * fForwSpeed * fForwSpeed;
|
fLiftAccel = (fRCAttackLiftMult * fLift + fRCFormLiftMult) * fForwSpeed * fForwSpeed;
|
||||||
else
|
else
|
||||||
fLiftImpluse = (fSeaAttackLiftMult * fLift + fSeaFormLiftMult) * fForwSpeed * fForwSpeed;
|
fLiftAccel = (fSeaAttackLiftMult * fLift + fSeaFormLiftMult) * fForwSpeed * fForwSpeed;
|
||||||
float fLiftForce = fLiftImpluse * m_fMass * CTimer::GetTimeStep();
|
float fLiftImpulse = fLiftAccel * m_fMass * CTimer::GetTimeStep();
|
||||||
if (GRAVITY * CTimer::GetTimeStep() * m_fMass < fLiftImpluse) {
|
if (GRAVITY * CTimer::GetTimeStep() * m_fMass < fLiftImpulse) {
|
||||||
if (flightModel == FLIGHT_MODEL_RCPLANE && GetPosition().z > 50.0f)
|
if (flightModel == FLIGHT_MODEL_RCPLANE && GetPosition().z > 50.0f)
|
||||||
fLiftForce = CTimer::GetTimeStep() * 0.0072 * m_fMass;
|
fLiftImpulse = CTimer::GetTimeStep() * 0.9f*GRAVITY * m_fMass;
|
||||||
else if (flightModel == FLIGHT_MODEL_SEAPLANE && GetPosition().z > 80.0f)
|
else if (flightModel == FLIGHT_MODEL_SEAPLANE && GetPosition().z > 80.0f)
|
||||||
fLiftForce = CTimer::GetTimeStep() * 0.0072 * m_fMass;
|
fLiftImpulse = CTimer::GetTimeStep() * 0.9f*GRAVITY * m_fMass;
|
||||||
}
|
}
|
||||||
ApplyMoveForce(fLiftForce * GetUp());
|
ApplyMoveForce(fLiftImpulse * GetUp());
|
||||||
|
|
||||||
CVector vecResistance;
|
CVector vecResistance;
|
||||||
if (flightModel == FLIGHT_MODEL_RCPLANE)
|
if (flightModel == FLIGHT_MODEL_RCPLANE)
|
||||||
vecResistance = vecRCAeroResistance;
|
vecResistance = vecRCAeroResistance;
|
||||||
@ -425,10 +426,9 @@ CVehicle::FlyingControl(eFlightModel flightModel)
|
|||||||
}
|
}
|
||||||
if (CPad::GetPad(0)->GetHorn()) {
|
if (CPad::GetPad(0)->GetHorn()) {
|
||||||
fYaw = 0.0f;
|
fYaw = 0.0f;
|
||||||
fPitch = clamp(10.0f * DotProduct(m_vecMoveSpeed, GetUp()), -200.0f, 1.3f);
|
fPitch = clamp(10.0f * DotProduct(m_vecMoveSpeed, GetForward()), -200.0f, 1.3f);
|
||||||
fRoll = clamp(10.0f * DotProduct(m_vecMoveSpeed, GetRight()), -200.0f, 1.3f);
|
fRoll = clamp(10.0f * DotProduct(m_vecMoveSpeed, GetRight()), -200.0f, 1.3f);
|
||||||
}
|
}
|
||||||
debug("fPitch: %f\n", fPitch);
|
|
||||||
ApplyTurnForce(fPitch * GetUp() * fPitchVar * m_fTurnMass * CTimer::GetTimeStep(), GetForward());
|
ApplyTurnForce(fPitch * GetUp() * fPitchVar * m_fTurnMass * CTimer::GetTimeStep(), GetForward());
|
||||||
ApplyTurnForce(fRoll * GetUp() * fRollVar * m_fTurnMass * CTimer::GetTimeStep(), GetRight());
|
ApplyTurnForce(fRoll * GetUp() * fRollVar * m_fTurnMass * CTimer::GetTimeStep(), GetRight());
|
||||||
ApplyTurnForce(fYaw * GetForward() * fYawVar * m_fTurnMass * CTimer::GetTimeStep(), GetRight());
|
ApplyTurnForce(fYaw * GetForward() * fYawVar * m_fTurnMass * CTimer::GetTimeStep(), GetRight());
|
||||||
@ -442,11 +442,11 @@ CVehicle::FlyingControl(eFlightModel flightModel)
|
|||||||
float rY = Pow(vecResistance.y, CTimer::GetTimeStep());
|
float rY = Pow(vecResistance.y, CTimer::GetTimeStep());
|
||||||
float rZ = Pow(vecResistance.z, CTimer::GetTimeStep());
|
float rZ = Pow(vecResistance.z, CTimer::GetTimeStep());
|
||||||
CVector vecTurnSpeed = Multiply3x3(m_vecTurnSpeed, GetMatrix());
|
CVector vecTurnSpeed = Multiply3x3(m_vecTurnSpeed, GetMatrix());
|
||||||
float fResistanceMultiplier = Pow(1.0f / (fSpinSpeedRes * SQR(vecTurnSpeed.z) + 1.0f), CTimer::GetTimeStep());
|
float fResistanceMultiplier = Pow(1.0f / (fSpinSpeedRes * SQR(vecTurnSpeed.z) + 1.0f) * rZ, CTimer::GetTimeStep());
|
||||||
float fResistance = vecTurnSpeed.z * fResistanceMultiplier - vecTurnSpeed.z;
|
float fResistance = vecTurnSpeed.z * fResistanceMultiplier - vecTurnSpeed.z;
|
||||||
vecTurnSpeed.x *= rX;
|
vecTurnSpeed.x *= rX;
|
||||||
vecTurnSpeed.y *= rY;
|
vecTurnSpeed.y *= rY;
|
||||||
vecTurnSpeed.z *= rZ;
|
vecTurnSpeed.z *= fResistanceMultiplier;
|
||||||
m_vecTurnSpeed = Multiply3x3(GetMatrix(), vecTurnSpeed);
|
m_vecTurnSpeed = Multiply3x3(GetMatrix(), vecTurnSpeed);
|
||||||
ApplyTurnForce(-GetRight() * fResistance * m_fTurnMass, GetForward() + Multiply3x3(GetMatrix(), m_vecCentreOfMass));
|
ApplyTurnForce(-GetRight() * fResistance * m_fTurnMass, GetForward() + Multiply3x3(GetMatrix(), m_vecCentreOfMass));
|
||||||
break;
|
break;
|
||||||
@ -454,6 +454,9 @@ CVehicle::FlyingControl(eFlightModel flightModel)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
float fBurstSpeedMax = 0.3f;
|
||||||
|
float fBurstTyreMod = 0.1f;
|
||||||
|
|
||||||
void
|
void
|
||||||
CVehicle::ProcessWheel(CVector &wheelFwd, CVector &wheelRight, CVector &wheelContactSpeed, CVector &wheelContactPoint,
|
CVehicle::ProcessWheel(CVector &wheelFwd, CVector &wheelRight, CVector &wheelContactSpeed, CVector &wheelContactPoint,
|
||||||
int32 wheelsOnGround, float thrust, float brake, float adhesion, int8 wheelId, float *wheelSpeed, tWheelState *wheelState, uint16 wheelStatus)
|
int32 wheelsOnGround, float thrust, float brake, float adhesion, int8 wheelId, float *wheelSpeed, tWheelState *wheelState, uint16 wheelStatus)
|
||||||
@ -494,8 +497,8 @@ CVehicle::ProcessWheel(CVector &wheelFwd, CVector &wheelRight, CVector &wheelCon
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
if(wheelStatus == WHEEL_STATUS_BURST){
|
if(wheelStatus == WHEEL_STATUS_BURST){
|
||||||
float fwdspeed = Min(contactSpeedFwd, 0.3f);
|
float fwdspeed = Min(contactSpeedFwd, fBurstSpeedMax);
|
||||||
right += fwdspeed * CGeneral::GetRandomNumberInRange(-0.1f, 0.1f);
|
right += fwdspeed * CGeneral::GetRandomNumberInRange(-fBurstTyreMod, fBurstTyreMod);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -671,7 +674,7 @@ CVehicle::InflictDamage(CEntity* damagedBy, eWeaponType weaponType, float damage
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (oldHealth > DAMAGE_HEALTH_TO_CATCH_FIRE && m_fHealth < DAMAGE_HEALTH_TO_CATCH_FIRE) {
|
if (oldHealth >= DAMAGE_HEALTH_TO_CATCH_FIRE && m_fHealth < DAMAGE_HEALTH_TO_CATCH_FIRE) {
|
||||||
if (IsCar()) {
|
if (IsCar()) {
|
||||||
CAutomobile* pThisCar = (CAutomobile*)this;
|
CAutomobile* pThisCar = (CAutomobile*)this;
|
||||||
pThisCar->Damage.SetEngineStatus(ENGINE_STATUS_ON_FIRE);
|
pThisCar->Damage.SetEngineStatus(ENGINE_STATUS_ON_FIRE);
|
||||||
@ -990,9 +993,8 @@ CVehicle::CanPedOpenLocks(CPed *ped)
|
|||||||
bool
|
bool
|
||||||
CVehicle::CanPedEnterCar(void)
|
CVehicle::CanPedEnterCar(void)
|
||||||
{
|
{
|
||||||
CVector up = GetUp();
|
|
||||||
// can't enter when car is on side
|
// can't enter when car is on side
|
||||||
if(up.z > 0.1f || up.z < -0.1f){
|
if(GetUp().z > 0.1f || GetUp().z < -0.1f){
|
||||||
// also when car is moving too fast
|
// also when car is moving too fast
|
||||||
if(m_vecMoveSpeed.MagnitudeSqr() > sq(0.2f))
|
if(m_vecMoveSpeed.MagnitudeSqr() > sq(0.2f))
|
||||||
return false;
|
return false;
|
||||||
|
@ -86,8 +86,8 @@ enum
|
|||||||
CAR_PIECE_WING_LR,
|
CAR_PIECE_WING_LR,
|
||||||
CAR_PIECE_WING_RR,
|
CAR_PIECE_WING_RR,
|
||||||
CAR_PIECE_WHEEL_LF,
|
CAR_PIECE_WHEEL_LF,
|
||||||
CAR_PIECE_WHEEL_LR,
|
|
||||||
CAR_PIECE_WHEEL_RF,
|
CAR_PIECE_WHEEL_RF,
|
||||||
|
CAR_PIECE_WHEEL_LR,
|
||||||
CAR_PIECE_WHEEL_RR,
|
CAR_PIECE_WHEEL_RR,
|
||||||
CAR_PIECE_WINDSCREEN,
|
CAR_PIECE_WINDSCREEN,
|
||||||
};
|
};
|
||||||
|
@ -241,51 +241,51 @@ CWeapon::Fire(CEntity *shooter, CVector *fireSource)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( fired )
|
if (fired)
|
||||||
{
|
{
|
||||||
bool isPlayer = false;
|
bool isPlayer = false;
|
||||||
|
|
||||||
if ( shooter->IsPed() )
|
if (shooter->IsPed())
|
||||||
{
|
{
|
||||||
CPed *shooterPed = (CPed*)shooter;
|
CPed* shooterPed = (CPed*)shooter;
|
||||||
|
|
||||||
shooterPed->bIsShooting = true;
|
shooterPed->bIsShooting = true;
|
||||||
|
|
||||||
if ( shooterPed->IsPlayer() )
|
if (shooterPed->IsPlayer())
|
||||||
isPlayer = true;
|
isPlayer = true;
|
||||||
|
|
||||||
DMAudio.PlayOneShot(shooterPed->m_audioEntityId, SOUND_WEAPON_SHOT_FIRED, 0.0f);
|
DMAudio.PlayOneShot(shooterPed->m_audioEntityId, SOUND_WEAPON_SHOT_FIRED, 0.0f);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( m_nAmmoInClip > 0 ) m_nAmmoInClip--;
|
if (m_nAmmoInClip > 0) m_nAmmoInClip--;
|
||||||
if ( m_nAmmoTotal > 0 && (m_nAmmoTotal < 25000 || isPlayer) ) m_nAmmoTotal--;
|
if (m_nAmmoTotal > 0 && (m_nAmmoTotal < 25000 || isPlayer)) m_nAmmoTotal--;
|
||||||
|
|
||||||
if ( m_eWeaponState == WEAPONSTATE_READY && m_eWeaponType == WEAPONTYPE_FLAMETHROWER )
|
if (m_eWeaponState == WEAPONSTATE_READY && m_eWeaponType == WEAPONTYPE_FLAMETHROWER)
|
||||||
DMAudio.PlayOneShot(((CPhysical*)shooter)->m_audioEntityId, SOUND_WEAPON_FLAMETHROWER_FIRE, 0.0f);
|
DMAudio.PlayOneShot(((CPhysical*)shooter)->m_audioEntityId, SOUND_WEAPON_FLAMETHROWER_FIRE, 0.0f);
|
||||||
|
|
||||||
m_eWeaponState = WEAPONSTATE_FIRING;
|
m_eWeaponState = WEAPONSTATE_FIRING;
|
||||||
}
|
|
||||||
|
|
||||||
if ( m_nAmmoInClip == 0 )
|
if (m_nAmmoInClip == 0)
|
||||||
{
|
|
||||||
if ( m_nAmmoTotal == 0 )
|
|
||||||
return true;
|
|
||||||
|
|
||||||
m_eWeaponState = WEAPONSTATE_RELOADING;
|
|
||||||
m_nTimer = CTimer::GetTimeInMilliseconds() + GetInfo()->m_nReload;
|
|
||||||
|
|
||||||
if ( shooter == FindPlayerPed() )
|
|
||||||
{
|
{
|
||||||
if ( CWorld::Players[CWorld::PlayerInFocus].m_bFastReload )
|
if (m_nAmmoTotal == 0)
|
||||||
m_nTimer = CTimer::GetTimeInMilliseconds() + GetInfo()->m_nReload / 4;
|
return true;
|
||||||
|
|
||||||
|
m_eWeaponState = WEAPONSTATE_RELOADING;
|
||||||
|
m_nTimer = CTimer::GetTimeInMilliseconds() + GetInfo()->m_nReload;
|
||||||
|
|
||||||
|
if (shooter == FindPlayerPed())
|
||||||
|
{
|
||||||
|
if (CWorld::Players[CWorld::PlayerInFocus].m_bFastReload)
|
||||||
|
m_nTimer = CTimer::GetTimeInMilliseconds() + GetInfo()->m_nReload / 4;
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
m_nTimer = CTimer::GetTimeInMilliseconds() + 1000;
|
||||||
|
if (shooter == FindPlayerPed())
|
||||||
|
CStats::RoundsFiredByPlayer++;
|
||||||
}
|
}
|
||||||
|
|
||||||
m_nTimer = CTimer::GetTimeInMilliseconds() + 1000;
|
|
||||||
if ( shooter == FindPlayerPed() )
|
|
||||||
CStats::RoundsFiredByPlayer++;
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -16,8 +16,8 @@ class CWeapon
|
|||||||
public:
|
public:
|
||||||
eWeaponType m_eWeaponType;
|
eWeaponType m_eWeaponType;
|
||||||
eWeaponState m_eWeaponState;
|
eWeaponState m_eWeaponState;
|
||||||
uint32 m_nAmmoInClip;
|
int32 m_nAmmoInClip;
|
||||||
uint32 m_nAmmoTotal;
|
int32 m_nAmmoTotal;
|
||||||
uint32 m_nTimer;
|
uint32 m_nTimer;
|
||||||
bool m_bAddRotOffset;
|
bool m_bAddRotOffset;
|
||||||
|
|
||||||
|
@ -5,13 +5,13 @@
|
|||||||
|
|
||||||
class CWeaponInfo {
|
class CWeaponInfo {
|
||||||
// static CWeaponInfo(&ms_apWeaponInfos)[14];
|
// static CWeaponInfo(&ms_apWeaponInfos)[14];
|
||||||
static CWeaponInfo ms_apWeaponInfos[14];
|
static CWeaponInfo ms_apWeaponInfos[WEAPONTYPE_LAST_WEAPONTYPE];
|
||||||
public:
|
public:
|
||||||
eWeaponFire m_eWeaponFire;
|
eWeaponFire m_eWeaponFire;
|
||||||
float m_fRange;
|
float m_fRange;
|
||||||
uint32 m_nFiringRate;
|
uint32 m_nFiringRate;
|
||||||
uint32 m_nReload;
|
uint32 m_nReload;
|
||||||
uint32 m_nAmountofAmmunition;
|
int32 m_nAmountofAmmunition;
|
||||||
uint32 m_nDamage;
|
uint32 m_nDamage;
|
||||||
float m_fSpeed;
|
float m_fSpeed;
|
||||||
float m_fRadius;
|
float m_fRadius;
|
||||||
|
Loading…
Reference in New Issue
Block a user