/** * * rct2: 0x0066D7BF */ static void window_music_credits_scrollpaint(rct_window *w, rct_drawpixelinfo *dpi, int scrollIndex) { int x = 245; int y = 2; for (int i = 0; i < countof(music_credits); i++) { gfx_draw_string_centred(dpi, music_credits[i], x, y, COLOUR_BLACK, NULL); y += 10; } // Add 4 more space before "Original recordings ...". y += 4; gfx_draw_string_centred(dpi, STR_MUSIC_ACKNOWLEDGEMENTS_ORIGINAL_RECORDINGS, x, y, COLOUR_BLACK, NULL); y += 10; // Draw the separator y += 5; gfx_fill_rect_inset(dpi, 4, y, 484, y+1, w->colours[1], INSET_RECT_FLAG_BORDER_INSET); y += 11; for (int i = 0; i < countof(music_credits_rct2); i++) { gfx_draw_string_centred(dpi, music_credits_rct2[i], x, y, COLOUR_BLACK, NULL); y += 10; } }
/** * * rct2: 0x006E6ACF */ static void window_water_paint(rct_window *w, rct_drawpixelinfo *dpi) { sint32 x, y; x = w->x + (window_water_widgets[WIDX_PREVIEW].left + window_water_widgets[WIDX_PREVIEW].right) / 2; y = w->y + (window_water_widgets[WIDX_PREVIEW].top + window_water_widgets[WIDX_PREVIEW].bottom) / 2; window_draw_widgets(w, dpi); // Draw number for tool sizes bigger than 7 if (gLandToolSize > MAX_TOOL_SIZE_WITH_SPRITE) { gfx_draw_string_centred(dpi, STR_LAND_TOOL_SIZE_VALUE, x, y - 2, COLOUR_BLACK, &gLandToolSize); } // Draw raise cost amount x = (window_water_widgets[WIDX_PREVIEW].left + window_water_widgets[WIDX_PREVIEW].right) / 2 + w->x; y = window_water_widgets[WIDX_PREVIEW].bottom + w->y + 5; if (gWaterToolRaiseCost != MONEY32_UNDEFINED && gWaterToolRaiseCost != 0) gfx_draw_string_centred(dpi, STR_RAISE_COST_AMOUNT, x, y, COLOUR_BLACK, &gWaterToolRaiseCost); y += 10; // Draw lower cost amount if (gWaterToolLowerCost != MONEY32_UNDEFINED && gWaterToolLowerCost != 0) gfx_draw_string_centred(dpi, STR_LOWER_COST_AMOUNT, x, y, COLOUR_BLACK, &gWaterToolLowerCost); }
static void draw_category_heading(rct_window *w, rct_drawpixelinfo *dpi, int left, int right, int y, rct_string_id stringId) { uint8 baseColour = w->colours[1]; uint8 lightColour = ColourMapA[baseColour].lighter; uint8 darkColour = ColourMapA[baseColour].mid_dark; // Draw string int centreX = (left + right) / 2; gfx_draw_string_centred(dpi, stringId, centreX, y, baseColour, NULL); // Get string dimensions utf8 *buffer = gCommonStringFormatBuffer; format_string(buffer, 256, stringId, NULL); int categoryStringHalfWidth = (gfx_get_string_width(buffer) / 2) + 4; int strLeft = centreX - categoryStringHalfWidth; int strRight = centreX + categoryStringHalfWidth; // Draw light horizontal rule int lineY = y + 4; gfx_draw_line(dpi, left, lineY, strLeft, lineY, lightColour); gfx_draw_line(dpi, strRight, lineY, right, lineY, lightColour); // Draw dark horizontal rule lineY++; gfx_draw_line(dpi, left, lineY, strLeft, lineY, darkColour); gfx_draw_line(dpi, strRight, lineY, right, lineY, darkColour); }
static void window_land_rights_paint(rct_window *w, rct_drawpixelinfo *dpi) { int x, y; x = w->x + (window_land_rights_widgets[WIDX_PREVIEW].left + window_land_rights_widgets[WIDX_PREVIEW].right) / 2; y = w->y + (window_land_rights_widgets[WIDX_PREVIEW].top + window_land_rights_widgets[WIDX_PREVIEW].bottom) / 2; window_draw_widgets(w, dpi); // Draw number for tool sizes bigger than 7 if (RCT2_GLOBAL(RCT2_ADDRESS_LAND_TOOL_SIZE, sint16) > 7) { gfx_draw_string_centred(dpi, STR_LAND_TOOL_SIZE_VALUE, x, y - 2, 0, &RCT2_GLOBAL(RCT2_ADDRESS_LAND_TOOL_SIZE, sint16)); } y = w->y + window_land_rights_widgets[WIDX_PREVIEW].bottom + 5; // Draw cost amount x = (window_land_rights_widgets[WIDX_PREVIEW].left + window_land_rights_widgets[WIDX_PREVIEW].right) / 2 + w->x; y = window_land_rights_widgets[WIDX_PREVIEW].bottom + w->y + 32; if (RCT2_GLOBAL(0x00F1AD62, uint32) != MONEY32_UNDEFINED && RCT2_GLOBAL(0x00F1AD62, uint32) != 0) gfx_draw_string_centred(dpi, 986, x, y, 0, (void*)0x00F1AD62); }
/** * * rct2: 0x006E6ACF */ static void window_water_paint() { rct_window *w; rct_drawpixelinfo *dpi; int x, y; __asm mov w, esi __asm mov dpi, edi window_draw_widgets(w, dpi); // Draw raise cost amount x = (window_water_widgets[WIDX_PREVIEW].left + window_water_widgets[WIDX_PREVIEW].right) / 2 + w->x; y = window_water_widgets[WIDX_PREVIEW].bottom + w->y + 5; if (RCT2_GLOBAL(0x0141F738, uint32) != 0x80000000 && RCT2_GLOBAL(0x0141F738, uint32) != 0) gfx_draw_string_centred(dpi, 984, x, y, 0, (void*)0x0141F738); y += 10; // Draw lower cost amount if (RCT2_GLOBAL(0x0141F73C, uint32) != 0x80000000 && RCT2_GLOBAL(0x0141F73C, uint32) != 0) gfx_draw_string_centred(dpi, 985, x, y, 0, (void*)0x0141F73C); }
/** * * rct2: 0x0068E130 */ static void window_clear_scenery_paint(rct_window *w, rct_drawpixelinfo *dpi) { sint32 x, y; window_draw_widgets(w, dpi); // Draw number for tool sizes bigger than 7 x = w->x + (window_clear_scenery_widgets[WIDX_PREVIEW].left + window_clear_scenery_widgets[WIDX_PREVIEW].right) / 2; y = w->y + (window_clear_scenery_widgets[WIDX_PREVIEW].top + window_clear_scenery_widgets[WIDX_PREVIEW].bottom) / 2; if (gLandToolSize > 7) { gfx_draw_string_centred(dpi, STR_LAND_TOOL_SIZE_VALUE, x, y - 2, COLOUR_BLACK, &gLandToolSize); } // Draw cost amount x = (window_clear_scenery_widgets[WIDX_PREVIEW].left + window_clear_scenery_widgets[WIDX_PREVIEW].right) / 2 + w->x; y = window_clear_scenery_widgets[WIDX_PREVIEW].bottom + w->y + 5 + 27; if (gClearSceneryCost != MONEY32_UNDEFINED && gClearSceneryCost != 0 ) { gfx_draw_string_centred(dpi, STR_COST_AMOUNT, x, y, COLOUR_BLACK, &gClearSceneryCost); } }
/** * * rct2: 0x0068E130 */ static void window_clear_scenery_paint() { rct_window *w; rct_drawpixelinfo *dpi; int x, y; window_paint_get_registers(w, dpi); window_draw_widgets(w, dpi); // Draw cost amount x = (window_clear_scenery_widgets[WIDX_PREVIEW].left + window_clear_scenery_widgets[WIDX_PREVIEW].right) / 2 + w->x; y = window_clear_scenery_widgets[WIDX_PREVIEW].bottom + w->y + 5; if (RCT2_GLOBAL(0x00F1AD62, uint32) != 0x80000000 && RCT2_GLOBAL(0x00F1AD62, uint32) != 0) gfx_draw_string_centred(dpi, 986, x, y, 0, (void*)0x00F1AD62); }
/** * * rct2: 0x0066D321 */ static void window_about_rct2_paint(rct_window *w, rct_drawpixelinfo *dpi) { sint32 x, y, yPage; window_draw_widgets(w, dpi); window_about_openrct2_common_paint(w, dpi); yPage = w->y + w->widgets[WIDX_PAGE_BACKGROUND].top + 5; x = w->x + 200; y = yPage + 5; // Credits gfx_draw_string_centred(dpi, STR_COPYRIGHT_CS, x, y, COLOUR_BLACK, NULL); y += 84; gfx_draw_string_centred(dpi, STR_DESIGNED_AND_PROGRAMMED_BY_CS, x, y, COLOUR_BLACK, NULL); y += 10; gfx_draw_string_centred(dpi, STR_GRAPHICS_BY_SF, x, y, COLOUR_BLACK, NULL); y += 10; gfx_draw_string_centred(dpi, STR_SOUND_AND_MUSIC_BY_AB, x, y, COLOUR_BLACK, NULL); y += 10; gfx_draw_string_centred(dpi, STR_ADDITIONAL_SOUNDS_RECORDED_BY_DE, x, y, COLOUR_BLACK, NULL); y += 13; gfx_draw_string_centred(dpi, STR_REPRESENTATION_BY_JL, x, y, COLOUR_BLACK, NULL); y += 25; gfx_draw_string_centred(dpi, STR_THANKS_TO, x, y, COLOUR_BLACK, NULL); y += 10; gfx_draw_string_centred(dpi, STR_THANKS_TO_PEOPLE, x, y, COLOUR_BLACK, NULL); y += 25; gfx_draw_string_centred(dpi, STR_LICENSED_TO_INFOGRAMES_INTERACTIVE_INC, x, y, COLOUR_BLACK, NULL); // Images gfx_draw_sprite(dpi, SPR_CREDITS_CHRIS_SAWYER_SMALL, w->x + 92, yPage + 24, 0); // Licence }
/** * * rct2: 0x006E6ACF */ static void window_water_paint() { rct_window *w; rct_drawpixelinfo *dpi; int x, y; window_paint_get_registers(w, dpi); x = w->x + (window_water_widgets[WIDX_PREVIEW].left + window_water_widgets[WIDX_PREVIEW].right) / 2; y = w->y + (window_water_widgets[WIDX_PREVIEW].top + window_water_widgets[WIDX_PREVIEW].bottom) / 2; window_draw_widgets(w, dpi); // FEATURE larger land tool size support if (RCT2_GLOBAL(RCT2_ADDRESS_LAND_TOOL_SIZE, sint16) > 7) { RCT2_GLOBAL(0x009BC677, char) = FORMAT_BLACK; RCT2_GLOBAL(0x009BC678, char) = FORMAT_COMMA16; RCT2_GLOBAL(0x009BC679, char) = 0; RCT2_GLOBAL(0x013CE952, sint16) = RCT2_GLOBAL(RCT2_ADDRESS_LAND_TOOL_SIZE, sint16); gfx_draw_string_centred(dpi, 3165, x, y - 2, 0, (void*)0x013CE952); }
/** * * rct2: 0x006A7D8B */ static void window_footpath_paint() { int x, y, image, selectedPath; rct_path_type *pathType; rct_window *w; rct_drawpixelinfo *dpi; window_paint_get_registers(w, dpi); window_draw_widgets(w, dpi); if (!(w->disabled_widgets & (1 << WIDX_CONSTRUCT))) { // Get construction image image = (RCT2_GLOBAL(RCT2_ADDRESS_CONSTRUCT_PATH_DIRECTION, uint8) + RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_ROTATION, uint32)) % 4; if (RCT2_GLOBAL(0x00F3EF91, uint8) == 2) image += 4; else if (RCT2_GLOBAL(0x00F3EF91, uint8) == 6) image += 8; image = RCT2_ADDRESS(0x0098D7E0, uint8)[image]; selectedPath = RCT2_GLOBAL(RCT2_ADDRESS_SELECTED_PATH_ID, uint16); pathType = RCT2_ADDRESS(RCT2_ADDRESS_PATH_TYPES, rct_path_type*)[selectedPath]; image += pathType->image; if (RCT2_GLOBAL(RCT2_ADDRESS_SELECTED_PATH_TYPE, uint8) != SELECTED_PATH_TYPE_NORMAL) image += 51; // Draw construction image x = w->x + (window_footpath_widgets[WIDX_CONSTRUCT].left + window_footpath_widgets[WIDX_CONSTRUCT].right) / 2; y = w->y + window_footpath_widgets[WIDX_CONSTRUCT].bottom - 60; gfx_draw_sprite(dpi, image, x, y, 0); // Draw build this... label x = w->x + (window_footpath_widgets[WIDX_CONSTRUCT].left + window_footpath_widgets[WIDX_CONSTRUCT].right) / 2; y = w->y + window_footpath_widgets[WIDX_CONSTRUCT].bottom - 23; gfx_draw_string_centred(dpi, STR_BUILD_THIS, x, y, 0, 0); }
static void window_text_input_paint(rct_window *w, rct_drawpixelinfo *dpi) { window_draw_widgets(w, dpi); int y = w->y + 25; int no_lines = 0; int font_height = 0; gfx_draw_string_centred(dpi, input_text_description, w->x + WW / 2, y, w->colours[1], &TextInputDescriptionArgs); y += 25; RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_FONT_SPRITE_BASE, uint16) = 224; RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_FONT_FLAGS, uint16) = 0; char wrapped_string[512]; safe_strcpy(wrapped_string, text_input, 512); // String length needs to add 12 either side of box // +13 for cursor when max length. gfx_wrap_string(wrapped_string, WW - (24 + 13), &no_lines, &font_height); gfx_fill_rect_inset(dpi, w->x + 10, y, w->x + WW - 10, y + 10 * (no_lines + 1) + 3, w->colours[1], 0x60); y += 1; char* wrap_pointer = wrapped_string; int char_count = 0; uint8 cur_drawn = 0; int cursorX, cursorY; for (int line = 0; line <= no_lines; line++) { gfx_draw_string(dpi, wrap_pointer, w->colours[1], w->x + 12, y); int string_length = get_string_size(wrap_pointer) - 1; if (!cur_drawn && (gTextInput.selection_offset <= (size_t)(char_count + string_length))) { // Make a copy of the string for measuring the width. char temp_string[512] = { 0 }; memcpy(temp_string, wrap_pointer, gTextInput.selection_offset - char_count); cursorX = w->x + 13 + gfx_get_string_width(temp_string); cursorY = y; int width = 6; if ((uint32)gTextInput.selection_offset < strlen(text_input)){ // Make a new 1 character wide string for measuring the width // of the character that the cursor is under. temp_string[1] = '\0'; temp_string[0] = text_input[gTextInput.selection_offset]; width = max(gfx_get_string_width(temp_string) - 2, 4); } if (w->frame_no > 15){ uint8 colour = ColourMapA[w->colours[1]].mid_light; gfx_fill_rect(dpi, cursorX, y + 9, cursorX + width, y + 9, colour + 5); } cur_drawn++; } wrap_pointer += string_length + 1; if (text_input[char_count + string_length] == ' ')char_count++; char_count += string_length; y += 10; } if (!cur_drawn) { cursorX = gLastDrawStringX; cursorY = y - 10; } // IME composition if (gTextInputCompositionActive) { int compositionWidth = gfx_get_string_width(gTextInputComposition); int x = cursorX - (compositionWidth / 2); int y = cursorY + 13; int w = compositionWidth; int h = 10; gfx_fill_rect(dpi, x - 1, y - 1, x + w + 1, y + h + 1, 12); gfx_fill_rect(dpi, x, y, x + w, y + h, 0); gfx_draw_string(dpi, gTextInputComposition, 12, x, y); } }
static void window_text_input_paint(){ rct_window *w; rct_drawpixelinfo *dpi; window_paint_get_registers(w, dpi); window_draw_widgets(w, dpi); int y = w->y + 25; int no_lines = 0; int font_height = 0; gfx_draw_string_centred(dpi, input_text_description, w->x + WW / 2, y, w->colours[1], &TextInputDescriptionArgs); y += 25; RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_FONT_SPRITE_BASE, uint16) = 224; RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_FONT_FLAGS, uint16) = 0; char wrapped_string[512]; strcpy(wrapped_string, text_input); // String length needs to add 12 either side of box // +13 for cursor when max length. gfx_wrap_string(wrapped_string, WW - (24 + 13), &no_lines, &font_height); gfx_fill_rect_inset(dpi, w->x + 10, y, w->x + WW - 10, y + 10 * (no_lines + 1) + 3, w->colours[1], 0x60); y += 1; char* wrap_pointer = wrapped_string; int char_count = 0; uint8 cur_drawn = 0; for (int line = 0; line <= no_lines; ++line){ gfx_draw_string(dpi, wrap_pointer, w->colours[1], w->x + 12, y); int string_length = get_string_length(wrap_pointer); if (!cur_drawn && (gTextInputCursorPosition <= char_count + string_length)){ // Make a copy of the string for measuring the width. char temp_string[512] = { 0 }; memcpy(temp_string, wrap_pointer, gTextInputCursorPosition - char_count); int cur_x = w->x + 13 + gfx_get_string_width(temp_string); int width = 6; if ((uint32)gTextInputCursorPosition < strlen(text_input)){ // Make a new 1 character wide string for measuring the width // of the character that the cursor is under. temp_string[1] = '\0'; temp_string[0] = text_input[gTextInputCursorPosition]; width = max(gfx_get_string_width(temp_string) - 2, 4); } if (w->frame_no > 15){ uint8 colour = RCT2_ADDRESS(0x0141FC48, uint8)[w->colours[1] * 8]; gfx_fill_rect(dpi, cur_x, y + 9, cur_x + width, y + 9, colour + 5); } cur_drawn++; } wrap_pointer += string_length + 1; if (text_input[char_count + string_length] == ' ')char_count++; char_count += string_length; y += 10; } }
/** * * rct2: 0x0066F25C */ void window_editor_bottom_toolbar_paint(rct_window *w, rct_drawpixelinfo *dpi) { bool drawPreviousButton = false; bool drawNextButton = false; if (gS6Info.editor_step == EDITOR_STEP_OBJECT_SELECTION) { drawNextButton = true; } else if (gScreenFlags & SCREEN_FLAGS_TRACK_DESIGNER) { drawPreviousButton = true; } else if (gSpriteListCount[SPRITE_LIST_NULL] != MAX_SPRITES) { drawNextButton = true; } else if (gParkFlags & PARK_FLAGS_SPRITES_INITIALISED) { drawNextButton = true; } else { drawPreviousButton = true; } if (!(gScreenFlags & SCREEN_FLAGS_TRACK_MANAGER)) { if (drawPreviousButton) { gfx_filter_rect(dpi, window_editor_bottom_toolbar_widgets[WIDX_PREVIOUS_IMAGE].left + w->x, window_editor_bottom_toolbar_widgets[WIDX_PREVIOUS_IMAGE].top + w->y, window_editor_bottom_toolbar_widgets[WIDX_PREVIOUS_IMAGE].right + w->x, window_editor_bottom_toolbar_widgets[WIDX_PREVIOUS_IMAGE].bottom + w->y, PALETTE_51); } if ((drawPreviousButton || drawNextButton) && gS6Info.editor_step != EDITOR_STEP_ROLLERCOASTER_DESIGNER) { gfx_filter_rect(dpi, window_editor_bottom_toolbar_widgets[WIDX_NEXT_IMAGE].left + w->x, window_editor_bottom_toolbar_widgets[WIDX_NEXT_IMAGE].top + w->y, window_editor_bottom_toolbar_widgets[WIDX_NEXT_IMAGE].right + w->x, window_editor_bottom_toolbar_widgets[WIDX_NEXT_IMAGE].bottom + w->y, PALETTE_51); } } window_draw_widgets(w, dpi); if (!(gScreenFlags & SCREEN_FLAGS_TRACK_MANAGER)) { if (drawPreviousButton) { gfx_fill_rect_inset(dpi, window_editor_bottom_toolbar_widgets[WIDX_PREVIOUS_IMAGE].left + 1 + w->x, window_editor_bottom_toolbar_widgets[WIDX_PREVIOUS_IMAGE].top + 1 + w->y, window_editor_bottom_toolbar_widgets[WIDX_PREVIOUS_IMAGE].right - 1 + w->x, window_editor_bottom_toolbar_widgets[WIDX_PREVIOUS_IMAGE].bottom - 1 + w->y, w->colours[1], INSET_RECT_F_30); } if ((drawPreviousButton || drawNextButton) && gS6Info.editor_step != EDITOR_STEP_ROLLERCOASTER_DESIGNER) { gfx_fill_rect_inset(dpi, window_editor_bottom_toolbar_widgets[WIDX_NEXT_IMAGE].left + 1 + w->x, window_editor_bottom_toolbar_widgets[WIDX_NEXT_IMAGE].top + 1 + w->y, window_editor_bottom_toolbar_widgets[WIDX_NEXT_IMAGE].right - 1 + w->x, window_editor_bottom_toolbar_widgets[WIDX_NEXT_IMAGE].bottom - 1 + w->y, w->colours[1], INSET_RECT_F_30); } sint16 stateX = (window_editor_bottom_toolbar_widgets[WIDX_PREVIOUS_IMAGE].right + window_editor_bottom_toolbar_widgets[WIDX_NEXT_IMAGE].left) / 2 + w->x; sint16 stateY = w->height - 0x0C + w->y; gfx_draw_string_centred(dpi, EditorStepNames[gS6Info.editor_step], stateX, stateY, NOT_TRANSLUCENT(w->colours[2]) | COLOUR_FLAG_OUTLINE, 0); if (drawPreviousButton) { gfx_draw_sprite(dpi, SPR_PREVIOUS, window_editor_bottom_toolbar_widgets[WIDX_PREVIOUS_IMAGE].left + 6 + w->x, window_editor_bottom_toolbar_widgets[WIDX_PREVIOUS_IMAGE].top + 6 + w->y, 0); sint32 textColour = NOT_TRANSLUCENT(w->colours[1]); if (gHoverWidget.window_classification == WC_BOTTOM_TOOLBAR && gHoverWidget.widget_index == WIDX_PREVIOUS_STEP_BUTTON ) { textColour = COLOUR_WHITE; } sint16 textX = (window_editor_bottom_toolbar_widgets[WIDX_PREVIOUS_IMAGE].left + 30 + window_editor_bottom_toolbar_widgets[WIDX_PREVIOUS_IMAGE].right) / 2 + w->x; sint16 textY = window_editor_bottom_toolbar_widgets[WIDX_PREVIOUS_IMAGE].top + 6 + w->y; rct_string_id stringId = EditorStepNames[gS6Info.editor_step - 1]; if (gScreenFlags & SCREEN_FLAGS_TRACK_DESIGNER) stringId = STR_EDITOR_STEP_OBJECT_SELECTION; gfx_draw_string_centred(dpi, STR_BACK_TO_PREVIOUS_STEP, textX, textY, textColour, NULL); gfx_draw_string_centred(dpi, stringId, textX, textY + 10, textColour, NULL); } if ((drawPreviousButton || drawNextButton) && gS6Info.editor_step != EDITOR_STEP_ROLLERCOASTER_DESIGNER) { gfx_draw_sprite(dpi, SPR_NEXT, window_editor_bottom_toolbar_widgets[WIDX_NEXT_IMAGE].right - 29 + w->x, window_editor_bottom_toolbar_widgets[WIDX_NEXT_IMAGE].top + 6 + w->y, 0); sint32 textColour = NOT_TRANSLUCENT(w->colours[1]); if (gHoverWidget.window_classification == WC_BOTTOM_TOOLBAR && gHoverWidget.widget_index == WIDX_NEXT_STEP_BUTTON ) { textColour = COLOUR_WHITE; } sint16 textX = (window_editor_bottom_toolbar_widgets[WIDX_NEXT_IMAGE].left + window_editor_bottom_toolbar_widgets[WIDX_NEXT_IMAGE].right - 30) / 2 + w->x; sint16 textY = window_editor_bottom_toolbar_widgets[WIDX_NEXT_IMAGE].top + 6 + w->y; rct_string_id stringId = EditorStepNames[gS6Info.editor_step + 1]; if (gScreenFlags & SCREEN_FLAGS_TRACK_DESIGNER) stringId = STR_EDITOR_STEP_ROLLERCOASTER_DESIGNER; gfx_draw_string_centred(dpi, STR_FORWARD_TO_NEXT_STEP, textX, textY, textColour, NULL); gfx_draw_string_centred(dpi, stringId, textX, textY + 10, textColour, NULL); } } }
static void window_scenarioselect_scrollpaint(rct_window *w, rct_drawpixelinfo *dpi, int scrollIndex) { int colour; uint8 paletteIndex = ColourMapA[w->colours[1]].mid_light; gfx_clear(dpi, paletteIndex); rct_string_id highlighted_format = (theme_get_flags() & UITHEME_FLAG_USE_ALTERNATIVE_SCENARIO_SELECT_FONT) ? STR_WHITE_STRING : STR_WINDOW_COLOUR_2_STRINGID; rct_string_id unhighlighted_format = (theme_get_flags() & UITHEME_FLAG_USE_ALTERNATIVE_SCENARIO_SELECT_FONT) ? STR_WHITE_STRING : STR_BLACK_STRING; bool wide = gConfigGeneral.scenario_select_mode == SCENARIO_SELECT_MODE_ORIGIN; rct_widget *listWidget = &w->widgets[WIDX_SCENARIOLIST]; int listWidth = listWidget->right - listWidget->left - 12; int y = 0; for (sc_list_item *listItem = _listItems; listItem->type != LIST_ITEM_TYPE_END; listItem++) { if (y > dpi->y + dpi->height) { continue; } switch (listItem->type) { case LIST_ITEM_TYPE_HEADING:; const int horizontalRuleMargin = 4; draw_category_heading(w, dpi, horizontalRuleMargin, listWidth - horizontalRuleMargin, y + 2, listItem->heading.string_id); y += 18; break; case LIST_ITEM_TYPE_SCENARIO:; // Draw hover highlight const scenario_index_entry *scenario = listItem->scenario.scenario; bool isHighlighted = w->highlighted_scenario == scenario; if (isHighlighted) { gfx_filter_rect(dpi, 0, y, w->width, y + 23, PALETTE_DARKEN_1); } bool isCompleted = scenario->highscore != NULL; bool isDisabled = listItem->scenario.is_locked; // Draw scenario name char buffer[64]; safe_strcpy(buffer, scenario->name, sizeof(buffer)); rct_string_id format = isDisabled ? STR_STRINGID : (isHighlighted ? highlighted_format : unhighlighted_format); set_format_arg(0, rct_string_id, STR_STRING); set_format_arg(2, char *, buffer); colour = isDisabled ? w->colours[1] | COLOUR_FLAG_INSET : COLOUR_BLACK; if (isDisabled) { gCurrentFontSpriteBase = FONT_SPRITE_BASE_MEDIUM_DARK; } gfx_draw_string_centred(dpi, format, wide ? 270 : 210, y + 1, colour, gCommonFormatArgs); // Check if scenario is completed if (isCompleted) { // Draw completion tick gfx_draw_sprite(dpi, SPR_MENU_CHECKMARK, wide ? 500 : 395, y + 1, 0); // Draw completion score const utf8 *completedByName = "???"; if (!str_is_null_or_empty(scenario->highscore->name)) { completedByName = scenario->highscore->name; } safe_strcpy(buffer, completedByName, 64); set_format_arg(0, rct_string_id, STR_COMPLETED_BY); set_format_arg(2, rct_string_id, STR_STRING); set_format_arg(4, char *, buffer); gfx_draw_string_centred(dpi, format, wide ? 270 : 210, y + 11, COLOUR_BLACK, gCommonFormatArgs); } y += 24; break; } } }
static void window_text_input_paint(rct_window *w, rct_drawpixelinfo *dpi) { window_draw_widgets(w, dpi); sint32 y = w->y + 25; sint32 no_lines = 0; sint32 font_height = 0; gfx_draw_string_centred(dpi, input_text_description, w->x + WW / 2, y, w->colours[1], &TextInputDescriptionArgs); y += 25; gCurrentFontSpriteBase = FONT_SPRITE_BASE_MEDIUM; gCurrentFontFlags = 0; char wrapped_string[512]; safe_strcpy(wrapped_string, text_input, 512); // String length needs to add 12 either side of box // +13 for cursor when max length. gfx_wrap_string(wrapped_string, WW - (24 + 13), &no_lines, &font_height); gfx_fill_rect_inset(dpi, w->x + 10, y, w->x + WW - 10, y + 10 * (no_lines + 1) + 3, w->colours[1], INSET_RECT_F_60); y += 1; char* wrap_pointer = wrapped_string; size_t char_count = 0; uint8 cur_drawn = 0; sint32 cursorX = 0, cursorY = 0; for (sint32 line = 0; line <= no_lines; line++) { gfx_draw_string(dpi, wrap_pointer, w->colours[1], w->x + 12, y); size_t string_length = get_string_size(wrap_pointer) - 1; if (!cur_drawn && (gTextInput.selection_offset <= char_count + string_length)) { // Make a copy of the string for measuring the width. char temp_string[512] = { 0 }; memcpy(temp_string, wrap_pointer, gTextInput.selection_offset - char_count); cursorX = w->x + 13 + gfx_get_string_width(temp_string); cursorY = y; sint32 width = 6; if (gTextInput.selection_offset < strlen(text_input)){ // Make a 1 utf8-character wide string for measuring the width // of the currently selected character. utf8 tmp[5] = { 0 }; // This is easier than setting temp_string[0..5] uint32 codepoint = utf8_get_next(text_input + gTextInput.selection_offset, NULL); utf8_write_codepoint(tmp, codepoint); width = max(gfx_get_string_width(tmp) - 2, 4); } if (w->frame_no > 15){ uint8 colour = ColourMapA[w->colours[1]].mid_light; gfx_fill_rect(dpi, cursorX, y + 9, cursorX + width, y + 9, colour + 5); } cur_drawn++; } wrap_pointer += string_length + 1; if (text_input[char_count + string_length] == ' ')char_count++; char_count += string_length; y += 10; } if (!cur_drawn) { cursorX = gLastDrawStringX; cursorY = y - 10; } // IME composition if (gTextInputCompositionActive) { draw_ime_composition(dpi, cursorX, cursorY); } }
/** * * rct2: 0x0066F25C */ void window_editor_bottom_toolbar_paint(rct_window *w, rct_drawpixelinfo *dpi) { bool drawPreviousButton = false; bool drawNextButton = false; if (g_editor_step == EDITOR_STEP_OBJECT_SELECTION) { drawNextButton = true; } else if (RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_FLAGS, uint8) & SCREEN_FLAGS_TRACK_DESIGNER) { drawPreviousButton = true; } else if (RCT2_GLOBAL(0x13573C8, uint16) != 0x2710) { drawNextButton = true; } else if (RCT2_GLOBAL(RCT2_ADDRESS_PARK_FLAGS, uint32) & PARK_FLAGS_18) { drawNextButton = true; } else { drawPreviousButton = true; } if (!(RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_FLAGS, uint8) & SCREEN_FLAGS_TRACK_MANAGER)) { if (drawPreviousButton) { gfx_fill_rect(dpi, window_editor_bottom_toolbar_widgets[WIDX_PREVIOUS_IMAGE].left + w->x, window_editor_bottom_toolbar_widgets[WIDX_PREVIOUS_IMAGE].top + w->y, window_editor_bottom_toolbar_widgets[WIDX_PREVIOUS_IMAGE].right + w->x, window_editor_bottom_toolbar_widgets[WIDX_PREVIOUS_IMAGE].bottom + w->y, 0x2000033); } if ((drawPreviousButton || drawNextButton) && g_editor_step != EDITOR_STEP_ROLLERCOASTER_DESIGNER) { gfx_fill_rect(dpi, window_editor_bottom_toolbar_widgets[WIDX_NEXT_IMAGE].left + w->x, window_editor_bottom_toolbar_widgets[WIDX_NEXT_IMAGE].top + w->y, window_editor_bottom_toolbar_widgets[WIDX_NEXT_IMAGE].right + w->x, window_editor_bottom_toolbar_widgets[WIDX_NEXT_IMAGE].bottom + w->y, 0x2000033); } } window_draw_widgets(w, dpi); if (!(RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_FLAGS, uint8) & SCREEN_FLAGS_TRACK_MANAGER)) { if (drawPreviousButton) { gfx_fill_rect_inset(dpi, window_editor_bottom_toolbar_widgets[WIDX_PREVIOUS_IMAGE].left + 1 + w->x, window_editor_bottom_toolbar_widgets[WIDX_PREVIOUS_IMAGE].top + 1 + w->y, window_editor_bottom_toolbar_widgets[WIDX_PREVIOUS_IMAGE].right - 1 + w->x, window_editor_bottom_toolbar_widgets[WIDX_PREVIOUS_IMAGE].bottom - 1 + w->y, w->colours[1], 0x30); } if ((drawPreviousButton || drawNextButton) && g_editor_step != EDITOR_STEP_ROLLERCOASTER_DESIGNER) { gfx_fill_rect_inset(dpi, window_editor_bottom_toolbar_widgets[WIDX_NEXT_IMAGE].left + 1 + w->x, window_editor_bottom_toolbar_widgets[WIDX_NEXT_IMAGE].top + 1 + w->y, window_editor_bottom_toolbar_widgets[WIDX_NEXT_IMAGE].right - 1 + w->x, window_editor_bottom_toolbar_widgets[WIDX_NEXT_IMAGE].bottom - 1 + w->y, w->colours[1], 0x30); } short stateX = (window_editor_bottom_toolbar_widgets[WIDX_PREVIOUS_IMAGE].right + window_editor_bottom_toolbar_widgets[WIDX_NEXT_IMAGE].left) / 2 + w->x; short stateY = w->height - 0x0C + w->y; gfx_draw_string_centred(dpi, STR_OBJECT_SELECTION_STEP + g_editor_step, stateX, stateY, (w->colours[2] & 0x7F) | 0x20, 0); if (drawPreviousButton) { gfx_draw_sprite(dpi, SPR_PREVIOUS, window_editor_bottom_toolbar_widgets[WIDX_PREVIOUS_IMAGE].left + 6 + w->x, window_editor_bottom_toolbar_widgets[WIDX_PREVIOUS_IMAGE].top + 6 + w->y, 0); int textColour = w->colours[1] & 0x7F; if (gHoverWidget.window_classification == WC_BOTTOM_TOOLBAR && gHoverWidget.widget_index == WIDX_PREVIOUS_STEP_BUTTON ) { textColour = 2; } short textX = (window_editor_bottom_toolbar_widgets[WIDX_PREVIOUS_IMAGE].left + 30 + window_editor_bottom_toolbar_widgets[WIDX_PREVIOUS_IMAGE].right) / 2 + w->x; short textY = window_editor_bottom_toolbar_widgets[WIDX_PREVIOUS_IMAGE].top + 6 + w->y; short stringId = STR_OBJECT_SELECTION_STEP + g_editor_step - 1; if (RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_FLAGS, uint8) & SCREEN_FLAGS_TRACK_DESIGNER) stringId = STR_OBJECT_SELECTION_STEP; gfx_draw_string_centred(dpi, STR_BACK_TO_PREVIOUS_STEP, textX, textY, textColour, 0); gfx_draw_string_centred(dpi, stringId, textX, textY + 10, textColour, 0); } if ((drawPreviousButton || drawNextButton) && g_editor_step != EDITOR_STEP_ROLLERCOASTER_DESIGNER) { gfx_draw_sprite(dpi, SPR_NEXT, window_editor_bottom_toolbar_widgets[WIDX_NEXT_IMAGE].right - 29 + w->x, window_editor_bottom_toolbar_widgets[WIDX_NEXT_IMAGE].top + 6 + w->y, 0); int textColour = w->colours[1] & 0x7F; if (gHoverWidget.window_classification == WC_BOTTOM_TOOLBAR && gHoverWidget.widget_index == WIDX_NEXT_STEP_BUTTON ) { textColour = 2; } short textX = (window_editor_bottom_toolbar_widgets[WIDX_NEXT_IMAGE].left + window_editor_bottom_toolbar_widgets[WIDX_NEXT_IMAGE].right - 30) / 2 + w->x; short textY = window_editor_bottom_toolbar_widgets[WIDX_NEXT_IMAGE].top + 6 + w->y; short stringId = STR_OBJECT_SELECTION_STEP + g_editor_step + 1; if (RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_FLAGS, uint8) & SCREEN_FLAGS_TRACK_DESIGNER) stringId = STR_ROLLERCOASTER_DESIGNER_STEP; gfx_draw_string_centred(dpi, STR_FORWARD_TO_NEXT_STEP, textX, textY, textColour, 0); gfx_draw_string_centred(dpi, stringId, textX, textY + 10, textColour, 0); } } }
/** * * rct2: 0x0066D321 */ static void window_about_paint() { int x, y; rct_window *w; rct_drawpixelinfo *dpi; window_paint_get_registers(w, dpi); window_draw_widgets(w, dpi); x = w->x + 200; y = w->y + 17; // Version RCT2_GLOBAL(0x009C383C, uint8) = 49; gfx_draw_string_centred(dpi, STR_VERSION_X, x, y, 0, (void*)0x009E2D28); // Credits RCT2_GLOBAL(0x009C383C, uint8) = 48; y += 10; gfx_draw_string_centred(dpi, STR_COPYRIGHT_CS, x, y, 0, (void*)0x009E2D28); y += 79; gfx_draw_string_centred(dpi, STR_DESIGNED_AND_PROGRAMMED_BY_CS, x, y, 0, (void*)0x009E2D28); y += 10; gfx_draw_string_centred(dpi, STR_GRAPHICS_BY_SF, x, y, 0, (void*)0x009E2D28); y += 10; gfx_draw_string_centred(dpi, STR_SOUND_AND_MUSIC_BY_AB, x, y, 0, (void*)0x009E2D28); y += 10; gfx_draw_string_centred(dpi, STR_ADDITIONAL_SOUNDS_RECORDED_BY_DE, x, y, 0, (void*)0x009E2D28); y += 13; gfx_draw_string_centred(dpi, STR_REPRESENTATION_BY_JL, x, y, 0, (void*)0x009E2D28); y += 25; gfx_draw_string_centred(dpi, STR_THANKS_TO, x, y, 0, (void*)0x009E2D28); y += 10; gfx_draw_string_centred(dpi, STR_THANKS_TO_PEOPLE, x, y, 0, (void*)0x009E2D28); y += 10; gfx_draw_string_centred(dpi, STR_CREDIT_SPARE_1, x, y, 0, (void*)0x009E2D28); y += 10; gfx_draw_string_centred(dpi, STR_CREDIT_SPARE_2, x, y, 0, (void*)0x009E2D28); y += 10; gfx_draw_string_centred(dpi, STR_CREDIT_SPARE_3, x, y, 0, (void*)0x009E2D28); y += 10; gfx_draw_string_centred(dpi, STR_CREDIT_SPARE_4, x, y, 0, (void*)0x009E2D28); y += 10; gfx_draw_string_centred(dpi, STR_CREDIT_SPARE_5, x, y, 0, (void*)0x009E2D28); y += 10; gfx_draw_string_centred(dpi, STR_CREDIT_SPARE_6, x, y, 0, (void*)0x009E2D28); y += 10; gfx_draw_string_centred(dpi, STR_CREDIT_SPARE_7, x, y, 0, (void*)0x009E2D28); // Images gfx_draw_sprite(dpi, SPR_CREDITS_CHRIS_SAWYER_SMALL, w->x + 92, w->y + 40, 0); gfx_draw_sprite(dpi, SPR_CREDITS_INFOGRAMES, w->x + 50, w->y + 247, 0); // Licence gfx_draw_string_left(dpi, STR_LICENSED_TO_INFOGRAMES_INTERACTIVE_INC, 0, 0, w->x + 157, w->y + 257); }