Make -2 the magic infinite loops value
This commit is contained in:
@@ -935,6 +935,12 @@ void cPict::drawPresetField(short num, rectangle to_rect){
|
||||
rect_draw_some_item(*from_gw, from_rect, getWindow(), to_rect, sf::BlendAlpha);
|
||||
}
|
||||
|
||||
void cPict::setAnimLoops(short value) {
|
||||
// -2 is infinite loops. Anything else <= 0 is no animation.
|
||||
if(value >= 0 || value == -2) animLoops = value;
|
||||
else animLoops = 0;
|
||||
}
|
||||
|
||||
void cPict::updateAnim(short loop_frames) {
|
||||
if(prevAnimFrame != animFrame){
|
||||
if(animFrame % loop_frames == 0 && animLoops > 0)
|
||||
|
@@ -85,7 +85,7 @@ public:
|
||||
cPict& operator=(cPict& other) = delete;
|
||||
cPict(cPict& other) = delete;
|
||||
inline static void resetAnim() { animFrame = 0; }
|
||||
inline void setAnimLoops(short value) { animLoops = value; }
|
||||
void setAnimLoops(short value);
|
||||
private:
|
||||
static std::shared_ptr<const sf::Texture> getSheetInternal(eSheetType type, size_t n);
|
||||
std::shared_ptr<const sf::Texture> getSheet(eSheetType type, size_t n = 0);
|
||||
|
Reference in New Issue
Block a user