This commit is contained in:
parent
51e8f52d9b
commit
6c5c1fba9b
9 changed files with 116 additions and 11 deletions
|
@ -73,7 +73,7 @@ int Width,Height;
|
|||
|
||||
// Create Tile Layers
|
||||
AddLayer(LAYER_TYPE_TILE,LAYERTILE_ACTION, Width, Height);
|
||||
// AddLayer(LAYER_TYPE_COLLISION,-1, Width, Height);
|
||||
AddLayer(LAYER_TYPE_COLLISION,-1, Width, Height);
|
||||
|
||||
ActiveLayer=FindActionLayer();
|
||||
MapCam.Zero();
|
||||
|
|
|
@ -27,3 +27,26 @@ CExport::~CExport()
|
|||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
void CExport::BuildColTable(CTile &ThisTile)
|
||||
{
|
||||
u8 *RGB=ThisTile.GetGBTexRGB();
|
||||
int Width=ThisTile.GetGBTexW();
|
||||
int Height=ThisTile.GetGBTexH();
|
||||
|
||||
int X,Y;
|
||||
ColTable.resize(Width);
|
||||
|
||||
for (X=0; X<Width; X++)
|
||||
{
|
||||
for (Y=Height; Y ; Y--)
|
||||
{
|
||||
int Ofs=X+((Y-1)*Width);
|
||||
u8 R=RGB[(Ofs*3)+0];
|
||||
u8 G=RGB[(Ofs*3)+1];
|
||||
u8 B=RGB[(Ofs*3)+2];
|
||||
if (R==255 && G==255 && B==255) break;
|
||||
}
|
||||
ColTable[X]=Y-1;
|
||||
}
|
||||
|
||||
}
|
|
@ -29,14 +29,18 @@ public:
|
|||
~CExport();
|
||||
|
||||
virtual void ExportLayerTile(CCore *Core,char *LayerName,int SubType,CMap &Map)=0;
|
||||
virtual void ExportLayerCollision(CCore *Core,char *LayerName,int SubType,CMap &Map)=0;
|
||||
|
||||
virtual void ExportTiles(CCore *Core)=0;
|
||||
|
||||
protected:
|
||||
void BuildColTable(CTile &ThisTile);
|
||||
|
||||
GFName Filename;
|
||||
FILE *File;
|
||||
int Count;
|
||||
GFName Filename;
|
||||
FILE *File;
|
||||
int Count;
|
||||
|
||||
std::vector<int> ColTable;
|
||||
|
||||
|
||||
};
|
||||
|
|
|
@ -101,7 +101,7 @@ void CLayerCollision::UpdateGUI(CCore *Core)
|
|||
/*****************************************************************************/
|
||||
void CLayerCollision::Export(CCore *Core,CExport &Exp)
|
||||
{
|
||||
// Exp.ExportLayerTile(Core,GetName(),SubType,Map);
|
||||
Exp.ExportLayerCollision(Core,GetName(),SubType,Map);
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
|
|
|
@ -5,6 +5,9 @@
|
|||
#define __LAYER_DEFS_HEADER__
|
||||
|
||||
/*****************************************************************************/
|
||||
|
||||
// Max size is 8 * 6
|
||||
|
||||
enum LAYER_TYPE
|
||||
{
|
||||
LAYER_TYPE_TILE=0,
|
||||
|
|
|
@ -43,7 +43,7 @@ GString Filename;
|
|||
|
||||
// Get application path
|
||||
#ifdef _DEBUG
|
||||
ExePath="C:/Spongebob/tools/mapedit/mapedit/";
|
||||
ExePath="C:/Spongebob/tools/mapedit/";
|
||||
#else
|
||||
char ExeFilename[2048];
|
||||
GetModuleFileName(GetModuleHandle(NULL),ExeFilename,2048);
|
||||
|
@ -85,6 +85,21 @@ void CTileBank::SetCollision(bool f)
|
|||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
char *FixName(const char *In)
|
||||
{
|
||||
char *Ptr=(char*)In;
|
||||
while (*Ptr)
|
||||
{
|
||||
if (Ptr[0]=='T' &&
|
||||
Ptr[1]=='I' &&
|
||||
Ptr[2]=='L' &&
|
||||
Ptr[3]=='E') return(Ptr);
|
||||
Ptr++;
|
||||
}
|
||||
|
||||
return(Ptr);
|
||||
}
|
||||
|
||||
void CTileBank::Load(CFile *File,int Version)
|
||||
{
|
||||
int ListSize;
|
||||
|
@ -105,16 +120,24 @@ GString FilePath;
|
|||
{
|
||||
CurrentSet++;
|
||||
}
|
||||
|
||||
// New Style rel storage
|
||||
for (int i=0;i<ListSize;i++)
|
||||
{
|
||||
char c=1,RelName[256+64],FullName[256+64];
|
||||
char c=1,FullName[256+64];
|
||||
GString RelName;
|
||||
int Len=0;
|
||||
while (c)
|
||||
{
|
||||
File->Read(&c,1);
|
||||
RelName[Len++]=c;
|
||||
RelName.Append(c);
|
||||
}
|
||||
RelName.Upper();
|
||||
|
||||
{ // Dodgy arse artist fix
|
||||
RelName=FixName(RelName);
|
||||
}
|
||||
|
||||
RootPath.makeabsolute(FilePath,RelName,FullName);
|
||||
AddTileSet(FullName);
|
||||
}
|
||||
|
|
|
@ -51,7 +51,7 @@ public:
|
|||
void SetCurrent(int Set) {CurrentSet=Set+1;}
|
||||
int GetCurrent() {return(CurrentSet);}
|
||||
int GetSetCount() {return(TileSet.size());}
|
||||
|
||||
|
||||
CMap &GetLBrush() {return(Brush[LBrush]);}
|
||||
CMap &GetRBrush() {return(Brush[RBrush]);}
|
||||
CMap &GetBrush(int i) {return(Brush[i]);}
|
||||
|
@ -67,6 +67,7 @@ public:
|
|||
BOOL IsTileValidGB(int Set,int Tile);
|
||||
|
||||
void SetCollision(bool f);
|
||||
CTileSet &GetSet(int Set) {return(TileSet[Set]);}
|
||||
|
||||
// Functions
|
||||
BOOL SelectL(BOOL DownFlag) {return(Select(LBrush,DownFlag));}
|
||||
|
|
|
@ -4,6 +4,7 @@
|
|||
|
||||
#include "stdio.h"
|
||||
#include <misc.hpp>
|
||||
#include <GFName.hpp>
|
||||
#include <conio.h>
|
||||
#include <iostream.h>
|
||||
#include <vector>
|
||||
|
@ -16,6 +17,7 @@ using namespace std;
|
|||
|
||||
int QuatCount=0;
|
||||
|
||||
|
||||
//***************************************************************************
|
||||
|
||||
char * CycleCommands(char *String,int Num)
|
||||
|
@ -39,6 +41,9 @@ char * CycleCommands(char *String,int Num)
|
|||
TpStr= CheckFileString(String);
|
||||
Scale=atof(TpStr);
|
||||
break;
|
||||
case 'i':
|
||||
IncludeFile= CheckFileString(String);
|
||||
break;
|
||||
default:
|
||||
GObject::Error(ERR_FATAL,"Unknown switch %s",String);
|
||||
break;
|
||||
|
@ -61,6 +66,7 @@ void CMkAnim3d::Add(GString const &Filename)
|
|||
{
|
||||
CScene Scene;
|
||||
int ThisBoneCount;
|
||||
GFName Name=Filename;
|
||||
|
||||
printf("%s\n",Filename);
|
||||
Scene.Load(Filename);
|
||||
|
@ -81,7 +87,8 @@ int ThisBoneCount;
|
|||
|
||||
// Process Anim
|
||||
sAnim ThisAnim;
|
||||
|
||||
ThisAnim.Name=Name.File();
|
||||
ThisAnim.Name.Upper();
|
||||
ThisAnim.FrameCount=ProcessSkelMove(Scene,ThisAnim,1);
|
||||
ProcessSkelAnim(Scene,ThisAnim,1);
|
||||
AnimList.push_back(ThisAnim);
|
||||
|
@ -122,7 +129,7 @@ int FrameCount=NodeAnim.size();
|
|||
{
|
||||
sGinAnim const &InFrame=NodeAnim[i];
|
||||
sQuat ThisFrame;
|
||||
Quaternion ThisQuat=InFrame.Ang;
|
||||
Quaternion const &ThisQuat=InFrame.Ang;
|
||||
|
||||
/* if (Idx==1)
|
||||
{
|
||||
|
@ -260,6 +267,43 @@ int ListSize=QuatList.size();
|
|||
return(Pos);
|
||||
}
|
||||
|
||||
//***************************************************************************
|
||||
void CMkAnim3d::WriteInclude(GString const &Filename)
|
||||
{
|
||||
GString Upper=Filename;
|
||||
Upper.Upper();
|
||||
GFName Name=Upper;
|
||||
|
||||
File=fopen(Filename,"wt");
|
||||
|
||||
fprintf(File,"// %s Header\n",Name.File());
|
||||
fprintf(File,"\n");
|
||||
fprintf(File,"#ifndef\t__ANIM_%s_HEADER__\n",Name.File());
|
||||
fprintf(File,"#define\t__ANIM_%s_HEADER__\n",Name.File());
|
||||
fprintf(File,"\n");
|
||||
fprintf(File,"\n");
|
||||
fprintf(File,"enum\tANIM_%s_LIST\n",Name.File());
|
||||
fprintf(File,"{\n");
|
||||
|
||||
int ListSize=AnimList.size();
|
||||
for (int i=0; i<ListSize; i++)
|
||||
{
|
||||
sAnim &ThisAnim=AnimList[i];
|
||||
fprintf(File,"\tANIM_%s_%s",Name.File(),ThisAnim.Name);
|
||||
if (i==0)
|
||||
{
|
||||
fprintf(File,"=0");
|
||||
}
|
||||
fprintf(File,",\n");
|
||||
}
|
||||
|
||||
fprintf(File,"};\n");
|
||||
fprintf(File,"\n");
|
||||
fprintf(File,"#endif\n");
|
||||
|
||||
fclose(File);
|
||||
}
|
||||
|
||||
//***************************************************************************
|
||||
//***************************************************************************
|
||||
//***************************************************************************
|
||||
|
@ -292,5 +336,10 @@ vector<GString> const &Files = MyFiles.GetFileInfoVector();
|
|||
|
||||
AnimBank.Write(OutStr);
|
||||
|
||||
if (!IncludeFile.Empty())
|
||||
{
|
||||
AnimBank.WriteInclude(IncludeFile);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -15,6 +15,7 @@ struct sBoneAnim
|
|||
|
||||
struct sAnim
|
||||
{
|
||||
GString Name;
|
||||
int FrameCount;
|
||||
vector<sBoneAnim> BoneAnim;
|
||||
vector<s32> Move;
|
||||
|
@ -33,6 +34,7 @@ public:
|
|||
|
||||
void Add(GString const &Filename);
|
||||
void Write(GString &Filename);
|
||||
void WriteInclude(GString const &IncludeFile);
|
||||
|
||||
private:
|
||||
int ProcessSkelMove(CScene &Scene,sAnim &ThisAnim,int Idx);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue