-
Notifications
You must be signed in to change notification settings - Fork 1
/
game.h
executable file
·279 lines (238 loc) · 5.82 KB
/
game.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
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
#ifndef GAME_H
#define GAME_H
#include <QObject>
#include <QQmlListProperty>
#include <QString>
#include <QThread>
#include "clientfield.h"
#include "singlemode.h"
#include "signalWaiter.h"
namespace glaze{
struct Config {
bool use_d3d;
unsigned short antialias;
unsigned short serverport;
unsigned char textfontsize;
wchar_t lastip[20];
wchar_t lastport[10];
wchar_t nickname[20];
wchar_t gamename[20];
wchar_t lastdeck[64];
wchar_t textfont[256];
wchar_t numfont[256];
wchar_t roompass[20];
};
class DuelInfo : public QObject {
Q_OBJECT
public:
explicit DuelInfo(QObject *parent = 0);
bool is_started; //TODO: discard its usage
bool is_replay;
bool is_replaySkiping;
bool is_first;
bool is_tag;
bool is_singleMode;
bool is_shuffling;
bool tag_player[2];
int lp[2];
int turn;
short curMsg;
wchar_t hostname[20];
wchar_t clientname[20];
wchar_t hostname_tag[20];
wchar_t clientname_tag[20];
// wchar_t strLP[2][16];
// wchar_t strTurn[8];
wchar_t* vic_string;
unsigned char player_type;
unsigned char time_player;
unsigned short time_limit;
unsigned short time_left[2];
public slots:
int getLp1() {
return lp[0];
}
int getLp2() {
return lp[1];
}
QString getClientName() {
return QString::fromWCharArray(clientname);
}
int getCurMsg() {
return curMsg;
}
bool isReplay() {
return is_replay;
}
int playerType() {
return player_type;
}
bool isSingleMode() {
return is_singleMode;
}
signals:
void lp1Changed();
void lp2Changed();
void clientNameChanged();
};
// struct FadingUnit{}; // not needed
class Game : public QObject
{
Q_OBJECT
public:
explicit Game(QObject *parent = 0);
~Game();
bool Initialize();
Q_INVOKABLE void stopSinglePlay(bool is_exiting = false);
Q_INVOKABLE bool qwMessage() const;
Q_INVOKABLE void setQwMessage(bool wMess);
Q_INVOKABLE QString qstMessage();
Q_INVOKABLE void startSinglePlay(QString name);
Q_INVOKABLE void mySet();
Q_INVOKABLE int getShowCardCode();
Q_INVOKABLE int getShowCard();
Q_INVOKABLE int getBuffer();
Q_INVOKABLE void setResponseI(int respI);
Q_INVOKABLE static void setResponseB(QList<int> respB, unsigned char len);
Q_INVOKABLE static void sendResponse();
// void setQstMessage(QString);
bool qstHintMsg();
void setQstHintMsg(bool msg);
QString qHintMsg();
bool qwQuery();
void setQwQuery(bool que);
QString qstQMessage();
bool qwCardSelect();
void setQwCardSelect(bool sel);
QString qstCardSelect();
bool qwPosSelect();
void setQwPosSelect(bool pos);
uint32 qbtnPSAU();
uint32 qbtnPSAD();
uint32 qbtnPSDU();
uint32 qbtnPSDD();
bool qbtnLeaveGame();
void setQbtnLeaveGame(bool t);
QString qstLeaveGame();
bool qwACMessage();
void setQwACMessage(bool t);
QString qstACMessage();
bool qwANRace();
void setQwANRace(bool t);
QList<bool> qchkRace();
bool qwin();
int LocalPlayer(int player);
const wchar_t* LocalName(int local_player);
void AddChatMsg(wchar_t* msg, int player);
DuelInfo dInfo;
ClientField dField;
SingleMode *sMode;
QThread *workerThread;
SignalWaiter actionSignal;
SignalWaiter singleSignal;
SignalWaiter invokeMethodSignal;
QVector<int> buffer;
bool win;
QVector<int> showcard;
QVector<int> showcardcode;
int showcarddif;
int showcardp;
bool always_chain;
bool ignore_chain;
int lpplayer;
int lpccolor;
wchar_t* lpcstring;
int lpd;
std::wstring chatMsg[8];
int chatTiming[8];
int chatType[8];
QVector3D atk_r;
QVector3D atk_t;
int is_attacking;
int attack_sv;
// command menu (menu showed upon clicling a card)
bool wCmdMenu;
bool btnActivate;
bool btnSummon;
bool btnSPSummon;
bool btnMSet;
bool btnSSet;
bool btnRepos;
bool btnAttack;
bool btnShowList;
// card select window
bool wCardSelect;
QString stCardSelect;
int btnCardSelect[100];
//hint text
bool stHintMsg;
QString HintMsg;
bool stTip;
//message
bool wMessage;
QString stMessage;
//lan
bool wLanWindow;
QString ebNickName;
bool btnLanRefresh;
bool btnJoinHost;
bool btnJoinCancel;
bool btnCreateHost;
//phase button //TODO: move completly to qml
bool wPhase;
bool btnDP;
bool btnSP;
bool btnM1;
bool btnBP;
bool btnM2;
bool btnEP;
//yes/no
bool wQuery;
QString stQMessage;
//info
bool chkWaitChain;
bool chkAutoPos;
bool chkRandomPos;
bool chkAutoChain;
//pos select // select battle position
// after special summoning a monster it asks for the attle position to put the card in
bool wPosSelect;
uint32 btnPSAU;
uint32 btnPSAD;
uint32 btnPSDU;
uint32 btnPSDD;
//surrender/leave
bool btnLeaveGame;
QString stLeaveGame;
//auto close message
bool wACMessage;
QString stACMessage;
//announce race
bool wANRace;
QString stANRace;
QList<bool> chkRace;
signals:
void qwMessageChanged();
void qstHintMsgChanged();
void qwQueryChanged();
void qwCardSelectChanged();
void qwPosSelectChanged();
void qbtnLeaveGameChanged();
void qwACMessageChanged();
void qwANRaceChanged();
void qwinChanged();
void qshowCardChanged();
void qclientAnalyzeChanged();
void qshowWCardSelectChanged();
};
extern Game* mainGame;
}
#define COMMAND_ACTIVATE 0x0001
#define COMMAND_SUMMON 0x0002
#define COMMAND_SPSUMMON 0x0004
#define COMMAND_MSET 0x0008
#define COMMAND_SSET 0x0010
#define COMMAND_REPOS 0x0020
#define COMMAND_ATTACK 0x0040
#define COMMAND_LIST 0x0080
#endif // GAME_H