… | |
… | |
264 | |
264 | |
265 | flags = query_flags (head); |
265 | flags = query_flags (head); |
266 | if (QUERY_FLAG (head, FLAG_NO_PICK)) |
266 | if (QUERY_FLAG (head, FLAG_NO_PICK)) |
267 | flags |= F_NOPICK; |
267 | flags |= F_NOPICK; |
268 | |
268 | |
269 | if (!(ns.faces_sent[head->face->number] & NS_FACESENT_FACE)) |
269 | ns.send_face (head->face); |
270 | esrv_send_face (&ns, head->face->number, 0); |
270 | ns.flush_fx (); |
271 | |
271 | |
272 | if (QUERY_FLAG (head, FLAG_ANIMATE) && !ns.anims_sent[head->animation_id]) |
272 | if (QUERY_FLAG (head, FLAG_ANIMATE) && !ns.anims_sent[head->animation_id]) |
273 | esrv_send_animation (&ns, head->animation_id); |
273 | ns.send_animation (head->animation_id); |
274 | |
274 | |
275 | sl << uint32 (head->count) |
275 | sl << uint32 (head->count) |
276 | << uint32 (flags) |
276 | << uint32 (flags) |
277 | << uint32 (QUERY_FLAG (head, FLAG_NO_PICK) ? -1 : WEIGHT (head)) |
277 | << uint32 (QUERY_FLAG (head, FLAG_NO_PICK) ? -1 : WEIGHT (head)) |
278 | << uint32 (head->face->number); |
278 | << uint32 (head->face); |
279 | |
279 | |
280 | if (!head->custom_name) |
280 | if (!head->custom_name) |
281 | { |
281 | { |
282 | strncpy (item_n, query_base_name (head, 0), 127); |
282 | strncpy (item_n, query_base_name (head, 0), 127); |
283 | item_n[127] = 0; |
283 | item_n[127] = 0; |
… | |
… | |
334 | */ |
334 | */ |
335 | void |
335 | void |
336 | esrv_draw_look (object *pl) |
336 | esrv_draw_look (object *pl) |
337 | { |
337 | { |
338 | int got_one = 0, start_look = 0, end_look = 0; |
338 | int got_one = 0, start_look = 0, end_look = 0; |
339 | char buf[MAX_BUF]; |
|
|
340 | |
339 | |
341 | if (!pl->contr->ns->update_look) |
340 | if (!pl->contr->ns->update_look) |
342 | { |
341 | { |
343 | LOG (llevDebug, "esrv_draw_look called when update_look was not set\n"); |
342 | LOG (llevDebug, "esrv_draw_look called when update_look was not set (player %s)\n", &pl->name); |
344 | return; |
343 | return; |
345 | } |
344 | } |
346 | else |
345 | else |
347 | pl->contr->ns->update_look = 0; |
346 | pl->contr->ns->update_look = 0; |
348 | |
347 | |
… | |
… | |
357 | packet sl; |
356 | packet sl; |
358 | sl.printf ("item%d ", pl->contr->ns->itemcmd); |
357 | sl.printf ("item%d ", pl->contr->ns->itemcmd); |
359 | |
358 | |
360 | sl << uint32 (0); |
359 | sl << uint32 (0); |
361 | |
360 | |
362 | if (!(pl->contr->ns->faces_sent[empty_face->number] & NS_FACESENT_FACE)) |
361 | pl->contr->ns->send_face (empty_face); |
363 | esrv_send_face (pl->contr->ns, empty_face->number, 0); |
362 | pl->contr->ns->flush_fx (); |
364 | |
363 | |
365 | if (pl->contr->ns->look_position) |
364 | if (pl->contr->ns->look_position) |
366 | { |
365 | { |
367 | char buf[80]; |
366 | char buf[80]; |
368 | snprintf (buf, 80, "Apply this to see %d previous items", FLOORBOX_PAGESIZE); |
367 | snprintf (buf, 80, "Apply this to see %d previous items", FLOORBOX_PAGESIZE); |
369 | |
368 | |
370 | sl << uint32 (0x80000000 | (pl->contr->ns->look_position - FLOORBOX_PAGESIZE)) |
369 | sl << uint32 (0x80000000 | (pl->contr->ns->look_position - FLOORBOX_PAGESIZE)) |
371 | << uint32 (0) |
370 | << uint32 (0) |
372 | << sint32 (-1) |
371 | << sint32 (-1) |
373 | << uint32 (empty_face->number) |
372 | << uint32 (empty_face) |
374 | << data8 (buf) |
373 | << data8 (buf) |
375 | << uint16 (0) |
374 | << uint16 (0) |
376 | << uint8 (0) |
375 | << uint8 (0) |
377 | << uint32 (0); |
376 | << uint32 (0); |
378 | |
377 | |
… | |
… | |
405 | * we notice the special tag the object has, and act accordingly. |
404 | * we notice the special tag the object has, and act accordingly. |
406 | */ |
405 | */ |
407 | sl << uint32 (0x80000000 | (pl->contr->ns->look_position + FLOORBOX_PAGESIZE)) |
406 | sl << uint32 (0x80000000 | (pl->contr->ns->look_position + FLOORBOX_PAGESIZE)) |
408 | << uint32 (0) |
407 | << uint32 (0) |
409 | << uint32 ((uint32) - 1) |
408 | << uint32 ((uint32) - 1) |
410 | << uint32 (empty_face->number) |
409 | << uint32 (empty_face) |
411 | << data8 ("Apply this to see next group of items") |
410 | << data8 ("Apply this to see next group of items") |
412 | << uint16 (0) |
411 | << uint16 (0) |
413 | << uint8 (0) |
412 | << uint8 (0) |
414 | << uint32 (0); |
413 | << uint32 (0); |
415 | |
414 | |
… | |
… | |
502 | * |
501 | * |
503 | * flags is a list of values to update |
502 | * flags is a list of values to update |
504 | * to the client (as defined in newclient.h - might as well use the |
503 | * to the client (as defined in newclient.h - might as well use the |
505 | * same value both places. |
504 | * same value both places. |
506 | */ |
505 | */ |
507 | |
|
|
508 | void |
506 | void |
509 | esrv_update_item (int flags, object *pl, object *op) |
507 | esrv_update_item (int flags, object *pl, object *op) |
510 | { |
508 | { |
511 | /* If we have a request to send the player item, skip a few checks. */ |
509 | /* If we have a request to send the player item, skip a few checks. */ |
512 | if (op != pl) |
510 | if (op != pl) |
… | |
… | |
557 | ns->last_weight = weight; |
555 | ns->last_weight = weight; |
558 | } |
556 | } |
559 | |
557 | |
560 | if (flags & UPD_FACE) |
558 | if (flags & UPD_FACE) |
561 | { |
559 | { |
562 | if (!(ns->faces_sent[op->face->number] & NS_FACESENT_FACE)) |
560 | ns->send_face (op->face); |
563 | esrv_send_face (ns, op->face->number, 0); |
561 | ns->flush_fx (); |
564 | |
|
|
565 | sl << uint32 (op->face->number); |
562 | sl << uint32 (op->face); |
566 | } |
563 | } |
567 | |
564 | |
568 | if (flags & UPD_NAME) |
565 | if (flags & UPD_NAME) |
569 | { |
566 | { |
570 | int len; |
567 | int len; |
… | |
… | |
670 | |
667 | |
671 | /** |
668 | /** |
672 | * Tells the client to delete an item. Uses the item |
669 | * Tells the client to delete an item. Uses the item |
673 | * command with a -1 location. |
670 | * command with a -1 location. |
674 | */ |
671 | */ |
675 | |
|
|
676 | void |
672 | void |
677 | esrv_del_item (player *pl, int tag) |
673 | esrv_del_item (player *pl, int tag) |
678 | { |
674 | { |
679 | if (!pl->ns) |
675 | if (!pl->ns) |
680 | return; |
676 | return; |
… | |
… | |
882 | else |
878 | else |
883 | new_draw_info (NDI_UNIQUE, 0, op, "You see nothing."); |
879 | new_draw_info (NDI_UNIQUE, 0, op, "You see nothing."); |
884 | } |
880 | } |
885 | } |
881 | } |
886 | |
882 | |
887 | |
|
|
888 | |
|
|
889 | /** Client wants to look at some object. Lets do so. */ |
883 | /** Client wants to look at some object. Lets do so. */ |
890 | void |
884 | void |
891 | LookAt (char *buf, int len, player *pl) |
885 | LookAt (char *buf, int len, player *pl) |
892 | { |
886 | { |
893 | int dx, dy; |
887 | int dx, dy; |