1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-06-23 00:28:08 +02:00

Made speed of most of battle animations time-based

- speed of creature-related animation no longer depends on framerate
- most of values from cranim.txt are now used correctly
- removed BMPPalette struct in favor of SDL_Color
- animation group "DEAD" that is used to display dead stacks, by default consists from last frame of "DEATH" group

Notes:
- animation speed may still need some adjustments
- range of config property "battle/animationSpeed" has been changed. This may result in extremely fast animation. To fix - change animation speed via options.
This commit is contained in:
Ivan Savenko
2013-07-06 16:10:20 +00:00
parent 68603245c4
commit 146a5e5ef8
21 changed files with 845 additions and 827 deletions

View File

@ -52,7 +52,7 @@ CDefEssential::~CDefEssential()
void CDefHandler::openFromMemory(ui8 *table, const std::string & name)
{
BMPPalette palette[256];
SDL_Color palette[256];
SDefEntry &de = * reinterpret_cast<SDefEntry *>(table);
ui8 *p;
@ -64,10 +64,10 @@ void CDefHandler::openFromMemory(ui8 *table, const std::string & name)
for (ui32 it=0;it<256;it++)
{
palette[it].R = de.palette[it].R;
palette[it].G = de.palette[it].G;
palette[it].B = de.palette[it].B;
palette[it].F = 255;
palette[it].r = de.palette[it].R;
palette[it].g = de.palette[it].G;
palette[it].b = de.palette[it].B;
palette[it].unused = 255;
}
// The SDefEntryBlock starts just after the SDefEntry
@ -128,7 +128,7 @@ void CDefHandler::expand(ui8 N,ui8 & BL, ui8 & BR)
BR = N & 0x1F;
}
SDL_Surface * CDefHandler::getSprite (int SIndex, const ui8 * FDef, const BMPPalette * palette) const
SDL_Surface * CDefHandler::getSprite (int SIndex, const ui8 * FDef, const SDL_Color * palette) const
{
SDL_Surface * ret=nullptr;
@ -176,10 +176,10 @@ SDL_Surface * CDefHandler::getSprite (int SIndex, const ui8 * FDef, const BMPPal
for(int i=0; i<256; ++i)
{
SDL_Color pr;
pr.r = palette[i].R;
pr.g = palette[i].G;
pr.b = palette[i].B;
pr.unused = palette[i].F;
pr.r = palette[i].r;
pr.g = palette[i].g;
pr.b = palette[i].b;
pr.unused = palette[i].unused;
(*(ret->format->palette->colors+i))=pr;
}