author | nemo |
Sat, 27 Feb 2010 00:13:45 +0000 | |
changeset 2875 | 021103f450e7 |
parent 2874 | 3c7c2bf1ba38 |
child 2948 | 3f21a9dc93d0 |
permissions | -rw-r--r-- |
184 | 1 |
/* |
1066 | 2 |
* Hedgewars, a free turn based strategy game |
486 | 3 |
* Copyright (c) 2005-2007 Andrey Korotaev <unC0Rr@gmail.com> |
184 | 4 |
* |
5 |
* This program is free software; you can redistribute it and/or modify |
|
6 |
* it under the terms of the GNU General Public License as published by |
|
7 |
* the Free Software Foundation; version 2 of the License |
|
8 |
* |
|
9 |
* This program is distributed in the hope that it will be useful, |
|
10 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
11 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
12 |
* GNU General Public License for more details. |
|
13 |
* |
|
14 |
* You should have received a copy of the GNU General Public License |
|
15 |
* along with this program; if not, write to the Free Software |
|
16 |
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA |
|
17 |
*/ |
|
18 |
||
19 |
#ifndef HWFORM_H |
|
20 |
#define HWFORM_H |
|
21 |
||
471 | 22 |
#include <QMainWindow> |
289 | 23 |
#include <QStack> |
530 | 24 |
#include <QTime> |
184 | 25 |
|
314 | 26 |
#include "netserver.h" |
306 | 27 |
#include "game.h" |
184 | 28 |
#include "ui_hwform.h" |
1225
f882a92ef872
Play music in menu also, with fading effects when run game
unc0rr
parents:
1223
diff
changeset
|
29 |
#include "SDLs.h" |
2012 | 30 |
#include "bgwidget.h" |
184 | 31 |
|
2401 | 32 |
#ifdef __APPLE__ |
2400
2422ea85d100
added a utility that warns the user to install hedgewars when it's run from the diskimage
koda
parents:
2399
diff
changeset
|
33 |
#include "InstallController.h" |
2422ea85d100
added a utility that warns the user to install hedgewars when it's run from the diskimage
koda
parents:
2399
diff
changeset
|
34 |
#endif |
2422ea85d100
added a utility that warns the user to install hedgewars when it's run from the diskimage
koda
parents:
2399
diff
changeset
|
35 |
|
184 | 36 |
class HWGame; |
37 |
class HWTeam; |
|
1907 | 38 |
class HWNamegen; |
314 | 39 |
class HWNewNet; |
184 | 40 |
class GameUIConfig; |
634 | 41 |
class HWNetRegisterServer; |
674 | 42 |
class QCloseEvent; |
1897 | 43 |
class AmmoSchemeModel; |
2773
e94f240a8a41
Have game beep when someone joins lobby/room. Controlled by Sound option
nemo
parents:
2515
diff
changeset
|
44 |
class QSettings; |
184 | 45 |
|
2098
c977d7f2aa09
Toggle for stars ("frontend effects") - also turns off optimisations for stars that were causing problems onone machine
nemo
parents:
2012
diff
changeset
|
46 |
extern bool frontendEffects; |
2874
3c7c2bf1ba38
A simple hat reservation mechanism. Can be worked around with a little effort, but to make it useful, you'd have to get everyone you played with to work around it too. Quite a bit of effort for a small reward feature.
nemo
parents:
2821
diff
changeset
|
47 |
extern QString playerHash; |
2098
c977d7f2aa09
Toggle for stars ("frontend effects") - also turns off optimisations for stars that were causing problems onone machine
nemo
parents:
2012
diff
changeset
|
48 |
|
184 | 49 |
class HWForm : public QMainWindow |
50 |
{ |
|
51 |
Q_OBJECT |
|
52 |
||
53 |
public: |
|
54 |
HWForm(QWidget *parent = 0); |
|
55 |
Ui_HWForm ui; |
|
2515
51d3f4b6293a
revert audio to use SDL_mixer -- also frontend uses it, so it needs sdlmixer sources
koda
parents:
2428
diff
changeset
|
56 |
SDLInteraction sdli; |
2773
e94f240a8a41
Have game beep when someone joins lobby/room. Controlled by Sound option
nemo
parents:
2515
diff
changeset
|
57 |
GameUIConfig * config; |
e94f240a8a41
Have game beep when someone joins lobby/room. Controlled by Sound option
nemo
parents:
2515
diff
changeset
|
58 |
QSettings * gameSettings; // Same file GameUIConfig points to but without the baggage. Needs sync() calls if you want to get GameUIConfig changes though |
2821 | 59 |
void updateXfire(); |
184 | 60 |
|
61 |
private slots: |
|
62 |
void GoToMain(); |
|
63 |
void GoToSinglePlayer(); |
|
64 |
void GoToSetup(); |
|
65 |
void GoToMultiplayer(); |
|
579 | 66 |
void GoToSaves(); |
184 | 67 |
void GoToDemos(); |
68 |
void GoToNet(); |
|
1950 | 69 |
void GoToNetType(); |
187 | 70 |
void GoToInfo(); |
587 | 71 |
void GoToTraining(); |
600 | 72 |
void GoToSelectWeapon(); |
2009 | 73 |
void GoToSelectWeaponSet(const QString & name); |
694 | 74 |
void GoToSelectNewWeapon(); |
646 | 75 |
void GoToNetServer(); |
1885 | 76 |
void GoToSchemes(); |
1905 | 77 |
void GoToAdmin(); |
289 | 78 |
void GoToPage(quint8 id); |
79 |
void GoBack(); |
|
530 | 80 |
void btnExitPressed(); |
81 |
void btnExitClicked(); |
|
535
a14eaf35cf4b
"Setup" button instead of "New team", exclude playing teams from setup
displacer
parents:
533
diff
changeset
|
82 |
void IntermediateSetup(); |
184 | 83 |
void NewTeam(); |
84 |
void EditTeam(); |
|
1840 | 85 |
void RandomNames(); |
86 |
void RandomName(const int &i); |
|
184 | 87 |
void TeamSave(); |
88 |
void TeamDiscard(); |
|
89 |
void SimpleGame(); |
|
90 |
void PlayDemo(); |
|
587 | 91 |
void StartTraining(); |
184 | 92 |
void NetConnect(); |
666 | 93 |
void NetConnectServer(const QString & host, quint16 port); |
1395 | 94 |
void NetConnectOfficialServer(); |
314 | 95 |
void NetStartServer(); |
184 | 96 |
void NetDisconnect(); |
1311 | 97 |
void NetConnected(); |
184 | 98 |
void NetGameEnter(); |
339
7535ab6c3820
Run game message added, team and config info provided for net game
displacer
parents:
338
diff
changeset
|
99 |
void AddNetTeam(const HWTeam& team); |
184 | 100 |
void StartMPGame(); |
306 | 101 |
void GameStateChanged(GameState gameState); |
383 | 102 |
void ForcedDisconnect(); |
425 | 103 |
void ShowErrorMessage(const QString &); |
533 | 104 |
void GetRecord(bool isDemo, const QByteArray & record); |
660 | 105 |
void CreateNetGame(); |
695 | 106 |
void UpdateWeapons(); |
1162 | 107 |
void onFrontendFullscreen(bool value); |
1235 | 108 |
void Music(bool checked); |
2345
daf1785f2337
- Frontend: reorganize code controlling widgets state, fix problems getting room admin status
unc0rr
parents:
2098
diff
changeset
|
109 |
|
daf1785f2337
- Frontend: reorganize code controlling widgets state, fix problems getting room admin status
unc0rr
parents:
2098
diff
changeset
|
110 |
void NetGameChangeStatus(bool isMaster); |
1409
d1cbe4a57ebf
Add button for controlling room options (no usefull yet)
unc0rr
parents:
1404
diff
changeset
|
111 |
void NetGameMaster(); |
d1cbe4a57ebf
Add button for controlling room options (no usefull yet)
unc0rr
parents:
1404
diff
changeset
|
112 |
void NetGameSlave(); |
2377 | 113 |
|
1418 | 114 |
void AsyncNetServerStart(); |
1600 | 115 |
void NetLeftRoom(); |
1899
5763f46d7486
Sync schemes config over net should work now (untested)
unc0rr
parents:
1897
diff
changeset
|
116 |
void selectFirstNetScheme(); |
660 | 117 |
|
184 | 118 |
private: |
314 | 119 |
void _NetConnect(const QString & hostName, quint16 port, const QString & nick); |
535
a14eaf35cf4b
"Setup" button instead of "New team", exclude playing teams from setup
displacer
parents:
533
diff
changeset
|
120 |
void UpdateTeamsLists(const QStringList* editable_teams=0); |
696 | 121 |
void CreateGame(GameCFGWidget * gamecfg, TeamSelWidget* pTeamSelWidget, QString ammo); |
674 | 122 |
void closeEvent(QCloseEvent *event); |
1419 | 123 |
void CustomizePalettes(); |
2012 | 124 |
void resizeEvent(QResizeEvent * event); |
2377 | 125 |
|
187 | 126 |
enum PageIDs { |
788
00720357601f
- Get rid of PageSimpleGame, now pressing 'quick game' just starts round
unc0rr
parents:
697
diff
changeset
|
127 |
ID_PAGE_SETUP_TEAM = 0, |
00720357601f
- Get rid of PageSimpleGame, now pressing 'quick game' just starts round
unc0rr
parents:
697
diff
changeset
|
128 |
ID_PAGE_SETUP = 1, |
00720357601f
- Get rid of PageSimpleGame, now pressing 'quick game' just starts round
unc0rr
parents:
697
diff
changeset
|
129 |
ID_PAGE_MULTIPLAYER = 2, |
00720357601f
- Get rid of PageSimpleGame, now pressing 'quick game' just starts round
unc0rr
parents:
697
diff
changeset
|
130 |
ID_PAGE_DEMOS = 3, |
00720357601f
- Get rid of PageSimpleGame, now pressing 'quick game' just starts round
unc0rr
parents:
697
diff
changeset
|
131 |
ID_PAGE_NET = 4, |
1354
a8dcdeb88a43
Various small insignificant improvements everywhere
unc0rr
parents:
1311
diff
changeset
|
132 |
ID_PAGE_NETGAME = 5, |
788
00720357601f
- Get rid of PageSimpleGame, now pressing 'quick game' just starts round
unc0rr
parents:
697
diff
changeset
|
133 |
ID_PAGE_INFO = 6, |
00720357601f
- Get rid of PageSimpleGame, now pressing 'quick game' just starts round
unc0rr
parents:
697
diff
changeset
|
134 |
ID_PAGE_MAIN = 7, |
00720357601f
- Get rid of PageSimpleGame, now pressing 'quick game' just starts round
unc0rr
parents:
697
diff
changeset
|
135 |
ID_PAGE_GAMESTATS = 8, |
00720357601f
- Get rid of PageSimpleGame, now pressing 'quick game' just starts round
unc0rr
parents:
697
diff
changeset
|
136 |
ID_PAGE_SINGLEPLAYER = 9, |
00720357601f
- Get rid of PageSimpleGame, now pressing 'quick game' just starts round
unc0rr
parents:
697
diff
changeset
|
137 |
ID_PAGE_TRAINING = 10, |
00720357601f
- Get rid of PageSimpleGame, now pressing 'quick game' just starts round
unc0rr
parents:
697
diff
changeset
|
138 |
ID_PAGE_SELECTWEAPON = 11, |
00720357601f
- Get rid of PageSimpleGame, now pressing 'quick game' just starts round
unc0rr
parents:
697
diff
changeset
|
139 |
ID_PAGE_NETSERVER = 12, |
1311 | 140 |
ID_PAGE_INGAME = 13, |
1800 | 141 |
ID_PAGE_ROOMSLIST = 14, |
1884 | 142 |
ID_PAGE_CONNECTING = 15, |
1905 | 143 |
ID_PAGE_SCHEME = 16, |
1950 | 144 |
ID_PAGE_ADMIN = 17, |
145 |
ID_PAGE_NETTYPE = 18 |
|
187 | 146 |
}; |
184 | 147 |
HWGame * game; |
1904 | 148 |
HWNetServer* pnetserver; |
149 |
HWNetRegisterServer* pRegisterServer; |
|
245 | 150 |
HWTeam * editedTeam; |
314 | 151 |
HWNewNet * hwnet; |
1907 | 152 |
HWNamegen * namegen; |
1897 | 153 |
AmmoSchemeModel * ammoSchemeModel; |
289 | 154 |
QStack<quint8> PagesStack; |
530 | 155 |
QTime eggTimer; |
2012 | 156 |
BGWidget * wBackground; |
2400
2422ea85d100
added a utility that warns the user to install hedgewars when it's run from the diskimage
koda
parents:
2399
diff
changeset
|
157 |
|
2422ea85d100
added a utility that warns the user to install hedgewars when it's run from the diskimage
koda
parents:
2399
diff
changeset
|
158 |
#ifdef __APPLE__ |
2422ea85d100
added a utility that warns the user to install hedgewars when it's run from the diskimage
koda
parents:
2399
diff
changeset
|
159 |
InstallController * panel; |
2422ea85d100
added a utility that warns the user to install hedgewars when it's run from the diskimage
koda
parents:
2399
diff
changeset
|
160 |
#endif |
2422ea85d100
added a utility that warns the user to install hedgewars when it's run from the diskimage
koda
parents:
2399
diff
changeset
|
161 |
|
496 | 162 |
void OnPageShown(quint8 id, quint8 lastid=0); |
184 | 163 |
}; |
164 |
||
165 |
#endif |