add global macros for viewport variables

This commit is contained in:
Ted John 2016-04-25 21:37:48 +01:00
parent aa77c06c01
commit 870a8b55e5
14 changed files with 99 additions and 94 deletions

View File

@ -161,7 +161,7 @@ bool wooden_a_supports_paint_setup(int supportType, int special, int height, uin
*underground = false;
}
if (RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_VIEWPORT_FLAGS, uint16) & VIEWPORT_FLAG_INVISIBLE_SUPPORTS) {
if (gCurrentViewportFlags & VIEWPORT_FLAG_INVISIBLE_SUPPORTS) {
return false;
}
@ -311,7 +311,7 @@ bool wooden_b_supports_paint_setup(int supportType, int special, int height, uin
*/
bool metal_a_supports_paint_setup(int supportType, int segment, int special, int height, uint32 imageColourFlags)
{
if (RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_VIEWPORT_FLAGS, uint16) & VIEWPORT_FLAG_INVISIBLE_SUPPORTS) {
if (gCurrentViewportFlags & VIEWPORT_FLAG_INVISIBLE_SUPPORTS) {
return false;
}

View File

@ -536,13 +536,12 @@ static void editor_finalise_main_view()
rct_viewport *viewport = w->viewport;
w->viewport_target_sprite = -1;
w->saved_view_x = RCT2_GLOBAL(RCT2_ADDRESS_SAVED_VIEW_X, sint16);
w->saved_view_y = RCT2_GLOBAL(RCT2_ADDRESS_SAVED_VIEW_Y, sint16);
w->saved_view_x = gSavedViewX;
w->saved_view_y = gSavedViewY;
gCurrentRotation = gSavedViewRotation;
RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_ROTATION, uint8) = RCT2_GLOBAL(RCT2_ADDRESS_SAVED_VIEW_ZOOM_AND_ROTATION, uint16) >> 8;
int zoom_difference = RCT2_GLOBAL(RCT2_ADDRESS_SAVED_VIEW_ZOOM_AND_ROTATION, sint16) - viewport->zoom;
viewport->zoom = RCT2_GLOBAL(RCT2_ADDRESS_SAVED_VIEW_ZOOM_AND_ROTATION, uint16) & 0xFF;
int zoom_difference = gSavedViewZoom - viewport->zoom;
viewport->zoom = gSavedViewZoom;
if (zoom_difference != 0) {
if (zoom_difference >= 0) {
viewport->view_width <<= zoom_difference;

View File

@ -974,19 +974,19 @@ void game_load_init()
mainWindow = window_get_main();
mainWindow->viewport_target_sprite = -1;
mainWindow->saved_view_x = RCT2_GLOBAL(RCT2_ADDRESS_SAVED_VIEW_X, sint16);
mainWindow->saved_view_y = RCT2_GLOBAL(RCT2_ADDRESS_SAVED_VIEW_Y, sint16);
uint8 _cl = (RCT2_GLOBAL(RCT2_ADDRESS_SAVED_VIEW_ZOOM_AND_ROTATION, sint16) & 0xFF) - mainWindow->viewport->zoom;
mainWindow->viewport->zoom = RCT2_GLOBAL(RCT2_ADDRESS_SAVED_VIEW_ZOOM_AND_ROTATION, sint16) & 0xFF;
*((char*)(&RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_ROTATION, sint32))) = RCT2_GLOBAL(RCT2_ADDRESS_SAVED_VIEW_ZOOM_AND_ROTATION, sint16) >> 8;
if (_cl != 0) {
if (_cl < 0) {
_cl = -_cl;
mainWindow->viewport->view_width >>= _cl;
mainWindow->viewport->view_height >>= _cl;
mainWindow->saved_view_x = gSavedViewX;
mainWindow->saved_view_y = gSavedViewY;
uint8 zoomDifference = gSavedViewZoom - mainWindow->viewport->zoom;
mainWindow->viewport->zoom = gSavedViewZoom;
gCurrentRotation = gSavedViewRotation;
if (zoomDifference != 0) {
if (zoomDifference < 0) {
zoomDifference = -zoomDifference;
mainWindow->viewport->view_width >>= zoomDifference;
mainWindow->viewport->view_height >>= zoomDifference;
} else {
mainWindow->viewport->view_width <<= _cl;
mainWindow->viewport->view_height <<= _cl;
mainWindow->viewport->view_width <<= zoomDifference;
mainWindow->viewport->view_height <<= zoomDifference;
}
}
mainWindow->saved_view_x -= mainWindow->viewport->view_width >> 1;

View File

@ -217,8 +217,7 @@ void screenshot_giant()
viewport.view_x = x - ((viewport.view_width << zoom) / 2);
viewport.view_y = y - ((viewport.view_height << zoom) / 2);
viewport.zoom = zoom;
RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_ROTATION, uint8) = rotation;
gCurrentRotation = rotation;
// Ensure sprites appear regardless of rotation
reset_all_sprite_quadrant_placements();
@ -358,14 +357,12 @@ int cmdline_for_screenshot(const char **argv, int argc)
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;
gCurrentRotation = 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;
viewport.view_x = gSavedViewX - (viewport.view_width / 2);
viewport.view_y = gSavedViewY - (viewport.view_height / 2);
viewport.zoom = gSavedViewZoom;
gCurrentRotation = gSavedViewRotation;
}
// Ensure sprites appear regardless of rotation

View File

@ -764,7 +764,7 @@ void paint_attached_ps(paint_struct* ps, paint_struct* attached_ps, rct_drawpixe
sint16 y = attached_ps->attached_y + ps->y;
int image_id = attached_ps->image_id;
if (RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_VIEWPORT_FLAGS, uint16) & VIEWPORT_FLAG_SEETHROUGH_RIDES){
if (gCurrentViewportFlags & VIEWPORT_FLAG_SEETHROUGH_RIDES) {
if (ps->sprite_type == 3){
if (image_id & 0x40000000){
image_id &= 0x7FFFF;
@ -773,7 +773,7 @@ void paint_attached_ps(paint_struct* ps, paint_struct* attached_ps, rct_drawpixe
}
}
if (RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_VIEWPORT_FLAGS, uint16) & VIEWPORT_FLAG_SEETHROUGH_SCENERY){
if (gCurrentViewportFlags & VIEWPORT_FLAG_SEETHROUGH_SCENERY) {
if (ps->sprite_type == 5){
if (image_id & 0x40000000){
image_id &= 0x7FFFF;
@ -809,7 +809,7 @@ void sub_688485(){
}
}
int image_id = ps->image_id;
if (RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_VIEWPORT_FLAGS, uint16) & VIEWPORT_FLAG_SEETHROUGH_RIDES){
if (gCurrentViewportFlags & VIEWPORT_FLAG_SEETHROUGH_RIDES) {
if (ps->sprite_type == 3){
if (!(image_id & 0x40000000)){
image_id &= 0x7FFFF;
@ -817,7 +817,7 @@ void sub_688485(){
}
}
}
if (RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_VIEWPORT_FLAGS, uint16) & VIEWPORT_FLAG_UNDERGROUND_INSIDE){
if (gCurrentViewportFlags & VIEWPORT_FLAG_UNDERGROUND_INSIDE) {
if (ps->sprite_type == 9){
if (!(image_id & 0x40000000)){
image_id &= 0x7FFFF;
@ -825,7 +825,7 @@ void sub_688485(){
}
}
}
if (RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_VIEWPORT_FLAGS, uint16) & VIEWPORT_FLAG_SEETHROUGH_SCENERY){
if (gCurrentViewportFlags & VIEWPORT_FLAG_SEETHROUGH_SCENERY) {
if (ps->sprite_type == 10 || ps->sprite_type == 12 || ps->sprite_type == 9 || ps->sprite_type == 5){
if (!(image_id & 0x40000000)){
image_id &= 0x7FFFF;
@ -1307,7 +1307,7 @@ void sprite_paint_setup(const uint16 eax, const uint16 ecx){
if (RCT2_GLOBAL(0x9DEA6F, uint8) & 1) return;
if (RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_VIEWPORT_FLAGS, uint16) & VIEWPORT_FLAG_INVISIBLE_SPRITES) return;
if (gCurrentViewportFlags & VIEWPORT_FLAG_INVISIBLE_SPRITES) return;
dpi = RCT2_GLOBAL(0x140E9A8, rct_drawpixelinfo*);
if (dpi->zoom_level > 2) return;
@ -1624,7 +1624,7 @@ void viewport_track_paint_setup(uint8 direction, int height, rct_map_element *ma
trackSequence = mapElement->properties.track.sequence & 0x0F;
trackColourScheme = mapElement->properties.track.colour & 3;
if ((RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_VIEWPORT_FLAGS, uint16) & VIEWPORT_FLAG_TRACK_HEIGHTS) && dpi->zoom_level == 0) {
if ((gCurrentViewportFlags & VIEWPORT_FLAG_TRACK_HEIGHTS) && dpi->zoom_level == 0) {
RCT2_GLOBAL(RCT2_ADDRESS_PAINT_SETUP_CURRENT_TYPE, uint8) = 0;
if (RCT2_ADDRESS(0x00999694, uint32)[trackType] & (1 << trackSequence)) {
uint16 ax = RideData5[ride->type].z_offset;
@ -1714,7 +1714,7 @@ void viewport_entrance_paint_setup(uint8 direction, int height, rct_map_element*
rct_drawpixelinfo* dpi = RCT2_GLOBAL(0x140E9A8, rct_drawpixelinfo*);
if (RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_VIEWPORT_FLAGS, uint16) & VIEWPORT_FLAG_PATH_HEIGHTS &&
if (gCurrentViewportFlags & VIEWPORT_FLAG_PATH_HEIGHTS &&
dpi->zoom_level == 0){
uint32 ebx =
(map_element->properties.entrance.type << 4) |
@ -2372,7 +2372,7 @@ static void viewport_draw_money_effects()
* ebp: bottom
*/
void viewport_paint(rct_viewport* viewport, rct_drawpixelinfo* dpi, int left, int top, int right, int bottom){
RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_VIEWPORT_FLAGS, uint16) = viewport->flags;
gCurrentViewportFlags = viewport->flags;
RCT2_GLOBAL(RCT2_ADDRESS_VIEWPORT_ZOOM, uint16) = viewport->zoom;
uint16 width = right - left;
@ -2439,9 +2439,9 @@ void viewport_paint(rct_viewport* viewport, rct_drawpixelinfo* dpi, int left, in
dpi2->bits = bits_pointer;
dpi2->pitch = pitch;
if (RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_VIEWPORT_FLAGS, uint16) & (VIEWPORT_FLAG_HIDE_VERTICAL | VIEWPORT_FLAG_HIDE_BASE | VIEWPORT_FLAG_UNDERGROUND_INSIDE)){
if (gCurrentViewportFlags & (VIEWPORT_FLAG_HIDE_VERTICAL | VIEWPORT_FLAG_HIDE_BASE | VIEWPORT_FLAG_UNDERGROUND_INSIDE)){
uint8 colour = 0x0A;
if (RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_VIEWPORT_FLAGS, uint16) & VIEWPORT_FLAG_INVISIBLE_SPRITES){
if (gCurrentViewportFlags & VIEWPORT_FLAG_INVISIBLE_SPRITES){
colour = 0;
}
gfx_clear(dpi2, colour);
@ -2455,7 +2455,7 @@ void viewport_paint(rct_viewport* viewport, rct_drawpixelinfo* dpi, int left, in
sub_688485();
int weather_colour = RCT2_ADDRESS(0x98195C, uint32)[gClimateCurrentWeatherGloom];
if ((weather_colour != -1) && (!(RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_VIEWPORT_FLAGS, uint16) & VIEWPORT_FLAG_INVISIBLE_SPRITES)) && (!(RCT2_GLOBAL(0x9DEA6F, uint8) & 1))){
if ((weather_colour != -1) && (!(gCurrentViewportFlags & VIEWPORT_FLAG_INVISIBLE_SPRITES)) && (!(RCT2_GLOBAL(0x9DEA6F, uint8) & 1))){
gfx_fill_rect(dpi2, dpi2->x, dpi2->y, dpi2->width + dpi2->x - 1, dpi2->height + dpi2->y - 1, weather_colour);
}
viewport_draw_money_effects();
@ -3312,12 +3312,12 @@ void screen_get_map_xy_side_with_z(sint16 screenX, sint16 screenY, sint16 z, sin
*/
uint8 get_current_rotation()
{
uint32 rotation = RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_ROTATION, uint32);
uint32 rotation_masked = rotation & 3;
uint8 rotation = gCurrentRotation;
uint8 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);
log_error("Found wrong rotation %d! Will return %d instead.", (uint32)rotation, (uint32)rotation_masked);
}
#endif // DEBUG_LEVEL_1
return (uint8)rotation_masked;
return rotation_masked;
}

View File

@ -90,6 +90,13 @@ typedef struct {
#define MAX_VIEWPORT_COUNT MAX_WINDOW_COUNT
#define gSavedViewX RCT2_GLOBAL(RCT2_ADDRESS_SAVED_VIEW_X, sint16)
#define gSavedViewY RCT2_GLOBAL(RCT2_ADDRESS_SAVED_VIEW_Y, sint16)
#define gSavedViewZoom RCT2_GLOBAL(RCT2_ADDRESS_SAVED_VIEW_ZOOM_AND_ROTATION, uint8)
#define gSavedViewRotation RCT2_GLOBAL(RCT2_ADDRESS_SAVED_VIEW_ZOOM_AND_ROTATION + 1, uint8)
#define gCurrentRotation RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_ROTATION, uint8)
#define gCurrentViewportFlags RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_VIEWPORT_FLAGS, uint16)
// rct2: 0x014234BC
extern rct_viewport g_viewport_list[MAX_VIEWPORT_COUNT];

View File

@ -1428,7 +1428,7 @@ void window_rotate_camera(rct_window *w, int direction)
z = map_element_height(x, y);
}
RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_ROTATION, uint32) = (get_current_rotation() + direction) & 3;
gCurrentRotation = (get_current_rotation() + direction) & 3;
int new_x, new_y;
center_2d_coordinates(x, y, z, &new_x, &new_y, viewport);

View File

@ -1032,10 +1032,10 @@ void S4Importer::ImportScenarioObjective()
void S4Importer::ImportSavedView()
{
RCT2_GLOBAL(RCT2_ADDRESS_SAVED_VIEW_X, uint16) = _s4.view_x;
RCT2_GLOBAL(RCT2_ADDRESS_SAVED_VIEW_Y, uint16) = _s4.view_y;
RCT2_GLOBAL(RCT2_ADDRESS_SAVED_VIEW_ZOOM_AND_ROTATION, uint8) = _s4.view_zoom;
RCT2_GLOBAL(RCT2_ADDRESS_SAVED_VIEW_ZOOM_AND_ROTATION + 1, uint8) = _s4.view_rotation;
gSavedViewX = _s4.view_x;
gSavedViewY = _s4.view_y;
gSavedViewZoom = _s4.view_zoom;
gSavedViewRotation = _s4.view_rotation;
}
void S4Importer::ClearExtraTileEntries()

View File

@ -744,7 +744,7 @@ void reload_map_backup()
gMapSizeUnits = *(uint16*)(backup_info + 4);
gMapSizeMinus2 = *(uint16*)(backup_info + 6);
gMapSize = *(uint16*)(backup_info + 8);
RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_ROTATION, uint32) = *(uint32*)(backup_info + 10);
gCurrentRotation = *(uint8*)(backup_info + 10);
free(RCT2_GLOBAL(0xF440ED, uint8*));
free(RCT2_GLOBAL(0xF440F1, uint8*));
@ -2149,7 +2149,7 @@ void draw_track_preview(uint8** preview){
int x = center_y - center_x - width / 2;
int y = (center_y + center_x) / 2 - center_z - height / 2;
RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_ROTATION, uint32) = 0;
gCurrentRotation = 0;
view->width = 370;
view->height = 217;
@ -2179,7 +2179,7 @@ void draw_track_preview(uint8** preview){
dpi->bits += TRACK_PREVIEW_IMAGE_SIZE;
RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_ROTATION, uint32) = 1;
gCurrentRotation = 1;
x = -center_y - center_x - width / 2;
y = (center_y - center_x) / 2 - center_z - height / 2;
@ -2194,7 +2194,7 @@ void draw_track_preview(uint8** preview){
dpi->bits += TRACK_PREVIEW_IMAGE_SIZE;
RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_ROTATION, uint32) = 2;
gCurrentRotation = 2;
x = center_x - center_y - width / 2;
y = (-center_y - center_x) / 2 - center_z - height / 2;
@ -2209,7 +2209,7 @@ void draw_track_preview(uint8** preview){
dpi->bits += TRACK_PREVIEW_IMAGE_SIZE;
RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_ROTATION, uint32) = 3;
gCurrentRotation = 3;
x = center_x + center_y - width / 2;
y = (center_x - center_y) / 2 - center_z - height / 2;

View File

@ -243,20 +243,20 @@ void scenario_begin()
mainWindow = window_get_main();
mainWindow->viewport_target_sprite = -1;
mainWindow->saved_view_x = RCT2_GLOBAL(RCT2_ADDRESS_SAVED_VIEW_X, sint16);
mainWindow->saved_view_y = RCT2_GLOBAL(RCT2_ADDRESS_SAVED_VIEW_Y, sint16);
mainWindow->saved_view_x = gSavedViewX;
mainWindow->saved_view_y = gSavedViewY;
uint8 _cl = (RCT2_GLOBAL(RCT2_ADDRESS_SAVED_VIEW_ZOOM_AND_ROTATION, sint16) & 0xFF) - mainWindow->viewport->zoom;
mainWindow->viewport->zoom = RCT2_GLOBAL(RCT2_ADDRESS_SAVED_VIEW_ZOOM_AND_ROTATION, sint16) & 0xFF;
*((char*)(&RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_ROTATION, sint32))) = RCT2_GLOBAL(RCT2_ADDRESS_SAVED_VIEW_ZOOM_AND_ROTATION, sint16) >> 8;
if (_cl != 0) {
if (_cl < 0) {
_cl = -_cl;
mainWindow->viewport->view_width >>= _cl;
mainWindow->viewport->view_height >>= _cl;
uint8 zoomDifference = gSavedViewZoom - mainWindow->viewport->zoom;
mainWindow->viewport->zoom = gSavedViewZoom;
gCurrentRotation = gSavedViewRotation;
if (zoomDifference != 0) {
if (zoomDifference < 0) {
zoomDifference = -zoomDifference;
mainWindow->viewport->view_width >>= zoomDifference;
mainWindow->viewport->view_height >>= zoomDifference;
} else {
mainWindow->viewport->view_width <<= _cl;
mainWindow->viewport->view_height <<= _cl;
mainWindow->viewport->view_width <<= zoomDifference;
mainWindow->viewport->view_height <<= zoomDifference;
}
}
mainWindow->saved_view_x -= mainWindow->viewport->view_width >> 1;
@ -983,15 +983,16 @@ int scenario_save(SDL_RWops* rw, int flags)
viewZoom = viewport->zoom;
viewRotation = get_current_rotation();
} else {
viewX = RCT2_GLOBAL(RCT2_ADDRESS_SAVED_VIEW_X, uint16);
viewY = RCT2_GLOBAL(RCT2_ADDRESS_SAVED_VIEW_Y, uint16);
viewZoom = RCT2_GLOBAL(RCT2_ADDRESS_SAVED_VIEW_ZOOM_AND_ROTATION, uint16) & 0xFF;
viewRotation = RCT2_GLOBAL(RCT2_ADDRESS_SAVED_VIEW_ZOOM_AND_ROTATION, uint16) >> 8;
viewX = gSavedViewX;
viewY = gSavedViewY;
viewZoom = gSavedViewZoom;
viewRotation = gSavedViewRotation;
}
RCT2_GLOBAL(RCT2_ADDRESS_SAVED_VIEW_X, uint16) = viewX;
RCT2_GLOBAL(RCT2_ADDRESS_SAVED_VIEW_Y, uint16) = viewY;
RCT2_GLOBAL(RCT2_ADDRESS_SAVED_VIEW_ZOOM_AND_ROTATION, uint16) = viewZoom | (viewRotation << 8);
gSavedViewX = viewX;
gSavedViewY = viewY;
gSavedViewZoom = viewZoom;
gSavedViewRotation = viewRotation;
// Prepare S6
rct_s6_data *s6 = malloc(sizeof(rct_s6_data));
@ -1063,9 +1064,10 @@ int scenario_save_network(SDL_RWops* rw)
viewRotation = 0;
}
RCT2_GLOBAL(RCT2_ADDRESS_SAVED_VIEW_X, uint16) = viewX;
RCT2_GLOBAL(RCT2_ADDRESS_SAVED_VIEW_Y, uint16) = viewY;
RCT2_GLOBAL(RCT2_ADDRESS_SAVED_VIEW_ZOOM_AND_ROTATION, uint16) = viewZoom | (viewRotation << 8);
gSavedViewX = viewX;
gSavedViewY = viewY;
gSavedViewZoom = viewZoom;
gSavedViewRotation = viewRotation;
// Prepare S6
rct_s6_data *s6 = malloc(sizeof(rct_s6_data));

View File

@ -191,21 +191,21 @@ static int title_load_park(const char *path)
w = window_get_main();
w->viewport_target_sprite = -1;
w->saved_view_x = RCT2_GLOBAL(RCT2_ADDRESS_SAVED_VIEW_X, sint16);
w->saved_view_y = RCT2_GLOBAL(RCT2_ADDRESS_SAVED_VIEW_Y, sint16);
w->saved_view_x = gSavedViewX;
w->saved_view_y = gSavedViewY;
{
char _cl = (RCT2_GLOBAL(RCT2_ADDRESS_SAVED_VIEW_ZOOM_AND_ROTATION, sint16) & 0xFF) - w->viewport->zoom;
w->viewport->zoom = RCT2_GLOBAL(RCT2_ADDRESS_SAVED_VIEW_ZOOM_AND_ROTATION, sint16) & 0xFF;
*((char*)(&RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_ROTATION, sint32))) = RCT2_GLOBAL(RCT2_ADDRESS_SAVED_VIEW_ZOOM_AND_ROTATION, sint16) >> 8;
if (_cl != 0) {
if (_cl < 0) {
_cl = -_cl;
w->viewport->view_width >>= _cl;
w->viewport->view_height >>= _cl;
char zoomDifference = gSavedViewZoom - w->viewport->zoom;
w->viewport->zoom = gSavedViewZoom;
gCurrentRotation = gSavedViewRotation;
if (zoomDifference != 0) {
if (zoomDifference < 0) {
zoomDifference = -zoomDifference;
w->viewport->view_width >>= zoomDifference;
w->viewport->view_height >>= zoomDifference;
} else {
w->viewport->view_width <<= _cl;
w->viewport->view_height <<= _cl;
w->viewport->view_width <<= zoomDifference;
w->viewport->view_height <<= zoomDifference;
}
}
w->saved_view_x -= w->viewport->view_width >> 1;

View File

@ -80,7 +80,7 @@ void window_editor_main_open()
viewport_create(window, window->x, window->y, window->width, window->height, 0, 0x0FFF, 0x0FFF, 0, 0x1, -1);
window->viewport->flags |= 0x0400;
RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_ROTATION, sint32) = 0;
gCurrentRotation = 0;
RCT2_GLOBAL(0x009E32B0, uint8) = 0;
RCT2_GLOBAL(0x009E32B2, uint8) = 0;
RCT2_GLOBAL(0x009E32B3, uint8) = 0;

View File

@ -83,7 +83,7 @@ void window_main_open()
viewport_create(window, window->x, window->y, window->width, window->height, 0,0x0FFF,0x0FFF, 0, 0x1, -1);
window->viewport->flags |= VIEWPORT_FLAG_SOUND_ON;
RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_ROTATION, sint32) = 0;
gCurrentRotation = 0;
RCT2_GLOBAL(0x009E32B0, uint8) = 0;
RCT2_GLOBAL(0x009E32B2, uint8) = 0;
RCT2_GLOBAL(0x009E32B3, uint8) = 0;

View File

@ -2277,8 +2277,8 @@ static void sub_6CBCE2(
int preserve_current_viewport_flags;
int x, y, baseZ, clearanceZ, offsetX, offsetY;
preserve_current_viewport_flags = RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_VIEWPORT_FLAGS, uint16);
RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_VIEWPORT_FLAGS, uint16) = 0;
preserve_current_viewport_flags = gCurrentViewportFlags;
gCurrentViewportFlags = 0;
trackDirection &= 3;
RCT2_GLOBAL(0x00EE7880, uint32) = 0x00F1A4CC;
@ -2387,7 +2387,7 @@ static void sub_6CBCE2(
sub_688217();
sub_688485();
RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_VIEWPORT_FLAGS, uint16) = preserve_current_viewport_flags;
gCurrentViewportFlags = preserve_current_viewport_flags;
}
/**