diff options
author | Andrei Karas <akaras@inbox.ru> | 2014-02-27 13:25:41 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2014-02-27 13:25:41 +0300 |
commit | c61f1b6abe8e68995f00ae3a939afe5049e5cdb3 (patch) | |
tree | c50613a2c7722fba4aba9d5a67949b118a279b33 /src | |
parent | b481cd74dfd1629ca7b045cde57562e752c49638 (diff) | |
download | mv-c61f1b6abe8e68995f00ae3a939afe5049e5cdb3.tar.gz mv-c61f1b6abe8e68995f00ae3a939afe5049e5cdb3.tar.bz2 mv-c61f1b6abe8e68995f00ae3a939afe5049e5cdb3.tar.xz mv-c61f1b6abe8e68995f00ae3a939afe5049e5cdb3.zip |
Remove manaserv ifdefs code.
ManaServ was already depricated long ago.
Diffstat (limited to 'src')
-rw-r--r-- | src/actormanager.cpp | 21 | ||||
-rw-r--r-- | src/being/actorsprite.h | 9 | ||||
-rw-r--r-- | src/being/being.cpp | 249 | ||||
-rw-r--r-- | src/being/being.h | 11 | ||||
-rw-r--r-- | src/being/localplayer.cpp | 765 | ||||
-rw-r--r-- | src/being/playerinfo.cpp | 19 | ||||
-rw-r--r-- | src/client.cpp | 6 | ||||
-rw-r--r-- | src/game.cpp | 12 | ||||
-rw-r--r-- | src/gui/models/typelistmodel.h | 17 | ||||
-rw-r--r-- | src/gui/viewport.cpp | 242 | ||||
-rw-r--r-- | src/gui/windowmenu.cpp | 12 | ||||
-rw-r--r-- | src/gui/windows/charcreatedialog.cpp | 13 | ||||
-rw-r--r-- | src/gui/windows/charselectdialog.cpp | 7 | ||||
-rw-r--r-- | src/gui/windows/editserverdialog.cpp | 23 | ||||
-rw-r--r-- | src/gui/windows/selldialog.cpp | 10 | ||||
-rw-r--r-- | src/gui/windows/serverdialog.cpp | 20 | ||||
-rw-r--r-- | src/main.h | 2 | ||||
-rw-r--r-- | src/map.cpp | 125 | ||||
-rw-r--r-- | src/map.h | 23 | ||||
-rw-r--r-- | src/net/ea/loginhandler.cpp | 5 | ||||
-rw-r--r-- | src/net/loginhandler.h | 5 | ||||
-rw-r--r-- | src/net/messagein.cpp | 5 | ||||
-rw-r--r-- | src/net/net.cpp | 10 | ||||
-rw-r--r-- | src/net/serverinfo.h | 4 | ||||
-rw-r--r-- | src/resources/db/monsterdb.cpp | 6 |
25 files changed, 248 insertions, 1373 deletions
diff --git a/src/actormanager.cpp b/src/actormanager.cpp index 9661dc2fe..72ab8c21c 100644 --- a/src/actormanager.cpp +++ b/src/actormanager.cpp @@ -137,23 +137,10 @@ class SortBeingFunctor final return being1->getDistance() < being2->getDistance(); } - int d1, d2; -#ifdef MANASERV_SUPPORT - if (Net::getNetworkType() == ServerInfo::MANASERV) - { - const Vector &pos1 = being1->getPosition(); - d1 = abs((static_cast<int>(pos1.x)) - x) - + abs((static_cast<int>(pos1.y)) - y); - const Vector &pos2 = being2->getPosition(); - d2 = abs((static_cast<int>(pos2.x)) - x) - + abs((static_cast<int>(pos2.y)) - y); - } - else -#endif - { - d1 = abs(being1->getTileX() - x) + abs(being1->getTileY() - y); - d2 = abs(being2->getTileX() - x) + abs(being2->getTileY() - y); - } + const int d1 = abs(being1->getTileX() - x) + + abs(being1->getTileY() - y); + const int d2 = abs(being2->getTileX() - x) + + abs(being2->getTileY() - y); if (d1 != d2) return d1 < d2; diff --git a/src/being/actorsprite.h b/src/being/actorsprite.h index f9876fa79..444232ddd 100644 --- a/src/being/actorsprite.h +++ b/src/being/actorsprite.h @@ -183,14 +183,7 @@ public: { return getPixelX() - mapTileSize / 2; } int getActorY() const - { -#ifdef MANASERV_SUPPORT - return getPixelY() + ((Net::getNetworkType() == ServerInfo::MANASERV) - ? 15 : mapTileSize); -#else - return getPixelY() - mapTileSize; -#endif - } + { return getPixelY() - mapTileSize; } protected: /** diff --git a/src/being/being.cpp b/src/being/being.cpp index 428e6e7f8..705d97439 100644 --- a/src/being/being.cpp +++ b/src/being/being.cpp @@ -371,50 +371,7 @@ void Being::setDestination(const int dstX, const int dstY) if (!mMap) return; -#ifdef MANASERV_SUPPORT - if (Net::getNetworkType() != ServerInfo::MANASERV) -#endif - { - setPath(mMap->findPath(mX, mY, dstX, dstY, getWalkMask())); - return; - } - -#ifdef MANASERV_SUPPORT - // Don't handle flawed destinations from server... - if (dstX == 0 || dstY == 0) - return; - - // If the destination is unwalkable, don't bother trying to get there - if (!mMap->getWalk(dstX / mapTileSize, dstY / mapTileSize)) - return; - - Position dest = mMap->checkNodeOffsets(getCollisionRadius(), getWalkMask(), - dstX, dstY); - Path thisPath = mMap->findPixelPath(static_cast<int>(mPos.x), - static_cast<int>(mPos.y), dest.x, dest.y, - static_cast<int>(getCollisionRadius()), - static_cast<unsigned char>(getWalkMask())); - - if (thisPath.empty()) - { - // If there is no path but the destination is on the same walkable tile, - // we accept it. - if (static_cast<int>(mPos.x) / mapTileSize == dest.x / mapTileSize - && static_cast<int>(mPos.y) / mapTileSize == dest.y / mapTileSize) - { - mDest.x = static_cast<float>(dest.x); - mDest.y = static_cast<float>(dest.y); - } - setPath(Path()); - return; - } - - // The destination is valid, so we set it. - mDest.x = static_cast<float>(dest.x); - mDest.y = static_cast<float>(dest.y); - - setPath(thisPath); -#endif + setPath(mMap->findPath(mX, mY, dstX, dstY, getWalkMask())); } void Being::clearPath() @@ -428,12 +385,7 @@ void Being::setPath(const Path &path) if (mPath.empty()) return; -#ifdef MANASERV_SUPPORT - if ((Net::getNetworkType() != ServerInfo::MANASERV) && - mAction != MOVE && mAction != DEAD) -#else if (mAction != MOVE && mAction != DEAD) -#endif { nextTile(); mActionTime = tick_time; @@ -771,13 +723,8 @@ void Being::handleAttack(Being *const victim, const int damage, else if (mInfo->getAttack(attackId)) fireMissile(victim, mInfo->getAttack(attackId)->mMissileParticle); -#ifdef MANASERV_SUPPORT - if (Net::getNetworkType() != ServerInfo::MANASERV) -#endif - { - reset(); - mActionTime = tick_time; - } + reset(); + mActionTime = tick_time; if (this != player_node) { @@ -824,13 +771,8 @@ void Being::handleSkill(Being *const victim, const int damage, if (data) fireMissile(victim, data->particle); -#ifdef MANASERV_SUPPORT - if (Net::getNetworkType() != ServerInfo::MANASERV) -#endif - { - reset(); - mActionTime = tick_time; - } + reset(); + mActionTime = tick_time; if (this != player_node) { @@ -1443,157 +1385,68 @@ void Being::logic() } int frameCount = static_cast<int>(getFrameCount()); -#ifdef MANASERV_SUPPORT - if ((Net::getNetworkType() == ServerInfo::MANASERV) && (mAction != DEAD)) - { - const Vector dest = (mPath.empty()) ? - mDest : Vector(static_cast<float>(mPath.front().x), - static_cast<float>(mPath.front().y)); - // This is a hack that stops NPCs from running off the map... - if (mDest.x <= 0 && mDest.y <= 0) - { - BLOCK_END("Being::logic") - return; - } - - // The Vector representing the difference between current position - // and the next destination path node. - Vector dir = dest - mPos; - - const float nominalLength = dir.length(); + switch (mAction) + { + case STAND: + case SIT: + case DEAD: + case HURT: + case SPAWN: + default: + break; - // When we've not reached our destination, move to it. - if (nominalLength > 0.0F && !mWalkSpeed.isNull()) + case MOVE: { - // The deplacement of a point along a vector is calculated - // using the Unit Vector (â) multiplied by the point speed. - // â = a / ||a|| (||a|| is the a length.) - // Then, diff = (dir/||dir||) * speed. - const Vector normalizedDir = dir.normalized(); - Vector diff(normalizedDir.x * mWalkSpeed.x, - normalizedDir.y * mWalkSpeed.y); - - // Test if we don't miss the destination by a move too far: - if (diff.length() > nominalLength) - { - setPosition(mPos + dir); - - // Also, if the destination is reached, try to get the next - // path point, if existing. - if (!mPath.empty()) - mPath.pop_front(); - } - // Otherwise, go to it using the nominal speed. - else + if (static_cast<float>(get_elapsed_time( + mActionTime)) >= mSpeed) { - setPosition(mPos + diff); + nextTile(); } - - if (mAction != MOVE) - setAction(MOVE, 0); - - // Update the player sprite direction. - // N.B.: We only change this if the distance is more than one pixel. - if (nominalLength > 1.0F) - { - int direction = 0; - const float dx = std::abs(dir.x); - float dy = std::abs(dir.y); - - // When not using mouse for the player, we slightly prefer - // UP and DOWN position, especially when walking diagonally. - if (player_node && this == player_node && - !player_node->isPathSetByMouse()) - { - dy = dy + 2; - } - - if (dx > dy) - direction |= (dir.x > 0) ? RIGHT : LEFT; - else - direction |= (dir.y > 0) ? DOWN : UP; - - setDirection(static_cast<uint8_t>(direction)); - } - } - else if (!mPath.empty()) - { - // If the current path node has been reached, - // remove it and go to the next one. - mPath.pop_front(); - } - else if (mAction == MOVE) - { - setAction(STAND, 0); + break; } - } - else - if (Net::getNetworkType() != ServerInfo::MANASERV) -#endif - { - switch (mAction) - { - case STAND: - case SIT: - case DEAD: - case HURT: - case SPAWN: - default: - break; - case MOVE: - { - if (static_cast<float>(get_elapsed_time( - mActionTime)) >= mSpeed) - { - nextTile(); - } + case ATTACK: + { + if (!mActionTime) break; - } - case ATTACK: + int curFrame = 0; + if (mAttackSpeed) { - if (!mActionTime) - break; - - int curFrame = 0; - if (mAttackSpeed) - { - curFrame = (get_elapsed_time(mActionTime) * frameCount) - / mAttackSpeed; - } + curFrame = (get_elapsed_time(mActionTime) * frameCount) + / mAttackSpeed; + } - if (this == player_node && curFrame >= frameCount) - nextTile(); + if (this == player_node && curFrame >= frameCount) + nextTile(); - break; - } + break; } + } - if (mAction == MOVE) - { - const int xOffset = getXOffset(); - const int yOffset = getYOffset(); - int offset = xOffset; - if (!offset) - offset = yOffset; + if (mAction == MOVE) + { + const int xOffset = getXOffset(); + const int yOffset = getYOffset(); + int offset = xOffset; + if (!offset) + offset = yOffset; - mSortOffsetY = (mOldHeight * mapTileSize / 2) - + (mOffsetY * mapTileSize / 2) - * (mapTileSize - abs(offset)) / mapTileSize; - const int yOffset2 = yOffset - mSortOffsetY; + mSortOffsetY = (mOldHeight * mapTileSize / 2) + + (mOffsetY * mapTileSize / 2) + * (mapTileSize - abs(offset)) / mapTileSize; + const int yOffset2 = yOffset - mSortOffsetY; - // Update pixel coordinates - setPosition(static_cast<float>(mX * mapTileSize - + mapTileSize / 2 + xOffset), static_cast<float>( - mY * mapTileSize + mapTileSize + yOffset2)); - } - else - { - setPosition(static_cast<float>(mX * mapTileSize + mapTileSize / 2), - static_cast<float>(mY * mapTileSize + mapTileSize)); - } + // Update pixel coordinates + setPosition(static_cast<float>(mX * mapTileSize + + mapTileSize / 2 + xOffset), static_cast<float>( + mY * mapTileSize + mapTileSize + yOffset2)); + } + else + { + setPosition(static_cast<float>(mX * mapTileSize + mapTileSize / 2), + static_cast<float>(mY * mapTileSize + mapTileSize)); } if (mEmotionSprite) diff --git a/src/being/being.h b/src/being/being.h index e427612f0..2521eb0c3 100644 --- a/src/being/being.h +++ b/src/being/being.h @@ -472,17 +472,13 @@ class Being : public ActorSprite, public ConfigListener } /** - * Sets the walk speed. - * in pixels per second for eAthena, - * in tiles per second for Manaserv. + * Sets the walk speed in pixels per second. */ void setWalkSpeed(Vector speed) { mWalkSpeed = speed; mSpeed = speed.x; } /** - * Gets the walk speed. - * in pixels per second for eAthena, - * in tiles per second for Manaserv (0.1 precision). + * Gets the walk speed in pixels per second. */ Vector getWalkSpeed() const A_WARN_UNUSED { return mWalkSpeed; } @@ -1037,8 +1033,7 @@ class Being : public ActorSprite, public ConfigListener /** * Walk speed for x and y movement values. - * In pixels per second for eAthena, - * In pixels per ticks for Manaserv. + * In pixels per second. * @see MILLISECONDS_IN_A_TICK */ Vector mWalkSpeed; diff --git a/src/being/localplayer.cpp b/src/being/localplayer.cpp index 0e7f8a9b0..5d4ce123e 100644 --- a/src/being/localplayer.cpp +++ b/src/being/localplayer.cpp @@ -286,10 +286,6 @@ void LocalPlayer::logic() mMessageTime--; } -#ifdef MANASERV_SUPPORT - PlayerInfo::logic(); -#endif - if (mTarget) { if (mTarget->getType() == ActorSprite::NPC) @@ -300,23 +296,10 @@ void LocalPlayer::logic() else { // Find whether target is in range -#ifdef MANASERV_SUPPORT - const int rangeX = - (Net::getNetworkType() == ServerInfo::MANASERV) ? - static_cast<int>(abs(static_cast<int>(mTarget->getPosition().x - - getPosition().x))) : - static_cast<int>(abs(mTarget->getTileX() - getTileX())); - const int rangeY = - (Net::getNetworkType() == ServerInfo::MANASERV) ? - static_cast<int>(abs(static_cast<int>(mTarget->getPosition().y - - getPosition().y))) : - static_cast<int>(abs(mTarget->getTileY() - getTileY())); -#else const int rangeX = static_cast<int>( abs(mTarget->getTileX() - getTileX())); const int rangeY = static_cast<int>( abs(mTarget->getTileY() - getTileY())); -#endif const int attackRange = getAttackRange(); const TargetCursorType targetType = rangeX > attackRange || rangeY > attackRange ? @@ -420,475 +403,58 @@ void LocalPlayer::setGMLevel(const int level) } } -#ifdef MANASERV_SUPPORT -Position LocalPlayer::getNextWalkPosition(const unsigned char dir) const +void LocalPlayer::nextTile(unsigned char dir A_UNUSED = 0) { - // Compute where the next tile will be set. - int dx = 0, dy = 0; - if (dir & Being::UP) - dy--; - if (dir & Being::DOWN) - dy++; - if (dir & Being::LEFT) - dx--; - if (dir & Being::RIGHT) - dx++; - - const Vector &pos = getPosition(); - - // If no map or no direction is given, give back the current player position - if (!mMap || (!dx && !dy)) - return Position(static_cast<int>(pos.x), static_cast<int>(pos.y)); - - const int posX = static_cast<int>(pos.x); - const int posY = static_cast<int>(pos.y); - // Get the current tile pos and its offset - const int tileX = posX / mMap->getTileWidth(); - const int tileY = posY / mMap->getTileHeight(); - const int offsetX = posX % mMap->getTileWidth(); - const int offsetY = posY % mMap->getTileHeight(); - const unsigned char walkMask = getWalkMask(); - const int radius = getCollisionRadius(); - - // Get the walkability of every surrounding tiles. - bool wTopLeft = mMap->getWalk(tileX - 1, tileY - 1, walkMask); - const bool wTop = mMap->getWalk(tileX, tileY - 1, walkMask); - bool wTopRight = mMap->getWalk(tileX + 1, tileY - 1, walkMask); - const bool wLeft = mMap->getWalk(tileX - 1, tileY, walkMask); - const bool wRight = mMap->getWalk(tileX + 1, tileY, walkMask); - bool wBottomLeft = mMap->getWalk(tileX - 1, tileY + 1, walkMask); - const bool wBottom = mMap->getWalk(tileX, tileY + 1, walkMask); - bool wBottomRight = mMap->getWalk(tileX + 1, tileY + 1, walkMask); - - // Make diagonals unwalkable when both straight directions are blocking - if (!wTop) - { - if (!wRight) - wTopRight = false; - if (!wLeft) - wTopLeft = false; - } - if (!wBottom) - { - if (!wRight) - wBottomRight = false; - if (!wLeft) - wBottomLeft = false; - } - - // We'll make tests for each desired direction - - // Handle diagonal cases by setting the way back to a straight direction - // when necessary. - if (dx && dy) + const Party *const party = Party::getParty(1); + if (party) { - // Going top-right - if (dx > 0 && dy < 0) - { - if (!wTopRight) - { - // Choose a straight direction when diagonal target is blocked - if (!wTop && wRight) - { - dy = 0; - } - else if (wTop && !wRight) - { - dx = 0; - } - else if (!wTop && !wRight) - { - return Position(tileX * mapTileSize + mapTileSize - radius, - tileY * mapTileSize + getCollisionRadius()); - } - else // Both straight direction are walkable - { - // Go right when below the corner - if (offsetY >= (offsetX / mMap->getTileHeight() - - (offsetX / mMap->getTileWidth() - * mMap->getTileHeight()) )) - { - dy = 0; - } - else // Go up otherwise - { - dx = 0; - } - } - } - else // The diagonal is walkable - { - return mMap->checkNodeOffsets(radius, walkMask, - Position(posX + mapTileSize, posY - mapTileSize)); - } - } - - // Going top-left - if (dx < 0 && dy < 0) - { - if (!wTopLeft) - { - // Choose a straight direction when diagonal target is blocked - if (!wTop && wLeft) - { - dy = 0; - } - else if (wTop && !wLeft) - { - dx = 0; - } - else if (!wTop && !wLeft) - { - return Position(tileX * mapTileSize + radius, - tileY * mapTileSize + radius); - } - else // Both straight direction are walkable - { - // Go left when below the corner - if (offsetY >= (offsetX / mMap->getTileWidth() - * mMap->getTileHeight())) - { - dy = 0; - } - else // Go up otherwise - { - dx = 0; - } - } - } - else // The diagonal is walkable - { - return mMap->checkNodeOffsets(radius, walkMask, - Position(posX - mapTileSize, posY - mapTileSize)); - } - } - - // Going bottom-left - if (dx < 0 && dy > 0) - { - if (!wBottomLeft) - { - // Choose a straight direction when diagonal target is blocked - if (!wBottom && wLeft) - { - dy = 0; - } - else if (wBottom && !wLeft) - { - dx = 0; - } - else if (!wBottom && !wLeft) - { - return Position(tileX * mapTileSize + radius, - tileY * mapTileSize + mapTileSize - radius); - } - else // Both straight direction are walkable - { - // Go down when below the corner - if (offsetY >= (offsetX / mMap->getTileHeight() - - (offsetX / mMap->getTileWidth() - * mMap->getTileHeight()))) - { - dx = 0; - } - else // Go left otherwise - { - dy = 0; - } - } - } - else // The diagonal is walkable - { - return mMap->checkNodeOffsets(radius, walkMask, - Position(posX - mapTileSize, posY + mapTileSize)); - } - } - - // Going bottom-right - if (dx > 0 && dy > 0) + PartyMember *const pm = party->getMember(getName()); + if (pm) { - if (!wBottomRight) - { - // Choose a straight direction when diagonal target is blocked - if (!wBottom && wRight) - { - dy = 0; - } - else if (wBottom && !wRight) - { - dx = 0; - } - else if (!wBottom && !wRight) - { - return Position(tileX * mapTileSize + mapTileSize - radius, - tileY * mapTileSize + mapTileSize - radius); - } - else // Both straight direction are walkable - { - // Go down when below the corner - if (offsetY >= (offsetX / mMap->getTileWidth() - * mMap->getTileHeight())) - { - dx = 0; - } - else // Go right otherwise - { - dy = 0; - } - } - } - else // The diagonal is walkable - { - return mMap->checkNodeOffsets(radius, walkMask, - Position(posX + mapTileSize, posY + mapTileSize)); - } + pm->setX(mX); + pm->setY(mY); } - } // End of diagonal cases + } - // Straight directions - // Right direction - if (dx > 0 && !dy) + if (mPath.empty()) { - // If the straight destination is blocked, - // Make the player go the closest possible. - if (!wRight) - { - return Position(tileX * mapTileSize + mapTileSize - radius, posY); - } - else - { - if (!wTopRight) - { - // If we're going to collide with the top-right corner - if (offsetY - radius < 0) - { - // We make the player corrects its offset - // before going further - return Position(tileX * mapTileSize + mapTileSize - radius, - tileY * mapTileSize + radius); - } - } + if (mPickUpTarget) + pickUp(mPickUpTarget); - if (!wBottomRight) - { - // If we're going to collide with the bottom-right corner - if (offsetY + radius > mapTileSize) - { - // We make the player corrects its offset - // before going further - return Position(tileX * mapTileSize + mapTileSize - radius, - tileY * mapTileSize + mapTileSize - radius); - } - } - // If the way is clear, step up one checked tile ahead. - return mMap->checkNodeOffsets(radius, walkMask, - Position(posX + mapTileSize, posY)); - } + if (mWalkingDir) + startWalking(mWalkingDir); } - - // Left direction - if (dx < 0 && !dy) + else if (mPath.size() == 1) { - // If the straight destination is blocked, - // Make the player go the closest possible. - if (!wLeft) - { - return Position(tileX * mapTileSize + radius, posY); - } - else - { - if (!wTopLeft) - { - // If we're going to collide with the top-left corner - if (offsetY - radius < 0) - { - // We make the player corrects its offset - // before going further - return Position(tileX * mapTileSize + radius, - tileY * mapTileSize + radius); - } - } - - if (!wBottomLeft) - { - // If we're going to collide with the bottom-left corner - if (offsetY + radius > mapTileSize) - { - // We make the player corrects its offset - // before going further - return Position(tileX * mapTileSize + radius, - tileY * mapTileSize + mapTileSize - radius); - } - } - // If the way is clear, step up one checked tile ahead. - return mMap->checkNodeOffsets(radius, walkMask, - Position(posX - mapTileSize, posY)); - } + if (mPickUpTarget) + pickUp(mPickUpTarget); } - // Up direction - if (!dx && dy < 0) + if (mGoingToTarget && mTarget && withinAttackRange(mTarget)) { - // If the straight destination is blocked, - // Make the player go the closest possible. - if (!wTop) - { - return Position(posX, tileY * mapTileSize + radius); - } - else - { - if (!wTopLeft) - { - // If we're going to collide with the top-left corner - if (offsetX - radius < 0) - { - // We make the player corrects its offset - // before going further - return Position(tileX * mapTileSize + radius, - tileY * mapTileSize + radius); - } - } - - if (!wTopRight) - { - // If we're going to collide with the top-right corner - if (offsetX + radius > mapTileSize) - { - // We make the player corrects its offset - // before going further - return Position(tileX * mapTileSize + mapTileSize - radius, - tileY * mapTileSize + radius); - } - } - // If the way is clear, step up one checked tile ahead. - return mMap->checkNodeOffsets(radius, - walkMask, Position(posX, posY - mapTileSize)); - } + mAction = Being::STAND; + attack(mTarget, true); + mGoingToTarget = false; + mPath.clear(); + return; } - - // Down direction - if (!dx && dy > 0) + else if (mGoingToTarget && !mTarget) { - // If the straight destination is blocked, - // Make the player go the closest possible. - if (!wBottom) - { - return Position(posX, tileY * mapTileSize + mapTileSize - radius); - } - else - { - if (!wBottomLeft) - { - // If we're going to collide with the bottom-left corner - if (offsetX - radius < 0) - { - // We make the player corrects its offset - // before going further - return Position(tileX * mapTileSize + radius, - tileY * mapTileSize + mapTileSize - radius); - } - } - - if (!wBottomRight) - { - // If we're going to collide with the bottom-right corner - if (offsetX + radius > mapTileSize) - { - // We make the player corrects its offset - // before going further - return Position(tileX * mapTileSize + mapTileSize - radius, - tileY * mapTileSize + mapTileSize - radius); - } - } - // If the way is clear, step up one checked tile ahead. - return mMap->checkNodeOffsets(radius, - walkMask, Position(posX, posY + mapTileSize)); - } + mGoingToTarget = false; + mPath.clear(); } - // Return the current position if everything else has failed. - return Position(posX, posY); -} -#endif - -void LocalPlayer::nextTile(unsigned char dir A_UNUSED = 0) -{ -#ifdef MANASERV_SUPPORT - if (Net::getNetworkType() != ServerInfo::MANASERV) -#endif + if (mPath.empty()) { - const Party *const party = Party::getParty(1); - if (party) - { - PartyMember *const pm = party->getMember(getName()); - if (pm) - { - pm->setX(mX); - pm->setY(mY); - } - } - - if (mPath.empty()) - { - if (mPickUpTarget) - pickUp(mPickUpTarget); - - if (mWalkingDir) - startWalking(mWalkingDir); - } - else if (mPath.size() == 1) - { - if (mPickUpTarget) - pickUp(mPickUpTarget); - } - - if (mGoingToTarget && mTarget && withinAttackRange(mTarget)) - { - mAction = Being::STAND; - attack(mTarget, true); - mGoingToTarget = false; - mPath.clear(); - return; - } - else if (mGoingToTarget && !mTarget) - { - mGoingToTarget = false; - mPath.clear(); - } - - if (mPath.empty()) - { - if (mNavigatePath.empty() || mAction != MOVE) - setAction(STAND); - else - mNextStep = true; - } + if (mNavigatePath.empty() || mAction != MOVE) + setAction(STAND); else - { - Being::nextTile(); - } + mNextStep = true; } -#ifdef MANASERV_SUPPORT else { - if (!mMap || !dir) - return; - - const Vector &pos = getPosition(); - const Position destination = getNextWalkPosition(dir); - - if (static_cast<int>(pos.x) != destination.x - || static_cast<int>(pos.y) != destination.y) - { - setDestination(destination.x, destination.y); - } - else if (dir != mDirection) - { - Net::getPlayerHandler()->setDirection(dir); - setDirection(dir); - } + Being::nextTile(); } -#endif } bool LocalPlayer::pickUp(FloorItem *const item) @@ -916,29 +482,18 @@ bool LocalPlayer::pickUp(FloorItem *const item) } else if (mPickUpType >= 4 && mPickUpType <= 6) { -#ifdef MANASERV_SUPPORT - if (Net::getNetworkType() == ServerInfo::MANASERV) - { - setDestination(item->getPixelX() + 16, item->getPixelY() + 16); - mPickUpTarget = item; - mPickUpTarget->addActorSpriteListener(this); - } + const Vector &playerPos = getPosition(); + const Path debugPath = mMap->findPath( + static_cast<int>(playerPos.x - mapTileSize / 2) / mapTileSize, + static_cast<int>(playerPos.y - mapTileSize) / mapTileSize, + item->getTileX(), item->getTileY(), getWalkMask(), 0); + if (!debugPath.empty()) + navigateTo(item->getTileX(), item->getTileY()); else -#endif - { - const Vector &playerPos = getPosition(); - const Path debugPath = mMap->findPath( - static_cast<int>(playerPos.x - mapTileSize / 2) / mapTileSize, - static_cast<int>(playerPos.y - mapTileSize) / mapTileSize, - item->getTileX(), item->getTileY(), getWalkMask(), 0); - if (!debugPath.empty()) - navigateTo(item->getTileX(), item->getTileY()); - else - setDestination(item->getTileX(), item->getTileY()); + setDestination(item->getTileX(), item->getTileY()); - mPickUpTarget = item; - mPickUpTarget->addActorSpriteListener(this); - } + mPickUpTarget = item; + mPickUpTarget->addActorSpriteListener(this); } return true; } @@ -1024,17 +579,7 @@ void LocalPlayer::setDestination(const int x, const int y) } Being::setDestination(x, y); - -#ifdef MANASERV_SUPPORT - // Manaserv: - // If the destination given to being class is accepted, - // we inform the Server. - if ((x == mDest.x && y == mDest.y) - || Net::getNetworkType() != ServerInfo::MANASERV) -#endif - { - Net::getPlayerHandler()->setDestination(x, y, mDirection); - } + Net::getPlayerHandler()->setDestination(x, y, mDirection); } } } @@ -1042,51 +587,11 @@ void LocalPlayer::setDestination(const int x, const int y) void LocalPlayer::setWalkingDir(const unsigned char dir) { // This function is called by Game::handleInput() - -#ifdef MANASERV_SUPPORT - if (Net::getNetworkType() == ServerInfo::MANASERV) - { - // First if player is pressing key for the direction he is already - // going, do nothing more... - - // Else if he is pressing a key, and its different from what he has - // been pressing, stop (do not send this stop to the server) and - // start in the new direction - if (dir && (dir != getWalkingDir())) - stopWalking(false); - - // Else, he is not pressing a key, - // and the current path hasn't been sent by mouse, - // then, stop (sending to server). - else if (!dir) - { - if (!mPathSetByMouse) - stopWalking(true); - return; - } - - // If the delay to send another walk message to the server hasn't - // expired, don't do anything or we could get disconnected for - // spamming the server - if (get_elapsed_time(mLocalWalkTime) < walkingKeyboardDelay) - return; - } -#endif - mWalkingDir = dir; // If we're not already walking, start walking. if (mAction != MOVE && dir) - { startWalking(dir); - } -#ifdef MANASERV_SUPPORT - else if (mAction == MOVE && (Net::getNetworkType() - == ServerInfo::MANASERV)) - { - nextTile(dir); - } -#endif } void LocalPlayer::startWalking(const unsigned char dir) @@ -1100,18 +605,7 @@ void LocalPlayer::startWalking(const unsigned char dir) if (mAction == MOVE && !mPath.empty()) { // Just finish the current action, otherwise we get out of sync -#ifdef MANASERV_SUPPORT - if (Net::getNetworkType() == ServerInfo::MANASERV) - { - const Vector &pos = getPosition(); - Being::setDestination(static_cast<int>(pos.x), - static_cast<int>(pos.y)); - } - else -#endif - { - Being::setDestination(mX, mY); - } + Being::setDestination(mX, mY); return; } @@ -1125,43 +619,32 @@ void LocalPlayer::startWalking(const unsigned char dir) if (dir & RIGHT) dx++; -#ifdef MANASERV_SUPPORT - if (Net::getNetworkType() != ServerInfo::MANASERV) -#endif - { - const unsigned char walkMask = getWalkMask(); - // Prevent skipping corners over colliding tiles - if (dx && !mMap->getWalk(mX + dx, mY, walkMask)) - dx = 0; - if (dy && !mMap->getWalk(mX, mY + dy, walkMask)) - dy = 0; + const unsigned char walkMask = getWalkMask(); + // Prevent skipping corners over colliding tiles + if (dx && !mMap->getWalk(mX + dx, mY, walkMask)) + dx = 0; + if (dy && !mMap->getWalk(mX, mY + dy, walkMask)) + dy = 0; - // Choose a straight direction when diagonal target is blocked - if (dx && dy && !mMap->getWalk(mX + dx, mY + dy, walkMask)) - dx = 0; + // Choose a straight direction when diagonal target is blocked + if (dx && dy && !mMap->getWalk(mX + dx, mY + dy, walkMask)) + dx = 0; - // Walk to where the player can actually go - if ((dx || dy) && mMap->getWalk(mX + dx, mY + dy, walkMask)) - { - setDestination(mX + dx, mY + dy); - } - else if (dir != mDirection) - { - // If the being can't move, just change direction + // Walk to where the player can actually go + if ((dx || dy) && mMap->getWalk(mX + dx, mY + dy, walkMask)) + { + setDestination(mX + dx, mY + dy); + } + else if (dir != mDirection) + { + // If the being can't move, just change direction // if (client->limitPackets(PACKET_DIRECTION)) - { - Net::getPlayerHandler()->setDirection(dir); - setDirection(dir); - } + { + Net::getPlayerHandler()->setDirection(dir); + setDirection(dir); } } -#ifdef MANASERV_SUPPORT - else - { - nextTile(dir); - } -#endif } void LocalPlayer::stopWalking(const bool sendToServer) @@ -1238,18 +721,6 @@ bool LocalPlayer::emote(const uint8_t emotion) void LocalPlayer::attack(Being *const target, const bool keep, const bool dontChangeEquipment) { -#ifdef MANASERV_SUPPORT - if (Net::getNetworkType() == ServerInfo::MANASERV) - { - if (mLastAction != -1) - return; - - // Can only attack when standing still - if (mAction != STAND && mAction != ATTACK) - return; - } -#endif - mKeepAttacking = keep; if (!target || target->getType() == ActorSprite::NPC) @@ -1258,59 +729,30 @@ void LocalPlayer::attack(Being *const target, const bool keep, if (mTarget != target) setTarget(target); -#ifdef MANASERV_SUPPORT - if (Net::getNetworkType() == ServerInfo::MANASERV) - { - const Vector &plaPos = this->getPosition(); - const Vector &tarPos = mTarget->getPosition(); - const int dist_x = static_cast<int>(plaPos.x - tarPos.x); - const int dist_y = static_cast<int>(plaPos.y - tarPos.y); + const int dist_x = target->getTileX() - mX; + const int dist_y = target->getTileY() - mY; - if (abs(dist_y) >= abs(dist_x)) - { - if (dist_y < 0) - setDirection(DOWN); - else - setDirection(UP); - } - else - { - if (dist_x < 0) - setDirection(RIGHT); - else - setDirection(LEFT); - } + // Must be standing or sitting to attack + if (mAction != STAND && mAction != SIT) + return; - mLastAction = tick_time; + if (abs(dist_y) >= abs(dist_x)) + { + if (dist_y > 0) + setDirection(DOWN); + else + setDirection(UP); } else -#endif { - const int dist_x = target->getTileX() - mX; - const int dist_y = target->getTileY() - mY; - - // Must be standing or sitting to attack - if (mAction != STAND && mAction != SIT) - return; - - if (abs(dist_y) >= abs(dist_x)) - { - if (dist_y > 0) - setDirection(DOWN); - else - setDirection(UP); - } + if (dist_x > 0) + setDirection(RIGHT); else - { - if (dist_x > 0) - setDirection(RIGHT); - else - setDirection(LEFT); - } - - mActionTime = tick_time; + setDirection(LEFT); } + mActionTime = tick_time; + if (target->getType() != Being::PLAYER || checAttackPermissions(target)) { setAction(ATTACK); @@ -1324,11 +766,7 @@ void LocalPlayer::attack(Being *const target, const bool keep, Net::getPlayerHandler()->attack(target->getId(), mServerAttack); } -#ifdef MANASERV_SUPPORT - if ((Net::getNetworkType() != ServerInfo::MANASERV) && !keep) -#else if (!keep) -#endif stopAttack(); } @@ -1476,20 +914,8 @@ bool LocalPlayer::withinAttackRange(const Being *const target, if (fixDistance && range == 1) range = 2; -#ifdef MANASERV_SUPPORT - if (Net::getNetworkType() == ServerInfo::MANASERV) - { - const Vector &targetPos = target->getPosition(); - const Vector &pos = getPosition(); - dx = static_cast<int>(abs(static_cast<int>(targetPos.x - pos.x))); - dy = static_cast<int>(abs(static_cast<int>(targetPos.y - pos.y))); - } - else -#endif - { - dx = static_cast<int>(abs(target->getTileX() - mX)); - dy = static_cast<int>(abs(target->getTileY() - mY)); - } + dx = static_cast<int>(abs(target->getTileX() - mX)); + dy = static_cast<int>(abs(target->getTileY() - mY)); return !(dx > range || dy > range); } @@ -1499,22 +925,9 @@ void LocalPlayer::setGotoTarget(Being *const target) return; mPickUpTarget = nullptr; -#ifdef MANASERV_SUPPORT - if (Net::getNetworkType() == ServerInfo::MANASERV) - { - mTarget = target; - mGoingToTarget = true; - const Vector &targetPos = target->getPosition(); - setDestination(static_cast<int>(targetPos.x), - static_cast<int>(targetPos.y)); - } - else -#endif - { - setTarget(target); - mGoingToTarget = true; - setDestination(target->getTileX(), target->getTileY()); - } + setTarget(target); + mGoingToTarget = true; + setDestination(target->getTileX(), target->getTileY()); } void LocalPlayer::handleStatusEffect(StatusEffect *const effect, @@ -3192,16 +2605,6 @@ bool LocalPlayer::pickUpItems(int pickUpType) void LocalPlayer::moveByDirection(const unsigned char dir) { int dx = 0, dy = 0; -#ifdef MANASERV_SUPPORT - if (dir & UP) - dy -= mapTileSize; - if (dir & DOWN) - dy += mapTileSize; - if (dir & LEFT) - dx -= mapTileSize; - if (dir & RIGHT) - dx += mapTileSize; -#else if (dir & UP) dy--; if (dir & DOWN) @@ -3210,8 +2613,6 @@ void LocalPlayer::moveByDirection(const unsigned char dir) dx--; if (dir & RIGHT) dx++; -#endif - move(dx, dy); } diff --git a/src/being/playerinfo.cpp b/src/being/playerinfo.cpp index c9b10b4a6..728fe786f 100644 --- a/src/being/playerinfo.cpp +++ b/src/being/playerinfo.cpp @@ -48,11 +48,6 @@ int mCharId = 0; Inventory *mInventory = nullptr; Equipment *mEquipment = nullptr; -#ifdef MANASERV_SUPPORT -std::map<int, Special> mSpecials; -signed char mSpecialRechargeUpdateNeeded = 0; -#endif - bool mTrading = false; int mLevelProgress = 0; std::set<int> mProtectedItems; @@ -365,20 +360,6 @@ int getCharId() void logic() { -#ifdef MANASERV_SUPPORT - if ((mSpecialRechargeUpdateNeeded % 11) == 0) - { - mSpecialRechargeUpdateNeeded = 0; - FOR_EACH (SpecialsMap::iterator, it, mSpecials) - { - Special &special = it->second; - special.currentMana += special.recharge; - if (special.currentMana > special.neededMana) - special.currentMana = special.neededMana; - } - } - mSpecialRechargeUpdateNeeded++; -#endif } bool isTrading() diff --git a/src/client.cpp b/src/client.cpp index 990306fc1..daae02221 100644 --- a/src/client.cpp +++ b/src/client.cpp @@ -103,9 +103,6 @@ #include "resources/db/moddb.h" #include "resources/db/monsterdb.h" #include "resources/db/npcdb.h" -#ifdef MANASERV_SUPPORT -#include "resources/db/specialdb.h" -#endif #include "resources/db/palettedb.h" #include "resources/db/petdb.h" #include "resources/db/weaponsdb.h" @@ -1466,9 +1463,6 @@ int Client::gameExec() ItemDB::load(); Being::load(); MonsterDB::load(); -#ifdef MANASERV_SUPPORT - SpecialDB::load(); -#endif AvatarDB::load(); WeaponsDB::load(); NPCDB::load(); diff --git a/src/game.cpp b/src/game.cpp index e0957b57d..253c4bff2 100644 --- a/src/game.cpp +++ b/src/game.cpp @@ -49,9 +49,6 @@ #include "input/keyboardconfig.h" #include "gui/gui.h" -#ifdef MANASERV_SUPPORT -#include "gui/specialswindow.h" -#endif #include "gui/viewport.h" #include "gui/windowmenu.h" @@ -139,9 +136,6 @@ DebugWindow *debugWindow = nullptr; ShortcutWindow *itemShortcutWindow = nullptr; ShortcutWindow *emoteShortcutWindow = nullptr; OutfitWindow *outfitWindow = nullptr; -#ifdef MANASERV_SUPPORT -SpecialsWindow *specialsWindow = nullptr; -#endif ShortcutWindow *dropShortcutWindow = nullptr; ShortcutWindow *spellShortcutWindow = nullptr; WhoIsOnline *whoIsOnline = nullptr; @@ -249,9 +243,6 @@ static void createGuiWindows() "emotes.xml", 130, 480); outfitWindow = new OutfitWindow(); -#ifdef MANASERV_SUPPORT - specialsWindow = new SpecialsWindow(); -#endif dropShortcutWindow = new ShortcutWindow("DropShortcut", new DropShortcutContainer(nullptr), "drops.xml"); @@ -373,9 +364,6 @@ static void destroyGuiWindows() del_0(itemShortcutWindow) del_0(emoteShortcutWindow) del_0(outfitWindow) -#ifdef MANASERV_SUPPORT - del_0(specialsWindow) -#endif del_0(socialWindow) del_0(dropShortcutWindow); del_0(spellShortcutWindow); diff --git a/src/gui/models/typelistmodel.h b/src/gui/models/typelistmodel.h index d7b6226b0..f9c005f8f 100644 --- a/src/gui/models/typelistmodel.h +++ b/src/gui/models/typelistmodel.h @@ -38,18 +38,10 @@ class TypeListModel : public ListModel */ int getNumberOfElements() override final A_WARN_UNUSED #ifdef EATHENA_SUPPORT -#ifdef MANASERV_SUPPORT - { return 4; } -#else - { return 3; } -#endif -#else -#ifdef MANASERV_SUPPORT { return 3; } #else { return 2; } #endif -#endif /** * Used to get an element from the list @@ -64,15 +56,6 @@ class TypeListModel : public ListModel #ifdef EATHENA_SUPPORT else if (elementIndex == 2) return "eAthena"; -#ifdef MANASERV_SUPPORT - else if (elementIndex == 3) - return "ManaServ"; -#endif -#else -#ifdef MANASERV_SUPPORT - else if (elementIndex == 2) - return "ManaServ"; -#endif #endif else return "Unknown"; diff --git a/src/gui/viewport.cpp b/src/gui/viewport.cpp index 500378628..96760f8c7 100644 --- a/src/gui/viewport.cpp +++ b/src/gui/viewport.cpp @@ -343,46 +343,21 @@ void Viewport::_drawPath(Graphics *const graphics, const Path &path, graphics->setColor(color); Font *const font = getFont(); -#ifdef MANASERV_SUPPORT - if (Net::getNetworkType() != ServerInfo::MANASERV) -#endif + int cnt = 1; + FOR_EACH (Path::const_iterator, i, path) { - int cnt = 1; - FOR_EACH (Path::const_iterator, i, path) - { - const int squareX = i->x * mapTileSize - mPixelViewX + 12; - const int squareY = i->y * mapTileSize - mPixelViewY + 12; + const int squareX = i->x * mapTileSize - mPixelViewX + 12; + const int squareY = i->y * mapTileSize - mPixelViewY + 12; - graphics->fillRectangle(Rect(squareX, squareY, 8, 8)); - if (mMap) - { - const std::string str = toString(cnt); - font->drawString(graphics, str, squareX + 4 - - font->getWidth(str) / 2, squareY + 12); - } - cnt ++; - } - } -#ifdef MANASERV_SUPPORT - else if (Net::getNetworkType() == ServerInfo::MANASERV) - { - FOR_EACH (Path::const_iterator, i, path) + graphics->fillRectangle(Rect(squareX, squareY, 8, 8)); + if (mMap) { - const int squareX = i->x - mPixelViewX; - const int squareY = i->y - mPixelViewY; - - graphics->fillRectangle(Rect( - squareX - 4, squareY - 4, 8, 8)); - if (mMap) - { - const std::string str = toString(mMap->getMetaTile( - i->x / mapTileSize, i->y / mapTileSize)->Gcost); - font->drawString(graphics, str, - squareX + 4 - font->getWidth(text) / 2, squareY + 12); - } + const std::string str = toString(cnt); + font->drawString(graphics, str, squareX + 4 + - font->getWidth(str) / 2, squareY + 12); } + cnt ++; } -#endif } void Viewport::mousePressed(MouseEvent &event) @@ -557,127 +532,111 @@ void Viewport::mouseDragged(MouseEvent &event) Input::KEY_STOP_ATTACK) && !inputManager.isActionActive( Input::KEY_UNTARGET)) { -#ifdef MANASERV_SUPPORT - if (Net::getNetworkType() == ServerInfo::MANASERV) - { - if (get_elapsed_time(mLocalWalkTime) >= walkingMouseDelay) - { - mLocalWalkTime = tick_time; - player_node->unSetPickUpTarget(); - player_node->setDestination(event.getX() + mPixelViewX, - event.getY() + mPixelViewY); - player_node->pathSetByMouse(); - } - } - else -#endif + if (mLocalWalkTime != player_node->getActionTime()) { - if (mLocalWalkTime != player_node->getActionTime()) + mLocalWalkTime = cur_time; + player_node->unSetPickUpTarget(); + int playerX = player_node->getTileX(); + int playerY = player_node->getTileY(); + if (mMouseDirectionMove) { - mLocalWalkTime = cur_time; - player_node->unSetPickUpTarget(); - int playerX = player_node->getTileX(); - int playerY = player_node->getTileY(); - if (mMouseDirectionMove) + const int width = mainGraphics->mWidth / 2; + const int height = mainGraphics->mHeight / 2; + const float wh = static_cast<float>(width) + / static_cast<float>(height); + int x = event.getX() - width; + int y = event.getY() - height; + if (!x && !y) + return; + const int x2 = abs(x); + const int y2 = abs(y); + const float diff = 2; + int dx = 0; + int dy = 0; + if (x2 > y2) { - const int width = mainGraphics->mWidth / 2; - const int height = mainGraphics->mHeight / 2; - const float wh = static_cast<float>(width) - / static_cast<float>(height); - int x = event.getX() - width; - int y = event.getY() - height; - if (!x && !y) - return; - const int x2 = abs(x); - const int y2 = abs(y); - const float diff = 2; - int dx = 0; - int dy = 0; - if (x2 > y2) - { - if (y2 && x2 / y2 / wh > diff) - y = 0; - } - else - { - if (x2 && y2 * wh / x2 > diff) - x = 0; - } - if (x > 0) - dx = 1; - else if (x < 0) - dx = -1; - if (y > 0) - dy = 1; - else if (y < 0) - dy = -1; - - if (mMap->getWalk(playerX + dx, playerY + dy)) + if (y2 && x2 / y2 / wh > diff) + y = 0; + } + else + { + if (x2 && y2 * wh / x2 > diff) + x = 0; + } + if (x > 0) + dx = 1; + else if (x < 0) + dx = -1; + if (y > 0) + dy = 1; + else if (y < 0) + dy = -1; + + if (mMap->getWalk(playerX + dx, playerY + dy)) + { + player_node->navigateTo(playerX + dx, playerY + dy); + } + else + { + if (dx && dy) { - player_node->navigateTo(playerX + dx, playerY + dy); + // try avoid diagonal collision + if (x2 > y2) + { + if (mMap->getWalk(playerX + dx, playerY)) + dy = 0; + else + dx = 0; + } + else + { + if (mMap->getWalk(playerX, playerY + dy)) + dx = 0; + else + dy = 0; + } } else { - if (dx && dy) + // try avoid vertical or horisontal collision + if (!dx) { - // try avoid diagonal collision - if (x2 > y2) - { - if (mMap->getWalk(playerX + dx, playerY)) - dy = 0; - else - dx = 0; - } - else - { - if (mMap->getWalk(playerX, playerY + dy)) - dx = 0; - else - dy = 0; - } + if (mMap->getWalk(playerX + 1, playerY + dy)) + dx = 1; + if (mMap->getWalk(playerX - 1, playerY + dy)) + dx = -1; } - else + if (!dy) { - // try avoid vertical or horisontal collision - if (!dx) - { - if (mMap->getWalk(playerX + 1, playerY + dy)) - dx = 1; - if (mMap->getWalk(playerX - 1, playerY + dy)) - dx = -1; - } - if (!dy) - { - if (mMap->getWalk(playerX + dx, playerY + 1)) - dy = 1; - if (mMap->getWalk(playerX + dx, playerY - 1)) - dy = -1; - } + if (mMap->getWalk(playerX + dx, playerY + 1)) + dy = 1; + if (mMap->getWalk(playerX + dx, playerY - 1)) + dy = -1; } - player_node->navigateTo(playerX + dx, playerY + dy); } + player_node->navigateTo(playerX + dx, playerY + dy); } - else + } + else + { + const int destX = (event.getX() + mPixelViewX) + / static_cast<float>(mMap->getTileWidth()); + const int destY = (event.getY() + mPixelViewY) + / static_cast<float>(mMap->getTileHeight()); + if (playerX != destX || playerY != destY) { - const int destX = (event.getX() + mPixelViewX) - / static_cast<float>(mMap->getTileWidth()); - const int destY = (event.getY() + mPixelViewY) - / static_cast<float>(mMap->getTileHeight()); - if (playerX != destX || playerY != destY) + if (!player_node->navigateTo(destX, destY)) { - if (!player_node->navigateTo(destX, destY)) - { - if (playerX > destX) - playerX --; - else if (playerX < destX) - playerX ++; - if (playerY > destY) - playerY --; - else if (playerY < destY) - playerY ++; - if (mMap->getWalk(playerX, playerY, 0)) - player_node->navigateTo(playerX, playerY); - } + if (playerX > destX) + playerX --; + else if (playerX < destX) + playerX ++; + if (playerY > destY) + playerY --; + else if (playerY < destY) + playerY ++; + if (mMap->getWalk(playerX, playerY, 0)) + player_node->navigateTo(playerX, playerY); } } } @@ -688,7 +647,6 @@ void Viewport::mouseDragged(MouseEvent &event) void Viewport::mouseReleased(MouseEvent &event A_UNUSED) { mPlayerFollowMouse = false; - // Only useful for eAthena but doesn't hurt under ManaServ mLocalWalkTime = -1; } diff --git a/src/gui/windowmenu.cpp b/src/gui/windowmenu.cpp index 40a5445ca..795f2ad5a 100644 --- a/src/gui/windowmenu.cpp +++ b/src/gui/windowmenu.cpp @@ -31,9 +31,6 @@ #include "gui/popups/textpopup.h" #include "gui/windows/skilldialog.h" -#ifdef MANASERV_SUPPORT -#include "gui/specialswindow.h" -#endif #include "gui/widgets/button.h" @@ -111,15 +108,6 @@ WindowMenu::WindowMenu(const Widget2 *const widget) : _("Skills"), x, h, Input::KEY_WINDOW_SKILL); } -#ifdef MANASERV_SUPPORT - if (Net::getNetworkType() == ServerInfo::MANASERV) - { - // TRANSLATORS: short button name for specials window. - addButton(N_("SPE"), - _("Specials"), x, h, Input::KEY_NO_VALUE); - } -#endif - // TRANSLATORS: short button name for social window. addButton(N_("SOC"), // TRANSLATORS: full button name diff --git a/src/gui/windows/charcreatedialog.cpp b/src/gui/windows/charcreatedialog.cpp index 4f98cb931..a877f45e0 100644 --- a/src/gui/windows/charcreatedialog.cpp +++ b/src/gui/windows/charcreatedialog.cpp @@ -325,11 +325,7 @@ void CharCreateDialog::action(const ActionEvent &event) const std::string id = event.getId(); if (id == "create") { - if ( -#ifdef MANASERV_SUPPORT - Net::getNetworkType() == ServerInfo::MANASERV || -#endif - getName().length() >= 4) + if (getName().length() >= 4) { // Attempt to create the character mCreateButton->setEnabled(false); @@ -341,14 +337,7 @@ void CharCreateDialog::action(const ActionEvent &event) mAttributeSlider[i]->getValue())); } -#ifdef MANASERV_SUPPORT - int characterSlot = mSlot; - // On Manaserv, the slots start at 1, so we offset them. - if (Net::getNetworkType() == ServerInfo::MANASERV) - ++characterSlot; -#else const int characterSlot = mSlot; -#endif Net::getCharServerHandler()->newCharacter(getName(), characterSlot, mFemale->isSelected(), mHairStyle, mHairColor, diff --git a/src/gui/windows/charselectdialog.cpp b/src/gui/windows/charselectdialog.cpp index d67c15bf0..3ef378aa0 100644 --- a/src/gui/windows/charselectdialog.cpp +++ b/src/gui/windows/charselectdialog.cpp @@ -474,14 +474,7 @@ void CharSelectDialog::setCharacters(const Net::Characters &characters) Net::Character *const character = *i; // Slots Number start at 1 for Manaserv, so we offset them by one. -#ifdef MANASERV_SUPPORT - int characterSlot = character->slot; - if (Net::getNetworkType() == ServerInfo::MANASERV && characterSlot > 0) - --characterSlot; -#else const int characterSlot = character->slot; -#endif - if (characterSlot >= static_cast<int>(mCharacterEntries.size())) { logger->log("Warning: slot out of range: %d", character->slot); diff --git a/src/gui/windows/editserverdialog.cpp b/src/gui/windows/editserverdialog.cpp index e236841a5..c4e490091 100644 --- a/src/gui/windows/editserverdialog.cpp +++ b/src/gui/windows/editserverdialog.cpp @@ -139,21 +139,11 @@ EditServerDialog::EditServerDialog(ServerDialog *const parent, case ServerInfo::EATHENA: mTypeField->setSelected(2); break; - case ServerInfo::MANASERV: -#ifdef MANASERV_SUPPORT - mTypeField->setSelected(3); - break; -#endif -#else - case ServerInfo::MANASERV: -#ifdef MANASERV_SUPPORT - mTypeField->setSelected(2); - break; -#endif #endif default: case ServerInfo::UNKNOWN: case ServerInfo::TMWATHENA: + case ServerInfo::MANASERV: #ifndef EATHENA_SUPPORT case ServerInfo::EATHENA: #endif @@ -226,17 +216,6 @@ void EditServerDialog::action(const ActionEvent &event) case 2: mServer.type = ServerInfo::EATHENA; break; -#ifdef MANASERV_SUPPORT - case 3: - mServer.type = ServerInfo::MANASERV; - break; -#endif -#else -#ifdef MANASERV_SUPPORT - case 2: - mServer.type = ServerInfo::MANASERV; - break; -#endif #endif default: mServer.type = ServerInfo::UNKNOWN; diff --git a/src/gui/windows/selldialog.cpp b/src/gui/windows/selldialog.cpp index 524c77366..8bfcc6728 100644 --- a/src/gui/windows/selldialog.cpp +++ b/src/gui/windows/selldialog.cpp @@ -258,20 +258,10 @@ void SellDialog::action(const ActionEvent &event) mMaxItems -= mAmountItems; while (mAmountItems > 0) { -#ifdef MANASERV_SUPPORT - // This order is important, item->getCurrentInvIndex() would - // return the inventory index of the next Duplicate otherwise. - int itemIndex = item->getCurrentInvIndex(); - const int sellCount = item->sellCurrentDuplicate(mAmountItems); - // For Manaserv, the Item id is to be given as index. - if ((Net::getNetworkType() == ServerInfo::MANASERV)) - itemIndex = item->getId(); -#else // This order is important, item->getCurrentInvIndex() would // return the inventory index of the next Duplicate otherwise. const int itemIndex = item->getCurrentInvIndex(); const int sellCount = item->sellCurrentDuplicate(mAmountItems); -#endif Net::getNpcHandler()->sellItem(mNpcId, itemIndex, sellCount); mAmountItems -= sellCount; } diff --git a/src/gui/windows/serverdialog.cpp b/src/gui/windows/serverdialog.cpp index 579e9ad18..faae75ab3 100644 --- a/src/gui/windows/serverdialog.cpp +++ b/src/gui/windows/serverdialog.cpp @@ -63,20 +63,12 @@ static std::string serverTypeToString(const ServerInfo::Type type) return "TmwAthena"; case ServerInfo::EVOL: return "Evol"; -#ifdef EATHENA_SUPPORT case ServerInfo::EATHENA: +#ifdef EATHENA_SUPPORT return "eAthena"; #endif -#ifdef MANASERV_SUPPORT - case ServerInfo::MANASERV: - return "ManaServ"; -#else - case ServerInfo::MANASERV: -#endif -#ifndef EATHENA_SUPPORT - case ServerInfo::EATHENA: -#endif default: + case ServerInfo::MANASERV: case ServerInfo::UNKNOWN: return ""; } @@ -90,20 +82,12 @@ static uint16_t defaultPortForServerType(const ServerInfo::Type type) case ServerInfo::EATHENA: #ifdef EATHENA_SUPPORT return 6900; -#else - return 6901; #endif case ServerInfo::UNKNOWN: case ServerInfo::TMWATHENA: case ServerInfo::EVOL: -#ifdef MANASERV_SUPPORT - return 6901; - case ServerInfo::MANASERV: - return 9601; -#else case ServerInfo::MANASERV: return 6901; -#endif } } diff --git a/src/main.h b/src/main.h index 2035338a6..1884be6a5 100644 --- a/src/main.h +++ b/src/main.h @@ -40,7 +40,7 @@ * by the map, interleaved with the tiles in the fringe layer. * * The client supports two servers, \link EAthena eAthena\endlink (the TMW - * version) and the \link ManaServ Mana server\endlink. To achieve this, the + * version) and the \link EvolServ server\endlink. To achieve this, the * \link Net network communication layer\endlink is abstracted in many * different interfaces, which have different implementations for each server. */ diff --git a/src/map.cpp b/src/map.cpp index 4e654198c..70a48b811 100644 --- a/src/map.cpp +++ b/src/map.cpp @@ -800,131 +800,6 @@ const std::string Map::getFilename() const return fileName.substr(lastSlash, fileName.rfind(".") - lastSlash); } -#ifdef MANASERV_SUPPORT -Position Map::checkNodeOffsets(int radius, const unsigned char walkMask, - const Position &position) const -{ - // Pre-computing character's position in tiles - const int tx = position.x / mapTileSize; - const int ty = position.y / mapTileSize; - - // Pre-computing character's position offsets. - int fx = position.x % mapTileSize; - int fy = position.y % mapTileSize; - - // Compute the being radius: - // FIXME: Hande beings with more than 1/2 tile radius by not letting them - // go or spawn in too narrow places. The server will have to be aware - // of being's radius value (in tiles) to handle this gracefully. - if (radius > mapTileSize / 2) - radius = mapTileSize / 2; - // set a default value if no value returned. - if (radius < 1) - radius = mapTileSize / 3; - - // We check diagonal first as they are more restrictive. - // Top-left border check - if (!getWalk(tx - 1, ty - 1, walkMask) - && fy < radius && fx < radius) - { - fx = radius; - fy = radius; - } - // Top-right border check - if (!getWalk(tx + 1, ty - 1, walkMask) - && (fy < radius) && fx > (mapTileSize - radius)) - { - fx = mapTileSize - radius; - fy = radius; - } - // Bottom-left border check - if (!getWalk(tx - 1, ty + 1, walkMask) - && fy > (mapTileSize - radius) && fx < radius) - { - fx = radius; - fy = mapTileSize - radius; - } - // Bottom-right border check - if (!getWalk(tx + 1, ty + 1, walkMask) - && fy > (mapTileSize - radius) && fx > (mapTileSize - radius)) - { - fx = mapTileSize - radius; - fy = fx; - } - - // Fix coordinates so that the player does not seem to dig into walls. - if (fx > (mapTileSize - radius) && !getWalk(tx + 1, ty, walkMask)) - fx = mapTileSize - radius; - else if (fx < radius && !getWalk(tx - 1, ty, walkMask)) - fx = radius; - else if (fy > (mapTileSize - radius) && !getWalk(tx, ty + 1, walkMask)) - fy = mapTileSize - radius; - else if (fy < radius && !getWalk(tx, ty - 1, walkMask)) - fy = radius; - - return Position(tx * mapTileSize + fx, ty * mapTileSize + fy); -} - -Path Map::findPixelPath(const int startPixelX, const int startPixelY, - const int endPixelX, const int endPixelY, - const int radius, const unsigned char walkMask, - const int maxCost) -{ - Path myPath = findPath(startPixelX / mapTileSize, - startPixelY / mapTileSize, - endPixelX / mapTileSize, - endPixelY / mapTileSize, - walkMask, maxCost); - - // Don't compute empty coordinates. - if (myPath.empty()) - return myPath; - - // Find the starting offset - const float startOffsetX = static_cast<float>(startPixelX % mapTileSize); - const float startOffsetY = static_cast<float>(startPixelY % mapTileSize); - - // Find the ending offset - const float endOffsetX = static_cast<float>(endPixelX % mapTileSize); - const float endOffsetY = static_cast<float>(endPixelY % mapTileSize); - - const int sz = static_cast<int>(myPath.size()); - // Find the distance, and divide it by the number of steps - const int changeX = static_cast<int>((endOffsetX - startOffsetX) - / static_cast<float>(sz)); - const int changeY = static_cast<int>((endOffsetY - startOffsetY) - / static_cast<float>(sz)); - - // Convert the map path to pixels over tiles - // And add interpolation between the starting and ending offsets - Path::iterator it = myPath.begin(); - const Path::iterator it_end = myPath.end(); - int i = 0; - while (it != it_end) - { - // A position that is valid on the start and end tile is not - // necessarily valid on all the tiles in between, so check the offsets. - *it = checkNodeOffsets(radius, walkMask, - it->x * mapTileSize + startOffsetX - + static_cast<float>(changeX * i), - it->y * mapTileSize + startOffsetY - + static_cast<float>(changeY * i)); - i++; - ++it; - } - - // Remove the last path node, as it's more clever to go to the destination. - // It also permit to avoid zigzag at the end of the path, - // especially with mouse. - const Position destination = checkNodeOffsets(radius, walkMask, - endPixelX, endPixelY); - myPath.pop_back(); - myPath.push_back(destination); - - return myPath; -} -#endif - Path Map::findPath(const int startX, const int startY, const int destX, const int destY, const unsigned char walkmask, const int maxCost) @@ -278,29 +278,6 @@ class Map final : public Properties, public ConfigListener */ const std::string getFilename() const A_WARN_UNUSED; -#ifdef MANASERV_SUPPORT - /** - * Check the current position against surrounding blocking tiles, and - * correct the position offset within tile when needed. - */ - Position checkNodeOffsets(int radius, const unsigned char walkMask, - const Position &position) - const A_WARN_UNUSED; - - Position checkNodeOffsets(const int radius, - const unsigned char walkMask, - const int x, const int y) const A_WARN_UNUSED - { return checkNodeOffsets(radius, walkMask, Position(x, y)); } - - /** - * Find a pixel path from one location to the next. - */ - Path findPixelPath(const int startPixelX, const int startPixelY, - const int destPixelX, const int destPixelY, - const int radius, const unsigned char walkmask, - const int maxCost = 20) A_WARN_UNUSED; -#endif - /** * Find a path from one location to the next. */ diff --git a/src/net/ea/loginhandler.cpp b/src/net/ea/loginhandler.cpp index 62514b10b..44d834b94 100644 --- a/src/net/ea/loginhandler.cpp +++ b/src/net/ea/loginhandler.cpp @@ -70,12 +70,7 @@ void LoginHandler::loginAccount(LoginData *const loginData1) const { if (loginData1) { - // Since we're attempting to use the tAthena protocol, - // let's reset the character slots to the good value, - // in case we just logged out a Manaserv server - // with a different config. loginData1->resetCharacterSlots(); - sendLoginRegister(loginData1->username, loginData1->password, ""); } } diff --git a/src/net/loginhandler.h b/src/net/loginhandler.h index 0c3fa27ff..91c2e4603 100644 --- a/src/net/loginhandler.h +++ b/src/net/loginhandler.h @@ -36,11 +36,6 @@ namespace Net class LoginHandler { public: - /** - * This enum describes options specific to either eAthena or Manaserv. - * By querying for these flags, the GUI can adapt to the current - * server type dynamically. - */ enum OptionalAction { Unregister = 0x1, diff --git a/src/net/messagein.cpp b/src/net/messagein.cpp index 81340ba33..a6008da42 100644 --- a/src/net/messagein.cpp +++ b/src/net/messagein.cpp @@ -97,10 +97,7 @@ uint8_t MessageIn::fromServerDirection(const uint8_t serverDir) case 7: return 9; case 8: -#ifdef MANASERV_SUPPORT - if (Net::getNetworkType() != ServerInfo::MANASERV) -#endif - return 8; + return 8; default: logger->log("incorrect direction: %d", static_cast<int>(serverDir)); diff --git a/src/net/net.cpp b/src/net/net.cpp index c7a4f33f7..6b744c673 100644 --- a/src/net/net.cpp +++ b/src/net/net.cpp @@ -32,10 +32,6 @@ #include "net/eathena/generalhandler.h" #endif -#ifdef MANASERV_SUPPORT -#include "net/manaserv/generalhandler.h" -#endif - #include "debug.h" Net::AdminHandler *adminHandler = nullptr; @@ -163,12 +159,6 @@ void connectToServer(const ServerInfo &server) #endif break; case ServerInfo::MANASERV: -#ifdef MANASERV_SUPPORT - new ManaServ::GeneralHandler; -#else - new TmwAthena::GeneralHandler; -#endif - break; case ServerInfo::TMWATHENA: case ServerInfo::UNKNOWN: default: diff --git a/src/net/serverinfo.h b/src/net/serverinfo.h index 0b17184fd..6035a1f51 100644 --- a/src/net/serverinfo.h +++ b/src/net/serverinfo.h @@ -139,10 +139,6 @@ public: else if (compareStrI(serverType, "eathena") == 0) return TMWATHENA; #endif -#ifdef MANASERV_SUPPORT - else if (compareStrI(serverType, "manaserv") == 0) - return MANASERV; -#endif return UNKNOWN; } }; diff --git a/src/resources/db/monsterdb.cpp b/src/resources/db/monsterdb.cpp index 9b9112f0f..7bdbeb33d 100644 --- a/src/resources/db/monsterdb.cpp +++ b/src/resources/db/monsterdb.cpp @@ -68,14 +68,8 @@ void MonsterDB::loadXmlFile(const std::string &fileName) return; } -#ifdef MANASERV_SUPPORT - const int offset = XML::getProperty(rootNode, "offset", - Net::getNetworkType() != ServerInfo::MANASERV - ? OLD_TMWATHENA_OFFSET : 0); -#else const int offset = XML::getProperty(rootNode, "offset", OLD_TMWATHENA_OFFSET); -#endif // iterate <monster>s for_each_xml_child_node(monsterNode, rootNode) |