Better wall writing...?
Moderator: Sophia
Forum rules
Please read the Forum rules and policies before posting.
Please read the Forum rules and policies before posting.
- Gambit37
- Should eat more pies
- Posts: 13720
- Joined: Wed May 31, 2000 1:57 pm
- Location: Location, Location
- Contact:
Better wall writing...?
I'd like to change the "carved stone" wall-writing into text that's displayed on a nice plaque, or tapestry.
I know there's a wall-writing render hack which manages all the masking and cropping for wall text. I think I can still use this, but I'm not sure how to render that text into a new bitmap of my plaque/tapestry?
I did try just placing a tapestry under the wallwriting object in ESB, but DSB doesn't render anything else if wallwriting exists on a wall.
What would be the right way to do this? If it's even doable?
I know there's a wall-writing render hack which manages all the masking and cropping for wall text. I think I can still use this, but I'm not sure how to render that text into a new bitmap of my plaque/tapestry?
I did try just placing a tapestry under the wallwriting object in ESB, but DSB doesn't render anything else if wallwriting exists on a wall.
What would be the right way to do this? If it's even doable?
- Sophia
- Concise and Honest
- Posts: 4240
- Joined: Thu Sep 12, 2002 9:50 pm
- Location: Nowhere in particular
- Contact:
Re: Better wall writing...?
It isn't that DSB doesn't render anything if wallwriting exists on a wall, but rather that the DM dungeon sets a compatibility flag in DSB to only render one wallitem per wall. You can turn this off and your background will look right, but there will be graphical glitches elsewhere in the dungeon because the original DM engine worked this way so other mechanics kind of rely on it.
- Gambit37
- Should eat more pies
- Posts: 13720
- Joined: Wed May 31, 2000 1:57 pm
- Location: Location, Location
- Contact:
Re: Better wall writing...?
Looks like I can do it using an alternate wall set with the plaque/tapestry pre-composed, and then just paint that wallset onto tiles where there's writing. Bit more fiddly, but it works
But I still need to do some tweaks to the writing functions, so I was wondering, can you explain how wallwriting_alter function works? I don't quite follow what it's doing...
But I still need to do some tweaks to the writing functions, so I was wondering, can you explain how wallwriting_alter function works? I don't quite follow what it's doing...
- Sophia
- Concise and Honest
- Posts: 4240
- Joined: Thu Sep 12, 2002 9:50 pm
- Location: Nowhere in particular
- Contact:
Re: Better wall writing...?
The purpose of wallwriting_alter is to modify the scribbly-looking "distant wallwriting" bitmap so that it looks like an approximation of the actual wall writing. It does this by grabbing the length of each string of the wall writing and drawing rectangles of power pink to cover up the unneeded parts of the image. The coordinates are specified as floating point multipliers instead of as absolute coordinates so that the code will (more or less) work right for any size image and at any level of scaling.
- Gambit37
- Should eat more pies
- Posts: 13720
- Joined: Wed May 31, 2000 1:57 pm
- Location: Location, Location
- Contact:
Re: Better wall writing...?
OK, thanks. I can't get the results I want with the built in wall-writing renderer, so I'm going to take another approach. Not sure if it'll work but I have some ideas...
- Gambit37
- Should eat more pies
- Posts: 13720
- Joined: Wed May 31, 2000 1:57 pm
- Location: Location, Location
- Contact:
Re: Better wall writing...?
So now I'm playing around with the bitmap tweaker. Fun, and confusing times!
- Gambit37
- Should eat more pies
- Posts: 13720
- Joined: Wed May 31, 2000 1:57 pm
- Location: Location, Location
- Contact:
Re: Better wall writing...?
With the bitmap tweaker, are there any performance issues I should be aware of? Would it be a problem to use dsb_new_bitmap here?
Also, does the bitmap tweaker get any information about the position that the instance of the arch is currently displayed in? I need to do my own dynamic scaling of the text depending if it's front1, front2, front3 etc but I'm not sure how to check for that...?
Also, does the bitmap tweaker get any information about the position that the instance of the arch is currently displayed in? I need to do my own dynamic scaling of the text depending if it's front1, front2, front3 etc but I'm not sure how to check for that...?
- Gambit37
- Should eat more pies
- Posts: 13720
- Joined: Wed May 31, 2000 1:57 pm
- Location: Location, Location
- Contact:
Re: Better wall writing...?
Not sure you saw my above queries, but not to worry, I've mostly fixed my wallwriting object now:
I have a second wallset with a wallwriting "panel" pre-drawn at every facing. When the wallwriting is spawned, it calls a function to change the wallset at the object location to the alternate pre-drawn panelled wallset. Works great!
Except, there's one small problem remaining: how do I also change the wallset when wallwriting is triggered between active/inactive?
I tried using the same function in the on_trigger property but nothing happens. So things like the "this wall says nothing" and "you will regret that" in DM don't work, because the panel doesn't disappear when the wallwriting is inactive.
Here's the function:
I have a second wallset with a wallwriting "panel" pre-drawn at every facing. When the wallwriting is spawned, it calls a function to change the wallset at the object location to the alternate pre-drawn panelled wallset. Works great!
Except, there's one small problem remaining: how do I also change the wallset when wallwriting is triggered between active/inactive?
I tried using the same function in the on_trigger property but nothing happens. So things like the "this wall says nothing" and "you will regret that" in DM don't work, because the panel doesn't disappear when the wallwriting is inactive.
Here's the function:
Code: Select all
obj.wallwriting.on_spawn = function(arch, id, lev, x, y, d)
if (not exvar[id] or not exvar[id].text) then return false end
local inactive = dsb_get_gfxflag(id, GF_INACTIVE)
if (inactive) then
dsb_alt_wallset(wallset.default, lev, x, y, d)
else
dsb_alt_wallset(wallset.wallwriting, lev, x, y, d)
end
end
- Sophia
- Concise and Honest
- Posts: 4240
- Joined: Thu Sep 12, 2002 9:50 pm
- Location: Nowhere in particular
- Contact:
Re: Better wall writing...?
Sorry, I missed the questions above. I'm glad you got it working.
The issue is that on_trigger is called by the engine when the party steps on a square or when you drop an item there. It's for handling pressure pads and teleporters and things like that. If you're activating and deactivating wallwriting, then you're handling messages, so you probably want to define a custom message handler that toggles the wallset and put it in obj.wallwriting.msg_handler.
Something like this
(Not tested, so check for typos if it doesn't work)
You'll need to add obj.wallwriting.msg_handler = wallwriting_msg_handler to your objects.lua of course.
I hope this helps. There are some other good examples of how to set up a message handler in base/msg_handlers.lua
The issue is that on_trigger is called by the engine when the party steps on a square or when you drop an item there. It's for handling pressure pads and teleporters and things like that. If you're activating and deactivating wallwriting, then you're handling messages, so you probably want to define a custom message handler that toggles the wallset and put it in obj.wallwriting.msg_handler.
Something like this
(Not tested, so check for typos if it doesn't work)
Code: Select all
function enable_wallwriting(id)
local lev, x, y, d = dsb_get_coords(id)
object_enable(id)
dsb_alt_wallset(wallset.wallwriting, lev, x, y, d)
end
function disable_wallwriting(id)
local lev, x, y, d = dsb_get_coords(id)
object_disable(id)
dsb_alt_wallset(wallset.default, lev, x, y, d)
end
function toggle_wallwriting(id)
local lev, x, y, d = dsb_get_coords(id)
object_toggle(id)
if (dsb_get_gfxflag(id, GF_INACTIVE)) then
dsb_alt_wallset(wallset.default, lev, x, y, d)
else
dsb_alt_wallset(wallset.wallwriting, lev, x, y, d)
end
end
wallwriting_msg_handler = {
[M_ACTIVATE] = "enable_wallwriting",
[M_DEACTIVATE] = "disable_wallwriting",
[M_TOGGLE] = "toggle_wallwriting"
}
I hope this helps. There are some other good examples of how to set up a message handler in base/msg_handlers.lua
- Gambit37
- Should eat more pies
- Posts: 13720
- Joined: Wed May 31, 2000 1:57 pm
- Location: Location, Location
- Contact:
Re: Better wall writing...?
Ah, Messages! The one part of DSB I've avoided so far, despite knowing that it's core and powerful... Thanks for this, I'll explore it as a solution.
Is there any trick to understanding the messaging system? I seem to struggle with abstract systems like this. It's why I'll never be a hardcore programmer and am content to just do simple loops and basic logic
(Oh, by the way, elsewhere I mentioned I was using combined front/side views for some of my wall graphics. I had to revert to the normal DSB wall graphics with all the individual pieces, because the combined graphics totally messed up alternate wallsets which I'd forgotten about...)
Is there any trick to understanding the messaging system? I seem to struggle with abstract systems like this. It's why I'll never be a hardcore programmer and am content to just do simple loops and basic logic
(Oh, by the way, elsewhere I mentioned I was using combined front/side views for some of my wall graphics. I had to revert to the normal DSB wall graphics with all the individual pieces, because the combined graphics totally messed up alternate wallsets which I'd forgotten about...)
- Sophia
- Concise and Honest
- Posts: 4240
- Joined: Thu Sep 12, 2002 9:50 pm
- Location: Nowhere in particular
- Contact:
Re: Better wall writing...?
As you probably already understand, a message is just how one inst can send information or commands to another inst. For example, a button telling a door to open, or a pressure pad telling a monster generator to generate some monsters, or whatever. A "message" is really just a set of integers: a message code (e.g., activate, deactivate, etc.) and some data, like the target inst or whatever. A message handler is just a set of Lua functions that get called in response to certain messages with the data passed as parameters to the function.
The simplest trick to understanding how this works is probably looking at the function_caller archetype, because that exposes the basic core of the messaging system directly to the designer. You specify the name of a function to be called in response to certain messages and it just calls the function directly.
The simplest trick to understanding how this works is probably looking at the function_caller archetype, because that exposes the basic core of the messaging system directly to the designer. You specify the name of a function to be called in response to certain messages and it just calls the function directly.