2424#include < vector>
2525#include < set>
2626#include < array>
27+ #include " shared/IFile.h"
2728
2829constexpr uint8_t NO_SPECIAL_ID = 0 ;
2930constexpr const size_t SEQ_COUNT = 30 ;
3031
31- const std::array<CAnimator::animzSeq_t, SEQ_COUNT > g_animzSeq = {{
32+ constexpr const std::array<CAnimator::animzSeq_t, SEQ_COUNT > g_animzSeq = {{
3233 {TILES_DIAMOND , ANIMZ_DIAMOND , ANIMZ_DIAMOND_LEN , NO_SPECIAL_ID },
3334 {TILES_INSECT1 , ANIMZ_INSECT1_DN , ANIMZ_INSECT1_LEN , ANIMZ_INSECT1 },
3435 {TILES_SWAMP , ANIMZ_SWAMP , ANIMZ_SWAMP_LEN , NO_SPECIAL_ID },
@@ -61,14 +62,6 @@ const std::array<CAnimator::animzSeq_t, SEQ_COUNT> g_animzSeq = {{
6162 {SFX_FLAME , ANIMZ_FLAME , ANIMZ_FLAME_LEN , ANIMZ_FLAME }, // barrel flame
6263}};
6364
64- const std::set<uint8_t > g_specialCases = {
65- TILES_INSECT1 ,
66- TILES_MUSH_IDLE ,
67- TILES_DRAGO ,
68- TILES_ETURTLE ,
69- TILES_WHTEWORM ,
70- };
71-
7265CAnimator::CAnimator () : m_seqIndex(g_animzSeq.size(), 0)
7366{
7467 memset (m_tileMainLayer, NO_ANIMZ , sizeof (m_tileMainLayer));
@@ -83,7 +76,6 @@ CAnimator::CAnimator() : m_seqIndex(g_animzSeq.size(), 0)
8376 ++i;
8477 }
8578
86- // std::fill(m_tileMainLayer.begin(), m_tileReplacement.end(), NO_ANIMZ);
8779 for (const auto &seq : g_animzSeq)
8880 {
8981 m_seqLookUp[seq.srcTile ] = animzInfo_t{
@@ -125,11 +117,6 @@ uint16_t CAnimator::offset() const
125117 return m_offset;
126118}
127119
128- bool CAnimator::isSpecialCase (uint8_t tileID) const
129- {
130- return g_specialCases.find (tileID) != g_specialCases.end ();
131- }
132-
133120animzInfo_t CAnimator::getSpecialInfo (const int tileID) const
134121{
135122 const auto &it = m_seqLookUp.find (tileID);
@@ -142,4 +129,30 @@ animzInfo_t CAnimator::getSpecialInfo(const int tileID) const
142129 };
143130 }
144131 return animzInfo_t{};
145- }
132+ }
133+
134+ bool CAnimator::read (IFile &sfile)
135+ {
136+ if (sfile.read (m_tileMainLayer, sizeof (m_tileMainLayer)) != IFILE_OK )
137+ {
138+ return false ;
139+ }
140+ if (sfile.read (m_tileLayer, sizeof (m_tileLayer)) != IFILE_OK )
141+ {
142+ return false ;
143+ }
144+ return false ;
145+ }
146+
147+ bool CAnimator::write (IFile &sfile) const
148+ {
149+ if (sfile.write (m_tileMainLayer, sizeof (m_tileMainLayer)) != IFILE_OK )
150+ {
151+ return false ;
152+ }
153+ if (sfile.write (m_tileLayer, sizeof (m_tileLayer)) != IFILE_OK )
154+ {
155+ return false ;
156+ }
157+ return false ;
158+ }
0 commit comments