| 1 | /* |
| 2 | * LegacyClonk |
| 3 | * |
| 4 | * Copyright (c) RedWolf Design |
| 5 | * Copyright (c) 2008, Sven2 |
| 6 | * Copyright (c) 2017-2020, The LegacyClonk Team and contributors |
| 7 | * |
| 8 | * Distributed under the terms of the ISC license; see accompanying file |
| 9 | * "COPYING" for details. |
| 10 | * |
| 11 | * "Clonk" is a registered trademark of Matthes Bender, used with permission. |
| 12 | * See accompanying file "TRADEMARK" for details. |
| 13 | * |
| 14 | * To redistribute this file separately, substitute the full license texts |
| 15 | * for the above references. |
| 16 | */ |
| 17 | |
| 18 | // Engine internal C4Menus: Main menu, Options, Player join, Hostility, etc. |
| 19 | |
| 20 | #pragma once |
| 21 | |
| 22 | #include "C4Menu.h" |
| 23 | |
| 24 | // Menu identification constants for main menus |
| 25 | enum |
| 26 | { |
| 27 | C4MN_Hostility = 1, // identification for hostility menu |
| 28 | C4MN_Main = 2, // identification for all other menus |
| 29 | C4MN_TeamSelection = 3, |
| 30 | C4MN_TeamSwitch = 4, |
| 31 | C4MN_Observer = 5, |
| 32 | }; |
| 33 | |
| 34 | class C4MainMenu : public C4Menu |
| 35 | { |
| 36 | public: |
| 37 | C4MainMenu(); |
| 38 | |
| 39 | virtual void Default() override; |
| 40 | |
| 41 | protected: |
| 42 | int32_t Player; |
| 43 | |
| 44 | public: |
| 45 | bool Init(C4FacetExSurface &fctSymbol, const char *szEmpty, int32_t iPlayer, int32_t = C4MN_Extra_None, int32_t = 0, int32_t iId = 0, int32_t iStyle = C4MN_Style_Normal); |
| 46 | bool InitRefSym(const C4FacetEx &fctSymbol, const char *szEmpty, int32_t iPlayer, int32_t = C4MN_Extra_None, int32_t = 0, int32_t iId = 0, int32_t iStyle = C4MN_Style_Normal); |
| 47 | |
| 48 | bool ActivateMain(int32_t iPlayer); |
| 49 | bool ActivateNewPlayer(int32_t iPlayer); |
| 50 | bool ActivateHostility(int32_t iPlayer); |
| 51 | bool ActivateGoals(int32_t iPlayer, bool fDoActivate); |
| 52 | bool ActivateRules(int32_t iPlayer); |
| 53 | bool ActivateSavegame(int32_t iPlayer); |
| 54 | bool ActivateHost(int32_t iPlayer); |
| 55 | bool ActivateClient(int32_t iPlayer); |
| 56 | bool ActivateOptions(int32_t iPlayer, int32_t selection = 0); |
| 57 | bool ActivateDisplay(int32_t iPlayer, int32_t selection = 0); |
| 58 | bool ActivateSurrender(int32_t iPlayer); |
| 59 | bool ActivateObserver(); |
| 60 | |
| 61 | protected: |
| 62 | virtual bool MenuCommand(const char *szCommand, bool fIsCloseCommand) override; |
| 63 | |
| 64 | virtual bool DoRefillInternal(bool &rfRefilled) override; |
| 65 | |
| 66 | virtual void OnSelectionChanged(int32_t iNewSelection) override; |
| 67 | virtual void OnUserSelectItem(int32_t Player, int32_t iIndex) override; |
| 68 | virtual void OnUserEnter(int32_t Player, int32_t iIndex, bool fRight) override; |
| 69 | virtual void OnUserClose() override; |
| 70 | virtual void OnClosed(bool ok) override; |
| 71 | virtual int32_t GetControllingPlayer() override { return Player; } |
| 72 | }; |
| 73 | |