{"id":107,"date":"2018-06-11T14:40:11","date_gmt":"2018-06-11T14:40:11","guid":{"rendered":"https:\/\/blogs.scummvm.org\/joefish-gsoc\/?p=107"},"modified":"2022-05-21T14:41:51","modified_gmt":"2022-05-21T14:41:51","slug":"week-3-game-intro-running","status":"publish","type":"post","link":"https:\/\/blogs.scummvm.org\/joefish-gsoc\/2018\/06\/11\/week-3-game-intro-running\/","title":{"rendered":"Week 3 &#8212; Game intro running"},"content":{"rendered":"<h2><a href=\"https:\/\/blogs.scummvm.org\/joefish-gsoc\/wp-content\/uploads\/sites\/22\/2018\/06\/dialog4.gif\" target=\"_blank\" rel=\"noopener\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter wp-image-109\" src=\"https:\/\/blogs.scummvm.org\/joefish-gsoc\/wp-content\/uploads\/sites\/22\/2018\/06\/dialog4.gif\" alt=\"\" width=\"640\" height=\"360\" \/><\/a>Overview<\/h2>\n<ul>\n<li>Text rendering<\/li>\n<li>Basic Dialog implementation for intro<\/li>\n<li>Logic abstraction<\/li>\n<\/ul>\n<p>The porting process is tougher than I had anticipated. I described my problems with the animations in <a href=\"https:\/\/joefish-gsoc.blogspot.com\/2018\/06\/week-2-animation.html\">Week 2<\/a> and continued with correctly positioning sprites in the dialog. Fortunately I [found my mistake](link to Renderer::drawSprite pos calc) and dialogs not only for the intro, but in general will be solved soon.<\/p>\n<h3 id=\"details\">Details<\/h3>\n<p>The logic differentiates between different states like showing a dialog, the game, a cutscene, and so on. This helps the logic to know when to update what so that for example you are not slain while still picking up items from a chest. <a href=\"https:\/\/github.com\/Joefish\/scummvm\/commit\/6c6549d2709e34150bacea889288abcd2f796417#diff-8792219dfe16db81635e7ea0217597f8R61\">link<\/a><\/p>\n<p>The characters for text rendering are stored in general2.anm that use the ASCII value as an offset to access the sprite in the animation (link to Dialog::update default case). The <a href=\"https:\/\/github.com\/Joefish\/scummvm\/commit\/f03c3f799f5fa99989c96ecda88c08970ceb9d6b#diff-8792219dfe16db81635e7ea0217597f8R43\">dialog strings<\/a> contain information directly for fadein\/out, what type of dialog it should be (Yes\/No, Ok, multipage, immediate) <a href=\"https:\/\/github.com\/Joefish\/scummvm\/blob\/e5a0d552437a11a63e5f303ed66081bec357a8e4\/engines\/immortal\/dialog.cpp#L80\">and so on<\/a>.<\/p>\n<p>In general the implementation is quite simple. The engine iterates over every char one after another and either executes the \u2018meta char\u2019 (e.g. \u2018|\u2019 for fade in text) or renders the sprite for the character. When the null terminator is reached and no further string is to be loaded, the dialog rendering terminates and depending on if the dialog expects user input (password, yes\/no, ok) the logic either waits on a keypress before switching back to its \u2018game state\u2019 and continues where the player left off.<\/p>\n<h3 id=\"next-week\">Next Week<\/h3>\n<p>Judging from my current speed, I hope to get our hero making its first steps in the first level and ironing out the remaining dialog bugs.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Overview Text rendering Basic Dialog implementation for intro Logic abstraction The porting process is tougher than I had anticipated. I described my problems with the animations in Week 2 and continued with correctly positioning sprites in the dialog. Fortunately I [found my mistake](link to Renderer::drawSprite pos calc) and dialogs not only for the intro, but [&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-107","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"_links":{"self":[{"href":"https:\/\/blogs.scummvm.org\/joefish-gsoc\/wp-json\/wp\/v2\/posts\/107","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/blogs.scummvm.org\/joefish-gsoc\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blogs.scummvm.org\/joefish-gsoc\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blogs.scummvm.org\/joefish-gsoc\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/blogs.scummvm.org\/joefish-gsoc\/wp-json\/wp\/v2\/comments?post=107"}],"version-history":[{"count":2,"href":"https:\/\/blogs.scummvm.org\/joefish-gsoc\/wp-json\/wp\/v2\/posts\/107\/revisions"}],"predecessor-version":[{"id":110,"href":"https:\/\/blogs.scummvm.org\/joefish-gsoc\/wp-json\/wp\/v2\/posts\/107\/revisions\/110"}],"wp:attachment":[{"href":"https:\/\/blogs.scummvm.org\/joefish-gsoc\/wp-json\/wp\/v2\/media?parent=107"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blogs.scummvm.org\/joefish-gsoc\/wp-json\/wp\/v2\/categories?post=107"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blogs.scummvm.org\/joefish-gsoc\/wp-json\/wp\/v2\/tags?post=107"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}