Skip to content
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

Maniac Patch: Implement Load, Save, SaveInfo and Mouse input #2623

Merged
merged 9 commits into from
Sep 13, 2021

Conversation

Ghabry
Copy link
Member

@Ghabry Ghabry commented Aug 28, 2021

This implements the imo most useful commands of the Maniac Patch (except for String picture, this is also pretty cool!)

Still have to do careful testing of this again. There shouldn't be regressions as the code is usually in ManiacPatch checks.

Discussion:

Load

This does a Async Load (yields the interpreter), in Maniac it loads directly, this is incompatible with how our code works.

The parameter for checking whether the save exists is ignored, in RPG_RT loading a non-existant save simply crashes.

Save

This does a Async save (Yields the interpreter), in Maniac this saves directly resulting in saving at an undefined state because there is stuff in temporaries. So yielding here is safer.

Get Save Info

In Maniac this is implemented by setting the arguments (or not if the pic exists) and then doing a jump just before the 2k3E picture code that handles layers etc. (so save game pictures shown inherit the attributes of the current picture in the slot)
As we cannot really do this I added a function for retrieving the current Show Params instead.
There will be likely minor incompatibilities here, but when they do not do anything fancy with the picture it should work...

Key Input Proc (Mouse)

Had to add "& 2"-checks where applicable as Maniac uses bit 1 of certain keys for this:

  • Confirm: Mouse left
  • Cancel: Mouse right
  • Shift: Mouse middle
  • Up: Wheel Up
  • Down: Wheel Down

To reduce chaos in the code this will only work properly with RPG2k3E, KeyInput is already messy enough, so sorry, no fully Maniac mouse input in Player for 2k ;).

New return values in Control Variables

Maniacs added tons of stuff here, also new ops like sin and pow. For now I only add the absolute minimum:

  • Current Time (Maniac reuses the savegame time function here, I use stdlib time functions)
  • Frame counter
  • Maniac version: Returns the highest version available before the engine was replaced with this replace

ValueOrVariable

Maniac Patch adds support for "Variable indirect", "Switch" and "Switch Indirect" to some event commands (and I guess with TPC and the new engine to even more).

To make this easier for me I simply added this handling to ValueOrVariable which is our resolver for this indirection stuff.

Has the side-effect that all event commands that support indirection got these features now with a minimal code change.

This e.g. implements for Call Event: "Added method to specify common event by variable number variable."

@Ghabry
Copy link
Member Author

Ghabry commented Aug 28, 2021

Already found some bugs:

Load

Forgot to remove the warning (upps)

Different behaviour:
ManiacPatch goes from black to fade-in here, this is not implemented

Key Input Proc

Wheel Up and Right click not working (Copy paste error)


The rest appears to work. In the new, rewritten Maniac Patch GetSaveInfo seems to be kinda broken o_O

@Ghabry Ghabry removed the Has PR Dependencies This PR depends on another PR label Aug 28, 2021
The handling is incompatible to how Maniacs does it:
First the interpreter is yielded before performing the actions.
This prevents issues with undefined data.
…direct for ValueOrVariable function

Maniac Patch itself does not support this for all commands but supporting it for all is simpler and makes most sense.
@Ghabry Ghabry force-pushed the maniac-events branch 2 times, most recently from a0538da to 076e2a9 Compare September 11, 2021 20:21
@fdelapena fdelapena merged commit 50e2fab into EasyRPG:master Sep 13, 2021
@Ghabry Ghabry deleted the maniac-events branch February 22, 2022 13:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

Successfully merging this pull request may close these issues.

3 participants