summary refs log tree commit diff stats
path: root/src/step_type.h
diff options
context:
space:
mode:
authorKelly Rauchenberger <fefferburbia@gmail.com>2021-02-03 17:11:46 -0500
committerKelly Rauchenberger <fefferburbia@gmail.com>2021-02-03 17:11:46 -0500
commitdab96b810691c26e29fef92d88c828a311be3e9d (patch)
treee906b10f8dbca817e2b65bd14469226c2717a05a /src/step_type.h
parentc54dd4fd583f1d00d424590a9f192b2a35ede26b (diff)
downloadtanetane-dab96b810691c26e29fef92d88c828a311be3e9d.tar.gz
tanetane-dab96b810691c26e29fef92d88c828a311be3e9d.tar.bz2
tanetane-dab96b810691c26e29fef92d88c828a311be3e9d.zip
Added running sounds
Diffstat (limited to 'src/step_type.h')
-rw-r--r--src/step_type.h54
1 files changed, 54 insertions, 0 deletions
diff --git a/src/step_type.h b/src/step_type.h new file mode 100644 index 0000000..c38d6f9 --- /dev/null +++ b/src/step_type.h
@@ -0,0 +1,54 @@
1#ifndef STEP_TYPE_H_38251870
2#define STEP_TYPE_H_38251870
3
4#include <string_view>
5#include <stdexcept>
6
7enum class StepType {
8 none,
9 wood,
10 land_light,
11 land,
12 sand,
13 water,
14 mechanical,
15 grass,
16 unknown,
17 paved,
18 carpet,
19 weak_wood
20};
21
22inline StepType stepTypeFromString(std::string_view str) {
23 if (str == "wood") return StepType::wood;
24 if (str == "land_light") return StepType::land_light;
25 if (str == "land") return StepType::land;
26 if (str == "sand") return StepType::sand;
27 if (str == "water") return StepType::water;
28 if (str == "mechanical") return StepType::mechanical;
29 if (str == "grass") return StepType::grass;
30 if (str == "unknown") return StepType::unknown;
31 if (str == "paved") return StepType::paved;
32 if (str == "carpet") return StepType::carpet;
33 if (str == "weak_wood") return StepType::weak_wood;
34 return StepType::none;
35}
36
37inline std::string_view runningSfxForStepType(StepType step) {
38 switch (step) {
39 case StepType::wood: return "../res/running_wood.wav";
40 case StepType::land_light: return "../res/running_land_light.wav";
41 case StepType::land: return "../res/running_land.wav";
42 case StepType::sand: return "../res/running_sand.wav";
43 case StepType::water: return "../res/running_water.wav";
44 case StepType::mechanical: return "../res/running_mechanical.wav";
45 case StepType::grass: return "../res/running_grass.wav";
46 case StepType::unknown: return "../res/running_unknown.wav";
47 case StepType::paved: return "../res/running_paved.wav";
48 case StepType::carpet: return "../res/running_carpet.wav";
49 case StepType::weak_wood: return "../res/running_weak_wood.wav";
50 case StepType::none: throw std::invalid_argument("No running sfx for none step type");
51 }
52}
53
54#endif /* end of include guard: STEP_TYPE_H_38251870 */