1
0
mirror of https://github.com/OpenRCT2/OpenRCT2 synced 2026-01-23 23:04:36 +01:00

Merge branch 'master' into ride-update

Conflicts:
	projects/openrct2.vcxproj.filters
This commit is contained in:
IntelOrca
2014-11-03 17:37:08 +00:00
20 changed files with 1035 additions and 94 deletions

View File

@@ -102,6 +102,7 @@
<ClCompile Include="..\src\windows\banner.c" />
<ClCompile Include="..\src\windows\cheats.c" />
<ClCompile Include="..\src\windows\clear_scenery.c" />
<ClCompile Include="..\src\windows\demolish_ride_prompt.c" />
<ClCompile Include="..\src\windows\dropdown.c" />
<ClCompile Include="..\src\windows\error.c" />
<ClCompile Include="..\src\windows\finances.c" />
@@ -128,6 +129,7 @@
<ClCompile Include="..\src\windows\scenery.c" />
<ClCompile Include="..\src\windows\shortcut_keys.c" />
<ClCompile Include="..\src\windows\shortcut_key_change.c" />
<ClCompile Include="..\src\windows\sign.c" />
<ClCompile Include="..\src\windows\staff_fire_prompt.c" />
<ClCompile Include="..\src\windows\staff_list.c" />
<ClCompile Include="..\src\windows\staff.c" />

View File

@@ -381,7 +381,6 @@
<ClCompile Include="..\lib\lodepng\lodepng.c" />
<ClCompile Include="..\lib\lodepng\lodepng.c" />
<ClCompile Include="..\lib\lodepng\lodepng.c" />
<ClCompile Include="..\lib\lodepng\lodepng.c" />
<ClCompile Include="..\src\drawing\rain.c">
<Filter>Source\Drawing</Filter>
</ClCompile>
@@ -428,6 +427,13 @@
<Filter>Source\Windows</Filter>
</ClCompile>
<ClCompile Include="..\lib\libspeex\resample.c;..\lib\lodepng\lodepng.c" />
<ClCompile Include="..\src\windows\demolish_ride_prompt.c">
<Filter>Source\Windows</Filter>
</ClCompile>
<ClCompile Include="..\src\windows\sign.c">
<Filter>Source\Windows</Filter>
</ClCompile>
<ClCompile Include="..\lib\libspeex\resample.c;..\lib\lodepng\lodepng.c" />
<ClCompile Include="..\src\ride\station.c">
<Filter>Source\Ride</Filter>
</ClCompile>

View File

@@ -372,6 +372,10 @@
#define RCT2_ADDRESS_CURRENT_WINDOW_COLOUR_3 0x0141F742
#define RCT2_ADDRESS_CURRENT_WINDOW_COLOUR_4 0x0141F743
// size: 500 chars
#define RCT2_ADDRESS_TOOLTIP_TEXT_BUFFER 0x0141FE44
#define RCT2_ADDRESS_TOOLTIP_TEXT_HEIGHT 0x01420044
#define RCT2_ADDRESS_WINDOW_LIST 0x01420078
#define RCT2_ADDRESS_NEW_WINDOW_PTR 0x014234B8
#define RCT2_ADDRESS_VIEWPORT_LIST 0x014234BC

View File

@@ -486,13 +486,13 @@ void redraw_peep_and_rain()
if (RCT2_GLOBAL(0x009ABDF2, uint32) != 0) {
int sprite = RCT2_GLOBAL(RCT2_ADDRESS_PICKEDUP_PEEP_SPRITE, sint32);
if (sprite != -1) {
sprite = (sprite & 0x7FFFF) * 16;
sprite = sprite & 0x7FFFF;
rct_g1_element *g1_elements = RCT2_ADDRESS(RCT2_ADDRESS_G1_ELEMENTS, rct_g1_element);
int left = RCT2_GLOBAL(RCT2_ADDRESS_PICKEDUP_PEEP_X, sint32) + g1_elements[sprite].x_offset;
int top = RCT2_GLOBAL(RCT2_ADDRESS_PICKEDUP_PEEP_Y, sint32) + g1_elements[sprite].y_offset;
int right = left + g1_elements[sprite].width;
int bottom = top + g1_elements[sprite].height;
rct_g1_element *g1_elements = &RCT2_ADDRESS(RCT2_ADDRESS_G1_ELEMENTS, rct_g1_element)[sprite];
int left = RCT2_GLOBAL(RCT2_ADDRESS_PICKEDUP_PEEP_X, sint16) + g1_elements->x_offset;
int top = RCT2_GLOBAL(RCT2_ADDRESS_PICKEDUP_PEEP_Y, sint16) + g1_elements->y_offset;
int right = left + g1_elements->width;
int bottom = top + g1_elements->height;
gfx_set_dirty_blocks(left, top, right, bottom);
}
@@ -511,6 +511,6 @@ void redraw_peep_and_rain()
}
RCT2_GLOBAL(0x009E2C78, uint32) = 1;
}
RCT2_GLOBAL(RCT2_ADDRESS_NO_RAIN_PIXELS, uint32) = 0;
}
RCT2_GLOBAL(RCT2_ADDRESS_NO_RAIN_PIXELS, uint32) = 0;
}

View File

@@ -100,6 +100,7 @@ void gfx_load_character_widths();
int clip_text(char *buffer, int width);
int gfx_wrap_string(char* buffer, int width, int* num_lines, int* font_height);
int gfx_get_string_width(char *buffer);
int gfx_get_string_width_new_lined(char* buffer);
void gfx_draw_string(rct_drawpixelinfo *dpi, char *buffer, int colour, int x, int y);
void gfx_draw_string_left(rct_drawpixelinfo *dpi, int format, void *args, int colour, int x, int y);
void gfx_draw_string_left_clipped(rct_drawpixelinfo *dpi, int format, void *args, int colour, int x, int y, int width);

View File

