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

Bird animation (#15294)

* initial implementation;

progress 1

progress 2

refactor to chain start

progress 3

begin walking

finish bird

remove walking

remove unused functions

refactor track element getting

fix formatting

refactor and add comments

remove brackets from simple if-else statements

invalidate vehicle

refactor again

fix format and refactor

please satisfy clang format

fix fallthrough

invalidate default case

remove redundant falltrhough

network bump

use std::max

refactor animation again

fix modulus

* move array declaration

* satisfy clang-format

* add changelog entry
This commit is contained in:
spacek531
2021-08-29 02:30:34 -07:00
committed by GitHub
parent e0751d707f
commit cba52b240e
5 changed files with 52 additions and 3 deletions

View File

@@ -62,7 +62,7 @@ The following people are not part of the development team, but have been contrib
* Robert Jordan (trigger-death) - UI theming, title sequence editor, misc.
* Aaron van Geffen (AaronVanGeffen) - scenario select screen, font detection, misc.
* Michał Janiszewski (janisozaur) - Linux port, crash handling, security, misc.
* Kelson Blakewood (spacek531) - title sequences for release versions 0.0.4 through 0.1.2, title sequences using milliseconds
* Kelson Blakewood (spacek531) - title sequences, title sequence features, vehicle features
* Hugo Wallenburg (Goddesen) - Misc.
* Edward Calver (X7123M3-256) - New Hybrid Coaster track, extended sprite toolchain, more vehicle cheats, misc.
* Matte Andersson (Nubbie) - Misc, UX

View File

@@ -6,6 +6,7 @@
- Feature: [#15164] Highlight elements selected by the Tile Inspector, tracks are currently not supported.
- Feature: [#15165] [Plugin] Add the ability to create entities using "map.createEntity".
- Feature: [#15194] [Plugin] Add guest properties, ride downtime and park casualty penalty.
- Feature: [#15294] New vehicle animation type: flying animal
- Fix: [#13465] Creating a scenario based on a won save game results in a scenario thats instantly won.
- Fix: [#14316] Closing the Track Designs Manager window causes broken state.
- Fix: [#14667] “Extreme Hawaiian Island” has unpurchaseable land tiles (original bug).

View File

@@ -37,7 +37,7 @@
// This string specifies which version of network stream current build uses.
// It is used for making sure only compatible builds get connected, even within
// single OpenRCT2 version.
#define NETWORK_STREAM_VERSION "5"
#define NETWORK_STREAM_VERSION "6"
#define NETWORK_STREAM_ID OPENRCT2_VERSION "-" NETWORK_STREAM_VERSION
static Peep* _pickup_peep = nullptr;

View File

@@ -1536,6 +1536,13 @@ bool Vehicle::OpenRestraints()
restraintsOpen = false;
continue;
}
if (vehicleEntry->animation == VEHICLE_ENTRY_ANIMATION_ANIMAL_FLYING
&& (vehicle->animation_frame != 0 || vehicle->animationState > 0))
{
vehicle->UpdateAnimationAnimalFlying();
restraintsOpen = false;
continue;
}
if (vehicle->HasUpdateFlag(VEHICLE_UPDATE_FLAG_BROKEN_CAR) && vehicle->restraints_position != 0xFF
&& (curRide->breakdown_reason_pending == BREAKDOWN_RESTRAINTS_STUCK_CLOSED
@@ -7269,6 +7276,39 @@ void Vehicle::UpdateSpinningCar()
Invalidate();
}
void Vehicle::UpdateAnimationAnimalFlying()
{
if (animationState > 0)
{
animationState--;
return;
}
else
{
if (animation_frame == 0)
{
auto trackType = GetTrackType();
TileElement* trackElement = map_get_track_element_at_of_type_seq(TrackLocation, trackType, 0);
if (trackElement != nullptr && trackElement->AsTrack()->HasChain())
{
// start flapping, bird
animation_frame = 1;
animationState = 5;
Invalidate();
}
}
else
{
// continue flapping until reaching frame 0
animation_frame = (animation_frame + 1) % 4;
Invalidate();
}
// number of frames to skip before updating again
constexpr std::array<uint8_t, 4> frameWaitTimes = { 5, 3, 5, 3 };
animationState = frameWaitTimes[animation_frame];
}
}
/**
*
* rct2: 0x006D63D4
@@ -7421,6 +7461,12 @@ void Vehicle::UpdateAdditionalAnimation()
}
}
break;
case VEHICLE_ENTRY_ANIMATION_ANIMAL_FLYING:
UpdateAnimationAnimalFlying();
// makes animation play faster with vehicle speed
targetFrame = abs(_vehicleVelocityF64E08) >> 24;
animationState = std::max(animationState - targetFrame, 0);
break;
}
}

View File

@@ -324,6 +324,7 @@ private:
void UpdateCrashSetup();
void UpdateCollisionSetup();
int32_t UpdateMotionDodgems();
void UpdateAnimationAnimalFlying();
void UpdateAdditionalAnimation();
void CheckIfMissing();
bool CurrentTowerElementIsTop();
@@ -472,7 +473,8 @@ enum
VEHICLE_ENTRY_ANIMATION_OBSERVATION_TOWER,
VEHICLE_ENTRY_ANIMATION_HELICARS,
VEHICLE_ENTRY_ANIMATION_MONORAIL_CYCLES,
VEHICLE_ENTRY_ANIMATION_MULTI_DIM_COASTER
VEHICLE_ENTRY_ANIMATION_MULTI_DIM_COASTER,
VEHICLE_ENTRY_ANIMATION_ANIMAL_FLYING // OpenRCT2-specific feature
};
enum : uint32_t