49 const std::string& field_name,
const std::vector<std::string>& field_id_to_name_lookup,
69 unsigned int map_id,
const std::string& entity,
70 const std::string& function_name,
unsigned int address
73 field_name_ +
"_" + entity +
"_" + function_name +
"_addr_" + std::to_string(address);
82 virtual std::string
GetMapName(
unsigned int map_id)
override{
95 unsigned int bank,
unsigned int addr
131 const std::string& entity,
const std::string& function_name
147 const std::string& entity,
const std::string& function_name
185 const std::string& field_name,
const std::vector<std::string>& field_id_to_name_lookup,
209 unsigned int map_id,
const std::string& entity,
const std::string& function_name,
210 unsigned int address,
int x,
int y,
int z,
int angle
228 it->second.gateways_to_this_field.push_back(rec);
272 const std::vector<std::string>& field_id_to_name_lookup,
291 if (
static_cast<unsigned int>(char_id) >=
model_loader_->GetModels().size()){
292 std::cerr <<
"FF7FieldScriptFormatter::AnimationName ERROR:"
293 <<
"Char ID " << char_id <<
" out of bounds" << std::endl;
294 return std::to_string(
id);
296 const auto& model_info =
model_loader_->GetModels().at(char_id);
297 if (
static_cast<unsigned int>(
id) >= model_info.animations.size()){
298 std::cerr <<
"FF7FieldScriptFormatter::AnimationName ERROR:"
299 <<
"In field " <<
field_name_ <<
" the model " << model_info.name
300 <<
" animation with ID " <<
id <<
" is out of bounds ("
301 << model_info.animations.size() <<
")" << std::endl;
302 return std::to_string(
id);
304 const auto raw_name = model_info.animations.at(
id).name;
308 VGears::StringUtil::toLowerCase(base_name);
384 void Write(
int field_index);
422 const std::string& gateway_entity_name,
const std::string& target_map_name,
423 const std::string& source_spawn_point_name
435 const std::string& name,
const std::vector<std::string>& field_id_to_name_lookup
485 const std::vector<std::string>& field_id_to_name_lookup
536 void ExportMesh(
const std::string outdir,
const Ogre::MeshPtr &mesh);
662 std::unique_ptr<TiXmlDocument>
doc_;
std::vector< std::string > MapList
Definition: FieldDataInstaller.h:31
std::map< u16, float > FieldScaleFactorMap
Definition: FieldDataInstaller.h:35
std::map< u16, SpawnPointDb > FieldSpawnPointsMap
Definition: FieldDataInstaller.h:33
Handles the script gateway colection.
Definition: FieldDataInstaller.h:175
size_t field_id_
The field map ID.
Definition: FieldDataInstaller.h:251
FF7FieldScriptGatewayCollector(const std::string &field_name, const std::vector< std::string > &field_id_to_name_lookup, FieldSpawnPointsMap &spawn_points, size_t this_field_id)
Cosntructor.
Definition: FieldDataInstaller.h:184
virtual void AddSpawnPoint(unsigned int map_id, const std::string &entity, const std::string &function_name, unsigned int address, int x, int y, int z, int angle) override
Adds an spawn point.
Definition: FieldDataInstaller.h:208
Definition: FieldDataInstaller.h:320
VGears::FLevelFilePtr field_
Field currently being processed.
Definition: FieldDataInstaller.h:650
FieldTextWriter field_text_writer_
Field text writer.
Definition: FieldDataInstaller.h:689
MapList::iterator converted_map_list_iterator_
Iterator for {.
Definition: FieldDataInstaller.h:645
std::string output_dir_
The path to the directory where to save the V-Gears data.
Definition: FieldDataInstaller.h:579
ModelAnimationMap::iterator model_animation_map_iterator_
Iterator for {.
Definition: FieldDataInstaller.h:674
size_t progress_step_num_elements_
Helper variable to indicate internal progress of installation steps.
Definition: FieldDataInstaller.h:589
static void CollectFieldScaleFactors(VGears::FLevelFilePtr &field, FieldScaleFactorMap &scale_factors, const std::vector< std::string > &field_id_to_name_lookup)
Collects the scale factor from a map.
Definition: FieldDataInstaller.cpp:150
void WriteEnd()
Cleans up after {.
Definition: FieldDataInstaller.cpp:297
static bool IsAFieldFile(const Ogre::String &resource_name)
Checks if a file is a field file.
Definition: FieldDataInstaller.cpp:74
static size_t GetFieldId(const std::string &name, const std::vector< std::string > &field_id_to_name_lookup)
Retrieves a field ID from a name.
Definition: FieldDataInstaller.cpp:66
std::vector< std::string > map_list_
The list of maps.
Definition: FieldDataInstaller.h:620
FieldDataInstaller(const std::string input_dir, const std::string output_dir)
Installer constructor.
Definition: FieldDataInstaller.cpp:210
std::vector< int > ExtractMusicTrackIds(VGears::FLevelFilePtr &field)
Reads the music track IDs from a specific field.
Definition: FieldDataInstaller.cpp:469
static bool IsTestField(const Ogre::String &resource_name)
Checks if a map is a test field.
Definition: FieldDataInstaller.cpp:101
FieldScaleFactorMap scale_factors_
Map of th collected scale factors.
Definition: FieldDataInstaller.h:630
int CollectSpawnAndScaleFactorsInit(Ogre::ResourceGroupManager *res_mgr)
Initializer for {.
Definition: FieldDataInstaller.cpp:216
std::string input_dir_
The path to the directory from which to read the PC game data.
Definition: FieldDataInstaller.h:574
void PcFieldToVGearsField(VGears::FLevelFilePtr &field)
Converts a FFVII PC field to a V-Gears field.
Definition: FieldDataInstaller.cpp:488
void ConvertModels(std::string model_name)
Converts the field models to V-Gears format.
Definition: FieldDataInstaller.cpp:333
static int INACTIVE_GATEWAY_ID
Gateways to this map ID are considered to be inactive.
Definition: FieldDataInstaller.h:526
void CreateDir(const std::string &dir)
Creates a directory in the outputh path.
Definition: FieldDataInstaller.cpp:144
FieldSpawnPointsMap spawn_points_
Map of the collected spawn points.
Definition: FieldDataInstaller.h:625
Ogre::StringVectorPtr field_model_file_list_
List of model files.
Definition: FieldDataInstaller.h:655
static bool WillCrash(const Ogre::String &resource_name)
Checks if a map cause fatal crash bugs.
Definition: FieldDataInstaller.cpp:83
std::unique_ptr< ScopedLgp > fields_lgp_
LGP archive with field data.
Definition: FieldDataInstaller.h:599
void Convert(int field_index)
Converts FFVII PC fields to V-Gears format.
Definition: FieldDataInstaller.cpp:248
std::unique_ptr< ScopedLgp > textures_lgp_
LGP archive with texture data.
Definition: FieldDataInstaller.h:604
std::function< void(std::string)> set_progress_label_
Function used to print set the current installation progress text.
Definition: FieldDataInstaller.h:684
Ogre::StringVectorPtr flevel_file_list_
List of flevel files.
Definition: FieldDataInstaller.h:615
static std::string FIELD_MAPS_DIR
Path to the field maps directory.
Definition: FieldDataInstaller.h:521
void Write(int field_index)
Saves the game maps to XML files.
Definition: FieldDataInstaller.cpp:283
MapList converted_map_list_
List of converted maps.
Definition: FieldDataInstaller.h:640
size_t iterator_counter_
Iterator counter.
Definition: FieldDataInstaller.h:594
static std::string FIELD_MODELS_DIR
Path to the field models directory.
Definition: FieldDataInstaller.h:516
static std::string CreateGateWayScript(const std::string &gateway_entity_name, const std::string &target_map_name, const std::string &source_spawn_point_name)
Creates a gateway script.
Definition: FieldDataInstaller.cpp:36
std::unique_ptr< ScopedLgp > field_models_lgp_
LGP archive with field model data.
Definition: FieldDataInstaller.h:609
float GetFieldScaleFactor(size_t field_id)
Retrieves a field scale factor.
Definition: FieldDataInstaller.cpp:462
size_t conversion_step_
Helper variable to indicate internal progress of installation steps.
Definition: FieldDataInstaller.h:584
std::vector< std::string > ConvertModelsInit()
Initializer for {.
Definition: FieldDataInstaller.cpp:302
std::unique_ptr< TiXmlDocument > doc_
An XML document.
Definition: FieldDataInstaller.h:662
ModelsAndAnimationsDb used_models_and_anims_
ModelsAndAnimationsUsedByConvertedFields.
Definition: FieldDataInstaller.h:635
std::unique_ptr< TiXmlElement > element_
An XML element.
Definition: FieldDataInstaller.h:669
std::function< void(std::string)> write_output_line_
Function used to print text to the log output, line by line.
Definition: FieldDataInstaller.h:679
std::vector< std::string > materials_
Written materials.
Definition: FieldDataInstaller.h:694
void ExportMesh(const std::string outdir, const Ogre::MeshPtr &mesh)
Exports a mesh to a file.
Definition: FieldDataInstaller.cpp:367
int WriteInit()
Initializer for {.
Definition: FieldDataInstaller.cpp:277
void CollectSpawnAndScaleFactors(int field_index)
Reads spawn points and scale factors from flevel files.
Definition: FieldDataInstaller.cpp:228
static float LINE_SCALE_FACTOR
The scale factor for line point coordinates.
Definition: FieldDataInstaller.h:511
static void CollectSpawnPoints(VGears::FLevelFilePtr &field, const std::vector< std::string > &field_id_to_name_lookup, FieldSpawnPointsMap &spawn_points)
Collects the spawn point from a field.
Definition: FieldDataInstaller.cpp:158
~FieldDataInstaller()
Installer destructor.
Definition: FieldDataInstaller.cpp:214
Handles the.
Definition: FieldTextWriter.h:26
Database of model animations.
Definition: ModelsAndAnimationsDb.h:25
static String FieldScriptEntityName(const String &old_entity_name)
Matches entity names.
Definition: FF7NameLookup.h:422
static String FieldScriptVarName(int bank, int addr)
Retrieves a variable name.
Definition: FF7NameLookup.h:399
static String FieldScriptFunctionName(const String &field_name, const String &entity_name, const String &old_function_name)
Matches function names.
Definition: FF7NameLookup.h:463
static const String & Animation(const String &key)
Matches animation names.
Definition: FF7NameLookup.h:373
static String CharName(int char_id)
Retrieves a character name from an ID.
Definition: FF7NameLookup.h:354
static String FieldScriptFunctionComment(const String &field_name, const String &entity_name, const String &old_function_name)
Matches function comments.
Definition: FF7NameLookup.h:440
static void splitBase(const String &name, String &basename)
Extract a file name without extension.
Definition: VGearsStringUtil.cpp:25
Ogre::SharedPtr< ModelListFile > ModelListFilePtr
Definition: FF7ModelListFile.h:197
Ogre::String String
Definition: TypeDefine.h:37
Ogre::SharedPtr< FLevelFile > FLevelFilePtr
Definition: VGearsFLevelFile.h:303
A spawn point database record.
Definition: SpawnPointDb.h:34
u16 field_id
Field that links to {.
Definition: SpawnPointDb.h:39
std::string script_function_name
Definition: SpawnPointDb.h:68
std::string entity_name
Definition: SpawnPointDb.h:61
u32 gateway_index_or_map_jump_address
Index of the gateway in {.
Definition: SpawnPointDb.h:44
bool from_script
Indicates if the gateway is a map jump from a script.
Definition: SpawnPointDb.h:54
VGears::TriggersFile::Gateway gateway
Gateway data.
Definition: SpawnPointDb.h:49
A database of spawn points.
Definition: SpawnPointDb.h:21
std::vector< Record > gateways_to_this_field
List of gateways to this field.
Definition: SpawnPointDb.h:74
u16 target_field_id
Field IDs.
Definition: SpawnPointDb.h:29
A gateway.
Definition: VGearsTriggersFile.h:179
u16 destination_field_id
ID of the destination field.
Definition: VGearsTriggersFile.h:194
TriggerVertex destination
The destination point in the target map.
Definition: VGearsTriggersFile.h:189
u8 dir
Definition: VGearsTriggersFile.h:199
s16 y
Y coordinate.
Definition: VGearsTriggersFile.h:166
s16 z
Z coordinate.
Definition: VGearsTriggersFile.h:171
s16 x
X coordinate.
Definition: VGearsTriggersFile.h:161