/***************************************************************************** * const.c * *****************************************************************************/ // Replace const struct class_type class_table [MAX_CLASS] = { etc. // With struct class_type class_table [MAX_CLASS]; // Replace const struct skill_type skill_table [MAX_SKILL] = // With struct skill_type skill_table [MAX_SKILL] = // Go through your skill_table definition and replace all the class levels and // class difficulty with {}, for example, the following { "acid blast", { 28, 53, 35, 32 }, { 1, 1, 2, 2 }, spell_acid_blast, TAR_CHAR_OFFENSIVE, POS_FIGHTING, NULL, SLOT(70), 20, 12, "acid blast", "!Acid Blast!" }, // would be replaced with { "acid blast", {}, {}, spell_acid_blast, TAR_CHAR_OFFENSIVE, POS_FIGHTING, NULL, SLOT(70), 20, 12, "acid blast", "!Acid Blast!" }, /***************************************************************************** * End const.c * *****************************************************************************/ /***************************************************************************** * db.c * *****************************************************************************/ /* * void boot_db ************************************************************* */ // After /* * Assign gsn's for skills which have them. */ { int sn; log_string( "Assinging gsn's." ); for ( sn = 0; sn < MAX_SKILL; sn++ ) { if ( skill_table[sn].pgsn != NULL ) *skill_table[sn].pgsn = sn; } } // Add the following 4 lines /* * Load the classes. */ load_classes(); /* * End boot_db *************************************************************** */ /***************************************************************************** * End db.c * *****************************************************************************/ /***************************************************************************** * db2.c * *****************************************************************************/ // Add all the lines in this section to the end of the file void load_classes( void ) { FILE *fp; char buf[MAX_STRING_LENGTH]; int class, i; /* Initialize Skill levels */ { int sn, i; for ( sn = 0; sn < MAX_SKILL; sn++ ) { if ( skill_table[sn].name == NULL ) break; for( i = 0; i < MAX_CLASS; i++ ) { skill_table[sn].skill_level[i] = LEVEL_IMMORTAL; skill_table[sn].rating[i] = 0; } } } for( class = 0; class < MAX_CLASS; class++ ) { switch (class) { case 0: sprintf( buf, "%smage.class", CLASS_DIR ); log_string( "Loading Mage." ); break; case 1: sprintf( buf, "%scleric.class", CLASS_DIR ); log_string( "Loading Cleric." ); break; case 2: sprintf( buf, "%sthief.class", CLASS_DIR ); log_string( "Loading Thief." ); break; case 3: sprintf( buf, "%swarrior.class", CLASS_DIR ); log_string( "Loading Warrior." ); break; } if ( (fp = fopen( buf, "r" )) == NULL ) { log_string( "Error opening class file." ); exit(1); } for ( ;; ) { char letter; char *word; letter = fread_letter( fp ); if ( letter == '*' ) { fread_to_eol( fp ); continue; } if ( letter != '#' ) { bug( "Load_classes: # not found.", 0 ); break; } word = fread_word( fp ); if ( !str_cmp( word, "CLASS" ) ) { char *field; for ( ;; ) { field = fread_word( fp ); if ( !str_cmp( field, "Name" ) ) class_table[class].name = fread_string( fp ); else if ( !str_cmp( field, "WhoN" ) ) { for( i = 0; i < 3; i++ ) class_table[class].who_name[i] = fread_letter( fp ); } else if( !str_cmp( field, "Prime" ) ) class_table[class].attr_prime = fread_number( fp ); else if ( !str_cmp( field, "Weapon" ) ) class_table[class].weapon = fread_number( fp ); else if ( !str_cmp( field, "Guild1" ) ) class_table[class].guild[0] = fread_number( fp ); else if ( !str_cmp( field, "Guild2" ) ) class_table[class].guild[1] = fread_number( fp ); else if ( !str_cmp( field, "Skill" ) ) class_table[class].skill_adept = fread_number( fp ); else if ( !str_cmp( field, "Thac00" ) ) class_table[class].thac0_00 = fread_number( fp ); else if ( !str_cmp( field, "Thac32" ) ) class_table[class].thac0_32 = fread_number( fp ); else if ( !str_cmp( field, "HPMin" ) ) class_table[class].hp_min = fread_number( fp ); else if ( !str_cmp( field, "HPMax" ) ) class_table[class].hp_max = fread_number( fp ); else if ( !str_cmp( field, "FMana" ) ) class_table[class].fMana = fread_number( fp ); else if ( !str_cmp( field, "Base" ) ) class_table[class].base_group = fread_string( fp ); else if ( !str_cmp( field, "Default" ) ) class_table[class].default_group = fread_string( fp ); else if ( !str_cmp( field, "End" ) ) break; } } else if ( !str_cmp( word, "SKILLS" ) ) { int sn; char *spell; for ( ;; ) { spell = fread_string( fp ); if ( !str_cmp( spell, "End" ) ) break; for ( sn = 0; sn < MAX_SKILL; sn++ ) { if ( skill_table[sn].name == NULL ) break; if ( !str_cmp( spell, skill_table[sn].name ) ) { skill_table[sn].skill_level[class] = fread_number( fp ); skill_table[sn].rating[class] = fread_number( fp ); break; } } } } else if ( !str_cmp( word, "END" ) ) { fclose( fp ); break; } } } } /***************************************************************************** * End db2.c * *****************************************************************************/ /***************************************************************************** * merc.h * *****************************************************************************/ // Replace extern const struct class_type class_table [MAX_CLASS]; // With extern struct class_type class_table [MAX_CLASS]; // Replace extern const struct skill_type skill_table [MAX_SKILL]; // With extern struct skill_type skill_table [MAX_SKILL]; // Right below #define AREA_LIST "area.lst" /* List of areas*/ // Add the following line if you change the directory you store your class // files in, be sure to change this to the directory you store them in #define CLASS_DIR "../data/class/" /* Class files */ // Right before /* effect.c */ // Add the following 2 lines /* db2.c */ void load_classes args( (void) ); /***************************************************************************** * End merc.h * *****************************************************************************/