{"id":83,"date":"2018-07-01T18:31:16","date_gmt":"2018-07-01T18:31:16","guid":{"rendered":"https:\/\/blogs.scummvm.org\/douglas\/?p=83"},"modified":"2022-05-24T18:36:38","modified_gmt":"2022-05-24T18:36:38","slug":"residualvm-week-7","status":"publish","type":"post","link":"https:\/\/blogs.scummvm.org\/douglas\/2018\/07\/01\/residualvm-week-7\/","title":{"rendered":"ResidualVM: Week 7"},"content":{"rendered":"<div class=\"post-outer\">\n<div class=\"post\">\n<div id=\"post-body-2585386199206203675\" class=\"post-body entry-content float-container\">\n<div>Sorry for you guys waiting\u00a0<span style=\"text-decoration: line-through;\">as if there really are people waiting to read my blog<\/span>, it seems that this week, and potentially next week, are still about finishing small tails left from the menu task. Well, this is not just because of laziness (and there is some laziness recently&#8230; I didn&#8217;t feel completely well for a couple days&#8230; But I am good now, so no excuses any more), but some of them actually have problems deeper than I had expected.<\/div>\n<div><\/div>\n<div>One example is the task of implementing the Book of Secrets, the extra content of the game, in the main menu. It looked easy at a glance since it is not a menu, but a game level. Just load the level when the button is clicked and there, the book opens.<\/div>\n<div><\/div>\n<table class=\"tr-caption-container\" cellspacing=\"0\" cellpadding=\"0\" align=\"center\">\n<tbody>\n<tr>\n<td><img decoding=\"async\" src=\"https:\/\/blogs.scummvm.org\/douglas\/wp-content\/uploads\/sites\/63\/2022\/05\/book-1.png\" \/><\/td>\n<\/tr>\n<tr>\n<td class=\"tr-caption\">The Book of Secrets<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<div>\nBut that&#8217;s not the whole story of it. The Book of Secrets is probably the only game level that contains texts in its resources. When it comes to texts, one problem will show up: the texts&#8217; textures will not be automatically reset when the screen&#8217;s resolution changes. I have done similar things before but again, things are different here. The level of the Book of Secrets contains only one location, but that location contains multiple layers, which all contain texts. The default implementation of a location will only list all render entries, which store the texts I am looking for, of the currently enabled layer. So I have to open a new interface in the Location class, let it list all the layers, then find the render entries containing texts and reset their textures.<\/div>\n<table class=\"tr-caption-container\" cellspacing=\"0\" cellpadding=\"0\" align=\"center\">\n<tbody>\n<tr>\n<td><img decoding=\"async\" src=\"https:\/\/blogs.scummvm.org\/douglas\/wp-content\/uploads\/sites\/63\/2022\/05\/layer.png\" \/><\/td>\n<\/tr>\n<tr>\n<td class=\"tr-caption\">Find all the layers and reset texts&#8217; textures<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<div><\/div>\n<div>Another annoying problem of the Book of Secrets is that it can directly quit to the main menu, which is accomplished by the script system built into the engine. The point is: the original implementation of the quitting to the main menu will automatically deallocate all the loaded game resources, but the script system is still running in the middle of the process, soSEGMANTATION FAULTTTTTTT!!! For some reason, I don&#8217;t use an IDE for development, and it seems that I still need experiences in managing pointers, because it literally took me an ETERNITY to realize what happened. Really, now I know the good of Linux, where you can install\u00a0Address Sanitizer to help to debug. Fixing this issue is easy though, just delay the time where the quitting is actually performed.<\/div>\n<table class=\"tr-caption-container\" cellspacing=\"0\" cellpadding=\"0\" align=\"center\">\n<tbody>\n<tr>\n<td><img decoding=\"async\" src=\"https:\/\/blogs.scummvm.org\/douglas\/wp-content\/uploads\/sites\/63\/2022\/05\/quit.png\" \/><\/td>\n<\/tr>\n<tr>\n<td class=\"tr-caption\">Delay the quitting<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<div><\/div>\n<div>The other task I have finished this week is about enabling the confirmation message dialog. Since the original game uses the OS&#8217;s dialog and right now ResidualVM has no API for this, after discussion I decided to just use ResidualVM&#8217;s dialog\u00a0for the first version. At first, I intended to follow how (I think) the original game does: read all the message texts used from the gui.ini file, whose content may change to\u00a0achieve localization. I had written all the necessary codes to do this, but then I found that ResidualVM&#8217;s dialog\u00a0does not support non-Latin characters well. So sadly, right now only the built-in default English version can be used. I kept all the codes there though, for future development.<\/div>\n<div><\/div>\n<div>Now I am working on the keyboard binding task. Honestly, I didn&#8217;t know that you can play The Longest Journey with the help of the keyboard until my mentor told me so. It doesn&#8217;t look like a handy task, but manageable, and I plan to make it my last menu task before I officially start doing the shadow. Anyway, time to keep on working!<\/div>\n<div>\n<\/div>\n<div>\n<div>\n<div>For the detailed development of the codes, please refers to\u00a0<a href=\"https:\/\/github.com\/residualvm\/residualvm\/pull\/1467\">this<\/a>\u00a0and\u00a0<a href=\"https:\/\/github.com\/residualvm\/residualvm\/pull\/1468\">this<\/a>\u00a0Pull Request on GitHub.<\/div>\n<\/div>\n<div>\n<div>\n<div>All code images are generated through\u00a0<a href=\"https:\/\/carbon.now.sh\/\" target=\"_blank\" rel=\"noopener\">Carbon<\/a>.<\/div>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<div class=\"post-bottom\">\n<div class=\"post-footer float-container\">\n<div class=\"post-footer-line post-footer-line-1\"><\/div>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n","protected":false},"excerpt":{"rendered":"<p>Sorry for you guys waiting\u00a0as if there really are people waiting to read my blog, it seems that this week, and potentially next week, are still about finishing small tails left from the menu task. Well, this is not just because of laziness (and there is some laziness recently&#8230; I didn&#8217;t feel completely well for [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-83","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"_links":{"self":[{"href":"https:\/\/blogs.scummvm.org\/douglas\/wp-json\/wp\/v2\/posts\/83","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/blogs.scummvm.org\/douglas\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blogs.scummvm.org\/douglas\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blogs.scummvm.org\/douglas\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/blogs.scummvm.org\/douglas\/wp-json\/wp\/v2\/comments?post=83"}],"version-history":[{"count":1,"href":"https:\/\/blogs.scummvm.org\/douglas\/wp-json\/wp\/v2\/posts\/83\/revisions"}],"predecessor-version":[{"id":84,"href":"https:\/\/blogs.scummvm.org\/douglas\/wp-json\/wp\/v2\/posts\/83\/revisions\/84"}],"wp:attachment":[{"href":"https:\/\/blogs.scummvm.org\/douglas\/wp-json\/wp\/v2\/media?parent=83"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blogs.scummvm.org\/douglas\/wp-json\/wp\/v2\/categories?post=83"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blogs.scummvm.org\/douglas\/wp-json\/wp\/v2\/tags?post=83"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}