This commit is contained in:
parent
db91f241c9
commit
cd67596117
3 changed files with 46 additions and 9 deletions
|
@ -289,6 +289,14 @@ int i,ListSize=AnimList.size();
|
|||
//***************************************************************************
|
||||
void CMkActor::MakePsxGfx(sBmp &Bmp)
|
||||
{
|
||||
// capture blank frames
|
||||
if (Bmp.Frm.IsBlank())
|
||||
{
|
||||
Bmp.Psx=0;
|
||||
Bmp.PsxSize=0;
|
||||
return;
|
||||
}
|
||||
|
||||
// Copied from SprSet
|
||||
int nfW,nfH,nfLineWidthBytes,nfAreaBytes;
|
||||
Frame Frm=Bmp.Frm;
|
||||
|
@ -393,7 +401,7 @@ u8 *RGB0,*RGB1;
|
|||
}
|
||||
|
||||
//***************************************************************************
|
||||
void CMkActor::CheckAndShrinkFrame(sBmp &Bmp)
|
||||
void CMkActor::CheckAndShrinkFrame(sBmp &Bmp,const char *FrameName)
|
||||
{
|
||||
// Check Colors
|
||||
int ColorCount=Bmp.Frm.GetNumOfCols();
|
||||
|
@ -401,6 +409,24 @@ int ColorCount=Bmp.Frm.GetNumOfCols();
|
|||
{
|
||||
GObject::Error(ERR_FATAL,"%s has %i colors.\n",Name,ColorCount);
|
||||
}
|
||||
// Check Palette
|
||||
if (BmpList.size())
|
||||
{
|
||||
Palette &BasePal=BmpList[0].Frm.GetPal();
|
||||
Palette &ThisPal=Bmp.Frm.GetPal();
|
||||
int Count=__min(BasePal.GetNumOfCols(),ThisPal.GetNumOfCols());
|
||||
|
||||
for (int p=1;p<Count; p++)
|
||||
{
|
||||
if (BasePal[p].GetR()!=ThisPal[p].GetR() ||
|
||||
BasePal[p].GetG()!=ThisPal[p].GetG() ||
|
||||
BasePal[p].GetB()!=ThisPal[p].GetB())
|
||||
{
|
||||
GObject::Error(ERR_WARNING,"Palette MisMatch : %s\n",FrameName);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Bmp.OrigW=Bmp.Frm.GetWidth();
|
||||
Bmp.OrigH=Bmp.Frm.GetHeight();
|
||||
|
@ -411,7 +437,7 @@ Rect BBox;
|
|||
Bmp.Frm.Crop(BBox);
|
||||
Bmp.CrossHairX=BBox.X-(Bmp.OrigW/2);//+)/2;
|
||||
Bmp.CrossHairY=-(Bmp.OrigH-BBox.Y);
|
||||
// printf("%i %i \n",Bmp.CrossHairX,Bmp.CrossHairY);
|
||||
|
||||
}
|
||||
|
||||
//***************************************************************************
|
||||
|
@ -427,7 +453,7 @@ sBmp NewBmp;
|
|||
NewBmp.Pak=0;
|
||||
NewBmp.Psx=0;
|
||||
|
||||
CheckAndShrinkFrame(NewBmp);
|
||||
CheckAndShrinkFrame(NewBmp,ThisFrame.Filename);
|
||||
ThisFrame.XOfs=NewBmp.CrossHairX;
|
||||
ThisFrame.YOfs=NewBmp.CrossHairY;
|
||||
|
||||
|
@ -489,10 +515,18 @@ int i,ListSize=BmpList.size();
|
|||
sBmp &ThisBmp=BmpList[i];
|
||||
|
||||
printf("%s - Processing Frame %2d\\%2d\r",Name,i+1,ListSize);
|
||||
ThisBmp.PakSize=PAK_findPakSize(ThisBmp.Psx,ThisBmp.PsxSize);
|
||||
ThisBmp.Pak=(u8*)malloc(ThisBmp.PakSize);
|
||||
ASSERT(ThisBmp.Pak);
|
||||
PAK_doPak(ThisBmp.Pak,ThisBmp.Psx,ThisBmp.PsxSize);
|
||||
if (ThisBmp.Psx)
|
||||
{
|
||||
ThisBmp.PakSize=PAK_findPakSize(ThisBmp.Psx,ThisBmp.PsxSize);
|
||||
ThisBmp.Pak=(u8*)malloc(ThisBmp.PakSize);
|
||||
ASSERT(ThisBmp.Pak);
|
||||
PAK_doPak(ThisBmp.Pak,ThisBmp.Psx,ThisBmp.PsxSize);
|
||||
}
|
||||
else
|
||||
{ // Blank Frame
|
||||
ThisBmp.Pak=0;
|
||||
ThisBmp.PakSize=0;
|
||||
}
|
||||
|
||||
TotalIn+=ThisBmp.PsxSize;
|
||||
TotalOut+=ThisBmp.PakSize;
|
||||
|
|
|
@ -55,11 +55,12 @@ private:
|
|||
|
||||
void LoadFrameList();
|
||||
void LoadBmp(sFrame &ThisFrame);
|
||||
void CheckAndShrinkFrame(sBmp &Bmp);
|
||||
void CheckAndShrinkFrame(sBmp &Bmp,const char *Filename);
|
||||
bool IsImageSame(sBmp &Bmp0,sBmp &Bmp1);
|
||||
void MakePsxGfx(sBmp &Bmp);
|
||||
void ProcessFrames();
|
||||
|
||||
|
||||
int WritePalette();
|
||||
int WriteAnimList();
|
||||
int WriteFrameList();
|
||||
|
|
|
@ -556,6 +556,8 @@ sSpriteAnim *ThisAnim=SpriteBank->AnimList+Anim;
|
|||
CurrentFrame=&ThisAnim->Anim[Frame];
|
||||
CurrentFrameGfx=&SpriteBank->FrameList[CurrentFrame->FrameIdx];
|
||||
|
||||
if (!CurrentFrameGfx->PAKSpr) return(0); // Blank Frame
|
||||
|
||||
// Try to find Pre-cached sprite
|
||||
ThisNode=0;
|
||||
// Check Local Cache
|
||||
|
|
Loading…
Add table
Reference in a new issue