Compare commits

...

14 Commits

Author SHA1 Message Date
katerid c1f9b888df
Merge a8b180936d into 9266a6f0d3 2024-04-28 01:48:55 +00:00
Harry Hopkinson 9266a6f0d3
Remove duplicate sprite_map in TrackPaint.cpp 2024-04-27 21:13:22 +02:00
Michael Steenbeek 03926c46d0
Update to v1.4.4 objects release 2024-04-27 19:30:39 +02:00
Kateri Darr a8b180936d fixed up all instances of SCROLLABLE_ROW_HEIGHT 2024-04-26 17:23:54 -04:00
Kateri Darr af4fe9bf5f Starting to work on Window.h with scrollable_row_height 2024-04-26 16:39:31 -04:00
Kateri Darr a94f488410 fixing some final things up before I start from a clean slate 2024-04-26 14:58:26 -04:00
Kateri Darr 36b876f2f7 trying to see if the build issues are from something I did 2024-04-26 14:53:09 -04:00
Kateri Darr a7e59b1a02 attempting to start from a clean slate and want to make sure nothing is broken 2024-04-26 14:10:25 -04:00
Kateri Darr 5134623074 changing openrct2Version, trying to do nothing with openrct2Name 2024-04-26 13:37:15 -04:00
Kateri Darr 4a5fcfd4d9 new attempt at concatenating a constexpr 2024-04-26 13:15:00 -04:00
Kateri Darr c4e65b00c5 testing if this changed any of the problems from RootCommands.cpp 2024-04-26 12:47:16 -04:00
Kateri Darr d02a03f214 constexpr in Version.h 2024-04-26 00:44:31 -04:00
Kateri Darr fb9dca4678 reset 2024-04-26 00:42:52 -04:00
Kateri Darr be8f949969 changing #define to constexpr in Version.h 2024-04-26 00:40:31 -04:00
23 changed files with 94 additions and 183 deletions

View File

@ -1,85 +0,0 @@
{
"configurations": [
{
"name": "Mac",
"includePath": [
"/usr/include",
"/usr/local/include",
"${workspaceRoot}",
"${workspaceRoot}/src/**"
],
"defines": [],
"intelliSenseMode": "clang-x64",
"browse": {
"path": [
"/usr/include",
"/usr/local/include",
"${workspaceRoot}"
],
"limitSymbolsToIncludedHeaders": true,
"databaseFilename": ""
},
"macFrameworkPath": [
"/System/Library/Frameworks",
"/Library/Frameworks"
],
"cStandard": "c11",
"cppStandard": "c++20"
},
{
"name": "Linux",
"includePath": [
"/usr/include",
"/usr/include/SDL2",
"/usr/local/include",
"${workspaceRoot}",
"${workspaceRoot}/src"
],
"defines": [
"ENABLE_SCRIPTING"
],
"intelliSenseMode": "clang-x64",
"browse": {
"path": [
"/usr/include",
"/usr/local/include",
"${workspaceRoot}",
"${workspaceRoot}/src"
],
"limitSymbolsToIncludedHeaders": true,
"databaseFilename": ""
},
"compilerPath": "/usr/bin/clang",
"cStandard": "c11",
"cppStandard": "c++17"
},
{
"name": "Win32",
"includePath": [
"${workspaceRoot}",
"${workspaceRoot}/src",
"${workspaceRoot}/src/thirdparty",
"${workspaceRoot}/lib/Win32/include",
"${workspaceRoot}/lib/x64/include",
"${workspaceRoot}/lib/googletest/googletest/include"
],
"defines": [
"_DEBUG",
"UNICODE",
"_UNICODE",
"ENABLE_SCRIPTING"
],
"intelliSenseMode": "msvc-x64",
"browse": {
"path": [
"${workspaceRoot}"
],
"limitSymbolsToIncludedHeaders": true,
"databaseFilename": ""
},
"cStandard": "c11",
"cppStandard": "c++17"
}
],
"version": 4
}

View File

@ -64,9 +64,9 @@ set(TITLE_SEQUENCE_VERSION "0.4.6")
set(TITLE_SEQUENCE_URL "https://github.com/OpenRCT2/title-sequences/releases/download/v${TITLE_SEQUENCE_VERSION}/title-sequences.zip")
set(TITLE_SEQUENCE_SHA1 "80fefc6ebbabc42a6f4703412daa5c62f661420d")
set(OBJECTS_VERSION "1.4.3")
set(OBJECTS_VERSION "1.4.4")
set(OBJECTS_URL "https://github.com/OpenRCT2/objects/releases/download/v${OBJECTS_VERSION}/objects.zip")
set(OBJECTS_SHA1 "ac78210ef46465c0f51bbffd6fe21845092af48e")
set(OBJECTS_SHA1 "4e9b5d7f85a07b90ec57fe37517e04b19ee0395c")
set(OPENSFX_VERSION "1.0.5")
set(OPENSFX_URL "https://github.com/OpenRCT2/OpenSoundEffects/releases/download/v${OPENSFX_VERSION}/opensound.zip")

View File

