forked from chaehoon/KickItUp
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathGameConfig.h
128 lines (101 loc) · 2.18 KB
/
GameConfig.h
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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
#ifndef _KICKITUP_GAMECONFIG_H
#define _KICKITUP_GAMECONFIG_H
#include <algorithm>
#include "common.h"
using std::max;
using std::min;
enum ePlayer
{
eP_Min,
eP_1 = eP_Min,
eP_2,
eP_Max
};
struct stStepSpeed {
int step;
public:
stStepSpeed() : step(2) {
}
void set(const int speed = 1) {
step = speed;
}
int getMax() const {
int ret = step;
return ret;
}
int getMin() const {
int ret = step;
return ret;
}
void setRandom() {
step = 1+rand() % 8;
}
};
class GameConfig
{
private:
bool m_bStart[eP_Max]; // 1p 2p
stStepSpeed m_StepSpped[eP_Max];
bool m_stageBreak; //< STAGE BREAK
bool m_autoKey[eP_Max][eBA_Max]; //< 1p, 2p auto key
int m_keySet; //< KEY SETTING NORMAL, FUSION
bool m_judgePic; //< JUDGEMENT PICTURE
int m_joySet; //< DDR(0), KOINS(1)
public:
GameConfig(void);
~GameConfig(void);
bool IsStarted( const ePlayer p ) const { return m_bStart[p]; }
void SetStart( const ePlayer p, const bool bStart = true ) { m_bStart[p] = bStart; }
void SetSpeed( const ePlayer p, const int spped ) { m_StepSpped[p].set(spped); }
bool SaveToFile();
bool LoadFromFile();
bool TogleStageBreak() {
m_stageBreak = !m_stageBreak;
return m_stageBreak;
}
bool GetStageBreak() {
return m_stageBreak;
}
bool TogleJudgePic() {
m_judgePic = !m_judgePic;
return m_judgePic;
}
bool GetJudgePic() {
return m_judgePic;
}
int TogleKeySet() {
m_keySet = (m_keySet + 1) % 2;
return m_keySet;
}
int GetKeySet() {
return m_keySet;
}
const char * GetKeySetStr() {
if (1 == m_keySet) {
return "FUSION";
}
return "NORMAL";
}
int TootleJoySet() {
m_joySet = (m_joySet + 1) % 2;
return m_joySet;
}
int GetJoySet() {
return m_joySet;
}
const char* GetJoySetStr() {
if (1 == m_joySet) {
return "KOINS";
}
return "DDR";
}
bool TotleAutoKey(ePlayer p, eButtonToArray b) {
m_autoKey[p][b] = !m_autoKey[p][b];
return m_autoKey[p][b];
}
bool GetAutoKey(ePlayer p, eButtonToArray b) {
return m_autoKey[p][b];
}
};
extern GameConfig g_GameConfig;
#endif // _KICKITUP_GAMECONFIG_H