From dab96b810691c26e29fef92d88c828a311be3e9d Mon Sep 17 00:00:00 2001 From: Kelly Rauchenberger Date: Wed, 3 Feb 2021 17:11:46 -0500 Subject: Added running sounds --- src/step_type.h | 54 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 54 insertions(+) create mode 100644 src/step_type.h (limited to 'src/step_type.h') 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 @@ +#ifndef STEP_TYPE_H_38251870 +#define STEP_TYPE_H_38251870 + +#include +#include + +enum class StepType { + none, + wood, + land_light, + land, + sand, + water, + mechanical, + grass, + unknown, + paved, + carpet, + weak_wood +}; + +inline StepType stepTypeFromString(std::string_view str) { + if (str == "wood") return StepType::wood; + if (str == "land_light") return StepType::land_light; + if (str == "land") return StepType::land; + if (str == "sand") return StepType::sand; + if (str == "water") return StepType::water; + if (str == "mechanical") return StepType::mechanical; + if (str == "grass") return StepType::grass; + if (str == "unknown") return StepType::unknown; + if (str == "paved") return StepType::paved; + if (str == "carpet") return StepType::carpet; + if (str == "weak_wood") return StepType::weak_wood; + return StepType::none; +} + +inline std::string_view runningSfxForStepType(StepType step) { + switch (step) { + case StepType::wood: return "../res/running_wood.wav"; + case StepType::land_light: return "../res/running_land_light.wav"; + case StepType::land: return "../res/running_land.wav"; + case StepType::sand: return "../res/running_sand.wav"; + case StepType::water: return "../res/running_water.wav"; + case StepType::mechanical: return "../res/running_mechanical.wav"; + case StepType::grass: return "../res/running_grass.wav"; + case StepType::unknown: return "../res/running_unknown.wav"; + case StepType::paved: return "../res/running_paved.wav"; + case StepType::carpet: return "../res/running_carpet.wav"; + case StepType::weak_wood: return "../res/running_weak_wood.wav"; + case StepType::none: throw std::invalid_argument("No running sfx for none step type"); + } +} + +#endif /* end of include guard: STEP_TYPE_H_38251870 */ -- cgit 1.4.1