ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/deliantra/server/random_maps/room_gen_spiral.C
(Generate patch)

Comparing deliantra/server/random_maps/room_gen_spiral.C (file contents):
Revision 1.5 by root, Sun Dec 31 19:02:24 2006 UTC vs.
Revision 1.11 by root, Thu Nov 8 19:43:25 2007 UTC

1
2/* 1/*
3 CrossFire, A Multiplayer game for X-windows 2 * This file is part of Deliantra, the Roguelike Realtime MMORPG.
4 3 *
4 * Copyright (©) 2005,2006,2007 Marc Alexander Lehmann / Robin Redeker / the Deliantra team
5 Copyright (C) 1994 Mark Wedel 5 * Copyright (©) 1994,2007 Mark Wedel
6 Copyright (C) 1992 Frank Tore Johansen 6 * Copyright (©) 1992,2007 Frank Tore Johansen
7 7 *
8 This program is free software; you can redistribute it and/or modify 8 * Deliantra is free software: you can redistribute it and/or modify
9 it under the terms of the GNU General Public License as published by 9 * it under the terms of the GNU General Public License as published by
10 the Free Software Foundation; either version 2 of the License, or 10 * the Free Software Foundation, either version 3 of the License, or
11 (at your option) any later version. 11 * (at your option) any later version.
12 12 *
13 This program is distributed in the hope that it will be useful, 13 * This program is distributed in the hope that it will be useful,
14 but WITHOUT ANY WARRANTY; without even the implied warranty of 14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 GNU General Public License for more details. 16 * GNU General Public License for more details.
17 17 *
18 You should have received a copy of the GNU General Public License 18 * You should have received a copy of the GNU General Public License
19 along with this program; if not, write to the Free Software 19 * along with this program. If not, see <http://www.gnu.org/licenses/>.
20 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 20 *
21 21 * The authors can be reached via e-mail to <support@deliantra.net>
22 The author can be reached via e-mail to mark@pyramid.com
23*/ 22 */
24
25 23
26/* The onion room generator: 24/* The onion room generator:
27Onion rooms are like this: 25Onion rooms are like this:
28 26
29char **map_gen_spiral(int xsize, int ysize, int option); 27char **map_gen_spiral(int xsize, int ysize, int option);
82 SizeY = ysize / 2 - 2; 80 SizeY = ysize / 2 - 2;
83 81
84 /* select random options if necessary */ 82 /* select random options if necessary */
85 if (option == 0) 83 if (option == 0)
86 { 84 {
87 option = RANDOM () % MAX_SPIRAL_OPT; 85 option = rndm (MAX_SPIRAL_OPT);
88 } 86 }
89 87
90 /* the order in which these are evaluated matters */ 88 /* the order in which these are evaluated matters */
91 89
92 /* the following two are mutually exclusive. 90 /* the following two are mutually exclusive.
93 pick one if they're both set. */ 91 pick one if they're both set. */
94 if ((option & REGULAR_SPIRAL) && (option & FIT_SPIRAL)) 92 if ((option & REGULAR_SPIRAL) && (option & FIT_SPIRAL))
95 { 93 {
96 /* unset REGULAR_SPIRAL half the time */ 94 /* unset REGULAR_SPIRAL half the time */
97 if (RANDOM () % 2 && (option & REGULAR_SPIRAL)) 95 if (rndm (2) && (option & REGULAR_SPIRAL))
98 option -= REGULAR_SPIRAL; 96 option -= REGULAR_SPIRAL;
99 else 97 else
100 option -= FIT_SPIRAL; 98 option -= FIT_SPIRAL;
101 } 99 }
102 100
103 xscale = yscale = MAX_FINE; /* fine spiral */ 101 xscale = yscale = MAX_FINE; /* fine spiral */
104 102
105 /* choose the spiral pitch */ 103 /* choose the spiral pitch */
106 if (!(option & FINE_SPIRAL)) 104 if (!(option & FINE_SPIRAL))
107 { 105 {
108 float pitch = (RANDOM () % 5) / 10. + 10. / 22.; 106 float pitch = (rndm (5)) / 10. + 10. / 22.;
109 107
110 xscale = yscale = pitch; 108 xscale = yscale = pitch;
111 } 109 }
112 110
113 if ((option & FIT_SPIRAL) && (xsize != ysize)) 111 if ((option & FIT_SPIRAL) && (xsize != ysize))

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines