aboutsummaryrefslogtreecommitdiff
path: root/extensions
diff options
context:
space:
mode:
authorGravatar Chris Xiong <chirs241097@gmail.com> 2015-10-07 22:50:48 +0800
committerGravatar Chris Xiong <chirs241097@gmail.com> 2015-10-07 22:50:48 +0800
commit0b049c3ea601a7ea6dc441db73af7a5bd75c834a (patch)
treedd0a232de133bdd5b93a5e8f9193d76978c1216e /extensions
parent16b769db4b4312b8d862bfff59e01f1c7aaf55ed (diff)
downloadbullet-lab-remix-0b049c3ea601a7ea6dc441db73af7a5bd75c834a.tar.xz
Make the compiler happy.
Add some makefiles.
Diffstat (limited to 'extensions')
-rw-r--r--extensions/makefile13
-rw-r--r--extensions/smanim.cpp1
-rw-r--r--extensions/smbmfont.cpp2
-rw-r--r--extensions/smdatapack.cpp18
4 files changed, 27 insertions, 7 deletions
diff --git a/extensions/makefile b/extensions/makefile
new file mode 100644
index 0000000..4c6b3fe
--- /dev/null
+++ b/extensions/makefile
@@ -0,0 +1,13 @@
+CC= g++
+CXXFLAGS= -c -std=c++11 -Wall -I../include -I/usr/include/freetype2
+
+all: objects archive clean
+
+objects:
+ $(CC) *.cpp $(CXXFLAGS)
+archive:
+ $(AR) rcs libsmeltext.a *.o
+clean:
+ if ( test smanim.o ); then rm *.o; fi
+clean-all: clean
+ rm *.a \ No newline at end of file
diff --git a/extensions/smanim.cpp b/extensions/smanim.cpp
index d57292b..69bf8e0 100644
--- a/extensions/smanim.cpp
+++ b/extensions/smanim.cpp
@@ -111,6 +111,7 @@ bool smAnmFile::loadAnmFromMemory(const char* ptr,DWORD size)
DWORD msez=anm.getFileSize("content.meta");
parseMeta(mptr,msez);
anm.releaseFilePtr("content.meta");
+ return true;
}
void smAnmFile::close()
{
diff --git a/extensions/smbmfont.cpp b/extensions/smbmfont.cpp
index 22f9280..97b7fdb 100644
--- a/extensions/smbmfont.cpp
+++ b/extensions/smbmfont.cpp
@@ -55,6 +55,7 @@ bool smBMFont::loadAnmFromMemory(const char* ptr,DWORD size)
anm.releaseFilePtr("content.meta");
setBlend(BLEND_ALPHABLEND);
setColor(0xFFFFFFFF);
+ return true;
}
void smBMFont::close()
{
@@ -155,6 +156,7 @@ bool smBMFontw::loadAnmFromMemory(char* ptr,DWORD size)
DWORD msez=anm.getFileSize("content.meta");
parseMeta(mptr,msez);
anm.releaseFilePtr("content.meta");
+ return true;
}
void smBMFontw::close()
{
diff --git a/extensions/smdatapack.cpp b/extensions/smdatapack.cpp
index 2e77324..8b2c12b 100644
--- a/extensions/smdatapack.cpp
+++ b/extensions/smdatapack.cpp
@@ -11,9 +11,11 @@
#include "smdatapack.hpp"
#include <cstdio>
#include <cstring>
-#define gzgetDWORD(f) ((gzgetc(f)<<24)|(gzgetc(f)<<16)|(gzgetc(f)<<8)|(gzgetc(f)))&0xFFFFFFFF
-#define gch ((*(cp++))&0xFF)
-#define mmgetDWORD ((gch<<24)|(gch<<16)|(gch<<8)|(gch))&0xFFFFFFFF
+inline int gzgch(gzFile f){return gzgetc(f);}
+inline DWORD gzgetDWORD(gzFile f)
+{return ((gzgch(f)<<24)|(gzgch(f)<<16)|(gzgch(f)<<8)|gzgch(f))&0xFFFFFFFF;}
+inline DWORD gch(const char *&cp){return (DWORD)((*(cp++))&0xFF);}
+inline DWORD mmgetDWORD(const char *&cp){return ((gch(cp)<<24)|(gch(cp)<<16)|(gch(cp)<<8)|(gch(cp)))&0xFFFFFFFF;}
#define gzputDWORD(f,a) gzputc(f,a>>24);gzputc(f,(a>>16)&0xFF);gzputc(f,(a>>8)&0xFF);gzputc(f,a&0xFF);
bool smDtpFileR::openDtp(const char* path)
{
@@ -35,6 +37,7 @@ bool smDtpFileR::openDtp(const char* path)
f.crc=gzgetDWORD(file);
m[std::string(f.path)]=f;
}
+ return true;
}
bool smDtpFileR::openDtpFromMemory(const char* ptr,DWORD size)
{
@@ -50,11 +53,12 @@ bool smDtpFileR::openDtpFromMemory(const char* ptr,DWORD size)
f.path=new char[pl+1];f.data=NULL;
for(int j=0;j<pl;++j)f.path[j]=*(cp++);
f.path[pl]='\0';
- f.size=mmgetDWORD;
- f.offset=mmgetDWORD;
- f.crc=mmgetDWORD;
+ f.size=mmgetDWORD(cp);
+ f.offset=mmgetDWORD(cp);
+ f.crc=mmgetDWORD(cp);
m[std::string(f.path)]=f;
}
+ return true;
}
void smDtpFileR::closeDtp()
{
@@ -97,7 +101,7 @@ char* smDtpFileR::getFilePtr(const char* path)
if(!enmemory)
{
int r=gzread(file,m[fns].data,m[fns].size);
- if(r<m[fns].size){delete[] m[fns].data;printf("error: file size mismatch.\n");return m[fns].data=NULL;}
+ if((unsigned)r<m[fns].size){delete[] m[fns].data;printf("error: file size mismatch.\n");return m[fns].data=NULL;}
}
else
{