mirror of https://github.com/OpenRCT2/OpenRCT2.git
Merge pull request #1172 from duncanspumpkin/cmdline-screenshot
Fix rotation issue
This commit is contained in:
commit
e9f7ec0a6a
|
@ -4,7 +4,7 @@
|
||||||
<LocalDebuggerWorkingDirectory>$(TargetDir)</LocalDebuggerWorkingDirectory>
|
<LocalDebuggerWorkingDirectory>$(TargetDir)</LocalDebuggerWorkingDirectory>
|
||||||
<DebuggerFlavor>WindowsLocalDebugger</DebuggerFlavor>
|
<DebuggerFlavor>WindowsLocalDebugger</DebuggerFlavor>
|
||||||
<LocalDebuggerCommand>$(TargetDir)\openrct2.exe</LocalDebuggerCommand>
|
<LocalDebuggerCommand>$(TargetDir)\openrct2.exe</LocalDebuggerCommand>
|
||||||
<LocalDebuggerCommandArguments>screenshot "C:\Program Files (x86)\Infogrames\RollerCoaster Tycoon 2\Scenarios\Six Flags Magic Mountain.SC6" "test.png" 1920 1080</LocalDebuggerCommandArguments>
|
<LocalDebuggerCommandArguments>screenshot "C:\GOG Games\RollerCoaster Tycoon 2 Triple Thrill Pack\Scenarios\Six Flags Magic Mountain.SC6" "test.png" 16000 8000 c c 0 0</LocalDebuggerCommandArguments>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<ShowAllFiles>false</ShowAllFiles>
|
<ShowAllFiles>false</ShowAllFiles>
|
||||||
|
|
|
@ -598,7 +598,7 @@ static void editor_finalise_main_view()
|
||||||
w->saved_view_y -= viewport->view_height >> 1;
|
w->saved_view_y -= viewport->view_height >> 1;
|
||||||
|
|
||||||
window_invalidate(w);
|
window_invalidate(w);
|
||||||
sub_69E9A7();
|
reset_all_sprite_quadrant_placements();
|
||||||
scenery_set_default_placement_configuration();
|
scenery_set_default_placement_configuration();
|
||||||
window_new_ride_init_vars();
|
window_new_ride_init_vars();
|
||||||
RCT2_GLOBAL(0x009DEB7C, uint16) = 0;
|
RCT2_GLOBAL(0x009DEB7C, uint16) = 0;
|
||||||
|
|
|
@ -705,7 +705,7 @@ int game_load_save(const char *path)
|
||||||
mainWindow->saved_view_y -= mainWindow->viewport->view_height >> 1;
|
mainWindow->saved_view_y -= mainWindow->viewport->view_height >> 1;
|
||||||
window_invalidate(mainWindow);
|
window_invalidate(mainWindow);
|
||||||
|
|
||||||
sub_69E9A7();
|
reset_all_sprite_quadrant_placements();
|
||||||
scenery_set_default_placement_configuration();
|
scenery_set_default_placement_configuration();
|
||||||
window_new_ride_init_vars();
|
window_new_ride_init_vars();
|
||||||
RCT2_GLOBAL(0x009DEB7C, uint16) = 0;
|
RCT2_GLOBAL(0x009DEB7C, uint16) = 0;
|
||||||
|
@ -722,8 +722,9 @@ int game_load_save(const char *path)
|
||||||
/*
|
/*
|
||||||
*
|
*
|
||||||
* rct2: 0x0069E9A7
|
* rct2: 0x0069E9A7
|
||||||
|
* Call after a rotation or loading of a save to reset sprite quadrants
|
||||||
*/
|
*/
|
||||||
void sub_69E9A7()
|
void reset_all_sprite_quadrant_placements()
|
||||||
{
|
{
|
||||||
for (rct_sprite* spr = g_sprite_list; spr < (rct_sprite*)RCT2_ADDRESS_SPRITES_NEXT_INDEX; spr++)
|
for (rct_sprite* spr = g_sprite_list; spr < (rct_sprite*)RCT2_ADDRESS_SPRITES_NEXT_INDEX; spr++)
|
||||||
if (spr->unknown.sprite_identifier != 0xFF)
|
if (spr->unknown.sprite_identifier != 0xFF)
|
||||||
|
|
|
@ -97,7 +97,7 @@ void game_reduce_game_speed();
|
||||||
void game_create_windows();
|
void game_create_windows();
|
||||||
void game_update();
|
void game_update();
|
||||||
void game_logic_update();
|
void game_logic_update();
|
||||||
void sub_69E9A7();
|
void reset_all_sprite_quadrant_placements();
|
||||||
void update_palette_effects();
|
void update_palette_effects();
|
||||||
|
|
||||||
int game_do_command(int eax, int ebx, int ecx, int edx, int esi, int edi, int ebp);
|
int game_do_command(int eax, int ebx, int ecx, int edx, int esi, int edi, int ebp);
|
||||||
|
|
|
@ -392,7 +392,7 @@ int cmdline_for_screenshot(const char **argv, int argc)
|
||||||
customY = (mapSize / 2) * 32 + 16;
|
customY = (mapSize / 2) * 32 + 16;
|
||||||
|
|
||||||
int x, y;
|
int x, y;
|
||||||
int z = map_element_height(customX, customY);
|
int z = map_element_height(customX, customY) & 0xFFFF;
|
||||||
switch (customRotation) {
|
switch (customRotation) {
|
||||||
case 0:
|
case 0:
|
||||||
x = customY - customX;
|
x = customY - customX;
|
||||||
|
@ -417,6 +417,8 @@ int cmdline_for_screenshot(const char **argv, int argc)
|
||||||
viewport.zoom = customZoom;
|
viewport.zoom = customZoom;
|
||||||
|
|
||||||
RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_ROTATION, uint8) = customRotation;
|
RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_ROTATION, uint8) = customRotation;
|
||||||
|
|
||||||
|
reset_all_sprite_quadrant_placements();
|
||||||
} else {
|
} else {
|
||||||
viewport.view_x = RCT2_GLOBAL(RCT2_ADDRESS_SAVED_VIEW_X, sint16) - (viewport.view_width / 2);
|
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.view_y = RCT2_GLOBAL(RCT2_ADDRESS_SAVED_VIEW_Y, sint16) - (viewport.view_height / 2);
|
||||||
|
|
|
@ -821,7 +821,7 @@ void sub_0x6736FC(rct_litter* litter, int ebx, int edx){
|
||||||
* Paint Quadrant
|
* Paint Quadrant
|
||||||
* rct2: 0x0069E8B0
|
* rct2: 0x0069E8B0
|
||||||
*/
|
*/
|
||||||
void sub_0x69E8B0(uint32 eax, uint32 ecx){
|
void sub_0x69E8B0(uint16 eax, uint16 ecx){
|
||||||
uint32 _eax = eax, _ecx = ecx;
|
uint32 _eax = eax, _ecx = ecx;
|
||||||
rct_drawpixelinfo* dpi;
|
rct_drawpixelinfo* dpi;
|
||||||
|
|
||||||
|
@ -1231,36 +1231,42 @@ void sub_68B35F(int ax, int cx)
|
||||||
void sub_0x68B6C2(){
|
void sub_0x68B6C2(){
|
||||||
rct_drawpixelinfo* dpi = RCT2_GLOBAL(0x140E9A8, rct_drawpixelinfo*);
|
rct_drawpixelinfo* dpi = RCT2_GLOBAL(0x140E9A8, rct_drawpixelinfo*);
|
||||||
sint16 ax, bx, cx, dx;
|
sint16 ax, bx, cx, dx;
|
||||||
|
uint16 num_vertical_quadrants = 0;
|
||||||
|
rct_xy16 mapTile;
|
||||||
switch (RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_ROTATION, uint32)){
|
switch (RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_ROTATION, uint32)){
|
||||||
case 0:
|
case 0:
|
||||||
ax = dpi->y;
|
mapTile.x = dpi->x & 0xFFE0;
|
||||||
bx = dpi->x;
|
mapTile.y = (dpi->y - 16) & 0xFFE0;
|
||||||
|
|
||||||
ax -= 16;
|
bx = mapTile.x / 2;
|
||||||
bx &= 0xFFE0;
|
mapTile.x = mapTile.y - bx;
|
||||||
ax &= 0xFFE0;
|
mapTile.y = mapTile.y + bx;
|
||||||
bx >>= 1;
|
|
||||||
cx = ax;
|
mapTile.x &= 0xFFE0;
|
||||||
ax -= bx;
|
mapTile.y &= 0xFFE0;
|
||||||
cx += bx;
|
|
||||||
ax &= 0xFFE0;
|
num_vertical_quadrants = (dpi->height + 2128) / 32;
|
||||||
cx &= 0xFFE0;
|
|
||||||
dx = dpi->height;
|
for (; num_vertical_quadrants > 0; --num_vertical_quadrants){
|
||||||
dx += 2128;
|
sub_68B35F(mapTile.x, mapTile.y);
|
||||||
dx >>= 5;
|
sub_0x69E8B0(mapTile.x, mapTile.y);
|
||||||
for (int i = dx; i > 0; --i){
|
|
||||||
sub_68B35F(ax, cx);
|
mapTile.x -= 32;
|
||||||
sub_0x69E8B0(ax, cx);
|
mapTile.y += 32;
|
||||||
cx += 0x20;
|
|
||||||
ax -= 0x20;
|
sub_0x69E8B0(mapTile.x, mapTile.y);
|
||||||
sub_0x69E8B0(ax, cx);
|
|
||||||
ax += 0x20;
|
mapTile.x += 32;
|
||||||
sub_68B35F(ax, cx);
|
|
||||||
sub_0x69E8B0(ax, cx);
|
sub_68B35F(mapTile.x, mapTile.y);
|
||||||
ax += 0x20;
|
sub_0x69E8B0(mapTile.x, mapTile.y);
|
||||||
cx -= 0x20;
|
|
||||||
sub_0x69E8B0(ax, cx);
|
mapTile.x += 32;
|
||||||
cx += 0x20;
|
mapTile.y -= 32;
|
||||||
|
|
||||||
|
sub_0x69E8B0(mapTile.x, mapTile.y);
|
||||||
|
|
||||||
|
mapTile.y += 32;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 1:
|
case 1:
|
||||||
|
@ -1513,8 +1519,8 @@ void viewport_paint(rct_viewport* viewport, rct_drawpixelinfo* dpi, int left, in
|
||||||
left &= bitmask;
|
left &= bitmask;
|
||||||
top &= bitmask;
|
top &= bitmask;
|
||||||
|
|
||||||
RCT2_GLOBAL(RCT2_ADDRESS_VIEWPORT_PAINT_X, uint16) = left;
|
RCT2_GLOBAL(RCT2_ADDRESS_VIEWPORT_PAINT_X, sint16) = left;
|
||||||
RCT2_GLOBAL(RCT2_ADDRESS_VIEWPORT_PAINT_Y, uint16) = top;
|
RCT2_GLOBAL(RCT2_ADDRESS_VIEWPORT_PAINT_Y, sint16) = top;
|
||||||
RCT2_GLOBAL(RCT2_ADDRESS_VIEWPORT_PAINT_WIDTH, uint16) = width;
|
RCT2_GLOBAL(RCT2_ADDRESS_VIEWPORT_PAINT_WIDTH, uint16) = width;
|
||||||
RCT2_GLOBAL(RCT2_ADDRESS_VIEWPORT_PAINT_HEIGHT, uint16) = height;
|
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;
|
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->zoom;
|
||||||
x += viewport->x;
|
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->zoom;
|
||||||
y += viewport->y;
|
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;
|
RCT2_GLOBAL(RCT2_ADDRESS_VIEWPORT_PAINT_BITS_PTR, uint8*) = bits_pointer;
|
||||||
|
|
||||||
rct_drawpixelinfo* dpi2 = RCT2_ADDRESS(RCT2_ADDRESS_VIEWPORT_DPI, rct_drawpixelinfo);
|
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->height = RCT2_GLOBAL(RCT2_ADDRESS_VIEWPORT_PAINT_HEIGHT, uint16);
|
||||||
dpi2->zoom_level = (uint8)RCT2_GLOBAL(RCT2_ADDRESS_VIEWPORT_ZOOM, uint16);
|
dpi2->zoom_level = (uint8)RCT2_GLOBAL(RCT2_ADDRESS_VIEWPORT_ZOOM, uint16);
|
||||||
|
|
||||||
//Splits the screen into 32 pixel columns and renders them.
|
//Splits the screen into 32 pixel columns and renders them.
|
||||||
for (x = RCT2_GLOBAL(RCT2_ADDRESS_VIEWPORT_PAINT_X, uint16) & 0xFFFFFFE0;
|
for (x = RCT2_GLOBAL(RCT2_ADDRESS_VIEWPORT_PAINT_X, sint16) & 0xFFFFFFE0;
|
||||||
x < RCT2_GLOBAL(RCT2_ADDRESS_VIEWPORT_PAINT_X, uint16) + RCT2_GLOBAL(RCT2_ADDRESS_VIEWPORT_PAINT_WIDTH, uint16);
|
x < RCT2_GLOBAL(RCT2_ADDRESS_VIEWPORT_PAINT_X, sint16) + RCT2_GLOBAL(RCT2_ADDRESS_VIEWPORT_PAINT_WIDTH, uint16);
|
||||||
x += 32){
|
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);
|
int width_col = RCT2_GLOBAL(RCT2_ADDRESS_VIEWPORT_PAINT_WIDTH, uint16);
|
||||||
bits_pointer = RCT2_GLOBAL(RCT2_ADDRESS_VIEWPORT_PAINT_BITS_PTR, uint8*);
|
bits_pointer = RCT2_GLOBAL(RCT2_ADDRESS_VIEWPORT_PAINT_BITS_PTR, uint8*);
|
||||||
int pitch = RCT2_GLOBAL(RCT2_ADDRESS_VIEWPORT_PAINT_PITCH, uint16);
|
int pitch = RCT2_GLOBAL(RCT2_ADDRESS_VIEWPORT_PAINT_PITCH, uint16);
|
||||||
|
|
|
@ -1220,7 +1220,7 @@ void window_rotate_camera(rct_window *w)
|
||||||
window_invalidate(w);
|
window_invalidate(w);
|
||||||
|
|
||||||
sub_688956();
|
sub_688956();
|
||||||
sub_69E9A7();
|
reset_all_sprite_quadrant_placements();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -248,7 +248,7 @@ int scenario_load_and_play_from_path(const char *path)
|
||||||
mainWindow->saved_view_y -= mainWindow->viewport->view_height >> 1;
|
mainWindow->saved_view_y -= mainWindow->viewport->view_height >> 1;
|
||||||
window_invalidate(mainWindow);
|
window_invalidate(mainWindow);
|
||||||
|
|
||||||
sub_69E9A7();
|
reset_all_sprite_quadrant_placements();
|
||||||
window_new_ride_init_vars();
|
window_new_ride_init_vars();
|
||||||
|
|
||||||
// Set the scenario pseduo-random seeds
|
// Set the scenario pseduo-random seeds
|
||||||
|
|
|
@ -203,7 +203,7 @@ static void title_update_showcase()
|
||||||
}
|
}
|
||||||
|
|
||||||
window_invalidate(w);
|
window_invalidate(w);
|
||||||
sub_69E9A7();
|
reset_all_sprite_quadrant_placements();
|
||||||
window_new_ride_init_vars();
|
window_new_ride_init_vars();
|
||||||
sub_684AC3();
|
sub_684AC3();
|
||||||
scenery_set_default_placement_configuration();
|
scenery_set_default_placement_configuration();
|
||||||
|
|
Loading…
Reference in New Issue