Changeset 566

Show
Ignore:
Timestamp:
09/17/07 07:47:35 (1 year ago)
Author:
takkaria
Message:

Attempt to make more varied-size dungeons.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/src/generate.c

    r557 r566  
    2525 
    2626 
    27  
    28 /* 
    29  * Level generation is not an important bottleneck, though it can be  
    30  * annoyingly slow on older machines...  Thus we emphasize simplicity  
    31  * and correctness over speed.  See individual functions for notes. 
    32  * 
    33  * This entire file is only needed for generating levels. 
    34  * This may allow smart compilers to only load it when needed. 
    35  * 
    36  * The "vault.txt" file is used to store vault generation info. 
    37  */ 
    38  
    39  
    4027/* 
    4128 * Dungeon generation values 
    4229 */ 
    43 #define DUN_ROOMS                       30      /* Number of rooms to attempt */ 
     30#define DUN_ROOMS_MIN  10 
     31#define DUN_ROOMS_MAX  30 
     32 
     33 
     34 
    4435#define DEST_LEVEL_CHANCE       30      /* 1/chance of being a destroyed level */ 
    4536 
     
    10192 * These bounds are checked, though usually this is a formality. 
    10293 */ 
    103 #define CENT_MAX        DUN_ROOMS 
     94#define CENT_MAX        DUN_ROOMS_MAX 
    10495#define DOOR_MAX        100 
    10596#define WALL_MAX        40 
     
    32253216 
    32263217        /* No special limit on ordinary rooms. */ 
    3227         if (room_type == 1) return (DUN_ROOMS); 
     3218        if (room_type == 1) return (DUN_ROOMS_MAX); 
    32283219 
    32293220 
     
    32533244        num_tries = 3 * base_num / 100; 
    32543245        if (num_tries < 2) num_tries = (base_num < 12 ? 1 : 2); 
    3255         if (num_tries > DUN_ROOMS / 2) num_tries = DUN_ROOMS / 2; 
     3246        if (num_tries > DUN_ROOMS_MAX / 2) num_tries = DUN_ROOMS_MAX / 2; 
    32563247 
    32573248 
     
    45114502        int rooms_built = 0; 
    45124503 
     4504        int max_rooms = rand_range(DUN_ROOMS_MIN, DUN_ROOMS_MAX); 
     4505 
    45134506        /* Build rooms in descending order of difficulty. */ 
    45144507        byte room_build_order[ROOM_MAX] = {7, 6, 5, 4, 3, 2, 1, 0}; 
     
    45934586                { 
    45944587                        /* Stop building rooms when we hit the maximum. */ 
    4595                         if (rooms_built >= DUN_ROOMS) break; 
     4588                        if (rooms_built >= max_rooms) break; 
    45964589 
    45974590                        /* Build the room. */