Skip to content

Commit 4b91a58

Browse files
authored
Merge pull request #507 from Ghabry/event-chunks
More chunks
2 parents 92c4450 + cd865d0 commit 4b91a58

11 files changed

Lines changed: 47 additions & 7 deletions

File tree

CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -379,7 +379,7 @@ if(LIBLCF_WITH_ICU)
379379
set(LCF_SUPPORT_ICU 1)
380380
else()
381381
if(NOT WIN32)
382-
message(FATAL_ERROR "ICU not found. Use LCF_SUPPORT_ICU=0 to disable ICU support (not recommended).")
382+
message(FATAL_ERROR "ICU not found. Use LIBLCF_WITH_ICU=0 to disable ICU support (not recommended).")
383383
endif()
384384

385385
message(STATUS "ICU not found. Using the system library.")

generator/csv/enums_easyrpg.csv

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ EventCommand,Code,Maniac_WritePicture,3026
3737
EventCommand,Code,Maniac_AddMoveRoute,3027
3838
EventCommand,Code,Maniac_EditTile,3028
3939
EventCommand,Code,Maniac_ControlTextProcessing,3029
40+
EventCommand,Code,Maniac_Zoom,3032
4041
EventPage,ManiacEventInfo,action,0
4142
EventPage,ManiacEventInfo,touched,1
4243
EventPage,ManiacEventInfo,collision,2
@@ -54,5 +55,6 @@ SavePicture,EasyRpgFlip,y,2
5455
SavePicture,EasyRpgFlip,both,3
5556
SavePicture,EasyRpgType,default,0
5657
SavePicture,EasyRpgType,window,1
58+
SavePicture,EasyRpgType,canvas,2
5759
Skill,HpType,cost,0
5860
Skill,HpType,percent,1

generator/csv/fields_easyrpg.csv

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ SavePicture,easyrpg_flip,f,Enum<EasyRpgFlip>,0xC8,0,0,1,How to flip the picture
1717
SavePicture,easyrpg_blend_mode,f,Int32,0xC9,0,0,1,Blend mode to use for blit. See Bitmap::BlendMode
1818
SavePicture,easyrpg_type,f,Enum<EasyRpgPictureType>,0xCA,0,0,1,Type of this picture
1919
SavePicture,maniac_current_magnify_height,f,Double,0x0A,100.0,0,0,Current zoom level of picture (y direction).
20+
SavePicture,maniac_image_data,f,Vector<UInt8>,0x1C,,0,0,Deflate compressed image data of a picture modified with EditPicture command
2021
SavePicture,maniac_finish_magnify_height,f,Int32,0x24,100,0,0,Final zoom level to animate picture to (y direction).
2122
SaveEasyRpgWindow,texts,f,Array<SaveEasyRpgText>,0x01,,0,0,Texts to render
2223
SaveEasyRpgWindow,width,f,Int32,0x02,0,0,0,Window width (px)

src/generated/lcf/lsd/chunks.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -348,6 +348,8 @@ namespace LSD_Reader {
348348
easyrpg_type = 0xCA,
349349
/** Current zoom level of picture (y direction). */
350350
maniac_current_magnify_height = 0x0A,
351+
/** Deflate compressed image data of a picture modified with EditPicture command */
352+
maniac_image_data = 0x1C,
351353
/** Final zoom level to animate picture to (y direction). */
352354
maniac_finish_magnify_height = 0x24
353355
};

