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