Remove __ENABLE_LIGHTFX__ define

It is already enabled for all our builds, and upcoming changes to RTD would add a slew more.
Discussed in team chat with Duncan and Hielke.
This commit is contained in:
Michael Steenbeek 2022-07-28 23:34:02 +02:00 committed by GitHub
parent 5f9b0da5ff
commit 2b859c7099
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
17 changed files with 26 additions and 71 deletions

View File

@ -36,7 +36,6 @@
"${workspaceRoot}/src"
],
"defines": [
"__ENABLE_LIGHTFX__",
"ENABLE_SCRIPTING"
],
"intelliSenseMode": "clang-x64",
@ -83,4 +82,4 @@
}
],
"version": 4
}
}

View File

@ -94,7 +94,6 @@ option(DISABLE_GOOGLE_BENCHMARK "Disable Google Benchmarks support." OFF)
option(DISABLE_HTTP "Disable HTTP support.")
option(DISABLE_NETWORK "Disable multiplayer functionality. Mainly for testing.")
option(DISABLE_TTF "Disable support for TTF provided by freetype2.")
option(ENABLE_LIGHTFX "Enable lighting effects." ON)
option(ENABLE_SCRIPTING "Enable script / plugin support." ON)
option(DISABLE_GUI "Don't build GUI. (Headless only.)")
@ -371,9 +370,6 @@ endif ()
if (DISABLE_TTF)
target_compile_options(libopenrct2 PUBLIC -DNO_TTF)
endif ()
if (ENABLE_LIGHTFX)
target_compile_options(libopenrct2 PUBLIC -D__ENABLE_LIGHTFX__)
endif ()
if (ENABLE_SCRIPTING)
target_compile_options(libopenrct2 PUBLIC -DENABLE_SCRIPTING)
endif ()

View File

@ -37,9 +37,7 @@ private:
SDL_Texture* _scaledScreenTexture = nullptr;
SDL_PixelFormat* _screenTextureFormat = nullptr;
uint32_t _paletteHWMapped[256] = { 0 };
#ifdef __ENABLE_LIGHTFX__
uint32_t _lightPaletteHWMapped[256] = { 0 };
#endif
// Steam overlay checking
uint32_t _pixelBeforeOverlay = 0;
@ -164,7 +162,6 @@ public:
_paletteHWMapped[i] = SDL_MapRGB(_screenTextureFormat, palette[i].Red, palette[i].Green, palette[i].Blue);
}
#ifdef __ENABLE_LIGHTFX__
if (gConfigGeneral.enable_light_fx)
{
auto& lightPalette = lightfx_get_palette();
@ -174,7 +171,6 @@ public:
_lightPaletteHWMapped[i] = SDL_MapRGBA(_screenTextureFormat, src.Red, src.Green, src.Blue, src.Alpha);
}
}
#endif
}
}
@ -207,7 +203,6 @@ protected:
private:
void Display()
{
#ifdef __ENABLE_LIGHTFX__
if (gConfigGeneral.enable_light_fx)
{
void* pixels;
@ -219,7 +214,6 @@ private:
}
}
else
#endif
{
CopyBitsToTexture(
_screenTexture, _bits, static_cast<int32_t>(_width), static_cast<int32_t>(_height), _paletteHWMapped);

View File

@ -205,9 +205,7 @@ public:
{
_window = static_cast<SDL_Window*>(_uiContext->GetWindow());
_bitsDPI.DrawingEngine = this;
# ifdef __ENABLE_LIGHTFX__
lightfx_set_available(false);
# endif
}
~OpenGLDrawingEngine() override

View File

@ -217,7 +217,7 @@
<Import Project="..\..\openrct2.common.props" />
<ItemDefinitionGroup>
<ClCompile>
<PreprocessorDefinitions>__ENABLE_LIGHTFX__;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PreprocessorDefinitions>%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PreprocessorDefinitions Condition="'$(Breakpad)'=='true' and ('$(Platform)'=='Win32' or '$(Platform)'=='x64')">USE_BREAKPAD;%(PreprocessorDefinitions)</PreprocessorDefinitions>
</ClCompile>
</ItemDefinitionGroup>

View File

@ -453,9 +453,7 @@ namespace OpenRCT2
{
return false;
}
#ifdef __ENABLE_LIGHTFX__
lightfx_init();
#endif
}
input_reset_place_obj_modifier();

View File

