Игорь Пашев - Post a comment

Oct. 19th, 2009

[info]igorpashev

07:06 pm

Патч для игрушки PowerManga, слегка исправляющий установку,
чтение и запись параметров,
но главное — добавляющий режим holiday,
в котором бонусы так и сыплются!

diff -urdb powermanga-0.90/Makefile.am powermanga-0.90.pin/Makefile.am
--- powermanga-0.90/Makefile.am 2007-08-13 10:43:21.000000000 +0400
+++ powermanga-0.90.pin/Makefile.am 2009-10-21 00:47:22.000000000 +0400
@@ -2,6 +2,6 @@
 SUBDIRS = texts src graphics graphics/bitmap graphics/bitmap/fonts graphics/sprites graphics/sprites/guardians graphics/sprites/stars graphics/sprites/meteors graphics/sprites/spaceships data data/curves data/levels/curves_phase data/levels/grids_phase sounds sounds/handheld_console
 EXTRA_DIST = bootstrap
 
-pkgdatadir = $(mandir)
+pkgdatadir = $(mandir)/man6
 dist_pkgdata_DATA = powermanga.6
 
diff -urdb powermanga-0.90/src/bonus.c powermanga-0.90.pin/src/bonus.c
--- powermanga-0.90/src/bonus.c 2007-08-24 11:55:16.000000000 +0400
+++ powermanga-0.90.pin/src/bonus.c 2009-10-21 00:47:22.000000000 +0400
@@ -582,6 +582,30 @@
   /* test only
      btype = BONUS_INC_ENERGY;
    */
+
+  if (power_conf->holiday && btype != PENALITY_LONELY_FOE)
+  {
+    switch (rand() % 6)
+    {
+       case 0:
+          btype = BONUS_INC_BY_1;
+          break;
+       case 1:
+          btype = BONUS_INC_BY_2;
+          break;
+       case 2:
+          btype = BONUS_ADD_SATELLITE;
+          break;
+       case 3:
+          btype = BONUS_INC_ENERGY;
+          break;
+       case 4:
+          btype = BONUS_SCR_MULTIPLIER;
+          break;
+       default:
+          break;
+      }
+  }
   return btype;
 }
 
@@ -753,6 +777,30 @@
           btype = PENALITY_LONELY_FOE;
         }
     }
+
+  if (power_conf->holiday && btype != PENALITY_LONELY_FOE)
+  {
+    switch (rand() % 6)
+    {
+       case 0:
+          btype = BONUS_INC_BY_1;
+          break;
+       case 1:
+          btype = BONUS_INC_BY_2;
+          break;
+       case 2:
+          btype = BONUS_ADD_SATELLITE;
+          break;
+       case 3:
+          btype = BONUS_INC_ENERGY;
+          break;
+       case 4:
+          btype = BONUS_SCR_MULTIPLIER;
+          break;
+       default:
+          break;
+      }
+  }
   return btype;
 }
 
