[funguloids] Initial Fedora package based on openSUSE pkg + some Debian bits

Hans de Goede jwrdegoede at fedoraproject.org
Fri May 24 06:39:10 UTC 2013


commit f57bb9f5436370fa30c4c2bb4ffb5e8f24daf099
Author: Hans de Goede <hdegoede at redhat.com>
Date:   Fri May 24 08:44:21 2013 +0200

    Initial Fedora package based on openSUSE pkg + some Debian bits

 .gitignore                             |    1 +
 README.Fedora                          |    7 +
 funguloids-alc_error.patch             |   21 ++
 funguloids-destdir.patch               |   43 ++++
 funguloids-gcc47.patch                 |   13 +
 funguloids-honor_autotools_paths.patch |   25 ++
 funguloids-lua.patch                   |   39 ++++
 funguloids-missing_includes.patch      |   12 +
 funguloids-ogre-1.6.patch              |   43 ++++
 funguloids-ogre-1.7.0.patch            |  120 ++++++++++
 funguloids-ogre-1.8.patch              |  102 +++++++++
 funguloids-optional_cg.patch           |   38 ++++
 funguloids-size_chunks_reverse.patch   |   13 +
 funguloids-strcmp.patch                |   13 +
 funguloids.6                           |   44 ++++
 funguloids.desktop                     |    8 +
 funguloids.png                         |  Bin 0 -> 122732 bytes
 funguloids.spec                        |  142 ++++++++++++
 mpak.py                                |  376 ++++++++++++++++++++++++++++++++
 sources                                |    1 +
 20 files changed, 1061 insertions(+), 0 deletions(-)
