add LightsDriver_ScreenMessage

This commit is contained in:
Chris Danford
2003-11-20 11:55:45 +00:00
parent 4e80f3057a
commit ffc40fe994
12 changed files with 186 additions and 42 deletions
+20 -1
View File
@@ -113,9 +113,20 @@ void LightsManager::Update( float fDeltaTime )
case LIGHTMODE_DEMONSTRATION:
case LIGHTMODE_GAMEPLAY:
{
int i;
// top lights are controlled my ScreenGameplay
//for( int i=0; i<4; i++ )
// m_pDriver->SetLight( (Light)i, bOn );
// menu lights are always off
for( i=4; i<6; i++ )
m_pDriver->SetLight( (Light)i, false );
// bass lights
float fBeatPercentage = GAMESTATE->m_fSongBeat - (int)GAMESTATE->m_fSongBeat;
bool bOn = fBeatPercentage < 0.1 || fBeatPercentage > 0.9;
for( int i=0; i<8; i++ )
for( i=7; i<8; i++ )
m_pDriver->SetLight( (Light)i, bOn );
}
break;
@@ -198,3 +209,11 @@ void LightsManager::SetLightMode( LightMode lm )
{
m_LightMode = lm;
}
void LightsManager::SetAllUpperLights( bool bOn )
{
for( int i=0; i<4; i++ )
{
m_pDriver->SetLight( (Light)i, bOn );
}
}
+1
View File
@@ -57,6 +57,7 @@ public:
void Update( float fDeltaTime );
void SetLightMode( LightMode lm );
void SetAllUpperLights( bool bOn );
private:
void SetLight( Light light, bool bOn );
+3
View File
@@ -18,6 +18,7 @@
#include "GameState.h"
#include "RageSounds.h"
#include "ThemeManager.h"
#include "LightsManager.h"
#define NEXT_SCREEN THEME->GetMetric("ScreenCaution","NextScreen")
@@ -79,8 +80,10 @@ void ScreenCaution::HandleScreenMessage( const ScreenMessage SM )
break;
case SM_GoToPrevScreen:
SCREENMAN->SetNewScreen( "ScreenTitleMenu" );
LIGHTSMAN->SetLightMode( LIGHTMODE_MENU );
break;
case SM_GoToNextScreen:
LIGHTSMAN->SetLightMode( LIGHTMODE_MENU );
SCREENMAN->SetNewScreen( NEXT_SCREEN );
break;
}
+24 -2
View File
@@ -1228,8 +1228,30 @@ void ScreenGameplay::Update( float fDeltaTime )
this->PostScreenMessage( SM_NotesEnded, 0 );
}
if( GAMESTATE->m_SongOptions.m_bAssistTick && IsTimeToPlayTicks())
m_soundAssistTick.Play();
bool bPlayTicks = IsTimeToPlayTicks();
if( bPlayTicks )
{
if( GAMESTATE->m_SongOptions.m_bAssistTick )
m_soundAssistTick.Play();
}
static float s_fSecsLeftOnUpperLights = 0;
if( bPlayTicks )
{
float fSecsPerBeat = 1.f/GAMESTATE->m_fCurBPS;
float fSecsToLight = fSecsPerBeat*.2;
s_fSecsLeftOnUpperLights = fSecsToLight;
}
else
{
s_fSecsLeftOnUpperLights -= fDeltaTime;
if( s_fSecsLeftOnUpperLights < 0 )
s_fSecsLeftOnUpperLights = 0;
}
if( s_fSecsLeftOnUpperLights>0 )
LIGHTSMAN->SetAllUpperLights( true );
else
LIGHTSMAN->SetAllUpperLights( false );
}
/* Set m_CurStageStats.bFailed for failed players. In, FAIL_ARCADE, send
+20 -2
View File
@@ -69,6 +69,7 @@ class ScreenSystemLayer: public Screen
public:
ScreenSystemLayer();
void SystemMessage( CString sMessage );
void SystemMessageNoAnimate( CString sMessage );
void RefreshCreditsMessages();
void Update( float fDeltaTime );
};
@@ -140,9 +141,9 @@ ScreenSystemLayer::ScreenSystemLayer() : Screen("ScreenSystemLayer")
void ScreenSystemLayer::SystemMessage( CString sMessage )
{
m_textSystemMessage.StopTweening();
m_textSystemMessage.FinishTweening();
m_textSystemMessage.SetText( sMessage );
m_textSystemMessage.SetDiffuse( RageColor(1,1,1,1) );
m_textSystemMessage.SetDiffuseAlpha( 1 );
m_textSystemMessage.SetX( -640 );
m_textSystemMessage.BeginTweening( 0.5f );
m_textSystemMessage.SetX( 4 );
@@ -151,6 +152,17 @@ void ScreenSystemLayer::SystemMessage( CString sMessage )
m_textSystemMessage.SetDiffuse( RageColor(1,1,1,0) );
}
void ScreenSystemLayer::SystemMessageNoAnimate( CString sMessage )
{
m_textSystemMessage.FinishTweening();
m_textSystemMessage.SetText( sMessage );
m_textSystemMessage.SetX( 4 );
m_textSystemMessage.SetDiffuseAlpha( 1 );
m_textSystemMessage.BeginTweening( 5 );
m_textSystemMessage.BeginTweening( 0.5f );
m_textSystemMessage.SetDiffuse( RageColor(1,1,1,0) );
}
void ScreenSystemLayer::RefreshCreditsMessages()
{
m_textCredits.LoadFromFont( THEME->GetPathToF("ScreenManager credits") );
@@ -646,6 +658,12 @@ void ScreenManager::SystemMessage( CString sMessage )
m_SystemLayer->SystemMessage( sMessage );
}
void ScreenManager::SystemMessageNoAnimate( CString sMessage )
{
LOG->Trace( "%s", sMessage.c_str() );
m_SystemLayer->SystemMessageNoAnimate( sMessage );
}
void ScreenManager::RefreshCreditsMessages()
{
m_SystemLayer->RefreshCreditsMessages();
+1
View File
@@ -47,6 +47,7 @@ public:
void MiniMenu( Menu* pDef, ScreenMessage SM_SendOnOK, ScreenMessage SM_SendOnCancel = SM_None );
void PopTopScreen( ScreenMessage SM = SM_None );
void SystemMessage( CString sMessage );
void SystemMessageNoAnimate( CString sMessage );
void PostMessageToTopScreen( ScreenMessage SM, float fDelay );
void SendMessageToTopScreen( ScreenMessage SM );
+2 -1
View File
@@ -1090,7 +1090,6 @@ bool HandleGlobalInputs( DeviceInput DeviceI, InputEventType type, GameInput Gam
static void HandleInputEvents(float fDeltaTime)
{
INPUTFILTER->Update( fDeltaTime );
LIGHTSMAN->Update( fDeltaTime );
static InputEventArray ieArray;
ieArray.clear(); // empty the array
@@ -1204,6 +1203,8 @@ static void GameLoop()
/* Important: Process input AFTER updating game logic, or input will be acting on song beat from last frame */
HandleInputEvents( fDeltaTime );
LIGHTSMAN->Update( fDeltaTime );
HOOKS->Update( fDeltaTime );
/*
+44 -36
View File
@@ -1,5 +1,5 @@
# Microsoft Developer Studio Project File - Name="StepMania" - Package Owner=<4>
# Microsoft Developer Studio Generated Build File, Format Version 6.00
# Microsoft Developer Studio Generated Build File, Format Version 60000
# ** DO NOT EDIT **
# TARGTYPE "Win32 (x86) Application" 0x0101
@@ -58,14 +58,14 @@ BSC32=bscmake.exe
LINK32=link.exe
# ADD BASE LINK32 $(intdir)\verstub.obj kernel32.lib shell32.lib user32.lib gdi32.lib advapi32.lib winmm.lib /nologo /subsystem:windows /pdb:"../debug6/StepMania-debug.pdb" /map /debug /machine:I386 /nodefaultlib:"libcmtd.lib" /out:"../StepMania-debug.exe"
# SUBTRACT BASE LINK32 /verbose /profile /pdb:none /incremental:no /nodefaultlib
# ADD LINK32 $(intdir)\verstub.obj kernel32.lib gdi32.lib shell32.lib user32.lib advapi32.lib winmm.lib /nologo /subsystem:windows /map /debug /machine:I386 /nodefaultlib:"libcmtd.lib" /out:"../StepMania-debug.exe"
# ADD LINK32 $(intdir)\verstub.obj kernel32.lib gdi32.lib shell32.lib user32.lib advapi32.lib winmm.lib /nologo /subsystem:windows /map /debug /machine:I386 /nodefaultlib:"libcmtd.lib" /out:"../../itg/StepMania-debug.exe"
# SUBTRACT LINK32 /verbose /profile /pdb:none /incremental:no /nodefaultlib
# Begin Special Build Tool
IntDir=.\../Debug6
TargetDir=\CVS\stepmania\stepmania
TargetDir=\stepmania\itg
TargetName=StepMania-debug
SOURCE="$(InputPath)"
PreLink_Cmds=disasm\verinc cl /Zl /nologo /c verstub.cpp /Fo$(IntDir)\
PreLink_Cmds=disasm\verinc cl /Zl /nologo /c verstub.cpp /Fo$(IntDir)\
PostBuild_Cmds=disasm\mapconv $(IntDir)\$(TargetName).map $(TargetDir)\StepMania.vdi
# End Special Build Tool
@@ -82,24 +82,28 @@ PostBuild_Cmds=disasm\mapconv $(IntDir)\$(TargetName).map $(TargetDir)\StepMania
# PROP Intermediate_Dir "Debug"
# PROP Ignore_Export_Lib 0
# PROP Target_Dir ""
XBCP=xbecopy.exe
# ADD BASE XBCP /NOLOGO
# ADD XBCP /NOLOGO
XBE=imagebld.exe
# ADD BASE XBE /nologo /stack:0x10000 /debug
# ADD XBE /nologo /stack:0x10000 /debug /out:"../default.xbe"
LINK32=link.exe
# ADD BASE LINK32 xapilibd.lib d3d8d.lib d3dx8d.lib xgraphicsd.lib dsoundd.lib dmusicd.lib xnetd.lib xboxkrnl.lib /nologo /incremental:no /debug /machine:I386 /subsystem:xbox /fixed:no /TMP
# ADD LINK32 xapilibd.lib d3d8d.lib d3dx8d.lib xgraphicsd.lib dsoundd.lib dmusicd.lib xnetd.lib xboxkrnl.lib /nologo /incremental:no /debug /machine:I386 /nodefaultlib:"libcd" /nodefaultlib:"libcmt" /out:"../StepManiaXbox-debug.exe" /subsystem:xbox /fixed:no /TMP
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
CPP=cl.exe
# ADD BASE CPP /nologo /W3 /Gm /GX /Zi /Od /D "WIN32" /D "_XBOX" /D "_DEBUG" /YX /FD /G6 /Ztmp /c
# ADD CPP /nologo /W3 /Gm /GX /Zi /Od /I "." /I "SDL-1.2.5\include" /I "SDL_image-1.2" /I "plib-1.6.0" /I "SDL_sound-1.0.0" /D "WIN32" /D "_XBOX" /D "_DEBUG" /D "OGG_ONLY" /YX /FD /G6 /Ztmp /c
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LINK32=link.exe
# ADD BASE LINK32 xapilibd.lib d3d8d.lib d3dx8d.lib xgraphicsd.lib dsoundd.lib dmusicd.lib xnetd.lib xboxkrnl.lib /nologo /incremental:no /debug /machine:I386 /subsystem:xbox /fixed:no /TMP
# ADD LINK32 xapilibd.lib d3d8d.lib d3dx8d.lib xgraphicsd.lib dsoundd.lib dmusicd.lib xnetd.lib xboxkrnl.lib /nologo /incremental:no /debug /machine:I386 /nodefaultlib:"libcd" /nodefaultlib:"libcmt" /out:"../StepManiaXbox-debug.exe" /subsystem:xbox /fixed:no /TMP
XBE=imagebld.exe
# ADD BASE XBE /nologo /stack:0x10000 /debug
# ADD XBE /nologo /stack:0x10000 /debug /out:"../default.xbe"
XBCP=xbecopy.exe
# ADD BASE XBCP /NOLOGO
# ADD XBCP /NOLOGO
# Begin Special Build Tool
PreLink_Cmds=disasm\verinc cl /Zl /nologo /c verstub.cpp \
/Fo$(IntDir)\
IntDir=.\Debug
TargetDir=\stepmania\stepmania
TargetName=default
SOURCE="$(InputPath)"
PreLink_Cmds=disasm\verinc cl /Zl /nologo /c verstub.cpp \
/Fo$(IntDir)\
PostBuild_Cmds=disasm\mapconv $(IntDir)\$(TargetName).map $(TargetDir)\StepMania.vdi ia32.vdi
# End Special Build Tool
@@ -132,14 +136,14 @@ BSC32=bscmake.exe
LINK32=link.exe
# ADD BASE LINK32 $(intdir)\verstub.obj kernel32.lib gdi32.lib shell32.lib user32.lib advapi32.lib winmm.lib /nologo /subsystem:windows /pdb:"../release6/StepMania.pdb" /map /debug /machine:I386
# SUBTRACT BASE LINK32 /verbose /pdb:none
# ADD LINK32 $(intdir)\verstub.obj kernel32.lib gdi32.lib shell32.lib user32.lib advapi32.lib winmm.lib /nologo /subsystem:windows /map /debug /machine:I386 /out:"../StepMania.exe"
# ADD LINK32 $(intdir)\verstub.obj kernel32.lib gdi32.lib shell32.lib user32.lib advapi32.lib winmm.lib /nologo /subsystem:windows /map /debug /machine:I386 /out:"../../itg/StepMania.exe"
# SUBTRACT LINK32 /verbose /pdb:none
# Begin Special Build Tool
IntDir=.\../Release6
TargetDir=\CVS\stepmania\stepmania
TargetDir=\stepmania\itg
TargetName=StepMania
SOURCE="$(InputPath)"
PreLink_Cmds=disasm\verinc cl /Zl /nologo /c verstub.cpp /Fo$(IntDir)\
PreLink_Cmds=disasm\verinc cl /Zl /nologo /c verstub.cpp /Fo$(IntDir)\
PostBuild_Cmds=disasm\mapconv $(IntDir)\$(TargetName).map $(TargetDir)\StepMania.vdi
# End Special Build Tool
@@ -157,27 +161,31 @@ PostBuild_Cmds=disasm\mapconv $(IntDir)\$(TargetName).map $(TargetDir)\StepMania
# PROP Intermediate_Dir "StepMania___Xbox_Release"
# PROP Ignore_Export_Lib 0
# PROP Target_Dir ""
XBCP=xbecopy.exe
# ADD BASE XBCP /NOLOGO
# ADD XBCP /NOLOGO
XBE=imagebld.exe
# ADD BASE XBE /nologo /stack:0x10000 /debug
# ADD XBE /nologo /testid:"123456" /stack:0x10000 /debug /out:"../default.xbe"
CPP=cl.exe
# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /I "." /I "SDL-1.2.5\include" /I "SDL_image-1.2" /I "plib-1.6.0" /D "WIN32" /D "_XBOX" /D "_DEBUG" /Fr /YX"global.h" /FD /c
# ADD CPP /nologo /MT /W3 /GX /O2 /I "." /I "SDL-1.2.5\include" /I "SDL_image-1.2" /I "plib-1.6.0" /I "SDL_sound-1.0.0" /D "WIN32" /D "_XBOX" /D "NDEBUG" /YX"global.h" /FD /c
# SUBTRACT CPP /Fr
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LINK32=link.exe
# ADD BASE LINK32 $(intdir)\verstub.obj xapilibd.lib d3d8d.lib d3dx8d.lib xgraphicsd.lib dsoundd.lib dmusicd.lib xnetd.lib xboxkrnl.lib /nologo /pdb:"../debug6/StepMania-debug.pdb" /map /debug /machine:IX86 /nodefaultlib:"libcmtd.lib" /out:"../StepMania-debug.exe"
# SUBTRACT BASE LINK32 /verbose /profile /pdb:none /incremental:no /nodefaultlib
# ADD LINK32 $(intdir)\verstub.obj xapilib.lib d3d8.lib d3dx8.lib xgraphics.lib dsound.lib dmusic.lib xnet.lib xboxkrnl.lib libcmt.lib /nologo /incremental:no /pdb:"../release6xbox/StepMania.pdb" /machine:I386 /nodefaultlib:"libc" /nodefaultlib:"libcmtd" /out:"../StepManiaXbox.exe" /subsystem:xbox /fixed:no /TMP /OPT:REF
# SUBTRACT LINK32 /pdb:none /map /debug
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
CPP=cl.exe
# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /I "." /I "SDL-1.2.5\include" /I "SDL_image-1.2" /I "plib-1.6.0" /D "WIN32" /D "_XBOX" /D "_DEBUG" /Fr /YX"global.h" /FD /c
# ADD CPP /nologo /MT /W3 /GX /O2 /I "." /I "SDL-1.2.5\include" /I "SDL_image-1.2" /I "plib-1.6.0" /I "SDL_sound-1.0.0" /D "WIN32" /D "_XBOX" /D "NDEBUG" /YX"global.h" /FD /c
# SUBTRACT CPP /Fr
XBE=imagebld.exe
# ADD BASE XBE /nologo /stack:0x10000 /debug
# ADD XBE /nologo /testid:"123456" /stack:0x10000 /debug /out:"../default.xbe"
XBCP=xbecopy.exe
# ADD BASE XBCP /NOLOGO
# ADD XBCP /NOLOGO
# Begin Special Build Tool
PreLink_Cmds=disasm\verinc cl /Zl /nologo /c verstub.cpp \
/Fo$(IntDir)\
IntDir=.\StepMania___Xbox_Release
TargetDir=\stepmania\stepmania
TargetName=default
SOURCE="$(InputPath)"
PreLink_Cmds=disasm\verinc cl /Zl /nologo /c verstub.cpp \
/Fo$(IntDir)\
PostBuild_Cmds=disasm\mapconv $(IntDir)\$(TargetName).map $(TargetDir)\StepMania.vdi ia32.vdi
# End Special Build Tool
@@ -0,0 +1,41 @@
#include "global.h"
/*
-----------------------------------------------------------------------------
Class: LightsDriver_SystemMessage
Desc: See header.
Copyright (c) 2003 by the person(s) listed below. All rights reserved.
Chris Danford
-----------------------------------------------------------------------------
*/
#include "LightsDriver_SystemMessage.h"
#include "ScreenManager.h"
bool g_bLightOn[NUM_LIGHTS];
LightsDriver_SystemMessage::LightsDriver_SystemMessage()
{
memset( g_bLightOn, 0, sizeof(g_bLightOn) );
}
LightsDriver_SystemMessage::~LightsDriver_SystemMessage()
{
}
void LightsDriver_SystemMessage::SetLight( Light light, bool bOn )
{
g_bLightOn[light] = bOn;
}
void LightsDriver_SystemMessage::Flush()
{
CString s = "Lights: ";
for( int i=0; i<NUM_LIGHTS; i++ )
{
s += g_bLightOn[i] ? '1' : '0';
}
SCREENMAN->SystemMessageNoAnimate( s );
}
@@ -0,0 +1,28 @@
#ifndef LightsDriver_SystemMessage_H
#define LightsDriver_SystemMessage_H
/*
-----------------------------------------------------------------------------
Class: LightsDriver_SystemMessage
Desc: Control lights.
Copyright (c) 2003 by the person(s) listed below. All rights reserved.
Chris Danford
-----------------------------------------------------------------------------
*/
#include "arch/Lights/LightsDriver.h"
class LightsDriver_SystemMessage : public LightsDriver
{
public:
LightsDriver_SystemMessage();
virtual ~LightsDriver_SystemMessage();
virtual void SetLight( Light light, bool bOn );
virtual void Flush();
};
#endif
+1
View File
@@ -155,6 +155,7 @@ LightsDriver *MakeLightsDriver(CString driver)
#ifdef LINUX
if(!driver.CompareNoCase("Serial")) ret = new LightsDriver_LinuxSerial;
#endif
if(!driver.CompareNoCase("SystemMessage")) ret = new LightsDriver_SystemMessage;
if(!driver.CompareNoCase("Null")) ret = new LightsDriver_Null;
if( !ret )
{
+1
View File
@@ -34,6 +34,7 @@
#include "ArchHooks/ArchHooks_none.h"
#include "Sound/RageSoundDriver_Null.h"
#include "Lights/LightsDriver_Null.h"
#include "Lights/LightsDriver_SystemMessage.h"
#if defined(SUPPORT_OPENGL)
#include "LowLevelWindow/LowLevelWindow_SDL.h"