This commit is contained in:
parent
3f599c810a
commit
fc6f48024a
2 changed files with 20 additions and 68 deletions
|
@ -30,7 +30,7 @@ GString SpritePath;
|
|||
GString OutPath;
|
||||
GString IncludePath;
|
||||
|
||||
float Aspect=512.0f/320.0f;
|
||||
float Aspect=512.0f/(320.0f+128.0f);
|
||||
|
||||
//***************************************************************************
|
||||
char * CycleCommands(char *String,int Num)
|
||||
|
@ -507,15 +507,16 @@ int ColorCount=Bmp.Frm.GetNumOfCols();
|
|||
Bmp.OrigW=Bmp.Frm.GetWidth();
|
||||
Bmp.OrigH=Bmp.Frm.GetHeight();
|
||||
|
||||
Rect BBox;
|
||||
Rect &BBox=Bmp.BBox;
|
||||
BBox=Bmp.Frm.FindBoundingRect();
|
||||
BBox.W=GU_AlignVal(BBox.W,4);
|
||||
Bmp.Frm.Crop(BBox);
|
||||
Bmp.CrossHairX=BBox.X-(Bmp.OrigW/2);//+)/2;
|
||||
Bmp.CrossHairY=-(Bmp.OrigH-BBox.Y);
|
||||
Bmp.CrossHairX=BBox.X-(Bmp.OrigW/2);
|
||||
Bmp.CrossHairY=BBox.Y-Bmp.OrigH;
|
||||
|
||||
}
|
||||
|
||||
//***************************************************************************
|
||||
//***************************************************************************
|
||||
void CMkActor::LoadBmp(sFrame &ThisFrame)
|
||||
{
|
||||
|
@ -530,8 +531,9 @@ sBmp NewBmp;
|
|||
NewBmp.Psx=0;
|
||||
|
||||
CheckAndShrinkFrame(NewBmp,ThisFrame.Filename);
|
||||
ThisFrame.XOfs=-80;
|
||||
ThisFrame.YOfs=-80;
|
||||
ThisFrame.XOfs=NewBmp.CrossHairX;
|
||||
ThisFrame.YOfs=NewBmp.CrossHairY;
|
||||
|
||||
// Check Dups
|
||||
int Idx=FindDup(NewBmp);
|
||||
|
||||
|
@ -539,66 +541,20 @@ int Idx=FindDup(NewBmp);
|
|||
{
|
||||
DupCount++;
|
||||
ThisFrame.FrameIdx=Idx;
|
||||
sBmp &DupBmp=BmpList[Idx];
|
||||
ThisFrame.XOfs=DupBmp.CrossHairX;
|
||||
ThisFrame.YOfs=DupBmp.CrossHairY;
|
||||
return;
|
||||
}
|
||||
// Adjust HotSpot for aspect
|
||||
// int NXO=(int)(((float)NewBmp.CrossHairX*Aspect));//+(StepX/2));
|
||||
// NewBmp.CrossHairX=NXO;
|
||||
float hx=NewBmp.CrossHairX;
|
||||
float StepX=Aspect;
|
||||
hx*=StepX;
|
||||
|
||||
// float IncX=(float)NewX;
|
||||
// IncX/=OldX;
|
||||
// hx+=IncX/2;
|
||||
/*
|
||||
float IncX=(float)NewBmp.Frm.GetWidth()*Aspect;
|
||||
IncX/=(float)NewBmp.CrossHairX;//.NewBmp.Frm.GetWidth();
|
||||
hx-=IncX;
|
||||
printf("%i \n",(int)IncX);
|
||||
*/
|
||||
int NX=NewBmp.CrossHairX-(int)hx;
|
||||
// NewBmp.CrossHairX=(int)hx;
|
||||
// NewBmp.CrossHairX-=NX/2;
|
||||
|
||||
/*
|
||||
float StepX=(float)NewX;
|
||||
float StepY=(float)NewY;
|
||||
|
||||
StepX/=OldX;
|
||||
StepY/=OldY;
|
||||
hx*=StepX;
|
||||
hy*=StepY;
|
||||
|
||||
float IncX=(float)NewX;
|
||||
IncX/=OldX;
|
||||
hx+=IncX/2;
|
||||
|
||||
float IncY=(float)NewY;
|
||||
IncY/=OldY;
|
||||
hy+=IncY/2;
|
||||
*/
|
||||
|
||||
|
||||
// Its unique, add to list
|
||||
BmpList.push_back(NewBmp);
|
||||
|
||||
MakePsxGfx(BmpList[BmpListSize]);
|
||||
ThisFrame.FrameIdx=BmpListSize;
|
||||
|
||||
|
||||
// copy XY Info
|
||||
ThisFrame.XOfs=NewBmp.CrossHairX;
|
||||
ThisFrame.YOfs=NewBmp.CrossHairY;
|
||||
|
||||
#if _DEBUG && defined(OutputTGA)
|
||||
void WriteTGA(GString Name,Frame Frm);
|
||||
WriteTGA(Name,NewBmp.Frm);
|
||||
#endif
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
//***************************************************************************
|
||||
void WriteTGA(GString Name,Frame Frm)
|
||||
|
@ -795,21 +751,17 @@ vector<sSpriteFrameGfx> Hdrs;
|
|||
Hdrs[i].W=ThisBmp.Frm.GetWidth();
|
||||
Hdrs[i].H=ThisBmp.Frm.GetHeight();
|
||||
// aspect
|
||||
float aW=Hdrs[i].W*Aspect;
|
||||
int dW=(int)aW-Hdrs[i].W;
|
||||
int X0=dW/2;
|
||||
int X1=dW-X0;
|
||||
int X0,X1;
|
||||
int W0,W1;
|
||||
|
||||
int W=ThisBmp.Frm.GetWidth();
|
||||
int W0=W+ThisBmp.CrossHairX;
|
||||
int W1=W-W0;
|
||||
// printf("%i %i %i \n",W,W0,W1);
|
||||
W0=(ThisBmp.OrigW/2)-ThisBmp.BBox.X;//W+ThisBmp.CrossHairX;
|
||||
W1=ThisBmp.Frm.GetWidth()-W0;
|
||||
|
||||
X0=W0*Aspect;
|
||||
X1=W1*Aspect;
|
||||
X0=W0*(Aspect/2);
|
||||
X1=W1*(Aspect/2);
|
||||
|
||||
Hdrs[i].AspectX0=X0-W0;
|
||||
Hdrs[i].AspectX1=X1-W1;
|
||||
Hdrs[i].AspectX0=X0;
|
||||
Hdrs[i].AspectX1=X1;
|
||||
|
||||
|
||||
// printf("%i %i %i\n",Hdrs[i].W,X0,X1);
|
||||
|
|
|
@ -25,7 +25,7 @@ struct sBmp
|
|||
{
|
||||
Frame Frm;
|
||||
int OrigW,OrigH;
|
||||
// int ChkR,ChkG,ChkB;
|
||||
Rect BBox;
|
||||
u8 *RGB;
|
||||
u8 *Psx;
|
||||
u8 *Pak;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue