Questions about currently undocumented functions

This forum is for the Lua scriptable clone of DM/CSB called Dungeon Strikes Back by Sophia. Use DSB to build your own highly customised games.

Moderator: Sophia

Forum rules
Please read the Forum rules and policies before posting. You may Image to help finance the hosting costs of this forum.
Post Reply
User avatar
Gambit37
Should eat more pies
Posts: 13773
Joined: Wed May 31, 2000 1:57 pm
Location: Location, Location
Contact:

Questions about currently undocumented functions

Post 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?
User avatar
Joramun
Mon Master
Posts: 927
Joined: Thu May 25, 2006 7:05 pm
Location: The Universe

Re: Questions about currently undocumented functions

Post 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 :)
What Is Your Quest ?
User avatar
Gambit37
Should eat more pies
Posts: 13773
Joined: Wed May 31, 2000 1:57 pm
Location: Location, Location
Contact:

Re: Questions about currently undocumented functions

Post 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?
User avatar
Sophia
Concise and Honest
Posts: 4307
Joined: Thu Sep 12, 2002 9:50 pm
Location: Nowhere in particular
Contact:

Re: Questions about currently undocumented functions

Post 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.
User avatar
Gambit37
Should eat more pies
Posts: 13773
Joined: Wed May 31, 2000 1:57 pm
Location: Location, Location
Contact:

Re: Questions about currently undocumented functions

Post by Gambit37 »

I tried doing the distortion by assigning the function to a wall button -- when I press it, everything goes black!?
User avatar
Sophia
Concise and Honest
Posts: 4307
Joined: Thu Sep 12, 2002 9:50 pm
Location: Nowhere in particular
Contact:

Re: Questions about currently undocumented functions

Post by Sophia »

It's very murky water...

... :?

I have a few bugs to fix, it seems.
Post Reply