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.16 by root, Mon Oct 12 14:00:58 2009 UTC vs.
Revision 1.19 by root, Fri Mar 26 01:04:44 2010 UTC

1/* 1/*
2 * This file is part of Deliantra, the Roguelike Realtime MMORPG. 2 * This file is part of Deliantra, the Roguelike Realtime MMORPG.
3 * 3 *
4 * Copyright (©) 2005,2006,2007,2008 Marc Alexander Lehmann / Robin Redeker / the Deliantra team 4 * Copyright (©) 2005,2006,2007,2008,2009,2010 Marc Alexander Lehmann / Robin Redeker / the Deliantra team
5 * Copyright (©) 1994,2007 Mark Wedel 5 * Copyright (©) 1994 Mark Wedel
6 * Copyright (©) 1992,2007 Frank Tore Johansen 6 * Copyright (©) 1992 Frank Tore Johansen
7 * 7 *
8 * Deliantra is free software: you can redistribute it and/or modify it under 8 * Deliantra is free software: you can redistribute it and/or modify it under
9 * the terms of the Affero GNU General Public License as published by the 9 * the terms of the Affero GNU General Public License as published by the
10 * Free Software Foundation, either version 3 of the License, or (at your 10 * Free Software Foundation, either version 3 of the License, or (at your
11 * option) any later version. 11 * option) any later version.
28char **map_gen_spiral(int xsize, int ysize, int option); 28char **map_gen_spiral(int xsize, int ysize, int option);
29*/ 29*/
30 30
31#include <global.h> 31#include <global.h>
32#include <random_map.h> 32#include <random_map.h>
33#include <rproto.h>
33 34
34#define RANDOM_OPTIONS 0 /* Pick random options below */ 35#define RANDOM_OPTIONS 0 /* Pick random options below */
35#define REGULAR_SPIRAL 1 /* Regular spiral--distance increases constantly */ 36#define REGULAR_SPIRAL 1 /* Regular spiral--distance increases constantly */
36#define FINE_SPIRAL 2 /* uses the min. separation: most coiling */ 37#define FINE_SPIRAL 2 /* uses the min. separation: most coiling */
37#define FIT_SPIRAL 4 /* scale to a rectangular region, not square */ 38#define FIT_SPIRAL 4 /* scale to a rectangular region, not square */
38#define MAX_SPIRAL_OPT 8 /* this should be 2x the last real option */ 39#define MAX_SPIRAL_OPT 8 /* this should be 2x the last real option */
39#include <math.h>
40
41#ifndef MIN
42# define MIN(x,y) (((x)<(y))? (x):(y))
43#endif
44#ifndef MAX
45# define MAX(x,y) (((x)<(y))? (y):(x))
46#endif
47 40
48#define MINDIST 3 41#define MINDIST 3
49 42
50#define MAX_FINE .454545 43#define MAX_FINE .454545
51 44
107 yscale *= (float) ysize / (float) xsize; 100 yscale *= (float) ysize / (float) xsize;
108 } 101 }
109 102
110 if (option & REGULAR_SPIRAL) 103 if (option & REGULAR_SPIRAL)
111 { 104 {
112 float scale = MIN (xscale, yscale); 105 float scale = min (xscale, yscale);
113 106
114 xscale = yscale = scale; 107 xscale = yscale = scale;
115 } 108 }
116 109
117 /* cut out the spiral */ 110 /* cut out the spiral */

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines