mirror of https://github.com/OpenRCT2/OpenRCT2.git
Fix #4511: Crash, invalid scrolling mode for banner
Do not attempt to draw banners with an invalid scrolling mode. Some custom objects use 255 for scrolling mode as they don't actually have scrolling text.
This commit is contained in:
parent
ee896a481e
commit
b18d053a18
|
@ -122,6 +122,8 @@ typedef struct rct_palette {
|
|||
|
||||
#define PALETTE_TO_G1_OFFSET_COUNT 144
|
||||
|
||||
#define MAX_SCROLLING_TEXT_MODES 38
|
||||
|
||||
extern sint16 gCurrentFontSpriteBase;
|
||||
extern uint16 gCurrentFontFlags;
|
||||
|
||||
|
|
|
@ -1365,7 +1365,7 @@ static const sint16 _scrollpos37[] = {
|
|||
-1,
|
||||
};
|
||||
|
||||
static const sint16* _scrollPositions[38] = {
|
||||
static const sint16* _scrollPositions[MAX_SCROLLING_TEXT_MODES] = {
|
||||
_scrollpos0,
|
||||
_scrollpos1,
|
||||
_scrollpos2,
|
||||
|
@ -1416,6 +1416,8 @@ static const sint16* _scrollPositions[38] = {
|
|||
*/
|
||||
int scrolling_text_setup(rct_string_id stringId, uint16 scroll, uint16 scrollingMode)
|
||||
{
|
||||
assert(scrollingMode < MAX_SCROLLING_TEXT_MODES);
|
||||
|
||||
rct_drawpixelinfo* dpi = unk_140E9A8;
|
||||
|
||||
if (dpi->zoom_level != 0) return SPR_SCROLLING_TEXT_DEFAULT;
|
||||
|
|
|
@ -83,6 +83,10 @@ void banner_paint(uint8 direction, int height, rct_map_element* map_element)
|
|||
if (direction >= 2 || (map_element->flags & MAP_ELEMENT_FLAG_GHOST)) return;
|
||||
|
||||
uint16 scrollingMode = banner_scenery->banner.scrolling_mode;
|
||||
if (scrollingMode >= MAX_SCROLLING_TEXT_MODES) {
|
||||
return;
|
||||
}
|
||||
|
||||
scrollingMode += direction;
|
||||
|
||||
set_format_arg(0, uint32, 0);
|
||||
|
|
Loading…
Reference in New Issue