Use flags where known. Refactor large 3d signs slightly

This commit is contained in:
duncanspumpkin committed 2017-02-04 08:12:44 +00:00
1 parent afc8943e34
commit fef7445f0c
19 files changed
+60 -46

No files matched your search

+3 -3
View File
@@ -1085,7 +1085,7 @@ void process_mouse_over(sint32 x, sint32 y)
case WWT_FRAME:
case WWT_RESIZE:
if (!(window->flags & 0x100))
if (!(window->flags & WF_RESIZABLE))
break;
if (window->min_width == window->max_width && window->min_height == window->max_height)
@@ -1605,7 +1605,7 @@ void game_handle_edge_scroll()
mainWindow = window_get_main();
if (mainWindow == NULL)
return;
if ((mainWindow->flags & WF_NO_SCROLLING) || (gScreenFlags & 9))
if ((mainWindow->flags & WF_NO_SCROLLING) || (gScreenFlags & (SCREEN_FLAGS_TRACK_MANAGER | SCREEN_FLAGS_TITLE_DEMO)))
return;
if (mainWindow->viewport == NULL)
return;
@@ -1648,7 +1648,7 @@ void game_handle_key_scroll()
mainWindow = window_get_main();
if (mainWindow == NULL)
return;
if ((mainWindow->flags & WF_NO_SCROLLING) || (gScreenFlags & 9))
if ((mainWindow->flags & WF_NO_SCROLLING) || (gScreenFlags & (SCREEN_FLAGS_TRACK_MANAGER | SCREEN_FLAGS_TITLE_DEMO)))
return;
if (mainWindow->viewport == NULL)
return;
@@ -304,7 +304,7 @@ sint32 viewport_interaction_get_item_right(sint32 x, sint32 y, viewport_interact
case VIEWPORT_INTERACTION_ITEM_FOOTPATH_ITEM:
sceneryEntry = get_footpath_item_entry(footpath_element_get_path_scenery_index(mapElement));
set_map_tooltip_format_arg(0, rct_string_id, STR_MAP_TOOLTIP_STRINGID_CLICK_TO_REMOVE);
if (mapElement->flags & 0x20) {
if (mapElement->flags & MAP_ELEMENT_FLAG_BROKEN) {
set_map_tooltip_format_arg(2, rct_string_id, STR_BROKEN);
set_map_tooltip_format_arg(4, rct_string_id, sceneryEntry->name);
} else {
+3 -3
View File
@@ -240,7 +240,7 @@ static sint32 window_wheel_input(rct_window *w, sint32 wheel)
*/
static void window_viewport_wheel_input(rct_window *w, sint32 wheel)
{
if (gScreenFlags & 9)
if (gScreenFlags & (SCREEN_FLAGS_TRACK_MANAGER | SCREEN_FLAGS_TITLE_DEMO))
return;
if (wheel < 0)
@@ -807,7 +807,7 @@ void window_close_top()
window_close_by_class(WC_DROPDOWN);
if (gScreenFlags & 2)
if (gScreenFlags & SCREEN_FLAGS_SCENARIO_EDITOR)
if (gS6Info.editor_step != EDITOR_STEP_LANDSCAPE_EDITOR)
return;
@@ -2115,7 +2115,7 @@ void window_relocate_windows(sint32 width, sint32 height){
*/
void window_resize_gui(sint32 width, sint32 height)
{
if (gScreenFlags & 0xE){
if (gScreenFlags & (SCREEN_FLAGS_SCENARIO_EDITOR | SCREEN_FLAGS_TRACK_DESIGNER | SCREEN_FLAGS_TRACK_MANAGER)){
window_resize_gui_scenario_editor(width, height);
return;
}
+5 -5
View File
@@ -47,7 +47,7 @@ void LargeSceneryObject::ReadLegacy(IReadObjectContext * context, IStream * stre
rct_object_entry sgEntry = stream->ReadValue<rct_object_entry>();
SetPrimarySceneryGroup(&sgEntry);
if (_legacyType.large_scenery.flags & (1 << 2))
if (_legacyType.large_scenery.flags & LARGE_SCENERY_FLAG_3D_TEXT)
{
_3dFont = Memory::Allocate<rct_large_scenery_text>();
stream->Read(_3dFont);
@@ -83,16 +83,16 @@ void LargeSceneryObject::Load()
_legacyType.large_scenery.tiles = _tiles;
if (_legacyType.large_scenery.flags & (1 << 2))
if (_legacyType.large_scenery.flags & LARGE_SCENERY_FLAG_3D_TEXT)
{
_legacyType.large_scenery.text_image = _legacyType.image;
if (_3dFont->var_C & (1 << 0))
if (_3dFont->flags & LARGE_SCENERY_TEXT_FLAG_VERTICAL)
{
_legacyType.image += (_3dFont->var_C >> 8) * 2;
_legacyType.image += _3dFont->var_D * 2;
}
else
{
_legacyType.image += (_3dFont->var_C >> 8) * 4;
_legacyType.image += _3dFont->var_D * 4;
}
}
}
@@ -115,7 +115,7 @@ static void scenery_multiple_sign_paint_line(const utf8 *str, rct_large_scenery_
sint32 width = scenery_multiple_sign_text_width(fitStr, text);
sint32 x_offset = text->offset[(direction & 1)].x;
sint32 acc = y_offset * ((direction & 1) ? -1 : 1);
if (!(text->var_C & 0x1)) {
if (!(text->flags & LARGE_SCENERY_TEXT_FLAG_VERTICAL)) {
// sign is horizontal, center text:
x_offset -= (width / 2);
acc -= (width / 2);
@@ -124,7 +124,7 @@ static void scenery_multiple_sign_paint_line(const utf8 *str, rct_large_scenery_
while ((codepoint = utf8_get_next(fitStr, &fitStr)) != 0) {
sint32 glyph_offset = scenery_multiple_sign_get_glyph(text, codepoint)->image_offset;
uint8 glyph_type = direction & 1;
if (text->var_C & 0x1) { // vertical sign
if (text->flags & LARGE_SCENERY_TEXT_FLAG_VERTICAL) { // vertical sign
glyph_offset *= 2;
} else {
glyph_offset *= 4;
@@ -143,7 +143,7 @@ static void scenery_multiple_sign_paint_line(const utf8 *str, rct_large_scenery_
if (direction == 3) {
paint_attach_to_previous_ps(image_id, x_offset, -div_to_minus_infinity(acc, 2));
} else {
if (text->var_C & 0x1) {
if (text->flags & LARGE_SCENERY_TEXT_FLAG_VERTICAL) {
paint_attach_to_previous_ps(image_id, x_offset, div_to_minus_infinity(acc, 2));
} else {
paint_attach_to_previous_attach(image_id, x_offset, div_to_minus_infinity(acc, 2));
@@ -232,7 +232,7 @@ void scenery_multiple_paint(uint8 direction, uint16 height, rct_map_element *map
scenery_multiple_paint_supports(direction, height, mapElement, dword_F4387C, tile);
return;
}
if (entry->large_scenery.flags & 0x4) {
if (entry->large_scenery.flags & LARGE_SCENERY_FLAG_3D_TEXT) {
if (entry->large_scenery.tiles[1].x_offset != (sint16)(uint16)0xFFFF) {
sint32 al = ((mapElement->properties.surface.terrain >> 2) - 1) & 3;
if (al != direction) {
@@ -266,7 +266,7 @@ void scenery_multiple_paint(uint8 direction, uint16 height, rct_map_element *map
format_string(signString, MAX_PATH, stringId, gCommonFormatArgs);
rct_large_scenery_text *text = entry->large_scenery.text;
sint32 y_offset = (text->offset[(direction & 1)].y * 2);
if (text->var_C & 0x1) {
if (text->flags & LARGE_SCENERY_TEXT_FLAG_VERTICAL) {
// Draw vertical sign:
y_offset += 1;
utf8 fitStr[32];
@@ -282,7 +282,7 @@ void scenery_multiple_paint(uint8 direction, uint16 height, rct_map_element *map
}
} else {
y_offset -= (direction & 1);
if (text->var_C & 0x2) {
if (text->flags & LARGE_SCENERY_TEXT_FLAG_TWO_LINE) {
// Draw two-line sign:
sint32 width = scenery_multiple_sign_text_width(signString, text);
if (width > text->max_width) {
+1 -1
View File
@@ -1076,7 +1076,7 @@ void surface_paint(uint8 direction, uint16 height, rct_map_element * mapElement)
if ((mapElement->properties.surface.terrain & 0xE0) == 0) {
if ((mapElement->type & 0x3) == 0) {
if (zoomLevel == 0) {
if ((gCurrentViewportFlags & 0x1001) == 0) {
if ((gCurrentViewportFlags & (VIEWPORT_FLAG_HIDE_BASE | VIEWPORT_FLAG_UNDERGROUND_INSIDE)) == 0) {
branch = mapElement->properties.surface.grass_length & 0x7;
}
}
+5 -5
View File
@@ -528,7 +528,7 @@ void peep_update_all()
uint16 spriteIndex;
rct_peep* peep;
if (gScreenFlags & 0x0E)
if (gScreenFlags & (SCREEN_FLAGS_SCENARIO_EDITOR | SCREEN_FLAGS_TRACK_DESIGNER | SCREEN_FLAGS_TRACK_MANAGER))
return;
spriteIndex = gSpriteListHead[SPRITE_LIST_PEEP];
@@ -6903,7 +6903,7 @@ void peep_update_crowd_noise()
if (!gConfigSound.sound_enabled)
return;
if (gScreenFlags & 2)
if (gScreenFlags & SCREEN_FLAGS_SCENARIO_EDITOR)
return;
viewport = g_music_tracking_viewport;
@@ -11308,7 +11308,7 @@ static bool peep_find_ride_to_look_at(rct_peep *peep, uint8 edge, uint8 *rideToV
}
if (map_element_get_type(mapElement) == MAP_ELEMENT_TYPE_SCENERY_MULTIPLE) {
if (!(get_large_scenery_entry(mapElement->properties.scenerymultiple.type & 0x3FF)->large_scenery.flags & 0x10)) {
if (!(get_large_scenery_entry(mapElement->properties.scenerymultiple.type & 0x3FF)->large_scenery.flags & LARGE_SCENERY_FLAG5)) {
continue;
}
@@ -11377,7 +11377,7 @@ static bool peep_find_ride_to_look_at(rct_peep *peep, uint8 edge, uint8 *rideToV
}
if (map_element_get_type(mapElement) == MAP_ELEMENT_TYPE_SCENERY_MULTIPLE) {
if (!(get_large_scenery_entry(mapElement->properties.scenerymultiple.type & 0x3FF)->large_scenery.flags & 0x10)) {
if (!(get_large_scenery_entry(mapElement->properties.scenerymultiple.type & 0x3FF)->large_scenery.flags & LARGE_SCENERY_FLAG5)) {
continue;
}
@@ -11445,7 +11445,7 @@ static bool peep_find_ride_to_look_at(rct_peep *peep, uint8 edge, uint8 *rideToV
}
if (map_element_get_type(mapElement) == MAP_ELEMENT_TYPE_SCENERY_MULTIPLE) {
if (!(get_large_scenery_entry(mapElement->properties.scenerymultiple.type & 0x3FF)->large_scenery.flags & 0x10)) {
if (!(get_large_scenery_entry(mapElement->properties.scenerymultiple.type & 0x3FF)->large_scenery.flags & LARGE_SCENERY_FLAG5)) {
continue;
}
+2 -2
View File
@@ -3655,9 +3655,9 @@ void ride_music_update_final()
{
rct_ride_music_params* edi = NULL;
sint32 ebx = 0;
if (!(gScreenFlags & 2)) {
if (!(gScreenFlags & SCREEN_FLAGS_SCENARIO_EDITOR)) {
// TODO Allow circus music (CSS24) to play if ride music is disabled (that should be sound)
if (!gGameSoundsOff && gConfigSound.ride_music_enabled && !(gScreenFlags & 1)) {
if (!gGameSoundsOff && gConfigSound.ride_music_enabled && !(gScreenFlags & SCREEN_FLAGS_TITLE_DEMO)) {
while (1) {
sint32 v8 = 0;
sint32 v9 = 1;
+2 -2
View File
@@ -6854,7 +6854,7 @@ static void vehicle_update_scenery_door(rct_vehicle *vehicle)
if (vehicle->next_vehicle_on_train != SPRITE_INDEX_NULL) {
mapElement->properties.fence.item[2] &= 7;
mapElement->properties.fence.item[2] |= 8;
map_animation_create(MAP_ANIMATION_TYPE_WALL_UNKNOWN, x, y, z);
map_animation_create(MAP_ANIMATION_TYPE_WALL_DOOR, x, y, z);
vehicle_play_scenery_door_open_sound(vehicle, mapElement);
} else {
mapElement->properties.fence.item[2] &= 7;
@@ -6937,7 +6937,7 @@ static void sub_6DEDE8(rct_vehicle *vehicle)
if (vehicle->next_vehicle_on_train != SPRITE_INDEX_NULL) {
mapElement->properties.fence.item[2] &= 7;
mapElement->properties.fence.item[2] |= 0x88;
map_animation_create(MAP_ANIMATION_TYPE_WALL_UNKNOWN, x, y, z);
map_animation_create(MAP_ANIMATION_TYPE_WALL_DOOR, x, y, z);
vehicle_play_scenery_door_open_sound(vehicle, mapElement);
} else {
mapElement->properties.fence.item[2] &= 7;
+2 -2
View File
@@ -190,9 +190,9 @@ void window_save_prompt_open()
window_invalidate_by_class(WC_TOP_TOOLBAR);
stringId = window_save_prompt_labels[prompt_mode][0];
if (stringId == STR_LOAD_GAME_PROMPT_TITLE && gScreenFlags & 2)
if (stringId == STR_LOAD_GAME_PROMPT_TITLE && gScreenFlags & SCREEN_FLAGS_SCENARIO_EDITOR)
stringId = STR_LOAD_LANDSCAPE_PROMPT_TITLE;
if (stringId == STR_QUIT_GAME_PROMPT_TITLE && gScreenFlags & 2)
if (stringId == STR_QUIT_GAME_PROMPT_TITLE && gScreenFlags & SCREEN_FLAGS_SCENARIO_EDITOR)
stringId = STR_QUIT_SCENARIO_EDITOR;
window_save_prompt_widgets[WIDX_TITLE].text = stringId;
window_save_prompt_widgets[WIDX_LABEL].text = window_save_prompt_labels[prompt_mode][1];
+2 -2
View File
@@ -963,9 +963,9 @@ void window_scenery_invalidate(rct_window *w)
} else if (tabSelectedSceneryId >= 0x300) {
sceneryEntry = get_large_scenery_entry(tabSelectedSceneryId - 0x300);
if (sceneryEntry->large_scenery.flags & 1)
if (sceneryEntry->large_scenery.flags & LARGE_SCENERY_FLAG_HAS_PRIMARY_COLOUR)
window_scenery_widgets[WIDX_SCENERY_PRIMARY_COLOUR_BUTTON].type = WWT_COLOURBTN;
if (sceneryEntry->large_scenery.flags & 2)
if (sceneryEntry->large_scenery.flags & LARGE_SCENERY_FLAG_HAS_SECONDARY_COLOUR)
window_scenery_widgets[WIDX_SCENERY_SECONDARY_COLOUR_BUTTON].type = WWT_COLOURBTN;
} else if (tabSelectedSceneryId >= 0x200) {
sceneryEntry = get_wall_entry(tabSelectedSceneryId - 0x200);
+2 -2
View File
@@ -335,10 +335,10 @@ static void window_sign_invalidate(rct_window *w)
main_colour_btn->type = WWT_EMPTY;
text_colour_btn->type = WWT_EMPTY;
if (scenery_entry->large_scenery.flags&(1 << 0)){
if (scenery_entry->large_scenery.flags & LARGE_SCENERY_FLAG_HAS_PRIMARY_COLOUR){
main_colour_btn->type = WWT_COLOURBTN;
}
if (scenery_entry->large_scenery.flags&(1 << 1)) {
if (scenery_entry->large_scenery.flags & LARGE_SCENERY_FLAG_HAS_SECONDARY_COLOUR) {
text_colour_btn->type = WWT_COLOURBTN;
}
+3 -3
View File
@@ -961,7 +961,7 @@ static void repaint_scenery_tool_down(sint16 x, sint16 y, sint16 widgetIndex){
// If can't repaint
if (!(scenery_entry->large_scenery.flags &
(1 << 0)))
LARGE_SCENERY_FLAG_HAS_PRIMARY_COLOUR))
return;
gGameCommandErrorTitle = STR_CANT_REPAINT_THIS;
@@ -2032,8 +2032,8 @@ static void top_toolbar_tool_update_water(sint16 x, sint16 y){
state_changed++;
}
if (gMapSelectType != MAP_SELECT_TYPE_5) {
gMapSelectType = MAP_SELECT_TYPE_5;
if (gMapSelectType != MAP_SELECT_TYPE_FULL_WATER) {
gMapSelectType = MAP_SELECT_TYPE_FULL_WATER;
state_changed++;
}
+2 -2
View File
@@ -220,10 +220,10 @@ static money32 footpath_element_insert(sint32 type, sint32 x, sint32 y, sint32 z
footpath_queue_chain_reset();
if (!(flags & (1 << 7)))
if (!(flags & GAME_COMMAND_FLAG_7))
footpath_remove_edges_at(x, y, mapElement);
if ((gScreenFlags & SCREEN_FLAGS_SCENARIO_EDITOR) && !(flags & (1 << 6)))
if ((gScreenFlags & SCREEN_FLAGS_SCENARIO_EDITOR) && !(flags & GAME_COMMAND_FLAG_GHOST))
automatically_set_peep_spawn(x, y, mapElement->base_height / 2);
loc_6A6620(flags, x, y, mapElement);
+1 -1
View File
@@ -320,7 +320,7 @@ enum {
MAP_SELECT_TYPE_CORNER_2,
MAP_SELECT_TYPE_CORNER_3,
MAP_SELECT_TYPE_FULL,
MAP_SELECT_TYPE_5,
MAP_SELECT_TYPE_FULL_WATER,
MAP_SELECT_TYPE_QUARTER_0,
MAP_SELECT_TYPE_QUARTER_1,
MAP_SELECT_TYPE_QUARTER_2,
+2 -2
View File
@@ -184,7 +184,7 @@ static bool map_animation_invalidate_small_scenery(sint32 x, sint32 y, sint32 ba
continue;
sceneryEntry = get_small_scenery_entry(mapElement->properties.scenery.type);
if (sceneryEntry->small_scenery.flags & 0xD800) {
if (sceneryEntry->small_scenery.flags & (SMALL_SCENERY_FLAG12 | SMALL_SCENERY_FLAG13 | SMALL_SCENERY_FLAG15 | SMALL_SCENERY_FLAG16)) {
map_invalidate_tile_zoom1(x, y, mapElement->base_height * 8, mapElement->clearance_height * 8);
return false;
}
@@ -434,7 +434,7 @@ static bool map_animation_invalidate_large_scenery(sint32 x, sint32 y, sint32 ba
continue;
sceneryEntry = get_large_scenery_entry(mapElement->properties.scenery.type & 0x3FF);
if (sceneryEntry->large_scenery.flags & (1 << 3)) {
if (sceneryEntry->large_scenery.flags & LARGE_SCENERY_FLAG_ANIMATED) {
sint32 z = mapElement->base_height * 8;
map_invalidate_tile_zoom1(x, y, z, z + 16);
wasInvalidated = true;
+1 -1
View File
@@ -46,7 +46,7 @@ enum {
MAP_ANIMATION_TYPE_REMOVE,
MAP_ANIMATION_TYPE_BANNER,
MAP_ANIMATION_TYPE_LARGE_SCENERY,
MAP_ANIMATION_TYPE_WALL_UNKNOWN,
MAP_ANIMATION_TYPE_WALL_DOOR,
MAP_ANIMATION_TYPE_WALL,
MAP_ANIMATION_TYPE_COUNT
};
+1 -1
View File
@@ -554,7 +554,7 @@ static void park_generate_new_guests()
*/
void park_update()
{
if (gScreenFlags & 0x0E)
if (gScreenFlags & (SCREEN_FLAGS_SCENARIO_EDITOR | SCREEN_FLAGS_TRACK_DESIGNER | SCREEN_FLAGS_TRACK_MANAGER))
return;
// Every 5 seconds approximately
+16 -2
View File
@@ -89,12 +89,18 @@ assert_struct_size(rct_large_scenery_text_glyph, 4);
typedef struct rct_large_scenery_text {
rct_xy16 offset[2]; // 0x0
uint16 max_width; // 0x8
uint16 var_A; // 0xA
uint16 var_C; // 0xC
uint16 pad_A; // 0xA
uint8 flags; // 0xC
uint8 var_D; // 0xD
rct_large_scenery_text_glyph glyphs[256]; // 0xE
} rct_large_scenery_text;
assert_struct_size(rct_large_scenery_text, 14 + 4 * 256);
typedef enum {
LARGE_SCENERY_TEXT_FLAG_VERTICAL = (1 << 0), // 0x1
LARGE_SCENERY_TEXT_FLAG_TWO_LINE = (1 << 1), // 0x2
} LARGE_SCENERY_TEXT_FLAGS;
typedef struct rct_large_scenery_entry {
uint8 tool_id; // 0x06
uint8 flags; // 0x07
@@ -110,6 +116,14 @@ typedef struct rct_large_scenery_entry {
assert_struct_size(rct_large_scenery_entry, 20);
#endif
typedef enum {
LARGE_SCENERY_FLAG_HAS_PRIMARY_COLOUR = (1 << 0), // 0x1
LARGE_SCENERY_FLAG_HAS_SECONDARY_COLOUR = (1 << 1), // 0x2
LARGE_SCENERY_FLAG_3D_TEXT = (1 << 2), // 0x4
LARGE_SCENERY_FLAG_ANIMATED = (1 << 3), // 0x8
LARGE_SCENERY_FLAG5 = (1 << 4), // 0x10
} LARGE_SCENERY_FLAGS;
typedef struct rct_wall_scenery_entry {
uint8 tool_id; // 0x06
uint8 flags; // 0x07