author | nemo |
Thu, 25 Feb 2010 23:28:26 +0000 | |
changeset 2870 | 1358cc003e4d |
parent 2821 | 67815ee123d7 |
child 2874 | 3c7c2bf1ba38 |
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; |
c977d7f2aa09
Toggle for stars ("frontend effects") - also turns off optimisations for stars that were causing problems onone machine
nemo
parents:
2012
diff
changeset
|
47 |
|
184 | 48 |
class HWForm : public QMainWindow |
49 |
{ |
|
50 |
Q_OBJECT |
|
51 |
||
52 |
public: |
|
53 |
HWForm(QWidget *parent = 0); |
|
54 |
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
|
55 |
SDLInteraction sdli; |
2773
e94f240a8a41
Have game beep when someone joins lobby/room. Controlled by Sound option
nemo
parents:
2515
diff
changeset
|
56 |
GameUIConfig * config; |
e94f240a8a41
Have game beep when someone joins lobby/room. Controlled by Sound option
nemo
parents:
2515
diff
changeset
|
57 |
QSettings * gameSettings; // Same file GameUIConfig points to but without the baggage. Needs sync() calls if you want to get GameUIConfig changes though |
2821 | 58 |
void updateXfire(); |
184 | 59 |
|
60 |
private slots: |
|
61 |
void GoToMain(); |
|
62 |
void GoToSinglePlayer(); |
|
63 |
void GoToSetup(); |
|
64 |
void GoToMultiplayer(); |
|
579 | 65 |
void GoToSaves(); |
184 | 66 |
void GoToDemos(); |
67 |
void GoToNet(); |
|
1950 | 68 |
void GoToNetType(); |
187 | 69 |
void GoToInfo(); |
587 | 70 |
void GoToTraining(); |
600 | 71 |
void GoToSelectWeapon(); |
2009 | 72 |
void GoToSelectWeaponSet(const QString & name); |
694 | 73 |
void GoToSelectNewWeapon(); |
646 | 74 |
void GoToNetServer(); |
1885 | 75 |
void GoToSchemes(); |
1905 | 76 |
void GoToAdmin(); |
289 | 77 |
void GoToPage(quint8 id); |
78 |
void GoBack(); |
|
530 | 79 |
void btnExitPressed(); |
80 |
void btnExitClicked(); |
|
535
a14eaf35cf4b
"Setup" button instead of "New team", exclude playing teams from setup
displacer
parents:
533
diff
changeset
|
81 |
void IntermediateSetup(); |
184 | 82 |
void NewTeam(); |
83 |
void EditTeam(); |
|
1840 | 84 |
void RandomNames(); |
85 |
void RandomName(const int &i); |
|
184 | 86 |
void TeamSave(); |
87 |
void TeamDiscard(); |
|
88 |
void SimpleGame(); |
|
89 |
void PlayDemo(); |
|
587 | 90 |
void StartTraining(); |
184 | 91 |
void NetConnect(); |
666 | 92 |
void NetConnectServer(const QString & host, quint16 port); |
1395 | 93 |
void NetConnectOfficialServer(); |
314 | 94 |
void NetStartServer(); |
184 | 95 |
void NetDisconnect(); |
1311 | 96 |
void NetConnected(); |
184 | 97 |
void NetGameEnter(); |
339
7535ab6c3820
Run game message added, team and config info provided for net game
displacer
parents:
338
diff
changeset
|
98 |
void AddNetTeam(const HWTeam& team); |
184 | 99 |
void StartMPGame(); |
306 | 100 |
void GameStateChanged(GameState gameState); |
383 | 101 |
void ForcedDisconnect(); |
425 | 102 |
void ShowErrorMessage(const QString &); |
533 | 103 |
void GetRecord(bool isDemo, const QByteArray & record); |
660 | 104 |
void CreateNetGame(); |
695 | 105 |
void UpdateWeapons(); |
1162 | 106 |
void onFrontendFullscreen(bool value); |
1235 | 107 |
void Music(bool checked); |
2345
daf1785f2337
- Frontend: reorganize code controlling widgets state, fix problems getting room admin status
unc0rr
parents:
2098
diff
changeset
|
108 |
|
daf1785f2337
- Frontend: reorganize code controlling widgets state, fix problems getting room admin status
unc0rr
parents:
2098
diff
changeset
|
109 |
void NetGameChangeStatus(bool isMaster); |
1409
d1cbe4a57ebf
Add button for controlling room options (no usefull yet)
unc0rr
parents:
1404
diff
changeset
|
110 |
void NetGameMaster(); |
d1cbe4a57ebf
Add button for controlling room options (no usefull yet)
unc0rr
parents:
1404
diff
changeset
|
111 |
void NetGameSlave(); |
2377 | 112 |
|
1418 | 113 |
void AsyncNetServerStart(); |
1600 | 114 |
void NetLeftRoom(); |
1899
5763f46d7486
Sync schemes config over net should work now (untested)
unc0rr
parents:
1897
diff
changeset
|
115 |
void selectFirstNetScheme(); |
660 | 116 |
|
184 | 117 |
private: |
314 | 118 |
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
|
119 |
void UpdateTeamsLists(const QStringList* editable_teams=0); |
696 | 120 |
void CreateGame(GameCFGWidget * gamecfg, TeamSelWidget* pTeamSelWidget, QString ammo); |
674 | 121 |
void closeEvent(QCloseEvent *event); |
1419 | 122 |
void CustomizePalettes(); |
2012 | 123 |
void resizeEvent(QResizeEvent * event); |
2377 | 124 |
|
187 | 125 |
enum PageIDs { |
788
00720357601f
- Get rid of PageSimpleGame, now pressing 'quick game' just starts round
unc0rr
parents:
697
diff
changeset
|
126 |
ID_PAGE_SETUP_TEAM = 0, |
00720357601f
- Get rid of PageSimpleGame, now pressing 'quick game' just starts round
unc0rr
parents:
697
diff
changeset
|
127 |
ID_PAGE_SETUP = 1, |
00720357601f
- Get rid of PageSimpleGame, now pressing 'quick game' just starts round
unc0rr
parents:
697
diff
changeset
|
128 |
ID_PAGE_MULTIPLAYER = 2, |
00720357601f
- Get rid of PageSimpleGame, now pressing 'quick game' just starts round
unc0rr
parents:
697
diff
changeset
|
129 |
ID_PAGE_DEMOS = 3, |
00720357601f
- Get rid of PageSimpleGame, now pressing 'quick game' just starts round
unc0rr
parents:
697
diff
changeset
|
130 |
ID_PAGE_NET = 4, |
1354
a8dcdeb88a43
Various small insignificant improvements everywhere
unc0rr
parents:
1311
diff
changeset
|
131 |
ID_PAGE_NETGAME = 5, |
788
00720357601f
- Get rid of PageSimpleGame, now pressing 'quick game' just starts round
unc0rr
parents:
697
diff
changeset
|
132 |
ID_PAGE_INFO = 6, |
00720357601f
- Get rid of PageSimpleGame, now pressing 'quick game' just starts round
unc0rr
parents:
697
diff
changeset
|
133 |
ID_PAGE_MAIN = 7, |
00720357601f
- Get rid of PageSimpleGame, now pressing 'quick game' just starts round
unc0rr
parents:
697
diff
changeset
|
134 |
ID_PAGE_GAMESTATS = 8, |
00720357601f
- Get rid of PageSimpleGame, now pressing 'quick game' just starts round
unc0rr
parents:
697
diff
changeset
|
135 |
ID_PAGE_SINGLEPLAYER = 9, |
00720357601f
- Get rid of PageSimpleGame, now pressing 'quick game' just starts round
unc0rr
parents:
697
diff
changeset
|
136 |
ID_PAGE_TRAINING = 10, |
00720357601f
- Get rid of PageSimpleGame, now pressing 'quick game' just starts round
unc0rr
parents:
697
diff
changeset
|
137 |
ID_PAGE_SELECTWEAPON = 11, |
00720357601f
- Get rid of PageSimpleGame, now pressing 'quick game' just starts round
unc0rr
parents:
697
diff
changeset
|
138 |
ID_PAGE_NETSERVER = 12, |
1311 | 139 |
ID_PAGE_INGAME = 13, |
1800 | 140 |
ID_PAGE_ROOMSLIST = 14, |
1884 | 141 |
ID_PAGE_CONNECTING = 15, |
1905 | 142 |
ID_PAGE_SCHEME = 16, |
1950 | 143 |
ID_PAGE_ADMIN = 17, |
144 |
ID_PAGE_NETTYPE = 18 |
|
187 | 145 |
}; |
184 | 146 |
HWGame * game; |
1904 | 147 |
HWNetServer* pnetserver; |
148 |
HWNetRegisterServer* pRegisterServer; |
|
245 | 149 |
HWTeam * editedTeam; |
314 | 150 |
HWNewNet * hwnet; |
1907 | 151 |
HWNamegen * namegen; |
1897 | 152 |
AmmoSchemeModel * ammoSchemeModel; |
289 | 153 |
QStack<quint8> PagesStack; |
530 | 154 |
QTime eggTimer; |
2012 | 155 |
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
|
156 |
|
2422ea85d100
added a utility that warns the user to install hedgewars when it's run from the diskimage
koda
parents:
2399
diff
changeset
|
157 |
#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
|
158 |
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
|
159 |
#endif |
2422ea85d100
added a utility that warns the user to install hedgewars when it's run from the diskimage
koda
parents:
2399
diff
changeset
|
160 |
|
496 | 161 |
void OnPageShown(quint8 id, quint8 lastid=0); |
184 | 162 |
}; |
163 |
||
164 |
#endif |