1
0
Fork 0
mirror of https://git.rip/DMCA_FUCKER/re3.git synced 2024-12-22 23:40:01 +00:00

Merge remote-tracking branch 'origin/master' into opus

This commit is contained in:
Sergeanur 2020-05-24 18:25:53 +03:00
commit e4f136344c
10 changed files with 94 additions and 84 deletions

View file

@ -6212,7 +6212,7 @@ int8 CRunningScript::ProcessCommands700To799(int32 command)
}
CCranes::ActivateCrane(infX, supX, infY, supY,
*(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]);
return 0;
}

View file

@ -137,9 +137,13 @@ DoRWStuffStartOfFrame(int16 TopRed, int16 TopGreen, int16 TopBlue, int16 BottomR
CRGBA TopColor(TopRed, TopGreen, TopBlue, 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);
#endif
CVisibilityPlugins::SetRenderWareCamera(Scene.camera);
RwCameraClear(Scene.camera, &gColourTop, rwCAMERACLEARZ);
RwCameraClear(Scene.camera, &TopColor.rwRGBA, rwCAMERACLEARZ);
if(!RsCameraBeginUpdate(Scene.camera))
return false;
@ -155,7 +159,11 @@ DoRWStuffStartOfFrame(int16 TopRed, int16 TopGreen, int16 TopBlue, int16 BottomR
bool
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);
#endif
CVisibilityPlugins::SetRenderWareCamera(Scene.camera);
RwCameraClear(Scene.camera, &gColourTop, rwCAMERACLEARZ);

View file

@ -227,7 +227,7 @@ CPlayerPed::SetInitialState(void)
{
m_bAdrenalineActive = false;
m_nAdrenalineTime = 0;
CTimer::SetTimeStep(1.0f);
CTimer::SetTimeScale(1.0f);
m_pSeekTarget = nil;
m_vecSeekPos = { 0.0f, 0.0f, 0.0f };
m_fleeFromPosX = 0.0f;

View file

@ -175,7 +175,7 @@ CAutomobile::CAutomobile(int32 id, uint8 CreatedBy)
m_nNumPassengers = 0;
m_bombType = CARBOMB_NONE;
bHadDriver = false;
bDriverLastFrame = false;
m_pBombRigger = nil;
if(m_nDoorLock == CARLOCK_UNLOCKED &&
@ -276,7 +276,7 @@ CAutomobile::ProcessControl(void)
// Process driver
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
m_nBombTimer = 1000;
m_pBlowUpEntity = m_pBombRigger;
@ -284,7 +284,7 @@ CAutomobile::ProcessControl(void)
m_pBlowUpEntity->RegisterReference((CEntity**)&m_pBlowUpEntity);
DMAudio.PlayOneShot(m_audioEntityId, SOUND_BOMB_TICK, 1.0f);
}
bHadDriver = true;
bDriverLastFrame = true;
if(IsUpsideDown() && CanPedEnterCar()){
if(!pDriver->IsPlayer() &&
@ -293,7 +293,7 @@ CAutomobile::ProcessControl(void)
pDriver->SetObjective(OBJECTIVE_LEAVE_VEHICLE, this);
}
}else
bHadDriver = false;
bDriverLastFrame = false;
// Process passengers
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){
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]));
colModel->spheres[5].Set(mi->m_wheelScale, mat.GetPosition(), SURFACE_TIRE, CAR_PIECE_WHEEL_RR);
colModel->numSpheres = 6;

View file

@ -86,7 +86,7 @@ public:
uint8 field_4D8;
uint8 m_bombType : 3;
uint8 bTaxiLight : 1;
uint8 bHadDriver : 1; // for bombs
uint8 bDriverLastFrame : 1; // for bombs
uint8 bFixedColour : 1;
uint8 bBigWheels : 1;
uint8 bWaterTight : 1; // no damage for non-player peds

View file

@ -50,8 +50,8 @@ CVehicle::CVehicle(uint8 CreatedBy)
{
int i;
m_nCurrentGear = 0;
m_fChangeGearTime = 0;
m_nCurrentGear = 1;
m_fChangeGearTime = 0.0f;
m_fSteerRatio = 0.0f;
m_type = ENTITY_TYPE_VEHICLE;
VehicleCreatedBy = CreatedBy;
@ -280,8 +280,8 @@ CVehicle::FlyingControl(eFlightModel flightModel)
float turnSpeed = m_vecTurnSpeed.MagnitudeSqr();
if(turnSpeed > SQR(0.2f))
m_vecTurnSpeed *= 0.2f/Sqrt(turnSpeed);
}
break;
}
case FLIGHT_MODEL_RCPLANE:
case FLIGHT_MODEL_SEAPLANE:
@ -294,76 +294,77 @@ CVehicle::FlyingControl(eFlightModel flightModel)
fThrust += 1.0f;
else if (fForwSpeed > 0.0f && fThrust < 0.0f)
fThrust = 0.0f;
float fThrustImpulse;
float fThrustAccel;
if (flightModel == FLIGHT_MODEL_RCPLANE)
fThrustImpulse = (fThrust - fRCPropFallOff * fForwSpeed) * fRCAeroThrust;
fThrustAccel = (fThrust - fRCPropFallOff * fForwSpeed) * fRCAeroThrust;
else
fThrustImpulse = (fThrust - fSeaPropFallOff * fForwSpeed) * fSeaThrust;
ApplyMoveForce(fThrustImpulse * GetForward() * m_fMass * CTimer::GetTimeStep());
fThrustAccel = (fThrust - fSeaPropFallOff * fForwSpeed) * fSeaThrust;
ApplyMoveForce(fThrustAccel * GetForward() * m_fMass * CTimer::GetTimeStep());
// left/right
float fSideSpeed = -DotProduct(GetMoveSpeed(), GetRight());
float fSteerLR = CPad::GetPad(0)->GetSteeringLeftRight() / 128.0f;
float fSideSlipImpulse;
float fSideSlipAccel;
if (flightModel == FLIGHT_MODEL_RCPLANE)
fSideSlipImpulse = Abs(fSideSpeed) * fSideSpeed * fRCSideSlipMult;
fSideSlipAccel = Abs(fSideSpeed) * fSideSpeed * fRCSideSlipMult;
else
fSideSlipImpulse = Abs(fSideSpeed) * fSideSpeed * fSeaSideSlipMult;
ApplyMoveForce(m_fMass * GetRight() * fSideSlipImpulse * CTimer::GetTimeStep());
fSideSlipAccel = Abs(fSideSpeed) * fSideSpeed * fSeaSideSlipMult;
ApplyMoveForce(m_fMass * GetRight() * fSideSlipAccel * CTimer::GetTimeStep());
float fYaw = -DotProduct(CrossProduct(m_vecTurnSpeed + m_vecTurnFriction, vecWidthForward) + m_vecMoveSpeed + m_vecMoveFriction, GetRight());
float fYawImpulse;
float fYaw = -DotProduct(GetSpeed(vecWidthForward), GetRight());
float fYawAccel;
if (flightModel == FLIGHT_MODEL_RCPLANE)
fYawImpulse = fRCRudderMult * fYaw * Abs(fYaw) + fRCYawMult * fSteerLR * fForwSpeed;
fYawAccel = fRCRudderMult * fYaw * Abs(fYaw) + fRCYawMult * fSteerLR * fForwSpeed;
else
fYawImpulse = fSeaRudderMult * fYaw * Abs(fYaw) + fSeaYawMult * fSteerLR * fForwSpeed;
ApplyTurnForce(fYawImpulse * GetRight() * m_fTurnMass * CTimer::GetTimeStep(), vecWidthForward);
fYawAccel = fSeaRudderMult * fYaw * Abs(fYaw) + fSeaYawMult * fSteerLR * fForwSpeed;
ApplyTurnForce(fYawAccel * GetRight() * m_fTurnMass * CTimer::GetTimeStep(), vecWidthForward);
float fRollImpulse;
float fRollAccel;
if (flightModel == FLIGHT_MODEL_RCPLANE) {
float fDirectionMultiplier = CPad::GetPad(0)->GetLookRight();
if (CPad::GetPad(0)->GetLookLeft())
fDirectionMultiplier = -1;
fRollImpulse = (0.5f * fDirectionMultiplier + fSteerLR) * fRCRollMult;
fRollAccel = (0.5f * fDirectionMultiplier + fSteerLR) * fRCRollMult;
}
else
fRollImpulse = fSteerLR * fSeaRollMult;
ApplyTurnForce(GetRight() * fRollImpulse * fForwSpeed * m_fTurnMass * CTimer::GetTimeStep(), GetUp());
fRollAccel = fSteerLR * fSeaRollMult;
ApplyTurnForce(GetRight() * fRollAccel * fForwSpeed * m_fTurnMass * CTimer::GetTimeStep(), GetUp());
CVector vecFRight = CrossProduct(GetForward(), CVector(0.0f, 0.0f, 1.0f));
CVector vecStabilise = (GetUp().z > 0.0f) ? vecFRight : -vecFRight;
float fStabiliseDirection = (GetRight().z > 0.0f) ? -1.0f : 1.0f;
float fStabiliseImpulse;
float fStabiliseSpeed;
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
fStabiliseImpulse = 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
fStabiliseSpeed = fSeaRollStabilise * fStabiliseDirection * (1.0f - DotProduct(GetRight(), vecStabilise)) * (1.0f - Abs(GetForward().z));
ApplyTurnForce(fStabiliseSpeed * m_fTurnMass * GetRight(), GetUp()); // no CTimer::GetTimeStep(), is it right? VC doesn't have it too
// 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 fPitchImpulse;
float fPitchAccel;
if (flightModel == FLIGHT_MODEL_RCPLANE)
fPitchImpulse = fRCTailMult * fTail * Abs(fTail) + fRCPitchMult * fSteerUD * fForwSpeed;
fPitchAccel = fRCTailMult * fTail * Abs(fTail) + fRCPitchMult * fSteerUD * fForwSpeed;
else
fPitchImpulse = fSeaTailMult * fTail * Abs(fTail) + fSeaPitchMult * fSteerUD * fForwSpeed;
ApplyTurnForce(fPitchImpulse * m_fTurnMass * GetUp() * CTimer::GetTimeStep(), vecWidthForward);
fPitchAccel = fSeaTailMult * fTail * Abs(fTail) + fSeaPitchMult * fSteerUD * fForwSpeed;
ApplyTurnForce(fPitchAccel * m_fTurnMass * GetUp() * CTimer::GetTimeStep(), vecWidthForward);
float fLift = -DotProduct(GetMoveSpeed(), GetUp()) / Max(0.01f, GetMoveSpeed().Magnitude());
float fLiftImpluse;
float fLiftAccel;
if (flightModel == FLIGHT_MODEL_RCPLANE)
fLiftImpluse = (fRCAttackLiftMult * fLift + fRCFormLiftMult) * fForwSpeed * fForwSpeed;
fLiftAccel = (fRCAttackLiftMult * fLift + fRCFormLiftMult) * fForwSpeed * fForwSpeed;
else
fLiftImpluse = (fSeaAttackLiftMult * fLift + fSeaFormLiftMult) * fForwSpeed * fForwSpeed;
float fLiftForce = fLiftImpluse * m_fMass * CTimer::GetTimeStep();
if (GRAVITY * CTimer::GetTimeStep() * m_fMass < fLiftImpluse) {
fLiftAccel = (fSeaAttackLiftMult * fLift + fSeaFormLiftMult) * fForwSpeed * fForwSpeed;
float fLiftImpulse = fLiftAccel * m_fMass * CTimer::GetTimeStep();
if (GRAVITY * CTimer::GetTimeStep() * m_fMass < fLiftImpulse) {
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)
fLiftForce = CTimer::GetTimeStep() * 0.0072 * m_fMass;
fLiftImpulse = CTimer::GetTimeStep() * 0.9f*GRAVITY * m_fMass;
}
ApplyMoveForce(fLiftForce * GetUp());
ApplyMoveForce(fLiftImpulse * GetUp());
CVector vecResistance;
if (flightModel == FLIGHT_MODEL_RCPLANE)
vecResistance = vecRCAeroResistance;
@ -425,10 +426,9 @@ CVehicle::FlyingControl(eFlightModel flightModel)
}
if (CPad::GetPad(0)->GetHorn()) {
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);
}
debug("fPitch: %f\n", fPitch);
ApplyTurnForce(fPitch * GetUp() * fPitchVar * m_fTurnMass * CTimer::GetTimeStep(), GetForward());
ApplyTurnForce(fRoll * GetUp() * fRollVar * 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 rZ = Pow(vecResistance.z, CTimer::GetTimeStep());
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;
vecTurnSpeed.x *= rX;
vecTurnSpeed.y *= rY;
vecTurnSpeed.z *= rZ;
vecTurnSpeed.z *= fResistanceMultiplier;
m_vecTurnSpeed = Multiply3x3(GetMatrix(), vecTurnSpeed);
ApplyTurnForce(-GetRight() * fResistance * m_fTurnMass, GetForward() + Multiply3x3(GetMatrix(), m_vecCentreOfMass));
break;
@ -454,6 +454,9 @@ CVehicle::FlyingControl(eFlightModel flightModel)
}
}
float fBurstSpeedMax = 0.3f;
float fBurstTyreMod = 0.1f;
void
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)
@ -494,8 +497,8 @@ CVehicle::ProcessWheel(CVector &wheelFwd, CVector &wheelRight, CVector &wheelCon
#endif
if(wheelStatus == WHEEL_STATUS_BURST){
float fwdspeed = Min(contactSpeedFwd, 0.3f);
right += fwdspeed * CGeneral::GetRandomNumberInRange(-0.1f, 0.1f);
float fwdspeed = Min(contactSpeedFwd, fBurstSpeedMax);
right += fwdspeed * CGeneral::GetRandomNumberInRange(-fBurstTyreMod, fBurstTyreMod);
}
}
@ -671,7 +674,7 @@ CVehicle::InflictDamage(CEntity* damagedBy, eWeaponType weaponType, float damage
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()) {
CAutomobile* pThisCar = (CAutomobile*)this;
pThisCar->Damage.SetEngineStatus(ENGINE_STATUS_ON_FIRE);
@ -990,9 +993,8 @@ CVehicle::CanPedOpenLocks(CPed *ped)
bool
CVehicle::CanPedEnterCar(void)
{
CVector up = GetUp();
// 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
if(m_vecMoveSpeed.MagnitudeSqr() > sq(0.2f))
return false;

View file

@ -86,8 +86,8 @@ enum
CAR_PIECE_WING_LR,
CAR_PIECE_WING_RR,
CAR_PIECE_WHEEL_LF,
CAR_PIECE_WHEEL_LR,
CAR_PIECE_WHEEL_RF,
CAR_PIECE_WHEEL_LR,
CAR_PIECE_WHEEL_RR,
CAR_PIECE_WINDSCREEN,
};

View file

@ -241,51 +241,51 @@ CWeapon::Fire(CEntity *shooter, CVector *fireSource)
}
}
if ( fired )
if (fired)
{
bool isPlayer = false;
if ( shooter->IsPed() )
if (shooter->IsPed())
{
CPed *shooterPed = (CPed*)shooter;
CPed* shooterPed = (CPed*)shooter;
shooterPed->bIsShooting = true;
if ( shooterPed->IsPlayer() )
if (shooterPed->IsPlayer())
isPlayer = true;
DMAudio.PlayOneShot(shooterPed->m_audioEntityId, SOUND_WEAPON_SHOT_FIRED, 0.0f);
}
if ( m_nAmmoInClip > 0 ) m_nAmmoInClip--;
if ( m_nAmmoTotal > 0 && (m_nAmmoTotal < 25000 || isPlayer) ) m_nAmmoTotal--;
if (m_nAmmoInClip > 0) m_nAmmoInClip--;
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);
m_eWeaponState = WEAPONSTATE_FIRING;
}
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 (m_nAmmoInClip == 0)
{
if ( CWorld::Players[CWorld::PlayerInFocus].m_bFastReload )
m_nTimer = CTimer::GetTimeInMilliseconds() + GetInfo()->m_nReload / 4;
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)
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
{

View file

@ -16,8 +16,8 @@ class CWeapon
public:
eWeaponType m_eWeaponType;
eWeaponState m_eWeaponState;
uint32 m_nAmmoInClip;
uint32 m_nAmmoTotal;
int32 m_nAmmoInClip;
int32 m_nAmmoTotal;
uint32 m_nTimer;
bool m_bAddRotOffset;

View file

@ -5,13 +5,13 @@
class CWeaponInfo {
// static CWeaponInfo(&ms_apWeaponInfos)[14];
static CWeaponInfo ms_apWeaponInfos[14];
static CWeaponInfo ms_apWeaponInfos[WEAPONTYPE_LAST_WEAPONTYPE];
public:
eWeaponFire m_eWeaponFire;
float m_fRange;
uint32 m_nFiringRate;
uint32 m_nReload;
uint32 m_nAmountofAmmunition;
int32 m_nAmountofAmmunition;
uint32 m_nDamage;
float m_fSpeed;
float m_fRadius;