This commit is contained in:
parent
2ba61e595c
commit
73c60fbd11
23 changed files with 471 additions and 84 deletions
|
@ -65,8 +65,6 @@ CTexGrab::~CTexGrab()
|
|||
---------------------------------------------------------------------- */
|
||||
void CTexGrab::Process()
|
||||
{
|
||||
SprSet MySprSet;
|
||||
|
||||
MySprSet.setHalfTpage(m_useHalfTpage);
|
||||
MySprSet.setAnimatedHeader(m_AnimatedHeadersOnly);
|
||||
MySprSet.setDontOutputBoxes(m_DontOutputBoxes);
|
||||
|
@ -92,6 +90,7 @@ SprSet MySprSet;
|
|||
if (m_PagePlacements)
|
||||
{
|
||||
MySprSet.Write(m_OutFile,m_PageBase,m_WidthPages,m_HeightPages);
|
||||
MySprSet.CreateTexInfo(TexInfo);
|
||||
|
||||
if (m_OutLbm)
|
||||
MySprSet.WriteLBM(m_OutLbm);
|
||||
|
@ -127,6 +126,14 @@ GString UpperName(Name);
|
|||
Purpose:
|
||||
Params:
|
||||
---------------------------------------------------------------------- */
|
||||
void CTexGrab::AddMemFrame(char *Name,Frame &Frame)
|
||||
{
|
||||
GString UpperName(Name);
|
||||
|
||||
UpperName.Upper();
|
||||
|
||||
MyFiles.AddMemFrame(UpperName,Frame);
|
||||
}
|
||||
|
||||
/*
|
||||
|
||||
|
|
|
@ -40,8 +40,9 @@ RSC=rc.exe
|
|||
# PROP Output_Dir "Release"
|
||||
# PROP Intermediate_Dir "Release"
|
||||
# PROP Target_Dir ""
|
||||
MTL=midl.exe
|
||||
# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_MBCS" /D "_LIB" /YX /FD /c
|
||||
# ADD CPP /nologo /W3 /GX /O2 /I "..\GinLib" /I "..\glib\include" /I "..\glib\include\pc" /D "WIN32" /D "NDEBUG" /D "_MBCS" /D "_LIB" /YX /FD /c
|
||||
# ADD CPP /nologo /W3 /GX /O2 /I "..\glib" /I "..\ginlib" /I "..\maths" /D "WIN32" /D "NDEBUG" /D "_MBCS" /D "_LIB" /YX /FD /c
|
||||
# ADD BASE RSC /l 0x809 /d "NDEBUG"
|
||||
# ADD RSC /l 0x809 /d "NDEBUG"
|
||||
BSC32=bscmake.exe
|
||||
|
@ -63,8 +64,9 @@ LIB32=link.exe -lib
|
|||
# PROP Output_Dir "Debug"
|
||||
# PROP Intermediate_Dir "Debug"
|
||||
# PROP Target_Dir ""
|
||||
MTL=midl.exe
|
||||
# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_MBCS" /D "_LIB" /YX /FD /GZ /c
|
||||
# ADD CPP /nologo /MDd /W3 /Gm /GX /ZI /Od /I "..\GinLib" /I "..\glib\include" /I "..\glib\include\pc" /D "WIN32" /D "_DEBUG" /D "_MBCS" /D "_LIB" /FR /YX /FD /GZ /c
|
||||
# ADD CPP /nologo /MDd /W3 /Gm /GX /ZI /Od /I "..\glib" /I "..\ginlib" /I "..\maths" /D "WIN32" /D "_DEBUG" /D "_MBCS" /D "_LIB" /FR /YX /FD /GZ /c
|
||||
# ADD BASE RSC /l 0x809 /d "_DEBUG"
|
||||
# ADD RSC /l 0x809 /d "_DEBUG"
|
||||
BSC32=bscmake.exe
|
||||
|
|
|
@ -56,6 +56,8 @@ public:
|
|||
~CTexGrab();
|
||||
|
||||
void AddFile(char *Name);
|
||||
void AddMemFrame(char *Name,Frame &Frame);
|
||||
|
||||
void Process();
|
||||
|
||||
void CompressTpages(bool f) {m_compressTpages=f;}
|
||||
|
@ -85,12 +87,15 @@ public:
|
|||
void MaxSize(int Size) {MyFiles.SetMaxSize(Size);}
|
||||
void SetTPage(int Base,int W,int H) {m_PageBase=Base; m_WidthPages=W; m_HeightPages=H; m_PagePlacements=true;}
|
||||
void ForceOffsets(int XOfs,int YOfs) {MyFiles.SetXOff(XOfs); MyFiles.SetYOff(YOfs); MyFiles.SetForceOffsets(true);}
|
||||
|
||||
|
||||
std::vector<sTexOutInfo> &GetTexInfo() {return(TexInfo);}
|
||||
|
||||
|
||||
protected:
|
||||
|
||||
AllFiles MyFiles;
|
||||
SprSet MySprSet;
|
||||
|
||||
|
||||
GString m_OutFile;
|
||||
GString m_OutLbm;
|
||||
|
@ -109,6 +114,8 @@ protected:
|
|||
bool m_AnimatedHeadersOnly;
|
||||
bool m_DontOutputBoxes;
|
||||
bool m_AlignHeaders;
|
||||
|
||||
std::vector<sTexOutInfo> TexInfo;
|
||||
|
||||
};
|
||||
|
||||
|
|
|
@ -127,12 +127,19 @@ void SprSet::AddFile(FileInfo const & ThisInfo)
|
|||
GString Ext(FileName.Ext());
|
||||
Ext.Upper();
|
||||
|
||||
if (Ext == "LBM" || Ext == "BMP")
|
||||
AddLbm(ThisInfo);
|
||||
else if (Ext == "ANM")
|
||||
AddAnm(ThisInfo);
|
||||
if (ThisInfo.getHasMemFrame())
|
||||
{ // NEW!! Frames from memory :o) Dave
|
||||
AddFrame(ThisInfo.getMemFrame(),ThisInfo);
|
||||
}
|
||||
else
|
||||
Error(ERR_FATAL,"Don't deal with these sort of files : %s", FileName.FullName());
|
||||
{
|
||||
if (Ext == "LBM" || Ext == "BMP")
|
||||
AddLbm(ThisInfo);
|
||||
else if (Ext == "ANM")
|
||||
AddAnm(ThisInfo);
|
||||
else
|
||||
Error(ERR_FATAL,"Don't deal with these sort of files : %s", FileName.FullName());
|
||||
}
|
||||
}
|
||||
/*----------------------------------------------------------------------
|
||||
Function:
|
||||
|
@ -355,6 +362,47 @@ void SprSet::WriteReport(char const * File)
|
|||
Error(ERR_FATAL,"Couldn't open file %s for output",(char const *)OutFileName);
|
||||
}
|
||||
|
||||
/*----------------------------------------------------------------------
|
||||
Function:
|
||||
Purpose:
|
||||
Params:
|
||||
Returns:
|
||||
---------------------------------------------------------------------- */
|
||||
#include <direct.h>
|
||||
|
||||
void SprSet::CreateTexInfo(std::vector<sTexOutInfo> &TexInfo)
|
||||
{
|
||||
int ListSize=AllSprFrames.size();
|
||||
const int DirLen=1024;
|
||||
char Dir[DirLen+1];
|
||||
GString CurrDir;
|
||||
|
||||
CurrDir=getcwd(Dir,DirLen);
|
||||
CurrDir.Upper();
|
||||
CurrDir=CurrDir+"\\";
|
||||
|
||||
TexInfo.resize(ListSize);
|
||||
|
||||
for (int f=0;f<ListSize;f++)
|
||||
{
|
||||
SprFrame &Frm =AllSprFrames[f];
|
||||
sTexOutInfo &ThisInfo=TexInfo[f];
|
||||
GString Name=Frm.GetFileInfo()->GetActualName();
|
||||
|
||||
|
||||
ThisInfo.Name=GFName::makerelative(CurrDir,Name,Dir);
|
||||
ThisInfo.Clut=Frm.GetClut();
|
||||
ThisInfo.Tpage=Frm.GetTpage();
|
||||
ThisInfo.Rotated=Frm.IsRotated();
|
||||
ThisInfo.u=Frm.GetTPRect().X;
|
||||
ThisInfo.v=Frm.GetTPRect().Y;
|
||||
ThisInfo.w=Frm.GetWidth();
|
||||
ThisInfo.h=Frm.GetHeight();
|
||||
ThisInfo.XOfs=Frm.GetX();
|
||||
ThisInfo.XOfs=Frm.GetY();
|
||||
}
|
||||
}
|
||||
|
||||
/*----------------------------------------------------------------------
|
||||
Function:
|
||||
Purpose: Allocate all processed frames into tpages
|
||||
|
|
|
@ -44,6 +44,15 @@
|
|||
/*----------------------------------------------------------------------
|
||||
Structure defintions
|
||||
-------------------- */
|
||||
struct sTexOutInfo
|
||||
{
|
||||
GString Name;
|
||||
u16 Clut;
|
||||
u16 Tpage;
|
||||
bool Rotated;
|
||||
int u,v,w,h;
|
||||
int XOfs,YOfs;
|
||||
};
|
||||
|
||||
/* Encapsulates a file and all the infomation parkgrab needs to process it
|
||||
----------------------------------------------------------------------- */
|
||||
|
@ -54,7 +63,6 @@ class FileInfo
|
|||
{
|
||||
CrossHair=false;
|
||||
ForceOffsets=false;
|
||||
MemFrame=0;
|
||||
}
|
||||
|
||||
FileInfo(FileInfo const & Fi)
|
||||
|
@ -122,7 +130,10 @@ class FileInfo
|
|||
ShrinkToFit=NewShrinkToFit;
|
||||
|
||||
m_allocateAs16Bit=allocateAs16Bit;
|
||||
MemFrame=NewMemFrame;
|
||||
if (NewMemFrame)
|
||||
{
|
||||
MemFrame=*NewMemFrame;
|
||||
}
|
||||
/*
|
||||
if we're allocating on a 16 bit pixel boundary then
|
||||
we don't want the texture to be rotated
|
||||
|
@ -177,6 +188,12 @@ class FileInfo
|
|||
bool getAllocateAs16Bit(void) const
|
||||
{return(m_allocateAs16Bit);}
|
||||
|
||||
bool getHasMemFrame(void) const
|
||||
{return(MemFrame.SeeData!=0);}
|
||||
|
||||
Frame const &getMemFrame() const
|
||||
{return(MemFrame);}
|
||||
|
||||
char const * GetActualName(void) const
|
||||
{return(ActualFileName);}
|
||||
|
||||
|
@ -198,7 +215,7 @@ class FileInfo
|
|||
|
||||
int XOff,YOff;
|
||||
|
||||
Frame *MemFrame;
|
||||
Frame MemFrame;
|
||||
};
|
||||
|
||||
typedef std::vector<FileInfo> FIVec;
|
||||
|
@ -439,6 +456,26 @@ public:
|
|||
{
|
||||
return(MyFileInfo.getAllocateAs16Bit());
|
||||
}
|
||||
int getX(void) {return(X);}
|
||||
|
||||
int getY(void) {return(Y);}
|
||||
|
||||
int getW(void)
|
||||
{
|
||||
if (MyFileInfo.GetMoveUVs() && Width && !MyFileInfo.getAllocateAs16Bit())
|
||||
return(Width-1);
|
||||
else
|
||||
return(Width);
|
||||
}
|
||||
|
||||
int getH(void)
|
||||
{
|
||||
if (MyFileInfo.GetMoveUVs() && Height && !MyFileInfo.getAllocateAs16Bit())
|
||||
return(Height-1);
|
||||
else
|
||||
return(Height);
|
||||
}
|
||||
|
||||
protected:
|
||||
void ResizeAndReduce(Frame & Frm,int TargCols,float XPerc,float YPerc,bool ZeroSeeThrough);
|
||||
|
||||
|
@ -485,6 +522,8 @@ public:
|
|||
|
||||
void AddFiles(FIVec const & FileList);
|
||||
|
||||
void CreateTexInfo(std::vector<sTexOutInfo> &TexInfo);
|
||||
|
||||
void Write(char const * FileName,int TpNumber,int WidthInTpages,int HeightInTpages);
|
||||
void WriteLBM(char const * FileName);
|
||||
void WriteSprFile(char const * Name);
|
||||
|
|
|
@ -55,15 +55,25 @@ struct TPInfo
|
|||
/*----------------------------------------------------------------------
|
||||
Vars
|
||||
---- */
|
||||
// changed by dave to get the pixel border back
|
||||
static TPInfo const InfStruct[TP_NUM_OF_TP_TYPES]=
|
||||
{
|
||||
{1,256,1,1}, /* TP_4 */
|
||||
{2,512,2,1}, /* TP_8 */
|
||||
{4,256,4,1}, /* TP_16 */
|
||||
{0,0,0,0}, /* TP_SCREEN */
|
||||
{16*4,1024*4,0,0}, /* TP_PAL */
|
||||
{1,256,0,0}, // TP_4
|
||||
{2,512,0,0}, // TP_8
|
||||
{4,256,0,0}, // TP_16
|
||||
{0,0,0,0}, // TP_SCREEN
|
||||
{16*4,1024*4,0,0}, // TP_PAL
|
||||
};
|
||||
|
||||
/*
|
||||
static TPInfo const InfStruct[TP_NUM_OF_TP_TYPES]=
|
||||
{
|
||||
{1,256,1,1}, // TP_4
|
||||
{2,512,2,1}, // TP_8
|
||||
{4,256,4,1}, // TP_16
|
||||
{0,0,0,0}, // TP_SCREEN
|
||||
{16*4,1024*4,0,0}, // TP_PAL
|
||||
};
|
||||
*/
|
||||
/*----------------------------------------------------------------------
|
||||
Function Prototypes
|
||||
------------------- */
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue