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