@ -805,13 +805,11 @@ void UpdatePalette(const uint8_t* colours, int32_t start_index, int32_t num_colo
uint8_t g = colours[1];
uint8_t b = colours[0];
#ifdef __ENABLE_LIGHTFX__
if (lightfx_is_available())
{
lightfx_apply_palette_filter(i, &r, &g, &b);
}
else
#endif
{
float night = gDayNightCycle;
if (night >= 0 && gClimateLightningFlash == 0)

View File

@ -7,28 +7,26 @@
* OpenRCT2 is licensed under the GNU General Public License version 3.
*****************************************************************************/
#ifdef __ENABLE_LIGHTFX__
#include "LightFX.h"
# include "LightFX.h"
#include "../Game.h"
#include "../common.h"
#include "../config/Config.h"
#include "../entity/EntityRegistry.h"
#include "../interface/Viewport.h"
#include "../interface/Window.h"
#include "../interface/Window_internal.h"
#include "../paint/Paint.h"
#include "../ride/Ride.h"
#include "../ride/Vehicle.h"
#include "../util/Util.h"
#include "../world/Climate.h"
#include "../world/Map.h"
#include "Drawing.h"
# include "../Game.h"
# include "../common.h"
# include "../config/Config.h"
# include "../entity/EntityRegistry.h"
# include "../interface/Viewport.h"
# include "../interface/Window.h"
# include "../interface/Window_internal.h"
# include "../paint/Paint.h"
# include "../ride/Ride.h"
# include "../ride/Vehicle.h"
# include "../util/Util.h"
# include "../world/Climate.h"
# include "../world/Map.h"
# include "Drawing.h"
# include <algorithm>
# include <cmath>
# include <cstring>
#include <algorithm>
#include <cmath>
#include <cstring>
static uint8_t _bakedLightTexture_lantern_0[32 * 32];
static uint8_t _bakedLightTexture_lantern_1[64 * 64];
@ -873,9 +871,9 @@ void lightfx_apply_palette_filter(uint8_t i, uint8_t* r, uint8_t* g, uint8_t* b)
float overExpose = 0.0f;
float lightAvg = (natLightR + natLightG + natLightB) / 3.0f;
# ifdef LIGHTFX_UNKNOWN_PART_2
#ifdef LIGHTFX_UNKNOWN_PART_2
float lightMax = (natLightR + natLightG + natLightB) / 3.0f;
# endif // LIGHTFX_UNKNOWN_PART_2
#endif // LIGHTFX_UNKNOWN_PART_2
// overExpose += ((lightMax - lightAvg) / lightMax) * 0.01f;
@ -887,9 +885,9 @@ void lightfx_apply_palette_filter(uint8_t i, uint8_t* r, uint8_t* g, uint8_t* b)
// overExpose += offset * 0.1f;
}
# ifdef LIGHTFX_UNKNOWN_PART_2
#ifdef LIGHTFX_UNKNOWN_PART_2
lightAvg += (lightMax - lightAvg) * 0.6f;
# endif // LIGHTFX_UNKNOWN_PART_2
#endif // LIGHTFX_UNKNOWN_PART_2
if (lightAvg > 1.0f)
{
@ -1070,5 +1068,3 @@ void lightfx_render_to_texture(
}
}
}
#endif // __ENABLE_LIGHTFX__

View File

@ -9,9 +9,7 @@
#pragma once
#ifdef __ENABLE_LIGHTFX__
# include "../common.h"
#include "../common.h"
struct CoordsXY;
struct Vehicle;
@ -76,5 +74,3 @@ void lightfx_apply_palette_filter(uint8_t i, uint8_t* r, uint8_t* g, uint8_t* b)
void lightfx_render_to_texture(
void* dstPixels, uint32_t dstPitch, uint8_t* bits, uint32_t width, uint32_t height, const uint32_t* palette,
const uint32_t* lightPalette);
#endif // __ENABLE_LIGHTFX__

View File

@ -122,10 +122,8 @@ X8DrawingEngine::X8DrawingEngine([[maybe_unused]] const std::shared_ptr<Ui::IUiC
{
_drawingContext = new X8DrawingContext(this);
_bitsDPI.DrawingEngine = this;
#ifdef __ENABLE_LIGHTFX__
lightfx_set_available(true);
_lastLightFXenabled = (gConfigGeneral.enable_light_fx != 0);
#endif
}
X8DrawingEngine::~X8DrawingEngine()
@ -190,13 +188,11 @@ void X8DrawingEngine::BeginDraw()
{
if (gIntroState == IntroState::None)
{
#ifdef __ENABLE_LIGHTFX__
// HACK we need to re-configure the bits if light fx has been enabled / disabled
if (_lastLightFXenabled != (gConfigGeneral.enable_light_fx != 0))
{
Resize(_width, _height);
}
#endif
_weatherDrawer.Restore(&_bitsDPI);
}
}
@ -342,12 +338,10 @@ void X8DrawingEngine::ConfigureBits(uint32_t width, uint32_t height, uint32_t pi
ConfigureDirtyGrid();
#ifdef __ENABLE_LIGHTFX__
if (lightfx_is_available())
{
lightfx_update_buffers(dpi);
}
#endif
}
void X8DrawingEngine::OnDrawDirtyBlock(

View File

@ -76,9 +76,7 @@ namespace OpenRCT2
rct_drawpixelinfo _bitsDPI = {};
#ifdef __ENABLE_LIGHTFX__
bool _lastLightFXenabled = false;
#endif
X8WeatherDrawer _weatherDrawer;
X8DrawingContext* _drawingContext;

View File

@ -2740,7 +2740,6 @@ void Peep::Paint(paint_session& session, int32_t imageDirection) const
{
PROFILED_FUNCTION();
#ifdef __ENABLE_LIGHTFX__
if (lightfx_is_available())
{
if (Is<Staff>())
@ -2767,7 +2766,6 @@ void Peep::Paint(paint_session& session, int32_t imageDirection) const
LightfxAdd3DLight(*this, 0, loc, LightType::Spot1);
}
}
#endif
rct_drawpixelinfo* dpi = &session.DPI;
if (dpi->zoom_level > ZoomLevel{ 2 })

View File

@ -39,7 +39,7 @@
<Import Project="..\..\openrct2.common.props" />
<ItemDefinitionGroup>
<ClCompile>
<PreprocessorDefinitions>__ENABLE_DISCORD__;__ENABLE_LIGHTFX__;USE_BENCHMARK;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PreprocessorDefinitions>__ENABLE_DISCORD__;USE_BENCHMARK;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PreprocessorDefinitions Condition="'$(Breakpad)'=='true' and ('$(Platform)'=='Win32' or '$(Platform)'=='x64')">USE_BREAKPAD;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PreprocessorDefinitions Condition="'$(Platform)'=='Win32' or '$(Platform)'=='x64'">USE_FRIBIDI;%(PreprocessorDefinitions)</PreprocessorDefinitions>
</ClCompile>

View File

@ -117,12 +117,10 @@ void EntityPaintSetup(paint_session& session, const CoordsXY& pos)
{
case EntityType::Vehicle:
spr->As<Vehicle>()->Paint(session, image_direction);
#ifdef __ENABLE_LIGHTFX__
if (lightfx_for_vehicles_is_available())
{
lightfx_add_lights_magic_vehicle(spr->As<Vehicle>());
}
#endif
break;
case EntityType::Guest:
case EntityType::Staff:

View File

@ -79,7 +79,6 @@ static void PaintRideEntranceExitScrollingText(
static void PaintRideEntranceExitLightEffects(paint_session& session, int32_t height, const EntranceElement& entranceEl)
{
#ifdef __ENABLE_LIGHTFX__
PROFILED_FUNCTION();
if (lightfx_is_available())
@ -105,7 +104,6 @@ static void PaintRideEntranceExitLightEffects(paint_session& session, int32_t he
break;
}
}
#endif
}
static void PaintRideEntranceExit(paint_session& session, uint8_t direction, int32_t height, const EntranceElement& entranceEl)
@ -253,14 +251,12 @@ static void PaintParkEntranceScrollingText(
static void PaintParkEntranceLightEffects(paint_session& session)
{
#ifdef __ENABLE_LIGHTFX__
PROFILED_FUNCTION();
if (lightfx_is_available())
{
lightfx_add_3d_light_magic_from_drawing_tile(session.MapPosition, 0, 0, 155, LightType::Lantern3);
}
#endif
}
static void PaintParkEntrance(paint_session& session, uint8_t direction, int32_t height, const EntranceElement& entranceEl)

View File

@ -938,7 +938,6 @@ static void PaintHeightMarkers(paint_session& session, const PathElement& pathEl
static void PaintLampLightEffects(paint_session& session, const PathElement& pathEl, uint16_t height)
{
#ifdef __ENABLE_LIGHTFX__
PROFILED_FUNCTION();
if (lightfx_is_available())
@ -967,7 +966,6 @@ static void PaintLampLightEffects(paint_session& session, const PathElement& pat
}
}
}
#endif
}
/**

View File

@ -2219,7 +2219,6 @@ void PaintTrack(paint_session& session, Direction direction, int32_t height, con
}
}
#ifdef __ENABLE_LIGHTFX__
if (lightfx_is_available())
{
uint8_t zOffset = 16;
@ -2231,7 +2230,6 @@ void PaintTrack(paint_session& session, Direction direction, int32_t height, con
else if (RideTypeDescriptors[ride->type].HasFlag(RIDE_TYPE_FLAG_IS_SHOP))
LightFxAddShopLights(session.MapPosition, trackElement.GetDirection(), height, zOffset);
}
#endif
session.InteractionType = ViewportInteractionItem::Ride;
session.TrackColours[SCHEME_TRACK] = SPRITE_ID_PALETTE_COLOUR_2(