r3553 - in packages/trunk/rrootage/debian: . patches

Miriam Ruiz baby-guest at alioth.debian.org
Sat Aug 4 19:46:00 UTC 2007


Author: baby-guest
Date: 2007-08-04 19:46:00 +0000 (Sat, 04 Aug 2007)
New Revision: 3553

Added:
   packages/trunk/rrootage/debian/patches/06_rrootage_make_highres_default.patch
   packages/trunk/rrootage/debian/patches/07_rrootage_highres.patch
Modified:
   packages/trunk/rrootage/debian/changelog
Log:
Added high resolution patches by Peter De Wachter



Modified: packages/trunk/rrootage/debian/changelog
===================================================================
--- packages/trunk/rrootage/debian/changelog	2007-08-04 19:39:00 UTC (rev 3552)
+++ packages/trunk/rrootage/debian/changelog	2007-08-04 19:46:00 UTC (rev 3553)
@@ -10,6 +10,9 @@
   * Upgraded libglut3-dev build-dep to freeglut3-dev (Closes: #394502)
   * Replaced (= ${Source-Version}) by (>= ${source:Version}) to make the
     packages binnmu-friendly.
+  * Added patches 06_rrootage_make_highres_default.patch and
+    07_rrootage_highres.patch provided by "Peter De Wachter" <pdewacht at gmail.com>
+    to add a high resolution mode and make the game resizable in window mode.
 
   [ Eddy Petrișor ]
   * added missing build-depends on dpkg-dev (>= 1.13.19) since we use

Added: packages/trunk/rrootage/debian/patches/06_rrootage_make_highres_default.patch
===================================================================
--- packages/trunk/rrootage/debian/patches/06_rrootage_make_highres_default.patch	                        (rev 0)
+++ packages/trunk/rrootage/debian/patches/06_rrootage_make_highres_default.patch	2007-08-04 19:46:00 UTC (rev 3553)
@@ -0,0 +1,30 @@
+diff --git a/debian/rrootage.6 b/debian/rrootage.6
+index f6dd7b2..3b5b16c 100644
+--- a/debian/rrootage.6
++++ b/debian/rrootage.6
+@@ -76,10 +76,10 @@ These command line options are available:
+ Low resolution mode.
+ .TP
+ .B \-mediumres
+-Medium resolution mode (default).
++Medium resolution mode.
+ .TP
+ .B \-highres
+-High resolution mode.
++High resolution mode (default).
+ .TP
+ .B \-nosound
+ Disable sound.
+diff --git a/src/screen.c b/src/screen.c
+index c67fde7..4e31ab5 100644
+--- a/src/screen.c
++++ b/src/screen.c
+@@ -128,7 +128,7 @@ static GLuint smokeTexture;
+ static GLuint titleTexture;
+ #define TITLE_BMP "title.bmp"
+ 
+-int resolution = MEDIUM_RESOLUTION;
++int resolution = HIGH_RESOLUTION;
+ int windowMode = 0;
+ int brightness = DEFAULT_BRIGHTNESS;
+ Uint8 *keys;

Added: packages/trunk/rrootage/debian/patches/07_rrootage_highres.patch
===================================================================
--- packages/trunk/rrootage/debian/patches/07_rrootage_highres.patch	                        (rev 0)
+++ packages/trunk/rrootage/debian/patches/07_rrootage_highres.patch	2007-08-04 19:46:00 UTC (rev 3553)
@@ -0,0 +1,171 @@
+diff --git a/debian/rrootage.6 b/debian/rrootage.6
+index 4fdf8bb..f6dd7b2 100644
+--- a/debian/rrootage.6
++++ b/debian/rrootage.6
+@@ -15,7 +15,7 @@ rRootage \- an abstract arcade shooter
+ .SH SYNOPSIS
+ .
+ .B rrootage
+-[\-lowres]
++[\-lowres|\-mediumres|\-highres]
+ [\-nosound]
+ [\-window]
+ [\-reverse]
+@@ -75,6 +75,12 @@ These command line options are available:
+ .B \-lowres
+ Low resolution mode.
+ .TP
++.B \-mediumres
++Medium resolution mode (default).
++.TP
++.B \-highres
++High resolution mode.
++.TP
+ .B \-nosound
+ Disable sound.
+ .TP
+diff --git a/src/rr.c b/src/rr.c
+index 71d49fa..cfe3587 100644
+--- a/src/rr.c
++++ b/src/rr.c
+@@ -195,14 +195,18 @@ static void draw() {
+ static int accframe = 0;
+ 
+ static void usage(char *argv0) {
+-  fprintf(stderr, "Usage: %s [-lowres] [-nosound] [-window] [-reverse] [-nowait] [-accframe]\n", argv0);
++  fprintf(stderr, "Usage: %s [-lowres|-mediumres|-highres] [-nosound] [-window] [-reverse] [-nowait] [-accframe]\n", argv0);
+ }
+ 
+ static void parseArgs(int argc, char *argv[]) {
+   int i;
+   for ( i=1 ; i<argc ; i++ ) {
+     if ( strcmp(argv[i], "-lowres") == 0 ) {
+-      lowres = 1;
++      resolution = LOW_RESOLUTION;
++    } else if ( strcmp(argv[i], "-mediumres") == 0 ) {
++      resolution = MEDIUM_RESOLUTION;
++    } else if ( strcmp(argv[i], "-highres") == 0 ) {
++      resolution = HIGH_RESOLUTION;
+     } else if ( strcmp(argv[i], "-nosound") == 0 ) {
+       noSound = 1;
+     } else if ( strcmp(argv[i], "-window") == 0 ) {
+@@ -249,6 +253,10 @@ int main(int argc, char *argv[]) {
+ 
+   while ( !done ) {
+     SDL_PollEvent(&event);
++
++    if ( event.type == SDL_VIDEORESIZE )
++      resized(event.resize.w, event.resize.h);
++
+     keys = SDL_GetKeyState(NULL);
+     if ( keys[SDLK_ESCAPE] == SDL_PRESSED || event.type == SDL_QUIT ) done = 1;
+     if ( keys[SDLK_p] == SDL_PRESSED ) {
+diff --git a/src/screen.c b/src/screen.c
+index 751c8fc..c67fde7 100644
+--- a/src/screen.c
++++ b/src/screen.c
+@@ -33,19 +33,37 @@
+ #define LOWRES_SCREEN_HEIGHT 240
+ #define SHARE_LOC "/usr/share/games/rrootage/"
+ 
++static Uint32 videoFlags;
+ static int screenWidth, screenHeight;
+ 
+ // Reset viewport when the screen is resized.
+ static void screenResized() {
+-  glViewport(0, 0, screenWidth, screenHeight);
++  int viewWidth, viewHeight;
++  if ( screenWidth * SCREEN_HEIGHT > screenHeight * SCREEN_WIDTH ) {
++    viewWidth = screenHeight * SCREEN_WIDTH / SCREEN_HEIGHT;
++    viewHeight = screenHeight;
++  } else if ( screenWidth * SCREEN_HEIGHT < screenHeight * SCREEN_WIDTH ) {
++    viewWidth = screenWidth;
++    viewHeight = screenWidth * SCREEN_HEIGHT / SCREEN_WIDTH;
++  } else {
++    viewWidth = screenWidth;
++    viewHeight = screenHeight;
++  }
++
++  glViewport((screenWidth - viewWidth) / 2, screenHeight - viewHeight, viewWidth, viewHeight);
+   glMatrixMode(GL_PROJECTION);
+   glLoadIdentity();
+-  gluPerspective(45.0f, (GLfloat)screenWidth/(GLfloat)screenHeight, 0.1f, FAR_PLANE);
++  gluPerspective(45.0f, (GLfloat)viewWidth/(GLfloat)viewHeight, 0.1f, FAR_PLANE);
+   glMatrixMode(GL_MODELVIEW);
+ }
+ 
+ void resized(int width, int height) {
+   screenWidth = width; screenHeight = height;
++  if ( SDL_SetVideoMode(width, height, 0, videoFlags) == NULL ) {
++    fprintf(stderr, "Unable to create OpenGL screen: %s\n", SDL_GetError());
++    SDL_Quit();
++    exit(2);
++  }
+   screenResized();
+ }
+ 
+@@ -110,7 +128,7 @@ static GLuint smokeTexture;
+ static GLuint titleTexture;
+ #define TITLE_BMP "title.bmp"
+ 
+-int lowres = 0;
++int resolution = MEDIUM_RESOLUTION;
+ int windowMode = 0;
+ int brightness = DEFAULT_BRIGHTNESS;
+ Uint8 *keys;
+@@ -118,11 +136,13 @@ SDL_Joystick *stick = NULL;
+ int joystickMode = 1;
+ 
+ void initSDL() {
+-  Uint32 videoFlags;
+-
+-  if ( lowres ) {
++  if ( resolution == LOW_RESOLUTION ) {
+     screenWidth  = LOWRES_SCREEN_WIDTH;
+     screenHeight = LOWRES_SCREEN_HEIGHT;
++  } else if ( resolution == HIGH_RESOLUTION ) {
++    /* SDL will pick the desktop resolution, which should be the highest possible */
++    screenWidth = 0;
++    screenHeight = 0;
+   } else {
+     screenWidth  = SCREEN_WIDTH;
+     screenHeight = SCREEN_HEIGHT;
+@@ -144,11 +164,14 @@ void initSDL() {
+   } else {
+     videoFlags = SDL_OPENGL | SDL_FULLSCREEN;
+   }
+-  if ( SDL_SetVideoMode(screenWidth, screenHeight, 0, videoFlags) == NULL ) {
++  SDL_Surface * screen = SDL_SetVideoMode(screenWidth, screenHeight, 0, videoFlags);
++  if ( screen == NULL ) {
+     fprintf(stderr, "Unable to create OpenGL screen: %s\n", SDL_GetError());
+     SDL_Quit();
+     exit(2);
+   }
++  screenWidth = screen->w;
++  screenHeight = screen->h;
+ 
+   if (joystickMode == 1) {
+     stick = SDL_JoystickOpen(0);
+diff --git a/src/screen.h b/src/screen.h
+index 46f849c..38ca485 100644
+--- a/src/screen.h
++++ b/src/screen.h
+@@ -23,13 +23,17 @@
+ 
+ #define DEFAULT_BRIGHTNESS 224
+ 
++#define MEDIUM_RESOLUTION 0
++#define LOW_RESOLUTION 1
++#define HIGH_RESOLUTION 2
++
+ extern float eyeX, eyeY, eyeZ;
+ extern float pitch, roll;
+ extern float zoom;
+ extern Uint8 *keys;
+ extern SDL_Joystick *stick;
+ extern int buttonReversed;
+-extern int lowres;
++extern int resolution;
+ extern int windowMode;
+ extern int brightness;
+ 




More information about the Pkg-games-commits mailing list