Week 14 – Working on MacVenture III

Continuing from last week, I worked a bit more on IIGS support but I eventually realized that it might be too much work to take on in this GSoC period. I was initially planning on just writing the code for loading all the game data into the existing data structures and hoped that it would be enough to get things working but it wasn’t that simple. So I decided to leave it for the time being and work on it on my own pace after GSoC is over.

So after this I decided to just take care of all the pending tasks and issues from the original 2016 GSoC work and work has been going smoothly.

This is a small blog post but the first week of college was pretty hectic and I tried to do my best in the time I had. Hoping to do to better this week as GSoC comes to an end.

That’s it for this week. Thanks for reading and see you again next time!

Week 13 – Working on MacVenture II

Another week spent on MacVenture though this one was a bit uneventful. I learned a bit more about the .2mg format and saw what WebVenture was doing with it and it didn’t seem too complicated so that’s what I am adding to ScummVM right now.

About WebVenture, I actually managed to get it working. What worked was to place the game in it’s root directory and to run the website on a http-server. This should give me another frame of reference when comparing game behavior.

WebVenture Working in WebBrowser

I am not too well versed with node/javascript development but it’s good enough for me to go through and understand what’s happening. And speaking of understand, let’s have a look at the javascript file which is being executed as the game runs.

?

It wasn’t exactly what you can describe as understandable with all the obfuscation and lack of formatting. Luckily this wasn’t really that big of a problem and all I had to do was to run the Closure Compiler on the repo with all optimizations disabled and generate a file with everything intact except for the formatting (which got fixed with an online beautifier).

Anyways, having a working WebVenture made it easier to step through the game as it runs and see which piece of code is called when. Visual Studio Code wasn’t doing to well with JS code and things like Jump to Definition were often going to the wrong function so this was a really useful thing.

After that I worked for a bit on implementing the required functions to get the data from the .2mg files but that had to be put on hold for a while. Colleges were finally open and I had to leave the city to get to the hostel. I had to make some preparations both before leaving and after arriving and that made it hard to get the time to work so I took the weekend off.

The blog post got delayed by a day too but I have adjusted my hostel and will be working regularly from here ?I hope to work a bit harder this week to make up for the lost time.

That’s it for this blog post. Thanks for reading you next week!

Week 12 – Working on MacVenture

3 months have passed since GSoC started! This week I started working on MacVenture which was also worked on by another GSoC student blorente in 2016. You can see his blog here. My work continues were he left off, fixing the engine to work with the newer MacGui while also implementing some new things.

The first thing I worked on was the borders.

The borders had a bunch of problems. The title wasn’t aligned properly in either direction and it was just broken when you had a window active. If you read my past blogs then you might remember how nine-patch gave me some troubles when I was working with WAGE. This time wasn’t any different either.

It took me a decent amount of time to wrap my head around how they work but eventually I figured things out and realized that the problem is in the division of the border into different areas.

The images below aren’t accurate as far as the scale of the area is concerned but it’s good enough to show the problem and how to solve it.

 

This was the older way the border was divided into 3 areas. The 2nd rect is stretched to fill the required width while the others are fixed in length. Also the title can only be printed at the start of an rect. This is why the title wouldn’t get centered.

To fix this we can instead divide the border into 5 rects. This time the 2nd and 4th rect are stretched to fill the remaining area while the 3rd one is of the size of the title. This way we can center the 3rd rect and the title with it.

The other problem was that active windows also shared the same set of offsets as the inactive ones. This wasn’t a problem when we were just printing the title in the beginning but with it being centered, I now had to make sure that the same offsets also worked with the active window borders. This required some tedious redrawing and testing but eventually I got it to work too.

After this I starting working on the leftover tasks from the previous work. There’s also the task of adding support for the Apple IIgs version of the games and that’s what I am working on right now.

That’s it for this week. Thanks for reading and see you next week.

Week 11 – Finishing WAGE and PINK

After last week’s blog post I opened the PR for both WAGE and PINK to get them reviewed. Let’s start with PINK:

For PINK there was a regression caused by a later commit which broke some things. The problem was that the window mode wasn’t being set and the fix was really easy. A bigger problem was the Hebrew text wasn’t being rendered properly. It has been there from the start but I never noticed it because I can’t read it.

The text is reversed and the borders are broken

Thanks to discord user rzil for the help with the hebrew text. It was kinda hard dealing with text you can’t read and it being an RTL language just made things more annoying. What I ended up having to do was to render the text in reverse order and that was enough to fix it.

Fixed!

With this PINK was done and it got merged.

WAGE spent quite some time in review. The first major issue was Engine code being called from inside Graphics. Another issue was with how I had solved some game specific issues. I had implemented some game specific hacks but a general solution was desirable.

Most of the issues were caused because of how object click detection was implemented. In the current system, each object had it’s own screen to draw on. To detect clicks, ScummVM would just see if something was drawn at that pixel. This was however too precise because the original game seemed to count any click inside the bounding box of the object. I rewrote the object detection code to work like that and it fixed all issues.

There was also a problem with how the bounds of the objects were calculated. Fixing that fixed the issues with cropped bitmaps.

Some formatting issues needed to be fixed too but after that WAGE finally got merged. However there are still some things which need to be addressed. Some functions were stubbed (not implemented) so I worked on those. There’s are some some TODOs from the original JAVA implementation which need to be looked at.

And that’s where I am right now.

Thanks for reading and see you next week!