mirror of
https://git.rip/DMCA_FUCKER/re3.git
synced 2025-01-11 06:34:09 +00:00
minimal weather stuff + multiple bugfixes
This commit is contained in:
parent
9067469f7c
commit
4defd8b75c
|
@ -17,6 +17,7 @@
|
||||||
#include "ModelInfo.h"
|
#include "ModelInfo.h"
|
||||||
#include "Object.h"
|
#include "Object.h"
|
||||||
#include "Pad.h"
|
#include "Pad.h"
|
||||||
|
#include "PedAttractor.h"
|
||||||
#include "Phones.h"
|
#include "Phones.h"
|
||||||
#include "Pickups.h"
|
#include "Pickups.h"
|
||||||
#include "Plane.h"
|
#include "Plane.h"
|
||||||
|
@ -1116,6 +1117,14 @@ void CReplay::StoreStuffInMem(void)
|
||||||
for (int i = 0; i < NUMPLAYERS; i++)
|
for (int i = 0; i < NUMPLAYERS; i++)
|
||||||
nHandleOfPlayerPed[i] = CPools::GetPedPool()->GetIndex(CWorld::Players[i].m_pPed);
|
nHandleOfPlayerPed[i] = CPools::GetPedPool()->GetIndex(CWorld::Players[i].m_pPed);
|
||||||
#endif
|
#endif
|
||||||
|
int i = CPools::GetPedPool()->GetSize();
|
||||||
|
while (--i >= 0) {
|
||||||
|
CPed* ped = CPools::GetPedPool()->GetSlot(i);
|
||||||
|
if (!ped)
|
||||||
|
continue;
|
||||||
|
if (ped->m_attractor)
|
||||||
|
GetPedAttractorManager()->DeRegisterPed(ped, ped->m_attractor);
|
||||||
|
}
|
||||||
CPools::GetVehiclePool()->Store(pBuf0, pBuf1);
|
CPools::GetVehiclePool()->Store(pBuf0, pBuf1);
|
||||||
CPools::GetPedPool()->Store(pBuf2, pBuf3);
|
CPools::GetPedPool()->Store(pBuf2, pBuf3);
|
||||||
CPools::GetObjectPool()->Store(pBuf4, pBuf5);
|
CPools::GetObjectPool()->Store(pBuf4, pBuf5);
|
||||||
|
|
|
@ -5248,12 +5248,8 @@ int8 CRunningScript::ProcessCommands500To599(int32 command)
|
||||||
ScriptParams[3] / 255.0f, ScriptParams[4] / 255.0f, ScriptParams[5] / 255.0f, 0, true);
|
ScriptParams[3] / 255.0f, ScriptParams[4] / 255.0f, ScriptParams[5] / 255.0f, 0, true);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
case COMMAND_STORE_WEATHER:
|
//case COMMAND_STORE_WEATHER:
|
||||||
CWeather::StoreWeatherState();
|
//case COMMAND_RESTORE_WEATHER:
|
||||||
return 0;
|
|
||||||
case COMMAND_RESTORE_WEATHER:
|
|
||||||
CWeather::RestoreWeatherState();
|
|
||||||
return 0;
|
|
||||||
case COMMAND_STORE_CLOCK:
|
case COMMAND_STORE_CLOCK:
|
||||||
CClock::StoreClock();
|
CClock::StoreClock();
|
||||||
return 0;
|
return 0;
|
||||||
|
|
|
@ -60,6 +60,7 @@ int32 CStats::HighestScores[CStats::TOTAL_HIGHEST_SCORES];
|
||||||
|
|
||||||
int32 CStats::Sprayings;
|
int32 CStats::Sprayings;
|
||||||
float CStats::AutoPaintingBudget;
|
float CStats::AutoPaintingBudget;
|
||||||
|
int32 CStats::NoMoreHurricanes;
|
||||||
|
|
||||||
void CStats::Init()
|
void CStats::Init()
|
||||||
{
|
{
|
||||||
|
@ -119,6 +120,7 @@ void CStats::Init()
|
||||||
|
|
||||||
Sprayings = 0;
|
Sprayings = 0;
|
||||||
AutoPaintingBudget = 0.0f;
|
AutoPaintingBudget = 0.0f;
|
||||||
|
NoMoreHurricanes = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void CStats::RegisterFastestTime(int32 index, int32 time)
|
void CStats::RegisterFastestTime(int32 index, int32 time)
|
||||||
|
|
|
@ -64,6 +64,7 @@ public:
|
||||||
static int32 HighestScores[TOTAL_HIGHEST_SCORES];
|
static int32 HighestScores[TOTAL_HIGHEST_SCORES];
|
||||||
static int32 Sprayings;
|
static int32 Sprayings;
|
||||||
static float AutoPaintingBudget;
|
static float AutoPaintingBudget;
|
||||||
|
static int32 NoMoreHurricanes;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
static void Init(void);
|
static void Init(void);
|
||||||
|
|
|
@ -143,7 +143,8 @@ CRenderer::RenderOneNonRoad(CEntity *e)
|
||||||
resetLights = e->SetupLighting();
|
resetLights = e->SetupLighting();
|
||||||
|
|
||||||
if(e->IsVehicle()){
|
if(e->IsVehicle()){
|
||||||
CVisibilityPlugins::SetupVehicleVariables(e->GetClump());
|
// unfortunately can't use GetClump here
|
||||||
|
CVisibilityPlugins::SetupVehicleVariables((RpClump*)e->m_rwObject);
|
||||||
CVisibilityPlugins::InitAlphaAtomicList();
|
CVisibilityPlugins::InitAlphaAtomicList();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -8,6 +8,7 @@
|
||||||
#include "DMAudio.h"
|
#include "DMAudio.h"
|
||||||
#include "General.h"
|
#include "General.h"
|
||||||
#include "Pad.h"
|
#include "Pad.h"
|
||||||
|
#include "PlayerPed.h"
|
||||||
#include "Particle.h"
|
#include "Particle.h"
|
||||||
#include "RenderBuffer.h"
|
#include "RenderBuffer.h"
|
||||||
#include "Stats.h"
|
#include "Stats.h"
|
||||||
|
@ -40,41 +41,60 @@ float CWeather::Rain;
|
||||||
float CWeather::InterpolationValue;
|
float CWeather::InterpolationValue;
|
||||||
float CWeather::WetRoads;
|
float CWeather::WetRoads;
|
||||||
float CWeather::Rainbow;
|
float CWeather::Rainbow;
|
||||||
|
float CWeather::SunGlare;
|
||||||
|
float CWeather::WindClipped;
|
||||||
|
float CWeather::TrafficLightBrightness;
|
||||||
|
|
||||||
bool CWeather::bScriptsForceRain;
|
bool CWeather::bScriptsForceRain;
|
||||||
bool CWeather::Stored_StateStored;
|
|
||||||
|
|
||||||
float CWeather::Stored_InterpolationValue;
|
|
||||||
int16 CWeather::Stored_OldWeatherType;
|
|
||||||
int16 CWeather::Stored_NewWeatherType;
|
|
||||||
float CWeather::Stored_Rain;
|
|
||||||
|
|
||||||
tRainStreak Streaks[NUM_RAIN_STREAKS];
|
tRainStreak Streaks[NUM_RAIN_STREAKS];
|
||||||
|
|
||||||
const int16 WeatherTypesList[] = {
|
const 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,
|
||||||
|
WEATHER_EXTRA_SUNNY, WEATHER_EXTRA_SUNNY, WEATHER_SUNNY, WEATHER_SUNNY,
|
||||||
|
WEATHER_SUNNY, WEATHER_EXTRA_SUNNY, WEATHER_EXTRA_SUNNY, WEATHER_EXTRA_SUNNY,
|
||||||
|
WEATHER_EXTRA_SUNNY, WEATHER_SUNNY, WEATHER_SUNNY, 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_EXTRA_SUNNY,
|
||||||
|
WEATHER_EXTRA_SUNNY, WEATHER_EXTRA_SUNNY, WEATHER_SUNNY, WEATHER_SUNNY,
|
||||||
WEATHER_SUNNY, WEATHER_SUNNY, WEATHER_SUNNY, WEATHER_SUNNY,
|
WEATHER_SUNNY, WEATHER_SUNNY, WEATHER_SUNNY, WEATHER_SUNNY,
|
||||||
WEATHER_SUNNY, WEATHER_SUNNY, WEATHER_SUNNY, WEATHER_SUNNY,
|
WEATHER_SUNNY, WEATHER_SUNNY, WEATHER_SUNNY, WEATHER_CLOUDY,
|
||||||
WEATHER_SUNNY, WEATHER_SUNNY, WEATHER_SUNNY, WEATHER_SUNNY,
|
WEATHER_RAINY, WEATHER_RAINY, WEATHER_RAINY, WEATHER_RAINY,
|
||||||
WEATHER_SUNNY, WEATHER_SUNNY, WEATHER_SUNNY, WEATHER_SUNNY,
|
|
||||||
WEATHER_CLOUDY, WEATHER_CLOUDY, WEATHER_RAINY, WEATHER_RAINY,
|
|
||||||
WEATHER_CLOUDY, WEATHER_SUNNY, WEATHER_SUNNY, WEATHER_SUNNY,
|
WEATHER_CLOUDY, WEATHER_SUNNY, WEATHER_SUNNY, WEATHER_SUNNY,
|
||||||
WEATHER_CLOUDY, WEATHER_FOGGY, WEATHER_FOGGY, WEATHER_CLOUDY,
|
WEATHER_SUNNY, WEATHER_EXTRA_SUNNY, WEATHER_EXTRA_SUNNY, WEATHER_EXTRA_SUNNY,
|
||||||
WEATHER_SUNNY, WEATHER_SUNNY, WEATHER_CLOUDY, WEATHER_CLOUDY,
|
WEATHER_EXTRA_SUNNY, WEATHER_EXTRA_SUNNY, WEATHER_EXTRA_SUNNY, WEATHER_EXTRA_SUNNY,
|
||||||
|
WEATHER_EXTRA_SUNNY, WEATHER_EXTRA_SUNNY, WEATHER_EXTRA_SUNNY, WEATHER_EXTRA_SUNNY
|
||||||
|
};
|
||||||
|
|
||||||
|
const 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,
|
||||||
|
WEATHER_EXTRA_SUNNY, WEATHER_EXTRA_SUNNY, WEATHER_SUNNY, WEATHER_SUNNY,
|
||||||
|
WEATHER_SUNNY, WEATHER_EXTRA_SUNNY, WEATHER_EXTRA_SUNNY, WEATHER_CLOUDY,
|
||||||
|
WEATHER_HURRICANE, WEATHER_HURRICANE, WEATHER_CLOUDY, WEATHER_SUNNY,
|
||||||
|
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_EXTRA_SUNNY, WEATHER_EXTRA_SUNNY, WEATHER_SUNNY, WEATHER_SUNNY,
|
||||||
WEATHER_SUNNY, WEATHER_SUNNY, WEATHER_SUNNY, WEATHER_SUNNY,
|
WEATHER_SUNNY, WEATHER_SUNNY, WEATHER_SUNNY, WEATHER_SUNNY,
|
||||||
WEATHER_SUNNY, WEATHER_SUNNY, WEATHER_SUNNY, WEATHER_SUNNY,
|
WEATHER_SUNNY, WEATHER_SUNNY, WEATHER_SUNNY, WEATHER_SUNNY,
|
||||||
WEATHER_CLOUDY, WEATHER_CLOUDY, WEATHER_RAINY, WEATHER_RAINY,
|
WEATHER_CLOUDY, WEATHER_HURRICANE, WEATHER_HURRICANE, WEATHER_HURRICANE,
|
||||||
WEATHER_CLOUDY, WEATHER_RAINY, WEATHER_CLOUDY, WEATHER_SUNNY,
|
WEATHER_CLOUDY, WEATHER_SUNNY, WEATHER_SUNNY, WEATHER_SUNNY,
|
||||||
WEATHER_SUNNY, WEATHER_SUNNY, WEATHER_SUNNY, WEATHER_SUNNY,
|
WEATHER_SUNNY, WEATHER_EXTRA_SUNNY, WEATHER_EXTRA_SUNNY, WEATHER_EXTRA_SUNNY,
|
||||||
WEATHER_SUNNY, WEATHER_SUNNY, WEATHER_SUNNY, WEATHER_SUNNY,
|
WEATHER_EXTRA_SUNNY, WEATHER_EXTRA_SUNNY, WEATHER_EXTRA_SUNNY, WEATHER_EXTRA_SUNNY,
|
||||||
WEATHER_SUNNY, WEATHER_FOGGY, WEATHER_FOGGY, WEATHER_SUNNY,
|
WEATHER_EXTRA_SUNNY, WEATHER_EXTRA_SUNNY, WEATHER_EXTRA_SUNNY, WEATHER_EXTRA_SUNNY
|
||||||
WEATHER_SUNNY, WEATHER_SUNNY, WEATHER_RAINY, WEATHER_CLOUDY,
|
|
||||||
};
|
};
|
||||||
|
|
||||||
const float Windiness[] = {
|
const float Windiness[] = {
|
||||||
0.0f, // WEATHER_SUNNY
|
0.25f,// WEATHER_SUNNY
|
||||||
0.7f, // WEATHER_CLOUDY
|
0.7f, // WEATHER_CLOUDY
|
||||||
1.0f, // WEATHER_RAINY
|
1.0f, // WEATHER_RAINY
|
||||||
0.5f // WEATHER_FOGGY
|
0.0f, // WEATHER_FOGGY
|
||||||
|
0.0f, // WEATHER_EXTRA_SUNNY
|
||||||
|
2.0f, // WEATHER_HURRICANE
|
||||||
|
0.0f
|
||||||
};
|
};
|
||||||
|
|
||||||
#define MIN_TIME_BETWEEN_LIGHTNING_FLASH_CHANGES (50)
|
#define MIN_TIME_BETWEEN_LIGHTNING_FLASH_CHANGES (50)
|
||||||
|
@ -105,10 +125,9 @@ const float Windiness[] = {
|
||||||
|
|
||||||
void CWeather::Init(void)
|
void CWeather::Init(void)
|
||||||
{
|
{
|
||||||
NewWeatherType = WEATHER_SUNNY;
|
NewWeatherType = WEATHER_EXTRA_SUNNY;
|
||||||
bScriptsForceRain = false;
|
bScriptsForceRain = false;
|
||||||
OldWeatherType = WEATHER_CLOUDY;
|
OldWeatherType = WEATHER_EXTRA_SUNNY;
|
||||||
Stored_StateStored = false;
|
|
||||||
InterpolationValue = 0.0f;
|
InterpolationValue = 0.0f;
|
||||||
WhenToPlayLightningSound = 0;
|
WhenToPlayLightningSound = 0;
|
||||||
WeatherTypeInList = 0;
|
WeatherTypeInList = 0;
|
||||||
|
@ -128,16 +147,8 @@ void CWeather::Update(void)
|
||||||
NewWeatherType = ForcedWeatherType;
|
NewWeatherType = ForcedWeatherType;
|
||||||
else {
|
else {
|
||||||
WeatherTypeInList = (WeatherTypeInList + 1) % ARRAY_SIZE(WeatherTypesList);
|
WeatherTypeInList = (WeatherTypeInList + 1) % ARRAY_SIZE(WeatherTypesList);
|
||||||
NewWeatherType = WeatherTypesList[WeatherTypeInList];
|
NewWeatherType = CStats::NoMoreHurricanes ? WeatherTypesList[WeatherTypeInList] : WeatherTypesList_WithHurricanes[WeatherTypeInList];
|
||||||
#ifdef FIX_BUGS
|
|
||||||
}
|
}
|
||||||
if (NewWeatherType == WEATHER_RAINY)
|
|
||||||
CStats::mmRain += CGeneral::GetRandomNumber() & 7;
|
|
||||||
#else
|
|
||||||
if (NewWeatherType == WEATHER_RAINY)
|
|
||||||
CStats::mmRain += CGeneral::GetRandomNumber() & 7;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
InterpolationValue = fNewInterpolation;
|
InterpolationValue = fNewInterpolation;
|
||||||
if (CPad::GetPad(1)->GetRightShockJustDown()) {
|
if (CPad::GetPad(1)->GetRightShockJustDown()) {
|
||||||
|
@ -189,14 +200,14 @@ void CWeather::Update(void)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Wet roads
|
// Wet roads
|
||||||
if (OldWeatherType == WEATHER_RAINY) {
|
if (OldWeatherType == WEATHER_RAINY || OldWeatherType == WEATHER_HURRICANE) {
|
||||||
if (NewWeatherType == WEATHER_RAINY)
|
if (NewWeatherType == WEATHER_RAINY || NewWeatherType == WEATHER_HURRICANE)
|
||||||
WetRoads = 1.0f;
|
WetRoads = 1.0f;
|
||||||
else
|
else
|
||||||
WetRoads = 1.0f - InterpolationValue;
|
WetRoads = 1.0f - InterpolationValue;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
if (NewWeatherType == WEATHER_RAINY)
|
if (NewWeatherType == WEATHER_RAINY || NewWeatherType == WEATHER_HURRICANE)
|
||||||
WetRoads = InterpolationValue;
|
WetRoads = InterpolationValue;
|
||||||
else
|
else
|
||||||
WetRoads = 0.0f;
|
WetRoads = 0.0f;
|
||||||
|
@ -204,10 +215,10 @@ void CWeather::Update(void)
|
||||||
|
|
||||||
// Rain
|
// Rain
|
||||||
float fNewRain;
|
float fNewRain;
|
||||||
if (NewWeatherType == WEATHER_RAINY) {
|
if (NewWeatherType == WEATHER_RAINY || NewWeatherType == WEATHER_HURRICANE) {
|
||||||
// if raining for >1 hour, values: 0, 0.33, 0.66, 0.99, switching every ~16.5s
|
// if raining for >1 hour, values: 0, 0.33, 0.66, 0.99, switching every ~16.5s
|
||||||
fNewRain = ((uint16)CTimer::GetTimeInMilliseconds() >> 14) * 0.33f;
|
fNewRain = ((uint16)CTimer::GetTimeInMilliseconds() >> 14) * 0.33f;
|
||||||
if (OldWeatherType != WEATHER_RAINY) {
|
if (OldWeatherType != WEATHER_RAINY && OldWeatherType != WEATHER_HURRICANE) {
|
||||||
if (InterpolationValue < 0.4f)
|
if (InterpolationValue < 0.4f)
|
||||||
// if rain has just started (<24 minutes), always 0.5
|
// if rain has just started (<24 minutes), always 0.5
|
||||||
fNewRain = 0.5f;
|
fNewRain = 0.5f;
|
||||||
|
@ -218,19 +229,14 @@ void CWeather::Update(void)
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
fNewRain = 0.0f;
|
fNewRain = 0.0f;
|
||||||
if (Rain != fNewRain) { // ok to use comparasion
|
Rain = fNewRain;
|
||||||
if (Rain < fNewRain)
|
|
||||||
Rain = Min(fNewRain, Rain + RAIN_CHANGE_SPEED * CTimer::GetTimeStep());
|
|
||||||
else
|
|
||||||
Rain = Max(fNewRain, Rain - RAIN_CHANGE_SPEED * CTimer::GetTimeStep());
|
|
||||||
}
|
|
||||||
|
|
||||||
// Clouds
|
// Clouds
|
||||||
if (OldWeatherType != WEATHER_SUNNY)
|
if (OldWeatherType != WEATHER_SUNNY && OldWeatherType != WEATHER_EXTRA_SUNNY)
|
||||||
CloudCoverage = 1.0f - InterpolationValue;
|
CloudCoverage = 1.0f - InterpolationValue;
|
||||||
else
|
else
|
||||||
CloudCoverage = 0.0f;
|
CloudCoverage = 0.0f;
|
||||||
if (NewWeatherType != WEATHER_SUNNY)
|
if (NewWeatherType != WEATHER_SUNNY && OldWeatherType != WEATHER_EXTRA_SUNNY)
|
||||||
CloudCoverage += InterpolationValue;
|
CloudCoverage += InterpolationValue;
|
||||||
|
|
||||||
// Fog
|
// Fog
|
||||||
|
@ -240,12 +246,76 @@ void CWeather::Update(void)
|
||||||
Foggyness = 0.0f;
|
Foggyness = 0.0f;
|
||||||
if (NewWeatherType == WEATHER_FOGGY)
|
if (NewWeatherType == WEATHER_FOGGY)
|
||||||
Foggyness += InterpolationValue;
|
Foggyness += InterpolationValue;
|
||||||
if (OldWeatherType == WEATHER_RAINY && NewWeatherType == WEATHER_SUNNY && InterpolationValue < 0.5f && CClock::GetHours() > 6 && CClock::GetHours() < 21)
|
|
||||||
|
// Extra Sunnyness
|
||||||
|
if (OldWeatherType == WEATHER_EXTRA_SUNNY)
|
||||||
|
ExtraSunnyness = 1.0f - InterpolationValue;
|
||||||
|
else
|
||||||
|
ExtraSunnyness = 0.0f;
|
||||||
|
if (NewWeatherType == WEATHER_EXTRA_SUNNY)
|
||||||
|
ExtraSunnyness += InterpolationValue;
|
||||||
|
|
||||||
|
// Rainbow
|
||||||
|
if (OldWeatherType == WEATHER_RAINY && (NewWeatherType == WEATHER_SUNNY || NewWeatherType == WEATHER_EXTRA_SUNNY) &&
|
||||||
|
InterpolationValue < 0.5f && CClock::GetHours() > 6 && CClock::GetHours() < 21)
|
||||||
Rainbow = 1.0f - 4.0f * Abs(InterpolationValue - 0.25f) / 4.0f;
|
Rainbow = 1.0f - 4.0f * Abs(InterpolationValue - 0.25f) / 4.0f;
|
||||||
else
|
else
|
||||||
Rainbow = 0.0f;
|
Rainbow = 0.0f;
|
||||||
|
|
||||||
|
// Sun Glare
|
||||||
|
if (OldWeatherType == WEATHER_EXTRA_SUNNY)
|
||||||
|
SunGlare = 1.0f - InterpolationValue;
|
||||||
|
else
|
||||||
|
SunGlare = 0.0f;
|
||||||
|
if (NewWeatherType == WEATHER_EXTRA_SUNNY)
|
||||||
|
SunGlare += InterpolationValue;
|
||||||
|
|
||||||
|
if (SunGlare > 0.0f) {
|
||||||
|
SunGlare *= Min(1.0f, 7.0 * CTimeCycle::GetSunPosition().z);
|
||||||
|
SunGlare = clamp(SunGlare, 0.0f, 1.0f);
|
||||||
|
// TODO(MIAMI): if (CSpecialFX::bSnapShotActive)...
|
||||||
|
}
|
||||||
|
|
||||||
Wind = InterpolationValue * Windiness[NewWeatherType] + (1.0f - InterpolationValue) * Windiness[OldWeatherType];
|
Wind = InterpolationValue * Windiness[NewWeatherType] + (1.0f - InterpolationValue) * Windiness[OldWeatherType];
|
||||||
|
WindClipped = Max(1.0f, Wind);
|
||||||
|
|
||||||
|
if (CClock::GetHours() == 20)
|
||||||
|
TrafficLightBrightness = CClock::GetMinutes() / 60.0f;
|
||||||
|
else if (CClock::GetHours() > 6 && CClock::GetHours() < 20)
|
||||||
|
TrafficLightBrightness = 0.0f;
|
||||||
|
else if (CClock::GetHours() == 6)
|
||||||
|
TrafficLightBrightness = 1.0f - CClock::GetMinutes() / 60.0f;
|
||||||
|
else
|
||||||
|
TrafficLightBrightness = 1.0f;
|
||||||
|
TrafficLightBrightness = Max(WetRoads, TrafficLightBrightness);
|
||||||
|
TrafficLightBrightness = Max(Rain, TrafficLightBrightness);
|
||||||
|
|
||||||
AddRain();
|
AddRain();
|
||||||
|
|
||||||
|
if ((NewWeatherType == WEATHER_SUNNY || NewWeatherType == WEATHER_EXTRA_SUNNY) &&
|
||||||
|
!CGame::IsInInterior() && !CCutsceneMgr::IsRunning() && (CTimer::GetFrameCounter() & 7) == 0) {
|
||||||
|
#ifdef FIX_BUGS
|
||||||
|
if (FindPlayerPed() && (!FindPlayerPed()->CheckIfInTheAir() || FindPlayerPed()->CheckIfInTheAir() && FindPlayerPed()->GetPosition().z < 7.5f &&
|
||||||
|
CClock::GetHours() > 6 && CClock::GetHours() < 18))
|
||||||
|
#else
|
||||||
|
if (!FindPlayerPed()->CheckIfInTheAir() || FindPlayerPed()->CheckIfInTheAir() && FindPlayerPed()->GetPosition().z < 7.5f &&
|
||||||
|
CClock::GetHours() > 6 && CClock::GetHours() < 18)
|
||||||
|
#endif
|
||||||
|
AddHeatHaze();
|
||||||
|
}
|
||||||
|
|
||||||
|
if ((NewWeatherType == WEATHER_SUNNY || NewWeatherType == WEATHER_EXTRA_SUNNY) && !CGame::IsInInterior() && !CCutsceneMgr::IsRunning())
|
||||||
|
AddBeastie();
|
||||||
|
}
|
||||||
|
|
||||||
|
void CWeather::AddHeatHaze()
|
||||||
|
{
|
||||||
|
/* TODO(MIAMI) */
|
||||||
|
}
|
||||||
|
|
||||||
|
void CWeather::AddBeastie()
|
||||||
|
{
|
||||||
|
/* TODO(MIAMI) */
|
||||||
}
|
}
|
||||||
|
|
||||||
void CWeather::ForceWeather(int16 weather)
|
void CWeather::ForceWeather(int16 weather)
|
||||||
|
@ -511,23 +581,3 @@ void CWeather::RenderRainStreaks(void)
|
||||||
TempBufferVerticesStored = 0;
|
TempBufferVerticesStored = 0;
|
||||||
TempBufferIndicesStored = 0;
|
TempBufferIndicesStored = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void CWeather::StoreWeatherState()
|
|
||||||
{
|
|
||||||
Stored_StateStored = true;
|
|
||||||
Stored_InterpolationValue = InterpolationValue;
|
|
||||||
Stored_Rain = Rain;
|
|
||||||
Stored_NewWeatherType = NewWeatherType;
|
|
||||||
Stored_OldWeatherType = OldWeatherType;
|
|
||||||
}
|
|
||||||
|
|
||||||
void CWeather::RestoreWeatherState()
|
|
||||||
{
|
|
||||||
#ifdef FIX_BUGS // it's not used anyway though
|
|
||||||
Stored_StateStored = false;
|
|
||||||
#endif
|
|
||||||
InterpolationValue = Stored_InterpolationValue;
|
|
||||||
Rain = Stored_Rain;
|
|
||||||
NewWeatherType = Stored_NewWeatherType;
|
|
||||||
OldWeatherType = Stored_OldWeatherType;
|
|
||||||
}
|
|
||||||
|
|
|
@ -1,21 +1,17 @@
|
||||||
enum {
|
enum {
|
||||||
WEATHER_SUNNY,
|
WEATHER_RANDOM = -1,
|
||||||
|
WEATHER_SUNNY = 0,
|
||||||
WEATHER_CLOUDY,
|
WEATHER_CLOUDY,
|
||||||
WEATHER_RAINY,
|
WEATHER_RAINY,
|
||||||
WEATHER_FOGGY
|
WEATHER_FOGGY,
|
||||||
|
WEATHER_EXTRA_SUNNY,
|
||||||
|
WEATHER_HURRICANE,
|
||||||
|
WEATHER_TOTAL
|
||||||
};
|
};
|
||||||
|
|
||||||
class CWeather
|
class CWeather
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
enum {
|
|
||||||
WEATHER_RANDOM = -1,
|
|
||||||
WEATHER_SUNNY = 0,
|
|
||||||
WEATHER_CLOUDY = 1,
|
|
||||||
WEATHER_RAINY = 2,
|
|
||||||
WEATHER_FOGGY = 3,
|
|
||||||
WEATHER_TOTAL = 4
|
|
||||||
};
|
|
||||||
static int32 SoundHandle;
|
static int32 SoundHandle;
|
||||||
|
|
||||||
static int32 WeatherTypeInList;
|
static int32 WeatherTypeInList;
|
||||||
|
@ -38,13 +34,11 @@ public:
|
||||||
static float InterpolationValue;
|
static float InterpolationValue;
|
||||||
static float WetRoads;
|
static float WetRoads;
|
||||||
static float Rainbow;
|
static float Rainbow;
|
||||||
|
static float SunGlare;
|
||||||
|
static float WindClipped;
|
||||||
|
static float TrafficLightBrightness;
|
||||||
|
|
||||||
static bool bScriptsForceRain;
|
static bool bScriptsForceRain;
|
||||||
static bool Stored_StateStored;
|
|
||||||
static float Stored_InterpolationValue;
|
|
||||||
static int16 Stored_OldWeatherType;
|
|
||||||
static int16 Stored_NewWeatherType;
|
|
||||||
static float Stored_Rain;
|
|
||||||
|
|
||||||
static void RenderRainStreaks(void);
|
static void RenderRainStreaks(void);
|
||||||
static void Update(void);
|
static void Update(void);
|
||||||
|
@ -53,9 +47,9 @@ public:
|
||||||
static void ReleaseWeather();
|
static void ReleaseWeather();
|
||||||
static void ForceWeather(int16);
|
static void ForceWeather(int16);
|
||||||
static void ForceWeatherNow(int16);
|
static void ForceWeatherNow(int16);
|
||||||
static void StoreWeatherState();
|
|
||||||
static void RestoreWeatherState();
|
|
||||||
static void AddRain();
|
static void AddRain();
|
||||||
|
static void AddHeatHaze();
|
||||||
|
static void AddBeastie();
|
||||||
};
|
};
|
||||||
|
|
||||||
enum {
|
enum {
|
||||||
|
|
|
@ -139,6 +139,8 @@ static float PitchToCamera;
|
||||||
void
|
void
|
||||||
CVisibilityPlugins::SetupVehicleVariables(RpClump *vehicle)
|
CVisibilityPlugins::SetupVehicleVariables(RpClump *vehicle)
|
||||||
{
|
{
|
||||||
|
if (vehicle->object.type != rpCLUMP)
|
||||||
|
return;
|
||||||
DistToCameraSq = GetDistanceSquaredFromCamera(RpClumpGetFrame(vehicle));
|
DistToCameraSq = GetDistanceSquaredFromCamera(RpClumpGetFrame(vehicle));
|
||||||
RwV3d distToCam;
|
RwV3d distToCam;
|
||||||
RwV3dSub(&distToCam, ms_pCameraPosn, &RwFrameGetMatrix(RpClumpGetFrame(vehicle))->pos);
|
RwV3dSub(&distToCam, ms_pCameraPosn, &RwFrameGetMatrix(RpClumpGetFrame(vehicle))->pos);
|
||||||
|
|
|
@ -186,7 +186,7 @@ bool CCarGenerator::CheckForBlockage(int32 mi)
|
||||||
CWorld::FindObjectsKindaColliding(CVector(m_vecPos), pColModel->boundingSphere.radius, 1, &entities, 8, pEntities, false, true, true, false, false);
|
CWorld::FindObjectsKindaColliding(CVector(m_vecPos), pColModel->boundingSphere.radius, 1, &entities, 8, pEntities, false, true, true, false, false);
|
||||||
for (int i = 0; i < entities; i++) {
|
for (int i = 0; i < entities; i++) {
|
||||||
if (m_vecPos.z + pColModel->boundingBox.min.z < pEntities[i]->GetPosition().z + pEntities[i]->GetColModel()->boundingBox.max.z + 1.0f &&
|
if (m_vecPos.z + pColModel->boundingBox.min.z < pEntities[i]->GetPosition().z + pEntities[i]->GetColModel()->boundingBox.max.z + 1.0f &&
|
||||||
m_vecPos.z + pColModel->boundingBox.max.z < pEntities[i]->GetPosition().z + pEntities[i]->GetColModel()->boundingBox.min.z - 1.0f) {
|
m_vecPos.z + pColModel->boundingBox.max.z > pEntities[i]->GetPosition().z + pEntities[i]->GetColModel()->boundingBox.min.z - 1.0f) {
|
||||||
m_bIsBlocking = true;
|
m_bIsBlocking = true;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue