From 6192f3da1da37016d5bd35263353d4786dea7475 Mon Sep 17 00:00:00 2001 From: Glenn Maynard Date: Wed, 2 Apr 2003 21:55:54 +0000 Subject: [PATCH] Add NoteFieldPositioning. This handles translating from the origin of a note field to the position of each track. (No new functionality yet.) --- stepmania/src/Makefile.am | 2 +- stepmania/src/NoteFieldPositioning.cpp | 94 ++++++++++++++++++++++++++ stepmania/src/NoteFieldPositioning.h | 31 +++++++++ stepmania/src/StepMania.dsp | 8 +++ stepmania/src/StepMania.vcproj | 6 ++ 5 files changed, 140 insertions(+), 1 deletion(-) create mode 100644 stepmania/src/NoteFieldPositioning.cpp create mode 100644 stepmania/src/NoteFieldPositioning.h diff --git a/stepmania/src/Makefile.am b/stepmania/src/Makefile.am index e8c610c13c..8c0a265abe 100644 --- a/stepmania/src/Makefile.am +++ b/stepmania/src/Makefile.am @@ -48,7 +48,7 @@ NotesWriterDWI.cpp NotesWriterDWI.h NotesWriterSM.cpp NotesWriterSM.h NoteTypes. PlayerOptions.cpp PlayerOptions.h RandomSample.cpp RandomSample.h Song.cpp song.h SongCacheIndex.cpp SongCacheIndex.h \ SongOptions.cpp SongOptions.h StageStats.cpp StageStats.h StyleDef.cpp StyleDef.h StyleInput.h \ TitleSubstitution.cpp TitleSubstitution.h Inventory.cpp Inventory.h PlayerNumber.cpp PlayerNumber.h \ -LyricsLoader.cpp LyricsLoader.h +LyricsLoader.cpp LyricsLoader.h NoteFieldPositioning.cpp NoteFieldPositioning.h FileTypes = IniFile.cpp IniFile.h MsdFile.cpp MsdFile.h diff --git a/stepmania/src/NoteFieldPositioning.cpp b/stepmania/src/NoteFieldPositioning.cpp new file mode 100644 index 0000000000..5b4f0f00c9 --- /dev/null +++ b/stepmania/src/NoteFieldPositioning.cpp @@ -0,0 +1,94 @@ +#include "global.h" +#include "NoteFieldPositioning.h" +#include "Actor.h" +#include "RageDisplay.h" +#include "RageUtil.h" +#include "RageMath.h" +#include "RageLog.h" + + +NoteFieldPositioning::NoteFieldPositioning() +{ + /* Note: while Actor class is usually the base class of something that + * renders something to screen, all Actor itself does is store location and + * effect state and handle tweening between them. These actors do this + * without actually rendering anything; we only use them for their render + * state. */ + for( int t=0; tReset(); + } +} +/* +void NoteFieldPositioning::LoadFromFile(CString fn) +{ + Init(); + +} +*/ +void NoteFieldPositioning::LoadFromStyleDef(const StyleDef *s, PlayerNumber pn) +{ + Init(); + + for( int t=0; tm_ColumnInfo[pn][t].fXOffset; + m_Position[t]->SetX(fPixelXOffsetFromCenter); + } +} + +void NoteFieldPositioning::Update(float fDeltaTime) +{ + for( int t=0; tUpdate(fDeltaTime); + m_PerspPosition[t]->Update(fDeltaTime); + } +} + +void NoteFieldPositioning::BeginDrawTrack(int tn) +{ + m_Position[tn]->BeginDraw(); + + if(m_bPerspective[tn]) + { + DISPLAY->EnterPerspective(45); + } + +// m_PerspPosition[tn]->BeginDraw(); +} + +void NoteFieldPositioning::EndDrawTrack(int tn) +{ + m_PerspPosition[tn]->EndDraw(); + + if(m_bPerspective[tn]) + { + DISPLAY->ExitPerspective(); + } + +// m_Position[tn]->EndDraw(); +} + diff --git a/stepmania/src/NoteFieldPositioning.h b/stepmania/src/NoteFieldPositioning.h new file mode 100644 index 0000000000..3ad0773451 --- /dev/null +++ b/stepmania/src/NoteFieldPositioning.h @@ -0,0 +1,31 @@ +#ifndef NOTEFIELD_POSITIONING_H +#define NOTEFIELD_POSITIONING_H + +#include "NoteTypes.h" +#include "PlayerNumber.h" +#include "StyleDef.h" +#include "PlayerNumber.h" + +class Actor; + +class NoteFieldPositioning +{ + Actor *m_Position[MAX_NOTE_TRACKS]; + bool m_bPerspective[MAX_NOTE_TRACKS]; +// float + Actor *m_PerspPosition[MAX_NOTE_TRACKS]; + +public: + NoteFieldPositioning(); + ~NoteFieldPositioning(); + void Init(); + void Update(float fDeltaTime); + + void LoadFromFile(CString fn); + void LoadFromStyleDef(const StyleDef *s, PlayerNumber pn); + + void BeginDrawTrack(int tn); + void EndDrawTrack(int tn); +}; + +#endif diff --git a/stepmania/src/StepMania.dsp b/stepmania/src/StepMania.dsp index 980e736927..c87b8b6d41 100644 --- a/stepmania/src/StepMania.dsp +++ b/stepmania/src/StepMania.dsp @@ -553,6 +553,14 @@ SOURCE=.\TitleSubstitution.cpp SOURCE=.\TitleSubstitution.h # End Source File +# Begin Source File + +SOURCE=.\NoteFieldPositioning.cpp +# End Source File +# Begin Source File + +SOURCE=.\NoteFieldPositioning.h +# End Source File # End Group # Begin Group "File Types" diff --git a/stepmania/src/StepMania.vcproj b/stepmania/src/StepMania.vcproj index 7b1770ad02..c2a9f7e01b 100644 --- a/stepmania/src/StepMania.vcproj +++ b/stepmania/src/StepMania.vcproj @@ -590,6 +590,12 @@ cl /Zl /nologo /c verstub.cpp /Fo$(IntDir)\ + + + +