summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2013-10-04 02:03:12 +0300
committerAndrei Karas <akaras@inbox.ru>2013-10-04 13:13:21 +0300
commit343809fe458a08bf96fe4f537db2d81d7523632e (patch)
tree0230a135f3ecaf574a3d67f090e6dcb21f1934f5 /src
parentb0238edbc3f125e5d7d9d1506f7c9b78a440a200 (diff)
downloadmanaplus-343809fe458a08bf96fe4f537db2d81d7523632e.tar.gz
manaplus-343809fe458a08bf96fe4f537db2d81d7523632e.tar.bz2
manaplus-343809fe458a08bf96fe4f537db2d81d7523632e.tar.xz
manaplus-343809fe458a08bf96fe4f537db2d81d7523632e.zip
Add new item sound events constants.
Diffstat (limited to 'src')
-rw-r--r--src/being/being.cpp2
-rw-r--r--src/resources/beinginfo.cpp7
-rw-r--r--src/resources/beinginfo.h20
-rw-r--r--src/resources/db/itemdb.cpp4
-rw-r--r--src/resources/iteminfo.cpp6
-rw-r--r--src/resources/iteminfo.h6
-rw-r--r--src/resources/soundinfo.h21
7 files changed, 37 insertions, 29 deletions
diff --git a/src/being/being.cpp b/src/being/being.cpp
index 43f82db0b..3bf1c4453 100644
--- a/src/being/being.cpp
+++ b/src/being/being.cpp
@@ -1153,7 +1153,7 @@ void Being::setAction(const Action &action, const int attackId)
currentAction = getSitAction();
if (mInfo)
{
- SoundEvent event;
+ ItemSoundEvent event;
if (currentAction == SpriteAction::SITTOP)
event = SOUND_EVENT_SITTOP;
else
diff --git a/src/resources/beinginfo.cpp b/src/resources/beinginfo.cpp
index 84d32f623..92169314a 100644
--- a/src/resources/beinginfo.cpp
+++ b/src/resources/beinginfo.cpp
@@ -104,7 +104,8 @@ void BeingInfo::setTargetCursorSize(const std::string &size)
}
}
-void BeingInfo::addSound(const SoundEvent event, const std::string &filename,
+void BeingInfo::addSound(const ItemSoundEvent event,
+ const std::string &filename,
const int delay)
{
if (mSounds.find(event) == mSounds.end())
@@ -114,11 +115,11 @@ void BeingInfo::addSound(const SoundEvent event, const std::string &filename,
mSounds[event]->push_back(SoundInfo("sfx/" + filename, delay));
}
-const SoundInfo &BeingInfo::getSound(const SoundEvent event) const
+const SoundInfo &BeingInfo::getSound(const ItemSoundEvent event) const
{
static SoundInfo emptySound("", 0);
- const SoundEvents::const_iterator i = mSounds.find(event);
+ const ItemSoundEvents::const_iterator i = mSounds.find(event);
if (i == mSounds.end())
return emptySound;
diff --git a/src/resources/beinginfo.h b/src/resources/beinginfo.h
index 3d00471da..008af8590 100644
--- a/src/resources/beinginfo.h
+++ b/src/resources/beinginfo.h
@@ -63,20 +63,6 @@ struct Attack final
typedef std::map<int, Attack*> Attacks;
-enum SoundEvent
-{
- SOUND_EVENT_HIT = 0,
- SOUND_EVENT_MISS,
- SOUND_EVENT_HURT,
- SOUND_EVENT_DIE,
- SOUND_EVENT_MOVE,
- SOUND_EVENT_SIT,
- SOUND_EVENT_SITTOP,
- SOUND_EVENT_SPAWN
-};
-
-typedef std::map<SoundEvent, SoundInfoVect*> SoundEvents;
-
/**
* Holds information about a certain type of monster. This includes the name
* of the monster, the sprite to display and the sounds the monster makes.
@@ -125,10 +111,10 @@ class BeingInfo final
ActorSprite::TargetCursorSize getTargetCursorSize() const A_WARN_UNUSED
{ return mTargetCursorSize; }
- void addSound(const SoundEvent event, const std::string &filename,
+ void addSound(const ItemSoundEvent event, const std::string &filename,
const int delay);
- const SoundInfo &getSound(const SoundEvent event)
+ const SoundInfo &getSound(const ItemSoundEvent event)
const A_WARN_UNUSED;
void addAttack(const int id, std::string action, std::string skyAttack,
@@ -251,7 +237,7 @@ class BeingInfo final
std::string mName;
ActorSprite::TargetCursorSize mTargetCursorSize;
Cursor::Cursor mHoverCursor;
- SoundEvents mSounds;
+ ItemSoundEvents mSounds;
Attacks mAttacks;
unsigned char mWalkMask;
Map::BlockType mBlockType;
diff --git a/src/resources/db/itemdb.cpp b/src/resources/db/itemdb.cpp
index 6f015b64e..867c01e2d 100644
--- a/src/resources/db/itemdb.cpp
+++ b/src/resources/db/itemdb.cpp
@@ -42,7 +42,7 @@ namespace
bool mConstructed = false;
StringVect mTagNames;
std::map<std::string, int> mTags;
- std::map<std::string, SoundEvent> mSoundNames;
+ std::map<std::string, ItemSoundEvent> mSoundNames;
} // namespace
// Forward declarations
@@ -732,7 +732,7 @@ void loadSoundRef(ItemInfo *const itemInfo, const XmlNodePtr node)
node->xmlChildrenNode->content);
const int delay = XML::getProperty(node, "delay", 0);
- const std::map<std::string, SoundEvent>::const_iterator
+ const std::map<std::string, ItemSoundEvent>::const_iterator
it = mSoundNames.find(event);
if (it != mSoundNames.end())
{
diff --git a/src/resources/iteminfo.cpp b/src/resources/iteminfo.cpp
index fa8ca2b61..cc7cc41c7 100644
--- a/src/resources/iteminfo.cpp
+++ b/src/resources/iteminfo.cpp
@@ -129,17 +129,17 @@ void ItemInfo::setWaterAttackAction(const std::string &attackAction)
mWaterAttackAction = attackAction;
}
-void ItemInfo::addSound(const SoundEvent event,
+void ItemInfo::addSound(const ItemSoundEvent event,
const std::string &filename, const int delay)
{
mSounds[event].push_back(SoundInfo(
paths.getStringValue("sfx").append(filename), delay));
}
-const SoundInfo &ItemInfo::getSound(const SoundEvent event) const
+const SoundInfo &ItemInfo::getSound(const ItemSoundEvent event) const
{
static const SoundInfo empty("", 0);
- std::map<SoundEvent, SoundInfoVect>::const_iterator i;
+ std::map<ItemSoundEvent, SoundInfoVect>::const_iterator i;
i = mSounds.find(event);
diff --git a/src/resources/iteminfo.h b/src/resources/iteminfo.h
index b386e51f7..cf2c64e27 100644
--- a/src/resources/iteminfo.h
+++ b/src/resources/iteminfo.h
@@ -216,11 +216,11 @@ class ItemInfo final
void setAttackRange(const int r)
{ mAttackRange = r; }
- void addSound(const SoundEvent event,
+ void addSound(const ItemSoundEvent event,
const std::string &filename,
const int delay);
- const SoundInfo &getSound(const SoundEvent event)
+ const SoundInfo &getSound(const ItemSoundEvent event)
const A_WARN_UNUSED;
int getDrawBefore(const int direction) const A_WARN_UNUSED;
@@ -345,7 +345,7 @@ class ItemInfo final
std::map <int, std::string> mAnimationFiles;
/** Stores the names of sounds to be played at certain event. */
- std::map <SoundEvent, SoundInfoVect> mSounds;
+ std::map <ItemSoundEvent, SoundInfoVect> mSounds;
std::map <int, int> mTags;
const std::map <int, ColorDB::ItemColor> *mColors;
std::string mColorList;
diff --git a/src/resources/soundinfo.h b/src/resources/soundinfo.h
index 30fe8675d..01671d43b 100644
--- a/src/resources/soundinfo.h
+++ b/src/resources/soundinfo.h
@@ -21,6 +21,7 @@
#ifndef RESOURCES_SOUNDINFO_H
#define RESOURCES_SOUNDINFO_H
+#include <map>
#include <string>
#include <vector>
@@ -40,4 +41,24 @@ struct SoundInfo final
typedef std::vector<SoundInfo> SoundInfoVect;
+enum ItemSoundEvent
+{
+ SOUND_EVENT_HIT = 0,
+ SOUND_EVENT_MISS,
+ SOUND_EVENT_HURT,
+ SOUND_EVENT_DIE,
+ SOUND_EVENT_MOVE,
+ SOUND_EVENT_SIT,
+ SOUND_EVENT_SITTOP,
+ SOUND_EVENT_SPAWN,
+ SOUND_EVENT_DROP,
+ SOUND_EVENT_PICKUP,
+ SOUND_EVENT_TAKE, // take from container
+ SOUND_EVENT_PUT, // put into container
+ SOUND_EVENT_EQUIP,
+ SOUND_EVENT_UNEQUIP
+};
+
+typedef std::map<ItemSoundEvent, SoundInfoVect*> ItemSoundEvents;
+
#endif // RESOURCES_SOUNDINFO_H