diff options
author | ultramage <ultramage@54d463be-8e91-2dee-dedb-b68131a5f0ec> | 2007-12-29 20:12:46 +0000 |
---|---|---|
committer | ultramage <ultramage@54d463be-8e91-2dee-dedb-b68131a5f0ec> | 2007-12-29 20:12:46 +0000 |
commit | 46e72fc8f9aa45151646986aae20869749121a2a (patch) | |
tree | 499f1d055eeabac7ba4b439d83526e0111a8d400 | |
parent | 8e699f7f4fdfec34c48268b91867d27adcfdac4e (diff) | |
download | hercules-46e72fc8f9aa45151646986aae20869749121a2a.tar.gz hercules-46e72fc8f9aa45151646986aae20869749121a2a.tar.bz2 hercules-46e72fc8f9aa45151646986aae20869749121a2a.tar.xz hercules-46e72fc8f9aa45151646986aae20869749121a2a.zip |
Knockback now works through cells where there is a diagonal path, but no horizontal+vertical alternative (like two perpendicular icewalls with a gap where they 'join').
Some dead code removal in path.c.
git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@11991 54d463be-8e91-2dee-dedb-b68131a5f0ec
-rw-r--r-- | Changelog-Trunk.txt | 4 | ||||
-rw-r--r-- | src/map/path.c | 78 |
2 files changed, 26 insertions, 56 deletions
diff --git a/Changelog-Trunk.txt b/Changelog-Trunk.txt index 25a85d1fe..a46017b63 100644 --- a/Changelog-Trunk.txt +++ b/Changelog-Trunk.txt @@ -3,6 +3,10 @@ Date Added AS OF SVN REV. 5091, WE ARE NOW USING TRUNK. ALL UNTESTED BUGFIXES/FEATURES GO INTO TRUNK. IF YOU HAVE A WORKING AND TESTED BUGFIX PUT IT INTO STABLE AS WELL AS TRUNK. +2007/12/29 + * Knockback now works through cells where there is a diagonal path, but + no horizontal+vertical (two 90` icewalls with a gap where they 'join') + * Some dead code removal in path.c [ultramage] 2007/12/28 * Fixed a memory leak in memitemdata_to_sql. * Reverted a bad modification in clif_produceeffect from r11290. [FlavioJS] diff --git a/src/map/path.c b/src/map/path.c index 549144d7b..440316131 100644 --- a/src/map/path.c +++ b/src/map/path.c @@ -144,52 +144,9 @@ static int add_path(int *heap,struct tmp_path *tp,int x,int y,int dist,int befor return 0; } - /*========================================== - * is (x,y) passable? - * flag: 0x10000 = ranged attack check - * 0x30000 = stacking check - *------------------------------------------*/ -static int can_place(struct map_data *m,int x,int y,int flag) -{ - if( map_getcellp(m,x,y,CELL_CHKPASS) ) - return 1; - if( (flag&0x10000)&&map_getcellp(m,x,y,CELL_CHKGROUND) ) - return 1; -#ifdef CELL_NOSTACK - //Special flag for CELL_NOSTACK systems. Returns true when the given cell is stacked. [Skotlex] - if( (flag&0x30000)&&map_getcellp(m,x,y,CELL_CHKSTACK) ) - return 1; -#endif - return 0; -} - -/*========================================== - * can you move from (x0,y0) to (x1,y1) in one step? - * (helper function for path_blownpos()) - *------------------------------------------*/ -static int can_move(struct map_data *m,int x0,int y0,int x1,int y1,int flag) -{ - if( x1 < 0 || y1 < 0 || x1 >= m->xs || y1 >= m->ys) - return 0; // out-of-bounds coordinates - if( flag&0x20000 ) //Flag to ignore everything, for use with Taekwon's Jump skill currently. [Skotlex] - return 1; -#ifndef CELL_NOSTACK - //In no-stack mode, do not check current cell. - if( !can_place(m,x0,y0,flag) ) - return 0; -#endif - if( !can_place(m,x1,y1,flag) ) - return 0; - if( x0 == x1 || y0 == y1 ) - return 1; - if( !can_place(m,x0,y1,flag) || !can_place(m,x1,y0,flag) ) - return 0; - return 1; -} - -/*========================================== - * (x0,y0)から(dx,dy)方向へcountセル分 + * Find the closest reachable cell, 'count' cells away from (x0,y0) in direction (dx,dy). + * * 吹き飛ばしたあとの座標を所得 *------------------------------------------*/ int path_blownpos(int m,int x0,int y0,int dx,int dy,int count) @@ -210,21 +167,30 @@ int path_blownpos(int m,int x0,int y0,int dx,int dy,int count) dy=(dy>0)?1:((dy<0)?-1:0); } - while( (count--)>0 && (dx || dy) ) + while( count > 0 && (dx != 0 || dy != 0) ) { - if( !can_move(md,x0,y0,x0+dx,y0+dy,0) ){ - int fx=(dx!=0 && can_move(md,x0,y0,x0+dx,y0,0)); - int fy=(dy!=0 && can_move(md,x0,y0,x0,y0+dy,0)); - if( fx && fy ){ - if(rand()&1) dx=0; - else dy=0; + if( !map_getcellp(md,x0+dx,y0+dy,CELL_CHKPASS) ) + {// attempt partial movement + int fx = ( dx != 0 && map_getcellp(md,x0+dx,y0,CELL_CHKPASS) ); + int fy = ( dy != 0 && map_getcellp(md,x0,y0+dy,CELL_CHKPASS) ); + if( fx && fy ) + { + if(rand()&1) + dx=0; + else + dy=0; } - if( !fx ) dx=0; - if( !fy ) dy=0; + else if( !fx ) + dx=0; + else if( !fy ) + dy=0; } - x0+=dx; - y0+=dy; + + x0 += dx; + y0 += dy; + count--; } + return (x0<<16)|y0; //TODO: use 'struct point' here instead? } |