Added ForceStateUpdate and SetDecodeMovie to AMV. Fixed SetStateProperties and SetQuadState off by one errors. Added size lua functions to RageTexture. Added GetBGChanges to Song.

This commit is contained in:
Kyzentun
2015-02-02 23:28:33 -07:00
parent 6570db599c
commit c400794d50
7 changed files with 105 additions and 3 deletions
+7
View File
@@ -4,6 +4,13 @@ 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.
________________________________________________________________________________
2015/02/02
----------
* [ActorMultiVertex] ForceStateUpdate and SetDecodeMovie added. [kyzentun]
* [RageTexture] Get<thing>Width and Height functions added.
(<thing> means Source, Texture, or Image) [kyzentun]
* [Song] GetBGChanges added. [kyzentun]
2015/02/01
----------
* [ActorMultiVertex] Animation state system added. AMVs can now have
+9
View File
@@ -491,6 +491,7 @@
<Class base='Actor' name='ActorMultiVertex'>
<Function name='AddState'/>
<Function name='AddQuadState'/>
<Function name='ForceStateUpdate'/>
<Function name='GetCurrDrawMode'/>
<Function name='GetCurrFirstToDraw'/>
<Function name='GetCurrNumToDraw'/>
@@ -510,6 +511,7 @@
<Function name='RemoveState'/>
<Function name='RemoveQuadState'/>
<Function name='SetAllStateDelays'/>
<Function name='SetDecodeMovie'/>
<Function name='SetDrawState'/>
<Function name='SetEffectMode'/>
<Function name='SetLineWidth'/>
@@ -1382,6 +1384,12 @@
<Function name='volume'/>
</Class>
<Class name='RageTexture'>
<Function name='GetSourceWidth'/>
<Function name='GetSourceHeight'/>
<Function name='GetTextureWidth'/>
<Function name='GetTextureHeight'/>
<Function name='GetImageWidth'/>
<Function name='GetImageHeight'/>
<Function name='GetTextureCoordRect'/>
<Function name='loop'/>
<Function name='position'/>
@@ -1505,6 +1513,7 @@
<Function name='GetAllSteps'/>
<Function name='GetBackgroundPath'/>
<Function name='GetBannerPath'/>
<Function name='GetBGChanges'/>
<Function name='GetCDImagePath'/>
<Function name='GetCDTitlePath'/>
<Function name='GetDiscPath'/>
+29
View File
@@ -1525,6 +1525,9 @@ save yourself some time, copy this for undocumented things:
{{left, top, right, bottom}, delay}<br />
left, top, right, and bottom are pixel coordinates, starting at 0. If delay is 0 or negative, the state will last forever.
</Function>
<Function name='ForceStateUpdate' return='' arguments=''>
Forces the AMV to update the texture coordinates on all its quads, even if the current state has not changed.
</Function>
<Function name='GetUseAnimationState' return= 'bool' arguments=''>
Returns whether the AMV uses the animation state.
</Function>
@@ -1544,6 +1547,9 @@ save yourself some time, copy this for undocumented things:
<Function name='GetState' return= 'int' arguments=''>
Returns the id of the current state.
</Function>
<Function name='SetDecodeMovie' return='' arguments='bool decode'>
Sets whether the AMV should call the decode function for its texture during updates.
</Function>
<Function name='SetState' return= '' arguments='int id'>
Sets the current state.
</Function>
@@ -4044,6 +4050,24 @@ save yourself some time, copy this for undocumented things:
</Function>
</Class>
<Class name='RageTexture'>
<Function name='GetSourceWidth' return='float' arguments=''>
Returns the source width.
</Function>
<Function name='GetSourceHeight' return='float' arguments=''>
Returns the source height.
</Function>
<Function name='GetTextureWidth' return='float' arguments=''>
Returns the texture width.
</Function>
<Function name='GetTextureHeight' return='float' arguments=''>
Returns the texture height.
</Function>
<Function name='GetImageWidth' return='float' arguments=''>
Returns the image width.
</Function>
<Function name='GetImageHeight' return='float' arguments=''>
Returns the image height.
</Function>
<Function name='GetNumFrames' return='int' arguments=''>
Returns the number of frames in this texture.
</Function>
@@ -4352,6 +4376,11 @@ save yourself some time, copy this for undocumented things:
<Function name='GetBannerPath' return='string' arguments=''>
Returns the path to the song's banner.
</Function>
<Function name='GetBGChanges' return='table' arguments=''>
Returns a table with all the data for the song's BGCHANGES line.<br />
Each element of the table is one change like this:<br />
{start_beat= 1.0, rate= 1.0, transition= "example", effect= "example", file1= "example", file2= "example", color1= "#FFFFFFFF", color2= "#FFFFFFFF"}
</Function>
<Function name='GetCDImagePath' return='string' arguments=''>
Returns the path to the song's CD image.
</Function>
+19 -3
View File
@@ -72,6 +72,7 @@ ActorMultiVertex::ActorMultiVertex()
_splines[i].m_owned_by_actor= true;
}
_skip_next_update= true;
_decode_movie= true;
_use_animation_state= false;
_secs_into_state= 0.0f;
_cur_state= 0;
@@ -571,7 +572,7 @@ void ActorMultiVertex::Update(float fDelta)
wrap(_secs_into_state, GetAnimationLengthSeconds());
}
UpdateAnimationState();
if(!skip_this_movie_update)
if(!skip_this_movie_update && _decode_movie)
{
_Texture->DecodeSeconds(max(0, time_passed));
}
@@ -897,11 +898,14 @@ public:
if( lua_isnil(L, 1) )
{
p->UnloadTexture();
p->LoadFromTexture(TEXTUREMAN->GetDefaultTextureID());
}
else
{
RageTextureID ID( SArg(1) );
TEXTUREMAN->DisableOddDimensionWarning();
p->LoadFromTexture( ID );
TEXTUREMAN->EnableOddDimensionWarning();
}
COMMON_RETURN_SELF;
}
@@ -1053,7 +1057,7 @@ public:
new_states.resize(num_states);
for(size_t i= 0; i < num_states; ++i)
{
lua_rawgeti(L, 1, i);
lua_rawgeti(L, 1, i+1);
FillStateFromLua(L, new_states[i], tex, -1);
lua_pop(L, 1);
}
@@ -1102,7 +1106,17 @@ public:
}
static int SetQuadState(T* p, lua_State *L)
{
p->SetQuadState(QuadStateIndex(p, L, 1), IArg(1)-1);
p->SetQuadState(QuadStateIndex(p, L, 1), IArg(2)-1);
COMMON_RETURN_SELF;
}
static int ForceStateUpdate(T* p, lua_State *L)
{
p->UpdateAnimationState(true);
COMMON_RETURN_SELF;
}
static int SetDecodeMovie(T* p, lua_State *L)
{
p->_decode_movie= BArg(1);
COMMON_RETURN_SELF;
}
@@ -1167,6 +1181,8 @@ public:
ADD_METHOD(RemoveQuadState);
ADD_METHOD(GetQuadState);
ADD_METHOD(SetQuadState);
ADD_METHOD(ForceStateUpdate);
ADD_METHOD(SetDecodeMovie);
// Copy from RageTexture
ADD_METHOD( SetTexture );
+1
View File
@@ -146,6 +146,7 @@ public:
void SetQuadState(size_t i, size_t s)
{ AMV_DestTweenState().quad_states[i]= s; }
bool _use_animation_state;
bool _decode_movie;
virtual void PushSelf( lua_State *L );
+12
View File
@@ -108,6 +108,12 @@ public:
p->Reload();
COMMON_RETURN_SELF;
}
DEFINE_METHOD(GetSourceWidth, GetSourceWidth());
DEFINE_METHOD(GetSourceHeight, GetSourceHeight());
DEFINE_METHOD(GetTextureWidth, GetTextureWidth());
DEFINE_METHOD(GetTextureHeight, GetTextureHeight());
DEFINE_METHOD(GetImageWidth, GetImageWidth());
DEFINE_METHOD(GetImageHeight, GetImageHeight());
LunaRageTexture()
{
@@ -117,6 +123,12 @@ public:
ADD_METHOD( GetTextureCoordRect );
ADD_METHOD( GetNumFrames );
ADD_METHOD( Reload );
ADD_METHOD(GetSourceWidth);
ADD_METHOD(GetSourceHeight);
ADD_METHOD(GetTextureWidth);
ADD_METHOD(GetTextureHeight);
ADD_METHOD(GetImageWidth);
ADD_METHOD(GetImageHeight);
}
};
+28
View File
@@ -1916,6 +1916,33 @@ public:
return 1;
}
static int GetTimingData( T* p, lua_State *L ) { p->m_SongTiming.PushSelf(L); return 1; }
static int GetBGChanges(T* p, lua_State* L)
{
const vector<BackgroundChange>& changes= p->GetBackgroundChanges(BACKGROUND_LAYER_1);
lua_createtable(L, changes.size(), 0);
for(size_t c= 0; c < changes.size(); ++c)
{
lua_createtable(L, 0, 8);
lua_pushnumber(L, changes[c].m_fStartBeat);
lua_setfield(L, -2, "start_beat");
lua_pushnumber(L, changes[c].m_fRate);
lua_setfield(L, -2, "rate");
LuaHelpers::Push(L, changes[c].m_sTransition);
lua_setfield(L, -2, "transition");
LuaHelpers::Push(L, changes[c].m_def.m_sEffect);
lua_setfield(L, -2, "effect");
LuaHelpers::Push(L, changes[c].m_def.m_sFile1);
lua_setfield(L, -2, "file1");
LuaHelpers::Push(L, changes[c].m_def.m_sFile2);
lua_setfield(L, -2, "file2");
LuaHelpers::Push(L, changes[c].m_def.m_sColor1);
lua_setfield(L, -2, "color1");
LuaHelpers::Push(L, changes[c].m_def.m_sColor2);
lua_setfield(L, -2, "color2");
lua_rawseti(L, -2, c+1);
}
return 1;
}
// has functions
static int HasMusic( T* p, lua_State *L ) { lua_pushboolean(L, p->HasMusic()); return 1; }
static int HasBanner( T* p, lua_State *L ) { lua_pushboolean(L, p->HasBanner()); return 1; }
@@ -2053,6 +2080,7 @@ public:
ADD_METHOD( HasStepsTypeAndDifficulty );
ADD_METHOD( GetOneSteps );
ADD_METHOD( GetTimingData );
ADD_METHOD(GetBGChanges);
ADD_METHOD( HasMusic );
ADD_METHOD( HasBanner );
ADD_METHOD( HasBackground );