Skip to content

Commit

Permalink
Merge pull request #434 from Ghabry/pic-chunks
Browse files Browse the repository at this point in the history
SavePicture: Add chunks for Flip and Blend Mode
  • Loading branch information
fdelapena authored Sep 8, 2021
2 parents c6b2e20 + 5bde015 commit 3f5cbdc
Show file tree
Hide file tree
Showing 8 changed files with 56 additions and 4 deletions.
1 change: 1 addition & 0 deletions generator/csv/enums.csv
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,7 @@ SavePartyLocation,PanState,follow,1
SavePicture,Effect,none,0
SavePicture,Effect,rotation,1
SavePicture,Effect,wave,2
SavePicture,Effect,maniac_fixed_angle,3
SavePicture,MapLayer,none,0
SavePicture,MapLayer,parallax,1
SavePicture,MapLayer,tilemap_below,2
Expand Down
4 changes: 4 additions & 0 deletions generator/csv/enums_easyrpg.csv
Original file line number Diff line number Diff line change
Expand Up @@ -29,3 +29,7 @@ EventPage,ManiacEventInfo,battle_parallel,7
EventPage,ManiacEventInfo,map_event,16
EventPage,ManiacEventInfo,common_event,32
EventPage,ManiacEventInfo,battle_event,64
SavePicture,EasyRpgFlip,none,0
SavePicture,EasyRpgFlip,x,1
SavePicture,EasyRpgFlip,y,2
SavePicture,EasyRpgFlip,both,3
2 changes: 2 additions & 0 deletions generator/csv/fields_easyrpg.csv
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ 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<Int32>,0x12,,0,0,"One group of (Current loop count, end loop value) for each identation"
SavePicture,easyrpg_flip,f,Enum<EasyRpgFlip>,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
SaveSystem,maniac_frameskip,,Int32,0x88,0,0,0,"FatalMix Frameskip (0=None, 1=1/5, 2=1/3, 3=1/2)"
SaveSystem,maniac_picture_limit,,Int32,0x89,0,0,0,FatalMix Picture Limit
SaveSystem,maniac_options,,Vector<UInt8>,0x8A,,0,0,"Various FatalMix options (XX XA XB XC). A: MsgSkip OFF/RShift (0/4) B: TestPlay Keep/ON/OFF (0/2/4), C: Pause focus lost Wait/Run (0/1)"
Expand Down
6 changes: 5 additions & 1 deletion src/generated/lcf/lsd/chunks.h
Original file line number Diff line number Diff line change
Expand Up @@ -313,7 +313,11 @@ namespace LSD_Reader {
/** How much the picture is currently rotated. */
current_rotation = 0x34,
/** Current wave effect for picture. */
current_waver = 0x35
current_waver = 0x35,
/** How to flip the picture */
easyrpg_flip = 0xC8,
/** Blend mode to use for blit. See Bitmap::BlendMode */
easyrpg_blend_mode = 0xC9
};
};
struct ChunkSavePartyLocation {
Expand Down
28 changes: 25 additions & 3 deletions src/generated/lcf/rpg/savepicture.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,12 +31,14 @@ namespace rpg {
enum Effect {
Effect_none = 0,
Effect_rotation = 1,
Effect_wave = 2
Effect_wave = 2,
Effect_maniac_fixed_angle = 3
};
static constexpr auto kEffectTags = lcf::makeEnumTags<Effect>(
"none",
"rotation",
"wave"
"wave",
"maniac_fixed_angle"
);
enum MapLayer {
MapLayer_none = 0,
Expand Down Expand Up @@ -80,6 +82,18 @@ namespace rpg {
"windows_and_status",
"timers"
);
enum EasyRpgFlip {
EasyRpgFlip_none = 0,
EasyRpgFlip_x = 1,
EasyRpgFlip_y = 2,
EasyRpgFlip_both = 3
};
static constexpr auto kEasyRpgFlipTags = lcf::makeEnumTags<EasyRpgFlip>(
"none",
"x",
"y",
"both"
);

int ID = 0;
std::string name;
Expand Down Expand Up @@ -136,6 +150,8 @@ namespace rpg {
int32_t time_left = 0;
double current_rotation = 0.0;
int32_t current_waver = 0;
int32_t easyrpg_flip = 0;
int32_t easyrpg_blend_mode = 0;
};
inline std::ostream& operator<<(std::ostream& os, SavePicture::Effect code) {
os << static_cast<std::underlying_type_t<decltype(code)>>(code);
Expand All @@ -149,6 +165,10 @@ namespace rpg {
os << static_cast<std::underlying_type_t<decltype(code)>>(code);
return os;
}
inline std::ostream& operator<<(std::ostream& os, SavePicture::EasyRpgFlip code) {
os << static_cast<std::underlying_type_t<decltype(code)>>(code);
return os;
}

inline bool operator==(const SavePicture::Flags& l, const SavePicture::Flags& r) {
return l.flags == r.flags;
Expand Down Expand Up @@ -198,7 +218,9 @@ namespace rpg {
&& l.finish_effect_power == r.finish_effect_power
&& l.time_left == r.time_left
&& l.current_rotation == r.current_rotation
&& l.current_waver == r.current_waver;
&& l.current_waver == r.current_waver
&& l.easyrpg_flip == r.easyrpg_flip
&& l.easyrpg_blend_mode == r.easyrpg_blend_mode;
}

inline bool operator!=(const SavePicture& l, const SavePicture& r) {
Expand Down
16 changes: 16 additions & 0 deletions src/generated/lsd_savepicture.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -286,6 +286,20 @@ static TypedField<rpg::SavePicture, int32_t> static_current_waver(
0,
0
);
static TypedField<rpg::SavePicture, int32_t> static_easyrpg_flip(
&rpg::SavePicture::easyrpg_flip,
LSD_Reader::ChunkSavePicture::easyrpg_flip,
"easyrpg_flip",
0,
1
);
static TypedField<rpg::SavePicture, int32_t> static_easyrpg_blend_mode(
&rpg::SavePicture::easyrpg_blend_mode,
LSD_Reader::ChunkSavePicture::easyrpg_blend_mode,
"easyrpg_blend_mode",
0,
1
);


template <>
Expand Down Expand Up @@ -328,6 +342,8 @@ Field<rpg::SavePicture> const* Struct<rpg::SavePicture>::fields[] = {
&static_time_left,
&static_current_rotation,
&static_current_waver,
&static_easyrpg_flip,
&static_easyrpg_blend_mode,
NULL
};

Expand Down
1 change: 1 addition & 0 deletions src/generated/rpg_enums.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,7 @@ constexpr decltype(SaveSystem::kAtbModeTags) SaveSystem::kAtbModeTags;
constexpr decltype(SavePicture::kEffectTags) SavePicture::kEffectTags;
constexpr decltype(SavePicture::kMapLayerTags) SavePicture::kMapLayerTags;
constexpr decltype(SavePicture::kBattleLayerTags) SavePicture::kBattleLayerTags;
constexpr decltype(SavePicture::kEasyRpgFlipTags) SavePicture::kEasyRpgFlipTags;
constexpr decltype(SavePartyLocation::kVehicleTypeTags) SavePartyLocation::kVehicleTypeTags;
constexpr decltype(SavePartyLocation::kPanStateTags) SavePartyLocation::kPanStateTags;
constexpr decltype(SaveVehicleLocation::kVehicleTypeTags) SaveVehicleLocation::kVehicleTypeTags;
Expand Down
2 changes: 2 additions & 0 deletions src/generated/rpg_savepicture.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,8 @@ std::ostream& operator<<(std::ostream& os, const SavePicture& obj) {
os << ", time_left="<< obj.time_left;
os << ", current_rotation="<< obj.current_rotation;
os << ", current_waver="<< obj.current_waver;
os << ", easyrpg_flip="<< obj.easyrpg_flip;
os << ", easyrpg_blend_mode="<< obj.easyrpg_blend_mode;
os << "}";
return os;
}
Expand Down

0 comments on commit 3f5cbdc

Please sign in to comment.