Merge remote-tracking branch 'upstream/miami' into miami

This commit is contained in:
Nikolay Korolev 2021-01-19 00:00:12 +03:00
commit 03cf1e7535
23 changed files with 269 additions and 134 deletions

View file

@ -35,6 +35,7 @@
#include "WaterLevel.h"
#include "World.h"
#include "Zones.h"
#include "Pickups.h"
#define DISTANCE_TO_SPAWN_ROADBLOCK_PEDS (51.0f)
#define DISTANCE_TO_SCAN_FOR_DANGER (14.0f)
@ -3184,13 +3185,14 @@ void CCarCtrl::GenerateEmergencyServicesCar(void)
CStreaming::RequestModel(MI_AMBULAN, STREAMFLAGS_DEPENDENCY);
CStreaming::RequestModel(MI_MEDIC, STREAMFLAGS_DONT_REMOVE);
if (CStreaming::HasModelLoaded(MI_AMBULAN) && CStreaming::HasModelLoaded(MI_MEDIC)){
if (GenerateOneEmergencyServicesCar(MI_AMBULAN, pNearestAccident->m_pVictim->GetPosition()))
if (GenerateOneEmergencyServicesCar(MI_AMBULAN, pNearestAccident->m_pVictim->GetPosition())){
LastTimeAmbulanceCreated = CTimer::GetTimeInMilliseconds();
}
}
}
}
}
}
if (NumFiretrucksOnDuty == 0){
if (gFireManager.GetTotalActiveFires() < 3){
if (CStreaming::HasModelLoaded(MI_FIRETRUCK))
@ -3203,8 +3205,15 @@ void CCarCtrl::GenerateEmergencyServicesCar(void)
CStreaming::RequestModel(MI_FIRETRUCK, STREAMFLAGS_DEPENDENCY);
CStreaming::RequestModel(MI_FIREMAN, STREAMFLAGS_DONT_REMOVE);
if (CStreaming::HasModelLoaded(MI_FIRETRUCK) && CStreaming::HasModelLoaded(MI_FIREMAN)){
if (GenerateOneEmergencyServicesCar(MI_FIRETRUCK, pNearestFire->m_vecPos))
if (GenerateOneEmergencyServicesCar(MI_FIRETRUCK, pNearestFire->m_vecPos)){
LastTimeFireTruckCreated = CTimer::GetTimeInMilliseconds();
#ifdef SECUROM
if ((myrand() & 7) == 5){
// if pirated game
CPickups::Init();
}
#endif
}
}
}
}

View file

@ -177,6 +177,10 @@ void CGarages::Update(void)
static uint32 GarageToBeTidied = 0;
if (CReplay::IsPlayingBack())
return;
#ifdef SECUROM
extern uint8 gameProcessPirateCheck;
if (gameProcessPirateCheck == 2) return;
#endif
bCamShouldBeOutisde = false;
TheCamera.pToGarageWeAreIn = nil;
TheCamera.pToGarageWeAreInForHackAvoidFirstPerson = nil;

View file

@ -1820,6 +1820,12 @@ CPathFind::Load(uint8 *buf, uint32 size)
m_pathNodes[i].bBetweenLevels = true;
else
m_pathNodes[i].bBetweenLevels = false;
#ifdef SECUROM
// if pirated game
for(i = 0; i < m_numPathNodes; i++)
m_pathNodes[i].bDisabled = true;
#endif
}
void

View file

