From: <dun...@us...> - 2006-07-23 10:50:29
|
Revision: 30 Author: dunkfordyce Date: 2006-07-23 03:50:22 -0700 (Sun, 23 Jul 2006) ViewCVS: http://svn.sourceforge.net/dunelegacy/?rev=30&view=rev Log Message: ----------- reading font file tests Added Paths: ----------- branches/dunks/wip/ branches/dunks/wip/SConstruct branches/dunks/wip/font.cpp Added: branches/dunks/wip/SConstruct =================================================================== --- branches/dunks/wip/SConstruct (rev 0) +++ branches/dunks/wip/SConstruct 2006-07-23 10:50:22 UTC (rev 30) @@ -0,0 +1 @@ +Program('font.cpp') Added: branches/dunks/wip/font.cpp =================================================================== --- branches/dunks/wip/font.cpp (rev 0) +++ branches/dunks/wip/font.cpp 2006-07-23 10:50:22 UTC (rev 30) @@ -0,0 +1,62 @@ +#include <stdio.h> + +// http://xccu.sourceforge.net/documents/ccfonts.txt + +typedef unsigned short word; +typedef unsigned char byte; + +struct FNTHeader +{ + word fsize; /* Size of the file */ + word unknown1; /* Unknown entry (always 0x0500) */ + word unknown2; /* Unknown entry (always 0x000e) */ + word unknown3; /* Unknown entry (always 0x0014) */ + word wpos; /* Offset of char. widths array (abs. from beg. of file) */ + word cdata; /* Offset of char. graphics data (abs. from beg. of file) */ + word hpos; /* Offset of char. heights array (abs. from beg. of file) */ + word unknown4; /* Unknown entry (always 0x1012) */ + byte unknown5; // dunk- had to add this to get nchars read correctly + byte nchars; /* Number of characters in font minus 1*/ // dunk- the doc says word + byte height; /* Font height */ + byte maxw; /* Max. character width */ +}; + +int main(int argc, char* argv[]) +{ + FILE* file = fopen("new10p.fnt", "rb"); + + FNTHeader header; + + printf("sizeof word %ld, sizeof byte %ld\n", sizeof(word), sizeof(byte)); + + printf("fsize %d\n", header.fsize); + + fread(&header, sizeof(FNTHeader), 1, file); + + printf("fsize %d\n", header.fsize); + + // this checks if its a valid font + if (header.unknown1 != 0x0500) printf("failed unknown1\n"); + if (header.unknown2 != 0x000e) printf("failed unknown2\n"); + if (header.unknown3 != 0x0014) printf("failed unknown3\n"); + + printf("nchars %u\n", header.nchars); + + word cdata[header.nchars+1]; + + fread(cdata, sizeof(word), header.nchars+1, file); + + byte wchar[header.nchars+1]; + + printf("wpos %d\n", header.wpos); + fseek(file, header.wpos, SEEK_SET); + long br = fread(cdata, sizeof(byte), header.nchars+1, file); + printf("br %ld\n", br); + + if (wchar[0] != 8) printf("bad!!\n"); + + //for (int i=0; i!=header.nchars+1; i++) + // printf("%d %hd\n", i, wchar[i]); + + fclose(file); +}; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <dun...@us...> - 2006-07-24 09:50:22
|
Revision: 42 Author: dunkfordyce Date: 2006-07-24 02:50:09 -0700 (Mon, 24 Jul 2006) ViewCVS: http://svn.sourceforge.net/dunelegacy/?rev=42&view=rev Log Message: ----------- fixes for windows Modified Paths: -------------- branches/dunks/SConstruct branches/dunks/config.py branches/dunks/include/Font.h branches/dunks/src/Application.cpp branches/dunks/src/Font.cpp branches/dunks/src/main.cpp Modified: branches/dunks/SConstruct =================================================================== --- branches/dunks/SConstruct 2006-07-23 22:21:11 UTC (rev 41) +++ branches/dunks/SConstruct 2006-07-24 09:50:09 UTC (rev 42) @@ -1,4 +1,5 @@ import sys +import os opts = Options('config.py') # default to using sdl-config if not on windows @@ -9,37 +10,46 @@ opts.Add('ZZIP_INCLUDE_PATH', 'include path for zlib', '') opts.Add('ZZIP_LIB_PATH', 'lib path for zlib', '') -env = Environment(options = opts ) +opts.Add('BOOST_INCLUDE_PATH', 'include path for boost', '') +# need to get two paths as far as i can tell. these can probably be calculated somehow +opts.Add('BOOST_LIB_PATH', 'lib path for boost', '') + +if sys.platform == 'win32': + env = Environment(options = opts, ENV=os.environ) +else: + env = Environment(options = opts) + env.Append(CPPPATH="#include") if sys.platform != "win32": env.ParseConfig('sdl-config --cflags --libs') env.ParseConfig('pkg-config --cflags --libs zziplib') - env.Append(CCFLAGS=["-Wall", "-Werror"]) + env.Append(CCFLAGS=["-Wall", "-Werror", "-O2", "-ffast-math", "-funroll-loops"]) + env.Append(LINKFLAGS = ["-ffast-math"]) if 1: env.Append(CCFLAGS=["-ggdb"]) else: - env.Append(LIBS = ["zziplib", "zdll", "SDLmain"]) + env.Append(LIBS = ["zzipdll", "zdll", "SDLmain"]) env.Append(LINKFLAGS = ["/SUBSYSTEM:CONSOLE"]) - env.Append(CCFLAGS = ["/MD", "/Ox"]) + env.Append(CCFLAGS = ["/MD", "/O2"]) env.Append(LIBS = [ "SDL", "SDL_mixer", "SDL_image", "SDL_net", "SDL_ttf", - - "boost_signals", ]) env.Append(CPPPATH = [ "${SDL_INCLUDE_PATH}", "${ZLIB_INCLUDE_PATH}", - "${ZZIP_INCLUDE_PATH}"]) + "${ZZIP_INCLUDE_PATH}", + "${BOOST_INCLUDE_PATH}"]) env.Append(LIBPATH = [ "${SDL_LIB_PATH}", "${ZLIB_LIB_PATH}", - "${ZZIP_LIB_PATH}"]) + "${ZZIP_LIB_PATH}", + "${BOOST_LIB_PATH}"]) Export('env') Modified: branches/dunks/config.py =================================================================== --- branches/dunks/config.py 2006-07-23 22:21:11 UTC (rev 41) +++ branches/dunks/config.py 2006-07-24 09:50:09 UTC (rev 42) @@ -4,3 +4,5 @@ ZLIB_LIB_PATH = r"E:\projects\include\zlib123-dll\lib" ZZIP_INCLUDE_PATH = "E:\projects\include\zziplib-0.10.82-msvc6-lib\include" ZZIP_LIB_PATH = "E:\projects\include\zziplib-0.10.82-msvc6-lib\lib" +BOOST_INCLUDE_PATH = r"C:\Boost\include\boost-1_33_1" +BOOST_LIB_PATH = r"C:\Boost\lib" Modified: branches/dunks/include/Font.h =================================================================== --- branches/dunks/include/Font.h 2006-07-23 22:21:11 UTC (rev 41) +++ branches/dunks/include/Font.h 2006-07-24 09:50:09 UTC (rev 42) @@ -45,7 +45,7 @@ Font(FNTCharacter* characters, FNTHeader* header); ~Font(); - void render(const char* text, SDL_Surface* surface, Uint16 x, Uint16 y); + void render(const char* text, SDL_Surface* surface, Uint16 x, Uint16 y, Uint8 paloff); private: FNTHeader* m_header; Modified: branches/dunks/src/Application.cpp =================================================================== --- branches/dunks/src/Application.cpp 2006-07-23 22:21:11 UTC (rev 41) +++ branches/dunks/src/Application.cpp 2006-07-24 09:50:09 UTC (rev 42) @@ -28,6 +28,8 @@ #define SCREEN_BPP 8 #define VERSION "0.94.1" +Uint8 gpaloff; + Application::Application() { m_running = false; @@ -264,11 +266,13 @@ const int fps_interval = 10 * 1000; // 10 seconds float fps; - Font* fnt = FontManager::Instance()->getFont("intro.fnt"); + Font* fnt = FontManager::Instance()->getFont("new8p.fnt"); m_running = true; assert(m_rootWidget != NULL); + + gpaloff = 0 ; while (m_running) { @@ -293,7 +297,8 @@ m_rootWidget->draw(m_screen); - fnt->render("ABCDEFGHIJKLMOPQRSTUVWXYZ", m_screen, 10, 10); + fnt->render("ABCDEFGHIJKLMOPQRSTUVWXYZ", m_screen, 10, 10, gpaloff); + fnt->render("abcdefghijklmnopqrstuvwxz", m_screen, 10, 30, gpaloff); BlitCursor(); @@ -344,6 +349,11 @@ m_rootWidget->handleButtonUp( event.button.button, event.button.x, event.button.y); + if (event.button.button == 1) + gpaloff ++; + else + gpaloff --; + printf("gpla %u\n", gpaloff); break; case SDL_KEYDOWN: m_rootWidget->handleKeyDown(&(event.key.keysym)); Modified: branches/dunks/src/Font.cpp =================================================================== --- branches/dunks/src/Font.cpp 2006-07-23 22:21:11 UTC (rev 41) +++ branches/dunks/src/Font.cpp 2006-07-24 09:50:09 UTC (rev 42) @@ -17,20 +17,20 @@ delete m_header; }; -void Font::render(const char* text, SDL_Surface* surface, Uint16 offx, Uint16 offy) +void Font::render(const char* text, SDL_Surface* surface, Uint16 offx, Uint16 offy, Uint8 paloff) { FNTCharacter* ch; byte* bitmap; Uint8* pixels = (Uint8*)surface->pixels; - + for (unsigned int c=0; c!=strlen(text); c++) { - printf("char %c\n", text[c]); ch = &m_characters[text[c]]; bitmap = ch->bitmap; byte ox; + /* for (byte y=0; y!=ch->y_offset; y++) { ox = offx; @@ -42,6 +42,7 @@ ++ox; }; }; + */ for (byte y=0; y!=ch->height; y++) { @@ -72,22 +73,21 @@ printf("."); */ - //if (hibyte!=0) + if (hibyte!=0) { - pixels[(offx + x) + ((ch->y_offset + y + offy) * surface->w)] = Uint8(hibyte); + pixels[(offx + x) + ((ch->y_offset + y + offy) * surface->w)] = paloff + Uint8(hibyte); }; - //if (2 < ch->width) lobyte!=0) + if (lobyte!=0) //(2 < ch->width) lobyte!=0) { - pixels[(offx + x + 1) + ((ch->y_offset + y + offy) * surface->w)] = Uint8(lobyte); + pixels[(offx + x + 1) + ((ch->y_offset + y + offy) * surface->w)] = paloff + Uint8(lobyte); }; }; - printf("\n"); }; offx += (2*ch->width) + 1; }; - + }; FontManager::FontManager() Modified: branches/dunks/src/main.cpp =================================================================== --- branches/dunks/src/main.cpp 2006-07-23 22:21:11 UTC (rev 41) +++ branches/dunks/src/main.cpp 2006-07-24 09:50:09 UTC (rev 42) @@ -1,6 +1,15 @@ #include "Application.h" #include "Settings.h" +namespace boost { + + void throw_exception(std::exception const & e) + { + + }; + +} + int main(int argc, char *argv[]) { Settings::Instance()->ParseFile("dunelegacy.cfg"); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <dun...@us...> - 2006-07-25 09:59:57
|
Revision: 48 Author: dunkfordyce Date: 2006-07-25 02:59:46 -0700 (Tue, 25 Jul 2006) ViewCVS: http://svn.sourceforge.net/dunelegacy/?rev=48&view=rev Log Message: ----------- commiting resource manager to test on linux Modified Paths: -------------- branches/dunks/SConstruct branches/dunks/src/SConscript branches/dunks/src/pakfile/Decode.cpp Added Paths: ----------- branches/dunks/include/ResMan.h branches/dunks/src/ResMan.cpp Modified: branches/dunks/SConstruct =================================================================== --- branches/dunks/SConstruct 2006-07-25 06:24:26 UTC (rev 47) +++ branches/dunks/SConstruct 2006-07-25 09:59:46 UTC (rev 48) @@ -41,7 +41,7 @@ "SDL_image", "SDL_net", "SDL_ttf", - "boost_signals", + #"boost_signals", ]) env.Append(CPPPATH = [ "${SDL_INCLUDE_PATH}", Added: branches/dunks/include/ResMan.h =================================================================== --- branches/dunks/include/ResMan.h (rev 0) +++ branches/dunks/include/ResMan.h 2006-07-25 09:59:46 UTC (rev 48) @@ -0,0 +1,65 @@ +#ifndef DUNE_RESMAN_H +#define DUNE_RESMAN_H + +#include "singleton.h" +#include "pakfile/Pakfile.h" + +#include "boost/filesystem/path.hpp" + +#include <map> + +class Resource +{ + public: + Resource() {}; + virtual long readFile(boost::filesystem::path path, char* buf) { return 0; } + + protected: + boost::filesystem::path m_path; +}; + + +class DIRResource : public Resource +{ + public: + DIRResource(boost::filesystem::path path) {}; + virtual long readFile(boost::filesystem::path path, char* buf) {return 0;} + +}; + + +class PAKResource : public Resource +{ + public: + PAKResource(boost::filesystem::path path) {}; + ~PAKResource(); + virtual long readFile(boost::filesystem::path path, char* buf) {return 0;} + + private: + Pakfile *m_pakfile; +}; + + +class ResMan : public Singleton<ResMan> +{ + friend class Singleton<ResMan>; + + typedef std::map<const char*, Resource*> ResList; + + protected: + ResMan(); + ~ResMan(); + + public: + bool addRes(const char* name); + + long readFile(const char* path, char* buf); + + private: + ResList m_resources; + +}; + +#endif // DUNE_RESMAN_H + + Added: branches/dunks/src/ResMan.cpp =================================================================== --- branches/dunks/src/ResMan.cpp (rev 0) +++ branches/dunks/src/ResMan.cpp 2006-07-25 09:59:46 UTC (rev 48) @@ -0,0 +1,97 @@ +#include "ResMan.h" + +#include "boost/filesystem/operations.hpp" // includes boost/filesystem/path.hpp +#include "boost/filesystem/fstream.hpp" // ditto +namespace bfs = boost::filesystem; + +DIRResource::DIRResource(bfs::path path) +{ + m_path = path; +}; + +long DIRResource::readFile(bfs::path path, char* buf) +{ + bfs::path fullpath = m_path + path; + + FILE file (fullpath.c_str(), "rb"); + fseek(file, 0, SEEK_END); + long filesize = ftell; + + fseek(file, 0, SEEK_SET); + + buf = new char[filesize]; + + fread(buf, filesize, 1, file); + + fclose(file); + + return filesize; +}; + +// ------------------------------------------------------------------ + +PAKResource::PAKResource(bfs::path path) +{ + m_path = path; + m_pakfile = Pakfile(path.c_str()); +}; + +PAKResource::~PAKResource() +{ + delete m_pakfile; +}; + +long PAKResource::readFile(bfs::path path, char* buf) +{ + long filesize; + buf = m_pakfile->getFile(path.c_str(), &filesize); + return filesize; +}; + +// ------------------------------------------------------------------ + +ResMan::ResMan() +{ + +}; + +ResMan::~ResMan() +{ + ResList::iterator it; + for (it = m_resources.begin(); + it != m_resources.end(); + ++it) + { + delete *it; + }; + + m_resources.clear(); +}; + +bool ResMan::addRes(const char* name) +{ + bfs::path file (name); + Resource *res = NULL; + + if (bfs::is_directory(file)) + { + res = DIRResource(file); + } + else + { + res = PAKResource(file); + }; + + // this isnt going to work.. + if (res == NULL) + { + return false; + }; + + m_resources[fn] = res; + + return true; +}; + + + Modified: branches/dunks/src/SConscript =================================================================== --- branches/dunks/src/SConscript 2006-07-25 06:24:26 UTC (rev 47) +++ branches/dunks/src/SConscript 2006-07-25 09:59:46 UTC (rev 48) @@ -22,6 +22,8 @@ "MainMenu.cpp", "SingleMenu.cpp", + "ResMan.cpp", + "gui2/Widget.cpp", "gui2/Container.cpp", "gui2/Button.cpp", Modified: branches/dunks/src/pakfile/Decode.cpp =================================================================== --- branches/dunks/src/pakfile/Decode.cpp 2006-07-25 06:24:26 UTC (rev 47) +++ branches/dunks/src/pakfile/Decode.cpp 2006-07-25 09:59:46 UTC (rev 48) @@ -24,17 +24,17 @@ unsigned char *readp = image_in; unsigned char *writep = image_out; - uint a = 0; - uint b = 0; - uint c = 0; - uint d = 0; - uint e = 0; -// uint relposcount = 0; - uint megacounta = 0; - uint megacountb = 0; - uint megacountc = 0; - uint megacountd = 0; - uint megacounte = 0; + Uint16 a = 0; + Uint16 b = 0; + Uint16 c = 0; + Uint16 d = 0; + Uint16 e = 0; +// Uint16 relposcount = 0; + Uint16 megacounta = 0; + Uint16 megacountb = 0; + Uint16 megacountc = 0; + Uint16 megacountd = 0; + Uint16 megacounte = 0; /* 1 10cccccc 2 0cccpppp p @@ -165,7 +165,7 @@ void Decode::apply_pal_offsets(unsigned char *offsets, unsigned char *data,unsigned int length) { - uint i; + Uint16 i; for (i = 0; i < length; i ++) data[i] = offsets[data[i]]; }; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <dun...@us...> - 2006-07-25 10:27:30
|
Revision: 49 Author: dunkfordyce Date: 2006-07-25 03:27:19 -0700 (Tue, 25 Jul 2006) ViewCVS: http://svn.sourceforge.net/dunelegacy/?rev=49&view=rev Log Message: ----------- fixes to resource manager Modified Paths: -------------- branches/dunks/SConstruct branches/dunks/include/ResMan.h branches/dunks/include/pakfile/Pakfile.h branches/dunks/src/ResMan.cpp branches/dunks/src/pakfile/Pakfile.cpp Modified: branches/dunks/SConstruct =================================================================== --- branches/dunks/SConstruct 2006-07-25 09:59:46 UTC (rev 48) +++ branches/dunks/SConstruct 2006-07-25 10:27:19 UTC (rev 49) @@ -41,9 +41,11 @@ "SDL_image", "SDL_net", "SDL_ttf", - #"boost_signals", ]) +if sys.platform != 'win32': + env.Append(LIBS=["boost_signals"]) + env.Append(CPPPATH = [ "${SDL_INCLUDE_PATH}", "${ZLIB_INCLUDE_PATH}", "${ZZIP_INCLUDE_PATH}", Modified: branches/dunks/include/ResMan.h =================================================================== --- branches/dunks/include/ResMan.h 2006-07-25 09:59:46 UTC (rev 48) +++ branches/dunks/include/ResMan.h 2006-07-25 10:27:19 UTC (rev 49) @@ -12,7 +12,8 @@ { public: Resource() {}; - virtual long readFile(boost::filesystem::path path, char* buf) { return 0; } + virtual ~Resource(); + virtual int readFile(boost::filesystem::path path, unsigned char* buf) { return 0; } protected: boost::filesystem::path m_path; @@ -22,8 +23,8 @@ class DIRResource : public Resource { public: - DIRResource(boost::filesystem::path path) {}; - virtual long readFile(boost::filesystem::path path, char* buf) {return 0;} + DIRResource(boost::filesystem::path path) ; + virtual int readFile(boost::filesystem::path path, unsigned char* buf) ; }; @@ -31,9 +32,9 @@ class PAKResource : public Resource { public: - PAKResource(boost::filesystem::path path) {}; + PAKResource(boost::filesystem::path path) ; ~PAKResource(); - virtual long readFile(boost::filesystem::path path, char* buf) {return 0;} + virtual int readFile(boost::filesystem::path path, unsigned char* buf) ; private: Pakfile *m_pakfile; @@ -53,7 +54,7 @@ public: bool addRes(const char* name); - long readFile(const char* path, char* buf); + int readFile(const char* path, char* buf); private: ResList m_resources; Modified: branches/dunks/include/pakfile/Pakfile.h =================================================================== --- branches/dunks/include/pakfile/Pakfile.h 2006-07-25 09:59:46 UTC (rev 48) +++ branches/dunks/include/pakfile/Pakfile.h 2006-07-25 10:27:19 UTC (rev 49) @@ -12,12 +12,12 @@ class Pakfile { public: - Pakfile(char * Pakfilename); + Pakfile(const char * Pakfilename); ~Pakfile(); char * getFilename(int index); - unsigned char *getFile(char *fname, int *size); + unsigned char *getFile(const char *fname, int *size); inline int getNumFiles() {return NumFileEntry;}; Modified: branches/dunks/src/ResMan.cpp =================================================================== --- branches/dunks/src/ResMan.cpp 2006-07-25 09:59:46 UTC (rev 48) +++ branches/dunks/src/ResMan.cpp 2006-07-25 10:27:19 UTC (rev 49) @@ -9,17 +9,17 @@ m_path = path; }; -long DIRResource::readFile(bfs::path path, char* buf) +int DIRResource::readFile(bfs::path path, unsigned char* buf) { - bfs::path fullpath = m_path + path; + bfs::path fullpath (m_path.string() + path.string()); - FILE file (fullpath.c_str(), "rb"); + FILE *file = fopen (fullpath.string().c_str(), "rb"); fseek(file, 0, SEEK_END); - long filesize = ftell; + int filesize = ftell(file); fseek(file, 0, SEEK_SET); - buf = new char[filesize]; + buf = new unsigned char[filesize]; fread(buf, filesize, 1, file); @@ -33,7 +33,7 @@ PAKResource::PAKResource(bfs::path path) { m_path = path; - m_pakfile = Pakfile(path.c_str()); + m_pakfile = new Pakfile(path.string().c_str()); }; PAKResource::~PAKResource() @@ -41,10 +41,10 @@ delete m_pakfile; }; -long PAKResource::readFile(bfs::path path, char* buf) +int PAKResource::readFile(bfs::path path, unsigned char* buf) { - long filesize; - buf = m_pakfile->getFile(path.c_str(), &filesize); + int filesize; + buf = m_pakfile->getFile(path.string().c_str(), &filesize); return filesize; }; @@ -62,7 +62,7 @@ it != m_resources.end(); ++it) { - delete *it; + delete (it->second); }; m_resources.clear(); @@ -75,11 +75,11 @@ if (bfs::is_directory(file)) { - res = DIRResource(file); + res = new DIRResource(file); } else { - res = PAKResource(file); + res = new PAKResource(file); }; // this isnt going to work.. @@ -88,7 +88,7 @@ return false; }; - m_resources[fn] = res; + m_resources[name] = res; return true; }; Modified: branches/dunks/src/pakfile/Pakfile.cpp =================================================================== --- branches/dunks/src/pakfile/Pakfile.cpp 2006-07-25 09:59:46 UTC (rev 48) +++ branches/dunks/src/pakfile/Pakfile.cpp 2006-07-25 10:27:19 UTC (rev 49) @@ -3,7 +3,7 @@ #include <string.h> #include <SDL_endian.h> -Pakfile::Pakfile(char *Pakfilename) +Pakfile::Pakfile(const char *Pakfilename) { FileEntry = NULL; NumFileEntry = 0; @@ -120,7 +120,7 @@ return FileEntry[index].Filename; }; -unsigned char *Pakfile::getFile(char *fname, int *size) +unsigned char *Pakfile::getFile(const char *fname, int *size) { int Index = -1; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <dun...@us...> - 2006-07-25 10:48:47
|
Revision: 50 Author: dunkfordyce Date: 2006-07-25 03:48:36 -0700 (Tue, 25 Jul 2006) ViewCVS: http://svn.sourceforge.net/dunelegacy/?rev=50&view=rev Log Message: ----------- fixes to resource manager Modified Paths: -------------- branches/dunks/SConstruct branches/dunks/src/ResMan.cpp branches/dunks/src/pakfile/Decode.cpp Modified: branches/dunks/SConstruct =================================================================== --- branches/dunks/SConstruct 2006-07-25 10:27:19 UTC (rev 49) +++ branches/dunks/SConstruct 2006-07-25 10:48:36 UTC (rev 50) @@ -44,7 +44,9 @@ ]) if sys.platform != 'win32': - env.Append(LIBS=["boost_signals"]) + env.Append(LIBS=[ "boost_signals", + "boost_filesystem", + ]) env.Append(CPPPATH = [ "${SDL_INCLUDE_PATH}", "${ZLIB_INCLUDE_PATH}", Modified: branches/dunks/src/ResMan.cpp =================================================================== --- branches/dunks/src/ResMan.cpp 2006-07-25 10:27:19 UTC (rev 49) +++ branches/dunks/src/ResMan.cpp 2006-07-25 10:48:36 UTC (rev 50) @@ -4,6 +4,13 @@ #include "boost/filesystem/fstream.hpp" // ditto namespace bfs = boost::filesystem; +Resource::~Resource() +{ + +}; + +// ------------------------------------------------------------------ + DIRResource::DIRResource(bfs::path path) { m_path = path; Modified: branches/dunks/src/pakfile/Decode.cpp =================================================================== --- branches/dunks/src/pakfile/Decode.cpp 2006-07-25 10:27:19 UTC (rev 49) +++ branches/dunks/src/pakfile/Decode.cpp 2006-07-25 10:48:36 UTC (rev 50) @@ -15,7 +15,7 @@ ; }; -int Decode::decode80(unsigned char *image_in, unsigned char *image_out,unsigned checksum) +int Decode::decode80(unsigned char *image_in, unsigned char *image_out,unsigned int checksum) { // // should decode all the format80 stuff ;-) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <dun...@us...> - 2006-07-25 06:24:47
|
Revision: 47 Author: dunkfordyce Date: 2006-07-24 23:24:26 -0700 (Mon, 24 Jul 2006) ViewCVS: http://svn.sourceforge.net/dunelegacy/?rev=47&view=rev Log Message: ----------- included pakfile Modified Paths: -------------- branches/dunks/SConstruct branches/dunks/src/Application.cpp branches/dunks/src/SConscript Added Paths: ----------- branches/dunks/config.py.example branches/dunks/include/pakfile/ branches/dunks/include/pakfile/Cpsfile.h branches/dunks/include/pakfile/Decode.h branches/dunks/include/pakfile/Icnfile.h branches/dunks/include/pakfile/Pakfile.h branches/dunks/include/pakfile/Shpfile.h branches/dunks/include/pakfile/Wsafile.h branches/dunks/src/pakfile/ branches/dunks/src/pakfile/Cpsfile.cpp branches/dunks/src/pakfile/Decode.cpp branches/dunks/src/pakfile/Icnfile.cpp branches/dunks/src/pakfile/Pakfile.cpp branches/dunks/src/pakfile/SConscript branches/dunks/src/pakfile/Shpfile.cpp branches/dunks/src/pakfile/Wsafile.cpp branches/dunks/src/pakfile/main.cpp Removed Paths: ------------- branches/dunks/config.py Modified: branches/dunks/SConstruct =================================================================== --- branches/dunks/SConstruct 2006-07-24 22:30:32 UTC (rev 46) +++ branches/dunks/SConstruct 2006-07-25 06:24:26 UTC (rev 47) @@ -25,8 +25,9 @@ if sys.platform != "win32": env.ParseConfig('sdl-config --cflags --libs') env.ParseConfig('pkg-config --cflags --libs zziplib') - env.Append(CCFLAGS=["-Wall", "-Werror", "-O2", "-ffast-math", "-funroll-loops"]) - env.Append(LINKFLAGS = ["-ffast-math", "-lboost_signals"]) + env.Append(CCFLAGS=["-Wall"]) #, "-Werror"]) + #env.Append(CCFLAGS=["-Wall", "-Werror", "-O2", "-ffast-math", "-funroll-loops"]) + #env.Append(LINKFLAGS = ["-ffast-math"]) if 1: env.Append(CCFLAGS=["-ggdb"]) @@ -40,6 +41,7 @@ "SDL_image", "SDL_net", "SDL_ttf", + "boost_signals", ]) env.Append(CPPPATH = [ "${SDL_INCLUDE_PATH}", Deleted: branches/dunks/config.py =================================================================== --- branches/dunks/config.py 2006-07-24 22:30:32 UTC (rev 46) +++ branches/dunks/config.py 2006-07-25 06:24:26 UTC (rev 47) @@ -1,8 +0,0 @@ -SDL_INCLUDE_PATH = r"E:\projects\include\SDL\SDL-1.2.11\include" -SDL_LIB_PATH = r"E:\projects\include\SDL\SDL-1.2.11\lib" -ZLIB_INCLUDE_PATH = r"E:\projects\include\zlib123-dll\include" -ZLIB_LIB_PATH = r"E:\projects\include\zlib123-dll\lib" -ZZIP_INCLUDE_PATH = "E:\projects\include\zziplib-0.10.82-msvc6-lib\include" -ZZIP_LIB_PATH = "E:\projects\include\zziplib-0.10.82-msvc6-lib\lib" -BOOST_INCLUDE_PATH = r"C:\Boost\include\boost-1_33_1" -BOOST_LIB_PATH = r"C:\Boost\lib" Copied: branches/dunks/config.py.example (from rev 21, branches/dunks/config.py) =================================================================== --- branches/dunks/config.py.example (rev 0) +++ branches/dunks/config.py.example 2006-07-25 06:24:26 UTC (rev 47) @@ -0,0 +1,6 @@ +SDL_INCLUDE_PATH = r"E:\projects\include\SDL\SDL-1.2.11\include" +SDL_LIB_PATH = r"E:\projects\include\SDL\SDL-1.2.11\lib" +ZLIB_INCLUDE_PATH = r"E:\projects\include\zlib123-dll\include" +ZLIB_LIB_PATH = r"E:\projects\include\zlib123-dll\lib" +ZZIP_INCLUDE_PATH = "E:\projects\include\zziplib-0.10.82-msvc6-lib\include" +ZZIP_LIB_PATH = "E:\projects\include\zziplib-0.10.82-msvc6-lib\lib" Added: branches/dunks/include/pakfile/Cpsfile.h =================================================================== --- branches/dunks/include/pakfile/Cpsfile.h (rev 0) +++ branches/dunks/include/pakfile/Cpsfile.h 2006-07-25 06:24:26 UTC (rev 47) @@ -0,0 +1,21 @@ +#ifndef CPSFILE_H_INCLUDED +#define CPSFILE_H_INCLUDED + +#include "pakfile/Decode.h" +#include "SDL.h" + +class Cpsfile : public Decode +{ +public: + Cpsfile(unsigned char * bufFiledata, int bufsize); + ~Cpsfile(); + + + SDL_Surface * getPicture(); + +private: + unsigned char* Filedata; + Uint32 CpsFilesize; +}; + +#endif // CPSFILE_H_INCLUDED Added: branches/dunks/include/pakfile/Decode.h =================================================================== --- branches/dunks/include/pakfile/Decode.h (rev 0) +++ branches/dunks/include/pakfile/Decode.h 2006-07-25 06:24:26 UTC (rev 47) @@ -0,0 +1,19 @@ +#ifndef DECODE_H_INCLUDED +#define DECODE_H_INCLUDED + +class Decode +{ +public: + Decode(); + ~Decode(); + +protected: + + int decode80(unsigned char *image_in, unsigned char *image_out,unsigned checksum); + void my_memcpy(unsigned char *dst, unsigned char *src, unsigned cnt); + void shp_correct_lf(unsigned char *in, unsigned char *out, int size); + void apply_pal_offsets(unsigned char *offsets, unsigned char *data,unsigned int length); + int decode40(unsigned char *image_in, unsigned char *image_out); +}; + +#endif // DECODE_H_INCLUDED Added: branches/dunks/include/pakfile/Icnfile.h =================================================================== --- branches/dunks/include/pakfile/Icnfile.h (rev 0) +++ branches/dunks/include/pakfile/Icnfile.h 2006-07-25 06:24:26 UTC (rev 47) @@ -0,0 +1,32 @@ +#ifndef ICNFILE_H_INCLUDED +#define ICNFILE_H_INCLUDED + +#include "SDL.h" + +class Icnfile +{ +public: + Icnfile(unsigned char * bufFiledata, int bufsize); + ~Icnfile(); + + + SDL_Surface * getPicture(Uint32 IndexOfFile); + + int getNumFiles(); + +private: + unsigned char* Filedata; + Uint32 IcnFilesize; + + Uint32 NumFiles; + + unsigned char* SSET; + Uint32 SSET_Length; + unsigned char* RPAL; + Uint32 RPAL_Length; + unsigned char* RTBL; + Uint32 RTBL_Length; + +}; + +#endif // ICNFILE_H_INCLUDED Added: branches/dunks/include/pakfile/Pakfile.h =================================================================== --- branches/dunks/include/pakfile/Pakfile.h (rev 0) +++ branches/dunks/include/pakfile/Pakfile.h 2006-07-25 06:24:26 UTC (rev 47) @@ -0,0 +1,35 @@ +#ifndef PAKFILE_H_INCLUDED +#define PAKFILE_H_INCLUDED + +#include <stdio.h> + +struct PakFileEntry { + long StartOffset; + long EndOffset; + char * Filename; +}; + +class Pakfile +{ +public: + Pakfile(char * Pakfilename); + ~Pakfile(); + + char * getFilename(int index); + + unsigned char *getFile(char *fname, int *size); + + inline int getNumFiles() {return NumFileEntry;}; + +private: + + void readIndex(); + + FILE * fPakFile; + char * Filename; + + PakFileEntry *FileEntry; + int NumFileEntry; +}; + +#endif // PAKFILE_H_INCLUDED Added: branches/dunks/include/pakfile/Shpfile.h =================================================================== --- branches/dunks/include/pakfile/Shpfile.h (rev 0) +++ branches/dunks/include/pakfile/Shpfile.h 2006-07-25 06:24:26 UTC (rev 47) @@ -0,0 +1,33 @@ +#ifndef SHPFILE_H_INCLUDED +#define SHPFILE_H_INCLUDED + +#include "SDL.h" +#include "pakfile/Decode.h" + +struct ShpfileEntry +{ + Uint32 StartOffset; + Uint32 EndOffset; +}; + +class Shpfile : public Decode +{ +public: + Shpfile(unsigned char * bufFiledata, int bufsize); + ~Shpfile(); + + SDL_Surface* getPicture(Uint32 IndexOfFile); + + inline int getNumFiles() {return (int) NumFiles;}; + +private: + void readIndex(); + + ShpfileEntry * Index; + unsigned char* Filedata; + Uint32 ShpFilesize; + Uint16 NumFiles; +}; + + +#endif //SHPFILE_H_INCLUDED Added: branches/dunks/include/pakfile/Wsafile.h =================================================================== --- branches/dunks/include/pakfile/Wsafile.h (rev 0) +++ branches/dunks/include/pakfile/Wsafile.h 2006-07-25 06:24:26 UTC (rev 47) @@ -0,0 +1,36 @@ +#ifndef WSAFILE_H_INCLUDED +#define WSAFILE_H_INCLUDED + +#include "pakfile/Decode.h" +#include "SDL.h" + +//extern SDL_Palette* palette; + +class Wsafile : public Decode +{ +public: + Wsafile(unsigned char * bufFiledata, int bufsize); + ~Wsafile(); + + SDL_Surface * getPicture(Uint32 FrameNumber); + + inline int getNumFrames() { return (int) NumFrames; }; + inline Uint32 getFramesPer1024ms() { return FramesPer1024ms; }; + +private: + void decodeFrames(); + + unsigned char *decodedFrames; + + + unsigned char* Filedata; + Uint32* Index; + Uint32 WsaFilesize; + + Uint16 NumFrames; + Uint16 SizeX; + Uint16 SizeY; + Uint32 FramesPer1024ms; +}; + +#endif // WSAFILE_H_INCLUDED Modified: branches/dunks/src/Application.cpp =================================================================== --- branches/dunks/src/Application.cpp 2006-07-24 22:30:32 UTC (rev 46) +++ branches/dunks/src/Application.cpp 2006-07-25 06:24:26 UTC (rev 47) @@ -25,6 +25,8 @@ #include "MainMenu.h" #include "DataFile.h" +#include "pakfile/Pakfile.h" + #define SCREEN_BPP 8 #define VERSION "0.94.1" @@ -100,8 +102,7 @@ //mutex_currentWidget = SDL_CreateMutex(); //mutex_playersJoined = SDL_CreateMutex(); - //LoadData(); - loadDataFile(); + LoadData(); m_rootWidget = new Container(); @@ -220,6 +221,18 @@ void Application::LoadData() { + Pakfile intropak ("intro.pak"); + int nfiles = intropak.getNumFiles(); + + for (int i=0; i!=nfiles; i++) + { + printf("found file %s\n", intropak.getFilename(i)); + }; + + + + //loadDataFile(); + /* fprintf(stdout, "loading data.....\n"); loadDataFile(); @@ -293,9 +306,9 @@ float dt = float(now - then) / 1000.0f; - if (m_rootState->Execute(dt) == -1) m_running = false; + //if (m_rootState->Execute(dt) == -1) m_running = false; - m_rootWidget->draw(m_screen); + //m_rootWidget->draw(m_screen); fnt->render("ABCDEFGHIJKLMOPQRSTUVWXYZ", m_screen, 10, 10, gpaloff); fnt->render("abcdefghijklmnopqrstuvwxz", m_screen, 10, 30, gpaloff); Modified: branches/dunks/src/SConscript =================================================================== --- branches/dunks/src/SConscript 2006-07-24 22:30:32 UTC (rev 46) +++ branches/dunks/src/SConscript 2006-07-25 06:24:26 UTC (rev 47) @@ -26,7 +26,14 @@ "gui2/Container.cpp", "gui2/Button.cpp", "gui2/VBox.cpp", - + + "pakfile/Cpsfile.cpp", + "pakfile/Decode.cpp", + "pakfile/Icnfile.cpp", + "pakfile/Pakfile.cpp", + "pakfile/Shpfile.cpp", + "pakfile/Wsafile.cpp", + "main.cpp", ] Added: branches/dunks/src/pakfile/Cpsfile.cpp =================================================================== --- branches/dunks/src/pakfile/Cpsfile.cpp (rev 0) +++ branches/dunks/src/pakfile/Cpsfile.cpp 2006-07-25 06:24:26 UTC (rev 47) @@ -0,0 +1,64 @@ +#include "pakfile/Cpsfile.h" +#include <SDL_endian.h> +#include <stdlib.h> +#include <string.h> + +#define SIZE_X 320 +#define SIZE_Y 240 + +//extern SDL_Palette* palette; + +Cpsfile::Cpsfile(unsigned char * bufFiledata, int bufsize) : Decode() +{ + Filedata = bufFiledata; + CpsFilesize = bufsize; +} + +Cpsfile::~Cpsfile() +{ + ; +}; + +SDL_Surface* Cpsfile::getPicture() +{ + unsigned char * ImageOut; + SDL_Surface *pic = NULL; + + // check for valid file + if( SDL_SwapLE16(*(unsigned short *)(Filedata + 2)) != 0x0004) { + return NULL; + } + + if( SDL_SwapLE16(*(unsigned short *)(Filedata + 4)) != 0xFA00) { + return NULL; + } + + Uint16 PaletteSize = SDL_SwapLE16(*((unsigned short *)(Filedata + 8))); + + if( (ImageOut = (unsigned char*) calloc(1,SIZE_X*SIZE_Y)) == NULL) { + return NULL; + } + + if(decode80(Filedata + 10 + PaletteSize,ImageOut,0) == -2) { + fprintf(stderr,"Error: Cannot decode Cps-File\n"); + } + + // create new picture surface + if((pic = SDL_CreateRGBSurface(SDL_SWSURFACE,SIZE_X,SIZE_Y,8,0,0,0,0))== NULL) { + return NULL; + } + + //SDL_SetColors(pic, palette->colors, 0, palette->ncolors); + SDL_LockSurface(pic); + + //Now we can copy line by line + for(int y = 0; y < SIZE_Y;y++) { + memcpy( ((char*) (pic->pixels)) + y * pic->pitch , ImageOut + y * SIZE_X, SIZE_X); + } + + SDL_UnlockSurface(pic); + + free(ImageOut); + + return pic; +}; Added: branches/dunks/src/pakfile/Decode.cpp =================================================================== --- branches/dunks/src/pakfile/Decode.cpp (rev 0) +++ branches/dunks/src/pakfile/Decode.cpp 2006-07-25 06:24:26 UTC (rev 47) @@ -0,0 +1,257 @@ +#include "pakfile/Decode.h" +#include <SDL_endian.h> +#include <stdlib.h> +#include <string.h> + +#include <SDL.h> + +Decode::Decode() +{ + ; +} + +Decode::~Decode() +{ + ; +}; + +int Decode::decode80(unsigned char *image_in, unsigned char *image_out,unsigned checksum) +{ + // + // should decode all the format80 stuff ;-) + // + + unsigned char *readp = image_in; + unsigned char *writep = image_out; + + uint a = 0; + uint b = 0; + uint c = 0; + uint d = 0; + uint e = 0; +// uint relposcount = 0; + uint megacounta = 0; + uint megacountb = 0; + uint megacountc = 0; + uint megacountd = 0; + uint megacounte = 0; + /* + 1 10cccccc + 2 0cccpppp p + 3 11cccccc p p + 4 11111110 c c v + 5 11111111 c c p p + */ + + while (1) { + if ((*readp & 0xc0) == 0x80) { + // + // 10cccccc (1) + // + unsigned count = readp[0] & 0x3f; + //printf("Cmd 1, count: %d\n", count); + megacounta += count; + if (!count) { +//#ifdef DEBUG +// pinfo80(); +//#endif + break; + } + readp++; + my_memcpy(writep, readp, count); + readp += count; + writep += count; + a++; + } else if ((*readp & 0x80) == 0x00) { + // + // 0cccpppp p (2) + // + unsigned count = ((readp[0] & 0x70) >> 4) + 3; + unsigned short relpos = (((unsigned short) (readp[0] & 0xf)) << 8) | ((unsigned short) readp[1]); + //printf("Cmd 2, count: %d, relpos: %d\n", count, relpos); + readp += 2; + megacountb += count; + my_memcpy(writep, writep - relpos, count); + writep += count; + b++; + } else if (*readp == 0xff) { + // + // 11111111 c c p p (5) + // + unsigned short count = SDL_SwapLE16(*((unsigned short *) (readp + 1))); + unsigned short pos = SDL_SwapLE16(*((unsigned short *) (readp + 3))); + //printf("Cmd 5, count: %d, pos: %d\n", count, pos); + readp += 5; + megacounte += count; + my_memcpy(writep, image_out + pos, count); + writep += count; + e++; + } else if (*readp == 0xfe) { + // + // 11111110 c c v(4) + // + unsigned short count = SDL_SwapLE16(*((unsigned short *) (readp + 1))); + unsigned char color = readp[3]; + //printf("Cmd 4, count: %d, color: %d\n", count, color); + readp += 4; + memset(writep, color, count); + writep += count; + megacountd += count; + d++; + } else if ((*readp & 0xc0) == 0xc0) { + // + // 11cccccc p p (3) + // + + unsigned short count = (*readp & 0x3f) + 3; + unsigned short pos = SDL_SwapLE16(*((unsigned short *) (readp + 1))); + //printf("Cmd 3, count: %d, pos: %d\n", count, pos); + readp += 3; + megacountc += count; + my_memcpy(writep, image_out + pos, count); + writep += count; + c++; + } else { + fprintf(stderr,"file contains unknown format80 command: %x\n",*readp); + exit(EXIT_FAILURE); + } + } + if (megacounta + megacountb + megacountc + megacountd + megacounte + != checksum) + return -1; + return 0; +} + +void Decode::my_memcpy(unsigned char *dst, unsigned char *src, unsigned cnt) +{ + /* Copies memory areas that may overlap byte by byte from small memory + * addresses to big memory addresses. Thus, already copied bytes can be + * copied again. */ + if (dst + cnt < src || src + cnt < dst) { + memcpy(dst, src, cnt); + return; + } + while (cnt--) { + *dst = *src; + dst++; + src++; + } +} + +void Decode::shp_correct_lf(unsigned char *in, unsigned char *out, int size) +{ + unsigned char *end = in + size; + while (in < end) { + unsigned char val = *in; + in++; + + if (val != 0) { + *out = val; + out++; + } else { + unsigned char count; + count = *in; + in++; + if (count == 0) { + return; + } + memset(out, 0, count); + + out += count; + } + } +}; + + +void Decode::apply_pal_offsets(unsigned char *offsets, unsigned char *data,unsigned int length) +{ + uint i; + for (i = 0; i < length; i ++) + data[i] = offsets[data[i]]; +}; + +int Decode::decode40(unsigned char *image_in, unsigned char *image_out) +{ + /* + 0 fill 00000000 c v + 1 copy 0ccccccc + 2 skip 10000000 c 0ccccccc + 3 copy 10000000 c 10cccccc + 4 fill 10000000 c 11cccccc v + 5 skip 1ccccccc + */ + + const unsigned char* readp = image_in; + unsigned char* writep = image_out; + Uint16 code; + Uint16 count; + while (1) + { + code = *readp++; + if (~code & 0x80) + { + //bit 7 = 0 + if (!code) + { + //command 0 (00000000 c v): fill + count = *readp++; + code = *readp++; + while (count--) + *writep++ ^= code; + } + else + { + //command 1 (0ccccccc): copy + count = code; + while (count--) + *writep++ ^= *readp++; + } + + } + else + { + //bit 7 = 1 + if (!(count = code & 0x7f)) + { + count = SDL_SwapLE16(*((Uint16*)readp)); + readp += 2; + code = count >> 8; + if (~code & 0x80) + { + //bit 7 = 0 + //command 2 (10000000 c 0ccccccc): skip + if (!count) + // end of image + break; + writep += count; + } + else + { + //bit 7 = 1 + count &= 0x3fff; + if (~code & 0x40) + { + //bit 6 = 0 + //command 3 (10000000 c 10cccccc): copy + while (count--) + *writep++ ^= *readp++; + } + else + { + //bit 6 = 1 + //command 4 (10000000 c 11cccccc v): fill + code = *readp++; + while (count--) + *writep++ ^= code; + } + } + } + else + { + //command 5 (1ccccccc): skip + writep += count; + } + } + } + return (writep - image_out); +}; Added: branches/dunks/src/pakfile/Icnfile.cpp =================================================================== --- branches/dunks/src/pakfile/Icnfile.cpp (rev 0) +++ branches/dunks/src/pakfile/Icnfile.cpp 2006-07-25 06:24:26 UTC (rev 47) @@ -0,0 +1,151 @@ +#include "pakfile/Icnfile.h" + +#include <SDL_endian.h> +#include <stdlib.h> +#include <string.h> + +#define SIZE_X 16 +#define SIZE_Y 16 + +//extern SDL_Palette* palette; + + +Icnfile::Icnfile(unsigned char * bufFiledata, int bufsize) +{ + Filedata = bufFiledata; + IcnFilesize = bufsize; + + + // check if we can access first section; + if(IcnFilesize < 0x20) { + fprintf(stderr, "ERROR: Invalid ICN-File: No SSET-Section found!\n"); + exit(EXIT_FAILURE); + } + + + SSET = Filedata+0x18; + + // check SSET-Section + if( (SSET[0] != 'S') + || (SSET[1] != 'S') + || (SSET[2] != 'E') + || (SSET[3] != 'T')) { + fprintf(stderr, "ERROR: Invalid ICN-File: No SSET-Section found!\n"); + exit(EXIT_FAILURE); + } + + SSET_Length = SDL_SwapBE32( *((Uint32*) (SSET + 4))) - 8; + + SSET += 16; + + if(Filedata + IcnFilesize < SSET + SSET_Length) { + fprintf(stderr, "ERROR: Invalid ICN-File: SSET-Section is bigger than ICN-File!\n"); + exit(EXIT_FAILURE); + } + + RPAL = SSET + SSET_Length; + + // check RPAL-Section + if( (RPAL[0] != 'R') + || (RPAL[1] != 'P') + || (RPAL[2] != 'A') + || (RPAL[3] != 'L')) { + fprintf(stderr, "ERROR: Invalid ICN-File: No RPAL-Section found!\n"); + exit(EXIT_FAILURE); + } + + RPAL_Length = SDL_SwapBE32( *((Uint32*) (RPAL + 4))); + + RPAL += 8; + + if(Filedata + IcnFilesize < RPAL + RPAL_Length) { + fprintf(stderr, "ERROR: Invalid ICN-File: RPAL-Section is bigger than ICN-File!\n"); + exit(EXIT_FAILURE); + } + + RTBL = RPAL + RPAL_Length; + + // check RTBL-Section + if( (RTBL[0] != 'R') + || (RTBL[1] != 'T') + || (RTBL[2] != 'B') + || (RTBL[3] != 'L')) { + fprintf(stderr, "ERROR: Invalid ICN-File: No RTBL-Section found!\n"); + exit(EXIT_FAILURE); + } + + + + RTBL_Length = SDL_SwapBE32( *((Uint32*) (RTBL + 4))); + + RTBL += 8; + + if(Filedata + IcnFilesize < RTBL + RTBL_Length) { + fprintf(stderr, "ERROR: Invalid ICN-File: RTBL-Section is bigger than ICN-File!\n"); + exit(EXIT_FAILURE); + } + + NumFiles = SSET_Length / ((SIZE_X * SIZE_Y) / 2); + + if(RTBL_Length < NumFiles) { + fprintf(stderr, "ERROR: Invalid ICN-File: RTBL-Section is too small!\n"); + exit(EXIT_FAILURE); + } +} + +Icnfile::~Icnfile() +{ + ; +}; + +SDL_Surface* Icnfile::getPicture(Uint32 IndexOfFile) { + SDL_Surface * pic; + + if(IndexOfFile >= NumFiles) { + return NULL; + } + + // check if palette is in range + if(RTBL[IndexOfFile] >= RPAL_Length / 16) { + return NULL; + } + + unsigned char* palettestart = RPAL + (16 * RTBL[IndexOfFile]); + + unsigned char * filestart = SSET + (IndexOfFile * ((SIZE_X * SIZE_Y)/2)); + + // create new picture surface + if((pic = SDL_CreateRGBSurface(SDL_SWSURFACE,SIZE_X,SIZE_Y,8,0,0,0,0))== NULL) { + return NULL; + } + + //SDL_SetColors(pic, palette->colors, 0, palette->ncolors); + SDL_LockSurface(pic); + + //Now we can copy to surface + unsigned char *dest = (unsigned char*) (pic->pixels); + unsigned char pixel; + for(int y = 0; y < SIZE_Y;y++) { + for(int x = 0; x < SIZE_X; x+=2) { + pixel = filestart[ (y*SIZE_X + x) / 2]; + pixel = pixel >> 4; + dest[x] = palettestart[pixel]; + + pixel = filestart[ (y*SIZE_X + x) / 2]; + pixel = pixel & 0x0F; + dest[x+1] = palettestart[pixel]; + } + dest += pic->pitch; + } + + SDL_UnlockSurface(pic); + + printf("File Nr.: %d (Size: %dx%d)\n",IndexOfFile,SIZE_X,SIZE_Y); + + return pic; +}; + +int Icnfile::getNumFiles() +{ + return NumFiles; +}; Added: branches/dunks/src/pakfile/Pakfile.cpp =================================================================== --- branches/dunks/src/pakfile/Pakfile.cpp (rev 0) +++ branches/dunks/src/pakfile/Pakfile.cpp 2006-07-25 06:24:26 UTC (rev 47) @@ -0,0 +1,163 @@ +#include "pakfile/Pakfile.h" +#include <stdlib.h> +#include <string.h> +#include <SDL_endian.h> + +Pakfile::Pakfile(char *Pakfilename) +{ + FileEntry = NULL; + NumFileEntry = 0; + + if(Pakfilename == NULL) { + fprintf(stderr,"Pakfile::Pakfile(): Pakfilename == NULL\n"); + exit(EXIT_FAILURE); + } + + if((Filename = (char*) malloc(strlen(Pakfilename)+1)) == NULL) { + perror("Pakfile::Pakfile()"); + exit(EXIT_FAILURE); + } + + strcpy(Filename,Pakfilename); + + if( (fPakFile = fopen(Filename, "rb")) == NULL) { + perror("Pakfile::Pakfile()"); + exit(EXIT_FAILURE); + } + + readIndex(); +}; + +Pakfile::~Pakfile() +{ + if(fPakFile != NULL) { + fclose(fPakFile); + } + + for(int i=0;i<NumFileEntry;i++) { + free(FileEntry[i].Filename); + } + + free(FileEntry); +}; + +void Pakfile::readIndex() +{ + int i; + int startoffset; + char name[256]; + + + while(1) { + if(fread((void*) &startoffset, 4, 1,fPakFile) != 1) { + perror("fread()"); + exit(EXIT_FAILURE); + } + + //pak-files are always little endian encoded + startoffset = SDL_SwapLE32(startoffset); + + + if(startoffset == 0) { + break; + } + + if((FileEntry = (PakFileEntry*) realloc(FileEntry,(NumFileEntry+1) * sizeof(PakFileEntry))) == NULL) { + perror("realloc()"); + exit(EXIT_FAILURE); + } + + FileEntry[NumFileEntry].StartOffset = startoffset; + + i = 0; + while(1) { + if(fread(&name[i],1,1,fPakFile) != 1) { + perror("fread()"); + exit(EXIT_FAILURE); + } + + i++; + + if(name[i-1] == '\0') { + break; + } + + if(i >= 256) { + fprintf(stderr,"Pakfile::readIndex(): Filename in Pakfile too long\n"); + exit(EXIT_FAILURE); + } + } + + if((FileEntry[NumFileEntry].Filename = (char *) malloc(i)) == NULL) { + perror("malloc()"); + exit(EXIT_FAILURE); + } + + strcpy(FileEntry[NumFileEntry].Filename,name); + + if(NumFileEntry > 0) { + FileEntry[NumFileEntry - 1].EndOffset = startoffset - 1; + } + + NumFileEntry++; + } + + if(fseek(fPakFile,0,SEEK_END) != 0) { + perror("fseek()"); + exit(EXIT_FAILURE); + } + + if((FileEntry[NumFileEntry-1].EndOffset = (ftell(fPakFile) - 1)) < 0) { + perror("ftell()"); + exit(EXIT_FAILURE); + } +}; + +char * Pakfile::getFilename(int index) { + if((index >= NumFileEntry) || (index < 0)) + return NULL; + + return FileEntry[index].Filename; +}; + +unsigned char *Pakfile::getFile(char *fname, int *size) +{ + int Index = -1; + + for(int i=0;i<NumFileEntry;i++) { + if(strcmp(FileEntry[i].Filename,fname) == 0) { + Index = i; + break; + } + } + + if(Index == -1) { + return NULL; + } + + int filesize = FileEntry[Index].EndOffset - FileEntry[Index].StartOffset + 1; + + if(filesize == 0) { + return NULL; + } + + unsigned char * content; + + if( (content = (unsigned char*) malloc(filesize)) == NULL) { + return NULL; + } + + if(fseek(fPakFile,FileEntry[Index].StartOffset,SEEK_SET) != 0) { + return NULL; + } + + if(fread(content,filesize,1,fPakFile) != 1) { + return NULL; + } + + if(size != NULL) { + *size = filesize; + } + + return content; +}; Added: branches/dunks/src/pakfile/SConscript =================================================================== --- branches/dunks/src/pakfile/SConscript (rev 0) +++ branches/dunks/src/pakfile/SConscript 2006-07-25 06:24:26 UTC (rev 47) @@ -0,0 +1,44 @@ +Import('env') + +from glob import glob + +gui_sources = glob("gui/*.cpp") +structure_sources = glob("structures/*.cpp") +unit_sources = glob("units/*.cpp") +base_sources = glob("*.cpp") + +all_sources = gui_sources + structure_sources + unit_sources + base_sources + +#all_sources.remove('Menu.cpp') + +all_sources = [ "Application.cpp", + "Settings.cpp", + "Font.cpp", + "State.cpp", + "DataFile.cpp", + + "TopLevelState.cpp", + "MenuBase.cpp", + "MainMenu.cpp", + "SingleMenu.cpp", + + "gui2/Widget.cpp", + "gui2/Container.cpp", + "gui2/Button.cpp", + "gui2/VBox.cpp", + + "pakfile/CpsFile.cpp", + "pakfile/Decode.cpp", + "pakfile/IcnFile.cpp", + "pakfile/Pakfile.cpp", + "pakfile/Shpfile.cpp", + "pakfile/Wsafile.cpp", + + "main.cpp", + ] + +#all_sources += [env.Object('SDL_rwops_zzip.c')] + +env.Program("../dunelegacy", all_sources) + + Added: branches/dunks/src/pakfile/Shpfile.cpp =================================================================== --- branches/dunks/src/pakfile/Shpfile.cpp (rev 0) +++ branches/dunks/src/pakfile/Shpfile.cpp 2006-07-25 06:24:26 UTC (rev 47) @@ -0,0 +1,198 @@ + +#include "pakfile/Shpfile.h" +#include <SDL_endian.h> +#include <stdlib.h> +#include <string.h> + +//extern SDL_Palette* palette; + +Shpfile::Shpfile(unsigned char * bufFiledata, int bufsize) : Decode() +{ + Filedata = bufFiledata; + ShpFilesize = bufsize; + Index = NULL; + readIndex(); +}; + +Shpfile::~Shpfile() +{ + if(Index != NULL) { + free(Index); + } +}; + +SDL_Surface *Shpfile::getPicture(Uint32 IndexOfFile) +{ + SDL_Surface *pic = NULL; + unsigned char *DecodeDestination = NULL; + unsigned char *ImageOut = NULL; + + if(IndexOfFile >= NumFiles) { + return NULL; + } + + unsigned char * Fileheader = Filedata + Index[IndexOfFile].StartOffset; + + unsigned char type = Fileheader[0]; + + unsigned char sizeY = Fileheader[2]; + unsigned char sizeX = Fileheader[3]; + + /* size and also checksum */ + Uint16 size = SDL_SwapLE16(*((Uint16*) (Fileheader + 8))); + + + printf("File Nr.: %d (Size: %dx%d)\n",IndexOfFile,sizeX,sizeY); + /* + printf("Type: %d\n",type); + printf("SizeX: %d SizeY: %d\n",sizeX,sizeY); + printf("Size: %d Filesize: %d\n",size,Index[IndexOfFile].EndOffset-Index[IndexOfFile].StartOffset); + fflush(stdout); + */ + + if((ImageOut = (unsigned char*) calloc(1,sizeX*sizeY)) == NULL) { + return NULL; + } + + switch(type) { + + case 0: + { + if( (DecodeDestination = (unsigned char*) calloc(1,size)) == NULL) { + free(ImageOut); + return NULL; + } + + if(decode80(Fileheader + 10,DecodeDestination,size) == -1) { + fprintf(stderr,"Warning: Checksum-Error in Shp-File\n"); + } + + shp_correct_lf(DecodeDestination,ImageOut, size); + + free(DecodeDestination); + } break; + + case 1: + { + if( (DecodeDestination = (unsigned char*) calloc(1,size)) == NULL) { + free(ImageOut); + return NULL; + } + + if(decode80(Fileheader + 10 + 16,DecodeDestination,size) == -1) { + fprintf(stderr,"Warning: Checksum-Error in Shp-File\n"); + } + + shp_correct_lf(DecodeDestination, ImageOut, size); + + apply_pal_offsets(Fileheader + 10,ImageOut,sizeX*sizeY); + + free(DecodeDestination); + } break; + + case 2: + { + shp_correct_lf(Fileheader+10, ImageOut,size); + } break; + + case 3: + { + + shp_correct_lf(Fileheader + 10 + 16, ImageOut,size); + + apply_pal_offsets(Fileheader + 10,ImageOut,sizeX*sizeY); + } break; + + default: + { + fprintf(stderr,"Error: Type %d in SHP-Files not supported!\n",type); + exit(EXIT_FAILURE); + } + } + + // create new picture surface + if((pic = SDL_CreateRGBSurface(SDL_SWSURFACE,sizeX,sizeY,8,0,0,0,0))== NULL) { + return NULL; + } + + //SDL_SetColors(pic, palette->colors, 0, palette->ncolors); + SDL_LockSurface(pic); + + //Now we can copy line by line + for(int y = 0; y < sizeY;y++) { + memcpy( ((char*) (pic->pixels)) + y * pic->pitch , ImageOut + y * sizeX, sizeX); + } + + SDL_UnlockSurface(pic); + + if(ImageOut != NULL) { + free(ImageOut); + } + + return pic; +}; + +void Shpfile::readIndex() +{ + // First get number of files in shp-file + NumFiles = SDL_SwapLE16( ((Uint16*) Filedata)[0]); + + if(NumFiles == 0) { + fprintf(stderr, "Error: There is no file in this shp-File!\n"); + exit(EXIT_FAILURE); + } + + if(NumFiles == 1) { + /* files with only one image might be different */ + + // create array with one entry + if((Index = (ShpfileEntry*) malloc(sizeof(ShpfileEntry) * 1)) == NULL) { + perror("Shpfile::readIndex"); + exit(EXIT_FAILURE); + } + + if (((Uint16*) Filedata)[2] != 0) { + /* File has special header with only 2 byte offset */ + + Index[0].StartOffset = ((Uint32) SDL_SwapLE16(((Uint16*) Filedata)[1])); + Index[0].EndOffset = ((Uint32) SDL_SwapLE16(((Uint16*) Filedata)[2])) - 1; + + + } else { + /* File has normal 4 byte offsets */ + Index[0].StartOffset = ((Uint32) SDL_SwapLE32(*((Uint32*) (Filedata+2)))) + 2; + Index[0].EndOffset = ((Uint32) SDL_SwapLE16(((Uint16*) Filedata)[3])) - 1 + 2; + } + + } else { + /* File contains more than one image */ + + if( ShpFilesize < (Uint32) ((NumFiles * 4) + 2 + 2)) { + fprintf(stderr, "Error:Shp-File-Header is not complete! Header should be %d bytes big, but Shp-File is only %d bytes long.\n",(NumFiles * 4) + 2 + 2,ShpFilesize); + exit(EXIT_FAILURE); + } + + // create array + if((Index = (ShpfileEntry*) malloc(sizeof(ShpfileEntry) * NumFiles)) == NULL) { + perror("Shpfile::readIndex"); + exit(EXIT_FAILURE); + } + + // now fill Index with start and end-offsets + for(int i = 0; i < NumFiles; i++) { + Index[i].StartOffset = SDL_SwapLE32( ((Uint32*)(Filedata+2))[i]) + 2; + + if(i > 0) { + Index[i-1].EndOffset = Index[i].StartOffset - 1; + + if(Index[i-1].EndOffset > ShpFilesize) { + fprintf(stderr, "Error:The File with Index %d, goes until byte %d, but this SHP-File is only %d bytes big.\n",i,Index[i-1].EndOffset,ShpFilesize); + exit(EXIT_FAILURE); + } + } + } + + // Add the EndOffset for the last file + Index[NumFiles-1].EndOffset = ((Uint32) SDL_SwapLE16( *((Uint16*) (Filedata + 2 + (NumFiles * 4))))) - 1 + 2; + } +}; Added: branches/dunks/src/pakfile/Wsafile.cpp =================================================================== --- branches/dunks/src/pakfile/Wsafile.cpp (rev 0) +++ branches/dunks/src/pakfile/Wsafile.cpp 2006-07-25 06:24:26 UTC (rev 47) @@ -0,0 +1,101 @@ +#include "pakfile/Wsafile.h" +#include <SDL_endian.h> +#include <stdlib.h> +#include <string.h> + +Wsafile::Wsafile(unsigned char * bufFiledata, int bufsize) : Decode() +{ + Filedata = bufFiledata; + WsaFilesize = bufsize; + + if(WsaFilesize < 10) { + fprintf(stderr, "Error: No valid WSA-File: File too small!\n"); + exit(EXIT_FAILURE); + } + + NumFrames = SDL_SwapLE16(*((Uint16*) Filedata) ); + SizeX = SDL_SwapLE16(*((Uint16*) (Filedata + 2)) ); + SizeY = SDL_SwapLE16(*((Uint16*) (Filedata + 4)) ); + + if( ((unsigned short *) Filedata)[4] == 0) { + Index = (Uint32 *) (Filedata + 10); + FramesPer1024ms = SDL_SwapLE32( *((Uint32*) (Filedata+6)) ); + } else { + Index = (Uint32 *) (Filedata + 8); + FramesPer1024ms = SDL_SwapLE16( *((Uint16*) (Filedata+6)) ); + } + + if(Index[0] == 0) { + Index++; + NumFrames--; + } + + if(Filedata + WsaFilesize < (((unsigned char *) Index) + 4 * NumFrames)) { + fprintf(stderr, "Error: No valid WSA-File: File too small!\n"); + exit(EXIT_FAILURE); + } + + if( (decodedFrames = (unsigned char*) calloc(1,SizeX*SizeY*NumFrames)) == NULL) { + fprintf(stderr, "Error: Unable to allocate memory for decoded WSA-Frames!\n"); + exit(EXIT_FAILURE); + } + + decodeFrames(); +}; + +Wsafile::~Wsafile() +{ + free(decodedFrames); +}; + +SDL_Surface * Wsafile::getPicture(Uint32 FrameNumber) +{ + if(FrameNumber >= NumFrames) { + return NULL; + } + + SDL_Surface * pic; + unsigned char * Image = decodedFrames + (FrameNumber * SizeX * SizeY); + + // create new picture surface + if((pic = SDL_CreateRGBSurface(SDL_SWSURFACE,SizeX,SizeY,8,0,0,0,0))== NULL) { + return NULL; + } + + printf("File Nr.: %d (Size: %dx%d)\n",FrameNumber,SizeX,SizeY); + + //SDL_SetColors(pic, palette->colors, 0, palette->ncolors); + SDL_LockSurface(pic); + + //Now we can copy line by line + for(int y = 0; y < SizeY;y++) { + memcpy( ((char*) (pic->pixels)) + y * pic->pitch , Image + y * SizeX, SizeX); + } + + SDL_UnlockSurface(pic); + + return pic; + +}; + +void Wsafile::decodeFrames() +{ + unsigned char *dec80; + + for(int i=0;i<NumFrames;i++) { + if( (dec80 = (unsigned char*) calloc(1,SizeX*SizeY*2)) == NULL) { + fprintf(stderr, "Error: Unable to allocate memory for decoded WSA-Frames!\n"); + exit(EXIT_FAILURE); + } + + decode80(Filedata + SDL_SwapLE32(Index[i]), dec80, 0); + + decode40(dec80, decodedFrames + i * SizeX * SizeY); + + free(dec80); + + if (i < NumFrames - 1) { + memcpy(decodedFrames + (i+1) * SizeX * SizeY, decodedFrames + i * SizeX * SizeY,SizeX * SizeY); + } + } +}; Added: branches/dunks/src/pakfile/main.cpp =================================================================== --- branches/dunks/src/pakfile/main.cpp (rev 0) +++ branches/dunks/src/pakfile/main.cpp 2006-07-25 06:24:26 UTC (rev 47) @@ -0,0 +1,481 @@ +/* Created by Anjuta version 1.2.4 */ +/* This file will not be overwritten */ + +#include <iostream> +#include <string.h> +#include <SDL.h> +#include "Pakfile.h" +#include "Shpfile.h" +#include "Cpsfile.h" +#include "Wsafile.h" +#include "Icnfile.h" + +SDL_Surface* screen; +SDL_Palette* palette; +bool quiting = false; +int ShpIndex = 0; +int WsaIndex = 0; +int IcnIndex = 0; +int PakIndex = 0; + +SDL_Surface* picture = NULL; + +Pakfile* myPakfile = NULL; +Shpfile* myShpfile = NULL; +Cpsfile* myCpsfile = NULL; +Wsafile* myWsafile = NULL; +Icnfile* myIcnfile = NULL; +unsigned char * filedata = NULL; + +void showShp(int index) +{ + if(myShpfile == NULL) { + return; + } + + if(picture != NULL) { + SDL_FreeSurface(picture); + picture = NULL; + } + + + + picture = myShpfile->getPicture(index); + + if(picture == NULL) { + fprintf(stderr,"Cannot load picture %d\n",index); + } +} + +void showWsa(int index) +{ + if(myWsafile == NULL) { + return; + } + + if(picture != NULL) { + SDL_FreeSurface(picture); + picture = NULL; + } + + + + picture = myWsafile->getPicture(index); + + if(picture == NULL) { + fprintf(stderr,"Cannot load picture %d\n",index); + } +} + +void showIcn(int index) +{ + if(myIcnfile == NULL) { + return; + } + + if(picture != NULL) { + SDL_FreeSurface(picture); + picture = NULL; + } + + picture = myIcnfile->getPicture(index); + + if(picture == NULL) { + fprintf(stderr,"Cannot load picture %d\n",index); + } +} + +void showOtherFile(char *filename) { + if(myShpfile != NULL) { + delete myShpfile; + } + + if(myCpsfile != NULL) { + delete myCpsfile; + } + + if(myWsafile != NULL) { + delete myWsafile; + } + + if(myIcnfile != NULL) { + delete myIcnfile; + } + + if(filedata != NULL) { + free(filedata); + } + + int bufsize; + + if((filedata = myPakfile->getFile(filename,&bufsize)) == NULL) { + fprintf(stderr,"Error: Cannot open %s\n",filename); + exit(EXIT_FAILURE); + } + + if(strstr(filename,".SHP") != 0) { + myCpsfile = NULL; + myWsafile = NULL; + myIcnfile = NULL; + if( (myShpfile = new Shpfile(filedata,bufsize)) == NULL) { + fprintf(stderr,"Error: Cannot open Shp-File %s\n",filename); + exit(EXIT_FAILURE); + } + } else if (strstr(filename,".CPS") != 0) { + myShpfile = NULL; + myWsafile = NULL; + myIcnfile = NULL; + if( (myCpsfile = new Cpsfile(filedata,bufsize)) == NULL) { + fprintf(stderr,"Error: Cannot open Cps-File %s\n",filename); + exit(EXIT_FAILURE); + } + } else if (strstr(filename,".WSA") != 0) { + myShpfile = NULL; + myCpsfile = NULL; + myIcnfile = NULL; + if( (myWsafile = new Wsafile(filedata,bufsize)) == NULL) { + fprintf(stderr,"Error: Cannot open Wsa-File %s\n",filename); + exit(EXIT_FAILURE); + } + } else if (strstr(filename,".ICN") != 0) { + myShpfile = NULL; + myCpsfile = NULL; + myWsafile = NULL; + if( (myIcnfile = new Icnfile(filedata,bufsize)) == NULL) { + fprintf(stderr,"Error: Cannot open Icn-File %s\n",filename); + exit(EXIT_FAILURE); + } + } else { + return; + } + + + + printf("\nOpening File %s\n",filename); + fflush(stdout); + + if(myShpfile != NULL) { + ShpIndex = 0; + showShp(ShpIndex); + } else if (myCpsfile != NULL) { + if(picture != NULL) { + SDL_FreeSurface(picture); + picture = NULL; + } + picture = myCpsfile->getPicture(); + } else if (myWsafile != NULL) { + WsaIndex = 0; + showWsa(WsaIndex); + } else if (myIcnfile != NULL) { + IcnIndex = 0; + showIcn(IcnIndex); + } +} + +char * getNextFileInPak() { + int oldPakIndex = PakIndex; + char * Filename; + + PakIndex++; + if(PakIndex >= myPakfile->getNumFiles()) { + PakIndex = 0; + } + + do { + if( (Filename = myPakfile->getFilename(PakIndex)) == NULL) { + fprintf(stderr,"ERROR: Pakfile::getFilename() returned NULL.\n"); + exit(EXIT_FAILURE); + } + + if(strstr(Filename,".SHP") != 0) { + return Filename; + } else if (strstr(Filename,".CPS") != 0) { + return Filename; + } else if (strstr(Filename,".WSA") != 0) { + return Filename; + } else if (strstr(Filename,".ICN") != 0) { + return Filename; + }else { + printf("Skipping %s\n",Filename); + } + + + PakIndex++; + if(PakIndex >= myPakfile->getNumFiles()) { + PakIndex = 0; + } + } while(oldPakIndex != PakIndex); + + return NULL; +} + +char * getPrevFileInPak() { + int oldPakIndex = PakIndex; + PakIndex--; + char * Filename; + + if(PakIndex < 0) { + PakIndex = myPakfile->getNumFiles() - 1; + } + + do { + + if( (Filename = myPakfile->getFilename(PakIndex)) == NULL) { + fprintf(stderr,"ERROR: Pakfile::getFilename() returned NULL.\n"); + exit(EXIT_FAILURE); + } + + if(strstr(Filename,".SHP") != 0) { + return Filename; + } else if (strstr(Filename,".CPS") != 0) { + return Filename; + } else if (strstr(Filename,".WSA") != 0) { + return Filename; + } else if (strstr(Filename,".ICN") != 0) { + return Filename; + }else { + printf("Skipping %s\n",Filename); + } + + PakIndex--; + if(PakIndex < 0) { + PakIndex = myPakfile->getNumFiles() - 1; + } + } while(oldPakIndex != PakIndex); + + return NULL; +} + +int main(int argc, char ** argv) +{ + bool fullscreen = false; + + + switch(argc) + { + case 2: + { + } break; + + case 3: + { + if ((argc == 3) & (strcmp(argv[1],"--fullscreen") == 0)) { + fullscreen = true; + } else { + printf("Usage:\n Pakfile [--fullscreen] filename.pak\n"); + exit(EXIT_SUCCESS); + } + } break; + + default: + { + if((argc > 3) || (argc < 2)) { + printf("Usage:\n Pakfile [--fullscreen] filename.pak\n"); + exit(EXIT_SUCCESS); + } + } break; + } + + + + + + + SDL_Event event; + + if (SDL_Init(SDL_INIT_VIDEO | SDL_INIT_NOPARACHUTE) < 0) + { + fprintf(stderr, "ERROR: Couldn't initialise SDL: %s\n", SDL_GetError()); + exit(1); + } + SDL_EnableUNICODE(1); + + SDL_WM_SetCaption("Pakfileviewer", "Pakfileviewer"); + + + // Load palette + SDL_Surface* paletteSurf = SDL_LoadBMP("Palette.bmp"); + if(paletteSurf == NULL) { + fprintf(stderr, "ERROR: Couldn't load Palette.bmp: %s\n", SDL_GetError()); + exit(EXIT_FAILURE); + } + + if((palette = new SDL_Palette) == NULL) { + fprintf(stderr, "ERROR: Couldn't allocate new SDL_Palette.\n"); + exit(EXIT_FAILURE); + } + + palette->ncolors = paletteSurf->format->palette->ncolors; + if((palette->colors = new SDL_Color[palette->ncolors]) == NULL) { + fprintf(stderr, "ERROR: Couldn't allocate new SDL_Color.\n"); + exit(EXIT_FAILURE); + } + memcpy(palette->colors, paletteSurf->format->palette->colors, sizeof(SDL_Color) * palette->ncolors); + SDL_FreeSurface(paletteSurf); + + // init Screen + if( (screen = SDL_SetVideoMode(640, 480, 8, (fullscreen ? SDL_FULLSCREEN : 0) )) == NULL) { + fprintf(stderr, "ERROR: Couldn't set video mode: %s\n", SDL_GetError()); + exit(EXIT_FAILURE); + } + SDL_SetColors(screen, palette->colors, 0, palette->ncolors); + + + // open pakfile + if( (myPakfile = new Pakfile( ((argc == 2) ? argv[1] : argv[2]))) == NULL) { + + } + + + char *FName; + + if((FName = getNextFileInPak()) != NULL) { + showOtherFile(FName); + } else { + fprintf(stderr,"Error: Pakfile contains no images!\n"); + exit(EXIT_FAILURE); + } + + + // main Loop + while(!quiting) { + + + SDL_FillRect(screen,NULL,0); + + if(picture != NULL) { + SDL_Rect dest; + dest.x = 0; + dest.y = 0; + dest.w = picture->w; + dest.h = picture->h; + + SDL_BlitSurface(picture,&dest,screen,&dest); + } + + SDL_Flip(screen); + + // do input + while(SDL_PollEvent(&event)) { + switch (event.type) + { + case (SDL_KEYUP): + { + switch(event.key.keysym.sym) + { + case SDLK_ESCAPE: + { + quiting = true; + } break; + + case SDLK_DOWN: + { + if(myShpfile != NULL) { + ShpIndex++; + if(myShpfile) { + if(ShpIndex == myShpfile->getNumFiles()) { + ShpIndex = 0; + } + } else { + ShpIndex = 0; + } + + showShp(ShpIndex); + } else if(myWsafile != NULL) { + WsaIndex++; + if(myWsafile) { + if(WsaIndex == myWsafile->getNumFrames()) { + WsaIndex = 0; + } + } else { + WsaIndex = 0; + } + showWsa(WsaIndex); + } else if(myIcnfile != NULL) { + IcnIndex++; + if(myIcnfile) { + if(IcnIndex == myIcnfile->getNumFiles()) { + IcnIndex = 0; + } + } else { + IcnIndex = 0; + } + showIcn(IcnIndex); + } + } break; + + case SDLK_UP: + { + if(myShpfile != NULL) { + ShpIndex--; + if(ShpIndex < 0) { + if(myShpfile) { + ShpIndex = myShpfile->getNumFiles() - 1; + } else { + ShpIndex = 0; + } + } + showShp(ShpIndex); + } else if(myWsafile != NULL) { + WsaIndex--; + if(WsaIndex < 0) { + if(myWsafile) { + WsaIndex = myWsafile->getNumFrames() - 1; + } else { + WsaIndex = 0; + } + } + showWsa(WsaIndex); + } + else if (myIcnfile != NULL) { + IcnIndex--; + if(IcnIndex < 0) { + if(myIcnfile) { + IcnIndex = myIcnfile->getNumFiles() - 1; + } else { + IcnIndex = 0; + } + } + showIcn(IcnIndex); + } + } break; + + case SDLK_LEFT: + { + char * Filename = getPrevFileInPak(); + if(Filename != NULL) { + showOtherFile(Filename); + } + } break; + + case SDLK_RIGHT: + { + char * Filename = getNextFileInPak(); + if(Filename != NULL) { + showOtherFile(Filename); + } + } break; + + default: + { + ; + } break; + } + } break; + + default: + { + ; + } break; + } + } + } + + delete myPakfile; + delete myShpfile; + free(filedata); + + SDL_Quit(); + + return 0; +} This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <dun...@us...> - 2006-07-26 16:37:01
|
Revision: 52 Author: dunkfordyce Date: 2006-07-26 09:36:44 -0700 (Wed, 26 Jul 2006) ViewCVS: http://svn.sourceforge.net/dunelegacy/?rev=52&view=rev Log Message: ----------- windows stuff Modified Paths: -------------- branches/dunks/SConstruct branches/dunks/include/ResMan.h branches/dunks/src/Application.cpp branches/dunks/src/ResMan.cpp branches/dunks/src/SConscript branches/dunks/src/Settings.cpp branches/dunks/src/pakfile/Decode.cpp branches/dunks/src/pakfile/Pakfile.cpp Modified: branches/dunks/SConstruct =================================================================== --- branches/dunks/SConstruct 2006-07-25 22:10:09 UTC (rev 51) +++ branches/dunks/SConstruct 2006-07-26 16:36:44 UTC (rev 52) @@ -26,7 +26,7 @@ env.ParseConfig('sdl-config --cflags --libs') env.ParseConfig('pkg-config --cflags --libs zziplib') env.Append(CCFLAGS=["-Wall"]) #, "-Werror"]) - #env.Append(CCFLAGS=["-Wall", "-Werror", "-O2", "-ffast-math", "-funroll-loops"]) + env.Append(CCFLAGS=["-Wall", "-Werror", "-O2", "-ffast-math", "-funroll-loops"]) #env.Append(LINKFLAGS = ["-ffast-math"]) if 1: @@ -34,10 +34,10 @@ else: env.Append(LIBS = ["zzipdll", "zdll", "SDLmain"]) env.Append(LINKFLAGS = ["/SUBSYSTEM:CONSOLE"]) - env.Append(CCFLAGS = ["/MD", "/O2"]) + env.Append(CCFLAGS = ["/O2", "/EHsc", "/MD", "/Op"]) env.Append(LIBS = [ "SDL", - "SDL_mixer", + "SDL_mixer", "SDL_image", "SDL_net", "SDL_ttf", Modified: branches/dunks/include/ResMan.h =================================================================== --- branches/dunks/include/ResMan.h 2006-07-25 22:10:09 UTC (rev 51) +++ branches/dunks/include/ResMan.h 2006-07-26 16:36:44 UTC (rev 52) @@ -65,3 +65,4 @@ #endif // DUNE_RESMAN_H + Modified: branches/dunks/src/Application.cpp =================================================================== --- branches/dunks/src/Application.cpp 2006-07-25 22:10:09 UTC (rev 51) +++ branches/dunks/src/Application.cpp 2006-07-26 16:36:44 UTC (rev 52) @@ -26,7 +26,7 @@ #include "IntroState.h" #include "DataFile.h" -#include "pakfile/Pakfile.h" +//#include "pakfile/Pakfile.h" #include "ResMan.h" @@ -252,7 +252,6 @@ //Pakfile intropak ("intro.pak"); //int nfiles = intropak.getNumFiles(); - //for (int i=0; i!=nfiles; i++) //{ // printf("found file %s\n", intropak.getFilename(i)); Modified: branches/dunks/src/ResMan.cpp =================================================================== --- branches/dunks/src/ResMan.cpp 2006-07-25 22:10:09 UTC (rev 51) +++ branches/dunks/src/ResMan.cpp 2006-07-26 16:36:44 UTC (rev 52) @@ -1,8 +1,10 @@ +#include "boost/filesystem/path.hpp" +#include "boost/filesystem/operations.hpp" + #include "ResMan.h" #include "Settings.h" -#include "boost/filesystem/operations.hpp" // includes boost/filesystem/path.hpp -#include "boost/filesystem/fstream.hpp" // ditto +//#include "boost/filesystem/fstream.hpp" // ditto #include <assert.h> @@ -138,4 +140,3 @@ return res->readFile(filename.c_str(), buf); }; - Modified: branches/dunks/src/SConscript =================================================================== --- branches/dunks/src/SConscript 2006-07-25 22:10:09 UTC (rev 51) +++ branches/dunks/src/SConscript 2006-07-26 16:36:44 UTC (rev 52) @@ -41,6 +41,8 @@ "main.cpp", ] +#all_sources = ["ResMan.cpp"] + #all_sources += [env.Object('SDL_rwops_zzip.c')] env.Program("../dunelegacy", all_sources) Modified: branches/dunks/src/Settings.cpp =================================================================== --- branches/dunks/src/Settings.cpp 2006-07-25 22:10:09 UTC (rev 51) +++ branches/dunks/src/Settings.cpp 2006-07-26 16:36:44 UTC (rev 52) @@ -12,7 +12,7 @@ m_debug = false; - m_dataDir = "/home/dunk/downloads/dune/"; + m_dataDir = "paks\\"; m_doubleBuffered = false; }; Modified: branches/dunks/src/pakfile/Decode.cpp =================================================================== --- branches/dunks/src/pakfile/Decode.cpp 2006-07-25 22:10:09 UTC (rev 51) +++ branches/dunks/src/pakfile/Decode.cpp 2006-07-26 16:36:44 UTC (rev 52) @@ -1,18 +1,18 @@ #include "pakfile/Decode.h" #include <SDL_endian.h> #include <stdlib.h> -#include <string.h> +#include <string> #include <SDL.h> Decode::Decode() { - ; -} +}; + Decode::~Decode() { - ; + }; int Decode::decode80(unsigned char *image_in, unsigned char *image_out,unsigned int checksum) @@ -115,12 +115,12 @@ fprintf(stderr,"file contains unknown format80 command: %x\n",*readp); exit(EXIT_FAILURE); } - } + }; if (megacounta + megacountb + megacountc + megacountd + megacounte != checksum) return -1; return 0; -} +}; void Decode::my_memcpy(unsigned char *dst, unsigned char *src, unsigned cnt) { @@ -135,8 +135,8 @@ *dst = *src; dst++; src++; - } -} + }; +}; void Decode::shp_correct_lf(unsigned char *in, unsigned char *out, int size) { Modified: branches/dunks/src/pakfile/Pakfile.cpp =================================================================== --- branches/dunks/src/pakfile/Pakfile.cpp 2006-07-25 22:10:09 UTC (rev 51) +++ branches/dunks/src/pakfile/Pakfile.cpp 2006-07-26 16:36:44 UTC (rev 52) @@ -1,6 +1,5 @@ #include "pakfile/Pakfile.h" #include <stdlib.h> -#include <string.h> #include <SDL_endian.h> Pakfile::Pakfile(const char *Pakfilename) @@ -47,7 +46,6 @@ int startoffset; char name[256]; - while(1) { if(fread((void*) &startoffset, 4, 1,fPakFile) != 1) { perror("fread()"); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <dun...@us...> - 2006-07-28 19:17:14
|
Revision: 53 Author: dunkfordyce Date: 2006-07-26 12:08:09 -0700 (Wed, 26 Jul 2006) ViewCVS: http://svn.sourceforge.net/dunelegacy/?rev=53&view=rev Log Message: ----------- almost working intro Modified Paths: -------------- branches/dunks/SConstruct branches/dunks/include/ResMan.h branches/dunks/include/pakfile/Wsafile.h branches/dunks/src/Application.cpp branches/dunks/src/IntroState.cpp branches/dunks/src/ResMan.cpp branches/dunks/src/Settings.cpp branches/dunks/src/pakfile/Pakfile.cpp branches/dunks/src/pakfile/Wsafile.cpp Modified: branches/dunks/SConstruct =================================================================== --- branches/dunks/SConstruct 2006-07-26 16:36:44 UTC (rev 52) +++ branches/dunks/SConstruct 2006-07-26 19:08:09 UTC (rev 53) @@ -26,7 +26,7 @@ env.ParseConfig('sdl-config --cflags --libs') env.ParseConfig('pkg-config --cflags --libs zziplib') env.Append(CCFLAGS=["-Wall"]) #, "-Werror"]) - env.Append(CCFLAGS=["-Wall", "-Werror", "-O2", "-ffast-math", "-funroll-loops"]) + #env.Append(CCFLAGS=["-Wall", "-Werror", "-O2", "-ffast-math", "-funroll-loops"]) #env.Append(LINKFLAGS = ["-ffast-math"]) if 1: Modified: branches/dunks/include/ResMan.h =================================================================== --- branches/dunks/include/ResMan.h 2006-07-26 16:36:44 UTC (rev 52) +++ branches/dunks/include/ResMan.h 2006-07-26 19:08:09 UTC (rev 53) @@ -14,8 +14,7 @@ public: Resource() {}; virtual ~Resource(); - virtual int readFile(boost::filesystem::path path, unsigned char* buf) { return 0; } - + virtual unsigned char* readFile(boost::filesystem::path path, int *size) { return NULL; } protected: boost::filesystem::path m_path; }; @@ -25,8 +24,7 @@ { public: DIRResource(boost::filesystem::path path) ; - virtual int readFile(boost::filesystem::path path, unsigned char* buf) ; - + unsigned char* readFile(boost::filesystem::path path, int *size); }; @@ -35,7 +33,7 @@ public: PAKResource(boost::filesystem::path path) ; ~PAKResource(); - virtual int readFile(boost::filesystem::path path, unsigned char* buf) ; + unsigned char* readFile(boost::filesystem::path path, int *size); private: Pakfile *m_pakfile; @@ -55,7 +53,7 @@ public: bool addRes(std::string name); - int readFile(std::string path, unsigned char* buf); + unsigned char* readFile(std::string name, int *size); private: ResList m_resources; Modified: branches/dunks/include/pakfile/Wsafile.h =================================================================== --- branches/dunks/include/pakfile/Wsafile.h 2006-07-26 16:36:44 UTC (rev 52) +++ branches/dunks/include/pakfile/Wsafile.h 2006-07-26 19:08:09 UTC (rev 53) @@ -12,7 +12,7 @@ Wsafile(unsigned char * bufFiledata, int bufsize); ~Wsafile(); - SDL_Surface * getPicture(Uint32 FrameNumber); + SDL_Surface * getPicture(Uint32 FrameNumber, SDL_Palette* pal); inline int getNumFrames() { return (int) NumFrames; }; inline Uint32 getFramesPer1024ms() { return FramesPer1024ms; }; Modified: branches/dunks/src/Application.cpp =================================================================== --- branches/dunks/src/Application.cpp 2006-07-26 16:36:44 UTC (rev 52) +++ branches/dunks/src/Application.cpp 2006-07-26 19:08:09 UTC (rev 53) @@ -192,6 +192,8 @@ void Application::SetPalette(SDL_Palette* pal) { + assert(pal != NULL); + printf("setting palette %d colors\n", pal->ncolors); SDL_SetColors(m_screen, pal->colors, 0, pal->ncolors); }; @@ -307,7 +309,7 @@ const int fps_interval = 10 * 1000; // 10 seconds float fps; - Font* fnt = FontManager::Instance()->getFont("new8p.fnt"); + //Font* fnt = FontManager::Instance()->getFont("new8p.fnt"); m_running = true; @@ -334,14 +336,14 @@ float dt = float(now - then) / 1000.0f; - //if (m_rootState->Execute(dt) == -1) m_running = false; + if (m_rootState->Execute(dt) == -1) m_running = false; //m_rootWidget->draw(m_screen); - fnt->render("ABCDEFGHIJKLMOPQRSTUVWXYZ", m_screen, 10, 10, gpaloff); - fnt->render("abcdefghijklmnopqrstuvwxz", m_screen, 10, 30, gpaloff); + //fnt->render("ABCDEFGHIJKLMOPQRSTUVWXYZ", m_screen, 10, 10, gpaloff); + //fnt->render("abcdefghijklmnopqrstuvwxz", m_screen, 10, 30, gpaloff); - BlitCursor(); + //BlitCursor(); SDL_Flip(m_screen); @@ -440,7 +442,7 @@ void Application::Blit(SDL_Surface* surface, SDL_Rect* src, SDL_Rect* dest) { - SDL_BlitSurface(surface, src, m_screen, dest); + assert( SDL_BlitSurface(surface, src, m_screen, dest) == 0 ); }; void Application::BlitCentered(SDL_Surface* surface, SDL_Rect* src) @@ -457,6 +459,7 @@ dest.y = (Settings::Instance()->m_height / 2) - (src->h / 2); }; + printf("blitting %d %d %d %d\n", dest.x, dest.y, surface->w, surface->h); Blit(surface, src, &dest); }; Modified: branches/dunks/src/IntroState.cpp =================================================================== --- branches/dunks/src/IntroState.cpp 2006-07-26 16:36:44 UTC (rev 52) +++ branches/dunks/src/IntroState.cpp 2006-07-26 19:08:09 UTC (rev 53) @@ -5,15 +5,23 @@ IntroState::IntroState() { - unsigned char* data; - int len = ResMan::Instance()->readFile("INTRO:INTRO2.WSA", data); + int len; + unsigned char* data = ResMan::Instance()->readFile(std::string("INTRO:INTRO2.WSA"), &len); + assert(data != NULL); + printf("intro1 len %d\n", len); m_wsa = new Wsafile(data, len); m_currentFrame = 0; m_frametime = 0.0f; + + int len; + unsigned char* data = ResMan::Instance()->readFile("INTRO:INTRO.PAL", &len); + + Palettefile pal (data, len); + Application::Instance()->SetPalette(pal.getPalette()); }; IntroState::~IntroState() @@ -23,12 +31,7 @@ void IntroState::JustMadeActive() { - unsigned char* data; - int len = ResMan::Instance()->readFile("INTRO:INTRO.PAL", data); - Palettefile pal (data, len); - Application::Instance()->SetPalette(pal.getPalette()); - State::JustMadeActive(); }; @@ -52,6 +55,9 @@ }; m_animSurface = m_wsa->getPicture(m_currentFrame); + + assert(m_animSurface != NULL); + Application::Instance()->BlitCentered(m_animSurface); return 0; Modified: branches/dunks/src/ResMan.cpp =================================================================== --- branches/dunks/src/ResMan.cpp 2006-07-26 16:36:44 UTC (rev 52) +++ branches/dunks/src/ResMan.cpp 2006-07-26 19:08:09 UTC (rev 53) @@ -22,7 +22,7 @@ m_path = path; }; -int DIRResource::readFile(bfs::path path, unsigned char* buf) +unsigned char* DIRResource::readFile(bfs::path path, int *size) { assert(0); // this doesnt work bfs::path fullpath (m_path.string() + path.string()); @@ -33,13 +33,15 @@ fseek(file, 0, SEEK_SET); - buf = new unsigned char[filesize]; + unsigned char* buf = new unsigned char[filesize]; fread(buf, filesize, 1, file); fclose(file); - return filesize; + if (size != NULL) *size = filesize; + + return buf; }; // ------------------------------------------------------------------ @@ -55,13 +57,19 @@ delete m_pakfile; }; -int PAKResource::readFile(bfs::path path, unsigned char* buf) +unsigned char* PAKResource::readFile(bfs::path path, int *size) { int filesize; - unsigned char *b = m_pakfile->getFile(path.string().c_str(), &filesize); - buf = b; + unsigned char *buf = m_pakfile->getFile(path.string().c_str(), &filesize); + printf("read pak %s size %d\n", path.string().c_str(), filesize); - return filesize; + + assert(buf != NULL); + assert(filesize != 0); + + if (size != NULL) *size = filesize; + + return buf; }; // ------------------------------------------------------------------ @@ -118,7 +126,7 @@ }; -int ResMan::readFile(std::string name, unsigned char* buf) +unsigned char* ResMan::readFile(std::string name, int *size) { unsigned int p = name.find(':'); assert(p != std::string::npos); @@ -134,9 +142,13 @@ if (res == NULL) { printf("ERROR: cannot find file!\n"); - buf = 0; - return 0; + if (size != NULL) size = 0; + return NULL; }; - return res->readFile(filename.c_str(), buf); + unsigned char *buf = res->readFile(filename.c_str(), size); + + assert(buf != NULL); + + return buf; }; Modified: branches/dunks/src/Settings.cpp =================================================================== --- branches/dunks/src/Settings.cpp 2006-07-26 16:36:44 UTC (rev 52) +++ branches/dunks/src/Settings.cpp 2006-07-26 19:08:09 UTC (rev 53) @@ -12,7 +12,7 @@ m_debug = false; - m_dataDir = "paks\\"; + m_dataDir = "/home/dunk/downloads/dune/"; m_doubleBuffered = false; }; Modified: branches/dunks/src/pakfile/Pakfile.cpp =================================================================== --- branches/dunks/src/pakfile/Pakfile.cpp 2006-07-26 16:36:44 UTC (rev 52) +++ branches/dunks/src/pakfile/Pakfile.cpp 2006-07-26 19:08:09 UTC (rev 53) @@ -1,6 +1,7 @@ #include "pakfile/Pakfile.h" #include <stdlib.h> -#include <SDL_endian.h> +#include <string> +#include "SDL_endian.h" Pakfile::Pakfile(const char *Pakfilename) { Modified: branches/dunks/src/pakfile/Wsafile.cpp =================================================================== --- branches/dunks/src/pakfile/Wsafile.cpp 2006-07-26 16:36:44 UTC (rev 52) +++ branches/dunks/src/pakfile/Wsafile.cpp 2006-07-26 19:08:09 UTC (rev 53) @@ -54,7 +54,7 @@ free(decodedFrames); }; -SDL_Surface * Wsafile::getPicture(Uint32 FrameNumber) +SDL_Surface * Wsafile::getPicture(Uint32 FrameNumber, SDL_Palette *pal) { if(FrameNumber >= NumFrames) { return NULL; @@ -70,7 +70,7 @@ printf("File Nr.: %d (Size: %dx%d)\n",FrameNumber,SizeX,SizeY); - //SDL_SetColors(pic, palette->colors, 0, palette->ncolors); + SDL_SetColors(pic, palette->colors, 0, palette->ncolors); SDL_LockSurface(pic); //Now we can copy line by line This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <dun...@us...> - 2006-07-31 08:09:08
|
Revision: 61 Author: dunkfordyce Date: 2006-07-31 01:08:57 -0700 (Mon, 31 Jul 2006) ViewCVS: http://svn.sourceforge.net/dunelegacy/?rev=61&view=rev Log Message: ----------- compile parts to static libs to easily allow tools to be created Modified Paths: -------------- branches/dunks/SConstruct branches/dunks/src/Application.cpp branches/dunks/src/SConscript branches/dunks/src/main.cpp branches/dunks/src/pakfile/main.cpp Added Paths: ----------- branches/dunks/src/pakview.cpp Modified: branches/dunks/SConstruct =================================================================== --- branches/dunks/SConstruct 2006-07-30 22:50:22 UTC (rev 60) +++ branches/dunks/SConstruct 2006-07-31 08:08:57 UTC (rev 61) @@ -59,4 +59,5 @@ Export('env') +#SConscript("src/pakfile/SConscript") SConscript("src/SConscript") Modified: branches/dunks/src/Application.cpp =================================================================== --- branches/dunks/src/Application.cpp 2006-07-30 22:50:22 UTC (rev 60) +++ branches/dunks/src/Application.cpp 2006-07-31 08:08:57 UTC (rev 61) @@ -22,8 +22,6 @@ #include "Settings.h" #include "Font.h" #include "TopLevelState.h" -#include "MainMenu.h" -#include "IntroState.h" #include "DataFile.h" //#include "pakfile/Pakfile.h" @@ -126,8 +124,8 @@ InitVideo(); - char versionString[100]; - sprintf(versionString, "%s", VERSION); + //char versionString[100]; + //sprintf(versionString, "%s", VERSION); //menuText = TTF_RenderText_Solid(font[16], versionString, palette->colors[COLOUR_BLACK]); //init_loadWindow(); @@ -135,9 +133,9 @@ //realign_buttons(); m_rootState = new TopLevelState(); - m_rootState->PushState( new MainMenuState() ); - m_rootState->PushState( new IntroState() ); //m_rootState->PushState( new MainMenuState() ); + //m_rootState->PushState( new IntroState() ); + //m_rootState->PushState( new MainMenuState() ); } void Application::InitSettings() Modified: branches/dunks/src/SConscript =================================================================== --- branches/dunks/src/SConscript 2006-07-30 22:50:22 UTC (rev 60) +++ branches/dunks/src/SConscript 2006-07-31 08:08:57 UTC (rev 61) @@ -1,5 +1,7 @@ Import('env') +SConscript("pakfile/SConscript") + from glob import glob gui_sources = glob("gui/*.cpp") @@ -24,27 +26,33 @@ "SingleMenu.cpp", "ResMan.cpp", + ] +gui_sources = [ "gui2/Widget.cpp", "gui2/Container.cpp", "gui2/Button.cpp", "gui2/VBox.cpp", - "pakfile/Cpsfile.cpp", + ] + +pak_sources = [ "pakfile/Cpsfile.cpp", "pakfile/Decode.cpp", "pakfile/Icnfile.cpp", "pakfile/Pakfile.cpp", "pakfile/Shpfile.cpp", "pakfile/Wsafile.cpp", "pakfile/Palette.cpp", - - "main.cpp", ] -#all_sources = ["ResMan.cpp"] +gamelib = env.StaticLibrary("dune_game", all_sources) +guilib = env.StaticLibrary("dune_gui", gui_sources) +paklib = env.StaticLibrary("dune_pak", pak_sources) -#all_sources += [env.Object('SDL_rwops_zzip.c')] +dunelegacy = env.Program("../dunelegacy", ["main.cpp", gamelib, guilib, paklib] ) +pakview = env.Program("../pakview", ["pakview.cpp", gamelib, guilib, paklib] ) -env.Program("../dunelegacy", all_sources) +Default(dunelegacy) +Default(pakview) Modified: branches/dunks/src/main.cpp =================================================================== --- branches/dunks/src/main.cpp 2006-07-30 22:50:22 UTC (rev 60) +++ branches/dunks/src/main.cpp 2006-07-31 08:08:57 UTC (rev 61) @@ -1,5 +1,7 @@ #include "Application.h" #include "Settings.h" +#include "MainMenu.h" +#include "IntroState.h" namespace boost { @@ -16,6 +18,8 @@ Settings::Instance()->ParseOptions(argc, argv); Application::Instance()->Init(); + Application::Instance()->RootState()->PushState( new MainMenuState() ); + Application::Instance()->RootState()->PushState( new IntroState() ); Application::Instance()->Run(); Application::Destroy(); Modified: branches/dunks/src/pakfile/main.cpp =================================================================== --- branches/dunks/src/pakfile/main.cpp 2006-07-30 22:50:22 UTC (rev 60) +++ branches/dunks/src/pakfile/main.cpp 2006-07-31 08:08:57 UTC (rev 61) @@ -1,6 +1,3 @@ -/* Created by Anjuta version 1.2.4 */ -/* This file will not be overwritten */ - #include <iostream> #include <string.h> #include <SDL.h> Added: branches/dunks/src/pakview.cpp =================================================================== --- branches/dunks/src/pakview.cpp (rev 0) +++ branches/dunks/src/pakview.cpp 2006-07-31 08:08:57 UTC (rev 61) @@ -0,0 +1,30 @@ +#include "Application.h" +#include "Settings.h" + +namespace boost { + + void throw_exception(std::exception const & e) + { + + }; + +} + +int main(int argc, char *argv[]) +{ + Settings::Instance()->ParseFile("dunelegacy.cfg"); + Settings::Instance()->ParseOptions(argc, argv); + + Application::Instance()->Init(); + //Application::Instance()->PushState( new MainMenuState() ); + //Application::Instance()->PushState( new IntroState() ); + + + + Application::Instance()->Run(); + + Application::Destroy(); + Settings::Destroy(); + + return 0; +}; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <dv...@us...> - 2008-04-26 00:53:50
|
Revision: 161 http://dunelegacy.svn.sourceforge.net/dunelegacy/?rev=161&view=rev Author: dvalin Date: 2008-04-25 17:53:46 -0700 (Fri, 25 Apr 2008) Log Message: ----------- drop getDoublePicture, Image class already provides getResized.. (I suck) Modified Paths: -------------- branches/dunks/include/pakfile/Cpsfile.h branches/dunks/src/pakfile/Cpsfile.cpp Modified: branches/dunks/include/pakfile/Cpsfile.h =================================================================== --- branches/dunks/include/pakfile/Cpsfile.h 2008-04-26 00:48:39 UTC (rev 160) +++ branches/dunks/include/pakfile/Cpsfile.h 2008-04-26 00:53:46 UTC (rev 161) @@ -18,10 +18,7 @@ Image * getPicture(); - Image * getDoublePicture(); - Image * getSubPicture(unsigned int left, unsigned int top, unsigned int width, unsigned int height); - private: unsigned char* Filedata; Uint32 CpsFilesize; Modified: branches/dunks/src/pakfile/Cpsfile.cpp =================================================================== --- branches/dunks/src/pakfile/Cpsfile.cpp 2008-04-26 00:48:39 UTC (rev 160) +++ branches/dunks/src/pakfile/Cpsfile.cpp 2008-04-26 00:53:46 UTC (rev 161) @@ -69,40 +69,6 @@ return img; } -Image * Cpsfile::getDoublePicture() { - SDL_Surface *inputPic = getPicture()->getSurface(); - SDL_Surface *returnPic; - - // create new picture surface - if((returnPic = SDL_CreateRGBSurface(SDL_HWSURFACE,inputPic->w * 2,inputPic->h * 2,8,0,0,0,0))== NULL) { - fprintf(stderr,"DoublePicture: Cannot create new Picture!\n"); - exit(EXIT_FAILURE); - } - - SDL_SetColors(returnPic, inputPic->format->palette->colors, 0, inputPic->format->palette->ncolors); - SDL_LockSurface(returnPic); - SDL_LockSurface(inputPic); - - //Now we can copy pixel by pixel - for(int y = 0; y < inputPic->h;y++) { - for(int x = 0; x < inputPic->w; x++) { - char val = *( ((char*) (inputPic->pixels)) + y*inputPic->pitch + x); - *( ((char*) (returnPic->pixels)) + 2*y*returnPic->pitch + 2*x) = val; - *( ((char*) (returnPic->pixels)) + 2*y*returnPic->pitch + 2*x+1) = val; - *( ((char*) (returnPic->pixels)) + (2*y+1)*returnPic->pitch + 2*x) = val; - *( ((char*) (returnPic->pixels)) + (2*y+1)*returnPic->pitch + 2*x+1) = val; - } - } - - SDL_UnlockSurface(inputPic); - SDL_UnlockSurface(returnPic); - - SDL_FreeSurface(inputPic); - Image * img = new Image(returnPic); - - return img; -} - Image * Cpsfile::getSubPicture(unsigned int left, unsigned int top, unsigned int width, unsigned int height) { SDL_Surface *Pic = getPicture()->getSurface(); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <dv...@us...> - 2008-04-27 17:44:25
|
Revision: 165 http://dunelegacy.svn.sourceforge.net/dunelegacy/?rev=165&view=rev Author: dvalin Date: 2008-04-27 10:42:52 -0700 (Sun, 27 Apr 2008) Log Message: ----------- add function for adding and getting gui pictures Modified Paths: -------------- branches/dunks/include/DataCache.h branches/dunks/src/DataCache.cpp Modified: branches/dunks/include/DataCache.h =================================================================== --- branches/dunks/include/DataCache.h 2008-04-27 17:36:11 UTC (rev 164) +++ branches/dunks/include/DataCache.h 2008-04-27 17:42:52 UTC (rev 165) @@ -371,7 +371,7 @@ NUM_SOUNDCHUNK } Sound_enum; -typedef std::map <ObjPic_enum, ImagePtr> images; +typedef std::map <unsigned, ImagePtr> images; typedef std::vector <images*> remapped_images; //One for each house class DataCache : public Singleton<DataCache> @@ -384,7 +384,7 @@ public: void addObjPic(ObjPic_enum ID, SDL_Surface * tmp, HOUSETYPE house = HOUSE_HARKONNEN); -// void addGuiPic(GuiPic_enum ID, SDL_Surface * tmp, HOUSETYPE house = HOUSE_HARKONNEN); + void addGuiPic(GuiPic_enum ID, SDL_Surface * tmp, HOUSETYPE house = HOUSE_HARKONNEN); void addSoundChunk(Sound_enum ID, Mix_Chunk* tmp); ImagePtr getObjPic(ObjPic_enum ID, HOUSETYPE house = HOUSE_HARKONNEN); ImagePtr getGuiPic(GuiPic_enum ID, HOUSETYPE house = HOUSE_HARKONNEN); @@ -396,7 +396,6 @@ private: - bool addObjPic(ObjPic_enum ID) { return false;}; remapped_images m_objImg; remapped_images m_guiImg; Modified: branches/dunks/src/DataCache.cpp =================================================================== --- branches/dunks/src/DataCache.cpp 2008-04-27 17:36:11 UTC (rev 164) +++ branches/dunks/src/DataCache.cpp 2008-04-27 17:42:52 UTC (rev 165) @@ -220,13 +220,12 @@ ImagePtr(new Image(tmp)))); } -/*void DataCache::addGuiPic(GuiPic_enum ID, SDL_Surface * tmp, HOUSETYPE house) { +void DataCache::addGuiPic(GuiPic_enum ID, SDL_Surface * tmp, HOUSETYPE house) { m_guiImg[HOUSE_HARKONNEN]->insert(std::pair<GuiPic_enum, ImagePtr>(ID, ImagePtr(new Image(tmp)))); -}*/ +} - ImagePtr DataCache::getObjPic(ObjPic_enum ID, HOUSETYPE house) { images::iterator iter = m_objImg[house]->find(ID); @@ -244,7 +243,7 @@ } -/*ImagePtr DataCache::getGuiPic(GuiPic_enum ID, HOUSETYPE house) { +ImagePtr DataCache::getGuiPic(GuiPic_enum ID, HOUSETYPE house) { images::iterator iter = m_guiImg[house]->find(ID); if (iter != m_guiImg[house]->end()) @@ -259,7 +258,7 @@ return copy; } -}*/ +} void DataCache::addSoundChunk(Sound_enum ID, Mix_Chunk* tmp){ soundChunk[ID] = tmp; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <dv...@us...> - 2008-04-27 20:04:41
|
Revision: 167 http://dunelegacy.svn.sourceforge.net/dunelegacy/?rev=167&view=rev Author: dvalin Date: 2008-04-27 13:04:24 -0700 (Sun, 27 Apr 2008) Log Message: ----------- use std::string in stead of char Modified Paths: -------------- branches/dunks/include/pakfile/StringFile.h branches/dunks/src/pakfile/StringFile.cpp Modified: branches/dunks/include/pakfile/StringFile.h =================================================================== --- branches/dunks/include/pakfile/StringFile.h 2008-04-27 20:02:00 UTC (rev 166) +++ branches/dunks/include/pakfile/StringFile.h 2008-04-27 20:04:24 UTC (rev 167) @@ -17,7 +17,7 @@ class StringFile { public: - StringFile(unsigned char * bufFiledata, int bufsize); + StringFile(std::string stringFileName); ~StringFile(); /// This method returns the briefing/debriefing text. Modified: branches/dunks/src/pakfile/StringFile.cpp =================================================================== --- branches/dunks/src/pakfile/StringFile.cpp 2008-04-27 20:02:00 UTC (rev 166) +++ branches/dunks/src/pakfile/StringFile.cpp 2008-04-27 20:04:24 UTC (rev 167) @@ -1,11 +1,14 @@ #include "pakfile/StringFile.h" +#include "ResMan.h" #include <SDL_endian.h> #include <SDL.h> #include <SDL_rwops.h> #include <iostream> #include <string> -StringFile::StringFile(unsigned char * bufFiledata, int bufsize){ +StringFile::StringFile(std::string stringFileName) { + int bufsize; + unsigned char* bufFiledata = ResMan::Instance()->readFile(stringFileName.c_str(), &bufsize); Uint16* index; SDL_RWops* RWop = SDL_RWFromMem(bufFiledata, bufsize); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <dv...@us...> - 2008-05-01 05:31:28
|
Revision: 225 http://dunelegacy.svn.sourceforge.net/dunelegacy/?rev=225&view=rev Author: dvalin Date: 2008-04-30 22:31:26 -0700 (Wed, 30 Apr 2008) Log Message: ----------- * make soundplayer globally available from Application class * speed up game initialization by loading things more ordered * add music for westwood intro scene Modified Paths: -------------- branches/dunks/include/DataCache.h branches/dunks/include/IntroState.h branches/dunks/src/DataCache.cpp branches/dunks/src/IntroState.cpp Modified: branches/dunks/include/DataCache.h =================================================================== --- branches/dunks/include/DataCache.h 2008-05-01 05:05:26 UTC (rev 224) +++ branches/dunks/include/DataCache.h 2008-05-01 05:31:26 UTC (rev 225) @@ -431,9 +431,9 @@ // std::string getBriefingText(ObjPic_enum mission, ObjPic_enum texttype, ObjPic_enum house); std::string getIntroString(uint16_t i); + std::string getCreditsString(uint16_t i); - private: remapped_images m_objImg; remapped_images m_guiImg; @@ -449,6 +449,7 @@ Animation* Anim[NUM_ANIMATION]; Stringfile* BriefingStrings[3]; Stringfile* IntroStrings; + Stringfile* CreditsStrings; Mix_Chunk* soundChunk[NUM_SOUNDCHUNK]; }; Modified: branches/dunks/include/IntroState.h =================================================================== --- branches/dunks/include/IntroState.h 2008-05-01 05:05:26 UTC (rev 224) +++ branches/dunks/include/IntroState.h 2008-05-01 05:31:26 UTC (rev 225) @@ -39,7 +39,7 @@ HOLDING }; - Frame(std::string file, Transition in, Transition out, std::vector<introText> introStrings, bool cont, Palette_enum pal = INTRO_PAL); + Frame(std::string file, Transition in, Transition out, std::vector<introText> introStrings, bool cont, int8_t song = -1, Palette_enum pal = INTRO_PAL); ~Frame(); bool Execute(float ft); @@ -59,6 +59,7 @@ WsafilePtr m_wsa; int m_currentFrame; float m_frametime; + int m_song; ImagePtr m_animSurface, m_scaledSurface; SDL_Color* m_transitionPalette; Modified: branches/dunks/src/DataCache.cpp =================================================================== --- branches/dunks/src/DataCache.cpp 2008-05-01 05:05:26 UTC (rev 224) +++ branches/dunks/src/DataCache.cpp 2008-05-01 05:31:26 UTC (rev 225) @@ -20,16 +20,40 @@ int len, maplen; uint8_t *data, *mapdata; - - addPalette(INTRO_PAL, "INTRO:INTRO.PAL"); + ResMan::Instance()->addRes("ENGLISH"); + + addPalette(WESTWOOD_PAL, "INTRO:WESTWOOD.PAL"); + // Not properly decoded yet.. + // CreditsStrings = new Stringfile("ENGLISH:CREDITS.ENG"); + + addPalette(INTRO_PAL, "INTRO:INTRO.PAL"); + IntroStrings = new Stringfile("ENGLISH:INTRO.ENG"); + + ResMan::Instance()->addRes("DUNE"); + // FIXME: Something seems to be fscked up with this palette, the Bene Gesserit // mentat ends up looking a bit unhealthy greenish, needs to be corrected! addPalette(BENE_PAL, "DUNE:BENE.PAL"); addPalette(IBM_PAL, "DUNE:IBM.PAL"); - addPalette(WESTWOOD_PAL, "INTRO:WESTWOOD.PAL"); + ResMan::Instance()->addRes("SOUND"); + addMusic(MUSIC_INTRO, "SOUND:DUNE0.ADL", 4); + ResMan::Instance()->addRes("ATRE"); + ResMan::Instance()->addRes("GERMAN"); + ResMan::Instance()->addRes("FINALE"); + ResMan::Instance()->addRes("HARK"); + ResMan::Instance()->addRes("HERC"); + ResMan::Instance()->addRes("INTROVOC"); + ResMan::Instance()->addRes("MENTAT"); + ResMan::Instance()->addRes("MERC"); + ResMan::Instance()->addRes("ORDOS"); + ResMan::Instance()->addRes("SCENARIO"); + ResMan::Instance()->addRes("VOC"); + ResMan::Instance()->addRes("XTRE"); + + //LOADING FILES data = ResMan::Instance()->readFile("DUNE:UNITS.SHP", &len); ShpfilePtr units(new Shpfile(data, len)); @@ -44,7 +68,7 @@ data = ResMan::Instance()->readFile("DUNE:ICON.ICN", &len); mapdata = ResMan::Instance()->readFile("DUNE:ICON.MAP", &maplen); IcnfilePtr icon(new Icnfile(data, len, mapdata, maplen)); - delete mapdata; + //delete mapdata; data = ResMan::Instance()->readFile("DUNE:STATIC.WSA", &len); WsafilePtr radar(new Wsafile(data, len)); @@ -216,6 +240,8 @@ 7|TILE_NORMAL,8|TILE_NORMAL,9|TILE_NORMAL,10|TILE_NORMAL,11|TILE_NORMAL)); // addGuiPic(UI_GameBar, PicFactory->createGameBar(); addGuiPic(UI_Indicator, units1->getPictureArray(3,1,8|TILE_NORMAL,9|TILE_NORMAL,10|TILE_NORMAL)); +// addMusic(MUSIC_INTRO, "SOUND:DUNE0.ADL", 2); + // SDL_SetColorKey(addGuiPic(UI_Indicator][HOUSE_HARKONNEN], SDL_SRCCOLORKEY | SDL_RLEACCEL, 0); // addGuiPic(UI_InvalidPlace, PicFactory->createInvalidPlace(); // addGuiPic(UI_ValidPlace, PicFactory->createValidPlace(); @@ -397,12 +423,11 @@ addSoundChunk(Intro_Wind_2bp, getChunkFromFile("INTROVOC:WIND2BP.VOC")); addSoundChunk(Intro_Your, getChunkFromFile("INTROVOC:YOUR.VOC")); - IntroStrings = new Stringfile("ENGLISH:INTRO.ENG"); BriefingStrings[0] = new Stringfile("ENGLISH:TEXTA.ENG"); BriefingStrings[1] = new Stringfile("ENGLISH:TEXTO.ENG"); BriefingStrings[2] = new Stringfile("ENGLISH:TEXTH.ENG"); - addMusic(MUSIC_INTRO, "SOUND:DUNE0.ADL", 2); + addMusic(MUSIC_INTRO, "SOUND:DUNE0.ADL", 2); addMusic(MUSIC_LOSE, "SOUND:DUNE1.ADL", 3); addMusic(MUSIC_PEACE, "SOUND:DUNE2.ADL", 6); addMusic(MUSIC_PEACE, "SOUND:DUNE3.ADL", 6); @@ -622,6 +647,15 @@ return IntroStrings->getString(i); } +std::string DataCache::getCreditsString(uint16_t i){ +#ifdef THREADS + spinlock: + if(!IntroStrings) + goto spinlock; +#endif + return CreditsStrings->getString(i); +} + void DataCache::addAnimation(Animation_enum ID, std::string fileName, double frameRate) { int len; uint8_t * data = ResMan::Instance()->readFile(fileName, &len); Modified: branches/dunks/src/IntroState.cpp =================================================================== --- branches/dunks/src/IntroState.cpp 2008-05-01 05:05:26 UTC (rev 224) +++ branches/dunks/src/IntroState.cpp 2008-05-01 05:31:26 UTC (rev 225) @@ -15,7 +15,7 @@ IntroState::Frame::Frame(std::string filename, Transition in, Transition out, std::vector<introText> introStrings, - bool continuation, Palette_enum pal) + bool continuation, int8_t song, Palette_enum pal) { m_filename = filename; m_transition_in = in; @@ -31,6 +31,8 @@ m_container->setSize(UPoint(Settings::Instance()->GetWidth(), Settings::Instance()->GetHeight())); m_palette = DataCache::Instance()->getPalette(pal); + + m_song = song; Application::Instance()->RootWidget()->addChild(m_container); @@ -99,6 +101,7 @@ void IntroState::Frame::doPlaying(float dt) { + m_frametime += dt; if (m_frametime > m_wsa->getFPS()) @@ -127,6 +130,10 @@ void IntroState::Frame::doTransitionIn(float dt) { + if(m_song != -1){ + Application::Instance()->playSound(DataCache::Instance()->getMusic(MUSIC_INTRO, m_song)); + } + if (m_transition_in == NO_TRANSITION) m_state = PLAYING; } @@ -194,12 +201,13 @@ IntroState::IntroState() { - m_introStrings.push_back(introText(0, "Original copyright by:")); + m_introStrings.push_back(introText(0, "")); // credits.eng isn't properly decoded yet.. + // DataCache::Instance()->getCreditsString(20))); enque( new Frame("INTRO:WESTWOOD.WSA", Frame::NO_TRANSITION, Frame::NO_TRANSITION, m_introStrings, - false, WESTWOOD_PAL) ); + false, 0, WESTWOOD_PAL) ); m_introStrings.clear(); m_introStrings.push_back(introText(0, DataCache::Instance()->getIntroString(2))); @@ -207,7 +215,7 @@ Frame::NO_TRANSITION, Frame::FADE_OUT, m_introStrings, - false) ); + false, 1) ); m_introStrings.clear(); m_introStrings.push_back(introText(0, DataCache::Instance()->getIntroString(3))); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <dv...@us...> - 2008-05-01 13:07:49
|
Revision: 232 http://dunelegacy.svn.sourceforge.net/dunelegacy/?rev=232&view=rev Author: dvalin Date: 2008-05-01 06:07:27 -0700 (Thu, 01 May 2008) Log Message: ----------- start adding sounds.. Modified Paths: -------------- branches/dunks/include/IntroState.h branches/dunks/src/IntroState.cpp Modified: branches/dunks/include/IntroState.h =================================================================== --- branches/dunks/include/IntroState.h 2008-05-01 13:01:31 UTC (rev 231) +++ branches/dunks/include/IntroState.h 2008-05-01 13:07:27 UTC (rev 232) @@ -14,7 +14,7 @@ #include <string> typedef std::pair <uint16_t, std::string> introText; -typedef std::pair <uint16_t, Mix_Chunk*> introSound; +typedef std::pair <uint16_t, Sound_enum> introSound; class StringFile; class Button; @@ -47,6 +47,7 @@ bool Execute(float ft); void Load(Frame* lastframe); void addText(uint16_t playAt, std::string introText); + void addSound(uint16_t playAt, Sound_enum sound); void setPalette(Palette_enum palette); void setSong(uint8_t song); @@ -73,6 +74,8 @@ Label* m_subText; Container* m_container; std::vector<introText> m_introStrings; + std::vector<introSound> m_introSounds; + SDL_Palette* m_palette; Modified: branches/dunks/src/IntroState.cpp =================================================================== --- branches/dunks/src/IntroState.cpp 2008-05-01 13:01:31 UTC (rev 231) +++ branches/dunks/src/IntroState.cpp 2008-05-01 13:07:27 UTC (rev 232) @@ -42,6 +42,11 @@ m_introStrings.push_back(introText(playAt, text)); } +void IntroState::Frame::addSound(uint16_t playAt, Sound_enum sound) +{ + m_introSounds.push_back(introSound(playAt, sound)); +} + void IntroState::Frame::setPalette(Palette_enum palette) { m_palette = DataCache::Instance()->getPalette(palette); @@ -120,6 +125,14 @@ } } + if(m_introSounds.size() > 0){ + if(m_currentFrame == m_introSounds[0].first){ + Mix_Chunk* sound = DataCache::Instance()->getSoundChunk(m_introSounds[0].second); + Application::Instance()->playSound(sound); + m_introSounds.erase(m_introSounds.begin()); + } + } + m_frametime += dt; if (m_frametime > m_wsa->getFPS()) @@ -246,7 +259,7 @@ // m_introStrings.push_back(introText(0, "")); // credits.eng isn't properly decoded yet.. // DataCache::Instance()->getCreditsString(20))); - frame = new Frame("INTRO:WESTWOOD.WSA", +/* frame = new Frame("INTRO:WESTWOOD.WSA", Frame::NO_TRANSITION, Frame::FADE_OUT, false, 5000); @@ -259,13 +272,18 @@ Frame::FADE_OUT, false, 2000); frame->setSong(1); + frame->addSound(5, Intro_Dune); + frame->addSound(25, Intro_TheBuilding); + frame->addSound(49, Intro_OfADynasty); frame->addText(48, "The Building of a Dynasty"); enque(frame); - - frame = new Frame("INTRO:INTRO2.WSA", + + frame = new Frame("INTRO:INTRO2.WSA", Frame::NO_TRANSITION, Frame::FADE_OUT, false, 2000); + frame->addSound(0, Intro_ThePlanetArrakis); + frame->addSound(11, Intro_KnownAsDune); frame->addText(0, DataCache::Instance()->getIntroString(3)); enque(frame); @@ -273,14 +291,27 @@ Frame::NO_TRANSITION, Frame::FADE_OUT, false, 2000); + frame->addSound(0, Intro_LandOfSand); frame->addText(0, DataCache::Instance()->getIntroString(4)); + frame->addSound(20, Intro_Home); + frame->addSound(33, Intro_OfTheSpice); + frame->addSound(39, Intro_Melange); frame->addText(33, DataCache::Instance()->getIntroString(5)); enque(frame); - +*/ frame = new Frame("INTRO:INTRO9.WSA", Frame::NO_TRANSITION, Frame::FADE_OUT, false, 3000); + frame->addSound(0, Intro_TheSpice); + frame->addSound(3, Intro_Controls); + frame->addSound(7, Intro_TheEmpire); + frame->addSound(3, Intro_ControlsDune); + frame->addSound(9, Intro_WhoEver); + frame->addSound(10, Intro_Clank); + frame->addSound(10, Intro_ControlsTheSpice); + frame->addSound(50, Intro_Brakes_2p); + frame->addSound(58, Intro_Clank); frame->addText(0, DataCache::Instance()->getIntroString(6)); frame->addText(50, DataCache::Instance()->getIntroString(7)); enque(frame); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <dv...@us...> - 2008-05-04 18:53:22
|
Revision: 267 http://dunelegacy.svn.sourceforge.net/dunelegacy/?rev=267&view=rev Author: dvalin Date: 2008-05-04 11:53:03 -0700 (Sun, 04 May 2008) Log Message: ----------- commit some soundplayer code that never made it in, thus breaking build.. Modified Paths: -------------- branches/dunks/include/Application.h branches/dunks/src/Application.cpp Modified: branches/dunks/include/Application.h =================================================================== --- branches/dunks/include/Application.h 2008-05-04 04:31:10 UTC (rev 266) +++ branches/dunks/include/Application.h 2008-05-04 18:53:03 UTC (rev 267) @@ -13,7 +13,11 @@ #include <pthread.h> extern "C" void *dataCacheThread(void * arg); #endif +//#include "SoundPlayerClass.h" +class SoundPlayerClass; +class Mix_Chunk; + typedef enum { CURSOR_NORMAL, @@ -59,8 +63,11 @@ void UpdateVideoMode(bool fullscreen); void UpdateVideoMode(Uint16 w, Uint16 h); void UpdateVideoMode(Uint16 w, Uint16 h, bool fullscreen); +// SoundPlayerClass* soundPlayer; + void playSound(Mix_Chunk* chunk, int channel = 0); private: + SoundPlayerClass* soundPlayer; // void *testis(void * arg); void InitSettings(); void InitAudio(); Modified: branches/dunks/src/Application.cpp =================================================================== --- branches/dunks/src/Application.cpp 2008-05-04 04:31:10 UTC (rev 266) +++ branches/dunks/src/Application.cpp 2008-05-04 18:53:03 UTC (rev 267) @@ -108,7 +108,7 @@ SDL_EnableUNICODE(1); // replace NULL with a path to a 32x32 icon - SDL_WM_SetCaption("Dune Legacy", NULL); + SDL_WM_SetCaption("Dune Legacy", "paks/DUNE2.ICO"); InitAudio(); //InitNet(); @@ -276,22 +276,9 @@ void Application::LoadData() { printf("loading resources\n"); - ResMan::Instance()->addRes("ATRE"); - ResMan::Instance()->addRes("DUNE"); - ResMan::Instance()->addRes("ENGLISH"); - ResMan::Instance()->addRes("GERMAN"); - ResMan::Instance()->addRes("FINALE"); - ResMan::Instance()->addRes("HARK"); - ResMan::Instance()->addRes("HERC"); ResMan::Instance()->addRes("INTRO"); - ResMan::Instance()->addRes("INTROVOC"); - ResMan::Instance()->addRes("MENTAT"); - ResMan::Instance()->addRes("MERC"); - ResMan::Instance()->addRes("ORDOS"); - ResMan::Instance()->addRes("SCENARIO"); - ResMan::Instance()->addRes("SOUND"); - ResMan::Instance()->addRes("VOC"); - ResMan::Instance()->addRes("XTRE"); + + printf("done loading resources\n"); #ifdef __linux__ pthread_t threads[1]; @@ -306,12 +293,16 @@ m_cursor.reset(DataCache::Instance()->getGuiPic(UI_MouseCursor).get()); //mouse.getPicture(0)); fprintf(stdout, "starting sound...\n"); - SoundPlayerClass* soundPlayer = new SoundPlayerClass(); + soundPlayer = new SoundPlayerClass(); - Mix_Chunk* myChunk = DataCache::Instance()->getMusic(MUSIC_INTRO, 0); - soundPlayer->playSound(myChunk); +/* Mix_Chunk* myChunk = DataCache::Instance()->getMusic(MUSIC_INTRO, 0); + soundPlayer->playSound(myChunk);*/ } +void Application::playSound(Mix_Chunk* chunk, int channel) +{ + soundPlayer->playSound(chunk, channel); +} void Application::Die() { FontManager::Destroy(); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <dun...@us...> - 2006-07-31 13:26:37
|
Revision: 63 Author: dunkfordyce Date: 2006-07-31 06:26:23 -0700 (Mon, 31 Jul 2006) ViewCVS: http://svn.sourceforge.net/dunelegacy/?rev=63&view=rev Log Message: ----------- added simple button that draws itself Modified Paths: -------------- branches/dunks/include/Font.h branches/dunks/include/gui2/Button.h branches/dunks/src/Application.cpp branches/dunks/src/Font.cpp branches/dunks/src/gui2/Button.cpp branches/dunks/src/pakview.cpp Property Changed: ---------------- branches/dunks/ Property changes on: branches/dunks ___________________________________________________________________ Name: svn:ignore + .sconsign Modified: branches/dunks/include/Font.h =================================================================== --- branches/dunks/include/Font.h 2006-07-31 08:12:26 UTC (rev 62) +++ branches/dunks/include/Font.h 2006-07-31 13:26:23 UTC (rev 63) @@ -45,6 +45,7 @@ Font(FNTCharacter* characters, FNTHeader* header); ~Font(); + void extents(const char* text, Uint16& w, Uint16& h); void render(const char* text, SDL_Surface* surface, Uint16 x, Uint16 y, Uint8 paloff); private: Modified: branches/dunks/include/gui2/Button.h =================================================================== --- branches/dunks/include/gui2/Button.h 2006-07-31 08:12:26 UTC (rev 62) +++ branches/dunks/include/gui2/Button.h 2006-07-31 13:26:23 UTC (rev 63) @@ -3,6 +3,7 @@ #include "gui2/Widget.h" #include "boost/signal.hpp" +#include <string> class Button : public Widget { @@ -34,5 +35,20 @@ bool m_pressed; }; + +class BoringButton : public GraphicButton +{ + public: + BoringButton(std::string caption); + ~BoringButton(); + + virtual void setSize(Uint16 w, Uint16 h); + + protected: + std::string m_caption; + + virtual void redraw(); +}; + #endif // DUNE_GUI2_BUTTON Modified: branches/dunks/src/Application.cpp =================================================================== --- branches/dunks/src/Application.cpp 2006-07-31 08:12:26 UTC (rev 62) +++ branches/dunks/src/Application.cpp 2006-07-31 13:26:23 UTC (rev 63) @@ -198,16 +198,7 @@ SDL_Palette* palette = m_screen->format->palette; - printf("1-- %u %u %u\n", palette->colors[12].r, - palette->colors[12].g, - palette->colors[12].b); - palette = m_currentPalette; - - printf("2-- %u %u %u\n", palette->colors[12].r, - palette->colors[12].g, - palette->colors[12].b); - }; void Application::InitVideo() @@ -351,14 +342,14 @@ if (m_rootState->Execute(dt) == -1) m_running = false; - //m_rootWidget->draw(m_screen); + m_rootWidget->draw(m_screen); - fnt->render("ABCDEFGHIJKLMOPQRSTUVWXYZ", m_screen, 10, 10, gpaloff); - fnt->render("abcdefghijklmnopqrstuvwxz", m_screen, 10, 30, gpaloff); - //BlitCursor(); #if 0 + fnt->render("ABCDEFGHIJKLMOPQRSTUVWXYZ", m_screen, 10, 10, gpaloff); + fnt->render("abcdefghijklmnopqrstuvwxz", m_screen, 10, 30, gpaloff); + SDL_Rect pdest = {10, 10, 5, 10}; for (Uint32 i=0; i!=256; i++) @@ -367,9 +358,8 @@ SDL_FillRect(m_screen, &pdest, i); } #endif - - assert( SDL_Flip(m_screen) == 0); + SDL_Flip(m_screen); fps_frames ++; Modified: branches/dunks/src/Font.cpp =================================================================== --- branches/dunks/src/Font.cpp 2006-07-31 08:12:26 UTC (rev 62) +++ branches/dunks/src/Font.cpp 2006-07-31 13:26:23 UTC (rev 63) @@ -18,6 +18,20 @@ delete m_header; }; +void Font::extents(const char* text, Uint16& w, Uint16& h) +{ + FNTCharacter* ch; + + w = 0; + h = m_header->height; + + for (unsigned int c=0; c!=strlen(text); c++) + { + ch = &m_characters[text[c]]; + w += (2 * ch->width) + 1; + }; +}; + void Font::render(const char* text, SDL_Surface* surface, Uint16 offx, Uint16 offy, Uint8 paloff) { FNTCharacter* ch; @@ -29,22 +43,6 @@ ch = &m_characters[text[c]]; bitmap = ch->bitmap; -/* byte ox; - - - for (byte y=0; y!=ch->y_offset; y++) - { - ox = offx; - for (byte x=0; x!=ch->width; x++) - { - pixels[(ox) + ((y + offy) * surface->w)] = 0; - ++ox; - pixels[(ox) + ((y + offy) * surface->w)] = 0; - ++ox; - }; - }; - */ - for (byte y=0; y!=ch->height; y++) { for (byte x=0; x!=ch->width*2; x+=2) @@ -52,28 +50,6 @@ byte lobyte = bitmap[(x/2) + (y*ch->width)] >> 4; byte hibyte = bitmap[(x/2) + (y*ch->width)] & 0x0F; - /* - if (hibyte==0) - { - printf(" "); - } - else - { - printf("%2hd", hibyte); - } - printf("."); - - if (lobyte==0) - { - printf(" "); - } - else - { - printf("%2hd", lobyte); - }; - printf("."); - */ - if (hibyte!=0) { pixels[(offx + x) + ((ch->y_offset + y + offy) * surface->w)] = paloff + Uint8(hibyte); Modified: branches/dunks/src/gui2/Button.cpp =================================================================== --- branches/dunks/src/gui2/Button.cpp 2006-07-31 08:12:26 UTC (rev 62) +++ branches/dunks/src/gui2/Button.cpp 2006-07-31 13:26:23 UTC (rev 63) @@ -1,5 +1,8 @@ #include "gui2/Button.h" #include <stdio.h> +#include "Colours.h" +#include "Font.h" +#include "Application.h" bool Button::handleButtonUp(Uint8 button, Uint16 x, Uint16 y) { @@ -43,13 +46,15 @@ SDL_Rect destrect; destrect.x = offx + m_x; destrect.y = offy + m_y; - + if (m_pressed) { + assert(m_pressed != NULL); SDL_BlitSurface(m_surfPressed, NULL, dest, &destrect); } else { + assert(m_surfNormal != NULL); SDL_BlitSurface(m_surfNormal, NULL, dest, &destrect); }; }; @@ -77,7 +82,62 @@ return Button::handleButtonUp(button, x, y); }; +// ------------------------------------------------------------------ +BoringButton::BoringButton(std::string caption) +{ + m_caption = caption; +}; +BoringButton::~BoringButton() +{ + SDL_FreeSurface(m_surfNormal); + SDL_FreeSurface(m_surfPressed); +}; +void BoringButton::setSize(Uint16 w, Uint16 h) +{ + GraphicButton::setSize(w, h); + redraw(); +}; +void BoringButton::redraw() +{ + if (m_surfNormal != NULL) SDL_FreeSurface(m_surfNormal); + if (m_surfPressed != NULL) SDL_FreeSurface(m_surfPressed); + + m_surfNormal = SDL_CreateRGBSurface(SDL_SWSURFACE, m_width, m_height, 8, + 0, 0, 0, 0); + assert(m_surfNormal != NULL); + + m_surfPressed = SDL_CreateRGBSurface(SDL_SWSURFACE, m_width, m_height, 8, + 0, 0, 0, 0); + assert(m_surfPressed != NULL); + + SDL_Palette* pal = Application::Instance()->Screen()->format->palette; + + SDL_SetColors(m_surfNormal, pal->colors, 0, pal->ncolors); + SDL_SetColors(m_surfPressed, pal->colors, 0, pal->ncolors); + + SDL_FillRect(m_surfNormal, NULL, COLOUR_DARKGREY); + SDL_FillRect(m_surfPressed, NULL, COLOUR_LIGHTGREY); + + Font* font = FontManager::Instance()->getFont("INTRO:INTRO.FNT"); + + Uint16 textw, texth; + font->extents(m_caption.c_str(), textw, texth); + + printf("text wh %u %u\n", textw, texth); + + font->render(m_caption.c_str(), m_surfNormal, + (m_width / 2) - (textw / 2), + (m_height / 2) - (texth / 2), 0); + font->render(m_caption.c_str(), m_surfPressed, + (m_width / 2) - (textw / 2), + (m_height / 2) - (texth / 2), 0); +}; + + + + + Modified: branches/dunks/src/pakview.cpp =================================================================== --- branches/dunks/src/pakview.cpp 2006-07-31 08:12:26 UTC (rev 62) +++ branches/dunks/src/pakview.cpp 2006-07-31 13:26:23 UTC (rev 63) @@ -1,6 +1,9 @@ #include "Application.h" #include "Settings.h" +#include "State.h" +#include "gui2/Button.h" + namespace boost { void throw_exception(std::exception const & e) @@ -10,6 +13,35 @@ } +class PakViewState : public State +{ + public: + PakViewState() + { + m_button = new BoringButton("test"); + m_button->setSize(100, 50); + m_button->setPos(10, 10); + m_button->setVisible(true); + + Application::Instance()->RootWidget()->addChild(m_button); + }; + + ~PakViewState() + { + delete m_button; + }; + + int Execute(float dt) + { + return 0; + }; + + virtual const char* GetName() { return "PakViewState"; } + + private: + BoringButton* m_button; +}; + int main(int argc, char *argv[]) { Settings::Instance()->ParseFile("dunelegacy.cfg"); @@ -18,9 +50,9 @@ Application::Instance()->Init(); //Application::Instance()->PushState( new MainMenuState() ); //Application::Instance()->PushState( new IntroState() ); + + Application::Instance()->RootState()->PushState( new PakViewState() ); - - Application::Instance()->Run(); Application::Destroy(); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <otp...@us...> - 2006-08-03 22:01:18
|
Revision: 78 Author: otpetrik Date: 2006-08-03 15:01:08 -0700 (Thu, 03 Aug 2006) ViewCVS: http://svn.sourceforge.net/dunelegacy/?rev=78&view=rev Log Message: ----------- added log system Modified Paths: -------------- branches/dunks/SConstruct branches/dunks/src/SConscript Added Paths: ----------- branches/dunks/include/Log.h branches/dunks/src/Log.cpp Modified: branches/dunks/SConstruct =================================================================== --- branches/dunks/SConstruct 2006-08-03 18:58:44 UTC (rev 77) +++ branches/dunks/SConstruct 2006-08-03 22:01:08 UTC (rev 78) @@ -57,6 +57,9 @@ "${ZZIP_LIB_PATH}", "${BOOST_LIB_PATH}"]) +# Uncomment to disable logging +#env.Append(CCFLAGS=["-DLOG_DISABLED"]) + Export('env') #SConscript("src/pakfile/SConscript") Added: branches/dunks/include/Log.h =================================================================== --- branches/dunks/include/Log.h (rev 0) +++ branches/dunks/include/Log.h 2006-08-03 22:01:08 UTC (rev 78) @@ -0,0 +1,256 @@ +/*! + \file Log.h + \brief Message logging routines. + + @note + Avoid use of global logging, try using subsystem specific. It allows finer + verbosity control. + + @note + To disable logging altogether, define macro LOG_DISABLED. + + @note + Do not add new log verbosity levels to this file, instead create your own + enum in file in question. Use LOG_LEVEL_AVAILABLE as basis for your enum: + + @code + enum LogAiVerbosity + { + LOG_AI_WORLDWIDE = LOG_VERBOSITY_AVAILABLE, + LOG_AI_PLATOON, + LOG_AI_SQUAD + }; + @endcode + + @note + To make logging easier for subsystem SOMETHING, define your own macros: + + @code + + #define SOMETHING_LOG(level,...) S_LOG("something", level, __VA_ARGS__) + #define SOMETHING_LOG_ERROR(...) SOMETHING_LOG(LOG_ERROR, __VA_ARGS__) + #define SOMETHING_LOG_FATAL(...) SOMETHING_LOG(LOG_FATAL, __VA_ARGS__) + #define SOMETHING_LOG_WARNING(...) SOMETHING_LOG(LOG_WARNING, __VA_ARGS__) + #define SOMETHING_LOG_INFO(...) SOMETHING_LOG(LOG_INFO, __VA_ARGS__) + + @endcode + +*/ + +#ifndef DUNE_LOG_H +#define DUNE_LOG_H + +#include "singleton.h" + +#include <string> +#include <map> +#include <boost/shared_ptr.hpp> + +// TODO: not sure where these belong, mayby separate file Types.h ? (otpetrik) +typedef std::string String; +typedef const std::string &ConstString; + +#ifndef LOG_DISABLED + +//! Log verbosity level +/*! + Used to filter unnecessary messages. +*/ +enum LogVerbosity +{ + //! bye, bye ! + LOG_FATAL = 0, + //! that hurt... + LOG_ERROR, + //! i can handle that + LOG_WARNING, + //! look what's happening + LOG_INFO, + //! first user loglevel + LOG_VERBOSITY_AVAILABLE, + //! last loglevel (used to set full logging) + LOG_VERBOSITY_MAX = 255 +}; + +class LogBackend; + +typedef boost::shared_ptr<LogBackend> LogBackendPtr; + +//! Generic log backend class +/*! + Parent class for all log backends (write to console, + file, screen, network, ...) +*/ +class LogBackend +{ + public: + //! @name Constructors & Destructor + //@{ + + //! Constructor + LogBackend(); + //! Destructor + virtual ~LogBackend(); + + //@} + + //! @name Log methods + //@{ + + //! Log the message + /*! + Called by Log class to log every feasible message. + + @param message message to be logged + */ + virtual void log(const char *message) = 0; + + //@} +}; + +//! Stdout backend class +/*! + Default backend, just writes message to the console. +*/ +class LogBackendStdout : public LogBackend +{ + public: + virtual void log(const char *message); +}; + +//! Log system +/*! + Provides complete logging facilites including different verbosity levels. + + @note: For logging itself, do not use this class, use macros ! + + @see S_LOG, S_LOG_FATAL, S_LOG_ERROR, S_LOG_WARNING, S_LOG_INFO + @see G_LOG, G_LOG_FATAL, G_LOG_ERROR, G_LOG_WARNING, G_LOG_INFO +*/ +class Log : public Singleton<Log> +{ + friend class Singleton<Log>; + + public: + + //! @name Logging + //@{ + + //! Log message + /*! + @param logSystem string identificatin what logged the message + @param verbosity verbosity of message + @param message message itself + */ + void log(ConstString logSystem, LogVerbosity verbosity, ConstString message); + //! Log message + /*! + @param logSystem string identificatin what logged the message + @param verbosity verbosity of message + @param format printf-type message string + */ + void log(ConstString logSystem, LogVerbosity verbosity, const char *format, ...); + + //@} + + + //! @name Verbosity setting + //@{ + + //! Set verbosity level for given system + void setVerbosity(ConstString logSystem, LogVerbosity verbosity); + + //! Set default verbosity level + /* + Sets verbosity level for system with no verbosity level on their own + */ + void setDefaultVerbosity(LogVerbosity verbosity) { defaultVerbosity = verbosity; }; + + //@} + + //! @name Backend + //@{ + + //! Set new backend + void setBackend(LogBackendPtr backend); + //! Get current backend + LogBackendPtr getBackend() { return backend; }; + + //@} + + protected: + + //! @name Constructors & Destructor + //@{ + + //! Constructor + Log(); + //! Destructor + ~Log(); + + //@} + + private: + LogVerbosity defaultVerbosity; + LogBackendPtr backend; + std::map<const String, LogVerbosity> verbosities; + + void doLog(ConstString logSystem, LogVerbosity verbosity, const char *message); + +}; + +// few usefull macros + +//! @name Subsystem logs +//! Subsystem emitted messages +//@{ + +//! Log message of given verbosity emitted by given system +#define S_LOG(system,verbosity,...) Log::Instance()->log(system, verbosity, __VA_ARGS__) +//! Log fatal message emitted by given system +#define S_LOG_FATAL(system,...) Log::Instance()->log(system, LOG_FATAL, __VA_ARGS__) +//! Log error message emitted by given system +#define S_LOG_ERROR(system,...) Log::Instance()->log(system, LOG_ERROR, __VA_ARGS__) +//! Log warning message emitted by given system +#define S_LOG_WARNING(system,...) Log::Instance()->log(system, LOG_WARNING, __VA_ARGS__) +//! Log info message emitted by given system +#define S_LOG_INFO(system,...) Log::Instance()->log(system, LOG_INFO, __VA_ARGS__) + +//@} + +//! @name Global log +//! Messages not bound to any given system +//@{ + +//! Log message of given verbosity +#define G_LOG(level,...) S_LOG("", level, __VA_ARGS__) +//! Log fatal message +#define G_LOG_FATAL(...) G_LOG(LOG_FATAL, __VA_ARGS__) +//! Log error message +#define G_LOG_ERROR(...) G_LOG(LOG_ERROR, __VA_ARGS__) +//! Log warning message +#define G_LOG_WARNING(...) G_LOG(LOG_WARNING, __VA_ARGS__) +//! Log info message +#define G_LOG_INFO(...) G_LOG(LOG_INFO, __VA_ARGS__) + +//@} + +#else // LOG_DISABLED + +// few useless macros + +#define S_LOG(system,verbosity,...) ((void)(0)) +#define S_LOG_FATAL(system,...) ((void)(0)) +#define S_LOG_ERROR(system,...) ((void)(0)) +#define S_LOG_WARNING(system,...) ((void)(0)) +#define S_LOG_INFO(system,...) ((void)(0)) +#define G_LOG(level,...) ((void)(0)) +#define G_LOG_FATAL(...) ((void)(0)) +#define G_LOG_ERROR(...) ((void)(0)) +#define G_LOG_WARNING(...) ((void)(0)) +#define G_LOG_INFO(...) ((void)(0)) + + +#endif // LOG_DISABLED + +#endif // DUNE_LOG_H Added: branches/dunks/src/Log.cpp =================================================================== --- branches/dunks/src/Log.cpp (rev 0) +++ branches/dunks/src/Log.cpp 2006-08-03 22:01:08 UTC (rev 78) @@ -0,0 +1,124 @@ +#include "Log.h" + +#ifndef LOG_DISABLED + +#include <stdio.h> +#include <stdarg.h> + +#define LOG_DEFAULT_VERBOSITY LOG_VERBOSITY_MAX +#define LOG_MAX_STRING_LENGTH 100 + +//------------------------------------------------------------------------------ +// LogBackend class +//------------------------------------------------------------------------------ + +LogBackend::LogBackend() +{ +}; +LogBackend::~LogBackend() +{ +}; + +void LogBackend::log(const char *message) +{ +}; + +//------------------------------------------------------------------------------ +// LogBackendStdout class +//------------------------------------------------------------------------------ + +void LogBackendStdout::log(const char *message) +{ + printf("%s", message); +}; + +//------------------------------------------------------------------------------ +// Log class +//------------------------------------------------------------------------------ + +void Log::log(ConstString logSystem, LogVerbosity verbosity, ConstString message) +{ + doLog(logSystem, verbosity, message.c_str()); +}; +void Log::log(ConstString logSystem, LogVerbosity verbosity, const char *format, ...) +{ + std::map<const String, LogVerbosity>::iterator i; + LogVerbosity systemVerbosity; + static char message[LOG_MAX_STRING_LENGTH]; + + // find verbosity level applicable to this message + i = verbosities.find(logSystem); + if (i != verbosities.end()) + { + systemVerbosity = i->second; + } + else + { + systemVerbosity = defaultVerbosity; + } + + // check that level + if (verbosity > systemVerbosity) + return; + + + // assemble the message + va_list args; + va_start(args, format); + vsnprintf(message, LOG_MAX_STRING_LENGTH, format, args); + va_end(args); + + // log it + doLog(logSystem, verbosity, message); +}; + +void Log::setVerbosity(ConstString logSystem, LogVerbosity verbosity) +{ + verbosities[logSystem] = verbosity; +}; + +void Log::setBackend(LogBackendPtr backend) +{ + assert(backend != NULL); + this->backend = backend; +}; + +Log::Log() : defaultVerbosity(LOG_DEFAULT_VERBOSITY), backend(new LogBackendStdout()) +{ +}; +Log::~Log() +{ +}; + +void Log::doLog(ConstString logSystem, LogVerbosity verbosity, const char *message) +{ + static char formated[LOG_MAX_STRING_LENGTH]; + const char *verb; + + switch (verbosity) + { + case LOG_FATAL: + verb = "[FATAL]"; + break; + case LOG_ERROR: + verb = "[ERROR]"; + break; + case LOG_WARNING: + verb = "[WARNING]"; + break; + case LOG_INFO: + default: + verb = ""; + break; + }; + + // do not print ':' unless there is a logSystem string + if (logSystem.size() != 0) + snprintf(formated, LOG_MAX_STRING_LENGTH, "%s%s: %s\n", verb, logSystem.c_str(), message); + else + snprintf(formated, LOG_MAX_STRING_LENGTH, "%s%s\n", verb, message); + + backend->log(formated); +} + +#endif Modified: branches/dunks/src/SConscript =================================================================== --- branches/dunks/src/SConscript 2006-08-03 18:58:44 UTC (rev 77) +++ branches/dunks/src/SConscript 2006-08-03 22:01:08 UTC (rev 78) @@ -27,6 +27,7 @@ "OptionsMenu.cpp", "Gfx.cpp", "houses.cpp", # just for colors, hope there will be a better place for these (otpetrik) + "Log.cpp", "ResMan.cpp", ] This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <dun...@us...> - 2006-08-07 08:52:54
|
Revision: 87 Author: dunkfordyce Date: 2006-08-07 01:52:30 -0700 (Mon, 07 Aug 2006) ViewCVS: http://svn.sourceforge.net/dunelegacy/?rev=87&view=rev Log Message: ----------- - added MSVS soloution and project - set compiler to include debug info for win32 builds - temporary fix for undefined symbols in Buttons when using Gfx - bit of drawing code for the buttons ( shutdownrunner has more i think ) - commented out Log.cpp in SConscript as it still doesnt work on win32. need to replace vsnprintf - added clear color setting to application Modified Paths: -------------- branches/dunks/SConstruct branches/dunks/include/Application.h branches/dunks/include/ResMan.h branches/dunks/src/Application.cpp branches/dunks/src/IntroState.cpp branches/dunks/src/Log.cpp branches/dunks/src/ResMan.cpp branches/dunks/src/SConscript branches/dunks/src/gui2/Button.cpp Added Paths: ----------- branches/dunks/dunelegacy.sln branches/dunks/dunelegacy.vcproj Modified: branches/dunks/SConstruct =================================================================== --- branches/dunks/SConstruct 2006-08-07 07:18:33 UTC (rev 86) +++ branches/dunks/SConstruct 2006-08-07 08:52:30 UTC (rev 87) @@ -33,8 +33,8 @@ env.Append(CCFLAGS=["-ggdb"]) else: env.Append(LIBS = ["zzipdll", "zdll", "SDLmain"]) - env.Append(LINKFLAGS = ["/SUBSYSTEM:CONSOLE"]) - env.Append(CCFLAGS = ["/O2", "/EHsc", "/MD", "/Op"]) + env.Append(LINKFLAGS = ["/SUBSYSTEM:CONSOLE", "/DEBUG"]) + env.Append(CCFLAGS = ["/O2", "/EHsc", "/MD", "/Op", "/DEBUG", "/Zi"]) env.Append(LIBS = [ "SDL", "SDL_mixer", Added: branches/dunks/dunelegacy.sln =================================================================== --- branches/dunks/dunelegacy.sln (rev 0) +++ branches/dunks/dunelegacy.sln 2006-08-07 08:52:30 UTC (rev 87) @@ -0,0 +1,21 @@ +Microsoft Visual Studio Solution File, Format Version 8.00 +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "dunelegacy", "dunelegacy.vcproj", "{4E0B6F5C-ECCE-6CC6-4AF7-7AF481BEAF22}" + ProjectSection(ProjectDependencies) = postProject + EndProjectSection +EndProject +Global + GlobalSection(SolutionConfiguration) = preSolution + ConfigName.0 = Release + EndGlobalSection + GlobalSection(ProjectConfiguration) = postSolution + {4E0B6F5C-ECCE-6CC6-4AF7-7AF481BEAF22}.Release.ActiveCfg = Release|Win32 + {4E0B6F5C-ECCE-6CC6-4AF7-7AF481BEAF22}.Release.Build.0 = Release|Win32 + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + EndGlobalSection + GlobalSection(ExtensibilityAddIns) = postSolution + EndGlobalSection +EndGlobal +fXEAVQdSZWxlYXNlcQEoY1NDb25zLlRvb2wubXN2cwpDb25maWcKcQJvcQN9cQRVB3ZhcmlhbnRx +BWgBc2JzLg== + Added: branches/dunks/dunelegacy.vcproj =================================================================== --- branches/dunks/dunelegacy.vcproj (rev 0) +++ branches/dunks/dunelegacy.vcproj 2006-08-07 08:52:30 UTC (rev 87) @@ -0,0 +1,414 @@ +<?xml version="1.0" encoding="Windows-1252"?> +<VisualStudioProject + ProjectType="Visual C++" + Version="7.10" + Name="dunelegacy" + SccProjectName="" + SccLocalPath="" + Keyword="MakeFileProj"> + <Platforms> + <Platform + Name="Win32"/> + </Platforms> + <Configurations> + <Configuration + Name="Release|Win32" + OutputDirectory="E:\projects\dunelegacy-dunks" + IntermediateDirectory="E:\projects\dunelegacy-dunks" + ConfigurationType="0" + UseOfMFC="0" + ATLMinimizesCRunTimeLibraryUsage="FALSE"> + <Tool + Name="VCNMakeTool" + BuildCommandLine=""C:\Python24\python.exe" -c "from os.path import join; import sys; sys.path = [ join(sys.prefix, 'Lib', 'site-packages', 'scons-0.96.1'), join(sys.prefix, 'scons-0.96.1'), join(sys.prefix, 'Lib', 'site-packages', 'scons'), join(sys.prefix, 'scons') ] + sys.path; import SCons.Script; SCons.Script.main()" -C E:\projects\dunelegacy-dunks -f SConstruct E:\projects\dunelegacy-dunks\dunelegacy.exe" + ReBuildCommandLine=""C:\Python24\python.exe" -c "from os.path import join; import sys; sys.path = [ join(sys.prefix, 'Lib', 'site-packages', 'scons-0.96.1'), join(sys.prefix, 'scons-0.96.1'), join(sys.prefix, 'Lib', 'site-packages', 'scons'), join(sys.prefix, 'scons') ] + sys.path; import SCons.Script; SCons.Script.main()" -C E:\projects\dunelegacy-dunks -f SConstruct E:\projects\dunelegacy-dunks\dunelegacy.exe" + CleanCommandLine=""C:\Python24\python.exe" -c "from os.path import join; import sys; sys.path = [ join(sys.prefix, 'Lib', 'site-packages', 'scons-0.96.1'), join(sys.prefix, 'scons-0.96.1'), join(sys.prefix, 'Lib', 'site-packages', 'scons'), join(sys.prefix, 'scons') ] + sys.path; import SCons.Script; SCons.Script.main()" -C E:\projects\dunelegacy-dunks -f SConstruct -c E:\projects\dunelegacy-dunks\dunelegacy.exe" + Output="E:\projects\dunelegacy-dunks\dunelegacy.exe"/> + </Configuration> + </Configurations> + <References> + </References> + <Files> + <Filter + Name=" Source Files" + Filter="cpp;c;cxx;l;y;def;odl;idl;hpj;bat"> + <File + RelativePath=".\src\AiPlayerClass.cpp"> + </File> + <File + RelativePath=".\include\AiPlayerClass.h"> + </File> + <File + RelativePath=".\src\Application.cpp"> + </File> + <File + RelativePath=".\include\Application.h"> + </File> + <File + RelativePath=".\src\BuildItemClass.cpp"> + </File> + <File + RelativePath=".\include\BuildItemClass.h"> + </File> + <File + RelativePath=".\src\BulletClass.cpp"> + </File> + <File + RelativePath=".\include\BulletClass.h"> + </File> + <File + RelativePath=".\include\Colours.h"> + </File> + <File + RelativePath=".\src\CommViewClass.cpp"> + </File> + <File + RelativePath=".\include\CommViewClass.h"> + </File> + <File + RelativePath=".\src\CutScene.cpp"> + </File> + <File + RelativePath=".\include\CutScene.h"> + </File> + <File + RelativePath=".\include\data.h"> + </File> + <File + RelativePath=".\src\DataFile.cpp"> + </File> + <File + RelativePath=".\include\DataFile.h"> + </File> + <File + RelativePath=".\include\dMath.h"> + </File> + <File + RelativePath=".\include\DuneConstants.h"> + </File> + <File + RelativePath=".\src\editor.cpp"> + </File> + <File + RelativePath=".\include\Editor.h"> + </File> + <File + RelativePath=".\src\Font.cpp"> + </File> + <File + RelativePath=".\include\Font.h"> + </File> + <File + RelativePath=".\src\Game.cpp"> + </File> + <File + RelativePath=".\include\Game.h"> + </File> + <File + RelativePath=".\src\GameNet.cpp"> + </File> + <File + RelativePath=".\include\GameNet.h"> + </File> + <File + RelativePath=".\src\Gfx.cpp"> + </File> + <File + RelativePath=".\include\Gfx.h"> + </File> + <File + RelativePath=".\src\globals.cpp"> + </File> + <File + RelativePath=".\include\globals.h"> + </File> + <File + RelativePath=".\include\gui.h"> + </File> + <File + RelativePath=".\src\houses.cpp"> + </File> + <File + RelativePath=".\include\houses.h"> + </File> + <File + RelativePath=".\src\IntroState.cpp"> + </File> + <File + RelativePath=".\include\IntroState.h"> + </File> + <File + RelativePath=".\include\Items.h"> + </File> + <File + RelativePath=".\src\Link.cpp"> + </File> + <File + RelativePath=".\include\Link.h"> + </File> + <File + RelativePath=".\src\LinkedList.cpp"> + </File> + <File + RelativePath=".\include\LinkedList.h"> + </File> + <File + RelativePath=".\src\ListIterator.cpp"> + </File> + <File + RelativePath=".\include\ListIterator.h"> + </File> + <File + RelativePath=".\src\listStuff.cpp"> + </File> + <File + RelativePath=".\include\listStuff.h"> + </File> + <File + RelativePath=".\src\Log.cpp"> + </File> + <File + RelativePath=".\include\Log.h"> + </File> + <File + RelativePath=".\src\main.cpp"> + </File> + <File + RelativePath=".\src\MainMenu.cpp"> + </File> + <File + RelativePath=".\include\MainMenu.h"> + </File> + <File + RelativePath=".\src\MapClass.cpp"> + </File> + <File + RelativePath=".\include\MapClass.h"> + </File> + <File + RelativePath=".\src\MapGenerator.cpp"> + </File> + <File + RelativePath=".\include\MapGenerator.h"> + </File> + <File + RelativePath=".\src\MentatClass.cpp"> + </File> + <File + RelativePath=".\include\MentatClass.h"> + </File> + <File + RelativePath=".\src\Menu.cpp"> + </File> + <File + RelativePath=".\include\Menu.h"> + </File> + <File + RelativePath=".\src\MenuBase.cpp"> + </File> + <File + RelativePath=".\include\MenuBase.h"> + </File> + <File + RelativePath=".\src\mmath.cpp"> + </File> + <File + RelativePath=".\include\mmath.h"> + </File> + <File + RelativePath=".\src\Music.cpp"> + </File> + <File + RelativePath=".\include\Music.h"> + </File> + <File + RelativePath=".\src\Net.cpp"> + </File> + <File + RelativePath=".\include\Net.h"> + </File> + <File + RelativePath=".\src\ObjectClass.cpp"> + </File> + <File + RelativePath=".\include\ObjectClass.h"> + </File> + <File + RelativePath=".\src\OptionsMenu.cpp"> + </File> + <File + RelativePath=".\include\OptionsMenu.h"> + </File> + <File + RelativePath=".\src\pakview.cpp"> + </File> + <File + RelativePath=".\src\PlayerClass.cpp"> + </File> + <File + RelativePath=".\include\PlayerClass.h"> + </File> + <File + RelativePath=".\src\PriorityQ.cpp"> + </File> + <File + RelativePath=".\include\PriorityQ.h"> + </File> + <File + RelativePath=".\src\ResMan.cpp"> + </File> + <File + RelativePath=".\include\ResMan.h"> + </File> + <File + RelativePath=".\include\resource.h"> + </File> + <File + RelativePath=".\src\SConscript"> + </File> + <File + RelativePath=".\src\SDL_rwops_zzip.c"> + </File> + <File + RelativePath=".\include\SDL_rwops_zzip.h"> + </File> + <File + RelativePath=".\src\Settings.cpp"> + </File> + <File + RelativePath=".\include\Settings.h"> + </File> + <File + RelativePath=".\src\SingleMenu.cpp"> + </File> + <File + RelativePath=".\include\SingleMenu.h"> + </File> + <File + RelativePath=".\include\singleton.h"> + </File> + <File + RelativePath=".\src\SoundPlayerClass.cpp"> + </File> + <File + RelativePath=".\include\SoundPlayerClass.h"> + </File> + <File + RelativePath=".\src\State.cpp"> + </File> + <File + RelativePath=".\include\State.h"> + </File> + <File + RelativePath=".\src\TerrainClass.cpp"> + </File> + <File + RelativePath=".\include\TerrainClass.h"> + </File> + <File + RelativePath=".\include\terrainData.h"> + </File> + <File + RelativePath=".\src\TopLevelState.cpp"> + </File> + <File + RelativePath=".\include\TopLevelState.h"> + </File> + <File + RelativePath=".\src\ui.cpp"> + </File> + <File + RelativePath=".\include\ui.h"> + </File> + <Filter + Name="pakfile" + Filter=""> + <File + RelativePath=".\src\pakfile\Cpsfile.cpp"> + </File> + <File + RelativePath=".\include\pakfile\Cpsfile.h"> + </File> + <File + RelativePath=".\src\pakfile\Decode.cpp"> + </File> + <File + RelativePath=".\include\pakfile\Decode.h"> + </File> + <File + RelativePath=".\src\pakfile\Icnfile.cpp"> + </File> + <File + RelativePath=".\include\pakfile\Icnfile.h"> + </File> + <File + RelativePath=".\src\pakfile\main.cpp"> + </File> + <File + RelativePath=".\src\pakfile\Pakfile.cpp"> + </File> + <File + RelativePath=".\include\pakfile\Pakfile.h"> + </File> + <File + RelativePath=".\src\pakfile\Palette.cpp"> + </File> + <File + RelativePath=".\include\pakfile\Palette.h"> + </File> + <File + RelativePath=".\src\pakfile\Shpfile.cpp"> + </File> + <File + RelativePath=".\include\pakfile\Shpfile.h"> + </File> + <File + RelativePath=".\src\pakfile\Wsafile.cpp"> + </File> + <File + RelativePath=".\include\pakfile\Wsafile.h"> + </File> + </Filter> + <Filter + Name="gui2" + Filter=""> + <File + RelativePath=".\src\gui2\Button.cpp"> + </File> + <File + RelativePath=".\include\gui2\Button.h"> + </File> + <File + RelativePath=".\src\gui2\Container.cpp"> + </File> + <File + RelativePath=".\include\gui2\Container.h"> + </File> + <File + RelativePath=".\src\gui2\VBox.cpp"> + </File> + <File + RelativePath=".\include\gui2\VBox.h"> + </File> + <File + RelativePath=".\src\gui2\Widget.cpp"> + </File> + <File + RelativePath=".\include\gui2\Widget.h"> + </File> + </Filter> + </Filter> + <Filter + Name="Other Files" + Filter=""> + <File + RelativePath="Changelog"> + </File> + </Filter> + <File + RelativePath=".\SConstruct"> + </File> + </Files> + <Globals> + </Globals> +</VisualStudioProject> Modified: branches/dunks/include/Application.h =================================================================== --- branches/dunks/include/Application.h 2006-08-07 07:18:33 UTC (rev 86) +++ branches/dunks/include/Application.h 2006-08-07 08:52:30 UTC (rev 87) @@ -49,6 +49,8 @@ void SetPalette(); SDL_Palette* GetCurrentPalette() { return m_currentPalette; } + void SetClearColor(Uint32 palIndex) { m_clearColor = palIndex; } + void UpdateVideoMode(bool fullscreen); void UpdateVideoMode(Uint16 w, Uint16 h); void UpdateVideoMode(Uint16 w, Uint16 h, bool fullscreen); @@ -77,6 +79,8 @@ Uint16 m_cursorX, m_cursorY; Cursor m_cursorFrame; SDL_Surface* m_cursor; + + Uint32 m_clearColor; }; Modified: branches/dunks/include/ResMan.h =================================================================== --- branches/dunks/include/ResMan.h 2006-08-07 07:18:33 UTC (rev 86) +++ branches/dunks/include/ResMan.h 2006-08-07 08:52:30 UTC (rev 87) @@ -9,6 +9,8 @@ #include <map> #include <string> +//#include "Log.h" + class FileLike { public: Modified: branches/dunks/src/Application.cpp =================================================================== --- branches/dunks/src/Application.cpp 2006-08-07 07:18:33 UTC (rev 86) +++ branches/dunks/src/Application.cpp 2006-08-07 08:52:30 UTC (rev 87) @@ -328,7 +328,7 @@ while (m_running) { - SDL_FillRect(m_screen, NULL, 0); + SDL_FillRect(m_screen, NULL, m_clearColor); HandleEvents(); Modified: branches/dunks/src/IntroState.cpp =================================================================== --- branches/dunks/src/IntroState.cpp 2006-08-07 07:18:33 UTC (rev 86) +++ branches/dunks/src/IntroState.cpp 2006-08-07 08:52:30 UTC (rev 87) @@ -170,7 +170,7 @@ IntroState::IntroState() { - Frame* tf; + m_currentFrame = NULL; enque( new Frame("INTRO:INTRO1.WSA", Frame::NO_TRANSITION, @@ -253,7 +253,7 @@ void IntroState::JustMadeActive() { - + Application::Instance()->SetClearColor(0); Application::Instance()->RootWidget()->addChild(m_butIntro); State::JustMadeActive(); }; Modified: branches/dunks/src/Log.cpp =================================================================== --- branches/dunks/src/Log.cpp 2006-08-07 07:18:33 UTC (rev 86) +++ branches/dunks/src/Log.cpp 2006-08-07 08:52:30 UTC (rev 87) @@ -2,7 +2,8 @@ #ifndef LOG_DISABLED -#include <stdio.h> +#include +<stdio.h> #include <stdarg.h> #define LOG_DEFAULT_VERBOSITY LOG_VERBOSITY_MAX Modified: branches/dunks/src/ResMan.cpp =================================================================== --- branches/dunks/src/ResMan.cpp 2006-08-07 07:18:33 UTC (rev 86) +++ branches/dunks/src/ResMan.cpp 2006-08-07 08:52:30 UTC (rev 87) @@ -1,8 +1,10 @@ #include "boost/filesystem/path.hpp" #include "boost/filesystem/operations.hpp" +#include "boost/format.hpp" #include "ResMan.h" #include "Settings.h" +//#include "Log.h" //#include "boost/filesystem/fstream.hpp" // ditto @@ -87,7 +89,7 @@ int filesize; unsigned char *buf = m_pakfile->getFile(path.string().c_str(), &filesize); - printf("read pak %s size %d\n", path.string().c_str(), filesize); + //RESMAN_LOG_INFO(boost::format("read pak %s size %d\n") % path.string().c_str() % filesize); assert(buf != NULL); assert(filesize != 0); Modified: branches/dunks/src/SConscript =================================================================== --- branches/dunks/src/SConscript 2006-08-07 07:18:33 UTC (rev 86) +++ branches/dunks/src/SConscript 2006-08-07 08:52:30 UTC (rev 87) @@ -27,7 +27,7 @@ "OptionsMenu.cpp", "Gfx.cpp", "houses.cpp", # just for colors, hope there will be a better place for these (otpetrik) - "Log.cpp", + #"Log.cpp", "ResMan.cpp", ] @@ -50,7 +50,7 @@ ] gamelib = env.StaticLibrary("dune_game", all_sources) -guilib = env.StaticLibrary("dune_gui", gui_sources) +guilib = env.StaticLibrary("dune_gui", gui_sources + gamelib) paklib = env.StaticLibrary("dune_pak", pak_sources) dunelegacy = env.Program("../dunelegacy", ["main.cpp", gamelib, guilib, paklib] ) @@ -59,4 +59,3 @@ Default(dunelegacy) Default(pakview) - Modified: branches/dunks/src/gui2/Button.cpp =================================================================== --- branches/dunks/src/gui2/Button.cpp 2006-08-07 07:18:33 UTC (rev 86) +++ branches/dunks/src/gui2/Button.cpp 2006-08-07 08:52:30 UTC (rev 87) @@ -130,16 +130,16 @@ SDL_FillRect(m_surfNormal, NULL, 115); SDL_FillRect(m_surfPressed, NULL, 115); - /* + // dark brown box SDL_Rect r = {0, 0, m_width -1, m_height -1}; drawRect(m_surfNormal, r, 229, false); // bottom line - drawHLine(m_surfNormal, 1, m_height, m_width, 226); + drawHLine(m_surfNormal, 0, m_height-1, m_width-1, 226, false); // far right line - drawVLine(m_surfNormal, m_width, 0, m_height, 226); - */ + drawVLine(m_surfNormal, m_width-1, 0, m_height-1, 226, false); + Font* font = FontManager::Instance()->getFont("INTRO:INTRO.FNT"); @@ -152,6 +152,9 @@ font->render(m_caption.c_str(), m_surfPressed, (m_width / 2) - (textw / 2), (m_height / 2) - (texth / 2), 47); + + SDL_UnlockSurface(m_surfNormal); + SDL_UnlockSurface(m_surfPressed); }; // ------------------------------------------------------------------ This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <dun...@us...> - 2006-08-09 10:29:00
|
Revision: 94 Author: dunkfordyce Date: 2006-08-09 03:28:51 -0700 (Wed, 09 Aug 2006) ViewCVS: http://svn.sourceforge.net/dunelegacy/?rev=94&view=rev Log Message: ----------- - replaced misused boost::filesystem::path with std::string - updated vcproj to include ConfigFile Modified Paths: -------------- branches/dunks/dunelegacy.vcproj branches/dunks/include/ResMan.h branches/dunks/src/ResMan.cpp Modified: branches/dunks/dunelegacy.vcproj =================================================================== --- branches/dunks/dunelegacy.vcproj 2006-08-09 09:46:55 UTC (rev 93) +++ branches/dunks/dunelegacy.vcproj 2006-08-09 10:28:51 UTC (rev 94) @@ -66,6 +66,12 @@ RelativePath=".\include\CommViewClass.h"> </File> <File + RelativePath=".\src\ConfigFile.cpp"> + </File> + <File + RelativePath=".\include\ConfigFile.h"> + </File> + <File RelativePath=".\src\CutScene.cpp"> </File> <File Modified: branches/dunks/include/ResMan.h =================================================================== --- branches/dunks/include/ResMan.h 2006-08-09 09:46:55 UTC (rev 93) +++ branches/dunks/include/ResMan.h 2006-08-09 10:28:51 UTC (rev 94) @@ -63,20 +63,20 @@ @param size if not NULL the file size is put here @return file data */ - virtual unsigned char* readFile(boost::filesystem::path path, int *size) { return NULL; } + virtual unsigned char* readFile(std::string path, int *size) { return NULL; } /*! read a text file from resource @param path path to the file to open @return text from the file */ - virtual std::string readText(boost::filesystem::path path) { return ""; } + virtual std::string readText(std::string path) { return ""; } /*! write a text file to a resource @param path path to write the file @param text text to write to file */ - virtual void writeText(boost::filesystem::path path, std::string text) {} + virtual void writeText(std::string, std::string text) {} /*! return true if the resource can be written to @@ -97,8 +97,8 @@ { public: DIRResource(boost::filesystem::path path) ; - unsigned char* readFile(boost::filesystem::path path, int *size); - std::string readText(boost::filesystem::path path); + unsigned char* readFile(std::string path, int *size); + std::string readText(std::string path); }; /*! @@ -107,8 +107,8 @@ class WritableDIRResource : public DIRResource { public: - WritableDIRResource(boost::filesystem::path path); - void writeText(boost::filesystem::path path, std::string text); + WritableDIRResource(std::string path); + void writeText(std::string path, std::string text); }; /*! @@ -119,7 +119,7 @@ public: PAKResource(boost::filesystem::path path) ; ~PAKResource(); - unsigned char* readFile(boost::filesystem::path path, int *size); + unsigned char* readFile(std::string path, int *size); private: Pakfile *m_pakfile; Modified: branches/dunks/src/ResMan.cpp =================================================================== --- branches/dunks/src/ResMan.cpp 2006-08-09 09:46:55 UTC (rev 93) +++ branches/dunks/src/ResMan.cpp 2006-08-09 10:28:51 UTC (rev 94) @@ -58,7 +58,7 @@ m_path = path; }; -unsigned char* DIRResource::readFile(bfs::path path, int *size) +unsigned char* DIRResource::readFile(std::string path, int *size) { // TODO: seems to work now, tested on linux, please test it on windows. (otpetrik) bfs::path fullpath (m_path); @@ -81,7 +81,7 @@ return buf; }; -std::string DIRResource::readText(boost::filesystem::path path) +std::string DIRResource::readText(std::string path) { bfs::path fullpath (m_path); fullpath /= path; @@ -103,12 +103,12 @@ // ------------------------------------------------------------------ -WritableDIRResource::WritableDIRResource(boost::filesystem::path path) : DIRResource(path) +WritableDIRResource::WritableDIRResource(std::string path) : DIRResource(path) { mb_writable = true; }; -void WritableDIRResource::writeText(boost::filesystem::path path, std::string text) +void WritableDIRResource::writeText(std::string path, std::string text) { bfs::path fullpath(m_path); fullpath /= path; @@ -132,10 +132,10 @@ delete m_pakfile; }; -unsigned char* PAKResource::readFile(bfs::path path, int *size) +unsigned char* PAKResource::readFile(std::string path, int *size) { int filesize; - unsigned char *buf = m_pakfile->getFile(path.string().c_str(), &filesize); + unsigned char *buf = m_pakfile->getFile(path.c_str(), &filesize); //RESMAN_LOG_INFO(boost::format("read pak %s size %d\n") % path.string().c_str() % filesize); @@ -270,10 +270,17 @@ Resource* res = getResource(name, filename); if (res == NULL) { - printf("resource not found!\n"); + printf("resource not found!\n"); + assert(0); + return; }; - assert(res != NULL); + if (!res->isWritable()) + { + printf("resource not writable!\n"); + assert(0); + return; + }; res->writeText(filename, text); } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <dun...@us...> - 2006-08-09 09:47:10
|
Revision: 93 Author: dunkfordyce Date: 2006-08-09 02:46:55 -0700 (Wed, 09 Aug 2006) ViewCVS: http://svn.sourceforge.net/dunelegacy/?rev=93&view=rev Log Message: ----------- - updated doxygen.conf to include non doc'd methods - added readText and writeText functions to Resource and ResMan. These read and write std::string's - added WritableDIRResource class for config files etc - added resource CONFIG. currently set to use the current directory. ( otpetrik see Application.cpp for example read/write usage ) Modified Paths: -------------- branches/dunks/doxygen.conf branches/dunks/include/ResMan.h branches/dunks/src/Application.cpp branches/dunks/src/ResMan.cpp Modified: branches/dunks/doxygen.conf =================================================================== --- branches/dunks/doxygen.conf 2006-08-08 18:09:59 UTC (rev 92) +++ branches/dunks/doxygen.conf 2006-08-09 09:46:55 UTC (rev 93) @@ -1,1237 +1,225 @@ -# Doxyfile 1.4.6 +# Doxyfile 1.4.7 -# This file describes the settings to be used by the documentation system -# doxygen (www.doxygen.org) for a project -# -# All text after a hash (#) is considered a comment and will be ignored -# The format is: -# TAG = value [value, ...] -# For lists items can also be appended using: -# TAG += value [value, ...] -# Values that contain spaces should be placed between quotes (" ") - #--------------------------------------------------------------------------- # Project related configuration options #--------------------------------------------------------------------------- - -# The PROJECT_NAME tag is a single word (or a sequence of words surrounded -# by quotes) that should identify the project. - -PROJECT_NAME = Dune Legacy - -# The PROJECT_NUMBER tag can be used to enter a project or revision number. -# This could be handy for archiving the generated documentation or -# if some version control system is used. - +PROJECT_NAME = DuneLegacy PROJECT_NUMBER = - -# The OUTPUT_DIRECTORY tag is used to specify the (relative or absolute) -# base path where the generated documentation will be put. -# If a relative path is entered, it will be relative to the location -# where doxygen was started. If left blank the current directory will be used. - OUTPUT_DIRECTORY = doc - -# If the CREATE_SUBDIRS tag is set to YES, then doxygen will create -# 4096 sub-directories (in 2 levels) under the output directory of each output -# format and will distribute the generated files over these directories. -# Enabling this option can be useful when feeding doxygen a huge amount of -# source files, where putting all generated files in the same directory would -# otherwise cause performance problems for the file system. - CREATE_SUBDIRS = YES - -# The OUTPUT_LANGUAGE tag is used to specify the language in which all -# documentation generated by doxygen is written. Doxygen will use this -# information to generate all constant output in the proper language. -# The default language is English, other supported languages are: -# Brazilian, Catalan, Chinese, Chinese-Traditional, Croatian, Czech, Danish, -# Dutch, Finnish, French, German, Greek, Hungarian, Italian, Japanese, -# Japanese-en (Japanese with English messages), Korean, Korean-en, Norwegian, -# Polish, Portuguese, Romanian, Russian, Serbian, Slovak, Slovene, Spanish, -# Swedish, and Ukrainian. - OUTPUT_LANGUAGE = English - -# This tag can be used to specify the encoding used in the generated output. -# The encoding is not always determined by the language that is chosen, -# but also whether or not the output is meant for Windows or non-Windows users. -# In case there is a difference, setting the USE_WINDOWS_ENCODING tag to YES -# forces the Windows encoding (this is the default for the Windows binary), -# whereas setting the tag to NO uses a Unix-style encoding (the default for -# all platforms other than Windows). - USE_WINDOWS_ENCODING = NO - -# If the BRIEF_MEMBER_DESC tag is set to YES (the default) Doxygen will -# include brief member descriptions after the members that are listed in -# the file and class documentation (similar to JavaDoc). -# Set to NO to disable this. - BRIEF_MEMBER_DESC = YES - -# If the REPEAT_BRIEF tag is set to YES (the default) Doxygen will prepend -# the brief description of a member or function before the detailed description. -# Note: if both HIDE_UNDOC_MEMBERS and BRIEF_MEMBER_DESC are set to NO, the -# brief descriptions will be completely suppressed. - REPEAT_BRIEF = YES - -# This tag implements a quasi-intelligent brief description abbreviator -# that is used to form the text in various listings. Each string -# in this list, if found as the leading text of the brief description, will be -# stripped from the text and the result after processing the whole list, is -# used as the annotated text. Otherwise, the brief description is used as-is. -# If left blank, the following values are used ("$name" is automatically -# replaced with the name of the entity): "The $name class" "The $name widget" -# "The $name file" "is" "provides" "specifies" "contains" -# "represents" "a" "an" "the" - ABBREVIATE_BRIEF = - -# If the ALWAYS_DETAILED_SEC and REPEAT_BRIEF tags are both set to YES then -# Doxygen will generate a detailed section even if there is only a brief -# description. - ALWAYS_DETAILED_SEC = NO - -# If the INLINE_INHERITED_MEMB tag is set to YES, doxygen will show all -# inherited members of a class in the documentation of that class as if those -# members were ordinary class members. Constructors, destructors and assignment -# operators of the base classes will not be shown. - INLINE_INHERITED_MEMB = NO - -# If the FULL_PATH_NAMES tag is set to YES then Doxygen will prepend the full -# path before files name in the file list and in the header files. If set -# to NO the shortest path that makes the file name unique will be used. - FULL_PATH_NAMES = YES - -# If the FULL_PATH_NAMES tag is set to YES then the STRIP_FROM_PATH tag -# can be used to strip a user-defined part of the path. Stripping is -# only done if one of the specified strings matches the left-hand part of -# the path. The tag can be used to show relative paths in the file list. -# If left blank the directory from which doxygen is run is used as the -# path to strip. - STRIP_FROM_PATH = - -# The STRIP_FROM_INC_PATH tag can be used to strip a user-defined part of -# the path mentioned in the documentation of a class, which tells -# the reader which header file to include in order to use a class. -# If left blank only the name of the header file containing the class -# definition is used. Otherwise one should specify the include paths that -# are normally passed to the compiler using the -I flag. - STRIP_FROM_INC_PATH = - -# If the SHORT_NAMES tag is set to YES, doxygen will generate much shorter -# (but less readable) file names. This can be useful is your file systems -# doesn't support long names like on DOS, Mac, or CD-ROM. - SHORT_NAMES = NO - -# If the JAVADOC_AUTOBRIEF tag is set to YES then Doxygen -# will interpret the first line (until the first dot) of a JavaDoc-style -# comment as the brief description. If set to NO, the JavaDoc -# comments will behave just like the Qt-style comments (thus requiring an -# explicit @brief command for a brief description. - JAVADOC_AUTOBRIEF = NO - -# The MULTILINE_CPP_IS_BRIEF tag can be set to YES to make Doxygen -# treat a multi-line C++ special comment block (i.e. a block of //! or /// -# comments) as a brief description. This used to be the default behaviour. -# The new default is to treat a multi-line C++ comment block as a detailed -# description. Set this tag to YES if you prefer the old behaviour instead. - MULTILINE_CPP_IS_BRIEF = NO - -# If the DETAILS_AT_TOP tag is set to YES then Doxygen -# will output the detailed description near the top, like JavaDoc. -# If set to NO, the detailed description appears after the member -# documentation. - DETAILS_AT_TOP = NO - -# If the INHERIT_DOCS tag is set to YES (the default) then an undocumented -# member inherits the documentation from any documented member that it -# re-implements. - INHERIT_DOCS = YES - -# If the SEPARATE_MEMBER_PAGES tag is set to YES, then doxygen will produce -# a new page for each member. If set to NO, the documentation of a member will -# be part of the file/class/namespace that contains it. - SEPARATE_MEMBER_PAGES = NO - -# The TAB_SIZE tag can be used to set the number of spaces in a tab. -# Doxygen uses this value to replace tabs by spaces in code fragments. - TAB_SIZE = 8 - -# This tag can be used to specify a number of aliases that acts -# as commands in the documentation. An alias has the form "name=value". -# For example adding "sideeffect=\par Side Effects:\n" will allow you to -# put the command \sideeffect (or @sideeffect) in the documentation, which -# will result in a user-defined paragraph with heading "Side Effects:". -# You can put \n's in the value part of an alias to insert newlines. - ALIASES = - -# Set the OPTIMIZE_OUTPUT_FOR_C tag to YES if your project consists of C -# sources only. Doxygen will then generate output that is more tailored for C. -# For instance, some of the names that are used will be different. The list -# of all members will be omitted, etc. - OPTIMIZE_OUTPUT_FOR_C = NO - -# Set the OPTIMIZE_OUTPUT_JAVA tag to YES if your project consists of Java -# sources only. Doxygen will then generate output that is more tailored for Java. -# For instance, namespaces will be presented as packages, qualified scopes -# will look different, etc. - OPTIMIZE_OUTPUT_JAVA = NO - -# If you use STL classes (i.e. std::string, std::vector, etc.) but do not want to -# include (a tag file for) the STL sources as input, then you should -# set this tag to YES in order to let doxygen match functions declarations and -# definitions whose arguments contain STL classes (e.g. func(std::string); v.s. -# func(std::string) {}). This also make the inheritance and collaboration -# diagrams that involve STL classes more complete and accurate. - BUILTIN_STL_SUPPORT = NO - -# If member grouping is used in the documentation and the DISTRIBUTE_GROUP_DOC -# tag is set to YES, then doxygen will reuse the documentation of the first -# member in the group (if any) for the other members of the group. By default -# all members of a group must be documented explicitly. - DISTRIBUTE_GROUP_DOC = NO - -# Set the SUBGROUPING tag to YES (the default) to allow class member groups of -# the same type (for instance a group of public functions) to be put as a -# subgroup of that type (e.g. under the Public Functions section). Set it to -# NO to prevent subgrouping. Alternatively, this can be done per class using -# the \nosubgrouping command. - SUBGROUPING = YES - #--------------------------------------------------------------------------- # Build related configuration options #--------------------------------------------------------------------------- - -# If the EXTRACT_ALL tag is set to YES doxygen will assume all entities in -# documentation are documented, even if no documentation was available. -# Private class members and static file members will be hidden unless -# the EXTRACT_PRIVATE and EXTRACT_STATIC tags are set to YES - -EXTRACT_ALL = NO - -# If the EXTRACT_PRIVATE tag is set to YES all private members of a class -# will be included in the documentation. - -EXTRACT_PRIVATE = NO - -# If the EXTRACT_STATIC tag is set to YES all static members of a file -# will be included in the documentation. - -EXTRACT_STATIC = NO - -# If the EXTRACT_LOCAL_CLASSES tag is set to YES classes (and structs) -# defined locally in source files will be included in the documentation. -# If set to NO only classes defined in header files are included. - +EXTRACT_ALL = YES +EXTRACT_PRIVATE = YES +EXTRACT_STATIC = YES EXTRACT_LOCAL_CLASSES = YES - -# This flag is only useful for Objective-C code. When set to YES local -# methods, which are defined in the implementation section but not in -# the interface are included in the documentation. -# If set to NO (the default) only methods in the interface are included. - EXTRACT_LOCAL_METHODS = NO - -# If the HIDE_UNDOC_MEMBERS tag is set to YES, Doxygen will hide all -# undocumented members of documented classes, files or namespaces. -# If set to NO (the default) these members will be included in the -# various overviews, but no documentation section is generated. -# This option has no effect if EXTRACT_ALL is enabled. - HIDE_UNDOC_MEMBERS = NO - -# If the HIDE_UNDOC_CLASSES tag is set to YES, Doxygen will hide all -# undocumented classes that are normally visible in the class hierarchy. -# If set to NO (the default) these classes will be included in the various -# overviews. This option has no effect if EXTRACT_ALL is enabled. - HIDE_UNDOC_CLASSES = NO - -# If the HIDE_FRIEND_COMPOUNDS tag is set to YES, Doxygen will hide all -# friend (class|struct|union) declarations. -# If set to NO (the default) these declarations will be included in the -# documentation. - HIDE_FRIEND_COMPOUNDS = NO - -# If the HIDE_IN_BODY_DOCS tag is set to YES, Doxygen will hide any -# documentation blocks found inside the body of a function. -# If set to NO (the default) these blocks will be appended to the -# function's detailed documentation block. - HIDE_IN_BODY_DOCS = NO - -# The INTERNAL_DOCS tag determines if documentation -# that is typed after a \internal command is included. If the tag is set -# to NO (the default) then the documentation will be excluded. -# Set it to YES to include the internal documentation. - INTERNAL_DOCS = NO - -# If the CASE_SENSE_NAMES tag is set to NO then Doxygen will only generate -# file names in lower-case letters. If set to YES upper-case letters are also -# allowed. This is useful if you have classes or files whose names only differ -# in case and if your file system supports case sensitive file names. Windows -# and Mac users are advised to set this option to NO. - CASE_SENSE_NAMES = YES - -# If the HIDE_SCOPE_NAMES tag is set to NO (the default) then Doxygen -# will show members with their full class and namespace scopes in the -# documentation. If set to YES the scope will be hidden. - HIDE_SCOPE_NAMES = NO - -# If the SHOW_INCLUDE_FILES tag is set to YES (the default) then Doxygen -# will put a list of the files that are included by a file in the documentation -# of that file. - SHOW_INCLUDE_FILES = YES - -# If the INLINE_INFO tag is set to YES (the default) then a tag [inline] -# is inserted in the documentation for inline members. - INLINE_INFO = YES - -# If the SORT_MEMBER_DOCS tag is set to YES (the default) then doxygen -# will sort the (detailed) documentation of file and class members -# alphabetically by member name. If set to NO the members will appear in -# declaration order. - SORT_MEMBER_DOCS = YES - -# If the SORT_BRIEF_DOCS tag is set to YES then doxygen will sort the -# brief documentation of file, namespace and class members alphabetically -# by member name. If set to NO (the default) the members will appear in -# declaration order. - SORT_BRIEF_DOCS = NO - -# If the SORT_BY_SCOPE_NAME tag is set to YES, the class list will be -# sorted by fully-qualified names, including namespaces. If set to -# NO (the default), the class list will be sorted only by class name, -# not including the namespace part. -# Note: This option is not very useful if HIDE_SCOPE_NAMES is set to YES. -# Note: This option applies only to the class list, not to the -# alphabetical list. - SORT_BY_SCOPE_NAME = NO - -# The GENERATE_TODOLIST tag can be used to enable (YES) or -# disable (NO) the todo list. This list is created by putting \todo -# commands in the documentation. - GENERATE_TODOLIST = YES - -# The GENERATE_TESTLIST tag can be used to enable (YES) or -# disable (NO) the test list. This list is created by putting \test -# commands in the documentation. - GENERATE_TESTLIST = YES - -# The GENERATE_BUGLIST tag can be used to enable (YES) or -# disable (NO) the bug list. This list is created by putting \bug -# commands in the documentation. - GENERATE_BUGLIST = YES - -# The GENERATE_DEPRECATEDLIST tag can be used to enable (YES) or -# disable (NO) the deprecated list. This list is created by putting -# \deprecated commands in the documentation. - GENERATE_DEPRECATEDLIST= YES - -# The ENABLED_SECTIONS tag can be used to enable conditional -# documentation sections, marked by \if sectionname ... \endif. - ENABLED_SECTIONS = - -# The MAX_INITIALIZER_LINES tag determines the maximum number of lines -# the initial value of a variable or define consists of for it to appear in -# the documentation. If the initializer consists of more lines than specified -# here it will be hidden. Use a value of 0 to hide initializers completely. -# The appearance of the initializer of individual variables and defines in the -# documentation can be controlled using \showinitializer or \hideinitializer -# command in the documentation regardless of this setting. - MAX_INITIALIZER_LINES = 30 - -# Set the SHOW_USED_FILES tag to NO to disable the list of files generated -# at the bottom of the documentation of classes and structs. If set to YES the -# list will mention the files that were used to generate the documentation. - SHOW_USED_FILES = YES - -# If the sources in your project are distributed over multiple directories -# then setting the SHOW_DIRECTORIES tag to YES will show the directory hierarchy -# in the documentation. The default is NO. - SHOW_DIRECTORIES = NO - -# The FILE_VERSION_FILTER tag can be used to specify a program or script that -# doxygen should invoke to get the current version for each file (typically from the -# version control system). Doxygen will invoke the program by executing (via -# popen()) the command <command> <input-file>, where <command> is the value of -# the FILE_VERSION_FILTER tag, and <input-file> is the name of an input file -# provided by doxygen. Whatever the program writes to standard output -# is used as the file version. See the manual for examples. - FILE_VERSION_FILTER = - #--------------------------------------------------------------------------- # configuration options related to warning and progress messages #--------------------------------------------------------------------------- - -# The QUIET tag can be used to turn on/off the messages that are generated -# by doxygen. Possible values are YES and NO. If left blank NO is used. - QUIET = NO - -# The WARNINGS tag can be used to turn on/off the warning messages that are -# generated by doxygen. Possible values are YES and NO. If left blank -# NO is used. - WARNINGS = YES - -# If WARN_IF_UNDOCUMENTED is set to YES, then doxygen will generate warnings -# for undocumented members. If EXTRACT_ALL is set to YES then this flag will -# automatically be disabled. - WARN_IF_UNDOCUMENTED = YES - -# If WARN_IF_DOC_ERROR is set to YES, doxygen will generate warnings for -# potential errors in the documentation, such as not documenting some -# parameters in a documented function, or documenting parameters that -# don't exist or using markup commands wrongly. - WARN_IF_DOC_ERROR = YES - -# This WARN_NO_PARAMDOC option can be abled to get warnings for -# functions that are documented, but have no documentation for their parameters -# or return value. If set to NO (the default) doxygen will only warn about -# wrong or incomplete parameter documentation, but not about the absence of -# documentation. - WARN_NO_PARAMDOC = NO - -# The WARN_FORMAT tag determines the format of the warning messages that -# doxygen can produce. The string should contain the $file, $line, and $text -# tags, which will be replaced by the file and line number from which the -# warning originated and the warning text. Optionally the format may contain -# $version, which will be replaced by the version of the file (if it could -# be obtained via FILE_VERSION_FILTER) - WARN_FORMAT = "$file:$line: $text" - -# The WARN_LOGFILE tag can be used to specify a file to which warning -# and error messages should be written. If left blank the output is written -# to stderr. - WARN_LOGFILE = - #--------------------------------------------------------------------------- # configuration options related to the input files #--------------------------------------------------------------------------- - -# The INPUT tag can be used to specify the files and/or directories that contain -# documented source files. You may enter file names like "myfile.cpp" or -# directories like "/usr/src/myproject". Separate the files or directories -# with spaces. - INPUT = include/ - -# If the value of the INPUT tag contains directories, you can use the -# FILE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp -# and *.h) to filter out the source-files in the directories. If left -# blank the following patterns are tested: -# *.c *.cc *.cxx *.cpp *.c++ *.java *.ii *.ixx *.ipp *.i++ *.inl *.h *.hh *.hxx -# *.hpp *.h++ *.idl *.odl *.cs *.php *.php3 *.inc *.m *.mm *.py - FILE_PATTERNS = *.h - -# The RECURSIVE tag can be used to turn specify whether or not subdirectories -# should be searched for input files as well. Possible values are YES and NO. -# If left blank NO is used. - RECURSIVE = YES - -# The EXCLUDE tag can be used to specify files and/or directories that should -# excluded from the INPUT source files. This way you can easily exclude a -# subdirectory from a directory tree whose root is specified with the INPUT tag. - EXCLUDE = - -# The EXCLUDE_SYMLINKS tag can be used select whether or not files or -# directories that are symbolic links (a Unix filesystem feature) are excluded -# from the input. - EXCLUDE_SYMLINKS = NO - -# If the value of the INPUT tag contains directories, you can use the -# EXCLUDE_PATTERNS tag to specify one or more wildcard patterns to exclude -# certain files from those directories. Note that the wildcards are matched -# against the file with absolute path, so to exclude all test directories -# for example use the pattern */test/* - EXCLUDE_PATTERNS = - -# The EXAMPLE_PATH tag can be used to specify one or more files or -# directories that contain example code fragments that are included (see -# the \include command). - EXAMPLE_PATH = - -# If the value of the EXAMPLE_PATH tag contains directories, you can use the -# EXAMPLE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp -# and *.h) to filter out the source-files in the directories. If left -# blank all files are included. - EXAMPLE_PATTERNS = - -# If the EXAMPLE_RECURSIVE tag is set to YES then subdirectories will be -# searched for input files to be used with the \include or \dontinclude -# commands irrespective of the value of the RECURSIVE tag. -# Possible values are YES and NO. If left blank NO is used. - EXAMPLE_RECURSIVE = NO - -# The IMAGE_PATH tag can be used to specify one or more files or -# directories that contain image that are included in the documentation (see -# the \image command). - IMAGE_PATH = - -# The INPUT_FILTER tag can be used to specify a program that doxygen should -# invoke to filter for each input file. Doxygen will invoke the filter program -# by executing (via popen()) the command <filter> <input-file>, where <filter> -# is the value of the INPUT_FILTER tag, and <input-file> is the name of an -# input file. Doxygen will then use the output that the filter program writes -# to standard output. If FILTER_PATTERNS is specified, this tag will be -# ignored. - INPUT_FILTER = - -# The FILTER_PATTERNS tag can be used to specify filters on a per file pattern -# basis. Doxygen will compare the file name with each pattern and apply the -# filter if there is a match. The filters are a list of the form: -# pattern=filter (like *.cpp=my_cpp_filter). See INPUT_FILTER for further -# info on how filters are used. If FILTER_PATTERNS is empty, INPUT_FILTER -# is applied to all files. - FILTER_PATTERNS = - -# If the FILTER_SOURCE_FILES tag is set to YES, the input filter (if set using -# INPUT_FILTER) will be used to filter the input files when producing source -# files to browse (i.e. when SOURCE_BROWSER is set to YES). - FILTER_SOURCE_FILES = NO - #--------------------------------------------------------------------------- # configuration options related to source browsing #--------------------------------------------------------------------------- - -# If the SOURCE_BROWSER tag is set to YES then a list of source files will -# be generated. Documented entities will be cross-referenced with these sources. -# Note: To get rid of all source code in the generated output, make sure also -# VERBATIM_HEADERS is set to NO. - -SOURCE_BROWSER = NO - -# Setting the INLINE_SOURCES tag to YES will include the body -# of functions and classes directly in the documentation. - +SOURCE_BROWSER = YES INLINE_SOURCES = NO - -# Setting the STRIP_CODE_COMMENTS tag to YES (the default) will instruct -# doxygen to hide any special comment blocks from generated source code -# fragments. Normal C and C++ comments will always remain visible. - STRIP_CODE_COMMENTS = YES - -# If the REFERENCED_BY_RELATION tag is set to YES (the default) -# then for each documented function all documented -# functions referencing it will be listed. - REFERENCED_BY_RELATION = YES - -# If the REFERENCES_RELATION tag is set to YES (the default) -# then for each documented function all documented entities -# called/used by that function will be listed. - REFERENCES_RELATION = YES - -# If the USE_HTAGS tag is set to YES then the references to source code -# will point to the HTML generated by the htags(1) tool instead of doxygen -# built-in source browser. The htags tool is part of GNU's global source -# tagging system (see http://www.gnu.org/software/global/global.html). You -# will need version 4.8.6 or higher. - +REFERENCES_LINK_SOURCE = YES USE_HTAGS = NO - -# If the VERBATIM_HEADERS tag is set to YES (the default) then Doxygen -# will generate a verbatim copy of the header file for each class for -# which an include is specified. Set to NO to disable this. - VERBATIM_HEADERS = YES - #--------------------------------------------------------------------------- # configuration options related to the alphabetical class index #--------------------------------------------------------------------------- - -# If the ALPHABETICAL_INDEX tag is set to YES, an alphabetical index -# of all compounds will be generated. Enable this if the project -# contains a lot of classes, structs, unions or interfaces. - -ALPHABETICAL_INDEX = NO - -# If the alphabetical index is enabled (see ALPHABETICAL_INDEX) then -# the COLS_IN_ALPHA_INDEX tag can be used to specify the number of columns -# in which this list will be split (can be a number in the range [1..20]) - -COLS_IN_ALPHA_INDEX = 5 - -# In case all classes in a project start with a common prefix, all -# classes will be put under the same header in the alphabetical index. -# The IGNORE_PREFIX tag can be used to specify one or more prefixes that -# should be ignored while generating the index headers. - +ALPHABETICAL_INDEX = YES +COLS_IN_ALPHA_INDEX = 4 IGNORE_PREFIX = - #--------------------------------------------------------------------------- # configuration options related to the HTML output #--------------------------------------------------------------------------- - -# If the GENERATE_HTML tag is set to YES (the default) Doxygen will -# generate HTML output. - GENERATE_HTML = YES - -# The HTML_OUTPUT tag is used to specify where the HTML docs will be put. -# If a relative path is entered the value of OUTPUT_DIRECTORY will be -# put in front of it. If left blank `html' will be used as the default path. - HTML_OUTPUT = html - -# The HTML_FILE_EXTENSION tag can be used to specify the file extension for -# each generated HTML page (for example: .htm,.php,.asp). If it is left blank -# doxygen will generate files with .html extension. - HTML_FILE_EXTENSION = .html - -# The HTML_HEADER tag can be used to specify a personal HTML header for -# each generated HTML page. If it is left blank doxygen will generate a -# standard header. - HTML_HEADER = - -# The HTML_FOOTER tag can be used to specify a personal HTML footer for -# each generated HTML page. If it is left blank doxygen will generate a -# standard footer. - HTML_FOOTER = - -# The HTML_STYLESHEET tag can be used to specify a user-defined cascading -# style sheet that is used by each HTML page. It can be used to -# fine-tune the look of the HTML output. If the tag is left blank doxygen -# will generate a default style sheet. Note that doxygen will try to copy -# the style sheet file to the HTML output directory, so don't put your own -# stylesheet in the HTML output directory as well, or it will be erased! - HTML_STYLESHEET = - -# If the HTML_ALIGN_MEMBERS tag is set to YES, the members of classes, -# files or namespaces will be aligned in HTML using tables. If set to -# NO a bullet list will be used. - HTML_ALIGN_MEMBERS = YES - -# If the GENERATE_HTMLHELP tag is set to YES, additional index files -# will be generated that can be used as input for tools like the -# Microsoft HTML help workshop to generate a compressed HTML help file (.chm) -# of the generated HTML documentation. - GENERATE_HTMLHELP = NO - -# If the GENERATE_HTMLHELP tag is set to YES, the CHM_FILE tag can -# be used to specify the file name of the resulting .chm file. You -# can add a path in front of the file if the result should not be -# written to the html output directory. - CHM_FILE = - -# If the GENERATE_HTMLHELP tag is set to YES, the HHC_LOCATION tag can -# be used to specify the location (absolute path including file name) of -# the HTML help compiler (hhc.exe). If non-empty doxygen will try to run -# the HTML help compiler on the generated index.hhp. - HHC_LOCATION = - -# If the GENERATE_HTMLHELP tag is set to YES, the GENERATE_CHI flag -# controls if a separate .chi index file is generated (YES) or that -# it should be included in the master .chm file (NO). - GENERATE_CHI = NO - -# If the GENERATE_HTMLHELP tag is set to YES, the BINARY_TOC flag -# controls whether a binary table of contents is generated (YES) or a -# normal table of contents (NO) in the .chm file. - BINARY_TOC = NO - -# The TOC_EXPAND flag can be set to YES to add extra items for group members -# to the contents of the HTML help documentation and to the tree view. - TOC_EXPAND = NO - -# The DISABLE_INDEX tag can be used to turn on/off the condensed index at -# top of each HTML page. The value NO (the default) enables the index and -# the value YES disables it. - DISABLE_INDEX = NO - -# This tag can be used to set the number of enum values (range [1..20]) -# that doxygen will group on one line in the generated HTML documentation. - ENUM_VALUES_PER_LINE = 4 - -# If the GENERATE_TREEVIEW tag is set to YES, a side panel will be -# generated containing a tree-like index structure (just like the one that -# is generated for HTML Help). For this to work a browser that supports -# JavaScript, DHTML, CSS and frames is required (for instance Mozilla 1.0+, -# Netscape 6.0+, Internet explorer 5.0+, or Konqueror). Windows users are -# probably better off using the HTML help feature. - GENERATE_TREEVIEW = NO - -# If the treeview is enabled (see GENERATE_TREEVIEW) then this tag can be -# used to set the initial width (in pixels) of the frame in which the tree -# is shown. - TREEVIEW_WIDTH = 250 - #--------------------------------------------------------------------------- # configuration options related to the LaTeX output #--------------------------------------------------------------------------- - -# If the GENERATE_LATEX tag is set to YES (the default) Doxygen will -# generate Latex output. - GENERATE_LATEX = NO - -# The LATEX_OUTPUT tag is used to specify where the LaTeX docs will be put. -# If a relative path is entered the value of OUTPUT_DIRECTORY will be -# put in front of it. If left blank `latex' will be used as the default path. - LATEX_OUTPUT = latex - -# The LATEX_CMD_NAME tag can be used to specify the LaTeX command name to be -# invoked. If left blank `latex' will be used as the default command name. - LATEX_CMD_NAME = latex - -# The MAKEINDEX_CMD_NAME tag can be used to specify the command name to -# generate index for LaTeX. If left blank `makeindex' will be used as the -# default command name. - MAKEINDEX_CMD_NAME = makeindex - -# If the COMPACT_LATEX tag is set to YES Doxygen generates more compact -# LaTeX documents. This may be useful for small projects and may help to -# save some trees in general. - COMPACT_LATEX = NO - -# The PAPER_TYPE tag can be used to set the paper type that is used -# by the printer. Possible values are: a4, a4wide, letter, legal and -# executive. If left blank a4wide will be used. - PAPER_TYPE = a4wide - -# The EXTRA_PACKAGES tag can be to specify one or more names of LaTeX -# packages that should be included in the LaTeX output. - EXTRA_PACKAGES = - -# The LATEX_HEADER tag can be used to specify a personal LaTeX header for -# the generated latex document. The header should contain everything until -# the first chapter. If it is left blank doxygen will generate a -# standard header. Notice: only use this tag if you know what you are doing! - LATEX_HEADER = - -# If the PDF_HYPERLINKS tag is set to YES, the LaTeX that is generated -# is prepared for conversion to pdf (using ps2pdf). The pdf file will -# contain links (just like the HTML output) instead of page references -# This makes the output suitable for online browsing using a pdf viewer. - PDF_HYPERLINKS = NO - -# If the USE_PDFLATEX tag is set to YES, pdflatex will be used instead of -# plain latex in the generated Makefile. Set this option to YES to get a -# higher quality PDF documentation. - USE_PDFLATEX = NO - -# If the LATEX_BATCHMODE tag is set to YES, doxygen will add the \\batchmode. -# command to the generated LaTeX files. This will instruct LaTeX to keep -# running if errors occur, instead of asking the user for help. -# This option is also used when generating formulas in HTML. - LATEX_BATCHMODE = NO - -# If LATEX_HIDE_INDICES is set to YES then doxygen will not -# include the index chapters (such as File Index, Compound Index, etc.) -# in the output. - LATEX_HIDE_INDICES = NO - #--------------------------------------------------------------------------- # configuration options related to the RTF output #--------------------------------------------------------------------------- - -# If the GENERATE_RTF tag is set to YES Doxygen will generate RTF output -# The RTF output is optimized for Word 97 and may not look very pretty with -# other RTF readers or editors. - GENERATE_RTF = NO - -# The RTF_OUTPUT tag is used to specify where the RTF docs will be put. -# If a relative path is entered the value of OUTPUT_DIRECTORY will be -# put in front of it. If left blank `rtf' will be used as the default path. - RTF_OUTPUT = rtf - -# If the COMPACT_RTF tag is set to YES Doxygen generates more compact -# RTF documents. This may be useful for small projects and may help to -# save some trees in general. - COMPACT_RTF = NO - -# If the RTF_HYPERLINKS tag is set to YES, the RTF that is generated -# will contain hyperlink fields. The RTF file will -# contain links (just like the HTML output) instead of page references. -# This makes the output suitable for online browsing using WORD or other -# programs which support those fields. -# Note: wordpad (write) and others do not support links. - RTF_HYPERLINKS = NO - -# Load stylesheet definitions from file. Syntax is similar to doxygen's -# config file, i.e. a series of assignments. You only have to provide -# replacements, missing definitions are set to their default value. - RTF_STYLESHEET_FILE = - -# Set optional variables used in the generation of an rtf document. -# Syntax is similar to doxygen's config file. - RTF_EXTENSIONS_FILE = - #--------------------------------------------------------------------------- # configuration options related to the man page output #--------------------------------------------------------------------------- - -# If the GENERATE_MAN tag is set to YES (the default) Doxygen will -# generate man pages - GENERATE_MAN = NO - -# The MAN_OUTPUT tag is used to specify where the man pages will be put. -# If a relative path is entered the value of OUTPUT_DIRECTORY will be -# put in front of it. If left blank `man' will be used as the default path. - MAN_OUTPUT = man - -# The MAN_EXTENSION tag determines the extension that is added to -# the generated man pages (default is the subroutine's section .3) - MAN_EXTENSION = .3 - -# If the MAN_LINKS tag is set to YES and Doxygen generates man output, -# then it will generate one additional man file for each entity -# documented in the real man page(s). These additional files -# only source the real man page, but without them the man command -# would be unable to find the correct page. The default is NO. - MAN_LINKS = NO - #--------------------------------------------------------------------------- # configuration options related to the XML output #--------------------------------------------------------------------------- - -# If the GENERATE_XML tag is set to YES Doxygen will -# generate an XML file that captures the structure of -# the code including all documentation. - GENERATE_XML = NO - -# The XML_OUTPUT tag is used to specify where the XML pages will be put. -# If a relative path is entered the value of OUTPUT_DIRECTORY will be -# put in front of it. If left blank `xml' will be used as the default path. - XML_OUTPUT = xml - -# The XML_SCHEMA tag can be used to specify an XML schema, -# which can be used by a validating XML parser to check the -# syntax of the XML files. - XML_SCHEMA = - -# The XML_DTD tag can be used to specify an XML DTD, -# which can be used by a validating XML parser to check the -# syntax of the XML files. - XML_DTD = - -# If the XML_PROGRAMLISTING tag is set to YES Doxygen will -# dump the program listings (including syntax highlighting -# and cross-referencing information) to the XML output. Note that -# enabling this will significantly increase the size of the XML output. - XML_PROGRAMLISTING = YES - #--------------------------------------------------------------------------- # configuration options for the AutoGen Definitions output #--------------------------------------------------------------------------- - -# If the GENERATE_AUTOGEN_DEF tag is set to YES Doxygen will -# generate an AutoGen Definitions (see autogen.sf.net) file -# that captures the structure of the code including all -# documentation. Note that this feature is still experimental -# and incomplete at the moment. - GENERATE_AUTOGEN_DEF = NO - #--------------------------------------------------------------------------- # configuration options related to the Perl module output #--------------------------------------------------------------------------- - -# If the GENERATE_PERLMOD tag is set to YES Doxygen will -# generate a Perl module file that captures the structure of -# the code including all documentation. Note that this -# feature is still experimental and incomplete at the -# moment. - GENERATE_PERLMOD = NO - -# If the PERLMOD_LATEX tag is set to YES Doxygen will generate -# the necessary Makefile rules, Perl scripts and LaTeX code to be able -# to generate PDF and DVI output from the Perl module output. - PERLMOD_LATEX = NO - -# If the PERLMOD_PRETTY tag is set to YES the Perl module output will be -# nicely formatted so it can be parsed by a human reader. This is useful -# if you want to understand what is going on. On the other hand, if this -# tag is set to NO the size of the Perl module output will be much smaller -# and Perl will parse it just the same. - PERLMOD_PRETTY = YES - -# The names of the make variables in the generated doxyrules.make file -# are prefixed with the string contained in PERLMOD_MAKEVAR_PREFIX. -# This is useful so different doxyrules.make files included by the same -# Makefile don't overwrite each other's variables. - PERLMOD_MAKEVAR_PREFIX = - #--------------------------------------------------------------------------- # Configuration options related to the preprocessor #--------------------------------------------------------------------------- - -# If the ENABLE_PREPROCESSING tag is set to YES (the default) Doxygen will -# evaluate all C-preprocessor directives found in the sources and include -# files. - ENABLE_PREPROCESSING = YES - -# If the MACRO_EXPANSION tag is set to YES Doxygen will expand all macro -# names in the source code. If set to NO (the default) only conditional -# compilation will be performed. Macro expansion can be done in a controlled -# way by setting EXPAND_ONLY_PREDEF to YES. - MACRO_EXPANSION = NO - -# If the EXPAND_ONLY_PREDEF and MACRO_EXPANSION tags are both set to YES -# then the macro expansion is limited to the macros specified with the -# PREDEFINED and EXPAND_AS_DEFINED tags. - EXPAND_ONLY_PREDEF = NO - -# If the SEARCH_INCLUDES tag is set to YES (the default) the includes files -# in the INCLUDE_PATH (see below) will be search if a #include is found. - SEARCH_INCLUDES = YES - -# The INCLUDE_PATH tag can be used to specify one or more directories that -# contain include files that are not input files but should be processed by -# the preprocessor. - INCLUDE_PATH = - -# You can use the INCLUDE_FILE_PATTERNS tag to specify one or more wildcard -# patterns (like *.h and *.hpp) to filter out the header-files in the -# directories. If left blank, the patterns specified with FILE_PATTERNS will -# be used. - INCLUDE_FILE_PATTERNS = - -# The PREDEFINED tag can be used to specify one or more macro names that -# are defined before the preprocessor is started (similar to the -D option of -# gcc). The argument of the tag is a list of macros of the form: name -# or name=definition (no spaces). If the definition and the = are -# omitted =1 is assumed. To prevent a macro definition from being -# undefined via #undef or recursively expanded use the := operator -# instead of the = operator. - PREDEFINED = - -# If the MACRO_EXPANSION and EXPAND_ONLY_PREDEF tags are set to YES then -# this tag can be used to specify a list of macro names that should be expanded. -# The macro definition that is found in the sources will be used. -# Use the PREDEFINED tag if you want to use a different macro definition. - EXPAND_AS_DEFINED = - -# If the SKIP_FUNCTION_MACROS tag is set to YES (the default) then -# doxygen's preprocessor will remove all function-like macros that are alone -# on a line, have an all uppercase name, and do not end with a semicolon. Such -# function macros are typically used for boiler-plate code, and will confuse -# the parser if not removed. - SKIP_FUNCTION_MACROS = YES - #--------------------------------------------------------------------------- # Configuration::additions related to external references #--------------------------------------------------------------------------- - -# The TAGFILES option can be used to specify one or more tagfiles. -# Optionally an initial location of the external documentation -# can be added for each tagfile. The format of a tag file without -# this location is as follows: -# TAGFILES = file1 file2 ... -# Adding location for the tag files is done as follows: -# TAGFILES = file1=loc1 "file2 = loc2" ... -# where "loc1" and "loc2" can be relative or absolute paths or -# URLs. If a location is present for each tag, the installdox tool -# does not have to be run to correct the links. -# Note that each tag file must have a unique name -# (where the name does NOT include the path) -# If a tag file is not located in the directory in which doxygen -# is run, you must also specify the path to the tagfile here. - TAGFILES = - -# When a file name is specified after GENERATE_TAGFILE, doxygen will create -# a tag file that is based on the input files it reads. - GENERATE_TAGFILE = - -# If the ALLEXTERNALS tag is set to YES all external classes will be listed -# in the class index. If set to NO only the inherited external classes -# will be listed. - ALLEXTERNALS = NO - -# If the EXTERNAL_GROUPS tag is set to YES all external groups will be listed -# in the modules index. If set to NO, only the current project's groups will -# be listed. - EXTERNAL_GROUPS = YES - -# The PERL_PATH should be the absolute path and name of the perl script -# interpreter (i.e. the result of `which perl'). - PERL_PATH = /usr/bin/perl - #--------------------------------------------------------------------------- # Configuration options related to the dot tool #--------------------------------------------------------------------------- - -# If the CLASS_DIAGRAMS tag is set to YES (the default) Doxygen will -# generate a inheritance diagram (in HTML, RTF and LaTeX) for classes with base -# or super classes. Setting the tag to NO turns the diagrams off. Note that -# this option is superseded by the HAVE_DOT option below. This is only a -# fallback. It is recommended to install and use dot, since it yields more -# powerful graphs. - CLASS_DIAGRAMS = YES - -# If set to YES, the inheritance and collaboration graphs will hide -# inheritance and usage relations if the target is undocumented -# or is not a class. - HIDE_UNDOC_RELATIONS = YES - -# If you set the HAVE_DOT tag to YES then doxygen will assume the dot tool is -# available from the path. This tool is part of Graphviz, a graph visualization -# toolkit from AT&T and Lucent Bell Labs. The other options in this section -# have no effect if this option is set to NO (the default) - HAVE_DOT = NO - -# If the CLASS_GRAPH and HAVE_DOT tags are set to YES then doxygen -# will generate a graph for each documented class showing the direct and -# indirect inheritance relations. Setting this tag to YES will force the -# the CLASS_DIAGRAMS tag to NO. - CLASS_GRAPH = YES - -# If the COLLABORATION_GRAPH and HAVE_DOT tags are set to YES then doxygen -# will generate a graph for each documented class showing the direct and -# indirect implementation dependencies (inheritance, containment, and -# class references variables) of the class with other documented classes. - COLLABORATION_GRAPH = YES - -# If the GROUP_GRAPHS and HAVE_DOT tags are set to YES then doxygen -# will generate a graph for groups, showing the direct groups dependencies - GROUP_GRAPHS = YES - -# If the UML_LOOK tag is set to YES doxygen will generate inheritance and -# collaboration diagrams in a style similar to the OMG's Unified Modeling -# Language. - UML_LOOK = NO - -# If set to YES, the inheritance and collaboration graphs will show the -# relations between templates and their instances. - TEMPLATE_RELATIONS = NO - -# If the ENABLE_PREPROCESSING, SEARCH_INCLUDES, INCLUDE_GRAPH, and HAVE_DOT -# tags are set to YES then doxygen will generate a graph for each documented -# file showing the direct and indirect include dependencies of the file with -# other documented files. - INCLUDE_GRAPH = YES - -# If the ENABLE_PREPROCESSING, SEARCH_INCLUDES, INCLUDED_BY_GRAPH, and -# HAVE_DOT tags are set to YES then doxygen will generate a graph for each -# documented header file showing the documented files that directly or -# indirectly include this file. - INCLUDED_BY_GRAPH = YES - -# If the CALL_GRAPH and HAVE_DOT tags are set to YES then doxygen will -# generate a call dependency graph for every global function or class method. -# Note that enabling this option will significantly increase the time of a run. -# So in most cases it will be better to enable call graphs for selected -# functions only using the \callgraph command. - CALL_GRAPH = NO - -# If the GRAPHICAL_HIERARCHY and HAVE_DOT tags are set to YES then doxygen -# will graphical hierarchy of all classes instead of a textual one. - +CALLER_GRAPH = NO GRAPHICAL_HIERARCHY = YES - -# If the DIRECTORY_GRAPH, SHOW_DIRECTORIES and HAVE_DOT tags are set to YES -# then doxygen will show the dependencies a directory has on other directories -# in a graphical way. The dependency relations are determined by the #include -# relations between the files in the directories. - DIRECTORY_GRAPH = YES - -# The DOT_IMAGE_FORMAT tag can be used to set the image format of the images -# generated by dot. Possible values are png, jpg, or gif -# If left blank png will be used. - DOT_IMAGE_FORMAT = png - -# The tag DOT_PATH can be used to specify the path where the dot tool can be -# found. If left blank, it is assumed the dot tool can be found in the path. - DOT_PATH = - -# The DOTFILE_DIRS tag can be used to specify one or more directories that -# contain dot files that are included in the documentation (see the -# \dotfile command). - DOTFILE_DIRS = - -# The MAX_DOT_GRAPH_WIDTH tag can be used to set the maximum allowed width -# (in pixels) of the graphs generated by dot. If a graph becomes larger than -# this value, doxygen will try to truncate the graph, so that it fits within -# the specified constraint. Beware that most browsers cannot cope with very -# large images. - MAX_DOT_GRAPH_WIDTH = 1024 - -# The MAX_DOT_GRAPH_HEIGHT tag can be used to set the maximum allows height -# (in pixels) of the graphs generated by dot. If a graph becomes larger than -# this value, doxygen will try to truncate the graph, so that it fits within -# the specified constraint. Beware that most browsers cannot cope with very -# large images. - MAX_DOT_GRAPH_HEIGHT = 1024 - -# The MAX_DOT_GRAPH_DEPTH tag can be used to set the maximum depth of the -# graphs generated by dot. A depth value of 3 means that only nodes reachable -# from the root by following a path via at most 3 edges will be shown. Nodes -# that lay further from the root node will be omitted. Note that setting this -# option to 1 or 2 may greatly reduce the computation time needed for large -# code bases. Also note that a graph may be further truncated if the graph's -# image dimensions are not sufficient to fit the graph (see MAX_DOT_GRAPH_WIDTH -# and MAX_DOT_GRAPH_HEIGHT). If 0 is used for the depth value (the default), -# the graph is not depth-constrained. - MAX_DOT_GRAPH_DEPTH = 0 - -# Set the DOT_TRANSPARENT tag to YES to generate images with a transparent -# background. This is disabled by default, which results in a white background. -# Warning: Depending on the platform used, enabling this option may lead to -# badly anti-aliased labels on the edges of a graph (i.e. they become hard to -# read). - DOT_TRANSPARENT = NO - -# Set the DOT_MULTI_TARGETS tag to YES allow dot to generate multiple output -# files in one run (i.e. multiple -o and -T options on the command line). This -# makes dot run faster, but since only newer versions of dot (>1.8.10) -# support this, this feature is disabled by default. - DOT_MULTI_TARGETS = NO - -# If the GENERATE_LEGEND tag is set to YES (the default) Doxygen will -# generate a legend page explaining the meaning of the various boxes and -# arrows in the dot generated graphs. - GENERATE_LEGEND = YES - -# If the DOT_CLEANUP tag is set to YES (the default) Doxygen will -# remove the intermediate dot files that are used to generate -# the various graphs. - DOT_CLEANUP = YES - #--------------------------------------------------------------------------- # Configuration::additions related to the search engine #--------------------------------------------------------------------------- - -# The SEARCHENGINE tag specifies whether or not a search engine should be -# used. If set to NO the values of all tags below this one will be ignored. - SEARCHENGINE = NO Modified: branches/dunks/include/ResMan.h =================================================================== --- branches/dunks/include/ResMan.h 2006-08-08 18:09:59 UTC (rev 92) +++ branches/dunks/include/ResMan.h 2006-08-09 09:46:55 UTC (rev 93) @@ -11,14 +11,33 @@ //#include "Log.h" +/*! + Class to emulate a file object using an unsigned char* buffer +*/ class FileLike { public: + //! @name Constructors & Destructor + //@{ FileLike(unsigned char* buf, int size); ~FileLike(); - + //@} + + //! @name FileLike methods + //@{ + + /*! + read data from the buffer + @param buf buffer to read data into + @param size amount of bytes to read + */ void read(void* buf, int size); + /*! + seek to a position in the buffer + @param offset offset from the beginning of the buffer in bytes + */ void seek(int offset); + //@} private: unsigned char* m_buf; @@ -26,26 +45,75 @@ int m_pos; }; +/*! + Base class for all resources. +*/ class Resource { public: - Resource() {}; + //! @name Constructors & Destructor + //@{ + Resource(); virtual ~Resource(); + //@} + + /*! + read a file from the resource. + @param path path to the file to read + @param size if not NULL the file size is put here + @return file data + */ virtual unsigned char* readFile(boost::filesystem::path path, int *size) { return NULL; } + + /*! + read a text file from resource + @param path path to the file to open + @return text from the file + */ + virtual std::string readText(boost::filesystem::path path) { return ""; } + /*! + write a text file to a resource + @param path path to write the file + @param text text to write to file + */ + virtual void writeText(boost::filesystem::path path, std::string text) {} + + /*! + return true if the resource can be written to + */ + inline bool isWritable() { return mb_writable; } + protected: boost::filesystem::path m_path; - bool mb_writable; + + bool mb_writable; + }; - +/*! + Directory Resource - all files are read/written from a directory. Supports writing. +*/ class DIRResource : public Resource { public: DIRResource(boost::filesystem::path path) ; unsigned char* readFile(boost::filesystem::path path, int *size); + std::string readText(boost::filesystem::path path); }; +/*! + Writable directory resource for storing config files +*/ +class WritableDIRResource : public DIRResource +{ + public: + WritableDIRResource(boost::filesystem::path path); + void writeText(boost::filesystem::path path, std::string text); +}; +/*! + PAK file resource - all files are read from a PAK file. Does not support writing. +*/ class PAKResource : public Resource { public: @@ -57,7 +125,9 @@ Pakfile *m_pakfile; }; - +/*! + Class to simplify reading and writing from different resource files. +*/ class ResMan : public Singleton<ResMan> { friend class Singleton<ResMan>; @@ -69,14 +139,58 @@ ~ResMan(); public: + //! @name resource management + //@{ + /*! + add a resource to the manager. the resource will be searched for + in the directory pointed to by Settings::GetDataDir. It will + first search for a directory and then for the pak file + @ param name name of the resource to open + @ return true on success + */ bool addRes(std::string name); + /*! + add an existing resource to the resource manager. + */ + bool addRes(std::string name, Resource *res); + Resource* getResource(std::string name, std::string& filename); + //@} + + //! @name binary functions + //@{ + /*! + read a file from the resource. + @param path path to the file to read + @param size if not NULL the file size is put here + @return file data + */ unsigned char* readFile(std::string name, int *size); - FileLike* readFile(std::string name); + /*! + read a file from the resource. + @param path path to the file to read + @return FileLike object + */ + FileLike* readFile(std::string path); + //@} + //! @name textmode functions + //@{ + /*! + read a text file from resource + @param path path to the file to open + @return text from the file + */ + virtual std::string readText(std::string name); + /*! + write a text file to a resource + @param path path to write the file + @param text text to write to file + */ + virtual void writeText(std::string name, std::string text); + //@} private: ResList m_resources; - }; #endif // DUNE_RESMAN_H Modified: branches/dunks/src/Application.cpp =================================================================== --- branches/dunks/src/Application.cpp 2006-08-08 18:09:59 UTC (rev 92) +++ branches/dunks/src/Application.cpp 2006-08-09 09:46:55 UTC (rev 93) @@ -261,6 +261,10 @@ void Application::LoadData() { + // for config files + // set to the current directory for the moment + ResMan::Instance()->addRes("CONFIG", new WritableDIRResource("") ); + printf("loading resources\n"); ResMan::Instance()->addRes("ATRE"); ResMan::Instance()->addRes("DUNE"); @@ -279,6 +283,13 @@ ResMan::Instance()->addRes("XTRE"); printf("done loading resources\n"); + // example of reading the config file - remove me + std::string config = ResMan::Instance()->readText("CONFIG:config.txt"); + printf("%s\n", config.c_str()); + + config += "newline\n"; + ResMan::Instance()->writeText("CONFIG:config.txt", config); + SetPalette(); int len; @@ -354,7 +365,6 @@ #if 0 fnt->render("ABCDEFGHIJKLMOPQRSTUVWXYZ", m_screen, 10, 10, gpaloff); fnt->render("abcdefghijklmnopqrstuvwxz", m_screen, 10, 30, gpaloff); - #endif #if 1 Modified: branches/dunks/src/ResMan.cpp =================================================================== --- branches/dunks/src/ResMan.cpp 2006-08-08 18:09:59 UTC (rev 92) +++ branches/dunks/src/ResMan.cpp 2006-08-09 09:46:55 UTC (rev 93) @@ -2,6 +2,10 @@ #include "boost/filesystem/operations.hpp" #include "boost/format.hpp" +#include <fstream> +#include <sstream> +#include <iostream> + #include "ResMan.h" #include "Settings.h" //#include "Log.h" @@ -37,6 +41,11 @@ // ------------------------------------------------------------------ +Resource::Resource() +{ + mb_writable = false; +}; + Resource::~Resource() { @@ -52,7 +61,8 @@ unsigned char* DIRResource::readFile(bfs::path path, int *size) { // TODO: seems to work now, tested on linux, please test it on windows. (otpetrik) - bfs::path fullpath (m_path.string() + "/" + path.string()); + bfs::path fullpath (m_path); + fullpath /= path; FILE *file = fopen (fullpath.string().c_str(), "rb"); fseek(file, 0, SEEK_END); @@ -71,8 +81,46 @@ return buf; }; +std::string DIRResource::readText(boost::filesystem::path path) +{ + bfs::path fullpath (m_path); + fullpath /= path; + std::string file_contents; + printf("openin... [truncated message content] |
From: <otp...@us...> - 2006-08-10 14:12:50
|
Revision: 97 Author: otpetrik Date: 2006-08-10 07:12:30 -0700 (Thu, 10 Aug 2006) ViewCVS: http://svn.sourceforge.net/dunelegacy/?rev=97&view=rev Log Message: ----------- - basic settings load & save Modified Paths: -------------- branches/dunks/include/ConfigFile.h branches/dunks/include/Settings.h branches/dunks/include/Strings.h branches/dunks/src/Application.cpp branches/dunks/src/ConfigFile.cpp branches/dunks/src/Settings.cpp branches/dunks/src/Strings.cpp Added Paths: ----------- branches/dunks/config.txt Added: branches/dunks/config.txt =================================================================== --- branches/dunks/config.txt (rev 0) +++ branches/dunks/config.txt 2006-08-10 14:12:30 UTC (rev 97) @@ -0,0 +1,10 @@ +{ + data_dir = "paks/"; + debug = false; + graphics = { + double_buffer = false; + fullscreen = false; + height = 600; + width = 800; + }; +} Modified: branches/dunks/include/ConfigFile.h =================================================================== --- branches/dunks/include/ConfigFile.h 2006-08-10 09:14:20 UTC (rev 96) +++ branches/dunks/include/ConfigFile.h 2006-08-10 14:12:30 UTC (rev 97) @@ -306,7 +306,12 @@ //------------------------------------------------------------------------------ //! Value node /*! - Leaf node containg a string + Leaf node containg a string. + + @note + The string cannot contain any of the following characters: '\n', '\t', ' ', '/', '*', ',', ')', ';' + String containing those characters can be escaped by ' or ", but escaped string cannot contain '"' ! + */ class ValueNode : public Node { Modified: branches/dunks/include/Settings.h =================================================================== --- branches/dunks/include/Settings.h 2006-08-10 09:14:20 UTC (rev 96) +++ branches/dunks/include/Settings.h 2006-08-10 14:12:30 UTC (rev 97) @@ -55,6 +55,8 @@ #include "singleton.h" +#include "ConfigFile.h" + class Settings: public Singleton<Settings> { friend class Singleton<Settings>; @@ -70,8 +72,13 @@ bool m_doubleBuffered; std::string m_dataDir; + + ConfigFile::NodePtr configFile; public: + void load(); + void save(); + void ParseFile(char* fn); void ParseOptions(int argc, char* argv[]); Modified: branches/dunks/include/Strings.h =================================================================== --- branches/dunks/include/Strings.h 2006-08-10 09:14:20 UTC (rev 96) +++ branches/dunks/include/Strings.h 2006-08-10 14:12:30 UTC (rev 97) @@ -29,12 +29,22 @@ Tries to convert value to string (uses std::ostringstream). */ template <typename T> -String toString(const T &something) +inline String toString(const T &something) { std::ostringstream s; s << something; return s.str(); }; +template <> +inline String toString(const bool &something) +{ + std::ostringstream s; + if (something) + s << "true"; + else + s << "false"; + return s.str(); +}; //! Convert string to something /* @@ -46,13 +56,24 @@ @endcode */ template <typename T> -T fromString(ConstString string) +inline T fromString(ConstString string) { T something; std::istringstream s(string); s >> something; return something; }; +template <> +inline bool fromString(ConstString string) +{ + String something; + std::istringstream s(string); + s >> something; + if (something == "true") + return true; + else + return false; +}; //@} Modified: branches/dunks/src/Application.cpp =================================================================== --- branches/dunks/src/Application.cpp 2006-08-10 09:14:20 UTC (rev 96) +++ branches/dunks/src/Application.cpp 2006-08-10 14:12:30 UTC (rev 97) @@ -46,6 +46,9 @@ Application::~Application() { + // TODO: not sure where this belongs... (otpetrik) + Settings::Instance()->save(); + delete m_rootState; delete m_rootWidget; @@ -283,13 +286,8 @@ ResMan::Instance()->addRes("XTRE"); printf("done loading resources\n"); - // example of reading the config file - remove me - std::string config = ResMan::Instance()->readText("CONFIG:config.txt"); - printf("%s\n", config.c_str()); - - config += "newline\n"; - ResMan::Instance()->writeText("CONFIG:config.txt", config); - + Settings::Instance()->load(); + SetPalette(); int len; Modified: branches/dunks/src/ConfigFile.cpp =================================================================== --- branches/dunks/src/ConfigFile.cpp 2006-08-10 09:14:20 UTC (rev 96) +++ branches/dunks/src/ConfigFile.cpp 2006-08-10 14:12:30 UTC (rev 97) @@ -439,6 +439,8 @@ { if (binder != NULL) value = binder->getString(); + if (value.find_first_of("\n\t /*,);") != String::npos) + value = "\"" + value + "\""; cache.add(value); }; @@ -505,7 +507,10 @@ assert(root != NULL); root->save(c); + // file should end with a newline + c.add("\n"); + return c.getString(); }; - + } // namespace ConfigFile Modified: branches/dunks/src/Settings.cpp =================================================================== --- branches/dunks/src/Settings.cpp 2006-08-10 09:14:20 UTC (rev 96) +++ branches/dunks/src/Settings.cpp 2006-08-10 14:12:30 UTC (rev 97) @@ -1,6 +1,9 @@ #include "Settings.h" #include <fstream> +#include "Strings.h" +#include "ResMan.h" + SETTINGSTYPE settings; Settings::Settings() @@ -18,6 +21,32 @@ }; +void Settings::load() +{ + String configText = ResMan::Instance()->readText("CONFIG:config.txt"); + configFile = ConfigFile::loadFile(configText.c_str()); + ConfigFile::bind("graphics.width", configFile, m_width, 640); + ConfigFile::bind("graphics.height", configFile, m_height, 480); + ConfigFile::bind("graphics.fullscreen", configFile, m_fullscreen, false); + ConfigFile::bind("graphics.double_buffer", configFile, m_doubleBuffered, false); + ConfigFile::bind("debug", configFile, m_debug, true); + ConfigFile::bind("data_dir", configFile, m_dataDir, String("paks/")); + +/* root = ConfigFile::loadFile((const char *)data); + std::string config = ResMan::Instance()->readText("CONFIG:config.txt"); + printf("%s\n", config.c_str()); + + config += "newline\n"; + ResMan::Instance()->writeText("CONFIG:config.txt", config); + +*/ +}; +void Settings::save() +{ + String configText = ConfigFile::saveFile(configFile); + ResMan::Instance()->writeText("CONFIG:config.txt", configText); +}; + void Settings::ParseFile(char* fn) { /* Modified: branches/dunks/src/Strings.cpp =================================================================== --- branches/dunks/src/Strings.cpp 2006-08-10 09:14:20 UTC (rev 96) +++ branches/dunks/src/Strings.cpp 2006-08-10 14:12:30 UTC (rev 97) @@ -196,7 +196,7 @@ { data += str.substr(index, nlIndex-index); data += '\n'; - for (int i = 0; i <= indentLevel; i++) + for (int i = 0; i < indentLevel; i++) data += " "; // 4 spaces for one indent level // start next search after the newline index = nlIndex+1; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <otp...@us...> - 2006-08-10 14:20:16
|
Revision: 98 Author: otpetrik Date: 2006-08-10 07:20:09 -0700 (Thu, 10 Aug 2006) ViewCVS: http://svn.sourceforge.net/dunelegacy/?rev=98&view=rev Log Message: ----------- - minor settings fix Modified Paths: -------------- branches/dunks/config.txt branches/dunks/src/Application.cpp branches/dunks/src/Settings.cpp Modified: branches/dunks/config.txt =================================================================== --- branches/dunks/config.txt 2006-08-10 14:12:30 UTC (rev 97) +++ branches/dunks/config.txt 2006-08-10 14:20:09 UTC (rev 98) @@ -4,7 +4,7 @@ graphics = { double_buffer = false; fullscreen = false; - height = 600; - width = 800; + height = 480; + width = 640; }; } Modified: branches/dunks/src/Application.cpp =================================================================== --- branches/dunks/src/Application.cpp 2006-08-10 14:12:30 UTC (rev 97) +++ branches/dunks/src/Application.cpp 2006-08-10 14:20:09 UTC (rev 98) @@ -125,6 +125,7 @@ //MentatClass* m = new MentatClass(); //setMentat( m ); //MentatClass::Instance(); + Settings::Instance()->load(); InitVideo(); @@ -264,10 +265,6 @@ void Application::LoadData() { - // for config files - // set to the current directory for the moment - ResMan::Instance()->addRes("CONFIG", new WritableDIRResource("") ); - printf("loading resources\n"); ResMan::Instance()->addRes("ATRE"); ResMan::Instance()->addRes("DUNE"); @@ -286,8 +283,6 @@ ResMan::Instance()->addRes("XTRE"); printf("done loading resources\n"); - Settings::Instance()->load(); - SetPalette(); int len; Modified: branches/dunks/src/Settings.cpp =================================================================== --- branches/dunks/src/Settings.cpp 2006-08-10 14:12:30 UTC (rev 97) +++ branches/dunks/src/Settings.cpp 2006-08-10 14:20:09 UTC (rev 98) @@ -8,6 +8,10 @@ Settings::Settings() { + // for config files + // set to the current directory for the moment + ResMan::Instance()->addRes("CONFIG", new WritableDIRResource("") ); + m_width = 640; m_height = 480; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <dun...@us...> - 2006-08-10 15:14:13
|
Revision: 99 Author: dunkfordyce Date: 2006-08-10 08:14:07 -0700 (Thu, 10 Aug 2006) ViewCVS: http://svn.sourceforge.net/dunelegacy/?rev=99&view=rev Log Message: ----------- - added RTTI for windows build - added new files to vcproj Modified Paths: -------------- branches/dunks/SConstruct branches/dunks/dunelegacy.vcproj Modified: branches/dunks/SConstruct =================================================================== --- branches/dunks/SConstruct 2006-08-10 14:20:09 UTC (rev 98) +++ branches/dunks/SConstruct 2006-08-10 15:14:07 UTC (rev 99) @@ -34,7 +34,7 @@ else: env.Append(LIBS = ["zzipdll", "zdll", "SDLmain"]) env.Append(LINKFLAGS = ["/SUBSYSTEM:CONSOLE", "/DEBUG"]) - env.Append(CCFLAGS = ["/O2", "/EHsc", "/MD", "/Op", "/DEBUG", "/Zi"]) + env.Append(CCFLAGS = ["/O2", "/EHsc", "/MD", "/Op", "/DEBUG", "/Zi", "/GR"]) env.Append(LIBS = [ "SDL", "SDL_mixer", Modified: branches/dunks/dunelegacy.vcproj =================================================================== --- branches/dunks/dunelegacy.vcproj 2006-08-10 14:20:09 UTC (rev 98) +++ branches/dunks/dunelegacy.vcproj 2006-08-10 15:14:07 UTC (rev 99) @@ -306,6 +306,12 @@ RelativePath=".\include\State.h"> </File> <File + RelativePath=".\src\Strings.cpp"> + </File> + <File + RelativePath=".\include\Strings.h"> + </File> + <File RelativePath=".\src\TerrainClass.cpp"> </File> <File This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <otp...@us...> - 2006-08-11 09:25:44
|
Revision: 103 Author: otpetrik Date: 2006-08-11 02:25:36 -0700 (Fri, 11 Aug 2006) ViewCVS: http://svn.sourceforge.net/dunelegacy/?rev=103&view=rev Log Message: ----------- - Settings.cpp fixed, config.txt no longer needed - removed config.txt from svn Modified Paths: -------------- branches/dunks/src/Settings.cpp Removed Paths: ------------- branches/dunks/config.txt Deleted: branches/dunks/config.txt =================================================================== --- branches/dunks/config.txt 2006-08-11 07:47:25 UTC (rev 102) +++ branches/dunks/config.txt 2006-08-11 09:25:36 UTC (rev 103) @@ -1,10 +0,0 @@ -{ - data_dir = "paks/"; - debug = false; - graphics = { - double_buffer = false; - fullscreen = false; - height = 480; - width = 640; - }; -} Modified: branches/dunks/src/Settings.cpp =================================================================== --- branches/dunks/src/Settings.cpp 2006-08-11 07:47:25 UTC (rev 102) +++ branches/dunks/src/Settings.cpp 2006-08-11 09:25:36 UTC (rev 103) @@ -28,10 +28,17 @@ void Settings::load() { const char* settingsfile = "CONFIG:config.txt"; - if (ResMan::Instance()->exists(settingsfile)) - { - String configText = ResMan::Instance()->readText(settingsfile); - configFile = ConfigFile::loadFile(configText.c_str()); + + // try loading config file + if (ResMan::Instance()->exists(settingsfile)) + { + String configText = ResMan::Instance()->readText(settingsfile); + configFile = ConfigFile::loadFile(configText.c_str()); + } + else + { + // just parse empty string... + configFile = ConfigFile::loadFile(""); }; ConfigFile::bind(".graphics.width", configFile, m_width, 640); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <shu...@us...> - 2006-09-02 16:29:32
|
Revision: 110 http://svn.sourceforge.net/dunelegacy/?rev=110&view=rev Author: shutdownrunner Date: 2006-09-02 09:28:26 -0700 (Sat, 02 Sep 2006) Log Message: ----------- - Make dunelegacy compilable - No buttons are clickable. No idea why. Yet Modified Paths: -------------- branches/dunks/include/gui2/Widget.h branches/dunks/src/Application.cpp branches/dunks/src/IntroState.cpp branches/dunks/src/MainMenu.cpp branches/dunks/src/MenuBase.cpp branches/dunks/src/OptionsMenu.cpp branches/dunks/src/SConscript branches/dunks/src/SingleMenu.cpp branches/dunks/src/gui2/Button.cpp Modified: branches/dunks/include/gui2/Widget.h =================================================================== --- branches/dunks/include/gui2/Widget.h 2006-08-25 11:01:06 UTC (rev 109) +++ branches/dunks/include/gui2/Widget.h 2006-09-02 16:28:26 UTC (rev 110) @@ -15,7 +15,7 @@ virtual ~Widget(); //@} - virtual void draw(SDL_Surface* dest, SPoint &off) {} + virtual void draw(SDL_Surface* dest, SPoint off) {} //! @name Event handling functions //@{ Modified: branches/dunks/src/Application.cpp =================================================================== --- branches/dunks/src/Application.cpp 2006-08-25 11:01:06 UTC (rev 109) +++ branches/dunks/src/Application.cpp 2006-09-02 16:28:26 UTC (rev 110) @@ -22,7 +22,7 @@ #include "Settings.h" #include "Font.h" #include "TopLevelState.h" -#include "DataFile.h" +//#include "DataFile.h" #include "pakfile/Palette.h" #include "pakfile/Shpfile.h" @@ -409,6 +409,7 @@ case SDL_MOUSEBUTTONDOWN: m_rootWidget->handleButtonDown( event.button.button, SPoint(event.button.x, event.button.y)); + printf("X:%d, Y:%d\n", event.button.x, event.button.y); break; case SDL_MOUSEBUTTONUP: m_rootWidget->handleButtonUp( event.button.button, Modified: branches/dunks/src/IntroState.cpp =================================================================== --- branches/dunks/src/IntroState.cpp 2006-08-25 11:01:06 UTC (rev 109) +++ branches/dunks/src/IntroState.cpp 2006-09-02 16:28:26 UTC (rev 110) @@ -176,7 +176,7 @@ Frame::NO_TRANSITION, Frame::FADE_OUT, false) ); - enque( new Frame("INTRO:INTRO2.WSA", + /*enque( new Frame("INTRO:INTRO2.WSA", Frame::NO_TRANSITION, Frame::FADE_OUT, false) ); @@ -232,7 +232,7 @@ enque( new Frame("INTRO:INTRO1.WSA", Frame::NO_TRANSITION, Frame::FADE_OUT, - false) ); + false) );*/ next(); m_butIntro = new TranspButton(Settings::Instance()->GetWidth(), Modified: branches/dunks/src/MainMenu.cpp =================================================================== --- branches/dunks/src/MainMenu.cpp 2006-08-25 11:01:06 UTC (rev 109) +++ branches/dunks/src/MainMenu.cpp 2006-09-02 16:28:26 UTC (rev 110) @@ -1,7 +1,7 @@ #include "MainMenu.h" #include "Application.h" -#include "DataFile.h" +//#include "DataFile.h" #include "Settings.h" #include "SingleMenu.h" Modified: branches/dunks/src/MenuBase.cpp =================================================================== --- branches/dunks/src/MenuBase.cpp 2006-08-25 11:01:06 UTC (rev 109) +++ branches/dunks/src/MenuBase.cpp 2006-09-02 16:28:26 UTC (rev 110) @@ -1,7 +1,7 @@ #include "MainMenu.h" #include "Application.h" -#include "DataFile.h" +//#include "DataFile.h" #include "Settings.h" #include "SingleMenu.h" Modified: branches/dunks/src/OptionsMenu.cpp =================================================================== --- branches/dunks/src/OptionsMenu.cpp 2006-08-25 11:01:06 UTC (rev 109) +++ branches/dunks/src/OptionsMenu.cpp 2006-09-02 16:28:26 UTC (rev 110) @@ -1,7 +1,7 @@ #include "OptionsMenu.h" #include "Application.h" -#include "DataFile.h" +//#include "DataFile.h" #include "Settings.h" #include "boost/bind.hpp" Modified: branches/dunks/src/SConscript =================================================================== --- branches/dunks/src/SConscript 2006-08-25 11:01:06 UTC (rev 109) +++ branches/dunks/src/SConscript 2006-09-02 16:28:26 UTC (rev 110) @@ -17,7 +17,7 @@ "Settings.cpp", "Font.cpp", "State.cpp", - "DataFile.cpp", +# "DataFile.cpp", "TopLevelState.cpp", "MenuBase.cpp", Modified: branches/dunks/src/SingleMenu.cpp =================================================================== --- branches/dunks/src/SingleMenu.cpp 2006-08-25 11:01:06 UTC (rev 109) +++ branches/dunks/src/SingleMenu.cpp 2006-09-02 16:28:26 UTC (rev 110) @@ -1,7 +1,7 @@ #include "SingleMenu.h" #include "Application.h" -#include "DataFile.h" +//#include "DataFile.h" #include "Settings.h" #include "boost/bind.hpp" Modified: branches/dunks/src/gui2/Button.cpp =================================================================== --- branches/dunks/src/gui2/Button.cpp 2006-08-25 11:01:06 UTC (rev 109) +++ branches/dunks/src/gui2/Button.cpp 2006-09-02 16:28:26 UTC (rev 110) @@ -146,13 +146,13 @@ drawHLine(m_surfNormal, 0, h-1, w-1, 229, false); // right lines - drawVLine(m_surfNormal, w-1, 0, w-1, 229, false); - drawVLine(m_surfNormal, w-2, 1, w-2, 226, false); + drawVLine(m_surfNormal, w-1, 0, h-1, 229, false); + drawVLine(m_surfNormal, w-2, 1, h-2, 226, false); // final pixels to make it look really duneish - // putPixel(m_surfNormal, 1, h-2, 115); - // putPixel(m_surfNormal, w-2, 1, 115); - // putPixel(m_surfNormal, w-2, h-2, 227); + putPixel(m_surfNormal, 1, h-2, 115); + putPixel(m_surfNormal, w-2, 1, 115); + putPixel(m_surfNormal, w-2, h-2, 227); /* This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |