Merge pull request #3313 from IntelOrca/integrate-ride-session-vars

Integrate ride construction session variables
This commit is contained in:
Ted John 2016-04-16 14:10:05 +01:00
commit e5666f214b
9 changed files with 120 additions and 87 deletions

View File

@ -137,6 +137,37 @@ int gRideRemoveTrackPieceCallbackZ;
int gRideRemoveTrackPieceCallbackDirection;
int gRideRemoveTrackPieceCallbackType;
money32 _currentTrackPrice;
uint16 _numCurrentPossibleRideConfigurations;
uint16 _numCurrentPossibleSpecialTrackPieces;
uint16 _currentTrackCurve;
uint16 _currentTrackEndX;
uint16 _currentTrackEndY;
uint8 _rideConstructionState;
uint8 _currentRideIndex;
uint16 _currentTrackBeginX;
uint16 _currentTrackBeginY;
uint16 _currentTrackBeginZ;
uint8 _currentTrackPieceDirection;
uint8 _currentTrackPieceType;
uint8 _currentTrackSelectionFlags;
sint8 _rideConstructionArrowPulseTime;
uint8 _currentTrackSlopeEnd;
uint8 _currentTrackBankEnd;
uint8 _currentTrackLiftHill;
uint8 _currentTrackCovered;
uint8 _previousTrackBankEnd;
uint8 _previousTrackSlopeEnd;
uint16 _previousTrackPieceX;
uint16 _previousTrackPieceY;
uint16 _previousTrackPieceZ;
uint8 _currentSeatRotationAngle;
// Static function declarations
rct_peep *find_closest_mechanic(int x, int y, int forInspection);
static void ride_breakdown_status_update(int rideIndex);
@ -1810,7 +1841,7 @@ int sub_6CC3FB(int rideIndex)
_currentTrackCurve = RCT2_ADDRESS(0x0097CC68, uint8)[ride->type * 2] | 0x100;
_currentTrackSlopeEnd = 0;
RCT2_GLOBAL(0x00F440B3, uint8) = 0;
_currentTrackBankEnd = 0;
_currentTrackLiftHill = 0;
_currentTrackCovered = 0;

View File

@ -886,42 +886,36 @@ rct_ride_measurement *get_ride_measurement(int index);
extern const uint8 gRideClassifications[255];
extern money32 _currentTrackPrice;
// Macros for very commonly used varaibles, eventually will be changed to locals or globals
#define _enabledRidePieces RCT2_GLOBAL(0x00F44048, uint64)
#define _enabledRidePiecesA RCT2_GLOBAL(0x00F44048, uint32)
#define _enabledRidePiecesB RCT2_GLOBAL(0x00F4404C, uint32)
extern uint16 _numCurrentPossibleRideConfigurations;
extern uint16 _numCurrentPossibleSpecialTrackPieces;
#define _currentTrackPrice RCT2_GLOBAL(0x00F44070, money32)
extern uint16 _currentTrackCurve;
extern uint16 _currentTrackEndX;
extern uint16 _currentTrackEndY;
extern uint8 _rideConstructionState;
extern uint8 _currentRideIndex;
extern uint16 _currentTrackBeginX;
extern uint16 _currentTrackBeginY;
extern uint16 _currentTrackBeginZ;
extern uint8 _currentTrackPieceDirection;
extern uint8 _currentTrackPieceType;
extern uint8 _currentTrackSelectionFlags;
extern sint8 _rideConstructionArrowPulseTime;
extern uint8 _currentTrackSlopeEnd;
extern uint8 _currentTrackBankEnd;
extern uint8 _currentTrackLiftHill;
extern uint8 _currentTrackCovered;
#define _numCurrentPossibleRideConfigurations RCT2_GLOBAL(0x00F44078, uint16)
#define _numCurrentPossibleSpecialTrackPieces RCT2_GLOBAL(0x00F4407A, uint16)
extern uint8 _previousTrackBankEnd;
extern uint8 _previousTrackSlopeEnd;
#define _currentTrackCurve RCT2_GLOBAL(0x00F440A0, uint16)
#define _currentTrackEndX RCT2_GLOBAL(0x00F440A2, uint16)
#define _currentTrackEndY RCT2_GLOBAL(0x00F440A4, uint16)
#define _rideConstructionState RCT2_GLOBAL(0x00F440A6, uint8)
#define _currentRideIndex RCT2_GLOBAL(0x00F440A7, uint8)
#define _currentTrackBeginX RCT2_GLOBAL(0x00F440A8, uint16)
#define _currentTrackBeginY RCT2_GLOBAL(0x00F440AA, uint16)
#define _currentTrackBeginZ RCT2_GLOBAL(0x00F440AC, uint16)
#define _currentTrackPieceDirection RCT2_GLOBAL(RCT2_ADDRESS_TRACK_PREVIEW_ROTATION, uint8)
#define _currentTrackPieceType RCT2_GLOBAL(0x00F440AF, uint8)
#define _currentTrackSelectionFlags RCT2_GLOBAL(0x00F440B0, uint8)
#define _rideConstructionArrowPulseTime RCT2_GLOBAL(0x00F440B1, sint8)
#define _currentTrackSlopeEnd RCT2_GLOBAL(0x00F440B2, uint8)
#define _currentTrackBankEnd RCT2_GLOBAL(0x00F440B3, uint8)
#define _currentTrackLiftHill RCT2_GLOBAL(0x00F440B4, uint8)
#define _currentTrackCovered RCT2_GLOBAL(0x00F440B5, uint8)
extern uint16 _previousTrackPieceX;
extern uint16 _previousTrackPieceY;
extern uint16 _previousTrackPieceZ;
#define _previousTrackBankEnd RCT2_GLOBAL(0x00F440B6, uint8)
#define _previousTrackSlopeEnd RCT2_GLOBAL(0x00F440B7, uint8)
#define _previousTrackPieceX RCT2_GLOBAL(0x00F440B9, uint16)
#define _previousTrackPieceY RCT2_GLOBAL(0x00F440BB, uint16)
#define _previousTrackPieceZ RCT2_GLOBAL(0x00F440BD, uint16)
#define _currentSeatRotationAngle RCT2_GLOBAL(0x00F440CF, uint8)
extern uint8 _currentSeatRotationAngle;
extern bool gGotoStartPlacementMode;
extern int gRideRemoveTrackPieceCallbackX;

