diff options
author | Elias Fleckenstein <54945686+EliasFleckenstein03@users.noreply.github.com> | 2020-11-04 16:57:47 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-11-04 16:57:47 +0100 |
commit | 3e16c3a78fff61c20e63ba730d15e94e3bb877b4 (patch) | |
tree | c070350db219f2c4241d22bc31949685c7b42fe9 /src/tileanimation.cpp | |
parent | 5d9ae5a91c544fc7fbd475decf47cef7e09ef8fc (diff) | |
parent | 6ccb5835ff55d85156be91473c598eca9d6cb9a6 (diff) | |
download | dragonfireclient-3e16c3a78fff61c20e63ba730d15e94e3bb877b4.tar.xz |
Merge branch 'master' into master
Diffstat (limited to 'src/tileanimation.cpp')
-rw-r--r-- | src/tileanimation.cpp | 22 |
1 files changed, 10 insertions, 12 deletions
diff --git a/src/tileanimation.cpp b/src/tileanimation.cpp index f4043f5a0..930fd9473 100644 --- a/src/tileanimation.cpp +++ b/src/tileanimation.cpp @@ -35,7 +35,7 @@ void TileAnimationParams::serialize(std::ostream &os, u8 tiledef_version) const void TileAnimationParams::deSerialize(std::istream &is, u8 tiledef_version) { - type = (TileAnimationType)readU8(is); + type = (TileAnimationType) readU8(is); if (type == TAT_VERTICAL_FRAMES) { vertical_frames.aspect_w = readU16(is); @@ -53,8 +53,8 @@ void TileAnimationParams::determineParams(v2u32 texture_size, int *frame_count, { if (type == TAT_VERTICAL_FRAMES) { int frame_height = (float)texture_size.X / - (float)vertical_frames.aspect_w * - (float)vertical_frames.aspect_h; + (float)vertical_frames.aspect_w * + (float)vertical_frames.aspect_h; int _frame_count = texture_size.Y / frame_height; if (frame_count) *frame_count = _frame_count; @@ -68,14 +68,12 @@ void TileAnimationParams::determineParams(v2u32 texture_size, int *frame_count, if (frame_length_ms) *frame_length_ms = 1000 * sheet_2d.frame_length; if (frame_size) - *frame_size = v2u32(texture_size.X / sheet_2d.frames_w, - texture_size.Y / sheet_2d.frames_h); + *frame_size = v2u32(texture_size.X / sheet_2d.frames_w, texture_size.Y / sheet_2d.frames_h); } // caller should check for TAT_NONE } -void TileAnimationParams::getTextureModifer( - std::ostream &os, v2u32 texture_size, int frame) const +void TileAnimationParams::getTextureModifer(std::ostream &os, v2u32 texture_size, int frame) const { if (type == TAT_NONE) return; @@ -87,8 +85,8 @@ void TileAnimationParams::getTextureModifer( int q, r; q = frame / sheet_2d.frames_w; r = frame % sheet_2d.frames_w; - os << "^[sheet:" << sheet_2d.frames_w << "x" << sheet_2d.frames_h << ":" - << r << "," << q; + os << "^[sheet:" << sheet_2d.frames_w << "x" << sheet_2d.frames_h + << ":" << r << "," << q; } } @@ -97,8 +95,8 @@ v2f TileAnimationParams::getTextureCoords(v2u32 texture_size, int frame) const v2u32 ret(0, 0); if (type == TAT_VERTICAL_FRAMES) { int frame_height = (float)texture_size.X / - (float)vertical_frames.aspect_w * - (float)vertical_frames.aspect_h; + (float)vertical_frames.aspect_w * + (float)vertical_frames.aspect_h; ret = v2u32(0, frame_height * frame); } else if (type == TAT_SHEET_2D) { v2u32 frame_size; @@ -108,5 +106,5 @@ v2f TileAnimationParams::getTextureCoords(v2u32 texture_size, int frame) const r = frame % sheet_2d.frames_w; ret = v2u32(r * frame_size.X, q * frame_size.Y); } - return v2f(ret.X / (float)texture_size.X, ret.Y / (float)texture_size.Y); + return v2f(ret.X / (float) texture_size.X, ret.Y / (float) texture_size.Y); } |