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.5 by root, Mon May 2 16:55:38 2011 UTC vs.
Revision 1.8 by root, Tue May 3 17:12:15 2011 UTC

24 24
25#include "noise.h" 25#include "noise.h"
26 26
27///////////////////////////////////////////////////////////////////////////// 27/////////////////////////////////////////////////////////////////////////////
28 28
29static bool
30has_floor (maptile *m, sint16 x, sint16 y)
31{
32 mapxy pos (m, x, y);
33
34 if (!pos.normalise ())
35 return true;
36
37 mapspace &ms = pos.ms ();
38
39 for (object *ob = ms.bot; ob; ob = ob->above)
40 if (ob->arch->archname == shstr_quad_open_space)
41 return false;
42 else if (ob->flag [FLAG_IS_FLOOR])
43 return true;
44
45 return false;
46}
47
29void 48void
30move_into_wall (object *ob, object *wall) 49move_into_wall (object *ob, object *wall)
31{ 50{
32 bool visible = !wall->invisible && !ob->flag [FLAG_BLIND]; 51 bool visible = !wall->invisible && !ob->flag [FLAG_BLIND];
33 52
34 if (wall->flag [FLAG_IS_QUAD] && visible) 53 if (wall->flag [FLAG_IS_QUAD] && visible)
35 { 54 {
36 maptile *m = wall->map; 55 maptile *m = wall->map;
37 printf ("hi\n");//D
38 56
39 if (m->tile_path [TILE_UP]) 57 if (m->tile_path [TILE_UP])
40 if (maptile *up = m->tile_available (TILE_UP)) 58 if (maptile *up = m->tile_available (TILE_UP))
41 { 59 {
42 if (ob->blocked (up, ob->x, ob->y)) 60 if (ob->blocked (up, ob->x, ob->y) || has_floor (up, ob->x, ob->y))
43 ob->failmsg (format ("Ouch, you hit your head while climbing the %s! H<Didn't you see the ceiling?>", query_name (wall))); 61 ob->failmsg (format ("Ouch, you hit your head while climbing the %s! H<Didn't you see the ceiling?>", query_name (wall)));
44 //TODO: reduce health 62 //TODO: reduce health
45 else if (ob->blocked (up, wall->x, wall->y)) 63 else if (ob->blocked (up, wall->x, wall->y))
46 ob->failmsg (format ("You try to climb up, but the %s is too high for you!", query_name (wall))); 64 ob->failmsg (format ("You try to climb up, but the %s is too high for you!", query_name (wall)));
47 //TODO: reduce health 65 //TODO: reduce health
72 } 90 }
73} 91}
74 92
75///////////////////////////////////////////////////////////////////////////// 93/////////////////////////////////////////////////////////////////////////////
76 94
95// this mapspace has changed - potentialyl activate dormant physics objects
96// in the vicinity
97
98void update_physics (maptile *m, int x, int y)
99{
100}
101
102// handle physics updates
103void move_physics (object *ob)
104{
105}
106
107/////////////////////////////////////////////////////////////////////////////
108
77#define FANCY_GRAPHICS 0 109#define FANCY_GRAPHICS 0
78 110
79static void 111static void
80gen_quadspace (maptile *m, int mx, int my, int x, int y, int z) 112gen_quadspace (maptile *m, int mx, int my, int x, int y, int z)
81{ 113{
122 T_OCEAN, 154 T_OCEAN,
123 T_RIVER, 155 T_RIVER,
124 T_VALLEY, 156 T_VALLEY,
125 T_MOUNTAIN, 157 T_MOUNTAIN,
126 T_UNDERGROUND, 158 T_UNDERGROUND,
159 T_AIR, // unused
127 T_ACQUIFER, 160 T_ACQUIFER,
128 } t = T_NONE; 161 } t = T_NONE;
129 162
130 vec3d c; 163 vec3d c;
131 int h0 = 0; // "water level" 164 int h0 = 0; // "water level"
185 218
186 max_it (h0, h); 219 max_it (h0, h);
187 220
188 // everything below the surface is underground, or a variant 221 // everything below the surface is underground, or a variant
189 if (z < h) 222 if (z < h)
190 {
191 t = T_UNDERGROUND; 223 t = T_UNDERGROUND;
192 }
193 224
194 // put acquifers a bit below the surface, to reduce them leaking out (will still happen) 225 // put acquifers a bit below the surface, to reduce them leaking out (will still happen)
195 if (z < h - 3) 226 if (z < h - 3)
196 { 227 {
197 static frac3d acquifer_gen (4); 228 static frac3d acquifer_gen (4);
218 putc (clamp<int> (255 * c[2], 0, 255), stdout); 249 putc (clamp<int> (255 * c[2], 0, 255), stdout);
219#else 250#else
220 shstr arch_floor = shstr ("quad_open_space"); 251 shstr arch_floor = shstr ("quad_open_space");
221 shstr arch_wall; 252 shstr arch_wall;
222 253
254 // TODO: this is shit - we should never generatea water surface, but only
255 // water above the surface
223 switch (t) 256 switch (t)
224 { 257 {
225 case T_OCEAN: 258 case T_OCEAN:
226 if (z < h0) 259 if (z < h0)
227 arch_wall = shstr ("quad_water_wall"); 260 arch_wall = shstr ("quad_water_wall");
228 else 261 else if (z == h0)
229 arch_floor = shstr ("quad_ocean_floor"); 262 arch_floor = shstr ("quad_ocean_floor");
230 break; 263 break;
231 264
232 case T_RIVER: 265 case T_RIVER:
233 if (z < h0) 266 if (z < h0)
234 arch_wall = shstr ("quad_water_wall"); 267 arch_wall = shstr ("quad_water_wall");
235 else 268 else if (z == h0)
236 arch_floor = shstr ("quad_water_floor"); 269 arch_floor = shstr ("quad_water_floor");
237 break; 270 break;
238 271
239 case T_VALLEY: 272 case T_VALLEY:
240 if (z == h) 273 if (z == h)

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines