mirror of https://github.com/OpenTTD/OpenTTD
Add: [NewGRF] Station/roadstop animation-triggers 'tile loop' (bit 7) and 'path reservation' (bit 8). (#14080)
parent
d3ae6bc9a8
commit
1ea1dbd19e
|
@ -906,8 +906,17 @@ void TriggerStationAnimation(BaseStation *st, TileIndex trigger_tile, StationAni
|
||||||
{
|
{
|
||||||
/* List of coverage areas for each animation trigger */
|
/* List of coverage areas for each animation trigger */
|
||||||
static const TriggerArea tas[] = {
|
static const TriggerArea tas[] = {
|
||||||
TA_TILE, TA_WHOLE, TA_WHOLE, TA_PLATFORM, TA_PLATFORM, TA_PLATFORM, TA_WHOLE
|
TA_TILE, // Built
|
||||||
|
TA_WHOLE, // NewCargo
|
||||||
|
TA_WHOLE, // CargoTaken
|
||||||
|
TA_PLATFORM, // VehicleArrives
|
||||||
|
TA_PLATFORM, // VehicleDeparts
|
||||||
|
TA_PLATFORM, // VehicleLoads
|
||||||
|
TA_WHOLE, // AcceptanceTick
|
||||||
|
TA_TILE, // TileLoop
|
||||||
|
TA_PLATFORM, // PathReservation
|
||||||
};
|
};
|
||||||
|
static_assert(std::size(tas) == static_cast<size_t>(StationAnimationTrigger::End));
|
||||||
|
|
||||||
assert(st != nullptr);
|
assert(st != nullptr);
|
||||||
|
|
||||||
|
|
|
@ -82,6 +82,7 @@ private:
|
||||||
|
|
||||||
auto *st = Station::GetByTile(start);
|
auto *st = Station::GetByTile(start);
|
||||||
TriggerStationRandomisation(st, start, StationRandomTrigger::PathReservation);
|
TriggerStationRandomisation(st, start, StationRandomTrigger::PathReservation);
|
||||||
|
TriggerStationAnimation(st, start, StationAnimationTrigger::PathReservation);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -114,6 +115,7 @@ private:
|
||||||
if (IsRailWaypointTile(tile)) {
|
if (IsRailWaypointTile(tile)) {
|
||||||
auto *st = BaseStation::GetByTile(tile);
|
auto *st = BaseStation::GetByTile(tile);
|
||||||
TriggerStationRandomisation(st, tile, StationRandomTrigger::PathReservation);
|
TriggerStationRandomisation(st, tile, StationRandomTrigger::PathReservation);
|
||||||
|
TriggerStationAnimation(st, tile, StationAnimationTrigger::PathReservation);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -116,6 +116,7 @@ bool TryReserveRailTrack(TileIndex tile, Track t, bool trigger_stations)
|
||||||
if (trigger_stations) {
|
if (trigger_stations) {
|
||||||
auto *st = BaseStation::GetByTile(tile);
|
auto *st = BaseStation::GetByTile(tile);
|
||||||
TriggerStationRandomisation(st, tile, StationRandomTrigger::PathReservation);
|
TriggerStationRandomisation(st, tile, StationRandomTrigger::PathReservation);
|
||||||
|
TriggerStationAnimation(st, tile, StationAnimationTrigger::PathReservation);
|
||||||
}
|
}
|
||||||
MarkTileDirtyByTile(tile); // some GRFs need redraw after reserving track
|
MarkTileDirtyByTile(tile); // some GRFs need redraw after reserving track
|
||||||
return true;
|
return true;
|
||||||
|
|
|
@ -3601,9 +3601,15 @@ static TrackStatus GetTileTrackStatus_Station(TileIndex tile, TransportType mode
|
||||||
|
|
||||||
static void TileLoop_Station(TileIndex tile)
|
static void TileLoop_Station(TileIndex tile)
|
||||||
{
|
{
|
||||||
|
auto *st = BaseStation::GetByTile(tile);
|
||||||
switch (GetStationType(tile)) {
|
switch (GetStationType(tile)) {
|
||||||
case StationType::Airport:
|
case StationType::Airport:
|
||||||
TriggerAirportTileAnimation(Station::GetByTile(tile), tile, AirportAnimationTrigger::TileLoop);
|
TriggerAirportTileAnimation(Station::From(st), tile, AirportAnimationTrigger::TileLoop);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case StationType::Rail:
|
||||||
|
case StationType::RailWaypoint:
|
||||||
|
TriggerStationAnimation(st, tile, StationAnimationTrigger::TileLoop);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case StationType::Dock:
|
case StationType::Dock:
|
||||||
|
@ -3615,6 +3621,11 @@ static void TileLoop_Station(TileIndex tile)
|
||||||
TileLoop_Water(tile);
|
TileLoop_Water(tile);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case StationType::Truck:
|
||||||
|
case StationType::Bus:
|
||||||
|
TriggerRoadStopAnimation(st, tile, StationAnimationTrigger::TileLoop);
|
||||||
|
break;
|
||||||
|
|
||||||
case StationType::RoadWaypoint: {
|
case StationType::RoadWaypoint: {
|
||||||
switch (_settings_game.game_creation.landscape) {
|
switch (_settings_game.game_creation.landscape) {
|
||||||
case LandscapeType::Arctic:
|
case LandscapeType::Arctic:
|
||||||
|
@ -3648,6 +3659,8 @@ static void TileLoop_Station(TileIndex tile)
|
||||||
SetRoadWaypointRoadside(tile, cur_rs == ROADSIDE_BARREN ? new_rs : ROADSIDE_BARREN);
|
SetRoadWaypointRoadside(tile, cur_rs == ROADSIDE_BARREN ? new_rs : ROADSIDE_BARREN);
|
||||||
MarkTileDirtyByTile(tile);
|
MarkTileDirtyByTile(tile);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
TriggerRoadStopAnimation(st, tile, StationAnimationTrigger::TileLoop);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -96,6 +96,9 @@ enum class StationAnimationTrigger : uint8_t {
|
||||||
VehicleDeparts, ///< Trigger platform when train leaves.
|
VehicleDeparts, ///< Trigger platform when train leaves.
|
||||||
VehicleLoads, ///< Trigger platform when train loads/unloads.
|
VehicleLoads, ///< Trigger platform when train loads/unloads.
|
||||||
AcceptanceTick, ///< Trigger station every 250 ticks.
|
AcceptanceTick, ///< Trigger station every 250 ticks.
|
||||||
|
TileLoop, ///< Trigger in the periodic tile loop.
|
||||||
|
PathReservation, ///< Trigger platform when train reserves path.
|
||||||
|
End
|
||||||
};
|
};
|
||||||
using StationAnimationTriggers = EnumBitSet<StationAnimationTrigger, uint16_t>;
|
using StationAnimationTriggers = EnumBitSet<StationAnimationTrigger, uint16_t>;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue