This commit is contained in:
Daveo 2001-04-26 21:38:18 +00:00
parent 7fa8e5a852
commit 1b65f73e2b
3 changed files with 71 additions and 76 deletions

View file

@ -33,28 +33,28 @@ Class21=CMapEditDoc
Class22=CMapEditView Class22=CMapEditView
ResourceCount=20 ResourceCount=20
Resource1=IDD_LAYER_PLATFORM Resource1=IDD_LAYER_THING_POS
Resource2=IDD_ADDLAYER Resource2=IDD_NEWMAP
Resource3=IDD_TOOLBAR Resource3=IDD_TILEBANK
Resource4=IDR_MAPEDITYPE (English (U.S.)) Resource4=IDR_MAPEDITYPE (English (U.S.))
Resource5=IDD_LAYER_THING_POS Resource5=IDD_LAYER_THING
Resource6=IDR_TOOLBAR (English (U.S.)) Resource6=IDD_LAYER_TRIGGER
Resource7=IDD_LAYER_ACTOR Resource7=IDD_ELEMLIST
Resource8=IDD_LAYER_LIST Resource8=IDD_MULTIBAR (English (U.S.))
Resource9=IDD_MULTIBAR (English (U.S.)) Resource9=IDD_ABOUTBOX (English (U.S.))
Resource10=IDD_LAYER_THING Resource10=IDD_LAYER_ACTOR
Resource11=IDD_LAYER_TRIGGER Resource11=IDD_LAYER_PLATFORM
Resource12=IDD_NEWMAP Resource12=IDD_RESIZE
Resource13=IDD_TILEBANK Resource13=IDD_ADDLAYER
Resource14=IDR_MAINFRAME (English (U.S.)) Resource14=IDD_LAYER_FX
Resource15=IDD_ABOUTBOX (English (U.S.)) Resource15=IDR_MAINFRAME (English (U.S.))
Resource16=IDD_LAYER_COLLISION Resource16=IDD_LAYER_SHADE
Resource17=IDD_ELEMLIST Resource17=IDD_LAYER_COLLISION
Resource18=IDD_LAYER_SHADE Resource18=IDD_TOOLBAR
Class23=CGUILayerTrigger Class23=CGUILayerTrigger
Resource19=IDD_RESIZE Resource19=IDD_LAYER_LIST
Class24=CGUILayerFX Class24=CGUILayerFX
Resource20=IDD_LAYER_FX Resource20=IDR_TOOLBAR (English (U.S.))
[CLS:CChildFrame] [CLS:CChildFrame]
Type=0 Type=0

View file

