This commit is contained in:
parent
5b4d988629
commit
f8cc72ac83
4 changed files with 73 additions and 103 deletions
|
@ -227,16 +227,9 @@ char AnimName[256];
|
||||||
{
|
{
|
||||||
sAnim &ThisAnim=AnimList[i];
|
sAnim &ThisAnim=AnimList[i];
|
||||||
sprintf(AnimName,"%s",InAnimList[i]);
|
sprintf(AnimName,"%s",InAnimList[i]);
|
||||||
if (AnimName[0]=='~')
|
|
||||||
{ // VRam Sprite
|
ThisAnim.Name=&AnimName[0];
|
||||||
ThisAnim.Name=&AnimName[1];
|
|
||||||
ThisAnim.VRamFlag=true;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{ // PAK Sprite
|
|
||||||
ThisAnim.Name=&AnimName[0];
|
|
||||||
ThisAnim.VRamFlag=false;
|
|
||||||
}
|
|
||||||
FindFrames(ThisAnim);
|
FindFrames(ThisAnim);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -285,18 +278,13 @@ int i,ListSize=AnimList.size();
|
||||||
int FrameCount=ThisAnim.Frames.size();
|
int FrameCount=ThisAnim.Frames.size();
|
||||||
for (int f=0; f<FrameCount; f++)
|
for (int f=0; f<FrameCount; f++)
|
||||||
{
|
{
|
||||||
printf("%s - Load Anim %2d/%2d\tFrame %2d/%2d\r",Name,i+1,ListSize,f,FrameCount);
|
printf("%s - Load Anim %2d/%2d\tFrame %2d/%2d \r",Name,i+1,ListSize,f,FrameCount);
|
||||||
LoadFrame(ThisAnim.Frames[f],ThisAnim.VRamFlag);
|
LoadBmp(ThisAnim.Frames[f]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
printf("\t\t\t\t\t\t\r");
|
printf("\t\t\t\t\t\t\r");
|
||||||
}
|
}
|
||||||
|
|
||||||
//***************************************************************************
|
|
||||||
void CMkActor::LoadFrame(sFrame &ThisFrame,bool VRamFlag)
|
|
||||||
{
|
|
||||||
ThisFrame.FrameIdx=LoadBmp(ThisFrame.Filename,VRamFlag);
|
|
||||||
}
|
|
||||||
|
|
||||||
//***************************************************************************
|
//***************************************************************************
|
||||||
void CMkActor::MakePsxGfx(sBmp &Bmp)
|
void CMkActor::MakePsxGfx(sBmp &Bmp)
|
||||||
|
@ -427,9 +415,9 @@ Rect BBox;
|
||||||
}
|
}
|
||||||
|
|
||||||
//***************************************************************************
|
//***************************************************************************
|
||||||
int CMkActor::LoadBmp(GString &Name,bool VRamFlag)
|
void CMkActor::LoadBmp(sFrame &ThisFrame)
|
||||||
{
|
{
|
||||||
GString Filename=SpriteDir+Name;
|
GString Filename=SpriteDir+ThisFrame.Filename;
|
||||||
int BmpListSize=BmpList.size();
|
int BmpListSize=BmpList.size();
|
||||||
sBmp NewBmp;
|
sBmp NewBmp;
|
||||||
|
|
||||||
|
@ -438,14 +426,10 @@ sBmp NewBmp;
|
||||||
NewBmp.RGB=0;
|
NewBmp.RGB=0;
|
||||||
NewBmp.Pak=0;
|
NewBmp.Pak=0;
|
||||||
NewBmp.Psx=0;
|
NewBmp.Psx=0;
|
||||||
NewBmp.VRamFlag=VRamFlag;
|
|
||||||
|
|
||||||
CheckAndShrinkFrame(NewBmp);
|
CheckAndShrinkFrame(NewBmp);
|
||||||
if (BmpListSize==0)
|
ThisFrame.XOfs=NewBmp.CrossHairX;
|
||||||
{ // Calc HotSpot based on first frame
|
ThisFrame.YOfs=NewBmp.CrossHairY;
|
||||||
printf("!");
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
// Check Dups
|
// Check Dups
|
||||||
int Idx=FindDup(NewBmp);
|
int Idx=FindDup(NewBmp);
|
||||||
|
@ -453,7 +437,8 @@ int Idx=FindDup(NewBmp);
|
||||||
if (Idx!=-1)
|
if (Idx!=-1)
|
||||||
{
|
{
|
||||||
DupCount++;
|
DupCount++;
|
||||||
return(Idx);
|
ThisFrame.FrameIdx=Idx;
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
// Its unique, add to list
|
// Its unique, add to list
|
||||||
BmpList.push_back(NewBmp);
|
BmpList.push_back(NewBmp);
|
||||||
|
@ -465,7 +450,7 @@ void WriteTGA(GString Name,Frame Frm);
|
||||||
WriteTGA(Name,NewBmp.Frm);
|
WriteTGA(Name,NewBmp.Frm);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return(BmpListSize);
|
ThisFrame.FrameIdx=BmpListSize;
|
||||||
}
|
}
|
||||||
|
|
||||||
//***************************************************************************
|
//***************************************************************************
|
||||||
|
@ -535,7 +520,7 @@ GString OutName=OutFile+".SBK";
|
||||||
FileHdr.AnimList=(sSpriteAnim*)WriteAnimList();
|
FileHdr.AnimList=(sSpriteAnim*)WriteAnimList();
|
||||||
PadFile(File);
|
PadFile(File);
|
||||||
// Write FrameList
|
// Write FrameList
|
||||||
FileHdr.FrameList=(sSpriteFrame*)WriteFrameList();
|
FileHdr.FrameList=(sSpriteFrameGfx*)WriteFrameList();
|
||||||
// PadFile(File);
|
// PadFile(File);
|
||||||
|
|
||||||
// Rewrite Header
|
// Rewrite Header
|
||||||
|
@ -594,13 +579,17 @@ vector<sSpriteAnim> Hdrs;
|
||||||
int f,FrameCount=ThisAnim.Frames.size();
|
int f,FrameCount=ThisAnim.Frames.size();
|
||||||
|
|
||||||
Hdrs[i].FrameCount=FrameCount;
|
Hdrs[i].FrameCount=FrameCount;
|
||||||
Hdrs[i].Anim=(u16*)ftell(File);
|
Hdrs[i].Anim=(sSpriteFrame*)ftell(File);
|
||||||
|
|
||||||
for (f=0; f<FrameCount; f++)
|
for (f=0; f<FrameCount; f++)
|
||||||
{
|
{
|
||||||
sFrame &ThisFrame=ThisAnim.Frames[f];
|
sFrame &ThisFrame=ThisAnim.Frames[f];
|
||||||
u16 FrameNo=ThisFrame.FrameIdx;
|
sSpriteFrame OutFrame;
|
||||||
fwrite(&FrameNo,1,sizeof(u16),File);
|
|
||||||
|
OutFrame.FrameIdx=ThisFrame.FrameIdx;
|
||||||
|
OutFrame.XOfs=ThisFrame.XOfs;
|
||||||
|
OutFrame.YOfs=ThisFrame.YOfs;
|
||||||
|
fwrite(&OutFrame,1,sizeof(sSpriteFrame),File);
|
||||||
}
|
}
|
||||||
PadFile(File);
|
PadFile(File);
|
||||||
|
|
||||||
|
@ -623,7 +612,7 @@ int CMkActor::WriteFrameList()
|
||||||
{
|
{
|
||||||
int Pos=ftell(File);
|
int Pos=ftell(File);
|
||||||
int i,FrameCount=BmpList.size();
|
int i,FrameCount=BmpList.size();
|
||||||
vector<sSpriteFrame> Hdrs;
|
vector<sSpriteFrameGfx> Hdrs;
|
||||||
|
|
||||||
FileHdr.MaxW=MaxW;
|
FileHdr.MaxW=MaxW;
|
||||||
FileHdr.MaxH=MaxH;
|
FileHdr.MaxH=MaxH;
|
||||||
|
@ -631,9 +620,10 @@ vector<sSpriteFrame> Hdrs;
|
||||||
|
|
||||||
// Write Dummy Hdrs
|
// Write Dummy Hdrs
|
||||||
Hdrs.resize(FrameCount);
|
Hdrs.resize(FrameCount);
|
||||||
|
|
||||||
for (i=0; i<FrameCount; i++)
|
for (i=0; i<FrameCount; i++)
|
||||||
{
|
{
|
||||||
fwrite(&Hdrs[i],1,sizeof(sSpriteFrame),File);
|
fwrite(&Hdrs[i],1,sizeof(sSpriteFrameGfx),File);
|
||||||
}
|
}
|
||||||
PadFile(File);
|
PadFile(File);
|
||||||
|
|
||||||
|
@ -641,31 +631,20 @@ vector<sSpriteFrame> Hdrs;
|
||||||
for (i=0; i<FrameCount; i++)
|
for (i=0; i<FrameCount; i++)
|
||||||
{
|
{
|
||||||
sBmp &ThisBmp=BmpList[i];
|
sBmp &ThisBmp=BmpList[i];
|
||||||
if (ThisBmp.VRamFlag)
|
|
||||||
{ // VRam
|
|
||||||
GObject::Error(ERR_FATAL,"VRam sprites not supported yet (%s)\n",ThisBmp.Frm.GetName);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{ // Pak
|
|
||||||
int XOfs=ThisBmp.CrossHairX;
|
|
||||||
int YOfs=ThisBmp.CrossHairY;
|
|
||||||
|
|
||||||
Hdrs[i].PAKSpr=(u8*)ftell(File);
|
|
||||||
Hdrs[i].XOfs=XOfs;
|
|
||||||
Hdrs[i].YOfs=YOfs;
|
|
||||||
Hdrs[i].W=ThisBmp.Frm.GetWidth();
|
|
||||||
Hdrs[i].H=ThisBmp.Frm.GetHeight();
|
|
||||||
fwrite(ThisBmp.Pak,1,ThisBmp.PakSize,File);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
Hdrs[i].PAKSpr=(u8*)ftell(File);
|
||||||
|
// Hdrs[i].XOfs=ThisBmp.CrossHairX;
|
||||||
|
// Hdrs[i].YOfs=ThisBmp.CrossHairY;
|
||||||
|
Hdrs[i].W=ThisBmp.Frm.GetWidth();
|
||||||
|
Hdrs[i].H=ThisBmp.Frm.GetHeight();
|
||||||
|
fwrite(ThisBmp.Pak,1,ThisBmp.PakSize,File);
|
||||||
}
|
}
|
||||||
// ReWrite Headers
|
// ReWrite Headers
|
||||||
int SavePos=ftell(File);
|
int SavePos=ftell(File);
|
||||||
fseek(File,Pos,SEEK_SET);
|
fseek(File,Pos,SEEK_SET);
|
||||||
for (i=0; i<FrameCount; i++)
|
for (i=0; i<FrameCount; i++)
|
||||||
{
|
{
|
||||||
fwrite(&Hdrs[i],1,sizeof(sSpriteFrame),File);
|
fwrite(&Hdrs[i],1,sizeof(sSpriteFrameGfx),File);
|
||||||
}
|
}
|
||||||
fseek(File,SavePos,SEEK_SET);
|
fseek(File,SavePos,SEEK_SET);
|
||||||
|
|
||||||
|
|
|
@ -10,6 +10,7 @@ struct sFrame
|
||||||
{
|
{
|
||||||
GString Filename;
|
GString Filename;
|
||||||
int FrameIdx;
|
int FrameIdx;
|
||||||
|
int XOfs,YOfs;
|
||||||
};
|
};
|
||||||
|
|
||||||
//***************************************************************************
|
//***************************************************************************
|
||||||
|
@ -17,7 +18,6 @@ struct sAnim
|
||||||
{
|
{
|
||||||
GString Name;
|
GString Name;
|
||||||
vector<sFrame> Frames;
|
vector<sFrame> Frames;
|
||||||
bool VRamFlag;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
//***************************************************************************
|
//***************************************************************************
|
||||||
|
@ -31,7 +31,6 @@ struct sBmp
|
||||||
u8 *Pak;
|
u8 *Pak;
|
||||||
int PsxSize;
|
int PsxSize;
|
||||||
int PakSize;
|
int PakSize;
|
||||||
bool VRamFlag;
|
|
||||||
int CrossHairX,CrossHairY;
|
int CrossHairX,CrossHairY;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -55,8 +54,7 @@ private:
|
||||||
int FindDup(sBmp &Frm);
|
int FindDup(sBmp &Frm);
|
||||||
|
|
||||||
void LoadFrameList();
|
void LoadFrameList();
|
||||||
void LoadFrame(sFrame &ThisFrame,bool VRamFlag);
|
void LoadBmp(sFrame &ThisFrame);
|
||||||
int LoadBmp(GString &Name,bool VRamFlag);
|
|
||||||
void CheckAndShrinkFrame(sBmp &Bmp);
|
void CheckAndShrinkFrame(sBmp &Bmp);
|
||||||
bool IsImageSame(sBmp &Bmp0,sBmp &Bmp1);
|
bool IsImageSame(sBmp &Bmp0,sBmp &Bmp1);
|
||||||
void MakePsxGfx(sBmp &Bmp);
|
void MakePsxGfx(sBmp &Bmp);
|
||||||
|
|
|
@ -429,22 +429,22 @@ int TotalFrames=0;
|
||||||
|
|
||||||
sSpriteAnimBank *Spr=(sSpriteAnimBank*)CFileIO::loadFile(Filename,"ActorGfx");
|
sSpriteAnimBank *Spr=(sSpriteAnimBank*)CFileIO::loadFile(Filename,"ActorGfx");
|
||||||
|
|
||||||
Spr->AnimList=(sSpriteAnim*) MakePtr(Spr,(int)Spr->AnimList);
|
Spr->AnimList=(sSpriteAnim*) MakePtr(Spr,(int)Spr->AnimList);
|
||||||
Spr->FrameList=(sSpriteFrame*) MakePtr(Spr,(int)Spr->FrameList);
|
Spr->FrameList=(sSpriteFrameGfx*) MakePtr(Spr,(int)Spr->FrameList);
|
||||||
Spr->Palette=(u8*) MakePtr(Spr,(int)Spr->Palette);
|
Spr->Palette=(u8*) MakePtr(Spr,(int)Spr->Palette);
|
||||||
|
|
||||||
// FixUp AnimList
|
// FixUp AnimList
|
||||||
for (i=0; i<Spr->AnimCount; i++)
|
for (i=0; i<Spr->AnimCount; i++)
|
||||||
{
|
{
|
||||||
sSpriteAnim *ThisAnim=&Spr->AnimList[i];
|
sSpriteAnim *ThisAnim=&Spr->AnimList[i];
|
||||||
ThisAnim->Anim=(u16*) MakePtr(Spr,(int)ThisAnim->Anim);
|
ThisAnim->Anim=(sSpriteFrame*) MakePtr(Spr,(int)ThisAnim->Anim);
|
||||||
TotalFrames+=ThisAnim->FrameCount;
|
TotalFrames+=ThisAnim->FrameCount;
|
||||||
}
|
}
|
||||||
|
|
||||||
// FixUp FrameList
|
// FixUp FrameList
|
||||||
for (i=0; i<Spr->FrameCount; i++)
|
for (i=0; i<Spr->FrameCount; i++)
|
||||||
{
|
{
|
||||||
sSpriteFrame *ThisFrame=&Spr->FrameList[i];
|
sSpriteFrameGfx *ThisFrame=&Spr->FrameList[i];
|
||||||
ThisFrame->PAKSpr=(u8*) MakePtr(Spr,(int)ThisFrame->PAKSpr);
|
ThisFrame->PAKSpr=(u8*) MakePtr(Spr,(int)ThisFrame->PAKSpr);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -531,6 +531,7 @@ CActorGfx::CActorGfx(sActorPool *ThisActor)
|
||||||
ShadowYOfs=DEF_SHADOW_OFS;
|
ShadowYOfs=DEF_SHADOW_OFS;
|
||||||
ShadowFlag=false;
|
ShadowFlag=false;
|
||||||
OtPos=OTPOS__ACTOR_POS;
|
OtPos=OTPOS__ACTOR_POS;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
@ -538,30 +539,26 @@ CActorGfx::~CActorGfx()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
/*****************************************************************************/
|
|
||||||
sSpriteFrame *CActorGfx::GetFrame(int Anim,int Frame)
|
|
||||||
{
|
|
||||||
|
|
||||||
sSpriteAnim *ThisAnim=PoolEntry->ActorGfx->AnimList+Anim;
|
|
||||||
u16 ThisFrame=ThisAnim->Anim[Frame];
|
|
||||||
|
|
||||||
return(PoolEntry->ActorGfx->FrameList+ThisFrame);
|
|
||||||
}
|
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
POLY_FT4 *CActorGfx::Render(DVECTOR &Pos,int Anim,int Frame,bool XFlip,bool YFlip)
|
POLY_FT4 *CActorGfx::Render(DVECTOR &Pos,int Anim,int Frame,bool XFlip,bool YFlip)
|
||||||
{
|
{
|
||||||
sPoolNode *ThisNode,*FindNode;
|
sPoolNode *ThisNode,*FindNode;
|
||||||
POLY_FT4 *Ft4;
|
POLY_FT4 *Ft4;
|
||||||
|
|
||||||
CurrentFrame=GetFrame(Anim,Frame);
|
// Calc Frame Ptrs
|
||||||
ThisNode=0;
|
sSpriteAnimBank *SpriteBank=PoolEntry->ActorGfx;
|
||||||
|
sSpriteAnim *ThisAnim=SpriteBank->AnimList+Anim;
|
||||||
|
|
||||||
|
CurrentFrame=&ThisAnim->Anim[Frame];
|
||||||
|
CurrentFrameGfx=&SpriteBank->FrameList[CurrentFrame->FrameIdx];
|
||||||
|
|
||||||
|
// Try to find Pre-cached sprite
|
||||||
|
ThisNode=0;
|
||||||
// Check Local Cache
|
// Check Local Cache
|
||||||
FindNode=PoolEntry->LocalCache.Head;
|
FindNode=PoolEntry->LocalCache.Head;
|
||||||
while (FindNode)
|
while (FindNode)
|
||||||
{ // Try local Cache (From Head forward)
|
{ // Try local Cache (From Head forward)
|
||||||
if (FindNode->Frame==CurrentFrame)
|
if (FindNode->Frame==CurrentFrameGfx)
|
||||||
{
|
{
|
||||||
ThisNode=FindNode;
|
ThisNode=FindNode;
|
||||||
break;
|
break;
|
||||||
|
@ -575,7 +572,7 @@ POLY_FT4 *Ft4;
|
||||||
FindNode=PoolEntry->LastCache.Head;
|
FindNode=PoolEntry->LastCache.Head;
|
||||||
while (FindNode)
|
while (FindNode)
|
||||||
{
|
{
|
||||||
if (FindNode->Frame==CurrentFrame)
|
if (FindNode->Frame==CurrentFrameGfx)
|
||||||
{
|
{
|
||||||
ThisNode=FindNode;
|
ThisNode=FindNode;
|
||||||
CActorCache::RemoveNode(ThisNode,PoolEntry->GlobalCache);
|
CActorCache::RemoveNode(ThisNode,PoolEntry->GlobalCache);
|
||||||
|
@ -588,13 +585,13 @@ POLY_FT4 *Ft4;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Check Global Cache
|
// Check Global Cache (From Tail back)
|
||||||
if (!ThisNode)
|
if (!ThisNode)
|
||||||
{
|
{
|
||||||
FindNode=PoolEntry->GlobalCache->Tail;
|
FindNode=PoolEntry->GlobalCache->Tail;
|
||||||
while (FindNode)
|
while (FindNode)
|
||||||
{
|
{
|
||||||
if (FindNode->Frame==CurrentFrame)
|
if (FindNode->Frame==CurrentFrameGfx)
|
||||||
{
|
{
|
||||||
ThisNode=FindNode;
|
ThisNode=FindNode;
|
||||||
CActorCache::RemoveNode(ThisNode,PoolEntry->GlobalCache);
|
CActorCache::RemoveNode(ThisNode,PoolEntry->GlobalCache);
|
||||||
|
@ -612,15 +609,16 @@ POLY_FT4 *Ft4;
|
||||||
ASSERT(ThisNode);
|
ASSERT(ThisNode);
|
||||||
CActorCache::AddNode(ThisNode,&PoolEntry->LocalCache);
|
CActorCache::AddNode(ThisNode,&PoolEntry->LocalCache);
|
||||||
|
|
||||||
ThisNode->Frame=CurrentFrame;
|
ThisNode->Frame=CurrentFrameGfx;
|
||||||
|
|
||||||
ThisNode->DstRect.w=CurrentFrame->W>>2; // div 4 cos 16 color
|
ThisNode->DstRect.w=CurrentFrameGfx->W>>2; // div 4 cos 16 color
|
||||||
ThisNode->DstRect.h=CurrentFrame->H;
|
ThisNode->DstRect.h=CurrentFrameGfx->H;
|
||||||
CPakTex::Add(CurrentFrame->PAKSpr,&ThisNode->DstRect);
|
|
||||||
|
CPakTex::Add(CurrentFrameGfx->PAKSpr,&ThisNode->DstRect);
|
||||||
}
|
}
|
||||||
|
|
||||||
Ft4=GetPrimFT4();
|
Ft4=GetPrimFT4();
|
||||||
SetUpFT4(Ft4,CurrentFrame,ThisNode,Pos.vx,Pos.vy,XFlip,YFlip);
|
SetUpFT4(Ft4,ThisNode,Pos.vx,Pos.vy,XFlip,YFlip);
|
||||||
setRGB0(Ft4,128,128,128);
|
setRGB0(Ft4,128,128,128);
|
||||||
Ft4->tpage=ThisNode->TPage;
|
Ft4->tpage=ThisNode->TPage;
|
||||||
Ft4->clut=PoolEntry->ActorGfx->Clut;
|
Ft4->clut=PoolEntry->ActorGfx->Clut;
|
||||||
|
@ -639,11 +637,11 @@ POLY_FT4 *Ft4;
|
||||||
addPrim(OtPtr+OtPos,sFt4);
|
addPrim(OtPtr+OtPos,sFt4);
|
||||||
}
|
}
|
||||||
// Set BBox
|
// Set BBox
|
||||||
int HalfW=CurrentFrame->W>>1;
|
int HalfW=CurrentFrameGfx->W>>1;
|
||||||
|
|
||||||
BBox.XMin=-HalfW+BBOX_ADJ;
|
BBox.XMin=-HalfW+BBOX_ADJ;
|
||||||
BBox.XMax=+HalfW-BBOX_ADJ;
|
BBox.XMax=+HalfW-BBOX_ADJ;
|
||||||
BBox.YMin=-CurrentFrame->H+BBOX_ADJ;
|
BBox.YMin=-CurrentFrameGfx->H+BBOX_ADJ;
|
||||||
BBox.YMax=0-BBOX_ADJ;
|
BBox.YMax=0-BBOX_ADJ;
|
||||||
|
|
||||||
return(Ft4);
|
return(Ft4);
|
||||||
|
@ -660,8 +658,8 @@ sBBox SBox,CBox;
|
||||||
|
|
||||||
Angle&=4095;
|
Angle&=4095;
|
||||||
|
|
||||||
dX=(CurrentFrame->W*XScale)>>(12+1); // +1 for half
|
dX=(CurrentFrameGfx->W*XScale)>>(12+1); // +1 for half
|
||||||
dY=(CurrentFrame->H*YScale)>>(12);
|
dY=(CurrentFrameGfx->H*YScale)>>(12);
|
||||||
|
|
||||||
CosAngle=mcos(Angle);
|
CosAngle=mcos(Angle);
|
||||||
SinAngle=msin(Angle);
|
SinAngle=msin(Angle);
|
||||||
|
@ -713,25 +711,20 @@ int YMin,YMax;
|
||||||
Ft4->x2=Pos.vx+x2; Ft4->y2=Pos.vy+y2;
|
Ft4->x2=Pos.vx+x2; Ft4->y2=Pos.vy+y2;
|
||||||
Ft4->x3=Pos.vx+x3; Ft4->y3=Pos.vy+y3;
|
Ft4->x3=Pos.vx+x3; Ft4->y3=Pos.vy+y3;
|
||||||
|
|
||||||
// Ft4->x0=Pos.vx+CBox.XMin-SBox.YMin; Ft4->y0=Pos.vy+SBox.XMin+CBox.YMin;
|
|
||||||
// Ft4->x1=Pos.vx+CBox.XMax-SBox.YMin; Ft4->y1=Pos.vy+SBox.XMax+CBox.YMin;
|
|
||||||
// Ft4->x2=Pos.vx+CBox.XMin+SBox.YMax; Ft4->y2=Pos.vy+SBox.XMin-CBox.YMax;
|
|
||||||
// Ft4->x3=Pos.vx+CBox.XMax+SBox.YMax; Ft4->y3=Pos.vy+SBox.XMax-CBox.YMax;
|
|
||||||
|
|
||||||
return(Ft4);
|
return(Ft4);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
void CActorGfx::SetUpFT4(POLY_FT4 *Ft4,sSpriteFrame *Frame,sPoolNode *Node,int X,int Y,bool XFlip,bool YFlip)
|
void CActorGfx::SetUpFT4(POLY_FT4 *Ft4,sPoolNode *Node,int X,int Y,bool XFlip,bool YFlip)
|
||||||
{
|
{
|
||||||
u8 W=Frame->W;
|
u8 W=CurrentFrameGfx->W;
|
||||||
u8 H=Frame->H;
|
u8 H=CurrentFrameGfx->H;
|
||||||
u8 U=Node->U;
|
u8 U=Node->U;
|
||||||
u8 V=Node->V;
|
u8 V=Node->V;
|
||||||
|
|
||||||
if (XFlip)
|
if (XFlip)
|
||||||
{
|
{
|
||||||
X-=Frame->XOfs;
|
X-=CurrentFrame->XOfs;
|
||||||
X-=W;
|
X-=W;
|
||||||
Ft4->u0=U+W-1;
|
Ft4->u0=U+W-1;
|
||||||
Ft4->u1=U;//-1;
|
Ft4->u1=U;//-1;
|
||||||
|
@ -741,7 +734,7 @@ u8 V=Node->V;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
X+=Frame->XOfs;
|
X+=CurrentFrame->XOfs;
|
||||||
Ft4->u0=U;
|
Ft4->u0=U;
|
||||||
Ft4->u1=U+W-1;
|
Ft4->u1=U+W-1;
|
||||||
Ft4->u2=U;
|
Ft4->u2=U;
|
||||||
|
@ -751,7 +744,7 @@ u8 V=Node->V;
|
||||||
|
|
||||||
if (YFlip)
|
if (YFlip)
|
||||||
{
|
{
|
||||||
Y-=Frame->YOfs;
|
Y-=CurrentFrame->YOfs;
|
||||||
Y-=H;
|
Y-=H;
|
||||||
Ft4->v0=V+H-1;
|
Ft4->v0=V+H-1;
|
||||||
Ft4->v1=V+H-1;
|
Ft4->v1=V+H-1;
|
||||||
|
@ -760,7 +753,7 @@ u8 V=Node->V;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
Y+=Frame->YOfs;
|
Y+=CurrentFrame->YOfs;
|
||||||
Ft4->v0=V;
|
Ft4->v0=V;
|
||||||
Ft4->v1=V;
|
Ft4->v1=V;
|
||||||
Ft4->v2=V+H-1;
|
Ft4->v2=V+H-1;
|
||||||
|
@ -796,8 +789,8 @@ void CModelGfx::SetModel(int Type)
|
||||||
}
|
}
|
||||||
|
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
int PXOfs=-16;
|
const int PXOfs=-16;
|
||||||
int PYOfs=-8;
|
const int PYOfs=-8;
|
||||||
|
|
||||||
void CModelGfx::Render(DVECTOR &Pos,SVECTOR *Angle,VECTOR *Scale)
|
void CModelGfx::Render(DVECTOR &Pos,SVECTOR *Angle,VECTOR *Scale)
|
||||||
{
|
{
|
||||||
|
|
|
@ -15,7 +15,7 @@
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
struct sPoolNode
|
struct sPoolNode
|
||||||
{
|
{
|
||||||
sSpriteFrame *Frame;
|
sSpriteFrameGfx *Frame;
|
||||||
RECT DstRect;
|
RECT DstRect;
|
||||||
u16 TPage;
|
u16 TPage;
|
||||||
u8 U,V;
|
u8 U,V;
|
||||||
|
@ -151,11 +151,11 @@ virtual ~CActorGfx();
|
||||||
void SetOtPos(int Ot) {OtPos=Ot;}
|
void SetOtPos(int Ot) {OtPos=Ot;}
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void SetUpFT4(POLY_FT4 *Ft4,sSpriteFrame *Frame,sPoolNode *Node,int X,int Y,bool XFlip,bool YFlip);
|
void SetUpFT4(POLY_FT4 *Ft4,sPoolNode *Node,int X,int Y,bool XFlip,bool YFlip);
|
||||||
sSpriteFrame *GetFrame(int Anim,int Frame);
|
|
||||||
|
|
||||||
sActorPool *PoolEntry;
|
sActorPool *PoolEntry;
|
||||||
sSpriteFrame *CurrentFrame;
|
sSpriteFrame *CurrentFrame;
|
||||||
|
sSpriteFrameGfx *CurrentFrameGfx;
|
||||||
|
|
||||||
sBBox BBox;
|
sBBox BBox;
|
||||||
bool ShadowFlag;
|
bool ShadowFlag;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue