diff --git a/Utils/MkColTab/MkColTab.cpp b/Utils/MkColTab/MkColTab.cpp new file mode 100644 index 000000000..890fe30ff --- /dev/null +++ b/Utils/MkColTab/MkColTab.cpp @@ -0,0 +1,168 @@ +/*********************************/ +/*** 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; +} + + + diff --git a/Utils/MkColTab/MkColTab.dsp b/Utils/MkColTab/MkColTab.dsp new file mode 100644 index 000000000..5da9938ed --- /dev/null +++ b/Utils/MkColTab/MkColTab.dsp @@ -0,0 +1,93 @@ +# Microsoft Developer Studio Project File - Name="MkColTab" - Package Owner=<4> +# Microsoft Developer Studio Generated Build File, Format Version 6.00 +# ** DO NOT EDIT ** + +# TARGTYPE "Win32 (x86) Console Application" 0x0103 + +CFG=MkColTab - Win32 Debug +!MESSAGE This is not a valid makefile. To build this project using NMAKE, +!MESSAGE use the Export Makefile command and run +!MESSAGE +!MESSAGE NMAKE /f "MkColTab.mak". +!MESSAGE +!MESSAGE You can specify a configuration when running NMAKE +!MESSAGE by defining the macro CFG on the command line. For example: +!MESSAGE +!MESSAGE NMAKE /f "MkColTab.mak" CFG="MkColTab - Win32 Debug" +!MESSAGE +!MESSAGE Possible choices for configuration are: +!MESSAGE +!MESSAGE "MkColTab - Win32 Release" (based on "Win32 (x86) Console Application") +!MESSAGE "MkColTab - Win32 Debug" (based on "Win32 (x86) Console Application") +!MESSAGE + +# Begin Project +# PROP AllowPerConfigDependencies 0 +# PROP Scc_ProjName "" +# PROP Scc_LocalPath "" +CPP=cl.exe +RSC=rc.exe + +!IF "$(CFG)" == "MkColTab - Win32 Release" + +# PROP BASE Use_MFC 0 +# PROP BASE Use_Debug_Libraries 0 +# PROP BASE Output_Dir "Release" +# PROP BASE Intermediate_Dir "Release" +# PROP BASE Target_Dir "" +# PROP Use_MFC 0 +# PROP Use_Debug_Libraries 0 +# PROP Output_Dir "Release" +# PROP Intermediate_Dir "Release" +# PROP Ignore_Export_Lib 0 +# PROP Target_Dir "" +# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c +# ADD CPP /nologo /MD /W3 /GX /O2 /I "..\libs\glib" /I "..\libs\maths" /I "..\libs\davelib" /I "..\libs\ginlib" /I "..\libs\psxlib" /I "..\libs\texgrab" /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c +# ADD BASE RSC /l 0x809 /d "NDEBUG" +# ADD RSC /l 0x809 /d "NDEBUG" +BSC32=bscmake.exe +# ADD BASE BSC32 /nologo +# ADD BSC32 /nologo +LINK32=link.exe +# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386 +# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib davelib.lib glib.lib /nologo /subsystem:console /machine:I386 /out:"..\..\tools\data\bin\MkColTab.exe" /libpath:"..\libs\glib\release" /libpath:"..\libs\davelib\release" + +!ELSEIF "$(CFG)" == "MkColTab - Win32 Debug" + +# PROP BASE Use_MFC 0 +# PROP BASE Use_Debug_Libraries 1 +# PROP BASE Output_Dir "Debug" +# PROP BASE Intermediate_Dir "Debug" +# PROP BASE Target_Dir "" +# PROP Use_MFC 0 +# PROP Use_Debug_Libraries 1 +# PROP Output_Dir "Debug" +# PROP Intermediate_Dir "Debug" +# PROP Target_Dir "" +# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c +# ADD CPP /nologo /MDd /W3 /Gm /GX /ZI /Od /I "..\libs\glib" /I "..\libs\maths" /I "..\libs\davelib" /I "..\libs\ginlib" /I "..\libs\psxlib" /I "..\libs\texgrab" /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c +# ADD BASE RSC /l 0x809 /d "_DEBUG" +# ADD RSC /l 0x809 /d "_DEBUG" +BSC32=bscmake.exe +# ADD BASE BSC32 /nologo +# ADD BSC32 /nologo +LINK32=link.exe +# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept +# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib davelib.lib glib.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept /libpath:"..\libs\ginlib\debug" /libpath:"..\libs\glib\debug" /libpath:"..\libs\davelib\debug" + +!ENDIF + +# Begin Target + +# Name "MkColTab - Win32 Release" +# Name "MkColTab - Win32 Debug" +# Begin Source File + +SOURCE=.\MkColTab.cpp +# End Source File +# Begin Source File + +SOURCE=.\MkColTab.h +# End Source File +# End Target +# End Project diff --git a/Utils/MkColTab/MkColTab.h b/Utils/MkColTab/MkColTab.h new file mode 100644 index 000000000..7d1ea8e32 --- /dev/null +++ b/Utils/MkColTab/MkColTab.h @@ -0,0 +1,35 @@ +/*********************************/ +/*** Make Collision Table Util ***/ +/*********************************/ + +#ifndef __MKCOLTAB_HEADER__ +#define __MKCOLTAB_HEADER__ + +using namespace std; + +struct sColInfo +{ + vector Ofs; +}; + +//*************************************************************************** +class CMkColTab +{ +public: + enum + { + BLK_SIZE=16, + }; + void Load(const char *Filename); + void Process(); + void Write(const char *Filename); + +protected: + void BuildTable(Frame &ThisFrame,sColInfo &ThisTile); + + Frame InFrame; + vector Tiles; + FILE *File; +}; + +#endif diff --git a/tools/Data/bin/MkColTab.exe b/tools/Data/bin/MkColTab.exe new file mode 100644 index 000000000..ba87575b6 Binary files /dev/null and b/tools/Data/bin/MkColTab.exe differ