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

Barrels do not roll #2197

Closed
zell180 opened this issue May 4, 2020 · 10 comments · Fixed by #2208
Closed

Barrels do not roll #2197

zell180 opened this issue May 4, 2020 · 10 comments · Fixed by #2208

Comments

@zell180
Copy link

zell180 commented May 4, 2020

Name of the game:

Saint Seiya -Il Mito-

Player platform:

Android

Attach files (as a .zip archive or link them)

barrels_not_roll.zip

Describe the issue in detail and how to reproduce it:

Load the save and talk to the boy in front of you, select one of the choices (first play 1 level of game, 4 play 4 levels) and a minigame starts.
If you be hitten by the barrel you lose a life and the game restart but in EasyRPG the barrels no longer roll

@Ghabry
Copy link
Member

Ghabry commented May 4, 2020

It seems that when two event pages have Exactly the same custom move commands then the move command continues at the same position. Just with the new frequency settings applied. WTF.

Also tested with same length commands. It must be really 100% the same, otherwise it restarts.

@CherryDT did you know this one? ;)

@fmatthew5876
Copy link
Contributor

Confirmed in the page reset function at 0x4AAF50 in dynrpg RPG_RT. Happens near the end.

if (old_page == nullptr || old_move_route != new_move_route) {
   original_move_route_index = 0;
}

@Ghabry
Copy link
Member

Ghabry commented May 6, 2020

Are you sure this is the line for this? This looks like the normal index reset on page change code.
For determining whether the move route is the same I expect some loop or memcmp on the chunk.

@fmatthew5876
Copy link
Contributor

fmatthew5876 commented May 6, 2020

0x4AAF50 is the start of the page change function. 0x4AB200 calls a function which compares the arrays.

In this case it's not a true memcmp, it looks like it only checks the command codes. So if you had for example:

Move Right, Sw1 on Move Right, Sw2 on, they would still compare equal and the index would not be reset. This should be verified with a test.

@Ghabry
Copy link
Member

Ghabry commented May 6, 2020

Just tested it: Your observation is correct. Sometimes reverse engenering is useful to find edge-cases in edge-cases -_-

@Ghabry
Copy link
Member

Ghabry commented May 6, 2020

This seems to be also the case when you set the Move Route with "Change Move Route" and then switch to a new page with a Custom route that matches the "Event cmd move route".

Though I observe something strange:

I have RRRRDDDDLLLLUUUU for both. Then I switch the page (movement becomes slow) and somehow when the initial route was custom the U movement is suddenly fast again.

Will share the map you will see what I mean:

Next to you (tile on the right) is an event that switches the page:

Map0003.zip

@Ghabry
Copy link
Member

Ghabry commented May 6, 2020

Ah nevermind. I had "Sw1" turned on in my tests which was the page trigger. Still a good test maybe ^^

@fmatthew5876
Copy link
Contributor

Confirmed fixed by #2208

@carstene1ns carstene1ns added this to the 0.6.3 milestone May 15, 2020
@fdelapena
Copy link
Contributor

fdelapena commented Jun 28, 2020

Pizus reported is using the same feature in his game. He's using the same custom route in multiple tabs (more than two, but same behavior) and continues as documented.

So this trick seems to be known by more game authors and actively exploited because it is useful to change commands and character appearance between tabs while preserving the same route without interruptions (e.g. action RPG bosses).

Added another test case kindly provided by Pizus: issue2197.zip

@fmatthew5876
Copy link
Contributor

fmatthew5876 commented Aug 19, 2020

So this mysterious logic is actually not so mysterious at all.

It's a there to specifically avoid the issue in #2255

There is a second part of this story not mentioned here, which was necessary to fix the other issue.

When you have a move route with a switch, if the switch changes the page and that page has a different move route, then the logic in this issue sets the index to 0. Once the refresh function returns, the switch move command handler will check if the index is 0 and exit.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

Successfully merging a pull request may close this issue.

5 participants