1 /*
2 	This file is part of Warzone 2100.
3 	Copyright (C) 1999-2004  Eidos Interactive
4 	Copyright (C) 2005-2020  Warzone 2100 Project
5 
6 	Warzone 2100 is free software; you can redistribute it and/or modify
7 	it under the terms of the GNU General Public License as published by
8 	the Free Software Foundation; either version 2 of the License, or
9 	(at your option) any later version.
10 
11 	Warzone 2100 is distributed in the hope that it will be useful,
12 	but WITHOUT ANY WARRANTY; without even the implied warranty of
13 	MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 	GNU General Public License for more details.
15 
16 	You should have received a copy of the GNU General Public License
17 	along with Warzone 2100; if not, write to the Free Software
18 	Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
19 */
20 /** \file
21  *  Multiplayer Options Title UI. Used for skirmish, challenge and online skirmish options UIs.
22  */
23 
24 #ifndef __INCLUDED_SRC_TITLEUI_MULTIPLAYER_H__
25 #define __INCLUDED_SRC_TITLEUI_MULTIPLAYER_H__
26 
27 #include "../wrappers.h"
28 #include "titleui.h"
29 
30 class IntFormAnimated; // forward-declare
31 
32 class WzMultiplayerOptionsTitleUI : public WzTitleUI
33 {
34 public:
35 	WzMultiplayerOptionsTitleUI(std::shared_ptr<WzTitleUI> parent);
36 	virtual ~WzMultiplayerOptionsTitleUI();
37 	virtual void start() override;
38 	virtual TITLECODE run() override;
39 	void frontendMultiMessages(bool running);
40 
41 	void openDifficultyChooser(uint32_t playerIndex);
42 	void closeDifficultyChooser();
43 
44 	void openFactionChooser(uint32_t playerIndex);
45 	void closeFactionChooser();
46 
47 	void openAiChooser(uint32_t playerIndex);
48 	void closeAiChooser();
49 
50 	void openPositionChooser(uint32_t playerIndex);
51 	void closePositionChooser();
52 
53 	void openTeamChooser(uint32_t playerIndex);
54 	void closeTeamChooser();
55 
56 	void openColourChooser(uint32_t playerIndex);
57 	void closeColourChooser();
58 
59 	void closeAllChoosers();
60 
61 	void screenSizeDidChange(unsigned int oldWidth, unsigned int oldHeight, unsigned int newWidth, unsigned int newHeight) override;
62 private:
63 	/**
64 	 * Initializes a chooser, preparing to add it on a single line on player list. This involves removing
65 	 * any widgets that may have been positioned on that player's row.
66 	 */
67 	void initInlineChooser(uint32_t playerIndex);
68 
69 	/**
70 	 * Initializes a chooser, preparing to replace the "right side". This involves removing
71 	 * the player list.
72 	 */
73 	IntFormAnimated* initRightSideChooser(const char* sideText);
74 
75 	/**
76 	 * Initializes the right side box which usually contains the list of players. Handles opening difficulty
77 	 * and ai choosers etc.
78 	 */
79 	void addPlayerBox(bool addPlayerEntries);
80 
81 	/**
82 	 * Starts hosting. Used as an action for "Host Game" button. Another place where this is used is for
83 	 * activating the host immediately when entering the multiplayer menu with a challenge active.
84 	 */
85 	bool startHost();
86 
87 	void processMultiopWidgets(UDWORD button);
88 
89 	std::shared_ptr<W_SCREEN> psInlineChooserOverlayScreen = nullptr;
90 	std::shared_ptr<WzTitleUI> parent;
91 	bool performedFirstStart = false;
92 
93 	int8_t inlineChooserUp;
94 	int8_t aiChooserUp;
95 	int8_t difficultyChooserUp;
96 	int8_t positionChooserUp;
97 };
98 
99 #endif
100