Categories
Coding Experience Fun Opinion Technical

Reading Books in Total Distortion

Greetings everybody! Just before we start, I have something to tell you all, It’s about time and we are in the final phases of GSoC ending, the final mentor evaluation is about to happen (2 weeks~) and unfortunately, that means my tenure will be coming to an end! With that being said let’s start with my work this week! (plus what has been merged)

This week I have worked on fixing more bugs and improve more support, let’s start with the title!

Reading Books in Total Distortion!

Linked to https://trello.com/c/ZMRuRYA0/632-index-books-overflow where in books library the index in book was overflowing (see image)

image.png
bad (or bugged) render of books

Now, like any good sensible developer I took it upon myself to fix this issue! To do that I have to investigate, that how this thing is different from other “texts” in Director.. and I found that:

Style: Scrolling and that’s it! The difference was that this “text cast” has this style “Scrolling”, which was giving issues as in ScummVM we didn’t implement “Scrolling” textcast! You might have been confused about one thing: What is “Cast?” or “Text Cast” here??

Well a cast is like an element of movie, it is like the building blocks of any game/multimedia in director engine, and among these elements, we have many different kinds, for example Image cast, text cast, filmloop (series of frames), digital-video etc etc. Now each of these building blocks can have properties, like here TextCast member has this property of Style, where we can choose what kind of cast that is!

The Cast terms originally coined right after movies

e.g. it is one of the actors in a movie, you put it on a Frame, and Frames compose a Score
~ sev, (#engine-director, discord server)

So as I have previously mentioned, there is only simple text cast implemented in ScummVM, therefore, what I had to do is to simply implement a scrolling cast member! OneĀ  that takes into account a scrollbar in side and the logic to click items in it!

Well to do that, I just reused the TextScrollingWindow (ie a special kind of window specially created for displaying text in mac styled windows), well I had to do this because of scrollbar, that I needed in order to implement this scroll behaviour! Now as a part of doing this, what I was basically doing is to reuse the code that was written for text display, google says about code reuse:

Code reuse aimsĀ to save time and resources and reduce redundancy by taking advantage of assets that have already been created in some form within the software product development process.
and that serves about right! I could have simply written everything into default text class (which was used to mactexts) however the thing is, to do that I have to add scrollbar, its render, then event functions.. basically all of these were there in textwindow itself, so why do that all again when all you can do is to reuse it!
and that is how, after fixing it up, and making more changes to make it work properly, here’s the final result:

and that’s how the working books look like, Happy Reading!

Link to PR – #5182

More work done

Fixing visibility issues when setting window properties

There was this bug where assigning windows property automatically used to bring them to foreground, but this was not good as it means that sometimes hidden window that are supposed to be hidden are now shown, to fix it all I had to do is to remove the statement that does this and voila, fixed!

Link to PR – #5245

Refactor frames loading, fixing chan command

If you have been reading my blogs for a while, you must be knowing about one of the biggest changes to frames loading, well there are still some things that pop out occasionally, one of them being this debugger command “chan <number>” which was used to list channel information on any specific frame! The fix was simple, to refactor some things and fix the logic!

Link to PR – #5255

The End

Thank you for reading so far, its been great writing and working for scummvm and I really enjoyed this whole journey! Before ending I’d like to say that I have been offered to become member of this organization (Director engine), and I am very happy for that! (the process is still underway but expect the results next week), what that means is I can officially start directly committing codes to scummvm, and get some perks (cool discord roles, etc!). With that being said see you in next article!

Leave a Reply

Your email address will not be published. Required fields are marked *