Page 1 of 1
Questions about currently undocumented functions
Posted: Tue Apr 26, 2011 12:14 pm
by Gambit37
I'm finding functions in the wiki that have no docs yet, will ask about them here:
dsb_viewport_distort(effect)
Sounds interesting! What does this do and how can we use it?
dsb_animate(bitmap, frames, frame_delay)
Can we get an example? I'm not clear how to define the sequence of frames?
Re: Questions about currently undocumented functions
Posted: Tue Apr 26, 2011 8:06 pm
by Joramun
Gambit37 wrote:I'm finding functions in the wiki that have no docs yet, will ask about them here:
dsb_viewport_distort(effect)
Sounds interesting! What does this do and how can we use it?
The viewport distort is a function that displaces the pixels.
A good example can be found in MFI's dungeon with the Quake "underwater effect"
gfx.bmp = dsb_animate(bitmap, frames, frame_delay)
Can we get an example? I'm not clear how to define the sequence of frames?
This one is very easy: it cuts "
bitmap" horizontally into a number (
frames) of sub-bitmaps and switches the bitmap displayed on screen by the next sub-bitmaps every "
frame_delay" (number of ticks)
Example: Say you have two images of the same size: Goblin, and goblin frowning, and want the front view of the goblin to alternate every 3 frames. Make one image, double-horizontal size (named double_goblin), with one copy on the left half, the other on the right half, and do:
gfx.goblin_anim = dsb_animate(double_goblin, 2, 3)
Am I clear ? I'll release a dungeon with a lot of stuff like that

Re: Questions about currently undocumented functions
Posted: Tue Apr 26, 2011 8:16 pm
by Gambit37
Joramun wrote:The viewport distort is a function that displaces the pixels.
A good example can be found in MFI's dungeon with the Quake "underwater effect"
Oooh, sounds nice, I'll have to check that out. Is there a download somewhere?
Joramun wrote:Make one image, double-horizontal size (named double_goblin), with one copy on the left half, the other on the right half
Oh, that's annoying. I build up frames in layers in a Photoshop document, then export each layer to it's own image. Having to then put all that into a super wide image is extra work and makes creating animations less flexible (if you want to add an extra frame, that's a lot of fiddling with moving things around and making a space). It also means if you have 20 frames of a 640px image, your image will be way too wide to view as thumbnails in Windows Explorer, which I use to rapidly identify resources.
I wonder if this can be improved to use a table of individual files instead?
Re: Questions about currently undocumented functions
Posted: Tue Apr 26, 2011 8:52 pm
by Sophia
If you want to just test it out, add something like this to your startup code:
Code: Select all
function go_underwater()
dsb_viewport_distort(DISTORTION_UNDERWATER)
end
Then just invoke it via a "function_caller" somewhere.
There will be other distortions in DSB 0.48, and I'll try to better document it then.
Gambit37 wrote:I wonder if [dsb_animate] can be improved to use a table of individual files instead?
Good idea. I'll look into doing exactly that.
Re: Questions about currently undocumented functions
Posted: Tue Apr 26, 2011 9:46 pm
by Gambit37
I tried doing the distortion by assigning the function to a wall button -- when I press it, everything goes black!?
Re: Questions about currently undocumented functions
Posted: Tue Apr 26, 2011 9:54 pm
by Sophia
It's very murky water...
...
I have a few bugs to fix, it seems.