Add get_current_rotation function and DEBUG_LEVEL macros

This commit is contained in:
Michał Janiszewski 2015-10-30 11:00:35 +01:00
parent be32b5e5f4
commit c0e2a5c7be
26 changed files with 209 additions and 139 deletions

View File

@ -50,6 +50,10 @@ else (DISABLE_NETWORK)
endif (WIN32)
endif (DISABLE_NETWORK)
set(DEBUG_LEVEL 0 CACHE STRING "Select debug level for compilation. Use value in range 03.")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DDEBUG=${DEBUG_LEVEL}")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DDEBUG=${DEBUG_LEVEL}")
# include lib
include_directories("lib/")
# add source files
@ -57,8 +61,8 @@ file(GLOB_RECURSE ORCT2_SOURCES "src/*.c" "src/*.cpp" "lib/argparse/*.c" "lib/cu
if (UNIX)
# force 32bit build for now and set necessary flags to compile code as is
set(CMAKE_C_FLAGS "-m32 -std=gnu99")
set(CMAKE_CXX_FLAGS "-m32 -std=gnu++11")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -m32 -std=gnu99")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -m32 -std=gnu++11")
set(CMAKE_SHARED_LINKER_FLAGS "-m32")
set(CMAKE_EXE_LINKER_FLAGS ${CMAKE_SHARED_LINKER_FLAGS})
endif (UNIX)

View File

