From a10c0c4f01bc1fa3542110850a96d76696b2bcb5 Mon Sep 17 00:00:00 2001 From: Kyzentun Keeslala Date: Mon, 21 Sep 2015 20:42:56 -0600 Subject: [PATCH] Added set_use_effect_clock_for_texcoords to Sprite. Updated changelog. --- Docs/Changelog_sm5.txt | 26 ++++++++++++++++++++++++ Docs/Luadoc/Lua.xml | 2 ++ Docs/Luadoc/LuaDocumentation.xml | 8 +++++++- src/Sprite.cpp | 35 ++++++++++++++++++++++++-------- src/Sprite.h | 2 ++ 5 files changed, 64 insertions(+), 9 deletions(-) diff --git a/Docs/Changelog_sm5.txt b/Docs/Changelog_sm5.txt index f0bb03005c..3467cf14ae 100644 --- a/Docs/Changelog_sm5.txt +++ b/Docs/Changelog_sm5.txt @@ -5,6 +5,32 @@ from StepMania 4 alpha 5 to sm-ssc v1.2.5, see Changelog_sm-ssc.txt. ________________________________________________________________________________ +2015/09/21 +---------- +* [Sprite] Added set_use_effect_clock_for_texcoords for toggling whether the + tex coord velocity uses the effect clock instead of the time. + +2015/09/10 +---------- +* [MusicWheel] Fixed SetItemPosition so that it actually passes the item + index and the number of items to the transform function. [kyzentun] + +2015/09/09 +---------- +* [Notefield] Fixed bug where the hold body doesn't scroll if it goes off the + top of the screen. [waiei] + +2015/09/08 +---------- +* [Compiling] Compiling stepmania on Windows with the locale set to Japanese + should work now. [wolfman] + +2015/09/06 +---------- +* [Preferences] Fixed crash on Advanced Input Options on OS X caused by the + Axis Fix preference not existing on OS X. The preference does nothing on + OS X, but the game no longer crashes on that screen. [kyzentun] + 2015/09/03 ---------- * [Fonts] Respliced large kanji sprite sheets from 32x106 and 32x61 to 63x54 diff --git a/Docs/Luadoc/Lua.xml b/Docs/Luadoc/Lua.xml index 458f97b6d0..82734011d7 100644 --- a/Docs/Luadoc/Lua.xml +++ b/Docs/Luadoc/Lua.xml @@ -1699,10 +1699,12 @@ + + diff --git a/Docs/Luadoc/LuaDocumentation.xml b/Docs/Luadoc/LuaDocumentation.xml index d6999e4873..8e945e6852 100644 --- a/Docs/Luadoc/LuaDocumentation.xml +++ b/Docs/Luadoc/LuaDocumentation.xml @@ -4969,6 +4969,9 @@ save yourself some time, copy this for undocumented things: Allows the themer to set a custom texture rectangle that effects the way the texture is drawn. + + Returns true if the sprite is using the effect clock for texcoordvelocity. + [02 Sprite.lua] Call RageTexture:loop( bLoop ) on the texture. @@ -4984,11 +4987,14 @@ save yourself some time, copy this for undocumented things: Set the Sprite's state to iNewState. + + If use is true, then the sprite will use the effect clock for texcoordvelocity. + - Set the texture coordinate velocity which controls how the Sprite changes as it animates. + Set the texture coordinate velocity which controls how the Sprite changes as it animates. A velocity of 1 makes the texture scroll all the way once per second. diff --git a/src/Sprite.cpp b/src/Sprite.cpp index 796b01678e..492f2f28a6 100644 --- a/src/Sprite.cpp +++ b/src/Sprite.cpp @@ -36,6 +36,7 @@ Sprite::Sprite() m_fTexCoordVelocityX = 0; m_fTexCoordVelocityY = 0; + m_use_effect_clock_for_texcoords= false; } // NoteSkinManager needs a sprite with a texture set to return in cases where @@ -74,6 +75,7 @@ Sprite::Sprite( const Sprite &cpy ): CPY( m_fRememberedClipHeight ); CPY( m_fTexCoordVelocityX ); CPY( m_fTexCoordVelocityY ); + CPY(m_use_effect_clock_for_texcoords); #undef CPY if( cpy.m_pTexture != NULL ) @@ -426,18 +428,23 @@ void Sprite::Update( float fDelta ) // update scrolling if( m_fTexCoordVelocityX != 0 || m_fTexCoordVelocityY != 0 ) { + float coord_delta= fDelta; + if(m_use_effect_clock_for_texcoords) + { + coord_delta= fTimePassed; + } float fTexCoords[8]; Sprite::GetActiveTextureCoords( fTexCoords ); // top left, bottom left, bottom right, top right - fTexCoords[0] += fDelta*m_fTexCoordVelocityX; - fTexCoords[1] += fDelta*m_fTexCoordVelocityY; - fTexCoords[2] += fDelta*m_fTexCoordVelocityX; - fTexCoords[3] += fDelta*m_fTexCoordVelocityY; - fTexCoords[4] += fDelta*m_fTexCoordVelocityX; - fTexCoords[5] += fDelta*m_fTexCoordVelocityY; - fTexCoords[6] += fDelta*m_fTexCoordVelocityX; - fTexCoords[7] += fDelta*m_fTexCoordVelocityY; + fTexCoords[0] += coord_delta * m_fTexCoordVelocityX; + fTexCoords[1] += coord_delta * m_fTexCoordVelocityY; + fTexCoords[2] += coord_delta * m_fTexCoordVelocityX; + fTexCoords[3] += coord_delta * m_fTexCoordVelocityY; + fTexCoords[4] += coord_delta * m_fTexCoordVelocityX; + fTexCoords[5] += coord_delta * m_fTexCoordVelocityY; + fTexCoords[6] += coord_delta * m_fTexCoordVelocityX; + fTexCoords[7] += coord_delta * m_fTexCoordVelocityY; /* When wrapping, avoid gradual loss of precision and sending * unreasonably large texture coordinates to the renderer by pushing @@ -1110,6 +1117,16 @@ public: } static int StopUsingCustomPosCoords( T* p, lua_State *L ) { p->StopUsingCustomPosCoords(); COMMON_RETURN_SELF; } static int texcoordvelocity( T* p, lua_State *L ) { p->SetTexCoordVelocity( FArg(1),FArg(2) ); COMMON_RETURN_SELF; } + static int get_use_effect_clock_for_texcoords(T* p, lua_State* L) + { + lua_pushboolean(L, p->m_use_effect_clock_for_texcoords); + return 1; + } + static int set_use_effect_clock_for_texcoords(T* p, lua_State* L) + { + p->m_use_effect_clock_for_texcoords= BArg(1); + COMMON_RETURN_SELF; + } static int scaletoclipped( T* p, lua_State *L ) { p->ScaleToClipped( FArg(1),FArg(2) ); COMMON_RETURN_SELF; } static int CropTo( T* p, lua_State *L ) { p->CropTo( FArg(1),FArg(2) ); COMMON_RETURN_SELF; } static int stretchtexcoords( T* p, lua_State *L ) { p->StretchTexCoords( FArg(1),FArg(2) ); COMMON_RETURN_SELF; } @@ -1240,6 +1257,8 @@ public: ADD_METHOD( SetCustomPosCoords ); ADD_METHOD( StopUsingCustomPosCoords ); ADD_METHOD( texcoordvelocity ); + ADD_METHOD(get_use_effect_clock_for_texcoords); + ADD_METHOD(set_use_effect_clock_for_texcoords); ADD_METHOD( scaletoclipped ); ADD_METHOD( CropTo ); ADD_METHOD( stretchtexcoords ); diff --git a/src/Sprite.h b/src/Sprite.h index e9b2fa371d..f6d907ed7b 100644 --- a/src/Sprite.h +++ b/src/Sprite.h @@ -94,6 +94,8 @@ public: bool m_DecodeMovie; + bool m_use_effect_clock_for_texcoords; + protected: void LoadFromTexture( RageTextureID ID );