mirror of
https://github.com/OpenRCT2/OpenRCT2
synced 2026-01-18 04:23:20 +01:00
committed by
Michael Steenbeek
parent
c9cbe391eb
commit
1fcedae3bc
@@ -316,7 +316,7 @@ static void window_editor_bottom_toolbar_mouseup([[maybe_unused]] rct_window* w,
|
||||
if (widgetIndex == WIDX_PREVIOUS_STEP_BUTTON)
|
||||
{
|
||||
if ((gScreenFlags & SCREEN_FLAGS_TRACK_DESIGNER)
|
||||
|| (gSpriteListCount[SPRITE_LIST_NULL] == MAX_SPRITES && !(gParkFlags & PARK_FLAGS_SPRITES_INITIALISED)))
|
||||
|| (gSpriteListCount[SPRITE_LIST_FREE] == MAX_SPRITES && !(gParkFlags & PARK_FLAGS_SPRITES_INITIALISED)))
|
||||
{
|
||||
previous_button_mouseup_events[gS6Info.editor_step]();
|
||||
}
|
||||
@@ -376,7 +376,7 @@ void window_editor_bottom_toolbar_invalidate(rct_window* w)
|
||||
}
|
||||
else if (!(gScreenFlags & SCREEN_FLAGS_TRACK_DESIGNER))
|
||||
{
|
||||
if (gSpriteListCount[SPRITE_LIST_NULL] != MAX_SPRITES || gParkFlags & PARK_FLAGS_SPRITES_INITIALISED)
|
||||
if (gSpriteListCount[SPRITE_LIST_FREE] != MAX_SPRITES || gParkFlags & PARK_FLAGS_SPRITES_INITIALISED)
|
||||
{
|
||||
hide_previous_step_button();
|
||||
}
|
||||
@@ -401,7 +401,7 @@ void window_editor_bottom_toolbar_paint(rct_window* w, rct_drawpixelinfo* dpi)
|
||||
{
|
||||
drawPreviousButton = true;
|
||||
}
|
||||
else if (gSpriteListCount[SPRITE_LIST_NULL] != MAX_SPRITES)
|
||||
else if (gSpriteListCount[SPRITE_LIST_FREE] != MAX_SPRITES)
|
||||
{
|
||||
drawNextButton = true;
|
||||
}
|
||||
|
||||
@@ -111,7 +111,7 @@ private:
|
||||
return MakeResult(GA_ERROR::INVALID_PARAMETERS, STR_NONE);
|
||||
}
|
||||
|
||||
if (gSpriteListCount[SPRITE_LIST_NULL] < 400)
|
||||
if (gSpriteListCount[SPRITE_LIST_FREE] < 400)
|
||||
{
|
||||
return MakeResult(GA_ERROR::NO_FREE_ELEMENTS, STR_TOO_MANY_PEOPLE_IN_GAME);
|
||||
}
|
||||
|
||||
@@ -1710,7 +1710,7 @@ static constexpr const uint8_t tshirt_colours[] = {
|
||||
*/
|
||||
Peep* Peep::Generate(const CoordsXYZ coords)
|
||||
{
|
||||
if (gSpriteListCount[SPRITE_LIST_NULL] < 400)
|
||||
if (gSpriteListCount[SPRITE_LIST_FREE] < 400)
|
||||
return nullptr;
|
||||
|
||||
Peep* peep = (Peep*)create_sprite(1);
|
||||
|
||||
@@ -1072,7 +1072,7 @@ public:
|
||||
gSpriteListCount[i] = _s6.sprite_lists_count[i];
|
||||
}
|
||||
// This list contains the number of free slots. Increase it according to our own sprite limit.
|
||||
gSpriteListCount[SPRITE_LIST_NULL] += (MAX_SPRITES - RCT2_MAX_SPRITES);
|
||||
gSpriteListCount[SPRITE_LIST_FREE] += (MAX_SPRITES - RCT2_MAX_SPRITES);
|
||||
}
|
||||
|
||||
void ImportSprite(rct_sprite* dst, const RCT2Sprite* src)
|
||||
|
||||
@@ -4574,7 +4574,7 @@ static void ride_set_start_finish_points(ride_id_t rideIndex, CoordsXYE* startEl
|
||||
static int32_t count_free_misc_sprite_slots()
|
||||
{
|
||||
int32_t miscSpriteCount = gSpriteListCount[SPRITE_LIST_MISC];
|
||||
int32_t remainingSpriteCount = gSpriteListCount[SPRITE_LIST_NULL];
|
||||
int32_t remainingSpriteCount = gSpriteListCount[SPRITE_LIST_FREE];
|
||||
return std::max(0, miscSpriteCount + remainingSpriteCount - 300);
|
||||
}
|
||||
|
||||
|
||||
@@ -174,13 +174,13 @@ void reset_sprite_list()
|
||||
else
|
||||
{
|
||||
spr->generic.previous = SPRITE_INDEX_NULL;
|
||||
gSpriteListHead[SPRITE_LIST_NULL] = i;
|
||||
gSpriteListHead[SPRITE_LIST_FREE] = i;
|
||||
}
|
||||
_spriteFlashingList[i] = false;
|
||||
previous_spr = spr;
|
||||
}
|
||||
|
||||
gSpriteListCount[SPRITE_LIST_NULL] = MAX_SPRITES;
|
||||
gSpriteListCount[SPRITE_LIST_FREE] = MAX_SPRITES;
|
||||
|
||||
reset_sprite_spatial_index();
|
||||
}
|
||||
@@ -316,13 +316,13 @@ void sprite_clear_all_unused()
|
||||
rct_sprite_generic* sprite;
|
||||
uint16_t spriteIndex, nextSpriteIndex;
|
||||
|
||||
spriteIndex = gSpriteListHead[SPRITE_LIST_NULL];
|
||||
spriteIndex = gSpriteListHead[SPRITE_LIST_FREE];
|
||||
while (spriteIndex != SPRITE_INDEX_NULL)
|
||||
{
|
||||
sprite = &get_sprite(spriteIndex)->generic;
|
||||
nextSpriteIndex = sprite->next;
|
||||
sprite_reset(sprite);
|
||||
sprite->linked_list_type_offset = SPRITE_LIST_NULL * 2;
|
||||
sprite->linked_list_type_offset = SPRITE_LIST_FREE * 2;
|
||||
|
||||
// This shouldn't be necessary, as sprite_reset() preserves the index
|
||||
// but it has been left in as a safety net in case the index isn't set correctly
|
||||
@@ -351,18 +351,18 @@ rct_sprite* create_sprite(uint8_t bl)
|
||||
{
|
||||
// 69EC96;
|
||||
uint16_t cx = 0x12C - gSpriteListCount[SPRITE_LIST_MISC];
|
||||
if (cx >= gSpriteListCount[SPRITE_LIST_NULL])
|
||||
if (cx >= gSpriteListCount[SPRITE_LIST_FREE])
|
||||
{
|
||||
return nullptr;
|
||||
}
|
||||
linkedListTypeOffset = SPRITE_LIST_MISC;
|
||||
}
|
||||
else if (gSpriteListCount[SPRITE_LIST_NULL] == 0)
|
||||
else if (gSpriteListCount[SPRITE_LIST_FREE] == 0)
|
||||
{
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
rct_sprite_generic* sprite = &(get_sprite(gSpriteListHead[SPRITE_LIST_NULL]))->generic;
|
||||
rct_sprite_generic* sprite = &(get_sprite(gSpriteListHead[SPRITE_LIST_FREE]))->generic;
|
||||
|
||||
move_sprite_to_list((rct_sprite*)sprite, linkedListTypeOffset);
|
||||
|
||||
@@ -684,7 +684,7 @@ void sprite_remove(rct_sprite* sprite)
|
||||
user_string_free(peep->name_string_idx);
|
||||
}
|
||||
|
||||
move_sprite_to_list(sprite, SPRITE_LIST_NULL);
|
||||
move_sprite_to_list(sprite, SPRITE_LIST_FREE);
|
||||
sprite->generic.sprite_identifier = SPRITE_IDENTIFIER_NULL;
|
||||
_spriteFlashingList[sprite->generic.sprite_index] = false;
|
||||
|
||||
@@ -1029,7 +1029,7 @@ int32_t check_for_sprite_list_cycles(bool fix)
|
||||
}
|
||||
|
||||
/**
|
||||
* Finds and fixes null sprites that are not reachable via SPRITE_LIST_NULL list.
|
||||
* Finds and fixes null sprites that are not reachable via SPRITE_LIST_FREE list.
|
||||
*
|
||||
* @return count of disjoint sprites found
|
||||
*/
|
||||
@@ -1037,7 +1037,7 @@ int32_t fix_disjoint_sprites()
|
||||
{
|
||||
// Find reachable sprites
|
||||
bool reachable[MAX_SPRITES] = { false };
|
||||
uint16_t sprite_idx = gSpriteListHead[SPRITE_LIST_NULL];
|
||||
uint16_t sprite_idx = gSpriteListHead[SPRITE_LIST_FREE];
|
||||
rct_sprite* null_list_tail = nullptr;
|
||||
while (sprite_idx != SPRITE_INDEX_NULL)
|
||||
{
|
||||
|
||||
@@ -30,7 +30,7 @@ enum SPRITE_IDENTIFIER
|
||||
|
||||
enum SPRITE_LIST
|
||||
{
|
||||
SPRITE_LIST_NULL,
|
||||
SPRITE_LIST_FREE,
|
||||
SPRITE_LIST_TRAIN,
|
||||
SPRITE_LIST_PEEP,
|
||||
SPRITE_LIST_MISC,
|
||||
|
||||
Reference in New Issue
Block a user