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.6 by pippijn, Sat Jan 6 14:42:30 2007 UTC vs.
Revision 1.9 by root, Sat Jan 27 02:19:37 2007 UTC

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

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines