add option to blink the GameButton lights on note instead of step
This commit is contained in:
@@ -19,6 +19,7 @@
|
|||||||
#include "GameInput.h" // for GameController
|
#include "GameInput.h" // for GameController
|
||||||
#include "InputMapper.h"
|
#include "InputMapper.h"
|
||||||
#include "GameDef.h"
|
#include "GameDef.h"
|
||||||
|
#include "PrefsManager.h"
|
||||||
|
|
||||||
|
|
||||||
static const CString CabinetLightNames[NUM_CABINET_LIGHTS] = {
|
static const CString CabinetLightNames[NUM_CABINET_LIGHTS] = {
|
||||||
@@ -54,7 +55,8 @@ LightsManager::LightsManager(CString sDriver)
|
|||||||
|
|
||||||
m_pDriver = MakeLightsDriver(sDriver);
|
m_pDriver = MakeLightsDriver(sDriver);
|
||||||
|
|
||||||
ZERO( m_fSecsLeftInBlink );
|
ZERO( m_fSecsLeftInCabinetLightBlink );
|
||||||
|
ZERO( m_fSecsLeftInGameButtonBlink );
|
||||||
}
|
}
|
||||||
|
|
||||||
LightsManager::~LightsManager()
|
LightsManager::~LightsManager()
|
||||||
@@ -67,15 +69,18 @@ void LightsManager::Update( float fDeltaTime )
|
|||||||
// update lights falloff
|
// update lights falloff
|
||||||
{
|
{
|
||||||
FOREACH_CabinetLight( cl )
|
FOREACH_CabinetLight( cl )
|
||||||
m_fSecsLeftInBlink[cl] = max( 0, m_fSecsLeftInBlink[cl] - fDeltaTime );
|
fapproach( m_fSecsLeftInCabinetLightBlink[cl], 0, fDeltaTime );
|
||||||
|
FOREACH_GameController( gc )
|
||||||
|
FOREACH_GameButton( gb )
|
||||||
|
fapproach( m_fSecsLeftInGameButtonBlink[gc][gb], 0, fDeltaTime );
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// Set new lights state cabinet lights
|
// Set new lights state cabinet lights
|
||||||
//
|
//
|
||||||
{
|
{
|
||||||
FOREACH_CabinetLight( cl )
|
ZERO( m_LightsState.m_bCabinetLights );
|
||||||
m_LightsState.m_bCabinetLights[cl] = false;
|
ZERO( m_LightsState.m_bGameButtonLights );
|
||||||
}
|
}
|
||||||
|
|
||||||
switch( m_LightsMode )
|
switch( m_LightsMode )
|
||||||
@@ -147,12 +152,7 @@ void LightsManager::Update( float fDeltaTime )
|
|||||||
case LIGHTSMODE_GAMEPLAY:
|
case LIGHTSMODE_GAMEPLAY:
|
||||||
{
|
{
|
||||||
FOREACH_CabinetLight( cl )
|
FOREACH_CabinetLight( cl )
|
||||||
m_LightsState.m_bCabinetLights[cl] = false;
|
m_LightsState.m_bCabinetLights[cl] = m_fSecsLeftInCabinetLightBlink[cl] > 0 ;
|
||||||
|
|
||||||
{
|
|
||||||
FOREACH_CabinetLight( cl )
|
|
||||||
m_LightsState.m_bCabinetLights[cl] = m_fSecsLeftInBlink[cl] > 0 ;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case LIGHTSMODE_STAGE:
|
case LIGHTSMODE_STAGE:
|
||||||
@@ -220,6 +220,18 @@ void LightsManager::Update( float fDeltaTime )
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case LIGHTSMODE_GAMEPLAY:
|
case LIGHTSMODE_GAMEPLAY:
|
||||||
|
{
|
||||||
|
if( PREFSMAN->m_bBlinkGameplayButtonLightsOnNote )
|
||||||
|
{
|
||||||
|
FOREACH_GameController( gc )
|
||||||
|
{
|
||||||
|
FOREACH_GameButton( gb )
|
||||||
|
{
|
||||||
|
m_LightsState.m_bGameButtonLights[gc][gb] = m_fSecsLeftInGameButtonBlink[gc][gb] > 0 ;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
{
|
{
|
||||||
FOREACH_GameController( gc )
|
FOREACH_GameController( gc )
|
||||||
{
|
{
|
||||||
@@ -234,6 +246,7 @@ void LightsManager::Update( float fDeltaTime )
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case LIGHTSMODE_TEST:
|
case LIGHTSMODE_TEST:
|
||||||
{
|
{
|
||||||
@@ -259,9 +272,14 @@ void LightsManager::Update( float fDeltaTime )
|
|||||||
m_pDriver->Set( &m_LightsState );
|
m_pDriver->Set( &m_LightsState );
|
||||||
}
|
}
|
||||||
|
|
||||||
void LightsManager::GameplayBlinkLight( CabinetLight cl )
|
void LightsManager::BlinkCabinetLight( CabinetLight cl )
|
||||||
{
|
{
|
||||||
m_fSecsLeftInBlink[cl] = LIGHTS_FALLOFF_SECONDS;
|
m_fSecsLeftInCabinetLightBlink[cl] = LIGHTS_FALLOFF_SECONDS;
|
||||||
|
}
|
||||||
|
|
||||||
|
void LightsManager::BlinkGameButton( GameInput gi )
|
||||||
|
{
|
||||||
|
m_fSecsLeftInGameButtonBlink[gi.controller][gi.button] = LIGHTS_FALLOFF_SECONDS;
|
||||||
}
|
}
|
||||||
|
|
||||||
void LightsManager::SetLightsMode( LightsMode lm )
|
void LightsManager::SetLightsMode( LightsMode lm )
|
||||||
|
|||||||
@@ -62,13 +62,15 @@ public:
|
|||||||
|
|
||||||
void Update( float fDeltaTime );
|
void Update( float fDeltaTime );
|
||||||
|
|
||||||
void GameplayBlinkLight( CabinetLight cl );
|
void BlinkCabinetLight( CabinetLight cl );
|
||||||
|
void BlinkGameButton( GameInput gi );
|
||||||
|
|
||||||
void SetLightsMode( LightsMode lm );
|
void SetLightsMode( LightsMode lm );
|
||||||
LightsMode GetLightsMode();
|
LightsMode GetLightsMode();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
float m_fSecsLeftInBlink[NUM_CABINET_LIGHTS];
|
float m_fSecsLeftInCabinetLightBlink[NUM_CABINET_LIGHTS];
|
||||||
|
float m_fSecsLeftInGameButtonBlink[MAX_GAME_CONTROLLERS][MAX_GAME_BUTTONS];
|
||||||
|
|
||||||
LightsDriver* m_pDriver;
|
LightsDriver* m_pDriver;
|
||||||
LightsMode m_LightsMode;
|
LightsMode m_LightsMode;
|
||||||
|
|||||||
@@ -254,6 +254,7 @@ PrefsManager::PrefsManager()
|
|||||||
|
|
||||||
m_sLightsDriver = DEFAULT_LIGHTS_DRIVER;
|
m_sLightsDriver = DEFAULT_LIGHTS_DRIVER;
|
||||||
|
|
||||||
|
m_bBlinkGameplayButtonLightsOnNote = false;
|
||||||
m_bAllowUnacceleratedRenderer = false;
|
m_bAllowUnacceleratedRenderer = false;
|
||||||
m_bThreadedInput = true;
|
m_bThreadedInput = true;
|
||||||
m_bThreadedMovieDecode = true;
|
m_bThreadedMovieDecode = true;
|
||||||
@@ -435,6 +436,7 @@ void PrefsManager::ReadGlobalPrefsFromDisk()
|
|||||||
ini.GetValue( "Options", "LongVerSeconds", m_fLongVerSongSeconds );
|
ini.GetValue( "Options", "LongVerSeconds", m_fLongVerSongSeconds );
|
||||||
ini.GetValue( "Options", "MarathonVerSeconds", m_fMarathonVerSongSeconds );
|
ini.GetValue( "Options", "MarathonVerSeconds", m_fMarathonVerSongSeconds );
|
||||||
ini.GetValue( "Options", "ShowSongOptions", (int&)m_ShowSongOptions );
|
ini.GetValue( "Options", "ShowSongOptions", (int&)m_ShowSongOptions );
|
||||||
|
ini.GetValue( "Options", "BlinkGameplayButtonLightsOnNote", m_bBlinkGameplayButtonLightsOnNote );
|
||||||
ini.GetValue( "Options", "AllowUnacceleratedRenderer", m_bAllowUnacceleratedRenderer );
|
ini.GetValue( "Options", "AllowUnacceleratedRenderer", m_bAllowUnacceleratedRenderer );
|
||||||
ini.GetValue( "Options", "ThreadedInput", m_bThreadedInput );
|
ini.GetValue( "Options", "ThreadedInput", m_bThreadedInput );
|
||||||
ini.GetValue( "Options", "ThreadedMovieDecode", m_bThreadedMovieDecode );
|
ini.GetValue( "Options", "ThreadedMovieDecode", m_bThreadedMovieDecode );
|
||||||
@@ -656,6 +658,7 @@ void PrefsManager::SaveGlobalPrefsToDisk() const
|
|||||||
ini.SetValue( "Options", "LongVerSeconds", m_fLongVerSongSeconds );
|
ini.SetValue( "Options", "LongVerSeconds", m_fLongVerSongSeconds );
|
||||||
ini.SetValue( "Options", "MarathonVerSeconds", m_fMarathonVerSongSeconds );
|
ini.SetValue( "Options", "MarathonVerSeconds", m_fMarathonVerSongSeconds );
|
||||||
ini.SetValue( "Options", "ShowSongOptions", m_ShowSongOptions );
|
ini.SetValue( "Options", "ShowSongOptions", m_ShowSongOptions );
|
||||||
|
ini.SetValue( "Options", "BlinkGameplayButtonLightsOnNote", m_bBlinkGameplayButtonLightsOnNote );
|
||||||
ini.SetValue( "Options", "AllowUnacceleratedRenderer", m_bAllowUnacceleratedRenderer );
|
ini.SetValue( "Options", "AllowUnacceleratedRenderer", m_bAllowUnacceleratedRenderer );
|
||||||
ini.SetValue( "Options", "ThreadedInput", m_bThreadedInput );
|
ini.SetValue( "Options", "ThreadedInput", m_bThreadedInput );
|
||||||
ini.SetValue( "Options", "ThreadedMovieDecode", m_bThreadedMovieDecode );
|
ini.SetValue( "Options", "ThreadedMovieDecode", m_bThreadedMovieDecode );
|
||||||
|
|||||||
@@ -234,6 +234,7 @@ public:
|
|||||||
int m_iSoundResampleQuality;
|
int m_iSoundResampleQuality;
|
||||||
CString m_sMovieDrivers;
|
CString m_sMovieDrivers;
|
||||||
CString m_sLightsDriver;
|
CString m_sLightsDriver;
|
||||||
|
bool m_bBlinkGameplayButtonLightsOnNote;
|
||||||
bool m_bAllowUnacceleratedRenderer;
|
bool m_bAllowUnacceleratedRenderer;
|
||||||
bool m_bThreadedInput;
|
bool m_bThreadedInput;
|
||||||
bool m_bThreadedMovieDecode;
|
bool m_bThreadedMovieDecode;
|
||||||
|
|||||||
@@ -1051,7 +1051,7 @@ void ScreenGameplay::LoadNextSong()
|
|||||||
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// Load lights data
|
// Load cabinet lights data
|
||||||
//
|
//
|
||||||
{
|
{
|
||||||
m_CabinetLightsNoteData.Init();
|
m_CabinetLightsNoteData.Init();
|
||||||
@@ -1400,12 +1400,14 @@ void ScreenGameplay::Update( float fDeltaTime )
|
|||||||
//
|
//
|
||||||
// update lights
|
// update lights
|
||||||
//
|
//
|
||||||
bool bBlink[NUM_CABINET_LIGHTS];
|
const StyleDef* pStyleDef = GAMESTATE->GetCurrentStyleDef();
|
||||||
ZERO( bBlink );
|
bool bBlinkCabinetLight[NUM_CABINET_LIGHTS];
|
||||||
|
bool bBlinkGameButton[MAX_GAME_CONTROLLERS][MAX_GAME_BUTTONS];
|
||||||
|
ZERO( bBlinkCabinetLight );
|
||||||
|
ZERO( bBlinkGameButton );
|
||||||
bool bCrossedABeat = false;
|
bool bCrossedABeat = false;
|
||||||
{
|
{
|
||||||
float fPositionSeconds = GAMESTATE->m_fMusicSeconds - LIGHTS_FALLOFF_SECONDS/2; // trigger the light a tiny bit early
|
float fPositionSeconds = GAMESTATE->m_fMusicSeconds - LIGHTS_FALLOFF_SECONDS/2; // trigger the light a tiny bit early
|
||||||
fPositionSeconds += (SOUND->GetPlayLatency()) * GAMESTATE->m_SongOptions.m_fMusicRate;
|
|
||||||
float fSongBeat = GAMESTATE->m_pCurSong->GetBeatFromElapsedTime( fPositionSeconds );
|
float fSongBeat = GAMESTATE->m_pCurSong->GetBeatFromElapsedTime( fPositionSeconds );
|
||||||
|
|
||||||
int iRowNow = BeatToNoteRowNotRounded( fSongBeat );
|
int iRowNow = BeatToNoteRowNotRounded( fSongBeat );
|
||||||
@@ -1417,21 +1419,72 @@ void ScreenGameplay::Update( float fDeltaTime )
|
|||||||
|
|
||||||
bCrossedABeat = fBeatLast != fBeatNow;
|
bCrossedABeat = fBeatLast != fBeatNow;
|
||||||
|
|
||||||
|
const int iSongRow = BeatToNoteRow( fSongBeat );
|
||||||
|
|
||||||
for( int r=iRowLastCrossed+1; r<=iRowNow; r++ ) // for each index we crossed since the last update
|
for( int r=iRowLastCrossed+1; r<=iRowNow; r++ ) // for each index we crossed since the last update
|
||||||
{
|
{
|
||||||
FOREACH_CabinetLight( cl )
|
FOREACH_CabinetLight( cl )
|
||||||
bBlink[cl] |= (m_CabinetLightsNoteData.GetTapNote( cl, r ) != TAP_EMPTY);
|
{
|
||||||
|
bool bBlink = (m_CabinetLightsNoteData.GetTapNote( cl, r ) != TAP_EMPTY);
|
||||||
|
bBlinkCabinetLight[cl] |= bBlink;
|
||||||
|
}
|
||||||
|
FOREACH_EnabledPlayer( pn )
|
||||||
|
{
|
||||||
|
for( int t=0; t<m_Player[pn].GetNumTracks(); t++ )
|
||||||
|
{
|
||||||
|
bool bBlink = (m_Player[pn].GetTapNote(t,r) != TAP_EMPTY);
|
||||||
|
if( bBlink )
|
||||||
|
{
|
||||||
|
StyleInput si( pn, t );
|
||||||
|
GameInput gi = pStyleDef->StyleInputToGameInput( si );
|
||||||
|
bBlinkGameButton[gi.controller][gi.button] |= bBlink;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
iRowLastCrossed = iRowNow;
|
iRowLastCrossed = iRowNow;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool bOverrideBlink = (GAMESTATE->m_fSongBeat < GAMESTATE->m_pCurSong->m_fFirstBeat) && bCrossedABeat;
|
{
|
||||||
|
// check for active HoldNotes
|
||||||
|
float fPositionSeconds = GAMESTATE->m_fMusicSeconds - LIGHTS_FALLOFF_SECONDS/2; // trigger the light a tiny bit early
|
||||||
|
float fSongBeat = GAMESTATE->m_pCurSong->GetBeatFromElapsedTime( fPositionSeconds );
|
||||||
|
const int iSongRow = BeatToNoteRow( fSongBeat );
|
||||||
|
|
||||||
|
FOREACH_EnabledPlayer( pn )
|
||||||
|
{
|
||||||
|
// check if a hold should be active
|
||||||
|
for( int i=0; i < m_Player[pn].GetNumHoldNotes(); i++ ) // for each HoldNote
|
||||||
|
{
|
||||||
|
const HoldNote &hn = m_Player[pn].GetHoldNote(i);
|
||||||
|
if( hn.iStartRow <= iSongRow && iSongRow <= hn.iEndRow )
|
||||||
|
{
|
||||||
|
StyleInput si( pn, hn.iTrack );
|
||||||
|
GameInput gi = pStyleDef->StyleInputToGameInput( si );
|
||||||
|
bBlinkGameButton[gi.controller][gi.button] |= true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// send blink data
|
||||||
|
bool bOverrideCabinetBlink = (GAMESTATE->m_fSongBeat < GAMESTATE->m_pCurSong->m_fFirstBeat) && bCrossedABeat;
|
||||||
|
|
||||||
FOREACH_CabinetLight( cl )
|
FOREACH_CabinetLight( cl )
|
||||||
{
|
{
|
||||||
if( bOverrideBlink || bBlink[cl] )
|
if( bOverrideCabinetBlink || bBlinkCabinetLight[cl] )
|
||||||
LIGHTSMAN->GameplayBlinkLight( cl );
|
LIGHTSMAN->BlinkCabinetLight( cl );
|
||||||
|
}
|
||||||
|
|
||||||
|
FOREACH_GameController( gc )
|
||||||
|
{
|
||||||
|
FOREACH_GameButton( gb )
|
||||||
|
{
|
||||||
|
if( bBlinkGameButton[gc][gb] )
|
||||||
|
LIGHTSMAN->BlinkGameButton( GameInput(gc,gb) );
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
|
|||||||
Reference in New Issue
Block a user