@ -303,7 +303,7 @@ void CMkActor::MakePsxGfx(sBmp &Bmp)
{ {
// Copied from SprSet // Copied from SprSet
int nfW,nfH,nfLineWidthBytes,nfAreaBytes; int nfW,nfH,nfLineWidthBytes,nfAreaBytes;
Frame Frm=Bmp.Bmp; Frame Frm=Bmp.Frm;
nfW=Frm.GetWidth(); nfW=Frm.GetWidth();
nfH=Frm.GetHeight(); nfH=Frm.GetHeight();
@ -313,6 +313,7 @@ Frame Frm=Bmp.Bmp;
if (nfW>MaxW) MaxW=nfW; if (nfW>MaxW) MaxW=nfW;
if (nfH>MaxH) MaxH=nfH; if (nfH>MaxH) MaxH=nfH;
Bmp.Psx=(u8*)malloc(nfAreaBytes+16); Bmp.Psx=(u8*)malloc(nfAreaBytes+16);
ASSERT(Bmp.Psx); ASSERT(Bmp.Psx);
@ -346,11 +347,11 @@ Frame Frm=Bmp.Bmp;
int CMkActor::FindDup(sBmp &Bmp) int CMkActor::FindDup(sBmp &Bmp)
{ {
int i,BmpListSize=BmpList.size(); int i,BmpListSize=BmpList.size();
int Size=Bmp.Bmp.GetWidth()*Bmp.Bmp.GetHeight(); int Size=Bmp.Frm.GetWidth()*Bmp.Frm.GetHeight();
Bmp.RGB=(u8*)malloc(Size*3); Bmp.RGB=(u8*)malloc(Size*3);
ASSERT(Bmp.RGB); ASSERT(Bmp.RGB);
Bmp.Bmp.MakeRGB(Bmp.RGB); Bmp.Frm.MakeRGB(Bmp.RGB);
// Check for dups (Broken at the mo, ah well) // Check for dups (Broken at the mo, ah well)
// Gen Chksum // Gen Chksum
@ -386,10 +387,10 @@ int W0,H0,W1,H1,Size;
u8 *RGB0,*RGB1; u8 *RGB0,*RGB1;
if (Bmp0.ChkR!=Bmp1.ChkR || Bmp0.ChkG!=Bmp1.ChkG || Bmp0.ChkB!=Bmp1.ChkB) return(false); if (Bmp0.ChkR!=Bmp1.ChkR || Bmp0.ChkG!=Bmp1.ChkG || Bmp0.ChkB!=Bmp1.ChkB) return(false);
W0=Bmp0.Bmp.GetWidth(); W0=Bmp0.Frm.GetWidth();
H0=Bmp0.Bmp.GetHeight(); H0=Bmp0.Frm.GetHeight();
W1=Bmp1.Bmp.GetWidth(); W1=Bmp1.Frm.GetWidth();
H1=Bmp1.Bmp.GetHeight(); H1=Bmp1.Frm.GetHeight();
if (W0!=W1 || H0!=H1) return(false); if (W0!=W1 || H0!=H1) return(false);
Size=W0*H0*3; Size=W0*H0*3;
@ -404,33 +405,25 @@ u8 *RGB0,*RGB1;
} }
//*************************************************************************** //***************************************************************************
// Shrink frame to extents, aligned for 4 pixels (needed?) void CMkActor::CheckAndShrinkFrame(sBmp &Bmp)
void CMkActor::SetAndShrinkFrame(GString &Filename,Frame &Src, SprFrame &Dst)
{ {
FileInfo ThisInfo;
Rect OriginalRect;
// Check Colors // Check Colors
int ColorCount=Src.GetNumOfCols(); int ColorCount=Bmp.Frm.GetNumOfCols();
if (ColorCount>16) if (ColorCount>16)
{ {
GObject::Error(ERR_FATAL,"%s has %i colors.\n",Name,ColorCount); GObject::Error(ERR_FATAL,"%s has %i colors.\n",Name,ColorCount);
} }
// ThisInfo.SetInfo(name, CrossHair, ThisZeroColZero, MoveUVs, AllowRotate, ShrinkToFit, m_allocateAs16bit); Bmp.OrigW=Bmp.Frm.GetWidth();
ThisInfo.SetInfo(Filename, false, true, false, false, true, false); Bmp.OrigH=Bmp.Frm.GetHeight();
// Copy Frame
Dst.SetFrameAndInfo(Src,ThisInfo,0);
// Align Frame
OriginalRect=Src;
OriginalRect.X=0;
OriginalRect.Y=0;
OriginalRect.W=GU_AlignVal(OriginalRect.W,4);
Dst.Crop(OriginalRect);
Rect 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);
// printf("%i %i \n",Bmp.CrossHairX,Bmp.CrossHairY);
} }
//*************************************************************************** //***************************************************************************
@ -439,17 +432,20 @@ int CMkActor::LoadBmp(GString &Name,bool VRamFlag)
GString Filename=SpriteDir+Name; GString Filename=SpriteDir+Name;
int BmpListSize=BmpList.size(); int BmpListSize=BmpList.size();
sBmp NewBmp; sBmp NewBmp;
Frame NewFrame;
// Init Frame // Init & Load Frame
NewBmp.Frm.LoadBMP(Filename);
NewBmp.RGB=0; NewBmp.RGB=0;
NewBmp.Pak=0; NewBmp.Pak=0;
NewBmp.Psx=0; NewBmp.Psx=0;
NewBmp.VRamFlag=VRamFlag; NewBmp.VRamFlag=VRamFlag;
// Load frame CheckAndShrinkFrame(NewBmp);
NewFrame.LoadBMP(Filename); if (BmpListSize==0)
SetAndShrinkFrame(Filename,NewFrame,NewBmp.Bmp); { // Calc HotSpot based on first frame
printf("!");
}
// Check Dups // Check Dups
int Idx=FindDup(NewBmp); int Idx=FindDup(NewBmp);
@ -466,7 +462,7 @@ int Idx=FindDup(NewBmp);
#if _DEBUG && defined(OutputTGA) #if _DEBUG && defined(OutputTGA)
void WriteTGA(GString Name,Frame Frm); void WriteTGA(GString Name,Frame Frm);
WriteTGA(Name,NewBmp.Bmp); WriteTGA(Name,NewBmp.Frm);
#endif #endif
return(BmpListSize); return(BmpListSize);
@ -494,18 +490,15 @@ void CMkActor::Process()
BuildFrameList(); BuildFrameList();
LoadFrameList(); LoadFrameList();
ProcessFrames(); ProcessFrames();
// TexGrab.Process();
} }
//*************************************************************************** //***************************************************************************
void CMkActor::ProcessFrames() void CMkActor::ProcessFrames()
{ {
int i,ListSize=BmpList.size(); int i,ListSize=BmpList.size();
int TotalIn=0;
int TotalOut=0;
TotalIn=0;
TotalOut=0;
for (i=0; i<ListSize; i++) for (i=0; i<ListSize; i++)
{ {
sBmp &ThisBmp=BmpList[i]; sBmp &ThisBmp=BmpList[i];
@ -520,7 +513,6 @@ int TotalOut=0;
TotalOut+=ThisBmp.PakSize; TotalOut+=ThisBmp.PakSize;
} }
printf("\t\t\t\t\t\r"); printf("\t\t\t\t\t\r");
printf("%s - Done. %i Dups (In %i) (Out %i) (Saved %i)\n",Name,DupCount,TotalIn,TotalOut,TotalIn-TotalOut);
} }
//*************************************************************************** //***************************************************************************
@ -537,6 +529,7 @@ GString OutName=OutFile+".SBK";
PadFile(File); PadFile(File);
// Write Palette // Write Palette
FileHdr.Palette=(u8*)WritePalette(); FileHdr.Palette=(u8*)WritePalette();
FileHdr.Clut=0;
PadFile(File); PadFile(File);
// Write AnimList // Write AnimList
FileHdr.AnimList=(sSpriteAnim*)WriteAnimList(); FileHdr.AnimList=(sSpriteAnim*)WriteAnimList();
@ -551,6 +544,7 @@ GString OutName=OutFile+".SBK";
fclose(File); fclose(File);
WriteInclude(); WriteInclude();
printf("%s. %i Dups, (In %i Out %i = Saved %i) (MaxWH %i %i)\n",Name,DupCount,TotalIn,TotalOut,TotalIn-TotalOut,FileHdr.MaxW,FileHdr.MaxH);
} }
@ -558,7 +552,7 @@ GString OutName=OutFile+".SBK";
int CMkActor::WritePalette() int CMkActor::WritePalette()
{ {
int Pos=ftell(File); int Pos=ftell(File);
Palette &PCPalette=BmpList[0].Bmp.GetPal(); Palette &PCPalette=BmpList[0].Frm.GetPal();
SprPal PsxPalette; SprPal PsxPalette;
int i,Count; int i,Count;
vector<u16> OutPal; vector<u16> OutPal;
@ -568,11 +562,6 @@ vector<u16> OutPal;
Count=PsxPalette.GetNumOfCols(); Count=PsxPalette.GetNumOfCols();
if (Count<16) Count=16; if (Count<16) Count=16;
// if (Count>16)
// {
// GObject::Error(ERR_WARNING,"Too Many Colors.\n");
// }
FileHdr.ColorCount=Count;
PsxPalette.MakePSXPal(OutPal); PsxPalette.MakePSXPal(OutPal);
for (i=0; i<Count; i++) for (i=0; i<Count; i++)
{ {
@ -636,10 +625,11 @@ int Pos=ftell(File);
int i,FrameCount=BmpList.size(); int i,FrameCount=BmpList.size();
vector<sSpriteFrame> Hdrs; vector<sSpriteFrame> Hdrs;
// Write Dummy Hdrs
FileHdr.MaxW=MaxW; FileHdr.MaxW=MaxW;
FileHdr.MaxH=MaxH; FileHdr.MaxH=MaxH;
FileHdr.FrameCount=FrameCount; FileHdr.FrameCount=FrameCount;
// Write Dummy Hdrs
Hdrs.resize(FrameCount); Hdrs.resize(FrameCount);
for (i=0; i<FrameCount; i++) for (i=0; i<FrameCount; i++)
{ {
@ -653,17 +643,24 @@ vector<sSpriteFrame> Hdrs;
sBmp &ThisBmp=BmpList[i]; sBmp &ThisBmp=BmpList[i];
if (ThisBmp.VRamFlag) if (ThisBmp.VRamFlag)
{ // VRam { // VRam
GObject::Error(ERR_FATAL,"VRam sprites not supported yet (%s)\n",ThisBmp.Bmp.GetName); GObject::Error(ERR_FATAL,"VRam sprites not supported yet (%s)\n",ThisBmp.Frm.GetName);
} }
else else
{ // Pak { // Pak
int XOfs=ThisBmp.Bmp.GetX()-(ThisBmp.Bmp.GetOrigW()/2); // int XOfs=ThisBmp.Frm.GetX()-(ThisBmp.OrigW/2);
int YOfs=ThisBmp.Bmp.GetY()-(ThisBmp.Bmp.GetOrigH()); // int YOfs=ThisBmp.Frm.GetY()-(ThisBmp.OrigH);
int OH=ThisBmp.OrigH;
int NH=ThisBmp.Frm.GetHeight();
// int XOfs=ThisBmp.Frm.GetX()-(MaxW/2);
// int YOfs=ThisBmp.Frm.GetY()-(OH-NH);
int XOfs=ThisBmp.CrossHairX;
int YOfs=ThisBmp.CrossHairY;
Hdrs[i].PAKSpr=(u8*)ftell(File); Hdrs[i].PAKSpr=(u8*)ftell(File);
Hdrs[i].XOfs=XOfs; Hdrs[i].XOfs=XOfs;
Hdrs[i].YOfs=YOfs; Hdrs[i].YOfs=YOfs;
Hdrs[i].W=ThisBmp.Bmp.GetWidth(); Hdrs[i].W=ThisBmp.Frm.GetWidth();
Hdrs[i].H=ThisBmp.Bmp.GetHeight(); Hdrs[i].H=ThisBmp.Frm.GetHeight();
fwrite(ThisBmp.Pak,1,ThisBmp.PakSize,File); fwrite(ThisBmp.Pak,1,ThisBmp.PakSize,File);
} }
@ -720,8 +717,3 @@ int ListSize=AnimList.size();
} }
//platform length on bio dome - collision fix
//flying things
//platform gfx
//look up & down

View file

@ -23,7 +23,8 @@ struct sAnim
//*************************************************************************** //***************************************************************************
struct sBmp struct sBmp
{ {
SprFrame Bmp; Frame Frm;
int OrigW,OrigH;
int ChkR,ChkG,ChkB; int ChkR,ChkG,ChkB;
u8 *RGB; u8 *RGB;
u8 *Psx; u8 *Psx;
@ -31,6 +32,7 @@ struct sBmp
int PsxSize; int PsxSize;
int PakSize; int PakSize;
bool VRamFlag; bool VRamFlag;
int CrossHairX,CrossHairY;
}; };
//*************************************************************************** //***************************************************************************
@ -55,7 +57,7 @@ private:
void LoadFrameList(); void LoadFrameList();
void LoadFrame(sFrame &ThisFrame,bool VRamFlag); void LoadFrame(sFrame &ThisFrame,bool VRamFlag);
int LoadBmp(GString &Name,bool VRamFlag); int LoadBmp(GString &Name,bool VRamFlag);
void SetAndShrinkFrame(GString &Filename,Frame &Src,SprFrame &Dst); void CheckAndShrinkFrame(sBmp &Bmp);
bool IsImageSame(sBmp &Bmp0,sBmp &Bmp1); bool IsImageSame(sBmp &Bmp0,sBmp &Bmp1);
void MakePsxGfx(sBmp &Bmp); void MakePsxGfx(sBmp &Bmp);
void ProcessFrames(); void ProcessFrames();
@ -77,6 +79,7 @@ private:
CTexGrab TexGrab; CTexGrab TexGrab;
int DupCount; int DupCount;
int MaxW,MaxH; int MaxW,MaxH;
int TotalIn,TotalOut;
}; };
//*************************************************************************** //***************************************************************************