rpms/shippy/devel shippy-fixes.patch, NONE, 1.1 shippy-fullscreen.patch, NONE, 1.1 shippy-joy.patch, NONE, 1.1 shippy-lcdfix.patch, NONE, 1.1 shippy-warnings.patch, NONE, 1.1 shippy.desktop, NONE, 1.1 shippy.png, NONE, 1.1 shippy.sh, NONE, 1.1 shippy.spec, NONE, 1.1 .cvsignore, 1.1, 1.2 sources, 1.1, 1.2

Hans de Goede (jwrdegoede) fedora-extras-commits at redhat.com
Fri Mar 31 08:18:18 UTC 2006


Author: jwrdegoede

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

Modified Files:
	.cvsignore sources 
Added Files:
	shippy-fixes.patch shippy-fullscreen.patch shippy-joy.patch 
	shippy-lcdfix.patch shippy-warnings.patch shippy.desktop 
	shippy.png shippy.sh shippy.spec 
Log Message:
auto-import shippy-1.3.3.7-2 on branch devel from shippy-1.3.3.7-2.src.rpm

shippy-fixes.patch:

--- NEW FILE shippy-fixes.patch ---
--- shippy-1.3.3.7/shippy.c.fix	2004-03-08 06:41:30.000000000 +0100
+++ shippy-1.3.3.7/shippy.c	2006-03-27 19:52:23.000000000 +0200
@@ -4,6 +4,9 @@
 http://ship84.sourceforge.net
 */
 
+/* this must be done before the first include of unistd.h for setresgid */
+#define _GNU_SOURCE 
+#include <unistd.h>
 #include <stdio.h>
 #include "shippy.h"
 
@@ -98,6 +101,8 @@
 int missedshots = 0;
 int firedshots = 0;
 
+FILE *highscore_fp;
+
 int compare(const void *a, const void *b)
 {
     struct HISCORE *test = (struct HISCORE *)a;
@@ -656,7 +661,7 @@
                                     if(shots<10)
                                     {
                                         AddObject(BULLET, ShippyObjects[number].x, ShippyObjects[number].y,0,0,0,NULL,0,0);
-                                        audio_play("data/shot.wav");
+                                        audio_play(DATADIR "shot.wav");
                                         ++shots;
                                         ++firedshots;
                                     }
@@ -670,7 +675,7 @@
                                 {
                                     if(shots<6)
                                     {
-                                        audio_play("data/helix.wav");
+                                        audio_play(DATADIR "helix.wav");
                                         AddObject(BULLWAVE, ShippyObjects[number].x-6, ShippyObjects[number].y-8,0,-16,0,NULL,0,0);
                                         AddObject(BULLWAVE, ShippyObjects[number].x+6, ShippyObjects[number].y-8,0,16,0,NULL,0,0);
                                         shots+=2;
@@ -693,7 +698,7 @@
                             if(shots<3)
                             {
                                 AddObject(BULLET, ShippyObjects[number].x, ShippyObjects[number].y,0,0,0,NULL,0,0);
-                                audio_play("data/shot.wav");
+                                audio_play(DATADIR "shot.wav");
                                 ++shots;
                                 ++firedshots;
                             }
@@ -837,7 +842,7 @@
                         }
                         diedlast = 1;
                     
-                        audio_play("data/die.wav");
+                        audio_play(DATADIR "die.wav");
                         ShippyObjects[number].type=EXPLOSION;
                         ShippyObjects[number].special=4;
                     }
@@ -937,7 +942,7 @@
                                                  0);
                                          
                                      }
-                                    audio_play("data/hit.wav");
+                                    audio_play(DATADIR "hit.wav");
                                 break;
 
                                 case ENEMYSHIPPY:
@@ -955,7 +960,7 @@
                                                  0,
                                                  0);
                                      }
-                                    audio_play("data/hit.wav");
+                                    audio_play(DATADIR "hit.wav");
                                      break;
 
 				 case FEZBOMB:
@@ -976,7 +981,7 @@
                                                  0,
                                                  0);
                                      }
-                                    audio_play("data/hit.wav");
+                                    audio_play(DATADIR "hit.wav");
                                     break;
                             
                             }
@@ -1059,7 +1064,7 @@
                         }
 
                         diedlast = 1;                    
-                        audio_play("data/die.wav");
+                        audio_play(DATADIR "die.wav");
                         ShippyObjects[number].type=EXPLOSION;
                         ShippyObjects[number].special=4;
                         return;
