i already solved this problem long time ago in 2012 i just have not done any thing with it sorry about that I was making a gui to handle tmx but there was no interest in it I think its finally time that I put my editor on the forums because I can't fix it because I stopped working on it, but my problem was that I wanted to sell it.
#include "Main.h"
#include "menuhandle.h"
#include "savefiletype.h"
#include "initwindowgravmfc.h"
#include <string>
using namespace std;
string foldernametemp;
void exportanimated(string afile)
{
agk::OpenToWrite(5,"theexporttile.file",0);
int numsprites=getcurnumsprites(0);
if(numsprites==0&&getlpos()==0)
{return;}
agk::WriteInteger(5,getcurspriteframesize(0));
agk::WriteInteger(5,numsprites);
agk::WriteInteger(5,getsizepos());
int ggi=getlpos();
agk::WriteInteger(5,ggi);
for(int ig=0;ig<=ggi;ig++)
{
setlpos(ig);
if(checksize(ig))
{
numsprites=getcurnumsprites(ig);
agk::WriteInteger(5,numsprites);
for(int ic=0;ic<numsprites;ic++)
{
agk::WriteString(5,getspritechar(ic));
agk::WriteInteger(5,getsprite(ic));
agk::WriteInteger(5,getanimatedsprite(ic));
agk::WriteFloat(5,getcurspritexpos2(ic,ic));
agk::WriteFloat(5,getcurspriteypos2(ic,ic));
for(int frame=0;frame<getsizepos();frame++)
{
agk::WriteInteger(5,getanimatedspriteframe2(ic,0));
//agk::WriteInteger(getwidth(ic,frame));
//agk::WriteInteger(getheight(ic,frame));
}
}
}
}
}
void setfilestr(string foldername)
{
foldernametemp=foldername;
agk::MakeFolder(foldername.c_str());
}
void exportafile3d(string afile)
{
agk::OpenToWrite(5,"theexporttile3d.file",0);
// int numobjs=
}
void exportafile2(string afile)
{
agk::OpenToWrite(4,"theexporttile.file",0);
int numsprites=getcurnumsprites(0);
if(numsprites==0&&getlpos()==0)
{return;}
//agk::WriteInteger(4,getcurspriteframesize(0));
agk::WriteInteger(4,numsprites);
int ggi=getlpos();
agk::WriteInteger(4,ggi);
for(int ig=0;ig<=ggi;ig++)
{
setlpos(ig);
if(checksize(ig))
{
numsprites=getcurnumsprites(ig);
agk::WriteInteger(4,numsprites);
for(int ic=0;ic<numsprites;ic++)
{
// agk::WriteString(4,getspritechar(ic));
// agk::WriteInteger(4,getsprite(ic));
//char *filechar=getspritechar(ic);
/* if(filechar=="")
{
agk::WriteLine(4,"none");
}
else
{
agk::WriteLine(4,getspritechar(ic));
}*/
// agk::WriteInteger(4,getanimatedsprite(ic));
//int width =getwidth(ic);
agk::WriteInteger(4,getwidth(ic,0));
agk::WriteInteger(4,getheight(ic,0));
//agk::getjointid(4,
// int frame=getanimatedspriteframe2(ic,0);
agk::WriteInteger(4,getanimatedspriteframe2(ic,0));
float xx=getcurspritexpos(ic,0);
float yy=getcurspriteypos(ic,0);
agk::WriteFloat(4,getcurspritexpos2(ic,0));
agk::WriteFloat(4,getcurspriteypos2(ic,0));
/*agk::WriteFloat(4,getcurspriteangle(ic,0));
agk::WriteFloat(4,getcurspritexsize(ic,0));
agk::WriteFloat(4,getcurspriteysize(ic,0));
agk::WriteInteger(4,getcurspritered(ic,0));
agk::WriteInteger(4,getcurspritegreen(ic,0));
agk::WriteInteger(4,getcurspriteblue(ic,0));
agk::WriteInteger(4,gettrans(ic,0));*/
int ab=getcurspritephysact(ic);
agk::WriteInteger(4,ab);
agk::WriteInteger(4,getphysicstype(ic));
}
}
}
int filesize=getassignnodechildnode();
if(filesize!=0)
{
agk::WriteInteger(4,filesize);
for(int icc=0; icc<filesize;icc=icc+1)
{
agk::WriteInteger(4,getjointid(icc));
agk::WriteInteger(4,getassignnodechildnode2(icc));
agk::WriteInteger(4,getassignnodechildnode3(icc));
agk::WriteInteger(4,getspritejointancp1(icc));
agk::WriteInteger(4,getspritejointancp2(icc));
agk::WriteInteger(4,getspritejointancp3(icc));
agk::WriteInteger(4,getspritejointancp4(icc));
}
}
agk::CloseFile(4);
}
void exportafile22(string afile)
{
agk::OpenToWrite(4,"theexporttile.file",0);
int numsprites=getcurnumsprites(0);
if(numsprites==0&&getlpos()==0)
{return;}
//agk::WriteInteger(4,getcurspriteframesize(0));
agk::WriteInteger(4,numsprites);
int ggi=getlpos();
agk::WriteInteger(4,ggi);
for(int ig=0;ig<=ggi;ig++)
{
setlpos(ig);
if(checksize(ig))
{
numsprites=getcurnumsprites(ig);
agk::WriteInteger(4,numsprites);
for(int ic=0;ic<numsprites;ic++)
{
// agk::WriteString(4,getspritechar(ic));
// agk::WriteInteger(4,getsprite(ic));
//char *filechar=getspritechar(ic);
/* if(filechar=="")
{
agk::WriteLine(4,"none");
}
else
{
agk::WriteLine(4,getspritechar(ic));
}*/
// agk::WriteInteger(4,getanimatedsprite(ic));
//int width =getwidth(ic);
agk::WriteInteger(4,getwidth(ic,0));
agk::WriteInteger(4,getheight(ic,0));
//agk::getjointid(4,
// int frame=getanimatedspriteframe2(ic,0);
agk::WriteInteger(4,getanimatedspriteframe2(ic,0));
float xx=getcurspritexpos(ic,0);
float yy=getcurspriteypos(ic,0);
agk::WriteFloat(4,getcurspritexpos2(ic,0));
agk::WriteFloat(4,getcurspriteypos2(ic,0));
/*agk::WriteFloat(4,getcurspriteangle(ic,0));
agk::WriteFloat(4,getcurspritexsize(ic,0));
agk::WriteFloat(4,getcurspriteysize(ic,0));
agk::WriteInteger(4,getcurspritered(ic,0));
agk::WriteInteger(4,getcurspritegreen(ic,0));
agk::WriteInteger(4,getcurspriteblue(ic,0));
agk::WriteInteger(4,gettrans(ic,0));*/
int ab=getcurspritephysact(ic);
agk::WriteInteger(4,ab);
agk::WriteInteger(4,getphysicstype(ic));
}
}
}
int filesize=getassignnodechildnode();
if(filesize!=0)
{
agk::WriteInteger(4,filesize);
for(int icc=0; icc<filesize;icc=icc+1)
{
agk::WriteInteger(4,getjointid(icc));
agk::WriteInteger(4,getassignnodechildnode2(icc));
agk::WriteInteger(4,getassignnodechildnode3(icc));
agk::WriteInteger(4,getspritejointancp1(icc));
agk::WriteInteger(4,getspritejointancp2(icc));
agk::WriteInteger(4,getspritejointancp3(icc));
agk::WriteInteger(4,getspritejointancp4(icc));
}
}
agk::CloseFile(4);
}
void exportafile(string afile)
{
agk::OpenToWrite(4,"theexport.file",0);
int numsprites=getcurnumsprites(0);
agk::WriteInteger(4,getcurspriteframesize(0));
agk::WriteInteger(4,numsprites);
for(int ic=0;ic<numsprites;ic++)
{
agk::WriteInteger(4,getsprite(ic));
agk::WriteLine(4,getspritechar(ic));
}
for(int icc=0;icc<getcurspriteframesize(0);icc++)
{
agk::WriteInteger(4,icc);
for(int ic=0;ic<numsprites;ic++)
{
agk::WriteInteger(4,getsprite(ic));
agk::WriteInteger(4,getcurspritephysact(ic));
//agk::getjointid(4,
agk::WriteInteger(4,getanimatedspriteframe2(ic,0));
agk::WriteFloat(4,getcurspritexpos(ic,icc));
agk::WriteFloat(4,getcurspriteypos(ic,icc));
agk::WriteFloat(4,getcurspriteangle(ic,icc));
agk::WriteFloat(4,getcurspritexsize(ic,icc));
agk::WriteFloat(4,getcurspriteysize(ic,icc));
agk::WriteFloat(4,getcurspritered(ic,icc));
agk::WriteFloat(4,getcurspritegreen(ic,icc));
agk::WriteFloat(4,getcurspriteblue(ic,icc));
agk::WriteFloat(4,gettrans(ic,icc));
}
}
if(getspritejointsize()!=0)
{
agk::WriteInteger(4, getspritejointsize());
for(int icc=0;icc<getspritejointsize();icc++)
{
agk::WriteInteger(4,icc);
//int GETSPRITEJOINTPARENT(int pos);
agk::WriteInteger(4,getspritejointparent(icc));
//int GETSPRITEJOINTCHILD(int pos);
agk::WriteInteger(4, getspritejointchild(icc));
// int GETSPRITEJOINTANCP1(int pos);
agk::WriteInteger(4, getspritejointancp1(icc));
//int GETSPRITEJOINTANCP2(int pos);
agk::WriteInteger(4,getspritejointancp2(icc));
//int GETSPRITEJOINTANCP3(int pos
agk::WriteInteger(4,getspritejointancp3(icc));
agk::WriteInteger(4,getspritejointancp4(icc));
}
}
// setanframeszero();
/* agk::WriteInteger(4,getkeyboardspritenum());
if(getnextupframesize()!=0)
{
for(int ic=0;ic<getnextupframesize();ic++)
{
agk::WriteInteger(4,getnextupframe());
}
}
if(getnextdownframesize()!=0)
{
for(int ic=0;ic<getnextdownframesize();ic++)
{
agk::WriteInteger(4,getnextdownframe());
}
}
if(getnextleftframesize()!=0)
{
for(int ic=0;ic<getnextleftframesize();ic++)
{
agk::WriteInteger(4,getnextleftframe());
}
}
if(getnextrightframesize()!=0)
{
for(int ic=0;ic<getnextrightframesize();ic++)
{
agk::WriteInteger(4,getnextrightframe());
}
}
//int getnextdkey2framesize();
//int getnextsframesize();
//int getnextaframesize();
//int getnextjumpframesize();
if(getnextjumpframesize()!=0)
{
for(int ic=0;ic<getnextjumpframesize();ic++)
{
agk::WriteInteger(4,getnextjumpframe());
}
}
if(getnextaframesize()!=0)
{
for(int ic=0;ic<getnextaframesize();ic++)
{
agk::WriteInteger(4,getnextaframe());
}
}
if(getnextsframesize()!=0)
{
for(int ic=0;ic<getnextsframesize();ic++)
{
agk::WriteInteger(4,getnextsframe());
}
}
if(getnextdkey2framesize()!=0)
{
for(int ic=0;ic<getnextdkey2framesize();ic++)
{
agk::WriteInteger(4,getnextdkey2frame());
}
}*/
agk::CloseFile(4);
}
void exportkeys5(string asavefile)
{
agk::OpenToWrite(4,"theexport2.file",0);
setanframeszero();
agk::WriteInteger(4,getkeyboardspritenum());
if(getnextupframesize()!=0)
{
for(int ic=0;ic<getnextupframesize();ic++)
{
agk::WriteInteger(4,getnextupframe());
}
}
if(getnextdownframesize()!=0)
{
for(int ic=0;ic<getnextdownframesize();ic++)
{
agk::WriteInteger(4,getnextdownframe());
}
}
if(getnextleftframesize()!=0)
{
for(int ic=0;ic<getnextleftframesize();ic++)
{
agk::WriteInteger(4,getnextleftframe());
}
}
if(getnextrightframesize()!=0)
{
for(int ic=0;ic<getnextrightframesize();ic++)
{
agk::WriteInteger(4,getnextrightframe());
}
}
//int getnextdkey2framesize();
//int getnextsframesize();
//int getnextaframesize();
//int getnextjumpframesize();
if(getnextjumpframesize()!=0)
{
for(int ic=0;ic<getnextjumpframesize();ic++)
{
agk::WriteInteger(4,getnextjumpframe());
}
}
if(getnextaframesize()!=0)
{
for(int ic=0;ic<getnextaframesize();ic++)
{
agk::WriteInteger(4,getnextaframe());
}
}
if(getnextsframesize()!=0)
{
for(int ic=0;ic<getnextsframesize();ic++)
{
agk::WriteInteger(4,getnextsframe());
}
}
if(getnextdkey2framesize()!=0)
{
for(int ic=0;ic<getnextdkey2framesize();ic++)
{
agk::WriteInteger(4,getnextdkey2frame());
}
}
agk::CloseFile(4);
}
void saveafile(string asavefile)
{
agk::OpenToWrite(4,asavefile.c_str(),0);
// agk::WriteInteger(4,getnumframes());
agk::WriteInteger(4,5);
//agk
agk::CloseFile(4);
}
here are the exports that can go to tier one also
I think its the second export i believe
void exportafile2(string afile)
{
agk::OpenToWrite(4,"theexporttile.file",0);
int numsprites=getcurnumsprites(0);
if(numsprites==0&&getlpos()==0)
{return;}
//agk::WriteInteger(4,getcurspriteframesize(0));
agk::WriteInteger(4,numsprites);
int ggi=getlpos();
agk::WriteInteger(4,ggi);
for(int ig=0;ig<=ggi;ig++)
{
setlpos(ig);
if(checksize(ig))
{
numsprites=getcurnumsprites(ig);
agk::WriteInteger(4,numsprites);
for(int ic=0;ic<numsprites;ic++)
{
// agk::WriteString(4,getspritechar(ic));
// agk::WriteInteger(4,getsprite(ic));
//char *filechar=getspritechar(ic);
/* if(filechar=="")
{
agk::WriteLine(4,"none");
}
else
{
agk::WriteLine(4,getspritechar(ic));
}*/
// agk::WriteInteger(4,getanimatedsprite(ic));
//int width =getwidth(ic);
agk::WriteInteger(4,getwidth(ic,0));
agk::WriteInteger(4,getheight(ic,0));
//agk::getjointid(4,
// int frame=getanimatedspriteframe2(ic,0);
agk::WriteInteger(4,getanimatedspriteframe2(ic,0));
float xx=getcurspritexpos(ic,0);
float yy=getcurspriteypos(ic,0);
agk::WriteFloat(4,getcurspritexpos2(ic,0));
agk::WriteFloat(4,getcurspriteypos2(ic,0));
/*agk::WriteFloat(4,getcurspriteangle(ic,0));
agk::WriteFloat(4,getcurspritexsize(ic,0));
agk::WriteFloat(4,getcurspriteysize(ic,0));
agk::WriteInteger(4,getcurspritered(ic,0));
agk::WriteInteger(4,getcurspritegreen(ic,0));
agk::WriteInteger(4,getcurspriteblue(ic,0));
agk::WriteInteger(4,gettrans(ic,0));*/
int ab=getcurspritephysact(ic);
agk::WriteInteger(4,ab);
agk::WriteInteger(4,getphysicstype(ic));
}
}
}
int filesize=getassignnodechildnode();
if(filesize!=0)
{
agk::WriteInteger(4,filesize);
for(int icc=0; icc<filesize;icc=icc+1)
{
agk::WriteInteger(4,getjointid(icc));
agk::WriteInteger(4,getassignnodechildnode2(icc));
agk::WriteInteger(4,getassignnodechildnode3(icc));
agk::WriteInteger(4,getspritejointancp1(icc));
agk::WriteInteger(4,getspritejointancp2(icc));
agk::WriteInteger(4,getspritejointancp3(icc));
agk::WriteInteger(4,getspritejointancp4(icc));
}
}
agk::CloseFile(4);
}
The export can be loaded in Tier one I think I have a newer verson though this is one of the older versions but it works, and actually this export is extremely fast to load in both tiers I write some more documentation when I get to it.
What I did is I converted the TMX into a agk save file which can be loaded with the commands in agk which is very fast I tested it and it loads fast, but u you can also use that convertor to make a save agk file and convert it back to agk I think.
Developer of Space Chips, pianobasic, zipzapzoom, and vet pinball apps. Developed the tiled map engine seen on the showcase. Veteran for the military.