1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-07-05 00:49:09 +02:00

Implemented terrain palette animatiions. Removed old code

This commit is contained in:
Ivan Savenko
2023-02-19 22:05:19 +02:00
parent 57d906a01c
commit ca13e7dedf
14 changed files with 85 additions and 507 deletions

View File

@ -155,7 +155,7 @@ const CGPath * MapRendererContext::currentPath() const
size_t MapRendererContext::objectImageIndex(ObjectInstanceID objectID, size_t groupSize) const
{
assert(groupSize > 0);
if (groupSize == 0)
if(groupSize == 0)
return 0;
// H3 timing for adventure map objects animation is 180 ms
@ -164,14 +164,22 @@ size_t MapRendererContext::objectImageIndex(ObjectInstanceID objectID, size_t gr
// hero movement animation always plays at ~50ms / frame
// in-game setting only affect movement across screen
if (movementAnimation && movementAnimation->target == objectID)
baseFrameTime = 50;
if(movementAnimation && movementAnimation->target == objectID)
baseFrameTime = 50;
size_t frameCounter = animationTime / baseFrameTime;
size_t frameIndex = frameCounter % groupSize;
return frameIndex;
}
size_t MapRendererContext::terrainImageIndex(size_t groupSize) const
{
size_t baseFrameTime = 180;
size_t frameCounter = animationTime / baseFrameTime;
size_t frameIndex = frameCounter % groupSize;
return frameIndex;
}
Point MapRendererContext::getTileSize() const
{
return Point(32, 32);
@ -179,7 +187,7 @@ Point MapRendererContext::getTileSize() const
bool MapRendererContext::showGrid() const
{
return true; // settings["session"]["showGrid"].Bool();
return true; // settings["gameTweaks"]["showGrid"].Bool();
}
void MapViewController::setViewCenter(const int3 & position)