diff -urdb powermanga-0.90/src/config_file.c powermanga-0.90.pin/src/config_file.c
--- powermanga-0.90/src/config_file.c   2007-09-02 18:55:29.000000000 +0400
+++ powermanga-0.90.pin/src/config_file.c   2009-10-21 00:48:12.000000000 +0400
@@ -65,6 +65,7 @@
 {
   power_conf->fullscreen = TRUE;
   power_conf->nosound = FALSE;
+  power_conf->holiday = FALSE;
   power_conf->resolution = 640;
   power_conf->verbose = 0;
   power_conf->difficulty = 1;
@@ -244,10 +245,22 @@
     {
       power_conf->nosync = FALSE;
     }
+  if (!lisp_read_bool (lst, "holiday", &power_conf->holiday))
+    {
+      power_conf->holiday = FALSE;
+    }
   if (!lisp_read_int (lst, "verbose", &power_conf->verbose))
     {
       power_conf->verbose = 0;
     }
+  if (!lisp_read_int (lst, "difficulty", &power_conf->difficulty))
+    {
+      power_conf->difficulty = 1;
+    }
+  if (power_conf->difficulty < 0 || power_conf->difficulty > 2)
+    {
+      power_conf->difficulty = 1;
+    }
   if (!lisp_read_int (lst, "scale_x", &power_conf->scale_x))
     {
       power_conf->scale_x = 2;
@@ -289,6 +302,7 @@
            power_conf->fullscreen ? "#t" : "#f");
   fprintf (config, "\t(nosound %s)\n", power_conf->nosound ? "#t" : "#f");
   fprintf (config, "\t(nosync %s)\n", power_conf->nosync ? "#t" : "#f");
+  fprintf (config, "\t(holiday %s)\n", power_conf->holiday ? "#t" : "#f");
 
   fprintf (config, "\n\t;; window size (320 or 640):\n");
   fprintf (config, "\t(resolution  %d)\n", power_conf->resolution);
@@ -303,7 +317,7 @@
   fprintf (config, "\n\t;; difficulty 0 (easy), 1 (normal) or 2 (hard)\n");
   fprintf (config, "\t(difficulty   %d)\n", power_conf->difficulty);
 
-  fprintf (config, "\n\t;; langage en or fr\n");
+  fprintf (config, "\n\t;; language en or fr\n");
   fprintf (config, "\t(lang      ");
   switch (power_conf->lang)
     {
@@ -392,9 +406,13 @@
           fprintf (stdout, "\noptions:\n"
                    "-h, --help     print Help (this message) and exit\n"
                    "--version      print version information and exit\n"
+                   "\n\n"
+                   "These options will be saved to config file:\n"
                    "--320          game run in a 320*200 window (slow machine)\n"
-                   "--2x           scale2x\n"
-                   "--3x           scale3x\n" "--4x           scale4x\n");
+                   "--640          game run in a 640*480 window\n"
+                   "--2x           scale 640*480 by 2x\n"
+                   "--3x           scale 640*480 by 3x\n"
+                   "--4x           scale 640*480 by 4x\n");
 #ifdef POWERMANGA_SDL
           fprintf (stdout,
                    "--window       windowed mode (full screen by default) \n");
@@ -405,8 +423,13 @@
                    "--nosound      force no sound\n"
                    "--sound        force sound\n"
                    "--nosync       disable timer\n"
-                   "--easy         easy bonuses\n"
-                   "--hard         hard bonuses\n"
+                   "--sync         enable timer\n"
+                   "\n"
+                   "--easy         easy game\n"
+                   "--normal       normal game\n"
+                   "--hard         hard game\n"
+                   "--holiday      more bonuses!\n"
+                   "--noholiday    usual game (easy, normal or hard)\n"
                    "--------------------------------------------------------------\n"
                    "keys recognized during the game:\n"
                    "[Ctrl] + [S]   enable/disable the music\n"
@@ -517,12 +540,36 @@
           continue;
         }
 
-      /* difficulty: easy or hard (normal bu default) */
+      /* enable timer */
+      if (!strcmp (arg_values[i], "--sync"))
+        {
+          power_conf->nosync = FALSE;
+          continue;
+        }
+
+      /* more bonuses! */
+      if (!strcmp (arg_values[i], "--holiday"))
+        {
+          power_conf->holiday = TRUE;
+          continue;
+        }
+      if (!strcmp (arg_values[i], "--noholiday"))
+        {
+          power_conf->holiday = FALSE;
+          continue;
+        }
+
+      /* difficulty: easy or hard (normal by default) */
       if (!strcmp (arg_values[i], "--easy"))
         {
           power_conf->difficulty = 0;
           continue;
         }
+      if (!strcmp (arg_values[i], "--normal"))
+        {
+          power_conf->difficulty = 1;
+          continue;
+        }
       if (!strcmp (arg_values[i], "--hard"))
         {
           power_conf->difficulty = 2;
diff -urdb powermanga-0.90/src/config_file.h powermanga-0.90.pin/src/config_file.h
--- powermanga-0.90/src/config_file.h   2007-07-10 00:21:36.000000000 +0400
+++ powermanga-0.90.pin/src/config_file.h   2009-10-21 00:47:22.000000000 +0400
@@ -58,6 +58,8 @@
     Sint32 verbose;
     /** 0 = easy, 1 = normal or 2 = hard */
     Sint32 difficulty;
+    /** More bonuses! */
+    bool holiday;
     /** 0 = EN or 1 = FR */
     Sint32 lang;
   } config_file;
diff -urdb powermanga-0.90/src/Makefile.am powermanga-0.90.pin/src/Makefile.am
--- powermanga-0.90/src/Makefile.am 2007-09-01 00:46:43.000000000 +0400
+++ powermanga-0.90.pin/src/Makefile.am 2009-10-21 00:47:22.000000000 +0400
@@ -1,6 +1,6 @@
 
-gamesdir = $(prefix)/games
-scoredir = /var/games
+gamesdir = $(prefix)/bin
+scoredir = /var/lib/games
 score = powermanga.hi
 
 games_PROGRAMS = powermanga

Read Comments

Reply:

From:
(will be screened)
Identity URL: 
имя пользователя:    
Вы должны предварительно войти в LiveJournal.com
 
E-mail для ответов: 
Вы сможете оставлять комментарии, даже если не введете e-mail.
Но вы не сможете получать уведомления об ответах на ваши комментарии!
Внимание: на указанный адрес будет выслано подтверждение.
Username:
Password:
Subject:
No HTML allowed in subject
Message: