mirror of
https://github.com/OpenRCT2/OpenRCT2
synced 2026-01-23 23:04:36 +01:00
Add get_current_rotation function and DEBUG_LEVEL macros
This commit is contained in:
@@ -537,7 +537,7 @@ static void window_footpath_paint(rct_window *w, rct_drawpixelinfo *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;
|
||||
image = (RCT2_GLOBAL(RCT2_ADDRESS_CONSTRUCT_PATH_DIRECTION, uint8) + get_current_rotation()) % 4;
|
||||
if (RCT2_GLOBAL(RCT2_ADDRESS_CONSTRUCT_PATH_SLOPE, uint8) == 2)
|
||||
image += 4;
|
||||
else if (RCT2_GLOBAL(RCT2_ADDRESS_CONSTRUCT_PATH_SLOPE, uint8) == 6)
|
||||
@@ -618,7 +618,7 @@ static void window_footpath_show_footpath_types_dialog(rct_window *w, rct_widget
|
||||
static void window_footpath_mousedown_direction(int direction)
|
||||
{
|
||||
footpath_provisional_update();
|
||||
RCT2_GLOBAL(RCT2_ADDRESS_CONSTRUCT_PATH_DIRECTION, uint8) = (direction - RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_ROTATION, uint32)) & 3;
|
||||
RCT2_GLOBAL(RCT2_ADDRESS_CONSTRUCT_PATH_DIRECTION, uint8) = (direction - get_current_rotation()) & 3;
|
||||
_window_footpath_cost = MONEY32_UNDEFINED;
|
||||
window_footpath_set_enabled_and_pressed_widgets();
|
||||
}
|
||||
@@ -1012,7 +1012,7 @@ static void window_footpath_set_enabled_and_pressed_widgets()
|
||||
|
||||
pressedWidgets = w->pressed_widgets & 0xFFFF887F;
|
||||
disabledWidgets = 0;
|
||||
currentRotation = RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_ROTATION, uint8);
|
||||
currentRotation = get_current_rotation();
|
||||
if (RCT2_GLOBAL(RCT2_ADDRESS_PATH_CONSTRUCTION_MODE, uint8) >= PATH_CONSTRUCTION_MODE_BRIDGE_OR_TUNNEL) {
|
||||
// Set pressed directional widget
|
||||
direction = (RCT2_GLOBAL(RCT2_ADDRESS_CONSTRUCT_PATH_DIRECTION, uint8) + currentRotation) & 3;
|
||||
|
||||
@@ -732,7 +732,7 @@ void window_guest_viewport_init(rct_window* w){
|
||||
focus.sprite.type |= VIEWPORT_FOCUS_TYPE_SPRITE | VIEWPORT_FOCUS_TYPE_COORDINATE;
|
||||
focus.sprite.pad_486 &= 0xFFFF;
|
||||
}
|
||||
focus.coordinate.rotation = RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_ROTATION, uint8);
|
||||
focus.coordinate.rotation = get_current_rotation();
|
||||
}
|
||||
|
||||
uint16 viewport_flags;
|
||||
|
||||
@@ -224,7 +224,7 @@ void window_map_open()
|
||||
|
||||
window_init_scroll_widgets(w);
|
||||
|
||||
w->map.rotation = RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_ROTATION, uint16);
|
||||
w->map.rotation = get_current_rotation();
|
||||
|
||||
window_map_init_map();
|
||||
RCT2_GLOBAL(0x00F64F05, uint8) = 0;
|
||||
@@ -394,8 +394,8 @@ static void window_map_mousedown(int widgetIndex, rct_window *w, rct_widget *wid
|
||||
*/
|
||||
static void window_map_update(rct_window *w)
|
||||
{
|
||||
if (RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_ROTATION, uint8) != w->map.rotation) {
|
||||
w->map.rotation = RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_ROTATION, uint8);
|
||||
if (get_current_rotation() != w->map.rotation) {
|
||||
w->map.rotation = get_current_rotation();
|
||||
window_map_init_map();
|
||||
window_map_center_on_view_point();
|
||||
}
|
||||
@@ -885,7 +885,7 @@ static void window_map_center_on_view_point()
|
||||
if (w_map == NULL)
|
||||
return;
|
||||
|
||||
rct_xy16 offset = MiniMapOffsets[RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_ROTATION, uint8) & 3];
|
||||
rct_xy16 offset = MiniMapOffsets[get_current_rotation()];
|
||||
|
||||
// calculate center view point of viewport and transform it to minimap coordinates
|
||||
|
||||
@@ -975,7 +975,7 @@ static void window_map_transform_to_map_coords(sint16 *left, sint16 *top)
|
||||
sint16 x = *left, y = *top;
|
||||
sint16 temp;
|
||||
|
||||
switch (RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_ROTATION, uint32)) {
|
||||
switch (get_current_rotation()) {
|
||||
case 3:
|
||||
temp = x;
|
||||
x = y;
|
||||
@@ -1097,7 +1097,7 @@ static void window_map_paint_hud_rectangle(rct_drawpixelinfo *dpi)
|
||||
if (viewport == NULL)
|
||||
return;
|
||||
|
||||
rct_xy16 offset = MiniMapOffsets[RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_ROTATION, uint32) & 3];
|
||||
rct_xy16 offset = MiniMapOffsets[get_current_rotation()];
|
||||
sint16 left = (viewport->view_x >> 5) + offset.x;
|
||||
sint16 right = ((viewport->view_x + viewport->view_width) >> 5) + offset.x;
|
||||
sint16 top = (viewport->view_y >> 4) + offset.y;
|
||||
@@ -1176,7 +1176,7 @@ void sub_666EEF(int x, int y, sint16 *mapX, sint16 *mapY, sint16 *mapZ, int *dir
|
||||
}
|
||||
}
|
||||
}
|
||||
*direction = (window_scenery_rotation - RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_ROTATION, uint8)) & 3;
|
||||
*direction = (window_scenery_rotation - get_current_rotation()) & 3;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -1604,7 +1604,7 @@ static void map_window_set_pixels(rct_window *w)
|
||||
int x, y, dx, dy;
|
||||
|
||||
destination = (uint16*)((RCT2_GLOBAL(0x00F1AD6C, uint32) * 511) + RCT2_GLOBAL(RCT2_ADDRESS_MAP_IMAGE_DATA, uint32) + 255);
|
||||
switch (RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_ROTATION, uint8)) {
|
||||
switch (get_current_rotation()) {
|
||||
case 0:
|
||||
x = RCT2_GLOBAL(0x00F1AD6C, uint32) * 32;
|
||||
y = 0;
|
||||
@@ -1665,7 +1665,7 @@ static void map_window_screen_to_map(int screenX, int screenY, int *mapX, int *m
|
||||
screenY = ((screenY + 8) ) / 2;
|
||||
x = (screenY - screenX) * 32;
|
||||
y = (screenX + screenY) * 32;
|
||||
switch (RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_ROTATION, uint8) & 3) {
|
||||
switch (get_current_rotation()) {
|
||||
case 0:
|
||||
*mapX = x;
|
||||
*mapY = y;
|
||||
|
||||
@@ -225,7 +225,7 @@ static void window_maze_construction_mouseup(rct_window *w, int widgetIndex)
|
||||
case WIDX_MAZE_DIRECTION_SE:
|
||||
case WIDX_MAZE_DIRECTION_SW:
|
||||
window_maze_construction_construct(
|
||||
((widgetIndex - WIDX_MAZE_DIRECTION_NW) - RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_ROTATION, uint8)) & 3
|
||||
((widgetIndex - WIDX_MAZE_DIRECTION_NW) - get_current_rotation()) & 3
|
||||
);
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -1064,7 +1064,7 @@ static void window_park_init_viewport(rct_window *w)
|
||||
x = RCT2_ADDRESS(RCT2_ADDRESS_PARK_ENTRANCE_X, sint16)[i] + 16;
|
||||
y = RCT2_ADDRESS(RCT2_ADDRESS_PARK_ENTRANCE_Y, sint16)[i] + 16;
|
||||
z = RCT2_ADDRESS(RCT2_ADDRESS_PARK_ENTRANCE_Z, sint16)[i] + 32;
|
||||
r = RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_ROTATION, uint8);
|
||||
r = get_current_rotation();
|
||||
|
||||
xy = 0x40000000 | (y << 16) | x;
|
||||
zr = (z << 16) | (r << 8);
|
||||
|
||||
@@ -1488,7 +1488,7 @@ static void window_ride_init_viewport(rct_window *w)
|
||||
|
||||
focus.sprite.sprite_id = -1;
|
||||
focus.coordinate.zoom = 0;
|
||||
focus.coordinate.rotation = RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_ROTATION, uint8);
|
||||
focus.coordinate.rotation = get_current_rotation();
|
||||
|
||||
|
||||
if (eax >= 0 && eax < ride->num_vehicles && ride->lifecycle_flags & RIDE_LIFECYCLE_ON_TRACK){
|
||||
|
||||
@@ -2152,7 +2152,7 @@ static void window_ride_construction_draw_track_piece(
|
||||
|
||||
z -= bx;
|
||||
int start_x = x;
|
||||
switch (RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_ROTATION, uint32_t)) {
|
||||
switch (get_current_rotation()) {
|
||||
case 0:
|
||||
x = y - x;
|
||||
y = (y + start_x) / 2 - z;
|
||||
|
||||
@@ -1188,7 +1188,7 @@ void window_staff_viewport_init(rct_window* w){
|
||||
}
|
||||
else{
|
||||
focus.type |= VIEWPORT_FOCUS_TYPE_SPRITE | VIEWPORT_FOCUS_TYPE_COORDINATE;
|
||||
focus.rotation = RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_ROTATION, uint8);
|
||||
focus.rotation = get_current_rotation();
|
||||
}
|
||||
|
||||
uint16 viewport_flags;
|
||||
|
||||
@@ -1117,7 +1117,7 @@ void sub_6E1F34(sint16 x, sint16 y, uint16 selected_scenery, sint16* grid_x, sin
|
||||
rotation = scenario_rand() & 0xFF;
|
||||
}
|
||||
|
||||
rotation -= RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_ROTATION, uint8);
|
||||
rotation -= get_current_rotation();
|
||||
rotation &= 0x3;
|
||||
|
||||
// Also places it in lower but think thats for clobering
|
||||
@@ -1195,7 +1195,7 @@ void sub_6E1F34(sint16 x, sint16 y, uint16 selected_scenery, sint16* grid_x, sin
|
||||
rotation = scenario_rand() & 0xFF;
|
||||
}
|
||||
|
||||
rotation -= RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_ROTATION, uint8);
|
||||
rotation -= get_current_rotation();
|
||||
rotation &= 0x3;
|
||||
|
||||
// Also places it in lower but think thats for clobering
|
||||
@@ -1344,7 +1344,7 @@ void sub_6E1F34(sint16 x, sint16 y, uint16 selected_scenery, sint16* grid_x, sin
|
||||
*grid_y &= 0xFFE0;
|
||||
|
||||
uint8 rotation = window_scenery_rotation;
|
||||
rotation -= RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_ROTATION, uint8);
|
||||
rotation -= get_current_rotation();
|
||||
rotation &= 0x3;
|
||||
|
||||
*parameter_1 = (rotation << 8);
|
||||
@@ -1371,7 +1371,7 @@ void sub_6E1F34(sint16 x, sint16 y, uint16 selected_scenery, sint16* grid_x, sin
|
||||
}
|
||||
|
||||
uint8 rotation = window_scenery_rotation;
|
||||
rotation -= RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_ROTATION, uint8);
|
||||
rotation -= get_current_rotation();
|
||||
rotation &= 0x3;
|
||||
|
||||
sint16 z = map_element->base_height;
|
||||
|
||||
@@ -150,7 +150,7 @@ static void window_track_place_draw_mini_preview()
|
||||
if (track->type != RIDE_TYPE_MAZE) {
|
||||
#pragma region Track
|
||||
|
||||
rotation = RCT2_GLOBAL(RCT2_ADDRESS_TRACK_PREVIEW_ROTATION, uint8) + RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_ROTATION, uint32);
|
||||
rotation = RCT2_GLOBAL(RCT2_ADDRESS_TRACK_PREVIEW_ROTATION, uint8) + get_current_rotation();
|
||||
trackElement = RCT2_ADDRESS(0x009D821B, rct_track_element);
|
||||
|
||||
while (trackElement->type != 255) {
|
||||
@@ -249,7 +249,7 @@ static void window_track_place_draw_mini_preview()
|
||||
} else {
|
||||
#pragma region Maze
|
||||
|
||||
rotation = (RCT2_GLOBAL(RCT2_ADDRESS_TRACK_PREVIEW_ROTATION, uint8) + RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_ROTATION, uint32)) & 3;
|
||||
rotation = (RCT2_GLOBAL(RCT2_ADDRESS_TRACK_PREVIEW_ROTATION, uint8) + get_current_rotation()) & 3;
|
||||
mazeElement = RCT2_ADDRESS(0x009D821B, rct_maze_element);
|
||||
while (mazeElement->all != 0) {
|
||||
x = mazeElement->x * 32;
|
||||
@@ -393,7 +393,7 @@ void window_track_place_open()
|
||||
show_gridlines();
|
||||
_window_track_place_last_cost = MONEY32_UNDEFINED;
|
||||
_window_track_place_last_x = 0xFFFF;
|
||||
RCT2_GLOBAL(RCT2_ADDRESS_TRACK_PREVIEW_ROTATION, uint8) = (-RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_ROTATION, uint8) + 2) & 3;
|
||||
RCT2_GLOBAL(RCT2_ADDRESS_TRACK_PREVIEW_ROTATION, uint8) = (-get_current_rotation() + 2) & 3;
|
||||
window_track_place_draw_mini_preview();
|
||||
}
|
||||
|
||||
|
||||
@@ -119,7 +119,7 @@ void window_viewport_open()
|
||||
(1 << WIDX_LOCATE);
|
||||
w->number = _viewportNumber++;
|
||||
|
||||
rotation = RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_ROTATION, sint32);
|
||||
rotation = get_current_rotation();
|
||||
|
||||
// Create viewport
|
||||
viewport_create(w, w->x, w->y, w->width, w->height, 0, 128 * 32, 128 * 32, 0, 1, -1);
|
||||
@@ -245,4 +245,4 @@ static void window_viewport_paint(rct_window *w, rct_drawpixelinfo *dpi)
|
||||
// Draw viewport
|
||||
if (w->viewport != NULL)
|
||||
window_draw_viewport(dpi, w);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user