This commit is contained in:
Daveo 2001-08-03 00:07:59 +00:00
parent 3f599c810a
commit fc6f48024a
2 changed files with 20 additions and 68 deletions

View File

@ -30,7 +30,7 @@ GString SpritePath;
GString OutPath; GString OutPath;
GString IncludePath; GString IncludePath;
float Aspect=512.0f/320.0f; float Aspect=512.0f/(320.0f+128.0f);
//*************************************************************************** //***************************************************************************
char * CycleCommands(char *String,int Num) char * CycleCommands(char *String,int Num)
@ -507,15 +507,16 @@ int ColorCount=Bmp.Frm.GetNumOfCols();
Bmp.OrigW=Bmp.Frm.GetWidth(); Bmp.OrigW=Bmp.Frm.GetWidth();
Bmp.OrigH=Bmp.Frm.GetHeight(); Bmp.OrigH=Bmp.Frm.GetHeight();
Rect BBox; Rect &BBox=Bmp.BBox;
BBox=Bmp.Frm.FindBoundingRect(); BBox=Bmp.Frm.FindBoundingRect();
BBox.W=GU_AlignVal(BBox.W,4); BBox.W=GU_AlignVal(BBox.W,4);
Bmp.Frm.Crop(BBox); Bmp.Frm.Crop(BBox);
Bmp.CrossHairX=BBox.X-(Bmp.OrigW/2);//+)/2; Bmp.CrossHairX=BBox.X-(Bmp.OrigW/2);
Bmp.CrossHairY=-(Bmp.OrigH-BBox.Y); Bmp.CrossHairY=BBox.Y-Bmp.OrigH;
} }
//***************************************************************************
//*************************************************************************** //***************************************************************************
void CMkActor::LoadBmp(sFrame &ThisFrame) void CMkActor::LoadBmp(sFrame &ThisFrame)
{ {
@ -530,8 +531,9 @@ sBmp NewBmp;
NewBmp.Psx=0; NewBmp.Psx=0;
CheckAndShrinkFrame(NewBmp,ThisFrame.Filename); CheckAndShrinkFrame(NewBmp,ThisFrame.Filename);
ThisFrame.XOfs=-80; ThisFrame.XOfs=NewBmp.CrossHairX;
ThisFrame.YOfs=-80; ThisFrame.YOfs=NewBmp.CrossHairY;
// Check Dups // Check Dups
int Idx=FindDup(NewBmp); int Idx=FindDup(NewBmp);
@ -539,66 +541,20 @@ int Idx=FindDup(NewBmp);
{ {
DupCount++; DupCount++;
ThisFrame.FrameIdx=Idx; ThisFrame.FrameIdx=Idx;
sBmp &DupBmp=BmpList[Idx];
ThisFrame.XOfs=DupBmp.CrossHairX;
ThisFrame.YOfs=DupBmp.CrossHairY;
return; 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 // Its unique, add to list
BmpList.push_back(NewBmp); BmpList.push_back(NewBmp);
MakePsxGfx(BmpList[BmpListSize]); MakePsxGfx(BmpList[BmpListSize]);
ThisFrame.FrameIdx=BmpListSize; ThisFrame.FrameIdx=BmpListSize;
// copy XY Info
ThisFrame.XOfs=NewBmp.CrossHairX;
ThisFrame.YOfs=NewBmp.CrossHairY;
#if _DEBUG && defined(OutputTGA) #if _DEBUG && defined(OutputTGA)
void WriteTGA(GString Name,Frame Frm); void WriteTGA(GString Name,Frame Frm);
WriteTGA(Name,NewBmp.Frm); WriteTGA(Name,NewBmp.Frm);
#endif #endif
}
}
//*************************************************************************** //***************************************************************************
void WriteTGA(GString Name,Frame Frm) void WriteTGA(GString Name,Frame Frm)
@ -795,21 +751,17 @@ vector<sSpriteFrameGfx> Hdrs;
Hdrs[i].W=ThisBmp.Frm.GetWidth(); Hdrs[i].W=ThisBmp.Frm.GetWidth();
Hdrs[i].H=ThisBmp.Frm.GetHeight(); Hdrs[i].H=ThisBmp.Frm.GetHeight();
// aspect // aspect
float aW=Hdrs[i].W*Aspect; int X0,X1;
int dW=(int)aW-Hdrs[i].W; int W0,W1;
int X0=dW/2;
int X1=dW-X0; W0=(ThisBmp.OrigW/2)-ThisBmp.BBox.X;//W+ThisBmp.CrossHairX;
W1=ThisBmp.Frm.GetWidth()-W0;
int W=ThisBmp.Frm.GetWidth(); X0=W0*(Aspect/2);
int W0=W+ThisBmp.CrossHairX; X1=W1*(Aspect/2);
int W1=W-W0;
// printf("%i %i %i \n",W,W0,W1);
X0=W0*Aspect; Hdrs[i].AspectX0=X0;
X1=W1*Aspect; Hdrs[i].AspectX1=X1;
Hdrs[i].AspectX0=X0-W0;
Hdrs[i].AspectX1=X1-W1;
// printf("%i %i %i\n",Hdrs[i].W,X0,X1); // printf("%i %i %i\n",Hdrs[i].W,X0,X1);

View File

@ -25,7 +25,7 @@ struct sBmp
{ {
Frame Frm; Frame Frm;
int OrigW,OrigH; int OrigW,OrigH;
// int ChkR,ChkG,ChkB; Rect BBox;
u8 *RGB; u8 *RGB;
u8 *Psx; u8 *Psx;
u8 *Pak; u8 *Pak;