@@ -1097,43 +1102,26 @@
 
 void StoreHS()
 {
-    FILE *savehs = NULL;
-    savehs = fopen("data/scores.lst","wb");
-
-    if(savehs==NULL) return;
-
-    fwrite(winners,sizeof(struct HISCORE), 14, savehs);
-    fclose(savehs);
-    return;
-
+    if(highscore_fp==NULL) return;
 
+    rewind(highscore_fp);
+    fwrite(winners,sizeof(struct HISCORE), 14, highscore_fp);
 }
 
 
 void RestoreHS()
 {
     int i;    
-    FILE *loadhs = NULL;
-    
-    loadhs = fopen("data/scores.lst","rb");
 
-    if(loadhs!=NULL)
+    if(highscore_fp!=NULL)
     {
-        if(fread(winners,sizeof(struct HISCORE), 14, loadhs)==14)
+        if(fread(winners,sizeof(struct HISCORE), 14, highscore_fp)==14)
         {
-            fclose(loadhs);
             highscore=winners[0].score;
             return;
         }
-        else
-        {
-            fclose(loadhs);
-        }
-    
-    
     }
 
-
     strcpy(winners[0].name,"RAB");
     winners[0].level = 14;
     winners[0].score = 250000;
@@ -1225,17 +1213,17 @@
 
             if(operational==600)
             {
-                SYSTEM_BG("data/splash.bmp");
+                SYSTEM_BG(DATADIR "splash.bmp");
             }
             
             if(operational>0)
             {
                 --operational;
-                if(operational==0) audio_play("data/splash.wav");
+                if(operational==0) audio_play(DATADIR "splash.wav");
             }
             if(operational==120)
             {
-                SYSTEM_BG("data/splash2.bmp");
+                SYSTEM_BG(DATADIR "splash2.bmp");
             }
             if(waitforkey==0)
             {
@@ -1339,7 +1327,7 @@
         {
             ShippyObjects[0].lives++;
             extralife *= 2;
-            audio_play("data/fanfare.wav");
+            audio_play(DATADIR "fanfare.wav");
         
         }
         if(leftmonsters>0 && done == 0 && gameover==0)
@@ -1388,7 +1376,7 @@
 		}
 		for(increment=0;increment<14;++increment) winners[increment].last=0;
                 gamestate = INITIALS;
-                audio_music("data/score.xm");
+                audio_music(DATADIR "score.xm");
                 waitforkey=30;
                 operational = 0;
             }
@@ -1401,7 +1389,7 @@
             {
                 NewGame(-1);
                 operational = 1;
-                if(gamestate==TITLE) audio_music("data/title.xm");
+                if(gamestate==TITLE) audio_music(DATADIR "title.xm");
             }
             
             if(done==0 && operational==1)
@@ -1429,7 +1417,7 @@
                     else
                     {
     
-                        audio_music("data/shippy.xm");
+                        audio_music(DATADIR "shippy.xm");
                         gamestate = GAME;
                         operational = 0;
                     }
@@ -1467,7 +1455,7 @@
         {
             ShippyObjects[0].lives++;
             extralife *= 2;
-            audio_play("data/fanfare.wav");
+            audio_play(DATADIR "fanfare.wav");
         
         }
 
@@ -1513,6 +1501,16 @@
 void SHIPPY_MAIN()
 {
     int increment;
+    gid_t realgid;
+    
+    highscore_fp = fopen("/var/lib/games/shippy.hs", "r+");
+    
+    realgid = getgid();
+    if (setresgid(-1, realgid, realgid) != 0) {
+        perror("Could not drop setgid privileges.  Aborting.");
+        exit(1);
+    }
+        
     srand(time(0));
     if(SYSTEM_INIT()!=0) return;
     InitShippy();
--- shippy-1.3.3.7/shippy.h.fix	2004-02-03 21:10:00.000000000 +0100
+++ shippy-1.3.3.7/shippy.h	2006-03-27 19:51:06.000000000 +0200
@@ -3,6 +3,10 @@
 
 #include "externs.h"
 
+#ifndef DATADIR
+#define DATADIR "data/"
+#endif
+
 void Start_Audio();
 void audio_start();
 void audio_play(char *wav);
--- shippy-1.3.3.7/shipall.c.fix	2004-03-04 00:52:10.000000000 +0100
+++ shippy-1.3.3.7/shipall.c	2006-03-27 19:51:06.000000000 +0200
@@ -199,7 +199,7 @@
     BackBuffer=create_system_bitmap(240,160);
     Graphics=create_system_bitmap(320,128);
 
-    mytest2 = load_bmp("data/graphics.bmp",mypal);
+    mytest2 = load_bmp(DATADIR "graphics.bmp",mypal);
     if(mytest2==NULL) return;
 	blit(mytest2,Graphics,0,0,0,0,320,128);
 	destroy_bitmap(mytest2);
--- shippy-1.3.3.7/shipsdl.c.fix	2004-03-04 00:53:02.000000000 +0100
+++ shippy-1.3.3.7/shipsdl.c	2006-03-27 19:51:06.000000000 +0200
@@ -164,9 +164,9 @@
     
 void End_Audio()
 {
+    audio_end();
     Mix_HaltMusic();
     Mix_CloseAudio();
-    audio_end();
 }
 
     
@@ -194,8 +194,8 @@
 
     SYSTEM_CLEANBMP();
 
-    Graphics = CreateSurfaceFromBitmap("data/graphics.bmp",SDL_SWSURFACE|SDL_SRCCOLORKEY);
-    BackBuffer= CreateSurfaceFromBitmap("data/splash.bmp",SDL_SWSURFACE|SDL_SRCCOLORKEY);
+    Graphics = CreateSurfaceFromBitmap(DATADIR "graphics.bmp",SDL_SWSURFACE|SDL_SRCCOLORKEY);
+    BackBuffer= CreateSurfaceFromBitmap(DATADIR "splash.bmp",SDL_SWSURFACE|SDL_SRCCOLORKEY);
     SDL_SetColors(screen, Graphics->format->palette->colors, 0,Graphics->format->palette->ncolors);
     SDL_SetColorKey(Graphics,SDL_SRCCOLORKEY, SDL_MapRGB(Graphics->format, 255, 0, 255));
     SDL_SetColorKey(BackBuffer,SDL_SRCCOLORKEY, SDL_MapRGB(Graphics->format, 255, 0, 255));
@@ -356,6 +356,10 @@
 void SYSTEM_IDLE()
 {
     Uint32 test = SDL_GetTicks();
+
+    if (test < timing)
+        usleep(1000);
+
     while(test>timing)
     {
         timing+=14;

shippy-fullscreen.patch:

--- NEW FILE shippy-fullscreen.patch ---
diff -ur shippy-1.3.3.7.orig/shipall.c shippy-1.3.3.7/shipall.c
--- shippy-1.3.3.7.orig/shipall.c	2006-03-27 23:12:03.000000000 +0200
+++ shippy-1.3.3.7/shipall.c	2006-03-27 22:55:33.000000000 +0200
@@ -10,6 +10,11 @@
 
 volatile int objectsynch = 0;
 
+#ifndef ALLEGRO_DOS
+static int vidmode;
+#endif
+static RGB mypal[256];    
+
 DUH *music=NULL;
 AL_DUH_PLAYER *dp=NULL;
 
@@ -172,7 +177,6 @@
 {
     int GraphicsFlag;
     BITMAP *mytest2;
-    RGB mypal[256];    
     set_color_depth(8);
     bitsperpixel = 8;
 	set_color_conversion(COLORCONV_TOTAL);
@@ -189,12 +193,15 @@
 	
 
 #else
-    GraphicsFlag=set_gfx_mode(GFX_AUTODETECT_WINDOWED, 480, 320, 0, 0);    
+    GraphicsFlag=set_gfx_mode(GFX_AUTODETECT_FULLSCREEN, 480, 320, 0, 0);    
     if(GraphicsFlag!=0)
     {
         GraphicsFlag=set_gfx_mode(GFX_SAFE, 480, 320, 0, 0);
         if(GraphicsFlag!=0) exit(-1);
+        else vidmode = GFX_SAFE;
     }
+    else
+        vidmode = GFX_AUTODETECT_FULLSCREEN;
 #endif
 
     BackBuffer=create_system_bitmap(240,160);
@@ -306,6 +313,25 @@
 
 
     if(SYSTEM_GETKEY(KEY_ESC)) done = 1;
+
+#ifndef ALLEGRO_DOS
+    if (key[KEY_ENTER] && key[KEY_ALT] && (vidmode != GFX_SAFE))
+    {
+        vidmode = (vidmode == GFX_AUTODETECT_FULLSCREEN)?
+            GFX_AUTODETECT_WINDOWED:GFX_AUTODETECT_FULLSCREEN;
+        if(set_gfx_mode(vidmode, 480, 320, 0, 0))
+        {
+            vidmode = GFX_SAFE;
+            if(set_gfx_mode(vidmode, 480, 320, 0, 0))
+            {
+                fprintf(stderr, "FATAL error switching Fullscreen <-> Window\n");
+	        exit(1);
+	    }
+	}
+        set_palette(mypal);
+    }
+#endif
+
     if(waitforkey>0)
     {
         --waitforkey;
diff -ur shippy-1.3.3.7.orig/shipsdl.c shippy-1.3.3.7/shipsdl.c
--- shippy-1.3.3.7.orig/shipsdl.c	2006-03-27 23:12:03.000000000 +0200
+++ shippy-1.3.3.7/shipsdl.c	2006-03-27 22:39:46.000000000 +0200
@@ -189,7 +189,8 @@
 
 void SYSTEM_SETVID()
 {
-    screen = SDL_SetVideoMode(480, 320, 8, SDL_SWSURFACE | SDL_HWPALETTE);
+    SDL_ShowCursor(SDL_DISABLE);
+    screen = SDL_SetVideoMode(480, 320, 8, SDL_SWSURFACE | SDL_HWPALETTE | SDL_FULLSCREEN);
     if ( screen == NULL )
     {
         return;
@@ -328,6 +329,9 @@
 
 
     if(key[SDLK_ESCAPE]) done = 1;
+    if(key[SDLK_RETURN] && key[SDLK_LALT])
+        SDL_WM_ToggleFullScreen(screen);
+    
     if(waitforkey>0)
     {
         --waitforkey;

shippy-joy.patch:

--- NEW FILE shippy-joy.patch ---
--- shippy-1.3.3.7/shippy.c.joy	2006-03-31 01:07:13.000000000 +0200
+++ shippy-1.3.3.7/shippy.c	2006-03-31 01:07:13.000000000 +0200
@@ -1281,13 +1281,13 @@
             }
             
            
-            if(jdirx == -2)
+            if(jdirx <= -1)
             {
                 --currchar;
                 if(currchar<'A') currchar = 'Z';
                 waitforkey=15;
             }
-            if(jdirx == 2)
+            if(jdirx >= 1)
             {
                 ++currchar;
                 if(currchar>'Z') currchar = 'A';
--- shippy-1.3.3.7/shipsdl.c.joy	2006-03-31 01:07:13.000000000 +0200
+++ shippy-1.3.3.7/shipsdl.c	2006-03-31 01:15:09.000000000 +0200
@@ -8,6 +8,7 @@
 SDL_Surface *screen = NULL;
 SDL_Surface *BackBuffer = NULL;
 SDL_Surface *Graphics = NULL;
+SDL_Joystick *Joystick = NULL;
 Uint8 key[1337];
 
 Uint32 CLEARCOLOR = 0;
@@ -215,7 +216,7 @@
 int SYSTEM_INIT()
 {
    
-    if((SDL_Init(SDL_INIT_VIDEO|SDL_INIT_AUDIO)==-1))
+    if((SDL_Init(SDL_INIT_VIDEO|SDL_INIT_AUDIO|SDL_INIT_JOYSTICK)==-1))
     { 
         return 1;
     }
@@ -226,6 +227,8 @@
     SDL_WM_SetCaption("Shippy1984 by Ryan Broomfield SDL VERSION", NULL);
 
     audio_start();
+    
+    Joystick = SDL_JoystickOpen(0);
 
     return 0;
 }
@@ -234,6 +237,8 @@
 {
     SYSTEM_CLEANBMP();
     End_Audio();
+    if (Joystick)
+        SDL_JoystickClose(Joystick);
     return 0;
 }
 
@@ -327,21 +332,20 @@
         return;
     }
 
-/*    if(num_joysticks>0)
-    {
-        poll_joystick();
-        jaction = joy[0].button[0].b;
-        jsecond = joy[0].button[1].b;
-        jdirx = (joy[0].stick[0].axis[0].d1 - joy[0].stick[0].axis[0].d2)*2;
-        jdiry = (joy[0].stick[0].axis[1].d1 - joy[0].stick[0].axis[1].d2);
-    }
-*/
-
     jdirx = 0;
     jdiry = 0;
     jaction = 0;
     jsecond = 0;
 
+    if(Joystick)
+    {
+        SDL_JoystickUpdate();
+        jaction = SDL_JoystickGetButton(Joystick, 0);
+        jsecond = SDL_JoystickGetButton(Joystick, 1);
+        jdirx = SDL_JoystickGetAxis(Joystick, 0) / (50 * 256);
+        jdiry = SDL_JoystickGetAxis(Joystick, 1) / (65 * 256);
+    }
+
     if(jdirx == 0) jdirx=(key[SDLK_RIGHT] - key[SDLK_LEFT]) * 2;
     if(jdiry == 0) jdiry=key[SDLK_DOWN] - key[SDLK_UP];
     if(jaction == 0) jaction = key[SDLK_LCTRL];
--- shippy-1.3.3.7/shipall.c.joy	2006-03-31 01:07:13.000000000 +0200
+++ shippy-1.3.3.7/shipall.c	2006-03-31 01:15:40.000000000 +0200
@@ -344,8 +344,8 @@
         poll_joystick();
         jaction = joy[0].button[0].b;
         jsecond = joy[0].button[1].b;
-        jdirx = (joy[0].stick[0].axis[0].d1 - joy[0].stick[0].axis[0].d2)*2;
-        jdiry = (joy[0].stick[0].axis[1].d1 - joy[0].stick[0].axis[1].d2);
+        jdirx = joy[0].stick[0].axis[0].pos / 50;
+        jdiry = joy[0].stick[0].axis[1].pos / 65;
     }
     if(jdirx == 0) jdirx=(SYSTEM_GETKEY(KEY_LEFT) - SYSTEM_GETKEY(KEY_RIGHT)) * 2;
     if(jdiry == 0) jdiry=SYSTEM_GETKEY(KEY_UP) - SYSTEM_GETKEY(KEY_DOWN);

shippy-lcdfix.patch:

--- NEW FILE shippy-lcdfix.patch ---
--- shippy-1.3.3.7/shipsdl.c.lcdfix	2006-03-28 21:57:07.000000000 +0200
+++ shippy-1.3.3.7/shipsdl.c	2006-03-28 21:57:07.000000000 +0200
@@ -189,8 +189,11 @@
 
 void SYSTEM_SETVID()
 {
+    Uint32 flags = SDL_SWSURFACE | SDL_HWPALETTE | SDL_FULLSCREEN;
+    if (start_windowed)
+        flags &= ~SDL_FULLSCREEN;
     SDL_ShowCursor(SDL_DISABLE);
-    screen = SDL_SetVideoMode(480, 320, 8, SDL_SWSURFACE | SDL_HWPALETTE | SDL_FULLSCREEN);
+    screen = SDL_SetVideoMode(screen_width, screen_height, 8, flags);
     if ( screen == NULL )
     {
         return;
@@ -253,36 +256,22 @@
 /* NEW SYSTEM_FINISHRENDER() BY JONATHAN GILBERT 1-28-2004 */ 
 void SYSTEM_FINISHRENDER()
 {
-  int x, y, w;
-  Uint8 *in;
-  Uint16 *out;
- 
+  src.x = 0;
+  src.y = 0;
+  src.w = 240;
+  src.h = 160;
+  
+  dest.x = 0;
+  dest.y = 0;
+  dest.w = screen_width;
+  dest.h = screen_height;
+  
   if (SDL_MUSTLOCK(BackBuffer))
     SDL_LockSurface(BackBuffer);
   if (SDL_MUSTLOCK(screen))
     SDL_LockSurface(screen);
- 
-  in = BackBuffer->pixels;
-  out = (Uint16 *)screen->pixels;
- 
-  w = BackBuffer->pitch;
- 
-  for (y=0; y<160; y++)
-  {
-    for (x=0; x<w; x += 2)
-    {
-      Uint32 sample = *(Uint16 *)&in[x];
- 
-      sample = (sample & 0xFF) | (sample >> 8 << 16);
-      sample *= 257;
- 
-      *(Uint32 *)(&out[x]) = sample;
-      *(Uint32 *)(&out[x + w]) = sample;
-    }
- 
-    in += w;
-    out += w + w;
-  }
+
+  SDL_SoftStretch(BackBuffer, &src, screen, &dest);
  
   if (SDL_MUSTLOCK(BackBuffer))
     SDL_UnlockSurface(BackBuffer);
@@ -399,8 +388,5 @@
 
 int main(int argc, char*argv[])
 {
-
-	SHIPPY_MAIN();
-	return 0;
-
+	return SHIPPY_MAIN(argc, argv);
 }
--- shippy-1.3.3.7/shipall.c.lcdfix	2006-03-28 21:57:07.000000000 +0200
+++ shippy-1.3.3.7/shipall.c	2006-03-28 21:57:07.000000000 +0200
@@ -193,10 +193,11 @@
 	
 
 #else
-    GraphicsFlag=set_gfx_mode(GFX_AUTODETECT_FULLSCREEN, 480, 320, 0, 0);    
+    GraphicsFlag=set_gfx_mode(start_windowed? GFX_AUTODETECT_WINDOWED:
+        GFX_AUTODETECT_FULLSCREEN, screen_width, screen_height, 0, 0);    
     if(GraphicsFlag!=0)
     {
-        GraphicsFlag=set_gfx_mode(GFX_SAFE, 480, 320, 0, 0);
+        GraphicsFlag=set_gfx_mode(GFX_SAFE, screen_width, screen_height, 0, 0);
         if(GraphicsFlag!=0) exit(-1);
         else vidmode = GFX_SAFE;
     }
@@ -289,7 +290,7 @@
     blit(BackBuffer,screen,0,0,40,20,240,160);
 #else
     acquire_screen();
-    stretch_blit(BackBuffer,screen,0,0,240,160,0,0,480,320);
+    stretch_blit(BackBuffer,screen,0,0,240,160,0,0,screen_width,screen_height);
     release_screen();
 #endif
 }
@@ -319,10 +320,10 @@
     {
         vidmode = (vidmode == GFX_AUTODETECT_FULLSCREEN)?
             GFX_AUTODETECT_WINDOWED:GFX_AUTODETECT_FULLSCREEN;
-        if(set_gfx_mode(vidmode, 480, 320, 0, 0))
+        if(set_gfx_mode(vidmode, screen_width, screen_height, 0, 0))
         {
             vidmode = GFX_SAFE;
-            if(set_gfx_mode(vidmode, 480, 320, 0, 0))
+            if(set_gfx_mode(vidmode, screen_width, screen_height, 0, 0))
             {
                 fprintf(stderr, "FATAL error switching Fullscreen <-> Window\n");
 	        exit(1);
@@ -354,13 +355,12 @@
 
 void SYSTEM_IDLE()
 {
-
+    if (objectsynch == 0)
+        rest(1);
 }
 
 int main(int argc, char*argv[])
 {
-	SHIPPY_MAIN();
-	return 0;
-
+	return SHIPPY_MAIN(argc, argv);
 }
 END_OF_MAIN()
--- shippy-1.3.3.7/shippy.c.lcdfix	2006-03-28 21:57:07.000000000 +0200
+++ shippy-1.3.3.7/shippy.c	2006-03-28 21:57:51.000000000 +0200
@@ -106,6 +106,11 @@
 
 FILE *highscore_fp;
 
+int start_windowed  = 0;
+int use_arcade_mode = 0;
+int screen_width  = 640;
+int screen_height = 480;
+
 int compare(const void *a, const void *b)
 {
     struct HISCORE *test = (struct HISCORE *)a;
@@ -1499,9 +1504,19 @@
     }
 }
 
-void SHIPPY_MAIN()
+static void show_usage(char *name, FILE *f)
 {
-    int increment;
+    fprintf(f,
+        "Usage: %s [-w] [-a] [-h]\n\n"
+        "Options:\n"
+        "-w\tWindowed, start in a window (default fullscreen)\n"
+        "-a\tArcade, use an arcade-ish video mode with scanlines (CRT only!)\n"
+        "-h\tHelp, display this help and exit\n", name);
+}
+
+int SHIPPY_MAIN(int argc, char *argv[])
+{
+    int i;
     gid_t realgid;
     
     highscore_fp = fopen("/var/games/shippy.hs", "r+");
@@ -1509,11 +1524,37 @@
     realgid = getgid();
     if (setresgid(-1, realgid, realgid) != 0) {
         perror("Could not drop setgid privileges.  Aborting.");
-        exit(1);
+        return 1;
+    }
+    
+    for (i = 1; i < argc; i++)
+    {
+        if (!strcmp(argv[i], "-w"))
+            start_windowed = 1;
+        else if (!strcmp(argv[i], "-a"))
+        {
+            use_arcade_mode = 1;
+            screen_width  = 480;
+            screen_height = 320;
+        }
+        else if (!strcmp(argv[i], "-h") ||
+            !strcmp(argv[i], "-?") ||
+            !strcmp(argv[i], "-help") ||
+            !strcmp(argv[i], "--help"))
+        {
+            show_usage(argv[0], stdout);
+            return 0;
+        }
+        else
+        {
+            fprintf(stderr, "Error: unknown argument: %s\n", argv[i]);
+            show_usage(argv[0], stderr);
+            return 1;
+        }
     }
         
     srand(time(0));
-    if(SYSTEM_INIT()!=0) return;
+    if(SYSTEM_INIT()!=0) return 1;
     InitShippy();
     while(done==0)
     {
@@ -1532,9 +1573,9 @@
                 countframes=0;
         	}
 
-            for(increment=0;increment<MAXSHIPPY;++increment)
+            for(i=0;i<MAXSHIPPY;++i)
             {
-                if(gamestate!=INITIALS) RenderShippy(increment);
+                if(gamestate!=INITIALS) RenderShippy(i);
             }
             DrawOverlay();
             SYSTEM_FINISHRENDER();
@@ -1543,6 +1584,7 @@
     }
     StoreHS();
     SYSTEM_CLEAN();
+    return 0;
 }
 
 
--- shippy-1.3.3.7/externs.h.lcdfix	2004-01-17 21:57:50.000000000 +0100
+++ shippy-1.3.3.7/externs.h	2006-03-28 21:57:07.000000000 +0200
@@ -10,5 +10,9 @@
 extern int done;
 extern int gscale;
 extern volatile int objectsynch;
+extern int start_windowed;
+extern int use_arcade_mode;
+extern int screen_width;
+extern int screen_height;
 
 #endif
--- shippy-1.3.3.7/shippy.h.lcdfix	2006-03-28 21:57:07.000000000 +0200
+++ shippy-1.3.3.7/shippy.h	2006-03-28 21:57:07.000000000 +0200
@@ -40,7 +40,6 @@
 void RestoreHS();
 void InitShippy();
 void ExecShippy();
-void SHIPPY_MAIN();
-
+int SHIPPY_MAIN(int argc, char *argv[]);
 
 #endif

shippy-warnings.patch:

--- NEW FILE shippy-warnings.patch ---
--- shippy-1.3.3.7/shippy.c~	2006-03-27 20:25:11.000000000 +0200
+++ shippy-1.3.3.7/shippy.c	2006-03-27 20:25:11.000000000 +0200
@@ -7,7 +7,10 @@
 /* this must be done before the first include of unistd.h for setresgid */
 #define _GNU_SOURCE 
 #include <unistd.h>
+#include <string.h>
 #include <stdio.h>
+#include <stdlib.h>
+#include <time.h>
 #include "shippy.h"
 
 #define TEXT_WHITE 0
@@ -304,10 +307,7 @@
 {
     int increment;
     int adder;
-    int accuracy;
-    int courage;
     int bonus;
-    float floatop;
 
     shots = 0;
     powerupframe = 0;
@@ -595,7 +595,6 @@
     if(ShippyObjects[number].used==0) return;
     int increment;
     int runsim;
-    int tx,ty;
 
     switch(ShippyObjects[number].type)
     {
@@ -807,7 +806,7 @@
                 --ShippyObjects[number].special;
             }
 
-            if(ShippyObjects[number].x<-7 || ShippyObjects[number].x>247 && ShippyObjects[number].type==ENEMYSHIPPY)
+            if(ShippyObjects[number].x<-7 || (ShippyObjects[number].x>247 && ShippyObjects[number].type==ENEMYSHIPPY))
             {
                 ShippyObjects[number].y+=16;
                 ShippyObjects[number].level=-ShippyObjects[number].level;
@@ -1102,10 +1101,12 @@
 
 void StoreHS()
 {
+    size_t silence_warnings;
+    
     if(highscore_fp==NULL) return;
 
     rewind(highscore_fp);
-    fwrite(winners,sizeof(struct HISCORE), 14, highscore_fp);
+    silence_warnings = fwrite(winners,sizeof(struct HISCORE), 14, highscore_fp);
 }
 
 
--- shippy-1.3.3.7/shipsdl.c~	2006-03-27 20:27:19.000000000 +0200
+++ shippy-1.3.3.7/shipsdl.c	2006-03-27 20:27:19.000000000 +0200
@@ -1,3 +1,6 @@
+#include <string.h>
+#include <stdlib.h>
+#include <unistd.h>
 #include <SDL/SDL.h>
 #include <SDL/SDL_mixer.h>
 #include "shippy.h"
@@ -236,7 +239,7 @@
 
 }
 
-int SYSTEM_BG(char *bmp)
+void SYSTEM_BG(char *bmp)
 {
     if(BackBuffer!=NULL) SDL_FreeSurface(BackBuffer);
     BackBuffer= CreateSurfaceFromBitmap(bmp,SDL_SWSURFACE|SDL_SRCCOLORKEY);
@@ -247,7 +250,7 @@
 
 
 /* NEW SYSTEM_FINISHRENDER() BY JONATHAN GILBERT 1-28-2004 */ 
-int SYSTEM_FINISHRENDER()
+void SYSTEM_FINISHRENDER()
 {
   int x, y, w;
   Uint8 *in;
@@ -294,10 +297,12 @@
     if(SDL_FillRect(BackBuffer, NULL, CLEARCOLOR)==-1)
     {
         printf("CLS ERROR! \n");
+        return 1;
     }
+    return 0;
 }
 
-int SYSTEM_BLIT(int sx, int sy, int x, int y, int szx, int szy)
+void SYSTEM_BLIT(int sx, int sy, int x, int y, int szx, int szy)
 {
     src.x = sx;
     src.y = sy;
@@ -316,7 +321,6 @@
 
 void SYSTEM_POLLINPUT()
 {
-    int tx,ty;
     jaction = 0;
     jsecond = 0;
     jdirx = 0;
@@ -393,5 +397,6 @@
 {
 
 	SHIPPY_MAIN();
+	return 0;
 
 }
--- shippy-1.3.3.7/shippy.h~	2006-03-27 20:25:10.000000000 +0200
+++ shippy-1.3.3.7/shippy.h	2006-03-27 20:25:10.000000000 +0200
@@ -18,13 +18,13 @@
 void SCRAPPABLE_CLOSE();
 void SYSTEM_CLEANBMP();
 void SYSTEM_SETVID();
-int SYSTEM_BG();
+void SYSTEM_BG();
 int SYSTEM_INIT();
 int SYSTEM_CLEAN();
 int SYSTEM_GETKEY(int scancode);
-int SYSTEM_FINISHRENDER();
+void SYSTEM_FINISHRENDER();
 int SYSTEM_CLEARSCREEN();
-int SYSTEM_BLIT(int sx, int sy, int x, int y, int szx, int szy);
+void SYSTEM_BLIT(int sx, int sy, int x, int y, int szx, int szy);
 void SYSTEM_POLLINPUT();
 void SYSTEM_IDLE();
 int compare(const void *a, const void *b);
--- shippy-1.3.3.7/shipall.c~	2006-03-27 20:21:26.000000000 +0200
+++ shippy-1.3.3.7/shipall.c	2006-03-27 20:21:26.000000000 +0200
@@ -1,3 +1,4 @@
+#include <string.h>
 #include <allegro.h>
 #include <aldumb.h>
 #include "shippy.h"
@@ -215,7 +216,7 @@
     set_palette(mypal);
 }
 
-int SYSTEM_BG(char *bmp)
+void SYSTEM_BG(char *bmp)
 {
     BITMAP *mytest2;
   	mytest2 = load_bmp(bmp,NULL);
@@ -227,12 +228,8 @@
 }
 int SYSTEM_INIT()
 {
-    int AllegroInitFlag;
-    int GraphicsFlag;
-    int width,height;
-    BITMAP *mytest2;
-
-    AllegroInitFlag = allegro_init();
+    if (allegro_init())
+        return -1;
 
     atexit(&dumb_exit);
     dumb_register_stdfiles();
@@ -279,7 +276,7 @@
     return key[scancode];
 }
 
-int SYSTEM_FINISHRENDER()
+void SYSTEM_FINISHRENDER()
 {
 #ifdef ALLEGRO_DOS
     blit(BackBuffer,screen,0,0,40,20,240,160);
@@ -295,14 +292,13 @@
     return 0;
 }
 
-int SYSTEM_BLIT(int sx, int sy, int x, int y, int szx, int szy)
+void SYSTEM_BLIT(int sx, int sy, int x, int y, int szx, int szy)
 {
     masked_blit(Graphics,BackBuffer,sx,sy,x,y,szx,szy);
 }
 
 void SYSTEM_POLLINPUT()
 {
-    int tx,ty;
     jaction = 0;
     jsecond = 0;
     jdirx = 0;
@@ -338,6 +334,7 @@
 int main(int argc, char*argv[])
 {
 	SHIPPY_MAIN();
+	return 0;
 
 }
 END_OF_MAIN()


--- NEW FILE shippy.desktop ---
[Desktop Entry]
Encoding=UTF-8
Name=Shippy 1984
GenericName=Space invaders / Galaxians like game
Comment=Galaxians with powerups!
Exec=shippy
Icon=shippy.png
Terminal=false
StartupNotify=false
Type=Application
Categories=Application;Game;ArcadeGame;
Version=1.3.3.7


--- NEW FILE shippy.sh ---
#!/bin/bash

SHIPPY=`which shippy-sdl 2> /dev/null`

if [ -z "$SHIPPY" ]; then
    SHIPPY=`which shippy-allegro 2> /dev/null`
fi

if [ -z "$SHIPPY" ]; then
    echo "error could find neither shippy-sdl nor shippy-allegro"
    exit 1
fi

exec $SHIPPY "$@"


--- NEW FILE shippy.spec ---
Name:           shippy
Version:        1.3.3.7
Release:        2%{?dist}
Summary:        Space invaders / Galaxians like game with powerups
Group:          Amusements/Games
License:        GPL
URL:            http://www.shippysite.com/
Source0:        http://download.sourceforge.net/ship84/shipv%{version}UNIX.zip
Source1:        shippy.png
Source2:        shippy.desktop
Source3:        shippy.sh
Patch0:         shippy-fixes.patch
Patch1:         shippy-warnings.patch
Patch2:         shippy-fullscreen.patch
Patch3:         shippy-lcdfix.patch
Patch4:         shippy-joy.patch
BuildRoot:      %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
BuildRequires:  dumb-devel SDL_mixer-devel desktop-file-utils
Requires:	%{name}-common = %{version}
Provides:       %{name}-engine = %{version}

%description
Shippy1984 is a small, portable game designed to bring back nostalgia for the
ways games used to be made--addicting as hell! Mash buttons on your way to the
high score! Shippy1984 is designed from the ground up for the avid casual
gamer who feels left behind by the technological overload of today's games!
No longer! Shippy1984 is the game you have been waiting for!


%package allegro
Summary:	Shippy1984 Allegro version
Group:		Amusements/Games
Requires:	%{name}-common = %{version}
Provides:       %{name}-engine = %{version}

%description allegro
Alternative version of Shippy1984 compiled to use the allegro display library.


%package common
Summary:	Shippy1984 common files
Group:		Amusements/Games
Requires:       %{name}-engine = %{version}

%description common
Data files, desktop entry and icon, docs and wrapper-script for the
Shippy1984 game.


%prep
%setup -q -c
%patch0 -p1
%patch1 -p1
%patch2 -p1
%patch3 -p1
%patch4 -p1
%{__sed} -i 's/\r//' NOTES.txt LICENSE.txt docs/manual.html
mv docs html
#see comment in %%install
rm data/scores.lst


%build
make %{?_smp_mflags} SDL=1 \
 CFLAGS="$RPM_OPT_FLAGS -fsigned-char -DDATADIR=\\\"%{_datadir}/%{name}/\\\"" \
 LDFLAGS="-g `sdl-config --libs` -lSDL_mixer"
mv %{name} %{name}-sdl

make %{?_smp_mflags} ALLEGRO=1 \
 CFLAGS="$RPM_OPT_FLAGS -fsigned-char -DDATADIR=\\\"%{_datadir}/%{name}/\\\"" \
 LDFLAGS="-g -laldmb -ldumb `allegro-config --libs`"
mv %{name} %{name}-allegro


%install
rm -rf $RPM_BUILD_ROOT
# no make install target so DIY
mkdir -p $RPM_BUILD_ROOT%{_bindir}
install -m 755 %{SOURCE3} $RPM_BUILD_ROOT%{_bindir}/%{name}
install -m 755 %{name}-sdl %{name}-allegro $RPM_BUILD_ROOT%{_bindir}
mkdir -p $RPM_BUILD_ROOT/%{_datadir}/%{name}
install -p -m 644 data/* $RPM_BUILD_ROOT%{_datadir}/%{name}
# scores.lst is a binary file which is different on MSB vs LSB, so we just
# create an empty file, then the game will use its identical internal defaults
# and fill it with data in platform format after the first run.
mkdir -p $RPM_BUILD_ROOT%{_var}/lib/games
touch $RPM_BUILD_ROOT%{_var}/lib/games/%{name}.hs

# 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 \
  --add-category X-Fedora                       \
  %{SOURCE2}
mkdir -p $RPM_BUILD_ROOT%{_datadir}/icons/hicolor/16x16/apps
install -p -m 644 %{SOURCE1} \
  $RPM_BUILD_ROOT%{_datadir}/icons/hicolor/16x16/apps


%clean
rm -rf $RPM_BUILD_ROOT


%post
touch --no-create %{_datadir}/icons/hicolor || :
if [ -x %{_bindir}/gtk-update-icon-cache ]; then
   %{_bindir}/gtk-update-icon-cache --quiet %{_datadir}/icons/hicolor || :
fi

%postun
touch --no-create %{_datadir}/icons/hicolor || :
if [ -x %{_bindir}/gtk-update-icon-cache ]; then
   %{_bindir}/gtk-update-icon-cache --quiet %{_datadir}/icons/hicolor || :
fi


%files
%defattr(-,root,root,-)
%attr(2755,root,games) %{_bindir}/%{name}-sdl

%files allegro
%defattr(-,root,root,-)
%attr(2755,root,games) %{_bindir}/%{name}-allegro

%files common
%defattr(-,root,root,-)
%doc NOTES.txt LICENSE.txt html
%{_bindir}/%{name}
%{_datadir}/%{name}
%{_datadir}/applications/fedora-%{name}.desktop
%{_datadir}/icons/hicolor/16x16/apps/%{name}.png
%config(noreplace) %attr (0664,root,games) %{_var}/lib/games/%{name}.hs


%changelog
* Thu Mar 30 2006 Hans de Goede <j.w.r.degoede at hhs.nl> 1.3.3.7-2
- Fix reversed joy directions in allegro version
- Improve support for analog joysticks in the allegro version
- Add support for joysticks to the SDL version

* Mon Mar 27 2006 Hans de Goede <j.w.r.degoede at hhs.nl> 1.3.3.7-1
- Initial Fedora Extras package
- Todo: add joystick support to SDL version


Index: .cvsignore
===================================================================
RCS file: /cvs/extras/rpms/shippy/devel/.cvsignore,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- .cvsignore	31 Mar 2006 08:17:05 -0000	1.1
+++ .cvsignore	31 Mar 2006 08:18:18 -0000	1.2
@@ -0,0 +1 @@
+shipv1.3.3.7UNIX.zip


Index: sources
===================================================================
RCS file: /cvs/extras/rpms/shippy/devel/sources,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- sources	31 Mar 2006 08:17:05 -0000	1.1
+++ sources	31 Mar 2006 08:18:18 -0000	1.2
@@ -0,0 +1 @@
+06df2ae060fe4a076d7fa17a57205348  shipv1.3.3.7UNIX.zip




More information about the scm-commits mailing list