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

Refactor Interpreter command execution #1740

Merged
merged 24 commits into from
Aug 4, 2019
Merged

Conversation

mateofio
Copy link
Contributor

@mateofio mateofio commented Apr 6, 2019

This PR modifies the interpreter to use SaveEventExecState and SaveEventExecFrame chunks so that it executes more accurately and allows correct saving and loading of LSD chunks while events are running.

Changes include

  • Refactoring call stack to use frame array instead of child interpreters
  • Fixing wait commands
  • Fixing key input proc
  • Fixing wait for all movement
  • Other cleanups

Control flow refactors using subcommand_path chunks will come in the next PR.

Depends: #1717
Depends: #1739
Depends: EasyRPG/liblcf#324

Fix: #757
Fix: #1777

Test Cases from #1707 addressed by this PR

  • 9
  • 10
  • 11
  • 12
  • 13 - commands work in rm2k3e mode
  • 13 - commands crash otherwise (We currently print a warning)
  • 14
  • 15
  • 16
  • 17
  • 18

@mateofio mateofio force-pushed the event_state branch 3 times, most recently from 79996f4 to 8bea0cd Compare April 6, 2019 13:11
@mateofio mateofio force-pushed the event_state branch 13 times, most recently from 6292f5f to f2760a9 Compare April 7, 2019 17:25
@mateofio mateofio marked this pull request as ready for review April 7, 2019 17:29
@mateofio
Copy link
Contributor Author

mateofio commented Apr 7, 2019

I'm cutting this one here and will do the control flow / subcommand_path stuff in the next PR.

Test cases related to this have been listed and need to be verified.

@mateofio
Copy link
Contributor Author

mateofio commented Apr 13, 2019

All test cases pass, except that for doing "ThisEvent" from common events in Player causes warnings instead of crashing. Personally I think this should be fixed, as it quickly ends up in undefined/corrupted behavior but that falls under #1720 and I don't want a huge debate about it holding up this PR.

This is ready for review and merge.

@fdelapena
Copy link
Contributor

Diff between PR1717 and PR1740: mateofio/Player@scene_fixes...fmatthew5876:event_state

mateofio added 22 commits July 30, 2019 22:21
* Don't ever delete the interpreter, because allocating
and deleting is slow.
* Still don't allocate an interpreter until a parallel page
is activated, however.
* assert if we're parallel but there is no interpreter. This means
there is a bug that needs to be fixed.
Don't make extra copies of the data. Also avoids potential
sync with page bugs.
Eliminates possibility of sync with page bugs
This flag is only used during initiation and immediately cleared.
So pass it into Refresh() as a local variable instead of storing it.
Store an entire SaveEventExecFrame and use the
last element of its stack as the list.

Until we remove child interpreters, the stack articially
stays always as size 1.
Add Game_Interpreter_Map::OnMapChange() and call it for
the foreground interpreter.
* Use SaveEventExecState::stack
* Remove child_interpreter
* Correct storage of event_id chunk
* Correct behavior for "ThisEvent" commands for rm2k3e and not
* Use wait_time chunk. Allows frame accurate loading of save
  games with active wait commands.
* Waiting pan commands also use wait_time
Use the correct chunk
Use the wait_movement chunk and check in main update loop.
* Support rm2k and rm2k3 versions
* Abstract nasty details of chunk versioning
@mateofio
Copy link
Contributor Author

I found a regression in the game log.[in] (Download)

Go through the intro, start the computer, select "Enhanced Reality". Once entered you can't leave the ER menu anymore. That "Please turn on ER headset" doesn't always appear and that cancelling sometimes closes the whole PC window are game bugs.

This one is fixed now.

I have addressed all review comments and game regressions. Also rebased to master.

@Ghabry Ghabry mentioned this pull request Aug 4, 2019
8 tasks
@Ghabry
Copy link
Member

Ghabry commented Aug 4, 2019

Well the stuff I found before my vacation is fixed, so is fine for me now.
Will just merge this one now to get this finally in. But all the other PRs have to wait until next Sunday when I'm back home.

@Ghabry Ghabry merged commit 4c3913d into EasyRPG:master Aug 4, 2019
@mateofio mateofio deleted the event_state branch December 29, 2019 20:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
4 participants