comment/cleanup

This commit is contained in:
AJ Kelly
2010-07-17 02:33:13 -05:00
parent 7d36a60cff
commit eb504b5963
6 changed files with 53 additions and 63 deletions
+1 -1
View File
@@ -660,7 +660,7 @@ void NoteData::LoadTransformed( const NoteData& in, int iNewNumTracks, const int
{
// reset all notes
Init();
SetNumTracks( iNewNumTracks );
// copy tracks
+18 -18
View File
@@ -11,15 +11,15 @@ class XNode;
struct TapNoteResult
{
TapNoteResult() : tns(TNS_None), fTapNoteOffset(0.f), bHidden(false) { }
TapNoteScore tns;
/* Offset, in seconds, for a tap grade. Negative numbers mean the note
* was hit early; positive numbers mean it was hit late. These values are
/* Offset, in seconds, for a tap grade. Negative numbers mean the note
* was hit early; positive numbers mean it was hit late. These values are
* only meaningful for graded taps (tns >= TNS_W5). */
float fTapNoteOffset;
/* If the whole row has been judged, all taps on the row will be set to hidden. */
// If the whole row has been judged, all taps on the row will be set to hidden.
bool bHidden;
// XML
@@ -31,7 +31,7 @@ struct HoldNoteResult
{
HoldNoteResult() : hns(HNS_None), fLife(1.f), fOverlappedTime(0), iLastHeldRow(0), iCheckpointsHit(0), iCheckpointsMissed(0), bHeld(false), bActive(false) { }
float GetLastHeldBeat() const;
HoldNoteScore hns;
/* 1.0 means this HoldNote has full life.
@@ -40,15 +40,15 @@ struct HoldNoteResult
* If the life is > 0.0 when the HoldNote ends, then m_HoldScore becomes HNS_Held. */
float fLife;
/* The number of seconds the hold note has overlapped the current beat, or 0 if it
* doesn't overlap. */
/* The number of seconds the hold note has overlapped the current beat, or 0
* if it doesn't overlap. */
float fOverlappedTime;
/* Last index where fLife was greater than 0. If the tap was missed, this will
* be the first index of the hold. */
/* Last index where fLife was greater than 0. If the tap was missed, this
* will be the first index of the hold. */
int iLastHeldRow;
/* If checkpoint holds are enabled, the number of checkpoints hit and missed. */
// If checkpoint holds are enabled, the number of checkpoints hit and missed.
int iCheckpointsHit;
int iCheckpointsMissed;
@@ -98,16 +98,16 @@ struct TapNote
TapNoteResult result;
int8_t iMidiNote; // ignored by all game types but Karaoke
PlayerNumber pn; // used in routine mode
bool bHopoPossible; // set just before gameplay begins
bool bHopoPossible; // set just before gameplay begins
RString sAttackModifiers; // used only if Type == attack
float fAttackDurationSeconds; // used only if Type == attack
int iKeysoundIndex; // Index into Song's vector of keysound files if nonnegative.
int iDuration; // used if hold_head only
HoldNoteResult HoldResult; // used if hold_head only
int iDuration; // used if hold_head only
HoldNoteResult HoldResult; // used if hold_head only
// XML
XNode* CreateNode() const;
void LoadFromNode( const XNode* pNode );
@@ -180,11 +180,11 @@ extern TapNote TAP_ADDITION_MINE;
// TODO: Don't have a hard-coded track limit.
const int MAX_NOTE_TRACKS = 16;
/* This is a divisor for our "fixed-point" time/beat representation. It must be evenly divisible
* by 2, 3, and 4, to exactly represent 8th, 12th and 16th notes. */
/* This is a divisor for our "fixed-point" time/beat representation. It must be
* evenly divisible by 2, 3, and 4, to exactly represent 8th, 12th and 16th notes. */
const int ROWS_PER_BEAT = 48;
/* In the editor, enforce a reasonable limit on the number of notes. */
// In the editor, enforce a reasonable limit on the number of notes.
const int MAX_NOTES_PER_MEASURE = 50;
+1 -1
View File
@@ -1,4 +1,4 @@
/* ScreenEvaluation - Shows the user their score after gameplay has ended. */
/* ScreenEvaluation - Shows the player their score after gameplay has ended. */
#ifndef SCREEN_EVALUATION_H
#define SCREEN_EVALUATION_H
+4 -4
View File
@@ -7,9 +7,9 @@
#include "RageLog.h"
#include "arch/ArchHooks/ArchHooks.h"
/* This screen used to wait for sounds to stop. However, implementing GetPlayingSounds()
/* This screen used to wait for sounds to stop. However, implementing GetPlayingSounds()
* is annoying, because sounds might be deleted at any time; they aren't ours to have
* references to. Also, it's better to quit on command instead of waiting several seconds
* references to. Also, it's better to quit on command instead of waiting several seconds
* for a sound to stop. */
REGISTER_SCREEN_CLASS( ScreenExit );
@@ -22,7 +22,7 @@ void ScreenExit::Init()
ArchHooks::SetUserQuit();
/* It'd be better for any previous screen playing music to fade it out as it fades
* out the screen. XXX: Check to see if it's fading out; if it'll stop playing in
* out the screen. XXX: Check to see if it's fading out; if it'll stop playing in
* reasonable time, let it. */
// SOUND->StopMusic();
}
@@ -33,7 +33,7 @@ void ScreenExit::Update( float fDelta )
if( m_Exited )
return;
/* Grab the list of playing sounds, and see if it's empty. */
// Grab the list of playing sounds, and see if it's empty.
const set<RageSound *> &PlayingSounds = SOUNDMAN->GetPlayingSounds();
bool DoQuit = PlayingSounds.empty();
+12 -14
View File
@@ -743,7 +743,6 @@ void ScreenGameplay::Init()
pi->GetPlayerStageStats()->m_vpPossibleSteps = pi->m_vpStepsQueue;
}
LOG->Trace("[ScreenGameplay::Init] loading scorekeepers");
FOREACH_EnabledPlayerInfo( m_vPlayerInfo, pi )
{
ASSERT( !pi->m_vpStepsQueue.empty() );
@@ -801,7 +800,7 @@ bool ScreenGameplay::Center1Player() const
/* Perhaps this should be handled better by defining a new
* StyleType for ONE_PLAYER_ONE_CREDIT_AND_ONE_COMPUTER,
* but for now just ignore Center1Player when it's Battle or Rave
* Mode. This doesn't begin to address two-player solo (6 arrows) */
* Mode. This doesn't begin to address two-player solo (6 arrows) */
return g_bCenter1Player &&
(bool)ALLOW_CENTER_1_PLAYER &&
GAMESTATE->m_PlayMode != PLAY_MODE_BATTLE &&
@@ -907,9 +906,9 @@ ScreenGameplay::~ScreenGameplay()
{
if( this->IsFirstUpdate() )
{
/* We never received any updates. That means we were deleted without being
* used, and never actually played. (This can happen when backing out of
* ScreenStage.) Cancel the stage. */
/* We never received any updates. That means we were deleted without being
* used, and never actually played. (This can happen when backing out of
* ScreenStage.) Cancel the stage. */
GAMESTATE->CancelStage();
}
@@ -944,22 +943,21 @@ bool ScreenGameplay::IsLastSong()
void ScreenGameplay::SetupSong( int iSongIndex )
{
LOG->Trace("[ScreenGameplay::SetupSong] begin");
FOREACH_EnabledPlayerInfo( m_vPlayerInfo, pi )
{
/* This is the first beat that can be changed without it being visible. Until
* we draw for the first time, any beat can be changed. */
/* This is the first beat that can be changed without it being visible.
* Until we draw for the first time, any beat can be changed. */
pi->GetPlayerState()->m_fLastDrawnBeat = -100;
Steps *pSteps = pi->m_vpStepsQueue[iSongIndex];
GAMESTATE->m_pCurSteps[ pi->GetStepsAndTrailIndex() ].Set( pSteps );
/* Load new NoteData into Player. Do this before
/* Load new NoteData into Player. Do this before
* RebuildPlayerOptionsFromActiveAttacks or else transform mods will get
* propogated to GAMESTATE->m_pPlayerOptions too early and be double-applied
* propagated to GAMESTATE->m_pPlayerOptions too early and be double-applied
* to the NoteData:
* once in Player::Load, then again in Player::ApplyActiveAttacks. This
* is very bad for transforms like AddMines.
* once in Player::Load, then again in Player::ApplyActiveAttacks.
* This is very bad for transforms like AddMines.
*/
NoteData originalNoteData;
pSteps->GetNoteData( originalNoteData );
@@ -1031,10 +1029,10 @@ void ScreenGameplay::SetupSong( int iSongIndex )
GAMESTATE->m_SongOptions.FromString( ModsLevel_Song, a.sModifiers );
}
/* Update attack bOn flags. */
// Update attack bOn flags.
pi->GetPlayerState()->Update( 0 );
/* Hack: Course modifiers that are set to start immediately shouldn't tween on. */
// Hack: Course modifiers that are set to start immediately shouldn't tween on.
pi->GetPlayerState()->m_PlayerOptions.SetCurrentToLevel( ModsLevel_Stage );
}
}
+17 -25
View File
@@ -1,5 +1,4 @@
#include "global.h"
#include "ScreenJukebox.h"
#include "RageLog.h"
#include "ThemeManager.h"
@@ -28,13 +27,12 @@
REGISTER_SCREEN_CLASS( ScreenJukebox );
void ScreenJukebox::SetSong()
{
ThemeMetric<bool> ALLOW_ADVANCED_MODIFIERS(m_sName,"AllowAdvancedModifiers");
ThemeMetric<bool> ALLOW_ADVANCED_MODIFIERS(m_sName,"AllowAdvancedModifiers");
vector<Song*> vSongs;
//Check to see if there is a theme-course
//I.E. If there is a course called exactly the theme name,
//then we pick a song from this course.
/* Check to see if there is a theme course. If there is a course that has
* the exact same name as the theme, then we pick a song from this course. */
Course *pCourse = SONGMAN->GetCourseFromName( THEME->GetCurThemeName() );
if( pCourse != NULL )
for ( unsigned i = 0; i < pCourse->m_vEntries.size(); i++ )
@@ -45,13 +43,11 @@ void ScreenJukebox::SetSong()
vSongs = SONGMAN->GetSongs( GAMESTATE->m_sPreferredSongGroup );
//
// Calculate what difficulties to show
//
vector<Difficulty> vDifficultiesToShow;
if( m_bDemonstration )
{
// HACK: This belongs in ScreenDemonstration
// HACK: This belongs in ScreenDemonstration.
ThemeMetricDifficultiesToShow DIFFICULTIES_TO_SHOW_HERE(m_sName,"DifficultiesToShow");
vDifficultiesToShow = DIFFICULTIES_TO_SHOW_HERE.GetValue();
}
@@ -70,9 +66,7 @@ void ScreenJukebox::SetSong()
ASSERT( !vDifficultiesToShow.empty() );
//
// Search for a Song and Steps to play during the demo
//
// Search for a Song and Steps to play during the demo.
for( int i=0; i<1000; i++ )
{
if( vSongs.size() == 0 )
@@ -103,13 +97,12 @@ void ScreenJukebox::SetSong()
AdjustSync::ResetOriginalSyncData();
FOREACH_PlayerNumber( p )
GAMESTATE->m_pCurSteps[p].Set( pSteps );
bool bShowModifiers = randomf(0,1) <= SHOW_COURSE_MODIFIERS_PROBABILITY;
if( bShowModifiers )
{
/* If we have a modifier course containing this song, apply its modifiers. Only check
* fixed course entries. */
/* If we have a modifier course containing this song, apply its
* modifiers. Only check fixed course entries. */
vector<Course*> apCourses;
SONGMAN->GetAllCourses( apCourses, false );
vector<const CourseEntry *> apOptions;
@@ -120,7 +113,6 @@ void ScreenJukebox::SetSong()
const CourseEntry *pEntry = pCourse->FindFixedSong( pSong );
if( pEntry == NULL || pEntry->attacks.size() == 0 )
continue;
if( !ALLOW_ADVANCED_MODIFIERS )
{
@@ -133,6 +125,7 @@ void ScreenJukebox::SetSong()
{
RString s = a->sModifiers;
s.MakeLower();
// todo: allow themers to modify this list? -aj
if( s.find("dark") != string::npos ||
s.find("stealth") != string::npos )
{
@@ -144,7 +137,6 @@ void ScreenJukebox::SetSong()
continue; // skip
}
apOptions.push_back( pEntry );
apPossibleCourses.push_back( pCourse );
}
@@ -154,7 +146,7 @@ void ScreenJukebox::SetSong()
int iIndex = RandomInt( apOptions.size() );
m_pCourseEntry = apOptions[iIndex];
Course *pCourse = apPossibleCourses[iIndex];
PlayMode pm = CourseTypeToPlayMode( pCourse->GetCourseType() );
GAMESTATE->m_PlayMode.Set( pm );
GAMESTATE->m_pCurCourse.Set( pCourse );
@@ -164,8 +156,8 @@ void ScreenJukebox::SetSong()
ASSERT( GAMESTATE->m_pCurTrail[p] );
}
}
}
}
return; // done looking
}
@@ -175,13 +167,12 @@ void ScreenJukebox::SetSong()
ScreenJukebox::ScreenJukebox()
{
m_bDemonstration = false;
m_pCourseEntry = NULL;
}
void ScreenJukebox::Init()
{
// ScreeJukeboxMenu must set this
// ScreenJukeboxMenu must set this
ASSERT( GAMESTATE->GetCurrentStyle() );
GAMESTATE->m_PlayMode.Set( PLAY_MODE_REGULAR );
@@ -196,7 +187,8 @@ void ScreenJukebox::Init()
if( Benchmark )
{
/* Note that you also need to make sure you benchmark with the
* same notes. I use a copy of MaxU with only heavy notes included. */
* same notes. I (who? -aj) use a copy of Maxx Unlimited with only heavy notes
* included.*/
FOREACH_EnabledPlayer( p )
{
/* Lots and lots of arrows. This might even bias to arrows a little
@@ -211,7 +203,7 @@ void ScreenJukebox::Init()
FOREACH_EnabledPlayer( p )
{
/* Reset score between songs. */
// Reset score between songs.
STATSMAN->m_CurStageStats.m_player[p].ResetScoreForLesson();
if( GAMESTATE->m_bJukeboxUsesModifiers )
@@ -232,7 +224,7 @@ void ScreenJukebox::Init()
GAMESTATE->m_bDemonstrationOrJukebox = true;
/* Now that we've set up, init the base class. */
// Now that we've set up, init the base class.
ScreenGameplay::Init();
if( GAMESTATE->m_pCurSong == NULL ) // we didn't find a song.
@@ -253,7 +245,7 @@ void ScreenJukebox::Input( const InputEventPlus &input )
//LOG->Trace( "ScreenJukebox::Input()" );
if( input.type != IET_FIRST_PRESS )
return; /* ignore */
return; // ignore
switch( input.MenuI )
{