From bec1a52bba590f5bc83b4dcb44d0da08373e7ea4 Mon Sep 17 00:00:00 2001 From: Runelaenen Date: Thu, 9 Jul 2015 13:05:21 +0200 Subject: [PATCH] Changed function and occurences It doesnt have to rotate three times to get an anti-clockwise return. --- src/interface/window.c | 7 ++++--- src/interface/window.h | 2 +- src/title.c | 2 +- src/windows/top_toolbar.c | 6 ++---- 4 files changed, 8 insertions(+), 9 deletions(-) diff --git a/src/interface/window.c b/src/interface/window.c index a80ffa2238..b4d4700765 100644 --- a/src/interface/window.c +++ b/src/interface/window.c @@ -1354,7 +1354,7 @@ void sub_688956() * * rct2: 0x0068881A */ -void window_rotate_camera(rct_window *w) +void window_rotate_camera(rct_window *w, int wise) { rct_viewport *viewport = w->viewport; if (viewport == NULL) @@ -1375,11 +1375,12 @@ void window_rotate_camera(rct_window *w) y = (viewport->view_height >> 1) + viewport->view_y; sub_689174(&x, &y, &z); - } else { + } + else { z = map_element_height(x, y); } - RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_ROTATION, uint32) = (RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_ROTATION, uint32) + 1) % 4; + RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_ROTATION, uint32) = (RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_ROTATION, uint32) + wise) % 4; int new_x, new_y; center_2d_coordinates(x, y, z, &new_x, &new_y, viewport); diff --git a/src/interface/window.h b/src/interface/window.h index 6093d52ee1..8b5aacee16 100644 --- a/src/interface/window.h +++ b/src/interface/window.h @@ -496,7 +496,7 @@ rct_window *window_get_main(); void window_scroll_to_viewport(rct_window *w); void window_scroll_to_location(rct_window *w, int x, int y, int z); -void window_rotate_camera(rct_window *w); +void window_rotate_camera(rct_window *w, int wise); void window_zoom_set(rct_window *w, int zoomLevel); void window_zoom_in(rct_window *w); void window_zoom_out(rct_window *w); diff --git a/src/title.c b/src/title.c index ad472457df..6fe269bd0b 100644 --- a/src/title.c +++ b/src/title.c @@ -300,7 +300,7 @@ static void title_do_next_script_opcode() w = window_get_main(); if (w != NULL) for (i = 0; i < script_operand; i++) - window_rotate_camera(w); + window_rotate_camera(w, 1); break; case TITLE_SCRIPT_ZOOM: script_operand = (*_currentScript++); diff --git a/src/windows/top_toolbar.c b/src/windows/top_toolbar.c index f94a5c3ce9..a880b07206 100644 --- a/src/windows/top_toolbar.c +++ b/src/windows/top_toolbar.c @@ -2853,13 +2853,11 @@ void top_toolbar_rotate_menu_dropdown(short dropdownIndex) { rct_window* w = window_get_main(); if (w) { if (dropdownIndex == 0) { - window_rotate_camera(w); + window_rotate_camera(w, 1); window_invalidate(w); } else if (dropdownIndex == 1){ - window_rotate_camera(w); - window_rotate_camera(w); - window_rotate_camera(w); + window_rotate_camera(w, -1); window_invalidate(w); } }