@ -108,7 +108,7 @@ int sound_play_panned(int sound_id, int ebx, sint16 x, sint16 y, sint16 z)
}
sint16 rx;
sint16 ry;
switch (RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_ROTATION, uint32)) {
switch (get_current_rotation()) {
case 0:
rx = y - x;
ry = ((y + x) / 2) - z;

View File

@ -30,6 +30,49 @@ enum {
DIAGNOSTIC_LEVEL_COUNT
};
/*
* Compile-time debug levels.
*
* When compiling, just add -DDEBUG={0,1,2,3} (where 0 means disabled)
* Regardless of DEBUG value, a set of defines will be created:
* - DEBUG_LEVEL_1
* - DEBUG_LEVEL_2
* - DEBUG_LEVEL_3
* which you would use like so:
*
* #if DEBUG_LEVEL_1
* (... some debug code ...)
* #if DEBUG_LEVEL_2
* (... more debug code ...)
* #endif // DEBUG_LEVEL_2
* #endif // DEBUG_LEVEL_1
*
* The defines will be either 0 or 1 so compiler will complain about undefined
* macro if you forget to include the file, which would not happen if we were
* only checking whether the define is present or not.
*/
#if defined(DEBUG)
#if DEBUG > 0
#define DEBUG_LEVEL_1 1
#if DEBUG > 1
#define DEBUG_LEVEL_2 1
#if DEBUG > 2
#define DEBUG_LEVEL_3 1
#else
#define DEBUG_LEVEL_3 0
#endif // DEBUG > 2
#else
#define DEBUG_LEVEL_3 0
#define DEBUG_LEVEL_2 0
#endif // DEBUG > 1
#endif // DEBUG > 0
#else
#define DEBUG_LEVEL_3 0
#define DEBUG_LEVEL_2 0
#define DEBUG_LEVEL_1 0
#endif // defined(DEBUG)
extern int _log_levels[DIAGNOSTIC_LEVEL_COUNT];
void diagnostic_log(int diagnosticLevel, const char *format, ...);

View File

@ -357,7 +357,7 @@ bool screenshot_write_png(rct_drawpixelinfo *dpi, const char *path)
void screenshot_giant()
{
int originalRotation = RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_ROTATION, uint8);
int originalRotation = get_current_rotation();
int originalZoom = 0;
rct_window *mainWindow = window_get_main();

View File

@ -140,7 +140,7 @@ void center_2d_coordinates(int x, int y, int z, int* out_x, int* out_y, rct_view
.z = z
};
rct_xy16 coord_2d = coordinate_3d_to_2d(&coord_3d, RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_ROTATION, uint32));
rct_xy16 coord_2d = coordinate_3d_to_2d(&coord_3d, get_current_rotation());
// If the start location was invalid
// propagate the invalid location to the output.
@ -259,7 +259,7 @@ void sub_689174(sint16* x, sint16* y, sint16 *z)
if (pos.x > max && pos.y > max) {
int x_corr[] = { -1, 1, 1, -1 };
int y_corr[] = { -1, -1, 1, 1 };
uint32 rotation = RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_ROTATION, uint32);
uint32 rotation = get_current_rotation();
pos.x += x_corr[rotation] * height;
pos.y += y_corr[rotation] * height;
}
@ -816,7 +816,7 @@ void sub_688485(){
/* rct2: 0x006874B0, 0x00687618, 0x0068778C, 0x00687902, 0x0098199C */
int sub_98199C(sint8 al, sint8 ah, int image_id, sint8 cl, int height, sint16 length_y, sint16 length_x, uint32 rotation){
RCT2_CALLPROC_X(RCT2_ADDRESS(0x98199C, uint32_t)[RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_ROTATION, uint32_t)],
RCT2_CALLPROC_X(RCT2_ADDRESS(0x98199C, uint32_t)[get_current_rotation()],
al | (ah << 8),
image_id,
cl,
@ -858,7 +858,7 @@ int sub_98197C(sint8 al, sint8 ah, int image_id, sint8 cl, int height, sint16 le
};
switch (rotation) {
case 0:
case 0:
rotate_map_coordinates(&coord_3d.x, &coord_3d.y, 0);
break;
case 1:
@ -1008,7 +1008,7 @@ void viewport_vehicle_paint_setup(rct_vehicle *vehicle, int imageDirection)
RCT2_GLOBAL(0x9DEA52, uint16) = 0;
RCT2_GLOBAL(0x9DEA54, uint16) = 0;
RCT2_GLOBAL(0x9DEA56, uint16) = z + 2;
sub_98197C(0, 0, ebx, 0, z, 1, 1, RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_ROTATION, uint32));
sub_98197C(0, 0, ebx, 0, z, 1, 1, get_current_rotation());
return;
}
@ -1087,7 +1087,7 @@ void viewport_litter_paint_setup(rct_litter *litter, int imageDirection)
RCT2_GLOBAL(0x9DEA54, uint16) = 0xFFFC;
RCT2_GLOBAL(0x9DEA56, uint16) = litter->z + 2;
sub_98197C(0, 0xFF, image_id, 0, litter->z, 4, 4, RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_ROTATION, uint32));
sub_98197C(0, 0xFF, image_id, 0, litter->z, 4, 4, get_current_rotation());
}
@ -1125,7 +1125,7 @@ void sprite_paint_setup(uint16 eax, uint16 ecx){
if (dpi->x + dpi->width <= spr->unknown.sprite_left)continue;
if (spr->unknown.sprite_right <= dpi->x)continue;
int image_direction = RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_ROTATION, uint32);
int image_direction = get_current_rotation();
image_direction <<= 3;
image_direction += spr->unknown.sprite_direction;
image_direction &= 0x1F;
@ -1230,7 +1230,7 @@ void viewport_ride_entrance_exit_paint_setup(uint8 direction, int height, rct_ma
sint16 lengthY = (direction & 1) ? 28 : 2;
sint16 lengthX = (direction & 1) ? 2 : 28;
sub_98197C(0, ah, image_id, 0, height, lengthY, lengthX, RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_ROTATION, uint32_t));
sub_98197C(0, ah, image_id, 0, height, lengthY, lengthX, get_current_rotation());
if (transparant_image_id){
if (is_exit){
@ -1252,7 +1252,7 @@ void viewport_ride_entrance_exit_paint_setup(uint8 direction, int height, rct_ma
RCT2_GLOBAL(0x009DEA54, uint16) = (direction & 1) ? 2 : 28;
RCT2_GLOBAL(0x009DEA56, uint16) = height;
sub_98197C(0, ah, image_id, 0, height, lengthY, lengthX, RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_ROTATION, uint32_t));
sub_98197C(0, ah, image_id, 0, height, lengthY, lengthX, get_current_rotation());
if (transparant_image_id){
transparant_image_id += 4;
@ -1367,7 +1367,7 @@ void viewport_park_entrance_paint_setup(uint8 direction, int height, rct_map_ele
RCT2_GLOBAL(0x009DEA54, uint16) = 2;
RCT2_GLOBAL(0x009DEA56, sint16) = height;
sub_98197C(0, 0, image_id, 0, height, 0x1C, 32, RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_ROTATION, uint32_t));
sub_98197C(0, 0, image_id, 0, height, 0x1C, 32, get_current_rotation());
entrance = (rct_entrance_type*)object_entry_groups[OBJECT_TYPE_PARK_ENTRANCE].chunks[0];
image_id = (entrance->image_id + direction * 3) | ghost_id;
@ -1376,7 +1376,7 @@ void viewport_park_entrance_paint_setup(uint8 direction, int height, rct_map_ele
RCT2_GLOBAL(0x009DEA54, uint16) = 2;
RCT2_GLOBAL(0x009DEA56, sint16) = height + 32;
sub_98197C(0, 0x2F, image_id, 0, height, 0x1C, 0x1C, RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_ROTATION, uint32_t));
sub_98197C(0, 0x2F, image_id, 0, height, 0x1C, 0x1C, get_current_rotation());
if ((direction + 1) & (1 << 1))
break;
@ -1423,7 +1423,7 @@ void viewport_park_entrance_paint_setup(uint8 direction, int height, rct_map_ele
RCT2_GLOBAL(0x009DEA54, uint16) = 3;
RCT2_GLOBAL(0x009DEA56, sint16) = height;
sub_98197C(0, 0x4F, image_id, 0, height, di, 0x1A, RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_ROTATION, uint32_t));
sub_98197C(0, 0x4F, image_id, 0, height, di, 0x1A, get_current_rotation());
break;
}
@ -1491,7 +1491,7 @@ void viewport_track_paint_setup(uint8 direction, int height, rct_map_element *ma
RCT2_GLOBAL(0x009DEA52, uint16) = 1000;
RCT2_GLOBAL(0x009DEA54, uint16) = 1000;
RCT2_GLOBAL(0x009DEA56, uint16) = 2047;
sub_98197C(16, 0, ebx, 16, height + ax + 3, 1, 1, RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_ROTATION, uint32));
sub_98197C(16, 0, ebx, 16, height + ax + 3, 1, 1, get_current_rotation());
}
}
@ -1571,7 +1571,7 @@ void viewport_entrance_paint_setup(uint8 direction, int height, rct_map_element*
RCT2_GLOBAL(0x009DEA56, sint16) = z;
RCT2_GLOBAL(0x009DEA56, uint16) += 64;
sub_98197C(16, 0, image_id, 16, height, 1, 1, RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_ROTATION, uint32_t));
sub_98197C(16, 0, image_id, 16, height, 1, 1, get_current_rotation());
}
}
@ -1620,11 +1620,11 @@ void viewport_banner_paint_setup(uint8 direction, int height, rct_map_element* m
0x20000000;
}
sub_98197C(0, 0x15, image_id, 0, height, 1, 1, RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_ROTATION, uint32_t));
sub_98197C(0, 0x15, image_id, 0, height, 1, 1, get_current_rotation());
RCT2_GLOBAL(0x9DEA52, uint32) = RCT2_ADDRESS(0x98D888, uint32)[direction * 2];
image_id++;
sub_98197C(0, 0x15, image_id, 0, height, 1, 1, RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_ROTATION, uint32_t));
sub_98197C(0, 0x15, image_id, 0, height, 1, 1, get_current_rotation());
// Opposite direction
direction ^= 2;
@ -1678,7 +1678,7 @@ static void sub_68B3FB(int x, int y)
rct_map_element* map_element = map_get_first_element_at(x >> 5, y >> 5);
int dx = 0;
switch (RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_ROTATION, uint32_t)) {
switch (get_current_rotation()) {
case 0:
dx = x + y;
break;
@ -1702,7 +1702,7 @@ static void sub_68B3FB(int x, int y)
RCT2_GLOBAL(0x9DE56A, uint16) == RCT2_GLOBAL(RCT2_ADDRESS_MAP_ARROW_X, uint16) &&
RCT2_GLOBAL(0x9DE56E, uint16) == RCT2_GLOBAL(RCT2_ADDRESS_MAP_ARROW_Y, uint16)){
uint8 arrowRotation =
(RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_ROTATION, uint32)
(get_current_rotation()
+ (RCT2_GLOBAL(RCT2_ADDRESS_MAP_ARROW_DIRECTION, uint8) & 3)) & 3;
uint32 imageId =
@ -1719,7 +1719,7 @@ static void sub_68B3FB(int x, int y)
RCT2_GLOBAL(0x9DEA54, uint16) = 0;
RCT2_GLOBAL(0x9DEA56, uint16) = arrowZ + 18;
sub_98197C(0, 0xFF, imageId, 0, arrowZ, 32, 32, RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_ROTATION, uint32));
sub_98197C(0, 0xFF, imageId, 0, arrowZ, 32, 32, get_current_rotation());
}
int bx = dx + 52;
@ -1753,7 +1753,7 @@ static void sub_68B3FB(int x, int y)
RCT2_GLOBAL(0x9DE56C, sint16) = y;
RCT2_GLOBAL(0x9DE57C, uint16) = 0;
do {
int direction = (map_element->type + RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_ROTATION, uint32_t)) & MAP_ELEMENT_DIRECTION_MASK;
int direction = (map_element->type + get_current_rotation()) & MAP_ELEMENT_DIRECTION_MASK;
int height = map_element->base_height * 8;
uint32_t dword_9DE574 = RCT2_GLOBAL(0x9DE574, uint32_t);
@ -1806,7 +1806,7 @@ static void viewport_blank_tiles_paint_setup(int x, int y)
rct_drawpixelinfo *dpi = RCT2_GLOBAL(0x0140E9A8, rct_drawpixelinfo*);
int dx;
switch (RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_ROTATION, uint32_t)) {
switch (get_current_rotation()) {
case 0:
dx = x + y;
break;
@ -1835,14 +1835,14 @@ static void viewport_blank_tiles_paint_setup(int x, int y)
RCT2_GLOBAL(0x9DE56C, sint16) = y;
RCT2_GLOBAL(RCT2_ADDRESS_PAINT_SETUP_CURRENT_TYPE, uint8_t) = VIEWPORT_INTERACTION_ITEM_NONE;
RCT2_CALLPROC_X(
(int)RCT2_ADDRESS(0x98196C, uint32_t*)[RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_ROTATION, uint32_t)],
(int)RCT2_ADDRESS(0x98196C, uint32_t*)[get_current_rotation()],
0xFF00,
3123,
y & 0xFF00,
16,
32,
32,
RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_ROTATION, uint32_t)
get_current_rotation()
);
}
@ -1925,7 +1925,7 @@ void viewport_paint_setup()
uint16 num_vertical_quadrants = (dpi->height + 2128) >> 5;
switch (RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_ROTATION, uint32)){
switch (get_current_rotation()){
case 0:
mapTile.x = mapTile.y - half_x;
mapTile.y = mapTile.y + half_x;
@ -2074,7 +2074,7 @@ void sub_688217_helper(uint16 ax, uint8 flag)
if (!(ps_next->var_1B & (1 << 1))) continue;
int yes = 0;
switch (RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_ROTATION, uint32)) {
switch (get_current_rotation()) {
case 0:
if (my_some_y >= ps_next->some_x && my_other_y >= ps_next->attached_y && my_other_x >= ps_next->attached_x
&& !(my_some_x < ps_next->some_y && my_attached_y < ps_next->other_y && my_attached_x < ps_next->other_x))
@ -2339,7 +2339,7 @@ rct_xy16 screen_coord_to_viewport_coord(rct_viewport *viewport, uint16 x, uint16
rct_xy16 viewport_coord_to_map_coord(int x, int y, int z)
{
rct_xy16 ret;
switch (RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_ROTATION, uint32)) {
switch (get_current_rotation()) {
case 0:
ret.x = -x / 2 + y + z;
ret.y = x / 2 + y + z;
@ -2854,3 +2854,23 @@ void screen_get_map_xy_side_with_z(sint16 screenX, sint16 screenY, sint16 z, sin
*mapX = floor2(*mapX, 32);
*mapY = floor2(*mapY, 32);
}
/**
* Get current viewport rotation.
*
* If an invalid rotation is detected and DEBUG_LEVEL_1 is enabled, an error
* will be reported.
*
* @returns rotation in range 0-3 (inclusive)
*/
int get_current_rotation()
{
int rotation = RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_ROTATION, uint32);
int rotation_masked = rotation & 3;
#if DEBUG_LEVEL_1
if (rotation != rotation_masked) {
log_error("Found wrong rotation %d! Will return %d instead.", rotation, rotation_masked);
}
#endif // DEBUG_LEVEL_1
return rotation_masked;
}

View File

@ -144,4 +144,6 @@ void screen_get_map_xy_quadrant_with_z(sint16 screenX, sint16 screenY, sint16 z,
void screen_get_map_xy_side(sint16 screenX, sint16 screenY, sint16 *mapX, sint16 *mapY, uint8 *side);
void screen_get_map_xy_side_with_z(sint16 screenX, sint16 screenY, sint16 z, sint16 *mapX, sint16 *mapY, uint8 *side);
int get_current_rotation();
#endif

View File

@ -1301,7 +1301,7 @@ void window_scroll_to_location(rct_window *w, int x, int y, int z)
}
}
rct_xy16 map_coordinate = coordinate_3d_to_2d(&location_3d, RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_ROTATION, uint8));
rct_xy16 map_coordinate = coordinate_3d_to_2d(&location_3d, get_current_rotation());
int i = 0;
if (!(RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_FLAGS, uint8) & SCREEN_FLAGS_TITLE_DEMO)) {
@ -1389,7 +1389,7 @@ void window_rotate_camera(rct_window *w, int direction)
z = map_element_height(x, y);
}
RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_ROTATION, uint32) = (RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_ROTATION, uint32) + direction) % 4;
RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_ROTATION, uint32) = (get_current_rotation() + direction) % 4;
int new_x, new_y;
center_2d_coordinates(x, y, z, &new_x, &new_y, viewport);

