Page 11 of 15

Re: Questions about DSB/ESB

Posted: Mon Dec 17, 2018 12:08 am
by Gambit37
How can I change the x/y/w/h of the portrait area overlays for the conditions C_SHIELD, C_SPELLSHIELD and C_FIRESHIELD?

Re: Questions about DSB/ESB

Posted: Mon Dec 17, 2018 11:23 pm
by Sophia
I'm not entirely sure what you're asking. They're just bitmaps, so you can change the width and height by just having a different size bitmap, and you can tweak their positioning with x_off and y_off as normal. Does that help?

Re: Questions about DSB/ESB

Posted: Mon Dec 17, 2018 11:26 pm
by Gambit37
Oh, I didn't think that UI graphics used any of the x_off, y_off properties, I thought that was just for everything in the game viewport. OK, thank you.

Re: Questions about DSB/ESB

Posted: Mon Dec 17, 2018 11:35 pm
by Gambit37
I just tried that and nothing changed. The gfx.fireshield / blueshield / spellshield dotted lines are still rendered at 0,0 relative to the parent bitmap. Not to worry though, I can just make the whole thing the same size in power pink and move the contents around inside the pink area to get it where I want.

Re: Questions about DSB/ESB

Posted: Mon Dec 17, 2018 11:36 pm
by Sophia
Oh, yeah. Now that I think about it, this might not work because the bitmap is asserted in the base code and then you are trying to change it after the condition is already defined.

The fix there is to re-assert the conditions after you've changed the bitmaps to your liking:

Code: Select all

dsb_replace_condition(C_SHIELD, INDIVIDUAL, nil, gfx.blueshield, 0, nil)
dsb_replace_condition(C_SPELLSHIELD, INDIVIDUAL, nil, gfx.spellshield, 0, nil)
dsb_replace_condition(C_FIRESHIELD, INDIVIDUAL, nil, gfx.fireshield, 0, nil)

Re: Questions about DSB/ESB

Posted: Mon Dec 17, 2018 11:54 pm
by Gambit37
Ah right, thanks. Just tried that and it works :)

Re: Questions about DSB/ESB

Posted: Wed Dec 19, 2018 11:33 am
by Gambit37
If I have this:

Code: Select all

variable_containing_an_object_id = 1234
exvar[variable_containing_an_object_id].new_exvar = true
can I do something like this?

Code: Select all

variable_containing_an_object_id = 1234
e = exvar[variable_containing_an_object_id]
e.new_exvar = true
I'm getting bored writing long exvar IDs in my code and would like to use shorter aliases if possible?

Re: Questions about DSB/ESB

Posted: Tue Mar 03, 2020 3:01 pm
by Gambit37
When rendering elements using the sys_render_other function, is there a way to know if the inventory view is currently being displayed?

That function does have a frozen parameter, but it would be cool to also receive in_inv in there too, if it's not already possible some other way?

Re: Questions about DSB/ESB

Posted: Tue Mar 03, 2020 6:17 pm
by Sophia
You can use dsb_current_inventory, which returns the party position (ppos) of the inventory being viewed (which you can translate to a character index with dsb_ppos_char), or nil if you aren't looking at an inventory.

Example

Code: Select all

local current_inv_ppos = dsb_current_inventory()
if (current_inv_ppos) then
   local current_inv = dsb_ppos_char(current_inv_ppos)
   -- do stuff here
end

Re: Questions about DSB/ESB

Posted: Tue Mar 03, 2020 7:23 pm
by Gambit37
Ah nice, somehow I totally missed that in the wiki. Thank you.

Re: Questions about DSB/ESB

Posted: Wed Mar 11, 2020 11:08 am
by Gambit37
Is there a way of increasing the time that the boosted stats/skills/eye border colour remain onscreen?

Also, shouldn't boosted stats be shown in green on the maximum value? I only ever see the lower value shown in red. It sort of looks weird not to highlight the boosted stat and instead show a "warning" colour on the currently lower value? That said, I honestly can't remember how original DM did it...!

Re: Questions about DSB/ESB

Posted: Wed Mar 11, 2020 10:18 pm
by Sophia
Not currently, but in 0.76 you'll be able to modify inventory_info.stats.boost_highlight_time to control the number of ticks that the boost remains visible.

In original DM, when you gained a level, the new stat was just in red, so this is how DSB works as well, at least for now. For 0.76 I've changed it so that the eye's border is green instead of red when you've just leveled up, though.

Re: Questions about DSB/ESB

Posted: Wed Mar 11, 2020 11:00 pm
by Gambit37
Flippin' amazing once again, thank you! :)

Re: Questions about DSB/ESB

Posted: Thu Mar 12, 2020 12:06 am
by ChristopheF
My ReDMCSB source code shows that in the original DM/CSB, the current statistic values are displayed in red if lower than the maximum value, in green if greater than the maximum or in gray if equal to the maximum.
In the latest versions only (DM PC-9801 and all 3.x versions), after a skill level is gained, the next time the skills and statistics values are displayed, recently upgraded skills are displayed in green, otherwise in gray.
Older versions always display skill levels in gray.

Re: Questions about DSB/ESB

Posted: Thu Mar 12, 2020 8:33 am
by Gambit37
Thank you for clarifying, Christophe. My memory is playing tricks on me!

Re: Questions about DSB/ESB

Posted: Thu Mar 12, 2020 8:35 am
by Gambit37
Is it more memory efficient to load four separate bitmaps, or one bitmap with all four images combined and then use DSB functions to carve it up?

Re: Questions about DSB/ESB

Posted: Thu Mar 12, 2020 9:28 pm
by Sophia
I don't actually know, but I don't think it matters much either way.

The main thing that you have to watch out for in terms of memory usage is that you get rid of the old bitmap after you've carved it up, or it'll be sitting around wasting memory. If you delete all references to a bitmap, then the Lua garbage collector will scoop it up.

Re: Questions about DSB/ESB

Posted: Wed Mar 18, 2020 9:55 am
by Gambit37
Regarding "empty hand" subrenderers (mouth, eye), is it possible to completely intercept that click and do nothing at all? At the moment, I know I can override them in the hooks file by passing true to the relevant hook, but this also removes any existing subrenderers currently displayed. Instead, I'd like these clicks to simply leave the display as it is, and do nothing at all. Is that possible?

Re: Questions about DSB/ESB

Posted: Wed Mar 18, 2020 9:33 pm
by Sophia
I'm not totally sure if I understand what you're asking for, but if you're saying you want to just keep drawing the same thing, wouldn't the simplest approach be to just directly call whatever function that draws what you want to draw, and then return true?

Re: Questions about DSB/ESB

Posted: Wed Mar 18, 2020 10:10 pm
by Gambit37
Heh, yeah I realised after I posted that I could just restructure my functions and reuse them across the existing subrender hooks. Thanks.

Re: Questions about DSB/ESB

Posted: Sun Mar 22, 2020 12:34 am
by Gambit37
I just realised something awful: the changes I've made to the invetory UI completely break the resurrect/reincarnate interface -- in so far as it's now not possible to inspect all the champion's stats when the resurrect subrenderer is displayed... I know you've previously said that the resurrect subrenderer code is messy and hard coded... but I was wondering if this is something that you might consider reviewing? I'd love to be able to use the sys_render_other function to handle resurrect/reincarnate by completely changing its look and moving somewhere else on screen...

Re: Questions about DSB/ESB

Posted: Mon Mar 23, 2020 6:10 pm
by Sophia
I don't really have any interest in delving into that mess of code right now and rewriting it all in Lua, but fortunately there is probably something that is quite a bit easier for me that should still allow things to work somewhat the way you want. Since the resurrection and reincarnation interface is such a mess, it is not a proper subrenderer, but more its own thing that pretends to act like one. This is advantageous here, though; I'll just add an option to gui_info to allow the resurrection and reincarnation options to be rendered as a separate graphics element like the other stuff in gui_info rather than as a (fake) subrenderer. If you do it that way, it should hopefully work somewhat like what you were hoping to do, though the clickzones themselves will still be sort of hardcoded.

Re: Questions about DSB/ESB

Posted: Mon Mar 23, 2020 6:49 pm
by Gambit37
That sounds cool, thanks :) Would the overall size still be 246x146?

Re: Questions about DSB/ESB

Posted: Mon Mar 23, 2020 7:13 pm
by Gambit37
Just thinking about this some more: I think I can get around the issue by using sys_render_other already. The only thing I'm not sure about is whether or not I can test for "is player viewing the inventory of a not-yet-resurrected champion?" If I can test for the resurrect interface being displayed, then I can add some extra small controls to that view to allow the player to also view the character's stats.

Re: Questions about DSB/ESB

Posted: Mon Mar 23, 2020 7:22 pm
by Sophia
The size would be the size of whatever bitmap you used.

The way I've designed it currently, if the resurrection and reincarnation interface is onscreen and not a subrenderer, the stats are drawn in the normal place. I can change this if you want to but I thought it was sensible default behavior.

Re: Questions about DSB/ESB

Posted: Mon Mar 23, 2020 7:51 pm
by Gambit37
Unfortunately that won't work for my changes, because I no longer show stats anywhere except in the subrenderer area: it's a four tab self contained interface that occupies the subrender area. (I think I showed you previously but not sure). I think maybe I've pushed too far away from the DM way with these changes...!

Re: Questions about DSB/ESB

Posted: Mon Mar 23, 2020 8:20 pm
by Sophia
I don't really understand why it won't work. It seems like we're sort of saying the same thing.

So let me ask this way. What do you want to have shown in the subrenderer area if the resurrection and reincarnation interface is onscreen but not being drawn there? Or, perhaps, the real question for me as a developer to ask is, which rendering function should be called at that time?

Re: Questions about DSB/ESB

Posted: Mon Mar 23, 2020 11:05 pm
by Gambit37
I'll PM you, easier to explain with a visual...

Re: Questions about DSB/ESB

Posted: Sun Mar 29, 2020 4:01 am
by Gambit37
What's the right way to determine if an item is currently "in" the mouse pointer, ie, being held by the leader? Is it possible?
EDIT: Never mind, I just found it in the base code.

Re: Questions about DSB/ESB

Posted: Sun Mar 29, 2020 4:48 am
by Gambit37
I'm trying to draw a bitmap with an alpha channel onto the bitmap in sys_render_other. The sys_render_other bitmap is cleared to powerpink. The powerpink bitmap is fully transparent in game as expected. But when the alpha channel bitmap is added to the powerpink transparent bitmap, it gets "merged" and the powerpink becomes visible, showing as a horrible fringe round the alpha channel.

I think I've had this issue before, but don't recall how to solve it...?