mirror of https://github.com/OpenTTD/OpenTTD
Codechange: Unify naming of NewGRF animation callbacks.
parent
264abfafe6
commit
f399b8eb29
|
@ -1430,7 +1430,7 @@ static void AircraftLandAirplane(Aircraft *v)
|
|||
|
||||
v->UpdateDeltaXY();
|
||||
|
||||
AirportTileAnimationTrigger(st, vt, AAT_STATION_AIRPLANE_LAND);
|
||||
TriggerAirportTileAnimation(st, vt, AAT_STATION_AIRPLANE_LAND);
|
||||
|
||||
if (!PlayVehicleSound(v, VSE_TOUCHDOWN)) {
|
||||
SndPlayVehicleFx(SND_17_SKID_PLANE, v);
|
||||
|
|
|
@ -1168,7 +1168,7 @@ static void TriggerIndustryProduction(Industry *i)
|
|||
}
|
||||
|
||||
TriggerIndustryRandomisation(i, INDUSTRY_TRIGGER_RECEIVED_CARGO);
|
||||
StartStopIndustryTileAnimation(i, IAT_INDUSTRY_RECEIVED_CARGO);
|
||||
TriggerIndustryAnimation(i, IAT_INDUSTRY_RECEIVED_CARGO);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -1813,7 +1813,7 @@ static void LoadUnloadVehicle(Vehicle *front)
|
|||
if (ge->GetData().cargo.TotalCount() == 0) {
|
||||
TriggerStationRandomisation(st, st->xy, SRT_CARGO_TAKEN, v->cargo_type);
|
||||
TriggerStationAnimation(st, st->xy, SAT_CARGO_TAKEN, v->cargo_type);
|
||||
AirportAnimationTrigger(st, AAT_STATION_CARGO_TAKEN, v->cargo_type);
|
||||
TriggerAirportAnimation(st, AAT_STATION_CARGO_TAKEN, v->cargo_type);
|
||||
TriggerRoadStopRandomisation(st, st->xy, RSRT_CARGO_TAKEN, v->cargo_type);
|
||||
TriggerRoadStopAnimation(st, st->xy, SAT_CARGO_TAKEN, v->cargo_type);
|
||||
}
|
||||
|
|
|
@ -763,7 +763,7 @@ static void MakeIndustryTileBigger(TileIndex tile)
|
|||
uint8_t stage = GetIndustryConstructionStage(tile) + 1;
|
||||
SetIndustryConstructionCounter(tile, 0);
|
||||
SetIndustryConstructionStage(tile, stage);
|
||||
StartStopIndustryTileAnimation(tile, IAT_CONSTRUCTION_STAGE_CHANGE);
|
||||
TriggerIndustryTileAnimation(tile, IAT_CONSTRUCTION_STAGE_CHANGE);
|
||||
if (stage == INDUSTRY_COMPLETED) SetIndustryCompleted(tile);
|
||||
|
||||
MarkTileDirtyByTile(tile);
|
||||
|
@ -853,7 +853,7 @@ static void TileLoop_Industry(TileIndex tile)
|
|||
|
||||
if (_game_mode == GM_EDITOR) return;
|
||||
|
||||
if (TransportIndustryGoods(tile) && !StartStopIndustryTileAnimation(Industry::GetByTile(tile), IAT_INDUSTRY_DISTRIBUTES_CARGO)) {
|
||||
if (TransportIndustryGoods(tile) && !TriggerIndustryAnimation(Industry::GetByTile(tile), IAT_INDUSTRY_DISTRIBUTES_CARGO)) {
|
||||
uint newgfx = GetIndustryTileSpec(GetIndustryGfx(tile))->anim_production;
|
||||
|
||||
if (newgfx != INDUSTRYTILE_NOANIM) {
|
||||
|
@ -865,7 +865,7 @@ static void TileLoop_Industry(TileIndex tile)
|
|||
}
|
||||
}
|
||||
|
||||
if (StartStopIndustryTileAnimation(tile, IAT_TILELOOP)) return;
|
||||
if (TriggerIndustryTileAnimation(tile, IAT_TILELOOP)) return;
|
||||
|
||||
IndustryGfx newgfx = GetIndustryTileSpec(GetIndustryGfx(tile))->anim_next;
|
||||
if (newgfx != INDUSTRYTILE_NOANIM) {
|
||||
|
@ -1223,7 +1223,7 @@ static void ProduceIndustryGoods(Industry *i)
|
|||
}
|
||||
|
||||
TriggerIndustryRandomisation(i, INDUSTRY_TRIGGER_INDUSTRY_TICK);
|
||||
StartStopIndustryTileAnimation(i, IAT_INDUSTRY_TICK);
|
||||
TriggerIndustryAnimation(i, IAT_INDUSTRY_TICK);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -286,7 +286,7 @@ bool DrawNewAirportTile(TileInfo *ti, Station *st, const AirportTileSpec *airts)
|
|||
/** Helper class for animation control. */
|
||||
struct AirportTileAnimationBase : public AnimationBase<AirportTileAnimationBase, AirportTileSpec, Station, int, GetAirportTileCallback, TileAnimationFrameAnimationHelper<Station> > {
|
||||
static constexpr CallbackID cb_animation_speed = CBID_AIRPTILE_ANIMATION_SPEED;
|
||||
static constexpr CallbackID cb_animation_next_frame = CBID_AIRPTILE_ANIM_NEXT_FRAME;
|
||||
static constexpr CallbackID cb_animation_next_frame = CBID_AIRPTILE_ANIMATION_NEXT_FRAME;
|
||||
|
||||
static constexpr AirportTileCallbackMask cbm_animation_speed = AirportTileCallbackMask::AnimationSpeed;
|
||||
static constexpr AirportTileCallbackMask cbm_animation_next_frame = AirportTileCallbackMask::AnimationNextFrame;
|
||||
|
@ -300,20 +300,20 @@ void AnimateAirportTile(TileIndex tile)
|
|||
AirportTileAnimationBase::AnimateTile(ats, Station::GetByTile(tile), tile, HasBit(ats->animation_special_flags, 0));
|
||||
}
|
||||
|
||||
void AirportTileAnimationTrigger(Station *st, TileIndex tile, AirpAnimationTrigger trigger, CargoType cargo_type)
|
||||
void TriggerAirportTileAnimation(Station *st, TileIndex tile, AirpAnimationTrigger trigger, CargoType cargo_type)
|
||||
{
|
||||
const AirportTileSpec *ats = AirportTileSpec::GetByTile(tile);
|
||||
if (!HasBit(ats->animation.triggers, trigger)) return;
|
||||
|
||||
AirportTileAnimationBase::ChangeAnimationFrame(CBID_AIRPTILE_ANIM_START_STOP, ats, st, tile, Random(), (uint8_t)trigger | (cargo_type << 8));
|
||||
AirportTileAnimationBase::ChangeAnimationFrame(CBID_AIRPTILE_ANIMATION_TRIGGER, ats, st, tile, Random(), (uint8_t)trigger | (cargo_type << 8));
|
||||
}
|
||||
|
||||
void AirportAnimationTrigger(Station *st, AirpAnimationTrigger trigger, CargoType cargo_type)
|
||||
void TriggerAirportAnimation(Station *st, AirpAnimationTrigger trigger, CargoType cargo_type)
|
||||
{
|
||||
if (st->airport.tile == INVALID_TILE) return;
|
||||
|
||||
for (TileIndex tile : st->airport) {
|
||||
if (st->TileBelongsToAirport(tile)) AirportTileAnimationTrigger(st, tile, trigger, cargo_type);
|
||||
if (st->TileBelongsToAirport(tile)) TriggerAirportTileAnimation(st, tile, trigger, cargo_type);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -88,8 +88,8 @@ private:
|
|||
};
|
||||
|
||||
void AnimateAirportTile(TileIndex tile);
|
||||
void AirportTileAnimationTrigger(Station *st, TileIndex tile, AirpAnimationTrigger trigger, CargoType cargo_type = INVALID_CARGO);
|
||||
void AirportAnimationTrigger(Station *st, AirpAnimationTrigger trigger, CargoType cargo_type = INVALID_CARGO);
|
||||
void TriggerAirportTileAnimation(Station *st, TileIndex tile, AirpAnimationTrigger trigger, CargoType cargo_type = INVALID_CARGO);
|
||||
void TriggerAirportAnimation(Station *st, AirpAnimationTrigger trigger, CargoType cargo_type = INVALID_CARGO);
|
||||
bool DrawNewAirportTile(TileInfo *ti, Station *st, const AirportTileSpec *airts);
|
||||
|
||||
#endif /* NEWGRF_AIRPORTTILES_H */
|
||||
|
|
|
@ -65,10 +65,10 @@ enum CallbackID : uint16_t {
|
|||
CBID_HOUSE_ANIMATION_NEXT_FRAME = 0x1A, // 15 bit callback
|
||||
|
||||
/** Called for periodically starting or stopping the animation. */
|
||||
CBID_HOUSE_ANIMATION_START_STOP = 0x1B, // 15 bit callback
|
||||
CBID_HOUSE_ANIMATION_TRIGGER_TILE_LOOP = 0x1B, // 15 bit callback
|
||||
|
||||
/** Called whenever the construction stage of a house changes. */
|
||||
CBID_HOUSE_CONSTRUCTION_STAGE_CHANGE = 0x1C, // 15 bit callback
|
||||
CBID_HOUSE_ANIMATION_TRIGGER_CONSTRUCTION_STAGE_CHANGED = 0x1C, // 15 bit callback
|
||||
|
||||
/** Determine whether a wagon can be attached to an already existing train. */
|
||||
CBID_TRAIN_ALLOW_WAGON_ATTACH = 0x1D,
|
||||
|
@ -98,10 +98,10 @@ enum CallbackID : uint16_t {
|
|||
CBID_STATION_BUILD_TILE_LAYOUT = 0x24, // 15 bit callback
|
||||
|
||||
/** Called for periodically starting or stopping the animation. */
|
||||
CBID_INDTILE_ANIM_START_STOP = 0x25, // 15 bit callback
|
||||
CBID_INDTILE_ANIMATION_TRIGGER = 0x25, // 15 bit callback
|
||||
|
||||
/** Called to determine industry tile next animation frame. */
|
||||
CBID_INDTILE_ANIM_NEXT_FRAME = 0x26, // 15 bit callback
|
||||
CBID_INDTILE_ANIMATION_NEXT_FRAME = 0x26, // 15 bit callback
|
||||
|
||||
/** Called to indicate how long the current animation frame should last. */
|
||||
CBID_INDTILE_ANIMATION_SPEED = 0x27, // 8 bit callback
|
||||
|
@ -184,10 +184,10 @@ enum CallbackID : uint16_t {
|
|||
/* There are no callbacks 0x3E - 0x13F */
|
||||
|
||||
/** Called for periodically starting or stopping the animation. */
|
||||
CBID_STATION_ANIM_START_STOP = 0x140, // 15 bit callback
|
||||
CBID_STATION_ANIMATION_TRIGGER = 0x140, // 15 bit callback
|
||||
|
||||
/** Called to determine station tile next animation frame. */
|
||||
CBID_STATION_ANIM_NEXT_FRAME = 0x141, // 15 bit callback
|
||||
CBID_STATION_ANIMATION_NEXT_FRAME = 0x141, // 15 bit callback
|
||||
|
||||
/** Called to indicate how long the current animation frame should last. */
|
||||
CBID_STATION_ANIMATION_SPEED = 0x142, // 8 bit callback
|
||||
|
@ -208,7 +208,7 @@ enum CallbackID : uint16_t {
|
|||
CBID_CANALS_SPRITE_OFFSET = 0x147, // 15 bit callback
|
||||
|
||||
/** Called when a cargo type specified in property 20 is accepted. */
|
||||
CBID_HOUSE_WATCHED_CARGO_ACCEPTED = 0x148, // 15 bit callback
|
||||
CBID_HOUSE_ANIMATION_TRIGGER_WATCHED_CARGO_ACCEPTED = 0x148, // 15 bit callback
|
||||
|
||||
/** Callback done for each tile of a station to check the slope. */
|
||||
CBID_STATION_LAND_SLOPE_CHECK = 0x149, // 15 bit callback
|
||||
|
@ -235,10 +235,10 @@ enum CallbackID : uint16_t {
|
|||
CBID_AIRPTILE_DRAW_FOUNDATIONS = 0x150, // 15 bit callback
|
||||
|
||||
/** Called for periodically starting or stopping the animation. */
|
||||
CBID_AIRPTILE_ANIM_START_STOP = 0x152, // 15 bit callback
|
||||
CBID_AIRPTILE_ANIMATION_TRIGGER = 0x152, // 15 bit callback
|
||||
|
||||
/** Called to determine airport tile next animation frame. */
|
||||
CBID_AIRPTILE_ANIM_NEXT_FRAME = 0x153, // 15 bit callback
|
||||
CBID_AIRPTILE_ANIMATION_NEXT_FRAME = 0x153, // 15 bit callback
|
||||
|
||||
/** Called to indicate how long the current animation frame should last. */
|
||||
CBID_AIRPTILE_ANIMATION_SPEED = 0x154, // 8 bit callback
|
||||
|
@ -259,7 +259,7 @@ enum CallbackID : uint16_t {
|
|||
CBID_OBJECT_ANIMATION_NEXT_FRAME = 0x158, // 15 bit callback
|
||||
|
||||
/** Called for periodically starting or stopping the animation. */
|
||||
CBID_OBJECT_ANIMATION_START_STOP = 0x159, // 15 bit callback
|
||||
CBID_OBJECT_ANIMATION_TRIGGER = 0x159, // 15 bit callback
|
||||
|
||||
/** Called to indicate how long the current animation frame should last. */
|
||||
CBID_OBJECT_ANIMATION_SPEED = 0x15A, // 8 bit callback
|
||||
|
@ -341,8 +341,8 @@ using RoadStopCallbackMasks = EnumBitSet<RoadStopCallbackMask, uint8_t>;
|
|||
enum class HouseCallbackMask : uint8_t {
|
||||
AllowConstruction = 0, ///< decide whether the house can be built on a given tile
|
||||
AnimationNextFrame = 1, ///< decides next animation frame
|
||||
AnimationStartStop = 2, ///< periodically start/stop the animation
|
||||
ConstructionStageChange = 3, ///< change animation when construction stage changes
|
||||
AnimationTriggerTileLoop = 2, ///< periodically start/stop the animation
|
||||
AnimationTriggerConstructionStageChanged = 3, ///< change animation when construction stage changes
|
||||
Colour = 4, ///< decide the colour of the building
|
||||
CargoAcceptance = 5, ///< decides amount of cargo acceptance
|
||||
AnimationSpeed = 6, ///< decides animation speed
|
||||
|
|
|
@ -537,12 +537,12 @@ void AnimateNewHouseTile(TileIndex tile)
|
|||
HouseAnimationBase::AnimateTile(hs, Town::GetByTile(tile), tile, hs->extra_flags.Test(HouseExtraFlag::Callback1ARandomBits));
|
||||
}
|
||||
|
||||
void AnimateNewHouseConstruction(TileIndex tile)
|
||||
void TriggerHouseAnimation_ConstructionStageChanged(TileIndex tile)
|
||||
{
|
||||
const HouseSpec *hs = HouseSpec::Get(GetHouseType(tile));
|
||||
|
||||
if (hs->callback_mask.Test(HouseCallbackMask::ConstructionStageChange)) {
|
||||
HouseAnimationBase::ChangeAnimationFrame(CBID_HOUSE_CONSTRUCTION_STAGE_CHANGE, hs, Town::GetByTile(tile), tile, 0, 0);
|
||||
if (hs->callback_mask.Test(HouseCallbackMask::AnimationTriggerConstructionStageChanged)) {
|
||||
HouseAnimationBase::ChangeAnimationFrame(CBID_HOUSE_ANIMATION_TRIGGER_CONSTRUCTION_STAGE_CHANGED, hs, Town::GetByTile(tile), tile, 0, 0);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -570,15 +570,15 @@ bool CanDeleteHouse(TileIndex tile)
|
|||
* @param sync Whether to call the synchronized or the unsynchronized trigger.
|
||||
* @param random_bits Shared random bits for the synchronized trigger.
|
||||
*/
|
||||
static void AnimationControl(TileIndex tile, bool sync, uint16_t random_bits)
|
||||
static void TriggerHouseAnimation_TileLoop(TileIndex tile, bool sync, uint16_t random_bits)
|
||||
{
|
||||
const HouseSpec *hs = HouseSpec::Get(GetHouseType(tile));
|
||||
|
||||
/* Check whether the matching trigger is enabled */
|
||||
if (hs->callback_mask.Test(HouseCallbackMask::AnimationStartStop) &&
|
||||
if (hs->callback_mask.Test(HouseCallbackMask::AnimationTriggerTileLoop) &&
|
||||
hs->extra_flags.Test(HouseExtraFlag::SynchronisedCallback1B) == sync) {
|
||||
uint32_t param = sync ? (GB(Random(), 0, 16) | random_bits << 16) : Random();
|
||||
HouseAnimationBase::ChangeAnimationFrame(CBID_HOUSE_ANIMATION_START_STOP, hs, Town::GetByTile(tile), tile, param, 0);
|
||||
HouseAnimationBase::ChangeAnimationFrame(CBID_HOUSE_ANIMATION_TRIGGER_TILE_LOOP, hs, Town::GetByTile(tile), tile, param, 0);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -595,15 +595,15 @@ bool NewHouseTileLoop(TileIndex tile)
|
|||
if (hs->building_flags.Any(BUILDING_HAS_1_TILE)) TriggerHouseRandomisation(tile, HOUSE_TRIGGER_TILE_LOOP_TOP);
|
||||
|
||||
/* Call the unsynchronized tile loop trigger */
|
||||
AnimationControl(tile, false, 0);
|
||||
TriggerHouseAnimation_TileLoop(tile, false, 0);
|
||||
|
||||
/* Call the synchronized tile loop trigger, if this is the north tile */
|
||||
if (hs->building_flags.Any(BUILDING_HAS_1_TILE)) {
|
||||
uint16_t random = GB(Random(), 0, 16);
|
||||
AnimationControl(tile, true, random);
|
||||
if (hs->building_flags.Any(BUILDING_2_TILES_Y)) AnimationControl(TileAddXY(tile, 0, 1), true, random);
|
||||
if (hs->building_flags.Any(BUILDING_2_TILES_X)) AnimationControl(TileAddXY(tile, 1, 0), true, random);
|
||||
if (hs->building_flags.Any(BUILDING_HAS_4_TILES)) AnimationControl(TileAddXY(tile, 1, 1), true, random);
|
||||
TriggerHouseAnimation_TileLoop(tile, true, random);
|
||||
if (hs->building_flags.Any(BUILDING_2_TILES_Y)) TriggerHouseAnimation_TileLoop(TileAddXY(tile, 0, 1), true, random);
|
||||
if (hs->building_flags.Any(BUILDING_2_TILES_X)) TriggerHouseAnimation_TileLoop(TileAddXY(tile, 1, 0), true, random);
|
||||
if (hs->building_flags.Any(BUILDING_HAS_4_TILES)) TriggerHouseAnimation_TileLoop(TileAddXY(tile, 1, 1), true, random);
|
||||
}
|
||||
|
||||
/* Check callback 21, which determines if a house should be destroyed. */
|
||||
|
@ -679,11 +679,11 @@ void TriggerHouseRandomisation(TileIndex t, HouseTrigger trigger)
|
|||
* @param trigger_cargoes Cargo types that triggered the callback.
|
||||
* @param random Random bits.
|
||||
*/
|
||||
void DoWatchedCargoCallback(TileIndex tile, TileIndex origin, CargoTypes trigger_cargoes, uint16_t random)
|
||||
static void DoTriggerHouseAnimation_WatchedCargoAccepted(TileIndex tile, TileIndex origin, CargoTypes trigger_cargoes, uint16_t random)
|
||||
{
|
||||
TileIndexDiffC diff = TileIndexToTileIndexDiffC(origin, tile);
|
||||
uint32_t cb_info = random << 16 | (uint8_t)diff.y << 8 | (uint8_t)diff.x;
|
||||
HouseAnimationBase::ChangeAnimationFrame(CBID_HOUSE_WATCHED_CARGO_ACCEPTED, HouseSpec::Get(GetHouseType(tile)), Town::GetByTile(tile), tile, 0, cb_info, trigger_cargoes);
|
||||
HouseAnimationBase::ChangeAnimationFrame(CBID_HOUSE_ANIMATION_TRIGGER_WATCHED_CARGO_ACCEPTED, HouseSpec::Get(GetHouseType(tile)), Town::GetByTile(tile), tile, 0, cb_info, trigger_cargoes);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -692,7 +692,7 @@ void DoWatchedCargoCallback(TileIndex tile, TileIndex origin, CargoTypes trigger
|
|||
* @param trigger_cargoes Triggering cargo types.
|
||||
* @pre IsTileType(t, MP_HOUSE)
|
||||
*/
|
||||
void WatchedCargoCallback(TileIndex tile, CargoTypes trigger_cargoes)
|
||||
void TriggerHouseAnimation_WatchedCargoAccepted(TileIndex tile, CargoTypes trigger_cargoes)
|
||||
{
|
||||
assert(IsTileType(tile, MP_HOUSE));
|
||||
HouseID id = GetHouseType(tile);
|
||||
|
@ -709,9 +709,9 @@ void WatchedCargoCallback(TileIndex tile, CargoTypes trigger_cargoes)
|
|||
TileIndex north = tile + GetHouseNorthPart(id);
|
||||
hs = HouseSpec::Get(id);
|
||||
|
||||
DoWatchedCargoCallback(north, tile, trigger_cargoes, r);
|
||||
if (hs->building_flags.Any(BUILDING_2_TILES_Y)) DoWatchedCargoCallback(TileAddXY(north, 0, 1), tile, trigger_cargoes, r);
|
||||
if (hs->building_flags.Any(BUILDING_2_TILES_X)) DoWatchedCargoCallback(TileAddXY(north, 1, 0), tile, trigger_cargoes, r);
|
||||
if (hs->building_flags.Any(BUILDING_HAS_4_TILES)) DoWatchedCargoCallback(TileAddXY(north, 1, 1), tile, trigger_cargoes, r);
|
||||
DoTriggerHouseAnimation_WatchedCargoAccepted(north, tile, trigger_cargoes, r);
|
||||
if (hs->building_flags.Any(BUILDING_2_TILES_Y)) DoTriggerHouseAnimation_WatchedCargoAccepted(TileAddXY(north, 0, 1), tile, trigger_cargoes, r);
|
||||
if (hs->building_flags.Any(BUILDING_2_TILES_X)) DoTriggerHouseAnimation_WatchedCargoAccepted(TileAddXY(north, 1, 0), tile, trigger_cargoes, r);
|
||||
if (hs->building_flags.Any(BUILDING_HAS_4_TILES)) DoTriggerHouseAnimation_WatchedCargoAccepted(TileAddXY(north, 1, 1), tile, trigger_cargoes, r);
|
||||
}
|
||||
|
||||
|
|
|
@ -99,11 +99,12 @@ std::span<const uint> GetBuildingHouseIDCounts();
|
|||
|
||||
void DrawNewHouseTile(TileInfo *ti, HouseID house_id);
|
||||
void AnimateNewHouseTile(TileIndex tile);
|
||||
void AnimateNewHouseConstruction(TileIndex tile);
|
||||
/* see also: void TriggerHouseAnimation_TileLoop(TileIndex tile, uint16_t random_bits) */
|
||||
void TriggerHouseAnimation_ConstructionStageChanged(TileIndex tile);
|
||||
void TriggerHouseAnimation_WatchedCargoAccepted(TileIndex tile, CargoTypes trigger_cargoes);
|
||||
|
||||
uint16_t GetHouseCallback(CallbackID callback, uint32_t param1, uint32_t param2, HouseID house_id, Town *town, TileIndex tile,
|
||||
bool not_yet_constructed = false, uint8_t initial_random_bits = 0, CargoTypes watched_cargo_triggers = 0, int view = 0);
|
||||
void WatchedCargoCallback(TileIndex tile, CargoTypes trigger_cargoes);
|
||||
|
||||
bool CanDeleteHouse(TileIndex tile);
|
||||
|
||||
|
|
|
@ -262,7 +262,7 @@ uint16_t GetSimpleIndustryCallback(CallbackID callback, uint32_t param1, uint32_
|
|||
/** Helper class for animation control. */
|
||||
struct IndustryAnimationBase : public AnimationBase<IndustryAnimationBase, IndustryTileSpec, Industry, int, GetSimpleIndustryCallback, TileAnimationFrameAnimationHelper<Industry> > {
|
||||
static constexpr CallbackID cb_animation_speed = CBID_INDTILE_ANIMATION_SPEED;
|
||||
static constexpr CallbackID cb_animation_next_frame = CBID_INDTILE_ANIM_NEXT_FRAME;
|
||||
static constexpr CallbackID cb_animation_next_frame = CBID_INDTILE_ANIMATION_NEXT_FRAME;
|
||||
|
||||
static constexpr IndustryTileCallbackMask cbm_animation_speed = IndustryTileCallbackMask::AnimationSpeed;
|
||||
static constexpr IndustryTileCallbackMask cbm_animation_next_frame = IndustryTileCallbackMask::AnimationNextFrame;
|
||||
|
@ -276,23 +276,23 @@ void AnimateNewIndustryTile(TileIndex tile)
|
|||
IndustryAnimationBase::AnimateTile(itspec, Industry::GetByTile(tile), tile, itspec->special_flags.Test(IndustryTileSpecialFlag::NextFrameRandomBits));
|
||||
}
|
||||
|
||||
bool StartStopIndustryTileAnimation(TileIndex tile, IndustryAnimationTrigger iat, uint32_t random)
|
||||
bool TriggerIndustryTileAnimation(TileIndex tile, IndustryAnimationTrigger iat, uint32_t random)
|
||||
{
|
||||
const IndustryTileSpec *itspec = GetIndustryTileSpec(GetIndustryGfx(tile));
|
||||
|
||||
if (!HasBit(itspec->animation.triggers, iat)) return false;
|
||||
|
||||
IndustryAnimationBase::ChangeAnimationFrame(CBID_INDTILE_ANIM_START_STOP, itspec, Industry::GetByTile(tile), tile, random, iat);
|
||||
IndustryAnimationBase::ChangeAnimationFrame(CBID_INDTILE_ANIMATION_TRIGGER, itspec, Industry::GetByTile(tile), tile, random, iat);
|
||||
return true;
|
||||
}
|
||||
|
||||
bool StartStopIndustryTileAnimation(const Industry *ind, IndustryAnimationTrigger iat)
|
||||
bool TriggerIndustryAnimation(const Industry *ind, IndustryAnimationTrigger iat)
|
||||
{
|
||||
bool ret = true;
|
||||
uint32_t random = Random();
|
||||
for (TileIndex tile : ind->location) {
|
||||
if (ind->TileBelongsToIndustry(tile)) {
|
||||
if (StartStopIndustryTileAnimation(tile, iat, random)) {
|
||||
if (TriggerIndustryTileAnimation(tile, iat, random)) {
|
||||
SB(random, 0, 16, Random());
|
||||
} else {
|
||||
ret = false;
|
||||
|
|
|
@ -62,8 +62,8 @@ uint16_t GetIndustryTileCallback(CallbackID callback, uint32_t param1, uint32_t
|
|||
CommandCost PerformIndustryTileSlopeCheck(TileIndex ind_base_tile, TileIndex ind_tile, const IndustryTileSpec *its, IndustryType type, IndustryGfx gfx, size_t layout_index, uint16_t initial_random_bits, Owner founder, IndustryAvailabilityCallType creation_type);
|
||||
|
||||
void AnimateNewIndustryTile(TileIndex tile);
|
||||
bool StartStopIndustryTileAnimation(TileIndex tile, IndustryAnimationTrigger iat, uint32_t random = Random());
|
||||
bool StartStopIndustryTileAnimation(const Industry *ind, IndustryAnimationTrigger iat);
|
||||
bool TriggerIndustryTileAnimation(TileIndex tile, IndustryAnimationTrigger iat, uint32_t random = Random());
|
||||
bool TriggerIndustryAnimation(const Industry *ind, IndustryAnimationTrigger iat);
|
||||
|
||||
|
||||
/** Available industry tile triggers. */
|
||||
|
|
|
@ -566,7 +566,7 @@ void TriggerObjectTileAnimation(Object *o, TileIndex tile, ObjectAnimationTrigge
|
|||
{
|
||||
if (!HasBit(spec->animation.triggers, trigger)) return;
|
||||
|
||||
ObjectAnimationBase::ChangeAnimationFrame(CBID_OBJECT_ANIMATION_START_STOP, spec, o, tile, Random(), trigger);
|
||||
ObjectAnimationBase::ChangeAnimationFrame(CBID_OBJECT_ANIMATION_TRIGGER, spec, o, tile, Random(), trigger);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -363,7 +363,7 @@ struct RoadStopAnimationFrameAnimationHelper {
|
|||
/** Helper class for animation control. */
|
||||
struct RoadStopAnimationBase : public AnimationBase<RoadStopAnimationBase, RoadStopSpec, BaseStation, int, GetAnimRoadStopCallback, RoadStopAnimationFrameAnimationHelper> {
|
||||
static constexpr CallbackID cb_animation_speed = CBID_STATION_ANIMATION_SPEED;
|
||||
static constexpr CallbackID cb_animation_next_frame = CBID_STATION_ANIM_NEXT_FRAME;
|
||||
static constexpr CallbackID cb_animation_next_frame = CBID_STATION_ANIMATION_NEXT_FRAME;
|
||||
|
||||
static constexpr RoadStopCallbackMask cbm_animation_speed = RoadStopCallbackMask::AnimationSpeed;
|
||||
static constexpr RoadStopCallbackMask cbm_animation_next_frame = RoadStopCallbackMask::AnimationNextFrame;
|
||||
|
@ -396,7 +396,7 @@ void TriggerRoadStopAnimation(BaseStation *st, TileIndex trigger_tile, StationAn
|
|||
} else {
|
||||
local_cargo = ss->grf_prop.grffile->cargo_map[cargo_type];
|
||||
}
|
||||
RoadStopAnimationBase::ChangeAnimationFrame(CBID_STATION_ANIM_START_STOP, ss, st, cur_tile, (random_bits << 16) | Random(), (uint8_t)trigger | (local_cargo << 8));
|
||||
RoadStopAnimationBase::ChangeAnimationFrame(CBID_STATION_ANIMATION_TRIGGER, ss, st, cur_tile, (random_bits << 16) | Random(), (uint8_t)trigger | (local_cargo << 8));
|
||||
}
|
||||
};
|
||||
|
||||
|
|
|
@ -888,7 +888,7 @@ uint16_t GetAnimStationCallback(CallbackID callback, uint32_t param1, uint32_t p
|
|||
/** Helper class for animation control. */
|
||||
struct StationAnimationBase : public AnimationBase<StationAnimationBase, StationSpec, BaseStation, int, GetAnimStationCallback, TileAnimationFrameAnimationHelper<BaseStation> > {
|
||||
static constexpr CallbackID cb_animation_speed = CBID_STATION_ANIMATION_SPEED;
|
||||
static constexpr CallbackID cb_animation_next_frame = CBID_STATION_ANIM_NEXT_FRAME;
|
||||
static constexpr CallbackID cb_animation_next_frame = CBID_STATION_ANIMATION_NEXT_FRAME;
|
||||
|
||||
static constexpr StationCallbackMask cbm_animation_speed = StationCallbackMask::AnimationSpeed;
|
||||
static constexpr StationCallbackMask cbm_animation_next_frame = StationCallbackMask::AnimationNextFrame;
|
||||
|
@ -930,7 +930,7 @@ void TriggerStationAnimation(BaseStation *st, TileIndex trigger_tile, StationAni
|
|||
} else {
|
||||
local_cargo = ss->grf_prop.grffile->cargo_map[cargo_type];
|
||||
}
|
||||
StationAnimationBase::ChangeAnimationFrame(CBID_STATION_ANIM_START_STOP, ss, st, tile, (random_bits << 16) | GB(Random(), 0, 16), (uint8_t)trigger | (local_cargo << 8));
|
||||
StationAnimationBase::ChangeAnimationFrame(CBID_STATION_ANIMATION_TRIGGER, ss, st, tile, (random_bits << 16) | GB(Random(), 0, 16), (uint8_t)trigger | (local_cargo << 8));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2622,7 +2622,7 @@ CommandCost CmdBuildAirport(DoCommandFlags flags, TileIndex tile, uint8_t airpor
|
|||
|
||||
/* Only call the animation trigger after all tiles have been built */
|
||||
for (AirportTileTableIterator iter(as->layouts[layout].tiles.data(), tile); iter != INVALID_TILE; ++iter) {
|
||||
AirportTileAnimationTrigger(st, iter, AAT_BUILT);
|
||||
TriggerAirportTileAnimation(st, iter, AAT_BUILT);
|
||||
}
|
||||
|
||||
UpdateAirplanesOnNewStation(st);
|
||||
|
@ -3609,7 +3609,7 @@ static void TileLoop_Station(TileIndex tile)
|
|||
{
|
||||
switch (GetStationType(tile)) {
|
||||
case StationType::Airport:
|
||||
AirportTileAnimationTrigger(Station::GetByTile(tile), tile, AAT_TILELOOP);
|
||||
TriggerAirportTileAnimation(Station::GetByTile(tile), tile, AAT_TILELOOP);
|
||||
break;
|
||||
|
||||
case StationType::Dock:
|
||||
|
@ -3764,7 +3764,7 @@ void TriggerWatchedCargoCallbacks(Station *st)
|
|||
BitmapTileIterator it(st->catchment_tiles);
|
||||
for (TileIndex tile = it; tile != INVALID_TILE; tile = ++it) {
|
||||
if (IsTileType(tile, MP_HOUSE)) {
|
||||
WatchedCargoCallback(tile, cargoes);
|
||||
TriggerHouseAnimation_WatchedCargoAccepted(tile, cargoes);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -4213,7 +4213,7 @@ void OnTick_Station()
|
|||
if ((TimerGameTick::counter + st->index) % Ticks::STATION_ACCEPTANCE_TICKS == 0) {
|
||||
TriggerStationAnimation(st, st->xy, SAT_250_TICKS);
|
||||
TriggerRoadStopAnimation(st, st->xy, SAT_250_TICKS);
|
||||
if (Station::IsExpected(st)) AirportAnimationTrigger(Station::From(st), AAT_STATION_250_TICKS);
|
||||
if (Station::IsExpected(st)) TriggerAirportAnimation(Station::From(st), AAT_STATION_250_TICKS);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -4280,7 +4280,7 @@ static uint UpdateStationWaiting(Station *st, CargoType cargo, uint amount, Sour
|
|||
|
||||
TriggerStationRandomisation(st, st->xy, SRT_NEW_CARGO, cargo);
|
||||
TriggerStationAnimation(st, st->xy, SAT_NEW_CARGO, cargo);
|
||||
AirportAnimationTrigger(st, AAT_STATION_NEW_CARGO, cargo);
|
||||
TriggerAirportAnimation(st, AAT_STATION_NEW_CARGO, cargo);
|
||||
TriggerRoadStopRandomisation(st, st->xy, RSRT_NEW_CARGO, cargo);
|
||||
TriggerRoadStopAnimation(st, st->xy, SAT_NEW_CARGO, cargo);
|
||||
|
||||
|
|
|
@ -97,8 +97,8 @@ static const NICallback _nic_stations[] = {
|
|||
NICS(CBID_STATION_AVAILABILITY, StationCallbackMask::Avail),
|
||||
NICS(CBID_STATION_DRAW_TILE_LAYOUT, StationCallbackMask::DrawTileLayout),
|
||||
NICS(CBID_STATION_BUILD_TILE_LAYOUT,std::monostate{}),
|
||||
NICS(CBID_STATION_ANIM_START_STOP, std::monostate{}),
|
||||
NICS(CBID_STATION_ANIM_NEXT_FRAME, StationCallbackMask::AnimationNextFrame),
|
||||
NICS(CBID_STATION_ANIMATION_TRIGGER, std::monostate{}),
|
||||
NICS(CBID_STATION_ANIMATION_NEXT_FRAME, StationCallbackMask::AnimationNextFrame),
|
||||
NICS(CBID_STATION_ANIMATION_SPEED, StationCallbackMask::AnimationSpeed),
|
||||
NICS(CBID_STATION_LAND_SLOPE_CHECK, StationCallbackMask::SlopeCheck),
|
||||
};
|
||||
|
@ -160,8 +160,8 @@ static const NIFeature _nif_station = {
|
|||
static const NICallback _nic_house[] = {
|
||||
NICH(CBID_HOUSE_ALLOW_CONSTRUCTION, HouseCallbackMask::AllowConstruction),
|
||||
NICH(CBID_HOUSE_ANIMATION_NEXT_FRAME, HouseCallbackMask::AnimationNextFrame),
|
||||
NICH(CBID_HOUSE_ANIMATION_START_STOP, HouseCallbackMask::AnimationStartStop),
|
||||
NICH(CBID_HOUSE_CONSTRUCTION_STAGE_CHANGE, HouseCallbackMask::ConstructionStageChange),
|
||||
NICH(CBID_HOUSE_ANIMATION_TRIGGER_TILE_LOOP, HouseCallbackMask::AnimationTriggerTileLoop),
|
||||
NICH(CBID_HOUSE_ANIMATION_TRIGGER_CONSTRUCTION_STAGE_CHANGED, HouseCallbackMask::AnimationTriggerConstructionStageChanged),
|
||||
NICH(CBID_HOUSE_COLOUR, HouseCallbackMask::Colour),
|
||||
NICH(CBID_HOUSE_CARGO_ACCEPTANCE, HouseCallbackMask::CargoAcceptance),
|
||||
NICH(CBID_HOUSE_ANIMATION_SPEED, HouseCallbackMask::AnimationSpeed),
|
||||
|
@ -169,7 +169,7 @@ static const NICallback _nic_house[] = {
|
|||
NICH(CBID_HOUSE_ACCEPT_CARGO, HouseCallbackMask::AcceptCargo),
|
||||
NICH(CBID_HOUSE_PRODUCE_CARGO, HouseCallbackMask::ProduceCargo),
|
||||
NICH(CBID_HOUSE_DENY_DESTRUCTION, HouseCallbackMask::DenyDestruction),
|
||||
NICH(CBID_HOUSE_WATCHED_CARGO_ACCEPTED, std::monostate{}),
|
||||
NICH(CBID_HOUSE_ANIMATION_TRIGGER_WATCHED_CARGO_ACCEPTED, std::monostate{}),
|
||||
NICH(CBID_HOUSE_CUSTOM_NAME, std::monostate{}),
|
||||
NICH(CBID_HOUSE_DRAW_FOUNDATIONS, HouseCallbackMask::DrawFoundations),
|
||||
NICH(CBID_HOUSE_AUTOSLOPE, HouseCallbackMask::Autoslope),
|
||||
|
@ -223,8 +223,8 @@ static const NIFeature _nif_house = {
|
|||
|
||||
#define NICIT(cb_id, bit) NIC(cb_id, IndustryTileSpec, callback_mask, bit)
|
||||
static const NICallback _nic_industrytiles[] = {
|
||||
NICIT(CBID_INDTILE_ANIM_START_STOP, std::monostate{}),
|
||||
NICIT(CBID_INDTILE_ANIM_NEXT_FRAME, IndustryTileCallbackMask::AnimationNextFrame),
|
||||
NICIT(CBID_INDTILE_ANIMATION_TRIGGER, std::monostate{}),
|
||||
NICIT(CBID_INDTILE_ANIMATION_NEXT_FRAME, IndustryTileCallbackMask::AnimationNextFrame),
|
||||
NICIT(CBID_INDTILE_ANIMATION_SPEED, IndustryTileCallbackMask::AnimationSpeed),
|
||||
NICIT(CBID_INDTILE_CARGO_ACCEPTANCE, IndustryTileCallbackMask::CargoAcceptance),
|
||||
NICIT(CBID_INDTILE_ACCEPT_CARGO, IndustryTileCallbackMask::AcceptCargo),
|
||||
|
@ -394,7 +394,7 @@ static const NIFeature _nif_industry = {
|
|||
static const NICallback _nic_objects[] = {
|
||||
NICO(CBID_OBJECT_LAND_SLOPE_CHECK, ObjectCallbackMask::SlopeCheck),
|
||||
NICO(CBID_OBJECT_ANIMATION_NEXT_FRAME, ObjectCallbackMask::AnimationNextFrame),
|
||||
NICO(CBID_OBJECT_ANIMATION_START_STOP, std::monostate{}),
|
||||
NICO(CBID_OBJECT_ANIMATION_TRIGGER, std::monostate{}),
|
||||
NICO(CBID_OBJECT_ANIMATION_SPEED, ObjectCallbackMask::AnimationSpeed),
|
||||
NICO(CBID_OBJECT_COLOUR, ObjectCallbackMask::Colour),
|
||||
NICO(CBID_OBJECT_FUND_MORE_TEXT, ObjectCallbackMask::FundMoreText),
|
||||
|
@ -485,8 +485,8 @@ static const NIFeature _nif_railtype = {
|
|||
#define NICAT(cb_id, bit) NIC(cb_id, AirportTileSpec, callback_mask, bit)
|
||||
static const NICallback _nic_airporttiles[] = {
|
||||
NICAT(CBID_AIRPTILE_DRAW_FOUNDATIONS, AirportTileCallbackMask::DrawFoundations),
|
||||
NICAT(CBID_AIRPTILE_ANIM_START_STOP, std::monostate{}),
|
||||
NICAT(CBID_AIRPTILE_ANIM_NEXT_FRAME, AirportTileCallbackMask::AnimationNextFrame),
|
||||
NICAT(CBID_AIRPTILE_ANIMATION_TRIGGER, std::monostate{}),
|
||||
NICAT(CBID_AIRPTILE_ANIMATION_NEXT_FRAME, AirportTileCallbackMask::AnimationNextFrame),
|
||||
NICAT(CBID_AIRPTILE_ANIMATION_SPEED, AirportTileCallbackMask::AnimationSpeed),
|
||||
};
|
||||
|
||||
|
@ -665,8 +665,8 @@ static const NIFeature _nif_tramtype = {
|
|||
#define NICRS(cb_id, bit) NIC(cb_id, RoadStopSpec, callback_mask, bit)
|
||||
static const NICallback _nic_roadstops[] = {
|
||||
NICRS(CBID_STATION_AVAILABILITY, RoadStopCallbackMask::Avail),
|
||||
NICRS(CBID_STATION_ANIM_START_STOP, std::monostate{}),
|
||||
NICRS(CBID_STATION_ANIM_NEXT_FRAME, RoadStopCallbackMask::AnimationNextFrame),
|
||||
NICRS(CBID_STATION_ANIMATION_TRIGGER, std::monostate{}),
|
||||
NICRS(CBID_STATION_ANIMATION_NEXT_FRAME, RoadStopCallbackMask::AnimationNextFrame),
|
||||
NICRS(CBID_STATION_ANIMATION_SPEED, RoadStopCallbackMask::AnimationSpeed),
|
||||
};
|
||||
|
||||
|
|
|
@ -503,7 +503,7 @@ static void AdvanceSingleHouseConstruction(TileIndex tile)
|
|||
IncHouseConstructionTick(tile);
|
||||
if (GetHouseConstructionTick(tile) != 0) return;
|
||||
|
||||
AnimateNewHouseConstruction(tile);
|
||||
TriggerHouseAnimation_ConstructionStageChanged(tile);
|
||||
|
||||
if (IsHouseCompleted(tile)) {
|
||||
/* Now that construction is complete, we can add the population of the
|
||||
|
|
Loading…
Reference in New Issue