@ -11,6 +11,8 @@
- Fix: [#21696] Fullscreen window option not correctly applied on macOS.
- Fix: [#21787] Map generator heightmap should respect increased height limits.
- Fix: [#21829] When creating a new scenario, the default name contains formatting codes.
- Fix: [objects#324] Cannot build Colosseum inside a turn or helix.
- Fix: [objects#325] Sloped castle walls are vertically offset by one pixel (original bug).
0.4.10 (2024-04-02)
------------------------------------------------------------------------

View File

@ -45,8 +45,8 @@
<LibsSha1 Condition="'$(Platform)'=='Win32'">f3636b530110c7592deab23ca0d0c1916fc7e44c</LibsSha1>
<TitleSequencesUrl>https://github.com/OpenRCT2/title-sequences/releases/download/v0.4.6/title-sequences.zip</TitleSequencesUrl>
<TitleSequencesSha1>80fefc6ebbabc42a6f4703412daa5c62f661420d</TitleSequencesSha1>
<ObjectsUrl>https://github.com/OpenRCT2/objects/releases/download/v1.4.3/objects.zip</ObjectsUrl>
<ObjectsSha1>ac78210ef46465c0f51bbffd6fe21845092af48e</ObjectsSha1>
<ObjectsUrl>https://github.com/OpenRCT2/objects/releases/download/v1.4.4/objects.zip</ObjectsUrl>
<ObjectsSha1>4e9b5d7f85a07b90ec57fe37517e04b19ee0395c</ObjectsSha1>
<OpenSFXUrl>https://github.com/OpenRCT2/OpenSoundEffects/releases/download/v1.0.5/opensound.zip</OpenSFXUrl>
<OpenSFXSha1>b1b1f1b241d2cbff63a1889c4dc5a09bdf769bfb</OpenSFXSha1>
<OpenMSXUrl>https://github.com/OpenRCT2/OpenMusic/releases/download/v1.5/openmusic.zip</OpenMSXUrl>

View File

@ -52,7 +52,7 @@ static Widget WindowAssetPacksWidgets[] = {
class AssetPacksWindow final : public Window
{
private:
static constexpr int32_t ItemHeight = SCROLLABLE_ROW_HEIGHT + 1;
static constexpr int32_t ItemHeight = kScrollableRowHeight + 1;
static constexpr int32_t ItemCheckBoxSize = ItemHeight - 3;
std::optional<size_t> _highlightedIndex;
std::optional<size_t> _selectedIndex;

View File

@ -230,11 +230,11 @@ static Widget _inventionListDragWidgets[] = {
ScreenSize size{};
if (scrollIndex == 0)
{
size.height = static_cast<int32_t>(gameState.ResearchItemsInvented.size()) * SCROLLABLE_ROW_HEIGHT;
size.height = static_cast<int32_t>(gameState.ResearchItemsInvented.size()) * kScrollableRowHeight;
}
else
{
size.height = static_cast<int32_t>(gameState.ResearchItemsUninvented.size()) * SCROLLABLE_ROW_HEIGHT;
size.height = static_cast<int32_t>(gameState.ResearchItemsUninvented.size()) * kScrollableRowHeight;
}
return size;
}
@ -279,14 +279,14 @@ static Widget _inventionListDragWidgets[] = {
GfxClear(dpi, paletteIndex);
int16_t boxWidth = widgets[WIDX_RESEARCH_ORDER_SCROLL].width();
int32_t itemY = -SCROLLABLE_ROW_HEIGHT;
int32_t itemY = -kScrollableRowHeight;
auto* dragItem = WindowEditorInventionsListDragGetItem();
const auto& researchList = scrollIndex == 0 ? gameState.ResearchItemsInvented : gameState.ResearchItemsUninvented;
for (const auto& researchItem : researchList)
{
itemY += SCROLLABLE_ROW_HEIGHT;
if (itemY + SCROLLABLE_ROW_HEIGHT < dpi.y || itemY >= dpi.y + dpi.height)
itemY += kScrollableRowHeight;
if (itemY + kScrollableRowHeight < dpi.y || itemY >= dpi.y + dpi.height)
continue;
if (_selectedResearchItem == &researchItem)
@ -296,7 +296,7 @@ static Widget _inventionListDragWidgets[] = {
{
// Highlight
top = itemY;
bottom = itemY + SCROLLABLE_ROW_HEIGHT - 1;
bottom = itemY + kScrollableRowHeight - 1;
}
else
{
@ -559,7 +559,7 @@ static Widget _inventionListDragWidgets[] = {
auto& researchList = isInvented ? gameState.ResearchItemsInvented : gameState.ResearchItemsUninvented;
for (auto& researchItem : researchList)
{
y -= SCROLLABLE_ROW_HEIGHT;
y -= kScrollableRowHeight;
if (y < 0)
{
return &researchItem;
@ -575,7 +575,7 @@ static Widget _inventionListDragWidgets[] = {
auto& researchList = isInvented ? gameState.ResearchItemsInvented : gameState.ResearchItemsUninvented;
for (auto& researchItem : researchList)
{
y -= SCROLLABLE_ROW_HEIGHT;
y -= kScrollableRowHeight;
if (y < 0)
{
return &researchItem;

View File

@ -585,7 +585,7 @@ static std::vector<Widget> _window_editor_object_selection_widgets = {
*/
ScreenSize OnScrollGetSize(int32_t scrollIndex) override
{
const auto newHeight = static_cast<int32_t>(_listItems.size() * SCROLLABLE_ROW_HEIGHT);
const auto newHeight = static_cast<int32_t>(_listItems.size() * kScrollableRowHeight);
return { 0, newHeight };
}
@ -730,7 +730,7 @@ static std::vector<Widget> _window_editor_object_selection_widgets = {
for (size_t i = 0; i < _listItems.size(); i++)
{
const auto& listItem = _listItems[i];
if (screenCoords.y + SCROLLABLE_ROW_HEIGHT >= dpi.y && screenCoords.y <= dpi.y + dpi.height)
if (screenCoords.y + kScrollableRowHeight >= dpi.y && screenCoords.y <= dpi.y + dpi.height)
{
// Draw checkbox
if (!(gScreenFlags & SCREEN_FLAGS_TRACK_MANAGER) && !(*listItem.flags & 0x20))
@ -742,7 +742,7 @@ static std::vector<Widget> _window_editor_object_selection_widgets = {
&& !(*listItem.flags & ObjectSelectionFlags::Flag6);
if (highlighted)
{
auto bottom = screenCoords.y + (SCROLLABLE_ROW_HEIGHT - 1);
auto bottom = screenCoords.y + (kScrollableRowHeight - 1);
GfxFilterRect(dpi, { 0, screenCoords.y, width, bottom }, FilterPaletteID::PaletteDarken1);
}
@ -801,7 +801,7 @@ static std::vector<Widget> _window_editor_object_selection_widgets = {
ft.Add<const char*>(gCommonStringFormatBuffer);
DrawTextEllipsised(dpi, screenCoords, width_limit, STR_STRING, ft, { colour, FontStyle::Medium, darkness });
}
screenCoords.y += SCROLLABLE_ROW_HEIGHT;
screenCoords.y += kScrollableRowHeight;
}
}
@ -1539,7 +1539,7 @@ static std::vector<Widget> _window_editor_object_selection_widgets = {
*/
int32_t GetObjectFromObjectSelection(ObjectType object_type, int32_t y)
{
int32_t listItemIndex = y / SCROLLABLE_ROW_HEIGHT;
int32_t listItemIndex = y / kScrollableRowHeight;
if (listItemIndex < 0 || static_cast<size_t>(listItemIndex) >= _listItems.size())
return -1;

View File

@ -130,9 +130,9 @@ static Widget window_guest_list_widgets[] = {
char Name[256];
};
static constexpr uint8_t SUMMARISED_GUEST_ROW_HEIGHT = SCROLLABLE_ROW_HEIGHT + 11;
static constexpr uint8_t SUMMARISED_GUEST_ROW_HEIGHT = kScrollableRowHeight + 11;
static constexpr auto GUESTS_PER_PAGE = 2000;
static constexpr const auto GUEST_PAGE_HEIGHT = GUESTS_PER_PAGE * SCROLLABLE_ROW_HEIGHT;
static constexpr const auto GUEST_PAGE_HEIGHT = GUESTS_PER_PAGE * kScrollableRowHeight;
static constexpr size_t MaxGroups = 240;
TabId _selectedTab{};
@ -503,7 +503,7 @@ static Widget window_guest_list_widgets[] = {
{
case TabId::Individual:
// Count the number of guests
y = static_cast<int32_t>(_guestList.size()) * SCROLLABLE_ROW_HEIGHT;
y = static_cast<int32_t>(_guestList.size()) * kScrollableRowHeight;
_numPages = (_guestList.size() + GUESTS_PER_PAGE - 1) / GUESTS_PER_PAGE;
if (_numPages == 0)
_selectedPage = 0;
@ -542,7 +542,7 @@ static Widget window_guest_list_widgets[] = {
void OnScrollMouseOver(int32_t scrollIndex, const ScreenCoordsXY& screenCoords) override
{
auto i = screenCoords.y / (_selectedTab == TabId::Individual ? SCROLLABLE_ROW_HEIGHT : SUMMARISED_GUEST_ROW_HEIGHT);
auto i = screenCoords.y / (_selectedTab == TabId::Individual ? kScrollableRowHeight : SUMMARISED_GUEST_ROW_HEIGHT);
i += static_cast<int32_t>(_selectedPage * GUESTS_PER_PAGE);
if (static_cast<size_t>(i) != _highlightedIndex)
{
@ -557,7 +557,7 @@ static Widget window_guest_list_widgets[] = {
{
case TabId::Individual:
{
auto i = screenCoords.y / SCROLLABLE_ROW_HEIGHT;
auto i = screenCoords.y / kScrollableRowHeight;
i += static_cast<int32_t>(_selectedPage * GUESTS_PER_PAGE);
for (const auto& guestItem : _guestList)
{
@ -670,14 +670,14 @@ static Widget window_guest_list_widgets[] = {
for (const auto& guestItem : _guestList)
{
// Check if y is beyond the scroll control
if (y + SCROLLABLE_ROW_HEIGHT + 1 >= -0x7FFF && y + SCROLLABLE_ROW_HEIGHT + 1 > dpi.y && y < 0x7FFF
if (y + kScrollableRowHeight + 1 >= -0x7FFF && y + kScrollableRowHeight + 1 > dpi.y && y < 0x7FFF
&& y < dpi.y + dpi.height)
{
// Highlight backcolour and text colour (format)
StringId format = STR_BLACK_STRING;
if (index == _highlightedIndex)
{
GfxFilterRect(dpi, { 0, y, 800, y + SCROLLABLE_ROW_HEIGHT - 1 }, FilterPaletteID::PaletteDarken1);
GfxFilterRect(dpi, { 0, y, 800, y + kScrollableRowHeight - 1 }, FilterPaletteID::PaletteDarken1);
format = STR_WINDOW_COLOUR_2_STRINGID;
}
@ -725,7 +725,7 @@ static Widget window_guest_list_widgets[] = {
break;
}
}
y += SCROLLABLE_ROW_HEIGHT;
y += kScrollableRowHeight;
index++;
}
}

View File

@ -905,14 +905,14 @@ static Widget window_loadsave_widgets[] =
ScreenSize OnScrollGetSize(int32_t scrollIndex) override
{
return { 0, no_list_items * SCROLLABLE_ROW_HEIGHT };
return { 0, no_list_items * kScrollableRowHeight };
}
void OnScrollMouseOver(int32_t scrollIndex, const ScreenCoordsXY& screenCoords) override
{
int32_t selectedItem;
selectedItem = screenCoords.y / SCROLLABLE_ROW_HEIGHT;
selectedItem = screenCoords.y / kScrollableRowHeight;
if (selectedItem >= no_list_items)
return;
@ -925,7 +925,7 @@ static Widget window_loadsave_widgets[] =
{
int32_t selectedItem;
selectedItem = screenCoords.y / SCROLLABLE_ROW_HEIGHT;
selectedItem = screenCoords.y / kScrollableRowHeight;
if (selectedItem >= no_list_items)
return;
@ -966,11 +966,11 @@ static Widget window_loadsave_widgets[] =
for (int32_t i = 0; i < no_list_items; i++)
{
int32_t y = i * SCROLLABLE_ROW_HEIGHT;
int32_t y = i * kScrollableRowHeight;
if (y > dpi.y + dpi.height)
break;
if (y + SCROLLABLE_ROW_HEIGHT < dpi.y)
if (y + kScrollableRowHeight < dpi.y)
continue;
StringId stringId = STR_BLACK_STRING;
@ -979,7 +979,7 @@ static Widget window_loadsave_widgets[] =
if (i == selected_list_item)
{
stringId = STR_WINDOW_COLOUR_2_STRINGID;
GfxFilterRect(dpi, { 0, y, listWidth, y + SCROLLABLE_ROW_HEIGHT }, FilterPaletteID::PaletteDarken1);
GfxFilterRect(dpi, { 0, y, listWidth, y + kScrollableRowHeight }, FilterPaletteID::PaletteDarken1);
}
// display a marker next to the currently loaded game file
if (_listItems[i].loaded)

View File

@ -569,7 +569,7 @@ static constexpr StringId WindowMultiplayerPageTitles[] = {
Invalidate();
}
screenSize = { 0, NetworkGetNumPlayers() * SCROLLABLE_ROW_HEIGHT };
screenSize = { 0, NetworkGetNumPlayers() * kScrollableRowHeight };
int32_t i = screenSize.height - window_multiplayer_players_widgets[WIDX_LIST].bottom
+ window_multiplayer_players_widgets[WIDX_LIST].top + 21;
if (i < 0)
@ -590,7 +590,7 @@ static constexpr StringId WindowMultiplayerPageTitles[] = {
Invalidate();
}
screenSize = { 0, NetworkGetNumActions() * SCROLLABLE_ROW_HEIGHT };
screenSize = { 0, NetworkGetNumActions() * kScrollableRowHeight };
int32_t i = screenSize.height - window_multiplayer_groups_widgets[WIDX_LIST].bottom
+ window_multiplayer_groups_widgets[WIDX_LIST].top + 21;
if (i < 0)
@ -612,7 +612,7 @@ static constexpr StringId WindowMultiplayerPageTitles[] = {
{
case WINDOW_MULTIPLAYER_PAGE_PLAYERS:
{
int32_t index = screenCoords.y / SCROLLABLE_ROW_HEIGHT;
int32_t index = screenCoords.y / kScrollableRowHeight;
if (index >= no_list_items)
return;
@ -626,7 +626,7 @@ static constexpr StringId WindowMultiplayerPageTitles[] = {
case WINDOW_MULTIPLAYER_PAGE_GROUPS:
{
int32_t index = screenCoords.y / SCROLLABLE_ROW_HEIGHT;
int32_t index = screenCoords.y / kScrollableRowHeight;
if (index >= no_list_items)
return;
@ -648,7 +648,7 @@ static constexpr StringId WindowMultiplayerPageTitles[] = {
case WINDOW_MULTIPLAYER_PAGE_PLAYERS:
case WINDOW_MULTIPLAYER_PAGE_GROUPS:
{
int32_t index = screenCoords.y / SCROLLABLE_ROW_HEIGHT;
int32_t index = screenCoords.y / kScrollableRowHeight;
if (index >= no_list_items)
return;
@ -751,7 +751,7 @@ static constexpr StringId WindowMultiplayerPageTitles[] = {
break;
}
if (screenCoords.y + SCROLLABLE_ROW_HEIGHT + 1 >= dpi.y)
if (screenCoords.y + kScrollableRowHeight + 1 >= dpi.y)
{
thread_local std::string _buffer;
_buffer.reserve(512);
@ -762,7 +762,7 @@ static constexpr StringId WindowMultiplayerPageTitles[] = {
if (listPosition == selected_list_item)
{
GfxFilterRect(
dpi, { 0, screenCoords.y, 800, screenCoords.y + SCROLLABLE_ROW_HEIGHT - 1 },
dpi, { 0, screenCoords.y, 800, screenCoords.y + kScrollableRowHeight - 1 },
FilterPaletteID::PaletteDarken1);
_buffer += NetworkGetPlayerName(player);
colour = colours[2];
@ -831,7 +831,7 @@ static constexpr StringId WindowMultiplayerPageTitles[] = {
screenCoords.x = 356;
GfxDrawString(dpi, screenCoords, _buffer.c_str(), { colour });
}
screenCoords.y += SCROLLABLE_ROW_HEIGHT;
screenCoords.y += kScrollableRowHeight;
listPosition++;
}
}
@ -893,7 +893,7 @@ static constexpr StringId WindowMultiplayerPageTitles[] = {
if (i == selected_list_item)
{
GfxFilterRect(
dpi, { 0, screenCoords.y, 800, screenCoords.y + SCROLLABLE_ROW_HEIGHT - 1 },
dpi, { 0, screenCoords.y, 800, screenCoords.y + kScrollableRowHeight - 1 },
FilterPaletteID::PaletteDarken1);
}
if (screenCoords.y > dpi.y + dpi.height)
@ -901,7 +901,7 @@ static constexpr StringId WindowMultiplayerPageTitles[] = {
break;
}
if (screenCoords.y + SCROLLABLE_ROW_HEIGHT + 1 >= dpi.y)
if (screenCoords.y + kScrollableRowHeight + 1 >= dpi.y)
{
int32_t groupindex = NetworkGetGroupIndex(_selectedGroup);
if (groupindex != -1)
@ -918,7 +918,7 @@ static constexpr StringId WindowMultiplayerPageTitles[] = {
ft.Add<uint16_t>(NetworkGetActionNameStringID(i));
DrawTextBasic(dpi, { 10, screenCoords.y }, STR_WINDOW_COLOUR_2_STRINGID, ft);
}
screenCoords.y += SCROLLABLE_ROW_HEIGHT;
screenCoords.y += kScrollableRowHeight;
}
}

View File

@ -465,19 +465,19 @@ static Widget window_object_load_error_widgets[] = {
ScreenSize OnScrollGetSize(const int32_t scrollIndex) override
{
return ScreenSize(0, no_list_items * SCROLLABLE_ROW_HEIGHT);
return ScreenSize(0, no_list_items * kScrollableRowHeight);
}
void OnScrollMouseDown(const int32_t scrollIndex, const ScreenCoordsXY& screenCoords) override
{
const auto selectedItem = screenCoords.y / SCROLLABLE_ROW_HEIGHT;
const auto selectedItem = screenCoords.y / kScrollableRowHeight;
SelectObjectFromList(selectedItem);
}
void OnScrollMouseOver(const int32_t scrollIndex, const ScreenCoordsXY& screenCoords) override
{
// Highlight item that the cursor is over, or remove highlighting if none
const auto selectedItem = screenCoords.y / SCROLLABLE_ROW_HEIGHT;
const auto selectedItem = screenCoords.y / kScrollableRowHeight;
if (selectedItem < 0 || selectedItem >= no_list_items)
_highlightedIndex = -1;
else
@ -513,15 +513,15 @@ static Widget window_object_load_error_widgets[] = {
for (int32_t i = 0; i < no_list_items; i++)
{
ScreenCoordsXY screenCoords;
screenCoords.y = i * SCROLLABLE_ROW_HEIGHT;
screenCoords.y = i * kScrollableRowHeight;
if (screenCoords.y > dpi.y + dpi.height)
break;
if (screenCoords.y + SCROLLABLE_ROW_HEIGHT < dpi.y)
if (screenCoords.y + kScrollableRowHeight < dpi.y)
continue;
const auto screenRect = ScreenRect{ { 0, screenCoords.y },
{ listWidth, screenCoords.y + SCROLLABLE_ROW_HEIGHT - 1 } };
{ listWidth, screenCoords.y + kScrollableRowHeight - 1 } };
// If hovering over item, change the color and fill the backdrop.
if (i == selected_list_item)
GfxFillRect(dpi, screenRect, ColourMapA[colours[1]].darker);

View File

@ -386,7 +386,7 @@ static Widget _rideListWidgets[] = {
*/
ScreenSize OnScrollGetSize(int32_t scrollIndex) override
{
const auto newHeight = static_cast<int32_t>(_rideList.size() * SCROLLABLE_ROW_HEIGHT);
const auto newHeight = static_cast<int32_t>(_rideList.size() * kScrollableRowHeight);
if (selected_list_item != -1)
{
selected_list_item = -1;
@ -411,7 +411,7 @@ static Widget _rideListWidgets[] = {
*/
void OnScrollMouseDown(int32_t scrollIndex, const ScreenCoordsXY& screenCoords) override
{
const auto index = screenCoords.y / SCROLLABLE_ROW_HEIGHT;
const auto index = screenCoords.y / kScrollableRowHeight;
if (index < 0 || static_cast<size_t>(index) >= _rideList.size())
return;
@ -437,7 +437,7 @@ static Widget _rideListWidgets[] = {
*/
void OnScrollMouseOver(int32_t scrollIndex, const ScreenCoordsXY& screenCoords) override
{
const auto index = screenCoords.y / SCROLLABLE_ROW_HEIGHT;
const auto index = screenCoords.y / kScrollableRowHeight;
if (index < 0 || static_cast<size_t>(index) >= _rideList.size())
return;
@ -552,7 +552,7 @@ static Widget _rideListWidgets[] = {
if (i == static_cast<size_t>(selected_list_item))
{
// Background highlight
GfxFilterRect(dpi, { 0, y, 800, y + SCROLLABLE_ROW_HEIGHT - 1 }, FilterPaletteID::PaletteDarken1);
GfxFilterRect(dpi, { 0, y, 800, y + kScrollableRowHeight - 1 }, FilterPaletteID::PaletteDarken1);
format = (_quickDemolishMode ? STR_LIGHTPINK_STRINGID : STR_WINDOW_COLOUR_2_STRINGID);
}
@ -742,7 +742,7 @@ static Widget _rideListWidgets[] = {
ft.Add<StringId>(formatSecondary);
}
DrawTextEllipsised(dpi, { 160, y - 1 }, 157, format, ft);
y += SCROLLABLE_ROW_HEIGHT;
y += kScrollableRowHeight;
}
}

View File

@ -263,7 +263,7 @@ static Widget window_shortcut_change_widgets[] = {
ScreenSize OnScrollGetSize(int32_t scrollIndex) override
{
auto h = static_cast<int32_t>(_list.size() * SCROLLABLE_ROW_HEIGHT);
auto h = static_cast<int32_t>(_list.size() * kScrollableRowHeight);
auto bottom = std::max(0, h - widgets[WIDX_SCROLL].bottom + widgets[WIDX_SCROLL].top + 21);
if (bottom < scrolls[0].v_top)
{
@ -275,7 +275,7 @@ static Widget window_shortcut_change_widgets[] = {
void OnScrollMouseOver(int32_t scrollIndex, const ScreenCoordsXY& screenCoords) override
{
auto index = static_cast<int_fast16_t>((screenCoords.y - 1) / SCROLLABLE_ROW_HEIGHT);
auto index = static_cast<int_fast16_t>((screenCoords.y - 1) / kScrollableRowHeight);
if (static_cast<size_t>(index) < _list.size())
{
_highlightedItem = index;
@ -289,7 +289,7 @@ static Widget window_shortcut_change_widgets[] = {
void OnScrollMouseDown(int32_t scrollIndex, const ScreenCoordsXY& screenCoords) override
{
auto selectedItem = static_cast<size_t>((screenCoords.y - 1) / SCROLLABLE_ROW_HEIGHT);
auto selectedItem = static_cast<size_t>((screenCoords.y - 1) / kScrollableRowHeight);
if (selectedItem < _list.size())
{
// Is this a separator?
@ -314,13 +314,13 @@ static Widget window_shortcut_change_widgets[] = {
for (size_t i = 0; i < _list.size(); ++i)
{
auto y = static_cast<int32_t>(1 + i * SCROLLABLE_ROW_HEIGHT);
auto y = static_cast<int32_t>(1 + i * kScrollableRowHeight);
if (y > dpi.y + dpi.height)
{
break;
}
if (y + SCROLLABLE_ROW_HEIGHT < dpi.y)
if (y + kScrollableRowHeight < dpi.y)
{
continue;
}
@ -504,7 +504,7 @@ static Widget window_shortcut_change_widgets[] = {
void DrawSeparator(DrawPixelInfo& dpi, int32_t y, int32_t scrollWidth)
{
const int32_t top = y + (SCROLLABLE_ROW_HEIGHT / 2) - 1;
const int32_t top = y + (kScrollableRowHeight / 2) - 1;
GfxFillRect(dpi, { { 0, top }, { scrollWidth, top } }, ColourMapA[colours[0]].mid_dark);
GfxFillRect(dpi, { { 0, top + 1 }, { scrollWidth, top + 1 } }, ColourMapA[colours[0]].lightest);
}
@ -516,7 +516,7 @@ static Widget window_shortcut_change_widgets[] = {
if (isHighlighted)
{
format = STR_WINDOW_COLOUR_2_STRINGID;
GfxFilterRect(dpi, { 0, y - 1, scrollWidth, y + (SCROLLABLE_ROW_HEIGHT - 2) }, FilterPaletteID::PaletteDarken1);
GfxFilterRect(dpi, { 0, y - 1, scrollWidth, y + (kScrollableRowHeight - 2) }, FilterPaletteID::PaletteDarken1);
}
auto bindingOffset = (scrollWidth * 2) / 3;

View File

@ -324,7 +324,7 @@ static Widget _staffListWidgets[] = {
Invalidate();
}
auto scrollHeight = static_cast<int32_t>(_staffList.size()) * SCROLLABLE_ROW_HEIGHT;
auto scrollHeight = static_cast<int32_t>(_staffList.size()) * kScrollableRowHeight;
auto i = scrollHeight - widgets[WIDX_STAFF_LIST_LIST].bottom + widgets[WIDX_STAFF_LIST_LIST].top + 21;
if (i < 0)
i = 0;
@ -340,7 +340,7 @@ static Widget _staffListWidgets[] = {
void OnScrollMouseOver(int32_t scrollIndex, const ScreenCoordsXY& screenCoords) override
{
auto i = static_cast<size_t>(screenCoords.y / SCROLLABLE_ROW_HEIGHT);
auto i = static_cast<size_t>(screenCoords.y / kScrollableRowHeight);
if (i != _highlightedIndex)
{
_highlightedIndex = static_cast<size_t>(i);
@ -350,7 +350,7 @@ static Widget _staffListWidgets[] = {
void OnScrollMouseDown(int32_t scrollIndex, const ScreenCoordsXY& screenCoords) override
{
int32_t i = screenCoords.y / SCROLLABLE_ROW_HEIGHT;
int32_t i = screenCoords.y / kScrollableRowHeight;
for (const auto& entry : _staffList)
{
if (i == 0)
@ -410,7 +410,7 @@ static Widget _staffListWidgets[] = {
if (i == _highlightedIndex)
{
GfxFilterRect(dpi, { 0, y, 800, y + (SCROLLABLE_ROW_HEIGHT - 1) }, FilterPaletteID::PaletteDarken1);
GfxFilterRect(dpi, { 0, y, 800, y + (kScrollableRowHeight - 1) }, FilterPaletteID::PaletteDarken1);
format = (_quickFireMode ? STR_LIGHTPINK_STRINGID : STR_WINDOW_COLOUR_2_STRINGID);
}
@ -452,7 +452,7 @@ static Widget _staffListWidgets[] = {
}
}
y += SCROLLABLE_ROW_HEIGHT;
y += kScrollableRowHeight;
i++;
}
}

View File

@ -994,7 +994,7 @@ static uint64_t PageDisabledWidgets[] = {
ScreenSize OnScrollGetSize(int32_t scrollIndex) override
{
return ScreenSize(WW - 30, windowTileInspectorElementCount * SCROLLABLE_ROW_HEIGHT);
return ScreenSize(WW - 30, windowTileInspectorElementCount * kScrollableRowHeight);
}
void OnScrollMouseDown(int32_t scrollIndex, const ScreenCoordsXY& screenCoords) override
@ -1004,7 +1004,7 @@ static uint64_t PageDisabledWidgets[] = {
return;
// Because the list items are displayed in reverse order, subtract the calculated index from the amount of elements
const int16_t index = windowTileInspectorElementCount - (screenCoords.y - 1) / SCROLLABLE_ROW_HEIGHT - 1;
const int16_t index = windowTileInspectorElementCount - (screenCoords.y - 1) / kScrollableRowHeight - 1;
const ScreenRect checkboxColumnRect{ { 2, 0 }, { 15, screenCoords.y } };
if (index >= 0 && checkboxColumnRect.Contains(screenCoords))
{ // Checkbox was clicked
@ -1018,7 +1018,7 @@ static uint64_t PageDisabledWidgets[] = {
void OnScrollMouseOver(int32_t scrollIndex, const ScreenCoordsXY& screenCoords) override
{
int16_t index = windowTileInspectorElementCount - (screenCoords.y - 1) / SCROLLABLE_ROW_HEIGHT - 1;
int16_t index = windowTileInspectorElementCount - (screenCoords.y - 1) / kScrollableRowHeight - 1;
if (index < 0 || index >= windowTileInspectorElementCount)
_highlightedIndex = -1;
else
@ -1585,7 +1585,7 @@ static uint64_t PageDisabledWidgets[] = {
}
ScreenCoordsXY screenCoords{};
screenCoords.y = SCROLLABLE_ROW_HEIGHT * (windowTileInspectorElementCount - 1);
screenCoords.y = kScrollableRowHeight * (windowTileInspectorElementCount - 1);
int32_t i = 0;
char buffer[256];
@ -1602,7 +1602,7 @@ static uint64_t PageDisabledWidgets[] = {
// Draw row background colour
auto fillRectangle = ScreenRect{ { 0, screenCoords.y },
{ listWidth, screenCoords.y + SCROLLABLE_ROW_HEIGHT - 1 } };
{ listWidth, screenCoords.y + kScrollableRowHeight - 1 } };
if (selectedRow)
GfxFillRect(dpi, fillRectangle, ColourMapA[colours[1]].mid_dark);
else if (hoveredRow)
@ -1719,7 +1719,7 @@ static uint64_t PageDisabledWidgets[] = {
if (last)
DrawTextBasic(dpi, screenCoords + ScreenCoordsXY{ LastFlagColumnXY.x, 0 }, stringFormat, checkboxFormatter);
screenCoords.y -= SCROLLABLE_ROW_HEIGHT;
screenCoords.y -= kScrollableRowHeight;
i++;
} while (!(tileElement++)->IsLastForTile());
}

View File

@ -173,7 +173,7 @@ static Widget _trackListWidgets[] = {
maxItems++;
}
int32_t index = screenCoords.y / SCROLLABLE_ROW_HEIGHT;
int32_t index = screenCoords.y / kScrollableRowHeight;
if (index < 0 || static_cast<uint32_t>(index) >= maxItems)
{
index = -1;
@ -329,7 +329,7 @@ static Widget _trackListWidgets[] = {
// Extra item: custom design
numItems++;
}
int32_t scrollHeight = static_cast<int32_t>(numItems * SCROLLABLE_ROW_HEIGHT);
int32_t scrollHeight = static_cast<int32_t>(numItems * kScrollableRowHeight);
return { width, scrollHeight };
}
@ -520,7 +520,7 @@ static Widget _trackListWidgets[] = {
{
// Vehicle design not available
DrawTextEllipsised(dpi, screenPos, 368, STR_VEHICLE_DESIGN_UNAVAILABLE, {}, { TextAlignment::CENTRE });
screenPos.y -= SCROLLABLE_ROW_HEIGHT;
screenPos.y -= kScrollableRowHeight;
}
if (_loadedTrackDesign->track_flags & TRACK_DESIGN_FLAG_SCENERY_UNAVAILABLE)
@ -530,7 +530,7 @@ static Widget _trackListWidgets[] = {
// Scenery not available
DrawTextEllipsised(
dpi, screenPos, 368, STR_DESIGN_INCLUDES_SCENERY_WHICH_IS_UNAVAILABLE, {}, { TextAlignment::CENTRE });
screenPos.y -= SCROLLABLE_ROW_HEIGHT;
screenPos.y -= kScrollableRowHeight;
}
}
@ -697,7 +697,7 @@ static Widget _trackListWidgets[] = {
{
// Highlight
GfxFilterRect(
dpi, { screenCoords, { width, screenCoords.y + SCROLLABLE_ROW_HEIGHT - 1 } },
dpi, { screenCoords, { width, screenCoords.y + kScrollableRowHeight - 1 } },
FilterPaletteID::PaletteDarken1);
stringId = STR_WINDOW_COLOUR_2_STRINGID;
}
@ -709,20 +709,20 @@ static Widget _trackListWidgets[] = {
auto ft = Formatter();
ft.Add<StringId>(STR_BUILD_CUSTOM_DESIGN);
DrawTextBasic(dpi, screenCoords - ScreenCoordsXY{ 0, 1 }, stringId, ft);
screenCoords.y += SCROLLABLE_ROW_HEIGHT;
screenCoords.y += kScrollableRowHeight;
listIndex++;
}
for (auto i : _filteredTrackIds)
{
if (screenCoords.y + SCROLLABLE_ROW_HEIGHT >= dpi.y && screenCoords.y < dpi.y + dpi.height)
if (screenCoords.y + kScrollableRowHeight >= dpi.y && screenCoords.y < dpi.y + dpi.height)
{
StringId stringId;
if (listIndex == static_cast<size_t>(selected_list_item))
{
// Highlight
GfxFilterRect(
dpi, { screenCoords, { width, screenCoords.y + SCROLLABLE_ROW_HEIGHT - 1 } },
dpi, { screenCoords, { width, screenCoords.y + kScrollableRowHeight - 1 } },
FilterPaletteID::PaletteDarken1);
stringId = STR_WINDOW_COLOUR_2_STRINGID;
}
@ -738,7 +738,7 @@ static Widget _trackListWidgets[] = {
DrawTextBasic(dpi, screenCoords - ScreenCoordsXY{ 0, 1 }, stringId, ft);
}
screenCoords.y += SCROLLABLE_ROW_HEIGHT;
screenCoords.y += kScrollableRowHeight;
listIndex++;
}
}

View File

@ -84,4 +84,4 @@ struct NewVersionInfo
std::string url;
};
NewVersionInfo GetLatestVersion();
NewVersionInfo GetLatestVersion();

View File

@ -487,4 +487,4 @@ static void PrintLaunchInformation()
Console::WriteLine();
// TODO Print other potential information (e.g. user, hardware)
}
}

View File

@ -41,7 +41,7 @@ enum class CloseWindowModifier : uint8_t;
constexpr uint8_t CloseButtonWidth = 10;
#define SCROLLABLE_ROW_HEIGHT 12
constexpr uint8_t kScrollableRowHeight = 12;
constexpr uint8_t kListRowHeight = 12;
constexpr uint8_t kTableCellHeight = 12;
constexpr uint8_t kButtonFaceHeight = 12;

View File

@ -1,3 +1,4 @@
/*****************************************************************************
* Copyright (c) 2014-2024 OpenRCT2 developers
*

View File

@ -1625,19 +1625,12 @@ constexpr CoordsXY defaultRightQuarterTurn3TilesBoundLengths[4][3] = {
},
};
static constexpr int8_t right_quarter_turn_3_tiles_sprite_map[] = {
0,
-1,
1,
2,
};
void TrackPaintUtilRightQuarterTurn3TilesPaint(
PaintSession& session, int8_t thickness, int16_t height, Direction direction, uint8_t trackSequence,
const ImageId colourFlags, const uint32_t sprites[4][3], const CoordsXY offsets[4][3], const CoordsXY boundsLengths[4][3],
const CoordsXYZ boundsOffsets[4][3])
{
int32_t index = right_quarter_turn_3_tiles_sprite_map[trackSequence];
int32_t index = kRightQuarterTurn3TilesSpriteMap[trackSequence];
if (index < 0)
{
return;
@ -1665,7 +1658,7 @@ void TrackPaintUtilRightQuarterTurn3TilesPaint2WithHeightOffset(
PaintSession& session, int8_t thickness, int16_t height, Direction direction, uint8_t trackSequence,
const ImageId colourFlags, const uint32_t sprites[4][3], int32_t heightOffset)
{
int8_t sprite = right_quarter_turn_3_tiles_sprite_map[trackSequence];
int8_t sprite = kRightQuarterTurn3TilesSpriteMap[trackSequence];
if (sprite < 0)
{
return;
@ -1753,7 +1746,7 @@ void TrackPaintUtilRightQuarterTurn3TilesPaint3(
PaintSession& session, int16_t height, Direction direction, uint8_t trackSequence, const ImageId colourFlags,
const SpriteBb sprites[4][3])
{
int8_t sprite = right_quarter_turn_3_tiles_sprite_map[trackSequence];
int8_t sprite = kRightQuarterTurn3TilesSpriteMap[trackSequence];
if (sprite < 0)
{
return;
@ -1770,7 +1763,7 @@ void TrackPaintUtilRightQuarterTurn3TilesPaint4(
PaintSession& session, int16_t height, Direction direction, uint8_t trackSequence, const ImageId colourFlags,
const SpriteBb sprites[4][3])
{
int8_t sprite = right_quarter_turn_3_tiles_sprite_map[trackSequence];
int8_t sprite = kRightQuarterTurn3TilesSpriteMap[trackSequence];
if (sprite < 0)
{
return;

View File

@ -258,6 +258,8 @@ extern const CoordsXY defaultRightQuarterTurn3TilesOffsets[4][3];
extern const CoordsXYZ defaultRightQuarterTurn3TilesBoundOffsets[4][3];
extern const CoordsXY defaultRightQuarterTurn3TilesBoundLengths[4][3];
constexpr int8_t kRightQuarterTurn3TilesSpriteMap[] = { 0, -1, 1, 2 };
extern const CoordsXY defaultRightHelixUpSmallQuarterBoundLengths[4][3][2];
extern const CoordsXYZ defaultRightHelixUpSmallQuarterBoundOffsets[4][3][2];

View File

@ -1392,9 +1392,7 @@ static void PaintMiniatureRailwayTrackRightQuarterTurn3Tiles(
miniature_railway_right_quarter_turn_3_tile_track_floor, nullptr, defaultRightQuarterTurn3TilesBoundLengths,
miniature_railway_right_quarter_turn_3_tile_bound_offsets);
static constexpr int8_t _right_quarter_turn_3_tiles_sprite_map[] = { 0, -1, 1, 2 };
int32_t index = _right_quarter_turn_3_tiles_sprite_map[trackSequence];
int32_t index = kRightQuarterTurn3TilesSpriteMap[trackSequence];
auto imageId = session.TrackColours.WithIndex(
miniature_railway_track_pieces_flat_quarter_turn_3_tiles[direction][index]);