summary refs log tree commit diff stats
path: root/src/step_type.h
blob: 0cbdad0ec831d58f572d45c2064f3011e8fb610c (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
#ifndef STEP_TYPE_H_38251870
#define STEP_TYPE_H_38251870

#include <string_view>
#include <stdexcept>

enum class StepType {
  none,
  wood,
  land_light,
  land,
  sand,
  water,
  mechanical,
  grass,
  unknown,
  paved,
  carpet,
  weak_wood,
  ladder_vine
};

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;
  if (str == "ladder_vine") return StepType::ladder_vine;
  return StepType::none;
}

inline std::string_view runningSfxForStepType(StepType step) {
  switch (step) {
    case StepType::wood: return "../res/sfx/running_wood.wav";
    case StepType::land_light: return "../res/sfx/running_land_light.wav";
    case StepType::land: return "../res/sfx/running_land.wav";
    case StepType::sand: return "../res/sfx/running_sand.wav";
    case StepType::water: return "../res/sfx/running_water.wav";
    case StepType::mechanical: return "../res/sfx/running_mechanical.wav";
    case StepType::grass: return "../res/sfx/running_grass.wav";
    case StepType::unknown: return "../res/sfx/running_unknown.wav";
    case StepType::paved: return "../res/sfx/running_paved.wav";
    case StepType::carpet: return "../res/sfx/running_carpet.wav";
    case StepType::weak_wood: return "../res/sfx/running_weak_wood.wav";
    case StepType::ladder_vine: return "../res/sfx/running_ladder_vine.wav";
    case StepType::none: throw std::invalid_argument("No running sfx for none step type");
  }
}

#endif /* end of include guard: STEP_TYPE_H_38251870 */