wtorek, 24 czerwca 2014

Dialog frame and rest of mouse handling

Hello everyone!

This is very difficult week for me - final exams at university and midterm evaluation of GSoC at the same time. I'm doing my best to combine these two and I hope you'll like my weekly progress.
So, here we go:

At the beginning of a week I was working on implementing dialog box frames. I manage to finish it and it's drawing everything in right position now (long sentences are cut properly). Mouse handling and highlighting is working fine too. On the video and on first screenshot you can see temporary texts. It's not loading actual texts from game data yet - it needs more work at script part to be finished.

I was also fixing some of existing functions, like showTexts(). I had to change calculations of texts position to adjust it for heroTalk() function and other texts that will be shown above heads of characters. It's now using width of longest line to find a center and it's also drawing correctly at the edge of screen and in wider locations.

I also mange to do cursor changing function (screenshot no. 3) and rest of left and right mouse button handling to finish choosing from option frame (Give, Use, Open/Push, Close/Pull) in inventory.
Most of mouse button handling outside of inventory is working too.

At the end of a week I also asked wjp for help with my git repository. I had a job to recover history of malik's commits in my branch instead of initial commit that I create at the beginning of GSoC from existing Prince codes. Everything is working excellent now, so again - many thanks to wjp ;)

You can see my progress on screenshots below or watch it here: https://www.youtube.com/watch?v=V44Dbpdbxm8


Dialog box drawing
Highlighting one of options


Hero talking - working animation
Texts from dialog box in correct position

Cursor changing
Use / Give - working inventory options

This week I'll try to take a look at script part to check if I can connect existing mouse events (and their op codes) with simple actions, like drawing texts for mobs examining outside of inventory. I'm also looking at pathfinding part right now, but it still looks very complex. I'll also try to check and fix some memory problems and do some clean up in existing code.

wtorek, 17 czerwca 2014

Options menu and item examining

Hello everyone!

I would like to show you my weekly progress. I was working on left and right mouse button events and I finished drawing options menu and displaying short descriptions of items in inventory.

I had to check position of cursor to find which mob (item / object) is selected. Then if LMB is pressed I play voice sample and load proper text for calculated amount of time. If LMB is pressed again (during the voice sample) it cancel playing the sample and turn off text instantly. During this event mouse cursor is invisible and you can't leave the inventory.

RMB allows to display options menu for selected item. Selected option is highlighted properly. We have to check if cursor stays inside of rect of menu, otherwise we turn it off.
 "Examine" - first option in inventory menu starts same event as LMB click on item. I have to implement events for rest of options now.

You can check all of these on screenshots below or on video here, first time with sound ;)
https://www.youtube.com/watch?v=yPc_FXlAHyE



Drawing exam texts of items in inventory
Options menu outside of inventory
Options menu in inventory

I was also working on fixing letters from German version of game in intro animation, options menu and exam texts and it seems to be fine now:

German letters drawing in intro, options menu and exam texts

Next thing that I will implement will be probably cursor changing for "Use" and "Give" menu options. I also start working on dialog windows part.

wtorek, 10 czerwca 2014

Inventory implementation

Hello everyone!

I would like to show you my new progress. Like i wrote in my last post I'm working on inventory part right now. I have already implemented drawing the suitcase and loading sprites and texts for items. I managed to recreate animation of adding a new item with sound effect. Position of items in inventory is based on amount of them. I also handle proper opening and closing it by mouse and drawing names of item selected by a cursor.

 There were also two additional parts of code that had to be done - drawing animation of candle (it's the only one animated inventory item) and also gravedigger's curse animation for four items (immortality elixir, amulet, gem and dagger) for first location. Animation of adding new item and gravedigger's curse use other algorithm of calculating frame colors (which creates blinking effect). You can see that on screenshots below or on short video right here: https://www.youtube.com/watch?v=TsaZnmblBgM

Inventory - dagger
Name drawing, mouse handling

Inventory - Gravedigger's curse
Items animation - blinking

Next things that I want to implement are left and right mouse button events for inventory (drawing short description of item and item options window). Some functions from inventory will be very useful for dialog windows part later.


wtorek, 3 czerwca 2014

Parallax sprites, masks and Z axis

Hello everyone!
There will be more pictures to show my progress this time. ;)

I was working harder at the weekend and was able to implement loading and displaying sprites that use parallax effect.
In simple words, in Prince these are bitmaps displaying as last, on top of everything else and scrolls faster then other animations while hero is moving in wider locations. It gives a feeling that this kind of objects are closest to the screen.
You can see them by finding differences in pictures below:


Parallax sprites - loc no. 2
Before (left) / After (right)


Parallax sprites - loc no. 2
Before (left) / After (right)

Parallax sprites - loc no. 4
Before (left) / After (right)

Parallax sprites - loc no. 4
Before (left) / After (right)

Next part I manage to code was masking sprites by parts of background.
Information about masking is loading for each location. Mask doesn't contain graphics data, just info about position and which pixels of background should be redrawn on top.
I recorded short video with mask debugging - https://www.youtube.com/watch?v=6bhaI_PDOdI.
It shows working algorithm of turning on and off proper masks. It depends on position of hero, background animations and objects, etc.

Masking - loc no. 3
Before (left) / After (right)

Masking - loc no. 5
Before (left) / After (right)

Last part that I code required some thinking before actual doing it. It was a problem of drawing everything I already had (sprites of hero, background animations, masks, parallax sprites, objects) on background in proper sequence of Z axis coordinate.
I decided to create structure similar to this one from original asm code - DrawNode. It contains all information about drawing element (e.g. position, width and height of sprite, pointer to sprite) and also pointer to function that will draw it later.
Each function of drawing add new DrawNode to an array. After creating whole array I'm sorting all of them by Z coordinate and then draw them. You can see working algorithm on pictures below and also on short video here: https://www.youtube.com/watch?v=jdwqNOwqG1s

Z axis - loc no. 1
Before (left) / After (right)

Z axis - loc no. 2
Before (left) / After (right)

Next things I'll try to implement will be probably inventory drawing functions or dialog / choice frames. I'm trying to get familiar with these parts of code now.

See you next time!