mirror of
https://github.com/OpenRCT2/OpenRCT2
synced 2026-01-18 12:33:17 +01:00
Minor refactor of banner and footpath enums
This commit is contained in:
@@ -291,7 +291,7 @@ static void editor_clear_map_for_editing(bool fromSave)
|
||||
//
|
||||
for (sint32 i = 0; i < MAX_BANNERS; i++) {
|
||||
if (gBanners[i].type == 255) {
|
||||
gBanners[i].flags &= ~BANNER_FLAG_2;
|
||||
gBanners[i].flags &= ~BANNER_FLAG_LINKED_TO_RIDE;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -361,7 +361,7 @@ void fence_paint(uint8 direction, sint32 height, rct_map_element * map_element)
|
||||
rct_banner * banner = &gBanners[bannerIndex];
|
||||
|
||||
set_format_arg(0, rct_string_id, banner->string_idx);
|
||||
if (banner->flags & BANNER_FLAG_2) {
|
||||
if (banner->flags & BANNER_FLAG_LINKED_TO_RIDE) {
|
||||
rct_ride * ride = get_ride(banner->colour);
|
||||
set_format_arg(0, rct_string_id, ride->name);
|
||||
set_format_arg(2, uint32, ride->name_arguments);
|
||||
|
||||
@@ -429,7 +429,7 @@ static void sub_6A4101(rct_map_element * map_element, uint16 height, uint32 ebp,
|
||||
|
||||
// save ecx, ebp, esi
|
||||
uint32 dword_F3EF80 = ebp;
|
||||
if (!(footpathEntry->flags & 2)) {
|
||||
if (!(footpathEntry->flags & FOOTPATH_ENTRY_FLAG_2)) {
|
||||
dword_F3EF80 &= 0x0F;
|
||||
}
|
||||
|
||||
@@ -842,7 +842,7 @@ void loc_6A37C9(rct_map_element * mapElement, sint32 height, rct_footpath_entry
|
||||
|
||||
sub_98197C(image_id | imageFlags, 0, 0, boundBoxSize.x, boundBoxSize.y, 0, height, boundBoxOffset.x, boundBoxOffset.y, height + 1, get_current_rotation());
|
||||
|
||||
if (!(mapElement->type & 1) && !(footpathEntry->flags & 2)) {
|
||||
if (!(mapElement->type & 1) && !(footpathEntry->flags & FOOTPATH_ENTRY_FLAG_2)) {
|
||||
// don't draw
|
||||
} else {
|
||||
sub_98199C(imageId | imageFlags, 0, 0, boundBoxSize.x, boundBoxSize.y, 0, height, boundBoxOffset.x, boundBoxOffset.y, height + 1, get_current_rotation());
|
||||
@@ -959,7 +959,7 @@ void loc_6A3B57(rct_map_element* mapElement, sint16 height, rct_footpath_entry*
|
||||
|
||||
sub_98197C(bridgeImage | imageFlags, 0, 0, boundBoxSize.x, boundBoxSize.y, 0, height, boundBoxOffset.x, boundBoxOffset.y, height + 1, get_current_rotation());
|
||||
|
||||
if ((mapElement->type & 1) || (footpathEntry->flags & 2)) {
|
||||
if ((mapElement->type & 1) || (footpathEntry->flags & FOOTPATH_ENTRY_FLAG_2)) {
|
||||
sub_98199C(imageId | imageFlags, 0, 0, boundBoxSize.x, boundBoxSize.y, 0, height, boundBoxOffset.x, boundBoxOffset.y, height + 1, get_current_rotation());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -257,7 +257,7 @@ void scenery_multiple_paint(uint8 direction, uint16 height, rct_map_element *map
|
||||
uint32 bannerIndex = (mapElement->type & 0xC0) | ((mapElement->properties.scenerymultiple.colour[0] & 0xE0) >> 2) | ((mapElement->properties.scenerymultiple.colour[1] & 0xE0) >> 5);
|
||||
rct_banner *banner = &gBanners[bannerIndex];
|
||||
rct_string_id stringId = banner->string_idx;
|
||||
if (banner->flags & BANNER_FLAG_2) {
|
||||
if (banner->flags & BANNER_FLAG_LINKED_TO_RIDE) {
|
||||
rct_ride * ride = get_ride(banner->colour);
|
||||
stringId = ride->name;
|
||||
set_format_arg(0, uint32, ride->name_arguments);
|
||||
@@ -347,7 +347,7 @@ void scenery_multiple_paint(uint8 direction, uint16 height, rct_map_element *map
|
||||
uint16 scrollMode = entry->large_scenery.var_11 + ((direction + 1) & 0x3);
|
||||
rct_banner *banner = &gBanners[bannerIndex];
|
||||
set_format_arg(0, rct_string_id, banner->string_idx);
|
||||
if (banner->flags & BANNER_FLAG_2) {
|
||||
if (banner->flags & BANNER_FLAG_LINKED_TO_RIDE) {
|
||||
rct_ride * ride = get_ride(banner->colour);
|
||||
set_format_arg(0, rct_string_id, ride->name);
|
||||
set_format_arg(2, uint32, ride->name_arguments);
|
||||
|
||||
@@ -6368,7 +6368,7 @@ void game_command_demolish_ride(sint32 *eax, sint32 *ebx, sint32 *ecx, sint32 *e
|
||||
|
||||
for(sint32 i = 0; i < MAX_BANNERS; i++){
|
||||
rct_banner *banner = &gBanners[i];
|
||||
if(banner->type != BANNER_NULL && banner->flags & BANNER_FLAG_2 && banner->colour == ride_id){
|
||||
if(banner->type != BANNER_NULL && banner->flags & BANNER_FLAG_LINKED_TO_RIDE && banner->colour == ride_id){
|
||||
banner->flags &= 0xFB;
|
||||
banner->string_idx = STR_DEFAULT_SIGN;
|
||||
}
|
||||
|
||||
@@ -639,7 +639,7 @@ static sint32 track_design_place_scenery(rct_td6_scenery_element *scenery_start,
|
||||
if (path == (rct_footpath_entry*)-1) {
|
||||
continue;
|
||||
}
|
||||
if (path->flags & (1 << 2)) {
|
||||
if (path->flags & FOOTPATH_ENTRY_FLAG_SHOW_ONLY_IN_SCENARIO_EDITOR) {
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -250,7 +250,7 @@ void window_footpath_open()
|
||||
|
||||
// If a restricted path was selected when the game is no longer in Sandbox mode, reset it
|
||||
rct_footpath_entry *pathEntry = get_footpath_entry(gFootpathSelectedId);
|
||||
if (pathEntry != (rct_footpath_entry*)-1 && (pathEntry->flags & 4) && !gCheatsSandboxMode) {
|
||||
if (pathEntry != (rct_footpath_entry*)-1 && (pathEntry->flags & FOOTPATH_ENTRY_FLAG_SHOW_ONLY_IN_SCENARIO_EDITOR) && !gCheatsSandboxMode) {
|
||||
pathEntry = (rct_footpath_entry*)-1;
|
||||
}
|
||||
|
||||
@@ -397,7 +397,7 @@ static void window_footpath_dropdown(rct_window *w, sint32 widgetIndex, sint32 d
|
||||
if (pathType->flags & flags)
|
||||
continue;
|
||||
// Skip queue lines of scenario editor-only paths (only applicable when the game is in sandbox mode)
|
||||
if(widgetIndex == WIDX_QUEUELINE_TYPE && (pathType->flags & 4))
|
||||
if(widgetIndex == WIDX_QUEUELINE_TYPE && (pathType->flags & FOOTPATH_ENTRY_FLAG_SHOW_ONLY_IN_SCENARIO_EDITOR))
|
||||
continue;
|
||||
|
||||
if (j == pathId)
|
||||
@@ -568,7 +568,7 @@ static void window_footpath_invalidate(rct_window *w)
|
||||
window_footpath_widgets[WIDX_FOOTPATH_TYPE].image = pathImage;
|
||||
|
||||
// Disable queue line button when the path is scenario editor-only (and therefore usually shouldn't have one)
|
||||
if(!(pathType->flags & 4)) {
|
||||
if(!(pathType->flags & FOOTPATH_ENTRY_FLAG_SHOW_ONLY_IN_SCENARIO_EDITOR)) {
|
||||
window_footpath_widgets[WIDX_QUEUELINE_TYPE].image = pathImage + 1;
|
||||
window_footpath_widgets[WIDX_QUEUELINE_TYPE].type = WWT_FLATBTN;
|
||||
} else {
|
||||
@@ -1150,7 +1150,7 @@ static void footpath_select_default()
|
||||
gFootpathSelectedId = i;
|
||||
|
||||
// Prioritise non-restricted path
|
||||
if (!(pathEntry->flags & 4)) {
|
||||
if (!(pathEntry->flags & FOOTPATH_ENTRY_FLAG_SHOW_ONLY_IN_SCENARIO_EDITOR)) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -252,7 +252,7 @@ static void window_sign_mouseup(rct_window *w, sint32 widgetIndex)
|
||||
0);
|
||||
break;
|
||||
case WIDX_SIGN_TEXT:
|
||||
if (banner->flags&BANNER_FLAG_2){
|
||||
if (banner->flags & BANNER_FLAG_LINKED_TO_RIDE){
|
||||
rct_ride* ride = get_ride(banner->colour);
|
||||
set_format_arg(16, uint32, ride->name_arguments);
|
||||
string_id = ride->name;
|
||||
@@ -516,7 +516,7 @@ static void window_sign_small_mouseup(rct_window *w, sint32 widgetIndex)
|
||||
0);
|
||||
break;
|
||||
case WIDX_SIGN_TEXT:
|
||||
if (banner->flags&BANNER_FLAG_2){
|
||||
if (banner->flags & BANNER_FLAG_LINKED_TO_RIDE){
|
||||
rct_ride* ride = get_ride(banner->colour);
|
||||
set_format_arg(16, uint32, ride->name_arguments);
|
||||
string_id = ride->name;
|
||||
|
||||
@@ -38,8 +38,8 @@ assert_struct_size(rct_banner, 8);
|
||||
|
||||
enum{
|
||||
BANNER_FLAG_NO_ENTRY = (1 << 0),
|
||||
BANNER_FLAG_1 = (1 << 1),
|
||||
BANNER_FLAG_2 = (1 << 2)
|
||||
BANNER_FLAG_IS_LARGE_SCENERY = (1 << 1),
|
||||
BANNER_FLAG_LINKED_TO_RIDE = (1 << 2)
|
||||
};
|
||||
|
||||
extern rct_banner gBanners[MAX_BANNERS];
|
||||
|
||||
@@ -41,6 +41,7 @@ assert_struct_size(rct_footpath_entry, 13);
|
||||
|
||||
enum {
|
||||
FOOTPATH_ENTRY_FLAG_1 = (1 << 0),
|
||||
FOOTPATH_ENTRY_FLAG_2 = (1 << 1),
|
||||
FOOTPATH_ENTRY_FLAG_SHOW_ONLY_IN_SCENARIO_EDITOR = (1 << 2),
|
||||
};
|
||||
|
||||
|
||||
@@ -3635,7 +3635,7 @@ void game_command_place_fence(sint32* eax, sint32* ebx, sint32* ecx, sint32* edx
|
||||
sint32 rideIndex = banner_get_closest_ride_index(position.x, position.y, position.z);
|
||||
if (rideIndex != -1) {
|
||||
banner->colour = rideIndex & 0xFF;
|
||||
banner->flags |= BANNER_FLAG_2;
|
||||
banner->flags |= BANNER_FLAG_LINKED_TO_RIDE;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -3782,7 +3782,7 @@ void game_command_place_large_scenery(sint32* eax, sint32* ebx, sint32* ecx, sin
|
||||
|
||||
if (flags & GAME_COMMAND_FLAG_APPLY) {
|
||||
rct_banner* banner = &gBanners[banner_id];
|
||||
banner->flags |= BANNER_FLAG_1;
|
||||
banner->flags |= BANNER_FLAG_IS_LARGE_SCENERY;
|
||||
banner->type = 0;
|
||||
banner->x = x / 32;
|
||||
banner->y = y / 32;
|
||||
@@ -3790,7 +3790,7 @@ void game_command_place_large_scenery(sint32* eax, sint32* ebx, sint32* ecx, sin
|
||||
sint32 rideIndex = banner_get_closest_ride_index(x, y, z);
|
||||
if (rideIndex != -1) {
|
||||
banner->colour = rideIndex;
|
||||
banner->flags |= BANNER_FLAG_2;
|
||||
banner->flags |= BANNER_FLAG_LINKED_TO_RIDE;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -5418,7 +5418,7 @@ void game_command_set_sign_name(sint32* eax, sint32* ebx, sint32* ecx, sint32* e
|
||||
banner->string_idx = string_id;
|
||||
user_string_free(prev_string_id);
|
||||
|
||||
banner->flags &= ~(BANNER_FLAG_2);
|
||||
banner->flags &= ~(BANNER_FLAG_LINKED_TO_RIDE);
|
||||
gfx_invalidate_screen();
|
||||
} else {
|
||||
gGameCommandErrorText = STR_ERR_CANT_SET_BANNER_TEXT;
|
||||
@@ -5434,7 +5434,7 @@ void game_command_set_sign_name(sint32* eax, sint32* ebx, sint32* ecx, sint32* e
|
||||
}
|
||||
|
||||
banner->colour = rideIndex;
|
||||
banner->flags |= BANNER_FLAG_2;
|
||||
banner->flags |= BANNER_FLAG_LINKED_TO_RIDE;
|
||||
|
||||
rct_string_id prev_string_id = banner->string_idx;
|
||||
banner->string_idx = STR_DEFAULT_SIGN;
|
||||
|
||||
Reference in New Issue
Block a user