rpms/shippy/devel shippy-merged.patch, NONE, 1.1 shippy.spec, 1.1, 1.2 shippy-fixes.patch, 1.1, NONE shippy-fullscreen.patch, 1.1, NONE shippy-joy.patch, 1.1, NONE shippy-lcdfix.patch, 1.1, NONE shippy-warnings.patch, 1.1, NONE
Hans de Goede (jwrdegoede)
fedora-extras-commits at redhat.com
Mon Apr 3 19:31:03 UTC 2006
Author: jwrdegoede
Update of /cvs/extras/rpms/shippy/devel
In directory cvs-int.fedora.redhat.com:/tmp/cvs-serv1143
Modified Files:
shippy.spec
Added Files:
shippy-merged.patch
Removed Files:
shippy-fixes.patch shippy-fullscreen.patch shippy-joy.patch
shippy-lcdfix.patch shippy-warnings.patch
Log Message:
* Mon Apr 3 2006 Hans de Goede <j.w.r.degoede at hhs.nl> 1.3.3.7-unreleased
- Merged all patches into one and put a few parts between #ifdef __unix__
(I send this upstream for merging).
shippy-merged.patch:
--- NEW FILE shippy-merged.patch ---
Only in shippy-1.3.3.7.orig/data: scores.lst
diff -ur shippy-1.3.3.7.orig/externs.h shippy-1.3.3.7/externs.h
--- shippy-1.3.3.7.orig/externs.h 2004-01-17 21:57:50.000000000 +0100
+++ shippy-1.3.3.7/externs.h 2006-04-01 13:45:54.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
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 2004-03-04 00:52:10.000000000 +0100
+++ shippy-1.3.3.7/shipall.c 2006-04-01 13:45:54.000000000 +0200
@@ -1,3 +1,4 @@
+#include <string.h>
#include <allegro.h>
#include <aldumb.h>
#include "shippy.h"
@@ -9,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;
@@ -171,7 +177,6 @@
{
int GraphicsFlag;
BITMAP *mytest2;
- RGB mypal[256];
set_color_depth(8);
bitsperpixel = 8;
set_color_conversion(COLORCONV_TOTAL);
@@ -188,18 +193,22 @@
#else
- GraphicsFlag=set_gfx_mode(GFX_AUTODETECT_WINDOWED, 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;
}
+ else
+ vidmode = GFX_AUTODETECT_FULLSCREEN;
#endif
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);
@@ -215,7 +224,7 @@
set_palette(mypal);
}
-int SYSTEM_BG(char *bmp)
+void SYSTEM_BG(char *bmp)
{
BITMAP *mytest2;
mytest2 = load_bmp(bmp,NULL);
@@ -227,12 +236,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,13 +284,13 @@
return key[scancode];
}
-int SYSTEM_FINISHRENDER()
+void SYSTEM_FINISHRENDER()
{
#ifdef ALLEGRO_DOS
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
}
@@ -295,14 +300,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;
@@ -310,6 +314,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, screen_width, screen_height, 0, 0))
+ {
+ vidmode = GFX_SAFE;
+ if(set_gfx_mode(vidmode, screen_width, screen_height, 0, 0))
+ {
+ fprintf(stderr, "FATAL error switching Fullscreen <-> Window\n");
+ exit(1);
+ }
+ }
+ set_palette(mypal);
+ }
+#endif
+
if(waitforkey>0)
{
--waitforkey;
@@ -321,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);
@@ -332,12 +355,12 @@
void SYSTEM_IDLE()
{
-
+ if (objectsynch == 0)
+ rest(1);
}
int main(int argc, char*argv[])
{
- SHIPPY_MAIN();
-
+ return SHIPPY_MAIN(argc, argv);
}
END_OF_MAIN()
diff -ur shippy-1.3.3.7.orig/shippy.c shippy-1.3.3.7/shippy.c
--- shippy-1.3.3.7.orig/shippy.c 2004-03-08 06:41:30.000000000 +0100
+++ shippy-1.3.3.7/shippy.c 2006-04-01 13:57:04.000000000 +0200
@@ -4,7 +4,15 @@
http://ship84.sourceforge.net
*/
+#ifdef __unix__
+/* this must be done before the first include of unistd.h for setresgid */
+#define _GNU_SOURCE
+#include <unistd.h>
+#endif
+#include <string.h>
#include <stdio.h>
+#include <stdlib.h>
+#include <time.h>
#include "shippy.h"
#define TEXT_WHITE 0
@@ -98,6 +106,13 @@
int missedshots = 0;
int firedshots = 0;
+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;
@@ -299,10 +314,7 @@
{
int increment;
int adder;
- int accuracy;
- int courage;
int bonus;
- float floatop;
shots = 0;
powerupframe = 0;
@@ -590,7 +602,6 @@
if(ShippyObjects[number].used==0) return;
int increment;
int runsim;
- int tx,ty;
switch(ShippyObjects[number].type)
{
@@ -656,7 +667,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 +681,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 +704,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;
}
@@ -802,7 +813,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;
@@ -837,7 +848,7 @@
}
diedlast = 1;
- audio_play("data/die.wav");
+ audio_play(DATADIR "die.wav");
ShippyObjects[number].type=EXPLOSION;
ShippyObjects[number].special=4;
}
@@ -937,7 +948,7 @@
0);
}
- audio_play("data/hit.wav");
+ audio_play(DATADIR "hit.wav");
break;
case ENEMYSHIPPY:
@@ -955,7 +966,7 @@
0,
0);
}
- audio_play("data/hit.wav");
+ audio_play(DATADIR "hit.wav");
break;
case FEZBOMB:
@@ -976,7 +987,7 @@
0,
0);
}
- audio_play("data/hit.wav");
+ audio_play(DATADIR "hit.wav");
break;
}
@@ -1059,7 +1070,7 @@
}
diedlast = 1;
- audio_play("data/die.wav");
+ audio_play(DATADIR "die.wav");
ShippyObjects[number].type=EXPLOSION;
ShippyObjects[number].special=4;
return;
@@ -1097,43 +1108,28 @@
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;
-
+ size_t silence_warnings;
+
+ if(highscore_fp==NULL) return;
+ rewind(highscore_fp);
+ silence_warnings = 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 +1221,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)
{
@@ -1287,13 +1283,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';
@@ -1339,7 +1335,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 +1384,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 +1397,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 +1425,7 @@
else
{
- audio_music("data/shippy.xm");
+ audio_music(DATADIR "shippy.xm");
gamestate = GAME;
operational = 0;
}
@@ -1467,7 +1463,7 @@
{
ShippyObjects[0].lives++;
extralife *= 2;
- audio_play("data/fanfare.wav");
+ audio_play(DATADIR "fanfare.wav");
}
@@ -1510,11 +1506,61 @@
}
}
-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;
+#ifdef __unix__
+ 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.");
+ return 1;
+ }
+#else
+ highscore_fp = fopen("data/scores.lst","r+b");
+#endif
+
+ 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)
{
@@ -1533,9 +1579,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();
@@ -1544,6 +1590,7 @@
}
StoreHS();
SYSTEM_CLEAN();
+ return 0;
}
Only in shippy-1.3.3.7: shippy.c.orig
Only in shippy-1.3.3.7: shippy.c~
diff -ur shippy-1.3.3.7.orig/shippy.h shippy-1.3.3.7/shippy.h
--- shippy-1.3.3.7.orig/shippy.h 2004-02-03 21:10:00.000000000 +0100
+++ shippy-1.3.3.7/shippy.h 2006-04-01 13:45:54.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);
@@ -14,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);
@@ -36,7 +40,6 @@
void RestoreHS();
void InitShippy();
void ExecShippy();
-void SHIPPY_MAIN();
-
+int SHIPPY_MAIN(int argc, char *argv[]);
#endif
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 2004-03-04 00:53:02.000000000 +0100
+++ shippy-1.3.3.7/shipsdl.c 2006-04-01 13:58:59.000000000 +0200
@@ -1,3 +1,5 @@
+#include <string.h>
+#include <stdlib.h>
#include <SDL/SDL.h>
#include <SDL/SDL_mixer.h>
#include "shippy.h"
@@ -5,6 +7,7 @@
SDL_Surface *screen = NULL;
SDL_Surface *BackBuffer = NULL;
SDL_Surface *Graphics = NULL;
+SDL_Joystick *Joystick = NULL;
Uint8 key[1337];
Uint32 CLEARCOLOR = 0;
@@ -164,9 +167,9 @@
void End_Audio()
{
+ audio_end();
Mix_HaltMusic();
Mix_CloseAudio();
- audio_end();
}
@@ -186,7 +189,11 @@
void SYSTEM_SETVID()
{
- screen = SDL_SetVideoMode(480, 320, 8, SDL_SWSURFACE | SDL_HWPALETTE);
+ Uint32 flags = SDL_SWSURFACE | SDL_HWPALETTE | SDL_FULLSCREEN;
+ if (start_windowed)
+ flags &= ~SDL_FULLSCREEN;
+ SDL_ShowCursor(SDL_DISABLE);
+ screen = SDL_SetVideoMode(screen_width, screen_height, 8, flags);
if ( screen == NULL )
{
return;
@@ -194,8 +201,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));
@@ -208,7 +215,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;
}
@@ -219,6 +226,8 @@
SDL_WM_SetCaption("Shippy1984 by Ryan Broomfield SDL VERSION", NULL);
audio_start();
+
+ Joystick = SDL_JoystickOpen(0);
return 0;
}
@@ -227,6 +236,8 @@
{
SYSTEM_CLEANBMP();
End_Audio();
+ if (Joystick)
+ SDL_JoystickClose(Joystick);
return 0;
}
@@ -236,7 +247,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,38 +258,24 @@
/* NEW SYSTEM_FINISHRENDER() BY JONATHAN GILBERT 1-28-2004 */
-int SYSTEM_FINISHRENDER()
+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);
@@ -294,10 +291,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 +315,6 @@
void SYSTEM_POLLINPUT()
{
- int tx,ty;
jaction = 0;
jsecond = 0;
jdirx = 0;
@@ -324,27 +322,29 @@
if(key[SDLK_ESCAPE]) done = 1;
+ if(key[SDLK_RETURN] && key[SDLK_LALT])
+ SDL_WM_ToggleFullScreen(screen);
+
if(waitforkey>0)
{
--waitforkey;
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];
@@ -356,6 +356,10 @@
void SYSTEM_IDLE()
{
Uint32 test = SDL_GetTicks();
+
+ if (test < timing)
+ SDL_Delay(1);
+
while(test>timing)
{
timing+=14;
@@ -387,7 +391,5 @@
int main(int argc, char*argv[])
{
-
- SHIPPY_MAIN();
-
+ return SHIPPY_MAIN(argc, argv);
}
Only in shippy-1.3.3.7: shipsdl.c~
Index: shippy.spec
===================================================================
RCS file: /cvs/extras/rpms/shippy/devel/shippy.spec,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- shippy.spec 31 Mar 2006 08:18:18 -0000 1.1
+++ shippy.spec 3 Apr 2006 19:31:03 -0000 1.2
@@ -1,6 +1,6 @@
Name: shippy
Version: 1.3.3.7
-Release: 2%{?dist}
+Release: unreleased(last 2)%{?dist}
Summary: Space invaders / Galaxians like game with powerups
Group: Amusements/Games
License: GPL
@@ -9,11 +9,7 @@
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
+Patch0: shippy-merged.patch
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
BuildRequires: dumb-devel SDL_mixer-devel desktop-file-utils
Requires: %{name}-common = %{version}
@@ -49,11 +45,7 @@
%prep
%setup -q -c
-%patch0 -p1
-%patch1 -p1
-%patch2 -p1
-%patch3 -p1
-%patch4 -p1
+%patch0 -p1 -z .merged
%{__sed} -i 's/\r//' NOTES.txt LICENSE.txt docs/manual.html
mv docs html
#see comment in %%install
@@ -133,6 +125,10 @@
%changelog
+* Mon Apr 3 2006 Hans de Goede <j.w.r.degoede at hhs.nl> 1.3.3.7-unreleased
+- Merged all patches into one and put a few parts between #ifdef __unix__
+ (I send this upstream for merging).
+
* 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
--- shippy-fixes.patch DELETED ---
--- shippy-fullscreen.patch DELETED ---
--- shippy-joy.patch DELETED ---
--- shippy-lcdfix.patch DELETED ---
--- shippy-warnings.patch DELETED ---
More information about the scm-commits
mailing list