ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/deliantra/server/random_maps/random_map.h
Revision: 1.8
Committed: Sun Dec 31 22:23:12 2006 UTC (17 years, 5 months ago) by root
Content type: text/plain
Branch: MAIN
Changes since 1.7: +2 -0 lines
Log Message:
- random maps seem to work now
- had to move map parameters into files because we need constant-sized map path lengths
  as the full map stack history would have to be included.

File Contents

# Content
1 /*
2 * CrossFire, A Multiplayer game for X-windows
3 *
4 * Copyright (C) 2001 Mark Wedel & Crossfire Development Team
5 * Copyright (C) 1992 Frank Tore Johansen
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 2 of the License, or
10 * (at your option) any later version.
11 *
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, write to the Free Software
19 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
20 *
21 * The authors can be reached via e-mail at crossfire@schmorp.de
22 */
23
24 #ifndef RANDOM_MAP_H
25 #define RANDOM_MAP_H
26
27 struct random_map_params
28 {
29 char wallstyle[512];
30 char wall_name[512];
31 char floorstyle[512];
32 char monsterstyle[512];
33 char treasurestyle[512];
34 char layoutstyle[512];
35 char doorstyle[512];
36 char decorstyle[512];
37 shstr origin_map;
38 shstr final_map;
39 char exitstyle[512];
40 shstr this_map;
41 char exit_on_final_map[512];
42
43 int Xsize;
44 int Ysize;
45 int expand2x;
46 int layoutoptions1;
47 int layoutoptions2;
48 int layoutoptions3;
49 int symmetry;
50 int difficulty;
51 int difficulty_given;
52 float difficulty_increase;
53
54 int dungeon_level;
55 int dungeon_depth;
56
57 int decoroptions;
58 int orientation;
59 int origin_y;
60 int origin_x;
61 int random_seed;
62 uint64_t total_map_hp;
63 int map_layout_style;
64 int treasureoptions;
65 int symmetry_used;
66
67 struct region *region;
68 };
69
70 enum {
71 LAYOUT_NONE,
72 LAYOUT_ONION,
73 LAYOUT_MAZE,
74 LAYOUT_SPIRAL,
75 LAYOUT_ROGUELIKE,
76 LAYOUT_SNAKE,
77 LAYOUT_SQUARE_SPIRAL,
78 NROFLAYOUTS,
79 };
80
81 /*
82 * Move these defines out of room_gen_onion.c to here, as
83 * other files (like square_spiral) also uses them.
84
85 options:
86 0 Pick random options below
87 1 "centered"
88 2 linear doors (default is nonlinear)
89 4 bottom "centered"
90 8 bottom-right centered
91 16 irregularly/randomly spaced layers (default: regular)
92 32 outer wall off: i.e., no outer wall.
93
94 */
95
96 enum {
97 RMOPT_RANDOM = 0,
98 RMOPT_CENTERED = 1,
99 RMOPT_LINEAR = 2,
100 RMOPT_BOTTOM_C = 4,
101 RMOPT_BOTTOM_R = 8,
102 RMOPT_IRR_SPACE = 16,
103 RMOPT_WALL_OFF = 32,
104 RMOPT_WALLS_ONLY = 64,
105 RMOPT_NO_DOORS = 256, /* Place walls insead of doors. Produces broken map. */
106 };
107
108 /* symmetry definitions--used in this file AND in treasure.c:
109 the numerical values matter so don't change them. */
110 enum {
111 SYMMETRY_RANDOM,
112 SYMMETRY_NONE,
113 SYMMETRY_X,
114 SYMMETRY_Y,
115 SYMMETRY_XY,
116 };
117
118 #define MIN_RANDOM_MAP_SIZE 10
119
120 /* a macro to get a strongly centered random distribution,
121 from 0 to x, centered at x/2 */
122 #define BC_RANDOM(x) ((int) ((RANDOM() % (x)+RANDOM()%(x)+RANDOM()%(x))/3.))
123
124 #endif
125