mirror of
https://github.com/OpenRCT2/OpenRCT2
synced 2026-01-18 20:43:04 +01:00
Resolved Merge Conflicts
This commit is contained in:
@@ -24,8 +24,8 @@
|
||||
#include "colour_schemes.h"
|
||||
|
||||
window_colour_scheme gColourSchemes[] = {
|
||||
{ WC_TOP_TOOLBAR, { 7, 12, 24, 1, 0, 0 }, 4, 5178, "top_toolbar" },
|
||||
{ WC_BOTTOM_TOOLBAR, { 140, 140, 0, 14, 0, 0 }, 4, 5179, "bottom_toolbar" },
|
||||
{ WC_TOP_TOOLBAR, { 7, 12, 24, 1, 0, 0 }, 4, 5245, "top_toolbar" },
|
||||
{ WC_BOTTOM_TOOLBAR, { 140, 140, 0, 14, 0, 0 }, 4, 5246, "bottom_toolbar" },
|
||||
{ WC_RIDE, { 1, 26, 11, 0, 0, 0 }, 3, 5203, "ride" },
|
||||
{ WC_RIDE_CONSTRUCTION, { 24, 24, 24, 0, 0, 0 }, 3, 5199, "ride_construction" },
|
||||
{ WC_RIDE_LIST, { 1, 26, 26, 0, 0, 0 }, 3, 5204, "ride_list" },
|
||||
@@ -41,12 +41,12 @@ window_colour_scheme gColourSchemes[] = {
|
||||
{ WC_GUEST_LIST, { 1, 15, 15, 0, 0, 0 }, 3, 5206, "guest_list" },
|
||||
{ WC_STAFF_LIST, { 1, 4, 4, 0, 0, 0 }, 3, 5208, "staff_list" },
|
||||
{ WC_FIRE_PROMPT, { 154, 0, 0, 0, 0, 0 }, 1, 5225, "staff_fire_prompt" },
|
||||
{ WC_PARK_INFORMATION, { 1, 19, 19, 0, 0, 0 }, 3, 5186, "park_information" },
|
||||
{ WC_PARK_INFORMATION, { 1, 19, 19, 0, 0, 0 }, 3, 5253, "park_information" },
|
||||
{ WC_FINANCES, { 1, 19, 19, 0, 0, 0 }, 3, 5187, "finances" },
|
||||
{ WC_TITLE_MENU, { 140, 140, 140, 0, 0, 0 }, 3, 5182, "title_menu" },
|
||||
{ WC_TITLE_EXIT, { 140, 140, 140, 0, 0, 0 }, 3, 5183, "title_exit" },
|
||||
{ WC_TITLE_MENU, { 140, 140, 140, 0, 0, 0 }, 3, 5249, "title_menu" },
|
||||
{ WC_TITLE_EXIT, { 140, 140, 140, 0, 0, 0 }, 3, 5250, "title_exit" },
|
||||
{ WC_RECENT_NEWS, { 1, 1, 0, 0, 0, 0 }, 3, 5192, "recent_news" },
|
||||
{ WC_SCENARIO_SELECT, { 1, 26, 26, 0, 0, 0 }, 3, 5185, "scenario_select" },
|
||||
{ WC_SCENARIO_SELECT, { 1, 26, 26, 0, 0, 0 }, 3, 5252, "scenario_select" },
|
||||
{ WC_TRACK_DESIGN_LIST, { 26, 26, 26, 0, 0, 0 }, 3, 5202, "track_design_list" },
|
||||
{ WC_TRACK_DESIGN_PLACE, { 24, 24, 24, 0, 0, 0 }, 3, 5200, "track_design_place" },
|
||||
{ WC_NEW_CAMPAIGN, { 19, 19, 19, 0, 0, 0 }, 3, 5188, "new_campaign" },
|
||||
@@ -68,12 +68,12 @@ window_colour_scheme gColourSchemes[] = {
|
||||
{ WC_MAPGEN, { 12, 24, 24, 0, 0, 0 }, 3, 5214, "map_generation" },
|
||||
{ WC_LOADSAVE, { 7, 7, 7, 0, 0, 0 }, 3, 5222, "loadsave" },
|
||||
{ WC_LOADSAVE_OVERWRITE_PROMPT, { 154, 0, 0, 0, 0, 0 }, 1, 5227, "loadsave_overwrite_prompt" },
|
||||
{ WC_TITLE_OPTIONS, { 140, 140, 140, 0, 0, 0 }, 3, 5184, "title_options" },
|
||||
{ WC_TITLE_OPTIONS, { 140, 140, 140, 0, 0, 0 }, 3, 5251, "title_options" },
|
||||
{ WC_LAND_RIGHTS, { 19, 19, 19, 0, 0, 0 }, 3, 5196, "land_rights" },
|
||||
{ WC_COLOUR_SCHEMES, { 1, 12, 12, 0, 0, 0 }, 3, 5218, "colour_schemes" },
|
||||
{ WC_STAFF, { 1, 4, 4, 0, 0, 0 }, 3, 5207, "staff" },
|
||||
{ WC_EDITOR_TRACK_BOTTOM_TOOLBAR, { 135, 135, 135, 0, 0, 0 }, 3, 5180, "editor_track_bottom_toolbar" },
|
||||
{ WC_EDITOR_SCENARIO_BOTTOM_TOOLBAR, { 150, 150, 141, 0, 0, 0 }, 3, 5181, "editor_scenario_bottom_toolbar" },
|
||||
{ WC_EDITOR_TRACK_BOTTOM_TOOLBAR, { 135, 135, 135, 0, 0, 0 }, 3, 5247, "editor_track_bottom_toolbar" },
|
||||
{ WC_EDITOR_SCENARIO_BOTTOM_TOOLBAR, { 150, 150, 141, 0, 0, 0 }, 3, 5248, "editor_scenario_bottom_toolbar" },
|
||||
};
|
||||
|
||||
|
||||
|
||||
@@ -25,9 +25,11 @@
|
||||
#include "../drawing/drawing.h"
|
||||
#include "../game.h"
|
||||
#include "../localisation/localisation.h"
|
||||
#include "../openrct2.h"
|
||||
#include "../platform/platform.h"
|
||||
#include "../windows/error.h"
|
||||
#include "screenshot.h"
|
||||
#include "viewport.h"
|
||||
|
||||
static const char *_screenshot_format_extension[] = { ".bmp", ".png" };
|
||||
|
||||
@@ -273,4 +275,174 @@ int screenshot_dump_png()
|
||||
|
||||
free(png);
|
||||
return index;
|
||||
}
|
||||
|
||||
bool screenshot_write_png(rct_drawpixelinfo *dpi, const char *path)
|
||||
{
|
||||
unsigned int error;
|
||||
unsigned char* png;
|
||||
size_t pngSize;
|
||||
LodePNGState state;
|
||||
|
||||
lodepng_state_init(&state);
|
||||
state.info_raw.colortype = LCT_PALETTE;
|
||||
|
||||
// Get image size
|
||||
int stride = (dpi->width + 3) & ~3;
|
||||
|
||||
for (int i = 0; i < 256; i++) {
|
||||
unsigned char r, g, b, a = 255;
|
||||
|
||||
b = RCT2_ADDRESS(0x01424680, uint8)[i * 4 + 0];
|
||||
g = RCT2_ADDRESS(0x01424680, uint8)[i * 4 + 1];
|
||||
r = RCT2_ADDRESS(0x01424680, uint8)[i * 4 + 2];
|
||||
|
||||
lodepng_palette_add(&state.info_raw, r, g, b, a);
|
||||
}
|
||||
|
||||
error = lodepng_encode(&png, &pngSize, dpi->bits, stride, dpi->height, &state);
|
||||
if (error != 0) {
|
||||
free(png);
|
||||
return false;
|
||||
} else {
|
||||
error = lodepng_save_file(png, pngSize, path);
|
||||
if (error != 0) {
|
||||
free(png);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
free(png);
|
||||
return true;
|
||||
}
|
||||
|
||||
int cmdline_for_screenshot(const char **argv, int argc)
|
||||
{
|
||||
bool giantScreenshot = argc == 5 && _stricmp(argv[2], "giant") == 0;
|
||||
if (argc != 4 && argc != 8 && !giantScreenshot) {
|
||||
printf("Usage: openrct2 screenshot <file> <ouput_image> <width> <height> [<x> <y> <zoom> <rotation>]\n");
|
||||
printf("Usage: openrct2 screenshot <file> <ouput_image> giant <zoom> <rotation>\n");
|
||||
return -1;
|
||||
}
|
||||
|
||||
bool customLocation = false;
|
||||
bool centreMapX = false;
|
||||
bool centreMapY = false;
|
||||
int resolutionWidth, resolutionHeight, customX, customY, customZoom, customRotation;
|
||||
|
||||
const char *inputPath = argv[0];
|
||||
const char *outputPath = argv[1];
|
||||
if (giantScreenshot) {
|
||||
resolutionWidth = 0;
|
||||
resolutionHeight = 0;
|
||||
customLocation = true;
|
||||
centreMapX = true;
|
||||
centreMapY = true;
|
||||
customZoom = atoi(argv[3]);
|
||||
customRotation = atoi(argv[4]) & 3;
|
||||
} else {
|
||||
resolutionWidth = atoi(argv[2]);
|
||||
resolutionHeight = atoi(argv[3]);
|
||||
if (argc == 8) {
|
||||
customLocation = true;
|
||||
if (argv[4][0] == 'c')
|
||||
centreMapX = true;
|
||||
else
|
||||
customX = atoi(argv[4]);
|
||||
if (argv[5][0] == 'c')
|
||||
centreMapY = true;
|
||||
else
|
||||
customY = atoi(argv[5]);
|
||||
|
||||
customZoom = atoi(argv[6]);
|
||||
customRotation = atoi(argv[7]) & 3;
|
||||
}
|
||||
}
|
||||
|
||||
gOpenRCT2Headless = true;
|
||||
if (openrct2_initialise()) {
|
||||
rct2_open_file(inputPath);
|
||||
|
||||
RCT2_GLOBAL(RCT2_ADDRESS_RUN_INTRO_TICK_PART, uint8) = 0;
|
||||
RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_FLAGS, uint8) = SCREEN_FLAGS_PLAYING;
|
||||
|
||||
int mapSize = RCT2_GLOBAL(RCT2_ADDRESS_MAP_SIZE, uint16);
|
||||
if (resolutionWidth == 0 || resolutionHeight == 0) {
|
||||
resolutionWidth = (mapSize * 32 * 2) >> customZoom;
|
||||
resolutionHeight = (mapSize * 32 * 1) >> customZoom;
|
||||
|
||||
resolutionWidth += 8;
|
||||
resolutionHeight += 128;
|
||||
}
|
||||
|
||||
rct_viewport viewport;
|
||||
viewport.x = 0;
|
||||
viewport.y = 0;
|
||||
viewport.width = resolutionWidth;
|
||||
viewport.height = resolutionHeight;
|
||||
viewport.view_width = viewport.width;
|
||||
viewport.view_height = viewport.height;
|
||||
viewport.var_11 = 0;
|
||||
viewport.flags = 0;
|
||||
|
||||
if (customLocation) {
|
||||
if (centreMapX)
|
||||
customX = (mapSize / 2) * 32 + 16;
|
||||
if (centreMapY)
|
||||
customY = (mapSize / 2) * 32 + 16;
|
||||
|
||||
int x, y;
|
||||
int z = map_element_height(customX, customY) & 0xFFFF;
|
||||
switch (customRotation) {
|
||||
case 0:
|
||||
x = customY - customX;
|
||||
y = ((customX + customY) / 2) - z;
|
||||
break;
|
||||
case 1:
|
||||
x = -customY - customX;
|
||||
y = ((-customX + customY) / 2) - z;
|
||||
break;
|
||||
case 2:
|
||||
x = -customY + customX;
|
||||
y = ((-customX - customY) / 2) - z;
|
||||
break;
|
||||
case 3:
|
||||
x = customY + customX;
|
||||
y = ((customX - customY) / 2) - z;
|
||||
break;
|
||||
}
|
||||
|
||||
viewport.view_x = x - ((viewport.view_width << customZoom) / 2);
|
||||
viewport.view_y = y - ((viewport.view_height << customZoom) / 2);
|
||||
viewport.zoom = customZoom;
|
||||
|
||||
RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_ROTATION, uint8) = customRotation;
|
||||
} else {
|
||||
viewport.view_x = RCT2_GLOBAL(RCT2_ADDRESS_SAVED_VIEW_X, sint16) - (viewport.view_width / 2);
|
||||
viewport.view_y = RCT2_GLOBAL(RCT2_ADDRESS_SAVED_VIEW_Y, sint16) - (viewport.view_height / 2);
|
||||
viewport.zoom = RCT2_GLOBAL(RCT2_ADDRESS_SAVED_VIEW_ZOOM_AND_ROTATION, uint16) & 0xFF;
|
||||
|
||||
RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_ROTATION, uint8) = RCT2_GLOBAL(RCT2_ADDRESS_SAVED_VIEW_ZOOM_AND_ROTATION, uint16) >> 8;
|
||||
}
|
||||
|
||||
// Ensure sprites appear regardless of rotation
|
||||
reset_all_sprite_quadrant_placements();
|
||||
|
||||
rct_drawpixelinfo dpi;
|
||||
dpi.x = 0;
|
||||
dpi.y = 0;
|
||||
dpi.width = resolutionWidth;
|
||||
dpi.height = resolutionHeight;
|
||||
dpi.pitch = 0;
|
||||
dpi.zoom_level = 0;
|
||||
dpi.bits = malloc(dpi.width * dpi.height);
|
||||
|
||||
viewport_render(&dpi, &viewport, 0, 0, viewport.width, viewport.height);
|
||||
|
||||
screenshot_write_png(&dpi, outputPath);
|
||||
|
||||
free(dpi.bits);
|
||||
}
|
||||
openrct2_dispose();
|
||||
return 1;
|
||||
}
|
||||
@@ -24,4 +24,6 @@
|
||||
void screenshot_check();
|
||||
int screenshot_dump();
|
||||
|
||||
int cmdline_for_screenshot(const char **argv, int argc);
|
||||
|
||||
#endif
|
||||
@@ -88,7 +88,7 @@ void viewport_init_all()
|
||||
// Palette from sprites?
|
||||
d = 0;
|
||||
for (i = 4915; i < 4947; i++) {
|
||||
g1_element = &(RCT2_ADDRESS(RCT2_ADDRESS_G1_ELEMENTS, rct_g1_element)[i]);
|
||||
g1_element = &g1Elements[i];
|
||||
*((int*)(0x0141FC44 + d)) = *((int*)(&g1_element->offset[0xF5]));
|
||||
*((int*)(0x0141FC48 + d)) = *((int*)(&g1_element->offset[0xF9]));
|
||||
*((int*)(0x0141FD44 + d)) = *((int*)(&g1_element->offset[0xFD]));
|
||||
@@ -112,7 +112,7 @@ void viewport_init_all()
|
||||
RCT2_GLOBAL(RCT2_ADDRESS_TOOLTIP_NOT_SHOWN_TICKS, sint16) = -1;
|
||||
RCT2_GLOBAL(RCT2_ADDRESS_MAP_SELECTION_FLAGS, sint16) = 0;
|
||||
RCT2_GLOBAL(0x009DEA50, sint16) = -1;
|
||||
RCT2_CALLPROC_EBPSAFE(0x006EE3C3);
|
||||
textinput_cancel();
|
||||
format_string((char*)0x0141FA44, STR_CANCEL, NULL);
|
||||
format_string((char*)0x0141F944, STR_OK, NULL);
|
||||
}
|
||||
@@ -743,7 +743,7 @@ int sub_0x686806(rct_sprite* sprite, int eax, int image_id, int ecx, int edx){
|
||||
|
||||
ps->image_id = image_id;
|
||||
|
||||
rct_g1_element *g1Element = &RCT2_ADDRESS(RCT2_ADDRESS_G1_ELEMENTS, rct_g1_element)[image_id & 0x7FFFF];
|
||||
rct_g1_element *g1Element = &g1Elements[image_id & 0x7FFFF];
|
||||
|
||||
eax = (eax & 0xFF) + RCT2_GLOBAL(0x9DE568, uint16);
|
||||
ecx = (ecx & 0xFF) + RCT2_GLOBAL(0x9DE56C, uint16);
|
||||
@@ -821,7 +821,7 @@ void sub_0x6736FC(rct_litter* litter, int ebx, int edx){
|
||||
* Paint Quadrant
|
||||
* rct2: 0x0069E8B0
|
||||
*/
|
||||
void sub_0x69E8B0(uint32 eax, uint32 ecx){
|
||||
void sub_0x69E8B0(uint16 eax, uint16 ecx){
|
||||
uint32 _eax = eax, _ecx = ecx;
|
||||
rct_drawpixelinfo* dpi;
|
||||
|
||||
@@ -1231,36 +1231,42 @@ void sub_68B35F(int ax, int cx)
|
||||
void sub_0x68B6C2(){
|
||||
rct_drawpixelinfo* dpi = RCT2_GLOBAL(0x140E9A8, rct_drawpixelinfo*);
|
||||
sint16 ax, bx, cx, dx;
|
||||
uint16 num_vertical_quadrants = 0;
|
||||
rct_xy16 mapTile;
|
||||
switch (RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_ROTATION, uint32)){
|
||||
case 0:
|
||||
ax = dpi->y;
|
||||
bx = dpi->x;
|
||||
mapTile.x = dpi->x & 0xFFE0;
|
||||
mapTile.y = (dpi->y - 16) & 0xFFE0;
|
||||
|
||||
bx = mapTile.x / 2;
|
||||
mapTile.x = mapTile.y - bx;
|
||||
mapTile.y = mapTile.y + bx;
|
||||
|
||||
ax -= 16;
|
||||
bx &= 0xFFE0;
|
||||
ax &= 0xFFE0;
|
||||
bx >>= 1;
|
||||
cx = ax;
|
||||
ax -= bx;
|
||||
cx += bx;
|
||||
ax &= 0xFFE0;
|
||||
cx &= 0xFFE0;
|
||||
dx = dpi->height;
|
||||
dx += 2128;
|
||||
dx >>= 5;
|
||||
for (int i = dx; i > 0; --i){
|
||||
sub_68B35F(ax, cx);
|
||||
sub_0x69E8B0(ax, cx);
|
||||
cx += 0x20;
|
||||
ax -= 0x20;
|
||||
sub_0x69E8B0(ax, cx);
|
||||
ax += 0x20;
|
||||
sub_68B35F(ax, cx);
|
||||
sub_0x69E8B0(ax, cx);
|
||||
ax += 0x20;
|
||||
cx -= 0x20;
|
||||
sub_0x69E8B0(ax, cx);
|
||||
cx += 0x20;
|
||||
mapTile.x &= 0xFFE0;
|
||||
mapTile.y &= 0xFFE0;
|
||||
|
||||
num_vertical_quadrants = (dpi->height + 2128) / 32;
|
||||
|
||||
for (; num_vertical_quadrants > 0; --num_vertical_quadrants){
|
||||
sub_68B35F(mapTile.x, mapTile.y);
|
||||
sub_0x69E8B0(mapTile.x, mapTile.y);
|
||||
|
||||
mapTile.x -= 32;
|
||||
mapTile.y += 32;
|
||||
|
||||
sub_0x69E8B0(mapTile.x, mapTile.y);
|
||||
|
||||
mapTile.x += 32;
|
||||
|
||||
sub_68B35F(mapTile.x, mapTile.y);
|
||||
sub_0x69E8B0(mapTile.x, mapTile.y);
|
||||
|
||||
mapTile.x += 32;
|
||||
mapTile.y -= 32;
|
||||
|
||||
sub_0x69E8B0(mapTile.x, mapTile.y);
|
||||
|
||||
mapTile.y += 32;
|
||||
}
|
||||
break;
|
||||
case 1:
|
||||
@@ -1513,8 +1519,8 @@ void viewport_paint(rct_viewport* viewport, rct_drawpixelinfo* dpi, int left, in
|
||||
left &= bitmask;
|
||||
top &= bitmask;
|
||||
|
||||
RCT2_GLOBAL(RCT2_ADDRESS_VIEWPORT_PAINT_X, uint16) = left;
|
||||
RCT2_GLOBAL(RCT2_ADDRESS_VIEWPORT_PAINT_Y, uint16) = top;
|
||||
RCT2_GLOBAL(RCT2_ADDRESS_VIEWPORT_PAINT_X, sint16) = left;
|
||||
RCT2_GLOBAL(RCT2_ADDRESS_VIEWPORT_PAINT_Y, sint16) = top;
|
||||
RCT2_GLOBAL(RCT2_ADDRESS_VIEWPORT_PAINT_WIDTH, uint16) = width;
|
||||
RCT2_GLOBAL(RCT2_ADDRESS_VIEWPORT_PAINT_HEIGHT, uint16) = height;
|
||||
|
||||
@@ -1522,11 +1528,11 @@ void viewport_paint(rct_viewport* viewport, rct_drawpixelinfo* dpi, int left, in
|
||||
|
||||
RCT2_GLOBAL(RCT2_ADDRESS_VIEWPORT_PAINT_PITCH, uint16) = (dpi->width + dpi->pitch) - width;
|
||||
|
||||
int x = (sint16)(left - (sint16)(viewport->view_x & bitmask));
|
||||
sint16 x = (sint16)(left - (sint16)(viewport->view_x & bitmask));
|
||||
x >>= viewport->zoom;
|
||||
x += viewport->x;
|
||||
|
||||
int y = (sint16)(top - (sint16)(viewport->view_y & bitmask));
|
||||
sint16 y = (sint16)(top - (sint16)(viewport->view_y & bitmask));
|
||||
y >>= viewport->zoom;
|
||||
y += viewport->y;
|
||||
|
||||
@@ -1534,16 +1540,16 @@ void viewport_paint(rct_viewport* viewport, rct_drawpixelinfo* dpi, int left, in
|
||||
RCT2_GLOBAL(RCT2_ADDRESS_VIEWPORT_PAINT_BITS_PTR, uint8*) = bits_pointer;
|
||||
|
||||
rct_drawpixelinfo* dpi2 = RCT2_ADDRESS(RCT2_ADDRESS_VIEWPORT_DPI, rct_drawpixelinfo);
|
||||
dpi2->y = RCT2_GLOBAL(RCT2_ADDRESS_VIEWPORT_PAINT_Y, uint16);
|
||||
dpi2->y = RCT2_GLOBAL(RCT2_ADDRESS_VIEWPORT_PAINT_Y, sint16);
|
||||
dpi2->height = RCT2_GLOBAL(RCT2_ADDRESS_VIEWPORT_PAINT_HEIGHT, uint16);
|
||||
dpi2->zoom_level = (uint8)RCT2_GLOBAL(RCT2_ADDRESS_VIEWPORT_ZOOM, uint16);
|
||||
|
||||
//Splits the screen into 32 pixel columns and renders them.
|
||||
for (x = RCT2_GLOBAL(RCT2_ADDRESS_VIEWPORT_PAINT_X, uint16) & 0xFFFFFFE0;
|
||||
x < RCT2_GLOBAL(RCT2_ADDRESS_VIEWPORT_PAINT_X, uint16) + RCT2_GLOBAL(RCT2_ADDRESS_VIEWPORT_PAINT_WIDTH, uint16);
|
||||
for (x = RCT2_GLOBAL(RCT2_ADDRESS_VIEWPORT_PAINT_X, sint16) & 0xFFFFFFE0;
|
||||
x < RCT2_GLOBAL(RCT2_ADDRESS_VIEWPORT_PAINT_X, sint16) + RCT2_GLOBAL(RCT2_ADDRESS_VIEWPORT_PAINT_WIDTH, uint16);
|
||||
x += 32){
|
||||
|
||||
int start_x = RCT2_GLOBAL(RCT2_ADDRESS_VIEWPORT_PAINT_X, uint16);
|
||||
int start_x = RCT2_GLOBAL(RCT2_ADDRESS_VIEWPORT_PAINT_X, sint16);
|
||||
int width_col = RCT2_GLOBAL(RCT2_ADDRESS_VIEWPORT_PAINT_WIDTH, uint16);
|
||||
bits_pointer = RCT2_GLOBAL(RCT2_ADDRESS_VIEWPORT_PAINT_BITS_PTR, uint8*);
|
||||
int pitch = RCT2_GLOBAL(RCT2_ADDRESS_VIEWPORT_PAINT_PITCH, uint16);
|
||||
@@ -1609,7 +1615,8 @@ void viewport_paint(rct_viewport* viewport, rct_drawpixelinfo* dpi, int left, in
|
||||
* viewport: edi
|
||||
*/
|
||||
void sub_688972(int screenX, int screenY, sint16 *x, sint16 *y, rct_viewport **viewport) {
|
||||
int my_x, my_y, z, interactionType;
|
||||
sint16 my_x, my_y;
|
||||
int z, interactionType;
|
||||
rct_viewport *myViewport;
|
||||
get_map_coordinates_from_pos(screenX, screenY, VIEWPORT_INTERACTION_MASK_TERRAIN, &my_x, &my_y, &interactionType, NULL, &myViewport);
|
||||
if (interactionType == VIEWPORT_INTERACTION_ITEM_NONE) {
|
||||
@@ -1665,9 +1672,9 @@ void screen_pos_to_map_pos(sint16 *x, sint16 *y, int *direction)
|
||||
}
|
||||
} else {
|
||||
if (mod_y < 16) {
|
||||
my_direction = 0;
|
||||
} else {
|
||||
my_direction = 1;
|
||||
} else {
|
||||
my_direction = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1955,7 +1962,7 @@ void sub_68862C()
|
||||
* mapElement: edx
|
||||
* viewport: edi
|
||||
*/
|
||||
void get_map_coordinates_from_pos(int screenX, int screenY, int flags, int *x, int *y, int *interactionType, rct_map_element **mapElement, rct_viewport **viewport)
|
||||
void get_map_coordinates_from_pos(int screenX, int screenY, int flags, sint16 *x, sint16 *y, int *interactionType, rct_map_element **mapElement, rct_viewport **viewport)
|
||||
{
|
||||
RCT2_GLOBAL(0x9AC154, uint16_t) = flags & 0xFFFF;
|
||||
RCT2_GLOBAL(0x9AC148, uint8_t) = 0;
|
||||
@@ -1994,7 +2001,7 @@ void get_map_coordinates_from_pos(int screenX, int screenY, int flags, int *x, i
|
||||
if (viewport != NULL) *viewport = myviewport;
|
||||
}
|
||||
if (interactionType != NULL) *interactionType = RCT2_GLOBAL(0x9AC148, uint8_t);
|
||||
if (x != NULL) *x = (int)RCT2_GLOBAL(0x9AC14C, int16_t);
|
||||
if (y != NULL) *y = (int)RCT2_GLOBAL(0x9AC14E, int16_t);
|
||||
if (x != NULL) *x = RCT2_GLOBAL(0x9AC14C, int16_t);
|
||||
if (y != NULL) *y = RCT2_GLOBAL(0x9AC14E, int16_t);
|
||||
if (mapElement != NULL) *mapElement = RCT2_GLOBAL(0x9AC150, rct_map_element*);
|
||||
}
|
||||
@@ -113,7 +113,7 @@ void show_construction_rights();
|
||||
void hide_construction_rights();
|
||||
void viewport_set_visibility(uint8 mode);
|
||||
|
||||
void get_map_coordinates_from_pos(int screenX, int screenY, int flags, int *x, int *y, int *interactionType, rct_map_element **mapElement, rct_viewport **viewport);
|
||||
void get_map_coordinates_from_pos(int screenX, int screenY, int flags, sint16 *x, sint16 *y, int *interactionType, rct_map_element **mapElement, rct_viewport **viewport);
|
||||
|
||||
int viewport_interaction_get_item_left(int x, int y, viewport_interaction_info *info);
|
||||
int viewport_interaction_left_over(int x, int y);
|
||||
|
||||
@@ -59,7 +59,10 @@ int viewport_interaction_get_item_left(int x, int y, viewport_interaction_info *
|
||||
if ((RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_FLAGS, uint8) & SCREEN_FLAGS_TRACK_DESIGNER) && s6Info->var_000 != 6)
|
||||
return info->type = VIEWPORT_INTERACTION_ITEM_NONE;
|
||||
|
||||
get_map_coordinates_from_pos(x, y, VIEWPORT_INTERACTION_MASK_SPRITE & VIEWPORT_INTERACTION_MASK_RIDE & VIEWPORT_INTERACTION_MASK_PARK, &info->x, &info->y, &info->type, &info->mapElement, NULL);
|
||||
rct_xy16 mapCoord = { 0 };
|
||||
get_map_coordinates_from_pos(x, y, VIEWPORT_INTERACTION_MASK_SPRITE & VIEWPORT_INTERACTION_MASK_RIDE & VIEWPORT_INTERACTION_MASK_PARK, &mapCoord.x, &mapCoord.y, &info->type, &info->mapElement, NULL);
|
||||
info->x = mapCoord.x;
|
||||
info->y = mapCoord.y;
|
||||
mapElement = info->mapElement;
|
||||
sprite = (rct_sprite*)mapElement;
|
||||
|
||||
@@ -179,7 +182,10 @@ int viewport_interaction_get_item_right(int x, int y, viewport_interaction_info
|
||||
if ((RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_FLAGS, uint8) & SCREEN_FLAGS_TRACK_DESIGNER) && s6Info->var_000 != 6)
|
||||
return info->type = VIEWPORT_INTERACTION_ITEM_NONE;
|
||||
|
||||
get_map_coordinates_from_pos(x, y, ~(VIEWPORT_INTERACTION_MASK_TERRAIN & VIEWPORT_INTERACTION_MASK_WATER), &info->x, &info->y, &info->type, &info->mapElement, NULL);
|
||||
rct_xy16 mapCoord = { 0 };
|
||||
get_map_coordinates_from_pos(x, y, ~(VIEWPORT_INTERACTION_MASK_TERRAIN & VIEWPORT_INTERACTION_MASK_WATER), &mapCoord.x, &mapCoord.y, &info->type, &info->mapElement, NULL);
|
||||
info->x = mapCoord.x;
|
||||
info->y = mapCoord.y;
|
||||
mapElement = info->mapElement;
|
||||
sprite = (rct_sprite*)mapElement;
|
||||
|
||||
@@ -566,7 +572,8 @@ static rct_peep *viewport_interaction_get_closest_peep(int x, int y, int maxDist
|
||||
*/
|
||||
void sub_68A15E(int screenX, int screenY, short *x, short *y, int *direction, rct_map_element **mapElement)
|
||||
{
|
||||
int my_x, my_y, z, interactionType;
|
||||
sint16 my_x, my_y;
|
||||
int z, interactionType;
|
||||
rct_map_element *myMapElement;
|
||||
rct_viewport *viewport;
|
||||
get_map_coordinates_from_pos(screenX, screenY, VIEWPORT_INTERACTION_MASK_TERRAIN & VIEWPORT_INTERACTION_MASK_WATER, &my_x, &my_y, &interactionType, &myMapElement, &viewport);
|
||||
|
||||
@@ -1220,7 +1220,7 @@ void window_rotate_camera(rct_window *w)
|
||||
window_invalidate(w);
|
||||
|
||||
sub_688956();
|
||||
sub_69E9A7();
|
||||
reset_all_sprite_quadrant_placements();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -2141,3 +2141,34 @@ int window_can_resize(rct_window *w)
|
||||
{
|
||||
return (w->flags & WF_RESIZABLE) && (w->min_width != w->max_width || w->min_height != w->max_height);
|
||||
}
|
||||
|
||||
void window_event_textinput_call(rct_window *w, int widgetIndex, char *text)
|
||||
{
|
||||
RCT2_CALLPROC_X(w->event_handlers[WE_TEXT_INPUT], 0, 0, text != NULL, widgetIndex, (int)w, (int)text, 0);
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* rct2: 0x006EE3C3
|
||||
*/
|
||||
void textinput_cancel()
|
||||
{
|
||||
rct_window *w;
|
||||
|
||||
// Close the new text input window
|
||||
window_close_by_class(WC_TEXTINPUT);
|
||||
|
||||
// The following code is only necessary for the old Windows text input dialog. In theory this isn't used anymore, but can
|
||||
// still be triggered via original code paths.
|
||||
RCT2_CALLPROC_EBPSAFE(0x0040701D);
|
||||
if (RCT2_GLOBAL(0x009DEB8C, uint8) != 255) {
|
||||
RCT2_CALLPROC_EBPSAFE(0x006EE4E2);
|
||||
w = window_find_by_number(
|
||||
RCT2_GLOBAL(RCT2_ADDRESS_TEXTINPUT_WINDOWCLASS, rct_windowclass),
|
||||
RCT2_GLOBAL(RCT2_ADDRESS_TEXTINPUT_WINDOWNUMBER, rct_windownumber)
|
||||
);
|
||||
if (w != NULL) {
|
||||
window_event_textinput_call(w, RCT2_GLOBAL(RCT2_ADDRESS_TEXTINPUT_WIDGETINDEX, uint16), NULL);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -597,8 +597,10 @@ void window_event_resize_call(rct_window* w);
|
||||
void window_event_mouse_down_call(rct_window* w, int widgetIndex);
|
||||
void window_event_invalidate_call(rct_window* w);
|
||||
void window_event_update_call(rct_window *w);
|
||||
void window_event_textinput_call(rct_window *w, int widgetIndex, char *text);
|
||||
|
||||
void sub_6EA73F();
|
||||
void textinput_cancel();
|
||||
|
||||
void window_move_and_snap(rct_window *w, int newWindowX, int newWindowY, int snapProximity);
|
||||
int window_can_resize(rct_window *w);
|
||||
@@ -666,6 +668,13 @@ int window_can_resize(rct_window *w);
|
||||
#define window_cursor_set_registers(cursorId) \
|
||||
__asm mov ebx, cursorId
|
||||
|
||||
#define window_tooltip_get_registers(w, widgetIndex) \
|
||||
__asm mov widgetIndex, ax \
|
||||
__asm mov w, esi
|
||||
|
||||
#define window_tooltip_set_registers(value) \
|
||||
__asm mov ax, value
|
||||
|
||||
#else
|
||||
#define window_get_register(w) \
|
||||
__asm__ ( "mov %["#w"], esi " : [w] "+m" (w) );
|
||||
@@ -728,6 +737,13 @@ int window_can_resize(rct_window *w);
|
||||
|
||||
#define window_cursor_set_registers(cursorId) \
|
||||
__asm__ ( "mov ebx, %[cursorId] " : [cursorId] "+m" (cursorId) );
|
||||
|
||||
#define window_tooltip_get_registers(w, widgetIndex) \
|
||||
__asm__ ( "mov %["#widgetIndex"], ax " : [widgetIndex] "+m" (widgetIndex) ); \
|
||||
__asm__ ( "mov %["#w"], esi " : [w] "+m" (w) );
|
||||
|
||||
#define window_tooltip_set_registers(value) \
|
||||
__asm__ ( "mov ax, %["#value"] " : [value] "+m" (value) );
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user