1 /* 2 * OpenClonk, http://www.openclonk.org 3 * 4 * Copyright (c) 1998-2000, Matthes Bender 5 * Copyright (c) 2001-2009, RedWolf Design GmbH, http://www.clonk.de/ 6 * Copyright (c) 2009-2016, The OpenClonk 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 /* Handles engine execution in developer mode */ 19 20 #ifndef INC_C4Console 21 #define INC_C4Console 22 23 #include "editor/C4ConsoleGUI.h" 24 #include "editor/C4EditCursor.h" 25 #include "editor/C4ObjectListDlg.h" 26 #include "editor/C4ToolsDlg.h" 27 28 #include "platform/C4Window.h" 29 30 const int C4CNS_ModePlay = 0, 31 C4CNS_ModeEdit = 1, 32 C4CNS_ModeCreateObject = 2, 33 C4CNS_ModeDraw = 3; 34 35 #define IDM_NET_CLIENT1 10000 36 #define IDM_NET_CLIENT2 10100 37 #define IDM_PLAYER_QUIT1 10200 38 #define IDM_PLAYER_QUIT2 10300 39 #define IDM_VIEWPORT_NEW1 10400 40 #define IDM_VIEWPORT_NEW2 10500 41 42 class C4Console: public C4ConsoleGUI 43 { 44 public: 45 C4Console(); 46 ~C4Console() override; 47 void Default(); 48 void Clear() override; 49 void Close() override; 50 using C4Window::Init; 51 virtual C4Window * Init(C4AbstractApp * app); 52 void Execute(); 53 void ClearPointers(C4Object *pObj); 54 bool Message(const char *szMessage, bool fQuery=false); 55 bool In(const char *szText); 56 void DoPlay(); 57 void DoHalt(); 58 void UpdateInputCtrl(); 59 void UpdateMenus(); 60 void InitGame(); 61 bool TogglePause(); // key callpack: pause 62 public: 63 void CloseGame(); 64 bool UpdatePlayerMenu(); 65 bool UpdateViewportMenu(); 66 void UpdateStatusBars(); 67 // Menu 68 void ClearViewportMenu(); 69 void UpdateNetMenu(); 70 void ClearNetMenu(); 71 void PlayerJoin(); 72 void ViewportNew(); 73 void HelpAbout(); 74 bool FileSelect(StdStrBuf *sFilename, const char *szFilter, DWORD dwFlags, bool fSave=false); 75 bool SaveGame(const char * path); 76 bool SaveScenario(const char * path, bool export_packed=false); 77 bool FileSaveAs(bool fSaveGame, bool export_packed=false); 78 bool FileSave(); 79 bool FileNew(); 80 bool FileOpen(const char *filename=nullptr, bool host_in_network=false); 81 bool FileOpenWPlrs(); 82 bool FileCommand(); 83 bool FileClose(); 84 bool FileQuit(); 85 bool FileRecord(); 86 void SetCaptionToFilename(const char* szFilename); 87 public: 88 C4ToolsDlg ToolsDlg; 89 C4ObjectListDlg ObjectListDlg; 90 C4EditCursor EditCursor; 91 92 int FrameCounter; 93 int Time,FPS; 94 95 // Script MRU: Keep track of recent script executions in global and local windows 96 enum RecentScriptInputLists 97 { 98 MRU_Scenario = 0, 99 MRU_Object = 1 100 }; 101 private: 102 std::list<StdCopyStrBuf> recent_script_input[2]; 103 public: 104 std::list<const char *> GetScriptSuggestions(class C4PropList *target, RecentScriptInputLists section) const; 105 void RegisterRecentInput(const char *input, RecentScriptInputLists section); 106 }; 107 108 extern C4Console Console; 109 110 #endif 111