/*********************************/ /*** Make Collision Table Util ***/ /*********************************/ #include "stdio.h" #include #include #include #include "MkColTab.h" //*************************************************************************** char * CycleCommands(char *String,int Num) { if (String[0]=='-' || String[0]=='/') { // Check Format switch (String[1]) {// Switches case 'o': OutStr = CheckFileString(String); break; case 'd': DebugOn=true; break; default: GObject::Error(ERR_FATAL,"Unknown switch %s",String); break; } } else { GString UpperName(String); UpperName.Upper(); MyFiles.AddFile(UpperName); } return(String); } //*************************************************************************** void Usage(char *ErrStr) { printf("\nMkColTab: by Dave\n"); printf("Usage: nMkColTab [ .. ] [ switches.. ]\n"); printf("Switches:\n"); printf(" -o:[FILE] Set output File\n"); printf(" -d Set Debug On\n"); GObject::Error(ERR_FATAL,ErrStr); } //*************************************************************************** //*************************************************************************** //*************************************************************************** //*************************************************************************** void CMkColTab::Load(const char*Name) { InFrame.LoadBMP(Name); } //*************************************************************************** void CMkColTab::Process() { int BlkW=InFrame.GetWidth()/BLK_SIZE; int BlkH=InFrame.GetHeight()/BLK_SIZE; Rect R; sColInfo ThisTile; R.W=BLK_SIZE; R.H=BLK_SIZE; ThisTile.Ofs.resize(BLK_SIZE); // Add Blank Tiles.push_back(ThisTile); for (int BlkY=0; BlkY const &Files = MyFiles.GetFileInfoVector(); if (!Files.size()) Usage("No Levels specified\n"); if (Files.size()>1) Usage("Too many inputs\n"); if (OutStr.Empty()) Usage("No Output specified\n"); ColTab.Load(Files[0]); ColTab.Process(); ColTab.Write(OutStr); printf("Made %s\n",OutStr); return 0; }