1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88
|
Description: fix score display and add nosound
Print very large scores correctly and add a nosound option.
Author: Zack Weinberg <zack@codesourcery.com>
Bug-Debian: http://bugs.debian.org/115203
Reviewed-By: Christian T. Steigies <cts@debian.org>
Last-Update: 2001-10-14
--- gemdropx-0.9.orig/gemdropx.c
+++ gemdropx-0.9/gemdropx.c
@@ -29,6 +29,7 @@
#include <sys/types.h>
#include <sys/time.h>
#include <unistd.h>
+#include <errno.h>
#ifndef EMBEDDED
#include <SDL.h>
@@ -720,8 +721,6 @@ void setup(int argc, char * argv[])
/* Setup sound: */
- use_sound = 1;
-
#ifndef NOSOUND
if (use_sound)
{
@@ -788,14 +787,13 @@ void setup(int argc, char * argv[])
void shownumber(int num, int x, int y)
{
int i;
- char temp[15];
+ char temp[11];
+ /* 32-bit integer needs 10 characters, plus one for the null. */
SDL_Rect src, dest;
- num = (num % 100000);
+ sprintf(temp, "%-10u", num);
- sprintf(temp, "%d ", num);
-
- for (i = 0; i < 5; i++)
+ for (i = 0; i < 10; i++)
{
dest.x = x + i * 16;
dest.y = y;
@@ -1154,7 +1152,9 @@ int title(void)
/* Draw the currently-selected level: */
updatelevel();
-
+
+ /* Draw the score, so that it stays visible from a previous round. */
+ drawscore();
/* Init. animation variables: */
@@ -2146,7 +2146,8 @@ void play()
oact = 0 ;
score = 0;
-
+ drawscore();
+
/* Draw you! */
drawyou(playerx);
@@ -2562,7 +2563,8 @@ int main(int argc, char * argv[])
no_music = 0;
-
+ use_sound = 1;
+
if (argc == 2)
{
/* --version or --help?? */
@@ -2630,6 +2632,11 @@ int main(int argc, char * argv[])
else if (strcmp(argv[1], "--nomusic") == 0)
{
no_music = 1;
+ }
+ else if (strcmp(argv[1], "--nosound") == 0)
+ {
+ use_sound = 0;
+ no_music = 1;
}
else if (strcmp(argv[1], "--usage") == 0)
{
|