-
Notifications
You must be signed in to change notification settings - Fork 217
Maniacs Patch - Save Image command #3498
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
Implements the CommandManiacSaveImage function, allowing saving of screen or picture images to disk with options for dynamic effects and opacity. Registers the new command in ExecuteCommand and updates the header file with its declaration.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This PR implements the CommandManiacSaveImage function for the Maniac Patch, enabling event commands to save either the current screen or a specified picture to disk as a PNG file. The implementation supports dynamic rendering effects (color tone, flash, flip) and an option to force opaque pixels.
Key Changes
- Added
CommandManiacSaveImagehandler that supports saving screen captures or individual picture images with optional dynamic effects and opacity modifications - Registered the new Maniac event command (ID 3026) in the command dispatcher
- Included
cache.hheader to enable bitmap effect processing
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| src/game_interpreter.h | Declares the new CommandManiacSaveImage method in the Game_Interpreter class |
| src/game_interpreter.cpp | Implements the save image command with screen/picture capture, dynamic effects application, opacity handling, and PNG file writing; registers command 3026 in the dispatcher; includes cache.h for bitmap effects |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Adds logic to mark pending picture requests as important and yield/repeat the async operation in CommandManiacSaveImage. This ensures that image save operations wait for picture requests to complete before proceeding.
|
Could you create a simple test case for me that has these things in it:
(btw wow To ensure this works when the save directory is redirected (e.g. web player or game inside a ZIP) Also saving of a single picture looks pretty complicated. Will see if I can simplify this. |
…d fallback on loading image Refactored CommandManiacSaveImage to better handle opaque and effects flags, including loading cached images without transparency and applying effects only when needed. Added support for cropping spritesheet frames and ensured alpha is forced to 255 for opaque saves. Updated FileFinder to use open_generic_with_fallback for image loading.
|
Test cases + both output from maniacs and ours provide. |
| bool is_canvas = false; | ||
| if (picture.sprite && picture.sprite->GetBitmap()) { | ||
| // Canvas bitmaps have IDs starting with "Canvas:" | ||
| is_canvas = StartsWith(picture.sprite->GetBitmap()->GetId(), "Canvas:"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
what is a canvas bitmap?
|
(Note to myself thinking about reusing Sprite functionality) What the image saving appears to do is:
|
Implements the CommandManiacSaveImage function, allowing saving of screen or picture images to disk with options for dynamic effects and opacity. Registers the new command in ExecuteCommand and updates the header file with its declaration.
Maniac Patch: Image Saving Support
CommandManiacSaveImagetoGame_Interpreter, which enables saving either the current screen or a specified picture to a PNG file. The command supports dynamic mode (applying color tone, flash, flip effects) and an option to force opaque pixels.Maniac_SaveImage, command ID 3026) in the interpreter's command dispatcher, allowing it to be invoked from events.Game_Interpreterclass header (game_interpreter.h).Supporting Changes
cache.hheader ingame_interpreter.cppto support bitmap effect processing for dynamic image saving.