Fixed automagic typing. Added debug overlay line for conversion.

This commit is contained in:
Kyzentun
2015-05-05 21:41:15 -06:00
parent 5eba25a495
commit 9b6ae296c7
4 changed files with 35 additions and 17 deletions
+1
View File
@@ -1472,6 +1472,7 @@ CPU=CPU
Clear Errors=Clear Errors Clear Errors=Clear Errors
Clear Profile Stats=Clear Profile Scores Clear Profile Stats=Clear Profile Scores
CoinMode=CoinMode CoinMode=CoinMode
Convert XML=Convert XML
Debug Menu=Debug Menu Debug Menu=Debug Menu
Fill Profile Stats=Fill Profile Stats Fill Profile Stats=Fill Profile Stats
Flush Log=Flush Log Flush Log=Flush Log
+1
View File
@@ -2022,6 +2022,7 @@ public:
ADD_METHOD( effectcolor2 ); ADD_METHOD( effectcolor2 );
ADD_METHOD( effectperiod ); ADD_METHOD( effectperiod );
ADD_METHOD( effecttiming ); ADD_METHOD( effecttiming );
ADD_METHOD(effect_hold_at_full);
ADD_METHOD( effectoffset ); ADD_METHOD( effectoffset );
ADD_METHOD( effectclock ); ADD_METHOD( effectclock );
ADD_METHOD( effectmagnitude ); ADD_METHOD( effectmagnitude );
+20
View File
@@ -564,6 +564,7 @@ static LocalizedString SCREEN_OFF ( "ScreenDebugOverlay", "Send Off To Screen"
static LocalizedString RELOAD_OVERLAY_SCREENS( "ScreenDebugOverlay", "Reload Overlay Screens" ); static LocalizedString RELOAD_OVERLAY_SCREENS( "ScreenDebugOverlay", "Reload Overlay Screens" );
static LocalizedString TOGGLE_ERRORS( "ScreenDebugOverlay", "Toggle Errors" ); static LocalizedString TOGGLE_ERRORS( "ScreenDebugOverlay", "Toggle Errors" );
static LocalizedString CLEAR_ERRORS( "ScreenDebugOverlay", "Clear Errors" ); static LocalizedString CLEAR_ERRORS( "ScreenDebugOverlay", "Clear Errors" );
static LocalizedString CONVERT_XML( "ScreenDebugOverlay", "Convert XML" );
static LocalizedString RELOAD_THEME_AND_TEXTURES( "ScreenDebugOverlay", "Reload Theme and Textures" ); static LocalizedString RELOAD_THEME_AND_TEXTURES( "ScreenDebugOverlay", "Reload Theme and Textures" );
static LocalizedString WRITE_PROFILES ( "ScreenDebugOverlay", "Write Profiles" ); static LocalizedString WRITE_PROFILES ( "ScreenDebugOverlay", "Write Profiles" );
static LocalizedString WRITE_PREFERENCES ( "ScreenDebugOverlay", "Write Preferences" ); static LocalizedString WRITE_PREFERENCES ( "ScreenDebugOverlay", "Write Preferences" );
@@ -1115,6 +1116,24 @@ class DebugLineClearErrors : public IDebugLine
} }
}; };
void convert_xmls_in_dir(RString const& dirname);
class DebugLineConvrtXML : public IDebugLine
{
virtual RString GetDisplayTitle() { return CONVERT_XML.GetValue(); }
virtual RString GetDisplayValue() { return RString(); }
virtual bool IsEnabled() { return true; }
virtual RString GetPageName() const { return "Theme"; }
virtual void DoAndLog( RString &sMessageOut )
{
Song* cur_song= GAMESTATE->m_pCurSong;
if(cur_song)
{
convert_xmls_in_dir(cur_song->GetSongDir() + "/");
IDebugLine::DoAndLog(sMessageOut);
}
}
};
class DebugLineWriteProfiles : public IDebugLine class DebugLineWriteProfiles : public IDebugLine
{ {
virtual RString GetDisplayTitle() { return WRITE_PROFILES.GetValue(); } virtual RString GetDisplayTitle() { return WRITE_PROFILES.GetValue(); }
@@ -1300,6 +1319,7 @@ DECLARE_ONE( DebugLineReloadTheme );
DECLARE_ONE( DebugLineReloadOverlayScreens ); DECLARE_ONE( DebugLineReloadOverlayScreens );
DECLARE_ONE( DebugLineToggleErrors ); DECLARE_ONE( DebugLineToggleErrors );
DECLARE_ONE( DebugLineClearErrors ); DECLARE_ONE( DebugLineClearErrors );
DECLARE_ONE( DebugLineConvrtXML );
DECLARE_ONE( DebugLineWriteProfiles ); DECLARE_ONE( DebugLineWriteProfiles );
DECLARE_ONE( DebugLineWritePreferences ); DECLARE_ONE( DebugLineWritePreferences );
DECLARE_ONE( DebugLineMenuTimer ); DECLARE_ONE( DebugLineMenuTimer );
+13 -17
View File
@@ -492,6 +492,7 @@ void actor_template_t::load_node(XNode const& node, RString const& dirname, cond
{ {
type= node.GetName(); type= node.GetName();
bool type_set_by_automagic= false; bool type_set_by_automagic= false;
#define set_type(auto_type) type_set_by_automagic= true; type= auto_type;
FOREACH_CONST_Attr(&node, attr) FOREACH_CONST_Attr(&node, attr)
{ {
if(attr->first == "Name") if(attr->first == "Name")
@@ -525,6 +526,11 @@ void actor_template_t::load_node(XNode const& node, RString const& dirname, cond
// Ignore. This attribute seems to be put in by the xml parser, and // Ignore. This attribute seems to be put in by the xml parser, and
// not part of the actual xml code. // not part of the actual xml code.
} }
else if(attr->first == "Text")
{
set_type("BitmapText");
store_field(attr->first, attr->second, true);
}
else if(attr->first == "File") else if(attr->first == "File")
{ {
RString relative_path; RString relative_path;
@@ -532,7 +538,7 @@ void actor_template_t::load_node(XNode const& node, RString const& dirname, cond
RString sfname= dirname + relative_path; RString sfname= dirname + relative_path;
if(FILEMAN->IsADirectory(sfname)) if(FILEMAN->IsADirectory(sfname))
{ {
type= "LoadActor"; set_type("LoadActor");
store_field("File", attr->second, false); store_field("File", attr->second, false);
} }
else else
@@ -553,7 +559,7 @@ void actor_template_t::load_node(XNode const& node, RString const& dirname, cond
case FT_Xml: case FT_Xml:
this_relative= SetExtension(this_relative, "lua"); this_relative= SetExtension(this_relative, "lua");
case FT_Lua: case FT_Lua:
type= "LoadActor"; set_type("LoadActor");
store_field("File", this_relative, false); store_field("File", this_relative, false);
handled_level= 2; handled_level= 2;
break; break;
@@ -563,23 +569,23 @@ void actor_template_t::load_node(XNode const& node, RString const& dirname, cond
case FT_Movie: case FT_Movie:
if(handled_level < 2) if(handled_level < 2)
{ {
type= "Sprite"; set_type("Sprite");
store_field("File", this_relative, false); store_field("File", this_relative, false);
handled_level= 1; handled_level= 1;
} }
break; break;
case FT_Sound: case FT_Sound:
type= "ActorSound"; set_type("ActorSound");
store_field("File", this_relative, false); store_field("File", this_relative, false);
handled_level= 1; handled_level= 1;
break; break;
case FT_Sprite: case FT_Sprite:
type= "Sprite"; set_type("Sprite");
load_frames_from_file(dirname + this_relative, Dirname(relative_path)); load_frames_from_file(dirname + this_relative, Dirname(relative_path));
handled_level= 2; handled_level= 2;
break; break;
case FT_Model: case FT_Model:
type= "Model"; set_type("Model");
store_field("Meshes", this_relative, false); store_field("Meshes", this_relative, false);
store_field("Materials", this_relative, false); store_field("Materials", this_relative, false);
store_field("Bones", this_relative, false); store_field("Bones", this_relative, false);
@@ -590,7 +596,7 @@ void actor_template_t::load_node(XNode const& node, RString const& dirname, cond
{ {
if(extension == "model") if(extension == "model")
{ {
type= "Model"; set_type("Model");
load_model_from_file(dirname + this_relative, Dirname(relative_path)); load_model_from_file(dirname + this_relative, Dirname(relative_path));
handled_level= 2; handled_level= 2;
} }
@@ -611,16 +617,6 @@ void actor_template_t::load_node(XNode const& node, RString const& dirname, cond
} }
} }
} }
// else if(attr->first.Right(1) == "X")
// {
// attr->second->GetValue(x);
// x= maybe_conv_pos(x, convert_xpos);
// }
// else if(attr->first.Right(1) == "Y")
// {
// attr->second->GetValue(y);
// y= maybe_conv_pos(y, convert_ypos);
// }
else else
{ {
store_field(attr->first, attr->second, true); store_field(attr->first, attr->second, true);