diff options
author | eathenabot <eathenabot@54d463be-8e91-2dee-dedb-b68131a5f0ec> | 2012-01-09 19:15:40 +0000 |
---|---|---|
committer | eathenabot <eathenabot@54d463be-8e91-2dee-dedb-b68131a5f0ec> | 2012-01-09 19:15:40 +0000 |
commit | 6f0f01549234d6427486c23ffa06129626f53438 (patch) | |
tree | c90ef8b712f1a091cf1c12d0c9cd61b05445c44a /src/map/clif.c | |
parent | 87372e334b904e0b54c18d06aa99b256f4ab634d (diff) | |
download | hercules-6f0f01549234d6427486c23ffa06129626f53438.tar.gz hercules-6f0f01549234d6427486c23ffa06129626f53438.tar.bz2 hercules-6f0f01549234d6427486c23ffa06129626f53438.tar.xz hercules-6f0f01549234d6427486c23ffa06129626f53438.zip |
* Merged changes up to eAthena 15051.
git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@15414 54d463be-8e91-2dee-dedb-b68131a5f0ec
Diffstat (limited to 'src/map/clif.c')
-rw-r--r-- | src/map/clif.c | 85 |
1 files changed, 74 insertions, 11 deletions
diff --git a/src/map/clif.c b/src/map/clif.c index 2810a624b..fe5d559d5 100644 --- a/src/map/clif.c +++ b/src/map/clif.c @@ -92,12 +92,81 @@ static inline void WFIFOPOS(int fd, unsigned short pos, short x, short y, unsign } -inline void WFIFOPOS2(int fd, unsigned short pos, short x0, short y0, short x1, short y1, unsigned char sx0, unsigned char sy0) +static inline void WFIFOPOS2(int fd, unsigned short pos, short x0, short y0, short x1, short y1, unsigned char sx0, unsigned char sy0) { WBUFPOS2(WFIFOP(fd,pos), 0, x0, y0, x1, y1, sx0, sy0); } +static inline void RBUFPOS(const uint8* p, unsigned short pos, short* x, short* y, unsigned char* dir) +{ + p += pos; + + if( x ) + { + x[0] = ( ( p[0] & 0xff ) << 2 ) | ( p[1] >> 6 ); + } + + if( y ) + { + y[0] = ( ( p[1] & 0x3f ) << 4 ) | ( p[2] >> 4 ); + } + + if( dir ) + { + dir[0] = ( p[2] & 0x0f ); + } +} + + +static inline void RBUFPOS2(const uint8* p, unsigned short pos, short* x0, short* y0, short* x1, short* y1, unsigned char* sx0, unsigned char* sy0) +{ + p += pos; + + if( x0 ) + { + x0[0] = ( ( p[0] & 0xff ) << 2 ) | ( p[1] >> 6 ); + } + + if( y0 ) + { + y0[0] = ( ( p[1] & 0x3f ) << 4 ) | ( p[2] >> 4 ); + } + + if( x1 ) + { + x1[0] = ( ( p[2] & 0x0f ) << 6 ) | ( p[3] >> 2 ); + } + + if( y1 ) + { + y1[0] = ( ( p[3] & 0x03 ) << 8 ) | ( p[4] >> 0 ); + } + + if( sx0 ) + { + sx0[0] = ( p[5] & 0xf0 ) >> 4; + } + + if( sy0 ) + { + sy0[0] = ( p[5] & 0x0f ) >> 0; + } +} + + +static inline void RFIFOPOS(int fd, unsigned short pos, short* x, short* y, unsigned char* dir) +{ + RBUFPOS(RFIFOP(fd,pos), 0, x, y, dir); +} + + +static inline void RFIFOPOS2(int fd, unsigned short pos, short* x0, short* y0, short* x1, short* y1, unsigned char* sx0, unsigned char* sy0) +{ + RBUFPOS2(WFIFOP(fd,pos), 0, x0, y0, x1, y1, sx0, sy0); +} + + //To idenfity disguised characters. static inline bool disguised(struct block_list* bl) { @@ -9001,7 +9070,6 @@ void clif_parse_progressbar(int fd, struct map_session_data * sd) void clif_parse_WalkToXY(int fd, struct map_session_data *sd) { short x, y; - int cmd; if (pc_isdead(sd)) { clif_clearunit_area(&sd->bl, CLR_DEAD); @@ -9020,11 +9088,8 @@ void clif_parse_WalkToXY(int fd, struct map_session_data *sd) pc_delinvincibletimer(sd); - cmd = RFIFOW(fd,0); - x = RFIFOB(fd,packet_db[sd->packet_ver][cmd].pos[0]) * 4 + - (RFIFOB(fd,packet_db[sd->packet_ver][cmd].pos[0] + 1) >> 6); - y = ((RFIFOB(fd,packet_db[sd->packet_ver][cmd].pos[0]+1) & 0x3f) << 4) + - (RFIFOB(fd,packet_db[sd->packet_ver][cmd].pos[0] + 2) >> 4); + RFIFOPOS(fd, packet_db[sd->packet_ver][RFIFOW(fd,0)].pos[0], &x, &y, NULL); + //Set last idle time... [Skotlex] sd->idletime = last_tick; @@ -12662,11 +12727,9 @@ void clif_parse_HomMoveTo(int fd, struct map_session_data *sd) { int id = RFIFOL(fd,2); // Mercenary or Homunculus struct block_list *bl = NULL; - short x, y, cmd; + short x, y; - cmd = RFIFOW(fd,0); - x = RFIFOB(fd,packet_db[sd->packet_ver][cmd].pos[0]) * 4 + (RFIFOB(fd,packet_db[sd->packet_ver][cmd].pos[0] + 1) >> 6); - y = ((RFIFOB(fd,packet_db[sd->packet_ver][cmd].pos[0]+1) & 0x3f) << 4) + (RFIFOB(fd,packet_db[sd->packet_ver][cmd].pos[0] + 2) >> 4); + RFIFOPOS(fd, packet_db[sd->packet_ver][RFIFOW(fd,0)].pos[1], &x, &y, NULL); if( sd->md && sd->md->bl.id == id ) bl = &sd->md->bl; // Moving Mercenary |