@@ -85,6 +85,79 @@ void gfx_load_character_widths(){
}
}
/* rct2: 0x006C23B1 */
int gfx_get_string_width_new_lined(char* buffer){
// Current font sprites
uint16* current_font_sprite_base;
// Width of string
int width = 0, max_width = 0, no_lines = 1;
rct_g1_element g1_element;
current_font_sprite_base = RCT2_ADDRESS(RCT2_ADDRESS_CURRENT_FONT_SPRITE_BASE, uint16);
for (uint8* curr_char = (uint8*)buffer; *curr_char != (uint8)0; curr_char++) {
if (*curr_char >= 0x20) {
width += RCT2_ADDRESS(RCT2_ADDRESS_FONT_CHAR_WIDTH, uint8)[*current_font_sprite_base + (*curr_char - 0x20)];
continue;
}
switch (*curr_char) {
case FORMAT_MOVE_X:
curr_char++;
width = *curr_char;
break;
case FORMAT_ADJUST_PALETTE:
case 3:
case 4:
curr_char++;
break;
case FORMAT_NEWLINE:
case FORMAT_NEWLINE_SMALLER:
no_lines++;
max_width = max(max_width, width);
width = 0;
break;
case FORMAT_TINYFONT:
*current_font_sprite_base = 0x1C0;
break;
case FORMAT_BIGFONT:
*current_font_sprite_base = 0x2A0;
break;
case FORMAT_MEDIUMFONT:
*current_font_sprite_base = 0x0E0;
break;
case FORMAT_SMALLFONT:
*current_font_sprite_base = 0;
break;
case FORMAT_OUTLINE:
case FORMAT_OUTLINE_OFF:
case FORMAT_WINDOW_COLOUR_1:
case FORMAT_WINDOW_COLOUR_2:
case FORMAT_WINDOW_COLOUR_3:
case 0x10:
continue;
case FORMAT_INLINE_SPRITE:
g1_element = RCT2_ADDRESS(RCT2_ADDRESS_G1_ELEMENTS, rct_g1_element)[*((uint32*)(curr_char + 1)) & 0x7FFFF];
width += g1_element.width;
curr_char += 4;
break;
default:
if (*curr_char <= 0x16) { //case 0x11? FORMAT_NEW_LINE_X_Y
curr_char += 2;
continue;
}
curr_char += 4;//never happens?
break;
}
}
if (width > max_width)
return width;
return max_width;
}
/**
* Return the width of the string in buffer
*

View File

@@ -276,6 +276,13 @@ void game_logic_update()
if (RCT2_GLOBAL(0x009DEA66, sint16) == 0)
RCT2_GLOBAL(0x009DEA66, sint16)--;
// This is a hack for now to force a complete rerender of the screen to
// stop viewports from failing. Remove this when real bug cause has been
// found.
// ***********
gfx_invalidate_screen();
// ***********
sub_68B089();
scenario_update();
climate_update();

View File

@@ -34,6 +34,7 @@
#include "windows/dropdown.h"
#include "world/map.h"
#include "world/sprite.h"
#include "world/scenery.h"
POINT _dragPosition;
@@ -814,38 +815,76 @@ static void game_handle_input_mouse(int x, int y, int state)
if (RCT2_GLOBAL(0x009DE540, sint16) < 500) {
// Right click
{
int eax, ebx, ecx, edx, esi, edi, ebp;
int eax, ebx, ecx, esi, edi, ebp;
rct_map_element* map_element;
rct_scenery_entry* scenery_entry;
eax = RCT2_GLOBAL(RCT2_ADDRESS_CURSOR_DRAG_LAST_X, sint16);
ebx = RCT2_GLOBAL(RCT2_ADDRESS_CURSOR_DRAG_LAST_Y, sint16);
RCT2_CALLFUNC_X(0x006EDE88, &eax, &ebx, &ecx, &edx, &esi, &edi, &ebp);
RCT2_CALLFUNC_X(0x006EDE88, &eax, &ebx, &ecx, (int*)&map_element, &esi, &edi, &ebp);
switch (ebx & 0xFF) {
case 2:
if (*((uint8*)edx) == 0)
RCT2_CALLPROC_X(0x006B4857, eax, 0, ecx, edx, 0, 0, 0);
if (map_element->type == 0)
RCT2_CALLPROC_X(0x006B4857, eax, 0, ecx, (int)map_element, 0, 0, 0);
break;
case 3:
RCT2_CALLPROC_X(0x006CC056, eax, 0, ecx, edx, 0, 0, 0);
RCT2_CALLPROC_X(0x006CC056, eax, 0, ecx, (int)map_element, 0, 0, 0);
break;
case 5:
RCT2_CALLPROC_X(0x006E08D2, eax, 0, ecx, edx, 0, 0, 0);
RCT2_CALLPROC_X(0x006E08D2, eax, 0, ecx, (int)map_element, 0, 0, 0);
break;
case 6:
RCT2_CALLPROC_X(0x006A614A, eax, 0, ecx, edx, 0, 0, 0);
RCT2_CALLPROC_X(0x006A614A, eax, 0, ecx, (int)map_element, 0, 0, 0);
break;
case 7:
RCT2_CALLPROC_X(0x006A61AB, eax, 0, ecx, edx, 0, 0, 0);
RCT2_CALLPROC_X(0x006A61AB, eax, 0, ecx, (int)map_element, 0, 0, 0);
break;
case 8:
RCT2_CALLPROC_X(0x00666C0E, eax, 0, ecx, edx, 0, 0, 0);
RCT2_CALLPROC_X(0x00666C0E, eax, 0, ecx, (int)map_element, 0, 0, 0);
break;
case 9:
RCT2_CALLPROC_X(0x006E57A9, eax, 0, ecx, edx, 0, 0, 0);
//0x006e57a9
scenery_entry = g_wallSceneryEntries[map_element->properties.fence.slope];
if (scenery_entry->wall.var_0D != 0xFF){
window_sign_small_open(map_element->properties.fence.item[0]);
}
else{
RCT2_GLOBAL(RCT2_ADDRESS_GAME_COMMAND_ERROR_STRING_ID, rct_string_id) = 1158;
game_do_command(
eax,
1,
ecx,
(map_element->type & 0x3) | (map_element->base_height << 8),
GAME_COMMAND_42,
0,
0);
}
break;
case 10:
RCT2_CALLPROC_X(0x006B88DC, eax, 0, ecx, edx, 0, 0, 0);
//0x006B88DC
ebx = map_element->properties.scenerymultiple.type;
ebx |= (map_element->properties.scenerymultiple.index & 0x3) << 8;
scenery_entry = g_largeSceneryEntries[ebx];
if (scenery_entry->large_scenery.var_11 != 0xFF){
int id = (map_element->type & 0xC0) |
((map_element->properties.scenerymultiple.colour[0] & 0xE0) >> 2) |
((map_element->properties.scenerymultiple.colour[1] & 0xE0) >> 5);
window_sign_open(id);
}
else{
RCT2_GLOBAL(RCT2_ADDRESS_GAME_COMMAND_ERROR_STRING_ID, rct_string_id) = 1158;
game_do_command(
eax,
1 | ((map_element->type & 0x3) << 8),
ecx,
map_element->base_height | ((map_element->properties.scenerymultiple.index >> 2) << 8),
GAME_COMMAND_44,
0,
0);
}
break;
case 12:
RCT2_CALLPROC_X(0x006BA233, eax, 0, ecx, edx, 0, 0, 0);
window_banner_open(map_element->properties.banner.index);
break;
default:
break;

View File

@@ -289,7 +289,6 @@ void viewport_update_position(rct_window *window)
center_2d_coordinates(sprite->unknown.x, sprite->unknown.y, sprite->unknown.z, &center_x, &center_y, window->viewport);
RCT2_CALLPROC_X(0x6E7DE1, center_x, center_y, 0, 0, (int)window, (int)viewport, 0);
window_invalidate(window);//Added to force a redraw.
return;
}

View File

@@ -501,11 +501,14 @@ void window_finances_open();
void window_finances_research_open();
void window_new_campaign_open(sint16 campaignType);
rct_window *window_ride_main_open(int rideIndex);
void window_ride_demolish_prompt_open(int rideIndex);
void window_ride_construct(rct_window *w);
void window_ride_list_open();
void window_track_place_open();
void window_new_ride_open();
void window_banner_open(rct_windownumber number);
void window_sign_open(rct_windownumber number);
void window_sign_small_open(rct_windownumber number);
void window_cheats_open();
void window_research_open();
void window_scenery_open();

View File

@@ -144,6 +144,9 @@ enum {
STR_CONSTRUCTION = 990,
STR_DEMOLISH_RIDE_TIP = 992,
STR_DEMOLISH_RIDE = 993,
STR_DEMOLISH = 994,
STR_DEMOLISH_RIDE_ID = 995,
STR_OVERALL_VIEW = 996,
STR_VIEW_SELECTION = 997,
@@ -679,6 +682,8 @@ enum {
STR_MONTH_NOVEMBER = STR_MONTH_JANUARY + 10,
STR_MONTH_DECEMBER = STR_MONTH_JANUARY + 11,
STR_CANT_DEMOLISH_RIDE = 2248,
STR_RESEARCH_TRANSPORT_RIDES = 2253,
STR_RESEARCH_GENTLE_RIDES = 2254,
STR_RESEARCH_ROLLER_COASTERS = 2255,
@@ -993,6 +998,10 @@ enum {
STR_DEMOLISH_BANNER_TIP = 2988,
STR_SELECT_MAIN_COLOR_TIP = 2989,
STR_SELECT_TEXT_COLOR_TIP = 2990,
STR_SIGN = 2991,
STR_CHANGE_SIGN_TEXT_TIP = 2994,
STR_DEMOLISH_SIGN_TIP = 2995,
STR_LICENCE_AGREEMENT_NOTICE_1 = 2969,
STR_LICENCE_AGREEMENT_NOTICE_2 = 2970,

View File

@@ -229,6 +229,7 @@ void check_file_path(int pathId)
{
case PATH_ID_GAMECFG:
case PATH_ID_SCORES:
case PATH_ID_TRACKSIDX:
// Do nothing; these will be created later if they do not exist yet
break;

View File

@@ -0,0 +1,154 @@
/*****************************************************************************
* Copyright (c) 2014 Ted John, Duncan Frost
* OpenRCT2, an open source clone of Roller Coaster Tycoon 2.
*
* This file is part of OpenRCT2.
*
* OpenRCT2 is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*****************************************************************************/
#include "../addresses.h"
#include "../game.h"
#include "../interface/widget.h"
#include "../interface/window.h"
#include "../localisation/localisation.h"
#include "../peep/peep.h"
#include "../peep/staff.h"
#include "../sprites.h"
#include "../world/sprite.h"
#define WW 200
#define WH 100
enum WINDOW_RIDE_DEMOLISH_WIDGET_IDX {
WIDX_BACKGROUND,
WIDX_TITLE,
WIDX_CLOSE,
WIDX_DEMOLISH,
WIDX_CANCEL
};
// 0x009AEBA0
static rct_widget window_ride_demolish_widgets[] = {
{ WWT_FRAME, 0, 0, WW - 1, 0, WH - 1, STR_NONE, STR_NONE },
{ WWT_CAPTION, 0, 1, WW - 2, 1, 14, STR_DEMOLISH_RIDE, STR_WINDOW_TITLE_TIP },
{ WWT_CLOSEBOX, 0, WW - 13, WW - 3, 2, 13, STR_CLOSE_X, STR_CLOSE_WINDOW_TIP },
{ WWT_DROPDOWN_BUTTON, 0, 10, 94, WH - 20, WH - 9, STR_DEMOLISH, STR_NONE },
{ WWT_DROPDOWN_BUTTON, 0, WW - 95, WW - 11, WH - 20, WH - 9, STR_SAVE_PROMPT_CANCEL, STR_NONE },
{ WIDGETS_END }
};
static void window_ride_demolish_emptysub(){}
static void window_ride_demolish_mouseup();
static void window_ride_demolish_paint();
//0x0098E2E4
static void* window_ride_demolish_events[] = {
window_ride_demolish_emptysub,
window_ride_demolish_mouseup,
window_ride_demolish_emptysub,
window_ride_demolish_emptysub,
window_ride_demolish_emptysub,
window_ride_demolish_emptysub,
window_ride_demolish_emptysub,
window_ride_demolish_emptysub,
window_ride_demolish_emptysub,
window_ride_demolish_emptysub,
window_ride_demolish_emptysub,
window_ride_demolish_emptysub,
window_ride_demolish_emptysub,
window_ride_demolish_emptysub,
window_ride_demolish_emptysub,
window_ride_demolish_emptysub,
window_ride_demolish_emptysub,
window_ride_demolish_emptysub,
window_ride_demolish_emptysub,
window_ride_demolish_emptysub,
window_ride_demolish_emptysub,
window_ride_demolish_emptysub,
window_ride_demolish_emptysub,
window_ride_demolish_emptysub,
window_ride_demolish_emptysub,
window_ride_demolish_emptysub,
window_ride_demolish_paint,
window_ride_demolish_emptysub
};
/** Based off of rct2: 0x006B486A */
void window_ride_demolish_prompt_open(int rideIndex){
rct_window *w;
w = window_bring_to_front_by_number(WC_DEMOLISH_RIDE_PROMPT, rideIndex);
if (w != NULL)
return;
// Find center of the screen.
int screen_height = RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_HEIGHT, sint16);
int screen_width = RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_WIDTH, sint16);
int x = screen_width / 2 - WW / 2;
int y = screen_height / 2 - WH / 2;
w = window_create(x, y, WW, WH, (uint32*)window_ride_demolish_events, WC_DEMOLISH_RIDE_PROMPT, 0);
w->widgets = window_ride_demolish_widgets;
w->enabled_widgets = (1 << WIDX_CLOSE) | (1 << WIDX_CANCEL) | (1 << WIDX_DEMOLISH);
window_init_scroll_widgets(w);
w->flags |= WF_TRANSPARENT;
w->number = rideIndex;
w->colours[0] = 154;
}
/**
*
* rct2: 0x006B4933
*/
static void window_ride_demolish_mouseup(){
short widgetIndex;
rct_window *w;
window_widget_get_registers(w, widgetIndex);
switch (widgetIndex){
case WIDX_DEMOLISH:
RCT2_GLOBAL(RCT2_ADDRESS_GAME_COMMAND_ERROR_STRING_ID, rct_string_id) = STR_CANT_DEMOLISH_RIDE;
game_do_command(0, 1, 0, w->number, GAME_COMMAND_7, 0, 0);
break;
case WIDX_CANCEL:
case WIDX_CLOSE:
window_close(w);
}
}
/**
*
* rct2: 0x006B48E5
*/
static void window_ride_demolish_paint(){
rct_window *w;
rct_drawpixelinfo *dpi;
window_paint_get_registers(w, dpi);
window_draw_widgets(w, dpi);
rct_ride* ride = GET_RIDE(w->number);
RCT2_GLOBAL(0x13CE952, uint16) = ride->name;
RCT2_GLOBAL(0x13CE954, uint32) = ride->name_arguments;
int x = w->x + WW / 2;
int y = w->y + (WH / 2) - 3;
gfx_draw_string_centred_wrapped(dpi, (void*)0x13CE952, x, y, WW - 4, STR_DEMOLISH_RIDE_ID, 0);
}

View File

@@ -72,18 +72,6 @@ static void* window_error_events[] = {
static char _window_error_text[512];
static uint16 _window_error_num_lines;
/**
*
* rct2: 0x006C23B1
*/
int sub_6C23B1(char *text)
{
int eax, ebx, ecx, edx, esi, edi, ebp;
esi = (int)text;
RCT2_CALLFUNC_X(0x006C23B1, &eax, &ebx, &ecx, &edx, &esi, &edi, &ebp);
return *((sint16*)&ecx);
}
/**
*
* rct2: 0x0066792F
@@ -120,7 +108,7 @@ void window_error_open(rct_string_id title, rct_string_id message)
return;
RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_FONT_SPRITE_BASE, uint16) = 224;
width = sub_6C23B1(_window_error_text);
width = gfx_get_string_width_new_lined(_window_error_text);
width = min(196, width);
RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_FONT_SPRITE_BASE, uint16) = 224;

View File

@@ -1437,33 +1437,6 @@ static void window_ride_locate(rct_window *w)
window_scroll_to_location(mainWindow, x, y, z);
}
/**
*
* rct2: 0x006B486A
*/
static void window_ride_demolish(rct_window *w)
{
rct_window *demolishWindow;
int x, y, screenWidth, screenHeight;
demolishWindow = window_bring_to_front_by_number(WC_DEMOLISH_RIDE_PROMPT, w->number);
if (demolishWindow != NULL)
return;
screenWidth = RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_WIDTH, sint16);
screenHeight = RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_HEIGHT, sint16);
x = screenWidth / 2 - 100;
y = max(28, screenHeight / 2 - 50);
demolishWindow = window_create(x, y, 200, 100, (uint32*)0x0098E2E4, WC_DEMOLISH_RIDE_PROMPT, 0);
demolishWindow->widgets = (rct_widget*)0x009AEBA0;
demolishWindow->enabled_widgets = 4 | 8 | 16;
window_init_scroll_widgets(demolishWindow);
demolishWindow->flags |= WF_TRANSPARENT;
demolishWindow->number = w->number;
demolishWindow->colours[0] = 154;
}
/**
*
* rct2: 0x006AF17E
@@ -1501,7 +1474,7 @@ static void window_ride_main_mouseup()
window_ride_locate(w);
break;
case WIDX_DEMOLISH:
window_ride_demolish(w);
window_ride_demolish_prompt_open(w->number);
break;
}
}

678
src/windows/sign.c Normal file
View File

@@ -0,0 +1,678 @@
/*****************************************************************************
* Copyright (c) 2014 Ted John, Dennis Devriendt
* OpenRCT2, an open source clone of Roller Coaster Tycoon 2.
*
* This file is part of OpenRCT2.
*
* OpenRCT2 is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*****************************************************************************/
#include <string.h>
#include "../addresses.h"
#include "../game.h"
#include "../config.h"
#include "../localisation/localisation.h"
#include "../interface/viewport.h"
#include "../interface/widget.h"
#include "../interface/window.h"
#include "../ride/ride.h"
#include "../world/map.h"
#include "../world/banner.h"
#include "../world/scenery.h"
#include "error.h"
#include "dropdown.h"
#include "../drawing/drawing.h"
#define WW 113
#define WH 96
enum WINDOW_SIGN_WIDGET_IDX {
WIDX_BACKGROUND,
WIDX_TITLE,
WIDX_CLOSE,
WIDX_VIEWPORT,
WIDX_SIGN_TEXT,
WIDX_SIGN_DEMOLISH,
WIDX_MAIN_COLOR,
WIDX_TEXT_COLOR
};
// 0x9AEE00
rct_widget window_sign_widgets[] = {
{ WWT_FRAME, 0, 0, WW - 1, 0, WH - 1, 0x0FFFFFFFF, 65535 }, // panel / background
{ WWT_CAPTION, 0, 1, WW - 2, 1, 14, STR_SIGN, STR_WINDOW_TITLE_TIP }, // title bar
{ WWT_CLOSEBOX, 0, WW - 13, WW - 3, 2, 13, STR_CLOSE_X, STR_CLOSE_WINDOW_TIP }, // close x button
{ WWT_VIEWPORT, 1, 3, WW - 26, 17, WH - 20, 0x0FFFFFFFE, 65535 }, // Viewport
{ WWT_FLATBTN, 1, WW - 25, WW - 2, 19, 42, 5168, STR_CHANGE_SIGN_TEXT_TIP }, // change sign button
{ WWT_FLATBTN, 1, WW - 25, WW - 2, 67, 90, 5165, STR_DEMOLISH_SIGN_TIP }, // demolish button
{ WWT_COLORBTN, 1, 5, 16, WH - 16, WH - 5, 0x0FFFFFFFF, STR_SELECT_MAIN_COLOR_TIP },// Main colour
{ WWT_COLORBTN, 1, 17, 28, WH - 16, WH - 5, 0x0FFFFFFFF, STR_SELECT_TEXT_COLOR_TIP },// Text colour
{ WIDGETS_END },
};
static void window_sign_emptysub() { }
static void window_sign_mouseup();
static void window_sign_mousedown(int widgetIndex, rct_window*w, rct_widget* widget);
static void window_sign_dropdown();
static void window_sign_textinput();
static void window_sign_invalidate();
static void window_sign_paint();
static void window_sign_unknown_14();
// 0x98E44C
static void* window_sign_events[] = {
window_sign_emptysub,
window_sign_mouseup,
window_sign_emptysub,
window_sign_mousedown,
window_sign_dropdown,
window_sign_emptysub,
window_sign_emptysub,
window_sign_emptysub,
window_sign_emptysub,
window_sign_emptysub,
window_sign_emptysub,
window_sign_emptysub,
window_sign_emptysub,
window_sign_emptysub,
window_sign_emptysub,
window_sign_emptysub,
window_sign_emptysub,
window_sign_emptysub,
window_sign_emptysub,
window_sign_textinput,
window_sign_unknown_14,
window_sign_emptysub,
window_sign_emptysub,
window_sign_emptysub,
window_sign_emptysub,
window_sign_invalidate,
window_sign_paint,
window_sign_emptysub
};
static void window_sign_small_mouseup();
static void window_sign_small_dropdown();
static void window_sign_small_invalidate();
// 0x9A410C
static void* window_sign_small_events[] = {
window_sign_emptysub,
window_sign_small_mouseup,
window_sign_emptysub,
window_sign_mousedown,
window_sign_small_dropdown,
window_sign_emptysub,
window_sign_emptysub,
window_sign_emptysub,
window_sign_emptysub,
window_sign_emptysub,
window_sign_emptysub,
window_sign_emptysub,
window_sign_emptysub,
window_sign_emptysub,
window_sign_emptysub,
window_sign_emptysub,
window_sign_emptysub,
window_sign_emptysub,
window_sign_emptysub,
window_sign_textinput,
window_sign_unknown_14,
window_sign_emptysub,
window_sign_emptysub,
window_sign_emptysub,
window_sign_emptysub,
window_sign_small_invalidate,
window_sign_paint,
window_sign_emptysub
};
/**
*
* rct2: 0x006BA305
*/
void window_sign_open(rct_windownumber number)
{
rct_window* w;
rct_widget *viewportWidget;
// Check if window is already open
w = window_bring_to_front_by_number(WC_BANNER, number);
if (w != NULL)
return;
w = window_create_auto_pos(WW, WH, (uint32*)window_sign_events, WC_BANNER, 0);
w->widgets = window_sign_widgets;
w->enabled_widgets =
(1 << WIDX_CLOSE) |
(1 << WIDX_SIGN_TEXT) |
(1 << WIDX_SIGN_DEMOLISH) |
(1 << WIDX_MAIN_COLOR) |
(1 << WIDX_TEXT_COLOR);
w->number = number;
window_init_scroll_widgets(w);
w->colours[0] = 24;
w->colours[1] = 24;
w->colours[2] = 24;
int view_x = gBanners[w->number].x << 5;
int view_y = gBanners[w->number].y << 5;
int ebp = ((view_y << 8) | view_x) >> 5;
rct_map_element* map_element = TILE_MAP_ELEMENT_POINTER(ebp);
while (1){
if ((map_element->type & MAP_ELEMENT_TYPE_MASK) == MAP_ELEMENT_TYPE_SCENERY_MULTIPLE){
int ebx = map_element->properties.scenerymultiple.type;
ebx |= (map_element->properties.scenerymultiple.index & 0x3) << 8;
rct_scenery_entry* scenery_entry = g_largeSceneryEntries[ebx];
if (scenery_entry->large_scenery.var_11 != 0xFF){
int id = (map_element->type & 0xC0) |
((map_element->properties.scenerymultiple.colour[0] & 0xE0) >> 2) |
((map_element->properties.scenerymultiple.colour[1] & 0xE0) >> 5);
if (id == w->number)
break;
}
}
map_element++;
}
int view_z = map_element->base_height << 3;
w->frame_no = view_z;
w->list_information_type = map_element->properties.scenerymultiple.colour[0] & 0x1F;
w->var_492 = map_element->properties.scenerymultiple.colour[1] & 0x1F;
w->var_48C = map_element->properties.scenerymultiple.type;
view_x += 16;
view_y += 16;
// Create viewport
viewportWidget = &window_sign_widgets[WIDX_VIEWPORT];
viewport_create(
w,
w->x + viewportWidget->left + 1,
w->y + viewportWidget->top + 1,
(viewportWidget->right - viewportWidget->left) - 1,
(viewportWidget->bottom - viewportWidget->top) - 1,
0,
view_x,
view_y,
view_z,
0,
-1
);
w->viewport->flags = (RCT2_GLOBAL(RCT2_ADDRESS_CONFIG_FLAGS, uint8) & CONFIG_FLAG_ALWAYS_SHOW_GRIDLINES) ? VIEWPORT_FLAG_GRIDLINES : 0;
w->flags |= WF_2;
window_invalidate(w);
}
/* rct2: 0x6B9765*/
static void window_sign_mouseup()
{
short widgetIndex;
rct_window *w;
window_widget_get_registers(w, widgetIndex);
rct_banner* banner = &gBanners[w->number];
int x = banner->x << 5;
int y = banner->y << 5;
rct_string_id string_id;
rct_map_element* map_element = TILE_MAP_ELEMENT_POINTER(((y << 8) | x) >> 5);
switch (widgetIndex) {
case WIDX_CLOSE:
window_close(w);
break;
case WIDX_SIGN_DEMOLISH:
while (1){
if ((map_element->type & MAP_ELEMENT_TYPE_MASK) == MAP_ELEMENT_TYPE_SCENERY_MULTIPLE){
int ebx = map_element->properties.scenerymultiple.type;
ebx |= (map_element->properties.scenerymultiple.index & 0x3) << 8;
rct_scenery_entry* scenery_entry = g_largeSceneryEntries[ebx];
if (scenery_entry->large_scenery.var_11 != 0xFF){
int id = (map_element->type & 0xC0) |
((map_element->properties.scenerymultiple.colour[0] & 0xE0) >> 2) |
((map_element->properties.scenerymultiple.colour[1] & 0xE0) >> 5);
if (id == w->number)
break;
}
}
map_element++;
}
game_do_command(
x,
1 | ((map_element->type&0x3) << 8),
y,
map_element->base_height | ((map_element->properties.scenerymultiple.index >> 2) << 8),
GAME_COMMAND_44,
0,
0);
break;
case WIDX_SIGN_TEXT:
if (banner->flags&BANNER_FLAG_2){
rct_ride* ride = GET_RIDE(banner->colour);
RCT2_GLOBAL(0x13CE962, uint32) = ride->name_arguments;
string_id = ride->name;
}
else
{
string_id = gBanners[w->number].string_idx;
}
window_text_input_open(w, WIDX_SIGN_TEXT, 2992, 2993, string_id, 0);
break;
}
}
/* rct2: 0x6B9784 & 0x6E6164 */
static void window_sign_mousedown(int widgetIndex, rct_window*w, rct_widget* widget)
{
rct_banner* banner = &gBanners[w->number];
switch (widgetIndex) {
case WIDX_MAIN_COLOR:
window_dropdown_show_colour(w, widget, w->colours[1] | 0x80, (uint8)w->list_information_type);
break;
case WIDX_TEXT_COLOR:
window_dropdown_show_colour(w, widget, w->colours[1] | 0x80, (uint8)w->var_492);
break;
}
}
/* rct2: 0x6B979C */
static void window_sign_dropdown()
{
short widgetIndex, dropdownIndex;
rct_window* w;
window_dropdown_get_registers(w, widgetIndex, dropdownIndex);
switch (widgetIndex){
case WIDX_MAIN_COLOR:
if (dropdownIndex == -1) return;
w->list_information_type = dropdownIndex;
break;
case WIDX_TEXT_COLOR:
if (dropdownIndex == -1) return;
w->var_492 = dropdownIndex;
break;
default:
return;
}
rct_banner* banner = &gBanners[w->number];
int x = banner->x << 5;
int y = banner->y << 5;
rct_map_element* map_element = TILE_MAP_ELEMENT_POINTER(((y << 8) | x) >> 5);
while (1){
if ((map_element->type & MAP_ELEMENT_TYPE_MASK) == MAP_ELEMENT_TYPE_SCENERY_MULTIPLE){
int ebx = map_element->properties.scenerymultiple.type;
ebx |= (map_element->properties.scenerymultiple.index & 0x3) << 8;
rct_scenery_entry* scenery_entry = g_largeSceneryEntries[ebx];
if (scenery_entry->large_scenery.var_11 != 0xFF){
int id = (map_element->type & 0xC0) |
((map_element->properties.scenerymultiple.colour[0] & 0xE0) >> 2) |
((map_element->properties.scenerymultiple.colour[1] & 0xE0) >> 5);
if (id == w->number)
break;
}
}
map_element++;
}
int edx = map_element->base_height | ((map_element->properties.scenerymultiple.index >> 2) << 8);
int ebp = w->list_information_type | (w->var_492 << 8);
int ebx = (map_element->type & 0x3) << 8;
RCT2_CALLPROC_X(0x6B9B05, x, ebx, y, edx, 0, w->number, ebp);
window_invalidate(w);
}
/* rct2: 0x6B9791 & 0x6E6171*/
static void window_sign_textinput()
{
short widgetIndex;
rct_window *w;
uint8 result;
uint8* text;
window_text_input_get_registers(w, widgetIndex, result, text);
rct_banner* banner = &gBanners[w->number];
int x = banner->x << 5;
int y = banner->y << 5;
if (widgetIndex == WIDX_SIGN_TEXT && result) {
if (*text != 0){
int string_id = 0, ebx = 0, ecx = 128, edx = 0, ebp = 0, esi = 0;
RCT2_CALLFUNC_X(0x6C421D, &string_id, &ebx, &ecx, &edx, &esi, (int*)&text, &ebp);
if (string_id){
rct_string_id prev_string_id = banner->string_idx;
banner->string_idx = string_id;
// De-allocate previous string id?
RCT2_CALLPROC_X(0x6C42AC, prev_string_id, 0, 0, 0, 0, 0, 0);
banner->flags &= ~(BANNER_FLAG_2);
gfx_invalidate_screen();
}
else{
window_error_open(2984, RCT2_GLOBAL(RCT2_ADDRESS_GAME_COMMAND_ERROR_TEXT, rct_string_id));
}
}
else{
int eax = x, ebx = 0, ecx = y, edx = 16, ebp = 0, edi = 0, esi = 0;
RCT2_CALLFUNC_X(0x6B7D86, &eax, &ebx, &ecx, &edx, &esi, &edi, &ebp);
if ((eax & 0xFF) == 0xFF)return;
banner->colour = eax & 0xFF;
banner->flags |= BANNER_FLAG_2;
rct_string_id prev_string_id = banner->string_idx;
banner->string_idx = 778;
RCT2_CALLPROC_X(0x6C42AC, prev_string_id, 0, 0, 0, 0, 0, 0);
gfx_invalidate_screen();
}
}
}
/* rct2: 0x006B96F5 */
static void window_sign_invalidate()
{
rct_window* w;
window_get_register(w);
rct_widget* main_colour_btn = &window_sign_widgets[WIDX_MAIN_COLOR];
rct_widget* text_colour_btn = &window_sign_widgets[WIDX_TEXT_COLOR];
rct_scenery_entry* scenery_entry = g_largeSceneryEntries[w->var_48C];
main_colour_btn->type = WWT_EMPTY;
text_colour_btn->type = WWT_EMPTY;
if (scenery_entry->large_scenery.flags&(1 << 0)){
main_colour_btn->type = WWT_COLORBTN;
}
if (scenery_entry->large_scenery.flags&(1 << 1)) {
text_colour_btn->type = WWT_COLORBTN;
}
main_colour_btn->image = (w->list_information_type << 19) | 0x600013C3;
text_colour_btn->image = (w->var_492 << 19) | 0x600013C3;
}
/* rct2: 0x006B9754 & 0x006E6134 */
static void window_sign_paint()
{
rct_window *w;
rct_drawpixelinfo *dpi;
window_paint_get_registers(w, dpi);
window_draw_widgets(w, dpi);
// Draw viewport
if (w->viewport != NULL) {
window_draw_viewport(dpi, w);
}
}
/* rct2: 0x6B9A6C & 0x6E6424 */
static void window_sign_unknown_14()
{
rct_window* w;
window_get_register(w);
rct_viewport* view = w->viewport;
w->viewport = 0;
view->width = 0;
viewport_update_pointers();
rct_banner* banner = &gBanners[w->number];
int view_x = (banner->x << 5) + 16;
int view_y = (banner->y << 5) + 16;
int view_z = w->frame_no;
// Create viewport
rct_widget* viewportWidget = &window_sign_widgets[WIDX_VIEWPORT];
viewport_create(
w,
w->x + viewportWidget->left + 1,
w->y + viewportWidget->top + 1,
(viewportWidget->right - viewportWidget->left) - 1,
(viewportWidget->bottom - viewportWidget->top) - 1,
0,
view_x,
view_y,
view_z,
0,
-1
);
w->viewport->flags = (RCT2_GLOBAL(RCT2_ADDRESS_CONFIG_FLAGS, uint8) & CONFIG_FLAG_ALWAYS_SHOW_GRIDLINES) ? VIEWPORT_FLAG_GRIDLINES : 0;
window_invalidate(w);
}
/* rct2: 0x6E5F52 */
void window_sign_small_open(rct_windownumber number){
rct_window* w;
rct_widget *viewportWidget;
// Check if window is already open
w = window_bring_to_front_by_number(WC_BANNER, number);
if (w != NULL)
return;
w = window_create_auto_pos(WW, WH, (uint32*)window_sign_small_events, WC_BANNER, 0);
w->widgets = window_sign_widgets;
w->enabled_widgets =
(1 << WIDX_CLOSE) |
(1 << WIDX_SIGN_TEXT) |
(1 << WIDX_SIGN_DEMOLISH) |
(1 << WIDX_MAIN_COLOR) |
(1 << WIDX_TEXT_COLOR);
w->number = number;
window_init_scroll_widgets(w);
w->colours[0] = 24;
w->colours[1] = 24;
w->colours[2] = 24;
int view_x = gBanners[w->number].x << 5;
int view_y = gBanners[w->number].y << 5;
int ebp = ((view_y << 8) | view_x) >> 5;
rct_map_element* map_element = TILE_MAP_ELEMENT_POINTER(ebp);
while (1){
if ((map_element->type & MAP_ELEMENT_TYPE_MASK) == MAP_ELEMENT_TYPE_FENCE){
rct_scenery_entry* scenery_entry = g_wallSceneryEntries[map_element->properties.fence.slope];
if (scenery_entry->wall.var_0D != 0xFF){
if (map_element->properties.fence.item[0] == w->number)
break;
}
}
map_element++;
}
int view_z = map_element->base_height << 3;
w->frame_no = view_z;
w->list_information_type = map_element->properties.fence.item[1] & 0x1F;
w->var_492 = (map_element->properties.fence.item[1] >> 5) | ((map_element->flags&0x60) >> 2);
w->var_48C = map_element->properties.fence.slope;
view_x += 16;
view_y += 16;
// Create viewport
viewportWidget = &window_sign_widgets[WIDX_VIEWPORT];
viewport_create(
w,
w->x + viewportWidget->left + 1,
w->y + viewportWidget->top + 1,
(viewportWidget->right - viewportWidget->left) - 1,
(viewportWidget->bottom - viewportWidget->top) - 1,
0,
view_x,
view_y,
view_z,
0,
-1
);
w->viewport->flags = (RCT2_GLOBAL(RCT2_ADDRESS_CONFIG_FLAGS, uint8) & CONFIG_FLAG_ALWAYS_SHOW_GRIDLINES) ? VIEWPORT_FLAG_GRIDLINES : 0;
w->flags |= WF_2;
window_invalidate(w);
}
/* rct2: 0x6E6145 */
static void window_sign_small_mouseup()
{
short widgetIndex;
rct_window *w;
window_widget_get_registers(w, widgetIndex);
rct_banner* banner = &gBanners[w->number];
int x = banner->x << 5;
int y = banner->y << 5;
rct_string_id string_id;
rct_map_element* map_element = TILE_MAP_ELEMENT_POINTER(((y << 8) | x) >> 5);
switch (widgetIndex) {
case WIDX_CLOSE:
window_close(w);
break;
case WIDX_SIGN_DEMOLISH:
while (1){
if ((map_element->type & MAP_ELEMENT_TYPE_MASK) == MAP_ELEMENT_TYPE_FENCE){
rct_scenery_entry* scenery_entry = g_wallSceneryEntries[map_element->properties.fence.slope];
if (scenery_entry->wall.var_0D != 0xFF){
if (map_element->properties.fence.item[0] == w->number)
break;
}
}
map_element++;
}
RCT2_GLOBAL(RCT2_ADDRESS_GAME_COMMAND_ERROR_STRING_ID, rct_string_id) = 1158;
game_do_command(
x,
1 | ((map_element->type & 0x3) << 8),
y,
(map_element->base_height << 8) | (map_element->type & 0x3),
GAME_COMMAND_42,
0,
0);
break;
case WIDX_SIGN_TEXT:
if (banner->flags&BANNER_FLAG_2){
rct_ride* ride = GET_RIDE(banner->colour);
RCT2_GLOBAL(0x13CE962, uint32) = ride->name_arguments;
string_id = ride->name;
}
else
{
string_id = gBanners[w->number].string_idx;
}
window_text_input_open(w, WIDX_SIGN_TEXT, 2992, 2993, string_id, 0);
break;
}
}
/* rct2: 0x6E617C */
static void window_sign_small_dropdown()
{
short widgetIndex, dropdownIndex;
rct_window* w;
window_dropdown_get_registers(w, widgetIndex, dropdownIndex);
switch (widgetIndex){
case WIDX_MAIN_COLOR:
if (dropdownIndex == -1) return;
w->list_information_type = dropdownIndex;
break;
case WIDX_TEXT_COLOR:
if (dropdownIndex == -1) return;
w->var_492 = dropdownIndex;
break;
default:
return;
}
rct_banner* banner = &gBanners[w->number];
int x = banner->x << 5;
int y = banner->y << 5;
rct_map_element* map_element = TILE_MAP_ELEMENT_POINTER(((y << 8) | x) >> 5);
while (1){
if ((map_element->type & MAP_ELEMENT_TYPE_MASK) == MAP_ELEMENT_TYPE_FENCE){
rct_scenery_entry* scenery_entry = g_wallSceneryEntries[map_element->properties.fence.slope];
if (scenery_entry->wall.var_0D != 0xFF){
if (map_element->properties.fence.item[0] == w->number)
break;
}
}
map_element++;
}
map_element->flags &= 0x9F;
map_element->properties.fence.item[1] =
w->list_information_type |
((w->var_492 & 0x7) << 5);
map_element->flags |= ((w->var_492 & 0x18) << 2);
RCT2_CALLPROC_X(0x6EC847, x, 0, y, 0, map_element->clearance_height << 3, map_element->base_height << 3, 0);
window_invalidate(w);
}
/* rct2: 0x006E60D5 */
static void window_sign_small_invalidate()
{
rct_window* w;
window_get_register(w);
rct_widget* main_colour_btn = &window_sign_widgets[WIDX_MAIN_COLOR];
rct_widget* text_colour_btn = &window_sign_widgets[WIDX_TEXT_COLOR];
rct_scenery_entry* scenery_entry = g_wallSceneryEntries[w->var_48C];
main_colour_btn->type = WWT_EMPTY;
text_colour_btn->type = WWT_EMPTY;
if (scenery_entry->wall.flags&(1 << 0)){
main_colour_btn->type = WWT_COLORBTN;
}
if (scenery_entry->wall.flags&(1 << 6)) {
text_colour_btn->type = WWT_COLORBTN;
}
main_colour_btn->image = (w->list_information_type << 19) | 0x600013C3;
text_colour_btn->image = (w->var_492 << 19) | 0x600013C3;
}

View File

@@ -73,14 +73,15 @@ static void* window_tooltip_events[] = {
void window_tooltip_reset(int x, int y)
{
RCT2_GLOBAL(RCT2_ADDRESS_TOOLTIP_CURSOR_X, uint8) = x;
RCT2_GLOBAL(RCT2_ADDRESS_TOOLTIP_CURSOR_Y, uint8) = y;
RCT2_GLOBAL(RCT2_ADDRESS_TOOLTIP_TIMEOUT, uint8) = 0;
RCT2_GLOBAL(RCT2_ADDRESS_TOOLTIP_CURSOR_X, uint16) = x;
RCT2_GLOBAL(RCT2_ADDRESS_TOOLTIP_CURSOR_Y, uint16) = y;
RCT2_GLOBAL(RCT2_ADDRESS_TOOLTIP_TIMEOUT, uint16) = 0;
RCT2_GLOBAL(RCT2_ADDRESS_TOOLTIP_WINDOW_CLASS, uint8) = 255;
RCT2_GLOBAL(RCT2_ADDRESS_INPUT_STATE, uint8) = 1;
RCT2_GLOBAL(RCT2_ADDRESS_INPUT_FLAGS, uint32) &= ~(1 << 4);
}
extern uint8* gTooltip_text_buffer = RCT2_ADDRESS(RCT2_ADDRESS_TOOLTIP_TEXT_BUFFER, uint8);
/**
*
* rct2: 0x006EA10D
@@ -120,9 +121,9 @@ void window_tooltip_open(rct_window *widgetWindow, int widgetIndex, int x, int y
format_string(buffer, widget->tooltip, (void*)0x013CE952);
RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_FONT_SPRITE_BASE, uint16) = 224;
int tooltip_text_width = ecx, tooltip_text_height = 0;
//gfx_get_string_width_new_lined
RCT2_CALLFUNC_X(0x006C23B1, &eax, &ebx, &tooltip_text_width, &edx, (int*)(&buffer), &edi, &ebp);
int tooltip_text_width = 0, tooltip_text_height = 0;
tooltip_text_width = gfx_get_string_width_new_lined(buffer);
buffer = RCT2_ADDRESS(RCT2_ADDRESS_COMMON_STRING_FORMAT_BUFFER, char);
tooltip_text_width &= 0xFFFF;
if (tooltip_text_width > 196)
@@ -131,13 +132,13 @@ void window_tooltip_open(rct_window *widgetWindow, int widgetIndex, int x, int y
RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_FONT_SPRITE_BASE, uint16) = 224;
tooltip_text_width = gfx_wrap_string(buffer, tooltip_text_width + 1, &tooltip_text_height, &ebx);
RCT2_GLOBAL(0x01420044, sint16) = tooltip_text_height;
RCT2_GLOBAL(RCT2_ADDRESS_TOOLTIP_TEXT_HEIGHT, sint16) = tooltip_text_height;
width = tooltip_text_width + 3;
height = ((tooltip_text_height + 1) * 10) + 4;
window_tooltip_widgets[WIDX_BACKGROUND].right = width;
window_tooltip_widgets[WIDX_BACKGROUND].bottom = height;
memcpy((void*)0x0141FE44, (void*)buffer, 512);
memcpy(gTooltip_text_buffer, buffer, 512);
x = clamp(0, x - (width / 2), RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_WIDTH, uint16) - width);
y = clamp(22, y + 26, RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_HEIGHT, uint16) - height - 40);
@@ -215,5 +216,5 @@ static void window_tooltip_paint()
// Text
left = w->x + ((w->width + 1) / 2) - 1;
top = w->y + 1;
draw_string_centred_raw(dpi, left, top, RCT2_GLOBAL(0x01420044, uint16), (char*)0x0141FE44);
draw_string_centred_raw(dpi, left, top, RCT2_GLOBAL(RCT2_ADDRESS_TOOLTIP_TEXT_HEIGHT, uint16), gTooltip_text_buffer);
}

View File

@@ -27,7 +27,7 @@
typedef struct {
uint8 var_00;
uint8 flags; //bit 0 is no entry
uint8 flags; //0x01 bit 0 is no entry
rct_string_id string_idx; //0x02
uint8 colour; //0x04
uint8 text_colour; //0x05
@@ -36,7 +36,8 @@ typedef struct {
} rct_banner;
enum{
BANNER_FLAG_NO_ENTRY = (1<<0)
BANNER_FLAG_NO_ENTRY = (1<<0),
BANNER_FLAG_2 = (1<<2)
} BANNER_FLAGS;
extern rct_banner *gBanners;

View File

@@ -31,42 +31,42 @@ typedef struct {
} rct_map_element_surface_properties;
typedef struct {
uint8 type;
uint8 additions;
uint8 edges;
uint8 addition_status;
uint8 type; //4
uint8 additions; //5
uint8 edges; //6
uint8 addition_status; //7
} rct_map_element_path_properties;
typedef struct {
uint8 type;
uint8 sequence;
uint8 colour;
uint8 ride_index;
uint8 type; //4
uint8 sequence; //5
uint8 colour; //6
uint8 ride_index; //7
} rct_map_element_track_properties;
typedef struct {
uint8 type;
uint8 age;
uint8 colour;
uint8 unused;
uint8 type; //4
uint8 age; //5
uint8 colour; //6
uint8 unused; //7
} rct_map_element_scenery_properties;
typedef struct {
uint8 type;
uint8 index;
uint8 path_type;
uint8 ride_index;
uint8 type; //4
uint8 index; //5
uint8 path_type; //6
uint8 ride_index; //7
} rct_map_element_entrance_properties;
typedef struct {
uint8 slope;
uint8 item[3];
uint8 slope; //4
uint8 item[3]; //5
} rct_map_element_fence_properties;
typedef struct {
uint8 type;
uint8 index;
uint8 colour[2];
uint8 type; //4
uint8 index; //5
uint8 colour[2]; //6
} rct_map_element_scenerymultiple_properties;
typedef struct {

View File

@@ -61,6 +61,7 @@ typedef struct {
uint16 price; // 0x08
uint8 pad_0A[6];
uint8 scenery_tab_id; // 0x10
uint8 var_11;
} rct_large_scenery_entry;
@@ -71,6 +72,7 @@ typedef struct {
uint8 flags2; // 0x09
uint16 price; // 0x0A
uint8 scenery_tab_id; // 0x0C
uint8 var_0D;
} rct_wall_scenery_entry;
typedef enum {