View File

@ -1986,7 +1986,7 @@ static void ride_spiral_slide_update(rct_ride *ride)
z = ride->station_heights[i];
mapElement = ride_get_station_start_track_element(ride, i);
int rotation = ((mapElement->type & 3) << 2) | RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_ROTATION, uint8);
int rotation = ((mapElement->type & 3) << 2) | get_current_rotation();
x *= 32;
y *= 32;
x += RCT2_GLOBAL(0x0098DDB8 + (rotation * 4), sint16);
@ -3231,7 +3231,7 @@ int ride_music_params_update(sint16 x, sint16 y, sint16 z, uint8 rideIndex, uint
RCT2_GLOBAL(0x009AF47C, uint16) = sampleRate;
sint16 v11;
sint16 v12;
switch (RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_ROTATION, uint32)) {
switch (get_current_rotation()) {
case 0:
v11 = y - x;
v12 = ((y + x) / 2) - z;

View File

@ -716,7 +716,7 @@ int backup_map(){
*(uint16*)(backup_info + 4) = RCT2_GLOBAL(RCT2_ADDRESS_MAP_SIZE_UNITS, uint16);
*(uint16*)(backup_info + 6) = RCT2_GLOBAL(RCT2_ADDRESS_MAP_SIZE_MINUS_2, uint16);
*(uint16*)(backup_info + 8) = RCT2_GLOBAL(RCT2_ADDRESS_MAP_SIZE, uint16);
*(uint32*)(backup_info + 10) = RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_ROTATION, uint32);
*(uint32*)(backup_info + 10) = get_current_rotation();
return 1;
}

View File

@ -182,7 +182,7 @@ void top_spin_paint_tile_0(uint8 rideIndex, uint8 trackSequence, uint8 direction
RCT2_GLOBAL(0x009DEA52, uint16) = 0;
RCT2_GLOBAL(0x009DEA54, uint16) = 0;
RCT2_GLOBAL(0x009DEA56, uint16) = height;
sub_98197C(0, 1, image_id, 0, height, 32, 32, RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_ROTATION, uint32));
sub_98197C(0, 1, image_id, 0, height, 32, 32, get_current_rotation());
RCT2_GLOBAL(0x141E9B4, uint16) = 0xFFFF;
RCT2_GLOBAL(0x141E9B8, uint16) = 0xFFFF;
@ -265,7 +265,7 @@ void top_spin_paint_vehicle(sint8 al, sint8 cl, uint8 rideIndex, uint8 direction
// Left back bottom support
image_id += 572;
sub_98197C(al, 90, image_id, cl, height, lengthY, lengthX, RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_ROTATION, uint32));
sub_98197C(al, 90, image_id, cl, height, lengthY, lengthX, get_current_rotation());
image_id = RCT2_GLOBAL(0x00F441A0, uint32);
if (image_id == 0x20000000) {
@ -290,10 +290,10 @@ void top_spin_paint_vehicle(sint8 al, sint8 cl, uint8 rideIndex, uint8 direction
sub_98199C(
al,
90,
image_id,
cl,
height,
lengthY,
image_id,
cl,
height,
lengthY,
lengthX,
0);
@ -352,18 +352,18 @@ void top_spin_paint_vehicle(sint8 al, sint8 cl, uint8 rideIndex, uint8 direction
sub_98199C(
(sint8)seatCoords.x,
90,
image_id,
90,
image_id,
(sint8)seatCoords.y,
seatCoords.z,
lengthY,
seatCoords.z,
lengthY,
lengthX,
0);
rct_drawpixelinfo* dpi = RCT2_GLOBAL(0x140E9A8, rct_drawpixelinfo*);
if (dpi->zoom_level < 2 && vehicle != NULL && vehicle->num_peeps != 0) {
image_id =
(vehicle->peep_tshirt_colours[0] << 19) |
image_id =
(vehicle->peep_tshirt_colours[0] << 19) |
(vehicle->peep_tshirt_colours[1] << 24);
image_id += seatImageId;
image_id += 0xA0000000;
@ -403,7 +403,7 @@ void top_spin_paint_vehicle(sint8 al, sint8 cl, uint8 rideIndex, uint8 direction
sub_98199C((sint8)seatCoords.x, 90, image_id, (sint8)seatCoords.y, seatCoords.z, lengthY, lengthX, 0);
}
}
}
image_id = RCT2_GLOBAL(0x00F441A0, uint32);
if (image_id == 0x20000000) {
@ -420,12 +420,12 @@ void top_spin_paint_vehicle(sint8 al, sint8 cl, uint8 rideIndex, uint8 direction
image_id += 476;
sub_98199C(
al,
al,
90,
image_id,
cl,
height,
lengthY,
image_id,
cl,
height,
lengthY,
lengthX,
0);
@ -445,10 +445,10 @@ void top_spin_paint_vehicle(sint8 al, sint8 cl, uint8 rideIndex, uint8 direction
sub_98199C(
al,
90,
image_id,
cl,
height,
lengthY,
image_id,
cl,
height,
lengthY,
lengthX,
0);
@ -466,12 +466,12 @@ void top_spin_paint_tile_1(uint8 rideIndex, uint8 trackSequence, uint8 direction
RCT2_GLOBAL(0x009DEA52, uint16) = 0;
RCT2_GLOBAL(0x009DEA54, uint16) = 0;
RCT2_GLOBAL(0x009DEA56, uint16) = height;
sub_98197C(0, 1, image_id, 0, height, 32, 32, RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_ROTATION, uint32));
sub_98197C(0, 1, image_id, 0, height, 32, 32, get_current_rotation());
sint16 x = RCT2_GLOBAL(0x009DE56A, sint16), y = RCT2_GLOBAL(0x009DE56E, sint16);
uint16 entranceLoc =
((x / 32) + loc_7667AE[RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_ROTATION, uint32)].x) |
(((y / 32) + loc_7667AE[RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_ROTATION, uint32)].y) << 8);
uint16 entranceLoc =
((x / 32) + loc_7667AE[get_current_rotation()].x) |
(((y / 32) + loc_7667AE[get_current_rotation()].y) << 8);
uint8 entranceId = (mapElement->properties.track.sequence & 0x70) >> 4;
rct_ride* ride = GET_RIDE(rideIndex);
@ -487,8 +487,8 @@ void top_spin_paint_tile_1(uint8 rideIndex, uint8 trackSequence, uint8 direction
}
entranceLoc =
((x / 32) + loc_7667AC[RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_ROTATION, uint32)].x) |
(((y / 32) + loc_7667AC[RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_ROTATION, uint32)].y) << 8);
((x / 32) + loc_7667AC[get_current_rotation()].x) |
(((y / 32) + loc_7667AC[get_current_rotation()].y) << 8);
if (ride->entrances[entranceId] != entranceLoc && ride->exits[entranceId] != entranceLoc) {
@ -499,9 +499,9 @@ void top_spin_paint_tile_1(uint8 rideIndex, uint8 trackSequence, uint8 direction
sub_98199C(0, 7, image_id, 0, height, 32, 1, 0);
}
top_spin_paint_vehicle(32, 32, rideIndex, direction, height, mapElement);
RCT2_GLOBAL(0x141E9B4, uint16) = height + 2;
RCT2_GLOBAL(0x141E9B6, uint16) = 32;
RCT2_GLOBAL(0x141E9B8, uint16) = 0xFFFF;
@ -532,12 +532,12 @@ void top_spin_paint_tile_2(uint8 rideIndex, uint8 trackSequence, uint8 direction
RCT2_GLOBAL(0x009DEA52, uint16) = 0;
RCT2_GLOBAL(0x009DEA54, uint16) = 0;
RCT2_GLOBAL(0x009DEA56, uint16) = height;
sub_98197C(0, 1, image_id, 0, height, 32, 32, RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_ROTATION, uint32));
sub_98197C(0, 1, image_id, 0, height, 32, 32, get_current_rotation());
sint16 x = RCT2_GLOBAL(0x009DE56A, sint16), y = RCT2_GLOBAL(0x009DE56E, sint16);
uint16 entranceLoc =
((x / 32) + loc_7667AC[RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_ROTATION, uint32)].x) |
(((y / 32) + loc_7667AC[RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_ROTATION, uint32)].y) << 8);
((x / 32) + loc_7667AC[get_current_rotation()].x) |
(((y / 32) + loc_7667AC[get_current_rotation()].y) << 8);
uint8 entranceId = (mapElement->properties.track.sequence & 0x70) >> 4;
rct_ride* ride = GET_RIDE(rideIndex);
@ -579,12 +579,12 @@ void top_spin_paint_tile_4(uint8 rideIndex, uint8 trackSequence, uint8 direction
RCT2_GLOBAL(0x009DEA52, uint16) = 0;
RCT2_GLOBAL(0x009DEA54, uint16) = 0;
RCT2_GLOBAL(0x009DEA56, uint16) = height;
sub_98197C(0, 1, image_id, 0, height, 32, 32, RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_ROTATION, uint32));
sub_98197C(0, 1, image_id, 0, height, 32, 32, get_current_rotation());
sint16 x = RCT2_GLOBAL(0x009DE56A, sint16), y = RCT2_GLOBAL(0x009DE56E, sint16);
uint16 entranceLoc =
((x / 32) + loc_7667AE[RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_ROTATION, uint32)].x) |
(((y / 32) + loc_7667AE[RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_ROTATION, uint32)].y) << 8);
((x / 32) + loc_7667AE[get_current_rotation()].x) |
(((y / 32) + loc_7667AE[get_current_rotation()].y) << 8);
uint8 entranceId = (mapElement->properties.track.sequence & 0x70) >> 4;
rct_ride* ride = GET_RIDE(rideIndex);
@ -626,12 +626,12 @@ void top_spin_paint_tile_3(uint8 rideIndex, uint8 trackSequence, uint8 direction
RCT2_GLOBAL(0x009DEA52, uint16) = 0;
RCT2_GLOBAL(0x009DEA54, uint16) = 0;
RCT2_GLOBAL(0x009DEA56, uint16) = height;
sub_98197C(0, 1, image_id, 0, height, 32, 32, RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_ROTATION, uint32));
sub_98197C(0, 1, image_id, 0, height, 32, 32, get_current_rotation());
sint16 x = RCT2_GLOBAL(0x009DE56A, sint16), y = RCT2_GLOBAL(0x009DE56E, sint16);
uint16 entranceLoc =
((x / 32) + loc_7667AC[RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_ROTATION, uint32)].x) |
(((y / 32) + loc_7667AC[RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_ROTATION, uint32)].y) << 8);
((x / 32) + loc_7667AC[get_current_rotation()].x) |
(((y / 32) + loc_7667AC[get_current_rotation()].y) << 8);
uint8 entranceId = (mapElement->properties.track.sequence & 0x70) >> 4;
rct_ride* ride = GET_RIDE(rideIndex);
@ -647,8 +647,8 @@ void top_spin_paint_tile_3(uint8 rideIndex, uint8 trackSequence, uint8 direction
}
entranceLoc =
((x / 32) + loc_7667AC[(RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_ROTATION, uint32) + 3) & 3].x) |
(((y / 32) + loc_7667AC[(RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_ROTATION, uint32) + 3) & 3].y) << 8);
((x / 32) + loc_7667AC[(get_current_rotation() + 3) & 3].x) |
(((y / 32) + loc_7667AC[(get_current_rotation() + 3) & 3].y) << 8);
if (ride->entrances[entranceId] != entranceLoc && ride->exits[entranceId] != entranceLoc) {
@ -657,7 +657,7 @@ void top_spin_paint_tile_3(uint8 rideIndex, uint8 trackSequence, uint8 direction
RCT2_GLOBAL(0x009DEA52, uint16) = 0;
RCT2_GLOBAL(0x009DEA54, uint16) = 30;
RCT2_GLOBAL(0x009DEA56, uint16) = height + 2;
sub_98197C(0, 7, image_id, 0, height, 1, 32, RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_ROTATION, uint32));
sub_98197C(0, 7, image_id, 0, height, 1, 32, get_current_rotation());
}
top_spin_paint_vehicle(32, -32, rideIndex, direction, height, mapElement);
@ -692,15 +692,15 @@ void top_spin_paint_tile_5(uint8 rideIndex, uint8 trackSequence, uint8 direction
RCT2_GLOBAL(0x009DEA52, uint16) = 0;
RCT2_GLOBAL(0x009DEA54, uint16) = 0;
RCT2_GLOBAL(0x009DEA56, uint16) = height;
sub_98197C(0, 1, image_id, 0, height, 32, 32, RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_ROTATION, uint32));
sub_98197C(0, 1, image_id, 0, height, 32, 32, get_current_rotation());
sint16 x = RCT2_GLOBAL(0x009DE56A, sint16), y = RCT2_GLOBAL(0x009DE56E, sint16);
uint8 entranceId = (mapElement->properties.track.sequence & 0x70) >> 4;
rct_ride* ride = GET_RIDE(rideIndex);
uint16 entranceLoc =
((x / 32) + loc_7667AC[(RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_ROTATION, uint32) + 3) & 3].x) |
(((y / 32) + loc_7667AC[(RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_ROTATION, uint32) + 3) & 3].y) << 8);
((x / 32) + loc_7667AC[(get_current_rotation() + 3) & 3].x) |
(((y / 32) + loc_7667AC[(get_current_rotation() + 3) & 3].y) << 8);
if (ride->entrances[entranceId] != entranceLoc && ride->exits[entranceId] != entranceLoc) {
image_id = 22139 | RCT2_GLOBAL(0x00F441A0, uint32);
@ -708,7 +708,7 @@ void top_spin_paint_tile_5(uint8 rideIndex, uint8 trackSequence, uint8 direction
RCT2_GLOBAL(0x009DEA52, uint16) = 0;
RCT2_GLOBAL(0x009DEA54, uint16) = 30;
RCT2_GLOBAL(0x009DEA56, uint16) = height + 2;
sub_98197C(0, 7, image_id, 0, height, 1, 32, RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_ROTATION, uint32));
sub_98197C(0, 7, image_id, 0, height, 1, 32, get_current_rotation());
}
top_spin_paint_vehicle(0, -32, rideIndex, direction, height, mapElement);
@ -740,12 +740,12 @@ void top_spin_paint_tile_6(uint8 rideIndex, uint8 trackSequence, uint8 direction
RCT2_GLOBAL(0x009DEA52, uint16) = 0;
RCT2_GLOBAL(0x009DEA54, uint16) = 0;
RCT2_GLOBAL(0x009DEA56, uint16) = height;
sub_98197C(0, 1, image_id, 0, height, 32, 32, RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_ROTATION, uint32));
sub_98197C(0, 1, image_id, 0, height, 32, 32, get_current_rotation());
sint16 x = RCT2_GLOBAL(0x009DE56A, sint16), y = RCT2_GLOBAL(0x009DE56E, sint16);
uint16 entranceLoc =
((x / 32) + loc_7667AE[RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_ROTATION, uint32)].x) |
(((y / 32) + loc_7667AE[RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_ROTATION, uint32)].y) << 8);
((x / 32) + loc_7667AE[get_current_rotation()].x) |
(((y / 32) + loc_7667AE[get_current_rotation()].y) << 8);
uint8 entranceId = (mapElement->properties.track.sequence & 0x70) >> 4;
rct_ride* ride = GET_RIDE(rideIndex);
@ -761,8 +761,8 @@ void top_spin_paint_tile_6(uint8 rideIndex, uint8 trackSequence, uint8 direction
}
entranceLoc =
((x / 32) + loc_7667AE[(RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_ROTATION, uint32) + 1) & 3].x) |
(((y / 32) + loc_7667AE[(RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_ROTATION, uint32) + 1) & 3].y) << 8);
((x / 32) + loc_7667AE[(get_current_rotation() + 1) & 3].x) |
(((y / 32) + loc_7667AE[(get_current_rotation() + 1) & 3].y) << 8);
if (ride->entrances[entranceId] != entranceLoc && ride->exits[entranceId] != entranceLoc) {
@ -771,7 +771,7 @@ void top_spin_paint_tile_6(uint8 rideIndex, uint8 trackSequence, uint8 direction
RCT2_GLOBAL(0x009DEA54, uint16) = 2;
RCT2_GLOBAL(0x009DEA56, uint16) = height + 2;
sub_98197C(0, 7, image_id, 0, height, 32, 1, RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_ROTATION, uint32));
sub_98197C(0, 7, image_id, 0, height, 32, 1, get_current_rotation());
}
top_spin_paint_vehicle(-32, 32, rideIndex, direction, height, mapElement);
@ -806,15 +806,15 @@ void top_spin_paint_tile_7(uint8 rideIndex, uint8 trackSequence, uint8 direction
RCT2_GLOBAL(0x009DEA52, uint16) = 0;
RCT2_GLOBAL(0x009DEA54, uint16) = 0;
RCT2_GLOBAL(0x009DEA56, uint16) = height;
sub_98197C(0, 1, image_id, 0, height, 32, 32, RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_ROTATION, uint32));
sub_98197C(0, 1, image_id, 0, height, 32, 32, get_current_rotation());
sint16 x = RCT2_GLOBAL(0x009DE56A, sint16), y = RCT2_GLOBAL(0x009DE56E, sint16);
uint8 entranceId = (mapElement->properties.track.sequence & 0x70) >> 4;
rct_ride* ride = GET_RIDE(rideIndex);
uint16 entranceLoc =
((x / 32) + loc_7667AE[(RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_ROTATION, uint32) + 1) & 3].x) |
(((y / 32) + loc_7667AE[(RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_ROTATION, uint32) + 1) & 3].y) << 8);
((x / 32) + loc_7667AE[(get_current_rotation() + 1) & 3].x) |
(((y / 32) + loc_7667AE[(get_current_rotation() + 1) & 3].y) << 8);
if (ride->entrances[entranceId] != entranceLoc && ride->exits[entranceId] != entranceLoc) {
@ -823,12 +823,12 @@ void top_spin_paint_tile_7(uint8 rideIndex, uint8 trackSequence, uint8 direction
RCT2_GLOBAL(0x009DEA52, uint16) = 29;
RCT2_GLOBAL(0x009DEA54, uint16) = 0;
RCT2_GLOBAL(0x009DEA56, uint16) = height + 3;
sub_98197C(0, 7, image_id, 0, height, 28, 1, RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_ROTATION, uint32));
sub_98197C(0, 7, image_id, 0, height, 28, 1, get_current_rotation());
}
entranceLoc =
((x / 32) + loc_7667AC[(RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_ROTATION, uint32) + 3) & 3].x) |
(((y / 32) + loc_7667AC[(RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_ROTATION, uint32) + 3) & 3].y) << 8);
((x / 32) + loc_7667AC[(get_current_rotation() + 3) & 3].x) |
(((y / 32) + loc_7667AC[(get_current_rotation() + 3) & 3].y) << 8);
if (ride->entrances[entranceId] != entranceLoc && ride->exits[entranceId] != entranceLoc) {
@ -837,7 +837,7 @@ void top_spin_paint_tile_7(uint8 rideIndex, uint8 trackSequence, uint8 direction
RCT2_GLOBAL(0x009DEA52, uint16) = 0;
RCT2_GLOBAL(0x009DEA54, uint16) = 29;
RCT2_GLOBAL(0x009DEA56, uint16) = height + 3;
sub_98197C(0, 7, image_id, 0, height, 1, 28, RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_ROTATION, uint32));
sub_98197C(0, 7, image_id, 0, height, 1, 28, get_current_rotation());
}
top_spin_paint_vehicle(-32, -32, rideIndex, direction, height, mapElement);
@ -872,15 +872,15 @@ void top_spin_paint_tile_8(uint8 rideIndex, uint8 trackSequence, uint8 direction
RCT2_GLOBAL(0x009DEA52, uint16) = 0;
RCT2_GLOBAL(0x009DEA54, uint16) = 0;
RCT2_GLOBAL(0x009DEA56, uint16) = height;
sub_98197C(0, 1, image_id, 0, height, 32, 32, RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_ROTATION, uint32));
sub_98197C(0, 1, image_id, 0, height, 32, 32, get_current_rotation());
sint16 x = RCT2_GLOBAL(0x009DE56A, sint16), y = RCT2_GLOBAL(0x009DE56E, sint16);
uint8 entranceId = (mapElement->properties.track.sequence & 0x70) >> 4;
rct_ride* ride = GET_RIDE(rideIndex);
uint16 entranceLoc =
((x / 32) + loc_7667AE[(RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_ROTATION, uint32) + 1) & 3].x) |
(((y / 32) + loc_7667AE[(RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_ROTATION, uint32) + 1) & 3].y) << 8);
((x / 32) + loc_7667AE[(get_current_rotation() + 1) & 3].x) |
(((y / 32) + loc_7667AE[(get_current_rotation() + 1) & 3].y) << 8);
if (ride->entrances[entranceId] != entranceLoc && ride->exits[entranceId] != entranceLoc) {
@ -889,7 +889,7 @@ void top_spin_paint_tile_8(uint8 rideIndex, uint8 trackSequence, uint8 direction
RCT2_GLOBAL(0x009DEA54, uint16) = 0;
RCT2_GLOBAL(0x009DEA56, uint16) = height + 2;
sub_98197C(0, 7, image_id, 0, height, 32, 1, RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_ROTATION, uint32));
sub_98197C(0, 7, image_id, 0, height, 32, 1, get_current_rotation());
}
top_spin_paint_vehicle(-32, 0, rideIndex, direction, height, mapElement);
@ -910,7 +910,7 @@ void top_spin_paint_tile_8(uint8 rideIndex, uint8 trackSequence, uint8 direction
}
}
/* rct2: 0x007667BC
/* rct2: 0x007667BC
*/
void top_spin_paint_setup_rot_0(uint8 rideIndex, uint8 trackSequence, uint8 direction, int height, rct_map_element* mapElement) {
switch (trackSequence)
@ -1052,4 +1052,4 @@ void top_spin_paint_setup_rot_3(uint8 rideIndex, uint8 trackSequence, uint8 dire
break;
}
return;
}
}

