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

Comparing deliantra/server/server/quadland.C (file contents):
Revision 1.3 by root, Sun May 1 16:59:41 2011 UTC vs.
Revision 1.7 by root, Mon May 2 17:21:58 2011 UTC

21 */ 21 */
22 22
23#include <global.h> 23#include <global.h>
24 24
25#include "noise.h" 25#include "noise.h"
26
27/////////////////////////////////////////////////////////////////////////////
28
29void
30move_into_wall (object *ob, object *wall)
31{
32 bool visible = !wall->invisible && !ob->flag [FLAG_BLIND];
33
34 if (wall->flag [FLAG_IS_QUAD] && visible)
35 {
36 maptile *m = wall->map;
37
38 if (m->tile_path [TILE_UP])
39 if (maptile *up = m->tile_available (TILE_UP))
40 {
41 if (ob->blocked (up, ob->x, ob->y))
42 ob->failmsg (format ("Ouch, you hit your head while climbing the %s! H<Didn't you see the ceiling?>", query_name (wall)));
43 //TODO: reduce health
44 else if (ob->blocked (up, wall->x, wall->y))
45 ob->failmsg (format ("You try to climb up, but the %s is too high for you!", query_name (wall)));
46 //TODO: reduce health
47 else
48 {
49 ob->statusmsg (format ("You successfully climb up the %s.", query_name (wall)));
50 // here we assume that ob is a player...
51 ob->enter_map (up, wall->x, wall->y);
52 }
53 }
54 else
55 ob->failmsg (format ("You try to climb the %s, but you fall down! H<Try again.>", query_name (wall)));
56 else
57 ob->failmsg (format ("You fail to climb up the %s! H<You cannot climb up here.>", query_name (wall)));
58
59
60 return;
61 }
62
63 if (ob->contr->ns->bumpmsg)
64 {
65 ob->play_sound (sound_find ("bump_wall"));
66
67 ob->statusmsg (visible
68 ? format ("You bump into the %s.", query_name (wall))
69 : "You bump into something."
70 );
71 }
72}
73
74/////////////////////////////////////////////////////////////////////////////
26 75
27#define FANCY_GRAPHICS 0 76#define FANCY_GRAPHICS 0
28 77
29static void 78static void
30gen_quadspace (maptile *m, int mx, int my, int x, int y, int z) 79gen_quadspace (maptile *m, int mx, int my, int x, int y, int z)
72 T_OCEAN, 121 T_OCEAN,
73 T_RIVER, 122 T_RIVER,
74 T_VALLEY, 123 T_VALLEY,
75 T_MOUNTAIN, 124 T_MOUNTAIN,
76 T_UNDERGROUND, 125 T_UNDERGROUND,
126 T_AIR, // unused
77 T_ACQUIFER, 127 T_ACQUIFER,
78 } t = T_NONE; 128 } t = T_NONE;
79 129
80 vec3d c; 130 vec3d c;
81 int h0 = 0; // "water level" 131 int h0 = 0; // "water level"
135 185
136 max_it (h0, h); 186 max_it (h0, h);
137 187
138 // everything below the surface is underground, or a variant 188 // everything below the surface is underground, or a variant
139 if (z < h) 189 if (z < h)
140 {
141 t = T_UNDERGROUND; 190 t = T_UNDERGROUND;
142 }
143 191
144 // put acquifers a bit below the surface, to reduce them leaking out (will still happen) 192 // put acquifers a bit below the surface, to reduce them leaking out (will still happen)
145 if (z < h - 3) 193 if (z < h - 3)
146 { 194 {
147 static frac3d acquifer_gen (4); 195 static frac3d acquifer_gen (4);
168 putc (clamp<int> (255 * c[2], 0, 255), stdout); 216 putc (clamp<int> (255 * c[2], 0, 255), stdout);
169#else 217#else
170 shstr arch_floor = shstr ("quad_open_space"); 218 shstr arch_floor = shstr ("quad_open_space");
171 shstr arch_wall; 219 shstr arch_wall;
172 220
221 // TODO: this is shit - we should never generatea water surface, but only
222 // water above the surface
173 switch (t) 223 switch (t)
174 { 224 {
175 case T_OCEAN: 225 case T_OCEAN:
226 if (z < h0)
227 arch_wall = shstr ("quad_water_wall");
228 else if (z == h0)
229 arch_floor = shstr ("quad_ocean_floor");
230 break;
231
176 case T_RIVER: 232 case T_RIVER:
177 if (z < h0) 233 if (z < h0)
178 arch_wall = shstr ("quad_water_wall"); 234 arch_wall = shstr ("quad_water_wall");
235 else if (z == h0)
236 arch_floor = shstr ("quad_water_floor");
179 break; 237 break;
180 238
181 case T_VALLEY: 239 case T_VALLEY:
182 if (z == h) 240 if (z == h)
183 arch_floor = shstr ("quad_dirt_floor"); 241 arch_floor = shstr ("quad_dirt_floor");
227 for (int mx = 0; mx < 50; ++mx) 285 for (int mx = 0; mx < 50; ++mx)
228 for (int my = 0; my < 50; ++my) 286 for (int my = 0; my < 50; ++my)
229 gen_quadspace (m, mx, my, x + mx, y + my, z); 287 gen_quadspace (m, mx, my, x + mx, y + my, z);
230} 288}
231 289
290/////////////////////////////////////////////////////////////////////////////
291
232void noise_test (); 292void noise_test ();
233void noise_test () 293void noise_test ()
234{ 294{
235#if 1 295#if 1
236 int Nw = 700; 296 int Nw = 700;

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines