diff --git a/src/openrct2/drawing/LightFX.cpp b/src/openrct2/drawing/LightFX.cpp index 10c9e2895d..30861d5299 100644 --- a/src/openrct2/drawing/LightFX.cpp +++ b/src/openrct2/drawing/LightFX.cpp @@ -53,23 +53,23 @@ enum class LightFXQualifier : uint8_t Map, }; -struct lightlist_entry +struct LightListEntry { - CoordsXYZ loc; - ScreenCoordsXY viewCoords; - LightType lightType; - uint8_t lightIntensity; - uint32_t lightHash; - LightFXQualifier qualifier; - uint8_t lightID; - uint8_t lightLinger; + CoordsXYZ Position; + ScreenCoordsXY ViewCoords; + LightType Type; + uint8_t LightIntensity; + uint32_t LightHash; + LightFXQualifier Qualifier; + uint8_t LightID; + uint8_t LightLinger; }; -static lightlist_entry _LightListA[16000]; -static lightlist_entry _LightListB[16000]; +static LightListEntry _LightListA[16000]; +static LightListEntry _LightListB[16000]; -static lightlist_entry* _LightListBack; -static lightlist_entry* _LightListFront; +static LightListEntry* _LightListBack; +static LightListEntry* _LightListFront; static uint32_t LightListCurrentCountBack; static uint32_t LightListCurrentCountFront; @@ -194,16 +194,16 @@ void lightfx_prepare_light_list() { for (uint32_t light = 0; light < LightListCurrentCountFront; light++) { - lightlist_entry* entry = &_LightListFront[light]; + LightListEntry* entry = &_LightListFront[light]; - if (entry->loc.z == 0x7FFF) + if (entry->Position.z == 0x7FFF) { - entry->lightIntensity = 0xFF; + entry->LightIntensity = 0xFF; continue; } - int32_t posOnScreenX = entry->viewCoords.x - _current_view_x_front; - int32_t posOnScreenY = entry->viewCoords.y - _current_view_y_front; + int32_t posOnScreenX = entry->ViewCoords.x - _current_view_x_front; + int32_t posOnScreenY = entry->ViewCoords.y - _current_view_y_front; posOnScreenX = posOnScreenX / _current_view_zoom_front; posOnScreenY = posOnScreenY / _current_view_zoom_front; @@ -211,7 +211,7 @@ void lightfx_prepare_light_list() if ((posOnScreenX < -128) || (posOnScreenY < -128) || (posOnScreenX > _pixelInfo.width + 128) || (posOnScreenY > _pixelInfo.height + 128)) { - entry->lightType = LightType::None; + entry->Type = LightType::None; continue; } @@ -283,7 +283,7 @@ void lightfx_prepare_light_list() int32_t totalSamplePoints = 5; int32_t startSamplePoint = 1; - if (entry->qualifier == LightFXQualifier::Map) + if (entry->Qualifier == LightFXQualifier::Map) { startSamplePoint = 0; totalSamplePoints = 1; @@ -302,8 +302,8 @@ void lightfx_prepare_light_list() { // based on get_map_coordinates_from_pos_window rct_drawpixelinfo dpi; - dpi.x = entry->viewCoords.x + offsetPattern[0 + pat * 2] / mapFrontDiv; - dpi.y = entry->viewCoords.y + offsetPattern[1 + pat * 2] / mapFrontDiv; + dpi.x = entry->ViewCoords.x + offsetPattern[0 + pat * 2] / mapFrontDiv; + dpi.y = entry->ViewCoords.y + offsetPattern[1 + pat * 2] / mapFrontDiv; dpi.height = 1; dpi.zoom_level = _current_view_zoom_front; dpi.width = 1; @@ -331,10 +331,10 @@ void lightfx_prepare_light_list() baseHeight = tileElement->GetBaseZ(); } - minDist = (baseHeight - entry->loc.z) / 2; + minDist = (baseHeight - entry->Position.z) / 2; - int32_t deltaX = mapCoord.x - entry->loc.x; - int32_t deltaY = mapCoord.y - entry->loc.y; + int32_t deltaX = mapCoord.x - entry->Position.x; + int32_t deltaY = mapCoord.y - entry->Position.y; int32_t projDot = (dirVecX * deltaX + dirVecY * deltaY) / 1000; @@ -380,26 +380,26 @@ void lightfx_prepare_light_list() if (lightIntensityOccluded == 0) { - entry->lightType = LightType::None; + entry->Type = LightType::None; continue; } - entry->lightIntensity = std::min( - 0xFF, (entry->lightIntensity * lightIntensityOccluded) / (totalSamplePoints * 100)); + entry->LightIntensity = std::min( + 0xFF, (entry->LightIntensity * lightIntensityOccluded) / (totalSamplePoints * 100)); } - entry->lightIntensity = std::max( - 0x00, entry->lightIntensity - static_cast(_current_view_zoom_front) * 5); + entry->LightIntensity = std::max( + 0x00, entry->LightIntensity - static_cast(_current_view_zoom_front) * 5); if (_current_view_zoom_front > 0) { - if (GetLightTypeSize(entry->lightType) < static_cast(_current_view_zoom_front)) + if (GetLightTypeSize(entry->Type) < static_cast(_current_view_zoom_front)) { - entry->lightType = LightType::None; + entry->Type = LightType::None; continue; } - entry->lightType = SetLightTypeSize( - entry->lightType, GetLightTypeSize(entry->lightType) - static_cast(_current_view_zoom_front)); + entry->Type = SetLightTypeSize( + entry->Type, GetLightTypeSize(entry->Type) - static_cast(_current_view_zoom_front)); } } } @@ -416,7 +416,7 @@ void lightfx_swap_buffers() tmp = _LightListBack; _LightListBack = _LightListFront; - _LightListFront = static_cast(tmp); + _LightListFront = static_cast(tmp); LightListCurrentCountFront = LightListCurrentCountBack; LightListCurrentCountBack = 0x0; @@ -467,12 +467,12 @@ void lightfx_render_lights_to_frontbuffer() int32_t bufWriteWidth, bufWriteHeight; uint32_t bufReadSkip, bufWriteSkip; - lightlist_entry* entry = &_LightListFront[light]; + LightListEntry* entry = &_LightListFront[light]; - int32_t inRectCentreX = entry->viewCoords.x; - int32_t inRectCentreY = entry->viewCoords.y; + int32_t inRectCentreX = entry->ViewCoords.x; + int32_t inRectCentreY = entry->ViewCoords.y; - if (entry->loc.z != 0x7FFF) + if (entry->Position.z != 0x7FFF) { inRectCentreX -= _current_view_x_front; inRectCentreY -= _current_view_y_front; @@ -480,7 +480,7 @@ void lightfx_render_lights_to_frontbuffer() inRectCentreY = inRectCentreY / _current_view_zoom_front; } - switch (entry->lightType) + switch (entry->Type) { case LightType::Lantern0: bufReadWidth = 32; @@ -580,7 +580,7 @@ void lightfx_render_lights_to_frontbuffer() bufReadSkip = bufReadWidth - bufWriteWidth; bufWriteSkip = _pixelInfo.width - bufWriteWidth; - if (entry->lightIntensity == 0xFF) + if (entry->LightIntensity == 0xFF) { for (int32_t y = 0; y < bufWriteHeight; y++) { @@ -601,7 +601,7 @@ void lightfx_render_lights_to_frontbuffer() { for (int32_t x = 0; x < bufWriteWidth; x++) { - *bufWriteBase = std::min(0xFF, *bufWriteBase + (((*bufReadBase) * (1 + entry->lightIntensity)) >> 8)); + *bufWriteBase = std::min(0xFF, *bufWriteBase + (((*bufReadBase) * (1 + entry->LightIntensity)) >> 8)); bufWriteBase++; bufReadBase++; } @@ -636,36 +636,36 @@ static void LightfxAdd3DLight( for (uint32_t i = 0; i < LightListCurrentCountBack; i++) { - lightlist_entry* entry = &_LightListBack[i]; - if (entry->lightHash != lightHash) + LightListEntry* entry = &_LightListBack[i]; + if (entry->LightHash != lightHash) continue; - if (entry->qualifier != qualifier) + if (entry->Qualifier != qualifier) continue; - if (entry->lightID != id) + if (entry->LightID != id) continue; - entry->loc = loc; - entry->viewCoords = translate_3d_to_2d_with_z(get_current_rotation(), loc); - entry->lightType = lightType; - entry->lightIntensity = 0xFF; - entry->lightHash = lightHash; - entry->qualifier = qualifier; - entry->lightID = id; - entry->lightLinger = 1; + entry->Position = loc; + entry->ViewCoords = translate_3d_to_2d_with_z(get_current_rotation(), loc); + entry->Type = lightType; + entry->LightIntensity = 0xFF; + entry->LightHash = lightHash; + entry->Qualifier = qualifier; + entry->LightID = id; + entry->LightLinger = 1; return; } - lightlist_entry* entry = &_LightListBack[LightListCurrentCountBack++]; + LightListEntry* entry = &_LightListBack[LightListCurrentCountBack++]; - entry->loc = loc; - entry->viewCoords = translate_3d_to_2d_with_z(get_current_rotation(), loc); - entry->lightType = lightType; - entry->lightIntensity = 0xFF; - entry->lightHash = lightHash; - entry->qualifier = qualifier; - entry->lightID = id; - entry->lightLinger = 1; + entry->Position = loc; + entry->ViewCoords = translate_3d_to_2d_with_z(get_current_rotation(), loc); + entry->Type = lightType; + entry->LightIntensity = 0xFF; + entry->LightHash = lightHash; + entry->Qualifier = qualifier; + entry->LightID = id; + entry->LightLinger = 1; // log_warning("new 3d light"); }