lanceewing / agile

Sierra AGI (Adventure Game Interpreter) engine written in C#
15 stars 7 forks source link

Refactored how NewRoom, restore and restart operate #49

Closed lanceewing closed 1 year ago

lanceewing commented 1 year ago

Refactored how NewRoom, restore and restart operate. They should all immediately rescan logics from the top of Logic.0.

This is discussed in PR #48 and issue #45.

As mentioned in some of the comments in those discussions, NewRoom shouldn't have been outside of the main logic execution, as that necessitated a design that made it difficult for restore and restart to also rescan logics. Now that NewRoom is executed at the point where the new.room and new.room.v commands are encountered, then it means the return value for ExecuteLogic can work more like the original AGI interpreter.

vafada commented 1 year ago

Tested on both LSL and PQ and fixes the issue.

Looks good to me. I didn't like that pass by reference for exit and newRoom .. It make debugging so hard.

one more thing... I think you can now get rid of state.CurrentRoom.

In this PR, state.CurrentRoom is only being set and its never being read. Removing that should also fix https://github.com/lanceewing/agile/issues/21

vafada commented 1 year ago

this possibly fixes also #21

lanceewing commented 1 year ago

@vafada , I've made all the changes you suggested and pushed to this branch. Good call on the CurrentRoom.

Let me know if this still works fine for you after these changes. I gave it a quick test and it seemed fine. If you agree, then I'll merge this PR and close both issues.

lanceewing commented 1 year ago

this possibly fixes also #21

Yeah, I agree that this would fix that one. I can see that it was the fact that NewRoom was outside of the main loop that was causing that issue.

vafada commented 1 year ago

Look good to me. Played some PQ and no issues