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