mirror of https://github.com/OpenRCT2/OpenRCT2.git
Add ScrollingText.h
This commit is contained in:
parent
9d473bbfbe
commit
7dfe0b02a6
|
@ -18,6 +18,7 @@
|
|||
#include "../ui/UiContext.h"
|
||||
#include "../util/Util.h"
|
||||
#include "Drawing.h"
|
||||
#include "ScrollingText.h"
|
||||
|
||||
#include <algorithm>
|
||||
#include <memory>
|
||||
|
@ -180,7 +181,7 @@ void mask_scalar(
|
|||
static rct_gx _g1 = {};
|
||||
static rct_gx _g2 = {};
|
||||
static rct_gx _csg = {};
|
||||
static rct_g1_element _scrollingText[256]{};
|
||||
static rct_g1_element _scrollingText[MaxScrollingTextEntries]{};
|
||||
static bool _csgLoaded = false;
|
||||
|
||||
static rct_g1_element _g1Temp = {};
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/*****************************************************************************
|
||||
/*****************************************************************************
|
||||
* Copyright (c) 2014-2020 OpenRCT2 developers
|
||||
*
|
||||
* For a complete list of all authors, please refer to contributors.md
|
||||
|
@ -7,6 +7,8 @@
|
|||
* OpenRCT2 is licensed under the GNU General Public License version 3.
|
||||
*****************************************************************************/
|
||||
|
||||
#include "ScrollingText.h"
|
||||
|
||||
#include "../config/Config.h"
|
||||
#include "../core/String.hpp"
|
||||
#include "../interface/Colour.h"
|
||||
|
@ -34,9 +36,7 @@ struct rct_draw_scroll_text
|
|||
uint8_t bitmap[64 * 40];
|
||||
};
|
||||
|
||||
constexpr int32_t MAX_SCROLLING_TEXT_ENTRIES = SPR_SCROLLING_TEXT_END - SPR_SCROLLING_TEXT_START;
|
||||
|
||||
static rct_draw_scroll_text _drawScrollTextList[MAX_SCROLLING_TEXT_ENTRIES];
|
||||
static rct_draw_scroll_text _drawScrollTextList[OpenRCT2::MaxScrollingTextEntries];
|
||||
static uint8_t _characterBitmaps[FONT_SPRITE_GLYPH_COUNT + SPR_G2_GLYPH_COUNT][8];
|
||||
static uint32_t _drawSCrollNextIndex = 0;
|
||||
static std::mutex _scrollingTextMutex;
|
||||
|
@ -97,7 +97,7 @@ void scrolling_text_initialise_bitmaps()
|
|||
}
|
||||
}
|
||||
|
||||
for (int32_t i = 0; i < MAX_SCROLLING_TEXT_ENTRIES; i++)
|
||||
for (int32_t i = 0; i < OpenRCT2::MaxScrollingTextEntries; i++)
|
||||
{
|
||||
const int32_t imageIdReference = SPR_SCROLLING_TEXT_LEGACY_START;
|
||||
const int32_t imageId = SPR_SCROLLING_TEXT_START + i;
|
||||
|
@ -137,7 +137,7 @@ static int32_t scrolling_text_get_matching_or_oldest(
|
|||
{
|
||||
uint32_t oldestId = 0xFFFFFFFF;
|
||||
int32_t scrollIndex = -1;
|
||||
for (int32_t i = 0; i < MAX_SCROLLING_TEXT_ENTRIES; i++)
|
||||
for (int32_t i = 0; i < std::size(_drawScrollTextList); i++)
|
||||
{
|
||||
rct_draw_scroll_text* scrollText = &_drawScrollTextList[i];
|
||||
if (oldestId >= scrollText->id)
|
||||
|
@ -1438,9 +1438,8 @@ static constexpr const int16_t* _scrollPositions[MAX_SCROLLING_TEXT_MODES] = {
|
|||
|
||||
void scrolling_text_invalidate()
|
||||
{
|
||||
for (int32_t i = 0; i < MAX_SCROLLING_TEXT_ENTRIES; i++)
|
||||
for (auto& scrollText : _drawScrollTextList)
|
||||
{
|
||||
rct_draw_scroll_text& scrollText = _drawScrollTextList[i];
|
||||
scrollText.string_id = 0;
|
||||
std::memset(scrollText.string_args, 0, sizeof(scrollText.string_args));
|
||||
}
|
||||
|
|
|
@ -0,0 +1,8 @@
|
|||
#pragma once
|
||||
|
||||
namespace OpenRCT2
|
||||
{
|
||||
static auto constexpr MaxScrollingTextLegacyEntries = 32;
|
||||
static auto constexpr MaxScrollingTextEntries = 256;
|
||||
|
||||
} // namespace OpenRCT2
|
|
@ -190,6 +190,7 @@
|
|||
<ClInclude Include="drawing\ImageImporter.h" />
|
||||
<ClInclude Include="drawing\LightFX.h" />
|
||||
<ClInclude Include="drawing\NewDrawing.h" />
|
||||
<ClInclude Include="drawing\ScrollingText.h" />
|
||||
<ClInclude Include="drawing\Weather.h" />
|
||||
<ClInclude Include="drawing\Text.h" />
|
||||
<ClInclude Include="drawing\TTF.h" />
|
||||
|
|
|
@ -10,6 +10,7 @@
|
|||
#ifndef _SPRITES_H_
|
||||
#define _SPRITES_H_
|
||||
|
||||
#include "drawing/ScrollingText.h"
|
||||
#include "rct1/RCT1.h"
|
||||
|
||||
enum
|
||||
|
@ -20,7 +21,7 @@ enum
|
|||
SPR_TEMP = 0x7FFFE,
|
||||
|
||||
SPR_SCROLLING_TEXT_LEGACY_START = 1542,
|
||||
SPR_SCROLLING_TEXT_LEGACY_END = SPR_SCROLLING_TEXT_LEGACY_START + 32,
|
||||
SPR_SCROLLING_TEXT_LEGACY_END = SPR_SCROLLING_TEXT_LEGACY_START + OpenRCT2::MaxScrollingTextLegacyEntries,
|
||||
SPR_SCROLLING_TEXT_DEFAULT = 1574,
|
||||
|
||||
SPR_EDGE_ROCK_BASE = 1579,
|
||||
|
@ -1038,7 +1039,7 @@ enum
|
|||
SPR_CSG_END = SPR_CSG_BEGIN + RCT1_NUM_LL_CSG_ENTRIES,
|
||||
|
||||
SPR_SCROLLING_TEXT_START = SPR_CSG_END,
|
||||
SPR_SCROLLING_TEXT_END = SPR_SCROLLING_TEXT_START + 256,
|
||||
SPR_SCROLLING_TEXT_END = SPR_SCROLLING_TEXT_START + OpenRCT2::MaxScrollingTextEntries,
|
||||
|
||||
SPR_IMAGE_LIST_BEGIN = SPR_SCROLLING_TEXT_END,
|
||||
SPR_IMAGE_LIST_END = 0x7FFFE
|
||||
|
|
Loading…
Reference in New Issue