update
add clip plane control fix INI silliness
This commit is contained in:
@@ -225,8 +225,11 @@ void NoteField::DrawPrimitives()
|
|||||||
fDrawScale *= 1 + 0.5f * fabsf( GAMESTATE->m_PlayerOptions[m_PlayerNumber].m_fPerspectiveTilt );
|
fDrawScale *= 1 + 0.5f * fabsf( GAMESTATE->m_PlayerOptions[m_PlayerNumber].m_fPerspectiveTilt );
|
||||||
fDrawScale *= 1 + fabsf( GAMESTATE->m_PlayerOptions[m_PlayerNumber].m_fEffects[PlayerOptions::EFFECT_MINI] );
|
fDrawScale *= 1 + fabsf( GAMESTATE->m_PlayerOptions[m_PlayerNumber].m_fEffects[PlayerOptions::EFFECT_MINI] );
|
||||||
|
|
||||||
iFirstPixelToDraw = (int)(iFirstPixelToDraw * fDrawScale);
|
float fFirstDrawScale = g_NoteFieldMode[m_PlayerNumber].m_fFirstPixelToDrawScale;
|
||||||
iLastPixelToDraw = (int)(iLastPixelToDraw * fDrawScale);
|
float fLastDrawScale = g_NoteFieldMode[m_PlayerNumber].m_fLastPixelToDrawScale;
|
||||||
|
|
||||||
|
iFirstPixelToDraw = (int)(iFirstPixelToDraw * fFirstDrawScale * fDrawScale);
|
||||||
|
iLastPixelToDraw = (int)(iLastPixelToDraw * fLastDrawScale * fDrawScale);
|
||||||
|
|
||||||
|
|
||||||
// CPU OPTIMIZATION OPPORTUNITY:
|
// CPU OPTIMIZATION OPPORTUNITY:
|
||||||
|
|||||||
@@ -19,6 +19,8 @@ NoteFieldMode g_NoteFieldMode[NUM_PLAYERS];
|
|||||||
NoteFieldMode::NoteFieldMode()
|
NoteFieldMode::NoteFieldMode()
|
||||||
{
|
{
|
||||||
m_fFov = 0;
|
m_fFov = 0;
|
||||||
|
m_fNear = 5;
|
||||||
|
m_fFar = 1000;
|
||||||
m_fFirstPixelToDrawScale = m_fLastPixelToDrawScale = 1.0f;
|
m_fFirstPixelToDrawScale = m_fLastPixelToDrawScale = 1.0f;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -34,7 +36,7 @@ void NoteFieldMode::BeginDrawTrack(int tn)
|
|||||||
m_CenterTrack[tn].BeginDraw();
|
m_CenterTrack[tn].BeginDraw();
|
||||||
|
|
||||||
if(m_fFov)
|
if(m_fFov)
|
||||||
DISPLAY->EnterPerspective(m_fFov);
|
DISPLAY->EnterPerspective(m_fFov, true, m_fNear, m_fFar);
|
||||||
|
|
||||||
m_Position.BeginDraw();
|
m_Position.BeginDraw();
|
||||||
if(tn == -1)
|
if(tn == -1)
|
||||||
@@ -61,58 +63,46 @@ void NoteFieldMode::EndDrawTrack(int tn)
|
|||||||
DISPLAY->PopMatrix();
|
DISPLAY->PopMatrix();
|
||||||
}
|
}
|
||||||
|
|
||||||
NoteFieldPositioning::NoteFieldPositioning(CString fn)
|
static bool GetValueCmd(IniFile &ini,
|
||||||
|
const CString &key, const CString &valuename, Actor &value )
|
||||||
{
|
{
|
||||||
IniFile ini(fn);
|
CString str;
|
||||||
if(!ini.ReadFile())
|
if(!ini.GetValue(key, valuename, str))
|
||||||
return;
|
return false;
|
||||||
|
|
||||||
for(IniFile::const_iterator i = ini.begin(); i != ini.end(); ++i)
|
value.Command(str);
|
||||||
{
|
return true;
|
||||||
NoteFieldMode m;
|
}
|
||||||
|
|
||||||
const IniFile::key &k = i->second;
|
void NoteFieldMode::Load(IniFile &ini, CString id)
|
||||||
IniFile::key::const_iterator val;
|
{
|
||||||
|
m_Id = id;
|
||||||
|
|
||||||
val = k.find("Name");
|
/* Required: */
|
||||||
ASSERT(val != k.end()); /* required */
|
ASSERT( ini.GetValue ( id, "Name", m_Name ) );
|
||||||
m.name = val->second;
|
|
||||||
|
|
||||||
val = k.find("Backdrop");
|
ini.GetValue ( id, "Backdrop", m_Backdrop );
|
||||||
if(val != k.end())
|
ini.GetValueF( id, "FOV", m_fFov );
|
||||||
m.Backdrop = val->second;
|
ini.GetValueF( id, "NearClipDistance", m_fNear );
|
||||||
|
ini.GetValueF( id, "FarClipDistance", m_fFar );
|
||||||
|
ini.GetValueF( id, "PixelsDrawAheadScale", m_fFirstPixelToDrawScale );
|
||||||
|
ini.GetValueF( id, "PixelsDrawBehindScale", m_fLastPixelToDrawScale );
|
||||||
|
|
||||||
val = k.find("Center");
|
GetValueCmd( ini, id, "Center", m_Center );
|
||||||
if(val != k.end())
|
GetValueCmd( ini, id, "Position", m_Position );
|
||||||
m.m_Center.Command(val->second);
|
GetValueCmd( ini, id, "BackdropPosition", m_PositionBackdrop );
|
||||||
|
|
||||||
val = k.find("FOV");
|
|
||||||
if(val != k.end())
|
|
||||||
m.m_fFov = float(atof(val->second.c_str()));
|
|
||||||
|
|
||||||
val = k.find("Position");
|
|
||||||
if(val != k.end())
|
|
||||||
m.m_Position.Command(val->second);
|
|
||||||
|
|
||||||
val = k.find("BackdropPosition");
|
|
||||||
if(val != k.end())
|
|
||||||
m.m_PositionBackdrop.Command(val->second);
|
|
||||||
|
|
||||||
for(int t = 0; t < MAX_NOTE_TRACKS; ++t)
|
for(int t = 0; t < MAX_NOTE_TRACKS; ++t)
|
||||||
{
|
{
|
||||||
val = k.find(ssprintf("Center%i", t+1));
|
GetValueCmd( ini, id, ssprintf("Center%i", t+1), m_CenterTrack[t] );
|
||||||
if(val != k.end())
|
GetValueCmd( ini, id, ssprintf("Position%i", t+1), m_PositionTrack[t] );
|
||||||
m.m_CenterTrack[t].Command(val->second);
|
}
|
||||||
val = k.find(ssprintf("Position%i", t+1));
|
|
||||||
if(val != k.end())
|
|
||||||
m.m_PositionTrack[t].Command(val->second);
|
|
||||||
|
|
||||||
CString sGames;
|
CString sGames;
|
||||||
val = k.find("Games");
|
if(ini.GetValue( id, "Games", sGames ))
|
||||||
if(val != k.end())
|
|
||||||
{
|
{
|
||||||
vector<CString> games;
|
vector<CString> games;
|
||||||
split(val->second, ",", games);
|
split(sGames, ",", games);
|
||||||
for(unsigned n = 0; n < games.size(); ++n)
|
for(unsigned n = 0; n < games.size(); ++n)
|
||||||
{
|
{
|
||||||
vector<CString> bits;
|
vector<CString> bits;
|
||||||
@@ -124,10 +114,22 @@ NoteFieldPositioning::NoteFieldPositioning(CString fn)
|
|||||||
|
|
||||||
const Style style = GAMEMAN->GameAndStringToStyle( game, bits[1] );
|
const Style style = GAMEMAN->GameAndStringToStyle( game, bits[1] );
|
||||||
ASSERT(style != STYLE_INVALID);
|
ASSERT(style != STYLE_INVALID);
|
||||||
m.Styles.insert(style );
|
Styles.insert(style);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
NoteFieldPositioning::NoteFieldPositioning(CString fn)
|
||||||
|
{
|
||||||
|
m_Filename = fn;
|
||||||
|
IniFile ini(fn);
|
||||||
|
if(!ini.ReadFile())
|
||||||
|
return;
|
||||||
|
|
||||||
|
for(IniFile::const_iterator i = ini.begin(); i != ini.end(); ++i)
|
||||||
|
{
|
||||||
|
NoteFieldMode m;
|
||||||
|
m.Load(ini, i->first);
|
||||||
|
|
||||||
Modes.push_back(m);
|
Modes.push_back(m);
|
||||||
}
|
}
|
||||||
@@ -147,26 +149,30 @@ bool NoteFieldMode::MatchesCurrentGame() const
|
|||||||
void NoteFieldPositioning::Load(PlayerNumber pn)
|
void NoteFieldPositioning::Load(PlayerNumber pn)
|
||||||
{
|
{
|
||||||
NoteFieldMode &mode = g_NoteFieldMode[pn];
|
NoteFieldMode &mode = g_NoteFieldMode[pn];
|
||||||
const int ModeNum = GetID(GAMESTATE->m_PlayerOptions[pn].m_sPositioning);
|
|
||||||
if(ModeNum != -1)
|
|
||||||
{
|
|
||||||
/* We have a custom mode; copy it. */
|
|
||||||
mode = Modes[ModeNum];
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* No transformation is enabled, so use the one defined in the style
|
|
||||||
* table. */
|
|
||||||
mode = NoteFieldMode(); /* reset */
|
mode = NoteFieldMode(); /* reset */
|
||||||
|
|
||||||
const StyleDef *s = GAMESTATE->GetCurrentStyleDef();
|
const StyleDef *s = GAMESTATE->GetCurrentStyleDef();
|
||||||
|
|
||||||
/* Set the m_PositionTrack[] value for each track. */
|
/* Load the settings in the style table by default. */
|
||||||
for(int tn = 0; tn < MAX_NOTE_TRACKS; ++tn)
|
for(int tn = 0; tn < MAX_NOTE_TRACKS; ++tn)
|
||||||
{
|
{
|
||||||
const float fPixelXOffsetFromCenter = s->m_ColumnInfo[pn][tn].fXOffset;
|
const float fPixelXOffsetFromCenter = s->m_ColumnInfo[pn][tn].fXOffset;
|
||||||
mode.m_PositionTrack[tn].SetX(fPixelXOffsetFromCenter);
|
mode.m_PositionTrack[tn].SetX(fPixelXOffsetFromCenter);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Is there a custom mode with the current name that fits the current game? */
|
||||||
|
const int ModeNum = GetID(GAMESTATE->m_PlayerOptions[pn].m_sPositioning);
|
||||||
|
if(ModeNum == -1)
|
||||||
|
return; /* No, only use the style table settings. */
|
||||||
|
|
||||||
|
/* We have a custom mode. Reload the mode on top of the default style
|
||||||
|
* table settings. */
|
||||||
|
IniFile ini(m_Filename);
|
||||||
|
if(!ini.ReadFile())
|
||||||
|
return;
|
||||||
|
|
||||||
|
mode.Load(ini, Modes[ModeNum].m_Id);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -176,7 +182,7 @@ int NoteFieldPositioning::GetID(const CString &name) const
|
|||||||
{
|
{
|
||||||
for(unsigned i = 0; i < Modes.size(); ++i)
|
for(unsigned i = 0; i < Modes.size(); ++i)
|
||||||
{
|
{
|
||||||
if(Modes[i].name.CompareNoCase(name))
|
if(Modes[i].m_Name.CompareNoCase(name))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if(!Modes[i].MatchesCurrentGame())
|
if(!Modes[i].MatchesCurrentGame())
|
||||||
@@ -198,6 +204,6 @@ void NoteFieldPositioning::GetNamesForCurrentGame(vector<CString> &IDs)
|
|||||||
if(!Modes[i].MatchesCurrentGame())
|
if(!Modes[i].MatchesCurrentGame())
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
IDs.push_back(Modes[i].name);
|
IDs.push_back(Modes[i].m_Name);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -9,27 +9,36 @@
|
|||||||
|
|
||||||
#include <set>
|
#include <set>
|
||||||
|
|
||||||
|
class IniFile;
|
||||||
|
|
||||||
struct NoteFieldMode
|
struct NoteFieldMode
|
||||||
{
|
{
|
||||||
NoteFieldMode();
|
NoteFieldMode();
|
||||||
bool MatchesCurrentGame() const;
|
bool MatchesCurrentGame() const;
|
||||||
|
void Load(IniFile &ini, CString id);
|
||||||
|
|
||||||
void BeginDrawTrack(int tn);
|
void BeginDrawTrack(int tn);
|
||||||
void EndDrawTrack(int tn);
|
void EndDrawTrack(int tn);
|
||||||
|
|
||||||
CString name;
|
/* Visual name. */
|
||||||
|
CString m_Name;
|
||||||
|
|
||||||
|
/* Unique ID from the INI. */
|
||||||
|
CString m_Id;
|
||||||
|
|
||||||
|
/* Styles that this is valid for; empty means all. */
|
||||||
set<Style> Styles;
|
set<Style> Styles;
|
||||||
|
|
||||||
Actor m_Center;
|
Actor m_Center;
|
||||||
Actor m_CenterTrack[MAX_NOTE_TRACKS];
|
Actor m_CenterTrack[MAX_NOTE_TRACKS];
|
||||||
|
|
||||||
/* 0 = no perspective */
|
/* 0 = no perspective */
|
||||||
float m_fFov;
|
float m_fFov, m_fNear, m_fFar;
|
||||||
Actor m_Position;
|
Actor m_Position;
|
||||||
Actor m_PositionTrack[MAX_NOTE_TRACKS];
|
Actor m_PositionTrack[MAX_NOTE_TRACKS];
|
||||||
|
|
||||||
float m_fFirstPixelToDrawScale, m_fLastPixelToDrawScale;
|
float m_fFirstPixelToDrawScale, m_fLastPixelToDrawScale;
|
||||||
CString Backdrop;
|
CString m_Backdrop;
|
||||||
Actor m_PositionBackdrop;
|
Actor m_PositionBackdrop;
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -42,6 +51,7 @@ public:
|
|||||||
void GetNamesForCurrentGame(vector<CString> &IDs);
|
void GetNamesForCurrentGame(vector<CString> &IDs);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
CString m_Filename;
|
||||||
vector<NoteFieldMode> Modes;
|
vector<NoteFieldMode> Modes;
|
||||||
int GetID(const CString &name) const;
|
int GetID(const CString &name) const;
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -139,7 +139,7 @@ void Player::Load( PlayerNumber pn, NoteData* pNoteData, LifeMeter* pLM, ScoreDi
|
|||||||
int iStopDrawingAtPixels = GAMESTATE->m_bEditing ? 400 : STOP_DRAWING_AT_PIXELS;
|
int iStopDrawingAtPixels = GAMESTATE->m_bEditing ? 400 : STOP_DRAWING_AT_PIXELS;
|
||||||
|
|
||||||
m_ArrowBackdrop.Unload();
|
m_ArrowBackdrop.Unload();
|
||||||
CString BackdropName = g_NoteFieldMode[pn].Backdrop;
|
CString BackdropName = g_NoteFieldMode[pn].m_Backdrop;
|
||||||
if( !BackdropName.empty() )
|
if( !BackdropName.empty() )
|
||||||
m_ArrowBackdrop.LoadFromAniDir( THEME->GetPathToB( BackdropName ) );
|
m_ArrowBackdrop.LoadFromAniDir( THEME->GetPathToB( BackdropName ) );
|
||||||
m_NoteField.Load( (NoteData*)this, pn, iStartDrawingAtPixels, iStopDrawingAtPixels );
|
m_NoteField.Load( (NoteData*)this, pn, iStartDrawingAtPixels, iStopDrawingAtPixels );
|
||||||
|
|||||||
Reference in New Issue
Block a user