diff --git a/.gitignore b/.gitignore
index fcbf52fef..50e95aef2 100644
--- a/.gitignore
+++ b/.gitignore
@@ -37,10 +37,18 @@ CMakeFiles/
*.cmake
!/builds/cmake/Modules/Find*.cmake
/builds/cmake/lib/
+/builds/cmake/*.in
+
+# IntelliJ / CLion
+.idea/
# doxygen generated files
/doc/
+# Python generated files
+*.pyc
+__pycache__/
+
# other generated files
Makefile
*~
diff --git a/Makefile.am b/Makefile.am
index 34e10dc1b..a1d9024a5 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -97,6 +97,7 @@ liblcf_la_SOURCES = \
src/generated/lsd_savemapinfo.cpp \
src/generated/lsd_savepartylocation.cpp \
src/generated/lsd_savepicture.cpp \
+ src/generated/lsd_savepicture_flags.cpp \
src/generated/lsd_savescreen.cpp \
src/generated/lsd_savesystem.cpp \
src/generated/lsd_savetarget.cpp \
diff --git a/builds/vs2015/liblcf.vcxproj b/builds/vs2015/liblcf.vcxproj
index abb6e3a75..da350e3ac 100644
--- a/builds/vs2015/liblcf.vcxproj
+++ b/builds/vs2015/liblcf.vcxproj
@@ -257,6 +257,7 @@
+
diff --git a/builds/vs2015/liblcf.vcxproj.filters b/builds/vs2015/liblcf.vcxproj.filters
index dafea6700..06dbda029 100644
--- a/builds/vs2015/liblcf.vcxproj.filters
+++ b/builds/vs2015/liblcf.vcxproj.filters
@@ -374,6 +374,9 @@
Source Files\LSD
+
+ Source Files\LSD
+
Source Files\LSD
diff --git a/generator/csv/enums.csv b/generator/csv/enums.csv
index 98cd21c8d..67dd7c5b5 100644
--- a/generator/csv/enums.csv
+++ b/generator/csv/enums.csv
@@ -118,6 +118,23 @@ SavePartyLocation,VehicleType,none,0
SavePartyLocation,VehicleType,skiff,1
SavePartyLocation,VehicleType,ship,2
SavePartyLocation,VehicleType,airship,3
+SavePicture,MapLayer,none,0
+SavePicture,MapLayer,parallax,1
+SavePicture,MapLayer,tilemap_below,2
+SavePicture,MapLayer,events_below,3
+SavePicture,MapLayer,events_same_as_player,4
+SavePicture,MapLayer,tilemap_above,5
+SavePicture,MapLayer,events_above,6
+SavePicture,MapLayer,weather,7
+SavePicture,MapLayer,animations,8
+SavePicture,MapLayer,windows,9
+SavePicture,MapLayer,timers,10
+SavePicture,BattleLayer,none,0
+SavePicture,BattleLayer,background,1
+SavePicture,BattleLayer,battlers_and_animations,2
+SavePicture,BattleLayer,weather,3
+SavePicture,BattleLayer,windows_and_status,4
+SavePicture,BattleLayer,timers,5
SaveSystem,AtbMode,atb_active,0
SaveSystem,AtbMode,atb_wait,1
State,Persistence,ends,0
diff --git a/generator/csv/fields.csv b/generator/csv/fields.csv
index 52d9e9899..f9cc89614 100644
--- a/generator/csv/fields.csv
+++ b/generator/csv/fields.csv
@@ -759,7 +759,7 @@ SaveSystem,menu_allowed,f,Boolean,0x7C,True,
SaveSystem,background,f,String,0x7D,,string
SaveSystem,save_count,f,Integer,0x83,0,
SaveSystem,save_slot,f,Integer,0x84,1,
-SaveSystem,atb_mode,f,Enum,0x8C,0,ATB mode of RPG 2003 battle system.
+SaveSystem,atb_mode,f,Enum,0x8C,0,ATB mode of RPG 2003 battle system.
SaveScreen,tint_finish_red,f,Integer,0x01,100,int
SaveScreen,tint_finish_green,f,Integer,0x02,100,int
SaveScreen,tint_finish_blue,f,Integer,0x03,100,int
@@ -806,6 +806,15 @@ SavePicture,current_sat,f,Double,0x0E,-1.0,double
SavePicture,effect_mode,f,Integer,0x0F,0,int
SavePicture,current_effect,f,Double,0x10,0.0,double
SavePicture,current_bot_trans,f,Double,0x12,0.0,double
+SavePicture,spritesheet_cols,f,Integer,0x13,1,Spritesheet columns
+SavePicture,spritesheet_rows,f,Integer,0x14,1,Spritesheet rows
+SavePicture,spritesheet_frame,f,Integer,0x15,0,Current spritesheet frame
+SavePicture,spritesheet_speed,f,Integer,0x16,0,Spritesheet speed (X frames per second)
+SavePicture,frames,f,Integer,0x17,0,Frames since ShowPicture
+SavePicture,spritesheet_play_once,f,Boolean,0x18,False,True: Play once and destroy; False: Loop spritesheet
+SavePicture,map_layer,f,Enum,0x19,7,Layer to show picture on at the map
+SavePicture,battle_layer,f,Enum,0x1A,0,Layer to show picture on in battle
+SavePicture,flags,f,SavePicture_Flags,0x1B,97,Bitflag. Persists Map/Battle change/end; Affected by Shake/Flash/Tint
SavePicture,finish_x,f,Double,0x1F,0.0,double
SavePicture,finish_y,f,Double,0x20,0.0,double
SavePicture,finish_magnify,f,Integer,0x21,100,int
diff --git a/generator/csv/flags.csv b/generator/csv/flags.csv
index d4d4e1ab5..e93e2c1e3 100644
--- a/generator/csv/flags.csv
+++ b/generator/csv/flags.csv
@@ -20,3 +20,10 @@ EventPageCondition,item
EventPageCondition,actor
EventPageCondition,timer
EventPageCondition,timer2
+SavePicture,erase_on_map_change
+SavePicture,erase_on_battle_end
+SavePicture,unused_bit
+SavePicture,unused_bit2
+SavePicture,affected_by_tint
+SavePicture,affected_by_flash
+SavePicture,affected_by_shake
diff --git a/generator/generate.py b/generator/generate.py
index 53f34b823..d5123684a 100755
--- a/generator/generate.py
+++ b/generator/generate.py
@@ -92,6 +92,16 @@ def pod_default(field):
def flag_size(flag):
return (len(flag) + 7) // 8
+def flag_set(field, bit):
+ bit -= 1
+ try:
+ res = bool(int(field.default) & (1 << bit))
+ except ValueError:
+ # Default was not an int
+ res = False
+
+ return str(res).lower()
+
def filter_structs_without_codes(structs):
for struct in structs:
if all(f.code for f in sfields[struct.name]):
@@ -334,6 +344,7 @@ def main(argv):
env.filters["struct_has_code"] = filter_structs_without_codes
env.filters["field_is_used"] = filter_unused_fields
env.filters["flag_size"] = flag_size
+ env.filters["flag_set"] = flag_set
env.tests['needs_ctor'] = needs_ctor
globals = dict(
diff --git a/generator/templates/rpg_header.tmpl b/generator/templates/rpg_header.tmpl
index e3914f396..e894a179a 100644
--- a/generator/templates/rpg_header.tmpl
+++ b/generator/templates/rpg_header.tmpl
@@ -49,7 +49,7 @@ namespace RPG {
{%- if field.type.endswith("_Flags") %}
struct Flags {
{%- for flag in flags[struct_name] %}
- bool {{ flag.field }};
+ bool {{ flag.field }} = {{ field|flag_set(loop.index) }};
{%- endfor %}
} {{ field.name }};
{%- else %}
diff --git a/src/generated/lsd_chunks.h b/src/generated/lsd_chunks.h
index 4d20dbb51..618c43a2b 100644
--- a/src/generated/lsd_chunks.h
+++ b/src/generated/lsd_chunks.h
@@ -260,6 +260,24 @@ namespace LSD_Reader {
current_effect = 0x10,
/** double */
current_bot_trans = 0x12,
+ /** Spritesheet columns */
+ spritesheet_cols = 0x13,
+ /** Spritesheet rows */
+ spritesheet_rows = 0x14,
+ /** Current spritesheet frame */
+ spritesheet_frame = 0x15,
+ /** Spritesheet speed (X frames per second) */
+ spritesheet_speed = 0x16,
+ /** Frames since ShowPicture */
+ frames = 0x17,
+ /** True: Play once and destroy; False: Loop spritesheet */
+ spritesheet_play_once = 0x18,
+ /** Layer to show picture on at the map */
+ map_layer = 0x19,
+ /** Layer to show picture on in battle */
+ battle_layer = 0x1A,
+ /** Bitflag. Persists Map/Battle change/end; Affected by Shake/Flash/Tint */
+ flags = 0x1B,
/** double */
finish_x = 0x1F,
/** double */
diff --git a/src/generated/lsd_savepicture.cpp b/src/generated/lsd_savepicture.cpp
index b1f20675c..492aa8661 100644
--- a/src/generated/lsd_savepicture.cpp
+++ b/src/generated/lsd_savepicture.cpp
@@ -36,6 +36,15 @@ LCF_STRUCT_FIELDS_BEGIN()
LCF_STRUCT_TYPED_FIELD(int, effect_mode),
LCF_STRUCT_TYPED_FIELD(double, current_effect),
LCF_STRUCT_TYPED_FIELD(double, current_bot_trans),
+ LCF_STRUCT_TYPED_FIELD(int, spritesheet_cols),
+ LCF_STRUCT_TYPED_FIELD(int, spritesheet_rows),
+ LCF_STRUCT_TYPED_FIELD(int, spritesheet_frame),
+ LCF_STRUCT_TYPED_FIELD(int, spritesheet_speed),
+ LCF_STRUCT_TYPED_FIELD(int, frames),
+ LCF_STRUCT_TYPED_FIELD(bool, spritesheet_play_once),
+ LCF_STRUCT_TYPED_FIELD(int, map_layer),
+ LCF_STRUCT_TYPED_FIELD(int, battle_layer),
+ LCF_STRUCT_TYPED_FIELD(RPG::SavePicture::Flags, flags),
LCF_STRUCT_TYPED_FIELD(double, finish_x),
LCF_STRUCT_TYPED_FIELD(double, finish_y),
LCF_STRUCT_TYPED_FIELD(int, finish_magnify),
diff --git a/src/generated/lsd_savepicture_flags.cpp b/src/generated/lsd_savepicture_flags.cpp
new file mode 100644
index 000000000..31b37bbd3
--- /dev/null
+++ b/src/generated/lsd_savepicture_flags.cpp
@@ -0,0 +1,41 @@
+/* !!!! GENERATED FILE - DO NOT EDIT !!!!
+ * --------------------------------------
+ *
+ * This file is part of liblcf. Copyright (c) 2017 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 "lsd_reader.h"
+#include "lsd_chunks.h"
+#include "reader_struct.h"
+
+
+// Read SavePicture.
+
+typedef RPG::SavePicture::Flags flags_type;
+
+template <>
+char const* const Flags::name("SavePicture_Flags");
+
+template <>
+const Flags::Flag* Flags::flags[] = {
+ new Flags::Flag(&flags_type::erase_on_map_change, "erase_on_map_change"),
+ new Flags::Flag(&flags_type::erase_on_battle_end, "erase_on_battle_end"),
+ new Flags::Flag(&flags_type::unused_bit, "unused_bit"),
+ new Flags::Flag(&flags_type::unused_bit2, "unused_bit2"),
+ new Flags::Flag(&flags_type::affected_by_tint, "affected_by_tint"),
+ new Flags::Flag(&flags_type::affected_by_flash, "affected_by_flash"),
+ new Flags::Flag(&flags_type::affected_by_shake, "affected_by_shake"),
+ NULL
+};
+
+template <>
+const uint32_t Flags::max_size = 1;
+
diff --git a/src/generated/rpg_eventpagecondition.h b/src/generated/rpg_eventpagecondition.h
index f1330a671..074bf8b53 100644
--- a/src/generated/rpg_eventpagecondition.h
+++ b/src/generated/rpg_eventpagecondition.h
@@ -28,13 +28,13 @@ namespace RPG {
};
struct Flags {
- bool switch_a;
- bool switch_b;
- bool variable;
- bool item;
- bool actor;
- bool timer;
- bool timer2;
+ bool switch_a = false;
+ bool switch_b = false;
+ bool variable = false;
+ bool item = false;
+ bool actor = false;
+ bool timer = false;
+ bool timer2 = false;
} flags;
int switch_a_id = 1;
int switch_b_id = 1;
diff --git a/src/generated/rpg_savepicture.h b/src/generated/rpg_savepicture.h
index d0bacc7cb..19dde1dac 100644
--- a/src/generated/rpg_savepicture.h
+++ b/src/generated/rpg_savepicture.h
@@ -21,6 +21,28 @@
namespace RPG {
class SavePicture {
public:
+ enum MapLayer {
+ MapLayer_none = 0,
+ MapLayer_parallax = 1,
+ MapLayer_tilemap_below = 2,
+ MapLayer_events_below = 3,
+ MapLayer_events_same_as_player = 4,
+ MapLayer_tilemap_above = 5,
+ MapLayer_events_above = 6,
+ MapLayer_weather = 7,
+ MapLayer_animations = 8,
+ MapLayer_windows = 9,
+ MapLayer_timers = 10
+ };
+ enum BattleLayer {
+ BattleLayer_none = 0,
+ BattleLayer_background = 1,
+ BattleLayer_battlers_and_animations = 2,
+ BattleLayer_weather = 3,
+ BattleLayer_windows_and_status = 4,
+ BattleLayer_timers = 5
+ };
+
int ID = 0;
std::string name;
double start_x = 0.0;
@@ -38,6 +60,23 @@ namespace RPG {
int effect_mode = 0;
double current_effect = 0.0;
double current_bot_trans = 0.0;
+ int spritesheet_cols = 1;
+ int spritesheet_rows = 1;
+ int spritesheet_frame = 0;
+ int spritesheet_speed = 0;
+ int frames = 0;
+ bool spritesheet_play_once = false;
+ int map_layer = 7;
+ int battle_layer = 0;
+ struct Flags {
+ bool erase_on_map_change = true;
+ bool erase_on_battle_end = false;
+ bool unused_bit = false;
+ bool unused_bit2 = false;
+ bool affected_by_tint = false;
+ bool affected_by_flash = true;
+ bool affected_by_shake = true;
+ } flags;
double finish_x = 0.0;
double finish_y = 0.0;
int finish_magnify = 100;
diff --git a/src/generated/rpg_terrain.h b/src/generated/rpg_terrain.h
index b71650175..0fd7edac7 100644
--- a/src/generated/rpg_terrain.h
+++ b/src/generated/rpg_terrain.h
@@ -58,10 +58,10 @@ namespace RPG {
int background_b_scrollh_speed = 0;
int background_b_scrollv_speed = 0;
struct Flags {
- bool back_party;
- bool back_enemies;
- bool lateral_party;
- bool lateral_enemies;
+ bool back_party = false;
+ bool back_enemies = false;
+ bool lateral_party = false;
+ bool lateral_enemies = false;
} special_flags;
int special_back_party = 15;
int special_back_enemies = 10;
diff --git a/src/generated/rpg_trooppagecondition.h b/src/generated/rpg_trooppagecondition.h
index d83649aa3..de204fc88 100644
--- a/src/generated/rpg_trooppagecondition.h
+++ b/src/generated/rpg_trooppagecondition.h
@@ -19,16 +19,16 @@ namespace RPG {
class TroopPageCondition {
public:
struct Flags {
- bool switch_a;
- bool switch_b;
- bool variable;
- bool turn;
- bool fatigue;
- bool enemy_hp;
- bool actor_hp;
- bool turn_enemy;
- bool turn_actor;
- bool command_actor;
+ bool switch_a = false;
+ bool switch_b = false;
+ bool variable = false;
+ bool turn = false;
+ bool fatigue = false;
+ bool enemy_hp = false;
+ bool actor_hp = false;
+ bool turn_enemy = false;
+ bool turn_actor = false;
+ bool command_actor = false;
} flags;
int switch_a_id = 1;
int switch_b_id = 1;
diff --git a/src/reader_flags.cpp b/src/reader_flags.cpp
index 67083cae3..3e8a10f7a 100644
--- a/src/reader_flags.cpp
+++ b/src/reader_flags.cpp
@@ -11,6 +11,7 @@
#include "rpg_trooppagecondition.h"
#include "rpg_eventpagecondition.h"
#include "rpg_terrain.h"
+#include "rpg_savepicture.h"
// Templates
@@ -120,3 +121,4 @@ void Flags::BeginXml(S& obj, XmlReader& stream) {
template class Flags;
template class Flags;
template class Flags;
+template class Flags;
diff --git a/src/reader_struct.h b/src/reader_struct.h
index c3725cc74..f2dceb8a8 100644
--- a/src/reader_struct.h
+++ b/src/reader_struct.h
@@ -31,6 +31,7 @@
#include "rpg_movecommand.h"
#include "rpg_treemap.h"
#include "rpg_rect.h"
+#include "rpg_savepicture.h"
// Forward declarations
@@ -55,7 +56,8 @@ struct TypeCategory {
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; };
@@ -216,7 +218,7 @@ struct Primitive {
#endif
stream.Seek(length, LcfReader::FromCurrent);
}
-
+
}
static void WriteLcf(const int& ref, LcfWriter& stream) {
stream.WriteInt(ref);