From 18c1956d68af07248cd563e21b222146a352d5a2 Mon Sep 17 00:00:00 2001 From: Zero Fanker Date: Fri, 8 Nov 2024 23:43:02 -0500 Subject: [PATCH] MinPlayer option (#113) * let minplayers to inherit from ini . using enum to define preview save options . --- MissionEditor/FinalSunDlg.cpp | 10 ++++----- MissionEditor/MissionEditor.rc | 35 ++++++++++++++++++----------- MissionEditor/SaveMapOptionsDlg.cpp | 18 ++++++++++----- MissionEditor/SaveMapOptionsDlg.h | 33 ++++++++++++++++----------- MissionEditor/resource.h | 6 +++-- 5 files changed, 64 insertions(+), 38 deletions(-) diff --git a/MissionEditor/FinalSunDlg.cpp b/MissionEditor/FinalSunDlg.cpp index 0620f6d..b08157b 100644 --- a/MissionEditor/FinalSunDlg.cpp +++ b/MissionEditor/FinalSunDlg.cpp @@ -1061,20 +1061,20 @@ void CFinalSunDlg::SaveMap(CString FileName_) } } - if (count < 2) { - count = 2; + if (count < 1) { + count = 1; } // TODO: control from dialog - Map->GetIniFile().SetInteger("Basic", "MinPlayer", 2); + Map->GetIniFile().SetInteger("Basic", "MinPlayer", opt.m_MinPlayers); Map->GetIniFile().SetInteger("Basic", "MaxPlayer", count); if (opt.m_Compress == 0) { dwFlags |= MAPDATA_UPDATE_TO_INI_ALL_COMPRESSED; } - if (opt.m_PreviewMode == 0) { + if (opt.m_PreviewMode == CSaveMapOptionsDlg::PREVIEW_MINIMAP) { dwFlags |= MAPDATA_UPDATE_TO_INI_ALL_PREVIEW; } - if (opt.m_PreviewMode == 2) { + if (opt.m_PreviewMode == CSaveMapOptionsDlg::PREVIEW_STRIP) { hidePreview = TRUE; } } else { diff --git a/MissionEditor/MissionEditor.rc b/MissionEditor/MissionEditor.rc index ae86e91..7e95187 100644 --- a/MissionEditor/MissionEditor.rc +++ b/MissionEditor/MissionEditor.rc @@ -245,29 +245,25 @@ END #if defined(APSTUDIO_INVOKED) || defined(RA2_MODE) #if defined(APSTUDIO_INVOKED) -IDD_SAVEOPTIONS$(RA2_MODE) DIALOG 0, 0, 233, 186 +IDD_SAVEOPTIONS$(RA2_MODE) DIALOGEX 0, 0, 233, 186 #else -IDD_SAVEOPTIONS DIALOG 0, 0, 233, 186 +IDD_SAVEOPTIONS DIALOGEX 0, 0, 233, 186 #endif STYLE DS_SETFONT | DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU CAPTION "Save options" -FONT 8, "Tahoma" +FONT 8, "Tahoma", 0, 0, 0x0 BEGIN DEFPUSHBUTTON "OK",IDOK,176,165,50,14 PUSHBUTTON "Cancel",IDCANCEL,117,165,50,14 - CONTROL "Compress map",IDC_COMPRESS,"Button",BS_AUTORADIOBUTTON | NOT WS_VISIBLE | WS_GROUP,201,46,25,8 - CONTROL "Don't compress map (use this if any problems with the map occur in RA2/TS)",IDC_NOCOMPRESSION, - "Button",BS_AUTORADIOBUTTON | BS_MULTILINE | NOT WS_VISIBLE,184,62,42,13 CONTROL "Create new preview using minimap",IDC_PREVIEWMODE, - "Button",BS_AUTORADIOBUTTON | WS_GROUP,19,40,150,13 + "Button",BS_AUTORADIOBUTTON | WS_GROUP,19,40,129,13 CONTROL "Use existing preview (if possible)",IDC_EXISTINGPREVIEW, - "Button",BS_AUTORADIOBUTTON,19,53,141,12 - CONTROL "Don't save any preview",IDC_NOPREVIEW,"Button",BS_AUTORADIOBUTTON,19,66,141,12 - GROUPBOX "Compression",IDC_STATIC,119,52,107,15,NOT WS_VISIBLE - GROUPBOX "Preview",IDC_STATIC,7,29,219,56 + "Button",BS_AUTORADIOBUTTON,19,53,127,12 + CONTROL "Don't save any preview",IDC_NOPREVIEW,"Button",BS_AUTORADIOBUTTON,19,66,127,12 + GROUPBOX "Preview",IDC_STATIC,7,29,145,56 LTEXT "If you want to play the map online, you should try to make the file size as low as possible. This includes turning off the preview.",IDC_STATIC,7,143,219,21 - LTEXT "Map name:",IDC_STATIC,7,7,63,13 - EDITTEXT IDC_MAPNAME,73,7,153,12,ES_AUTOHSCROLL + LTEXT "Map name:",IDC_STATIC,7,7,41,13 + EDITTEXT IDC_MAPNAME,52,7,174,12,ES_AUTOHSCROLL CONTROL "Standard",IDC_STANDARD,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,7,89,67,14 CONTROL "Meatgrind",IDC_MEATGRIND,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,83,90,65,14 CONTROL "Naval War",IDC_NAVALWAR,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,161,90,65,14 @@ -277,6 +273,8 @@ BEGIN CONTROL "Land Rush",IDC_DUEL,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,7,121,59,14 CONTROL "Cooperative",IDC_COOPERATIVE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,83,121,70,14 CONTROL "Team Alliance",IDC_TEAMGAME,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,161,121,65,14 + LTEXT "Min players:",IDC_SAVE_OPT_MP_TXT,159,30,57,8 + EDITTEXT IDC_SAVE_OPT_M_PLAYERS,157,42,69,14,ES_AUTOHSCROLL END #endif @@ -3631,6 +3629,17 @@ BEGIN 0 END +#if defined(APSTUDIO_INVOKED) || defined(RA2_MODE) +#if defined(APSTUDIO_INVOKED) +IDD_SAVEOPTIONS$(RA2_MODE) AFX_DIALOG_LAYOUT +#else +IDD_SAVEOPTIONS AFX_DIALOG_LAYOUT +#endif +BEGIN + 0 +END +#endif + ///////////////////////////////////////////////////////////////////////////// // diff --git a/MissionEditor/SaveMapOptionsDlg.cpp b/MissionEditor/SaveMapOptionsDlg.cpp index 9891601..82bc515 100644 --- a/MissionEditor/SaveMapOptionsDlg.cpp +++ b/MissionEditor/SaveMapOptionsDlg.cpp @@ -42,7 +42,8 @@ CSaveMapOptionsDlg::CSaveMapOptionsDlg(CWnd* pParent /*=NULL*/) { //{{AFX_DATA_INIT(CSaveMapOptionsDlg) m_Compress = 1; - m_PreviewMode = 0; + m_PreviewMode = PREVIEW_MINIMAP; + m_MinPlayers = 2; m_MapName = _T(""); m_AirWar = FALSE; m_Cooperative = FALSE; @@ -56,10 +57,12 @@ CSaveMapOptionsDlg::CSaveMapOptionsDlg(CWnd* pParent /*=NULL*/) //}}AFX_DATA_INIT CIniFile& ini = Map->GetIniFile(); - if (!Map->IsMultiplayer()) - m_PreviewMode = 1; + if (!Map->IsMultiplayer()) { + m_PreviewMode = PREVIEW_DONT_CHANGE; + } m_MapName = ini.GetString("Basic", "Name"); + m_MinPlayers = ini.GetInteger("Basic", "MinPlayer"); } @@ -67,9 +70,9 @@ void CSaveMapOptionsDlg::DoDataExchange(CDataExchange* pDX) { CDialog::DoDataExchange(pDX); //{{AFX_DATA_MAP(CSaveMapOptionsDlg) - DDX_Radio(pDX, IDC_COMPRESS, m_Compress); - DDX_Radio(pDX, IDC_PREVIEWMODE, m_PreviewMode); + DDX_Radio(pDX, IDC_PREVIEWMODE, reinterpret_cast(m_PreviewMode)); DDX_Text(pDX, IDC_MAPNAME, m_MapName); + DDX_Text(pDX, IDC_SAVE_OPT_M_PLAYERS, m_MinPlayers); #ifdef RA2_MODE DDX_Check(pDX, IDC_AIRWAR, m_AirWar); DDX_Check(pDX, IDC_COOPERATIVE, m_Cooperative); @@ -119,3 +122,8 @@ BOOL CSaveMapOptionsDlg::OnInitDialog() return TRUE; // return TRUE unless you set the focus to a control // EXCEPTION: OCX-Eigenschaftenseiten sollten FALSE zurückgeben } + +void translateUI() +{ + //IDC_SAVE_OPT_MP_TXT; +} \ No newline at end of file diff --git a/MissionEditor/SaveMapOptionsDlg.h b/MissionEditor/SaveMapOptionsDlg.h index 34ef922..c1e8759 100644 --- a/MissionEditor/SaveMapOptionsDlg.h +++ b/MissionEditor/SaveMapOptionsDlg.h @@ -32,25 +32,32 @@ class CSaveMapOptionsDlg : public CDialog { - // Konstruktion public: + enum PreviewType { + PREVIEW_MINIMAP, + PREVIEW_DONT_CHANGE, + PREVIEW_STRIP, + }; + + // Konstruktion CSaveMapOptionsDlg(CWnd* pParent = NULL); // Standardkonstruktor // Dialogfelddaten //{{AFX_DATA(CSaveMapOptionsDlg) enum { IDD = IDD_SAVEOPTIONS }; - int m_Compress; - int m_PreviewMode; - CString m_MapName; - BOOL m_AirWar; - BOOL m_Cooperative; - BOOL m_Duel; - BOOL m_Meatgrind; - BOOL m_Megawealth; - BOOL m_Navalwar; - BOOL m_Nukewar; - BOOL m_Standard; - BOOL m_TeamGame; + int m_Compress; + PreviewType m_PreviewMode; + int m_MinPlayers; + CString m_MapName; + BOOL m_AirWar; + BOOL m_Cooperative; + BOOL m_Duel; + BOOL m_Meatgrind; + BOOL m_Megawealth; + BOOL m_Navalwar; + BOOL m_Nukewar; + BOOL m_Standard; + BOOL m_TeamGame; //}}AFX_DATA diff --git a/MissionEditor/resource.h b/MissionEditor/resource.h index 4603515..3aeb58b 100644 --- a/MissionEditor/resource.h +++ b/MissionEditor/resource.h @@ -620,6 +620,8 @@ #define IDC_INI_EDITOR_CONTENT 1544 #define IDC_INI_EDITOR_VAL 1545 #define IDC_INI_EDITOR_KEYS 1546 +#define IDC_SAVE_OPT_MP_TXT 1547 +#define IDC_SAVE_OPT_M_PLAYERS 1548 #define ID_FILE_OPENMAP 40001 #define ID_FILE_SAVEAS 40002 #define ID_FILE_QUIT 40003 @@ -714,9 +716,9 @@ // #ifdef APSTUDIO_INVOKED #ifndef APSTUDIO_READONLY_SYMBOLS -#define _APS_NEXT_RESOURCE_VALUE 320 +#define _APS_NEXT_RESOURCE_VALUE 321 #define _APS_NEXT_COMMAND_VALUE 40144 -#define _APS_NEXT_CONTROL_VALUE 1547 +#define _APS_NEXT_CONTROL_VALUE 1549 #define _APS_NEXT_SYMED_VALUE 111 #endif #endif