From 7224c1253228e5c29c78cb3f0f26ce34770f2356 Mon Sep 17 00:00:00 2001 From: BlackNoxis Date: Sat, 15 Feb 2014 23:24:26 +0200 Subject: Added ebuilds for kogaion desktop --- games-strategy/zod-engine/Manifest | 3 + .../zod-engine-20110906-proper-linux-support.patch | 1419 ++++++++++++++++++++ .../zod-engine/zod-engine-20110906.ebuild | 71 + 3 files changed, 1493 insertions(+) create mode 100644 games-strategy/zod-engine/Manifest create mode 100644 games-strategy/zod-engine/files/zod-engine-20110906-proper-linux-support.patch create mode 100644 games-strategy/zod-engine/zod-engine-20110906.ebuild (limited to 'games-strategy/zod-engine') diff --git a/games-strategy/zod-engine/Manifest b/games-strategy/zod-engine/Manifest new file mode 100644 index 00000000..397f0d33 --- /dev/null +++ b/games-strategy/zod-engine/Manifest @@ -0,0 +1,3 @@ +AUX zod-engine-20110906-proper-linux-support.patch 41849 SHA256 98a7cef026ffd24132512095c314ea57ae1668b74b228c97262dea035ae15195 SHA512 8c5a28b7abdf59f15d60f08deac4fb8c63a72fd0eac92467d2fa35293272ab5bc3a29c08f9ffc84fcd99363660941028de9133ce0d0e64281efc97828075db8a WHIRLPOOL 557f9cc6b1cc476712feeb9bd61aab6520723a60504e9a986bfeb925c5557a4e640a1f6a6224b050b9c136f75ebb4e3b99483a8691a26425f9d4eaf10c0f8fbc +DIST zod_linux-2011-09-06.tar.gz 40237117 SHA256 02d8cfbc0da8901a36ea14cdffb72fb7780ea718073d4b6c9e0409cdacca356c +EBUILD zod-engine-20110906.ebuild 1948 SHA256 4f31aba6e68bb95aa1d5119ed2eea02eda3983c9d15721c946fee2a9c945f490 SHA512 84acd41f2c84817f20a526af61ad5107892608ef033f3063f4038dd22e1ace5ec72f0f7f7ce66ae73feedcb12384908d940ed7cf323649a92c0c2174c896efc2 WHIRLPOOL 03cb6e5467cfb5c1a235be63525c185f41df9ed7f097dad7308fe0c209f156a904aec39862b5364937b2ff588ce455a361448f7983bf33d3dee87e0bbb18188f diff --git a/games-strategy/zod-engine/files/zod-engine-20110906-proper-linux-support.patch b/games-strategy/zod-engine/files/zod-engine-20110906-proper-linux-support.patch new file mode 100644 index 00000000..d81e6049 --- /dev/null +++ b/games-strategy/zod-engine/files/zod-engine-20110906-proper-linux-support.patch @@ -0,0 +1,1419 @@ +diff -burN zod_engine/zod_launcher_src/common.cpp zod_engine.new/zod_launcher_src/common.cpp +--- zod_engine/zod_launcher_src/common.cpp 2011-03-22 12:05:11.000000000 +0100 ++++ zod_engine.new/zod_launcher_src/common.cpp 2012-05-05 22:50:56.000000000 +0200 +@@ -9,24 +9,216 @@ + #include + #include + #include ++ ++#define OSPATH_SEP '\\' ++ + #else + #include + #include + #include ++ ++#define OSPATH_SEP '/' ++ + #endif + + namespace COMMON + { + +-void create_folder(char *foldername) ++//base data path for the engine ++static char base_path[FILENAME_MAX]; ++//home (user specific) data path for the engine ++static char home_path[FILENAME_MAX]; ++ ++static bool path_concat(const char *base, const char *file, char *dest) ++{ ++ size_t i; ++ size_t len; ++ char c; ++ bool was_sep; ++ ++ // base path is an OS specific path ++ len = 0; ++ for (i = 0; len < (FILENAME_MAX - 1) && base[i] != '\0'; i++) ++ dest[len++] = base[i]; ++ ++ // this also catches base[i] != '\0' ++ if (len == (FILENAME_MAX - 1)) ++ return false; ++ ++ ++ // ensure base is terminated by OSPATH_SEP ++ if (len == 0 || dest[len - 1] != OSPATH_SEP) ++ dest[len++] = OSPATH_SEP; ++ ++ was_sep = true; ++ ++ // file name could have both '/' or '\\' for path separation ++ for (i = 0; len < (FILENAME_MAX - 1) && file[i] != '\0'; i++) { ++ char c = file[i]; ++ if (c == '/' || c == '\\') { ++ // ignore double separators ++ if (was_sep) ++ continue; ++ ++ c = OSPATH_SEP; ++ was_sep = true; ++ } else { ++ was_sep = false; ++ } ++ ++ dest[len++] = c; ++ } ++ ++ if (file[i] != '\0') ++ return false; ++ ++ dest[len] = '\0'; ++ return true; ++} ++ ++static bool file_exists(const char*filename) ++{ ++#ifdef _WIN32 ++ DWORD attrs = GetFileAttributes(filename); ++ return (attrs != INVALID_FILE_ATTRIBUTES); ++ ++#else ++ ++ return (access(filename, R_OK) == 0); ++ ++#endif ++ ++} ++ ++void init_file_paths(const char *bin_path) + { +-#ifdef WIN32 //if windows ++ base_path[0] = '\0'; ++ ++#ifdef DATA_PATH ++ //compilation defined base path, ignore if too long ++ if (strlen(DATA_PATH) < FILENAME_MAX) ++ strcpy(base_path, DATA_PATH); ++#endif ++ ++ if (base_path[0] == '\0' && bin_path && bin_path[0] != '\0') { ++ //default to binary path dirname ++ char dirname[FILENAME_MAX]; ++ size_t len; ++ ++ len = strlen(bin_path); ++ if (len < FILENAME_MAX) { ++ strcpy(base_path, bin_path); ++ //find the last separator ++ do len--; while (len > 0 && base_path[len] != OSPATH_SEP); ++ ++ base_path[len] = '\0'; ++ } ++ } ++ ++ // if no explicit directory is specified ++ // default to current working directory ++ if (base_path[0] == '\0') ++ strcpy(base_path, "."); ++ ++ // get home path ++ home_path[0] = '\0'; ++ ++#ifdef _WIN32 ++ // on Windows home path is equivalent to base path ++ strcpy(home_path, base_path); ++ ++#else ++ // on Unix platforms use a specific directory in home ++ const char *home = getenv("HOME"); ++ if (home && home[0] != '\0') { ++ if (path_concat(home, ".zod-engine", home_path)) ++ create_folder(home_path); ++ else ++ home_path[0] = '\0'; ++ } ++ ++#endif ++ ++} ++ ++void create_folder(const char *foldername) ++{ ++#ifdef _WIN32 //if windows + mkdir(foldername); + #else + mkdir(foldername,-1); + #endif + } + ++FILE *open_file_read(const char *filename, bool binary) ++{ ++ char path[FILENAME_MAX]; ++ const char *mode; ++ FILE *fp; ++ ++ fp = NULL; ++ mode = (binary)? "rb" : "r"; ++ if (home_path[0] != '\0') { ++ // if home directory is available, pick the file from there, ++ // as there is where we can find user specific overrides ++ // of our files ++ if (path_concat(home_path, filename, path)) ++ fp = fopen(path, mode); ++ } ++ ++ if (!fp) { ++ // retrieve the file from the data directory ++ if (path_concat(base_path, filename, path)) ++ fp = fopen(path, mode); ++ } ++ ++ return fp; ++} ++ ++FILE *open_file_write(const char *filename, bool binary, bool append) ++{ ++ FILE *fp = NULL; ++ if (home_path[0] != '\0') { ++ //files can only be created in home path ++ char path[FILENAME_MAX]; ++ ++ if (path_concat(home_path, filename, path)) { ++ // determine open mode ++ char mode[3]; ++ ++ mode[0] = (append)? 'a' : 'w'; ++ mode[1] = (binary)? 'b' : '\0'; ++ mode[2] = '\0'; ++ fp = fopen(path, mode); ++ } ++ } ++ ++ return fp; ++} ++ ++bool get_os_path(const char *filename, bool read_only, char *dest) ++{ ++ ++ if (read_only) ++ { ++ if (home_path[0]) ++ { ++ if (path_concat(home_path, filename, dest) && file_exists(dest)) ++ return true; ++ } ++ ++ return path_concat(base_path, filename, dest) && file_exists(dest); ++ ++ } ++ else ++ { ++ if (home_path[0] != '\0') ++ return path_concat(home_path, filename, dest); ++ else ++ return false; ++ } ++} ++ + double current_time() + { + #ifdef WIN32 +diff -burN zod_engine/zod_launcher_src/common.h zod_engine.new/zod_launcher_src/common.h +--- zod_engine/zod_launcher_src/common.h 2011-03-22 12:05:11.000000000 +0100 ++++ zod_engine.new/zod_launcher_src/common.h 2012-05-05 22:51:24.000000000 +0200 +@@ -3,11 +3,16 @@ + + namespace COMMON + { ++ ++ extern void init_file_paths(const char *bin_path); ++ extern bool get_os_path(const char *filename, bool read_only, char *dest); ++ extern void create_folder(const char *foldername); ++ extern FILE *open_file_read(const char *filename, bool binary); ++ extern FILE *open_file_write(const char *filename, bool binary, bool append); + extern void split(char *dest, char *message, char split, int *initial, int d_size, int m_size); + extern void clean_newline(char *message, int size); + extern void lcase(char *message, int m_size); + extern double current_time(); +- extern void create_folder(char *foldername); + extern void uni_pause(int m_sec); + extern char *wtoc_s(const wchar_t *input); + extern char *wtoc(const wchar_t *input, char *dest, int size); +diff -burN zod_engine/zod_launcher_src/makefile zod_engine.new/zod_launcher_src/makefile +--- zod_engine/zod_launcher_src/makefile 2011-03-22 12:13:12.000000000 +0100 ++++ zod_engine.new/zod_launcher_src/makefile 2012-05-06 04:09:08.000000000 +0200 +@@ -1,2 +1,11 @@ ++CC=g++ ++CFLAGS=-g `wx-config --cppflags` ++LDFLAGS=`wx-config --libs` ++EXENAME=zod_launcher ++ ++ifdef DATA_PATH ++ CFLAGS += -DDATA_PATH=\"$(DATA_PATH)\" ++endif ++ + default: +- g++ -g -o zod_launcher *.cpp `wx-config --cppflags` `wx-config --libs` ++ $(CC) $(CFLAGS) -o $(EXENAME) *.cpp $(LDFLAGS) +diff -burN zod_engine/zod_launcher_src/store_settings.cpp zod_engine.new/zod_launcher_src/store_settings.cpp +--- zod_engine/zod_launcher_src/store_settings.cpp 2011-03-22 12:05:11.000000000 +0100 ++++ zod_engine.new/zod_launcher_src/store_settings.cpp 2012-05-06 16:14:49.000000000 +0200 +@@ -11,7 +11,7 @@ + { + FILE *fp; + +- fp = fopen("zod_launcher_settings.txt", "w"); ++ fp = open_file_write("zod_launcher_settings.txt", false, false); + + if(!fp) return; + +@@ -45,7 +45,7 @@ + { + FILE *fp; + +- fp = fopen("zod_launcher_settings.txt", "r"); ++ fp = open_file_read("zod_launcher_settings.txt", false); + + if(!fp) return; + +I file binari zod_engine/zod_launcher_src/zod_launcher e zod_engine.new/zod_launcher_src/zod_launcher sono diversi +diff -burN zod_engine/zod_launcher_src/zod_launcherApp.cpp zod_engine.new/zod_launcher_src/zod_launcherApp.cpp +--- zod_engine/zod_launcher_src/zod_launcherApp.cpp 2011-03-22 12:05:11.000000000 +0100 ++++ zod_engine.new/zod_launcher_src/zod_launcherApp.cpp 2012-05-05 22:32:45.000000000 +0200 +@@ -9,11 +9,17 @@ + + #include "zod_launcherApp.h" + #include "zod_launcherFrm.h" ++#include "common.h" + + IMPLEMENT_APP(zod_launcherFrmApp) + + bool zod_launcherFrmApp::OnInit() + { ++ // initialize file system ++ wxString bin_path(argv[0]); ++ COMMON::init_file_paths(bin_path.mb_str(wxConvUTF8)); ++ ++ // create form + zod_launcherFrm* frame = new zod_launcherFrm(NULL); + SetTopWindow(frame); + frame->Show(); +diff -burN zod_engine/zod_launcher_src/zod_launcherFrm.cpp zod_engine.new/zod_launcher_src/zod_launcherFrm.cpp +--- zod_engine/zod_launcher_src/zod_launcherFrm.cpp 2011-03-22 12:35:01.000000000 +0100 ++++ zod_engine.new/zod_launcher_src/zod_launcherFrm.cpp 2012-05-06 16:16:19.000000000 +0200 +@@ -10,6 +10,7 @@ + + #include "zod_launcherFrm.h" + #include "store_settings.h" ++#include "common.h" + + //Do not add custom headers between + //Header Include Start and Header Include End +@@ -215,7 +216,7 @@ + #ifdef _WIN32 + message = wxT("zod_engine.exe"); + #else +- message = wxT("./zod"); ++ message = wxT("zod"); + #endif + + if(WxEdit1->GetValue().length()) +diff -burN zod_engine/zod_src/cgatling.cpp zod_engine.new/zod_src/cgatling.cpp +--- zod_engine/zod_src/cgatling.cpp 2011-09-06 17:35:10.000000000 +0200 ++++ zod_engine.new/zod_src/cgatling.cpp 2012-05-05 17:26:16.000000000 +0200 +@@ -53,7 +53,7 @@ + for(j=0;j + #include + #include ++#include + #include "common.h" + + #ifdef _WIN32 + #include + #include + #include ++ ++#define OSPATH_SEP '\\' ++ + #else + #include + #include +@@ -16,20 +20,257 @@ + #include + #include + #include ++ ++#define OSPATH_SEP '/' ++ + #endif + + namespace COMMON + { + +-void create_folder(char *foldername) ++//base data path for the engine ++static char base_path[FILENAME_MAX]; ++//home (user specific) data path for the engine ++static char home_path[FILENAME_MAX]; ++ ++static bool path_concat(const char *base, const char *file, char *dest) ++{ ++ size_t i; ++ size_t len; ++ char c; ++ bool was_sep; ++ ++ // base path is an OS specific path ++ len = 0; ++ for (i = 0; len < (FILENAME_MAX - 1) && base[i] != '\0'; i++) ++ dest[len++] = base[i]; ++ ++ // this also catches base[i] != '\0' ++ if (len == (FILENAME_MAX - 1)) ++ return false; ++ ++ ++ // ensure base is terminated by OSPATH_SEP ++ if (len == 0 || dest[len - 1] != OSPATH_SEP) ++ dest[len++] = OSPATH_SEP; ++ ++ was_sep = true; ++ ++ // file name could have both '/' or '\\' for path separation ++ for (i = 0; len < (FILENAME_MAX - 1) && file[i] != '\0'; i++) { ++ char c = file[i]; ++ if (c == '/' || c == '\\') { ++ // ignore double separators ++ if (was_sep) ++ continue; ++ ++ c = OSPATH_SEP; ++ was_sep = true; ++ } else { ++ was_sep = false; ++ } ++ ++ dest[len++] = c; ++ } ++ ++ if (file[i] != '\0') ++ return false; ++ ++ dest[len] = '\0'; ++ return true; ++} ++ ++static vector scan_folder(string foldername) ++{ ++ vector list; ++ ++#ifdef _WIN32 ++ ++ HANDLE hFind = INVALID_HANDLE_VALUE; ++ WIN32_FIND_DATA ffd; ++ ++ foldername += "*"; ++ ++ hFind = FindFirstFile(foldername.c_str(), &ffd); ++ ++ if(INVALID_HANDLE_VALUE == hFind) return filelist; ++ ++ do ++ { ++ if(!(ffd.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY)) ++ list.push_back((char*)ffd.cFileName); ++ } ++ while (FindNextFile(hFind, &ffd) != 0); ++ ++ FindClose(hFind); ++ ++#else ++ ++ DIR *dp; ++ struct dirent *dirp; ++ ++ dp = opendir(foldername.c_str()); ++ ++ if (dp) { ++ ++ while ((dirp = readdir(dp)) != NULL) ++ { ++ if(dirp->d_type == DT_REG) ++ list.push_back(dirp->d_name); ++ } ++ ++ closedir(dp); ++ } ++ ++#endif ++ ++ return list; ++} ++ ++static bool file_exists(const char*filename) ++{ ++#ifdef _WIN32 ++ ++ DWORD attrs = GetFileAttributes(filename); ++ return (attrs != INVALID_FILE_ATTRIBUTES); ++ ++#else ++ ++ return (access(filename, R_OK) == 0); ++ ++#endif ++ ++} ++ ++void init_file_paths(const char *bin_path) ++{ ++ base_path[0] = '\0'; ++ ++#ifdef DATA_PATH ++ //compilation defined base path, ignore if too long ++ if (strlen(DATA_PATH) < FILENAME_MAX) ++ strcpy(base_path, DATA_PATH); ++#endif ++ ++ if (base_path[0] == '\0' && bin_path && bin_path[0] != '\0') { ++ //default to binary path dirname ++ char dirname[FILENAME_MAX]; ++ size_t len; ++ ++ len = strlen(bin_path); ++ if (len < FILENAME_MAX) { ++ strcpy(base_path, bin_path); ++ //find the last separator ++ do len--; while (len > 0 && base_path[len] != OSPATH_SEP); ++ ++ base_path[len] = '\0'; ++ } ++ } ++ ++ // if no explicit directory is specified ++ // default to current working directory ++ if (base_path[0] == '\0') ++ strcpy(base_path, "."); ++ ++ // get home path ++ home_path[0] = '\0'; ++ ++#ifdef _WIN32 ++ // on Windows home path is equivalent to base path ++ strcpy(home_path, base_path); ++ ++#else ++ // on Unix platforms use a specific directory in home ++ const char *home = getenv("HOME"); ++ if (home && home[0] != '\0') { ++ if (path_concat(home, ".zod-engine", home_path)) ++ create_folder(home_path); ++ else ++ home_path[0] = '\0'; ++ } ++ ++#endif ++ ++} ++ ++void create_folder(const char *foldername) + { +-#ifdef WIN32 //if windows ++#ifdef _WIN32 //if windows + mkdir(foldername); + #else + mkdir(foldername,-1); + #endif + } + ++bool get_os_path(const char *filename, bool read_only, char *dest) ++{ ++ ++ if (read_only) ++ { ++ if (home_path[0]) ++ { ++ if (path_concat(home_path, filename, dest) && file_exists(dest)) ++ return true; ++ } ++ ++ return path_concat(base_path, filename, dest) && file_exists(dest); ++ ++ } ++ else ++ { ++ if (home_path[0] != '\0') ++ return path_concat(home_path, filename, dest); ++ else ++ return false; ++ } ++} ++ ++FILE *open_file_read(const char *filename, bool binary) ++{ ++ char path[FILENAME_MAX]; ++ const char *mode; ++ FILE *fp; ++ ++ fp = NULL; ++ mode = (binary)? "rb" : "r"; ++ if (home_path[0] != '\0') { ++ // if home directory is available, pick the file from there, ++ // as there is where we can find user specific overrides ++ // of our files ++ if (path_concat(home_path, filename, path)) ++ fp = fopen(path, mode); ++ } ++ ++ if (!fp) { ++ // retrieve the file from the data directory ++ if (path_concat(base_path, filename, path)) ++ fp = fopen(path, mode); ++ } ++ ++ return fp; ++} ++ ++FILE *open_file_write(const char *filename, bool binary, bool append) ++{ ++ FILE *fp = NULL; ++ if (home_path[0] != '\0') { ++ //files can only be created in home path ++ char path[FILENAME_MAX]; ++ ++ if (path_concat(home_path, filename, path)) { ++ // determine open mode ++ char mode[3]; ++ ++ mode[0] = (append)? 'a' : 'w'; ++ mode[1] = (binary)? 'b' : '\0'; ++ mode[2] = '\0'; ++ fp = fopen(path, mode); ++ } ++ } ++ ++ return fp; ++} ++ + double current_time() + { + #ifdef WIN32 +@@ -139,7 +380,18 @@ + #ifdef _WIN32 //if windows + Sleep(m_sec); //win version + #else +- usleep(m_sec * 1000); //lin version ++ struct timespec ts; //use nanosleep() ++ int secs; ++ int mills; ++ int res; ++ ++ secs = m_sec / 1000; ++ mills = m_sec - secs * 1000; ++ ts.tv_sec = secs; ++ ts.tv_nsec = mills * 1000000L; ++ ++ do res = nanosleep(&ts, &ts); while (res == -1 && errno == EINTR); ++ + #endif + } + +@@ -229,7 +481,7 @@ + lt = time(NULL); + ptr = localtime(<); + +- ofp = fopen("reg_log.txt","a"); ++ ofp = open_file_write("reg_log.txt",false,true); + + strcpy(timebuf, asctime(ptr)); + clean_newline(timebuf, 100); +@@ -259,7 +511,7 @@ + { + FILE *fp; + +- fp = fopen(filename, "a"); ++ fp = open_file_write(filename, false, true); + + if(!fp) return false; + +@@ -270,51 +522,37 @@ + + vector directory_filelist(string foldername) + { +- vector filelist; ++ vector list; ++ vector base; ++ vector merged; ++ char path[FILENAME_MAX]; + +-#ifdef _WIN32 ++ // scan both base and home folders ++ if (path_concat(home_path, foldername.c_str(), path)) ++ list = scan_folder(path); + +- HANDLE hFind = INVALID_HANDLE_VALUE; +- WIN32_FIND_DATA ffd; ++ if (path_concat(base_path, foldername.c_str(), path)) ++ base = scan_folder(path); + +- foldername += "*"; ++ // for (size_t i=0;i::iterator el; + +- if(INVALID_HANDLE_VALUE == hFind) return filelist; ++ el = lower_bound(list.begin(), list.end(), base[i], sort_string_func); ++ if (el != list.end() && *el == base[i]) ++ continue; + +- do +- { +- if(!(ffd.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY)) +- filelist.push_back((char*)ffd.cFileName); ++ merged.push_back(base[i]); + } +- while (FindNextFile(hFind, &ffd) != 0); +- +- FindClose(hFind); +- +-#else +- DIR *dp; +- struct dirent *dirp; +- +- if(!foldername.size()) foldername = "."; +- +- dp = opendir(foldername.c_str()); +- +- if(!dp) return filelist; +- +- while ((dirp = readdir(dp)) != NULL) +- { +- if(dirp->d_type == DT_REG) +- filelist.push_back(dirp->d_name); +- } +- +- closedir(dp); +- +-#endif + +- //for(int i=0;i &filelist, string extension) +diff -burN zod_engine/zod_src/common.h zod_engine.new/zod_src/common.h +--- zod_engine/zod_src/common.h 2011-09-06 17:35:07.000000000 +0200 ++++ zod_engine.new/zod_src/common.h 2012-05-05 20:39:00.000000000 +0200 +@@ -1,6 +1,7 @@ + #ifndef _COMMON_H_ + #define _COMMON_H_ + ++#include + #include + #include + #include +@@ -19,12 +20,16 @@ + int x, y; + }; + ++ extern void init_file_paths(const char *bin_path); ++ extern bool get_os_path(const char *filename, bool read_only, char*dest); ++ extern FILE *open_file_read(const char *filename, bool binary); ++ extern FILE *open_file_write(const char *filename, bool binary, bool append); + extern void split(char *dest, char *message, char split, int *initial, int d_size, int m_size); + extern void clean_newline(char *message, int size); + extern void lcase(char *message, int m_size); + extern void lcase(string &message); + extern double current_time(); +- extern void create_folder(char *foldername); ++ extern void create_folder(const char *foldername); + extern void uni_pause(int m_sec); + extern char *wtoc_s(const wchar_t *input); + extern char *wtoc(const wchar_t *input, char *dest, int size); +diff -burN zod_engine/zod_src/cursor.cpp zod_engine.new/zod_src/cursor.cpp +--- zod_engine/zod_src/cursor.cpp 2011-09-06 17:35:10.000000000 +0200 ++++ zod_engine.new/zod_src/cursor.cpp 2012-05-05 17:31:02.000000000 +0200 +@@ -24,56 +24,56 @@ + cursor[CURSOR_C][0][j].LoadBaseImage(filename_c); + + sprintf(filename_c, "assets/cursors/placed_n%02d.png", j); +- temp_surface = IMG_Load(filename_c); ++ temp_surface = ZSDL_IMG_Load(filename_c, false); + cursor[PLACED_C][0][j].LoadBaseImage(temp_surface, false); + cursor[PLACE_C][0][j].LoadBaseImage(temp_surface); + //cursor[PLACED_C][0][j] = IMG_Load_Error(filename_c); + //cursor[PLACE_C][0][j] = cursor[PLACED_C][0][j]; + + sprintf(filename_c, "assets/cursors/attacked_n%02d.png", j); +- temp_surface = IMG_Load(filename_c); ++ temp_surface = ZSDL_IMG_Load(filename_c, false); + cursor[ATTACKED_C][0][j].LoadBaseImage(temp_surface, false); + cursor[ATTACK_C][0][j].LoadBaseImage(temp_surface); + //cursor[ATTACKED_C][0][j] = IMG_Load_Error(filename_c); + //cursor[ATTACK_C][0][j] = cursor[ATTACKED_C][0][j]; + + sprintf(filename_c, "assets/cursors/grabbed_n%02d.png", j); +- temp_surface = IMG_Load(filename_c); ++ temp_surface = ZSDL_IMG_Load(filename_c, false); + cursor[GRABBED_C][0][j].LoadBaseImage(temp_surface, false); + cursor[GRAB_C][0][j].LoadBaseImage(temp_surface); + //cursor[GRABBED_C][0][j] = IMG_Load_Error(filename_c); + //cursor[GRAB_C][0][j] = cursor[GRABBED_C][0][j]; + + sprintf(filename_c, "assets/cursors/grenaded_n%02d.png", j); +- temp_surface = IMG_Load(filename_c); ++ temp_surface = ZSDL_IMG_Load(filename_c, false); + cursor[GRENADED_C][0][j].LoadBaseImage(temp_surface, false); + cursor[GRENADE_C][0][j].LoadBaseImage(temp_surface); + //cursor[GRENADED_C][0][j] = IMG_Load_Error(filename_c); + //cursor[GRENADE_C][0][j] = cursor[GRENADED_C][0][j]; + + sprintf(filename_c, "assets/cursors/repaired_n%02d.png", j); +- temp_surface = IMG_Load(filename_c); ++ temp_surface = ZSDL_IMG_Load(filename_c, false); + cursor[REPAIRED_C][0][j].LoadBaseImage(temp_surface, false); + cursor[REPAIR_C][0][j].LoadBaseImage(temp_surface); + //cursor[REPAIRED_C][0][j] = IMG_Load_Error(filename_c); + //cursor[REPAIR_C][0][j] = cursor[REPAIRED_C][0][j]; + + sprintf(filename_c, "assets/cursors/entered_n%02d.png", j); +- temp_surface = IMG_Load(filename_c); ++ temp_surface = ZSDL_IMG_Load(filename_c, false); + cursor[ENTERED_C][0][j].LoadBaseImage(temp_surface, false); + cursor[ENTER_C][0][j].LoadBaseImage(temp_surface); + //cursor[ENTERED_C][0][j] = IMG_Load_Error(filename_c); + //cursor[ENTER_C][0][j] = cursor[ENTERED_C][0][j]; + + sprintf(filename_c, "assets/cursors/exited_n%02d.png", j); +- temp_surface = IMG_Load(filename_c); ++ temp_surface = ZSDL_IMG_Load(filename_c, false); + cursor[EXITED_C][0][j].LoadBaseImage(temp_surface, false); + cursor[EXIT_C][0][j].LoadBaseImage(temp_surface); + //cursor[EXITED_C][0][j] = IMG_Load_Error(filename_c); + //cursor[EXIT_C][0][j] = cursor[EXITED_C][0][j]; + + sprintf(filename_c, "assets/cursors/cannoned_n%02d.png", j); +- temp_surface = IMG_Load(filename_c); ++ temp_surface = ZSDL_IMG_Load(filename_c, false); + cursor[CANNONED_C][0][j].LoadBaseImage(temp_surface, false); + cursor[CANNON_C][0][j].LoadBaseImage(temp_surface); + //cursor[CANNONED_C][0][j] = IMG_Load_Error(filename_c); +diff -burN zod_engine/zod_src/main.cpp zod_engine.new/zod_src/main.cpp +--- zod_engine/zod_src/main.cpp 2011-09-06 17:35:11.000000000 +0200 ++++ zod_engine.new/zod_src/main.cpp 2012-05-05 17:49:03.000000000 +0200 +@@ -42,7 +42,7 @@ + + printf("Welcome to the Zod Engine\n"); + +- if(argc<=1) starting_conditions.setdefaults(); ++ if(argc==1) starting_conditions.setdefaults(); + + //read in the arguments + starting_conditions.getoptions(argc, argv); +@@ -51,6 +51,9 @@ + //like we are trying to make a dedicated server that is supposed to connect to another server + starting_conditions.checkoptions(); + ++ //init engine search paths ++ COMMON::init_file_paths(argv[0]); ++ + //init this for the bots + ZCore::CreateRandomBotBypassData(bot_bypass_data, bot_bypass_size); + +diff -burN zod_engine/zod_src/makefile zod_engine.new/zod_src/makefile +--- zod_engine/zod_src/makefile 2011-09-06 17:35:07.000000000 +0200 ++++ zod_engine.new/zod_src/makefile 2012-05-06 04:03:47.000000000 +0200 +@@ -18,6 +18,9 @@ + MAPEDITOR_OFILES = map_editor.o $(CPPFILES:.cpp=.o) + DATE = `date +%m-%d-%y` + ++ifdef DATA_PATH ++ CFLAGS += -D DATA_PATH=\"$(DATA_PATH)\" ++endif + + main: $(OFILES) + $(CC) -o $(EXENAME) $(OFILES) $(LDFLAGS) +diff -burN zod_engine/zod_src/map_editor.cpp zod_engine.new/zod_src/map_editor.cpp +--- zod_engine/zod_src/map_editor.cpp 2011-09-06 17:35:11.000000000 +0200 ++++ zod_engine.new/zod_src/map_editor.cpp 2012-05-05 21:50:20.000000000 +0200 +@@ -270,6 +270,8 @@ + //check if args ok + if(!checkargs(argv[0])) return 0; + ++ //init filesystem search paths ++ COMMON::init_file_paths(argv[0]); + //init SDL + SDL_Init(SDL_INIT_VIDEO|SDL_INIT_AUDIO); + screen = SDL_SetVideoMode(800,600,32,SDL_HWSURFACE|SDL_DOUBLEBUF|SDL_RESIZABLE); +@@ -287,8 +289,15 @@ + ZSDL_Surface::SetHasHud(false); + + //TTF ++ char path[FILENAME_MAX]; ++ + TTF_Init(); +- ttf_font = TTF_OpenFont("assets/arial.ttf",10); ++ ttf_font = NULL; ++ if (COMMON::get_os_path("assets/arial.ttf", true, path)) ++ { ++ ttf_font = TTF_OpenFont(path,10); ++ } ++ + if (!ttf_font) printf("could not load arial.ttf\n"); + + //init stuff +@@ -499,10 +508,8 @@ + //save the map + { + bmp_filename = filename + ".bmp"; +- + printf("saving map screenshot: '%s'\n", bmp_filename.c_str()); +- +- SDL_SaveBMP(print_surface, bmp_filename.c_str()); ++ ZSDL_SaveBMP(print_surface, filename); + } + + SDL_FreeSurface(print_surface); +diff -burN zod_engine/zod_src/map_merger.cpp zod_engine.new/zod_src/map_merger.cpp +--- zod_engine/zod_src/map_merger.cpp 2011-09-06 17:35:11.000000000 +0200 ++++ zod_engine.new/zod_src/map_merger.cpp 2012-05-05 16:17:15.000000000 +0200 +@@ -16,6 +16,9 @@ + return 0; + } + ++ //init filesystem paths ++ COMMON::init_file_paths(argv[0]); ++ + printf("argc:%d\n", argc); + printf("output_map:'%s'\n", argv[1]); + printf("direction:'%s'\n", argv[2]); +diff -burN zod_engine/zod_src/ogrenades.cpp zod_engine.new/zod_src/ogrenades.cpp +--- zod_engine/zod_src/ogrenades.cpp 2011-09-06 17:35:11.000000000 +0200 ++++ zod_engine.new/zod_src/ogrenades.cpp 2012-05-05 17:28:25.000000000 +0200 +@@ -24,7 +24,7 @@ + + void OGrenades::Init() + { +- render_img.LoadBaseImage("assets/other/map_items/grenades.png");// = ZSDL_IMG_Load("assets/other/map_items/grenades.png"); ++ render_img.LoadBaseImage("assets/other/map_items/grenades.png");// = ZSDL_IMG_Load("assets/other/map_items/grenades.png", true); + } + + void OGrenades::DoRender(ZMap &the_map, SDL_Surface *dest, int shift_x, int shift_y) +diff -burN zod_engine/zod_src/ohut.cpp zod_engine.new/zod_src/ohut.cpp +--- zod_engine/zod_src/ohut.cpp 2011-09-06 17:35:11.000000000 +0200 ++++ zod_engine.new/zod_src/ohut.cpp 2012-05-05 17:28:13.000000000 +0200 +@@ -42,7 +42,7 @@ + for(i=0;imap_name.c_str(), "rb"); ++ fp = COMMON::open_file_read(p->map_name.c_str(), true); + + if(fp) + { +diff -burN zod_engine/zod_src/zsettings.cpp zod_engine.new/zod_src/zsettings.cpp +--- zod_engine/zod_src/zsettings.cpp 2011-09-06 17:35:08.000000000 +0200 ++++ zod_engine.new/zod_src/zsettings.cpp 2012-05-05 16:31:45.000000000 +0200 +@@ -393,7 +393,7 @@ + { + FILE *fp; + +- fp = fopen(filename.c_str(), "r"); ++ fp = COMMON::open_file_read(filename.c_str(), false); + + if(!fp) + { +@@ -555,7 +555,7 @@ + { + FILE *fp; + +- fp = fopen(filename.c_str(), "w"); ++ fp = COMMON::open_file_write(filename.c_str(), false, false); + + if(!fp) + { +diff -burN zod_engine/zod_src/zteam.cpp zod_engine.new/zod_src/zteam.cpp +--- zod_engine/zod_src/zteam.cpp 2011-09-06 17:35:07.000000000 +0200 ++++ zod_engine.new/zod_src/zteam.cpp 2012-05-05 17:31:56.000000000 +0200 +@@ -113,7 +113,7 @@ + } + + //save surface +- SDL_SaveBMP(src, filename.c_str()); ++ ZSDL_SaveBMP(src, filename); + + //free surface + SDL_FreeSurface(src); +@@ -264,7 +264,7 @@ + if(team == ZTEAM_BASE_TEAM) return; + + filename = "assets/teams/" + team_type_string[team] + "_palette.bmp"; +- surface = IMG_Load(filename.c_str()); ++ surface = ZSDL_IMG_Load(filename.c_str(), false); + + if(!surface) + { +@@ -294,7 +294,7 @@ + + team_palette[team].SaveSurfacePalette(filename); + +- //SDL_SaveBMP(team_palette[team], filename.c_str()); ++ //ZSDL_SaveBMP(team_palette[team], filename); + } + + void ZTeam::SaveAllPalettes() diff --git a/games-strategy/zod-engine/zod-engine-20110906.ebuild b/games-strategy/zod-engine/zod-engine-20110906.ebuild new file mode 100644 index 00000000..86528d3e --- /dev/null +++ b/games-strategy/zod-engine/zod-engine-20110906.ebuild @@ -0,0 +1,71 @@ +# Copyright 1999-2012 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v3 +# $Header: $ + +EAPI="3" + +WX_GTK_VER="2.8" + +inherit wxwidgets eutils games + +MY_PN="zod_linux" +MY_P="${MY_PN}-${PV:0:4}-${PV:4:2}-${PV:6:2}" + +DESCRIPTION="Zod Engine is a remake of the 1996 classic game by Bitmap Brothers called Z" +HOMEPAGE="http://zod.sourceforge.net/" +SRC_URI="mirror://sourceforge/zod/${MY_P}.tar.gz" + +LICENSE="GPL-3" +SLOT="0" +KEYWORDS="~amd64 ~x86" +IUSE="" + +RDEPEND=" + >=media-libs/libsdl-1.2[X] + >=media-libs/sdl-ttf-2.0[X] + >=media-libs/sdl-mixer-1.2[timidity] + >=media-libs/sdl-image-1.2 + virtual/mysql + x11-libs/wxGTK:2.8[X]" +DEPEND="${RDEPEND}" + +S="${WORKDIR}/zod_engine" + +src_prepare() { + # various fixes and proper linux platform and filesystem support + epatch "${FILESDIR}/${P}-proper-linux-support.patch" + + # fix files, this project really should provide a make install + + # remove Thumbs.db files + find . -type f -name Thumbs.db -exec rm -f {} \; || die + # remove GIMP .xcf files + find . -type f -name "*.xcf" -exec rm -f {} \; || die + # remove Windows .ico files, unused on Linux build + find . -type f -name "*.ico" -exec rm -f {} \; || die + # remove useless icescene file + rm -f "assets/WebCamScene.icescene" || die + # remove unused splash screen + rm -f "assets/splash.png" || die +} + +src_compile() { + emake -C zod_src DATA_PATH="\"${GAMES_DATADIR}/${PN}\"" map_editor main || die + emake -C zod_launcher_src DATA_PATH="\"${GAMES_DATADIR}/${PN}\"" || die +} + +src_install() { + # custom install procedure for Gentoo + insinto "${GAMES_DATADIR}/${PN}" + doins -r assets blank_maps *.map default_settings.txt *map_list.txt || die + dogamesbin zod_launcher_src/zod_launcher || die + dogamesbin zod_src/zod || die + dogamesbin zod_src/zod_map_editor || die + + newicon assets/icon.png ${PN}.png || die + make_desktop_entry zod_launcher "Zod Engine" || die + + dodoc zod_engine_help.txt map_editor_help.txt || die + + prepgamesdirs +} -- cgit v1.2.3