diff options
author | Philipp Sehmisch <crush@themanaworld.org> | 2009-12-16 18:49:09 +0100 |
---|---|---|
committer | Philipp Sehmisch <crush@themanaworld.org> | 2009-12-16 20:09:13 +0100 |
commit | f862b7ecb1fc9c410a693eac0accf5081830ab5e (patch) | |
tree | 660f1c07d9260349edf83738825408a598097b4d /src | |
parent | 6b7833deee20e3abb5856d64d7f359d754fea4ca (diff) | |
download | mana-f862b7ecb1fc9c410a693eac0accf5081830ab5e.tar.gz mana-f862b7ecb1fc9c410a693eac0accf5081830ab5e.tar.bz2 mana-f862b7ecb1fc9c410a693eac0accf5081830ab5e.tar.xz mana-f862b7ecb1fc9c410a693eac0accf5081830ab5e.zip |
Stored the cached config value which says if non-crucial particle effects are enabled or not in a static member of class Particle instead of an instanced member of Being.
Diffstat (limited to 'src')
-rw-r--r-- | src/being.cpp | 1 | ||||
-rw-r--r-- | src/being.h | 1 | ||||
-rw-r--r-- | src/gui/charselectdialog.cpp | 2 | ||||
-rw-r--r-- | src/gui/setup_video.cpp | 2 | ||||
-rw-r--r-- | src/localplayer.cpp | 3 | ||||
-rw-r--r-- | src/monster.cpp | 4 | ||||
-rw-r--r-- | src/net/ea/beinghandler.cpp | 18 | ||||
-rw-r--r-- | src/net/ea/protocol.h | 1 | ||||
-rw-r--r-- | src/npc.cpp | 2 | ||||
-rw-r--r-- | src/particle.cpp | 2 | ||||
-rw-r--r-- | src/particle.h | 1 | ||||
-rw-r--r-- | src/player.cpp | 2 |
12 files changed, 32 insertions, 7 deletions
diff --git a/src/being.cpp b/src/being.cpp index 69d9293f..b54f4c44 100644 --- a/src/being.cpp +++ b/src/being.cpp @@ -78,7 +78,6 @@ Being::Being(int id, int job, Map *map): mDirection(DOWN), mSpriteDirection(DIRECTION_DOWN), mMap(NULL), - mParticleEffects(config.getValue("particleeffects", 1)), mDispName(0), mShowName(false), mEquippedWeapon(NULL), diff --git a/src/being.h b/src/being.h index b1a08e37..8aa34b7c 100644 --- a/src/being.h +++ b/src/being.h @@ -529,7 +529,6 @@ class Being : public Sprite, public ConfigListener Map *mMap; /**< Map on which this being resides */ std::string mName; /**< Name of character */ MapSprite mMapSprite; - bool mParticleEffects; /**< Whether to display particles or not */ /** * Holds a text object when the being displays it's name, 0 otherwise diff --git a/src/gui/charselectdialog.cpp b/src/gui/charselectdialog.cpp index 4f3619ae..8dc292ab 100644 --- a/src/gui/charselectdialog.cpp +++ b/src/gui/charselectdialog.cpp @@ -226,7 +226,7 @@ void CharSelectDialog::keyPressed(gcn::KeyEvent &keyEvent) if (key.getValue() == Key::ESCAPE) { - action(gcn::ActionEvent(NULL, mSwitchLoginButton->getActionEventId())); + action(gcn::ActionEvent(mSwitchLoginButton, mSwitchLoginButton->getActionEventId())); } } diff --git a/src/gui/setup_video.cpp b/src/gui/setup_video.cpp index a4bd6864..b1d40575 100644 --- a/src/gui/setup_video.cpp +++ b/src/gui/setup_video.cpp @@ -484,6 +484,8 @@ void Setup_Video::action(const gcn::ActionEvent &event) { config.setValue("particleeffects", mParticleEffectsCheckBox->isSelected()); + Particle::enabled = mParticleEffectsCheckBox->isSelected(); + if (engine) { new OkDialog(_("Particle Effect Settings Changed."), diff --git a/src/localplayer.cpp b/src/localplayer.cpp index d670b3b6..260a5542 100644 --- a/src/localplayer.cpp +++ b/src/localplayer.cpp @@ -887,6 +887,9 @@ void LocalPlayer::setExperience(int skill, int current, int next) { addMessageToQueue(strprintf("%d %s xp", diff, name.c_str())); } + + if (statusWindow) + statusWindow->update(skill); } std::pair<int, int> LocalPlayer::getExperience(int skill) diff --git a/src/monster.cpp b/src/monster.cpp index cc2285fe..34390982 100644 --- a/src/monster.cpp +++ b/src/monster.cpp @@ -53,7 +53,7 @@ Monster::Monster(int id, int job, Map *map): mSprites.push_back(AnimatedSprite::load("graphics/sprites/error.xml")); } - if (mParticleEffects) + if (Particle::enabled) { const std::list<std::string> &particleEffects = info.getParticleEffects(); for (std::list<std::string>::const_iterator i = particleEffects.begin(); @@ -106,7 +106,7 @@ void Monster::setAction(Action action, int attackType) //attack particle effect particleEffect = getInfo().getAttackParticleEffect(attackType); - if (!particleEffect.empty() && mParticleEffects) + if (!particleEffect.empty() && Particle::enabled) { switch (mSpriteDirection) { diff --git a/src/net/ea/beinghandler.cpp b/src/net/ea/beinghandler.cpp index 1ede1b8d..cba1c984 100644 --- a/src/net/ea/beinghandler.cpp +++ b/src/net/ea/beinghandler.cpp @@ -50,6 +50,7 @@ BeingHandler::BeingHandler(bool enableSync): SMSG_BEING_MOVE, SMSG_BEING_MOVE2, SMSG_BEING_REMOVE, + SMSG_SKILL_DAMAGE, SMSG_BEING_ACTION, SMSG_BEING_SELFEFFECT, SMSG_BEING_EMOTION, @@ -290,6 +291,23 @@ void BeingHandler::handleMessage(Net::MessageIn &msg) break; + case SMSG_SKILL_DAMAGE: + msg.readInt16(); // Skill Id + srcBeing = beingManager->findBeing(msg.readInt32()); + dstBeing = beingManager->findBeing(msg.readInt32()); + msg.readInt32(); // Server tick + msg.readInt32(); // src speed + msg.readInt32(); // dst speed + param1 = msg.readInt32(); // Damage + msg.readInt16(); // Skill level + msg.readInt16(); // Div + msg.readInt8(); // Skill hit/type (?) + if (dstBeing) + dstBeing->takeDamage(srcBeing, param1, Being::HIT); // Perhaps a new skill attack type should be created and used? + if (srcBeing) + srcBeing->handleAttack(dstBeing, param1, Being::HIT); + break; + case SMSG_BEING_ACTION: srcBeing = beingManager->findBeing(msg.readInt32()); dstBeing = beingManager->findBeing(msg.readInt32()); diff --git a/src/net/ea/protocol.h b/src/net/ea/protocol.h index 75d0d30e..f17ded61 100644 --- a/src/net/ea/protocol.h +++ b/src/net/ea/protocol.h @@ -95,6 +95,7 @@ static const int STORAGE_OFFSET = 1; #define SMSG_PLAYER_SKILLS 0x010f #define SMSG_PLAYER_SKILL_UP 0x010e #define SMSG_SKILL_FAILED 0x0110 +#define SMSG_SKILL_DAMAGE 0x01de #define SMSG_ITEM_USE_RESPONSE 0x00a8 #define SMSG_ITEM_VISIBLE 0x009d /**< An item is on the floor */ #define SMSG_ITEM_DROPPED 0x009e /**< An item is dropped */ diff --git a/src/npc.cpp b/src/npc.cpp index 882f1b42..a79e5bac 100644 --- a/src/npc.cpp +++ b/src/npc.cpp @@ -52,7 +52,7 @@ NPC::NPC(int id, int job, Map *map): mSpriteColors.push_back(""); } - if (mParticleEffects) + if (Particle::enabled) { //setup particle effects for (std::list<std::string>::const_iterator i = info.particles.begin(); diff --git a/src/particle.cpp b/src/particle.cpp index 42ec84d7..21bcec99 100644 --- a/src/particle.cpp +++ b/src/particle.cpp @@ -49,6 +49,7 @@ int Particle::particleCount = 0; int Particle::maxCount = 0; int Particle::fastPhysics = 0; int Particle::emitterSkip = 1; +bool Particle::enabled = true; const float Particle::PARTICLE_SKY = 800.0f; Particle::Particle(Map *map): @@ -89,6 +90,7 @@ void Particle::setupEngine() Particle::maxCount = (int)config.getValue("particleMaxCount", 3000); Particle::fastPhysics = (int)config.getValue("particleFastPhysics", 0); Particle::emitterSkip = (int)config.getValue("particleEmitterSkip", 1) + 1; + Particle::enabled = (bool)config.getValue("particleeffects", true); disableAutoDelete(); logger->log("Particle engine set up"); } diff --git a/src/particle.h b/src/particle.h index c3e7692c..1b2d24ae 100644 --- a/src/particle.h +++ b/src/particle.h @@ -49,6 +49,7 @@ class Particle : public Sprite static int particleCount; /**< Current number of particles */ static int maxCount; /**< Maximum number of particles */ static int emitterSkip; /**< Duration of pause between two emitter updates in ticks */ + static bool enabled; /**< true when non-crucial particle effects are disabled */ /** * Constructor. diff --git a/src/player.cpp b/src/player.cpp index 7e390b84..3cee0d1e 100644 --- a/src/player.cpp +++ b/src/player.cpp @@ -102,7 +102,7 @@ void Player::logic() if (mEquippedWeapon) particleEffect = mEquippedWeapon->getParticleEffect(); - if (!particleEffect.empty() && mParticleEffects && mFrame == 1) + if (!particleEffect.empty() && Particle::enabled && mFrame == 1) { switch (mDirection) { |