View File

@ -1033,7 +1033,7 @@ int track_place_scenery(rct_track_scenery* scenery_start, uint8 rideIndex, int o
for (rct_track_scenery* scenery = scenery_start; (scenery->scenery_object.flags & 0xFF) != 0xFF; scenery++){
uint8 rotation = RCT2_GLOBAL(RCT2_ADDRESS_TRACK_PREVIEW_ROTATION, uint8);
uint8 rotation = _currentTrackPieceDirection;
rct_xy8 tile = { .x = originX / 32, .y = originY / 32 };
switch (rotation & 3){
@ -1113,7 +1113,7 @@ int track_place_scenery(rct_track_scenery* scenery_start, uint8 rideIndex, int o
rotation &= 3;
//bh
uint8 quadrant = (scenery->flags >> 2) + RCT2_GLOBAL(RCT2_ADDRESS_TRACK_PREVIEW_ROTATION, uint8);
uint8 quadrant = (scenery->flags >> 2) + _currentTrackPieceDirection;
quadrant &= 3;
uint8 bh = rotation | (quadrant << 6) | MAP_ELEMENT_TYPE_SCENERY;
@ -1223,7 +1223,7 @@ int track_place_scenery(rct_track_scenery* scenery_start, uint8 rideIndex, int o
rotation += scenery->flags;
rotation &= 3;
z = scenery->z * 8 + originZ;
uint8 quadrant = ((scenery->flags >> 2) + RCT2_GLOBAL(RCT2_ADDRESS_TRACK_PREVIEW_ROTATION, uint8)) & 3;
uint8 quadrant = ((scenery->flags >> 2) + _currentTrackPieceDirection) & 3;
bl = 0x81;
if (RCT2_GLOBAL(0x00F440D4, uint8) == 5)bl = 0xA9;
@ -1386,14 +1386,14 @@ int track_place_maze(sint16 x, sint16 y, sint16 z, uint8 rideIndex, uint8** trac
RCT2_GLOBAL(RCT2_ADDRESS_MAP_ARROW_Y, sint16) = y;
RCT2_GLOBAL(RCT2_ADDRESS_MAP_ARROW_Z, sint16) = map_element_height(x, y) & 0xFFFF;
RCT2_GLOBAL(RCT2_ADDRESS_MAP_ARROW_DIRECTION, uint8) = RCT2_GLOBAL(RCT2_ADDRESS_TRACK_PREVIEW_ROTATION, uint8);
RCT2_GLOBAL(RCT2_ADDRESS_MAP_ARROW_DIRECTION, uint8) = _currentTrackPieceDirection;
}
RCT2_GLOBAL(0x00F440D5, uint32) = 0;
rct_maze_element* maze = (rct_maze_element*)(*track_elements);
for (; maze->all != 0; maze++){
uint8 rotation = RCT2_GLOBAL(RCT2_ADDRESS_TRACK_PREVIEW_ROTATION, uint8);
uint8 rotation = _currentTrackPieceDirection;
rct_xy16 mapCoord = { .x = maze->x * 32, .y = maze->y * 32 };
switch (rotation & 3){
@ -1571,11 +1571,11 @@ int track_place_ride(sint16 x, sint16 y, sint16 z, uint8 rideIndex, uint8** trac
RCT2_GLOBAL(RCT2_ADDRESS_MAP_ARROW_Y, sint16) = y;
RCT2_GLOBAL(RCT2_ADDRESS_MAP_ARROW_Z, sint16) = map_element_height(x, y) & 0xFFFF;
RCT2_GLOBAL(RCT2_ADDRESS_MAP_ARROW_DIRECTION, uint8) = RCT2_GLOBAL(RCT2_ADDRESS_TRACK_PREVIEW_ROTATION, uint8);
RCT2_GLOBAL(RCT2_ADDRESS_MAP_ARROW_DIRECTION, uint8) = _currentTrackPieceDirection;
}
RCT2_GLOBAL(0x00F440D5, uint32) = 0;
uint8 rotation = RCT2_GLOBAL(RCT2_ADDRESS_TRACK_PREVIEW_ROTATION, uint8);
uint8 rotation = _currentTrackPieceDirection;
rct_track_element* track = (rct_track_element*)(*track_elements);
for (; track->type != 0xFF; track++){
@ -1664,7 +1664,7 @@ int track_place_ride(sint16 x, sint16 y, sint16 z, uint8 rideIndex, uint8** trac
(((track->flags >> 4) & 0x3) << 24) |
(temp_z & 0xFFFF);
int edx = RCT2_GLOBAL(0x00F440A7, uint8) | (track_type << 8);
int edx = _currentRideIndex | (track_type << 8);
if (track->flags & 0x80)edx |= 0x10000;
if (track->flags & 0x40)edx |= 0x20000;
@ -1791,7 +1791,7 @@ int track_place_ride(sint16 x, sint16 y, sint16 z, uint8 rideIndex, uint8** trac
*track_elements = (uint8*)track + 1;
rct_track_entrance* entrance = (rct_track_entrance*)(*track_elements);
for (; entrance->z != -1; entrance++){
rotation = RCT2_GLOBAL(RCT2_ADDRESS_TRACK_PREVIEW_ROTATION, uint8);
rotation = _currentTrackPieceDirection;
x = entrance->x;
y = entrance->y;
@ -1913,8 +1913,8 @@ int track_place_ride(sint16 x, sint16 y, sint16 z, uint8 rideIndex, uint8** trac
}
if (RCT2_GLOBAL(0x00F440D4, uint8) == 6){
sub_6CB945(RCT2_GLOBAL(0x00F440A7, uint8));
rct_ride* ride = get_ride(RCT2_GLOBAL(0x00F440A7, uint8));
sub_6CB945(_currentRideIndex);
rct_ride* ride = get_ride(_currentRideIndex);
user_string_free(ride->name);
ride->type = RIDE_TYPE_NULL;
}
@ -1944,7 +1944,7 @@ int sub_6D01B3(uint8 bl, uint8 rideIndex, int x, int y, int z)
if (RCT2_GLOBAL(RCT2_ADDRESS_TRACK_DESIGN_SCENERY_TOGGLE, uint8) != 0){
RCT2_GLOBAL(0x00F4414E, uint8) |= 0x80;
}
RCT2_GLOBAL(0x00F440A7, uint8) = rideIndex;
_currentRideIndex = rideIndex;
RCT2_GLOBAL(RCT2_ADDRESS_TRACK_PREVIEW_X_MIN, sint16) = x;
RCT2_GLOBAL(RCT2_ADDRESS_TRACK_PREVIEW_X_MAX, sint16) = x;
@ -2044,12 +2044,12 @@ int sub_6D2189(int* cost, uint8* ride_id){
}
RCT2_GLOBAL(0x009D8150, uint8) |= 1;
uint8 backup_rotation = RCT2_GLOBAL(RCT2_ADDRESS_TRACK_PREVIEW_ROTATION, uint8);
uint8 backup_rotation = _currentTrackPieceDirection;
uint32 backup_park_flags = RCT2_GLOBAL(RCT2_ADDRESS_PARK_FLAGS, uint32);
RCT2_GLOBAL(RCT2_ADDRESS_PARK_FLAGS, uint32) &= ~PARK_FLAGS_FORBID_HIGH_CONSTRUCTION;
int map_size = RCT2_GLOBAL(RCT2_ADDRESS_MAP_SIZE, uint16) << 4;
RCT2_GLOBAL(RCT2_ADDRESS_TRACK_PREVIEW_ROTATION, uint8) = 0;
_currentTrackPieceDirection = 0;
int z = sub_6D01B3(3, 0, map_size, map_size, 16);
if (RCT2_GLOBAL(0xF4414E, uint8) & 4){
@ -2072,14 +2072,14 @@ int sub_6D2189(int* cost, uint8* ride_id){
RCT2_GLOBAL(0xF44151, uint8) |= 4;
}
RCT2_GLOBAL(RCT2_ADDRESS_TRACK_PREVIEW_ROTATION, uint8) = backup_rotation;
_currentTrackPieceDirection = backup_rotation;
RCT2_GLOBAL(0x009D8150, uint8) &= ~1;
*cost = edi;
return 1;
}
else{
RCT2_GLOBAL(RCT2_ADDRESS_TRACK_PREVIEW_ROTATION, uint8) = backup_rotation;
_currentTrackPieceDirection = backup_rotation;
user_string_free(ride->name);
ride->type = RIDE_TYPE_NULL;
RCT2_GLOBAL(0x009D8150, uint8) &= ~1;
@ -2284,7 +2284,7 @@ rct_track_design *track_get_info(int index, uint8** preview)
// Set preview to correct preview image based on rotation
if (preview != NULL)
*preview = trackDesign->preview[RCT2_GLOBAL(RCT2_ADDRESS_TRACK_PREVIEW_ROTATION, uint8)];
*preview = trackDesign->preview[_currentTrackPieceDirection];
return trackDesign;
}
@ -3176,7 +3176,7 @@ rct_track_design *temp_track_get_info(char* path, uint8** preview)
// Set preview to correct preview image based on rotation
if (preview != NULL)
*preview = trackDesign->preview[RCT2_GLOBAL(RCT2_ADDRESS_TRACK_PREVIEW_ROTATION, uint8)];
*preview = trackDesign->preview[_currentTrackPieceDirection];
return trackDesign;
}

View File

@ -120,7 +120,7 @@ void window_install_track_open(const char* path)
RCT2_GLOBAL(RCT2_ADDRESS_TRACK_DESIGN_CACHE, void*) = mem;
RCT2_GLOBAL(RCT2_ADDRESS_TRACK_DESIGN_SCENERY_TOGGLE, uint8) = 0;
RCT2_GLOBAL(RCT2_ADDRESS_TRACK_PREVIEW_ROTATION, uint8) = 2;
_currentTrackPieceDirection = 2;
reset_track_list_cache();
x = RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_WIDTH, uint16) / 2 - 201;
@ -227,8 +227,8 @@ static void window_install_track_mouseup(rct_window *w, int widgetIndex)
window_close(w);
break;
case WIDX_ROTATE:
RCT2_GLOBAL(RCT2_ADDRESS_TRACK_PREVIEW_ROTATION, uint8)++;
RCT2_GLOBAL(RCT2_ADDRESS_TRACK_PREVIEW_ROTATION, uint8) %= 4;
_currentTrackPieceDirection++;
_currentTrackPieceDirection %= 4;
window_invalidate(w);
break;
case WIDX_TOGGLE_SCENERY:

View File

@ -447,13 +447,21 @@ rct_string_id RideConfigurationStringIds[] = {
#pragma endregion
#define _trackPlaceCtrlState RCT2_GLOBAL(0x00F44159, uint8)
union {
uint64 ab;
struct {
uint32 a;
uint32 b;
};
} _enabledRidePieces;
static bool _trackPlaceCtrlState;
static int _trackPlaceCtrlZ;
#define _trackPlaceShiftState RCT2_GLOBAL(0x00F4415C, uint8)
static bool _trackPlaceShiftState;
static int _trackPlaceShiftStartScreenX;
static int _trackPlaceShiftStartScreenY;
static int _trackPlaceShiftZ;
#define _trackPlaceZ RCT2_GLOBAL(0x00F44163, sint16)
static int _trackPlaceZ;
static bool _autoOpeningShop;
// This variable is updated separately from ride->num_stations because the latter
@ -493,7 +501,7 @@ uint8 *_currentPossibleRideConfigurations = (uint8*)0x00F4407C;
static bool is_track_enabled(int trackFlagIndex)
{
return _enabledRidePieces & (1ULL << trackFlagIndex);
return _enabledRidePieces.ab & (1ULL << trackFlagIndex);
}
static int ride_get_alternative_type(rct_ride *ride)
@ -540,7 +548,7 @@ rct_window *window_ride_construction_open()
_currentTrackPrice = MONEY32_UNDEFINED;
RCT2_GLOBAL(0x00F440CD, uint8) = 8;
RCT2_GLOBAL(0x00F440CE, uint8) = 18;
RCT2_GLOBAL(0x00F440CF, uint8) = 4;
_currentSeatRotationAngle = 4;
if (ride->type == RIDE_TYPE_REVERSE_FREEFALL_COASTER)
RCT2_GLOBAL(0x00F440CE, uint8) = 30;
@ -550,23 +558,23 @@ rct_window *window_ride_construction_open()
_currentTrackCurve = RCT2_ADDRESS(0x0097CC68, uint8)[ride->type * 2] | 0x100;
_currentTrackSlopeEnd = 0;
RCT2_GLOBAL(0x00F440B3, uint8) = 0;
_currentTrackBankEnd = 0;
_currentTrackLiftHill = 0;
_currentTrackCovered = 0;
if (RideData4[ride->type].flags & RIDE_TYPE_FLAG4_15)
_currentTrackCovered |= 2;
RCT2_GLOBAL(0x00F440B6, uint8) = 0;
RCT2_GLOBAL(0x00F440B7, uint8) = 0;
_previousTrackBankEnd = 0;
_previousTrackSlopeEnd = 0;
RCT2_GLOBAL(RCT2_ADDRESS_TRACK_PREVIEW_ROTATION, uint8) = 0;
_currentTrackPieceDirection = 0;
_rideConstructionState = RIDE_CONSTRUCTION_STATE_PLACE;
_currentTrackSelectionFlags = 0;
_rideConstructionArrowPulseTime = 0;
_autoOpeningShop = false;
RCT2_GLOBAL(0x00F44159, uint8) = 0;
RCT2_GLOBAL(0x00F4415C, uint8) = 0;
_trackPlaceCtrlState = false;
_trackPlaceShiftState = false;
colour_scheme_update(w);
return w;
}
@ -2115,7 +2123,7 @@ static void window_ride_construction_invalidate(rct_window *w)
RCT2_GLOBAL(RCT2_ADDRESS_COMMON_FORMAT_ARGS + 2, uint16) = ((RCT2_GLOBAL(0x00F440CD, uint8) * 9) >> 2) & 0xFFFF;
window_ride_construction_widgets[WIDX_SEAT_ROTATION_ANGLE_SPINNER].image =
STR_RIDE_CONSTRUCTION_SEAT_ROTATION_ANGLE_NEG_180 + RCT2_GLOBAL(0x00F440CF, uint8);
STR_RIDE_CONSTRUCTION_SEAT_ROTATION_ANGLE_NEG_180 + _currentSeatRotationAngle;
if (RCT2_GLOBAL(0x00F440D3, uint8) == 2)
RCT2_GLOBAL(RCT2_ADDRESS_COMMON_FORMAT_ARGS + 2, uint16) = ((RCT2_GLOBAL(0x00F440CE, uint8) * 9) >> 2) & 0xFFFF;
@ -2430,7 +2438,7 @@ static bool sub_6CA2DF_get_track_element(uint8 *trackElement) {
return false;
}
bool startsDiagonal = RCT2_GLOBAL(RCT2_ADDRESS_TRACK_PREVIEW_ROTATION, uint8) & (1 << 2);
bool startsDiagonal = _currentTrackPieceDirection & (1 << 2);
if (curve == TRACK_CURVE_LEFT_LARGE || curve == TRACK_CURVE_RIGHT_LARGE) {
if (_rideConstructionState == RIDE_CONSTRUCTION_STATE_BACK) {
startsDiagonal = !startsDiagonal;
@ -2525,7 +2533,7 @@ static bool sub_6CA2DF(int *_trackType, int *_trackDirection, int *_rideIndex, i
rct_ride *ride = get_ride(rideIndex);
if (_enabledRidePiecesB & (1 << 8)) {
if (_enabledRidePieces.b & (1 << 8)) {
switch (trackType) {
case TRACK_ELEM_FLAT_TO_60_DEG_UP:
trackType = TRACK_ELEM_FLAT_TO_60_DEG_UP_LONG_BASE;
@ -2565,7 +2573,7 @@ static bool sub_6CA2DF(int *_trackType, int *_trackDirection, int *_rideIndex, i
z = _currentTrackBeginZ;
if (_rideConstructionState == 2) {
z -= trackCoordinates->z_end;
trackDirection = RCT2_GLOBAL(RCT2_ADDRESS_TRACK_PREVIEW_ROTATION, uint8) ^ 0x02;
trackDirection = _currentTrackPieceDirection ^ 0x02;
trackDirection -= trackCoordinates->rotation_end;
trackDirection += trackCoordinates->rotation_begin;
trackDirection &= 0x03;
@ -2597,12 +2605,12 @@ static bool sub_6CA2DF(int *_trackType, int *_trackDirection, int *_rideIndex, i
}
} else {
z -= trackCoordinates->z_begin;
trackDirection = RCT2_GLOBAL(RCT2_ADDRESS_TRACK_PREVIEW_ROTATION, uint8);
trackDirection = _currentTrackPieceDirection;
}
bool do_loc_6CAF26 = false;
if (!(_enabledRidePiecesA & (1 << 5))) {
if (!(_enabledRidePieces.a & (1 << 5))) {
if (RCT2_ADDRESS(0x0099423C, uint16)[trackType] & 0x2000) {
do_loc_6CAF26 = true;
}
@ -2654,8 +2662,8 @@ static void window_ride_construction_update_enabled_track_pieces()
return;
int rideType = _currentTrackCovered & 2 ? RCT2_ADDRESS(0x0097D4F5, uint8)[ride->type * 8] : ride->type;
_enabledRidePiecesA = rideEntry->enabledTrackPiecesA & RCT2_ADDRESS(0x01357444, uint32)[rideType];
_enabledRidePiecesB = rideEntry->enabledTrackPiecesB & RCT2_ADDRESS(0x01357644, uint32)[rideType];
_enabledRidePieces.a = rideEntry->enabledTrackPiecesA & RCT2_ADDRESS(0x01357444, uint32)[rideType];
_enabledRidePieces.b = rideEntry->enabledTrackPiecesB & RCT2_ADDRESS(0x01357644, uint32)[rideType];
}
/**
@ -3817,8 +3825,8 @@ void ride_construction_tooldown_construct(int screenX, int screenY)
if (w != NULL){
tool_set(w, 23, 12);
gInputFlags |= INPUT_FLAG_6;
RCT2_GLOBAL(0x00F44159, uint8) = 0;
RCT2_GLOBAL(0x00F4415C, uint8) = 0;
_trackPlaceCtrlState = false;
_trackPlaceShiftState = false;
}
window_maze_construction_update_pressed_widgets();
break;

View File

@ -144,7 +144,7 @@ void window_track_list_open(ride_list_item item)
w->track_list.var_484 = 0;
RCT2_GLOBAL(RCT2_ADDRESS_TRACK_DESIGN_SCENERY_TOGGLE, uint8) = 0;
window_push_others_right(w);
RCT2_GLOBAL(RCT2_ADDRESS_TRACK_PREVIEW_ROTATION, uint8) = 2;
_currentTrackPieceDirection = 2;
}
/**
@ -253,8 +253,8 @@ static void window_track_list_mouseup(rct_window *w, int widgetIndex)
}
break;
case WIDX_ROTATE:
RCT2_GLOBAL(RCT2_ADDRESS_TRACK_PREVIEW_ROTATION, uint8)++;
RCT2_GLOBAL(RCT2_ADDRESS_TRACK_PREVIEW_ROTATION, uint8) %= 4;
_currentTrackPieceDirection++;
_currentTrackPieceDirection %= 4;
window_invalidate(w);
break;
case WIDX_TOGGLE_SCENERY:

View File

@ -151,7 +151,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) + get_current_rotation();
rotation = _currentTrackPieceDirection + get_current_rotation();
trackElement = RCT2_ADDRESS(0x009D821B, rct_track_element);
while (trackElement->type != 255) {
@ -250,7 +250,7 @@ static void window_track_place_draw_mini_preview()
} else {
#pragma region Maze
rotation = (RCT2_GLOBAL(RCT2_ADDRESS_TRACK_PREVIEW_ROTATION, uint8) + get_current_rotation()) & 3;
rotation = (_currentTrackPieceDirection + get_current_rotation()) & 3;
mazeElement = RCT2_ADDRESS(0x009D821B, rct_maze_element);
while (mazeElement->all != 0) {
x = mazeElement->x * 32;
@ -395,7 +395,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) = (2 - get_current_rotation()) & 3;
_currentTrackPieceDirection = (2 - get_current_rotation()) & 3;
window_track_place_draw_mini_preview();
}
@ -544,7 +544,7 @@ static void window_track_place_tooldown(rct_window* w, int widgetIndex, int x, i
window_close_by_class(WC_ERROR);
audio_play_sound_at_location(SOUND_PLACE_ITEM, mapX, mapY, mapZ);
RCT2_GLOBAL(0x00F440A7, uint8) = rideIndex;
_currentRideIndex = rideIndex;
if (RCT2_GLOBAL(0x00F4414E, uint8) & 1) {
window_ride_main_open(rideIndex);
window_close(w);

View File

@ -353,7 +353,7 @@ static money32 footpath_place_real(int type, int x, int y, int z, int slope, int
}
// Force ride construction to recheck area
RCT2_GLOBAL(0x00F440B0, uint8) |= 8;
_currentTrackSelectionFlags |= 8;
if (RCT2_GLOBAL(0x009A8C28, uint8) == 1 && !(flags & GAME_COMMAND_FLAG_GHOST)) {
rct_xyz16 coord;

View File

@ -1908,7 +1908,7 @@ money32 raise_land(int flags, int x, int y, int z, int ax, int ay, int bx, int b
}
// Force ride construction to recheck area
RCT2_GLOBAL(0x00F440B0, uint8) |= 8;
_currentTrackSelectionFlags |= 8;
RCT2_GLOBAL(RCT2_ADDRESS_NEXT_EXPENDITURE_TYPE, uint8) = RCT_EXPENDITURE_TYPE_LANDSCAPING * 4;
RCT2_GLOBAL(RCT2_ADDRESS_COMMAND_MAP_X, uint16) = x;
@ -1981,7 +1981,7 @@ money32 lower_land(int flags, int x, int y, int z, int ax, int ay, int bx, int b
}
// Force ride construction to recheck area
RCT2_GLOBAL(0x00F440B0, uint8) |= 8;
_currentTrackSelectionFlags |= 8;
RCT2_GLOBAL(RCT2_ADDRESS_NEXT_EXPENDITURE_TYPE, uint8) = RCT_EXPENDITURE_TYPE_LANDSCAPING * 4;
RCT2_GLOBAL(RCT2_ADDRESS_COMMAND_MAP_X, uint16) = x;
@ -2066,7 +2066,7 @@ money32 raise_water(sint16 x0, sint16 y0, sint16 x1, sint16 y1, uint8 flags)
}
// Force ride construction to recheck area
RCT2_GLOBAL(0x00F440B0, uint8) |= 8;
_currentTrackSelectionFlags |= 8;
return cost;
}
@ -2142,7 +2142,7 @@ money32 lower_water(sint16 x0, sint16 y0, sint16 x1, sint16 y1, uint8 flags)
}
// Force ride construction to recheck area
RCT2_GLOBAL(0x00F440B0, uint8) |= 8;
_currentTrackSelectionFlags |= 8;
return cost;
}
@ -3749,7 +3749,7 @@ void game_command_place_large_scenery(int* eax, int* ebx, int* ecx, int* edx, in
}
// Force ride construction to recheck area
RCT2_GLOBAL(0x00F440B0, uint8) |= 8;
_currentTrackSelectionFlags |= 8;
*ebx = (scenery_entry->large_scenery.price * 10) + RCT2_GLOBAL(0x00F4389A, money32);
if(RCT2_GLOBAL(RCT2_ADDRESS_PARK_FLAGS, uint32) & PARK_FLAGS_NO_MONEY){