This commit is contained in:
Jonathan Payne
2012-12-28 19:00:28 -08:00
6 changed files with 76 additions and 114 deletions
@@ -234,34 +234,5 @@ end;
t[#t+1] = StandardDecorationFromFileOptional("BPMDisplay","BPMDisplay");
t[#t+1] = StandardDecorationFromFileOptional("StageDisplay","StageDisplay");
t[#t+1] = StandardDecorationFromFileOptional("SongTitle","SongTitle");
t[#t+1] = Def.ActorFrame {
Def.ActorFrame {
Name="LifeTest";
Owner=PLAYER_1;
InitCommand=cmd(x,Center1Player() and SCREEN_CENTER_X or THEME:GetMetric(Var "LoadingScreen","PlayerP1OnePlayerOneSideX");y,SCREEN_TOP+80);
LifeChangedMessageCommand=function(self,params)
local c = self:GetChildren();
if params.Player == PLAYER_1 then
local fLife = params.LifeMeter:GetLife();
c.LifeText:settextf("%03i", fLife * 100);
end
end;
HealthStateChangedMessageCommand=function(self, params)
local c = self.GetChildren();
if params.PlayerNumber == PLAYER_1 then
c.LifeText:settext( ToEnumShortString(params.HealthState) );
end
end;
--
LoadFont("Common Normal") .. {
Name="LifeText";
InitCommand=cmd(shadowlength,1);
HotCommand=cmd(stopeffect;diffuse,Color.White;diffuseshift;effectcolor2,Color.White;effectcolor1,Color.Orange);
AliveCommand=cmd(stopeffect;diffuse,Color.White;);
DangerCommand=cmd(stopeffect;diffuse,Color.White;diffuseshift;effectcolor2,Color.Red;effectcolor2,BoostColor(Color.Red,0.5));
DeadCommand=cmd(stopeffect;diffuse,Color.Black);
};
};
};
return t
@@ -2,52 +2,46 @@ local player = Var "Player"
local blinkTime = 1.2
local barWidth = 256;
local barHeight = 32;
local c
local function CreateLives(numLives)
local t = {};
for i=1,numLives do
t[#t+1] = Def.Quad {
Name=i;
OnCommand=cmd(zoom,1024);
};
end
return t
end
local c;
local LifeMeter, MaxLives, CurLives;
local LifeRatio;
local t = Def.ActorFrame {
Def.ActorFrame {
Name="LifeContainer";
Def.Quad {
Name="LifeFill";
InitCommand=cmd(zoomto,barWidth,barHeight);
--OnCommand=cmd(diffuseramp;effectcolor2,PlayerColor(player);effectcolor1,ColorMidTone(PlayerColor(player));
-- effectclock,'beatnooffset';effectperiod,1);
};
InitCommand=function(self)
c = self:GetChildren();
--c = self:GetChildren();
end;
BeginCommand=function(self,param)
MESSAGEMAN:Broadcast("SystemMessage",{ Message = "TEST", NoAnimate = true});
local c = self:GetChildren();
local screen = SCREENMAN:GetTopScreen();
local lifemeter = screen:GetLifeMeter(player);
MESSAGEMAN:Broadcast("SystemMessage",{ Message = "TEST2", NoAnimate = true});
local TotalLives = lifemeter:GetTotalLives();
local CurLives = lifemeter:GetLivesLeft();
MESSAGEMAN:Broadcast("SystemMessage",{ Message = "ASSIGN CONTAINERS", NoAnimate = true});
c.LifeContainer[#c.LifeContainer+1] = CreateLives(TotalLives);
MESSAGEMAN:Broadcast("SystemMessage",{ Message = "LIVES = " .. TotalLives .. " | CUR = " .. CurLives .. " | ACTORS: " .. self:GetNumChildren(), NoAnimate = true});
local screen = SCREENMAN:GetTopScreen() or nil;
if screen ~= nil then
LifeMeter = screen:GetLifeMeter(player);
MaxLives = LifeMeter:GetTotalLives();
CurLives = LifeMeter:GetLivesLeft();
MESSAGEMAN:Broadcast("SystemMessage",
{ Message = "(" .. MaxLives .. ", " .. CurLives ")", NoAnimate = true });
else
MESSAGEMAN:Broadcast("SystemMessage", { Message = "WE DONE FUCKED UP"});
end
end;
LifeChangedMessageCommand=function(self,param)
if param.Player == player then
return
LifeRatio = CurLives / MaxLives;
end
end;
StartCommand=function(self,param)
if param.Player == player then
return
LifeRatio = CurLives / MaxLives;
end
end;
FinishCommand=function(self,param)
if param.Player == player then
return
LifeRatio = CurLives / MaxLives;
end
end;
--[[ LoadActor("_lives")..{
+38 -38
View File
@@ -2511,7 +2511,7 @@ void ScreenEdit::InputEdit( const InputEventPlus &input, EditButton EditB )
if( iAttack >= 0 )
{
const RString sDuration = ssprintf( "%.6f", ce.attacks[iAttack].fSecsRemaining );
const RString sDuration = FloatToString(ce.attacks[iAttack].fSecsRemaining );
g_InsertCourseAttack.rows[remove].bEnabled = true;
if( g_InsertCourseAttack.rows[duration].choices.size() == 9 )
@@ -3653,14 +3653,14 @@ void ScreenEdit::HandleScreenMessage( const ScreenMessage SM )
{
ScreenTextEntry::TextEntry(SM_BackFromEditingAttackStart,
EDIT_ATTACK_START,
ssprintf("%.5f", attack.fStartSecond),
FloatToString(attack.fStartSecond),
10);
}
else if (option == 1) // adjusting the length of the attack
{
ScreenTextEntry::TextEntry(SM_BackFromEditingAttackLength,
EDIT_ATTACK_LENGTH,
ssprintf("%.5f", attack.fSecsRemaining),
FloatToString(attack.fSecsRemaining),
10);
}
else if (option >= 2 + mods.size()) // adding a new mod
@@ -3732,7 +3732,7 @@ void ScreenEdit::HandleScreenMessage( const ScreenMessage SM )
true,
0,
NULL));
g_IndividualAttack.rows[0].SetOneUnthemedChoice(ssprintf("%.5f", attack.fStartSecond));
g_IndividualAttack.rows[0].SetOneUnthemedChoice(FloatToString(attack.fStartSecond));
g_IndividualAttack.rows.push_back(MenuRowDef(1,
"Secs Remaining",
true,
@@ -3741,7 +3741,7 @@ void ScreenEdit::HandleScreenMessage( const ScreenMessage SM )
true,
0,
NULL));
g_IndividualAttack.rows[1].SetOneUnthemedChoice(ssprintf("%.5f", attack.fSecsRemaining));
g_IndividualAttack.rows[1].SetOneUnthemedChoice(FloatToString(attack.fSecsRemaining));
vector<RString> mods;
split(attack.sModifiers, ",", mods);
for (unsigned i = 0; i < mods.size(); ++i)
@@ -4218,10 +4218,10 @@ void ScreenEdit::DisplayTimingMenu()
// bool bIsSelecting = ( (m_NoteFieldEdit.m_iEndMarker != -1) && (m_NoteFieldEdit.m_iBeginMarker != -1) );
g_TimingDataInformation.rows[beat_0_offset].SetOneUnthemedChoice( ssprintf("%.6f", pTime.m_fBeat0OffsetInSeconds) );
g_TimingDataInformation.rows[bpm].SetOneUnthemedChoice( ssprintf("%.6f", pTime.GetBPMAtRow( row ) ) );
g_TimingDataInformation.rows[stop].SetOneUnthemedChoice( ssprintf("%.6f", pTime.GetStopAtRow( row ) ) ) ;
g_TimingDataInformation.rows[delay].SetOneUnthemedChoice( ssprintf("%.6f", pTime.GetDelayAtRow( row ) ) );
g_TimingDataInformation.rows[beat_0_offset].SetOneUnthemedChoice( FloatToString(pTime.m_fBeat0OffsetInSeconds) );
g_TimingDataInformation.rows[bpm].SetOneUnthemedChoice( FloatToString(pTime.GetBPMAtRow( row ) ) );
g_TimingDataInformation.rows[stop].SetOneUnthemedChoice( FloatToString(pTime.GetStopAtRow( row ) ) ) ;
g_TimingDataInformation.rows[delay].SetOneUnthemedChoice( FloatToString(pTime.GetDelayAtRow( row ) ) );
g_TimingDataInformation.rows[time_signature].SetOneUnthemedChoice(
ssprintf( "%d / %d",
@@ -4235,15 +4235,15 @@ void ScreenEdit::DisplayTimingMenu()
g_TimingDataInformation.rows[combo].SetOneUnthemedChoice( ssprintf("%d / %d",
pTime.GetComboAtRow( row ),
pTime.GetMissComboAtRow( row ) ) );
g_TimingDataInformation.rows[warp].SetOneUnthemedChoice( ssprintf("%.6f", pTime.GetWarpAtRow( row ) ) );
g_TimingDataInformation.rows[speed_percent].SetOneUnthemedChoice( bHasSpeedOnThisRow ? ssprintf("%.6f", pTime.GetSpeedPercentAtRow( row ) ) : "---" );
g_TimingDataInformation.rows[speed_wait].SetOneUnthemedChoice( bHasSpeedOnThisRow ? ssprintf("%.6f", pTime.GetSpeedWaitAtRow( row ) ) : "---" );
g_TimingDataInformation.rows[warp].SetOneUnthemedChoice( FloatToString(pTime.GetWarpAtRow( row ) ) );
g_TimingDataInformation.rows[speed_percent].SetOneUnthemedChoice( bHasSpeedOnThisRow ? FloatToString(pTime.GetSpeedPercentAtRow( row ) ) : "---" );
g_TimingDataInformation.rows[speed_wait].SetOneUnthemedChoice( bHasSpeedOnThisRow ? FloatToString(pTime.GetSpeedWaitAtRow( row ) ) : "---" );
RString starting = ( pTime.GetSpeedModeAtRow( row ) == 1 ? "Seconds" : "Beats" );
g_TimingDataInformation.rows[speed_mode].SetOneUnthemedChoice( starting.c_str() );
g_TimingDataInformation.rows[scroll].SetOneUnthemedChoice( ssprintf("%.6f", pTime.GetScrollAtRow( row ) ) );
g_TimingDataInformation.rows[fake].SetOneUnthemedChoice( ssprintf("%.6f", pTime.GetFakeAtRow( row ) ) );
g_TimingDataInformation.rows[scroll].SetOneUnthemedChoice( FloatToString(pTime.GetScrollAtRow( row ) ) );
g_TimingDataInformation.rows[fake].SetOneUnthemedChoice( FloatToString(pTime.GetFakeAtRow( row ) ) );
// g_TimingDataInformation.rows[speed_percent].bEnabled = !bIsSelecting;
g_TimingDataInformation.rows[speed_wait].bEnabled = bHasSpeedOnThisRow;
@@ -4347,8 +4347,8 @@ void ScreenEdit::HandleMainMenuChoice( MainMenuChoice c, const vector<int> &iAns
g_StepsInformation.rows[step_credit].bEnabled = (EDIT_MODE.GetValue() >= EditMode_Full);
g_StepsInformation.rows[step_credit].SetOneUnthemedChoice( pSteps->GetCredit() );
g_StepsInformation.rows[step_display_bpm].iDefaultChoice = pSteps->GetDisplayBPM();
g_StepsInformation.rows[step_min_bpm].SetOneUnthemedChoice( ssprintf("%.6f", pSteps->GetMinBPM()));
g_StepsInformation.rows[step_max_bpm].SetOneUnthemedChoice( ssprintf("%.6f", pSteps->GetMaxBPM()));
g_StepsInformation.rows[step_min_bpm].SetOneUnthemedChoice( FloatToString(pSteps->GetMinBPM()));
g_StepsInformation.rows[step_max_bpm].SetOneUnthemedChoice( FloatToString(pSteps->GetMaxBPM()));
EditMiniMenu( &g_StepsInformation, SM_BackFromStepsInformation, SM_None );
}
break;
@@ -4488,12 +4488,12 @@ void ScreenEdit::HandleMainMenuChoice( MainMenuChoice c, const vector<int> &iAns
g_SongInformation.rows[main_title_transliteration].SetOneUnthemedChoice( pSong->m_sMainTitleTranslit );
g_SongInformation.rows[sub_title_transliteration].SetOneUnthemedChoice( pSong->m_sSubTitleTranslit );
g_SongInformation.rows[artist_transliteration].SetOneUnthemedChoice( pSong->m_sArtistTranslit );
g_SongInformation.rows[last_second_hint].SetOneUnthemedChoice( ssprintf("%.6f", pSong->GetSpecifiedLastSecond()) );
g_SongInformation.rows[preview_start].SetOneUnthemedChoice( ssprintf("%.6f", pSong->m_fMusicSampleStartSeconds) );
g_SongInformation.rows[preview_length].SetOneUnthemedChoice( ssprintf("%.6f", pSong->m_fMusicSampleLengthSeconds) );
g_SongInformation.rows[last_second_hint].SetOneUnthemedChoice( FloatToString(pSong->GetSpecifiedLastSecond()) );
g_SongInformation.rows[preview_start].SetOneUnthemedChoice( FloatToString(pSong->m_fMusicSampleStartSeconds) );
g_SongInformation.rows[preview_length].SetOneUnthemedChoice( FloatToString(pSong->m_fMusicSampleLengthSeconds) );
g_SongInformation.rows[display_bpm].iDefaultChoice = pSong->m_DisplayBPMType;
g_SongInformation.rows[min_bpm].SetOneUnthemedChoice( ssprintf("%.6f", pSong->m_fSpecifiedBPMMin) );
g_SongInformation.rows[max_bpm].SetOneUnthemedChoice( ssprintf("%.6f", pSong->m_fSpecifiedBPMMax) );
g_SongInformation.rows[min_bpm].SetOneUnthemedChoice( FloatToString(pSong->m_fSpecifiedBPMMin) );
g_SongInformation.rows[max_bpm].SetOneUnthemedChoice( FloatToString(pSong->m_fSpecifiedBPMMax) );
EditMiniMenu( &g_SongInformation, SM_BackFromSongInformation );
}
@@ -5096,7 +5096,7 @@ void ScreenEdit::HandleStepsInformationChoice( StepsInformationChoice c, const v
case step_min_bpm:
{
ScreenTextEntry::TextEntry(SM_None, ENTER_MIN_BPM,
ssprintf("%.6f", pSteps->GetMinBPM()), 20,
FloatToString(pSteps->GetMinBPM()), 20,
ScreenTextEntry::FloatValidate,
ChangeStepsMinBPM, NULL);
break;
@@ -5104,7 +5104,7 @@ void ScreenEdit::HandleStepsInformationChoice( StepsInformationChoice c, const v
case step_max_bpm:
{
ScreenTextEntry::TextEntry(SM_None, ENTER_MAX_BPM,
ssprintf("%.6f", pSteps->GetMaxBPM()), 20,
FloatToString(pSteps->GetMaxBPM()), 20,
ScreenTextEntry::FloatValidate,
ChangeStepsMaxBPM, NULL);
break;
@@ -5159,27 +5159,27 @@ void ScreenEdit::HandleSongInformationChoice( SongInformationChoice c, const vec
break;
case last_second_hint:
ScreenTextEntry::TextEntry( SM_None, ENTER_LAST_SECOND_HINT,
ssprintf("%.6f", pSong->GetSpecifiedLastSecond()), 20,
FloatToString(pSong->GetSpecifiedLastSecond()), 20,
ScreenTextEntry::FloatValidate, ChangeLastSecondHint, NULL );
break;
case preview_start:
ScreenTextEntry::TextEntry( SM_None, ENTER_PREVIEW_START,
ssprintf("%.6f", pSong->m_fMusicSampleStartSeconds), 20,
FloatToString(pSong->m_fMusicSampleStartSeconds), 20,
ScreenTextEntry::FloatValidate, ChangePreviewStart, NULL );
break;
case preview_length:
ScreenTextEntry::TextEntry( SM_None, ENTER_PREVIEW_LENGTH,
ssprintf("%.6f", pSong->m_fMusicSampleLengthSeconds), 20,
FloatToString(pSong->m_fMusicSampleLengthSeconds), 20,
ScreenTextEntry::FloatValidate, ChangePreviewLength, NULL );
break;
case min_bpm:
ScreenTextEntry::TextEntry( SM_None, ENTER_MIN_BPM,
ssprintf("%.6f", pSong->m_fSpecifiedBPMMin), 20,
FloatToString(pSong->m_fSpecifiedBPMMin), 20,
ScreenTextEntry::FloatValidate, ChangeMinBPM, NULL );
break;
case max_bpm:
ScreenTextEntry::TextEntry( SM_None, ENTER_MAX_BPM,
ssprintf("%.6f", pSong->m_fSpecifiedBPMMax), 20,
FloatToString(pSong->m_fSpecifiedBPMMax), 20,
ScreenTextEntry::FloatValidate, ChangeMaxBPM, NULL );
break;
default: break;
@@ -5210,14 +5210,14 @@ void ScreenEdit::HandleTimingDataInformationChoice( TimingDataInformationChoice
DEFAULT_FAIL( c );
case beat_0_offset:
ScreenTextEntry::TextEntry( SM_None, ENTER_BEAT_0_OFFSET,
ssprintf("%.6f", GetAppropriateTiming().m_fBeat0OffsetInSeconds), 20,
FloatToString(GetAppropriateTiming().m_fBeat0OffsetInSeconds), 20,
ScreenTextEntry::FloatValidate, ChangeBeat0Offset, NULL );
break;
case bpm:
ScreenTextEntry::TextEntry(
SM_BackFromBPMChange,
ENTER_BPM_VALUE,
ssprintf( "%.4f", GetAppropriateTiming().GetBPMAtBeat( GetBeat() ) ),
FloatToString( GetAppropriateTiming().GetBPMAtBeat( GetBeat() ) ),
10
);
break;
@@ -5225,7 +5225,7 @@ void ScreenEdit::HandleTimingDataInformationChoice( TimingDataInformationChoice
ScreenTextEntry::TextEntry(
SM_BackFromStopChange,
ENTER_STOP_VALUE,
ssprintf( "%.4f", GetAppropriateTiming().GetStopAtBeat( GetBeat() ) ),
FloatToString( GetAppropriateTiming().GetStopAtBeat( GetBeat() ) ),
10
);
break;
@@ -5233,7 +5233,7 @@ void ScreenEdit::HandleTimingDataInformationChoice( TimingDataInformationChoice
ScreenTextEntry::TextEntry(
SM_BackFromDelayChange,
ENTER_DELAY_VALUE,
ssprintf( "%.4f", GetAppropriateTiming().GetDelayAtBeat( GetBeat() ) ),
FloatToString( GetAppropriateTiming().GetDelayAtBeat( GetBeat() ) ),
10
);
break;
@@ -5279,7 +5279,7 @@ void ScreenEdit::HandleTimingDataInformationChoice( TimingDataInformationChoice
ScreenTextEntry::TextEntry(
SM_BackFromWarpChange,
ENTER_WARP_VALUE,
ssprintf( "%.6f", GetAppropriateTiming().GetWarpAtBeat( GetBeat() ) ),
FloatToString( GetAppropriateTiming().GetWarpAtBeat( GetBeat() ) ),
10
);
break;
@@ -5287,7 +5287,7 @@ void ScreenEdit::HandleTimingDataInformationChoice( TimingDataInformationChoice
ScreenTextEntry::TextEntry(
SM_BackFromSpeedPercentChange,
ENTER_SPEED_PERCENT_VALUE,
ssprintf( "%.6f", GetAppropriateTiming().GetSpeedSegmentAtBeat( GetBeat() )->GetRatio() ),
FloatToString( GetAppropriateTiming().GetSpeedSegmentAtBeat( GetBeat() )->GetRatio() ),
10
);
break;
@@ -5295,7 +5295,7 @@ void ScreenEdit::HandleTimingDataInformationChoice( TimingDataInformationChoice
ScreenTextEntry::TextEntry(
SM_BackFromScrollChange,
ENTER_SCROLL_VALUE,
ssprintf( "%.6f", GetAppropriateTiming().GetScrollSegmentAtBeat( GetBeat() )->GetRatio() ),
FloatToString( GetAppropriateTiming().GetScrollSegmentAtBeat( GetBeat() )->GetRatio() ),
10
);
break;
@@ -5303,7 +5303,7 @@ void ScreenEdit::HandleTimingDataInformationChoice( TimingDataInformationChoice
ScreenTextEntry::TextEntry(
SM_BackFromSpeedWaitChange,
ENTER_SPEED_WAIT_VALUE,
ssprintf( "%.6f", GetAppropriateTiming().GetSpeedSegmentAtBeat( GetBeat() )->GetDelay() ),
FloatToString( GetAppropriateTiming().GetSpeedSegmentAtBeat( GetBeat() )->GetDelay() ),
10
);
break;
@@ -5323,7 +5323,7 @@ void ScreenEdit::HandleTimingDataInformationChoice( TimingDataInformationChoice
ScreenTextEntry::TextEntry(
SM_BackFromFakeChange,
ENTER_FAKE_VALUE,
ssprintf("%.6f", GetAppropriateTiming().GetFakeAtBeat( GetBeat() ) ),
FloatToString(GetAppropriateTiming().GetFakeAtBeat( GetBeat() ) ),
10
);
break;
@@ -5780,7 +5780,7 @@ void ScreenEdit::DoStepAttackMenu()
FOREACH(int, points, i)
{
const Attack &attack = attacks[*i];
RString desc = ssprintf("%.5f -> %.5f (%d mod[s])",
RString desc = ssprintf("%g -> %g (%d mod[s])",
startTime, startTime + attack.fSecsRemaining,
attack.GetNumAttacks());
+2 -2
View File
@@ -833,10 +833,10 @@ void ScreenSelectMaster::MenuStart( const InputEventPlus &input )
if( (bool)SHARED_SELECTION || GetCurrentPage() == PAGE_2 )
{
// Only one player has to pick. Choose this for all the other players, too.
FOREACH_PlayerNumber( p )
FOREACH_EnabledPlayer( p )
{
ASSERT( !m_bChosen[p] );
fSecs = max( fSecs, DoMenuStart(p) ); // no harm in calling this for an unjoined player
fSecs = max( fSecs, DoMenuStart(p) );
}
}
else
+12 -17
View File
@@ -394,6 +394,18 @@ void ScreenSelectMusic::Update( float fDeltaTime )
}
void ScreenSelectMusic::Input( const InputEventPlus &input )
{
// HACK: This screen eats mouse inputs if we don't check for them first.
bool mouse_evt = false;
for (int i = MOUSE_LEFT; i <= MOUSE_WHEELDOWN; i++)
{
if (input.DeviceI == DeviceInput( DEVICE_MOUSE, (DeviceButton)i ))
mouse_evt = true;
}
if (mouse_evt)
{
ScreenWithMenuElements::Input(input);
return;
}
// LOG->Trace( "ScreenSelectMusic::Input()" );
// reset announcer timer
@@ -505,23 +517,6 @@ void ScreenSelectMusic::Input( const InputEventPlus &input )
m_bStepsChosen[input.pn] )
return; // ignore
// todo: Allow mousewheel to scroll MusicWheel -aj
/*
if( input.DeviceI.device == DEVICE_MOUSE )
{
if( input.DeviceI.button == MOUSE_WHEELUP )
{
MESSAGEMAN->Broadcast( "PreviousSong" );
m_MusicWheel.Move( -1 );
}
else if( input.DeviceI.button == MOUSE_WHEELDOWN )
{
MESSAGEMAN->Broadcast( "NextSong" );
m_MusicWheel.Move( +1 );
}
}
*/
if( USE_PLAYER_SELECT_MENU )
{
if( input.type == IET_RELEASE && input.MenuI == GAME_BUTTON_SELECT )
+2
View File
@@ -526,6 +526,7 @@ int WheelBase::FirstVisibleIndex()
class LunaWheelBase: public Luna<WheelBase>
{
public:
static int Move( T* p, lua_State *L ){ p->Move( IArg(1) ); return 0; }
static int GetWheelItem( T* p, lua_State *L )
{
int iItem = IArg(1);
@@ -553,6 +554,7 @@ public:
LunaWheelBase()
{
ADD_METHOD( Move );
ADD_METHOD( GetWheelItem );
ADD_METHOD( IsSettled );
ADD_METHOD( IsLocked );