Fix/UnFix for SaveSystem transition, etc..
MODIFY
generator/csv/fields.csv
generator/csv/fields.csv
@@ -748,12 +748,12 @@ SaveSystem,actor_damaged_se,f,Sound,0x63,,1,0,
SaveSystem,dodge_se,f,Sound,0x64,,1,0,
SaveSystem,enemy_death_se,f,Sound,0x65,,1,0,
SaveSystem,item_se,f,Sound,0x66,,1,0,
-SaveSystem,transition_out,f,UInt8,0x6F,1,1,0,
-SaveSystem,transition_in,f,UInt8,0x70,1,1,0,
-SaveSystem,battle_start_fadeout,f,UInt8,0x71,1,0,0,
-SaveSystem,battle_start_fadein,f,UInt8,0x72,1,0,0,
-SaveSystem,battle_end_fadeout,f,UInt8,0x73,1,0,0,
-SaveSystem,battle_end_fadein,f,UInt8,0x74,1,0,0,
+SaveSystem,transition_out,f,Int8,0x6F,1,1,0,
+SaveSystem,transition_in,f,Int8,0x70,1,1,0,
+SaveSystem,battle_start_fadeout,f,Int8,0x71,1,0,0,
+SaveSystem,battle_start_fadein,f,Int8,0x72,1,0,0,
+SaveSystem,battle_end_fadeout,f,Int8,0x73,1,0,0,
+SaveSystem,battle_end_fadein,f,Int8,0x74,1,0,0,
SaveSystem,teleport_allowed,f,Boolean,0x79,True,0,0,
SaveSystem,escape_allowed,f,Boolean,0x7A,True,0,0,
SaveSystem,save_allowed,f,Boolean,0x7B,True,0,0,

MODIFY
src/generated/lsd_savesystem.cpp
src/generated/lsd_savesystem.cpp
Binary files a/src/generated/lsd_savesystem.cpp and b/src/generated/lsd_savesystem.cpp differ

MODIFY
src/generated/rpg_savesystem.h
src/generated/rpg_savesystem.h
Binary files a/src/generated/rpg_savesystem.h and b/src/generated/rpg_savesystem.h differ

MODIFY
src/rpg_fixup.cpp
src/rpg_fixup.cpp
#include "rpg_savemapinfo.h"
#include "data.h"
+
+template <typename T, typename U>
+static void FixInt(T& val, U def) {
+ if (val < 0) {
+ val = def;
+ }
+};
+
+template <typename T, typename U>
+void UnFixInt(T& val, U def) {
+ if (val == def) {
+ val = -1;
+ }
+};
+
void RPG::SaveActor::Fixup(int actor_id) {
ID = actor_id;
@@ -163,9 +178,14 @@ void RPG::SaveSystem::Fixup() {
if (item_se.name.empty()) {
item_se = system.item_se;
}
- if (message_stretch == -1) {
- message_stretch = system.message_stretch;
- }
+
+ FixInt(message_stretch, system.message_stretch);
+ FixInt(transition_out, system.transition_out);
+ FixInt(transition_in, system.transition_in);
+ FixInt(battle_start_fadeout, system.battle_start_fadeout);
+ FixInt(battle_start_fadein, system.battle_start_fadein);
+ FixInt(battle_end_fadeout, system.battle_end_fadeout);
+ FixInt(battle_end_fadein, system.battle_end_fadein);
}
void RPG::SaveSystem::UnFixup() {
@@ -246,21 +266,22 @@ void RPG::SaveSystem::UnFixup() {
if (item_se == system.item_se) {
reset_se(item_se);
}
- if (message_stretch == system.message_stretch) {
- message_stretch = -1;
- }
+
+ UnFixInt(message_stretch, system.message_stretch);
+ UnFixInt(transition_out, system.transition_out);
+ UnFixInt(transition_in, system.transition_in);
+ UnFixInt(battle_start_fadeout, system.battle_start_fadeout);
+ UnFixInt(battle_start_fadein, system.battle_start_fadein);
+ UnFixInt(battle_end_fadeout, system.battle_end_fadeout);
+ UnFixInt(battle_end_fadein, system.battle_end_fadein);
}
void RPG::SaveMapInfo::Fixup(const RPG::Map& map) {
- if (chipset_id <= 0) {
- chipset_id = map.chipset_id;
- }
+ FixInt(chipset_id, map.chipset_id);
}
void RPG::SaveMapInfo::UnFixup(const RPG::Map& map) {
- if (chipset_id == map.chipset_id) {
- chipset_id = -1;
- }
+ UnFixInt(chipset_id, map.chipset_id);
}

Fix/UnFix for SaveSystem transition, etc..