mirror of https://github.com/OpenRCT2/OpenRCT2.git
add global macros for viewport variables
This commit is contained in:
parent
aa77c06c01
commit
870a8b55e5
|
@ -161,7 +161,7 @@ bool wooden_a_supports_paint_setup(int supportType, int special, int height, uin
|
||||||
*underground = false;
|
*underground = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_VIEWPORT_FLAGS, uint16) & VIEWPORT_FLAG_INVISIBLE_SUPPORTS) {
|
if (gCurrentViewportFlags & VIEWPORT_FLAG_INVISIBLE_SUPPORTS) {
|
||||||
return false;
|
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)
|
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;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
11
src/editor.c
11
src/editor.c
|
@ -536,13 +536,12 @@ static void editor_finalise_main_view()
|
||||||
rct_viewport *viewport = w->viewport;
|
rct_viewport *viewport = w->viewport;
|
||||||
|
|
||||||
w->viewport_target_sprite = -1;
|
w->viewport_target_sprite = -1;
|
||||||
w->saved_view_x = RCT2_GLOBAL(RCT2_ADDRESS_SAVED_VIEW_X, sint16);
|
w->saved_view_x = gSavedViewX;
|
||||||
w->saved_view_y = RCT2_GLOBAL(RCT2_ADDRESS_SAVED_VIEW_Y, sint16);
|
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 = gSavedViewZoom - viewport->zoom;
|
||||||
|
viewport->zoom = gSavedViewZoom;
|
||||||
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;
|
|
||||||
if (zoom_difference != 0) {
|
if (zoom_difference != 0) {
|
||||||
if (zoom_difference >= 0) {
|
if (zoom_difference >= 0) {
|
||||||
viewport->view_width <<= zoom_difference;
|
viewport->view_width <<= zoom_difference;
|
||||||
|
|
24
src/game.c
24
src/game.c
|
@ -974,19 +974,19 @@ void game_load_init()
|
||||||
mainWindow = window_get_main();
|
mainWindow = window_get_main();
|
||||||
|
|
||||||
mainWindow->viewport_target_sprite = -1;
|
mainWindow->viewport_target_sprite = -1;
|
||||||
mainWindow->saved_view_x = RCT2_GLOBAL(RCT2_ADDRESS_SAVED_VIEW_X, sint16);
|
mainWindow->saved_view_x = gSavedViewX;
|
||||||
mainWindow->saved_view_y = RCT2_GLOBAL(RCT2_ADDRESS_SAVED_VIEW_Y, sint16);
|
mainWindow->saved_view_y = gSavedViewY;
|
||||||
uint8 _cl = (RCT2_GLOBAL(RCT2_ADDRESS_SAVED_VIEW_ZOOM_AND_ROTATION, sint16) & 0xFF) - mainWindow->viewport->zoom;
|
uint8 zoomDifference = gSavedViewZoom - mainWindow->viewport->zoom;
|
||||||
mainWindow->viewport->zoom = RCT2_GLOBAL(RCT2_ADDRESS_SAVED_VIEW_ZOOM_AND_ROTATION, sint16) & 0xFF;
|
mainWindow->viewport->zoom = gSavedViewZoom;
|
||||||
*((char*)(&RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_ROTATION, sint32))) = RCT2_GLOBAL(RCT2_ADDRESS_SAVED_VIEW_ZOOM_AND_ROTATION, sint16) >> 8;
|
gCurrentRotation = gSavedViewRotation;
|
||||||
if (_cl != 0) {
|
if (zoomDifference != 0) {
|
||||||
if (_cl < 0) {
|
if (zoomDifference < 0) {
|
||||||
_cl = -_cl;
|
zoomDifference = -zoomDifference;
|
||||||
mainWindow->viewport->view_width >>= _cl;
|
mainWindow->viewport->view_width >>= zoomDifference;
|
||||||
mainWindow->viewport->view_height >>= _cl;
|
mainWindow->viewport->view_height >>= zoomDifference;
|
||||||
} else {
|
} else {
|
||||||
mainWindow->viewport->view_width <<= _cl;
|
mainWindow->viewport->view_width <<= zoomDifference;
|
||||||
mainWindow->viewport->view_height <<= _cl;
|
mainWindow->viewport->view_height <<= zoomDifference;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
mainWindow->saved_view_x -= mainWindow->viewport->view_width >> 1;
|
mainWindow->saved_view_x -= mainWindow->viewport->view_width >> 1;
|
||||||
|
|
|
@ -217,8 +217,7 @@ void screenshot_giant()
|
||||||
viewport.view_x = x - ((viewport.view_width << zoom) / 2);
|
viewport.view_x = x - ((viewport.view_width << zoom) / 2);
|
||||||
viewport.view_y = y - ((viewport.view_height << zoom) / 2);
|
viewport.view_y = y - ((viewport.view_height << zoom) / 2);
|
||||||
viewport.zoom = zoom;
|
viewport.zoom = zoom;
|
||||||
|
gCurrentRotation = rotation;
|
||||||
RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_ROTATION, uint8) = rotation;
|
|
||||||
|
|
||||||
// Ensure sprites appear regardless of rotation
|
// Ensure sprites appear regardless of rotation
|
||||||
reset_all_sprite_quadrant_placements();
|
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_x = x - ((viewport.view_width << customZoom) / 2);
|
||||||
viewport.view_y = y - ((viewport.view_height << customZoom) / 2);
|
viewport.view_y = y - ((viewport.view_height << customZoom) / 2);
|
||||||
viewport.zoom = customZoom;
|
viewport.zoom = customZoom;
|
||||||
|
gCurrentRotation = customRotation;
|
||||||
RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_ROTATION, uint8) = customRotation;
|
|
||||||
} else {
|
} else {
|
||||||
viewport.view_x = RCT2_GLOBAL(RCT2_ADDRESS_SAVED_VIEW_X, sint16) - (viewport.view_width / 2);
|
viewport.view_x = gSavedViewX - (viewport.view_width / 2);
|
||||||
viewport.view_y = RCT2_GLOBAL(RCT2_ADDRESS_SAVED_VIEW_Y, sint16) - (viewport.view_height / 2);
|
viewport.view_y = gSavedViewY - (viewport.view_height / 2);
|
||||||
viewport.zoom = RCT2_GLOBAL(RCT2_ADDRESS_SAVED_VIEW_ZOOM_AND_ROTATION, uint16) & 0xFF;
|
viewport.zoom = gSavedViewZoom;
|
||||||
|
gCurrentRotation = gSavedViewRotation;
|
||||||
RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_ROTATION, uint8) = RCT2_GLOBAL(RCT2_ADDRESS_SAVED_VIEW_ZOOM_AND_ROTATION, uint16) >> 8;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Ensure sprites appear regardless of rotation
|
// Ensure sprites appear regardless of rotation
|
||||||
|
|
|
@ -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;
|
sint16 y = attached_ps->attached_y + ps->y;
|
||||||
|
|
||||||
int image_id = attached_ps->image_id;
|
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 (ps->sprite_type == 3){
|
||||||
if (image_id & 0x40000000){
|
if (image_id & 0x40000000){
|
||||||
image_id &= 0x7FFFF;
|
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 (ps->sprite_type == 5){
|
||||||
if (image_id & 0x40000000){
|
if (image_id & 0x40000000){
|
||||||
image_id &= 0x7FFFF;
|
image_id &= 0x7FFFF;
|
||||||
|
@ -809,7 +809,7 @@ void sub_688485(){
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
int image_id = ps->image_id;
|
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 (ps->sprite_type == 3){
|
||||||
if (!(image_id & 0x40000000)){
|
if (!(image_id & 0x40000000)){
|
||||||
image_id &= 0x7FFFF;
|
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 (ps->sprite_type == 9){
|
||||||
if (!(image_id & 0x40000000)){
|
if (!(image_id & 0x40000000)){
|
||||||
image_id &= 0x7FFFF;
|
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 (ps->sprite_type == 10 || ps->sprite_type == 12 || ps->sprite_type == 9 || ps->sprite_type == 5){
|
||||||
if (!(image_id & 0x40000000)){
|
if (!(image_id & 0x40000000)){
|
||||||
image_id &= 0x7FFFF;
|
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(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*);
|
dpi = RCT2_GLOBAL(0x140E9A8, rct_drawpixelinfo*);
|
||||||
if (dpi->zoom_level > 2) return;
|
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;
|
trackSequence = mapElement->properties.track.sequence & 0x0F;
|
||||||
trackColourScheme = mapElement->properties.track.colour & 3;
|
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;
|
RCT2_GLOBAL(RCT2_ADDRESS_PAINT_SETUP_CURRENT_TYPE, uint8) = 0;
|
||||||
if (RCT2_ADDRESS(0x00999694, uint32)[trackType] & (1 << trackSequence)) {
|
if (RCT2_ADDRESS(0x00999694, uint32)[trackType] & (1 << trackSequence)) {
|
||||||
uint16 ax = RideData5[ride->type].z_offset;
|
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*);
|
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){
|
dpi->zoom_level == 0){
|
||||||
uint32 ebx =
|
uint32 ebx =
|
||||||
(map_element->properties.entrance.type << 4) |
|
(map_element->properties.entrance.type << 4) |
|
||||||
|
@ -2372,7 +2372,7 @@ static void viewport_draw_money_effects()
|
||||||
* ebp: bottom
|
* ebp: bottom
|
||||||
*/
|
*/
|
||||||
void viewport_paint(rct_viewport* viewport, rct_drawpixelinfo* dpi, int left, int top, int right, int 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;
|
RCT2_GLOBAL(RCT2_ADDRESS_VIEWPORT_ZOOM, uint16) = viewport->zoom;
|
||||||
|
|
||||||
uint16 width = right - left;
|
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->bits = bits_pointer;
|
||||||
dpi2->pitch = pitch;
|
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;
|
uint8 colour = 0x0A;
|
||||||
if (RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_VIEWPORT_FLAGS, uint16) & VIEWPORT_FLAG_INVISIBLE_SPRITES){
|
if (gCurrentViewportFlags & VIEWPORT_FLAG_INVISIBLE_SPRITES){
|
||||||
colour = 0;
|
colour = 0;
|
||||||
}
|
}
|
||||||
gfx_clear(dpi2, colour);
|
gfx_clear(dpi2, colour);
|
||||||
|
@ -2455,7 +2455,7 @@ void viewport_paint(rct_viewport* viewport, rct_drawpixelinfo* dpi, int left, in
|
||||||
sub_688485();
|
sub_688485();
|
||||||
|
|
||||||
int weather_colour = RCT2_ADDRESS(0x98195C, uint32)[gClimateCurrentWeatherGloom];
|
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);
|
gfx_fill_rect(dpi2, dpi2->x, dpi2->y, dpi2->width + dpi2->x - 1, dpi2->height + dpi2->y - 1, weather_colour);
|
||||||
}
|
}
|
||||||
viewport_draw_money_effects();
|
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()
|
uint8 get_current_rotation()
|
||||||
{
|
{
|
||||||
uint32 rotation = RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_ROTATION, uint32);
|
uint8 rotation = gCurrentRotation;
|
||||||
uint32 rotation_masked = rotation & 3;
|
uint8 rotation_masked = rotation & 3;
|
||||||
#if DEBUG_LEVEL_1
|
#if DEBUG_LEVEL_1
|
||||||
if (rotation != rotation_masked) {
|
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
|
#endif // DEBUG_LEVEL_1
|
||||||
return (uint8)rotation_masked;
|
return rotation_masked;
|
||||||
}
|
}
|
||||||
|
|
|
@ -90,6 +90,13 @@ typedef struct {
|
||||||
|
|
||||||
#define MAX_VIEWPORT_COUNT MAX_WINDOW_COUNT
|
#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
|
// rct2: 0x014234BC
|
||||||
extern rct_viewport g_viewport_list[MAX_VIEWPORT_COUNT];
|
extern rct_viewport g_viewport_list[MAX_VIEWPORT_COUNT];
|
||||||
|
|
||||||
|
|
|
@ -1428,7 +1428,7 @@ void window_rotate_camera(rct_window *w, int direction)
|
||||||
z = map_element_height(x, y);
|
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;
|
int new_x, new_y;
|
||||||
center_2d_coordinates(x, y, z, &new_x, &new_y, viewport);
|
center_2d_coordinates(x, y, z, &new_x, &new_y, viewport);
|
||||||
|
|
|
@ -1032,10 +1032,10 @@ void S4Importer::ImportScenarioObjective()
|
||||||
|
|
||||||
void S4Importer::ImportSavedView()
|
void S4Importer::ImportSavedView()
|
||||||
{
|
{
|
||||||
RCT2_GLOBAL(RCT2_ADDRESS_SAVED_VIEW_X, uint16) = _s4.view_x;
|
gSavedViewX = _s4.view_x;
|
||||||
RCT2_GLOBAL(RCT2_ADDRESS_SAVED_VIEW_Y, uint16) = _s4.view_y;
|
gSavedViewY = _s4.view_y;
|
||||||
RCT2_GLOBAL(RCT2_ADDRESS_SAVED_VIEW_ZOOM_AND_ROTATION, uint8) = _s4.view_zoom;
|
gSavedViewZoom = _s4.view_zoom;
|
||||||
RCT2_GLOBAL(RCT2_ADDRESS_SAVED_VIEW_ZOOM_AND_ROTATION + 1, uint8) = _s4.view_rotation;
|
gSavedViewRotation = _s4.view_rotation;
|
||||||
}
|
}
|
||||||
|
|
||||||
void S4Importer::ClearExtraTileEntries()
|
void S4Importer::ClearExtraTileEntries()
|
||||||
|
|
|
@ -744,7 +744,7 @@ void reload_map_backup()
|
||||||
gMapSizeUnits = *(uint16*)(backup_info + 4);
|
gMapSizeUnits = *(uint16*)(backup_info + 4);
|
||||||
gMapSizeMinus2 = *(uint16*)(backup_info + 6);
|
gMapSizeMinus2 = *(uint16*)(backup_info + 6);
|
||||||
gMapSize = *(uint16*)(backup_info + 8);
|
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(0xF440ED, uint8*));
|
||||||
free(RCT2_GLOBAL(0xF440F1, 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 x = center_y - center_x - width / 2;
|
||||||
int y = (center_y + center_x) / 2 - center_z - height / 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->width = 370;
|
||||||
view->height = 217;
|
view->height = 217;
|
||||||
|
@ -2179,7 +2179,7 @@ void draw_track_preview(uint8** preview){
|
||||||
|
|
||||||
dpi->bits += TRACK_PREVIEW_IMAGE_SIZE;
|
dpi->bits += TRACK_PREVIEW_IMAGE_SIZE;
|
||||||
|
|
||||||
RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_ROTATION, uint32) = 1;
|
gCurrentRotation = 1;
|
||||||
x = -center_y - center_x - width / 2;
|
x = -center_y - center_x - width / 2;
|
||||||
y = (center_y - center_x) / 2 - center_z - height / 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;
|
dpi->bits += TRACK_PREVIEW_IMAGE_SIZE;
|
||||||
|
|
||||||
RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_ROTATION, uint32) = 2;
|
gCurrentRotation = 2;
|
||||||
x = center_x - center_y - width / 2;
|
x = center_x - center_y - width / 2;
|
||||||
y = (-center_y - center_x) / 2 - center_z - height / 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;
|
dpi->bits += TRACK_PREVIEW_IMAGE_SIZE;
|
||||||
|
|
||||||
RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_ROTATION, uint32) = 3;
|
gCurrentRotation = 3;
|
||||||
x = center_x + center_y - width / 2;
|
x = center_x + center_y - width / 2;
|
||||||
y = (center_x - center_y) / 2 - center_z - height / 2;
|
y = (center_x - center_y) / 2 - center_z - height / 2;
|
||||||
|
|
||||||
|
|
|
@ -243,20 +243,20 @@ void scenario_begin()
|
||||||
mainWindow = window_get_main();
|
mainWindow = window_get_main();
|
||||||
|
|
||||||
mainWindow->viewport_target_sprite = -1;
|
mainWindow->viewport_target_sprite = -1;
|
||||||
mainWindow->saved_view_x = RCT2_GLOBAL(RCT2_ADDRESS_SAVED_VIEW_X, sint16);
|
mainWindow->saved_view_x = gSavedViewX;
|
||||||
mainWindow->saved_view_y = RCT2_GLOBAL(RCT2_ADDRESS_SAVED_VIEW_Y, sint16);
|
mainWindow->saved_view_y = gSavedViewY;
|
||||||
|
|
||||||
uint8 _cl = (RCT2_GLOBAL(RCT2_ADDRESS_SAVED_VIEW_ZOOM_AND_ROTATION, sint16) & 0xFF) - mainWindow->viewport->zoom;
|
uint8 zoomDifference = gSavedViewZoom - mainWindow->viewport->zoom;
|
||||||
mainWindow->viewport->zoom = RCT2_GLOBAL(RCT2_ADDRESS_SAVED_VIEW_ZOOM_AND_ROTATION, sint16) & 0xFF;
|
mainWindow->viewport->zoom = gSavedViewZoom;
|
||||||
*((char*)(&RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_ROTATION, sint32))) = RCT2_GLOBAL(RCT2_ADDRESS_SAVED_VIEW_ZOOM_AND_ROTATION, sint16) >> 8;
|
gCurrentRotation = gSavedViewRotation;
|
||||||
if (_cl != 0) {
|
if (zoomDifference != 0) {
|
||||||
if (_cl < 0) {
|
if (zoomDifference < 0) {
|
||||||
_cl = -_cl;
|
zoomDifference = -zoomDifference;
|
||||||
mainWindow->viewport->view_width >>= _cl;
|
mainWindow->viewport->view_width >>= zoomDifference;
|
||||||
mainWindow->viewport->view_height >>= _cl;
|
mainWindow->viewport->view_height >>= zoomDifference;
|
||||||
} else {
|
} else {
|
||||||
mainWindow->viewport->view_width <<= _cl;
|
mainWindow->viewport->view_width <<= zoomDifference;
|
||||||
mainWindow->viewport->view_height <<= _cl;
|
mainWindow->viewport->view_height <<= zoomDifference;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
mainWindow->saved_view_x -= mainWindow->viewport->view_width >> 1;
|
mainWindow->saved_view_x -= mainWindow->viewport->view_width >> 1;
|
||||||
|
@ -983,15 +983,16 @@ int scenario_save(SDL_RWops* rw, int flags)
|
||||||
viewZoom = viewport->zoom;
|
viewZoom = viewport->zoom;
|
||||||
viewRotation = get_current_rotation();
|
viewRotation = get_current_rotation();
|
||||||
} else {
|
} else {
|
||||||
viewX = RCT2_GLOBAL(RCT2_ADDRESS_SAVED_VIEW_X, uint16);
|
viewX = gSavedViewX;
|
||||||
viewY = RCT2_GLOBAL(RCT2_ADDRESS_SAVED_VIEW_Y, uint16);
|
viewY = gSavedViewY;
|
||||||
viewZoom = RCT2_GLOBAL(RCT2_ADDRESS_SAVED_VIEW_ZOOM_AND_ROTATION, uint16) & 0xFF;
|
viewZoom = gSavedViewZoom;
|
||||||
viewRotation = RCT2_GLOBAL(RCT2_ADDRESS_SAVED_VIEW_ZOOM_AND_ROTATION, uint16) >> 8;
|
viewRotation = gSavedViewRotation;
|
||||||
}
|
}
|
||||||
|
|
||||||
RCT2_GLOBAL(RCT2_ADDRESS_SAVED_VIEW_X, uint16) = viewX;
|
gSavedViewX = viewX;
|
||||||
RCT2_GLOBAL(RCT2_ADDRESS_SAVED_VIEW_Y, uint16) = viewY;
|
gSavedViewY = viewY;
|
||||||
RCT2_GLOBAL(RCT2_ADDRESS_SAVED_VIEW_ZOOM_AND_ROTATION, uint16) = viewZoom | (viewRotation << 8);
|
gSavedViewZoom = viewZoom;
|
||||||
|
gSavedViewRotation = viewRotation;
|
||||||
|
|
||||||
// Prepare S6
|
// Prepare S6
|
||||||
rct_s6_data *s6 = malloc(sizeof(rct_s6_data));
|
rct_s6_data *s6 = malloc(sizeof(rct_s6_data));
|
||||||
|
@ -1063,9 +1064,10 @@ int scenario_save_network(SDL_RWops* rw)
|
||||||
viewRotation = 0;
|
viewRotation = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
RCT2_GLOBAL(RCT2_ADDRESS_SAVED_VIEW_X, uint16) = viewX;
|
gSavedViewX = viewX;
|
||||||
RCT2_GLOBAL(RCT2_ADDRESS_SAVED_VIEW_Y, uint16) = viewY;
|
gSavedViewY = viewY;
|
||||||
RCT2_GLOBAL(RCT2_ADDRESS_SAVED_VIEW_ZOOM_AND_ROTATION, uint16) = viewZoom | (viewRotation << 8);
|
gSavedViewZoom = viewZoom;
|
||||||
|
gSavedViewRotation = viewRotation;
|
||||||
|
|
||||||
// Prepare S6
|
// Prepare S6
|
||||||
rct_s6_data *s6 = malloc(sizeof(rct_s6_data));
|
rct_s6_data *s6 = malloc(sizeof(rct_s6_data));
|
||||||
|
|
24
src/title.c
24
src/title.c
|
@ -191,21 +191,21 @@ static int title_load_park(const char *path)
|
||||||
|
|
||||||
w = window_get_main();
|
w = window_get_main();
|
||||||
w->viewport_target_sprite = -1;
|
w->viewport_target_sprite = -1;
|
||||||
w->saved_view_x = RCT2_GLOBAL(RCT2_ADDRESS_SAVED_VIEW_X, sint16);
|
w->saved_view_x = gSavedViewX;
|
||||||
w->saved_view_y = RCT2_GLOBAL(RCT2_ADDRESS_SAVED_VIEW_Y, sint16);
|
w->saved_view_y = gSavedViewY;
|
||||||
|
|
||||||
{
|
{
|
||||||
char _cl = (RCT2_GLOBAL(RCT2_ADDRESS_SAVED_VIEW_ZOOM_AND_ROTATION, sint16) & 0xFF) - w->viewport->zoom;
|
char zoomDifference = gSavedViewZoom - w->viewport->zoom;
|
||||||
w->viewport->zoom = RCT2_GLOBAL(RCT2_ADDRESS_SAVED_VIEW_ZOOM_AND_ROTATION, sint16) & 0xFF;
|
w->viewport->zoom = gSavedViewZoom;
|
||||||
*((char*)(&RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_ROTATION, sint32))) = RCT2_GLOBAL(RCT2_ADDRESS_SAVED_VIEW_ZOOM_AND_ROTATION, sint16) >> 8;
|
gCurrentRotation = gSavedViewRotation;
|
||||||
if (_cl != 0) {
|
if (zoomDifference != 0) {
|
||||||
if (_cl < 0) {
|
if (zoomDifference < 0) {
|
||||||
_cl = -_cl;
|
zoomDifference = -zoomDifference;
|
||||||
w->viewport->view_width >>= _cl;
|
w->viewport->view_width >>= zoomDifference;
|
||||||
w->viewport->view_height >>= _cl;
|
w->viewport->view_height >>= zoomDifference;
|
||||||
} else {
|
} else {
|
||||||
w->viewport->view_width <<= _cl;
|
w->viewport->view_width <<= zoomDifference;
|
||||||
w->viewport->view_height <<= _cl;
|
w->viewport->view_height <<= zoomDifference;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
w->saved_view_x -= w->viewport->view_width >> 1;
|
w->saved_view_x -= w->viewport->view_width >> 1;
|
||||||
|
|
|
@ -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);
|
viewport_create(window, window->x, window->y, window->width, window->height, 0, 0x0FFF, 0x0FFF, 0, 0x1, -1);
|
||||||
window->viewport->flags |= 0x0400;
|
window->viewport->flags |= 0x0400;
|
||||||
|
|
||||||
RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_ROTATION, sint32) = 0;
|
gCurrentRotation = 0;
|
||||||
RCT2_GLOBAL(0x009E32B0, uint8) = 0;
|
RCT2_GLOBAL(0x009E32B0, uint8) = 0;
|
||||||
RCT2_GLOBAL(0x009E32B2, uint8) = 0;
|
RCT2_GLOBAL(0x009E32B2, uint8) = 0;
|
||||||
RCT2_GLOBAL(0x009E32B3, uint8) = 0;
|
RCT2_GLOBAL(0x009E32B3, uint8) = 0;
|
||||||
|
|
|
@ -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);
|
viewport_create(window, window->x, window->y, window->width, window->height, 0,0x0FFF,0x0FFF, 0, 0x1, -1);
|
||||||
window->viewport->flags |= VIEWPORT_FLAG_SOUND_ON;
|
window->viewport->flags |= VIEWPORT_FLAG_SOUND_ON;
|
||||||
RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_ROTATION, sint32) = 0;
|
gCurrentRotation = 0;
|
||||||
RCT2_GLOBAL(0x009E32B0, uint8) = 0;
|
RCT2_GLOBAL(0x009E32B0, uint8) = 0;
|
||||||
RCT2_GLOBAL(0x009E32B2, uint8) = 0;
|
RCT2_GLOBAL(0x009E32B2, uint8) = 0;
|
||||||
RCT2_GLOBAL(0x009E32B3, uint8) = 0;
|
RCT2_GLOBAL(0x009E32B3, uint8) = 0;
|
||||||
|
|
|
@ -2277,8 +2277,8 @@ static void sub_6CBCE2(
|
||||||
int preserve_current_viewport_flags;
|
int preserve_current_viewport_flags;
|
||||||
int x, y, baseZ, clearanceZ, offsetX, offsetY;
|
int x, y, baseZ, clearanceZ, offsetX, offsetY;
|
||||||
|
|
||||||
preserve_current_viewport_flags = RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_VIEWPORT_FLAGS, uint16);
|
preserve_current_viewport_flags = gCurrentViewportFlags;
|
||||||
RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_VIEWPORT_FLAGS, uint16) = 0;
|
gCurrentViewportFlags = 0;
|
||||||
trackDirection &= 3;
|
trackDirection &= 3;
|
||||||
|
|
||||||
RCT2_GLOBAL(0x00EE7880, uint32) = 0x00F1A4CC;
|
RCT2_GLOBAL(0x00EE7880, uint32) = 0x00F1A4CC;
|
||||||
|
@ -2387,7 +2387,7 @@ static void sub_6CBCE2(
|
||||||
sub_688217();
|
sub_688217();
|
||||||
sub_688485();
|
sub_688485();
|
||||||
|
|
||||||
RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_VIEWPORT_FLAGS, uint16) = preserve_current_viewport_flags;
|
gCurrentViewportFlags = preserve_current_viewport_flags;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Reference in New Issue