EasyRPG / Player

RPG Maker 2000/2003 and EasyRPG games interpreter
https://easyrpg.org/player/
GNU General Public License v3.0
965 stars 183 forks source link

Maniacs Feature: Add separate Width/Height parameters for scaling pictures, Picture StringVar, Tint Variable #3180

Closed ToolMan2k closed 2 months ago

ToolMan2k commented 6 months ago

This commit allows for the use of separate Width/Height parameters for rendering pictures. You can use this feature with ManiacPatch 211010 using the .scale2 parameter.

It also adds scaling support for "Maniac_ShowStringPic" and a quick fix for failed bitmap assertion.

https://github.com/EasyRPG/Player/assets/26819563/e8a6eb26-f7a9-4267-a4f1-e26e4c5e135c

Sister commit here: https://github.com/EasyRPG/liblcf/pull/473

Added:

Fixed:

ToolMan2k commented 6 months ago

Looking at the failed test, we'll need to compile liblcf using a modified fields_easyrpg file.

Ghabry commented 6 months ago

The build failures are normal when depending on lcf changes.

You added new easyrpg chunks here. Did you check how maniac patch stores it in the save file? If it isn't something annoying like storing it in some upper bits we usually try to be compatible to mp here.

ToolMan2k commented 6 months ago

You added new easyrpg chunks here. Did you check how maniac patch stores it in the save file? If it isn't something annoying like storing it in some upper bits we usually try to be compatible to mp here.

This is definitely something that needs more love. I did try to load saves between original RPG_RT and EasyRPG, it does prints about "unknown chunks" inside the save file. Inside my above test project, you can make an instant save file by pressing SHIFT.

Here's the log I've posted on the bug tracker post:

Skipped Chunk 86 (1 byte) in lcf at 1F9 (SaveSystem)
01 
Skipped Chunk 87 (1 byte) in lcf at 1FD (SaveSystem)
04 
Reading Primitive of incorrect size 4 (expected 1) at 29D
SavePicture: Corrupted Chunk 0x06 (size: 4, pos: 0x29d): fixed_to_map : Read 7 bytes! Reseting...
Reading Primitive of incorrect size 3 (expected 1) at 2AD
SavePicture: Corrupted Chunk 0x09 (size: 3, pos: 0x2ad): use_transparent_color : Read 5 bytes! Reseting...
Skipped Chunk 0A (8 byte) in lcf at 2B2 (SavePicture)
00 00 00 00 00 60 73 40 
Skipped Chunk 24 (2 byte) in lcf at 2D0 (SavePicture)
82 36 
Skipped Chunk 0A (8 byte) in lcf at 345 (SavePicture)
00 00 00 00 00 60 73 40 
Skipped Chunk 1E (2 byte) in lcf at 362 (SavePicture)
82 20 
Skipped Chunk 24 (2 byte) in lcf at 37E (SavePicture)
82 36 
Debug: Loading Save Save01.lsd
Skipped Chunk 86 (1 byte) in lcf at 1F9 (SaveSystem)
01 
Skipped Chunk 87 (1 byte) in lcf at 1FD (SaveSystem)
04 
Reading Primitive of incorrect size 4 (expected 1) at 29D
SavePicture: Corrupted Chunk 0x06 (size: 4, pos: 0x29d): fixed_to_map : Read 7 bytes! Reseting...
Reading Primitive of incorrect size 3 (expected 1) at 2AD
SavePicture: Corrupted Chunk 0x09 (size: 3, pos: 0x2ad): use_transparent_color : Read 5 bytes! Reseting...
Skipped Chunk 0A (8 byte) in lcf at 2B2 (SavePicture)
00 00 00 00 00 60 73 40 
Skipped Chunk 24 (2 byte) in lcf at 2D0 (SavePicture)
82 36 
Skipped Chunk 0A (8 byte) in lcf at 345 (SavePicture)
00 00 00 00 00 60 73 40 
Skipped Chunk 1E (2 byte) in lcf at 362 (SavePicture)
82 20 
Skipped Chunk 24 (2 byte) in lcf at 37E (SavePicture)
82 36 
Debug: Savegame version 0 (RPG_RT or EasyRPG Player Pre-0.6.0)
Debug: Loaded Map Map0001.lmu
Debug: Tree: MAP0001
ToolMan2k commented 6 months ago

While playing around, jumping between RPG_RT, saving, then reading the savefile using LCF2XML, I can determine the following things:

  1. Maniacs uses "current_magnify" and "finish_magnify" for the Width Parameter.
  2. When using the height parameter, it adds 8 bytes to the 0A chunk, and adds between 1 to 4 bytes in chunk 24.
  3. 0A seems to be the current height double, and 24 seems to be the final height integer.
ToolMan2k commented 6 months ago

I'll recompile liblcf with the proper indexes, then I'll let you know. However, I have a quick question: is it safe to reuse a save chunk twice?

For instance, using the block 07 for both current_magnify and current_width_scale, since they're the same value internally. Or would we have to change the name for everything, even though width/height is only for Maniac?

I would certainly keep magnify as it is for compatibility reasons.

ToolMan2k commented 6 months ago

As per https://github.com/EasyRPG/liblcf/pull/473, I've updated the chunk pointers.

Now I can save and load between Maniacs and EasyRPG, and scaling is kept between the twos.

Ghabry commented 3 months ago

Jenkins: Test this please