From 548736290285e27de1cef218b1a417a006297978 Mon Sep 17 00:00:00 2001 From: Kyzentun Date: Wed, 5 Nov 2014 22:26:25 -0700 Subject: [PATCH] Fixed ScreenPrompt::AnswerOnCommand metrics by calling LOAD_ALL_COMMANDS after the name was set. --- Docs/Changelog_sm5.txt | 4 ++++ src/BitmapText.cpp | 2 +- src/BitmapText.h | 2 +- src/ScreenPrompt.cpp | 10 +++++++++- 4 files changed, 15 insertions(+), 3 deletions(-) diff --git a/Docs/Changelog_sm5.txt b/Docs/Changelog_sm5.txt index bd36d4a91c..8c3efa2d91 100644 --- a/Docs/Changelog_sm5.txt +++ b/Docs/Changelog_sm5.txt @@ -4,6 +4,10 @@ The StepMania 5 Changelog covers all post-sm-ssc changes. For a list of changes from StepMania 4 alpha 5 to sm-ssc v1.2.5, see Changelog_sm-ssc.txt. ________________________________________________________________________________ +2014/11/05 +---------- +* [ScreenPrompt] Answer OnCommand metrics fixed to actually work. + 2014/11/01 ---------- * [RollingNumbers] Cropping and color during tweens fixed. diff --git a/src/BitmapText.cpp b/src/BitmapText.cpp index c2981cba21..823c730bda 100644 --- a/src/BitmapText.cpp +++ b/src/BitmapText.cpp @@ -885,7 +885,7 @@ void BitmapText::Attribute::FromStack( lua_State *L, int iPos ) lua_getfield( L, iTab, "Diffuses" ); if( !lua_isnil(L, -1) ) { - for( int i = 1; i <= 4; ++i ) + for( int i = 1; i <= NUM_DIFFUSE_COLORS; ++i ) { lua_rawgeti( L, -i, i ); diffuse[i-1].FromStack( L, -1 ); diff --git a/src/BitmapText.h b/src/BitmapText.h index d98daff4d7..b4cb21205d 100644 --- a/src/BitmapText.h +++ b/src/BitmapText.h @@ -93,7 +93,7 @@ public: { Attribute() : length(-1), glow() { } int length; - RageColor diffuse[4]; + RageColor diffuse[NUM_DIFFUSE_COLORS]; RageColor glow; void FromStack( lua_State *L, int iPos ); diff --git a/src/ScreenPrompt.cpp b/src/ScreenPrompt.cpp index b033a1746a..94dd89d561 100644 --- a/src/ScreenPrompt.cpp +++ b/src/ScreenPrompt.cpp @@ -66,7 +66,12 @@ void ScreenPrompt::Init() for( int i=0; iGetPathF(m_sName,"answer") ); - LOAD_ALL_COMMANDS( m_textAnswer[i] ); + // The name of the actor isn't set because it is not known at this point + // how many answers there will be, and the name depends on the number of + // answers as a clumsy way of letting the themer set different positions + // for different answer groups. The name is set in BeginScreen, and + // then the commands are loaded. -Kyz (At least, that seems like the + // explanation to me, reading the code years after the author left) this->AddChild( &m_textAnswer[i] ); } @@ -90,6 +95,9 @@ void ScreenPrompt::BeginScreen() { RString sElem = ssprintf("Answer%dOf%d", i+1, g_PromptType+1); m_textAnswer[i].SetName( sElem ); + LOAD_ALL_COMMANDS(m_textAnswer[i]); + // Side note: Because LOAD_ALL_COMMANDS occurs here, InitCommand will + // not be run for the actors. People can just use OnCommand instead. RString sAnswer = PromptAnswerToString( (PromptAnswer)i ); // FRAGILE if( g_PromptType == PROMPT_OK )