1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291
|
/*
* Descent 3
* Copyright (C) 2024 Parallax Software
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
--- HISTORICAL COMMENTS FOLLOW ---
* $Logfile: /DescentIII/Main/editor/PreferencesDialog.cpp $
* $Revision: 1.1.1.1 $
* $Date: 2003-08-26 03:57:38 $
* $Author: kevinb $
*
* Preferences
*
* $Log: not supported by cvs2svn $
*
* 18 4/02/99 11:32p Jeff
* able to turn off IGC in debug mode. Better handling of cinematics
* quick exit if playing via alt-p
*
* 17 3/15/99 9:24p Gwar
*
* 16 3/15/99 6:02p Jeff
* PltClearList no longer takes an arg
*
* 15 11/30/98 11:56a Jeff
* fixed bug, allowing unlimited pilots
*
* 14 9/04/98 3:16p Samir
* control whether to allow joystick slewing.
*
* 13 7/16/98 12:06p Jason
* added special flags to room structure
*
* 12 5/20/98 6:59p Samir
* added slew speed slider.
*
* 11 3/20/98 1:20p Jeff
* Hooked Default Pilot into the code and database
*
* 10 3/19/98 6:57p Jeff
* Added in a default pilot section for Preferences
*
* 9 2/14/98 10:48p Jason
* got preferred rendering working
*
* 8 8/01/97 11:59a Samir
* Added a preference for debugging in fullscreen.
*
* 7 7/25/97 4:00p Matt
* Was swapping zbuffer and bilinear filter states
*
* 6 7/24/97 3:03p Matt
* Got rid of D3EditState fields that duplicated other variables
*
* 5 7/23/97 10:18a Matt
* Cleaned up D3EditState, moving some vars in and some out, and renaming
* and changing a few others
*
* 6 6/16/97 2:34p Jason
* added 3dfx support
*
* 5 6/05/97 6:10p Jason
* added support for zbuffering and bilinear filtering
*
* 4 5/27/97 5:41p Jason
* added toggling of opengl renderer
*
* 3 5/12/97 2:50p Jason
* fixed dumb bug with 16bit mode setting
*
*
* 2 4/30/97 5:43p Jason
* added ability to toggle whether or not you want to run in 16 bit mode
*
* 1 2/05/97 11:58a Samir
*
* 2 2/05/97 11:45a Samir
* Baisc functionality for D3windowed toggle
*
* $NoKeywords: $
*/
// PreferencesDialog.cpp : implementation file
//
#include "stdafx.h"
#include "editor.h"
#include "PreferencesDialog.h"
#include "game.h"
#include "pilot.h"
#include "slew.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
extern bool Cinematics_enabled;
/////////////////////////////////////////////////////////////////////////////
// CPreferencesDialog dialog
CPreferencesDialog::CPreferencesDialog(CWnd *pParent /*=NULL*/) : CDialog(CPreferencesDialog::IDD, pParent) {
//{{AFX_DATA_INIT(CPreferencesDialog)
// NOTE: the ClassWizard will add member initialization here
//}}AFX_DATA_INIT
}
void CPreferencesDialog::DoDataExchange(CDataExchange *pDX) {
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CPreferencesDialog)
// NOTE: the ClassWizard will add DDX and DDV calls here
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(CPreferencesDialog, CDialog)
//{{AFX_MSG_MAP(CPreferencesDialog)
ON_BN_CLICKED(IDC_BILINEAR_CHECK, OnBilinearCheck)
ON_BN_CLICKED(IDC_WINDOWED, OnWindowed)
ON_BN_CLICKED(IDC_FULLSCREEN_HW, OnFullScreenHW)
ON_BN_CLICKED(IDC_FULLSCREEN_SW, OnFullScreenSW)
ON_BN_CLICKED(IDC_MIPPING_CHECK, OnMippingCheck)
ON_BN_CLICKED(IDC_IGC_ENABLED, OnIgcEnabled)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CPreferencesDialog message handlers
#define GET_CHECK(id) (((CButton *)GetDlgItem(id))->GetCheck() != 0)
void CPreferencesDialog::OnOK() {
CSliderCtrl *slew_slider = (CSliderCtrl *)GetDlgItem(IDC_SLEWSLIDER);
bool joyslew;
if (GET_CHECK(IDC_WINDOWED))
D3EditState.game_render_mode = GM_WINDOWED;
else if (GET_CHECK(IDC_FULLSCREEN_SW))
D3EditState.game_render_mode = GM_FULLSCREEN_SW;
else if (GET_CHECK(IDC_FULLSCREEN_HW))
D3EditState.game_render_mode = GM_FULLSCREEN_HW;
else
Int3(); // unknown game render mode
// Do we want fullscreen debug mode?
if (GET_CHECK(IDC_DEBUG_CHECK))
D3EditState.fullscreen_debug_state = true;
else
D3EditState.fullscreen_debug_state = false;
if (GET_CHECK(IDC_USE_OPENGL))
PreferredRenderer = RENDERER_OPENGL;
else if (GET_CHECK(IDC_USE_GLIDE))
PreferredRenderer = RENDERER_GLIDE;
else if (GET_CHECK(IDC_USE_D3D))
PreferredRenderer = RENDERER_DIRECT3D;
else
Int3(); // unknown hardware renderer
joyslew = (GET_CHECK(IDC_JOYENABLE)) ? true : false;
if (joyslew != D3EditState.joy_slewing) {
D3EditState.joy_slewing = joyslew;
SlewControlInit();
}
Render_preferred_state.filtering = GET_CHECK(IDC_BILINEAR_CHECK);
Render_preferred_state.mipping = GET_CHECK(IDC_MIPPING_CHECK);
CComboBox *combo = (CComboBox *)GetDlgItem(IDC_DEFAULT_PILOT);
if (combo->GetCount()) {
combo->GetLBText(combo->GetCurSel(), Default_pilot);
} else {
strcpy(Default_pilot, " ");
}
Slew_key_speed = (slew_slider->GetPos() * 0.5) + 0.5;
CDialog::OnOK();
}
BOOL CPreferencesDialog::OnInitDialog() {
CDialog::OnInitDialog();
char **pilotlist;
int pilot_count;
// TODO: Add extra initialization here
CSliderCtrl *slew_slider = (CSliderCtrl *)GetDlgItem(IDC_SLEWSLIDER);
((CButton *)GetDlgItem(IDC_WINDOWED))->SetCheck(D3EditState.game_render_mode == GM_WINDOWED);
((CButton *)GetDlgItem(IDC_FULLSCREEN_SW))->SetCheck(D3EditState.game_render_mode == GM_FULLSCREEN_SW);
((CButton *)GetDlgItem(IDC_FULLSCREEN_HW))->SetCheck(D3EditState.game_render_mode == GM_FULLSCREEN_HW);
((CButton *)GetDlgItem(IDC_DEBUG_CHECK))->SetCheck(D3EditState.fullscreen_debug_state);
((CButton *)GetDlgItem(IDC_USE_OPENGL))->SetCheck(PreferredRenderer == RENDERER_OPENGL);
((CButton *)GetDlgItem(IDC_USE_GLIDE))->SetCheck(PreferredRenderer == RENDERER_GLIDE);
((CButton *)GetDlgItem(IDC_USE_D3D))->SetCheck(PreferredRenderer == RENDERER_DIRECT3D);
((CButton *)GetDlgItem(IDC_BILINEAR_CHECK))->SetCheck(Render_preferred_state.filtering);
((CButton *)GetDlgItem(IDC_MIPPING_CHECK))->SetCheck(Render_preferred_state.mipping);
((CButton *)GetDlgItem(IDC_JOYENABLE))->SetCheck(D3EditState.joy_slewing);
((CButton *)GetDlgItem(IDC_IGC_ENABLED))->SetCheck(Cinematics_enabled);
slew_slider->SetRange(0, 3);
slew_slider->SetPos((Slew_key_speed - 0.5) / 0.5);
CComboBox *combo = (CComboBox *)GetDlgItem(IDC_DEFAULT_PILOT);
combo->ResetContent();
pilotlist = PltGetPilots(&pilot_count);
for (int i = 0; i < pilot_count; i++) {
combo->AddString(pilotlist[i]);
}
if (pilot_count) {
combo->SelectString(-1, Default_pilot);
}
PltClearList();
if (D3EditState.game_render_mode == GM_FULLSCREEN_HW)
EnableHardwareOptions();
else
DisableHardwareOptions();
PltGetPilotsFree();
return TRUE; // return TRUE unless you set the focus to a control
// EXCEPTION: OCX Property Pages should return FALSE
}
void CPreferencesDialog::OnBilinearCheck() {
// TODO: Add your control notification handler code here
}
void CPreferencesDialog::DisableHardwareOptions() {
((CButton *)GetDlgItem(IDC_HARDWARE_ACC))->EnableWindow(0);
((CButton *)GetDlgItem(IDC_USE_OPENGL))->EnableWindow(0);
((CButton *)GetDlgItem(IDC_USE_GLIDE))->EnableWindow(0);
((CButton *)GetDlgItem(IDC_USE_D3D))->EnableWindow(0);
((CButton *)GetDlgItem(IDC_BILINEAR_CHECK))->EnableWindow(0);
((CButton *)GetDlgItem(IDC_MIPPING_CHECK))->EnableWindow(0);
}
void CPreferencesDialog::EnableHardwareOptions() {
((CButton *)GetDlgItem(IDC_HARDWARE_ACC))->EnableWindow(1);
((CButton *)GetDlgItem(IDC_USE_OPENGL))->EnableWindow(1);
((CButton *)GetDlgItem(IDC_USE_GLIDE))->EnableWindow(1);
((CButton *)GetDlgItem(IDC_USE_D3D))->EnableWindow(1);
((CButton *)GetDlgItem(IDC_BILINEAR_CHECK))->EnableWindow(1);
((CButton *)GetDlgItem(IDC_MIPPING_CHECK))->EnableWindow(1);
}
void CPreferencesDialog::OnWindowed() {
if (((CButton *)GetDlgItem(IDC_WINDOWED))->GetCheck())
DisableHardwareOptions();
else
EnableHardwareOptions();
}
void CPreferencesDialog::OnFullScreenSW() {
if (((CButton *)GetDlgItem(IDC_FULLSCREEN_SW))->GetCheck())
DisableHardwareOptions();
else
EnableHardwareOptions();
}
void CPreferencesDialog::OnFullScreenHW() {
if (((CButton *)GetDlgItem(IDC_FULLSCREEN_HW))->GetCheck())
EnableHardwareOptions();
else
DisableHardwareOptions();
}
void CPreferencesDialog::OnMippingCheck() {
// TODO: Add your control notification handler code here
}
void CPreferencesDialog::OnIgcEnabled() {
CButton *button = (CButton *)GetDlgItem(IDC_IGC_ENABLED);
Cinematics_enabled = (bool)(button->GetCheck() != 0);
}
|