diff --git a/CMakeLists.txt b/CMakeLists.txt index 7ec059bf..30a30559 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -41,8 +41,8 @@ set(LCF_SOURCES src/lmu_movecommand.cpp src/lmu_reader.cpp src/log.h - src/lsd_reader.cpp src/log_handler.cpp + src/lsd_reader.cpp src/reader_flags.cpp src/reader_lcf.cpp src/reader_struct.h @@ -54,6 +54,8 @@ set(LCF_SOURCES src/saveopt.cpp src/writer_lcf.cpp src/writer_xml.cpp + src/generated/fwd_flags_impl.h + src/generated/fwd_flags_instance.h src/generated/fwd_struct_impl.h src/generated/ldb_actor.cpp src/generated/ldb_animation.cpp @@ -83,7 +85,7 @@ set(LCF_SOURCES src/generated/ldb_system.cpp src/generated/ldb_terms.cpp src/generated/ldb_terrain.cpp - src/generated/ldb_terrain_flags.h + src/generated/ldb_terrain_special_flags.h src/generated/ldb_testbattler.cpp src/generated/ldb_troop.cpp src/generated/ldb_troopmember.cpp @@ -109,10 +111,13 @@ set(LCF_SOURCES src/generated/lsd_saveeasyrpgwindow.cpp src/generated/lsd_saveeasyrpgwindow_flags.h src/generated/lsd_saveeventexecframe.cpp + src/generated/lsd_saveeventexecframe_easyrpg_runtime_flags.h src/generated/lsd_saveeventexecstate.cpp + src/generated/lsd_saveeventexecstate_easyrpg_runtime_flags.h src/generated/lsd_saveinventory.cpp src/generated/lsd_savemapevent.cpp src/generated/lsd_savemapeventbase.cpp + src/generated/lsd_savemapeventbase_easyrpg_runtime_flags.h src/generated/lsd_savemapinfo.cpp src/generated/lsd_savepanorama.cpp src/generated/lsd_savepartylocation.cpp @@ -205,8 +210,8 @@ set(LCF_HEADERS src/lcf/ldb/reader.h src/lcf/lmt/reader.h src/lcf/lmu/reader.h - src/lcf/lsd/reader.h src/lcf/log_handler.h + src/lcf/lsd/reader.h src/lcf/reader_lcf.h src/lcf/reader_util.h src/lcf/reader_xml.h diff --git a/Makefile.am b/Makefile.am index 7f0d4953..b6585257 100644 --- a/Makefile.am +++ b/Makefile.am @@ -58,8 +58,8 @@ liblcf_la_SOURCES = \ src/lmu_movecommand.cpp \ src/lmu_reader.cpp \ src/log.h \ - src/lsd_reader.cpp \ src/log_handler.cpp \ + src/lsd_reader.cpp \ src/reader_flags.cpp \ src/reader_lcf.cpp \ src/reader_struct.h \ @@ -71,6 +71,8 @@ liblcf_la_SOURCES = \ src/saveopt.cpp \ src/writer_lcf.cpp \ src/writer_xml.cpp \ + src/generated/fwd_flags_impl.h \ + src/generated/fwd_flags_instance.h \ src/generated/fwd_struct_impl.h \ src/generated/ldb_actor.cpp \ src/generated/ldb_animation.cpp \ @@ -100,7 +102,7 @@ liblcf_la_SOURCES = \ src/generated/ldb_system.cpp \ src/generated/ldb_terms.cpp \ src/generated/ldb_terrain.cpp \ - src/generated/ldb_terrain_flags.h \ + src/generated/ldb_terrain_special_flags.h \ src/generated/ldb_testbattler.cpp \ src/generated/ldb_troop.cpp \ src/generated/ldb_troopmember.cpp \ @@ -126,10 +128,13 @@ liblcf_la_SOURCES = \ src/generated/lsd_saveeasyrpgwindow.cpp \ src/generated/lsd_saveeasyrpgwindow_flags.h \ src/generated/lsd_saveeventexecframe.cpp \ + src/generated/lsd_saveeventexecframe_easyrpg_runtime_flags.h \ src/generated/lsd_saveeventexecstate.cpp \ + src/generated/lsd_saveeventexecstate_easyrpg_runtime_flags.h \ src/generated/lsd_saveinventory.cpp \ src/generated/lsd_savemapevent.cpp \ src/generated/lsd_savemapeventbase.cpp \ + src/generated/lsd_savemapeventbase_easyrpg_runtime_flags.h \ src/generated/lsd_savemapinfo.cpp \ src/generated/lsd_savepanorama.cpp \ src/generated/lsd_savepartylocation.cpp \ diff --git a/builds/sources2buildsystem.pl b/builds/sources2buildsystem.pl index 18c6c9ad..a9a495c4 100755 --- a/builds/sources2buildsystem.pl +++ b/builds/sources2buildsystem.pl @@ -2,7 +2,7 @@ # sources2buildsystem.pl - maintainer utility script to keep the # source/header file list for our build systems organized and up-to-date. -# by carstene1ns 2018-2021, released under the MIT license +# by carstene1ns 2018-2025, released under the MIT license use strict; use warnings; @@ -22,7 +22,7 @@ @files = (@others, @generated, @third_party); # split source and headers -my $regex = '(\.cpp|_flags\.h|_impl\.h|src\/[^\/]*\.h)$'; +my $regex = '(\.cpp|_flags\.h|fwd_.*\.h|src\/[^\/]*\.h)$'; my @sources = grep( /$regex/, @files); my @headers = grep(!/$regex/, @files); @@ -57,6 +57,7 @@ sub wanted { return unless -f; return unless /\.(cpp|h)$/; + return if /inireader/; push @files, $File::Find::name; } diff --git a/generator/csv/enums_easyrpg.csv b/generator/csv/enums_easyrpg.csv index 7f42c73c..7125767d 100644 --- a/generator/csv/enums_easyrpg.csv +++ b/generator/csv/enums_easyrpg.csv @@ -1,7 +1,6 @@ Structure,Entry,Value,Index EventCommand,Code,EasyRpg_TriggerEventAt,2002 -EventCommand,Code,EasyRpg_SmartMoveRoute,2003 -EventCommand,Code,EasyRpg_SmartStepToward,2004 +EventCommand,Code,EasyRpg_Pathfinder,2003 EventCommand,Code,EasyRpg_CallMovementAction,2050 EventCommand,Code,EasyRpg_WaitForSingleMovement,2051 EventCommand,Code,EasyRpg_AnimateVariable,2052 diff --git a/generator/csv/fields_easyrpg.csv b/generator/csv/fields_easyrpg.csv index 44fb0b09..408fd0b8 100644 --- a/generator/csv/fields_easyrpg.csv +++ b/generator/csv/fields_easyrpg.csv @@ -8,9 +8,11 @@ SaveEventExecFrame,maniac_event_id,f,Int32,0x0F,0,0,0,Event ID SaveEventExecFrame,maniac_event_page_id,f,Int32,0x10,0,0,0,Page ID when it is a map event SaveEventExecFrame,maniac_loop_info_size,f,Int32,0x11,0,0,0,Amount of loop info groups SaveEventExecFrame,maniac_loop_info,f,Vector,0x12,,0,0,"One group of (Current loop count, end loop value) for each identation" +SaveEventExecFrame,easyrpg_runtime_flags,f,EasyRpgFrameRuntime_Flags,0xCC,0,0,0,Runtime changes to the engine config SaveEventExecState,easyrpg_active,f,Boolean,0xC9,False,0,0,When true state of an event is preserved in easyrpg_string and easyrpg_parameters SaveEventExecState,easyrpg_string,f,DBString,0xCA,,0,0,Preserved string data of an event SaveEventExecState,easyrpg_parameters,f,Vector,0xCB,,0,0,Preserved int parameter of an event +SaveEventExecState,easyrpg_runtime_flags,f,EasyRpgStateRuntime_Flags,0xCC,0,0,0,Runtime changes to the engine config SavePicture,easyrpg_flip,f,Enum,0xC8,0,0,1,How to flip the picture SavePicture,easyrpg_blend_mode,f,Int32,0xC9,0,0,1,Blend mode to use for blit. See Bitmap::BlendMode SavePicture,easyrpg_type,f,Enum,0xCA,0,0,1,Type of this picture @@ -31,6 +33,9 @@ SaveEasyRpgText,letter_spacing,f,Int32,0x06,0,0,0,Additional spacing between let SaveEasyRpgText,line_spacing,f,Int32,0x07,4,0,0,Additional spacing between lines SaveEasyRpgText,flags,f,SaveEasyRpgText_Flags,0x08,3,0,0,Various text settings SaveMapEventBase,easyrpg_move_failure_count,f,Int32,0xC9,0,0,0,Tracks how often the current move operation in a move route failed +SaveMapEventBase,easyrpg_clone_map_id,f,UInt32,0xCA,0,0,0,The original map id of a cloned event +SaveMapEventBase,easyrpg_clone_event_id,f,UInt32,0xCB,0,0,0,The original event id of a cloned event +SaveMapEventBase,easyrpg_runtime_flags,f,EasyRpgEventRuntime_Flags,0xCC,0,0,0,Runtime changes to the engine config SavePartyLocation,maniac_horizontal_pan_speed,f,Double,0x8D,0,0,0,horizontal speed in the scrolls of the screen SavePartyLocation,maniac_vertical_pan_speed,f,Double,0x8E,0,0,0,vertical speed in the scrolls of the screen SaveSystem,maniac_strings,f,Vector,0x24,,0,0,rpg::Strings diff --git a/generator/csv/flags_easyrpg.csv b/generator/csv/flags_easyrpg.csv index 6e1a6c92..892b94dc 100644 --- a/generator/csv/flags_easyrpg.csv +++ b/generator/csv/flags_easyrpg.csv @@ -5,3 +5,25 @@ SaveEasyRpgText,draw_gradient,0 SaveEasyRpgText,draw_shadow,0 SaveEasyRpgText,bold,0 SaveEasyRpgText,italic,0 +EasyRpgFrameRuntime,reserved_1,0 +EasyRpgEventRuntime,reserved_1,0 +EasyRpgStateRuntime,conf_override_active,0 +EasyRpgStateRuntime,reserved_1,0 +EasyRpgStateRuntime,reserved_2,0 +EasyRpgStateRuntime,reserved_3,0 +EasyRpgStateRuntime,patch_destiny_on,0 +EasyRpgStateRuntime,patch_destiny_off,0 +EasyRpgStateRuntime,patch_dynrpg_on,0 +EasyRpgStateRuntime,patch_dynrpg_off,0 +EasyRpgStateRuntime,patch_maniac_on,0 +EasyRpgStateRuntime,patch_maniac_off,0 +EasyRpgStateRuntime,patch_common_this_event_on,0 +EasyRpgStateRuntime,patch_common_this_event_off,0 +EasyRpgStateRuntime,patch_unlock_pics_on,0 +EasyRpgStateRuntime,patch_unlock_pics_off,0 +EasyRpgStateRuntime,patch_keypatch_on,0 +EasyRpgStateRuntime,patch_keypatch_off,0 +EasyRpgStateRuntime,patch_rpg2k3_cmds_on,0 +EasyRpgStateRuntime,patch_rpg2k3_cmds_off,0 +EasyRpgStateRuntime,use_rpg2k_battle_system_on,0 +EasyRpgStateRuntime,use_rpg2k_battle_system_off,0 diff --git a/generator/generate.py b/generator/generate.py index cd500cbe..4afad371 100755 --- a/generator/generate.py +++ b/generator/generate.py @@ -90,16 +90,20 @@ def cpp_type(ty, prefix=True): m = re.match(r'(.*)_Flags$', ty) if m: - ty = m.expand(r'\1::Flags') - if prefix: - ty = 'rpg::' + ty - return ty + raise ValueError("use flag_type for flags") if prefix: ty = 'rpg::' + ty return ty +def flag_type(field, struct_name): + field_type = field.type + # Backward compatibility: When Struct Name = Flag Name only emit "Flags" + if struct_name == field.type[:-6]: + field_type = "Flags" + return field_type + def pod_default(field): dfl = field.default ftype = field.type @@ -133,9 +137,6 @@ def pod_default(field): return " = " + str(dfl) -def num_flags(flag): - return len(flag) - def flag_size(flag): return (len(flag) + 7) // 8 @@ -149,6 +150,9 @@ def flag_set(field, bit): return str(res).lower() +def flags_for(field): + return flags[field.type[:-6]] + def filter_structs_without_codes(structs): for struct in structs: if all(f.code for f in sfields[struct.name]): @@ -392,11 +396,14 @@ def type_is_array_of_struct(ty): def is_monotonic_from_0(enum): expected = 0 for (val, idx) in enum: - if int(idx) != expected: + if int(idx, 0) != expected: return False expected += 1 return True +def is_scoped_enum(enum_name): + return enum_name == "Code" + def openToRender(path): subdir = os.path.dirname(path) if not os.path.exists(subdir): @@ -426,6 +433,8 @@ def generate(): structs=sorted([x.name for x in structs_flat]) )) + flag_fields = [] + for filetype, structlist in structs.items(): for struct in structlist: filename = struct.name.lower() @@ -442,8 +451,8 @@ def generate(): type=filetype )) - - filepath = os.path.join(tmp_dir, 'lcf', 'rpg', '%s.h' % filename) + struct_header = os.path.join('lcf', 'rpg', '%s.h' % filename) + filepath = os.path.join(tmp_dir, struct_header) with openToRender(filepath) as f: f.write(rpg_header_tmpl.render( struct_name=struct.name, @@ -459,14 +468,33 @@ def generate(): filename=filename )) - if struct.name in flags: - filepath = os.path.join(tmp_dir, '%s_%s_flags.h' % (filetype, filename)) + struct_flag_fields = [s for s in sfields[struct.name] if s.type.endswith("_Flags")] + for flag_field in struct_flag_fields: + header_file = '%s_%s_%s.h' % (filetype, filename, flag_field.name) + filepath = os.path.join(tmp_dir, header_file) + field_name = flag_type(flag_field, struct.name) + flag_fields.append(dict(struct_name=struct.name, struct_header=struct_header, field_name=field_name, flag_header=header_file)) + with openToRender(filepath) as f: f.write(flags_tmpl.render( - struct_name=struct.name, - type=filetype + struct_name=flag_fields[-1]["struct_name"], + type=filetype, + flag_name=flag_fields[-1]["field_name"], + flag_item=flags[flag_field.type[:-6]] )) + filepath = os.path.join(tmp_dir, 'fwd_flags_impl.h') + with openToRender(filepath) as f: + f.write(flags_fwd_tmpl.render( + flags=flag_fields + )) + + filepath = os.path.join(tmp_dir, 'fwd_flags_instance.h') + with openToRender(filepath) as f: + f.write(flags_instance_tmpl.render( + flags=flag_fields + )) + for dirname, subdirlist, filelist in os.walk(tmp_dir, topdown=False): subdir = os.path.relpath(dirname, tmp_dir) @@ -486,7 +514,7 @@ def main(argv): os.mkdir(dest_dir) global structs, structs_flat, sfields, enums, flags, functions, constants, headers - global chunk_tmpl, lcf_struct_tmpl, rpg_header_tmpl, rpg_source_tmpl, flags_tmpl, enums_tmpl, fwd_tmpl, fwd_struct_tmpl + global chunk_tmpl, lcf_struct_tmpl, rpg_header_tmpl, rpg_source_tmpl, flags_tmpl, flags_fwd_tmpl, flags_instance_tmpl, enums_tmpl, fwd_tmpl, fwd_struct_tmpl structs, structs_flat = get_structs('structs.csv', 'structs_easyrpg.csv') sfields = get_fields('fields.csv', 'fields_easyrpg.csv') @@ -499,15 +527,17 @@ def main(argv): # Setup Jinja env.filters["lcf_type"] = lcf_type env.filters["cpp_type"] = cpp_type + env.filters["flag_type"] = flag_type env.filters["pod_default"] = pod_default env.filters["struct_has_code"] = filter_structs_without_codes env.filters["field_is_used"] = filter_unused_fields env.filters["field_is_written"] = filter_unwritten_fields env.filters["field_is_not_size"] = filter_size_fields - env.filters["num_flags"] = num_flags env.filters["flag_size"] = flag_size env.filters["flag_set"] = flag_set + env.filters["flags_for"] = flags_for env.tests['monotonic_from_0'] = is_monotonic_from_0 + env.tests['scoped_enum'] = is_scoped_enum env.tests['is_db_string'] = type_is_db_string env.tests['is_array'] = type_is_array env.tests['is_array_of_struct'] = type_is_array_of_struct @@ -529,6 +559,8 @@ def main(argv): rpg_header_tmpl = env.get_template('rpg_header.tmpl', globals=globals) rpg_source_tmpl = env.get_template('rpg_source.tmpl', globals=globals) flags_tmpl = env.get_template('flag_reader.tmpl', globals=globals) + flags_fwd_tmpl = env.get_template('flag_fwd.tmpl', globals=globals) + flags_instance_tmpl = env.get_template('flag_instance.tmpl', globals=globals) fwd_tmpl = env.get_template('fwd.tmpl', globals=globals) fwd_struct_tmpl = env.get_template('fwd_struct.tmpl', globals=globals) diff --git a/generator/templates/chunks.tmpl b/generator/templates/chunks.tmpl index 328b2106..27174bf7 100644 --- a/generator/templates/chunks.tmpl +++ b/generator/templates/chunks.tmpl @@ -1,3 +1,6 @@ +{# +This template is used for the chunks.h files +-#} {% include "copyright.tmpl" %} #ifndef LCF_{{ type|upper }}_CHUNKS_H #define LCF_{{ type|upper }}_CHUNKS_H diff --git a/generator/templates/flag_fwd.tmpl b/generator/templates/flag_fwd.tmpl new file mode 100644 index 00000000..d2cf9f97 --- /dev/null +++ b/generator/templates/flag_fwd.tmpl @@ -0,0 +1,13 @@ +{# +This template generates "fwd_flags_impl.h" which is included by "reader_struct.h" +and is used to declare the templates used by "Flags" +-#} +{% include "copyright.tmpl" %} + +{%- for flag in flags %} +#include "{{ flag.struct_header }}" +{%- endfor %} + +{%- for flag in flags %} +template <> struct lcf::TypeCategory { static const lcf::Category::Index value = lcf::Category::Flags; }; +{%- endfor %} diff --git a/generator/templates/flag_instance.tmpl b/generator/templates/flag_instance.tmpl new file mode 100644 index 00000000..e7b0e274 --- /dev/null +++ b/generator/templates/flag_instance.tmpl @@ -0,0 +1,15 @@ +{# +This template generates "fwd_flags_instance.h" which is included by "reader_flags.cpp" +to instantiate the templates used by "Flags" +-#} +{% include "copyright.tmpl" %} + +{%- for flag in flags %} +#include "{{ flag.flag_header }}" +{%- endfor %} + +namespace lcf { +{%- for flag in flags %} +template class Flags; +{%- endfor %} +} diff --git a/generator/templates/flag_reader.tmpl b/generator/templates/flag_reader.tmpl index 2e77db97..2d807093 100644 --- a/generator/templates/flag_reader.tmpl +++ b/generator/templates/flag_reader.tmpl @@ -1,3 +1,7 @@ +{# +This template generates "*_flags.h" which is used to define the classes used +by flags. Flags are classes that encode bitfields using bools. +-#} {% include "copyright.tmpl" %} /* * Headers @@ -11,18 +15,18 @@ namespace lcf { // Read {{ struct_name }}. template <> -char const* const Flags::name = "{{ struct_name }}_Flags"; +char const* const Flags::name = "{{ struct_name }}_{{ flag_name }}"; template <> -decltype(Flags::flag_names) Flags::flag_names = { -{%- for flag in flags[struct_name] %} +decltype(Flags::flag_names) Flags::flag_names = { +{%- for flag in flag_item %} "{{ flag.field }}"{%- if not loop.last %}, {%- endif %} {%- endfor %} }; template <> -decltype(Flags::flags_is2k3) Flags::flags_is2k3 = { -{%- for flag in flags[struct_name] %} +decltype(Flags::flags_is2k3) Flags::flags_is2k3 = { +{%- for flag in flag_item %} {{ flag.is2k3 }}{%- if not loop.last %}, {%- endif %} {%- endfor %} }; diff --git a/generator/templates/fwd.tmpl b/generator/templates/fwd.tmpl index eec642a5..fb599aab 100644 --- a/generator/templates/fwd.tmpl +++ b/generator/templates/fwd.tmpl @@ -1,3 +1,7 @@ +{# +This template generates "fwd.h" which is installed as part of the library +and is used to forward declare all classes generated by liblcf. +-#} {% include "copyright.tmpl" %} #ifndef LCF_RPG_FWD_H #define LCF_RPG_FWD_H diff --git a/generator/templates/fwd_struct.tmpl b/generator/templates/fwd_struct.tmpl index f53635a6..a76bd130 100644 --- a/generator/templates/fwd_struct.tmpl +++ b/generator/templates/fwd_struct.tmpl @@ -1,3 +1,7 @@ +{# +This template generates "fwd_struct_impl.h" which is included by "reader_struct_impl.h" +and is used to forward declare Struct::fields[] to reduce compile times. +-#} {% include "copyright.tmpl" %} // MSVC incorrectly treats these declarations as definitions and fails. #ifndef _MSC_VER diff --git a/generator/templates/reader.tmpl b/generator/templates/reader.tmpl index 6e59d24d..af590de3 100644 --- a/generator/templates/reader.tmpl +++ b/generator/templates/reader.tmpl @@ -1,3 +1,7 @@ +{# +This template generates the source files for the metadata of the chunk readers. +Files generated are "ldb/lmu/lsd/lmt_*.cpp" +-#} {% include "copyright.tmpl" %} // Headers #include "lcf/{{ type }}/reader.h" @@ -15,7 +19,11 @@ char const* const Struct::name = "{{ LCF_CURRENT_ {%- for field in fields[struct_base]|field_is_written|list + fields[struct_name]|field_is_written|list %} {%- if field|lcf_type in ["Typed", "DatabaseVersion"] %} +{%- if field.type.endswith("_Flags") %} +static {{ field|lcf_type }}Field static_{{ field.name }}( +{%- else %} static {{ field|lcf_type }}Field static_{{ field.name }}( +{%- endif %} &rpg::{{ LCF_CURRENT_STRUCT }}::{{ field.name }}, {{ LCF_CHUNK_SUFFIX }}::Chunk{{ LCF_CURRENT_STRUCT }}::{{ field.name }}, "{{ field.name }}", diff --git a/generator/templates/rpg_header.tmpl b/generator/templates/rpg_header.tmpl index ea8d899d..3f0a3536 100644 --- a/generator/templates/rpg_header.tmpl +++ b/generator/templates/rpg_header.tmpl @@ -1,3 +1,7 @@ +{# +This template generates the headers (*.h) for all the chunks in the "rpg" folder. +These are files for chunks like Actor, Class and Event. +-#} {% include "copyright.tmpl" %} #ifndef LCF_RPG_{{ struct_name|upper }}_H #define LCF_RPG_{{ struct_name|upper }}_H @@ -37,9 +41,9 @@ namespace rpg { {% endif %} {%- if struct_name in enums %} {%- for name, enum in enums[struct_name].items() %} - enum {% if name == "Code" -%} class {% endif -%} {{ name }} { + enum {% if name is scoped_enum -%} class {% endif -%} {{ name }} { {%- for field in enum %} - {%- if name != "Code" %} + {%- if name is not scoped_enum %} {{ name }}_{{ field.0 }} {%- else %} {{ field.0 }} @@ -55,7 +59,7 @@ namespace rpg { {%- else %} static constexpr auto k{{ name }}Tags = lcf::EnumTags{ {%- for field in enum %} - {%- if name != "Code" %} + {%- if name is not scoped_enum %} {{ name }}_{{ field.0 }}, "{{ field.0 }}"{%- if not loop.last %},{% endif %} {%- else %} {{ name }}::{{ field.0 }}, "{{ field.0 }}"{%- if not loop.last %},{% endif %} @@ -74,17 +78,17 @@ namespace rpg { {%- for field in fields[struct_name]|field_is_used %} {%- if not field.size %} {%- if field.type.endswith("_Flags") %} - struct Flags { + struct {{ field|flag_type(struct_name) }} { union { struct { - {%- for flag in flags[struct_name] %} + {%- for flag in field|flags_for %} bool {{ flag.field }}; {%- endfor %} }; - std::array flags; + std::array flags; }; - Flags() noexcept - {%- for flag in flags[struct_name] %} + {{ field|flag_type(struct_name) }}() noexcept + {%- for flag in field|flags_for %} {%- if loop.first %}:{%- else %},{%- endif %} {{ flag.field }}({{ field|flag_set(loop.index) }}) {%- endfor %} {} @@ -106,16 +110,17 @@ namespace rpg { {%- for field in fields[struct_name]|field_is_used %} {%- if not field.size %} {%- if field.type.endswith("_Flags") %} + {%- set field_type = field|flag_type(struct_name) %} - inline bool operator==(const {{ struct_name }}::Flags& l, const {{ struct_name }}::Flags& r) { + inline bool operator==(const {{ struct_name }}::{{ field_type }}& l, const {{ struct_name }}::{{ field_type }}& r) { return l.flags == r.flags; } - inline bool operator!=(const {{ struct_name }}::Flags& l, const {{ struct_name }}::Flags& r) { + inline bool operator!=(const {{ struct_name }}::{{ field_type }}& l, const {{ struct_name }}::{{ field_type }}& r) { return !(l == r); } - std::ostream& operator<<(std::ostream& os, const {{ struct_name }}::Flags& obj); + std::ostream& operator<<(std::ostream& os, const {{ struct_name }}::{{ field_type }}& obj); {%- endif %} {%- endif %} {%- endfor %} diff --git a/generator/templates/rpg_source.tmpl b/generator/templates/rpg_source.tmpl index 3092f37b..9d0847e2 100644 --- a/generator/templates/rpg_source.tmpl +++ b/generator/templates/rpg_source.tmpl @@ -1,3 +1,7 @@ +{# +This template generates the sources (*.cpp) for all the chunks in the "rpg" folder. +These are files for chunks like Actor, Class and Event. +-#} {% include "copyright.tmpl" %} // Headers #include "lcf/rpg/{{ filename }}.h" @@ -8,7 +12,7 @@ namespace rpg { {%- if not field.size %} {%- if field.type.endswith("_Flags") %} -std::ostream& operator<<(std::ostream& os, const {{ struct_name }}::Flags& obj) { +std::ostream& operator<<(std::ostream& os, const {{ struct_name }}::{{ field|flag_type(struct_name) }}& obj) { for (size_t i = 0; i < obj.flags.size(); ++i) { os << (i == 0 ? "[" : ", ") << obj.flags[i]; } diff --git a/src/generated/fwd_flags_impl.h b/src/generated/fwd_flags_impl.h new file mode 100644 index 00000000..6883f7ae --- /dev/null +++ b/src/generated/fwd_flags_impl.h @@ -0,0 +1,29 @@ +/* !!!! GENERATED FILE - DO NOT EDIT !!!! + * -------------------------------------- + * + * This file is part of liblcf. Copyright (c) liblcf authors. + * https://github.com/EasyRPG/liblcf - https://easyrpg.org + * + * liblcf is Free/Libre Open Source Software, released under the MIT License. + * For the full copyright and license information, please view the COPYING + * file that was distributed with this source code. + */ + +#include "lcf/rpg/trooppagecondition.h" +#include "lcf/rpg/terrain.h" +#include "lcf/rpg/eventpagecondition.h" +#include "lcf/rpg/savepicture.h" +#include "lcf/rpg/saveeventexecframe.h" +#include "lcf/rpg/saveeventexecstate.h" +#include "lcf/rpg/savemapeventbase.h" +#include "lcf/rpg/saveeasyrpgwindow.h" +#include "lcf/rpg/saveeasyrpgtext.h" +template <> struct lcf::TypeCategory { static const lcf::Category::Index value = lcf::Category::Flags; }; +template <> struct lcf::TypeCategory { static const lcf::Category::Index value = lcf::Category::Flags; }; +template <> struct lcf::TypeCategory { static const lcf::Category::Index value = lcf::Category::Flags; }; +template <> struct lcf::TypeCategory { static const lcf::Category::Index value = lcf::Category::Flags; }; +template <> struct lcf::TypeCategory { static const lcf::Category::Index value = lcf::Category::Flags; }; +template <> struct lcf::TypeCategory { static const lcf::Category::Index value = lcf::Category::Flags; }; +template <> struct lcf::TypeCategory { static const lcf::Category::Index value = lcf::Category::Flags; }; +template <> struct lcf::TypeCategory { static const lcf::Category::Index value = lcf::Category::Flags; }; +template <> struct lcf::TypeCategory { static const lcf::Category::Index value = lcf::Category::Flags; }; diff --git a/src/generated/fwd_flags_instance.h b/src/generated/fwd_flags_instance.h new file mode 100644 index 00000000..829ddd2d --- /dev/null +++ b/src/generated/fwd_flags_instance.h @@ -0,0 +1,32 @@ +/* !!!! GENERATED FILE - DO NOT EDIT !!!! + * -------------------------------------- + * + * This file is part of liblcf. Copyright (c) liblcf authors. + * https://github.com/EasyRPG/liblcf - https://easyrpg.org + * + * liblcf is Free/Libre Open Source Software, released under the MIT License. + * For the full copyright and license information, please view the COPYING + * file that was distributed with this source code. + */ + +#include "ldb_trooppagecondition_flags.h" +#include "ldb_terrain_special_flags.h" +#include "lmu_eventpagecondition_flags.h" +#include "lsd_savepicture_flags.h" +#include "lsd_saveeventexecframe_easyrpg_runtime_flags.h" +#include "lsd_saveeventexecstate_easyrpg_runtime_flags.h" +#include "lsd_savemapeventbase_easyrpg_runtime_flags.h" +#include "lsd_saveeasyrpgwindow_flags.h" +#include "lsd_saveeasyrpgtext_flags.h" + +namespace lcf { +template class Flags; +template class Flags; +template class Flags; +template class Flags; +template class Flags; +template class Flags; +template class Flags; +template class Flags; +template class Flags; +} diff --git a/src/generated/lcf/lsd/chunks.h b/src/generated/lcf/lsd/chunks.h index cfe92f27..1453bea9 100644 --- a/src/generated/lcf/lsd/chunks.h +++ b/src/generated/lcf/lsd/chunks.h @@ -410,6 +410,12 @@ namespace LSD_Reader { flash_time_left = 0x55, /** Tracks how often the current move operation in a move route failed */ easyrpg_move_failure_count = 0xC9, + /** The original map id of a cloned event */ + easyrpg_clone_map_id = 0xCA, + /** The original event id of a cloned event */ + easyrpg_clone_event_id = 0xCB, + /** Runtime changes to the engine config */ + easyrpg_runtime_flags = 0xCC, /** */ boarding = 0x65, /** */ @@ -530,6 +536,12 @@ namespace LSD_Reader { flash_time_left = 0x55, /** Tracks how often the current move operation in a move route failed */ easyrpg_move_failure_count = 0xC9, + /** The original map id of a cloned event */ + easyrpg_clone_map_id = 0xCA, + /** The original event id of a cloned event */ + easyrpg_clone_event_id = 0xCB, + /** Runtime changes to the engine config */ + easyrpg_runtime_flags = 0xCC, /** Which vehicle */ vehicle = 0x65, /** From 0 to 255 - In flying vehicles; remaining distance to ascend */ @@ -693,7 +705,9 @@ namespace LSD_Reader { /** Amount of loop info groups */ maniac_loop_info_size = 0x11, /** One group of (Current loop count, end loop value) for each identation */ - maniac_loop_info = 0x12 + maniac_loop_info = 0x12, + /** Runtime changes to the engine config */ + easyrpg_runtime_flags = 0xCC }; }; struct ChunkSaveEventExecState { @@ -747,7 +761,9 @@ namespace LSD_Reader { /** Preserved string data of an event */ easyrpg_string = 0xCA, /** Preserved int parameter of an event */ - easyrpg_parameters = 0xCB + easyrpg_parameters = 0xCB, + /** Runtime changes to the engine config */ + easyrpg_runtime_flags = 0xCC }; }; struct ChunkSaveMapEventBase { @@ -831,7 +847,13 @@ namespace LSD_Reader { /** int */ flash_time_left = 0x55, /** Tracks how often the current move operation in a move route failed */ - easyrpg_move_failure_count = 0xC9 + easyrpg_move_failure_count = 0xC9, + /** The original map id of a cloned event */ + easyrpg_clone_map_id = 0xCA, + /** The original event id of a cloned event */ + easyrpg_clone_event_id = 0xCB, + /** Runtime changes to the engine config */ + easyrpg_runtime_flags = 0xCC }; }; struct ChunkSaveMapEvent { @@ -916,6 +938,12 @@ namespace LSD_Reader { flash_time_left = 0x55, /** Tracks how often the current move operation in a move route failed */ easyrpg_move_failure_count = 0xC9, + /** The original map id of a cloned event */ + easyrpg_clone_map_id = 0xCA, + /** The original event id of a cloned event */ + easyrpg_clone_event_id = 0xCB, + /** Runtime changes to the engine config */ + easyrpg_runtime_flags = 0xCC, /** If true; this event is waiting for foreground execution. */ waiting_execution = 0x65, /** Index of custom move route */ diff --git a/src/generated/lcf/rpg/eventcommand.h b/src/generated/lcf/rpg/eventcommand.h index 2ff1e08d..0e5ed36e 100644 --- a/src/generated/lcf/rpg/eventcommand.h +++ b/src/generated/lcf/rpg/eventcommand.h @@ -158,8 +158,7 @@ namespace rpg { ElseBranch_B = 23310, EndBranch_B = 23311, EasyRpg_TriggerEventAt = 2002, - EasyRpg_SmartMoveRoute = 2003, - EasyRpg_SmartStepToward = 2004, + EasyRpg_Pathfinder = 2003, EasyRpg_CallMovementAction = 2050, EasyRpg_WaitForSingleMovement = 2051, EasyRpg_AnimateVariable = 2052, @@ -325,8 +324,7 @@ namespace rpg { Code::ElseBranch_B, "ElseBranch_B", Code::EndBranch_B, "EndBranch_B", Code::EasyRpg_TriggerEventAt, "EasyRpg_TriggerEventAt", - Code::EasyRpg_SmartMoveRoute, "EasyRpg_SmartMoveRoute", - Code::EasyRpg_SmartStepToward, "EasyRpg_SmartStepToward", + Code::EasyRpg_Pathfinder, "EasyRpg_Pathfinder", Code::EasyRpg_CallMovementAction, "EasyRpg_CallMovementAction", Code::EasyRpg_WaitForSingleMovement, "EasyRpg_WaitForSingleMovement", Code::EasyRpg_AnimateVariable, "EasyRpg_AnimateVariable", diff --git a/src/generated/lcf/rpg/saveeventexecframe.h b/src/generated/lcf/rpg/saveeventexecframe.h index 636ae357..cf1c21ae 100644 --- a/src/generated/lcf/rpg/saveeventexecframe.h +++ b/src/generated/lcf/rpg/saveeventexecframe.h @@ -13,6 +13,7 @@ #define LCF_RPG_SAVEEVENTEXECFRAME_H // Headers +#include #include #include #include "lcf/rpg/eventcommand.h" @@ -38,8 +39,28 @@ namespace rpg { int32_t maniac_event_page_id = 0; int32_t maniac_loop_info_size = 0; std::vector maniac_loop_info; + struct EasyRpgFrameRuntime_Flags { + union { + struct { + bool reserved_1; + }; + std::array flags; + }; + EasyRpgFrameRuntime_Flags() noexcept: reserved_1(false) + {} + } easyrpg_runtime_flags; }; + inline bool operator==(const SaveEventExecFrame::EasyRpgFrameRuntime_Flags& l, const SaveEventExecFrame::EasyRpgFrameRuntime_Flags& r) { + return l.flags == r.flags; + } + + inline bool operator!=(const SaveEventExecFrame::EasyRpgFrameRuntime_Flags& l, const SaveEventExecFrame::EasyRpgFrameRuntime_Flags& r) { + return !(l == r); + } + + std::ostream& operator<<(std::ostream& os, const SaveEventExecFrame::EasyRpgFrameRuntime_Flags& obj); + inline bool operator==(const SaveEventExecFrame& l, const SaveEventExecFrame& r) { return l.commands == r.commands && l.current_command == r.current_command @@ -50,7 +71,8 @@ namespace rpg { && l.maniac_event_id == r.maniac_event_id && l.maniac_event_page_id == r.maniac_event_page_id && l.maniac_loop_info_size == r.maniac_loop_info_size - && l.maniac_loop_info == r.maniac_loop_info; + && l.maniac_loop_info == r.maniac_loop_info + && l.easyrpg_runtime_flags == r.easyrpg_runtime_flags; } inline bool operator!=(const SaveEventExecFrame& l, const SaveEventExecFrame& r) { diff --git a/src/generated/lcf/rpg/saveeventexecstate.h b/src/generated/lcf/rpg/saveeventexecstate.h index d49d0104..f93e5f56 100644 --- a/src/generated/lcf/rpg/saveeventexecstate.h +++ b/src/generated/lcf/rpg/saveeventexecstate.h @@ -13,6 +13,7 @@ #define LCF_RPG_SAVEEVENTEXECSTATE_H // Headers +#include #include #include #include "lcf/dbstring.h" @@ -53,8 +54,47 @@ namespace rpg { bool easyrpg_active = false; DBString easyrpg_string; std::vector easyrpg_parameters; + struct EasyRpgStateRuntime_Flags { + union { + struct { + bool conf_override_active; + bool reserved_1; + bool reserved_2; + bool reserved_3; + bool patch_destiny_on; + bool patch_destiny_off; + bool patch_dynrpg_on; + bool patch_dynrpg_off; + bool patch_maniac_on; + bool patch_maniac_off; + bool patch_common_this_event_on; + bool patch_common_this_event_off; + bool patch_unlock_pics_on; + bool patch_unlock_pics_off; + bool patch_keypatch_on; + bool patch_keypatch_off; + bool patch_rpg2k3_cmds_on; + bool patch_rpg2k3_cmds_off; + bool use_rpg2k_battle_system_on; + bool use_rpg2k_battle_system_off; + }; + std::array flags; + }; + EasyRpgStateRuntime_Flags() noexcept: conf_override_active(false), reserved_1(false), reserved_2(false), reserved_3(false), patch_destiny_on(false), patch_destiny_off(false), patch_dynrpg_on(false), patch_dynrpg_off(false), patch_maniac_on(false), patch_maniac_off(false), patch_common_this_event_on(false), patch_common_this_event_off(false), patch_unlock_pics_on(false), patch_unlock_pics_off(false), patch_keypatch_on(false), patch_keypatch_off(false), patch_rpg2k3_cmds_on(false), patch_rpg2k3_cmds_off(false), use_rpg2k_battle_system_on(false), use_rpg2k_battle_system_off(false) + {} + } easyrpg_runtime_flags; }; + inline bool operator==(const SaveEventExecState::EasyRpgStateRuntime_Flags& l, const SaveEventExecState::EasyRpgStateRuntime_Flags& r) { + return l.flags == r.flags; + } + + inline bool operator!=(const SaveEventExecState::EasyRpgStateRuntime_Flags& l, const SaveEventExecState::EasyRpgStateRuntime_Flags& r) { + return !(l == r); + } + + std::ostream& operator<<(std::ostream& os, const SaveEventExecState::EasyRpgStateRuntime_Flags& obj); + inline bool operator==(const SaveEventExecState& l, const SaveEventExecState& r) { return l.stack == r.stack && l.show_message == r.show_message @@ -80,7 +120,8 @@ namespace rpg { && l.wait_key_enter == r.wait_key_enter && l.easyrpg_active == r.easyrpg_active && l.easyrpg_string == r.easyrpg_string - && l.easyrpg_parameters == r.easyrpg_parameters; + && l.easyrpg_parameters == r.easyrpg_parameters + && l.easyrpg_runtime_flags == r.easyrpg_runtime_flags; } inline bool operator!=(const SaveEventExecState& l, const SaveEventExecState& r) { diff --git a/src/generated/lcf/rpg/savemapeventbase.h b/src/generated/lcf/rpg/savemapeventbase.h index 6bff9dce..e31c2928 100644 --- a/src/generated/lcf/rpg/savemapeventbase.h +++ b/src/generated/lcf/rpg/savemapeventbase.h @@ -13,6 +13,7 @@ #define LCF_RPG_SAVEMAPEVENTBASE_H // Headers +#include #include #include #include "lcf/enum_tags.h" @@ -68,8 +69,30 @@ namespace rpg { double flash_current_level = 0.0; int32_t flash_time_left = 0; int32_t easyrpg_move_failure_count = 0; + uint32_t easyrpg_clone_map_id = 0; + uint32_t easyrpg_clone_event_id = 0; + struct EasyRpgEventRuntime_Flags { + union { + struct { + bool reserved_1; + }; + std::array flags; + }; + EasyRpgEventRuntime_Flags() noexcept: reserved_1(false) + {} + } easyrpg_runtime_flags; }; + inline bool operator==(const SaveMapEventBase::EasyRpgEventRuntime_Flags& l, const SaveMapEventBase::EasyRpgEventRuntime_Flags& r) { + return l.flags == r.flags; + } + + inline bool operator!=(const SaveMapEventBase::EasyRpgEventRuntime_Flags& l, const SaveMapEventBase::EasyRpgEventRuntime_Flags& r) { + return !(l == r); + } + + std::ostream& operator<<(std::ostream& os, const SaveMapEventBase::EasyRpgEventRuntime_Flags& obj); + inline bool operator==(const SaveMapEventBase& l, const SaveMapEventBase& r) { return l.active == r.active && l.map_id == r.map_id @@ -110,7 +133,10 @@ namespace rpg { && l.flash_blue == r.flash_blue && l.flash_current_level == r.flash_current_level && l.flash_time_left == r.flash_time_left - && l.easyrpg_move_failure_count == r.easyrpg_move_failure_count; + && l.easyrpg_move_failure_count == r.easyrpg_move_failure_count + && l.easyrpg_clone_map_id == r.easyrpg_clone_map_id + && l.easyrpg_clone_event_id == r.easyrpg_clone_event_id + && l.easyrpg_runtime_flags == r.easyrpg_runtime_flags; } inline bool operator!=(const SaveMapEventBase& l, const SaveMapEventBase& r) { diff --git a/src/generated/ldb_terrain_flags.h b/src/generated/ldb_terrain_special_flags.h similarity index 100% rename from src/generated/ldb_terrain_flags.h rename to src/generated/ldb_terrain_special_flags.h diff --git a/src/generated/lsd_saveeventexecframe.cpp b/src/generated/lsd_saveeventexecframe.cpp index a29acf33..2805017f 100644 --- a/src/generated/lsd_saveeventexecframe.cpp +++ b/src/generated/lsd_saveeventexecframe.cpp @@ -102,6 +102,13 @@ static TypedField> static_maniac_l 0, 0 ); +static TypedField static_easyrpg_runtime_flags( + &rpg::SaveEventExecFrame::easyrpg_runtime_flags, + LSD_Reader::ChunkSaveEventExecFrame::easyrpg_runtime_flags, + "easyrpg_runtime_flags", + 0, + 0 +); template <> @@ -118,6 +125,7 @@ Field const* Struct::fields[] &static_maniac_event_page_id, &static_maniac_loop_info_size, &static_maniac_loop_info, + &static_easyrpg_runtime_flags, NULL }; diff --git a/src/generated/lsd_saveeventexecframe_easyrpg_runtime_flags.h b/src/generated/lsd_saveeventexecframe_easyrpg_runtime_flags.h new file mode 100644 index 00000000..64cccbcc --- /dev/null +++ b/src/generated/lsd_saveeventexecframe_easyrpg_runtime_flags.h @@ -0,0 +1,36 @@ +/* !!!! GENERATED FILE - DO NOT EDIT !!!! + * -------------------------------------- + * + * This file is part of liblcf. Copyright (c) liblcf authors. + * https://github.com/EasyRPG/liblcf - https://easyrpg.org + * + * liblcf is Free/Libre Open Source Software, released under the MIT License. + * For the full copyright and license information, please view the COPYING + * file that was distributed with this source code. + */ + +/* + * Headers + */ +#include "lcf/lsd/reader.h" +#include "lcf/lsd/chunks.h" +#include "reader_struct.h" + +namespace lcf { + +// Read SaveEventExecFrame. + +template <> +char const* const Flags::name = "SaveEventExecFrame_EasyRpgFrameRuntime_Flags"; + +template <> +decltype(Flags::flag_names) Flags::flag_names = { + "reserved_1" +}; + +template <> +decltype(Flags::flags_is2k3) Flags::flags_is2k3 = { + 0 +}; + +} //namespace lcf diff --git a/src/generated/lsd_saveeventexecstate.cpp b/src/generated/lsd_saveeventexecstate.cpp index e8f68469..fb9f7b3f 100644 --- a/src/generated/lsd_saveeventexecstate.cpp +++ b/src/generated/lsd_saveeventexecstate.cpp @@ -195,6 +195,13 @@ static TypedField> static_easyrpg_ 0, 0 ); +static TypedField static_easyrpg_runtime_flags( + &rpg::SaveEventExecState::easyrpg_runtime_flags, + LSD_Reader::ChunkSaveEventExecState::easyrpg_runtime_flags, + "easyrpg_runtime_flags", + 0, + 0 +); template <> @@ -224,6 +231,7 @@ Field const* Struct::fields[] &static_easyrpg_active, &static_easyrpg_string, &static_easyrpg_parameters, + &static_easyrpg_runtime_flags, NULL }; diff --git a/src/generated/lsd_saveeventexecstate_easyrpg_runtime_flags.h b/src/generated/lsd_saveeventexecstate_easyrpg_runtime_flags.h new file mode 100644 index 00000000..98dbec5a --- /dev/null +++ b/src/generated/lsd_saveeventexecstate_easyrpg_runtime_flags.h @@ -0,0 +1,74 @@ +/* !!!! GENERATED FILE - DO NOT EDIT !!!! + * -------------------------------------- + * + * This file is part of liblcf. Copyright (c) liblcf authors. + * https://github.com/EasyRPG/liblcf - https://easyrpg.org + * + * liblcf is Free/Libre Open Source Software, released under the MIT License. + * For the full copyright and license information, please view the COPYING + * file that was distributed with this source code. + */ + +/* + * Headers + */ +#include "lcf/lsd/reader.h" +#include "lcf/lsd/chunks.h" +#include "reader_struct.h" + +namespace lcf { + +// Read SaveEventExecState. + +template <> +char const* const Flags::name = "SaveEventExecState_EasyRpgStateRuntime_Flags"; + +template <> +decltype(Flags::flag_names) Flags::flag_names = { + "conf_override_active", + "reserved_1", + "reserved_2", + "reserved_3", + "patch_destiny_on", + "patch_destiny_off", + "patch_dynrpg_on", + "patch_dynrpg_off", + "patch_maniac_on", + "patch_maniac_off", + "patch_common_this_event_on", + "patch_common_this_event_off", + "patch_unlock_pics_on", + "patch_unlock_pics_off", + "patch_keypatch_on", + "patch_keypatch_off", + "patch_rpg2k3_cmds_on", + "patch_rpg2k3_cmds_off", + "use_rpg2k_battle_system_on", + "use_rpg2k_battle_system_off" +}; + +template <> +decltype(Flags::flags_is2k3) Flags::flags_is2k3 = { + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0 +}; + +} //namespace lcf diff --git a/src/generated/lsd_savemapevent.cpp b/src/generated/lsd_savemapevent.cpp index bf14bf83..a7242406 100644 --- a/src/generated/lsd_savemapevent.cpp +++ b/src/generated/lsd_savemapevent.cpp @@ -300,6 +300,27 @@ static TypedField static_easyrpg_move_failure_count( 0, 0 ); +static TypedField static_easyrpg_clone_map_id( + &rpg::SaveMapEvent::easyrpg_clone_map_id, + LSD_Reader::ChunkSaveMapEvent::easyrpg_clone_map_id, + "easyrpg_clone_map_id", + 0, + 0 +); +static TypedField static_easyrpg_clone_event_id( + &rpg::SaveMapEvent::easyrpg_clone_event_id, + LSD_Reader::ChunkSaveMapEvent::easyrpg_clone_event_id, + "easyrpg_clone_event_id", + 0, + 0 +); +static TypedField static_easyrpg_runtime_flags( + &rpg::SaveMapEvent::easyrpg_runtime_flags, + LSD_Reader::ChunkSaveMapEvent::easyrpg_runtime_flags, + "easyrpg_runtime_flags", + 0, + 0 +); static TypedField static_waiting_execution( &rpg::SaveMapEvent::waiting_execution, LSD_Reader::ChunkSaveMapEvent::waiting_execution, @@ -372,6 +393,9 @@ Field const* Struct::fields[] = { &static_flash_current_level, &static_flash_time_left, &static_easyrpg_move_failure_count, + &static_easyrpg_clone_map_id, + &static_easyrpg_clone_event_id, + &static_easyrpg_runtime_flags, &static_waiting_execution, &static_original_move_route_index, &static_triggered_by_decision_key, diff --git a/src/generated/lsd_savemapeventbase.cpp b/src/generated/lsd_savemapeventbase.cpp index db8e6080..5fbc48c2 100644 --- a/src/generated/lsd_savemapeventbase.cpp +++ b/src/generated/lsd_savemapeventbase.cpp @@ -300,6 +300,27 @@ static TypedField static_easyrpg_move_failure_co 0, 0 ); +static TypedField static_easyrpg_clone_map_id( + &rpg::SaveMapEventBase::easyrpg_clone_map_id, + LSD_Reader::ChunkSaveMapEventBase::easyrpg_clone_map_id, + "easyrpg_clone_map_id", + 0, + 0 +); +static TypedField static_easyrpg_clone_event_id( + &rpg::SaveMapEventBase::easyrpg_clone_event_id, + LSD_Reader::ChunkSaveMapEventBase::easyrpg_clone_event_id, + "easyrpg_clone_event_id", + 0, + 0 +); +static TypedField static_easyrpg_runtime_flags( + &rpg::SaveMapEventBase::easyrpg_runtime_flags, + LSD_Reader::ChunkSaveMapEventBase::easyrpg_runtime_flags, + "easyrpg_runtime_flags", + 0, + 0 +); template <> @@ -344,6 +365,9 @@ Field const* Struct::fields[] = { &static_flash_current_level, &static_flash_time_left, &static_easyrpg_move_failure_count, + &static_easyrpg_clone_map_id, + &static_easyrpg_clone_event_id, + &static_easyrpg_runtime_flags, NULL }; diff --git a/src/generated/lsd_savemapeventbase_easyrpg_runtime_flags.h b/src/generated/lsd_savemapeventbase_easyrpg_runtime_flags.h new file mode 100644 index 00000000..601572b3 --- /dev/null +++ b/src/generated/lsd_savemapeventbase_easyrpg_runtime_flags.h @@ -0,0 +1,36 @@ +/* !!!! GENERATED FILE - DO NOT EDIT !!!! + * -------------------------------------- + * + * This file is part of liblcf. Copyright (c) liblcf authors. + * https://github.com/EasyRPG/liblcf - https://easyrpg.org + * + * liblcf is Free/Libre Open Source Software, released under the MIT License. + * For the full copyright and license information, please view the COPYING + * file that was distributed with this source code. + */ + +/* + * Headers + */ +#include "lcf/lsd/reader.h" +#include "lcf/lsd/chunks.h" +#include "reader_struct.h" + +namespace lcf { + +// Read SaveMapEventBase. + +template <> +char const* const Flags::name = "SaveMapEventBase_EasyRpgEventRuntime_Flags"; + +template <> +decltype(Flags::flag_names) Flags::flag_names = { + "reserved_1" +}; + +template <> +decltype(Flags::flags_is2k3) Flags::flags_is2k3 = { + 0 +}; + +} //namespace lcf diff --git a/src/generated/lsd_savepartylocation.cpp b/src/generated/lsd_savepartylocation.cpp index 24f786b0..f532cf52 100644 --- a/src/generated/lsd_savepartylocation.cpp +++ b/src/generated/lsd_savepartylocation.cpp @@ -300,6 +300,27 @@ static TypedField static_easyrpg_move_failure_c 0, 0 ); +static TypedField static_easyrpg_clone_map_id( + &rpg::SavePartyLocation::easyrpg_clone_map_id, + LSD_Reader::ChunkSavePartyLocation::easyrpg_clone_map_id, + "easyrpg_clone_map_id", + 0, + 0 +); +static TypedField static_easyrpg_clone_event_id( + &rpg::SavePartyLocation::easyrpg_clone_event_id, + LSD_Reader::ChunkSavePartyLocation::easyrpg_clone_event_id, + "easyrpg_clone_event_id", + 0, + 0 +); +static TypedField static_easyrpg_runtime_flags( + &rpg::SavePartyLocation::easyrpg_runtime_flags, + LSD_Reader::ChunkSavePartyLocation::easyrpg_runtime_flags, + "easyrpg_runtime_flags", + 0, + 0 +); static TypedField static_boarding( &rpg::SavePartyLocation::boarding, LSD_Reader::ChunkSavePartyLocation::boarding, @@ -470,6 +491,9 @@ Field const* Struct::fields[] = &static_flash_current_level, &static_flash_time_left, &static_easyrpg_move_failure_count, + &static_easyrpg_clone_map_id, + &static_easyrpg_clone_event_id, + &static_easyrpg_runtime_flags, &static_boarding, &static_aboard, &static_vehicle, diff --git a/src/generated/lsd_savevehiclelocation.cpp b/src/generated/lsd_savevehiclelocation.cpp index 9868b82e..71a64faa 100644 --- a/src/generated/lsd_savevehiclelocation.cpp +++ b/src/generated/lsd_savevehiclelocation.cpp @@ -300,6 +300,27 @@ static TypedField static_easyrpg_move_failure 0, 0 ); +static TypedField static_easyrpg_clone_map_id( + &rpg::SaveVehicleLocation::easyrpg_clone_map_id, + LSD_Reader::ChunkSaveVehicleLocation::easyrpg_clone_map_id, + "easyrpg_clone_map_id", + 0, + 0 +); +static TypedField static_easyrpg_clone_event_id( + &rpg::SaveVehicleLocation::easyrpg_clone_event_id, + LSD_Reader::ChunkSaveVehicleLocation::easyrpg_clone_event_id, + "easyrpg_clone_event_id", + 0, + 0 +); +static TypedField static_easyrpg_runtime_flags( + &rpg::SaveVehicleLocation::easyrpg_runtime_flags, + LSD_Reader::ChunkSaveVehicleLocation::easyrpg_runtime_flags, + "easyrpg_runtime_flags", + 0, + 0 +); static TypedField static_vehicle( &rpg::SaveVehicleLocation::vehicle, LSD_Reader::ChunkSaveVehicleLocation::vehicle, @@ -379,6 +400,9 @@ Field const* Struct::fields[ &static_flash_current_level, &static_flash_time_left, &static_easyrpg_move_failure_count, + &static_easyrpg_clone_map_id, + &static_easyrpg_clone_event_id, + &static_easyrpg_runtime_flags, &static_vehicle, &static_remaining_ascent, &static_remaining_descent, diff --git a/src/generated/rpg_saveeventexecframe.cpp b/src/generated/rpg_saveeventexecframe.cpp index 55dc3bc4..a36f071c 100644 --- a/src/generated/rpg_saveeventexecframe.cpp +++ b/src/generated/rpg_saveeventexecframe.cpp @@ -15,6 +15,14 @@ namespace lcf { namespace rpg { +std::ostream& operator<<(std::ostream& os, const SaveEventExecFrame::EasyRpgFrameRuntime_Flags& obj) { + for (size_t i = 0; i < obj.flags.size(); ++i) { + os << (i == 0 ? "[" : ", ") << obj.flags[i]; + } + os << "]"; + return os; +} + std::ostream& operator<<(std::ostream& os, const SaveEventExecFrame& obj) { os << "SaveEventExecFrame{"; os << "commands="; @@ -39,6 +47,7 @@ std::ostream& operator<<(std::ostream& os, const SaveEventExecFrame& obj) { os << (i == 0 ? "[" : ", ") << obj.maniac_loop_info[i]; } os << "]"; + os << ", easyrpg_runtime_flags="<< obj.easyrpg_runtime_flags; os << "}"; return os; } diff --git a/src/generated/rpg_saveeventexecstate.cpp b/src/generated/rpg_saveeventexecstate.cpp index 4c58ae4b..0e1dc729 100644 --- a/src/generated/rpg_saveeventexecstate.cpp +++ b/src/generated/rpg_saveeventexecstate.cpp @@ -15,6 +15,14 @@ namespace lcf { namespace rpg { +std::ostream& operator<<(std::ostream& os, const SaveEventExecState::EasyRpgStateRuntime_Flags& obj) { + for (size_t i = 0; i < obj.flags.size(); ++i) { + os << (i == 0 ? "[" : ", ") << obj.flags[i]; + } + os << "]"; + return os; +} + std::ostream& operator<<(std::ostream& os, const SaveEventExecState& obj) { os << "SaveEventExecState{"; os << "stack="; @@ -50,6 +58,7 @@ std::ostream& operator<<(std::ostream& os, const SaveEventExecState& obj) { os << (i == 0 ? "[" : ", ") << obj.easyrpg_parameters[i]; } os << "]"; + os << ", easyrpg_runtime_flags="<< obj.easyrpg_runtime_flags; os << "}"; return os; } diff --git a/src/generated/rpg_savemapeventbase.cpp b/src/generated/rpg_savemapeventbase.cpp index 03b76554..430b6d92 100644 --- a/src/generated/rpg_savemapeventbase.cpp +++ b/src/generated/rpg_savemapeventbase.cpp @@ -15,6 +15,14 @@ namespace lcf { namespace rpg { +std::ostream& operator<<(std::ostream& os, const SaveMapEventBase::EasyRpgEventRuntime_Flags& obj) { + for (size_t i = 0; i < obj.flags.size(); ++i) { + os << (i == 0 ? "[" : ", ") << obj.flags[i]; + } + os << "]"; + return os; +} + std::ostream& operator<<(std::ostream& os, const SaveMapEventBase& obj) { os << "SaveMapEventBase{"; os << "active="<< obj.active; @@ -57,6 +65,9 @@ std::ostream& operator<<(std::ostream& os, const SaveMapEventBase& obj) { os << ", flash_current_level="<< obj.flash_current_level; os << ", flash_time_left="<< obj.flash_time_left; os << ", easyrpg_move_failure_count="<< obj.easyrpg_move_failure_count; + os << ", easyrpg_clone_map_id="<< obj.easyrpg_clone_map_id; + os << ", easyrpg_clone_event_id="<< obj.easyrpg_clone_event_id; + os << ", easyrpg_runtime_flags="<< obj.easyrpg_runtime_flags; os << "}"; return os; } diff --git a/src/reader_flags.cpp b/src/reader_flags.cpp index 79327ef7..cb361dd5 100644 --- a/src/reader_flags.cpp +++ b/src/reader_flags.cpp @@ -8,17 +8,6 @@ */ #include "reader_struct.h" -#include "lcf/rpg/trooppagecondition.h" -#include "lcf/rpg/eventpagecondition.h" -#include "lcf/rpg/terrain.h" -#include "lcf/rpg/savepicture.h" - -#include "ldb_trooppagecondition_flags.h" -#include "ldb_terrain_flags.h" -#include "lmu_eventpagecondition_flags.h" -#include "lsd_savepicture_flags.h" -#include "lsd_saveeasyrpgtext_flags.h" -#include "lsd_saveeasyrpgwindow_flags.h" namespace lcf { // Templates @@ -143,12 +132,6 @@ void Flags::BeginXml(S& obj, XmlReader& stream) { #pragma warning (disable : 4661) #endif -// Do not forget to add new Flags here -template class Flags; -template class Flags; -template class Flags; -template class Flags; -template class Flags; -template class Flags; - } //namespace lcf + +#include "fwd_flags_instance.h" diff --git a/src/reader_struct.h b/src/reader_struct.h index d247714a..a3f9158b 100644 --- a/src/reader_struct.h +++ b/src/reader_struct.h @@ -16,7 +16,6 @@ #include #include #include -#include #include #include #include @@ -25,19 +24,13 @@ #include "lcf/writer_lcf.h" #include "lcf/reader_xml.h" #include "lcf/writer_xml.h" -#include "lcf/rpg/eventpagecondition.h" -#include "lcf/rpg/trooppagecondition.h" -#include "lcf/rpg/terrain.h" #include "lcf/rpg/equipment.h" #include "lcf/rpg/parameters.h" #include "lcf/rpg/eventcommand.h" #include "lcf/rpg/movecommand.h" #include "lcf/rpg/treemap.h" #include "lcf/rpg/rect.h" -#include "lcf/rpg/savepicture.h" #include "lcf/rpg/terms.h" -#include "lcf/rpg/saveeasyrpgtext.h" -#include "lcf/rpg/saveeasyrpgwindow.h" #include "log.h" namespace lcf { @@ -64,14 +57,6 @@ struct TypeCategory { static const Category::Index value = Category::Struct; }; -// Do not forget to add new Flags here -template <> struct TypeCategory { static const Category::Index value = Category::Flags; }; -template <> struct TypeCategory { static const Category::Index value = Category::Flags; }; -template <> struct TypeCategory { static const Category::Index value = Category::Flags; }; -template <> struct TypeCategory { static const Category::Index value = Category::Flags; }; -template <> struct TypeCategory { static const Category::Index value = Category::Flags; }; -template <> struct TypeCategory { static const Category::Index value = Category::Flags; }; - template <> struct TypeCategory { static const Category::Index value = Category::RawStruct; }; template <> struct TypeCategory { static const Category::Index value = Category::RawStruct; }; template <> struct TypeCategory { static const Category::Index value = Category::RawStruct; }; @@ -806,4 +791,6 @@ class RootXmlHandler : public XmlHandler { } //namespace lcf +#include "fwd_flags_impl.h" + #endif