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
|
////////////////////////////////////////////////////////////////////////////////
//
// Copyright 2016 RWS Inc, All Rights Reserved
//
// This program is free software; you can redistribute it and/or modify
// it under the terms of version 2 of the GNU General Public License as published by
// the Free Software Foundation
//
// 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, write to the Free Software Foundation, Inc.,
// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
//
// MenuSettings.cpp
// Project: Nostril (aka Postal)
//
// History:
// 06/11/97 JMI Started.
//
// 07/18/97 JMI Added more menus to those scanned.
//
// 07/20/97 JMI Added menuVideoOptions, menuAudioOptions, and
// menuPlayOptions.
//
// 08/04/97 JMI Added menuRotation.
//
// 08/27/97 JMI Now section names are "Menu " instead of "Menu_" since
// RPrefs now supports spaces in vars and sections.
//
// 06/28/01 MJR Added menuChallenge.
//
//////////////////////////////////////////////////////////////////////////////
//
// Implementation for CMenuSettings object. Each instance contains settings
// for Postal.
//
//////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////
// C Headers -- Must be included before RSPiX.h b/c RSPiX utilizes SHMalloc.
//////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////
// RSPiX Headers.
///////////////////////////////////////////////////////////////////////////////
#include "RSPiX.h"
///////////////////////////////////////////////////////////////////////////////
// Postal Headers.
///////////////////////////////////////////////////////////////////////////////
#include "MenuSettings.h"
#include "menus.h"
//////////////////////////////////////////////////////////////////////////////
// Module specific macros.
//////////////////////////////////////////////////////////////////////////////
// Determines the number of elements in the passed array at compile time.
#define NUM_ELEMENTS(a) (sizeof(a) / sizeof(a[0]) )
//////////////////////////////////////////////////////////////////////////////
// Module specific typedefs.
//////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////
// Exported (extern) variables.
//////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////
// Module specific (static) variables / Instantiate class statics.
//////////////////////////////////////////////////////////////////////////////
// Items pointed to by elements of this array are the ones that are checked
// for settings.
static Menu* ms_apmenus[] =
{
&menuMain,
&menuClientGame,
&menuEditor,
&g_menuVerifyQuitGame,
&menuStart,
&menuStartSingle,
&menuStartMulti,
&menuStartDemo,
&menuChallenge,
&menuOptions,
&menuControls,
&menuKeyboard,
&menuMouse,
&menuJoystick,
&menuVerifyExit,
&menuMultiOptions,
&menuFeatures,
&menuChallenge,
&menuVolumes,
&menuVideoOptions,
&menuAudioOptions,
&menuPlayOptions,
&menuRotation,
};
//////////////////////////////////////////////////////////////////////////////
// Module specific (static) protos.
//////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////
// Functions.
//////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////
// Set settings to default values
//////////////////////////////////////////////////////////////////////////////
CMenuSettings::CMenuSettings(void)
{
}
//////////////////////////////////////////////////////////////////////////////
// Destructor
//////////////////////////////////////////////////////////////////////////////
CMenuSettings::~CMenuSettings()
{
}
//////////////////////////////////////////////////////////////////////////////
// Read settings that are stored in preference file
//////////////////////////////////////////////////////////////////////////////
int16_t CMenuSettings::LoadPrefs(
RPrefs* pPrefs)
{
int16_t sResult = 0;
// Check for entries for all our menus.
int16_t sMenu;
int16_t sMenuItem;
char szSection[256];
for (sMenu = 0; sMenu < NUM_ELEMENTS(ms_apmenus); sMenu++)
{
// Create section name.
sprintf(szSection, "Menu %s", ms_apmenus[sMenu]->menuheader.pszHeaderText);
for (sMenuItem = 0; ms_apmenus[sMenu]->ami[sMenuItem].pszText != NULL; sMenuItem++)
{
// Check for var name.
pPrefs->GetVal(
szSection, // In: Section.
ms_apmenus[sMenu]->ami[sMenuItem].pszText, // In: Var.
ms_apmenus[sMenu]->ami[sMenuItem].sEnabled, // In: Default.
&(ms_apmenus[sMenu]->ami[sMenuItem].sEnabled) ); // Out: Value.
}
}
if (!sResult)
{
if (pPrefs->IsError())
sResult = -1;
}
return sResult;
}
//////////////////////////////////////////////////////////////////////////////
// Write settings that are stored in preference file
//////////////////////////////////////////////////////////////////////////////
int16_t CMenuSettings::SavePrefs(
RPrefs* pPrefs)
{
return pPrefs->IsError();
}
//////////////////////////////////////////////////////////////////////////////
// Load settings that are stored in game file
//////////////////////////////////////////////////////////////////////////////
int16_t CMenuSettings::LoadGame(
RFile* pFile)
{
return 0;
}
//////////////////////////////////////////////////////////////////////////////
// Save settings that are stored in game file
//////////////////////////////////////////////////////////////////////////////
int16_t CMenuSettings::SaveGame(
RFile* pFile)
{
return 0;
}
//////////////////////////////////////////////////////////////////////////////
// Temporarily set settings for demo mode (file is for saving current settings)
//////////////////////////////////////////////////////////////////////////////
int16_t CMenuSettings::PreDemo(
RFile* pFile)
{
return 0;
}
//////////////////////////////////////////////////////////////////////////////
// Restore settings to what they were prior to demo mode
//////////////////////////////////////////////////////////////////////////////
int16_t CMenuSettings::PostDemo(
RFile* pFile)
{
return 0;
}
///////////////////////////////////////////////////////////////////////////////
// Internal functions.
///////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////
// EOF
///////////////////////////////////////////////////////////////////////////////
|