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

Comparing deliantra/server/server/player.C (file contents):
Revision 1.299 by root, Sat Sep 16 21:55:51 2017 UTC vs.
Revision 1.301 by root, Sat Nov 17 23:40:04 2018 UTC

1/* 1/*
2 * This file is part of Deliantra, the Roguelike Realtime MMORPG. 2 * This file is part of Deliantra, the Roguelike Realtime MMORPG.
3 * 3 *
4 * Copyright (©) 2017,2018 Marc Alexander Lehmann / the Deliantra team
4 * Copyright (©) 2005,2006,2007,2008,2009,2010,2011,2012,2013,2014,2015,2016 Marc Alexander Lehmann / Robin Redeker / the Deliantra team 5 * Copyright (©) 2005,2006,2007,2008,2009,2010,2011,2012,2013,2014,2015,2016 Marc Alexander Lehmann / Robin Redeker / the Deliantra team
5 * Copyright (©) 2002 Mark Wedel & Crossfire Development Team 6 * Copyright (©) 2002 Mark Wedel & Crossfire Development Team
6 * Copyright (©) 1992 Frank Tore Johansen 7 * Copyright (©) 1992 Frank Tore Johansen
7 * 8 *
8 * Deliantra is free software: you can redistribute it and/or modify it under 9 * Deliantra is free software: you can redistribute it and/or modify it under
1317 y = op->y; 1318 y = op->y;
1318 1319
1319 /* find the first target */ 1320 /* find the first target */
1320 for (i = 0, found = 0; i < 20; i++) 1321 for (i = 0, found = 0; i < 20; i++)
1321 { 1322 {
1322 x += freearr_x[dir]; 1323 x += DIRX (dir);
1323 y += freearr_y[dir]; 1324 y += DIRY (dir);
1324 mflags = get_map_flags (m, &m, x, y, &x, &y); 1325 mflags = get_map_flags (m, &m, x, y, &x, &y);
1325 1326
1326 if (mflags & P_OUT_OF_MAP || mflags & P_BLOCKSVIEW) 1327 if (mflags & P_OUT_OF_MAP || mflags & P_BLOCKSVIEW)
1327 { 1328 {
1328 tmp = 0; 1329 tmp = 0;
1538 ret = fire_bow (op, op, NULL, op->contr->bowtype - bow_n + 1, wcmod, op->x, op->y); 1539 ret = fire_bow (op, op, NULL, op->contr->bowtype - bow_n + 1, wcmod, op->x, op->y);
1539 } 1540 }
1540 else if (op->contr->bowtype == bow_threewide) 1541 else if (op->contr->bowtype == bow_threewide)
1541 { 1542 {
1542 ret = fire_bow (op, op, NULL, dir, 0, op->x, op->y); 1543 ret = fire_bow (op, op, NULL, dir, 0, op->x, op->y);
1543 ret |= fire_bow (op, op, NULL, dir, -5, op->x + freearr_x[absdir (dir + 2)], op->y + freearr_y[absdir (dir + 2)]); 1544 ret |= fire_bow (op, op, NULL, dir, -5, op->x + DIRX (absdir (dir + 2)), op->y + DIRY (absdir (dir + 2)));
1544 ret |= fire_bow (op, op, NULL, dir, -5, op->x + freearr_x[absdir (dir - 2)], op->y + freearr_y[absdir (dir - 2)]); 1545 ret |= fire_bow (op, op, NULL, dir, -5, op->x + DIRX (absdir (dir - 2)), op->y + DIRY (absdir (dir - 2)));
1545 } 1546 }
1546 else if (op->contr->bowtype == bow_spreadshot) 1547 else if (op->contr->bowtype == bow_spreadshot)
1547 { 1548 {
1548 ret = fire_bow (op, op, NULL, dir, 0, op->x, op->y); 1549 ret = fire_bow (op, op, NULL, dir, 0, op->x, op->y);
1549 ret |= fire_bow (op, op, NULL, absdir (dir - 1), -5, op->x, op->y); 1550 ret |= fire_bow (op, op, NULL, absdir (dir - 1), -5, op->x, op->y);
1856 { 1857 {
1857 --op->speed_left; 1858 --op->speed_left;
1858 return true; 1859 return true;
1859 } 1860 }
1860 1861
1861 sint16 nx = freearr_x[dir] + op->x; 1862 sint16 nx = DIRX (dir) + op->x;
1862 sint16 ny = freearr_y[dir] + op->y; 1863 sint16 ny = DIRY (dir) + op->y;
1863 1864
1864 if (out_of_map (op->map, nx, ny)) 1865 if (out_of_map (op->map, nx, ny))
1865 return false; 1866 return false;
1866 1867
1867 /* If braced, or can't move to the square, and it is not out of the 1868 /* If braced, or can't move to the square, and it is not out of the
2873 level = -(10 + (2 * ob->map->darklevel ())); 2874 level = -(10 + (2 * ob->map->darklevel ()));
2874 2875
2875 /* scan through all nearby squares for terrain to hide in */ 2876 /* scan through all nearby squares for terrain to hide in */
2876 for (i = 0, x = ob->x, y = ob->y; 2877 for (i = 0, x = ob->x, y = ob->y;
2877 i <= SIZEOFFREE1; 2878 i <= SIZEOFFREE1;
2878 i++, x = ob->x + freearr_x[i], y = ob->y + freearr_y[i]) 2879 i++, x = ob->x + DIRX (i), y = ob->y + DIRY (i))
2879 { 2880 {
2880 mflag = get_map_flags (ob->map, NULL, x, y, NULL, NULL); 2881 mflag = get_map_flags (ob->map, NULL, x, y, NULL, NULL);
2881 if (mflag & P_OUT_OF_MAP) 2882 if (mflag & P_OUT_OF_MAP)
2882 continue; 2883 continue;
2883 2884
2955 friendly = who->flag [FLAG_FRIENDLY]; 2956 friendly = who->flag [FLAG_FRIENDLY];
2956 2957
2957 /* search adjacent squares */ 2958 /* search adjacent squares */
2958 for (i = 1; i < 9; i++) 2959 for (i = 1; i < 9; i++)
2959 { 2960 {
2960 x = who->x + freearr_x[i]; 2961 x = who->x + DIRX (i);
2961 y = who->y + freearr_y[i]; 2962 y = who->y + DIRY (i);
2962 m = who->map; 2963 m = who->map;
2963 mflags = get_map_flags (m, &m, x, y, &x, &y); 2964 mflags = get_map_flags (m, &m, x, y, &x, &y);
2964 /* space must be blocked if there is a monster. If not 2965 /* space must be blocked if there is a monster. If not
2965 * blocked, don't need to check this space. 2966 * blocked, don't need to check this space.
2966 */ 2967 */

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines