mirror of
https://github.com/OpenRCT2/OpenRCT2
synced 2025-12-10 09:32:29 +01:00
Merge pull request #5098 from IntelOrca/enable-lightfx
Resolve #5048: Enable light FX
This commit is contained in:
@@ -113,6 +113,7 @@ option(DISABLE_RCT2 "Build a standalone version, without using code and data seg
|
||||
option(USE_MMAP "Use mmap to try loading rct2's data segment into memory.")
|
||||
option(WITH_TESTS "Build tests")
|
||||
option(DISABLE_TTF "Disable support for TTF provided by SDL2_ttf.")
|
||||
option(ENABLE_LIGHTFX "Enable lighting effects." ON)
|
||||
|
||||
set(COMMON_COMPILE_OPTIONS "${COMMON_COMPILE_OPTIONS} -fstrict-aliasing -Werror -Wundef -Wmissing-declarations -Winit-self -Wall -Wno-unknown-pragmas -Wno-unused-function -Wno-missing-braces ")
|
||||
set(COMMON_COMPILE_OPTIONS "${COMMON_COMPILE_OPTIONS} -Wno-comment -Wshadow -Wmissing-declarations -Wnonnull")
|
||||
@@ -135,6 +136,10 @@ if (DISABLE_TTF)
|
||||
add_definitions(-DNO_TTF)
|
||||
endif (DISABLE_TTF)
|
||||
|
||||
if (ENABLE_LIGHTFX)
|
||||
add_definitions(-D__ENABLE_LIGHTFX__)
|
||||
endif (ENABLE_LIGHTFX)
|
||||
|
||||
# Launchpad turns on -Wdate-time for compilers that support it, this shouldn't break our build
|
||||
ADD_CHECK_C_COMPILER_FLAG(CMAKE_C_FLAGS C_WARN_WRITE_STRINGS -Wno-error=date-time)
|
||||
ADD_CHECK_CXX_COMPILER_FLAG(CMAKE_CXX_FLAGS CXX_WARN_WRITE_STRINGS -Wno-error=date-time)
|
||||
|
||||
@@ -459,6 +459,7 @@
|
||||
D49766891D03BABB002222CD /* rain.cpp in Sources */ = {isa = PBXBuildFile; fileRef = D49766871D03BABB002222CD /* rain.cpp */; };
|
||||
D4A8B4B41DB41873007A2F29 /* libpng16.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = D4A8B4B31DB41873007A2F29 /* libpng16.dylib */; };
|
||||
D4A8B4B51DB4188D007A2F29 /* libpng16.dylib in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = D4A8B4B31DB41873007A2F29 /* libpng16.dylib */; settings = {ATTRIBUTES = (CodeSignOnCopy, ); }; };
|
||||
D4B21B6F1E343AF1004982C7 /* lightfx.c in Sources */ = {isa = PBXBuildFile; fileRef = D4B21B6D1E343AF1004982C7 /* lightfx.c */; };
|
||||
D4CA88661D4E64C800060C11 /* version.c in Sources */ = {isa = PBXBuildFile; fileRef = D4CA88651D4E64C800060C11 /* version.c */; };
|
||||
D4EC48E61C2637710024B507 /* g2.dat in Resources */ = {isa = PBXBuildFile; fileRef = D4EC48E31C2637710024B507 /* g2.dat */; };
|
||||
D4EC48E71C2637710024B507 /* language in Resources */ = {isa = PBXBuildFile; fileRef = D4EC48E41C2637710024B507 /* language */; };
|
||||
@@ -1193,6 +1194,8 @@
|
||||
D497668B1D03BAC8002222CD /* IDrawingEngine.h */ = {isa = PBXFileReference; explicitFileType = sourcecode.cpp.h; path = IDrawingEngine.h; sourceTree = "<group>"; usesTabs = 0; };
|
||||
D497D0781C20FD52002BF46A /* OpenRCT2.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = OpenRCT2.app; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||
D4A8B4B31DB41873007A2F29 /* libpng16.dylib */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.dylib"; path = libpng16.dylib; sourceTree = "<group>"; };
|
||||
D4B21B6D1E343AF1004982C7 /* lightfx.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = lightfx.c; sourceTree = "<group>"; };
|
||||
D4B21B6E1E343AF1004982C7 /* lightfx.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = lightfx.h; sourceTree = "<group>"; };
|
||||
D4CA88651D4E64C800060C11 /* version.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = version.c; sourceTree = "<group>"; };
|
||||
D4EC48E31C2637710024B507 /* g2.dat */ = {isa = PBXFileReference; lastKnownFileType = file; name = g2.dat; path = data/g2.dat; sourceTree = SOURCE_ROOT; };
|
||||
D4EC48E41C2637710024B507 /* language */ = {isa = PBXFileReference; lastKnownFileType = folder; name = language; path = data/language; sourceTree = SOURCE_ROOT; };
|
||||
@@ -1675,6 +1678,8 @@
|
||||
D497668A1D03BAC8002222CD /* IDrawingContext.h */,
|
||||
D497668B1D03BAC8002222CD /* IDrawingEngine.h */,
|
||||
D464FEBF1D31A68800CBABAC /* Image.cpp */,
|
||||
D4B21B6D1E343AF1004982C7 /* lightfx.c */,
|
||||
D4B21B6E1E343AF1004982C7 /* lightfx.h */,
|
||||
D44271061CC81B3200D84D28 /* line.c */,
|
||||
D49766841D03BAA5002222CD /* NewDrawing.cpp */,
|
||||
D49766851D03BAA5002222CD /* NewDrawing.h */,
|
||||
@@ -2893,6 +2898,7 @@
|
||||
C65A88941E1B1148000368D7 /* MemoryAudioSource.cpp in Sources */,
|
||||
D464FEE61D31A6AA00CBABAC /* EntranceObject.cpp in Sources */,
|
||||
D43407DE1D0E14BE00C2B3D4 /* OpenGLShaderProgram.cpp in Sources */,
|
||||
D4B21B6F1E343AF1004982C7 /* lightfx.c in Sources */,
|
||||
D43407DC1D0E14BE00C2B3D4 /* OpenGLDrawingEngine.cpp in Sources */,
|
||||
D44272761CC81B3200D84D28 /* options.c in Sources */,
|
||||
C686F93D1CDBC3B7009F9BFC /* shop.c in Sources */,
|
||||
@@ -3156,6 +3162,7 @@
|
||||
GCC_PREPROCESSOR_DEFINITIONS = (
|
||||
"$(inherited)",
|
||||
NO_RCT2,
|
||||
__ENABLE_LIGHTFX__,
|
||||
);
|
||||
GCC_WARN_64_TO_32_BIT_CONVERSION = NO;
|
||||
GCC_WARN_UNINITIALIZED_AUTOS = YES;
|
||||
@@ -3187,6 +3194,7 @@
|
||||
GCC_PREPROCESSOR_DEFINITIONS = (
|
||||
"$(inherited)",
|
||||
NO_RCT2,
|
||||
__ENABLE_LIGHTFX__,
|
||||
);
|
||||
GCC_WARN_64_TO_32_BIT_CONVERSION = NO;
|
||||
GCC_WARN_UNINITIALIZED_AUTOS = YES;
|
||||
|
||||
@@ -4309,6 +4309,8 @@ STR_5997 :Add/set money
|
||||
STR_5998 :Add money
|
||||
STR_5999 :Set money
|
||||
STR_6000 :Enter new value
|
||||
STR_6001 :Enable lighting effects (experimental)
|
||||
STR_6002 :{SMALLFONT}{BLACK}Lamps and rides will be lit up at night.{NEWLINE}Requires rendering engine to be set to hardware display.
|
||||
|
||||
#############
|
||||
# Scenarios #
|
||||
|
||||
@@ -208,6 +208,7 @@ config_property_definition _generalDefinitions[] = {
|
||||
{ offsetof(general_configuration, load_save_sort), "load_save_sort", CONFIG_VALUE_TYPE_UINT8, SORT_NAME_ASCENDING, NULL },
|
||||
{ offsetof(general_configuration, minimize_fullscreen_focus_loss), "minimize_fullscreen_focus_loss",CONFIG_VALUE_TYPE_BOOLEAN, true, NULL },
|
||||
{ offsetof(general_configuration, day_night_cycle), "day_night_cycle", CONFIG_VALUE_TYPE_BOOLEAN, false, NULL }, //Default config setting is false until the games canvas can be seperated from the effect
|
||||
{ offsetof(general_configuration, enable_light_fx), "enable_light_fx", CONFIG_VALUE_TYPE_BOOLEAN, false, NULL },
|
||||
{ offsetof(general_configuration, upper_case_banners), "upper_case_banners", CONFIG_VALUE_TYPE_BOOLEAN, false, NULL },
|
||||
{ offsetof(general_configuration, disable_lightning_effect), "disable_lightning_effect", CONFIG_VALUE_TYPE_BOOLEAN, false, NULL },
|
||||
{ offsetof(general_configuration, allow_loading_with_incorrect_checksum),"allow_loading_with_incorrect_checksum", CONFIG_VALUE_TYPE_BOOLEAN, true, NULL },
|
||||
|
||||
@@ -182,6 +182,7 @@ typedef struct general_configuration {
|
||||
uint8 load_save_sort;
|
||||
uint8 minimize_fullscreen_focus_loss;
|
||||
uint8 day_night_cycle;
|
||||
uint8 enable_light_fx;
|
||||
uint8 upper_case_banners;
|
||||
uint8 disable_lightning_effect;
|
||||
uint8 allow_loading_with_incorrect_checksum;
|
||||
|
||||
@@ -199,6 +199,7 @@ private:
|
||||
uint32 _paletteHWMapped[256] = { 0 };
|
||||
#ifdef __ENABLE_LIGHTFX__
|
||||
uint32 _lightPaletteHWMapped[256] = { 0 };
|
||||
bool _lastLightFXenabled = false;
|
||||
#endif
|
||||
|
||||
// Steam overlay checking
|
||||
@@ -225,6 +226,9 @@ public:
|
||||
{
|
||||
_hardwareDisplay = hardwareDisplay;
|
||||
_drawingContext = new SoftwareDrawingContext(this);
|
||||
#ifdef __ENABLE_LIGHTFX__
|
||||
_lastLightFXenabled = (gConfigGeneral.enable_light_fx != 0);
|
||||
#endif
|
||||
}
|
||||
|
||||
~SoftwareDrawingEngine() override
|
||||
@@ -312,16 +316,21 @@ public:
|
||||
{
|
||||
if (_screenTextureFormat != nullptr)
|
||||
{
|
||||
#ifdef __ENABLE_LIGHTFX__
|
||||
const SDL_Color * lightPalette = lightfx_get_palette();
|
||||
#endif
|
||||
for (sint32 i = 0; i < 256; i++)
|
||||
{
|
||||
_paletteHWMapped[i] = SDL_MapRGB(_screenTextureFormat, palette[i].r, palette[i].g, palette[i].b);
|
||||
#ifdef __ENABLE_LIGHTFX__
|
||||
_lightPaletteHWMapped[i] = SDL_MapRGBA(_screenTextureFormat, lightPalette[i].r, lightPalette[i].g, lightPalette[i].b, lightPalette[i].a);
|
||||
#endif
|
||||
}
|
||||
|
||||
#ifdef __ENABLE_LIGHTFX__
|
||||
if (gConfigGeneral.enable_light_fx)
|
||||
{
|
||||
const SDL_Color * lightPalette = lightfx_get_palette();
|
||||
for (sint32 i = 0; i < 256; i++)
|
||||
{
|
||||
_lightPaletteHWMapped[i] = SDL_MapRGBA(_screenTextureFormat, lightPalette[i].r, lightPalette[i].g, lightPalette[i].b, lightPalette[i].a);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
}
|
||||
else
|
||||
@@ -381,6 +390,13 @@ public:
|
||||
if (gIntroState != INTRO_STATE_NONE) {
|
||||
intro_draw(&_bitsDPI);
|
||||
} else {
|
||||
#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
|
||||
|
||||
_rainDrawer.SetDPI(&_bitsDPI);
|
||||
_rainDrawer.Restore();
|
||||
|
||||
@@ -536,7 +552,10 @@ private:
|
||||
ConfigureDirtyGrid();
|
||||
|
||||
#ifdef __ENABLE_LIGHTFX__
|
||||
lightfx_update_buffers(dpi);
|
||||
if (gConfigGeneral.enable_light_fx)
|
||||
{
|
||||
lightfx_update_buffers(dpi);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -698,10 +717,15 @@ private:
|
||||
void DisplayViaTexture()
|
||||
{
|
||||
#ifdef __ENABLE_LIGHTFX__
|
||||
lightfx_render_to_texture(_screenTexture, _bits, _width, _height, _paletteHWMapped, _lightPaletteHWMapped);
|
||||
#else
|
||||
CopyBitsToTexture(_screenTexture, _bits, (sint32)_width, (sint32)_height, _paletteHWMapped);
|
||||
if (gConfigGeneral.enable_light_fx)
|
||||
{
|
||||
lightfx_render_to_texture(_screenTexture, _bits, _width, _height, _paletteHWMapped, _lightPaletteHWMapped);
|
||||
}
|
||||
else
|
||||
#endif
|
||||
{
|
||||
CopyBitsToTexture(_screenTexture, _bits, (sint32)_width, (sint32)_height, _paletteHWMapped);
|
||||
}
|
||||
SDL_RenderCopy(_sdlRenderer, _screenTexture, nullptr, nullptr);
|
||||
|
||||
if (gSteamOverlayActive && gConfigGeneral.steam_overlay_pause)
|
||||
|
||||
@@ -37,8 +37,8 @@ static uint8 _bakedLightTexture_spot_2[128 * 128];
|
||||
static uint8 _bakedLightTexture_spot_3[256 * 256];
|
||||
static rct_drawpixelinfo _pixelInfo;
|
||||
|
||||
static void* _light_rendered_buffer_back = 0;
|
||||
static void* _light_rendered_buffer_front = 0;
|
||||
static void* _light_rendered_buffer_back = NULL;
|
||||
static void* _light_rendered_buffer_front = NULL;
|
||||
|
||||
static uint32 _lightPolution_back = 0;
|
||||
static uint32 _lightPolution_front = 0;
|
||||
@@ -258,7 +258,7 @@ void lightfx_prepare_light_list()
|
||||
if (true) {
|
||||
sint32 totalSamplePoints = 5;
|
||||
sint32 startSamplePoint = 1;
|
||||
sint32 lastSampleCount = 0;
|
||||
// sint32 lastSampleCount = 0;
|
||||
|
||||
if ((entry->lightIDqualifier & 0xF) == LIGHTFX_LIGHT_QUALIFIER_MAP) {
|
||||
startSamplePoint = 0;
|
||||
@@ -370,18 +370,18 @@ void lightfx_prepare_light_list()
|
||||
break;
|
||||
if (lightIntensityOccluded == 0 || lightIntensityOccluded == 500)
|
||||
break;
|
||||
lastSampleCount = lightIntensityOccluded / 500;
|
||||
// lastSampleCount = lightIntensityOccluded / 500;
|
||||
// break;
|
||||
totalSamplePoints += 4;
|
||||
}
|
||||
else if (pat == 8) {
|
||||
break;
|
||||
if (_current_view_zoom_front > 0)
|
||||
break;
|
||||
sint32 newSampleCount = lightIntensityOccluded / 900;
|
||||
if (abs(newSampleCount - lastSampleCount) < 10)
|
||||
break;
|
||||
totalSamplePoints += 4;
|
||||
// if (_current_view_zoom_front > 0)
|
||||
// break;
|
||||
// sint32 newSampleCount = lightIntensityOccluded / 900;
|
||||
// if (abs(newSampleCount - lastSampleCount) < 10)
|
||||
// break;
|
||||
// totalSamplePoints += 4;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -454,6 +454,10 @@ void lightfx_update_viewport_settings()
|
||||
|
||||
void lightfx_render_lights_to_frontbuffer()
|
||||
{
|
||||
if (_light_rendered_buffer_front == NULL) {
|
||||
return;
|
||||
}
|
||||
|
||||
memset(_light_rendered_buffer_front, 0, _pixelInfo.width * _pixelInfo.height);
|
||||
|
||||
_lightPolution_back = 0;
|
||||
@@ -688,7 +692,7 @@ uint32 lightfx_get_light_polution()
|
||||
|
||||
void lightfx_add_lights_magic_vehicles()
|
||||
{
|
||||
uint16 spriteIndex = gSpriteListHead[SPRITE_LIST_VEHICLE];
|
||||
uint16 spriteIndex = gSpriteListHead[SPRITE_LIST_TRAIN];
|
||||
while (spriteIndex != SPRITE_INDEX_NULL) {
|
||||
rct_vehicle * vehicle = &(get_sprite(spriteIndex)->vehicle);
|
||||
uint16 vehicleID = spriteIndex;
|
||||
@@ -701,7 +705,7 @@ void lightfx_add_lights_magic_vehicles()
|
||||
}
|
||||
|
||||
for (uint16 q = vehicleID; q != SPRITE_INDEX_NULL; ) {
|
||||
rct_vehicle *vehicle = GET_VEHICLE(q);
|
||||
vehicle = GET_VEHICLE(q);
|
||||
|
||||
vehicleID = q;
|
||||
if (vehicle->next_vehicle_on_train == q)
|
||||
@@ -1005,6 +1009,9 @@ void lightfx_render_to_texture(
|
||||
lightfx_render_lights_to_frontbuffer();
|
||||
|
||||
uint8 * lightBits = (uint8 *)lightfx_get_front_buffer();
|
||||
if (lightBits == NULL) {
|
||||
return;
|
||||
}
|
||||
|
||||
void * pixels;
|
||||
sint32 pitch;
|
||||
|
||||
@@ -44,25 +44,25 @@ enum LIGHTFX_LIGHT_QUALIFIER {
|
||||
LIGHTFX_LIGHT_QUALIFIER_MAP = 0x2
|
||||
};
|
||||
|
||||
extern void lightfx_init();
|
||||
void lightfx_init();
|
||||
|
||||
extern void lightfx_update_buffers(rct_drawpixelinfo*);
|
||||
void lightfx_update_buffers(rct_drawpixelinfo*);
|
||||
|
||||
extern void lightfx_prepare_light_list();
|
||||
extern void lightfx_swap_buffers();
|
||||
extern void lightfx_render_lights_to_frontbuffer();
|
||||
extern void lightfx_update_viewport_settings();
|
||||
void lightfx_prepare_light_list();
|
||||
void lightfx_swap_buffers();
|
||||
void lightfx_render_lights_to_frontbuffer();
|
||||
void lightfx_update_viewport_settings();
|
||||
|
||||
extern void* lightfx_get_front_buffer();
|
||||
void* lightfx_get_front_buffer();
|
||||
const SDL_Color * lightfx_get_palette();
|
||||
|
||||
extern void lightfx_add_3d_light(uint32 lightID, uint16 lightIDqualifier, sint16 x, sint16 y, uint16 z, uint8 lightType);
|
||||
void lightfx_add_3d_light(uint32 lightID, uint16 lightIDqualifier, sint16 x, sint16 y, uint16 z, uint8 lightType);
|
||||
|
||||
extern void lightfx_add_3d_light_magic_from_drawing_tile(sint16 offsetX, sint16 offsetY, sint16 offsetZ, uint8 lightType);
|
||||
void lightfx_add_3d_light_magic_from_drawing_tile(sint16 offsetX, sint16 offsetY, sint16 offsetZ, uint8 lightType);
|
||||
|
||||
extern void lightfx_add_lights_magic_vehicles();
|
||||
void lightfx_add_lights_magic_vehicles();
|
||||
|
||||
extern uint32 lightfx_get_light_polution();
|
||||
uint32 lightfx_get_light_polution();
|
||||
|
||||
void lightfx_apply_palette_filter(uint8 i, uint8 *r, uint8 *g, uint8 *b);
|
||||
void lightfx_render_to_texture(
|
||||
|
||||
@@ -39,6 +39,7 @@
|
||||
</PropertyGroup>
|
||||
<ItemDefinitionGroup>
|
||||
<ClCompile>
|
||||
<PreprocessorDefinitions>__ENABLE_LIGHTFX__;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<PreprocessorDefinitions Condition="'$(Breakpad)'=='true'">USE_BREAKPAD;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
</ClCompile>
|
||||
</ItemDefinitionGroup>
|
||||
|
||||
@@ -3651,6 +3651,9 @@ enum {
|
||||
STR_SET_MONEY = 5999,
|
||||
STR_ENTER_NEW_VALUE = 6000,
|
||||
|
||||
STR_ENABLE_LIGHTING_EFFECTS = 6001,
|
||||
STR_ENABLE_LIGHTING_EFFECTS_TIP = 6002,
|
||||
|
||||
// Have to include resource strings (from scenarios and objects) for the time being now that language is partially working
|
||||
STR_COUNT = 32768
|
||||
};
|
||||
|
||||
@@ -43,12 +43,12 @@ static void ride_entrance_exit_paint(uint8 direction, sint32 height, rct_map_ele
|
||||
}
|
||||
|
||||
#ifdef __ENABLE_LIGHTFX__
|
||||
if (gConfigGeneral.enable_light_fx) {
|
||||
if (!is_exit) {
|
||||
lightfx_add_3d_light_magic_from_drawing_tile(0, 0, height + 45, LIGHTFX_LIGHT_TYPE_LANTERN_3);
|
||||
}
|
||||
|
||||
if (!is_exit) {
|
||||
lightfx_add_3d_light_magic_from_drawing_tile(0, 0, height + 45, LIGHTFX_LIGHT_TYPE_LANTERN_3);
|
||||
}
|
||||
|
||||
switch (map_element->type & MAP_ELEMENT_DIRECTION_MASK) {
|
||||
switch (map_element->type & MAP_ELEMENT_DIRECTION_MASK) {
|
||||
case 0:
|
||||
lightfx_add_3d_light_magic_from_drawing_tile(16, 0, height + 16, LIGHTFX_LIGHT_TYPE_LANTERN_2);
|
||||
break;
|
||||
@@ -61,8 +61,8 @@ static void ride_entrance_exit_paint(uint8 direction, sint32 height, rct_map_ele
|
||||
case 3:
|
||||
lightfx_add_3d_light_magic_from_drawing_tile(0, 16, height + 16, LIGHTFX_LIGHT_TYPE_LANTERN_2);
|
||||
break;
|
||||
};
|
||||
|
||||
};
|
||||
}
|
||||
#endif
|
||||
|
||||
rct_ride* ride = get_ride(map_element->properties.entrance.ride_index);
|
||||
@@ -190,9 +190,9 @@ static void park_entrance_paint(uint8 direction, sint32 height, rct_map_element*
|
||||
return;
|
||||
|
||||
#ifdef __ENABLE_LIGHTFX__
|
||||
|
||||
lightfx_add_3d_light_magic_from_drawing_tile(0, 0, 155, LIGHTFX_LIGHT_TYPE_LANTERN_3);
|
||||
|
||||
if (gConfigGeneral.enable_light_fx) {
|
||||
lightfx_add_3d_light_magic_from_drawing_tile(0, 0, 155, LIGHTFX_LIGHT_TYPE_LANTERN_3);
|
||||
}
|
||||
#endif
|
||||
|
||||
gPaintInteractionType = VIEWPORT_INTERACTION_ITEM_PARK;
|
||||
|
||||
@@ -774,20 +774,22 @@ void path_paint(uint8 direction, uint16 height, rct_map_element * map_element)
|
||||
}
|
||||
|
||||
#ifdef __ENABLE_LIGHTFX__
|
||||
if (footpath_element_has_path_scenery(map_element) && !(map_element->flags & MAP_ELEMENT_FLAG_BROKEN)) {
|
||||
rct_scenery_entry *sceneryEntry = get_footpath_item_entry(footpath_element_get_path_scenery_index(map_element));
|
||||
if (sceneryEntry->path_bit.flags & PATH_BIT_FLAG_LAMP) {
|
||||
if (!(map_element->properties.path.edges & (1 << 0))) {
|
||||
lightfx_add_3d_light_magic_from_drawing_tile(-16, 0, height + 23, LIGHTFX_LIGHT_TYPE_LANTERN_3);
|
||||
}
|
||||
if (!(map_element->properties.path.edges & (1 << 1))) {
|
||||
lightfx_add_3d_light_magic_from_drawing_tile(0, 16, height + 23, LIGHTFX_LIGHT_TYPE_LANTERN_3);
|
||||
}
|
||||
if (!(map_element->properties.path.edges & (1 << 2))) {
|
||||
lightfx_add_3d_light_magic_from_drawing_tile(16, 0, height + 23, LIGHTFX_LIGHT_TYPE_LANTERN_3);
|
||||
}
|
||||
if (!(map_element->properties.path.edges & (1 << 3))) {
|
||||
lightfx_add_3d_light_magic_from_drawing_tile(0, -16, height + 23, LIGHTFX_LIGHT_TYPE_LANTERN_3);
|
||||
if (gConfigGeneral.enable_light_fx) {
|
||||
if (footpath_element_has_path_scenery(map_element) && !(map_element->flags & MAP_ELEMENT_FLAG_BROKEN)) {
|
||||
rct_scenery_entry *sceneryEntry = get_footpath_item_entry(footpath_element_get_path_scenery_index(map_element));
|
||||
if (sceneryEntry->path_bit.flags & PATH_BIT_FLAG_LAMP) {
|
||||
if (!(map_element->properties.path.edges & (1 << 0))) {
|
||||
lightfx_add_3d_light_magic_from_drawing_tile(-16, 0, height + 23, LIGHTFX_LIGHT_TYPE_LANTERN_3);
|
||||
}
|
||||
if (!(map_element->properties.path.edges & (1 << 1))) {
|
||||
lightfx_add_3d_light_magic_from_drawing_tile(0, 16, height + 23, LIGHTFX_LIGHT_TYPE_LANTERN_3);
|
||||
}
|
||||
if (!(map_element->properties.path.edges & (1 << 2))) {
|
||||
lightfx_add_3d_light_magic_from_drawing_tile(16, 0, height + 23, LIGHTFX_LIGHT_TYPE_LANTERN_3);
|
||||
}
|
||||
if (!(map_element->properties.path.edges & (1 << 3))) {
|
||||
lightfx_add_3d_light_magic_from_drawing_tile(0, -16, height + 23, LIGHTFX_LIGHT_TYPE_LANTERN_3);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -14,12 +14,13 @@
|
||||
*****************************************************************************/
|
||||
#pragma endregion
|
||||
|
||||
#include "../../world/sprite.h"
|
||||
#include "../../config.h"
|
||||
#include "../../drawing/lightfx.h"
|
||||
#include "../../interface/viewport.h"
|
||||
#include "../../paint/sprite/sprite.h"
|
||||
#include "../../peep/peep.h"
|
||||
#include "../../world/sprite.h"
|
||||
#include "../paint.h"
|
||||
#include "../../drawing/lightfx.h"
|
||||
|
||||
/**
|
||||
*
|
||||
@@ -28,15 +29,15 @@
|
||||
void peep_paint(rct_peep * peep, sint32 imageDirection)
|
||||
{
|
||||
#ifdef __ENABLE_LIGHTFX__
|
||||
if (gConfigGeneral.enable_light_fx) {
|
||||
if (peep->type == PEEP_TYPE_STAFF) {
|
||||
sint16 peep_x, peep_y, peep_z;
|
||||
|
||||
if (peep->type == PEEP_TYPE_STAFF){
|
||||
sint16 peep_x, peep_y, peep_z;
|
||||
peep_x = peep->x;
|
||||
peep_y = peep->y;
|
||||
peep_z = peep->z;
|
||||
|
||||
peep_x = peep->x;
|
||||
peep_y = peep->y;
|
||||
peep_z = peep->z;
|
||||
|
||||
switch (peep->sprite_direction) {
|
||||
switch (peep->sprite_direction) {
|
||||
case 0:
|
||||
peep_x -= 10;
|
||||
break;
|
||||
@@ -51,11 +52,11 @@ void peep_paint(rct_peep * peep, sint32 imageDirection)
|
||||
break;
|
||||
default:
|
||||
return;
|
||||
};
|
||||
};
|
||||
|
||||
lightfx_add_3d_light(peep->sprite_index, 0x0000 | LIGHTFX_LIGHT_QUALIFIER_SPRITE, peep_x, peep_y, peep_z, LIGHTFX_LIGHT_TYPE_SPOT_1);
|
||||
lightfx_add_3d_light(peep->sprite_index, 0x0000 | LIGHTFX_LIGHT_QUALIFIER_SPRITE, peep_x, peep_y, peep_z, LIGHTFX_LIGHT_TYPE_SPOT_1);
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
rct_drawpixelinfo * dpi = unk_140E9A8;
|
||||
|
||||
@@ -257,15 +257,20 @@ void platform_update_palette(const uint8* colours, sint32 start_index, sint32 nu
|
||||
uint8 b = colours[0];
|
||||
|
||||
#ifdef __ENABLE_LIGHTFX__
|
||||
lightfx_apply_palette_filter(i, &r, &g, &b);
|
||||
#else
|
||||
float night = gDayNightCycle;
|
||||
if (night >= 0 && gClimateLightningFlash == 0) {
|
||||
r = lerp(r, soft_light(r, 8), night);
|
||||
g = lerp(g, soft_light(g, 8), night);
|
||||
b = lerp(b, soft_light(b, 128), night);
|
||||
if (gConfigGeneral.enable_light_fx)
|
||||
{
|
||||
lightfx_apply_palette_filter(i, &r, &g, &b);
|
||||
}
|
||||
else
|
||||
#endif
|
||||
{
|
||||
float night = gDayNightCycle;
|
||||
if (night >= 0 && gClimateLightningFlash == 0) {
|
||||
r = lerp(r, soft_light(r, 8), night);
|
||||
g = lerp(g, soft_light(g, 8), night);
|
||||
b = lerp(b, soft_light(b, 128), night);
|
||||
}
|
||||
}
|
||||
|
||||
gPalette[i].r = r;
|
||||
gPalette[i].g = g;
|
||||
|
||||
@@ -21,6 +21,7 @@
|
||||
#include "audio/AudioMixer.h"
|
||||
#include "config.h"
|
||||
#include "drawing/drawing.h"
|
||||
#include "drawing/lightfx.h"
|
||||
#include "editor.h"
|
||||
#include "game.h"
|
||||
#include "input.h"
|
||||
@@ -52,12 +53,6 @@
|
||||
#include "world/scenery.h"
|
||||
#include "world/sprite.h"
|
||||
|
||||
#ifdef __ENABLE_LIGHTFX__
|
||||
|
||||
#include "drawing/lightfx.h"
|
||||
|
||||
#endif
|
||||
|
||||
// rct2: 0x0097F67C
|
||||
const char * const RCT2FilePaths[PATH_ID_END] = {
|
||||
"Data" PATH_SEPARATOR "g1.dat",
|
||||
@@ -194,14 +189,10 @@ bool rct2_init()
|
||||
window_staff_list_init_vars();
|
||||
load_palette();
|
||||
|
||||
|
||||
#ifdef __ENABLE_LIGHTFX__
|
||||
|
||||
lightfx_init();
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
log_verbose("initialising game finished");
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -97,6 +97,7 @@ enum WINDOW_OPTIONS_WIDGET_IDX {
|
||||
WIDX_CONSTRUCTION_MARKER,
|
||||
WIDX_CONSTRUCTION_MARKER_DROPDOWN,
|
||||
WIDX_DAY_NIGHT_CHECKBOX,
|
||||
WIDX_ENABLE_LIGHT_FX_CHECKBOX,
|
||||
WIDX_UPPER_CASE_BANNERS_CHECKBOX,
|
||||
WIDX_RENDER_WEATHER_EFFECTS_CHECKBOX,
|
||||
WIDX_DISABLE_LIGHTNING_EFFECT_CHECKBOX,
|
||||
@@ -233,9 +234,10 @@ static rct_widget window_options_rendering_widgets[] = {
|
||||
{ WWT_DROPDOWN, 1, 155, 299, FRAME_RENDERING_START + 45, FRAME_RENDERING_START + 55, STR_NONE, STR_NONE }, // Construction marker
|
||||
{ WWT_DROPDOWN_BUTTON, 1, 288, 298, FRAME_RENDERING_START + 46, FRAME_RENDERING_START + 54, STR_DROPDOWN_GLYPH, STR_CONSTRUCTION_MARKER_COLOUR_TIP },
|
||||
{ WWT_CHECKBOX, 1, 10, 290, FRAME_RENDERING_START + 60, FRAME_RENDERING_START + 71, STR_CYCLE_DAY_NIGHT, STR_CYCLE_DAY_NIGHT_TIP }, // Cycle day-night
|
||||
{ WWT_CHECKBOX, 1, 10, 290, FRAME_RENDERING_START + 75, FRAME_RENDERING_START + 86, STR_UPPERCASE_BANNERS, STR_UPPERCASE_BANNERS_TIP }, // Uppercase banners
|
||||
{ WWT_CHECKBOX, 1, 10, 290, FRAME_RENDERING_START + 90, FRAME_RENDERING_START + 101, STR_RENDER_WEATHER_EFFECTS, STR_RENDER_WEATHER_EFFECTS_TIP }, // Render weather effects
|
||||
{ WWT_CHECKBOX, 1, 31, 290, FRAME_RENDERING_START + 105, FRAME_RENDERING_START + 116, STR_DISABLE_LIGHTNING_EFFECT, STR_DISABLE_LIGHTNING_EFFECT_TIP }, // Disable lightning effect
|
||||
{ WWT_CHECKBOX, 1, 31, 290, FRAME_RENDERING_START + 75, FRAME_RENDERING_START + 86, STR_ENABLE_LIGHTING_EFFECTS, STR_ENABLE_LIGHTING_EFFECTS_TIP }, // Enable light fx
|
||||
{ WWT_CHECKBOX, 1, 10, 290, FRAME_RENDERING_START + 90, FRAME_RENDERING_START + 101, STR_UPPERCASE_BANNERS, STR_UPPERCASE_BANNERS_TIP }, // Uppercase banners
|
||||
{ WWT_CHECKBOX, 1, 10, 290, FRAME_RENDERING_START + 105, FRAME_RENDERING_START + 116, STR_RENDER_WEATHER_EFFECTS, STR_RENDER_WEATHER_EFFECTS_TIP }, // Render weather effects
|
||||
{ WWT_CHECKBOX, 1, 31, 290, FRAME_RENDERING_START + 120, FRAME_RENDERING_START + 131, STR_DISABLE_LIGHTNING_EFFECT, STR_DISABLE_LIGHTNING_EFFECT_TIP }, // Disable lightning effect
|
||||
#undef FRAME_RENDERING_START
|
||||
{ WIDGETS_END },
|
||||
};
|
||||
@@ -466,6 +468,7 @@ static uint32 window_options_page_enabled_widgets[] = {
|
||||
(1 << WIDX_CONSTRUCTION_MARKER) |
|
||||
(1 << WIDX_CONSTRUCTION_MARKER_DROPDOWN) |
|
||||
(1 << WIDX_DAY_NIGHT_CHECKBOX) |
|
||||
(1 << WIDX_ENABLE_LIGHT_FX_CHECKBOX) |
|
||||
(1 << WIDX_UPPER_CASE_BANNERS_CHECKBOX) |
|
||||
(1 << WIDX_RENDER_WEATHER_EFFECTS_CHECKBOX) |
|
||||
(1 << WIDX_DISABLE_LIGHTNING_EFFECT_CHECKBOX),
|
||||
@@ -646,6 +649,11 @@ static void window_options_mouseup(rct_window *w, sint32 widgetIndex)
|
||||
config_save_default();
|
||||
window_invalidate(w);
|
||||
break;
|
||||
case WIDX_ENABLE_LIGHT_FX_CHECKBOX:
|
||||
gConfigGeneral.enable_light_fx ^= 1;
|
||||
config_save_default();
|
||||
window_invalidate(w);
|
||||
break;
|
||||
case WIDX_UPPER_CASE_BANNERS_CHECKBOX:
|
||||
gConfigGeneral.upper_case_banners ^= 1;
|
||||
config_save_default();
|
||||
@@ -1475,6 +1483,15 @@ static void window_options_invalidate(rct_window *w)
|
||||
widget_set_checkbox_value(w, WIDX_TILE_SMOOTHING_CHECKBOX, gConfigGeneral.landscape_smoothing);
|
||||
widget_set_checkbox_value(w, WIDX_GRIDLINES_CHECKBOX, gConfigGeneral.always_show_gridlines);
|
||||
widget_set_checkbox_value(w, WIDX_DAY_NIGHT_CHECKBOX, gConfigGeneral.day_night_cycle);
|
||||
widget_set_checkbox_value(w, WIDX_ENABLE_LIGHT_FX_CHECKBOX, gConfigGeneral.enable_light_fx);
|
||||
if (gConfigGeneral.day_night_cycle &&
|
||||
gConfigGeneral.drawing_engine == DRAWING_ENGINE_SOFTWARE_WITH_HARDWARE_DISPLAY
|
||||
) {
|
||||
w->disabled_widgets &= ~(1 << WIDX_ENABLE_LIGHT_FX_CHECKBOX);
|
||||
} else {
|
||||
w->disabled_widgets |= (1 << WIDX_ENABLE_LIGHT_FX_CHECKBOX);
|
||||
}
|
||||
|
||||
widget_set_checkbox_value(w, WIDX_UPPER_CASE_BANNERS_CHECKBOX, gConfigGeneral.upper_case_banners);
|
||||
widget_set_checkbox_value(w, WIDX_RENDER_WEATHER_EFFECTS_CHECKBOX, gConfigGeneral.render_weather_effects || gConfigGeneral.render_weather_gloom);
|
||||
widget_set_checkbox_value(w, WIDX_DISABLE_LIGHTNING_EFFECT_CHECKBOX, gConfigGeneral.disable_lightning_effect);
|
||||
@@ -1499,6 +1516,7 @@ static void window_options_invalidate(rct_window *w)
|
||||
window_options_rendering_widgets[WIDX_CONSTRUCTION_MARKER].type = WWT_DROPDOWN;
|
||||
window_options_rendering_widgets[WIDX_CONSTRUCTION_MARKER_DROPDOWN].type = WWT_DROPDOWN_BUTTON;
|
||||
window_options_rendering_widgets[WIDX_DAY_NIGHT_CHECKBOX].type = WWT_CHECKBOX;
|
||||
window_options_rendering_widgets[WIDX_ENABLE_LIGHT_FX_CHECKBOX].type = WWT_CHECKBOX;
|
||||
window_options_rendering_widgets[WIDX_UPPER_CASE_BANNERS_CHECKBOX].type = WWT_CHECKBOX;
|
||||
window_options_rendering_widgets[WIDX_RENDER_WEATHER_EFFECTS_CHECKBOX].type = WWT_CHECKBOX;
|
||||
window_options_rendering_widgets[WIDX_DISABLE_LIGHTNING_EFFECT_CHECKBOX].type = WWT_CHECKBOX;
|
||||
|
||||
Reference in New Issue
Block a user