/** * Reads Map Tree. */ void RawStruct<RPG::TreeMap>::ReadLcf(RPG::TreeMap& ref, LcfReader& stream, uint32_t /* length */) { Struct<RPG::MapInfo>::ReadLcf(ref.maps, stream); for (int i = stream.ReadInt(); i > 0; i--) ref.tree_order.push_back(stream.ReadInt()); ref.active_node = stream.ReadInt(); Struct<RPG::Start>::ReadLcf(ref.start, stream); }
/** * Reads Event Command. */ void RawStruct<RPG::EventCommand>::ReadLcf(RPG::EventCommand& event_command, LcfReader& stream, uint32_t /* length */) { stream.Read(event_command.code); if (event_command.code != 0) { stream.Read(event_command.indent); stream.ReadString(event_command.string, stream.ReadInt()); for (int i = stream.ReadInt(); i > 0; i--) { event_command.parameters.push_back(stream.ReadInt()); } } }
void Struct<S>::ReadLcf(std::vector<S>& vec, LcfReader& stream) { int count = stream.ReadInt(); vec.resize(count); for (int i = 0; i < count; i++) { IDReader::ReadID(vec[i], stream); TypeReader<S>::ReadLcf(vec[i], stream, 0); } }
/** * Reads Move Command. */ void RawStruct<RPG::MoveCommand>::ReadLcf(RPG::MoveCommand& ref, LcfReader& stream, uint32_t /* length */) { ref.command_id = stream.ReadInt(); switch (ref.command_id) { case RPG::MoveCommand::Code::switch_on: stream.Read(ref.parameter_a); break; case RPG::MoveCommand::Code::switch_off: stream.Read(ref.parameter_a); break; case RPG::MoveCommand::Code::change_graphic: stream.ReadString(ref.parameter_string, stream.ReadInt()); stream.Read(ref.parameter_a); break; case RPG::MoveCommand::Code::play_sound_effect: stream.ReadString(ref.parameter_string, stream.ReadInt()); stream.Read(ref.parameter_a); stream.Read(ref.parameter_b); stream.Read(ref.parameter_c); break; } }
void Struct<S>::ReadLcf(S& obj, LcfReader& stream) { MakeFieldMap(); LcfReader::Chunk chunk_info; while (!stream.Eof()) { chunk_info.ID = stream.ReadInt(); if (chunk_info.ID == 0) break; chunk_info.length = stream.ReadInt(); if (chunk_info.length == 0) continue; typename field_map_type::const_iterator it = field_map.find(chunk_info.ID); if (it != field_map.end()) { //printf("%s\n", it->second->name); it->second->ReadLcf(obj, stream, chunk_info.length); } else stream.Skip(chunk_info); } }