Skip to content

Commit

Permalink
New effect: Low Draw Distance (#268)
Browse files Browse the repository at this point in the history
  • Loading branch information
gromchek authored Jan 26, 2024
1 parent 350442e commit 226d826
Show file tree
Hide file tree
Showing 2 changed files with 54 additions and 0 deletions.
17 changes: 17 additions & 0 deletions src/gtasa/effects/custom/unsorted/LowDrawDistanceEffect.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
#include "util/EffectBase.h"

#include <CTimeCycle.h>

class LowDrawDistanceEffect : public EffectBase
{
public:
void
OnTick (EffectInstance *inst) override
{
CTimeCycle::m_CurrentColours.m_fFarClip = 200.0f;
}
};

DEFINE_EFFECT (LowDrawDistanceEffect, "effect_low_draw_distance",
GROUP_NPC_SPAWNS | GROUP_CAMERA | GROUP_VISION
| GROUP_VEHICLE_RARITY);
37 changes: 37 additions & 0 deletions src/gtasa/effects/custom/unsorted/MistEffect.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
#include "util/EffectBase.h"

#include <CClock.h>
#include <CTimeCycle.h>
#include <CWeather.h>

class MistEffect : public EffectBase
{
private:
int forceWeather = WEATHER_FOGGY_SF;

public:
void
OnStart (EffectInstance *inst) override
{
constexpr int weathers[]
= {WEATHER_RAINY_SF, WEATHER_FOGGY_SF, WEATHER_RAINY_COUNTRYSIDE,
WEATHER_SANDSTORM_DESERT};

auto idx = inst->Random (0, 10000) % std::size (weathers);
forceWeather = weathers[idx];
}

void
OnTick (EffectInstance *inst) override
{
CClock::ms_nGameClockHours = 0;
CClock::ms_nGameClockMinutes = 0;
CClock::ms_nGameClockSeconds = 0;
CWeather::ForceWeatherNow (forceWeather);
CTimeCycle::m_CurrentColours.m_fFarClip = 150.0f;
}
};

DEFINE_EFFECT (MistEffect, "effect_mist",
GROUP_NPC_SPAWNS | GROUP_CAMERA | GROUP_VISION | GROUP_WEATHER
| GROUP_VEHICLE_RARITY);

0 comments on commit 226d826

Please sign in to comment.