mirror of https://github.com/OpenRCT2/OpenRCT2.git
Create CarEntry.cpp
This commit is contained in:
parent
06e31f968d
commit
b4d5ac640b
|
@ -851,6 +851,7 @@
|
||||||
<ClCompile Include="rct2\T6Importer.cpp" />
|
<ClCompile Include="rct2\T6Importer.cpp" />
|
||||||
<ClCompile Include="ReplayManager.cpp" />
|
<ClCompile Include="ReplayManager.cpp" />
|
||||||
<ClCompile Include="ride\CableLift.cpp" />
|
<ClCompile Include="ride\CableLift.cpp" />
|
||||||
|
<ClCompile Include="ride\CarEntry.cpp" />
|
||||||
<ClCompile Include="ride\coaster\AirPoweredVerticalCoaster.cpp" />
|
<ClCompile Include="ride\coaster\AirPoweredVerticalCoaster.cpp" />
|
||||||
<ClCompile Include="ride\coaster\AlpineCoaster.cpp" />
|
<ClCompile Include="ride\coaster\AlpineCoaster.cpp" />
|
||||||
<ClCompile Include="ride\coaster\BobsleighCoaster.cpp" />
|
<ClCompile Include="ride\coaster\BobsleighCoaster.cpp" />
|
||||||
|
|
|
@ -0,0 +1,40 @@
|
||||||
|
/*****************************************************************************
|
||||||
|
* Copyright (c) 2014-2023 OpenRCT2 developers
|
||||||
|
*
|
||||||
|
* For a complete list of all authors, please refer to contributors.md
|
||||||
|
* Interested in contributing? Visit https://github.com/OpenRCT2/OpenRCT2
|
||||||
|
*
|
||||||
|
* OpenRCT2 is licensed under the GNU General Public License version 3.
|
||||||
|
*****************************************************************************/
|
||||||
|
|
||||||
|
#include "CarEntry.h"
|
||||||
|
|
||||||
|
#include "../entity/Yaw.hpp"
|
||||||
|
|
||||||
|
#include <cstdint>
|
||||||
|
|
||||||
|
uint32_t CarEntry::NumRotationSprites(SpriteGroupType spriteGroup) const
|
||||||
|
{
|
||||||
|
return NumSpritesPrecision(SpriteGroups[static_cast<uint8_t>(spriteGroup)].spritePrecision);
|
||||||
|
}
|
||||||
|
|
||||||
|
int32_t CarEntry::SpriteByYaw(int32_t yaw, SpriteGroupType spriteGroup) const
|
||||||
|
{
|
||||||
|
return YawToPrecision(yaw, SpriteGroups[static_cast<uint8_t>(spriteGroup)].spritePrecision);
|
||||||
|
}
|
||||||
|
|
||||||
|
bool CarEntry::GroupEnabled(SpriteGroupType spriteGroup) const
|
||||||
|
{
|
||||||
|
return SpriteGroups[static_cast<uint8_t>(spriteGroup)].Enabled();
|
||||||
|
}
|
||||||
|
|
||||||
|
uint32_t CarEntry::GroupImageId(SpriteGroupType spriteGroup) const
|
||||||
|
{
|
||||||
|
return SpriteGroups[static_cast<uint8_t>(spriteGroup)].imageId;
|
||||||
|
}
|
||||||
|
|
||||||
|
uint32_t CarEntry::SpriteOffset(SpriteGroupType spriteGroup, int32_t imageDirection, uint8_t rankIndex) const
|
||||||
|
{
|
||||||
|
return ((SpriteByYaw(imageDirection, spriteGroup) + NumRotationSprites(spriteGroup) * rankIndex) * base_num_frames)
|
||||||
|
+ GroupImageId(spriteGroup);
|
||||||
|
}
|
|
@ -3741,29 +3741,3 @@ void Vehicle::Paint(PaintSession& session, int32_t imageDirection) const
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
uint32_t CarEntry::NumRotationSprites(SpriteGroupType spriteGroup) const
|
|
||||||
{
|
|
||||||
return NumSpritesPrecision(SpriteGroups[static_cast<uint8_t>(spriteGroup)].spritePrecision);
|
|
||||||
}
|
|
||||||
|
|
||||||
int32_t CarEntry::SpriteByYaw(int32_t yaw, SpriteGroupType spriteGroup) const
|
|
||||||
{
|
|
||||||
return YawToPrecision(yaw, SpriteGroups[static_cast<uint8_t>(spriteGroup)].spritePrecision);
|
|
||||||
}
|
|
||||||
|
|
||||||
bool CarEntry::GroupEnabled(SpriteGroupType spriteGroup) const
|
|
||||||
{
|
|
||||||
return SpriteGroups[static_cast<uint8_t>(spriteGroup)].Enabled();
|
|
||||||
}
|
|
||||||
|
|
||||||
uint32_t CarEntry::GroupImageId(SpriteGroupType spriteGroup) const
|
|
||||||
{
|
|
||||||
return SpriteGroups[static_cast<uint8_t>(spriteGroup)].imageId;
|
|
||||||
}
|
|
||||||
|
|
||||||
uint32_t CarEntry::SpriteOffset(SpriteGroupType spriteGroup, int32_t imageDirection, uint8_t rankIndex) const
|
|
||||||
{
|
|
||||||
return ((SpriteByYaw(imageDirection, spriteGroup) + NumRotationSprites(spriteGroup) * rankIndex) * base_num_frames)
|
|
||||||
+ GroupImageId(spriteGroup);
|
|
||||||
}
|
|
||||||
|
|
Loading…
Reference in New Issue