Fixed conflicts to merge kickbox in.

This commit is contained in:
Kyzentun
2015-01-27 18:03:41 -07:00
269 changed files with 2639 additions and 514 deletions
+82 -1
View File
@@ -104,6 +104,68 @@ void ScreenSelectMaster::Init()
FOREACH( PlayerNumber, vpns, p )
m_vsprScroll[*p].resize( m_aGameCommands.size() );
vector<RageVector3> positions;
bool positions_set_by_lua= false;
if(THEME->HasMetric(m_sName, "IconChoicePosFunction"))
{
positions_set_by_lua= true;
LuaReference command= THEME->GetMetricR(m_sName, "IconChoicePosFunction");
if(command.GetLuaType() != LUA_TFUNCTION)
{
LuaHelpers::ReportScriptError(m_sName+"::IconChoicePosFunction must be a function.");
positions_set_by_lua= false;
}
else
{
Lua* L= LUA->Get();
command.PushSelf(L);
lua_pushnumber(L, m_aGameCommands.size());
RString err= m_sName + "::IconChoicePosFunction: ";
if(!LuaHelpers::RunScriptOnStack(L, err, 1, 1, true))
{
positions_set_by_lua= false;
}
else
{
if(!lua_istable(L, -1))
{
LuaHelpers::ReportScriptError(m_sName+"::IconChoicePosFunction did not return a table of positions.");
positions_set_by_lua= false;
}
else
{
size_t poses= lua_objlen(L, -1);
for(size_t p= 1; p <= poses; ++p)
{
lua_rawgeti(L, -1, p);
RageVector3 pos(0.0f, 0.0f, 0.0f);
if(!lua_istable(L, -1))
{
LuaHelpers::ReportScriptErrorFmt("Position %zu is not a table.", p);
}
else
{
#define SET_POS_PART(i, part) \
lua_rawgeti(L, -1, i); \
pos.part= lua_tonumber(L, -1); \
lua_pop(L, 1);
// If part of the position is not provided, we want it to
// default to zero, which lua_tonumber does. -Kyz
SET_POS_PART(1, x);
SET_POS_PART(2, y);
SET_POS_PART(3, z);
#undef SET_POS_PART
}
lua_pop(L, 1);
positions.push_back(pos);
}
}
}
lua_settop(L, 0);
LUA->Release(L);
}
}
for( unsigned c=0; c<m_aGameCommands.size(); c++ )
{
GameCommand& mc = m_aGameCommands[c];
@@ -122,7 +184,26 @@ void ScreenSelectMaster::Init()
RString sName = "Icon" "Choice" + mc.m_sName;
m_vsprIcon[c]->SetName( sName );
if( USE_ICON_METRICS )
LOAD_ALL_COMMANDS_AND_SET_XY( m_vsprIcon[c] );
{
if(positions_set_by_lua)
{
LOAD_ALL_COMMANDS(m_vsprIcon[c]);
m_vsprIcon[c]->SetXY(positions[c].x, positions[c].y);
m_vsprIcon[c]->SetZ(positions[c].z);
}
else
{
LOAD_ALL_COMMANDS_AND_SET_XY( m_vsprIcon[c] );
}
#define OPTIONAL_COMMAND(onoff) \
if(THEME->HasMetric(m_sName, "IconChoice" onoff "Command")) \
{ \
m_vsprIcon[c]->AddCommand(onoff, THEME->GetMetricA(m_sName, "IconChoice" onoff "Command"), false); \
}
OPTIONAL_COMMAND("On");
OPTIONAL_COMMAND("Off");
#undef OPTIONAL_COMMAND
}
this->AddChild( m_vsprIcon[c] );
}