ResidualVM: Week 9

So apparently this week is still about the keyboard bindings, mostly on the two things: the display of exit locations, and further improvement on the dialog panel.

In the original game, when the player presses the key X, all the exit locations of the current location will be pointed out with a symbol on it. To achieve this, I need to find which PATTable (the object that contains info of a clicking area) has the exit action, get its location, and render a symbol on it. It sounds easy, but the OO structure of the game engine warps it in a pretty complex way and I have to open interfaces in many classes. After doing so, I started to understand that why people are being more critical to OO design and FP is getting more popular. You really need to know how to balance things. Also, it took me some time to verify the exact location of the symbol to be drawn.

See the exit symbol on the door?

As for the dialog panel, I made a wrong assumption in my previous implementation: assuming that all dialog options will be only one line. Yet taking the fact that an option may wrap up multiple lines into consideration, many corner cases need to be reconsidered. So basically, I have to rewrite the codes in the dialog panel, again, to accommodate this change.

The final approach I came up with is actually not that complicated: instead of just recording the first visible option in the current scrolling, the last visible option is also recorded. When the dialog panel scrolls, one of them can be determined easily and used to find the other one. During the finding, the total height of the currently selected options is recorded to see whether they fit into the panel’s space. Of course, there are some corner cases need to be paid attention to, but the overall logic is intuitive.
Find the last visible option with the first visible option pre-determined
The keyboard bindings task is taking way to much time to tackle with, but I believe it is very close to being merged. I have already been looking at the next important task: implementing the characters’ shadows, and I can’t wait to have some “experience” with OpenGL. Sorry for such a short blog this week, just not much to say. I promise there will be more updates next week.
All code snippets are generated through Carbon