diff options
author | zephyrus <zephyrus@54d463be-8e91-2dee-dedb-b68131a5f0ec> | 2008-03-21 17:12:52 +0000 |
---|---|---|
committer | zephyrus <zephyrus@54d463be-8e91-2dee-dedb-b68131a5f0ec> | 2008-03-21 17:12:52 +0000 |
commit | b9b4409da9f557d7904af6439c41e6534639604a (patch) | |
tree | c21db4f38b329bac2ddec410977d6dac30c7669e /src/map/mob.c | |
parent | dbad79f525ce1b76933bc489743ae431f0d96da1 (diff) | |
download | hercules-b9b4409da9f557d7904af6439c41e6534639604a.tar.gz hercules-b9b4409da9f557d7904af6439c41e6534639604a.tar.bz2 hercules-b9b4409da9f557d7904af6439c41e6534639604a.tar.xz hercules-b9b4409da9f557d7904af6439c41e6534639604a.zip |
- Added status changes for netcafe premium items. Status Resist Potion and SP Reduction Potion.
* More Barricade stuff:
- Changed the way "Dir" works. Now it's just like NPC dir definition (from 0 to 7).
git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@12414 54d463be-8e91-2dee-dedb-b68131a5f0ec
Diffstat (limited to 'src/map/mob.c')
-rw-r--r-- | src/map/mob.c | 35 |
1 files changed, 23 insertions, 12 deletions
diff --git a/src/map/mob.c b/src/map/mob.c index 87b4377ef..f03b9ac9d 100644 --- a/src/map/mob.c +++ b/src/map/mob.c @@ -498,11 +498,28 @@ int mob_once_spawn_area(struct map_session_data* sd,int m,int x0,int y0,int x1,i /*========================================== * Barricades [Zephyrus] *------------------------------------------*/ +void mob_barricade_nextxy(short x, short y, short dir, int pos, short *x1, short *y1) +{ // Calculates Next X-Y Position + if( dir == 0 || dir == 4 ) + *x1 = x; // Keep X + else if( dir > 0 && dir < 4 ) + *x1 = x - pos; // Going left + else + *x1 = x + pos; // Going right + + if( dir == 2 || dir == 6 ) + *y1 = y; + else if( dir > 2 && dir < 6 ) + *y1 = y - pos; + else + *y1 = y + pos; +} + short mob_barricade_build(short m, short x, short y, short count, short dir, bool killable, const char* event) { int i, j; - short x1 = dir ? x + count - 1 : x; - short y1 = dir ? y : y + count - 1; + short x1; + short y1; struct mob_data *md; struct barricade_data *barricade; @@ -531,8 +548,7 @@ short mob_barricade_build(short m, short x, short y, short count, short dir, boo for( i = 0; i < count; i++ ) { - x1 = dir ? x + i : x; - y1 = dir ? y : y + i; + mob_barricade_nextxy(x, y, dir, i, &x1, &y1); if( map_getcell(m, x1, y1, CELL_CHKNOREACH) ) break; // Collision @@ -576,8 +592,7 @@ void mob_barricade_get(struct map_session_data *sd) for( i = 0; i < barricade->count; i++ ) { - x1 = barricade->dir ? barricade->x + i : barricade->x; - y1 = barricade->dir ? barricade->y : barricade->y + i; + mob_barricade_nextxy(barricade->x, barricade->y, barricade->dir, i, &x1, &y1); clif_changemapcell(sd->fd, barricade->m, x1, y1, (barricade->killable ? 5 : 1), SELF); } } @@ -597,9 +612,7 @@ static void mob_barricade_break(struct barricade_data *barricade) for( i = 0; i < barricade->count; i++ ) { - x1 = barricade->dir ? barricade->x + i : barricade->x; - y1 = barricade->dir ? barricade->y : barricade->y + i; - + mob_barricade_nextxy(barricade->x, barricade->y, barricade->dir, i, &x1, &y1); map_setgatcell(barricade->m, x1, y1, 0); clif_changemapcell(0, barricade->m, x1, y1, 0, ALL_SAMEMAP); } @@ -645,9 +658,7 @@ void mod_barricade_clearall(void) { for( i = 0; i < barricade->count; i++ ) { - x1 = barricade->dir ? barricade->x + i : barricade->x; - y1 = barricade->dir ? barricade->y : barricade->y + i; - + mob_barricade_nextxy(barricade->x, barricade->y, barricade->dir, i, &x1, &y1); map_setgatcell(barricade->m, x1, y1, 0); clif_changemapcell(0, barricade->m, x1, y1, 0, ALL_SAMEMAP); } |