Crossfire Server, Trunk
GameSounds.cpp
Go to the documentation of this file.
1
/*
2
* Crossfire -- cooperative multi-player graphical RPG and adventure game
3
*
4
* Copyright (c) 2022 the Crossfire Development Team
5
*
6
* Crossfire is free software and comes with ABSOLUTELY NO WARRANTY. You are
7
* welcome to redistribute it under certain conditions. For details, please
8
* see COPYING and LICENSE.
9
*
10
* The authors can be reached via e-mail at <crossfire@metalforge.org>.
11
*/
12
13
#include "
GameSounds.h
"
14
#include "
GameSound.h
"
15
#include "
SoundFile.h
"
16
#include <QVariant>
17
18
std::map<QString, std::string>
GameSounds::gameSounds
= {
19
{
"learn"
, QT_TR_NOOP(
"player learns a spell"
)},
20
{
"apply"
, QT_TR_NOOP(
"player applies an item"
)},
21
// evaporate may be an item evaporating when polymorphed, but the spell is disabled
22
{
"evaporate"
, QT_TR_NOOP(
"someone applies an item that is only available to DM; an item is destroyed to save the player's life"
)},
23
{
"hit"
, QT_TR_NOOP(
"player (or pet) hits a living creature"
)},
24
{
"miss"
, QT_TR_NOOP(
"player fails hitting a living creature"
)},
25
{
"kill"
, QT_TR_NOOP(
"player is killed"
)},
26
{
"step"
, QT_TR_NOOP(
"player is walking"
)},
27
{
"fire"
, QT_TR_NOOP(
"player fires a bow or crossbow"
)},
28
{
"poof"
, QT_TR_NOOP(
"player attempts to use a rod or wand without enough sp or charges"
)},
29
{
"open"
, QT_TR_NOOP(
"player opens a door with a key"
)},
30
{
"push"
, QT_TR_NOOP(
"a living creature is pushed"
)},
31
{
"death"
, QT_TR_NOOP(
"player dies"
)},
32
{
"explode"
, QT_TR_NOOP(
"a wand explodes when an attempt to recharged it is made"
)},
33
{
"fumble"
, QT_TR_NOOP(
"player fails casting a praying spell; player fails to learn a spell"
)},
34
{
"button click"
, QT_TR_NOOP(
"a button is walked on"
)},
35
{
"turn handle"
, QT_TR_NOOP(
"a handle is applied"
)},
36
{
"tick"
, QT_TR_NOOP(
"player applies a clock"
)},
37
{
"drink"
, QT_TR_NOOP(
"someone drinks an item"
)},
38
{
"gate moving"
, QT_TR_NOOP(
"a gate is opening or closing"
)},
39
{
"fall hole"
, QT_TR_NOOP(
"someone falls in a hole"
)},
40
{
"poison"
, QT_TR_NOOP(
"player applies a poisoned food or drink"
)},
41
};
42
43
GameSounds::GameSounds
(
AssetWrapper
*parent) :
AssetWrapper
(parent,
"GameSounds"
) {
44
setProperty(
tipProperty
, tr(
"Display all game internal sounds."
));
45
for
(
const
auto
&sound :
gameSounds
) {
46
mySounds
.push_back(
new
GameSound
(
this
, tr(sound.first.toStdString().data()), tr(sound.second.data())));
47
}
48
}
49
50
AssetWrapper::PossibleUse
GameSounds::uses
(
const
AssetWrapper
*asset, std::string &)
const
{
51
return
dynamic_cast<
const
SoundFile
*
>
(asset) ?
ChildrenMayUse
:
DoesntUse
;
52
}
53
54
QString
GameSounds::description
()
const
{
55
return
tr(
"All sound names defined in the server and sent to the client"
);
56
}
57
58
AssetWrapper
*
GameSounds::child
(
int
child) {
59
return
mySounds
[
child
];
60
}
61
62
int
GameSounds::childIndex
(
AssetWrapper
*child) {
63
auto
pos = std::find(
mySounds
.cbegin(),
mySounds
.cend(),
child
);
64
return
pos ==
mySounds
.cend() ? -1 : pos -
mySounds
.cbegin();
65
}
AssetWrapper::PossibleUse
PossibleUse
Definition:
AssetWrapper.h:32
GameSound
Definition:
GameSound.h:18
GameSounds::GameSounds
GameSounds(AssetWrapper *parent)
Definition:
GameSounds.cpp:43
AssetWrapper::tipProperty
static const char * tipProperty
Definition:
AssetWrapper.h:34
AssetWrapper::ChildrenMayUse
@ ChildrenMayUse
Definition:
AssetWrapper.h:32
GameSounds::gameSounds
static std::map< QString, std::string > gameSounds
Definition:
GameSounds.h:36
AssetWrapper
Definition:
AssetWrapper.h:25
GameSounds::childIndex
virtual int childIndex(AssetWrapper *child) override
Definition:
GameSounds.cpp:62
GameSounds::description
QString description
Definition:
GameSounds.h:24
GameSounds::child
virtual AssetWrapper * child(int child) override
Definition:
GameSounds.cpp:58
GameSounds::uses
virtual PossibleUse uses(const AssetWrapper *asset, std::string &) const override
Definition:
GameSounds.cpp:50
SoundFile.h
GameSound.h
AssetWrapper::DoesntUse
@ DoesntUse
Definition:
AssetWrapper.h:32
GameSounds::mySounds
std::vector< GameSound * > mySounds
Definition:
GameSounds.h:39
GameSounds.h
SoundFile
Definition:
SoundFile.h:19
crossfire-crossfire-server
utils
cre
sounds
GameSounds.cpp
Generated by
1.8.17