rpms/blobAndConquer/FC-6 blobAndConquer-0.90-exit-crash.patch, NONE, 1.1 blobAndConquer-0.90-no-stencil.patch, NONE, 1.1 blobAndConquer-0.90-opt-fix.patch, NONE, 1.1 blobAndConquer-0.90-ppc.patch, NONE, 1.1 blobAndConquer-0.90-strict-alias.patch, NONE, 1.1 blobAndConquer-0.90-unix-lf.patch, NONE, 1.1 blobAndConquer.spec, NONE, 1.1 .cvsignore, 1.1, 1.2 sources, 1.1, 1.2

Hans de Goede (jwrdegoede) fedora-extras-commits at redhat.com
Sat May 26 10:40:52 UTC 2007


Author: jwrdegoede

Update of /cvs/extras/rpms/blobAndConquer/FC-6
In directory cvs-int.fedora.redhat.com:/tmp/cvs-serv2117

Modified Files:
	.cvsignore sources 
Added Files:
	blobAndConquer-0.90-exit-crash.patch 
	blobAndConquer-0.90-no-stencil.patch 
	blobAndConquer-0.90-opt-fix.patch 
	blobAndConquer-0.90-ppc.patch 
	blobAndConquer-0.90-strict-alias.patch 
	blobAndConquer-0.90-unix-lf.patch blobAndConquer.spec 
Log Message:
* Thu May 24 2007 Hans de Goede <j.w.r.degoede at hhs.nl> 0.90-2
- Add missing desktop-file-utils BuildRequire


blobAndConquer-0.90-exit-crash.patch:

--- NEW FILE blobAndConquer-0.90-exit-crash.patch ---
--- blobAndConquer-0.90/src/init.cpp~	2007-05-23 22:40:47.000000000 +0200
+++ blobAndConquer-0.90/src/init.cpp	2007-05-23 22:40:47.000000000 +0200
@@ -506,8 +506,9 @@
 		SDL_JoystickClose(engine->joystick);
 	}
 
+/*	Disable this it causes us to segfault on exit (at_exit that is)
 	debug(("Closing SDL Sub System...\n"));
-	SDL_Quit();
+	SDL_Quit(); */
 
 	debug(("All Done.\n"));m
 }

blobAndConquer-0.90-no-stencil.patch:

--- NEW FILE blobAndConquer-0.90-no-stencil.patch ---
diff -ur blobAndConquer-0.90/src/effects/shadows.cpp blobAndConquer-0.90.new/src/effects/shadows.cpp
--- blobAndConquer-0.90/src/effects/shadows.cpp	2006-10-28 19:34:10.000000000 +0200
+++ blobAndConquer-0.90.new/src/effects/shadows.cpp	2007-05-20 18:40:56.000000000 +0200
@@ -126,6 +126,9 @@
 
 void drawShadow()
 {
+	if (game->shadowPolicy == SHADOW_POLICY_OFF)
+		return;
+	
 	generateShadows();
 	
 	glPushAttrib(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT | GL_ENABLE_BIT | GL_POLYGON_BIT | GL_STENCIL_BUFFER_BIT);
diff -ur blobAndConquer-0.90/src/hud/options.cpp blobAndConquer-0.90.new/src/hud/options.cpp
--- blobAndConquer-0.90/src/hud/options.cpp	2007-04-24 09:32:01.000000000 +0200
+++ blobAndConquer-0.90.new/src/hud/options.cpp	2007-05-20 19:17:52.000000000 +0200
@@ -445,11 +445,16 @@
 	blood->addItem("Off");
 	blood->addItem("No Stains");
 	blood->addItem("On");
-	
-	shadows->addItem("Off");
-	shadows->addItem("Bob Only");
-	shadows->addItem("Blobs and Enemies");
-	shadows->addItem("On");
+
+	if (graphics->hasStencils)
+	{	
+		shadows->addItem("Off");
+		shadows->addItem("Bob Only");
+		shadows->addItem("Blobs and Enemies");
+		shadows->addItem("On");
+	}
+	else
+		shadows->addItem("Not Available (no stencil support)");
 	
 	decals->addItem("Off");
 	decals->addItem("Low");
diff -ur blobAndConquer-0.90/src/init.cpp blobAndConquer-0.90.new/src/init.cpp
--- blobAndConquer-0.90/src/init.cpp	2007-04-24 09:32:01.000000000 +0200
+++ blobAndConquer-0.90.new/src/init.cpp	2007-05-20 19:13:32.000000000 +0200
@@ -278,9 +278,15 @@
 	
 	glGetIntegerv(GL_STENCIL_BITS, &stencil);
 	
-	if (stencil == 0)
-	{
-		graphics->showErrorAndExit("Stencil Buffering is not supported");
+	/* update queried hasStencils value with the real thing */
+	graphics->hasStencils = stencil;
+	if (!graphics->hasStencils) {
+		printf("Warning: Stencil Buffering is not supported,\n");
+#ifdef __unix__
+		printf("  try changing your X-windows colordepth to 32bpp,\n");
+#endif
+		printf("  disabling shadows!\n");
+		game->shadowPolicy = SHADOW_POLICY_OFF;
 	}
 	
 	/*
@@ -315,8 +321,13 @@
 		exit(1);
 	}
 	
+	graphics->queryStencilSupport();
+	
 	SDL_GL_SetAttribute(SDL_GL_DOUBLEBUFFER, 1);
-	SDL_GL_SetAttribute(SDL_GL_STENCIL_SIZE, 8);
+	if (graphics->hasStencils)
+		SDL_GL_SetAttribute(SDL_GL_STENCIL_SIZE, 8);
+	else
+		SDL_GL_SetAttribute(SDL_GL_STENCIL_SIZE, 0);
 	SDL_GL_SetAttribute(SDL_GL_SWAP_CONTROL, 1);
 	
 	graphics->getAvailableScreenModes();
diff -ur blobAndConquer-0.90/src/system/CGraphics.cpp blobAndConquer-0.90.new/src/system/CGraphics.cpp
--- blobAndConquer-0.90/src/system/CGraphics.cpp	2007-05-04 09:14:36.000000000 +0200
+++ blobAndConquer-0.90.new/src/system/CGraphics.cpp	2007-05-20 19:13:43.000000000 +0200
@@ -19,6 +19,10 @@
 */
 
 #include "../headers.h"
+#ifdef __unix__
+#include <GL/glx.h>
+#include <SDL/SDL_syswm.h>
+#endif
 
 Graphics::Graphics()
 {
@@ -135,6 +139,60 @@
 	}
 }
 
+void Graphics::queryStencilSupport()
+{
+#ifdef __unix__
+	SDL_SysWMinfo wm_info;
+	
+	SDL_VERSION(&wm_info.version);
+
+	if (SDL_GetWMInfo(&wm_info) && wm_info.subsystem == SDL_SYSWM_X11)
+	{
+		XVisualInfo theTemplate;  
+		XVisualInfo *visuals;
+		int i, numVisuals, visualCaveat, stencilSize;
+		long mask = VisualScreenMask;
+		Display *dpy = wm_info.info.x11.display;
+		
+		wm_info.info.x11.lock_func();
+
+		theTemplate.screen = 0;
+		visuals = XGetVisualInfo(dpy, mask, &theTemplate, &numVisuals);
+		
+		hasStencils = false;
+		for(i = 0; i < numVisuals; i++)
+		{
+			const char *ext = glXQueryExtensionsString(dpy, visuals[i].screen);
+			
+			glXGetConfig(dpy, &visuals[i], GLX_STENCIL_SIZE, &stencilSize);
+			
+			if (ext && strstr(ext, "GLX_EXT_visual_rating")) {
+				glXGetConfig(dpy, &visuals[i], GLX_VISUAL_CAVEAT_EXT, &visualCaveat);
+			}
+			else {
+				visualCaveat = -1; /* unknown */
+			}
+			
+			if (stencilSize && (visualCaveat == GLX_NONE_EXT)) {
+				hasStencils = true;
+				break;
+			}
+		}
+		wm_info.info.x11.unlock_func();
+		debug(("Query stencil support: has stencils: %d\n", (int)hasStencils));
+	}
+	else
+	{
+		printf("Warning: Couldn't determine the availability of stencil buffers (no X11 display),\n");
+		printf("  assuming they are available\n");
+		hasStencils = true;
+	}
+#else
+	/* assume stencils are available on other platforms */
+	hasStencils = true;
+#endif
+}
+
 void Graphics::getAvailableScreenModes()
 {
 	debug(("Graphics::getAvailableScreenModes()\n"));
@@ -286,7 +344,10 @@
 
 void Graphics::clearScreen()
 {
-	glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT | GL_STENCIL_BUFFER_BIT);
+	if (hasStencils)
+		glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT | GL_STENCIL_BUFFER_BIT);
+	else
+		glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
 }
 
 void Graphics::updateScreen()