View File

@ -991,7 +991,7 @@ int scenario_save(SDL_RWops* rw, int flags)
viewX = viewport->view_width / 2 + viewport->view_x;
viewY = viewport->view_height / 2 + viewport->view_y;
viewZoom = viewport->zoom;
viewRotation = RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_ROTATION, uint8);
viewRotation = get_current_rotation();
} else {
viewX = 0;
viewY = 0;
@ -1064,7 +1064,7 @@ int scenario_save_network(SDL_RWops* rw)
viewX = viewport->view_width / 2 + viewport->view_x;
viewY = viewport->view_height / 2 + viewport->view_y;
viewZoom = viewport->zoom;
viewRotation = RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_ROTATION, uint8);
viewRotation = get_current_rotation();
} else {
viewX = 0;
viewY = 0;

View File

@ -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;

View File

@ -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;

View File

@ -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;

View File

@ -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;
}

View File

@ -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);

View File

@ -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){

View File

@ -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;

View File

@ -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;

View File

@ -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;

View File

@ -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();
}

View File

@ -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);
}
}

View File

@ -3539,28 +3539,28 @@ void map_get_bounding_box(int ax, int ay, int bx, int by, int *left, int *top, i
int x, y;
x = ax;
y = ay;
translate_3d_to_2d(RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_ROTATION, uint32), &x, &y);
translate_3d_to_2d(get_current_rotation(), &x, &y);
*left = x;
*right = x;
*top = y;
*bottom = y;
x = bx;
y = ay;
translate_3d_to_2d(RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_ROTATION, uint32), &x, &y);
translate_3d_to_2d(get_current_rotation(), &x, &y);
if (x < *left) *left = x;
if (x > *right) *right = x;
if (y > *bottom) *bottom = y;
if (y < *top) *top = y;
x = bx;
y = by;
translate_3d_to_2d(RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_ROTATION, uint32), &x, &y);
translate_3d_to_2d(get_current_rotation(), &x, &y);
if (x < *left) *left = x;
if (x > *right) *right = x;
if (y > *bottom) *bottom = y;
if (y < *top) *top = y;
x = ax;
y = by;
translate_3d_to_2d(RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_ROTATION, uint32), &x, &y);
translate_3d_to_2d(get_current_rotation(), &x, &y);
if (x < *left) *left = x;
if (x > *right) *right = x;
if (y > *bottom) *bottom = y;
@ -4431,7 +4431,7 @@ void map_invalidate_tile_under_zoom(int x, int y, int z0, int z1, int maxZoom)
x += 16;
y += 16;
translate_3d_to_2d(RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_ROTATION, uint32), &x, &y);
translate_3d_to_2d(get_current_rotation(), &x, &y);
x1 = x - 32;
y1 = y - 32 - z1;

