2012-11-26 18:58:24 +00:00
|
|
|
/*
|
|
|
|
===========================================================================
|
|
|
|
|
|
|
|
Doom 3 BFG Edition GPL Source Code
|
2012-11-28 15:47:07 +00:00
|
|
|
Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company.
|
2012-11-26 18:58:24 +00:00
|
|
|
|
2012-11-28 15:47:07 +00:00
|
|
|
This file is part of the Doom 3 BFG Edition GPL Source Code ("Doom 3 BFG Edition Source Code").
|
2012-11-26 18:58:24 +00:00
|
|
|
|
|
|
|
Doom 3 BFG Edition Source Code 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.
|
|
|
|
|
|
|
|
Doom 3 BFG Edition Source Code 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 Doom 3 BFG Edition Source Code. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
|
|
|
|
In addition, the Doom 3 BFG Edition Source Code is also subject to certain additional terms. You should have received a copy of these additional terms immediately following the terms and conditions of the GNU General Public License which accompanied the Doom 3 BFG Edition Source Code. If not, please request a copy in writing from id Software at the address below.
|
|
|
|
|
|
|
|
If you have questions concerning this license or the applicable additional terms, you may contact in writing id Software LLC, c/o ZeniMax Media Inc., Suite 120, Rockville, Maryland 20850 USA.
|
|
|
|
|
|
|
|
===========================================================================
|
|
|
|
*/
|
|
|
|
#ifndef __PLAYERPROFILE_H__
|
|
|
|
#define __PLAYERPROFILE_H__
|
|
|
|
|
|
|
|
#define MAX_PROFILE_SIZE ( 1024 * 1000 ) // High number for the key bindings
|
|
|
|
|
|
|
|
/*
|
|
|
|
================================================
|
2012-11-28 15:47:07 +00:00
|
|
|
profileStatValue_t
|
2012-11-26 18:58:24 +00:00
|
|
|
================================================
|
|
|
|
*/
|
2012-11-28 15:47:07 +00:00
|
|
|
union profileStatValue_t
|
|
|
|
{
|
|
|
|
int i;
|
2012-11-26 18:58:24 +00:00
|
|
|
float f;
|
|
|
|
};
|
|
|
|
|
|
|
|
/*
|
|
|
|
================================================
|
|
|
|
idPlayerProfile
|
|
|
|
|
|
|
|
The general rule for using cvars for settings is that if you want the player's profile settings to affect the startup
|
|
|
|
of the game before there is a player associated with the game, use cvars. Example: video & volume settings.
|
|
|
|
================================================
|
|
|
|
*/
|
2012-11-28 15:47:07 +00:00
|
|
|
class idPlayerProfile
|
|
|
|
{
|
2012-11-26 18:58:24 +00:00
|
|
|
friend class idLocalUser;
|
|
|
|
friend class idProfileMgr;
|
2012-11-28 15:47:07 +00:00
|
|
|
|
|
|
|
public:
|
2012-11-26 18:58:24 +00:00
|
|
|
// Only have room to squeeze ~450 in doom3 right now
|
|
|
|
static const int MAX_PLAYER_PROFILE_STATS = 200;
|
2012-11-28 15:47:07 +00:00
|
|
|
|
|
|
|
enum state_t
|
|
|
|
{
|
2012-11-26 18:58:24 +00:00
|
|
|
IDLE = 0,
|
|
|
|
SAVING,
|
|
|
|
LOADING,
|
|
|
|
SAVE_REQUESTED,
|
|
|
|
LOAD_REQUESTED,
|
|
|
|
ERR
|
|
|
|
};
|
|
|
|
protected:
|
2012-11-28 15:47:07 +00:00
|
|
|
idPlayerProfile(); // don't instantiate. we static_cast the child all over the place
|
2012-11-26 18:58:24 +00:00
|
|
|
public:
|
|
|
|
|
|
|
|
virtual ~idPlayerProfile();
|
2012-11-28 15:47:07 +00:00
|
|
|
|
|
|
|
static idPlayerProfile* CreatePlayerProfile( int deviceIndex );
|
|
|
|
|
2012-11-26 18:58:24 +00:00
|
|
|
void SetDefaults();
|
2012-11-28 15:47:07 +00:00
|
|
|
bool Serialize( idSerializer& ser );
|
|
|
|
|
|
|
|
const int GetDeviceNumForProfile() const
|
|
|
|
{
|
|
|
|
return deviceNum;
|
|
|
|
}
|
|
|
|
void SetDeviceNumForProfile( int num )
|
|
|
|
{
|
|
|
|
deviceNum = num;
|
|
|
|
}
|
2012-11-26 18:58:24 +00:00
|
|
|
void SaveSettings( bool forceDirty );
|
|
|
|
void LoadSettings();
|
2012-11-28 15:47:07 +00:00
|
|
|
state_t GetState() const
|
|
|
|
{
|
|
|
|
return state;
|
|
|
|
}
|
|
|
|
state_t GetRequestedState() const
|
|
|
|
{
|
|
|
|
return requestedState;
|
|
|
|
}
|
|
|
|
bool IsDirty()
|
|
|
|
{
|
|
|
|
return dirty;
|
|
|
|
}
|
|
|
|
|
2012-11-26 18:58:24 +00:00
|
|
|
bool GetAchievement( const int id ) const;
|
|
|
|
void SetAchievement( const int id );
|
|
|
|
void ClearAchievement( const int id );
|
2012-11-28 15:47:07 +00:00
|
|
|
|
|
|
|
int GetDlcReleaseVersion() const
|
|
|
|
{
|
|
|
|
return dlcReleaseVersion;
|
|
|
|
}
|
|
|
|
void SetDlcReleaseVersion( int version )
|
|
|
|
{
|
|
|
|
dlcReleaseVersion = version;
|
|
|
|
}
|
|
|
|
|
|
|
|
int GetLevel() const
|
|
|
|
{
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2012-11-26 18:58:24 +00:00
|
|
|
//------------------------
|
|
|
|
// Config
|
|
|
|
//------------------------
|
2012-11-28 15:47:07 +00:00
|
|
|
int GetConfig() const
|
|
|
|
{
|
|
|
|
return configSet;
|
|
|
|
}
|
2012-11-26 18:58:24 +00:00
|
|
|
void SetConfig( int config, bool save );
|
|
|
|
void RestoreDefault();
|
2012-11-28 15:47:07 +00:00
|
|
|
|
2012-11-26 18:58:24 +00:00
|
|
|
void SetLeftyFlip( bool lf );
|
2012-11-28 15:47:07 +00:00
|
|
|
bool GetLeftyFlip() const
|
|
|
|
{
|
|
|
|
return leftyFlip;
|
|
|
|
}
|
|
|
|
|
2012-11-26 18:58:24 +00:00
|
|
|
private:
|
|
|
|
void StatSetInt( int s, int v );
|
|
|
|
void StatSetFloat( int s, float v );
|
|
|
|
int StatGetInt( int s ) const;
|
|
|
|
float StatGetFloat( int s ) const;
|
2012-11-28 15:47:07 +00:00
|
|
|
void SetState( state_t value )
|
|
|
|
{
|
|
|
|
state = value;
|
|
|
|
}
|
|
|
|
void SetRequestedState( state_t value )
|
|
|
|
{
|
|
|
|
requestedState = value;
|
|
|
|
}
|
|
|
|
void MarkDirty( bool isDirty )
|
|
|
|
{
|
|
|
|
dirty = isDirty;
|
|
|
|
}
|
|
|
|
|
2012-11-26 18:58:24 +00:00
|
|
|
void ExecConfig( bool save = false, bool forceDefault = false );
|
2012-11-28 15:47:07 +00:00
|
|
|
|
2012-11-26 18:58:24 +00:00
|
|
|
protected:
|
|
|
|
// Do not save:
|
|
|
|
state_t state;
|
|
|
|
state_t requestedState;
|
|
|
|
int deviceNum;
|
2012-11-28 15:47:07 +00:00
|
|
|
|
2012-11-26 18:58:24 +00:00
|
|
|
// Save:
|
|
|
|
uint64 achievementBits;
|
|
|
|
uint64 achievementBits2;
|
|
|
|
int dlcReleaseVersion;
|
|
|
|
int configSet;
|
|
|
|
bool customConfig;
|
|
|
|
bool leftyFlip;
|
2012-11-28 15:47:07 +00:00
|
|
|
|
2012-11-26 18:58:24 +00:00
|
|
|
bool dirty; // dirty bit to indicate whether or not we need to save
|
2012-11-28 15:47:07 +00:00
|
|
|
|
2012-11-26 18:58:24 +00:00
|
|
|
idStaticList< profileStatValue_t, MAX_PLAYER_PROFILE_STATS > stats;
|
|
|
|
};
|
|
|
|
|
|
|
|
#endif
|