ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/deliantra/server/common/object.c
(Generate patch)

Comparing deliantra/server/common/object.c (file contents):
Revision 1.6 by root, Sun Jun 4 19:46:55 2006 UTC vs.
Revision 1.8 by elmex, Fri Aug 11 12:50:36 2006 UTC

1/* 1/*
2 * static char *rcsid_object_c = 2 * static char *rcsid_object_c =
3 * "$Id: object.c,v 1.6 2006/06/04 19:46:55 root Exp $"; 3 * "$Id: object.c,v 1.8 2006/08/11 12:50:36 elmex Exp $";
4 */ 4 */
5 5
6/* 6/*
7 CrossFire, A Multiplayer game for X-windows 7 CrossFire, A Multiplayer game for X-windows
8 8
1601 */ 1601 */
1602 1602
1603 while (top != NULL) { 1603 while (top != NULL) {
1604 if (QUERY_FLAG(top, FLAG_IS_FLOOR) || 1604 if (QUERY_FLAG(top, FLAG_IS_FLOOR) ||
1605 QUERY_FLAG(top, FLAG_OVERLAY_FLOOR)) floor = top; 1605 QUERY_FLAG(top, FLAG_OVERLAY_FLOOR)) floor = top;
1606 if (QUERY_FLAG(top, FLAG_NO_PICK) && 1606 if (QUERY_FLAG(top, FLAG_NO_PICK)
1607 (top->move_type & (MOVE_FLY_LOW |MOVE_FLY_HIGH))) { 1607 && (top->move_type & (MOVE_FLY_LOW |MOVE_FLY_HIGH))
1608 && !QUERY_FLAG(top, FLAG_IS_FLOOR))
1609 {
1608 /* We insert above top, so we want this object below this */ 1610 /* We insert above top, so we want this object below this */
1609 top=top->below; 1611 top=top->below;
1610 break; 1612 break;
1611 } 1613 }
1614
1612 last = top; 1615 last = top;
1613 top = top->above; 1616 top = top->above;
1614 } 1617 }
1615 /* Don't want top to be NULL, so set it to the last valid object */ 1618 /* Don't want top to be NULL, so set it to the last valid object */
1616 top = last; 1619 top = last;
1629 if (!(flag & INS_ON_TOP) && 1632 if (!(flag & INS_ON_TOP) &&
1630 (get_map_flags(op->map, NULL, op->x, op->y, NULL, NULL) & P_BLOCKSVIEW) && 1633 (get_map_flags(op->map, NULL, op->x, op->y, NULL, NULL) & P_BLOCKSVIEW) &&
1631 (op->face && !op->face->visibility)) { 1634 (op->face && !op->face->visibility)) {
1632 for (last=top; last != floor; last=last->below) 1635 for (last=top; last != floor; last=last->below)
1633 if (QUERY_FLAG(last, FLAG_BLOCKSVIEW)&&(last->type != EXIT)) break; 1636 if (QUERY_FLAG(last, FLAG_BLOCKSVIEW)&&(last->type != EXIT)) break;
1634 /* Check to see i we found the object that blocks view, 1637 /* Check to see if we found the object that blocks view,
1635 * and make sure we have a below pointer for it so that 1638 * and make sure we have a below pointer for it so that
1636 * we can get inserted below this one, which requires we 1639 * we can get inserted below this one, which requires we
1637 * set top to the object below us. 1640 * set top to the object below us.
1638 */ 1641 */
1639 if (last && last->below && last != floor) top=last->below; 1642 if (last && last->below && last != floor) top=last->below;
2392 * object, needs to travel toward it. 2395 * object, needs to travel toward it.
2393 */ 2396 */
2394 2397
2395int find_dir_2(int x, int y) { 2398int find_dir_2(int x, int y) {
2396 int q; 2399 int q;
2400
2397 if(!y) 2401 if(y)
2402 q=x*100/y;
2403 else if (x)
2398 q= -300*x; 2404 q= -300*x;
2399 else 2405 else
2400 q=x*100/y; 2406 return 0;
2407
2401 if(y>0) { 2408 if(y>0) {
2402 if(q < -242) 2409 if(q < -242)
2403 return 3 ; 2410 return 3 ;
2404 if (q < -41) 2411 if (q < -41)
2405 return 2 ; 2412 return 2 ;
2407 return 1 ; 2414 return 1 ;
2408 if (q < 242) 2415 if (q < 242)
2409 return 8 ; 2416 return 8 ;
2410 return 7 ; 2417 return 7 ;
2411 } 2418 }
2419
2412 if (q < -242) 2420 if (q < -242)
2413 return 7 ; 2421 return 7 ;
2414 if (q < -41) 2422 if (q < -41)
2415 return 6 ; 2423 return 6 ;
2416 if (q < 41) 2424 if (q < 41)
2417 return 5 ; 2425 return 5 ;
2418 if (q < 242) 2426 if (q < 242)
2419 return 4 ; 2427 return 4 ;
2428
2420 return 3 ; 2429 return 3 ;
2421} 2430}
2422 2431
2423/* 2432/*
2424 * absdir(int): Returns a number between 1 and 8, which represent 2433 * absdir(int): Returns a number between 1 and 8, which represent

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines