diff options
author | Bjørn Lindeijer <bjorn@lindeijer.nl> | 2009-03-22 19:45:03 +0100 |
---|---|---|
committer | Bjørn Lindeijer <bjorn@lindeijer.nl> | 2009-03-22 19:45:56 +0100 |
commit | 0c43d04b438d41c277ae80402d4b4888db1a0b64 (patch) | |
tree | 3aaeb75ecd1bcbe85decedab5f1fa426fe0411e3 /src/resources/monsterinfo.cpp | |
parent | a7f5eaeb7f643658d356533a608f0f18d85b6d32 (diff) | |
parent | 401802c1d7a1b3d659bdc53a45d9a6292fc1121e (diff) | |
download | mana-0c43d04b438d41c277ae80402d4b4888db1a0b64.tar.gz mana-0c43d04b438d41c277ae80402d4b4888db1a0b64.tar.bz2 mana-0c43d04b438d41c277ae80402d4b4888db1a0b64.tar.xz mana-0c43d04b438d41c277ae80402d4b4888db1a0b64.zip |
Merged the tmwserv client with the eAthena client
This merge involved major changes on both sides, and as such took
several weeks. Lots of things are expected to be broken now, however, we
now have a single code base to improve and extend, which can be compiled
to support either eAthena or tmwserv.
In the coming months, the plan is to work towards a client that supports
both eAthena and tmwserv, without needing to be recompiled.
Conflicts:
Everywhere!
Diffstat (limited to 'src/resources/monsterinfo.cpp')
-rw-r--r-- | src/resources/monsterinfo.cpp | 45 |
1 files changed, 30 insertions, 15 deletions
diff --git a/src/resources/monsterinfo.cpp b/src/resources/monsterinfo.cpp index 503990e7..2fc16bef 100644 --- a/src/resources/monsterinfo.cpp +++ b/src/resources/monsterinfo.cpp @@ -25,7 +25,6 @@ MonsterInfo::MonsterInfo() { - } MonsterInfo::~MonsterInfo() @@ -35,8 +34,7 @@ MonsterInfo::~MonsterInfo() mSounds.clear(); } - -void MonsterInfo::addSound(MonsterSoundEvent event, std::string filename) +void MonsterInfo::addSound(MonsterSoundEvent event, const std::string &filename) { if (mSounds.find(event) == mSounds.end()) { @@ -46,24 +44,41 @@ void MonsterInfo::addSound(MonsterSoundEvent event, std::string filename) mSounds[event]->push_back("sfx/" + filename); } +const std::string &MonsterInfo::getSound(MonsterSoundEvent event) const +{ + static std::string empty(""); + std::map<MonsterSoundEvent, std::vector<std::string>* >::const_iterator i = + mSounds.find(event); + return (i == mSounds.end()) ? empty : + i->second->at(rand() % i->second->size()); +} -std::string MonsterInfo::getSound(MonsterSoundEvent event) const +const std::string &MonsterInfo::getAttackParticleEffect(int attackType) const { - std::map<MonsterSoundEvent, std::vector<std::string>* >::const_iterator i; + static std::string empty(""); + std::map<int, MonsterAttack*>::const_iterator i = + mMonsterAttacks.find(attackType); + return (i == mMonsterAttacks.end()) ? empty : (*i).second->particleEffect; +} - i = mSounds.find(event); +SpriteAction MonsterInfo::getAttackAction(int attackType) const +{ + std::map<int, MonsterAttack*>::const_iterator i = + mMonsterAttacks.find(attackType); + return (i == mMonsterAttacks.end()) ? ACTION_ATTACK : (*i).second->action; +} - if (i == mSounds.end()) - { - return ""; - } - else - { - return i->second->at(rand()%i->second->size()); - } +void MonsterInfo::addMonsterAttack(int id, + const std::string &particleEffect, + SpriteAction action) +{ + MonsterAttack *a = new MonsterAttack; + a->particleEffect = particleEffect; + a->action = action; + mMonsterAttacks[id] = a; } -void MonsterInfo::addParticleEffect(std::string filename) +void MonsterInfo::addParticleEffect(const std::string &filename) { mParticleEffects.push_back(filename); } |