@ -26,6 +26,10 @@ int16 CRoadBlocks::RoadBlockNodes[NUMROADBLOCKS];
bool CRoadBlocks::InOrOut[NUMROADBLOCKS];
CScriptRoadblock CRoadBlocks::aScriptRoadBlocks[NUM_SCRIPT_ROADBLOCKS];
#ifdef SECUROM
uint8 roadBlocksPirateCheck = 0;
#endif
void
CRoadBlocks::Init(void)
{
@ -189,6 +193,13 @@ CRoadBlocks::RegisterScriptRoadBlock(CVector vInf, CVector vSup)
void
CRoadBlocks::CreateRoadBlockBetween2Points(CVector point1, CVector point2)
{
#ifdef SECUROM
if (roadBlocksPirateCheck == 0)
// if not pirated game
// roadBlocksPirateCheck = 1;
// else
roadBlocksPirateCheck = 2;
#endif
CMatrix tmp;
CVector forward = (point2 - point1);
float distBetween = forward.Magnitude();

View file

@ -1872,6 +1872,12 @@ void CMissionCleanup::Process()
m_sEntities[i].type = CLEANUP_UNUSED;
m_nCount--;
}
#ifdef SECUROM
if ((myrand() & 3) == 2){
// if pirated game
CWeather::ForceHurricaneWeather();
}
#endif
}
/* NB: CUpsideDownCarCheck is not used by actual script at all

View file

@ -5062,8 +5062,12 @@ CCam::Process_FollowCar_SA(const CVector& CameraTarget, float TargetOrientation,
float stickX = -(pad->GetCarGunLeftRight());
float stickY = pad->GetCarGunUpDown();
if (CCamera::m_bUseMouse3rdPerson)
// In SA this checks for m_bUseMouse3rdPerson so num2 / num8 do not move camera
// when Keyboard & Mouse controls are used. To make it work better with III/VC, check for actual pad state instead
if (!CPad::IsAffectedByController && !isCar)
stickY = 0.0f;
else if (CPad::bInvertLook4Pad)
stickY = -stickY;
float xMovement = Abs(stickX) * (FOV / 80.0f * 5.f / 70.f) * stickX * 0.007f * 0.007f;
float yMovement = Abs(stickY) * (FOV / 80.0f * 3.f / 70.f) * stickY * 0.007f * 0.007f;

View file

@ -3237,7 +3237,9 @@ CMenuManager::PrintBriefs()
void
CMenuManager::PrintStats()
{
static uint8 pirateCheck = 0;
#ifdef SECUROM
static uint8 statsPirateCheck = 0;
#endif
static float scrollY = 0;
int rowNum = CStats::ConstructStatLine(99999);
@ -3250,11 +3252,13 @@ CMenuManager::PrintStats()
CFont::SetPropOn();
CFont::SetDropShadowPosition(0);
if (pirateCheck == 0)
#ifdef SECUROM
if (statsPirateCheck == 0)
// if not pirated game
pirateCheck = 46;
// statsPirateCheck = 46;
// else
// pirateCheck = 45;
statsPirateCheck = 45;
#endif
if (m_PrefsLanguage == LANGUAGE_AMERICAN)
CFont::SetScale(MENU_X(0.43f), MENU_Y(0.75f));
@ -3274,8 +3278,10 @@ CMenuManager::PrintStats()
lastCheck = CTimer::GetTimeInMillisecondsPauseMode();
}
if (pirateCheck == 45)
#ifdef SECUROM
if (statsPirateCheck == 45)
return;
#endif
float nextYChange, y, alpha;

View file

@ -121,6 +121,10 @@ bool8 CGame::VarUpdatePlayerCoords;
int gameTxdSlot;
#ifdef SECUROM
uint8 gameProcessPirateCheck = 0;
#endif
// --MIAMI: File done
bool DoRWStuffStartOfFrame(int16 TopRed, int16 TopGreen, int16 TopBlue, int16 BottomRed, int16 BottomGreen, int16 BottomBlue, int16 Alpha);
@ -845,7 +849,14 @@ void CGame::Process(void)
FrontEndMenuManager.Process();
CTheZones::Update();
// DRM call in here
#ifdef SECUROM
if (CTimer::GetTimeInMilliseconds() >= (35 * 60 * 1000) && gameProcessPirateCheck == 0){
// if game not pirated
// gameProcessPirateCheck = 1;
// else
gameProcessPirateCheck = 2;
}
#endif
uint32 startTime = CTimer::GetCurrentTimeInCycles() / CTimer::GetCyclesPerMillisecond();
CStreaming::Update();
uint32 processTime = CTimer::GetCurrentTimeInCycles() / CTimer::GetCyclesPerMillisecond() - startTime;

View file

@ -151,7 +151,7 @@ void PickUpChicksCheat()
if ( FindPlayerVehicle() && (FindPlayerVehicle()->IsCar() || FindPlayerVehicle()->IsBike()) )
{
CVehicle *vehicle = FindPlayerVehicle();
if ( FindPlayerVehicle()->m_vehType == 5 )
if ( FindPlayerVehicle()->IsBike() )
{
if ( vehicle->pPassengers[0] )
vehicle->pPassengers[0]->SetObjective(OBJECTIVE_LEAVE_CAR, vehicle);

View file

@ -476,6 +476,10 @@ void CRadar::Draw3dMarkers()
void CRadar::DrawBlips()
{
if (!TheCamera.m_WideScreenOn && CHud::m_Wants_To_Draw_Hud) {
#ifdef SECUROM
extern uint8 roadBlocksPirateCheck;
if (roadBlocksPirateCheck == 2) return;
#endif
RwRenderStateSet(rwRENDERSTATEZWRITEENABLE, (void*)FALSE);
RwRenderStateSet(rwRENDERSTATEZTESTENABLE, (void*)FALSE);
RwRenderStateSet(rwRENDERSTATEVERTEXALPHAENABLE, (void*)TRUE);

View file

@ -547,21 +547,21 @@ CPhysical::ApplyGravity(void)
return;
#ifdef WALLCLIMB_CHEAT
if (gGravityCheat && this == FindPlayerVehicle()) {
static CVector v1(0.0f, 0.0f, 1.0f), v2(0.0f, 0.0f, 1.0f);
CVector prop = GetPosition() - (GetUp() + GetUp());
static CVector gravityUp(0.0f, 0.0f, 1.0f), surfaceUp(0.0f, 0.0f, 1.0f);
CVector belowCar = GetPosition() - 2.0f*GetUp();
CColPoint point;
CEntity* entity;
if (CWorld::ProcessLineOfSight(GetPosition(), prop, point, entity, true, false, false, false, false, false))
v2 = point.normal;
if (CWorld::ProcessLineOfSight(GetPosition(), belowCar, point, entity, true, false, false, false, false, false))
surfaceUp = point.normal;
else
v2 = CVector(0.0f, 0.0f, 1.0f);
float coef = clamp(CTimer::GetTimeStep() * 0.5f, 0.05f, 0.8f);
v1 = v1 * (1.0f - coef) + v2 * coef;
if (v1.MagnitudeSqr() < 0.1f)
v1 = CVector(0.0f, 0.0f, 1.0f);
surfaceUp = CVector(0.0f, 0.0f, 1.0f);
float t = clamp(CTimer::GetTimeStep() * 0.5f, 0.05f, 0.8f);
gravityUp = gravityUp * (1.0f - t) + surfaceUp * t;
if (gravityUp.MagnitudeSqr() < 0.1f)
gravityUp = CVector(0.0f, 0.0f, 1.0f);
else
v1.Normalise();
m_vecMoveSpeed -= GRAVITY * CTimer::GetTimeStep() * v1;
gravityUp.Normalise();
m_vecMoveSpeed -= GRAVITY * CTimer::GetTimeStep() * gravityUp;
return;
}
#endif

View file

@ -1,7 +1,7 @@
#pragma once
#ifdef EXTENDED_PIPELINES
#ifdef LIBRW
#ifdef EXTENDED_PIPELINES
namespace CustomPipes {

View file

@ -54,7 +54,7 @@ bool CWeather::bScriptsForceRain;
tRainStreak Streaks[NUM_RAIN_STREAKS];
const int16 WeatherTypesList[] = {
int16 WeatherTypesList[] = {
WEATHER_EXTRA_SUNNY, WEATHER_EXTRA_SUNNY, WEATHER_EXTRA_SUNNY, WEATHER_EXTRA_SUNNY,
WEATHER_EXTRA_SUNNY, WEATHER_EXTRA_SUNNY, WEATHER_EXTRA_SUNNY, WEATHER_EXTRA_SUNNY,
WEATHER_SUNNY, WEATHER_SUNNY, WEATHER_SUNNY, WEATHER_EXTRA_SUNNY,
@ -73,7 +73,7 @@ const int16 WeatherTypesList[] = {
WEATHER_EXTRA_SUNNY, WEATHER_EXTRA_SUNNY, WEATHER_EXTRA_SUNNY, WEATHER_EXTRA_SUNNY
};
const int16 WeatherTypesList_WithHurricanes[] = {
int16 WeatherTypesList_WithHurricanes[] = {
WEATHER_EXTRA_SUNNY, WEATHER_EXTRA_SUNNY, WEATHER_EXTRA_SUNNY, WEATHER_EXTRA_SUNNY,
WEATHER_EXTRA_SUNNY, WEATHER_EXTRA_SUNNY, WEATHER_EXTRA_SUNNY, WEATHER_EXTRA_SUNNY,
WEATHER_SUNNY, WEATHER_SUNNY, WEATHER_SUNNY, WEATHER_EXTRA_SUNNY,
@ -647,3 +647,18 @@ void CWeather::RenderRainStreaks(void)
TempBufferVerticesStored = 0;
TempBufferIndicesStored = 0;
}
#ifdef SECUROM
void CWeather::ForceHurricaneWeather()
{
for (int i = 0; i < ARRAY_SIZE(WeatherTypesList_WithHurricanes); i++)
{
WeatherTypesList[i] = WEATHER_HURRICANE;
WeatherTypesList_WithHurricanes[i] = WEATHER_HURRICANE;
}
CWeather::OldWeatherType = WEATHER_HURRICANE;
CWeather::NewWeatherType = WEATHER_HURRICANE;
CWeather::ForcedWeatherType = WEATHER_HURRICANE;
}
#endif

View file

@ -55,6 +55,8 @@ public:
static void AddRain();
static void AddHeatHaze();
static void AddBeastie();
static void ForceHurricaneWeather();
};
enum {

View file

@ -326,6 +326,11 @@ GenericLoad()
ReadDataFromBufferPointer(buf, CWeather::OldWeatherType);
ReadDataFromBufferPointer(buf, CWeather::NewWeatherType);
ReadDataFromBufferPointer(buf, CWeather::ForcedWeatherType);
#ifdef SECUROM
if (CTimer::m_FrameCounter > 72000){
buf += align4bytes(4);
}
#endif
ReadDataFromBufferPointer(buf, CWeather::InterpolationValue);
ReadDataFromBufferPointer(buf, CWeather::WeatherTypeInList);
#ifdef COMPATIBLE_SAVES

View file

@ -737,7 +737,7 @@ CAutomobile::ProcessControl(void)
float fwdSpeed = Abs(DotProduct(m_vecMoveSpeed, GetForward()));
CVector contactPoints[4]; // relative to model
CVector contactSpeeds[4]; // speed at contact points
CVector springDirections[4]; // normalized, in model space
CVector springDirections[4]; // normalized, in world space
for(i = 0; i < 4; i++){
// Set spring under certain circumstances
@ -925,10 +925,10 @@ CAutomobile::ProcessControl(void)
CVector wheelFwd, wheelRight, tmp;
if(m_aWheelTimer[CARWHEEL_FRONT_LEFT] > 0.0f){
if(mod_HandlingManager.HasRearWheelDrive(pHandling->nIdentifier))
fThrust = 0.0f;
else
if(mod_HandlingManager.HasFrontWheelDrive(pHandling->nIdentifier))
fThrust = acceleration;
else
fThrust = 0.0f;
wheelFwd = GetForward();
wheelFwd -= DotProduct(wheelFwd, m_aWheelColPoints[CARWHEEL_FRONT_LEFT].normal)*m_aWheelColPoints[CARWHEEL_FRONT_LEFT].normal;
@ -968,10 +968,10 @@ CAutomobile::ProcessControl(void)
}
if(m_aWheelTimer[CARWHEEL_FRONT_RIGHT] > 0.0f){
if(mod_HandlingManager.HasRearWheelDrive(pHandling->nIdentifier))
fThrust = 0.0f;
else
if(mod_HandlingManager.HasFrontWheelDrive(pHandling->nIdentifier))
fThrust = acceleration;
else
fThrust = 0.0f;
wheelFwd = GetForward();
wheelFwd -= DotProduct(wheelFwd, m_aWheelColPoints[CARWHEEL_FRONT_RIGHT].normal)*m_aWheelColPoints[CARWHEEL_FRONT_RIGHT].normal;
@ -1015,9 +1015,7 @@ CAutomobile::ProcessControl(void)
if(!IsRealHeli()){
if(m_aWheelTimer[CARWHEEL_FRONT_LEFT] <= 0.0f){
if(mod_HandlingManager.HasRearWheelDrive(pHandling->nIdentifier) || acceleration == 0.0f)
m_aWheelSpeed[CARWHEEL_FRONT_LEFT] *= 0.95f;
else{
if(mod_HandlingManager.HasFrontWheelDrive(pHandling->nIdentifier) && acceleration != 0.0f){
if(acceleration > 0.0f){
if(m_aWheelSpeed[CARWHEEL_FRONT_LEFT] < 2.0f)
m_aWheelSpeed[CARWHEEL_FRONT_LEFT] -= 0.2f;
@ -1025,13 +1023,13 @@ CAutomobile::ProcessControl(void)
if(m_aWheelSpeed[CARWHEEL_FRONT_LEFT] > -2.0f)
m_aWheelSpeed[CARWHEEL_FRONT_LEFT] += 0.1f;
}
}else{
m_aWheelSpeed[CARWHEEL_FRONT_LEFT] *= 0.95f;
}
m_aWheelRotation[CARWHEEL_FRONT_LEFT] += m_aWheelSpeed[CARWHEEL_FRONT_LEFT];
}
if(m_aWheelTimer[CARWHEEL_FRONT_RIGHT] <= 0.0f){
if(mod_HandlingManager.HasRearWheelDrive(pHandling->nIdentifier) || acceleration == 0.0f)
m_aWheelSpeed[CARWHEEL_FRONT_RIGHT] *= 0.95f;
else{
if(mod_HandlingManager.HasFrontWheelDrive(pHandling->nIdentifier) && acceleration != 0.0f){
if(acceleration > 0.0f){
if(m_aWheelSpeed[CARWHEEL_FRONT_RIGHT] < 2.0f)
m_aWheelSpeed[CARWHEEL_FRONT_RIGHT] -= 0.2f;
@ -1039,6 +1037,8 @@ CAutomobile::ProcessControl(void)
if(m_aWheelSpeed[CARWHEEL_FRONT_RIGHT] > -2.0f)
m_aWheelSpeed[CARWHEEL_FRONT_RIGHT] += 0.1f;
}
}else{
m_aWheelSpeed[CARWHEEL_FRONT_RIGHT] *= 0.95f;
}
m_aWheelRotation[CARWHEEL_FRONT_RIGHT] += m_aWheelSpeed[CARWHEEL_FRONT_RIGHT];
}
@ -1065,7 +1065,7 @@ CAutomobile::ProcessControl(void)
if(m_fTireTemperature > 2.0f)
m_fTireTemperature = 2.0f;
}
}else if(m_doingBurnout && !mod_HandlingManager.HasFrontWheelDrive(pHandling->nIdentifier)){
}else if(m_doingBurnout && mod_HandlingManager.HasRearWheelDrive(pHandling->nIdentifier)){
rearBrake = 0.0f;
rearTraction = 0.0f;
// BUG: missing timestep
@ -1075,10 +1075,10 @@ CAutomobile::ProcessControl(void)
}
if(m_aWheelTimer[CARWHEEL_REAR_LEFT] > 0.0f){
if(mod_HandlingManager.HasFrontWheelDrive(pHandling->nIdentifier))
fThrust = 0.0f;
else
if(mod_HandlingManager.HasRearWheelDrive(pHandling->nIdentifier))
fThrust = acceleration;
else
fThrust = 0.0f;
wheelFwd -= DotProduct(wheelFwd, m_aWheelColPoints[CARWHEEL_REAR_LEFT].normal)*m_aWheelColPoints[CARWHEEL_REAR_LEFT].normal;
wheelFwd.Normalise();
@ -1120,10 +1120,10 @@ CAutomobile::ProcessControl(void)
#endif
if(m_aWheelTimer[CARWHEEL_REAR_RIGHT] > 0.0f){
if(mod_HandlingManager.HasFrontWheelDrive(pHandling->nIdentifier))
fThrust = 0.0f;
else
if(mod_HandlingManager.HasRearWheelDrive(pHandling->nIdentifier))
fThrust = acceleration;
else
fThrust = 0.0f;
wheelFwd -= DotProduct(wheelFwd, m_aWheelColPoints[CARWHEEL_REAR_RIGHT].normal)*m_aWheelColPoints[CARWHEEL_REAR_RIGHT].normal;
wheelFwd.Normalise();
@ -1159,7 +1159,7 @@ CAutomobile::ProcessControl(void)
}
}
if(m_doingBurnout && !mod_HandlingManager.HasFrontWheelDrive(pHandling->nIdentifier) &&
if(m_doingBurnout && mod_HandlingManager.HasRearWheelDrive(pHandling->nIdentifier) &&
(m_aWheelState[CARWHEEL_REAR_LEFT] == WHEEL_STATE_SPINNING || m_aWheelState[CARWHEEL_REAR_RIGHT] == WHEEL_STATE_SPINNING)){
m_fTireTemperature += 0.001f*CTimer::GetTimeStep();
if(m_fTireTemperature > 3.0f)
@ -1174,9 +1174,7 @@ CAutomobile::ProcessControl(void)
if(m_aWheelTimer[CARWHEEL_REAR_LEFT] <= 0.0f){
if(bIsHandbrakeOn)
m_aWheelSpeed[CARWHEEL_REAR_LEFT] = 0.0f;
else if(mod_HandlingManager.HasFrontWheelDrive(pHandling->nIdentifier) || acceleration == 0.0f)
m_aWheelSpeed[CARWHEEL_REAR_LEFT] *= 0.95f;
else{
else if(mod_HandlingManager.HasRearWheelDrive(pHandling->nIdentifier) && acceleration != 0.0f){
if(acceleration > 0.0f){
if(m_aWheelSpeed[CARWHEEL_REAR_LEFT] < 2.0f)
m_aWheelSpeed[CARWHEEL_REAR_LEFT] -= 0.2f;
@ -1184,15 +1182,15 @@ CAutomobile::ProcessControl(void)
if(m_aWheelSpeed[CARWHEEL_REAR_LEFT] > -2.0f)
m_aWheelSpeed[CARWHEEL_REAR_LEFT] += 0.1f;
}
}else{
m_aWheelSpeed[CARWHEEL_REAR_LEFT] *= 0.95f;
}
m_aWheelRotation[CARWHEEL_REAR_LEFT] += m_aWheelSpeed[CARWHEEL_REAR_LEFT];
}
if(m_aWheelTimer[CARWHEEL_REAR_RIGHT] <= 0.0f){
if(bIsHandbrakeOn)
m_aWheelSpeed[CARWHEEL_REAR_RIGHT] = 0.0f;
else if(mod_HandlingManager.HasFrontWheelDrive(pHandling->nIdentifier) || acceleration == 0.0f)
m_aWheelSpeed[CARWHEEL_REAR_RIGHT] *= 0.95f;
else{
else if(mod_HandlingManager.HasRearWheelDrive(pHandling->nIdentifier) && acceleration != 0.0f){
if(acceleration > 0.0f){
if(m_aWheelSpeed[CARWHEEL_REAR_RIGHT] < 2.0f)
m_aWheelSpeed[CARWHEEL_REAR_RIGHT] -= 0.2f;
@ -1200,6 +1198,8 @@ CAutomobile::ProcessControl(void)
if(m_aWheelSpeed[CARWHEEL_REAR_RIGHT] > -2.0f)
m_aWheelSpeed[CARWHEEL_REAR_RIGHT] += 0.1f;
}
}else{
m_aWheelSpeed[CARWHEEL_REAR_RIGHT] *= 0.95f;
}
m_aWheelRotation[CARWHEEL_REAR_RIGHT] += m_aWheelSpeed[CARWHEEL_REAR_RIGHT];
}
@ -1215,10 +1215,10 @@ CAutomobile::ProcessControl(void)
CVector wheelFwd, wheelRight, tmp;
if(m_aWheelTimer[CARWHEEL_FRONT_LEFT] > 0.0f){
if(mod_HandlingManager.HasRearWheelDrive(pHandling->nIdentifier))
fThrust = 0.0f;
else
if(mod_HandlingManager.HasFrontWheelDrive(pHandling->nIdentifier))
fThrust = acceleration;
else
fThrust = 0.0f;
wheelFwd = GetForward();
wheelFwd -= DotProduct(wheelFwd, m_aWheelColPoints[CARWHEEL_FRONT_LEFT].normal)*m_aWheelColPoints[CARWHEEL_FRONT_LEFT].normal;
@ -1258,10 +1258,10 @@ CAutomobile::ProcessControl(void)
}
if(m_aWheelTimer[CARWHEEL_FRONT_RIGHT] > 0.0f){
if(mod_HandlingManager.HasRearWheelDrive(pHandling->nIdentifier))
fThrust = 0.0f;
else
if(mod_HandlingManager.HasFrontWheelDrive(pHandling->nIdentifier))
fThrust = acceleration;
else
fThrust = 0.0f;
wheelFwd = GetForward();
wheelFwd -= DotProduct(wheelFwd, m_aWheelColPoints[CARWHEEL_FRONT_RIGHT].normal)*m_aWheelColPoints[CARWHEEL_FRONT_RIGHT].normal;
@ -1305,9 +1305,7 @@ CAutomobile::ProcessControl(void)
if (!IsRealHeli()) {
if(m_aWheelTimer[CARWHEEL_FRONT_LEFT] <= 0.0f){
if(mod_HandlingManager.HasRearWheelDrive(pHandling->nIdentifier) || acceleration == 0.0f)
m_aWheelSpeed[CARWHEEL_FRONT_LEFT] *= 0.95f;
else{
if(mod_HandlingManager.HasFrontWheelDrive(pHandling->nIdentifier) && acceleration != 0.0f){
if(acceleration > 0.0f){
if(m_aWheelSpeed[CARWHEEL_FRONT_LEFT] < 2.0f)
m_aWheelSpeed[CARWHEEL_FRONT_LEFT] -= 0.2f;
@ -1315,13 +1313,13 @@ CAutomobile::ProcessControl(void)
if(m_aWheelSpeed[CARWHEEL_FRONT_LEFT] > -2.0f)
m_aWheelSpeed[CARWHEEL_FRONT_LEFT] += 0.1f;
}
}else{
m_aWheelSpeed[CARWHEEL_FRONT_LEFT] *= 0.95f;
}
m_aWheelRotation[CARWHEEL_FRONT_LEFT] += m_aWheelSpeed[CARWHEEL_FRONT_LEFT];
}
if(m_aWheelTimer[CARWHEEL_FRONT_RIGHT] <= 0.0f){
if(mod_HandlingManager.HasRearWheelDrive(pHandling->nIdentifier) || acceleration == 0.0f)
m_aWheelSpeed[CARWHEEL_FRONT_RIGHT] *= 0.95f;
else{
if(mod_HandlingManager.HasFrontWheelDrive(pHandling->nIdentifier) && acceleration != 0.0f){
if(acceleration > 0.0f){
if(m_aWheelSpeed[CARWHEEL_FRONT_RIGHT] < 2.0f)
m_aWheelSpeed[CARWHEEL_FRONT_RIGHT] -= 0.2f;
@ -1329,6 +1327,8 @@ CAutomobile::ProcessControl(void)
if(m_aWheelSpeed[CARWHEEL_FRONT_RIGHT] > -2.0f)
m_aWheelSpeed[CARWHEEL_FRONT_RIGHT] += 0.1f;
}
}else{
m_aWheelSpeed[CARWHEEL_FRONT_RIGHT] *= 0.95f;
}
m_aWheelRotation[CARWHEEL_FRONT_RIGHT] += m_aWheelSpeed[CARWHEEL_FRONT_RIGHT];
}
@ -1424,7 +1424,12 @@ CAutomobile::ProcessControl(void)
if (GetModelIndex() == MI_RCRAIDER || GetModelIndex() == MI_RCGOBLIN)
FlyingControl(FLIGHT_MODEL_RCHELI);
else if (m_nWheelsOnGround < 4 && !(GetModelIndex() == MI_SEASPAR && bTouchingWater) ||
CPad::GetPad(0)->GetAccelerate() != 0 || CPad::GetPad(0)->GetCarGunUpDown() > 1.0f ||
CPad::GetPad(0)->GetAccelerate() != 0 ||
#ifndef FREE_CAM
CPad::GetPad(0)->GetCarGunUpDown() > 1.0f ||
#else
((!CCamera::bFreeCam || (CCamera::bFreeCam && !CPad::IsAffectedByController)) && CPad::GetPad(0)->GetCarGunUpDown() > 1.0f) ||
#endif
Abs(m_vecMoveSpeed.x) > 0.02f ||
Abs(m_vecMoveSpeed.y) > 0.02f ||
Abs(m_vecMoveSpeed.z) > 0.02f)

View file

@ -1844,7 +1844,12 @@ CBike::ProcessControlInputs(uint8 pad)
m_fSteerInput = clamp(m_fSteerInput, -1.0f, 1.0f);
// Lean forward/backward
float updown = -CPad::GetPad(pad)->GetSteeringUpDown()/128.0f + CPad::GetPad(pad)->GetCarGunUpDown()/128.0f;
float updown;
#ifdef FREE_CAM
if (CCamera::bFreeCam) updown = CPad::IsAffectedByController ? -CPad::GetPad(pad)->GetSteeringUpDown()/128.0f : CPad::GetPad(pad)->GetCarGunUpDown()/128.0f;
else
#endif
updown = -CPad::GetPad(pad)->GetSteeringUpDown()/128.0f + CPad::GetPad(pad)->GetCarGunUpDown()/128.0f;
m_fLeanInput += (updown - m_fLeanInput)*0.2f*CTimer::GetTimeStep();
m_fLeanInput = clamp(m_fLeanInput, -1.0f, 1.0f);

View file

@ -964,7 +964,14 @@ CBoat::PreRender(void)
// FIX: Planes can also be controlled with GetCarGunUpDown
#ifdef FIX_BUGS
static float steeringUpDown = 0.0f;
#ifdef FREE_CAM
if(!CCamera::bFreeCam || (CCamera::bFreeCam && !CPad::IsAffectedByController))
#endif
steeringUpDown += ((Abs(CPad::GetPad(0)->GetCarGunUpDown()) > 1.0f ? (-CPad::GetPad(0)->GetCarGunUpDown()/128.0f) : (-CPad::GetPad(0)->GetSteeringUpDown()/128.0f)) - steeringUpDown) * Min(1.f, CTimer::GetTimeStep()/5.f);
#ifdef FREE_CAM
else
steeringUpDown = -CPad::GetPad(0)->GetSteeringUpDown()/128.0f;
#endif
#else
float steeringUpDown = -CPad::GetPad(0)->GetSteeringUpDown()/128.0f;
#endif

View file

@ -273,7 +273,7 @@ public:
tBikeHandlingData *GetBikePointer(uint8 id) { return &BikeHandlingData[id-HANDLING_BIKE]; }
tFlyingHandlingData *GetFlyingPointer(uint8 id);
tBoatHandlingData *GetBoatPointer(uint8 id);
bool HasRearWheelDrive(tVehicleType id) { return HandlingData[id].Transmission.nDriveType == 'R'; }
bool HasFrontWheelDrive(tVehicleType id) { return HandlingData[id].Transmission.nDriveType == 'F'; }
bool HasRearWheelDrive(tVehicleType id) { return HandlingData[id].Transmission.nDriveType != 'F'; }
bool HasFrontWheelDrive(tVehicleType id) { return HandlingData[id].Transmission.nDriveType != 'R'; }
};
extern cHandlingDataMgr mod_HandlingManager;

View file

@ -334,6 +334,9 @@ CVehicle::FlyingControl(eFlightModel flightModel)
float fSteerLR = CPad::GetPad(0)->GetSteeringLeftRight() / 128.0f;
float fSteerUD = -CPad::GetPad(0)->GetSteeringUpDown() / 128.0f;
float fGunUD = Abs(CPad::GetPad(0)->GetCarGunUpDown());
#ifdef FREE_CAM
if(!CCamera::bFreeCam || (CCamera::bFreeCam && !CPad::IsAffectedByController))
#endif
if(fGunUD > 1.0f)
fSteerUD = -CPad::GetPad(0)->GetCarGunUpDown() / 128.0f;
@ -507,9 +510,15 @@ CVehicle::FlyingControl(eFlightModel flightModel)
fYaw = CPad::GetPad(0)->GetLookRight();
if (CPad::GetPad(0)->GetLookLeft())
fYaw = -1.0f;
#ifdef FREE_CAM
if (!CCamera::bFreeCam || (CCamera::bFreeCam && !CPad::IsAffectedByController))
#endif
if(Abs(CPad::GetPad(0)->GetCarGunLeftRight()) > 1.0f)
fYaw = CPad::GetPad(0)->GetCarGunLeftRight() / 128.0f;
}
#ifdef FREE_CAM
if(!CCamera::bFreeCam || (CCamera::bFreeCam && !CPad::IsAffectedByController))
#endif
if(Abs(CPad::GetPad(0)->GetCarGunUpDown()) > 1.0f)
fPitch = -CPad::GetPad(0)->GetCarGunUpDown() / 128.0f;
if (CPad::GetPad(0)->GetHorn()) {

View file

@ -44,6 +44,10 @@ float fPlayerAimScale = 2.5f;
bool CWeapon::bPhotographHasBeenTaken;
#ifdef SECUROM
int32 sniperPirateCheck = 0x00797743; // 'Cwy\0' ???
#endif
CWeaponInfo *
CWeapon::GetInfo()
{
@ -2201,6 +2205,13 @@ CWeapon::FireSniper(CEntity *shooter)
}
}
#ifdef SECUROM
if (sniperPirateCheck){
// if not pirated game
// sniperPirateCheck = 0;
}
#endif
#ifndef FIX_BUGS
CWeaponInfo *info = GetInfo(); //unused
#endif
@ -2217,6 +2228,10 @@ CWeapon::FireSniper(CEntity *shooter)
dir.Normalise();
dir *= 16.0f;
#ifdef SECUROM
if (sniperPirateCheck) return true;
#endif
CBulletInfo::AddBullet(shooter, m_eWeaponType, source, dir);
if ( shooter == FindPlayerPed() )

View file

@ -56,65 +56,6 @@ typedef struct _AILSOUNDINFO
void const *initial_ptr;
} AILSOUNDINFO;
#define DLLEXPORT extern "C" __declspec(dllexport)
DLLEXPORT S32 WINAPI AIL_enumerate_3D_providers(HPROENUM *next, HPROVIDER *dest, C8 **name);
DLLEXPORT void WINAPI AIL_release_3D_sample_handle(H3DSAMPLE S);
DLLEXPORT void WINAPI AIL_close_3D_provider(HPROVIDER lib);
DLLEXPORT void WINAPI AIL_set_3D_provider_preference(HPROVIDER lib, C8 const *name, void const *val);
DLLEXPORT M3DRESULT WINAPI AIL_open_3D_provider(HPROVIDER lib);
DLLEXPORT C8 *WINAPI AIL_last_error(void);
DLLEXPORT S32 WINAPI AIL_3D_room_type(HPROVIDER lib);
DLLEXPORT void WINAPI AIL_set_3D_room_type(HPROVIDER lib, S32 room_type);
DLLEXPORT void WINAPI AIL_3D_provider_attribute(HPROVIDER lib, C8 const *name, void *val);
DLLEXPORT H3DSAMPLE WINAPI AIL_allocate_3D_sample_handle(HPROVIDER lib);
DLLEXPORT void WINAPI AIL_set_3D_sample_effects_level(H3DSAMPLE S, F32 effects_level);
DLLEXPORT void WINAPI AIL_set_3D_speaker_type(HPROVIDER lib, S32 speaker_type);
DLLEXPORT HSTREAM WINAPI AIL_open_stream(HDIGDRIVER dig, C8 const *filename, S32 stream_mem);
DLLEXPORT void WINAPI AIL_stream_ms_position(HSTREAM S, S32 *total_milliseconds, S32 *current_milliseconds);
DLLEXPORT void WINAPI AIL_close_stream(HSTREAM stream);
DLLEXPORT S32 WINAPI AIL_digital_handle_release(HDIGDRIVER drvr);
DLLEXPORT S32 WINAPI AIL_digital_handle_reacquire(HDIGDRIVER drvr);
DLLEXPORT C8 *WINAPI AIL_set_redist_directory(C8 const *dir);
DLLEXPORT S32 WINAPI AIL_startup(void);
DLLEXPORT S32 WINAPI AIL_set_preference(U32 number, S32 value);
DLLEXPORT HDIGDRIVER WINAPI AIL_open_digital_driver(U32 frequency, S32 bits, S32 channel, U32 flags);
DLLEXPORT void *WINAPI AIL_mem_alloc_lock(U32 size);
DLLEXPORT HSAMPLE WINAPI AIL_allocate_sample_handle(HDIGDRIVER dig);
DLLEXPORT void WINAPI AIL_init_sample(HSAMPLE S);
DLLEXPORT void WINAPI AIL_set_sample_type(HSAMPLE S, S32 format, U32 flags);
DLLEXPORT void WINAPI AIL_pause_stream(HSTREAM stream, S32 onoff);
DLLEXPORT void WINAPI AIL_release_sample_handle(HSAMPLE S);
DLLEXPORT void WINAPI AIL_mem_free_lock(void *ptr);
DLLEXPORT void WINAPI AIL_close_digital_driver(HDIGDRIVER dig);
DLLEXPORT void WINAPI AIL_shutdown(void);
DLLEXPORT void WINAPI AIL_set_3D_sample_volume(H3DSAMPLE S, S32 volume);
DLLEXPORT void WINAPI AIL_set_sample_volume(HSAMPLE S, S32 volume);
DLLEXPORT void WINAPI AIL_set_sample_address(HSAMPLE S, void const *start, U32 len);
DLLEXPORT S32 WINAPI AIL_set_3D_sample_info(H3DSAMPLE S, AILSOUNDINFO const *info);
DLLEXPORT void WINAPI AIL_set_3D_position(H3DPOBJECT obj, F32 X, F32 Y, F32 Z);
DLLEXPORT void WINAPI AIL_set_3D_sample_distances(H3DSAMPLE S, F32 max_dist, F32 min_dist);
DLLEXPORT void WINAPI AIL_set_sample_pan(HSAMPLE S, S32 pan);
DLLEXPORT void WINAPI AIL_set_sample_playback_rate(HSAMPLE S, S32 playback_rate);
DLLEXPORT void WINAPI AIL_set_3D_sample_playback_rate(H3DSAMPLE S, S32 playback_rate);
DLLEXPORT void WINAPI AIL_set_sample_loop_block(HSAMPLE S, S32 loop_start_offset, S32 loop_end_offset);
DLLEXPORT void WINAPI AIL_set_3D_sample_loop_block(H3DSAMPLE S, S32 loop_start_offset, S32 loop_end_offset);
DLLEXPORT void WINAPI AIL_set_sample_loop_count(HSAMPLE S, S32 loop_count);
DLLEXPORT void WINAPI AIL_set_3D_sample_loop_count(H3DSAMPLE S, S32 loops);
DLLEXPORT U32 WINAPI AIL_sample_status(HSAMPLE S);
DLLEXPORT U32 WINAPI AIL_3D_sample_status(H3DSAMPLE S);
DLLEXPORT void WINAPI AIL_start_sample(HSAMPLE S);
DLLEXPORT void WINAPI AIL_start_3D_sample(H3DSAMPLE S);
DLLEXPORT void WINAPI AIL_end_sample(HSAMPLE S);
DLLEXPORT void WINAPI AIL_end_3D_sample(H3DSAMPLE S);
DLLEXPORT void WINAPI AIL_set_stream_loop_count(HSTREAM stream, S32 count);
DLLEXPORT S32 WINAPI AIL_service_stream(HSTREAM stream, S32 fillup);
DLLEXPORT void WINAPI AIL_start_stream(HSTREAM stream);
DLLEXPORT void WINAPI AIL_set_stream_ms_position(HSTREAM S, S32 milliseconds);
DLLEXPORT void WINAPI AIL_set_stream_volume(HSTREAM stream, S32 volume);
DLLEXPORT void WINAPI AIL_set_stream_pan(HSTREAM stream, S32 pan);
DLLEXPORT S32 WINAPI AIL_stream_status(HSTREAM stream);
typedef U32 (WINAPI *AIL_file_open_callback)(char const * Filename, U32 * FileHandle);
typedef void (WINAPI *AIL_file_close_callback)(U32 FileHandle);
@ -127,4 +68,74 @@ typedef S32(WINAPI* AIL_file_seek_callback) (U32 FileHandle, S32 Offset, U32 Ty
typedef U32(WINAPI *AIL_file_read_callback)(U32 FileHandle, void* Buffer, U32 Bytes);
DLLEXPORT void WINAPI AIL_set_file_callbacks(AIL_file_open_callback opencb, AIL_file_close_callback closecb, AIL_file_seek_callback seekcb, AIL_file_read_callback readcb);
#ifdef RE3MSS_EXPORTS
#define RE3MSS_EXPORT __declspec(dllexport)
#else
#define RE3MSS_EXPORT __declspec(dllimport)
#endif
#ifdef __cplusplus
extern "C" {
#endif
RE3MSS_EXPORT S32 WINAPI AIL_enumerate_3D_providers(HPROENUM *next, HPROVIDER *dest, C8 **name);
RE3MSS_EXPORT void WINAPI AIL_release_3D_sample_handle(H3DSAMPLE S);
RE3MSS_EXPORT void WINAPI AIL_close_3D_provider(HPROVIDER lib);
RE3MSS_EXPORT void WINAPI AIL_set_3D_provider_preference(HPROVIDER lib, C8 const *name, void const *val);
RE3MSS_EXPORT M3DRESULT WINAPI AIL_open_3D_provider(HPROVIDER lib);
RE3MSS_EXPORT C8 *WINAPI AIL_last_error(void);
RE3MSS_EXPORT S32 WINAPI AIL_3D_room_type(HPROVIDER lib);
RE3MSS_EXPORT void WINAPI AIL_set_3D_room_type(HPROVIDER lib, S32 room_type);
RE3MSS_EXPORT void WINAPI AIL_3D_provider_attribute(HPROVIDER lib, C8 const *name, void *val);
RE3MSS_EXPORT H3DSAMPLE WINAPI AIL_allocate_3D_sample_handle(HPROVIDER lib);
RE3MSS_EXPORT void WINAPI AIL_set_3D_sample_effects_level(H3DSAMPLE S, F32 effects_level);
RE3MSS_EXPORT void WINAPI AIL_set_3D_speaker_type(HPROVIDER lib, S32 speaker_type);
RE3MSS_EXPORT HSTREAM WINAPI AIL_open_stream(HDIGDRIVER dig, C8 const *filename, S32 stream_mem);
RE3MSS_EXPORT void WINAPI AIL_stream_ms_position(HSTREAM S, S32 *total_milliseconds, S32 *current_milliseconds);
RE3MSS_EXPORT void WINAPI AIL_close_stream(HSTREAM stream);
RE3MSS_EXPORT S32 WINAPI AIL_digital_handle_release(HDIGDRIVER drvr);
RE3MSS_EXPORT S32 WINAPI AIL_digital_handle_reacquire(HDIGDRIVER drvr);
RE3MSS_EXPORT C8 *WINAPI AIL_set_redist_directory(C8 const *dir);
RE3MSS_EXPORT S32 WINAPI AIL_startup(void);
RE3MSS_EXPORT S32 WINAPI AIL_set_preference(U32 number, S32 value);
RE3MSS_EXPORT HDIGDRIVER WINAPI AIL_open_digital_driver(U32 frequency, S32 bits, S32 channel, U32 flags);
RE3MSS_EXPORT void *WINAPI AIL_mem_alloc_lock(U32 size);
RE3MSS_EXPORT HSAMPLE WINAPI AIL_allocate_sample_handle(HDIGDRIVER dig);
RE3MSS_EXPORT void WINAPI AIL_init_sample(HSAMPLE S);
RE3MSS_EXPORT void WINAPI AIL_set_sample_type(HSAMPLE S, S32 format, U32 flags);
RE3MSS_EXPORT void WINAPI AIL_pause_stream(HSTREAM stream, S32 onoff);
RE3MSS_EXPORT void WINAPI AIL_release_sample_handle(HSAMPLE S);
RE3MSS_EXPORT void WINAPI AIL_mem_free_lock(void *ptr);
RE3MSS_EXPORT void WINAPI AIL_close_digital_driver(HDIGDRIVER dig);
RE3MSS_EXPORT void WINAPI AIL_shutdown(void);
RE3MSS_EXPORT void WINAPI AIL_set_3D_sample_volume(H3DSAMPLE S, S32 volume);
RE3MSS_EXPORT void WINAPI AIL_set_sample_volume(HSAMPLE S, S32 volume);
RE3MSS_EXPORT void WINAPI AIL_set_sample_address(HSAMPLE S, void const *start, U32 len);
RE3MSS_EXPORT S32 WINAPI AIL_set_3D_sample_info(H3DSAMPLE S, AILSOUNDINFO const *info);
RE3MSS_EXPORT void WINAPI AIL_set_3D_position(H3DPOBJECT obj, F32 X, F32 Y, F32 Z);
RE3MSS_EXPORT void WINAPI AIL_set_3D_sample_distances(H3DSAMPLE S, F32 max_dist, F32 min_dist);
RE3MSS_EXPORT void WINAPI AIL_set_sample_pan(HSAMPLE S, S32 pan);
RE3MSS_EXPORT void WINAPI AIL_set_sample_playback_rate(HSAMPLE S, S32 playback_rate);
RE3MSS_EXPORT void WINAPI AIL_set_3D_sample_playback_rate(H3DSAMPLE S, S32 playback_rate);
RE3MSS_EXPORT void WINAPI AIL_set_sample_loop_block(HSAMPLE S, S32 loop_start_offset, S32 loop_end_offset);
RE3MSS_EXPORT void WINAPI AIL_set_3D_sample_loop_block(H3DSAMPLE S, S32 loop_start_offset, S32 loop_end_offset);
RE3MSS_EXPORT void WINAPI AIL_set_sample_loop_count(HSAMPLE S, S32 loop_count);
RE3MSS_EXPORT void WINAPI AIL_set_3D_sample_loop_count(H3DSAMPLE S, S32 loops);
RE3MSS_EXPORT U32 WINAPI AIL_sample_status(HSAMPLE S);
RE3MSS_EXPORT U32 WINAPI AIL_3D_sample_status(H3DSAMPLE S);
RE3MSS_EXPORT void WINAPI AIL_start_sample(HSAMPLE S);
RE3MSS_EXPORT void WINAPI AIL_start_3D_sample(H3DSAMPLE S);
RE3MSS_EXPORT void WINAPI AIL_end_sample(HSAMPLE S);
RE3MSS_EXPORT void WINAPI AIL_end_3D_sample(H3DSAMPLE S);
RE3MSS_EXPORT void WINAPI AIL_set_stream_loop_count(HSTREAM stream, S32 count);
RE3MSS_EXPORT S32 WINAPI AIL_service_stream(HSTREAM stream, S32 fillup);
RE3MSS_EXPORT void WINAPI AIL_start_stream(HSTREAM stream);
RE3MSS_EXPORT void WINAPI AIL_set_stream_ms_position(HSTREAM S, S32 milliseconds);
RE3MSS_EXPORT void WINAPI AIL_set_stream_volume(HSTREAM stream, S32 volume);
RE3MSS_EXPORT void WINAPI AIL_set_stream_pan(HSTREAM stream, S32 pan);
RE3MSS_EXPORT S32 WINAPI AIL_stream_status(HSTREAM stream);
RE3MSS_EXPORT void WINAPI AIL_set_file_callbacks(AIL_file_open_callback opencb, AIL_file_close_callback closecb, AIL_file_seek_callback seekcb, AIL_file_read_callback readcb);
#ifdef __cplusplus
}
#endif

Binary file not shown.