diff -ur blobAndConquer-0.90/src/system/CGraphics.h blobAndConquer-0.90.new/src/system/CGraphics.h
--- blobAndConquer-0.90/src/system/CGraphics.h	2007-01-04 18:39:32.000000000 +0100
+++ blobAndConquer-0.90.new/src/system/CGraphics.h	2007-05-20 19:12:40.000000000 +0200
@@ -76,6 +76,7 @@
 		
 		int currentScreenResolution;
 		bool fullscreen;
+		bool hasStencils;
 		float gamma;
 		
 		int redPulseDir;
@@ -85,6 +86,7 @@
 	~Graphics();
 	void destroy();
 	
+	void queryStencilSupport();
 	void getAvailableScreenModes();
 	void setResolution(int i);
 	void resetFPSCount();

blobAndConquer-0.90-opt-fix.patch:

--- NEW FILE blobAndConquer-0.90-opt-fix.patch ---
--- blobAndConquer-0.90/src/system/CGraphics.cpp~	2007-05-22 17:33:50.000000000 +0200
+++ blobAndConquer-0.90/src/system/CGraphics.cpp	2007-05-22 17:33:50.000000000 +0200
@@ -604,8 +604,11 @@
 
 Texture *Graphics::createTexture(SDL_Surface *surface)
 {
-	int w = Math::toNextPower(surface->w, 2);
-	int h = Math::toNextPower(surface->h, 2);
+	int w = 1;
+	int h = 1;
+	
+	while (w < surface->w) w <<= 1;
+	while (h < surface->h) h <<= 1;
 	
 	SDL_Surface *tmp = createSurface(w, h);
 	
--- blobAndConquer-0.90/src/system/CMath.h~	2007-05-22 17:34:07.000000000 +0200
+++ blobAndConquer-0.90/src/system/CMath.h	2007-05-22 17:34:07.000000000 +0200
@@ -41,6 +41,5 @@
 	
 	static float getDistance(float x1, float y1, float x2, float y2);
 	static float getDistance(Vector v1, Vector v2);
-	static int toNextPower(int val, int power);
 	
 };
--- blobAndConquer-0.90/src/system/CMath.cpp~	2007-05-22 17:34:02.000000000 +0200
+++ blobAndConquer-0.90/src/system/CMath.cpp	2007-05-22 17:34:02.000000000 +0200
@@ -178,10 +178,3 @@
 	
 	return (rtn == 0) ? 0 : sqrt(rtn);
 }
-
-int Math::toNextPower(int val, int power)
-{
-	double logbase2 = (log(val) / log(power));
-	
-	return (int)(pow(power, ceil(logbase2)) + 0.5);
-}

blobAndConquer-0.90-ppc.patch:

--- NEW FILE blobAndConquer-0.90-ppc.patch ---
--- blobAndConquer-0.90/src/world/bsp.cpp~	2007-05-26 11:38:25.000000000 +0200
+++ blobAndConquer-0.90/src/world/bsp.cpp	2007-05-26 11:38:25.000000000 +0200
@@ -22,6 +22,8 @@
 
 #define TESSELATION 10
 
+float swapBytes(float f);
+
 TextureSpec *getTextureSpec(char *basename)
 {
 	// ignore this texture

blobAndConquer-0.90-strict-alias.patch:

--- NEW FILE blobAndConquer-0.90-strict-alias.patch ---
diff -ur blobAndConquer-0.90/src/3d/CPlane.cpp blobAndConquer-0.90.new/src/3d/CPlane.cpp
--- blobAndConquer-0.90/src/3d/CPlane.cpp	2006-12-05 21:40:52.000000000 +0100
+++ blobAndConquer-0.90.new/src/3d/CPlane.cpp	2007-05-22 19:09:18.000000000 +0200
@@ -49,12 +49,16 @@
 
 float Plane::invSqrt(float x) /* Fast Invert Square Root */
 {
+   union {
+      float f;
+      int i;
+   } u;
+      
    float xhalf = 0.5f * x;
 
-   int i = *(int*)&x;
-
-   i = 0x5f3759df - (i >> 1);
-   x = * (float *)&i;
+   u.f = x;
+   u.i = 0x5f3759df - (u.i >> 1);
+   x = u.f;
    x = x * (1.5f - xhalf * x * x);
 
    return x;
diff -ur blobAndConquer-0.90/src/3d/CVector.cpp blobAndConquer-0.90.new/src/3d/CVector.cpp
--- blobAndConquer-0.90/src/3d/CVector.cpp	2006-12-01 22:19:31.000000000 +0100
+++ blobAndConquer-0.90.new/src/3d/CVector.cpp	2007-05-22 19:09:20.000000000 +0200
@@ -137,12 +137,16 @@
 
 float Vector::invSqrt(float x) /* Fast Invert Square Root */
 {
+   union {
+      float f;
+      int i;
+   } u;
+      
    float xhalf = 0.5f * x;
 
-   int i = *(int*)&x;
-
-   i = 0x5f3759df - (i >> 1);
-   x = * (float *)&i;
+   u.f = x;
+   u.i = 0x5f3759df - (u.i >> 1);
+   x = u.f;
    x = x * (1.5f - xhalf * x * x);
 
    return x;
diff -ur blobAndConquer-0.90/src/3d/CVectori.cpp blobAndConquer-0.90.new/src/3d/CVectori.cpp
--- blobAndConquer-0.90/src/3d/CVectori.cpp	2006-12-10 11:07:28.000000000 +0100
+++ blobAndConquer-0.90.new/src/3d/CVectori.cpp	2007-05-22 19:09:20.000000000 +0200
@@ -116,12 +116,16 @@
 
 float Vectori::invSqrt(float x) /* Fast Invert Square Root */
 {
+   union {
+      float f;
+      int i;
+   } u;
+      
    float xhalf = 0.5f * x;
 
-   int i = *(int*)&x;
-
-   i = 0x5f3759df - (i >> 1);
-   x = * (float *)&i;
+   u.f = x;
+   u.i = 0x5f3759df - (u.i >> 1);
+   x = u.f;
    x = x * (1.5f - xhalf * x * x);
 
    return x;

blobAndConquer-0.90-unix-lf.patch:

--- NEW FILE blobAndConquer-0.90-unix-lf.patch ---
--- blobAndConquer-0.90/src/system/CEngine.cpp~	2007-05-23 22:41:48.000000000 +0200
+++ blobAndConquer-0.90/src/system/CEngine.cpp	2007-05-23 22:41:48.000000000 +0200
@@ -466,7 +466,7 @@
 			continue;
 		}
 		
-		if (strlen(token) < 10)
+		if (strlen(token) < 9)
 		{
 			token = strtok(NULL, "\n");
 			continue;


--- NEW FILE blobAndConquer.spec ---
# Upstream's primary form of distribution is deb/rpm packages, not sources
# so the have a version-release versioning scheme themselves. Since they
# almost always only do one release per version, we just ignore the -release
# part of the version for our versioning, but we still need to know their
# release in a couple of places
%define upstream_release 1

Name:           blobAndConquer
Version:        0.90
Release:        2%{?dist}
Summary:        Blob Wars 2: Blob And Conquer
Group:          Amusements/Games
License:        GPL
URL:            http://www.parallelrealities.co.uk/blobAndConquer.php
# Non rpm compatible URL: http://www.parallelrealities.co.uk/download.php?file=blobAndConquer-%{version}-%{upstream_release}.tar.gz&type=zip
Source0:        %{name}-%{version}-%{upstream_release}.tar.gz
Patch0:         blobAndConquer-0.90-no-stencil.patch
Patch1:         blobAndConquer-0.90-opt-fix.patch
Patch2:         blobAndConquer-0.90-strict-alias.patch
Patch3:         blobAndConquer-0.90-unix-lf.patch
Patch4:         blobAndConquer-0.90-exit-crash.patch
Patch5:         blobAndConquer-0.90-ppc.patch
BuildRoot:      %(mktemp -ud %{_tmppath}/%{name}-%{version}-%{release}-XXXXXX)
BuildRequires:  SDL_image-devel SDL_mixer-devel SDL_ttf-devel zlib-devel
BuildRequires:  desktop-file-utils
Requires:       hicolor-icon-theme

%description
With the apparent defeat of Galdov and the reclaiming of the Fire, Time, Space
and Reality Crystals the Blobs' battle was only just beginning. Bob had rescued
many Blobs and fought many battles, but now he had an ever bigger task ahead of
him. The Blobs' homeworld is still littered with the alien forces and Bob once
again makes it his task to lead the counter attack. But even without Galdov the
aliens are still extremely well organised...

They're Ready. Will You Be?


%prep
%setup -q
%patch0 -p1 -z .stencil
%patch1 -p1 -z .opt
%patch2 -p1 -z .strict-alias
%patch3 -p1 -z .unix-lf
%patch4 -p1 -z .exit
%patch5 -p1 -z .ppc
# some cleanup
chmod -x gfx/rw2/*.raw data/gameDefs/defines.h `find src -type f`
sed -i 's/\r//g' data/gameDefs/defines.h `find src -type f`


%build
# the long CXXFLAGS isn't pretty, but it really is the easiest way
make CXXFLAGS='%{optflags} `sdl-config --cflags` -DVERSION=%{version} \
  -DRELEASE=%{upstream_release} -DUSEPAK=0 -DDEV=0 -DPAKNAME=\"%{name}.pak\" \
  -DPAKLOCATION=\"%{_datadir}/%{name}\" -DLOCALEDIR=\"%{_datadir}/locale\" \
  -DGAMEPLAYMANUAL=\"%{_docdir}/%{name}-%{version}/index.html\"'


%install
rm -rf $RPM_BUILD_ROOT
mkdir -p $RPM_BUILD_ROOT%{_datadir}/applications
mkdir -p $RPM_BUILD_ROOT%{_datadir}/icons/hicolor/48x48/apps
make install DESTDIR=$RPM_BUILD_ROOT BINDIR=$RPM_BUILD_ROOT%{_bindir} \
  DATADIR=$RPM_BUILD_ROOT%{_datadir}/%{name} \
  ICONDIR=$RPM_BUILD_ROOT%{_datadir}/icons/hicolor/48x48/apps
mv $RPM_BUILD_ROOT%{_docdir}/%{name}/doc installed-docs

desktop-file-install --vendor fedora --delete-original \
  --dir $RPM_BUILD_ROOT%{_datadir}/applications \
  $RPM_BUILD_ROOT%{_datadir}/applications/%{name}.desktop


%clean
rm -rf $RPM_BUILD_ROOT


%post
touch --no-create %{_datadir}/icons/hicolor || :
%{_bindir}/gtk-update-icon-cache --quiet %{_datadir}/icons/hicolor || :

%postun
touch --no-create %{_datadir}/icons/hicolor || :
%{_bindir}/gtk-update-icon-cache --quiet %{_datadir}/icons/hicolor || :


%files
%defattr(-,root,root,-)
%doc installed-docs/*
%{_bindir}/%{name}
# the data/gameDefs/defines.h file is needed runtime and thus not a devel file!
%{_datadir}/%{name}
%{_datadir}/applications/fedora-%{name}.desktop
%{_datadir}/icons/hicolor/48x48/apps/%{name}.png


%changelog
* Thu May 24 2007 Hans de Goede <j.w.r.degoede at hhs.nl> 0.90-2
- Add missing desktop-file-utils BuildRequire

* Fri May 18 2007 Hans de Goede <j.w.r.degoede at hhs.nl> 0.90-1
- Initial Fedora package


Index: .cvsignore
===================================================================
RCS file: /cvs/extras/rpms/blobAndConquer/FC-6/.cvsignore,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- .cvsignore	25 May 2007 20:23:33 -0000	1.1
+++ .cvsignore	26 May 2007 10:40:17 -0000	1.2
@@ -0,0 +1 @@
+blobAndConquer-0.90-1.tar.gz


Index: sources
===================================================================
RCS file: /cvs/extras/rpms/blobAndConquer/FC-6/sources,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- sources	25 May 2007 20:23:33 -0000	1.1
+++ sources	26 May 2007 10:40:17 -0000	1.2
@@ -0,0 +1 @@
+1be4fe4b85ce27868d616c6c10967334  blobAndConquer-0.90-1.tar.gz




More information about the fedora-extras-commits mailing list