src/generated/lcf/rpg/eventcommand.h

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -192,7 +192,8 @@ namespace rpg {
192192
Maniac_WritePicture = 3026,
193193
Maniac_AddMoveRoute = 3027,
194194
Maniac_EditTile = 3028,
195-
Maniac_ControlTextProcessing = 3029
195+
Maniac_ControlTextProcessing = 3029,
196+
Maniac_Zoom = 3032
196197
};
197198
static constexpr auto kCodeTags = lcf::EnumTags{
198199
Code::END, "END",
@@ -358,7 +359,8 @@ namespace rpg {
358359
Code::Maniac_WritePicture, "Maniac_WritePicture",
359360
Code::Maniac_AddMoveRoute, "Maniac_AddMoveRoute",
360361
Code::Maniac_EditTile, "Maniac_EditTile",
361-
Code::Maniac_ControlTextProcessing, "Maniac_ControlTextProcessing"
362+
Code::Maniac_ControlTextProcessing, "Maniac_ControlTextProcessing",
363+
Code::Maniac_Zoom, "Maniac_Zoom"
362364
};
363365

364366
int32_t code = 0;

src/generated/lcf/rpg/savepicture.h

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
#include <array>
1717
#include <stdint.h>
1818
#include <string>
19+
#include <vector>
1920
#include "lcf/enum_tags.h"
2021
#include "lcf/context.h"
2122
#include <ostream>
@@ -96,11 +97,13 @@ namespace rpg {
9697
);
9798
enum EasyRpgType {
9899
EasyRpgType_default = 0,
99-
EasyRpgType_window = 1
100+
EasyRpgType_window = 1,
101+
EasyRpgType_canvas = 2
100102
};
101103
static constexpr auto kEasyRpgTypeTags = lcf::makeEnumTags<EasyRpgType>(
102104
"default",
103-
"window"
105+
"window",
106+
"canvas"
104107
);
105108

106109
int ID = 0;
@@ -161,6 +164,7 @@ namespace rpg {
161164
int32_t easyrpg_blend_mode = 0;
162165
int32_t easyrpg_type = 0;
163166
double maniac_current_magnify_height = 100.0;
167+
std::vector<uint8_t> maniac_image_data;
164168
int32_t maniac_finish_magnify_height = 100;
165169
};
166170
inline std::ostream& operator<<(std::ostream& os, SavePicture::Effect code) {
@@ -237,6 +241,7 @@ namespace rpg {
237241
&& l.easyrpg_blend_mode == r.easyrpg_blend_mode
238242
&& l.easyrpg_type == r.easyrpg_type
239243
&& l.maniac_current_magnify_height == r.maniac_current_magnify_height
244+
&& l.maniac_image_data == r.maniac_image_data
240245
&& l.maniac_finish_magnify_height == r.maniac_finish_magnify_height;
241246
}
242247

src/generated/lsd_savepicture.cpp

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -314,6 +314,13 @@ static TypedField<rpg::SavePicture, double> static_maniac_current_magnify_height
314314
0,
315315
0
316316
);
317+
static TypedField<rpg::SavePicture, std::vector<uint8_t>> static_maniac_image_data(
318+
&rpg::SavePicture::maniac_image_data,
319+
LSD_Reader::ChunkSavePicture::maniac_image_data,
320+
"maniac_image_data",
321+
0,
322+
0
323+
);
317324
static TypedField<rpg::SavePicture, int32_t> static_maniac_finish_magnify_height(
318325
&rpg::SavePicture::maniac_finish_magnify_height,
319326
LSD_Reader::ChunkSavePicture::maniac_finish_magnify_height,
@@ -367,6 +374,7 @@ Field<rpg::SavePicture> const* Struct<rpg::SavePicture>::fields[] = {
367374
&static_easyrpg_blend_mode,
368375
&static_easyrpg_type,
369376
&static_maniac_current_magnify_height,
377+
&static_maniac_image_data,
370378
&static_maniac_finish_magnify_height,
371379
NULL
372380
};

src/generated/rpg_savepicture.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,11 @@ std::ostream& operator<<(std::ostream& os, const SavePicture& obj) {
6767
os << ", easyrpg_blend_mode="<< obj.easyrpg_blend_mode;
6868
os << ", easyrpg_type="<< obj.easyrpg_type;
6969
os << ", maniac_current_magnify_height="<< obj.maniac_current_magnify_height;
70+
os << ", maniac_image_data=";
71+
for (size_t i = 0; i < obj.maniac_image_data.size(); ++i) {
72+
os << (i == 0 ? "[" : ", ") << obj.maniac_image_data[i];
73+
}
74+
os << "]";
7075
os << ", maniac_finish_magnify_height="<< obj.maniac_finish_magnify_height;
7176
os << "}";
7277
return os;

src/lcf/reader_lcf.h

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -190,11 +190,18 @@ class LcfReader {
190190
* In debug builds, dumps the content of the
191191
* skipped chunk to stderr.
192192
*
193-
* @param chunk_info chunk that will be skipped.
193+
* @param chunk_info chunk that will be skipped and dumped.
194194
* @param where name of the caller that caused the skip, for finding unknown chunks
195195
*/
196196
void Skip(const struct LcfReader::Chunk& chunk_info, const char* where);
197197

198+
/**
199+
* Like Skip but only dumps the content of the skipped chunk on stderr.
200+
*
201+
* @param length how many bytes to dump
202+
*/
203+
void Dump(uint32_t length);
204+
198205
/**
199206
* Encodes a string to UTF-8 using the set encoding
200207
* in the reader constructor.

src/reader_lcf.cpp

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -282,10 +282,14 @@ void LcfReader::Skip(const struct LcfReader::Chunk& chunk_info, const char* wher
282282
Log::Debug("Skipped Chunk %02X (%" PRIu32 " byte) in lcf at %" PRIX32 " (%s)",
283283
chunk_info.ID, chunk_info.length, Tell(), where);
284284

285+
Dump(chunk_info.length);
286+
}
287+
288+
void LcfReader::Dump(uint32_t length) {
285289
std::stringstream ss;
286290
ss << std::hex;
287291

288-
for (uint32_t i = 0; i < chunk_info.length; ++i) {
292+
for (uint32_t i = 0; i < length; ++i) {
289293
uint8_t byte;
290294
LcfReader::Read(byte);
291295
ss << std::setfill('0') << std::setw(2) << (int)byte << " ";

0 commit comments

Comments
 (0)