rpms/machineball/devel machineball-config-only-once.patch, NONE, 1.1 machineball-fixes.patch, NONE, 1.1 machineball.desktop, NONE, 1.1 machineball.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 12 08:27:48 UTC 2007


Author: jwrdegoede

Update of /cvs/extras/rpms/machineball/devel
In directory cvs-int.fedora.redhat.com:/tmp/cvs-serv22364/devel

Modified Files:
	.cvsignore sources 
Added Files:
	machineball-config-only-once.patch machineball-fixes.patch 
	machineball.desktop machineball.spec 
Log Message:
initial machineball import


machineball-config-only-once.patch:

--- NEW FILE machineball-config-only-once.patch ---
--- machineball-src/window.h~	2007-04-30 20:18:54.000000000 +0200
+++ machineball-src/window.h	2007-04-30 20:18:54.000000000 +0200
@@ -10,6 +10,6 @@
 #ifndef _WINDOW_H_
 #define _WINDOW_H_
 
-void createWindow(int force);
+void createWindow(int force, int do_configure);
 
 #endif
--- machineball-src/window.cpp~	2007-04-30 20:29:41.000000000 +0200
+++ machineball-src/window.cpp	2007-04-30 20:29:41.000000000 +0200
@@ -92,7 +92,7 @@
 }
 
 
-static int setup (void)
+static int setup (int do_configure)
 {
 #define RESOLUTION_LIST   4
 #define COLOUR_LIST       6
@@ -117,71 +117,35 @@
 
 	int x;
 
-	set_dialog_color (dlg, makecol(255, 255, 255), makecol(32, 32, 64));
+	if (do_configure)
+	{
+		set_dialog_color (dlg, makecol(255, 255, 255), makecol(32, 32, 64));
+			
+		x = do_dialog (dlg, 9);
 		
-	x = do_dialog (dlg, 9);
+		options.resolution = dlg[RESOLUTION_LIST].d1;
+		options.colordepth = dlg[COLOUR_LIST].d1;
+		options.zdepth = dlg[ZBUFFER_LIST].d1;
+	}
+	else
+		x = BUTTON_OK;
 	
 	allegro_gl_clear_settings();
-	allegro_gl_set (AGL_COLOR_DEPTH, colour_depths[dlg[COLOUR_LIST].d1].depth);
-	allegro_gl_set (AGL_Z_DEPTH, zbuffer_depths[dlg[ZBUFFER_LIST].d1].depth);
+	allegro_gl_set (AGL_COLOR_DEPTH, colour_depths[options.colordepth].depth);
+	allegro_gl_set (AGL_Z_DEPTH, zbuffer_depths[options.zdepth].depth);
 	allegro_gl_set (AGL_DOUBLEBUFFER, TRUE);
 	allegro_gl_set (AGL_RENDERMETHOD, 1);
 	allegro_gl_set(AGL_FULLSCREEN, TRUE);
 	allegro_gl_set(AGL_REQUIRE, AGL_RENDERMETHOD);
 	allegro_gl_set (AGL_SUGGEST, AGL_COLOR_DEPTH | AGL_Z_DEPTH | AGL_DOUBLEBUFFER | AGL_RENDERMETHOD | AGL_FULLSCREEN);
-	width  = resolutions[dlg[RESOLUTION_LIST].d1].w;
-	height = resolutions[dlg[RESOLUTION_LIST].d1].h;
-
-	if(width==320 && height==200)
-		options.resolution=0;
-	if(width==320 && height==240)
-		options.resolution=1;
-	if(width==400 && height==300)
-		options.resolution=2;
-	if(width==512 && height==384)
-		options.resolution=3;
-	if(width==640 && height==400)
-		options.resolution=4;
-	if(width==640 && height==480)
-		options.resolution=5;
-	if(width==800 && height==600)
-		options.resolution=6;
-	if(width==1024 && height==768)
-		options.resolution=7;
-	if(width==1152 && height==864)
-		options.resolution=8;
-	if(width==1280 && height==960)
-		options.resolution=9;
-	if(width==1280 && height==1024)
-		options.resolution=10;
-	if(width==1600 && height==1200)
-		options.resolution=11;
-	if(width==1920 && height==1440)
-		options.resolution=12;
-
-	if(colour_depths[dlg[COLOUR_LIST].d1].depth==15)
-		options.colordepth=0;
-	if(colour_depths[dlg[COLOUR_LIST].d1].depth==16)
-		options.colordepth=1;
-	if(colour_depths[dlg[COLOUR_LIST].d1].depth==24)
-		options.colordepth=2;
-	if(colour_depths[dlg[COLOUR_LIST].d1].depth==32)
-		options.colordepth=3;
-
-	if(zbuffer_depths[dlg[ZBUFFER_LIST].d1].depth==8)
-		options.zdepth=0;
-	if(zbuffer_depths[dlg[ZBUFFER_LIST].d1].depth==16)
-		options.zdepth=1;
-	if(zbuffer_depths[dlg[ZBUFFER_LIST].d1].depth==24)
-		options.zdepth=2;
-	if(zbuffer_depths[dlg[ZBUFFER_LIST].d1].depth==32)
-		options.zdepth=3;
+	width  = resolutions[options.resolution].w;
+	height = resolutions[options.resolution].h;
 	
 	return (x == BUTTON_OK);
 }
 
 
-void createWindow(int force)
+void createWindow(int force, int do_configure)
 {
 	// Load configuration from disk
 	// ...
@@ -158,7 +158,8 @@
 	atexit(&dumb_exit);
 
 	dumb_register_stdfiles();
-	
+
+if (do_configure) {	
 	set_color_depth(16);
 	if(set_gfx_mode(GFX_AUTODETECT_WINDOWED, 600, 400, 0, 0) < 0)
 	{
@@ -181,7 +182,7 @@
 
 	MoveWindow(wnd, (dw-w)/2, (dh-h)/2, w, h, TRUE); 
 #endif
-
+}
 
 	install_keyboard();
 	install_mouse();
@@ -198,6 +199,7 @@
 	}
 	set_volume(options.soundvol, -1);
 
+if (do_configure) {
 	acquire_screen();
 	
 	rectfill(screen, 0, 0, 599, 399, makecol(64, 64, 128));
@@ -215,10 +217,11 @@
 				putpixel(screen, x, y, makecol(0, 0, y*192/400));
 
 	release_screen();
+}
 	
 	install_allegro_gl();
 
-	int ok = setup();
+	int ok = setup(do_configure);
 	if(!ok)
 		exit(0);
 	
--- machineball-src/main.cpp~	2007-04-30 20:21:05.000000000 +0200
+++ machineball-src/main.cpp	2007-04-30 20:21:05.000000000 +0200
@@ -35,6 +35,7 @@
 	// Parse command line args:
 	int i;
 	int forc=1;
+	int do_configure=0;
 
 	char rcfile[1024];
 #ifndef ALLEGRO_WINDOWS
@@ -105,9 +106,9 @@
 
 	FILE *fp = fopen(rcfile, "r");
 	if(fp==NULL)
-		printf("=== Cannot Open %s for reading. Using default Configuration ===\n", rcfile);
-	if(fp==NULL)
 	{
+		printf("=== Cannot Open %s for reading. Using default Configuration ===\n", rcfile);
+		do_configure=1;
 		// Default values:
 		options.resolution=6;
 		options.colordepth=1;
@@ -197,7 +198,7 @@
 	}
 
 	srand(time(0));
-	createWindow(forc); // The argument tells us if we want sound or not
+	createWindow(forc, do_configure); // The 1st argument tells us if we want sound or not
 	
 	loadProgramData();
 	dumb_resampling_quality=2;

machineball-fixes.patch:

--- NEW FILE machineball-fixes.patch ---
--- machineball-src/Makefile~	2007-04-30 17:24:11.000000000 +0200
+++ machineball-src/Makefile	2007-04-30 17:24:11.000000000 +0200
@@ -39,10 +39,10 @@
 
 options.o : options.cpp
 
-mbdata.o : mbdata.s
+mbdata.o : mbdata.c
 
-mbdata.s : mbdata.dat
-	dat2s mbdata.dat -o mbdata.s -h mbdata.h -p mb
+mbdata.c : mbdata.dat
+	dat2c mbdata.dat -o mbdata.c -h mbdata.h -p mb -g
 
 clean :
 	rm machineball main.o window.o intro.o menu.o game.o text.o timer.o controls.o ball.o glode.o camera.o render.o court.o machine.o powerup.o explosion.o models.o options.o mbdata.o
--- machineball-src/main.cpp	2002-12-21 14:31:40.000000000 +0100
+++ machineball-src.new/main.cpp	2007-04-30 20:05:07.000000000 +0200
@@ -290,13 +290,11 @@
 	text.init();
 
 
-	allegro_gl_set_texture_format(GL_ALPHA4);
-	shadowtex = allegro_gl_make_texture(&mb_shadow);
+	shadowtex = allegro_gl_make_texture_ex(AGL_TEXTURE_RESCALE|AGL_TEXTURE_FLIP, &mb_shadow, GL_ALPHA4);
 	glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
 	glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
 
-	allegro_gl_set_texture_format(GL_ALPHA4);
-	poweruptex = allegro_gl_make_texture(&mb_powerup);
+	poweruptex = allegro_gl_make_texture_ex(AGL_TEXTURE_RESCALE|AGL_TEXTURE_FLIP, &mb_powerup, GL_ALPHA4);
 	glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
 	glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
 
@@ -332,8 +330,7 @@
 	glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
 	glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
 
-	allegro_gl_set_texture_format(GL_ALPHA4);
-	bennykramekwebtex = allegro_gl_make_texture(&mb_bennykramekweb);
+	bennykramekwebtex = allegro_gl_make_texture_ex(AGL_TEXTURE_RESCALE|AGL_TEXTURE_FLIP, &mb_bennykramekweb, GL_ALPHA4);
 	glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
 	glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
 
--- machineball-src/text.cpp	2002-12-21 14:31:40.000000000 +0100
+++ machineball-src.new/text.cpp	2007-04-30 20:02:43.000000000 +0200
@@ -65,8 +67,7 @@
 
 
 	// Create the OpenGL texture from the BITMAP
-	allegro_gl_set_texture_format(GL_INTENSITY4);
-	texture = allegro_gl_make_texture(bmp);
+	texture = allegro_gl_make_texture_ex(AGL_TEXTURE_RESCALE|AGL_TEXTURE_FLIP, bmp, GL_INTENSITY4);
 	glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
 	glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
 
--- machineball-src/game.cpp~	2007-05-01 16:04:31.000000000 +0200
+++ machineball-src/game.cpp	2007-05-01 16:04:31.000000000 +0200
@@ -178,9 +178,12 @@
 	int esckeydown=0;
 	while(!((gameover && key[KEY_ESC]) || (gamepaused && key[KEY_F11])))
 	{
-		rest(1);
-		m=timer.seconds();
-		timer.reset();
+		/* m may never be 0, otherwise an assert in ODE will get
+		   triggered */
+		do {
+			rest(1);
+			m=timer.getsecondsandreset();
+		} while (m <= 0);
 
 		poll_joystick();
 		al_poll_duh(dp);
--- machineball-src/timer.h~	2007-05-01 16:02:19.000000000 +0200
+++ machineball-src/timer.h	2007-05-01 16:02:19.000000000 +0200
@@ -23,6 +23,17 @@
   void install(double tps=596590.5) { install_int_ex(tickf, (long int)((double)1193181.0/tps)); ticks_per_sec=tps; ticks=0; }
   double seconds(void) { return (double)ticks/ticks_per_sec; }
   void reset(void) { ticks=0; }
+  /* race proof code to get the seconds and then reset the ticks, without
+     missing any ticks */
+  double getsecondsandreset(void) {
+    unsigned long ticks_counter = 0;
+    while (ticks) {
+      ticks--;
+      ticks_counter++;
+    }
+    return (double)ticks_counter/ticks_per_sec;
+  }
+  
 };
 
 extern Timer timer;


--- NEW FILE machineball.desktop ---
[Desktop Entry]
Version=1.0
Encoding=UTF-8
Name=machineball
Comment=A futuristic ball game with simple rules
Exec=machineball
StartupNotify=false
Terminal=false
Type=Application
Icon=machineball.xpm
Categories=Game;ActionGame;SportsGame;



--- NEW FILE machineball.spec ---
Name:           machineball
Version:        1.0
Release:        2%{?dist}
Summary:        A futuristic ball game with simple rules
Group:          Amusements/Games
License:        GPL
URL:            http://benny.kramekweb.com/machineball/
Source0:        http://benny.kramekweb.com/%{name}/%{name}-src-%{version}-1.tar.gz
Source1:        machineball.desktop
Patch0:         machineball-fixes.patch
Patch1:         machineball-config-only-once.patch
BuildRoot:      %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
BuildRequires:  alleggl-devel libGLU-devel ode-devel dumb-devel allegro-tools
BuildRequires:  desktop-file-utils
Requires:       hicolor-icon-theme

%description
Machine Ball is a futuristic sport with amazing 3D graphics and realistic
physics with very simple rules: Get the ball into your opponents goal. You can
use your machine to push the ball in, or you can collect powerups such as
missiles and blast the ball into the goal. Be creative.


%prep
%setup -q -n %{name}-src
%patch0 -p1 -z .fixes
%patch1 -p1 -z .cfg-only-once


%build
make %{?_smp_mflags} CFLAGS="$RPM_OPT_FLAGS" CXXFLAGS="$RPM_OPT_FLAGS"


%install
rm -rf $RPM_BUILD_ROOT
mkdir -p $RPM_BUILD_ROOT/usr/bin
install -m 755 %{name} $RPM_BUILD_ROOT/usr/bin

# below is the desktop file and icon stuff.
mkdir -p $RPM_BUILD_ROOT%{_datadir}/applications
desktop-file-install --vendor fedora            \
  --dir $RPM_BUILD_ROOT%{_datadir}/applications \
  %{SOURCE1}

for i in "16x16" "24x24" "32x32" "48x48" "64x64"; do
  mkdir -p $RPM_BUILD_ROOT%{_datadir}/icons/hicolor/$i/apps
  install -p -m 644 %{name}-icon-$i.xpm \
    $RPM_BUILD_ROOT%{_datadir}/icons/hicolor/$i/apps/%{name}.xpm
done


%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 COPYING README
%{_bindir}/%{name}
%{_datadir}/applications/fedora-%{name}.desktop
%{_datadir}/icons/hicolor/*/apps/%{name}.xpm


%changelog
* Thu May 10 2007 Hans de Goede <j.w.r.degoede at hhs.nl> 1.0-2
- Add missing BuildRequires
- Fix Source0 url, and fix version to match

* Tue Apr  2 2007 Hans de Goede <j.w.r.degoede at hhs.nl> 1.0-1
- Initial Fedora Extras package, based on a package by Mikhail S. Kalenkov.


Index: .cvsignore
===================================================================
RCS file: /cvs/extras/rpms/machineball/devel/.cvsignore,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- .cvsignore	11 May 2007 21:15:43 -0000	1.1
+++ .cvsignore	12 May 2007 08:27:14 -0000	1.2
@@ -0,0 +1 @@
+machineball-src-1.0-1.tar.gz


Index: sources
===================================================================
RCS file: /cvs/extras/rpms/machineball/devel/sources,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- sources	11 May 2007 21:15:43 -0000	1.1
+++ sources	12 May 2007 08:27:14 -0000	1.2
@@ -0,0 +1 @@
+034eb4310bec9c4694f925a69a3ee0e0  machineball-src-1.0-1.tar.gz




More information about the fedora-extras-commits mailing list