home *** CD-ROM | disk | FTP | other *** search
/ 1,000 Games (Collectors Edition) - Disc 2 / 1000GamesDisc2.iso / solution / editors / eye / eob_fix.c < prev    next >
Encoding:
C/C++ Source or Header  |  1992-03-20  |  5.7 KB  |  180 lines

  1. /**************************************************************/
  2. /*    Goodies Generator for Eye of the Beholder               */
  3. /*    *****************************************               */
  4. /*                                                            */
  5. /*    Garry J. Vass
  6.       Frankfurt, Germany
  7.  
  8.       Notes:
  9.       This program fills the packs of EOB characters with
  10.       those "hard to find" items, great weapons and armor,
  11.       potions, scrolls, and so forth.
  12.       
  13.       The source code is given for two reasons:  first to
  14.       examine to assure that it is virus free; second to 
  15.       assure that it is used as intended - see my note
  16.       below...
  17.       
  18.       Use it at your own risk.  I have no liability for
  19.       any outcome, even to the extent that the program
  20.       does what it says.
  21.       
  22.       A further caution.  The immediate temptation is to
  23.       run this program several times, check out your
  24.       goodies in EOB, and then drop the things you don't
  25.       need on the dungeon floor.  Sooner or later, you'll
  26.       build up a pile of discarded items so large that
  27.       EOB will crash.  A better ploy is to move to different
  28.       levels and drop things discretely.  
  29.       
  30.       Another note.  Since you now have an unlimited supply
  31.       of scrolls and potions, they can be used as "pathway
  32.       markers" when exploring new dungeon areas!  For some
  33.       reason, however, these discarded items are not retained 
  34.       between game sessions.
  35.       
  36.       I found the program to compile clean under Borland
  37.       and Zortech.  If you want to use it, but do not 
  38.       have a compiler, simply request a friend or
  39.       colleague to provide you with an executable
  40.       version.
  41.       
  42.       Last note.  There is nothing magic about the tables
  43.       below.  There are many more scrolls, for example, 
  44.       than those given in the table.  Items start at
  45.       1 and continue through 445.  Feel free to experiment
  46.       around!
  47.           
  48. ***************************************************************/
  49. int Scrolls[] = {
  50. 213,214,218,220,222,223,234,241,251,252,253,
  51. 258,261,264,267,271,278,281,283,288,289,290,
  52. 300,307,308,245, -1 };
  53. int Armor[] =  {
  54. 273,171,209,304,294,232,43,
  55. 296,292,293,44,297,269,266, -1 };
  56. int Weapons[] = {
  57. 349,329,346,45,336,380,442,443,49,274,208,
  58. 262,231,257,67,215,38,291,177,255,256,295, -1  };
  59. int Wands[] = {
  60. 272,309,299,306,210,210,21,32, -1 };
  61. int Heavy_magic[] = {
  62. 332,326,333,319,317,318,316,322,320,390,407, -1 };
  63. int Keys[] =  {
  64. 313,260,82,324,337,80,303,376,400, -1 };
  65. int Potions_food[] = {
  66. 386,387,379,392,315,372,430,398,397,396,
  67. 406,403,421,404, -1 };
  68. int Pot_luck[ 20 ];
  69. #include  <stdio.h>
  70. #include     <io.h>
  71. #include  <fcntl.h>
  72. #include <stdlib.h>
  73. #include <string.h>
  74. #include  <ctype.h>
  75. #include  <conio.h>
  76. int  Stuff[ 4 ] = { 123, 366, 609, 852 };
  77. int Packs[ 14 ];
  78. char Buf[ 1000 ];
  79. int *Ibuf;
  80. int getopts( void )
  81. {
  82. int s;
  83. int i;
  84. char ch;
  85.     printf( "Selections available...\n" );
  86.     printf( "A.  Scrolls\n" );
  87.     printf( "B.  Weapons\n" );
  88.     printf( "C.  Armor\n" );
  89.     printf( "D.  Potions/food\n" );
  90.     printf( "E.  Keys\n" );
  91.     printf( "F.  Wands\n" );
  92.     printf( "G.  Desparato\n" );
  93.     printf( "H.  Grab bag\n" );
  94.     printf( "Your choice... ->  " );
  95.     ch = toupper( getch() );
  96.     printf( "\n\n" );
  97.     switch( ch ) {
  98.             case 'A':
  99.                  Ibuf = Scrolls;
  100.                  break;
  101.             case 'B':
  102.                  Ibuf = Weapons;
  103.                  break;
  104.             case 'C':
  105.                  Ibuf = Armor;
  106.                  break;
  107.             case 'D':
  108.                  Ibuf = Potions_food;
  109.                  break;
  110.             case 'E':
  111.                  Ibuf = Keys;
  112.                  break;
  113.             case 'F':
  114.                  Ibuf = Wands;
  115.                  break;
  116.             case 'G':
  117.                  Ibuf = Heavy_magic;
  118.                  break;
  119.             case 'H':
  120.                  Ibuf = Pot_luck;
  121.                  s = random( 255 );
  122.                  for( i = 0; i < 20; i++ ) {
  123.                       Pot_luck[ i ] = s++;
  124.                  }
  125.                  Pot_luck[ 19 ] = -1;
  126.                  break;
  127.             default:
  128.                  printf( "Try again later\n" );
  129.                  exit( 0 );
  130.     }
  131.     return( ch );
  132. }
  133. int Total = 0;
  134. int main( int argc, char *argv[] )
  135. {
  136. int i;
  137. int h;
  138. int a;
  139. int p = 0;
  140.     if( argc ) {
  141.         strcpy( Buf, argv[ 1 ] );
  142.         strupr( Buf );
  143.         h = open( "eobdata.sav", O_RDWR | O_BINARY );
  144.         if( h > 1 ) {
  145.             int r = read( h, Buf, 980 ); // 4 characters
  146.             if( r == 980 ) {
  147.                 getopts();
  148.                 for( i = 0; i < 4; i++ ) {
  149.                      memmove( Packs, Buf + Stuff[ i ], sizeof( int ) * 14 );
  150.                      for( a = 0; a < 14; a++ ) {
  151.                           if( Packs[ a ] == 0 ) {
  152.                               Packs[ a ] = Ibuf[ p ];
  153.                               ++Total;
  154.                           }
  155.                           ++p;
  156.                           if( Ibuf[ p ] < 0 ) {
  157.                               p = 0;
  158.                           } 
  159.                      }
  160.                      memmove( Buf + Stuff[ i ], Packs, sizeof( int ) * 14 );
  161.                 }
  162.                 lseek( h, 0, SEEK_SET );
  163.                 write( h, Buf, r );
  164.  
  165.             } else {
  166.                 printf( "Cannot locate characters\n" );
  167.             }
  168.             close( h );
  169.             printf( "%d items delivered\n", Total );
  170.         } else {
  171.             printf( "Cannot locate file!\n" );
  172.         }
  173.     } else {
  174.         printf( "No starting point defined\n" );
  175.     }
  176.     return( 0 );
  177.  
  178. }
  179.  
  180.