View File

@ -22,6 +22,7 @@
#include "../ride/ride.h"
#include "../ride/ride_data.h"
#include "../ride/track.h"
#include "../interface/viewport.h"
#include "map_animation.h"
#include "map.h"
#include "scenery.h"
@ -150,7 +151,7 @@ static bool map_animation_invalidate_queue_banner(int x, int y, int baseZ)
if (!(mapElement->properties.path.type & PATH_FLAG_QUEUE_BANNER))
continue;
int direction = ((mapElement->type >> 6) + RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_ROTATION, uint8)) & 3;
int direction = ((mapElement->type >> 6) + get_current_rotation()) & 3;
if (direction == MAP_ELEMENT_DIRECTION_NORTH || direction == MAP_ELEMENT_DIRECTION_EAST) {
baseZ = mapElement->base_height * 8;
map_invalidate_tile_zoom1(x, y, baseZ + 16, baseZ + 30);
@ -542,4 +543,4 @@ static const map_animation_invalidate_event_handler _animatedObjectEventHandlers
map_animation_invalidate_large_scenery,
map_animation_invalidate_wall_unknown,
map_animation_invalidate_wall
};
};

View File

@ -96,8 +96,8 @@ void money_effect_update(rct_money_effect *moneyEffect)
return;
moneyEffect->move_delay = 0;
int x = moneyEffect->x + _moneyEffectMoveOffset[RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_ROTATION, uint8)].x;
int y = moneyEffect->y + _moneyEffectMoveOffset[RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_ROTATION, uint8)].y;
int x = moneyEffect->x + _moneyEffectMoveOffset[get_current_rotation()].x;
int y = moneyEffect->y + _moneyEffectMoveOffset[get_current_rotation()].y;
int z = moneyEffect->z;
sprite_move(x, y, z, (rct_sprite*)moneyEffect);

View File

@ -451,7 +451,7 @@ void sprite_move(sint16 x, sint16 y, sint16 z, rct_sprite* sprite){
return;
}
sint16 new_x = x, new_y = y, start_x = x;
switch (RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_ROTATION, uint32)){
switch (get_current_rotation()){
case 0:
new_x = new_y - new_x;
new_y = (new_y + start_x) / 2 - z;