---
diff --git a/.gitignore b/.gitignore
index e69de29..6232c6c 100644
--- a/.gitignore
+++ b/.gitignore
@@ -0,0 +1 @@
+/funguloids-linux-1.06-4.tar.bz2
diff --git a/README.Fedora b/README.Fedora
new file mode 100644
index 0000000..0fc4a0e
--- /dev/null
+++ b/README.Fedora
@@ -0,0 +1,7 @@
+This game runs with improved graphics when the Ogre Cg plugin is installed.
+Since Cg has a non-free licence the game has been patched by Fedora to be
+able to run without it. The game will have worse graphics but no extra warning
+will be shown.
+
+No option exists to enable/disable the use of Cg. It will be automatically used
+if available.
diff --git a/funguloids-alc_error.patch b/funguloids-alc_error.patch
new file mode 100644
index 0000000..1bc8282
--- /dev/null
+++ b/funguloids-alc_error.patch
@@ -0,0 +1,21 @@
+Index: src/openalsoundsystem.cpp
+===================================================================
+--- src/openalsoundsystem.cpp.orig
++++ src/openalsoundsystem.cpp
+@@ -266,14 +266,14 @@ int OpenALSoundSystem::initialise( unsig
+ 
+ 	int attributes[] = { 0 };
+ 	mContext = alcCreateContext(mDevice, attributes);
+-	if ( (err = alGetError()) != AL_NO_ERROR) {
++	if ( (err = alcGetError(mDevice)) != ALC_NO_ERROR) {
+ 		LogManager::getSingleton().logMessage("OpanAL: error creating context: " + lastALError(err) );
+ 		return 1;
+ 	}
+ //	check_alc_error("Couldn't create audio context: ");
+ 	alcMakeContextCurrent(mContext);
+ //	check_alc_error("Couldn't select audio context: ");
+-	if ( (err = alGetError()) != AL_NO_ERROR) {
++	if ( (err = alcGetError(mDevice)) != ALC_NO_ERROR) {
+ 		LogManager::getSingleton().logMessage("OpanAL: error making context current: " + lastALError(err) );
+ 		return 2;
+ 	}
diff --git a/funguloids-destdir.patch b/funguloids-destdir.patch
new file mode 100644
index 0000000..5d1a41c
--- /dev/null
+++ b/funguloids-destdir.patch
@@ -0,0 +1,43 @@
+Index: bin/Makefile.am
+===================================================================
+--- bin/Makefile.am.orig
++++ bin/Makefile.am
+@@ -4,7 +4,7 @@ EXTRA_DIST = plugins.cfg.in resources.cf
+ dist_pixmapinstall_DATA = funguloids.png
+ dist_gameinstall_DATA = gamesettings.cfg
+ dist_docinstall_DATA = readme.html
+-gameinstall_DATA = plugins.cfg resources.cfg
++gameinstall_DATA = plugins.cfg resources.cfg bootstrap.mpk funguloids.mpk
+ 
+ plugins.cfg: plugins.cfg.in
+ 	cat plugins.cfg.in | sed 's,%%ogreplugindir%%, at ogreplugindir@/,' > plugins.cfg
+@@ -22,9 +22,7 @@ install-data-hook:
+ 		if test ! -e "@highscoredir@/hiscore.lst"; then cp hiscore.lst.in "@highscoredir@/hiscore.lst"; fi; \
+ 		chgrp -R @highscoregroup@ "@highscoredir@"; \
+ 		chmod -R g+w "@highscoredir@"; \
+-	fi; \
+-	if test -r bootstrap.mpk; then cp bootstrap.mpk "@gameinstalldir@"; fi; \
+-	if test -r funguloids.mpk; then cp funguloids.mpk "@gameinstalldir@"; fi
++	fi;
+ 
+ uninstall-hook:
+ 	rm -rf "@docinstalldir@"
+Index: bin/music/Makefile.am
+===================================================================
+--- bin/music/Makefile.am.orig
++++ bin/music/Makefile.am
+@@ -1,13 +1,10 @@
+-musicinstall_DATA = playlist.lua
++musicinstall_DATA = playlist.lua MarylandInMay.ogg
+ 
+ EXTRA_DIST = playlist.lua.in
+ 
+ playlist.lua: playlist.lua.in
+ 	cat playlist.lua.in | sed 's,%%musicinstalldir%%, at musicinstalldir@,' > playlist.lua
+ 
+-install-data-hook:
+-	if test -r MarylandInMay.ogg; then cp MarylandInMay.ogg "@musicinstalldir@"; fi;
+-
+ 
+ distclean: clean
+ 
diff --git a/funguloids-gcc47.patch b/funguloids-gcc47.patch
new file mode 100644
index 0000000..e6b0020
--- /dev/null
+++ b/funguloids-gcc47.patch
@@ -0,0 +1,13 @@
+Index: include/SimpleIni/SimpleIni.h
+===================================================================
+--- include/SimpleIni/SimpleIni.h.orig
++++ include/SimpleIni/SimpleIni.h
+@@ -407,7 +407,7 @@ public:
+             return *this;
+         }
+         bool ConvertToStore(const SI_CHAR * a_pszString) {
+-            size_t uLen = SizeToStore(a_pszString);
++            size_t uLen = this->SizeToStore(a_pszString);
+             if (uLen == (size_t)(-1)) {
+                 return false;
+             }
diff --git a/funguloids-honor_autotools_paths.patch b/funguloids-honor_autotools_paths.patch
new file mode 100644
index 0000000..1385627
--- /dev/null
+++ b/funguloids-honor_autotools_paths.patch
@@ -0,0 +1,25 @@
+Index: configure.ac
+===================================================================
+--- configure.ac.orig
++++ configure.ac
+@@ -231,13 +231,13 @@ if test "x$prefix" = "xNONE" -o "x$prefi
+ 	prefix="/usr/local"
+ fi
+ 
+-bininstalldir="${prefix}/games"
+-gameinstalldir="${prefix}/share/games/funguloids"
+-iconinstalldir="${prefix}/share/games/funguloids/icon"
+-musicinstalldir="${prefix}/share/games/funguloids/music"
+-docinstalldir="${prefix}/share/docs/funguloids"
+-docimageinstalldir="${prefix}/share/docs/funguloids/docs"
+-pixmapinstalldir="${prefix}/share/pixmaps"
++bininstalldir="${bindir}"
++gameinstalldir="${datadir}/funguloids"
++iconinstalldir="${gameinstalldir}/icon"
++musicinstalldir="${gameinstalldir}/music"
++docinstalldir="${docdir}"
++docimageinstalldir="${docinstalldir}/docs"
++pixmapinstalldir="${datarootdir}/pixmaps"
+ 
+ AC_SUBST(prefix)
+ AC_SUBST(bininstalldir)
diff --git a/funguloids-lua.patch b/funguloids-lua.patch
new file mode 100644
index 0000000..1d64478
--- /dev/null
+++ b/funguloids-lua.patch
@@ -0,0 +1,39 @@
+Index: configure.ac
+===================================================================
+--- configure.ac.orig
++++ configure.ac
+@@ -47,30 +47,11 @@ AC_SUBST(OIS_LIBS)
+ 
+ 
+ # LUA ----------------------------------------------------
+-AC_LANG_PUSH(C)
+-AC_ARG_WITH(lua,
+-[  --with-lua[[=DIR]] specify the path to the Lua 5.1 include files [[autodetect]]],
+-[
+-	if test "x$withval" != "x"; then
+-		lua_dir="$withval"
+-	fi
+-],[
+-	lua_dir=
+-])
+-
+-FUNGU_SEARCH_HEADER( [lua.h], [$lua_dir /usr/local /usr], [ include/lua5.1 include/lua / ] )
+-if test "x$FUNGU_FOUND_HEADER" = "xno"; then
+-	PKG_CHECK_MODULES(LUA, [lua >= 5.1],[],[
+-		PKG_CHECK_MODULES(LUA, [lua5.1 >= 5.1],[],[
+-			AC_MSG_ERROR(Lua 5.1 not found. You can specify its location with [[--with-lua=/path/to/include/lua51]])
+-		])
++PKG_CHECK_MODULES(LUA, [lua >= 5.1],[],[
++	PKG_CHECK_MODULES(LUA, [lua5.1 >= 5.1],[],[
++		AC_MSG_ERROR(Lua 5.1 not found)
+ 	])
+-else
+-	CFLAGS="$CFLAGS $FUNGU_FOUND_HEADER"
+-	CPPFLAGS="$CPPFLAGS $FUNGU_FOUND_HEADER"
+-	LDFLAGS="$LDFLAGS -llua5.1"
+-fi
+-AC_LANG_POP
++])
+ 
+ AC_SUBST(LUA_CFLAGS)
+ AC_SUBST(LUA_LIBS)
diff --git a/funguloids-missing_includes.patch b/funguloids-missing_includes.patch
new file mode 100644
index 0000000..e98ddb7
--- /dev/null
+++ b/funguloids-missing_includes.patch
@@ -0,0 +1,12 @@
+Index: src/mp3stream.cpp
+===================================================================
+--- src/mp3stream.cpp.orig
++++ src/mp3stream.cpp
+@@ -34,6 +34,7 @@
+ 
+ #include <sys/stat.h>
+ #include <sstream>
++#include <climits>
+ #include "Ogre.h"
+ 
+ #include "mp3stream.h"
diff --git a/funguloids-ogre-1.6.patch b/funguloids-ogre-1.6.patch
new file mode 100644
index 0000000..f68cea2
--- /dev/null
+++ b/funguloids-ogre-1.6.patch
@@ -0,0 +1,43 @@
+Index: include/mpakogre.h
+===================================================================
+--- include/mpakogre.h.orig
++++ include/mpakogre.h
+@@ -56,6 +56,18 @@ public:
+ 	FileInfoListPtr findFileInfo(const String &pattern, bool recursive, bool dirs = false);
+ 
+ 	bool exists(const String &filename);
++
++	time_t getModifiedTime(const String& filename)
++	{
++		struct stat tagStat;
++		bool ret = (stat(filename.c_str(), &tagStat) == 0);
++		if (ret) {
++			return tagStat.st_mtime;
++		}
++		else {
++			return 0;
++		}
++	}
+ };
+ 
+ 
+Index: src/scriptsystem.cpp
+===================================================================
+--- src/scriptsystem.cpp.orig
++++ src/scriptsystem.cpp
+@@ -137,7 +137,6 @@ static int CreateAsteroid(lua_State *L)
+ 	Asteroid *roid = new Asteroid(String(name), ScriptSystem::getSingleton().getSceneMgr(), String(mesh), String(mat), pos);
+ 	roid->setScale(scale, scale, scale);
+ 	roid->setMass(scale * 10.0f);
+-	roid->getEntity()->setNormaliseNormals(true);
+ 	return 0;
+ }
+ 
+@@ -435,6 +434,7 @@
+ ScriptSystem::ScriptSystem(SceneManager *mgr, const char *startup_file) {
+ 	assert(mgr);
+ 	mSceneMgr = mgr;
++	mgr->setNormaliseNormalsOnScale(true);
+ 	scriptLights.clear();
+ 
+ 	LogManager::getSingleton().logMessage("Using " + String(LUA_VERSION));
diff --git a/funguloids-ogre-1.7.0.patch b/funguloids-ogre-1.7.0.patch
new file mode 100644
index 0000000..a980d32
--- /dev/null
+++ b/funguloids-ogre-1.7.0.patch
@@ -0,0 +1,120 @@
+Index: include/mpakogre.h
+===================================================================
+--- include/mpakogre.h.orig
++++ include/mpakogre.h
+@@ -49,6 +49,7 @@ public:
+ 	void unload();
+ 
+ 	DataStreamPtr open(const String &filename) const;
++	DataStreamPtr open(const String &filename, bool) const { return open(filename); };
+ 	StringVectorPtr list(bool recursive = true, bool dirs = false);
+ 	FileInfoListPtr listFileInfo(bool recursive = true, bool dirs = false);
+ 
+Index: include/objectsystem.h
+===================================================================
+--- include/objectsystem.h.orig
++++ include/objectsystem.h
+@@ -34,7 +34,7 @@
+ using namespace std;
+ using namespace Ogre;
+ 
+-typedef map<String, MovingObject*> ObjectMapType;
++typedef std::map<String, MovingObject*> ObjectMapType;
+ 
+ // ObjectSystem
+ class ObjectSystem : public Singleton<ObjectSystem> {
+Index: include/openalsoundsystem.h
+===================================================================
+--- include/openalsoundsystem.h.orig
++++ include/openalsoundsystem.h
+@@ -47,7 +47,7 @@ using namespace Ogre;
+ using namespace std;
+ 
+ 
+-typedef map<String, ALuint> SoundMapType;
++typedef std::map<String, ALuint> SoundMapType;
+ 
+ // Number of independent channels for sound fx
+ const int NUM_SOUND_CHANNELS = 32;
+Index: src/mp3stream.cpp
+===================================================================
+--- src/mp3stream.cpp.orig
++++ src/mp3stream.cpp
+@@ -1,4 +1,4 @@
+-//****************************************************************************
++/****************************************************************************
+ // "Those Funny Funguloids!"
+ // http://funguloids.sourceforge.net
+ // Copyright (c) 2006-2007, Mika Halttunen
+@@ -31,7 +31,9 @@
+ #endif
+ 
+ #ifdef SOUND_STREAM_MP3
+-
++#include <unistd.h>
++#include <cstdlib>
++#include <sys/types.h>
+ #include <sys/stat.h>
+ #include <sstream>
+ #include <climits>
+@@ -233,7 +235,7 @@ void MP3Stream::rewindFile( )
+ //----------------------------------------------------------------------------
+ void MP3Stream::logInfo( struct mad_header *Header )
+ {
+-	stringstream ss;
++	std::stringstream ss;
+ 
+ 	/* Convert the layer number to it's printed representation. */
+ 	ss << "mpeg 1 layer ";
+Index: src/oggstream.cpp
+===================================================================
+--- src/oggstream.cpp.orig
++++ src/oggstream.cpp
+@@ -269,7 +269,7 @@ void OggStream::rewindOggFile( )
+ //----------------------------------------------------------------------------
+ void OggStream::logInfo()
+ {
+-	stringstream ss;
++	std::stringstream ss;
+ 	ss	<< "version         " << mVorbisInfo->version         << "\n"
+ 		<< "channels        " << mVorbisInfo->channels        << "\n"
+ 		<< "rate (hz)       " << mVorbisInfo->rate            << "\n"
+Index: src/openalsoundsystem.cpp
+===================================================================
+--- src/openalsoundsystem.cpp.orig
++++ src/openalsoundsystem.cpp
+@@ -287,7 +287,7 @@ int OpenALSoundSystem::initialise( unsig
+ 		LogManager::getSingleton().logMessage("OpenALSoundSystem(): initialised OpenAL" );
+ 	}
+ 
+-	stringstream ss;
++	std::stringstream ss;
+ 	ss << "OpenAL Vendor: " << alGetString(AL_VENDOR) << std::endl;
+ 	ss << "OpenAL Version: " << alGetString(AL_VERSION) << std::endl;
+ 	ss << "OpenAL Renderer: " << alGetString(AL_RENDERER) << std::endl;
+Index: src/playlist.cpp
+===================================================================
+--- src/playlist.cpp.orig
++++ src/playlist.cpp
+@@ -42,7 +42,7 @@
+ using namespace std;
+ 
+ // Play list files
+-static vector<String> playList;
++static std::vector<String> playList;
+ static unsigned int currentSong = -1;
+ 
+ 
+Index: src/scriptsystem.cpp
+===================================================================
+--- src/scriptsystem.cpp.orig
++++ src/scriptsystem.cpp
+@@ -48,7 +48,7 @@ void luaError(const String &str) {
+ 
+ 
+ // This keeps track of the lights created in script
+-static vector<Light*> scriptLights;
++static std::vector<Light*> scriptLights;
+ 
+ 
+ // File locator for script files
diff --git a/funguloids-ogre-1.8.patch b/funguloids-ogre-1.8.patch
new file mode 100644
index 0000000..30344be
--- /dev/null
+++ b/funguloids-ogre-1.8.patch
@@ -0,0 +1,102 @@
+--- include/mpakogre.h.old	2012-11-24 00:08:29.483485776 +0100
++++ include/mpakogre.h	2012-11-24 00:09:09.840160157 +0100
+@@ -54,7 +54,7 @@
+ 	FileInfoListPtr listFileInfo(bool recursive = true, bool dirs = false);
+ 
+ 	StringVectorPtr find(const String &pattern, bool recursive = true, bool dirs = false);
+-	FileInfoListPtr findFileInfo(const String &pattern, bool recursive, bool dirs = false);
++	FileInfoListPtr findFileInfo(const String &pattern, bool recursive, bool dirs = false) const;
+ 
+ 	bool exists(const String &filename);
+ 
+--- src/mpakogre.cpp.old	2012-11-24 00:04:48.801730942 +0100
++++ src/mpakogre.cpp	2012-11-26 11:08:04.114559127 +0100
+@@ -180,10 +180,10 @@
+ 	return ret;
+ }
+ 
+-FileInfoListPtr MPakArchive::findFileInfo(const String &pattern, bool recursive, bool dirs) {
++FileInfoListPtr MPakArchive::findFileInfo(const String &pattern, bool recursive, bool dirs) const {
+ 	FileInfoListPtr ret = FileInfoListPtr(new FileInfoList());
+ 
+-	FileInfoList::iterator i, iend;
++	FileInfoList::const_iterator i, iend;
+ 	iend = mFileList.end();
+ 	for(i = mFileList.begin(); i != iend; ++i) {
+ 		if(StringUtil::match(i->filename, pattern, true))
+--- src/openalsoundsystem.cpp.orig	2012-11-26 11:25:48.798301526 +0100
++++ src/openalsoundsystem.cpp	2012-11-26 11:29:53.556485128 +0100
+@@ -35,16 +35,16 @@
+ #include "playlist.h"
+ #include "mpakogre.h"
+ 
+-template<> OpenALSoundSystem* Singleton<OpenALSoundSystem>::ms_Singleton = 0;
++template<> OpenALSoundSystem* Singleton<OpenALSoundSystem>::msSingleton = 0;
+ 
+ OpenALSoundSystem* OpenALSoundSystem::getSingletonPtr() {
+-	return ms_Singleton;
++	return msSingleton;
+ }
+ 
+ 
+ OpenALSoundSystem& OpenALSoundSystem::getSingleton() {
+-	assert(ms_Singleton);
+-	return *ms_Singleton;
++	assert(msSingleton);
++	return *msSingleton;
+ }
+ 
+ 
+--- src/objectsystem.cpp.orig	2012-11-26 11:27:14.562919664 +0100
++++ src/objectsystem.cpp	2012-11-26 11:29:48.549625145 +0100
+@@ -26,7 +26,7 @@
+ #include "objectsystem.h"
+ #include "game.h"
+ 
+-template<> ObjectSystem* Singleton<ObjectSystem>::ms_Singleton = 0;
++template<> ObjectSystem* Singleton<ObjectSystem>::msSingleton = 0;
+ 
+ 
+ // ObjectSystem constructor
+@@ -135,11 +135,11 @@
+ 
+ 
+ ObjectSystem *ObjectSystem::getSingletonPtr() {
+-	return ms_Singleton;
++	return msSingleton;
+ }
+ 
+ ObjectSystem &ObjectSystem::getSingleton() {
+-	assert(ms_Singleton);
+-	return *ms_Singleton;
++	assert(msSingleton);
++	return *msSingleton;
+ }
+ 
+--- src/scriptsystem.cpp.orig	2012-11-26 11:31:47.781284474 +0100
++++ src/scriptsystem.cpp	2012-11-26 11:32:04.409817569 +0100
+@@ -38,7 +38,7 @@
+ #include "mpakogre.h"
+ #include <vector>
+ 
+-template<> ScriptSystem* Singleton<ScriptSystem>::ms_Singleton = 0;
++template<> ScriptSystem* Singleton<ScriptSystem>::msSingleton = 0;
+ 
+ 
+ // Log error messages
+@@ -564,12 +564,12 @@
+ 
+ 
+ ScriptSystem *ScriptSystem::getSingletonPtr() {
+-	return ms_Singleton;
++	return msSingleton;
+ }
+ 
+ ScriptSystem &ScriptSystem::getSingleton() {
+-	assert(ms_Singleton);
+-	return *ms_Singleton;
++	assert(msSingleton);
++	return *msSingleton;
+ }
+ 
+ 
diff --git a/funguloids-optional_cg.patch b/funguloids-optional_cg.patch
new file mode 100644
index 0000000..a486de4
--- /dev/null
+++ b/funguloids-optional_cg.patch
@@ -0,0 +1,38 @@
+Index: bin/plugins.cfg.in
+===================================================================
+--- bin/plugins.cfg.in.orig
++++ bin/plugins.cfg.in
+@@ -7,6 +7,6 @@ PluginFolder=%%ogreplugindir%%
+ Plugin=RenderSystem_GL
+ Plugin=Plugin_ParticleFX
+ Plugin=Plugin_OctreeSceneManager
+-Plugin=Plugin_CgProgramManager
++#Plugin=Plugin_CgProgramManager
+ 
+ 
+Index: src/ogreapp.cpp
+===================================================================
+--- src/ogreapp.cpp.orig
++++ src/ogreapp.cpp
+@@ -23,6 +23,7 @@
+ //
+ //***************************************************************************/
+ 
++#include <sys/stat.h>
+ #include "ogreapp.h"
+ #include "objectsystem.h"
+ #include "effects.h"
+@@ -71,6 +72,13 @@ bool OgreApplication::setup() {
+ 			OGRE_CONFIG_AND_LOG_PATH + "Ogre.log"
+ 			);
+ 
++	ConfigFile cfg;
++	cfg.load(String(OGRE_PLUGINS_AND_RESOURCES_PATH) + "plugins.cfg");
++	String pluginDir = cfg.getSetting("PluginFolder");
++	struct stat sb;
++	if (stat((pluginDir + "Plugin_CgProgramManager.so").c_str(), &sb) == 0)
++		mRoot->loadPlugin(pluginDir + "Plugin_CgProgramManager");
++
+ 	// Random seed
+ 	srand(time(NULL));
+ 
diff --git a/funguloids-size_chunks_reverse.patch b/funguloids-size_chunks_reverse.patch
new file mode 100644
index 0000000..38c4619
--- /dev/null
+++ b/funguloids-size_chunks_reverse.patch
@@ -0,0 +1,13 @@
+Index: src/mpakogre.cpp
+===================================================================
+--- src/mpakogre.cpp.orig
++++ src/mpakogre.cpp
+@@ -219,7 +219,7 @@ MPakDataStream::~MPakDataStream() {
+ }
+ 
+ size_t MPakDataStream::read(void *buf, size_t count) {
+-	return fread(buf, count, 1, mFileHandle);
++	return fread(buf, 1, count, mFileHandle);
+ }
+ 
+ void MPakDataStream::skip(long count) {
diff --git a/funguloids-strcmp.patch b/funguloids-strcmp.patch
new file mode 100644
index 0000000..8b8e1e4
--- /dev/null
+++ b/funguloids-strcmp.patch
@@ -0,0 +1,13 @@
+Index: src/ogrelistener.cpp
+===================================================================
+--- src/ogrelistener.cpp.orig
++++ src/ogrelistener.cpp
+@@ -130,7 +130,7 @@ OgreAppFrameListener::OgreAppFrameListen
+ 
+ 
+ 	// Show debug info?
+-	if(GameApplication::mGameConfig->GetValue("graphics", "debug_info", "off") == "on") {
++	if(strcmp(GameApplication::mGameConfig->GetValue("graphics", "debug_info", "off"), "on") == 0) {
+ 		showDebugOverlay(true);
+ 		mStatsOn = true;
+ 	}
diff --git a/funguloids.6 b/funguloids.6
new file mode 100644
index 0000000..65f9689
--- /dev/null
+++ b/funguloids.6
@@ -0,0 +1,44 @@
+.TH FUNGULOIDS 6 "July 10, 2007"
+.SH NAME
+funguloids \- "Those Funny Funguloids!"
+.SH SYNOPSIS
+.B funguloids
+.SH DESCRIPTION
+This manual page documents briefly the
+.B funguloids
+command.
+.PP
+\fBfunguloids\fP is a the command to run and play the game "Those Funny Funguloids!".
+.SH SEE ALSO
+.BR /usr/share/doc/funguloids
+.br
+.BR http://funguloids.sourceforge.net
+.SH CREDITS
+"Those Funny Funguloids!" was primarily developed by:
+.br
+.br
+\fBCode:\fP Mika Halttunen <lsoftNOSPAM at mbnet.fi>
+.br
+\fBGame Design:\fP Teemu Ruokolainen
+.br
+\fBArtwork:\fP Mika Halttunen
+.br
+\fBSound Design & Music:\fP Teemu Ruokolainen
+.SH LICENSE
+"Those Funny Funguloids!" is licensed under the zlib/libpng license.
+Copyright (C) 2006-2007, Mika Halttunen & Teemu Ruokolainen
+
+This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages arising from the use of this software.
+
+Permission is granted to anyone to use this software for any purpose, including commercial applications, and to alter it and redistribute it freely, subject to the following restrictions:
+
+   1. The origin of this software must not be misrepresented; you must not claim
+   that you wrote the original software. If you use this software in a product, an
+   acknowledgment in the product documentation would be appreciated but is not
+   required.
+   2. Altered source versions must be plainly marked as such, and must not be
+   misrepresented as being the original software.
+   3. This notice may not be removed or altered from any source distribution.
+
+This manual page was written by Andres Mejia <mcitadel at gmail.com>,
+for the Debian project (but may be used by others).
diff --git a/funguloids.desktop b/funguloids.desktop
new file mode 100644
index 0000000..3c44a6f
--- /dev/null
+++ b/funguloids.desktop
@@ -0,0 +1,8 @@
+[Desktop Entry]
+Name=Funguloids
+Comment=Those Funny Funguloids!
+Icon=funguloids
+Exec=funguloids
+Terminal=false
+Type=Application
+Categories=Game;ArcadeGame;
diff --git a/funguloids.png b/funguloids.png
new file mode 100644
index 0000000..a7d37a9
Binary files /dev/null and b/funguloids.png differ
diff --git a/funguloids.spec b/funguloids.spec
new file mode 100644
index 0000000..cd768b3
--- /dev/null
+++ b/funguloids.spec
@@ -0,0 +1,142 @@
+#
+# Fedora spec file for package funguloids
+#
+# Adapted from the openSUSE spec file and patches, which are:
+#
+# Copyright (c) 2012 SUSE LINUX Products GmbH, Nuernberg, Germany.
+#
+# All modifications and additions to the file contributed by third parties
+# remain the property of their copyright owners, unless otherwise agreed
+# upon. The license for this file, and modifications and additions to the
+# file, is the same license as for the pristine package itself (unless the
+# license for the pristine package is not an Open Source License, in which
+# case the license is the MIT License). An "Open Source License" is a
+# license that conforms to the Open Source Definition (Version 1.9)
+# published by the Open Source Initiative.
+
+Name:           funguloids
+Version:        1.06
+Release:        1%{?dist}
+Summary:        Space-Flying-Mushroom-Picking-Simulator game
+License:        zlib
+Group:          Amusements/Games
+URL:            http://funguloids.sourceforge.net
+Source0:        http://downloads.sourceforge.net/%{name}/%{name}-linux-%{version}-4.tar.bz2
+# From Debian, as the openSUSE srpm has v1.4, which lacks a clear license
+Source1:        mpak.py
+# README.openSUSE modified for Fedora
+Source2:        README.Fedora
+Source3:        funguloids.desktop
+Source4:        funguloids.png
+# Shamelessly borrowed from Debian
+Source5:        funguloids.6
+# All the below patches where taken from the openSUSE srpm
+# funguloids-ogre-1.6.patch has been extended with some bits from the more
+# complete ogre-1.6.1.patch from Debian
+Patch0:         %{name}-size_chunks_reverse.patch
+Patch1:         %{name}-alc_error.patch
+Patch2:         %{name}-missing_includes.patch
+Patch3:         %{name}-ogre-1.6.patch
+Patch4:         %{name}-lua.patch
+Patch5:         %{name}-destdir.patch
+Patch6:         %{name}-honor_autotools_paths.patch
+Patch7:         %{name}-strcmp.patch
+Patch8:         %{name}-optional_cg.patch
+Patch9:         %{name}-ogre-1.7.0.patch
+Patch10:        %{name}-gcc47.patch
+Patch11:        %{name}-ogre-1.8.patch
+BuildRequires:  automake desktop-file-utils python
+BuildRequires:  freealut-devel libvorbis-devel lua-devel
+BuildRequires:  ogre-devel ois-devel openal-devel
+Requires:       hicolor-icon-theme
+
+%description
+Never before has collecting mushrooms been this mildly entertaining. At least
+not in outer space. It's more of a lifestyle than a game, really. Now with
+graphics and sound, too!
+
+Seriously though, we like to think the game as a
+space-flying-mushroom-picking-simulator. Well no, "Those Funny Funguloids!" is
+actually a nice little piece of entertainment. You collect mushrooms, bring them
+back to your home base and profit! That's the basic idea in a nutshell. It has
+smooth, appealing 3d graphics and nice atmospheric sound effects. Go ahead and
+try it out - it has sounds too!
+
+
+%prep
+%setup -q -n %{name}
+%patch0
+%patch1
+%patch2
+%patch3
+%patch4
+%patch5
+%patch6
+%patch7
+%patch8
+%patch9
+%patch10
+%patch11
+autoreconf -fi
+# docs fixup
+sed -i 's/\r$//' bin/docs/stylesheet.css
+sed -i 's/\r$//' README
+# mpk file fixup
+%{SOURCE1} -e -f bin/bootstrap.mpk -p _bootstrap
+%{SOURCE1} -e -f bin/funguloids.mpk -p _gamedata
+sed -ri '/^[A-Z]/ s/(.*)/overlay \1/' _bootstrap/*.overlay _gamedata/*.overlay
+sed -ri '/^[A-Z]/ s/(.*)/particle_system \1/' _gamedata/*.particle
+# This last one looks like a bug in ogre, should be removed when fixed
+# The problem is that green and blue mushrooms have a square instead of a glow
+sed -ri 's/^(\t\t\t)(texture_unit) 1/\1\2\n\1{\n\1}\n\1\2/' _gamedata/materials.material
+%{SOURCE1} -c -f bin/bootstrap.mpk _bootstrap/*
+%{SOURCE1} -c -f bin/funguloids.mpk _gamedata/*
+rm -rf _bootstrap _gamedata
+
+
+%build
+%configure --docdir=%{_docdir}/%{name}-%{version} --without-mad --without-fmod
+make %{?_smp_mflags}
+
+
+%install
+%make_install
+cp -p COPYING README %{SOURCE2} $RPM_BUILD_ROOT%{_docdir}/%{name}-%{version}
+
+mkdir -p $RPM_BUILD_ROOT%{_datadir}/applications
+desktop-file-install --dir $RPM_BUILD_ROOT%{_datadir}/applications %{SOURCE3}
+
+mkdir -p $RPM_BUILD_ROOT%{_datadir}/icons/hicolor/{48x48,256x256}/apps
+mv $RPM_BUILD_ROOT%{_datadir}/pixmaps/%{name}.png \
+   $RPM_BUILD_ROOT%{_datadir}/icons/hicolor/48x48/apps
+cp -p %{SOURCE4} $RPM_BUILD_ROOT%{_datadir}/icons/hicolor/256x256/apps
+
+mkdir -p $RPM_BUILD_ROOT%{_mandir}/man6
+cp -p %{SOURCE5} $RPM_BUILD_ROOT%{_mandir}/man6
+
+
+%post
+touch --no-create %{_datadir}/icons/hicolor &>/dev/null || :
+
+%postun
+if [ $1 -eq 0 ] ; then
+    touch --no-create %{_datadir}/icons/hicolor &>/dev/null
+    gtk-update-icon-cache %{_datadir}/icons/hicolor &>/dev/null || :
+fi
+
+%posttrans
+gtk-update-icon-cache %{_datadir}/icons/hicolor &>/dev/null || :
+
+
+%files
+%doc %{_docdir}/%{name}-%{version}
+%{_bindir}/%{name}
+%{_datadir}/%{name}/
+%{_datadir}/applications/%{name}.desktop
+%{_datadir}/icons/hicolor/*/apps/%{name}.png
+%{_mandir}/man6/%{name}.6*
+
+
+%changelog
+* Mon May 13 2013 Hans de Goede <hdegoede at redhat.com> - 1.06-1
+- Initial Fedora package based on openSUSE pkg + some Debian bits
diff --git a/mpak.py b/mpak.py
new file mode 100755
index 0000000..6cd6ccc
--- /dev/null
+++ b/mpak.py
@@ -0,0 +1,376 @@
+#!/usr/bin/python
+"""
+	MPAK package handling utility
+	Version 1.5 (Python-implementation)
+	Copyright (c) 2008, 2012, Mika Halttunen. <http://www.mhgames.org>
+
+	Permission is hereby granted, free of charge, to any person obtaining a
+	copy of this software and associated documentation files (the "Software"),
+	to deal in the Software without restriction, including without limitation
+	the rights to use, copy, modify, merge, publish, distribute, sublicense,
+	and/or sell copies of the Software, and to permit persons to whom the
+	Software is furnished to do so, subject to the following conditions:
+
+	The above copyright notice and this permission notice shall be included in
+	all copies or substantial portions of the Software.
+
+	THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+	IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+	FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+	AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+	LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+	FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+	DEALINGS IN THE SOFTWARE.
+	
+	- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+	Description follows:
+	
+	This command line tool allows creation and extraction of MPAK (.mpk) packages used
+	in several of my games. MPAK is a simple WAD-like file format of mine, that allows storing
+	the game data in one single .mpk file. I originally had a very crude command line program
+	bit like this one (written in C++), and decided to write this Python-implementation as
+	an Python-programming excercise. So, it's my first Python program. :)
+
+	Version history:
+	v1.5: Licensed under MIT license (no functional changes)
+	v1.4: The first Python version
+	v1.0 -- v1.31: The original C++ implementation
+"""
+import getopt, sys
+import os
+import traceback
+import struct
+import binascii
+import fnmatch
+import shutil
+from ctypes import c_uint32
+
+def usage():
+	"""
+	Prints the program usage.
+	"""
+	print "MPAK package handling utility"
+	print "Version 1.5 (Python-implementation)"
+	print "Copyright (c) 2008, 2012, Mika Halttunen."
+	print ""
+	print "Usage:", sys.argv[0],"[switch]","-f pakfile.mpk","[file1]","[file2]", "[...]", "[fileN]"
+	print "where [switch] is one of the following:"
+	print "  -f, --file=FILE   Use package FILE"
+	print "  -c, --create      Create a new package with files 'file1' to 'fileN'"
+	print "  -l, --list        List the files from given package"
+	print "  -e, --extract     Extract all files (by default) from given package. If you"
+	print "                    want to only extract some specific files, you can name"
+	print "                    them individually, and/or use wildcards (i.e. *.png)."
+	print "                    You can supply path where to extract with -p."
+	print "  -p, --path=PATH   Extract to PATH (created if doesn't exist)"
+	print "  -h, --help        Print this usage text"
+	print ""
+
+
+def errorMsg(msg):
+	"""
+	Prints an error message and exits.
+	"""
+	try:
+		pos = traceback.extract_stack(limit=2)
+		if pos:
+			print "ERROR: In %s:%s, line %d:" % (pos[0][0], pos[0][2], pos[0][1])
+		else: print "ERROR:"
+		print "\t",msg
+	except:
+		if __debug__:
+			traceback.print_exc()
+		pass
+	sys.exit(2)
+
+
+def separator():
+	"""
+	Prints the separator line.
+	"""
+	print "-"*75
+
+
+def computeCRC(file, offset):
+	"""
+	Computes the CRC32 for the file, starting at given offset.
+	"""
+	f = open(file, "rb")
+	f.seek(offset)
+	crc = 0
+
+	# Compute a running CRC32 for the file in 16kb chunks
+	while True:
+		buffer = f.read(16384)
+		if buffer == "": break		# End of file
+
+		crc = binascii.crc32(buffer, crc)
+
+	f.close()
+	return crc
+
+
+def createPackage(pakFile, files):
+	"""
+	Creates a new MPAK package.
+
+	This copies the given files into the new package file, writes the file table
+	and closes the package. MPAK doesn't support adding new files to an existing
+	package.
+	"""
+	print "Creating '%s'.." % pakFile
+	if len(files) < 1: errorMsg("No input files specified!")
+	separator()
+
+	# Open the package file for writing
+	out = open(pakFile, "wb")
+
+	# Write the header and reserve 4+4 bytes for CRC32 and file table offset
+	out.write("MPK1")
+	out.write("."*8)
+
+	# Write each file
+	package = { "fileNames": [], "fileOffsets": [] }
+	count = 0
+	for file in files:
+		# Get the basename
+		filename = os.path.basename(file)
+		print " <",filename,"...",
+		package["fileNames"].append(filename)
+
+		# Get the file size in bytes
+		stats = os.stat(file)
+
+		# Store the current offset
+		package["fileOffsets"].append(out.tell())
+
+		# Open the file and copy its contents
+		f = open(file, "rb")
+		shutil.copyfileobj(f, out, 16384)
+		f.close()
+
+		print "OK. (%.1f KB)" % (stats.st_size / 1024.0)
+		count = count + 1
+
+	separator()
+
+	# Grab the file table offset and write the table
+	ftOffset = out.tell()
+
+	# Write the number of files
+	out.write(struct.pack("<L", count))
+
+	# Write the file information
+	for i in range(count):
+		# File name length
+		length = len(package["fileNames"][i]) + 1
+		out.write(struct.pack("B", length))
+		# File name, plus one zero for the C++ implementation
+		out.write(package["fileNames"][i])
+		out.write(struct.pack("B", 0))
+		# File offset
+		out.write(struct.pack("<L", package["fileOffsets"][i]))
+
+	# Update the header to have the correct file table offset
+	out.seek(8)
+	out.write(struct.pack("<L", ftOffset))
+
+	# Compute the CRC32 and write it to the header
+	out.flush()
+	crc32 = c_uint32(0)
+	crc32.value = computeCRC(pakFile, 8)
+	out.seek(4)
+	out.write(struct.pack("<L", crc32.value))
+
+	print "Added %d files to %s" % (count, pakFile)
+	print "Package '%s' created successfully. CRC32 checksum is %s." % (pakFile, hex(crc32.value))
+	out.close()
+
+
+def readPackage(pakFile):
+	"""
+	Opens the given MPAK package, reads its information and stores it to a
+	package dictionary. Returns the dictionary.
+	"""
+	packageInfo = { "filename": pakFile }
+
+	f = open(pakFile, 'rb')
+	if f.read(4) != "MPK1": errorMsg("Unsupported file format!")
+
+	# Read the CRC32 checksum and the file table header offset
+	buffer = f.read(8)
+	crc32, headerOffset = struct.unpack("<LL", buffer)
+	crc32 = int(crc32)
+	packageInfo["crc"] = crc32
+
+	# Check that the CRC32 matches
+	checksum = c_uint32(0)
+	checksum.value = computeCRC(pakFile, 8)
+	if checksum.value != crc32:
+		f.close()
+		errorMsg("Checksum doesn't match; perhaps a corrupted package?")
+
+	# Seek to the file table, and read the number of files
+	f.seek(headerOffset)
+	numFiles = struct.unpack("<L", f.read(4))[0]
+	packageInfo["numFiles"] = numFiles
+
+	# Read the file information
+	fileNames = []
+	fileOffsets = []
+	for i in range(numFiles):
+		namelen = struct.unpack("B", f.read(1))[0]
+		file = f.read(namelen)
+		offset = struct.unpack("<L", f.read(4))[0]
+		fileNames.append(file[:-1])		# Remove the trailing null character
+		fileOffsets.append(offset)
+
+	# Compute the file sizes from the offsets
+	fileSizes = []
+	for i in range(numFiles-1):
+		fileSizes.append(fileOffsets[i+1] - fileOffsets[i])
+	fileSizes.append(headerOffset - fileOffsets[numFiles-1])
+
+	# Store the information
+	packageInfo["fileNames"] = fileNames
+	packageInfo["fileOffsets"] = fileOffsets
+	packageInfo["fileSizes"] = fileSizes
+	f.close()
+	return packageInfo
+
+
+def listPackage(pakFile):
+	"""
+	Lists the contents of a MPAK package.
+	"""
+	print "Listing '%s'.." % pakFile
+	package = readPackage(pakFile)
+
+	# Print the listing
+	numFiles = package["numFiles"]
+	print "'%s' (CRC32: %s) contains %d files:" % (pakFile, hex(package["crc"]), numFiles)
+	print ""
+	print " NUM : FILE                           : SIZE(KB)   : OFFSET"
+	separator()
+	for i in range(numFiles):
+		print " %3d : %30s : %-10.1f : (at %s)" % (i+1, package["fileNames"][i], package["fileSizes"][i] / 1024.0, hex(package["fileOffsets"][i]))
+
+	separator()
+	print " NUM : FILE                           : SIZE(KB)   : OFFSET"
+
+
+def extractPackage(pakFile, path, filters):
+	"""
+	Extracts files from a package to given path.
+
+	By default extracts all the files. Can be given list of wildcards (i.e. *.png) to
+	extract only the files that match given wildcards. Wildcards can also be file names
+	from the package.
+
+	The given path is created if it doesn't exist.
+	If the path is just a single directory name, it's assumed to exist in the current
+	working directory.
+	"""
+	print "Extracting files from '%s' to %s.." % (pakFile, path)
+	package = readPackage(pakFile)
+
+	# Try to create the path if it doesn't exist
+	path = os.path.abspath(path)
+	if not os.path.exists(path):
+		print "Path",path,"doesn't exist, creating it.."
+		try:
+			os.makedirs(path)
+		except:
+			errorMsg("Unable to create directory " + path + "!");
+
+	separator()
+
+	# Open the file, and extract all the individual files from it
+	count = 0
+	f = open(pakFile, "rb")
+	for i in range(package["numFiles"]):
+		# Test if the file name matches the given wildcard
+		if len(filters) > 0:
+			for filter in filters:
+				if fnmatch.fnmatch(package["fileNames"][i], filter):
+					break
+			else: continue
+
+		print " >", package["fileNames"][i],"...",
+		# Seek to the correct offset
+		f.seek(package["fileOffsets"][i])
+
+		# Open a new file for writing, and write the file out in 16kb chunks
+		out = open(os.path.join(path, package["fileNames"][i]), "wb")
+		bytesWritten = 0
+		bytesTotal = package["fileSizes"][i];
+		while True:
+			# We have to watch not to write too much
+			bytesLeft = bytesTotal - bytesWritten
+			if bytesLeft > 16384: bytesLeft = 16384
+
+			buffer = f.read(bytesLeft)
+			out.write(buffer)
+			bytesWritten = bytesWritten + bytesLeft
+
+			if bytesWritten == bytesTotal:
+				break
+
+		out.close()
+		print "OK."
+		count = count + 1
+
+	f.close()
+	separator()
+	print "%d (of %d) files extracted to %s." % (count, package["numFiles"], path)
+
+
+def main():
+	"""
+	Main method.
+	"""
+	try:
+		# Get the optiosn
+		opts, args = getopt.getopt(sys.argv[1:], "f:clep:h", ["file=", "create", "list", "extract", "path=", "help"])
+	except getopt.GetoptError, err:
+		# Print the program usage and exit
+		print "ERROR:", str(err)
+		usage()
+		sys.exit(2)
+
+	extractPath = os.getcwd()
+	pakFile = None
+	action = None
+
+	# Handle the options
+	for o, a in opts:
+		if o in ("-f", "--file"):
+			pakFile = a					# Grab the pakfile
+		elif o in ("-c", "--create"):
+			action = "create"
+		elif o in ("-l", "--list"):
+			action = "list"
+		elif o in ("-e", "--extract"):
+			action = "extract"
+		elif o in ("-p", "--path"):
+			extractPath = a				# Grab the path
+		elif o in ("-h", "--help"):
+			usage()
+			sys.exit()
+		else:
+			assert False, "Unhandled option"
+
+	# Check that we got a pakfile
+	if pakFile == None:
+		usage()
+		sys.exit(2)
+
+	if action == "create": createPackage(pakFile, args)
+	elif action == "list": listPackage(pakFile)
+	elif action == "extract": extractPackage(pakFile, extractPath, args)
+	else: usage()
+	sys.exit()
+
+if __name__ == "__main__":
+	main()
+
diff --git a/sources b/sources
index e69de29..c37ebf3 100644
--- a/sources
+++ b/sources
@@ -0,0 +1 @@
+1d9d92b08f58715d3dcb59c2ebcb7db7  funguloids-linux-1.06-4.tar.bz2


More information about the scm-commits mailing list