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

Comparing deliantra/server/socket/info.C (file contents):
Revision 1.53 by root, Thu Oct 15 21:09:32 2009 UTC vs.
Revision 1.56 by root, Fri Nov 6 13:07:28 2009 UTC

187} 187}
188 188
189void 189void
190draw_ext_info (int flags, int pri, const object *pl, uint8 type, uint8 subtype, const char *message, const char *oldmessage) 190draw_ext_info (int flags, int pri, const object *pl, uint8 type, uint8 subtype, const char *message, const char *oldmessage)
191{ 191{
192
193 if (!pl || (pl->type != PLAYER) || (pl->contr == NULL)) 192 if (!pl || (pl->type != PLAYER) || (pl->contr == NULL))
194 return; 193 return;
195 194
196 if (!CLIENT_SUPPORT_READABLES (pl->contr->ns, type)) 195 if (!CLIENT_SUPPORT_READABLES (pl->contr->ns, type))
197 { 196 {
237} 236}
238 237
239/** 238/**
240 * Writes to everyone on the map *except* op. This is useful for emotions. 239 * Writes to everyone on the map *except* op. This is useful for emotions.
241 */ 240 */
242
243void 241void
244new_info_map_except (int color, maptile * map, object *op, const char *str) 242new_info_map_except (int color, maptile * map, object *op, const char *str)
245{ 243{
246 for_all_players (pl) 244 for_all_players (pl)
247 if (pl->ob->map == map && pl->ob != op) 245 if (pl->ob->map == map && pl->ob != op)
249} 247}
250 248
251/** 249/**
252 * Writes to everyone on the map except op1 and op2 250 * Writes to everyone on the map except op1 and op2
253 */ 251 */
254void 252static void
255new_info_map_except2 (int color, maptile * map, object *op1, object *op2, const char *str) 253new_info_map_except2 (int color, maptile * map, object *op1, object *op2, const char *str)
256{ 254{
257 for_all_players (pl) 255 for_all_players (pl)
258 if (pl->ob->map == map && pl->ob != op1 && pl->ob != op2) 256 if (pl->ob->map == map && pl->ob != op1 && pl->ob != op2)
259 new_draw_info (color, 0, pl->ob, str); 257 new_draw_info (color, 0, pl->ob, str);
283 sprintf (buf, "Player: %s %s", (const char *) pl->name, (const char *) pl->contr->own_title); 281 sprintf (buf, "Player: %s %s", (const char *) pl->name, (const char *) pl->contr->own_title);
284} 282}
285 283
286// formerly a macro, used only by magic map, so optimised it out 284// formerly a macro, used only by magic map, so optimised it out
287static inline faceidx 285static inline faceidx
288GET_MAP_FACE (maptile *m, int x, int y, int layer) 286GET_MAP_FACE (mapspace &ms, int layer)
289{ 287{
290 if (object *op = GET_MAP_FACE_OBJ (m, x, y, layer)) 288 if (object *op = ms.faces_obj [layer])
291 return op->face; 289 return op->face;
292 else 290 else
293 return 0; 291 return 0;
294} 292}
295 293
305 * for various code values. 303 * for various code values.
306 */ 304 */
307static void 305static void
308magic_mapping_mark_recursive (object *pl, char *map_mark, int px, int py) 306magic_mapping_mark_recursive (object *pl, char *map_mark, int px, int py)
309{ 307{
310 int x, y, dx, dy, mflags;
311 sint16 nx, ny;
312 maptile *mp;
313
314 for (dx = -1; dx <= 1; dx++) 308 for (int dx = -1; dx <= 1; dx++)
315 { 309 {
316 for (dy = -1; dy <= 1; dy++) 310 for (int dy = -1; dy <= 1; dy++)
317 { 311 {
318 x = px + dx; 312 int x = px + dx;
319 y = py + dy; 313 int y = py + dy;
320 314
321 if (FABS (x) >= MAGIC_MAP_HALF || FABS (y) >= MAGIC_MAP_HALF) 315 if (abs (x) >= MAGIC_MAP_HALF || abs (y) >= MAGIC_MAP_HALF)
322 continue; 316 continue;
323 317
324 mp = pl->map; 318 mapxy pos (pl);
325 nx = pl->x + x; 319 pos.move (x, y);
326 ny = pl->y + y;
327 320
328 mflags = get_map_flags (pl->map, &mp, nx, ny, &nx, &ny); 321 if (!pos.normalise ())
329 if (mflags & P_OUT_OF_MAP)
330 continue; 322 continue;
323
324 mapspace &ms = pos.ms ();
331 325
332 if (map_mark[MAGIC_MAP_HALF + x + MAGIC_MAP_SIZE * (MAGIC_MAP_HALF + y)] == 0) 326 if (map_mark[MAGIC_MAP_HALF + x + MAGIC_MAP_SIZE * (MAGIC_MAP_HALF + y)] == 0)
333 { 327 {
328 int mflags = ms.flags ();
329
334 int f = GET_MAP_FACE (mp, nx, ny, 0); 330 int f = GET_MAP_FACE (ms, 0);
335 if (f == blank_face) 331 if (f == blank_face)
336 { 332 {
337 f = GET_MAP_FACE (mp, nx, ny, 1); 333 f = GET_MAP_FACE (ms, 1);
338 if (f == blank_face) 334 if (f == blank_face)
339 f = GET_MAP_FACE (mp, nx, ny, 2); 335 f = GET_MAP_FACE (ms, 2);
340 } 336 }
341 337
342 int magicmap = faces [f].magicmap; 338 int magicmap = faces [f].magicmap;
343 339
344 /* Should probably have P_NO_MAGIC here also, but then shops don't 340 /* Should probably have P_NO_MAGIC here also, but then shops don't
357} 353}
358 354
359/** 355/**
360 * Creates magic map for player. 356 * Creates magic map for player.
361 * 357 *
362 * Note: For improved magic mapping display, the space that blocks 358 * Note: For improved magic mapping display, the space that blocks
363 * the view is now marked with value 2. Any dependencies of map_mark 359 * the view is now marked with value 2. Any dependencies of map_mark
364 * being nonzero have been changed to check for 1. Also, since 360 * being nonzero have been changed to check for 1. Also, since
365 * map_mark is a char value, putting 2 in should cause no problems. 361 * map_mark is a char value, putting 2 in should cause no problems.
366 * 362 *
367 * This function examines the map the player is on, and determines what 363 * This function examines the map the player is on, and determines what
368 * is visible. 2 is set for walls or objects that blocks view. 1 364 * is visible. 2 is set for walls or objects that blocks view. 1
369 * is for open spaces. map_mark should already have been initialised 365 * is for open spaces. map_mark should already have been initialised
370 * to zero before this is called. 366 * to zero before this is called.
371 * strength is an initial strength*2 rectangular area that we automatically 367 * strength is an initial strength*2 rectangular area that we automatically
372 * see in/penetrate through. 368 * see in/penetrate through.
373 */ 369 */
374void 370static void
375magic_mapping_mark (object *pl, char *map_mark, int strength) 371magic_mapping_mark (object *pl, char *map_mark, int strength)
376{ 372{
377 int x, y, mflags;
378 sint16 nx, ny;
379 maptile *mp;
380
381 for (x = -strength; x < strength; x++) 373 for (int x = -strength; x < strength; x++)
382 { 374 {
383 for (y = -strength; y < strength; y++) 375 for (int y = -strength; y < strength; y++)
384 { 376 {
385 mp = pl->map; 377 mapxy pos (pl);
386 nx = pl->x + x; 378 pos.move (x, y);
387 ny = pl->y + y;
388 379
389 mflags = get_map_flags (pl->map, &mp, nx, ny, &nx, &ny); 380 if (!pos.normalise ())
390 if (mflags & P_OUT_OF_MAP)
391 continue; 381 continue;
392 382
383 mapspace &ms = pos.ms ();
384
385 int mflags = ms.flags ();
386
393 int f = GET_MAP_FACE (mp, nx, ny, 0); 387 int f = GET_MAP_FACE (ms, 0);
394 if (f == blank_face) 388 if (f == blank_face)
395 { 389 {
396 f = GET_MAP_FACE (mp, nx, ny, 1); 390 f = GET_MAP_FACE (ms, 1);
397 if (f == blank_face) 391 if (f == blank_face)
398 f = GET_MAP_FACE (mp, nx, ny, 2); 392 f = GET_MAP_FACE (ms, 2);
399 } 393 }
400 394
401 int magicmap = faces [f].magicmap; 395 int magicmap = faces [f].magicmap;
402 396
403 if (mflags & P_BLOCKSVIEW) 397 if (mflags & P_BLOCKSVIEW)

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines