Skip to content

Commit

Permalink
Bug Fix
Browse files Browse the repository at this point in the history
  • Loading branch information
zesinger authored Mar 24, 2023
1 parent 622a7ea commit 59e8e74
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions ColorizingDMD.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3829,6 +3829,7 @@ void CompareAdditionalFrames(UINT nFrames, sFrames* pFrames)
}
}
}
// calculate the hashes for the old frames
UINT32* pnomaskhash = (UINT32*)malloc(sizeof(UINT32) * MycRom.nFrames);
if (!pnomaskhash)
{
Expand All @@ -3840,22 +3841,21 @@ void CompareAdditionalFrames(UINT nFrames, sFrames* pFrames)
if (!(ti % 200)) Display_Avancement((float)ti / (float)(MycRom.nFrames - 1), 2, 4);
if (MycRom.CompMaskID[ti] != 255)
{
MycRom.HashCode[ti] = crc32_fast_mask(&MycRom.cFrames[MycRom.fWidth * MycRom.fHeight * ti], &MycRom.CompMasks[MycRom.CompMaskID[ti] * MycRom.fWidth * MycRom.fHeight], MycRom.fWidth * MycRom.fHeight, (BOOL)MycRom.ShapeCompMode[ti]);
pnomaskhash[ti] = crc32_fast(&MycRom.cFrames[MycRom.fWidth * MycRom.fHeight * ti], MycRom.fWidth * MycRom.fHeight, FALSE);
MycRom.HashCode[ti] = crc32_fast_mask(&MycRP.oFrames[MycRom.fWidth * MycRom.fHeight * ti], &MycRom.CompMasks[MycRom.CompMaskID[ti] * MycRom.fWidth * MycRom.fHeight], MycRom.fWidth * MycRom.fHeight, (BOOL)MycRom.ShapeCompMode[ti]);
pnomaskhash[ti] = crc32_fast(&MycRP.oFrames[MycRom.fWidth * MycRom.fHeight * ti], MycRom.fWidth * MycRom.fHeight, FALSE);
}
else
{
MycRom.HashCode[ti] = crc32_fast(&MycRom.cFrames[MycRom.fWidth * MycRom.fHeight * ti], MycRom.fWidth * MycRom.fHeight, (BOOL)MycRom.ShapeCompMode[ti]);
MycRom.HashCode[ti] = crc32_fast(&MycRP.oFrames[MycRom.fWidth * MycRom.fHeight * ti], MycRom.fWidth * MycRom.fHeight, (BOOL)MycRom.ShapeCompMode[ti]);
if (MycRom.ShapeCompMode[ti] == FALSE) pnomaskhash[ti] = MycRom.HashCode[ti];
else pnomaskhash[ti] = crc32_fast(&MycRom.cFrames[MycRom.fWidth * MycRom.fHeight * ti], MycRom.fWidth * MycRom.fHeight, FALSE);
else pnomaskhash[ti] = crc32_fast(&MycRP.oFrames[MycRom.fWidth * MycRom.fHeight * ti], MycRom.fWidth * MycRom.fHeight, FALSE);
}
}
// then compare the new frames with the previous ones
for (unsigned int ti = 0; ti < nFrames; ti++)
{
if (pFrames[ti].active == FALSE) continue;
if (!(ti % 200)) Display_Avancement((float)ti / (float)(nFrames - 1), 3, 4);
//on compare 2 frames ici
UINT8 premask = 255;
BOOL isshapemode = FALSE;
UINT32 achash = crc32_fast((UINT8*)pFrames[ti].ptr, MycRom.fWidth * MycRom.fHeight, FALSE);
Expand Down Expand Up @@ -3895,7 +3895,7 @@ void CompareAdditionalFrames(UINT nFrames, sFrames* pFrames)
}
else
{
if (pnomaskhash[ti] == pFrames[ti].hashcode)
if (pnomaskhash[tj] == pFrames[ti].hashcode)
{
pFrames[ti].active = FALSE;
nfrremsame++;
Expand Down Expand Up @@ -4002,7 +4002,7 @@ bool CopyTXTFrames2Frame(UINT nFrames, sFrames* pFrames)
{
for (UINT ti = 0; ti < MAX_DYNA_SETS_PER_FRAME; ti++)
{
for (UINT tk = 0; tk < MycRom.noColors; tk++) MycRom.Dyna4Cols[tj * MAX_DYNA_SETS_PER_FRAME * MycRom.noColors + ti * MycRom.noColors + tk] = (UINT8)(ti * MycRom.noColors + tk);
for (UINT tk = 0; tk < MycRom.noColors; tk++) MycRom.Dyna4Cols[tj * MAX_DYNA_SETS_PER_FRAME * MycRom.noColors + ti * MycRom.noColors + tk] = (UINT8)((ti * MycRom.noColors + tk) % 64);
}
}
MycRom.FrameSprites = (UINT8*)malloc(nF * MAX_SPRITES_PER_FRAME);
Expand Down

0 comments on commit 59e8e74

Please sign in to comment.