{"id":32,"date":"2019-07-02T09:51:33","date_gmt":"2019-07-02T09:51:33","guid":{"rendered":"https:\/\/blogs.scummvm.org\/nipungarg\/?p=32"},"modified":"2022-05-22T09:54:09","modified_gmt":"2022-05-22T09:54:09","slug":"gsoc-update-week-5","status":"publish","type":"post","link":"https:\/\/blogs.scummvm.org\/nipungarg\/2019\/07\/02\/gsoc-update-week-5\/","title":{"rendered":"GSOC Update: Week 5"},"content":{"rendered":"<p>Continuing the work that I started last week, I have implmeneted most of the functionality in AI and Window, and mostly completed a new sub-system: Input.<\/p>\n<p>The openning cinematic is completely running, all the input controls except the Quit Key and the Pause Key have been implemented, NPCs, Bots and objects like crates have been introduced, and the player can now talk to NPCs. Here it is:<\/p>\n<div style=\"width: 454px;\" class=\"wp-video\"><!--[if lt IE 9]><script>document.createElement('video');<\/script><![endif]-->\n<video class=\"wp-video-shortcode\" id=\"video-32-1\" width=\"454\" height=\"360\" preload=\"metadata\" controls=\"controls\"><source type=\"video\/mp4\" src=\"https:\/\/blogs.scummvm.org\/nipungarg\/wp-content\/uploads\/sites\/28\/2019\/07\/Hyperspace-Delivery-Boy-CbiMT60i3eU.mp4?_=1\" \/><a href=\"https:\/\/blogs.scummvm.org\/nipungarg\/wp-content\/uploads\/sites\/28\/2019\/07\/Hyperspace-Delivery-Boy-CbiMT60i3eU.mp4\">https:\/\/blogs.scummvm.org\/nipungarg\/wp-content\/uploads\/sites\/28\/2019\/07\/Hyperspace-Delivery-Boy-CbiMT60i3eU.mp4<\/a><\/video><\/div>\n<p style=\"text-align: center;\"><em>(Source: https:\/\/www.youtube.com\/watch?v=CbiMT60i3eU)<\/em><\/p>\n<p>While most of this week went according to plan, I ran into a few weird bugs that sev had to point out for me. Here are they:<\/p>\n<h3 id=\"the-cinecommand-problem\">The CineCommand Problem<\/h3>\n<p>Shortly after writing the previous blogpost, I ran into a bit of trouble. I noticed that Lua was loading the wrong string for the dialog text, and fixed that which directly caused the game to crash.<\/p>\n<p>After a few hours going over why it was crashing(which among other things involved printing the Lua Stack), sev pointed out that I had been using a preallocated char arrays of 32 length, while trying to load messages as long as 80+ characters. This had led to a memory overwrite, and caused the crash. Changing the CineCommand struct to use a <code class=\"language-plaintext highlighter-rouge\">const char *<\/code> fixed the crash.<\/p>\n<h3 id=\"dialog-spacing\">Dialog Spacing<\/h3>\n<p>In a stupid blunder, I had been miscalulating the whitespace in the dialog messages. Instead of simply adding the designated number of pixels, I was multiplying them leading to a large amount of unnecessary whitespace.<\/p>\n<h3 id=\"foreground-and-background-indices\">Foreground and Background indices<\/h3>\n<p>If one recalls the previous blogpost, one would know I have a tendency to declare values as unsigned variables. This led to another problem recently, when I realized that certain tiles are designed to as to have a <code class=\"language-plaintext highlighter-rouge\">-1<\/code> index value. This type mismatch had to be corrected.<\/p>\n<h3 id=\"the-clock-that-wouldnt-disappear\">The Clock That Wouldn\u2019t Disappear<\/h3>\n<p>In the openning cinematic, there is a clock that needs to vanish after it is thrown. However, it wasn\u2019t disappearing. sev pointed out that I had been using the <code class=\"language-plaintext highlighter-rouge\">_cine[i]-&gt;x, _cine[i]-&gt;y<\/code> positions rather than the <code class=\"language-plaintext highlighter-rouge\">_cineBlitList[i]-&gt;x, _cineBlitList[i]-&gt;y<\/code> positions for the clock, hence its appearance.<\/p>\n<h3 id=\"the-copypaste-error\">The Copy\/Paste Error<\/h3>\n<p>I had made a nasty copy\/paste error. When making a nester for-loop, I had copy-pasted the outer-loop without changing the indices of the new loop. This didn\u2019t show any problems at first, but would definitely cause trouble later.<\/p>\n<h3 id=\"changing-indice-mid-loop\">Changing indice mid-loop<\/h3>\n<p>One of the slightly-inconvenient problems I have started to face involves altering an array while iterating over it. Doing so while using an iterator has caused to be trouble some, since it would lead to one or the other pointer error. The best approach seems to be to rewrite those loops without the use of iterators.<\/p>\n<h3 id=\"objectives\">Objectives<\/h3>\n<ol>\n<li>Add Sound System<\/li>\n<li>Add the remaining Bots and NPC code<\/li>\n<li>Implement Pushing<\/li>\n<li>Find and patch Lua problems<\/li>\n<\/ol>\n<p>&nbsp;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Continuing the work that I started last week, I have implmeneted most of the functionality in AI and Window, and mostly completed a new sub-system: Input. The openning cinematic is completely running, all the input controls except the Quit Key and the Pause Key have been implemented, NPCs, Bots and objects like crates have been [&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-32","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"_links":{"self":[{"href":"https:\/\/blogs.scummvm.org\/nipungarg\/wp-json\/wp\/v2\/posts\/32","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/blogs.scummvm.org\/nipungarg\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blogs.scummvm.org\/nipungarg\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blogs.scummvm.org\/nipungarg\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/blogs.scummvm.org\/nipungarg\/wp-json\/wp\/v2\/comments?post=32"}],"version-history":[{"count":3,"href":"https:\/\/blogs.scummvm.org\/nipungarg\/wp-json\/wp\/v2\/posts\/32\/revisions"}],"predecessor-version":[{"id":36,"href":"https:\/\/blogs.scummvm.org\/nipungarg\/wp-json\/wp\/v2\/posts\/32\/revisions\/36"}],"wp:attachment":[{"href":"https:\/\/blogs.scummvm.org\/nipungarg\/wp-json\/wp\/v2\/media?parent=32"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blogs.scummvm.org\/nipungarg\/wp-json\/wp\/v2\/categories?post=32"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blogs.scummvm.org\/nipungarg\/wp-json\/wp\/v2\/tags?post=32"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}