1
0
mirror of https://github.com/OpenRCT2/OpenRCT2 synced 2026-01-23 23:04:36 +01:00

Split special direction to new parameter.

This commit is contained in:
ZehMatt
2018-01-11 18:02:39 +01:00
committed by Aaron van Geffen
parent 49d8d37748
commit e3708c0593
8 changed files with 28 additions and 28 deletions

View File

@@ -509,7 +509,7 @@ static void window_maze_construction_construct(sint32 direction)
break;
}
money32 cost = maze_set_track(x, y, z, flags, direction, _currentRideIndex, mode);
money32 cost = maze_set_track(x, y, z, flags, false, direction, _currentRideIndex, mode);
if (cost == MONEY32_UNDEFINED) {
return;
}

View File

@@ -3560,7 +3560,8 @@ void ride_construction_tooldown_construct(sint32 screenX, sint32 screenY)
_currentTrackBeginY,
_currentTrackBeginZ,
GAME_COMMAND_FLAG_APPLY,
4,
true,
0,
_currentRideIndex,
GC_SET_MAZE_TRACK_BUILD);

View File

@@ -253,9 +253,9 @@
#pragma endregion
#pragma region MazeSetTrack
money32 maze_set_track(uint16 x, uint16 y, uint16 z, uint8 flags, uint8 direction, uint8 rideIndex, uint8 mode)
money32 maze_set_track(uint16 x, uint16 y, uint16 z, uint8 flags, bool initialPlacement, uint8 direction, uint8 rideIndex, uint8 mode)
{
auto gameAction = MazeSetTrackAction(x, y, z, direction, rideIndex, mode);
auto gameAction = MazeSetTrackAction(x, y, z, initialPlacement, direction, rideIndex, mode);
gameAction.SetFlags(flags);
GameActionResult::Ptr res;

View File

@@ -56,16 +56,18 @@ private:
uint16 _x;
uint16 _y;
uint16 _z;
bool _initialPlacement;
uint8 _direction;
uint8 _rideIndex;
uint8 _mode;
public:
MazeSetTrackAction() {}
MazeSetTrackAction(uint16 x, uint16 y, uint16 z, uint8 direction, uint8 rideIndex, uint8 mode)
MazeSetTrackAction(uint16 x, uint16 y, uint16 z, bool initialPlacement, uint8 direction, uint8 rideIndex, uint8 mode)
: _x(x),
_y(y),
_z(z),
_initialPlacement(initialPlacement),
_direction(direction),
_rideIndex(rideIndex),
_mode(mode)
@@ -81,7 +83,7 @@ public:
{
GameAction::Serialise(stream);
stream << _x << _y << _z << _direction << _rideIndex << _mode;
stream << _x << _y << _z << _initialPlacement << _direction << _rideIndex << _mode;
}
GameActionResult::Ptr Query() const override
@@ -247,13 +249,10 @@ public:
ride->station_heights[0] = tileElement->base_height;
ride->station_starts[0].xy = 0;
if (_direction == 4)
if (_initialPlacement && !(flags & GAME_COMMAND_FLAG_GHOST))
{
if (!(flags & GAME_COMMAND_FLAG_GHOST))
{
ride->overall_view.x = flooredX / 32;
ride->overall_view.y = flooredY / 32;
}
ride->overall_view.x = flooredX / 32;
ride->overall_view.y = flooredY / 32;
}
}
@@ -265,7 +264,7 @@ public:
tileElement->properties.track.maze_entry &= ~(1 << segmentOffset);
if (_direction != 4)
if (!_initialPlacement)
{
segmentOffset = byte_993CE9[(_direction + segmentOffset)];
tileElement->properties.track.maze_entry &= ~(1 << segmentOffset);
@@ -301,7 +300,7 @@ public:
break;
case GC_SET_MAZE_TRACK_FILL:
if (_direction != 4)
if (!_initialPlacement)
{
uint16 previousSegmentX = _x - TileDirectionDelta[_direction].x / 2;
uint16 previousSegmentY = _y - TileDirectionDelta[_direction].y / 2;

View File

@@ -114,7 +114,7 @@ public:
{
peep->current_ride = MAX_RIDES;
if (peep->time_to_stand >= 50)
{
{
// make peep stop watching the ride
peep->time_to_stand = 50;
}
@@ -223,7 +223,7 @@ private:
money32 MazeRemoveTrack(uint16 x, uint16 y, uint16 z, uint8 direction) const
{
auto setMazeTrack = MazeSetTrackAction(x, y, z, direction, _rideIndex, GC_SET_MAZE_TRACK_FILL);
auto setMazeTrack = MazeSetTrackAction(x, y, z, false, direction, _rideIndex, GC_SET_MAZE_TRACK_FILL);
setMazeTrack.SetFlags(GetFlags());
auto queryRes = setMazeTrack.Query();
@@ -236,7 +236,7 @@ private:
}
}
return MONEY16_UNDEFINED;
return MONEY32_UNDEFINED;
}
money32 DemolishTracks() const
@@ -249,7 +249,7 @@ private:
tile_element_iterator it;
tile_element_iterator_begin(&it);
while (tile_element_iterator_next(&it))
while (tile_element_iterator_next(&it))
{
if (tile_element_get_type(it.element) != TILE_ELEMENT_TYPE_TRACK)
continue;
@@ -263,7 +263,7 @@ private:
uint8 rotation = tile_element_get_direction(it.element);
uint8 type = track_element_get_type(it.element);
if (type != TRACK_ELEM_INVERTED_90_DEG_UP_TO_FLAT_QUARTER_LOOP)
if (type != TRACK_ELEM_INVERTED_90_DEG_UP_TO_FLAT_QUARTER_LOOP)
{
money32 removePrice = game_do_command(
x,
@@ -274,9 +274,9 @@ private:
z,
0);
if (removePrice == MONEY32_UNDEFINED)
if (removePrice == MONEY32_UNDEFINED)
tile_element_remove(it.element);
else
else
refundPrice += removePrice;
tile_element_iterator_restart_for_tile(&it);

View File

@@ -1382,10 +1382,10 @@ void ride_remove_provisional_track_piece()
if (ride->type == RIDE_TYPE_MAZE)
{
sint32 flags = GAME_COMMAND_FLAG_APPLY | GAME_COMMAND_FLAG_ALLOW_DURING_PAUSED | GAME_COMMAND_FLAG_5 | GAME_COMMAND_FLAG_GHOST;
maze_set_track(x, y, z, flags, 0, rideIndex, GC_SET_MAZE_TRACK_FILL);
maze_set_track(x, y + 16, z, flags, 1, rideIndex, GC_SET_MAZE_TRACK_FILL);
maze_set_track(x + 16, y + 16, z, flags, 2, rideIndex, GC_SET_MAZE_TRACK_FILL);
maze_set_track(x + 16, y, z, flags, 3, rideIndex, GC_SET_MAZE_TRACK_FILL);
maze_set_track(x, y, z, flags, false, 0, rideIndex, GC_SET_MAZE_TRACK_FILL);
maze_set_track(x, y + 16, z, flags, false, 1, rideIndex, GC_SET_MAZE_TRACK_FILL);
maze_set_track(x + 16, y + 16, z, flags, false, 2, rideIndex, GC_SET_MAZE_TRACK_FILL);
maze_set_track(x + 16, y, z, flags, false, 3, rideIndex, GC_SET_MAZE_TRACK_FILL);
}
else
{

View File

@@ -557,7 +557,7 @@ void game_command_place_track(sint32 * eax, sint32 * ebx, sint32 * ecx, sint32 *
void game_command_remove_track(sint32 * eax, sint32 * ebx, sint32 * ecx, sint32 * edx, sint32 * esi, sint32 * edi, sint32 * ebp);
void game_command_set_maze_track(sint32 * eax, sint32 * ebx, sint32 * ecx, sint32 * edx, sint32 * esi, sint32 * edi, sint32 * ebp);
money32 maze_set_track(uint16 x, uint16 y, uint16 z, uint8 flags, uint8 direction, uint8 rideIndex, uint8 mode);
money32 maze_set_track(uint16 x, uint16 y, uint16 z, uint8 flags, bool initialPlacement, uint8 direction, uint8 rideIndex, uint8 mode);
void game_command_set_brakes_speed(sint32 * eax, sint32 * ebx, sint32 * ecx, sint32 * edx, sint32 * esi, sint32 * edi, sint32 * ebp);
bool track_element_is_booster(uint8 rideType, uint8 trackType);

View File

@@ -139,7 +139,7 @@ money32 place_provisional_track_piece(sint32 rideIndex, sint32 trackType, sint32
if (ride->type == RIDE_TYPE_MAZE)
{
sint32 flags = GAME_COMMAND_FLAG_APPLY | GAME_COMMAND_FLAG_ALLOW_DURING_PAUSED | GAME_COMMAND_FLAG_5 | GAME_COMMAND_FLAG_GHOST; // 105
result = maze_set_track(x, y, z, flags, 4, rideIndex, GC_SET_MAZE_TRACK_BUILD);
result = maze_set_track(x, y, z, flags, true, 0, rideIndex, GC_SET_MAZE_TRACK_BUILD);
if (result == MONEY32_UNDEFINED)
return result;
@@ -163,7 +163,7 @@ money32 place_provisional_track_piece(sint32 rideIndex, sint32 trackType, sint32
return result;
}
else
else
{
result = game_do_command(x, 105 | (trackDirection << 8), y, rideIndex | (trackType << 8) | (liftHillAndAlternativeState << 16), GAME_COMMAND_PLACE_TRACK, z, 0);
if (result == MONEY32_UNDEFINED)