2003-02-16 04:01:45 +00:00
|
|
|
#include "global.h"
|
2002-02-28 19:40:40 +00:00
|
|
|
/*
|
|
|
|
|
-----------------------------------------------------------------------------
|
|
|
|
|
Class: GrayArrow
|
|
|
|
|
|
2002-04-28 20:42:32 +00:00
|
|
|
Desc: A gray arrow that "receives" ColorNotes.
|
2002-02-28 19:40:40 +00:00
|
|
|
|
2002-05-19 01:59:48 +00:00
|
|
|
Copyright (c) 2001-2002 by the person(s) listed below. All rights reserved.
|
2002-02-28 19:40:40 +00:00
|
|
|
Ben Nordstrom
|
|
|
|
|
Chris Danford
|
|
|
|
|
-----------------------------------------------------------------------------
|
|
|
|
|
*/
|
2001-12-01 23:46:09 +00:00
|
|
|
|
|
|
|
|
#include "GrayArrow.h"
|
2002-07-23 01:41:40 +00:00
|
|
|
#include "PrefsManager.h"
|
2002-07-28 20:28:37 +00:00
|
|
|
#include "GameState.h"
|
2002-11-11 04:53:31 +00:00
|
|
|
#include <math.h>
|
|
|
|
|
#include "ThemeManager.h"
|
2001-12-01 23:46:09 +00:00
|
|
|
|
2002-12-29 23:38:56 +00:00
|
|
|
#include "RageLog.h"
|
2002-07-28 20:28:37 +00:00
|
|
|
|
2003-03-26 19:15:38 +00:00
|
|
|
CachedThemeMetricF GR_STEP_SECONDS ("GrayArrow","StepSeconds");
|
|
|
|
|
CachedThemeMetricF GR_STEP_ZOOM ("GrayArrow","StepZoom");
|
2001-12-01 23:46:09 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
GrayArrow::GrayArrow()
|
|
|
|
|
{
|
2003-02-25 08:07:56 +00:00
|
|
|
GR_STEP_SECONDS.Refresh();
|
|
|
|
|
GR_STEP_ZOOM.Refresh();
|
2002-08-28 22:42:40 +00:00
|
|
|
|
2001-12-01 23:46:09 +00:00
|
|
|
StopAnimating();
|
|
|
|
|
}
|
|
|
|
|
|
2002-07-28 20:28:37 +00:00
|
|
|
void GrayArrow::Update( float fDeltaTime )
|
2001-12-01 23:46:09 +00:00
|
|
|
{
|
2002-08-28 22:42:40 +00:00
|
|
|
ASSERT( Sprite::GetNumStates() > 0 ); // you forgot to call Load()
|
|
|
|
|
|
2002-07-28 20:28:37 +00:00
|
|
|
Sprite::Update( fDeltaTime );
|
|
|
|
|
|
2003-01-26 04:23:01 +00:00
|
|
|
/* XXX: get rid of this once we update the note skins */
|
|
|
|
|
int IdleState = (GetNumStates() == 3)? 0: 1;
|
2003-01-26 04:58:49 +00:00
|
|
|
int OnState = (GetNumStates() == 3)? 1: 0;
|
|
|
|
|
int OffState = (GetNumStates() == 3)? 2: 1;
|
2003-01-26 04:23:01 +00:00
|
|
|
|
2003-02-03 05:53:59 +00:00
|
|
|
if( !GAMESTATE->m_bPastHereWeGo )
|
2003-01-25 11:05:12 +00:00
|
|
|
{
|
2003-01-26 04:23:01 +00:00
|
|
|
SetState( IdleState );
|
2003-01-26 02:21:47 +00:00
|
|
|
return;
|
2003-01-25 11:05:12 +00:00
|
|
|
}
|
2002-12-29 23:38:56 +00:00
|
|
|
|
2003-01-26 02:21:47 +00:00
|
|
|
/* These could be metrics or configurable. I'd prefer the flash to
|
2003-01-26 04:23:01 +00:00
|
|
|
* start on the beat, I think ... -glenn */
|
2002-12-29 23:38:56 +00:00
|
|
|
|
2003-01-26 02:21:47 +00:00
|
|
|
/* Start flashing 10% of a beat before the beat starts. */
|
|
|
|
|
const float flash_offset = -0.1f;
|
2002-12-29 23:38:56 +00:00
|
|
|
|
2003-01-26 02:21:47 +00:00
|
|
|
/* Flash for 20% of a beat. */
|
|
|
|
|
const float flash_length = 0.2f;
|
2002-12-29 23:38:56 +00:00
|
|
|
|
2003-01-26 02:21:47 +00:00
|
|
|
float cur_beat = GAMESTATE->m_fSongBeat;
|
2002-12-29 23:38:56 +00:00
|
|
|
|
2003-01-26 02:21:47 +00:00
|
|
|
/* Beats can start in very negative territory (many BMR songs, Drop Out
|
2003-01-26 04:23:01 +00:00
|
|
|
* -Remix-). */
|
2003-01-26 02:21:47 +00:00
|
|
|
cur_beat += 100.0f;
|
|
|
|
|
|
|
|
|
|
cur_beat -= flash_offset;
|
|
|
|
|
float fPercentIntoBeat = fmodf(cur_beat, 1);
|
2003-01-26 04:58:49 +00:00
|
|
|
SetState( (fPercentIntoBeat<flash_length)? OnState : OffState );
|
2001-12-01 23:46:09 +00:00
|
|
|
}
|
|
|
|
|
|
2002-02-24 01:43:11 +00:00
|
|
|
void GrayArrow::Step()
|
2001-12-01 23:46:09 +00:00
|
|
|
{
|
2003-02-25 08:07:56 +00:00
|
|
|
SetZoom( GR_STEP_ZOOM );
|
2002-09-05 01:16:57 +00:00
|
|
|
StopTweening();
|
2003-02-25 08:07:56 +00:00
|
|
|
BeginTweening( GR_STEP_SECONDS );
|
2003-04-12 06:16:12 +00:00
|
|
|
SetZoom( 1 );
|
2001-12-01 23:46:09 +00:00
|
|
|
}
|