summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/client.cpp1
-rw-r--r--src/compoundsprite.cpp12
-rw-r--r--src/configuration.cpp5
-rw-r--r--src/configuration.h8
-rw-r--r--src/defaults.cpp2
-rw-r--r--src/game.cpp131
-rw-r--r--src/game.h13
-rw-r--r--src/gui/setup.cpp3
-rw-r--r--src/gui/setup_other.cpp2
-rw-r--r--src/gui/setup_video.cpp60
-rw-r--r--src/gui/setup_video.h6
-rw-r--r--src/localplayer.h6
-rw-r--r--src/main.h4
-rw-r--r--src/map.cpp52
-rw-r--r--src/map.h1
-rw-r--r--src/net/tmwa/npchandler.cpp3
16 files changed, 260 insertions, 49 deletions
diff --git a/src/client.cpp b/src/client.cpp
index 68f31bd27..01543d8be 100644
--- a/src/client.cpp
+++ b/src/client.cpp
@@ -849,6 +849,7 @@ int Client::exec()
{
delete game;
game = 0;
+ Game::clearInstance();
ResourceManager *resman = ResourceManager::getInstance();
if (resman)
resman->cleanOrphans();
diff --git a/src/compoundsprite.cpp b/src/compoundsprite.cpp
index 6f80e2c7b..1642416ea 100644
--- a/src/compoundsprite.cpp
+++ b/src/compoundsprite.cpp
@@ -406,13 +406,15 @@ void CompoundSprite::setAlpha(float alpha)
{
if (alpha != mAlpha)
{
- SpriteConstIterator it, it_end;
- for (it = begin(), it_end = end(); it != it_end; ++ it)
+ if (Image::mUseOpenGL == 0 && size() > 3)
{
- if (*it)
- (*it)->setAlpha(alpha);
+ SpriteConstIterator it, it_end;
+ for (it = begin(), it_end = end(); it != it_end; ++ it)
+ {
+ if (*it)
+ (*it)->setAlpha(alpha);
+ }
}
-
mAlpha = alpha;
}
}
diff --git a/src/configuration.cpp b/src/configuration.cpp
index 5dca06b56..7d1f41fe5 100644
--- a/src/configuration.cpp
+++ b/src/configuration.cpp
@@ -66,6 +66,11 @@ void Configuration::setValue(const std::string &key, const std::string &value)
}
}
+void Configuration::setSilent(const std::string &key, const std::string &value)
+{
+ ConfigurationObject::setValue(key, value);
+}
+
std::string ConfigurationObject::getValue(const std::string &key,
const std::string &deflt) const
{
diff --git a/src/configuration.h b/src/configuration.h
index 4b0238e9a..2e694002d 100644
--- a/src/configuration.h
+++ b/src/configuration.h
@@ -246,9 +246,14 @@ class Configuration : public ConfigurationObject
void setValue(const std::string &key, const std::string &value);
+ void setSilent(const std::string &key, const std::string &value);
+
inline void setValue(const std::string &key, const char *value)
{ setValue(key, std::string(value)); }
+ inline void setSilent(const std::string &key, const char *value)
+ { setSilent(key, std::string(value)); }
+
inline void setValue(const std::string &key, float value)
{ setValue(key, toString(value)); }
@@ -267,6 +272,9 @@ class Configuration : public ConfigurationObject
inline void setValue(const std::string &key, bool value)
{ setValue(key, value ? "1" : "0"); }
+ inline void setSilent(const std::string &key, bool value)
+ { setSilent(key, value ? "1" : "0"); }
+
int resetIntValue(const std::string &key);
bool resetBoolValue(const std::string &key);
diff --git a/src/defaults.cpp b/src/defaults.cpp
index ad908ad78..7b5f5255a 100644
--- a/src/defaults.cpp
+++ b/src/defaults.cpp
@@ -208,6 +208,8 @@ DefaultsData* getConfigDefaults()
AddDEF(configData, "enableAdvert", true);
AddDEF(configData, "enableMapReduce", true);
AddDEF(configData, "showPlayersStatus", true);
+ AddDEF(configData, "beingopacity", false);
+ AddDEF(configData, "adjustPerfomance", true);
return configData;
}
diff --git a/src/game.cpp b/src/game.cpp
index 494d35692..9a5128f37 100644
--- a/src/game.cpp
+++ b/src/game.cpp
@@ -162,6 +162,8 @@ ChatTab *debugChatTab = NULL;
TradeTab *tradeChatTab = NULL;
BattleTab *battleChatTab = NULL;
+const unsigned adjustDelay = 10;
+
/**
* Initialize every game sub-engines in the right order
*/
@@ -331,8 +333,12 @@ Game *Game::mInstance = 0;
Game::Game():
mLastTarget(ActorSprite::UNKNOWN),
- mCurrentMap(0), mMapName(""),
- mValidSpeed(true), mLastAction(0)
+ mCurrentMap(0),
+ mMapName(""),
+ mValidSpeed(true),
+ mLastAction(0),
+ mNextAdjustTime(cur_time + adjustDelay),
+ mAdjustLevel(0)
{
spellManager = new SpellManager;
spellShortcut = new SpellShortcut;
@@ -342,6 +348,8 @@ Game::Game():
disconnectedDialog = NULL;
+ mAdjustPerfomance = config.getBoolValue("adjustPerfomance");
+
// Create the viewport
viewport = new Viewport;
viewport->setDimension(gcn::Rectangle(0, 0, graphics->mWidth,
@@ -391,6 +399,9 @@ Game::~Game()
{
config.write();
serverConfig.write();
+
+ resetAdjustLevel();
+
// delete mWindowMenu;
// mWindowMenu = 0;
@@ -504,6 +515,7 @@ void Game::logic()
// Handle network stuff
if (!Net::getGameHandler()->isConnected())
{
+
if (Client::getState() == STATE_CHANGE_MAP)
return; // Not a problem here
@@ -530,6 +542,8 @@ void Game::logic()
}
else
{
+ if (mAdjustPerfomance)
+ adjustPerfomance();
if (disconnectedDialog)
{
disconnectedDialog->scheduleDelete();
@@ -538,6 +552,117 @@ void Game::logic()
}
}
+void Game::adjustPerfomance()
+{
+ if (mNextAdjustTime <= adjustDelay)
+ {
+ mNextAdjustTime = cur_time + adjustDelay;
+ }
+ else if (mNextAdjustTime < cur_time)
+ {
+ mNextAdjustTime = cur_time + adjustDelay;
+
+ if (mAdjustLevel > 3 || !player_node || player_node->getHalfAway()
+ || player_node->getAway())
+ {
+ return;
+ }
+
+ int maxFps = config.getIntValue("fpslimit");
+ if (!maxFps)
+ maxFps = 30;
+ else if (maxFps < 10)
+ return;
+
+ if (fps < maxFps - 10)
+ {
+ mAdjustLevel ++;
+ switch (mAdjustLevel)
+ {
+ case 1:
+ {
+ if (config.getBoolValue("beingopacity"))
+ {
+ config.setValue("beingopacity", false);
+ config.setSilent("beingopacity", true);
+ if (localChatTab)
+ {
+ localChatTab->chatLog("Auto disable Show "
+ "beings transparency", BY_SERVER);
+ }
+ }
+ else
+ {
+ mNextAdjustTime = cur_time + 1;
+ }
+ break;
+ }
+ case 2:
+ if (Particle::emitterSkip < 4)
+ {
+ Particle::emitterSkip = 4;
+// config.setValue("particleEmitterSkip", 3);
+ if (localChatTab)
+ {
+ localChatTab->chatLog("Auto lower Particle "
+ "effects", BY_SERVER);
+ }
+ }
+ else
+ {
+ mNextAdjustTime = cur_time + 1;
+ }
+ break;
+ case 3:
+ if (!config.getBoolValue("alphaCache"))
+ {
+ config.setValue("alphaCache", true);
+ config.setSilent("alphaCache", false);
+ if (localChatTab)
+ {
+ localChatTab->chatLog("Auto enable opacity cache",
+ BY_SERVER);
+ }
+ }
+ break;
+ default:
+ break;
+ }
+ }
+ }
+}
+
+void Game::resetAdjustLevel()
+{
+ if (!mAdjustPerfomance)
+ return;
+
+ mNextAdjustTime = cur_time + adjustDelay;
+ switch (mAdjustLevel)
+ {
+ case 1:
+ config.setValue("beingopacity",
+ config.getBoolValue("beingopacity"));
+ break;
+ case 2:
+ config.setValue("beingopacity",
+ config.getBoolValue("beingopacity"));
+ Particle::emitterSkip = config.getIntValue(
+ "particleEmitterSkip") + 1;
+ break;
+ default:
+ case 3:
+ config.setValue("beingopacity",
+ config.getBoolValue("beingopacity"));
+ Particle::emitterSkip = config.getIntValue(
+ "particleEmitterSkip") + 1;
+ config.setValue("alphaCache",
+ config.getBoolValue("alphaCache"));
+ break;
+ }
+ mAdjustLevel = 0;
+}
+
/**
* The huge input handling method.
*/
@@ -1414,6 +1539,8 @@ void Game::handleInput()
*/
void Game::changeMap(const std::string &mapPath)
{
+ resetAdjustLevel();
+
// Clean up floor items, beings and particles
actorSpriteManager->clear();
diff --git a/src/game.h b/src/game.h
index 03c22587d..88dc9166b 100644
--- a/src/game.h
+++ b/src/game.h
@@ -65,6 +65,9 @@ class Game
static Game *instance()
{ return mInstance; }
+ static void clearInstance()
+ { mInstance = 0; }
+
/**
* This method takes the game a small step further. It is called 100
* times per second.
@@ -86,6 +89,13 @@ class Game
void setValidSpeed();
+ void adjustPerfomance();
+
+ void resetAdjustLevel();
+
+ void setAdjustLevel(int n)
+ { mAdjustLevel = n; }
+
private:
void updateHistory(SDL_Event &event);
@@ -104,6 +114,9 @@ class Game
bool mValidSpeed;
int mLastAction;
LastKey mLastKeys[MAX_LASTKEYS];
+ unsigned mNextAdjustTime;
+ int mAdjustLevel;
+ bool mAdjustPerfomance;
static Game *mInstance;
};
diff --git a/src/gui/setup.cpp b/src/gui/setup.cpp
index 76588a860..33ff6ddb7 100644
--- a/src/gui/setup.cpp
+++ b/src/gui/setup.cpp
@@ -23,6 +23,7 @@
#include "gui/setup.h"
#include "configuration.h"
+#include "game.h"
#include "main.h"
#include "gui/setup_audio.h"
@@ -129,6 +130,8 @@ Setup::~Setup()
void Setup::action(const gcn::ActionEvent &event)
{
+ if (Game::instance())
+ Game::instance()->resetAdjustLevel();
if (event.getId() == "Apply")
{
setVisible(false);
diff --git a/src/gui/setup_other.cpp b/src/gui/setup_other.cpp
index ca70133a2..ac047e34b 100644
--- a/src/gui/setup_other.cpp
+++ b/src/gui/setup_other.cpp
@@ -166,6 +166,8 @@ Setup_Other::Setup_Other()
new SetupItemCheckBox(_("Hide shield sprite"), "", "hideShield",
this, "hideShieldEvent");
+ new SetupItemCheckBox(_("Show background"), "", "showBackground",
+ this, "showBackgroundEvent");
setDimension(gcn::Rectangle(0, 0, 550, 350));
}
diff --git a/src/gui/setup_video.cpp b/src/gui/setup_video.cpp
index d3ee64f3a..3e5c56f64 100644
--- a/src/gui/setup_video.cpp
+++ b/src/gui/setup_video.cpp
@@ -284,7 +284,8 @@ Setup_Video::Setup_Video():
mAltFps(config.getIntValue("altfpslimit")),
mAlphaCache(config.getBoolValue("alphaCache")),
mEnableMapReduce(config.getBoolValue("enableMapReduce")),
- mShowBackground(config.getBoolValue("showBackground")),
+ mAdjustPerfomance(config.getBoolValue("adjustPerfomance")),
+ mBeingOpacity(config.getBoolValue("beingopacity")),
mSpeechMode(static_cast<Being::Speech>(
config.getIntValue("speech"))),
mModeListModel(new ModeListModel),
@@ -304,8 +305,10 @@ Setup_Video::Setup_Video():
mAlphaCacheCheckBox(new CheckBox(_("Enable opacity cache"), mAlphaCache)),
mEnableMapReduceCheckBox(new CheckBox(_("Enable map reduce"),
mEnableMapReduce)),
- mShowBackgroundCheckBox(new CheckBox(_("Show background"),
- mShowBackground)),
+ mAdjustPerfomanceCheckBox(new CheckBox(_("Auto adjust perfomance"),
+ mAdjustPerfomance)),
+ mBeingOpacityCheckBox(new CheckBox(_("Show beings transparency"),
+ mBeingOpacity)),
mSpeechSlider(new Slider(0, 3)),
mSpeechLabel(new Label("")),
mAlphaSlider(new Slider(0.1, 1.0)),
@@ -380,6 +383,7 @@ Setup_Video::Setup_Video():
mParticleDetailField->setActionEventId("particledetailfield");
mAlphaCacheCheckBox->setActionEventId("alphaCache");
mEnableMapReduceCheckBox->setActionEventId("enableMapReduce");
+ mAdjustPerfomanceCheckBox->setActionEventId("adjustPerfomance");
mOpenGLDropDown->setActionEventId("opengl");
mModeList->addActionListener(this);
@@ -400,6 +404,7 @@ Setup_Video::Setup_Video():
mAlphaCacheCheckBox->addKeyListener(this);
mEnableMapReduceCheckBox->addKeyListener(this);
+ mAdjustPerfomanceCheckBox->addKeyListener(this);
mSpeechLabel->setCaption(speechModeToString(mSpeechMode));
mSpeechSlider->setValue(mSpeechMode);
@@ -425,7 +430,7 @@ Setup_Video::Setup_Video():
place(1, 1, mCustomCursorCheckBox, 3);
- place(1, 2, mShowBackgroundCheckBox);
+ place(1, 2, mBeingOpacityCheckBox);
place(1, 3, mParticleEffectsCheckBox, 2);
place(1, 4, mPickupNotifyLabel, 4);
@@ -433,27 +438,29 @@ Setup_Video::Setup_Video():
place(1, 5, mPickupChatCheckBox, 1);
place(2, 5, mPickupParticleCheckBox, 2);
- place(0, 9, mAlphaSlider);
- place(1, 9, alphaLabel, 3);
+ place(0, 9, mAdjustPerfomanceCheckBox, 6);
- place(0, 10, mFpsSlider);
- place(1, 10, mFpsCheckBox).setPadding(3);
- place(2, 10, mFpsLabel).setPadding(1);
+ place(0, 10, mAlphaSlider);
+ place(1, 10, alphaLabel, 3);
- place(0, 11, mAltFpsSlider);
- place(1, 11, mAltFpsLabel).setPadding(3);
+ place(0, 11, mFpsSlider);
+ place(1, 11, mFpsCheckBox).setPadding(3);
+ place(2, 11, mFpsLabel).setPadding(1);
- place(0, 12, mSpeechSlider);
- place(1, 12, speechLabel);
- place(2, 12, mSpeechLabel, 3).setPadding(2);
+ place(0, 12, mAltFpsSlider);
+ place(1, 12, mAltFpsLabel).setPadding(3);
- place(0, 13, mOverlayDetailSlider);
- place(1, 13, overlayDetailLabel);
- place(2, 13, mOverlayDetailField, 3).setPadding(2);
+ place(0, 13, mSpeechSlider);
+ place(1, 13, speechLabel);
+ place(2, 13, mSpeechLabel, 3).setPadding(2);
- place(0, 14, mParticleDetailSlider);
- place(1, 14, particleDetailLabel);
- place(2, 14, mParticleDetailField, 3).setPadding(2);
+ place(0, 14, mOverlayDetailSlider);
+ place(1, 14, overlayDetailLabel);
+ place(2, 14, mOverlayDetailField, 3).setPadding(2);
+
+ place(0, 15, mParticleDetailSlider);
+ place(1, 15, particleDetailLabel);
+ place(2, 15, mParticleDetailField, 3).setPadding(2);
int width = 600;
@@ -552,7 +559,9 @@ void Setup_Video::apply()
config.setValue("alphaCache", mAlphaCacheCheckBox->isSelected());
config.setValue("enableMapReduce", mEnableMapReduceCheckBox->isSelected());
- config.setValue("showBackground", mShowBackgroundCheckBox->isSelected());
+ config.setValue("adjustPerfomance",
+ mAdjustPerfomanceCheckBox->isSelected());
+ config.setValue("beingopacity", mBeingOpacityCheckBox->isSelected());
// We sync old and new values at apply time
mFullScreenEnabled = config.getBoolValue("screen");
@@ -560,7 +569,8 @@ void Setup_Video::apply()
mParticleEffectsEnabled = config.getBoolValue("particleeffects");
mAlphaCache = config.getBoolValue("alphaCache");
mEnableMapReduce = config.getBoolValue("enableMapReduce");
- mShowBackground = config.getBoolValue("showBackground");
+ mAdjustPerfomance = config.getBoolValue("adjustPerfomance");
+ mBeingOpacity = config.getBoolValue("beingopacity");
mSpeechMode = static_cast<Being::Speech>(
config.getIntValue("speech"));
@@ -587,7 +597,8 @@ void Setup_Video::cancel()
mSpeechSlider->setValue(mSpeechMode);
mAlphaCacheCheckBox->setSelected(mAlphaCache);
mEnableMapReduceCheckBox->setSelected(mEnableMapReduce);
- mShowBackgroundCheckBox->setSelected(mShowBackground);
+ mAdjustPerfomanceCheckBox->setSelected(mAdjustPerfomance);
+ mBeingOpacityCheckBox->setSelected(mBeingOpacity);
mAlphaSlider->setValue(mOpacity);
mOverlayDetailSlider->setValue(mOverlayDetail);
mParticleDetailSlider->setValue(mParticleDetail);
@@ -609,7 +620,8 @@ void Setup_Video::cancel()
config.setValue("speech", static_cast<int>(mSpeechMode));
config.setValue("alphaCache", mAlphaCache);
config.setValue("enableMapReduce", mEnableMapReduce);
- config.setValue("showBackground", mShowBackground);
+ config.setValue("adjustPerfomance", mAdjustPerfomance);
+ config.setValue("beingopacity", mBeingOpacity);
config.setValue("guialpha", mOpacity);
Image::setEnableAlpha(mOpacity != 1.0f);
config.setValue("opengl", mOpenGLEnabled);
diff --git a/src/gui/setup_video.h b/src/gui/setup_video.h
index 4448b05c8..9533877fb 100644
--- a/src/gui/setup_video.h
+++ b/src/gui/setup_video.h
@@ -65,7 +65,8 @@ class Setup_Video : public SetupTab, public gcn::KeyListener
int mAltFps;
bool mAlphaCache;
bool mEnableMapReduce;
- bool mShowBackground;
+ bool mAdjustPerfomance;
+ bool mBeingOpacity;
Being::Speech mSpeechMode;
ModeListModel *mModeListModel;
@@ -92,7 +93,8 @@ class Setup_Video : public SetupTab, public gcn::KeyListener
gcn::CheckBox *mAlphaCacheCheckBox;
gcn::CheckBox *mEnableMapReduceCheckBox;
- gcn::CheckBox *mShowBackgroundCheckBox;
+ gcn::CheckBox *mAdjustPerfomanceCheckBox;
+ gcn::CheckBox *mBeingOpacityCheckBox;
gcn::Slider *mSpeechSlider;
gcn::Label *mSpeechLabel;
gcn::Slider *mAlphaSlider;
diff --git a/src/localplayer.h b/src/localplayer.h
index df2a61b03..ebc347ce0 100644
--- a/src/localplayer.h
+++ b/src/localplayer.h
@@ -331,9 +331,15 @@ class LocalPlayer : public Being, public ActorSpriteListener,
void setAway(const std::string &message);
+ bool getAway()
+ { return mAwayMode; }
+
void setHalfAway(bool n)
{ mInactive = n; }
+ bool getHalfAway()
+ { return mInactive; }
+
void afkRespond(ChatTab *tab, const std::string &nick);
bool navigateTo(int x, int y);
diff --git a/src/main.h b/src/main.h
index 38b64a367..dbe9b3142 100644
--- a/src/main.h
+++ b/src/main.h
@@ -91,8 +91,8 @@
//define DEBUG_ALPHA_CACHE 1
//define DEBUG_OPENGL_LEAKS 1
-#define SMALL_VERSION "1.1.7.24"
-#define CHECK_VERSION "01.01.07.24"
+#define SMALL_VERSION "1.1.8.7"
+#define CHECK_VERSION "01.01.08.07"
#define PACKAGE_EXTENDED_VERSION "ManaPlus (" PACKAGE_OS \
diff --git a/src/map.cpp b/src/map.cpp
index f8c4e007e..8225aded1 100644
--- a/src/map.cpp
+++ b/src/map.cpp
@@ -622,7 +622,8 @@ Map::Map(int width, int height, int tileWidth, int tileHeight):
mDrawY(-1),
mDrawScrollX(-1),
mDrawScrollY(-1),
- mRedrawMap(true)
+ mRedrawMap(true),
+ mBeingOpacity(false)
{
const int size = mWidth * mHeight;
@@ -639,6 +640,13 @@ Map::Map(int width, int height, int tileWidth, int tileHeight):
config.addListener("OverlayDetail", this);
config.addListener("guialpha", this);
+ config.addListener("beingopacity", this);
+
+ mOpacity = config.getFloatValue("guialpha");
+ if (mOpacity != 1.0f)
+ mBeingOpacity = config.getBoolValue("beingopacity");
+ else
+ mBeingOpacity = false;
#ifdef USE_OPENGL
mOpenGL = config.getIntValue("opengl");
@@ -651,6 +659,7 @@ Map::~Map()
{
config.removeListener("OverlayDetail", this);
config.removeListener("guialpha", this);
+ config.removeListener("beingopacity", this);
// delete metadata, layers, tilesets and overlays
delete[] mMetaTiles;
@@ -675,9 +684,24 @@ Map::~Map()
void Map::optionChanged(const std::string &value)
{
if (value == "OverlayDetail")
+ {
mOverlayDetail = config.getIntValue("OverlayDetail");
+ }
else if (value == "guialpha")
+ {
mOpacity = config.getFloatValue("guialpha");
+ if (mOpacity != 1.0f)
+ mBeingOpacity = config.getBoolValue("beingopacity");
+ else
+ mBeingOpacity = false;
+ }
+ else if (value == "beingopacity")
+ {
+ if (mOpacity != 1.0f)
+ mBeingOpacity = config.getBoolValue("beingopacity");
+ else
+ mBeingOpacity = false;
+ }
}
void Map::initializeAmbientLayers()
@@ -895,7 +919,7 @@ void Map::draw(Graphics *graphics, int scrollX, int scrollY)
}
// Dont draw if gui opacity == 1
- if (mOpacity != 1.0f)
+ if (mBeingOpacity && mOpacity != 1.0f)
{
// Draws beings with a lower opacity to make them visible
// even when covered by a wall or some other elements...
@@ -1360,7 +1384,7 @@ Path Map::findPath(int startX, int startY, int destX, int destY,
return path;
// Reset starting tile's G cost to 0
- MetaTile *startTile = getMetaTile(startX, startY);
+ MetaTile *startTile = &mMetaTiles[startX + startY * mWidth];
startTile->Gcost = 0;
// Add the start point to the open list
@@ -1383,21 +1407,26 @@ Path Map::findPath(int startX, int startY, int destX, int destY,
// Put the current tile on the closed list
curr.tile->whichList = mOnClosedList;
+ const int curWidth = curr.y * mWidth;
+
// Check the adjacent tiles
for (int dy = -1; dy <= 1; dy++)
{
+ const int y = curr.y + dy;
+ const int yWidth = y * mWidth;
+ const int dy1 = std::abs(y - destY);
+
for (int dx = -1; dx <= 1; dx++)
{
// Calculate location of tile to check
const int x = curr.x + dx;
- const int y = curr.y + dy;
// Skip if if we're checking the same tile we're leaving from,
// or if the new location falls outside of the map boundaries
if ((dx == 0 && dy == 0) || !contains(x, y))
continue;
- MetaTile *newTile = getMetaTile(x, y);
+ MetaTile *newTile = &mMetaTiles[x + yWidth];
// Skip if the tile is on the closed list or is not walkable
// unless its the destination tile
@@ -1414,8 +1443,9 @@ Path Map::findPath(int startX, int startY, int destX, int destY,
// corner.
if (dx != 0 && dy != 0)
{
- MetaTile *t1 = getMetaTile(curr.x, curr.y + dy);
- MetaTile *t2 = getMetaTile(curr.x + dx, curr.y);
+ MetaTile *t1 = &mMetaTiles[curr.x +
+ (curr.y + dy) * mWidth];
+ MetaTile *t2 = &mMetaTiles[curr.x + dx + curWidth];
//+++ here need check block must depend on player abilities.
if (!t1 || !t2 || ((t1->blockmask | t2->blockmask)
@@ -1463,9 +1493,9 @@ Path Map::findPath(int startX, int startY, int destX, int destY,
work reliably if the heuristic cost is higher than the
real cost. In particular, using Manhattan distance is
forbidden here. */
- int dx = std::abs(x - destX), dy = std::abs(y - destY);
- newTile->Hcost = std::abs(dx - dy) * basicCost +
- std::min(dx, dy) * (basicCost * 362 / 256);
+ int dx1 = std::abs(x - destX);
+ newTile->Hcost = std::abs(dx1 - dy1) * basicCost +
+ std::min(dx1, dy1) * (basicCost * 362 / 256);
// Set the current tile as the parent of the new tile
newTile->parentX = curr.x;
@@ -1538,7 +1568,7 @@ Path Map::findPath(int startX, int startY, int destX, int destY,
path.push_front(Position(pathX, pathY));
// Find out the next parent
- MetaTile *tile = getMetaTile(pathX, pathY);
+ MetaTile *tile = &mMetaTiles[pathX + pathY * mWidth];
pathX = tile->parentX;
pathY = tile->parentY;
}
diff --git a/src/map.h b/src/map.h
index 776f00ebe..c92a3c60f 100644
--- a/src/map.h
+++ b/src/map.h
@@ -615,6 +615,7 @@ class Map : public Properties, public ConfigListener
int mDrawScrollX;
int mDrawScrollY;
bool mRedrawMap;
+ bool mBeingOpacity;
};
diff --git a/src/net/tmwa/npchandler.cpp b/src/net/tmwa/npchandler.cpp
index d6549e39f..43271671e 100644
--- a/src/net/tmwa/npchandler.cpp
+++ b/src/net/tmwa/npchandler.cpp
@@ -92,9 +92,6 @@ void NpcHandler::handleMessage(Net::MessageIn &msg)
break;
}
- if (player_node && player_node->getCurrentAction() != Being::SIT)
- player_node->setAction(Being::STAND);
-
mDialog = 0;
}